From: Andrea Bianco Date: Sun, 16 Jan 2022 17:28:52 +0000 (+0100) Subject: Built motion from commit 8a7b3435.|2.5.48 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=baf1f63884cd6848362e71e3b15b71e4c71a9aa4;p=motion2.git Built motion from commit 8a7b3435.|2.5.48 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 3e46f52..dbe2a97 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-01-16T15:10:30.694Z", + "time": "2022-01-16T17:09:59.176Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 683a76f..8c7db2a 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-16T15:10:30.694Z", + "time": "2022-01-16T17:09:59.176Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index f10eb21..38ff775 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 _0x7bb4=['urlForward[body]','exports','VIRTUAL','action','STRING','contactManager','motionbar','jscripty','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7bb4,0x191));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x47bb('0x0')]={'name':{'type':Sequelize[_0x47bb('0x1')],'get':function(_0x527a85){return this['getDataValue'](_0x47bb('0x2'));}},'action':{'type':Sequelize[_0x47bb('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x47bb('0x4'),'integration',_0x47bb('0x5'),_0x47bb('0x6'),'urlForward',_0x47bb('0x7'),_0x47bb('0x8'),'script']],'msg':_0x47bb('0x9')}},'comment':_0x47bb('0x9')},'data1':{'type':Sequelize[_0x47bb('0x3')](0x1000),'comment':_0x47bb('0xa')},'data2':{'type':Sequelize[_0x47bb('0x3')](0x1000),'comment':_0x47bb('0xb')},'data3':{'type':Sequelize[_0x47bb('0x3')](0x1000),'comment':_0x47bb('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x47bb('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x47bb('0xe')},'data6':{'type':Sequelize[_0x47bb('0x3')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x47bb('0xf')}}; \ No newline at end of file +var _0xb925=['VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','TEXT','urlForward[body]','sequelize'];(function(_0x359142,_0xe40ace){var _0x17d338=function(_0xdba3e4){while(--_0xdba3e4){_0x359142['push'](_0x359142['shift']());}};_0x17d338(++_0xe40ace);}(_0xb925,0x155));var _0x5b92=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0xb925[_0x2baca1];return _0x9aa62a;};'use strict';var Sequelize=require(_0x5b92('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b92('0x1')],'get':function(_0x47be10){return this[_0x5b92('0x2')](_0x5b92('0x3'));}},'action':{'type':Sequelize[_0x5b92('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5b92('0x5'),_0x5b92('0x6'),_0x5b92('0x7'),_0x5b92('0x8'),_0x5b92('0x9'),_0x5b92('0xa'),_0x5b92('0xb'),_0x5b92('0xc')]],'msg':_0x5b92('0xd')}},'comment':_0x5b92('0xd')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x5b92('0xe')},'data2':{'type':Sequelize[_0x5b92('0x4')](0x1000),'comment':_0x5b92('0xf')},'data3':{'type':Sequelize[_0x5b92('0x4')](0x1000),'comment':_0x5b92('0x10')},'data4':{'type':Sequelize[_0x5b92('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x5b92('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x5b92('0x11')],'comments':_0x5b92('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 819888d..0a4e090 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 _0x03c5=['Action','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','update','body'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x03c5,0x1a2));var _0x503c=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0x03c5[_0x3cb152];return _0x4f54c3;};'use strict';var emlformat=require(_0x503c('0x0'));var rimraf=require(_0x503c('0x1'));var zipdir=require(_0x503c('0x2'));var jsonpatch=require(_0x503c('0x3'));var rp=require('request-promise');var moment=require(_0x503c('0x4'));var BPromise=require(_0x503c('0x5'));var Mustache=require(_0x503c('0x6'));var util=require('util');var path=require(_0x503c('0x7'));var sox=require('sox');var csv=require(_0x503c('0x8'));var ejs=require(_0x503c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x503c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x503c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x503c('0x8'));var querystring=require(_0x503c('0xc'));var Papa=require(_0x503c('0xd'));var Redis=require(_0x503c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x503c('0xf'));var logger=require(_0x503c('0x10'))(_0x503c('0x11'));var utils=require(_0x503c('0x12'));var config=require(_0x503c('0x13'));var licenseUtil=require(_0x503c('0x14'));var db=require(_0x503c('0x15'))['db'];function respondWithStatusCode(_0x80722b,_0x5f5f0b){_0x5f5f0b=_0x5f5f0b||0xcc;return function(_0x2f4c40){if(_0x2f4c40){return _0x80722b[_0x503c('0x16')](_0x5f5f0b);}return _0x80722b[_0x503c('0x17')](_0x5f5f0b)[_0x503c('0x18')]();};}function respondWithResult(_0x493ef5,_0x247a27){_0x247a27=_0x247a27||0xc8;return function(_0xe962fd){if(_0xe962fd){return _0x493ef5[_0x503c('0x17')](_0x247a27)[_0x503c('0x19')](_0xe962fd);}};}function respondWithFilteredResult(_0x25bfe6,_0x477c36){return function(_0x1f2c39){if(_0x1f2c39){var _0x485bd8=typeof _0x477c36[_0x503c('0x1a')]===_0x503c('0x1b')&&typeof _0x477c36[_0x503c('0x1c')]===_0x503c('0x1b');var _0x3f8f1b=_0x1f2c39[_0x503c('0x1d')];var _0x23ecf2=_0x485bd8?0x0:_0x477c36[_0x503c('0x1a')];var _0x201425=_0x485bd8?_0x1f2c39[_0x503c('0x1d')]:_0x477c36[_0x503c('0x1a')]+_0x477c36[_0x503c('0x1c')];var _0x16de92;if(_0x201425>=_0x3f8f1b){_0x201425=_0x3f8f1b;_0x16de92=0xc8;}else{_0x16de92=0xce;}_0x25bfe6[_0x503c('0x17')](_0x16de92);return _0x25bfe6[_0x503c('0x1e')](_0x503c('0x1f'),_0x23ecf2+'-'+_0x201425+'/'+_0x3f8f1b)[_0x503c('0x19')](_0x1f2c39);}return null;};}function patchUpdates(_0x52bf15){return function(_0x22563f){try{jsonpatch['apply'](_0x22563f,_0x52bf15,!![]);}catch(_0x2b3784){return BPromise[_0x503c('0x20')](_0x2b3784);}return _0x22563f[_0x503c('0x21')]();};}function saveUpdates(_0x368b00,_0x374bc3){return function(_0x2e2d2a){if(_0x2e2d2a){return _0x2e2d2a['update'](_0x368b00)['then'](function(_0x6825b1){return _0x6825b1;});}return null;};}function removeEntity(_0x1100e4,_0x466d0c){return function(_0x120b22){if(_0x120b22){return _0x120b22[_0x503c('0x22')]()[_0x503c('0x23')](function(){_0x1100e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be802,_0x58835d){return function(_0x25ad10){if(!_0x25ad10){_0x4be802[_0x503c('0x16')](0x194);}return _0x25ad10;};}function handleError(_0x5714da,_0x1f931a){_0x1f931a=_0x1f931a||0x1f4;return function(_0x544cb8){logger[_0x503c('0x24')](_0x544cb8[_0x503c('0x25')]);if(_0x544cb8[_0x503c('0x26')]){delete _0x544cb8[_0x503c('0x26')];}_0x5714da[_0x503c('0x17')](_0x1f931a)[_0x503c('0x27')](_0x544cb8);};}exports[_0x503c('0x28')]=function(_0x496603,_0x2362ab){if(_0x496603[_0x503c('0x29')]['id']){delete _0x496603[_0x503c('0x29')]['id'];}return db[_0x503c('0x2a')][_0x503c('0x2b')]({'where':{'id':_0x496603['params']['id']}})[_0x503c('0x23')](handleEntityNotFound(_0x2362ab,null))[_0x503c('0x23')](saveUpdates(_0x496603['body'],null))['then'](respondWithResult(_0x2362ab,null))[_0x503c('0x2c')](handleError(_0x2362ab,null));};exports[_0x503c('0x22')]=function(_0x47a329,_0x3a743b){return db[_0x503c('0x2a')][_0x503c('0x2b')]({'where':{'id':_0x47a329[_0x503c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3a743b,null))[_0x503c('0x23')](removeEntity(_0x3a743b,null))[_0x503c('0x2c')](handleError(_0x3a743b,null));}; \ No newline at end of file +var _0x6359=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','body','Action','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x444b5f,_0x4abe3e){var _0x5cda23=function(_0x277e7e){while(--_0x277e7e){_0x444b5f['push'](_0x444b5f['shift']());}};_0x5cda23(++_0x4abe3e);}(_0x6359,0xb0));var _0x9635=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6359[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x9635('0x0'));var rimraf=require(_0x9635('0x1'));var zipdir=require(_0x9635('0x2'));var jsonpatch=require(_0x9635('0x3'));var rp=require(_0x9635('0x4'));var moment=require('moment');var BPromise=require(_0x9635('0x5'));var Mustache=require(_0x9635('0x6'));var util=require('util');var path=require(_0x9635('0x7'));var sox=require(_0x9635('0x8'));var csv=require(_0x9635('0x9'));var ejs=require(_0x9635('0xa'));var fs=require('fs');var fs_extra=require(_0x9635('0xb'));var _=require(_0x9635('0xc'));var squel=require(_0x9635('0xd'));var crypto=require(_0x9635('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9635('0xf'));var toCsv=require(_0x9635('0x9'));var querystring=require(_0x9635('0x10'));var Papa=require(_0x9635('0x11'));var Redis=require(_0x9635('0x12'));var authService=require(_0x9635('0x13'));var qs=require(_0x9635('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9635('0x15'));var logger=require(_0x9635('0x16'))(_0x9635('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9635('0x18'));var db=require(_0x9635('0x19'))['db'];function respondWithStatusCode(_0x3aaec8,_0x56e60a){_0x56e60a=_0x56e60a||0xcc;return function(_0x312f9c){if(_0x312f9c){return _0x3aaec8[_0x9635('0x1a')](_0x56e60a);}return _0x3aaec8[_0x9635('0x1b')](_0x56e60a)[_0x9635('0x1c')]();};}function respondWithResult(_0x556f68,_0x168a6e){_0x168a6e=_0x168a6e||0xc8;return function(_0x496e5e){if(_0x496e5e){return _0x556f68[_0x9635('0x1b')](_0x168a6e)['json'](_0x496e5e);}};}function respondWithFilteredResult(_0x21baae,_0x58e950){return function(_0x453ef4){if(_0x453ef4){var _0x35de8e=typeof _0x58e950[_0x9635('0x1d')]===_0x9635('0x1e')&&typeof _0x58e950[_0x9635('0x1f')]===_0x9635('0x1e');var _0xaf1aa4=_0x453ef4['count'];var _0x21393b=_0x35de8e?0x0:_0x58e950[_0x9635('0x1d')];var _0x3180a6=_0x35de8e?_0x453ef4[_0x9635('0x20')]:_0x58e950[_0x9635('0x1d')]+_0x58e950[_0x9635('0x1f')];var _0x2b75e4;if(_0x3180a6>=_0xaf1aa4){_0x3180a6=_0xaf1aa4;_0x2b75e4=0xc8;}else{_0x2b75e4=0xce;}_0x21baae[_0x9635('0x1b')](_0x2b75e4);return _0x21baae['set'](_0x9635('0x21'),_0x21393b+'-'+_0x3180a6+'/'+_0xaf1aa4)[_0x9635('0x22')](_0x453ef4);}return null;};}function patchUpdates(_0x112a4d){return function(_0x5c1247){try{jsonpatch[_0x9635('0x23')](_0x5c1247,_0x112a4d,!![]);}catch(_0x26e737){return BPromise['reject'](_0x26e737);}return _0x5c1247[_0x9635('0x24')]();};}function saveUpdates(_0x418095,_0x50a007){return function(_0x266885){if(_0x266885){return _0x266885[_0x9635('0x25')](_0x418095)[_0x9635('0x26')](function(_0x598399){return _0x598399;});}return null;};}function removeEntity(_0x44fcd1,_0x1fa706){return function(_0x124895){if(_0x124895){return _0x124895[_0x9635('0x27')]()[_0x9635('0x26')](function(){_0x44fcd1[_0x9635('0x1b')](0xcc)[_0x9635('0x1c')]();});}};}function handleEntityNotFound(_0x5b564c,_0x1eb500){return function(_0x16e8dd){if(!_0x16e8dd){_0x5b564c[_0x9635('0x1a')](0x194);}return _0x16e8dd;};}function handleError(_0x29b019,_0x22c67a){_0x22c67a=_0x22c67a||0x1f4;return function(_0x423b10){logger[_0x9635('0x28')](_0x423b10[_0x9635('0x29')]);if(_0x423b10['name']){delete _0x423b10[_0x9635('0x2a')];}_0x29b019[_0x9635('0x1b')](_0x22c67a)[_0x9635('0x2b')](_0x423b10);};}exports['update']=function(_0x536177,_0x4e3c4b){if(_0x536177['body']['id']){delete _0x536177[_0x9635('0x2c')]['id'];}return db[_0x9635('0x2d')][_0x9635('0x2e')]({'where':{'id':_0x536177['params']['id']}})['then'](handleEntityNotFound(_0x4e3c4b,null))['then'](saveUpdates(_0x536177['body'],null))[_0x9635('0x26')](respondWithResult(_0x4e3c4b,null))[_0x9635('0x2f')](handleError(_0x4e3c4b,null));};exports[_0x9635('0x27')]=function(_0x486dd7,_0x39db69){return db[_0x9635('0x2d')][_0x9635('0x2e')]({'where':{'id':_0x486dd7[_0x9635('0x30')]['id']}})['then'](handleEntityNotFound(_0x39db69,null))['then'](removeEntity(_0x39db69,null))[_0x9635('0x2f')](handleError(_0x39db69,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c6b018c..9b6d260 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 _0xa7a6=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util'];(function(_0x5a8b3d,_0x540e49){var _0x5b619f=function(_0x55225f){while(--_0x55225f){_0x5a8b3d['push'](_0x5a8b3d['shift']());}};_0x5b619f(++_0x540e49);}(_0xa7a6,0x1d2));var _0x6a7a=function(_0x235983,_0xd22673){_0x235983=_0x235983-0x0;var _0x538b67=_0xa7a6[_0x235983];return _0x538b67;};'use strict';var _=require(_0x6a7a('0x0'));var util=require(_0x6a7a('0x1'));var logger=require(_0x6a7a('0x2'))(_0x6a7a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a7a('0x4'));var fs=require('fs');var path=require(_0x6a7a('0x5'));var rimraf=require(_0x6a7a('0x6'));var config=require(_0x6a7a('0x7'));var attributes=require(_0x6a7a('0x8'));module[_0x6a7a('0x9')]=function(_0x1b8027,_0x45e0b9){return _0x1b8027[_0x6a7a('0xa')](_0x6a7a('0xb'),attributes,{'tableName':_0x6a7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash'];(function(_0x533809,_0x2b71b2){var _0x52b96b=function(_0x3e0258){while(--_0x3e0258){_0x533809['push'](_0x533809['shift']());}};_0x52b96b(++_0x2b71b2);}(_0xba88,0xed));var _0x8ba8=function(_0xe472a,_0x2c29ac){_0xe472a=_0xe472a-0x0;var _0x257f3b=_0xba88[_0xe472a];return _0x257f3b;};'use strict';var _=require(_0x8ba8('0x0'));var util=require(_0x8ba8('0x1'));var logger=require(_0x8ba8('0x2'))(_0x8ba8('0x3'));var moment=require('moment');var BPromise=require(_0x8ba8('0x4'));var rp=require(_0x8ba8('0x5'));var fs=require('fs');var path=require(_0x8ba8('0x6'));var rimraf=require(_0x8ba8('0x7'));var config=require(_0x8ba8('0x8'));var attributes=require(_0x8ba8('0x9'));module[_0x8ba8('0xa')]=function(_0x4e7e2f,_0x7dc03){return _0x4e7e2f[_0x8ba8('0xb')](_0x8ba8('0xc'),attributes,{'tableName':_0x8ba8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 05e1cea..4d8bcc7 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x421a2d,_0xefe4a4){var _0x461f53=function(_0x42fdc3){while(--_0x42fdc3){_0x421a2d['push'](_0x421a2d['shift']());}};_0x461f53(++_0xefe4a4);}(_0x5fab,0x177));var _0xb5fa=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x5fab[_0x2125f0];return _0x12d6eb;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x27349a,_0x57b810){var _0xd806ec=function(_0x51ee49){while(--_0x51ee49){_0x27349a['push'](_0x27349a['shift']());}};_0xd806ec(++_0x57b810);}(_0x5fc3,0xa8));var _0x35fc=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x5fc3[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index fd1451d..046dcbd 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 _0xfbc5=['express','Router','fs-extra','../../config/environment','./action.controller','put','/:id','update','isAuthenticated','destroy','multer','util','path','connect-timeout'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xfbc5,0x1ca));var _0x5fbc=function(_0x4ef839,_0x1f379b){_0x4ef839=_0x4ef839-0x0;var _0x59810f=_0xfbc5[_0x4ef839];return _0x59810f;};'use strict';var multer=require(_0x5fbc('0x0'));var util=require(_0x5fbc('0x1'));var path=require(_0x5fbc('0x2'));var timeout=require(_0x5fbc('0x3'));var express=require(_0x5fbc('0x4'));var router=express[_0x5fbc('0x5')]();var fs_extra=require(_0x5fbc('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5fbc('0x7'));var controller=require(_0x5fbc('0x8'));router[_0x5fbc('0x9')](_0x5fbc('0xa'),auth['isAuthenticated'](),controller[_0x5fbc('0xb')]);router['delete'](_0x5fbc('0xa'),auth[_0x5fbc('0xc')](),controller[_0x5fbc('0xd')]);module['exports']=router; \ No newline at end of file +var _0x4367=['isAuthenticated','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4367,0x81));var _0x7436=function(_0x3d7c71,_0x5536e2){_0x3d7c71=_0x3d7c71-0x0;var _0x35410c=_0x4367[_0x3d7c71];return _0x35410c;};'use strict';var multer=require(_0x7436('0x0'));var util=require(_0x7436('0x1'));var path=require(_0x7436('0x2'));var timeout=require(_0x7436('0x3'));var express=require(_0x7436('0x4'));var router=express[_0x7436('0x5')]();var fs_extra=require(_0x7436('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7436('0x7'));var config=require(_0x7436('0x8'));var controller=require(_0x7436('0x9'));router['put'](_0x7436('0xa'),auth[_0x7436('0xb')](),controller[_0x7436('0xc')]);router['delete'](_0x7436('0xa'),auth[_0x7436('0xb')](),controller[_0x7436('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 92e098b..021ba9b 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 _0x71ab=['TEXT','exports','STRING'];(function(_0x5b0c7d,_0x26ffc7){var _0x510470=function(_0x2d673f){while(--_0x2d673f){_0x5b0c7d['push'](_0x5b0c7d['shift']());}};_0x510470(++_0x26ffc7);}(_0x71ab,0x64));var _0xb71a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x71ab[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file +var _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3c823d,_0x3ce6d3){_0x3c823d=_0x3c823d-0x0;var _0x44cfcf=_0xb4c7[_0x3c823d];return _0x44cfcf;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 24a9677..d995d38 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 _0x09ba=['web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','clone','Limited\x20Query:','eml-format','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','dbH','status','json','offset','undefined','limit','count','Content-Range','save','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','format','foreignKey','conditions','debug','toString','sequelize','QueryTypes','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','SEC_TO_TIME(%s)','IS\x20NULL','getFields','%s.%s\x20=\x20%s.%s','output'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x09ba,0xbd));var _0xa09b=function(_0x5e3bb1,_0x3cfe7c){_0x5e3bb1=_0x5e3bb1-0x0;var _0x4c1278=_0x09ba[_0x5e3bb1];return _0x4c1278;};'use strict';var emlformat=require(_0xa09b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa09b('0x1'));var rp=require('request-promise');var moment=require(_0xa09b('0x2'));var BPromise=require(_0xa09b('0x3'));var Mustache=require(_0xa09b('0x4'));var util=require(_0xa09b('0x5'));var path=require('path');var sox=require(_0xa09b('0x6'));var csv=require(_0xa09b('0x7'));var ejs=require(_0xa09b('0x8'));var fs=require('fs');var fs_extra=require(_0xa09b('0x9'));var _=require(_0xa09b('0xa'));var squel=require(_0xa09b('0xb'));var crypto=require(_0xa09b('0xc'));var jsforce=require(_0xa09b('0xd'));var deskjs=require(_0xa09b('0xe'));var toCsv=require(_0xa09b('0x7'));var querystring=require(_0xa09b('0xf'));var Papa=require(_0xa09b('0x10'));var Redis=require(_0xa09b('0x11'));var authService=require(_0xa09b('0x12'));var qs=require(_0xa09b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa09b('0x14'));var logger=require(_0xa09b('0x15'))(_0xa09b('0x16'));var utils=require(_0xa09b('0x17'));var config=require(_0xa09b('0x18'));var licenseUtil=require(_0xa09b('0x19'));var db=require(_0xa09b('0x1a'))['db'];var dbH=require(_0xa09b('0x1a'))[_0xa09b('0x1b')];function respondWithStatusCode(_0x37d24e,_0x73a4e4){_0x73a4e4=_0x73a4e4||0xcc;return function(_0x2c25b6){if(_0x2c25b6){return _0x37d24e['sendStatus'](_0x73a4e4);}return _0x37d24e['status'](_0x73a4e4)['end']();};}function respondWithResult(_0x1396ec,_0xf60ce2){_0xf60ce2=_0xf60ce2||0xc8;return function(_0x56b299){if(_0x56b299){return _0x1396ec[_0xa09b('0x1c')](_0xf60ce2)[_0xa09b('0x1d')](_0x56b299);}};}function respondWithFilteredResult(_0x4e48a7,_0x4910e0){return function(_0x4440ab){if(_0x4440ab){var _0x5b2285=typeof _0x4910e0[_0xa09b('0x1e')]===_0xa09b('0x1f')&&typeof _0x4910e0[_0xa09b('0x20')]==='undefined';var _0x508273=_0x4440ab[_0xa09b('0x21')];var _0x1ea2c2=_0x5b2285?0x0:_0x4910e0[_0xa09b('0x1e')];var _0x3e4d14=_0x5b2285?_0x4440ab[_0xa09b('0x21')]:_0x4910e0['offset']+_0x4910e0[_0xa09b('0x20')];var _0x453aae;if(_0x3e4d14>=_0x508273){_0x3e4d14=_0x508273;_0x453aae=0xc8;}else{_0x453aae=0xce;}_0x4e48a7[_0xa09b('0x1c')](_0x453aae);return _0x4e48a7['set'](_0xa09b('0x22'),_0x1ea2c2+'-'+_0x3e4d14+'/'+_0x508273)[_0xa09b('0x1d')](_0x4440ab);}return null;};}function patchUpdates(_0xa3957d){return function(_0x185596){try{jsonpatch['apply'](_0x185596,_0xa3957d,!![]);}catch(_0x5ecdc1){return BPromise['reject'](_0x5ecdc1);}return _0x185596[_0xa09b('0x23')]();};}function saveUpdates(_0x27a6b4,_0x46cf42){return function(_0x45b04b){if(_0x45b04b){return _0x45b04b['update'](_0x27a6b4)[_0xa09b('0x24')](function(_0x135ab8){return _0x135ab8;});}return null;};}function removeEntity(_0x253494,_0x2641aa){return function(_0x4be099){if(_0x4be099){return _0x4be099[_0xa09b('0x25')]()[_0xa09b('0x24')](function(){var _0x250944=_0x4be099[_0xa09b('0x26')]({'plain':!![]});var _0x57a4cf=_0xa09b('0x27');return db[_0xa09b('0x28')][_0xa09b('0x25')]({'where':{'type':_0x57a4cf,'resourceId':_0x250944['id']}})[_0xa09b('0x24')](function(){return _0x4be099;});})[_0xa09b('0x24')](function(){_0x253494['status'](0xcc)[_0xa09b('0x29')]();});}};}function handleEntityNotFound(_0x1c1803,_0x35678a){return function(_0x4fb15c){if(!_0x4fb15c){_0x1c1803['sendStatus'](0x194);}return _0x4fb15c;};}function handleError(_0x713ab0,_0x558e53){_0x558e53=_0x558e53||0x1f4;return function(_0x219d7f){logger['error'](_0x219d7f[_0xa09b('0x2a')]);if(_0x219d7f[_0xa09b('0x2b')]){delete _0x219d7f['name'];}_0x713ab0[_0xa09b('0x1c')](_0x558e53)['send'](_0x219d7f);};}exports[_0xa09b('0x2c')]=function(_0x1c6c95,_0x1e161d){var _0x11c896={},_0x3845c4={},_0x5a6737={'count':0x0,'rows':[]};var _0x2b53e5=_[_0xa09b('0x2d')](db[_0xa09b('0x2e')][_0xa09b('0x2f')],function(_0xeebcab){return{'name':_0xeebcab[_0xa09b('0x30')],'type':_0xeebcab[_0xa09b('0x31')][_0xa09b('0x32')]};});_0x3845c4['model']=_[_0xa09b('0x2d')](_0x2b53e5,_0xa09b('0x2b'));_0x3845c4[_0xa09b('0x33')]=_[_0xa09b('0x34')](_0x1c6c95[_0xa09b('0x33')]);_0x3845c4[_0xa09b('0x35')]=_[_0xa09b('0x36')](_0x3845c4['model'],_0x3845c4[_0xa09b('0x33')]);_0x11c896['attributes']=_[_0xa09b('0x36')](_0x3845c4[_0xa09b('0x37')],qs[_0xa09b('0x38')](_0x1c6c95[_0xa09b('0x33')][_0xa09b('0x38')]));_0x11c896[_0xa09b('0x39')]=_0x11c896[_0xa09b('0x39')]['length']?_0x11c896[_0xa09b('0x39')]:_0x3845c4[_0xa09b('0x37')];if(!_0x1c6c95[_0xa09b('0x33')][_0xa09b('0x3a')](_0xa09b('0x3b'))){_0x11c896[_0xa09b('0x20')]=qs['limit'](_0x1c6c95[_0xa09b('0x33')]['limit']);_0x11c896['offset']=qs[_0xa09b('0x1e')](_0x1c6c95[_0xa09b('0x33')][_0xa09b('0x1e')]);}_0x11c896[_0xa09b('0x3c')]=qs[_0xa09b('0x3d')](_0x1c6c95[_0xa09b('0x33')][_0xa09b('0x3d')]);_0x11c896[_0xa09b('0x3e')]=qs[_0xa09b('0x35')](_[_0xa09b('0x3f')](_0x1c6c95[_0xa09b('0x33')],_0x3845c4['filters']),_0x2b53e5);if(_0x1c6c95['query']['filter']){_0x11c896[_0xa09b('0x3e')]=_[_0xa09b('0x40')](_0x11c896[_0xa09b('0x3e')],{'$or':_['map'](_0x2b53e5,function(_0x41439a){if(_0x41439a[_0xa09b('0x31')]!==_0xa09b('0x41')){var _0x192cc8={};_0x192cc8[_0x41439a[_0xa09b('0x2b')]]={'$like':'%'+_0x1c6c95[_0xa09b('0x33')][_0xa09b('0x42')]+'%'};return _0x192cc8;}})});}_0x11c896=_[_0xa09b('0x40')]({},_0x11c896,_0x1c6c95[_0xa09b('0x43')]);var _0x273d77={'where':_0x11c896[_0xa09b('0x3e')]};return db[_0xa09b('0x2e')][_0xa09b('0x21')](_0x273d77)['then'](function(_0x558569){_0x5a6737[_0xa09b('0x21')]=_0x558569;if(_0x1c6c95[_0xa09b('0x33')][_0xa09b('0x44')]){_0x11c896[_0xa09b('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xa09b('0x46')](_0x11c896);})[_0xa09b('0x24')](function(_0x4601c8){_0x5a6737[_0xa09b('0x47')]=_0x4601c8;return _0x5a6737;})['then'](respondWithFilteredResult(_0x1e161d,_0x11c896))[_0xa09b('0x48')](handleError(_0x1e161d,null));};exports[_0xa09b('0x49')]=function(_0x484907,_0x1f4e6e){var _0x46cc35={'raw':![],'where':{'id':_0x484907[_0xa09b('0x4a')]['id']}},_0x1d7d9e={};_0x1d7d9e[_0xa09b('0x37')]=_[_0xa09b('0x34')](db['AnalyticCustomReport'][_0xa09b('0x2f')]);_0x1d7d9e[_0xa09b('0x33')]=_['keys'](_0x484907[_0xa09b('0x33')]);_0x1d7d9e['filters']=_['intersection'](_0x1d7d9e['model'],_0x1d7d9e['query']);_0x46cc35[_0xa09b('0x39')]=_[_0xa09b('0x36')](_0x1d7d9e[_0xa09b('0x37')],qs[_0xa09b('0x38')](_0x484907[_0xa09b('0x33')][_0xa09b('0x38')]));_0x46cc35[_0xa09b('0x39')]=_0x46cc35[_0xa09b('0x39')]['length']?_0x46cc35[_0xa09b('0x39')]:_0x1d7d9e[_0xa09b('0x37')];if(_0x484907['query'][_0xa09b('0x44')]){_0x46cc35[_0xa09b('0x45')]=[{'all':!![]}];}_0x46cc35=_['merge']({},_0x46cc35,_0x484907[_0xa09b('0x43')]);return db['AnalyticCustomReport'][_0xa09b('0x4b')](_0x46cc35)[_0xa09b('0x24')](handleEntityNotFound(_0x1f4e6e,null))[_0xa09b('0x24')](respondWithResult(_0x1f4e6e,null))['catch'](handleError(_0x1f4e6e,null));};exports[_0xa09b('0x4c')]=function(_0x3cfa89,_0x174026){return db[_0xa09b('0x2e')][_0xa09b('0x4c')](_0x3cfa89[_0xa09b('0x4d')],{})[_0xa09b('0x24')](function(_0x41ae83){var _0x42b1af=_0x3cfa89[_0xa09b('0x4e')][_0xa09b('0x26')]({'plain':!![]});if(!_0x42b1af)throw new Error(_0xa09b('0x4f'));if(_0x42b1af[_0xa09b('0x50')]===_0xa09b('0x4e')){var _0x56a979=_0x41ae83[_0xa09b('0x26')]({'plain':!![]});var _0x16a73d=_0xa09b('0x51');return db[_0xa09b('0x52')][_0xa09b('0x4b')]({'where':{'name':_0x16a73d,'userProfileId':_0x42b1af[_0xa09b('0x53')]},'raw':!![]})[_0xa09b('0x24')](function(_0x1189f7){if(_0x1189f7&&_0x1189f7['autoAssociation']===0x0){return db[_0xa09b('0x28')][_0xa09b('0x4c')]({'name':_0x56a979[_0xa09b('0x2b')],'resourceId':_0x56a979['id'],'type':_0xa09b('0x27'),'sectionId':_0x1189f7['id']},{})[_0xa09b('0x24')](function(){return _0x41ae83;});}else{return _0x41ae83;}})['catch'](function(_0x475157){logger[_0xa09b('0x54')](_0xa09b('0x55'),_0x475157);throw _0x475157;});}return _0x41ae83;})[_0xa09b('0x24')](respondWithResult(_0x174026,0xc9))[_0xa09b('0x48')](handleError(_0x174026,null));};exports[_0xa09b('0x56')]=function(_0x11cc73,_0x43b445){if(_0x11cc73['body']['id']){delete _0x11cc73['body']['id'];}return db[_0xa09b('0x2e')]['find']({'where':{'id':_0x11cc73['params']['id']}})[_0xa09b('0x24')](handleEntityNotFound(_0x43b445,null))[_0xa09b('0x24')](saveUpdates(_0x11cc73[_0xa09b('0x4d')],null))['then'](respondWithResult(_0x43b445,null))[_0xa09b('0x48')](handleError(_0x43b445,null));};exports[_0xa09b('0x25')]=function(_0x100b32,_0x2ea1d6){return db[_0xa09b('0x2e')][_0xa09b('0x4b')]({'where':{'id':_0x100b32[_0xa09b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2ea1d6,null))[_0xa09b('0x24')](removeEntity(_0x2ea1d6,null))['catch'](handleError(_0x2ea1d6,null));};exports[_0xa09b('0x57')]=function(_0xd6b261,_0x7ac2da){var _0x174632=0xa;var _0x2f1c32=[_0xa09b('0x58'),_0xa09b('0x59'),_0xa09b('0x5a'),_0xa09b('0x5b')];var _0x3d6a12={'SUM':'SUM(%s)','COUNT':_0xa09b('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa09b('0x5d'),'MIN':_0xa09b('0x5e'),'AVG':_0xa09b('0x5f'),'GROUP_CONCAT':_0xa09b('0x60'),'GROUP_CONCAT ASC':_0xa09b('0x61'),'GROUP_CONCAT DESC':_0xa09b('0x62')};var _0x2dc7a3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xa09b('0x63'),'HOUR':_0xa09b('0x64'),'ROUND':_0xa09b('0x65'),'UNIX_TIMESTAMP':_0xa09b('0x66')};var _0x24ffb2=function(_0x50fea5){return!_[_0xa09b('0x67')](['IS\x20NULL',_0xa09b('0x68'),_0xa09b('0x69'),_0xa09b('0x6a')],_0x50fea5);};var _0x272785=function(_0x2f7da1){if(!_0x2f7da1||!_0x2f7da1[_0xa09b('0x6b')]['length']){return'';}for(var _0x1010f9='(',_0x5505e4=0x0;_0x5505e4<_0x2f7da1[_0xa09b('0x6b')][_0xa09b('0x6c')];_0x5505e4+=0x1){_0x5505e4>0x0&&(_0x1010f9+='\x20'+_0x2f7da1[_0xa09b('0x6d')]+'\x20');_0x1010f9+=_0x2f7da1[_0xa09b('0x6b')][_0x5505e4][_0xa09b('0x6e')]?_0x272785(_0x2f7da1[_0xa09b('0x6b')][_0x5505e4]['group']):_0x2f7da1[_0xa09b('0x6b')][_0x5505e4][_0xa09b('0x6f')]+'\x20'+_0x2f7da1[_0xa09b('0x6b')][_0x5505e4][_0xa09b('0x70')]+(_0x24ffb2(_0x2f7da1[_0xa09b('0x6b')][_0x5505e4][_0xa09b('0x70')])?'\x20'+_0x2f7da1[_0xa09b('0x6b')][_0x5505e4][_0xa09b('0x71')]:'');}return _0x1010f9+')';};var _0x1ccdb0={'where':{'id':_0xd6b261['params']['id']}},_0x1aa59f,_0x11d3ed,_0x1fe3f6,_0x4f1b42,_0x193d59;_0x1ccdb0=_[_0xa09b('0x40')]({},_0x1ccdb0,_0xd6b261[_0xa09b('0x43')]);return db[_0xa09b('0x2e')][_0xa09b('0x4b')](_0x1ccdb0)[_0xa09b('0x24')](function(_0x4de164){if(_0x4de164){_0x1aa59f=_0x4de164;return _0x4de164['getFields']();}return null;})[_0xa09b('0x24')](function(_0x3de64e){if(_0x3de64e){if(!_0x3de64e[_0xa09b('0x6c')]){throw new db[(_0xa09b('0x72'))][(_0xa09b('0x73'))](_0xa09b('0x74'),0x193);}_0x11d3ed=_0x3de64e;return db[_0xa09b('0x75')][_0xa09b('0x46')]({'raw':!![]});}return null;})[_0xa09b('0x24')](function(_0x22f369){if(_0x22f369){_0x1fe3f6=_[_0xa09b('0x76')](_0x22f369,'id');var _0x5ceb8d;var _0x1613c9=squel[_0xa09b('0x77')]();_0x1613c9[_0xa09b('0x78')](_0x1aa59f[_0xa09b('0x79')]);for(var _0x1a4971=0x0;_0x1a4971<_0x11d3ed['length'];_0x1a4971+=0x1){_0x5ceb8d=_0x11d3ed[_0x1a4971]['MetricId']?_0x1fe3f6[_0x11d3ed[_0x1a4971][_0xa09b('0x7a')]][_0xa09b('0x7b')]:_0x11d3ed[_0x1a4971]['field'];_0x5ceb8d=_0x11d3ed[_0x1a4971]['function']?_[_0xa09b('0x7c')](_0x3d6a12[_0x11d3ed[_0x1a4971][_0xa09b('0x7d')]],'%s',_0x5ceb8d):_0x5ceb8d;_0x5ceb8d=_0x11d3ed[_0x1a4971]['format']?_['replace'](_0x2dc7a3[_0x11d3ed[_0x1a4971]['format']],'%s',_0x5ceb8d):_0x5ceb8d;if(_0x11d3ed[_0x1a4971][_0xa09b('0x7e')]){_0x1613c9[_0xa09b('0x6e')](_0x5ceb8d);}_0x11d3ed[_0x1a4971][_0xa09b('0x7f')]&&_0x1613c9[_0xa09b('0x3c')](_0x5ceb8d,_0x11d3ed[_0x1a4971][_0xa09b('0x7f')]===_0xa09b('0x80')?![]:!![]);_0x1613c9[_0xa09b('0x6f')](_0x5ceb8d,_0x11d3ed[_0x1a4971][_0xa09b('0x81')]||_0x5ceb8d);}if(_0x1aa59f['joins']){_0x1aa59f[_0xa09b('0x82')]=JSON[_0xa09b('0x83')](_0x1aa59f[_0xa09b('0x82')]);for(var _0x4c3ee5=0x0;_0x4c3ee5<_0x1aa59f[_0xa09b('0x82')]['length'];_0x4c3ee5+=0x1){if(_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5][_0xa09b('0x31')]&&_[_0xa09b('0x67')](_0x2f1c32,_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5]['type'])&&_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5][_0xa09b('0x84')]&&_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5][_0xa09b('0x85')]&&_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5]['foreignKey']){_0x1613c9[_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5]['type']](_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5][_0xa09b('0x85')],null,util[_0xa09b('0x86')]('%s.%s\x20=\x20%s.%s',_0x1aa59f['table'],_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5][_0xa09b('0x84')],_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5][_0xa09b('0x85')],_0x1aa59f[_0xa09b('0x82')][_0x4c3ee5][_0xa09b('0x87')]));}}}if(_0x1aa59f[_0xa09b('0x88')]){_0x1aa59f[_0xa09b('0x88')]=JSON['parse'](_0x1aa59f[_0xa09b('0x88')]);_0x1613c9[_0xa09b('0x3e')](_0x272785(_0x1aa59f[_0xa09b('0x88')][_0xa09b('0x6e')]));}_0x193d59=_0x1613c9['clone']();_0x1613c9['limit'](_0x174632);_0x1613c9[_0xa09b('0x1e')](0x0);logger[_0xa09b('0x89')]('Limited\x20Query:',_0x1613c9[_0xa09b('0x8a')]());return dbH[_0xa09b('0x8b')][_0xa09b('0x33')](_0x1613c9['toString'](),{'type':dbH[_0xa09b('0x8b')][_0xa09b('0x8c')][_0xa09b('0x8d')]});}})[_0xa09b('0x24')](respondWithResult(_0x7ac2da,null))['catch'](handleError(_0x7ac2da,null));};function runReport(_0x1caef1,_0x4abfa6,_0x60de88){var _0x21a15a=_0x4abfa6[_0xa09b('0x2b')];var _0x57a9c6=0xa;var _0xcc354=['join','left_join',_0xa09b('0x5a'),_0xa09b('0x5b')];var _0x499843={'SUM':_0xa09b('0x8e'),'COUNT':_0xa09b('0x5c'),'COUNT DISTINCT':_0xa09b('0x8f'),'MAX':'MAX(%s)','MIN':_0xa09b('0x5e'),'AVG':_0xa09b('0x5f'),'GROUP_CONCAT':_0xa09b('0x60'),'GROUP_CONCAT ASC':_0xa09b('0x61'),'GROUP_CONCAT DESC':_0xa09b('0x62')};var _0xeb4dad={'SEC_TO_TIME':_0xa09b('0x90'),'DATE':_0xa09b('0x63'),'HOUR':_0xa09b('0x64'),'ROUND':_0xa09b('0x65'),'UNIX_TIMESTAMP':_0xa09b('0x66')};var _0x563b94=function(_0x4b0699){return!_[_0xa09b('0x67')]([_0xa09b('0x91'),_0xa09b('0x68'),'IS\x20EMPTY',_0xa09b('0x6a')],_0x4b0699);};var _0x3f1516=function(_0x11d199){if(!_0x11d199||!_0x11d199[_0xa09b('0x6b')][_0xa09b('0x6c')]){return'';}for(var _0x47ac70='(',_0x2d8e34=0x0;_0x2d8e34<_0x11d199[_0xa09b('0x6b')][_0xa09b('0x6c')];_0x2d8e34+=0x1){_0x2d8e34>0x0&&(_0x47ac70+='\x20'+_0x11d199['operator']+'\x20');_0x47ac70+=_0x11d199[_0xa09b('0x6b')][_0x2d8e34]['group']?_0x3f1516(_0x11d199[_0xa09b('0x6b')][_0x2d8e34][_0xa09b('0x6e')]):_0x11d199['rules'][_0x2d8e34][_0xa09b('0x6f')]+'\x20'+_0x11d199[_0xa09b('0x6b')][_0x2d8e34][_0xa09b('0x70')]+(_0x563b94(_0x11d199[_0xa09b('0x6b')][_0x2d8e34][_0xa09b('0x70')])?'\x20'+_0x11d199[_0xa09b('0x6b')][_0x2d8e34][_0xa09b('0x71')]:'');}return _0x47ac70+')';};var _0x16c50f={'where':{'id':_0x1caef1['id']}},_0x11fab5,_0x85ad4d,_0x35ad1d,_0x4251a8,_0x3a0456;_0x16c50f=_[_0xa09b('0x40')]({},_0x16c50f,_0x60de88);return db[_0xa09b('0x2e')][_0xa09b('0x4b')](_0x16c50f)[_0xa09b('0x24')](function(_0x3f0398){if(_0x3f0398){_0x11fab5=_0x3f0398;return _0x3f0398[_0xa09b('0x92')]();}return null;})[_0xa09b('0x24')](function(_0x3d45ef){if(_0x3d45ef){if(!_0x3d45ef[_0xa09b('0x6c')]){throw new db[(_0xa09b('0x72'))][(_0xa09b('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x85ad4d=_0x3d45ef;return db[_0xa09b('0x75')][_0xa09b('0x46')]({'raw':!![]});}return null;})[_0xa09b('0x24')](function(_0x252f44){if(_0x252f44){_0x35ad1d=_['keyBy'](_0x252f44,'id');var _0x17e453;var _0x36e396=squel[_0xa09b('0x77')]();_0x36e396[_0xa09b('0x78')](_0x11fab5['table']);for(var _0x395917=0x0;_0x395917<_0x85ad4d[_0xa09b('0x6c')];_0x395917+=0x1){_0x17e453=_0x85ad4d[_0x395917][_0xa09b('0x7a')]?_0x35ad1d[_0x85ad4d[_0x395917][_0xa09b('0x7a')]][_0xa09b('0x7b')]:_0x85ad4d[_0x395917][_0xa09b('0x6f')];_0x17e453=_0x85ad4d[_0x395917][_0xa09b('0x7d')]?_[_0xa09b('0x7c')](_0x499843[_0x85ad4d[_0x395917]['function']],'%s',_0x17e453):_0x17e453;_0x17e453=_0x85ad4d[_0x395917][_0xa09b('0x86')]?_[_0xa09b('0x7c')](_0xeb4dad[_0x85ad4d[_0x395917][_0xa09b('0x86')]],'%s',_0x17e453):_0x17e453;if(_0x85ad4d[_0x395917]['groupBy']){_0x36e396[_0xa09b('0x6e')](_0x17e453);}_0x85ad4d[_0x395917]['orderBy']&&_0x36e396[_0xa09b('0x3c')](_0x17e453,_0x85ad4d[_0x395917]['orderBy']===_0xa09b('0x80')?![]:!![]);_0x36e396['field'](_0x17e453,_0x85ad4d[_0x395917][_0xa09b('0x81')]||_0x17e453);}if(_0x11fab5['joins']){_0x11fab5[_0xa09b('0x82')]=JSON[_0xa09b('0x83')](_0x11fab5[_0xa09b('0x82')]);for(var _0x12dad1=0x0;_0x12dad1<_0x11fab5[_0xa09b('0x82')][_0xa09b('0x6c')];_0x12dad1+=0x1){if(_0x11fab5['joins'][_0x12dad1][_0xa09b('0x31')]&&_[_0xa09b('0x67')](_0xcc354,_0x11fab5[_0xa09b('0x82')][_0x12dad1][_0xa09b('0x31')])&&_0x11fab5[_0xa09b('0x82')][_0x12dad1]['parentKey']&&_0x11fab5['joins'][_0x12dad1][_0xa09b('0x85')]&&_0x11fab5[_0xa09b('0x82')][_0x12dad1][_0xa09b('0x87')]){_0x36e396[_0x11fab5[_0xa09b('0x82')][_0x12dad1][_0xa09b('0x31')]](_0x11fab5[_0xa09b('0x82')][_0x12dad1][_0xa09b('0x85')],null,util['format'](_0xa09b('0x93'),_0x11fab5[_0xa09b('0x79')],_0x11fab5[_0xa09b('0x82')][_0x12dad1][_0xa09b('0x84')],_0x11fab5[_0xa09b('0x82')][_0x12dad1][_0xa09b('0x85')],_0x11fab5[_0xa09b('0x82')][_0x12dad1]['foreignKey']));}}}if(_0x11fab5[_0xa09b('0x88')]){_0x11fab5['conditions']=JSON[_0xa09b('0x83')](_0x11fab5[_0xa09b('0x88')]);_0x36e396[_0xa09b('0x3e')](_0x3f1516(_0x11fab5['conditions'][_0xa09b('0x6e')]));}_0x3a0456=_0x36e396['clone']();_0x36e396[_0xa09b('0x20')](_0x57a9c6);_0x36e396['offset'](0x0);return;}})[_0xa09b('0x24')](function(){if(_0x4abfa6[_0xa09b('0x94')]===_0xa09b('0x95')){return null;}var _0x527f56=_['merge'](_0x4abfa6,{'name':_0x4abfa6[_0xa09b('0x96')]||_0x4abfa6[_0xa09b('0x2b')]||_0x11fab5[_0xa09b('0x2b')],'basename':_0x21a15a,'savename':util['format'](_0xa09b('0x97'),_0x4abfa6[_0xa09b('0x2b')]||_0x11fab5[_0xa09b('0x2b')],require(_0xa09b('0x98'))['generate'](0x4),_0x4abfa6[_0xa09b('0x94')]||_0xa09b('0x99')),'reportId':_0x11fab5['id'],'reportType':_0xa09b('0x9a')});return db[_0xa09b('0x9b')][_0xa09b('0x4c')](_0x527f56,{'raw':!![]});})['then'](function(_0x1c2ff2){if(_0x11fab5[_0xa09b('0x79')]==='cdr'){_0x3a0456['where'](_0x11fab5[_0xa09b('0x79')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4abfa6[_0xa09b('0x9c')],_0x4abfa6[_0xa09b('0x9d')]);}else{_0x3a0456[_0xa09b('0x3e')](_0x11fab5[_0xa09b('0x79')]+_0xa09b('0x9e'),_0x4abfa6[_0xa09b('0x9c')],_0x4abfa6['endDate']);}if(_0x1c2ff2){logger[_0xa09b('0x9f')](_0xa09b('0xa0'),_0x3a0456[_0xa09b('0x8a')]());require('child_process')['fork'](path[_0xa09b('0x58')](__dirname,_0xa09b('0xa1'),_0x1c2ff2['output']),[_0x1c2ff2['id'],_0x3a0456[_0xa09b('0x8a')](),path['join'](__dirname,_0xa09b('0xa2'),_0x1c2ff2[_0xa09b('0xa3')]),_0x21a15a]);return _0x1c2ff2;}else{var _0x459ce4=squel['select']();_0x459ce4['from']('('+_0x3a0456[_0xa09b('0x8a')]()+')','countTable');_0x459ce4[_0xa09b('0x6f')](_0xa09b('0xa4'),_0xa09b('0x21'));_0x3a0456[_0xa09b('0x20')](_0x4abfa6[_0xa09b('0x20')]||_0x57a9c6);_0x3a0456[_0xa09b('0x1e')](_0x4abfa6[_0xa09b('0x1e')]||0x0);return dbH[_0xa09b('0x8b')]['query'](_0x459ce4[_0xa09b('0x8a')](),{'type':dbH[_0xa09b('0x8b')][_0xa09b('0x8c')][_0xa09b('0x8d')]})['then'](function(_0xc3f27){if(!_0xc3f27['length']){_0x4251a8=0x0;}else{_0x4251a8=_0xc3f27[0x0][_0xa09b('0x21')]||0x0;}return dbH[_0xa09b('0x8b')][_0xa09b('0x33')](_0x3a0456[_0xa09b('0x8a')](),{'type':dbH[_0xa09b('0x8b')]['QueryTypes'][_0xa09b('0x8d')]});})['then'](function(_0x589608){return{'rows':_0x589608||[],'count':_0x4251a8};});}});}exports[_0xa09b('0xa5')]=function(_0x1929f2,_0x2e8b34){return runReport(_0x1929f2[_0xa09b('0x4a')],_0x1929f2[_0xa09b('0x33')],_0x1929f2['options'])[_0xa09b('0x24')](respondWithResult(_0x2e8b34,null))['catch'](handleError(_0x2e8b34,null));};exports[_0xa09b('0xa6')]=runReport;exports[_0xa09b('0x33')]=function(_0x360cb,_0x14d844){var _0x3852fa=0xa;var _0x429aff=[_0xa09b('0x58'),_0xa09b('0x59'),'right_join',_0xa09b('0x5b')];var _0x33c75e={'SUM':_0xa09b('0x8e'),'COUNT':_0xa09b('0x5c'),'COUNT DISTINCT':_0xa09b('0x8f'),'MAX':_0xa09b('0x5d'),'MIN':_0xa09b('0x5e'),'AVG':_0xa09b('0x5f'),'GROUP_CONCAT':_0xa09b('0x60'),'GROUP_CONCAT ASC':_0xa09b('0x61'),'GROUP_CONCAT DESC':_0xa09b('0x62')};var _0x4773f5={'SEC_TO_TIME':_0xa09b('0x90'),'DATE':_0xa09b('0x63'),'HOUR':'HOUR(%s)','ROUND':_0xa09b('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x11b528=function(_0x33d164){return!_[_0xa09b('0x67')]([_0xa09b('0x91'),_0xa09b('0x68'),'IS\x20EMPTY',_0xa09b('0x6a')],_0x33d164);};var _0x59313c=function(_0x311563){if(!_0x311563||!_0x311563[_0xa09b('0x6b')]['length']){return'';}for(var _0x53cfd6='(',_0x4e66b2=0x0;_0x4e66b2<_0x311563[_0xa09b('0x6b')][_0xa09b('0x6c')];_0x4e66b2+=0x1){_0x4e66b2>0x0&&(_0x53cfd6+='\x20'+_0x311563[_0xa09b('0x6d')]+'\x20');_0x53cfd6+=_0x311563[_0xa09b('0x6b')][_0x4e66b2][_0xa09b('0x6e')]?_0x59313c(_0x311563['rules'][_0x4e66b2][_0xa09b('0x6e')]):_0x311563['rules'][_0x4e66b2][_0xa09b('0x6f')]+'\x20'+_0x311563['rules'][_0x4e66b2][_0xa09b('0x70')]+(_0x11b528(_0x311563[_0xa09b('0x6b')][_0x4e66b2][_0xa09b('0x70')])?'\x20'+_0x311563[_0xa09b('0x6b')][_0x4e66b2][_0xa09b('0x71')]:'');}return _0x53cfd6+')';};var _0x304e55={'where':{'id':_0x360cb[_0xa09b('0x4a')]['id']}},_0x11695f,_0x4ed85e,_0x2cdcf0,_0x4d6fea,_0x158bdf;_0x304e55=_[_0xa09b('0x40')]({},_0x304e55,_0x360cb[_0xa09b('0x43')]);return db[_0xa09b('0x2e')][_0xa09b('0x4b')](_0x304e55)[_0xa09b('0x24')](function(_0x225886){if(_0x225886){_0x11695f=_0x225886;return _0x225886[_0xa09b('0x92')]();}return null;})['then'](function(_0x40345b){if(_0x40345b){if(!_0x40345b[_0xa09b('0x6c')]){throw new db[(_0xa09b('0x72'))][(_0xa09b('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ed85e=_0x40345b;return db[_0xa09b('0x75')][_0xa09b('0x46')]({'raw':!![]});}return null;})['then'](function(_0x237fbf){if(_0x237fbf){_0x2cdcf0=_[_0xa09b('0x76')](_0x237fbf,'id');var _0xeea10d;var _0x45632d=squel['select']();_0x45632d[_0xa09b('0x78')](_0x11695f[_0xa09b('0x79')]);for(var _0x14c882=0x0;_0x14c882<_0x4ed85e[_0xa09b('0x6c')];_0x14c882+=0x1){_0xeea10d=_0x4ed85e[_0x14c882][_0xa09b('0x7a')]?_0x2cdcf0[_0x4ed85e[_0x14c882]['MetricId']][_0xa09b('0x7b')]:_0x4ed85e[_0x14c882][_0xa09b('0x6f')];_0xeea10d=_0x4ed85e[_0x14c882]['function']?_['replace'](_0x33c75e[_0x4ed85e[_0x14c882][_0xa09b('0x7d')]],'%s',_0xeea10d):_0xeea10d;_0xeea10d=_0x4ed85e[_0x14c882]['format']?_[_0xa09b('0x7c')](_0x4773f5[_0x4ed85e[_0x14c882][_0xa09b('0x86')]],'%s',_0xeea10d):_0xeea10d;if(_0x4ed85e[_0x14c882][_0xa09b('0x7e')]){_0x45632d[_0xa09b('0x6e')](_0xeea10d);}_0x4ed85e[_0x14c882][_0xa09b('0x7f')]&&_0x45632d[_0xa09b('0x3c')](_0xeea10d,_0x4ed85e[_0x14c882][_0xa09b('0x7f')]===_0xa09b('0x80')?![]:!![]);_0x45632d['field'](_0xeea10d,_0x4ed85e[_0x14c882]['alias']||_0xeea10d);}if(_0x11695f[_0xa09b('0x82')]){_0x11695f[_0xa09b('0x82')]=JSON['parse'](_0x11695f[_0xa09b('0x82')]);for(var _0x26a850=0x0;_0x26a850<_0x11695f[_0xa09b('0x82')]['length'];_0x26a850+=0x1){if(_0x11695f[_0xa09b('0x82')][_0x26a850][_0xa09b('0x31')]&&_[_0xa09b('0x67')](_0x429aff,_0x11695f[_0xa09b('0x82')][_0x26a850][_0xa09b('0x31')])&&_0x11695f[_0xa09b('0x82')][_0x26a850][_0xa09b('0x84')]&&_0x11695f[_0xa09b('0x82')][_0x26a850]['foreignTable']&&_0x11695f[_0xa09b('0x82')][_0x26a850]['foreignKey']){_0x45632d[_0x11695f[_0xa09b('0x82')][_0x26a850][_0xa09b('0x31')]](_0x11695f[_0xa09b('0x82')][_0x26a850]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x11695f[_0xa09b('0x79')],_0x11695f[_0xa09b('0x82')][_0x26a850]['parentKey'],_0x11695f['joins'][_0x26a850][_0xa09b('0x85')],_0x11695f['joins'][_0x26a850]['foreignKey']));}}}if(_0x11695f[_0xa09b('0x88')]){_0x11695f[_0xa09b('0x88')]=JSON[_0xa09b('0x83')](_0x11695f[_0xa09b('0x88')]);_0x45632d['where'](_0x59313c(_0x11695f[_0xa09b('0x88')][_0xa09b('0x6e')]));}_0x158bdf=_0x45632d[_0xa09b('0xa7')]();_0x45632d[_0xa09b('0x20')](_0x3852fa);_0x45632d[_0xa09b('0x1e')](0x0);logger[_0xa09b('0x89')](_0xa09b('0xa8'),_0x45632d['toString']());return dbH['sequelize'][_0xa09b('0x33')](_0x45632d['toString'](),{'type':dbH['sequelize'][_0xa09b('0x8c')]['SELECT']});}})[_0xa09b('0x24')](function(){return{'sql':_0x158bdf['toString']()};})[_0xa09b('0x24')](respondWithResult(_0x14d844,null))[_0xa09b('0x48')](handleError(_0x14d844,null));}; \ No newline at end of file +var _0xbc33=['table','MetricId','metric','function','format','replace','groupBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','DATE(%s)','IS\x20NOT\x20NULL','field','orderBy','alias','%s.%s\x20=\x20%s.%s','output','web','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../files/reports','savename','run','runReport','IS\x20NULL','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','length','include','create','role','get','UserProfileSection','find','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xbc33,0xd1));var _0x3bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc33[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3bc3('0x0'));var rimraf=require(_0x3bc3('0x1'));var zipdir=require(_0x3bc3('0x2'));var jsonpatch=require(_0x3bc3('0x3'));var rp=require(_0x3bc3('0x4'));var moment=require('moment');var BPromise=require(_0x3bc3('0x5'));var Mustache=require(_0x3bc3('0x6'));var util=require(_0x3bc3('0x7'));var path=require(_0x3bc3('0x8'));var sox=require(_0x3bc3('0x9'));var csv=require(_0x3bc3('0xa'));var ejs=require(_0x3bc3('0xb'));var fs=require('fs');var fs_extra=require(_0x3bc3('0xc'));var _=require(_0x3bc3('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3bc3('0xe'));var deskjs=require(_0x3bc3('0xf'));var toCsv=require(_0x3bc3('0xa'));var querystring=require('querystring');var Papa=require(_0x3bc3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3bc3('0x11'));var as=require(_0x3bc3('0x12'));var hardwareService=require(_0x3bc3('0x13'));var logger=require(_0x3bc3('0x14'))(_0x3bc3('0x15'));var utils=require(_0x3bc3('0x16'));var config=require(_0x3bc3('0x17'));var licenseUtil=require(_0x3bc3('0x18'));var db=require(_0x3bc3('0x19'))['db'];var dbH=require(_0x3bc3('0x19'))[_0x3bc3('0x1a')];function respondWithStatusCode(_0x28d399,_0x4b2136){_0x4b2136=_0x4b2136||0xcc;return function(_0x46e518){if(_0x46e518){return _0x28d399[_0x3bc3('0x1b')](_0x4b2136);}return _0x28d399[_0x3bc3('0x1c')](_0x4b2136)['end']();};}function respondWithResult(_0x10930b,_0x17b7c1){_0x17b7c1=_0x17b7c1||0xc8;return function(_0x491272){if(_0x491272){return _0x10930b[_0x3bc3('0x1c')](_0x17b7c1)['json'](_0x491272);}};}function respondWithFilteredResult(_0x13f0f7,_0x31000b){return function(_0x17620a){if(_0x17620a){var _0x3fb95c=typeof _0x31000b[_0x3bc3('0x1d')]===_0x3bc3('0x1e')&&typeof _0x31000b[_0x3bc3('0x1f')]===_0x3bc3('0x1e');var _0x4718b0=_0x17620a[_0x3bc3('0x20')];var _0x38cc85=_0x3fb95c?0x0:_0x31000b[_0x3bc3('0x1d')];var _0x530992=_0x3fb95c?_0x17620a[_0x3bc3('0x20')]:_0x31000b['offset']+_0x31000b[_0x3bc3('0x1f')];var _0x2f388e;if(_0x530992>=_0x4718b0){_0x530992=_0x4718b0;_0x2f388e=0xc8;}else{_0x2f388e=0xce;}_0x13f0f7[_0x3bc3('0x1c')](_0x2f388e);return _0x13f0f7['set'](_0x3bc3('0x21'),_0x38cc85+'-'+_0x530992+'/'+_0x4718b0)[_0x3bc3('0x22')](_0x17620a);}return null;};}function patchUpdates(_0x55a330){return function(_0x3e4ded){try{jsonpatch['apply'](_0x3e4ded,_0x55a330,!![]);}catch(_0x24c8e5){return BPromise['reject'](_0x24c8e5);}return _0x3e4ded[_0x3bc3('0x23')]();};}function saveUpdates(_0x2fee4b,_0x39ea44){return function(_0x353b0f){if(_0x353b0f){return _0x353b0f[_0x3bc3('0x24')](_0x2fee4b)[_0x3bc3('0x25')](function(_0x3c48ea){return _0x3c48ea;});}return null;};}function removeEntity(_0x3422e5,_0x40a265){return function(_0x22c770){if(_0x22c770){return _0x22c770[_0x3bc3('0x26')]()[_0x3bc3('0x25')](function(){var _0x463567=_0x22c770['get']({'plain':!![]});var _0x32abea='CustomReports';return db[_0x3bc3('0x27')][_0x3bc3('0x26')]({'where':{'type':_0x32abea,'resourceId':_0x463567['id']}})[_0x3bc3('0x25')](function(){return _0x22c770;});})[_0x3bc3('0x25')](function(){_0x3422e5[_0x3bc3('0x1c')](0xcc)[_0x3bc3('0x28')]();});}};}function handleEntityNotFound(_0x1510a1,_0x3210dc){return function(_0x35c715){if(!_0x35c715){_0x1510a1[_0x3bc3('0x1b')](0x194);}return _0x35c715;};}function handleError(_0x17fe4a,_0xcb8ba){_0xcb8ba=_0xcb8ba||0x1f4;return function(_0x366f82){logger[_0x3bc3('0x29')](_0x366f82[_0x3bc3('0x2a')]);if(_0x366f82[_0x3bc3('0x2b')]){delete _0x366f82[_0x3bc3('0x2b')];}_0x17fe4a['status'](_0xcb8ba)[_0x3bc3('0x2c')](_0x366f82);};}exports[_0x3bc3('0x2d')]=function(_0xfd247e,_0x4af0b5){var _0x8fa0fa={},_0x3f990c={},_0x5eb94f={'count':0x0,'rows':[]};var _0x216338=_[_0x3bc3('0x2e')](db[_0x3bc3('0x2f')][_0x3bc3('0x30')],function(_0x179e0b){return{'name':_0x179e0b[_0x3bc3('0x31')],'type':_0x179e0b[_0x3bc3('0x32')][_0x3bc3('0x33')]};});_0x3f990c[_0x3bc3('0x34')]=_[_0x3bc3('0x2e')](_0x216338,_0x3bc3('0x2b'));_0x3f990c[_0x3bc3('0x35')]=_[_0x3bc3('0x36')](_0xfd247e[_0x3bc3('0x35')]);_0x3f990c['filters']=_[_0x3bc3('0x37')](_0x3f990c[_0x3bc3('0x34')],_0x3f990c[_0x3bc3('0x35')]);_0x8fa0fa[_0x3bc3('0x38')]=_[_0x3bc3('0x37')](_0x3f990c['model'],qs[_0x3bc3('0x39')](_0xfd247e[_0x3bc3('0x35')][_0x3bc3('0x39')]));_0x8fa0fa[_0x3bc3('0x38')]=_0x8fa0fa['attributes']['length']?_0x8fa0fa[_0x3bc3('0x38')]:_0x3f990c[_0x3bc3('0x34')];if(!_0xfd247e[_0x3bc3('0x35')]['hasOwnProperty'](_0x3bc3('0x3a'))){_0x8fa0fa[_0x3bc3('0x1f')]=qs[_0x3bc3('0x1f')](_0xfd247e[_0x3bc3('0x35')]['limit']);_0x8fa0fa[_0x3bc3('0x1d')]=qs[_0x3bc3('0x1d')](_0xfd247e[_0x3bc3('0x35')][_0x3bc3('0x1d')]);}_0x8fa0fa[_0x3bc3('0x3b')]=qs[_0x3bc3('0x3c')](_0xfd247e['query']['sort']);_0x8fa0fa[_0x3bc3('0x3d')]=qs[_0x3bc3('0x3e')](_[_0x3bc3('0x3f')](_0xfd247e[_0x3bc3('0x35')],_0x3f990c[_0x3bc3('0x3e')]),_0x216338);if(_0xfd247e['query']['filter']){_0x8fa0fa[_0x3bc3('0x3d')]=_['merge'](_0x8fa0fa['where'],{'$or':_['map'](_0x216338,function(_0x2436ee){if(_0x2436ee[_0x3bc3('0x32')]!==_0x3bc3('0x40')){var _0x311e71={};_0x311e71[_0x2436ee['name']]={'$like':'%'+_0xfd247e[_0x3bc3('0x35')]['filter']+'%'};return _0x311e71;}})});}_0x8fa0fa=_[_0x3bc3('0x41')]({},_0x8fa0fa,_0xfd247e[_0x3bc3('0x42')]);var _0x95356f={'where':_0x8fa0fa[_0x3bc3('0x3d')]};return db['AnalyticCustomReport'][_0x3bc3('0x20')](_0x95356f)[_0x3bc3('0x25')](function(_0x2c141d){_0x5eb94f[_0x3bc3('0x20')]=_0x2c141d;if(_0xfd247e['query'][_0x3bc3('0x43')]){_0x8fa0fa['include']=[{'all':!![]}];}return db[_0x3bc3('0x2f')][_0x3bc3('0x44')](_0x8fa0fa);})[_0x3bc3('0x25')](function(_0x15abae){_0x5eb94f[_0x3bc3('0x45')]=_0x15abae;return _0x5eb94f;})[_0x3bc3('0x25')](respondWithFilteredResult(_0x4af0b5,_0x8fa0fa))[_0x3bc3('0x46')](handleError(_0x4af0b5,null));};exports['show']=function(_0x4a7371,_0x131f70){var _0x37832e={'raw':![],'where':{'id':_0x4a7371[_0x3bc3('0x47')]['id']}},_0x415115={};_0x415115[_0x3bc3('0x34')]=_[_0x3bc3('0x36')](db['AnalyticCustomReport'][_0x3bc3('0x30')]);_0x415115[_0x3bc3('0x35')]=_[_0x3bc3('0x36')](_0x4a7371['query']);_0x415115['filters']=_[_0x3bc3('0x37')](_0x415115[_0x3bc3('0x34')],_0x415115[_0x3bc3('0x35')]);_0x37832e['attributes']=_[_0x3bc3('0x37')](_0x415115['model'],qs[_0x3bc3('0x39')](_0x4a7371[_0x3bc3('0x35')][_0x3bc3('0x39')]));_0x37832e[_0x3bc3('0x38')]=_0x37832e['attributes'][_0x3bc3('0x48')]?_0x37832e[_0x3bc3('0x38')]:_0x415115[_0x3bc3('0x34')];if(_0x4a7371[_0x3bc3('0x35')]['includeAll']){_0x37832e[_0x3bc3('0x49')]=[{'all':!![]}];}_0x37832e=_['merge']({},_0x37832e,_0x4a7371[_0x3bc3('0x42')]);return db[_0x3bc3('0x2f')]['find'](_0x37832e)[_0x3bc3('0x25')](handleEntityNotFound(_0x131f70,null))['then'](respondWithResult(_0x131f70,null))[_0x3bc3('0x46')](handleError(_0x131f70,null));};exports['create']=function(_0x2d0a66,_0x3a5019){return db[_0x3bc3('0x2f')][_0x3bc3('0x4a')](_0x2d0a66['body'],{})[_0x3bc3('0x25')](function(_0x434109){var _0x4fb06a=_0x2d0a66['user']['get']({'plain':!![]});if(!_0x4fb06a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fb06a[_0x3bc3('0x4b')]==='user'){var _0x354179=_0x434109[_0x3bc3('0x4c')]({'plain':!![]});var _0x5a30b2='Reports';return db[_0x3bc3('0x4d')][_0x3bc3('0x4e')]({'where':{'name':_0x5a30b2,'userProfileId':_0x4fb06a[_0x3bc3('0x4f')]},'raw':!![]})[_0x3bc3('0x25')](function(_0x4fa377){if(_0x4fa377&&_0x4fa377[_0x3bc3('0x50')]===0x0){return db[_0x3bc3('0x27')][_0x3bc3('0x4a')]({'name':_0x354179[_0x3bc3('0x2b')],'resourceId':_0x354179['id'],'type':_0x3bc3('0x51'),'sectionId':_0x4fa377['id']},{})['then'](function(){return _0x434109;});}else{return _0x434109;}})[_0x3bc3('0x46')](function(_0x596971){logger['error'](_0x3bc3('0x52'),_0x596971);throw _0x596971;});}return _0x434109;})[_0x3bc3('0x25')](respondWithResult(_0x3a5019,0xc9))['catch'](handleError(_0x3a5019,null));};exports[_0x3bc3('0x24')]=function(_0x20dd4a,_0x57831b){if(_0x20dd4a[_0x3bc3('0x53')]['id']){delete _0x20dd4a['body']['id'];}return db[_0x3bc3('0x2f')][_0x3bc3('0x4e')]({'where':{'id':_0x20dd4a[_0x3bc3('0x47')]['id']}})[_0x3bc3('0x25')](handleEntityNotFound(_0x57831b,null))[_0x3bc3('0x25')](saveUpdates(_0x20dd4a[_0x3bc3('0x53')],null))[_0x3bc3('0x25')](respondWithResult(_0x57831b,null))[_0x3bc3('0x46')](handleError(_0x57831b,null));};exports[_0x3bc3('0x26')]=function(_0x3f4cfa,_0x1efe93){return db[_0x3bc3('0x2f')][_0x3bc3('0x4e')]({'where':{'id':_0x3f4cfa[_0x3bc3('0x47')]['id']}})[_0x3bc3('0x25')](handleEntityNotFound(_0x1efe93,null))[_0x3bc3('0x25')](removeEntity(_0x1efe93,null))['catch'](handleError(_0x1efe93,null));};exports[_0x3bc3('0x54')]=function(_0x2e04c7,_0x1e907c){var _0x4ce923=0xa;var _0x2a3992=[_0x3bc3('0x55'),_0x3bc3('0x56'),_0x3bc3('0x57'),'cross_join'];var _0x1f6168={'SUM':_0x3bc3('0x58'),'COUNT':_0x3bc3('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x3bc3('0x5a'),'AVG':_0x3bc3('0x5b'),'GROUP_CONCAT':_0x3bc3('0x5c'),'GROUP_CONCAT ASC':_0x3bc3('0x5d'),'GROUP_CONCAT DESC':_0x3bc3('0x5e')};var _0x2de29a={'SEC_TO_TIME':_0x3bc3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x3bc3('0x60'),'ROUND':_0x3bc3('0x61'),'UNIX_TIMESTAMP':_0x3bc3('0x62')};var _0x42579f=function(_0x4a3c1f){return!_[_0x3bc3('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x3bc3('0x64'),_0x3bc3('0x65')],_0x4a3c1f);};var _0x52ed08=function(_0x4a2938){if(!_0x4a2938||!_0x4a2938[_0x3bc3('0x66')][_0x3bc3('0x48')]){return'';}for(var _0x263429='(',_0x57079c=0x0;_0x57079c<_0x4a2938[_0x3bc3('0x66')][_0x3bc3('0x48')];_0x57079c+=0x1){_0x57079c>0x0&&(_0x263429+='\x20'+_0x4a2938[_0x3bc3('0x67')]+'\x20');_0x263429+=_0x4a2938[_0x3bc3('0x66')][_0x57079c][_0x3bc3('0x68')]?_0x52ed08(_0x4a2938[_0x3bc3('0x66')][_0x57079c]['group']):_0x4a2938[_0x3bc3('0x66')][_0x57079c]['field']+'\x20'+_0x4a2938[_0x3bc3('0x66')][_0x57079c][_0x3bc3('0x69')]+(_0x42579f(_0x4a2938['rules'][_0x57079c][_0x3bc3('0x69')])?'\x20'+_0x4a2938[_0x3bc3('0x66')][_0x57079c][_0x3bc3('0x6a')]:'');}return _0x263429+')';};var _0x429bdd={'where':{'id':_0x2e04c7[_0x3bc3('0x47')]['id']}},_0x40d4f6,_0x54f142,_0x5b0d49,_0x532bcb,_0x5c505f;_0x429bdd=_[_0x3bc3('0x41')]({},_0x429bdd,_0x2e04c7[_0x3bc3('0x42')]);return db['AnalyticCustomReport'][_0x3bc3('0x4e')](_0x429bdd)[_0x3bc3('0x25')](function(_0x2f1dac){if(_0x2f1dac){_0x40d4f6=_0x2f1dac;return _0x2f1dac[_0x3bc3('0x6b')]();}return null;})[_0x3bc3('0x25')](function(_0x842726){if(_0x842726){if(!_0x842726[_0x3bc3('0x48')]){throw new db[(_0x3bc3('0x6c'))][(_0x3bc3('0x6d'))](_0x3bc3('0x6e'),0x193);}_0x54f142=_0x842726;return db[_0x3bc3('0x6f')][_0x3bc3('0x44')]({'raw':!![]});}return null;})[_0x3bc3('0x25')](function(_0x4e640e){if(_0x4e640e){_0x5b0d49=_[_0x3bc3('0x70')](_0x4e640e,'id');var _0x2d7cd1;var _0x547b17=squel[_0x3bc3('0x71')]();_0x547b17[_0x3bc3('0x72')](_0x40d4f6[_0x3bc3('0x73')]);for(var _0x2ab007=0x0;_0x2ab007<_0x54f142['length'];_0x2ab007+=0x1){_0x2d7cd1=_0x54f142[_0x2ab007][_0x3bc3('0x74')]?_0x5b0d49[_0x54f142[_0x2ab007][_0x3bc3('0x74')]][_0x3bc3('0x75')]:_0x54f142[_0x2ab007]['field'];_0x2d7cd1=_0x54f142[_0x2ab007][_0x3bc3('0x76')]?_['replace'](_0x1f6168[_0x54f142[_0x2ab007][_0x3bc3('0x76')]],'%s',_0x2d7cd1):_0x2d7cd1;_0x2d7cd1=_0x54f142[_0x2ab007][_0x3bc3('0x77')]?_[_0x3bc3('0x78')](_0x2de29a[_0x54f142[_0x2ab007][_0x3bc3('0x77')]],'%s',_0x2d7cd1):_0x2d7cd1;if(_0x54f142[_0x2ab007][_0x3bc3('0x79')]){_0x547b17['group'](_0x2d7cd1);}_0x54f142[_0x2ab007]['orderBy']&&_0x547b17[_0x3bc3('0x3b')](_0x2d7cd1,_0x54f142[_0x2ab007]['orderBy']===_0x3bc3('0x7a')?![]:!![]);_0x547b17['field'](_0x2d7cd1,_0x54f142[_0x2ab007]['alias']||_0x2d7cd1);}if(_0x40d4f6[_0x3bc3('0x7b')]){_0x40d4f6[_0x3bc3('0x7b')]=JSON[_0x3bc3('0x7c')](_0x40d4f6[_0x3bc3('0x7b')]);for(var _0x12949b=0x0;_0x12949b<_0x40d4f6[_0x3bc3('0x7b')]['length'];_0x12949b+=0x1){if(_0x40d4f6[_0x3bc3('0x7b')][_0x12949b][_0x3bc3('0x32')]&&_['includes'](_0x2a3992,_0x40d4f6[_0x3bc3('0x7b')][_0x12949b][_0x3bc3('0x32')])&&_0x40d4f6[_0x3bc3('0x7b')][_0x12949b][_0x3bc3('0x7d')]&&_0x40d4f6[_0x3bc3('0x7b')][_0x12949b][_0x3bc3('0x7e')]&&_0x40d4f6[_0x3bc3('0x7b')][_0x12949b][_0x3bc3('0x7f')]){_0x547b17[_0x40d4f6[_0x3bc3('0x7b')][_0x12949b][_0x3bc3('0x32')]](_0x40d4f6[_0x3bc3('0x7b')][_0x12949b][_0x3bc3('0x7e')],null,util[_0x3bc3('0x77')]('%s.%s\x20=\x20%s.%s',_0x40d4f6[_0x3bc3('0x73')],_0x40d4f6['joins'][_0x12949b][_0x3bc3('0x7d')],_0x40d4f6[_0x3bc3('0x7b')][_0x12949b]['foreignTable'],_0x40d4f6[_0x3bc3('0x7b')][_0x12949b][_0x3bc3('0x7f')]));}}}if(_0x40d4f6['conditions']){_0x40d4f6[_0x3bc3('0x80')]=JSON['parse'](_0x40d4f6[_0x3bc3('0x80')]);_0x547b17[_0x3bc3('0x3d')](_0x52ed08(_0x40d4f6[_0x3bc3('0x80')][_0x3bc3('0x68')]));}_0x5c505f=_0x547b17[_0x3bc3('0x81')]();_0x547b17[_0x3bc3('0x1f')](_0x4ce923);_0x547b17[_0x3bc3('0x1d')](0x0);logger[_0x3bc3('0x82')]('Limited\x20Query:',_0x547b17[_0x3bc3('0x83')]());return dbH[_0x3bc3('0x84')]['query'](_0x547b17[_0x3bc3('0x83')](),{'type':dbH[_0x3bc3('0x84')][_0x3bc3('0x85')][_0x3bc3('0x86')]});}})[_0x3bc3('0x25')](respondWithResult(_0x1e907c,null))['catch'](handleError(_0x1e907c,null));};function runReport(_0x569657,_0xafef21,_0x1ea15c){var _0x412172=_0xafef21[_0x3bc3('0x2b')];var _0x28f6eb=0xa;var _0x54d07c=['join',_0x3bc3('0x56'),_0x3bc3('0x57'),_0x3bc3('0x87')];var _0xcf83ba={'SUM':_0x3bc3('0x58'),'COUNT':_0x3bc3('0x59'),'COUNT DISTINCT':_0x3bc3('0x88'),'MAX':_0x3bc3('0x89'),'MIN':'MIN(%s)','AVG':_0x3bc3('0x5b'),'GROUP_CONCAT':_0x3bc3('0x5c'),'GROUP_CONCAT ASC':_0x3bc3('0x5d'),'GROUP_CONCAT DESC':_0x3bc3('0x5e')};var _0x50141f={'SEC_TO_TIME':_0x3bc3('0x5f'),'DATE':_0x3bc3('0x8a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3bc3('0x62')};var _0x590144=function(_0x8728c7){return!_[_0x3bc3('0x63')](['IS\x20NULL',_0x3bc3('0x8b'),'IS\x20EMPTY',_0x3bc3('0x65')],_0x8728c7);};var _0x3e0266=function(_0x40171a){if(!_0x40171a||!_0x40171a['rules'][_0x3bc3('0x48')]){return'';}for(var _0x183e2f='(',_0x2ee654=0x0;_0x2ee654<_0x40171a[_0x3bc3('0x66')][_0x3bc3('0x48')];_0x2ee654+=0x1){_0x2ee654>0x0&&(_0x183e2f+='\x20'+_0x40171a['operator']+'\x20');_0x183e2f+=_0x40171a[_0x3bc3('0x66')][_0x2ee654][_0x3bc3('0x68')]?_0x3e0266(_0x40171a[_0x3bc3('0x66')][_0x2ee654]['group']):_0x40171a[_0x3bc3('0x66')][_0x2ee654]['field']+'\x20'+_0x40171a['rules'][_0x2ee654][_0x3bc3('0x69')]+(_0x590144(_0x40171a['rules'][_0x2ee654][_0x3bc3('0x69')])?'\x20'+_0x40171a[_0x3bc3('0x66')][_0x2ee654][_0x3bc3('0x6a')]:'');}return _0x183e2f+')';};var _0x229d3a={'where':{'id':_0x569657['id']}},_0x2defb4,_0x5444a8,_0x2ddcc0,_0xfb55b0,_0x115157;_0x229d3a=_[_0x3bc3('0x41')]({},_0x229d3a,_0x1ea15c);return db['AnalyticCustomReport'][_0x3bc3('0x4e')](_0x229d3a)['then'](function(_0x444f58){if(_0x444f58){_0x2defb4=_0x444f58;return _0x444f58[_0x3bc3('0x6b')]();}return null;})[_0x3bc3('0x25')](function(_0x1aa219){if(_0x1aa219){if(!_0x1aa219[_0x3bc3('0x48')]){throw new db['Sequelize']['ValidationErrorItem'](_0x3bc3('0x6e'),0x193);}_0x5444a8=_0x1aa219;return db['AnalyticMetric'][_0x3bc3('0x44')]({'raw':!![]});}return null;})['then'](function(_0x4b455e){if(_0x4b455e){_0x2ddcc0=_[_0x3bc3('0x70')](_0x4b455e,'id');var _0x35aba;var _0x5b80c8=squel[_0x3bc3('0x71')]();_0x5b80c8[_0x3bc3('0x72')](_0x2defb4['table']);for(var _0x5e20da=0x0;_0x5e20da<_0x5444a8['length'];_0x5e20da+=0x1){_0x35aba=_0x5444a8[_0x5e20da][_0x3bc3('0x74')]?_0x2ddcc0[_0x5444a8[_0x5e20da]['MetricId']][_0x3bc3('0x75')]:_0x5444a8[_0x5e20da][_0x3bc3('0x8c')];_0x35aba=_0x5444a8[_0x5e20da][_0x3bc3('0x76')]?_[_0x3bc3('0x78')](_0xcf83ba[_0x5444a8[_0x5e20da][_0x3bc3('0x76')]],'%s',_0x35aba):_0x35aba;_0x35aba=_0x5444a8[_0x5e20da][_0x3bc3('0x77')]?_[_0x3bc3('0x78')](_0x50141f[_0x5444a8[_0x5e20da][_0x3bc3('0x77')]],'%s',_0x35aba):_0x35aba;if(_0x5444a8[_0x5e20da]['groupBy']){_0x5b80c8[_0x3bc3('0x68')](_0x35aba);}_0x5444a8[_0x5e20da][_0x3bc3('0x8d')]&&_0x5b80c8[_0x3bc3('0x3b')](_0x35aba,_0x5444a8[_0x5e20da][_0x3bc3('0x8d')]===_0x3bc3('0x7a')?![]:!![]);_0x5b80c8[_0x3bc3('0x8c')](_0x35aba,_0x5444a8[_0x5e20da][_0x3bc3('0x8e')]||_0x35aba);}if(_0x2defb4[_0x3bc3('0x7b')]){_0x2defb4[_0x3bc3('0x7b')]=JSON[_0x3bc3('0x7c')](_0x2defb4[_0x3bc3('0x7b')]);for(var _0x4e1088=0x0;_0x4e1088<_0x2defb4[_0x3bc3('0x7b')]['length'];_0x4e1088+=0x1){if(_0x2defb4[_0x3bc3('0x7b')][_0x4e1088]['type']&&_[_0x3bc3('0x63')](_0x54d07c,_0x2defb4[_0x3bc3('0x7b')][_0x4e1088][_0x3bc3('0x32')])&&_0x2defb4[_0x3bc3('0x7b')][_0x4e1088][_0x3bc3('0x7d')]&&_0x2defb4['joins'][_0x4e1088][_0x3bc3('0x7e')]&&_0x2defb4[_0x3bc3('0x7b')][_0x4e1088][_0x3bc3('0x7f')]){_0x5b80c8[_0x2defb4['joins'][_0x4e1088][_0x3bc3('0x32')]](_0x2defb4[_0x3bc3('0x7b')][_0x4e1088][_0x3bc3('0x7e')],null,util[_0x3bc3('0x77')](_0x3bc3('0x8f'),_0x2defb4['table'],_0x2defb4[_0x3bc3('0x7b')][_0x4e1088][_0x3bc3('0x7d')],_0x2defb4[_0x3bc3('0x7b')][_0x4e1088][_0x3bc3('0x7e')],_0x2defb4[_0x3bc3('0x7b')][_0x4e1088]['foreignKey']));}}}if(_0x2defb4[_0x3bc3('0x80')]){_0x2defb4[_0x3bc3('0x80')]=JSON[_0x3bc3('0x7c')](_0x2defb4['conditions']);_0x5b80c8[_0x3bc3('0x3d')](_0x3e0266(_0x2defb4[_0x3bc3('0x80')][_0x3bc3('0x68')]));}_0x115157=_0x5b80c8[_0x3bc3('0x81')]();_0x5b80c8[_0x3bc3('0x1f')](_0x28f6eb);_0x5b80c8['offset'](0x0);return;}})['then'](function(){if(_0xafef21[_0x3bc3('0x90')]===_0x3bc3('0x91')){return null;}var _0x46bfb1=_['merge'](_0xafef21,{'name':_0xafef21['fullPath']||_0xafef21[_0x3bc3('0x2b')]||_0x2defb4[_0x3bc3('0x2b')],'basename':_0x412172,'savename':util[_0x3bc3('0x77')](_0x3bc3('0x92'),_0xafef21[_0x3bc3('0x2b')]||_0x2defb4['name'],require(_0x3bc3('0x93'))[_0x3bc3('0x94')](0x4),_0xafef21[_0x3bc3('0x90')]||'csv'),'reportId':_0x2defb4['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x3bc3('0x4a')](_0x46bfb1,{'raw':!![]});})[_0x3bc3('0x25')](function(_0x190f77){if(_0x2defb4['table']===_0x3bc3('0x95')){_0x115157[_0x3bc3('0x3d')](_0x2defb4[_0x3bc3('0x73')]+_0x3bc3('0x96'),_0xafef21[_0x3bc3('0x97')],_0xafef21[_0x3bc3('0x98')]);}else{_0x115157[_0x3bc3('0x3d')](_0x2defb4[_0x3bc3('0x73')]+_0x3bc3('0x99'),_0xafef21[_0x3bc3('0x97')],_0xafef21[_0x3bc3('0x98')]);}if(_0x190f77){logger['info']('Run\x20Query:',_0x115157[_0x3bc3('0x83')]());require(_0x3bc3('0x9a'))[_0x3bc3('0x9b')](path[_0x3bc3('0x55')](__dirname,'../../components/export/',_0x190f77[_0x3bc3('0x90')]),[_0x190f77['id'],_0x115157[_0x3bc3('0x83')](),path[_0x3bc3('0x55')](__dirname,_0x3bc3('0x9c'),_0x190f77[_0x3bc3('0x9d')]),_0x412172]);return _0x190f77;}else{var _0x18d81a=squel[_0x3bc3('0x71')]();_0x18d81a[_0x3bc3('0x72')]('('+_0x115157[_0x3bc3('0x83')]()+')','countTable');_0x18d81a[_0x3bc3('0x8c')]('COUNT(*)',_0x3bc3('0x20'));_0x115157[_0x3bc3('0x1f')](_0xafef21['limit']||_0x28f6eb);_0x115157[_0x3bc3('0x1d')](_0xafef21['offset']||0x0);return dbH[_0x3bc3('0x84')]['query'](_0x18d81a[_0x3bc3('0x83')](),{'type':dbH['sequelize'][_0x3bc3('0x85')][_0x3bc3('0x86')]})['then'](function(_0x536440){if(!_0x536440[_0x3bc3('0x48')]){_0xfb55b0=0x0;}else{_0xfb55b0=_0x536440[0x0][_0x3bc3('0x20')]||0x0;}return dbH[_0x3bc3('0x84')]['query'](_0x115157['toString'](),{'type':dbH[_0x3bc3('0x84')]['QueryTypes']['SELECT']});})['then'](function(_0x415ffe){return{'rows':_0x415ffe||[],'count':_0xfb55b0};});}});}exports[_0x3bc3('0x9e')]=function(_0x58b845,_0x4f9d3e){return runReport(_0x58b845['params'],_0x58b845['query'],_0x58b845[_0x3bc3('0x42')])[_0x3bc3('0x25')](respondWithResult(_0x4f9d3e,null))['catch'](handleError(_0x4f9d3e,null));};exports[_0x3bc3('0x9f')]=runReport;exports['query']=function(_0x2e2506,_0x70a8d6){var _0x4e757b=0xa;var _0x4a4a53=[_0x3bc3('0x55'),_0x3bc3('0x56'),'right_join',_0x3bc3('0x87')];var _0x539ea2={'SUM':_0x3bc3('0x58'),'COUNT':_0x3bc3('0x59'),'COUNT DISTINCT':_0x3bc3('0x88'),'MAX':_0x3bc3('0x89'),'MIN':_0x3bc3('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3bc3('0x5e')};var _0x9d12dd={'SEC_TO_TIME':_0x3bc3('0x5f'),'DATE':_0x3bc3('0x8a'),'HOUR':'HOUR(%s)','ROUND':_0x3bc3('0x61'),'UNIX_TIMESTAMP':_0x3bc3('0x62')};var _0xa8cc41=function(_0x1ea472){return!_[_0x3bc3('0x63')]([_0x3bc3('0xa0'),_0x3bc3('0x8b'),_0x3bc3('0x64'),_0x3bc3('0x65')],_0x1ea472);};var _0x1b7453=function(_0x25d910){if(!_0x25d910||!_0x25d910[_0x3bc3('0x66')]['length']){return'';}for(var _0x42ab23='(',_0x1f663c=0x0;_0x1f663c<_0x25d910[_0x3bc3('0x66')][_0x3bc3('0x48')];_0x1f663c+=0x1){_0x1f663c>0x0&&(_0x42ab23+='\x20'+_0x25d910[_0x3bc3('0x67')]+'\x20');_0x42ab23+=_0x25d910[_0x3bc3('0x66')][_0x1f663c][_0x3bc3('0x68')]?_0x1b7453(_0x25d910[_0x3bc3('0x66')][_0x1f663c][_0x3bc3('0x68')]):_0x25d910[_0x3bc3('0x66')][_0x1f663c][_0x3bc3('0x8c')]+'\x20'+_0x25d910[_0x3bc3('0x66')][_0x1f663c][_0x3bc3('0x69')]+(_0xa8cc41(_0x25d910[_0x3bc3('0x66')][_0x1f663c][_0x3bc3('0x69')])?'\x20'+_0x25d910[_0x3bc3('0x66')][_0x1f663c][_0x3bc3('0x6a')]:'');}return _0x42ab23+')';};var _0xc8e386={'where':{'id':_0x2e2506[_0x3bc3('0x47')]['id']}},_0x43b039,_0x4e7db5,_0x5aaa2c,_0x1b12a5,_0x52108a;_0xc8e386=_[_0x3bc3('0x41')]({},_0xc8e386,_0x2e2506['options']);return db[_0x3bc3('0x2f')][_0x3bc3('0x4e')](_0xc8e386)[_0x3bc3('0x25')](function(_0x23322b){if(_0x23322b){_0x43b039=_0x23322b;return _0x23322b[_0x3bc3('0x6b')]();}return null;})[_0x3bc3('0x25')](function(_0x4d46cb){if(_0x4d46cb){if(!_0x4d46cb[_0x3bc3('0x48')]){throw new db[(_0x3bc3('0x6c'))][(_0x3bc3('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4e7db5=_0x4d46cb;return db[_0x3bc3('0x6f')][_0x3bc3('0x44')]({'raw':!![]});}return null;})['then'](function(_0x164f41){if(_0x164f41){_0x5aaa2c=_[_0x3bc3('0x70')](_0x164f41,'id');var _0x9b0cda;var _0x753bbd=squel[_0x3bc3('0x71')]();_0x753bbd[_0x3bc3('0x72')](_0x43b039[_0x3bc3('0x73')]);for(var _0x3045fa=0x0;_0x3045fa<_0x4e7db5[_0x3bc3('0x48')];_0x3045fa+=0x1){_0x9b0cda=_0x4e7db5[_0x3045fa][_0x3bc3('0x74')]?_0x5aaa2c[_0x4e7db5[_0x3045fa]['MetricId']][_0x3bc3('0x75')]:_0x4e7db5[_0x3045fa][_0x3bc3('0x8c')];_0x9b0cda=_0x4e7db5[_0x3045fa]['function']?_[_0x3bc3('0x78')](_0x539ea2[_0x4e7db5[_0x3045fa][_0x3bc3('0x76')]],'%s',_0x9b0cda):_0x9b0cda;_0x9b0cda=_0x4e7db5[_0x3045fa][_0x3bc3('0x77')]?_['replace'](_0x9d12dd[_0x4e7db5[_0x3045fa]['format']],'%s',_0x9b0cda):_0x9b0cda;if(_0x4e7db5[_0x3045fa][_0x3bc3('0x79')]){_0x753bbd[_0x3bc3('0x68')](_0x9b0cda);}_0x4e7db5[_0x3045fa]['orderBy']&&_0x753bbd[_0x3bc3('0x3b')](_0x9b0cda,_0x4e7db5[_0x3045fa][_0x3bc3('0x8d')]===_0x3bc3('0x7a')?![]:!![]);_0x753bbd[_0x3bc3('0x8c')](_0x9b0cda,_0x4e7db5[_0x3045fa][_0x3bc3('0x8e')]||_0x9b0cda);}if(_0x43b039['joins']){_0x43b039[_0x3bc3('0x7b')]=JSON[_0x3bc3('0x7c')](_0x43b039[_0x3bc3('0x7b')]);for(var _0xd212eb=0x0;_0xd212eb<_0x43b039[_0x3bc3('0x7b')]['length'];_0xd212eb+=0x1){if(_0x43b039[_0x3bc3('0x7b')][_0xd212eb]['type']&&_[_0x3bc3('0x63')](_0x4a4a53,_0x43b039['joins'][_0xd212eb]['type'])&&_0x43b039[_0x3bc3('0x7b')][_0xd212eb][_0x3bc3('0x7d')]&&_0x43b039[_0x3bc3('0x7b')][_0xd212eb][_0x3bc3('0x7e')]&&_0x43b039[_0x3bc3('0x7b')][_0xd212eb]['foreignKey']){_0x753bbd[_0x43b039[_0x3bc3('0x7b')][_0xd212eb][_0x3bc3('0x32')]](_0x43b039[_0x3bc3('0x7b')][_0xd212eb][_0x3bc3('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x43b039[_0x3bc3('0x73')],_0x43b039['joins'][_0xd212eb][_0x3bc3('0x7d')],_0x43b039[_0x3bc3('0x7b')][_0xd212eb][_0x3bc3('0x7e')],_0x43b039['joins'][_0xd212eb][_0x3bc3('0x7f')]));}}}if(_0x43b039[_0x3bc3('0x80')]){_0x43b039[_0x3bc3('0x80')]=JSON['parse'](_0x43b039[_0x3bc3('0x80')]);_0x753bbd['where'](_0x1b7453(_0x43b039['conditions'][_0x3bc3('0x68')]));}_0x52108a=_0x753bbd[_0x3bc3('0x81')]();_0x753bbd[_0x3bc3('0x1f')](_0x4e757b);_0x753bbd['offset'](0x0);logger['debug'](_0x3bc3('0xa1'),_0x753bbd[_0x3bc3('0x83')]());return dbH['sequelize'][_0x3bc3('0x35')](_0x753bbd[_0x3bc3('0x83')](),{'type':dbH[_0x3bc3('0x84')][_0x3bc3('0x85')][_0x3bc3('0x86')]});}})[_0x3bc3('0x25')](function(){return{'sql':_0x52108a[_0x3bc3('0x83')]()};})[_0x3bc3('0x25')](respondWithResult(_0x70a8d6,null))[_0x3bc3('0x46')](handleError(_0x70a8d6,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index f05cf5c..2b88923 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 _0xcfc5=['moment','request-promise','path','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','api'];(function(_0x30f9ed,_0x292d34){var _0x13dc35=function(_0x239060){while(--_0x239060){_0x30f9ed['push'](_0x30f9ed['shift']());}};_0x13dc35(++_0x292d34);}(_0xcfc5,0x1ac));var _0x5cfc=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xcfc5[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x5cfc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5cfc('0x1'));var moment=require(_0x5cfc('0x2'));var BPromise=require('bluebird');var rp=require(_0x5cfc('0x3'));var fs=require('fs');var path=require(_0x5cfc('0x4'));var rimraf=require('rimraf');var config=require(_0x5cfc('0x5'));var attributes=require('./analyticCustomReport.attributes');module[_0x5cfc('0x6')]=function(_0x1c114c,_0x39961c){return _0x1c114c[_0x5cfc('0x7')](_0x5cfc('0x8'),attributes,{'tableName':_0x5cfc('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x490b=['../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2aec81,_0x2086d7){var _0x49b124=function(_0x1cee22){while(--_0x1cee22){_0x2aec81['push'](_0x2aec81['shift']());}};_0x49b124(++_0x2086d7);}(_0x490b,0x19c));var _0xb490=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x490b[_0x130705];return _0x1fa991;};'use strict';var _=require('lodash');var util=require(_0xb490('0x0'));var logger=require(_0xb490('0x1'))(_0xb490('0x2'));var moment=require('moment');var BPromise=require(_0xb490('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb490('0x4'));var rimraf=require(_0xb490('0x5'));var config=require(_0xb490('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xb490('0x7')]=function(_0x43d6e0,_0x5790dc){return _0x43d6e0[_0xb490('0x8')](_0xb490('0x9'),attributes,{'tableName':_0xb490('0xa'),'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 bdfe51f..e7298a5 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 _0x3e2f=['info','result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x545d7c,_0x2ed9e6){var _0x364159=function(_0x479da4){while(--_0x479da4){_0x545d7c['push'](_0x545d7c['shift']());}};_0x364159(++_0x2ed9e6);}(_0x3e2f,0x1df));var _0xf3e2=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x3e2f[_0x1ee351];return _0x245aaf;};'use strict';var _=require('lodash');var util=require(_0xf3e2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3e2('0x1'));var db=require(_0xf3e2('0x2'))['db'];var utils=require(_0xf3e2('0x3'));var logger=require(_0xf3e2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xddccad,_0x174128,_0x4819be){return new BPromise(function(_0x90e366,_0x254d80){return client['request'](_0xddccad,_0x4819be)[_0xf3e2('0x5')](function(_0xe31baa){logger['info'](_0xf3e2('0x6'),_0x174128,_0xf3e2('0x7'));logger[_0xf3e2('0x8')](_0xf3e2('0x9'),_0x174128,'request\x20sent',JSON[_0xf3e2('0xa')](_0xe31baa));if(_0xe31baa[_0xf3e2('0xb')]){if(_0xe31baa[_0xf3e2('0xb')][_0xf3e2('0xc')]===0x1f4){logger['error'](_0xf3e2('0x6'),_0x174128,_0xe31baa[_0xf3e2('0xb')][_0xf3e2('0xd')]);return _0x254d80(_0xe31baa[_0xf3e2('0xb')]['message']);}logger[_0xf3e2('0xb')](_0xf3e2('0x6'),_0x174128,_0xe31baa['error']['message']);return _0x90e366(_0xe31baa[_0xf3e2('0xb')][_0xf3e2('0xd')]);}else{logger[_0xf3e2('0xe')](_0xf3e2('0x6'),_0x174128,'request\x20sent');_0x90e366(_0xe31baa[_0xf3e2('0xf')][_0xf3e2('0xd')]);}})[_0xf3e2('0x10')](function(_0x224720){logger[_0xf3e2('0xb')](_0xf3e2('0x6'),_0x174128,_0x224720);_0x254d80(_0x224720);});});} \ No newline at end of file +var _0xdccc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xdccc,0x104));var _0xcdcc=function(_0x13d6b6,_0x2e6dfb){_0x13d6b6=_0x13d6b6-0x0;var _0x1137b3=_0xdccc[_0x13d6b6];return _0x1137b3;};'use strict';var _=require(_0xcdcc('0x0'));var util=require(_0xcdcc('0x1'));var moment=require(_0xcdcc('0x2'));var BPromise=require(_0xcdcc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdcc('0x4'));var db=require(_0xcdcc('0x5'))['db'];var utils=require(_0xcdcc('0x6'));var logger=require(_0xcdcc('0x7'))('rpc');var config=require(_0xcdcc('0x8'));var jayson=require(_0xcdcc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x394389,_0xeb2ff6,_0x24ed21){return new BPromise(function(_0x1f8b61,_0x33b34b){return client[_0xcdcc('0xa')](_0x394389,_0x24ed21)[_0xcdcc('0xb')](function(_0x5b00dd){logger[_0xcdcc('0xc')](_0xcdcc('0xd'),_0xeb2ff6,_0xcdcc('0xe'));logger[_0xcdcc('0xf')](_0xcdcc('0x10'),_0xeb2ff6,_0xcdcc('0xe'),JSON[_0xcdcc('0x11')](_0x5b00dd));if(_0x5b00dd[_0xcdcc('0x12')]){if(_0x5b00dd['error'][_0xcdcc('0x13')]===0x1f4){logger[_0xcdcc('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xeb2ff6,_0x5b00dd['error'][_0xcdcc('0x14')]);return _0x33b34b(_0x5b00dd['error'][_0xcdcc('0x14')]);}logger[_0xcdcc('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xeb2ff6,_0x5b00dd['error']['message']);return _0x1f8b61(_0x5b00dd[_0xcdcc('0x12')][_0xcdcc('0x14')]);}else{logger[_0xcdcc('0xc')](_0xcdcc('0xd'),_0xeb2ff6,_0xcdcc('0xe'));_0x1f8b61(_0x5b00dd['result'][_0xcdcc('0x14')]);}})[_0xcdcc('0x15')](function(_0x54cca8){logger[_0xcdcc('0x12')](_0xcdcc('0xd'),_0xeb2ff6,_0x54cca8);_0x33b34b(_0x54cca8);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a65040d..012a252 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 _0x56c2=['./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x47abbc,_0x5a8c7a){var _0x55a157=function(_0x1e3f32){while(--_0x1e3f32){_0x47abbc['push'](_0x47abbc['shift']());}};_0x55a157(++_0x5a8c7a);}(_0x56c2,0xe1));var _0x256c=function(_0x5eaae7,_0x577c09){_0x5eaae7=_0x5eaae7-0x0;var _0x591743=_0x56c2[_0x5eaae7];return _0x591743;};'use strict';var multer=require(_0x256c('0x0'));var util=require(_0x256c('0x1'));var path=require(_0x256c('0x2'));var timeout=require(_0x256c('0x3'));var express=require(_0x256c('0x4'));var router=express['Router']();var fs_extra=require(_0x256c('0x5'));var auth=require(_0x256c('0x6'));var interaction=require(_0x256c('0x7'));var config=require(_0x256c('0x8'));var controller=require(_0x256c('0x9'));router[_0x256c('0xa')]('/',auth[_0x256c('0xb')](),controller[_0x256c('0xc')]);router[_0x256c('0xa')](_0x256c('0xd'),auth[_0x256c('0xb')](),controller[_0x256c('0xe')]);router[_0x256c('0xa')](_0x256c('0xf'),auth[_0x256c('0xb')](),controller[_0x256c('0x10')]);router[_0x256c('0xa')](_0x256c('0x11'),auth['isAuthenticated'](),controller[_0x256c('0x12')]);router[_0x256c('0xa')](_0x256c('0x13'),auth[_0x256c('0xb')](),controller[_0x256c('0x14')]);router[_0x256c('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x256c('0x16')](_0x256c('0xd'),auth[_0x256c('0xb')](),controller['update']);router[_0x256c('0x17')]('/:id',auth[_0x256c('0xb')](),controller[_0x256c('0x18')]);module[_0x256c('0x19')]=router; \ No newline at end of file +var _0xd71a=['path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy','exports','util'];(function(_0x3cd133,_0x222fcb){var _0x2512c8=function(_0x484491){while(--_0x484491){_0x3cd133['push'](_0x3cd133['shift']());}};_0x2512c8(++_0x222fcb);}(_0xd71a,0x18e));var _0xad71=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd71a[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0xad71('0x0'));var path=require(_0xad71('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xad71('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xad71('0x3'));var config=require(_0xad71('0x4'));var controller=require('./analyticCustomReport.controller');router[_0xad71('0x5')]('/',auth[_0xad71('0x6')](),controller['index']);router[_0xad71('0x5')](_0xad71('0x7'),auth[_0xad71('0x6')](),controller[_0xad71('0x8')]);router['get'](_0xad71('0x9'),auth[_0xad71('0x6')](),controller[_0xad71('0xa')]);router[_0xad71('0x5')](_0xad71('0xb'),auth[_0xad71('0x6')](),controller[_0xad71('0xc')]);router[_0xad71('0x5')]('/:id/query',auth[_0xad71('0x6')](),controller[_0xad71('0xd')]);router[_0xad71('0xe')]('/',auth[_0xad71('0x6')](),controller[_0xad71('0xf')]);router[_0xad71('0x10')](_0xad71('0x7'),auth[_0xad71('0x6')](),controller[_0xad71('0x11')]);router[_0xad71('0x12')](_0xad71('0x7'),auth[_0xad71('0x6')](),controller[_0xad71('0x13')]);module[_0xad71('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 a014092..8df045e 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x5c8643,_0x4f7c4d){var _0x546259=function(_0x2e1d6e){while(--_0x2e1d6e){_0x5c8643['push'](_0x5c8643['shift']());}};_0x546259(++_0x4f7c4d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0x154556,_0x3a3581){var _0x3658b9=function(_0x58fdd3){while(--_0x58fdd3){_0x154556['push'](_0x154556['shift']());}};_0x3658b9(++_0x3a3581);}(_0xa630,0xbe));var _0x0a63=function(_0x1c6a36,_0x5464c7){_0x1c6a36=_0x1c6a36-0x0;var _0x4ae3cb=_0xa630[_0x1c6a36];return _0x4ae3cb;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 3248dad..835d074 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 _0x2542=['getFields','ValidationErrorItem','metric','format','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','sequelize','SELECT','run','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','save','destroy','then','get','end','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','field','replace','function','groupBy','orderBy','alias','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','value'];(function(_0x366280,_0x4e0c44){var _0x213351=function(_0x1f2ec1){while(--_0x1f2ec1){_0x366280['push'](_0x366280['shift']());}};_0x213351(++_0x4e0c44);}(_0x2542,0x169));var _0x2254=function(_0x3c4e73,_0x1a5a6b){_0x3c4e73=_0x3c4e73-0x0;var _0x1dc209=_0x2542[_0x3c4e73];return _0x1dc209;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];var dbH=require(_0x2254('0x19'))[_0x2254('0x1a')];function respondWithStatusCode(_0x3c326b,_0x381efe){_0x381efe=_0x381efe||0xcc;return function(_0x592a4f){if(_0x592a4f){return _0x3c326b[_0x2254('0x1b')](_0x381efe);}return _0x3c326b[_0x2254('0x1c')](_0x381efe)['end']();};}function respondWithResult(_0x2f4de,_0x1e582d){_0x1e582d=_0x1e582d||0xc8;return function(_0xfb23cb){if(_0xfb23cb){return _0x2f4de[_0x2254('0x1c')](_0x1e582d)[_0x2254('0x1d')](_0xfb23cb);}};}function respondWithFilteredResult(_0xbc5548,_0x50f137){return function(_0x18baf4){if(_0x18baf4){var _0x57247a=typeof _0x50f137[_0x2254('0x1e')]===_0x2254('0x1f')&&typeof _0x50f137[_0x2254('0x20')]===_0x2254('0x1f');var _0x1ae11e=_0x18baf4[_0x2254('0x21')];var _0x497724=_0x57247a?0x0:_0x50f137['offset'];var _0x5ec98d=_0x57247a?_0x18baf4[_0x2254('0x21')]:_0x50f137[_0x2254('0x1e')]+_0x50f137[_0x2254('0x20')];var _0x1f1163;if(_0x5ec98d>=_0x1ae11e){_0x5ec98d=_0x1ae11e;_0x1f1163=0xc8;}else{_0x1f1163=0xce;}_0xbc5548[_0x2254('0x1c')](_0x1f1163);return _0xbc5548[_0x2254('0x22')]('Content-Range',_0x497724+'-'+_0x5ec98d+'/'+_0x1ae11e)[_0x2254('0x1d')](_0x18baf4);}return null;};}function patchUpdates(_0x16148d){return function(_0x906cde){try{jsonpatch['apply'](_0x906cde,_0x16148d,!![]);}catch(_0x52fedc){return BPromise['reject'](_0x52fedc);}return _0x906cde[_0x2254('0x23')]();};}function saveUpdates(_0x559af4,_0xf88b56){return function(_0x56b91e){if(_0x56b91e){return _0x56b91e['update'](_0x559af4)['then'](function(_0x540020){return _0x540020;});}return null;};}function removeEntity(_0x5e5edb,_0x4f797d){return function(_0x1aa71f){if(_0x1aa71f){return _0x1aa71f[_0x2254('0x24')]()[_0x2254('0x25')](function(){var _0x265467=_0x1aa71f[_0x2254('0x26')]({'plain':!![]});var _0x1349c9='DefaultReports';return db['UserProfileResource'][_0x2254('0x24')]({'where':{'type':_0x1349c9,'resourceId':_0x265467['id']}})['then'](function(){return _0x1aa71f;});})[_0x2254('0x25')](function(){_0x5e5edb[_0x2254('0x1c')](0xcc)[_0x2254('0x27')]();});}};}function handleEntityNotFound(_0x3aa0bd,_0x19043b){return function(_0x482688){if(!_0x482688){_0x3aa0bd[_0x2254('0x1b')](0x194);}return _0x482688;};}function handleError(_0x2a789b,_0x21285d){_0x21285d=_0x21285d||0x1f4;return function(_0x37af8b){logger[_0x2254('0x28')](_0x37af8b[_0x2254('0x29')]);if(_0x37af8b[_0x2254('0x2a')]){delete _0x37af8b[_0x2254('0x2a')];}_0x2a789b[_0x2254('0x1c')](_0x21285d)[_0x2254('0x2b')](_0x37af8b);};}exports[_0x2254('0x2c')]=function(_0xad7774,_0x220f2a){var _0x27d30a={},_0x4577f4={},_0x1b16c8={'count':0x0,'rows':[]};var _0x2c929f=_[_0x2254('0x2d')](db[_0x2254('0x2e')]['rawAttributes'],function(_0xe29526){return{'name':_0xe29526[_0x2254('0x2f')],'type':_0xe29526[_0x2254('0x30')][_0x2254('0x31')]};});_0x4577f4[_0x2254('0x32')]=_[_0x2254('0x2d')](_0x2c929f,_0x2254('0x2a'));_0x4577f4[_0x2254('0x33')]=_[_0x2254('0x34')](_0xad7774['query']);_0x4577f4[_0x2254('0x35')]=_[_0x2254('0x36')](_0x4577f4['model'],_0x4577f4[_0x2254('0x33')]);_0x27d30a[_0x2254('0x37')]=_[_0x2254('0x36')](_0x4577f4[_0x2254('0x32')],qs['fields'](_0xad7774['query'][_0x2254('0x38')]));_0x27d30a['attributes']=_0x27d30a[_0x2254('0x37')][_0x2254('0x39')]?_0x27d30a[_0x2254('0x37')]:_0x4577f4[_0x2254('0x32')];if(!_0xad7774[_0x2254('0x33')][_0x2254('0x3a')](_0x2254('0x3b'))){_0x27d30a['limit']=qs[_0x2254('0x20')](_0xad7774[_0x2254('0x33')][_0x2254('0x20')]);_0x27d30a[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0xad7774[_0x2254('0x33')][_0x2254('0x1e')]);}_0x27d30a[_0x2254('0x3c')]=qs[_0x2254('0x3d')](_0xad7774[_0x2254('0x33')]['sort']);_0x27d30a[_0x2254('0x3e')]=qs[_0x2254('0x35')](_[_0x2254('0x3f')](_0xad7774[_0x2254('0x33')],_0x4577f4['filters']),_0x2c929f);if(_0xad7774[_0x2254('0x33')][_0x2254('0x40')]){_0x27d30a[_0x2254('0x3e')]=_[_0x2254('0x41')](_0x27d30a[_0x2254('0x3e')],{'$or':_[_0x2254('0x2d')](_0x2c929f,function(_0x423377){if(_0x423377[_0x2254('0x30')]!=='VIRTUAL'){var _0x362ad1={};_0x362ad1[_0x423377['name']]={'$like':'%'+_0xad7774[_0x2254('0x33')][_0x2254('0x40')]+'%'};return _0x362ad1;}})});}_0x27d30a=_[_0x2254('0x41')]({},_0x27d30a,_0xad7774[_0x2254('0x42')]);var _0x460bb3={'where':_0x27d30a[_0x2254('0x3e')]};return db[_0x2254('0x2e')]['count'](_0x460bb3)[_0x2254('0x25')](function(_0x2f1ff9){_0x1b16c8[_0x2254('0x21')]=_0x2f1ff9;if(_0xad7774[_0x2254('0x33')][_0x2254('0x43')]){_0x27d30a['include']=[{'all':!![]}];}return db[_0x2254('0x2e')][_0x2254('0x44')](_0x27d30a);})[_0x2254('0x25')](function(_0x135ed8){_0x1b16c8[_0x2254('0x45')]=_0x135ed8;return _0x1b16c8;})['then'](respondWithFilteredResult(_0x220f2a,_0x27d30a))[_0x2254('0x46')](handleError(_0x220f2a,null));};exports['show']=function(_0x91e091,_0x1ded9a){var _0xb4d042={'raw':!![],'where':{'id':_0x91e091[_0x2254('0x47')]['id']}},_0x31c31e={};_0x31c31e[_0x2254('0x32')]=_[_0x2254('0x34')](db[_0x2254('0x2e')][_0x2254('0x48')]);_0x31c31e[_0x2254('0x33')]=_[_0x2254('0x34')](_0x91e091[_0x2254('0x33')]);_0x31c31e[_0x2254('0x35')]=_['intersection'](_0x31c31e[_0x2254('0x32')],_0x31c31e[_0x2254('0x33')]);_0xb4d042[_0x2254('0x37')]=_['intersection'](_0x31c31e[_0x2254('0x32')],qs[_0x2254('0x38')](_0x91e091[_0x2254('0x33')][_0x2254('0x38')]));_0xb4d042[_0x2254('0x37')]=_0xb4d042[_0x2254('0x37')][_0x2254('0x39')]?_0xb4d042[_0x2254('0x37')]:_0x31c31e[_0x2254('0x32')];if(_0x91e091['query'][_0x2254('0x43')]){_0xb4d042[_0x2254('0x49')]=[{'all':!![]}];}_0xb4d042=_[_0x2254('0x41')]({},_0xb4d042,_0x91e091[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0xb4d042)[_0x2254('0x25')](handleEntityNotFound(_0x1ded9a,null))[_0x2254('0x25')](respondWithResult(_0x1ded9a,null))[_0x2254('0x46')](handleError(_0x1ded9a,null));};exports[_0x2254('0x4b')]=function(_0x5b14c5,_0x36b977){return db[_0x2254('0x2e')]['create'](_0x5b14c5[_0x2254('0x4c')],{})[_0x2254('0x25')](function(_0x12e2ff){var _0x4331a9=_0x5b14c5['user'][_0x2254('0x26')]({'plain':!![]});if(!_0x4331a9)throw new Error(_0x2254('0x4d'));if(_0x4331a9['role']===_0x2254('0x4e')){var _0x3f0670=_0x12e2ff[_0x2254('0x26')]({'plain':!![]});var _0x43bb88='Reports';return db[_0x2254('0x4f')][_0x2254('0x4a')]({'where':{'name':_0x43bb88,'userProfileId':_0x4331a9[_0x2254('0x50')]},'raw':!![]})['then'](function(_0x4cc18a){if(_0x4cc18a&&_0x4cc18a[_0x2254('0x51')]===0x0){return db[_0x2254('0x52')]['create']({'name':_0x3f0670[_0x2254('0x2a')],'resourceId':_0x3f0670['id'],'type':'DefaultReports','sectionId':_0x4cc18a['id']},{})['then'](function(){return _0x12e2ff;});}else{return _0x12e2ff;}})[_0x2254('0x46')](function(_0x135962){logger[_0x2254('0x28')](_0x2254('0x53'),_0x135962);throw _0x135962;});}return _0x12e2ff;})[_0x2254('0x25')](respondWithResult(_0x36b977,0xc9))['catch'](handleError(_0x36b977,null));};exports['update']=function(_0x1bd988,_0x5e3fbc){if(_0x1bd988[_0x2254('0x4c')]['id']){delete _0x1bd988[_0x2254('0x4c')]['id'];}return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x1bd988['params']['id']}})[_0x2254('0x25')](handleEntityNotFound(_0x5e3fbc,null))[_0x2254('0x25')](saveUpdates(_0x1bd988['body'],null))['then'](respondWithResult(_0x5e3fbc,null))[_0x2254('0x46')](handleError(_0x5e3fbc,null));};exports['destroy']=function(_0x2cc59c,_0x305ace){return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x2cc59c[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x305ace,null))['then'](removeEntity(_0x305ace,null))[_0x2254('0x46')](handleError(_0x305ace,null));};exports['preview']=function(_0x335c66,_0x510fe0){var _0x4da493=0xa;var _0x5999c8=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x13606e={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':_0x2254('0x5b'),'MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f391d={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x329378=function(_0xae171c){return!_[_0x2254('0x65')]([_0x2254('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2254('0x67')],_0xae171c);};var _0x423c17=function(_0x1d73a3){if(!_0x1d73a3||!_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x53b55b='(',_0x45b7bd=0x0;_0x45b7bd<_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')];_0x45b7bd+=0x1){_0x45b7bd>0x0&&(_0x53b55b+='\x20'+_0x1d73a3['operator']+'\x20');_0x53b55b+=_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]?_0x423c17(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]):_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['field']+'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd][_0x2254('0x6a')]+(_0x329378(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x6a')])?'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['value']:'');}return _0x53b55b+')';};var _0x5cc6bd={'where':{'id':_0x335c66['params']['id']}},_0xde4e7,_0xa159a4,_0x486b82,_0x506d95,_0x48406e;_0x5cc6bd=_[_0x2254('0x41')]({},_0x5cc6bd,_0x335c66['options']);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x5cc6bd)[_0x2254('0x25')](function(_0x1ed6b9){if(_0x1ed6b9){_0xde4e7=_0x1ed6b9;return _0x1ed6b9['getFields']();}return null;})[_0x2254('0x25')](function(_0x5ecf82){if(_0x5ecf82){if(!_0x5ecf82[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xa159a4=_0x5ecf82;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x3b3b20){if(_0x3b3b20){_0x486b82=_[_0x2254('0x6e')](_0x3b3b20,'id');var _0x3cefbe;var _0x4f77e5=squel[_0x2254('0x6f')]();_0x4f77e5[_0x2254('0x70')](_0xde4e7['table']);for(var _0x1ac8ff=0x0;_0x1ac8ff<_0xa159a4[_0x2254('0x39')];_0x1ac8ff+=0x1){_0x3cefbe=_0xa159a4[_0x1ac8ff]['MetricId']?_0x486b82[_0xa159a4[_0x1ac8ff][_0x2254('0x71')]]['metric']:_0xa159a4[_0x1ac8ff][_0x2254('0x72')];_0x3cefbe=_0xa159a4[_0x1ac8ff]['function']?_[_0x2254('0x73')](_0x13606e[_0xa159a4[_0x1ac8ff][_0x2254('0x74')]],'%s',_0x3cefbe):_0x3cefbe;_0x3cefbe=_0xa159a4[_0x1ac8ff]['format']?_[_0x2254('0x73')](_0x2f391d[_0xa159a4[_0x1ac8ff]['format']],'%s',_0x3cefbe):_0x3cefbe;if(_0xa159a4[_0x1ac8ff][_0x2254('0x75')]){_0x4f77e5[_0x2254('0x69')](_0x3cefbe);}_0xa159a4[_0x1ac8ff][_0x2254('0x76')]&&_0x4f77e5['order'](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x76')]==='DESC'?![]:!![]);_0x4f77e5[_0x2254('0x72')](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x77')]||_0x3cefbe);}if(_0xde4e7['joins']){_0xde4e7['joins']=JSON[_0x2254('0x78')](_0xde4e7[_0x2254('0x79')]);for(var _0x451520=0x0;_0x451520<_0xde4e7[_0x2254('0x79')]['length'];_0x451520+=0x1){if(_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x5999c8,_0xde4e7[_0x2254('0x79')][_0x451520]['type'])&&_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7a')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7b')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7c')]){_0x4f77e5[_0xde4e7['joins'][_0x451520]['type']](_0xde4e7['joins'][_0x451520][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0xde4e7[_0x2254('0x7e')],_0xde4e7['joins'][_0x451520][_0x2254('0x7a')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7b')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7c')]));}}}if(_0xde4e7[_0x2254('0x7f')]){_0xde4e7['conditions']=JSON['parse'](_0xde4e7[_0x2254('0x7f')]);_0x4f77e5[_0x2254('0x3e')](_0x423c17(_0xde4e7[_0x2254('0x7f')][_0x2254('0x69')]));}_0x48406e=_0x4f77e5[_0x2254('0x80')]();_0x4f77e5[_0x2254('0x20')](_0x4da493);_0x4f77e5[_0x2254('0x1e')](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4f77e5[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4f77e5[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')]['SELECT']});}})[_0x2254('0x25')](respondWithResult(_0x510fe0,null))[_0x2254('0x46')](handleError(_0x510fe0,null));};function runReport(_0x4dfcb4,_0x1c317b,_0x4e699c){var _0x2ad519=_0x1c317b[_0x2254('0x2a')];var _0x30f2c9=0xa;var _0x1f7a48=['join',_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x3a8d4f={'SUM':'SUM(%s)','COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f3650={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x251d70=function(_0x2c7705){return!_['includes']([_0x2254('0x66'),'IS\x20NOT\x20NULL',_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x2c7705);};var _0x36d121=function(_0x207a09){if(!_0x207a09||!_0x207a09[_0x2254('0x68')]['length']){return'';}for(var _0x8a3656='(',_0x1554f1=0x0;_0x1554f1<_0x207a09[_0x2254('0x68')][_0x2254('0x39')];_0x1554f1+=0x1){_0x1554f1>0x0&&(_0x8a3656+='\x20'+_0x207a09[_0x2254('0x87')]+'\x20');_0x8a3656+=_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]?_0x36d121(_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]):_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x72')]+'\x20'+_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x6a')]+(_0x251d70(_0x207a09['rules'][_0x1554f1][_0x2254('0x6a')])?'\x20'+_0x207a09['rules'][_0x1554f1][_0x2254('0x88')]:'');}return _0x8a3656+')';};var _0xb98b40={'where':{'id':_0x4dfcb4['id']}},_0x3b1d5c,_0x2c907a,_0x23b78c,_0x2b5dba,_0x30307a;_0xb98b40=_['merge']({},_0xb98b40,_0x4e699c);return db[_0x2254('0x2e')]['find'](_0xb98b40)[_0x2254('0x25')](function(_0x52712d){if(_0x52712d){_0x3b1d5c=_0x52712d;return _0x52712d[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x1d0c8f){if(_0x1d0c8f){if(!_0x1d0c8f['length']){throw new db[(_0x2254('0x6b'))][(_0x2254('0x8a'))](_0x2254('0x6c'),0x193);}_0x2c907a=_0x1d0c8f;return db[_0x2254('0x6d')][_0x2254('0x44')]({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x34185c){if(_0x34185c){_0x23b78c=_[_0x2254('0x6e')](_0x34185c,'id');var _0x5e94b6;var _0x56239e=squel[_0x2254('0x6f')]();_0x56239e['from'](_0x3b1d5c[_0x2254('0x7e')]);for(var _0x3a1365=0x0;_0x3a1365<_0x2c907a[_0x2254('0x39')];_0x3a1365+=0x1){_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x71')]?_0x23b78c[_0x2c907a[_0x3a1365][_0x2254('0x71')]][_0x2254('0x8b')]:_0x2c907a[_0x3a1365][_0x2254('0x72')];_0x5e94b6=_0x2c907a[_0x3a1365]['function']?_[_0x2254('0x73')](_0x3a8d4f[_0x2c907a[_0x3a1365][_0x2254('0x74')]],'%s',_0x5e94b6):_0x5e94b6;_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x8c')]?_['replace'](_0x2f3650[_0x2c907a[_0x3a1365][_0x2254('0x8c')]],'%s',_0x5e94b6):_0x5e94b6;if(_0x2c907a[_0x3a1365][_0x2254('0x75')]){_0x56239e[_0x2254('0x69')](_0x5e94b6);}_0x2c907a[_0x3a1365][_0x2254('0x76')]&&_0x56239e[_0x2254('0x3c')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x56239e[_0x2254('0x72')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x77')]||_0x5e94b6);}if(_0x3b1d5c['joins']){_0x3b1d5c[_0x2254('0x79')]=JSON[_0x2254('0x78')](_0x3b1d5c['joins']);for(var _0x4cec5b=0x0;_0x4cec5b<_0x3b1d5c[_0x2254('0x79')]['length'];_0x4cec5b+=0x1){if(_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x1f7a48,_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')])&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7a')]&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b]['foreignTable']&&_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7c')]){_0x56239e[_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]](_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3b1d5c[_0x2254('0x7e')],_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7a')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7c')]));}}}if(_0x3b1d5c[_0x2254('0x7f')]){_0x3b1d5c[_0x2254('0x7f')]=JSON['parse'](_0x3b1d5c[_0x2254('0x7f')]);_0x56239e[_0x2254('0x3e')](_0x36d121(_0x3b1d5c['conditions'][_0x2254('0x69')]));}_0x30307a=_0x56239e[_0x2254('0x80')]();_0x56239e[_0x2254('0x20')](_0x30f2c9);_0x56239e[_0x2254('0x1e')](0x0);return;}})[_0x2254('0x25')](function(){if(_0x1c317b[_0x2254('0x8e')]===_0x2254('0x8f')){return null;}var _0x38e2df=_[_0x2254('0x41')](_0x1c317b,{'name':_0x1c317b[_0x2254('0x90')]||_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c['name'],'basename':_0x2ad519,'savename':util[_0x2254('0x8c')](_0x2254('0x91'),_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c[_0x2254('0x2a')],require(_0x2254('0x92'))[_0x2254('0x93')](0x4),_0x1c317b[_0x2254('0x8e')]||'csv'),'reportId':_0x3b1d5c['id'],'reportType':_0x2254('0x94')});return db[_0x2254('0x95')][_0x2254('0x4b')](_0x38e2df,{'raw':!![]});})['then'](function(_0x60f5ac){if(_0x3b1d5c[_0x2254('0x7e')]===_0x2254('0x96')){_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x97'),_0x1c317b['startDate'],_0x1c317b[_0x2254('0x98')]);}else{_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x99'),_0x1c317b[_0x2254('0x9a')],_0x1c317b['endDate']);}if(_0x60f5ac){logger['info'](_0x2254('0x9b'),_0x30307a['toString']());require(_0x2254('0x9c'))[_0x2254('0x9d')](path[_0x2254('0x54')](__dirname,_0x2254('0x9e'),_0x60f5ac[_0x2254('0x8e')]),[_0x60f5ac['id'],_0x30307a[_0x2254('0x83')](),path['join'](__dirname,'../../files/reports',_0x60f5ac[_0x2254('0x9f')]),_0x2ad519]);return _0x60f5ac;}else{var _0x3317d4=squel[_0x2254('0x6f')]();_0x3317d4[_0x2254('0x70')]('('+_0x30307a['toString']()+')',_0x2254('0xa0'));_0x3317d4[_0x2254('0x72')](_0x2254('0xa1'),_0x2254('0x21'));_0x30307a[_0x2254('0x20')](_0x1c317b[_0x2254('0x20')]||_0x30f2c9);_0x30307a[_0x2254('0x1e')](_0x1c317b[_0x2254('0x1e')]||0x0);return dbH[_0x2254('0xa2')]['query'](_0x3317d4[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')]['SELECT']})[_0x2254('0x25')](function(_0xe38a28){if(!_0xe38a28[_0x2254('0x39')]){_0x2b5dba=0x0;}else{_0x2b5dba=_0xe38a28[0x0]['count']||0x0;}return dbH['sequelize'][_0x2254('0x33')](_0x30307a[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')][_0x2254('0xa3')]});})[_0x2254('0x25')](function(_0x4011de){return{'rows':_0x4011de||[],'count':_0x2b5dba};});}});}exports[_0x2254('0xa4')]=function(_0x5cb3d1,_0x1d8238){return runReport(_0x5cb3d1[_0x2254('0x47')],_0x5cb3d1[_0x2254('0x33')],_0x5cb3d1[_0x2254('0x42')])[_0x2254('0x25')](respondWithResult(_0x1d8238,null))[_0x2254('0x46')](handleError(_0x1d8238,null));};exports['runReport']=runReport;exports['query']=function(_0x40339d,_0x4b3b96){var _0x59b8af=0xa;var _0x408695=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),'cross_join'];var _0x596eae={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x739a29={'SEC_TO_TIME':_0x2254('0x61'),'DATE':'DATE(%s)','HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x243466=function(_0x1b8587){return!_[_0x2254('0x65')]([_0x2254('0x66'),_0x2254('0xa5'),_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x1b8587);};var _0xbec5d0=function(_0x18f841){if(!_0x18f841||!_0x18f841[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x275b56='(',_0x315add=0x0;_0x315add<_0x18f841['rules']['length'];_0x315add+=0x1){_0x315add>0x0&&(_0x275b56+='\x20'+_0x18f841[_0x2254('0x87')]+'\x20');_0x275b56+=_0x18f841['rules'][_0x315add][_0x2254('0x69')]?_0xbec5d0(_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x69')]):_0x18f841[_0x2254('0x68')][_0x315add]['field']+'\x20'+_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x6a')]+(_0x243466(_0x18f841[_0x2254('0x68')][_0x315add]['condition'])?'\x20'+_0x18f841['rules'][_0x315add][_0x2254('0x88')]:'');}return _0x275b56+')';};var _0x51b02a={'where':{'id':_0x40339d[_0x2254('0x47')]['id']}},_0x3e7642,_0xe1abb6,_0x1a44d0,_0x4af6a7,_0x539aba;_0x51b02a=_[_0x2254('0x41')]({},_0x51b02a,_0x40339d[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x51b02a)['then'](function(_0x34e28b){if(_0x34e28b){_0x3e7642=_0x34e28b;return _0x34e28b[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x5d373){if(_0x5d373){if(!_0x5d373[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xe1abb6=_0x5d373;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x56a7ce){if(_0x56a7ce){_0x1a44d0=_[_0x2254('0x6e')](_0x56a7ce,'id');var _0x34bf19;var _0x4965c7=squel[_0x2254('0x6f')]();_0x4965c7[_0x2254('0x70')](_0x3e7642[_0x2254('0x7e')]);for(var _0x45541b=0x0;_0x45541b<_0xe1abb6[_0x2254('0x39')];_0x45541b+=0x1){_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x71')]?_0x1a44d0[_0xe1abb6[_0x45541b][_0x2254('0x71')]][_0x2254('0x8b')]:_0xe1abb6[_0x45541b][_0x2254('0x72')];_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x74')]?_[_0x2254('0x73')](_0x596eae[_0xe1abb6[_0x45541b][_0x2254('0x74')]],'%s',_0x34bf19):_0x34bf19;_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x8c')]?_[_0x2254('0x73')](_0x739a29[_0xe1abb6[_0x45541b]['format']],'%s',_0x34bf19):_0x34bf19;if(_0xe1abb6[_0x45541b][_0x2254('0x75')]){_0x4965c7[_0x2254('0x69')](_0x34bf19);}_0xe1abb6[_0x45541b]['orderBy']&&_0x4965c7['order'](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x4965c7[_0x2254('0x72')](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x77')]||_0x34bf19);}if(_0x3e7642['joins']){_0x3e7642[_0x2254('0x79')]=JSON['parse'](_0x3e7642['joins']);for(var _0x40fec0=0x0;_0x40fec0<_0x3e7642[_0x2254('0x79')][_0x2254('0x39')];_0x40fec0+=0x1){if(_0x3e7642[_0x2254('0x79')][_0x40fec0]['type']&&_[_0x2254('0x65')](_0x408695,_0x3e7642['joins'][_0x40fec0][_0x2254('0x30')])&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]){_0x4965c7[_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x30')]](_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0x3e7642[_0x2254('0x7e')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]));}}}if(_0x3e7642['conditions']){_0x3e7642[_0x2254('0x7f')]=JSON[_0x2254('0x78')](_0x3e7642[_0x2254('0x7f')]);_0x4965c7[_0x2254('0x3e')](_0xbec5d0(_0x3e7642[_0x2254('0x7f')]['group']));}_0x539aba=_0x4965c7[_0x2254('0x80')]();_0x4965c7[_0x2254('0x20')](_0x59b8af);_0x4965c7['offset'](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4965c7[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4965c7[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')][_0x2254('0xa3')]});}})[_0x2254('0x25')](function(){return{'sql':_0x539aba[_0x2254('0x83')]()};})['then'](respondWithResult(_0x4b3b96,null))[_0x2254('0x46')](handleError(_0x4b3b96,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xabce[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 9d14d3e..2162dd9 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 _0xc0e7=['bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','lodash','../../config/logger'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xc0e7,0xd0));var _0x7c0e=function(_0x1178a5,_0x316ffe){_0x1178a5=_0x1178a5-0x0;var _0x3df8c7=_0xc0e7[_0x1178a5];return _0x3df8c7;};'use strict';var _=require(_0x7c0e('0x0'));var util=require('util');var logger=require(_0x7c0e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7c0e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7c0e('0x3'));var config=require(_0x7c0e('0x4'));var attributes=require(_0x7c0e('0x5'));module[_0x7c0e('0x6')]=function(_0x49f0aa,_0x17493e){return _0x49f0aa['define']('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdefb=['api','moment','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xdefb,0x135));var _0xbdef=function(_0x1b87fb,_0x3e6870){_0x1b87fb=_0x1b87fb-0x0;var _0xc7de31=_0xdefb[_0x1b87fb];return _0xc7de31;};'use strict';var _=require(_0xbdef('0x0'));var util=require(_0xbdef('0x1'));var logger=require(_0xbdef('0x2'))(_0xbdef('0x3'));var moment=require(_0xbdef('0x4'));var BPromise=require('bluebird');var rp=require(_0xbdef('0x5'));var fs=require('fs');var path=require(_0xbdef('0x6'));var rimraf=require('rimraf');var config=require(_0xbdef('0x7'));var attributes=require(_0xbdef('0x8'));module[_0xbdef('0x9')]=function(_0x2be24d,_0x4aab92){return _0x2be24d[_0xbdef('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0xbdef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 20fcfc5..ff0dcca 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 _0x886d=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e7df1,_0x4ebe06){var _0x428385=function(_0x1c23e8){while(--_0x1c23e8){_0x3e7df1['push'](_0x3e7df1['shift']());}};_0x428385(++_0x4ebe06);}(_0x886d,0xff));var _0xd886=function(_0x459d7d,_0x55db19){_0x459d7d=_0x459d7d-0x0;var _0x26abf1=_0x886d[_0x459d7d];return _0x26abf1;};'use strict';var _=require(_0xd886('0x0'));var util=require(_0xd886('0x1'));var moment=require(_0xd886('0x2'));var BPromise=require(_0xd886('0x3'));var rs=require(_0xd886('0x4'));var fs=require('fs');var Redis=require(_0xd886('0x5'));var db=require(_0xd886('0x6'))['db'];var utils=require(_0xd886('0x7'));var logger=require(_0xd886('0x8'))(_0xd886('0x9'));var config=require(_0xd886('0xa'));var jayson=require(_0xd886('0xb'));var client=jayson[_0xd886('0xc')][_0xd886('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x10da73,_0x5f4c6b,_0x2ae17e){return new BPromise(function(_0x4e1784,_0x5459f1){return client[_0xd886('0xe')](_0x10da73,_0x2ae17e)[_0xd886('0xf')](function(_0x4f456c){logger[_0xd886('0x10')](_0xd886('0x11'),_0x5f4c6b,_0xd886('0x12'));logger[_0xd886('0x13')](_0xd886('0x14'),_0x5f4c6b,'request\x20sent',JSON[_0xd886('0x15')](_0x4f456c));if(_0x4f456c[_0xd886('0x16')]){if(_0x4f456c[_0xd886('0x16')][_0xd886('0x17')]===0x1f4){logger['error'](_0xd886('0x11'),_0x5f4c6b,_0x4f456c[_0xd886('0x16')][_0xd886('0x18')]);return _0x5459f1(_0x4f456c[_0xd886('0x16')]['message']);}logger[_0xd886('0x16')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5f4c6b,_0x4f456c['error'][_0xd886('0x18')]);return _0x4e1784(_0x4f456c['error']['message']);}else{logger[_0xd886('0x10')](_0xd886('0x11'),_0x5f4c6b,'request\x20sent');_0x4e1784(_0x4f456c['result'][_0xd886('0x18')]);}})['catch'](function(_0x45bdd5){logger[_0xd886('0x16')](_0xd886('0x11'),_0x5f4c6b,_0x45bdd5);_0x5459f1(_0x45bdd5);});});} \ No newline at end of file +var _0xe692=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe692,0xe7));var _0x2e69=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xe692[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x2e69('0x0'));var util=require('util');var moment=require(_0x2e69('0x1'));var BPromise=require(_0x2e69('0x2'));var rs=require(_0x2e69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e69('0x4'))['db'];var utils=require(_0x2e69('0x5'));var logger=require(_0x2e69('0x6'))(_0x2e69('0x7'));var config=require(_0x2e69('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2e69('0x9')][_0x2e69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e0a57,_0x4d9a83,_0x1cb076){return new BPromise(function(_0x25e221,_0x546525){return client[_0x2e69('0xb')](_0x1e0a57,_0x1cb076)[_0x2e69('0xc')](function(_0x401148){logger[_0x2e69('0xd')](_0x2e69('0xe'),_0x4d9a83,_0x2e69('0xf'));logger[_0x2e69('0x10')](_0x2e69('0x11'),_0x4d9a83,_0x2e69('0xf'),JSON['stringify'](_0x401148));if(_0x401148[_0x2e69('0x12')]){if(_0x401148[_0x2e69('0x12')][_0x2e69('0x13')]===0x1f4){logger[_0x2e69('0x12')](_0x2e69('0xe'),_0x4d9a83,_0x401148[_0x2e69('0x12')][_0x2e69('0x14')]);return _0x546525(_0x401148[_0x2e69('0x12')][_0x2e69('0x14')]);}logger['error'](_0x2e69('0xe'),_0x4d9a83,_0x401148[_0x2e69('0x12')][_0x2e69('0x14')]);return _0x25e221(_0x401148[_0x2e69('0x12')][_0x2e69('0x14')]);}else{logger[_0x2e69('0xd')](_0x2e69('0xe'),_0x4d9a83,_0x2e69('0xf'));_0x25e221(_0x401148[_0x2e69('0x15')][_0x2e69('0x14')]);}})[_0x2e69('0x16')](function(_0x12d04f){logger[_0x2e69('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4d9a83,_0x12d04f);_0x546525(_0x12d04f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index d7caa20..544faa0 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 _0x0b29=['Router','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','update','delete','exports','multer','util','express'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0b29,0x11b));var _0x90b2=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x0b29[_0x3daa8c];return _0x2b1bd7;};'use strict';var multer=require(_0x90b2('0x0'));var util=require(_0x90b2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x90b2('0x2'));var router=express[_0x90b2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x90b2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x90b2('0x5'));router[_0x90b2('0x6')]('/',auth[_0x90b2('0x7')](),controller[_0x90b2('0x8')]);router[_0x90b2('0x6')](_0x90b2('0x9'),auth[_0x90b2('0x7')](),controller[_0x90b2('0xa')]);router[_0x90b2('0x6')](_0x90b2('0xb'),auth[_0x90b2('0x7')](),controller[_0x90b2('0xc')]);router[_0x90b2('0x6')](_0x90b2('0xd'),auth[_0x90b2('0x7')](),controller[_0x90b2('0xe')]);router[_0x90b2('0x6')](_0x90b2('0xf'),auth['isAuthenticated'](),controller[_0x90b2('0x10')]);router[_0x90b2('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x90b2('0x12')](_0x90b2('0x9'),auth[_0x90b2('0x7')](),controller[_0x90b2('0x13')]);router[_0x90b2('0x14')](_0x90b2('0x9'),auth[_0x90b2('0x7')](),controller['destroy']);module[_0x90b2('0x15')]=router; \ No newline at end of file +var _0xa812=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','preview','run','query','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5d263b,_0x4dbb1a){var _0xcab942=function(_0x3edd53){while(--_0x3edd53){_0x5d263b['push'](_0x5d263b['shift']());}};_0xcab942(++_0x4dbb1a);}(_0xa812,0x164));var _0x2a81=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xa812[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0x2a81('0x0'));var util=require(_0x2a81('0x1'));var path=require(_0x2a81('0x2'));var timeout=require(_0x2a81('0x3'));var express=require('express');var router=express[_0x2a81('0x4')]();var fs_extra=require(_0x2a81('0x5'));var auth=require(_0x2a81('0x6'));var interaction=require(_0x2a81('0x7'));var config=require(_0x2a81('0x8'));var controller=require(_0x2a81('0x9'));router[_0x2a81('0xa')]('/',auth[_0x2a81('0xb')](),controller[_0x2a81('0xc')]);router[_0x2a81('0xa')](_0x2a81('0xd'),auth[_0x2a81('0xb')](),controller[_0x2a81('0xe')]);router[_0x2a81('0xa')]('/:id/preview',auth[_0x2a81('0xb')](),controller[_0x2a81('0xf')]);router[_0x2a81('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0x2a81('0x10')]);router[_0x2a81('0xa')]('/:id/query',auth[_0x2a81('0xb')](),controller[_0x2a81('0x11')]);router[_0x2a81('0x12')]('/',auth[_0x2a81('0xb')](),controller['create']);router[_0x2a81('0x13')](_0x2a81('0xd'),auth[_0x2a81('0xb')](),controller[_0x2a81('0x14')]);router[_0x2a81('0x15')](_0x2a81('0xd'),auth[_0x2a81('0xb')](),controller[_0x2a81('0x16')]);module[_0x2a81('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 35988e6..232deae 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 _0x0290=['moment','exports','STRING','ENUM','csv','xlsx','DATE','Loading','scheduled','manual','sequelize'];(function(_0xabe7e4,_0x288e85){var _0xb1891a=function(_0xe84ff6){while(--_0xe84ff6){_0xabe7e4['push'](_0xabe7e4['shift']());}};_0xb1891a(++_0x288e85);}(_0x0290,0xaf));var _0x0029=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x0290[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0x0029('0x0'));var moment=require(_0x0029('0x1'));module[_0x0029('0x2')]={'name':{'type':Sequelize[_0x0029('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x0029('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x0029('0x4')](_0x0029('0x5'),'pdf',_0x0029('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x0029('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0029('0x7')]},'endDate':{'type':Sequelize[_0x0029('0x7')]},'status':{'type':Sequelize[_0x0029('0x3')],'defaultValue':_0x0029('0x8')},'type':{'type':Sequelize[_0x0029('0x4')]('manual',_0x0029('0x9')),'allowNull':![],'defaultValue':_0x0029('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x0029('0x3')]}}; \ No newline at end of file +var _0x5e36=['DATE','scheduled','manual','INTEGER','UNSIGNED','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x5e36,0x73));var _0x65e3=function(_0x1c4ff5,_0x397c7a){_0x1c4ff5=_0x1c4ff5-0x0;var _0x39578b=_0x5e36[_0x1c4ff5];return _0x39578b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x65e3('0x0')]={'name':{'type':Sequelize[_0x65e3('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x65e3('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x65e3('0x2')](_0x65e3('0x3'),_0x65e3('0x4'),_0x65e3('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x65e3('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x65e3('0x6')]},'status':{'type':Sequelize[_0x65e3('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM']('manual',_0x65e3('0x7')),'allowNull':![],'defaultValue':_0x65e3('0x8')},'reportId':{'type':Sequelize[_0x65e3('0x9')](0xb)[_0x65e3('0xa')]},'reportType':{'type':Sequelize[_0x65e3('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d740367..6fc13d9 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 _0x0d49=['create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','output','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','root','format','toLowerCase','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','model','query','intersection','fields','attributes','length','limit','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','rows','catch','find'];(function(_0xfb3b3,_0x10db7a){var _0x36cae7=function(_0x183814){while(--_0x183814){_0xfb3b3['push'](_0xfb3b3['shift']());}};_0x36cae7(++_0x10db7a);}(_0x0d49,0x19c));var _0x90d4=function(_0x5b532e,_0x5369c4){_0x5b532e=_0x5b532e-0x0;var _0x15f83e=_0x0d49[_0x5b532e];return _0x15f83e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90d4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90d4('0x1'));var rp=require(_0x90d4('0x2'));var moment=require(_0x90d4('0x3'));var BPromise=require(_0x90d4('0x4'));var Mustache=require('mustache');var util=require(_0x90d4('0x5'));var path=require(_0x90d4('0x6'));var sox=require(_0x90d4('0x7'));var csv=require(_0x90d4('0x8'));var ejs=require(_0x90d4('0x9'));var fs=require('fs');var fs_extra=require(_0x90d4('0xa'));var _=require(_0x90d4('0xb'));var squel=require(_0x90d4('0xc'));var crypto=require(_0x90d4('0xd'));var jsforce=require(_0x90d4('0xe'));var deskjs=require(_0x90d4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x90d4('0x10'));var Papa=require(_0x90d4('0x11'));var Redis=require('ioredis');var authService=require(_0x90d4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x90d4('0x13'));var hardwareService=require(_0x90d4('0x14'));var logger=require(_0x90d4('0x15'))(_0x90d4('0x16'));var utils=require(_0x90d4('0x17'));var config=require(_0x90d4('0x18'));var licenseUtil=require(_0x90d4('0x19'));var db=require(_0x90d4('0x1a'))['db'];function respondWithStatusCode(_0x301bbb,_0x13ce7e){_0x13ce7e=_0x13ce7e||0xcc;return function(_0x18caa1){if(_0x18caa1){return _0x301bbb[_0x90d4('0x1b')](_0x13ce7e);}return _0x301bbb[_0x90d4('0x1c')](_0x13ce7e)[_0x90d4('0x1d')]();};}function respondWithResult(_0xef29af,_0xa06d78){_0xa06d78=_0xa06d78||0xc8;return function(_0xb5ee7c){if(_0xb5ee7c){return _0xef29af[_0x90d4('0x1c')](_0xa06d78)[_0x90d4('0x1e')](_0xb5ee7c);}};}function respondWithFilteredResult(_0x2dc8f3,_0xb44d66){return function(_0xab7598){if(_0xab7598){var _0x47f53e=typeof _0xb44d66[_0x90d4('0x1f')]==='undefined'&&typeof _0xb44d66['limit']===_0x90d4('0x20');var _0x1ad8cc=_0xab7598[_0x90d4('0x21')];var _0x39ddcc=_0x47f53e?0x0:_0xb44d66[_0x90d4('0x1f')];var _0x2d88a1=_0x47f53e?_0xab7598[_0x90d4('0x21')]:_0xb44d66[_0x90d4('0x1f')]+_0xb44d66['limit'];var _0x663f27;if(_0x2d88a1>=_0x1ad8cc){_0x2d88a1=_0x1ad8cc;_0x663f27=0xc8;}else{_0x663f27=0xce;}_0x2dc8f3[_0x90d4('0x1c')](_0x663f27);return _0x2dc8f3[_0x90d4('0x22')](_0x90d4('0x23'),_0x39ddcc+'-'+_0x2d88a1+'/'+_0x1ad8cc)[_0x90d4('0x1e')](_0xab7598);}return null;};}function patchUpdates(_0x59c83e){return function(_0x119cc6){try{jsonpatch[_0x90d4('0x24')](_0x119cc6,_0x59c83e,!![]);}catch(_0x3c3e58){return BPromise[_0x90d4('0x25')](_0x3c3e58);}return _0x119cc6[_0x90d4('0x26')]();};}function saveUpdates(_0x12a57e,_0x4b8eef){return function(_0x20a2a3){if(_0x20a2a3){return _0x20a2a3[_0x90d4('0x27')](_0x12a57e)[_0x90d4('0x28')](function(_0x37954d){return _0x37954d;});}return null;};}function removeEntity(_0x4a6593,_0x42d39c){return function(_0x1a6c6f){if(_0x1a6c6f){return _0x1a6c6f[_0x90d4('0x29')]()[_0x90d4('0x28')](function(){var _0x17164b=_0x1a6c6f['get']({'plain':!![]});var _0xa7e465='ExtractedReports';return db[_0x90d4('0x2a')]['destroy']({'where':{'type':_0xa7e465,'resourceId':_0x17164b['id']}})[_0x90d4('0x28')](function(){return _0x1a6c6f;});})[_0x90d4('0x28')](function(){_0x4a6593[_0x90d4('0x1c')](0xcc)[_0x90d4('0x1d')]();});}};}function handleEntityNotFound(_0x124ba4,_0x51323c){return function(_0x48b4c7){if(!_0x48b4c7){_0x124ba4['sendStatus'](0x194);}return _0x48b4c7;};}function handleError(_0x3ae887,_0x385c9a){_0x385c9a=_0x385c9a||0x1f4;return function(_0x3c3644){logger[_0x90d4('0x2b')](_0x3c3644['stack']);if(_0x3c3644[_0x90d4('0x2c')]){delete _0x3c3644['name'];}_0x3ae887[_0x90d4('0x1c')](_0x385c9a)[_0x90d4('0x2d')](_0x3c3644);};}exports[_0x90d4('0x2e')]=function(_0x5667f4,_0x452db8){var _0x354f55={},_0x460186={},_0x3f2c99={'count':0x0,'rows':[]};var _0x1b75f2=_[_0x90d4('0x2f')](db['AnalyticExtractedReport'][_0x90d4('0x30')],function(_0x72acc0){return{'name':_0x72acc0[_0x90d4('0x31')],'type':_0x72acc0[_0x90d4('0x32')][_0x90d4('0x33')]};});_0x460186['model']=_['map'](_0x1b75f2,_0x90d4('0x2c'));_0x460186['query']=_[_0x90d4('0x34')](_0x5667f4['query']);_0x460186[_0x90d4('0x35')]=_['intersection'](_0x460186[_0x90d4('0x36')],_0x460186[_0x90d4('0x37')]);_0x354f55['attributes']=_[_0x90d4('0x38')](_0x460186['model'],qs[_0x90d4('0x39')](_0x5667f4[_0x90d4('0x37')][_0x90d4('0x39')]));_0x354f55[_0x90d4('0x3a')]=_0x354f55[_0x90d4('0x3a')][_0x90d4('0x3b')]?_0x354f55[_0x90d4('0x3a')]:_0x460186[_0x90d4('0x36')];if(!_0x5667f4['query']['hasOwnProperty']('nolimit')){_0x354f55[_0x90d4('0x3c')]=qs[_0x90d4('0x3c')](_0x5667f4[_0x90d4('0x37')][_0x90d4('0x3c')]);_0x354f55[_0x90d4('0x1f')]=qs[_0x90d4('0x1f')](_0x5667f4[_0x90d4('0x37')][_0x90d4('0x1f')]);}_0x354f55['order']=qs['sort'](_0x5667f4[_0x90d4('0x37')][_0x90d4('0x3d')]);_0x354f55[_0x90d4('0x3e')]=qs[_0x90d4('0x35')](_[_0x90d4('0x3f')](_0x5667f4[_0x90d4('0x37')],_0x460186['filters']),_0x1b75f2);if(_0x5667f4['query']['filter']){_0x354f55[_0x90d4('0x3e')]=_[_0x90d4('0x40')](_0x354f55[_0x90d4('0x3e')],{'$or':_[_0x90d4('0x2f')](_0x1b75f2,function(_0x1a3250){if(_0x1a3250['type']!==_0x90d4('0x41')){var _0xc76f2f={};_0xc76f2f[_0x1a3250[_0x90d4('0x2c')]]={'$like':'%'+_0x5667f4[_0x90d4('0x37')][_0x90d4('0x42')]+'%'};return _0xc76f2f;}})});}_0x354f55=_[_0x90d4('0x40')]({},_0x354f55,_0x5667f4[_0x90d4('0x43')]);var _0x57d3e0={'where':_0x354f55[_0x90d4('0x3e')]};return db[_0x90d4('0x44')][_0x90d4('0x21')](_0x57d3e0)[_0x90d4('0x28')](function(_0x15c68f){_0x3f2c99['count']=_0x15c68f;if(_0x5667f4[_0x90d4('0x37')][_0x90d4('0x45')]){_0x354f55['include']=[{'all':!![]}];}return db[_0x90d4('0x44')]['findAll'](_0x354f55);})[_0x90d4('0x28')](function(_0x3a50ac){_0x3f2c99[_0x90d4('0x46')]=_0x3a50ac;return _0x3f2c99;})[_0x90d4('0x28')](respondWithFilteredResult(_0x452db8,_0x354f55))[_0x90d4('0x47')](handleError(_0x452db8,null));};exports['show']=function(_0x8f5180,_0x37b43d){var _0x90c4a1={'raw':!![],'where':{'id':_0x8f5180['params']['id']}},_0x24983a={};_0x24983a[_0x90d4('0x36')]=_[_0x90d4('0x34')](db[_0x90d4('0x44')][_0x90d4('0x30')]);_0x24983a[_0x90d4('0x37')]=_[_0x90d4('0x34')](_0x8f5180[_0x90d4('0x37')]);_0x24983a[_0x90d4('0x35')]=_[_0x90d4('0x38')](_0x24983a[_0x90d4('0x36')],_0x24983a[_0x90d4('0x37')]);_0x90c4a1[_0x90d4('0x3a')]=_['intersection'](_0x24983a['model'],qs['fields'](_0x8f5180[_0x90d4('0x37')][_0x90d4('0x39')]));_0x90c4a1[_0x90d4('0x3a')]=_0x90c4a1[_0x90d4('0x3a')]['length']?_0x90c4a1[_0x90d4('0x3a')]:_0x24983a[_0x90d4('0x36')];if(_0x8f5180['query'][_0x90d4('0x45')]){_0x90c4a1['include']=[{'all':!![]}];}_0x90c4a1=_[_0x90d4('0x40')]({},_0x90c4a1,_0x8f5180[_0x90d4('0x43')]);return db[_0x90d4('0x44')][_0x90d4('0x48')](_0x90c4a1)[_0x90d4('0x28')](handleEntityNotFound(_0x37b43d,null))[_0x90d4('0x28')](respondWithResult(_0x37b43d,null))[_0x90d4('0x47')](handleError(_0x37b43d,null));};exports[_0x90d4('0x49')]=function(_0x26cb77,_0x1f93a4){return db[_0x90d4('0x44')][_0x90d4('0x49')](_0x26cb77['body'],{})[_0x90d4('0x28')](function(_0x366661){var _0x3b1a22=_0x26cb77['user'][_0x90d4('0x4a')]({'plain':!![]});if(!_0x3b1a22)throw new Error(_0x90d4('0x4b'));if(_0x3b1a22[_0x90d4('0x4c')]==='user'){var _0x234e27=_0x366661[_0x90d4('0x4a')]({'plain':!![]});var _0x4ff479='ExtractedReports';return db[_0x90d4('0x4d')][_0x90d4('0x48')]({'where':{'name':_0x4ff479,'userProfileId':_0x3b1a22[_0x90d4('0x4e')]},'raw':!![]})[_0x90d4('0x28')](function(_0x47e5a7){if(_0x47e5a7&&_0x47e5a7[_0x90d4('0x4f')]===0x0){return db['UserProfileResource'][_0x90d4('0x49')]({'name':_0x234e27['name'],'resourceId':_0x234e27['id'],'type':_0x47e5a7['name'],'sectionId':_0x47e5a7['id']},{})[_0x90d4('0x28')](function(){return _0x366661;});}else{return _0x366661;}})[_0x90d4('0x47')](function(_0x7eec25){logger['error'](_0x90d4('0x50'),_0x7eec25);throw _0x7eec25;});}return _0x366661;})[_0x90d4('0x28')](respondWithResult(_0x1f93a4,0xc9))[_0x90d4('0x47')](handleError(_0x1f93a4,null));};exports['update']=function(_0x65f786,_0x566d7f){if(_0x65f786[_0x90d4('0x51')]['id']){delete _0x65f786['body']['id'];}return db[_0x90d4('0x44')][_0x90d4('0x48')]({'where':{'id':_0x65f786[_0x90d4('0x52')]['id']}})[_0x90d4('0x28')](handleEntityNotFound(_0x566d7f,null))[_0x90d4('0x28')](saveUpdates(_0x65f786['body'],null))[_0x90d4('0x28')](respondWithResult(_0x566d7f,null))[_0x90d4('0x47')](handleError(_0x566d7f,null));};exports['destroy']=function(_0x46ca31,_0x4bffb3){return db['AnalyticExtractedReport'][_0x90d4('0x48')]({'where':{'id':_0x46ca31['params']['id']}})['then'](handleEntityNotFound(_0x4bffb3,null))[_0x90d4('0x28')](removeEntity(_0x4bffb3,null))[_0x90d4('0x47')](handleError(_0x4bffb3,null));};exports[_0x90d4('0x53')]=function(_0x3e3ef0,_0x2fd2d4,_0x5cb7ad){return db[_0x90d4('0x44')]['find']({'where':{'id':_0x3e3ef0['params']['id']},'attributes':[_0x90d4('0x2c'),_0x90d4('0x54'),_0x90d4('0x55'),_0x90d4('0x56')],'raw':!![]})[_0x90d4('0x28')](handleEntityNotFound(_0x2fd2d4,null))['then'](function(_0x560bff){if(_0x560bff){if(!fs[_0x90d4('0x57')](path['join'](config['root'],_0x90d4('0x58'),_0x560bff[_0x90d4('0x55')]))){throw new db[(_0x90d4('0x59'))][(_0x90d4('0x5a'))](_0x90d4('0x5b'));}if(_0x3e3ef0[_0x90d4('0x37')][_0x90d4('0x5c')]){return _0x2fd2d4[_0x90d4('0x1b')](0xc8);}return _0x2fd2d4['download'](path[_0x90d4('0x5d')](config[_0x90d4('0x5e')],'server/files/reports',_0x560bff[_0x90d4('0x55')]),util[_0x90d4('0x5f')]('%s.%s',_0x560bff[_0x90d4('0x54')]||_0x560bff['name'],_0x560bff[_0x90d4('0x56')][_0x90d4('0x60')]()));}})[_0x90d4('0x47')](handleError(_0x2fd2d4,null));}; \ No newline at end of file +var _0x2486=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','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','download','basename','existsSync','join','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','output','toLowerCase','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x2486,0x90));var _0x6248=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2486[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6248('0x0'));var rp=require(_0x6248('0x1'));var moment=require(_0x6248('0x2'));var BPromise=require(_0x6248('0x3'));var Mustache=require('mustache');var util=require(_0x6248('0x4'));var path=require('path');var sox=require(_0x6248('0x5'));var csv=require(_0x6248('0x6'));var ejs=require(_0x6248('0x7'));var fs=require('fs');var fs_extra=require(_0x6248('0x8'));var _=require(_0x6248('0x9'));var squel=require(_0x6248('0xa'));var crypto=require(_0x6248('0xb'));var jsforce=require(_0x6248('0xc'));var deskjs=require(_0x6248('0xd'));var toCsv=require(_0x6248('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6248('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6248('0xf'));var as=require(_0x6248('0x10'));var hardwareService=require(_0x6248('0x11'));var logger=require(_0x6248('0x12'))('api');var utils=require(_0x6248('0x13'));var config=require(_0x6248('0x14'));var licenseUtil=require(_0x6248('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ee82,_0x37a44c){_0x37a44c=_0x37a44c||0xcc;return function(_0x253e26){if(_0x253e26){return _0x35ee82['sendStatus'](_0x37a44c);}return _0x35ee82[_0x6248('0x16')](_0x37a44c)[_0x6248('0x17')]();};}function respondWithResult(_0x249e4e,_0x7ec409){_0x7ec409=_0x7ec409||0xc8;return function(_0xaa10d5){if(_0xaa10d5){return _0x249e4e['status'](_0x7ec409)['json'](_0xaa10d5);}};}function respondWithFilteredResult(_0x55d9c2,_0x106963){return function(_0x4ef240){if(_0x4ef240){var _0x39ab90=typeof _0x106963[_0x6248('0x18')]===_0x6248('0x19')&&typeof _0x106963['limit']===_0x6248('0x19');var _0x7a9b2a=_0x4ef240[_0x6248('0x1a')];var _0x1457ca=_0x39ab90?0x0:_0x106963['offset'];var _0x34de76=_0x39ab90?_0x4ef240[_0x6248('0x1a')]:_0x106963[_0x6248('0x18')]+_0x106963[_0x6248('0x1b')];var _0x3700cb;if(_0x34de76>=_0x7a9b2a){_0x34de76=_0x7a9b2a;_0x3700cb=0xc8;}else{_0x3700cb=0xce;}_0x55d9c2[_0x6248('0x16')](_0x3700cb);return _0x55d9c2[_0x6248('0x1c')]('Content-Range',_0x1457ca+'-'+_0x34de76+'/'+_0x7a9b2a)['json'](_0x4ef240);}return null;};}function patchUpdates(_0x575699){return function(_0x319995){try{jsonpatch[_0x6248('0x1d')](_0x319995,_0x575699,!![]);}catch(_0x4e4f3b){return BPromise[_0x6248('0x1e')](_0x4e4f3b);}return _0x319995[_0x6248('0x1f')]();};}function saveUpdates(_0x411ad4,_0x34f160){return function(_0x48f826){if(_0x48f826){return _0x48f826[_0x6248('0x20')](_0x411ad4)[_0x6248('0x21')](function(_0x13df09){return _0x13df09;});}return null;};}function removeEntity(_0x5f09de,_0xf9fd9c){return function(_0x3f54bd){if(_0x3f54bd){return _0x3f54bd[_0x6248('0x22')]()[_0x6248('0x21')](function(){var _0x106076=_0x3f54bd[_0x6248('0x23')]({'plain':!![]});var _0x5ac37b=_0x6248('0x24');return db[_0x6248('0x25')][_0x6248('0x22')]({'where':{'type':_0x5ac37b,'resourceId':_0x106076['id']}})[_0x6248('0x21')](function(){return _0x3f54bd;});})['then'](function(){_0x5f09de['status'](0xcc)[_0x6248('0x17')]();});}};}function handleEntityNotFound(_0x5b9776,_0x2b1956){return function(_0x1fb3f4){if(!_0x1fb3f4){_0x5b9776[_0x6248('0x26')](0x194);}return _0x1fb3f4;};}function handleError(_0x210765,_0x3c34b7){_0x3c34b7=_0x3c34b7||0x1f4;return function(_0x306294){logger[_0x6248('0x27')](_0x306294['stack']);if(_0x306294[_0x6248('0x28')]){delete _0x306294['name'];}_0x210765[_0x6248('0x16')](_0x3c34b7)[_0x6248('0x29')](_0x306294);};}exports[_0x6248('0x2a')]=function(_0x40fb7b,_0x26c80c){var _0x316aa2={},_0x2a1507={},_0xc79724={'count':0x0,'rows':[]};var _0x3655bc=_[_0x6248('0x2b')](db[_0x6248('0x2c')][_0x6248('0x2d')],function(_0x18b659){return{'name':_0x18b659['fieldName'],'type':_0x18b659[_0x6248('0x2e')][_0x6248('0x2f')]};});_0x2a1507[_0x6248('0x30')]=_[_0x6248('0x2b')](_0x3655bc,_0x6248('0x28'));_0x2a1507[_0x6248('0x31')]=_[_0x6248('0x32')](_0x40fb7b[_0x6248('0x31')]);_0x2a1507[_0x6248('0x33')]=_['intersection'](_0x2a1507[_0x6248('0x30')],_0x2a1507['query']);_0x316aa2['attributes']=_[_0x6248('0x34')](_0x2a1507[_0x6248('0x30')],qs[_0x6248('0x35')](_0x40fb7b[_0x6248('0x31')]['fields']));_0x316aa2[_0x6248('0x36')]=_0x316aa2['attributes'][_0x6248('0x37')]?_0x316aa2[_0x6248('0x36')]:_0x2a1507[_0x6248('0x30')];if(!_0x40fb7b[_0x6248('0x31')][_0x6248('0x38')](_0x6248('0x39'))){_0x316aa2[_0x6248('0x1b')]=qs[_0x6248('0x1b')](_0x40fb7b[_0x6248('0x31')][_0x6248('0x1b')]);_0x316aa2['offset']=qs[_0x6248('0x18')](_0x40fb7b[_0x6248('0x31')][_0x6248('0x18')]);}_0x316aa2[_0x6248('0x3a')]=qs[_0x6248('0x3b')](_0x40fb7b[_0x6248('0x31')][_0x6248('0x3b')]);_0x316aa2[_0x6248('0x3c')]=qs['filters'](_['pick'](_0x40fb7b['query'],_0x2a1507[_0x6248('0x33')]),_0x3655bc);if(_0x40fb7b[_0x6248('0x31')][_0x6248('0x3d')]){_0x316aa2['where']=_[_0x6248('0x3e')](_0x316aa2[_0x6248('0x3c')],{'$or':_['map'](_0x3655bc,function(_0x29887c){if(_0x29887c[_0x6248('0x2e')]!==_0x6248('0x3f')){var _0x51c249={};_0x51c249[_0x29887c[_0x6248('0x28')]]={'$like':'%'+_0x40fb7b[_0x6248('0x31')][_0x6248('0x3d')]+'%'};return _0x51c249;}})});}_0x316aa2=_[_0x6248('0x3e')]({},_0x316aa2,_0x40fb7b[_0x6248('0x40')]);var _0xe3afc2={'where':_0x316aa2[_0x6248('0x3c')]};return db['AnalyticExtractedReport']['count'](_0xe3afc2)[_0x6248('0x21')](function(_0x50a745){_0xc79724[_0x6248('0x1a')]=_0x50a745;if(_0x40fb7b[_0x6248('0x31')][_0x6248('0x41')]){_0x316aa2['include']=[{'all':!![]}];}return db[_0x6248('0x2c')][_0x6248('0x42')](_0x316aa2);})[_0x6248('0x21')](function(_0x14d3c6){_0xc79724[_0x6248('0x43')]=_0x14d3c6;return _0xc79724;})['then'](respondWithFilteredResult(_0x26c80c,_0x316aa2))[_0x6248('0x44')](handleError(_0x26c80c,null));};exports[_0x6248('0x45')]=function(_0x359769,_0x35649c){var _0x1bb85b={'raw':!![],'where':{'id':_0x359769[_0x6248('0x46')]['id']}},_0x754c76={};_0x754c76[_0x6248('0x30')]=_['keys'](db[_0x6248('0x2c')][_0x6248('0x2d')]);_0x754c76[_0x6248('0x31')]=_[_0x6248('0x32')](_0x359769[_0x6248('0x31')]);_0x754c76['filters']=_[_0x6248('0x34')](_0x754c76[_0x6248('0x30')],_0x754c76['query']);_0x1bb85b[_0x6248('0x36')]=_['intersection'](_0x754c76[_0x6248('0x30')],qs['fields'](_0x359769['query'][_0x6248('0x35')]));_0x1bb85b['attributes']=_0x1bb85b[_0x6248('0x36')][_0x6248('0x37')]?_0x1bb85b[_0x6248('0x36')]:_0x754c76['model'];if(_0x359769[_0x6248('0x31')][_0x6248('0x41')]){_0x1bb85b['include']=[{'all':!![]}];}_0x1bb85b=_[_0x6248('0x3e')]({},_0x1bb85b,_0x359769[_0x6248('0x40')]);return db[_0x6248('0x2c')][_0x6248('0x47')](_0x1bb85b)[_0x6248('0x21')](handleEntityNotFound(_0x35649c,null))['then'](respondWithResult(_0x35649c,null))[_0x6248('0x44')](handleError(_0x35649c,null));};exports[_0x6248('0x48')]=function(_0x27bdd1,_0x756e08){return db[_0x6248('0x2c')][_0x6248('0x48')](_0x27bdd1[_0x6248('0x49')],{})['then'](function(_0x46e158){var _0x470f9c=_0x27bdd1[_0x6248('0x4a')]['get']({'plain':!![]});if(!_0x470f9c)throw new Error(_0x6248('0x4b'));if(_0x470f9c[_0x6248('0x4c')]==='user'){var _0x2888d0=_0x46e158[_0x6248('0x23')]({'plain':!![]});var _0x47aa25=_0x6248('0x24');return db[_0x6248('0x4d')][_0x6248('0x47')]({'where':{'name':_0x47aa25,'userProfileId':_0x470f9c[_0x6248('0x4e')]},'raw':!![]})[_0x6248('0x21')](function(_0x813b20){if(_0x813b20&&_0x813b20[_0x6248('0x4f')]===0x0){return db[_0x6248('0x25')][_0x6248('0x48')]({'name':_0x2888d0[_0x6248('0x28')],'resourceId':_0x2888d0['id'],'type':_0x813b20[_0x6248('0x28')],'sectionId':_0x813b20['id']},{})['then'](function(){return _0x46e158;});}else{return _0x46e158;}})[_0x6248('0x44')](function(_0x24e140){logger[_0x6248('0x27')](_0x6248('0x50'),_0x24e140);throw _0x24e140;});}return _0x46e158;})[_0x6248('0x21')](respondWithResult(_0x756e08,0xc9))[_0x6248('0x44')](handleError(_0x756e08,null));};exports[_0x6248('0x20')]=function(_0x2cd061,_0xd181b0){if(_0x2cd061[_0x6248('0x49')]['id']){delete _0x2cd061[_0x6248('0x49')]['id'];}return db['AnalyticExtractedReport'][_0x6248('0x47')]({'where':{'id':_0x2cd061['params']['id']}})['then'](handleEntityNotFound(_0xd181b0,null))['then'](saveUpdates(_0x2cd061[_0x6248('0x49')],null))[_0x6248('0x21')](respondWithResult(_0xd181b0,null))[_0x6248('0x44')](handleError(_0xd181b0,null));};exports[_0x6248('0x22')]=function(_0x4daf36,_0x1960b3){return db['AnalyticExtractedReport'][_0x6248('0x47')]({'where':{'id':_0x4daf36[_0x6248('0x46')]['id']}})[_0x6248('0x21')](handleEntityNotFound(_0x1960b3,null))['then'](removeEntity(_0x1960b3,null))[_0x6248('0x44')](handleError(_0x1960b3,null));};exports[_0x6248('0x51')]=function(_0x240f09,_0x4ce438,_0x44e2af){return db[_0x6248('0x2c')][_0x6248('0x47')]({'where':{'id':_0x240f09[_0x6248('0x46')]['id']},'attributes':['name',_0x6248('0x52'),'savename','output'],'raw':!![]})[_0x6248('0x21')](handleEntityNotFound(_0x4ce438,null))[_0x6248('0x21')](function(_0x1003f0){if(_0x1003f0){if(!fs[_0x6248('0x53')](path[_0x6248('0x54')](config['root'],_0x6248('0x55'),_0x1003f0[_0x6248('0x56')]))){throw new db[(_0x6248('0x57'))][(_0x6248('0x58'))](_0x6248('0x59'));}if(_0x240f09[_0x6248('0x31')][_0x6248('0x5a')]){return _0x4ce438[_0x6248('0x26')](0xc8);}return _0x4ce438[_0x6248('0x51')](path[_0x6248('0x54')](config[_0x6248('0x5b')],_0x6248('0x55'),_0x1003f0[_0x6248('0x56')]),util[_0x6248('0x5c')](_0x6248('0x5d'),_0x1003f0[_0x6248('0x52')]||_0x1003f0[_0x6248('0x28')],_0x1003f0[_0x6248('0x5e')][_0x6248('0x5f')]()));}})[_0x6248('0x44')](handleError(_0x4ce438,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7736bbf..a53b621 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 _0xe4c1=['rimraf','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','moment','bluebird','request-promise','path'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xe4c1,0x126));var _0x1e4c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe4c1[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x1e4c('0x0'));var util=require(_0x1e4c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1e4c('0x2'));var BPromise=require(_0x1e4c('0x3'));var rp=require(_0x1e4c('0x4'));var fs=require('fs');var path=require(_0x1e4c('0x5'));var rimraf=require(_0x1e4c('0x6'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x1e4c('0x7')]=function(_0x2b00bd,_0x2ce50a){return _0x2b00bd['define'](_0x1e4c('0x8'),attributes,{'tableName':_0x1e4c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd708=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x1aebfe,_0xb00c5b){var _0x3f0f9b=function(_0x291391){while(--_0x291391){_0x1aebfe['push'](_0x1aebfe['shift']());}};_0x3f0f9b(++_0xb00c5b);}(_0xd708,0x90));var _0x8d70=function(_0x44dfe7,_0x548636){_0x44dfe7=_0x44dfe7-0x0;var _0x438563=_0xd708[_0x44dfe7];return _0x438563;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d70('0x0'))(_0x8d70('0x1'));var moment=require(_0x8d70('0x2'));var BPromise=require(_0x8d70('0x3'));var rp=require(_0x8d70('0x4'));var fs=require('fs');var path=require(_0x8d70('0x5'));var rimraf=require(_0x8d70('0x6'));var config=require(_0x8d70('0x7'));var attributes=require(_0x8d70('0x8'));module[_0x8d70('0x9')]=function(_0x440b93,_0x173a16){return _0x440b93[_0x8d70('0xa')](_0x8d70('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 0250042..2fc7dfe 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 _0x7ef2=['http','request','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x2ef789,_0x26a493){var _0xf29e80=function(_0x392fbe){while(--_0x392fbe){_0x2ef789['push'](_0x2ef789['shift']());}};_0xf29e80(++_0x26a493);}(_0x7ef2,0x15d));var _0x27ef=function(_0x22a993,_0x221191){_0x22a993=_0x22a993-0x0;var _0x4f9ca0=_0x7ef2[_0x22a993];return _0x4f9ca0;};'use strict';var _=require(_0x27ef('0x0'));var util=require('util');var moment=require(_0x27ef('0x1'));var BPromise=require(_0x27ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27ef('0x3'));var db=require(_0x27ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x27ef('0x5'));var config=require(_0x27ef('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x27ef('0x7')][_0x27ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x285292,_0x563446,_0x133d91){return new BPromise(function(_0x3bbb83,_0x38dcbc){return client[_0x27ef('0x9')](_0x285292,_0x133d91)[_0x27ef('0xa')](function(_0x4ec4e5){logger[_0x27ef('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x563446,_0x27ef('0xc'));logger['debug'](_0x27ef('0xd'),_0x563446,'request\x20sent',JSON[_0x27ef('0xe')](_0x4ec4e5));if(_0x4ec4e5[_0x27ef('0xf')]){if(_0x4ec4e5[_0x27ef('0xf')][_0x27ef('0x10')]===0x1f4){logger[_0x27ef('0xf')](_0x27ef('0x11'),_0x563446,_0x4ec4e5[_0x27ef('0xf')]['message']);return _0x38dcbc(_0x4ec4e5[_0x27ef('0xf')][_0x27ef('0x12')]);}logger[_0x27ef('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x563446,_0x4ec4e5[_0x27ef('0xf')]['message']);return _0x3bbb83(_0x4ec4e5[_0x27ef('0xf')][_0x27ef('0x12')]);}else{logger[_0x27ef('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x563446,_0x27ef('0xc'));_0x3bbb83(_0x4ec4e5[_0x27ef('0x13')][_0x27ef('0x12')]);}})[_0x27ef('0x14')](function(_0x1d2803){logger[_0x27ef('0xf')](_0x27ef('0x11'),_0x563446,_0x1d2803);_0x38dcbc(_0x1d2803);});});} \ No newline at end of file +var _0x8d57=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa2abba,_0xe29cb8){var _0x5ea3f2=function(_0x37fb29){while(--_0x37fb29){_0xa2abba['push'](_0xa2abba['shift']());}};_0x5ea3f2(++_0xe29cb8);}(_0x8d57,0x1de));var _0x78d5=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x8d57[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require(_0x78d5('0x0'));var util=require(_0x78d5('0x1'));var moment=require(_0x78d5('0x2'));var BPromise=require(_0x78d5('0x3'));var rs=require(_0x78d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78d5('0x5'))['db'];var utils=require(_0x78d5('0x6'));var logger=require(_0x78d5('0x7'))(_0x78d5('0x8'));var config=require(_0x78d5('0x9'));var jayson=require(_0x78d5('0xa'));var client=jayson[_0x78d5('0xb')][_0x78d5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c496f,_0x50568e,_0x770ed){return new BPromise(function(_0x5a5947,_0x5f13bb){return client[_0x78d5('0xd')](_0x2c496f,_0x770ed)[_0x78d5('0xe')](function(_0x30bd2a){logger['info'](_0x78d5('0xf'),_0x50568e,_0x78d5('0x10'));logger['debug'](_0x78d5('0x11'),_0x50568e,_0x78d5('0x10'),JSON[_0x78d5('0x12')](_0x30bd2a));if(_0x30bd2a[_0x78d5('0x13')]){if(_0x30bd2a[_0x78d5('0x13')][_0x78d5('0x14')]===0x1f4){logger[_0x78d5('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50568e,_0x30bd2a[_0x78d5('0x13')][_0x78d5('0x15')]);return _0x5f13bb(_0x30bd2a[_0x78d5('0x13')]['message']);}logger[_0x78d5('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50568e,_0x30bd2a[_0x78d5('0x13')]['message']);return _0x5a5947(_0x30bd2a[_0x78d5('0x13')][_0x78d5('0x15')]);}else{logger[_0x78d5('0x16')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50568e,'request\x20sent');_0x5a5947(_0x30bd2a[_0x78d5('0x17')][_0x78d5('0x15')]);}})[_0x78d5('0x18')](function(_0x153389){logger[_0x78d5('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50568e,_0x153389);_0x5f13bb(_0x153389);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 709b8ba..2a990e6 100644 --- a/server/api/analyticExtractedReport/index.js +++ b/server/api/analyticExtractedReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88c5=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x88c5,0x1e3));var _0x588c=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x88c5[_0x7ad123];return _0x37d073;};'use strict';var multer=require(_0x588c('0x0'));var util=require(_0x588c('0x1'));var path=require(_0x588c('0x2'));var timeout=require(_0x588c('0x3'));var express=require(_0x588c('0x4'));var router=express[_0x588c('0x5')]();var fs_extra=require(_0x588c('0x6'));var auth=require(_0x588c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x588c('0x8'));var controller=require(_0x588c('0x9'));router[_0x588c('0xa')]('/',auth['isAuthenticated'](),controller[_0x588c('0xb')]);router[_0x588c('0xa')](_0x588c('0xc'),auth[_0x588c('0xd')](),controller[_0x588c('0xe')]);router['get'](_0x588c('0xf'),auth[_0x588c('0xd')](),controller[_0x588c('0x10')]);router[_0x588c('0x11')]('/',auth[_0x588c('0xd')](),controller[_0x588c('0x12')]);router[_0x588c('0x13')](_0x588c('0xc'),auth[_0x588c('0xd')](),controller[_0x588c('0x14')]);router[_0x588c('0x15')]('/:id',auth[_0x588c('0xd')](),controller[_0x588c('0x16')]);module[_0x588c('0x17')]=router; \ No newline at end of file +var _0x8b95=['../../components/interaction/service','isAuthenticated','/:id','show','get','/:id/download','download','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3cce65,_0x583905){var _0xea464b=function(_0x421e13){while(--_0x421e13){_0x3cce65['push'](_0x3cce65['shift']());}};_0xea464b(++_0x583905);}(_0x8b95,0x1ab));var _0x58b9=function(_0x326e7a,_0x328740){_0x326e7a=_0x326e7a-0x0;var _0x20d922=_0x8b95[_0x326e7a];return _0x20d922;};'use strict';var multer=require(_0x58b9('0x0'));var util=require('util');var path=require(_0x58b9('0x1'));var timeout=require(_0x58b9('0x2'));var express=require('express');var router=express[_0x58b9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x58b9('0x4'));var interaction=require(_0x58b9('0x5'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x58b9('0x6')](),controller['index']);router['get'](_0x58b9('0x7'),auth['isAuthenticated'](),controller[_0x58b9('0x8')]);router[_0x58b9('0x9')](_0x58b9('0xa'),auth[_0x58b9('0x6')](),controller[_0x58b9('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x58b9('0xc')]);router[_0x58b9('0xd')](_0x58b9('0x7'),auth[_0x58b9('0x6')](),controller[_0x58b9('0xe')]);router[_0x58b9('0xf')]('/:id',auth[_0x58b9('0x6')](),controller[_0x58b9('0x10')]);module[_0x58b9('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e0df11e..b0d888f 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 _0xd677=['TEXT','STRING','BOOLEAN','exports'];(function(_0x57fda8,_0x5e80a0){var _0x11c895=function(_0xd08d0e){while(--_0xd08d0e){_0x57fda8['push'](_0x57fda8['shift']());}};_0x11c895(++_0x5e80a0);}(_0xd677,0x9b));var _0x7d67=function(_0x29beb2,_0x37dc64){_0x29beb2=_0x29beb2-0x0;var _0x1d66d7=_0xd677[_0x29beb2];return _0x1d66d7;};'use strict';var Sequelize=require('sequelize');module[_0x7d67('0x0')]={'field':{'type':Sequelize[_0x7d67('0x1')]},'alias':{'type':Sequelize[_0x7d67('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7d67('0x2')]},'groupBy':{'type':Sequelize[_0x7d67('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7d67('0x2')]},'custom':{'type':Sequelize[_0x7d67('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0bff=['BOOLEAN','TEXT','STRING'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x0bff,0x145));var _0xf0bf=function(_0x5e6a7e,_0x1c7802){_0x5e6a7e=_0x5e6a7e-0x0;var _0x249e61=_0x0bff[_0x5e6a7e];return _0x249e61;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0xf0bf('0x0')]},'alias':{'type':Sequelize[_0xf0bf('0x1')]},'function':{'type':Sequelize[_0xf0bf('0x1')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xf0bf('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf0bf('0x1')]},'custom':{'type':Sequelize[_0xf0bf('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 8b9a0f3..fd985c6 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 _0xd4bd=['catch','create','body','bulkCreate','update','ids','addFields','AnalyticCustomReport','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','AnalyticFieldReport','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','show','params','keys','rawAttributes','options','find'];(function(_0x172f2e,_0x270e87){var _0x34390a=function(_0x6dc1b9){while(--_0x6dc1b9){_0x172f2e['push'](_0x172f2e['shift']());}};_0x34390a(++_0x270e87);}(_0xd4bd,0x1a3));var _0xdd4b=function(_0x2ddd5a,_0x132cea){_0x2ddd5a=_0x2ddd5a-0x0;var _0x35a682=_0xd4bd[_0x2ddd5a];return _0x35a682;};'use strict';var emlformat=require(_0xdd4b('0x0'));var rimraf=require(_0xdd4b('0x1'));var zipdir=require(_0xdd4b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd4b('0x3'));var moment=require(_0xdd4b('0x4'));var BPromise=require(_0xdd4b('0x5'));var Mustache=require(_0xdd4b('0x6'));var util=require(_0xdd4b('0x7'));var path=require('path');var sox=require(_0xdd4b('0x8'));var csv=require(_0xdd4b('0x9'));var ejs=require(_0xdd4b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd4b('0xb'));var squel=require(_0xdd4b('0xc'));var crypto=require(_0xdd4b('0xd'));var jsforce=require(_0xdd4b('0xe'));var deskjs=require(_0xdd4b('0xf'));var toCsv=require(_0xdd4b('0x9'));var querystring=require(_0xdd4b('0x10'));var Papa=require(_0xdd4b('0x11'));var Redis=require(_0xdd4b('0x12'));var authService=require(_0xdd4b('0x13'));var qs=require(_0xdd4b('0x14'));var as=require(_0xdd4b('0x15'));var hardwareService=require(_0xdd4b('0x16'));var logger=require(_0xdd4b('0x17'))('api');var utils=require(_0xdd4b('0x18'));var config=require(_0xdd4b('0x19'));var licenseUtil=require(_0xdd4b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x219bc1,_0x2a5b91){_0x2a5b91=_0x2a5b91||0xcc;return function(_0x137b08){if(_0x137b08){return _0x219bc1['sendStatus'](_0x2a5b91);}return _0x219bc1[_0xdd4b('0x1b')](_0x2a5b91)[_0xdd4b('0x1c')]();};}function respondWithResult(_0xd4cbb2,_0x5aa922){_0x5aa922=_0x5aa922||0xc8;return function(_0x41463c){if(_0x41463c){return _0xd4cbb2[_0xdd4b('0x1b')](_0x5aa922)[_0xdd4b('0x1d')](_0x41463c);}};}function respondWithFilteredResult(_0x278b85,_0x971ce7){return function(_0x503cc0){if(_0x503cc0){var _0x35b067=typeof _0x971ce7[_0xdd4b('0x1e')]===_0xdd4b('0x1f')&&typeof _0x971ce7[_0xdd4b('0x20')]==='undefined';var _0x1dd579=_0x503cc0[_0xdd4b('0x21')];var _0x13c075=_0x35b067?0x0:_0x971ce7[_0xdd4b('0x1e')];var _0xdd9229=_0x35b067?_0x503cc0[_0xdd4b('0x21')]:_0x971ce7[_0xdd4b('0x1e')]+_0x971ce7[_0xdd4b('0x20')];var _0x1d7045;if(_0xdd9229>=_0x1dd579){_0xdd9229=_0x1dd579;_0x1d7045=0xc8;}else{_0x1d7045=0xce;}_0x278b85[_0xdd4b('0x1b')](_0x1d7045);return _0x278b85[_0xdd4b('0x22')](_0xdd4b('0x23'),_0x13c075+'-'+_0xdd9229+'/'+_0x1dd579)['json'](_0x503cc0);}return null;};}function patchUpdates(_0x5d7eec){return function(_0x8a21b0){try{jsonpatch[_0xdd4b('0x24')](_0x8a21b0,_0x5d7eec,!![]);}catch(_0x252b5a){return BPromise[_0xdd4b('0x25')](_0x252b5a);}return _0x8a21b0[_0xdd4b('0x26')]();};}function saveUpdates(_0x35f334,_0x39d542){return function(_0x3526ea){if(_0x3526ea){return _0x3526ea['update'](_0x35f334)[_0xdd4b('0x27')](function(_0x1c76c5){return _0x1c76c5;});}return null;};}function removeEntity(_0x50afdf,_0x316aed){return function(_0x1cd417){if(_0x1cd417){return _0x1cd417[_0xdd4b('0x28')]()[_0xdd4b('0x27')](function(){_0x50afdf['status'](0xcc)[_0xdd4b('0x1c')]();});}};}function handleEntityNotFound(_0x24a5df,_0x4314a7){return function(_0x57e3e3){if(!_0x57e3e3){_0x24a5df[_0xdd4b('0x29')](0x194);}return _0x57e3e3;};}function handleError(_0x3daba9,_0x35fdfc){_0x35fdfc=_0x35fdfc||0x1f4;return function(_0xd7c3cc){logger[_0xdd4b('0x2a')](_0xd7c3cc[_0xdd4b('0x2b')]);if(_0xd7c3cc[_0xdd4b('0x2c')]){delete _0xd7c3cc[_0xdd4b('0x2c')];}_0x3daba9[_0xdd4b('0x1b')](_0x35fdfc)[_0xdd4b('0x2d')](_0xd7c3cc);};}exports['index']=function(_0x38bab5,_0x4017a2){var _0x41bee3={},_0x3fc4f1={},_0x42f306={'count':0x0,'rows':[]};var _0x154567=_[_0xdd4b('0x2e')](db[_0xdd4b('0x2f')]['rawAttributes'],function(_0x463485){return{'name':_0x463485['fieldName'],'type':_0x463485['type'][_0xdd4b('0x30')]};});_0x3fc4f1['model']=_[_0xdd4b('0x2e')](_0x154567,_0xdd4b('0x2c'));_0x3fc4f1['query']=_['keys'](_0x38bab5[_0xdd4b('0x31')]);_0x3fc4f1['filters']=_[_0xdd4b('0x32')](_0x3fc4f1[_0xdd4b('0x33')],_0x3fc4f1['query']);_0x41bee3[_0xdd4b('0x34')]=_['intersection'](_0x3fc4f1['model'],qs[_0xdd4b('0x35')](_0x38bab5[_0xdd4b('0x31')][_0xdd4b('0x35')]));_0x41bee3[_0xdd4b('0x34')]=_0x41bee3[_0xdd4b('0x34')][_0xdd4b('0x36')]?_0x41bee3[_0xdd4b('0x34')]:_0x3fc4f1[_0xdd4b('0x33')];if(!_0x38bab5[_0xdd4b('0x31')][_0xdd4b('0x37')]('nolimit')){_0x41bee3['limit']=qs[_0xdd4b('0x20')](_0x38bab5[_0xdd4b('0x31')][_0xdd4b('0x20')]);_0x41bee3[_0xdd4b('0x1e')]=qs['offset'](_0x38bab5['query'][_0xdd4b('0x1e')]);}_0x41bee3[_0xdd4b('0x38')]=qs['sort'](_0x38bab5['query']['sort']);_0x41bee3[_0xdd4b('0x39')]=qs[_0xdd4b('0x3a')](_[_0xdd4b('0x3b')](_0x38bab5[_0xdd4b('0x31')],_0x3fc4f1['filters']),_0x154567);if(_0x38bab5['query']['filter']){_0x41bee3['where']=_['merge'](_0x41bee3['where'],{'$or':_[_0xdd4b('0x2e')](_0x154567,function(_0x237e4c){if(_0x237e4c[_0xdd4b('0x3c')]!==_0xdd4b('0x3d')){var _0x4821dd={};_0x4821dd[_0x237e4c[_0xdd4b('0x2c')]]={'$like':'%'+_0x38bab5['query'][_0xdd4b('0x3e')]+'%'};return _0x4821dd;}})});}_0x41bee3=_[_0xdd4b('0x3f')]({},_0x41bee3,_0x38bab5['options']);var _0x157eca={'where':_0x41bee3[_0xdd4b('0x39')]};return db[_0xdd4b('0x2f')][_0xdd4b('0x21')](_0x157eca)[_0xdd4b('0x27')](function(_0x4d5fdb){_0x42f306[_0xdd4b('0x21')]=_0x4d5fdb;if(_0x38bab5[_0xdd4b('0x31')][_0xdd4b('0x40')]){_0x41bee3[_0xdd4b('0x41')]=[{'all':!![]}];}return db[_0xdd4b('0x2f')][_0xdd4b('0x42')](_0x41bee3);})[_0xdd4b('0x27')](function(_0x292d95){_0x42f306['rows']=_0x292d95;return _0x42f306;})[_0xdd4b('0x27')](respondWithFilteredResult(_0x4017a2,_0x41bee3))['catch'](handleError(_0x4017a2,null));};exports[_0xdd4b('0x43')]=function(_0x4cac98,_0x2e7efc){var _0x2874f7={'raw':![],'where':{'id':_0x4cac98[_0xdd4b('0x44')]['id']}},_0x1de4a3={};_0x1de4a3[_0xdd4b('0x33')]=_[_0xdd4b('0x45')](db[_0xdd4b('0x2f')][_0xdd4b('0x46')]);_0x1de4a3[_0xdd4b('0x31')]=_[_0xdd4b('0x45')](_0x4cac98['query']);_0x1de4a3[_0xdd4b('0x3a')]=_[_0xdd4b('0x32')](_0x1de4a3['model'],_0x1de4a3[_0xdd4b('0x31')]);_0x2874f7[_0xdd4b('0x34')]=_[_0xdd4b('0x32')](_0x1de4a3['model'],qs[_0xdd4b('0x35')](_0x4cac98[_0xdd4b('0x31')][_0xdd4b('0x35')]));_0x2874f7[_0xdd4b('0x34')]=_0x2874f7[_0xdd4b('0x34')]['length']?_0x2874f7[_0xdd4b('0x34')]:_0x1de4a3[_0xdd4b('0x33')];if(_0x4cac98[_0xdd4b('0x31')][_0xdd4b('0x40')]){_0x2874f7['include']=[{'all':!![]}];}_0x2874f7=_[_0xdd4b('0x3f')]({},_0x2874f7,_0x4cac98[_0xdd4b('0x47')]);return db[_0xdd4b('0x2f')][_0xdd4b('0x48')](_0x2874f7)['then'](handleEntityNotFound(_0x2e7efc,null))[_0xdd4b('0x27')](respondWithResult(_0x2e7efc,null))[_0xdd4b('0x49')](handleError(_0x2e7efc,null));};exports['create']=function(_0x9bd654,_0x370383){return db[_0xdd4b('0x2f')][_0xdd4b('0x4a')](_0x9bd654[_0xdd4b('0x4b')],{})[_0xdd4b('0x27')](respondWithResult(_0x370383,0xc9))[_0xdd4b('0x49')](handleError(_0x370383,null));};exports['bulkCreate']=function(_0x1aa94b,_0x200b26){return db[_0xdd4b('0x2f')][_0xdd4b('0x4c')](_0x1aa94b[_0xdd4b('0x4b')],{'raw':![],'individualHooks':!![]})[_0xdd4b('0x27')](respondWithResult(_0x200b26,0xc9))[_0xdd4b('0x49')](handleError(_0x200b26,null));};exports[_0xdd4b('0x4d')]=function(_0x120241,_0x3c5420){if(_0x120241[_0xdd4b('0x4b')]['id']){delete _0x120241[_0xdd4b('0x4b')]['id'];}return db[_0xdd4b('0x2f')][_0xdd4b('0x48')]({'where':{'id':_0x120241[_0xdd4b('0x44')]['id']}})[_0xdd4b('0x27')](handleEntityNotFound(_0x3c5420,null))[_0xdd4b('0x27')](saveUpdates(_0x120241[_0xdd4b('0x4b')],null))['then'](respondWithResult(_0x3c5420,null))[_0xdd4b('0x49')](handleError(_0x3c5420,null));};exports[_0xdd4b('0x28')]=function(_0x5cfc8a,_0x2f7768){return db[_0xdd4b('0x2f')][_0xdd4b('0x48')]({'where':{'id':_0x5cfc8a[_0xdd4b('0x44')]['id']}})[_0xdd4b('0x27')](handleEntityNotFound(_0x2f7768,null))[_0xdd4b('0x27')](removeEntity(_0x2f7768,null))[_0xdd4b('0x49')](handleError(_0x2f7768,null));};exports['bulkDestroy']=function(_0x454c3e,_0x1cf2fc){return db[_0xdd4b('0x2f')]['destroy']({'where':{'id':_0x454c3e[_0xdd4b('0x31')][_0xdd4b('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xdd4b('0x27')](respondWithResult(_0x1cf2fc,0xcc))['catch'](handleError(_0x1cf2fc,null));};exports[_0xdd4b('0x4f')]=function(_0x41b9a6,_0x38a7db,_0x6764eb){return db[_0xdd4b('0x50')][_0xdd4b('0x51')]({'where':{'id':_0x41b9a6['params']['id']}})[_0xdd4b('0x27')](handleEntityNotFound(_0x38a7db,null))[_0xdd4b('0x27')](function(_0x10ad1b){if(_0x10ad1b){return db['sequelize']['transaction'](function(_0xf6ae24){return db[_0xdd4b('0x2f')][_0xdd4b('0x28')]({'where':{'CustomReportId':_0x41b9a6['params']['id']},'transaction':_0xf6ae24})[_0xdd4b('0x27')](function(_0x297878){var _0x1cc00c=_[_0xdd4b('0x2e')](_0x41b9a6['body'],function(_0x9e65ce){delete _0x9e65ce['id'];_0x9e65ce['CustomReportId']=_0x41b9a6['params']['id'];return _0x9e65ce;});return db['AnalyticFieldReport'][_0xdd4b('0x4c')](_0x1cc00c,{'transaction':_0xf6ae24});});})[_0xdd4b('0x27')](function(){return db[_0xdd4b('0x2f')]['findAll']({'where':{'CustomReportId':_0x41b9a6[_0xdd4b('0x44')]['id']}});});}})['then'](respondWithResult(_0x38a7db,null))['catch'](handleError(_0x38a7db,null));}; \ No newline at end of file +var _0x5cf7=['name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x5cf7,0x121));var _0x75cf=function(_0xc72235,_0x1d3b33){_0xc72235=_0xc72235-0x0;var _0x36c3b1=_0x5cf7[_0xc72235];return _0x36c3b1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x75cf('0x0'));var jsonpatch=require(_0x75cf('0x1'));var rp=require(_0x75cf('0x2'));var moment=require('moment');var BPromise=require(_0x75cf('0x3'));var Mustache=require(_0x75cf('0x4'));var util=require('util');var path=require(_0x75cf('0x5'));var sox=require(_0x75cf('0x6'));var csv=require(_0x75cf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75cf('0x8'));var _=require('lodash');var squel=require(_0x75cf('0x9'));var crypto=require(_0x75cf('0xa'));var jsforce=require(_0x75cf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x75cf('0x7'));var querystring=require(_0x75cf('0xc'));var Papa=require(_0x75cf('0xd'));var Redis=require(_0x75cf('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75cf('0xf'));var hardwareService=require(_0x75cf('0x10'));var logger=require(_0x75cf('0x11'))(_0x75cf('0x12'));var utils=require(_0x75cf('0x13'));var config=require(_0x75cf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x75cf('0x15'))['db'];function respondWithStatusCode(_0x5bd01a,_0x404368){_0x404368=_0x404368||0xcc;return function(_0x14542b){if(_0x14542b){return _0x5bd01a[_0x75cf('0x16')](_0x404368);}return _0x5bd01a[_0x75cf('0x17')](_0x404368)[_0x75cf('0x18')]();};}function respondWithResult(_0x451ae1,_0x21020f){_0x21020f=_0x21020f||0xc8;return function(_0x5369b2){if(_0x5369b2){return _0x451ae1[_0x75cf('0x17')](_0x21020f)[_0x75cf('0x19')](_0x5369b2);}};}function respondWithFilteredResult(_0x2ed792,_0x555de2){return function(_0x54b329){if(_0x54b329){var _0x576444=typeof _0x555de2[_0x75cf('0x1a')]===_0x75cf('0x1b')&&typeof _0x555de2[_0x75cf('0x1c')]==='undefined';var _0xc00f83=_0x54b329[_0x75cf('0x1d')];var _0x375b75=_0x576444?0x0:_0x555de2['offset'];var _0x5c8fe2=_0x576444?_0x54b329[_0x75cf('0x1d')]:_0x555de2[_0x75cf('0x1a')]+_0x555de2['limit'];var _0x3878ce;if(_0x5c8fe2>=_0xc00f83){_0x5c8fe2=_0xc00f83;_0x3878ce=0xc8;}else{_0x3878ce=0xce;}_0x2ed792[_0x75cf('0x17')](_0x3878ce);return _0x2ed792['set'](_0x75cf('0x1e'),_0x375b75+'-'+_0x5c8fe2+'/'+_0xc00f83)[_0x75cf('0x19')](_0x54b329);}return null;};}function patchUpdates(_0x771752){return function(_0x2553be){try{jsonpatch[_0x75cf('0x1f')](_0x2553be,_0x771752,!![]);}catch(_0x19e7e7){return BPromise[_0x75cf('0x20')](_0x19e7e7);}return _0x2553be[_0x75cf('0x21')]();};}function saveUpdates(_0x443b3c,_0x959641){return function(_0x18512c){if(_0x18512c){return _0x18512c[_0x75cf('0x22')](_0x443b3c)[_0x75cf('0x23')](function(_0x1a0dc2){return _0x1a0dc2;});}return null;};}function removeEntity(_0x4f073b,_0x57b0d4){return function(_0x2b2a4c){if(_0x2b2a4c){return _0x2b2a4c[_0x75cf('0x24')]()[_0x75cf('0x23')](function(){_0x4f073b[_0x75cf('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a1f1f,_0x5501dc){return function(_0x14aaa4){if(!_0x14aaa4){_0x5a1f1f[_0x75cf('0x16')](0x194);}return _0x14aaa4;};}function handleError(_0x1e19f5,_0x6f0cfa){_0x6f0cfa=_0x6f0cfa||0x1f4;return function(_0x2f3d53){logger[_0x75cf('0x25')](_0x2f3d53[_0x75cf('0x26')]);if(_0x2f3d53['name']){delete _0x2f3d53[_0x75cf('0x27')];}_0x1e19f5[_0x75cf('0x17')](_0x6f0cfa)[_0x75cf('0x28')](_0x2f3d53);};}exports[_0x75cf('0x29')]=function(_0x5c2da6,_0x1d8db4){var _0xdb6c1d={},_0x2ac543={},_0x597072={'count':0x0,'rows':[]};var _0x31455c=_[_0x75cf('0x2a')](db[_0x75cf('0x2b')][_0x75cf('0x2c')],function(_0xa88263){return{'name':_0xa88263[_0x75cf('0x2d')],'type':_0xa88263[_0x75cf('0x2e')]['key']};});_0x2ac543[_0x75cf('0x2f')]=_['map'](_0x31455c,'name');_0x2ac543['query']=_[_0x75cf('0x30')](_0x5c2da6[_0x75cf('0x31')]);_0x2ac543[_0x75cf('0x32')]=_[_0x75cf('0x33')](_0x2ac543['model'],_0x2ac543[_0x75cf('0x31')]);_0xdb6c1d['attributes']=_[_0x75cf('0x33')](_0x2ac543[_0x75cf('0x2f')],qs[_0x75cf('0x34')](_0x5c2da6[_0x75cf('0x31')][_0x75cf('0x34')]));_0xdb6c1d[_0x75cf('0x35')]=_0xdb6c1d['attributes'][_0x75cf('0x36')]?_0xdb6c1d[_0x75cf('0x35')]:_0x2ac543[_0x75cf('0x2f')];if(!_0x5c2da6[_0x75cf('0x31')]['hasOwnProperty'](_0x75cf('0x37'))){_0xdb6c1d['limit']=qs['limit'](_0x5c2da6['query']['limit']);_0xdb6c1d[_0x75cf('0x1a')]=qs[_0x75cf('0x1a')](_0x5c2da6[_0x75cf('0x31')]['offset']);}_0xdb6c1d[_0x75cf('0x38')]=qs[_0x75cf('0x39')](_0x5c2da6['query']['sort']);_0xdb6c1d['where']=qs['filters'](_[_0x75cf('0x3a')](_0x5c2da6[_0x75cf('0x31')],_0x2ac543[_0x75cf('0x32')]),_0x31455c);if(_0x5c2da6[_0x75cf('0x31')][_0x75cf('0x3b')]){_0xdb6c1d[_0x75cf('0x3c')]=_['merge'](_0xdb6c1d[_0x75cf('0x3c')],{'$or':_[_0x75cf('0x2a')](_0x31455c,function(_0x39c1ed){if(_0x39c1ed[_0x75cf('0x2e')]!=='VIRTUAL'){var _0x5f3ba0={};_0x5f3ba0[_0x39c1ed['name']]={'$like':'%'+_0x5c2da6[_0x75cf('0x31')][_0x75cf('0x3b')]+'%'};return _0x5f3ba0;}})});}_0xdb6c1d=_[_0x75cf('0x3d')]({},_0xdb6c1d,_0x5c2da6[_0x75cf('0x3e')]);var _0x3554bd={'where':_0xdb6c1d['where']};return db[_0x75cf('0x2b')][_0x75cf('0x1d')](_0x3554bd)['then'](function(_0x1a20f1){_0x597072[_0x75cf('0x1d')]=_0x1a20f1;if(_0x5c2da6[_0x75cf('0x31')][_0x75cf('0x3f')]){_0xdb6c1d[_0x75cf('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x75cf('0x41')](_0xdb6c1d);})[_0x75cf('0x23')](function(_0x341136){_0x597072[_0x75cf('0x42')]=_0x341136;return _0x597072;})[_0x75cf('0x23')](respondWithFilteredResult(_0x1d8db4,_0xdb6c1d))['catch'](handleError(_0x1d8db4,null));};exports[_0x75cf('0x43')]=function(_0x24b256,_0x516252){var _0x1eabcb={'raw':![],'where':{'id':_0x24b256[_0x75cf('0x44')]['id']}},_0x17c5e4={};_0x17c5e4['model']=_[_0x75cf('0x30')](db[_0x75cf('0x2b')]['rawAttributes']);_0x17c5e4[_0x75cf('0x31')]=_['keys'](_0x24b256['query']);_0x17c5e4[_0x75cf('0x32')]=_[_0x75cf('0x33')](_0x17c5e4[_0x75cf('0x2f')],_0x17c5e4[_0x75cf('0x31')]);_0x1eabcb['attributes']=_[_0x75cf('0x33')](_0x17c5e4['model'],qs[_0x75cf('0x34')](_0x24b256[_0x75cf('0x31')][_0x75cf('0x34')]));_0x1eabcb['attributes']=_0x1eabcb['attributes'][_0x75cf('0x36')]?_0x1eabcb[_0x75cf('0x35')]:_0x17c5e4[_0x75cf('0x2f')];if(_0x24b256[_0x75cf('0x31')][_0x75cf('0x3f')]){_0x1eabcb[_0x75cf('0x40')]=[{'all':!![]}];}_0x1eabcb=_['merge']({},_0x1eabcb,_0x24b256[_0x75cf('0x3e')]);return db[_0x75cf('0x2b')]['find'](_0x1eabcb)['then'](handleEntityNotFound(_0x516252,null))[_0x75cf('0x23')](respondWithResult(_0x516252,null))[_0x75cf('0x45')](handleError(_0x516252,null));};exports[_0x75cf('0x46')]=function(_0x3d0511,_0x2472bf){return db[_0x75cf('0x2b')]['create'](_0x3d0511[_0x75cf('0x47')],{})['then'](respondWithResult(_0x2472bf,0xc9))['catch'](handleError(_0x2472bf,null));};exports[_0x75cf('0x48')]=function(_0x12ffda,_0x4ee76d){return db[_0x75cf('0x2b')][_0x75cf('0x48')](_0x12ffda[_0x75cf('0x47')],{'raw':![],'individualHooks':!![]})[_0x75cf('0x23')](respondWithResult(_0x4ee76d,0xc9))['catch'](handleError(_0x4ee76d,null));};exports[_0x75cf('0x22')]=function(_0x1b92ce,_0x2b4429){if(_0x1b92ce['body']['id']){delete _0x1b92ce[_0x75cf('0x47')]['id'];}return db['AnalyticFieldReport'][_0x75cf('0x49')]({'where':{'id':_0x1b92ce[_0x75cf('0x44')]['id']}})[_0x75cf('0x23')](handleEntityNotFound(_0x2b4429,null))[_0x75cf('0x23')](saveUpdates(_0x1b92ce['body'],null))[_0x75cf('0x23')](respondWithResult(_0x2b4429,null))['catch'](handleError(_0x2b4429,null));};exports[_0x75cf('0x24')]=function(_0x10f590,_0xe4e3){return db[_0x75cf('0x2b')][_0x75cf('0x49')]({'where':{'id':_0x10f590[_0x75cf('0x44')]['id']}})[_0x75cf('0x23')](handleEntityNotFound(_0xe4e3,null))['then'](removeEntity(_0xe4e3,null))['catch'](handleError(_0xe4e3,null));};exports[_0x75cf('0x4a')]=function(_0x3c2001,_0x1d8305){return db['AnalyticFieldReport'][_0x75cf('0x24')]({'where':{'id':_0x3c2001[_0x75cf('0x31')][_0x75cf('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x75cf('0x23')](respondWithResult(_0x1d8305,0xcc))[_0x75cf('0x45')](handleError(_0x1d8305,null));};exports[_0x75cf('0x4c')]=function(_0x533c49,_0x531902,_0x5f0572){return db[_0x75cf('0x4d')][_0x75cf('0x4e')]({'where':{'id':_0x533c49['params']['id']}})['then'](handleEntityNotFound(_0x531902,null))['then'](function(_0x58d53d){if(_0x58d53d){return db[_0x75cf('0x4f')][_0x75cf('0x50')](function(_0x3adebe){return db[_0x75cf('0x2b')][_0x75cf('0x24')]({'where':{'CustomReportId':_0x533c49['params']['id']},'transaction':_0x3adebe})[_0x75cf('0x23')](function(_0xc26686){var _0x3029e4=_[_0x75cf('0x2a')](_0x533c49[_0x75cf('0x47')],function(_0x1c02bd){delete _0x1c02bd['id'];_0x1c02bd[_0x75cf('0x51')]=_0x533c49[_0x75cf('0x44')]['id'];return _0x1c02bd;});return db[_0x75cf('0x2b')][_0x75cf('0x48')](_0x3029e4,{'transaction':_0x3adebe});});})[_0x75cf('0x23')](function(){return db[_0x75cf('0x2b')]['findAll']({'where':{'CustomReportId':_0x533c49[_0x75cf('0x44')]['id']}});});}})[_0x75cf('0x23')](respondWithResult(_0x531902,null))['catch'](handleError(_0x531902,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0ac8485..0942908 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 _0x6d30=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0x6d30,0xa2));var _0x06d3=function(_0x354fc7,_0x10bd45){_0x354fc7=_0x354fc7-0x0;var _0x462135=_0x6d30[_0x354fc7];return _0x462135;};'use strict';var _=require(_0x06d3('0x0'));var util=require(_0x06d3('0x1'));var logger=require('../../config/logger')(_0x06d3('0x2'));var moment=require('moment');var BPromise=require(_0x06d3('0x3'));var rp=require(_0x06d3('0x4'));var fs=require('fs');var path=require(_0x06d3('0x5'));var rimraf=require(_0x06d3('0x6'));var config=require(_0x06d3('0x7'));var attributes=require(_0x06d3('0x8'));module[_0x06d3('0x9')]=function(_0x3b512a,_0x299388){return _0x3b512a[_0x06d3('0xa')](_0x06d3('0xb'),attributes,{'tableName':_0x06d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36e4=['request-promise','../../config/environment','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment'];(function(_0x162fa4,_0x366705){var _0x1d1d8a=function(_0x8d266f){while(--_0x8d266f){_0x162fa4['push'](_0x162fa4['shift']());}};_0x1d1d8a(++_0x366705);}(_0x36e4,0x1d1));var _0x436e=function(_0x5ef24a,_0x238329){_0x5ef24a=_0x5ef24a-0x0;var _0x5ad174=_0x36e4[_0x5ef24a];return _0x5ad174;};'use strict';var _=require(_0x436e('0x0'));var util=require(_0x436e('0x1'));var logger=require(_0x436e('0x2'))(_0x436e('0x3'));var moment=require(_0x436e('0x4'));var BPromise=require('bluebird');var rp=require(_0x436e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x436e('0x6'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x2fa22f,_0x4ad910){return _0x2fa22f[_0x436e('0x7')](_0x436e('0x8'),attributes,{'tableName':_0x436e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 17b3909..b192f76 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 _0x3a7b=['rpc','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x561134,_0x287a49){var _0x5587f3=function(_0x4c8214){while(--_0x4c8214){_0x561134['push'](_0x561134['shift']());}};_0x5587f3(++_0x287a49);}(_0x3a7b,0xcb));var _0xb3a7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3a7b[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xb3a7('0x0'));var moment=require(_0xb3a7('0x1'));var BPromise=require(_0xb3a7('0x2'));var rs=require(_0xb3a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3a7('0x4'))['db'];var utils=require(_0xb3a7('0x5'));var logger=require(_0xb3a7('0x6'))(_0xb3a7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb3a7('0x8')][_0xb3a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41546a,_0x21eb63,_0x57e4cf){return new BPromise(function(_0x10e3e4,_0x5ec03d){return client[_0xb3a7('0xa')](_0x41546a,_0x57e4cf)['then'](function(_0x4ac4f3){logger[_0xb3a7('0xb')](_0xb3a7('0xc'),_0x21eb63,'request\x20sent');logger[_0xb3a7('0xd')](_0xb3a7('0xe'),_0x21eb63,_0xb3a7('0xf'),JSON[_0xb3a7('0x10')](_0x4ac4f3));if(_0x4ac4f3['error']){if(_0x4ac4f3[_0xb3a7('0x11')][_0xb3a7('0x12')]===0x1f4){logger[_0xb3a7('0x11')](_0xb3a7('0xc'),_0x21eb63,_0x4ac4f3[_0xb3a7('0x11')][_0xb3a7('0x13')]);return _0x5ec03d(_0x4ac4f3[_0xb3a7('0x11')][_0xb3a7('0x13')]);}logger[_0xb3a7('0x11')](_0xb3a7('0xc'),_0x21eb63,_0x4ac4f3[_0xb3a7('0x11')]['message']);return _0x10e3e4(_0x4ac4f3[_0xb3a7('0x11')][_0xb3a7('0x13')]);}else{logger[_0xb3a7('0xb')](_0xb3a7('0xc'),_0x21eb63,_0xb3a7('0xf'));_0x10e3e4(_0x4ac4f3[_0xb3a7('0x14')][_0xb3a7('0x13')]);}})['catch'](function(_0x5264b8){logger[_0xb3a7('0x11')](_0xb3a7('0xc'),_0x21eb63,_0x5264b8);_0x5ec03d(_0x5264b8);});});} \ No newline at end of file +var _0x519a=['../../config/environment','jayson/promise','http','request','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','code','error','message','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x187266,_0x3f99df){var _0x1a83bc=function(_0x189626){while(--_0x189626){_0x187266['push'](_0x187266['shift']());}};_0x1a83bc(++_0x3f99df);}(_0x519a,0xff));var _0xa519=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0x519a[_0x47e93d];return _0xe86c46;};'use strict';var _=require(_0xa519('0x0'));var util=require(_0xa519('0x1'));var moment=require(_0xa519('0x2'));var BPromise=require(_0xa519('0x3'));var rs=require(_0xa519('0x4'));var fs=require('fs');var Redis=require(_0xa519('0x5'));var db=require(_0xa519('0x6'))['db'];var utils=require(_0xa519('0x7'));var logger=require('../../config/logger')(_0xa519('0x8'));var config=require(_0xa519('0x9'));var jayson=require(_0xa519('0xa'));var client=jayson['client'][_0xa519('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4228ad,_0x42f5e3,_0x46f7c4){return new BPromise(function(_0x19619d,_0x314677){return client[_0xa519('0xc')](_0x4228ad,_0x46f7c4)['then'](function(_0x14b1f4){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x42f5e3,'request\x20sent');logger[_0xa519('0xd')](_0xa519('0xe'),_0x42f5e3,'request\x20sent',JSON['stringify'](_0x14b1f4));if(_0x14b1f4['error']){if(_0x14b1f4['error'][_0xa519('0xf')]===0x1f4){logger[_0xa519('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x42f5e3,_0x14b1f4[_0xa519('0x10')][_0xa519('0x11')]);return _0x314677(_0x14b1f4[_0xa519('0x10')]['message']);}logger['error'](_0xa519('0x12'),_0x42f5e3,_0x14b1f4[_0xa519('0x10')]['message']);return _0x19619d(_0x14b1f4['error'][_0xa519('0x11')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x42f5e3,_0xa519('0x13'));_0x19619d(_0x14b1f4[_0xa519('0x14')][_0xa519('0x11')]);}})[_0xa519('0x15')](function(_0x2d5a21){logger[_0xa519('0x10')](_0xa519('0x12'),_0x42f5e3,_0x2d5a21);_0x314677(_0x2d5a21);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 781763b..c5a800f 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(_0x3aa041,_0x56b55c){var _0x3b6837=function(_0x24b142){while(--_0x24b142){_0x3aa041['push'](_0x3aa041['shift']());}};_0x3b6837(++_0x56b55c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x38f755,_0x32fb5e){var _0xa0aa88=function(_0x184f0f){while(--_0x184f0f){_0x38f755['push'](_0x38f755['shift']());}};_0xa0aa88(++_0x32fb5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 ba85f07..87394c5 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 _0x50c1=['TEXT','sequelize','name','STRING'];(function(_0x396245,_0x22c863){var _0x353760=function(_0x80d10c){while(--_0x80d10c){_0x396245['push'](_0x396245['shift']());}};_0x353760(++_0x22c863);}(_0x50c1,0x1a5));var _0x150c=function(_0x171595,_0x5cf384){_0x171595=_0x171595-0x0;var _0x209861=_0x50c1[_0x171595];return _0x209861;};'use strict';var Sequelize=require(_0x150c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x150c('0x1')},'table':{'type':Sequelize[_0x150c('0x2')]},'metric':{'type':Sequelize[_0x150c('0x3')]},'description':{'type':Sequelize[_0x150c('0x2')]}}; \ No newline at end of file +var _0xb077=['TEXT','STRING','sequelize','name'];(function(_0x522887,_0x1ad1c3){var _0xbcf1c2=function(_0x5cac3c){while(--_0x5cac3c){_0x522887['push'](_0x522887['shift']());}};_0xbcf1c2(++_0x1ad1c3);}(_0xb077,0x7a));var _0x7b07=function(_0x27ff4a,_0x38e23d){_0x27ff4a=_0x27ff4a-0x0;var _0x313382=_0xb077[_0x27ff4a];return _0x313382;};'use strict';var Sequelize=require(_0x7b07('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7b07('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x7b07('0x2')]},'description':{'type':Sequelize[_0x7b07('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 653cf9f..e7947d5 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x3d2aaf,_0x208755){var _0x7bc601=function(_0xa0e936){while(--_0xa0e936){_0x3d2aaf['push'](_0x3d2aaf['shift']());}};_0x7bc601(++_0x208755);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file +var _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x5e497c,_0x15de4b){var _0x2b744c=function(_0x20c897){while(--_0x20c897){_0x5e497c['push'](_0x5e497c['shift']());}};_0x2b744c(++_0x15de4b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x00bb[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5fd9115..0983b09 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 _0x0650=['bluebird','path','rimraf','../../config/environment','exports','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x0650,0xed));var _0x0065=function(_0x33a140,_0x477198){_0x33a140=_0x33a140-0x0;var _0x47157e=_0x0650[_0x33a140];return _0x47157e;};'use strict';var _=require(_0x0065('0x0'));var util=require('util');var logger=require(_0x0065('0x1'))(_0x0065('0x2'));var moment=require('moment');var BPromise=require(_0x0065('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0065('0x4'));var rimraf=require(_0x0065('0x5'));var config=require(_0x0065('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x0065('0x7')]=function(_0x507ed3,_0x5cf16e){return _0x507ed3['define'](_0x0065('0x8'),attributes,{'tableName':_0x0065('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5024=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0xc32b7b,_0x13dde9){var _0x304a4c=function(_0x3abae3){while(--_0x3abae3){_0xc32b7b['push'](_0xc32b7b['shift']());}};_0x304a4c(++_0x13dde9);}(_0x5024,0xf7));var _0x4502=function(_0x5317a9,_0x34c091){_0x5317a9=_0x5317a9-0x0;var _0x3707de=_0x5024[_0x5317a9];return _0x3707de;};'use strict';var _=require(_0x4502('0x0'));var util=require(_0x4502('0x1'));var logger=require(_0x4502('0x2'))(_0x4502('0x3'));var moment=require('moment');var BPromise=require(_0x4502('0x4'));var rp=require(_0x4502('0x5'));var fs=require('fs');var path=require(_0x4502('0x6'));var rimraf=require(_0x4502('0x7'));var config=require(_0x4502('0x8'));var attributes=require(_0x4502('0x9'));module[_0x4502('0xa')]=function(_0x5eddab,_0x548459){return _0x5eddab[_0x4502('0xb')]('AnalyticMetric',attributes,{'tableName':_0x4502('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 d803c31..2b7b90f 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 _0xcb5c=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x3c42c6,_0x4e0d2e){var _0x1ddfc6=function(_0x38291f){while(--_0x38291f){_0x3c42c6['push'](_0x3c42c6['shift']());}};_0x1ddfc6(++_0x4e0d2e);}(_0xcb5c,0x179));var _0xccb5=function(_0x57f601,_0x35d28a){_0x57f601=_0x57f601-0x0;var _0x208e78=_0xcb5c[_0x57f601];return _0x208e78;};'use strict';var _=require('lodash');var util=require(_0xccb5('0x0'));var moment=require(_0xccb5('0x1'));var BPromise=require('bluebird');var rs=require(_0xccb5('0x2'));var fs=require('fs');var Redis=require(_0xccb5('0x3'));var db=require(_0xccb5('0x4'))['db'];var utils=require(_0xccb5('0x5'));var logger=require('../../config/logger')(_0xccb5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xccb5('0x7')][_0xccb5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69e238,_0x47979,_0x3a190e){return new BPromise(function(_0x5b70c2,_0x1430a7){return client[_0xccb5('0x9')](_0x69e238,_0x3a190e)[_0xccb5('0xa')](function(_0x364266){logger[_0xccb5('0xb')](_0xccb5('0xc'),_0x47979,_0xccb5('0xd'));logger[_0xccb5('0xe')](_0xccb5('0xf'),_0x47979,_0xccb5('0xd'),JSON[_0xccb5('0x10')](_0x364266));if(_0x364266[_0xccb5('0x11')]){if(_0x364266['error'][_0xccb5('0x12')]===0x1f4){logger[_0xccb5('0x11')](_0xccb5('0xc'),_0x47979,_0x364266['error']['message']);return _0x1430a7(_0x364266['error'][_0xccb5('0x13')]);}logger[_0xccb5('0x11')](_0xccb5('0xc'),_0x47979,_0x364266[_0xccb5('0x11')][_0xccb5('0x13')]);return _0x5b70c2(_0x364266['error'][_0xccb5('0x13')]);}else{logger[_0xccb5('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x47979,'request\x20sent');_0x5b70c2(_0x364266['result'][_0xccb5('0x13')]);}})[_0xccb5('0x14')](function(_0x3bb50e){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x47979,_0x3bb50e);_0x1430a7(_0x3bb50e);});});} \ No newline at end of file +var _0xe6a9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x4940f7,_0xeef48b){var _0x1e2e08=function(_0x531231){while(--_0x531231){_0x4940f7['push'](_0x4940f7['shift']());}};_0x1e2e08(++_0xeef48b);}(_0xe6a9,0x128));var _0x9e6a=function(_0x202cea,_0x41f223){_0x202cea=_0x202cea-0x0;var _0x572be3=_0xe6a9[_0x202cea];return _0x572be3;};'use strict';var _=require(_0x9e6a('0x0'));var util=require('util');var moment=require(_0x9e6a('0x1'));var BPromise=require(_0x9e6a('0x2'));var rs=require(_0x9e6a('0x3'));var fs=require('fs');var Redis=require(_0x9e6a('0x4'));var db=require(_0x9e6a('0x5'))['db'];var utils=require(_0x9e6a('0x6'));var logger=require(_0x9e6a('0x7'))(_0x9e6a('0x8'));var config=require(_0x9e6a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9e6a('0xa')][_0x9e6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fd318,_0x1a611f,_0x1f6821){return new BPromise(function(_0x3b7bbf,_0x2639ce){return client[_0x9e6a('0xc')](_0x3fd318,_0x1f6821)['then'](function(_0x1d68bb){logger[_0x9e6a('0xd')](_0x9e6a('0xe'),_0x1a611f,'request\x20sent');logger['debug'](_0x9e6a('0xf'),_0x1a611f,_0x9e6a('0x10'),JSON[_0x9e6a('0x11')](_0x1d68bb));if(_0x1d68bb['error']){if(_0x1d68bb[_0x9e6a('0x12')][_0x9e6a('0x13')]===0x1f4){logger[_0x9e6a('0x12')](_0x9e6a('0xe'),_0x1a611f,_0x1d68bb['error'][_0x9e6a('0x14')]);return _0x2639ce(_0x1d68bb['error'][_0x9e6a('0x14')]);}logger[_0x9e6a('0x12')](_0x9e6a('0xe'),_0x1a611f,_0x1d68bb[_0x9e6a('0x12')][_0x9e6a('0x14')]);return _0x3b7bbf(_0x1d68bb['error'][_0x9e6a('0x14')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x1a611f,_0x9e6a('0x10'));_0x3b7bbf(_0x1d68bb[_0x9e6a('0x15')][_0x9e6a('0x14')]);}})[_0x9e6a('0x16')](function(_0x5d37f1){logger[_0x9e6a('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x1a611f,_0x5d37f1);_0x2639ce(_0x5d37f1);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 16644f2..8e64f97 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 _0x1134=['../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2b5cc4,_0x3de7f8){var _0x3c7a90=function(_0x5477e7){while(--_0x5477e7){_0x2b5cc4['push'](_0x2b5cc4['shift']());}};_0x3c7a90(++_0x3de7f8);}(_0x1134,0x19c));var _0x4113=function(_0x536c97,_0x5d0742){_0x536c97=_0x536c97-0x0;var _0x12081c=_0x1134[_0x536c97];return _0x12081c;};'use strict';var multer=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var path=require('path');var timeout=require(_0x4113('0x2'));var express=require(_0x4113('0x3'));var router=express['Router']();var fs_extra=require(_0x4113('0x4'));var auth=require(_0x4113('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4113('0x6'));var controller=require('./analyticMetric.controller');router[_0x4113('0x7')]('/',auth['isAuthenticated'](),controller[_0x4113('0x8')]);router['get'](_0x4113('0x9'),auth[_0x4113('0xa')](),controller[_0x4113('0xb')]);router[_0x4113('0xc')]('/',auth[_0x4113('0xa')](),controller[_0x4113('0xd')]);router[_0x4113('0xe')](_0x4113('0x9'),auth['isAuthenticated'](),controller[_0x4113('0xf')]);router[_0x4113('0x10')](_0x4113('0x9'),auth[_0x4113('0xa')](),controller[_0x4113('0x11')]);module[_0x4113('0x12')]=router; \ No newline at end of file +var _0x37cc=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x37cc,0x185));var _0xc37c=function(_0xc9164a,_0x643ed7){_0xc9164a=_0xc9164a-0x0;var _0x1f0a59=_0x37cc[_0xc9164a];return _0x1f0a59;};'use strict';var multer=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var path=require(_0xc37c('0x2'));var timeout=require(_0xc37c('0x3'));var express=require(_0xc37c('0x4'));var router=express[_0xc37c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc37c('0x6'));var config=require(_0xc37c('0x7'));var controller=require(_0xc37c('0x8'));router[_0xc37c('0x9')]('/',auth[_0xc37c('0xa')](),controller[_0xc37c('0xb')]);router[_0xc37c('0x9')](_0xc37c('0xc'),auth[_0xc37c('0xa')](),controller['show']);router[_0xc37c('0xd')]('/',auth[_0xc37c('0xa')](),controller[_0xc37c('0xe')]);router[_0xc37c('0xf')](_0xc37c('0xc'),auth['isAuthenticated'](),controller[_0xc37c('0x10')]);router[_0xc37c('0x11')](_0xc37c('0xc'),auth[_0xc37c('0xa')](),controller[_0xc37c('0x12')]);module[_0xc37c('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 39ee626..8a5d216 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 _0x7846=['exports','TEXT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7846,0xf4));var _0x6784=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0x7846[_0x5f12fd];return _0x58bd80;};'use strict';var Sequelize=require('sequelize');module[_0x6784('0x0')]={'tree':{'type':Sequelize[_0x6784('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd0b3=['TEXT'];(function(_0x2acd35,_0x2b21df){var _0x272693=function(_0x118994){while(--_0x118994){_0x2acd35['push'](_0x2acd35['shift']());}};_0x272693(++_0x2b21df);}(_0xd0b3,0x72));var _0x3d0b=function(_0x2a13a0,_0xd5efd6){_0x2a13a0=_0x2a13a0-0x0;var _0x402904=_0xd0b3[_0x2a13a0];return _0x402904;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x3d0b('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index f3004e8..8254a6e 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 _0xfd1a=['fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','destroy','then','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x4cec95,_0x276dfa){var _0x5a6c41=function(_0x3b818a){while(--_0x3b818a){_0x4cec95['push'](_0x4cec95['shift']());}};_0x5a6c41(++_0x276dfa);}(_0xfd1a,0x129));var _0xafd1=function(_0x279dfe,_0x39674f){_0x279dfe=_0x279dfe-0x0;var _0x569667=_0xfd1a[_0x279dfe];return _0x569667;};'use strict';var emlformat=require(_0xafd1('0x0'));var rimraf=require(_0xafd1('0x1'));var zipdir=require(_0xafd1('0x2'));var jsonpatch=require(_0xafd1('0x3'));var rp=require(_0xafd1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xafd1('0x5'));var util=require(_0xafd1('0x6'));var path=require('path');var sox=require(_0xafd1('0x7'));var csv=require(_0xafd1('0x8'));var ejs=require(_0xafd1('0x9'));var fs=require('fs');var fs_extra=require(_0xafd1('0xa'));var _=require(_0xafd1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xafd1('0xc'));var deskjs=require(_0xafd1('0xd'));var toCsv=require('to-csv');var querystring=require(_0xafd1('0xe'));var Papa=require(_0xafd1('0xf'));var Redis=require(_0xafd1('0x10'));var authService=require(_0xafd1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xafd1('0x12'));var hardwareService=require(_0xafd1('0x13'));var logger=require(_0xafd1('0x14'))(_0xafd1('0x15'));var utils=require(_0xafd1('0x16'));var config=require(_0xafd1('0x17'));var licenseUtil=require(_0xafd1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425ef8,_0xa6cf17){_0xa6cf17=_0xa6cf17||0xcc;return function(_0x14fe51){if(_0x14fe51){return _0x425ef8[_0xafd1('0x19')](_0xa6cf17);}return _0x425ef8[_0xafd1('0x1a')](_0xa6cf17)[_0xafd1('0x1b')]();};}function respondWithResult(_0x4a80e0,_0x212c23){_0x212c23=_0x212c23||0xc8;return function(_0x4d8134){if(_0x4d8134){return _0x4a80e0[_0xafd1('0x1a')](_0x212c23)['json'](_0x4d8134);}};}function respondWithFilteredResult(_0x205217,_0x3b8aea){return function(_0xcf5b13){if(_0xcf5b13){var _0x80df7f=typeof _0x3b8aea[_0xafd1('0x1c')]===_0xafd1('0x1d')&&typeof _0x3b8aea[_0xafd1('0x1e')]===_0xafd1('0x1d');var _0x3ca89f=_0xcf5b13[_0xafd1('0x1f')];var _0x42ab24=_0x80df7f?0x0:_0x3b8aea[_0xafd1('0x1c')];var _0x49e217=_0x80df7f?_0xcf5b13[_0xafd1('0x1f')]:_0x3b8aea[_0xafd1('0x1c')]+_0x3b8aea[_0xafd1('0x1e')];var _0x5c055f;if(_0x49e217>=_0x3ca89f){_0x49e217=_0x3ca89f;_0x5c055f=0xc8;}else{_0x5c055f=0xce;}_0x205217[_0xafd1('0x1a')](_0x5c055f);return _0x205217[_0xafd1('0x20')]('Content-Range',_0x42ab24+'-'+_0x49e217+'/'+_0x3ca89f)[_0xafd1('0x21')](_0xcf5b13);}return null;};}function patchUpdates(_0x23dbc4){return function(_0x2821d5){try{jsonpatch[_0xafd1('0x22')](_0x2821d5,_0x23dbc4,!![]);}catch(_0x4875d0){return BPromise[_0xafd1('0x23')](_0x4875d0);}return _0x2821d5['save']();};}function saveUpdates(_0x285a3c,_0x1640cf){return function(_0x3236c3){if(_0x3236c3){return _0x3236c3[_0xafd1('0x24')](_0x285a3c)['then'](function(_0x62b566){return _0x62b566;});}return null;};}function removeEntity(_0x3e0d2f,_0x49c5b7){return function(_0x161e4e){if(_0x161e4e){return _0x161e4e[_0xafd1('0x25')]()[_0xafd1('0x26')](function(){_0x3e0d2f[_0xafd1('0x1a')](0xcc)[_0xafd1('0x1b')]();});}};}function handleEntityNotFound(_0x5c0b21,_0x3c7ad6){return function(_0x3f1044){if(!_0x3f1044){_0x5c0b21['sendStatus'](0x194);}return _0x3f1044;};}function handleError(_0x7eaab4,_0x1d9550){_0x1d9550=_0x1d9550||0x1f4;return function(_0x32ed82){logger[_0xafd1('0x27')](_0x32ed82['stack']);if(_0x32ed82[_0xafd1('0x28')]){delete _0x32ed82['name'];}_0x7eaab4[_0xafd1('0x1a')](_0x1d9550)[_0xafd1('0x29')](_0x32ed82);};}exports[_0xafd1('0x2a')]=function(_0x42b689,_0x38ab36){var _0x3cbcc5={},_0x4a3338={},_0x53554e={'count':0x0,'rows':[]};var _0x3be47a=_[_0xafd1('0x2b')](db[_0xafd1('0x2c')][_0xafd1('0x2d')],function(_0x3f6bb6){return{'name':_0x3f6bb6[_0xafd1('0x2e')],'type':_0x3f6bb6[_0xafd1('0x2f')][_0xafd1('0x30')]};});_0x4a3338['model']=_['map'](_0x3be47a,_0xafd1('0x28'));_0x4a3338[_0xafd1('0x31')]=_[_0xafd1('0x32')](_0x42b689[_0xafd1('0x31')]);_0x4a3338['filters']=_[_0xafd1('0x33')](_0x4a3338[_0xafd1('0x34')],_0x4a3338['query']);_0x3cbcc5[_0xafd1('0x35')]=_[_0xafd1('0x33')](_0x4a3338['model'],qs[_0xafd1('0x36')](_0x42b689[_0xafd1('0x31')][_0xafd1('0x36')]));_0x3cbcc5[_0xafd1('0x35')]=_0x3cbcc5[_0xafd1('0x35')][_0xafd1('0x37')]?_0x3cbcc5[_0xafd1('0x35')]:_0x4a3338[_0xafd1('0x34')];if(!_0x42b689[_0xafd1('0x31')]['hasOwnProperty']('nolimit')){_0x3cbcc5['limit']=qs[_0xafd1('0x1e')](_0x42b689[_0xafd1('0x31')]['limit']);_0x3cbcc5[_0xafd1('0x1c')]=qs[_0xafd1('0x1c')](_0x42b689[_0xafd1('0x31')][_0xafd1('0x1c')]);}_0x3cbcc5[_0xafd1('0x38')]=qs[_0xafd1('0x39')](_0x42b689['query']['sort']);_0x3cbcc5[_0xafd1('0x3a')]=qs[_0xafd1('0x3b')](_[_0xafd1('0x3c')](_0x42b689[_0xafd1('0x31')],_0x4a3338['filters']),_0x3be47a);if(_0x42b689[_0xafd1('0x31')][_0xafd1('0x3d')]){_0x3cbcc5['where']=_[_0xafd1('0x3e')](_0x3cbcc5[_0xafd1('0x3a')],{'$or':_[_0xafd1('0x2b')](_0x3be47a,function(_0x1d89c3){if(_0x1d89c3[_0xafd1('0x2f')]!==_0xafd1('0x3f')){var _0x4fa6de={};_0x4fa6de[_0x1d89c3[_0xafd1('0x28')]]={'$like':'%'+_0x42b689['query']['filter']+'%'};return _0x4fa6de;}})});}_0x3cbcc5=_[_0xafd1('0x3e')]({},_0x3cbcc5,_0x42b689[_0xafd1('0x40')]);var _0x320b5b={'where':_0x3cbcc5['where']};return db[_0xafd1('0x2c')][_0xafd1('0x1f')](_0x320b5b)[_0xafd1('0x26')](function(_0x2c88f2){_0x53554e[_0xafd1('0x1f')]=_0x2c88f2;if(_0x42b689[_0xafd1('0x31')]['includeAll']){_0x3cbcc5[_0xafd1('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xafd1('0x42')](_0x3cbcc5);})[_0xafd1('0x26')](function(_0x27b1fa){_0x53554e[_0xafd1('0x43')]=_0x27b1fa;return _0x53554e;})[_0xafd1('0x26')](respondWithFilteredResult(_0x38ab36,_0x3cbcc5))[_0xafd1('0x44')](handleError(_0x38ab36,null));};exports[_0xafd1('0x45')]=function(_0x3c03b4,_0x9efb46){var _0x485b83={'raw':!![],'where':{'id':_0x3c03b4[_0xafd1('0x46')]['id']}},_0x47b5d3={};_0x47b5d3[_0xafd1('0x34')]=_[_0xafd1('0x32')](db[_0xafd1('0x2c')][_0xafd1('0x2d')]);_0x47b5d3[_0xafd1('0x31')]=_[_0xafd1('0x32')](_0x3c03b4[_0xafd1('0x31')]);_0x47b5d3['filters']=_[_0xafd1('0x33')](_0x47b5d3['model'],_0x47b5d3[_0xafd1('0x31')]);_0x485b83['attributes']=_[_0xafd1('0x33')](_0x47b5d3[_0xafd1('0x34')],qs['fields'](_0x3c03b4[_0xafd1('0x31')][_0xafd1('0x36')]));_0x485b83[_0xafd1('0x35')]=_0x485b83['attributes'][_0xafd1('0x37')]?_0x485b83[_0xafd1('0x35')]:_0x47b5d3['model'];if(_0x3c03b4[_0xafd1('0x31')][_0xafd1('0x47')]){_0x485b83['include']=[{'all':!![]}];}_0x485b83=_['merge']({},_0x485b83,_0x3c03b4[_0xafd1('0x40')]);return db['AnalyticTreeReport'][_0xafd1('0x48')](_0x485b83)[_0xafd1('0x26')](handleEntityNotFound(_0x9efb46,null))[_0xafd1('0x26')](respondWithResult(_0x9efb46,null))[_0xafd1('0x44')](handleError(_0x9efb46,null));};exports[_0xafd1('0x49')]=function(_0x4ccb45,_0x828524){return db[_0xafd1('0x2c')][_0xafd1('0x49')](_0x4ccb45['body'],{})[_0xafd1('0x26')](respondWithResult(_0x828524,0xc9))[_0xafd1('0x44')](handleError(_0x828524,null));};exports['update']=function(_0x2a05a0,_0x28d2e9){if(_0x2a05a0[_0xafd1('0x4a')]['id']){delete _0x2a05a0['body']['id'];}return db[_0xafd1('0x2c')][_0xafd1('0x48')]({'where':{'id':_0x2a05a0[_0xafd1('0x46')]['id']}})[_0xafd1('0x26')](handleEntityNotFound(_0x28d2e9,null))['then'](saveUpdates(_0x2a05a0['body'],null))['then'](respondWithResult(_0x28d2e9,null))[_0xafd1('0x44')](handleError(_0x28d2e9,null));};exports[_0xafd1('0x25')]=function(_0x14fd36,_0x27f3bf){return db[_0xafd1('0x2c')]['find']({'where':{'id':_0x14fd36[_0xafd1('0x46')]['id']}})['then'](handleEntityNotFound(_0x27f3bf,null))[_0xafd1('0x26')](removeEntity(_0x27f3bf,null))[_0xafd1('0x44')](handleError(_0x27f3bf,null));}; \ No newline at end of file +var _0x04e3=['query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','AnalyticTreeReport','includeAll','include','rows','rawAttributes','catch','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','type','key','model'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x04e3,0x1f3));var _0x304e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x04e3[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x304e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x304e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x304e('0x2'));var moment=require(_0x304e('0x3'));var BPromise=require(_0x304e('0x4'));var Mustache=require(_0x304e('0x5'));var util=require(_0x304e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x304e('0x7'));var ejs=require(_0x304e('0x8'));var fs=require('fs');var fs_extra=require(_0x304e('0x9'));var _=require(_0x304e('0xa'));var squel=require(_0x304e('0xb'));var crypto=require(_0x304e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x304e('0x7'));var querystring=require(_0x304e('0xd'));var Papa=require('papaparse');var Redis=require(_0x304e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x304e('0xf'));var as=require(_0x304e('0x10'));var hardwareService=require(_0x304e('0x11'));var logger=require('../../config/logger')(_0x304e('0x12'));var utils=require(_0x304e('0x13'));var config=require(_0x304e('0x14'));var licenseUtil=require(_0x304e('0x15'));var db=require(_0x304e('0x16'))['db'];function respondWithStatusCode(_0x5df4c3,_0x3626e3){_0x3626e3=_0x3626e3||0xcc;return function(_0xe44961){if(_0xe44961){return _0x5df4c3[_0x304e('0x17')](_0x3626e3);}return _0x5df4c3[_0x304e('0x18')](_0x3626e3)[_0x304e('0x19')]();};}function respondWithResult(_0x1828cd,_0x3601e9){_0x3601e9=_0x3601e9||0xc8;return function(_0x3f53e1){if(_0x3f53e1){return _0x1828cd['status'](_0x3601e9)[_0x304e('0x1a')](_0x3f53e1);}};}function respondWithFilteredResult(_0x6e95bd,_0x182390){return function(_0x23d13e){if(_0x23d13e){var _0x2f17b5=typeof _0x182390[_0x304e('0x1b')]===_0x304e('0x1c')&&typeof _0x182390[_0x304e('0x1d')]===_0x304e('0x1c');var _0x2c9284=_0x23d13e[_0x304e('0x1e')];var _0x6e5407=_0x2f17b5?0x0:_0x182390['offset'];var _0x8c6c28=_0x2f17b5?_0x23d13e[_0x304e('0x1e')]:_0x182390[_0x304e('0x1b')]+_0x182390[_0x304e('0x1d')];var _0x100ce3;if(_0x8c6c28>=_0x2c9284){_0x8c6c28=_0x2c9284;_0x100ce3=0xc8;}else{_0x100ce3=0xce;}_0x6e95bd[_0x304e('0x18')](_0x100ce3);return _0x6e95bd['set'](_0x304e('0x1f'),_0x6e5407+'-'+_0x8c6c28+'/'+_0x2c9284)[_0x304e('0x1a')](_0x23d13e);}return null;};}function patchUpdates(_0x583fd9){return function(_0x2c18e8){try{jsonpatch['apply'](_0x2c18e8,_0x583fd9,!![]);}catch(_0x54fc68){return BPromise[_0x304e('0x20')](_0x54fc68);}return _0x2c18e8[_0x304e('0x21')]();};}function saveUpdates(_0x6330b7,_0x1ee6b8){return function(_0x47a5e9){if(_0x47a5e9){return _0x47a5e9[_0x304e('0x22')](_0x6330b7)['then'](function(_0x5841b8){return _0x5841b8;});}return null;};}function removeEntity(_0x1abb0e,_0x1075d1){return function(_0x252400){if(_0x252400){return _0x252400[_0x304e('0x23')]()[_0x304e('0x24')](function(){_0x1abb0e[_0x304e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39214f,_0x123209){return function(_0x4c0134){if(!_0x4c0134){_0x39214f['sendStatus'](0x194);}return _0x4c0134;};}function handleError(_0x2473c4,_0x25c1cf){_0x25c1cf=_0x25c1cf||0x1f4;return function(_0x5c640e){logger[_0x304e('0x25')](_0x5c640e[_0x304e('0x26')]);if(_0x5c640e[_0x304e('0x27')]){delete _0x5c640e[_0x304e('0x27')];}_0x2473c4[_0x304e('0x18')](_0x25c1cf)['send'](_0x5c640e);};}exports[_0x304e('0x28')]=function(_0x2b5664,_0x1893f5){var _0x250773={},_0x4063da={},_0x4e5f97={'count':0x0,'rows':[]};var _0x19f7ab=_[_0x304e('0x29')](db['AnalyticTreeReport']['rawAttributes'],function(_0x40669f){return{'name':_0x40669f['fieldName'],'type':_0x40669f[_0x304e('0x2a')][_0x304e('0x2b')]};});_0x4063da[_0x304e('0x2c')]=_[_0x304e('0x29')](_0x19f7ab,_0x304e('0x27'));_0x4063da[_0x304e('0x2d')]=_[_0x304e('0x2e')](_0x2b5664[_0x304e('0x2d')]);_0x4063da[_0x304e('0x2f')]=_['intersection'](_0x4063da[_0x304e('0x2c')],_0x4063da['query']);_0x250773['attributes']=_[_0x304e('0x30')](_0x4063da[_0x304e('0x2c')],qs[_0x304e('0x31')](_0x2b5664[_0x304e('0x2d')][_0x304e('0x31')]));_0x250773[_0x304e('0x32')]=_0x250773[_0x304e('0x32')][_0x304e('0x33')]?_0x250773[_0x304e('0x32')]:_0x4063da[_0x304e('0x2c')];if(!_0x2b5664['query']['hasOwnProperty'](_0x304e('0x34'))){_0x250773[_0x304e('0x1d')]=qs[_0x304e('0x1d')](_0x2b5664[_0x304e('0x2d')][_0x304e('0x1d')]);_0x250773['offset']=qs[_0x304e('0x1b')](_0x2b5664['query'][_0x304e('0x1b')]);}_0x250773[_0x304e('0x35')]=qs[_0x304e('0x36')](_0x2b5664['query'][_0x304e('0x36')]);_0x250773['where']=qs['filters'](_['pick'](_0x2b5664[_0x304e('0x2d')],_0x4063da[_0x304e('0x2f')]),_0x19f7ab);if(_0x2b5664[_0x304e('0x2d')][_0x304e('0x37')]){_0x250773[_0x304e('0x38')]=_[_0x304e('0x39')](_0x250773[_0x304e('0x38')],{'$or':_[_0x304e('0x29')](_0x19f7ab,function(_0x329ab2){if(_0x329ab2['type']!==_0x304e('0x3a')){var _0x354fbd={};_0x354fbd[_0x329ab2[_0x304e('0x27')]]={'$like':'%'+_0x2b5664['query'][_0x304e('0x37')]+'%'};return _0x354fbd;}})});}_0x250773=_['merge']({},_0x250773,_0x2b5664['options']);var _0x722ce3={'where':_0x250773['where']};return db[_0x304e('0x3b')][_0x304e('0x1e')](_0x722ce3)[_0x304e('0x24')](function(_0x41aa5e){_0x4e5f97[_0x304e('0x1e')]=_0x41aa5e;if(_0x2b5664['query'][_0x304e('0x3c')]){_0x250773[_0x304e('0x3d')]=[{'all':!![]}];}return db[_0x304e('0x3b')]['findAll'](_0x250773);})['then'](function(_0x580810){_0x4e5f97[_0x304e('0x3e')]=_0x580810;return _0x4e5f97;})[_0x304e('0x24')](respondWithFilteredResult(_0x1893f5,_0x250773))['catch'](handleError(_0x1893f5,null));};exports['show']=function(_0x4568a7,_0x5711e5){var _0x43da7b={'raw':!![],'where':{'id':_0x4568a7['params']['id']}},_0x437256={};_0x437256[_0x304e('0x2c')]=_[_0x304e('0x2e')](db[_0x304e('0x3b')][_0x304e('0x3f')]);_0x437256['query']=_[_0x304e('0x2e')](_0x4568a7[_0x304e('0x2d')]);_0x437256['filters']=_[_0x304e('0x30')](_0x437256[_0x304e('0x2c')],_0x437256[_0x304e('0x2d')]);_0x43da7b['attributes']=_['intersection'](_0x437256[_0x304e('0x2c')],qs[_0x304e('0x31')](_0x4568a7['query'][_0x304e('0x31')]));_0x43da7b[_0x304e('0x32')]=_0x43da7b[_0x304e('0x32')][_0x304e('0x33')]?_0x43da7b[_0x304e('0x32')]:_0x437256[_0x304e('0x2c')];if(_0x4568a7[_0x304e('0x2d')][_0x304e('0x3c')]){_0x43da7b['include']=[{'all':!![]}];}_0x43da7b=_['merge']({},_0x43da7b,_0x4568a7['options']);return db[_0x304e('0x3b')]['find'](_0x43da7b)[_0x304e('0x24')](handleEntityNotFound(_0x5711e5,null))[_0x304e('0x24')](respondWithResult(_0x5711e5,null))['catch'](handleError(_0x5711e5,null));};exports['create']=function(_0x47c7f6,_0x498878){return db[_0x304e('0x3b')]['create'](_0x47c7f6['body'],{})[_0x304e('0x24')](respondWithResult(_0x498878,0xc9))[_0x304e('0x40')](handleError(_0x498878,null));};exports[_0x304e('0x22')]=function(_0x473385,_0x11e54f){if(_0x473385[_0x304e('0x41')]['id']){delete _0x473385['body']['id'];}return db[_0x304e('0x3b')][_0x304e('0x42')]({'where':{'id':_0x473385[_0x304e('0x43')]['id']}})[_0x304e('0x24')](handleEntityNotFound(_0x11e54f,null))[_0x304e('0x24')](saveUpdates(_0x473385[_0x304e('0x41')],null))[_0x304e('0x24')](respondWithResult(_0x11e54f,null))[_0x304e('0x40')](handleError(_0x11e54f,null));};exports[_0x304e('0x23')]=function(_0x37f9da,_0x15888c){return db[_0x304e('0x3b')]['find']({'where':{'id':_0x37f9da['params']['id']}})[_0x304e('0x24')](handleEntityNotFound(_0x15888c,null))[_0x304e('0x24')](removeEntity(_0x15888c,null))[_0x304e('0x40')](handleError(_0x15888c,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a35ecda..b0ecdb6 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 _0x6299=['../../config/environment','./analyticTreeReport.attributes','exports','define','util','moment','bluebird','request-promise'];(function(_0x1069f5,_0x51cc78){var _0x5c211d=function(_0x1d527f){while(--_0x1d527f){_0x1069f5['push'](_0x1069f5['shift']());}};_0x5c211d(++_0x51cc78);}(_0x6299,0x64));var _0x9629=function(_0x30946f,_0x13e356){_0x30946f=_0x30946f-0x0;var _0x2d3b5f=_0x6299[_0x30946f];return _0x2d3b5f;};'use strict';var _=require('lodash');var util=require(_0x9629('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9629('0x1'));var BPromise=require(_0x9629('0x2'));var rp=require(_0x9629('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9629('0x4'));var attributes=require(_0x9629('0x5'));module[_0x9629('0x6')]=function(_0x4daf4c,_0x46da4a){return _0x4daf4c[_0x9629('0x7')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdee3=['./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','bluebird','request-promise','path','../../config/environment'];(function(_0x370029,_0x2af65){var _0x10edf3=function(_0xa8bff3){while(--_0xa8bff3){_0x370029['push'](_0x370029['shift']());}};_0x10edf3(++_0x2af65);}(_0xdee3,0x1f1));var _0x3dee=function(_0x89cf15,_0x4a995a){_0x89cf15=_0x89cf15-0x0;var _0x4e3b4d=_0xdee3[_0x89cf15];return _0x4e3b4d;};'use strict';var _=require(_0x3dee('0x0'));var util=require(_0x3dee('0x1'));var logger=require('../../config/logger')(_0x3dee('0x2'));var moment=require('moment');var BPromise=require(_0x3dee('0x3'));var rp=require(_0x3dee('0x4'));var fs=require('fs');var path=require(_0x3dee('0x5'));var rimraf=require('rimraf');var config=require(_0x3dee('0x6'));var attributes=require(_0x3dee('0x7'));module[_0x3dee('0x8')]=function(_0x5ed576,_0x361d89){return _0x5ed576[_0x3dee('0x9')](_0x3dee('0xa'),attributes,{'tableName':_0x3dee('0xb'),'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 4a063cd..9f2f0a8 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x58bf7c,_0x1ab137){var _0x292f7f=function(_0x20a4d5){while(--_0x20a4d5){_0x58bf7c['push'](_0x58bf7c['shift']());}};_0x292f7f(++_0x1ab137);}(_0x2ef3,0xba));var _0x32ef=function(_0x55d63a,_0x4cc997){_0x55d63a=_0x55d63a-0x0;var _0xd2f439=_0x2ef3[_0x55d63a];return _0xd2f439;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a081b,_0x516437){var _0xb166c4=function(_0x22bc5d){while(--_0x22bc5d){_0x3a081b['push'](_0x3a081b['shift']());}};_0xb166c4(++_0x516437);}(_0xadb5,0xad));var _0x5adb=function(_0xd29296,_0xaacaa){_0xd29296=_0xd29296-0x0;var _0x582a2d=_0xadb5[_0xd29296];return _0x582a2d;};'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']('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index ded256e..a0fdcd0 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 _0xa0bb=['../../config/environment','./analyticTreeReport.controller','get','index','isAuthenticated','create','put','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3d0fa4,_0x18be0f){var _0x34178c=function(_0x55209c){while(--_0x55209c){_0x3d0fa4['push'](_0x3d0fa4['shift']());}};_0x34178c(++_0x18be0f);}(_0xa0bb,0x190));var _0xba0b=function(_0x3d5103,_0x524622){_0x3d5103=_0x3d5103-0x0;var _0x5b98d5=_0xa0bb[_0x3d5103];return _0x5b98d5;};'use strict';var multer=require(_0xba0b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba0b('0x1'));var express=require(_0xba0b('0x2'));var router=express['Router']();var fs_extra=require(_0xba0b('0x3'));var auth=require(_0xba0b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xba0b('0x5'));var controller=require(_0xba0b('0x6'));router[_0xba0b('0x7')]('/',auth['isAuthenticated'](),controller[_0xba0b('0x8')]);router[_0xba0b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xba0b('0x9')](),controller[_0xba0b('0xa')]);router[_0xba0b('0xb')]('/:id',auth[_0xba0b('0x9')](),controller[_0xba0b('0xc')]);router[_0xba0b('0xd')]('/:id',auth[_0xba0b('0x9')](),controller[_0xba0b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5901=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','create','put','destroy'];(function(_0x954692,_0x47d1b8){var _0x5062d3=function(_0x35e718){while(--_0x35e718){_0x954692['push'](_0x954692['shift']());}};_0x5062d3(++_0x47d1b8);}(_0x5901,0x121));var _0x1590=function(_0x30e72d,_0x4c82e6){_0x30e72d=_0x30e72d-0x0;var _0x26091b=_0x5901[_0x30e72d];return _0x26091b;};'use strict';var multer=require(_0x1590('0x0'));var util=require(_0x1590('0x1'));var path=require(_0x1590('0x2'));var timeout=require(_0x1590('0x3'));var express=require(_0x1590('0x4'));var router=express[_0x1590('0x5')]();var fs_extra=require(_0x1590('0x6'));var auth=require(_0x1590('0x7'));var interaction=require(_0x1590('0x8'));var config=require(_0x1590('0x9'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x1590('0xa')](),controller['index']);router[_0x1590('0xb')](_0x1590('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1590('0xd')]('/',auth['isAuthenticated'](),controller[_0x1590('0xe')]);router[_0x1590('0xf')](_0x1590('0xc'),auth[_0x1590('0xa')](),controller['update']);router['delete'](_0x1590('0xc'),auth[_0x1590('0xa')](),controller[_0x1590('0x10')]);module[_0x1590('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 4d8e813..80ce84a 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 _0x8ce3=['sequelize','exports','STRING'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x8ce3,0xc3));var _0x38ce=function(_0x56a020,_0x3065c6){_0x56a020=_0x56a020-0x0;var _0xc4220c=_0x8ce3[_0x56a020];return _0xc4220c;};'use strict';var Sequelize=require(_0x38ce('0x0'));module[_0x38ce('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x38ce('0x2')]},'type':{'type':Sequelize[_0x38ce('0x2')]}}; \ No newline at end of file +var _0x6726=['STRING','exports'];(function(_0x1133c1,_0x32ba1d){var _0x4e1438=function(_0x5082a6){while(--_0x5082a6){_0x1133c1['push'](_0x1133c1['shift']());}};_0x4e1438(++_0x32ba1d);}(_0x6726,0xdb));var _0x6672=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x6726[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require('sequelize');module[_0x6672('0x0')]={'name':{'type':Sequelize[_0x6672('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6672('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 44a7485..6f77713 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 _0xca45=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Attachment','rawAttributes','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','clone','params','get','omit','createdAt','updatedAt','body','create','file','originalname','filename','mimetype','join','root','server/files/attachments/','download','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined'];(function(_0x4ee57e,_0x11bba0){var _0x1daf30=function(_0x52b45d){while(--_0x52b45d){_0x4ee57e['push'](_0x4ee57e['shift']());}};_0x1daf30(++_0x11bba0);}(_0xca45,0x92));var _0x5ca4=function(_0x5c1de9,_0x16b37a){_0x5c1de9=_0x5c1de9-0x0;var _0x452529=_0xca45[_0x5c1de9];return _0x452529;};'use strict';var emlformat=require(_0x5ca4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ca4('0x1'));var moment=require(_0x5ca4('0x2'));var BPromise=require(_0x5ca4('0x3'));var Mustache=require('mustache');var util=require(_0x5ca4('0x4'));var path=require(_0x5ca4('0x5'));var sox=require(_0x5ca4('0x6'));var csv=require(_0x5ca4('0x7'));var ejs=require(_0x5ca4('0x8'));var fs=require('fs');var fs_extra=require(_0x5ca4('0x9'));var _=require('lodash');var squel=require(_0x5ca4('0xa'));var crypto=require(_0x5ca4('0xb'));var jsforce=require(_0x5ca4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5ca4('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ca4('0xd'));var authService=require(_0x5ca4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ca4('0xf'));var logger=require(_0x5ca4('0x10'))(_0x5ca4('0x11'));var utils=require(_0x5ca4('0x12'));var config=require(_0x5ca4('0x13'));var licenseUtil=require(_0x5ca4('0x14'));var db=require(_0x5ca4('0x15'))['db'];function respondWithStatusCode(_0x320338,_0x29c5f9){_0x29c5f9=_0x29c5f9||0xcc;return function(_0x591970){if(_0x591970){return _0x320338[_0x5ca4('0x16')](_0x29c5f9);}return _0x320338['status'](_0x29c5f9)[_0x5ca4('0x17')]();};}function respondWithResult(_0x515fb1,_0x2ca85e){_0x2ca85e=_0x2ca85e||0xc8;return function(_0x55357c){if(_0x55357c){return _0x515fb1[_0x5ca4('0x18')](_0x2ca85e)[_0x5ca4('0x19')](_0x55357c);}};}function respondWithFilteredResult(_0xcdf7b1,_0x52cb5d){return function(_0x56a6c0){if(_0x56a6c0){var _0x5ad14c=typeof _0x52cb5d[_0x5ca4('0x1a')]===_0x5ca4('0x1b')&&typeof _0x52cb5d[_0x5ca4('0x1c')]===_0x5ca4('0x1b');var _0x484e3c=_0x56a6c0[_0x5ca4('0x1d')];var _0x54ee18=_0x5ad14c?0x0:_0x52cb5d[_0x5ca4('0x1a')];var _0xa2f539=_0x5ad14c?_0x56a6c0[_0x5ca4('0x1d')]:_0x52cb5d[_0x5ca4('0x1a')]+_0x52cb5d[_0x5ca4('0x1c')];var _0x4fa7ec;if(_0xa2f539>=_0x484e3c){_0xa2f539=_0x484e3c;_0x4fa7ec=0xc8;}else{_0x4fa7ec=0xce;}_0xcdf7b1[_0x5ca4('0x18')](_0x4fa7ec);return _0xcdf7b1[_0x5ca4('0x1e')](_0x5ca4('0x1f'),_0x54ee18+'-'+_0xa2f539+'/'+_0x484e3c)[_0x5ca4('0x19')](_0x56a6c0);}return null;};}function patchUpdates(_0x4d697e){return function(_0x133b50){try{jsonpatch[_0x5ca4('0x20')](_0x133b50,_0x4d697e,!![]);}catch(_0x3504e3){return BPromise[_0x5ca4('0x21')](_0x3504e3);}return _0x133b50[_0x5ca4('0x22')]();};}function saveUpdates(_0x4c01c9,_0x8c7a96){return function(_0x59a25a){if(_0x59a25a){return _0x59a25a[_0x5ca4('0x23')](_0x4c01c9)[_0x5ca4('0x24')](function(_0x377ae0){return _0x377ae0;});}return null;};}function removeEntity(_0x355fa3,_0x26e05f){return function(_0x35aa12){if(_0x35aa12){return _0x35aa12[_0x5ca4('0x25')]()['then'](function(){_0x355fa3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x338fc3,_0x1e2edf){return function(_0x37e846){if(!_0x37e846){_0x338fc3['sendStatus'](0x194);}return _0x37e846;};}function handleError(_0xe8d0d1,_0x35d405){_0x35d405=_0x35d405||0x1f4;return function(_0x4f4b76){logger[_0x5ca4('0x26')](_0x4f4b76[_0x5ca4('0x27')]);if(_0x4f4b76['name']){delete _0x4f4b76[_0x5ca4('0x28')];}_0xe8d0d1['status'](_0x35d405)['send'](_0x4f4b76);};}exports[_0x5ca4('0x29')]=function(_0x240151,_0xd0b574){var _0x39d1dc={},_0x541fe3={},_0x1eeb39={'count':0x0,'rows':[]};var _0x5feff5=_['map'](db[_0x5ca4('0x2a')][_0x5ca4('0x2b')],function(_0x595213){return{'name':_0x595213['fieldName'],'type':_0x595213['type'][_0x5ca4('0x2c')]};});_0x541fe3['model']=_[_0x5ca4('0x2d')](_0x5feff5,_0x5ca4('0x28'));_0x541fe3[_0x5ca4('0x2e')]=_[_0x5ca4('0x2f')](_0x240151[_0x5ca4('0x2e')]);_0x541fe3[_0x5ca4('0x30')]=_[_0x5ca4('0x31')](_0x541fe3['model'],_0x541fe3[_0x5ca4('0x2e')]);_0x39d1dc[_0x5ca4('0x32')]=_[_0x5ca4('0x31')](_0x541fe3[_0x5ca4('0x33')],qs[_0x5ca4('0x34')](_0x240151[_0x5ca4('0x2e')]['fields']));_0x39d1dc[_0x5ca4('0x32')]=_0x39d1dc['attributes'][_0x5ca4('0x35')]?_0x39d1dc[_0x5ca4('0x32')]:_0x541fe3[_0x5ca4('0x33')];if(!_0x240151[_0x5ca4('0x2e')][_0x5ca4('0x36')](_0x5ca4('0x37'))){_0x39d1dc['limit']=qs[_0x5ca4('0x1c')](_0x240151['query'][_0x5ca4('0x1c')]);_0x39d1dc[_0x5ca4('0x1a')]=qs[_0x5ca4('0x1a')](_0x240151[_0x5ca4('0x2e')][_0x5ca4('0x1a')]);}_0x39d1dc[_0x5ca4('0x38')]=qs['sort'](_0x240151[_0x5ca4('0x2e')][_0x5ca4('0x39')]);_0x39d1dc['where']=qs[_0x5ca4('0x30')](_[_0x5ca4('0x3a')](_0x240151['query'],_0x541fe3[_0x5ca4('0x30')]),_0x5feff5);if(_0x240151[_0x5ca4('0x2e')]['filter']){_0x39d1dc['where']=_['merge'](_0x39d1dc[_0x5ca4('0x3b')],{'$or':_[_0x5ca4('0x2d')](_0x5feff5,function(_0x5ed023){if(_0x5ed023[_0x5ca4('0x3c')]!==_0x5ca4('0x3d')){var _0x1f5440={};_0x1f5440[_0x5ed023[_0x5ca4('0x28')]]={'$like':'%'+_0x240151['query']['filter']+'%'};return _0x1f5440;}})});}_0x39d1dc=_[_0x5ca4('0x3e')]({},_0x39d1dc,_0x240151[_0x5ca4('0x3f')]);var _0x4c5bdf={'where':_0x39d1dc[_0x5ca4('0x3b')]};return db[_0x5ca4('0x2a')]['count'](_0x4c5bdf)[_0x5ca4('0x24')](function(_0x2ad100){_0x1eeb39[_0x5ca4('0x1d')]=_0x2ad100;if(_0x240151['query'][_0x5ca4('0x40')]){_0x39d1dc[_0x5ca4('0x41')]=[{'all':!![]}];}return db[_0x5ca4('0x2a')][_0x5ca4('0x42')](_0x39d1dc);})['then'](function(_0x58213b){_0x1eeb39[_0x5ca4('0x43')]=_0x58213b;return _0x1eeb39;})[_0x5ca4('0x24')](respondWithFilteredResult(_0xd0b574,_0x39d1dc))[_0x5ca4('0x44')](handleError(_0xd0b574,null));};exports[_0x5ca4('0x45')]=function(_0x4ac9c1,_0x301769){var _0x5cb3fa={'raw':!![],'where':{'id':_0x4ac9c1['params']['id']}},_0x497a5d={};_0x497a5d['model']=_['keys'](db[_0x5ca4('0x2a')][_0x5ca4('0x2b')]);_0x497a5d[_0x5ca4('0x2e')]=_[_0x5ca4('0x2f')](_0x4ac9c1[_0x5ca4('0x2e')]);_0x497a5d['filters']=_['intersection'](_0x497a5d[_0x5ca4('0x33')],_0x497a5d[_0x5ca4('0x2e')]);_0x5cb3fa[_0x5ca4('0x32')]=_[_0x5ca4('0x31')](_0x497a5d[_0x5ca4('0x33')],qs[_0x5ca4('0x34')](_0x4ac9c1[_0x5ca4('0x2e')][_0x5ca4('0x34')]));_0x5cb3fa['attributes']=_0x5cb3fa[_0x5ca4('0x32')]['length']?_0x5cb3fa[_0x5ca4('0x32')]:_0x497a5d['model'];if(_0x4ac9c1[_0x5ca4('0x2e')]['includeAll']){_0x5cb3fa[_0x5ca4('0x41')]=[{'all':!![]}];}_0x5cb3fa=_['merge']({},_0x5cb3fa,_0x4ac9c1['options']);return db[_0x5ca4('0x2a')][_0x5ca4('0x46')](_0x5cb3fa)['then'](handleEntityNotFound(_0x301769,null))[_0x5ca4('0x24')](respondWithResult(_0x301769,null))[_0x5ca4('0x44')](handleError(_0x301769,null));};exports[_0x5ca4('0x47')]=function(_0xcc1697,_0x256946){var _0x28aea2={'where':{'id':_0xcc1697[_0x5ca4('0x48')]['id']}},_0x5733={};_0x5733[_0x5ca4('0x33')]=_['keys'](db['Attachment'][_0x5ca4('0x2b')]);_0x28aea2[_0x5ca4('0x32')]=_[_0x5ca4('0x31')](_0x5733[_0x5ca4('0x33')],qs[_0x5ca4('0x34')](_0xcc1697[_0x5ca4('0x2e')]['fields']));_0x28aea2[_0x5ca4('0x32')]=_0x28aea2[_0x5ca4('0x32')][_0x5ca4('0x35')]?_0x28aea2[_0x5ca4('0x32')]:_0x5733['model'];if(_0xcc1697[_0x5ca4('0x2e')][_0x5ca4('0x40')]){_0x28aea2[_0x5ca4('0x41')]=[{'all':!![]}];}_0x28aea2=_['merge']({},_0x28aea2,_0xcc1697[_0x5ca4('0x3f')]);return db[_0x5ca4('0x2a')][_0x5ca4('0x46')](_0x28aea2)[_0x5ca4('0x24')](handleEntityNotFound(_0x256946,null))[_0x5ca4('0x24')](function(_0x42ba25){if(_0x42ba25){var _0x228b35=_0x42ba25[_0x5ca4('0x49')]({'plain':!![]});_0x228b35=qs[_0x5ca4('0x4a')](_0x228b35,['id',_0x5ca4('0x4b'),_0x5ca4('0x4c')]);_0xcc1697[_0x5ca4('0x4d')]=_[_0x5ca4('0x4a')](_0xcc1697[_0x5ca4('0x4d')],['id','createdAt','updatedAt']);return db[_0x5ca4('0x2a')][_0x5ca4('0x4e')](_[_0x5ca4('0x3e')](_0x228b35,_0xcc1697[_0x5ca4('0x4d')]),{'include':_0xcc1697[_0x5ca4('0x2e')][_0x5ca4('0x40')]?[{'all':!![]}]:undefined});}})[_0x5ca4('0x24')](respondWithResult(_0x256946,0xc9))[_0x5ca4('0x44')](handleError(_0x256946,null));};exports['update']=function(_0x495fc8,_0x58980d){if(_0x495fc8[_0x5ca4('0x4d')]['id']){delete _0x495fc8[_0x5ca4('0x4d')]['id'];}return db[_0x5ca4('0x2a')]['find']({'where':{'id':_0x495fc8[_0x5ca4('0x48')]['id']}})['then'](handleEntityNotFound(_0x58980d,null))['then'](saveUpdates(_0x495fc8[_0x5ca4('0x4d')],null))['then'](respondWithResult(_0x58980d,null))[_0x5ca4('0x44')](handleError(_0x58980d,null));};exports['destroy']=function(_0x4b0f4e,_0x1dbbf9){return db[_0x5ca4('0x2a')][_0x5ca4('0x46')]({'where':{'id':_0x4b0f4e[_0x5ca4('0x48')]['id']}})[_0x5ca4('0x24')](handleEntityNotFound(_0x1dbbf9,null))['then'](removeEntity(_0x1dbbf9,null))[_0x5ca4('0x44')](handleError(_0x1dbbf9,null));};exports[_0x5ca4('0x4e')]=function(_0xa054ac,_0x19d84f,_0xace4bf){_0xa054ac[_0x5ca4('0x4d')][_0x5ca4('0x28')]=_0xa054ac[_0x5ca4('0x4f')][_0x5ca4('0x50')];_0xa054ac[_0x5ca4('0x4d')]['basename']=_0xa054ac[_0x5ca4('0x4f')][_0x5ca4('0x51')];_0xa054ac[_0x5ca4('0x4d')][_0x5ca4('0x3c')]=_0xa054ac[_0x5ca4('0x4f')][_0x5ca4('0x52')];return db['Attachment'][_0x5ca4('0x4e')](_0xa054ac[_0x5ca4('0x4d')])[_0x5ca4('0x24')](respondWithResult(_0x19d84f,0xc9))[_0x5ca4('0x44')](handleError(_0x19d84f,null));};exports['download']=function(_0x2ffab2,_0x5f49a0,_0x3681e3){return db[_0x5ca4('0x2a')]['findOne']({'where':{'id':_0x2ffab2['params']['id']},'raw':!![]})[_0x5ca4('0x24')](handleEntityNotFound(_0x5f49a0,null))['then'](function(_0x2ca35a){if(_0x2ca35a){var _0x302ed1=_0x2ca35a['ChatOfflineMessageId']!==null;var _0x2e8f14=path[_0x5ca4('0x53')](config[_0x5ca4('0x54')],_0x5ca4('0x55'));if(_0x302ed1){_0x2e8f14=path[_0x5ca4('0x53')](_0x2e8f14,'offline-chat/');}var _0x4d460d=path['join'](_0x2e8f14,_0x2ca35a['basename']);return _0x5f49a0[_0x5ca4('0x56')](_0x4d460d);}})['catch'](handleError(_0x5f49a0,null));}; \ No newline at end of file +var _0xc870=['keys','length','get','omit','updatedAt','body','createdAt','create','find','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','set','save','update','then','destroy','end','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0xc870,0x126));var _0x0c87=function(_0x258e35,_0x58bea0){_0x258e35=_0x258e35-0x0;var _0x1b7570=_0xc870[_0x258e35];return _0x1b7570;};'use strict';var emlformat=require(_0x0c87('0x0'));var rimraf=require(_0x0c87('0x1'));var zipdir=require(_0x0c87('0x2'));var jsonpatch=require(_0x0c87('0x3'));var rp=require(_0x0c87('0x4'));var moment=require('moment');var BPromise=require(_0x0c87('0x5'));var Mustache=require(_0x0c87('0x6'));var util=require(_0x0c87('0x7'));var path=require(_0x0c87('0x8'));var sox=require(_0x0c87('0x9'));var csv=require('to-csv');var ejs=require(_0x0c87('0xa'));var fs=require('fs');var fs_extra=require(_0x0c87('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c87('0xc'));var jsforce=require(_0x0c87('0xd'));var deskjs=require(_0x0c87('0xe'));var toCsv=require(_0x0c87('0xf'));var querystring=require(_0x0c87('0x10'));var Papa=require(_0x0c87('0x11'));var Redis=require(_0x0c87('0x12'));var authService=require(_0x0c87('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0c87('0x14'));var hardwareService=require(_0x0c87('0x15'));var logger=require('../../config/logger')(_0x0c87('0x16'));var utils=require(_0x0c87('0x17'));var config=require(_0x0c87('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194de6,_0x3fc328){_0x3fc328=_0x3fc328||0xcc;return function(_0x35d846){if(_0x35d846){return _0x194de6[_0x0c87('0x19')](_0x3fc328);}return _0x194de6[_0x0c87('0x1a')](_0x3fc328)['end']();};}function respondWithResult(_0x5a1cb9,_0x3c08cc){_0x3c08cc=_0x3c08cc||0xc8;return function(_0x43ad28){if(_0x43ad28){return _0x5a1cb9[_0x0c87('0x1a')](_0x3c08cc)[_0x0c87('0x1b')](_0x43ad28);}};}function respondWithFilteredResult(_0x5b4067,_0x1e2831){return function(_0x2f4e0a){if(_0x2f4e0a){var _0x49ce54=typeof _0x1e2831['offset']==='undefined'&&typeof _0x1e2831[_0x0c87('0x1c')]===_0x0c87('0x1d');var _0x3fa02b=_0x2f4e0a['count'];var _0x1bac20=_0x49ce54?0x0:_0x1e2831['offset'];var _0x2a076e=_0x49ce54?_0x2f4e0a[_0x0c87('0x1e')]:_0x1e2831[_0x0c87('0x1f')]+_0x1e2831['limit'];var _0x42890f;if(_0x2a076e>=_0x3fa02b){_0x2a076e=_0x3fa02b;_0x42890f=0xc8;}else{_0x42890f=0xce;}_0x5b4067[_0x0c87('0x1a')](_0x42890f);return _0x5b4067[_0x0c87('0x20')]('Content-Range',_0x1bac20+'-'+_0x2a076e+'/'+_0x3fa02b)[_0x0c87('0x1b')](_0x2f4e0a);}return null;};}function patchUpdates(_0xbb582d){return function(_0x52d1c7){try{jsonpatch['apply'](_0x52d1c7,_0xbb582d,!![]);}catch(_0x5c0013){return BPromise['reject'](_0x5c0013);}return _0x52d1c7[_0x0c87('0x21')]();};}function saveUpdates(_0x3fd628,_0x3f9c1b){return function(_0x22e8ad){if(_0x22e8ad){return _0x22e8ad[_0x0c87('0x22')](_0x3fd628)[_0x0c87('0x23')](function(_0x55e04b){return _0x55e04b;});}return null;};}function removeEntity(_0xf138c3,_0xec9606){return function(_0x2ff3a3){if(_0x2ff3a3){return _0x2ff3a3[_0x0c87('0x24')]()[_0x0c87('0x23')](function(){_0xf138c3['status'](0xcc)[_0x0c87('0x25')]();});}};}function handleEntityNotFound(_0x220d89,_0x4d571c){return function(_0x3a48cf){if(!_0x3a48cf){_0x220d89['sendStatus'](0x194);}return _0x3a48cf;};}function handleError(_0x52c8ed,_0x403a8c){_0x403a8c=_0x403a8c||0x1f4;return function(_0x148286){logger[_0x0c87('0x26')](_0x148286[_0x0c87('0x27')]);if(_0x148286[_0x0c87('0x28')]){delete _0x148286[_0x0c87('0x28')];}_0x52c8ed['status'](_0x403a8c)[_0x0c87('0x29')](_0x148286);};}exports[_0x0c87('0x2a')]=function(_0x8a472b,_0x1dd832){var _0x5bd838={},_0x3bbff2={},_0x7f8f5f={'count':0x0,'rows':[]};var _0x49544c=_[_0x0c87('0x2b')](db[_0x0c87('0x2c')][_0x0c87('0x2d')],function(_0x1c1e9b){return{'name':_0x1c1e9b['fieldName'],'type':_0x1c1e9b[_0x0c87('0x2e')][_0x0c87('0x2f')]};});_0x3bbff2[_0x0c87('0x30')]=_[_0x0c87('0x2b')](_0x49544c,_0x0c87('0x28'));_0x3bbff2[_0x0c87('0x31')]=_['keys'](_0x8a472b[_0x0c87('0x31')]);_0x3bbff2[_0x0c87('0x32')]=_[_0x0c87('0x33')](_0x3bbff2[_0x0c87('0x30')],_0x3bbff2['query']);_0x5bd838[_0x0c87('0x34')]=_['intersection'](_0x3bbff2[_0x0c87('0x30')],qs[_0x0c87('0x35')](_0x8a472b[_0x0c87('0x31')][_0x0c87('0x35')]));_0x5bd838[_0x0c87('0x34')]=_0x5bd838['attributes']['length']?_0x5bd838[_0x0c87('0x34')]:_0x3bbff2['model'];if(!_0x8a472b[_0x0c87('0x31')][_0x0c87('0x36')](_0x0c87('0x37'))){_0x5bd838['limit']=qs[_0x0c87('0x1c')](_0x8a472b[_0x0c87('0x31')][_0x0c87('0x1c')]);_0x5bd838['offset']=qs['offset'](_0x8a472b[_0x0c87('0x31')]['offset']);}_0x5bd838[_0x0c87('0x38')]=qs['sort'](_0x8a472b[_0x0c87('0x31')][_0x0c87('0x39')]);_0x5bd838['where']=qs[_0x0c87('0x32')](_[_0x0c87('0x3a')](_0x8a472b['query'],_0x3bbff2[_0x0c87('0x32')]),_0x49544c);if(_0x8a472b[_0x0c87('0x31')]['filter']){_0x5bd838[_0x0c87('0x3b')]=_['merge'](_0x5bd838[_0x0c87('0x3b')],{'$or':_['map'](_0x49544c,function(_0x5b0208){if(_0x5b0208[_0x0c87('0x2e')]!==_0x0c87('0x3c')){var _0x19da29={};_0x19da29[_0x5b0208[_0x0c87('0x28')]]={'$like':'%'+_0x8a472b[_0x0c87('0x31')][_0x0c87('0x3d')]+'%'};return _0x19da29;}})});}_0x5bd838=_[_0x0c87('0x3e')]({},_0x5bd838,_0x8a472b[_0x0c87('0x3f')]);var _0x2e7329={'where':_0x5bd838['where']};return db[_0x0c87('0x2c')]['count'](_0x2e7329)[_0x0c87('0x23')](function(_0x21fdf0){_0x7f8f5f[_0x0c87('0x1e')]=_0x21fdf0;if(_0x8a472b['query'][_0x0c87('0x40')]){_0x5bd838[_0x0c87('0x41')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x5bd838);})[_0x0c87('0x23')](function(_0x58d869){_0x7f8f5f[_0x0c87('0x42')]=_0x58d869;return _0x7f8f5f;})[_0x0c87('0x23')](respondWithFilteredResult(_0x1dd832,_0x5bd838))[_0x0c87('0x43')](handleError(_0x1dd832,null));};exports[_0x0c87('0x44')]=function(_0xe0a3a5,_0x26b0c7){var _0x4a2e0f={'raw':!![],'where':{'id':_0xe0a3a5[_0x0c87('0x45')]['id']}},_0x1172fd={};_0x1172fd['model']=_[_0x0c87('0x46')](db[_0x0c87('0x2c')]['rawAttributes']);_0x1172fd[_0x0c87('0x31')]=_[_0x0c87('0x46')](_0xe0a3a5[_0x0c87('0x31')]);_0x1172fd[_0x0c87('0x32')]=_[_0x0c87('0x33')](_0x1172fd[_0x0c87('0x30')],_0x1172fd['query']);_0x4a2e0f[_0x0c87('0x34')]=_[_0x0c87('0x33')](_0x1172fd[_0x0c87('0x30')],qs[_0x0c87('0x35')](_0xe0a3a5[_0x0c87('0x31')][_0x0c87('0x35')]));_0x4a2e0f[_0x0c87('0x34')]=_0x4a2e0f[_0x0c87('0x34')][_0x0c87('0x47')]?_0x4a2e0f[_0x0c87('0x34')]:_0x1172fd[_0x0c87('0x30')];if(_0xe0a3a5[_0x0c87('0x31')][_0x0c87('0x40')]){_0x4a2e0f[_0x0c87('0x41')]=[{'all':!![]}];}_0x4a2e0f=_[_0x0c87('0x3e')]({},_0x4a2e0f,_0xe0a3a5[_0x0c87('0x3f')]);return db[_0x0c87('0x2c')]['find'](_0x4a2e0f)[_0x0c87('0x23')](handleEntityNotFound(_0x26b0c7,null))[_0x0c87('0x23')](respondWithResult(_0x26b0c7,null))[_0x0c87('0x43')](handleError(_0x26b0c7,null));};exports['clone']=function(_0x391cc8,_0x10de61){var _0x44a975={'where':{'id':_0x391cc8[_0x0c87('0x45')]['id']}},_0x2eb1b1={};_0x2eb1b1[_0x0c87('0x30')]=_[_0x0c87('0x46')](db[_0x0c87('0x2c')][_0x0c87('0x2d')]);_0x44a975[_0x0c87('0x34')]=_[_0x0c87('0x33')](_0x2eb1b1['model'],qs[_0x0c87('0x35')](_0x391cc8[_0x0c87('0x31')][_0x0c87('0x35')]));_0x44a975[_0x0c87('0x34')]=_0x44a975[_0x0c87('0x34')][_0x0c87('0x47')]?_0x44a975[_0x0c87('0x34')]:_0x2eb1b1[_0x0c87('0x30')];if(_0x391cc8[_0x0c87('0x31')]['includeAll']){_0x44a975[_0x0c87('0x41')]=[{'all':!![]}];}_0x44a975=_['merge']({},_0x44a975,_0x391cc8[_0x0c87('0x3f')]);return db['Attachment']['find'](_0x44a975)['then'](handleEntityNotFound(_0x10de61,null))[_0x0c87('0x23')](function(_0x4bcfd0){if(_0x4bcfd0){var _0x56bb18=_0x4bcfd0[_0x0c87('0x48')]({'plain':!![]});_0x56bb18=qs[_0x0c87('0x49')](_0x56bb18,['id','createdAt',_0x0c87('0x4a')]);_0x391cc8[_0x0c87('0x4b')]=_['omit'](_0x391cc8['body'],['id',_0x0c87('0x4c'),_0x0c87('0x4a')]);return db[_0x0c87('0x2c')][_0x0c87('0x4d')](_[_0x0c87('0x3e')](_0x56bb18,_0x391cc8['body']),{'include':_0x391cc8['query']['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x10de61,0xc9))[_0x0c87('0x43')](handleError(_0x10de61,null));};exports[_0x0c87('0x22')]=function(_0xe14ba,_0x53b6ca){if(_0xe14ba[_0x0c87('0x4b')]['id']){delete _0xe14ba['body']['id'];}return db[_0x0c87('0x2c')][_0x0c87('0x4e')]({'where':{'id':_0xe14ba[_0x0c87('0x45')]['id']}})['then'](handleEntityNotFound(_0x53b6ca,null))[_0x0c87('0x23')](saveUpdates(_0xe14ba[_0x0c87('0x4b')],null))[_0x0c87('0x23')](respondWithResult(_0x53b6ca,null))['catch'](handleError(_0x53b6ca,null));};exports[_0x0c87('0x24')]=function(_0x3c4dac,_0x9b8e9a){return db['Attachment'][_0x0c87('0x4e')]({'where':{'id':_0x3c4dac[_0x0c87('0x45')]['id']}})[_0x0c87('0x23')](handleEntityNotFound(_0x9b8e9a,null))[_0x0c87('0x23')](removeEntity(_0x9b8e9a,null))[_0x0c87('0x43')](handleError(_0x9b8e9a,null));};exports[_0x0c87('0x4d')]=function(_0x2d3005,_0x125502,_0x2fc2cc){_0x2d3005['body'][_0x0c87('0x28')]=_0x2d3005[_0x0c87('0x4f')][_0x0c87('0x50')];_0x2d3005['body'][_0x0c87('0x51')]=_0x2d3005[_0x0c87('0x4f')][_0x0c87('0x52')];_0x2d3005[_0x0c87('0x4b')]['type']=_0x2d3005[_0x0c87('0x4f')][_0x0c87('0x53')];return db['Attachment'][_0x0c87('0x4d')](_0x2d3005['body'])['then'](respondWithResult(_0x125502,0xc9))[_0x0c87('0x43')](handleError(_0x125502,null));};exports[_0x0c87('0x54')]=function(_0x5c5a58,_0x55ee1f,_0x5946c4){return db[_0x0c87('0x2c')][_0x0c87('0x55')]({'where':{'id':_0x5c5a58[_0x0c87('0x45')]['id']},'raw':!![]})[_0x0c87('0x23')](handleEntityNotFound(_0x55ee1f,null))[_0x0c87('0x23')](function(_0x101722){if(_0x101722){var _0x156e69=_0x101722[_0x0c87('0x56')]!==null;var _0x2077e9=path[_0x0c87('0x57')](config[_0x0c87('0x58')],_0x0c87('0x59'));if(_0x156e69){_0x2077e9=path[_0x0c87('0x57')](_0x2077e9,_0x0c87('0x5a'));}var _0x270ff7=path[_0x0c87('0x57')](_0x2077e9,_0x101722['basename']);return _0x55ee1f[_0x0c87('0x54')](_0x270ff7);}})[_0x0c87('0x43')](handleError(_0x55ee1f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 00cdb68..5e169c6 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 _0x60bb=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./attachment.attributes','define','Attachment'];(function(_0x29dfc1,_0x367174){var _0x4cafe6=function(_0x33db32){while(--_0x33db32){_0x29dfc1['push'](_0x29dfc1['shift']());}};_0x4cafe6(++_0x367174);}(_0x60bb,0x13f));var _0xb60b=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x60bb[_0x1bf809];return _0x1caa4e;};'use strict';var _=require(_0xb60b('0x0'));var util=require(_0xb60b('0x1'));var logger=require(_0xb60b('0x2'))(_0xb60b('0x3'));var moment=require('moment');var BPromise=require(_0xb60b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb60b('0x5'));var rimraf=require(_0xb60b('0x6'));var config=require(_0xb60b('0x7'));var attributes=require(_0xb60b('0x8'));module['exports']=function(_0x222945,_0xcc826a){return _0x222945[_0xb60b('0x9')](_0xb60b('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x952c=['attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','Attachment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x952c,0xeb));var _0xc952=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x952c[_0x2aefb6];return _0x202772;};'use strict';var _=require(_0xc952('0x0'));var util=require(_0xc952('0x1'));var logger=require(_0xc952('0x2'))('api');var moment=require(_0xc952('0x3'));var BPromise=require(_0xc952('0x4'));var rp=require(_0xc952('0x5'));var fs=require('fs');var path=require(_0xc952('0x6'));var rimraf=require(_0xc952('0x7'));var config=require(_0xc952('0x8'));var attributes=require(_0xc952('0x9'));module['exports']=function(_0x395632,_0x41a9eb){return _0x395632[_0xc952('0xa')](_0xc952('0xb'),attributes,{'tableName':_0xc952('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 0fe1eb6..89950d5 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 _0x7b6b=['body','options','raw','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateAttachment','Attachment'];(function(_0x157ec6,_0x39e0ff){var _0x3d4aef=function(_0x4a2f4a){while(--_0x4a2f4a){_0x157ec6['push'](_0x157ec6['shift']());}};_0x3d4aef(++_0x39e0ff);}(_0x7b6b,0xac));var _0xb7b6=function(_0x1f2f3d,_0x3e34f4){_0x1f2f3d=_0x1f2f3d-0x0;var _0x567817=_0x7b6b[_0x1f2f3d];return _0x567817;};'use strict';var _=require(_0xb7b6('0x0'));var util=require('util');var moment=require(_0xb7b6('0x1'));var BPromise=require(_0xb7b6('0x2'));var rs=require(_0xb7b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7b6('0x5'))(_0xb7b6('0x6'));var config=require(_0xb7b6('0x7'));var jayson=require(_0xb7b6('0x8'));var client=jayson[_0xb7b6('0x9')][_0xb7b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e81f,_0x318dfb,_0x36cd51){return new BPromise(function(_0x31809b,_0xb5b26f){return client[_0xb7b6('0xb')](_0x19e81f,_0x36cd51)[_0xb7b6('0xc')](function(_0x313aa8){logger[_0xb7b6('0xd')](_0xb7b6('0xe'),_0x318dfb,_0xb7b6('0xf'));logger[_0xb7b6('0x10')](_0xb7b6('0x11'),_0x318dfb,_0xb7b6('0xf'),JSON['stringify'](_0x313aa8));if(_0x313aa8[_0xb7b6('0x12')]){if(_0x313aa8[_0xb7b6('0x12')][_0xb7b6('0x13')]===0x1f4){logger[_0xb7b6('0x12')](_0xb7b6('0xe'),_0x318dfb,_0x313aa8[_0xb7b6('0x12')][_0xb7b6('0x14')]);return _0xb5b26f(_0x313aa8[_0xb7b6('0x12')][_0xb7b6('0x14')]);}logger[_0xb7b6('0x12')](_0xb7b6('0xe'),_0x318dfb,_0x313aa8[_0xb7b6('0x12')]['message']);return _0x31809b(_0x313aa8['error'][_0xb7b6('0x14')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x318dfb,_0xb7b6('0xf'));_0x31809b(_0x313aa8['result'][_0xb7b6('0x14')]);}})[_0xb7b6('0x15')](function(_0xa99f35){logger[_0xb7b6('0x12')](_0xb7b6('0xe'),_0x318dfb,_0xa99f35);_0xb5b26f(_0xa99f35);});});}exports[_0xb7b6('0x16')]=function(_0x3dc0f8){var _0x7bb633=this;return new Promise(function(_0x5667d9,_0x314049){return db[_0xb7b6('0x17')]['create'](_0x3dc0f8[_0xb7b6('0x18')],{'raw':_0x3dc0f8[_0xb7b6('0x19')]?_0x3dc0f8['options'][_0xb7b6('0x1a')]===undefined?!![]:![]:!![]})[_0xb7b6('0xc')](function(_0x5deaac){logger['info'](_0xb7b6('0x16'),_0x3dc0f8);logger['debug'](_0xb7b6('0x16'),_0x3dc0f8,JSON[_0xb7b6('0x1b')](_0x5deaac));_0x5667d9(_0x5deaac);})[_0xb7b6('0x15')](function(_0x230aa6){logger[_0xb7b6('0x12')](_0xb7b6('0x16'),_0x230aa6[_0xb7b6('0x14')],_0x3dc0f8);_0x314049(_0x7bb633[_0xb7b6('0x12')](0x1f4,_0x230aa6[_0xb7b6('0x14')]));});});}; \ No newline at end of file +var _0xd110=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','CreateAttachment','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x2c2d99,_0x1a61ce){var _0xc9af40=function(_0x4bc502){while(--_0x4bc502){_0x2c2d99['push'](_0x2c2d99['shift']());}};_0xc9af40(++_0x1a61ce);}(_0xd110,0x1e8));var _0x0d11=function(_0x31c1af,_0x53b811){_0x31c1af=_0x31c1af-0x0;var _0x1542a7=_0xd110[_0x31c1af];return _0x1542a7;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var moment=require(_0x0d11('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d11('0x3'));var fs=require('fs');var Redis=require(_0x0d11('0x4'));var db=require(_0x0d11('0x5'))['db'];var utils=require(_0x0d11('0x6'));var logger=require(_0x0d11('0x7'))(_0x0d11('0x8'));var config=require(_0x0d11('0x9'));var jayson=require(_0x0d11('0xa'));var client=jayson['client'][_0x0d11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a889c,_0x33c46e,_0x4f3f3f){return new BPromise(function(_0x47a493,_0x3f9f5a){return client[_0x0d11('0xc')](_0x5a889c,_0x4f3f3f)[_0x0d11('0xd')](function(_0x4c6a59){logger[_0x0d11('0xe')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x0d11('0xf'));logger['debug'](_0x0d11('0x10'),_0x33c46e,_0x0d11('0xf'),JSON[_0x0d11('0x11')](_0x4c6a59));if(_0x4c6a59[_0x0d11('0x12')]){if(_0x4c6a59['error'][_0x0d11('0x13')]===0x1f4){logger[_0x0d11('0x12')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);return _0x3f9f5a(_0x4c6a59[_0x0d11('0x12')]['message']);}logger[_0x0d11('0x12')](_0x0d11('0x15'),_0x33c46e,_0x4c6a59['error'][_0x0d11('0x14')]);return _0x47a493(_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);}else{logger[_0x0d11('0xe')](_0x0d11('0x15'),_0x33c46e,'request\x20sent');_0x47a493(_0x4c6a59['result'][_0x0d11('0x14')]);}})['catch'](function(_0x46aa4f){logger[_0x0d11('0x12')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x46aa4f);_0x3f9f5a(_0x46aa4f);});});}exports[_0x0d11('0x16')]=function(_0x57df83){var _0x2e4c05=this;return new Promise(function(_0x2a29db,_0x5e3bd3){return db['Attachment'][_0x0d11('0x17')](_0x57df83[_0x0d11('0x18')],{'raw':_0x57df83[_0x0d11('0x19')]?_0x57df83[_0x0d11('0x19')][_0x0d11('0x1a')]===undefined?!![]:![]:!![]})[_0x0d11('0xd')](function(_0x575ea3){logger[_0x0d11('0xe')](_0x0d11('0x16'),_0x57df83);logger[_0x0d11('0x1b')](_0x0d11('0x16'),_0x57df83,JSON[_0x0d11('0x11')](_0x575ea3));_0x2a29db(_0x575ea3);})['catch'](function(_0x38955b){logger['error'](_0x0d11('0x16'),_0x38955b[_0x0d11('0x14')],_0x57df83);_0x5e3bd3(_0x2e4c05[_0x0d11('0x12')](0x1f4,_0x38955b['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9303525..635b7bd 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x3c9699,_0x544d86){var _0x3e5a87=function(_0x4c1986){while(--_0x4c1986){_0x3c9699['push'](_0x3c9699['shift']());}};_0x3e5a87(++_0x544d86);}(_0xb10b,0x12a));var _0xbb10=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb10b[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x9aceac,_0x1cf09c){var _0x3c9541=function(_0x1d871c){while(--_0x1d871c){_0x9aceac['push'](_0x9aceac['shift']());}};_0x3c9541(++_0x1cf09c);}(_0xadb5,0xad));var _0x5adb=function(_0x46ba6a,_0x9264b7){_0x46ba6a=_0x46ba6a-0x0;var _0x27da99=_0xadb5[_0x46ba6a];return _0x27da99;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 37b4bbb..09b5540 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 _0xaa4d=['Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','agent','name','domain','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','error'];(function(_0x4fb862,_0x58cde2){var _0x3a3d45=function(_0x130023){while(--_0x130023){_0x4fb862['push'](_0x4fb862['shift']());}};_0x3a3d45(++_0x58cde2);}(_0xaa4d,0x83));var _0xdaa4=function(_0x5794dd,_0x37af14){_0x5794dd=_0x5794dd-0x0;var _0x1a32a7=_0xaa4d[_0x5794dd];return _0x1a32a7;};'use strict';var passport=require(_0xdaa4('0x0'));var LocalStrategy=require(_0xdaa4('0x1'))[_0xdaa4('0x2')];var moment=require(_0xdaa4('0x3'));var ActiveDirectory=require(_0xdaa4('0x4'));var BPromise=require(_0xdaa4('0x5'));var util=require(_0xdaa4('0x6'));var db=require(_0xdaa4('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xdaa4('0x8'));var config=require(_0xdaa4('0x9'));var logger=require(_0xdaa4('0xa'))(_0xdaa4('0xb'));function isActiveDirectoryConfigured(_0xbe5d6){var _0x3798aa=![];if(typeof _0xbe5d6[_0xdaa4('0xc')]!=='undefined'){_0x3798aa=_0xbe5d6[_0xdaa4('0xc')][_0xdaa4('0xd')]&&_0xbe5d6[_0xdaa4('0xc')][_0xdaa4('0xe')]&&_0xbe5d6[_0xdaa4('0xc')]['domain'];}return _0x3798aa;}function adAuthenticate(_0x59a1fc,_0x3d884f,_0x497c70){return new BPromise(function(_0x67bac4,_0x5260d3){try{var _0xe668d5=new ActiveDirectory(_0x59a1fc);_0xe668d5['authenticate'](_0x3d884f,_0x497c70,function(_0x413602,_0x46d06c){if(_0x413602){logger[_0xdaa4('0xf')](_0xdaa4('0x10'),_0x3d884f,util['inspect'](_0x413602,{'showHidden':![],'depth':null}));_0x5260d3(_0xdaa4('0x11'));}else if(!_0x46d06c){logger['error'](_0xdaa4('0x12'),_0x3d884f);_0x5260d3(_0xdaa4('0x11'));}else{_0x67bac4(_0x46d06c);}});}catch(_0x2a3853){_0x5260d3(_0x2a3853);}});}function ActiveDirectoryAuthenticate(_0x1c3c92,_0xe82ab7,_0x285a21,_0x354485){var _0x386af5,_0x31c21d;if(!isActiveDirectoryConfigured(config)){logger[_0xdaa4('0xf')](_0xdaa4('0x13'),_0xe82ab7);return _0x354485(null,![],{'message':_0xdaa4('0x11')});}return db[_0xdaa4('0x14')][_0xdaa4('0x15')]({'where':{'id':0x1},'attributes':[_0xdaa4('0x16'),_0xdaa4('0x17')],'raw':!![]})[_0xdaa4('0x18')](function(_0x17fd7a){_0x386af5=_0x17fd7a;if(!_0x386af5['adSsoEnabled']){logger[_0xdaa4('0xf')](_0xdaa4('0x19'),_0xe82ab7);throw new Error(_0xdaa4('0x11'));}return _0x1c3c92[_0xdaa4('0x15')]({'logging':!![],'attributes':['id','name',_0xdaa4('0x1a'),_0xdaa4('0x1b'),_0xdaa4('0x1c'),_0xdaa4('0x1d'),_0xdaa4('0x1e'),_0xdaa4('0x1f'),_0xdaa4('0x20')],'where':{'name':_0xe82ab7,'role':{'$or':['admin','user',_0xdaa4('0x21')]},'adSsoEnabled':!![]}});})[_0xdaa4('0x18')](function(_0x78d17f){if(!_0x78d17f||_0x78d17f&&_0x78d17f[_0xdaa4('0x22')]!==_0xe82ab7){throw new Error(_0xdaa4('0x11'));}_0x31c21d=_0x78d17f;var _0x280b70=_0x31c21d['name']+'@'+config[_0xdaa4('0xc')][_0xdaa4('0x23')];return adAuthenticate(config[_0xdaa4('0xc')],_0x280b70,_0x285a21);})['then'](function(_0x571bc9){if(_0x31c21d[_0xdaa4('0x1d')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x386af5[_0xdaa4('0x17')]>0x0){if(_0x31c21d[_0xdaa4('0x1e')]){if(moment(_0x31c21d[_0xdaa4('0x1f')])[_0xdaa4('0x24')](_0x386af5[_0xdaa4('0x17')],_0xdaa4('0x25'))>moment()){throw new Error(_0xdaa4('0x11'));}return utils[_0xdaa4('0x26')](_0x31c21d,0x0,![],null)[_0xdaa4('0x18')](function(){return utils[_0xdaa4('0x27')](_0x31c21d);})[_0xdaa4('0x18')](function(){return _0x354485(null,_0x31c21d);});}else{return utils[_0xdaa4('0x27')](_0x31c21d)[_0xdaa4('0x18')](function(){return _0x354485(null,_0x31c21d);});}}else{return utils[_0xdaa4('0x27')](_0x31c21d)['then'](function(){return _0x354485(null,_0x31c21d);});}})[_0xdaa4('0x28')](function(_0x1b42e0){return _0x354485(null,![],_0x1b42e0);});}function handleError(_0x5a0efe,_0x232bb5,_0x1f78b8){return _0x5a0efe[_0xdaa4('0x29')](_0x232bb5||0x1f4)[_0xdaa4('0x2a')]({'message':_0x1f78b8?_0x1f78b8[_0xdaa4('0x2b')]||_0x1f78b8:''});}exports[_0xdaa4('0x2c')]=function(_0x10fbaf,_0x46e312,_0x23747d){passport['authenticate'](_0xdaa4('0x2d'),function(_0x39401f,_0x380d31,_0x571fa4){var _0x1d0bbc=_0x39401f||_0x571fa4;if(_0x1d0bbc){return handleError(_0x46e312,0x191,_0x1d0bbc);}if(!_0x380d31){return handleError(_0x46e312,0x194,{'message':_0xdaa4('0x2e')});}else{var _0x47524c={'payload':{'id':_0x380d31['id'],'role':_0x380d31['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x47524c)[_0xdaa4('0x18')](function(_0x439208){_0x46e312['json']({'id':_0x380d31['id'],'token':_0x439208,'statusCall':'','isAlreadyLogged':_0x380d31[_0xdaa4('0x20')]});});}})(_0x10fbaf,_0x46e312,_0x23747d);};passport[_0xdaa4('0x2f')](_0xdaa4('0x2d'),new LocalStrategy({'usernameField':_0xdaa4('0x22'),'passwordField':_0xdaa4('0x1a')},function(_0x2d3935,_0x16720b,_0x8c63ac){return ActiveDirectoryAuthenticate(db[_0xdaa4('0x30')],_0x2d3935,_0x16720b,_0x8c63ac);})); \ No newline at end of file +var _0x3b50=['../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','role','disabled','blocked','online','user','blockedAt','add','minutes','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','password','User','passport','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/environment'];(function(_0x30f976,_0x2d86e9){var _0x30ee0f=function(_0xf711e3){while(--_0xf711e3){_0x30f976['push'](_0x30f976['shift']());}};_0x30ee0f(++_0x2d86e9);}(_0x3b50,0xd9));var _0x03b5=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3b50[_0xae7c2f];return _0x5d7001;};'use strict';var passport=require(_0x03b5('0x0'));var LocalStrategy=require('passport-local')[_0x03b5('0x1')];var moment=require(_0x03b5('0x2'));var ActiveDirectory=require(_0x03b5('0x3'));var BPromise=require('bluebird');var util=require(_0x03b5('0x4'));var db=require(_0x03b5('0x5'))['db'];var authService=require(_0x03b5('0x6'));var utils=require('../../config/utils');var config=require(_0x03b5('0x7'));var logger=require(_0x03b5('0x8'))(_0x03b5('0x9'));function isActiveDirectoryConfigured(_0xcaccf7){var _0x2b4bce=![];if(typeof _0xcaccf7[_0x03b5('0xa')]!=='undefined'){_0x2b4bce=_0xcaccf7[_0x03b5('0xa')][_0x03b5('0xb')]&&_0xcaccf7[_0x03b5('0xa')][_0x03b5('0xc')]&&_0xcaccf7[_0x03b5('0xa')][_0x03b5('0xd')];}return _0x2b4bce;}function adAuthenticate(_0x38b9f7,_0x3e15c0,_0x529310){return new BPromise(function(_0x34fce6,_0x2dd700){try{var _0x47b94b=new ActiveDirectory(_0x38b9f7);_0x47b94b[_0x03b5('0xe')](_0x3e15c0,_0x529310,function(_0x14db14,_0x1a44e){if(_0x14db14){logger[_0x03b5('0xf')](_0x03b5('0x10'),_0x3e15c0,util['inspect'](_0x14db14,{'showHidden':![],'depth':null}));_0x2dd700('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x1a44e){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3e15c0);_0x2dd700(_0x03b5('0x11'));}else{_0x34fce6(_0x1a44e);}});}catch(_0x123e72){_0x2dd700(_0x123e72);}});}function ActiveDirectoryAuthenticate(_0xdbd8ee,_0xfdd46e,_0x4c2f62,_0x29a546){var _0x5ae76f,_0x1ad809;if(!isActiveDirectoryConfigured(config)){logger[_0x03b5('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0xfdd46e);return _0x29a546(null,![],{'message':_0x03b5('0x11')});}return db[_0x03b5('0x12')][_0x03b5('0x13')]({'where':{'id':0x1},'attributes':[_0x03b5('0x14'),_0x03b5('0x15')],'raw':!![]})[_0x03b5('0x16')](function(_0x5e3d8b){_0x5ae76f=_0x5e3d8b;if(!_0x5ae76f[_0x03b5('0x14')]){logger[_0x03b5('0xf')](_0x03b5('0x17'),_0xfdd46e);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0xdbd8ee['findOne']({'logging':!![],'attributes':['id',_0x03b5('0x18'),'password','salt',_0x03b5('0x19'),_0x03b5('0x1a'),_0x03b5('0x1b'),'blockedAt',_0x03b5('0x1c')],'where':{'name':_0xfdd46e,'role':{'$or':['admin',_0x03b5('0x1d'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x178a61){if(!_0x178a61||_0x178a61&&_0x178a61[_0x03b5('0x18')]!==_0xfdd46e){throw new Error(_0x03b5('0x11'));}_0x1ad809=_0x178a61;var _0x5d4dab=_0x1ad809[_0x03b5('0x18')]+'@'+config[_0x03b5('0xa')][_0x03b5('0xd')];return adAuthenticate(config[_0x03b5('0xa')],_0x5d4dab,_0x4c2f62);})[_0x03b5('0x16')](function(_0x4ecbc1){if(_0x1ad809[_0x03b5('0x1a')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x5ae76f[_0x03b5('0x15')]>0x0){if(_0x1ad809[_0x03b5('0x1b')]){if(moment(_0x1ad809[_0x03b5('0x1e')])[_0x03b5('0x1f')](_0x5ae76f[_0x03b5('0x15')],_0x03b5('0x20'))>moment()){throw new Error(_0x03b5('0x11'));}return utils['clearBlockUser'](_0x1ad809,0x0,![],null)[_0x03b5('0x16')](function(){return utils[_0x03b5('0x21')](_0x1ad809);})[_0x03b5('0x16')](function(){return _0x29a546(null,_0x1ad809);});}else{return utils[_0x03b5('0x21')](_0x1ad809)[_0x03b5('0x16')](function(){return _0x29a546(null,_0x1ad809);});}}else{return utils[_0x03b5('0x21')](_0x1ad809)[_0x03b5('0x16')](function(){return _0x29a546(null,_0x1ad809);});}})[_0x03b5('0x22')](function(_0x5b275f){return _0x29a546(null,![],_0x5b275f);});}function handleError(_0x55e06c,_0x2678a5,_0x138a4d){return _0x55e06c[_0x03b5('0x23')](_0x2678a5||0x1f4)[_0x03b5('0x24')]({'message':_0x138a4d?_0x138a4d[_0x03b5('0x25')]||_0x138a4d:''});}exports['login']=function(_0x434d44,_0x436ff7,_0x4c35cf){passport['authenticate'](_0x03b5('0x26'),function(_0x270ed0,_0x15daa8,_0x4f63ef){var _0x337841=_0x270ed0||_0x4f63ef;if(_0x337841){return handleError(_0x436ff7,0x191,_0x337841);}if(!_0x15daa8){return handleError(_0x436ff7,0x194,{'message':_0x03b5('0x27')});}else{var _0x3e9b7a={'payload':{'id':_0x15daa8['id'],'role':_0x15daa8['role']},'options':{'expiresIn':0x15180}};return authService[_0x03b5('0x28')](_0x3e9b7a)[_0x03b5('0x16')](function(_0x4121bf){_0x436ff7[_0x03b5('0x29')]({'id':_0x15daa8['id'],'token':_0x4121bf,'statusCall':'','isAlreadyLogged':_0x15daa8[_0x03b5('0x1c')]});});}})(_0x434d44,_0x436ff7,_0x4c35cf);};passport[_0x03b5('0x2a')](_0x03b5('0x26'),new LocalStrategy({'usernameField':_0x03b5('0x18'),'passwordField':_0x03b5('0x2b')},function(_0x28b37a,_0xf45665,_0x8cdec){return ActiveDirectoryAuthenticate(db[_0x03b5('0x2c')],_0x28b37a,_0xf45665,_0x8cdec);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a9cc90e..4f304ca 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 _0x4ceb=['post','exports','express','Router','./authActiveDirectory.controller'];(function(_0x2967da,_0x19ef62){var _0x34e04b=function(_0x477b75){while(--_0x477b75){_0x2967da['push'](_0x2967da['shift']());}};_0x34e04b(++_0x19ef62);}(_0x4ceb,0x1c4));var _0xb4ce=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4ceb[_0x37bd26];return _0xe83dc4;};'use strict';var express=require(_0xb4ce('0x0'));var router=express[_0xb4ce('0x1')]();var controller=require(_0xb4ce('0x2'));router[_0xb4ce('0x3')]('/',controller['login']);module[_0xb4ce('0x4')]=router; \ No newline at end of file +var _0x3530=['post','express','Router','./authActiveDirectory.controller'];(function(_0x386d62,_0x473eff){var _0x24ca15=function(_0x42b210){while(--_0x42b210){_0x386d62['push'](_0x386d62['shift']());}};_0x24ca15(++_0x473eff);}(_0x3530,0x1c5));var _0x0353=function(_0x41316d,_0x12c583){_0x41316d=_0x41316d-0x0;var _0x3b1b4d=_0x3530[_0x41316d];return _0x3b1b4d;};'use strict';var express=require(_0x0353('0x0'));var router=express[_0x0353('0x1')]();var controller=require(_0x0353('0x2'));router[_0x0353('0x3')]('/',controller['login']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 233d7d7..77ce99e 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x1b9c11,_0x2d3e06){var _0x425019=function(_0x455b8b){while(--_0x455b8b){_0x1b9c11['push'](_0x1b9c11['shift']());}};_0x425019(++_0x2d3e06);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x7a54,0x106));var _0x47a5=function(_0x376c08,_0x4e7584){_0x376c08=_0x376c08-0x0;var _0x97acd4=_0x7a54[_0x376c08];return _0x97acd4;};'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 374444e..d0bcd88 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 _0x5080=['passport','./authGoogle.controller','../../components/auth/service','get','login','/callback'];(function(_0x54026e,_0x162a33){var _0x4a3bdd=function(_0x1fde62){while(--_0x1fde62){_0x54026e['push'](_0x54026e['shift']());}};_0x4a3bdd(++_0x162a33);}(_0x5080,0x66));var _0x0508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5080[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var passport=require(_0x0508('0x0'));var router=express['Router']();var controller=require(_0x0508('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x0508('0x2'));router[_0x0508('0x3')]('/',controller[_0x0508('0x4')]);router['get'](_0x0508('0x5'),controller['callback'],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xb505=['setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback'];(function(_0x5639e1,_0x421603){var _0x197e82=function(_0x150da4){while(--_0x150da4){_0x5639e1['push'](_0x5639e1['shift']());}};_0x197e82(++_0x421603);}(_0xb505,0x65));var _0x5b50=function(_0x364b47,_0x45e462){_0x364b47=_0x364b47-0x0;var _0x412169=_0xb505[_0x364b47];return _0x412169;};'use strict';var express=require('express');var passport=require(_0x5b50('0x0'));var router=express[_0x5b50('0x1')]();var controller=require(_0x5b50('0x2'));var userController=require(_0x5b50('0x3'));var authService=require(_0x5b50('0x4'));router['get']('/',controller[_0x5b50('0x5')]);router[_0x5b50('0x6')](_0x5b50('0x7'),controller[_0x5b50('0x8')],authService['isMiddleware'],userController['login'],authService[_0x5b50('0x9')]);module[_0x5b50('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c861b89..8fca2f8 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 _0x283a=['generate','trim','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','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','User','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','resetPasswordExpires','status','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','email','request','SendMail','error','format','message','send','local-login','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0x2a6490,_0x1adf0f){var _0x1b31df=function(_0x51eeb7){while(--_0x51eeb7){_0x2a6490['push'](_0x2a6490['shift']());}};_0x1b31df(++_0x1adf0f);}(_0x283a,0x169));var _0xa283=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x283a[_0x4bfac3];return _0x15f0f2;};'use strict';var util=require(_0xa283('0x0'));var passport=require(_0xa283('0x1'));var LocalStrategy=require(_0xa283('0x2'))[_0xa283('0x3')];var jayson=require(_0xa283('0x4'));var _=require('lodash');var rs=require(_0xa283('0x5'));var moment=require(_0xa283('0x6'));var db=require(_0xa283('0x7'))['db'];var authService=require(_0xa283('0x8'));var utils=require('../../config/utils');var client=jayson[_0xa283('0x9')][_0xa283('0xa')]({'port':0x232b});function localAuthenticate(_0x90bbf2,_0xb36cb,_0x723a95,_0x32afdd){var _0x29a0e0,_0x51c968;return db['Setting'][_0xa283('0xb')]({'where':{'id':0x1},'attributes':[_0xa283('0xc'),_0xa283('0xd')],'raw':!![]})[_0xa283('0xe')](function(_0x2d9988){_0x29a0e0=_0x2d9988;return _0x90bbf2[_0xa283('0xb')]({'attributes':['id',_0xa283('0xf'),_0xa283('0x10'),_0xa283('0x11'),_0xa283('0x12'),_0xa283('0x13'),_0xa283('0x14'),_0xa283('0x15'),_0xa283('0x16')],'where':{'name':_0xb36cb,'role':{'$or':[_0xa283('0x17'),_0xa283('0x18'),_0xa283('0x19')]}}});})[_0xa283('0xe')](function(_0x432367){if(!_0x432367||_0x432367&&_0x432367['name']!==_0xb36cb){throw new Error(_0xa283('0x1a'));}else{_0x51c968=_0x432367;return _0x51c968;}})[_0xa283('0xe')](function(){_0x51c968[_0xa283('0x1b')](_0x723a95,function(_0x5b5f98,_0x3f1d70){var _0x2055e0=_0x51c968[_0xa283('0x16')]+0x1;if(_0x5b5f98){return _0x32afdd(_0x5b5f98);}else if(!_0x3f1d70){if(_0x51c968['disabled']){return _0x32afdd(null,![],{'message':_0xa283('0x1a')});}else if(_0x29a0e0[_0xa283('0xc')]>0x0){if(_0x51c968[_0xa283('0x14')]){if(_0x29a0e0[_0xa283('0xd')]>0x0){if(moment(_0x51c968[_0xa283('0x15')])[_0xa283('0x1c')](_0x29a0e0[_0xa283('0xd')],_0xa283('0x1d'))>moment()){return _0x32afdd(null,![],{'message':_0xa283('0x1a')});}else{return utils[_0xa283('0x1e')](_0x51c968,_0x2055e0,![],null)[_0xa283('0xe')](function(){return _0x32afdd(null,![],{'message':_0xa283('0x1a')});});}}else{return _0x32afdd(null,![],{'message':_0xa283('0x1a')});}}else{if(_0x2055e0>=_0x29a0e0[_0xa283('0xc')]){return utils[_0xa283('0x1e')](_0x51c968,0x0,!![],moment())[_0xa283('0xe')](function(){return _0x32afdd(null,![],{'message':_0xa283('0x1a')});});}else{return utils['clearBlockUser'](_0x51c968,_0x2055e0,![],null)[_0xa283('0xe')](function(){return _0x32afdd(null,![],{'message':_0xa283('0x1a')});});}}}else{return _0x32afdd(null,![],{'message':_0xa283('0x1a')});}}else{if(_0x51c968[_0xa283('0x13')]){return _0x32afdd(null,![],{'message':_0xa283('0x1a')});}else if(_0x29a0e0[_0xa283('0xc')]>0x0){if(_0x51c968[_0xa283('0x14')]){if(_0x29a0e0[_0xa283('0xd')]>0x0){if(moment(_0x51c968['blockedAt'])[_0xa283('0x1c')](_0x29a0e0[_0xa283('0xd')],_0xa283('0x1d'))>moment()){return _0x32afdd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x51c968,0x0,![],null)[_0xa283('0xe')](function(){return utils[_0xa283('0x1f')](_0x51c968);})[_0xa283('0xe')](function(){return _0x32afdd(null,_0x51c968);});}}else{return _0x32afdd(null,![],{'message':_0xa283('0x1a')});}}else{return utils[_0xa283('0x1e')](_0x51c968,0x0,![],null)[_0xa283('0xe')](function(){return utils[_0xa283('0x1f')](_0x51c968);})[_0xa283('0xe')](function(){return _0x32afdd(null,_0x51c968);})[_0xa283('0x20')](function(_0x3eafbc){return _0x32afdd(null,![],_0x3eafbc);});}}else{if(_0x51c968['blocked']){return _0x32afdd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa283('0x1f')](_0x51c968)[_0xa283('0xe')](function(){return _0x32afdd(null,_0x51c968);});}}}});})[_0xa283('0x20')](function(_0x35b6bf){return _0x32afdd(null,![],_0x35b6bf);});}function sendServiceMail(_0x5532e6){return db['MailAccount'][_0xa283('0x21')]({'where':{'service':!![]},'attributes':['id',_0xa283('0xf'),'email'],'include':[{'model':db[_0xa283('0x22')],'as':_0xa283('0x23'),'include':[{'model':db['CloudProvider'],'as':_0xa283('0x24')}]}]})[_0xa283('0xe')](function(_0x160a2b){if(!_0x160a2b){throw new Error(_0xa283('0x25'));}var _0x391324=_0x160a2b[_0xa283('0x26')]();var _0x5f3a85={'account':_0x391324,'message':_[_0xa283('0x27')]({'from':util['format'](_0xa283('0x28'),_0x160a2b[_0xa283('0xf')],_0x160a2b[_0xa283('0x29')]||_0x160a2b['Smtp'][_0xa283('0x18')])},_0x5532e6)};return client[_0xa283('0x2a')](_0xa283('0x2b'),_0x5f3a85);})[_0xa283('0xe')](function(_0x1af0d8){if(_0x1af0d8[_0xa283('0x2c')]){throw new Error(util[_0xa283('0x2d')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1af0d8[_0xa283('0x2c')][_0xa283('0x2e')]||JSON['stringify'](_0x1af0d8[_0xa283('0x2c')])));}return!![];});}function handleError(_0x3c39e1,_0x44be4c,_0x55cb6b){return _0x3c39e1['status'](_0x44be4c||0x1f4)[_0xa283('0x2f')]({'message':_0x55cb6b?_0x55cb6b[_0xa283('0x2e')]||_0x55cb6b:''});}exports['login']=function(_0x4dcd65,_0x21bab0,_0x14157c){passport[_0xa283('0x1b')](_0xa283('0x30'),function(_0x44202e,_0x124c4c,_0x26ebb5){var _0x330188=_0x44202e||_0x26ebb5;if(_0x330188){return handleError(_0x21bab0,0x191,_0x330188);}if(!_0x124c4c){return handleError(_0x21bab0,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2440b3={'payload':{'id':_0x124c4c['id'],'role':_0x124c4c['role']},'options':{'expiresIn':0x15180}};return authService[_0xa283('0x31')](_0x2440b3)[_0xa283('0xe')](function(_0x4e7e16){_0x21bab0['json']({'id':_0x124c4c['id'],'token':_0x4e7e16,'statusCall':'','isAlreadyLogged':_0x124c4c[_0xa283('0x32')]});});}})(_0x4dcd65,_0x21bab0,_0x14157c);};exports[_0xa283('0x33')]=function(_0x469366,_0x4031e6){if(!_0x469366[_0xa283('0x34')][_0xa283('0x29')]){return handleError(_0x4031e6,0x1f4,{'message':_0xa283('0x35')});}var _0x22ad97=rs[_0xa283('0x36')]();_0x469366['body'][_0xa283('0x29')]=_0x469366['body']['email'][_0xa283('0x37')]()[_0xa283('0x38')]();var _0x27e5e1;return db[_0xa283('0x39')][_0xa283('0xb')]({'where':{'id':0x1},'attributes':[_0xa283('0xc'),_0xa283('0xd')],'raw':!![]})[_0xa283('0xe')](function(_0x746f09){_0x27e5e1=_0x746f09;return db['User'][_0xa283('0x21')]({'where':{'email':_0x469366[_0xa283('0x34')][_0xa283('0x29')]}});})['then'](function(_0x3fee1e){if(!_0x3fee1e){throw new Error(_0xa283('0x3a'));}if(_0x3fee1e[_0xa283('0x13')]){throw new Error(_0xa283('0x3b'));}if(_0x3fee1e[_0xa283('0x14')]){if(moment(_0x3fee1e['blockedAt'])[_0xa283('0x1c')](_0x27e5e1[_0xa283('0xd')],_0xa283('0x1d'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3fee1e[_0xa283('0x14')]=![];_0x3fee1e[_0xa283('0x15')]=null;}}_0x3fee1e[_0xa283('0x3c')]=_0x22ad97;_0x3fee1e['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x3fee1e[_0xa283('0x3d')]();})[_0xa283('0xe')](function(){return sendServiceMail({'to':_0x469366['body'][_0xa283('0x29')],'subject':_0xa283('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xa283('0x3f')+_0x469366[_0xa283('0x40')][_0xa283('0x41')]+_0xa283('0x42')+_0x22ad97+'\x0a\x0a'+_0xa283('0x43')});})[_0xa283('0xe')](function(){_0x4031e6['status'](0xc8)[_0xa283('0x2f')]({'message':_0xa283('0x44')});})[_0xa283('0x20')](function(_0x5af46c){return handleError(_0x4031e6,0x1f4,_0x5af46c);});};exports[_0xa283('0x45')]=function(_0x58d087,_0x4b728a){return db[_0xa283('0x46')]['find']({'where':{'resetPasswordToken':_0x58d087['params'][_0xa283('0x47')],'resetPasswordExpires':{'$gt':Date[_0xa283('0x48')]()}}})['then'](function(_0x1665ca){if(!_0x1665ca){throw new Error(_0xa283('0x49'));}return db[_0xa283('0x39')]['findOne']({'attributes':['id',_0xa283('0x4a'),'enforcePasswordHistory',_0xa283('0x4b')]})['then'](function(_0x52c589){if(_0x52c589[_0xa283('0x4a')])authService[_0xa283('0x4c')](_0x58d087['body']['password']);if(!_0x52c589[_0xa283('0x4d')]||!_0x1665ca[_0xa283('0x4e')])return _0x1665ca;authService['validatePasswordHistory'](_0x58d087[_0xa283('0x34')]['password'],_0x1665ca[_0xa283('0x4e')],_0x52c589[_0xa283('0x4b')]);return _0x1665ca;})['then'](function(){_0x1665ca['password']=_0x58d087['body']['password'];_0x1665ca[_0xa283('0x3c')]=null;_0x1665ca[_0xa283('0x4f')]=null;return _0x1665ca[_0xa283('0x3d')]();});})['then'](function(){_0x4b728a[_0xa283('0x50')](0xc8)[_0xa283('0x2f')]({'message':_0xa283('0x51')});})[_0xa283('0x20')](function(_0x5c4752){return handleError(_0x4b728a,0x1f4,_0x5c4752);});};passport[_0xa283('0x52')](_0xa283('0x30'),new LocalStrategy({'usernameField':_0xa283('0xf'),'passwordField':_0xa283('0x10')},function(_0x199a02,_0x432447,_0x104f55){return localAuthenticate(db[_0xa283('0x46')],_0x199a02,_0x432447,_0x104f55);})); \ No newline at end of file +var _0xe67e=['\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge'];(function(_0x465cb0,_0x422dc4){var _0xa820e1=function(_0x1118f2){while(--_0x1118f2){_0x465cb0['push'](_0x465cb0['shift']());}};_0xa820e1(++_0x422dc4);}(_0xe67e,0x1ca));var _0xee67=function(_0x5e7711,_0xbea97b){_0x5e7711=_0x5e7711-0x0;var _0x45cc4c=_0xe67e[_0x5e7711];return _0x45cc4c;};'use strict';var util=require(_0xee67('0x0'));var passport=require(_0xee67('0x1'));var LocalStrategy=require(_0xee67('0x2'))['Strategy'];var jayson=require(_0xee67('0x3'));var _=require(_0xee67('0x4'));var rs=require(_0xee67('0x5'));var moment=require(_0xee67('0x6'));var db=require(_0xee67('0x7'))['db'];var authService=require(_0xee67('0x8'));var utils=require(_0xee67('0x9'));var client=jayson['client'][_0xee67('0xa')]({'port':0x232b});function localAuthenticate(_0x28b6e5,_0x3e41fa,_0x34c7cb,_0x4b9c74){var _0x4ae5d4,_0x177664;return db[_0xee67('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0xee67('0xc'),_0xee67('0xd')],'raw':!![]})[_0xee67('0xe')](function(_0x3903ec){_0x4ae5d4=_0x3903ec;return _0x28b6e5['findOne']({'attributes':['id',_0xee67('0xf'),_0xee67('0x10'),_0xee67('0x11'),_0xee67('0x12'),_0xee67('0x13'),_0xee67('0x14'),_0xee67('0x15'),_0xee67('0x16')],'where':{'name':_0x3e41fa,'role':{'$or':[_0xee67('0x17'),_0xee67('0x18'),'agent']}}});})[_0xee67('0xe')](function(_0x56febb){if(!_0x56febb||_0x56febb&&_0x56febb[_0xee67('0xf')]!==_0x3e41fa){throw new Error(_0xee67('0x19'));}else{_0x177664=_0x56febb;return _0x177664;}})[_0xee67('0xe')](function(){_0x177664[_0xee67('0x1a')](_0x34c7cb,function(_0x183cc8,_0x551d4c){var _0x2ed3b3=_0x177664[_0xee67('0x16')]+0x1;if(_0x183cc8){return _0x4b9c74(_0x183cc8);}else if(!_0x551d4c){if(_0x177664[_0xee67('0x13')]){return _0x4b9c74(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ae5d4[_0xee67('0xc')]>0x0){if(_0x177664[_0xee67('0x14')]){if(_0x4ae5d4['blockDuration']>0x0){if(moment(_0x177664['blockedAt'])[_0xee67('0x1b')](_0x4ae5d4[_0xee67('0xd')],_0xee67('0x1c'))>moment()){return _0x4b9c74(null,![],{'message':_0xee67('0x19')});}else{return utils[_0xee67('0x1d')](_0x177664,_0x2ed3b3,![],null)[_0xee67('0xe')](function(){return _0x4b9c74(null,![],{'message':_0xee67('0x19')});});}}else{return _0x4b9c74(null,![],{'message':_0xee67('0x19')});}}else{if(_0x2ed3b3>=_0x4ae5d4[_0xee67('0xc')]){return utils[_0xee67('0x1d')](_0x177664,0x0,!![],moment())[_0xee67('0xe')](function(){return _0x4b9c74(null,![],{'message':_0xee67('0x19')});});}else{return utils[_0xee67('0x1d')](_0x177664,_0x2ed3b3,![],null)[_0xee67('0xe')](function(){return _0x4b9c74(null,![],{'message':_0xee67('0x19')});});}}}else{return _0x4b9c74(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x177664[_0xee67('0x13')]){return _0x4b9c74(null,![],{'message':_0xee67('0x19')});}else if(_0x4ae5d4[_0xee67('0xc')]>0x0){if(_0x177664[_0xee67('0x14')]){if(_0x4ae5d4[_0xee67('0xd')]>0x0){if(moment(_0x177664[_0xee67('0x15')])[_0xee67('0x1b')](_0x4ae5d4[_0xee67('0xd')],_0xee67('0x1c'))>moment()){return _0x4b9c74(null,![],{'message':_0xee67('0x19')});}else{return utils[_0xee67('0x1d')](_0x177664,0x0,![],null)[_0xee67('0xe')](function(){return utils[_0xee67('0x1e')](_0x177664);})[_0xee67('0xe')](function(){return _0x4b9c74(null,_0x177664);});}}else{return _0x4b9c74(null,![],{'message':_0xee67('0x19')});}}else{return utils[_0xee67('0x1d')](_0x177664,0x0,![],null)[_0xee67('0xe')](function(){return utils[_0xee67('0x1e')](_0x177664);})[_0xee67('0xe')](function(){return _0x4b9c74(null,_0x177664);})[_0xee67('0x1f')](function(_0x1fd65f){return _0x4b9c74(null,![],_0x1fd65f);});}}else{if(_0x177664['blocked']){return _0x4b9c74(null,![],{'message':_0xee67('0x19')});}else{return utils[_0xee67('0x1e')](_0x177664)[_0xee67('0xe')](function(){return _0x4b9c74(null,_0x177664);});}}}});})[_0xee67('0x1f')](function(_0x36dd34){return _0x4b9c74(null,![],_0x36dd34);});}function sendServiceMail(_0x36a240){return db[_0xee67('0x20')][_0xee67('0x21')]({'where':{'service':!![]},'attributes':['id',_0xee67('0xf'),_0xee67('0x22')],'include':[{'model':db['MailServerOut'],'as':_0xee67('0x23'),'include':[{'model':db[_0xee67('0x24')],'as':_0xee67('0x24')}]}]})[_0xee67('0xe')](function(_0x1115c5){if(!_0x1115c5){throw new Error(_0xee67('0x25'));}var _0x590d63=_0x1115c5[_0xee67('0x26')]();var _0x5f2e67={'account':_0x590d63,'message':_[_0xee67('0x27')]({'from':util['format'](_0xee67('0x28'),_0x1115c5[_0xee67('0xf')],_0x1115c5[_0xee67('0x22')]||_0x1115c5[_0xee67('0x23')][_0xee67('0x18')])},_0x36a240)};return client[_0xee67('0x29')](_0xee67('0x2a'),_0x5f2e67);})[_0xee67('0xe')](function(_0x3e599c){if(_0x3e599c[_0xee67('0x2b')]){throw new Error(util[_0xee67('0x2c')](_0xee67('0x2d'),_0x3e599c['error'][_0xee67('0x2e')]||JSON[_0xee67('0x2f')](_0x3e599c['error'])));}return!![];});}function handleError(_0x34411f,_0x3b0319,_0x51a7ec){return _0x34411f[_0xee67('0x30')](_0x3b0319||0x1f4)[_0xee67('0x31')]({'message':_0x51a7ec?_0x51a7ec[_0xee67('0x2e')]||_0x51a7ec:''});}exports[_0xee67('0x32')]=function(_0xa4e2c5,_0x5cde46,_0x2c9fda){passport[_0xee67('0x1a')](_0xee67('0x33'),function(_0x4df566,_0x41b3d5,_0x5b6e62){var _0x42bfe2=_0x4df566||_0x5b6e62;if(_0x42bfe2){return handleError(_0x5cde46,0x191,_0x42bfe2);}if(!_0x41b3d5){return handleError(_0x5cde46,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x91f3ec={'payload':{'id':_0x41b3d5['id'],'role':_0x41b3d5[_0xee67('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x91f3ec)[_0xee67('0xe')](function(_0x237450){_0x5cde46[_0xee67('0x34')]({'id':_0x41b3d5['id'],'token':_0x237450,'statusCall':'','isAlreadyLogged':_0x41b3d5['online']});});}})(_0xa4e2c5,_0x5cde46,_0x2c9fda);};exports[_0xee67('0x35')]=function(_0x487083,_0x1db4c8){if(!_0x487083[_0xee67('0x36')][_0xee67('0x22')]){return handleError(_0x1db4c8,0x1f4,{'message':_0xee67('0x37')});}var _0xd306d5=rs[_0xee67('0x38')]();_0x487083[_0xee67('0x36')][_0xee67('0x22')]=_0x487083[_0xee67('0x36')][_0xee67('0x22')][_0xee67('0x39')]()[_0xee67('0x3a')]();var _0x345d5f;return db[_0xee67('0xb')][_0xee67('0x3b')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xee67('0xd')],'raw':!![]})['then'](function(_0x5ad5e1){_0x345d5f=_0x5ad5e1;return db[_0xee67('0x3c')][_0xee67('0x21')]({'where':{'email':_0x487083[_0xee67('0x36')][_0xee67('0x22')]}});})[_0xee67('0xe')](function(_0x7554c2){if(!_0x7554c2){throw new Error(_0xee67('0x3d'));}if(_0x7554c2[_0xee67('0x13')]){throw new Error(_0xee67('0x3e'));}if(_0x7554c2[_0xee67('0x14')]){if(moment(_0x7554c2['blockedAt'])[_0xee67('0x1b')](_0x345d5f['blockDuration'],_0xee67('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x7554c2['blocked']=![];_0x7554c2['blockedAt']=null;}}_0x7554c2[_0xee67('0x3f')]=_0xd306d5;_0x7554c2[_0xee67('0x40')]=Date[_0xee67('0x41')]()+0x36ee80;return _0x7554c2[_0xee67('0x42')]();})[_0xee67('0xe')](function(){return sendServiceMail({'to':_0x487083['body'][_0xee67('0x22')],'subject':_0xee67('0x43'),'text':_0xee67('0x44')+_0xee67('0x45')+_0xee67('0x46')+_0x487083[_0xee67('0x47')]['host']+'/reset/'+_0xd306d5+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xee67('0xe')](function(){_0x1db4c8[_0xee67('0x30')](0xc8)[_0xee67('0x31')]({'message':_0xee67('0x48')});})[_0xee67('0x1f')](function(_0xd4872e){return handleError(_0x1db4c8,0x1f4,_0xd4872e);});};exports[_0xee67('0x49')]=function(_0x2cae15,_0x498887){return db[_0xee67('0x3c')][_0xee67('0x21')]({'where':{'resetPasswordToken':_0x2cae15['params'][_0xee67('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xee67('0xe')](function(_0xed4a0f){if(!_0xed4a0f){throw new Error(_0xee67('0x4b'));}return db[_0xee67('0xb')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0xee67('0x4c')]})[_0xee67('0xe')](function(_0x5ca465){if(_0x5ca465[_0xee67('0x4d')])authService['validatePasswordPattern'](_0x2cae15[_0xee67('0x36')][_0xee67('0x10')]);if(!_0x5ca465[_0xee67('0x4e')]||!_0xed4a0f[_0xee67('0x4f')])return _0xed4a0f;authService[_0xee67('0x50')](_0x2cae15[_0xee67('0x36')][_0xee67('0x10')],_0xed4a0f[_0xee67('0x4f')],_0x5ca465[_0xee67('0x4c')]);return _0xed4a0f;})['then'](function(){_0xed4a0f['password']=_0x2cae15[_0xee67('0x36')][_0xee67('0x10')];_0xed4a0f[_0xee67('0x3f')]=null;_0xed4a0f[_0xee67('0x40')]=null;return _0xed4a0f[_0xee67('0x42')]();});})[_0xee67('0xe')](function(){_0x498887[_0xee67('0x30')](0xc8)[_0xee67('0x31')]({'message':_0xee67('0x51')});})[_0xee67('0x1f')](function(_0x4517cc){return handleError(_0x498887,0x1f4,_0x4517cc);});};passport[_0xee67('0x52')](_0xee67('0x33'),new LocalStrategy({'usernameField':_0xee67('0xf'),'passwordField':_0xee67('0x10')},function(_0x5b335f,_0x2e9967,_0x21d9a1){return localAuthenticate(db[_0xee67('0x3c')],_0x5b335f,_0x2e9967,_0x21d9a1);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c266f8b..d887ad7 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 _0x3f99=['post','login','/forgot','/reset/:token','reset','exports','express','./authLocal.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f99,0x14e));var _0x93f9=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x3f99[_0x20cb20];return _0x2fcf4b;};'use strict';var express=require(_0x93f9('0x0'));var router=express['Router']();var controller=require(_0x93f9('0x1'));router[_0x93f9('0x2')]('/',controller[_0x93f9('0x3')]);router[_0x93f9('0x2')](_0x93f9('0x4'),controller['forgot']);router[_0x93f9('0x2')](_0x93f9('0x5'),controller[_0x93f9('0x6')]);module[_0x93f9('0x7')]=router; \ No newline at end of file +var _0x5428=['exports','Router','./authLocal.controller','login','post','/forgot','forgot','/reset/:token','reset'];(function(_0x530aec,_0x3646e9){var _0x38aca3=function(_0x40131b){while(--_0x40131b){_0x530aec['push'](_0x530aec['shift']());}};_0x38aca3(++_0x3646e9);}(_0x5428,0x145));var _0x8542=function(_0x273f98,_0x3fac3d){_0x273f98=_0x273f98-0x0;var _0x322600=_0x5428[_0x273f98];return _0x322600;};'use strict';var express=require('express');var router=express[_0x8542('0x0')]();var controller=require(_0x8542('0x1'));router['post']('/',controller[_0x8542('0x2')]);router[_0x8542('0x3')](_0x8542('0x4'),controller[_0x8542('0x5')]);router['post'](_0x8542('0x6'),controller[_0x8542('0x7')]);module[_0x8542('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c16ed79..250a09d 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 _0xc4ff=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x1945e3,_0x4efd74){var _0x5bf682=function(_0x43a175){while(--_0x43a175){_0x1945e3['push'](_0x1945e3['shift']());}};_0x5bf682(++_0x4efd74);}(_0xc4ff,0xf7));var _0xfc4f=function(_0x47042c,_0x339d8b){_0x47042c=_0x47042c-0x0;var _0x542e56=_0xc4ff[_0x47042c];return _0x542e56;};'use strict';var Sequelize=require('sequelize');module[_0xfc4f('0x0')]={'name':{'type':Sequelize[_0xfc4f('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xfc4f('0x1')]},'description':{'type':Sequelize[_0xfc4f('0x1')]},'status':{'type':Sequelize[_0xfc4f('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xfc4f('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xec16=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xec16,0xa7));var _0x6ec1=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0xec16[_0x290fa6];return _0x47f1f3;};'use strict';var Sequelize=require(_0x6ec1('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ec1('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6ec1('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6ec1('0x3')],'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 ef189c6..6bddcd7 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 _0xe62c=['hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','update','then','destroy','name','send','map','Automation','rawAttributes','type','key','model','keys','filters','intersection','query','fields','length','attributes','nolimit','sort','where','pick','filter','merge','options','include','catch','show','includeAll','find','create','body','params','Condition','addConditions','ids','omit','getConditions','findOne','order'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0xe62c,0xd9));var _0xce62=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xe62c[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0xce62('0x0'));var rimraf=require(_0xce62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce62('0x2'));var moment=require(_0xce62('0x3'));var BPromise=require(_0xce62('0x4'));var Mustache=require('mustache');var util=require(_0xce62('0x5'));var path=require(_0xce62('0x6'));var sox=require('sox');var csv=require(_0xce62('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce62('0x8'));var _=require(_0xce62('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce62('0x7'));var querystring=require(_0xce62('0xa'));var Papa=require(_0xce62('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce62('0xc'));var as=require(_0xce62('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xce62('0xe'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce62('0xf'))['db'];function respondWithStatusCode(_0x197a5b,_0x2bea96){_0x2bea96=_0x2bea96||0xcc;return function(_0x516db4){if(_0x516db4){return _0x197a5b[_0xce62('0x10')](_0x2bea96);}return _0x197a5b[_0xce62('0x11')](_0x2bea96)[_0xce62('0x12')]();};}function respondWithResult(_0x2eb809,_0x255a52){_0x255a52=_0x255a52||0xc8;return function(_0x2f9921){if(_0x2f9921){return _0x2eb809['status'](_0x255a52)[_0xce62('0x13')](_0x2f9921);}};}function respondWithFilteredResult(_0x33a094,_0x212bcb){return function(_0x53c27c){if(_0x53c27c){var _0x2249a0=typeof _0x212bcb['offset']===_0xce62('0x14')&&typeof _0x212bcb['limit']===_0xce62('0x14');var _0x1f00e4=_0x53c27c[_0xce62('0x15')];var _0x3fab63=_0x2249a0?0x0:_0x212bcb[_0xce62('0x16')];var _0x154923=_0x2249a0?_0x53c27c[_0xce62('0x15')]:_0x212bcb['offset']+_0x212bcb[_0xce62('0x17')];var _0x543ccd;if(_0x154923>=_0x1f00e4){_0x154923=_0x1f00e4;_0x543ccd=0xc8;}else{_0x543ccd=0xce;}_0x33a094[_0xce62('0x11')](_0x543ccd);return _0x33a094[_0xce62('0x18')]('Content-Range',_0x3fab63+'-'+_0x154923+'/'+_0x1f00e4)[_0xce62('0x13')](_0x53c27c);}return null;};}function patchUpdates(_0x1f3b39){return function(_0x9f50d){try{jsonpatch[_0xce62('0x19')](_0x9f50d,_0x1f3b39,!![]);}catch(_0x5dd43d){return BPromise[_0xce62('0x1a')](_0x5dd43d);}return _0x9f50d['save']();};}function saveUpdates(_0x208871,_0x22f1f1){return function(_0x4d7b8f){if(_0x4d7b8f){return _0x4d7b8f[_0xce62('0x1b')](_0x208871)[_0xce62('0x1c')](function(_0x4a4703){return _0x4a4703;});}return null;};}function removeEntity(_0x391b03,_0x645d5b){return function(_0x4091bf){if(_0x4091bf){return _0x4091bf[_0xce62('0x1d')]()[_0xce62('0x1c')](function(){_0x391b03[_0xce62('0x11')](0xcc)[_0xce62('0x12')]();});}};}function handleEntityNotFound(_0x2b4b1f,_0x4e8075){return function(_0x5f2f02){if(!_0x5f2f02){_0x2b4b1f['sendStatus'](0x194);}return _0x5f2f02;};}function handleError(_0x6709ae,_0x373d58){_0x373d58=_0x373d58||0x1f4;return function(_0x1d445e){logger['error'](_0x1d445e['stack']);if(_0x1d445e['name']){delete _0x1d445e[_0xce62('0x1e')];}_0x6709ae[_0xce62('0x11')](_0x373d58)[_0xce62('0x1f')](_0x1d445e);};}exports['index']=function(_0x20f71a,_0x4114f2){var _0x1504ce={},_0x174c5b={},_0x7598f4={'count':0x0,'rows':[]};var _0x15f172=_[_0xce62('0x20')](db[_0xce62('0x21')][_0xce62('0x22')],function(_0xa47858){return{'name':_0xa47858['fieldName'],'type':_0xa47858[_0xce62('0x23')][_0xce62('0x24')]};});_0x174c5b[_0xce62('0x25')]=_[_0xce62('0x20')](_0x15f172,_0xce62('0x1e'));_0x174c5b['query']=_[_0xce62('0x26')](_0x20f71a['query']);_0x174c5b[_0xce62('0x27')]=_[_0xce62('0x28')](_0x174c5b[_0xce62('0x25')],_0x174c5b[_0xce62('0x29')]);_0x1504ce['attributes']=_['intersection'](_0x174c5b[_0xce62('0x25')],qs[_0xce62('0x2a')](_0x20f71a[_0xce62('0x29')][_0xce62('0x2a')]));_0x1504ce['attributes']=_0x1504ce['attributes'][_0xce62('0x2b')]?_0x1504ce[_0xce62('0x2c')]:_0x174c5b[_0xce62('0x25')];if(!_0x20f71a['query']['hasOwnProperty'](_0xce62('0x2d'))){_0x1504ce[_0xce62('0x17')]=qs[_0xce62('0x17')](_0x20f71a['query']['limit']);_0x1504ce[_0xce62('0x16')]=qs['offset'](_0x20f71a[_0xce62('0x29')]['offset']);}_0x1504ce['order']=qs[_0xce62('0x2e')](_0x20f71a[_0xce62('0x29')][_0xce62('0x2e')]);_0x1504ce[_0xce62('0x2f')]=qs['filters'](_[_0xce62('0x30')](_0x20f71a['query'],_0x174c5b['filters']),_0x15f172);if(_0x20f71a[_0xce62('0x29')][_0xce62('0x31')]){_0x1504ce[_0xce62('0x2f')]=_[_0xce62('0x32')](_0x1504ce[_0xce62('0x2f')],{'$or':_[_0xce62('0x20')](_0x15f172,function(_0x15d2b5){if(_0x15d2b5[_0xce62('0x23')]!=='VIRTUAL'){var _0x402e02={};_0x402e02[_0x15d2b5[_0xce62('0x1e')]]={'$like':'%'+_0x20f71a[_0xce62('0x29')]['filter']+'%'};return _0x402e02;}})});}_0x1504ce=_[_0xce62('0x32')]({},_0x1504ce,_0x20f71a[_0xce62('0x33')]);var _0x52dd3a={'where':_0x1504ce[_0xce62('0x2f')]};return db[_0xce62('0x21')]['count'](_0x52dd3a)[_0xce62('0x1c')](function(_0x2374d0){_0x7598f4['count']=_0x2374d0;if(_0x20f71a[_0xce62('0x29')]['includeAll']){_0x1504ce[_0xce62('0x34')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x1504ce);})[_0xce62('0x1c')](function(_0x544e41){_0x7598f4['rows']=_0x544e41;return _0x7598f4;})['then'](respondWithFilteredResult(_0x4114f2,_0x1504ce))[_0xce62('0x35')](handleError(_0x4114f2,null));};exports[_0xce62('0x36')]=function(_0x15a7e7,_0x2a6916){var _0x1712f7={'raw':![],'where':{'id':_0x15a7e7['params']['id']}},_0xce5a9={};_0xce5a9[_0xce62('0x25')]=_['keys'](db[_0xce62('0x21')][_0xce62('0x22')]);_0xce5a9['query']=_[_0xce62('0x26')](_0x15a7e7[_0xce62('0x29')]);_0xce5a9['filters']=_['intersection'](_0xce5a9['model'],_0xce5a9['query']);_0x1712f7[_0xce62('0x2c')]=_[_0xce62('0x28')](_0xce5a9[_0xce62('0x25')],qs['fields'](_0x15a7e7['query'][_0xce62('0x2a')]));_0x1712f7['attributes']=_0x1712f7['attributes'][_0xce62('0x2b')]?_0x1712f7['attributes']:_0xce5a9['model'];if(_0x15a7e7['query'][_0xce62('0x37')]){_0x1712f7['include']=[{'all':!![]}];}_0x1712f7=_[_0xce62('0x32')]({},_0x1712f7,_0x15a7e7['options']);return db[_0xce62('0x21')][_0xce62('0x38')](_0x1712f7)[_0xce62('0x1c')](handleEntityNotFound(_0x2a6916,null))[_0xce62('0x1c')](respondWithResult(_0x2a6916,null))[_0xce62('0x35')](handleError(_0x2a6916,null));};exports['create']=function(_0x32b7fa,_0x4fb2b4){return db['Automation'][_0xce62('0x39')](_0x32b7fa[_0xce62('0x3a')],{})[_0xce62('0x1c')](respondWithResult(_0x4fb2b4,0xc9))['catch'](handleError(_0x4fb2b4,null));};exports[_0xce62('0x1b')]=function(_0x20f77a,_0xd9d0a9){if(_0x20f77a[_0xce62('0x3a')]['id']){delete _0x20f77a['body']['id'];}return db[_0xce62('0x21')]['find']({'where':{'id':_0x20f77a[_0xce62('0x3b')]['id']}})['then'](handleEntityNotFound(_0xd9d0a9,null))[_0xce62('0x1c')](saveUpdates(_0x20f77a[_0xce62('0x3a')],null))[_0xce62('0x1c')](respondWithResult(_0xd9d0a9,null))['catch'](handleError(_0xd9d0a9,null));};exports[_0xce62('0x1d')]=function(_0x2ad5ca,_0x44239d){return db[_0xce62('0x21')]['find']({'where':{'id':_0x2ad5ca[_0xce62('0x3b')]['id']}})[_0xce62('0x1c')](handleEntityNotFound(_0x44239d,null))[_0xce62('0x1c')](removeEntity(_0x44239d,null))[_0xce62('0x35')](handleError(_0x44239d,null));};exports['addConditions']=function(_0x4a280f,_0x315ad8,_0x151f45){return db[_0xce62('0x3c')][_0xce62('0x38')]({'where':{'id':_0x4a280f[_0xce62('0x3b')]['id']}})[_0xce62('0x1c')](handleEntityNotFound(_0x315ad8,null))[_0xce62('0x1c')](function(_0x590f04){if(_0x590f04){return _0x590f04[_0xce62('0x3d')](_0x4a280f[_0xce62('0x3a')][_0xce62('0x3e')],_[_0xce62('0x3f')](_0x4a280f[_0xce62('0x3a')],[_0xce62('0x3e'),'id'])||{});}})[_0xce62('0x1c')](respondWithResult(_0x315ad8,null))[_0xce62('0x35')](handleError(_0x315ad8,null));};exports[_0xce62('0x40')]=function(_0x230e8a,_0x1ae580,_0x5027e5){var _0x1cb832={};var _0x2b593c={};var _0x20e0a4;var _0x3b4aea;return db['Automation'][_0xce62('0x41')]({'where':{'id':_0x230e8a[_0xce62('0x3b')]['id']}})[_0xce62('0x1c')](handleEntityNotFound(_0x1ae580,null))[_0xce62('0x1c')](function(_0x568a0d){if(_0x568a0d){_0x20e0a4=_0x568a0d;_0x2b593c['model']=_[_0xce62('0x26')](db[_0xce62('0x3c')][_0xce62('0x22')]);_0x2b593c[_0xce62('0x29')]=_[_0xce62('0x26')](_0x230e8a[_0xce62('0x29')]);_0x2b593c[_0xce62('0x27')]=_[_0xce62('0x28')](_0x2b593c['model'],_0x2b593c[_0xce62('0x29')]);_0x1cb832[_0xce62('0x2c')]=_[_0xce62('0x28')](_0x2b593c[_0xce62('0x25')],qs[_0xce62('0x2a')](_0x230e8a[_0xce62('0x29')][_0xce62('0x2a')]));_0x1cb832[_0xce62('0x2c')]=_0x1cb832['attributes'][_0xce62('0x2b')]?_0x1cb832[_0xce62('0x2c')]:_0x2b593c[_0xce62('0x25')];_0x1cb832[_0xce62('0x42')]=qs[_0xce62('0x2e')](_0x230e8a[_0xce62('0x29')][_0xce62('0x2e')]);_0x1cb832[_0xce62('0x2f')]=qs[_0xce62('0x27')](_['pick'](_0x230e8a['query'],_0x2b593c['filters']));if(_0x230e8a[_0xce62('0x29')][_0xce62('0x31')]){_0x1cb832[_0xce62('0x2f')]=_[_0xce62('0x32')](_0x1cb832['where'],{'$or':_['map'](_0x1cb832[_0xce62('0x2c')],function(_0x17b151){var _0x16f11b={};_0x16f11b[_0x17b151]={'$like':'%'+_0x230e8a[_0xce62('0x29')][_0xce62('0x31')]+'%'};return _0x16f11b;})});}_0x1cb832=_[_0xce62('0x32')]({},_0x1cb832,_0x230e8a[_0xce62('0x33')]);return _0x20e0a4[_0xce62('0x40')](_0x1cb832);}})[_0xce62('0x1c')](function(_0x41994b){if(_0x41994b){_0x3b4aea=_0x41994b[_0xce62('0x2b')];if(!_0x230e8a[_0xce62('0x29')][_0xce62('0x43')](_0xce62('0x2d'))){_0x1cb832[_0xce62('0x17')]=qs[_0xce62('0x17')](_0x230e8a[_0xce62('0x29')][_0xce62('0x17')]);_0x1cb832['offset']=qs[_0xce62('0x16')](_0x230e8a[_0xce62('0x29')][_0xce62('0x16')]);}return _0x20e0a4[_0xce62('0x40')](_0x1cb832);}})['then'](function(_0x4909e8){if(_0x4909e8){return _0x4909e8?{'count':_0x3b4aea,'rows':_0x4909e8}:null;}})[_0xce62('0x1c')](respondWithResult(_0x1ae580,null))[_0xce62('0x35')](handleError(_0x1ae580,null));};exports[_0xce62('0x44')]=function(_0x14f8cc,_0x1b6280,_0x339cab){return db[_0xce62('0x45')][_0xce62('0x38')]({'where':{'id':_0x14f8cc['params']['id']}})['then'](handleEntityNotFound(_0x1b6280,null))[_0xce62('0x1c')](function(_0x8e3547){if(_0x8e3547){return _0x8e3547[_0xce62('0x44')](_0x14f8cc[_0xce62('0x3a')][_0xce62('0x3e')],_[_0xce62('0x3f')](_0x14f8cc[_0xce62('0x3a')],['ids','id'])||{});}})[_0xce62('0x1c')](respondWithResult(_0x1b6280,null))[_0xce62('0x35')](handleError(_0x1b6280,null));};exports[_0xce62('0x46')]=function(_0x3fd24d,_0x4d35c0,_0x20d33a){var _0x19757b={};var _0x50420c={};var _0x253124;var _0x16dbcf;return db[_0xce62('0x21')][_0xce62('0x41')]({'where':{'id':_0x3fd24d[_0xce62('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4d35c0,null))[_0xce62('0x1c')](function(_0x478686){if(_0x478686){_0x253124=_0x478686;_0x50420c[_0xce62('0x25')]=_['keys'](db[_0xce62('0x45')][_0xce62('0x22')]);_0x50420c[_0xce62('0x29')]=_[_0xce62('0x26')](_0x3fd24d[_0xce62('0x29')]);_0x50420c[_0xce62('0x27')]=_[_0xce62('0x28')](_0x50420c[_0xce62('0x25')],_0x50420c[_0xce62('0x29')]);_0x19757b[_0xce62('0x2c')]=_[_0xce62('0x28')](_0x50420c[_0xce62('0x25')],qs[_0xce62('0x2a')](_0x3fd24d[_0xce62('0x29')][_0xce62('0x2a')]));_0x19757b[_0xce62('0x2c')]=_0x19757b[_0xce62('0x2c')][_0xce62('0x2b')]?_0x19757b[_0xce62('0x2c')]:_0x50420c[_0xce62('0x25')];_0x19757b[_0xce62('0x42')]=qs['sort'](_0x3fd24d[_0xce62('0x29')][_0xce62('0x2e')]);_0x19757b[_0xce62('0x2f')]=qs['filters'](_[_0xce62('0x30')](_0x3fd24d[_0xce62('0x29')],_0x50420c[_0xce62('0x27')]));if(_0x3fd24d[_0xce62('0x29')][_0xce62('0x31')]){_0x19757b[_0xce62('0x2f')]=_['merge'](_0x19757b[_0xce62('0x2f')],{'$or':_[_0xce62('0x20')](_0x19757b['attributes'],function(_0x547757){var _0x13e7a6={};_0x13e7a6[_0x547757]={'$like':'%'+_0x3fd24d[_0xce62('0x29')][_0xce62('0x31')]+'%'};return _0x13e7a6;})});}_0x19757b=_['merge']({},_0x19757b,_0x3fd24d[_0xce62('0x33')]);return _0x253124[_0xce62('0x46')](_0x19757b);}})[_0xce62('0x1c')](function(_0xc3da6b){if(_0xc3da6b){_0x16dbcf=_0xc3da6b[_0xce62('0x2b')];if(!_0x3fd24d[_0xce62('0x29')][_0xce62('0x43')](_0xce62('0x2d'))){_0x19757b[_0xce62('0x17')]=qs[_0xce62('0x17')](_0x3fd24d['query'][_0xce62('0x17')]);_0x19757b[_0xce62('0x16')]=qs[_0xce62('0x16')](_0x3fd24d[_0xce62('0x29')][_0xce62('0x16')]);}return _0x253124[_0xce62('0x46')](_0x19757b);}})[_0xce62('0x1c')](function(_0x4b1ece){if(_0x4b1ece){return _0x4b1ece?{'count':_0x16dbcf,'rows':_0x4b1ece}:null;}})[_0xce62('0x1c')](respondWithResult(_0x4d35c0,null))[_0xce62('0x35')](handleError(_0x4d35c0,null));}; \ No newline at end of file +var _0xdd56=['includeAll','findAll','catch','show','params','include','merge','options','find','body','Condition','addConditions','ids','omit','getConditions','addActions','Action','getActions','findOne','eml-format','rimraf','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','end','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','Automation'];(function(_0x253946,_0x1c8d56){var _0x198cd6=function(_0x502fa3){while(--_0x502fa3){_0x253946['push'](_0x253946['shift']());}};_0x198cd6(++_0x1c8d56);}(_0xdd56,0x14f));var _0x6dd5=function(_0x5b60a9,_0x5d54fa){_0x5b60a9=_0x5b60a9-0x0;var _0x53c48f=_0xdd56[_0x5b60a9];return _0x53c48f;};'use strict';var emlformat=require(_0x6dd5('0x0'));var rimraf=require(_0x6dd5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6dd5('0x2'));var moment=require('moment');var BPromise=require(_0x6dd5('0x3'));var Mustache=require(_0x6dd5('0x4'));var util=require(_0x6dd5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6dd5('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6dd5('0x7'));var _=require('lodash');var squel=require(_0x6dd5('0x8'));var crypto=require('crypto');var jsforce=require(_0x6dd5('0x9'));var deskjs=require(_0x6dd5('0xa'));var toCsv=require(_0x6dd5('0x6'));var querystring=require(_0x6dd5('0xb'));var Papa=require(_0x6dd5('0xc'));var Redis=require(_0x6dd5('0xd'));var authService=require(_0x6dd5('0xe'));var qs=require(_0x6dd5('0xf'));var as=require(_0x6dd5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dd5('0x11'))(_0x6dd5('0x12'));var utils=require('../../config/utils');var config=require(_0x6dd5('0x13'));var licenseUtil=require(_0x6dd5('0x14'));var db=require(_0x6dd5('0x15'))['db'];function respondWithStatusCode(_0x764cf4,_0x4b631a){_0x4b631a=_0x4b631a||0xcc;return function(_0x496809){if(_0x496809){return _0x764cf4[_0x6dd5('0x16')](_0x4b631a);}return _0x764cf4[_0x6dd5('0x17')](_0x4b631a)['end']();};}function respondWithResult(_0x2e2283,_0xcacb1a){_0xcacb1a=_0xcacb1a||0xc8;return function(_0xc43822){if(_0xc43822){return _0x2e2283[_0x6dd5('0x17')](_0xcacb1a)[_0x6dd5('0x18')](_0xc43822);}};}function respondWithFilteredResult(_0x255b6e,_0x3a02b9){return function(_0xce7369){if(_0xce7369){var _0x3bb8ae=typeof _0x3a02b9['offset']===_0x6dd5('0x19')&&typeof _0x3a02b9[_0x6dd5('0x1a')]===_0x6dd5('0x19');var _0x5ce9eb=_0xce7369[_0x6dd5('0x1b')];var _0x1b8bdf=_0x3bb8ae?0x0:_0x3a02b9[_0x6dd5('0x1c')];var _0x564c23=_0x3bb8ae?_0xce7369['count']:_0x3a02b9[_0x6dd5('0x1c')]+_0x3a02b9[_0x6dd5('0x1a')];var _0xe7a440;if(_0x564c23>=_0x5ce9eb){_0x564c23=_0x5ce9eb;_0xe7a440=0xc8;}else{_0xe7a440=0xce;}_0x255b6e[_0x6dd5('0x17')](_0xe7a440);return _0x255b6e[_0x6dd5('0x1d')]('Content-Range',_0x1b8bdf+'-'+_0x564c23+'/'+_0x5ce9eb)[_0x6dd5('0x18')](_0xce7369);}return null;};}function patchUpdates(_0x4f726d){return function(_0x101bba){try{jsonpatch[_0x6dd5('0x1e')](_0x101bba,_0x4f726d,!![]);}catch(_0x901e68){return BPromise['reject'](_0x901e68);}return _0x101bba[_0x6dd5('0x1f')]();};}function saveUpdates(_0xe125dc,_0x2741fb){return function(_0x2f64bd){if(_0x2f64bd){return _0x2f64bd[_0x6dd5('0x20')](_0xe125dc)['then'](function(_0x87feaa){return _0x87feaa;});}return null;};}function removeEntity(_0x3b349d,_0x2874a0){return function(_0x27b2c1){if(_0x27b2c1){return _0x27b2c1[_0x6dd5('0x21')]()[_0x6dd5('0x22')](function(){_0x3b349d[_0x6dd5('0x17')](0xcc)[_0x6dd5('0x23')]();});}};}function handleEntityNotFound(_0x198bc8,_0x47601d){return function(_0x5e48b4){if(!_0x5e48b4){_0x198bc8[_0x6dd5('0x16')](0x194);}return _0x5e48b4;};}function handleError(_0x2dfaaf,_0x231297){_0x231297=_0x231297||0x1f4;return function(_0x46ebd3){logger['error'](_0x46ebd3['stack']);if(_0x46ebd3['name']){delete _0x46ebd3[_0x6dd5('0x24')];}_0x2dfaaf[_0x6dd5('0x17')](_0x231297)[_0x6dd5('0x25')](_0x46ebd3);};}exports[_0x6dd5('0x26')]=function(_0x2dd232,_0x2a7235){var _0xc40c7={},_0x33765f={},_0x42910b={'count':0x0,'rows':[]};var _0x3fa34a=_[_0x6dd5('0x27')](db['Automation'][_0x6dd5('0x28')],function(_0x1135f6){return{'name':_0x1135f6[_0x6dd5('0x29')],'type':_0x1135f6['type'][_0x6dd5('0x2a')]};});_0x33765f[_0x6dd5('0x2b')]=_['map'](_0x3fa34a,_0x6dd5('0x24'));_0x33765f[_0x6dd5('0x2c')]=_[_0x6dd5('0x2d')](_0x2dd232['query']);_0x33765f[_0x6dd5('0x2e')]=_['intersection'](_0x33765f[_0x6dd5('0x2b')],_0x33765f[_0x6dd5('0x2c')]);_0xc40c7[_0x6dd5('0x2f')]=_[_0x6dd5('0x30')](_0x33765f[_0x6dd5('0x2b')],qs[_0x6dd5('0x31')](_0x2dd232[_0x6dd5('0x2c')][_0x6dd5('0x31')]));_0xc40c7[_0x6dd5('0x2f')]=_0xc40c7[_0x6dd5('0x2f')][_0x6dd5('0x32')]?_0xc40c7['attributes']:_0x33765f[_0x6dd5('0x2b')];if(!_0x2dd232['query'][_0x6dd5('0x33')](_0x6dd5('0x34'))){_0xc40c7[_0x6dd5('0x1a')]=qs['limit'](_0x2dd232[_0x6dd5('0x2c')]['limit']);_0xc40c7[_0x6dd5('0x1c')]=qs[_0x6dd5('0x1c')](_0x2dd232[_0x6dd5('0x2c')][_0x6dd5('0x1c')]);}_0xc40c7[_0x6dd5('0x35')]=qs['sort'](_0x2dd232[_0x6dd5('0x2c')][_0x6dd5('0x36')]);_0xc40c7[_0x6dd5('0x37')]=qs[_0x6dd5('0x2e')](_[_0x6dd5('0x38')](_0x2dd232[_0x6dd5('0x2c')],_0x33765f['filters']),_0x3fa34a);if(_0x2dd232[_0x6dd5('0x2c')][_0x6dd5('0x39')]){_0xc40c7[_0x6dd5('0x37')]=_['merge'](_0xc40c7[_0x6dd5('0x37')],{'$or':_['map'](_0x3fa34a,function(_0x57b2ed){if(_0x57b2ed[_0x6dd5('0x3a')]!=='VIRTUAL'){var _0x4b4419={};_0x4b4419[_0x57b2ed['name']]={'$like':'%'+_0x2dd232[_0x6dd5('0x2c')][_0x6dd5('0x39')]+'%'};return _0x4b4419;}})});}_0xc40c7=_['merge']({},_0xc40c7,_0x2dd232['options']);var _0xf523ae={'where':_0xc40c7[_0x6dd5('0x37')]};return db[_0x6dd5('0x3b')][_0x6dd5('0x1b')](_0xf523ae)['then'](function(_0x44ed25){_0x42910b[_0x6dd5('0x1b')]=_0x44ed25;if(_0x2dd232[_0x6dd5('0x2c')][_0x6dd5('0x3c')]){_0xc40c7['include']=[{'all':!![]}];}return db[_0x6dd5('0x3b')][_0x6dd5('0x3d')](_0xc40c7);})[_0x6dd5('0x22')](function(_0x2abbbd){_0x42910b['rows']=_0x2abbbd;return _0x42910b;})[_0x6dd5('0x22')](respondWithFilteredResult(_0x2a7235,_0xc40c7))[_0x6dd5('0x3e')](handleError(_0x2a7235,null));};exports[_0x6dd5('0x3f')]=function(_0x4b4b56,_0x3356a3){var _0x2e4562={'raw':![],'where':{'id':_0x4b4b56[_0x6dd5('0x40')]['id']}},_0x31e62c={};_0x31e62c[_0x6dd5('0x2b')]=_[_0x6dd5('0x2d')](db[_0x6dd5('0x3b')]['rawAttributes']);_0x31e62c[_0x6dd5('0x2c')]=_[_0x6dd5('0x2d')](_0x4b4b56[_0x6dd5('0x2c')]);_0x31e62c[_0x6dd5('0x2e')]=_[_0x6dd5('0x30')](_0x31e62c[_0x6dd5('0x2b')],_0x31e62c['query']);_0x2e4562[_0x6dd5('0x2f')]=_[_0x6dd5('0x30')](_0x31e62c[_0x6dd5('0x2b')],qs[_0x6dd5('0x31')](_0x4b4b56[_0x6dd5('0x2c')][_0x6dd5('0x31')]));_0x2e4562[_0x6dd5('0x2f')]=_0x2e4562[_0x6dd5('0x2f')][_0x6dd5('0x32')]?_0x2e4562[_0x6dd5('0x2f')]:_0x31e62c['model'];if(_0x4b4b56[_0x6dd5('0x2c')][_0x6dd5('0x3c')]){_0x2e4562[_0x6dd5('0x41')]=[{'all':!![]}];}_0x2e4562=_[_0x6dd5('0x42')]({},_0x2e4562,_0x4b4b56[_0x6dd5('0x43')]);return db[_0x6dd5('0x3b')][_0x6dd5('0x44')](_0x2e4562)[_0x6dd5('0x22')](handleEntityNotFound(_0x3356a3,null))[_0x6dd5('0x22')](respondWithResult(_0x3356a3,null))[_0x6dd5('0x3e')](handleError(_0x3356a3,null));};exports['create']=function(_0x3a371e,_0x2d47d6){return db[_0x6dd5('0x3b')]['create'](_0x3a371e[_0x6dd5('0x45')],{})[_0x6dd5('0x22')](respondWithResult(_0x2d47d6,0xc9))[_0x6dd5('0x3e')](handleError(_0x2d47d6,null));};exports['update']=function(_0x10f94f,_0x584bbf){if(_0x10f94f[_0x6dd5('0x45')]['id']){delete _0x10f94f[_0x6dd5('0x45')]['id'];}return db['Automation'][_0x6dd5('0x44')]({'where':{'id':_0x10f94f[_0x6dd5('0x40')]['id']}})[_0x6dd5('0x22')](handleEntityNotFound(_0x584bbf,null))[_0x6dd5('0x22')](saveUpdates(_0x10f94f[_0x6dd5('0x45')],null))[_0x6dd5('0x22')](respondWithResult(_0x584bbf,null))[_0x6dd5('0x3e')](handleError(_0x584bbf,null));};exports[_0x6dd5('0x21')]=function(_0x1f6650,_0x5f43d3){return db['Automation'][_0x6dd5('0x44')]({'where':{'id':_0x1f6650['params']['id']}})[_0x6dd5('0x22')](handleEntityNotFound(_0x5f43d3,null))[_0x6dd5('0x22')](removeEntity(_0x5f43d3,null))[_0x6dd5('0x3e')](handleError(_0x5f43d3,null));};exports['addConditions']=function(_0x1b2d88,_0x434017,_0x4f3ad6){return db[_0x6dd5('0x46')]['find']({'where':{'id':_0x1b2d88[_0x6dd5('0x40')]['id']}})['then'](handleEntityNotFound(_0x434017,null))[_0x6dd5('0x22')](function(_0x36a6b9){if(_0x36a6b9){return _0x36a6b9[_0x6dd5('0x47')](_0x1b2d88[_0x6dd5('0x45')][_0x6dd5('0x48')],_[_0x6dd5('0x49')](_0x1b2d88[_0x6dd5('0x45')],[_0x6dd5('0x48'),'id'])||{});}})[_0x6dd5('0x22')](respondWithResult(_0x434017,null))[_0x6dd5('0x3e')](handleError(_0x434017,null));};exports[_0x6dd5('0x4a')]=function(_0x5a1300,_0x3b99ee,_0x271a4a){var _0x49ff71={};var _0x30d906={};var _0x125fd6;var _0x16fd48;return db['Automation']['findOne']({'where':{'id':_0x5a1300[_0x6dd5('0x40')]['id']}})[_0x6dd5('0x22')](handleEntityNotFound(_0x3b99ee,null))[_0x6dd5('0x22')](function(_0x176498){if(_0x176498){_0x125fd6=_0x176498;_0x30d906[_0x6dd5('0x2b')]=_[_0x6dd5('0x2d')](db[_0x6dd5('0x46')]['rawAttributes']);_0x30d906['query']=_[_0x6dd5('0x2d')](_0x5a1300['query']);_0x30d906[_0x6dd5('0x2e')]=_['intersection'](_0x30d906[_0x6dd5('0x2b')],_0x30d906[_0x6dd5('0x2c')]);_0x49ff71[_0x6dd5('0x2f')]=_[_0x6dd5('0x30')](_0x30d906['model'],qs['fields'](_0x5a1300[_0x6dd5('0x2c')]['fields']));_0x49ff71[_0x6dd5('0x2f')]=_0x49ff71['attributes'][_0x6dd5('0x32')]?_0x49ff71[_0x6dd5('0x2f')]:_0x30d906[_0x6dd5('0x2b')];_0x49ff71[_0x6dd5('0x35')]=qs[_0x6dd5('0x36')](_0x5a1300['query'][_0x6dd5('0x36')]);_0x49ff71['where']=qs[_0x6dd5('0x2e')](_[_0x6dd5('0x38')](_0x5a1300['query'],_0x30d906[_0x6dd5('0x2e')]));if(_0x5a1300[_0x6dd5('0x2c')][_0x6dd5('0x39')]){_0x49ff71[_0x6dd5('0x37')]=_[_0x6dd5('0x42')](_0x49ff71[_0x6dd5('0x37')],{'$or':_[_0x6dd5('0x27')](_0x49ff71[_0x6dd5('0x2f')],function(_0x30607e){var _0x5aef7e={};_0x5aef7e[_0x30607e]={'$like':'%'+_0x5a1300[_0x6dd5('0x2c')][_0x6dd5('0x39')]+'%'};return _0x5aef7e;})});}_0x49ff71=_[_0x6dd5('0x42')]({},_0x49ff71,_0x5a1300[_0x6dd5('0x43')]);return _0x125fd6['getConditions'](_0x49ff71);}})['then'](function(_0x2c99cf){if(_0x2c99cf){_0x16fd48=_0x2c99cf[_0x6dd5('0x32')];if(!_0x5a1300[_0x6dd5('0x2c')][_0x6dd5('0x33')](_0x6dd5('0x34'))){_0x49ff71['limit']=qs[_0x6dd5('0x1a')](_0x5a1300[_0x6dd5('0x2c')][_0x6dd5('0x1a')]);_0x49ff71[_0x6dd5('0x1c')]=qs[_0x6dd5('0x1c')](_0x5a1300[_0x6dd5('0x2c')][_0x6dd5('0x1c')]);}return _0x125fd6[_0x6dd5('0x4a')](_0x49ff71);}})['then'](function(_0x1060b7){if(_0x1060b7){return _0x1060b7?{'count':_0x16fd48,'rows':_0x1060b7}:null;}})[_0x6dd5('0x22')](respondWithResult(_0x3b99ee,null))[_0x6dd5('0x3e')](handleError(_0x3b99ee,null));};exports[_0x6dd5('0x4b')]=function(_0x1a7ded,_0x55f013,_0x31531f){return db[_0x6dd5('0x4c')][_0x6dd5('0x44')]({'where':{'id':_0x1a7ded['params']['id']}})[_0x6dd5('0x22')](handleEntityNotFound(_0x55f013,null))['then'](function(_0x6320ad){if(_0x6320ad){return _0x6320ad['addActions'](_0x1a7ded[_0x6dd5('0x45')][_0x6dd5('0x48')],_['omit'](_0x1a7ded[_0x6dd5('0x45')],['ids','id'])||{});}})[_0x6dd5('0x22')](respondWithResult(_0x55f013,null))[_0x6dd5('0x3e')](handleError(_0x55f013,null));};exports[_0x6dd5('0x4d')]=function(_0x46c530,_0x13d832,_0x4335af){var _0x218b7e={};var _0x1b50a2={};var _0x6d890f;var _0x582640;return db['Automation'][_0x6dd5('0x4e')]({'where':{'id':_0x46c530['params']['id']}})[_0x6dd5('0x22')](handleEntityNotFound(_0x13d832,null))[_0x6dd5('0x22')](function(_0x3ac60b){if(_0x3ac60b){_0x6d890f=_0x3ac60b;_0x1b50a2[_0x6dd5('0x2b')]=_[_0x6dd5('0x2d')](db[_0x6dd5('0x4c')]['rawAttributes']);_0x1b50a2[_0x6dd5('0x2c')]=_['keys'](_0x46c530[_0x6dd5('0x2c')]);_0x1b50a2[_0x6dd5('0x2e')]=_[_0x6dd5('0x30')](_0x1b50a2['model'],_0x1b50a2['query']);_0x218b7e[_0x6dd5('0x2f')]=_[_0x6dd5('0x30')](_0x1b50a2[_0x6dd5('0x2b')],qs['fields'](_0x46c530['query']['fields']));_0x218b7e[_0x6dd5('0x2f')]=_0x218b7e[_0x6dd5('0x2f')][_0x6dd5('0x32')]?_0x218b7e['attributes']:_0x1b50a2[_0x6dd5('0x2b')];_0x218b7e[_0x6dd5('0x35')]=qs['sort'](_0x46c530[_0x6dd5('0x2c')]['sort']);_0x218b7e['where']=qs[_0x6dd5('0x2e')](_[_0x6dd5('0x38')](_0x46c530['query'],_0x1b50a2[_0x6dd5('0x2e')]));if(_0x46c530[_0x6dd5('0x2c')][_0x6dd5('0x39')]){_0x218b7e[_0x6dd5('0x37')]=_['merge'](_0x218b7e[_0x6dd5('0x37')],{'$or':_[_0x6dd5('0x27')](_0x218b7e[_0x6dd5('0x2f')],function(_0x3c315b){var _0x40a298={};_0x40a298[_0x3c315b]={'$like':'%'+_0x46c530[_0x6dd5('0x2c')][_0x6dd5('0x39')]+'%'};return _0x40a298;})});}_0x218b7e=_[_0x6dd5('0x42')]({},_0x218b7e,_0x46c530[_0x6dd5('0x43')]);return _0x6d890f['getActions'](_0x218b7e);}})[_0x6dd5('0x22')](function(_0x1cf07e){if(_0x1cf07e){_0x582640=_0x1cf07e[_0x6dd5('0x32')];if(!_0x46c530[_0x6dd5('0x2c')][_0x6dd5('0x33')](_0x6dd5('0x34'))){_0x218b7e[_0x6dd5('0x1a')]=qs['limit'](_0x46c530[_0x6dd5('0x2c')][_0x6dd5('0x1a')]);_0x218b7e[_0x6dd5('0x1c')]=qs['offset'](_0x46c530['query']['offset']);}return _0x6d890f['getActions'](_0x218b7e);}})[_0x6dd5('0x22')](function(_0xa3b917){if(_0xa3b917){return _0xa3b917?{'count':_0x582640,'rows':_0xa3b917}:null;}})[_0x6dd5('0x22')](respondWithResult(_0x13d832,null))[_0x6dd5('0x3e')](handleError(_0x13d832,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 9548d52..dac4c6a 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 _0xf9c0=['rimraf','../../config/environment','exports','define','tools_automations','util','../../config/logger','moment','request-promise'];(function(_0x173df4,_0x5016fb){var _0x3ac206=function(_0x532cbb){while(--_0x532cbb){_0x173df4['push'](_0x173df4['shift']());}};_0x3ac206(++_0x5016fb);}(_0xf9c0,0x176));var _0x0f9c=function(_0x5c3e51,_0xfeaf8){_0x5c3e51=_0x5c3e51-0x0;var _0xd53ad5=_0xf9c0[_0x5c3e51];return _0xd53ad5;};'use strict';var _=require('lodash');var util=require(_0x0f9c('0x0'));var logger=require(_0x0f9c('0x1'))('api');var moment=require(_0x0f9c('0x2'));var BPromise=require('bluebird');var rp=require(_0x0f9c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f9c('0x4'));var config=require(_0x0f9c('0x5'));var attributes=require('./automation.attributes');module[_0x0f9c('0x6')]=function(_0xb63435,_0x1835f2){return _0xb63435[_0x0f9c('0x7')]('Automation',attributes,{'tableName':_0x0f9c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9740=['Automation','tools_automations','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./automation.attributes','define'];(function(_0x4c7b2a,_0x2d2401){var _0x4e23c7=function(_0x388e42){while(--_0x388e42){_0x4c7b2a['push'](_0x4c7b2a['shift']());}};_0x4e23c7(++_0x2d2401);}(_0x9740,0x110));var _0x0974=function(_0x1a2693,_0x5b4d6f){_0x1a2693=_0x1a2693-0x0;var _0x4eb10e=_0x9740[_0x1a2693];return _0x4eb10e;};'use strict';var _=require('lodash');var util=require(_0x0974('0x0'));var logger=require(_0x0974('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0974('0x2'));var rp=require(_0x0974('0x3'));var fs=require('fs');var path=require(_0x0974('0x4'));var rimraf=require('rimraf');var config=require(_0x0974('0x5'));var attributes=require(_0x0974('0x6'));module['exports']=function(_0x4c0070,_0x31d59b){return _0x4c0070[_0x0974('0x7')](_0x0974('0x8'),attributes,{'tableName':_0x0974('0x9'),'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 ac8fd62..bfe64d5 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 _0xfff0=['../../config/environment','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4c4ce4,_0x50d3d8){var _0x2bdcc8=function(_0x4801d2){while(--_0x4801d2){_0x4c4ce4['push'](_0x4c4ce4['shift']());}};_0x2bdcc8(++_0x50d3d8);}(_0xfff0,0x139));var _0x0fff=function(_0x11be98,_0x2a9bf1){_0x11be98=_0x11be98-0x0;var _0x3359a5=_0xfff0[_0x11be98];return _0x3359a5;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('Automation,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});} \ No newline at end of file +var _0xbc87=['stringify','error','code','message','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x9e1aec,_0x5713ab){var _0x12d017=function(_0x4b47f6){while(--_0x4b47f6){_0x9e1aec['push'](_0x9e1aec['shift']());}};_0x12d017(++_0x5713ab);}(_0xbc87,0x144));var _0x7bc8=function(_0x22133e,_0x5d59ca){_0x22133e=_0x22133e-0x0;var _0xac5bfe=_0xbc87[_0x22133e];return _0xac5bfe;};'use strict';var _=require(_0x7bc8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7bc8('0x1'));var rs=require(_0x7bc8('0x2'));var fs=require('fs');var Redis=require(_0x7bc8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7bc8('0x4'))(_0x7bc8('0x5'));var config=require(_0x7bc8('0x6'));var jayson=require(_0x7bc8('0x7'));var client=jayson[_0x7bc8('0x8')][_0x7bc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x410b95,_0x2e1d63,_0x1fcc43){return new BPromise(function(_0x466ed5,_0xb87048){return client[_0x7bc8('0xa')](_0x410b95,_0x1fcc43)[_0x7bc8('0xb')](function(_0x368899){logger[_0x7bc8('0xc')](_0x7bc8('0xd'),_0x2e1d63,_0x7bc8('0xe'));logger['debug'](_0x7bc8('0xf'),_0x2e1d63,'request\x20sent',JSON[_0x7bc8('0x10')](_0x368899));if(_0x368899[_0x7bc8('0x11')]){if(_0x368899[_0x7bc8('0x11')][_0x7bc8('0x12')]===0x1f4){logger[_0x7bc8('0x11')](_0x7bc8('0xd'),_0x2e1d63,_0x368899['error'][_0x7bc8('0x13')]);return _0xb87048(_0x368899[_0x7bc8('0x11')]['message']);}logger[_0x7bc8('0x11')]('Automation,\x20%s,\x20%s',_0x2e1d63,_0x368899[_0x7bc8('0x11')][_0x7bc8('0x13')]);return _0x466ed5(_0x368899[_0x7bc8('0x11')][_0x7bc8('0x13')]);}else{logger[_0x7bc8('0xc')]('Automation,\x20%s,\x20%s',_0x2e1d63,_0x7bc8('0xe'));_0x466ed5(_0x368899['result'][_0x7bc8('0x13')]);}})['catch'](function(_0x455f9a){logger[_0x7bc8('0x11')](_0x7bc8('0xd'),_0x2e1d63,_0x455f9a);_0xb87048(_0x455f9a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 9f248c9..6689051 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 _0x323f=['get','/:id','show','/:id/conditions','post','create','/:id/actions','addActions','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index'];(function(_0xfefda5,_0x38d020){var _0x2bac82=function(_0xaa512){while(--_0xaa512){_0xfefda5['push'](_0xfefda5['shift']());}};_0x2bac82(++_0x38d020);}(_0x323f,0xde));var _0xf323=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x323f[_0x4154a6];return _0x3b2786;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require('express');var router=express[_0xf323('0x2')]();var fs_extra=require(_0xf323('0x3'));var auth=require(_0xf323('0x4'));var interaction=require(_0xf323('0x5'));var config=require('../../config/environment');var controller=require(_0xf323('0x6'));router['get']('/',auth[_0xf323('0x7')](),controller[_0xf323('0x8')]);router[_0xf323('0x9')](_0xf323('0xa'),auth[_0xf323('0x7')](),controller[_0xf323('0xb')]);router[_0xf323('0x9')](_0xf323('0xc'),auth[_0xf323('0x7')](),controller['getConditions']);router[_0xf323('0x9')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0xf323('0xd')]('/',auth[_0xf323('0x7')](),controller[_0xf323('0xe')]);router['post'](_0xf323('0xc'),auth[_0xf323('0x7')](),controller['addConditions']);router[_0xf323('0xd')](_0xf323('0xf'),auth[_0xf323('0x7')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xa'),auth['isAuthenticated'](),controller[_0xf323('0x12')]);router[_0xf323('0x13')](_0xf323('0xa'),auth[_0xf323('0x7')](),controller['destroy']);module[_0xf323('0x14')]=router; \ No newline at end of file +var _0xc906=['./automation.controller','get','isAuthenticated','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b51ea,_0x394fd9){var _0x18bbdc=function(_0x45b83f){while(--_0x45b83f){_0x1b51ea['push'](_0x1b51ea['shift']());}};_0x18bbdc(++_0x394fd9);}(_0xc906,0x1ad));var _0x6c90=function(_0x598515,_0x557975){_0x598515=_0x598515-0x0;var _0x47c402=_0xc906[_0x598515];return _0x47c402;};'use strict';var multer=require(_0x6c90('0x0'));var util=require(_0x6c90('0x1'));var path=require('path');var timeout=require(_0x6c90('0x2'));var express=require(_0x6c90('0x3'));var router=express[_0x6c90('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c90('0x5'));var interaction=require(_0x6c90('0x6'));var config=require(_0x6c90('0x7'));var controller=require(_0x6c90('0x8'));router[_0x6c90('0x9')]('/',auth[_0x6c90('0xa')](),controller['index']);router['get']('/:id',auth[_0x6c90('0xa')](),controller['show']);router[_0x6c90('0x9')](_0x6c90('0xb'),auth[_0x6c90('0xa')](),controller[_0x6c90('0xc')]);router[_0x6c90('0x9')](_0x6c90('0xd'),auth[_0x6c90('0xa')](),controller[_0x6c90('0xe')]);router[_0x6c90('0xf')]('/',auth[_0x6c90('0xa')](),controller[_0x6c90('0x10')]);router[_0x6c90('0xf')](_0x6c90('0xb'),auth[_0x6c90('0xa')](),controller['addConditions']);router['post'](_0x6c90('0xd'),auth[_0x6c90('0xa')](),controller[_0x6c90('0x11')]);router[_0x6c90('0x12')](_0x6c90('0x13'),auth[_0x6c90('0xa')](),controller[_0x6c90('0x14')]);router[_0x6c90('0x15')](_0x6c90('0x13'),auth[_0x6c90('0xa')](),controller['destroy']);module[_0x6c90('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index bd4116a..b4889de 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 _0x20d3=['DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','name','ENUM','ivr','STRING','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x20d3,0xb9));var _0x320d=function(_0x25b738,_0x5c3de6){_0x25b738=_0x25b738-0x0;var _0x2c1051=_0x20d3[_0x25b738];return _0x2c1051;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x320d('0x0'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x320d('0x1')](_0x320d('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x320d('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x320d('0x4')](0x4)[_0x320d('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x320d('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x320d('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x320d('0x4')](0x3)[_0x320d('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x320d('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x320d('0x4')](0x3)[_0x320d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x320d('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x320d('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x320d('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x320d('0x4')](0x3)[_0x320d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x320d('0x4')](0x5)[_0x320d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x320d('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x320d('0x4')](0x3)[_0x320d('0x5')],'defaultValue':0x3,'comment':_0x320d('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x320d('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x320d('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x320d('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0x320d('0x1')](_0x320d('0xd'),_0x320d('0xe'),_0x320d('0xf')),'defaultValue':_0x320d('0xd')},'dialAMDActive':{'type':Sequelize[_0x320d('0x10')],'defaultValue':0x0,'comment':_0x320d('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x320d('0x4')](0x9)[_0x320d('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x320d('0x4')](0x9)[_0x320d('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x320d('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x320d('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x320d('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x320d('0x4')](0x9)[_0x320d('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x320d('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x320d('0x4')](0x9)[_0x320d('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x320d('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x320d('0x4')](0x9)[_0x320d('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x320d('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x320d('0x4')](0x9)[_0x320d('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x320d('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x320d('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x320d('0x4')](0x9)[_0x320d('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x320d('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x320d('0x1')](_0x320d('0x19'),_0x320d('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x320d('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x320d('0x4')](0x3)[_0x320d('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x320d('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x320d('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x320d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x320d('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x320d('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x320d('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x320d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x320d('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x320d('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x320d('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x320d('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x320d('0x4')](0x3)[_0x320d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x320d('0x4')](0x5)[_0x320d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x320d('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x320d('0x4')](0x3)[_0x320d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x320d('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x320d('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x320d('0x22')}}; \ No newline at end of file +var _0xbbbd=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','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)','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\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','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x171b79,_0x5204e7){var _0x24f1d6=function(_0x311f68){while(--_0x311f68){_0x171b79['push'](_0x171b79['shift']());}};_0x24f1d6(++_0x5204e7);}(_0xbbbd,0xaa));var _0xdbbb=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xbbbd[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0xdbbb('0x0'));module[_0xdbbb('0x1')]={'name':{'type':Sequelize[_0xdbbb('0x2')],'unique':_0xdbbb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdbbb('0x4')),'allowNull':![],'defaultValue':_0xdbbb('0x4')},'description':{'type':Sequelize[_0xdbbb('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xdbbb('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdbbb('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdbbb('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdbbb('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xdbbb('0x7')](0x3)[_0xdbbb('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)[_0xdbbb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbbb('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdbbb('0x7')](0x5)[_0xdbbb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbbb('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)[_0xdbbb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdbbb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbbb('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)[_0xdbbb('0x8')],'defaultValue':0x3,'comment':_0xdbbb('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdbbb('0x7')](0x5)[_0xdbbb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdbbb('0xd')},'dialTimezone':{'type':Sequelize[_0xdbbb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdbbb('0x2')],'defaultValue':_0xdbbb('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xdbbb('0xf'),_0xdbbb('0x10'),_0xdbbb('0x11')),'defaultValue':_0xdbbb('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xdbbb('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdbbb('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdbbb('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xdbbb('0x7')](0x9)[_0xdbbb('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdbbb('0x7')](0x9)[_0xdbbb('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdbbb('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdbbb('0x7')](0x9)[_0xdbbb('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdbbb('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xdbbb('0x7')](0x9)[_0xdbbb('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdbbb('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdbbb('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdbbb('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdbbb('0x7')](0x9)[_0xdbbb('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdbbb('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdbbb('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdbbb('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdbbb('0x7')](0x9)[_0xdbbb('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdbbb('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdbbb('0x1b')](_0xdbbb('0x1c'),'ASC'),'defaultValue':_0xdbbb('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xdbbb('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdbbb('0x1d')},'dialCutDigit':{'type':Sequelize[_0xdbbb('0x7')](0x3)[_0xdbbb('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdbbb('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdbbb('0x7')](0x5)[_0xdbbb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbbb('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)[_0xdbbb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbbb('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xdbbb('0x7')](0x5)[_0xdbbb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbbb('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)[_0xdbbb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbbb('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdbbb('0x7')](0x5)[_0xdbbb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbbb('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xdbbb('0x7')](0x5)[_0xdbbb('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbbb('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdbbb('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbbb('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdbbb('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbbb('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9a8c4bf..d41453c 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 _0x4e62=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','clone','length','omit','createdAt','updatedAt','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','into','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','push','sequelize','removeLists','getBlackLists','addBlackLists','all','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','end','sendStatus','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','show','params','find','create','body','user'];(function(_0x475a91,_0x299ed2){var _0x3eea6e=function(_0x490b66){while(--_0x490b66){_0x475a91['push'](_0x475a91['shift']());}};_0x3eea6e(++_0x299ed2);}(_0x4e62,0x1d1));var _0x24e6=function(_0xadadf3,_0x24e12d){_0xadadf3=_0xadadf3-0x0;var _0x58b72e=_0x4e62[_0xadadf3];return _0x58b72e;};'use strict';var emlformat=require(_0x24e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24e6('0x1'));var jsonpatch=require(_0x24e6('0x2'));var rp=require(_0x24e6('0x3'));var moment=require(_0x24e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x24e6('0x5'));var util=require('util');var path=require(_0x24e6('0x6'));var sox=require(_0x24e6('0x7'));var csv=require(_0x24e6('0x8'));var ejs=require(_0x24e6('0x9'));var fs=require('fs');var fs_extra=require(_0x24e6('0xa'));var _=require(_0x24e6('0xb'));var squel=require(_0x24e6('0xc'));var crypto=require(_0x24e6('0xd'));var jsforce=require(_0x24e6('0xe'));var deskjs=require(_0x24e6('0xf'));var toCsv=require(_0x24e6('0x8'));var querystring=require('querystring');var Papa=require(_0x24e6('0x10'));var Redis=require(_0x24e6('0x11'));var authService=require(_0x24e6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x24e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24e6('0x14'))(_0x24e6('0x15'));var utils=require('../../config/utils');var config=require(_0x24e6('0x16'));var licenseUtil=require(_0x24e6('0x17'));var db=require(_0x24e6('0x18'))['db'];function respondWithStatusCode(_0x310951,_0x22656a){_0x22656a=_0x22656a||0xcc;return function(_0x2aa8bc){if(_0x2aa8bc){return _0x310951['sendStatus'](_0x22656a);}return _0x310951[_0x24e6('0x19')](_0x22656a)['end']();};}function respondWithResult(_0x86132c,_0x399a1d){_0x399a1d=_0x399a1d||0xc8;return function(_0x5f40e6){if(_0x5f40e6){return _0x86132c[_0x24e6('0x19')](_0x399a1d)[_0x24e6('0x1a')](_0x5f40e6);}};}function respondWithFilteredResult(_0xfb9817,_0x2efa21){return function(_0xad2759){if(_0xad2759){var _0x4d6812=typeof _0x2efa21[_0x24e6('0x1b')]===_0x24e6('0x1c')&&typeof _0x2efa21[_0x24e6('0x1d')]===_0x24e6('0x1c');var _0x3fd860=_0xad2759[_0x24e6('0x1e')];var _0x4d0c16=_0x4d6812?0x0:_0x2efa21[_0x24e6('0x1b')];var _0x417f19=_0x4d6812?_0xad2759['count']:_0x2efa21['offset']+_0x2efa21[_0x24e6('0x1d')];var _0x16696c;if(_0x417f19>=_0x3fd860){_0x417f19=_0x3fd860;_0x16696c=0xc8;}else{_0x16696c=0xce;}_0xfb9817['status'](_0x16696c);return _0xfb9817[_0x24e6('0x1f')](_0x24e6('0x20'),_0x4d0c16+'-'+_0x417f19+'/'+_0x3fd860)[_0x24e6('0x1a')](_0xad2759);}return null;};}function patchUpdates(_0x3db125){return function(_0x357392){try{jsonpatch[_0x24e6('0x21')](_0x357392,_0x3db125,!![]);}catch(_0x3dd7ba){return BPromise[_0x24e6('0x22')](_0x3dd7ba);}return _0x357392[_0x24e6('0x23')]();};}function saveUpdates(_0x1c84f9,_0x148475){return function(_0x318684){if(_0x318684){return _0x318684['update'](_0x1c84f9)[_0x24e6('0x24')](function(_0x277566){return _0x277566;});}return null;};}function removeEntity(_0x4953ed,_0x1ddfc3){return function(_0x2ade79){if(_0x2ade79){return _0x2ade79[_0x24e6('0x25')]()[_0x24e6('0x24')](function(){var _0x31241f=_0x2ade79[_0x24e6('0x26')]({'plain':!![]});var _0x270755=_0x24e6('0x27');return db[_0x24e6('0x28')][_0x24e6('0x25')]({'where':{'type':_0x270755,'resourceId':_0x31241f['id']}})[_0x24e6('0x24')](function(){return _0x2ade79;});})[_0x24e6('0x24')](function(){_0x4953ed[_0x24e6('0x19')](0xcc)[_0x24e6('0x29')]();});}};}function handleEntityNotFound(_0x3c2c05,_0x4a6aef){return function(_0x6bcfd9){if(!_0x6bcfd9){_0x3c2c05[_0x24e6('0x2a')](0x194);}return _0x6bcfd9;};}function handleError(_0x35c2b6,_0xa15ed9){_0xa15ed9=_0xa15ed9||0x1f4;return function(_0x3ffebb){logger[_0x24e6('0x2b')](_0x3ffebb[_0x24e6('0x2c')]);if(_0x3ffebb[_0x24e6('0x2d')]){delete _0x3ffebb[_0x24e6('0x2d')];}_0x35c2b6['status'](_0xa15ed9)['send'](_0x3ffebb);};}exports[_0x24e6('0x2e')]=function(_0x2fd4e0,_0x59c830){var _0x15107e={},_0x1155bb={},_0x523298={'count':0x0,'rows':[]};var _0x469f47=_[_0x24e6('0x2f')](db['Campaign'][_0x24e6('0x30')],function(_0x209682){return{'name':_0x209682['fieldName'],'type':_0x209682['type'][_0x24e6('0x31')]};});_0x1155bb[_0x24e6('0x32')]=_['map'](_0x469f47,_0x24e6('0x2d'));_0x1155bb[_0x24e6('0x33')]=_[_0x24e6('0x34')](_0x2fd4e0[_0x24e6('0x33')]);_0x1155bb[_0x24e6('0x35')]=_[_0x24e6('0x36')](_0x1155bb['model'],_0x1155bb[_0x24e6('0x33')]);_0x15107e[_0x24e6('0x37')]=_[_0x24e6('0x36')](_0x1155bb[_0x24e6('0x32')],qs[_0x24e6('0x38')](_0x2fd4e0[_0x24e6('0x33')]['fields']));_0x15107e[_0x24e6('0x37')]=_0x15107e[_0x24e6('0x37')]['length']?_0x15107e[_0x24e6('0x37')]:_0x1155bb[_0x24e6('0x32')];if(!_0x2fd4e0[_0x24e6('0x33')][_0x24e6('0x39')](_0x24e6('0x3a'))){_0x15107e['limit']=qs[_0x24e6('0x1d')](_0x2fd4e0[_0x24e6('0x33')][_0x24e6('0x1d')]);_0x15107e[_0x24e6('0x1b')]=qs[_0x24e6('0x1b')](_0x2fd4e0[_0x24e6('0x33')][_0x24e6('0x1b')]);}_0x15107e[_0x24e6('0x3b')]=qs[_0x24e6('0x3c')](_0x2fd4e0[_0x24e6('0x33')][_0x24e6('0x3c')]);_0x15107e['where']=qs[_0x24e6('0x35')](_[_0x24e6('0x3d')](_0x2fd4e0[_0x24e6('0x33')],_0x1155bb[_0x24e6('0x35')]),_0x469f47);if(_0x2fd4e0[_0x24e6('0x33')][_0x24e6('0x3e')]){_0x15107e[_0x24e6('0x3f')]=_[_0x24e6('0x40')](_0x15107e[_0x24e6('0x3f')],{'$or':_[_0x24e6('0x2f')](_0x469f47,function(_0x2c5734){if(_0x2c5734['type']!==_0x24e6('0x41')){var _0x449614={};_0x449614[_0x2c5734['name']]={'$like':'%'+_0x2fd4e0['query'][_0x24e6('0x3e')]+'%'};return _0x449614;}})});}_0x15107e=_[_0x24e6('0x40')]({},_0x15107e,_0x2fd4e0[_0x24e6('0x42')]);var _0x278fe5={'where':_0x15107e[_0x24e6('0x3f')]};return db[_0x24e6('0x43')][_0x24e6('0x1e')](_0x278fe5)[_0x24e6('0x24')](function(_0x4e2ce0){_0x523298['count']=_0x4e2ce0;if(_0x2fd4e0[_0x24e6('0x33')][_0x24e6('0x44')]){_0x15107e[_0x24e6('0x45')]=[{'all':!![]}];}return db[_0x24e6('0x43')][_0x24e6('0x46')](_0x15107e);})[_0x24e6('0x24')](function(_0x338c7a){_0x523298[_0x24e6('0x47')]=_0x338c7a;return _0x523298;})[_0x24e6('0x24')](respondWithFilteredResult(_0x59c830,_0x15107e))[_0x24e6('0x48')](handleError(_0x59c830,null));};exports[_0x24e6('0x49')]=function(_0xad3cef,_0x22550e){var _0x239c02={'raw':![],'where':{'id':_0xad3cef[_0x24e6('0x4a')]['id']}},_0x175dd9={};_0x175dd9['model']=_[_0x24e6('0x34')](db[_0x24e6('0x43')][_0x24e6('0x30')]);_0x175dd9['query']=_['keys'](_0xad3cef[_0x24e6('0x33')]);_0x175dd9[_0x24e6('0x35')]=_['intersection'](_0x175dd9[_0x24e6('0x32')],_0x175dd9[_0x24e6('0x33')]);_0x239c02[_0x24e6('0x37')]=_[_0x24e6('0x36')](_0x175dd9[_0x24e6('0x32')],qs[_0x24e6('0x38')](_0xad3cef[_0x24e6('0x33')]['fields']));_0x239c02[_0x24e6('0x37')]=_0x239c02['attributes']['length']?_0x239c02['attributes']:_0x175dd9[_0x24e6('0x32')];if(_0xad3cef[_0x24e6('0x33')][_0x24e6('0x44')]){_0x239c02[_0x24e6('0x45')]=[{'all':!![]}];}_0x239c02=_[_0x24e6('0x40')]({},_0x239c02,_0xad3cef['options']);return db[_0x24e6('0x43')][_0x24e6('0x4b')](_0x239c02)['then'](handleEntityNotFound(_0x22550e,null))[_0x24e6('0x24')](respondWithResult(_0x22550e,null))[_0x24e6('0x48')](handleError(_0x22550e,null));};exports[_0x24e6('0x4c')]=function(_0x4ef050,_0x57aaf0){return db[_0x24e6('0x43')][_0x24e6('0x4c')](_0x4ef050[_0x24e6('0x4d')],{})[_0x24e6('0x24')](function(_0x4a481d){var _0x1ae248=_0x4ef050[_0x24e6('0x4e')][_0x24e6('0x26')]({'plain':!![]});if(!_0x1ae248)throw new Error(_0x24e6('0x4f'));if(_0x1ae248['role']===_0x24e6('0x4e')){var _0x467076=_0x4a481d[_0x24e6('0x26')]({'plain':!![]});var _0x401f88='IvrCampaigns';return db[_0x24e6('0x50')][_0x24e6('0x4b')]({'where':{'name':_0x401f88,'userProfileId':_0x1ae248['userProfileId']},'raw':!![]})['then'](function(_0x19ed45){if(_0x19ed45&&_0x19ed45['autoAssociation']===0x0){return db[_0x24e6('0x28')][_0x24e6('0x4c')]({'name':_0x467076[_0x24e6('0x2d')],'resourceId':_0x467076['id'],'type':_0x19ed45[_0x24e6('0x2d')],'sectionId':_0x19ed45['id']},{})[_0x24e6('0x24')](function(){return _0x4a481d;});}else{return _0x4a481d;}})['catch'](function(_0x507c29){logger[_0x24e6('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x507c29);throw _0x507c29;});}return _0x4a481d;})[_0x24e6('0x24')](respondWithResult(_0x57aaf0,0xc9))[_0x24e6('0x48')](handleError(_0x57aaf0,null));};exports[_0x24e6('0x51')]=function(_0x215640,_0x368bc3){var _0x567abf={'where':{'id':_0x215640[_0x24e6('0x4a')]['id']}},_0x292934={};_0x292934['model']=_[_0x24e6('0x34')](db[_0x24e6('0x43')][_0x24e6('0x30')]);_0x567abf['attributes']=_[_0x24e6('0x36')](_0x292934[_0x24e6('0x32')],qs[_0x24e6('0x38')](_0x215640[_0x24e6('0x33')][_0x24e6('0x38')]));_0x567abf[_0x24e6('0x37')]=_0x567abf[_0x24e6('0x37')][_0x24e6('0x52')]?_0x567abf['attributes']:_0x292934[_0x24e6('0x32')];if(_0x215640[_0x24e6('0x33')][_0x24e6('0x44')]){_0x567abf[_0x24e6('0x45')]=[{'all':!![]}];}_0x567abf=_['merge']({},_0x567abf,_0x215640['options']);return db[_0x24e6('0x43')]['find'](_0x567abf)[_0x24e6('0x24')](handleEntityNotFound(_0x368bc3,null))['then'](function(_0x406bcd){if(_0x406bcd){var _0x42701a=_0x406bcd[_0x24e6('0x26')]({'plain':!![]});_0x42701a=qs[_0x24e6('0x53')](_0x42701a,['id','createdAt','updatedAt']);_0x215640[_0x24e6('0x4d')]=_[_0x24e6('0x53')](_0x215640[_0x24e6('0x4d')],['id',_0x24e6('0x54'),_0x24e6('0x55')]);return db[_0x24e6('0x43')]['create'](_[_0x24e6('0x40')](_0x42701a,_0x215640[_0x24e6('0x4d')]),{'include':_0x215640[_0x24e6('0x33')][_0x24e6('0x44')]?[{'all':!![]}]:undefined})[_0x24e6('0x24')](function(_0x51c3b9){var _0x59706b=_0x215640['user']['get']({'plain':!![]});if(!_0x59706b)throw new Error(_0x24e6('0x4f'));if(_0x59706b['role']===_0x24e6('0x4e')){var _0x325f89=_0x51c3b9[_0x24e6('0x26')]({'plain':!![]});var _0x4330dc=_0x24e6('0x27');return db[_0x24e6('0x50')][_0x24e6('0x4b')]({'where':{'name':_0x4330dc,'userProfileId':_0x59706b[_0x24e6('0x56')]},'raw':!![]})[_0x24e6('0x24')](function(_0x1760b6){if(_0x1760b6&&_0x1760b6[_0x24e6('0x57')]===0x0){return db[_0x24e6('0x28')][_0x24e6('0x4c')]({'name':_0x325f89[_0x24e6('0x2d')],'resourceId':_0x325f89['id'],'type':_0x1760b6['name'],'sectionId':_0x1760b6['id']},{})['then'](function(){return _0x51c3b9;});}else{return _0x51c3b9;}})[_0x24e6('0x48')](function(_0x157f42){logger[_0x24e6('0x2b')](_0x24e6('0x58'),_0x157f42);throw _0x157f42;});}return _0x51c3b9;});}})[_0x24e6('0x24')](respondWithResult(_0x368bc3,0xc9))[_0x24e6('0x48')](handleError(_0x368bc3,null));};exports[_0x24e6('0x59')]=function(_0x41debd,_0x4303d4){if(_0x41debd[_0x24e6('0x4d')]['id']){delete _0x41debd[_0x24e6('0x4d')]['id'];}return db[_0x24e6('0x43')]['find']({'where':{'id':_0x41debd[_0x24e6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4303d4,null))[_0x24e6('0x24')](saveUpdates(_0x41debd['body'],null))[_0x24e6('0x24')](respondWithResult(_0x4303d4,null))[_0x24e6('0x48')](handleError(_0x4303d4,null));};exports[_0x24e6('0x25')]=function(_0x31d4db,_0x4c489e){return db[_0x24e6('0x43')][_0x24e6('0x4b')]({'where':{'id':_0x31d4db[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x4c489e,null))['then'](removeEntity(_0x4c489e,null))[_0x24e6('0x48')](handleError(_0x4c489e,null));};exports[_0x24e6('0x5a')]=function(_0x17626d,_0x6e59f2,_0x29fbfd){var _0xe12cdc={'raw':!![],'where':{}};var _0x47bf99={};var _0x2ec732={'count':0x0,'rows':[]};return db[_0x24e6('0x43')]['findOne']({'where':{'id':_0x17626d[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x6e59f2,null))[_0x24e6('0x24')](function(_0x3fbf9e){if(_0x3fbf9e){_0x47bf99['model']=_[_0x24e6('0x34')](db[_0x24e6('0x5b')][_0x24e6('0x30')]);_0x47bf99['query']=_['keys'](_0x17626d[_0x24e6('0x33')]);_0x47bf99[_0x24e6('0x35')]=_['intersection'](_0x47bf99[_0x24e6('0x32')],_0x47bf99['query']);_0xe12cdc[_0x24e6('0x37')]=_['intersection'](_0x47bf99[_0x24e6('0x32')],qs[_0x24e6('0x38')](_0x17626d[_0x24e6('0x33')]['fields']));_0xe12cdc[_0x24e6('0x37')]=_0xe12cdc[_0x24e6('0x37')][_0x24e6('0x52')]?_0xe12cdc[_0x24e6('0x37')]:_0x47bf99[_0x24e6('0x32')];if(!_0x17626d[_0x24e6('0x33')][_0x24e6('0x39')](_0x24e6('0x3a'))){_0xe12cdc[_0x24e6('0x1d')]=qs[_0x24e6('0x1d')](_0x17626d[_0x24e6('0x33')][_0x24e6('0x1d')]);_0xe12cdc[_0x24e6('0x1b')]=qs[_0x24e6('0x1b')](_0x17626d[_0x24e6('0x33')][_0x24e6('0x1b')]);}_0xe12cdc['order']=qs[_0x24e6('0x3c')](_0x17626d[_0x24e6('0x33')][_0x24e6('0x3c')]);_0xe12cdc[_0x24e6('0x3f')]=qs[_0x24e6('0x35')](_[_0x24e6('0x3d')](_0x17626d['query'],_0x47bf99[_0x24e6('0x35')]));_0xe12cdc['where'][_0x24e6('0x5c')]=_0x3fbf9e['id'];if(_0x17626d[_0x24e6('0x33')][_0x24e6('0x3e')]){_0xe12cdc[_0x24e6('0x3f')]=_[_0x24e6('0x40')](_0xe12cdc['where'],{'$or':_[_0x24e6('0x2f')](_0xe12cdc[_0x24e6('0x37')],function(_0x1590cc){var _0x5841f1={};_0x5841f1[_0x1590cc]={'$like':'%'+_0x17626d[_0x24e6('0x33')][_0x24e6('0x3e')]+'%'};return _0x5841f1;})});}_0xe12cdc=_[_0x24e6('0x40')]({},_0xe12cdc,_0x17626d[_0x24e6('0x42')]);return db[_0x24e6('0x5b')][_0x24e6('0x1e')]({'where':_0xe12cdc[_0x24e6('0x3f')]})[_0x24e6('0x24')](function(_0x2a1b5c){_0x2ec732[_0x24e6('0x1e')]=_0x2a1b5c;if(_0x17626d[_0x24e6('0x33')][_0x24e6('0x44')]){_0xe12cdc[_0x24e6('0x45')]=[{'all':!![]}];}return db[_0x24e6('0x5b')]['findAll'](_0xe12cdc);})[_0x24e6('0x24')](function(_0x38eda0){_0x2ec732['rows']=_0x38eda0;return _0x2ec732;});}})[_0x24e6('0x24')](respondWithFilteredResult(_0x6e59f2,_0xe12cdc))['catch'](handleError(_0x6e59f2,null));};exports[_0x24e6('0x5d')]=function(_0x16c5b2,_0x20cd56,_0x13a616){var _0x624440={'raw':!![],'where':{}};var _0x3bb31e={};var _0xc63b61={'count':0x0,'rows':[]};return db[_0x24e6('0x43')][_0x24e6('0x5e')]({'where':{'id':_0x16c5b2[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x20cd56,null))[_0x24e6('0x24')](function(_0x49e6fa){if(_0x49e6fa){_0x3bb31e['model']=_['keys'](db['CmHopperHistory'][_0x24e6('0x30')]);_0x3bb31e[_0x24e6('0x33')]=_[_0x24e6('0x34')](_0x16c5b2[_0x24e6('0x33')]);_0x3bb31e[_0x24e6('0x35')]=_[_0x24e6('0x36')](_0x3bb31e['model'],_0x3bb31e[_0x24e6('0x33')]);_0x624440[_0x24e6('0x37')]=_[_0x24e6('0x36')](_0x3bb31e['model'],qs[_0x24e6('0x38')](_0x16c5b2[_0x24e6('0x33')]['fields']));_0x624440['attributes']=_0x624440[_0x24e6('0x37')]['length']?_0x624440[_0x24e6('0x37')]:_0x3bb31e[_0x24e6('0x32')];if(!_0x16c5b2[_0x24e6('0x33')]['hasOwnProperty'](_0x24e6('0x3a'))){_0x624440[_0x24e6('0x1d')]=qs['limit'](_0x16c5b2[_0x24e6('0x33')][_0x24e6('0x1d')]);_0x624440[_0x24e6('0x1b')]=qs[_0x24e6('0x1b')](_0x16c5b2['query'][_0x24e6('0x1b')]);}_0x624440[_0x24e6('0x3b')]=qs[_0x24e6('0x3c')](_0x16c5b2[_0x24e6('0x33')][_0x24e6('0x3c')]);_0x624440[_0x24e6('0x3f')]=qs[_0x24e6('0x35')](_['pick'](_0x16c5b2[_0x24e6('0x33')],_0x3bb31e[_0x24e6('0x35')]));_0x624440[_0x24e6('0x3f')][_0x24e6('0x5c')]=_0x49e6fa['id'];if(_0x16c5b2[_0x24e6('0x33')]['filter']){_0x624440['where']=_[_0x24e6('0x40')](_0x624440[_0x24e6('0x3f')],{'$or':_[_0x24e6('0x2f')](_0x624440[_0x24e6('0x37')],function(_0x59e87f){var _0x2f3c0a={};_0x2f3c0a[_0x59e87f]={'$like':'%'+_0x16c5b2[_0x24e6('0x33')][_0x24e6('0x3e')]+'%'};return _0x2f3c0a;})});}_0x624440=_[_0x24e6('0x40')]({},_0x624440,_0x16c5b2['options']);return db[_0x24e6('0x5f')][_0x24e6('0x1e')]({'where':_0x624440[_0x24e6('0x3f')]})[_0x24e6('0x24')](function(_0x12c299){_0xc63b61[_0x24e6('0x1e')]=_0x12c299;if(_0x16c5b2['query'][_0x24e6('0x44')]){_0x624440['include']=[{'all':!![]}];}return db[_0x24e6('0x5f')][_0x24e6('0x46')](_0x624440);})[_0x24e6('0x24')](function(_0x4fc862){_0xc63b61[_0x24e6('0x47')]=_0x4fc862;return _0xc63b61;});}})[_0x24e6('0x24')](respondWithFilteredResult(_0x20cd56,_0x624440))['catch'](handleError(_0x20cd56,null));};exports[_0x24e6('0x60')]=function(_0x29d0bf,_0x337187,_0x13e93b){var _0x5a3277={'raw':!![],'where':{}};var _0x5aeaae={};var _0x3da5db={'count':0x0,'rows':[]};return db['Campaign'][_0x24e6('0x5e')]({'where':{'id':_0x29d0bf[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x337187,null))[_0x24e6('0x24')](function(_0x1f9b88){if(_0x1f9b88){_0x5aeaae[_0x24e6('0x32')]=_[_0x24e6('0x34')](db[_0x24e6('0x61')][_0x24e6('0x30')]);_0x5aeaae['query']=_[_0x24e6('0x34')](_0x29d0bf['query']);_0x5aeaae[_0x24e6('0x35')]=_['intersection'](_0x5aeaae[_0x24e6('0x32')],_0x5aeaae[_0x24e6('0x33')]);_0x5a3277[_0x24e6('0x37')]=_[_0x24e6('0x36')](_0x5aeaae[_0x24e6('0x32')],qs[_0x24e6('0x38')](_0x29d0bf[_0x24e6('0x33')][_0x24e6('0x38')]));_0x5a3277[_0x24e6('0x37')]=_0x5a3277[_0x24e6('0x37')][_0x24e6('0x52')]?_0x5a3277[_0x24e6('0x37')]:_0x5aeaae[_0x24e6('0x32')];if(!_0x29d0bf[_0x24e6('0x33')][_0x24e6('0x39')]('nolimit')){_0x5a3277[_0x24e6('0x1d')]=qs[_0x24e6('0x1d')](_0x29d0bf['query'][_0x24e6('0x1d')]);_0x5a3277[_0x24e6('0x1b')]=qs[_0x24e6('0x1b')](_0x29d0bf[_0x24e6('0x33')][_0x24e6('0x1b')]);}_0x5a3277[_0x24e6('0x3b')]=qs[_0x24e6('0x3c')](_0x29d0bf[_0x24e6('0x33')][_0x24e6('0x3c')]);_0x5a3277[_0x24e6('0x3f')]=qs[_0x24e6('0x35')](_[_0x24e6('0x3d')](_0x29d0bf[_0x24e6('0x33')],_0x5aeaae[_0x24e6('0x35')]));_0x5a3277[_0x24e6('0x3f')][_0x24e6('0x5c')]=_0x1f9b88['id'];if(_0x29d0bf[_0x24e6('0x33')][_0x24e6('0x3e')]){_0x5a3277[_0x24e6('0x3f')]=_[_0x24e6('0x40')](_0x5a3277[_0x24e6('0x3f')],{'$or':_[_0x24e6('0x2f')](_0x5a3277[_0x24e6('0x37')],function(_0x507686){var _0x6f6d92={};_0x6f6d92[_0x507686]={'$like':'%'+_0x29d0bf['query'][_0x24e6('0x3e')]+'%'};return _0x6f6d92;})});}_0x5a3277=_['merge']({},_0x5a3277,_0x29d0bf[_0x24e6('0x42')]);return db[_0x24e6('0x61')][_0x24e6('0x1e')]({'where':_0x5a3277[_0x24e6('0x3f')]})['then'](function(_0x3b4bb5){_0x3da5db['count']=_0x3b4bb5;if(_0x29d0bf[_0x24e6('0x33')]['includeAll']){_0x5a3277['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x24e6('0x46')](_0x5a3277);})[_0x24e6('0x24')](function(_0xc90e30){_0x3da5db[_0x24e6('0x47')]=_0xc90e30;return _0x3da5db;});}})['then'](respondWithFilteredResult(_0x337187,_0x5a3277))[_0x24e6('0x48')](handleError(_0x337187,null));};exports[_0x24e6('0x62')]=function(_0x5df3d3,_0x3784da,_0x3bea97){var _0x1c9005={'raw':!![],'where':{}};var _0x5d906b={};var _0x4b70b6={'count':0x0,'rows':[]};return db[_0x24e6('0x43')][_0x24e6('0x5e')]({'where':{'id':_0x5df3d3[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x3784da,null))[_0x24e6('0x24')](function(_0x42908e){if(_0x42908e){_0x5d906b['model']=_[_0x24e6('0x34')](db[_0x24e6('0x63')][_0x24e6('0x30')]);_0x5d906b[_0x24e6('0x33')]=_[_0x24e6('0x34')](_0x5df3d3[_0x24e6('0x33')]);_0x5d906b[_0x24e6('0x35')]=_[_0x24e6('0x36')](_0x5d906b[_0x24e6('0x32')],_0x5d906b[_0x24e6('0x33')]);_0x1c9005[_0x24e6('0x37')]=_[_0x24e6('0x36')](_0x5d906b[_0x24e6('0x32')],qs[_0x24e6('0x38')](_0x5df3d3[_0x24e6('0x33')][_0x24e6('0x38')]));_0x1c9005['attributes']=_0x1c9005[_0x24e6('0x37')][_0x24e6('0x52')]?_0x1c9005[_0x24e6('0x37')]:_0x5d906b[_0x24e6('0x32')];if(!_0x5df3d3['query'][_0x24e6('0x39')](_0x24e6('0x3a'))){_0x1c9005[_0x24e6('0x1d')]=qs[_0x24e6('0x1d')](_0x5df3d3[_0x24e6('0x33')][_0x24e6('0x1d')]);_0x1c9005[_0x24e6('0x1b')]=qs[_0x24e6('0x1b')](_0x5df3d3[_0x24e6('0x33')][_0x24e6('0x1b')]);}_0x1c9005['order']=qs[_0x24e6('0x3c')](_0x5df3d3[_0x24e6('0x33')][_0x24e6('0x3c')]);_0x1c9005[_0x24e6('0x3f')]=qs[_0x24e6('0x35')](_[_0x24e6('0x3d')](_0x5df3d3[_0x24e6('0x33')],_0x5d906b['filters']));_0x1c9005['where'][_0x24e6('0x5c')]=_0x42908e['id'];if(_0x5df3d3[_0x24e6('0x33')][_0x24e6('0x3e')]){_0x1c9005[_0x24e6('0x3f')]=_[_0x24e6('0x40')](_0x1c9005[_0x24e6('0x3f')],{'$or':_[_0x24e6('0x2f')](_0x1c9005['attributes'],function(_0xd3dc7b){var _0x44f429={};_0x44f429[_0xd3dc7b]={'$like':'%'+_0x5df3d3[_0x24e6('0x33')][_0x24e6('0x3e')]+'%'};return _0x44f429;})});}_0x1c9005=_[_0x24e6('0x40')]({},_0x1c9005,_0x5df3d3[_0x24e6('0x42')]);return db['CmHopperBlack']['count']({'where':_0x1c9005['where']})[_0x24e6('0x24')](function(_0x3c996c){_0x4b70b6[_0x24e6('0x1e')]=_0x3c996c;if(_0x5df3d3[_0x24e6('0x33')][_0x24e6('0x44')]){_0x1c9005[_0x24e6('0x45')]=[{'all':!![]}];}return db[_0x24e6('0x63')][_0x24e6('0x46')](_0x1c9005);})[_0x24e6('0x24')](function(_0x38cdc7){_0x4b70b6[_0x24e6('0x47')]=_0x38cdc7;return _0x4b70b6;});}})['then'](respondWithFilteredResult(_0x3784da,_0x1c9005))[_0x24e6('0x48')](handleError(_0x3784da,null));};exports[_0x24e6('0x64')]=function(_0x37c07f,_0x4f3008,_0x2b0f99){var _0x39c3d6={};var _0x3d271={};var _0x413aac;var _0x48fa61;return db[_0x24e6('0x43')][_0x24e6('0x5e')]({'where':{'id':_0x37c07f[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x4f3008,null))[_0x24e6('0x24')](function(_0x2bc73d){if(_0x2bc73d){_0x413aac=_0x2bc73d;_0x3d271[_0x24e6('0x32')]=_[_0x24e6('0x34')](db[_0x24e6('0x65')][_0x24e6('0x30')]);_0x3d271[_0x24e6('0x33')]=_[_0x24e6('0x34')](_0x37c07f[_0x24e6('0x33')]);_0x3d271['filters']=_[_0x24e6('0x36')](_0x3d271[_0x24e6('0x32')],_0x3d271['query']);_0x39c3d6['attributes']=_['intersection'](_0x3d271['model'],qs[_0x24e6('0x38')](_0x37c07f['query'][_0x24e6('0x38')]));_0x39c3d6['attributes']=_0x39c3d6[_0x24e6('0x37')][_0x24e6('0x52')]?_0x39c3d6[_0x24e6('0x37')]:_0x3d271[_0x24e6('0x32')];_0x39c3d6[_0x24e6('0x3b')]=qs[_0x24e6('0x3c')](_0x37c07f[_0x24e6('0x33')][_0x24e6('0x3c')]);_0x39c3d6['where']=qs[_0x24e6('0x35')](_[_0x24e6('0x3d')](_0x37c07f[_0x24e6('0x33')],_0x3d271['filters']));if(_0x37c07f[_0x24e6('0x33')][_0x24e6('0x3e')]){_0x39c3d6['where']=_[_0x24e6('0x40')](_0x39c3d6[_0x24e6('0x3f')],{'$or':_[_0x24e6('0x2f')](_0x39c3d6[_0x24e6('0x37')],function(_0x58968e){var _0x2ca9fa={};_0x2ca9fa[_0x58968e]={'$like':'%'+_0x37c07f[_0x24e6('0x33')][_0x24e6('0x3e')]+'%'};return _0x2ca9fa;})});}_0x39c3d6=_[_0x24e6('0x40')]({},_0x39c3d6,_0x37c07f['options']);return _0x413aac['getLists'](_0x39c3d6);}})[_0x24e6('0x24')](function(_0x383683){if(_0x383683){_0x48fa61=_0x383683[_0x24e6('0x52')];if(!_0x37c07f[_0x24e6('0x33')][_0x24e6('0x39')]('nolimit')){_0x39c3d6[_0x24e6('0x1d')]=qs[_0x24e6('0x1d')](_0x37c07f['query'][_0x24e6('0x1d')]);_0x39c3d6[_0x24e6('0x1b')]=qs[_0x24e6('0x1b')](_0x37c07f[_0x24e6('0x33')][_0x24e6('0x1b')]);}return _0x413aac[_0x24e6('0x64')](_0x39c3d6);}})[_0x24e6('0x24')](function(_0x421811){if(_0x421811){return _0x421811?{'count':_0x48fa61,'rows':_0x421811}:null;}})[_0x24e6('0x24')](respondWithResult(_0x4f3008,null))['catch'](handleError(_0x4f3008,null));};exports[_0x24e6('0x66')]=function(_0x395d7c,_0xbd271,_0x4a99e7){var _0x555d48,_0x21d57e;return db[_0x24e6('0x43')]['find']({'where':{'id':_0x395d7c[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0xbd271,null))['then'](function(_0x210136){if(_0x210136){_0x21d57e=_0x210136;return _0x210136['addLists'](_0x395d7c[_0x24e6('0x4d')][_0x24e6('0x67')],_['omit'](_0x395d7c['body'],[_0x24e6('0x67'),'id'])||{});}return null;})[_0x24e6('0x68')](function(_0x5edc3c){var _0xfaf720;_0x555d48=_0x5edc3c||[];var _0x400056=[];if(_0x5edc3c){for(var _0x2c0768=0x0;_0x2c0768<_0x5edc3c[_0x24e6('0x52')];_0x2c0768+=0x1){var _0x965f9b=_0x5edc3c[_0x2c0768][_0x24e6('0x26')]({'plain':!![]});_0x21d57e[_0x24e6('0x69')]=_0x395d7c[_0x24e6('0x4d')]['dialCheckDuplicateType']?_0x395d7c[_0x24e6('0x4d')]['dialCheckDuplicateType']:_0x21d57e[_0x24e6('0x69')];switch(_0x21d57e[_0x24e6('0x69')]){case _0x24e6('0x6a'):_0xfaf720=squel['insert']()['into'](_0x24e6('0x6b'))[_0x24e6('0x6c')]([_0x24e6('0x6d'),'scheduledAt',_0x24e6('0x6e'),_0x24e6('0x6f'),_0x24e6('0x5c'),_0x24e6('0x54'),_0x24e6('0x55')],squel[_0x24e6('0x70')]()[_0x24e6('0x71')](_0x24e6('0x6d'),_0x24e6('0x6d'))['field'](_0x24e6('0x72'),_0x24e6('0x73'))[_0x24e6('0x71')]('id',_0x24e6('0x6e'))[_0x24e6('0x71')](_0x965f9b[_0x24e6('0x74')][_0x24e6('0x75')](),_0x24e6('0x6f'))[_0x24e6('0x71')](_0x395d7c['params']['id'][_0x24e6('0x75')](),_0x24e6('0x5c'))[_0x24e6('0x71')](_0x24e6('0x72'),_0x24e6('0x54'))[_0x24e6('0x71')](_0x24e6('0x72'),'updatedAt')[_0x24e6('0x76')](_0x24e6('0x77'))[_0x24e6('0x3f')](_0x24e6('0x78'))[_0x24e6('0x3f')]('ListId\x20=\x20?',_0x965f9b[_0x24e6('0x74')][_0x24e6('0x75')]())[_0x24e6('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x24e6('0x79'),squel['select']()['field'](_0x24e6('0x7a'))['from']('cm_hopper_final')[_0x24e6('0x3f')](_0x24e6('0x7b'),_0x395d7c[_0x24e6('0x4a')]['id'][_0x24e6('0x75')]()))[_0x24e6('0x3f')](_0x24e6('0x79'),squel[_0x24e6('0x70')]()[_0x24e6('0x71')](_0x24e6('0x7c'))[_0x24e6('0x76')](_0x24e6('0x6b'))[_0x24e6('0x3f')](_0x24e6('0x7b'),_0x395d7c['params']['id']['toString']())))[_0x24e6('0x75')]();break;case'onlyIfOpen':_0xfaf720=squel[_0x24e6('0x7d')]()[_0x24e6('0x7e')](_0x24e6('0x6b'))[_0x24e6('0x6c')]([_0x24e6('0x6d'),_0x24e6('0x73'),'ContactId','ListId',_0x24e6('0x5c'),_0x24e6('0x54'),_0x24e6('0x55')],squel[_0x24e6('0x70')]()[_0x24e6('0x71')](_0x24e6('0x6d'),_0x24e6('0x6d'))['field'](_0x24e6('0x72'),'scheduledAt')[_0x24e6('0x71')]('id',_0x24e6('0x6e'))[_0x24e6('0x71')](_0x965f9b[_0x24e6('0x74')][_0x24e6('0x75')](),_0x24e6('0x6f'))['field'](_0x395d7c[_0x24e6('0x4a')]['id'][_0x24e6('0x75')](),'CampaignId')[_0x24e6('0x71')]('NOW()',_0x24e6('0x54'))[_0x24e6('0x71')](_0x24e6('0x72'),_0x24e6('0x55'))[_0x24e6('0x76')](_0x24e6('0x77'))[_0x24e6('0x3f')]('deletedAt\x20IS\x20NULL')[_0x24e6('0x3f')](_0x24e6('0x7f'),_0x965f9b['CmListId'][_0x24e6('0x75')]())[_0x24e6('0x3f')](_0x24e6('0x80'))['where'](_0x24e6('0x79'),squel[_0x24e6('0x70')]()[_0x24e6('0x71')](_0x24e6('0x7c'))[_0x24e6('0x76')](_0x24e6('0x6b'))[_0x24e6('0x3f')](_0x24e6('0x7b'),_0x395d7c[_0x24e6('0x4a')]['id']['toString']())))[_0x24e6('0x75')]();break;default:_0xfaf720=squel[_0x24e6('0x7d')]()[_0x24e6('0x7e')](_0x24e6('0x6b'))[_0x24e6('0x6c')]([_0x24e6('0x6d'),_0x24e6('0x73'),'ContactId',_0x24e6('0x6f'),_0x24e6('0x5c'),_0x24e6('0x54'),_0x24e6('0x55')],squel[_0x24e6('0x70')]()[_0x24e6('0x71')](_0x24e6('0x6d'),_0x24e6('0x6d'))[_0x24e6('0x71')]('NOW()','scheduledAt')[_0x24e6('0x71')]('id',_0x24e6('0x6e'))[_0x24e6('0x71')](_0x965f9b[_0x24e6('0x74')][_0x24e6('0x75')](),_0x24e6('0x6f'))['field'](_0x395d7c[_0x24e6('0x4a')]['id'][_0x24e6('0x75')](),'CampaignId')[_0x24e6('0x71')](_0x24e6('0x72'),_0x24e6('0x54'))[_0x24e6('0x71')](_0x24e6('0x72'),_0x24e6('0x55'))[_0x24e6('0x76')](_0x24e6('0x77'))['where'](_0x24e6('0x78'))[_0x24e6('0x3f')]('ListId\x20=\x20?',_0x965f9b[_0x24e6('0x74')][_0x24e6('0x75')]())[_0x24e6('0x3f')](_0x24e6('0x80')))['toString']();}_0x400056[_0x24e6('0x81')](db[_0x24e6('0x82')]['query'](_0xfaf720));}return BPromise['all'](_0x400056);}})[_0x24e6('0x24')](function(){return _0x555d48;})[_0x24e6('0x24')](respondWithResult(_0xbd271,null))[_0x24e6('0x48')](handleError(_0xbd271,null));};exports['removeLists']=function(_0x3ed2f3,_0x30b8c6,_0x288b7c){return db[_0x24e6('0x43')][_0x24e6('0x4b')]({'where':{'id':_0x3ed2f3[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x30b8c6,null))[_0x24e6('0x24')](function(_0x46fe82){if(_0x46fe82){return _0x46fe82[_0x24e6('0x83')](_0x3ed2f3[_0x24e6('0x33')]['ids']);}})[_0x24e6('0x24')](function(_0x1697ab){if(_0x1697ab){return db[_0x24e6('0x5b')]['destroy']({'where':{'ListId':_0x3ed2f3[_0x24e6('0x33')][_0x24e6('0x67')],'CampaignId':_0x3ed2f3[_0x24e6('0x4a')]['id']}})['then'](function(){return _0x1697ab;});}})[_0x24e6('0x24')](respondWithStatusCode(_0x30b8c6,null))['catch'](handleError(_0x30b8c6,null));};exports['getBlackLists']=function(_0x5d4361,_0xd0a4e8,_0x39128c){var _0x26726={};var _0x10cb22={};var _0x53adac;var _0x589add;return db[_0x24e6('0x43')][_0x24e6('0x5e')]({'where':{'id':_0x5d4361['params']['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0xd0a4e8,null))[_0x24e6('0x24')](function(_0x4c05fa){if(_0x4c05fa){_0x53adac=_0x4c05fa;_0x10cb22[_0x24e6('0x32')]=_[_0x24e6('0x34')](db[_0x24e6('0x65')][_0x24e6('0x30')]);_0x10cb22['query']=_[_0x24e6('0x34')](_0x5d4361[_0x24e6('0x33')]);_0x10cb22[_0x24e6('0x35')]=_['intersection'](_0x10cb22[_0x24e6('0x32')],_0x10cb22[_0x24e6('0x33')]);_0x26726[_0x24e6('0x37')]=_[_0x24e6('0x36')](_0x10cb22[_0x24e6('0x32')],qs[_0x24e6('0x38')](_0x5d4361[_0x24e6('0x33')]['fields']));_0x26726[_0x24e6('0x37')]=_0x26726[_0x24e6('0x37')][_0x24e6('0x52')]?_0x26726['attributes']:_0x10cb22[_0x24e6('0x32')];_0x26726[_0x24e6('0x3b')]=qs[_0x24e6('0x3c')](_0x5d4361[_0x24e6('0x33')]['sort']);_0x26726[_0x24e6('0x3f')]=qs[_0x24e6('0x35')](_[_0x24e6('0x3d')](_0x5d4361[_0x24e6('0x33')],_0x10cb22[_0x24e6('0x35')]));if(_0x5d4361[_0x24e6('0x33')][_0x24e6('0x3e')]){_0x26726[_0x24e6('0x3f')]=_[_0x24e6('0x40')](_0x26726[_0x24e6('0x3f')],{'$or':_[_0x24e6('0x2f')](_0x26726[_0x24e6('0x37')],function(_0x5e2dbb){var _0x223073={};_0x223073[_0x5e2dbb]={'$like':'%'+_0x5d4361[_0x24e6('0x33')][_0x24e6('0x3e')]+'%'};return _0x223073;})});}_0x26726=_[_0x24e6('0x40')]({},_0x26726,_0x5d4361[_0x24e6('0x42')]);return _0x53adac[_0x24e6('0x84')](_0x26726);}})[_0x24e6('0x24')](function(_0x2b494c){if(_0x2b494c){_0x589add=_0x2b494c[_0x24e6('0x52')];if(!_0x5d4361['query']['hasOwnProperty'](_0x24e6('0x3a'))){_0x26726[_0x24e6('0x1d')]=qs[_0x24e6('0x1d')](_0x5d4361[_0x24e6('0x33')][_0x24e6('0x1d')]);_0x26726[_0x24e6('0x1b')]=qs[_0x24e6('0x1b')](_0x5d4361[_0x24e6('0x33')][_0x24e6('0x1b')]);}return _0x53adac[_0x24e6('0x84')](_0x26726);}})[_0x24e6('0x24')](function(_0xb0b334){if(_0xb0b334){return _0xb0b334?{'count':_0x589add,'rows':_0xb0b334}:null;}})[_0x24e6('0x24')](respondWithResult(_0xd0a4e8,null))[_0x24e6('0x48')](handleError(_0xd0a4e8,null));};exports['addBlackLists']=function(_0x590aec,_0x18c51f,_0x218b38){var _0x192993,_0x2316b5;return db[_0x24e6('0x43')][_0x24e6('0x4b')]({'where':{'id':_0x590aec[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x18c51f,null))['then'](function(_0x242da4){if(_0x242da4){_0x2316b5=_0x242da4;return _0x242da4[_0x24e6('0x85')](_0x590aec[_0x24e6('0x4d')][_0x24e6('0x67')],_[_0x24e6('0x53')](_0x590aec['body'],[_0x24e6('0x67'),'id'])||{});}return null;})['spread'](function(_0xc3413e){var _0x1dc9fa;_0x192993=_0xc3413e||[];var _0x57d513=[];if(_0xc3413e){for(var _0x103ddd=0x0;_0x103ddd<_0xc3413e[_0x24e6('0x52')];_0x103ddd+=0x1){var _0x4aac8f=_0xc3413e[_0x103ddd][_0x24e6('0x26')]({'plain':!![]});_0x1dc9fa=squel[_0x24e6('0x7d')]()[_0x24e6('0x7e')]('cm_hopper_black')[_0x24e6('0x6c')]([_0x24e6('0x6d'),_0x24e6('0x6e'),'ListId','CampaignId','createdAt',_0x24e6('0x55')],squel['select']()[_0x24e6('0x71')]('phone',_0x24e6('0x6d'))[_0x24e6('0x71')]('id','ContactId')[_0x24e6('0x71')](_0x4aac8f[_0x24e6('0x74')][_0x24e6('0x75')](),_0x24e6('0x6f'))[_0x24e6('0x71')](_0x590aec[_0x24e6('0x4a')]['id'][_0x24e6('0x75')](),'CampaignId')[_0x24e6('0x71')](_0x24e6('0x72'),'createdAt')[_0x24e6('0x71')](_0x24e6('0x72'),_0x24e6('0x55'))[_0x24e6('0x76')](_0x24e6('0x77'))[_0x24e6('0x3f')](_0x24e6('0x78'))['where'](_0x24e6('0x7f'),_0x4aac8f['CmListId'][_0x24e6('0x75')]())[_0x24e6('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x24e6('0x75')]();_0x57d513[_0x24e6('0x81')](db[_0x24e6('0x82')][_0x24e6('0x33')](_0x1dc9fa));}return BPromise[_0x24e6('0x86')](_0x57d513);}})['then'](function(){return _0x192993;})[_0x24e6('0x24')](respondWithResult(_0x18c51f,null))[_0x24e6('0x48')](handleError(_0x18c51f,null));};exports[_0x24e6('0x87')]=function(_0x584c97,_0x5cf782,_0x4b4193){return db[_0x24e6('0x43')]['find']({'where':{'id':_0x584c97[_0x24e6('0x4a')]['id']}})[_0x24e6('0x24')](handleEntityNotFound(_0x5cf782,null))['then'](function(_0x2482ec){if(_0x2482ec){return _0x2482ec[_0x24e6('0x87')](_0x584c97['query'][_0x24e6('0x67')]);}})[_0x24e6('0x24')](function(_0xa92694){if(_0xa92694){return db[_0x24e6('0x63')]['destroy']({'where':{'ListId':_0x584c97[_0x24e6('0x33')][_0x24e6('0x67')],'CampaignId':_0x584c97['params']['id']}})[_0x24e6('0x24')](function(){return _0xa92694;});}})[_0x24e6('0x24')](respondWithStatusCode(_0x5cf782,null))['catch'](handleError(_0x5cf782,null));}; \ No newline at end of file +var _0xf700=['create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','nolimit','pick','CampaignId','map','CmHopper','getHopperHistories','findOne','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','from','cm_hopper','onlyIfOpen','ContactId','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','spread','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','set','apply','save','update','then','destroy','get','IvrCampaigns','error','stack','send','index','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','Campaign','includeAll','include','rows','catch','show','params','keys','length','find'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xf700,0xcb));var _0x0f70=function(_0x5693bc,_0x3cd1d5){_0x5693bc=_0x5693bc-0x0;var _0x4d8d9e=_0xf700[_0x5693bc];return _0x4d8d9e;};'use strict';var emlformat=require(_0x0f70('0x0'));var rimraf=require(_0x0f70('0x1'));var zipdir=require(_0x0f70('0x2'));var jsonpatch=require(_0x0f70('0x3'));var rp=require('request-promise');var moment=require(_0x0f70('0x4'));var BPromise=require(_0x0f70('0x5'));var Mustache=require(_0x0f70('0x6'));var util=require('util');var path=require(_0x0f70('0x7'));var sox=require(_0x0f70('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f70('0x9'));var _=require(_0x0f70('0xa'));var squel=require(_0x0f70('0xb'));var crypto=require(_0x0f70('0xc'));var jsforce=require(_0x0f70('0xd'));var deskjs=require(_0x0f70('0xe'));var toCsv=require(_0x0f70('0xf'));var querystring=require(_0x0f70('0x10'));var Papa=require(_0x0f70('0x11'));var Redis=require(_0x0f70('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0f70('0x13'));var as=require(_0x0f70('0x14'));var hardwareService=require(_0x0f70('0x15'));var logger=require('../../config/logger')(_0x0f70('0x16'));var utils=require(_0x0f70('0x17'));var config=require(_0x0f70('0x18'));var licenseUtil=require(_0x0f70('0x19'));var db=require(_0x0f70('0x1a'))['db'];function respondWithStatusCode(_0x5e48de,_0x37dfde){_0x37dfde=_0x37dfde||0xcc;return function(_0x1db5f4){if(_0x1db5f4){return _0x5e48de['sendStatus'](_0x37dfde);}return _0x5e48de['status'](_0x37dfde)[_0x0f70('0x1b')]();};}function respondWithResult(_0x5a3117,_0x18478e){_0x18478e=_0x18478e||0xc8;return function(_0x365325){if(_0x365325){return _0x5a3117['status'](_0x18478e)[_0x0f70('0x1c')](_0x365325);}};}function respondWithFilteredResult(_0x264168,_0x15e59c){return function(_0x365a48){if(_0x365a48){var _0x4498f2=typeof _0x15e59c[_0x0f70('0x1d')]===_0x0f70('0x1e')&&typeof _0x15e59c['limit']===_0x0f70('0x1e');var _0x2a4336=_0x365a48[_0x0f70('0x1f')];var _0x5d5412=_0x4498f2?0x0:_0x15e59c['offset'];var _0x3fe4b1=_0x4498f2?_0x365a48['count']:_0x15e59c[_0x0f70('0x1d')]+_0x15e59c[_0x0f70('0x20')];var _0x5059a4;if(_0x3fe4b1>=_0x2a4336){_0x3fe4b1=_0x2a4336;_0x5059a4=0xc8;}else{_0x5059a4=0xce;}_0x264168[_0x0f70('0x21')](_0x5059a4);return _0x264168[_0x0f70('0x22')]('Content-Range',_0x5d5412+'-'+_0x3fe4b1+'/'+_0x2a4336)[_0x0f70('0x1c')](_0x365a48);}return null;};}function patchUpdates(_0x2c7685){return function(_0x2df746){try{jsonpatch[_0x0f70('0x23')](_0x2df746,_0x2c7685,!![]);}catch(_0x2084d6){return BPromise['reject'](_0x2084d6);}return _0x2df746[_0x0f70('0x24')]();};}function saveUpdates(_0xb28d2b,_0x2ca7e9){return function(_0x5ded55){if(_0x5ded55){return _0x5ded55[_0x0f70('0x25')](_0xb28d2b)[_0x0f70('0x26')](function(_0xfab1cb){return _0xfab1cb;});}return null;};}function removeEntity(_0x8b6d4c,_0x351cb5){return function(_0x3c4cc8){if(_0x3c4cc8){return _0x3c4cc8[_0x0f70('0x27')]()['then'](function(){var _0x3e2ca0=_0x3c4cc8[_0x0f70('0x28')]({'plain':!![]});var _0x59aa31=_0x0f70('0x29');return db['UserProfileResource'][_0x0f70('0x27')]({'where':{'type':_0x59aa31,'resourceId':_0x3e2ca0['id']}})['then'](function(){return _0x3c4cc8;});})['then'](function(){_0x8b6d4c[_0x0f70('0x21')](0xcc)[_0x0f70('0x1b')]();});}};}function handleEntityNotFound(_0x3b63d7,_0x4b0e8f){return function(_0x4946d7){if(!_0x4946d7){_0x3b63d7['sendStatus'](0x194);}return _0x4946d7;};}function handleError(_0x555d0a,_0x1fa5db){_0x1fa5db=_0x1fa5db||0x1f4;return function(_0x302f48){logger[_0x0f70('0x2a')](_0x302f48[_0x0f70('0x2b')]);if(_0x302f48['name']){delete _0x302f48['name'];}_0x555d0a[_0x0f70('0x21')](_0x1fa5db)[_0x0f70('0x2c')](_0x302f48);};}exports[_0x0f70('0x2d')]=function(_0x5c23bd,_0xd967e8){var _0x2029c9={},_0x598f6c={},_0x3c9b6c={'count':0x0,'rows':[]};var _0x2638b3=_['map'](db['Campaign'][_0x0f70('0x2e')],function(_0x550036){return{'name':_0x550036[_0x0f70('0x2f')],'type':_0x550036[_0x0f70('0x30')][_0x0f70('0x31')]};});_0x598f6c[_0x0f70('0x32')]=_['map'](_0x2638b3,_0x0f70('0x33'));_0x598f6c[_0x0f70('0x34')]=_['keys'](_0x5c23bd[_0x0f70('0x34')]);_0x598f6c['filters']=_[_0x0f70('0x35')](_0x598f6c[_0x0f70('0x32')],_0x598f6c[_0x0f70('0x34')]);_0x2029c9[_0x0f70('0x36')]=_[_0x0f70('0x35')](_0x598f6c[_0x0f70('0x32')],qs[_0x0f70('0x37')](_0x5c23bd[_0x0f70('0x34')][_0x0f70('0x37')]));_0x2029c9[_0x0f70('0x36')]=_0x2029c9[_0x0f70('0x36')]['length']?_0x2029c9[_0x0f70('0x36')]:_0x598f6c[_0x0f70('0x32')];if(!_0x5c23bd[_0x0f70('0x34')][_0x0f70('0x38')]('nolimit')){_0x2029c9['limit']=qs['limit'](_0x5c23bd[_0x0f70('0x34')][_0x0f70('0x20')]);_0x2029c9[_0x0f70('0x1d')]=qs[_0x0f70('0x1d')](_0x5c23bd[_0x0f70('0x34')]['offset']);}_0x2029c9[_0x0f70('0x39')]=qs[_0x0f70('0x3a')](_0x5c23bd[_0x0f70('0x34')]['sort']);_0x2029c9[_0x0f70('0x3b')]=qs[_0x0f70('0x3c')](_['pick'](_0x5c23bd[_0x0f70('0x34')],_0x598f6c['filters']),_0x2638b3);if(_0x5c23bd[_0x0f70('0x34')][_0x0f70('0x3d')]){_0x2029c9[_0x0f70('0x3b')]=_[_0x0f70('0x3e')](_0x2029c9[_0x0f70('0x3b')],{'$or':_['map'](_0x2638b3,function(_0x3926e9){if(_0x3926e9['type']!==_0x0f70('0x3f')){var _0x6a593b={};_0x6a593b[_0x3926e9['name']]={'$like':'%'+_0x5c23bd[_0x0f70('0x34')][_0x0f70('0x3d')]+'%'};return _0x6a593b;}})});}_0x2029c9=_[_0x0f70('0x3e')]({},_0x2029c9,_0x5c23bd[_0x0f70('0x40')]);var _0x548fb1={'where':_0x2029c9['where']};return db[_0x0f70('0x41')][_0x0f70('0x1f')](_0x548fb1)['then'](function(_0x303705){_0x3c9b6c[_0x0f70('0x1f')]=_0x303705;if(_0x5c23bd[_0x0f70('0x34')][_0x0f70('0x42')]){_0x2029c9[_0x0f70('0x43')]=[{'all':!![]}];}return db[_0x0f70('0x41')]['findAll'](_0x2029c9);})[_0x0f70('0x26')](function(_0x1170c1){_0x3c9b6c[_0x0f70('0x44')]=_0x1170c1;return _0x3c9b6c;})[_0x0f70('0x26')](respondWithFilteredResult(_0xd967e8,_0x2029c9))[_0x0f70('0x45')](handleError(_0xd967e8,null));};exports[_0x0f70('0x46')]=function(_0x154e30,_0x3bb9fc){var _0x4ee0d0={'raw':![],'where':{'id':_0x154e30[_0x0f70('0x47')]['id']}},_0x648b70={};_0x648b70[_0x0f70('0x32')]=_[_0x0f70('0x48')](db[_0x0f70('0x41')][_0x0f70('0x2e')]);_0x648b70[_0x0f70('0x34')]=_[_0x0f70('0x48')](_0x154e30['query']);_0x648b70[_0x0f70('0x3c')]=_[_0x0f70('0x35')](_0x648b70[_0x0f70('0x32')],_0x648b70['query']);_0x4ee0d0[_0x0f70('0x36')]=_[_0x0f70('0x35')](_0x648b70[_0x0f70('0x32')],qs[_0x0f70('0x37')](_0x154e30[_0x0f70('0x34')]['fields']));_0x4ee0d0[_0x0f70('0x36')]=_0x4ee0d0[_0x0f70('0x36')][_0x0f70('0x49')]?_0x4ee0d0[_0x0f70('0x36')]:_0x648b70['model'];if(_0x154e30[_0x0f70('0x34')][_0x0f70('0x42')]){_0x4ee0d0['include']=[{'all':!![]}];}_0x4ee0d0=_[_0x0f70('0x3e')]({},_0x4ee0d0,_0x154e30[_0x0f70('0x40')]);return db[_0x0f70('0x41')][_0x0f70('0x4a')](_0x4ee0d0)['then'](handleEntityNotFound(_0x3bb9fc,null))[_0x0f70('0x26')](respondWithResult(_0x3bb9fc,null))[_0x0f70('0x45')](handleError(_0x3bb9fc,null));};exports['create']=function(_0x4e4c59,_0xdabb5e){return db['Campaign'][_0x0f70('0x4b')](_0x4e4c59[_0x0f70('0x4c')],{})[_0x0f70('0x26')](function(_0x44f0fd){var _0x3e6502=_0x4e4c59[_0x0f70('0x4d')][_0x0f70('0x28')]({'plain':!![]});if(!_0x3e6502)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e6502[_0x0f70('0x4e')]===_0x0f70('0x4d')){var _0x577782=_0x44f0fd[_0x0f70('0x28')]({'plain':!![]});var _0x19a3e1='IvrCampaigns';return db[_0x0f70('0x4f')][_0x0f70('0x4a')]({'where':{'name':_0x19a3e1,'userProfileId':_0x3e6502[_0x0f70('0x50')]},'raw':!![]})[_0x0f70('0x26')](function(_0x53bb2c){if(_0x53bb2c&&_0x53bb2c['autoAssociation']===0x0){return db[_0x0f70('0x51')]['create']({'name':_0x577782[_0x0f70('0x33')],'resourceId':_0x577782['id'],'type':_0x53bb2c[_0x0f70('0x33')],'sectionId':_0x53bb2c['id']},{})['then'](function(){return _0x44f0fd;});}else{return _0x44f0fd;}})[_0x0f70('0x45')](function(_0x7cfcec){logger[_0x0f70('0x2a')](_0x0f70('0x52'),_0x7cfcec);throw _0x7cfcec;});}return _0x44f0fd;})[_0x0f70('0x26')](respondWithResult(_0xdabb5e,0xc9))['catch'](handleError(_0xdabb5e,null));};exports[_0x0f70('0x53')]=function(_0x328250,_0x4dfb68){var _0x5cc5ba={'where':{'id':_0x328250[_0x0f70('0x47')]['id']}},_0x5a5a58={};_0x5a5a58[_0x0f70('0x32')]=_[_0x0f70('0x48')](db[_0x0f70('0x41')][_0x0f70('0x2e')]);_0x5cc5ba['attributes']=_['intersection'](_0x5a5a58[_0x0f70('0x32')],qs[_0x0f70('0x37')](_0x328250[_0x0f70('0x34')][_0x0f70('0x37')]));_0x5cc5ba[_0x0f70('0x36')]=_0x5cc5ba[_0x0f70('0x36')]['length']?_0x5cc5ba[_0x0f70('0x36')]:_0x5a5a58[_0x0f70('0x32')];if(_0x328250[_0x0f70('0x34')][_0x0f70('0x42')]){_0x5cc5ba[_0x0f70('0x43')]=[{'all':!![]}];}_0x5cc5ba=_[_0x0f70('0x3e')]({},_0x5cc5ba,_0x328250[_0x0f70('0x40')]);return db['Campaign'][_0x0f70('0x4a')](_0x5cc5ba)[_0x0f70('0x26')](handleEntityNotFound(_0x4dfb68,null))[_0x0f70('0x26')](function(_0x3f0edb){if(_0x3f0edb){var _0x57f9d4=_0x3f0edb['get']({'plain':!![]});_0x57f9d4=qs['omit'](_0x57f9d4,['id',_0x0f70('0x54'),_0x0f70('0x55')]);_0x328250['body']=_[_0x0f70('0x56')](_0x328250[_0x0f70('0x4c')],['id','createdAt',_0x0f70('0x55')]);return db['Campaign'][_0x0f70('0x4b')](_[_0x0f70('0x3e')](_0x57f9d4,_0x328250[_0x0f70('0x4c')]),{'include':_0x328250['query'][_0x0f70('0x42')]?[{'all':!![]}]:undefined})[_0x0f70('0x26')](function(_0x5b4d2b){var _0x5e2ce2=_0x328250[_0x0f70('0x4d')][_0x0f70('0x28')]({'plain':!![]});if(!_0x5e2ce2)throw new Error(_0x0f70('0x57'));if(_0x5e2ce2[_0x0f70('0x4e')]===_0x0f70('0x4d')){var _0x1f7f4f=_0x5b4d2b[_0x0f70('0x28')]({'plain':!![]});var _0x547904=_0x0f70('0x29');return db[_0x0f70('0x4f')]['find']({'where':{'name':_0x547904,'userProfileId':_0x5e2ce2[_0x0f70('0x50')]},'raw':!![]})[_0x0f70('0x26')](function(_0x19a79a){if(_0x19a79a&&_0x19a79a['autoAssociation']===0x0){return db[_0x0f70('0x51')]['create']({'name':_0x1f7f4f[_0x0f70('0x33')],'resourceId':_0x1f7f4f['id'],'type':_0x19a79a[_0x0f70('0x33')],'sectionId':_0x19a79a['id']},{})[_0x0f70('0x26')](function(){return _0x5b4d2b;});}else{return _0x5b4d2b;}})[_0x0f70('0x45')](function(_0x1bbac2){logger[_0x0f70('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bbac2);throw _0x1bbac2;});}return _0x5b4d2b;});}})[_0x0f70('0x26')](respondWithResult(_0x4dfb68,0xc9))[_0x0f70('0x45')](handleError(_0x4dfb68,null));};exports[_0x0f70('0x25')]=function(_0x411902,_0xd953a1){if(_0x411902['body']['id']){delete _0x411902['body']['id'];}return db[_0x0f70('0x41')][_0x0f70('0x4a')]({'where':{'id':_0x411902['params']['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0xd953a1,null))[_0x0f70('0x26')](saveUpdates(_0x411902[_0x0f70('0x4c')],null))['then'](respondWithResult(_0xd953a1,null))[_0x0f70('0x45')](handleError(_0xd953a1,null));};exports[_0x0f70('0x27')]=function(_0x6a6845,_0x11abc6){return db['Campaign'][_0x0f70('0x4a')]({'where':{'id':_0x6a6845[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0x11abc6,null))[_0x0f70('0x26')](removeEntity(_0x11abc6,null))[_0x0f70('0x45')](handleError(_0x11abc6,null));};exports['getHoppers']=function(_0x3119a8,_0x543fc2,_0x317ffe){var _0x3342af={'raw':!![],'where':{}};var _0x27c7a3={};var _0x50b9c3={'count':0x0,'rows':[]};return db[_0x0f70('0x41')]['findOne']({'where':{'id':_0x3119a8[_0x0f70('0x47')]['id']}})['then'](handleEntityNotFound(_0x543fc2,null))[_0x0f70('0x26')](function(_0x1cca7f){if(_0x1cca7f){_0x27c7a3[_0x0f70('0x32')]=_[_0x0f70('0x48')](db['CmHopper']['rawAttributes']);_0x27c7a3[_0x0f70('0x34')]=_[_0x0f70('0x48')](_0x3119a8[_0x0f70('0x34')]);_0x27c7a3[_0x0f70('0x3c')]=_[_0x0f70('0x35')](_0x27c7a3[_0x0f70('0x32')],_0x27c7a3[_0x0f70('0x34')]);_0x3342af[_0x0f70('0x36')]=_[_0x0f70('0x35')](_0x27c7a3['model'],qs[_0x0f70('0x37')](_0x3119a8[_0x0f70('0x34')][_0x0f70('0x37')]));_0x3342af['attributes']=_0x3342af['attributes'][_0x0f70('0x49')]?_0x3342af[_0x0f70('0x36')]:_0x27c7a3[_0x0f70('0x32')];if(!_0x3119a8[_0x0f70('0x34')][_0x0f70('0x38')](_0x0f70('0x58'))){_0x3342af[_0x0f70('0x20')]=qs[_0x0f70('0x20')](_0x3119a8[_0x0f70('0x34')]['limit']);_0x3342af[_0x0f70('0x1d')]=qs[_0x0f70('0x1d')](_0x3119a8[_0x0f70('0x34')][_0x0f70('0x1d')]);}_0x3342af[_0x0f70('0x39')]=qs[_0x0f70('0x3a')](_0x3119a8['query'][_0x0f70('0x3a')]);_0x3342af[_0x0f70('0x3b')]=qs['filters'](_[_0x0f70('0x59')](_0x3119a8[_0x0f70('0x34')],_0x27c7a3[_0x0f70('0x3c')]));_0x3342af[_0x0f70('0x3b')][_0x0f70('0x5a')]=_0x1cca7f['id'];if(_0x3119a8['query'][_0x0f70('0x3d')]){_0x3342af[_0x0f70('0x3b')]=_[_0x0f70('0x3e')](_0x3342af[_0x0f70('0x3b')],{'$or':_[_0x0f70('0x5b')](_0x3342af['attributes'],function(_0x3adb04){var _0x459ac5={};_0x459ac5[_0x3adb04]={'$like':'%'+_0x3119a8['query'][_0x0f70('0x3d')]+'%'};return _0x459ac5;})});}_0x3342af=_[_0x0f70('0x3e')]({},_0x3342af,_0x3119a8[_0x0f70('0x40')]);return db[_0x0f70('0x5c')]['count']({'where':_0x3342af[_0x0f70('0x3b')]})[_0x0f70('0x26')](function(_0x375dc3){_0x50b9c3['count']=_0x375dc3;if(_0x3119a8[_0x0f70('0x34')][_0x0f70('0x42')]){_0x3342af['include']=[{'all':!![]}];}return db[_0x0f70('0x5c')]['findAll'](_0x3342af);})[_0x0f70('0x26')](function(_0x4d4375){_0x50b9c3[_0x0f70('0x44')]=_0x4d4375;return _0x50b9c3;});}})[_0x0f70('0x26')](respondWithFilteredResult(_0x543fc2,_0x3342af))['catch'](handleError(_0x543fc2,null));};exports[_0x0f70('0x5d')]=function(_0x116e29,_0x26f7fb,_0x5157d2){var _0xa5fe15={'raw':!![],'where':{}};var _0x884289={};var _0x58a42d={'count':0x0,'rows':[]};return db[_0x0f70('0x41')][_0x0f70('0x5e')]({'where':{'id':_0x116e29[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0x26f7fb,null))[_0x0f70('0x26')](function(_0x2d8769){if(_0x2d8769){_0x884289[_0x0f70('0x32')]=_[_0x0f70('0x48')](db[_0x0f70('0x5f')][_0x0f70('0x2e')]);_0x884289['query']=_[_0x0f70('0x48')](_0x116e29[_0x0f70('0x34')]);_0x884289[_0x0f70('0x3c')]=_[_0x0f70('0x35')](_0x884289[_0x0f70('0x32')],_0x884289[_0x0f70('0x34')]);_0xa5fe15[_0x0f70('0x36')]=_[_0x0f70('0x35')](_0x884289[_0x0f70('0x32')],qs[_0x0f70('0x37')](_0x116e29[_0x0f70('0x34')][_0x0f70('0x37')]));_0xa5fe15[_0x0f70('0x36')]=_0xa5fe15[_0x0f70('0x36')][_0x0f70('0x49')]?_0xa5fe15[_0x0f70('0x36')]:_0x884289['model'];if(!_0x116e29[_0x0f70('0x34')]['hasOwnProperty']('nolimit')){_0xa5fe15[_0x0f70('0x20')]=qs[_0x0f70('0x20')](_0x116e29[_0x0f70('0x34')][_0x0f70('0x20')]);_0xa5fe15[_0x0f70('0x1d')]=qs['offset'](_0x116e29[_0x0f70('0x34')]['offset']);}_0xa5fe15[_0x0f70('0x39')]=qs[_0x0f70('0x3a')](_0x116e29['query'][_0x0f70('0x3a')]);_0xa5fe15[_0x0f70('0x3b')]=qs[_0x0f70('0x3c')](_[_0x0f70('0x59')](_0x116e29[_0x0f70('0x34')],_0x884289[_0x0f70('0x3c')]));_0xa5fe15[_0x0f70('0x3b')]['CampaignId']=_0x2d8769['id'];if(_0x116e29[_0x0f70('0x34')]['filter']){_0xa5fe15[_0x0f70('0x3b')]=_[_0x0f70('0x3e')](_0xa5fe15[_0x0f70('0x3b')],{'$or':_[_0x0f70('0x5b')](_0xa5fe15[_0x0f70('0x36')],function(_0x467914){var _0x1aa6e9={};_0x1aa6e9[_0x467914]={'$like':'%'+_0x116e29[_0x0f70('0x34')][_0x0f70('0x3d')]+'%'};return _0x1aa6e9;})});}_0xa5fe15=_['merge']({},_0xa5fe15,_0x116e29[_0x0f70('0x40')]);return db[_0x0f70('0x5f')][_0x0f70('0x1f')]({'where':_0xa5fe15[_0x0f70('0x3b')]})['then'](function(_0x4a79a8){_0x58a42d[_0x0f70('0x1f')]=_0x4a79a8;if(_0x116e29[_0x0f70('0x34')][_0x0f70('0x42')]){_0xa5fe15[_0x0f70('0x43')]=[{'all':!![]}];}return db[_0x0f70('0x5f')][_0x0f70('0x60')](_0xa5fe15);})[_0x0f70('0x26')](function(_0x4837ee){_0x58a42d[_0x0f70('0x44')]=_0x4837ee;return _0x58a42d;});}})[_0x0f70('0x26')](respondWithFilteredResult(_0x26f7fb,_0xa5fe15))[_0x0f70('0x45')](handleError(_0x26f7fb,null));};exports[_0x0f70('0x61')]=function(_0x8f1cc,_0x2f750b,_0x34d81d){var _0x233cda={'raw':!![],'where':{}};var _0x571707={};var _0xc771bb={'count':0x0,'rows':[]};return db['Campaign'][_0x0f70('0x5e')]({'where':{'id':_0x8f1cc[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0x2f750b,null))[_0x0f70('0x26')](function(_0x3d20c6){if(_0x3d20c6){_0x571707[_0x0f70('0x32')]=_[_0x0f70('0x48')](db[_0x0f70('0x62')][_0x0f70('0x2e')]);_0x571707[_0x0f70('0x34')]=_['keys'](_0x8f1cc['query']);_0x571707[_0x0f70('0x3c')]=_['intersection'](_0x571707['model'],_0x571707[_0x0f70('0x34')]);_0x233cda[_0x0f70('0x36')]=_['intersection'](_0x571707[_0x0f70('0x32')],qs[_0x0f70('0x37')](_0x8f1cc[_0x0f70('0x34')][_0x0f70('0x37')]));_0x233cda[_0x0f70('0x36')]=_0x233cda[_0x0f70('0x36')][_0x0f70('0x49')]?_0x233cda['attributes']:_0x571707[_0x0f70('0x32')];if(!_0x8f1cc[_0x0f70('0x34')][_0x0f70('0x38')](_0x0f70('0x58'))){_0x233cda[_0x0f70('0x20')]=qs[_0x0f70('0x20')](_0x8f1cc[_0x0f70('0x34')]['limit']);_0x233cda[_0x0f70('0x1d')]=qs[_0x0f70('0x1d')](_0x8f1cc['query'][_0x0f70('0x1d')]);}_0x233cda['order']=qs[_0x0f70('0x3a')](_0x8f1cc['query']['sort']);_0x233cda[_0x0f70('0x3b')]=qs[_0x0f70('0x3c')](_['pick'](_0x8f1cc[_0x0f70('0x34')],_0x571707[_0x0f70('0x3c')]));_0x233cda[_0x0f70('0x3b')]['CampaignId']=_0x3d20c6['id'];if(_0x8f1cc['query'][_0x0f70('0x3d')]){_0x233cda[_0x0f70('0x3b')]=_[_0x0f70('0x3e')](_0x233cda[_0x0f70('0x3b')],{'$or':_[_0x0f70('0x5b')](_0x233cda[_0x0f70('0x36')],function(_0xa286fc){var _0x212470={};_0x212470[_0xa286fc]={'$like':'%'+_0x8f1cc['query']['filter']+'%'};return _0x212470;})});}_0x233cda=_[_0x0f70('0x3e')]({},_0x233cda,_0x8f1cc[_0x0f70('0x40')]);return db[_0x0f70('0x62')]['count']({'where':_0x233cda[_0x0f70('0x3b')]})[_0x0f70('0x26')](function(_0x5b1d86){_0xc771bb[_0x0f70('0x1f')]=_0x5b1d86;if(_0x8f1cc['query'][_0x0f70('0x42')]){_0x233cda['include']=[{'all':!![]}];}return db[_0x0f70('0x62')][_0x0f70('0x60')](_0x233cda);})[_0x0f70('0x26')](function(_0x4219bd){_0xc771bb[_0x0f70('0x44')]=_0x4219bd;return _0xc771bb;});}})[_0x0f70('0x26')](respondWithFilteredResult(_0x2f750b,_0x233cda))[_0x0f70('0x45')](handleError(_0x2f750b,null));};exports[_0x0f70('0x63')]=function(_0x3f317d,_0x2bdf07,_0x37d665){var _0x3f0e52={'raw':!![],'where':{}};var _0x161f1d={};var _0x4c9125={'count':0x0,'rows':[]};return db[_0x0f70('0x41')][_0x0f70('0x5e')]({'where':{'id':_0x3f317d[_0x0f70('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bdf07,null))['then'](function(_0x5cd825){if(_0x5cd825){_0x161f1d[_0x0f70('0x32')]=_[_0x0f70('0x48')](db[_0x0f70('0x64')][_0x0f70('0x2e')]);_0x161f1d[_0x0f70('0x34')]=_[_0x0f70('0x48')](_0x3f317d[_0x0f70('0x34')]);_0x161f1d[_0x0f70('0x3c')]=_[_0x0f70('0x35')](_0x161f1d[_0x0f70('0x32')],_0x161f1d[_0x0f70('0x34')]);_0x3f0e52[_0x0f70('0x36')]=_[_0x0f70('0x35')](_0x161f1d[_0x0f70('0x32')],qs[_0x0f70('0x37')](_0x3f317d[_0x0f70('0x34')]['fields']));_0x3f0e52[_0x0f70('0x36')]=_0x3f0e52[_0x0f70('0x36')][_0x0f70('0x49')]?_0x3f0e52[_0x0f70('0x36')]:_0x161f1d[_0x0f70('0x32')];if(!_0x3f317d[_0x0f70('0x34')][_0x0f70('0x38')](_0x0f70('0x58'))){_0x3f0e52[_0x0f70('0x20')]=qs[_0x0f70('0x20')](_0x3f317d['query'][_0x0f70('0x20')]);_0x3f0e52['offset']=qs['offset'](_0x3f317d[_0x0f70('0x34')][_0x0f70('0x1d')]);}_0x3f0e52['order']=qs[_0x0f70('0x3a')](_0x3f317d[_0x0f70('0x34')][_0x0f70('0x3a')]);_0x3f0e52[_0x0f70('0x3b')]=qs[_0x0f70('0x3c')](_[_0x0f70('0x59')](_0x3f317d[_0x0f70('0x34')],_0x161f1d[_0x0f70('0x3c')]));_0x3f0e52[_0x0f70('0x3b')][_0x0f70('0x5a')]=_0x5cd825['id'];if(_0x3f317d['query']['filter']){_0x3f0e52[_0x0f70('0x3b')]=_[_0x0f70('0x3e')](_0x3f0e52[_0x0f70('0x3b')],{'$or':_[_0x0f70('0x5b')](_0x3f0e52[_0x0f70('0x36')],function(_0x859f9d){var _0x2a86fe={};_0x2a86fe[_0x859f9d]={'$like':'%'+_0x3f317d[_0x0f70('0x34')]['filter']+'%'};return _0x2a86fe;})});}_0x3f0e52=_['merge']({},_0x3f0e52,_0x3f317d[_0x0f70('0x40')]);return db[_0x0f70('0x64')][_0x0f70('0x1f')]({'where':_0x3f0e52['where']})[_0x0f70('0x26')](function(_0x19840c){_0x4c9125['count']=_0x19840c;if(_0x3f317d['query']['includeAll']){_0x3f0e52[_0x0f70('0x43')]=[{'all':!![]}];}return db[_0x0f70('0x64')][_0x0f70('0x60')](_0x3f0e52);})[_0x0f70('0x26')](function(_0x5056c3){_0x4c9125[_0x0f70('0x44')]=_0x5056c3;return _0x4c9125;});}})['then'](respondWithFilteredResult(_0x2bdf07,_0x3f0e52))['catch'](handleError(_0x2bdf07,null));};exports[_0x0f70('0x65')]=function(_0x535b95,_0x4c9c53,_0x8ce017){var _0x2ecf89={};var _0x2a3051={};var _0x5f1168;var _0x24c597;return db['Campaign'][_0x0f70('0x5e')]({'where':{'id':_0x535b95['params']['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0x4c9c53,null))['then'](function(_0x145634){if(_0x145634){_0x5f1168=_0x145634;_0x2a3051['model']=_[_0x0f70('0x48')](db['CmList'][_0x0f70('0x2e')]);_0x2a3051[_0x0f70('0x34')]=_[_0x0f70('0x48')](_0x535b95['query']);_0x2a3051[_0x0f70('0x3c')]=_[_0x0f70('0x35')](_0x2a3051['model'],_0x2a3051[_0x0f70('0x34')]);_0x2ecf89[_0x0f70('0x36')]=_[_0x0f70('0x35')](_0x2a3051[_0x0f70('0x32')],qs[_0x0f70('0x37')](_0x535b95[_0x0f70('0x34')][_0x0f70('0x37')]));_0x2ecf89[_0x0f70('0x36')]=_0x2ecf89[_0x0f70('0x36')]['length']?_0x2ecf89[_0x0f70('0x36')]:_0x2a3051[_0x0f70('0x32')];_0x2ecf89[_0x0f70('0x39')]=qs[_0x0f70('0x3a')](_0x535b95['query'][_0x0f70('0x3a')]);_0x2ecf89['where']=qs['filters'](_[_0x0f70('0x59')](_0x535b95[_0x0f70('0x34')],_0x2a3051[_0x0f70('0x3c')]));if(_0x535b95['query'][_0x0f70('0x3d')]){_0x2ecf89['where']=_[_0x0f70('0x3e')](_0x2ecf89['where'],{'$or':_[_0x0f70('0x5b')](_0x2ecf89['attributes'],function(_0x55be1d){var _0x16d8c2={};_0x16d8c2[_0x55be1d]={'$like':'%'+_0x535b95[_0x0f70('0x34')][_0x0f70('0x3d')]+'%'};return _0x16d8c2;})});}_0x2ecf89=_[_0x0f70('0x3e')]({},_0x2ecf89,_0x535b95[_0x0f70('0x40')]);return _0x5f1168[_0x0f70('0x65')](_0x2ecf89);}})['then'](function(_0x27084d){if(_0x27084d){_0x24c597=_0x27084d[_0x0f70('0x49')];if(!_0x535b95[_0x0f70('0x34')][_0x0f70('0x38')](_0x0f70('0x58'))){_0x2ecf89[_0x0f70('0x20')]=qs['limit'](_0x535b95[_0x0f70('0x34')][_0x0f70('0x20')]);_0x2ecf89[_0x0f70('0x1d')]=qs['offset'](_0x535b95[_0x0f70('0x34')]['offset']);}return _0x5f1168[_0x0f70('0x65')](_0x2ecf89);}})[_0x0f70('0x26')](function(_0x5b21d5){if(_0x5b21d5){return _0x5b21d5?{'count':_0x24c597,'rows':_0x5b21d5}:null;}})[_0x0f70('0x26')](respondWithResult(_0x4c9c53,null))[_0x0f70('0x45')](handleError(_0x4c9c53,null));};exports[_0x0f70('0x66')]=function(_0x439d04,_0x14c9a6,_0x2085b5){var _0x1c91c5,_0xf401df;return db[_0x0f70('0x41')][_0x0f70('0x4a')]({'where':{'id':_0x439d04[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0x14c9a6,null))[_0x0f70('0x26')](function(_0xdbf461){if(_0xdbf461){_0xf401df=_0xdbf461;return _0xdbf461[_0x0f70('0x66')](_0x439d04[_0x0f70('0x4c')]['ids'],_['omit'](_0x439d04[_0x0f70('0x4c')],[_0x0f70('0x67'),'id'])||{});}return null;})['spread'](function(_0x426569){var _0x277c3e;_0x1c91c5=_0x426569||[];var _0x10b36b=[];if(_0x426569){for(var _0x91cb44=0x0;_0x91cb44<_0x426569[_0x0f70('0x49')];_0x91cb44+=0x1){var _0x217025=_0x426569[_0x91cb44]['get']({'plain':!![]});_0xf401df[_0x0f70('0x68')]=_0x439d04['body'][_0x0f70('0x68')]?_0x439d04['body']['dialCheckDuplicateType']:_0xf401df[_0x0f70('0x68')];switch(_0xf401df[_0x0f70('0x68')]){case _0x0f70('0x69'):_0x277c3e=squel[_0x0f70('0x6a')]()[_0x0f70('0x6b')]('cm_hopper')[_0x0f70('0x6c')]([_0x0f70('0x6d'),_0x0f70('0x6e'),'ContactId',_0x0f70('0x6f'),'CampaignId',_0x0f70('0x54'),_0x0f70('0x55')],squel[_0x0f70('0x70')]()[_0x0f70('0x71')]('phone',_0x0f70('0x6d'))[_0x0f70('0x71')](_0x0f70('0x72'),_0x0f70('0x6e'))[_0x0f70('0x71')]('id','ContactId')[_0x0f70('0x71')](_0x217025[_0x0f70('0x73')][_0x0f70('0x74')](),_0x0f70('0x6f'))['field'](_0x439d04[_0x0f70('0x47')]['id']['toString'](),_0x0f70('0x5a'))['field'](_0x0f70('0x72'),'createdAt')[_0x0f70('0x71')](_0x0f70('0x72'),_0x0f70('0x55'))['from'](_0x0f70('0x75'))[_0x0f70('0x3b')](_0x0f70('0x76'))[_0x0f70('0x3b')](_0x0f70('0x77'),_0x217025[_0x0f70('0x73')][_0x0f70('0x74')]())[_0x0f70('0x3b')](_0x0f70('0x78'))[_0x0f70('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x0f70('0x79'))['where'](_0x0f70('0x7a'),_0x439d04[_0x0f70('0x47')]['id'][_0x0f70('0x74')]()))['where'](_0x0f70('0x7b'),squel['select']()[_0x0f70('0x71')](_0x0f70('0x7c'))[_0x0f70('0x7d')](_0x0f70('0x7e'))[_0x0f70('0x3b')](_0x0f70('0x7a'),_0x439d04[_0x0f70('0x47')]['id'][_0x0f70('0x74')]())))[_0x0f70('0x74')]();break;case _0x0f70('0x7f'):_0x277c3e=squel[_0x0f70('0x6a')]()['into'](_0x0f70('0x7e'))['fromQuery']([_0x0f70('0x6d'),_0x0f70('0x6e'),_0x0f70('0x80'),_0x0f70('0x6f'),_0x0f70('0x5a'),'createdAt',_0x0f70('0x55')],squel[_0x0f70('0x70')]()[_0x0f70('0x71')](_0x0f70('0x6d'),_0x0f70('0x6d'))[_0x0f70('0x71')](_0x0f70('0x72'),_0x0f70('0x6e'))['field']('id','ContactId')[_0x0f70('0x71')](_0x217025['CmListId'][_0x0f70('0x74')](),_0x0f70('0x6f'))[_0x0f70('0x71')](_0x439d04[_0x0f70('0x47')]['id']['toString'](),_0x0f70('0x5a'))[_0x0f70('0x71')]('NOW()',_0x0f70('0x54'))['field']('NOW()','updatedAt')[_0x0f70('0x7d')](_0x0f70('0x75'))[_0x0f70('0x3b')](_0x0f70('0x76'))[_0x0f70('0x3b')]('ListId\x20=\x20?',_0x217025[_0x0f70('0x73')][_0x0f70('0x74')]())[_0x0f70('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0f70('0x70')]()[_0x0f70('0x71')]('COALESCE(phone,\x27\x27)')[_0x0f70('0x7d')]('cm_hopper')[_0x0f70('0x3b')](_0x0f70('0x7a'),_0x439d04[_0x0f70('0x47')]['id'][_0x0f70('0x74')]())))[_0x0f70('0x74')]();break;default:_0x277c3e=squel[_0x0f70('0x6a')]()[_0x0f70('0x6b')]('cm_hopper')[_0x0f70('0x6c')]([_0x0f70('0x6d'),_0x0f70('0x6e'),_0x0f70('0x80'),_0x0f70('0x6f'),_0x0f70('0x5a'),'createdAt',_0x0f70('0x55')],squel[_0x0f70('0x70')]()['field'](_0x0f70('0x6d'),'phone')[_0x0f70('0x71')](_0x0f70('0x72'),'scheduledAt')[_0x0f70('0x71')]('id','ContactId')[_0x0f70('0x71')](_0x217025[_0x0f70('0x73')]['toString'](),'ListId')['field'](_0x439d04[_0x0f70('0x47')]['id'][_0x0f70('0x74')](),_0x0f70('0x5a'))[_0x0f70('0x71')](_0x0f70('0x72'),_0x0f70('0x54'))[_0x0f70('0x71')](_0x0f70('0x72'),'updatedAt')[_0x0f70('0x7d')](_0x0f70('0x75'))[_0x0f70('0x3b')](_0x0f70('0x76'))[_0x0f70('0x3b')](_0x0f70('0x77'),_0x217025[_0x0f70('0x73')]['toString']())['where'](_0x0f70('0x78')))[_0x0f70('0x74')]();}_0x10b36b['push'](db[_0x0f70('0x81')][_0x0f70('0x34')](_0x277c3e));}return BPromise[_0x0f70('0x82')](_0x10b36b);}})[_0x0f70('0x26')](function(){return _0x1c91c5;})[_0x0f70('0x26')](respondWithResult(_0x14c9a6,null))['catch'](handleError(_0x14c9a6,null));};exports[_0x0f70('0x83')]=function(_0x379732,_0x949efd,_0x45a838){return db[_0x0f70('0x41')][_0x0f70('0x4a')]({'where':{'id':_0x379732[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0x949efd,null))[_0x0f70('0x26')](function(_0x1caec6){if(_0x1caec6){return _0x1caec6[_0x0f70('0x83')](_0x379732[_0x0f70('0x34')][_0x0f70('0x67')]);}})['then'](function(_0x41c313){if(_0x41c313){return db[_0x0f70('0x5c')][_0x0f70('0x27')]({'where':{'ListId':_0x379732[_0x0f70('0x34')][_0x0f70('0x67')],'CampaignId':_0x379732[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](function(){return _0x41c313;});}})[_0x0f70('0x26')](respondWithStatusCode(_0x949efd,null))[_0x0f70('0x45')](handleError(_0x949efd,null));};exports[_0x0f70('0x84')]=function(_0x5f1ec6,_0x1c085b,_0x5f4671){var _0x233f63={};var _0x10e3e0={};var _0x2a4de6;var _0x48b532;return db['Campaign'][_0x0f70('0x5e')]({'where':{'id':_0x5f1ec6['params']['id']}})['then'](handleEntityNotFound(_0x1c085b,null))['then'](function(_0x52cdbd){if(_0x52cdbd){_0x2a4de6=_0x52cdbd;_0x10e3e0[_0x0f70('0x32')]=_[_0x0f70('0x48')](db[_0x0f70('0x85')][_0x0f70('0x2e')]);_0x10e3e0['query']=_[_0x0f70('0x48')](_0x5f1ec6[_0x0f70('0x34')]);_0x10e3e0['filters']=_[_0x0f70('0x35')](_0x10e3e0[_0x0f70('0x32')],_0x10e3e0['query']);_0x233f63[_0x0f70('0x36')]=_[_0x0f70('0x35')](_0x10e3e0['model'],qs[_0x0f70('0x37')](_0x5f1ec6[_0x0f70('0x34')][_0x0f70('0x37')]));_0x233f63['attributes']=_0x233f63[_0x0f70('0x36')][_0x0f70('0x49')]?_0x233f63[_0x0f70('0x36')]:_0x10e3e0[_0x0f70('0x32')];_0x233f63[_0x0f70('0x39')]=qs['sort'](_0x5f1ec6[_0x0f70('0x34')][_0x0f70('0x3a')]);_0x233f63[_0x0f70('0x3b')]=qs[_0x0f70('0x3c')](_[_0x0f70('0x59')](_0x5f1ec6[_0x0f70('0x34')],_0x10e3e0[_0x0f70('0x3c')]));if(_0x5f1ec6[_0x0f70('0x34')][_0x0f70('0x3d')]){_0x233f63['where']=_[_0x0f70('0x3e')](_0x233f63[_0x0f70('0x3b')],{'$or':_[_0x0f70('0x5b')](_0x233f63['attributes'],function(_0xd7039e){var _0x5de210={};_0x5de210[_0xd7039e]={'$like':'%'+_0x5f1ec6[_0x0f70('0x34')]['filter']+'%'};return _0x5de210;})});}_0x233f63=_[_0x0f70('0x3e')]({},_0x233f63,_0x5f1ec6[_0x0f70('0x40')]);return _0x2a4de6[_0x0f70('0x84')](_0x233f63);}})[_0x0f70('0x26')](function(_0x3379a7){if(_0x3379a7){_0x48b532=_0x3379a7[_0x0f70('0x49')];if(!_0x5f1ec6[_0x0f70('0x34')][_0x0f70('0x38')](_0x0f70('0x58'))){_0x233f63[_0x0f70('0x20')]=qs[_0x0f70('0x20')](_0x5f1ec6['query']['limit']);_0x233f63[_0x0f70('0x1d')]=qs[_0x0f70('0x1d')](_0x5f1ec6[_0x0f70('0x34')][_0x0f70('0x1d')]);}return _0x2a4de6[_0x0f70('0x84')](_0x233f63);}})['then'](function(_0x31594b){if(_0x31594b){return _0x31594b?{'count':_0x48b532,'rows':_0x31594b}:null;}})[_0x0f70('0x26')](respondWithResult(_0x1c085b,null))[_0x0f70('0x45')](handleError(_0x1c085b,null));};exports['addBlackLists']=function(_0x44bdf9,_0xf826ec,_0x549e00){var _0x511d55,_0x19aa8e;return db[_0x0f70('0x41')][_0x0f70('0x4a')]({'where':{'id':_0x44bdf9[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0xf826ec,null))[_0x0f70('0x26')](function(_0x2fb87f){if(_0x2fb87f){_0x19aa8e=_0x2fb87f;return _0x2fb87f[_0x0f70('0x86')](_0x44bdf9[_0x0f70('0x4c')][_0x0f70('0x67')],_['omit'](_0x44bdf9[_0x0f70('0x4c')],['ids','id'])||{});}return null;})[_0x0f70('0x87')](function(_0x38b9a3){var _0x40de6f;_0x511d55=_0x38b9a3||[];var _0x1dcedc=[];if(_0x38b9a3){for(var _0x268172=0x0;_0x268172<_0x38b9a3['length'];_0x268172+=0x1){var _0x46f4fc=_0x38b9a3[_0x268172][_0x0f70('0x28')]({'plain':!![]});_0x40de6f=squel[_0x0f70('0x6a')]()[_0x0f70('0x6b')](_0x0f70('0x88'))[_0x0f70('0x6c')]([_0x0f70('0x6d'),'ContactId','ListId',_0x0f70('0x5a'),_0x0f70('0x54'),_0x0f70('0x55')],squel[_0x0f70('0x70')]()['field'](_0x0f70('0x6d'),'phone')[_0x0f70('0x71')]('id',_0x0f70('0x80'))[_0x0f70('0x71')](_0x46f4fc[_0x0f70('0x73')]['toString'](),_0x0f70('0x6f'))['field'](_0x44bdf9[_0x0f70('0x47')]['id']['toString'](),'CampaignId')[_0x0f70('0x71')](_0x0f70('0x72'),_0x0f70('0x54'))[_0x0f70('0x71')](_0x0f70('0x72'),_0x0f70('0x55'))['from'](_0x0f70('0x75'))['where'](_0x0f70('0x76'))[_0x0f70('0x3b')]('ListId\x20=\x20?',_0x46f4fc[_0x0f70('0x73')][_0x0f70('0x74')]())[_0x0f70('0x3b')](_0x0f70('0x78')))['toString']();_0x1dcedc[_0x0f70('0x89')](db[_0x0f70('0x81')][_0x0f70('0x34')](_0x40de6f));}return BPromise[_0x0f70('0x82')](_0x1dcedc);}})[_0x0f70('0x26')](function(){return _0x511d55;})[_0x0f70('0x26')](respondWithResult(_0xf826ec,null))[_0x0f70('0x45')](handleError(_0xf826ec,null));};exports[_0x0f70('0x8a')]=function(_0x45a881,_0x4f0564,_0x5c045f){return db[_0x0f70('0x41')][_0x0f70('0x4a')]({'where':{'id':_0x45a881[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](handleEntityNotFound(_0x4f0564,null))[_0x0f70('0x26')](function(_0xc7d1cd){if(_0xc7d1cd){return _0xc7d1cd[_0x0f70('0x8a')](_0x45a881[_0x0f70('0x34')][_0x0f70('0x67')]);}})[_0x0f70('0x26')](function(_0x20fdf8){if(_0x20fdf8){return db[_0x0f70('0x64')][_0x0f70('0x27')]({'where':{'ListId':_0x45a881['query'][_0x0f70('0x67')],'CampaignId':_0x45a881[_0x0f70('0x47')]['id']}})[_0x0f70('0x26')](function(){return _0x20fdf8;});}})['then'](respondWithStatusCode(_0x4f0564,null))[_0x0f70('0x45')](handleError(_0x4f0564,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ee07702..e809d98 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4147b1,_0x34bf45){var _0x5b1d00=function(_0x287950){while(--_0x287950){_0x4147b1['push'](_0x4147b1['shift']());}};_0x5b1d00(++_0x34bf45);}(_0x7a54,0x106));var _0x47a5=function(_0x185035,_0x5c0a3c){_0x185035=_0x185035-0x0;var _0xaae8f3=_0x7a54[_0x185035];return _0xaae8f3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index df6d538..b713d2c 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 _0xde64=['randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','map','include','model','attributes','debug','lodash','util','moment','bluebird'];(function(_0x49c451,_0x30e41d){var _0x2a470d=function(_0x4c0b41){while(--_0x4c0b41){_0x49c451['push'](_0x49c451['shift']());}};_0x2a470d(++_0x30e41d);}(_0xde64,0x17c));var _0x4de6=function(_0x59a6ef,_0xe0cbdd){_0x59a6ef=_0x59a6ef-0x0;var _0x1809cf=_0xde64[_0x59a6ef];return _0x1809cf;};'use strict';var _=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var moment=require(_0x4de6('0x2'));var BPromise=require(_0x4de6('0x3'));var rs=require(_0x4de6('0x4'));var fs=require('fs');var Redis=require(_0x4de6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4de6('0x6'));var logger=require(_0x4de6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4de6('0x8'));var client=jayson[_0x4de6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568496,_0x24edef,_0x35ae72){return new BPromise(function(_0x475fb9,_0x248e39){return client[_0x4de6('0xa')](_0x568496,_0x35ae72)[_0x4de6('0xb')](function(_0x48a974){logger[_0x4de6('0xc')](_0x4de6('0xd'),_0x24edef,_0x4de6('0xe'));logger['debug'](_0x4de6('0xf'),_0x24edef,_0x4de6('0xe'),JSON[_0x4de6('0x10')](_0x48a974));if(_0x48a974[_0x4de6('0x11')]){if(_0x48a974[_0x4de6('0x11')]['code']===0x1f4){logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x48a974[_0x4de6('0x11')]['message']);return _0x248e39(_0x48a974[_0x4de6('0x11')][_0x4de6('0x12')]);}logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x48a974['error'][_0x4de6('0x12')]);return _0x475fb9(_0x48a974[_0x4de6('0x11')][_0x4de6('0x12')]);}else{logger['info'](_0x4de6('0xd'),_0x24edef,'request\x20sent');_0x475fb9(_0x48a974['result'][_0x4de6('0x12')]);}})[_0x4de6('0x13')](function(_0x6dbcf3){logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x6dbcf3);_0x248e39(_0x6dbcf3);});});}exports[_0x4de6('0x14')]=function(_0x324202){var _0x5aacb4=this;return new Promise(function(_0x420f7c,_0xea1610){return db[_0x4de6('0x15')][_0x4de6('0x16')]({'raw':_0x324202[_0x4de6('0x17')]?_0x324202[_0x4de6('0x17')][_0x4de6('0x18')]===undefined?!![]:![]:!![],'where':_0x324202[_0x4de6('0x17')]?_0x324202[_0x4de6('0x17')][_0x4de6('0x19')]||null:null,'attributes':_0x324202['options']?_0x324202[_0x4de6('0x17')]['attributes']||null:null,'limit':_0x324202[_0x4de6('0x17')]?_0x324202[_0x4de6('0x17')][_0x4de6('0x1a')]||null:null,'include':_0x324202['options']?_0x324202[_0x4de6('0x17')]['include']?_[_0x4de6('0x1b')](_0x324202[_0x4de6('0x17')][_0x4de6('0x1c')],function(_0x5ddbab){return{'model':db[_0x5ddbab[_0x4de6('0x1d')]],'as':_0x5ddbab['as'],'attributes':_0x5ddbab[_0x4de6('0x1e')],'include':_0x5ddbab[_0x4de6('0x1c')]?_[_0x4de6('0x1b')](_0x5ddbab[_0x4de6('0x1c')],function(_0x25a76b){return{'model':db[_0x25a76b[_0x4de6('0x1d')]],'as':_0x25a76b['as'],'attributes':_0x25a76b['attributes'],'include':_0x25a76b[_0x4de6('0x1c')]?_[_0x4de6('0x1b')](_0x25a76b[_0x4de6('0x1c')],function(_0x327215){return{'model':db[_0x327215[_0x4de6('0x1d')]],'as':_0x327215['as'],'attributes':_0x327215[_0x4de6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4de6('0xb')](function(_0x7bc61e){logger[_0x4de6('0xc')]('GetCampaign',_0x324202);logger[_0x4de6('0x1f')](_0x4de6('0x14'),_0x324202,JSON[_0x4de6('0x10')](_0x7bc61e));_0x420f7c(_0x7bc61e);})[_0x4de6('0x13')](function(_0x24a0a7){logger['error'](_0x4de6('0x14'),_0x24a0a7['message'],_0x324202);_0xea1610(_0x5aacb4[_0x4de6('0x11')](0x1f4,_0x24a0a7[_0x4de6('0x12')]));});});}; \ No newline at end of file +var _0x8cfd=['catch','Campaign','findAll','options','raw','where','limit','map','model','include','attributes','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x8cfd,0xe4));var _0xd8cf=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x8cfd[_0xd9c529];return _0x146760;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var moment=require(_0xd8cf('0x2'));var BPromise=require(_0xd8cf('0x3'));var rs=require(_0xd8cf('0x4'));var fs=require('fs');var Redis=require(_0xd8cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8cf('0x6'));var logger=require(_0xd8cf('0x7'))(_0xd8cf('0x8'));var config=require(_0xd8cf('0x9'));var jayson=require(_0xd8cf('0xa'));var client=jayson[_0xd8cf('0xb')][_0xd8cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b41b7,_0x5cfd20,_0x3fe2d2){return new BPromise(function(_0xa5b446,_0x37b91b){return client[_0xd8cf('0xd')](_0x4b41b7,_0x3fe2d2)[_0xd8cf('0xe')](function(_0x668d6c){logger['info'](_0xd8cf('0xf'),_0x5cfd20,_0xd8cf('0x10'));logger[_0xd8cf('0x11')](_0xd8cf('0x12'),_0x5cfd20,_0xd8cf('0x10'),JSON[_0xd8cf('0x13')](_0x668d6c));if(_0x668d6c[_0xd8cf('0x14')]){if(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x15')]===0x1f4){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c[_0xd8cf('0x14')]['message']);return _0x37b91b(_0x668d6c[_0xd8cf('0x14')]['message']);}logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c['error'][_0xd8cf('0x16')]);return _0xa5b446(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x16')]);}else{logger['info'](_0xd8cf('0xf'),_0x5cfd20,'request\x20sent');_0xa5b446(_0x668d6c[_0xd8cf('0x17')][_0xd8cf('0x16')]);}})[_0xd8cf('0x18')](function(_0x55018c){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x55018c);_0x37b91b(_0x55018c);});});}exports['GetCampaign']=function(_0xecd444){var _0x73e7c3=this;return new Promise(function(_0x3bee85,_0xf8732e){return db[_0xd8cf('0x19')][_0xd8cf('0x1a')]({'raw':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')][_0xd8cf('0x1c')]===undefined?!![]:![]:!![],'where':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')][_0xd8cf('0x1d')]||null:null,'attributes':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')]['attributes']||null:null,'limit':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')][_0xd8cf('0x1e')]||null:null,'include':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')]['include']?_[_0xd8cf('0x1f')](_0xecd444['options']['include'],function(_0x4e7d83){return{'model':db[_0x4e7d83[_0xd8cf('0x20')]],'as':_0x4e7d83['as'],'attributes':_0x4e7d83['attributes'],'include':_0x4e7d83[_0xd8cf('0x21')]?_[_0xd8cf('0x1f')](_0x4e7d83[_0xd8cf('0x21')],function(_0x667f44){return{'model':db[_0x667f44['model']],'as':_0x667f44['as'],'attributes':_0x667f44[_0xd8cf('0x22')],'include':_0x667f44[_0xd8cf('0x21')]?_[_0xd8cf('0x1f')](_0x667f44[_0xd8cf('0x21')],function(_0x2f97b1){return{'model':db[_0x2f97b1[_0xd8cf('0x20')]],'as':_0x2f97b1['as'],'attributes':_0x2f97b1['attributes']};}):[]};}):[]};}):[]:[]})[_0xd8cf('0xe')](function(_0x1453d3){logger['info'](_0xd8cf('0x23'),_0xecd444);logger[_0xd8cf('0x11')](_0xd8cf('0x23'),_0xecd444,JSON[_0xd8cf('0x13')](_0x1453d3));_0x3bee85(_0x1453d3);})[_0xd8cf('0x18')](function(_0x48013b){logger[_0xd8cf('0x14')](_0xd8cf('0x23'),_0x48013b[_0xd8cf('0x16')],_0xecd444);_0xf8732e(_0x73e7c3[_0xd8cf('0x14')](0x1f4,_0x48013b[_0xd8cf('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7743958..506a8cf 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 _0xf7cb=['../../config/environment','./campaign.controller','isAuthenticated','index','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','/:id/lists','addLists','addBlackLists','put','update','/:id','delete','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x452c94,_0xeddd6c){var _0x150446=function(_0x5eef33){while(--_0x5eef33){_0x452c94['push'](_0x452c94['shift']());}};_0x150446(++_0xeddd6c);}(_0xf7cb,0x1a9));var _0xbf7c=function(_0x355388,_0x3d00c1){_0x355388=_0x355388-0x0;var _0x324e01=_0xf7cb[_0x355388];return _0x324e01;};'use strict';var multer=require('multer');var util=require(_0xbf7c('0x0'));var path=require(_0xbf7c('0x1'));var timeout=require(_0xbf7c('0x2'));var express=require(_0xbf7c('0x3'));var router=express[_0xbf7c('0x4')]();var fs_extra=require(_0xbf7c('0x5'));var auth=require(_0xbf7c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbf7c('0x7'));var controller=require(_0xbf7c('0x8'));router['get']('/',auth[_0xbf7c('0x9')](),controller[_0xbf7c('0xa')]);router[_0xbf7c('0xb')]('/:id',auth[_0xbf7c('0x9')](),controller[_0xbf7c('0xc')]);router[_0xbf7c('0xb')](_0xbf7c('0xd'),auth[_0xbf7c('0x9')](),controller[_0xbf7c('0xe')]);router[_0xbf7c('0xb')](_0xbf7c('0xf'),auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x10')]);router[_0xbf7c('0xb')](_0xbf7c('0x11'),auth['isAuthenticated'](),controller[_0xbf7c('0x12')]);router[_0xbf7c('0xb')]('/:id/hopper_black',auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x13')]);router[_0xbf7c('0xb')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbf7c('0x14')]);router['get'](_0xbf7c('0x15'),auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x16')]);router[_0xbf7c('0x17')]('/',auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x18')]);router[_0xbf7c('0x17')](_0xbf7c('0x19'),auth[_0xbf7c('0x9')](),controller['clone']);router[_0xbf7c('0x17')](_0xbf7c('0x1a'),auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x1b')]);router[_0xbf7c('0x17')]('/:id/blacklists',auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x1c')]);router[_0xbf7c('0x1d')]('/:id',auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x1e')]);router['delete'](_0xbf7c('0x1f'),auth[_0xbf7c('0x9')](),controller['destroy']);router[_0xbf7c('0x20')](_0xbf7c('0x1a'),auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x21')]);router['delete'](_0xbf7c('0x15'),auth[_0xbf7c('0x9')](),controller[_0xbf7c('0x22')]);module[_0xbf7c('0x23')]=router; \ No newline at end of file +var _0x7085=['addBlackLists','update','delete','destroy','removeLists','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','create','post','/:id/clone','/:id/lists','addLists'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x7085,0x125));var _0x5708=function(_0x4d6624,_0x78b606){_0x4d6624=_0x4d6624-0x0;var _0x5dbb01=_0x7085[_0x4d6624];return _0x5dbb01;};'use strict';var multer=require(_0x5708('0x0'));var util=require(_0x5708('0x1'));var path=require(_0x5708('0x2'));var timeout=require(_0x5708('0x3'));var express=require('express');var router=express[_0x5708('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5708('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5708('0x6'));var controller=require(_0x5708('0x7'));router[_0x5708('0x8')]('/',auth['isAuthenticated'](),controller[_0x5708('0x9')]);router[_0x5708('0x8')](_0x5708('0xa'),auth[_0x5708('0xb')](),controller[_0x5708('0xc')]);router[_0x5708('0x8')](_0x5708('0xd'),auth[_0x5708('0xb')](),controller[_0x5708('0xe')]);router[_0x5708('0x8')](_0x5708('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x5708('0x8')](_0x5708('0x10'),auth[_0x5708('0xb')](),controller[_0x5708('0x11')]);router['get'](_0x5708('0x12'),auth['isAuthenticated'](),controller[_0x5708('0x13')]);router[_0x5708('0x8')]('/:id/lists',auth[_0x5708('0xb')](),controller['getLists']);router[_0x5708('0x8')](_0x5708('0x14'),auth[_0x5708('0xb')](),controller[_0x5708('0x15')]);router['post']('/',auth[_0x5708('0xb')](),controller[_0x5708('0x16')]);router[_0x5708('0x17')](_0x5708('0x18'),auth[_0x5708('0xb')](),controller['clone']);router['post'](_0x5708('0x19'),auth[_0x5708('0xb')](),controller[_0x5708('0x1a')]);router[_0x5708('0x17')]('/:id/blacklists',auth[_0x5708('0xb')](),controller[_0x5708('0x1b')]);router['put'](_0x5708('0xa'),auth[_0x5708('0xb')](),controller[_0x5708('0x1c')]);router[_0x5708('0x1d')](_0x5708('0xa'),auth[_0x5708('0xb')](),controller[_0x5708('0x1e')]);router[_0x5708('0x1d')]('/:id/lists',auth['isAuthenticated'](),controller[_0x5708('0x1f')]);router['delete'](_0x5708('0x14'),auth[_0x5708('0xb')](),controller['removeBlackLists']);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 01833d6..a21d4d6 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 _0x9864=['sequelize','exports','STRING','VIRTUAL','getDataValue','key'];(function(_0x4f6329,_0x253a75){var _0x2238bd=function(_0x2dfa77){while(--_0x2dfa77){_0x4f6329['push'](_0x4f6329['shift']());}};_0x2238bd(++_0x253a75);}(_0x9864,0x84));var _0x4986=function(_0x163838,_0x58a700){_0x163838=_0x163838-0x0;var _0xe51f37=_0x9864[_0x163838];return _0xe51f37;};'use strict';var Sequelize=require(_0x4986('0x0'));module[_0x4986('0x1')]={'key':{'type':Sequelize[_0x4986('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x4986('0x2')]},'name':{'type':Sequelize[_0x4986('0x3')],'get':function(){return this[_0x4986('0x4')](_0x4986('0x5'));}}}; \ No newline at end of file +var _0x06c0=['exports','TEXT','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x06c0,0x1e9));var _0x006c=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x06c0[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x006c('0x0'));module[_0x006c('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x006c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x006c('0x3')]},'name':{'type':Sequelize[_0x006c('0x4')],'get':function(){return this[_0x006c('0x5')](_0x006c('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 761b581..f3f8bba 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 _0x5e75=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','CannedAnswers','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','where','merge','filter','options','CannedAnswer','includeAll','include','rows','catch','show','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.'];(function(_0x54f253,_0x13acb1){var _0x207e8d=function(_0x32b855){while(--_0x32b855){_0x54f253['push'](_0x54f253['shift']());}};_0x207e8d(++_0x13acb1);}(_0x5e75,0x108));var _0x55e7=function(_0x398cb4,_0x4971c1){_0x398cb4=_0x398cb4-0x0;var _0x1825d1=_0x5e75[_0x398cb4];return _0x1825d1;};'use strict';var emlformat=require(_0x55e7('0x0'));var rimraf=require(_0x55e7('0x1'));var zipdir=require(_0x55e7('0x2'));var jsonpatch=require(_0x55e7('0x3'));var rp=require(_0x55e7('0x4'));var moment=require(_0x55e7('0x5'));var BPromise=require(_0x55e7('0x6'));var Mustache=require(_0x55e7('0x7'));var util=require(_0x55e7('0x8'));var path=require(_0x55e7('0x9'));var sox=require(_0x55e7('0xa'));var csv=require(_0x55e7('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x55e7('0xc'));var _=require(_0x55e7('0xd'));var squel=require(_0x55e7('0xe'));var crypto=require(_0x55e7('0xf'));var jsforce=require(_0x55e7('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x55e7('0xb'));var querystring=require(_0x55e7('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x55e7('0x12'));var as=require(_0x55e7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x55e7('0x14'));var utils=require(_0x55e7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x55e7('0x16'));var db=require(_0x55e7('0x17'))['db'];function respondWithStatusCode(_0x4cab61,_0x115623){_0x115623=_0x115623||0xcc;return function(_0x16242b){if(_0x16242b){return _0x4cab61[_0x55e7('0x18')](_0x115623);}return _0x4cab61[_0x55e7('0x19')](_0x115623)[_0x55e7('0x1a')]();};}function respondWithResult(_0x21e392,_0x1ea59d){_0x1ea59d=_0x1ea59d||0xc8;return function(_0x1cc004){if(_0x1cc004){return _0x21e392['status'](_0x1ea59d)[_0x55e7('0x1b')](_0x1cc004);}};}function respondWithFilteredResult(_0x382e7a,_0x491a3a){return function(_0x523f4b){if(_0x523f4b){var _0x531deb=typeof _0x491a3a['offset']===_0x55e7('0x1c')&&typeof _0x491a3a[_0x55e7('0x1d')]==='undefined';var _0x109cd6=_0x523f4b[_0x55e7('0x1e')];var _0x5338a7=_0x531deb?0x0:_0x491a3a[_0x55e7('0x1f')];var _0x23f477=_0x531deb?_0x523f4b['count']:_0x491a3a[_0x55e7('0x1f')]+_0x491a3a[_0x55e7('0x1d')];var _0x3aed30;if(_0x23f477>=_0x109cd6){_0x23f477=_0x109cd6;_0x3aed30=0xc8;}else{_0x3aed30=0xce;}_0x382e7a[_0x55e7('0x19')](_0x3aed30);return _0x382e7a[_0x55e7('0x20')](_0x55e7('0x21'),_0x5338a7+'-'+_0x23f477+'/'+_0x109cd6)[_0x55e7('0x1b')](_0x523f4b);}return null;};}function patchUpdates(_0x34ca96){return function(_0x397412){try{jsonpatch[_0x55e7('0x22')](_0x397412,_0x34ca96,!![]);}catch(_0x35eff8){return BPromise[_0x55e7('0x23')](_0x35eff8);}return _0x397412[_0x55e7('0x24')]();};}function saveUpdates(_0xe8f6f9,_0x2cf4df){return function(_0x8746e2){if(_0x8746e2){return _0x8746e2[_0x55e7('0x25')](_0xe8f6f9)[_0x55e7('0x26')](function(_0x55748c){return _0x55748c;});}return null;};}function removeEntity(_0x18197e,_0x5dea39){return function(_0x27c842){if(_0x27c842){return _0x27c842['destroy']()[_0x55e7('0x26')](function(){var _0x42c737=_0x27c842[_0x55e7('0x27')]({'plain':!![]});var _0x478953=_0x55e7('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x478953,'resourceId':_0x42c737['id']}})['then'](function(){return _0x27c842;});})[_0x55e7('0x26')](function(){_0x18197e[_0x55e7('0x19')](0xcc)[_0x55e7('0x1a')]();});}};}function handleEntityNotFound(_0x289e87,_0x439642){return function(_0x376025){if(!_0x376025){_0x289e87[_0x55e7('0x18')](0x194);}return _0x376025;};}function handleError(_0x10beb3,_0x25fc2a){_0x25fc2a=_0x25fc2a||0x1f4;return function(_0x44245c){logger[_0x55e7('0x29')](_0x44245c[_0x55e7('0x2a')]);if(_0x44245c['name']){delete _0x44245c[_0x55e7('0x2b')];}_0x10beb3['status'](_0x25fc2a)[_0x55e7('0x2c')](_0x44245c);};}exports[_0x55e7('0x2d')]=function(_0x1e3c75,_0x3d0eec){var _0x82951a={},_0x1cd43d={},_0x2daf01={'count':0x0,'rows':[]};var _0xef5a92=_[_0x55e7('0x2e')](db['CannedAnswer'][_0x55e7('0x2f')],function(_0xc108be){return{'name':_0xc108be[_0x55e7('0x30')],'type':_0xc108be[_0x55e7('0x31')][_0x55e7('0x32')]};});_0x1cd43d[_0x55e7('0x33')]=_[_0x55e7('0x2e')](_0xef5a92,_0x55e7('0x2b'));_0x1cd43d[_0x55e7('0x34')]=_['keys'](_0x1e3c75[_0x55e7('0x34')]);_0x1cd43d[_0x55e7('0x35')]=_['intersection'](_0x1cd43d[_0x55e7('0x33')],_0x1cd43d['query']);_0x82951a[_0x55e7('0x36')]=_[_0x55e7('0x37')](_0x1cd43d['model'],qs[_0x55e7('0x38')](_0x1e3c75['query'][_0x55e7('0x38')]));_0x82951a[_0x55e7('0x36')]=_0x82951a[_0x55e7('0x36')][_0x55e7('0x39')]?_0x82951a[_0x55e7('0x36')]:_0x1cd43d[_0x55e7('0x33')];if(!_0x1e3c75['query']['hasOwnProperty'](_0x55e7('0x3a'))){_0x82951a['limit']=qs[_0x55e7('0x1d')](_0x1e3c75['query'][_0x55e7('0x1d')]);_0x82951a['offset']=qs[_0x55e7('0x1f')](_0x1e3c75[_0x55e7('0x34')][_0x55e7('0x1f')]);}_0x82951a['order']=qs['sort'](_0x1e3c75[_0x55e7('0x34')]['sort']);_0x82951a[_0x55e7('0x3b')]=qs[_0x55e7('0x35')](_['pick'](_0x1e3c75[_0x55e7('0x34')],_0x1cd43d[_0x55e7('0x35')]),_0xef5a92);if(_0x1e3c75[_0x55e7('0x34')]['filter']){_0x82951a[_0x55e7('0x3b')]=_[_0x55e7('0x3c')](_0x82951a['where'],{'$or':[{'key':{'$like':'%'+_0x1e3c75[_0x55e7('0x34')][_0x55e7('0x3d')]+'%'}},{'value':{'$like':'%'+_0x1e3c75[_0x55e7('0x34')][_0x55e7('0x3d')]+'%'}}]});}_0x82951a=_[_0x55e7('0x3c')]({},_0x82951a,_0x1e3c75[_0x55e7('0x3e')]);var _0x4fe243={'where':_0x82951a[_0x55e7('0x3b')]};return db[_0x55e7('0x3f')][_0x55e7('0x1e')](_0x4fe243)['then'](function(_0x3edaf3){_0x2daf01['count']=_0x3edaf3;if(_0x1e3c75['query'][_0x55e7('0x40')]){_0x82951a[_0x55e7('0x41')]=[{'all':!![]}];}return db[_0x55e7('0x3f')]['findAll'](_0x82951a);})[_0x55e7('0x26')](function(_0x37284a){_0x2daf01[_0x55e7('0x42')]=_0x37284a;return _0x2daf01;})['then'](respondWithFilteredResult(_0x3d0eec,_0x82951a))[_0x55e7('0x43')](handleError(_0x3d0eec,null));};exports[_0x55e7('0x44')]=function(_0x4ad656,_0x33794b){var _0x2f1a41={'raw':!![],'where':{'id':_0x4ad656[_0x55e7('0x45')]['id']}},_0x574a9c={};_0x574a9c[_0x55e7('0x33')]=_[_0x55e7('0x46')](db['CannedAnswer']['rawAttributes']);_0x574a9c[_0x55e7('0x34')]=_[_0x55e7('0x46')](_0x4ad656[_0x55e7('0x34')]);_0x574a9c[_0x55e7('0x35')]=_['intersection'](_0x574a9c[_0x55e7('0x33')],_0x574a9c['query']);_0x2f1a41[_0x55e7('0x36')]=_['intersection'](_0x574a9c[_0x55e7('0x33')],qs[_0x55e7('0x38')](_0x4ad656[_0x55e7('0x34')][_0x55e7('0x38')]));_0x2f1a41['attributes']=_0x2f1a41[_0x55e7('0x36')][_0x55e7('0x39')]?_0x2f1a41[_0x55e7('0x36')]:_0x574a9c[_0x55e7('0x33')];if(_0x4ad656[_0x55e7('0x34')]['includeAll']){_0x2f1a41[_0x55e7('0x41')]=[{'all':!![]}];}_0x2f1a41=_['merge']({},_0x2f1a41,_0x4ad656[_0x55e7('0x3e')]);return db['CannedAnswer'][_0x55e7('0x47')](_0x2f1a41)[_0x55e7('0x26')](handleEntityNotFound(_0x33794b,null))['then'](respondWithResult(_0x33794b,null))[_0x55e7('0x43')](handleError(_0x33794b,null));};exports['update']=function(_0x2dc31a,_0x266f90){if(_0x2dc31a['body']['id']){delete _0x2dc31a[_0x55e7('0x48')]['id'];}return db[_0x55e7('0x3f')]['find']({'where':{'id':_0x2dc31a[_0x55e7('0x45')]['id']}})[_0x55e7('0x26')](handleEntityNotFound(_0x266f90,null))[_0x55e7('0x26')](saveUpdates(_0x2dc31a[_0x55e7('0x48')],null))['then'](respondWithResult(_0x266f90,null))['catch'](handleError(_0x266f90,null));};exports['destroy']=function(_0x251dbc,_0x19878e){return db['CannedAnswer']['find']({'where':{'id':_0x251dbc[_0x55e7('0x45')]['id']}})[_0x55e7('0x26')](handleEntityNotFound(_0x19878e,null))[_0x55e7('0x26')](removeEntity(_0x19878e,null))[_0x55e7('0x43')](handleError(_0x19878e,null));};exports[_0x55e7('0x49')]=function(_0x4bfe4d,_0x3c46fc){var _0x4b59d7={'key':_0x4bfe4d[_0x55e7('0x48')]['key']};if(_0x4bfe4d[_0x55e7('0x48')][_0x55e7('0x4a')]){_0x4b59d7[_0x55e7('0x4a')]=_0x4bfe4d[_0x55e7('0x48')][_0x55e7('0x4a')];}else if(_0x4bfe4d[_0x55e7('0x48')]['SmsAccountId']){_0x4b59d7[_0x55e7('0x4b')]=_0x4bfe4d[_0x55e7('0x48')][_0x55e7('0x4b')];}else if(_0x4bfe4d[_0x55e7('0x48')][_0x55e7('0x4c')]){_0x4b59d7['OpenchannelAccountId']=_0x4bfe4d[_0x55e7('0x48')]['OpenchannelAccountId'];}else if(_0x4bfe4d['body']['ChatWebsiteId']){_0x4b59d7[_0x55e7('0x4d')]=_0x4bfe4d[_0x55e7('0x48')][_0x55e7('0x4d')];}return db[_0x55e7('0x3f')]['find']({'where':_0x4b59d7})['then'](function(_0x34054d){if(_0x34054d){throw new db['Sequelize'][(_0x55e7('0x4e'))](_0x55e7('0x4f'));}return db['CannedAnswer'][_0x55e7('0x49')](_0x4bfe4d[_0x55e7('0x48')]);})['then'](function(_0x1c28ee){var _0x273c6d=_0x4bfe4d['user'][_0x55e7('0x27')]({'plain':!![]});if(!_0x273c6d)throw new Error(_0x55e7('0x50'));if(_0x273c6d[_0x55e7('0x51')]===_0x55e7('0x52')){var _0x2c2331=_0x1c28ee[_0x55e7('0x27')]({'plain':!![]});return db[_0x55e7('0x53')][_0x55e7('0x47')]({'where':{'name':_0x55e7('0x28'),'userProfileId':_0x273c6d[_0x55e7('0x54')]},'raw':!![]})[_0x55e7('0x26')](function(_0x3fa422){if(_0x3fa422&&_0x3fa422['autoAssociation']===0x0){return db[_0x55e7('0x55')][_0x55e7('0x49')]({'name':_0x2c2331[_0x55e7('0x2b')],'resourceId':_0x2c2331['id'],'type':_0x3fa422[_0x55e7('0x2b')],'sectionId':_0x3fa422['id']},{})['then'](function(){return _0x1c28ee;});}else{return _0x1c28ee;}})[_0x55e7('0x43')](function(_0x2ba902){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ba902);throw _0x2ba902;});}return _0x1c28ee;})[_0x55e7('0x26')](respondWithResult(_0x3c46fc,0xc9))['catch'](handleError(_0x3c46fc,null));}; \ No newline at end of file +var _0x0fc1=['filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','include','findAll','catch','params','includeAll','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0xb4a251,_0x2a08c8){var _0x5754e8=function(_0x5d7f53){while(--_0x5d7f53){_0xb4a251['push'](_0xb4a251['shift']());}};_0x5754e8(++_0x2a08c8);}(_0x0fc1,0xd4));var _0x10fc=function(_0x6e30f3,_0x206a91){_0x6e30f3=_0x6e30f3-0x0;var _0x5c175a=_0x0fc1[_0x6e30f3];return _0x5c175a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x10fc('0x0'));var zipdir=require(_0x10fc('0x1'));var jsonpatch=require(_0x10fc('0x2'));var rp=require('request-promise');var moment=require(_0x10fc('0x3'));var BPromise=require(_0x10fc('0x4'));var Mustache=require(_0x10fc('0x5'));var util=require(_0x10fc('0x6'));var path=require(_0x10fc('0x7'));var sox=require('sox');var csv=require(_0x10fc('0x8'));var ejs=require(_0x10fc('0x9'));var fs=require('fs');var fs_extra=require(_0x10fc('0xa'));var _=require(_0x10fc('0xb'));var squel=require(_0x10fc('0xc'));var crypto=require(_0x10fc('0xd'));var jsforce=require(_0x10fc('0xe'));var deskjs=require(_0x10fc('0xf'));var toCsv=require(_0x10fc('0x8'));var querystring=require('querystring');var Papa=require(_0x10fc('0x10'));var Redis=require(_0x10fc('0x11'));var authService=require(_0x10fc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x10fc('0x13'));var hardwareService=require(_0x10fc('0x14'));var logger=require(_0x10fc('0x15'))(_0x10fc('0x16'));var utils=require(_0x10fc('0x17'));var config=require(_0x10fc('0x18'));var licenseUtil=require(_0x10fc('0x19'));var db=require(_0x10fc('0x1a'))['db'];function respondWithStatusCode(_0x2ced6a,_0x1a8941){_0x1a8941=_0x1a8941||0xcc;return function(_0x2c4088){if(_0x2c4088){return _0x2ced6a[_0x10fc('0x1b')](_0x1a8941);}return _0x2ced6a['status'](_0x1a8941)[_0x10fc('0x1c')]();};}function respondWithResult(_0x381e61,_0x1dc3c6){_0x1dc3c6=_0x1dc3c6||0xc8;return function(_0x2efdcf){if(_0x2efdcf){return _0x381e61[_0x10fc('0x1d')](_0x1dc3c6)[_0x10fc('0x1e')](_0x2efdcf);}};}function respondWithFilteredResult(_0xe91abe,_0x1103b2){return function(_0x38054a){if(_0x38054a){var _0x4ec846=typeof _0x1103b2[_0x10fc('0x1f')]===_0x10fc('0x20')&&typeof _0x1103b2[_0x10fc('0x21')]===_0x10fc('0x20');var _0x4d62c8=_0x38054a[_0x10fc('0x22')];var _0x59ce1d=_0x4ec846?0x0:_0x1103b2['offset'];var _0x550e5f=_0x4ec846?_0x38054a[_0x10fc('0x22')]:_0x1103b2[_0x10fc('0x1f')]+_0x1103b2[_0x10fc('0x21')];var _0x54e119;if(_0x550e5f>=_0x4d62c8){_0x550e5f=_0x4d62c8;_0x54e119=0xc8;}else{_0x54e119=0xce;}_0xe91abe['status'](_0x54e119);return _0xe91abe[_0x10fc('0x23')](_0x10fc('0x24'),_0x59ce1d+'-'+_0x550e5f+'/'+_0x4d62c8)['json'](_0x38054a);}return null;};}function patchUpdates(_0x34e048){return function(_0x54cacd){try{jsonpatch[_0x10fc('0x25')](_0x54cacd,_0x34e048,!![]);}catch(_0xe87d07){return BPromise[_0x10fc('0x26')](_0xe87d07);}return _0x54cacd[_0x10fc('0x27')]();};}function saveUpdates(_0xee33b1,_0x3683d8){return function(_0x4d0d80){if(_0x4d0d80){return _0x4d0d80[_0x10fc('0x28')](_0xee33b1)[_0x10fc('0x29')](function(_0x383027){return _0x383027;});}return null;};}function removeEntity(_0x42e1f5,_0x487b29){return function(_0x4e4fc0){if(_0x4e4fc0){return _0x4e4fc0[_0x10fc('0x2a')]()[_0x10fc('0x29')](function(){var _0x5b1cd7=_0x4e4fc0[_0x10fc('0x2b')]({'plain':!![]});var _0x35e9c0=_0x10fc('0x2c');return db['UserProfileResource'][_0x10fc('0x2a')]({'where':{'type':_0x35e9c0,'resourceId':_0x5b1cd7['id']}})[_0x10fc('0x29')](function(){return _0x4e4fc0;});})['then'](function(){_0x42e1f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36a105,_0x48fd74){return function(_0x5c4c7f){if(!_0x5c4c7f){_0x36a105[_0x10fc('0x1b')](0x194);}return _0x5c4c7f;};}function handleError(_0x2f6cc4,_0x3f1296){_0x3f1296=_0x3f1296||0x1f4;return function(_0x5204da){logger[_0x10fc('0x2d')](_0x5204da['stack']);if(_0x5204da['name']){delete _0x5204da[_0x10fc('0x2e')];}_0x2f6cc4['status'](_0x3f1296)[_0x10fc('0x2f')](_0x5204da);};}exports[_0x10fc('0x30')]=function(_0x538f30,_0x84d0fb){var _0x1945df={},_0x323a21={},_0x3a4cef={'count':0x0,'rows':[]};var _0x5b6860=_[_0x10fc('0x31')](db[_0x10fc('0x32')][_0x10fc('0x33')],function(_0x184985){return{'name':_0x184985[_0x10fc('0x34')],'type':_0x184985[_0x10fc('0x35')][_0x10fc('0x36')]};});_0x323a21[_0x10fc('0x37')]=_[_0x10fc('0x31')](_0x5b6860,_0x10fc('0x2e'));_0x323a21[_0x10fc('0x38')]=_[_0x10fc('0x39')](_0x538f30[_0x10fc('0x38')]);_0x323a21[_0x10fc('0x3a')]=_[_0x10fc('0x3b')](_0x323a21[_0x10fc('0x37')],_0x323a21[_0x10fc('0x38')]);_0x1945df['attributes']=_[_0x10fc('0x3b')](_0x323a21[_0x10fc('0x37')],qs[_0x10fc('0x3c')](_0x538f30['query'][_0x10fc('0x3c')]));_0x1945df['attributes']=_0x1945df[_0x10fc('0x3d')][_0x10fc('0x3e')]?_0x1945df['attributes']:_0x323a21['model'];if(!_0x538f30[_0x10fc('0x38')]['hasOwnProperty']('nolimit')){_0x1945df['limit']=qs[_0x10fc('0x21')](_0x538f30[_0x10fc('0x38')][_0x10fc('0x21')]);_0x1945df[_0x10fc('0x1f')]=qs['offset'](_0x538f30[_0x10fc('0x38')][_0x10fc('0x1f')]);}_0x1945df[_0x10fc('0x3f')]=qs[_0x10fc('0x40')](_0x538f30[_0x10fc('0x38')]['sort']);_0x1945df[_0x10fc('0x41')]=qs[_0x10fc('0x3a')](_[_0x10fc('0x42')](_0x538f30[_0x10fc('0x38')],_0x323a21[_0x10fc('0x3a')]),_0x5b6860);if(_0x538f30['query'][_0x10fc('0x43')]){_0x1945df[_0x10fc('0x41')]=_['merge'](_0x1945df[_0x10fc('0x41')],{'$or':[{'key':{'$like':'%'+_0x538f30[_0x10fc('0x38')][_0x10fc('0x43')]+'%'}},{'value':{'$like':'%'+_0x538f30[_0x10fc('0x38')][_0x10fc('0x43')]+'%'}}]});}_0x1945df=_[_0x10fc('0x44')]({},_0x1945df,_0x538f30[_0x10fc('0x45')]);var _0x528788={'where':_0x1945df['where']};return db[_0x10fc('0x32')][_0x10fc('0x22')](_0x528788)[_0x10fc('0x29')](function(_0x3beeff){_0x3a4cef[_0x10fc('0x22')]=_0x3beeff;if(_0x538f30[_0x10fc('0x38')]['includeAll']){_0x1945df[_0x10fc('0x46')]=[{'all':!![]}];}return db[_0x10fc('0x32')][_0x10fc('0x47')](_0x1945df);})[_0x10fc('0x29')](function(_0xd16ed6){_0x3a4cef['rows']=_0xd16ed6;return _0x3a4cef;})[_0x10fc('0x29')](respondWithFilteredResult(_0x84d0fb,_0x1945df))[_0x10fc('0x48')](handleError(_0x84d0fb,null));};exports['show']=function(_0x3f278d,_0x178320){var _0x35795b={'raw':!![],'where':{'id':_0x3f278d[_0x10fc('0x49')]['id']}},_0x254c53={};_0x254c53[_0x10fc('0x37')]=_[_0x10fc('0x39')](db[_0x10fc('0x32')][_0x10fc('0x33')]);_0x254c53[_0x10fc('0x38')]=_['keys'](_0x3f278d[_0x10fc('0x38')]);_0x254c53[_0x10fc('0x3a')]=_[_0x10fc('0x3b')](_0x254c53['model'],_0x254c53['query']);_0x35795b[_0x10fc('0x3d')]=_[_0x10fc('0x3b')](_0x254c53['model'],qs[_0x10fc('0x3c')](_0x3f278d[_0x10fc('0x38')][_0x10fc('0x3c')]));_0x35795b[_0x10fc('0x3d')]=_0x35795b[_0x10fc('0x3d')][_0x10fc('0x3e')]?_0x35795b['attributes']:_0x254c53[_0x10fc('0x37')];if(_0x3f278d[_0x10fc('0x38')][_0x10fc('0x4a')]){_0x35795b[_0x10fc('0x46')]=[{'all':!![]}];}_0x35795b=_['merge']({},_0x35795b,_0x3f278d[_0x10fc('0x45')]);return db[_0x10fc('0x32')]['find'](_0x35795b)[_0x10fc('0x29')](handleEntityNotFound(_0x178320,null))[_0x10fc('0x29')](respondWithResult(_0x178320,null))[_0x10fc('0x48')](handleError(_0x178320,null));};exports['update']=function(_0x3ae361,_0x2763ad){if(_0x3ae361[_0x10fc('0x4b')]['id']){delete _0x3ae361[_0x10fc('0x4b')]['id'];}return db[_0x10fc('0x32')]['find']({'where':{'id':_0x3ae361['params']['id']}})[_0x10fc('0x29')](handleEntityNotFound(_0x2763ad,null))['then'](saveUpdates(_0x3ae361[_0x10fc('0x4b')],null))[_0x10fc('0x29')](respondWithResult(_0x2763ad,null))[_0x10fc('0x48')](handleError(_0x2763ad,null));};exports[_0x10fc('0x2a')]=function(_0xfef1d8,_0x487bdd){return db['CannedAnswer'][_0x10fc('0x4c')]({'where':{'id':_0xfef1d8[_0x10fc('0x49')]['id']}})[_0x10fc('0x29')](handleEntityNotFound(_0x487bdd,null))[_0x10fc('0x29')](removeEntity(_0x487bdd,null))[_0x10fc('0x48')](handleError(_0x487bdd,null));};exports[_0x10fc('0x4d')]=function(_0xac92e6,_0x1787c8){var _0x2cb949={'key':_0xac92e6['body']['key']};if(_0xac92e6['body'][_0x10fc('0x4e')]){_0x2cb949[_0x10fc('0x4e')]=_0xac92e6[_0x10fc('0x4b')][_0x10fc('0x4e')];}else if(_0xac92e6[_0x10fc('0x4b')][_0x10fc('0x4f')]){_0x2cb949[_0x10fc('0x4f')]=_0xac92e6[_0x10fc('0x4b')][_0x10fc('0x4f')];}else if(_0xac92e6['body'][_0x10fc('0x50')]){_0x2cb949['OpenchannelAccountId']=_0xac92e6[_0x10fc('0x4b')][_0x10fc('0x50')];}else if(_0xac92e6['body']['ChatWebsiteId']){_0x2cb949[_0x10fc('0x51')]=_0xac92e6[_0x10fc('0x4b')][_0x10fc('0x51')];}return db[_0x10fc('0x32')][_0x10fc('0x4c')]({'where':_0x2cb949})['then'](function(_0x461249){if(_0x461249){throw new db[(_0x10fc('0x52'))][(_0x10fc('0x53'))](_0x10fc('0x54'));}return db['CannedAnswer'][_0x10fc('0x4d')](_0xac92e6[_0x10fc('0x4b')]);})[_0x10fc('0x29')](function(_0x38c753){var _0x102394=_0xac92e6['user'][_0x10fc('0x2b')]({'plain':!![]});if(!_0x102394)throw new Error(_0x10fc('0x55'));if(_0x102394['role']===_0x10fc('0x56')){var _0x292fa4=_0x38c753[_0x10fc('0x2b')]({'plain':!![]});return db[_0x10fc('0x57')][_0x10fc('0x4c')]({'where':{'name':_0x10fc('0x2c'),'userProfileId':_0x102394[_0x10fc('0x58')]},'raw':!![]})[_0x10fc('0x29')](function(_0x5f349f){if(_0x5f349f&&_0x5f349f['autoAssociation']===0x0){return db['UserProfileResource'][_0x10fc('0x4d')]({'name':_0x292fa4[_0x10fc('0x2e')],'resourceId':_0x292fa4['id'],'type':_0x5f349f[_0x10fc('0x2e')],'sectionId':_0x5f349f['id']},{})[_0x10fc('0x29')](function(){return _0x38c753;});}else{return _0x38c753;}})[_0x10fc('0x48')](function(_0x51bfb3){logger[_0x10fc('0x2d')](_0x10fc('0x59'),_0x51bfb3);throw _0x51bfb3;});}return _0x38c753;})['then'](respondWithResult(_0x1787c8,0xc9))[_0x10fc('0x48')](handleError(_0x1787c8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 7b41075..29fe0c0 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 _0xfc73=['./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa1ceef,_0x184856){var _0x4797c1=function(_0xc253e0){while(--_0xc253e0){_0xa1ceef['push'](_0xa1ceef['shift']());}};_0x4797c1(++_0x184856);}(_0xfc73,0x8d));var _0x3fc7=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xfc73[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var logger=require('../../config/logger')(_0x3fc7('0x2'));var moment=require(_0x3fc7('0x3'));var BPromise=require(_0x3fc7('0x4'));var rp=require(_0x3fc7('0x5'));var fs=require('fs');var path=require(_0x3fc7('0x6'));var rimraf=require(_0x3fc7('0x7'));var config=require(_0x3fc7('0x8'));var attributes=require(_0x3fc7('0x9'));module[_0x3fc7('0xa')]=function(_0x1039e0,_0x262417){return _0x1039e0[_0x3fc7('0xb')]('CannedAnswer',attributes,{'tableName':_0x3fc7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3fc7('0xd'),'collate':_0x3fc7('0xe')});}; \ No newline at end of file +var _0x21de=['./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xeedf28,_0x98e8af){var _0x5aed80=function(_0x31faa5){while(--_0x31faa5){_0xeedf28['push'](_0xeedf28['shift']());}};_0x5aed80(++_0x98e8af);}(_0x21de,0xe2));var _0xe21d=function(_0x3fef14,_0x54eca9){_0x3fef14=_0x3fef14-0x0;var _0x52c017=_0x21de[_0x3fef14];return _0x52c017;};'use strict';var _=require(_0xe21d('0x0'));var util=require(_0xe21d('0x1'));var logger=require(_0xe21d('0x2'))(_0xe21d('0x3'));var moment=require(_0xe21d('0x4'));var BPromise=require(_0xe21d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe21d('0x6'));var config=require(_0xe21d('0x7'));var attributes=require(_0xe21d('0x8'));module[_0xe21d('0x9')]=function(_0x5b1c02,_0x23f619){return _0x5b1c02[_0xe21d('0xa')]('CannedAnswer',attributes,{'tableName':_0xe21d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe21d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 9638676..59e9203 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(_0x2ed4ae,_0x4d9445){var _0x4c59d2=function(_0xd503f8){while(--_0xd503f8){_0x2ed4ae['push'](_0x2ed4ae['shift']());}};_0x4c59d2(++_0x4d9445);}(_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 _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(_0x36e8be,_0x309471){var _0xdf46c5=function(_0x61327a){while(--_0x61327a){_0x36e8be['push'](_0x36e8be['shift']());}};_0xdf46c5(++_0x309471);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 f83a7bc..8f1468b 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 _0xfc71=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x261a64,_0x56415a){var _0x11fcf4=function(_0x524d80){while(--_0x524d80){_0x261a64['push'](_0x261a64['shift']());}};_0x11fcf4(++_0x56415a);}(_0xfc71,0xd3));var _0x1fc7=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xfc71[_0x41c381];return _0x427981;};'use strict';var multer=require('multer');var util=require(_0x1fc7('0x0'));var path=require(_0x1fc7('0x1'));var timeout=require(_0x1fc7('0x2'));var express=require('express');var router=express[_0x1fc7('0x3')]();var fs_extra=require(_0x1fc7('0x4'));var auth=require(_0x1fc7('0x5'));var interaction=require(_0x1fc7('0x6'));var config=require(_0x1fc7('0x7'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1fc7('0x8')]);router[_0x1fc7('0x9')]('/:id',auth[_0x1fc7('0xa')](),controller[_0x1fc7('0xb')]);router[_0x1fc7('0xc')]('/',auth[_0x1fc7('0xa')](),controller[_0x1fc7('0xd')]);router[_0x1fc7('0xe')]('/:id',auth[_0x1fc7('0xa')](),controller[_0x1fc7('0xf')]);router['delete']('/:id',auth[_0x1fc7('0xa')](),controller[_0x1fc7('0x10')]);module[_0x1fc7('0x11')]=router; \ No newline at end of file +var _0x0e2f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x59bdb2,_0x214f63){var _0x25c81c=function(_0x502cd7){while(--_0x502cd7){_0x59bdb2['push'](_0x59bdb2['shift']());}};_0x25c81c(++_0x214f63);}(_0x0e2f,0x15d));var _0xf0e2=function(_0x36a558,_0x34e8ad){_0x36a558=_0x36a558-0x0;var _0x2d8784=_0x0e2f[_0x36a558];return _0x2d8784;};'use strict';var multer=require(_0xf0e2('0x0'));var util=require(_0xf0e2('0x1'));var path=require(_0xf0e2('0x2'));var timeout=require(_0xf0e2('0x3'));var express=require(_0xf0e2('0x4'));var router=express[_0xf0e2('0x5')]();var fs_extra=require(_0xf0e2('0x6'));var auth=require(_0xf0e2('0x7'));var interaction=require(_0xf0e2('0x8'));var config=require(_0xf0e2('0x9'));var controller=require(_0xf0e2('0xa'));router[_0xf0e2('0xb')]('/',auth[_0xf0e2('0xc')](),controller[_0xf0e2('0xd')]);router['get'](_0xf0e2('0xe'),auth[_0xf0e2('0xc')](),controller[_0xf0e2('0xf')]);router['post']('/',auth[_0xf0e2('0xc')](),controller[_0xf0e2('0x10')]);router[_0xf0e2('0x11')](_0xf0e2('0xe'),auth[_0xf0e2('0xc')](),controller[_0xf0e2('0x12')]);router[_0xf0e2('0x13')](_0xf0e2('0xe'),auth['isAuthenticated'](),controller[_0xf0e2('0x14')]);module[_0xf0e2('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 b88c8ff..579151b 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 _0x36f9=['INTEGER','sequelize','DATE','STRING'];(function(_0x5be83a,_0x4578a8){var _0x44d447=function(_0x533b2e){while(--_0x533b2e){_0x5be83a['push'](_0x5be83a['shift']());}};_0x44d447(++_0x4578a8);}(_0x36f9,0x151));var _0x936f=function(_0x44257e,_0x428c8f){_0x44257e=_0x44257e-0x0;var _0x185d78=_0x36f9[_0x44257e];return _0x185d78;};'use strict';var Sequelize=require(_0x936f('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x936f('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x936f('0x2')]},'dst':{'type':Sequelize[_0x936f('0x2')]},'dcontext':{'type':Sequelize[_0x936f('0x2')]},'channel':{'type':Sequelize[_0x936f('0x2')]},'dstchannel':{'type':Sequelize[_0x936f('0x2')]},'lastapp':{'type':Sequelize[_0x936f('0x2')]},'lastdata':{'type':Sequelize[_0x936f('0x2')]},'duration':{'type':Sequelize[_0x936f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x936f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x936f('0x2')]},'amaflags':{'type':Sequelize[_0x936f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x936f('0x2')]},'uniqueid':{'type':Sequelize[_0x936f('0x2')]},'linkedid':{'type':Sequelize[_0x936f('0x2')]},'sequence':{'type':Sequelize[_0x936f('0x2')]},'peeraccount':{'type':Sequelize[_0x936f('0x2')]},'type':{'type':Sequelize[_0x936f('0x2')]},'tag':{'type':Sequelize[_0x936f('0x2')]}}; \ No newline at end of file +var _0xaaf7=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x56b034,_0xb96f9b){var _0x25f338=function(_0x4134cd){while(--_0x4134cd){_0x56b034['push'](_0x56b034['shift']());}};_0x25f338(++_0xb96f9b);}(_0xaaf7,0x79));var _0x7aaf=function(_0x1adb22,_0x260530){_0x1adb22=_0x1adb22-0x0;var _0x2ebffc=_0xaaf7[_0x1adb22];return _0x2ebffc;};'use strict';var Sequelize=require(_0x7aaf('0x0'));module[_0x7aaf('0x1')]={'calldate':{'type':Sequelize[_0x7aaf('0x2')],'allowNull':![],'defaultValue':_0x7aaf('0x3')},'clid':{'type':Sequelize[_0x7aaf('0x4')]},'src':{'type':Sequelize[_0x7aaf('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x7aaf('0x4')]},'channel':{'type':Sequelize[_0x7aaf('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x7aaf('0x4')]},'lastdata':{'type':Sequelize[_0x7aaf('0x4')]},'duration':{'type':Sequelize[_0x7aaf('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7aaf('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7aaf('0x4')]},'amaflags':{'type':Sequelize[_0x7aaf('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7aaf('0x4')]},'userfield':{'type':Sequelize[_0x7aaf('0x4')]},'uniqueid':{'type':Sequelize[_0x7aaf('0x4')]},'linkedid':{'type':Sequelize[_0x7aaf('0x4')]},'sequence':{'type':Sequelize[_0x7aaf('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7aaf('0x4')]},'tag':{'type':Sequelize[_0x7aaf('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 6fa1058..397b7a3 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 _0x85d0=['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','index','Cdr','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x85d0,0x164));var _0x085d=function(_0x2fca78,_0x19171a){_0x2fca78=_0x2fca78-0x0;var _0x41c8a6=_0x85d0[_0x2fca78];return _0x41c8a6;};'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={},_0x2eae2c={},_0x3f905d={'count':0x0,'rows':[]};var _0x26aa90=_['map'](db[_0x085d('0x2a')][_0x085d('0x2b')],function(_0x494070){return{'name':_0x494070[_0x085d('0x2c')],'type':_0x494070[_0x085d('0x2d')]['key']};});_0x2eae2c[_0x085d('0x2e')]=_[_0x085d('0x2f')](_0x26aa90,_0x085d('0x27'));_0x2eae2c['query']=_[_0x085d('0x30')](_0x3faf6b[_0x085d('0x31')]);_0x2eae2c[_0x085d('0x32')]=_['intersection'](_0x2eae2c[_0x085d('0x2e')],_0x2eae2c['query']);_0x2f670c[_0x085d('0x33')]=_[_0x085d('0x34')](_0x2eae2c[_0x085d('0x2e')],qs[_0x085d('0x35')](_0x3faf6b['query'][_0x085d('0x35')]));_0x2f670c[_0x085d('0x33')]=_0x2f670c[_0x085d('0x33')][_0x085d('0x36')]?_0x2f670c['attributes']:_0x2eae2c['model'];if(!_0x3faf6b[_0x085d('0x31')][_0x085d('0x37')](_0x085d('0x38'))){_0x2f670c[_0x085d('0x1b')]=qs[_0x085d('0x1b')](_0x3faf6b[_0x085d('0x31')][_0x085d('0x1b')]);_0x2f670c[_0x085d('0x1a')]=qs[_0x085d('0x1a')](_0x3faf6b['query'][_0x085d('0x1a')]);}_0x2f670c[_0x085d('0x39')]=qs['sort'](_0x3faf6b[_0x085d('0x31')]['sort']);_0x2f670c[_0x085d('0x3a')]=qs[_0x085d('0x32')](_['pick'](_0x3faf6b[_0x085d('0x31')],_0x2eae2c[_0x085d('0x32')]),_0x26aa90);if(_0x3faf6b[_0x085d('0x31')][_0x085d('0x3b')]){_0x2f670c[_0x085d('0x3a')]=_['merge'](_0x2f670c[_0x085d('0x3a')],{'$or':_['map'](_0x26aa90,function(_0x5d52be){if(_0x5d52be[_0x085d('0x2d')]!==_0x085d('0x3c')){var _0x31ee22={};_0x31ee22[_0x5d52be[_0x085d('0x27')]]={'$like':'%'+_0x3faf6b[_0x085d('0x31')]['filter']+'%'};return _0x31ee22;}})});}_0x2f670c=_[_0x085d('0x3d')]({},_0x2f670c,_0x3faf6b['options']);var _0x3a8646={'where':_0x2f670c[_0x085d('0x3a')]};return db[_0x085d('0x2a')]['count'](_0x3a8646)[_0x085d('0x24')](function(_0x55d81a){_0x3f905d[_0x085d('0x1d')]=_0x55d81a;if(_0x3faf6b[_0x085d('0x31')]['includeAll']){_0x2f670c[_0x085d('0x3e')]=[{'all':!![]}];}return db[_0x085d('0x2a')][_0x085d('0x3f')](_0x2f670c);})['then'](function(_0x56428e){_0x3f905d[_0x085d('0x40')]=_0x56428e;return _0x3f905d;})[_0x085d('0x24')](respondWithFilteredResult(_0x5c7849,_0x2f670c))[_0x085d('0x41')](handleError(_0x5c7849,null));};exports[_0x085d('0x42')]=function(_0x177f7d,_0x367a32){var _0x27e1c7={'raw':!![],'where':{'id':_0x177f7d[_0x085d('0x43')]['id']}},_0x120980={};_0x120980[_0x085d('0x2e')]=_['keys'](db['Cdr'][_0x085d('0x2b')]);_0x120980[_0x085d('0x31')]=_[_0x085d('0x30')](_0x177f7d[_0x085d('0x31')]);_0x120980[_0x085d('0x32')]=_[_0x085d('0x34')](_0x120980[_0x085d('0x2e')],_0x120980[_0x085d('0x31')]);_0x27e1c7[_0x085d('0x33')]=_[_0x085d('0x34')](_0x120980[_0x085d('0x2e')],qs['fields'](_0x177f7d[_0x085d('0x31')][_0x085d('0x35')]));_0x27e1c7[_0x085d('0x33')]=_0x27e1c7[_0x085d('0x33')][_0x085d('0x36')]?_0x27e1c7['attributes']:_0x120980[_0x085d('0x2e')];if(_0x177f7d['query'][_0x085d('0x44')]){_0x27e1c7['include']=[{'all':!![]}];}_0x27e1c7=_['merge']({},_0x27e1c7,_0x177f7d[_0x085d('0x45')]);return db[_0x085d('0x2a')][_0x085d('0x46')](_0x27e1c7)[_0x085d('0x24')](handleEntityNotFound(_0x367a32,null))[_0x085d('0x24')](respondWithResult(_0x367a32,null))['catch'](handleError(_0x367a32,null));};exports['create']=function(_0x547723,_0x580b91){return db['Cdr'][_0x085d('0x47')](_0x547723[_0x085d('0x48')],{})['then'](respondWithResult(_0x580b91,0xc9))[_0x085d('0x41')](handleError(_0x580b91,null));};exports['update']=function(_0x5df4cf,_0x415a4b){if(_0x5df4cf[_0x085d('0x48')]['id']){delete _0x5df4cf[_0x085d('0x48')]['id'];}return db[_0x085d('0x2a')]['find']({'where':{'id':_0x5df4cf[_0x085d('0x43')]['id']}})['then'](handleEntityNotFound(_0x415a4b,null))[_0x085d('0x24')](saveUpdates(_0x5df4cf[_0x085d('0x48')],null))['then'](respondWithResult(_0x415a4b,null))[_0x085d('0x41')](handleError(_0x415a4b,null));};exports[_0x085d('0x25')]=function(_0x298f6f,_0x37b56c){return db['Cdr'][_0x085d('0x46')]({'where':{'id':_0x298f6f['params']['id']}})[_0x085d('0x24')](handleEntityNotFound(_0x37b56c,null))['then'](removeEntity(_0x37b56c,null))['catch'](handleError(_0x37b56c,null));};exports[_0x085d('0x49')]=function(_0x41e3e0,_0x236368){return db[_0x085d('0x2a')][_0x085d('0x49')]()[_0x085d('0x24')](respondWithResult(_0x236368,null))[_0x085d('0x41')](handleError(_0x236368,null));}; \ No newline at end of file +var _0xcca7=['count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','Cdr','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','offset','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','findAll','catch','show','params','includeAll','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','end','status','json','limit','undefined'];(function(_0xeb4cd,_0x15dd4b){var _0x4078a1=function(_0x513b2e){while(--_0x513b2e){_0xeb4cd['push'](_0xeb4cd['shift']());}};_0x4078a1(++_0x15dd4b);}(_0xcca7,0x1aa));var _0x7cca=function(_0x3803d0,_0x2afb0e){_0x3803d0=_0x3803d0-0x0;var _0x3d4643=_0xcca7[_0x3803d0];return _0x3d4643;};'use strict';var emlformat=require(_0x7cca('0x0'));var rimraf=require(_0x7cca('0x1'));var zipdir=require(_0x7cca('0x2'));var jsonpatch=require(_0x7cca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7cca('0x4'));var Mustache=require('mustache');var util=require(_0x7cca('0x5'));var path=require(_0x7cca('0x6'));var sox=require(_0x7cca('0x7'));var csv=require(_0x7cca('0x8'));var ejs=require(_0x7cca('0x9'));var fs=require('fs');var fs_extra=require(_0x7cca('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cca('0xb'));var jsforce=require(_0x7cca('0xc'));var deskjs=require(_0x7cca('0xd'));var toCsv=require(_0x7cca('0x8'));var querystring=require(_0x7cca('0xe'));var Papa=require(_0x7cca('0xf'));var Redis=require(_0x7cca('0x10'));var authService=require(_0x7cca('0x11'));var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x14'))(_0x7cca('0x15'));var utils=require(_0x7cca('0x16'));var config=require(_0x7cca('0x17'));var licenseUtil=require(_0x7cca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a14cc,_0x41e0a2){_0x41e0a2=_0x41e0a2||0xcc;return function(_0x2854c7){if(_0x2854c7){return _0x2a14cc['sendStatus'](_0x41e0a2);}return _0x2a14cc['status'](_0x41e0a2)[_0x7cca('0x19')]();};}function respondWithResult(_0x20c1b2,_0x27d671){_0x27d671=_0x27d671||0xc8;return function(_0x847cce){if(_0x847cce){return _0x20c1b2[_0x7cca('0x1a')](_0x27d671)[_0x7cca('0x1b')](_0x847cce);}};}function respondWithFilteredResult(_0x45143d,_0x5a357d){return function(_0x216d4b){if(_0x216d4b){var _0x533608=typeof _0x5a357d['offset']==='undefined'&&typeof _0x5a357d[_0x7cca('0x1c')]===_0x7cca('0x1d');var _0x1dd043=_0x216d4b[_0x7cca('0x1e')];var _0x44294b=_0x533608?0x0:_0x5a357d['offset'];var _0xb35e1d=_0x533608?_0x216d4b['count']:_0x5a357d['offset']+_0x5a357d['limit'];var _0x370469;if(_0xb35e1d>=_0x1dd043){_0xb35e1d=_0x1dd043;_0x370469=0xc8;}else{_0x370469=0xce;}_0x45143d[_0x7cca('0x1a')](_0x370469);return _0x45143d[_0x7cca('0x1f')](_0x7cca('0x20'),_0x44294b+'-'+_0xb35e1d+'/'+_0x1dd043)[_0x7cca('0x1b')](_0x216d4b);}return null;};}function patchUpdates(_0x45db2f){return function(_0x2e023c){try{jsonpatch[_0x7cca('0x21')](_0x2e023c,_0x45db2f,!![]);}catch(_0x4d7804){return BPromise[_0x7cca('0x22')](_0x4d7804);}return _0x2e023c[_0x7cca('0x23')]();};}function saveUpdates(_0x165d13,_0x4343a3){return function(_0x55b689){if(_0x55b689){return _0x55b689[_0x7cca('0x24')](_0x165d13)[_0x7cca('0x25')](function(_0x4367f9){return _0x4367f9;});}return null;};}function removeEntity(_0x119d76,_0x823d7d){return function(_0x3fc157){if(_0x3fc157){return _0x3fc157[_0x7cca('0x26')]()[_0x7cca('0x25')](function(){_0x119d76['status'](0xcc)[_0x7cca('0x19')]();});}};}function handleEntityNotFound(_0x1dd3b3,_0x1774fc){return function(_0xdaf07f){if(!_0xdaf07f){_0x1dd3b3[_0x7cca('0x27')](0x194);}return _0xdaf07f;};}function handleError(_0x21da68,_0x35ebe8){_0x35ebe8=_0x35ebe8||0x1f4;return function(_0x40ac86){logger['error'](_0x40ac86[_0x7cca('0x28')]);if(_0x40ac86['name']){delete _0x40ac86[_0x7cca('0x29')];}_0x21da68[_0x7cca('0x1a')](_0x35ebe8)['send'](_0x40ac86);};}exports[_0x7cca('0x2a')]=function(_0x3d91b1,_0x5533fb){var _0x249442={},_0x1cd53a={},_0x100061={'count':0x0,'rows':[]};var _0x52fb40=_['map'](db[_0x7cca('0x2b')][_0x7cca('0x2c')],function(_0x3797f4){return{'name':_0x3797f4[_0x7cca('0x2d')],'type':_0x3797f4[_0x7cca('0x2e')][_0x7cca('0x2f')]};});_0x1cd53a[_0x7cca('0x30')]=_['map'](_0x52fb40,'name');_0x1cd53a[_0x7cca('0x31')]=_[_0x7cca('0x32')](_0x3d91b1[_0x7cca('0x31')]);_0x1cd53a['filters']=_[_0x7cca('0x33')](_0x1cd53a['model'],_0x1cd53a[_0x7cca('0x31')]);_0x249442[_0x7cca('0x34')]=_[_0x7cca('0x33')](_0x1cd53a[_0x7cca('0x30')],qs['fields'](_0x3d91b1[_0x7cca('0x31')][_0x7cca('0x35')]));_0x249442[_0x7cca('0x34')]=_0x249442['attributes']['length']?_0x249442['attributes']:_0x1cd53a[_0x7cca('0x30')];if(!_0x3d91b1[_0x7cca('0x31')]['hasOwnProperty'](_0x7cca('0x36'))){_0x249442[_0x7cca('0x1c')]=qs[_0x7cca('0x1c')](_0x3d91b1[_0x7cca('0x31')][_0x7cca('0x1c')]);_0x249442[_0x7cca('0x37')]=qs[_0x7cca('0x37')](_0x3d91b1['query'][_0x7cca('0x37')]);}_0x249442[_0x7cca('0x38')]=qs[_0x7cca('0x39')](_0x3d91b1[_0x7cca('0x31')]['sort']);_0x249442[_0x7cca('0x3a')]=qs[_0x7cca('0x3b')](_[_0x7cca('0x3c')](_0x3d91b1['query'],_0x1cd53a[_0x7cca('0x3b')]),_0x52fb40);if(_0x3d91b1['query'][_0x7cca('0x3d')]){_0x249442[_0x7cca('0x3a')]=_[_0x7cca('0x3e')](_0x249442[_0x7cca('0x3a')],{'$or':_[_0x7cca('0x3f')](_0x52fb40,function(_0x25b3a9){if(_0x25b3a9[_0x7cca('0x2e')]!==_0x7cca('0x40')){var _0x3617b8={};_0x3617b8[_0x25b3a9['name']]={'$like':'%'+_0x3d91b1['query'][_0x7cca('0x3d')]+'%'};return _0x3617b8;}})});}_0x249442=_[_0x7cca('0x3e')]({},_0x249442,_0x3d91b1['options']);var _0x48d87f={'where':_0x249442[_0x7cca('0x3a')]};return db[_0x7cca('0x2b')][_0x7cca('0x1e')](_0x48d87f)[_0x7cca('0x25')](function(_0x371c67){_0x100061['count']=_0x371c67;if(_0x3d91b1[_0x7cca('0x31')]['includeAll']){_0x249442['include']=[{'all':!![]}];}return db[_0x7cca('0x2b')][_0x7cca('0x41')](_0x249442);})['then'](function(_0x3b120b){_0x100061['rows']=_0x3b120b;return _0x100061;})[_0x7cca('0x25')](respondWithFilteredResult(_0x5533fb,_0x249442))[_0x7cca('0x42')](handleError(_0x5533fb,null));};exports[_0x7cca('0x43')]=function(_0x47e2e6,_0xb966da){var _0x207250={'raw':!![],'where':{'id':_0x47e2e6[_0x7cca('0x44')]['id']}},_0x2e8d97={};_0x2e8d97['model']=_[_0x7cca('0x32')](db[_0x7cca('0x2b')][_0x7cca('0x2c')]);_0x2e8d97[_0x7cca('0x31')]=_[_0x7cca('0x32')](_0x47e2e6[_0x7cca('0x31')]);_0x2e8d97['filters']=_['intersection'](_0x2e8d97['model'],_0x2e8d97['query']);_0x207250[_0x7cca('0x34')]=_['intersection'](_0x2e8d97['model'],qs[_0x7cca('0x35')](_0x47e2e6[_0x7cca('0x31')][_0x7cca('0x35')]));_0x207250[_0x7cca('0x34')]=_0x207250[_0x7cca('0x34')]['length']?_0x207250[_0x7cca('0x34')]:_0x2e8d97[_0x7cca('0x30')];if(_0x47e2e6[_0x7cca('0x31')][_0x7cca('0x45')]){_0x207250[_0x7cca('0x46')]=[{'all':!![]}];}_0x207250=_[_0x7cca('0x3e')]({},_0x207250,_0x47e2e6[_0x7cca('0x47')]);return db[_0x7cca('0x2b')][_0x7cca('0x48')](_0x207250)[_0x7cca('0x25')](handleEntityNotFound(_0xb966da,null))[_0x7cca('0x25')](respondWithResult(_0xb966da,null))['catch'](handleError(_0xb966da,null));};exports['create']=function(_0x36f12f,_0x5913eb){return db[_0x7cca('0x2b')][_0x7cca('0x49')](_0x36f12f[_0x7cca('0x4a')],{})[_0x7cca('0x25')](respondWithResult(_0x5913eb,0xc9))[_0x7cca('0x42')](handleError(_0x5913eb,null));};exports[_0x7cca('0x24')]=function(_0x184b56,_0xe0059e){if(_0x184b56[_0x7cca('0x4a')]['id']){delete _0x184b56[_0x7cca('0x4a')]['id'];}return db['Cdr'][_0x7cca('0x48')]({'where':{'id':_0x184b56[_0x7cca('0x44')]['id']}})[_0x7cca('0x25')](handleEntityNotFound(_0xe0059e,null))[_0x7cca('0x25')](saveUpdates(_0x184b56[_0x7cca('0x4a')],null))[_0x7cca('0x25')](respondWithResult(_0xe0059e,null))[_0x7cca('0x42')](handleError(_0xe0059e,null));};exports[_0x7cca('0x26')]=function(_0x218114,_0x43c581){return db[_0x7cca('0x2b')][_0x7cca('0x48')]({'where':{'id':_0x218114[_0x7cca('0x44')]['id']}})[_0x7cca('0x25')](handleEntityNotFound(_0x43c581,null))[_0x7cca('0x25')](removeEntity(_0x43c581,null))[_0x7cca('0x42')](handleError(_0x43c581,null));};exports[_0x7cca('0x4b')]=function(_0x27c527,_0x343a64){return db[_0x7cca('0x2b')][_0x7cca('0x4b')]()[_0x7cca('0x25')](respondWithResult(_0x343a64,null))[_0x7cca('0x42')](handleError(_0x343a64,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index fbc0598..acebb61 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x214566,_0x37b582){var _0x201a23=function(_0x2c245f){while(--_0x2c245f){_0x214566['push'](_0x214566['shift']());}};_0x201a23(++_0x37b582);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4db92c,_0x848331){var _0x1f46dc=function(_0x48d916){while(--_0x48d916){_0x4db92c['push'](_0x4db92c['shift']());}};_0x1f46dc(++_0x848331);}(_0x7a54,0x106));var _0x47a5=function(_0x4300e7,_0x193f74){_0x4300e7=_0x4300e7-0x0;var _0xdaf4f=_0x7a54[_0x4300e7];return _0xdaf4f;};'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 5539dc9..10d2c53 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 _0xcf78=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','Cdr,\x20%s,\x20%s','message','lodash'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0xcf78,0x68));var _0x8cf7=function(_0x231091,_0x319528){_0x231091=_0x231091-0x0;var _0x2eace3=_0xcf78[_0x231091];return _0x2eace3;};'use strict';var _=require(_0x8cf7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8cf7('0x1'));var rs=require(_0x8cf7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cf7('0x3'))['db'];var utils=require(_0x8cf7('0x4'));var logger=require(_0x8cf7('0x5'))(_0x8cf7('0x6'));var config=require(_0x8cf7('0x7'));var jayson=require(_0x8cf7('0x8'));var client=jayson[_0x8cf7('0x9')][_0x8cf7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41f126,_0x4840b9,_0x53a575){return new BPromise(function(_0x55e5dd,_0x4414c1){return client[_0x8cf7('0xb')](_0x41f126,_0x53a575)[_0x8cf7('0xc')](function(_0x21ea1e){logger[_0x8cf7('0xd')]('Cdr,\x20%s,\x20%s',_0x4840b9,_0x8cf7('0xe'));logger[_0x8cf7('0xf')](_0x8cf7('0x10'),_0x4840b9,_0x8cf7('0xe'),JSON[_0x8cf7('0x11')](_0x21ea1e));if(_0x21ea1e[_0x8cf7('0x12')]){if(_0x21ea1e[_0x8cf7('0x12')]['code']===0x1f4){logger[_0x8cf7('0x12')](_0x8cf7('0x13'),_0x4840b9,_0x21ea1e[_0x8cf7('0x12')][_0x8cf7('0x14')]);return _0x4414c1(_0x21ea1e['error'][_0x8cf7('0x14')]);}logger['error'](_0x8cf7('0x13'),_0x4840b9,_0x21ea1e[_0x8cf7('0x12')]['message']);return _0x55e5dd(_0x21ea1e[_0x8cf7('0x12')][_0x8cf7('0x14')]);}else{logger[_0x8cf7('0xd')]('Cdr,\x20%s,\x20%s',_0x4840b9,_0x8cf7('0xe'));_0x55e5dd(_0x21ea1e['result'][_0x8cf7('0x14')]);}})['catch'](function(_0x3e20ab){logger[_0x8cf7('0x12')]('Cdr,\x20%s,\x20%s',_0x4840b9,_0x3e20ab);_0x4414c1(_0x3e20ab);});});} \ No newline at end of file +var _0x466a=['jayson/promise','client','http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x466a,0x147));var _0xa466=function(_0x5b0d46,_0x535dea){_0x5b0d46=_0x5b0d46-0x0;var _0x2de3b2=_0x466a[_0x5b0d46];return _0x2de3b2;};'use strict';var _=require('lodash');var util=require(_0xa466('0x0'));var moment=require(_0xa466('0x1'));var BPromise=require(_0xa466('0x2'));var rs=require(_0xa466('0x3'));var fs=require('fs');var Redis=require(_0xa466('0x4'));var db=require(_0xa466('0x5'))['db'];var utils=require(_0xa466('0x6'));var logger=require('../../config/logger')(_0xa466('0x7'));var config=require(_0xa466('0x8'));var jayson=require(_0xa466('0x9'));var client=jayson[_0xa466('0xa')][_0xa466('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3be687,_0x3b1ba1,_0x32581d){return new BPromise(function(_0x234653,_0x2eb976){return client[_0xa466('0xc')](_0x3be687,_0x32581d)[_0xa466('0xd')](function(_0x165db4){logger[_0xa466('0xe')]('Cdr,\x20%s,\x20%s',_0x3b1ba1,_0xa466('0xf'));logger['debug'](_0xa466('0x10'),_0x3b1ba1,'request\x20sent',JSON[_0xa466('0x11')](_0x165db4));if(_0x165db4[_0xa466('0x12')]){if(_0x165db4[_0xa466('0x12')][_0xa466('0x13')]===0x1f4){logger[_0xa466('0x12')](_0xa466('0x14'),_0x3b1ba1,_0x165db4['error']['message']);return _0x2eb976(_0x165db4[_0xa466('0x12')]['message']);}logger['error']('Cdr,\x20%s,\x20%s',_0x3b1ba1,_0x165db4[_0xa466('0x12')]['message']);return _0x234653(_0x165db4[_0xa466('0x12')][_0xa466('0x15')]);}else{logger[_0xa466('0xe')](_0xa466('0x14'),_0x3b1ba1,_0xa466('0xf'));_0x234653(_0x165db4[_0xa466('0x16')][_0xa466('0x15')]);}})[_0xa466('0x17')](function(_0x36ee34){logger[_0xa466('0x12')]('Cdr,\x20%s,\x20%s',_0x3b1ba1,_0x36ee34);_0x2eb976(_0x36ee34);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d2f1b61..61f5edc 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x39ce6f,_0x9b38dc){var _0x5e9e04=function(_0x8b9d39){while(--_0x8b9d39){_0x39ce6f['push'](_0x39ce6f['shift']());}};_0x5e9e04(++_0x9b38dc);}(_0xb10b,0x12a));var _0xbb10=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0xb10b[_0x5de818];return _0x345670;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x293ce2,_0x39bc0a){var _0xf3f3aa=function(_0x575911){while(--_0x575911){_0x293ce2['push'](_0x293ce2['shift']());}};_0xf3f3aa(++_0x39bc0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x2634a7,_0x118508){_0x2634a7=_0x2634a7-0x0;var _0xa52e2c=_0xb10b[_0x2634a7];return _0xa52e2c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 04e38ec..db92d73 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 _0x2404=['TEXT','STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x3c8914,_0x362abe){var _0x14a4d0=function(_0x3b7352){while(--_0x3b7352){_0x3c8914['push'](_0x3c8914['shift']());}};_0x14a4d0(++_0x362abe);}(_0x2404,0x189));var _0x4240=function(_0x4ad34f,_0x275a71){_0x4ad34f=_0x4ad34f-0x0;var _0x1b6e04=_0x2404[_0x4ad34f];return _0x1b6e04;};'use strict';var Sequelize=require(_0x4240('0x0'));module[_0x4240('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4240('0x2')},'appdata':{'type':Sequelize[_0x4240('0x3')]()},'description':{'type':Sequelize[_0x4240('0x4')]},'interval':{'type':Sequelize[_0x4240('0x4')],'defaultValue':_0x4240('0x5')}}; \ No newline at end of file +var _0x2d94=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x2d94,0xe1));var _0x42d9=function(_0x5ac8d7,_0x50d870){_0x5ac8d7=_0x5ac8d7-0x0;var _0x498ecc=_0x2d94[_0x5ac8d7];return _0x498ecc;};'use strict';var Sequelize=require(_0x42d9('0x0'));module[_0x42d9('0x1')]={'priority':{'type':Sequelize[_0x42d9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x42d9('0x3')],'allowNull':![],'defaultValue':_0x42d9('0x4')},'appdata':{'type':Sequelize[_0x42d9('0x5')]()},'description':{'type':Sequelize[_0x42d9('0x3')]},'interval':{'type':Sequelize[_0x42d9('0x3')],'defaultValue':_0x42d9('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2d954df..e21c678 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 _0x49e9=['count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','show','params','ChatApplication','rawAttributes','query','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','undefined','limit'];(function(_0x180432,_0x255ac1){var _0x3fc15e=function(_0x5c320c){while(--_0x5c320c){_0x180432['push'](_0x180432['shift']());}};_0x3fc15e(++_0x255ac1);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x1185b3,_0x29e07b){return function(_0x255b11){if(!_0x255b11){_0x1185b3[_0x949e('0x18')](0x194);}return _0x255b11;};}function handleError(_0x20258c,_0x5dcc46){_0x5dcc46=_0x5dcc46||0x1f4;return function(_0x212224){logger[_0x949e('0x27')](_0x212224['stack']);if(_0x212224[_0x949e('0x28')]){delete _0x212224[_0x949e('0x28')];}_0x20258c['status'](_0x5dcc46)[_0x949e('0x29')](_0x212224);};}exports[_0x949e('0x2a')]=function(_0x5b9f28,_0x1867d9){var _0x5b2b0b={'raw':!![],'where':{'id':_0x5b9f28[_0x949e('0x2b')]['id']}},_0x5e6e34={};_0x5e6e34['model']=_['keys'](db[_0x949e('0x2c')][_0x949e('0x2d')]);_0x5e6e34[_0x949e('0x2e')]=_['keys'](_0x5b9f28['query']);_0x5e6e34['filters']=_['intersection'](_0x5e6e34[_0x949e('0x2f')],_0x5e6e34[_0x949e('0x2e')]);_0x5b2b0b[_0x949e('0x30')]=_[_0x949e('0x31')](_0x5e6e34['model'],qs[_0x949e('0x32')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x32')]));_0x5b2b0b['attributes']=_0x5b2b0b[_0x949e('0x30')][_0x949e('0x33')]?_0x5b2b0b[_0x949e('0x30')]:_0x5e6e34['model'];if(_0x5b9f28['query'][_0x949e('0x34')]){_0x5b2b0b[_0x949e('0x35')]=[{'all':!![]}];}_0x5b2b0b=_[_0x949e('0x36')]({},_0x5b2b0b,_0x5b9f28[_0x949e('0x37')]);return db['ChatApplication'][_0x949e('0x38')](_0x5b2b0b)[_0x949e('0x25')](handleEntityNotFound(_0x1867d9,null))[_0x949e('0x25')](respondWithResult(_0x1867d9,null))[_0x949e('0x39')](handleError(_0x1867d9,null));};exports[_0x949e('0x3a')]=function(_0x356eab,_0x3d84ba){if(_0x356eab[_0x949e('0x3b')]['id']){delete _0x356eab['body']['id'];}return db['ChatApplication'][_0x949e('0x38')]({'where':{'id':_0x356eab['params']['id']}})['then'](handleEntityNotFound(_0x3d84ba,null))[_0x949e('0x25')](saveUpdates(_0x356eab[_0x949e('0x3b')],null))[_0x949e('0x25')](respondWithResult(_0x3d84ba,null))[_0x949e('0x39')](handleError(_0x3d84ba,null));};exports[_0x949e('0x26')]=function(_0x461a8a,_0x3eaed5){return db[_0x949e('0x2c')][_0x949e('0x38')]({'where':{'id':_0x461a8a[_0x949e('0x2b')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x3eaed5,null))[_0x949e('0x25')](removeEntity(_0x3eaed5,null))[_0x949e('0x39')](handleError(_0x3eaed5,null));}; \ No newline at end of file +var _0x3f19=['send','show','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','includeAll','include','merge','options','find','then','body','params','catch','eml-format','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','stack','name'];(function(_0x96d980,_0x25a9d0){var _0xe021ab=function(_0x55115a){while(--_0x55115a){_0x96d980['push'](_0x96d980['shift']());}};_0xe021ab(++_0x25a9d0);}(_0x3f19,0xc0));var _0x93f1=function(_0x337d93,_0x7908a5){_0x337d93=_0x337d93-0x0;var _0x52a98b=_0x3f19[_0x337d93];return _0x52a98b;};'use strict';var emlformat=require(_0x93f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x93f1('0x1'));var moment=require('moment');var BPromise=require(_0x93f1('0x2'));var Mustache=require(_0x93f1('0x3'));var util=require(_0x93f1('0x4'));var path=require(_0x93f1('0x5'));var sox=require('sox');var csv=require(_0x93f1('0x6'));var ejs=require(_0x93f1('0x7'));var fs=require('fs');var fs_extra=require(_0x93f1('0x8'));var _=require(_0x93f1('0x9'));var squel=require(_0x93f1('0xa'));var crypto=require(_0x93f1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x93f1('0xc'));var toCsv=require(_0x93f1('0x6'));var querystring=require(_0x93f1('0xd'));var Papa=require(_0x93f1('0xe'));var Redis=require(_0x93f1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x93f1('0x10'));var as=require(_0x93f1('0x11'));var hardwareService=require(_0x93f1('0x12'));var logger=require(_0x93f1('0x13'))(_0x93f1('0x14'));var utils=require(_0x93f1('0x15'));var config=require(_0x93f1('0x16'));var licenseUtil=require(_0x93f1('0x17'));var db=require(_0x93f1('0x18'))['db'];function respondWithStatusCode(_0x3348ab,_0x5b4aa3){_0x5b4aa3=_0x5b4aa3||0xcc;return function(_0x4080a8){if(_0x4080a8){return _0x3348ab[_0x93f1('0x19')](_0x5b4aa3);}return _0x3348ab[_0x93f1('0x1a')](_0x5b4aa3)[_0x93f1('0x1b')]();};}function respondWithResult(_0x552ae6,_0x391deb){_0x391deb=_0x391deb||0xc8;return function(_0x49f4c8){if(_0x49f4c8){return _0x552ae6[_0x93f1('0x1a')](_0x391deb)[_0x93f1('0x1c')](_0x49f4c8);}};}function respondWithFilteredResult(_0x176cf2,_0x43b0bc){return function(_0x120c83){if(_0x120c83){var _0x48e0a1=typeof _0x43b0bc[_0x93f1('0x1d')]===_0x93f1('0x1e')&&typeof _0x43b0bc[_0x93f1('0x1f')]===_0x93f1('0x1e');var _0x2ed400=_0x120c83[_0x93f1('0x20')];var _0xaed1b5=_0x48e0a1?0x0:_0x43b0bc[_0x93f1('0x1d')];var _0x15c213=_0x48e0a1?_0x120c83[_0x93f1('0x20')]:_0x43b0bc[_0x93f1('0x1d')]+_0x43b0bc['limit'];var _0x54880e;if(_0x15c213>=_0x2ed400){_0x15c213=_0x2ed400;_0x54880e=0xc8;}else{_0x54880e=0xce;}_0x176cf2['status'](_0x54880e);return _0x176cf2[_0x93f1('0x21')]('Content-Range',_0xaed1b5+'-'+_0x15c213+'/'+_0x2ed400)[_0x93f1('0x1c')](_0x120c83);}return null;};}function patchUpdates(_0x39ae13){return function(_0x3795b8){try{jsonpatch[_0x93f1('0x22')](_0x3795b8,_0x39ae13,!![]);}catch(_0x595943){return BPromise[_0x93f1('0x23')](_0x595943);}return _0x3795b8['save']();};}function saveUpdates(_0xe7cea3,_0x310e76){return function(_0x4b26bb){if(_0x4b26bb){return _0x4b26bb[_0x93f1('0x24')](_0xe7cea3)['then'](function(_0x578ccc){return _0x578ccc;});}return null;};}function removeEntity(_0x14313d,_0x2b2115){return function(_0x5c30a5){if(_0x5c30a5){return _0x5c30a5[_0x93f1('0x25')]()['then'](function(){_0x14313d[_0x93f1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5272ba,_0x2972cd){return function(_0x9ed8af){if(!_0x9ed8af){_0x5272ba[_0x93f1('0x19')](0x194);}return _0x9ed8af;};}function handleError(_0x46719c,_0x2e9444){_0x2e9444=_0x2e9444||0x1f4;return function(_0x3e8f2f){logger['error'](_0x3e8f2f[_0x93f1('0x26')]);if(_0x3e8f2f['name']){delete _0x3e8f2f[_0x93f1('0x27')];}_0x46719c[_0x93f1('0x1a')](_0x2e9444)[_0x93f1('0x28')](_0x3e8f2f);};}exports[_0x93f1('0x29')]=function(_0x29ec13,_0x27efcf){var _0x2e6661={'raw':!![],'where':{'id':_0x29ec13['params']['id']}},_0x35a2d5={};_0x35a2d5[_0x93f1('0x2a')]=_[_0x93f1('0x2b')](db[_0x93f1('0x2c')][_0x93f1('0x2d')]);_0x35a2d5['query']=_[_0x93f1('0x2b')](_0x29ec13[_0x93f1('0x2e')]);_0x35a2d5['filters']=_[_0x93f1('0x2f')](_0x35a2d5[_0x93f1('0x2a')],_0x35a2d5['query']);_0x2e6661['attributes']=_[_0x93f1('0x2f')](_0x35a2d5['model'],qs['fields'](_0x29ec13['query']['fields']));_0x2e6661[_0x93f1('0x30')]=_0x2e6661[_0x93f1('0x30')]['length']?_0x2e6661[_0x93f1('0x30')]:_0x35a2d5[_0x93f1('0x2a')];if(_0x29ec13[_0x93f1('0x2e')][_0x93f1('0x31')]){_0x2e6661[_0x93f1('0x32')]=[{'all':!![]}];}_0x2e6661=_[_0x93f1('0x33')]({},_0x2e6661,_0x29ec13[_0x93f1('0x34')]);return db[_0x93f1('0x2c')][_0x93f1('0x35')](_0x2e6661)[_0x93f1('0x36')](handleEntityNotFound(_0x27efcf,null))[_0x93f1('0x36')](respondWithResult(_0x27efcf,null))['catch'](handleError(_0x27efcf,null));};exports['update']=function(_0x35f23c,_0x22e526){if(_0x35f23c[_0x93f1('0x37')]['id']){delete _0x35f23c[_0x93f1('0x37')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x35f23c[_0x93f1('0x38')]['id']}})[_0x93f1('0x36')](handleEntityNotFound(_0x22e526,null))['then'](saveUpdates(_0x35f23c[_0x93f1('0x37')],null))[_0x93f1('0x36')](respondWithResult(_0x22e526,null))[_0x93f1('0x39')](handleError(_0x22e526,null));};exports[_0x93f1('0x25')]=function(_0x422336,_0xb5696e){return db[_0x93f1('0x2c')][_0x93f1('0x35')]({'where':{'id':_0x422336[_0x93f1('0x38')]['id']}})[_0x93f1('0x36')](handleEntityNotFound(_0xb5696e,null))['then'](removeEntity(_0xb5696e,null))['catch'](handleError(_0xb5696e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 3e1b58e..8434657 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 _0x85a8=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatApplication','chat_applications'];(function(_0x12b9b7,_0x2a4948){var _0x1e2a73=function(_0x5e4965){while(--_0x5e4965){_0x12b9b7['push'](_0x12b9b7['shift']());}};_0x1e2a73(++_0x2a4948);}(_0x85a8,0xc6));var _0x885a=function(_0x1db176,_0xa98b8e){_0x1db176=_0x1db176-0x0;var _0xd09d79=_0x85a8[_0x1db176];return _0xd09d79;};'use strict';var _=require(_0x885a('0x0'));var util=require(_0x885a('0x1'));var logger=require('../../config/logger')(_0x885a('0x2'));var moment=require(_0x885a('0x3'));var BPromise=require(_0x885a('0x4'));var rp=require(_0x885a('0x5'));var fs=require('fs');var path=require(_0x885a('0x6'));var rimraf=require(_0x885a('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x885a('0x8')]=function(_0x12f4bb,_0x1d37a8){return _0x12f4bb[_0x885a('0x9')](_0x885a('0xa'),attributes,{'tableName':_0x885a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x885a('0xc'),'collate':_0x885a('0xd')});}; \ No newline at end of file +var _0x1b8c=['define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x1a4568,_0x3ddbf9){var _0x550398=function(_0x39b3fd){while(--_0x39b3fd){_0x1a4568['push'](_0x1a4568['shift']());}};_0x550398(++_0x3ddbf9);}(_0x1b8c,0x130));var _0xc1b8=function(_0x53bbe6,_0x3fabed){_0x53bbe6=_0x53bbe6-0x0;var _0x4ccf2d=_0x1b8c[_0x53bbe6];return _0x4ccf2d;};'use strict';var _=require(_0xc1b8('0x0'));var util=require('util');var logger=require(_0xc1b8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc1b8('0x2'));var rp=require(_0xc1b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1b8('0x4'));var config=require(_0xc1b8('0x5'));var attributes=require(_0xc1b8('0x6'));module[_0xc1b8('0x7')]=function(_0x2a4220,_0x2db296){return _0x2a4220[_0xc1b8('0x8')]('ChatApplication',attributes,{'tableName':_0xc1b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc1b8('0xa'),'collate':_0xc1b8('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 4169278..c1b991a 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 _0x8e21=['error','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x42f3a5,_0x3a4470){var _0x1a7d74=function(_0x43cc36){while(--_0x43cc36){_0x42f3a5['push'](_0x42f3a5['shift']());}};_0x1a7d74(++_0x3a4470);}(_0x8e21,0x1d0));var _0x18e2=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x8e21[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0x18e2('0x0'));var util=require(_0x18e2('0x1'));var moment=require(_0x18e2('0x2'));var BPromise=require(_0x18e2('0x3'));var rs=require(_0x18e2('0x4'));var fs=require('fs');var Redis=require(_0x18e2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x18e2('0x6'));var logger=require(_0x18e2('0x7'))(_0x18e2('0x8'));var config=require(_0x18e2('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cc8c0,_0x5ee915,_0x3491c2){return new BPromise(function(_0x4eb63f,_0xc10ffe){return client['request'](_0x5cc8c0,_0x3491c2)['then'](function(_0x3170d6){logger[_0x18e2('0xa')]('ChatApplication,\x20%s,\x20%s',_0x5ee915,_0x18e2('0xb'));logger[_0x18e2('0xc')](_0x18e2('0xd'),_0x5ee915,_0x18e2('0xb'),JSON[_0x18e2('0xe')](_0x3170d6));if(_0x3170d6['error']){if(_0x3170d6['error'][_0x18e2('0xf')]===0x1f4){logger[_0x18e2('0x10')](_0x18e2('0x11'),_0x5ee915,_0x3170d6['error'][_0x18e2('0x12')]);return _0xc10ffe(_0x3170d6['error']['message']);}logger['error'](_0x18e2('0x11'),_0x5ee915,_0x3170d6[_0x18e2('0x10')][_0x18e2('0x12')]);return _0x4eb63f(_0x3170d6[_0x18e2('0x10')][_0x18e2('0x12')]);}else{logger[_0x18e2('0xa')](_0x18e2('0x11'),_0x5ee915,_0x18e2('0xb'));_0x4eb63f(_0x3170d6['result'][_0x18e2('0x12')]);}})[_0x18e2('0x13')](function(_0x1ffe66){logger[_0x18e2('0x10')](_0x18e2('0x11'),_0x5ee915,_0x1ffe66);_0xc10ffe(_0x1ffe66);});});} \ No newline at end of file +var _0x61ad=['rpc','../../config/environment','jayson/promise','client','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a7585,_0x3a7b1a){var _0x2e3029=function(_0x1562e5){while(--_0x1562e5){_0x4a7585['push'](_0x4a7585['shift']());}};_0x2e3029(++_0x3a7b1a);}(_0x61ad,0x1b0));var _0xd61a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x61ad[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xd61a('0x0'));var moment=require(_0xd61a('0x1'));var BPromise=require(_0xd61a('0x2'));var rs=require(_0xd61a('0x3'));var fs=require('fs');var Redis=require(_0xd61a('0x4'));var db=require(_0xd61a('0x5'))['db'];var utils=require(_0xd61a('0x6'));var logger=require(_0xd61a('0x7'))(_0xd61a('0x8'));var config=require(_0xd61a('0x9'));var jayson=require(_0xd61a('0xa'));var client=jayson[_0xd61a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x681501,_0x1f0652,_0x27d30a){return new BPromise(function(_0x30c251,_0x995ff1){return client['request'](_0x681501,_0x27d30a)[_0xd61a('0xc')](function(_0x2301b1){logger['info'](_0xd61a('0xd'),_0x1f0652,_0xd61a('0xe'));logger['debug'](_0xd61a('0xf'),_0x1f0652,'request\x20sent',JSON[_0xd61a('0x10')](_0x2301b1));if(_0x2301b1[_0xd61a('0x11')]){if(_0x2301b1['error']['code']===0x1f4){logger[_0xd61a('0x11')](_0xd61a('0xd'),_0x1f0652,_0x2301b1[_0xd61a('0x11')][_0xd61a('0x12')]);return _0x995ff1(_0x2301b1[_0xd61a('0x11')][_0xd61a('0x12')]);}logger['error'](_0xd61a('0xd'),_0x1f0652,_0x2301b1[_0xd61a('0x11')][_0xd61a('0x12')]);return _0x30c251(_0x2301b1[_0xd61a('0x11')][_0xd61a('0x12')]);}else{logger[_0xd61a('0x13')](_0xd61a('0xd'),_0x1f0652,_0xd61a('0xe'));_0x30c251(_0x2301b1[_0xd61a('0x14')][_0xd61a('0x12')]);}})[_0xd61a('0x15')](function(_0x220427){logger['error'](_0xd61a('0xd'),_0x1f0652,_0x220427);_0x995ff1(_0x220427);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index e14ade8..7dce4ab 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 _0xaf08=['destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','delete'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0xaf08,0x1be));var _0x8af0=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0xaf08[_0x3dbd6d];return _0x1216f1;};'use strict';var multer=require(_0x8af0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8af0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8af0('0x2'));var auth=require(_0x8af0('0x3'));var interaction=require(_0x8af0('0x4'));var config=require('../../config/environment');var controller=require(_0x8af0('0x5'));router[_0x8af0('0x6')](_0x8af0('0x7'),auth['isAuthenticated'](),controller['show']);router['put'](_0x8af0('0x7'),auth[_0x8af0('0x8')](),controller['update']);router[_0x8af0('0x9')](_0x8af0('0x7'),auth[_0x8af0('0x8')](),controller[_0x8af0('0xa')]);module[_0x8af0('0xb')]=router; \ No newline at end of file +var _0x4689=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x314baf,_0x2fdf8e){var _0x963ce2=function(_0x466d7d){while(--_0x466d7d){_0x314baf['push'](_0x314baf['shift']());}};_0x963ce2(++_0x2fdf8e);}(_0x4689,0x1c4));var _0x9468=function(_0x43b246,_0x579a61){_0x43b246=_0x43b246-0x0;var _0x22c801=_0x4689[_0x43b246];return _0x22c801;};'use strict';var multer=require(_0x9468('0x0'));var util=require(_0x9468('0x1'));var path=require(_0x9468('0x2'));var timeout=require(_0x9468('0x3'));var express=require(_0x9468('0x4'));var router=express['Router']();var fs_extra=require(_0x9468('0x5'));var auth=require(_0x9468('0x6'));var interaction=require(_0x9468('0x7'));var config=require(_0x9468('0x8'));var controller=require('./chatApplication.controller');router[_0x9468('0x9')]('/:id',auth[_0x9468('0xa')](),controller[_0x9468('0xb')]);router['put'](_0x9468('0xc'),auth[_0x9468('0xa')](),controller[_0x9468('0xd')]);router[_0x9468('0xe')](_0x9468('0xc'),auth['isAuthenticated'](),controller[_0x9468('0xf')]);module[_0x9468('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 3c19cb0..e96d2b3 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 _0xf072=['exports','STRING','BOOLEAN','sequelize'];(function(_0x15ff2d,_0x14ee50){var _0x4ec84c=function(_0x2b54a3){while(--_0x2b54a3){_0x15ff2d['push'](_0x15ff2d['shift']());}};_0x4ec84c(++_0x14ee50);}(_0xf072,0x1cf));var _0x2f07=function(_0x44ab9d,_0x3d060c){_0x44ab9d=_0x44ab9d-0x0;var _0x279648=_0xf072[_0x44ab9d];return _0x279648;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'name':{'type':Sequelize[_0x2f07('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x2f07('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x494e=['sequelize','STRING'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x494e,0xd6));var _0xe494=function(_0x3aa0a3,_0x47dee8){_0x3aa0a3=_0x3aa0a3-0x0;var _0x35db3c=_0x494e[_0x3aa0a3];return _0x35db3c;};'use strict';var Sequelize=require(_0xe494('0x0'));module['exports']={'name':{'type':Sequelize[_0xe494('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'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 3085878..2b1b45e 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 _0x742c=['show','params','keys','merge','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','hasOwnProperty','removeMembers','ChatGroupId','$gte','split','format','getMessages','nolimit','eml-format','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','rawAttributes','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x185133,_0x29a472){var _0x862f7f=function(_0x25ea87){while(--_0x25ea87){_0x185133['push'](_0x185133['shift']());}};_0x862f7f(++_0x29a472);}(_0x742c,0xd5));var _0xc742=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x742c[_0x30f07a];return _0xb38461;};'use strict';var emlformat=require(_0xc742('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc742('0x1'));var moment=require(_0xc742('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc742('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc742('0x4'));var csv=require(_0xc742('0x5'));var ejs=require(_0xc742('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc742('0x7'));var squel=require(_0xc742('0x8'));var crypto=require(_0xc742('0x9'));var jsforce=require(_0xc742('0xa'));var deskjs=require(_0xc742('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc742('0xc'));var Papa=require(_0xc742('0xd'));var Redis=require(_0xc742('0xe'));var authService=require(_0xc742('0xf'));var qs=require(_0xc742('0x10'));var as=require(_0xc742('0x11'));var hardwareService=require(_0xc742('0x12'));var logger=require(_0xc742('0x13'))(_0xc742('0x14'));var utils=require(_0xc742('0x15'));var config=require(_0xc742('0x16'));var licenseUtil=require(_0xc742('0x17'));var db=require(_0xc742('0x18'))['db'];config['redis']=_[_0xc742('0x19')](config[_0xc742('0x1a')],{'host':_0xc742('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc742('0x1a')]));require('./chatGroup.socket')[_0xc742('0x1c')](socket);function respondWithStatusCode(_0x308619,_0x502044){_0x502044=_0x502044||0xcc;return function(_0x4d22af){if(_0x4d22af){return _0x308619[_0xc742('0x1d')](_0x502044);}return _0x308619[_0xc742('0x1e')](_0x502044)[_0xc742('0x1f')]();};}function respondWithResult(_0x2cdc1c,_0x472d2c){_0x472d2c=_0x472d2c||0xc8;return function(_0x1f83f3){if(_0x1f83f3){return _0x2cdc1c['status'](_0x472d2c)[_0xc742('0x20')](_0x1f83f3);}};}function respondWithFilteredResult(_0x46d8bc,_0x46e01a){return function(_0x205e56){if(_0x205e56){var _0x21abd0=typeof _0x46e01a[_0xc742('0x21')]===_0xc742('0x22')&&typeof _0x46e01a[_0xc742('0x23')]===_0xc742('0x22');var _0x3e86bb=_0x205e56[_0xc742('0x24')];var _0x356ba0=_0x21abd0?0x0:_0x46e01a[_0xc742('0x21')];var _0x5ec569=_0x21abd0?_0x205e56[_0xc742('0x24')]:_0x46e01a[_0xc742('0x21')]+_0x46e01a[_0xc742('0x23')];var _0x4f0f13;if(_0x5ec569>=_0x3e86bb){_0x5ec569=_0x3e86bb;_0x4f0f13=0xc8;}else{_0x4f0f13=0xce;}_0x46d8bc[_0xc742('0x1e')](_0x4f0f13);return _0x46d8bc[_0xc742('0x25')](_0xc742('0x26'),_0x356ba0+'-'+_0x5ec569+'/'+_0x3e86bb)[_0xc742('0x20')](_0x205e56);}return null;};}function patchUpdates(_0x5c8505){return function(_0x44b0b8){try{jsonpatch[_0xc742('0x27')](_0x44b0b8,_0x5c8505,!![]);}catch(_0x262f7d){return BPromise[_0xc742('0x28')](_0x262f7d);}return _0x44b0b8[_0xc742('0x29')]();};}function saveUpdates(_0x385eb5,_0x38e9c0){return function(_0x179342){if(_0x179342){return _0x179342[_0xc742('0x2a')](_0x385eb5)[_0xc742('0x2b')](function(_0x416278){return _0x416278;});}return null;};}function removeEntity(_0x294a61,_0x5eecc6){return function(_0x313edb){if(_0x313edb){return _0x313edb[_0xc742('0x2c')]()['then'](function(){_0x294a61[_0xc742('0x1e')](0xcc)[_0xc742('0x1f')]();});}};}function handleEntityNotFound(_0x21a32f,_0x3bb38e){return function(_0x303bf6){if(!_0x303bf6){_0x21a32f[_0xc742('0x1d')](0x194);}return _0x303bf6;};}function handleError(_0x49c2bc,_0x3741e4){_0x3741e4=_0x3741e4||0x1f4;return function(_0x575e79){logger[_0xc742('0x2d')](_0x575e79[_0xc742('0x2e')]);if(_0x575e79[_0xc742('0x2f')]){delete _0x575e79[_0xc742('0x2f')];}_0x49c2bc['status'](_0x3741e4)['send'](_0x575e79);};}exports[_0xc742('0x30')]=function(_0x581dfc,_0x3a5db7){var _0x27598b={},_0x3cabcd={},_0x35348b={'count':0x0,'rows':[]};var _0xa442a=_[_0xc742('0x31')](db[_0xc742('0x32')][_0xc742('0x33')],function(_0x43250b){return{'name':_0x43250b['fieldName'],'type':_0x43250b[_0xc742('0x34')][_0xc742('0x35')]};});_0x3cabcd[_0xc742('0x36')]=_[_0xc742('0x31')](_0xa442a,_0xc742('0x2f'));_0x3cabcd[_0xc742('0x37')]=_['keys'](_0x581dfc[_0xc742('0x37')]);_0x3cabcd['filters']=_[_0xc742('0x38')](_0x3cabcd[_0xc742('0x36')],_0x3cabcd[_0xc742('0x37')]);_0x27598b[_0xc742('0x39')]=_['intersection'](_0x3cabcd['model'],qs[_0xc742('0x3a')](_0x581dfc[_0xc742('0x37')][_0xc742('0x3a')]));_0x27598b['attributes']=_0x27598b[_0xc742('0x39')][_0xc742('0x3b')]?_0x27598b[_0xc742('0x39')]:_0x3cabcd[_0xc742('0x36')];if(!_0x581dfc[_0xc742('0x37')]['hasOwnProperty']('nolimit')){_0x27598b['limit']=qs['limit'](_0x581dfc[_0xc742('0x37')][_0xc742('0x23')]);_0x27598b[_0xc742('0x21')]=qs[_0xc742('0x21')](_0x581dfc[_0xc742('0x37')]['offset']);}_0x27598b[_0xc742('0x3c')]=qs[_0xc742('0x3d')](_0x581dfc[_0xc742('0x37')][_0xc742('0x3d')]);_0x27598b[_0xc742('0x3e')]=qs[_0xc742('0x3f')](_[_0xc742('0x40')](_0x581dfc[_0xc742('0x37')],_0x3cabcd[_0xc742('0x3f')]),_0xa442a);if(_0x581dfc[_0xc742('0x37')][_0xc742('0x41')]){_0x27598b[_0xc742('0x3e')]=_['merge'](_0x27598b[_0xc742('0x3e')],{'$or':_['map'](_0xa442a,function(_0x1516b3){if(_0x1516b3[_0xc742('0x34')]!==_0xc742('0x42')){var _0x5c1856={};_0x5c1856[_0x1516b3[_0xc742('0x2f')]]={'$like':'%'+_0x581dfc[_0xc742('0x37')][_0xc742('0x41')]+'%'};return _0x5c1856;}})});}_0x27598b=_['merge']({},_0x27598b,_0x581dfc[_0xc742('0x43')]);var _0x14fc10={'where':_0x27598b[_0xc742('0x3e')]};return db[_0xc742('0x32')][_0xc742('0x24')](_0x14fc10)[_0xc742('0x2b')](function(_0x586fe5){_0x35348b['count']=_0x586fe5;if(_0x581dfc[_0xc742('0x37')][_0xc742('0x44')]){_0x27598b[_0xc742('0x45')]=[{'all':!![]}];}return db[_0xc742('0x32')]['findAll'](_0x27598b);})[_0xc742('0x2b')](function(_0x26c368){_0x35348b[_0xc742('0x46')]=_0x26c368;return _0x35348b;})['then'](respondWithFilteredResult(_0x3a5db7,_0x27598b))[_0xc742('0x47')](handleError(_0x3a5db7,null));};exports[_0xc742('0x48')]=function(_0x191e03,_0x516a5b){var _0x4a3bc8={'raw':!![],'where':{'id':_0x191e03[_0xc742('0x49')]['id']}},_0x112778={};_0x112778[_0xc742('0x36')]=_[_0xc742('0x4a')](db[_0xc742('0x32')]['rawAttributes']);_0x112778[_0xc742('0x37')]=_[_0xc742('0x4a')](_0x191e03[_0xc742('0x37')]);_0x112778[_0xc742('0x3f')]=_[_0xc742('0x38')](_0x112778[_0xc742('0x36')],_0x112778['query']);_0x4a3bc8[_0xc742('0x39')]=_['intersection'](_0x112778['model'],qs[_0xc742('0x3a')](_0x191e03[_0xc742('0x37')][_0xc742('0x3a')]));_0x4a3bc8['attributes']=_0x4a3bc8['attributes']['length']?_0x4a3bc8[_0xc742('0x39')]:_0x112778[_0xc742('0x36')];if(_0x191e03[_0xc742('0x37')]['includeAll']){_0x4a3bc8[_0xc742('0x45')]=[{'all':!![]}];}_0x4a3bc8=_[_0xc742('0x4b')]({},_0x4a3bc8,_0x191e03[_0xc742('0x43')]);return db['ChatGroup'][_0xc742('0x4c')](_0x4a3bc8)[_0xc742('0x2b')](handleEntityNotFound(_0x516a5b,null))[_0xc742('0x2b')](respondWithResult(_0x516a5b,null))['catch'](handleError(_0x516a5b,null));};exports[_0xc742('0x4d')]=function(_0x19df21,_0x5e2db7){return db['ChatGroup'][_0xc742('0x4d')](_0x19df21[_0xc742('0x4e')],{})['then'](respondWithResult(_0x5e2db7,0xc9))[_0xc742('0x47')](handleError(_0x5e2db7,null));};exports[_0xc742('0x2a')]=function(_0x329580,_0x5ccdbd){if(_0x329580[_0xc742('0x4e')]['id']){delete _0x329580[_0xc742('0x4e')]['id'];}return db[_0xc742('0x32')][_0xc742('0x4c')]({'where':{'id':_0x329580[_0xc742('0x49')]['id']}})[_0xc742('0x2b')](handleEntityNotFound(_0x5ccdbd,null))[_0xc742('0x2b')](saveUpdates(_0x329580[_0xc742('0x4e')],null))[_0xc742('0x2b')](respondWithResult(_0x5ccdbd,null))['catch'](handleError(_0x5ccdbd,null));};exports['destroy']=function(_0xfcba44,_0x2b45f3){return db[_0xc742('0x32')]['find']({'where':{'id':_0xfcba44[_0xc742('0x49')]['id']}})[_0xc742('0x2b')](handleEntityNotFound(_0x2b45f3,null))[_0xc742('0x2b')](removeEntity(_0x2b45f3,null))[_0xc742('0x47')](handleError(_0x2b45f3,null));};exports[_0xc742('0x4f')]=function(_0x368e75,_0x1b8aa7){return db['ChatGroup'][_0xc742('0x4f')]()[_0xc742('0x2b')](respondWithResult(_0x1b8aa7,null))['catch'](handleError(_0x1b8aa7,null));};exports[_0xc742('0x50')]=function(_0x5d1ba9,_0x2f8f32,_0x50a521){return db[_0xc742('0x51')]['count']({'where':{'ChatGroupId':_0x5d1ba9[_0xc742('0x49')]['id'],'ToId':_0x5d1ba9['user']['id'],'read':![]}})['then'](function(_0xf9db3e){return{'id':_[_0xc742('0x52')](_0x5d1ba9[_0xc742('0x49')]['id']),'count':_0xf9db3e};})['then'](respondWithResult(_0x2f8f32,null))[_0xc742('0x47')](handleError(_0x2f8f32,null));};exports[_0xc742('0x53')]=function(_0x131b2a,_0x24e322,_0x3cf7ce){return db[_0xc742('0x32')]['find']({'where':{'id':_0x131b2a['params']['id']}})['then'](handleEntityNotFound(_0x24e322,null))[_0xc742('0x2b')](function(_0x5b4ade){if(_0x5b4ade){return _0x5b4ade[_0xc742('0x53')](_0x131b2a[_0xc742('0x4e')][_0xc742('0x54')],_['omit'](_0x131b2a[_0xc742('0x4e')],[_0xc742('0x54'),'id'])||{});}})[_0xc742('0x2b')](respondWithResult(_0x24e322,null))['catch'](handleError(_0x24e322,null));};exports[_0xc742('0x55')]=function(_0x3627f7,_0x17cc82,_0x31b8be){var _0x9816f4={};var _0x3508ad={};var _0x49bc50;var _0x407d5f;return db[_0xc742('0x32')][_0xc742('0x56')]({'where':{'id':_0x3627f7[_0xc742('0x49')]['id']}})[_0xc742('0x2b')](handleEntityNotFound(_0x17cc82,null))[_0xc742('0x2b')](function(_0x3fc085){if(_0x3fc085){_0x49bc50=_0x3fc085;_0x3508ad['model']=_[_0xc742('0x4a')](db['User'][_0xc742('0x33')]);_0x3508ad[_0xc742('0x37')]=_[_0xc742('0x4a')](_0x3627f7[_0xc742('0x37')]);_0x3508ad[_0xc742('0x3f')]=_[_0xc742('0x38')](_0x3508ad[_0xc742('0x36')],_0x3508ad[_0xc742('0x37')]);_0x9816f4[_0xc742('0x39')]=_[_0xc742('0x38')](_0x3508ad[_0xc742('0x36')],qs['fields'](_0x3627f7[_0xc742('0x37')][_0xc742('0x3a')]));_0x9816f4[_0xc742('0x39')]=_0x9816f4[_0xc742('0x39')][_0xc742('0x3b')]?_0x9816f4[_0xc742('0x39')]:_0x3508ad[_0xc742('0x36')];_0x9816f4[_0xc742('0x3c')]=qs['sort'](_0x3627f7[_0xc742('0x37')]['sort']);_0x9816f4['where']=qs[_0xc742('0x3f')](_['pick'](_0x3627f7[_0xc742('0x37')],_0x3508ad[_0xc742('0x3f')]));if(_0x3627f7[_0xc742('0x37')][_0xc742('0x41')]){_0x9816f4['where']=_['merge'](_0x9816f4['where'],{'$or':_[_0xc742('0x31')](_0x9816f4[_0xc742('0x39')],function(_0x36b439){var _0x19e788={};_0x19e788[_0x36b439]={'$like':'%'+_0x3627f7[_0xc742('0x37')]['filter']+'%'};return _0x19e788;})});}_0x9816f4=_[_0xc742('0x4b')]({},_0x9816f4,_0x3627f7[_0xc742('0x43')]);return _0x49bc50['getMembers'](_0x9816f4);}})[_0xc742('0x2b')](function(_0x5ad41b){if(_0x5ad41b){_0x407d5f=_0x5ad41b['length'];if(!_0x3627f7[_0xc742('0x37')][_0xc742('0x57')]('nolimit')){_0x9816f4['limit']=qs[_0xc742('0x23')](_0x3627f7[_0xc742('0x37')][_0xc742('0x23')]);_0x9816f4[_0xc742('0x21')]=qs[_0xc742('0x21')](_0x3627f7[_0xc742('0x37')][_0xc742('0x21')]);}return _0x49bc50[_0xc742('0x55')](_0x9816f4);}})[_0xc742('0x2b')](function(_0x17ebad){if(_0x17ebad){return _0x17ebad?{'count':_0x407d5f,'rows':_0x17ebad}:null;}})[_0xc742('0x2b')](respondWithResult(_0x17cc82,null))[_0xc742('0x47')](handleError(_0x17cc82,null));};exports[_0xc742('0x58')]=function(_0x575755,_0x3702fc,_0x3fb538){return db[_0xc742('0x32')][_0xc742('0x4c')]({'where':{'id':_0x575755['params']['id']}})['then'](handleEntityNotFound(_0x3702fc,null))['then'](function(_0xa10061){if(_0xa10061){return _0xa10061[_0xc742('0x58')](_0x575755[_0xc742('0x37')][_0xc742('0x54')]);}})[_0xc742('0x2b')](respondWithStatusCode(_0x3702fc,null))['catch'](handleError(_0x3702fc,null));};exports['addMessage']=function(_0x3d5611,_0xa91f01,_0x5663b2){if(_0x3d5611['body']['id']){delete _0x3d5611[_0xc742('0x4e')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x3d5611[_0xc742('0x49')]['id']}})[_0xc742('0x2b')](handleEntityNotFound(_0xa91f01,null))[_0xc742('0x2b')](function(_0x184376){if(_0x184376){_0x3d5611[_0xc742('0x4e')][_0xc742('0x59')]=_0x184376['id'];return db[_0xc742('0x51')]['create'](_0x3d5611[_0xc742('0x4e')]);}})[_0xc742('0x2b')](respondWithResult(_0xa91f01,null))[_0xc742('0x47')](handleError(_0xa91f01,null));};exports['getMessages']=function(_0x579163,_0x5c2ad6,_0xe55cff){var _0x372fc0={};var _0x33390e={};var _0x19e53c;var _0x74f476;return db[_0xc742('0x32')]['findOne']({'where':{'id':_0x579163[_0xc742('0x49')]['id']}})[_0xc742('0x2b')](handleEntityNotFound(_0x5c2ad6,null))['then'](function(_0x572666){if(_0x572666){_0x19e53c=_0x572666;_0x33390e[_0xc742('0x36')]=_[_0xc742('0x4a')](db[_0xc742('0x51')][_0xc742('0x33')]);_0x33390e[_0xc742('0x37')]=_[_0xc742('0x4a')](_0x579163[_0xc742('0x37')]);_0x33390e[_0xc742('0x3f')]=_['intersection'](_0x33390e[_0xc742('0x36')],_0x33390e[_0xc742('0x37')]);_0x372fc0['attributes']=_[_0xc742('0x38')](_0x33390e[_0xc742('0x36')],qs[_0xc742('0x3a')](_0x579163[_0xc742('0x37')][_0xc742('0x3a')]));_0x372fc0[_0xc742('0x39')]=_0x372fc0[_0xc742('0x39')][_0xc742('0x3b')]?_0x372fc0['attributes']:_0x33390e[_0xc742('0x36')];_0x372fc0[_0xc742('0x3c')]=qs['sort'](_0x579163[_0xc742('0x37')][_0xc742('0x3d')]);_0x372fc0[_0xc742('0x3e')]=qs[_0xc742('0x3f')](_[_0xc742('0x40')](_0x579163[_0xc742('0x37')],_0x33390e[_0xc742('0x3f')]));if(_0x579163[_0xc742('0x37')][_0xc742('0x41')]){_0x372fc0[_0xc742('0x3e')]=_['merge'](_0x372fc0[_0xc742('0x3e')],{'$or':_[_0xc742('0x31')](_0x372fc0[_0xc742('0x39')],function(_0x428ce8){var _0x41e420={};_0x41e420[_0x428ce8]={'$like':'%'+_0x579163[_0xc742('0x37')]['filter']+'%'};return _0x41e420;})});}if(_0x579163[_0xc742('0x37')][_0xc742('0x5a')]){var _0x13bd8f=_0x579163['query'][_0xc742('0x5a')][_0xc742('0x5b')](',');var _0x28b8bc={};_0x28b8bc[_0x13bd8f[0x0]]={'$gte':moment(_0x13bd8f[0x1])[_0xc742('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x372fc0[_0xc742('0x3e')]=_[_0xc742('0x4b')](_0x372fc0[_0xc742('0x3e')],_0x28b8bc);}_0x372fc0=_[_0xc742('0x4b')]({},_0x372fc0,_0x579163[_0xc742('0x43')]);return _0x19e53c[_0xc742('0x5d')](_0x372fc0);}})['then'](function(_0x32889e){if(_0x32889e){_0x74f476=_0x32889e[_0xc742('0x3b')];if(!_0x579163['query'][_0xc742('0x57')](_0xc742('0x5e'))){_0x372fc0[_0xc742('0x23')]=qs['limit'](_0x579163[_0xc742('0x37')]['limit']);_0x372fc0['offset']=qs[_0xc742('0x21')](_0x579163[_0xc742('0x37')]['offset']);}return _0x19e53c[_0xc742('0x5d')](_0x372fc0);}})[_0xc742('0x2b')](function(_0x1ca806){if(_0x1ca806){return _0x1ca806?{'count':_0x74f476,'rows':_0x1ca806}:null;}})[_0xc742('0x2b')](respondWithResult(_0x5c2ad6,null))[_0xc742('0x47')](handleError(_0x5c2ad6,null));}; \ No newline at end of file +var _0x5cd3=['fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','options','includeAll','include','findAll','catch','params','keys','find','create','body','describe','getUnread','ChatInternalMessage','addMembers','ids','omit','getMembers','findOne','filter','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','rimraf','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0x5cd3,0x16d));var _0x35cd=function(_0x1a7ff6,_0x2022da){_0x1a7ff6=_0x1a7ff6-0x0;var _0x9445e6=_0x5cd3[_0x1a7ff6];return _0x9445e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35cd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x35cd('0x1'));var BPromise=require(_0x35cd('0x2'));var Mustache=require(_0x35cd('0x3'));var util=require('util');var path=require(_0x35cd('0x4'));var sox=require(_0x35cd('0x5'));var csv=require(_0x35cd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35cd('0x7'));var _=require(_0x35cd('0x8'));var squel=require(_0x35cd('0x9'));var crypto=require(_0x35cd('0xa'));var jsforce=require(_0x35cd('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x35cd('0xc'));var Redis=require(_0x35cd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x35cd('0xe'));var as=require(_0x35cd('0xf'));var hardwareService=require(_0x35cd('0x10'));var logger=require(_0x35cd('0x11'))(_0x35cd('0x12'));var utils=require(_0x35cd('0x13'));var config=require(_0x35cd('0x14'));var licenseUtil=require(_0x35cd('0x15'));var db=require(_0x35cd('0x16'))['db'];config['redis']=_[_0x35cd('0x17')](config[_0x35cd('0x18')],{'host':_0x35cd('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x35cd('0x1a'))[_0x35cd('0x1b')](socket);function respondWithStatusCode(_0x35c7ad,_0x5adaf1){_0x5adaf1=_0x5adaf1||0xcc;return function(_0x304716){if(_0x304716){return _0x35c7ad[_0x35cd('0x1c')](_0x5adaf1);}return _0x35c7ad['status'](_0x5adaf1)['end']();};}function respondWithResult(_0x340605,_0x2e0f12){_0x2e0f12=_0x2e0f12||0xc8;return function(_0x213815){if(_0x213815){return _0x340605[_0x35cd('0x1d')](_0x2e0f12)[_0x35cd('0x1e')](_0x213815);}};}function respondWithFilteredResult(_0x47f9f1,_0x8e2a0e){return function(_0x494867){if(_0x494867){var _0x4f154b=typeof _0x8e2a0e[_0x35cd('0x1f')]===_0x35cd('0x20')&&typeof _0x8e2a0e['limit']===_0x35cd('0x20');var _0x17ecbf=_0x494867[_0x35cd('0x21')];var _0x57dc2d=_0x4f154b?0x0:_0x8e2a0e[_0x35cd('0x1f')];var _0x453d56=_0x4f154b?_0x494867[_0x35cd('0x21')]:_0x8e2a0e[_0x35cd('0x1f')]+_0x8e2a0e[_0x35cd('0x22')];var _0x2baa43;if(_0x453d56>=_0x17ecbf){_0x453d56=_0x17ecbf;_0x2baa43=0xc8;}else{_0x2baa43=0xce;}_0x47f9f1[_0x35cd('0x1d')](_0x2baa43);return _0x47f9f1[_0x35cd('0x23')](_0x35cd('0x24'),_0x57dc2d+'-'+_0x453d56+'/'+_0x17ecbf)['json'](_0x494867);}return null;};}function patchUpdates(_0xe115f1){return function(_0x148de5){try{jsonpatch['apply'](_0x148de5,_0xe115f1,!![]);}catch(_0x52b9e2){return BPromise[_0x35cd('0x25')](_0x52b9e2);}return _0x148de5[_0x35cd('0x26')]();};}function saveUpdates(_0x4df7cc,_0x47975a){return function(_0x3cce8b){if(_0x3cce8b){return _0x3cce8b[_0x35cd('0x27')](_0x4df7cc)[_0x35cd('0x28')](function(_0x4e6a28){return _0x4e6a28;});}return null;};}function removeEntity(_0x354990,_0x4a797e){return function(_0x220aaf){if(_0x220aaf){return _0x220aaf[_0x35cd('0x29')]()[_0x35cd('0x28')](function(){_0x354990['status'](0xcc)[_0x35cd('0x2a')]();});}};}function handleEntityNotFound(_0x5a8b48,_0x174337){return function(_0x98b4e6){if(!_0x98b4e6){_0x5a8b48[_0x35cd('0x1c')](0x194);}return _0x98b4e6;};}function handleError(_0x42b4ec,_0x3a10e4){_0x3a10e4=_0x3a10e4||0x1f4;return function(_0x20e96f){logger[_0x35cd('0x2b')](_0x20e96f[_0x35cd('0x2c')]);if(_0x20e96f[_0x35cd('0x2d')]){delete _0x20e96f[_0x35cd('0x2d')];}_0x42b4ec['status'](_0x3a10e4)[_0x35cd('0x2e')](_0x20e96f);};}exports['index']=function(_0x2b62f5,_0x2b5e2a){var _0xf6a13d={},_0x21bc79={},_0xfeb657={'count':0x0,'rows':[]};var _0x52c672=_['map'](db[_0x35cd('0x2f')][_0x35cd('0x30')],function(_0x4afec0){return{'name':_0x4afec0[_0x35cd('0x31')],'type':_0x4afec0[_0x35cd('0x32')][_0x35cd('0x33')]};});_0x21bc79[_0x35cd('0x34')]=_[_0x35cd('0x35')](_0x52c672,_0x35cd('0x2d'));_0x21bc79[_0x35cd('0x36')]=_['keys'](_0x2b62f5[_0x35cd('0x36')]);_0x21bc79['filters']=_['intersection'](_0x21bc79['model'],_0x21bc79['query']);_0xf6a13d[_0x35cd('0x37')]=_[_0x35cd('0x38')](_0x21bc79[_0x35cd('0x34')],qs['fields'](_0x2b62f5['query'][_0x35cd('0x39')]));_0xf6a13d[_0x35cd('0x37')]=_0xf6a13d[_0x35cd('0x37')][_0x35cd('0x3a')]?_0xf6a13d[_0x35cd('0x37')]:_0x21bc79[_0x35cd('0x34')];if(!_0x2b62f5[_0x35cd('0x36')][_0x35cd('0x3b')](_0x35cd('0x3c'))){_0xf6a13d['limit']=qs['limit'](_0x2b62f5['query']['limit']);_0xf6a13d['offset']=qs[_0x35cd('0x1f')](_0x2b62f5[_0x35cd('0x36')][_0x35cd('0x1f')]);}_0xf6a13d[_0x35cd('0x3d')]=qs[_0x35cd('0x3e')](_0x2b62f5[_0x35cd('0x36')]['sort']);_0xf6a13d[_0x35cd('0x3f')]=qs['filters'](_[_0x35cd('0x40')](_0x2b62f5[_0x35cd('0x36')],_0x21bc79[_0x35cd('0x41')]),_0x52c672);if(_0x2b62f5[_0x35cd('0x36')]['filter']){_0xf6a13d[_0x35cd('0x3f')]=_[_0x35cd('0x42')](_0xf6a13d[_0x35cd('0x3f')],{'$or':_['map'](_0x52c672,function(_0x180c80){if(_0x180c80[_0x35cd('0x32')]!=='VIRTUAL'){var _0x244c72={};_0x244c72[_0x180c80[_0x35cd('0x2d')]]={'$like':'%'+_0x2b62f5[_0x35cd('0x36')]['filter']+'%'};return _0x244c72;}})});}_0xf6a13d=_[_0x35cd('0x42')]({},_0xf6a13d,_0x2b62f5[_0x35cd('0x43')]);var _0x26458c={'where':_0xf6a13d[_0x35cd('0x3f')]};return db[_0x35cd('0x2f')][_0x35cd('0x21')](_0x26458c)['then'](function(_0x1a2a02){_0xfeb657[_0x35cd('0x21')]=_0x1a2a02;if(_0x2b62f5['query'][_0x35cd('0x44')]){_0xf6a13d[_0x35cd('0x45')]=[{'all':!![]}];}return db[_0x35cd('0x2f')][_0x35cd('0x46')](_0xf6a13d);})['then'](function(_0xcba682){_0xfeb657['rows']=_0xcba682;return _0xfeb657;})[_0x35cd('0x28')](respondWithFilteredResult(_0x2b5e2a,_0xf6a13d))[_0x35cd('0x47')](handleError(_0x2b5e2a,null));};exports['show']=function(_0x25b276,_0x5b411f){var _0x3283d2={'raw':!![],'where':{'id':_0x25b276[_0x35cd('0x48')]['id']}},_0x58012a={};_0x58012a[_0x35cd('0x34')]=_[_0x35cd('0x49')](db[_0x35cd('0x2f')]['rawAttributes']);_0x58012a[_0x35cd('0x36')]=_['keys'](_0x25b276['query']);_0x58012a[_0x35cd('0x41')]=_[_0x35cd('0x38')](_0x58012a[_0x35cd('0x34')],_0x58012a['query']);_0x3283d2[_0x35cd('0x37')]=_[_0x35cd('0x38')](_0x58012a['model'],qs['fields'](_0x25b276[_0x35cd('0x36')][_0x35cd('0x39')]));_0x3283d2[_0x35cd('0x37')]=_0x3283d2[_0x35cd('0x37')][_0x35cd('0x3a')]?_0x3283d2['attributes']:_0x58012a['model'];if(_0x25b276[_0x35cd('0x36')]['includeAll']){_0x3283d2[_0x35cd('0x45')]=[{'all':!![]}];}_0x3283d2=_[_0x35cd('0x42')]({},_0x3283d2,_0x25b276[_0x35cd('0x43')]);return db['ChatGroup'][_0x35cd('0x4a')](_0x3283d2)[_0x35cd('0x28')](handleEntityNotFound(_0x5b411f,null))['then'](respondWithResult(_0x5b411f,null))[_0x35cd('0x47')](handleError(_0x5b411f,null));};exports[_0x35cd('0x4b')]=function(_0x483229,_0x1f3e39){return db['ChatGroup'][_0x35cd('0x4b')](_0x483229[_0x35cd('0x4c')],{})['then'](respondWithResult(_0x1f3e39,0xc9))[_0x35cd('0x47')](handleError(_0x1f3e39,null));};exports[_0x35cd('0x27')]=function(_0x24222e,_0x37d597){if(_0x24222e[_0x35cd('0x4c')]['id']){delete _0x24222e[_0x35cd('0x4c')]['id'];}return db[_0x35cd('0x2f')][_0x35cd('0x4a')]({'where':{'id':_0x24222e[_0x35cd('0x48')]['id']}})[_0x35cd('0x28')](handleEntityNotFound(_0x37d597,null))[_0x35cd('0x28')](saveUpdates(_0x24222e[_0x35cd('0x4c')],null))[_0x35cd('0x28')](respondWithResult(_0x37d597,null))[_0x35cd('0x47')](handleError(_0x37d597,null));};exports[_0x35cd('0x29')]=function(_0x116b2e,_0x57a48c){return db[_0x35cd('0x2f')]['find']({'where':{'id':_0x116b2e['params']['id']}})['then'](handleEntityNotFound(_0x57a48c,null))[_0x35cd('0x28')](removeEntity(_0x57a48c,null))[_0x35cd('0x47')](handleError(_0x57a48c,null));};exports[_0x35cd('0x4d')]=function(_0x86f4d0,_0x3f47f9){return db[_0x35cd('0x2f')][_0x35cd('0x4d')]()['then'](respondWithResult(_0x3f47f9,null))[_0x35cd('0x47')](handleError(_0x3f47f9,null));};exports[_0x35cd('0x4e')]=function(_0x9d1590,_0x3c394e,_0x78b8a0){return db[_0x35cd('0x4f')][_0x35cd('0x21')]({'where':{'ChatGroupId':_0x9d1590[_0x35cd('0x48')]['id'],'ToId':_0x9d1590['user']['id'],'read':![]}})[_0x35cd('0x28')](function(_0x39693b){return{'id':_['toInteger'](_0x9d1590[_0x35cd('0x48')]['id']),'count':_0x39693b};})['then'](respondWithResult(_0x3c394e,null))[_0x35cd('0x47')](handleError(_0x3c394e,null));};exports['addMembers']=function(_0xb07962,_0x7c7e98,_0xe106bf){return db[_0x35cd('0x2f')][_0x35cd('0x4a')]({'where':{'id':_0xb07962['params']['id']}})[_0x35cd('0x28')](handleEntityNotFound(_0x7c7e98,null))[_0x35cd('0x28')](function(_0x29ffa2){if(_0x29ffa2){return _0x29ffa2[_0x35cd('0x50')](_0xb07962['body'][_0x35cd('0x51')],_[_0x35cd('0x52')](_0xb07962[_0x35cd('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0x7c7e98,null))['catch'](handleError(_0x7c7e98,null));};exports[_0x35cd('0x53')]=function(_0x104951,_0x44ac92,_0xdab959){var _0x352aa2={};var _0xd92e53={};var _0x216f24;var _0x23b643;return db[_0x35cd('0x2f')][_0x35cd('0x54')]({'where':{'id':_0x104951[_0x35cd('0x48')]['id']}})['then'](handleEntityNotFound(_0x44ac92,null))[_0x35cd('0x28')](function(_0x5852f1){if(_0x5852f1){_0x216f24=_0x5852f1;_0xd92e53['model']=_['keys'](db['User'][_0x35cd('0x30')]);_0xd92e53[_0x35cd('0x36')]=_['keys'](_0x104951[_0x35cd('0x36')]);_0xd92e53['filters']=_[_0x35cd('0x38')](_0xd92e53[_0x35cd('0x34')],_0xd92e53[_0x35cd('0x36')]);_0x352aa2[_0x35cd('0x37')]=_[_0x35cd('0x38')](_0xd92e53[_0x35cd('0x34')],qs['fields'](_0x104951[_0x35cd('0x36')][_0x35cd('0x39')]));_0x352aa2[_0x35cd('0x37')]=_0x352aa2[_0x35cd('0x37')][_0x35cd('0x3a')]?_0x352aa2[_0x35cd('0x37')]:_0xd92e53['model'];_0x352aa2['order']=qs[_0x35cd('0x3e')](_0x104951[_0x35cd('0x36')][_0x35cd('0x3e')]);_0x352aa2[_0x35cd('0x3f')]=qs['filters'](_[_0x35cd('0x40')](_0x104951[_0x35cd('0x36')],_0xd92e53[_0x35cd('0x41')]));if(_0x104951[_0x35cd('0x36')][_0x35cd('0x55')]){_0x352aa2['where']=_['merge'](_0x352aa2[_0x35cd('0x3f')],{'$or':_[_0x35cd('0x35')](_0x352aa2['attributes'],function(_0x5b9f4f){var _0x39caad={};_0x39caad[_0x5b9f4f]={'$like':'%'+_0x104951[_0x35cd('0x36')]['filter']+'%'};return _0x39caad;})});}_0x352aa2=_[_0x35cd('0x42')]({},_0x352aa2,_0x104951['options']);return _0x216f24[_0x35cd('0x53')](_0x352aa2);}})['then'](function(_0x3e65da){if(_0x3e65da){_0x23b643=_0x3e65da[_0x35cd('0x3a')];if(!_0x104951[_0x35cd('0x36')]['hasOwnProperty'](_0x35cd('0x3c'))){_0x352aa2[_0x35cd('0x22')]=qs[_0x35cd('0x22')](_0x104951[_0x35cd('0x36')]['limit']);_0x352aa2['offset']=qs[_0x35cd('0x1f')](_0x104951[_0x35cd('0x36')][_0x35cd('0x1f')]);}return _0x216f24[_0x35cd('0x53')](_0x352aa2);}})[_0x35cd('0x28')](function(_0x55c1a6){if(_0x55c1a6){return _0x55c1a6?{'count':_0x23b643,'rows':_0x55c1a6}:null;}})[_0x35cd('0x28')](respondWithResult(_0x44ac92,null))[_0x35cd('0x47')](handleError(_0x44ac92,null));};exports[_0x35cd('0x56')]=function(_0xa554e0,_0x1b8576,_0x1c8081){return db[_0x35cd('0x2f')][_0x35cd('0x4a')]({'where':{'id':_0xa554e0[_0x35cd('0x48')]['id']}})[_0x35cd('0x28')](handleEntityNotFound(_0x1b8576,null))['then'](function(_0x901ab){if(_0x901ab){return _0x901ab[_0x35cd('0x56')](_0xa554e0[_0x35cd('0x36')][_0x35cd('0x51')]);}})['then'](respondWithStatusCode(_0x1b8576,null))[_0x35cd('0x47')](handleError(_0x1b8576,null));};exports[_0x35cd('0x57')]=function(_0x4cea06,_0x330cf7,_0x586d8c){if(_0x4cea06[_0x35cd('0x4c')]['id']){delete _0x4cea06[_0x35cd('0x4c')]['id'];}return db[_0x35cd('0x2f')][_0x35cd('0x4a')]({'where':{'id':_0x4cea06[_0x35cd('0x48')]['id']}})['then'](handleEntityNotFound(_0x330cf7,null))[_0x35cd('0x28')](function(_0x923122){if(_0x923122){_0x4cea06[_0x35cd('0x4c')][_0x35cd('0x58')]=_0x923122['id'];return db[_0x35cd('0x4f')][_0x35cd('0x4b')](_0x4cea06['body']);}})[_0x35cd('0x28')](respondWithResult(_0x330cf7,null))[_0x35cd('0x47')](handleError(_0x330cf7,null));};exports[_0x35cd('0x59')]=function(_0x5b4735,_0x58ba70,_0x6562fa){var _0x1f2856={};var _0x5c3e32={};var _0x580c60;var _0x2afbb1;return db['ChatGroup'][_0x35cd('0x54')]({'where':{'id':_0x5b4735[_0x35cd('0x48')]['id']}})[_0x35cd('0x28')](handleEntityNotFound(_0x58ba70,null))['then'](function(_0x4b1890){if(_0x4b1890){_0x580c60=_0x4b1890;_0x5c3e32[_0x35cd('0x34')]=_[_0x35cd('0x49')](db[_0x35cd('0x4f')]['rawAttributes']);_0x5c3e32['query']=_[_0x35cd('0x49')](_0x5b4735['query']);_0x5c3e32[_0x35cd('0x41')]=_[_0x35cd('0x38')](_0x5c3e32[_0x35cd('0x34')],_0x5c3e32[_0x35cd('0x36')]);_0x1f2856[_0x35cd('0x37')]=_['intersection'](_0x5c3e32[_0x35cd('0x34')],qs[_0x35cd('0x39')](_0x5b4735[_0x35cd('0x36')][_0x35cd('0x39')]));_0x1f2856['attributes']=_0x1f2856['attributes'][_0x35cd('0x3a')]?_0x1f2856[_0x35cd('0x37')]:_0x5c3e32[_0x35cd('0x34')];_0x1f2856['order']=qs[_0x35cd('0x3e')](_0x5b4735[_0x35cd('0x36')]['sort']);_0x1f2856[_0x35cd('0x3f')]=qs[_0x35cd('0x41')](_[_0x35cd('0x40')](_0x5b4735[_0x35cd('0x36')],_0x5c3e32[_0x35cd('0x41')]));if(_0x5b4735['query'][_0x35cd('0x55')]){_0x1f2856[_0x35cd('0x3f')]=_[_0x35cd('0x42')](_0x1f2856[_0x35cd('0x3f')],{'$or':_[_0x35cd('0x35')](_0x1f2856[_0x35cd('0x37')],function(_0x46ab65){var _0xa8fbc6={};_0xa8fbc6[_0x46ab65]={'$like':'%'+_0x5b4735[_0x35cd('0x36')][_0x35cd('0x55')]+'%'};return _0xa8fbc6;})});}if(_0x5b4735['query'][_0x35cd('0x5a')]){var _0x15bc53=_0x5b4735['query'][_0x35cd('0x5a')][_0x35cd('0x5b')](',');var _0x226c11={};_0x226c11[_0x15bc53[0x0]]={'$gte':moment(_0x15bc53[0x1])[_0x35cd('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f2856[_0x35cd('0x3f')]=_['merge'](_0x1f2856[_0x35cd('0x3f')],_0x226c11);}_0x1f2856=_[_0x35cd('0x42')]({},_0x1f2856,_0x5b4735[_0x35cd('0x43')]);return _0x580c60[_0x35cd('0x59')](_0x1f2856);}})[_0x35cd('0x28')](function(_0x3e6958){if(_0x3e6958){_0x2afbb1=_0x3e6958[_0x35cd('0x3a')];if(!_0x5b4735['query'][_0x35cd('0x3b')](_0x35cd('0x3c'))){_0x1f2856['limit']=qs[_0x35cd('0x22')](_0x5b4735[_0x35cd('0x36')][_0x35cd('0x22')]);_0x1f2856[_0x35cd('0x1f')]=qs[_0x35cd('0x1f')](_0x5b4735[_0x35cd('0x36')][_0x35cd('0x1f')]);}return _0x580c60[_0x35cd('0x59')](_0x1f2856);}})[_0x35cd('0x28')](function(_0x52137f){if(_0x52137f){return _0x52137f?{'count':_0x2afbb1,'rows':_0x52137f}:null;}})[_0x35cd('0x28')](respondWithResult(_0x58ba70,null))[_0x35cd('0x47')](handleError(_0x58ba70,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6c1e081..f556bcd 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 _0xd0ce=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x40da26,_0x23369c){var _0x2a49a7=function(_0x3faa99){while(--_0x3faa99){_0x40da26['push'](_0x40da26['shift']());}};_0x2a49a7(++_0x23369c);}(_0xd0ce,0x105));var _0xed0c=function(_0x28286e,_0xd8c672){_0x28286e=_0x28286e-0x0;var _0x3a253e=_0xd0ce[_0x28286e];return _0x3a253e;};'use strict';var EventEmitter=require(_0xed0c('0x0'));var ChatGroup=require(_0xed0c('0x1'))['db'][_0xed0c('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xed0c('0x3')](0x0);var events={'afterCreate':_0xed0c('0x4'),'afterUpdate':_0xed0c('0x5'),'afterDestroy':_0xed0c('0x6')};function emitEvent(_0x8b6679){return function(_0x13b003,_0x330d3e,_0x5b7a5f){ChatGroupEvents[_0xed0c('0x7')](_0x8b6679+':'+_0x13b003['id'],_0x13b003);ChatGroupEvents['emit'](_0x8b6679,_0x13b003);_0x5b7a5f(null);};}for(var e in events){if(events[_0xed0c('0x8')](e)){var event=events[e];ChatGroup[_0xed0c('0x9')](e,emitEvent(event));}}module[_0xed0c('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0xd965=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0xd965,0x15b));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5d96('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d96('0x1'),'afterUpdate':_0x5d96('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2b1bbf){return function(_0x542af6,_0x1a0ab5,_0x5a6cba){ChatGroupEvents[_0x5d96('0x3')](_0x2b1bbf+':'+_0x542af6['id'],_0x542af6);ChatGroupEvents[_0x5d96('0x3')](_0x2b1bbf,_0x542af6);_0x5a6cba(null);};}for(var e in events){if(events[_0x5d96('0x4')](e)){var event=events[e];ChatGroup[_0x5d96('0x5')](e,emitEvent(event));}}module[_0x5d96('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 3116cc4..69f6e86 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 _0x54c3=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x26f935,_0x17b8c3){var _0x3b9713=function(_0x2a892c){while(--_0x2a892c){_0x26f935['push'](_0x26f935['shift']());}};_0x3b9713(++_0x17b8c3);}(_0x54c3,0x1b9));var _0x354c=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x54c3[_0x1af5b2];return _0xf1aa2d;};'use strict';var _=require(_0x354c('0x0'));var util=require(_0x354c('0x1'));var logger=require(_0x354c('0x2'))(_0x354c('0x3'));var moment=require(_0x354c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x354c('0x5'));var rimraf=require(_0x354c('0x6'));var config=require(_0x354c('0x7'));var attributes=require(_0x354c('0x8'));module[_0x354c('0x9')]=function(_0x3102a7,_0x7beaa1){return _0x3102a7[_0x354c('0xa')](_0x354c('0xb'),attributes,{'tableName':_0x354c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b5e=['request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','moment'];(function(_0x317f9e,_0x4a83d0){var _0x2ec1f7=function(_0x9d356d){while(--_0x9d356d){_0x317f9e['push'](_0x317f9e['shift']());}};_0x2ec1f7(++_0x4a83d0);}(_0x3b5e,0x18d));var _0xe3b5=function(_0x44c026,_0x31d7ab){_0x44c026=_0x44c026-0x0;var _0x53e051=_0x3b5e[_0x44c026];return _0x53e051;};'use strict';var _=require(_0xe3b5('0x0'));var util=require(_0xe3b5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe3b5('0x2'));var BPromise=require('bluebird');var rp=require(_0xe3b5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3b5('0x4'));var config=require(_0xe3b5('0x5'));var attributes=require(_0xe3b5('0x6'));module[_0xe3b5('0x7')]=function(_0x8db04a,_0x2bdffb){return _0x8db04a['define'](_0xe3b5('0x8'),attributes,{'tableName':_0xe3b5('0x9'),'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 c3f94bc..4af7997 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 _0x7e63=['http','redis','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e63,0x74));var _0x37e6=function(_0x1ff146,_0x5176bc){_0x1ff146=_0x1ff146-0x0;var _0x11d9b1=_0x7e63[_0x1ff146];return _0x11d9b1;};'use strict';var _=require(_0x37e6('0x0'));var util=require(_0x37e6('0x1'));var moment=require(_0x37e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x37e6('0x3'));var fs=require('fs');var Redis=require(_0x37e6('0x4'));var db=require(_0x37e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x37e6('0x6'))(_0x37e6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x37e6('0x8')][_0x37e6('0x9')]({'port':0x232a});config[_0x37e6('0xa')]=_['defaults'](config[_0x37e6('0xa')],{'host':_0x37e6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37e6('0xa')]));require(_0x37e6('0xc'))[_0x37e6('0xd')](socket);function respondWithRpcPromise(_0xfdc255,_0x5ea219,_0x676035){return new BPromise(function(_0x1f5d30,_0x10eb16){return client['request'](_0xfdc255,_0x676035)[_0x37e6('0xe')](function(_0x3f3158){logger[_0x37e6('0xf')](_0x37e6('0x10'),_0x5ea219,_0x37e6('0x11'));logger[_0x37e6('0x12')](_0x37e6('0x13'),_0x5ea219,_0x37e6('0x11'),JSON[_0x37e6('0x14')](_0x3f3158));if(_0x3f3158[_0x37e6('0x15')]){if(_0x3f3158[_0x37e6('0x15')]['code']===0x1f4){logger[_0x37e6('0x15')]('ChatGroup,\x20%s,\x20%s',_0x5ea219,_0x3f3158['error'][_0x37e6('0x16')]);return _0x10eb16(_0x3f3158['error'][_0x37e6('0x16')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x5ea219,_0x3f3158[_0x37e6('0x15')][_0x37e6('0x16')]);return _0x1f5d30(_0x3f3158[_0x37e6('0x15')]['message']);}else{logger[_0x37e6('0xf')](_0x37e6('0x10'),_0x5ea219,_0x37e6('0x11'));_0x1f5d30(_0x3f3158[_0x37e6('0x17')][_0x37e6('0x16')]);}})[_0x37e6('0x18')](function(_0x3cfebd){logger[_0x37e6('0x15')](_0x37e6('0x10'),_0x5ea219,_0x3cfebd);_0x10eb16(_0x3cfebd);});});} \ No newline at end of file +var _0x80ce=['ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','register','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x515990,_0x3689e3){var _0xe9c30a=function(_0x562c77){while(--_0x562c77){_0x515990['push'](_0x515990['shift']());}};_0xe9c30a(++_0x3689e3);}(_0x80ce,0xae));var _0xe80c=function(_0x210b03,_0xdea01){_0x210b03=_0x210b03-0x0;var _0x3739cc=_0x80ce[_0x210b03];return _0x3739cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe80c('0x0'));var rs=require(_0xe80c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe80c('0x2'))['db'];var utils=require(_0xe80c('0x3'));var logger=require(_0xe80c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe80c('0x5')][_0xe80c('0x6')]({'port':0x232a});config[_0xe80c('0x7')]=_[_0xe80c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe80c('0x9'))(new Redis(config[_0xe80c('0x7')]));require('./chatGroup.socket')[_0xe80c('0xa')](socket);function respondWithRpcPromise(_0x21f32c,_0x1338af,_0x3cfbeb){return new BPromise(function(_0x75b98f,_0x4881f9){return client['request'](_0x21f32c,_0x3cfbeb)['then'](function(_0xa08bf1){logger[_0xe80c('0xb')](_0xe80c('0xc'),_0x1338af,_0xe80c('0xd'));logger[_0xe80c('0xe')](_0xe80c('0xf'),_0x1338af,_0xe80c('0xd'),JSON[_0xe80c('0x10')](_0xa08bf1));if(_0xa08bf1[_0xe80c('0x11')]){if(_0xa08bf1[_0xe80c('0x11')][_0xe80c('0x12')]===0x1f4){logger[_0xe80c('0x11')](_0xe80c('0xc'),_0x1338af,_0xa08bf1['error'][_0xe80c('0x13')]);return _0x4881f9(_0xa08bf1['error'][_0xe80c('0x13')]);}logger[_0xe80c('0x11')](_0xe80c('0xc'),_0x1338af,_0xa08bf1['error'][_0xe80c('0x13')]);return _0x75b98f(_0xa08bf1[_0xe80c('0x11')]['message']);}else{logger[_0xe80c('0xb')](_0xe80c('0xc'),_0x1338af,'request\x20sent');_0x75b98f(_0xa08bf1[_0xe80c('0x14')][_0xe80c('0x13')]);}})['catch'](function(_0x4c431c){logger[_0xe80c('0x11')](_0xe80c('0xc'),_0x1338af,_0x4c431c);_0x4881f9(_0x4c431c);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 32808d5..b96ef28 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 _0x09b7=['emit','length','chatGroup:','./chatGroup.events','remove'];(function(_0x1ad418,_0x1a6ef4){var _0x557e31=function(_0xfd9e76){while(--_0xfd9e76){_0x1ad418['push'](_0x1ad418['shift']());}};_0x557e31(++_0x1a6ef4);}(_0x09b7,0x1c0));var _0x709b=function(_0x430ea6,_0x58db3b){_0x430ea6=_0x430ea6-0x0;var _0x8c837=_0x09b7[_0x430ea6];return _0x8c837;};'use strict';var ChatGroupEvents=require(_0x709b('0x0'));var events=['save',_0x709b('0x1'),'update'];function createListener(_0x16a449,_0x5d79a2){return function(_0x171edb){_0x5d79a2[_0x709b('0x2')](_0x16a449,_0x171edb);};}function removeListener(_0x3acde2,_0x3ac998){return function(){ChatGroupEvents['removeListener'](_0x3acde2,_0x3ac998);};}exports['register']=function(_0x13812c){for(var _0x4dc2d2=0x0,_0x245701=events[_0x709b('0x3')];_0x4dc2d2<_0x245701;_0x4dc2d2++){var _0x21f28d=events[_0x4dc2d2];var _0x4dfe48=createListener(_0x709b('0x4')+_0x21f28d,_0x13812c);ChatGroupEvents['on'](_0x21f28d,_0x4dfe48);}}; \ No newline at end of file +var _0x0ec7=['update','removeListener','register','save','remove'];(function(_0x3df027,_0x2e843e){var _0x1c8408=function(_0x41f2d5){while(--_0x41f2d5){_0x3df027['push'](_0x3df027['shift']());}};_0x1c8408(++_0x2e843e);}(_0x0ec7,0x1ac));var _0x70ec=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0ec7[_0x6c993a];return _0x27f547;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x70ec('0x0'),_0x70ec('0x1'),_0x70ec('0x2')];function createListener(_0x59b55b,_0x3821cc){return function(_0x21107d){_0x3821cc['emit'](_0x59b55b,_0x21107d);};}function removeListener(_0x32b63a,_0x5a4d05){return function(){ChatGroupEvents[_0x70ec('0x3')](_0x32b63a,_0x5a4d05);};}exports[_0x70ec('0x4')]=function(_0x232e9e){for(var _0x536583=0x0,_0x27e362=events['length'];_0x536583<_0x27e362;_0x536583++){var _0x3fd2d5=events[_0x536583];var _0x2812d6=createListener('chatGroup:'+_0x3fd2d5,_0x232e9e);ChatGroupEvents['on'](_0x3fd2d5,_0x2812d6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fddcde9..e2154ca 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 _0x3270=['/:id','getUnread','/:id/members','getMembers','getMessages','create','post','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x628de9,_0x8d0187){var _0x412d0b=function(_0x2ed322){while(--_0x2ed322){_0x628de9['push'](_0x628de9['shift']());}};_0x412d0b(++_0x8d0187);}(_0x3270,0x1bf));var _0x0327=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x3270[_0x4c6d6f];return _0x2d4478;};'use strict';var multer=require('multer');var util=require(_0x0327('0x0'));var path=require(_0x0327('0x1'));var timeout=require(_0x0327('0x2'));var express=require(_0x0327('0x3'));var router=express[_0x0327('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0327('0x5'));var config=require(_0x0327('0x6'));var controller=require('./chatGroup.controller');router[_0x0327('0x7')]('/',auth[_0x0327('0x8')](),controller[_0x0327('0x9')]);router[_0x0327('0x7')](_0x0327('0xa'),auth['isAuthenticated'](),controller[_0x0327('0xb')]);router[_0x0327('0x7')](_0x0327('0xc'),auth[_0x0327('0x8')](),controller['show']);router[_0x0327('0x7')]('/:id/unread',auth[_0x0327('0x8')](),controller[_0x0327('0xd')]);router[_0x0327('0x7')](_0x0327('0xe'),auth['isAuthenticated'](),controller[_0x0327('0xf')]);router[_0x0327('0x7')]('/:id/messages',auth[_0x0327('0x8')](),controller[_0x0327('0x10')]);router['post']('/',auth[_0x0327('0x8')](),controller[_0x0327('0x11')]);router[_0x0327('0x12')](_0x0327('0xe'),auth['isAuthenticated'](),controller[_0x0327('0x13')]);router['post']('/:id/messages',auth[_0x0327('0x8')](),controller[_0x0327('0x14')]);router[_0x0327('0x15')](_0x0327('0xc'),auth[_0x0327('0x8')](),controller[_0x0327('0x16')]);router[_0x0327('0x17')](_0x0327('0xc'),auth[_0x0327('0x8')](),controller[_0x0327('0x18')]);router[_0x0327('0x17')](_0x0327('0xe'),auth[_0x0327('0x8')](),controller[_0x0327('0x19')]);module[_0x0327('0x1a')]=router; \ No newline at end of file +var _0x03b1=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','/:id','update','delete','removeMembers'];(function(_0x4a65ed,_0x2ad9e0){var _0x143045=function(_0x2a0855){while(--_0x2a0855){_0x4a65ed['push'](_0x4a65ed['shift']());}};_0x143045(++_0x2ad9e0);}(_0x03b1,0x1c1));var _0x103b=function(_0x10bf85,_0x2d8208){_0x10bf85=_0x10bf85-0x0;var _0x2b896c=_0x03b1[_0x10bf85];return _0x2b896c;};'use strict';var multer=require('multer');var util=require(_0x103b('0x0'));var path=require(_0x103b('0x1'));var timeout=require(_0x103b('0x2'));var express=require(_0x103b('0x3'));var router=express[_0x103b('0x4')]();var fs_extra=require(_0x103b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x103b('0x6'));var config=require(_0x103b('0x7'));var controller=require(_0x103b('0x8'));router[_0x103b('0x9')]('/',auth['isAuthenticated'](),controller[_0x103b('0xa')]);router[_0x103b('0x9')](_0x103b('0xb'),auth[_0x103b('0xc')](),controller['describe']);router[_0x103b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x103b('0xd')]);router[_0x103b('0x9')]('/:id/unread',auth[_0x103b('0xc')](),controller[_0x103b('0xe')]);router['get'](_0x103b('0xf'),auth[_0x103b('0xc')](),controller[_0x103b('0x10')]);router[_0x103b('0x9')](_0x103b('0x11'),auth[_0x103b('0xc')](),controller[_0x103b('0x12')]);router[_0x103b('0x13')]('/',auth[_0x103b('0xc')](),controller[_0x103b('0x14')]);router['post']('/:id/members',auth[_0x103b('0xc')](),controller[_0x103b('0x15')]);router['post'](_0x103b('0x11'),auth[_0x103b('0xc')](),controller[_0x103b('0x16')]);router['put'](_0x103b('0x17'),auth[_0x103b('0xc')](),controller[_0x103b('0x18')]);router[_0x103b('0x19')](_0x103b('0x17'),auth[_0x103b('0xc')](),controller['destroy']);router['delete'](_0x103b('0xf'),auth[_0x103b('0xc')](),controller[_0x103b('0x1a')]);module[_0x103b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 16b1ca5..fe4f673 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 _0x2547=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','exports'];(function(_0x20a635,_0x2ac662){var _0x4582dd=function(_0xef0daa){while(--_0xef0daa){_0x20a635['push'](_0x20a635['shift']());}};_0x4582dd(++_0x2ac662);}(_0x2547,0x1cd));var _0x7254=function(_0x462df0,_0x4f1f46){_0x462df0=_0x462df0-0x0;var _0x640c67=_0x2547[_0x462df0];return _0x640c67;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'closed':{'type':Sequelize[_0x7254('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7254('0x2')]},'ratingType':{'type':Sequelize[_0x7254('0x3')](_0x7254('0x4'),_0x7254('0x5')),'defaultValue':_0x7254('0x4')},'ratingMessage':{'type':Sequelize[_0x7254('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x7254('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7254('0x8')]},'disposition':{'type':Sequelize[_0x7254('0x7')]},'secondDisposition':{'type':Sequelize[_0x7254('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7254('0x7')]},'browserName':{'type':Sequelize[_0x7254('0x7')]},'browserVersion':{'type':Sequelize[_0x7254('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7254('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x7254('0x6')]},'customerIp':{'type':Sequelize[_0x7254('0x7')]},'formData':{'type':Sequelize[_0x7254('0x6')](_0x7254('0x9'))},'read1stAt':{'type':Sequelize[_0x7254('0x8')]},'lastMsgAt':{'type':Sequelize[_0x7254('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7254('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x7254('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x7254('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xa902=['BOOLEAN','INTEGER','ENUM','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x512802,_0xa7d236){var _0x44b7fc=function(_0xd916c){while(--_0xd916c){_0x512802['push'](_0x512802['shift']());}};_0x44b7fc(++_0xa7d236);}(_0xa902,0x8d));var _0x2a90=function(_0x5bf5ce,_0x4649a6){_0x5bf5ce=_0x5bf5ce-0x0;var _0x286159=_0xa902[_0x5bf5ce];return _0x286159;};'use strict';var Sequelize=require(_0x2a90('0x0'));module[_0x2a90('0x1')]={'closed':{'type':Sequelize[_0x2a90('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2a90('0x3')]},'ratingType':{'type':Sequelize[_0x2a90('0x4')]('star',_0x2a90('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x2a90('0x6')]},'mailTranscript':{'type':Sequelize[_0x2a90('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2a90('0x8')]},'disposition':{'type':Sequelize[_0x2a90('0x7')]},'secondDisposition':{'type':Sequelize[_0x2a90('0x7')]},'thirdDisposition':{'type':Sequelize[_0x2a90('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x2a90('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2a90('0x7')]},'deviceModel':{'type':Sequelize[_0x2a90('0x7')]},'deviceVendor':{'type':Sequelize[_0x2a90('0x7')]},'deviceType':{'type':Sequelize[_0x2a90('0x7')]},'referer':{'type':Sequelize[_0x2a90('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2a90('0x6')](_0x2a90('0x9'))},'read1stAt':{'type':Sequelize[_0x2a90('0x8')]},'lastMsgAt':{'type':Sequelize[_0x2a90('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2a90('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x2a90('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x2a90('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 f2fb0e9..91fc968 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 _0xf109=['nolimit','order','sort','pick','select','field','color','from','u.fullname','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','left_join','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','start','some','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','rawAttributes','includeAll','include','options','params','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','POST','email','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','file','basename','filename','mimetype','Attachment','create','attachmentDownload','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','User','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','alias','direction','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','sendMail','Mail\x20Transcript','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','setTags','spread','emit','removeTags','unix','server','tmp','attachments','transcript-%d-%s.zip','firstName','secret','ChatWebsite','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createWriteStream','lastName','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','http','client','then','request\x20sent','debug','error','ChatInteraction,\x20%s,\x20%s','message','info','result','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','update','destroy','stack','name','send','render','merge','body','contact','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','total','UserId','closed','disposition','unmanaged','answered','index','ChatInteraction','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x21b8f2,_0x485cb8){var _0x1d000c=function(_0x597ec1){while(--_0x597ec1){_0x21b8f2['push'](_0x21b8f2['shift']());}};_0x1d000c(++_0x485cb8);}(_0xf109,0xce));var _0x9f10=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xf109[_0x32f7d7];return _0x133d09;};'use strict';var rimraf=require(_0x9f10('0x0'));var zipdir=require(_0x9f10('0x1'));var rp=require(_0x9f10('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9f10('0x3'));var path=require(_0x9f10('0x4'));var ejs=require(_0x9f10('0x5'));var fs=require('fs');var _=require(_0x9f10('0x6'));var squel=require(_0x9f10('0x7'));var Redis=require(_0x9f10('0x8'));var qs=require(_0x9f10('0x9'));var as=require(_0x9f10('0xa'));var pdf=require(_0x9f10('0xb'));var logger=require(_0x9f10('0xc'))(_0x9f10('0xd'));var config=require('../../config/environment');var db=require(_0x9f10('0xe'))['db'];config[_0x9f10('0xf')]=_[_0x9f10('0x10')](config[_0x9f10('0xf')],{'host':_0x9f10('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f10('0xf')]));require(_0x9f10('0x12'))[_0x9f10('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9f10('0x14')]({'port':0x232b});var client9004=jayson[_0x9f10('0x15')][_0x9f10('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x56780e,_0x289164,_0x260606,_0x35c529){return new BPromise(function(_0x58067f,_0x9a3ae6){var _0x309f27=_0x35c529||client;return _0x309f27['request'](_0x56780e,_0x260606)[_0x9f10('0x16')](function(_0x236e28){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x289164,_0x9f10('0x17'));logger[_0x9f10('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x289164,_0x9f10('0x17'),JSON['stringify'](_0x236e28));if(_0x236e28[_0x9f10('0x19')]){if(_0x236e28[_0x9f10('0x19')]['code']===0x1f4){logger[_0x9f10('0x19')](_0x9f10('0x1a'),_0x289164,_0x236e28['error'][_0x9f10('0x1b')]);return _0x9a3ae6(_0x236e28['error'][_0x9f10('0x1b')]);}logger['error'](_0x9f10('0x1a'),_0x289164,_0x236e28['error']['message']);return _0x58067f(_0x236e28[_0x9f10('0x19')][_0x9f10('0x1b')]);}else{logger[_0x9f10('0x1c')](_0x9f10('0x1a'),_0x289164,_0x9f10('0x17'));_0x58067f(_0x236e28[_0x9f10('0x1d')][_0x9f10('0x1b')]);}})['catch'](function(_0x366044){logger['error'](_0x9f10('0x1a'),_0x289164,_0x366044);_0x9a3ae6(_0x366044);});});}function respondWithStatusCode(_0x36ace4,_0x3d25cb){_0x3d25cb=_0x3d25cb||0xcc;return function(_0x4adbda){if(_0x4adbda){return _0x36ace4[_0x9f10('0x1e')](_0x3d25cb);}return _0x36ace4[_0x9f10('0x1f')](_0x3d25cb)[_0x9f10('0x20')]();};}function respondWithResult(_0x4d21c5,_0x36821e){_0x36821e=_0x36821e||0xc8;return function(_0x37e9ac){if(_0x37e9ac){return _0x4d21c5[_0x9f10('0x1f')](_0x36821e)['json'](_0x37e9ac);}};}function respondWithFilteredResult(_0x2ec07d,_0x23c2e7){return function(_0x11cae7){if(_0x11cae7){var _0x1647c0=typeof _0x23c2e7['offset']==='undefined'&&typeof _0x23c2e7['limit']===_0x9f10('0x21');var _0x4a0407=_0x11cae7[_0x9f10('0x22')];var _0x1de75a=_0x1647c0?0x0:_0x23c2e7[_0x9f10('0x23')];var _0x2ed95b=_0x1647c0?_0x11cae7[_0x9f10('0x22')]:_0x23c2e7['offset']+_0x23c2e7[_0x9f10('0x24')];var _0x22814f;if(_0x2ed95b>=_0x4a0407){_0x2ed95b=_0x4a0407;_0x22814f=0xc8;}else{_0x22814f=0xce;}_0x2ec07d[_0x9f10('0x1f')](_0x22814f);return _0x2ec07d[_0x9f10('0x25')](_0x9f10('0x26'),_0x1de75a+'-'+_0x2ed95b+'/'+_0x4a0407)[_0x9f10('0x27')](_0x11cae7);}return null;};}function saveUpdates(_0x581b1d){return function(_0x358d3f){if(_0x358d3f){return _0x358d3f[_0x9f10('0x28')](_0x581b1d)[_0x9f10('0x16')](function(_0x1b03ee){return _0x1b03ee;});}return null;};}function removeEntity(_0x49b3f4){return function(_0x44f0a0){if(_0x44f0a0){return _0x44f0a0[_0x9f10('0x29')]()[_0x9f10('0x16')](function(){_0x49b3f4['status'](0xcc)[_0x9f10('0x20')]();});}};}function handleEntityNotFound(_0x5af399){return function(_0x1069ba){if(!_0x1069ba){_0x5af399[_0x9f10('0x1e')](0x194);}return _0x1069ba;};}function handleError(_0x13532b,_0x5944e5){_0x5944e5=_0x5944e5||0x1f4;return function(_0x3ac139){logger[_0x9f10('0x19')](_0x3ac139[_0x9f10('0x2a')]);if(_0x3ac139[_0x9f10('0x2b')]){delete _0x3ac139[_0x9f10('0x2b')];}_0x13532b['status'](_0x5944e5)[_0x9f10('0x2c')](_0x3ac139);};}function getMustacheRender(_0x4b54b7,_0x24d21d){return Mustache[_0x9f10('0x2d')](_0x4b54b7,_[_0x9f10('0x2e')](_0x24d21d[_0x9f10('0x2f')],{'contact':_0x24d21d[_0x9f10('0x30')],'message':_0x24d21d[_0x9f10('0x1b')],'agent':_0x24d21d['agent'],'interaction':_0x24d21d[_0x9f10('0x31')],'account':_0x24d21d[_0x9f10('0x32')]}))||'';}function getInteractionUsers(_0x1b8018,_0x5e63b1){return new BPromise(function(_0x2310d0,_0x1f01a7){try{if(_0x5e63b1[_0x1b8018['id']]){_0x1b8018['Users']=_[_0x9f10('0x33')](_0x5e63b1[_0x1b8018['id']],function(_0x5671fe){return{'id':_0x5671fe['id'],'fullname':_0x5671fe[_0x9f10('0x34')]};});}}catch(_0x1b7a66){_0x1f01a7(_0x1b7a66);}_0x2310d0(_0x1b8018);});}function getInteractionTags(_0x26df66,_0xc17ea2){return new BPromise(function(_0x20605a,_0x1ba4be){try{if(_0x26df66[_0x9f10('0x35')]){_0x26df66[_0x9f10('0x36')]=[];_0x26df66['TagIds'][_0x9f10('0x37')](',')[_0x9f10('0x38')](function(_0x2fa4bf){_0x26df66['Tags'][_0x9f10('0x39')](_0xc17ea2[_0x2fa4bf]);});}delete _0x26df66[_0x9f10('0x35')];}catch(_0x52914c){_0x1ba4be(_0x52914c);}_0x20605a(_0x26df66);});}function updateChatInteraction(_0x30b04b,_0x26f0ba,_0x433c7a){return new BPromise(function(_0x5a1b2b,_0x5c516c){return getInteractionUsers(_0x30b04b,_0x433c7a)[_0x9f10('0x16')](function(_0x2ff98d){return getInteractionTags(_0x2ff98d,_0x26f0ba);})[_0x9f10('0x16')](function(_0x433e70){return getStateInteraction(_0x433e70);})[_0x9f10('0x16')](function(_0x227425){_0x5a1b2b(_0x227425);})[_0x9f10('0x3a')](function(_0x34869c){_0x5c516c(_0x34869c);});});}function getStateInteraction(_0x7fe320){return new BPromise(function(_0x149f8f){_0x7fe320[_0x9f10('0x3b')]=0x0;_0x7fe320[_0x9f10('0x3c')]=0x0;_0x7fe320['answered']=0x0;_0x7fe320['unmanaged']=0x0;_0x7fe320['abandoned']=0x0;_0x7fe320[_0x9f10('0x3d')]=0x0;if(!_0x7fe320['closed']&&!_0x7fe320[_0x9f10('0x3e')]){_0x7fe320[_0x9f10('0x3b')]+=0x1;}if(!_0x7fe320[_0x9f10('0x3f')]&&_0x7fe320['UserId']){_0x7fe320[_0x9f10('0x3c')]+=0x1;if(_0x7fe320[_0x9f10('0x3b')]){_0x7fe320[_0x9f10('0x3b')]-=0x1;}}if(_0x7fe320[_0x9f10('0x3f')]&&_0x7fe320[_0x9f10('0x40')]==='abandoned'){_0x7fe320['abandoned']+=0x1;if(_0x7fe320['waiting']){_0x7fe320[_0x9f10('0x3b')]-=0x1;}}else if(_0x7fe320['closed']&&!_0x7fe320[_0x9f10('0x3e')]&&_0x7fe320['disposition']){_0x7fe320[_0x9f10('0x41')]+=0x1;if(_0x7fe320[_0x9f10('0x3b')]){_0x7fe320[_0x9f10('0x3b')]-=0x1;}}else if(_0x7fe320[_0x9f10('0x3f')]&&_0x7fe320['UserId']){_0x7fe320[_0x9f10('0x42')]+=0x1;if(_0x7fe320[_0x9f10('0x3c')]){_0x7fe320['talking']-=0x1;}}_0x7fe320[_0x9f10('0x3d')]+=0x1;_0x149f8f(_0x7fe320);});}exports[_0x9f10('0x43')]=function(_0x3c64a9,_0x1bd37c){var _0x1b3529={},_0x3b3002={},_0x4bedbe={'count':0x0,'rows':[]};var _0x281da4=_[_0x9f10('0x33')](db[_0x9f10('0x44')]['rawAttributes'],function(_0x181eab){return{'name':_0x181eab[_0x9f10('0x45')],'type':_0x181eab['type'][_0x9f10('0x46')]};});_0x3b3002[_0x9f10('0x47')]=_[_0x9f10('0x33')](_0x281da4,_0x9f10('0x2b'));_0x3b3002['query']=_[_0x9f10('0x48')](_0x3c64a9[_0x9f10('0x49')]);_0x3b3002[_0x9f10('0x4a')]=_[_0x9f10('0x4b')](_0x3b3002[_0x9f10('0x47')],_0x3b3002[_0x9f10('0x49')]);_0x1b3529['attributes']=_[_0x9f10('0x4b')](_0x3b3002[_0x9f10('0x47')],qs[_0x9f10('0x4c')](_0x3c64a9[_0x9f10('0x49')][_0x9f10('0x4c')]));_0x1b3529[_0x9f10('0x4d')]=_0x1b3529['attributes'][_0x9f10('0x4e')]?_0x1b3529[_0x9f10('0x4d')]:_0x3b3002[_0x9f10('0x47')];if(!_0x3c64a9[_0x9f10('0x49')][_0x9f10('0x4f')](_0x9f10('0x50'))){_0x1b3529[_0x9f10('0x24')]=qs[_0x9f10('0x24')](_0x3c64a9['query'][_0x9f10('0x24')]);_0x1b3529['offset']=qs[_0x9f10('0x23')](_0x3c64a9['query'][_0x9f10('0x23')]);}_0x1b3529[_0x9f10('0x51')]=qs[_0x9f10('0x52')](_0x3c64a9[_0x9f10('0x49')][_0x9f10('0x52')]);_0x1b3529['where']=qs[_0x9f10('0x4a')](_[_0x9f10('0x53')](_0x3c64a9[_0x9f10('0x49')],_0x3b3002[_0x9f10('0x4a')]),_0x281da4);var _0x500e51=[];var _0x53ec45=squel[_0x9f10('0x54')]()[_0x9f10('0x55')]('id')['field']('name')[_0x9f10('0x55')](_0x9f10('0x56'))[_0x9f10('0x57')]('tools_tags');var _0x3d7b33=squel[_0x9f10('0x54')]()[_0x9f10('0x55')]('u.id')[_0x9f10('0x55')](_0x9f10('0x58'))[_0x9f10('0x55')]('ui.ChatInteractionId')[_0x9f10('0x57')](_0x9f10('0x59'),'ui')['left_join'](_0x9f10('0x5a'),'u',_0x9f10('0x5b'));var _0xcd8ae7=squel[_0x9f10('0x54')]()[_0x9f10('0x57')]('chat_interactions','i')[_0x9f10('0x5c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9f10('0x5c')](_0x9f10('0x5a'),'o',_0x9f10('0x5d'))[_0x9f10('0x5c')](_0x9f10('0x5e'),'a',_0x9f10('0x5f'))[_0x9f10('0x5c')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x9f10('0x5c')](_0x9f10('0x60'),'it',_0x9f10('0x61'))[_0x9f10('0x5c')](_0x9f10('0x62'),'t',_0x9f10('0x63'));var _0x35460a=squel['expr']();var _0x29bc1d=[];var _0x3ca18c=squel['expr']();var _0x29589e;if(_0x3c64a9[_0x9f10('0x49')]['search']){_0x29589e=as[_0x9f10('0x64')](_0x3c64a9[_0x9f10('0x49')]['search']);var _0x45ab35=_0x29589e['sqlOperator'];for(var _0xa93328=0x0;_0xa93328<_0x29589e[_0x9f10('0x65')][_0x9f10('0x4e')];_0xa93328++){var _0x208d48=_0x29589e[_0x9f10('0x65')][_0xa93328];var _0x4bf4d6='i';var _0x4c5fbf=_[_0x9f10('0x66')](_0x281da4,[_0x9f10('0x2b'),_0x208d48['field']]);if(!_0x4c5fbf){switch(_0x208d48['field']){case _0x9f10('0x67'):if(_0x208d48[_0x9f10('0x68')]==0x1){_0xcd8ae7[_0x9f10('0x69')]('`'+_0x208d48[_0x9f10('0x55')]+_0x9f10('0x6a'));}else{_0xcd8ae7[_0x9f10('0x69')]('`'+_0x208d48[_0x9f10('0x55')]+'`\x20>\x200');}break;case _0x9f10('0x6b'):if(_0x208d48[_0x9f10('0x6c')]==='$substring'){if(_0x208d48[_0x9f10('0x68')]['split']('\x20')[_0x9f10('0x4e')]>0x1){_0x35460a[_0x45ab35](_0x9f10('0x6d'),qs['getFullTextValue'](_0x208d48[_0x9f10('0x68')]),null);}else{var _0x4cbe80='%'+_0x208d48[_0x9f10('0x68')]+'%';_0x35460a[_0x45ab35](_0x9f10('0x6e'),_0x4cbe80,_0x4cbe80,_0x4cbe80);}}else{_0x4c5fbf=_[_0x9f10('0x66')](_0x281da4,['name',_0x9f10('0x6f')]);_0x208d48['field']=_0x9f10('0x6f');_0x16b217=as[_0x9f10('0x70')](_0x4bf4d6,_0x4c5fbf[_0x9f10('0x71')],_0x208d48);_0x35460a[_0x45ab35](_0x16b217['text'],_0x16b217[_0x9f10('0x68')]['start'],_0x16b217['value'][_0x9f10('0x20')]);}break;case _0x9f10('0x72'):var _0x6b3eb6=_0x208d48['value'][_0x9f10('0x37')](',')['map'](function(_0x48ce93){return Number(_0x48ce93);});_0x6b3eb6[_0x9f10('0x38')](function(_0x551a5d){_0x3ca18c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x551a5d+',%');});_0x29bc1d=_[_0x9f10('0x73')](_0x29bc1d,_0x6b3eb6);break;case'User':if(_0x208d48[_0x9f10('0x6c')]===_0x9f10('0x74')){_0x35460a[_0x45ab35](_0x9f10('0x75'),'%'+_0x208d48['value']+'%',null);}else{_0x4c5fbf=_[_0x9f10('0x66')](_0x281da4,[_0x9f10('0x2b'),'UserId']);_0x208d48[_0x9f10('0x55')]='UserId';_0x16b217=as['buildExpression'](_0x4bf4d6,_0x4c5fbf[_0x9f10('0x71')],_0x208d48);_0x35460a[_0x45ab35](_0x16b217[_0x9f10('0x76')],_0x16b217[_0x9f10('0x68')][_0x9f10('0x77')],_0x16b217[_0x9f10('0x68')][_0x9f10('0x20')]);}break;case _0x9f10('0x2f'):_0x16b217=as['buildExpression']('me',null,_0x208d48);_0x35460a[_0x45ab35](_0x16b217[_0x9f10('0x76')],_0x16b217[_0x9f10('0x68')][_0x9f10('0x77')],_0x16b217[_0x9f10('0x68')][_0x9f10('0x20')]);break;}}else{var _0x16b217=as[_0x9f10('0x70')](_0x4bf4d6,_0x4c5fbf[_0x9f10('0x71')],_0x208d48);_0x35460a[_0x45ab35](_0x16b217[_0x9f10('0x76')],_0x16b217['value'][_0x9f10('0x77')],_0x16b217[_0x9f10('0x68')][_0x9f10('0x20')]);}}}else{var _0x1c3b52=_(_0x3c64a9['query'])[_0x9f10('0x48')]()[_0x9f10('0x33')](function(_0x13d232){return _[_0x9f10('0x78')](_0x281da4,['name',_0x13d232])?_0x13d232:undefined;})['compact']()[_0x9f10('0x68')]();if(!_[_0x9f10('0x79')](_0x1c3b52)){_0x1c3b52[_0x9f10('0x38')](function(_0x2a656f){if(_0x2a656f===_0x9f10('0x7a')){_0xcd8ae7[_0x9f10('0x7b')](_0x9f10('0x7c'),[][_0x9f10('0x7d')](_0x3c64a9[_0x9f10('0x49')][_0x2a656f]));}else if(_0x2a656f===_0x9f10('0x7e')){var _0x108e98=JSON[_0x9f10('0x7f')](_0x3c64a9[_0x9f10('0x49')][_0x2a656f])[_0x9f10('0x80')];var _0x3903c5=JSON['parse'](_0x3c64a9[_0x9f10('0x49')][_0x2a656f])[_0x9f10('0x81')];_0xcd8ae7['where'](_0x9f10('0x82'),_0x108e98,_0x3903c5);}else{if(_0x3c64a9[_0x9f10('0x49')][_0x2a656f]===_0x9f10('0x83')){_0xcd8ae7[_0x9f10('0x7b')]('i.'+_0x2a656f+'\x20IS\x20NULL');}else{_0xcd8ae7[_0x9f10('0x7b')]('i.'+_0x2a656f+'\x20=\x20?',_0x3c64a9[_0x9f10('0x49')][_0x2a656f]);}}});}if(_0x3c64a9[_0x9f10('0x49')][_0x9f10('0x84')]){if(_0x3c64a9['query'][_0x9f10('0x84')]==0x1){_0xcd8ae7[_0x9f10('0x69')](_0x9f10('0x85'));}else{_0xcd8ae7['having'](_0x9f10('0x86'));}}if(_0x3c64a9[_0x9f10('0x49')][_0x9f10('0x87')]){_0x29bc1d=_['isArray'](_0x3c64a9['query']['tag'])?_0x3c64a9['query']['tag']:new Array(_0x3c64a9['query']['tag']);_0x29bc1d[_0x9f10('0x38')](function(_0x2571a6){_0x3ca18c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2571a6+',%');});}if(_0x3c64a9[_0x9f10('0x49')][_0x9f10('0x88')]){var _0x454506=_0x3c64a9[_0x9f10('0x49')][_0x9f10('0x88')][_0x9f10('0x89')]('\x5c','\x5c\x5c')[_0x9f10('0x89')](/'/g,'\x27\x27');if(qs[_0x9f10('0x8a')](_0x454506)){_0x35460a['or'](_0x9f10('0x8b'),_0x454506+'%');}else{_0x35460a['or'](_0x9f10('0x8c'),qs['getFullTextValue'](_0x454506))['or'](_0x9f10('0x8d'),_0x454506+'%');}}}_0xcd8ae7[_0x9f10('0x7b')](_0x35460a);_0xcd8ae7['group'](_0x9f10('0x8e'));var _0x5b2f86={'type':db['Sequelize'][_0x9f10('0x8f')][_0x9f10('0x90')],'raw':!![]};var _0x5ae22e=_0xcd8ae7[_0x9f10('0x91')]();_0x5ae22e[_0x9f10('0x55')]('i.id');_0x5ae22e[_0x9f10('0x55')](_0x9f10('0x92'),_0x9f10('0x67'));if(_0x1b3529['order']){_0x1b3529[_0x9f10('0x51')][_0x9f10('0x38')](function(_0x5c9d68){var _0x48c017=_0x5c9d68[0x0]===_0x9f10('0x93')?_0x5c9d68[0x0]:'i.'+_0x5c9d68[0x0];_0xcd8ae7[_0x9f10('0x51')](_0x48c017,_0x5c9d68[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9f10('0x79')](_0x29bc1d)){_0xcd8ae7[_0x9f10('0x69')](_0x3ca18c);_0x5ae22e['where']('t.id\x20IN\x20?',_0x29bc1d);}BPromise[_0x9f10('0x94')]()[_0x9f10('0x16')](function(){if(!_0x29589e){if(_0x3c64a9['query']['ChatWebsiteId'])return;_0x5ae22e[_0x9f10('0x7b')](_0x9f10('0x95'));_0xcd8ae7['where'](_0x9f10('0x95'));return;}if(_0x3c64a9[_0x9f10('0x96')][_0x9f10('0x97')]!==_0x9f10('0x98'))return;return _0x3c64a9[_0x9f10('0x96')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x5a51c7){if(_[_0x9f10('0x79')](_0x5a51c7)){_0x5ae22e[_0x9f10('0x7b')](_0x9f10('0x99'));_0xcd8ae7['where'](_0x9f10('0x99'));}else{_0x5ae22e['where'](_0x9f10('0x7c'),_['map'](_0x5a51c7,'id'));_0xcd8ae7['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x9f10('0x33')](_0x5a51c7,'id'));}});})[_0x9f10('0x16')](function(){if(_0x3c64a9[_0x9f10('0x96')][_0x9f10('0x97')]===_0x9f10('0x98')&&!_0x29589e&&!_0x3c64a9[_0x9f10('0x49')][_0x9f10('0x7a')])return[];return db[_0x9f10('0x9a')]['query'](_0x5ae22e[_0x9f10('0x9b')](),_0x5b2f86);})[_0x9f10('0x16')](function(_0x426fa4){_0x4bedbe['count']=_0x426fa4[_0x9f10('0x4e')];if(_0x4bedbe[_0x9f10('0x22')]===0x0)return[];return db[_0x9f10('0x9a')][_0x9f10('0x49')](_0x53ec45[_0x9f10('0x9b')](),_0x5b2f86)['then'](function(_0x14ea3c){_0x500e51=_['keyBy'](_0x14ea3c,'id');_0x5b2f86=_[_0x9f10('0x2e')](_0x5b2f86,{'model':db[_0x9f10('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c64a9['query'][_0x9f10('0x4c')]){_0x1b3529[_0x9f10('0x4d')][_0x9f10('0x38')](function(_0x3bc386){_0xcd8ae7['field']('i.'+_0x3bc386);});}else{_0xcd8ae7[_0x9f10('0x55')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9f10('0x67'));_0xcd8ae7[_0x9f10('0x55')]('a.key','Account.key');_0xcd8ae7[_0x9f10('0x55')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0xcd8ae7['field'](_0x9f10('0x9c'),_0x9f10('0x93'));_0xcd8ae7['field'](_0x9f10('0x9d'));_0xcd8ae7[_0x9f10('0x55')](_0x9f10('0x9e'),_0x9f10('0x9f'));_0xcd8ae7[_0x9f10('0x55')](_0x9f10('0xa0'),_0x9f10('0xa1'));_0xcd8ae7[_0x9f10('0x55')](_0x9f10('0xa2'),_0x9f10('0xa3'));_0xcd8ae7['field']('c.phone','Contact.phone');_0xcd8ae7['field'](_0x9f10('0xa4'),_0x9f10('0xa5'));_0xcd8ae7[_0x9f10('0x55')](_0x9f10('0xa6'),_0x9f10('0xa7'));_0xcd8ae7['field'](_0x9f10('0xa8'),_0x9f10('0xa9'));_0xcd8ae7['field'](_0x9f10('0xaa'),_0x9f10('0xab'));_0xcd8ae7[_0x9f10('0x55')](_0x9f10('0xac'),_0x9f10('0x35'));}if(_0x1b3529[_0x9f10('0x24')])_0xcd8ae7[_0x9f10('0x24')](_0x1b3529[_0x9f10('0x24')]);if(_0x1b3529[_0x9f10('0x23')])_0xcd8ae7['offset'](_0x1b3529['offset']);return db[_0x9f10('0x9a')][_0x9f10('0x49')](_0xcd8ae7[_0x9f10('0x9b')](),_0x5b2f86);})[_0x9f10('0x16')](function(_0x537de0){if(_0x537de0[_0x9f10('0x4e')]>0x0)_0x3d7b33[_0x9f10('0x7b')](_0x9f10('0xad'),_[_0x9f10('0x33')](_0x537de0,'id'));return db[_0x9f10('0x9a')][_0x9f10('0x49')](_0x3d7b33['toString'](),_0x5b2f86)['then'](function(_0x5044bc){var _0x44bbd5=_[_0x9f10('0xae')](_0x5044bc,_0x9f10('0xaf'));var _0x37a44d=[];_0x537de0[_0x9f10('0x38')](function(_0x164264){_0x37a44d[_0x9f10('0x39')](updateChatInteraction(_0x164264,_0x500e51,_0x44bbd5));});return BPromise[_0x9f10('0xb0')](_0x37a44d);});});})[_0x9f10('0x16')](function(_0x527cb4){_0x4bedbe[_0x9f10('0xb1')]=_0x527cb4;return _0x4bedbe;})[_0x9f10('0x16')](respondWithFilteredResult(_0x1bd37c,_0x1b3529))[_0x9f10('0x3a')](handleError(_0x1bd37c,null));};exports['show']=function(_0x12372d,_0x53dfa3){var _0xf95893={'raw':![],'where':{'id':_0x12372d['params']['id']}},_0x257daa={};_0x257daa[_0x9f10('0x47')]=_[_0x9f10('0x48')](db[_0x9f10('0x44')][_0x9f10('0xb2')]);_0x257daa[_0x9f10('0x49')]=_['keys'](_0x12372d[_0x9f10('0x49')]);_0x257daa['filters']=_[_0x9f10('0x4b')](_0x257daa['model'],_0x257daa['query']);_0xf95893[_0x9f10('0x4d')]=_[_0x9f10('0x4b')](_0x257daa[_0x9f10('0x47')],qs[_0x9f10('0x4c')](_0x12372d[_0x9f10('0x49')][_0x9f10('0x4c')]));_0xf95893['attributes']=_0xf95893[_0x9f10('0x4d')][_0x9f10('0x4e')]?_0xf95893[_0x9f10('0x4d')]:_0x257daa[_0x9f10('0x47')];if(_0x12372d[_0x9f10('0x49')][_0x9f10('0xb3')]){_0xf95893[_0x9f10('0xb4')]=[{'all':!![]}];}_0xf95893=_[_0x9f10('0x2e')]({},_0xf95893,_0x12372d[_0x9f10('0xb5')]);return db[_0x9f10('0x44')][_0x9f10('0x66')](_0xf95893)[_0x9f10('0x16')](handleEntityNotFound(_0x53dfa3,null))['then'](respondWithResult(_0x53dfa3,null))[_0x9f10('0x3a')](handleError(_0x53dfa3,null));};exports['create']=function(_0x38ddb1,_0x14d4cc){return db[_0x9f10('0x44')]['create'](_0x38ddb1[_0x9f10('0x2f')],{})[_0x9f10('0x16')](respondWithResult(_0x14d4cc,0xc9))[_0x9f10('0x3a')](handleError(_0x14d4cc,null));};exports[_0x9f10('0x28')]=function(_0x2f805f,_0x417b25){if(_0x2f805f['body']['id']){delete _0x2f805f[_0x9f10('0x2f')]['id'];}return db[_0x9f10('0x44')]['find']({'where':{'id':_0x2f805f[_0x9f10('0xb6')]['id']}})[_0x9f10('0x16')](handleEntityNotFound(_0x417b25,null))[_0x9f10('0x16')](saveUpdates(_0x2f805f[_0x9f10('0x2f')],null))['then'](respondWithResult(_0x417b25,null))['catch'](handleError(_0x417b25,null));};exports[_0x9f10('0x29')]=function(_0x5a4c18,_0xccb669){return db[_0x9f10('0x44')]['find']({'where':{'id':_0x5a4c18[_0x9f10('0xb6')]['id']}})[_0x9f10('0x16')](handleEntityNotFound(_0xccb669,null))[_0x9f10('0x16')](removeEntity(_0xccb669,null))[_0x9f10('0x3a')](handleError(_0xccb669,null));};exports['describe']=function(_0x3a894e,_0x2eeb02){return db['ChatInteraction'][_0x9f10('0xb7')]()['then'](respondWithResult(_0x2eeb02,null))['catch'](handleError(_0x2eeb02,null));};exports[_0x9f10('0xb8')]=function(_0x254354,_0x11e26f){var _0x49406f=_0x254354[_0x9f10('0xb6')]['id'];var _0x4e7496;var _0x3a1f83;var _0x5e4144;return db[_0x9f10('0x44')][_0x9f10('0xb9')]({'where':{'id':_0x49406f}})['then'](function(_0x3d5f3f){_0x4e7496=_0x3d5f3f;return db['ChatWebsite'][_0x9f10('0xb9')]({'where':{'id':_0x3d5f3f[_0x9f10('0x7a')]},'attributes':['id',_0x9f10('0xba'),_0x9f10('0xbb'),_0x9f10('0xbc'),_0x9f10('0xbd'),_0x9f10('0xbe')],'raw':!![]});})[_0x9f10('0x16')](function(_0x5ea087){if(_0x5ea087&&_0x5ea087[_0x9f10('0xba')]&&_0x5ea087[_0x9f10('0xbb')]){_0x3a1f83=_0x5ea087;var _0x35e05f={'interaction':{'id':_0x49406f},'agent':{'id':_0x254354[_0x9f10('0x96')]['id'],'name':_0x254354[_0x9f10('0x96')][_0x9f10('0x2b')],'fullname':_0x254354[_0x9f10('0x96')][_0x9f10('0x34')],'email':_0x254354[_0x9f10('0x96')]['email']},'contact':_0x254354['body']['contact'],'account':_0x254354[_0x9f10('0x2f')]['account']};var _0x3c412e={'rejectUnauthorized':![],'method':_0x9f10('0xbf'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x5ea087[_0x9f10('0xba')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x254354[_0x9f10('0x96')][_0x9f10('0xc0')]],'buttons':null,'topic':_0x3a1f83[_0x9f10('0xbc')],'note':_[_0x9f10('0xc1')](_0x3a1f83[_0x9f10('0xbd')])?null:getMustacheRender(_0x3a1f83[_0x9f10('0xbd')],_0x35e05f),'metadata':null},'redirect':_0x9f10('0xc2'),'json':!![]};try{if(!_[_0x9f10('0xc1')](_0x3a1f83[_0x9f10('0xbe')])){var _0x1bb7f5=getMustacheRender(_0x3a1f83['vidaooMetadata'],_0x35e05f);var _0x20c974=JSON[_0x9f10('0x7f')](_0x1bb7f5);_0x3c412e[_0x9f10('0x2f')][_0x9f10('0xc3')]=_0x20c974;}}catch(_0x494ca9){throw new db[(_0x9f10('0xc4'))][(_0x9f10('0xc5'))](_0x9f10('0xc6'));}return rp(_0x3c412e);}else{throw new db[(_0x9f10('0xc4'))][(_0x9f10('0xc5'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x9f10('0x16')](function(_0x36ec7d){_0x5e4144=_0x36ec7d;if(_0x5e4144['id']){var _0x119e9c={'body':_0x5e4144[_0x9f10('0xc7')],'ChatWebsiteId':_0x3a1f83['id'],'ChatInteractionId':_0x4e7496['id'],'direction':_0x9f10('0xc8'),'UserId':_0x254354[_0x9f10('0x96')]['id']};return db[_0x9f10('0xc9')]['create'](_0x119e9c,{});}else{throw new db[(_0x9f10('0xc4'))]['ValidationError'](_0x9f10('0xca'));}})[_0x9f10('0x16')](function(){return _0x4e7496[_0x9f10('0xcb')]({'vidaooSessionId':_0x5e4144['id']});})[_0x9f10('0x16')](respondWithResult(_0x11e26f,null))['catch'](handleError(_0x11e26f,null));};exports['customUpdate']=function(_0x1b71f3,_0x23d1a3){if(_0x1b71f3['body']['id']){delete _0x1b71f3[_0x9f10('0x2f')]['id'];}return db['ChatInteraction'][_0x9f10('0x66')]({'where':{'id':_0x1b71f3[_0x9f10('0xb6')]['id']},'include':[{'model':db[_0x9f10('0xcc')],'as':_0x9f10('0x6b')}]})[_0x9f10('0x16')](handleEntityNotFound(_0x23d1a3,null))[_0x9f10('0x16')](saveUpdates(_0x1b71f3[_0x9f10('0x2f')],null))[_0x9f10('0x16')](respondWithResult(_0x23d1a3,null))[_0x9f10('0x3a')](handleError(_0x23d1a3,null));};exports[_0x9f10('0xcd')]=function(_0x53998e,_0x5f531c){if(_0x53998e['body']['id']){delete _0x53998e[_0x9f10('0x2f')]['id'];}return db[_0x9f10('0x44')][_0x9f10('0x66')]({'where':{'id':_0x53998e['params']['id']}})[_0x9f10('0x16')](function(_0x1374b4){if(!_0x1374b4){logger['error'](_0x9f10('0xce'),_0x9f10('0xcd'),0x194,_0x9f10('0xcf'));_0x5f531c[_0x9f10('0x1e')](0x194);}else{if(_0x1374b4[_0x9f10('0x3e')]){throw new db[(_0x9f10('0xc4'))][(_0x9f10('0xc5'))](_0x9f10('0xd0'));}}return _0x1374b4;})[_0x9f10('0x16')](function(_0x579d2d){if(_0x579d2d){return _0x579d2d[_0x9f10('0x28')]({'closed':_0x53998e[_0x9f10('0x2f')][_0x9f10('0x3f')],'disposition':_0x53998e['body'][_0x9f10('0x40')]})[_0x9f10('0x16')](function(_0x430782){return _0x430782;});}})[_0x9f10('0x16')](function(){return respondWithRpcPromise(_0x9f10('0xd1'),_0x9f10('0xcd'),_0x53998e['body'],client9004);})[_0x9f10('0x16')](respondWithResult(_0x5f531c,null))[_0x9f10('0x3a')](handleError(_0x5f531c,null));};exports['attachmentUpload']=function(_0xf4fd93,_0x4fd3d4){_0xf4fd93[_0x9f10('0x2f')][_0x9f10('0x2b')]=_0xf4fd93[_0x9f10('0xd2')]['originalname'];_0xf4fd93['body'][_0x9f10('0xd3')]=_0xf4fd93[_0x9f10('0xd2')][_0x9f10('0xd4')];_0xf4fd93[_0x9f10('0x2f')][_0x9f10('0x71')]=_0xf4fd93[_0x9f10('0xd2')][_0x9f10('0xd5')];return db[_0x9f10('0xd6')][_0x9f10('0xd7')](_0xf4fd93['body'])[_0x9f10('0x16')](respondWithResult(_0x4fd3d4,0xc9))[_0x9f10('0x3a')](handleError(_0x4fd3d4,null));};exports[_0x9f10('0xd8')]=function(_0x3195cd,_0x3f06ac){return db[_0x9f10('0x44')][_0x9f10('0xb9')]({'where':{'id':_0x3195cd[_0x9f10('0xb6')]['id']},'raw':!![]})[_0x9f10('0x16')](handleEntityNotFound(_0x3f06ac,null))[_0x9f10('0x16')](function(_0x9a3870){if(_0x9a3870){if(_0x9a3870[_0x9f10('0x3f')]){return _0x3f06ac['status'](0x193)[_0x9f10('0x27')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x9f10('0xb9')]({'where':{'id':_0x3195cd[_0x9f10('0x49')][_0x9f10('0xd9')]},'raw':!![]})[_0x9f10('0x16')](handleEntityNotFound(_0x3f06ac,null));}})[_0x9f10('0x16')](function(_0x53dbab){if(_0x53dbab){var _0x481078=_0x53dbab[_0x9f10('0xda')]!==null;var _0x1a2a20=path[_0x9f10('0xdb')](config[_0x9f10('0xdc')],'server/files/attachments/');if(_0x481078){_0x1a2a20=path['join'](_0x1a2a20,_0x9f10('0xdd'));}var _0x293349=path[_0x9f10('0xdb')](_0x1a2a20,_0x53dbab[_0x9f10('0xd3')]);return _0x3f06ac[_0x9f10('0xde')](_0x293349);}})[_0x9f10('0x3a')](handleError(_0x3f06ac,null));};exports['close']=function(_0x364c46,_0x311ef6){var _0x364168=null;var _0x427d85=null;var _0x495833=null;if(_0x364c46[_0x9f10('0x2f')]['id']){delete _0x364c46[_0x9f10('0x2f')]['id'];}if(_0x364c46[_0x9f10('0x2f')][_0x9f10('0xdf')]){_0x495833=path[_0x9f10('0xdb')](config[_0x9f10('0xdc')],_0x9f10('0xe0'),util[_0x9f10('0xe1')]('transcript-%s.txt',Date[_0x9f10('0xe2')]()));_0x364c46[_0x9f10('0x2f')][_0x9f10('0xe3')]=_0x495833;}return db[_0x9f10('0x44')]['find']({'where':{'id':_0x364c46[_0x9f10('0xb6')]['id']},'include':[{'model':db[_0x9f10('0xc9')],'as':_0x9f10('0xe4'),'include':[{'model':db['User'],'as':_0x9f10('0xe5')}]}]})[_0x9f10('0x16')](handleEntityNotFound(_0x311ef6,null))[_0x9f10('0x16')](saveUpdates(_0x364c46['body'],null))[_0x9f10('0x16')](function(_0x267abb){if(_0x267abb){_0x364168=_0x267abb;return db['ChatWebsite']['find']({'where':{'id':_0x364168['ChatWebsiteId']}});}})[_0x9f10('0x16')](function(_0x36e6e4){if(_0x36e6e4){_0x427d85=_0x36e6e4;return db[_0x9f10('0xcc')][_0x9f10('0x66')]({'where':{'id':_0x364168[_0x9f10('0x6f')]}});}})['then'](function(_0x154548){if(_0x154548){if(_0x495833){var _0x54e40b=null;for(var _0xb28c2e=0x1;_0xb28c2e<_0x364168[_0x9f10('0xe4')]['length'];++_0xb28c2e){_0x54e40b=_0x364168[_0x9f10('0xe4')][_0xb28c2e];var _0xef1054=_0x54e40b[_0x9f10('0x3e')]?util[_0x9f10('0xe1')](_0x9f10('0xe6'),_0x427d85[_0x9f10('0xe7')],_0x54e40b['UserId']):_0x9f10('0xe8');var _0x427cef=_0x364c46[_0x9f10('0x2f')][_0x9f10('0xe9')]||util[_0x9f10('0xe1')](_0x9f10('0xe6'),_0x9f10('0xea'),_0x54e40b[_0x9f10('0x6f')]);switch(_0x427d85[_0x9f10('0xeb')]){case'website_alias':_0xef1054=_0x54e40b[_0x9f10('0x3e')]?util[_0x9f10('0xe1')]('%s%d',_0x427d85[_0x9f10('0xe7')],_0x54e40b[_0x9f10('0x3e')]):_0x9f10('0xe8');break;case'agent_alias':_0xef1054=_0x54e40b[_0x9f10('0x3e')]?_0x54e40b[_0x9f10('0xe5')][_0x9f10('0xec')]||_0x54e40b[_0x9f10('0xe5')]['fullname']:'System';break;case'agent_fullname':_0xef1054=_0x54e40b[_0x9f10('0x3e')]?_0x54e40b[_0x9f10('0xe5')]['fullname']:'System';break;default:_0xef1054=_0x54e40b[_0x9f10('0x3e')]?util['format']('%s%d',_0x427d85[_0x9f10('0xe7')],_0x54e40b[_0x9f10('0x3e')]):_0x9f10('0xe8');}var _0x1c0c1f=util[_0x9f10('0xe1')]('[%s]\x20%s:\x20%s\x0a',moment(_0x54e40b[_0x9f10('0x7e')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x54e40b[_0x9f10('0xed')]==='in'?_0x427cef:_0xef1054,_0x54e40b[_0x9f10('0x2f')]);if(!_0x54e40b['secret']){fs['appendFileSync'](_0x495833,_0x1c0c1f);}}return db[_0x9f10('0xee')][_0x9f10('0xb9')]({'where':{'service':!![]},'include':[{'model':db[_0x9f10('0xef')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x9f10('0xf0'),'raw':!![]}]}]});}}})[_0x9f10('0x16')](function(_0x3f13d7){if(!_0x3f13d7||!_0x3f13d7[_0x9f10('0xf1')]||!_0x364c46[_0x9f10('0x2f')])return _0x364168;var _0x4636fc=_0x3f13d7[_0x9f10('0xf2')]();return respondWithRpcPromise('SendMail',_0x9f10('0xf3'),{'account':_0x4636fc,'message':{'from':util[_0x9f10('0xe1')]('\x22%s\x22\x20<%s>',_0x3f13d7[_0x9f10('0x2b')],_0x3f13d7[_0x9f10('0xc0')]||_0x3f13d7['Smtp'][_0x9f10('0x96')]),'to':_0x364c46[_0x9f10('0x2f')][_0x9f10('0xdf')],'subject':_0x9f10('0xf4'),'text':util[_0x9f10('0xe1')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x364c46['body'][_0x9f10('0xdf')]),'attachments':[{'path':_0x495833}]}})[_0x9f10('0x16')](function(){return _0x364168;})[_0x9f10('0x3a')](function(_0x598774){logger['error'](_0x598774);});})[_0x9f10('0x16')](respondWithStatusCode(_0x311ef6,0xc8))[_0x9f10('0x3a')](handleError(_0x311ef6,null));};exports['addMessage']=function(_0x50507b,_0x580a4b){return db['ChatMessage'][_0x9f10('0x66')]({'where':{'id':_0x50507b[_0x9f10('0xb6')]['id']}})[_0x9f10('0x16')](handleEntityNotFound(_0x580a4b,null))[_0x9f10('0x16')](function(_0x34962c){if(_0x34962c){return _0x34962c[_0x9f10('0xf5')](_0x50507b['body'][_0x9f10('0xf6')],_[_0x9f10('0xf7')](_0x50507b[_0x9f10('0x2f')],[_0x9f10('0xf6'),'id'])||{});}})[_0x9f10('0x16')](respondWithResult(_0x580a4b,null))[_0x9f10('0x3a')](handleError(_0x580a4b,null));};exports[_0x9f10('0xf8')]=function(_0x49e4b7,_0x162f72){var _0xdae524={'raw':![],'where':{}};var _0x24b022={};var _0x3aab50={'count':0x0,'rows':[]};return db[_0x9f10('0x44')][_0x9f10('0xb9')]({'where':{'id':_0x49e4b7[_0x9f10('0xb6')]['id']}})[_0x9f10('0x16')](handleEntityNotFound(_0x162f72,null))[_0x9f10('0x16')](function(_0x483403){if(_0x483403){_0x24b022[_0x9f10('0x47')]=_[_0x9f10('0x48')](db[_0x9f10('0xc9')][_0x9f10('0xb2')]);_0x24b022['query']=_[_0x9f10('0x48')](_0x49e4b7[_0x9f10('0x49')]);_0x24b022[_0x9f10('0x4a')]=_['intersection'](_0x24b022[_0x9f10('0x47')],_0x24b022['query']);_0xdae524[_0x9f10('0x4d')]=_['intersection'](_0x24b022['model'],qs[_0x9f10('0x4c')](_0x49e4b7['query'][_0x9f10('0x4c')]));_0xdae524[_0x9f10('0x4d')]=_0xdae524[_0x9f10('0x4d')][_0x9f10('0x4e')]?_0xdae524['attributes']:_0x24b022[_0x9f10('0x47')];if(!_0x49e4b7[_0x9f10('0x49')][_0x9f10('0x4f')]('nolimit')){_0xdae524[_0x9f10('0x24')]=qs[_0x9f10('0x24')](_0x49e4b7[_0x9f10('0x49')][_0x9f10('0x24')]);_0xdae524[_0x9f10('0x23')]=qs[_0x9f10('0x23')](_0x49e4b7[_0x9f10('0x49')]['offset']);}_0xdae524['order']=qs['sort'](_0x49e4b7['query'][_0x9f10('0x52')]);_0xdae524[_0x9f10('0x7b')]=qs[_0x9f10('0x4a')](_[_0x9f10('0x53')](_0x49e4b7[_0x9f10('0x49')],_0x24b022[_0x9f10('0x4a')]));_0xdae524[_0x9f10('0x7b')][_0x9f10('0xaf')]=_0x483403['id'];if(_0x49e4b7[_0x9f10('0x49')][_0x9f10('0x88')]){_0xdae524[_0x9f10('0x7b')]=_[_0x9f10('0x2e')](_0xdae524[_0x9f10('0x7b')],{'$or':_[_0x9f10('0x33')](_0xdae524['attributes'],function(_0x153357){var _0x5a57e9={};_0x5a57e9[_0x153357]={'$like':'%'+_0x49e4b7[_0x9f10('0x49')][_0x9f10('0x88')]+'%'};return _0x5a57e9;})});}if(_0x49e4b7[_0x9f10('0x49')]['$gte']){var _0x52c3df=_0x49e4b7[_0x9f10('0x49')][_0x9f10('0x80')][_0x9f10('0x37')](',');var _0xd6a04a={};_0xd6a04a[_0x52c3df[0x0]]={'$gte':moment(_0x52c3df[0x1])[_0x9f10('0xe1')](_0x9f10('0xf9'))};_0xdae524[_0x9f10('0x7b')]=_[_0x9f10('0x2e')](_0xdae524[_0x9f10('0x7b')],_0xd6a04a);}_0xdae524=_[_0x9f10('0x2e')]({},_0xdae524,_0x49e4b7[_0x9f10('0xb5')]);return db[_0x9f10('0xc9')][_0x9f10('0x22')]({'where':_0xdae524[_0x9f10('0x7b')]})[_0x9f10('0x16')](function(_0x121d0d){_0x3aab50[_0x9f10('0x22')]=_0x121d0d;if(_0x49e4b7[_0x9f10('0x49')]['includeAll']){_0xdae524[_0x9f10('0xb4')]=[{'all':!![]}];}return db[_0x9f10('0xc9')][_0x9f10('0xfa')](_0xdae524);})['then'](function(_0x1f7081){_0x3aab50[_0x9f10('0xb1')]=_0x1f7081;return _0x3aab50;});}})[_0x9f10('0x16')](respondWithFilteredResult(_0x162f72,_0xdae524))['catch'](handleError(_0x162f72,null));};exports[_0x9f10('0xfb')]=function(_0xc11c03,_0x249595){var _0x2f54aa={'where':{}},_0x5566c4={},_0x2da6a8={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9f10('0xb9')]({'where':{'id':_0xc11c03[_0x9f10('0xb6')]['id']}})[_0x9f10('0x16')](handleEntityNotFound(_0x249595,null))[_0x9f10('0x16')](function(_0x575861){if(_0x575861){_0x5566c4[_0x9f10('0x47')]=_[_0x9f10('0x48')](db[_0x9f10('0xc9')][_0x9f10('0xb2')]);_0x5566c4[_0x9f10('0x49')]=_[_0x9f10('0x48')](_0xc11c03[_0x9f10('0x49')]);_0x5566c4[_0x9f10('0x4a')]=_[_0x9f10('0x4b')](_0x5566c4['model'],_0x5566c4['query']);_0x2f54aa[_0x9f10('0x4d')]=_[_0x9f10('0x4b')](_0x5566c4[_0x9f10('0x47')],qs['fields'](_0xc11c03[_0x9f10('0x49')]['fields']));_0x2f54aa[_0x9f10('0x4d')]=_0x2f54aa[_0x9f10('0x4d')][_0x9f10('0x4e')]?_0x2f54aa['attributes']:_0x5566c4['model'];if(!_0xc11c03[_0x9f10('0x49')]['hasOwnProperty'](_0x9f10('0x50'))){_0x2f54aa[_0x9f10('0x24')]=qs['limit'](_0xc11c03[_0x9f10('0x49')]['limit']);_0x2f54aa['offset']=qs[_0x9f10('0x23')](_0xc11c03[_0x9f10('0x49')][_0x9f10('0x23')]);}_0x2f54aa['order']=qs[_0x9f10('0x52')](_0xc11c03['query'][_0x9f10('0x52')]);_0x2f54aa[_0x9f10('0x7b')]=qs[_0x9f10('0x4a')](_['pick'](_0xc11c03[_0x9f10('0x49')],_0x5566c4[_0x9f10('0x4a')]));_0x2f54aa[_0x9f10('0x7b')]['ChatInteractionId']=_0x575861['id'];if(_0xc11c03[_0x9f10('0x49')][_0x9f10('0x88')]){_0x2f54aa[_0x9f10('0x7b')]=_[_0x9f10('0x2e')](_0x2f54aa[_0x9f10('0x7b')],{'$or':_[_0x9f10('0x33')](_0x2f54aa[_0x9f10('0x4d')],function(_0x91c6c){var _0x52da55={};_0x52da55[_0x91c6c]={'$like':'%'+_0xc11c03[_0x9f10('0x49')][_0x9f10('0x88')]+'%'};return _0x52da55;})});}_0x2f54aa['where']['secret']=![];if(_0xc11c03['query']['id']){_0x2f54aa[_0x9f10('0x7b')]['id']={'$gt':_0xc11c03[_0x9f10('0x49')]['id']};}_0x2f54aa=_['merge']({},_0x2f54aa,_0xc11c03[_0x9f10('0xb5')]);return db[_0x9f10('0xc9')][_0x9f10('0x22')]({'where':_0x2f54aa[_0x9f10('0x7b')]})[_0x9f10('0x16')](function(_0x27386b){_0x2da6a8[_0x9f10('0x22')]=_0x27386b;_0x2f54aa['include']=[];if(_0xc11c03[_0x9f10('0x49')][_0x9f10('0xfc')]){_0x2f54aa[_0x9f10('0xb4')][_0x9f10('0x39')]({'model':db[_0x9f10('0xe5')],'as':'User','attributes':['id','fullname',_0x9f10('0xec')]});}if(_0xc11c03[_0x9f10('0x49')]['includeAll']){_0x2f54aa[_0x9f10('0xb4')]=[{'all':!![]}];}return db[_0x9f10('0xc9')][_0x9f10('0xfa')](_0x2f54aa);})[_0x9f10('0x16')](function(_0x1671e0){_0x2da6a8[_0x9f10('0xb1')]=_0x1671e0;return _0x2da6a8;});}})['then'](respondWithFilteredResult(_0x249595,_0x2f54aa))[_0x9f10('0x3a')](handleError(_0x249595,null));};exports[_0x9f10('0xfd')]=function(_0x3c6f1b,_0x175b74){return db['ChatInteraction'][_0x9f10('0x66')]({'where':{'id':_0x3c6f1b[_0x9f10('0xb6')]['id']}})[_0x9f10('0x16')](handleEntityNotFound(_0x175b74,null))[_0x9f10('0x16')](function(_0x15c5df){if(_0x15c5df){return _0x15c5df[_0x9f10('0xfe')](_0x3c6f1b[_0x9f10('0x2f')]['ids'],_[_0x9f10('0xf7')](_0x3c6f1b[_0x9f10('0x2f')],[_0x9f10('0xf6'),'id'])||{})[_0x9f10('0xff')](function(){return db['Tag'][_0x9f10('0xfa')]({'attributes':['id','name','color'],'where':{'id':_0x3c6f1b[_0x9f10('0x2f')][_0x9f10('0xf6')]}});})['then'](function(_0x4943c3){socket[_0x9f10('0x100')]('chatInteractionTags:save',{'id':Number(_0x3c6f1b[_0x9f10('0xb6')]['id']),'tags':_0x4943c3||[]});return{'id':Number(_0x3c6f1b[_0x9f10('0xb6')]['id']),'tags':_0x4943c3||[]};});}})['then'](respondWithResult(_0x175b74,null))[_0x9f10('0x3a')](handleError(_0x175b74,null));};exports[_0x9f10('0x101')]=function(_0x4a77d2,_0x1c68d7){return db['ChatInteraction'][_0x9f10('0x66')]({'where':{'id':_0x4a77d2[_0x9f10('0xb6')]['id']}})[_0x9f10('0x16')](handleEntityNotFound(_0x1c68d7,null))[_0x9f10('0x16')](function(_0x3a58c4){if(_0x3a58c4){return _0x3a58c4['removeTags'](_0x4a77d2[_0x9f10('0x49')][_0x9f10('0xf6')]);}})[_0x9f10('0x16')](respondWithStatusCode(_0x1c68d7,null))[_0x9f10('0x3a')](handleError(_0x1c68d7,null));};exports[_0x9f10('0xde')]=function(_0x2e3239,_0x1135ce){var _0x492aaf=moment()[_0x9f10('0x102')]()['toString']();var _0x56b209=path[_0x9f10('0xdb')](config['root'],_0x9f10('0x103'),'files',_0x9f10('0x104'));var _0x2ce940=path[_0x9f10('0xdb')](config[_0x9f10('0xdc')],_0x9f10('0x103'),'files',_0x9f10('0x105'));var _0x274ea7=path[_0x9f10('0xdb')](_0x56b209,_0x492aaf);var _0x2b0199=util['format'](_0x9f10('0x106'),_0x2e3239['params']['id'],_0x492aaf);var _0x1511b7=path[_0x9f10('0xdb')](_0x56b209,_0x2b0199);var _0xa72487=[];_0xa72487[_0x9f10('0x39')]({'model':db['User'],'as':_0x9f10('0xe5'),'attributes':['id',_0x9f10('0x34')],'raw':!![]});_0xa72487[_0x9f10('0x39')]({'model':db['CmContact'],'as':_0x9f10('0x6b'),'attributes':['id',_0x9f10('0x107'),'lastName'],'raw':!![]});if(_0x2e3239[_0x9f10('0x49')][_0x9f10('0x105')]){_0xa72487[_0x9f10('0x39')]({'model':db[_0x9f10('0xd6')],'as':_0x9f10('0xd6'),'raw':!![]});}var _0x4bbfa5=[{'model':db[_0x9f10('0xc9')],'as':'Messages','attributes':['id',_0x9f10('0x2f'),'createdAt','direction',_0x9f10('0x108'),_0x9f10('0x84')],'include':_0xa72487}];_0x4bbfa5['push']({'model':db[_0x9f10('0x109')],'as':_0x9f10('0x10a'),'attributes':['id',_0x9f10('0x2b')]});_0x4bbfa5[_0x9f10('0x39')]({'model':db[_0x9f10('0xe5')],'as':_0x9f10('0x10b'),'attributes':['id',_0x9f10('0x34')]});return db[_0x9f10('0x44')][_0x9f10('0x66')]({'where':{'id':_0x2e3239[_0x9f10('0xb6')]['id']},'include':_0x4bbfa5})[_0x9f10('0x16')](handleEntityNotFound(_0x1135ce,null))[_0x9f10('0x16')](function(_0x502a15){if(_0x502a15){var _0x2faafe=_0x502a15[_0x9f10('0x10c')]({'plain':!![]});fs[_0x9f10('0x10d')](_0x274ea7);var _0x46de3d={'channel':_0x9f10('0x10e'),'account':_0x2faafe[_0x9f10('0x10a')]['name'],'agent':_0x2faafe[_0x9f10('0x10b')]?_0x2faafe[_0x9f10('0x10b')][_0x9f10('0x34')]:_0x9f10('0x10f'),'createdAt':moment(_0x2faafe[_0x9f10('0x7e')])[_0x9f10('0xe1')](_0x9f10('0xf9'))['toString'](),'closedAt':_0x2faafe[_0x9f10('0x3f')]?moment(_0x2faafe[_0x9f10('0x110')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9f10('0x9b')]():'','disposition':_0x2faafe[_0x9f10('0x40')],'chatInfo':{'browser':_0x2faafe[_0x9f10('0x111')],'os':_0x2faafe[_0x9f10('0x112')],'referer':_0x2faafe['referer'],'customerIp':_0x2faafe[_0x9f10('0x113')],'customerPort':_0x2faafe[_0x9f10('0x114')]?_0x2faafe[_0x9f10('0x114')]:_0x9f10('0x10f')},'messages':_(_0x2faafe[_0x9f10('0xe4')])[_0x9f10('0x115')]()[_0x9f10('0x88')]({'secret':![]})[_0x9f10('0x33')](function(_0xddbe2b){if(_0xddbe2b['Attachment']){var _0x32e5fd=path['join'](_0x2ce940,_0xddbe2b[_0x9f10('0xd6')][_0x9f10('0xd3')]);if(fs[_0x9f10('0x116')](_0x32e5fd)){fs['createReadStream'](_0x32e5fd)['pipe'](fs[_0x9f10('0x117')](path[_0x9f10('0xdb')](_0x274ea7,_0xddbe2b[_0x9f10('0xd6')][_0x9f10('0xd3')])));}}return{'date':moment(_0xddbe2b[_0x9f10('0x7e')])[_0x9f10('0xe1')](_0x9f10('0xf9'))[_0x9f10('0x9b')](),'sender':_0xddbe2b['direction']===_0x9f10('0xc8')?_0xddbe2b['User']?_0xddbe2b[_0x9f10('0xe5')][_0x9f10('0x34')]:_0x9f10('0xe8'):_0xddbe2b['Contact']['firstName']+(_0xddbe2b['Contact']['lastName']?'\x20'+_0xddbe2b['Contact'][_0x9f10('0x118')]:''),'body':_0xddbe2b[_0x9f10('0xd6')]?_0xddbe2b['Attachment'][_0x9f10('0xd3')]:_0xddbe2b[_0x9f10('0x2f')],'direction':_0xddbe2b['direction']===_0x9f10('0xc8')?'A':'C','secret':_0xddbe2b[_0x9f10('0x108')],'read':_0xddbe2b[_0x9f10('0x84')],'attachment':_0xddbe2b['Attachment']};})[_0x9f10('0x68')]()};return ejs[_0x9f10('0x119')](path['join'](config[_0x9f10('0xdc')],_0x9f10('0x103'),'views',_0x9f10('0x11a')),{'interaction':_0x46de3d})[_0x9f10('0x16')](function(_0xf35cbd){var _0x59dcf3=path[_0x9f10('0xdb')](_0x274ea7,'transcript-'+_0x2faafe['id']+'-'+_0x492aaf+_0x9f10('0x11b'));var _0x531ae6={'path':_0x59dcf3,'channel':_0x9f10('0x10e'),'interactionId':_0x2faafe['id']};return pdf[_0x9f10('0x11c')](_0xf35cbd,_0x531ae6);})['then'](function(){return new Promise(function(_0x2809b5,_0x44d12b){zipdir(_0x274ea7,{'saveTo':_0x1511b7},function(_0x3518e4,_0x208926){if(_0x3518e4)return _0x44d12b(_0x3518e4);return _0x2809b5(_0x208926);});})[_0x9f10('0x16')](function(){return new BPromise(function(_0x5b9746,_0x208341){rimraf(_0x274ea7,function(_0x41134f){if(_0x41134f)_0x208341(_0x41134f);return _0x5b9746();});});})[_0x9f10('0x16')](function(){return _0x1135ce[_0x9f10('0xde')](_0x1511b7,_0x2b0199,function(_0x6b6e72){if(_0x6b6e72){logger['error']('err',_0x6b6e72);}else{fs[_0x9f10('0x11d')](_0x1511b7);}});});});}else{return _0x1135ce[_0x9f10('0x1e')](0xc8);}})[_0x9f10('0x3a')](handleError(_0x1135ce,null));}; \ No newline at end of file +var _0xf3cd=['interaction','Users','map','TagIds','Tags','split','forEach','push','catch','waiting','unmanaged','total','closed','UserId','talking','disposition','abandoned','answered','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','some','isEmpty','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','ChatWebsiteId','sequelize','toString','count','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','show','params','includeAll','include','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','vidaooEscalation','fullname','email','contact','account','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','basename','file','filename','mimetype','attachmentDownload','Attachment','attachId','root','server/files/attachments/','close','mailTranscript','join','server/files/chat/upload/','format','now','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','ChatInteractionId','$gte','options','findAll','rows','getMyMessages','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','download','server','tmp','files','attachments','firstName','direction','Account','Owner','get','Chat','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','customerPort','N.A.','tail','createWriteStream','out','lastName','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','offset','undefined','limit','set','destroy','sendStatus','stack','name','send','render','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf3cd[_0x3947c9];return _0x2e7871;};'use strict';var rimraf=require(_0xdf3c('0x0'));var zipdir=require(_0xdf3c('0x1'));var rp=require(_0xdf3c('0x2'));var moment=require(_0xdf3c('0x3'));var BPromise=require(_0xdf3c('0x4'));var Mustache=require(_0xdf3c('0x5'));var util=require('util');var path=require(_0xdf3c('0x6'));var ejs=require(_0xdf3c('0x7'));var fs=require('fs');var _=require(_0xdf3c('0x8'));var squel=require('squel');var Redis=require(_0xdf3c('0x9'));var qs=require(_0xdf3c('0xa'));var as=require(_0xdf3c('0xb'));var pdf=require(_0xdf3c('0xc'));var logger=require(_0xdf3c('0xd'))(_0xdf3c('0xe'));var config=require('../../config/environment');var db=require(_0xdf3c('0xf'))['db'];config['redis']=_['defaults'](config[_0xdf3c('0x10')],{'host':_0xdf3c('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf3c('0x10')]));require(_0xdf3c('0x12'))[_0xdf3c('0x13')](socket);var jayson=require(_0xdf3c('0x14'));var client=jayson[_0xdf3c('0x15')][_0xdf3c('0x16')]({'port':0x232b});var client9004=jayson[_0xdf3c('0x15')][_0xdf3c('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x5e8925,_0x1d483c,_0x166ae5,_0x41fc33){return new BPromise(function(_0x17319c,_0x59e431){var _0x2ae4ad=_0x41fc33||client;return _0x2ae4ad[_0xdf3c('0x17')](_0x5e8925,_0x166ae5)[_0xdf3c('0x18')](function(_0x5e0047){logger[_0xdf3c('0x19')](_0xdf3c('0x1a'),_0x1d483c,_0xdf3c('0x1b'));logger[_0xdf3c('0x1c')](_0xdf3c('0x1d'),_0x1d483c,_0xdf3c('0x1b'),JSON[_0xdf3c('0x1e')](_0x5e0047));if(_0x5e0047[_0xdf3c('0x1f')]){if(_0x5e0047[_0xdf3c('0x1f')][_0xdf3c('0x20')]===0x1f4){logger['error'](_0xdf3c('0x1a'),_0x1d483c,_0x5e0047[_0xdf3c('0x1f')][_0xdf3c('0x21')]);return _0x59e431(_0x5e0047[_0xdf3c('0x1f')][_0xdf3c('0x21')]);}logger[_0xdf3c('0x1f')](_0xdf3c('0x1a'),_0x1d483c,_0x5e0047[_0xdf3c('0x1f')][_0xdf3c('0x21')]);return _0x17319c(_0x5e0047[_0xdf3c('0x1f')][_0xdf3c('0x21')]);}else{logger[_0xdf3c('0x19')](_0xdf3c('0x1a'),_0x1d483c,'request\x20sent');_0x17319c(_0x5e0047['result'][_0xdf3c('0x21')]);}})['catch'](function(_0x15776c){logger[_0xdf3c('0x1f')](_0xdf3c('0x1a'),_0x1d483c,_0x15776c);_0x59e431(_0x15776c);});});}function respondWithStatusCode(_0x38b319,_0x33652f){_0x33652f=_0x33652f||0xcc;return function(_0x36ba1c){if(_0x36ba1c){return _0x38b319['sendStatus'](_0x33652f);}return _0x38b319[_0xdf3c('0x22')](_0x33652f)[_0xdf3c('0x23')]();};}function respondWithResult(_0x13e3ca,_0x24754a){_0x24754a=_0x24754a||0xc8;return function(_0x40032a){if(_0x40032a){return _0x13e3ca[_0xdf3c('0x22')](_0x24754a)[_0xdf3c('0x24')](_0x40032a);}};}function respondWithFilteredResult(_0x155f54,_0x18cb46){return function(_0x1adee4){if(_0x1adee4){var _0x4c076c=typeof _0x18cb46[_0xdf3c('0x25')]===_0xdf3c('0x26')&&typeof _0x18cb46['limit']===_0xdf3c('0x26');var _0x59659e=_0x1adee4['count'];var _0x508be9=_0x4c076c?0x0:_0x18cb46[_0xdf3c('0x25')];var _0x186bba=_0x4c076c?_0x1adee4['count']:_0x18cb46['offset']+_0x18cb46[_0xdf3c('0x27')];var _0x1f2ce4;if(_0x186bba>=_0x59659e){_0x186bba=_0x59659e;_0x1f2ce4=0xc8;}else{_0x1f2ce4=0xce;}_0x155f54[_0xdf3c('0x22')](_0x1f2ce4);return _0x155f54[_0xdf3c('0x28')]('Content-Range',_0x508be9+'-'+_0x186bba+'/'+_0x59659e)[_0xdf3c('0x24')](_0x1adee4);}return null;};}function saveUpdates(_0x2a2d94){return function(_0x5386bf){if(_0x5386bf){return _0x5386bf['update'](_0x2a2d94)[_0xdf3c('0x18')](function(_0x46f0e3){return _0x46f0e3;});}return null;};}function removeEntity(_0x36937e){return function(_0x540f3a){if(_0x540f3a){return _0x540f3a[_0xdf3c('0x29')]()[_0xdf3c('0x18')](function(){_0x36937e[_0xdf3c('0x22')](0xcc)[_0xdf3c('0x23')]();});}};}function handleEntityNotFound(_0x575ae1){return function(_0xda0de0){if(!_0xda0de0){_0x575ae1[_0xdf3c('0x2a')](0x194);}return _0xda0de0;};}function handleError(_0x522e5f,_0x40ae3d){_0x40ae3d=_0x40ae3d||0x1f4;return function(_0x3daeda){logger[_0xdf3c('0x1f')](_0x3daeda[_0xdf3c('0x2b')]);if(_0x3daeda['name']){delete _0x3daeda[_0xdf3c('0x2c')];}_0x522e5f[_0xdf3c('0x22')](_0x40ae3d)[_0xdf3c('0x2d')](_0x3daeda);};}function getMustacheRender(_0x3b9ce8,_0x4c1f49){return Mustache[_0xdf3c('0x2e')](_0x3b9ce8,_[_0xdf3c('0x2f')](_0x4c1f49['body'],{'contact':_0x4c1f49['contact'],'message':_0x4c1f49[_0xdf3c('0x21')],'agent':_0x4c1f49['agent'],'interaction':_0x4c1f49[_0xdf3c('0x30')],'account':_0x4c1f49['account']}))||'';}function getInteractionUsers(_0x57faba,_0x52f0c3){return new BPromise(function(_0x44a478,_0x2ee9ad){try{if(_0x52f0c3[_0x57faba['id']]){_0x57faba[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x52f0c3[_0x57faba['id']],function(_0x54c25f){return{'id':_0x54c25f['id'],'fullname':_0x54c25f['fullname']};});}}catch(_0x3d8557){_0x2ee9ad(_0x3d8557);}_0x44a478(_0x57faba);});}function getInteractionTags(_0x49d0f0,_0x46e40f){return new BPromise(function(_0x17b502,_0x3628ae){try{if(_0x49d0f0[_0xdf3c('0x33')]){_0x49d0f0[_0xdf3c('0x34')]=[];_0x49d0f0[_0xdf3c('0x33')][_0xdf3c('0x35')](',')[_0xdf3c('0x36')](function(_0x398c76){_0x49d0f0['Tags'][_0xdf3c('0x37')](_0x46e40f[_0x398c76]);});}delete _0x49d0f0['TagIds'];}catch(_0x5c1471){_0x3628ae(_0x5c1471);}_0x17b502(_0x49d0f0);});}function updateChatInteraction(_0x3b97bc,_0x47f760,_0xccce51){return new BPromise(function(_0x4f93d5,_0x2a94c3){return getInteractionUsers(_0x3b97bc,_0xccce51)[_0xdf3c('0x18')](function(_0x1c6dee){return getInteractionTags(_0x1c6dee,_0x47f760);})[_0xdf3c('0x18')](function(_0x3098cb){return getStateInteraction(_0x3098cb);})[_0xdf3c('0x18')](function(_0x736ef5){_0x4f93d5(_0x736ef5);})[_0xdf3c('0x38')](function(_0x3cf131){_0x2a94c3(_0x3cf131);});});}function getStateInteraction(_0xa65478){return new BPromise(function(_0x424acf){_0xa65478[_0xdf3c('0x39')]=0x0;_0xa65478['talking']=0x0;_0xa65478['answered']=0x0;_0xa65478[_0xdf3c('0x3a')]=0x0;_0xa65478['abandoned']=0x0;_0xa65478[_0xdf3c('0x3b')]=0x0;if(!_0xa65478[_0xdf3c('0x3c')]&&!_0xa65478[_0xdf3c('0x3d')]){_0xa65478[_0xdf3c('0x39')]+=0x1;}if(!_0xa65478['closed']&&_0xa65478['UserId']){_0xa65478[_0xdf3c('0x3e')]+=0x1;if(_0xa65478[_0xdf3c('0x39')]){_0xa65478[_0xdf3c('0x39')]-=0x1;}}if(_0xa65478['closed']&&_0xa65478[_0xdf3c('0x3f')]===_0xdf3c('0x40')){_0xa65478[_0xdf3c('0x40')]+=0x1;if(_0xa65478[_0xdf3c('0x39')]){_0xa65478['waiting']-=0x1;}}else if(_0xa65478[_0xdf3c('0x3c')]&&!_0xa65478[_0xdf3c('0x3d')]&&_0xa65478[_0xdf3c('0x3f')]){_0xa65478[_0xdf3c('0x3a')]+=0x1;if(_0xa65478[_0xdf3c('0x39')]){_0xa65478['waiting']-=0x1;}}else if(_0xa65478[_0xdf3c('0x3c')]&&_0xa65478[_0xdf3c('0x3d')]){_0xa65478[_0xdf3c('0x41')]+=0x1;if(_0xa65478[_0xdf3c('0x3e')]){_0xa65478[_0xdf3c('0x3e')]-=0x1;}}_0xa65478[_0xdf3c('0x3b')]+=0x1;_0x424acf(_0xa65478);});}exports['index']=function(_0x4d6349,_0x2c6c6d){var _0x2be86d={},_0x5a4443={},_0x5c9885={'count':0x0,'rows':[]};var _0x269723=_[_0xdf3c('0x32')](db[_0xdf3c('0x42')][_0xdf3c('0x43')],function(_0xaae4bc){return{'name':_0xaae4bc[_0xdf3c('0x44')],'type':_0xaae4bc[_0xdf3c('0x45')][_0xdf3c('0x46')]};});_0x5a4443[_0xdf3c('0x47')]=_['map'](_0x269723,_0xdf3c('0x2c'));_0x5a4443[_0xdf3c('0x48')]=_[_0xdf3c('0x49')](_0x4d6349[_0xdf3c('0x48')]);_0x5a4443[_0xdf3c('0x4a')]=_[_0xdf3c('0x4b')](_0x5a4443[_0xdf3c('0x47')],_0x5a4443['query']);_0x2be86d[_0xdf3c('0x4c')]=_['intersection'](_0x5a4443[_0xdf3c('0x47')],qs['fields'](_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x4d')]));_0x2be86d[_0xdf3c('0x4c')]=_0x2be86d[_0xdf3c('0x4c')]['length']?_0x2be86d['attributes']:_0x5a4443['model'];if(!_0x4d6349[_0xdf3c('0x48')]['hasOwnProperty'](_0xdf3c('0x4e'))){_0x2be86d[_0xdf3c('0x27')]=qs[_0xdf3c('0x27')](_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x27')]);_0x2be86d['offset']=qs['offset'](_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x25')]);}_0x2be86d['order']=qs[_0xdf3c('0x4f')](_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x4f')]);_0x2be86d[_0xdf3c('0x50')]=qs[_0xdf3c('0x4a')](_[_0xdf3c('0x51')](_0x4d6349[_0xdf3c('0x48')],_0x5a4443['filters']),_0x269723);var _0x4c98dc=[];var _0x35767a=squel[_0xdf3c('0x52')]()[_0xdf3c('0x53')]('id')[_0xdf3c('0x53')](_0xdf3c('0x2c'))[_0xdf3c('0x53')](_0xdf3c('0x54'))[_0xdf3c('0x55')](_0xdf3c('0x56'));var _0x31624a=squel[_0xdf3c('0x52')]()['field'](_0xdf3c('0x57'))['field']('u.fullname')['field']('ui.ChatInteractionId')['from'](_0xdf3c('0x58'),'ui')[_0xdf3c('0x59')]('users','u',_0xdf3c('0x5a'));var _0x32427e=squel['select']()[_0xdf3c('0x55')](_0xdf3c('0x5b'),'i')[_0xdf3c('0x59')](_0xdf3c('0x5c'),'c',_0xdf3c('0x5d'))[_0xdf3c('0x59')](_0xdf3c('0x5e'),'o',_0xdf3c('0x5f'))[_0xdf3c('0x59')](_0xdf3c('0x60'),'a',_0xdf3c('0x61'))['left_join'](_0xdf3c('0x62'),'me',_0xdf3c('0x63'))[_0xdf3c('0x59')]('chat_interaction_has_tags','it',_0xdf3c('0x64'))[_0xdf3c('0x59')](_0xdf3c('0x56'),'t','t.id\x20=\x20it.TagId');var _0x1effdb=squel[_0xdf3c('0x65')]();var _0x5ca218=[];var _0x3611ec=squel['expr']();var _0x28c296;if(_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x66')]){_0x28c296=as[_0xdf3c('0x67')](_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x66')]);var _0x3fca95=_0x28c296[_0xdf3c('0x68')];for(var _0x2922d8=0x0;_0x2922d8<_0x28c296[_0xdf3c('0x69')][_0xdf3c('0x6a')];_0x2922d8++){var _0x1b7195=_0x28c296[_0xdf3c('0x69')][_0x2922d8];var _0x206a18='i';var _0x204110=_[_0xdf3c('0x6b')](_0x269723,[_0xdf3c('0x2c'),_0x1b7195['field']]);if(!_0x204110){switch(_0x1b7195['field']){case _0xdf3c('0x6c'):if(_0x1b7195[_0xdf3c('0x6d')]==0x1){_0x32427e[_0xdf3c('0x6e')]('`'+_0x1b7195['field']+_0xdf3c('0x6f'));}else{_0x32427e['having']('`'+_0x1b7195['field']+_0xdf3c('0x70'));}break;case _0xdf3c('0x71'):if(_0x1b7195[_0xdf3c('0x72')]===_0xdf3c('0x73')){if(_0x1b7195[_0xdf3c('0x6d')][_0xdf3c('0x35')]('\x20')[_0xdf3c('0x6a')]>0x1){_0x1effdb[_0x3fca95](_0xdf3c('0x74'),qs[_0xdf3c('0x75')](_0x1b7195[_0xdf3c('0x6d')]),null);}else{var _0x1cce9a='%'+_0x1b7195[_0xdf3c('0x6d')]+'%';_0x1effdb[_0x3fca95](_0xdf3c('0x76'),_0x1cce9a,_0x1cce9a,_0x1cce9a);}}else{_0x204110=_['find'](_0x269723,[_0xdf3c('0x2c'),_0xdf3c('0x77')]);_0x1b7195[_0xdf3c('0x53')]=_0xdf3c('0x77');_0x4ff52a=as[_0xdf3c('0x78')](_0x206a18,_0x204110['type'],_0x1b7195);_0x1effdb[_0x3fca95](_0x4ff52a[_0xdf3c('0x79')],_0x4ff52a[_0xdf3c('0x6d')][_0xdf3c('0x7a')],_0x4ff52a[_0xdf3c('0x6d')][_0xdf3c('0x23')]);}break;case _0xdf3c('0x7b'):var _0x3c0a8d=_0x1b7195[_0xdf3c('0x6d')][_0xdf3c('0x35')](',')[_0xdf3c('0x32')](function(_0x55010b){return Number(_0x55010b);});_0x3c0a8d[_0xdf3c('0x36')](function(_0x9cc472){_0x3611ec['or'](_0xdf3c('0x7c'),'%,'+_0x9cc472+',%');});_0x5ca218=_[_0xdf3c('0x7d')](_0x5ca218,_0x3c0a8d);break;case _0xdf3c('0x7e'):if(_0x1b7195[_0xdf3c('0x72')]===_0xdf3c('0x73')){_0x1effdb[_0x3fca95]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1b7195[_0xdf3c('0x6d')]+'%',null);}else{_0x204110=_[_0xdf3c('0x6b')](_0x269723,['name','UserId']);_0x1b7195[_0xdf3c('0x53')]=_0xdf3c('0x3d');_0x4ff52a=as[_0xdf3c('0x78')](_0x206a18,_0x204110[_0xdf3c('0x45')],_0x1b7195);_0x1effdb[_0x3fca95](_0x4ff52a[_0xdf3c('0x79')],_0x4ff52a[_0xdf3c('0x6d')][_0xdf3c('0x7a')],_0x4ff52a[_0xdf3c('0x6d')]['end']);}break;case _0xdf3c('0x7f'):_0x4ff52a=as[_0xdf3c('0x78')]('me',null,_0x1b7195);_0x1effdb[_0x3fca95](_0x4ff52a[_0xdf3c('0x79')],_0x4ff52a['value'][_0xdf3c('0x7a')],_0x4ff52a[_0xdf3c('0x6d')][_0xdf3c('0x23')]);break;}}else{var _0x4ff52a=as[_0xdf3c('0x78')](_0x206a18,_0x204110[_0xdf3c('0x45')],_0x1b7195);_0x1effdb[_0x3fca95](_0x4ff52a[_0xdf3c('0x79')],_0x4ff52a[_0xdf3c('0x6d')][_0xdf3c('0x7a')],_0x4ff52a[_0xdf3c('0x6d')]['end']);}}}else{var _0x50753f=_(_0x4d6349['query'])['keys']()['map'](function(_0x2a4e4c){return _[_0xdf3c('0x80')](_0x269723,[_0xdf3c('0x2c'),_0x2a4e4c])?_0x2a4e4c:undefined;})['compact']()[_0xdf3c('0x6d')]();if(!_[_0xdf3c('0x81')](_0x50753f)){_0x50753f[_0xdf3c('0x36')](function(_0x51e8c6){if(_0x51e8c6==='ChatWebsiteId'){_0x32427e[_0xdf3c('0x50')]('i.ChatWebsiteId\x20IN\x20?',[][_0xdf3c('0x82')](_0x4d6349['query'][_0x51e8c6]));}else if(_0x51e8c6===_0xdf3c('0x83')){var _0x2677d7=JSON[_0xdf3c('0x84')](_0x4d6349[_0xdf3c('0x48')][_0x51e8c6])['$gte'];var _0x5148f6=JSON[_0xdf3c('0x84')](_0x4d6349[_0xdf3c('0x48')][_0x51e8c6])[_0xdf3c('0x85')];_0x32427e[_0xdf3c('0x50')](_0xdf3c('0x86'),_0x2677d7,_0x5148f6);}else{if(_0x4d6349[_0xdf3c('0x48')][_0x51e8c6]==='null'){_0x32427e[_0xdf3c('0x50')]('i.'+_0x51e8c6+'\x20IS\x20NULL');}else{_0x32427e[_0xdf3c('0x50')]('i.'+_0x51e8c6+_0xdf3c('0x87'),_0x4d6349[_0xdf3c('0x48')][_0x51e8c6]);}}});}if(_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x88')]){if(_0x4d6349['query'][_0xdf3c('0x88')]==0x1){_0x32427e[_0xdf3c('0x6e')](_0xdf3c('0x89'));}else{_0x32427e['having']('`unreadMessages`\x20>\x200');}}if(_0x4d6349['query']['tag']){_0x5ca218=_[_0xdf3c('0x8a')](_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x8b')])?_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x8b')]:new Array(_0x4d6349[_0xdf3c('0x48')]['tag']);_0x5ca218[_0xdf3c('0x36')](function(_0x585871){_0x3611ec['or'](_0xdf3c('0x7c'),'%,'+_0x585871+',%');});}if(_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x8c')]){var _0x15a057=_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x8c')][_0xdf3c('0x8d')]('\x5c','\x5c\x5c')[_0xdf3c('0x8d')](/'/g,'\x27\x27');if(qs[_0xdf3c('0x8e')](_0x15a057)){_0x1effdb['or'](_0xdf3c('0x8f'),_0x15a057+'%');}else{_0x1effdb['or'](_0xdf3c('0x90'),qs[_0xdf3c('0x75')](_0x15a057))['or'](_0xdf3c('0x91'),_0x15a057+'%');}}}_0x32427e[_0xdf3c('0x50')](_0x1effdb);_0x32427e['group'](_0xdf3c('0x92'));var _0x194b1a={'type':db[_0xdf3c('0x93')][_0xdf3c('0x94')]['SELECT'],'raw':!![]};var _0x9c7bdd=_0x32427e[_0xdf3c('0x95')]();_0x9c7bdd['field']('i.id');_0x9c7bdd[_0xdf3c('0x53')](_0xdf3c('0x96'),_0xdf3c('0x6c'));if(_0x2be86d[_0xdf3c('0x97')]){_0x2be86d[_0xdf3c('0x97')]['forEach'](function(_0x50105b){var _0x471d8f=_0x50105b[0x0]===_0xdf3c('0x98')?_0x50105b[0x0]:'i.'+_0x50105b[0x0];_0x32427e[_0xdf3c('0x97')](_0x471d8f,_0x50105b[0x1]===_0xdf3c('0x99')?![]:!![]);});}if(!_[_0xdf3c('0x81')](_0x5ca218)){_0x32427e['having'](_0x3611ec);_0x9c7bdd[_0xdf3c('0x50')](_0xdf3c('0x9a'),_0x5ca218);}BPromise[_0xdf3c('0x9b')]()[_0xdf3c('0x18')](function(){if(!_0x28c296){if(_0x4d6349[_0xdf3c('0x48')]['ChatWebsiteId'])return;_0x9c7bdd['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x32427e[_0xdf3c('0x50')](_0xdf3c('0x9c'));return;}if(_0x4d6349[_0xdf3c('0x9d')][_0xdf3c('0x9e')]!==_0xdf3c('0x9f'))return;return _0x4d6349[_0xdf3c('0x9d')][_0xdf3c('0xa0')]({'attributes':['id'],'raw':!![]})[_0xdf3c('0x18')](function(_0x5c52e2){if(_[_0xdf3c('0x81')](_0x5c52e2)){_0x9c7bdd[_0xdf3c('0x50')](_0xdf3c('0xa1'));_0x32427e[_0xdf3c('0x50')](_0xdf3c('0xa1'));}else{_0x9c7bdd[_0xdf3c('0x50')]('i.ChatWebsiteId\x20IN\x20?',_[_0xdf3c('0x32')](_0x5c52e2,'id'));_0x32427e[_0xdf3c('0x50')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x5c52e2,'id'));}});})[_0xdf3c('0x18')](function(){if(_0x4d6349['user'][_0xdf3c('0x9e')]===_0xdf3c('0x9f')&&!_0x28c296&&!_0x4d6349['query'][_0xdf3c('0xa2')])return[];return db[_0xdf3c('0xa3')][_0xdf3c('0x48')](_0x9c7bdd[_0xdf3c('0xa4')](),_0x194b1a);})[_0xdf3c('0x18')](function(_0x45c987){_0x5c9885['count']=_0x45c987[_0xdf3c('0x6a')];if(_0x5c9885[_0xdf3c('0xa5')]===0x0)return[];return db[_0xdf3c('0xa3')][_0xdf3c('0x48')](_0x35767a[_0xdf3c('0xa4')](),_0x194b1a)[_0xdf3c('0x18')](function(_0x3deacb){_0x4c98dc=_['keyBy'](_0x3deacb,'id');_0x194b1a=_['merge'](_0x194b1a,{'model':db[_0xdf3c('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4d6349[_0xdf3c('0x48')][_0xdf3c('0x4d')]){_0x2be86d['attributes'][_0xdf3c('0x36')](function(_0x52fcb6){_0x32427e['field']('i.'+_0x52fcb6);});}else{_0x32427e[_0xdf3c('0x53')](_0xdf3c('0x96'),'unreadMessages');_0x32427e[_0xdf3c('0x53')]('a.key',_0xdf3c('0xa6'));_0x32427e['field'](_0xdf3c('0xa7'),_0xdf3c('0xa8'));_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xa9'),_0xdf3c('0x98'));_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xaa'));_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xab'),_0xdf3c('0xac'));_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xad'),_0xdf3c('0xae'));_0x32427e[_0xdf3c('0x53')]('c.email',_0xdf3c('0xaf'));_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xb0'),'Contact.phone');_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xb1'),_0xdf3c('0xb2'));_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xb3'),_0xdf3c('0xb4'));_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xb5'),_0xdf3c('0xb6'));_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xb7'),'Owner.internal');_0x32427e[_0xdf3c('0x53')](_0xdf3c('0xb8'),_0xdf3c('0x33'));}if(_0x2be86d[_0xdf3c('0x27')])_0x32427e[_0xdf3c('0x27')](_0x2be86d[_0xdf3c('0x27')]);if(_0x2be86d[_0xdf3c('0x25')])_0x32427e[_0xdf3c('0x25')](_0x2be86d[_0xdf3c('0x25')]);return db[_0xdf3c('0xa3')][_0xdf3c('0x48')](_0x32427e[_0xdf3c('0xa4')](),_0x194b1a);})['then'](function(_0x6627){if(_0x6627[_0xdf3c('0x6a')]>0x0)_0x31624a[_0xdf3c('0x50')](_0xdf3c('0xb9'),_[_0xdf3c('0x32')](_0x6627,'id'));return db[_0xdf3c('0xa3')][_0xdf3c('0x48')](_0x31624a['toString'](),_0x194b1a)[_0xdf3c('0x18')](function(_0x87c93a){var _0x2a7636=_[_0xdf3c('0xba')](_0x87c93a,'ChatInteractionId');var _0x4265cb=[];_0x6627[_0xdf3c('0x36')](function(_0x4eb2ce){_0x4265cb[_0xdf3c('0x37')](updateChatInteraction(_0x4eb2ce,_0x4c98dc,_0x2a7636));});return BPromise['all'](_0x4265cb);});});})[_0xdf3c('0x18')](function(_0x1b2363){_0x5c9885['rows']=_0x1b2363;return _0x5c9885;})[_0xdf3c('0x18')](respondWithFilteredResult(_0x2c6c6d,_0x2be86d))[_0xdf3c('0x38')](handleError(_0x2c6c6d,null));};exports[_0xdf3c('0xbb')]=function(_0x4c0742,_0x4ffd52){var _0x243ad5={'raw':![],'where':{'id':_0x4c0742[_0xdf3c('0xbc')]['id']}},_0x5ea218={};_0x5ea218[_0xdf3c('0x47')]=_[_0xdf3c('0x49')](db[_0xdf3c('0x42')]['rawAttributes']);_0x5ea218[_0xdf3c('0x48')]=_[_0xdf3c('0x49')](_0x4c0742['query']);_0x5ea218[_0xdf3c('0x4a')]=_['intersection'](_0x5ea218[_0xdf3c('0x47')],_0x5ea218[_0xdf3c('0x48')]);_0x243ad5['attributes']=_['intersection'](_0x5ea218[_0xdf3c('0x47')],qs['fields'](_0x4c0742[_0xdf3c('0x48')][_0xdf3c('0x4d')]));_0x243ad5[_0xdf3c('0x4c')]=_0x243ad5[_0xdf3c('0x4c')][_0xdf3c('0x6a')]?_0x243ad5[_0xdf3c('0x4c')]:_0x5ea218[_0xdf3c('0x47')];if(_0x4c0742[_0xdf3c('0x48')][_0xdf3c('0xbd')]){_0x243ad5[_0xdf3c('0xbe')]=[{'all':!![]}];}_0x243ad5=_[_0xdf3c('0x2f')]({},_0x243ad5,_0x4c0742['options']);return db[_0xdf3c('0x42')][_0xdf3c('0x6b')](_0x243ad5)['then'](handleEntityNotFound(_0x4ffd52,null))[_0xdf3c('0x18')](respondWithResult(_0x4ffd52,null))[_0xdf3c('0x38')](handleError(_0x4ffd52,null));};exports[_0xdf3c('0xbf')]=function(_0x307179,_0x7e5769){return db[_0xdf3c('0x42')]['create'](_0x307179[_0xdf3c('0x7f')],{})['then'](respondWithResult(_0x7e5769,0xc9))[_0xdf3c('0x38')](handleError(_0x7e5769,null));};exports[_0xdf3c('0xc0')]=function(_0x214506,_0x2dafff){if(_0x214506[_0xdf3c('0x7f')]['id']){delete _0x214506[_0xdf3c('0x7f')]['id'];}return db['ChatInteraction'][_0xdf3c('0x6b')]({'where':{'id':_0x214506[_0xdf3c('0xbc')]['id']}})['then'](handleEntityNotFound(_0x2dafff,null))[_0xdf3c('0x18')](saveUpdates(_0x214506[_0xdf3c('0x7f')],null))[_0xdf3c('0x18')](respondWithResult(_0x2dafff,null))[_0xdf3c('0x38')](handleError(_0x2dafff,null));};exports[_0xdf3c('0x29')]=function(_0x18c121,_0x1654d5){return db[_0xdf3c('0x42')]['find']({'where':{'id':_0x18c121['params']['id']}})[_0xdf3c('0x18')](handleEntityNotFound(_0x1654d5,null))[_0xdf3c('0x18')](removeEntity(_0x1654d5,null))[_0xdf3c('0x38')](handleError(_0x1654d5,null));};exports[_0xdf3c('0xc1')]=function(_0x47afe4,_0x4f8f27){return db[_0xdf3c('0x42')]['describe']()[_0xdf3c('0x18')](respondWithResult(_0x4f8f27,null))['catch'](handleError(_0x4f8f27,null));};exports[_0xdf3c('0xc2')]=function(_0x666df5,_0x35d01c){var _0x53555a=_0x666df5[_0xdf3c('0xbc')]['id'];var _0x142cd0;var _0x5bf9a9;var _0x50a21b;return db[_0xdf3c('0x42')][_0xdf3c('0xc3')]({'where':{'id':_0x53555a}})[_0xdf3c('0x18')](function(_0x1a1c13){_0x142cd0=_0x1a1c13;return db[_0xdf3c('0xc4')][_0xdf3c('0xc3')]({'where':{'id':_0x1a1c13[_0xdf3c('0xa2')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xdf3c('0xc5'),_0xdf3c('0xc6'),_0xdf3c('0xc7')],'raw':!![]});})[_0xdf3c('0x18')](function(_0x3c3770){if(_0x3c3770&&_0x3c3770[_0xdf3c('0xc8')]&&_0x3c3770[_0xdf3c('0xc9')]){_0x5bf9a9=_0x3c3770;var _0x828c9c={'interaction':{'id':_0x53555a},'agent':{'id':_0x666df5[_0xdf3c('0x9d')]['id'],'name':_0x666df5[_0xdf3c('0x9d')][_0xdf3c('0x2c')],'fullname':_0x666df5[_0xdf3c('0x9d')][_0xdf3c('0xca')],'email':_0x666df5[_0xdf3c('0x9d')][_0xdf3c('0xcb')]},'contact':_0x666df5[_0xdf3c('0x7f')][_0xdf3c('0xcc')],'account':_0x666df5[_0xdf3c('0x7f')][_0xdf3c('0xcd')]};var _0x552654={'rejectUnauthorized':![],'method':'POST','url':_0xdf3c('0xce'),'headers':{'X-APIKEY':_0x3c3770['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x666df5['user'][_0xdf3c('0xcb')]],'buttons':null,'topic':_0x5bf9a9['vidaooTopic'],'note':_[_0xdf3c('0xcf')](_0x5bf9a9[_0xdf3c('0xc6')])?null:getMustacheRender(_0x5bf9a9['vidaooNote'],_0x828c9c),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x5bf9a9[_0xdf3c('0xc7')])){var _0x3e0a0f=getMustacheRender(_0x5bf9a9[_0xdf3c('0xc7')],_0x828c9c);var _0x4d5216=JSON[_0xdf3c('0x84')](_0x3e0a0f);_0x552654['body'][_0xdf3c('0xd0')]=_0x4d5216;}}catch(_0x4ba88f){throw new db['Sequelize'][(_0xdf3c('0xd1'))](_0xdf3c('0xd2'));}return rp(_0x552654);}else{throw new db[(_0xdf3c('0x93'))][(_0xdf3c('0xd1'))](_0xdf3c('0xd3'));}})[_0xdf3c('0x18')](function(_0x48590a){_0x50a21b=_0x48590a;if(_0x50a21b['id']){var _0x4f017c={'body':_0x50a21b[_0xdf3c('0xd4')],'ChatWebsiteId':_0x5bf9a9['id'],'ChatInteractionId':_0x142cd0['id'],'direction':'out','UserId':_0x666df5[_0xdf3c('0x9d')]['id']};return db[_0xdf3c('0xd5')][_0xdf3c('0xbf')](_0x4f017c,{});}else{throw new db[(_0xdf3c('0x93'))][(_0xdf3c('0xd1'))](_0xdf3c('0xd6'));}})[_0xdf3c('0x18')](function(){return _0x142cd0['updateAttributes']({'vidaooSessionId':_0x50a21b['id']});})['then'](respondWithResult(_0x35d01c,null))[_0xdf3c('0x38')](handleError(_0x35d01c,null));};exports[_0xdf3c('0xd7')]=function(_0x3fa455,_0x13a882){if(_0x3fa455['body']['id']){delete _0x3fa455[_0xdf3c('0x7f')]['id'];}return db[_0xdf3c('0x42')][_0xdf3c('0x6b')]({'where':{'id':_0x3fa455[_0xdf3c('0xbc')]['id']},'include':[{'model':db[_0xdf3c('0xd8')],'as':_0xdf3c('0x71')}]})['then'](handleEntityNotFound(_0x13a882,null))[_0xdf3c('0x18')](saveUpdates(_0x3fa455[_0xdf3c('0x7f')],null))['then'](respondWithResult(_0x13a882,null))[_0xdf3c('0x38')](handleError(_0x13a882,null));};exports[_0xdf3c('0xd9')]=function(_0xe5f939,_0x511a40){if(_0xe5f939[_0xdf3c('0x7f')]['id']){delete _0xe5f939[_0xdf3c('0x7f')]['id'];}return db[_0xdf3c('0x42')][_0xdf3c('0x6b')]({'where':{'id':_0xe5f939[_0xdf3c('0xbc')]['id']}})[_0xdf3c('0x18')](function(_0x3c91ba){if(!_0x3c91ba){logger[_0xdf3c('0x1f')](_0xdf3c('0xda'),'abandon',0x194,_0xdf3c('0xdb'));_0x511a40['sendStatus'](0x194);}else{if(_0x3c91ba[_0xdf3c('0x3d')]){throw new db[(_0xdf3c('0x93'))][(_0xdf3c('0xd1'))](_0xdf3c('0xdc'));}}return _0x3c91ba;})[_0xdf3c('0x18')](function(_0x34344b){if(_0x34344b){return _0x34344b[_0xdf3c('0xc0')]({'closed':_0xe5f939[_0xdf3c('0x7f')][_0xdf3c('0x3c')],'disposition':_0xe5f939[_0xdf3c('0x7f')][_0xdf3c('0x3f')]})['then'](function(_0x379996){return _0x379996;});}})[_0xdf3c('0x18')](function(){return respondWithRpcPromise('AbandonInteraction',_0xdf3c('0xd9'),_0xe5f939[_0xdf3c('0x7f')],client9004);})[_0xdf3c('0x18')](respondWithResult(_0x511a40,null))[_0xdf3c('0x38')](handleError(_0x511a40,null));};exports['attachmentUpload']=function(_0x2670ef,_0xdf510b){_0x2670ef[_0xdf3c('0x7f')]['name']=_0x2670ef['file']['originalname'];_0x2670ef[_0xdf3c('0x7f')][_0xdf3c('0xdd')]=_0x2670ef[_0xdf3c('0xde')][_0xdf3c('0xdf')];_0x2670ef[_0xdf3c('0x7f')][_0xdf3c('0x45')]=_0x2670ef[_0xdf3c('0xde')][_0xdf3c('0xe0')];return db['Attachment'][_0xdf3c('0xbf')](_0x2670ef['body'])[_0xdf3c('0x18')](respondWithResult(_0xdf510b,0xc9))[_0xdf3c('0x38')](handleError(_0xdf510b,null));};exports[_0xdf3c('0xe1')]=function(_0x3263e7,_0x3cb8a7){return db[_0xdf3c('0x42')]['findOne']({'where':{'id':_0x3263e7[_0xdf3c('0xbc')]['id']},'raw':!![]})[_0xdf3c('0x18')](handleEntityNotFound(_0x3cb8a7,null))['then'](function(_0x28337a){if(_0x28337a){if(_0x28337a[_0xdf3c('0x3c')]){return _0x3cb8a7[_0xdf3c('0x22')](0x193)[_0xdf3c('0x24')]({'status':0x193,'message':'Unauthorized'});}return db[_0xdf3c('0xe2')]['findOne']({'where':{'id':_0x3263e7[_0xdf3c('0x48')][_0xdf3c('0xe3')]},'raw':!![]})[_0xdf3c('0x18')](handleEntityNotFound(_0x3cb8a7,null));}})[_0xdf3c('0x18')](function(_0x17669f){if(_0x17669f){var _0x2643be=_0x17669f['ChatOfflineMessageId']!==null;var _0x58edcc=path['join'](config[_0xdf3c('0xe4')],_0xdf3c('0xe5'));if(_0x2643be){_0x58edcc=path['join'](_0x58edcc,'offline-chat/');}var _0x2a8819=path['join'](_0x58edcc,_0x17669f['basename']);return _0x3cb8a7['download'](_0x2a8819);}})[_0xdf3c('0x38')](handleError(_0x3cb8a7,null));};exports[_0xdf3c('0xe6')]=function(_0x2ab6bc,_0x5126be){var _0x187ce8=null;var _0x51d880=null;var _0x1ce1b6=null;if(_0x2ab6bc[_0xdf3c('0x7f')]['id']){delete _0x2ab6bc[_0xdf3c('0x7f')]['id'];}if(_0x2ab6bc[_0xdf3c('0x7f')][_0xdf3c('0xe7')]){_0x1ce1b6=path[_0xdf3c('0xe8')](config[_0xdf3c('0xe4')],_0xdf3c('0xe9'),util[_0xdf3c('0xea')]('transcript-%s.txt',Date[_0xdf3c('0xeb')]()));_0x2ab6bc[_0xdf3c('0x7f')]['pathTranscript']=_0x1ce1b6;}return db[_0xdf3c('0x42')][_0xdf3c('0x6b')]({'where':{'id':_0x2ab6bc['params']['id']},'include':[{'model':db[_0xdf3c('0xd5')],'as':'Messages','include':[{'model':db[_0xdf3c('0x7e')],'as':_0xdf3c('0x7e')}]}]})[_0xdf3c('0x18')](handleEntityNotFound(_0x5126be,null))[_0xdf3c('0x18')](saveUpdates(_0x2ab6bc[_0xdf3c('0x7f')],null))[_0xdf3c('0x18')](function(_0x232b34){if(_0x232b34){_0x187ce8=_0x232b34;return db[_0xdf3c('0xc4')][_0xdf3c('0x6b')]({'where':{'id':_0x187ce8[_0xdf3c('0xa2')]}});}})[_0xdf3c('0x18')](function(_0x1c31ee){if(_0x1c31ee){_0x51d880=_0x1c31ee;return db[_0xdf3c('0xd8')][_0xdf3c('0x6b')]({'where':{'id':_0x187ce8[_0xdf3c('0x77')]}});}})[_0xdf3c('0x18')](function(_0x542a02){if(_0x542a02){if(_0x1ce1b6){var _0x3176cd=null;for(var _0x3f5b9d=0x1;_0x3f5b9d<_0x187ce8['Messages'][_0xdf3c('0x6a')];++_0x3f5b9d){_0x3176cd=_0x187ce8[_0xdf3c('0xec')][_0x3f5b9d];var _0x162d56=_0x3176cd[_0xdf3c('0x3d')]?util['format'](_0xdf3c('0xed'),_0x51d880[_0xdf3c('0xee')],_0x3176cd['UserId']):_0xdf3c('0xef');var _0x37b1a6=_0x2ab6bc['body']['customer']||util[_0xdf3c('0xea')](_0xdf3c('0xed'),_0xdf3c('0xf0'),_0x3176cd['ContactId']);switch(_0x51d880[_0xdf3c('0xf1')]){case'website_alias':_0x162d56=_0x3176cd[_0xdf3c('0x3d')]?util[_0xdf3c('0xea')](_0xdf3c('0xed'),_0x51d880[_0xdf3c('0xee')],_0x3176cd[_0xdf3c('0x3d')]):_0xdf3c('0xef');break;case'agent_alias':_0x162d56=_0x3176cd[_0xdf3c('0x3d')]?_0x3176cd['User'][_0xdf3c('0xf2')]||_0x3176cd[_0xdf3c('0x7e')][_0xdf3c('0xca')]:'System';break;case _0xdf3c('0xf3'):_0x162d56=_0x3176cd['UserId']?_0x3176cd[_0xdf3c('0x7e')][_0xdf3c('0xca')]:'System';break;default:_0x162d56=_0x3176cd[_0xdf3c('0x3d')]?util[_0xdf3c('0xea')](_0xdf3c('0xed'),_0x51d880[_0xdf3c('0xee')],_0x3176cd['UserId']):_0xdf3c('0xef');}var _0x2e4a80=util[_0xdf3c('0xea')](_0xdf3c('0xf4'),moment(_0x3176cd[_0xdf3c('0x83')])[_0xdf3c('0xea')](_0xdf3c('0xf5')),_0x3176cd['direction']==='in'?_0x37b1a6:_0x162d56,_0x3176cd[_0xdf3c('0x7f')]);if(!_0x3176cd[_0xdf3c('0xf6')]){fs[_0xdf3c('0xf7')](_0x1ce1b6,_0x2e4a80);}}return db[_0xdf3c('0xf8')][_0xdf3c('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0xdf3c('0xf9')],'as':_0xdf3c('0xfa'),'raw':!![],'include':[{'model':db[_0xdf3c('0xfb')],'as':_0xdf3c('0xfb'),'raw':!![]}]}]});}}})[_0xdf3c('0x18')](function(_0x1b6928){if(!_0x1b6928||!_0x1b6928['Smtp']||!_0x2ab6bc[_0xdf3c('0x7f')])return _0x187ce8;var _0x30a520=_0x1b6928[_0xdf3c('0xfc')]();return respondWithRpcPromise('SendMail',_0xdf3c('0xfd'),{'account':_0x30a520,'message':{'from':util[_0xdf3c('0xea')](_0xdf3c('0xfe'),_0x1b6928[_0xdf3c('0x2c')],_0x1b6928[_0xdf3c('0xcb')]||_0x1b6928['Smtp'][_0xdf3c('0x9d')]),'to':_0x2ab6bc[_0xdf3c('0x7f')]['mailTranscript'],'subject':_0xdf3c('0xff'),'text':util[_0xdf3c('0xea')](_0xdf3c('0x100'),_0x2ab6bc[_0xdf3c('0x7f')][_0xdf3c('0xe7')]),'attachments':[{'path':_0x1ce1b6}]}})[_0xdf3c('0x18')](function(){return _0x187ce8;})[_0xdf3c('0x38')](function(_0x3d9041){logger[_0xdf3c('0x1f')](_0x3d9041);});})['then'](respondWithStatusCode(_0x5126be,0xc8))[_0xdf3c('0x38')](handleError(_0x5126be,null));};exports[_0xdf3c('0x101')]=function(_0x4fcb83,_0x39bc51){return db[_0xdf3c('0xd5')]['find']({'where':{'id':_0x4fcb83['params']['id']}})[_0xdf3c('0x18')](handleEntityNotFound(_0x39bc51,null))[_0xdf3c('0x18')](function(_0x2c6ae1){if(_0x2c6ae1){return _0x2c6ae1[_0xdf3c('0x101')](_0x4fcb83[_0xdf3c('0x7f')][_0xdf3c('0x102')],_[_0xdf3c('0x103')](_0x4fcb83[_0xdf3c('0x7f')],['ids','id'])||{});}})[_0xdf3c('0x18')](respondWithResult(_0x39bc51,null))[_0xdf3c('0x38')](handleError(_0x39bc51,null));};exports[_0xdf3c('0x104')]=function(_0x28bc25,_0x5037a5){var _0x37fd42={'raw':![],'where':{}};var _0x357055={};var _0x137d99={'count':0x0,'rows':[]};return db[_0xdf3c('0x42')]['findOne']({'where':{'id':_0x28bc25[_0xdf3c('0xbc')]['id']}})[_0xdf3c('0x18')](handleEntityNotFound(_0x5037a5,null))[_0xdf3c('0x18')](function(_0x58bc3a){if(_0x58bc3a){_0x357055['model']=_[_0xdf3c('0x49')](db[_0xdf3c('0xd5')][_0xdf3c('0x43')]);_0x357055['query']=_[_0xdf3c('0x49')](_0x28bc25[_0xdf3c('0x48')]);_0x357055[_0xdf3c('0x4a')]=_[_0xdf3c('0x4b')](_0x357055[_0xdf3c('0x47')],_0x357055['query']);_0x37fd42['attributes']=_[_0xdf3c('0x4b')](_0x357055['model'],qs[_0xdf3c('0x4d')](_0x28bc25[_0xdf3c('0x48')][_0xdf3c('0x4d')]));_0x37fd42[_0xdf3c('0x4c')]=_0x37fd42[_0xdf3c('0x4c')][_0xdf3c('0x6a')]?_0x37fd42['attributes']:_0x357055[_0xdf3c('0x47')];if(!_0x28bc25[_0xdf3c('0x48')][_0xdf3c('0x105')](_0xdf3c('0x4e'))){_0x37fd42['limit']=qs[_0xdf3c('0x27')](_0x28bc25[_0xdf3c('0x48')][_0xdf3c('0x27')]);_0x37fd42['offset']=qs['offset'](_0x28bc25[_0xdf3c('0x48')][_0xdf3c('0x25')]);}_0x37fd42['order']=qs[_0xdf3c('0x4f')](_0x28bc25['query'][_0xdf3c('0x4f')]);_0x37fd42[_0xdf3c('0x50')]=qs[_0xdf3c('0x4a')](_[_0xdf3c('0x51')](_0x28bc25[_0xdf3c('0x48')],_0x357055[_0xdf3c('0x4a')]));_0x37fd42['where'][_0xdf3c('0x106')]=_0x58bc3a['id'];if(_0x28bc25[_0xdf3c('0x48')][_0xdf3c('0x8c')]){_0x37fd42[_0xdf3c('0x50')]=_[_0xdf3c('0x2f')](_0x37fd42[_0xdf3c('0x50')],{'$or':_[_0xdf3c('0x32')](_0x37fd42[_0xdf3c('0x4c')],function(_0x43ce1f){var _0x127bfb={};_0x127bfb[_0x43ce1f]={'$like':'%'+_0x28bc25[_0xdf3c('0x48')]['filter']+'%'};return _0x127bfb;})});}if(_0x28bc25[_0xdf3c('0x48')][_0xdf3c('0x107')]){var _0x5a14cd=_0x28bc25[_0xdf3c('0x48')][_0xdf3c('0x107')][_0xdf3c('0x35')](',');var _0x31ec26={};_0x31ec26[_0x5a14cd[0x0]]={'$gte':moment(_0x5a14cd[0x1])[_0xdf3c('0xea')]('YYYY-MM-DD\x20HH:mm:ss')};_0x37fd42[_0xdf3c('0x50')]=_[_0xdf3c('0x2f')](_0x37fd42[_0xdf3c('0x50')],_0x31ec26);}_0x37fd42=_[_0xdf3c('0x2f')]({},_0x37fd42,_0x28bc25[_0xdf3c('0x108')]);return db[_0xdf3c('0xd5')][_0xdf3c('0xa5')]({'where':_0x37fd42[_0xdf3c('0x50')]})[_0xdf3c('0x18')](function(_0x4727f2){_0x137d99[_0xdf3c('0xa5')]=_0x4727f2;if(_0x28bc25[_0xdf3c('0x48')][_0xdf3c('0xbd')]){_0x37fd42['include']=[{'all':!![]}];}return db[_0xdf3c('0xd5')][_0xdf3c('0x109')](_0x37fd42);})['then'](function(_0xc59cea){_0x137d99[_0xdf3c('0x10a')]=_0xc59cea;return _0x137d99;});}})[_0xdf3c('0x18')](respondWithFilteredResult(_0x5037a5,_0x37fd42))[_0xdf3c('0x38')](handleError(_0x5037a5,null));};exports[_0xdf3c('0x10b')]=function(_0x18e2f3,_0x2269da){var _0x15322a={'where':{}},_0xc3b6a1={},_0x3d9a1e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xdf3c('0xc3')]({'where':{'id':_0x18e2f3[_0xdf3c('0xbc')]['id']}})['then'](handleEntityNotFound(_0x2269da,null))[_0xdf3c('0x18')](function(_0x49981e){if(_0x49981e){_0xc3b6a1[_0xdf3c('0x47')]=_['keys'](db[_0xdf3c('0xd5')]['rawAttributes']);_0xc3b6a1[_0xdf3c('0x48')]=_[_0xdf3c('0x49')](_0x18e2f3[_0xdf3c('0x48')]);_0xc3b6a1[_0xdf3c('0x4a')]=_[_0xdf3c('0x4b')](_0xc3b6a1[_0xdf3c('0x47')],_0xc3b6a1[_0xdf3c('0x48')]);_0x15322a[_0xdf3c('0x4c')]=_['intersection'](_0xc3b6a1[_0xdf3c('0x47')],qs[_0xdf3c('0x4d')](_0x18e2f3[_0xdf3c('0x48')]['fields']));_0x15322a[_0xdf3c('0x4c')]=_0x15322a[_0xdf3c('0x4c')][_0xdf3c('0x6a')]?_0x15322a[_0xdf3c('0x4c')]:_0xc3b6a1['model'];if(!_0x18e2f3['query']['hasOwnProperty']('nolimit')){_0x15322a[_0xdf3c('0x27')]=qs[_0xdf3c('0x27')](_0x18e2f3[_0xdf3c('0x48')][_0xdf3c('0x27')]);_0x15322a[_0xdf3c('0x25')]=qs[_0xdf3c('0x25')](_0x18e2f3[_0xdf3c('0x48')]['offset']);}_0x15322a[_0xdf3c('0x97')]=qs['sort'](_0x18e2f3[_0xdf3c('0x48')][_0xdf3c('0x4f')]);_0x15322a[_0xdf3c('0x50')]=qs[_0xdf3c('0x4a')](_[_0xdf3c('0x51')](_0x18e2f3[_0xdf3c('0x48')],_0xc3b6a1[_0xdf3c('0x4a')]));_0x15322a[_0xdf3c('0x50')]['ChatInteractionId']=_0x49981e['id'];if(_0x18e2f3[_0xdf3c('0x48')][_0xdf3c('0x8c')]){_0x15322a[_0xdf3c('0x50')]=_[_0xdf3c('0x2f')](_0x15322a[_0xdf3c('0x50')],{'$or':_['map'](_0x15322a['attributes'],function(_0x31e0a4){var _0x260466={};_0x260466[_0x31e0a4]={'$like':'%'+_0x18e2f3[_0xdf3c('0x48')][_0xdf3c('0x8c')]+'%'};return _0x260466;})});}_0x15322a[_0xdf3c('0x50')][_0xdf3c('0xf6')]=![];if(_0x18e2f3[_0xdf3c('0x48')]['id']){_0x15322a[_0xdf3c('0x50')]['id']={'$gt':_0x18e2f3[_0xdf3c('0x48')]['id']};}_0x15322a=_[_0xdf3c('0x2f')]({},_0x15322a,_0x18e2f3[_0xdf3c('0x108')]);return db['ChatMessage'][_0xdf3c('0xa5')]({'where':_0x15322a[_0xdf3c('0x50')]})[_0xdf3c('0x18')](function(_0x1d4440){_0x3d9a1e[_0xdf3c('0xa5')]=_0x1d4440;_0x15322a[_0xdf3c('0xbe')]=[];if(_0x18e2f3[_0xdf3c('0x48')]['includeAgent']){_0x15322a[_0xdf3c('0xbe')]['push']({'model':db[_0xdf3c('0x7e')],'as':'User','attributes':['id',_0xdf3c('0xca'),_0xdf3c('0xf2')]});}if(_0x18e2f3['query']['includeAll']){_0x15322a[_0xdf3c('0xbe')]=[{'all':!![]}];}return db[_0xdf3c('0xd5')][_0xdf3c('0x109')](_0x15322a);})[_0xdf3c('0x18')](function(_0x310b34){_0x3d9a1e['rows']=_0x310b34;return _0x3d9a1e;});}})[_0xdf3c('0x18')](respondWithFilteredResult(_0x2269da,_0x15322a))[_0xdf3c('0x38')](handleError(_0x2269da,null));};exports[_0xdf3c('0x10c')]=function(_0x337945,_0x40944d){return db['ChatInteraction'][_0xdf3c('0x6b')]({'where':{'id':_0x337945['params']['id']}})[_0xdf3c('0x18')](handleEntityNotFound(_0x40944d,null))['then'](function(_0x5bf37b){if(_0x5bf37b){return _0x5bf37b[_0xdf3c('0x10d')](_0x337945[_0xdf3c('0x7f')][_0xdf3c('0x102')],_[_0xdf3c('0x103')](_0x337945[_0xdf3c('0x7f')],['ids','id'])||{})[_0xdf3c('0x10e')](function(){return db[_0xdf3c('0x7b')]['findAll']({'attributes':['id',_0xdf3c('0x2c'),_0xdf3c('0x54')],'where':{'id':_0x337945[_0xdf3c('0x7f')][_0xdf3c('0x102')]}});})[_0xdf3c('0x18')](function(_0x5e1788){socket[_0xdf3c('0x10f')](_0xdf3c('0x110'),{'id':Number(_0x337945[_0xdf3c('0xbc')]['id']),'tags':_0x5e1788||[]});return{'id':Number(_0x337945[_0xdf3c('0xbc')]['id']),'tags':_0x5e1788||[]};});}})[_0xdf3c('0x18')](respondWithResult(_0x40944d,null))['catch'](handleError(_0x40944d,null));};exports[_0xdf3c('0x111')]=function(_0x43fc55,_0x81b8dd){return db[_0xdf3c('0x42')][_0xdf3c('0x6b')]({'where':{'id':_0x43fc55[_0xdf3c('0xbc')]['id']}})[_0xdf3c('0x18')](handleEntityNotFound(_0x81b8dd,null))[_0xdf3c('0x18')](function(_0xb2e933){if(_0xb2e933){return _0xb2e933[_0xdf3c('0x111')](_0x43fc55[_0xdf3c('0x48')][_0xdf3c('0x102')]);}})[_0xdf3c('0x18')](respondWithStatusCode(_0x81b8dd,null))[_0xdf3c('0x38')](handleError(_0x81b8dd,null));};exports[_0xdf3c('0x112')]=function(_0x2be6c7,_0x18bbe0){var _0x174e96=moment()['unix']()[_0xdf3c('0xa4')]();var _0x350e07=path[_0xdf3c('0xe8')](config['root'],_0xdf3c('0x113'),'files',_0xdf3c('0x114'));var _0x4ac3d7=path[_0xdf3c('0xe8')](config[_0xdf3c('0xe4')],_0xdf3c('0x113'),_0xdf3c('0x115'),_0xdf3c('0x116'));var _0x227591=path[_0xdf3c('0xe8')](_0x350e07,_0x174e96);var _0x4642ca=util[_0xdf3c('0xea')]('transcript-%d-%s.zip',_0x2be6c7[_0xdf3c('0xbc')]['id'],_0x174e96);var _0x3e3d63=path[_0xdf3c('0xe8')](_0x350e07,_0x4642ca);var _0x2964ed=[];_0x2964ed['push']({'model':db['User'],'as':_0xdf3c('0x7e'),'attributes':['id',_0xdf3c('0xca')],'raw':!![]});_0x2964ed[_0xdf3c('0x37')]({'model':db[_0xdf3c('0xd8')],'as':'Contact','attributes':['id',_0xdf3c('0x117'),'lastName'],'raw':!![]});if(_0x2be6c7['query'][_0xdf3c('0x116')]){_0x2964ed[_0xdf3c('0x37')]({'model':db['Attachment'],'as':_0xdf3c('0xe2'),'raw':!![]});}var _0x19024e=[{'model':db['ChatMessage'],'as':_0xdf3c('0xec'),'attributes':['id',_0xdf3c('0x7f'),'createdAt',_0xdf3c('0x118'),_0xdf3c('0xf6'),_0xdf3c('0x88')],'include':_0x2964ed}];_0x19024e[_0xdf3c('0x37')]({'model':db[_0xdf3c('0xc4')],'as':_0xdf3c('0x119'),'attributes':['id','name']});_0x19024e['push']({'model':db[_0xdf3c('0x7e')],'as':_0xdf3c('0x11a'),'attributes':['id',_0xdf3c('0xca')]});return db[_0xdf3c('0x42')][_0xdf3c('0x6b')]({'where':{'id':_0x2be6c7[_0xdf3c('0xbc')]['id']},'include':_0x19024e})['then'](handleEntityNotFound(_0x18bbe0,null))[_0xdf3c('0x18')](function(_0x1605f1){if(_0x1605f1){var _0x3e7b1c=_0x1605f1[_0xdf3c('0x11b')]({'plain':!![]});fs['mkdirSync'](_0x227591);var _0x2f3248={'channel':_0xdf3c('0x11c'),'account':_0x3e7b1c['Account'][_0xdf3c('0x2c')],'agent':_0x3e7b1c[_0xdf3c('0x11a')]?_0x3e7b1c[_0xdf3c('0x11a')][_0xdf3c('0xca')]:'N.A.','createdAt':moment(_0x3e7b1c[_0xdf3c('0x83')])[_0xdf3c('0xea')](_0xdf3c('0x11d'))[_0xdf3c('0xa4')](),'closedAt':_0x3e7b1c['closed']?moment(_0x3e7b1c['closedAt'])[_0xdf3c('0xea')](_0xdf3c('0x11d'))[_0xdf3c('0xa4')]():'','disposition':_0x3e7b1c[_0xdf3c('0x3f')],'chatInfo':{'browser':_0x3e7b1c[_0xdf3c('0x11e')],'os':_0x3e7b1c[_0xdf3c('0x11f')],'referer':_0x3e7b1c[_0xdf3c('0x120')],'customerIp':_0x3e7b1c[_0xdf3c('0x121')],'customerPort':_0x3e7b1c['customerPort']?_0x3e7b1c[_0xdf3c('0x122')]:_0xdf3c('0x123')},'messages':_(_0x3e7b1c['Messages'])[_0xdf3c('0x124')]()[_0xdf3c('0x8c')]({'secret':![]})['map'](function(_0x3d497d){if(_0x3d497d['Attachment']){var _0x3c572d=path[_0xdf3c('0xe8')](_0x4ac3d7,_0x3d497d[_0xdf3c('0xe2')][_0xdf3c('0xdd')]);if(fs['existsSync'](_0x3c572d)){fs['createReadStream'](_0x3c572d)['pipe'](fs[_0xdf3c('0x125')](path[_0xdf3c('0xe8')](_0x227591,_0x3d497d[_0xdf3c('0xe2')][_0xdf3c('0xdd')])));}}return{'date':moment(_0x3d497d[_0xdf3c('0x83')])[_0xdf3c('0xea')](_0xdf3c('0x11d'))['toString'](),'sender':_0x3d497d[_0xdf3c('0x118')]===_0xdf3c('0x126')?_0x3d497d['User']?_0x3d497d[_0xdf3c('0x7e')]['fullname']:_0xdf3c('0xef'):_0x3d497d[_0xdf3c('0x71')][_0xdf3c('0x117')]+(_0x3d497d['Contact'][_0xdf3c('0x127')]?'\x20'+_0x3d497d[_0xdf3c('0x71')][_0xdf3c('0x127')]:''),'body':_0x3d497d[_0xdf3c('0xe2')]?_0x3d497d[_0xdf3c('0xe2')]['basename']:_0x3d497d[_0xdf3c('0x7f')],'direction':_0x3d497d[_0xdf3c('0x118')]===_0xdf3c('0x126')?'A':'C','secret':_0x3d497d[_0xdf3c('0xf6')],'read':_0x3d497d[_0xdf3c('0x88')],'attachment':_0x3d497d[_0xdf3c('0xe2')]};})[_0xdf3c('0x6d')]()};return ejs['renderFile'](path[_0xdf3c('0xe8')](config[_0xdf3c('0xe4')],_0xdf3c('0x113'),'views',_0xdf3c('0x128')),{'interaction':_0x2f3248})['then'](function(_0x200b6b){var _0x42d103=path['join'](_0x227591,_0xdf3c('0x129')+_0x3e7b1c['id']+'-'+_0x174e96+_0xdf3c('0x12a'));var _0x23ae7c={'path':_0x42d103,'channel':_0xdf3c('0x11c'),'interactionId':_0x3e7b1c['id']};return pdf[_0xdf3c('0x12b')](_0x200b6b,_0x23ae7c);})[_0xdf3c('0x18')](function(){return new Promise(function(_0x43057f,_0x429f2a){zipdir(_0x227591,{'saveTo':_0x3e3d63},function(_0x3d56cc,_0x34441a){if(_0x3d56cc)return _0x429f2a(_0x3d56cc);return _0x43057f(_0x34441a);});})[_0xdf3c('0x18')](function(){return new BPromise(function(_0x265d99,_0x59d1db){rimraf(_0x227591,function(_0x2888e3){if(_0x2888e3)_0x59d1db(_0x2888e3);return _0x265d99();});});})['then'](function(){return _0x18bbe0['download'](_0x3e3d63,_0x4642ca,function(_0x4a3bdd){if(_0x4a3bdd){logger['error'](_0xdf3c('0x12c'),_0x4a3bdd);}else{fs[_0xdf3c('0x12d')](_0x3e3d63);}});});});}else{return _0x18bbe0[_0xdf3c('0x2a')](0xc8);}})[_0xdf3c('0x38')](handleError(_0x18bbe0,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9eda2b1..0d7de70 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 _0x5ab0=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','emit','catch','hook','events'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5ab0,0x1ef));var _0x05ab=function(_0x131f6d,_0x5765ef){_0x131f6d=_0x131f6d-0x0;var _0x1741a8=_0x5ab0[_0x131f6d];return _0x1741a8;};'use strict';var EventEmitter=require(_0x05ab('0x0'));var ChatInteraction=require(_0x05ab('0x1'))['db'][_0x05ab('0x2')];var ChatMessage=require(_0x05ab('0x1'))['db'][_0x05ab('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x05ab('0x4')](0x0);var events={'afterCreate':_0x05ab('0x5'),'afterUpdate':_0x05ab('0x6'),'afterDestroy':_0x05ab('0x7')};function emitEvent(_0x30b733){return function(_0x315f52,_0x4de3bf,_0x3ebd7a){_0x315f52['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x24d45a){_0x315f52[_0x05ab('0x8')](_0x05ab('0x9'),_0x24d45a[_0x05ab('0xa')](function(_0x6cbc57){return{'id':_0x6cbc57['id']};}));return ChatMessage[_0x05ab('0xb')]({'where':{'ChatInteractionId':_0x315f52['id'],'direction':'in','read':![]},'raw':!![]});})[_0x05ab('0xc')](function(_0x1042de){_0x315f52[_0x05ab('0x8')]('unreadMessages',_0x1042de['length']);ChatInteractionEvents[_0x05ab('0xd')](_0x30b733+':'+_0x315f52['id'],_0x315f52);ChatInteractionEvents[_0x05ab('0xd')](_0x30b733,_0x315f52);_0x3ebd7a(null);})[_0x05ab('0xe')](_0x3ebd7a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x05ab('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x5b97=['getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b97,0x13c));var _0x75b9=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x5b97[_0xf0ec6e];return _0x8bbc27;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x75b9('0x0')];var ChatMessage=require(_0x75b9('0x1'))['db'][_0x75b9('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x75b9('0x3')](0x0);var events={'afterCreate':_0x75b9('0x4'),'afterUpdate':_0x75b9('0x5'),'afterDestroy':_0x75b9('0x6')};function emitEvent(_0x1deb07){return function(_0x59119d,_0x58784,_0x34d86b){_0x59119d[_0x75b9('0x7')]({'attributes':['id'],'raw':!![]})[_0x75b9('0x8')](function(_0xa4352){_0x59119d[_0x75b9('0x9')](_0x75b9('0xa'),_0xa4352['map'](function(_0x38491b){return{'id':_0x38491b['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x59119d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x75b9('0x8')](function(_0x520ec5){_0x59119d[_0x75b9('0x9')](_0x75b9('0xb'),_0x520ec5[_0x75b9('0xc')]);ChatInteractionEvents[_0x75b9('0xd')](_0x1deb07+':'+_0x59119d['id'],_0x59119d);ChatInteractionEvents[_0x75b9('0xd')](_0x1deb07,_0x59119d);_0x34d86b(null);})[_0x75b9('0xe')](_0x34d86b(null));};}for(var e in events){if(events[_0x75b9('0xf')](e)){var event=events[e];ChatInteraction[_0x75b9('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ace4c99..26d2f42 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 _0xee1d=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports','define','chat_interactions'];(function(_0x1308ec,_0x32c99e){var _0x1a43c8=function(_0x18ff62){while(--_0x18ff62){_0x1308ec['push'](_0x1308ec['shift']());}};_0x1a43c8(++_0x32c99e);}(_0xee1d,0x1b6));var _0xdee1=function(_0x54eef5,_0x2da6b4){_0x54eef5=_0x54eef5-0x0;var _0x342329=_0xee1d[_0x54eef5];return _0x342329;};'use strict';var _=require(_0xdee1('0x0'));var util=require(_0xdee1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdee1('0x2'));var BPromise=require(_0xdee1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdee1('0x4'));var rimraf=require(_0xdee1('0x5'));var config=require(_0xdee1('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xdee1('0x7')]=function(_0x5ccc94,_0x176c55){return _0x5ccc94[_0xdee1('0x8')]('ChatInteraction',attributes,{'tableName':_0xdee1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e134b,_0x15694c,_0x1c18a5){if(_0x3e134b[_0xdee1('0xa')]('closed')){_0x3e134b[_0xdee1('0xb')]=moment()[_0xdee1('0xc')](_0xdee1('0xd'));}_0x1c18a5(null,_0x3e134b);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2044=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','format','utf8mb4'];(function(_0x2df483,_0x44be77){var _0xa9049e=function(_0xaa74ff){while(--_0xaa74ff){_0x2df483['push'](_0x2df483['shift']());}};_0xa9049e(++_0x44be77);}(_0x2044,0xc1));var _0x4204=function(_0x1b1f15,_0x5569c9){_0x1b1f15=_0x1b1f15-0x0;var _0x21eb83=_0x2044[_0x1b1f15];return _0x21eb83;};'use strict';var _=require(_0x4204('0x0'));var util=require('util');var logger=require(_0x4204('0x1'))(_0x4204('0x2'));var moment=require(_0x4204('0x3'));var BPromise=require('bluebird');var rp=require(_0x4204('0x4'));var fs=require('fs');var path=require(_0x4204('0x5'));var rimraf=require(_0x4204('0x6'));var config=require(_0x4204('0x7'));var attributes=require(_0x4204('0x8'));module[_0x4204('0x9')]=function(_0x2972ea,_0x40b2b8){return _0x2972ea[_0x4204('0xa')]('ChatInteraction',attributes,{'tableName':_0x4204('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x518fc0,_0x1745fc,_0xc06c27){if(_0x518fc0[_0x4204('0xc')]('closed')){_0x518fc0['closedAt']=moment()[_0x4204('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0xc06c27(null,_0x518fc0);}},'charset':_0x4204('0xe'),'collate':_0x4204('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2dae279..a07a3f6 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 _0x7ebd=['ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','AddTagsToChatInteraction','find','where','addTags','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','defaults','redis','socket.io-emitter','register','request','info'];(function(_0x3d8857,_0x5777c8){var _0x26ee98=function(_0x357885){while(--_0x357885){_0x3d8857['push'](_0x3d8857['shift']());}};_0x26ee98(++_0x5777c8);}(_0x7ebd,0x159));var _0xd7eb=function(_0x47b504,_0x2b6163){_0x47b504=_0x47b504-0x0;var _0x16ffa9=_0x7ebd[_0x47b504];return _0x16ffa9;};'use strict';var _=require(_0xd7eb('0x0'));var util=require(_0xd7eb('0x1'));var moment=require(_0xd7eb('0x2'));var BPromise=require(_0xd7eb('0x3'));var rs=require(_0xd7eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd7eb('0x5'));var logger=require('../../config/logger')(_0xd7eb('0x6'));var config=require(_0xd7eb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd7eb('0x8')]({'port':0x232a});config['redis']=_[_0xd7eb('0x9')](config[_0xd7eb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7eb('0xb'))(new Redis(config[_0xd7eb('0xa')]));require('./chatInteraction.socket')[_0xd7eb('0xc')](socket);function respondWithRpcPromise(_0x1bb373,_0x54f3b7,_0x56e0d1){return new BPromise(function(_0x3efd44,_0x279c7e){return client[_0xd7eb('0xd')](_0x1bb373,_0x56e0d1)['then'](function(_0x4cb6e1){logger[_0xd7eb('0xe')](_0xd7eb('0xf'),_0x54f3b7,'request\x20sent');logger[_0xd7eb('0x10')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x54f3b7,_0xd7eb('0x11'),JSON[_0xd7eb('0x12')](_0x4cb6e1));if(_0x4cb6e1['error']){if(_0x4cb6e1[_0xd7eb('0x13')][_0xd7eb('0x14')]===0x1f4){logger[_0xd7eb('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x54f3b7,_0x4cb6e1[_0xd7eb('0x13')]['message']);return _0x279c7e(_0x4cb6e1['error'][_0xd7eb('0x15')]);}logger[_0xd7eb('0x13')](_0xd7eb('0xf'),_0x54f3b7,_0x4cb6e1[_0xd7eb('0x13')][_0xd7eb('0x15')]);return _0x3efd44(_0x4cb6e1['error'][_0xd7eb('0x15')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x54f3b7,_0xd7eb('0x11'));_0x3efd44(_0x4cb6e1['result'][_0xd7eb('0x15')]);}})[_0xd7eb('0x16')](function(_0x368b35){logger['error'](_0xd7eb('0xf'),_0x54f3b7,_0x368b35);_0x279c7e(_0x368b35);});});}exports[_0xd7eb('0x17')]=function(_0x131684){var _0x42ca46=this;return new Promise(function(_0x3dabf2,_0x383bce){return db[_0xd7eb('0x18')][_0xd7eb('0x19')](_0x131684[_0xd7eb('0x1a')],{'raw':_0x131684[_0xd7eb('0x1b')]?_0x131684['options'][_0xd7eb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x131684[_0xd7eb('0x1b')]?_0x131684['options']['where']||null:null,'attributes':_0x131684[_0xd7eb('0x1b')]?_0x131684['options'][_0xd7eb('0x1d')]||null:null,'limit':_0x131684[_0xd7eb('0x1b')]?_0x131684[_0xd7eb('0x1b')][_0xd7eb('0x1e')]||null:null})['then'](function(_0x58233e){logger[_0xd7eb('0xe')]('UpdateChatInteraction',_0x131684);logger[_0xd7eb('0x10')]('UpdateChatInteraction',_0x131684,JSON[_0xd7eb('0x12')](_0x58233e));_0x3dabf2(_0x58233e);})[_0xd7eb('0x16')](function(_0x526bf0){logger[_0xd7eb('0x13')]('UpdateChatInteraction',_0x526bf0[_0xd7eb('0x15')],_0x131684);_0x383bce(_0x42ca46[_0xd7eb('0x13')](0x1f4,_0x526bf0[_0xd7eb('0x15')]));});});};exports[_0xd7eb('0x1f')]=function(_0x5c9627){return new Promise(function(_0x2f4279,_0x465bd6){return db[_0xd7eb('0x18')][_0xd7eb('0x20')]({'where':_0x5c9627[_0xd7eb('0x1b')]?_0x5c9627[_0xd7eb('0x1b')][_0xd7eb('0x21')]||null:null})['then'](function(_0x59b12b){if(_0x59b12b){return _0x59b12b[_0xd7eb('0x22')](_0x5c9627[_0xd7eb('0x1a')]['ids'],_['omit'](_0x5c9627[_0xd7eb('0x1a')],['ids','id'])||{});}})['spread'](function(_0x1113f5){logger['info'](_0xd7eb('0x23'),_0x5c9627);logger[_0xd7eb('0x10')]('AddTags',_0x5c9627,JSON['stringify'](_0x1113f5));_0x2f4279(_0x1113f5);})['catch'](function(_0x199136){logger[_0xd7eb('0x13')]('AddTags',_0x199136['message'],_0x5c9627);_0x465bd6(_this[_0xd7eb('0x13')](0x1f4,_0x199136[_0xd7eb('0x15')]));});});}; \ No newline at end of file +var _0xed2b=['then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','ChatInteraction','update','body','options','where','attributes','limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request'];(function(_0x5c9d23,_0x3f6fb3){var _0x1112b2=function(_0x56f1c3){while(--_0x56f1c3){_0x5c9d23['push'](_0x5c9d23['shift']());}};_0x1112b2(++_0x3f6fb3);}(_0xed2b,0x19e));var _0xbed2=function(_0x1b944d,_0x14ac0f){_0x1b944d=_0x1b944d-0x0;var _0x1caddc=_0xed2b[_0x1b944d];return _0x1caddc;};'use strict';var _=require(_0xbed2('0x0'));var util=require(_0xbed2('0x1'));var moment=require('moment');var BPromise=require(_0xbed2('0x2'));var rs=require(_0xbed2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbed2('0x4'));var logger=require(_0xbed2('0x5'))('rpc');var config=require(_0xbed2('0x6'));var jayson=require(_0xbed2('0x7'));var client=jayson[_0xbed2('0x8')][_0xbed2('0x9')]({'port':0x232a});config[_0xbed2('0xa')]=_[_0xbed2('0xb')](config[_0xbed2('0xa')],{'host':_0xbed2('0xc'),'port':0x18eb});var socket=require(_0xbed2('0xd'))(new Redis(config[_0xbed2('0xa')]));require(_0xbed2('0xe'))['register'](socket);function respondWithRpcPromise(_0x809a87,_0x5ecfd0,_0x37bc47){return new BPromise(function(_0x4f490f,_0x45810e){return client[_0xbed2('0xf')](_0x809a87,_0x37bc47)[_0xbed2('0x10')](function(_0x5f149d){logger[_0xbed2('0x11')](_0xbed2('0x12'),_0x5ecfd0,'request\x20sent');logger[_0xbed2('0x13')](_0xbed2('0x14'),_0x5ecfd0,_0xbed2('0x15'),JSON['stringify'](_0x5f149d));if(_0x5f149d['error']){if(_0x5f149d['error'][_0xbed2('0x16')]===0x1f4){logger['error'](_0xbed2('0x12'),_0x5ecfd0,_0x5f149d[_0xbed2('0x17')][_0xbed2('0x18')]);return _0x45810e(_0x5f149d[_0xbed2('0x17')]['message']);}logger[_0xbed2('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x5ecfd0,_0x5f149d[_0xbed2('0x17')]['message']);return _0x4f490f(_0x5f149d['error'][_0xbed2('0x18')]);}else{logger[_0xbed2('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x5ecfd0,_0xbed2('0x15'));_0x4f490f(_0x5f149d[_0xbed2('0x19')][_0xbed2('0x18')]);}})[_0xbed2('0x1a')](function(_0x461965){logger[_0xbed2('0x17')](_0xbed2('0x12'),_0x5ecfd0,_0x461965);_0x45810e(_0x461965);});});}exports['UpdateChatInteraction']=function(_0x2f75f9){var _0x37ec2d=this;return new Promise(function(_0x4297ed,_0x1f2a73){return db[_0xbed2('0x1b')][_0xbed2('0x1c')](_0x2f75f9[_0xbed2('0x1d')],{'raw':_0x2f75f9['options']?_0x2f75f9[_0xbed2('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f75f9['options']?_0x2f75f9[_0xbed2('0x1e')][_0xbed2('0x1f')]||null:null,'attributes':_0x2f75f9[_0xbed2('0x1e')]?_0x2f75f9[_0xbed2('0x1e')][_0xbed2('0x20')]||null:null,'limit':_0x2f75f9[_0xbed2('0x1e')]?_0x2f75f9[_0xbed2('0x1e')][_0xbed2('0x21')]||null:null})[_0xbed2('0x10')](function(_0x592bae){logger['info'](_0xbed2('0x22'),_0x2f75f9);logger[_0xbed2('0x13')]('UpdateChatInteraction',_0x2f75f9,JSON[_0xbed2('0x23')](_0x592bae));_0x4297ed(_0x592bae);})[_0xbed2('0x1a')](function(_0x2b23a8){logger[_0xbed2('0x17')](_0xbed2('0x22'),_0x2b23a8[_0xbed2('0x18')],_0x2f75f9);_0x1f2a73(_0x37ec2d['error'](0x1f4,_0x2b23a8[_0xbed2('0x18')]));});});};exports[_0xbed2('0x24')]=function(_0x124dba){return new Promise(function(_0x14e4be,_0x5dd30d){return db[_0xbed2('0x1b')][_0xbed2('0x25')]({'where':_0x124dba['options']?_0x124dba[_0xbed2('0x1e')][_0xbed2('0x1f')]||null:null})[_0xbed2('0x10')](function(_0x14b482){if(_0x14b482){return _0x14b482[_0xbed2('0x26')](_0x124dba[_0xbed2('0x1d')][_0xbed2('0x27')],_[_0xbed2('0x28')](_0x124dba[_0xbed2('0x1d')],[_0xbed2('0x27'),'id'])||{});}})[_0xbed2('0x29')](function(_0x3d3de3){logger[_0xbed2('0x11')]('AddTags',_0x124dba);logger['debug'](_0xbed2('0x2a'),_0x124dba,JSON[_0xbed2('0x23')](_0x3d3de3));_0x14e4be(_0x3d3de3);})['catch'](function(_0x26459e){logger['error']('AddTags',_0x26459e['message'],_0x124dba);_0x5dd30d(_this[_0xbed2('0x17')](0x1f4,_0x26459e[_0xbed2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7faa5e0..9c18209 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 _0xa79a=['register','chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener'];(function(_0x53961f,_0x4533eb){var _0x42067f=function(_0x43422d){while(--_0x43422d){_0x53961f['push'](_0x53961f['shift']());}};_0x42067f(++_0x4533eb);}(_0xa79a,0x12f));var _0xaa79=function(_0x13d481,_0x17bc03){_0x13d481=_0x13d481-0x0;var _0x11de99=_0xa79a[_0x13d481];return _0x11de99;};'use strict';var ChatInteractionEvents=require(_0xaa79('0x0'));var events=['save',_0xaa79('0x1'),_0xaa79('0x2')];function createListener(_0x18ba57,_0x442e30){return function(_0x4e13cf){_0x442e30[_0xaa79('0x3')](_0x18ba57,_0x4e13cf);};}function removeListener(_0x12dd39,_0x29f871){return function(){ChatInteractionEvents[_0xaa79('0x4')](_0x12dd39,_0x29f871);};}exports[_0xaa79('0x5')]=function(_0x844d0c){for(var _0x4d456f=0x0,_0x257971=events['length'];_0x4d456f<_0x257971;_0x4d456f++){var _0x21ee25=events[_0x4d456f];var _0x3833ee=createListener(_0xaa79('0x6')+_0x21ee25,_0x844d0c);ChatInteractionEvents['on'](_0x21ee25,_0x3833ee);}}; \ No newline at end of file +var _0xf2ca=['emit','register','./chatInteraction.events','save','remove'];(function(_0x169bbb,_0x5aadf5){var _0x5d0db5=function(_0x7d77a5){while(--_0x7d77a5){_0x169bbb['push'](_0x169bbb['shift']());}};_0x5d0db5(++_0x5aadf5);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x232e7a,_0x19997){_0x232e7a=_0x232e7a-0x0;var _0x445ddd=_0xf2ca[_0x232e7a];return _0x445ddd;};'use strict';var ChatInteractionEvents=require(_0xaf2c('0x0'));var events=[_0xaf2c('0x1'),_0xaf2c('0x2'),'update'];function createListener(_0xbb7f52,_0x2102e2){return function(_0x1271a9){_0x2102e2[_0xaf2c('0x3')](_0xbb7f52,_0x1271a9);};}function removeListener(_0x3a724c,_0x10c910){return function(){ChatInteractionEvents['removeListener'](_0x3a724c,_0x10c910);};}exports[_0xaf2c('0x4')]=function(_0x100d17){for(var _0x297740=0x0,_0x1f9531=events['length'];_0x297740<_0x1f9531;_0x297740++){var _0x37fedd=events[_0x297740];var _0x3c0421=createListener('chatInteraction:'+_0x37fedd,_0x100d17);ChatInteractionEvents['on'](_0x37fedd,_0x3c0421);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b67fbc5..924bf75 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 _0xe09c=['diskStorage','join','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','removeTags','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','createVidaooSession'];(function(_0x2f922f,_0x34a14f){var _0x4a63d4=function(_0x251b57){while(--_0x251b57){_0x2f922f['push'](_0x2f922f['shift']());}};_0x4a63d4(++_0x34a14f);}(_0xe09c,0x123));var _0xce09=function(_0x1118d3,_0x15bb5f){_0x1118d3=_0x1118d3-0x0;var _0x190edc=_0xe09c[_0x1118d3];return _0x190edc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xce09('0x0'));var timeout=require(_0xce09('0x1'));var express=require(_0xce09('0x2'));var router=express[_0xce09('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce09('0x4'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0xce09('0x5')]('/',auth[_0xce09('0x6')](),controller[_0xce09('0x7')]);router[_0xce09('0x5')]('/describe',auth[_0xce09('0x6')](),controller[_0xce09('0x8')]);router[_0xce09('0x5')]('/:id',auth[_0xce09('0x9')](),controller[_0xce09('0xa')]);router['get'](_0xce09('0xb'),auth['isChatInteractionAuthorized'](),controller[_0xce09('0xc')]);router[_0xce09('0x5')](_0xce09('0xd'),auth[_0xce09('0x6')](),controller[_0xce09('0xe')]);router[_0xce09('0x5')](_0xce09('0xf'),auth[_0xce09('0x9')](),controller[_0xce09('0x10')]);router[_0xce09('0x5')](_0xce09('0x11'),auth[_0xce09('0x6')](),controller[_0xce09('0x12')]);router[_0xce09('0x13')]('/',auth[_0xce09('0x6')](),controller['create']);router[_0xce09('0x13')]('/:id/vidaoo',auth[_0xce09('0x6')](),controller[_0xce09('0x14')]);var upload=multer({'storage':multer[_0xce09('0x15')]({'destination':function(_0x1a2de8,_0x4945dc,_0x5813ef){_0x5813ef(null,path[_0xce09('0x16')](config[_0xce09('0x17')],_0xce09('0x18')));},'filename':function(_0x2a1b45,_0x349029,_0x130492){_0x130492(null,util[_0xce09('0x19')]('%s-%s',Date['now'](),_0x349029[_0xce09('0x1a')][_0xce09('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xce09('0x13')](_0xce09('0x1c'),upload[_0xce09('0x1d')](_0xce09('0x1e')),controller[_0xce09('0x1f')]);router[_0xce09('0x13')](_0xce09('0xd'),auth[_0xce09('0x9')](),controller[_0xce09('0x20')]);router[_0xce09('0x13')](_0xce09('0x21'),auth[_0xce09('0x6')](),interaction[_0xce09('0x22')]('chat',_0xce09('0x23')),controller[_0xce09('0x24')]);router[_0xce09('0x25')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xce09('0x26'),_0xce09('0x27')),controller[_0xce09('0x28')]);router[_0xce09('0x25')](_0xce09('0x29'),controller[_0xce09('0x2a')]);router[_0xce09('0x25')](_0xce09('0x2b'),auth[_0xce09('0x9')](),controller[_0xce09('0x2c')]);router['put'](_0xce09('0x2d'),controller[_0xce09('0x2e')]);router[_0xce09('0x2f')](_0xce09('0x30'),auth[_0xce09('0x6')](),interaction[_0xce09('0x22')]('chat',_0xce09('0x31')),controller[_0xce09('0x32')]);router[_0xce09('0x2f')](_0xce09('0x21'),auth[_0xce09('0x6')](),controller[_0xce09('0x33')]);module['exports']=router; \ No newline at end of file +var _0x7262=['./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0xb2dc0b,_0x5acdd0){var _0x214158=function(_0x2a0137){while(--_0x2a0137){_0xb2dc0b['push'](_0xb2dc0b['shift']());}};_0x214158(++_0x5acdd0);}(_0x7262,0x94));var _0x2726=function(_0x6b6fa3,_0x4a5b16){_0x6b6fa3=_0x6b6fa3-0x0;var _0x3b8cbb=_0x7262[_0x6b6fa3];return _0x3b8cbb;};'use strict';var multer=require('multer');var util=require(_0x2726('0x0'));var path=require(_0x2726('0x1'));var timeout=require(_0x2726('0x2'));var express=require('express');var router=express[_0x2726('0x3')]();var fs_extra=require(_0x2726('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2726('0x5'));router['get']('/',auth[_0x2726('0x6')](),controller[_0x2726('0x7')]);router[_0x2726('0x8')](_0x2726('0x9'),auth['isAuthenticated'](),controller[_0x2726('0xa')]);router['get'](_0x2726('0xb'),auth[_0x2726('0xc')](),controller[_0x2726('0xd')]);router[_0x2726('0x8')]('/:id/attachment_download',auth[_0x2726('0xc')](),controller[_0x2726('0xe')]);router[_0x2726('0x8')](_0x2726('0xf'),auth[_0x2726('0x6')](),controller['getMessages']);router[_0x2726('0x8')](_0x2726('0x10'),auth[_0x2726('0xc')](),controller[_0x2726('0x11')]);router[_0x2726('0x8')](_0x2726('0x12'),auth[_0x2726('0x6')](),controller['download']);router[_0x2726('0x13')]('/',auth[_0x2726('0x6')](),controller[_0x2726('0x14')]);router['post'](_0x2726('0x15'),auth[_0x2726('0x6')](),controller[_0x2726('0x16')]);var upload=multer({'storage':multer[_0x2726('0x17')]({'destination':function(_0x372e2d,_0xce0da,_0x2debc9){_0x2debc9(null,path[_0x2726('0x18')](config[_0x2726('0x19')],'server/files/attachments/'));},'filename':function(_0x5e8491,_0x485f4e,_0x28f375){_0x28f375(null,util[_0x2726('0x1a')](_0x2726('0x1b'),Date[_0x2726('0x1c')](),_0x485f4e[_0x2726('0x1d')][_0x2726('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2726('0x13')](_0x2726('0x1f'),upload[_0x2726('0x20')](_0x2726('0x21')),controller[_0x2726('0x22')]);router[_0x2726('0x13')](_0x2726('0xf'),auth[_0x2726('0xc')](),controller[_0x2726('0x23')]);router[_0x2726('0x13')](_0x2726('0x24'),auth['isAuthenticated'](),interaction[_0x2726('0x25')](_0x2726('0x26'),_0x2726('0x27')),controller[_0x2726('0x28')]);router['put'](_0x2726('0xb'),auth[_0x2726('0x6')](),interaction[_0x2726('0x25')](_0x2726('0x26'),_0x2726('0x29')),controller[_0x2726('0x2a')]);router['put']('/:id/custom_update',controller['customUpdate']);router[_0x2726('0x2b')](_0x2726('0x2c'),auth['isChatInteractionAuthorized'](),controller[_0x2726('0x2d')]);router[_0x2726('0x2b')](_0x2726('0x2e'),controller[_0x2726('0x2f')]);router[_0x2726('0x30')](_0x2726('0xb'),auth[_0x2726('0x6')](),interaction[_0x2726('0x25')](_0x2726('0x26'),_0x2726('0x31')),controller[_0x2726('0x32')]);router['delete'](_0x2726('0x24'),auth[_0x2726('0x6')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index da11504..ae69f82 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 _0xd787=['INTEGER','sequelize','TEXT','medium','BOOLEAN'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0xd787,0x1a0));var _0x7d78=function(_0x46d4c1,_0x2d0dca){_0x46d4c1=_0x46d4c1-0x0;var _0xf2a962=_0xd787[_0x46d4c1];return _0xf2a962;};'use strict';var Sequelize=require(_0x7d78('0x0'));module['exports']={'body':{'type':Sequelize[_0x7d78('0x1')](_0x7d78('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7d78('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7d78('0x4')]}}; \ No newline at end of file +var _0x1259=['sequelize','exports','BOOLEAN','INTEGER'];(function(_0x4b355a,_0x5b0b84){var _0x382753=function(_0x442ee5){while(--_0x442ee5){_0x4b355a['push'](_0x4b355a['shift']());}};_0x382753(++_0x5b0b84);}(_0x1259,0x9c));var _0x9125=function(_0x2f5943,_0xba490b){_0x2f5943=_0x2f5943-0x0;var _0x465b7b=_0x1259[_0x2f5943];return _0x465b7b;};'use strict';var Sequelize=require(_0x9125('0x0'));module[_0x9125('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9125('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9125('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 0a1bdad..d9c1fff 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 _0x5a4d=['isEmpty','agent','resourceId','push','FromId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','map','options','rows','catch','show','params','includeAll','include','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource'];(function(_0xd27ded,_0x1164e2){var _0x5ef850=function(_0x582e7d){while(--_0x582e7d){_0xd27ded['push'](_0xd27ded['shift']());}};_0x5ef850(++_0x1164e2);}(_0x5a4d,0x15e));var _0xd5a4=function(_0x35b6ab,_0x3992e8){_0x35b6ab=_0x35b6ab-0x0;var _0x3a7697=_0x5a4d[_0x35b6ab];return _0x3a7697;};'use strict';var emlformat=require(_0xd5a4('0x0'));var rimraf=require(_0xd5a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5a4('0x2'));var rp=require('request-promise');var moment=require(_0xd5a4('0x3'));var BPromise=require(_0xd5a4('0x4'));var Mustache=require(_0xd5a4('0x5'));var util=require(_0xd5a4('0x6'));var path=require('path');var sox=require(_0xd5a4('0x7'));var csv=require('to-csv');var ejs=require(_0xd5a4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5a4('0x9'));var squel=require(_0xd5a4('0xa'));var crypto=require(_0xd5a4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd5a4('0xc'));var toCsv=require(_0xd5a4('0xd'));var querystring=require(_0xd5a4('0xe'));var Papa=require(_0xd5a4('0xf'));var Redis=require('ioredis');var authService=require(_0xd5a4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd5a4('0x11'));var hardwareService=require(_0xd5a4('0x12'));var logger=require(_0xd5a4('0x13'))('api');var utils=require(_0xd5a4('0x14'));var config=require(_0xd5a4('0x15'));var licenseUtil=require(_0xd5a4('0x16'));var db=require(_0xd5a4('0x17'))['db'];config[_0xd5a4('0x18')]=_['defaults'](config[_0xd5a4('0x18')],{'host':_0xd5a4('0x19'),'port':0x18eb});var socket=require(_0xd5a4('0x1a'))(new Redis(config[_0xd5a4('0x18')]));require('./chatInternalMessage.socket')[_0xd5a4('0x1b')](socket);function respondWithStatusCode(_0x106304,_0x511641){_0x511641=_0x511641||0xcc;return function(_0x13ea20){if(_0x13ea20){return _0x106304[_0xd5a4('0x1c')](_0x511641);}return _0x106304[_0xd5a4('0x1d')](_0x511641)[_0xd5a4('0x1e')]();};}function respondWithResult(_0x57b254,_0xb1eafc){_0xb1eafc=_0xb1eafc||0xc8;return function(_0x500846){if(_0x500846){return _0x57b254['status'](_0xb1eafc)[_0xd5a4('0x1f')](_0x500846);}};}function respondWithFilteredResult(_0x102c59,_0x283d70){return function(_0xf188c9){if(_0xf188c9){var _0xfae717=typeof _0x283d70[_0xd5a4('0x20')]===_0xd5a4('0x21')&&typeof _0x283d70[_0xd5a4('0x22')]==='undefined';var _0x4a8395=_0xf188c9[_0xd5a4('0x23')];var _0x5f4517=_0xfae717?0x0:_0x283d70[_0xd5a4('0x20')];var _0x3e35cd=_0xfae717?_0xf188c9['count']:_0x283d70[_0xd5a4('0x20')]+_0x283d70[_0xd5a4('0x22')];var _0x3ca2fb;if(_0x3e35cd>=_0x4a8395){_0x3e35cd=_0x4a8395;_0x3ca2fb=0xc8;}else{_0x3ca2fb=0xce;}_0x102c59[_0xd5a4('0x1d')](_0x3ca2fb);return _0x102c59[_0xd5a4('0x24')](_0xd5a4('0x25'),_0x5f4517+'-'+_0x3e35cd+'/'+_0x4a8395)['json'](_0xf188c9);}return null;};}function patchUpdates(_0x15c5c2){return function(_0x287fd8){try{jsonpatch[_0xd5a4('0x26')](_0x287fd8,_0x15c5c2,!![]);}catch(_0x132893){return BPromise[_0xd5a4('0x27')](_0x132893);}return _0x287fd8[_0xd5a4('0x28')]();};}function saveUpdates(_0x3d337b,_0x5a042c){return function(_0x4fe350){if(_0x4fe350){return _0x4fe350[_0xd5a4('0x29')](_0x3d337b)[_0xd5a4('0x2a')](function(_0x3861f4){return _0x3861f4;});}return null;};}function removeEntity(_0x57bc22,_0x5ab317){return function(_0x3498ca){if(_0x3498ca){return _0x3498ca['destroy']()[_0xd5a4('0x2a')](function(){_0x57bc22[_0xd5a4('0x1d')](0xcc)[_0xd5a4('0x1e')]();});}};}function handleEntityNotFound(_0x34a756,_0x5fa1b0){return function(_0x46bcd9){if(!_0x46bcd9){_0x34a756[_0xd5a4('0x1c')](0x194);}return _0x46bcd9;};}function handleError(_0x5bee7a,_0x379086){_0x379086=_0x379086||0x1f4;return function(_0x3b4586){logger[_0xd5a4('0x2b')](_0x3b4586[_0xd5a4('0x2c')]);if(_0x3b4586[_0xd5a4('0x2d')]){delete _0x3b4586[_0xd5a4('0x2d')];}_0x5bee7a[_0xd5a4('0x1d')](_0x379086)[_0xd5a4('0x2e')](_0x3b4586);};}exports['index']=function(_0x115c46,_0x573873){var _0x3d46dc={},_0x47c75f={},_0x2a4f59={'count':0x0,'rows':[]};var _0x329bf8=_['map'](db[_0xd5a4('0x2f')][_0xd5a4('0x30')],function(_0x581df2){return{'name':_0x581df2[_0xd5a4('0x31')],'type':_0x581df2['type'][_0xd5a4('0x32')]};});_0x47c75f[_0xd5a4('0x33')]=_['map'](_0x329bf8,_0xd5a4('0x2d'));_0x47c75f[_0xd5a4('0x34')]=_[_0xd5a4('0x35')](_0x115c46[_0xd5a4('0x34')]);_0x47c75f['filters']=_[_0xd5a4('0x36')](_0x47c75f['model'],_0x47c75f[_0xd5a4('0x34')]);_0x3d46dc[_0xd5a4('0x37')]=_[_0xd5a4('0x36')](_0x47c75f[_0xd5a4('0x33')],qs['fields'](_0x115c46[_0xd5a4('0x34')][_0xd5a4('0x38')]));_0x3d46dc[_0xd5a4('0x37')]=_0x3d46dc[_0xd5a4('0x37')][_0xd5a4('0x39')]?_0x3d46dc[_0xd5a4('0x37')]:_0x47c75f['model'];if(!_0x115c46[_0xd5a4('0x34')]['hasOwnProperty'](_0xd5a4('0x3a'))){_0x3d46dc['limit']=qs[_0xd5a4('0x22')](_0x115c46[_0xd5a4('0x34')][_0xd5a4('0x22')]);_0x3d46dc[_0xd5a4('0x20')]=qs[_0xd5a4('0x20')](_0x115c46[_0xd5a4('0x34')][_0xd5a4('0x20')]);}_0x3d46dc[_0xd5a4('0x3b')]=qs[_0xd5a4('0x3c')](_0x115c46[_0xd5a4('0x34')]['sort']);_0x3d46dc[_0xd5a4('0x3d')]=qs[_0xd5a4('0x3e')](_[_0xd5a4('0x3f')](_0x115c46[_0xd5a4('0x34')],_0x47c75f['filters']),_0x329bf8);if(_0x115c46[_0xd5a4('0x34')][_0xd5a4('0x40')]){_0x3d46dc[_0xd5a4('0x3d')]=_[_0xd5a4('0x41')](_0x3d46dc['where'],{'$or':_[_0xd5a4('0x42')](_0x329bf8,function(_0x23000d){if(_0x23000d['type']!=='VIRTUAL'){var _0x23a7b8={};_0x23a7b8[_0x23000d['name']]={'$like':'%'+_0x115c46[_0xd5a4('0x34')]['filter']+'%'};return _0x23a7b8;}})});}_0x3d46dc=_['merge']({},_0x3d46dc,_0x115c46[_0xd5a4('0x43')]);var _0xa435ef={'where':_0x3d46dc[_0xd5a4('0x3d')]};return db[_0xd5a4('0x2f')][_0xd5a4('0x23')](_0xa435ef)['then'](function(_0x1a8333){_0x2a4f59[_0xd5a4('0x23')]=_0x1a8333;if(_0x115c46[_0xd5a4('0x34')]['includeAll']){_0x3d46dc['include']=[{'all':!![]}];}return db[_0xd5a4('0x2f')]['findAll'](_0x3d46dc);})['then'](function(_0x5e24d7){_0x2a4f59[_0xd5a4('0x44')]=_0x5e24d7;return _0x2a4f59;})[_0xd5a4('0x2a')](respondWithFilteredResult(_0x573873,_0x3d46dc))[_0xd5a4('0x45')](handleError(_0x573873,null));};exports[_0xd5a4('0x46')]=function(_0x4b61c0,_0x318777){var _0x55075b={'raw':!![],'where':{'id':_0x4b61c0[_0xd5a4('0x47')]['id']}},_0x3ff601={};_0x3ff601[_0xd5a4('0x33')]=_[_0xd5a4('0x35')](db[_0xd5a4('0x2f')][_0xd5a4('0x30')]);_0x3ff601['query']=_[_0xd5a4('0x35')](_0x4b61c0['query']);_0x3ff601[_0xd5a4('0x3e')]=_[_0xd5a4('0x36')](_0x3ff601['model'],_0x3ff601[_0xd5a4('0x34')]);_0x55075b[_0xd5a4('0x37')]=_['intersection'](_0x3ff601[_0xd5a4('0x33')],qs[_0xd5a4('0x38')](_0x4b61c0['query']['fields']));_0x55075b[_0xd5a4('0x37')]=_0x55075b[_0xd5a4('0x37')][_0xd5a4('0x39')]?_0x55075b[_0xd5a4('0x37')]:_0x3ff601['model'];if(_0x4b61c0[_0xd5a4('0x34')][_0xd5a4('0x48')]){_0x55075b[_0xd5a4('0x49')]=[{'all':!![]}];}_0x55075b=_['merge']({},_0x55075b,_0x4b61c0[_0xd5a4('0x43')]);return db[_0xd5a4('0x2f')][_0xd5a4('0x4a')](_0x55075b)['then'](handleEntityNotFound(_0x318777,null))['then'](respondWithResult(_0x318777,null))['catch'](handleError(_0x318777,null));};exports[_0xd5a4('0x4b')]=function(_0x1c6832,_0x2c2a2f){return db[_0xd5a4('0x2f')][_0xd5a4('0x4b')](_0x1c6832[_0xd5a4('0x4c')],{})[_0xd5a4('0x2a')](respondWithResult(_0x2c2a2f,0xc9))['catch'](handleError(_0x2c2a2f,null));};exports[_0xd5a4('0x29')]=function(_0x1bdc02,_0x282b61){if(_0x1bdc02[_0xd5a4('0x4c')]['id']){delete _0x1bdc02[_0xd5a4('0x4c')]['id'];}return db[_0xd5a4('0x2f')]['find']({'where':{'id':_0x1bdc02['params']['id']}})[_0xd5a4('0x2a')](handleEntityNotFound(_0x282b61,null))['then'](saveUpdates(_0x1bdc02[_0xd5a4('0x4c')],null))[_0xd5a4('0x2a')](respondWithResult(_0x282b61,null))[_0xd5a4('0x45')](handleError(_0x282b61,null));};exports[_0xd5a4('0x4d')]=function(_0x1f762e,_0x2e0b1f){return db['ChatInternalMessage'][_0xd5a4('0x4a')]({'where':{'id':_0x1f762e['params']['id']}})[_0xd5a4('0x2a')](handleEntityNotFound(_0x2e0b1f,null))[_0xd5a4('0x2a')](removeEntity(_0x2e0b1f,null))[_0xd5a4('0x45')](handleError(_0x2e0b1f,null));};exports[_0xd5a4('0x4e')]=function(_0x30bd63,_0x339fe6){return db['ChatInternalMessage'][_0xd5a4('0x4e')]()[_0xd5a4('0x2a')](respondWithResult(_0x339fe6,null))[_0xd5a4('0x45')](handleError(_0x339fe6,null));};function wrapUser(_0x1adf89){return function(_0x418060){var _0x408099=_0x1adf89[_0xd5a4('0x4f')]({'plain':!![]});_0x408099[_0xd5a4('0x50')]=[];if(_0x418060){_0x408099[_0xd5a4('0x51')]=_0x418060[_0xd5a4('0x52')];_0x408099[_0xd5a4('0x53')]=_0x418060;}else{_0x408099['lastMessageAt']=moment(0x0)[_0xd5a4('0x54')](_0xd5a4('0x55'));_0x408099[_0xd5a4('0x53')]={};}return _0x408099;};}exports[_0xd5a4('0x56')]=function(_0x25c931,_0x433a18,_0x53edf2){var _0x14b1fc=[];return db[_0xd5a4('0x57')][_0xd5a4('0x58')]({'where':{'role':['agent',_0xd5a4('0x59'),_0xd5a4('0x5a')]},'attributes':['id',_0xd5a4('0x5b'),'name',_0xd5a4('0x5c'),_0xd5a4('0x5d'),_0xd5a4('0x5e'),'online',_0xd5a4('0x5f'),_0xd5a4('0x60'),_0xd5a4('0x61')],'order':qs[_0xd5a4('0x3c')]('-online'),'include':[{'model':db[_0xd5a4('0x62')],'as':_0xd5a4('0x63'),'attributes':['id',_0xd5a4('0x2d'),_0xd5a4('0x64')],'through':{'attributes':[]}}]})[_0xd5a4('0x2a')](function(_0x40a2b5){if(_0x40a2b5){var _0x15e3a9=_0x25c931['user'][_0xd5a4('0x4f')]({'plain':!![]});if(!_0x15e3a9)throw new Error(_0xd5a4('0x65'));if(_0x15e3a9[_0xd5a4('0x5c')]===_0xd5a4('0x5a')){return db[_0xd5a4('0x66')][_0xd5a4('0x4a')]({'where':{'name':_0xd5a4('0x67'),'userProfileId':_0x15e3a9[_0xd5a4('0x68')]},'raw':!![]})[_0xd5a4('0x2a')](function(_0x4ec04e){if(_0x4ec04e){if(_0x4ec04e['autoAssociation']===0x0){return db[_0xd5a4('0x69')]['findAll']({'where':{'sectionId':_0x4ec04e['id']},'raw':!![]})[_0xd5a4('0x2a')](function(_0xae3ca7){var _0x2e2bbd=[];if(_[_0xd5a4('0x6a')](_0xae3ca7)){_0x2e2bbd=_['filter'](_0x40a2b5,function(_0x2d09b1){if(_0x2d09b1[_0xd5a4('0x5c')]!==_0xd5a4('0x6b')){return _0x2d09b1;}});return _0x2e2bbd;}else{for(var _0x59ae7e=0x0;_0x59ae7e<_0x40a2b5[_0xd5a4('0x39')];_0x59ae7e++){var _0x37f566=_0x40a2b5[_0x59ae7e];if(_0x37f566[_0xd5a4('0x5c')]===_0xd5a4('0x6b')){var _0x30c563=_[_0xd5a4('0x4a')](_0xae3ca7,function(_0x474efa){return _0x474efa[_0xd5a4('0x6c')]===_0x37f566['id'];});if(_0x30c563)_0x2e2bbd[_0xd5a4('0x6d')](_0x37f566);}else{_0x2e2bbd[_0xd5a4('0x6d')](_0x37f566);}}return _0x2e2bbd;}});}else{return _0x40a2b5;}}else{var _0x159439=_['filter'](_0x40a2b5,function(_0x4a7046){if(_0x4a7046[_0xd5a4('0x5c')]!=='agent'){return _0x4a7046;}});return _0x159439;}});}else{return _0x40a2b5;}}})[_0xd5a4('0x2a')](function(_0x58c15a){var _0x2d83df=[];if(_0x58c15a){_0x14b1fc=_0x58c15a;for(var _0x359f17=0x0;_0x359f17<_0x58c15a[_0xd5a4('0x39')];_0x359f17+=0x1){_0x14b1fc[_0x359f17][_0xd5a4('0x50')]=[];_0x2d83df['push'](db[_0xd5a4('0x2f')][_0xd5a4('0x4a')]({'where':{'FromId':[_0x25c931['user']['id'],_0x58c15a[_0x359f17]['id']],'ToId':[_0x25c931['user']['id'],_0x58c15a[_0x359f17]['id']],'ChatGroupId':null},'attributes':['id',_0xd5a4('0x52'),_0xd5a4('0x6e'),'ToId',_0xd5a4('0x6f'),_0xd5a4('0x4c')],'order':qs[_0xd5a4('0x3c')](_0xd5a4('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd5a4('0x2a')](wrapUser(_0x58c15a[_0x359f17])));}return BPromise[_0xd5a4('0x71')](_0x2d83df);}return[];})['then'](function(_0x59f44b){return{'rows':_0x59f44b,'count':_0x59f44b[_0xd5a4('0x39')]};})[_0xd5a4('0x2a')](respondWithResult(_0x433a18,null))[_0xd5a4('0x45')](handleError(_0x433a18,null));}; \ No newline at end of file +var _0x8158=['fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','count','set','save','update','then','destroy','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','fields','length','options','find','catch','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4ce684,_0x4b9f3e){var _0x423a96=function(_0x3b8f86){while(--_0x3b8f86){_0x4ce684['push'](_0x4ce684['shift']());}};_0x423a96(++_0x4b9f3e);}(_0x8158,0x1b8));var _0x8815=function(_0x57d678,_0x250ba9){_0x57d678=_0x57d678-0x0;var _0x15d2a4=_0x8158[_0x57d678];return _0x15d2a4;};'use strict';var emlformat=require(_0x8815('0x0'));var rimraf=require(_0x8815('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8815('0x2'));var rp=require(_0x8815('0x3'));var moment=require(_0x8815('0x4'));var BPromise=require(_0x8815('0x5'));var Mustache=require(_0x8815('0x6'));var util=require(_0x8815('0x7'));var path=require(_0x8815('0x8'));var sox=require(_0x8815('0x9'));var csv=require(_0x8815('0xa'));var ejs=require(_0x8815('0xb'));var fs=require('fs');var fs_extra=require(_0x8815('0xc'));var _=require(_0x8815('0xd'));var squel=require(_0x8815('0xe'));var crypto=require('crypto');var jsforce=require(_0x8815('0xf'));var deskjs=require(_0x8815('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8815('0x11'));var Redis=require('ioredis');var authService=require(_0x8815('0x12'));var qs=require(_0x8815('0x13'));var as=require(_0x8815('0x14'));var hardwareService=require(_0x8815('0x15'));var logger=require(_0x8815('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8815('0x17'));var db=require(_0x8815('0x18'))['db'];config[_0x8815('0x19')]=_[_0x8815('0x1a')](config[_0x8815('0x19')],{'host':_0x8815('0x1b'),'port':0x18eb});var socket=require(_0x8815('0x1c'))(new Redis(config[_0x8815('0x19')]));require(_0x8815('0x1d'))[_0x8815('0x1e')](socket);function respondWithStatusCode(_0x538edc,_0x2f519c){_0x2f519c=_0x2f519c||0xcc;return function(_0x5e5f99){if(_0x5e5f99){return _0x538edc[_0x8815('0x1f')](_0x2f519c);}return _0x538edc['status'](_0x2f519c)[_0x8815('0x20')]();};}function respondWithResult(_0x2f268e,_0x2a4c83){_0x2a4c83=_0x2a4c83||0xc8;return function(_0x427a96){if(_0x427a96){return _0x2f268e[_0x8815('0x21')](_0x2a4c83)[_0x8815('0x22')](_0x427a96);}};}function respondWithFilteredResult(_0x2aa465,_0x599365){return function(_0x1c84cd){if(_0x1c84cd){var _0x551e52=typeof _0x599365[_0x8815('0x23')]==='undefined'&&typeof _0x599365['limit']==='undefined';var _0x2b9090=_0x1c84cd['count'];var _0x469ccb=_0x551e52?0x0:_0x599365[_0x8815('0x23')];var _0x3f782a=_0x551e52?_0x1c84cd[_0x8815('0x24')]:_0x599365['offset']+_0x599365['limit'];var _0x586d1b;if(_0x3f782a>=_0x2b9090){_0x3f782a=_0x2b9090;_0x586d1b=0xc8;}else{_0x586d1b=0xce;}_0x2aa465['status'](_0x586d1b);return _0x2aa465[_0x8815('0x25')]('Content-Range',_0x469ccb+'-'+_0x3f782a+'/'+_0x2b9090)[_0x8815('0x22')](_0x1c84cd);}return null;};}function patchUpdates(_0x44e647){return function(_0x4a2220){try{jsonpatch['apply'](_0x4a2220,_0x44e647,!![]);}catch(_0x5d7752){return BPromise['reject'](_0x5d7752);}return _0x4a2220[_0x8815('0x26')]();};}function saveUpdates(_0xe5f5f0,_0x21c40b){return function(_0x3808a3){if(_0x3808a3){return _0x3808a3[_0x8815('0x27')](_0xe5f5f0)[_0x8815('0x28')](function(_0x530f3a){return _0x530f3a;});}return null;};}function removeEntity(_0x508a2c,_0x4a391a){return function(_0x366fa6){if(_0x366fa6){return _0x366fa6[_0x8815('0x29')]()[_0x8815('0x28')](function(){_0x508a2c[_0x8815('0x21')](0xcc)[_0x8815('0x20')]();});}};}function handleEntityNotFound(_0x428230,_0x4f1379){return function(_0x5b391b){if(!_0x5b391b){_0x428230[_0x8815('0x1f')](0x194);}return _0x5b391b;};}function handleError(_0x5567a1,_0x450b4f){_0x450b4f=_0x450b4f||0x1f4;return function(_0x24c5fa){logger[_0x8815('0x2a')](_0x24c5fa['stack']);if(_0x24c5fa[_0x8815('0x2b')]){delete _0x24c5fa['name'];}_0x5567a1[_0x8815('0x21')](_0x450b4f)[_0x8815('0x2c')](_0x24c5fa);};}exports[_0x8815('0x2d')]=function(_0x2a11f5,_0x2594a5){var _0x51ce18={},_0x5bea88={},_0x4476fd={'count':0x0,'rows':[]};var _0x5d2f70=_[_0x8815('0x2e')](db[_0x8815('0x2f')][_0x8815('0x30')],function(_0x34a650){return{'name':_0x34a650[_0x8815('0x31')],'type':_0x34a650[_0x8815('0x32')][_0x8815('0x33')]};});_0x5bea88['model']=_[_0x8815('0x2e')](_0x5d2f70,_0x8815('0x2b'));_0x5bea88['query']=_['keys'](_0x2a11f5[_0x8815('0x34')]);_0x5bea88[_0x8815('0x35')]=_[_0x8815('0x36')](_0x5bea88['model'],_0x5bea88['query']);_0x51ce18[_0x8815('0x37')]=_[_0x8815('0x36')](_0x5bea88['model'],qs['fields'](_0x2a11f5[_0x8815('0x34')]['fields']));_0x51ce18[_0x8815('0x37')]=_0x51ce18[_0x8815('0x37')]['length']?_0x51ce18[_0x8815('0x37')]:_0x5bea88[_0x8815('0x38')];if(!_0x2a11f5[_0x8815('0x34')][_0x8815('0x39')](_0x8815('0x3a'))){_0x51ce18[_0x8815('0x3b')]=qs[_0x8815('0x3b')](_0x2a11f5[_0x8815('0x34')][_0x8815('0x3b')]);_0x51ce18['offset']=qs[_0x8815('0x23')](_0x2a11f5[_0x8815('0x34')][_0x8815('0x23')]);}_0x51ce18[_0x8815('0x3c')]=qs[_0x8815('0x3d')](_0x2a11f5[_0x8815('0x34')][_0x8815('0x3d')]);_0x51ce18['where']=qs[_0x8815('0x35')](_[_0x8815('0x3e')](_0x2a11f5[_0x8815('0x34')],_0x5bea88[_0x8815('0x35')]),_0x5d2f70);if(_0x2a11f5['query'][_0x8815('0x3f')]){_0x51ce18[_0x8815('0x40')]=_[_0x8815('0x41')](_0x51ce18[_0x8815('0x40')],{'$or':_[_0x8815('0x2e')](_0x5d2f70,function(_0x181857){if(_0x181857[_0x8815('0x32')]!==_0x8815('0x42')){var _0x8d6269={};_0x8d6269[_0x181857[_0x8815('0x2b')]]={'$like':'%'+_0x2a11f5[_0x8815('0x34')][_0x8815('0x3f')]+'%'};return _0x8d6269;}})});}_0x51ce18=_[_0x8815('0x41')]({},_0x51ce18,_0x2a11f5['options']);var _0x29ff4f={'where':_0x51ce18['where']};return db[_0x8815('0x2f')][_0x8815('0x24')](_0x29ff4f)[_0x8815('0x28')](function(_0xbdde1a){_0x4476fd['count']=_0xbdde1a;if(_0x2a11f5[_0x8815('0x34')][_0x8815('0x43')]){_0x51ce18[_0x8815('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x8815('0x45')](_0x51ce18);})[_0x8815('0x28')](function(_0x4f7410){_0x4476fd['rows']=_0x4f7410;return _0x4476fd;})[_0x8815('0x28')](respondWithFilteredResult(_0x2594a5,_0x51ce18))['catch'](handleError(_0x2594a5,null));};exports[_0x8815('0x46')]=function(_0x3aaf99,_0x4b5e2c){var _0x3bed7c={'raw':!![],'where':{'id':_0x3aaf99[_0x8815('0x47')]['id']}},_0x395708={};_0x395708[_0x8815('0x38')]=_[_0x8815('0x48')](db[_0x8815('0x2f')][_0x8815('0x30')]);_0x395708[_0x8815('0x34')]=_[_0x8815('0x48')](_0x3aaf99[_0x8815('0x34')]);_0x395708[_0x8815('0x35')]=_[_0x8815('0x36')](_0x395708[_0x8815('0x38')],_0x395708['query']);_0x3bed7c[_0x8815('0x37')]=_[_0x8815('0x36')](_0x395708[_0x8815('0x38')],qs['fields'](_0x3aaf99[_0x8815('0x34')][_0x8815('0x49')]));_0x3bed7c['attributes']=_0x3bed7c[_0x8815('0x37')][_0x8815('0x4a')]?_0x3bed7c['attributes']:_0x395708[_0x8815('0x38')];if(_0x3aaf99[_0x8815('0x34')][_0x8815('0x43')]){_0x3bed7c[_0x8815('0x44')]=[{'all':!![]}];}_0x3bed7c=_[_0x8815('0x41')]({},_0x3bed7c,_0x3aaf99[_0x8815('0x4b')]);return db[_0x8815('0x2f')][_0x8815('0x4c')](_0x3bed7c)[_0x8815('0x28')](handleEntityNotFound(_0x4b5e2c,null))[_0x8815('0x28')](respondWithResult(_0x4b5e2c,null))[_0x8815('0x4d')](handleError(_0x4b5e2c,null));};exports[_0x8815('0x4e')]=function(_0x1b137f,_0x4bac6c){return db[_0x8815('0x2f')][_0x8815('0x4e')](_0x1b137f[_0x8815('0x4f')],{})[_0x8815('0x28')](respondWithResult(_0x4bac6c,0xc9))[_0x8815('0x4d')](handleError(_0x4bac6c,null));};exports[_0x8815('0x27')]=function(_0x4f3362,_0x3ab1b6){if(_0x4f3362['body']['id']){delete _0x4f3362[_0x8815('0x4f')]['id'];}return db[_0x8815('0x2f')]['find']({'where':{'id':_0x4f3362[_0x8815('0x47')]['id']}})[_0x8815('0x28')](handleEntityNotFound(_0x3ab1b6,null))[_0x8815('0x28')](saveUpdates(_0x4f3362['body'],null))[_0x8815('0x28')](respondWithResult(_0x3ab1b6,null))[_0x8815('0x4d')](handleError(_0x3ab1b6,null));};exports[_0x8815('0x29')]=function(_0x2f2d6b,_0x5db8c3){return db['ChatInternalMessage'][_0x8815('0x4c')]({'where':{'id':_0x2f2d6b[_0x8815('0x47')]['id']}})[_0x8815('0x28')](handleEntityNotFound(_0x5db8c3,null))[_0x8815('0x28')](removeEntity(_0x5db8c3,null))['catch'](handleError(_0x5db8c3,null));};exports[_0x8815('0x50')]=function(_0x59bbb5,_0x4e9145){return db[_0x8815('0x2f')][_0x8815('0x50')]()[_0x8815('0x28')](respondWithResult(_0x4e9145,null))[_0x8815('0x4d')](handleError(_0x4e9145,null));};function wrapUser(_0x154d76){return function(_0x75d027){var _0x45a800=_0x154d76['get']({'plain':!![]});_0x45a800[_0x8815('0x51')]=[];if(_0x75d027){_0x45a800[_0x8815('0x52')]=_0x75d027[_0x8815('0x53')];_0x45a800[_0x8815('0x54')]=_0x75d027;}else{_0x45a800[_0x8815('0x52')]=moment(0x0)[_0x8815('0x55')](_0x8815('0x56'));_0x45a800['lastMessage']={};}return _0x45a800;};}exports[_0x8815('0x57')]=function(_0x1ee662,_0xab8b61,_0x31b819){var _0xe4f41e=[];return db[_0x8815('0x58')][_0x8815('0x45')]({'where':{'role':[_0x8815('0x59'),'admin',_0x8815('0x5a')]},'attributes':['id',_0x8815('0x5b'),_0x8815('0x2b'),_0x8815('0x5c'),_0x8815('0x5d'),_0x8815('0x5e'),_0x8815('0x5f'),_0x8815('0x60'),_0x8815('0x61'),_0x8815('0x62')],'order':qs[_0x8815('0x3d')](_0x8815('0x63')),'include':[{'model':db[_0x8815('0x64')],'as':_0x8815('0x65'),'attributes':['id',_0x8815('0x2b'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x58d9ce){if(_0x58d9ce){var _0x47a123=_0x1ee662[_0x8815('0x5a')]['get']({'plain':!![]});if(!_0x47a123)throw new Error(_0x8815('0x66'));if(_0x47a123[_0x8815('0x5c')]==='user'){return db['UserProfileSection'][_0x8815('0x4c')]({'where':{'name':_0x8815('0x67'),'userProfileId':_0x47a123[_0x8815('0x68')]},'raw':!![]})[_0x8815('0x28')](function(_0x5dbaac){if(_0x5dbaac){if(_0x5dbaac[_0x8815('0x69')]===0x0){return db[_0x8815('0x6a')][_0x8815('0x45')]({'where':{'sectionId':_0x5dbaac['id']},'raw':!![]})[_0x8815('0x28')](function(_0x32ccf4){var _0x33f58=[];if(_[_0x8815('0x6b')](_0x32ccf4)){_0x33f58=_[_0x8815('0x3f')](_0x58d9ce,function(_0x40d946){if(_0x40d946[_0x8815('0x5c')]!==_0x8815('0x59')){return _0x40d946;}});return _0x33f58;}else{for(var _0x8b80cb=0x0;_0x8b80cb<_0x58d9ce[_0x8815('0x4a')];_0x8b80cb++){var _0xbae3ec=_0x58d9ce[_0x8b80cb];if(_0xbae3ec[_0x8815('0x5c')]==='agent'){var _0x385fe5=_[_0x8815('0x4c')](_0x32ccf4,function(_0xde151b){return _0xde151b[_0x8815('0x6c')]===_0xbae3ec['id'];});if(_0x385fe5)_0x33f58['push'](_0xbae3ec);}else{_0x33f58[_0x8815('0x6d')](_0xbae3ec);}}return _0x33f58;}});}else{return _0x58d9ce;}}else{var _0x5afc23=_[_0x8815('0x3f')](_0x58d9ce,function(_0x1a108f){if(_0x1a108f[_0x8815('0x5c')]!==_0x8815('0x59')){return _0x1a108f;}});return _0x5afc23;}});}else{return _0x58d9ce;}}})[_0x8815('0x28')](function(_0x4a0d2a){var _0x13a926=[];if(_0x4a0d2a){_0xe4f41e=_0x4a0d2a;for(var _0x11cea1=0x0;_0x11cea1<_0x4a0d2a[_0x8815('0x4a')];_0x11cea1+=0x1){_0xe4f41e[_0x11cea1]['messages']=[];_0x13a926[_0x8815('0x6d')](db[_0x8815('0x2f')]['find']({'where':{'FromId':[_0x1ee662[_0x8815('0x5a')]['id'],_0x4a0d2a[_0x11cea1]['id']],'ToId':[_0x1ee662[_0x8815('0x5a')]['id'],_0x4a0d2a[_0x11cea1]['id']],'ChatGroupId':null},'attributes':['id',_0x8815('0x53'),_0x8815('0x6e'),_0x8815('0x6f'),_0x8815('0x70'),'body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8815('0x28')](wrapUser(_0x4a0d2a[_0x11cea1])));}return BPromise['all'](_0x13a926);}return[];})[_0x8815('0x28')](function(_0x32d251){return{'rows':_0x32d251,'count':_0x32d251[_0x8815('0x4a')]};})[_0x8815('0x28')](respondWithResult(_0xab8b61,null))[_0x8815('0x4d')](handleError(_0xab8b61,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 051cf94..bb479cd 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 _0x56cc=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x56cc,0x161));var _0xc56c=function(_0x309d87,_0x5730d9){_0x309d87=_0x309d87-0x0;var _0x7729ab=_0x56cc[_0x309d87];return _0x7729ab;};'use strict';var EventEmitter=require(_0xc56c('0x0'));var ChatInternalMessage=require(_0xc56c('0x1'))['db'][_0xc56c('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc56c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc56c('0x4'),'afterDestroy':_0xc56c('0x5')};function emitEvent(_0x193b22){return function(_0x1f2f75,_0x117034,_0x5d8188){ChatInternalMessageEvents['emit'](_0x193b22+':'+_0x1f2f75['id'],_0x1f2f75);ChatInternalMessageEvents[_0xc56c('0x6')](_0x193b22,_0x1f2f75);_0x5d8188(null);};}for(var e in events){if(events[_0xc56c('0x7')](e)){var event=events[e];ChatInternalMessage[_0xc56c('0x8')](e,emitEvent(event));}}module[_0xc56c('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x9478=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9478,0x15b));var _0x8947=function(_0x1ade8d,_0x117a1e){_0x1ade8d=_0x1ade8d-0x0;var _0xf95b96=_0x9478[_0x1ade8d];return _0xf95b96;};'use strict';var EventEmitter=require(_0x8947('0x0'));var ChatInternalMessage=require(_0x8947('0x1'))['db'][_0x8947('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8947('0x3')](0x0);var events={'afterCreate':_0x8947('0x4'),'afterUpdate':_0x8947('0x5'),'afterDestroy':'remove'};function emitEvent(_0x45510b){return function(_0x535070,_0x2db57c,_0x189f26){ChatInternalMessageEvents[_0x8947('0x6')](_0x45510b+':'+_0x535070['id'],_0x535070);ChatInternalMessageEvents[_0x8947('0x6')](_0x45510b,_0x535070);_0x189f26(null);};}for(var e in events){if(events[_0x8947('0x7')](e)){var event=events[e];ChatInternalMessage[_0x8947('0x8')](e,emitEvent(event));}}module[_0x8947('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 df763a3..27eeb7c 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 _0x2600=['ChatInternalMessage','chat_internal_messages','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x2600,0x92));var _0x0260=function(_0x30be95,_0x4dcfad){_0x30be95=_0x30be95-0x0;var _0x354116=_0x2600[_0x30be95];return _0x354116;};'use strict';var _=require('lodash');var util=require(_0x0260('0x0'));var logger=require(_0x0260('0x1'))('api');var moment=require(_0x0260('0x2'));var BPromise=require(_0x0260('0x3'));var rp=require(_0x0260('0x4'));var fs=require('fs');var path=require(_0x0260('0x5'));var rimraf=require(_0x0260('0x6'));var config=require(_0x0260('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x0260('0x8')]=function(_0x3eaaf8,_0x36c654){return _0x3eaaf8[_0x0260('0x9')](_0x0260('0xa'),attributes,{'tableName':_0x0260('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0260('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9c50=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2d5734,_0x16e742){var _0x4c3197=function(_0x277aca){while(--_0x277aca){_0x2d5734['push'](_0x2d5734['shift']());}};_0x4c3197(++_0x16e742);}(_0x9c50,0x166));var _0x09c5=function(_0x121c6d,_0x489f8c){_0x121c6d=_0x121c6d-0x0;var _0x33f879=_0x9c50[_0x121c6d];return _0x33f879;};'use strict';var _=require(_0x09c5('0x0'));var util=require(_0x09c5('0x1'));var logger=require(_0x09c5('0x2'))('api');var moment=require(_0x09c5('0x3'));var BPromise=require(_0x09c5('0x4'));var rp=require(_0x09c5('0x5'));var fs=require('fs');var path=require(_0x09c5('0x6'));var rimraf=require(_0x09c5('0x7'));var config=require(_0x09c5('0x8'));var attributes=require(_0x09c5('0x9'));module['exports']=function(_0x12cf88,_0x1f849d){return _0x12cf88[_0x09c5('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x09c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x09c5('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 96fe4fd..ff9feaa 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 _0xebef=['ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x20afc3,_0x2f189a){var _0x4cbb43=function(_0x647042){while(--_0x647042){_0x20afc3['push'](_0x20afc3['shift']());}};_0x4cbb43(++_0x2f189a);}(_0xebef,0xb2));var _0xfebe=function(_0x1115fc,_0x47b2ca){_0x1115fc=_0x1115fc-0x0;var _0x4d7b9f=_0xebef[_0x1115fc];return _0x4d7b9f;};'use strict';var _=require(_0xfebe('0x0'));var util=require(_0xfebe('0x1'));var moment=require(_0xfebe('0x2'));var BPromise=require(_0xfebe('0x3'));var rs=require(_0xfebe('0x4'));var fs=require('fs');var Redis=require(_0xfebe('0x5'));var db=require(_0xfebe('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfebe('0x7'))(_0xfebe('0x8'));var config=require(_0xfebe('0x9'));var jayson=require(_0xfebe('0xa'));var client=jayson[_0xfebe('0xb')][_0xfebe('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfebe('0xd')],{'host':_0xfebe('0xe'),'port':0x18eb});var socket=require(_0xfebe('0xf'))(new Redis(config[_0xfebe('0xd')]));require(_0xfebe('0x10'))['register'](socket);function respondWithRpcPromise(_0x160c6a,_0x40e3bc,_0x19c1f8){return new BPromise(function(_0x5a69fb,_0x596c39){return client[_0xfebe('0x11')](_0x160c6a,_0x19c1f8)[_0xfebe('0x12')](function(_0x4773f0){logger[_0xfebe('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x40e3bc,'request\x20sent');logger[_0xfebe('0x14')](_0xfebe('0x15'),_0x40e3bc,_0xfebe('0x16'),JSON['stringify'](_0x4773f0));if(_0x4773f0['error']){if(_0x4773f0[_0xfebe('0x17')][_0xfebe('0x18')]===0x1f4){logger[_0xfebe('0x17')](_0xfebe('0x19'),_0x40e3bc,_0x4773f0['error'][_0xfebe('0x1a')]);return _0x596c39(_0x4773f0[_0xfebe('0x17')][_0xfebe('0x1a')]);}logger['error'](_0xfebe('0x19'),_0x40e3bc,_0x4773f0[_0xfebe('0x17')][_0xfebe('0x1a')]);return _0x5a69fb(_0x4773f0['error'][_0xfebe('0x1a')]);}else{logger[_0xfebe('0x13')](_0xfebe('0x19'),_0x40e3bc,_0xfebe('0x16'));_0x5a69fb(_0x4773f0[_0xfebe('0x1b')][_0xfebe('0x1a')]);}})[_0xfebe('0x1c')](function(_0x5ea3a1){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x40e3bc,_0x5ea3a1);_0x596c39(_0x5ea3a1);});});} \ No newline at end of file +var _0x1b4f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch'];(function(_0xbaea7b,_0x24265c){var _0x52d24a=function(_0x14e2f2){while(--_0x14e2f2){_0xbaea7b['push'](_0xbaea7b['shift']());}};_0x52d24a(++_0x24265c);}(_0x1b4f,0xd8));var _0xf1b4=function(_0x356e53,_0x2f6099){_0x356e53=_0x356e53-0x0;var _0x3b8ab0=_0x1b4f[_0x356e53];return _0x3b8ab0;};'use strict';var _=require(_0xf1b4('0x0'));var util=require(_0xf1b4('0x1'));var moment=require(_0xf1b4('0x2'));var BPromise=require(_0xf1b4('0x3'));var rs=require(_0xf1b4('0x4'));var fs=require('fs');var Redis=require(_0xf1b4('0x5'));var db=require(_0xf1b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1b4('0x7'))('rpc');var config=require(_0xf1b4('0x8'));var jayson=require(_0xf1b4('0x9'));var client=jayson[_0xf1b4('0xa')][_0xf1b4('0xb')]({'port':0x232a});config[_0xf1b4('0xc')]=_[_0xf1b4('0xd')](config[_0xf1b4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1b4('0xe'))(new Redis(config[_0xf1b4('0xc')]));require(_0xf1b4('0xf'))['register'](socket);function respondWithRpcPromise(_0x244eb2,_0x181134,_0x386aa5){return new BPromise(function(_0x1f855a,_0x212ebe){return client['request'](_0x244eb2,_0x386aa5)[_0xf1b4('0x10')](function(_0x5412b0){logger[_0xf1b4('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x181134,_0xf1b4('0x12'));logger['debug'](_0xf1b4('0x13'),_0x181134,_0xf1b4('0x12'),JSON[_0xf1b4('0x14')](_0x5412b0));if(_0x5412b0[_0xf1b4('0x15')]){if(_0x5412b0[_0xf1b4('0x15')][_0xf1b4('0x16')]===0x1f4){logger['error'](_0xf1b4('0x17'),_0x181134,_0x5412b0[_0xf1b4('0x15')][_0xf1b4('0x18')]);return _0x212ebe(_0x5412b0[_0xf1b4('0x15')][_0xf1b4('0x18')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x181134,_0x5412b0[_0xf1b4('0x15')][_0xf1b4('0x18')]);return _0x1f855a(_0x5412b0[_0xf1b4('0x15')][_0xf1b4('0x18')]);}else{logger[_0xf1b4('0x11')](_0xf1b4('0x17'),_0x181134,_0xf1b4('0x12'));_0x1f855a(_0x5412b0[_0xf1b4('0x19')][_0xf1b4('0x18')]);}})[_0xf1b4('0x1a')](function(_0x2b53fd){logger[_0xf1b4('0x15')](_0xf1b4('0x17'),_0x181134,_0x2b53fd);_0x212ebe(_0x2b53fd);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 04592e9..c055739 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 _0x5ff2=['chatInternalMessage:','./chatInternalMessage.events','remove','emit','removeListener','register','length'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0x5ff2,0x189));var _0x25ff=function(_0x3a2bc6,_0xb3d543){_0x3a2bc6=_0x3a2bc6-0x0;var _0x2781d8=_0x5ff2[_0x3a2bc6];return _0x2781d8;};'use strict';var ChatInternalMessageEvents=require(_0x25ff('0x0'));var events=['save',_0x25ff('0x1'),'update'];function createListener(_0x238f91,_0x427bcf){return function(_0x3c0055){_0x427bcf[_0x25ff('0x2')](_0x238f91,_0x3c0055);};}function removeListener(_0x3fb5be,_0x282435){return function(){ChatInternalMessageEvents[_0x25ff('0x3')](_0x3fb5be,_0x282435);};}exports[_0x25ff('0x4')]=function(_0x29ec4f){for(var _0x37b20b=0x0,_0x20318d=events[_0x25ff('0x5')];_0x37b20b<_0x20318d;_0x37b20b++){var _0x102ed2=events[_0x37b20b];var _0x1b6c7e=createListener(_0x25ff('0x6')+_0x102ed2,_0x29ec4f);ChatInternalMessageEvents['on'](_0x102ed2,_0x1b6c7e);}}; \ No newline at end of file +var _0xe40e=['remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x3c68ac,_0x38b406){var _0x35d849=function(_0x1fb2e0){while(--_0x1fb2e0){_0x3c68ac['push'](_0x3c68ac['shift']());}};_0x35d849(++_0x38b406);}(_0xe40e,0xde));var _0xee40=function(_0x118b99,_0x57ab44){_0x118b99=_0x118b99-0x0;var _0x405e9c=_0xe40e[_0x118b99];return _0x405e9c;};'use strict';var ChatInternalMessageEvents=require(_0xee40('0x0'));var events=[_0xee40('0x1'),_0xee40('0x2'),'update'];function createListener(_0x44010e,_0x1ad0a9){return function(_0xd73bcf){_0x1ad0a9[_0xee40('0x3')](_0x44010e,_0xd73bcf);};}function removeListener(_0x1d3878,_0x2a369c){return function(){ChatInternalMessageEvents[_0xee40('0x4')](_0x1d3878,_0x2a369c);};}exports[_0xee40('0x5')]=function(_0x20d552){for(var _0xfc389a=0x0,_0x34001d=events[_0xee40('0x6')];_0xfc389a<_0x34001d;_0xfc389a++){var _0x347925=events[_0xfc389a];var _0x5a4a3f=createListener(_0xee40('0x7')+_0x347925,_0x20d552);ChatInternalMessageEvents['on'](_0x347925,_0x5a4a3f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d3887a1..482c019 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 _0x491a=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','create','put','update'];(function(_0xed715a,_0x2eb934){var _0x55ce9b=function(_0x4d3d7a){while(--_0x4d3d7a){_0xed715a['push'](_0xed715a['shift']());}};_0x55ce9b(++_0x2eb934);}(_0x491a,0xdd));var _0xa491=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0x491a[_0x4da382];return _0x10073f;};'use strict';var multer=require(_0xa491('0x0'));var util=require(_0xa491('0x1'));var path=require(_0xa491('0x2'));var timeout=require(_0xa491('0x3'));var express=require(_0xa491('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa491('0x5'));var interaction=require(_0xa491('0x6'));var config=require(_0xa491('0x7'));var controller=require(_0xa491('0x8'));router[_0xa491('0x9')]('/',auth[_0xa491('0xa')](),controller['index']);router[_0xa491('0x9')](_0xa491('0xb'),auth[_0xa491('0xa')](),controller['describe']);router['get'](_0xa491('0xc'),auth[_0xa491('0xa')](),controller['getUsers']);router[_0xa491('0x9')](_0xa491('0xd'),auth[_0xa491('0xa')](),controller['show']);router['post']('/',auth[_0xa491('0xa')](),controller[_0xa491('0xe')]);router[_0xa491('0xf')](_0xa491('0xd'),controller[_0xa491('0x10')]);router['delete'](_0xa491('0xd'),auth[_0xa491('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa480=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','/describe','describe','get','/users','getUsers','/:id','show','post','create','update'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xa480,0x153));var _0x0a48=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xa480[_0x1ed116];return _0x574066;};'use strict';var multer=require('multer');var util=require(_0x0a48('0x0'));var path=require(_0x0a48('0x1'));var timeout=require(_0x0a48('0x2'));var express=require(_0x0a48('0x3'));var router=express[_0x0a48('0x4')]();var fs_extra=require(_0x0a48('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0a48('0x6'));var config=require(_0x0a48('0x7'));var controller=require(_0x0a48('0x8'));router['get']('/',auth[_0x0a48('0x9')](),controller[_0x0a48('0xa')]);router['get'](_0x0a48('0xb'),auth[_0x0a48('0x9')](),controller[_0x0a48('0xc')]);router[_0x0a48('0xd')](_0x0a48('0xe'),auth[_0x0a48('0x9')](),controller[_0x0a48('0xf')]);router['get'](_0x0a48('0x10'),auth[_0x0a48('0x9')](),controller[_0x0a48('0x11')]);router[_0x0a48('0x12')]('/',auth[_0x0a48('0x9')](),controller[_0x0a48('0x13')]);router['put'](_0x0a48('0x10'),controller[_0x0a48('0x14')]);router[_0x0a48('0x15')](_0x0a48('0x10'),auth[_0x0a48('0x9')](),controller[_0x0a48('0x16')]);module[_0x0a48('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ab57ed3..6a5bed2 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 _0x0102=['exports','TEXT','medium','BOOLEAN','STRING'];(function(_0x4b8dec,_0x1744f2){var _0x1b11b6=function(_0x4dca89){while(--_0x4dca89){_0x4b8dec['push'](_0x4b8dec['shift']());}};_0x1b11b6(++_0x1744f2);}(_0x0102,0x186));var _0x2010=function(_0x144297,_0x29ca79){_0x144297=_0x144297-0x0;var _0x1e22bf=_0x0102[_0x144297];return _0x1e22bf;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'body':{'type':Sequelize[_0x2010('0x1')](_0x2010('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2010('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x2010('0x4')]},'providerResponse':{'type':Sequelize[_0x2010('0x1')]}}; \ No newline at end of file +var _0xfcbb=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x3c1fa5,_0x531874){var _0x14a779=function(_0xd394a2){while(--_0xd394a2){_0x3c1fa5['push'](_0x3c1fa5['shift']());}};_0x14a779(++_0x531874);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x2342b0,_0x466c85){_0x2342b0=_0x2342b0-0x0;var _0x474210=_0xfcbb[_0x2342b0];return _0x474210;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'body':{'type':Sequelize[_0xbfcb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfcb('0x4')]('in',_0xbfcb('0x5')),'defaultValue':_0xbfcb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfcb('0x6')]},'providerName':{'type':Sequelize['STRING']},'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 8aa2500..95f331a 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 _0xa0c5=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','http','client','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','info','catch','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','name','send','index','map','ChatMessage','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','rawAttributes','include','create','body','update','find','params','describe','accept','chat','readAt','format','UserId','agent','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','acceptmessage','formData','chat-interactions','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','SELECT','event','EventManager','rejectmessage','parse','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','fs-extra','lodash','squel','crypto','to-csv'];(function(_0x28b754,_0x5a1158){var _0x2e0534=function(_0x4685f0){while(--_0x4685f0){_0x28b754['push'](_0x28b754['shift']());}};_0x2e0534(++_0x5a1158);}(_0xa0c5,0x174));var _0x5a0c=function(_0x372a57,_0x9aa407){_0x372a57=_0x372a57-0x0;var _0x358f6d=_0xa0c5[_0x372a57];return _0x358f6d;};'use strict';var emlformat=require(_0x5a0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a0c('0x1'));var jsonpatch=require(_0x5a0c('0x2'));var rp=require(_0x5a0c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a0c('0x4'));var util=require('util');var path=require(_0x5a0c('0x5'));var sox=require(_0x5a0c('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a0c('0x7'));var _=require(_0x5a0c('0x8'));var squel=require(_0x5a0c('0x9'));var crypto=require(_0x5a0c('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5a0c('0xb'));var querystring=require(_0x5a0c('0xc'));var Papa=require(_0x5a0c('0xd'));var Redis=require(_0x5a0c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5a0c('0xf'));var as=require(_0x5a0c('0x10'));var hardwareService=require(_0x5a0c('0x11'));var logger=require(_0x5a0c('0x12'))(_0x5a0c('0x13'));var utils=require(_0x5a0c('0x14'));var config=require(_0x5a0c('0x15'));var licenseUtil=require(_0x5a0c('0x16'));var db=require(_0x5a0c('0x17'))['db'];config[_0x5a0c('0x18')]=_[_0x5a0c('0x19')](config[_0x5a0c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5a0c('0x1a'))(new Redis(config[_0x5a0c('0x18')]));require(_0x5a0c('0x1b'))[_0x5a0c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5a0c('0x1d')]({'port':0x232c});var client9002=jayson[_0x5a0c('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc76c65,_0x3a3c68,_0x4fd323,_0x32d4f1){return new BPromise(function(_0x3078fe,_0x1d885b){var _0x413a15=_0x32d4f1||client;return _0x413a15[_0x5a0c('0x1f')](_0xc76c65,_0x4fd323)[_0x5a0c('0x20')](function(_0x42d921){logger['info'](_0x5a0c('0x21'),_0x3a3c68,_0x5a0c('0x22'));logger[_0x5a0c('0x23')](_0x5a0c('0x24'),_0x3a3c68,_0x5a0c('0x22'),JSON['stringify'](_0x42d921));if(_0x42d921['error']){if(_0x42d921[_0x5a0c('0x25')]['code']===0x1f4){logger['error'](_0x5a0c('0x21'),_0x3a3c68,_0x42d921[_0x5a0c('0x25')][_0x5a0c('0x26')]);return _0x1d885b(_0x42d921['error'][_0x5a0c('0x26')]);}logger['error'](_0x5a0c('0x21'),_0x3a3c68,_0x42d921['error'][_0x5a0c('0x26')]);return _0x3078fe(_0x42d921[_0x5a0c('0x25')][_0x5a0c('0x26')]);}else{logger[_0x5a0c('0x27')](_0x5a0c('0x21'),_0x3a3c68,_0x5a0c('0x22'));_0x3078fe(_0x42d921['result']['message']);}})[_0x5a0c('0x28')](function(_0x50847e){logger['error'](_0x5a0c('0x21'),_0x3a3c68,_0x50847e);_0x1d885b(_0x50847e);});});}function respondWithStatusCode(_0x8c8028,_0x7aaa89){_0x7aaa89=_0x7aaa89||0xcc;return function(_0x356e1c){if(_0x356e1c){return _0x8c8028['sendStatus'](_0x7aaa89);}return _0x8c8028[_0x5a0c('0x29')](_0x7aaa89)[_0x5a0c('0x2a')]();};}function respondWithResult(_0x5c2124,_0x27ef11){_0x27ef11=_0x27ef11||0xc8;return function(_0x21e99b){if(_0x21e99b){return _0x5c2124[_0x5a0c('0x29')](_0x27ef11)[_0x5a0c('0x2b')](_0x21e99b);}};}function respondWithFilteredResult(_0x3b6119,_0x1841e7){return function(_0x3c206b){if(_0x3c206b){var _0x2ab511=typeof _0x1841e7[_0x5a0c('0x2c')]===_0x5a0c('0x2d')&&typeof _0x1841e7['limit']===_0x5a0c('0x2d');var _0x3da1f4=_0x3c206b[_0x5a0c('0x2e')];var _0x25271f=_0x2ab511?0x0:_0x1841e7[_0x5a0c('0x2c')];var _0x3a1575=_0x2ab511?_0x3c206b['count']:_0x1841e7['offset']+_0x1841e7[_0x5a0c('0x2f')];var _0x1ae1ec;if(_0x3a1575>=_0x3da1f4){_0x3a1575=_0x3da1f4;_0x1ae1ec=0xc8;}else{_0x1ae1ec=0xce;}_0x3b6119[_0x5a0c('0x29')](_0x1ae1ec);return _0x3b6119[_0x5a0c('0x30')]('Content-Range',_0x25271f+'-'+_0x3a1575+'/'+_0x3da1f4)[_0x5a0c('0x2b')](_0x3c206b);}return null;};}function patchUpdates(_0xc9e28b){return function(_0x332d8e){try{jsonpatch[_0x5a0c('0x31')](_0x332d8e,_0xc9e28b,!![]);}catch(_0xda4914){return BPromise[_0x5a0c('0x32')](_0xda4914);}return _0x332d8e[_0x5a0c('0x33')]();};}function saveUpdates(_0x599d46,_0x44d1b8){return function(_0xf8e124){if(_0xf8e124){return _0xf8e124['update'](_0x599d46)[_0x5a0c('0x20')](function(_0x261032){return _0x261032;});}return null;};}function removeEntity(_0x112d7f,_0x15b5e4){return function(_0x33e61c){if(_0x33e61c){return _0x33e61c[_0x5a0c('0x34')]()[_0x5a0c('0x20')](function(){_0x112d7f[_0x5a0c('0x29')](0xcc)[_0x5a0c('0x2a')]();});}};}function handleEntityNotFound(_0x467a80,_0x269ddd){return function(_0x288a7e){if(!_0x288a7e){_0x467a80['sendStatus'](0x194);}return _0x288a7e;};}function handleError(_0x45451c,_0x3107e2){_0x3107e2=_0x3107e2||0x1f4;return function(_0x31f741){logger[_0x5a0c('0x25')](_0x31f741['stack']);if(_0x31f741[_0x5a0c('0x35')]){delete _0x31f741[_0x5a0c('0x35')];}_0x45451c[_0x5a0c('0x29')](_0x3107e2)[_0x5a0c('0x36')](_0x31f741);};}exports[_0x5a0c('0x37')]=function(_0x9ac285,_0x4c0269){var _0x7d048d={},_0x21982a={},_0x234247={'count':0x0,'rows':[]};var _0x311356=_[_0x5a0c('0x38')](db[_0x5a0c('0x39')]['rawAttributes'],function(_0x3f4441){return{'name':_0x3f4441[_0x5a0c('0x3a')],'type':_0x3f4441[_0x5a0c('0x3b')]['key']};});_0x21982a[_0x5a0c('0x3c')]=_[_0x5a0c('0x38')](_0x311356,_0x5a0c('0x35'));_0x21982a[_0x5a0c('0x3d')]=_[_0x5a0c('0x3e')](_0x9ac285['query']);_0x21982a[_0x5a0c('0x3f')]=_[_0x5a0c('0x40')](_0x21982a[_0x5a0c('0x3c')],_0x21982a[_0x5a0c('0x3d')]);_0x7d048d[_0x5a0c('0x41')]=_['intersection'](_0x21982a['model'],qs[_0x5a0c('0x42')](_0x9ac285['query'][_0x5a0c('0x42')]));_0x7d048d[_0x5a0c('0x41')]=_0x7d048d[_0x5a0c('0x41')][_0x5a0c('0x43')]?_0x7d048d['attributes']:_0x21982a[_0x5a0c('0x3c')];if(!_0x9ac285[_0x5a0c('0x3d')][_0x5a0c('0x44')](_0x5a0c('0x45'))){_0x7d048d['limit']=qs[_0x5a0c('0x2f')](_0x9ac285[_0x5a0c('0x3d')][_0x5a0c('0x2f')]);_0x7d048d['offset']=qs[_0x5a0c('0x2c')](_0x9ac285[_0x5a0c('0x3d')][_0x5a0c('0x2c')]);}_0x7d048d['order']=qs[_0x5a0c('0x46')](_0x9ac285[_0x5a0c('0x3d')]['sort']);_0x7d048d[_0x5a0c('0x47')]=qs[_0x5a0c('0x3f')](_['pick'](_0x9ac285['query'],_0x21982a[_0x5a0c('0x3f')]),_0x311356);if(_0x9ac285[_0x5a0c('0x3d')][_0x5a0c('0x48')]){_0x7d048d[_0x5a0c('0x47')]=_[_0x5a0c('0x49')](_0x7d048d[_0x5a0c('0x47')],{'$or':_[_0x5a0c('0x38')](_0x311356,function(_0xe3cd14){if(_0xe3cd14[_0x5a0c('0x3b')]!==_0x5a0c('0x4a')){var _0x12700b={};_0x12700b[_0xe3cd14['name']]={'$like':'%'+_0x9ac285[_0x5a0c('0x3d')][_0x5a0c('0x48')]+'%'};return _0x12700b;}})});}_0x7d048d=_['merge']({},_0x7d048d,_0x9ac285[_0x5a0c('0x4b')]);var _0x54bbba={'where':_0x7d048d[_0x5a0c('0x47')]};return db[_0x5a0c('0x39')][_0x5a0c('0x2e')](_0x54bbba)[_0x5a0c('0x20')](function(_0x38a66e){_0x234247[_0x5a0c('0x2e')]=_0x38a66e;if(_0x9ac285[_0x5a0c('0x3d')][_0x5a0c('0x4c')]){_0x7d048d['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x7d048d);})['then'](function(_0x8b5f45){_0x234247['rows']=_0x8b5f45;return _0x234247;})['then'](respondWithFilteredResult(_0x4c0269,_0x7d048d))[_0x5a0c('0x28')](handleError(_0x4c0269,null));};exports['show']=function(_0x4dc94d,_0x5d81e2){var _0x109f98={'raw':!![],'where':{'id':_0x4dc94d['params']['id']}},_0x351d60={};_0x351d60['model']=_[_0x5a0c('0x3e')](db[_0x5a0c('0x39')][_0x5a0c('0x4d')]);_0x351d60[_0x5a0c('0x3d')]=_[_0x5a0c('0x3e')](_0x4dc94d[_0x5a0c('0x3d')]);_0x351d60[_0x5a0c('0x3f')]=_[_0x5a0c('0x40')](_0x351d60[_0x5a0c('0x3c')],_0x351d60['query']);_0x109f98[_0x5a0c('0x41')]=_[_0x5a0c('0x40')](_0x351d60[_0x5a0c('0x3c')],qs[_0x5a0c('0x42')](_0x4dc94d[_0x5a0c('0x3d')][_0x5a0c('0x42')]));_0x109f98['attributes']=_0x109f98[_0x5a0c('0x41')]['length']?_0x109f98[_0x5a0c('0x41')]:_0x351d60[_0x5a0c('0x3c')];if(_0x4dc94d[_0x5a0c('0x3d')][_0x5a0c('0x4c')]){_0x109f98[_0x5a0c('0x4e')]=[{'all':!![]}];}_0x109f98=_[_0x5a0c('0x49')]({},_0x109f98,_0x4dc94d[_0x5a0c('0x4b')]);return db[_0x5a0c('0x39')]['find'](_0x109f98)['then'](handleEntityNotFound(_0x5d81e2,null))[_0x5a0c('0x20')](respondWithResult(_0x5d81e2,null))[_0x5a0c('0x28')](handleError(_0x5d81e2,null));};exports['create']=function(_0x5af3cd,_0x3c0798){return db[_0x5a0c('0x39')][_0x5a0c('0x4f')](_0x5af3cd[_0x5a0c('0x50')],{})[_0x5a0c('0x20')](respondWithResult(_0x3c0798,0xc9))[_0x5a0c('0x28')](handleError(_0x3c0798,null));};exports[_0x5a0c('0x51')]=function(_0x3789ac,_0x54335d){if(_0x3789ac[_0x5a0c('0x50')]['id']){delete _0x3789ac['body']['id'];}return db[_0x5a0c('0x39')][_0x5a0c('0x52')]({'where':{'id':_0x3789ac[_0x5a0c('0x53')]['id']}})[_0x5a0c('0x20')](handleEntityNotFound(_0x54335d,null))[_0x5a0c('0x20')](saveUpdates(_0x3789ac[_0x5a0c('0x50')],null))[_0x5a0c('0x20')](respondWithResult(_0x54335d,null))['catch'](handleError(_0x54335d,null));};exports[_0x5a0c('0x34')]=function(_0x542517,_0x259ff){return db[_0x5a0c('0x39')][_0x5a0c('0x52')]({'where':{'id':_0x542517['params']['id']}})['then'](handleEntityNotFound(_0x259ff,null))['then'](removeEntity(_0x259ff,null))[_0x5a0c('0x28')](handleError(_0x259ff,null));};exports[_0x5a0c('0x54')]=function(_0xcc925b,_0x27f115){return db['ChatMessage'][_0x5a0c('0x54')]()['then'](respondWithResult(_0x27f115,null))[_0x5a0c('0x28')](handleError(_0x27f115,null));};var interaction_log=require(_0x5a0c('0x12'))('chat-interactions');exports[_0x5a0c('0x55')]=function(_0x1aef2a,_0x285c09,_0xf33045){var _0xb705c7={'agent':{},'channel':_0x5a0c('0x56')};if(_0x1aef2a['body']['id']){delete _0x1aef2a[_0x5a0c('0x50')]['id'];}_0x1aef2a['body']['read']=!![];_0x1aef2a[_0x5a0c('0x50')][_0x5a0c('0x57')]=moment()[_0x5a0c('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x1aef2a['body'][_0x5a0c('0x59')]=_0x1aef2a[_0x5a0c('0x50')]['UserId']||_0x1aef2a['user']['id'];_0xb705c7[_0x5a0c('0x5a')]['id']=_0x1aef2a[_0x5a0c('0x50')][_0x5a0c('0x59')];return db[_0x5a0c('0x39')]['find']({'where':{'id':_0x1aef2a[_0x5a0c('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x285c09,null))[_0x5a0c('0x20')](saveUpdates(_0x1aef2a[_0x5a0c('0x50')],null))[_0x5a0c('0x20')](function(_0x364cbb){if(_0x364cbb){_0xb705c7['message']=_0x364cbb['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x364cbb['ChatInteractionId']}});}return null;})[_0x5a0c('0x20')](handleEntityNotFound(_0x285c09,null))['then'](function(_0x27a371){if(_0x27a371){return _0x27a371[_0x5a0c('0x51')]({'UserId':_0x1aef2a[_0x5a0c('0x50')][_0x5a0c('0x59')],'read1stAt':_[_0x5a0c('0x5b')](_0x27a371[_0x5a0c('0x5c')])?moment()[_0x5a0c('0x58')](_0x5a0c('0x5d')):undefined});}return null;})[_0x5a0c('0x20')](function(_0x433f3e){if(_0x433f3e){_0xb705c7[_0x5a0c('0x5e')]=_0x433f3e['get']({'plain':!![]});interaction_log[_0x5a0c('0x27')](_0x5a0c('0x5f'),_0x1aef2a['user']['id'],_0x1aef2a[_0x5a0c('0x60')][_0x5a0c('0x35')],_0x1aef2a[_0x5a0c('0x60')][_0x5a0c('0x61')],_0xb705c7[_0x5a0c('0x5e')]['id'],_0x1aef2a['body']?JSON[_0x5a0c('0x62')](_0x1aef2a[_0x5a0c('0x50')]):_0x5a0c('0x63'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xb705c7);}return null;})[_0x5a0c('0x20')](function(_0x23d412){var _0x1fc6df=_0x5a0c('0x64')+_0x23d412['message'][_0x5a0c('0x65')];return db['sequelize'][_0x5a0c('0x3d')](_0x1fc6df,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x5a0c('0x20')](function(_0x2d1b42){return _0x2d1b42;});})[_0x5a0c('0x20')](function(_0x363bf2){if(_0x363bf2){_0xb705c7[_0x5a0c('0x26')][_0x5a0c('0x66')]=_0x363bf2[0x0];if(!_0x1aef2a[_0x5a0c('0x50')]['UserId'])return;return db[_0x5a0c('0x67')][_0x5a0c('0x52')]({'where':{'id':_0x1aef2a[_0x5a0c('0x50')][_0x5a0c('0x59')],'role':_0x5a0c('0x5a')},'attributes':['id',_0x5a0c('0x35'),_0x5a0c('0x68'),_0x5a0c('0x69'),_0x5a0c('0x6a')],'raw':!![]});}return null;})[_0x5a0c('0x20')](function(_0x33e091){if(!_0x33e091)return null;_0xb705c7[_0x5a0c('0x26')][_0x5a0c('0x5a')]=_0x33e091;return _0xb705c7;})[_0x5a0c('0x20')](function(_0xf0d675){if(_0xf0d675){if(_0x1aef2a[_0x5a0c('0x50')][_0x5a0c('0x6b')]){_0xb705c7[_0x5a0c('0x26')][_0x5a0c('0x6c')]=util['format'](_0x5a0c('0x6d'),_0x1aef2a[_0x5a0c('0x60')][_0x5a0c('0x35')]);_0xb705c7[_0x5a0c('0x26')]['channel']=_0xb705c7[_0x5a0c('0x6e')];_0xb705c7[_0x5a0c('0x26')][_0x5a0c('0x6f')]=_0xb705c7[_0x5a0c('0x6e')];_0xb705c7[_0x5a0c('0x26')]['event']=_0x5a0c('0x55');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x5a0c('0x70'),'message':_[_0x5a0c('0x49')](_0xb705c7[_0x5a0c('0x26')],JSON['parse'](_0xb705c7[_0x5a0c('0x5e')][_0x5a0c('0x71')]))},client9002)['then'](function(){return _0xb705c7;});}return _0xb705c7;}return null;})[_0x5a0c('0x20')](respondWithResult(_0x285c09,null))[_0x5a0c('0x28')](handleError(_0x285c09,null));};var interaction_log=require(_0x5a0c('0x12'))(_0x5a0c('0x72'));exports[_0x5a0c('0x32')]=function(_0x3d0542,_0x48bc63,_0x3c7331){var _0x4063c7={'agent':{},'channel':'chat'};if(_0x3d0542[_0x5a0c('0x50')]['id']){delete _0x3d0542['body']['id'];}_0x3d0542[_0x5a0c('0x50')][_0x5a0c('0x59')]=_0x3d0542['body'][_0x5a0c('0x59')]||_0x3d0542['user']['id'];_0x4063c7['agent']['id']=_0x3d0542['body'][_0x5a0c('0x59')];return db['ChatMessage'][_0x5a0c('0x52')]({'where':{'id':_0x3d0542['params']['id'],'UserId':null}})[_0x5a0c('0x20')](handleEntityNotFound(_0x48bc63,null))[_0x5a0c('0x20')](function(_0x4ecee2){if(_0x4ecee2){_0x4063c7[_0x5a0c('0x26')]=_0x4ecee2[_0x5a0c('0x73')]({'plain':!![]});return db[_0x5a0c('0x74')][_0x5a0c('0x52')]({'where':{'id':_0x4ecee2[_0x5a0c('0x75')]}});}return null;})[_0x5a0c('0x20')](handleEntityNotFound(_0x48bc63,null))['then'](function(_0x144eb3){if(_0x144eb3){_0x4063c7['interaction']=_0x144eb3[_0x5a0c('0x73')]({'plain':!![]});interaction_log[_0x5a0c('0x27')](_0x5a0c('0x76'),_0x3d0542[_0x5a0c('0x60')]['id'],_0x3d0542[_0x5a0c('0x60')]['name'],_0x3d0542[_0x5a0c('0x60')][_0x5a0c('0x61')],_0x4063c7[_0x5a0c('0x5e')]['id'],_0x3d0542[_0x5a0c('0x50')]?JSON[_0x5a0c('0x62')](_0x3d0542['body']):'null');return respondWithRpcPromise(_0x5a0c('0x77'),_0x5a0c('0x78'),_0x4063c7);}return null;})[_0x5a0c('0x20')](function(_0x3ea36b){var _0x9984bf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3ea36b[_0x5a0c('0x26')][_0x5a0c('0x65')];return db[_0x5a0c('0x79')][_0x5a0c('0x3d')](_0x9984bf,{'type':db['Sequelize'][_0x5a0c('0x7a')][_0x5a0c('0x7b')],'raw':!![]})[_0x5a0c('0x20')](function(_0x30cc2c){return _0x30cc2c;});})[_0x5a0c('0x20')](function(_0x5dd298){if(_0x5dd298){_0x4063c7[_0x5a0c('0x26')][_0x5a0c('0x66')]=_0x5dd298[0x0];if(!_0x3d0542[_0x5a0c('0x50')][_0x5a0c('0x59')])return;return db[_0x5a0c('0x67')]['find']({'where':{'id':_0x3d0542[_0x5a0c('0x50')][_0x5a0c('0x59')],'role':_0x5a0c('0x5a')},'attributes':['id','name',_0x5a0c('0x68'),_0x5a0c('0x69'),'internal'],'raw':!![]});}return null;})[_0x5a0c('0x20')](function(_0x44b2db){if(!_0x44b2db)return null;_0x4063c7['message'][_0x5a0c('0x5a')]=_0x44b2db;return _0x4063c7;})['then'](function(_0x35d34b){if(_0x35d34b){_0x35d34b[_0x5a0c('0x26')]['interface']=util[_0x5a0c('0x58')](_0x5a0c('0x6d'),_0x3d0542[_0x5a0c('0x60')][_0x5a0c('0x35')]);_0x35d34b[_0x5a0c('0x26')]['channel']=_0x4063c7[_0x5a0c('0x6e')];_0x35d34b[_0x5a0c('0x26')][_0x5a0c('0x6f')]=_0x4063c7['channel'];_0x35d34b[_0x5a0c('0x26')][_0x5a0c('0x7c')]=_0x5a0c('0x32');respondWithRpcPromise(_0x5a0c('0x7d'),_0x5a0c('0x7d'),{'event':_0x5a0c('0x7e'),'message':_['merge'](_0x4063c7[_0x5a0c('0x26')],JSON[_0x5a0c('0x7f')](_0x4063c7['interaction'][_0x5a0c('0x71')]))},client9002);return _0x4063c7;}return null;})['then'](respondWithResult(_0x48bc63,null))[_0x5a0c('0x28')](handleError(_0x48bc63,null));}; \ No newline at end of file +var _0xae2f=['ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','internal','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','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','redis','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','key','model','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','where','pick','merge','filter','includeAll','findAll','rows','show','params','rawAttributes','fields','include','options','find','create','body','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','format','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData'];(function(_0x121b9f,_0x3e538b){var _0x3d1f31=function(_0x343511){while(--_0x343511){_0x121b9f['push'](_0x121b9f['shift']());}};_0x3d1f31(++_0x3e538b);}(_0xae2f,0x8c));var _0xfae2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xae2f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfae2('0x0'));var rimraf=require(_0xfae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfae2('0x2'));var rp=require(_0xfae2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfae2('0x4'));var util=require(_0xfae2('0x5'));var path=require(_0xfae2('0x6'));var sox=require(_0xfae2('0x7'));var csv=require(_0xfae2('0x8'));var ejs=require(_0xfae2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfae2('0xa'));var squel=require('squel');var crypto=require(_0xfae2('0xb'));var jsforce=require(_0xfae2('0xc'));var deskjs=require(_0xfae2('0xd'));var toCsv=require(_0xfae2('0x8'));var querystring=require(_0xfae2('0xe'));var Papa=require(_0xfae2('0xf'));var Redis=require(_0xfae2('0x10'));var authService=require(_0xfae2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfae2('0x12'));var hardwareService=require(_0xfae2('0x13'));var logger=require(_0xfae2('0x14'))(_0xfae2('0x15'));var utils=require(_0xfae2('0x16'));var config=require(_0xfae2('0x17'));var licenseUtil=require(_0xfae2('0x18'));var db=require('../../mysqldb')['db'];config[_0xfae2('0x19')]=_['defaults'](config['redis'],{'host':_0xfae2('0x1a'),'port':0x18eb});var socket=require(_0xfae2('0x1b'))(new Redis(config[_0xfae2('0x19')]));require(_0xfae2('0x1c'))[_0xfae2('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfae2('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0xfae2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3d7f7e,_0x5ddff8,_0x23eae2,_0x41e389){return new BPromise(function(_0x2a926a,_0x5e1967){var _0x1b318c=_0x41e389||client;return _0x1b318c['request'](_0x3d7f7e,_0x23eae2)[_0xfae2('0x20')](function(_0x1da1ea){logger[_0xfae2('0x21')](_0xfae2('0x22'),_0x5ddff8,_0xfae2('0x23'));logger[_0xfae2('0x24')](_0xfae2('0x25'),_0x5ddff8,_0xfae2('0x23'),JSON[_0xfae2('0x26')](_0x1da1ea));if(_0x1da1ea['error']){if(_0x1da1ea[_0xfae2('0x27')]['code']===0x1f4){logger[_0xfae2('0x27')](_0xfae2('0x22'),_0x5ddff8,_0x1da1ea['error'][_0xfae2('0x28')]);return _0x5e1967(_0x1da1ea['error'][_0xfae2('0x28')]);}logger['error'](_0xfae2('0x22'),_0x5ddff8,_0x1da1ea[_0xfae2('0x27')][_0xfae2('0x28')]);return _0x2a926a(_0x1da1ea['error']['message']);}else{logger[_0xfae2('0x21')](_0xfae2('0x22'),_0x5ddff8,_0xfae2('0x23'));_0x2a926a(_0x1da1ea[_0xfae2('0x29')][_0xfae2('0x28')]);}})[_0xfae2('0x2a')](function(_0x4731a7){logger[_0xfae2('0x27')](_0xfae2('0x22'),_0x5ddff8,_0x4731a7);_0x5e1967(_0x4731a7);});});}function respondWithStatusCode(_0x41dbb0,_0x117dd3){_0x117dd3=_0x117dd3||0xcc;return function(_0x59c4d5){if(_0x59c4d5){return _0x41dbb0[_0xfae2('0x2b')](_0x117dd3);}return _0x41dbb0[_0xfae2('0x2c')](_0x117dd3)[_0xfae2('0x2d')]();};}function respondWithResult(_0x1fb90d,_0xefacc5){_0xefacc5=_0xefacc5||0xc8;return function(_0xa64625){if(_0xa64625){return _0x1fb90d['status'](_0xefacc5)['json'](_0xa64625);}};}function respondWithFilteredResult(_0x1b74fc,_0x330c70){return function(_0x4c2296){if(_0x4c2296){var _0x17d51d=typeof _0x330c70[_0xfae2('0x2e')]===_0xfae2('0x2f')&&typeof _0x330c70[_0xfae2('0x30')]===_0xfae2('0x2f');var _0x3de9e1=_0x4c2296['count'];var _0x5aab3c=_0x17d51d?0x0:_0x330c70[_0xfae2('0x2e')];var _0x59972a=_0x17d51d?_0x4c2296[_0xfae2('0x31')]:_0x330c70[_0xfae2('0x2e')]+_0x330c70['limit'];var _0x59cce0;if(_0x59972a>=_0x3de9e1){_0x59972a=_0x3de9e1;_0x59cce0=0xc8;}else{_0x59cce0=0xce;}_0x1b74fc[_0xfae2('0x2c')](_0x59cce0);return _0x1b74fc['set'](_0xfae2('0x32'),_0x5aab3c+'-'+_0x59972a+'/'+_0x3de9e1)[_0xfae2('0x33')](_0x4c2296);}return null;};}function patchUpdates(_0x441869){return function(_0x3ea6a1){try{jsonpatch['apply'](_0x3ea6a1,_0x441869,!![]);}catch(_0x2073b8){return BPromise[_0xfae2('0x34')](_0x2073b8);}return _0x3ea6a1['save']();};}function saveUpdates(_0x544c2d,_0x215589){return function(_0x70ccd0){if(_0x70ccd0){return _0x70ccd0[_0xfae2('0x35')](_0x544c2d)[_0xfae2('0x20')](function(_0x5943ed){return _0x5943ed;});}return null;};}function removeEntity(_0x33ee02,_0x434169){return function(_0x32dbfd){if(_0x32dbfd){return _0x32dbfd[_0xfae2('0x36')]()[_0xfae2('0x20')](function(){_0x33ee02[_0xfae2('0x2c')](0xcc)[_0xfae2('0x2d')]();});}};}function handleEntityNotFound(_0x45d886,_0x40f7f4){return function(_0x5428ae){if(!_0x5428ae){_0x45d886['sendStatus'](0x194);}return _0x5428ae;};}function handleError(_0x1930e7,_0x5ed137){_0x5ed137=_0x5ed137||0x1f4;return function(_0x14fc47){logger['error'](_0x14fc47[_0xfae2('0x37')]);if(_0x14fc47[_0xfae2('0x38')]){delete _0x14fc47[_0xfae2('0x38')];}_0x1930e7[_0xfae2('0x2c')](_0x5ed137)[_0xfae2('0x39')](_0x14fc47);};}exports['index']=function(_0x2aca76,_0x1f9bb8){var _0x231cb2={},_0x656e40={},_0x3c7bfa={'count':0x0,'rows':[]};var _0x3eee6c=_[_0xfae2('0x3a')](db[_0xfae2('0x3b')]['rawAttributes'],function(_0x452107){return{'name':_0x452107[_0xfae2('0x3c')],'type':_0x452107[_0xfae2('0x3d')][_0xfae2('0x3e')]};});_0x656e40[_0xfae2('0x3f')]=_[_0xfae2('0x3a')](_0x3eee6c,'name');_0x656e40['query']=_[_0xfae2('0x40')](_0x2aca76[_0xfae2('0x41')]);_0x656e40[_0xfae2('0x42')]=_['intersection'](_0x656e40[_0xfae2('0x3f')],_0x656e40[_0xfae2('0x41')]);_0x231cb2[_0xfae2('0x43')]=_[_0xfae2('0x44')](_0x656e40[_0xfae2('0x3f')],qs['fields'](_0x2aca76[_0xfae2('0x41')]['fields']));_0x231cb2['attributes']=_0x231cb2[_0xfae2('0x43')]['length']?_0x231cb2[_0xfae2('0x43')]:_0x656e40[_0xfae2('0x3f')];if(!_0x2aca76['query'][_0xfae2('0x45')](_0xfae2('0x46'))){_0x231cb2[_0xfae2('0x30')]=qs[_0xfae2('0x30')](_0x2aca76['query'][_0xfae2('0x30')]);_0x231cb2[_0xfae2('0x2e')]=qs[_0xfae2('0x2e')](_0x2aca76['query'][_0xfae2('0x2e')]);}_0x231cb2[_0xfae2('0x47')]=qs['sort'](_0x2aca76[_0xfae2('0x41')]['sort']);_0x231cb2[_0xfae2('0x48')]=qs['filters'](_[_0xfae2('0x49')](_0x2aca76[_0xfae2('0x41')],_0x656e40[_0xfae2('0x42')]),_0x3eee6c);if(_0x2aca76[_0xfae2('0x41')]['filter']){_0x231cb2[_0xfae2('0x48')]=_[_0xfae2('0x4a')](_0x231cb2[_0xfae2('0x48')],{'$or':_['map'](_0x3eee6c,function(_0x5ab1af){if(_0x5ab1af[_0xfae2('0x3d')]!=='VIRTUAL'){var _0xfc8f89={};_0xfc8f89[_0x5ab1af[_0xfae2('0x38')]]={'$like':'%'+_0x2aca76[_0xfae2('0x41')][_0xfae2('0x4b')]+'%'};return _0xfc8f89;}})});}_0x231cb2=_['merge']({},_0x231cb2,_0x2aca76['options']);var _0x489430={'where':_0x231cb2[_0xfae2('0x48')]};return db['ChatMessage'][_0xfae2('0x31')](_0x489430)[_0xfae2('0x20')](function(_0x536ad5){_0x3c7bfa[_0xfae2('0x31')]=_0x536ad5;if(_0x2aca76[_0xfae2('0x41')][_0xfae2('0x4c')]){_0x231cb2['include']=[{'all':!![]}];}return db[_0xfae2('0x3b')][_0xfae2('0x4d')](_0x231cb2);})['then'](function(_0x61a8cc){_0x3c7bfa[_0xfae2('0x4e')]=_0x61a8cc;return _0x3c7bfa;})[_0xfae2('0x20')](respondWithFilteredResult(_0x1f9bb8,_0x231cb2))[_0xfae2('0x2a')](handleError(_0x1f9bb8,null));};exports[_0xfae2('0x4f')]=function(_0xffc6,_0x334e39){var _0x5442d5={'raw':!![],'where':{'id':_0xffc6[_0xfae2('0x50')]['id']}},_0x280bc5={};_0x280bc5[_0xfae2('0x3f')]=_[_0xfae2('0x40')](db[_0xfae2('0x3b')][_0xfae2('0x51')]);_0x280bc5[_0xfae2('0x41')]=_[_0xfae2('0x40')](_0xffc6[_0xfae2('0x41')]);_0x280bc5['filters']=_[_0xfae2('0x44')](_0x280bc5[_0xfae2('0x3f')],_0x280bc5[_0xfae2('0x41')]);_0x5442d5['attributes']=_['intersection'](_0x280bc5[_0xfae2('0x3f')],qs['fields'](_0xffc6[_0xfae2('0x41')][_0xfae2('0x52')]));_0x5442d5[_0xfae2('0x43')]=_0x5442d5[_0xfae2('0x43')]['length']?_0x5442d5[_0xfae2('0x43')]:_0x280bc5[_0xfae2('0x3f')];if(_0xffc6[_0xfae2('0x41')]['includeAll']){_0x5442d5[_0xfae2('0x53')]=[{'all':!![]}];}_0x5442d5=_['merge']({},_0x5442d5,_0xffc6[_0xfae2('0x54')]);return db[_0xfae2('0x3b')][_0xfae2('0x55')](_0x5442d5)['then'](handleEntityNotFound(_0x334e39,null))['then'](respondWithResult(_0x334e39,null))[_0xfae2('0x2a')](handleError(_0x334e39,null));};exports[_0xfae2('0x56')]=function(_0x4a676e,_0x10cc04){return db[_0xfae2('0x3b')][_0xfae2('0x56')](_0x4a676e['body'],{})[_0xfae2('0x20')](respondWithResult(_0x10cc04,0xc9))[_0xfae2('0x2a')](handleError(_0x10cc04,null));};exports['update']=function(_0x54a0b1,_0x24ab5e){if(_0x54a0b1[_0xfae2('0x57')]['id']){delete _0x54a0b1[_0xfae2('0x57')]['id'];}return db[_0xfae2('0x3b')][_0xfae2('0x55')]({'where':{'id':_0x54a0b1[_0xfae2('0x50')]['id']}})[_0xfae2('0x20')](handleEntityNotFound(_0x24ab5e,null))['then'](saveUpdates(_0x54a0b1[_0xfae2('0x57')],null))[_0xfae2('0x20')](respondWithResult(_0x24ab5e,null))['catch'](handleError(_0x24ab5e,null));};exports['destroy']=function(_0x38f34c,_0x5b03a9){return db[_0xfae2('0x3b')][_0xfae2('0x55')]({'where':{'id':_0x38f34c['params']['id']}})['then'](handleEntityNotFound(_0x5b03a9,null))[_0xfae2('0x20')](removeEntity(_0x5b03a9,null))['catch'](handleError(_0x5b03a9,null));};exports[_0xfae2('0x58')]=function(_0xf0edb6,_0x4d4479){return db[_0xfae2('0x3b')]['describe']()[_0xfae2('0x20')](respondWithResult(_0x4d4479,null))[_0xfae2('0x2a')](handleError(_0x4d4479,null));};var interaction_log=require(_0xfae2('0x14'))(_0xfae2('0x59'));exports[_0xfae2('0x5a')]=function(_0x18a243,_0xb9ea2f,_0x5cd206){var _0x5d3511={'agent':{},'channel':_0xfae2('0x5b')};if(_0x18a243['body']['id']){delete _0x18a243[_0xfae2('0x57')]['id'];}_0x18a243['body'][_0xfae2('0x5c')]=!![];_0x18a243[_0xfae2('0x57')][_0xfae2('0x5d')]=moment()['format'](_0xfae2('0x5e'));_0x18a243[_0xfae2('0x57')][_0xfae2('0x5f')]=_0x18a243['body'][_0xfae2('0x5f')]||_0x18a243[_0xfae2('0x60')]['id'];_0x5d3511[_0xfae2('0x61')]['id']=_0x18a243['body'][_0xfae2('0x5f')];return db[_0xfae2('0x3b')][_0xfae2('0x55')]({'where':{'id':_0x18a243[_0xfae2('0x50')]['id'],'UserId':null}})[_0xfae2('0x20')](handleEntityNotFound(_0xb9ea2f,null))['then'](saveUpdates(_0x18a243[_0xfae2('0x57')],null))[_0xfae2('0x20')](function(_0x2d9304){if(_0x2d9304){_0x5d3511[_0xfae2('0x28')]=_0x2d9304[_0xfae2('0x62')]({'plain':!![]});return db['ChatInteraction'][_0xfae2('0x55')]({'where':{'id':_0x2d9304[_0xfae2('0x63')]}});}return null;})[_0xfae2('0x20')](handleEntityNotFound(_0xb9ea2f,null))[_0xfae2('0x20')](function(_0x428e4f){if(_0x428e4f){return _0x428e4f['update']({'UserId':_0x18a243[_0xfae2('0x57')][_0xfae2('0x5f')],'read1stAt':_[_0xfae2('0x64')](_0x428e4f[_0xfae2('0x65')])?moment()[_0xfae2('0x66')](_0xfae2('0x5e')):undefined});}return null;})[_0xfae2('0x20')](function(_0x4c070d){if(_0x4c070d){_0x5d3511['interaction']=_0x4c070d[_0xfae2('0x62')]({'plain':!![]});interaction_log[_0xfae2('0x21')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18a243[_0xfae2('0x60')]['id'],_0x18a243[_0xfae2('0x60')][_0xfae2('0x38')],_0x18a243['user'][_0xfae2('0x67')],_0x5d3511[_0xfae2('0x68')]['id'],_0x18a243[_0xfae2('0x57')]?JSON[_0xfae2('0x26')](_0x18a243[_0xfae2('0x57')]):'null');return respondWithRpcPromise(_0xfae2('0x69'),_0xfae2('0x6a'),_0x5d3511);}return null;})[_0xfae2('0x20')](function(_0x4186a1){var _0x58c0e8=_0xfae2('0x6b')+_0x4186a1[_0xfae2('0x28')][_0xfae2('0x6c')];return db[_0xfae2('0x6d')][_0xfae2('0x41')](_0x58c0e8,{'type':db[_0xfae2('0x6e')][_0xfae2('0x6f')][_0xfae2('0x70')],'raw':!![]})[_0xfae2('0x20')](function(_0x197bce){return _0x197bce;});})[_0xfae2('0x20')](function(_0x58e4b8){if(_0x58e4b8){_0x5d3511[_0xfae2('0x28')][_0xfae2('0x71')]=_0x58e4b8[0x0];if(!_0x18a243[_0xfae2('0x57')][_0xfae2('0x5f')])return;return db[_0xfae2('0x72')][_0xfae2('0x55')]({'where':{'id':_0x18a243[_0xfae2('0x57')][_0xfae2('0x5f')],'role':_0xfae2('0x61')},'attributes':['id',_0xfae2('0x38'),'fullname',_0xfae2('0x73'),'internal'],'raw':!![]});}return null;})['then'](function(_0x29c22e){if(!_0x29c22e)return null;_0x5d3511[_0xfae2('0x28')][_0xfae2('0x61')]=_0x29c22e;return _0x5d3511;})[_0xfae2('0x20')](function(_0x46987e){if(_0x46987e){if(_0x18a243['body'][_0xfae2('0x74')]){_0x5d3511[_0xfae2('0x28')][_0xfae2('0x75')]=util[_0xfae2('0x66')](_0xfae2('0x76'),_0x18a243[_0xfae2('0x60')][_0xfae2('0x38')]);_0x5d3511['message'][_0xfae2('0x77')]=_0x5d3511[_0xfae2('0x77')];_0x5d3511[_0xfae2('0x28')][_0xfae2('0x78')]=_0x5d3511['channel'];_0x5d3511[_0xfae2('0x28')][_0xfae2('0x79')]=_0xfae2('0x5a');return respondWithRpcPromise(_0xfae2('0x7a'),_0xfae2('0x7a'),{'event':_0xfae2('0x7b'),'message':_[_0xfae2('0x4a')](_0x5d3511[_0xfae2('0x28')],JSON[_0xfae2('0x7c')](_0x5d3511[_0xfae2('0x68')][_0xfae2('0x7d')]))},client9002)[_0xfae2('0x20')](function(){return _0x5d3511;});}return _0x5d3511;}return null;})[_0xfae2('0x20')](respondWithResult(_0xb9ea2f,null))[_0xfae2('0x2a')](handleError(_0xb9ea2f,null));};var interaction_log=require(_0xfae2('0x14'))('chat-interactions');exports['reject']=function(_0x5586ea,_0x57fede,_0x466c59){var _0x28368d={'agent':{},'channel':'chat'};if(_0x5586ea[_0xfae2('0x57')]['id']){delete _0x5586ea[_0xfae2('0x57')]['id'];}_0x5586ea[_0xfae2('0x57')]['UserId']=_0x5586ea[_0xfae2('0x57')][_0xfae2('0x5f')]||_0x5586ea['user']['id'];_0x28368d['agent']['id']=_0x5586ea[_0xfae2('0x57')]['UserId'];return db['ChatMessage'][_0xfae2('0x55')]({'where':{'id':_0x5586ea[_0xfae2('0x50')]['id'],'UserId':null}})[_0xfae2('0x20')](handleEntityNotFound(_0x57fede,null))['then'](function(_0x3d9e28){if(_0x3d9e28){_0x28368d[_0xfae2('0x28')]=_0x3d9e28[_0xfae2('0x62')]({'plain':!![]});return db[_0xfae2('0x7e')]['find']({'where':{'id':_0x3d9e28[_0xfae2('0x63')]}});}return null;})[_0xfae2('0x20')](handleEntityNotFound(_0x57fede,null))['then'](function(_0x3e58bf){if(_0x3e58bf){_0x28368d[_0xfae2('0x68')]=_0x3e58bf[_0xfae2('0x62')]({'plain':!![]});interaction_log[_0xfae2('0x21')](_0xfae2('0x7f'),_0x5586ea['user']['id'],_0x5586ea['user'][_0xfae2('0x38')],_0x5586ea[_0xfae2('0x60')][_0xfae2('0x67')],_0x28368d[_0xfae2('0x68')]['id'],_0x5586ea[_0xfae2('0x57')]?JSON[_0xfae2('0x26')](_0x5586ea[_0xfae2('0x57')]):'null');return respondWithRpcPromise(_0xfae2('0x80'),_0xfae2('0x81'),_0x28368d);}return null;})[_0xfae2('0x20')](function(_0x2ddd3d){var _0x2b5fbc=_0xfae2('0x6b')+_0x2ddd3d[_0xfae2('0x28')][_0xfae2('0x6c')];return db[_0xfae2('0x6d')]['query'](_0x2b5fbc,{'type':db['Sequelize'][_0xfae2('0x6f')][_0xfae2('0x70')],'raw':!![]})[_0xfae2('0x20')](function(_0x822132){return _0x822132;});})[_0xfae2('0x20')](function(_0x4b1bb8){if(_0x4b1bb8){_0x28368d[_0xfae2('0x28')][_0xfae2('0x71')]=_0x4b1bb8[0x0];if(!_0x5586ea[_0xfae2('0x57')]['UserId'])return;return db[_0xfae2('0x72')][_0xfae2('0x55')]({'where':{'id':_0x5586ea[_0xfae2('0x57')][_0xfae2('0x5f')],'role':_0xfae2('0x61')},'attributes':['id',_0xfae2('0x38'),_0xfae2('0x82'),_0xfae2('0x73'),_0xfae2('0x83')],'raw':!![]});}return null;})['then'](function(_0x13838b){if(!_0x13838b)return null;_0x28368d[_0xfae2('0x28')][_0xfae2('0x61')]=_0x13838b;return _0x28368d;})[_0xfae2('0x20')](function(_0x5262fc){if(_0x5262fc){_0x5262fc[_0xfae2('0x28')]['interface']=util['format'](_0xfae2('0x76'),_0x5586ea[_0xfae2('0x60')][_0xfae2('0x38')]);_0x5262fc['message'][_0xfae2('0x77')]=_0x28368d[_0xfae2('0x77')];_0x5262fc[_0xfae2('0x28')]['motionChannel']=_0x28368d[_0xfae2('0x77')];_0x5262fc['message'][_0xfae2('0x79')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xfae2('0x84'),'message':_[_0xfae2('0x4a')](_0x28368d[_0xfae2('0x28')],JSON[_0xfae2('0x7c')](_0x28368d[_0xfae2('0x68')][_0xfae2('0x7d')]))},client9002);return _0x28368d;}return null;})['then'](respondWithResult(_0x57fede,null))['catch'](handleError(_0x57fede,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 4cd7bcf..251b403 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 _0x673e=['save','remove','emit','hasOwnProperty','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x50e440,_0x274af9){var _0x4257f0=function(_0x1dd4dd){while(--_0x1dd4dd){_0x50e440['push'](_0x50e440['shift']());}};_0x4257f0(++_0x274af9);}(_0x673e,0x1d4));var _0xe673=function(_0x21e4e6,_0x24c576){_0x21e4e6=_0x21e4e6-0x0;var _0x204b2d=_0x673e[_0x21e4e6];return _0x204b2d;};'use strict';var EventEmitter=require(_0xe673('0x0'));var ChatMessage=require(_0xe673('0x1'))['db'][_0xe673('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe673('0x3')](0x0);var events={'afterCreate':_0xe673('0x4'),'afterUpdate':'update','afterDestroy':_0xe673('0x5')};function emitEvent(_0x33b435){return function(_0x5449cf,_0x3353af,_0x13a544){ChatMessageEvents[_0xe673('0x6')](_0x33b435+':'+_0x5449cf['id'],_0x5449cf);ChatMessageEvents[_0xe673('0x6')](_0x33b435,_0x5449cf);_0x13a544(null);};}for(var e in events){if(events[_0xe673('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x8a08=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage'];(function(_0x51fa50,_0x327b8c){var _0x53e502=function(_0x2f65be){while(--_0x2f65be){_0x51fa50['push'](_0x51fa50['shift']());}};_0x53e502(++_0x327b8c);}(_0x8a08,0x127));var _0x88a0=function(_0x1940b2,_0x2dbe49){_0x1940b2=_0x1940b2-0x0;var _0x369750=_0x8a08[_0x1940b2];return _0x369750;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x88a0('0x0'))['db'][_0x88a0('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x88a0('0x2')](0x0);var events={'afterCreate':_0x88a0('0x3'),'afterUpdate':'update','afterDestroy':_0x88a0('0x4')};function emitEvent(_0x4ee8e2){return function(_0x4bcfeb,_0x2fe427,_0x40b860){ChatMessageEvents['emit'](_0x4ee8e2+':'+_0x4bcfeb['id'],_0x4bcfeb);ChatMessageEvents[_0x88a0('0x5')](_0x4ee8e2,_0x4bcfeb);_0x40b860(null);};}for(var e in events){if(events[_0x88a0('0x6')](e)){var event=events[e];ChatMessage[_0x88a0('0x7')](e,emitEvent(event));}}module[_0x88a0('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b6aaa39..918e358 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 _0x1521=['out','secret','UserId','ChatInteraction','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase'];(function(_0x5f0a31,_0x2d3496){var _0x37ef20=function(_0x468b03){while(--_0x468b03){_0x5f0a31['push'](_0x5f0a31['shift']());}};_0x37ef20(++_0x2d3496);}(_0x1521,0x11c));var _0x1152=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x1521[_0x36b037];return _0x409194;};'use strict';var _=require('lodash');var util=require(_0x1152('0x0'));var logger=require(_0x1152('0x1'))(_0x1152('0x2'));var moment=require(_0x1152('0x3'));var BPromise=require(_0x1152('0x4'));var rp=require(_0x1152('0x5'));var fs=require('fs');var path=require(_0x1152('0x6'));var rimraf=require('rimraf');var config=require(_0x1152('0x7'));var attributes=require('./chatMessage.attributes');module[_0x1152('0x8')]=function(_0xf59dec,_0x10a765){return _0xf59dec['define'](_0x1152('0x9'),attributes,{'tableName':_0x1152('0xa'),'paranoid':![],'indexes':[{'name':_0x1152('0xb'),'fields':['body'],'type':_0x1152('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45f68d,_0x999933,_0x13e967){var _0x4730fb=_0xf59dec['models'];var _0xc472c7=_0x45f68d[_0x1152('0xd')]({'plain':!![]});if(_0xc472c7[_0x1152('0xe')][_0x1152('0xf')]()==='in'||_0xc472c7[_0x1152('0xe')][_0x1152('0xf')]()===_0x1152('0x10')&&!_0xc472c7[_0x1152('0x11')]&&!_['isNil'](_0xc472c7[_0x1152('0x12')])){_0x4730fb[_0x1152('0x13')]['findOne']({'where':{'id':_0xc472c7['ChatInteractionId']}})['then'](function(_0x1b88bf){if(_0x1b88bf){_0x1b88bf['update']({'lastMsgAt':_0xc472c7[_0x1152('0x14')],'lastMsgDirection':_0xc472c7['direction'][_0x1152('0xf')]()});}})[_0x1152('0x15')](function(_0x535afe){console[_0x1152('0x16')](_0x535afe);});}_0x13e967();}},'charset':_0x1152('0x17'),'collate':_0x1152('0x18')});}; \ No newline at end of file +var _0xcaa3=['error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt'];(function(_0x32f8e7,_0x2f818e){var _0x117a06=function(_0x361363){while(--_0x361363){_0x32f8e7['push'](_0x32f8e7['shift']());}};_0x117a06(++_0x2f818e);}(_0xcaa3,0x1b5));var _0x3caa=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0xcaa3[_0x405385];return _0x43837b;};'use strict';var _=require(_0x3caa('0x0'));var util=require(_0x3caa('0x1'));var logger=require(_0x3caa('0x2'))('api');var moment=require(_0x3caa('0x3'));var BPromise=require(_0x3caa('0x4'));var rp=require(_0x3caa('0x5'));var fs=require('fs');var path=require(_0x3caa('0x6'));var rimraf=require(_0x3caa('0x7'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0x3caa('0x8')]=function(_0x16becc,_0x2b411e){return _0x16becc[_0x3caa('0x9')](_0x3caa('0xa'),attributes,{'tableName':_0x3caa('0xb'),'paranoid':![],'indexes':[{'name':_0x3caa('0xc'),'fields':[_0x3caa('0xd')],'type':_0x3caa('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29153d,_0xb82191,_0x455d8b){var _0x24506d=_0x16becc[_0x3caa('0xf')];var _0x1a665d=_0x29153d['get']({'plain':!![]});if(_0x1a665d[_0x3caa('0x10')][_0x3caa('0x11')]()==='in'||_0x1a665d['direction'][_0x3caa('0x11')]()===_0x3caa('0x12')&&!_0x1a665d[_0x3caa('0x13')]&&!_[_0x3caa('0x14')](_0x1a665d[_0x3caa('0x15')])){_0x24506d[_0x3caa('0x16')][_0x3caa('0x17')]({'where':{'id':_0x1a665d[_0x3caa('0x18')]}})['then'](function(_0x58b6aa){if(_0x58b6aa){_0x58b6aa[_0x3caa('0x19')]({'lastMsgAt':_0x1a665d[_0x3caa('0x1a')],'lastMsgDirection':_0x1a665d['direction']['toLowerCase']()});}})['catch'](function(_0x7b2e31){console[_0x3caa('0x1b')](_0x7b2e31);});}_0x455d8b();}},'charset':'utf8mb4','collate':_0x3caa('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 365aaab..b803f13 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 _0x0842=['redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x375f40,_0x511157){var _0x27a221=function(_0x131feb){while(--_0x131feb){_0x375f40['push'](_0x375f40['shift']());}};_0x27a221(++_0x511157);}(_0x0842,0xeb));var _0x2084=function(_0x160136,_0x2ca160){_0x160136=_0x160136-0x0;var _0x5d5eff=_0x0842[_0x160136];return _0x5d5eff;};'use strict';var _=require(_0x2084('0x0'));var util=require('util');var moment=require(_0x2084('0x1'));var BPromise=require(_0x2084('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2084('0x3'))['db'];var utils=require(_0x2084('0x4'));var logger=require(_0x2084('0x5'))('rpc');var config=require(_0x2084('0x6'));var jayson=require(_0x2084('0x7'));var client=jayson[_0x2084('0x8')][_0x2084('0x9')]({'port':0x232a});config[_0x2084('0xa')]=_[_0x2084('0xb')](config[_0x2084('0xa')],{'host':_0x2084('0xc'),'port':0x18eb});var socket=require(_0x2084('0xd'))(new Redis(config[_0x2084('0xa')]));require(_0x2084('0xe'))[_0x2084('0xf')](socket);function respondWithRpcPromise(_0x3a9bc3,_0xc7431a,_0x19dd5a){return new BPromise(function(_0x5e1066,_0x4cb8ea){return client[_0x2084('0x10')](_0x3a9bc3,_0x19dd5a)['then'](function(_0x5659da){logger[_0x2084('0x11')](_0x2084('0x12'),_0xc7431a,_0x2084('0x13'));logger['debug'](_0x2084('0x14'),_0xc7431a,_0x2084('0x13'),JSON[_0x2084('0x15')](_0x5659da));if(_0x5659da[_0x2084('0x16')]){if(_0x5659da[_0x2084('0x16')][_0x2084('0x17')]===0x1f4){logger[_0x2084('0x16')](_0x2084('0x12'),_0xc7431a,_0x5659da[_0x2084('0x16')][_0x2084('0x18')]);return _0x4cb8ea(_0x5659da[_0x2084('0x16')]['message']);}logger[_0x2084('0x16')](_0x2084('0x12'),_0xc7431a,_0x5659da['error']['message']);return _0x5e1066(_0x5659da[_0x2084('0x16')]['message']);}else{logger[_0x2084('0x11')](_0x2084('0x12'),_0xc7431a,_0x2084('0x13'));_0x5e1066(_0x5659da[_0x2084('0x19')][_0x2084('0x18')]);}})[_0x2084('0x1a')](function(_0x444031){logger[_0x2084('0x16')](_0x2084('0x12'),_0xc7431a,_0x444031);_0x4cb8ea(_0x444031);});});}exports[_0x2084('0x1b')]=function(_0x360079){var _0x5a6777=this;return new Promise(function(_0x9f7abd,_0x3ad78e){return db[_0x2084('0x1c')][_0x2084('0x1d')](_0x360079[_0x2084('0x1e')],{'raw':_0x360079['options']?_0x360079[_0x2084('0x1f')][_0x2084('0x20')]===undefined?!![]:![]:!![]})[_0x2084('0x21')](function(_0x42c845){logger[_0x2084('0x11')](_0x2084('0x1b'),_0x360079);logger[_0x2084('0x22')](_0x2084('0x1b'),_0x360079,JSON[_0x2084('0x15')](_0x42c845));_0x9f7abd(_0x42c845);})[_0x2084('0x1a')](function(_0x308db7){logger[_0x2084('0x16')](_0x2084('0x1b'),_0x308db7[_0x2084('0x18')],_0x360079);_0x3ad78e(_0x5a6777[_0x2084('0x16')](0x1f4,_0x308db7['message']));});});}; \ No newline at end of file +var _0x28d7=['ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./chatMessage.socket','register','request','then','info'];(function(_0x357b22,_0x2701de){var _0x1a7b17=function(_0x25f631){while(--_0x25f631){_0x357b22['push'](_0x357b22['shift']());}};_0x1a7b17(++_0x2701de);}(_0x28d7,0xe7));var _0x728d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x728d('0x0'));var BPromise=require('bluebird');var rs=require(_0x728d('0x1'));var fs=require('fs');var Redis=require(_0x728d('0x2'));var db=require(_0x728d('0x3'))['db'];var utils=require(_0x728d('0x4'));var logger=require(_0x728d('0x5'))(_0x728d('0x6'));var config=require(_0x728d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x728d('0x8')]({'port':0x232a});config[_0x728d('0x9')]=_[_0x728d('0xa')](config[_0x728d('0x9')],{'host':_0x728d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x728d('0x9')]));require(_0x728d('0xc'))[_0x728d('0xd')](socket);function respondWithRpcPromise(_0x180ea4,_0x1947d7,_0x32cc26){return new BPromise(function(_0x4586ef,_0x14cad){return client[_0x728d('0xe')](_0x180ea4,_0x32cc26)[_0x728d('0xf')](function(_0x904c4a){logger[_0x728d('0x10')](_0x728d('0x11'),_0x1947d7,'request\x20sent');logger[_0x728d('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1947d7,_0x728d('0x13'),JSON[_0x728d('0x14')](_0x904c4a));if(_0x904c4a['error']){if(_0x904c4a[_0x728d('0x15')][_0x728d('0x16')]===0x1f4){logger[_0x728d('0x15')](_0x728d('0x11'),_0x1947d7,_0x904c4a[_0x728d('0x15')]['message']);return _0x14cad(_0x904c4a[_0x728d('0x15')][_0x728d('0x17')]);}logger[_0x728d('0x15')]('ChatMessage,\x20%s,\x20%s',_0x1947d7,_0x904c4a[_0x728d('0x15')][_0x728d('0x17')]);return _0x4586ef(_0x904c4a[_0x728d('0x15')][_0x728d('0x17')]);}else{logger[_0x728d('0x10')](_0x728d('0x11'),_0x1947d7,'request\x20sent');_0x4586ef(_0x904c4a['result'][_0x728d('0x17')]);}})[_0x728d('0x18')](function(_0x516eae){logger['error'](_0x728d('0x11'),_0x1947d7,_0x516eae);_0x14cad(_0x516eae);});});}exports[_0x728d('0x19')]=function(_0x920ae2){var _0x10040e=this;return new Promise(function(_0x64cd1b,_0x38562a){return db[_0x728d('0x1a')][_0x728d('0x1b')](_0x920ae2[_0x728d('0x1c')],{'raw':_0x920ae2['options']?_0x920ae2[_0x728d('0x1d')][_0x728d('0x1e')]===undefined?!![]:![]:!![]})[_0x728d('0xf')](function(_0x533767){logger[_0x728d('0x10')](_0x728d('0x19'),_0x920ae2);logger[_0x728d('0x12')]('CreateChatMessage',_0x920ae2,JSON[_0x728d('0x14')](_0x533767));_0x64cd1b(_0x533767);})['catch'](function(_0x2e425a){logger[_0x728d('0x15')](_0x728d('0x19'),_0x2e425a['message'],_0x920ae2);_0x38562a(_0x10040e['error'](0x1f4,_0x2e425a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 56c01b8..f478b3c 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 _0xa63f=['./chatMessage.events','save','remove','update','emit','length'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa63f,0x1b6));var _0xfa63=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xa63f[_0x4ff09b];return _0x3f5c2e;};'use strict';var ChatMessageEvents=require(_0xfa63('0x0'));var events=[_0xfa63('0x1'),_0xfa63('0x2'),_0xfa63('0x3')];function createListener(_0x3103ba,_0x2bbc5a){return function(_0x401dbf){_0x2bbc5a[_0xfa63('0x4')](_0x3103ba,_0x401dbf);};}function removeListener(_0x37e644,_0x138518){return function(){ChatMessageEvents['removeListener'](_0x37e644,_0x138518);};}exports['register']=function(_0x20d4f6){for(var _0x41efce=0x0,_0xb35bc5=events[_0xfa63('0x5')];_0x41efce<_0xb35bc5;_0x41efce++){var _0x486050=events[_0x41efce];var _0x505e1a=createListener('chatMessage:'+_0x486050,_0x20d4f6);ChatMessageEvents['on'](_0x486050,_0x505e1a);}}; \ No newline at end of file +var _0x8a28=['chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8a28,0xfd));var _0x88a2=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x8a28[_0x1ddedd];return _0xa3e1ac;};'use strict';var ChatMessageEvents=require(_0x88a2('0x0'));var events=[_0x88a2('0x1'),_0x88a2('0x2'),_0x88a2('0x3')];function createListener(_0x27b1c1,_0x29e6d8){return function(_0x26138e){_0x29e6d8[_0x88a2('0x4')](_0x27b1c1,_0x26138e);};}function removeListener(_0x5d5b92,_0x2f482e){return function(){ChatMessageEvents[_0x88a2('0x5')](_0x5d5b92,_0x2f482e);};}exports[_0x88a2('0x6')]=function(_0x438e32){for(var _0x29ce92=0x0,_0x5cb591=events[_0x88a2('0x7')];_0x29ce92<_0x5cb591;_0x29ce92++){var _0x5406ed=events[_0x29ce92];var _0x1cdf6b=createListener(_0x88a2('0x8')+_0x5406ed,_0x438e32);ChatMessageEvents['on'](_0x5406ed,_0x1cdf6b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1f00b2e..b0ce08a 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 _0xae35=['put','update','/:id/reject','delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','show','post','tracked','chat','create'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0xae35,0xd7));var _0x5ae3=function(_0x17a67c,_0x8fa232){_0x17a67c=_0x17a67c-0x0;var _0x1c5c11=_0xae35[_0x17a67c];return _0x1c5c11;};'use strict';var multer=require(_0x5ae3('0x0'));var util=require(_0x5ae3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5ae3('0x2'));var router=express[_0x5ae3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5ae3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5ae3('0x5'));var controller=require(_0x5ae3('0x6'));router[_0x5ae3('0x7')]('/',auth[_0x5ae3('0x8')](),controller[_0x5ae3('0x9')]);router[_0x5ae3('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x5ae3('0xa')]);router[_0x5ae3('0x7')]('/:id',auth[_0x5ae3('0x8')](),controller[_0x5ae3('0xb')]);router[_0x5ae3('0xc')]('/',auth[_0x5ae3('0x8')](),interaction[_0x5ae3('0xd')](_0x5ae3('0xe'),'chatmessage:create'),controller[_0x5ae3('0xf')]);router[_0x5ae3('0x10')]('/:id',controller[_0x5ae3('0x11')]);router[_0x5ae3('0x10')]('/:id/accept',auth[_0x5ae3('0x8')](),controller['accept']);router[_0x5ae3('0x10')](_0x5ae3('0x12'),auth[_0x5ae3('0x8')](),controller['reject']);router[_0x5ae3('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5ae3('0x14')]=router; \ No newline at end of file +var _0x9e8e=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','delete','util','path','connect-timeout','express'];(function(_0x6ac602,_0x52b724){var _0x1422f7=function(_0x1fa412){while(--_0x1fa412){_0x6ac602['push'](_0x6ac602['shift']());}};_0x1422f7(++_0x52b724);}(_0x9e8e,0x1df));var _0xe9e8=function(_0x1a25ae,_0x1d145e){_0x1a25ae=_0x1a25ae-0x0;var _0x5293ce=_0x9e8e[_0x1a25ae];return _0x5293ce;};'use strict';var multer=require('multer');var util=require(_0xe9e8('0x0'));var path=require(_0xe9e8('0x1'));var timeout=require(_0xe9e8('0x2'));var express=require(_0xe9e8('0x3'));var router=express[_0xe9e8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe9e8('0x5'));var interaction=require(_0xe9e8('0x6'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0xe9e8('0x7')]('/',auth[_0xe9e8('0x8')](),controller['index']);router[_0xe9e8('0x7')](_0xe9e8('0x9'),auth[_0xe9e8('0x8')](),controller[_0xe9e8('0xa')]);router[_0xe9e8('0x7')](_0xe9e8('0xb'),auth[_0xe9e8('0x8')](),controller[_0xe9e8('0xc')]);router['post']('/',auth[_0xe9e8('0x8')](),interaction[_0xe9e8('0xd')](_0xe9e8('0xe'),_0xe9e8('0xf')),controller[_0xe9e8('0x10')]);router[_0xe9e8('0x11')](_0xe9e8('0xb'),controller[_0xe9e8('0x12')]);router[_0xe9e8('0x11')](_0xe9e8('0x13'),auth[_0xe9e8('0x8')](),controller[_0xe9e8('0x14')]);router['put']('/:id/reject',auth[_0xe9e8('0x8')](),controller[_0xe9e8('0x15')]);router[_0xe9e8('0x16')](_0xe9e8('0xb'),auth[_0xe9e8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 495fb0f..12037e4 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x0b0e[_0x3e182f];return _0x23edc9;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x12a31b,_0x4c7508){var _0x5e0ede=function(_0x39ff08){while(--_0x39ff08){_0x12a31b['push'](_0x12a31b['shift']());}};_0x5e0ede(++_0x4c7508);}(_0x2032,0xd9));var _0x2203=function(_0xc59a94,_0x3fb51f){_0xc59a94=_0xc59a94-0x0;var _0x12dd60=_0x2032[_0xc59a94];return _0x12dd60;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 77a5bbd..fd2051f 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(_0x24a9c5,_0x34be29){var _0x59422d=function(_0x244090){while(--_0x244090){_0x24a9c5['push'](_0x24a9c5['shift']());}};_0x59422d(++_0x34be29);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _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(_0x180022,_0x3fd336){var _0x5a77b4=function(_0x55ddea){while(--_0x55ddea){_0x180022['push'](_0x180022['shift']());}};_0x5a77b4(++_0x3fd336);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 0e68a1a..ff46041 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 _0x711c=['update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x337a31,_0xb1bb23){var _0x30b8f2=function(_0x2f1d65){while(--_0x2f1d65){_0x337a31['push'](_0x337a31['shift']());}};_0x30b8f2(++_0xb1bb23);}(_0x711c,0x74));var _0xc711=function(_0x336d06,_0x39bd81){_0x336d06=_0x336d06-0x0;var _0x55984b=_0x711c[_0x336d06];return _0x55984b;};'use strict';var EventEmitter=require(_0xc711('0x0'));var ChatOfflineMessage=require(_0xc711('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xc711('0x2')](0x0);var events={'afterCreate':_0xc711('0x3'),'afterUpdate':_0xc711('0x4'),'afterDestroy':'remove'};function emitEvent(_0x588b21){return function(_0x59c6a8,_0x1294ff,_0x272abd){ChatOfflineMessageEvents[_0xc711('0x5')](_0x588b21+':'+_0x59c6a8['id'],_0x59c6a8);ChatOfflineMessageEvents[_0xc711('0x5')](_0x588b21,_0x59c6a8);_0x272abd(null);};}for(var e in events){if(events[_0xc711('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xc711('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x07e8=['exports','events','../../mysqldb','ChatOfflineMessage','save','remove','emit','hasOwnProperty','hook'];(function(_0x3f4ce6,_0x5cd9bc){var _0xe24740=function(_0x2fd664){while(--_0x2fd664){_0x3f4ce6['push'](_0x3f4ce6['shift']());}};_0xe24740(++_0x5cd9bc);}(_0x07e8,0x10f));var _0x807e=function(_0x47c167,_0x130ba6){_0x47c167=_0x47c167-0x0;var _0x113f55=_0x07e8[_0x47c167];return _0x113f55;};'use strict';var EventEmitter=require(_0x807e('0x0'));var ChatOfflineMessage=require(_0x807e('0x1'))['db'][_0x807e('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x807e('0x3'),'afterUpdate':'update','afterDestroy':_0x807e('0x4')};function emitEvent(_0x51e9d4){return function(_0x47d154,_0x2c423b,_0x2dddb4){ChatOfflineMessageEvents[_0x807e('0x5')](_0x51e9d4+':'+_0x47d154['id'],_0x47d154);ChatOfflineMessageEvents['emit'](_0x51e9d4,_0x47d154);_0x2dddb4(null);};}for(var e in events){if(events[_0x807e('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x807e('0x7')](e,emitEvent(event));}}module[_0x807e('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8a2a228..1fb9859 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 _0xd3d4=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x540c61,_0x16f596){var _0x181e21=function(_0x158b4b){while(--_0x158b4b){_0x540c61['push'](_0x540c61['shift']());}};_0x181e21(++_0x16f596);}(_0xd3d4,0x188));var _0x4d3d=function(_0x30839a,_0x6cd6f4){_0x30839a=_0x30839a-0x0;var _0x21ab5b=_0xd3d4[_0x30839a];return _0x21ab5b;};'use strict';var attributes=require(_0x4d3d('0x0'));module[_0x4d3d('0x1')]=function(_0x17c5ab){return _0x17c5ab[_0x4d3d('0x2')](_0x4d3d('0x3'),attributes,{'tableName':_0x4d3d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4d3d('0x5')});}; \ No newline at end of file +var _0xc1a3=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc1a3,0x137));var _0x3c1a=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xc1a3[_0x31a371];return _0x2a5bd6;};'use strict';var attributes=require(_0x3c1a('0x0'));module[_0x3c1a('0x1')]=function(_0x3f7698){return _0x3f7698[_0x3c1a('0x2')](_0x3c1a('0x3'),attributes,{'tableName':_0x3c1a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c1a('0x5'),'collate':_0x3c1a('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 05b3629..833a6ce 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 _0xfe43=['../../config/logger','../../config/environment','jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3205dd,_0x147e2c){var _0x4fb353=function(_0x196998){while(--_0x196998){_0x3205dd['push'](_0x3205dd['shift']());}};_0x4fb353(++_0x147e2c);}(_0xfe43,0x120));var _0x3fe4=function(_0x196bc1,_0x38b037){_0x196bc1=_0x196bc1-0x0;var _0x35a231=_0xfe43[_0x196bc1];return _0x35a231;};'use strict';var _=require(_0x3fe4('0x0'));var util=require('util');var moment=require(_0x3fe4('0x1'));var BPromise=require(_0x3fe4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fe4('0x3'));var db=require(_0x3fe4('0x4'))['db'];var utils=require(_0x3fe4('0x5'));var logger=require(_0x3fe4('0x6'))('rpc');var config=require(_0x3fe4('0x7'));var jayson=require(_0x3fe4('0x8'));var client=jayson['client'][_0x3fe4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15dc3c,_0x53413b,_0x1311ec){return new BPromise(function(_0x36027e,_0x2aa775){return client['request'](_0x15dc3c,_0x1311ec)[_0x3fe4('0xa')](function(_0x5ace2f){logger[_0x3fe4('0xb')](_0x3fe4('0xc'),_0x53413b,_0x3fe4('0xd'));logger[_0x3fe4('0xe')](_0x3fe4('0xf'),_0x53413b,_0x3fe4('0xd'),JSON[_0x3fe4('0x10')](_0x5ace2f));if(_0x5ace2f[_0x3fe4('0x11')]){if(_0x5ace2f['error'][_0x3fe4('0x12')]===0x1f4){logger['error'](_0x3fe4('0xc'),_0x53413b,_0x5ace2f[_0x3fe4('0x11')][_0x3fe4('0x13')]);return _0x2aa775(_0x5ace2f['error'][_0x3fe4('0x13')]);}logger['error'](_0x3fe4('0xc'),_0x53413b,_0x5ace2f[_0x3fe4('0x11')][_0x3fe4('0x13')]);return _0x36027e(_0x5ace2f[_0x3fe4('0x11')][_0x3fe4('0x13')]);}else{logger[_0x3fe4('0xb')](_0x3fe4('0xc'),_0x53413b,_0x3fe4('0xd'));_0x36027e(_0x5ace2f[_0x3fe4('0x14')][_0x3fe4('0x13')]);}})['catch'](function(_0x15017e){logger[_0x3fe4('0x11')](_0x3fe4('0xc'),_0x53413b,_0x15017e);_0x2aa775(_0x15017e);});});} \ No newline at end of file +var _0x68ef=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x67892,_0x38d6e9){var _0x4dcfff=function(_0x225eaa){while(--_0x225eaa){_0x67892['push'](_0x67892['shift']());}};_0x4dcfff(++_0x38d6e9);}(_0x68ef,0x10a));var _0xf68e=function(_0x2efdd7,_0x33b50a){_0x2efdd7=_0x2efdd7-0x0;var _0x45cc51=_0x68ef[_0x2efdd7];return _0x45cc51;};'use strict';var _=require(_0xf68e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf68e('0x1'));var rs=require(_0xf68e('0x2'));var fs=require('fs');var Redis=require(_0xf68e('0x3'));var db=require(_0xf68e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf68e('0x5'));var config=require(_0xf68e('0x6'));var jayson=require(_0xf68e('0x7'));var client=jayson[_0xf68e('0x8')][_0xf68e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x323726,_0x3a614c,_0x50f705){return new BPromise(function(_0x15faff,_0x5477fa){return client[_0xf68e('0xa')](_0x323726,_0x50f705)[_0xf68e('0xb')](function(_0x1e1c2a){logger[_0xf68e('0xc')](_0xf68e('0xd'),_0x3a614c,_0xf68e('0xe'));logger[_0xf68e('0xf')](_0xf68e('0x10'),_0x3a614c,_0xf68e('0xe'),JSON[_0xf68e('0x11')](_0x1e1c2a));if(_0x1e1c2a[_0xf68e('0x12')]){if(_0x1e1c2a['error'][_0xf68e('0x13')]===0x1f4){logger[_0xf68e('0x12')](_0xf68e('0xd'),_0x3a614c,_0x1e1c2a[_0xf68e('0x12')]['message']);return _0x5477fa(_0x1e1c2a[_0xf68e('0x12')][_0xf68e('0x14')]);}logger[_0xf68e('0x12')](_0xf68e('0xd'),_0x3a614c,_0x1e1c2a[_0xf68e('0x12')]['message']);return _0x15faff(_0x1e1c2a[_0xf68e('0x12')][_0xf68e('0x14')]);}else{logger[_0xf68e('0xc')](_0xf68e('0xd'),_0x3a614c,_0xf68e('0xe'));_0x15faff(_0x1e1c2a[_0xf68e('0x15')][_0xf68e('0x14')]);}})[_0xf68e('0x16')](function(_0x4bd507){logger['error'](_0xf68e('0xd'),_0x3a614c,_0x4bd507);_0x5477fa(_0x4bd507);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 67090ec..901a23e 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 _0xdc77=['delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x30d7bd,_0x521a33){var _0x4bd842=function(_0x3fa21e){while(--_0x3fa21e){_0x30d7bd['push'](_0x30d7bd['shift']());}};_0x4bd842(++_0x521a33);}(_0xdc77,0x1cf));var _0x7dc7=function(_0x1f8591,_0x5396ac){_0x1f8591=_0x1f8591-0x0;var _0x50f0ce=_0xdc77[_0x1f8591];return _0x50f0ce;};'use strict';var multer=require(_0x7dc7('0x0'));var util=require('util');var path=require(_0x7dc7('0x1'));var timeout=require(_0x7dc7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7dc7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7dc7('0x4'));var config=require(_0x7dc7('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0x7dc7('0x6')]('/',auth['isAuthenticated'](),controller[_0x7dc7('0x7')]);router['get'](_0x7dc7('0x8'),auth[_0x7dc7('0x9')](),controller[_0x7dc7('0xa')]);router[_0x7dc7('0x6')](_0x7dc7('0xb'),auth[_0x7dc7('0x9')](),controller[_0x7dc7('0xc')]);router[_0x7dc7('0xd')]('/',auth[_0x7dc7('0x9')](),controller[_0x7dc7('0xe')]);router[_0x7dc7('0xf')](_0x7dc7('0xb'),auth[_0x7dc7('0x9')](),controller[_0x7dc7('0x10')]);router[_0x7dc7('0x11')](_0x7dc7('0xb'),auth[_0x7dc7('0x9')](),controller[_0x7dc7('0x12')]);module[_0x7dc7('0x13')]=router; \ No newline at end of file +var _0x4950=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4a9922,_0x5cd01f){var _0x5df7cc=function(_0x9a6dcd){while(--_0x9a6dcd){_0x4a9922['push'](_0x4a9922['shift']());}};_0x5df7cc(++_0x5cd01f);}(_0x4950,0x199));var _0x0495=function(_0x30a508,_0xeb3516){_0x30a508=_0x30a508-0x0;var _0x4de4da=_0x4950[_0x30a508];return _0x4de4da;};'use strict';var multer=require(_0x0495('0x0'));var util=require(_0x0495('0x1'));var path=require('path');var timeout=require(_0x0495('0x2'));var express=require(_0x0495('0x3'));var router=express[_0x0495('0x4')]();var fs_extra=require(_0x0495('0x5'));var auth=require(_0x0495('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0495('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x0495('0x8')]('/',auth[_0x0495('0x9')](),controller[_0x0495('0xa')]);router[_0x0495('0x8')](_0x0495('0xb'),auth[_0x0495('0x9')](),controller[_0x0495('0xc')]);router[_0x0495('0x8')](_0x0495('0xd'),auth[_0x0495('0x9')](),controller[_0x0495('0xe')]);router[_0x0495('0xf')]('/',auth[_0x0495('0x9')](),controller[_0x0495('0x10')]);router[_0x0495('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0495('0x12')]);router[_0x0495('0x13')](_0x0495('0xd'),auth[_0x0495('0x9')](),controller[_0x0495('0x14')]);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 389925b..acd71bc 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 _0x3526=['mouseOver','sequelize','exports','STRING','ENUM','timeout'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x3526,0x16f));var _0x6352=function(_0x202965,_0xebb2c4){_0x202965=_0x202965-0x0;var _0x1c105d=_0x3526[_0x202965];return _0x1c105d;};'use strict';var Sequelize=require(_0x6352('0x0'));module[_0x6352('0x1')]={'name':{'type':Sequelize[_0x6352('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6352('0x3')]('mouseOver',_0x6352('0x4')),'defaultValue':_0x6352('0x5')},'selector':{'type':Sequelize[_0x6352('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8919=['sequelize','exports','STRING','mouseOver','timeout','INTEGER'];(function(_0x4a6362,_0x9e782a){var _0x2653a5=function(_0x52b12b){while(--_0x52b12b){_0x4a6362['push'](_0x4a6362['shift']());}};_0x2653a5(++_0x9e782a);}(_0x8919,0x72));var _0x9891=function(_0x4bffa1,_0x1296c6){_0x4bffa1=_0x4bffa1-0x0;var _0x2fc1dd=_0x8919[_0x4bffa1];return _0x2fc1dd;};'use strict';var Sequelize=require(_0x9891('0x0'));module[_0x9891('0x1')]={'name':{'type':Sequelize[_0x9891('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9891('0x3'),_0x9891('0x4')),'defaultValue':_0x9891('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9891('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 66f6b64..202bc1d 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 _0x2b83=['path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x5d784f,_0x2d352c){var _0x2e0f32=function(_0x1b66f5){while(--_0x1b66f5){_0x5d784f['push'](_0x5d784f['shift']());}};_0x2e0f32(++_0x2d352c);}(_0x2b83,0x1d3));var _0x32b8=function(_0x260391,_0x2eda13){_0x260391=_0x260391-0x0;var _0x30abef=_0x2b83[_0x260391];return _0x30abef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32b8('0x0'));var zipdir=require(_0x32b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32b8('0x2'));var moment=require(_0x32b8('0x3'));var BPromise=require(_0x32b8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x32b8('0x5'));var sox=require(_0x32b8('0x6'));var csv=require('to-csv');var ejs=require(_0x32b8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32b8('0x8'));var squel=require(_0x32b8('0x9'));var crypto=require(_0x32b8('0xa'));var jsforce=require(_0x32b8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x32b8('0xc'));var querystring=require(_0x32b8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x32b8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x32b8('0xf'));var hardwareService=require(_0x32b8('0x10'));var logger=require(_0x32b8('0x11'))(_0x32b8('0x12'));var utils=require('../../config/utils');var config=require(_0x32b8('0x13'));var licenseUtil=require(_0x32b8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c337,_0x30d00a){_0x30d00a=_0x30d00a||0xcc;return function(_0x5a0ef2){if(_0x5a0ef2){return _0x49c337[_0x32b8('0x15')](_0x30d00a);}return _0x49c337['status'](_0x30d00a)[_0x32b8('0x16')]();};}function respondWithResult(_0x6b533e,_0x3b0fac){_0x3b0fac=_0x3b0fac||0xc8;return function(_0xdf56fb){if(_0xdf56fb){return _0x6b533e[_0x32b8('0x17')](_0x3b0fac)['json'](_0xdf56fb);}};}function respondWithFilteredResult(_0x4c8fc9,_0x5e7b4f){return function(_0x5e49d1){if(_0x5e49d1){var _0x4e0d7a=typeof _0x5e7b4f['offset']===_0x32b8('0x18')&&typeof _0x5e7b4f['limit']==='undefined';var _0x2828fc=_0x5e49d1[_0x32b8('0x19')];var _0x2ba4eb=_0x4e0d7a?0x0:_0x5e7b4f[_0x32b8('0x1a')];var _0x599bc3=_0x4e0d7a?_0x5e49d1['count']:_0x5e7b4f['offset']+_0x5e7b4f[_0x32b8('0x1b')];var _0x2ffea2;if(_0x599bc3>=_0x2828fc){_0x599bc3=_0x2828fc;_0x2ffea2=0xc8;}else{_0x2ffea2=0xce;}_0x4c8fc9[_0x32b8('0x17')](_0x2ffea2);return _0x4c8fc9[_0x32b8('0x1c')]('Content-Range',_0x2ba4eb+'-'+_0x599bc3+'/'+_0x2828fc)[_0x32b8('0x1d')](_0x5e49d1);}return null;};}function patchUpdates(_0x3ddc5f){return function(_0xb51551){try{jsonpatch[_0x32b8('0x1e')](_0xb51551,_0x3ddc5f,!![]);}catch(_0xb9dd1d){return BPromise[_0x32b8('0x1f')](_0xb9dd1d);}return _0xb51551[_0x32b8('0x20')]();};}function saveUpdates(_0xcd4b26,_0x52347c){return function(_0x567055){if(_0x567055){return _0x567055[_0x32b8('0x21')](_0xcd4b26)['then'](function(_0x1ec58d){return _0x1ec58d;});}return null;};}function removeEntity(_0x4bc4a8,_0x1a4c2b){return function(_0x21ee32){if(_0x21ee32){return _0x21ee32[_0x32b8('0x22')]()[_0x32b8('0x23')](function(){_0x4bc4a8[_0x32b8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1360,_0x25a917){return function(_0x3eea54){if(!_0x3eea54){_0x4e1360[_0x32b8('0x15')](0x194);}return _0x3eea54;};}function handleError(_0x23e195,_0x29988d){_0x29988d=_0x29988d||0x1f4;return function(_0x57a6a3){logger[_0x32b8('0x24')](_0x57a6a3[_0x32b8('0x25')]);if(_0x57a6a3[_0x32b8('0x26')]){delete _0x57a6a3[_0x32b8('0x26')];}_0x23e195[_0x32b8('0x17')](_0x29988d)[_0x32b8('0x27')](_0x57a6a3);};}exports[_0x32b8('0x28')]=function(_0x39ce15,_0x3fa029){var _0xa225ec={'raw':!![],'where':{'id':_0x39ce15[_0x32b8('0x29')]['id']}},_0x3e0548={};_0x3e0548[_0x32b8('0x2a')]=_['keys'](db[_0x32b8('0x2b')][_0x32b8('0x2c')]);_0x3e0548[_0x32b8('0x2d')]=_[_0x32b8('0x2e')](_0x39ce15[_0x32b8('0x2d')]);_0x3e0548[_0x32b8('0x2f')]=_[_0x32b8('0x30')](_0x3e0548[_0x32b8('0x2a')],_0x3e0548[_0x32b8('0x2d')]);_0xa225ec[_0x32b8('0x31')]=_['intersection'](_0x3e0548[_0x32b8('0x2a')],qs[_0x32b8('0x32')](_0x39ce15[_0x32b8('0x2d')][_0x32b8('0x32')]));_0xa225ec['attributes']=_0xa225ec['attributes'][_0x32b8('0x33')]?_0xa225ec[_0x32b8('0x31')]:_0x3e0548[_0x32b8('0x2a')];if(_0x39ce15[_0x32b8('0x2d')]['includeAll']){_0xa225ec[_0x32b8('0x34')]=[{'all':!![]}];}_0xa225ec=_[_0x32b8('0x35')]({},_0xa225ec,_0x39ce15[_0x32b8('0x36')]);return db[_0x32b8('0x2b')][_0x32b8('0x37')](_0xa225ec)[_0x32b8('0x23')](handleEntityNotFound(_0x3fa029,null))[_0x32b8('0x23')](respondWithResult(_0x3fa029,null))[_0x32b8('0x38')](handleError(_0x3fa029,null));};exports['create']=function(_0x10f17e,_0x5e8af2){return db[_0x32b8('0x2b')][_0x32b8('0x39')](_0x10f17e[_0x32b8('0x3a')],{})[_0x32b8('0x23')](respondWithResult(_0x5e8af2,0xc9))[_0x32b8('0x38')](handleError(_0x5e8af2,null));};exports[_0x32b8('0x21')]=function(_0x4c9ab0,_0x152209){if(_0x4c9ab0[_0x32b8('0x3a')]['id']){delete _0x4c9ab0[_0x32b8('0x3a')]['id'];}return db['ChatProactiveAction'][_0x32b8('0x37')]({'where':{'id':_0x4c9ab0['params']['id']}})[_0x32b8('0x23')](handleEntityNotFound(_0x152209,null))[_0x32b8('0x23')](saveUpdates(_0x4c9ab0[_0x32b8('0x3a')],null))[_0x32b8('0x23')](respondWithResult(_0x152209,null))['catch'](handleError(_0x152209,null));};exports[_0x32b8('0x22')]=function(_0x10ccf5,_0x2d586f){return db['ChatProactiveAction']['find']({'where':{'id':_0x10ccf5[_0x32b8('0x29')]['id']}})[_0x32b8('0x23')](handleEntityNotFound(_0x2d586f,null))[_0x32b8('0x23')](removeEntity(_0x2d586f,null))['catch'](handleError(_0x2d586f,null));}; \ No newline at end of file +var _0x323b=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','ChatProactiveAction','catch','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x189061,_0x21d774){var _0x257e15=function(_0x1e4a36){while(--_0x1e4a36){_0x189061['push'](_0x189061['shift']());}};_0x257e15(++_0x21d774);}(_0x323b,0x1ad));var _0xb323=function(_0x2336c3,_0x188f74){_0x2336c3=_0x2336c3-0x0;var _0x3cff23=_0x323b[_0x2336c3];return _0x3cff23;};'use strict';var emlformat=require(_0xb323('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb323('0x1'));var jsonpatch=require(_0xb323('0x2'));var rp=require(_0xb323('0x3'));var moment=require('moment');var BPromise=require(_0xb323('0x4'));var Mustache=require(_0xb323('0x5'));var util=require(_0xb323('0x6'));var path=require(_0xb323('0x7'));var sox=require(_0xb323('0x8'));var csv=require(_0xb323('0x9'));var ejs=require(_0xb323('0xa'));var fs=require('fs');var fs_extra=require(_0xb323('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb323('0xc'));var jsforce=require(_0xb323('0xd'));var deskjs=require(_0xb323('0xe'));var toCsv=require(_0xb323('0x9'));var querystring=require('querystring');var Papa=require(_0xb323('0xf'));var Redis=require(_0xb323('0x10'));var authService=require(_0xb323('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb323('0x12'));var hardwareService=require(_0xb323('0x13'));var logger=require(_0xb323('0x14'))(_0xb323('0x15'));var utils=require(_0xb323('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb323('0x17'));var db=require(_0xb323('0x18'))['db'];function respondWithStatusCode(_0x4c1bf1,_0x2f03f0){_0x2f03f0=_0x2f03f0||0xcc;return function(_0x524bf7){if(_0x524bf7){return _0x4c1bf1[_0xb323('0x19')](_0x2f03f0);}return _0x4c1bf1[_0xb323('0x1a')](_0x2f03f0)[_0xb323('0x1b')]();};}function respondWithResult(_0x51117c,_0x3a4c5f){_0x3a4c5f=_0x3a4c5f||0xc8;return function(_0x18c341){if(_0x18c341){return _0x51117c[_0xb323('0x1a')](_0x3a4c5f)[_0xb323('0x1c')](_0x18c341);}};}function respondWithFilteredResult(_0x41a47d,_0x57e9a0){return function(_0xb56df2){if(_0xb56df2){var _0xb3dd4=typeof _0x57e9a0[_0xb323('0x1d')]===_0xb323('0x1e')&&typeof _0x57e9a0['limit']===_0xb323('0x1e');var _0x3bc40f=_0xb56df2['count'];var _0x16d415=_0xb3dd4?0x0:_0x57e9a0[_0xb323('0x1d')];var _0x42a063=_0xb3dd4?_0xb56df2[_0xb323('0x1f')]:_0x57e9a0[_0xb323('0x1d')]+_0x57e9a0['limit'];var _0x3efcf7;if(_0x42a063>=_0x3bc40f){_0x42a063=_0x3bc40f;_0x3efcf7=0xc8;}else{_0x3efcf7=0xce;}_0x41a47d[_0xb323('0x1a')](_0x3efcf7);return _0x41a47d[_0xb323('0x20')]('Content-Range',_0x16d415+'-'+_0x42a063+'/'+_0x3bc40f)[_0xb323('0x1c')](_0xb56df2);}return null;};}function patchUpdates(_0x5d5f32){return function(_0x2fc9a5){try{jsonpatch[_0xb323('0x21')](_0x2fc9a5,_0x5d5f32,!![]);}catch(_0x7357b5){return BPromise[_0xb323('0x22')](_0x7357b5);}return _0x2fc9a5[_0xb323('0x23')]();};}function saveUpdates(_0x4afcd0,_0x5318a2){return function(_0x16b127){if(_0x16b127){return _0x16b127[_0xb323('0x24')](_0x4afcd0)[_0xb323('0x25')](function(_0x5e1d88){return _0x5e1d88;});}return null;};}function removeEntity(_0x25ab3c,_0x14b549){return function(_0x2b5ea2){if(_0x2b5ea2){return _0x2b5ea2[_0xb323('0x26')]()[_0xb323('0x25')](function(){_0x25ab3c['status'](0xcc)[_0xb323('0x1b')]();});}};}function handleEntityNotFound(_0x5ea703,_0x361d76){return function(_0x1aa17d){if(!_0x1aa17d){_0x5ea703['sendStatus'](0x194);}return _0x1aa17d;};}function handleError(_0x486a86,_0x5b44be){_0x5b44be=_0x5b44be||0x1f4;return function(_0x444c1d){logger[_0xb323('0x27')](_0x444c1d[_0xb323('0x28')]);if(_0x444c1d[_0xb323('0x29')]){delete _0x444c1d[_0xb323('0x29')];}_0x486a86[_0xb323('0x1a')](_0x5b44be)[_0xb323('0x2a')](_0x444c1d);};}exports[_0xb323('0x2b')]=function(_0x428c5a,_0x305563){var _0x38a533={'raw':!![],'where':{'id':_0x428c5a['params']['id']}},_0x45bd66={};_0x45bd66['model']=_[_0xb323('0x2c')](db['ChatProactiveAction'][_0xb323('0x2d')]);_0x45bd66[_0xb323('0x2e')]=_['keys'](_0x428c5a[_0xb323('0x2e')]);_0x45bd66[_0xb323('0x2f')]=_['intersection'](_0x45bd66[_0xb323('0x30')],_0x45bd66['query']);_0x38a533[_0xb323('0x31')]=_[_0xb323('0x32')](_0x45bd66[_0xb323('0x30')],qs[_0xb323('0x33')](_0x428c5a[_0xb323('0x2e')][_0xb323('0x33')]));_0x38a533[_0xb323('0x31')]=_0x38a533[_0xb323('0x31')][_0xb323('0x34')]?_0x38a533['attributes']:_0x45bd66['model'];if(_0x428c5a[_0xb323('0x2e')][_0xb323('0x35')]){_0x38a533[_0xb323('0x36')]=[{'all':!![]}];}_0x38a533=_[_0xb323('0x37')]({},_0x38a533,_0x428c5a[_0xb323('0x38')]);return db[_0xb323('0x39')]['find'](_0x38a533)['then'](handleEntityNotFound(_0x305563,null))[_0xb323('0x25')](respondWithResult(_0x305563,null))[_0xb323('0x3a')](handleError(_0x305563,null));};exports[_0xb323('0x3b')]=function(_0x4668c9,_0x31e9ac){return db[_0xb323('0x39')]['create'](_0x4668c9[_0xb323('0x3c')],{})['then'](respondWithResult(_0x31e9ac,0xc9))[_0xb323('0x3a')](handleError(_0x31e9ac,null));};exports[_0xb323('0x24')]=function(_0x301c70,_0x1b8616){if(_0x301c70[_0xb323('0x3c')]['id']){delete _0x301c70[_0xb323('0x3c')]['id'];}return db[_0xb323('0x39')][_0xb323('0x3d')]({'where':{'id':_0x301c70[_0xb323('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b8616,null))[_0xb323('0x25')](saveUpdates(_0x301c70[_0xb323('0x3c')],null))[_0xb323('0x25')](respondWithResult(_0x1b8616,null))[_0xb323('0x3a')](handleError(_0x1b8616,null));};exports['destroy']=function(_0x187805,_0x5cb95e){return db[_0xb323('0x39')]['find']({'where':{'id':_0x187805['params']['id']}})[_0xb323('0x25')](handleEntityNotFound(_0x5cb95e,null))['then'](removeEntity(_0x5cb95e,null))[_0xb323('0x3a')](handleError(_0x5cb95e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0f42f60..b7dc91e 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 _0xb946=['../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util','moment','bluebird','request-promise'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0xb946,0xd7));var _0x6b94=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xb946[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x6b94('0x0'));var util=require(_0x6b94('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b94('0x2'));var BPromise=require(_0x6b94('0x3'));var rp=require(_0x6b94('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b94('0x5'));var attributes=require(_0x6b94('0x6'));module[_0x6b94('0x7')]=function(_0x57880e,_0x58372b){return _0x57880e[_0x6b94('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x6b94('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc8c=['ChatProactiveAction','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x4a8893,_0x1e0358){var _0xf38a33=function(_0x3f6cb6){while(--_0x3f6cb6){_0x4a8893['push'](_0x4a8893['shift']());}};_0xf38a33(++_0x1e0358);}(_0xcc8c,0x112));var _0xccc8=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0xcc8c[_0x3b3750];return _0x1b9e8b;};'use strict';var _=require(_0xccc8('0x0'));var util=require(_0xccc8('0x1'));var logger=require(_0xccc8('0x2'))(_0xccc8('0x3'));var moment=require('moment');var BPromise=require(_0xccc8('0x4'));var rp=require(_0xccc8('0x5'));var fs=require('fs');var path=require(_0xccc8('0x6'));var rimraf=require(_0xccc8('0x7'));var config=require(_0xccc8('0x8'));var attributes=require(_0xccc8('0x9'));module[_0xccc8('0xa')]=function(_0x6a489f,_0x32e625){return _0x6a489f[_0xccc8('0xb')](_0xccc8('0xc'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 28d3426..86f8afa 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 _0x7a43=['../../config/environment','jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x1a9cec,_0x3bf353){var _0x2fa7ef=function(_0x20cc8a){while(--_0x20cc8a){_0x1a9cec['push'](_0x1a9cec['shift']());}};_0x2fa7ef(++_0x3bf353);}(_0x7a43,0x18a));var _0x37a4=function(_0x12fff4,_0x1be32d){_0x12fff4=_0x12fff4-0x0;var _0x5b155a=_0x7a43[_0x12fff4];return _0x5b155a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37a4('0x0'));var BPromise=require(_0x37a4('0x1'));var rs=require(_0x37a4('0x2'));var fs=require('fs');var Redis=require(_0x37a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37a4('0x4'))(_0x37a4('0x5'));var config=require(_0x37a4('0x6'));var jayson=require(_0x37a4('0x7'));var client=jayson['client'][_0x37a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45b055,_0x4481b4,_0xc1e2ee){return new BPromise(function(_0x56aeb5,_0x389b73){return client['request'](_0x45b055,_0xc1e2ee)[_0x37a4('0x9')](function(_0xb36395){logger[_0x37a4('0xa')](_0x37a4('0xb'),_0x4481b4,_0x37a4('0xc'));logger[_0x37a4('0xd')](_0x37a4('0xe'),_0x4481b4,_0x37a4('0xc'),JSON['stringify'](_0xb36395));if(_0xb36395[_0x37a4('0xf')]){if(_0xb36395[_0x37a4('0xf')][_0x37a4('0x10')]===0x1f4){logger['error'](_0x37a4('0xb'),_0x4481b4,_0xb36395[_0x37a4('0xf')][_0x37a4('0x11')]);return _0x389b73(_0xb36395['error'][_0x37a4('0x11')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4481b4,_0xb36395[_0x37a4('0xf')][_0x37a4('0x11')]);return _0x56aeb5(_0xb36395[_0x37a4('0xf')]['message']);}else{logger[_0x37a4('0xa')](_0x37a4('0xb'),_0x4481b4,'request\x20sent');_0x56aeb5(_0xb36395[_0x37a4('0x12')][_0x37a4('0x11')]);}})[_0x37a4('0x13')](function(_0x24fa87){logger[_0x37a4('0xf')](_0x37a4('0xb'),_0x4481b4,_0x24fa87);_0x389b73(_0x24fa87);});});} \ No newline at end of file +var _0xdfe1=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xdfe1,0x1e1));var _0x1dfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfe1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dfe('0x0'));var util=require(_0x1dfe('0x1'));var moment=require(_0x1dfe('0x2'));var BPromise=require(_0x1dfe('0x3'));var rs=require(_0x1dfe('0x4'));var fs=require('fs');var Redis=require(_0x1dfe('0x5'));var db=require(_0x1dfe('0x6'))['db'];var utils=require(_0x1dfe('0x7'));var logger=require(_0x1dfe('0x8'))(_0x1dfe('0x9'));var config=require(_0x1dfe('0xa'));var jayson=require(_0x1dfe('0xb'));var client=jayson[_0x1dfe('0xc')][_0x1dfe('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c2234,_0x4f5eca,_0x4ae9d5){return new BPromise(function(_0xbccf19,_0x2ecf8b){return client[_0x1dfe('0xe')](_0x4c2234,_0x4ae9d5)['then'](function(_0x334729){logger[_0x1dfe('0xf')](_0x1dfe('0x10'),_0x4f5eca,_0x1dfe('0x11'));logger[_0x1dfe('0x12')](_0x1dfe('0x13'),_0x4f5eca,_0x1dfe('0x11'),JSON[_0x1dfe('0x14')](_0x334729));if(_0x334729[_0x1dfe('0x15')]){if(_0x334729[_0x1dfe('0x15')][_0x1dfe('0x16')]===0x1f4){logger['error'](_0x1dfe('0x10'),_0x4f5eca,_0x334729[_0x1dfe('0x15')][_0x1dfe('0x17')]);return _0x2ecf8b(_0x334729[_0x1dfe('0x15')][_0x1dfe('0x17')]);}logger[_0x1dfe('0x15')](_0x1dfe('0x10'),_0x4f5eca,_0x334729[_0x1dfe('0x15')][_0x1dfe('0x17')]);return _0xbccf19(_0x334729[_0x1dfe('0x15')]['message']);}else{logger[_0x1dfe('0xf')](_0x1dfe('0x10'),_0x4f5eca,_0x1dfe('0x11'));_0xbccf19(_0x334729['result']['message']);}})[_0x1dfe('0x18')](function(_0x31152c){logger[_0x1dfe('0x15')](_0x1dfe('0x10'),_0x4f5eca,_0x31152c);_0x2ecf8b(_0x31152c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1a2b37b..12580e7 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4840f9,_0x734785){_0x4840f9=_0x4840f9-0x0;var _0x4856ff=_0xb4c7[_0x4840f9];return _0x4856ff;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file +var _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x44a6ad,_0x22cfd3){_0x44a6ad=_0x44a6ad-0x0;var _0x5b88be=_0x8d0e[_0x44a6ad];return _0x5b88be;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 246348e..8cf4d51 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 _0x85c9=['rrmemory','roundrobin','sequelize','exports','name','STRING'];(function(_0x1763ac,_0x17cb2f){var _0x1c55a9=function(_0x5ed9e4){while(--_0x5ed9e4){_0x1763ac['push'](_0x1763ac['shift']());}};_0x1c55a9(++_0x17cb2f);}(_0x85c9,0x8c));var _0x985c=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x85c9[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0x985c('0x0'));module[_0x985c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x985c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x985c('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x985c('0x4'),'beepall',_0x985c('0x5'))}}; \ No newline at end of file +var _0x1629=['STRING','name','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2e191e,_0x554750){var _0x19d906=function(_0x170903){while(--_0x170903){_0x2e191e['push'](_0x2e191e['shift']());}};_0x19d906(++_0x554750);}(_0x1629,0x139));var _0x9162=function(_0x89e75a,_0x5b41d3){_0x89e75a=_0x89e75a-0x0;var _0x4102db=_0x1629[_0x89e75a];return _0x4102db;};'use strict';var Sequelize=require(_0x9162('0x0'));module[_0x9162('0x1')]={'name':{'type':Sequelize[_0x9162('0x2')],'unique':_0x9162('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9162('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9162('0x4'),_0x9162('0x5'),_0x9162('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3094ea8..00e18a1 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 _0xb884=['addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','ChatQueues','UserProfileResource','end','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','ChatQueue','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','pick','ChatQueueId','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','transaction','removeAgents','userChatQueue:remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb884,0x9b));var _0x4b88=function(_0x450a0d,_0x21839f){_0x450a0d=_0x450a0d-0x0;var _0x41e651=_0xb884[_0x450a0d];return _0x41e651;};'use strict';var emlformat=require(_0x4b88('0x0'));var rimraf=require(_0x4b88('0x1'));var zipdir=require(_0x4b88('0x2'));var jsonpatch=require(_0x4b88('0x3'));var rp=require(_0x4b88('0x4'));var moment=require(_0x4b88('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4b88('0x6'));var sox=require(_0x4b88('0x7'));var csv=require(_0x4b88('0x8'));var ejs=require(_0x4b88('0x9'));var fs=require('fs');var fs_extra=require(_0x4b88('0xa'));var _=require(_0x4b88('0xb'));var squel=require(_0x4b88('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b88('0xd'));var deskjs=require(_0x4b88('0xe'));var toCsv=require(_0x4b88('0x8'));var querystring=require(_0x4b88('0xf'));var Papa=require(_0x4b88('0x10'));var Redis=require('ioredis');var authService=require(_0x4b88('0x11'));var qs=require(_0x4b88('0x12'));var as=require(_0x4b88('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b88('0x14'))(_0x4b88('0x15'));var utils=require('../../config/utils');var config=require(_0x4b88('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4b88('0x17')]=_['defaults'](config['redis'],{'host':_0x4b88('0x18'),'port':0x18eb});var socket=require(_0x4b88('0x19'))(new Redis(config[_0x4b88('0x17')]));require(_0x4b88('0x1a'))['register'](socket);var jayson=require(_0x4b88('0x1b'));var client=jayson[_0x4b88('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19e93c,_0x2d1d5d,_0x50e018,_0xe21a84){return new BPromise(function(_0x368a7e,_0x269e43){var _0x3a060e=_0xe21a84||client;return _0x3a060e[_0x4b88('0x1d')](_0x19e93c,_0x50e018)['then'](function(_0x419724){logger[_0x4b88('0x1e')](_0x4b88('0x1f'),_0x2d1d5d,'request\x20sent');logger['debug'](_0x4b88('0x20'),_0x2d1d5d,_0x4b88('0x21'),JSON[_0x4b88('0x22')](_0x419724));if(_0x419724['error']){if(_0x419724[_0x4b88('0x23')][_0x4b88('0x24')]===0x1f4){logger[_0x4b88('0x23')](_0x4b88('0x1f'),_0x2d1d5d,_0x419724['error']['message']);return _0x269e43(_0x419724[_0x4b88('0x23')][_0x4b88('0x25')]);}logger['error'](_0x4b88('0x1f'),_0x2d1d5d,_0x419724[_0x4b88('0x23')][_0x4b88('0x25')]);return _0x368a7e(_0x419724[_0x4b88('0x23')]['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2d1d5d,_0x4b88('0x21'));_0x368a7e(_0x419724[_0x4b88('0x26')][_0x4b88('0x25')]);}})['catch'](function(_0x46b052){logger[_0x4b88('0x23')](_0x4b88('0x1f'),_0x2d1d5d,_0x46b052);_0x269e43(_0x46b052);});});}function respondWithStatusCode(_0x56b038,_0xaa27ba){_0xaa27ba=_0xaa27ba||0xcc;return function(_0x5bfbfd){if(_0x5bfbfd){return _0x56b038['sendStatus'](_0xaa27ba);}return _0x56b038['status'](_0xaa27ba)['end']();};}function respondWithResult(_0x22d236,_0x37bdee){_0x37bdee=_0x37bdee||0xc8;return function(_0x3abc50){if(_0x3abc50){return _0x22d236['status'](_0x37bdee)[_0x4b88('0x27')](_0x3abc50);}};}function respondWithFilteredResult(_0xa5643,_0x3c5aa9){return function(_0xb6e8c4){if(_0xb6e8c4){var _0x21012f=typeof _0x3c5aa9[_0x4b88('0x28')]===_0x4b88('0x29')&&typeof _0x3c5aa9[_0x4b88('0x2a')]===_0x4b88('0x29');var _0x1bb386=_0xb6e8c4[_0x4b88('0x2b')];var _0xc7dcc0=_0x21012f?0x0:_0x3c5aa9[_0x4b88('0x28')];var _0x567502=_0x21012f?_0xb6e8c4[_0x4b88('0x2b')]:_0x3c5aa9[_0x4b88('0x28')]+_0x3c5aa9[_0x4b88('0x2a')];var _0x11c6d1;if(_0x567502>=_0x1bb386){_0x567502=_0x1bb386;_0x11c6d1=0xc8;}else{_0x11c6d1=0xce;}_0xa5643['status'](_0x11c6d1);return _0xa5643[_0x4b88('0x2c')](_0x4b88('0x2d'),_0xc7dcc0+'-'+_0x567502+'/'+_0x1bb386)['json'](_0xb6e8c4);}return null;};}function patchUpdates(_0x1422d9){return function(_0x5aade4){try{jsonpatch['apply'](_0x5aade4,_0x1422d9,!![]);}catch(_0x1ebcd5){return BPromise[_0x4b88('0x2e')](_0x1ebcd5);}return _0x5aade4[_0x4b88('0x2f')]();};}function saveUpdates(_0x918a10,_0x947243){return function(_0x40da1b){if(_0x40da1b){return _0x40da1b[_0x4b88('0x30')](_0x918a10)['then'](function(_0x2caf4f){return _0x2caf4f;});}return null;};}function removeEntity(_0x79114a,_0x457548){return function(_0x3e9137){if(_0x3e9137){return _0x3e9137[_0x4b88('0x31')]()[_0x4b88('0x32')](function(){var _0x5930d0=_0x3e9137['get']({'plain':!![]});var _0x3637d2=_0x4b88('0x33');return db[_0x4b88('0x34')][_0x4b88('0x31')]({'where':{'type':_0x3637d2,'resourceId':_0x5930d0['id']}})[_0x4b88('0x32')](function(){return _0x3e9137;});})[_0x4b88('0x32')](function(){_0x79114a['status'](0xcc)[_0x4b88('0x35')]();});}};}function handleEntityNotFound(_0xc938be,_0x3d3393){return function(_0x37276e){if(!_0x37276e){_0xc938be[_0x4b88('0x36')](0x194);}return _0x37276e;};}function handleError(_0xa47ea4,_0x34e95b){_0x34e95b=_0x34e95b||0x1f4;return function(_0x510a5a){logger['error'](_0x510a5a[_0x4b88('0x37')]);if(_0x510a5a['name']){delete _0x510a5a[_0x4b88('0x38')];}_0xa47ea4['status'](_0x34e95b)['send'](_0x510a5a);};}exports[_0x4b88('0x39')]=function(_0x21712f,_0x1aeecc){var _0x28c754={},_0x15882a={},_0x24dac7={'count':0x0,'rows':[]};var _0x328be0=_['map'](db['ChatQueue'][_0x4b88('0x3a')],function(_0x1a270b){return{'name':_0x1a270b[_0x4b88('0x3b')],'type':_0x1a270b[_0x4b88('0x3c')][_0x4b88('0x3d')]};});_0x15882a['model']=_[_0x4b88('0x3e')](_0x328be0,_0x4b88('0x38'));_0x15882a[_0x4b88('0x3f')]=_[_0x4b88('0x40')](_0x21712f[_0x4b88('0x3f')]);_0x15882a[_0x4b88('0x41')]=_[_0x4b88('0x42')](_0x15882a['model'],_0x15882a[_0x4b88('0x3f')]);_0x28c754['attributes']=_['intersection'](_0x15882a['model'],qs['fields'](_0x21712f[_0x4b88('0x3f')][_0x4b88('0x43')]));_0x28c754[_0x4b88('0x44')]=_0x28c754[_0x4b88('0x44')]['length']?_0x28c754['attributes']:_0x15882a[_0x4b88('0x45')];if(!_0x21712f[_0x4b88('0x3f')][_0x4b88('0x46')](_0x4b88('0x47'))){_0x28c754['limit']=qs[_0x4b88('0x2a')](_0x21712f['query'][_0x4b88('0x2a')]);_0x28c754['offset']=qs[_0x4b88('0x28')](_0x21712f[_0x4b88('0x3f')][_0x4b88('0x28')]);}_0x28c754[_0x4b88('0x48')]=qs[_0x4b88('0x49')](_0x21712f['query'][_0x4b88('0x49')]);_0x28c754['where']=qs[_0x4b88('0x41')](_['pick'](_0x21712f[_0x4b88('0x3f')],_0x15882a[_0x4b88('0x41')]),_0x328be0);if(_0x21712f[_0x4b88('0x3f')][_0x4b88('0x4a')]){_0x28c754['where']=_[_0x4b88('0x4b')](_0x28c754[_0x4b88('0x4c')],{'$or':_[_0x4b88('0x3e')](_0x328be0,function(_0x469c89){if(_0x469c89[_0x4b88('0x3c')]!==_0x4b88('0x4d')){var _0x4dee3f={};_0x4dee3f[_0x469c89[_0x4b88('0x38')]]={'$like':'%'+_0x21712f['query']['filter']+'%'};return _0x4dee3f;}})});}_0x28c754=_[_0x4b88('0x4b')]({},_0x28c754,_0x21712f[_0x4b88('0x4e')]);var _0x50a4d0={'where':_0x28c754[_0x4b88('0x4c')]};return db[_0x4b88('0x4f')]['count'](_0x50a4d0)[_0x4b88('0x32')](function(_0x487eaf){_0x24dac7[_0x4b88('0x2b')]=_0x487eaf;if(_0x21712f[_0x4b88('0x3f')][_0x4b88('0x50')]){_0x28c754[_0x4b88('0x51')]=[{'all':!![]}];}return db['ChatQueue'][_0x4b88('0x52')](_0x28c754);})[_0x4b88('0x32')](function(_0x12839a){_0x24dac7[_0x4b88('0x53')]=_0x12839a;return _0x24dac7;})[_0x4b88('0x32')](respondWithFilteredResult(_0x1aeecc,_0x28c754))[_0x4b88('0x54')](handleError(_0x1aeecc,null));};exports[_0x4b88('0x55')]=function(_0x374f1a,_0x1faa6e){var _0x4ce3ee={'raw':!![],'where':{'id':_0x374f1a[_0x4b88('0x56')]['id']}},_0x511abf={};_0x511abf['model']=_[_0x4b88('0x40')](db[_0x4b88('0x4f')][_0x4b88('0x3a')]);_0x511abf[_0x4b88('0x3f')]=_[_0x4b88('0x40')](_0x374f1a[_0x4b88('0x3f')]);_0x511abf[_0x4b88('0x41')]=_[_0x4b88('0x42')](_0x511abf[_0x4b88('0x45')],_0x511abf['query']);_0x4ce3ee[_0x4b88('0x44')]=_[_0x4b88('0x42')](_0x511abf[_0x4b88('0x45')],qs['fields'](_0x374f1a['query']['fields']));_0x4ce3ee[_0x4b88('0x44')]=_0x4ce3ee[_0x4b88('0x44')][_0x4b88('0x57')]?_0x4ce3ee['attributes']:_0x511abf[_0x4b88('0x45')];if(_0x374f1a[_0x4b88('0x3f')][_0x4b88('0x50')]){_0x4ce3ee[_0x4b88('0x51')]=[{'all':!![]}];}_0x4ce3ee=_[_0x4b88('0x4b')]({},_0x4ce3ee,_0x374f1a['options']);return db[_0x4b88('0x4f')]['find'](_0x4ce3ee)['then'](handleEntityNotFound(_0x1faa6e,null))['then'](respondWithResult(_0x1faa6e,null))['catch'](handleError(_0x1faa6e,null));};exports['create']=function(_0x587370,_0x8ef3cd){return db[_0x4b88('0x4f')][_0x4b88('0x58')](_0x587370[_0x4b88('0x59')],{})[_0x4b88('0x32')](function(_0x5b4e1c){var _0x2e2bc6=_0x587370[_0x4b88('0x5a')][_0x4b88('0x5b')]({'plain':!![]});if(!_0x2e2bc6)throw new Error(_0x4b88('0x5c'));if(_0x2e2bc6[_0x4b88('0x5d')]===_0x4b88('0x5a')){var _0x1dab2f=_0x5b4e1c[_0x4b88('0x5b')]({'plain':!![]});var _0x449457=_0x4b88('0x33');return db[_0x4b88('0x5e')][_0x4b88('0x5f')]({'where':{'name':_0x449457,'userProfileId':_0x2e2bc6[_0x4b88('0x60')]},'raw':!![]})[_0x4b88('0x32')](function(_0x568e25){if(_0x568e25&&_0x568e25[_0x4b88('0x61')]===0x0){return db[_0x4b88('0x34')][_0x4b88('0x58')]({'name':_0x1dab2f['name'],'resourceId':_0x1dab2f['id'],'type':_0x568e25[_0x4b88('0x38')],'sectionId':_0x568e25['id']},{})[_0x4b88('0x32')](function(){return _0x5b4e1c;});}else{return _0x5b4e1c;}})[_0x4b88('0x54')](function(_0x1c828f){logger['error'](_0x4b88('0x62'),_0x1c828f);throw _0x1c828f;});}return _0x5b4e1c;})[_0x4b88('0x32')](respondWithResult(_0x8ef3cd,0xc9))[_0x4b88('0x54')](handleError(_0x8ef3cd,null));};exports['update']=function(_0xc5eeaa,_0x2f05f2){if(_0xc5eeaa['body']['id']){delete _0xc5eeaa[_0x4b88('0x59')]['id'];}return db[_0x4b88('0x4f')][_0x4b88('0x5f')]({'where':{'id':_0xc5eeaa['params']['id']}})['then'](handleEntityNotFound(_0x2f05f2,null))[_0x4b88('0x32')](saveUpdates(_0xc5eeaa[_0x4b88('0x59')],null))[_0x4b88('0x32')](respondWithResult(_0x2f05f2,null))[_0x4b88('0x54')](handleError(_0x2f05f2,null));};exports[_0x4b88('0x31')]=function(_0x1e5729,_0x245016){return db[_0x4b88('0x4f')][_0x4b88('0x5f')]({'where':{'id':_0x1e5729[_0x4b88('0x56')]['id']}})[_0x4b88('0x32')](handleEntityNotFound(_0x245016,null))[_0x4b88('0x32')](removeEntity(_0x245016,null))[_0x4b88('0x54')](handleError(_0x245016,null));};exports[_0x4b88('0x63')]=function(_0x52716f,_0x148930){return db[_0x4b88('0x4f')][_0x4b88('0x63')]()[_0x4b88('0x32')](respondWithResult(_0x148930,null))[_0x4b88('0x54')](handleError(_0x148930,null));};exports[_0x4b88('0x64')]=function(_0x37bcbd,_0x4e139f,_0x17770a){var _0x580673={'raw':!![],'where':{}},_0x33e340={},_0x4fc926;return db[_0x4b88('0x4f')]['findOne']({'where':{'id':_0x37bcbd[_0x4b88('0x56')]['id']}})[_0x4b88('0x32')](handleEntityNotFound(_0x4e139f,null))[_0x4b88('0x32')](function(_0xa06f08){if(_0xa06f08){_0x4fc926=_0xa06f08['get']({'plain':!![]});_0x33e340[_0x4b88('0x45')]=_['keys'](db['UserChatQueue'][_0x4b88('0x3a')]);_0x33e340['query']=_['keys'](_0x37bcbd['query']);_0x33e340[_0x4b88('0x41')]=_['intersection'](_0x33e340['model'],_0x33e340[_0x4b88('0x3f')]);_0x580673['attributes']=_[_0x4b88('0x42')](_0x33e340[_0x4b88('0x45')],qs[_0x4b88('0x43')](_0x37bcbd[_0x4b88('0x3f')][_0x4b88('0x43')]));_0x580673[_0x4b88('0x44')]=_0x580673[_0x4b88('0x44')][_0x4b88('0x57')]?_0x580673[_0x4b88('0x44')]:_0x33e340[_0x4b88('0x45')];if(!_0x37bcbd[_0x4b88('0x3f')][_0x4b88('0x46')](_0x4b88('0x47'))){_0x580673[_0x4b88('0x2a')]=qs['limit'](_0x37bcbd[_0x4b88('0x3f')][_0x4b88('0x2a')]);_0x580673[_0x4b88('0x28')]=qs[_0x4b88('0x28')](_0x37bcbd[_0x4b88('0x3f')][_0x4b88('0x28')]);}_0x580673[_0x4b88('0x48')]=qs[_0x4b88('0x49')](_0x37bcbd['query']['sort']);_0x580673[_0x4b88('0x4c')]=qs[_0x4b88('0x41')](_[_0x4b88('0x65')](_0x37bcbd['query'],_0x33e340[_0x4b88('0x41')]));_0x580673[_0x4b88('0x4c')][_0x4b88('0x66')]=_0xa06f08['id'];if(_0x37bcbd[_0x4b88('0x3f')][_0x4b88('0x4a')]){_0x580673['where']=_[_0x4b88('0x4b')](_0x580673['where'],{'$or':_[_0x4b88('0x3e')](_0x580673['attributes'],function(_0x713c8a){var _0x23b0b8={};_0x23b0b8[_0x713c8a]={'$like':'%'+_0x37bcbd[_0x4b88('0x3f')][_0x4b88('0x4a')]+'%'};return _0x23b0b8;})});}_0x580673=_[_0x4b88('0x4b')]({},_0x580673,_0x37bcbd[_0x4b88('0x4e')]);return db['UserChatQueue'][_0x4b88('0x52')](_0x580673);}})[_0x4b88('0x32')](function(_0x315bd2){if(_0x315bd2){return db['User']['findAndCountAll']({'where':{'id':_[_0x4b88('0x3e')](_0x315bd2,_0x4b88('0x67')),'role':_0x4b88('0x68')},'attributes':['id','name',_0x4b88('0x69'),_0x4b88('0x6a'),_0x4b88('0x6b')]});}})[_0x4b88('0x32')](function(_0x31a484){if(_0x31a484){return{'count':_0x31a484[_0x4b88('0x2b')],'rows':_['map'](_0x31a484[_0x4b88('0x53')],function(_0x4a502b){return{'membername':_0x4a502b['name'],'UserId':_0x4a502b['id'],'queue_name':_0x4fc926[_0x4b88('0x38')],'ChatQueueId':_0x4fc926['id'],'interface':util[_0x4b88('0x6c')](_0x4b88('0x6d'),'SIP',_0x4a502b[_0x4b88('0x38')]),'penalty':0x0,'paused':_0x4a502b[_0x4b88('0x69')],'createdAt':_0x4a502b[_0x4b88('0x6b')],'updatedAt':_0x4a502b[_0x4b88('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b88('0x32')](respondWithFilteredResult(_0x4e139f,_0x580673))[_0x4b88('0x54')](handleError(_0x4e139f,null));};exports[_0x4b88('0x6e')]=function(_0x327950,_0xd5f138,_0x4e7597){var _0x2c3ecd={};var _0x5481c8={};var _0x1b4861;var _0x5cbb95;return db[_0x4b88('0x4f')][_0x4b88('0x6f')]({'where':{'id':_0x327950[_0x4b88('0x56')]['id']}})[_0x4b88('0x32')](handleEntityNotFound(_0xd5f138,null))['then'](function(_0x30fc7f){if(_0x30fc7f){_0x1b4861=_0x30fc7f;_0x5481c8['model']=_[_0x4b88('0x40')](db[_0x4b88('0x70')][_0x4b88('0x3a')]);_0x5481c8[_0x4b88('0x3f')]=_[_0x4b88('0x40')](_0x327950['query']);_0x5481c8[_0x4b88('0x41')]=_[_0x4b88('0x42')](_0x5481c8['model'],_0x5481c8['query']);_0x2c3ecd[_0x4b88('0x44')]=_[_0x4b88('0x42')](_0x5481c8[_0x4b88('0x45')],qs['fields'](_0x327950['query']['fields']));_0x2c3ecd['attributes']=_0x2c3ecd[_0x4b88('0x44')][_0x4b88('0x57')]?_0x2c3ecd[_0x4b88('0x44')]:_0x5481c8[_0x4b88('0x45')];_0x2c3ecd[_0x4b88('0x48')]=qs[_0x4b88('0x49')](_0x327950['query'][_0x4b88('0x49')]);_0x2c3ecd['where']=qs[_0x4b88('0x41')](_[_0x4b88('0x65')](_0x327950[_0x4b88('0x3f')],_0x5481c8[_0x4b88('0x41')]));if(_0x327950[_0x4b88('0x3f')][_0x4b88('0x4a')]){_0x2c3ecd[_0x4b88('0x4c')]=_['merge'](_0x2c3ecd[_0x4b88('0x4c')],{'$or':_['map'](_0x2c3ecd[_0x4b88('0x44')],function(_0x358010){var _0x4ae8a0={};_0x4ae8a0[_0x358010]={'$like':'%'+_0x327950['query'][_0x4b88('0x4a')]+'%'};return _0x4ae8a0;})});}_0x2c3ecd=_[_0x4b88('0x4b')]({},_0x2c3ecd,_0x327950['options']);return _0x1b4861['getTeams'](_0x2c3ecd);}})[_0x4b88('0x32')](function(_0x133b8e){if(_0x133b8e){_0x5cbb95=_0x133b8e['length'];if(!_0x327950['query'][_0x4b88('0x46')](_0x4b88('0x47'))){_0x2c3ecd['limit']=qs['limit'](_0x327950['query']['limit']);_0x2c3ecd[_0x4b88('0x28')]=qs[_0x4b88('0x28')](_0x327950[_0x4b88('0x3f')][_0x4b88('0x28')]);}return _0x1b4861['getTeams'](_0x2c3ecd);}})[_0x4b88('0x32')](function(_0x43c0aa){if(_0x43c0aa){return _0x43c0aa?{'count':_0x5cbb95,'rows':_0x43c0aa}:null;}})[_0x4b88('0x32')](respondWithResult(_0xd5f138,null))[_0x4b88('0x54')](handleError(_0xd5f138,null));};exports[_0x4b88('0x71')]=function(_0x5b3518,_0x402a8b,_0x55112d){var _0x1703d7=_0x5b3518['body'][_0x4b88('0x72')];return db['Team'][_0x4b88('0x52')]({'where':{'id':_0x1703d7},'attributes':['id'],'include':[{'model':db[_0x4b88('0x73')],'as':_0x4b88('0x74'),'attributes':['id',_0x4b88('0x38'),_0x4b88('0x75'),_0x4b88('0x76'),_0x4b88('0x77')],'raw':!![]}]})[_0x4b88('0x32')](function(_0x2de889){if(_0x2de889){var _0x44224c=_[_0x4b88('0x78')](_0x2de889,function(_0x40ba5b){var _0x47509=_0x40ba5b[_0x4b88('0x5b')]({'plain':!![]});return _0x47509[_0x4b88('0x74')];});return db[_0x4b88('0x4f')][_0x4b88('0x5f')]({'where':{'id':_0x5b3518[_0x4b88('0x56')]['id']}})['then'](function(_0x236fde){return db[_0x4b88('0x79')]['transaction'](function(_0x2cf041){return _0x236fde[_0x4b88('0x71')](_0x1703d7,{'transaction':_0x2cf041})['then'](function(){return BPromise[_0x4b88('0x7a')](_0x44224c,function(_0x3650dc){return db['UserChatQueue'][_0x4b88('0x7b')]({'where':{'UserId':_0x3650dc['id'],'ChatQueueId':_0x5b3518[_0x4b88('0x56')]['id']},'transaction':_0x2cf041});});})[_0x4b88('0x32')](function(){_0x44224c[_0x4b88('0x7c')](function(_0x5b4cf1){socket[_0x4b88('0x7d')]('userChatQueue:save',{'UserId':_0x5b4cf1['id'],'ChatQueueId':_0x236fde['id']});});});});});}})[_0x4b88('0x32')](respondWithStatusCode(_0x402a8b,null))[_0x4b88('0x54')](handleError(_0x402a8b,null));};exports[_0x4b88('0x7e')]=function(_0xc8522,_0x1e5b44,_0x37a4ac){return db[_0x4b88('0x70')][_0x4b88('0x52')]({'where':{'id':_0xc8522[_0x4b88('0x3f')][_0x4b88('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4b88('0x74'),'attributes':['id'],'raw':!![]}]})[_0x4b88('0x32')](handleEntityNotFound(_0x1e5b44,null))[_0x4b88('0x32')](function(_0x1881e7){var _0x38e8ee=_['map'](_0x1881e7,'id');var _0x38ee4e=[];var _0x2c87dc=[];var _0x1dff22=squel[_0x4b88('0x7f')]();_0x1dff22['field'](_0x4b88('0x80'))[_0x4b88('0x81')](_0x4b88('0x82'),'tq')[_0x4b88('0x83')]('user_has_teams','ut',_0x4b88('0x84'))[_0x4b88('0x4c')](_0x4b88('0x85'),_0xc8522[_0x4b88('0x56')]['id']);for(var _0xf0f57a=0x0;_0xf0f57a<_0x1881e7[_0x4b88('0x57')];_0xf0f57a+=0x1){let _0x27b298=_0x1881e7[_0xf0f57a];for(var _0x581588=0x0;_0x581588<_0x27b298['Agents'][_0x4b88('0x57')];_0x581588+=0x1){let _0x2716ee=_0x27b298['Agents'][_0x581588];var _0x2c122d=_0x1dff22[_0x4b88('0x86')]();_0x2c122d[_0x4b88('0x4c')](_0x4b88('0x87'),_0x2716ee['id']);_0x2c87dc['push'](db[_0x4b88('0x79')][_0x4b88('0x3f')](_0x2c122d[_0x4b88('0x88')](),{'type':db[_0x4b88('0x79')][_0x4b88('0x89')][_0x4b88('0x8a')]})[_0x4b88('0x32')](function(_0xf2ad3a){if(_0xf2ad3a[_0x4b88('0x57')]===0x1){return _0x2716ee['id'];}else{var _0x4df595=_[_0x4b88('0x8b')](_[_0x4b88('0x3e')](_0xf2ad3a,_0x4b88('0x8c')),function(_0x307b50){return _[_0x4b88('0x8d')](_0x38e8ee,_0x307b50);});if(_0x4df595){return _0x2716ee['id'];}}}));}}return BPromise['all'](_0x2c87dc)[_0x4b88('0x32')](function(_0x2f05fa){_0x38ee4e=_(_0x38ee4e)['union'](_0x2f05fa)[_0x4b88('0x8e')]()[_0x4b88('0x8f')]();return db[_0x4b88('0x4f')][_0x4b88('0x5f')]({'where':{'id':_0xc8522[_0x4b88('0x56')]['id']}})[_0x4b88('0x32')](function(_0x1d71d9){return db[_0x4b88('0x79')][_0x4b88('0x90')](function(_0x512c6a){return _0x1d71d9[_0x4b88('0x7e')](_0xc8522['query'][_0x4b88('0x72')],{'transaction':_0x512c6a})['then'](function(){if(!_['isEmpty'](_0x38ee4e)){return _0x1d71d9[_0x4b88('0x91')](_0x38ee4e,{'transaction':_0x512c6a});}})['then'](function(){_0x38ee4e[_0x4b88('0x7c')](function(_0x344ef1){socket['emit'](_0x4b88('0x92'),{'UserId':_0x344ef1,'ChatQueueId':_0x1d71d9['id']});});});});});});})[_0x4b88('0x32')](respondWithStatusCode(_0x1e5b44,null))[_0x4b88('0x54')](handleError(_0x1e5b44,null));};exports[_0x4b88('0x93')]=function(_0x3d4bbb,_0x51df60,_0x581c4a){return db[_0x4b88('0x4f')][_0x4b88('0x5f')]({'where':{'id':_0x3d4bbb['params']['id']}})[_0x4b88('0x32')](handleEntityNotFound(_0x51df60,null))[_0x4b88('0x32')](function(_0x3a3a5a){if(_0x3a3a5a){return _0x3a3a5a[_0x4b88('0x93')](_0x3d4bbb[_0x4b88('0x59')][_0x4b88('0x72')],_[_0x4b88('0x94')](_0x3d4bbb[_0x4b88('0x59')],[_0x4b88('0x72'),'id'])||{})['spread'](function(_0x946117){for(var _0x18c91b=0x0;_0x18c91b<_0x3d4bbb[_0x4b88('0x59')][_0x4b88('0x72')]['length'];_0x18c91b+=0x1){socket[_0x4b88('0x7d')]('userChatQueue:save',{'UserId':Number(_0x3d4bbb[_0x4b88('0x59')][_0x4b88('0x72')][_0x18c91b]),'ChatQueueId':Number(_0x3d4bbb[_0x4b88('0x56')]['id'])});}return _0x946117;});}})[_0x4b88('0x32')](respondWithResult(_0x51df60,null))['catch'](handleError(_0x51df60,null));};exports[_0x4b88('0x91')]=function(_0x47bba4,_0x1cac27,_0x11408a){return db['ChatQueue'][_0x4b88('0x5f')]({'where':{'id':_0x47bba4[_0x4b88('0x56')]['id']}})[_0x4b88('0x32')](handleEntityNotFound(_0x1cac27,null))[_0x4b88('0x32')](function(_0x24a2b8){if(_0x24a2b8){return _0x24a2b8[_0x4b88('0x91')](_0x47bba4['query']['ids'])[_0x4b88('0x32')](function(){if(_[_0x4b88('0x95')](_0x47bba4[_0x4b88('0x3f')][_0x4b88('0x72')])){for(var _0x26489d=0x0;_0x26489d<_0x47bba4[_0x4b88('0x3f')][_0x4b88('0x72')][_0x4b88('0x57')];_0x26489d+=0x1){socket[_0x4b88('0x7d')](_0x4b88('0x92'),{'UserId':Number(_0x47bba4[_0x4b88('0x3f')]['ids'][_0x26489d]),'ChatQueueId':Number(_0x47bba4[_0x4b88('0x56')]['id'])});}}else{socket[_0x4b88('0x7d')](_0x4b88('0x92'),{'UserId':Number(_0x47bba4[_0x4b88('0x3f')][_0x4b88('0x72')]),'ChatQueueId':Number(_0x47bba4[_0x4b88('0x56')]['id'])});}});}})[_0x4b88('0x32')](respondWithStatusCode(_0x1cac27,null))[_0x4b88('0x54')](handleError(_0x1cac27,null));};exports[_0x4b88('0x96')]=function(_0x433e9e,_0xeedcee,_0x518f71){var _0x310ae3={};var _0x4df3ad={};var _0x2fa4ac;var _0x26c7f9;return db[_0x4b88('0x4f')][_0x4b88('0x6f')]({'where':{'id':_0x433e9e[_0x4b88('0x56')]['id']}})[_0x4b88('0x32')](handleEntityNotFound(_0xeedcee,null))[_0x4b88('0x32')](function(_0x132f91){if(_0x132f91){_0x2fa4ac=_0x132f91;_0x4df3ad[_0x4b88('0x45')]=_[_0x4b88('0x40')](db['User'][_0x4b88('0x3a')]);_0x4df3ad['query']=_[_0x4b88('0x40')](_0x433e9e[_0x4b88('0x3f')]);_0x4df3ad['filters']=_[_0x4b88('0x42')](_0x4df3ad['model'],_0x4df3ad['query']);_0x310ae3[_0x4b88('0x44')]=_[_0x4b88('0x42')](_0x4df3ad[_0x4b88('0x45')],qs[_0x4b88('0x43')](_0x433e9e['query'][_0x4b88('0x43')]));_0x310ae3[_0x4b88('0x44')]=_0x310ae3['attributes'][_0x4b88('0x57')]?_0x310ae3[_0x4b88('0x44')]:_0x4df3ad[_0x4b88('0x45')];_0x310ae3[_0x4b88('0x48')]=qs['sort'](_0x433e9e['query']['sort']);_0x310ae3[_0x4b88('0x4c')]=qs[_0x4b88('0x41')](_[_0x4b88('0x65')](_0x433e9e['query'],_0x4df3ad['filters']));if(_0x433e9e[_0x4b88('0x3f')][_0x4b88('0x4a')]){_0x310ae3[_0x4b88('0x4c')]=_[_0x4b88('0x4b')](_0x310ae3[_0x4b88('0x4c')],{'$or':_['map'](_0x310ae3[_0x4b88('0x44')],function(_0x39d5a8){var _0x152b38={};_0x152b38[_0x39d5a8]={'$like':'%'+_0x433e9e['query'][_0x4b88('0x4a')]+'%'};return _0x152b38;})});}_0x310ae3=_[_0x4b88('0x4b')]({},_0x310ae3,_0x433e9e[_0x4b88('0x4e')]);return _0x2fa4ac['getAgents'](_0x310ae3);}})[_0x4b88('0x32')](function(_0x3a54ff){if(_0x3a54ff){_0x26c7f9=_0x3a54ff['length'];if(!_0x433e9e[_0x4b88('0x3f')]['hasOwnProperty'](_0x4b88('0x47'))){_0x310ae3['limit']=qs[_0x4b88('0x2a')](_0x433e9e[_0x4b88('0x3f')]['limit']);_0x310ae3['offset']=qs[_0x4b88('0x28')](_0x433e9e[_0x4b88('0x3f')]['offset']);}return _0x2fa4ac[_0x4b88('0x96')](_0x310ae3);}})['then'](function(_0x416f84){if(_0x416f84){return _0x416f84?{'count':_0x26c7f9,'rows':_0x416f84}:null;}})[_0x4b88('0x32')](respondWithResult(_0xeedcee,null))[_0x4b88('0x54')](handleError(_0xeedcee,null));}; \ No newline at end of file +var _0x1bc3=['squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','ChatQueues','stack','name','map','ChatQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','describe','UserChatQueue','order','pick','ChatQueueId','findAll','User','agent','chatPause','format','%s/%s','createdAt','updatedAt','findOne','Team','getTeams','nolimit','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','forEach','emit','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','union','compact','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userChatQueue:save','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2da0ba,_0x3f0001){var _0x18da0b=function(_0x255e6f){while(--_0x255e6f){_0x2da0ba['push'](_0x2da0ba['shift']());}};_0x18da0b(++_0x3f0001);}(_0x1bc3,0x196));var _0x31bc=function(_0x420539,_0x4f10ba){_0x420539=_0x420539-0x0;var _0x14dd12=_0x1bc3[_0x420539];return _0x14dd12;};'use strict';var emlformat=require(_0x31bc('0x0'));var rimraf=require(_0x31bc('0x1'));var zipdir=require(_0x31bc('0x2'));var jsonpatch=require(_0x31bc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x31bc('0x4'));var path=require(_0x31bc('0x5'));var sox=require(_0x31bc('0x6'));var csv=require(_0x31bc('0x7'));var ejs=require(_0x31bc('0x8'));var fs=require('fs');var fs_extra=require(_0x31bc('0x9'));var _=require(_0x31bc('0xa'));var squel=require(_0x31bc('0xb'));var crypto=require(_0x31bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x31bc('0xd'));var toCsv=require(_0x31bc('0x7'));var querystring=require(_0x31bc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x31bc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x31bc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31bc('0x11'))(_0x31bc('0x12'));var utils=require('../../config/utils');var config=require(_0x31bc('0x13'));var licenseUtil=require(_0x31bc('0x14'));var db=require(_0x31bc('0x15'))['db'];config[_0x31bc('0x16')]=_[_0x31bc('0x17')](config[_0x31bc('0x16')],{'host':_0x31bc('0x18'),'port':0x18eb});var socket=require(_0x31bc('0x19'))(new Redis(config[_0x31bc('0x16')]));require(_0x31bc('0x1a'))[_0x31bc('0x1b')](socket);var jayson=require(_0x31bc('0x1c'));var client=jayson[_0x31bc('0x1d')][_0x31bc('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x250640,_0x206c71,_0x5a6486,_0x53c788){return new BPromise(function(_0x535062,_0x17354b){var _0x6335c3=_0x53c788||client;return _0x6335c3[_0x31bc('0x1f')](_0x250640,_0x5a6486)['then'](function(_0xf4d64){logger[_0x31bc('0x20')]('ChatQueue,\x20%s,\x20%s',_0x206c71,_0x31bc('0x21'));logger['debug'](_0x31bc('0x22'),_0x206c71,_0x31bc('0x21'),JSON[_0x31bc('0x23')](_0xf4d64));if(_0xf4d64[_0x31bc('0x24')]){if(_0xf4d64[_0x31bc('0x24')][_0x31bc('0x25')]===0x1f4){logger[_0x31bc('0x24')]('ChatQueue,\x20%s,\x20%s',_0x206c71,_0xf4d64['error'][_0x31bc('0x26')]);return _0x17354b(_0xf4d64[_0x31bc('0x24')][_0x31bc('0x26')]);}logger[_0x31bc('0x24')](_0x31bc('0x27'),_0x206c71,_0xf4d64['error']['message']);return _0x535062(_0xf4d64[_0x31bc('0x24')][_0x31bc('0x26')]);}else{logger['info'](_0x31bc('0x27'),_0x206c71,_0x31bc('0x21'));_0x535062(_0xf4d64['result']['message']);}})[_0x31bc('0x28')](function(_0x1fcfeb){logger[_0x31bc('0x24')]('ChatQueue,\x20%s,\x20%s',_0x206c71,_0x1fcfeb);_0x17354b(_0x1fcfeb);});});}function respondWithStatusCode(_0x20c3b8,_0xbfb04d){_0xbfb04d=_0xbfb04d||0xcc;return function(_0x59939a){if(_0x59939a){return _0x20c3b8[_0x31bc('0x29')](_0xbfb04d);}return _0x20c3b8[_0x31bc('0x2a')](_0xbfb04d)[_0x31bc('0x2b')]();};}function respondWithResult(_0x2a213c,_0x501dd7){_0x501dd7=_0x501dd7||0xc8;return function(_0x1d1aa1){if(_0x1d1aa1){return _0x2a213c[_0x31bc('0x2a')](_0x501dd7)[_0x31bc('0x2c')](_0x1d1aa1);}};}function respondWithFilteredResult(_0x5554ce,_0x2f290a){return function(_0x77be06){if(_0x77be06){var _0x33dd83=typeof _0x2f290a[_0x31bc('0x2d')]===_0x31bc('0x2e')&&typeof _0x2f290a[_0x31bc('0x2f')]===_0x31bc('0x2e');var _0x167d0b=_0x77be06[_0x31bc('0x30')];var _0x579ad4=_0x33dd83?0x0:_0x2f290a['offset'];var _0x196b9d=_0x33dd83?_0x77be06['count']:_0x2f290a['offset']+_0x2f290a[_0x31bc('0x2f')];var _0x5ae8d6;if(_0x196b9d>=_0x167d0b){_0x196b9d=_0x167d0b;_0x5ae8d6=0xc8;}else{_0x5ae8d6=0xce;}_0x5554ce[_0x31bc('0x2a')](_0x5ae8d6);return _0x5554ce[_0x31bc('0x31')](_0x31bc('0x32'),_0x579ad4+'-'+_0x196b9d+'/'+_0x167d0b)['json'](_0x77be06);}return null;};}function patchUpdates(_0x284aac){return function(_0x47bb87){try{jsonpatch['apply'](_0x47bb87,_0x284aac,!![]);}catch(_0x4926e6){return BPromise[_0x31bc('0x33')](_0x4926e6);}return _0x47bb87[_0x31bc('0x34')]();};}function saveUpdates(_0x46d910,_0x23782b){return function(_0x30dc9b){if(_0x30dc9b){return _0x30dc9b[_0x31bc('0x35')](_0x46d910)[_0x31bc('0x36')](function(_0x245b30){return _0x245b30;});}return null;};}function removeEntity(_0x451abd,_0x146d81){return function(_0x150247){if(_0x150247){return _0x150247[_0x31bc('0x37')]()[_0x31bc('0x36')](function(){var _0x20b6d7=_0x150247['get']({'plain':!![]});var _0x22ec67=_0x31bc('0x38');return db['UserProfileResource'][_0x31bc('0x37')]({'where':{'type':_0x22ec67,'resourceId':_0x20b6d7['id']}})[_0x31bc('0x36')](function(){return _0x150247;});})[_0x31bc('0x36')](function(){_0x451abd['status'](0xcc)[_0x31bc('0x2b')]();});}};}function handleEntityNotFound(_0x2f644e,_0x4ff958){return function(_0x7fcee7){if(!_0x7fcee7){_0x2f644e[_0x31bc('0x29')](0x194);}return _0x7fcee7;};}function handleError(_0x586c36,_0x459563){_0x459563=_0x459563||0x1f4;return function(_0x562b4a){logger['error'](_0x562b4a[_0x31bc('0x39')]);if(_0x562b4a['name']){delete _0x562b4a[_0x31bc('0x3a')];}_0x586c36['status'](_0x459563)['send'](_0x562b4a);};}exports['index']=function(_0x1b6e4f,_0x42f267){var _0x71c5f2={},_0x4df1fd={},_0x6ad6db={'count':0x0,'rows':[]};var _0x3fa0b5=_[_0x31bc('0x3b')](db[_0x31bc('0x3c')][_0x31bc('0x3d')],function(_0x1e3139){return{'name':_0x1e3139['fieldName'],'type':_0x1e3139[_0x31bc('0x3e')][_0x31bc('0x3f')]};});_0x4df1fd[_0x31bc('0x40')]=_['map'](_0x3fa0b5,_0x31bc('0x3a'));_0x4df1fd['query']=_[_0x31bc('0x41')](_0x1b6e4f[_0x31bc('0x42')]);_0x4df1fd[_0x31bc('0x43')]=_[_0x31bc('0x44')](_0x4df1fd[_0x31bc('0x40')],_0x4df1fd[_0x31bc('0x42')]);_0x71c5f2[_0x31bc('0x45')]=_[_0x31bc('0x44')](_0x4df1fd[_0x31bc('0x40')],qs[_0x31bc('0x46')](_0x1b6e4f['query'][_0x31bc('0x46')]));_0x71c5f2['attributes']=_0x71c5f2[_0x31bc('0x45')][_0x31bc('0x47')]?_0x71c5f2[_0x31bc('0x45')]:_0x4df1fd[_0x31bc('0x40')];if(!_0x1b6e4f[_0x31bc('0x42')][_0x31bc('0x48')]('nolimit')){_0x71c5f2[_0x31bc('0x2f')]=qs[_0x31bc('0x2f')](_0x1b6e4f['query'][_0x31bc('0x2f')]);_0x71c5f2['offset']=qs[_0x31bc('0x2d')](_0x1b6e4f[_0x31bc('0x42')][_0x31bc('0x2d')]);}_0x71c5f2['order']=qs[_0x31bc('0x49')](_0x1b6e4f[_0x31bc('0x42')][_0x31bc('0x49')]);_0x71c5f2[_0x31bc('0x4a')]=qs[_0x31bc('0x43')](_['pick'](_0x1b6e4f[_0x31bc('0x42')],_0x4df1fd['filters']),_0x3fa0b5);if(_0x1b6e4f[_0x31bc('0x42')][_0x31bc('0x4b')]){_0x71c5f2[_0x31bc('0x4a')]=_[_0x31bc('0x4c')](_0x71c5f2[_0x31bc('0x4a')],{'$or':_[_0x31bc('0x3b')](_0x3fa0b5,function(_0x24ab1b){if(_0x24ab1b[_0x31bc('0x3e')]!==_0x31bc('0x4d')){var _0x548b4e={};_0x548b4e[_0x24ab1b['name']]={'$like':'%'+_0x1b6e4f[_0x31bc('0x42')][_0x31bc('0x4b')]+'%'};return _0x548b4e;}})});}_0x71c5f2=_[_0x31bc('0x4c')]({},_0x71c5f2,_0x1b6e4f[_0x31bc('0x4e')]);var _0x5d0a13={'where':_0x71c5f2[_0x31bc('0x4a')]};return db[_0x31bc('0x3c')][_0x31bc('0x30')](_0x5d0a13)[_0x31bc('0x36')](function(_0x210605){_0x6ad6db[_0x31bc('0x30')]=_0x210605;if(_0x1b6e4f['query'][_0x31bc('0x4f')]){_0x71c5f2[_0x31bc('0x50')]=[{'all':!![]}];}return db[_0x31bc('0x3c')]['findAll'](_0x71c5f2);})[_0x31bc('0x36')](function(_0x465d25){_0x6ad6db[_0x31bc('0x51')]=_0x465d25;return _0x6ad6db;})[_0x31bc('0x36')](respondWithFilteredResult(_0x42f267,_0x71c5f2))[_0x31bc('0x28')](handleError(_0x42f267,null));};exports['show']=function(_0x309cf7,_0x13e42f){var _0x4fab2b={'raw':!![],'where':{'id':_0x309cf7[_0x31bc('0x52')]['id']}},_0x455147={};_0x455147[_0x31bc('0x40')]=_[_0x31bc('0x41')](db[_0x31bc('0x3c')][_0x31bc('0x3d')]);_0x455147[_0x31bc('0x42')]=_[_0x31bc('0x41')](_0x309cf7[_0x31bc('0x42')]);_0x455147['filters']=_['intersection'](_0x455147[_0x31bc('0x40')],_0x455147['query']);_0x4fab2b['attributes']=_[_0x31bc('0x44')](_0x455147['model'],qs[_0x31bc('0x46')](_0x309cf7[_0x31bc('0x42')][_0x31bc('0x46')]));_0x4fab2b[_0x31bc('0x45')]=_0x4fab2b[_0x31bc('0x45')][_0x31bc('0x47')]?_0x4fab2b[_0x31bc('0x45')]:_0x455147[_0x31bc('0x40')];if(_0x309cf7['query'][_0x31bc('0x4f')]){_0x4fab2b[_0x31bc('0x50')]=[{'all':!![]}];}_0x4fab2b=_['merge']({},_0x4fab2b,_0x309cf7['options']);return db[_0x31bc('0x3c')]['find'](_0x4fab2b)[_0x31bc('0x36')](handleEntityNotFound(_0x13e42f,null))[_0x31bc('0x36')](respondWithResult(_0x13e42f,null))['catch'](handleError(_0x13e42f,null));};exports[_0x31bc('0x53')]=function(_0x275065,_0x39c715){return db[_0x31bc('0x3c')][_0x31bc('0x53')](_0x275065[_0x31bc('0x54')],{})[_0x31bc('0x36')](function(_0x469a69){var _0x5e0050=_0x275065[_0x31bc('0x55')][_0x31bc('0x56')]({'plain':!![]});if(!_0x5e0050)throw new Error(_0x31bc('0x57'));if(_0x5e0050['role']===_0x31bc('0x55')){var _0x20a2c6=_0x469a69[_0x31bc('0x56')]({'plain':!![]});var _0x4cae26=_0x31bc('0x38');return db['UserProfileSection'][_0x31bc('0x58')]({'where':{'name':_0x4cae26,'userProfileId':_0x5e0050['userProfileId']},'raw':!![]})[_0x31bc('0x36')](function(_0x44b0a1){if(_0x44b0a1&&_0x44b0a1[_0x31bc('0x59')]===0x0){return db['UserProfileResource'][_0x31bc('0x53')]({'name':_0x20a2c6[_0x31bc('0x3a')],'resourceId':_0x20a2c6['id'],'type':_0x44b0a1['name'],'sectionId':_0x44b0a1['id']},{})[_0x31bc('0x36')](function(){return _0x469a69;});}else{return _0x469a69;}})[_0x31bc('0x28')](function(_0x603562){logger[_0x31bc('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x603562);throw _0x603562;});}return _0x469a69;})[_0x31bc('0x36')](respondWithResult(_0x39c715,0xc9))[_0x31bc('0x28')](handleError(_0x39c715,null));};exports[_0x31bc('0x35')]=function(_0x762ead,_0x2acb54){if(_0x762ead[_0x31bc('0x54')]['id']){delete _0x762ead[_0x31bc('0x54')]['id'];}return db[_0x31bc('0x3c')][_0x31bc('0x58')]({'where':{'id':_0x762ead[_0x31bc('0x52')]['id']}})[_0x31bc('0x36')](handleEntityNotFound(_0x2acb54,null))[_0x31bc('0x36')](saveUpdates(_0x762ead['body'],null))[_0x31bc('0x36')](respondWithResult(_0x2acb54,null))[_0x31bc('0x28')](handleError(_0x2acb54,null));};exports[_0x31bc('0x37')]=function(_0x5cce26,_0xbc64fd){return db[_0x31bc('0x3c')][_0x31bc('0x58')]({'where':{'id':_0x5cce26['params']['id']}})[_0x31bc('0x36')](handleEntityNotFound(_0xbc64fd,null))[_0x31bc('0x36')](removeEntity(_0xbc64fd,null))[_0x31bc('0x28')](handleError(_0xbc64fd,null));};exports[_0x31bc('0x5a')]=function(_0x120aee,_0x39551c){return db[_0x31bc('0x3c')][_0x31bc('0x5a')]()[_0x31bc('0x36')](respondWithResult(_0x39551c,null))['catch'](handleError(_0x39551c,null));};exports['getMembers']=function(_0x332e35,_0x434108,_0x208fbe){var _0x3c039b={'raw':!![],'where':{}},_0x20bda2={},_0x423b94;return db[_0x31bc('0x3c')]['findOne']({'where':{'id':_0x332e35[_0x31bc('0x52')]['id']}})[_0x31bc('0x36')](handleEntityNotFound(_0x434108,null))['then'](function(_0x334f3a){if(_0x334f3a){_0x423b94=_0x334f3a[_0x31bc('0x56')]({'plain':!![]});_0x20bda2['model']=_[_0x31bc('0x41')](db[_0x31bc('0x5b')][_0x31bc('0x3d')]);_0x20bda2[_0x31bc('0x42')]=_[_0x31bc('0x41')](_0x332e35[_0x31bc('0x42')]);_0x20bda2[_0x31bc('0x43')]=_[_0x31bc('0x44')](_0x20bda2[_0x31bc('0x40')],_0x20bda2[_0x31bc('0x42')]);_0x3c039b[_0x31bc('0x45')]=_[_0x31bc('0x44')](_0x20bda2[_0x31bc('0x40')],qs[_0x31bc('0x46')](_0x332e35[_0x31bc('0x42')][_0x31bc('0x46')]));_0x3c039b[_0x31bc('0x45')]=_0x3c039b[_0x31bc('0x45')][_0x31bc('0x47')]?_0x3c039b[_0x31bc('0x45')]:_0x20bda2[_0x31bc('0x40')];if(!_0x332e35[_0x31bc('0x42')]['hasOwnProperty']('nolimit')){_0x3c039b[_0x31bc('0x2f')]=qs[_0x31bc('0x2f')](_0x332e35['query'][_0x31bc('0x2f')]);_0x3c039b[_0x31bc('0x2d')]=qs[_0x31bc('0x2d')](_0x332e35[_0x31bc('0x42')][_0x31bc('0x2d')]);}_0x3c039b[_0x31bc('0x5c')]=qs[_0x31bc('0x49')](_0x332e35[_0x31bc('0x42')][_0x31bc('0x49')]);_0x3c039b[_0x31bc('0x4a')]=qs[_0x31bc('0x43')](_[_0x31bc('0x5d')](_0x332e35[_0x31bc('0x42')],_0x20bda2[_0x31bc('0x43')]));_0x3c039b[_0x31bc('0x4a')][_0x31bc('0x5e')]=_0x334f3a['id'];if(_0x332e35[_0x31bc('0x42')]['filter']){_0x3c039b[_0x31bc('0x4a')]=_['merge'](_0x3c039b[_0x31bc('0x4a')],{'$or':_[_0x31bc('0x3b')](_0x3c039b['attributes'],function(_0x34adb2){var _0x2c17c6={};_0x2c17c6[_0x34adb2]={'$like':'%'+_0x332e35[_0x31bc('0x42')][_0x31bc('0x4b')]+'%'};return _0x2c17c6;})});}_0x3c039b=_[_0x31bc('0x4c')]({},_0x3c039b,_0x332e35['options']);return db[_0x31bc('0x5b')][_0x31bc('0x5f')](_0x3c039b);}})[_0x31bc('0x36')](function(_0x26ab8a){if(_0x26ab8a){return db[_0x31bc('0x60')]['findAndCountAll']({'where':{'id':_[_0x31bc('0x3b')](_0x26ab8a,'UserId'),'role':_0x31bc('0x61')},'attributes':['id',_0x31bc('0x3a'),_0x31bc('0x62'),'updatedAt','createdAt']});}})[_0x31bc('0x36')](function(_0x395491){if(_0x395491){return{'count':_0x395491['count'],'rows':_[_0x31bc('0x3b')](_0x395491[_0x31bc('0x51')],function(_0x10c880){return{'membername':_0x10c880[_0x31bc('0x3a')],'UserId':_0x10c880['id'],'queue_name':_0x423b94[_0x31bc('0x3a')],'ChatQueueId':_0x423b94['id'],'interface':util[_0x31bc('0x63')](_0x31bc('0x64'),'SIP',_0x10c880[_0x31bc('0x3a')]),'penalty':0x0,'paused':_0x10c880['chatPause'],'createdAt':_0x10c880[_0x31bc('0x65')],'updatedAt':_0x10c880[_0x31bc('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x31bc('0x36')](respondWithFilteredResult(_0x434108,_0x3c039b))[_0x31bc('0x28')](handleError(_0x434108,null));};exports['getTeams']=function(_0xd5db68,_0x525cab,_0x5881c4){var _0x53fc4c={};var _0x1ec7a0={};var _0x4d3e1b;var _0x2ab51a;return db['ChatQueue'][_0x31bc('0x67')]({'where':{'id':_0xd5db68[_0x31bc('0x52')]['id']}})[_0x31bc('0x36')](handleEntityNotFound(_0x525cab,null))[_0x31bc('0x36')](function(_0x894409){if(_0x894409){_0x4d3e1b=_0x894409;_0x1ec7a0[_0x31bc('0x40')]=_[_0x31bc('0x41')](db[_0x31bc('0x68')][_0x31bc('0x3d')]);_0x1ec7a0[_0x31bc('0x42')]=_['keys'](_0xd5db68[_0x31bc('0x42')]);_0x1ec7a0[_0x31bc('0x43')]=_[_0x31bc('0x44')](_0x1ec7a0['model'],_0x1ec7a0['query']);_0x53fc4c[_0x31bc('0x45')]=_['intersection'](_0x1ec7a0[_0x31bc('0x40')],qs[_0x31bc('0x46')](_0xd5db68[_0x31bc('0x42')][_0x31bc('0x46')]));_0x53fc4c[_0x31bc('0x45')]=_0x53fc4c['attributes'][_0x31bc('0x47')]?_0x53fc4c[_0x31bc('0x45')]:_0x1ec7a0[_0x31bc('0x40')];_0x53fc4c[_0x31bc('0x5c')]=qs[_0x31bc('0x49')](_0xd5db68['query'][_0x31bc('0x49')]);_0x53fc4c[_0x31bc('0x4a')]=qs[_0x31bc('0x43')](_[_0x31bc('0x5d')](_0xd5db68['query'],_0x1ec7a0[_0x31bc('0x43')]));if(_0xd5db68[_0x31bc('0x42')]['filter']){_0x53fc4c[_0x31bc('0x4a')]=_[_0x31bc('0x4c')](_0x53fc4c['where'],{'$or':_['map'](_0x53fc4c[_0x31bc('0x45')],function(_0x569f30){var _0x42aecc={};_0x42aecc[_0x569f30]={'$like':'%'+_0xd5db68[_0x31bc('0x42')][_0x31bc('0x4b')]+'%'};return _0x42aecc;})});}_0x53fc4c=_[_0x31bc('0x4c')]({},_0x53fc4c,_0xd5db68['options']);return _0x4d3e1b[_0x31bc('0x69')](_0x53fc4c);}})[_0x31bc('0x36')](function(_0x131564){if(_0x131564){_0x2ab51a=_0x131564['length'];if(!_0xd5db68[_0x31bc('0x42')][_0x31bc('0x48')](_0x31bc('0x6a'))){_0x53fc4c[_0x31bc('0x2f')]=qs[_0x31bc('0x2f')](_0xd5db68[_0x31bc('0x42')][_0x31bc('0x2f')]);_0x53fc4c[_0x31bc('0x2d')]=qs[_0x31bc('0x2d')](_0xd5db68[_0x31bc('0x42')]['offset']);}return _0x4d3e1b[_0x31bc('0x69')](_0x53fc4c);}})['then'](function(_0x1cfabb){if(_0x1cfabb){return _0x1cfabb?{'count':_0x2ab51a,'rows':_0x1cfabb}:null;}})[_0x31bc('0x36')](respondWithResult(_0x525cab,null))[_0x31bc('0x28')](handleError(_0x525cab,null));};exports[_0x31bc('0x6b')]=function(_0x5bfbf1,_0x532925,_0x16e1a5){var _0x53d1b1=_0x5bfbf1[_0x31bc('0x54')][_0x31bc('0x6c')];return db[_0x31bc('0x68')]['findAll']({'where':{'id':_0x53d1b1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x31bc('0x6d'),'attributes':['id',_0x31bc('0x3a'),_0x31bc('0x6e'),_0x31bc('0x6f'),'interface'],'raw':!![]}]})[_0x31bc('0x36')](function(_0x23d79d){if(_0x23d79d){var _0x19838a=_['flatMap'](_0x23d79d,function(_0x20076f){var _0x49d164=_0x20076f[_0x31bc('0x56')]({'plain':!![]});return _0x49d164['Agents'];});return db['ChatQueue'][_0x31bc('0x58')]({'where':{'id':_0x5bfbf1['params']['id']}})[_0x31bc('0x36')](function(_0xc56637){return db[_0x31bc('0x70')][_0x31bc('0x71')](function(_0x3ff9f0){return _0xc56637['addTeams'](_0x53d1b1,{'transaction':_0x3ff9f0})[_0x31bc('0x36')](function(){return BPromise[_0x31bc('0x72')](_0x19838a,function(_0x1f77fa){return db[_0x31bc('0x5b')]['findOrCreate']({'where':{'UserId':_0x1f77fa['id'],'ChatQueueId':_0x5bfbf1[_0x31bc('0x52')]['id']},'transaction':_0x3ff9f0});});})['then'](function(){_0x19838a[_0x31bc('0x73')](function(_0x10f024){socket[_0x31bc('0x74')]('userChatQueue:save',{'UserId':_0x10f024['id'],'ChatQueueId':_0xc56637['id']});});});});});}})[_0x31bc('0x36')](respondWithStatusCode(_0x532925,null))[_0x31bc('0x28')](handleError(_0x532925,null));};exports['removeTeams']=function(_0x22e6e6,_0xc616dd,_0x40552f){return db[_0x31bc('0x68')][_0x31bc('0x5f')]({'where':{'id':_0x22e6e6[_0x31bc('0x42')][_0x31bc('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x31bc('0x60')],'as':_0x31bc('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x31bc('0x36')](handleEntityNotFound(_0xc616dd,null))['then'](function(_0x5c65a9){var _0x373e3f=_[_0x31bc('0x3b')](_0x5c65a9,'id');var _0x23352f=[];var _0x4cc3b1=[];var _0x390e51=squel[_0x31bc('0x75')]();_0x390e51[_0x31bc('0x76')](_0x31bc('0x77'))['from']('team_has_chat_queues','tq')[_0x31bc('0x78')](_0x31bc('0x79'),'ut',_0x31bc('0x7a'))['where']('ChatQueueId\x20=\x20?',_0x22e6e6['params']['id']);for(var _0x517a0a=0x0;_0x517a0a<_0x5c65a9[_0x31bc('0x47')];_0x517a0a+=0x1){let _0x27a79f=_0x5c65a9[_0x517a0a];for(var _0x49f352=0x0;_0x49f352<_0x27a79f[_0x31bc('0x6d')][_0x31bc('0x47')];_0x49f352+=0x1){let _0x3cbd3d=_0x27a79f[_0x31bc('0x6d')][_0x49f352];var _0x5665ed=_0x390e51['clone']();_0x5665ed['where']('ut.UserId\x20=\x20?',_0x3cbd3d['id']);_0x4cc3b1[_0x31bc('0x7b')](db[_0x31bc('0x70')][_0x31bc('0x42')](_0x5665ed[_0x31bc('0x7c')](),{'type':db['sequelize'][_0x31bc('0x7d')][_0x31bc('0x7e')]})[_0x31bc('0x36')](function(_0x5d1d92){if(_0x5d1d92[_0x31bc('0x47')]===0x1){return _0x3cbd3d['id'];}else{var _0x6888f4=_['every'](_['map'](_0x5d1d92,'TeamId'),function(_0x84b0f7){return _['includes'](_0x373e3f,_0x84b0f7);});if(_0x6888f4){return _0x3cbd3d['id'];}}}));}}return BPromise['all'](_0x4cc3b1)[_0x31bc('0x36')](function(_0x2a04f1){_0x23352f=_(_0x23352f)[_0x31bc('0x7f')](_0x2a04f1)[_0x31bc('0x80')]()['value']();return db[_0x31bc('0x3c')]['find']({'where':{'id':_0x22e6e6[_0x31bc('0x52')]['id']}})[_0x31bc('0x36')](function(_0x43d303){return db['sequelize'][_0x31bc('0x71')](function(_0xa97fa1){return _0x43d303[_0x31bc('0x81')](_0x22e6e6['query'][_0x31bc('0x6c')],{'transaction':_0xa97fa1})[_0x31bc('0x36')](function(){if(!_[_0x31bc('0x82')](_0x23352f)){return _0x43d303[_0x31bc('0x83')](_0x23352f,{'transaction':_0xa97fa1});}})[_0x31bc('0x36')](function(){_0x23352f[_0x31bc('0x73')](function(_0x32959b){socket[_0x31bc('0x74')]('userChatQueue:remove',{'UserId':_0x32959b,'ChatQueueId':_0x43d303['id']});});});});});});})[_0x31bc('0x36')](respondWithStatusCode(_0xc616dd,null))[_0x31bc('0x28')](handleError(_0xc616dd,null));};exports[_0x31bc('0x84')]=function(_0x3fb43a,_0x2d1a66,_0x2ce332){return db['ChatQueue'][_0x31bc('0x58')]({'where':{'id':_0x3fb43a[_0x31bc('0x52')]['id']}})[_0x31bc('0x36')](handleEntityNotFound(_0x2d1a66,null))['then'](function(_0xfdb61d){if(_0xfdb61d){return _0xfdb61d['addAgents'](_0x3fb43a[_0x31bc('0x54')][_0x31bc('0x6c')],_[_0x31bc('0x85')](_0x3fb43a[_0x31bc('0x54')],[_0x31bc('0x6c'),'id'])||{})[_0x31bc('0x86')](function(_0x2dda6a){for(var _0x2e82cc=0x0;_0x2e82cc<_0x3fb43a[_0x31bc('0x54')][_0x31bc('0x6c')][_0x31bc('0x47')];_0x2e82cc+=0x1){socket[_0x31bc('0x74')](_0x31bc('0x87'),{'UserId':Number(_0x3fb43a[_0x31bc('0x54')][_0x31bc('0x6c')][_0x2e82cc]),'ChatQueueId':Number(_0x3fb43a[_0x31bc('0x52')]['id'])});}return _0x2dda6a;});}})['then'](respondWithResult(_0x2d1a66,null))[_0x31bc('0x28')](handleError(_0x2d1a66,null));};exports['removeAgents']=function(_0x5ae0a6,_0x2c7673,_0xd2a86f){return db[_0x31bc('0x3c')][_0x31bc('0x58')]({'where':{'id':_0x5ae0a6['params']['id']}})['then'](handleEntityNotFound(_0x2c7673,null))[_0x31bc('0x36')](function(_0x12c78c){if(_0x12c78c){return _0x12c78c['removeAgents'](_0x5ae0a6[_0x31bc('0x42')][_0x31bc('0x6c')])[_0x31bc('0x36')](function(){if(_[_0x31bc('0x88')](_0x5ae0a6['query'][_0x31bc('0x6c')])){for(var _0x5f158f=0x0;_0x5f158f<_0x5ae0a6[_0x31bc('0x42')]['ids']['length'];_0x5f158f+=0x1){socket[_0x31bc('0x74')]('userChatQueue:remove',{'UserId':Number(_0x5ae0a6[_0x31bc('0x42')][_0x31bc('0x6c')][_0x5f158f]),'ChatQueueId':Number(_0x5ae0a6[_0x31bc('0x52')]['id'])});}}else{socket['emit'](_0x31bc('0x89'),{'UserId':Number(_0x5ae0a6[_0x31bc('0x42')][_0x31bc('0x6c')]),'ChatQueueId':Number(_0x5ae0a6[_0x31bc('0x52')]['id'])});}});}})[_0x31bc('0x36')](respondWithStatusCode(_0x2c7673,null))[_0x31bc('0x28')](handleError(_0x2c7673,null));};exports[_0x31bc('0x8a')]=function(_0x27e5c6,_0x27e45a,_0x16292e){var _0x3469c1={};var _0x1b8fa4={};var _0x1dfa33;var _0x24e2ca;return db['ChatQueue'][_0x31bc('0x67')]({'where':{'id':_0x27e5c6[_0x31bc('0x52')]['id']}})[_0x31bc('0x36')](handleEntityNotFound(_0x27e45a,null))[_0x31bc('0x36')](function(_0x33376b){if(_0x33376b){_0x1dfa33=_0x33376b;_0x1b8fa4[_0x31bc('0x40')]=_['keys'](db['User']['rawAttributes']);_0x1b8fa4[_0x31bc('0x42')]=_[_0x31bc('0x41')](_0x27e5c6[_0x31bc('0x42')]);_0x1b8fa4[_0x31bc('0x43')]=_[_0x31bc('0x44')](_0x1b8fa4[_0x31bc('0x40')],_0x1b8fa4[_0x31bc('0x42')]);_0x3469c1[_0x31bc('0x45')]=_[_0x31bc('0x44')](_0x1b8fa4[_0x31bc('0x40')],qs[_0x31bc('0x46')](_0x27e5c6[_0x31bc('0x42')][_0x31bc('0x46')]));_0x3469c1[_0x31bc('0x45')]=_0x3469c1[_0x31bc('0x45')][_0x31bc('0x47')]?_0x3469c1[_0x31bc('0x45')]:_0x1b8fa4[_0x31bc('0x40')];_0x3469c1[_0x31bc('0x5c')]=qs[_0x31bc('0x49')](_0x27e5c6[_0x31bc('0x42')][_0x31bc('0x49')]);_0x3469c1[_0x31bc('0x4a')]=qs[_0x31bc('0x43')](_[_0x31bc('0x5d')](_0x27e5c6[_0x31bc('0x42')],_0x1b8fa4[_0x31bc('0x43')]));if(_0x27e5c6[_0x31bc('0x42')][_0x31bc('0x4b')]){_0x3469c1['where']=_[_0x31bc('0x4c')](_0x3469c1[_0x31bc('0x4a')],{'$or':_[_0x31bc('0x3b')](_0x3469c1[_0x31bc('0x45')],function(_0x3b5af5){var _0x21bf43={};_0x21bf43[_0x3b5af5]={'$like':'%'+_0x27e5c6[_0x31bc('0x42')]['filter']+'%'};return _0x21bf43;})});}_0x3469c1=_['merge']({},_0x3469c1,_0x27e5c6[_0x31bc('0x4e')]);return _0x1dfa33['getAgents'](_0x3469c1);}})[_0x31bc('0x36')](function(_0x25ca93){if(_0x25ca93){_0x24e2ca=_0x25ca93[_0x31bc('0x47')];if(!_0x27e5c6[_0x31bc('0x42')][_0x31bc('0x48')](_0x31bc('0x6a'))){_0x3469c1[_0x31bc('0x2f')]=qs[_0x31bc('0x2f')](_0x27e5c6[_0x31bc('0x42')][_0x31bc('0x2f')]);_0x3469c1[_0x31bc('0x2d')]=qs['offset'](_0x27e5c6['query'][_0x31bc('0x2d')]);}return _0x1dfa33['getAgents'](_0x3469c1);}})[_0x31bc('0x36')](function(_0x1178c3){if(_0x1178c3){return _0x1178c3?{'count':_0x24e2ca,'rows':_0x1178c3}:null;}})[_0x31bc('0x36')](respondWithResult(_0x27e45a,null))[_0x31bc('0x28')](handleError(_0x27e45a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d47b68a..79ea3bd 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 _0x8fb7=['events','../../mysqldb','ChatQueue','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x3d84b2,_0x566767){var _0x4e6b72=function(_0x9f6318){while(--_0x9f6318){_0x3d84b2['push'](_0x3d84b2['shift']());}};_0x4e6b72(++_0x566767);}(_0x8fb7,0x1a4));var _0x78fb=function(_0x2d6616,_0x37278c){_0x2d6616=_0x2d6616-0x0;var _0x509c8a=_0x8fb7[_0x2d6616];return _0x509c8a;};'use strict';var EventEmitter=require(_0x78fb('0x0'));var ChatQueue=require(_0x78fb('0x1'))['db'][_0x78fb('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x78fb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x78fb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2abc9c){return function(_0x4a96e6,_0x2febcf,_0x2a8416){ChatQueueEvents[_0x78fb('0x5')](_0x2abc9c+':'+_0x4a96e6['id'],_0x4a96e6);ChatQueueEvents[_0x78fb('0x5')](_0x2abc9c,_0x4a96e6);_0x2a8416(null);};}for(var e in events){if(events[_0x78fb('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xa8e0=['exports','events','../../mysqldb','ChatQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x1a40f3,_0xce8099){var _0x2ef970=function(_0xc79e11){while(--_0xc79e11){_0x1a40f3['push'](_0x1a40f3['shift']());}};_0x2ef970(++_0xce8099);}(_0xa8e0,0x1c3));var _0x0a8e=function(_0x3d3590,_0x23bd12){_0x3d3590=_0x3d3590-0x0;var _0x1348ff=_0xa8e0[_0x3d3590];return _0x1348ff;};'use strict';var EventEmitter=require(_0x0a8e('0x0'));var ChatQueue=require(_0x0a8e('0x1'))['db'][_0x0a8e('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a8e('0x3'),'afterDestroy':_0x0a8e('0x4')};function emitEvent(_0x86a314){return function(_0x3eccb9,_0x4a52f3,_0x59f071){ChatQueueEvents[_0x0a8e('0x5')](_0x86a314+':'+_0x3eccb9['id'],_0x3eccb9);ChatQueueEvents['emit'](_0x86a314,_0x3eccb9);_0x59f071(null);};}for(var e in events){if(events[_0x0a8e('0x6')](e)){var event=events[e];ChatQueue[_0x0a8e('0x7')](e,emitEvent(event));}}module[_0x0a8e('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6b3b295..1e46e91 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 _0xa870=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x3b2412,_0x3a2652){var _0x47bc00=function(_0x10b986){while(--_0x10b986){_0x3b2412['push'](_0x3b2412['shift']());}};_0x47bc00(++_0x3a2652);}(_0xa870,0xc3));var _0x0a87=function(_0xef7090,_0x9de7dd){_0xef7090=_0xef7090-0x0;var _0x263453=_0xa870[_0xef7090];return _0x263453;};'use strict';var _=require(_0x0a87('0x0'));var util=require(_0x0a87('0x1'));var logger=require(_0x0a87('0x2'))('api');var moment=require(_0x0a87('0x3'));var BPromise=require(_0x0a87('0x4'));var rp=require(_0x0a87('0x5'));var fs=require('fs');var path=require(_0x0a87('0x6'));var rimraf=require(_0x0a87('0x7'));var config=require(_0x0a87('0x8'));var attributes=require(_0x0a87('0x9'));module[_0x0a87('0xa')]=function(_0x3fc538,_0x1e8bae){return _0x3fc538[_0x0a87('0xb')](_0x0a87('0xc'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea23=['define','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatQueue.attributes'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xea23,0x1bb));var _0x3ea2=function(_0x130afc,_0x68e4e2){_0x130afc=_0x130afc-0x0;var _0x1ee810=_0xea23[_0x130afc];return _0x1ee810;};'use strict';var _=require('lodash');var util=require(_0x3ea2('0x0'));var logger=require(_0x3ea2('0x1'))(_0x3ea2('0x2'));var moment=require(_0x3ea2('0x3'));var BPromise=require(_0x3ea2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ea2('0x5'));var rimraf=require('rimraf');var config=require(_0x3ea2('0x6'));var attributes=require(_0x3ea2('0x7'));module['exports']=function(_0x5b999a,_0x9595fc){return _0x5b999a[_0x3ea2('0x8')](_0x3ea2('0x9'),attributes,{'tableName':_0x3ea2('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 3557705..52caf6b 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 _0x0f42=['then','GetChatQueue','debug','ShowChatQueue','ChatQueue','where','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','include','model','map'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0x0f42,0x126));var _0x20f4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0f42[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var moment=require(_0x20f4('0x2'));var BPromise=require(_0x20f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20f4('0x5'));var logger=require('../../config/logger')(_0x20f4('0x6'));var config=require(_0x20f4('0x7'));var jayson=require(_0x20f4('0x8'));var client=jayson['client'][_0x20f4('0x9')]({'port':0x232a});config[_0x20f4('0xa')]=_['defaults'](config[_0x20f4('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x20f4('0xb'))['register'](socket);function respondWithRpcPromise(_0x41c1bb,_0x30f2ef,_0x395fda){return new BPromise(function(_0x1ee8c6,_0x51ab58){return client[_0x20f4('0xc')](_0x41c1bb,_0x395fda)['then'](function(_0x2383ce){logger[_0x20f4('0xd')](_0x20f4('0xe'),_0x30f2ef,_0x20f4('0xf'));logger['debug'](_0x20f4('0x10'),_0x30f2ef,_0x20f4('0xf'),JSON[_0x20f4('0x11')](_0x2383ce));if(_0x2383ce[_0x20f4('0x12')]){if(_0x2383ce[_0x20f4('0x12')][_0x20f4('0x13')]===0x1f4){logger[_0x20f4('0x12')](_0x20f4('0xe'),_0x30f2ef,_0x2383ce[_0x20f4('0x12')][_0x20f4('0x14')]);return _0x51ab58(_0x2383ce[_0x20f4('0x12')]['message']);}logger['error'](_0x20f4('0xe'),_0x30f2ef,_0x2383ce[_0x20f4('0x12')][_0x20f4('0x14')]);return _0x1ee8c6(_0x2383ce[_0x20f4('0x12')][_0x20f4('0x14')]);}else{logger['info'](_0x20f4('0xe'),_0x30f2ef,_0x20f4('0xf'));_0x1ee8c6(_0x2383ce[_0x20f4('0x15')]['message']);}})[_0x20f4('0x16')](function(_0xd8de3b){logger[_0x20f4('0x12')]('ChatQueue,\x20%s,\x20%s',_0x30f2ef,_0xd8de3b);_0x51ab58(_0xd8de3b);});});}exports['GetChatQueue']=function(_0x323d19){var _0x56a89f=this;return new Promise(function(_0x5d646a,_0x83ee22){return db['ChatQueue'][_0x20f4('0x17')]({'raw':_0x323d19[_0x20f4('0x18')]?_0x323d19[_0x20f4('0x18')][_0x20f4('0x19')]===undefined?!![]:![]:!![],'where':_0x323d19[_0x20f4('0x18')]?_0x323d19[_0x20f4('0x18')]['where']||null:null,'attributes':_0x323d19[_0x20f4('0x18')]?_0x323d19[_0x20f4('0x18')][_0x20f4('0x1a')]||null:null,'limit':_0x323d19[_0x20f4('0x18')]?_0x323d19[_0x20f4('0x18')]['limit']||null:null,'include':_0x323d19['options']?_0x323d19[_0x20f4('0x18')][_0x20f4('0x1b')]?_['map'](_0x323d19[_0x20f4('0x18')][_0x20f4('0x1b')],function(_0x50a2c1){return{'model':db[_0x50a2c1[_0x20f4('0x1c')]],'as':_0x50a2c1['as'],'attributes':_0x50a2c1[_0x20f4('0x1a')],'include':_0x50a2c1['include']?_[_0x20f4('0x1d')](_0x50a2c1[_0x20f4('0x1b')],function(_0x104229){return{'model':db[_0x104229[_0x20f4('0x1c')]],'as':_0x104229['as'],'attributes':_0x104229[_0x20f4('0x1a')],'include':_0x104229[_0x20f4('0x1b')]?_[_0x20f4('0x1d')](_0x104229[_0x20f4('0x1b')],function(_0x365e5a){return{'model':db[_0x365e5a[_0x20f4('0x1c')]],'as':_0x365e5a['as'],'attributes':_0x365e5a[_0x20f4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x20f4('0x1e')](function(_0xf47be4){logger[_0x20f4('0xd')](_0x20f4('0x1f'),_0x323d19);logger[_0x20f4('0x20')](_0x20f4('0x1f'),_0x323d19,JSON['stringify'](_0xf47be4));_0x5d646a(_0xf47be4);})['catch'](function(_0x4d4edc){logger[_0x20f4('0x12')](_0x20f4('0x1f'),_0x4d4edc[_0x20f4('0x14')],_0x323d19);_0x83ee22(_0x56a89f['error'](0x1f4,_0x4d4edc['message']));});});};exports[_0x20f4('0x21')]=function(_0x1f85c8){var _0x38ac33=this;return new Promise(function(_0x40e3bb,_0x5d56e8){return db[_0x20f4('0x22')]['find']({'raw':_0x1f85c8[_0x20f4('0x18')]?_0x1f85c8[_0x20f4('0x18')][_0x20f4('0x19')]===undefined?!![]:![]:!![],'where':_0x1f85c8[_0x20f4('0x18')]?_0x1f85c8[_0x20f4('0x18')][_0x20f4('0x23')]||null:null,'attributes':_0x1f85c8[_0x20f4('0x18')]?_0x1f85c8[_0x20f4('0x18')][_0x20f4('0x1a')]||null:null,'include':_0x1f85c8['options']?_0x1f85c8[_0x20f4('0x18')][_0x20f4('0x1b')]?_[_0x20f4('0x1d')](_0x1f85c8['options']['include'],function(_0x24698a){return{'model':db[_0x24698a['model']],'as':_0x24698a['as'],'attributes':_0x24698a['attributes'],'include':_0x24698a['include']?_[_0x20f4('0x1d')](_0x24698a[_0x20f4('0x1b')],function(_0xbc17cc){return{'model':db[_0xbc17cc[_0x20f4('0x1c')]],'as':_0xbc17cc['as'],'attributes':_0xbc17cc['attributes'],'include':_0xbc17cc['include']?_[_0x20f4('0x1d')](_0xbc17cc[_0x20f4('0x1b')],function(_0xd250e7){return{'model':db[_0xd250e7['model']],'as':_0xd250e7['as'],'attributes':_0xd250e7[_0x20f4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x20f4('0x1e')](function(_0x190120){logger[_0x20f4('0xd')](_0x20f4('0x21'),_0x1f85c8);logger[_0x20f4('0x20')](_0x20f4('0x21'),_0x1f85c8,JSON[_0x20f4('0x11')](_0x190120));_0x40e3bb(_0x190120);})[_0x20f4('0x16')](function(_0x35e426){logger['error'](_0x20f4('0x21'),_0x35e426[_0x20f4('0x14')],_0x1f85c8);_0x5d56e8(_0x38ac33[_0x20f4('0x12')](0x1f4,_0x35e426[_0x20f4('0x14')]));});});}; \ No newline at end of file +var _0x84cd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','model','map','ShowChatQueue'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x84cd,0x1e0));var _0xd84c=function(_0x3bf051,_0x14edad){_0x3bf051=_0x3bf051-0x0;var _0x26f6c9=_0x84cd[_0x3bf051];return _0x26f6c9;};'use strict';var _=require('lodash');var util=require(_0xd84c('0x0'));var moment=require(_0xd84c('0x1'));var BPromise=require(_0xd84c('0x2'));var rs=require(_0xd84c('0x3'));var fs=require('fs');var Redis=require(_0xd84c('0x4'));var db=require(_0xd84c('0x5'))['db'];var utils=require(_0xd84c('0x6'));var logger=require(_0xd84c('0x7'))(_0xd84c('0x8'));var config=require(_0xd84c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd84c('0xa')][_0xd84c('0xb')]({'port':0x232a});config[_0xd84c('0xc')]=_[_0xd84c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd84c('0xe'))(new Redis(config[_0xd84c('0xc')]));require(_0xd84c('0xf'))[_0xd84c('0x10')](socket);function respondWithRpcPromise(_0x22bd29,_0x52caf2,_0xc5c2b0){return new BPromise(function(_0x33e67f,_0x5088fd){return client[_0xd84c('0x11')](_0x22bd29,_0xc5c2b0)[_0xd84c('0x12')](function(_0x263bdd){logger['info'](_0xd84c('0x13'),_0x52caf2,_0xd84c('0x14'));logger[_0xd84c('0x15')](_0xd84c('0x16'),_0x52caf2,_0xd84c('0x14'),JSON[_0xd84c('0x17')](_0x263bdd));if(_0x263bdd['error']){if(_0x263bdd['error']['code']===0x1f4){logger[_0xd84c('0x18')](_0xd84c('0x13'),_0x52caf2,_0x263bdd[_0xd84c('0x18')][_0xd84c('0x19')]);return _0x5088fd(_0x263bdd['error'][_0xd84c('0x19')]);}logger[_0xd84c('0x18')](_0xd84c('0x13'),_0x52caf2,_0x263bdd[_0xd84c('0x18')][_0xd84c('0x19')]);return _0x33e67f(_0x263bdd[_0xd84c('0x18')]['message']);}else{logger[_0xd84c('0x1a')](_0xd84c('0x13'),_0x52caf2,_0xd84c('0x14'));_0x33e67f(_0x263bdd[_0xd84c('0x1b')][_0xd84c('0x19')]);}})[_0xd84c('0x1c')](function(_0x1d3106){logger['error'](_0xd84c('0x13'),_0x52caf2,_0x1d3106);_0x5088fd(_0x1d3106);});});}exports[_0xd84c('0x1d')]=function(_0x90fc0){var _0x5da5db=this;return new Promise(function(_0xcbe9a4,_0x30b2ab){return db[_0xd84c('0x1e')][_0xd84c('0x1f')]({'raw':_0x90fc0[_0xd84c('0x20')]?_0x90fc0[_0xd84c('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x90fc0[_0xd84c('0x20')]?_0x90fc0['options'][_0xd84c('0x21')]||null:null,'attributes':_0x90fc0[_0xd84c('0x20')]?_0x90fc0[_0xd84c('0x20')][_0xd84c('0x22')]||null:null,'limit':_0x90fc0[_0xd84c('0x20')]?_0x90fc0[_0xd84c('0x20')][_0xd84c('0x23')]||null:null,'include':_0x90fc0['options']?_0x90fc0[_0xd84c('0x20')][_0xd84c('0x24')]?_['map'](_0x90fc0[_0xd84c('0x20')][_0xd84c('0x24')],function(_0x28254a){return{'model':db[_0x28254a[_0xd84c('0x25')]],'as':_0x28254a['as'],'attributes':_0x28254a[_0xd84c('0x22')],'include':_0x28254a[_0xd84c('0x24')]?_['map'](_0x28254a[_0xd84c('0x24')],function(_0x8cfb7e){return{'model':db[_0x8cfb7e['model']],'as':_0x8cfb7e['as'],'attributes':_0x8cfb7e['attributes'],'include':_0x8cfb7e['include']?_[_0xd84c('0x26')](_0x8cfb7e['include'],function(_0x393f2f){return{'model':db[_0x393f2f['model']],'as':_0x393f2f['as'],'attributes':_0x393f2f[_0xd84c('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd84c('0x12')](function(_0x534156){logger[_0xd84c('0x1a')]('GetChatQueue',_0x90fc0);logger['debug'](_0xd84c('0x1d'),_0x90fc0,JSON[_0xd84c('0x17')](_0x534156));_0xcbe9a4(_0x534156);})[_0xd84c('0x1c')](function(_0x35f3a6){logger[_0xd84c('0x18')](_0xd84c('0x1d'),_0x35f3a6['message'],_0x90fc0);_0x30b2ab(_0x5da5db[_0xd84c('0x18')](0x1f4,_0x35f3a6[_0xd84c('0x19')]));});});};exports[_0xd84c('0x27')]=function(_0x26fe4d){var _0x2fabee=this;return new Promise(function(_0x4eb62e,_0x48eae9){return db[_0xd84c('0x1e')]['find']({'raw':_0x26fe4d[_0xd84c('0x20')]?_0x26fe4d['options']['raw']===undefined?!![]:![]:!![],'where':_0x26fe4d[_0xd84c('0x20')]?_0x26fe4d[_0xd84c('0x20')]['where']||null:null,'attributes':_0x26fe4d['options']?_0x26fe4d[_0xd84c('0x20')][_0xd84c('0x22')]||null:null,'include':_0x26fe4d[_0xd84c('0x20')]?_0x26fe4d[_0xd84c('0x20')][_0xd84c('0x24')]?_[_0xd84c('0x26')](_0x26fe4d[_0xd84c('0x20')][_0xd84c('0x24')],function(_0x32b869){return{'model':db[_0x32b869['model']],'as':_0x32b869['as'],'attributes':_0x32b869['attributes'],'include':_0x32b869[_0xd84c('0x24')]?_['map'](_0x32b869['include'],function(_0x2ee22f){return{'model':db[_0x2ee22f['model']],'as':_0x2ee22f['as'],'attributes':_0x2ee22f[_0xd84c('0x22')],'include':_0x2ee22f['include']?_[_0xd84c('0x26')](_0x2ee22f[_0xd84c('0x24')],function(_0x153202){return{'model':db[_0x153202[_0xd84c('0x25')]],'as':_0x153202['as'],'attributes':_0x153202[_0xd84c('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd84c('0x12')](function(_0x36d6c5){logger[_0xd84c('0x1a')](_0xd84c('0x27'),_0x26fe4d);logger[_0xd84c('0x15')](_0xd84c('0x27'),_0x26fe4d,JSON[_0xd84c('0x17')](_0x36d6c5));_0x4eb62e(_0x36d6c5);})['catch'](function(_0x3ee5b3){logger[_0xd84c('0x18')]('ShowChatQueue',_0x3ee5b3[_0xd84c('0x19')],_0x26fe4d);_0x48eae9(_0x2fabee['error'](0x1f4,_0x3ee5b3[_0xd84c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9360885..8490669 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 _0x80d9=['./chatQueue.events','remove','update','emit','removeListener','chatQueue:'];(function(_0x19f92d,_0x55e990){var _0x4c7457=function(_0x102a61){while(--_0x102a61){_0x19f92d['push'](_0x19f92d['shift']());}};_0x4c7457(++_0x55e990);}(_0x80d9,0x15c));var _0x980d=function(_0x1eedfd,_0x133f0f){_0x1eedfd=_0x1eedfd-0x0;var _0x10be6c=_0x80d9[_0x1eedfd];return _0x10be6c;};'use strict';var ChatQueueEvents=require(_0x980d('0x0'));var events=['save',_0x980d('0x1'),_0x980d('0x2')];function createListener(_0xac96e5,_0x5d4b87){return function(_0x358d0a){_0x5d4b87[_0x980d('0x3')](_0xac96e5,_0x358d0a);};}function removeListener(_0x38d1b9,_0x279d93){return function(){ChatQueueEvents[_0x980d('0x4')](_0x38d1b9,_0x279d93);};}exports['register']=function(_0x4c3533){for(var _0x2fd4b9=0x0,_0x50854e=events['length'];_0x2fd4b9<_0x50854e;_0x2fd4b9++){var _0x7e96f7=events[_0x2fd4b9];var _0x758fc3=createListener(_0x980d('0x5')+_0x7e96f7,_0x4c3533);ChatQueueEvents['on'](_0x7e96f7,_0x758fc3);}}; \ No newline at end of file +var _0x032e=['removeListener','register','length','chatQueue:','./chatQueue.events','remove','update','emit'];(function(_0x3a9b8b,_0x7b9301){var _0x19cac0=function(_0x35d78a){while(--_0x35d78a){_0x3a9b8b['push'](_0x3a9b8b['shift']());}};_0x19cac0(++_0x7b9301);}(_0x032e,0x124));var _0xe032=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x032e[_0x5bd426];return _0x23a7eb;};'use strict';var ChatQueueEvents=require(_0xe032('0x0'));var events=['save',_0xe032('0x1'),_0xe032('0x2')];function createListener(_0x5ca562,_0x4afba2){return function(_0x45ab5b){_0x4afba2[_0xe032('0x3')](_0x5ca562,_0x45ab5b);};}function removeListener(_0x2f44f6,_0x1983cc){return function(){ChatQueueEvents[_0xe032('0x4')](_0x2f44f6,_0x1983cc);};}exports[_0xe032('0x5')]=function(_0x2ba8a0){for(var _0x33ad0b=0x0,_0x37432f=events[_0xe032('0x6')];_0x33ad0b<_0x37432f;_0x33ad0b++){var _0x3289b0=events[_0x33ad0b];var _0xd84027=createListener(_0xe032('0x7')+_0x3289b0,_0x2ba8a0);ChatQueueEvents['on'](_0x3289b0,_0xd84027);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 276c292..9214f58 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x4b29d4,_0x1a2af7){var _0x4004f5=function(_0x4966a5){while(--_0x4966a5){_0x4b29d4['push'](_0x4b29d4['shift']());}};_0x4004f5(++_0x1a2af7);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x3f944b,_0x248527){_0x3f944b=_0x3f944b-0x0;var _0x561cf5=_0x3e74[_0x3f944b];return _0x561cf5;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 372ad47..bca058b 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 _0x1921=['STRING','DATE','moment','sequelize','exports'];(function(_0x10706f,_0x292158){var _0xa40f54=function(_0x2e0468){while(--_0x2e0468){_0x10706f['push'](_0x10706f['shift']());}};_0xa40f54(++_0x292158);}(_0x1921,0xb1));var _0x1192=function(_0x2c2987,_0xa032ab){_0x2c2987=_0x2c2987-0x0;var _0x2ad65d=_0x1921[_0x2c2987];return _0x2ad65d;};'use strict';var moment=require(_0x1192('0x0'));var Sequelize=require(_0x1192('0x1'));module[_0x1192('0x2')]={'uniqueid':{'type':Sequelize[_0x1192('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1192('0x4')]},'leaveAt':{'type':Sequelize[_0x1192('0x4')]},'acceptAt':{'type':Sequelize[_0x1192('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36d4=['exports','STRING','DATE','moment','sequelize'];(function(_0x185c30,_0x314c03){var _0x424ea6=function(_0x48f4b7){while(--_0x48f4b7){_0x185c30['push'](_0x185c30['shift']());}};_0x424ea6(++_0x314c03);}(_0x36d4,0x99));var _0x436d=function(_0x182cf2,_0x3189bb){_0x182cf2=_0x182cf2-0x0;var _0xc0293=_0x36d4[_0x182cf2];return _0xc0293;};'use strict';var moment=require(_0x436d('0x0'));var Sequelize=require(_0x436d('0x1'));module[_0x436d('0x2')]={'uniqueid':{'type':Sequelize[_0x436d('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x436d('0x4')]},'leaveAt':{'type':Sequelize[_0x436d('0x4')]},'acceptAt':{'type':Sequelize[_0x436d('0x4')]},'exitAt':{'type':Sequelize[_0x436d('0x4')]},'reason':{'type':Sequelize[_0x436d('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index dbc0dae..addb5b8 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 _0x3fa4=['model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','intersection','length','find','create','body','params','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key'];(function(_0x5a5a7a,_0x571535){var _0xbea751=function(_0x2c64e3){while(--_0x2c64e3){_0x5a5a7a['push'](_0x5a5a7a['shift']());}};_0xbea751(++_0x571535);}(_0x3fa4,0xf0));var _0x43fa=function(_0x2af760,_0x3a142b){_0x2af760=_0x2af760-0x0;var _0x1c4408=_0x3fa4[_0x2af760];return _0x1c4408;};'use strict';var emlformat=require(_0x43fa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x43fa('0x1'));var moment=require(_0x43fa('0x2'));var BPromise=require(_0x43fa('0x3'));var Mustache=require(_0x43fa('0x4'));var util=require(_0x43fa('0x5'));var path=require(_0x43fa('0x6'));var sox=require(_0x43fa('0x7'));var csv=require('to-csv');var ejs=require(_0x43fa('0x8'));var fs=require('fs');var fs_extra=require(_0x43fa('0x9'));var _=require(_0x43fa('0xa'));var squel=require('squel');var crypto=require(_0x43fa('0xb'));var jsforce=require(_0x43fa('0xc'));var deskjs=require(_0x43fa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x43fa('0xe'));var Papa=require(_0x43fa('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43fa('0x10'));var as=require(_0x43fa('0x11'));var hardwareService=require(_0x43fa('0x12'));var logger=require(_0x43fa('0x13'))(_0x43fa('0x14'));var utils=require('../../config/utils');var config=require(_0x43fa('0x15'));var licenseUtil=require(_0x43fa('0x16'));var db=require(_0x43fa('0x17'))['db'];function respondWithStatusCode(_0x582ec2,_0xfbf89e){_0xfbf89e=_0xfbf89e||0xcc;return function(_0x4353c1){if(_0x4353c1){return _0x582ec2[_0x43fa('0x18')](_0xfbf89e);}return _0x582ec2['status'](_0xfbf89e)[_0x43fa('0x19')]();};}function respondWithResult(_0x4bb4b0,_0x5bc292){_0x5bc292=_0x5bc292||0xc8;return function(_0x4fba54){if(_0x4fba54){return _0x4bb4b0[_0x43fa('0x1a')](_0x5bc292)['json'](_0x4fba54);}};}function respondWithFilteredResult(_0x1a898a,_0x12ae9e){return function(_0x4a07b5){if(_0x4a07b5){var _0x27b87f=typeof _0x12ae9e[_0x43fa('0x1b')]===_0x43fa('0x1c')&&typeof _0x12ae9e[_0x43fa('0x1d')]===_0x43fa('0x1c');var _0x53c04c=_0x4a07b5['count'];var _0x479d81=_0x27b87f?0x0:_0x12ae9e[_0x43fa('0x1b')];var _0x29b8aa=_0x27b87f?_0x4a07b5[_0x43fa('0x1e')]:_0x12ae9e[_0x43fa('0x1b')]+_0x12ae9e[_0x43fa('0x1d')];var _0x15e594;if(_0x29b8aa>=_0x53c04c){_0x29b8aa=_0x53c04c;_0x15e594=0xc8;}else{_0x15e594=0xce;}_0x1a898a[_0x43fa('0x1a')](_0x15e594);return _0x1a898a[_0x43fa('0x1f')](_0x43fa('0x20'),_0x479d81+'-'+_0x29b8aa+'/'+_0x53c04c)['json'](_0x4a07b5);}return null;};}function patchUpdates(_0xfd8d3){return function(_0x551528){try{jsonpatch[_0x43fa('0x21')](_0x551528,_0xfd8d3,!![]);}catch(_0x319cfd){return BPromise[_0x43fa('0x22')](_0x319cfd);}return _0x551528['save']();};}function saveUpdates(_0x2c6075,_0x3c78fb){return function(_0x2db3dd){if(_0x2db3dd){return _0x2db3dd[_0x43fa('0x23')](_0x2c6075)[_0x43fa('0x24')](function(_0x1d3328){return _0x1d3328;});}return null;};}function removeEntity(_0x3b8cb9,_0x241948){return function(_0x427426){if(_0x427426){return _0x427426['destroy']()['then'](function(){_0x3b8cb9[_0x43fa('0x1a')](0xcc)[_0x43fa('0x19')]();});}};}function handleEntityNotFound(_0x28f695,_0x78f105){return function(_0x40969a){if(!_0x40969a){_0x28f695[_0x43fa('0x18')](0x194);}return _0x40969a;};}function handleError(_0x5014fb,_0x4f6101){_0x4f6101=_0x4f6101||0x1f4;return function(_0x1fa077){logger[_0x43fa('0x25')](_0x1fa077[_0x43fa('0x26')]);if(_0x1fa077[_0x43fa('0x27')]){delete _0x1fa077['name'];}_0x5014fb[_0x43fa('0x1a')](_0x4f6101)[_0x43fa('0x28')](_0x1fa077);};}exports[_0x43fa('0x29')]=function(_0x186249,_0x4d6c8c){var _0x3d5abd={},_0x44fdef={},_0x398c44={'count':0x0,'rows':[]};var _0x28b833=_[_0x43fa('0x2a')](db[_0x43fa('0x2b')][_0x43fa('0x2c')],function(_0x41a3cf){return{'name':_0x41a3cf[_0x43fa('0x2d')],'type':_0x41a3cf[_0x43fa('0x2e')][_0x43fa('0x2f')]};});_0x44fdef[_0x43fa('0x30')]=_['map'](_0x28b833,'name');_0x44fdef[_0x43fa('0x31')]=_[_0x43fa('0x32')](_0x186249[_0x43fa('0x31')]);_0x44fdef[_0x43fa('0x33')]=_['intersection'](_0x44fdef[_0x43fa('0x30')],_0x44fdef[_0x43fa('0x31')]);_0x3d5abd[_0x43fa('0x34')]=_['intersection'](_0x44fdef[_0x43fa('0x30')],qs[_0x43fa('0x35')](_0x186249[_0x43fa('0x31')][_0x43fa('0x35')]));_0x3d5abd['attributes']=_0x3d5abd[_0x43fa('0x34')]['length']?_0x3d5abd[_0x43fa('0x34')]:_0x44fdef[_0x43fa('0x30')];if(!_0x186249[_0x43fa('0x31')]['hasOwnProperty'](_0x43fa('0x36'))){_0x3d5abd['limit']=qs['limit'](_0x186249[_0x43fa('0x31')][_0x43fa('0x1d')]);_0x3d5abd[_0x43fa('0x1b')]=qs['offset'](_0x186249[_0x43fa('0x31')][_0x43fa('0x1b')]);}_0x3d5abd[_0x43fa('0x37')]=qs[_0x43fa('0x38')](_0x186249[_0x43fa('0x31')]['sort']);_0x3d5abd[_0x43fa('0x39')]=qs[_0x43fa('0x33')](_[_0x43fa('0x3a')](_0x186249[_0x43fa('0x31')],_0x44fdef['filters']),_0x28b833);if(_0x186249['query'][_0x43fa('0x3b')]){_0x3d5abd[_0x43fa('0x39')]=_[_0x43fa('0x3c')](_0x3d5abd[_0x43fa('0x39')],{'$or':_[_0x43fa('0x2a')](_0x28b833,function(_0x595d49){if(_0x595d49[_0x43fa('0x2e')]!=='VIRTUAL'){var _0x4cb1bd={};_0x4cb1bd[_0x595d49[_0x43fa('0x27')]]={'$like':'%'+_0x186249['query'][_0x43fa('0x3b')]+'%'};return _0x4cb1bd;}})});}_0x3d5abd=_[_0x43fa('0x3c')]({},_0x3d5abd,_0x186249[_0x43fa('0x3d')]);var _0x17403c={'where':_0x3d5abd['where']};return db['ChatQueueReport']['count'](_0x17403c)[_0x43fa('0x24')](function(_0x15ef49){_0x398c44['count']=_0x15ef49;if(_0x186249[_0x43fa('0x31')][_0x43fa('0x3e')]){_0x3d5abd[_0x43fa('0x3f')]=[{'all':!![]}];}return db[_0x43fa('0x2b')]['findAll'](_0x3d5abd);})[_0x43fa('0x24')](function(_0x23e156){_0x398c44['rows']=_0x23e156;return _0x398c44;})['then'](respondWithFilteredResult(_0x4d6c8c,_0x3d5abd))[_0x43fa('0x40')](handleError(_0x4d6c8c,null));};exports['show']=function(_0x3a6d39,_0x137ef){var _0x5cef1e={'raw':!![],'where':{'id':_0x3a6d39['params']['id']}},_0x4735d1={};_0x4735d1[_0x43fa('0x30')]=_[_0x43fa('0x32')](db[_0x43fa('0x2b')]['rawAttributes']);_0x4735d1[_0x43fa('0x31')]=_[_0x43fa('0x32')](_0x3a6d39[_0x43fa('0x31')]);_0x4735d1[_0x43fa('0x33')]=_[_0x43fa('0x41')](_0x4735d1[_0x43fa('0x30')],_0x4735d1['query']);_0x5cef1e[_0x43fa('0x34')]=_['intersection'](_0x4735d1[_0x43fa('0x30')],qs['fields'](_0x3a6d39[_0x43fa('0x31')][_0x43fa('0x35')]));_0x5cef1e[_0x43fa('0x34')]=_0x5cef1e[_0x43fa('0x34')][_0x43fa('0x42')]?_0x5cef1e['attributes']:_0x4735d1[_0x43fa('0x30')];if(_0x3a6d39['query']['includeAll']){_0x5cef1e['include']=[{'all':!![]}];}_0x5cef1e=_[_0x43fa('0x3c')]({},_0x5cef1e,_0x3a6d39[_0x43fa('0x3d')]);return db[_0x43fa('0x2b')][_0x43fa('0x43')](_0x5cef1e)[_0x43fa('0x24')](handleEntityNotFound(_0x137ef,null))['then'](respondWithResult(_0x137ef,null))[_0x43fa('0x40')](handleError(_0x137ef,null));};exports[_0x43fa('0x44')]=function(_0x305e90,_0x19b0f0){return db[_0x43fa('0x2b')][_0x43fa('0x44')](_0x305e90[_0x43fa('0x45')],{})[_0x43fa('0x24')](respondWithResult(_0x19b0f0,0xc9))[_0x43fa('0x40')](handleError(_0x19b0f0,null));};exports[_0x43fa('0x23')]=function(_0x1ae6e0,_0x52d66f){if(_0x1ae6e0[_0x43fa('0x45')]['id']){delete _0x1ae6e0[_0x43fa('0x45')]['id'];}return db['ChatQueueReport'][_0x43fa('0x43')]({'where':{'id':_0x1ae6e0['params']['id']}})[_0x43fa('0x24')](handleEntityNotFound(_0x52d66f,null))[_0x43fa('0x24')](saveUpdates(_0x1ae6e0[_0x43fa('0x45')],null))[_0x43fa('0x24')](respondWithResult(_0x52d66f,null))[_0x43fa('0x40')](handleError(_0x52d66f,null));};exports['destroy']=function(_0x1bbae4,_0x4a24f1){return db[_0x43fa('0x2b')][_0x43fa('0x43')]({'where':{'id':_0x1bbae4[_0x43fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a24f1,null))['then'](removeEntity(_0x4a24f1,null))[_0x43fa('0x40')](handleError(_0x4a24f1,null));};exports['describe']=function(_0x2ca431,_0x574076){return db['ChatQueueReport'][_0x43fa('0x47')]()[_0x43fa('0x24')](respondWithResult(_0x574076,null))['catch'](handleError(_0x574076,null));}; \ No newline at end of file +var _0x8a5c=['name','map','ChatQueueReport','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack'];(function(_0x14542d,_0x284158){var _0x473d53=function(_0x3d5c4e){while(--_0x3d5c4e){_0x14542d['push'](_0x14542d['shift']());}};_0x473d53(++_0x284158);}(_0x8a5c,0x112));var _0xc8a5=function(_0x5b8e07,_0x2a112f){_0x5b8e07=_0x5b8e07-0x0;var _0x1610bf=_0x8a5c[_0x5b8e07];return _0x1610bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8a5('0x0'));var zipdir=require(_0xc8a5('0x1'));var jsonpatch=require(_0xc8a5('0x2'));var rp=require(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc8a5('0x5'));var util=require(_0xc8a5('0x6'));var path=require('path');var sox=require(_0xc8a5('0x7'));var csv=require('to-csv');var ejs=require(_0xc8a5('0x8'));var fs=require('fs');var fs_extra=require(_0xc8a5('0x9'));var _=require(_0xc8a5('0xa'));var squel=require(_0xc8a5('0xb'));var crypto=require(_0xc8a5('0xc'));var jsforce=require(_0xc8a5('0xd'));var deskjs=require(_0xc8a5('0xe'));var toCsv=require(_0xc8a5('0xf'));var querystring=require(_0xc8a5('0x10'));var Papa=require(_0xc8a5('0x11'));var Redis=require(_0xc8a5('0x12'));var authService=require(_0xc8a5('0x13'));var qs=require(_0xc8a5('0x14'));var as=require(_0xc8a5('0x15'));var hardwareService=require(_0xc8a5('0x16'));var logger=require(_0xc8a5('0x17'))(_0xc8a5('0x18'));var utils=require(_0xc8a5('0x19'));var config=require(_0xc8a5('0x1a'));var licenseUtil=require(_0xc8a5('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xed43c2,_0x53df4a){_0x53df4a=_0x53df4a||0xcc;return function(_0x20e4cf){if(_0x20e4cf){return _0xed43c2[_0xc8a5('0x1c')](_0x53df4a);}return _0xed43c2['status'](_0x53df4a)[_0xc8a5('0x1d')]();};}function respondWithResult(_0x596680,_0x563a4a){_0x563a4a=_0x563a4a||0xc8;return function(_0x4d19bc){if(_0x4d19bc){return _0x596680[_0xc8a5('0x1e')](_0x563a4a)['json'](_0x4d19bc);}};}function respondWithFilteredResult(_0x29fdb3,_0xdb0d5d){return function(_0x4637fd){if(_0x4637fd){var _0x2de1af=typeof _0xdb0d5d[_0xc8a5('0x1f')]===_0xc8a5('0x20')&&typeof _0xdb0d5d[_0xc8a5('0x21')]===_0xc8a5('0x20');var _0x15e97b=_0x4637fd[_0xc8a5('0x22')];var _0x1dc268=_0x2de1af?0x0:_0xdb0d5d[_0xc8a5('0x1f')];var _0x2c9bba=_0x2de1af?_0x4637fd[_0xc8a5('0x22')]:_0xdb0d5d['offset']+_0xdb0d5d[_0xc8a5('0x21')];var _0x532962;if(_0x2c9bba>=_0x15e97b){_0x2c9bba=_0x15e97b;_0x532962=0xc8;}else{_0x532962=0xce;}_0x29fdb3['status'](_0x532962);return _0x29fdb3[_0xc8a5('0x23')](_0xc8a5('0x24'),_0x1dc268+'-'+_0x2c9bba+'/'+_0x15e97b)[_0xc8a5('0x25')](_0x4637fd);}return null;};}function patchUpdates(_0x43ba3e){return function(_0x3a52ef){try{jsonpatch[_0xc8a5('0x26')](_0x3a52ef,_0x43ba3e,!![]);}catch(_0x2f5c8c){return BPromise[_0xc8a5('0x27')](_0x2f5c8c);}return _0x3a52ef[_0xc8a5('0x28')]();};}function saveUpdates(_0x19217c,_0x4761c3){return function(_0x549249){if(_0x549249){return _0x549249[_0xc8a5('0x29')](_0x19217c)[_0xc8a5('0x2a')](function(_0x22c10d){return _0x22c10d;});}return null;};}function removeEntity(_0x27dea3,_0x417f7f){return function(_0x5e68c1){if(_0x5e68c1){return _0x5e68c1[_0xc8a5('0x2b')]()[_0xc8a5('0x2a')](function(){_0x27dea3[_0xc8a5('0x1e')](0xcc)[_0xc8a5('0x1d')]();});}};}function handleEntityNotFound(_0x57cbcf,_0x209f12){return function(_0xe7289d){if(!_0xe7289d){_0x57cbcf[_0xc8a5('0x1c')](0x194);}return _0xe7289d;};}function handleError(_0x3903de,_0x70aca5){_0x70aca5=_0x70aca5||0x1f4;return function(_0x1922fd){logger[_0xc8a5('0x2c')](_0x1922fd[_0xc8a5('0x2d')]);if(_0x1922fd[_0xc8a5('0x2e')]){delete _0x1922fd[_0xc8a5('0x2e')];}_0x3903de['status'](_0x70aca5)['send'](_0x1922fd);};}exports['index']=function(_0x2aa7eb,_0x109b1f){var _0x133e42={},_0x2fe38b={},_0x545e9e={'count':0x0,'rows':[]};var _0x562090=_[_0xc8a5('0x2f')](db[_0xc8a5('0x30')]['rawAttributes'],function(_0x55be1d){return{'name':_0x55be1d[_0xc8a5('0x31')],'type':_0x55be1d[_0xc8a5('0x32')][_0xc8a5('0x33')]};});_0x2fe38b['model']=_[_0xc8a5('0x2f')](_0x562090,_0xc8a5('0x2e'));_0x2fe38b['query']=_[_0xc8a5('0x34')](_0x2aa7eb[_0xc8a5('0x35')]);_0x2fe38b['filters']=_[_0xc8a5('0x36')](_0x2fe38b[_0xc8a5('0x37')],_0x2fe38b[_0xc8a5('0x35')]);_0x133e42[_0xc8a5('0x38')]=_[_0xc8a5('0x36')](_0x2fe38b[_0xc8a5('0x37')],qs[_0xc8a5('0x39')](_0x2aa7eb[_0xc8a5('0x35')]['fields']));_0x133e42[_0xc8a5('0x38')]=_0x133e42[_0xc8a5('0x38')][_0xc8a5('0x3a')]?_0x133e42['attributes']:_0x2fe38b[_0xc8a5('0x37')];if(!_0x2aa7eb[_0xc8a5('0x35')]['hasOwnProperty'](_0xc8a5('0x3b'))){_0x133e42['limit']=qs[_0xc8a5('0x21')](_0x2aa7eb['query']['limit']);_0x133e42[_0xc8a5('0x1f')]=qs[_0xc8a5('0x1f')](_0x2aa7eb[_0xc8a5('0x35')][_0xc8a5('0x1f')]);}_0x133e42['order']=qs[_0xc8a5('0x3c')](_0x2aa7eb[_0xc8a5('0x35')][_0xc8a5('0x3c')]);_0x133e42[_0xc8a5('0x3d')]=qs[_0xc8a5('0x3e')](_[_0xc8a5('0x3f')](_0x2aa7eb[_0xc8a5('0x35')],_0x2fe38b[_0xc8a5('0x3e')]),_0x562090);if(_0x2aa7eb[_0xc8a5('0x35')][_0xc8a5('0x40')]){_0x133e42[_0xc8a5('0x3d')]=_[_0xc8a5('0x41')](_0x133e42[_0xc8a5('0x3d')],{'$or':_['map'](_0x562090,function(_0x3ed0f2){if(_0x3ed0f2['type']!==_0xc8a5('0x42')){var _0x1f4c0a={};_0x1f4c0a[_0x3ed0f2[_0xc8a5('0x2e')]]={'$like':'%'+_0x2aa7eb[_0xc8a5('0x35')][_0xc8a5('0x40')]+'%'};return _0x1f4c0a;}})});}_0x133e42=_[_0xc8a5('0x41')]({},_0x133e42,_0x2aa7eb[_0xc8a5('0x43')]);var _0x2e675c={'where':_0x133e42[_0xc8a5('0x3d')]};return db['ChatQueueReport']['count'](_0x2e675c)[_0xc8a5('0x2a')](function(_0x175695){_0x545e9e[_0xc8a5('0x22')]=_0x175695;if(_0x2aa7eb[_0xc8a5('0x35')]['includeAll']){_0x133e42[_0xc8a5('0x44')]=[{'all':!![]}];}return db[_0xc8a5('0x30')][_0xc8a5('0x45')](_0x133e42);})[_0xc8a5('0x2a')](function(_0x3d4aeb){_0x545e9e[_0xc8a5('0x46')]=_0x3d4aeb;return _0x545e9e;})[_0xc8a5('0x2a')](respondWithFilteredResult(_0x109b1f,_0x133e42))[_0xc8a5('0x47')](handleError(_0x109b1f,null));};exports[_0xc8a5('0x48')]=function(_0x3d6dc2,_0x4340e7){var _0x57f3a1={'raw':!![],'where':{'id':_0x3d6dc2[_0xc8a5('0x49')]['id']}},_0x274c3b={};_0x274c3b[_0xc8a5('0x37')]=_['keys'](db[_0xc8a5('0x30')][_0xc8a5('0x4a')]);_0x274c3b[_0xc8a5('0x35')]=_[_0xc8a5('0x34')](_0x3d6dc2[_0xc8a5('0x35')]);_0x274c3b[_0xc8a5('0x3e')]=_[_0xc8a5('0x36')](_0x274c3b['model'],_0x274c3b[_0xc8a5('0x35')]);_0x57f3a1[_0xc8a5('0x38')]=_['intersection'](_0x274c3b['model'],qs[_0xc8a5('0x39')](_0x3d6dc2[_0xc8a5('0x35')][_0xc8a5('0x39')]));_0x57f3a1[_0xc8a5('0x38')]=_0x57f3a1[_0xc8a5('0x38')][_0xc8a5('0x3a')]?_0x57f3a1[_0xc8a5('0x38')]:_0x274c3b[_0xc8a5('0x37')];if(_0x3d6dc2[_0xc8a5('0x35')][_0xc8a5('0x4b')]){_0x57f3a1[_0xc8a5('0x44')]=[{'all':!![]}];}_0x57f3a1=_[_0xc8a5('0x41')]({},_0x57f3a1,_0x3d6dc2[_0xc8a5('0x43')]);return db[_0xc8a5('0x30')]['find'](_0x57f3a1)[_0xc8a5('0x2a')](handleEntityNotFound(_0x4340e7,null))['then'](respondWithResult(_0x4340e7,null))[_0xc8a5('0x47')](handleError(_0x4340e7,null));};exports[_0xc8a5('0x4c')]=function(_0x9ffbb4,_0x1fdba0){return db[_0xc8a5('0x30')]['create'](_0x9ffbb4[_0xc8a5('0x4d')],{})['then'](respondWithResult(_0x1fdba0,0xc9))['catch'](handleError(_0x1fdba0,null));};exports[_0xc8a5('0x29')]=function(_0x537b9c,_0x11c962){if(_0x537b9c[_0xc8a5('0x4d')]['id']){delete _0x537b9c[_0xc8a5('0x4d')]['id'];}return db[_0xc8a5('0x30')][_0xc8a5('0x4e')]({'where':{'id':_0x537b9c[_0xc8a5('0x49')]['id']}})['then'](handleEntityNotFound(_0x11c962,null))[_0xc8a5('0x2a')](saveUpdates(_0x537b9c[_0xc8a5('0x4d')],null))[_0xc8a5('0x2a')](respondWithResult(_0x11c962,null))[_0xc8a5('0x47')](handleError(_0x11c962,null));};exports[_0xc8a5('0x2b')]=function(_0xd57a7e,_0x4b91c9){return db[_0xc8a5('0x30')]['find']({'where':{'id':_0xd57a7e[_0xc8a5('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b91c9,null))[_0xc8a5('0x2a')](removeEntity(_0x4b91c9,null))[_0xc8a5('0x47')](handleError(_0x4b91c9,null));};exports[_0xc8a5('0x4f')]=function(_0x3c3f51,_0x3ebffd){return db['ChatQueueReport'][_0xc8a5('0x4f')]()[_0xc8a5('0x2a')](respondWithResult(_0x3ebffd,null))[_0xc8a5('0x47')](handleError(_0x3ebffd,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c93f5b5..f963228 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1c09cd,_0x1ebc27){var _0x262877=function(_0xca6e96){while(--_0xca6e96){_0x1c09cd['push'](_0x1c09cd['shift']());}};_0x262877(++_0x1ebc27);}(_0x757a,0xde));var _0xa757=function(_0x1675f7,_0x34a548){_0x1675f7=_0x1675f7-0x0;var _0x5bc972=_0x757a[_0x1675f7];return _0x5bc972;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3f603d,_0x44651d){var _0x109a8b=function(_0x112133){while(--_0x112133){_0x3f603d['push'](_0x3f603d['shift']());}};_0x109a8b(++_0x44651d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 237a19f..acc3882 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 _0x88ef=['where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport'];(function(_0x4dd373,_0x122f3a){var _0x468744=function(_0x5069eb){while(--_0x5069eb){_0x4dd373['push'](_0x4dd373['shift']());}};_0x468744(++_0x122f3a);}(_0x88ef,0xea));var _0xf88e=function(_0x4ad218,_0x32e57f){_0x4ad218=_0x4ad218-0x0;var _0x1991c5=_0x88ef[_0x4ad218];return _0x1991c5;};'use strict';var _=require('lodash');var util=require(_0xf88e('0x0'));var moment=require(_0xf88e('0x1'));var BPromise=require(_0xf88e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf88e('0x3'));var db=require(_0xf88e('0x4'))['db'];var utils=require(_0xf88e('0x5'));var logger=require(_0xf88e('0x6'))(_0xf88e('0x7'));var config=require(_0xf88e('0x8'));var jayson=require(_0xf88e('0x9'));var client=jayson[_0xf88e('0xa')][_0xf88e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31fd93,_0x21f3fd,_0xfca89d){return new BPromise(function(_0x33d312,_0x4908f){return client[_0xf88e('0xc')](_0x31fd93,_0xfca89d)[_0xf88e('0xd')](function(_0x29fd05){logger['info'](_0xf88e('0xe'),_0x21f3fd,'request\x20sent');logger[_0xf88e('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x21f3fd,_0xf88e('0x10'),JSON[_0xf88e('0x11')](_0x29fd05));if(_0x29fd05['error']){if(_0x29fd05[_0xf88e('0x12')][_0xf88e('0x13')]===0x1f4){logger[_0xf88e('0x12')](_0xf88e('0xe'),_0x21f3fd,_0x29fd05[_0xf88e('0x12')][_0xf88e('0x14')]);return _0x4908f(_0x29fd05['error']['message']);}logger['error'](_0xf88e('0xe'),_0x21f3fd,_0x29fd05[_0xf88e('0x12')][_0xf88e('0x14')]);return _0x33d312(_0x29fd05[_0xf88e('0x12')][_0xf88e('0x14')]);}else{logger[_0xf88e('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x21f3fd,_0xf88e('0x10'));_0x33d312(_0x29fd05[_0xf88e('0x16')][_0xf88e('0x14')]);}})[_0xf88e('0x17')](function(_0x4ecd51){logger['error'](_0xf88e('0xe'),_0x21f3fd,_0x4ecd51);_0x4908f(_0x4ecd51);});});}exports[_0xf88e('0x18')]=function(_0x590cb2){var _0x543796=this;return new Promise(function(_0x1509f1,_0x83da9b){return db[_0xf88e('0x19')][_0xf88e('0x1a')](_0x590cb2[_0xf88e('0x1b')],{'raw':_0x590cb2['options']?_0x590cb2[_0xf88e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5eb1aa){logger['info'](_0xf88e('0x18'),_0x590cb2);logger[_0xf88e('0xf')]('CreateChatQueueReport',_0x590cb2,JSON[_0xf88e('0x11')](_0x5eb1aa));_0x1509f1(_0x5eb1aa);})[_0xf88e('0x17')](function(_0x5149ba){logger[_0xf88e('0x12')](_0xf88e('0x18'),_0x5149ba[_0xf88e('0x14')],_0x590cb2);_0x83da9b(_0x543796['error'](0x1f4,_0x5149ba['message']));});});};exports[_0xf88e('0x1d')]=function(_0x44e2bd){var _0x876aa8=this;return new Promise(function(_0x3aede5,_0x73b647){return db[_0xf88e('0x19')]['update'](_0x44e2bd['body'],{'raw':_0x44e2bd[_0xf88e('0x1c')]?_0x44e2bd[_0xf88e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44e2bd[_0xf88e('0x1c')]?_0x44e2bd[_0xf88e('0x1c')][_0xf88e('0x1e')]||null:null,'attributes':_0x44e2bd[_0xf88e('0x1c')]?_0x44e2bd[_0xf88e('0x1c')][_0xf88e('0x1f')]||null:null,'limit':_0x44e2bd[_0xf88e('0x1c')]?_0x44e2bd[_0xf88e('0x1c')][_0xf88e('0x20')]||null:null})[_0xf88e('0xd')](function(_0x24a495){logger[_0xf88e('0x15')](_0xf88e('0x1d'),_0x44e2bd);logger[_0xf88e('0xf')]('UpdateChatQueueReport',_0x44e2bd,JSON[_0xf88e('0x11')](_0x24a495));_0x3aede5(_0x24a495);})['catch'](function(_0x4ab40b){logger['error']('UpdateChatQueueReport',_0x4ab40b[_0xf88e('0x14')],_0x44e2bd);_0x73b647(_0x876aa8[_0xf88e('0x12')](0x1f4,_0x4ab40b[_0xf88e('0x14')]));});});}; \ No newline at end of file +var _0x7f4b=['create','body','options','CreateChatQueueReport','UpdateChatQueueReport','raw','stringify','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','ChatQueueReport'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7f4b,0x1d2));var _0xb7f4=function(_0x3083d0,_0x4998ef){_0x3083d0=_0x3083d0-0x0;var _0x3abb1c=_0x7f4b[_0x3083d0];return _0x3abb1c;};'use strict';var _=require(_0xb7f4('0x0'));var util=require(_0xb7f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb7f4('0x2'));var fs=require('fs');var Redis=require(_0xb7f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb7f4('0x4'))(_0xb7f4('0x5'));var config=require(_0xb7f4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb7f4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bb17a,_0x395042,_0x363de5){return new BPromise(function(_0x22568f,_0x546f20){return client['request'](_0x2bb17a,_0x363de5)[_0xb7f4('0x8')](function(_0x529dff){logger[_0xb7f4('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x395042,'request\x20sent');logger[_0xb7f4('0xa')](_0xb7f4('0xb'),_0x395042,_0xb7f4('0xc'),JSON['stringify'](_0x529dff));if(_0x529dff[_0xb7f4('0xd')]){if(_0x529dff[_0xb7f4('0xd')][_0xb7f4('0xe')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x395042,_0x529dff[_0xb7f4('0xd')][_0xb7f4('0xf')]);return _0x546f20(_0x529dff[_0xb7f4('0xd')][_0xb7f4('0xf')]);}logger[_0xb7f4('0xd')](_0xb7f4('0x10'),_0x395042,_0x529dff['error'][_0xb7f4('0xf')]);return _0x22568f(_0x529dff[_0xb7f4('0xd')][_0xb7f4('0xf')]);}else{logger[_0xb7f4('0x9')](_0xb7f4('0x10'),_0x395042,'request\x20sent');_0x22568f(_0x529dff[_0xb7f4('0x11')][_0xb7f4('0xf')]);}})[_0xb7f4('0x12')](function(_0x55f4f1){logger[_0xb7f4('0xd')](_0xb7f4('0x10'),_0x395042,_0x55f4f1);_0x546f20(_0x55f4f1);});});}exports['CreateChatQueueReport']=function(_0x472228){var _0x3e9bea=this;return new Promise(function(_0x4addbb,_0x2ccdae){return db[_0xb7f4('0x13')][_0xb7f4('0x14')](_0x472228[_0xb7f4('0x15')],{'raw':_0x472228[_0xb7f4('0x16')]?_0x472228['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a921a){logger[_0xb7f4('0x9')]('CreateChatQueueReport',_0x472228);logger[_0xb7f4('0xa')]('CreateChatQueueReport',_0x472228,JSON['stringify'](_0x4a921a));_0x4addbb(_0x4a921a);})[_0xb7f4('0x12')](function(_0x3143f6){logger[_0xb7f4('0xd')](_0xb7f4('0x17'),_0x3143f6['message'],_0x472228);_0x2ccdae(_0x3e9bea[_0xb7f4('0xd')](0x1f4,_0x3143f6[_0xb7f4('0xf')]));});});};exports[_0xb7f4('0x18')]=function(_0xed668c){var _0x3bf293=this;return new Promise(function(_0x4a84b7,_0x4a7caa){return db[_0xb7f4('0x13')]['update'](_0xed668c[_0xb7f4('0x15')],{'raw':_0xed668c[_0xb7f4('0x16')]?_0xed668c['options'][_0xb7f4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xed668c['options']?_0xed668c[_0xb7f4('0x16')]['where']||null:null,'attributes':_0xed668c['options']?_0xed668c[_0xb7f4('0x16')]['attributes']||null:null,'limit':_0xed668c['options']?_0xed668c[_0xb7f4('0x16')]['limit']||null:null})['then'](function(_0x238d1c){logger[_0xb7f4('0x9')](_0xb7f4('0x18'),_0xed668c);logger['debug']('UpdateChatQueueReport',_0xed668c,JSON[_0xb7f4('0x1a')](_0x238d1c));_0x4a84b7(_0x238d1c);})['catch'](function(_0xdb4c5b){logger[_0xb7f4('0xd')](_0xb7f4('0x18'),_0xdb4c5b[_0xb7f4('0xf')],_0xed668c);_0x4a7caa(_0x3bf293[_0xb7f4('0xd')](0x1f4,_0xdb4c5b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5045342..09f37a5 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 _0x7cd6=['create','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','index','get','/describe','isAuthenticated','/:id','show'];(function(_0x48b964,_0x491840){var _0x527277=function(_0x27bee6){while(--_0x27bee6){_0x48b964['push'](_0x48b964['shift']());}};_0x527277(++_0x491840);}(_0x7cd6,0x1d4));var _0x67cd=function(_0x1dbc76,_0x550bab){_0x1dbc76=_0x1dbc76-0x0;var _0x1daefd=_0x7cd6[_0x1dbc76];return _0x1daefd;};'use strict';var multer=require('multer');var util=require(_0x67cd('0x0'));var path=require(_0x67cd('0x1'));var timeout=require('connect-timeout');var express=require(_0x67cd('0x2'));var router=express[_0x67cd('0x3')]();var fs_extra=require(_0x67cd('0x4'));var auth=require(_0x67cd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x67cd('0x6')]);router[_0x67cd('0x7')](_0x67cd('0x8'),auth[_0x67cd('0x9')](),controller['describe']);router[_0x67cd('0x7')](_0x67cd('0xa'),auth[_0x67cd('0x9')](),controller[_0x67cd('0xb')]);router['post']('/',auth[_0x67cd('0x9')](),controller[_0x67cd('0xc')]);router['put'](_0x67cd('0xa'),auth[_0x67cd('0x9')](),controller[_0x67cd('0xd')]);router[_0x67cd('0xe')]('/:id',auth[_0x67cd('0x9')](),controller['destroy']);module[_0x67cd('0xf')]=router; \ No newline at end of file +var _0x5739=['./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23ef1f,_0x127dd2){var _0x234192=function(_0x2d83da){while(--_0x2d83da){_0x23ef1f['push'](_0x23ef1f['shift']());}};_0x234192(++_0x127dd2);}(_0x5739,0xb4));var _0x9573=function(_0x41b8a7,_0xe876d4){_0x41b8a7=_0x41b8a7-0x0;var _0x302d79=_0x5739[_0x41b8a7];return _0x302d79;};'use strict';var multer=require('multer');var util=require(_0x9573('0x0'));var path=require(_0x9573('0x1'));var timeout=require(_0x9573('0x2'));var express=require(_0x9573('0x3'));var router=express[_0x9573('0x4')]();var fs_extra=require(_0x9573('0x5'));var auth=require(_0x9573('0x6'));var interaction=require(_0x9573('0x7'));var config=require(_0x9573('0x8'));var controller=require(_0x9573('0x9'));router['get']('/',auth[_0x9573('0xa')](),controller[_0x9573('0xb')]);router[_0x9573('0xc')](_0x9573('0xd'),auth[_0x9573('0xa')](),controller[_0x9573('0xe')]);router[_0x9573('0xc')](_0x9573('0xf'),auth[_0x9573('0xa')](),controller[_0x9573('0x10')]);router['post']('/',auth[_0x9573('0xa')](),controller[_0x9573('0x11')]);router['put'](_0x9573('0xf'),auth[_0x9573('0xa')](),controller[_0x9573('0x12')]);router['delete']('/:id',auth[_0x9573('0xa')](),controller[_0x9573('0x13')]);module[_0x9573('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index addf029..49edc6b 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x42d45c,_0x49ac2a){var _0x1dff4f=function(_0x3f391a){while(--_0x3f391a){_0x42d45c['push'](_0x42d45c['shift']());}};_0x1dff4f(++_0x49ac2a);}(_0xedd9,0xfc));var _0x9edd=function(_0x21df16,_0x425313){_0x21df16=_0x21df16-0x0;var _0x3a06fb=_0xedd9[_0x21df16];return _0x3a06fb;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x4708e9,_0x15b9b6){var _0x3e6218=function(_0x30171b){while(--_0x30171b){_0x4708e9['push'](_0x4708e9['shift']());}};_0x3e6218(++_0x15b9b6);}(_0xe706,0xa3));var _0x6e70=function(_0x48ccc1,_0x55e9cb){_0x48ccc1=_0x48ccc1-0x0;var _0x9ffe13=_0xe706[_0x48ccc1];return _0x9ffe13;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2f517f5..e9ec396 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 _0x9a79=['pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x573348,_0x303090){var _0x32b200=function(_0x497487){while(--_0x497487){_0x573348['push'](_0x573348['shift']());}};_0x32b200(++_0x303090);}(_0x9a79,0x183));var _0x99a7=function(_0x3e27bf,_0x1351fa){_0x3e27bf=_0x3e27bf-0x0;var _0x3ddb4f=_0x9a79[_0x3e27bf];return _0x3ddb4f;};'use strict';var emlformat=require(_0x99a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99a7('0x1'));var jsonpatch=require(_0x99a7('0x2'));var rp=require(_0x99a7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x99a7('0x4'));var util=require('util');var path=require(_0x99a7('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x99a7('0x6'));var fs=require('fs');var fs_extra=require(_0x99a7('0x7'));var _=require('lodash');var squel=require(_0x99a7('0x8'));var crypto=require(_0x99a7('0x9'));var jsforce=require(_0x99a7('0xa'));var deskjs=require(_0x99a7('0xb'));var toCsv=require(_0x99a7('0xc'));var querystring=require(_0x99a7('0xd'));var Papa=require(_0x99a7('0xe'));var Redis=require(_0x99a7('0xf'));var authService=require(_0x99a7('0x10'));var qs=require(_0x99a7('0x11'));var as=require(_0x99a7('0x12'));var hardwareService=require(_0x99a7('0x13'));var logger=require(_0x99a7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x99a7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x99a7('0x16'))['db'];function respondWithStatusCode(_0x10a1c9,_0x527a03){_0x527a03=_0x527a03||0xcc;return function(_0x2f165b){if(_0x2f165b){return _0x10a1c9[_0x99a7('0x17')](_0x527a03);}return _0x10a1c9[_0x99a7('0x18')](_0x527a03)[_0x99a7('0x19')]();};}function respondWithResult(_0x31757e,_0xaa16fd){_0xaa16fd=_0xaa16fd||0xc8;return function(_0x471a66){if(_0x471a66){return _0x31757e[_0x99a7('0x18')](_0xaa16fd)[_0x99a7('0x1a')](_0x471a66);}};}function respondWithFilteredResult(_0x59f49f,_0x504b25){return function(_0x5d5749){if(_0x5d5749){var _0x365c72=typeof _0x504b25['offset']===_0x99a7('0x1b')&&typeof _0x504b25[_0x99a7('0x1c')]===_0x99a7('0x1b');var _0x50a3e7=_0x5d5749['count'];var _0x5aeee2=_0x365c72?0x0:_0x504b25[_0x99a7('0x1d')];var _0x2958a9=_0x365c72?_0x5d5749[_0x99a7('0x1e')]:_0x504b25['offset']+_0x504b25[_0x99a7('0x1c')];var _0x21cfa3;if(_0x2958a9>=_0x50a3e7){_0x2958a9=_0x50a3e7;_0x21cfa3=0xc8;}else{_0x21cfa3=0xce;}_0x59f49f[_0x99a7('0x18')](_0x21cfa3);return _0x59f49f[_0x99a7('0x1f')](_0x99a7('0x20'),_0x5aeee2+'-'+_0x2958a9+'/'+_0x50a3e7)[_0x99a7('0x1a')](_0x5d5749);}return null;};}function patchUpdates(_0x481fc7){return function(_0x23433b){try{jsonpatch[_0x99a7('0x21')](_0x23433b,_0x481fc7,!![]);}catch(_0x2043c0){return BPromise['reject'](_0x2043c0);}return _0x23433b['save']();};}function saveUpdates(_0x2a3a41,_0x210376){return function(_0x127c9f){if(_0x127c9f){return _0x127c9f[_0x99a7('0x22')](_0x2a3a41)[_0x99a7('0x23')](function(_0x10d0a9){return _0x10d0a9;});}return null;};}function removeEntity(_0x5c61cc,_0x4890e6){return function(_0x379f91){if(_0x379f91){return _0x379f91[_0x99a7('0x24')]()[_0x99a7('0x23')](function(){_0x5c61cc[_0x99a7('0x18')](0xcc)[_0x99a7('0x19')]();});}};}function handleEntityNotFound(_0x1b580f,_0x230849){return function(_0x181561){if(!_0x181561){_0x1b580f[_0x99a7('0x17')](0x194);}return _0x181561;};}function handleError(_0xb1e19c,_0x3344fe){_0x3344fe=_0x3344fe||0x1f4;return function(_0x51d2ac){logger[_0x99a7('0x25')](_0x51d2ac[_0x99a7('0x26')]);if(_0x51d2ac[_0x99a7('0x27')]){delete _0x51d2ac[_0x99a7('0x27')];}_0xb1e19c[_0x99a7('0x18')](_0x3344fe)['send'](_0x51d2ac);};}exports[_0x99a7('0x28')]=function(_0x51650f,_0x55d36e){var _0x47d304={},_0x442051={},_0x41ce98={'count':0x0,'rows':[]};var _0x3f58d3=_[_0x99a7('0x29')](db[_0x99a7('0x2a')][_0x99a7('0x2b')],function(_0x3fb59f){return{'name':_0x3fb59f['fieldName'],'type':_0x3fb59f[_0x99a7('0x2c')][_0x99a7('0x2d')]};});_0x442051[_0x99a7('0x2e')]=_['map'](_0x3f58d3,'name');_0x442051[_0x99a7('0x2f')]=_['keys'](_0x51650f['query']);_0x442051['filters']=_[_0x99a7('0x30')](_0x442051[_0x99a7('0x2e')],_0x442051[_0x99a7('0x2f')]);_0x47d304[_0x99a7('0x31')]=_[_0x99a7('0x30')](_0x442051[_0x99a7('0x2e')],qs[_0x99a7('0x32')](_0x51650f[_0x99a7('0x2f')][_0x99a7('0x32')]));_0x47d304[_0x99a7('0x31')]=_0x47d304[_0x99a7('0x31')][_0x99a7('0x33')]?_0x47d304[_0x99a7('0x31')]:_0x442051[_0x99a7('0x2e')];if(!_0x51650f[_0x99a7('0x2f')][_0x99a7('0x34')](_0x99a7('0x35'))){_0x47d304[_0x99a7('0x1c')]=qs[_0x99a7('0x1c')](_0x51650f[_0x99a7('0x2f')]['limit']);_0x47d304[_0x99a7('0x1d')]=qs[_0x99a7('0x1d')](_0x51650f['query'][_0x99a7('0x1d')]);}_0x47d304[_0x99a7('0x36')]=qs['sort'](_0x51650f[_0x99a7('0x2f')][_0x99a7('0x37')]);_0x47d304[_0x99a7('0x38')]=qs['filters'](_[_0x99a7('0x39')](_0x51650f[_0x99a7('0x2f')],_0x442051[_0x99a7('0x3a')]),_0x3f58d3);if(_0x51650f[_0x99a7('0x2f')][_0x99a7('0x3b')]){_0x47d304[_0x99a7('0x38')]=_[_0x99a7('0x3c')](_0x47d304[_0x99a7('0x38')],{'$or':_['map'](_0x3f58d3,function(_0x34e481){if(_0x34e481['type']!==_0x99a7('0x3d')){var _0xc38799={};_0xc38799[_0x34e481[_0x99a7('0x27')]]={'$like':'%'+_0x51650f[_0x99a7('0x2f')]['filter']+'%'};return _0xc38799;}})});}_0x47d304=_[_0x99a7('0x3c')]({},_0x47d304,_0x51650f['options']);var _0x3b64c4={'where':_0x47d304[_0x99a7('0x38')]};return db[_0x99a7('0x2a')]['count'](_0x3b64c4)[_0x99a7('0x23')](function(_0x6928c0){_0x41ce98[_0x99a7('0x1e')]=_0x6928c0;if(_0x51650f[_0x99a7('0x2f')][_0x99a7('0x3e')]){_0x47d304[_0x99a7('0x3f')]=[{'all':!![]}];}return db[_0x99a7('0x2a')][_0x99a7('0x40')](_0x47d304);})[_0x99a7('0x23')](function(_0x4d3e5e){_0x41ce98['rows']=_0x4d3e5e;return _0x41ce98;})[_0x99a7('0x23')](respondWithFilteredResult(_0x55d36e,_0x47d304))[_0x99a7('0x41')](handleError(_0x55d36e,null));};exports[_0x99a7('0x42')]=function(_0x542c97,_0x3f3c5f){var _0x290d6f={'raw':!![],'where':{'id':_0x542c97['params']['id']}},_0x1b364f={};_0x1b364f['model']=_[_0x99a7('0x43')](db[_0x99a7('0x2a')][_0x99a7('0x2b')]);_0x1b364f[_0x99a7('0x2f')]=_[_0x99a7('0x43')](_0x542c97[_0x99a7('0x2f')]);_0x1b364f['filters']=_[_0x99a7('0x30')](_0x1b364f[_0x99a7('0x2e')],_0x1b364f[_0x99a7('0x2f')]);_0x290d6f[_0x99a7('0x31')]=_['intersection'](_0x1b364f['model'],qs[_0x99a7('0x32')](_0x542c97[_0x99a7('0x2f')]['fields']));_0x290d6f[_0x99a7('0x31')]=_0x290d6f['attributes'][_0x99a7('0x33')]?_0x290d6f[_0x99a7('0x31')]:_0x1b364f[_0x99a7('0x2e')];if(_0x542c97[_0x99a7('0x2f')][_0x99a7('0x3e')]){_0x290d6f[_0x99a7('0x3f')]=[{'all':!![]}];}_0x290d6f=_[_0x99a7('0x3c')]({},_0x290d6f,_0x542c97[_0x99a7('0x44')]);return db[_0x99a7('0x2a')][_0x99a7('0x45')](_0x290d6f)['then'](handleEntityNotFound(_0x3f3c5f,null))[_0x99a7('0x23')](respondWithResult(_0x3f3c5f,null))['catch'](handleError(_0x3f3c5f,null));};exports[_0x99a7('0x46')]=function(_0x696e21,_0x15cbf5){return db[_0x99a7('0x2a')][_0x99a7('0x46')](_0x696e21[_0x99a7('0x47')],{})[_0x99a7('0x23')](respondWithResult(_0x15cbf5,0xc9))[_0x99a7('0x41')](handleError(_0x15cbf5,null));};exports[_0x99a7('0x22')]=function(_0x75a662,_0x54bba9){if(_0x75a662[_0x99a7('0x47')]['id']){delete _0x75a662[_0x99a7('0x47')]['id'];}return db[_0x99a7('0x2a')]['find']({'where':{'id':_0x75a662[_0x99a7('0x48')]['id']}})[_0x99a7('0x23')](handleEntityNotFound(_0x54bba9,null))[_0x99a7('0x23')](saveUpdates(_0x75a662[_0x99a7('0x47')],null))[_0x99a7('0x23')](respondWithResult(_0x54bba9,null))[_0x99a7('0x41')](handleError(_0x54bba9,null));};exports['destroy']=function(_0x298fe5,_0xce8932){return db[_0x99a7('0x2a')]['find']({'where':{'id':_0x298fe5[_0x99a7('0x48')]['id']}})[_0x99a7('0x23')](handleEntityNotFound(_0xce8932,null))['then'](removeEntity(_0xce8932,null))[_0x99a7('0x41')](handleError(_0xce8932,null));};exports[_0x99a7('0x49')]=function(_0x3b3282,_0x45982a){return db[_0x99a7('0x2a')][_0x99a7('0x49')]()[_0x99a7('0x23')](respondWithResult(_0x45982a,null))[_0x99a7('0x41')](handleError(_0x45982a,null));}; \ No newline at end of file +var _0x6688=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','sendStatus','error','stack','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','name','query','keys','filters','intersection','attributes','length','model','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','find','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0xefb36a,_0x2804b9){var _0x41ed7d=function(_0x1e7b71){while(--_0x1e7b71){_0xefb36a['push'](_0xefb36a['shift']());}};_0x41ed7d(++_0x2804b9);}(_0x6688,0x81));var _0x8668=function(_0x46d18c,_0x1d3076){_0x46d18c=_0x46d18c-0x0;var _0x5c242b=_0x6688[_0x46d18c];return _0x5c242b;};'use strict';var emlformat=require(_0x8668('0x0'));var rimraf=require(_0x8668('0x1'));var zipdir=require(_0x8668('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8668('0x3'));var moment=require(_0x8668('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8668('0x5'));var util=require(_0x8668('0x6'));var path=require(_0x8668('0x7'));var sox=require(_0x8668('0x8'));var csv=require(_0x8668('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8668('0xa'));var _=require('lodash');var squel=require(_0x8668('0xb'));var crypto=require(_0x8668('0xc'));var jsforce=require(_0x8668('0xd'));var deskjs=require(_0x8668('0xe'));var toCsv=require(_0x8668('0x9'));var querystring=require(_0x8668('0xf'));var Papa=require(_0x8668('0x10'));var Redis=require(_0x8668('0x11'));var authService=require(_0x8668('0x12'));var qs=require(_0x8668('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8668('0x14'));var logger=require(_0x8668('0x15'))('api');var utils=require(_0x8668('0x16'));var config=require(_0x8668('0x17'));var licenseUtil=require(_0x8668('0x18'));var db=require(_0x8668('0x19'))['db'];function respondWithStatusCode(_0x54af2c,_0x25d76c){_0x25d76c=_0x25d76c||0xcc;return function(_0xed99d){if(_0xed99d){return _0x54af2c['sendStatus'](_0x25d76c);}return _0x54af2c[_0x8668('0x1a')](_0x25d76c)[_0x8668('0x1b')]();};}function respondWithResult(_0x21eea6,_0x3cbe30){_0x3cbe30=_0x3cbe30||0xc8;return function(_0x4187ca){if(_0x4187ca){return _0x21eea6[_0x8668('0x1a')](_0x3cbe30)[_0x8668('0x1c')](_0x4187ca);}};}function respondWithFilteredResult(_0x3a25f4,_0x488ccc){return function(_0x274032){if(_0x274032){var _0xb82393=typeof _0x488ccc[_0x8668('0x1d')]===_0x8668('0x1e')&&typeof _0x488ccc[_0x8668('0x1f')]===_0x8668('0x1e');var _0x525e65=_0x274032[_0x8668('0x20')];var _0x59e977=_0xb82393?0x0:_0x488ccc[_0x8668('0x1d')];var _0x52d969=_0xb82393?_0x274032[_0x8668('0x20')]:_0x488ccc[_0x8668('0x1d')]+_0x488ccc['limit'];var _0x4a751e;if(_0x52d969>=_0x525e65){_0x52d969=_0x525e65;_0x4a751e=0xc8;}else{_0x4a751e=0xce;}_0x3a25f4[_0x8668('0x1a')](_0x4a751e);return _0x3a25f4['set'](_0x8668('0x21'),_0x59e977+'-'+_0x52d969+'/'+_0x525e65)[_0x8668('0x1c')](_0x274032);}return null;};}function patchUpdates(_0x4b4b6a){return function(_0x1fa676){try{jsonpatch[_0x8668('0x22')](_0x1fa676,_0x4b4b6a,!![]);}catch(_0x1cf1f3){return BPromise[_0x8668('0x23')](_0x1cf1f3);}return _0x1fa676[_0x8668('0x24')]();};}function saveUpdates(_0x3410ca,_0x3c0750){return function(_0x3974ba){if(_0x3974ba){return _0x3974ba['update'](_0x3410ca)[_0x8668('0x25')](function(_0x1a7fe0){return _0x1a7fe0;});}return null;};}function removeEntity(_0x3f71b1,_0x410f74){return function(_0xc1cc65){if(_0xc1cc65){return _0xc1cc65['destroy']()[_0x8668('0x25')](function(){_0x3f71b1[_0x8668('0x1a')](0xcc)[_0x8668('0x1b')]();});}};}function handleEntityNotFound(_0x36fda1,_0x185bf1){return function(_0x5b79ee){if(!_0x5b79ee){_0x36fda1[_0x8668('0x26')](0x194);}return _0x5b79ee;};}function handleError(_0xdff7db,_0x5e01da){_0x5e01da=_0x5e01da||0x1f4;return function(_0x4e17a1){logger[_0x8668('0x27')](_0x4e17a1[_0x8668('0x28')]);if(_0x4e17a1['name']){delete _0x4e17a1['name'];}_0xdff7db['status'](_0x5e01da)[_0x8668('0x29')](_0x4e17a1);};}exports[_0x8668('0x2a')]=function(_0x73ab74,_0x27b2ca){var _0x4df97d={},_0x2e2c47={},_0x4cf010={'count':0x0,'rows':[]};var _0x3554e9=_[_0x8668('0x2b')](db[_0x8668('0x2c')][_0x8668('0x2d')],function(_0x5ce57a){return{'name':_0x5ce57a[_0x8668('0x2e')],'type':_0x5ce57a[_0x8668('0x2f')]['key']};});_0x2e2c47['model']=_[_0x8668('0x2b')](_0x3554e9,_0x8668('0x30'));_0x2e2c47[_0x8668('0x31')]=_[_0x8668('0x32')](_0x73ab74[_0x8668('0x31')]);_0x2e2c47[_0x8668('0x33')]=_['intersection'](_0x2e2c47['model'],_0x2e2c47['query']);_0x4df97d['attributes']=_[_0x8668('0x34')](_0x2e2c47['model'],qs['fields'](_0x73ab74[_0x8668('0x31')]['fields']));_0x4df97d[_0x8668('0x35')]=_0x4df97d['attributes'][_0x8668('0x36')]?_0x4df97d[_0x8668('0x35')]:_0x2e2c47[_0x8668('0x37')];if(!_0x73ab74[_0x8668('0x31')]['hasOwnProperty'](_0x8668('0x38'))){_0x4df97d[_0x8668('0x1f')]=qs[_0x8668('0x1f')](_0x73ab74[_0x8668('0x31')][_0x8668('0x1f')]);_0x4df97d[_0x8668('0x1d')]=qs[_0x8668('0x1d')](_0x73ab74[_0x8668('0x31')][_0x8668('0x1d')]);}_0x4df97d[_0x8668('0x39')]=qs[_0x8668('0x3a')](_0x73ab74['query'][_0x8668('0x3a')]);_0x4df97d['where']=qs[_0x8668('0x33')](_['pick'](_0x73ab74['query'],_0x2e2c47['filters']),_0x3554e9);if(_0x73ab74[_0x8668('0x31')]['filter']){_0x4df97d[_0x8668('0x3b')]=_['merge'](_0x4df97d[_0x8668('0x3b')],{'$or':_[_0x8668('0x2b')](_0x3554e9,function(_0x4d828b){if(_0x4d828b[_0x8668('0x2f')]!==_0x8668('0x3c')){var _0x67a554={};_0x67a554[_0x4d828b[_0x8668('0x30')]]={'$like':'%'+_0x73ab74[_0x8668('0x31')][_0x8668('0x3d')]+'%'};return _0x67a554;}})});}_0x4df97d=_[_0x8668('0x3e')]({},_0x4df97d,_0x73ab74[_0x8668('0x3f')]);var _0x24352a={'where':_0x4df97d[_0x8668('0x3b')]};return db[_0x8668('0x2c')][_0x8668('0x20')](_0x24352a)['then'](function(_0x2ef8ab){_0x4cf010['count']=_0x2ef8ab;if(_0x73ab74[_0x8668('0x31')][_0x8668('0x40')]){_0x4df97d['include']=[{'all':!![]}];}return db[_0x8668('0x2c')][_0x8668('0x41')](_0x4df97d);})[_0x8668('0x25')](function(_0x7dcee){_0x4cf010[_0x8668('0x42')]=_0x7dcee;return _0x4cf010;})[_0x8668('0x25')](respondWithFilteredResult(_0x27b2ca,_0x4df97d))[_0x8668('0x43')](handleError(_0x27b2ca,null));};exports[_0x8668('0x44')]=function(_0x46db59,_0xb8cef){var _0x333570={'raw':!![],'where':{'id':_0x46db59[_0x8668('0x45')]['id']}},_0x4741f2={};_0x4741f2[_0x8668('0x37')]=_[_0x8668('0x32')](db[_0x8668('0x2c')][_0x8668('0x2d')]);_0x4741f2[_0x8668('0x31')]=_[_0x8668('0x32')](_0x46db59['query']);_0x4741f2['filters']=_[_0x8668('0x34')](_0x4741f2[_0x8668('0x37')],_0x4741f2['query']);_0x333570['attributes']=_[_0x8668('0x34')](_0x4741f2['model'],qs['fields'](_0x46db59[_0x8668('0x31')][_0x8668('0x46')]));_0x333570['attributes']=_0x333570[_0x8668('0x35')][_0x8668('0x36')]?_0x333570[_0x8668('0x35')]:_0x4741f2['model'];if(_0x46db59[_0x8668('0x31')][_0x8668('0x40')]){_0x333570[_0x8668('0x47')]=[{'all':!![]}];}_0x333570=_[_0x8668('0x3e')]({},_0x333570,_0x46db59[_0x8668('0x3f')]);return db[_0x8668('0x2c')][_0x8668('0x48')](_0x333570)[_0x8668('0x25')](handleEntityNotFound(_0xb8cef,null))[_0x8668('0x25')](respondWithResult(_0xb8cef,null))[_0x8668('0x43')](handleError(_0xb8cef,null));};exports['create']=function(_0x1eaecb,_0x53cbc3){return db[_0x8668('0x2c')]['create'](_0x1eaecb[_0x8668('0x49')],{})[_0x8668('0x25')](respondWithResult(_0x53cbc3,0xc9))['catch'](handleError(_0x53cbc3,null));};exports[_0x8668('0x4a')]=function(_0x31917c,_0x555a9f){if(_0x31917c[_0x8668('0x49')]['id']){delete _0x31917c[_0x8668('0x49')]['id'];}return db[_0x8668('0x2c')]['find']({'where':{'id':_0x31917c[_0x8668('0x45')]['id']}})[_0x8668('0x25')](handleEntityNotFound(_0x555a9f,null))['then'](saveUpdates(_0x31917c[_0x8668('0x49')],null))['then'](respondWithResult(_0x555a9f,null))[_0x8668('0x43')](handleError(_0x555a9f,null));};exports['destroy']=function(_0x4ab59c,_0x258ea5){return db['ChatTransferReport'][_0x8668('0x48')]({'where':{'id':_0x4ab59c[_0x8668('0x45')]['id']}})['then'](handleEntityNotFound(_0x258ea5,null))['then'](removeEntity(_0x258ea5,null))[_0x8668('0x43')](handleError(_0x258ea5,null));};exports[_0x8668('0x4b')]=function(_0x381cbd,_0x22c362){return db[_0x8668('0x2c')]['describe']()[_0x8668('0x25')](respondWithResult(_0x22c362,null))[_0x8668('0x43')](handleError(_0x22c362,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 166cc32..ba0273d 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 _0xfc7b=['request-promise','path','rimraf','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x4b136a,_0xa8310c){var _0x51a36b=function(_0x35970e){while(--_0x35970e){_0x4b136a['push'](_0x4b136a['shift']());}};_0x51a36b(++_0xa8310c);}(_0xfc7b,0x140));var _0xbfc7=function(_0x593467,_0x14e615){_0x593467=_0x593467-0x0;var _0x67a71b=_0xfc7b[_0x593467];return _0x67a71b;};'use strict';var _=require(_0xbfc7('0x0'));var util=require(_0xbfc7('0x1'));var logger=require(_0xbfc7('0x2'))(_0xbfc7('0x3'));var moment=require('moment');var BPromise=require(_0xbfc7('0x4'));var rp=require(_0xbfc7('0x5'));var fs=require('fs');var path=require(_0xbfc7('0x6'));var rimraf=require(_0xbfc7('0x7'));var config=require('../../config/environment');var attributes=require(_0xbfc7('0x8'));module[_0xbfc7('0x9')]=function(_0xe8fe35,_0x2ac233){return _0xe8fe35[_0xbfc7('0xa')]('ChatTransferReport',attributes,{'tableName':_0xbfc7('0xb'),'paranoid':![],'indexes':[{'name':_0xbfc7('0xc'),'fields':[_0xbfc7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf550=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xc25b80,_0x2eb958){var _0x5a7955=function(_0x18a979){while(--_0x18a979){_0xc25b80['push'](_0xc25b80['shift']());}};_0x5a7955(++_0x2eb958);}(_0xf550,0x1cb));var _0x0f55=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xf550[_0x50f392];return _0x5926f2;};'use strict';var _=require(_0x0f55('0x0'));var util=require('util');var logger=require(_0x0f55('0x1'))('api');var moment=require(_0x0f55('0x2'));var BPromise=require(_0x0f55('0x3'));var rp=require(_0x0f55('0x4'));var fs=require('fs');var path=require(_0x0f55('0x5'));var rimraf=require(_0x0f55('0x6'));var config=require(_0x0f55('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0x0f55('0x8')]=function(_0x51ebd7,_0xc5f0dd){return _0x51ebd7[_0x0f55('0x9')](_0x0f55('0xa'),attributes,{'tableName':_0x0f55('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0f55('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ed5521d..d02b0c8 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 _0xa930=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x513254,_0x1305ca){var _0x384c92=function(_0xb22823){while(--_0xb22823){_0x513254['push'](_0x513254['shift']());}};_0x384c92(++_0x1305ca);}(_0xa930,0x1c0));var _0x0a93=function(_0xcb0c01,_0x43ba1c){_0xcb0c01=_0xcb0c01-0x0;var _0x26756d=_0xa930[_0xcb0c01];return _0x26756d;};'use strict';var _=require(_0x0a93('0x0'));var util=require(_0x0a93('0x1'));var moment=require(_0x0a93('0x2'));var BPromise=require(_0x0a93('0x3'));var rs=require(_0x0a93('0x4'));var fs=require('fs');var Redis=require(_0x0a93('0x5'));var db=require(_0x0a93('0x6'))['db'];var utils=require(_0x0a93('0x7'));var logger=require(_0x0a93('0x8'))(_0x0a93('0x9'));var config=require(_0x0a93('0xa'));var jayson=require(_0x0a93('0xb'));var client=jayson['client'][_0x0a93('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x465359,_0x5e3a09,_0x7bb695){return new BPromise(function(_0x23eb3f,_0xba4017){return client[_0x0a93('0xd')](_0x465359,_0x7bb695)[_0x0a93('0xe')](function(_0x3ff0f3){logger[_0x0a93('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x5e3a09,_0x0a93('0x10'));logger[_0x0a93('0x11')](_0x0a93('0x12'),_0x5e3a09,'request\x20sent',JSON['stringify'](_0x3ff0f3));if(_0x3ff0f3[_0x0a93('0x13')]){if(_0x3ff0f3[_0x0a93('0x13')][_0x0a93('0x14')]===0x1f4){logger['error'](_0x0a93('0x15'),_0x5e3a09,_0x3ff0f3[_0x0a93('0x13')][_0x0a93('0x16')]);return _0xba4017(_0x3ff0f3[_0x0a93('0x13')]['message']);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5e3a09,_0x3ff0f3[_0x0a93('0x13')][_0x0a93('0x16')]);return _0x23eb3f(_0x3ff0f3[_0x0a93('0x13')][_0x0a93('0x16')]);}else{logger[_0x0a93('0xf')](_0x0a93('0x15'),_0x5e3a09,_0x0a93('0x10'));_0x23eb3f(_0x3ff0f3[_0x0a93('0x17')][_0x0a93('0x16')]);}})[_0x0a93('0x18')](function(_0x30694d){logger[_0x0a93('0x13')](_0x0a93('0x15'),_0x5e3a09,_0x30694d);_0xba4017(_0x30694d);});});} \ No newline at end of file +var _0x1bc8=['message','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x113068,_0x35831f){var _0x493a40=function(_0x24c811){while(--_0x24c811){_0x113068['push'](_0x113068['shift']());}};_0x493a40(++_0x35831f);}(_0x1bc8,0xd3));var _0x81bc=function(_0x1ac53b,_0x31c1f1){_0x1ac53b=_0x1ac53b-0x0;var _0x6dcc75=_0x1bc8[_0x1ac53b];return _0x6dcc75;};'use strict';var _=require(_0x81bc('0x0'));var util=require(_0x81bc('0x1'));var moment=require(_0x81bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x81bc('0x3'));var fs=require('fs');var Redis=require(_0x81bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x81bc('0x5'))(_0x81bc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x81bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2652f6,_0x54e67c,_0x434a01){return new BPromise(function(_0x5a1290,_0x171784){return client[_0x81bc('0x8')](_0x2652f6,_0x434a01)[_0x81bc('0x9')](function(_0x2d8c80){logger[_0x81bc('0xa')](_0x81bc('0xb'),_0x54e67c,_0x81bc('0xc'));logger[_0x81bc('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x54e67c,_0x81bc('0xc'),JSON[_0x81bc('0xe')](_0x2d8c80));if(_0x2d8c80[_0x81bc('0xf')]){if(_0x2d8c80[_0x81bc('0xf')][_0x81bc('0x10')]===0x1f4){logger[_0x81bc('0xf')](_0x81bc('0xb'),_0x54e67c,_0x2d8c80[_0x81bc('0xf')][_0x81bc('0x11')]);return _0x171784(_0x2d8c80['error'][_0x81bc('0x11')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x54e67c,_0x2d8c80[_0x81bc('0xf')]['message']);return _0x5a1290(_0x2d8c80[_0x81bc('0xf')][_0x81bc('0x11')]);}else{logger[_0x81bc('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x54e67c,'request\x20sent');_0x5a1290(_0x2d8c80['result'][_0x81bc('0x11')]);}})[_0x81bc('0x12')](function(_0x229cdc){logger['error'](_0x81bc('0xb'),_0x54e67c,_0x229cdc);_0x171784(_0x229cdc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c983080..d471ee5 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 _0xe90a=['describe','post','put','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','index','get','/describe','isAuthenticated'];(function(_0x5c6c04,_0x4d576a){var _0x403115=function(_0xfdd4ba){while(--_0xfdd4ba){_0x5c6c04['push'](_0x5c6c04['shift']());}};_0x403115(++_0x4d576a);}(_0xe90a,0x6b));var _0xae90=function(_0x549c51,_0x29e6fd){_0x549c51=_0x549c51-0x0;var _0x264861=_0xe90a[_0x549c51];return _0x264861;};'use strict';var multer=require('multer');var util=require(_0xae90('0x0'));var path=require(_0xae90('0x1'));var timeout=require(_0xae90('0x2'));var express=require(_0xae90('0x3'));var router=express[_0xae90('0x4')]();var fs_extra=require(_0xae90('0x5'));var auth=require(_0xae90('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae90('0x7'));var controller=require(_0xae90('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xae90('0x9')]);router[_0xae90('0xa')](_0xae90('0xb'),auth[_0xae90('0xc')](),controller[_0xae90('0xd')]);router[_0xae90('0xa')]('/:id',auth[_0xae90('0xc')](),controller['show']);router[_0xae90('0xe')]('/',auth[_0xae90('0xc')](),controller['create']);router[_0xae90('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xae90('0x10')]);router[_0xae90('0x11')](_0xae90('0x12'),auth[_0xae90('0xc')](),controller[_0xae90('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3806=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x546dac,_0x9f635f){var _0x456395=function(_0x4185be){while(--_0x4185be){_0x546dac['push'](_0x546dac['shift']());}};_0x456395(++_0x9f635f);}(_0x3806,0x78));var _0x6380=function(_0x40007a,_0xba2070){_0x40007a=_0x40007a-0x0;var _0x489ef3=_0x3806[_0x40007a];return _0x489ef3;};'use strict';var multer=require(_0x6380('0x0'));var util=require(_0x6380('0x1'));var path=require(_0x6380('0x2'));var timeout=require(_0x6380('0x3'));var express=require('express');var router=express[_0x6380('0x4')]();var fs_extra=require(_0x6380('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6380('0x6'));var config=require(_0x6380('0x7'));var controller=require(_0x6380('0x8'));router[_0x6380('0x9')]('/',auth[_0x6380('0xa')](),controller[_0x6380('0xb')]);router[_0x6380('0x9')](_0x6380('0xc'),auth[_0x6380('0xa')](),controller['describe']);router[_0x6380('0x9')]('/:id',auth[_0x6380('0xa')](),controller[_0x6380('0xd')]);router[_0x6380('0xe')]('/',auth['isAuthenticated'](),controller[_0x6380('0xf')]);router[_0x6380('0x10')](_0x6380('0x11'),auth[_0x6380('0xa')](),controller['update']);router[_0x6380('0x12')]('/:id',auth[_0x6380('0xa')](),controller[_0x6380('0x13')]);module[_0x6380('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b8a0049..646cc93 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 _0x48f7=['onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Form\x20properly\x20submitted','Note','Skip','Feedback','star','thumb','stringify','input','name','getDataValue'];(function(_0x588e09,_0xdcccdb){var _0x24d9a1=function(_0x22a1ef){while(--_0x22a1ef){_0x588e09['push'](_0x588e09['shift']());}};_0x24d9a1(++_0xdcccdb);}(_0x48f7,0x71));var _0x748f=function(_0x19f4aa,_0x17a0d6){_0x19f4aa=_0x19f4aa-0x0;var _0x2aed12=_0x48f7[_0x19f4aa];return _0x2aed12;};'use strict';var Sequelize=require(_0x748f('0x0'));var rs=require('randomstring');module[_0x748f('0x1')]={'name':{'type':Sequelize[_0x748f('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x748f('0x3')},'description':{'type':Sequelize[_0x748f('0x2')]},'mapKey':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x4')},'mapKeyOffline':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x4')},'key':{'type':Sequelize[_0x748f('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x5')},'customerAlias':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x748f('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x748f('0x2')],'allowNull':![],'defaultValue':_0x748f('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x748f('0x2')],'allowNull':![],'defaultValue':_0x748f('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x748f('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x748f('0x9')]('rounded',_0x748f('0xa')),'defaultValue':_0x748f('0xb')},'header_online':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0xc')},'start_chat_button':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0xd')},'offline_chat_button':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0xe')},'header_offline':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x748f('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x748f('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x748f('0x11')]},'closingQuestion':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x13')},'placeholderMessage':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x748f('0xe')},'skipMessageButton':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x748f('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x748f('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x748f('0x16'),_0x748f('0x17')),'defaultValue':_0x748f('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x748f('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x748f('0x18')]({'items':[{'type':_0x748f('0x19'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x748f('0x1a'),'helpText':''}},{'type':_0x748f('0x19'),'props':{'title':_0x748f('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x748f('0x4'),'type':_0x748f('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x748f('0x1b')](_0x748f('0x1c'))?JSON[_0x748f('0x1d')](this[_0x748f('0x1b')](_0x748f('0x1c'))):{};},'set':function(_0x181fdd){return this[_0x748f('0x1e')](_0x748f('0x1c'),JSON[_0x748f('0x18')](_0x181fdd));}},'offlineForm':{'type':Sequelize[_0x748f('0x11')],'defaultValue':function(){return JSON[_0x748f('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x748f('0x4'),'type':_0x748f('0x4')},'variable':null},{'type':_0x748f('0x1f'),'config':{'placeholder':_0x748f('0x20')},'props':{'title':_0x748f('0x20'),'helpText':_0x748f('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x748f('0x1b')](_0x748f('0x22'))?JSON[_0x748f('0x1d')](this[_0x748f('0x1b')](_0x748f('0x22'))):{};},'set':function(_0x1de9f2){return this[_0x748f('0x1e')](_0x748f('0x22'),JSON[_0x748f('0x18')](_0x1de9f2));}},'token':{'type':Sequelize[_0x748f('0x2')],'defaultValue':function(){return rs[_0x748f('0x23')]();}},'autoclose':{'type':Sequelize[_0x748f('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x748f('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x748f('0x2')]},'waitingTitle':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x24')},'waitingMessage':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x748f('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x748f('0x14')},'sendUnmanaged':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x748f('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x748f('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x748f('0x10')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x748f('0x2')]},'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[_0x748f('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x748f('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x748f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x27')},'verticalAlignment':{'type':Sequelize[_0x748f('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x748f('0x2')],'defaultValue':_0x748f('0x28')},'messagesAlignment':{'type':Sequelize[_0x748f('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x748f('0x2')]},'customerAvatar':{'type':Sequelize[_0x748f('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x748f('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x748f('0x2')],'allowNull':![],'defaultValue':_0x748f('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x748f('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x748f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x748f('0x2a')},'systemAvatar':{'type':Sequelize[_0x748f('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x748f('0x2b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5a7071){if(!_0x5a7071)this[_0x748f('0x1e')](_0x748f('0x2c'),null);this[_0x748f('0x1e')]('mandatoryDisposition',_0x5a7071);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x748f('0x2')],'allowNull':![],'defaultValue':_0x748f('0x2d')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x748f('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0x748f('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x748f('0x11')]}}; \ No newline at end of file +var _0xb133=['Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','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','alternate','#fafafa','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip'];(function(_0x5b5047,_0x4fde8e){var _0x17a267=function(_0x51c230){while(--_0x51c230){_0x5b5047['push'](_0x5b5047['shift']());}};_0x17a267(++_0x4fde8e);}(_0xb133,0x1dd));var _0x3b13=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xb133[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x3b13('0x0'));var rs=require(_0x3b13('0x1'));module[_0x3b13('0x2')]={'name':{'type':Sequelize[_0x3b13('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3b13('0x4')},'description':{'type':Sequelize[_0x3b13('0x3')]},'mapKey':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x5')},'key':{'type':Sequelize[_0x3b13('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x6')},'customerAlias':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3b13('0x3')],'allowNull':![],'defaultValue':_0x3b13('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3b13('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3b13('0x3')],'allowNull':![],'defaultValue':_0x3b13('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3b13('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3b13('0x3')]},'animation':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3b13('0xb')](_0x3b13('0xc'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0xd')},'start_chat_button':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0xe')},'offline_chat_button':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x3b13('0x10')},'download_transcript':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3b13('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3b13('0x11')]},'closingQuestion':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3b13('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x13')},'noteTitle':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x14')},'placeholderMessage':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3b13('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x17')},'ratingType':{'type':Sequelize[_0x3b13('0xb')](_0x3b13('0x18'),_0x3b13('0x19')),'defaultValue':_0x3b13('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x3b13('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3b13('0x11')],'defaultValue':function(){return JSON[_0x3b13('0x1a')]({'items':[{'type':_0x3b13('0x1b'),'variable':null,'config':{'placeholder':_0x3b13('0x1c'),'type':_0x3b13('0x1d'),'required':!![]},'props':{'title':_0x3b13('0x1c'),'helpText':''}},{'type':_0x3b13('0x1b'),'props':{'title':_0x3b13('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3b13('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3b13('0x1e')](_0x3b13('0x1f'))?JSON[_0x3b13('0x20')](this[_0x3b13('0x1e')](_0x3b13('0x1f'))):{};},'set':function(_0x129033){return this[_0x3b13('0x21')](_0x3b13('0x1f'),JSON[_0x3b13('0x1a')](_0x129033));}},'offlineForm':{'type':Sequelize[_0x3b13('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3b13('0x1b'),'props':{'title':_0x3b13('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3b13('0x5'),'type':_0x3b13('0x5')},'variable':null},{'type':_0x3b13('0x22'),'config':{'placeholder':_0x3b13('0x23')},'props':{'title':_0x3b13('0x23'),'helpText':_0x3b13('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x3b13('0x1e')](_0x3b13('0x25'))?JSON[_0x3b13('0x20')](this[_0x3b13('0x1e')](_0x3b13('0x25'))):{};},'set':function(_0x58ad07){return this[_0x3b13('0x21')](_0x3b13('0x25'),JSON[_0x3b13('0x1a')](_0x58ad07));}},'token':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3b13('0x3')]},'forwardOffline':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3b13('0x3')]},'waitingTitle':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x26')},'waitingMessage':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x28')},'offlineMessageBody':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x16')},'sendUnmanaged':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3b13('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3b13('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3b13('0x2b');}},'notificationSound':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x3b13('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x3b13('0x2d')},'verticalAlignment':{'type':Sequelize[_0x3b13('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':_0x3b13('0x2e')},'defaultTitle':{'type':Sequelize[_0x3b13('0x3')]},'customerAvatar':{'type':Sequelize[_0x3b13('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3b13('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3b13('0x3')],'allowNull':![],'defaultValue':_0x3b13('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b13('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b13('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c5ca6){if(!_0x3c5ca6)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x3c5ca6);}},'vidaooEscalation':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3b13('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3b13('0x3')],'allowNull':![],'defaultValue':_0x3b13('0x30')},'vidaooNote':{'type':Sequelize[_0x3b13('0x3')],'defaultValue':function(){return _0x3b13('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x3b13('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3b13('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3b13('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2ba933c..0ac57a8 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 _0x1e5d=['device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','firstName','messageId','created','push','close','unmanaged','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','notify','files','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','fromString','originalname','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','toPairsIn','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','remove','addInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','inspect','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','virtual','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','referer','replace','alignment','verticalAlignment','labelText','textColor','backgroundColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','items','fromKey','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','ChatWebsites','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','order','ChatWebsiteId','filter','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addLogo','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','getResult','chat','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','headers','cf-connecting-ip','first','x-forwarded-for','split','lastName','x-real-port','browser','version','format','%s\x20%s','unknown'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e5d,0x1aa));var _0xd1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5d[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd1e5('0x0'));var Mustache=require(_0xd1e5('0x1'));var util=require(_0xd1e5('0x2'));var path=require(_0xd1e5('0x3'));var ejs=require(_0xd1e5('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xd1e5('0x5'));var Redis=require(_0xd1e5('0x6'));var qs=require(_0xd1e5('0x7'));var logger=require(_0xd1e5('0x8'))(_0xd1e5('0x9'));var config=require('../../config/environment');var db=require(_0xd1e5('0xa'))['db'];config[_0xd1e5('0xb')]=_[_0xd1e5('0xc')](config[_0xd1e5('0xb')],{'host':_0xd1e5('0xd'),'port':0x18eb});var socket=require(_0xd1e5('0xe'))(new Redis(config[_0xd1e5('0xb')]));require(_0xd1e5('0xf'))[_0xd1e5('0x10')](socket);var htmlToText=require(_0xd1e5('0x11'));var jayson=require(_0xd1e5('0x12'));var client=jayson[_0xd1e5('0x13')][_0xd1e5('0x14')]({'port':0x232c});var client9002=jayson[_0xd1e5('0x13')]['http']({'port':0x232a});var client9003=jayson[_0xd1e5('0x13')][_0xd1e5('0x14')]({'port':0x232b});var client9001=jayson[_0xd1e5('0x13')][_0xd1e5('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x282ce2,_0x116426,_0x1e71b7,_0x2375ac){return new BPromise(function(_0x35973c,_0xe87c14){var _0x1a99a7=_0x2375ac||client;return _0x1a99a7[_0xd1e5('0x15')](_0x282ce2,_0x1e71b7)[_0xd1e5('0x16')](function(_0x593ff0){logger[_0xd1e5('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x116426,'request\x20sent');logger[_0xd1e5('0x18')](_0xd1e5('0x19'),_0x116426,_0xd1e5('0x1a'),JSON['stringify'](_0x593ff0));if(_0x593ff0['error']){if(_0x593ff0[_0xd1e5('0x1b')]['code']===0x1f4){logger[_0xd1e5('0x1b')](_0xd1e5('0x1c'),_0x116426,_0x593ff0[_0xd1e5('0x1b')][_0xd1e5('0x1d')]);return _0xe87c14(_0x593ff0['error'][_0xd1e5('0x1d')]);}logger[_0xd1e5('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x116426,_0x593ff0['error']['message']);return _0x35973c(_0x593ff0[_0xd1e5('0x1b')][_0xd1e5('0x1d')]);}else{logger['info'](_0xd1e5('0x1c'),_0x116426,_0xd1e5('0x1a'));_0x35973c(_0x593ff0[_0xd1e5('0x1e')][_0xd1e5('0x1d')]);}})[_0xd1e5('0x1f')](function(_0x32d80c){logger[_0xd1e5('0x1b')](_0xd1e5('0x1c'),_0x116426,_0x32d80c);_0xe87c14(_0x32d80c);});});}function respondWithStatusCode(_0x4dc4e6,_0x425478){_0x425478=_0x425478||0xcc;return function(_0x241d5c){if(_0x241d5c){return _0x4dc4e6[_0xd1e5('0x20')](_0x425478);}return _0x4dc4e6[_0xd1e5('0x21')](_0x425478)['end']();};}function respondWithResult(_0x4f26ef,_0x19783f){_0x19783f=_0x19783f||0xc8;return function(_0x386f13){if(_0x386f13){return _0x4f26ef[_0xd1e5('0x21')](_0x19783f)[_0xd1e5('0x22')](_0x386f13);}};}function respondWithFilteredResult(_0x21604d,_0x46a8b4){return function(_0x18e25a){if(_0x18e25a){var _0x1f5185=typeof _0x46a8b4[_0xd1e5('0x23')]===_0xd1e5('0x24')&&typeof _0x46a8b4[_0xd1e5('0x25')]===_0xd1e5('0x24');var _0x28352d=_0x18e25a[_0xd1e5('0x26')];var _0x30a414=_0x1f5185?0x0:_0x46a8b4[_0xd1e5('0x23')];var _0x2d95de=_0x1f5185?_0x18e25a[_0xd1e5('0x26')]:_0x46a8b4['offset']+_0x46a8b4[_0xd1e5('0x25')];var _0x183c38;if(_0x2d95de>=_0x28352d){_0x2d95de=_0x28352d;_0x183c38=0xc8;}else{_0x183c38=0xce;}_0x21604d[_0xd1e5('0x21')](_0x183c38);return _0x21604d[_0xd1e5('0x27')](_0xd1e5('0x28'),_0x30a414+'-'+_0x2d95de+'/'+_0x28352d)[_0xd1e5('0x22')](_0x18e25a);}return null;};}function saveUpdates(_0x3f18b8){return function(_0x46ad9e){if(_0x46ad9e){return _0x46ad9e[_0xd1e5('0x29')](_0x3f18b8)[_0xd1e5('0x16')](function(_0x943b0e){return _0x943b0e;});}return null;};}function removeEntity(_0x3417de){return function(_0x1fda26){if(_0x1fda26){return _0x1fda26['destroy']()['then'](function(){var _0x2b75cf=_0x1fda26['get']({'plain':!![]});var _0x31321c=_0xd1e5('0x2a');return db[_0xd1e5('0x2b')][_0xd1e5('0x2c')]({'where':{'type':_0x31321c,'resourceId':_0x2b75cf['id']}})[_0xd1e5('0x16')](function(){return _0x1fda26;});})[_0xd1e5('0x16')](function(){_0x3417de[_0xd1e5('0x21')](0xcc)[_0xd1e5('0x2d')]();});}};}function handleEntityNotFound(_0x25cd9f){return function(_0x18cd70){if(!_0x18cd70){_0x25cd9f[_0xd1e5('0x20')](0x194);}return _0x18cd70;};}function handleError(_0x1c02c5,_0x2906ff){_0x2906ff=_0x2906ff||0x1f4;return function(_0x4f4b5f){logger[_0xd1e5('0x1b')](_0x4f4b5f[_0xd1e5('0x2e')]);if(_0x4f4b5f['name']){delete _0x4f4b5f[_0xd1e5('0x2f')];}_0x1c02c5[_0xd1e5('0x21')](_0x2906ff)[_0xd1e5('0x30')](_0x4f4b5f);};}exports[_0xd1e5('0x31')]=function(_0x5415bb,_0x385daf){var _0x33b480={'include':[{'model':db[_0xd1e5('0x32')],'as':_0xd1e5('0x33')}]},_0x50ea31={},_0x252778={'count':0x0,'rows':[]};var _0x272eb7=_['map'](db[_0xd1e5('0x34')][_0xd1e5('0x35')],function(_0x3af150){return{'name':_0x3af150[_0xd1e5('0x36')],'type':_0x3af150[_0xd1e5('0x37')][_0xd1e5('0x38')]};});_0x50ea31[_0xd1e5('0x39')]=_[_0xd1e5('0x3a')](_0x272eb7,_0xd1e5('0x2f'));_0x50ea31['query']=_[_0xd1e5('0x3b')](_0x5415bb[_0xd1e5('0x3c')]);_0x50ea31[_0xd1e5('0x3d')]=_[_0xd1e5('0x3e')](_0x50ea31[_0xd1e5('0x39')],_0x50ea31['query']);_0x33b480[_0xd1e5('0x3f')]=_[_0xd1e5('0x3e')](_0x50ea31[_0xd1e5('0x39')],qs[_0xd1e5('0x40')](_0x5415bb[_0xd1e5('0x3c')]['fields']));_0x33b480[_0xd1e5('0x3f')]=_0x33b480[_0xd1e5('0x3f')][_0xd1e5('0x41')]?_0x33b480[_0xd1e5('0x3f')]:_0x50ea31[_0xd1e5('0x39')];if(!_0x5415bb[_0xd1e5('0x3c')]['hasOwnProperty'](_0xd1e5('0x42'))){_0x33b480[_0xd1e5('0x25')]=qs['limit'](_0x5415bb['query'][_0xd1e5('0x25')]);_0x33b480['offset']=qs[_0xd1e5('0x23')](_0x5415bb[_0xd1e5('0x3c')][_0xd1e5('0x23')]);}_0x33b480['order']=qs[_0xd1e5('0x43')](_0x5415bb[_0xd1e5('0x3c')]['sort']);_0x33b480['where']=qs['filters'](_[_0xd1e5('0x44')](_0x5415bb[_0xd1e5('0x3c')],_0x50ea31[_0xd1e5('0x3d')]),_0x272eb7);if(_0x5415bb[_0xd1e5('0x3c')]['filter']){_0x33b480[_0xd1e5('0x45')]=_[_0xd1e5('0x46')](_0x33b480['where'],{'$or':_[_0xd1e5('0x3a')](_0x272eb7,function(_0xa1ecef){if(_0xa1ecef[_0xd1e5('0x37')]!==_0xd1e5('0x47')){var _0x3faeb5={};_0x3faeb5[_0xa1ecef[_0xd1e5('0x2f')]]={'$like':'%'+_0x5415bb['query']['filter']+'%'};return _0x3faeb5;}})});}_0x33b480=_[_0xd1e5('0x46')]({},_0x33b480,_0x5415bb[_0xd1e5('0x48')]);var _0x2765d6={'where':_0x33b480[_0xd1e5('0x45')]};return db[_0xd1e5('0x34')]['count'](_0x2765d6)[_0xd1e5('0x16')](function(_0x5da948){_0x252778[_0xd1e5('0x26')]=_0x5da948;if(_0x5415bb[_0xd1e5('0x3c')][_0xd1e5('0x49')]){_0x33b480[_0xd1e5('0x4a')]=[{'all':!![]}];}return db[_0xd1e5('0x34')][_0xd1e5('0x4b')](_0x33b480);})[_0xd1e5('0x16')](function(_0x61de1d){_0x252778[_0xd1e5('0x4c')]=_0x61de1d;return _0x252778;})[_0xd1e5('0x16')](respondWithFilteredResult(_0x385daf,_0x33b480))[_0xd1e5('0x1f')](handleError(_0x385daf,null));};exports[_0xd1e5('0x4d')]=function(_0x580332,_0x42346e){var _0x5cc6ab={'raw':![],'where':{'id':_0x580332[_0xd1e5('0x4e')]['id']},'include':[{'model':db[_0xd1e5('0x32')],'as':_0xd1e5('0x33')}]},_0x120e8f={};_0x120e8f[_0xd1e5('0x39')]=_[_0xd1e5('0x3b')](db[_0xd1e5('0x34')]['rawAttributes']);_0x120e8f['query']=_[_0xd1e5('0x3b')](_0x580332[_0xd1e5('0x3c')]);_0x120e8f[_0xd1e5('0x3d')]=_['intersection'](_0x120e8f['model'],_0x120e8f['query']);_0x5cc6ab[_0xd1e5('0x3f')]=_[_0xd1e5('0x3e')](_0x120e8f['model'],qs[_0xd1e5('0x40')](_0x580332[_0xd1e5('0x3c')]['fields']));_0x5cc6ab[_0xd1e5('0x3f')]=_0x5cc6ab[_0xd1e5('0x3f')][_0xd1e5('0x41')]?_0x5cc6ab[_0xd1e5('0x3f')]:_0x120e8f[_0xd1e5('0x39')];if(_0x580332[_0xd1e5('0x3c')][_0xd1e5('0x49')]){_0x5cc6ab[_0xd1e5('0x4a')]=[{'all':!![]}];}_0x5cc6ab=_[_0xd1e5('0x46')]({},_0x5cc6ab,_0x580332[_0xd1e5('0x48')]);return db[_0xd1e5('0x34')][_0xd1e5('0x4f')](_0x5cc6ab)[_0xd1e5('0x16')](handleEntityNotFound(_0x42346e,null))[_0xd1e5('0x16')](respondWithResult(_0x42346e,null))[_0xd1e5('0x1f')](handleError(_0x42346e,null));};exports[_0xd1e5('0x50')]=function(_0x53d672,_0x2cff3e){return db[_0xd1e5('0x34')][_0xd1e5('0x50')](_0x53d672[_0xd1e5('0x51')],{})['then'](function(_0x157280){var _0x34fb52=_0x53d672['user'][_0xd1e5('0x52')]({'plain':!![]});if(!_0x34fb52)throw new Error(_0xd1e5('0x53'));if(_0x34fb52['role']===_0xd1e5('0x54')){var _0xc719e4=_0x157280['get']({'plain':!![]});var _0x68f7e3=_0xd1e5('0x2a');return db['UserProfileSection'][_0xd1e5('0x4f')]({'where':{'name':_0x68f7e3,'userProfileId':_0x34fb52[_0xd1e5('0x55')]},'raw':!![]})[_0xd1e5('0x16')](function(_0x509318){if(_0x509318&&_0x509318[_0xd1e5('0x56')]===0x0){return db[_0xd1e5('0x2b')]['create']({'name':_0xc719e4[_0xd1e5('0x2f')],'resourceId':_0xc719e4['id'],'type':_0x509318[_0xd1e5('0x2f')],'sectionId':_0x509318['id']},{})[_0xd1e5('0x16')](function(){return _0x157280;});}else{return _0x157280;}})[_0xd1e5('0x1f')](function(_0x1e5e23){logger[_0xd1e5('0x1b')](_0xd1e5('0x57'),_0x1e5e23);throw _0x1e5e23;});}return _0x157280;})[_0xd1e5('0x16')](respondWithResult(_0x2cff3e,0xc9))[_0xd1e5('0x1f')](handleError(_0x2cff3e,null));};exports[_0xd1e5('0x29')]=function(_0x24d7f5,_0x49752b){if(_0x24d7f5['body']['id']){delete _0x24d7f5[_0xd1e5('0x51')]['id'];}return db[_0xd1e5('0x34')]['find']({'where':{'id':_0x24d7f5['params']['id']},'include':[{'model':db['Pause'],'as':_0xd1e5('0x33')}]})[_0xd1e5('0x16')](handleEntityNotFound(_0x49752b,null))[_0xd1e5('0x16')](saveUpdates(_0x24d7f5[_0xd1e5('0x51')],null))[_0xd1e5('0x16')](respondWithResult(_0x49752b,null))['catch'](handleError(_0x49752b,null));};exports[_0xd1e5('0x2c')]=function(_0x337f1b,_0x4a9a9a){return db['ChatWebsite'][_0xd1e5('0x4f')]({'where':{'id':_0x337f1b[_0xd1e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4a9a9a,null))[_0xd1e5('0x16')](removeEntity(_0x4a9a9a,null))[_0xd1e5('0x1f')](handleError(_0x4a9a9a,null));};exports[_0xd1e5('0x58')]=function(_0x3c85bb,_0x494346){return db['ChatWebsite'][_0xd1e5('0x58')]()['then'](respondWithResult(_0x494346,null))[_0xd1e5('0x1f')](handleError(_0x494346,null));};exports[_0xd1e5('0x59')]=function(_0x3ea951,_0x1fc3d3){if(_0x3ea951['body']['id']){delete _0x3ea951[_0xd1e5('0x51')]['id'];}return db[_0xd1e5('0x34')]['find']({'where':{'id':_0x3ea951[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x1fc3d3,null))['then'](function(_0x3e0418){if(_0x3e0418){_0x3ea951[_0xd1e5('0x51')]['ChatWebsiteId']=_0x3e0418['id'];return db[_0xd1e5('0x5a')][_0xd1e5('0x50')](_0x3ea951[_0xd1e5('0x51')]);}})[_0xd1e5('0x16')](respondWithResult(_0x1fc3d3,null))[_0xd1e5('0x1f')](handleError(_0x1fc3d3,null));};exports['getDispositions']=function(_0x457d16,_0x292a8d){var _0x2824cb={'raw':![],'where':{}};var _0x379d75={};var _0x486530={'count':0x0,'rows':[]};return db[_0xd1e5('0x34')][_0xd1e5('0x5b')]({'where':{'id':_0x457d16[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x292a8d,null))[_0xd1e5('0x16')](function(_0x1e4fd7){if(_0x1e4fd7){_0x379d75[_0xd1e5('0x39')]=_[_0xd1e5('0x3b')](db[_0xd1e5('0x5a')][_0xd1e5('0x35')]);_0x379d75[_0xd1e5('0x3c')]=_[_0xd1e5('0x3b')](_0x457d16[_0xd1e5('0x3c')]);_0x379d75[_0xd1e5('0x3d')]=_['intersection'](_0x379d75[_0xd1e5('0x39')],_0x379d75[_0xd1e5('0x3c')]);_0x2824cb[_0xd1e5('0x3f')]=_[_0xd1e5('0x3e')](_0x379d75[_0xd1e5('0x39')],qs[_0xd1e5('0x40')](_0x457d16[_0xd1e5('0x3c')][_0xd1e5('0x40')]));_0x2824cb[_0xd1e5('0x3f')]=_0x2824cb[_0xd1e5('0x3f')][_0xd1e5('0x41')]?_0x2824cb[_0xd1e5('0x3f')]:_0x379d75['model'];if(!_0x457d16['query']['hasOwnProperty']('nolimit')){_0x2824cb[_0xd1e5('0x25')]=qs[_0xd1e5('0x25')](_0x457d16['query']['limit']);_0x2824cb[_0xd1e5('0x23')]=qs[_0xd1e5('0x23')](_0x457d16['query'][_0xd1e5('0x23')]);}_0x2824cb[_0xd1e5('0x5c')]=qs['sort'](_0x457d16[_0xd1e5('0x3c')][_0xd1e5('0x43')]);_0x2824cb[_0xd1e5('0x45')]=qs['filters'](_[_0xd1e5('0x44')](_0x457d16[_0xd1e5('0x3c')],_0x379d75[_0xd1e5('0x3d')]));_0x2824cb['where'][_0xd1e5('0x5d')]=_0x1e4fd7['id'];if(_0x457d16['query'][_0xd1e5('0x5e')]){_0x2824cb[_0xd1e5('0x45')]=_[_0xd1e5('0x46')](_0x2824cb[_0xd1e5('0x45')],{'$or':_[_0xd1e5('0x3a')](_0x2824cb['attributes'],function(_0x5be513){var _0x1a9d0c={};_0x1a9d0c[_0x5be513]={'$like':'%'+_0x457d16[_0xd1e5('0x3c')][_0xd1e5('0x5e')]+'%'};return _0x1a9d0c;})});}_0x2824cb=_['merge']({},_0x2824cb,_0x457d16[_0xd1e5('0x48')]);return db[_0xd1e5('0x5a')][_0xd1e5('0x26')]({'where':_0x2824cb[_0xd1e5('0x45')]})[_0xd1e5('0x16')](function(_0x1d4f4a){_0x486530[_0xd1e5('0x26')]=_0x1d4f4a;if(_0x457d16[_0xd1e5('0x3c')][_0xd1e5('0x49')]){_0x2824cb[_0xd1e5('0x4a')]=[{'all':!![]}];}return db[_0xd1e5('0x5a')][_0xd1e5('0x4b')](_0x2824cb);})[_0xd1e5('0x16')](function(_0x35561f){_0x486530[_0xd1e5('0x4c')]=_0x35561f;return _0x486530;});}})['then'](respondWithFilteredResult(_0x292a8d,_0x2824cb))['catch'](handleError(_0x292a8d,null));};exports[_0xd1e5('0x5f')]=function(_0x3b06a1,_0x637a31){return db[_0xd1e5('0x34')][_0xd1e5('0x4f')]({'where':{'id':_0x3b06a1['params']['id']}})['then'](handleEntityNotFound(_0x637a31,null))['then'](function(_0x596193){if(_0x596193){return _0x596193[_0xd1e5('0x5f')](_0x3b06a1[_0xd1e5('0x3c')][_0xd1e5('0x60')]);}})[_0xd1e5('0x16')](respondWithStatusCode(_0x637a31,null))[_0xd1e5('0x1f')](handleError(_0x637a31,null));};exports['addAnswer']=function(_0x8b3f83,_0x4dcb09){if(_0x8b3f83[_0xd1e5('0x51')]['id']){delete _0x8b3f83[_0xd1e5('0x51')]['id'];}return db[_0xd1e5('0x34')][_0xd1e5('0x4f')]({'where':{'id':_0x8b3f83[_0xd1e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4dcb09,null))[_0xd1e5('0x16')](function(_0x440fdd){if(_0x440fdd){_0x8b3f83[_0xd1e5('0x51')][_0xd1e5('0x5d')]=_0x440fdd['id'];return db[_0xd1e5('0x61')]['create'](_0x8b3f83['body']);}})['then'](respondWithResult(_0x4dcb09,null))[_0xd1e5('0x1f')](handleError(_0x4dcb09,null));};exports[_0xd1e5('0x62')]=function(_0x190de6,_0x236dd){var _0x1826c4={'raw':![],'where':{}};var _0x4e6768={};var _0x27922c={'count':0x0,'rows':[]};return db[_0xd1e5('0x34')]['findOne']({'where':{'id':_0x190de6[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x236dd,null))['then'](function(_0x2398bd){if(_0x2398bd){_0x4e6768['model']=_['keys'](db[_0xd1e5('0x61')][_0xd1e5('0x35')]);_0x4e6768[_0xd1e5('0x3c')]=_[_0xd1e5('0x3b')](_0x190de6[_0xd1e5('0x3c')]);_0x4e6768[_0xd1e5('0x3d')]=_[_0xd1e5('0x3e')](_0x4e6768[_0xd1e5('0x39')],_0x4e6768['query']);_0x1826c4[_0xd1e5('0x3f')]=_[_0xd1e5('0x3e')](_0x4e6768[_0xd1e5('0x39')],qs[_0xd1e5('0x40')](_0x190de6[_0xd1e5('0x3c')][_0xd1e5('0x40')]));_0x1826c4[_0xd1e5('0x3f')]=_0x1826c4[_0xd1e5('0x3f')][_0xd1e5('0x41')]?_0x1826c4[_0xd1e5('0x3f')]:_0x4e6768['model'];if(!_0x190de6[_0xd1e5('0x3c')][_0xd1e5('0x63')](_0xd1e5('0x42'))){_0x1826c4['limit']=qs[_0xd1e5('0x25')](_0x190de6[_0xd1e5('0x3c')][_0xd1e5('0x25')]);_0x1826c4['offset']=qs[_0xd1e5('0x23')](_0x190de6[_0xd1e5('0x3c')][_0xd1e5('0x23')]);}_0x1826c4[_0xd1e5('0x5c')]=qs[_0xd1e5('0x43')](_0x190de6[_0xd1e5('0x3c')]['sort']);_0x1826c4['where']=qs[_0xd1e5('0x3d')](_[_0xd1e5('0x44')](_0x190de6[_0xd1e5('0x3c')],_0x4e6768[_0xd1e5('0x3d')]));_0x1826c4['where'][_0xd1e5('0x5d')]=_0x2398bd['id'];if(_0x190de6['query']['filter']){_0x1826c4['where']=_[_0xd1e5('0x46')](_0x1826c4[_0xd1e5('0x45')],{'$or':_[_0xd1e5('0x3a')](_0x1826c4[_0xd1e5('0x3f')],function(_0x3ca15c){var _0x3abf5b={};_0x3abf5b[_0x3ca15c]={'$like':'%'+_0x190de6[_0xd1e5('0x3c')][_0xd1e5('0x5e')]+'%'};return _0x3abf5b;})});}_0x1826c4=_['merge']({},_0x1826c4,_0x190de6[_0xd1e5('0x48')]);return db['CannedAnswer'][_0xd1e5('0x26')]({'where':_0x1826c4[_0xd1e5('0x45')]})['then'](function(_0xe40d6e){_0x27922c[_0xd1e5('0x26')]=_0xe40d6e;if(_0x190de6[_0xd1e5('0x3c')][_0xd1e5('0x49')]){_0x1826c4[_0xd1e5('0x4a')]=[{'all':!![]}];}return db[_0xd1e5('0x61')][_0xd1e5('0x4b')](_0x1826c4);})[_0xd1e5('0x16')](function(_0x569f6a){_0x27922c[_0xd1e5('0x4c')]=_0x569f6a;return _0x27922c;});}})['then'](respondWithFilteredResult(_0x236dd,_0x1826c4))[_0xd1e5('0x1f')](handleError(_0x236dd,null));};exports[_0xd1e5('0x64')]=function(_0x1860b5,_0x29517a){return db[_0xd1e5('0x34')][_0xd1e5('0x4f')]({'where':{'id':_0x1860b5[_0xd1e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x29517a,null))[_0xd1e5('0x16')](function(_0x1a7276){if(_0x1a7276){return _0x1a7276[_0xd1e5('0x64')](_0x1860b5[_0xd1e5('0x3c')][_0xd1e5('0x60')]);}})[_0xd1e5('0x16')](respondWithStatusCode(_0x29517a,null))[_0xd1e5('0x1f')](handleError(_0x29517a,null));};exports[_0xd1e5('0x65')]=function(_0x4976c1,_0xb19682){_0x4976c1[_0xd1e5('0x51')]['sitepic']=_0x4976c1[_0xd1e5('0x66')][_0xd1e5('0x67')];return db['ChatWebsite'][_0xd1e5('0x4f')]({'where':{'id':_0x4976c1[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0xb19682,null))[_0xd1e5('0x16')](saveUpdates(_0x4976c1[_0xd1e5('0x51')],null))['then'](respondWithResult(_0xb19682,null))['catch'](handleError(_0xb19682,null));};exports[_0xd1e5('0x68')]=function(_0x484c8c,_0x53c6fb){_0x484c8c[_0xd1e5('0x51')]['agentAvatar']=_0x484c8c[_0xd1e5('0x66')][_0xd1e5('0x67')];return db[_0xd1e5('0x34')][_0xd1e5('0x4f')]({'where':{'id':_0x484c8c['params']['id']}})['then'](handleEntityNotFound(_0x53c6fb,null))[_0xd1e5('0x16')](saveUpdates(_0x484c8c[_0xd1e5('0x51')],null))['then'](respondWithResult(_0x53c6fb,null))[_0xd1e5('0x1f')](handleError(_0x53c6fb,null));};exports[_0xd1e5('0x69')]=function(_0x1a0b39,_0xdb5579){_0x1a0b39[_0xd1e5('0x51')][_0xd1e5('0x6a')]=_0x1a0b39[_0xd1e5('0x66')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x1a0b39[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0xdb5579,null))[_0xd1e5('0x16')](saveUpdates(_0x1a0b39[_0xd1e5('0x51')],null))[_0xd1e5('0x16')](respondWithResult(_0xdb5579,null))[_0xd1e5('0x1f')](handleError(_0xdb5579,null));};exports[_0xd1e5('0x6b')]=function(_0x4501be,_0x20ac11){_0x4501be[_0xd1e5('0x51')][_0xd1e5('0x6c')]=_0x4501be['file']['filename'];return db[_0xd1e5('0x34')]['find']({'where':{'id':_0x4501be[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x20ac11,null))[_0xd1e5('0x16')](saveUpdates(_0x4501be[_0xd1e5('0x51')],null))['then'](respondWithResult(_0x20ac11,null))[_0xd1e5('0x1f')](handleError(_0x20ac11,null));};exports['getLogo']=function(_0x18b964,_0x1bc64f){var _0x81fcc4=path['join'](config[_0xd1e5('0x6d')],'server/files/images/logos/default_logo.svg');var _0x1d7262={'where':{'id':_0x18b964[_0xd1e5('0x4e')]['id']},'attributes':['id',_0xd1e5('0x6e')],'raw':!![]};var _0x31491c=![];return require(_0xd1e5('0x6f'))[_0xd1e5('0x70')]()[_0xd1e5('0x16')](function(_0x1cb8cc){if(_0x1cb8cc){_0x31491c=_0x1cb8cc[_0xd1e5('0x71')];}})[_0xd1e5('0x16')](function(){return db['ChatWebsite'][_0xd1e5('0x4f')](_0x1d7262);})[_0xd1e5('0x16')](handleEntityNotFound(_0x1bc64f,null))[_0xd1e5('0x16')](function(_0x2cad31){if(_0x2cad31){if(!_[_0xd1e5('0x72')](_0x2cad31[_0xd1e5('0x6e')])){if(fs[_0xd1e5('0x73')](path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],_0xd1e5('0x75'),_0x2cad31['sitepic']))&&_0x31491c){_0x81fcc4=path[_0xd1e5('0x74')](config['root'],_0xd1e5('0x75'),_0x2cad31[_0xd1e5('0x6e')]);}}return _0x1bc64f[_0xd1e5('0x76')](_0x81fcc4);}})['catch'](handleError(_0x1bc64f,null));};exports[_0xd1e5('0x77')]=function(_0x27e6fc,_0x49050e){var _0x5f401d=path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],_0xd1e5('0x78'));var _0x3b64cd={'where':{'id':_0x27e6fc['params']['id']},'attributes':['id',_0xd1e5('0x79')],'raw':!![]};return db[_0xd1e5('0x34')]['find'](_0x3b64cd)[_0xd1e5('0x16')](handleEntityNotFound(_0x49050e,null))[_0xd1e5('0x16')](function(_0x9a77f6){if(_0x9a77f6){if(!_[_0xd1e5('0x72')](_0x9a77f6[_0xd1e5('0x79')])){if(fs[_0xd1e5('0x73')](path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],'server/files/images/avatars/',_0x9a77f6['agentAvatar']))){_0x5f401d=path[_0xd1e5('0x74')](config['root'],_0xd1e5('0x7a'),_0x9a77f6['agentAvatar']);}}return _0x49050e[_0xd1e5('0x76')](_0x5f401d);}})[_0xd1e5('0x1f')](handleError(_0x49050e,null));};exports[_0xd1e5('0x7b')]=function(_0x2f161f,_0x1fff3f){var _0x3547f9=path[_0xd1e5('0x74')](config['root'],_0xd1e5('0x7c'));var _0xfb5766={'where':{'id':_0x2f161f['params']['id']},'attributes':['id',_0xd1e5('0x6a'),_0xd1e5('0x7d')],'raw':!![]};return db[_0xd1e5('0x34')][_0xd1e5('0x4f')](_0xfb5766)['then'](handleEntityNotFound(_0x1fff3f,null))[_0xd1e5('0x16')](function(_0x2f0652){if(_0x2f0652){if(!_[_0xd1e5('0x72')](_0x2f0652[_0xd1e5('0x6a')])){if(fs[_0xd1e5('0x73')](path[_0xd1e5('0x74')](config['root'],_0xd1e5('0x7a'),_0x2f0652[_0xd1e5('0x6a')]))&&_0x2f0652[_0xd1e5('0x7d')]){_0x3547f9=path['join'](config[_0xd1e5('0x6d')],_0xd1e5('0x7a'),_0x2f0652[_0xd1e5('0x6a')]);}}return _0x1fff3f['download'](_0x3547f9);}})[_0xd1e5('0x1f')](handleError(_0x1fff3f,null));};exports['getSystemAvatar']=function(_0x1dd9fd,_0x36d59c){var _0x1050c7=path[_0xd1e5('0x74')](config['root'],_0xd1e5('0x7e'));var _0x4d954c={'where':{'id':_0x1dd9fd[_0xd1e5('0x4e')]['id']},'attributes':['id',_0xd1e5('0x6c')],'raw':!![]};return db[_0xd1e5('0x34')][_0xd1e5('0x4f')](_0x4d954c)[_0xd1e5('0x16')](handleEntityNotFound(_0x36d59c,null))[_0xd1e5('0x16')](function(_0x1ff077){if(_0x1ff077){if(!_['isNil'](_0x1ff077[_0xd1e5('0x6c')])){if(fs[_0xd1e5('0x73')](path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],_0xd1e5('0x7a'),_0x1ff077[_0xd1e5('0x6c')]))){_0x1050c7=path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],_0xd1e5('0x7a'),_0x1ff077[_0xd1e5('0x6c')]);}}return _0x36d59c[_0xd1e5('0x76')](_0x1050c7);}})[_0xd1e5('0x1f')](handleError(_0x36d59c,null));};exports['notify']=function(_0x2fc728,_0x34820f){var _0x49986b=require(_0xd1e5('0x7f'));var _0x4abde6=new _0x49986b();var _0x695cef=_0x4abde6[_0xd1e5('0x80')](_0x2fc728['headers']['user-agent'])[_0xd1e5('0x81')]();var _0x18bdc8={'body':_0x2fc728[_0xd1e5('0x51')],'channel':_0xd1e5('0x82')};var _0x5c070a=[];var _0x31a869=[];var _0x4d7702={};var _0x5a20b3=![];return db[_0xd1e5('0x83')][_0xd1e5('0x58')]()[_0xd1e5('0x16')](function(_0x45ef48){if(!_0x45ef48){throw new db[(_0xd1e5('0x84'))][(_0xd1e5('0x85'))]('no\x20available\x20attributes');}_0x5c070a=_['difference'](_[_0xd1e5('0x3b')](_0x45ef48),[_0xd1e5('0x86'),_0xd1e5('0x87')]);_0x31a869=_[_0xd1e5('0x88')](_[_0xd1e5('0x3b')](_0x45ef48),['createdAt',_0xd1e5('0x87'),_0xd1e5('0x89'),_0xd1e5('0x8a')]);if(_0x2fc728[_0xd1e5('0x51')]['id']){delete _0x2fc728[_0xd1e5('0x51')]['id'];}if(_[_0xd1e5('0x72')](_0x2fc728['body']['from'])){throw new db[(_0xd1e5('0x84'))]['ValidationError'](_0xd1e5('0x8b'));}if(_['isNil'](_0x2fc728['body'][_0xd1e5('0x51')])||_0x2fc728['body'][_0xd1e5('0x51')]===''){throw new db['Sequelize']['ValidationError'](_0xd1e5('0x8c'));}if(_[_0xd1e5('0x72')](_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0x8d')])){throw new db[(_0xd1e5('0x84'))][(_0xd1e5('0x85'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x31a869);}if(!_[_0xd1e5('0x8e')](_0x31a869,_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0x8d')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x31a869);}_0x4d7702[_0x2fc728['body'][_0xd1e5('0x8d')]]=_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0x8f')];})['then'](function(){return db[_0xd1e5('0x34')][_0xd1e5('0x4f')]({'where':{'id':_0x2fc728[_0xd1e5('0x4e')]['id']},'include':[{'model':db[_0xd1e5('0x90')],'as':_0xd1e5('0x91'),'include':[{'model':db[_0xd1e5('0x83')],'as':_0xd1e5('0x92'),'where':_0x4d7702,'limit':0x1,'order':[[_0xd1e5('0x87'),_0xd1e5('0x93')]]}]},{'model':db['ChatApplication'],'as':_0xd1e5('0x94')}]});})[_0xd1e5('0x16')](handleEntityNotFound(_0x34820f,null))[_0xd1e5('0x16')](function(_0x308cca){if(_0x308cca&&_0x308cca['List']){_0x18bdc8[_0xd1e5('0x95')]=_0x308cca;_0x18bdc8[_0xd1e5('0x96')]=_0x308cca[_0xd1e5('0x94')];_0x18bdc8[_0xd1e5('0x97')]=_0x308cca[_0xd1e5('0x91')];_0x18bdc8[_0xd1e5('0x96')]=_[_0xd1e5('0x98')](_0x18bdc8[_0xd1e5('0x96')],[_0xd1e5('0x99')],['asc']);if(_0x18bdc8[_0xd1e5('0x95')][_0xd1e5('0x94')]){delete _0x18bdc8[_0xd1e5('0x95')][_0xd1e5('0x94')];}if(_0x18bdc8[_0xd1e5('0x95')][_0xd1e5('0x91')]&&_0x18bdc8[_0xd1e5('0x95')][_0xd1e5('0x91')][_0xd1e5('0x92')][_0xd1e5('0x41')]){return _0x18bdc8[_0xd1e5('0x95')]['List'][_0xd1e5('0x92')][0x0];}var _0x4a9927=_[_0xd1e5('0xc')](_0x2fc728[_0xd1e5('0x51')],{'firstName':_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0x8f')],'ListId':_0x308cca['ListId']});_0x4a9927[_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0x8d')]]=_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0x8f')];return db[_0xd1e5('0x83')][_0xd1e5('0x50')](_0x4a9927,{'fields':_0x5c070a,'raw':!![]});}})[_0xd1e5('0x16')](handleEntityNotFound(_0x34820f,null))[_0xd1e5('0x16')](function(_0x342875){_0x18bdc8['contact']=_0x342875;var _0x33e129=_0x2fc728[_0xd1e5('0x51')]['customerIp'];if(_0x2fc728[_0xd1e5('0x9a')][_0xd1e5('0x9b')]){_0x33e129=_0x2fc728[_0xd1e5('0x9a')][_0xd1e5('0x9b')];}else if(_0x2fc728[_0xd1e5('0x9a')]['x-forwarded-for']){_0x33e129=_[_0xd1e5('0x9c')](_0x2fc728[_0xd1e5('0x9a')][_0xd1e5('0x9d')][_0xd1e5('0x9e')](','));}if(_0x342875){var _0x565184={'ContactId':_0x342875['id'],'ChatWebsiteId':_0x2fc728['params']['id'],'from':(_0x342875['firstName']||'')+'\x20'+(_0x342875[_0xd1e5('0x9f')]||''),'customerIp':_0x33e129,'customerPort':_0x2fc728[_0xd1e5('0x9a')][_0xd1e5('0xa0')]?_0x2fc728[_0xd1e5('0x9a')][_0xd1e5('0xa0')]:null,'referer':_0x2fc728[_0xd1e5('0x51')]['referer'],'browserName':_0x695cef[_0xd1e5('0xa1')]['name']&&_0x695cef[_0xd1e5('0xa1')][_0xd1e5('0xa2')]?util[_0xd1e5('0xa3')](_0xd1e5('0xa4'),_0x695cef[_0xd1e5('0xa1')][_0xd1e5('0x2f')],_0x695cef['browser'][_0xd1e5('0xa2')]):_0xd1e5('0xa5'),'browserVersion':_0x695cef[_0xd1e5('0xa1')][_0xd1e5('0xa2')]||_0xd1e5('0xa5'),'osName':util['format'](_0xd1e5('0xa4'),_0x695cef['os'][_0xd1e5('0x2f')],_0x695cef['os'][_0xd1e5('0xa2')]),'osVersion':_0x695cef['os']['version'],'deviceModel':_0x695cef[_0xd1e5('0xa6')]['model']&&_0x695cef[_0xd1e5('0xa6')][_0xd1e5('0xa7')]?util[_0xd1e5('0xa3')](_0xd1e5('0xa8'),_0x695cef[_0xd1e5('0xa6')][_0xd1e5('0x39')],_0x695cef[_0xd1e5('0xa6')][_0xd1e5('0xa7')],_0x695cef[_0xd1e5('0xa6')][_0xd1e5('0x37')]):null,'deviceVendor':_0x695cef[_0xd1e5('0xa6')][_0xd1e5('0xa7')],'deviceType':_0x695cef[_0xd1e5('0xa6')]['type'],'formData':JSON[_0xd1e5('0xa9')](_0x2fc728[_0xd1e5('0x51')])};var _0x4de6c3={'ChatWebsiteId':_0x2fc728[_0xd1e5('0x4e')]['id'],'closed':![]};if(_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0xaa')]){_0x4de6c3[_0xd1e5('0xaa')]=_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0xaa')];return db[_0xd1e5('0xab')]['find']({'where':_0x4de6c3})['then'](function(_0x10fcaf){if(_0x10fcaf){return[_0x10fcaf,![]];}_0x565184[_0xd1e5('0xaa')]=_0x2fc728['body'][_0xd1e5('0xaa')];_0x565184[_0xd1e5('0xac')]=_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0xac')];return db[_0xd1e5('0xab')]['create'](_0x565184)[_0xd1e5('0x16')](function(_0x171c20){return[_0x171c20,!![]];});});}_0x4de6c3[_0xd1e5('0xad')]=_0x342875['id'];if(_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0xae')]&&_0x2fc728[_0xd1e5('0x51')]['interaction']['id']){_0x4de6c3['id']=_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0xae')]['id'];return db['ChatInteraction']['find']({'where':_0x4de6c3})['then'](function(_0x45b878){if(_0x45b878){return[_0x45b878,![]];}return db[_0xd1e5('0xab')]['create'](_0x565184)[_0xd1e5('0x16')](function(_0xce5172){return[_0xce5172,!![]];});});}return db['ChatInteraction']['create'](_0x565184)[_0xd1e5('0x16')](function(_0x406a58){return[_0x406a58,!![]];});}})[_0xd1e5('0xaf')](function(_0x12f5b4,_0x40c708){if(_0x12f5b4){_0x5a20b3=_0x40c708;if(!_0x40c708){var _0x4d675d={'from':(_0x18bdc8[_0xd1e5('0xb0')][_0xd1e5('0xb1')]||'')+'\x20'+(_0x18bdc8[_0xd1e5('0xb0')][_0xd1e5('0x9f')]||'')};if(_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0xaa')]&&_0x2fc728[_0xd1e5('0x51')]['messageId']&&_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0xaa')]!=_0x2fc728[_0xd1e5('0x51')]['messageId']){_0x4d675d[_0xd1e5('0xaa')]=_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0xb2')];}return _0x12f5b4[_0xd1e5('0x29')](_0x4d675d);}else{return _0x12f5b4;}}})['then'](function(_0x1b0d06){_0x18bdc8[_0xd1e5('0xae')]=_0x1b0d06[_0xd1e5('0x52')]({'plain':!![]});_0x18bdc8[_0xd1e5('0xae')][_0xd1e5('0xb3')]=_0x5a20b3;if(_0x18bdc8[_0xd1e5('0xae')]['created']){if(_0x18bdc8['account']['autoclose']){_0x18bdc8['applications'][_0xd1e5('0xb4')]({'id':0x0,'priority':_0x18bdc8[_0xd1e5('0x96')][_0xd1e5('0x41')]+0x1,'app':_0xd1e5('0xb5'),'appdata':_0xd1e5('0xb6'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0xd1e5('0x50')]({'body':_0x2fc728[_0xd1e5('0x51')][_0xd1e5('0x51')],'ChatWebsiteId':_0x2fc728[_0xd1e5('0x4e')]['id'],'ChatInteractionId':_0x1b0d06['id'],'direction':'in','ContactId':_0x18bdc8[_0xd1e5('0xb0')]['id'],'AttachmentId':_0x2fc728[_0xd1e5('0x51')]['AttachmentId']});})['then'](function(_0x1b66c7){_0x18bdc8['message']=_0x1b66c7;if(_0x18bdc8[_0xd1e5('0xae')][_0xd1e5('0xb7')]){return db['User'][_0xd1e5('0x4f')]({'attributes':['id',_0xd1e5('0x2f')],'where':{'id':_0x18bdc8[_0xd1e5('0xae')][_0xd1e5('0xb7')]}})[_0xd1e5('0x16')](function(_0x5d2a62){if(_0x5d2a62){_0x18bdc8[_0xd1e5('0x96')][_0xd1e5('0xb8')]({'id':0x0,'priority':0x0,'app':_0xd1e5('0xb9'),'appdata':_0x5d2a62[_0xd1e5('0x2f')]+','+(_0x18bdc8['account'][_0xd1e5('0xba')]||0xa),'interval':_0xd1e5('0xbb')});_0x18bdc8['forcedOwnership']=!![];}return respondWithRpcPromise(_0xd1e5('0xbc'),_0xd1e5('0xbd'),_0x18bdc8);});}return respondWithRpcPromise(_0xd1e5('0xbc'),_0xd1e5('0xbd'),_0x18bdc8);})[_0xd1e5('0x16')](function(_0x1f1ba6){respondWithRpcPromise(_0xd1e5('0xbe'),_0xd1e5('0xbe'),{'event':_0xd1e5('0xbf'),'message':_0x1f1ba6},client9002);return _0x1f1ba6;})['then'](respondWithResult(_0x34820f,null))[_0xd1e5('0x1f')](handleError(_0x34820f,null));};exports['offline']=function(_0x304ac9,_0x360d4b){var _0xa88d8e,_0x36cdee,_0x359a90;var _0x2b70c0=[];var _0x13020d={};var _0x273bcd=_0x304ac9[_0xd1e5('0xc0')]||[];var _0xab2f15=[];var _0x586a7b;return db[_0xd1e5('0x83')][_0xd1e5('0x58')]()[_0xd1e5('0x16')](function(_0x274242){if(!_0x274242){throw new db[(_0xd1e5('0x84'))][(_0xd1e5('0x85'))](_0xd1e5('0xc1'));}_0x2b70c0=_[_0xd1e5('0x88')](_['keys'](_0x274242),['createdAt','updatedAt','CompanyId',_0xd1e5('0x8a')]);if(_0x304ac9[_0xd1e5('0x51')]['id']){delete _0x304ac9['body']['id'];}if(_[_0xd1e5('0x72')](_0x304ac9[_0xd1e5('0x51')]['from'])){throw _0x360d4b[_0xd1e5('0x21')](0x1f4)[_0xd1e5('0x30')](new db[(_0xd1e5('0x84'))][(_0xd1e5('0x85'))](_0xd1e5('0x8b')));}if(_[_0xd1e5('0x72')](_0x304ac9[_0xd1e5('0x51')]['body'])||_0x304ac9['body'][_0xd1e5('0x51')]===''){throw _0x360d4b[_0xd1e5('0x21')](0x1f4)[_0xd1e5('0x30')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xd1e5('0x72')](_0x304ac9[_0xd1e5('0x51')][_0xd1e5('0xc2')])){throw _0x360d4b[_0xd1e5('0x21')](0x1f4)['send'](new db[(_0xd1e5('0x84'))]['ValidationError'](_0xd1e5('0xc3')+_0x2b70c0));}if(!_[_0xd1e5('0x8e')](_0x2b70c0,_0x304ac9[_0xd1e5('0x51')][_0xd1e5('0xc2')])){throw _0x360d4b[_0xd1e5('0x21')](0x1f4)['send'](new db[(_0xd1e5('0x84'))][(_0xd1e5('0x85'))](_0xd1e5('0xc4')+_0x2b70c0));}_0x13020d[_0x304ac9[_0xd1e5('0x51')][_0xd1e5('0xc2')]]=_0x304ac9['body'][_0xd1e5('0x8f')];})[_0xd1e5('0x16')](function(){return db[_0xd1e5('0x34')][_0xd1e5('0x4f')]({'where':{'id':_0x304ac9[_0xd1e5('0x4e')]['id']},'include':[{'model':db[_0xd1e5('0x90')],'as':'List'},{'model':db[_0xd1e5('0xc5')],'as':_0xd1e5('0xc5')}]});})['then'](handleEntityNotFound(_0x360d4b,null))[_0xd1e5('0x16')](function(_0x2334b6){if(_0x2334b6&&_0x2334b6[_0xd1e5('0x91')]){_0x36cdee=_0x2334b6;var _0x1a4ee8=_[_0xd1e5('0xc')](_0x304ac9[_0xd1e5('0x51')],{'firstName':_0x304ac9[_0xd1e5('0x51')][_0xd1e5('0x8f')],'phone':_0x304ac9['body'][_0xd1e5('0x8f')],'ListId':_0x2334b6[_0xd1e5('0x8a')]});_0x1a4ee8[_0x304ac9['body'][_0xd1e5('0xc2')]]=_0x304ac9[_0xd1e5('0x51')][_0xd1e5('0x8f')];return db['CmContact']['findOrCreate']({'where':_0x13020d,'defaults':_0x1a4ee8});}})[_0xd1e5('0xaf')](function(_0x49d02d){if(_0x49d02d){_0x359a90=_0x49d02d;var _0x1b5e8e=fs[_0xd1e5('0xc6')](path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],_0xd1e5('0xc7')),_0xd1e5('0xc8'));var _0x210c08=ejs[_0xd1e5('0xc9')](_0x1b5e8e,{'body':_[_0xd1e5('0xca')](_0x304ac9[_0xd1e5('0x51')][_0xd1e5('0x51')]),'bodyTitle':_0x36cdee['offlineMessageBody']});return db['ChatOfflineMessage'][_0xd1e5('0x50')]({'body':_0x210c08,'plainBody':htmlToText[_0xd1e5('0xcb')](_0x210c08),'ContactId':_0x49d02d['id'],'ChatWebsiteId':_0x36cdee['id']});}})[_0xd1e5('0x16')](function(_0x3c1d68){_0x586a7b=_0x3c1d68;if(_0x273bcd[_0xd1e5('0x41')]){var _0x55d72e=_0x273bcd['map'](function(_0x1cee09){return{'name':_0x1cee09[_0xd1e5('0xcc')],'basename':_0x1cee09[_0xd1e5('0x67')],'type':_0x1cee09['mimetype'],'ChatOfflineMessageId':_0x3c1d68['id']};});_0xab2f15=_0x55d72e[_0xd1e5('0x3a')](_0x283268=>{var _0x52101e={'filename':_0x283268[_0xd1e5('0x2f')],'path':path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],'server',_0xd1e5('0xc0'),_0xd1e5('0xcd'),_0xd1e5('0xce'),_0x283268[_0xd1e5('0xcf')])};return _0x52101e;});if(!_0x36cdee[_0xd1e5('0xd0')]){return db[_0xd1e5('0xd1')][_0xd1e5('0xd2')](function(_0x52a5c8){return db[_0xd1e5('0xd3')][_0xd1e5('0xd4')](_0x55d72e,{'transaction':_0x52a5c8});});}}})[_0xd1e5('0x16')](function(){if(_0x586a7b){_0xa88d8e=_0x586a7b;return db[_0xd1e5('0xc5')][_0xd1e5('0x5b')]({'where':{'active':!![]},'include':[{'model':db[_0xd1e5('0xd5')],'as':_0xd1e5('0xd6'),'raw':!![],'include':[{'model':db[_0xd1e5('0xd7')],'as':_0xd1e5('0xd7'),'raw':!![]}]}]});}})[_0xd1e5('0x16')](function(_0x52b885){if(_0x52b885&&_0x52b885['Smtp']&&_0x36cdee['forwardOffline']&&_0x36cdee[_0xd1e5('0xd8')]){var _0x2f151a=_0x52b885['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xd1e5('0xd9'),{'account':_0x2f151a,'message':{'from':util[_0xd1e5('0xa3')](_0xd1e5('0xda'),_0x52b885[_0xd1e5('0x2f')],_0x52b885[_0xd1e5('0xdb')]||_0x52b885[_0xd1e5('0xd6')]['user']),'to':_0x36cdee[_0xd1e5('0xd8')],'subject':_0x36cdee['offlineMessageSubject'],'html':_0xa88d8e[_0xd1e5('0x51')],'attachments':_0xab2f15}},client9003)[_0xd1e5('0x16')](function(){return _0xa88d8e;})['catch'](function(_0x3a1234){logger['error'](_0x3a1234);});}})[_0xd1e5('0x16')](function(){if(_0x36cdee&&_0x36cdee[_0xd1e5('0xd0')]&&_0x36cdee[_0xd1e5('0xdc')]){var _0x2525a7=[];if(_0x273bcd['length']){_0x2525a7=_0x273bcd[_0xd1e5('0x3a')](function(_0x465fb5){return{'name':_0x465fb5['originalname'],'basename':_0x465fb5[_0xd1e5('0x67')],'type':_0x465fb5[_0xd1e5('0xdd')],'ChatOfflineMessageId':_0x586a7b['id']};});}var _0x2c04b5;if(!_['isNil'](_0x36cdee[_0xd1e5('0xde')])){var _0x18d8f1=_[_0xd1e5('0x3a')](_0x304ac9[_0xd1e5('0x51')],function(_0x8b2bec){return _0x8b2bec;});var _0x20f32f=_[_0xd1e5('0xdf')](_0x18d8f1)[0x0];var _0x152901=_['mapValues'](_0x20f32f,function(_0x4c5408){return _0x4c5408;});_0x2c04b5=_0x152901[0x1][_0x36cdee['subjectOffline']];}var _0x3dca11={'from':_0x359a90[_0xd1e5('0xdb')],'firstName':_0x359a90[_0xd1e5('0xb1')],'lastName':_0x359a90[_0xd1e5('0x9f')],'mapKey':_0xd1e5('0xdb'),'message':{'from':_0x359a90[_0xd1e5('0xdb')],'to':_0x36cdee[_0xd1e5('0xc5')][_0xd1e5('0xdb')],'cc':'','subject':_[_0xd1e5('0x72')](_0x2c04b5)?_0x36cdee[_0xd1e5('0xe0')]:_0x2c04b5,'messageId':'','sentAt':new Date(),'attach':_0x2525a7[_0xd1e5('0x41')],'attachments':_0x2525a7,'originChannel':_0xd1e5('0xe1'),'ChatWebsiteId':_0x36cdee['id'],'ChatOfflineMessageId':_0xa88d8e['id'],'originTo':_0x36cdee[_0xd1e5('0xc5')][_0xd1e5('0xdb')]},'body':_0xa88d8e[_0xd1e5('0x51')]};var _0x214e5e={'account':{'id':_0x36cdee[_0xd1e5('0xdc')]},'body':_0x3dca11,'log':_0xd1e5('0xe2')};return respondWithRpcPromise(_0xd1e5('0xe2'),_0xd1e5('0xe3'),_0x214e5e,client9001)[_0xd1e5('0x16')](function(){return _0xa88d8e;})[_0xd1e5('0x1f')](function(_0x5cecdc){logger[_0xd1e5('0x1b')](_0x5cecdc);});}return;})[_0xd1e5('0x16')](function(){if(_0xa88d8e){return _0xa88d8e;}})[_0xd1e5('0x16')](respondWithResult(_0x360d4b,null))['catch'](function(_0x5bcfcb){logger[_0xd1e5('0x1b')]('catch',_0x5bcfcb);for(var _0x1d17a0 of _0x273bcd){var _0x5a3417=path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],_0xd1e5('0xe4'),_0xd1e5('0xc0'),_0xd1e5('0xcd'),'offline-chat',_0x1d17a0['filename']);fs_extra[_0xd1e5('0xe5')](_0x5a3417)[_0xd1e5('0x1f')](function(_0x162831){logger[_0xd1e5('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0x5a3417,_0x162831);});}});};exports[_0xd1e5('0xe6')]=function(_0x5aed11,_0x1738e0){return db[_0xd1e5('0xab')][_0xd1e5('0x4f')]({'where':{'id':_0x5aed11[_0xd1e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1738e0,null))[_0xd1e5('0x16')](function(_0x22a395){if(_0x22a395){return _0x22a395[_0xd1e5('0xe6')](_0x5aed11[_0xd1e5('0x51')]['ids'],_[_0xd1e5('0xe7')](_0x5aed11[_0xd1e5('0x51')],[_0xd1e5('0x60'),'id'])||{});}})['then'](respondWithResult(_0x1738e0,null))['catch'](handleError(_0x1738e0,null));};exports[_0xd1e5('0xe8')]=function(_0x16c5de,_0x2452fb){var _0x2e3dce={'raw':![],'where':{}};var _0x17e3e2={};var _0x58d0c0={'count':0x0,'rows':[]};return db[_0xd1e5('0x34')]['findOne']({'where':{'id':_0x16c5de[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x2452fb,null))['then'](function(_0x206aa2){if(_0x206aa2){_0x17e3e2[_0xd1e5('0x39')]=_['keys'](db[_0xd1e5('0xab')][_0xd1e5('0x35')]);_0x17e3e2[_0xd1e5('0x3c')]=_['keys'](_0x16c5de[_0xd1e5('0x3c')]);_0x17e3e2[_0xd1e5('0x3d')]=_[_0xd1e5('0x3e')](_0x17e3e2[_0xd1e5('0x39')],_0x17e3e2[_0xd1e5('0x3c')]);_0x2e3dce['attributes']=_[_0xd1e5('0x3e')](_0x17e3e2['model'],qs[_0xd1e5('0x40')](_0x16c5de[_0xd1e5('0x3c')][_0xd1e5('0x40')]));_0x2e3dce[_0xd1e5('0x3f')]=_0x2e3dce['attributes'][_0xd1e5('0x41')]?_0x2e3dce[_0xd1e5('0x3f')]:_0x17e3e2[_0xd1e5('0x39')];if(!_0x16c5de[_0xd1e5('0x3c')][_0xd1e5('0x63')]('nolimit')){_0x2e3dce[_0xd1e5('0x25')]=qs[_0xd1e5('0x25')](_0x16c5de['query'][_0xd1e5('0x25')]);_0x2e3dce['offset']=qs[_0xd1e5('0x23')](_0x16c5de[_0xd1e5('0x3c')][_0xd1e5('0x23')]);}_0x2e3dce['order']=qs['sort'](_0x16c5de['query'][_0xd1e5('0x43')]);_0x2e3dce['where']=qs['filters'](_['pick'](_0x16c5de[_0xd1e5('0x3c')],_0x17e3e2['filters']));_0x2e3dce['where']['ChatWebsiteId']=_0x206aa2['id'];if(_0x16c5de[_0xd1e5('0x3c')][_0xd1e5('0x5e')]){_0x2e3dce[_0xd1e5('0x45')]=_[_0xd1e5('0x46')](_0x2e3dce[_0xd1e5('0x45')],{'$or':_['map'](_0x2e3dce[_0xd1e5('0x3f')],function(_0x1a88d7){var _0x295d42={};_0x295d42[_0x1a88d7]={'$like':'%'+_0x16c5de[_0xd1e5('0x3c')][_0xd1e5('0x5e')]+'%'};return _0x295d42;})});}_0x2e3dce=_[_0xd1e5('0x46')]({},_0x2e3dce,_0x16c5de[_0xd1e5('0x48')]);return db[_0xd1e5('0xab')][_0xd1e5('0x26')]({'where':_0x2e3dce['where']})[_0xd1e5('0x16')](function(_0x5047f3){_0x58d0c0[_0xd1e5('0x26')]=_0x5047f3;if(_0x16c5de[_0xd1e5('0x3c')]['includeAll']){_0x2e3dce[_0xd1e5('0x4a')]=[{'model':db[_0xd1e5('0x83')],'as':_0xd1e5('0xe9'),'required':![]},{'model':db[_0xd1e5('0xea')],'as':'Owner','attributes':[_0xd1e5('0x2f'),_0xd1e5('0xeb'),_0xd1e5('0xec')],'required':![]},{'model':db[_0xd1e5('0xed')],'as':_0xd1e5('0xee'),'attributes':['id',_0xd1e5('0x2f'),_0xd1e5('0xef')],'where':_0x16c5de['query'][_0xd1e5('0xf0')]?{'id':_0x16c5de[_0xd1e5('0x3c')]['tag']}:undefined,'required':_0x16c5de['query'][_0xd1e5('0xf0')]?!![]:![]}];}return db[_0xd1e5('0xab')][_0xd1e5('0x4b')](_0x2e3dce);})['then'](function(_0x320217){_0x58d0c0[_0xd1e5('0x4c')]=_0x320217;return _0x58d0c0;});}})[_0xd1e5('0x16')](respondWithFilteredResult(_0x2452fb,_0x2e3dce))[_0xd1e5('0x1f')](handleError(_0x2452fb,null));};function iftimePromise(_0x5a3986,_0x174017){return respondWithRpcPromise(_0xd1e5('0xf1'),'getSnippet',{'command':_0x174017[_0xd1e5('0xf2')]?util[_0xd1e5('0xa3')](_0xd1e5('0xf3'),_0x5a3986[_0xd1e5('0xf4')],_0x174017[_0xd1e5('0xf2')]):util[_0xd1e5('0xa3')](_0xd1e5('0xf5'),_0x5a3986[_0xd1e5('0xf4')])},client9002)[_0xd1e5('0x16')](function(_0x368b89){var _0x4319b3=_0x368b89&&_0x368b89[_0xd1e5('0xf6')](_0xd1e5('0xf7'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x174017['id'],_0x5a3986['id'],_0x5a3986[_0xd1e5('0xf4')],_0x4319b3?_0xd1e5('0xf8'):_0xd1e5('0xf9'),_0x174017[_0xd1e5('0xf2')]?_0x174017['timezone']:'No\x20timezone');return _0x4319b3;})[_0xd1e5('0x1f')](function(_0x560cc8){logger[_0xd1e5('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x174017['id'],_0x5a3986['id'],_0x5a3986[_0xd1e5('0xf4')],util[_0xd1e5('0xfa')](_0x560cc8,{'showHidden':![],'depth':null}),_0x174017[_0xd1e5('0xf2')]?_0x174017[_0xd1e5('0xf2')]:_0xd1e5('0xfb'));return![];});}exports[_0xd1e5('0xfc')]=function(_0x5c6074,_0x29d15c){var _0xdd8419=0x0;var _0x29e774=0x0;var _0x3fe214=![];var _0x43891f;var _0x1424e2;return db[_0xd1e5('0x34')]['find']({'where':{'id':_0x5c6074[_0xd1e5('0x4e')]['id']},'include':[{'model':db[_0xd1e5('0xfd')],'as':_0xd1e5('0xfd'),'include':[{'model':db[_0xd1e5('0xfd')],'as':_0xd1e5('0xfe'),'attributes':['id',_0xd1e5('0xf4')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x29d15c,null))['then'](function(_0x3fda98){if(_0x3fda98){_0x43891f=_0x3fda98;return _0x3fda98[_0xd1e5('0xff')]({'raw':!![]});}})[_0xd1e5('0x16')](function(_0x115b27){if(_0x43891f){if(_0x115b27){_0x1424e2=_0x115b27;}}return require(_0xd1e5('0x6f'))['getLicense']();})['then'](function(_0x11308f){if(_0x11308f){_0x29e774=_0x11308f[_0xd1e5('0x100')];_0x3fe214=_0x11308f['custom'];}})[_0xd1e5('0x16')](function(){return db[_0xd1e5('0xab')]['count']({'where':{'closed':![]}});})[_0xd1e5('0x16')](function(_0x50fb45){_0xdd8419=_0x50fb45;if(_0x29e774&&_0x50fb45>_0x29e774){return db['License'][_0xd1e5('0x5b')]({'where':{'id':0x1}})[_0xd1e5('0x16')](function(_0x36ef06){if(_0x36ef06){_0x36ef06['increment'](_0xd1e5('0x101'));}});}})[_0xd1e5('0x16')](function(){if(_0x43891f[_0xd1e5('0xfd')]&&_0x43891f[_0xd1e5('0xfd')][_0xd1e5('0xfe')]){var _0x23fb83=[];for(var _0x30b760=0x0;_0x30b760<_0x43891f[_0xd1e5('0xfd')][_0xd1e5('0xfe')][_0xd1e5('0x41')];_0x30b760++){var _0x41dc07=_0x43891f['Interval'][_0xd1e5('0xfe')][_0x30b760][_0xd1e5('0x52')]({'plain':!![]});_0x23fb83['push'](iftimePromise(_0x41dc07,_0x43891f));}return BPromise[_0xd1e5('0x102')](_0x23fb83)[_0xd1e5('0x16')](function(_0x41cf69){return _[_0xd1e5('0x103')](_0x41cf69);});}else{return!![];}})[_0xd1e5('0x16')](function(_0x2dcd44){var _0x39fd31=fs[_0xd1e5('0xc6')](path[_0xd1e5('0x74')](config[_0xd1e5('0x6d')],_0xd1e5('0x104')),'utf8');var _0x517d61={'remote':_0x43891f[_0xd1e5('0x105')],'query':querystring[_0xd1e5('0xa9')](_[_0xd1e5('0x46')](_0x43891f[_0xd1e5('0x52')]({'plain':!![]}),{'customerIp':_0x5c6074[_0xd1e5('0x9a')]['x-forwarded-for']||_0x5c6074[_0xd1e5('0x9a')][_0xd1e5('0x106')]||_0x5c6074[_0xd1e5('0x107')]['remoteAddress']||_0x5c6074['ip'],'referer':_0x5c6074[_0xd1e5('0x9a')][_0xd1e5('0x108')],'openedInteractions':_0xdd8419,'maxInteractions':_0x29e774,'virtual':_0x3fe214[_0xd1e5('0x100')],'online':_0x2dcd44,'custom':_0x3fe214}))[_0xd1e5('0x109')](/'/g,'\x5c\x27')};_0x29d15c[_0xd1e5('0x30')](ejs[_0xd1e5('0xc9')](Mustache[_0xd1e5('0xc9')](_0x39fd31,_0x517d61),{'proactiveActions':_0x1424e2,'alignment':_0x43891f[_0xd1e5('0x10a')],'verticalAlignment':_0x43891f[_0xd1e5('0x10b')],'div_color':_0x43891f[_0xd1e5('0xef')],'labelText':_0x43891f[_0xd1e5('0x10c')],'text_color':_0x43891f[_0xd1e5('0x10d')],'button_color':_0x43891f['color_button'],'background_color':_0x43891f[_0xd1e5('0x10e')],'hideWhenOffline':_0x43891f['hideWhenOffline'],'interval':_0x43891f[_0xd1e5('0x10f')]}));})['catch'](handleError(_0x29d15c,null));};exports[_0xd1e5('0x110')]=function(_0x1c2b5d,_0x583461){var _0x4f160d=_0x1c2b5d[_0xd1e5('0x4e')]['id'];var _0x1ee32f=_0x1c2b5d[_0xd1e5('0x51')];var _0x4f9f40=0xc8;var _0x3e0573=null;return db[_0xd1e5('0xd1')][_0xd1e5('0xd2')]({'isolationLevel':db[_0xd1e5('0xd1')][_0xd1e5('0x111')][_0xd1e5('0x112')][_0xd1e5('0x113')]},function(_0x2ef09f){return db['ChatWebsite']['findOne']({'where':{'id':_0x4f160d},'transaction':_0x2ef09f})['then'](function(_0x24b4c3){if(_0x24b4c3){return db[_0xd1e5('0x114')][_0xd1e5('0x2c')]({'where':{'ChatWebsiteId':_0x4f160d},'transaction':_0x2ef09f})[_0xd1e5('0x16')](function(){var _0x13d401=_[_0xd1e5('0x3a')](_0x1ee32f,function(_0x483d4f){_0x483d4f[_0xd1e5('0x5d')]=_0x4f160d;return _0x483d4f;});return db['ChatApplication'][_0xd1e5('0xd4')](_0x13d401,{'transaction':_0x2ef09f});});}else{_0x4f9f40=0x194;_0x3e0573=[];}});})[_0xd1e5('0x16')](function(){if(_0x4f9f40!==0x194){return db[_0xd1e5('0x114')][_0xd1e5('0x115')]({'where':{'ChatWebsiteId':_0x4f160d},'order':_0xd1e5('0x99')})[_0xd1e5('0x16')](function(_0x1b89ea){_0x3e0573=_0x1b89ea;});}})[_0xd1e5('0x1f')](function(_0x3a5b99){_0x4f9f40=0x1f4;logger[_0xd1e5('0x1b')](_0x3a5b99[_0xd1e5('0x2e')]);if(_0x3a5b99[_0xd1e5('0x2f')]){delete _0x3a5b99[_0xd1e5('0x2f')];}_0x3e0573=_0x3a5b99;})[_0xd1e5('0x116')](function(){if(_0x3e0573===null){_0x583461[_0xd1e5('0x20')](_0x4f9f40);}else{if(_0x4f9f40===0x1f4){_0x583461[_0xd1e5('0x21')](_0x4f9f40)[_0xd1e5('0x30')](_0x3e0573);}else{_0x583461[_0xd1e5('0x21')](_0x4f9f40)[_0xd1e5('0x22')](_0x3e0573);}}});};exports[_0xd1e5('0x117')]=function(_0xe81d1e,_0xc72656){var _0x342788={};var _0x152fe2={};var _0x2a57f8;var _0x1df0ba;return db[_0xd1e5('0x34')]['findOne']({'where':{'id':_0xe81d1e[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0xc72656,null))[_0xd1e5('0x16')](function(_0x425234){if(_0x425234){_0x2a57f8=_0x425234;_0x152fe2[_0xd1e5('0x39')]=_[_0xd1e5('0x3b')](db[_0xd1e5('0x114')]['rawAttributes']);_0x152fe2[_0xd1e5('0x3c')]=_['keys'](_0xe81d1e[_0xd1e5('0x3c')]);_0x152fe2['filters']=_[_0xd1e5('0x3e')](_0x152fe2[_0xd1e5('0x39')],_0x152fe2[_0xd1e5('0x3c')]);_0x342788[_0xd1e5('0x3f')]=_[_0xd1e5('0x3e')](_0x152fe2[_0xd1e5('0x39')],qs['fields'](_0xe81d1e[_0xd1e5('0x3c')][_0xd1e5('0x40')]));_0x342788[_0xd1e5('0x3f')]=_0x342788[_0xd1e5('0x3f')][_0xd1e5('0x41')]?_0x342788[_0xd1e5('0x3f')]:_0x152fe2[_0xd1e5('0x39')];_0x342788[_0xd1e5('0x5c')]=qs['sort'](_0xe81d1e[_0xd1e5('0x3c')]['sort']);_0x342788['where']=qs[_0xd1e5('0x3d')](_['pick'](_0xe81d1e[_0xd1e5('0x3c')],_0x152fe2[_0xd1e5('0x3d')]));if(_0xe81d1e[_0xd1e5('0x3c')][_0xd1e5('0x5e')]){_0x342788[_0xd1e5('0x45')]=_[_0xd1e5('0x46')](_0x342788[_0xd1e5('0x45')],{'$or':_[_0xd1e5('0x3a')](_0x342788['attributes'],function(_0x5e4b67){var _0x482fb4={};_0x482fb4[_0x5e4b67]={'$like':'%'+_0xe81d1e['query']['filter']+'%'};return _0x482fb4;})});}_0x342788=_[_0xd1e5('0x46')]({},_0x342788,_0xe81d1e['options']);return _0x2a57f8[_0xd1e5('0x117')](_0x342788);}})[_0xd1e5('0x16')](function(_0x38a8f9){if(_0x38a8f9){_0x1df0ba=_0x38a8f9[_0xd1e5('0x41')];if(!_0xe81d1e[_0xd1e5('0x3c')]['hasOwnProperty'](_0xd1e5('0x42'))){_0x342788['limit']=qs[_0xd1e5('0x25')](_0xe81d1e[_0xd1e5('0x3c')]['limit']);_0x342788[_0xd1e5('0x23')]=qs['offset'](_0xe81d1e[_0xd1e5('0x3c')][_0xd1e5('0x23')]);}return _0x2a57f8[_0xd1e5('0x117')](_0x342788);}})[_0xd1e5('0x16')](function(_0x2c8e2f){if(_0x2c8e2f){return _0x2c8e2f?{'count':_0x1df0ba,'rows':_0x2c8e2f}:null;}})['then'](respondWithResult(_0xc72656,null))['catch'](handleError(_0xc72656,null));};exports[_0xd1e5('0x118')]=function(_0x59dda3,_0x1e320e){return db[_0xd1e5('0x119')][_0xd1e5('0x4f')]({'where':{'id':_0x59dda3[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x1e320e,null))[_0xd1e5('0x16')](function(_0x4ea63a){if(_0x4ea63a){return _0x4ea63a[_0xd1e5('0x118')](_0x59dda3['body']['ids'],_[_0xd1e5('0xe7')](_0x59dda3[_0xd1e5('0x51')],[_0xd1e5('0x60'),'id'])||{});}})['then'](respondWithResult(_0x1e320e,null))['catch'](handleError(_0x1e320e,null));};exports[_0xd1e5('0xff')]=function(_0x1231f0,_0x56ece0){var _0x5e990a={};var _0x370855={};var _0x1779b3;var _0x2549d8;return db[_0xd1e5('0x34')][_0xd1e5('0x5b')]({'where':{'id':_0x1231f0['params']['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x56ece0,null))['then'](function(_0x1367c3){if(_0x1367c3){_0x1779b3=_0x1367c3;_0x370855['model']=_['keys'](db[_0xd1e5('0x11a')][_0xd1e5('0x35')]);_0x370855[_0xd1e5('0x3c')]=_[_0xd1e5('0x3b')](_0x1231f0[_0xd1e5('0x3c')]);_0x370855[_0xd1e5('0x3d')]=_[_0xd1e5('0x3e')](_0x370855[_0xd1e5('0x39')],_0x370855[_0xd1e5('0x3c')]);_0x5e990a[_0xd1e5('0x3f')]=_['intersection'](_0x370855[_0xd1e5('0x39')],qs[_0xd1e5('0x40')](_0x1231f0['query']['fields']));_0x5e990a[_0xd1e5('0x3f')]=_0x5e990a[_0xd1e5('0x3f')][_0xd1e5('0x41')]?_0x5e990a[_0xd1e5('0x3f')]:_0x370855[_0xd1e5('0x39')];_0x5e990a[_0xd1e5('0x5c')]=qs['sort'](_0x1231f0[_0xd1e5('0x3c')][_0xd1e5('0x43')]);_0x5e990a['where']=qs[_0xd1e5('0x3d')](_[_0xd1e5('0x44')](_0x1231f0[_0xd1e5('0x3c')],_0x370855['filters']));if(_0x1231f0[_0xd1e5('0x3c')][_0xd1e5('0x5e')]){_0x5e990a[_0xd1e5('0x45')]=_['merge'](_0x5e990a[_0xd1e5('0x45')],{'$or':_[_0xd1e5('0x3a')](_0x5e990a[_0xd1e5('0x3f')],function(_0x2d2dfb){var _0x48bbd6={};_0x48bbd6[_0x2d2dfb]={'$like':'%'+_0x1231f0[_0xd1e5('0x3c')][_0xd1e5('0x5e')]+'%'};return _0x48bbd6;})});}_0x5e990a=_[_0xd1e5('0x46')]({},_0x5e990a,_0x1231f0[_0xd1e5('0x48')]);return _0x1779b3['getProactiveActions'](_0x5e990a);}})[_0xd1e5('0x16')](function(_0x261b29){if(_0x261b29){_0x2549d8=_0x261b29['length'];if(!_0x1231f0['query'][_0xd1e5('0x63')](_0xd1e5('0x42'))){_0x5e990a[_0xd1e5('0x25')]=qs['limit'](_0x1231f0[_0xd1e5('0x3c')][_0xd1e5('0x25')]);_0x5e990a[_0xd1e5('0x23')]=qs[_0xd1e5('0x23')](_0x1231f0[_0xd1e5('0x3c')][_0xd1e5('0x23')]);}return _0x1779b3[_0xd1e5('0xff')](_0x5e990a);}})[_0xd1e5('0x16')](function(_0x207326){if(_0x207326){return _0x207326?{'count':_0x2549d8,'rows':_0x207326}:null;}})[_0xd1e5('0x16')](respondWithResult(_0x56ece0,null))[_0xd1e5('0x1f')](handleError(_0x56ece0,null));};exports[_0xd1e5('0x11b')]=function(_0x1a988b,_0x241a53){var _0x45a050=_0x1a988b[_0xd1e5('0x3c')][_0xd1e5('0x11c')]==='false'?_0xd1e5('0x11d'):'onlineForm';return db[_0xd1e5('0x34')]['find']({'attributes':['id',_0x45a050],'where':{'id':_0x1a988b['params']['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x241a53,null))[_0xd1e5('0x16')](function(_0x40c8df){if(_0x40c8df){var _0x3cba02=_0x40c8df[_0x45a050];var _0x49dd8a=_0x3cba02&&_0x3cba02[_0xd1e5('0x11e')]?_0x3cba02[_0xd1e5('0x11e')]:[];_0x241a53[_0xd1e5('0x30')]({'fromKey':_[_0xd1e5('0x72')](_0x3cba02[_0xd1e5('0x11f')])?undefined:_0x3cba02[_0xd1e5('0x11f')],'count':_0x49dd8a[_0xd1e5('0x41')],'rows':_0x49dd8a});}})[_0xd1e5('0x1f')](handleError(_0x241a53,null));};exports['getOfflineMessages']=function(_0x5af8de,_0x59b2d3){var _0x2ac16e={'raw':![],'where':{}};var _0x1a75fa={};var _0x5cbf51={'count':0x0,'rows':[]};return db[_0xd1e5('0x34')]['findOne']({'where':{'id':_0x5af8de[_0xd1e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59b2d3,null))[_0xd1e5('0x16')](function(_0x1a8554){if(_0x1a8554){_0x1a75fa[_0xd1e5('0x39')]=_[_0xd1e5('0x3b')](db[_0xd1e5('0x120')]['rawAttributes']);_0x1a75fa[_0xd1e5('0x3c')]=_['keys'](_0x5af8de['query']);_0x1a75fa[_0xd1e5('0x3d')]=_['intersection'](_0x1a75fa[_0xd1e5('0x39')],_0x1a75fa[_0xd1e5('0x3c')]);_0x2ac16e[_0xd1e5('0x3f')]=_['intersection'](_0x1a75fa[_0xd1e5('0x39')],qs[_0xd1e5('0x40')](_0x5af8de[_0xd1e5('0x3c')][_0xd1e5('0x40')]));_0x2ac16e[_0xd1e5('0x3f')]=_0x2ac16e[_0xd1e5('0x3f')][_0xd1e5('0x41')]?_0x2ac16e[_0xd1e5('0x3f')]:_0x1a75fa['model'];if(!_0x5af8de[_0xd1e5('0x3c')][_0xd1e5('0x63')](_0xd1e5('0x42'))){_0x2ac16e[_0xd1e5('0x25')]=qs[_0xd1e5('0x25')](_0x5af8de[_0xd1e5('0x3c')][_0xd1e5('0x25')]);_0x2ac16e[_0xd1e5('0x23')]=qs[_0xd1e5('0x23')](_0x5af8de[_0xd1e5('0x3c')][_0xd1e5('0x23')]);}_0x2ac16e['order']=qs[_0xd1e5('0x43')](_0x5af8de[_0xd1e5('0x3c')][_0xd1e5('0x43')]);_0x2ac16e[_0xd1e5('0x45')]=qs[_0xd1e5('0x3d')](_[_0xd1e5('0x44')](_0x5af8de[_0xd1e5('0x3c')],_0x1a75fa[_0xd1e5('0x3d')]));_0x2ac16e[_0xd1e5('0x45')]['ChatWebsiteId']=_0x1a8554['id'];if(_0x5af8de[_0xd1e5('0x3c')]['filter']){_0x2ac16e[_0xd1e5('0x45')]=_[_0xd1e5('0x46')](_0x2ac16e[_0xd1e5('0x45')],{'$or':_['map'](_0x2ac16e[_0xd1e5('0x3f')],function(_0x350544){var _0x34c0c3={};_0x34c0c3[_0x350544]={'$like':'%'+_0x5af8de[_0xd1e5('0x3c')]['filter']+'%'};return _0x34c0c3;})});}_0x2ac16e=_[_0xd1e5('0x46')]({},_0x2ac16e,_0x5af8de[_0xd1e5('0x48')]);return db[_0xd1e5('0x120')]['count']({'where':_0x2ac16e[_0xd1e5('0x45')]})['then'](function(_0x32c428){_0x5cbf51['count']=_0x32c428;if(_0x5af8de[_0xd1e5('0x3c')][_0xd1e5('0x49')]){_0x2ac16e['include']=[{'all':!![]}];}else{_0x2ac16e[_0xd1e5('0x4a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xd1e5('0x120')][_0xd1e5('0x4b')](_0x2ac16e);})[_0xd1e5('0x16')](function(_0x55e45d){_0x5cbf51[_0xd1e5('0x4c')]=_0x55e45d;return _0x5cbf51;});}})[_0xd1e5('0x16')](respondWithFilteredResult(_0x59b2d3,_0x2ac16e))[_0xd1e5('0x1f')](handleError(_0x59b2d3,null));};exports[_0xd1e5('0x121')]=function(_0x595d54,_0x5c19bb){return db[_0xd1e5('0x34')][_0xd1e5('0x4f')]({'where':{'id':_0x595d54[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x5c19bb,null))[_0xd1e5('0x16')](function(_0x32281d){if(_0x32281d){return _0x32281d[_0xd1e5('0x121')](_0x595d54['body'][_0xd1e5('0x60')],_[_0xd1e5('0xe7')](_0x595d54[_0xd1e5('0x51')],[_0xd1e5('0x60'),'id'])||{})[_0xd1e5('0xaf')](function(_0x29cacc){for(var _0x58f3a7=0x0;_0x58f3a7<_0x595d54[_0xd1e5('0x51')]['ids']['length'];_0x58f3a7+=0x1){socket[_0xd1e5('0x122')](_0xd1e5('0x123'),{'UserId':Number(_0x595d54[_0xd1e5('0x51')][_0xd1e5('0x60')][_0x58f3a7]),'ChatWebsiteId':Number(_0x595d54[_0xd1e5('0x4e')]['id'])});}return _0x29cacc;});}})[_0xd1e5('0x16')](respondWithResult(_0x5c19bb,null))[_0xd1e5('0x1f')](handleError(_0x5c19bb,null));};exports[_0xd1e5('0x124')]=function(_0x43968d,_0x18b7c2){return db[_0xd1e5('0x34')][_0xd1e5('0x4f')]({'where':{'id':_0x43968d[_0xd1e5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x18b7c2,null))[_0xd1e5('0x16')](function(_0x4e1f4){if(_0x4e1f4){return _0x4e1f4[_0xd1e5('0x124')](_0x43968d[_0xd1e5('0x3c')]['ids'])[_0xd1e5('0x16')](function(){if(_[_0xd1e5('0x125')](_0x43968d[_0xd1e5('0x3c')][_0xd1e5('0x60')])){for(var _0x486895=0x0;_0x486895<_0x43968d[_0xd1e5('0x3c')][_0xd1e5('0x60')][_0xd1e5('0x41')];_0x486895+=0x1){socket[_0xd1e5('0x122')](_0xd1e5('0x126'),{'UserId':Number(_0x43968d[_0xd1e5('0x3c')]['ids'][_0x486895]),'ChatWebsiteId':Number(_0x43968d[_0xd1e5('0x4e')]['id'])});}}else{socket['emit'](_0xd1e5('0x126'),{'UserId':Number(_0x43968d[_0xd1e5('0x3c')]['ids']),'ChatWebsiteId':Number(_0x43968d[_0xd1e5('0x4e')]['id'])});}});}})[_0xd1e5('0x16')](respondWithStatusCode(_0x18b7c2,null))['catch'](handleError(_0x18b7c2,null));};exports[_0xd1e5('0x127')]=function(_0x38d5ec,_0x172948){var _0x59fbc8={};var _0x49759a={};var _0x30e32b;var _0x3cdde4;return db['ChatWebsite'][_0xd1e5('0x5b')]({'where':{'id':_0x38d5ec[_0xd1e5('0x4e')]['id']}})[_0xd1e5('0x16')](handleEntityNotFound(_0x172948,null))[_0xd1e5('0x16')](function(_0x39fab2){if(_0x39fab2){_0x30e32b=_0x39fab2;_0x49759a['model']=_[_0xd1e5('0x3b')](db[_0xd1e5('0xea')][_0xd1e5('0x35')]);_0x49759a[_0xd1e5('0x3c')]=_[_0xd1e5('0x3b')](_0x38d5ec[_0xd1e5('0x3c')]);_0x49759a[_0xd1e5('0x3d')]=_[_0xd1e5('0x3e')](_0x49759a[_0xd1e5('0x39')],_0x49759a[_0xd1e5('0x3c')]);_0x59fbc8['attributes']=_[_0xd1e5('0x3e')](_0x49759a[_0xd1e5('0x39')],qs['fields'](_0x38d5ec[_0xd1e5('0x3c')][_0xd1e5('0x40')]));_0x59fbc8[_0xd1e5('0x3f')]=_0x59fbc8[_0xd1e5('0x3f')][_0xd1e5('0x41')]?_0x59fbc8[_0xd1e5('0x3f')]:_0x49759a['model'];_0x59fbc8[_0xd1e5('0x5c')]=qs[_0xd1e5('0x43')](_0x38d5ec[_0xd1e5('0x3c')][_0xd1e5('0x43')]);_0x59fbc8[_0xd1e5('0x45')]=qs[_0xd1e5('0x3d')](_[_0xd1e5('0x44')](_0x38d5ec['query'],_0x49759a[_0xd1e5('0x3d')]));if(_0x38d5ec[_0xd1e5('0x3c')]['filter']){_0x59fbc8[_0xd1e5('0x45')]=_[_0xd1e5('0x46')](_0x59fbc8[_0xd1e5('0x45')],{'$or':_['map'](_0x59fbc8[_0xd1e5('0x3f')],function(_0x46c8bf){var _0x455e5b={};_0x455e5b[_0x46c8bf]={'$like':'%'+_0x38d5ec['query'][_0xd1e5('0x5e')]+'%'};return _0x455e5b;})});}_0x59fbc8=_[_0xd1e5('0x46')]({},_0x59fbc8,_0x38d5ec[_0xd1e5('0x48')]);return _0x30e32b[_0xd1e5('0x127')](_0x59fbc8);}})['then'](function(_0x1f1104){if(_0x1f1104){_0x3cdde4=_0x1f1104['length'];if(!_0x38d5ec[_0xd1e5('0x3c')]['hasOwnProperty']('nolimit')){_0x59fbc8[_0xd1e5('0x25')]=qs[_0xd1e5('0x25')](_0x38d5ec[_0xd1e5('0x3c')][_0xd1e5('0x25')]);_0x59fbc8['offset']=qs[_0xd1e5('0x23')](_0x38d5ec['query'][_0xd1e5('0x23')]);}return _0x30e32b[_0xd1e5('0x127')](_0x59fbc8);}})['then'](function(_0x402de0){if(_0x402de0){return _0x402de0?{'count':_0x3cdde4,'rows':_0x402de0}:null;}})[_0xd1e5('0x16')](respondWithResult(_0x172948,null))[_0xd1e5('0x1f')](handleError(_0x172948,null));}; \ No newline at end of file +var _0x6ffc=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','applications','orderBy','priority','account','customerIp','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','unknown','device','format','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','basename','transaction','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','openNewInteraction','mimetype','toPairsIn','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','all','server/files/chat/iframe.ejs','x-real-ip','connection','remoteAddress','replace','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','destroy','bulkCreate','findAndCountAll','finally','getApplications','chatProactiveAction','omit','ChatProactiveAction','getFields','online','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','count','set','json','update','then','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','type','options','include','ChatWebsite','findAll','rows','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','hasOwnProperty','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','join','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x32e662,_0x4da453){var _0x4f62f2=function(_0x46ead3){while(--_0x46ead3){_0x32e662['push'](_0x32e662['shift']());}};_0x4f62f2(++_0x4da453);}(_0x6ffc,0x1b4));var _0xc6ff=function(_0x4ee963,_0x2b9984){_0x4ee963=_0x4ee963-0x0;var _0x5d41f5=_0x6ffc[_0x4ee963];return _0x5d41f5;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xc6ff('0x0'));var util=require(_0xc6ff('0x1'));var path=require(_0xc6ff('0x2'));var ejs=require(_0xc6ff('0x3'));var fs=require('fs');var fs_extra=require(_0xc6ff('0x4'));var _=require(_0xc6ff('0x5'));var querystring=require('querystring');var Redis=require(_0xc6ff('0x6'));var qs=require(_0xc6ff('0x7'));var logger=require(_0xc6ff('0x8'))(_0xc6ff('0x9'));var config=require(_0xc6ff('0xa'));var db=require(_0xc6ff('0xb'))['db'];config['redis']=_[_0xc6ff('0xc')](config[_0xc6ff('0xd')],{'host':_0xc6ff('0xe'),'port':0x18eb});var socket=require(_0xc6ff('0xf'))(new Redis(config[_0xc6ff('0xd')]));require(_0xc6ff('0x10'))[_0xc6ff('0x11')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xc6ff('0x12'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc6ff('0x13')][_0xc6ff('0x14')]({'port':0x232a});var client9003=jayson['client'][_0xc6ff('0x14')]({'port':0x232b});var client9001=jayson['client'][_0xc6ff('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x7ee11b,_0x48b0eb,_0x2b456b,_0x5e7e2a){return new BPromise(function(_0x3bb3d8,_0xd6752d){var _0x1ccd71=_0x5e7e2a||client;return _0x1ccd71['request'](_0x7ee11b,_0x2b456b)['then'](function(_0x10bbea){logger[_0xc6ff('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x48b0eb,_0xc6ff('0x16'));logger[_0xc6ff('0x17')](_0xc6ff('0x18'),_0x48b0eb,_0xc6ff('0x16'),JSON[_0xc6ff('0x19')](_0x10bbea));if(_0x10bbea[_0xc6ff('0x1a')]){if(_0x10bbea[_0xc6ff('0x1a')]['code']===0x1f4){logger[_0xc6ff('0x1a')](_0xc6ff('0x1b'),_0x48b0eb,_0x10bbea[_0xc6ff('0x1a')][_0xc6ff('0x1c')]);return _0xd6752d(_0x10bbea['error'][_0xc6ff('0x1c')]);}logger[_0xc6ff('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x48b0eb,_0x10bbea[_0xc6ff('0x1a')][_0xc6ff('0x1c')]);return _0x3bb3d8(_0x10bbea[_0xc6ff('0x1a')][_0xc6ff('0x1c')]);}else{logger[_0xc6ff('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x48b0eb,_0xc6ff('0x16'));_0x3bb3d8(_0x10bbea[_0xc6ff('0x1d')][_0xc6ff('0x1c')]);}})[_0xc6ff('0x1e')](function(_0x15ca07){logger[_0xc6ff('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x48b0eb,_0x15ca07);_0xd6752d(_0x15ca07);});});}function respondWithStatusCode(_0x126c5a,_0xc5417c){_0xc5417c=_0xc5417c||0xcc;return function(_0x8b31de){if(_0x8b31de){return _0x126c5a[_0xc6ff('0x1f')](_0xc5417c);}return _0x126c5a[_0xc6ff('0x20')](_0xc5417c)[_0xc6ff('0x21')]();};}function respondWithResult(_0x55dd69,_0x9c21ce){_0x9c21ce=_0x9c21ce||0xc8;return function(_0x3a1e79){if(_0x3a1e79){return _0x55dd69[_0xc6ff('0x20')](_0x9c21ce)['json'](_0x3a1e79);}};}function respondWithFilteredResult(_0x2ed60b,_0x3471f2){return function(_0x7b1e5f){if(_0x7b1e5f){var _0x334cb9=typeof _0x3471f2[_0xc6ff('0x22')]==='undefined'&&typeof _0x3471f2['limit']==='undefined';var _0x463078=_0x7b1e5f[_0xc6ff('0x23')];var _0x254794=_0x334cb9?0x0:_0x3471f2[_0xc6ff('0x22')];var _0x573123=_0x334cb9?_0x7b1e5f[_0xc6ff('0x23')]:_0x3471f2[_0xc6ff('0x22')]+_0x3471f2['limit'];var _0x23874c;if(_0x573123>=_0x463078){_0x573123=_0x463078;_0x23874c=0xc8;}else{_0x23874c=0xce;}_0x2ed60b['status'](_0x23874c);return _0x2ed60b[_0xc6ff('0x24')]('Content-Range',_0x254794+'-'+_0x573123+'/'+_0x463078)[_0xc6ff('0x25')](_0x7b1e5f);}return null;};}function saveUpdates(_0x3e7ae5){return function(_0xc121d9){if(_0xc121d9){return _0xc121d9[_0xc6ff('0x26')](_0x3e7ae5)[_0xc6ff('0x27')](function(_0x45ff53){return _0x45ff53;});}return null;};}function removeEntity(_0x4a8127){return function(_0x2023b8){if(_0x2023b8){return _0x2023b8['destroy']()[_0xc6ff('0x27')](function(){var _0x42afd9=_0x2023b8[_0xc6ff('0x28')]({'plain':!![]});var _0x4157b0=_0xc6ff('0x29');return db[_0xc6ff('0x2a')]['destroy']({'where':{'type':_0x4157b0,'resourceId':_0x42afd9['id']}})['then'](function(){return _0x2023b8;});})[_0xc6ff('0x27')](function(){_0x4a8127[_0xc6ff('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x550156){return function(_0x50eb20){if(!_0x50eb20){_0x550156['sendStatus'](0x194);}return _0x50eb20;};}function handleError(_0x30c041,_0x54fbb0){_0x54fbb0=_0x54fbb0||0x1f4;return function(_0x40d445){logger['error'](_0x40d445[_0xc6ff('0x2b')]);if(_0x40d445[_0xc6ff('0x2c')]){delete _0x40d445[_0xc6ff('0x2c')];}_0x30c041[_0xc6ff('0x20')](_0x54fbb0)[_0xc6ff('0x2d')](_0x40d445);};}exports[_0xc6ff('0x2e')]=function(_0x7bf691,_0x52e741){var _0x3a26b2={'include':[{'model':db[_0xc6ff('0x2f')],'as':'mandatoryDispositionPause'}]},_0x460a0b={},_0x2b0da0={'count':0x0,'rows':[]};var _0x4052cd=_[_0xc6ff('0x30')](db['ChatWebsite'][_0xc6ff('0x31')],function(_0xddb8e6){return{'name':_0xddb8e6[_0xc6ff('0x32')],'type':_0xddb8e6['type']['key']};});_0x460a0b[_0xc6ff('0x33')]=_[_0xc6ff('0x30')](_0x4052cd,'name');_0x460a0b[_0xc6ff('0x34')]=_[_0xc6ff('0x35')](_0x7bf691[_0xc6ff('0x34')]);_0x460a0b[_0xc6ff('0x36')]=_[_0xc6ff('0x37')](_0x460a0b[_0xc6ff('0x33')],_0x460a0b[_0xc6ff('0x34')]);_0x3a26b2[_0xc6ff('0x38')]=_[_0xc6ff('0x37')](_0x460a0b[_0xc6ff('0x33')],qs[_0xc6ff('0x39')](_0x7bf691[_0xc6ff('0x34')][_0xc6ff('0x39')]));_0x3a26b2[_0xc6ff('0x38')]=_0x3a26b2[_0xc6ff('0x38')][_0xc6ff('0x3a')]?_0x3a26b2[_0xc6ff('0x38')]:_0x460a0b['model'];if(!_0x7bf691[_0xc6ff('0x34')]['hasOwnProperty'](_0xc6ff('0x3b'))){_0x3a26b2[_0xc6ff('0x3c')]=qs['limit'](_0x7bf691[_0xc6ff('0x34')][_0xc6ff('0x3c')]);_0x3a26b2['offset']=qs[_0xc6ff('0x22')](_0x7bf691[_0xc6ff('0x34')][_0xc6ff('0x22')]);}_0x3a26b2[_0xc6ff('0x3d')]=qs['sort'](_0x7bf691[_0xc6ff('0x34')][_0xc6ff('0x3e')]);_0x3a26b2['where']=qs[_0xc6ff('0x36')](_[_0xc6ff('0x3f')](_0x7bf691[_0xc6ff('0x34')],_0x460a0b[_0xc6ff('0x36')]),_0x4052cd);if(_0x7bf691[_0xc6ff('0x34')][_0xc6ff('0x40')]){_0x3a26b2[_0xc6ff('0x41')]=_[_0xc6ff('0x42')](_0x3a26b2[_0xc6ff('0x41')],{'$or':_[_0xc6ff('0x30')](_0x4052cd,function(_0xcb9fc){if(_0xcb9fc[_0xc6ff('0x43')]!=='VIRTUAL'){var _0x3bfd40={};_0x3bfd40[_0xcb9fc[_0xc6ff('0x2c')]]={'$like':'%'+_0x7bf691[_0xc6ff('0x34')]['filter']+'%'};return _0x3bfd40;}})});}_0x3a26b2=_[_0xc6ff('0x42')]({},_0x3a26b2,_0x7bf691[_0xc6ff('0x44')]);var _0x18ac91={'where':_0x3a26b2[_0xc6ff('0x41')]};return db['ChatWebsite'][_0xc6ff('0x23')](_0x18ac91)[_0xc6ff('0x27')](function(_0x1785f7){_0x2b0da0[_0xc6ff('0x23')]=_0x1785f7;if(_0x7bf691[_0xc6ff('0x34')]['includeAll']){_0x3a26b2[_0xc6ff('0x45')]=[{'all':!![]}];}return db[_0xc6ff('0x46')][_0xc6ff('0x47')](_0x3a26b2);})['then'](function(_0x3221e4){_0x2b0da0[_0xc6ff('0x48')]=_0x3221e4;return _0x2b0da0;})[_0xc6ff('0x27')](respondWithFilteredResult(_0x52e741,_0x3a26b2))['catch'](handleError(_0x52e741,null));};exports['show']=function(_0x5dd184,_0xf465cb){var _0x2a6a5a={'raw':![],'where':{'id':_0x5dd184[_0xc6ff('0x49')]['id']},'include':[{'model':db[_0xc6ff('0x2f')],'as':'mandatoryDispositionPause'}]},_0x369593={};_0x369593[_0xc6ff('0x33')]=_[_0xc6ff('0x35')](db[_0xc6ff('0x46')][_0xc6ff('0x31')]);_0x369593['query']=_['keys'](_0x5dd184[_0xc6ff('0x34')]);_0x369593[_0xc6ff('0x36')]=_[_0xc6ff('0x37')](_0x369593[_0xc6ff('0x33')],_0x369593[_0xc6ff('0x34')]);_0x2a6a5a[_0xc6ff('0x38')]=_[_0xc6ff('0x37')](_0x369593[_0xc6ff('0x33')],qs[_0xc6ff('0x39')](_0x5dd184[_0xc6ff('0x34')]['fields']));_0x2a6a5a[_0xc6ff('0x38')]=_0x2a6a5a['attributes'][_0xc6ff('0x3a')]?_0x2a6a5a['attributes']:_0x369593['model'];if(_0x5dd184[_0xc6ff('0x34')][_0xc6ff('0x4a')]){_0x2a6a5a['include']=[{'all':!![]}];}_0x2a6a5a=_[_0xc6ff('0x42')]({},_0x2a6a5a,_0x5dd184[_0xc6ff('0x44')]);return db[_0xc6ff('0x46')][_0xc6ff('0x4b')](_0x2a6a5a)[_0xc6ff('0x27')](handleEntityNotFound(_0xf465cb,null))[_0xc6ff('0x27')](respondWithResult(_0xf465cb,null))[_0xc6ff('0x1e')](handleError(_0xf465cb,null));};exports[_0xc6ff('0x4c')]=function(_0x431c14,_0x22b141){return db[_0xc6ff('0x46')][_0xc6ff('0x4c')](_0x431c14[_0xc6ff('0x4d')],{})['then'](function(_0x3b4272){var _0x1d0740=_0x431c14[_0xc6ff('0x4e')][_0xc6ff('0x28')]({'plain':!![]});if(!_0x1d0740)throw new Error(_0xc6ff('0x4f'));if(_0x1d0740[_0xc6ff('0x50')]===_0xc6ff('0x4e')){var _0x39dc83=_0x3b4272[_0xc6ff('0x28')]({'plain':!![]});var _0x14a99e='ChatWebsites';return db[_0xc6ff('0x51')][_0xc6ff('0x4b')]({'where':{'name':_0x14a99e,'userProfileId':_0x1d0740['userProfileId']},'raw':!![]})[_0xc6ff('0x27')](function(_0x109d57){if(_0x109d57&&_0x109d57['autoAssociation']===0x0){return db[_0xc6ff('0x2a')][_0xc6ff('0x4c')]({'name':_0x39dc83[_0xc6ff('0x2c')],'resourceId':_0x39dc83['id'],'type':_0x109d57[_0xc6ff('0x2c')],'sectionId':_0x109d57['id']},{})[_0xc6ff('0x27')](function(){return _0x3b4272;});}else{return _0x3b4272;}})[_0xc6ff('0x1e')](function(_0x1ec750){logger[_0xc6ff('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ec750);throw _0x1ec750;});}return _0x3b4272;})['then'](respondWithResult(_0x22b141,0xc9))[_0xc6ff('0x1e')](handleError(_0x22b141,null));};exports[_0xc6ff('0x26')]=function(_0x77a70f,_0x14154a){if(_0x77a70f[_0xc6ff('0x4d')]['id']){delete _0x77a70f['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x77a70f[_0xc6ff('0x49')]['id']},'include':[{'model':db[_0xc6ff('0x2f')],'as':_0xc6ff('0x52')}]})[_0xc6ff('0x27')](handleEntityNotFound(_0x14154a,null))[_0xc6ff('0x27')](saveUpdates(_0x77a70f[_0xc6ff('0x4d')],null))[_0xc6ff('0x27')](respondWithResult(_0x14154a,null))[_0xc6ff('0x1e')](handleError(_0x14154a,null));};exports['destroy']=function(_0x598436,_0x37b08e){return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'where':{'id':_0x598436[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x37b08e,null))[_0xc6ff('0x27')](removeEntity(_0x37b08e,null))[_0xc6ff('0x1e')](handleError(_0x37b08e,null));};exports[_0xc6ff('0x53')]=function(_0x432bd5,_0xe9eac2){return db[_0xc6ff('0x46')][_0xc6ff('0x53')]()[_0xc6ff('0x27')](respondWithResult(_0xe9eac2,null))[_0xc6ff('0x1e')](handleError(_0xe9eac2,null));};exports[_0xc6ff('0x54')]=function(_0x5866cb,_0x489508){if(_0x5866cb[_0xc6ff('0x4d')]['id']){delete _0x5866cb[_0xc6ff('0x4d')]['id'];}return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'where':{'id':_0x5866cb['params']['id']}})['then'](handleEntityNotFound(_0x489508,null))['then'](function(_0x173f6e){if(_0x173f6e){_0x5866cb[_0xc6ff('0x4d')][_0xc6ff('0x55')]=_0x173f6e['id'];return db['Disposition'][_0xc6ff('0x4c')](_0x5866cb[_0xc6ff('0x4d')]);}})[_0xc6ff('0x27')](respondWithResult(_0x489508,null))['catch'](handleError(_0x489508,null));};exports[_0xc6ff('0x56')]=function(_0x23aa51,_0x1fc1d9){var _0x384407={'raw':![],'where':{}};var _0x2729cd={};var _0x17a614={'count':0x0,'rows':[]};return db[_0xc6ff('0x46')][_0xc6ff('0x57')]({'where':{'id':_0x23aa51['params']['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x1fc1d9,null))[_0xc6ff('0x27')](function(_0x4a9935){if(_0x4a9935){_0x2729cd[_0xc6ff('0x33')]=_['keys'](db['Disposition']['rawAttributes']);_0x2729cd['query']=_[_0xc6ff('0x35')](_0x23aa51[_0xc6ff('0x34')]);_0x2729cd[_0xc6ff('0x36')]=_[_0xc6ff('0x37')](_0x2729cd[_0xc6ff('0x33')],_0x2729cd[_0xc6ff('0x34')]);_0x384407[_0xc6ff('0x38')]=_[_0xc6ff('0x37')](_0x2729cd['model'],qs[_0xc6ff('0x39')](_0x23aa51['query'][_0xc6ff('0x39')]));_0x384407[_0xc6ff('0x38')]=_0x384407[_0xc6ff('0x38')]['length']?_0x384407[_0xc6ff('0x38')]:_0x2729cd[_0xc6ff('0x33')];if(!_0x23aa51[_0xc6ff('0x34')][_0xc6ff('0x58')](_0xc6ff('0x3b'))){_0x384407[_0xc6ff('0x3c')]=qs[_0xc6ff('0x3c')](_0x23aa51[_0xc6ff('0x34')][_0xc6ff('0x3c')]);_0x384407[_0xc6ff('0x22')]=qs['offset'](_0x23aa51[_0xc6ff('0x34')][_0xc6ff('0x22')]);}_0x384407['order']=qs[_0xc6ff('0x3e')](_0x23aa51[_0xc6ff('0x34')][_0xc6ff('0x3e')]);_0x384407[_0xc6ff('0x41')]=qs[_0xc6ff('0x36')](_[_0xc6ff('0x3f')](_0x23aa51[_0xc6ff('0x34')],_0x2729cd[_0xc6ff('0x36')]));_0x384407['where']['ChatWebsiteId']=_0x4a9935['id'];if(_0x23aa51[_0xc6ff('0x34')][_0xc6ff('0x40')]){_0x384407[_0xc6ff('0x41')]=_[_0xc6ff('0x42')](_0x384407[_0xc6ff('0x41')],{'$or':_['map'](_0x384407[_0xc6ff('0x38')],function(_0x5363cb){var _0x584061={};_0x584061[_0x5363cb]={'$like':'%'+_0x23aa51['query'][_0xc6ff('0x40')]+'%'};return _0x584061;})});}_0x384407=_[_0xc6ff('0x42')]({},_0x384407,_0x23aa51[_0xc6ff('0x44')]);return db[_0xc6ff('0x59')][_0xc6ff('0x23')]({'where':_0x384407[_0xc6ff('0x41')]})[_0xc6ff('0x27')](function(_0x3b4652){_0x17a614['count']=_0x3b4652;if(_0x23aa51[_0xc6ff('0x34')][_0xc6ff('0x4a')]){_0x384407[_0xc6ff('0x45')]=[{'all':!![]}];}return db['Disposition'][_0xc6ff('0x47')](_0x384407);})[_0xc6ff('0x27')](function(_0x435ea0){_0x17a614[_0xc6ff('0x48')]=_0x435ea0;return _0x17a614;});}})[_0xc6ff('0x27')](respondWithFilteredResult(_0x1fc1d9,_0x384407))[_0xc6ff('0x1e')](handleError(_0x1fc1d9,null));};exports[_0xc6ff('0x5a')]=function(_0x3c230a,_0x5063c1){return db['ChatWebsite'][_0xc6ff('0x4b')]({'where':{'id':_0x3c230a['params']['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x5063c1,null))['then'](function(_0x22242c){if(_0x22242c){return _0x22242c[_0xc6ff('0x5a')](_0x3c230a[_0xc6ff('0x34')][_0xc6ff('0x5b')]);}})[_0xc6ff('0x27')](respondWithStatusCode(_0x5063c1,null))[_0xc6ff('0x1e')](handleError(_0x5063c1,null));};exports['addAnswer']=function(_0x387d3f,_0x483025){if(_0x387d3f['body']['id']){delete _0x387d3f[_0xc6ff('0x4d')]['id'];}return db[_0xc6ff('0x46')]['find']({'where':{'id':_0x387d3f[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x483025,null))[_0xc6ff('0x27')](function(_0x56f803){if(_0x56f803){_0x387d3f[_0xc6ff('0x4d')]['ChatWebsiteId']=_0x56f803['id'];return db[_0xc6ff('0x5c')]['create'](_0x387d3f[_0xc6ff('0x4d')]);}})[_0xc6ff('0x27')](respondWithResult(_0x483025,null))[_0xc6ff('0x1e')](handleError(_0x483025,null));};exports[_0xc6ff('0x5d')]=function(_0xcbff10,_0x290f3f){var _0x393412={'raw':![],'where':{}};var _0x425757={};var _0x5ca236={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0xcbff10[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x290f3f,null))[_0xc6ff('0x27')](function(_0x41ec3c){if(_0x41ec3c){_0x425757['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x425757['query']=_[_0xc6ff('0x35')](_0xcbff10[_0xc6ff('0x34')]);_0x425757[_0xc6ff('0x36')]=_[_0xc6ff('0x37')](_0x425757[_0xc6ff('0x33')],_0x425757['query']);_0x393412[_0xc6ff('0x38')]=_[_0xc6ff('0x37')](_0x425757['model'],qs[_0xc6ff('0x39')](_0xcbff10['query'][_0xc6ff('0x39')]));_0x393412[_0xc6ff('0x38')]=_0x393412[_0xc6ff('0x38')][_0xc6ff('0x3a')]?_0x393412['attributes']:_0x425757[_0xc6ff('0x33')];if(!_0xcbff10[_0xc6ff('0x34')][_0xc6ff('0x58')](_0xc6ff('0x3b'))){_0x393412[_0xc6ff('0x3c')]=qs[_0xc6ff('0x3c')](_0xcbff10[_0xc6ff('0x34')][_0xc6ff('0x3c')]);_0x393412['offset']=qs[_0xc6ff('0x22')](_0xcbff10[_0xc6ff('0x34')][_0xc6ff('0x22')]);}_0x393412[_0xc6ff('0x3d')]=qs[_0xc6ff('0x3e')](_0xcbff10['query'][_0xc6ff('0x3e')]);_0x393412[_0xc6ff('0x41')]=qs[_0xc6ff('0x36')](_[_0xc6ff('0x3f')](_0xcbff10[_0xc6ff('0x34')],_0x425757[_0xc6ff('0x36')]));_0x393412[_0xc6ff('0x41')][_0xc6ff('0x55')]=_0x41ec3c['id'];if(_0xcbff10[_0xc6ff('0x34')][_0xc6ff('0x40')]){_0x393412[_0xc6ff('0x41')]=_[_0xc6ff('0x42')](_0x393412[_0xc6ff('0x41')],{'$or':_[_0xc6ff('0x30')](_0x393412[_0xc6ff('0x38')],function(_0x1fc83e){var _0x17fb0a={};_0x17fb0a[_0x1fc83e]={'$like':'%'+_0xcbff10[_0xc6ff('0x34')]['filter']+'%'};return _0x17fb0a;})});}_0x393412=_['merge']({},_0x393412,_0xcbff10['options']);return db[_0xc6ff('0x5c')][_0xc6ff('0x23')]({'where':_0x393412[_0xc6ff('0x41')]})[_0xc6ff('0x27')](function(_0x321e97){_0x5ca236[_0xc6ff('0x23')]=_0x321e97;if(_0xcbff10[_0xc6ff('0x34')][_0xc6ff('0x4a')]){_0x393412[_0xc6ff('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc6ff('0x47')](_0x393412);})['then'](function(_0x1351f4){_0x5ca236['rows']=_0x1351f4;return _0x5ca236;});}})[_0xc6ff('0x27')](respondWithFilteredResult(_0x290f3f,_0x393412))[_0xc6ff('0x1e')](handleError(_0x290f3f,null));};exports[_0xc6ff('0x5e')]=function(_0x12be44,_0x538342){return db[_0xc6ff('0x46')]['find']({'where':{'id':_0x12be44[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x538342,null))['then'](function(_0x2a7df5){if(_0x2a7df5){return _0x2a7df5[_0xc6ff('0x5e')](_0x12be44['query'][_0xc6ff('0x5b')]);}})[_0xc6ff('0x27')](respondWithStatusCode(_0x538342,null))['catch'](handleError(_0x538342,null));};exports[_0xc6ff('0x5f')]=function(_0x13ca35,_0x36451e){_0x13ca35[_0xc6ff('0x4d')]['sitepic']=_0x13ca35[_0xc6ff('0x60')][_0xc6ff('0x61')];return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'where':{'id':_0x13ca35[_0xc6ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x36451e,null))[_0xc6ff('0x27')](saveUpdates(_0x13ca35['body'],null))['then'](respondWithResult(_0x36451e,null))[_0xc6ff('0x1e')](handleError(_0x36451e,null));};exports[_0xc6ff('0x62')]=function(_0x40ebf1,_0x4841a1){_0x40ebf1[_0xc6ff('0x4d')][_0xc6ff('0x63')]=_0x40ebf1[_0xc6ff('0x60')][_0xc6ff('0x61')];return db['ChatWebsite'][_0xc6ff('0x4b')]({'where':{'id':_0x40ebf1[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x4841a1,null))[_0xc6ff('0x27')](saveUpdates(_0x40ebf1[_0xc6ff('0x4d')],null))['then'](respondWithResult(_0x4841a1,null))[_0xc6ff('0x1e')](handleError(_0x4841a1,null));};exports[_0xc6ff('0x64')]=function(_0x499b36,_0x42cbd){_0x499b36[_0xc6ff('0x4d')]['customerAvatar']=_0x499b36['file'][_0xc6ff('0x61')];return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'where':{'id':_0x499b36['params']['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x42cbd,null))[_0xc6ff('0x27')](saveUpdates(_0x499b36[_0xc6ff('0x4d')],null))[_0xc6ff('0x27')](respondWithResult(_0x42cbd,null))['catch'](handleError(_0x42cbd,null));};exports[_0xc6ff('0x65')]=function(_0x15c393,_0xa3b0e6){_0x15c393[_0xc6ff('0x4d')][_0xc6ff('0x66')]=_0x15c393[_0xc6ff('0x60')]['filename'];return db['ChatWebsite'][_0xc6ff('0x4b')]({'where':{'id':_0x15c393[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0xa3b0e6,null))[_0xc6ff('0x27')](saveUpdates(_0x15c393[_0xc6ff('0x4d')],null))[_0xc6ff('0x27')](respondWithResult(_0xa3b0e6,null))[_0xc6ff('0x1e')](handleError(_0xa3b0e6,null));};exports['getLogo']=function(_0x50444c,_0x498c42){var _0x3ccc0d=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x437273={'where':{'id':_0x50444c['params']['id']},'attributes':['id',_0xc6ff('0x67')],'raw':!![]};var _0x1fae14=![];return require(_0xc6ff('0x68'))[_0xc6ff('0x69')]()[_0xc6ff('0x27')](function(_0x42019f){if(_0x42019f){_0x1fae14=_0x42019f[_0xc6ff('0x6a')];}})['then'](function(){return db[_0xc6ff('0x46')]['find'](_0x437273);})['then'](handleEntityNotFound(_0x498c42,null))[_0xc6ff('0x27')](function(_0x535ad0){if(_0x535ad0){if(!_[_0xc6ff('0x6b')](_0x535ad0[_0xc6ff('0x67')])){if(fs[_0xc6ff('0x6c')](path['join'](config[_0xc6ff('0x6d')],_0xc6ff('0x6e'),_0x535ad0[_0xc6ff('0x67')]))&&_0x1fae14){_0x3ccc0d=path[_0xc6ff('0x6f')](config['root'],_0xc6ff('0x6e'),_0x535ad0[_0xc6ff('0x67')]);}}return _0x498c42['download'](_0x3ccc0d);}})['catch'](handleError(_0x498c42,null));};exports[_0xc6ff('0x70')]=function(_0x3dbb40,_0xb45049){var _0x2a5736=path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],'server/files/images/avatars/default_avatar.png');var _0x5745d6={'where':{'id':_0x3dbb40[_0xc6ff('0x49')]['id']},'attributes':['id',_0xc6ff('0x63')],'raw':!![]};return db['ChatWebsite'][_0xc6ff('0x4b')](_0x5745d6)[_0xc6ff('0x27')](handleEntityNotFound(_0xb45049,null))[_0xc6ff('0x27')](function(_0x580ea2){if(_0x580ea2){if(!_[_0xc6ff('0x6b')](_0x580ea2[_0xc6ff('0x63')])){if(fs[_0xc6ff('0x6c')](path['join'](config[_0xc6ff('0x6d')],'server/files/images/avatars/',_0x580ea2['agentAvatar']))){_0x2a5736=path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],_0xc6ff('0x71'),_0x580ea2[_0xc6ff('0x63')]);}}return _0xb45049[_0xc6ff('0x72')](_0x2a5736);}})[_0xc6ff('0x1e')](handleError(_0xb45049,null));};exports[_0xc6ff('0x73')]=function(_0x227489,_0x4bc31c){var _0x2adc6c=path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],_0xc6ff('0x74'));var _0xa7e8bb={'where':{'id':_0x227489[_0xc6ff('0x49')]['id']},'attributes':['id','customerAvatar',_0xc6ff('0x75')],'raw':!![]};return db['ChatWebsite'][_0xc6ff('0x4b')](_0xa7e8bb)[_0xc6ff('0x27')](handleEntityNotFound(_0x4bc31c,null))[_0xc6ff('0x27')](function(_0x423009){if(_0x423009){if(!_['isNil'](_0x423009[_0xc6ff('0x76')])){if(fs[_0xc6ff('0x6c')](path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],_0xc6ff('0x71'),_0x423009['customerAvatar']))&&_0x423009[_0xc6ff('0x75')]){_0x2adc6c=path[_0xc6ff('0x6f')](config['root'],_0xc6ff('0x71'),_0x423009[_0xc6ff('0x76')]);}}return _0x4bc31c[_0xc6ff('0x72')](_0x2adc6c);}})[_0xc6ff('0x1e')](handleError(_0x4bc31c,null));};exports[_0xc6ff('0x77')]=function(_0x5f313e,_0x2f00b5){var _0x4a6054=path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],_0xc6ff('0x78'));var _0x4f5e52={'where':{'id':_0x5f313e['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xc6ff('0x46')][_0xc6ff('0x4b')](_0x4f5e52)[_0xc6ff('0x27')](handleEntityNotFound(_0x2f00b5,null))[_0xc6ff('0x27')](function(_0x525ac2){if(_0x525ac2){if(!_[_0xc6ff('0x6b')](_0x525ac2[_0xc6ff('0x66')])){if(fs[_0xc6ff('0x6c')](path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],_0xc6ff('0x71'),_0x525ac2[_0xc6ff('0x66')]))){_0x4a6054=path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],_0xc6ff('0x71'),_0x525ac2[_0xc6ff('0x66')]);}}return _0x2f00b5[_0xc6ff('0x72')](_0x4a6054);}})['catch'](handleError(_0x2f00b5,null));};exports[_0xc6ff('0x79')]=function(_0xf897ec,_0x474571){var _0x54583f=require(_0xc6ff('0x7a'));var _0x59bc97=new _0x54583f();var _0x34e897=_0x59bc97['setUA'](_0xf897ec[_0xc6ff('0x7b')][_0xc6ff('0x7c')])[_0xc6ff('0x7d')]();var _0x3c7007={'body':_0xf897ec[_0xc6ff('0x4d')],'channel':'chat'};var _0x273acf=[];var _0x586d4c=[];var _0x3f176b={};var _0x5dc7cf=![];return db[_0xc6ff('0x7e')]['describe']()[_0xc6ff('0x27')](function(_0x1bc461){if(!_0x1bc461){throw new db[(_0xc6ff('0x7f'))][(_0xc6ff('0x80'))](_0xc6ff('0x81'));}_0x273acf=_[_0xc6ff('0x82')](_['keys'](_0x1bc461),[_0xc6ff('0x83'),_0xc6ff('0x84')]);_0x586d4c=_['difference'](_['keys'](_0x1bc461),['createdAt','updatedAt',_0xc6ff('0x85'),_0xc6ff('0x86')]);if(_0xf897ec['body']['id']){delete _0xf897ec[_0xc6ff('0x4d')]['id'];}if(_['isNil'](_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x87')])){throw new db[(_0xc6ff('0x7f'))][(_0xc6ff('0x80'))](_0xc6ff('0x88'));}if(_[_0xc6ff('0x6b')](_0xf897ec['body']['body'])||_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x4d')]===''){throw new db['Sequelize'][(_0xc6ff('0x80'))](_0xc6ff('0x89'));}if(_[_0xc6ff('0x6b')](_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x8a')])){throw new db['Sequelize']['ValidationError'](_0xc6ff('0x8b')+_0x586d4c);}if(!_[_0xc6ff('0x8c')](_0x586d4c,_0xf897ec[_0xc6ff('0x4d')]['mapKey'])){throw new db['Sequelize'][(_0xc6ff('0x80'))](_0xc6ff('0x8d')+_0x586d4c);}_0x3f176b[_0xf897ec['body']['mapKey']]=_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x87')];})[_0xc6ff('0x27')](function(){return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'where':{'id':_0xf897ec[_0xc6ff('0x49')]['id']},'include':[{'model':db[_0xc6ff('0x8e')],'as':_0xc6ff('0x8f'),'include':[{'model':db['CmContact'],'as':_0xc6ff('0x90'),'where':_0x3f176b,'limit':0x1,'order':[[_0xc6ff('0x84'),_0xc6ff('0x91')]]}]},{'model':db['ChatApplication'],'as':_0xc6ff('0x92')}]});})[_0xc6ff('0x27')](handleEntityNotFound(_0x474571,null))[_0xc6ff('0x27')](function(_0x4f4b81){if(_0x4f4b81&&_0x4f4b81[_0xc6ff('0x8f')]){_0x3c7007['account']=_0x4f4b81;_0x3c7007[_0xc6ff('0x93')]=_0x4f4b81[_0xc6ff('0x92')];_0x3c7007['list']=_0x4f4b81[_0xc6ff('0x8f')];_0x3c7007['applications']=_[_0xc6ff('0x94')](_0x3c7007[_0xc6ff('0x93')],[_0xc6ff('0x95')],['asc']);if(_0x3c7007[_0xc6ff('0x96')][_0xc6ff('0x92')]){delete _0x3c7007[_0xc6ff('0x96')][_0xc6ff('0x92')];}if(_0x3c7007[_0xc6ff('0x96')][_0xc6ff('0x8f')]&&_0x3c7007[_0xc6ff('0x96')][_0xc6ff('0x8f')][_0xc6ff('0x90')]['length']){return _0x3c7007[_0xc6ff('0x96')]['List'][_0xc6ff('0x90')][0x0];}var _0x4aa41f=_[_0xc6ff('0xc')](_0xf897ec[_0xc6ff('0x4d')],{'firstName':_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x87')],'ListId':_0x4f4b81[_0xc6ff('0x86')]});_0x4aa41f[_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x8a')]]=_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x87')];return db['CmContact']['create'](_0x4aa41f,{'fields':_0x273acf,'raw':!![]});}})['then'](handleEntityNotFound(_0x474571,null))[_0xc6ff('0x27')](function(_0x155e0d){_0x3c7007['contact']=_0x155e0d;var _0xf7666=_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x97')];if(_0xf897ec[_0xc6ff('0x7b')]['cf-connecting-ip']){_0xf7666=_0xf897ec['headers']['cf-connecting-ip'];}else if(_0xf897ec[_0xc6ff('0x7b')]['x-forwarded-for']){_0xf7666=_['first'](_0xf897ec[_0xc6ff('0x7b')][_0xc6ff('0x98')][_0xc6ff('0x99')](','));}if(_0x155e0d){var _0x2c2215={'ContactId':_0x155e0d['id'],'ChatWebsiteId':_0xf897ec[_0xc6ff('0x49')]['id'],'from':(_0x155e0d[_0xc6ff('0x9a')]||'')+'\x20'+(_0x155e0d[_0xc6ff('0x9b')]||''),'customerIp':_0xf7666,'customerPort':_0xf897ec['headers']['x-real-port']?_0xf897ec['headers'][_0xc6ff('0x9c')]:null,'referer':_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x9d')],'browserName':_0x34e897[_0xc6ff('0x9e')][_0xc6ff('0x2c')]&&_0x34e897[_0xc6ff('0x9e')][_0xc6ff('0x9f')]?util['format']('%s\x20%s',_0x34e897[_0xc6ff('0x9e')][_0xc6ff('0x2c')],_0x34e897['browser'][_0xc6ff('0x9f')]):_0xc6ff('0xa0'),'browserVersion':_0x34e897[_0xc6ff('0x9e')]['version']||_0xc6ff('0xa0'),'osName':util['format']('%s\x20%s',_0x34e897['os'][_0xc6ff('0x2c')],_0x34e897['os'][_0xc6ff('0x9f')]),'osVersion':_0x34e897['os'][_0xc6ff('0x9f')],'deviceModel':_0x34e897[_0xc6ff('0xa1')][_0xc6ff('0x33')]&&_0x34e897[_0xc6ff('0xa1')]['vendor']?util[_0xc6ff('0xa2')](_0xc6ff('0xa3'),_0x34e897[_0xc6ff('0xa1')]['model'],_0x34e897[_0xc6ff('0xa1')][_0xc6ff('0xa4')],_0x34e897[_0xc6ff('0xa1')][_0xc6ff('0x43')]):null,'deviceVendor':_0x34e897[_0xc6ff('0xa1')][_0xc6ff('0xa4')],'deviceType':_0x34e897['device']['type'],'formData':JSON['stringify'](_0xf897ec[_0xc6ff('0x4d')])};var _0x45e251={'ChatWebsiteId':_0xf897ec['params']['id'],'closed':![]};if(_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0xa5')]){_0x45e251[_0xc6ff('0xa5')]=_0xf897ec[_0xc6ff('0x4d')]['threadId'];return db[_0xc6ff('0xa6')][_0xc6ff('0x4b')]({'where':_0x45e251})[_0xc6ff('0x27')](function(_0x221dd4){if(_0x221dd4){return[_0x221dd4,![]];}_0x2c2215[_0xc6ff('0xa5')]=_0xf897ec['body']['threadId'];_0x2c2215[_0xc6ff('0xa7')]=_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0xa7')];return db[_0xc6ff('0xa6')][_0xc6ff('0x4c')](_0x2c2215)[_0xc6ff('0x27')](function(_0x470ccd){return[_0x470ccd,!![]];});});}_0x45e251[_0xc6ff('0xa8')]=_0x155e0d['id'];if(_0xf897ec['body'][_0xc6ff('0xa9')]&&_0xf897ec[_0xc6ff('0x4d')]['interaction']['id']){_0x45e251['id']=_0xf897ec[_0xc6ff('0x4d')]['interaction']['id'];return db[_0xc6ff('0xa6')]['find']({'where':_0x45e251})[_0xc6ff('0x27')](function(_0x453278){if(_0x453278){return[_0x453278,![]];}return db['ChatInteraction'][_0xc6ff('0x4c')](_0x2c2215)[_0xc6ff('0x27')](function(_0x456836){return[_0x456836,!![]];});});}return db[_0xc6ff('0xa6')][_0xc6ff('0x4c')](_0x2c2215)[_0xc6ff('0x27')](function(_0x4995bc){return[_0x4995bc,!![]];});}})[_0xc6ff('0xaa')](function(_0x598d16,_0x5152d7){if(_0x598d16){_0x5dc7cf=_0x5152d7;if(!_0x5152d7){var _0x36bedb={'from':(_0x3c7007[_0xc6ff('0xab')][_0xc6ff('0x9a')]||'')+'\x20'+(_0x3c7007[_0xc6ff('0xab')][_0xc6ff('0x9b')]||'')};if(_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0xa5')]&&_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0xac')]&&_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0xa5')]!=_0xf897ec['body'][_0xc6ff('0xac')]){_0x36bedb[_0xc6ff('0xa5')]=_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0xac')];}return _0x598d16[_0xc6ff('0x26')](_0x36bedb);}else{return _0x598d16;}}})[_0xc6ff('0x27')](function(_0x125167){_0x3c7007['interaction']=_0x125167[_0xc6ff('0x28')]({'plain':!![]});_0x3c7007['interaction']['created']=_0x5dc7cf;if(_0x3c7007[_0xc6ff('0xa9')]['created']){if(_0x3c7007[_0xc6ff('0x96')][_0xc6ff('0xad')]){_0x3c7007['applications'][_0xc6ff('0xae')]({'id':0x0,'priority':_0x3c7007[_0xc6ff('0x93')][_0xc6ff('0x3a')]+0x1,'app':_0xc6ff('0xaf'),'appdata':_0xc6ff('0xb0'),'interval':_0xc6ff('0xb1')});}}return db[_0xc6ff('0xb2')][_0xc6ff('0x4c')]({'body':_0xf897ec[_0xc6ff('0x4d')][_0xc6ff('0x4d')],'ChatWebsiteId':_0xf897ec[_0xc6ff('0x49')]['id'],'ChatInteractionId':_0x125167['id'],'direction':'in','ContactId':_0x3c7007['contact']['id'],'AttachmentId':_0xf897ec[_0xc6ff('0x4d')]['AttachmentId']});})[_0xc6ff('0x27')](function(_0x3e3831){_0x3c7007[_0xc6ff('0x1c')]=_0x3e3831;if(_0x3c7007[_0xc6ff('0xa9')][_0xc6ff('0xb3')]){return db['User']['find']({'attributes':['id',_0xc6ff('0x2c')],'where':{'id':_0x3c7007['interaction'][_0xc6ff('0xb3')]}})[_0xc6ff('0x27')](function(_0x2b8d21){if(_0x2b8d21){_0x3c7007['applications'][_0xc6ff('0xb4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2b8d21[_0xc6ff('0x2c')]+','+(_0x3c7007[_0xc6ff('0x96')][_0xc6ff('0xb5')]||0xa),'interval':'*,*,*,*'});_0x3c7007[_0xc6ff('0xb6')]=!![];}return respondWithRpcPromise('Start',_0xc6ff('0xb7'),_0x3c7007);});}return respondWithRpcPromise(_0xc6ff('0xb8'),_0xc6ff('0xb7'),_0x3c7007);})[_0xc6ff('0x27')](function(_0x532365){respondWithRpcPromise('EventManager',_0xc6ff('0xb9'),{'event':_0xc6ff('0x79'),'message':_0x532365},client9002);return _0x532365;})[_0xc6ff('0x27')](respondWithResult(_0x474571,null))['catch'](handleError(_0x474571,null));};exports['offline']=function(_0x72aef7,_0xd63e47){var _0x123043,_0x5ecb2e,_0x5342b2;var _0xc022df=[];var _0x85ae13={};var _0x4033b4=_0x72aef7[_0xc6ff('0xba')]||[];var _0x2f33c1=[];var _0x22a001;return db['CmContact'][_0xc6ff('0x53')]()[_0xc6ff('0x27')](function(_0x49fe6f){if(!_0x49fe6f){throw new db['Sequelize'][(_0xc6ff('0x80'))](_0xc6ff('0x81'));}_0xc022df=_[_0xc6ff('0x82')](_['keys'](_0x49fe6f),[_0xc6ff('0x83'),_0xc6ff('0x84'),_0xc6ff('0x85'),'ListId']);if(_0x72aef7[_0xc6ff('0x4d')]['id']){delete _0x72aef7[_0xc6ff('0x4d')]['id'];}if(_[_0xc6ff('0x6b')](_0x72aef7['body']['from'])){throw _0xd63e47[_0xc6ff('0x20')](0x1f4)['send'](new db[(_0xc6ff('0x7f'))][(_0xc6ff('0x80'))](_0xc6ff('0x88')));}if(_['isNil'](_0x72aef7[_0xc6ff('0x4d')][_0xc6ff('0x4d')])||_0x72aef7['body'][_0xc6ff('0x4d')]===''){throw _0xd63e47[_0xc6ff('0x20')](0x1f4)['send'](new db[(_0xc6ff('0x7f'))]['ValidationError'](_0xc6ff('0x89')));}if(_[_0xc6ff('0x6b')](_0x72aef7[_0xc6ff('0x4d')][_0xc6ff('0xbb')])){throw _0xd63e47['status'](0x1f4)[_0xc6ff('0x2d')](new db['Sequelize'][(_0xc6ff('0x80'))](_0xc6ff('0xbc')+_0xc022df));}if(!_[_0xc6ff('0x8c')](_0xc022df,_0x72aef7['body'][_0xc6ff('0xbb')])){throw _0xd63e47[_0xc6ff('0x20')](0x1f4)[_0xc6ff('0x2d')](new db[(_0xc6ff('0x7f'))][(_0xc6ff('0x80'))](_0xc6ff('0xbd')+_0xc022df));}_0x85ae13[_0x72aef7['body'][_0xc6ff('0xbb')]]=_0x72aef7[_0xc6ff('0x4d')][_0xc6ff('0x87')];})[_0xc6ff('0x27')](function(){return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'where':{'id':_0x72aef7['params']['id']},'include':[{'model':db[_0xc6ff('0x8e')],'as':_0xc6ff('0x8f')},{'model':db[_0xc6ff('0xbe')],'as':_0xc6ff('0xbe')}]});})['then'](handleEntityNotFound(_0xd63e47,null))[_0xc6ff('0x27')](function(_0x151e3c){if(_0x151e3c&&_0x151e3c[_0xc6ff('0x8f')]){_0x5ecb2e=_0x151e3c;var _0x22955f=_[_0xc6ff('0xc')](_0x72aef7[_0xc6ff('0x4d')],{'firstName':_0x72aef7[_0xc6ff('0x4d')][_0xc6ff('0x87')],'phone':_0x72aef7[_0xc6ff('0x4d')][_0xc6ff('0x87')],'ListId':_0x151e3c[_0xc6ff('0x86')]});_0x22955f[_0x72aef7[_0xc6ff('0x4d')][_0xc6ff('0xbb')]]=_0x72aef7[_0xc6ff('0x4d')][_0xc6ff('0x87')];return db['CmContact'][_0xc6ff('0xbf')]({'where':_0x85ae13,'defaults':_0x22955f});}})[_0xc6ff('0xaa')](function(_0x274add){if(_0x274add){_0x5342b2=_0x274add;var _0x2dffce=fs[_0xc6ff('0xc0')](path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],'server/files/templates/chatOfflineMessage.ejs'),_0xc6ff('0xc1'));var _0x55a6a5=ejs[_0xc6ff('0xc2')](_0x2dffce,{'body':_['toPairs'](_0x72aef7['body'][_0xc6ff('0x4d')]),'bodyTitle':_0x5ecb2e[_0xc6ff('0xc3')]});return db[_0xc6ff('0xc4')][_0xc6ff('0x4c')]({'body':_0x55a6a5,'plainBody':htmlToText[_0xc6ff('0xc5')](_0x55a6a5),'ContactId':_0x274add['id'],'ChatWebsiteId':_0x5ecb2e['id']});}})[_0xc6ff('0x27')](function(_0x48299e){_0x22a001=_0x48299e;if(_0x4033b4['length']){var _0x33d94a=_0x4033b4[_0xc6ff('0x30')](function(_0x5404d2){return{'name':_0x5404d2[_0xc6ff('0xc6')],'basename':_0x5404d2[_0xc6ff('0x61')],'type':_0x5404d2['mimetype'],'ChatOfflineMessageId':_0x48299e['id']};});_0x2f33c1=_0x33d94a[_0xc6ff('0x30')](_0x2e7aeb=>{var _0x26ab62={'filename':_0x2e7aeb[_0xc6ff('0x2c')],'path':path['join'](config[_0xc6ff('0x6d')],_0xc6ff('0xc7'),_0xc6ff('0xba'),_0xc6ff('0xc8'),_0xc6ff('0xc9'),_0x2e7aeb[_0xc6ff('0xca')])};return _0x26ab62;});if(!_0x5ecb2e['openNewInteraction']){return db['sequelize'][_0xc6ff('0xcb')](function(_0x214990){return db['Attachment']['bulkCreate'](_0x33d94a,{'transaction':_0x214990});});}}})[_0xc6ff('0x27')](function(){if(_0x22a001){_0x123043=_0x22a001;return db['MailAccount'][_0xc6ff('0x57')]({'where':{'active':!![]},'include':[{'model':db[_0xc6ff('0xcc')],'as':_0xc6ff('0xcd'),'raw':!![],'include':[{'model':db[_0xc6ff('0xce')],'as':_0xc6ff('0xce'),'raw':!![]}]}]});}})['then'](function(_0x36d481){if(_0x36d481&&_0x36d481[_0xc6ff('0xcd')]&&_0x5ecb2e['forwardOffline']&&_0x5ecb2e['forwardOfflineAddress']){var _0xb84e57=_0x36d481['getSmtpOptions']();return respondWithRpcPromise(_0xc6ff('0xcf'),_0xc6ff('0xd0'),{'account':_0xb84e57,'message':{'from':util[_0xc6ff('0xa2')](_0xc6ff('0xd1'),_0x36d481[_0xc6ff('0x2c')],_0x36d481[_0xc6ff('0xd2')]||_0x36d481[_0xc6ff('0xcd')][_0xc6ff('0x4e')]),'to':_0x5ecb2e[_0xc6ff('0xd3')],'subject':_0x5ecb2e['offlineMessageSubject'],'html':_0x123043[_0xc6ff('0x4d')],'attachments':_0x2f33c1}},client9003)[_0xc6ff('0x27')](function(){return _0x123043;})[_0xc6ff('0x1e')](function(_0x5a8615){logger['error'](_0x5a8615);});}})[_0xc6ff('0x27')](function(){if(_0x5ecb2e&&_0x5ecb2e[_0xc6ff('0xd4')]&&_0x5ecb2e['MailAccountId']){var _0x51bf92=[];if(_0x4033b4['length']){_0x51bf92=_0x4033b4['map'](function(_0x3480a8){return{'name':_0x3480a8[_0xc6ff('0xc6')],'basename':_0x3480a8[_0xc6ff('0x61')],'type':_0x3480a8[_0xc6ff('0xd5')],'ChatOfflineMessageId':_0x22a001['id']};});}var _0x484104;if(!_[_0xc6ff('0x6b')](_0x5ecb2e['subjectOffline'])){var _0x26f997=_[_0xc6ff('0x30')](_0x72aef7[_0xc6ff('0x4d')],function(_0x335da3){return _0x335da3;});var _0xf0eda3=_[_0xc6ff('0xd6')](_0x26f997)[0x0];var _0x8ff670=_[_0xc6ff('0xd7')](_0xf0eda3,function(_0x226eb4){return _0x226eb4;});_0x484104=_0x8ff670[0x1][_0x5ecb2e['subjectOffline']];}var _0x2475c7={'from':_0x5342b2[_0xc6ff('0xd2')],'firstName':_0x5342b2['firstName'],'lastName':_0x5342b2[_0xc6ff('0x9b')],'mapKey':'email','message':{'from':_0x5342b2[_0xc6ff('0xd2')],'to':_0x5ecb2e['MailAccount'][_0xc6ff('0xd2')],'cc':'','subject':_[_0xc6ff('0x6b')](_0x484104)?_0x5ecb2e[_0xc6ff('0xd8')]:_0x484104,'messageId':'','sentAt':new Date(),'attach':_0x51bf92[_0xc6ff('0x3a')],'attachments':_0x51bf92,'originChannel':'Chat','ChatWebsiteId':_0x5ecb2e['id'],'ChatOfflineMessageId':_0x123043['id'],'originTo':_0x5ecb2e['MailAccount'][_0xc6ff('0xd2')]},'body':_0x123043[_0xc6ff('0x4d')]};var _0x49ba76={'account':{'id':_0x5ecb2e['MailAccountId']},'body':_0x2475c7,'log':_0xc6ff('0xd9')};return respondWithRpcPromise(_0xc6ff('0xd9'),_0xc6ff('0xda'),_0x49ba76,client9001)[_0xc6ff('0x27')](function(){return _0x123043;})[_0xc6ff('0x1e')](function(_0x1b5544){logger[_0xc6ff('0x1a')](_0x1b5544);});}return;})[_0xc6ff('0x27')](function(){if(_0x123043){return _0x123043;}})[_0xc6ff('0x27')](respondWithResult(_0xd63e47,null))['catch'](function(_0x2a3dd7){logger['error']('catch',_0x2a3dd7);for(var _0x29b2f7 of _0x4033b4){var _0x34fd43=path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],_0xc6ff('0xc7'),'files','attachments','offline-chat',_0x29b2f7[_0xc6ff('0x61')]);fs_extra[_0xc6ff('0xdb')](_0x34fd43)[_0xc6ff('0x1e')](function(_0x4e1d5d){logger['error'](_0xc6ff('0xdc'),_0x34fd43,_0x4e1d5d);});}});};exports['addInteraction']=function(_0x52dbd6,_0x5654b2){return db['ChatInteraction']['find']({'where':{'id':_0x52dbd6[_0xc6ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x5654b2,null))[_0xc6ff('0x27')](function(_0x5d36f1){if(_0x5d36f1){return _0x5d36f1[_0xc6ff('0xdd')](_0x52dbd6['body'][_0xc6ff('0x5b')],_['omit'](_0x52dbd6[_0xc6ff('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x5654b2,null))[_0xc6ff('0x1e')](handleError(_0x5654b2,null));};exports[_0xc6ff('0xde')]=function(_0x21e57e,_0xcb2c3){var _0x7dd8d9={'raw':![],'where':{}};var _0x5e94ba={};var _0x542633={'count':0x0,'rows':[]};return db[_0xc6ff('0x46')]['findOne']({'where':{'id':_0x21e57e[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0xcb2c3,null))[_0xc6ff('0x27')](function(_0xe2d40d){if(_0xe2d40d){_0x5e94ba[_0xc6ff('0x33')]=_['keys'](db[_0xc6ff('0xa6')][_0xc6ff('0x31')]);_0x5e94ba[_0xc6ff('0x34')]=_['keys'](_0x21e57e[_0xc6ff('0x34')]);_0x5e94ba[_0xc6ff('0x36')]=_[_0xc6ff('0x37')](_0x5e94ba[_0xc6ff('0x33')],_0x5e94ba['query']);_0x7dd8d9[_0xc6ff('0x38')]=_[_0xc6ff('0x37')](_0x5e94ba[_0xc6ff('0x33')],qs[_0xc6ff('0x39')](_0x21e57e['query']['fields']));_0x7dd8d9[_0xc6ff('0x38')]=_0x7dd8d9[_0xc6ff('0x38')][_0xc6ff('0x3a')]?_0x7dd8d9[_0xc6ff('0x38')]:_0x5e94ba[_0xc6ff('0x33')];if(!_0x21e57e[_0xc6ff('0x34')][_0xc6ff('0x58')](_0xc6ff('0x3b'))){_0x7dd8d9[_0xc6ff('0x3c')]=qs[_0xc6ff('0x3c')](_0x21e57e['query']['limit']);_0x7dd8d9[_0xc6ff('0x22')]=qs[_0xc6ff('0x22')](_0x21e57e[_0xc6ff('0x34')][_0xc6ff('0x22')]);}_0x7dd8d9[_0xc6ff('0x3d')]=qs['sort'](_0x21e57e[_0xc6ff('0x34')]['sort']);_0x7dd8d9[_0xc6ff('0x41')]=qs[_0xc6ff('0x36')](_[_0xc6ff('0x3f')](_0x21e57e[_0xc6ff('0x34')],_0x5e94ba[_0xc6ff('0x36')]));_0x7dd8d9['where'][_0xc6ff('0x55')]=_0xe2d40d['id'];if(_0x21e57e[_0xc6ff('0x34')][_0xc6ff('0x40')]){_0x7dd8d9['where']=_[_0xc6ff('0x42')](_0x7dd8d9[_0xc6ff('0x41')],{'$or':_[_0xc6ff('0x30')](_0x7dd8d9[_0xc6ff('0x38')],function(_0x4da7e1){var _0x35bade={};_0x35bade[_0x4da7e1]={'$like':'%'+_0x21e57e[_0xc6ff('0x34')]['filter']+'%'};return _0x35bade;})});}_0x7dd8d9=_[_0xc6ff('0x42')]({},_0x7dd8d9,_0x21e57e[_0xc6ff('0x44')]);return db[_0xc6ff('0xa6')][_0xc6ff('0x23')]({'where':_0x7dd8d9[_0xc6ff('0x41')]})[_0xc6ff('0x27')](function(_0x162a71){_0x542633['count']=_0x162a71;if(_0x21e57e['query'][_0xc6ff('0x4a')]){_0x7dd8d9[_0xc6ff('0x45')]=[{'model':db[_0xc6ff('0x7e')],'as':_0xc6ff('0xdf'),'required':![]},{'model':db[_0xc6ff('0xe0')],'as':_0xc6ff('0xe1'),'attributes':[_0xc6ff('0x2c'),_0xc6ff('0xe2'),'internal'],'required':![]},{'model':db[_0xc6ff('0xe3')],'as':_0xc6ff('0xe4'),'attributes':['id',_0xc6ff('0x2c'),_0xc6ff('0xe5')],'where':_0x21e57e[_0xc6ff('0x34')][_0xc6ff('0xe6')]?{'id':_0x21e57e[_0xc6ff('0x34')][_0xc6ff('0xe6')]}:undefined,'required':_0x21e57e[_0xc6ff('0x34')][_0xc6ff('0xe6')]?!![]:![]}];}return db[_0xc6ff('0xa6')][_0xc6ff('0x47')](_0x7dd8d9);})['then'](function(_0x19dc17){_0x542633[_0xc6ff('0x48')]=_0x19dc17;return _0x542633;});}})['then'](respondWithFilteredResult(_0xcb2c3,_0x7dd8d9))[_0xc6ff('0x1e')](handleError(_0xcb2c3,null));};function iftimePromise(_0x3f0d25,_0x2b0d40){return respondWithRpcPromise(_0xc6ff('0xe7'),_0xc6ff('0xe8'),{'command':_0x2b0d40[_0xc6ff('0xe9')]?util['format'](_0xc6ff('0xea'),_0x3f0d25[_0xc6ff('0xeb')],_0x2b0d40[_0xc6ff('0xe9')]):util['format']('iftime\x20%s',_0x3f0d25['interval'])},client9002)[_0xc6ff('0x27')](function(_0x12bb72){var _0x48033d=_0x12bb72&&_0x12bb72[_0xc6ff('0xec')](_0xc6ff('0xed'))>=0x0?!![]:![];logger[_0xc6ff('0x15')](_0xc6ff('0xee'),_0x2b0d40['id'],_0x3f0d25['id'],_0x3f0d25[_0xc6ff('0xeb')],_0x48033d?_0xc6ff('0xef'):_0xc6ff('0xf0'),_0x2b0d40[_0xc6ff('0xe9')]?_0x2b0d40['timezone']:'No\x20timezone');return _0x48033d;})[_0xc6ff('0x1e')](function(_0x30317a){logger[_0xc6ff('0x1a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2b0d40['id'],_0x3f0d25['id'],_0x3f0d25[_0xc6ff('0xeb')],util[_0xc6ff('0xf1')](_0x30317a,{'showHidden':![],'depth':null}),_0x2b0d40[_0xc6ff('0xe9')]?_0x2b0d40[_0xc6ff('0xe9')]:_0xc6ff('0xf2'));return![];});}exports['getSnippet']=function(_0x14c84d,_0x1f4505){var _0x1231e2=0x0;var _0x597acc=0x0;var _0x441c0a=![];var _0x18e6c1;var _0x27c6ff;return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'where':{'id':_0x14c84d['params']['id']},'include':[{'model':db[_0xc6ff('0xf3')],'as':'Interval','include':[{'model':db[_0xc6ff('0xf3')],'as':_0xc6ff('0xf4'),'attributes':['id',_0xc6ff('0xeb')],'raw':!![]}]}]})[_0xc6ff('0x27')](handleEntityNotFound(_0x1f4505,null))[_0xc6ff('0x27')](function(_0x50c16b){if(_0x50c16b){_0x18e6c1=_0x50c16b;return _0x50c16b[_0xc6ff('0xf5')]({'raw':!![]});}})[_0xc6ff('0x27')](function(_0x3959f8){if(_0x18e6c1){if(_0x3959f8){_0x27c6ff=_0x3959f8;}}return require(_0xc6ff('0x68'))[_0xc6ff('0x69')]();})[_0xc6ff('0x27')](function(_0x1b971d){if(_0x1b971d){_0x597acc=_0x1b971d[_0xc6ff('0xf6')];_0x441c0a=_0x1b971d['custom'];}})[_0xc6ff('0x27')](function(){return db[_0xc6ff('0xa6')]['count']({'where':{'closed':![]}});})[_0xc6ff('0x27')](function(_0x1dbec5){_0x1231e2=_0x1dbec5;if(_0x597acc&&_0x1dbec5>_0x597acc){return db[_0xc6ff('0xf7')][_0xc6ff('0x57')]({'where':{'id':0x1}})[_0xc6ff('0x27')](function(_0x4562ab){if(_0x4562ab){_0x4562ab[_0xc6ff('0xf8')]('chatLicenseExceeded');}});}})[_0xc6ff('0x27')](function(){if(_0x18e6c1[_0xc6ff('0xf3')]&&_0x18e6c1['Interval'][_0xc6ff('0xf4')]){var _0x547c42=[];for(var _0x419d64=0x0;_0x419d64<_0x18e6c1['Interval'][_0xc6ff('0xf4')][_0xc6ff('0x3a')];_0x419d64++){var _0x17a71c=_0x18e6c1[_0xc6ff('0xf3')][_0xc6ff('0xf4')][_0x419d64][_0xc6ff('0x28')]({'plain':!![]});_0x547c42['push'](iftimePromise(_0x17a71c,_0x18e6c1));}return BPromise[_0xc6ff('0xf9')](_0x547c42)[_0xc6ff('0x27')](function(_0x35640e){return _['some'](_0x35640e);});}else{return!![];}})['then'](function(_0x254012){var _0x55cef5=fs[_0xc6ff('0xc0')](path[_0xc6ff('0x6f')](config[_0xc6ff('0x6d')],_0xc6ff('0xfa')),_0xc6ff('0xc1'));var _0x2ee79e={'remote':_0x18e6c1['remote'],'query':querystring[_0xc6ff('0x19')](_[_0xc6ff('0x42')](_0x18e6c1['get']({'plain':!![]}),{'customerIp':_0x14c84d[_0xc6ff('0x7b')]['x-forwarded-for']||_0x14c84d[_0xc6ff('0x7b')][_0xc6ff('0xfb')]||_0x14c84d[_0xc6ff('0xfc')][_0xc6ff('0xfd')]||_0x14c84d['ip'],'referer':_0x14c84d[_0xc6ff('0x7b')][_0xc6ff('0x9d')],'openedInteractions':_0x1231e2,'maxInteractions':_0x597acc,'virtual':_0x441c0a[_0xc6ff('0xf6')],'online':_0x254012,'custom':_0x441c0a}))[_0xc6ff('0xfe')](/'/g,'\x5c\x27')};_0x1f4505[_0xc6ff('0x2d')](ejs[_0xc6ff('0xc2')](Mustache[_0xc6ff('0xc2')](_0x55cef5,_0x2ee79e),{'proactiveActions':_0x27c6ff,'alignment':_0x18e6c1['alignment'],'verticalAlignment':_0x18e6c1['verticalAlignment'],'div_color':_0x18e6c1['color'],'labelText':_0x18e6c1[_0xc6ff('0xff')],'text_color':_0x18e6c1[_0xc6ff('0x100')],'button_color':_0x18e6c1[_0xc6ff('0x101')],'background_color':_0x18e6c1[_0xc6ff('0x102')],'hideWhenOffline':_0x18e6c1[_0xc6ff('0x103')],'interval':_0x18e6c1[_0xc6ff('0x104')]}));})[_0xc6ff('0x1e')](handleError(_0x1f4505,null));};exports[_0xc6ff('0x105')]=function(_0x20d2de,_0x1fd016){var _0x8b598f=_0x20d2de[_0xc6ff('0x49')]['id'];var _0x1214f9=_0x20d2de[_0xc6ff('0x4d')];var _0x1e9a6f=0xc8;var _0x298546=null;return db['sequelize'][_0xc6ff('0xcb')]({'isolationLevel':db['sequelize'][_0xc6ff('0x106')][_0xc6ff('0x107')][_0xc6ff('0x108')]},function(_0x3be45a){return db['ChatWebsite']['findOne']({'where':{'id':_0x8b598f},'transaction':_0x3be45a})['then'](function(_0x28cbc9){if(_0x28cbc9){return db[_0xc6ff('0x109')][_0xc6ff('0x10a')]({'where':{'ChatWebsiteId':_0x8b598f},'transaction':_0x3be45a})[_0xc6ff('0x27')](function(){var _0x47d901=_['map'](_0x1214f9,function(_0x307d4a){_0x307d4a[_0xc6ff('0x55')]=_0x8b598f;return _0x307d4a;});return db[_0xc6ff('0x109')][_0xc6ff('0x10b')](_0x47d901,{'transaction':_0x3be45a});});}else{_0x1e9a6f=0x194;_0x298546=[];}});})['then'](function(){if(_0x1e9a6f!==0x194){return db[_0xc6ff('0x109')][_0xc6ff('0x10c')]({'where':{'ChatWebsiteId':_0x8b598f},'order':'priority'})['then'](function(_0xa39534){_0x298546=_0xa39534;});}})[_0xc6ff('0x1e')](function(_0x5de3af){_0x1e9a6f=0x1f4;logger['error'](_0x5de3af[_0xc6ff('0x2b')]);if(_0x5de3af[_0xc6ff('0x2c')]){delete _0x5de3af[_0xc6ff('0x2c')];}_0x298546=_0x5de3af;})[_0xc6ff('0x10d')](function(){if(_0x298546===null){_0x1fd016[_0xc6ff('0x1f')](_0x1e9a6f);}else{if(_0x1e9a6f===0x1f4){_0x1fd016[_0xc6ff('0x20')](_0x1e9a6f)[_0xc6ff('0x2d')](_0x298546);}else{_0x1fd016[_0xc6ff('0x20')](_0x1e9a6f)[_0xc6ff('0x25')](_0x298546);}}});};exports[_0xc6ff('0x10e')]=function(_0x19f852,_0x255155){var _0x3b1445={};var _0x40652a={};var _0x38cebe;var _0x5bdb6d;return db['ChatWebsite']['findOne']({'where':{'id':_0x19f852[_0xc6ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x255155,null))[_0xc6ff('0x27')](function(_0x182bf7){if(_0x182bf7){_0x38cebe=_0x182bf7;_0x40652a[_0xc6ff('0x33')]=_[_0xc6ff('0x35')](db[_0xc6ff('0x109')]['rawAttributes']);_0x40652a[_0xc6ff('0x34')]=_[_0xc6ff('0x35')](_0x19f852['query']);_0x40652a['filters']=_[_0xc6ff('0x37')](_0x40652a[_0xc6ff('0x33')],_0x40652a[_0xc6ff('0x34')]);_0x3b1445[_0xc6ff('0x38')]=_[_0xc6ff('0x37')](_0x40652a['model'],qs[_0xc6ff('0x39')](_0x19f852['query']['fields']));_0x3b1445[_0xc6ff('0x38')]=_0x3b1445['attributes']['length']?_0x3b1445[_0xc6ff('0x38')]:_0x40652a[_0xc6ff('0x33')];_0x3b1445[_0xc6ff('0x3d')]=qs['sort'](_0x19f852['query'][_0xc6ff('0x3e')]);_0x3b1445[_0xc6ff('0x41')]=qs[_0xc6ff('0x36')](_['pick'](_0x19f852[_0xc6ff('0x34')],_0x40652a['filters']));if(_0x19f852[_0xc6ff('0x34')][_0xc6ff('0x40')]){_0x3b1445[_0xc6ff('0x41')]=_[_0xc6ff('0x42')](_0x3b1445[_0xc6ff('0x41')],{'$or':_[_0xc6ff('0x30')](_0x3b1445[_0xc6ff('0x38')],function(_0x90a9c){var _0x5db4c1={};_0x5db4c1[_0x90a9c]={'$like':'%'+_0x19f852['query']['filter']+'%'};return _0x5db4c1;})});}_0x3b1445=_[_0xc6ff('0x42')]({},_0x3b1445,_0x19f852[_0xc6ff('0x44')]);return _0x38cebe[_0xc6ff('0x10e')](_0x3b1445);}})['then'](function(_0x2a98f8){if(_0x2a98f8){_0x5bdb6d=_0x2a98f8[_0xc6ff('0x3a')];if(!_0x19f852[_0xc6ff('0x34')][_0xc6ff('0x58')](_0xc6ff('0x3b'))){_0x3b1445['limit']=qs[_0xc6ff('0x3c')](_0x19f852[_0xc6ff('0x34')][_0xc6ff('0x3c')]);_0x3b1445[_0xc6ff('0x22')]=qs[_0xc6ff('0x22')](_0x19f852['query'][_0xc6ff('0x22')]);}return _0x38cebe[_0xc6ff('0x10e')](_0x3b1445);}})[_0xc6ff('0x27')](function(_0x1dd286){if(_0x1dd286){return _0x1dd286?{'count':_0x5bdb6d,'rows':_0x1dd286}:null;}})[_0xc6ff('0x27')](respondWithResult(_0x255155,null))[_0xc6ff('0x1e')](handleError(_0x255155,null));};exports['addProactiveActions']=function(_0x2ee933,_0x2eb0e7){return db[_0xc6ff('0x10f')][_0xc6ff('0x4b')]({'where':{'id':_0x2ee933[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x2eb0e7,null))[_0xc6ff('0x27')](function(_0x427b78){if(_0x427b78){return _0x427b78['addProactiveActions'](_0x2ee933['body']['ids'],_[_0xc6ff('0x110')](_0x2ee933[_0xc6ff('0x4d')],['ids','id'])||{});}})[_0xc6ff('0x27')](respondWithResult(_0x2eb0e7,null))[_0xc6ff('0x1e')](handleError(_0x2eb0e7,null));};exports['getProactiveActions']=function(_0xe58df2,_0x3db36c){var _0x30e0da={};var _0x214675={};var _0x53b613;var _0x1932fc;return db[_0xc6ff('0x46')]['findOne']({'where':{'id':_0xe58df2[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x3db36c,null))[_0xc6ff('0x27')](function(_0x4cb9ab){if(_0x4cb9ab){_0x53b613=_0x4cb9ab;_0x214675['model']=_[_0xc6ff('0x35')](db[_0xc6ff('0x111')][_0xc6ff('0x31')]);_0x214675[_0xc6ff('0x34')]=_[_0xc6ff('0x35')](_0xe58df2['query']);_0x214675[_0xc6ff('0x36')]=_[_0xc6ff('0x37')](_0x214675[_0xc6ff('0x33')],_0x214675[_0xc6ff('0x34')]);_0x30e0da[_0xc6ff('0x38')]=_[_0xc6ff('0x37')](_0x214675['model'],qs[_0xc6ff('0x39')](_0xe58df2[_0xc6ff('0x34')]['fields']));_0x30e0da[_0xc6ff('0x38')]=_0x30e0da[_0xc6ff('0x38')][_0xc6ff('0x3a')]?_0x30e0da[_0xc6ff('0x38')]:_0x214675['model'];_0x30e0da[_0xc6ff('0x3d')]=qs['sort'](_0xe58df2['query']['sort']);_0x30e0da[_0xc6ff('0x41')]=qs[_0xc6ff('0x36')](_[_0xc6ff('0x3f')](_0xe58df2[_0xc6ff('0x34')],_0x214675[_0xc6ff('0x36')]));if(_0xe58df2[_0xc6ff('0x34')][_0xc6ff('0x40')]){_0x30e0da[_0xc6ff('0x41')]=_[_0xc6ff('0x42')](_0x30e0da['where'],{'$or':_['map'](_0x30e0da[_0xc6ff('0x38')],function(_0x512f0f){var _0x341956={};_0x341956[_0x512f0f]={'$like':'%'+_0xe58df2['query'][_0xc6ff('0x40')]+'%'};return _0x341956;})});}_0x30e0da=_[_0xc6ff('0x42')]({},_0x30e0da,_0xe58df2['options']);return _0x53b613[_0xc6ff('0xf5')](_0x30e0da);}})[_0xc6ff('0x27')](function(_0x58fbd9){if(_0x58fbd9){_0x1932fc=_0x58fbd9[_0xc6ff('0x3a')];if(!_0xe58df2['query'][_0xc6ff('0x58')](_0xc6ff('0x3b'))){_0x30e0da[_0xc6ff('0x3c')]=qs[_0xc6ff('0x3c')](_0xe58df2['query'][_0xc6ff('0x3c')]);_0x30e0da[_0xc6ff('0x22')]=qs['offset'](_0xe58df2[_0xc6ff('0x34')][_0xc6ff('0x22')]);}return _0x53b613['getProactiveActions'](_0x30e0da);}})[_0xc6ff('0x27')](function(_0x14c097){if(_0x14c097){return _0x14c097?{'count':_0x1932fc,'rows':_0x14c097}:null;}})[_0xc6ff('0x27')](respondWithResult(_0x3db36c,null))[_0xc6ff('0x1e')](handleError(_0x3db36c,null));};exports[_0xc6ff('0x112')]=function(_0x3ba55f,_0x828631){var _0x3eeda1=_0x3ba55f[_0xc6ff('0x34')][_0xc6ff('0x113')]==='false'?'offlineForm':'onlineForm';return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'attributes':['id',_0x3eeda1],'where':{'id':_0x3ba55f[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x828631,null))[_0xc6ff('0x27')](function(_0x1b5fa1){if(_0x1b5fa1){var _0x21abea=_0x1b5fa1[_0x3eeda1];var _0x1341c5=_0x21abea&&_0x21abea[_0xc6ff('0x114')]?_0x21abea['items']:[];_0x828631[_0xc6ff('0x2d')]({'fromKey':_[_0xc6ff('0x6b')](_0x21abea[_0xc6ff('0x115')])?undefined:_0x21abea[_0xc6ff('0x115')],'count':_0x1341c5['length'],'rows':_0x1341c5});}})['catch'](handleError(_0x828631,null));};exports[_0xc6ff('0x116')]=function(_0x37373b,_0x33d08d){var _0x221e3b={'raw':![],'where':{}};var _0x3e270d={};var _0x1ef4e8={'count':0x0,'rows':[]};return db[_0xc6ff('0x46')][_0xc6ff('0x57')]({'where':{'id':_0x37373b[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x33d08d,null))['then'](function(_0x107bcc){if(_0x107bcc){_0x3e270d[_0xc6ff('0x33')]=_[_0xc6ff('0x35')](db['ChatOfflineMessage'][_0xc6ff('0x31')]);_0x3e270d[_0xc6ff('0x34')]=_['keys'](_0x37373b[_0xc6ff('0x34')]);_0x3e270d[_0xc6ff('0x36')]=_[_0xc6ff('0x37')](_0x3e270d[_0xc6ff('0x33')],_0x3e270d[_0xc6ff('0x34')]);_0x221e3b['attributes']=_[_0xc6ff('0x37')](_0x3e270d[_0xc6ff('0x33')],qs['fields'](_0x37373b[_0xc6ff('0x34')][_0xc6ff('0x39')]));_0x221e3b[_0xc6ff('0x38')]=_0x221e3b[_0xc6ff('0x38')]['length']?_0x221e3b['attributes']:_0x3e270d[_0xc6ff('0x33')];if(!_0x37373b[_0xc6ff('0x34')]['hasOwnProperty'](_0xc6ff('0x3b'))){_0x221e3b[_0xc6ff('0x3c')]=qs['limit'](_0x37373b[_0xc6ff('0x34')][_0xc6ff('0x3c')]);_0x221e3b['offset']=qs[_0xc6ff('0x22')](_0x37373b[_0xc6ff('0x34')][_0xc6ff('0x22')]);}_0x221e3b[_0xc6ff('0x3d')]=qs['sort'](_0x37373b['query'][_0xc6ff('0x3e')]);_0x221e3b[_0xc6ff('0x41')]=qs['filters'](_[_0xc6ff('0x3f')](_0x37373b[_0xc6ff('0x34')],_0x3e270d[_0xc6ff('0x36')]));_0x221e3b['where'][_0xc6ff('0x55')]=_0x107bcc['id'];if(_0x37373b[_0xc6ff('0x34')]['filter']){_0x221e3b[_0xc6ff('0x41')]=_[_0xc6ff('0x42')](_0x221e3b[_0xc6ff('0x41')],{'$or':_[_0xc6ff('0x30')](_0x221e3b[_0xc6ff('0x38')],function(_0x43a2a8){var _0x3dff05={};_0x3dff05[_0x43a2a8]={'$like':'%'+_0x37373b[_0xc6ff('0x34')]['filter']+'%'};return _0x3dff05;})});}_0x221e3b=_[_0xc6ff('0x42')]({},_0x221e3b,_0x37373b[_0xc6ff('0x44')]);return db[_0xc6ff('0xc4')][_0xc6ff('0x23')]({'where':_0x221e3b[_0xc6ff('0x41')]})[_0xc6ff('0x27')](function(_0x3e6b42){_0x1ef4e8[_0xc6ff('0x23')]=_0x3e6b42;if(_0x37373b[_0xc6ff('0x34')]['includeAll']){_0x221e3b[_0xc6ff('0x45')]=[{'all':!![]}];}else{_0x221e3b['include']=[{'model':db[_0xc6ff('0x7e')],'as':_0xc6ff('0xdf'),'required':![]},{'model':db['Attachment'],'as':_0xc6ff('0x117'),'required':![]}];}return db[_0xc6ff('0xc4')][_0xc6ff('0x47')](_0x221e3b);})[_0xc6ff('0x27')](function(_0x46695e){_0x1ef4e8['rows']=_0x46695e;return _0x1ef4e8;});}})[_0xc6ff('0x27')](respondWithFilteredResult(_0x33d08d,_0x221e3b))['catch'](handleError(_0x33d08d,null));};exports[_0xc6ff('0x118')]=function(_0x2c4728,_0x128352){return db[_0xc6ff('0x46')][_0xc6ff('0x4b')]({'where':{'id':_0x2c4728[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0x128352,null))[_0xc6ff('0x27')](function(_0x33314c){if(_0x33314c){return _0x33314c[_0xc6ff('0x118')](_0x2c4728['body'][_0xc6ff('0x5b')],_[_0xc6ff('0x110')](_0x2c4728['body'],[_0xc6ff('0x5b'),'id'])||{})['spread'](function(_0x16680b){for(var _0x3376df=0x0;_0x3376df<_0x2c4728['body'][_0xc6ff('0x5b')][_0xc6ff('0x3a')];_0x3376df+=0x1){socket['emit'](_0xc6ff('0x119'),{'UserId':Number(_0x2c4728[_0xc6ff('0x4d')]['ids'][_0x3376df]),'ChatWebsiteId':Number(_0x2c4728['params']['id'])});}return _0x16680b;});}})[_0xc6ff('0x27')](respondWithResult(_0x128352,null))['catch'](handleError(_0x128352,null));};exports[_0xc6ff('0x11a')]=function(_0x20b4d0,_0xc1a45f){return db['ChatWebsite'][_0xc6ff('0x4b')]({'where':{'id':_0x20b4d0['params']['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0xc1a45f,null))['then'](function(_0x12e572){if(_0x12e572){return _0x12e572[_0xc6ff('0x11a')](_0x20b4d0[_0xc6ff('0x34')][_0xc6ff('0x5b')])[_0xc6ff('0x27')](function(){if(_[_0xc6ff('0x11b')](_0x20b4d0[_0xc6ff('0x34')][_0xc6ff('0x5b')])){for(var _0x40decf=0x0;_0x40decf<_0x20b4d0[_0xc6ff('0x34')]['ids']['length'];_0x40decf+=0x1){socket[_0xc6ff('0x11c')](_0xc6ff('0x11d'),{'UserId':Number(_0x20b4d0[_0xc6ff('0x34')][_0xc6ff('0x5b')][_0x40decf]),'ChatWebsiteId':Number(_0x20b4d0['params']['id'])});}}else{socket[_0xc6ff('0x11c')](_0xc6ff('0x11d'),{'UserId':Number(_0x20b4d0[_0xc6ff('0x34')]['ids']),'ChatWebsiteId':Number(_0x20b4d0[_0xc6ff('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0xc1a45f,null))[_0xc6ff('0x1e')](handleError(_0xc1a45f,null));};exports[_0xc6ff('0x11e')]=function(_0x488325,_0xbac49d){var _0x1839c7={};var _0x277138={};var _0x4c4001;var _0x4adef3;return db[_0xc6ff('0x46')]['findOne']({'where':{'id':_0x488325[_0xc6ff('0x49')]['id']}})[_0xc6ff('0x27')](handleEntityNotFound(_0xbac49d,null))['then'](function(_0x259342){if(_0x259342){_0x4c4001=_0x259342;_0x277138['model']=_[_0xc6ff('0x35')](db['User'][_0xc6ff('0x31')]);_0x277138[_0xc6ff('0x34')]=_[_0xc6ff('0x35')](_0x488325[_0xc6ff('0x34')]);_0x277138[_0xc6ff('0x36')]=_['intersection'](_0x277138[_0xc6ff('0x33')],_0x277138[_0xc6ff('0x34')]);_0x1839c7['attributes']=_['intersection'](_0x277138[_0xc6ff('0x33')],qs['fields'](_0x488325[_0xc6ff('0x34')][_0xc6ff('0x39')]));_0x1839c7['attributes']=_0x1839c7[_0xc6ff('0x38')][_0xc6ff('0x3a')]?_0x1839c7['attributes']:_0x277138[_0xc6ff('0x33')];_0x1839c7[_0xc6ff('0x3d')]=qs[_0xc6ff('0x3e')](_0x488325[_0xc6ff('0x34')]['sort']);_0x1839c7[_0xc6ff('0x41')]=qs[_0xc6ff('0x36')](_['pick'](_0x488325[_0xc6ff('0x34')],_0x277138['filters']));if(_0x488325[_0xc6ff('0x34')][_0xc6ff('0x40')]){_0x1839c7['where']=_[_0xc6ff('0x42')](_0x1839c7['where'],{'$or':_[_0xc6ff('0x30')](_0x1839c7['attributes'],function(_0x9db170){var _0x1ac002={};_0x1ac002[_0x9db170]={'$like':'%'+_0x488325[_0xc6ff('0x34')][_0xc6ff('0x40')]+'%'};return _0x1ac002;})});}_0x1839c7=_[_0xc6ff('0x42')]({},_0x1839c7,_0x488325['options']);return _0x4c4001[_0xc6ff('0x11e')](_0x1839c7);}})['then'](function(_0xeb514b){if(_0xeb514b){_0x4adef3=_0xeb514b[_0xc6ff('0x3a')];if(!_0x488325['query'][_0xc6ff('0x58')](_0xc6ff('0x3b'))){_0x1839c7[_0xc6ff('0x3c')]=qs[_0xc6ff('0x3c')](_0x488325['query'][_0xc6ff('0x3c')]);_0x1839c7[_0xc6ff('0x22')]=qs['offset'](_0x488325[_0xc6ff('0x34')][_0xc6ff('0x22')]);}return _0x4c4001[_0xc6ff('0x11e')](_0x1839c7);}})[_0xc6ff('0x27')](function(_0x5926b5){if(_0x5926b5){return _0x5926b5?{'count':_0x4adef3,'rows':_0x5926b5}:null;}})[_0xc6ff('0x27')](respondWithResult(_0xbac49d,null))['catch'](handleError(_0xbac49d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d48d60c..a075acd 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 _0x61df=['emit','hasOwnProperty','hook','setMaxListeners','save','remove'];(function(_0x302e63,_0x2ae115){var _0x57eda1=function(_0x24c3a4){while(--_0x24c3a4){_0x302e63['push'](_0x302e63['shift']());}};_0x57eda1(++_0x2ae115);}(_0x61df,0xbd));var _0xf61d=function(_0x23ebd2,_0x1ab958){_0x23ebd2=_0x23ebd2-0x0;var _0x186752=_0x61df[_0x23ebd2];return _0x186752;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf61d('0x0')](0x0);var events={'afterCreate':_0xf61d('0x1'),'afterUpdate':'update','afterDestroy':_0xf61d('0x2')};function emitEvent(_0x380f27){return function(_0x485a55,_0x3170e7,_0x153a3c){ChatWebsiteEvents[_0xf61d('0x3')](_0x380f27+':'+_0x485a55['id'],_0x485a55);ChatWebsiteEvents[_0xf61d('0x3')](_0x380f27,_0x485a55);_0x153a3c(null);};}for(var e in events){if(events[_0xf61d('0x4')](e)){var event=events[e];ChatWebsite[_0xf61d('0x5')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xa7dc=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite'];(function(_0x2e80eb,_0x48f05e){var _0x26fc1d=function(_0x9f955e){while(--_0x9f955e){_0x2e80eb['push'](_0x2e80eb['shift']());}};_0x26fc1d(++_0x48f05e);}(_0xa7dc,0x11d));var _0xca7d=function(_0x808a42,_0x2d19b5){_0x808a42=_0x808a42-0x0;var _0x47cef5=_0xa7dc[_0x808a42];return _0x47cef5;};'use strict';var EventEmitter=require(_0xca7d('0x0'));var ChatWebsite=require(_0xca7d('0x1'))['db'][_0xca7d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca7d('0x3'),'afterUpdate':'update','afterDestroy':_0xca7d('0x4')};function emitEvent(_0x75fca7){return function(_0xc9d57a,_0x833d25,_0x9c070c){ChatWebsiteEvents[_0xca7d('0x5')](_0x75fca7+':'+_0xc9d57a['id'],_0xc9d57a);ChatWebsiteEvents[_0xca7d('0x5')](_0x75fca7,_0xc9d57a);_0x9c070c(null);};}for(var e in events){if(events[_0xca7d('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xca7d('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index df64daf..67d3ca2 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 _0xefc3=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','bluebird'];(function(_0x1dfee3,_0x585b79){var _0x37eb5a=function(_0x2e0628){while(--_0x2e0628){_0x1dfee3['push'](_0x1dfee3['shift']());}};_0x37eb5a(++_0x585b79);}(_0xefc3,0x171));var _0x3efc=function(_0x5075f8,_0x421862){_0x5075f8=_0x5075f8-0x0;var _0x78db03=_0xefc3[_0x5075f8];return _0x78db03;};'use strict';var _=require(_0x3efc('0x0'));var util=require(_0x3efc('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3efc('0x2'));var rp=require(_0x3efc('0x3'));var fs=require('fs');var path=require(_0x3efc('0x4'));var rimraf=require(_0x3efc('0x5'));var config=require(_0x3efc('0x6'));var attributes=require(_0x3efc('0x7'));module[_0x3efc('0x8')]=function(_0x42028a,_0x2bf6f6){return _0x42028a[_0x3efc('0x9')](_0x3efc('0xa'),attributes,{'tableName':_0x3efc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7266=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','util','api','moment','bluebird','path'];(function(_0x3c8d51,_0x51b312){var _0x1ec26f=function(_0x260081){while(--_0x260081){_0x3c8d51['push'](_0x3c8d51['shift']());}};_0x1ec26f(++_0x51b312);}(_0x7266,0x192));var _0x6726=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7266[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var util=require(_0x6726('0x0'));var logger=require('../../config/logger')(_0x6726('0x1'));var moment=require(_0x6726('0x2'));var BPromise=require(_0x6726('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6726('0x4'));var rimraf=require(_0x6726('0x5'));var config=require(_0x6726('0x6'));var attributes=require(_0x6726('0x7'));module[_0x6726('0x8')]=function(_0x5be407,_0xd7bab6){return _0x5be407[_0x6726('0x9')](_0x6726('0xa'),attributes,{'tableName':'chat_websites','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 3a1150a..d46fcc9 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 _0xd99a=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./chatWebsite.socket','register','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x3d4052,_0x502cfb){var _0x45dcd2=function(_0x1d948e){while(--_0x1d948e){_0x3d4052['push'](_0x3d4052['shift']());}};_0x45dcd2(++_0x502cfb);}(_0xd99a,0xdc));var _0xad99=function(_0x399ec8,_0xae6c1b){_0x399ec8=_0x399ec8-0x0;var _0xbd731c=_0xd99a[_0x399ec8];return _0xbd731c;};'use strict';var _=require(_0xad99('0x0'));var util=require(_0xad99('0x1'));var moment=require(_0xad99('0x2'));var BPromise=require(_0xad99('0x3'));var rs=require(_0xad99('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad99('0x5'))['db'];var utils=require(_0xad99('0x6'));var logger=require(_0xad99('0x7'))('rpc');var config=require(_0xad99('0x8'));var jayson=require(_0xad99('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xad99('0xa')]=_[_0xad99('0xb')](config[_0xad99('0xa')],{'host':_0xad99('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xad99('0xa')]));require(_0xad99('0xd'))[_0xad99('0xe')](socket);function respondWithRpcPromise(_0x56775f,_0x1439c5,_0x4718b7){return new BPromise(function(_0x1a2f21,_0x23bf63){return client['request'](_0x56775f,_0x4718b7)['then'](function(_0x45100a){logger['info'](_0xad99('0xf'),_0x1439c5,'request\x20sent');logger[_0xad99('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1439c5,_0xad99('0x11'),JSON[_0xad99('0x12')](_0x45100a));if(_0x45100a['error']){if(_0x45100a[_0xad99('0x13')][_0xad99('0x14')]===0x1f4){logger[_0xad99('0x13')](_0xad99('0xf'),_0x1439c5,_0x45100a[_0xad99('0x13')][_0xad99('0x15')]);return _0x23bf63(_0x45100a[_0xad99('0x13')][_0xad99('0x15')]);}logger[_0xad99('0x13')](_0xad99('0xf'),_0x1439c5,_0x45100a[_0xad99('0x13')]['message']);return _0x1a2f21(_0x45100a['error'][_0xad99('0x15')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1439c5,_0xad99('0x11'));_0x1a2f21(_0x45100a[_0xad99('0x16')]['message']);}})[_0xad99('0x17')](function(_0x1455f2){logger[_0xad99('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x1439c5,_0x1455f2);_0x23bf63(_0x1455f2);});});} \ No newline at end of file +var _0xd6e9=['ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent'];(function(_0x40b36f,_0x51ebfd){var _0x3e06a9=function(_0x57ef61){while(--_0x57ef61){_0x40b36f['push'](_0x40b36f['shift']());}};_0x3e06a9(++_0x51ebfd);}(_0xd6e9,0xc6));var _0x9d6e=function(_0xa32b5c,_0x28adaa){_0xa32b5c=_0xa32b5c-0x0;var _0x919635=_0xd6e9[_0xa32b5c];return _0x919635;};'use strict';var _=require('lodash');var util=require(_0x9d6e('0x0'));var moment=require(_0x9d6e('0x1'));var BPromise=require(_0x9d6e('0x2'));var rs=require(_0x9d6e('0x3'));var fs=require('fs');var Redis=require(_0x9d6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d6e('0x5'));var logger=require(_0x9d6e('0x6'))(_0x9d6e('0x7'));var config=require(_0x9d6e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9d6e('0x9')]({'port':0x232a});config[_0x9d6e('0xa')]=_['defaults'](config[_0x9d6e('0xa')],{'host':_0x9d6e('0xb'),'port':0x18eb});var socket=require(_0x9d6e('0xc'))(new Redis(config[_0x9d6e('0xa')]));require(_0x9d6e('0xd'))['register'](socket);function respondWithRpcPromise(_0x445a66,_0x330183,_0x119221){return new BPromise(function(_0x163fe2,_0x21552d){return client[_0x9d6e('0xe')](_0x445a66,_0x119221)[_0x9d6e('0xf')](function(_0x408b18){logger[_0x9d6e('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x330183,_0x9d6e('0x11'));logger['debug'](_0x9d6e('0x12'),_0x330183,_0x9d6e('0x11'),JSON['stringify'](_0x408b18));if(_0x408b18[_0x9d6e('0x13')]){if(_0x408b18[_0x9d6e('0x13')][_0x9d6e('0x14')]===0x1f4){logger[_0x9d6e('0x13')](_0x9d6e('0x15'),_0x330183,_0x408b18[_0x9d6e('0x13')]['message']);return _0x21552d(_0x408b18[_0x9d6e('0x13')][_0x9d6e('0x16')]);}logger[_0x9d6e('0x13')](_0x9d6e('0x15'),_0x330183,_0x408b18['error'][_0x9d6e('0x16')]);return _0x163fe2(_0x408b18[_0x9d6e('0x13')][_0x9d6e('0x16')]);}else{logger[_0x9d6e('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x330183,'request\x20sent');_0x163fe2(_0x408b18['result'][_0x9d6e('0x16')]);}})[_0x9d6e('0x17')](function(_0x567358){logger['error'](_0x9d6e('0x15'),_0x330183,_0x567358);_0x21552d(_0x567358);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b3141ae..5a2e9b6 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 _0xd890=['register','length','./chatWebsite.events','save','emit','removeListener'];(function(_0x302dd0,_0x46d210){var _0x3cb00f=function(_0x44f775){while(--_0x44f775){_0x302dd0['push'](_0x302dd0['shift']());}};_0x3cb00f(++_0x46d210);}(_0xd890,0x1ac));var _0x0d89=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xd890[_0x2dbce7];return _0x3a3ed0;};'use strict';var ChatWebsiteEvents=require(_0x0d89('0x0'));var events=[_0x0d89('0x1'),'remove','update'];function createListener(_0x42bf76,_0x1fcd6e){return function(_0x344d6f){_0x1fcd6e[_0x0d89('0x2')](_0x42bf76,_0x344d6f);};}function removeListener(_0xd2e389,_0x37f27d){return function(){ChatWebsiteEvents[_0x0d89('0x3')](_0xd2e389,_0x37f27d);};}exports[_0x0d89('0x4')]=function(_0x2ea564){for(var _0xbe8a2d=0x0,_0x25ce65=events[_0x0d89('0x5')];_0xbe8a2d<_0x25ce65;_0xbe8a2d++){var _0x19a9d7=events[_0xbe8a2d];var _0x443ca5=createListener('chatWebsite:'+_0x19a9d7,_0x2ea564);ChatWebsiteEvents['on'](_0x19a9d7,_0x443ca5);}}; \ No newline at end of file +var _0x3bae=['length','chatWebsite:','save','update','removeListener','register'];(function(_0x19733f,_0xf79a1){var _0x454af3=function(_0x19d9eb){while(--_0x19d9eb){_0x19733f['push'](_0x19733f['shift']());}};_0x454af3(++_0xf79a1);}(_0x3bae,0x7a));var _0xe3ba=function(_0x432d74,_0x51d55b){_0x432d74=_0x432d74-0x0;var _0x3b2daa=_0x3bae[_0x432d74];return _0x3b2daa;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xe3ba('0x0'),'remove',_0xe3ba('0x1')];function createListener(_0x44602d,_0x229efa){return function(_0x4c49e1){_0x229efa['emit'](_0x44602d,_0x4c49e1);};}function removeListener(_0x5ddc1b,_0x2b2ddd){return function(){ChatWebsiteEvents[_0xe3ba('0x2')](_0x5ddc1b,_0x2b2ddd);};}exports[_0xe3ba('0x3')]=function(_0xe74633){for(var _0xa2f78a=0x0,_0x163adf=events[_0xe3ba('0x4')];_0xa2f78a<_0x163adf;_0xa2f78a++){var _0x273ee6=events[_0xa2f78a];var _0x13add8=createListener(_0xe3ba('0x5')+_0x273ee6,_0xe74633);ChatWebsiteEvents['on'](_0x273ee6,_0x13add8);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b18f497..c3f6ef7 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 _0xd178=['notify','server/files','offline-chat','extname','replace','/:id/offline','offline','/:id/interactions','addInteraction','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','multer','path','Router','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','server/files/images/avatars/','/:id/avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd178,0xd8));var _0x8d17=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xd178[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x8d17('0x0'));var util=require('util');var path=require(_0x8d17('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8d17('0x2')]();var fs_extra=require(_0x8d17('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d17('0x4'));var controller=require(_0x8d17('0x5'));router[_0x8d17('0x6')]('/',auth[_0x8d17('0x7')](),controller[_0x8d17('0x8')]);router[_0x8d17('0x6')](_0x8d17('0x9'),auth[_0x8d17('0x7')](),controller[_0x8d17('0xa')]);router[_0x8d17('0x6')](_0x8d17('0xb'),auth[_0x8d17('0x7')](),controller[_0x8d17('0xc')]);router[_0x8d17('0x6')]('/:id/dispositions',auth[_0x8d17('0x7')](),controller[_0x8d17('0xd')]);router[_0x8d17('0x6')](_0x8d17('0xe'),auth[_0x8d17('0x7')](),controller[_0x8d17('0xf')]);router[_0x8d17('0x6')]('/:id/logo',controller[_0x8d17('0x10')]);router['get']('/:id/avatar',controller[_0x8d17('0x11')]);router[_0x8d17('0x6')](_0x8d17('0x12'),controller[_0x8d17('0x13')]);router[_0x8d17('0x6')]('/:id/system_avatar',controller[_0x8d17('0x14')]);router[_0x8d17('0x6')]('/:id/interactions',auth[_0x8d17('0x7')](),controller['getInteractions']);router[_0x8d17('0x6')](_0x8d17('0x15'),controller['getSnippet']);router['get'](_0x8d17('0x16'),auth['isAuthenticated'](),controller[_0x8d17('0x17')]);router[_0x8d17('0x6')](_0x8d17('0x18'),auth['isAuthenticated'](),controller[_0x8d17('0x19')]);router[_0x8d17('0x6')](_0x8d17('0x1a'),controller[_0x8d17('0x1b')]);router['get'](_0x8d17('0x1c'),auth[_0x8d17('0x7')](),controller['getOfflineMessages']);router[_0x8d17('0x6')](_0x8d17('0x1d'),auth['isAuthenticated'](),controller[_0x8d17('0x1e')]);router[_0x8d17('0x1f')]('/',auth[_0x8d17('0x7')](),controller[_0x8d17('0x20')]);router[_0x8d17('0x1f')](_0x8d17('0x21'),auth[_0x8d17('0x7')](),controller[_0x8d17('0x22')]);router['post']('/:id/canned_answers',auth[_0x8d17('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x8d17('0x23')]({'destination':function(_0xe68622,_0x5353cf,_0x2205d7){_0x2205d7(null,path[_0x8d17('0x24')](config[_0x8d17('0x25')],_0x8d17('0x26')));},'filename':function(_0x144c8b,_0x3cb8d9,_0x5d2420){_0x5d2420(null,util[_0x8d17('0x27')](_0x8d17('0x28'),Date[_0x8d17('0x29')](),_0x3cb8d9[_0x8d17('0x2a')]));}})});router['post'](_0x8d17('0x2b'),upload[_0x8d17('0x2c')](_0x8d17('0x2d')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x323a33,_0x2959b1,_0x1699c1){_0x1699c1(null,path[_0x8d17('0x24')](config['root'],_0x8d17('0x2e')));},'filename':function(_0x59b7a1,_0x2b30a3,_0x57f03b){_0x57f03b(null,util[_0x8d17('0x27')](_0x8d17('0x28'),Date['now'](),_0x2b30a3[_0x8d17('0x2a')]));}})});router[_0x8d17('0x1f')](_0x8d17('0x2f'),upload[_0x8d17('0x2c')](_0x8d17('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f5ec9,_0x16a15f,_0x3d96a0){_0x3d96a0(null,path[_0x8d17('0x24')](config[_0x8d17('0x25')],_0x8d17('0x2e')));},'filename':function(_0x260625,_0x4c8ee2,_0x30296f){_0x30296f(null,util[_0x8d17('0x27')](_0x8d17('0x28'),Date['now'](),_0x4c8ee2['originalname']));}})});router[_0x8d17('0x1f')]('/:id/customer_avatar',upload[_0x8d17('0x2c')]('file'),controller[_0x8d17('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c4a1c,_0x460173,_0x2e4c8a){_0x2e4c8a(null,path[_0x8d17('0x24')](config['root'],_0x8d17('0x2e')));},'filename':function(_0x58e745,_0x18ea69,_0x59e605){_0x59e605(null,util[_0x8d17('0x27')](_0x8d17('0x28'),Date['now'](),_0x18ea69['originalname']));}})});router[_0x8d17('0x1f')](_0x8d17('0x31'),upload[_0x8d17('0x2c')](_0x8d17('0x2d')),controller[_0x8d17('0x32')]);router[_0x8d17('0x1f')](_0x8d17('0x33'),controller[_0x8d17('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x8d17('0x23')]({'destination':function(_0x1c542d,_0x44215c,_0x1d1552){const _0x5de3e9=path[_0x8d17('0x24')](config[_0x8d17('0x25')],_0x8d17('0x35'),'attachments',_0x8d17('0x36'));fs_extra['ensureDir'](_0x5de3e9,function(){_0x1d1552(null,_0x5de3e9);});},'filename':function(_0x14542e,_0x453053,_0x5e1ded){const _0x57fdb8=_0x453053[_0x8d17('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x210c0f=path[_0x8d17('0x37')](_0x57fdb8);const _0x38413f=Date[_0x8d17('0x29')]()+'-'+_0x57fdb8[_0x8d17('0x38')](_0x210c0f,'')+_0x210c0f;_0x5e1ded(null,_0x38413f);}})});router[_0x8d17('0x1f')](_0x8d17('0x39'),offlineUploadMulter['any'](),controller[_0x8d17('0x3a')]);router['post'](_0x8d17('0x3b'),auth[_0x8d17('0x7')](),controller[_0x8d17('0x3c')]);router[_0x8d17('0x1f')](_0x8d17('0x16'),auth[_0x8d17('0x7')](),controller['addApplications']);router[_0x8d17('0x1f')](_0x8d17('0x18'),auth[_0x8d17('0x7')](),controller[_0x8d17('0x3d')]);router[_0x8d17('0x1f')](_0x8d17('0x1d'),auth[_0x8d17('0x7')](),controller[_0x8d17('0x3e')]);router['put'](_0x8d17('0xb'),auth[_0x8d17('0x7')](),controller[_0x8d17('0x3f')]);router[_0x8d17('0x40')](_0x8d17('0xb'),auth['isAuthenticated'](),controller[_0x8d17('0x41')]);router[_0x8d17('0x40')](_0x8d17('0x21'),auth['isAuthenticated'](),controller[_0x8d17('0x42')]);router[_0x8d17('0x40')](_0x8d17('0xe'),auth[_0x8d17('0x7')](),controller['removeAnswers']);router[_0x8d17('0x40')](_0x8d17('0x1d'),auth[_0x8d17('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xa329=['/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post','addAnswer','join','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','diskStorage','root','server/files/images/avatars/','addAvatar','addSystemAvatar','/:id/notify','attachments','ensureDir','extname','/:id/offline','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar'];(function(_0x5249ad,_0x39e576){var _0x44900f=function(_0x41f4dc){while(--_0x41f4dc){_0x5249ad['push'](_0x5249ad['shift']());}};_0x44900f(++_0x39e576);}(_0xa329,0x1c6));var _0x9a32=function(_0x4aeeb4,_0x228f16){_0x4aeeb4=_0x4aeeb4-0x0;var _0xcab88c=_0xa329[_0x4aeeb4];return _0xcab88c;};'use strict';var multer=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var path=require(_0x9a32('0x2'));var timeout=require(_0x9a32('0x3'));var express=require('express');var router=express[_0x9a32('0x4')]();var fs_extra=require(_0x9a32('0x5'));var auth=require(_0x9a32('0x6'));var interaction=require(_0x9a32('0x7'));var config=require('../../config/environment');var controller=require(_0x9a32('0x8'));router[_0x9a32('0x9')]('/',auth[_0x9a32('0xa')](),controller[_0x9a32('0xb')]);router[_0x9a32('0x9')](_0x9a32('0xc'),auth[_0x9a32('0xa')](),controller[_0x9a32('0xd')]);router[_0x9a32('0x9')](_0x9a32('0xe'),auth[_0x9a32('0xa')](),controller[_0x9a32('0xf')]);router[_0x9a32('0x9')](_0x9a32('0x10'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x11')]);router[_0x9a32('0x9')](_0x9a32('0x12'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x13')]);router['get'](_0x9a32('0x14'),controller['getLogo']);router[_0x9a32('0x9')](_0x9a32('0x15'),controller['getAvatar']);router[_0x9a32('0x9')](_0x9a32('0x16'),controller[_0x9a32('0x17')]);router['get']('/:id/system_avatar',controller[_0x9a32('0x18')]);router[_0x9a32('0x9')](_0x9a32('0x19'),auth[_0x9a32('0xa')](),controller['getInteractions']);router[_0x9a32('0x9')](_0x9a32('0x1a'),controller[_0x9a32('0x1b')]);router[_0x9a32('0x9')]('/:id/applications',auth[_0x9a32('0xa')](),controller[_0x9a32('0x1c')]);router[_0x9a32('0x9')](_0x9a32('0x1d'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x1e')]);router[_0x9a32('0x9')](_0x9a32('0x1f'),controller['getFields']);router[_0x9a32('0x9')](_0x9a32('0x20'),auth[_0x9a32('0xa')](),controller['getOfflineMessages']);router['get'](_0x9a32('0x21'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x22')]);router[_0x9a32('0x23')]('/',auth[_0x9a32('0xa')](),controller['create']);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x9a32('0x23')](_0x9a32('0x12'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b14b9,_0x23fc7a,_0x370d08){_0x370d08(null,path[_0x9a32('0x25')](config['root'],_0x9a32('0x26')));},'filename':function(_0x5bd87e,_0x455d1e,_0x35f10a){_0x35f10a(null,util[_0x9a32('0x27')](_0x9a32('0x28'),Date[_0x9a32('0x29')](),_0x455d1e[_0x9a32('0x2a')]));}})});router[_0x9a32('0x23')](_0x9a32('0x14'),upload[_0x9a32('0x2b')](_0x9a32('0x2c')),controller[_0x9a32('0x2d')]);var upload=multer({'storage':multer[_0x9a32('0x2e')]({'destination':function(_0x336a4b,_0x4c4e21,_0x561472){_0x561472(null,path[_0x9a32('0x25')](config[_0x9a32('0x2f')],_0x9a32('0x30')));},'filename':function(_0x1b3c3d,_0x1cc71c,_0x4d53a0){_0x4d53a0(null,util['format'](_0x9a32('0x28'),Date[_0x9a32('0x29')](),_0x1cc71c[_0x9a32('0x2a')]));}})});router['post'](_0x9a32('0x15'),upload[_0x9a32('0x2b')](_0x9a32('0x2c')),controller[_0x9a32('0x31')]);var upload=multer({'storage':multer[_0x9a32('0x2e')]({'destination':function(_0x3b9dab,_0x50466c,_0x3686b7){_0x3686b7(null,path[_0x9a32('0x25')](config[_0x9a32('0x2f')],_0x9a32('0x30')));},'filename':function(_0x5c9e62,_0x15743f,_0x6e87c5){_0x6e87c5(null,util['format'](_0x9a32('0x28'),Date[_0x9a32('0x29')](),_0x15743f[_0x9a32('0x2a')]));}})});router[_0x9a32('0x23')]('/:id/customer_avatar',upload[_0x9a32('0x2b')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x9a32('0x2e')]({'destination':function(_0x446410,_0x286212,_0x373f44){_0x373f44(null,path[_0x9a32('0x25')](config[_0x9a32('0x2f')],_0x9a32('0x30')));},'filename':function(_0x3355ab,_0x3f0606,_0x468dcf){_0x468dcf(null,util[_0x9a32('0x27')](_0x9a32('0x28'),Date['now'](),_0x3f0606[_0x9a32('0x2a')]));}})});router[_0x9a32('0x23')]('/:id/system_avatar',upload[_0x9a32('0x2b')](_0x9a32('0x2c')),controller[_0x9a32('0x32')]);router['post'](_0x9a32('0x33'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x9a32('0x2e')]({'destination':function(_0x2629d7,_0x3b7e0b,_0x3ac758){const _0x5410c0=path['join'](config[_0x9a32('0x2f')],'server/files',_0x9a32('0x34'),'offline-chat');fs_extra[_0x9a32('0x35')](_0x5410c0,function(){_0x3ac758(null,_0x5410c0);});},'filename':function(_0xa7ed2,_0x45af82,_0x7bb207){const _0x569c65=_0x45af82['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2e7e11=path[_0x9a32('0x36')](_0x569c65);const _0x13e358=Date['now']()+'-'+_0x569c65['replace'](_0x2e7e11,'')+_0x2e7e11;_0x7bb207(null,_0x13e358);}})});router[_0x9a32('0x23')](_0x9a32('0x37'),offlineUploadMulter['any'](),controller[_0x9a32('0x38')]);router['post'](_0x9a32('0x19'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x39')]);router[_0x9a32('0x23')](_0x9a32('0x3a'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x3b')]);router[_0x9a32('0x23')](_0x9a32('0x1d'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x3c')]);router['post'](_0x9a32('0x21'),auth[_0x9a32('0xa')](),controller[_0x9a32('0x3d')]);router[_0x9a32('0x3e')]('/:id',auth[_0x9a32('0xa')](),controller[_0x9a32('0x3f')]);router[_0x9a32('0x40')](_0x9a32('0xe'),auth['isAuthenticated'](),controller[_0x9a32('0x41')]);router[_0x9a32('0x40')](_0x9a32('0x10'),auth['isAuthenticated'](),controller[_0x9a32('0x42')]);router[_0x9a32('0x40')](_0x9a32('0x12'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x9a32('0x40')]('/:id/users',auth[_0x9a32('0xa')](),controller['removeAgents']);module[_0x9a32('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index f2d0070..6b50105 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 _0xa2ef=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','express','../components/auth/service','Router','env','production','app'];(function(_0x1ba256,_0x4d67c1){var _0x3254b0=function(_0x3e8588){while(--_0x3e8588){_0x1ba256['push'](_0x1ba256['shift']());}};_0x3254b0(++_0x4d67c1);}(_0xa2ef,0x13f));var _0xfa2e=function(_0x23089d,_0x1ac088){_0x23089d=_0x23089d-0x0;var _0x5a0868=_0xa2ef[_0x23089d];return _0x5a0868;};var beaverLogger=require('beaver-logger/server');var express=require(_0xfa2e('0x0'));var auth=require(_0xfa2e('0x1'));var config=require('../config/environment');var router=express[_0xfa2e('0x2')]();var isProduction=config[_0xfa2e('0x3')]===_0xfa2e('0x4')||![];function clientSideLogs(_0x450d35,_0x5e989c,_0x1dcc49){var _0x26f05c=_0x450d35[_0xfa2e('0x5')][_0xfa2e('0x6')](_0xfa2e('0x7'));if(!_0x26f05c){throw new Error(_0xfa2e('0x8'));}return beaverLogger[_0xfa2e('0x9')]({'uri':_0xfa2e('0xa'),'logger':_0x26f05c,'enableCors':!isProduction})(_0x450d35,_0x5e989c,_0x1dcc49);}router['use'](auth[_0xfa2e('0xb')](),clientSideLogs);module[_0xfa2e('0xc')]=router; \ No newline at end of file +var _0x9e08=['client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router','env','production','get'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9e08,0x88));var _0x89e0=function(_0x2b68df,_0x1e4990){_0x2b68df=_0x2b68df-0x0;var _0x30fbd1=_0x9e08[_0x2b68df];return _0x30fbd1;};var beaverLogger=require('beaver-logger/server');var express=require(_0x89e0('0x0'));var auth=require(_0x89e0('0x1'));var config=require(_0x89e0('0x2'));var router=express[_0x89e0('0x3')]();var isProduction=config[_0x89e0('0x4')]===_0x89e0('0x5')||![];function clientSideLogs(_0x57dcfb,_0x513d61,_0x4629db){var _0x3ad22c=_0x57dcfb['app'][_0x89e0('0x6')](_0x89e0('0x7'));if(!_0x3ad22c){throw new Error(_0x89e0('0x8'));}return beaverLogger[_0x89e0('0x9')]({'uri':'/client-logs','logger':_0x3ad22c,'enableCors':!isProduction})(_0x57dcfb,_0x513d61,_0x4629db);}router[_0x89e0('0xa')](auth[_0x89e0('0xb')](),clientSideLogs);module[_0x89e0('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 92ebf7d..d949ce2 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 _0xa6fa=['exports','STRING','AmazonAWS','ENUM','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize'];(function(_0x1f5b9e,_0x4331e6){var _0x5947b0=function(_0x398b18){while(--_0x398b18){_0x1f5b9e['push'](_0x1f5b9e['shift']());}};_0x5947b0(++_0x4331e6);}(_0xa6fa,0x81));var _0xaa6f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa6fa[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xaa6f('0x0'));module[_0xaa6f('0x1')]={'name':{'type':Sequelize[_0xaa6f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xaa6f('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xaa6f('0x4')]('Outlook365',_0xaa6f('0x5'))},'data1':{'type':Sequelize[_0xaa6f('0x2')],'comment':_0xaa6f('0x6')},'data2':{'type':Sequelize[_0xaa6f('0x2')],'comment':_0xaa6f('0x7')},'data3':{'type':Sequelize['STRING'],'comment':_0xaa6f('0x8')},'data4':{'type':Sequelize[_0xaa6f('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xaa6f('0x9')],'comment':_0xaa6f('0xa')},'data6':{'type':Sequelize[_0xaa6f('0x9')],'comment':_0xaa6f('0xb')},'data7':{'type':Sequelize[_0xaa6f('0x9')],'comment':_0xaa6f('0xc')}}; \ No newline at end of file +var _0xf047=['sequelize','exports','STRING','ENUM','Google','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf047,0xd8));var _0x7f04=function(_0x644668,_0x7e646d){_0x644668=_0x644668-0x0;var _0x4c9344=_0xf047[_0x644668];return _0x4c9344;};'use strict';var Sequelize=require(_0x7f04('0x0'));module[_0x7f04('0x1')]={'name':{'type':Sequelize[_0x7f04('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7f04('0x3')]('AmazonAWS',_0x7f04('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x7f04('0x3')](_0x7f04('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x7f04('0x2')],'comment':_0x7f04('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0x7f04('0x7')},'data3':{'type':Sequelize['STRING'],'comment':_0x7f04('0x8')},'data4':{'type':Sequelize[_0x7f04('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x7f04('0x9')],'comment':_0x7f04('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0x7f04('0xb')},'data7':{'type':Sequelize[_0x7f04('0x9')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e91b52c..8adc545 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 _0x54dc=['MicrosoftAzure','data3','find','decryptString','catch','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','params','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','isValidIdToken','id_token','code','access_token','data6','refresh_token','data5','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','padEnd','slice','index','map','CloudProvider','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','service'];(function(_0x4654c6,_0x17c4a8){var _0x286118=function(_0x29df7e){while(--_0x29df7e){_0x4654c6['push'](_0x4654c6['shift']());}};_0x286118(++_0x17c4a8);}(_0x54dc,0x1e9));var _0xc54d=function(_0x4383e9,_0xa4b307){_0x4383e9=_0x4383e9-0x0;var _0x355405=_0x54dc[_0x4383e9];return _0x355405;};'use strict';var _=require('lodash');var Redis=require(_0xc54d('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xc54d('0x1'));var config=require('../../config/environment');var logger=require(_0xc54d('0x2'))(_0xc54d('0x3'));var db=require(_0xc54d('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xc54d('0x5')]=_[_0xc54d('0x6')](config[_0xc54d('0x5')],{'host':_0xc54d('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0xc54d('0x5')]);function respondWithStatusCode(_0x4b2507,_0x47db3d){_0x47db3d=_0x47db3d||0xcc;return function(_0x19c3d3){if(_0x19c3d3){return _0x4b2507['sendStatus'](_0x47db3d);}return _0x4b2507[_0xc54d('0x8')](_0x47db3d)[_0xc54d('0x9')]();};}function respondWithResult(_0x53d0e1,_0x336ebf){_0x336ebf=_0x336ebf||0xc8;return function(_0xb0a71a){if(_0xb0a71a){return _0x53d0e1[_0xc54d('0x8')](_0x336ebf)[_0xc54d('0xa')](_0xb0a71a);}};}function respondWithFilteredResult(_0x184c0d,_0x1c73ea){return function(_0x1863b0){if(_0x1863b0){var _0x39c9c7=typeof _0x1c73ea[_0xc54d('0xb')]===_0xc54d('0xc')&&typeof _0x1c73ea[_0xc54d('0xd')]==='undefined';var _0x4a82c0=_0x1863b0['count'];var _0x502497=_0x39c9c7?0x0:_0x1c73ea[_0xc54d('0xb')];var _0x4e8946=_0x39c9c7?_0x1863b0[_0xc54d('0xe')]:_0x1c73ea[_0xc54d('0xb')]+_0x1c73ea[_0xc54d('0xd')];var _0x562729;if(_0x4e8946>=_0x4a82c0){_0x4e8946=_0x4a82c0;_0x562729=0xc8;}else{_0x562729=0xce;}_0x184c0d[_0xc54d('0x8')](_0x562729);return _0x184c0d[_0xc54d('0xf')](_0xc54d('0x10'),_0x502497+'-'+_0x4e8946+'/'+_0x4a82c0)[_0xc54d('0xa')](_0x1863b0);}return null;};}function saveUpdates(_0x4536b8){return function(_0x31c1ab){if(_0x31c1ab){return _0x31c1ab[_0xc54d('0x11')](_0x4536b8)[_0xc54d('0x12')](function(_0x13d596){return _0x13d596;});}return null;};}function removeEntity(_0x12148a){return function(_0x4d01ec){if(_0x4d01ec){return _0x4d01ec['destroy']()[_0xc54d('0x12')](function(){_0x12148a[_0xc54d('0x8')](0xcc)[_0xc54d('0x9')]();});}};}function handleEntityNotFound(_0x366128){return function(_0x41da05){if(!_0x41da05){_0x366128[_0xc54d('0x13')](0x194);}return _0x41da05;};}function handleError(_0x3f49bf,_0x494258){_0x494258=_0x494258||0x1f4;return function(_0x18b092){logger[_0xc54d('0x14')](_0x18b092[_0xc54d('0x15')]);if(_0x18b092[_0xc54d('0x16')]){delete _0x18b092['name'];}_0x3f49bf['status'](_0x494258)[_0xc54d('0x17')](_0x18b092);};}function maskClientSecret(_0x3c165d){return _[_0xc54d('0x18')](_0x3c165d[_0xc54d('0x19')](0x0,0x3),0x14,'*');}exports[_0xc54d('0x1a')]=function(_0x1a6320,_0x13d023){var _0x2478c5={},_0x1b680e={},_0x19ed7d={'count':0x0,'rows':[]};var _0x1ae93b=_[_0xc54d('0x1b')](db[_0xc54d('0x1c')]['rawAttributes'],function(_0x4f6529){return{'name':_0x4f6529['fieldName'],'type':_0x4f6529[_0xc54d('0x1d')][_0xc54d('0x1e')]};});_0x1b680e[_0xc54d('0x1f')]=_[_0xc54d('0x1b')](_0x1ae93b,_0xc54d('0x16'));_0x1b680e[_0xc54d('0x20')]=_[_0xc54d('0x21')](_0x1a6320['query']);_0x1b680e[_0xc54d('0x22')]=_[_0xc54d('0x23')](_0x1b680e['model'],_0x1b680e[_0xc54d('0x20')]);_0x2478c5[_0xc54d('0x24')]=_[_0xc54d('0x23')](_0x1b680e['model'],qs[_0xc54d('0x25')](_0x1a6320['query']['fields']));_0x2478c5[_0xc54d('0x24')]=_0x2478c5[_0xc54d('0x24')]['length']?_0x2478c5[_0xc54d('0x24')]:_0x1b680e['model'];if(!_0x1a6320[_0xc54d('0x20')][_0xc54d('0x26')]('nolimit')){_0x2478c5[_0xc54d('0xd')]=qs['limit'](_0x1a6320[_0xc54d('0x20')][_0xc54d('0xd')]);_0x2478c5[_0xc54d('0xb')]=qs[_0xc54d('0xb')](_0x1a6320['query'][_0xc54d('0xb')]);}_0x2478c5[_0xc54d('0x27')]=qs[_0xc54d('0x28')](_0x1a6320[_0xc54d('0x20')]['sort']);_0x2478c5[_0xc54d('0x29')]=qs[_0xc54d('0x22')](_[_0xc54d('0x2a')](_0x1a6320[_0xc54d('0x20')],_0x1b680e[_0xc54d('0x22')]),_0x1ae93b);if(_0x1a6320[_0xc54d('0x20')][_0xc54d('0x2b')]){_0x2478c5[_0xc54d('0x29')]=_[_0xc54d('0x2c')](_0x2478c5[_0xc54d('0x29')],{'$or':_['map'](_0x1ae93b,function(_0x5934b0){if(_0x5934b0[_0xc54d('0x1d')]!=='VIRTUAL'){var _0x1ac942={};_0x1ac942[_0x5934b0[_0xc54d('0x16')]]={'$like':'%'+_0x1a6320['query'][_0xc54d('0x2b')]+'%'};return _0x1ac942;}})});}_0x2478c5=_[_0xc54d('0x2c')]({},_0x2478c5,_0x1a6320[_0xc54d('0x2d')]);var _0xfa02ed={'where':_0x2478c5[_0xc54d('0x29')]};return db[_0xc54d('0x1c')][_0xc54d('0xe')](_0xfa02ed)[_0xc54d('0x12')](function(_0x3ec02a){_0x19ed7d[_0xc54d('0xe')]=_0x3ec02a;if(_0x1a6320[_0xc54d('0x20')][_0xc54d('0x2e')]){_0x2478c5[_0xc54d('0x2f')]=[{'all':!![]}];}return db['CloudProvider'][_0xc54d('0x30')](_0x2478c5);})['then'](function(_0x3c01d6){_0x19ed7d[_0xc54d('0x31')]=_[_0xc54d('0x1b')](_0x3c01d6,function(_0x775153){if(_0x775153[_0xc54d('0x32')]===_0xc54d('0x33')){var _0x1832c6=encryptor['decryptString'](_0x775153[_0xc54d('0x34')]);_0x775153['data3']=maskClientSecret(_0x1832c6);}return _0x775153;});return _0x19ed7d;})[_0xc54d('0x12')](respondWithFilteredResult(_0x13d023,_0x2478c5))['catch'](handleError(_0x13d023,null));};exports['show']=function(_0x3980cc,_0x10ee7f){var _0x544acd={'raw':!![],'where':{'id':_0x3980cc['params']['id']}},_0x1c329b={};_0x1c329b['model']=_[_0xc54d('0x21')](db[_0xc54d('0x1c')]['rawAttributes']);_0x1c329b[_0xc54d('0x20')]=_[_0xc54d('0x21')](_0x3980cc[_0xc54d('0x20')]);_0x1c329b['filters']=_[_0xc54d('0x23')](_0x1c329b[_0xc54d('0x1f')],_0x1c329b[_0xc54d('0x20')]);_0x544acd[_0xc54d('0x24')]=_[_0xc54d('0x23')](_0x1c329b['model'],qs[_0xc54d('0x25')](_0x3980cc['query'][_0xc54d('0x25')]));_0x544acd['attributes']=_0x544acd[_0xc54d('0x24')]['length']?_0x544acd['attributes']:_0x1c329b[_0xc54d('0x1f')];if(_0x3980cc[_0xc54d('0x20')]['includeAll']){_0x544acd[_0xc54d('0x2f')]=[{'all':!![]}];}_0x544acd=_[_0xc54d('0x2c')]({},_0x544acd,_0x3980cc['options']);return db[_0xc54d('0x1c')][_0xc54d('0x35')](_0x544acd)[_0xc54d('0x12')](handleEntityNotFound(_0x10ee7f,null))[_0xc54d('0x12')](function(_0x7b7e72){if(_0x7b7e72['service']===_0xc54d('0x33')){var _0x2e11ff=encryptor[_0xc54d('0x36')](_0x7b7e72['data3']);_0x7b7e72[_0xc54d('0x34')]=maskClientSecret(_0x2e11ff);}return _0x7b7e72;})[_0xc54d('0x12')](respondWithResult(_0x10ee7f,null))[_0xc54d('0x37')](handleError(_0x10ee7f,null));};exports[_0xc54d('0x38')]=function(_0x6f0e5f,_0x5f4c60){if(!_0x6f0e5f[_0xc54d('0x39')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x6f0e5f[_0xc54d('0x39')][_0xc54d('0x32')])throw new Error(_0xc54d('0x3a'));var _0x31ec55=db['CloudProvider']['rawAttributes']['service'][_0xc54d('0x3b')];if(!_0x31ec55[_0xc54d('0x3c')](_0x6f0e5f[_0xc54d('0x39')][_0xc54d('0x32')]))throw new Error(_0xc54d('0x3d')+_0x31ec55[_0xc54d('0x3e')](',\x20'));if(_0x6f0e5f[_0xc54d('0x39')][_0xc54d('0x32')]==='MicrosoftAzure'&&_0x6f0e5f[_0xc54d('0x39')]['data3']){_0x6f0e5f[_0xc54d('0x39')][_0xc54d('0x34')]=encryptor['encryptString'](_0x6f0e5f[_0xc54d('0x39')][_0xc54d('0x34')]);}return db[_0xc54d('0x1c')][_0xc54d('0x38')](_0x6f0e5f['body'],{})[_0xc54d('0x12')](respondWithResult(_0x5f4c60,0xc9))[_0xc54d('0x37')](handleError(_0x5f4c60,null));};exports[_0xc54d('0x11')]=function(_0x1f0e3b,_0x5a503c){if(_0x1f0e3b[_0xc54d('0x39')]['id']){delete _0x1f0e3b['body']['id'];}return db[_0xc54d('0x1c')]['find']({'where':{'id':_0x1f0e3b[_0xc54d('0x3f')]['id']}})[_0xc54d('0x12')](handleEntityNotFound(_0x5a503c,null))[_0xc54d('0x12')](function(_0xbfd79d){if(_0xbfd79d[_0xc54d('0x32')]===_0xc54d('0x33')&&_0x1f0e3b[_0xc54d('0x39')][_0xc54d('0x34')]){_0x1f0e3b['body'][_0xc54d('0x34')]=encryptor[_0xc54d('0x40')](_0x1f0e3b['body'][_0xc54d('0x34')]);}return _0xbfd79d;})['then'](saveUpdates(_0x1f0e3b[_0xc54d('0x39')],null))[_0xc54d('0x12')](respondWithResult(_0x5a503c,null))[_0xc54d('0x37')](handleError(_0x5a503c,null));};exports['destroy']=function(_0x158baf,_0x2dac7a){return db[_0xc54d('0x1c')][_0xc54d('0x35')]({'where':{'id':_0x158baf[_0xc54d('0x3f')]['id']}})[_0xc54d('0x12')](handleEntityNotFound(_0x2dac7a,null))[_0xc54d('0x12')](removeEntity(_0x2dac7a,null))[_0xc54d('0x37')](handleError(_0x2dac7a,null));};exports[_0xc54d('0x41')]=function(_0x3ed7c3,_0x150ff0){return db['CloudProvider'][_0xc54d('0x42')]({'where':{'id':_0x3ed7c3[_0xc54d('0x3f')]['id']},'raw':!![]})[_0xc54d('0x12')](function(_0x466dd6){if(!_0x466dd6)return _0x150ff0[_0xc54d('0x13')](0x194);return{'url':oauth[_0xc54d('0x43')](_0x466dd6,_0x3ed7c3[_0xc54d('0x44')]['id'])};})['then'](respondWithResult(_0x150ff0,null))['catch'](handleError(_0x150ff0,null));};exports[_0xc54d('0x45')]=function(_0xc5a48c,_0x3cbd04){var _0x33b935=_0xc5a48c['body'];var _0x40ded1;var _0x33ceab;if(_0x33b935[_0xc54d('0x14')])throw _0x33b935;redis['get'](_0x33b935[_0xc54d('0x46')])['then'](function(_0x56eb99){if(!_0x56eb99)throw new Error(_0xc54d('0x47'));_0x40ded1=JSON['parse'](_0x56eb99);var _0x4f6aea=Buffer[_0xc54d('0x48')](_0x33b935[_0xc54d('0x46')],_0xc54d('0x49'))[_0xc54d('0x4a')](_0xc54d('0x4b'));_0x33ceab=JSON['parse'](_0x4f6aea);if(!oauth[_0xc54d('0x4c')](_0x33b935[_0xc54d('0x4d')],_0x40ded1['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x33b935[_0xc54d('0x46')]);return oauth['getOauth2MicrosoftAccessToken'](_0x33b935[_0xc54d('0x4e')],_0x40ded1);})['then'](function(_0x22b91c){_0x40ded1['data5']=_0x22b91c[_0xc54d('0x4f')];_0x40ded1[_0xc54d('0x50')]=_0x22b91c[_0xc54d('0x51')];return db['CloudProvider'][_0xc54d('0x11')]({'data5':_0x40ded1[_0xc54d('0x52')],'data6':_0x40ded1['data6']},{'where':{'id':_0x40ded1['id']}});})[_0xc54d('0x12')](function(){oauth['startRefreshInterval'](_0x40ded1);socket[_0xc54d('0x53')](_0xc54d('0x54'),{'id':_0x33ceab['id']});return;})[_0xc54d('0x12')](respondWithStatusCode(_0x3cbd04,null))[_0xc54d('0x37')](function(_0x2bcbc8){if(_0x33ceab){socket[_0xc54d('0x53')](_0xc54d('0x55'),{'id':_0x33ceab['id']});}if(!_0x40ded1){logger[_0xc54d('0x14')](_0xc54d('0x56'),_0x2bcbc8);return _0x3cbd04[_0xc54d('0x8')](0x1f4)[_0xc54d('0x17')](_0x2bcbc8[_0xc54d('0x57')]);}logger[_0xc54d('0x14')](_0xc54d('0x58'),_0x40ded1['id'],JSON[_0xc54d('0x59')](_0x2bcbc8));});}; \ No newline at end of file +var _0x79e9=['service','MicrosoftAzure','decryptString','data3','catch','show','params','find','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','end','status','json','offset','limit','count','set','update','then','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x79e9,0x8b));var _0x979e=function(_0x5d23c0,_0x31b911){_0x5d23c0=_0x5d23c0-0x0;var _0x68af05=_0x79e9[_0x5d23c0];return _0x68af05;};'use strict';var _=require(_0x979e('0x0'));var Redis=require(_0x979e('0x1'));var qs=require(_0x979e('0x2'));var encryptor=require(_0x979e('0x3'));var config=require(_0x979e('0x4'));var logger=require(_0x979e('0x5'))(_0x979e('0x6'));var db=require(_0x979e('0x7'))['db'];var oauth=require(_0x979e('0x8'));config[_0x979e('0x9')]=_[_0x979e('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x979e('0xb'))(new Redis(config[_0x979e('0x9')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x28908e,_0x1940a4){_0x1940a4=_0x1940a4||0xcc;return function(_0x46b757){if(_0x46b757){return _0x28908e[_0x979e('0xc')](_0x1940a4);}return _0x28908e['status'](_0x1940a4)[_0x979e('0xd')]();};}function respondWithResult(_0x19facd,_0x3ac759){_0x3ac759=_0x3ac759||0xc8;return function(_0x317e3d){if(_0x317e3d){return _0x19facd[_0x979e('0xe')](_0x3ac759)[_0x979e('0xf')](_0x317e3d);}};}function respondWithFilteredResult(_0x492305,_0x32b9c0){return function(_0x33aa2b){if(_0x33aa2b){var _0x3a1fca=typeof _0x32b9c0[_0x979e('0x10')]==='undefined'&&typeof _0x32b9c0[_0x979e('0x11')]==='undefined';var _0x270177=_0x33aa2b[_0x979e('0x12')];var _0xd40213=_0x3a1fca?0x0:_0x32b9c0[_0x979e('0x10')];var _0x2df208=_0x3a1fca?_0x33aa2b[_0x979e('0x12')]:_0x32b9c0[_0x979e('0x10')]+_0x32b9c0[_0x979e('0x11')];var _0x1c5cd5;if(_0x2df208>=_0x270177){_0x2df208=_0x270177;_0x1c5cd5=0xc8;}else{_0x1c5cd5=0xce;}_0x492305[_0x979e('0xe')](_0x1c5cd5);return _0x492305[_0x979e('0x13')]('Content-Range',_0xd40213+'-'+_0x2df208+'/'+_0x270177)[_0x979e('0xf')](_0x33aa2b);}return null;};}function saveUpdates(_0x4727dc){return function(_0x2be3a8){if(_0x2be3a8){return _0x2be3a8[_0x979e('0x14')](_0x4727dc)[_0x979e('0x15')](function(_0xc1fc7e){return _0xc1fc7e;});}return null;};}function removeEntity(_0x2dac69){return function(_0x1820a2){if(_0x1820a2){return _0x1820a2['destroy']()[_0x979e('0x15')](function(){_0x2dac69['status'](0xcc)[_0x979e('0xd')]();});}};}function handleEntityNotFound(_0x35a32d){return function(_0x3bd156){if(!_0x3bd156){_0x35a32d['sendStatus'](0x194);}return _0x3bd156;};}function handleError(_0x13ec3c,_0x304ae4){_0x304ae4=_0x304ae4||0x1f4;return function(_0x31ae18){logger[_0x979e('0x16')](_0x31ae18[_0x979e('0x17')]);if(_0x31ae18[_0x979e('0x18')]){delete _0x31ae18[_0x979e('0x18')];}_0x13ec3c[_0x979e('0xe')](_0x304ae4)[_0x979e('0x19')](_0x31ae18);};}function maskClientSecret(_0x3e3d0e){return _['padEnd'](_0x3e3d0e[_0x979e('0x1a')](0x0,0x3),0x14,'*');}exports[_0x979e('0x1b')]=function(_0x2bda43,_0x3956e5){var _0x3ab103={},_0x28833b={},_0x266047={'count':0x0,'rows':[]};var _0x11d78d=_[_0x979e('0x1c')](db[_0x979e('0x1d')][_0x979e('0x1e')],function(_0x3ade58){return{'name':_0x3ade58['fieldName'],'type':_0x3ade58[_0x979e('0x1f')][_0x979e('0x20')]};});_0x28833b[_0x979e('0x21')]=_[_0x979e('0x1c')](_0x11d78d,_0x979e('0x18'));_0x28833b[_0x979e('0x22')]=_[_0x979e('0x23')](_0x2bda43[_0x979e('0x22')]);_0x28833b[_0x979e('0x24')]=_[_0x979e('0x25')](_0x28833b[_0x979e('0x21')],_0x28833b[_0x979e('0x22')]);_0x3ab103[_0x979e('0x26')]=_['intersection'](_0x28833b[_0x979e('0x21')],qs[_0x979e('0x27')](_0x2bda43[_0x979e('0x22')][_0x979e('0x27')]));_0x3ab103[_0x979e('0x26')]=_0x3ab103[_0x979e('0x26')][_0x979e('0x28')]?_0x3ab103[_0x979e('0x26')]:_0x28833b[_0x979e('0x21')];if(!_0x2bda43[_0x979e('0x22')]['hasOwnProperty'](_0x979e('0x29'))){_0x3ab103[_0x979e('0x11')]=qs['limit'](_0x2bda43[_0x979e('0x22')][_0x979e('0x11')]);_0x3ab103['offset']=qs['offset'](_0x2bda43[_0x979e('0x22')][_0x979e('0x10')]);}_0x3ab103[_0x979e('0x2a')]=qs['sort'](_0x2bda43[_0x979e('0x22')][_0x979e('0x2b')]);_0x3ab103[_0x979e('0x2c')]=qs['filters'](_[_0x979e('0x2d')](_0x2bda43['query'],_0x28833b[_0x979e('0x24')]),_0x11d78d);if(_0x2bda43['query']['filter']){_0x3ab103['where']=_[_0x979e('0x2e')](_0x3ab103[_0x979e('0x2c')],{'$or':_['map'](_0x11d78d,function(_0x126213){if(_0x126213[_0x979e('0x1f')]!=='VIRTUAL'){var _0x158932={};_0x158932[_0x126213[_0x979e('0x18')]]={'$like':'%'+_0x2bda43[_0x979e('0x22')][_0x979e('0x2f')]+'%'};return _0x158932;}})});}_0x3ab103=_[_0x979e('0x2e')]({},_0x3ab103,_0x2bda43[_0x979e('0x30')]);var _0x5b3ff7={'where':_0x3ab103[_0x979e('0x2c')]};return db[_0x979e('0x1d')][_0x979e('0x12')](_0x5b3ff7)[_0x979e('0x15')](function(_0x4122a0){_0x266047[_0x979e('0x12')]=_0x4122a0;if(_0x2bda43[_0x979e('0x22')][_0x979e('0x31')]){_0x3ab103[_0x979e('0x32')]=[{'all':!![]}];}return db[_0x979e('0x1d')][_0x979e('0x33')](_0x3ab103);})['then'](function(_0x771154){_0x266047[_0x979e('0x34')]=_[_0x979e('0x1c')](_0x771154,function(_0x17e9bf){if(_0x17e9bf[_0x979e('0x35')]===_0x979e('0x36')){var _0x113006=encryptor[_0x979e('0x37')](_0x17e9bf[_0x979e('0x38')]);_0x17e9bf[_0x979e('0x38')]=maskClientSecret(_0x113006);}return _0x17e9bf;});return _0x266047;})[_0x979e('0x15')](respondWithFilteredResult(_0x3956e5,_0x3ab103))[_0x979e('0x39')](handleError(_0x3956e5,null));};exports[_0x979e('0x3a')]=function(_0x4cf80d,_0x49536b){var _0x8e993e={'raw':!![],'where':{'id':_0x4cf80d[_0x979e('0x3b')]['id']}},_0x2ec012={};_0x2ec012[_0x979e('0x21')]=_[_0x979e('0x23')](db[_0x979e('0x1d')][_0x979e('0x1e')]);_0x2ec012[_0x979e('0x22')]=_[_0x979e('0x23')](_0x4cf80d['query']);_0x2ec012[_0x979e('0x24')]=_[_0x979e('0x25')](_0x2ec012['model'],_0x2ec012[_0x979e('0x22')]);_0x8e993e['attributes']=_[_0x979e('0x25')](_0x2ec012['model'],qs['fields'](_0x4cf80d['query'][_0x979e('0x27')]));_0x8e993e[_0x979e('0x26')]=_0x8e993e[_0x979e('0x26')][_0x979e('0x28')]?_0x8e993e[_0x979e('0x26')]:_0x2ec012[_0x979e('0x21')];if(_0x4cf80d[_0x979e('0x22')]['includeAll']){_0x8e993e[_0x979e('0x32')]=[{'all':!![]}];}_0x8e993e=_[_0x979e('0x2e')]({},_0x8e993e,_0x4cf80d['options']);return db[_0x979e('0x1d')][_0x979e('0x3c')](_0x8e993e)[_0x979e('0x15')](handleEntityNotFound(_0x49536b,null))['then'](function(_0x2d4fa4){if(_0x2d4fa4[_0x979e('0x35')]==='MicrosoftAzure'){var _0x487e36=encryptor['decryptString'](_0x2d4fa4[_0x979e('0x38')]);_0x2d4fa4[_0x979e('0x38')]=maskClientSecret(_0x487e36);}return _0x2d4fa4;})['then'](respondWithResult(_0x49536b,null))[_0x979e('0x39')](handleError(_0x49536b,null));};exports['create']=function(_0x1811b1,_0x3fe914){if(!_0x1811b1[_0x979e('0x3d')][_0x979e('0x18')])throw new Error(_0x979e('0x3e'));if(!_0x1811b1[_0x979e('0x3d')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x5e2210=db[_0x979e('0x1d')][_0x979e('0x1e')][_0x979e('0x35')][_0x979e('0x3f')];if(!_0x5e2210[_0x979e('0x40')](_0x1811b1[_0x979e('0x3d')][_0x979e('0x35')]))throw new Error(_0x979e('0x41')+_0x5e2210['join'](',\x20'));if(_0x1811b1[_0x979e('0x3d')]['service']==='MicrosoftAzure'&&_0x1811b1[_0x979e('0x3d')][_0x979e('0x38')]){_0x1811b1[_0x979e('0x3d')][_0x979e('0x38')]=encryptor[_0x979e('0x42')](_0x1811b1[_0x979e('0x3d')][_0x979e('0x38')]);}return db[_0x979e('0x1d')][_0x979e('0x43')](_0x1811b1['body'],{})[_0x979e('0x15')](respondWithResult(_0x3fe914,0xc9))['catch'](handleError(_0x3fe914,null));};exports[_0x979e('0x14')]=function(_0x16b155,_0x1d4eb2){if(_0x16b155[_0x979e('0x3d')]['id']){delete _0x16b155[_0x979e('0x3d')]['id'];}return db[_0x979e('0x1d')][_0x979e('0x3c')]({'where':{'id':_0x16b155[_0x979e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1d4eb2,null))[_0x979e('0x15')](function(_0x10ef8e){if(_0x10ef8e['service']===_0x979e('0x36')&&_0x16b155[_0x979e('0x3d')]['data3']){_0x16b155[_0x979e('0x3d')][_0x979e('0x38')]=encryptor['encryptString'](_0x16b155['body'][_0x979e('0x38')]);}return _0x10ef8e;})['then'](saveUpdates(_0x16b155['body'],null))[_0x979e('0x15')](respondWithResult(_0x1d4eb2,null))[_0x979e('0x39')](handleError(_0x1d4eb2,null));};exports[_0x979e('0x44')]=function(_0x5b5fff,_0x4ecb1b){return db[_0x979e('0x1d')][_0x979e('0x3c')]({'where':{'id':_0x5b5fff[_0x979e('0x3b')]['id']}})[_0x979e('0x15')](handleEntityNotFound(_0x4ecb1b,null))[_0x979e('0x15')](removeEntity(_0x4ecb1b,null))['catch'](handleError(_0x4ecb1b,null));};exports[_0x979e('0x45')]=function(_0x2cb5b9,_0x1a6bfa){return db[_0x979e('0x1d')][_0x979e('0x46')]({'where':{'id':_0x2cb5b9[_0x979e('0x3b')]['id']},'raw':!![]})[_0x979e('0x15')](function(_0x1cd95f){if(!_0x1cd95f)return _0x1a6bfa[_0x979e('0xc')](0x194);return{'url':oauth[_0x979e('0x47')](_0x1cd95f,_0x2cb5b9[_0x979e('0x48')]['id'])};})['then'](respondWithResult(_0x1a6bfa,null))[_0x979e('0x39')](handleError(_0x1a6bfa,null));};exports['oauth2MicrosoftCallback']=function(_0x149de1,_0x478a11){var _0x436a32=_0x149de1['body'];var _0x10c1e2;var _0x10e64b;if(_0x436a32['error'])throw _0x436a32;redis[_0x979e('0x49')](_0x436a32[_0x979e('0x4a')])[_0x979e('0x15')](function(_0x3e1a6c){if(!_0x3e1a6c)throw new Error(_0x979e('0x4b'));_0x10c1e2=JSON[_0x979e('0x4c')](_0x3e1a6c);var _0x1f1a78=Buffer[_0x979e('0x4d')](_0x436a32[_0x979e('0x4a')],_0x979e('0x4e'))['toString'](_0x979e('0x4f'));_0x10e64b=JSON[_0x979e('0x4c')](_0x1f1a78);if(!oauth['isValidIdToken'](_0x436a32[_0x979e('0x50')],_0x10c1e2[_0x979e('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x979e('0x52')](_0x436a32[_0x979e('0x4a')]);return oauth[_0x979e('0x53')](_0x436a32[_0x979e('0x54')],_0x10c1e2);})['then'](function(_0x424851){_0x10c1e2[_0x979e('0x55')]=_0x424851[_0x979e('0x56')];_0x10c1e2[_0x979e('0x57')]=_0x424851[_0x979e('0x58')];return db['CloudProvider'][_0x979e('0x14')]({'data5':_0x10c1e2[_0x979e('0x55')],'data6':_0x10c1e2['data6']},{'where':{'id':_0x10c1e2['id']}});})[_0x979e('0x15')](function(){oauth[_0x979e('0x59')](_0x10c1e2);socket[_0x979e('0x5a')](_0x979e('0x5b'),{'id':_0x10e64b['id']});return;})[_0x979e('0x15')](respondWithStatusCode(_0x478a11,null))['catch'](function(_0x200c27){if(_0x10e64b){socket[_0x979e('0x5a')]('microsoftAuthorization:error',{'id':_0x10e64b['id']});}if(!_0x10c1e2){logger['error'](_0x979e('0x5c'),_0x200c27);return _0x478a11[_0x979e('0xe')](0x1f4)[_0x979e('0x19')](_0x200c27[_0x979e('0x5d')]);}logger[_0x979e('0x16')](_0x979e('0x5e'),_0x10c1e2['id'],JSON[_0x979e('0x5f')](_0x200c27));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e98f562..65aa7c6 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 _0xb4ab=['request-promise','path','rimraf','../../config/environment','define','CloudProvider','cloud_providers','util','../../config/logger','api','bluebird'];(function(_0x37cf36,_0x124489){var _0x4678d5=function(_0x29168b){while(--_0x29168b){_0x37cf36['push'](_0x37cf36['shift']());}};_0x4678d5(++_0x124489);}(_0xb4ab,0x1ca));var _0xbb4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4ab[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xbb4a('0x0'));var logger=require(_0xbb4a('0x1'))(_0xbb4a('0x2'));var moment=require('moment');var BPromise=require(_0xbb4a('0x3'));var rp=require(_0xbb4a('0x4'));var fs=require('fs');var path=require(_0xbb4a('0x5'));var rimraf=require(_0xbb4a('0x6'));var config=require(_0xbb4a('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x5ba824,_0x40adb4){return _0x5ba824[_0xbb4a('0x8')](_0xbb4a('0x9'),attributes,{'tableName':_0xbb4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26e9=['request-promise','path','rimraf','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','bluebird'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x26e9,0x1a0));var _0x926e=function(_0x3d8502,_0x5b23b4){_0x3d8502=_0x3d8502-0x0;var _0x2e8073=_0x26e9[_0x3d8502];return _0x2e8073;};'use strict';var _=require(_0x926e('0x0'));var util=require(_0x926e('0x1'));var logger=require(_0x926e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x926e('0x3'));var rp=require(_0x926e('0x4'));var fs=require('fs');var path=require(_0x926e('0x5'));var rimraf=require(_0x926e('0x6'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x926e('0x7')]=function(_0x35fcac,_0x3eeb98){return _0x35fcac['define'](_0x926e('0x8'),attributes,{'tableName':_0x926e('0x9'),'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 703d86f..348074d 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 _0x9485=['https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','/.default','join','Outlook365','Dynamics365','replace','{TENANT_ID}','id_token','stringify','toString','base64','randomBytes','hex','client_id','data1','redirect_uri','data4','response_mode','form_post','scope','state','nonce','login','key','value','oauth2Claims','oauth2/','set','decode','iss','aud','audience','isAfter','unix','exp','then','data3','CloudProvider','findOne','refresh_token','decryptString','data2','data5','access_token','data6','update','POST','intervals','findAll','catch','inspect','error','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','openid','profile','email','offline_access'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9485,0x89));var _0x5948=function(_0x5d7686,_0x5d11b1){_0x5d7686=_0x5d7686-0x0;var _0x408ab4=_0x9485[_0x5d7686];return _0x408ab4;};'use strict';var _=require(_0x5948('0x0'));var crypto=require(_0x5948('0x1'));var jwt=require(_0x5948('0x2'));var moment=require(_0x5948('0x3'));var Redis=require('ioredis');var rp=require(_0x5948('0x4'));var util=require(_0x5948('0x5'));var encryptor=require(_0x5948('0x6'));var config=require(_0x5948('0x7'));var logger=require(_0x5948('0x8'))('api');var schedule=require(_0x5948('0x9'));var db=require(_0x5948('0xa'))['db'];config[_0x5948('0xb')]=_['defaults'](config[_0x5948('0xb')],{'host':_0x5948('0xc'),'port':0x18eb});var redis=new Redis(config[_0x5948('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x5948('0xd'),_0x5948('0xe'),_0x5948('0xf'),_0x5948('0x10'),_0x5948('0x11'),_0x5948('0x12'),_0x5948('0x13')],'Dynamics365':['openid',_0x5948('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x5948('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x5948('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x376e6c){var _0x31431d=_[_0x5948('0x16')](AZURE_AUTH_SCOPES[_0x376e6c[_0x5948('0x17')]]);if(_0x376e6c[_0x5948('0x17')]==='Dynamics365')_0x31431d[_0x5948('0x18')](_0x376e6c['data7']+_0x5948('0x19'));return _0x31431d[_0x5948('0x1a')]('\x20');}function getAccessTokenScope(_0x50cbfd){if(_0x50cbfd['type']===_0x5948('0x1b'))return _0x5948('0x11');if(_0x50cbfd['type']===_0x5948('0x1c'))return _0x50cbfd['data7']+_0x5948('0x19');}function generateMicrosoftAuthorizationUrl(_0xc43f8a,_0x4c7e6e){var _0x216205=MICROSOFT_AUTH_URL[_0x5948('0x1d')](_0x5948('0x1e'),_0xc43f8a['data2']);var _0x5c69d3=['code',_0x5948('0x1f')];var _0x103cc9=Buffer['from'](JSON[_0x5948('0x20')]({'id':_0x4c7e6e}))[_0x5948('0x21')](_0x5948('0x22'));var _0x220384=crypto[_0x5948('0x23')](0x10)[_0x5948('0x21')](_0x5948('0x24'));var _0x4fa564=getAuthorizationScopes(_0xc43f8a);var _0x137bb6=[{'key':_0x5948('0x25'),'value':_0xc43f8a[_0x5948('0x26')]},{'key':'response_type','value':encodeURIComponent(_0x5c69d3[_0x5948('0x1a')]('\x20'))},{'key':_0x5948('0x27'),'value':_0xc43f8a[_0x5948('0x28')]},{'key':_0x5948('0x29'),'value':_0x5948('0x2a')},{'key':_0x5948('0x2b'),'value':encodeURIComponent(_0x4fa564)},{'key':_0x5948('0x2c'),'value':_0x103cc9},{'key':_0x5948('0x2d'),'value':_0x220384},{'key':'prompt','value':_0x5948('0x2e')}];var _0x54ced0=_0x216205+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x5948('0x16')](_0x137bb6,function(_0x1daafe){return _0x1daafe[_0x5948('0x2f')]+'='+_0x1daafe[_0x5948('0x30')];})[_0x5948('0x1a')]('&');_0xc43f8a[_0x5948('0x31')]={'issuer':_0x216205[_0x5948('0x1d')](_0x5948('0x32'),''),'audience':_0xc43f8a[_0x5948('0x26')],'state':_0x103cc9,'nonce':_0x220384};redis[_0x5948('0x33')](_0x103cc9,JSON[_0x5948('0x20')](_0xc43f8a));return _0x54ced0;}function isValidIdToken(_0x41c30d,_0xc4baee){try{var _0x24fb27=jwt[_0x5948('0x34')](_0x41c30d,{'complete':!![]});var _0x2f4854=_0x24fb27['payload'];if(_0x2f4854[_0x5948('0x35')]!==_0xc4baee['issuer'])return![];if(_0x2f4854[_0x5948('0x36')]!==_0xc4baee[_0x5948('0x37')])return![];if(_0x2f4854[_0x5948('0x2d')]!==_0xc4baee[_0x5948('0x2d')])return![];if(moment()[_0x5948('0x38')](moment[_0x5948('0x39')](_0x2f4854[_0x5948('0x3a')])))return![];return!![];}catch(_0x1f5b97){throw _0x1f5b97;}}function refreshOauth2MicrosoftAccessToken(_0xa12e4e){return Promise['resolve']()[_0x5948('0x3b')](function(){if(_0xa12e4e[_0x5948('0x3c')])return _0xa12e4e;return db[_0x5948('0x3d')][_0x5948('0x3e')]({'where':{'id':_0xa12e4e['id']},'raw':!![]});})['then'](function(_0x35c098){var _0x1d2a68={'grant_type':_0x5948('0x3f'),'refresh_token':_0x35c098['data6'],'scope':getAccessTokenScope(_0x35c098),'redirect_uri':_0x35c098[_0x5948('0x28')],'client_id':_0x35c098[_0x5948('0x26')],'client_secret':encryptor[_0x5948('0x40')](_0x35c098['data3'])};var _0x297164={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x5948('0x1d')](_0x5948('0x1e'),_0x35c098[_0x5948('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1d2a68,'json':!![]};return rp(_0x297164);})['then'](function(_0x3e949f){_0xa12e4e[_0x5948('0x42')]=_0x3e949f[_0x5948('0x43')];_0xa12e4e[_0x5948('0x44')]=_0x3e949f[_0x5948('0x3f')];return db['CloudProvider'][_0x5948('0x45')]({'data5':_0xa12e4e[_0x5948('0x42')],'data6':_0xa12e4e[_0x5948('0x44')]},{'where':{'id':_0xa12e4e['id']}});})['then'](function(){return _0xa12e4e;})['catch'](function(_0x4b3223){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0xa12e4e['id'],_0x4b3223);});}function getOauth2MicrosoftAccessToken(_0x15a15e,_0x5b6991){var _0x3ed588={'grant_type':'authorization_code','code':_0x15a15e,'scope':getAccessTokenScope(_0x5b6991),'redirect_uri':_0x5b6991[_0x5948('0x28')],'client_id':_0x5b6991[_0x5948('0x26')],'client_secret':encryptor['decryptString'](_0x5b6991[_0x5948('0x3c')])};var _0x35201d={'method':_0x5948('0x46'),'uri':MICROSOFT_AUTH_URL['replace'](_0x5948('0x1e'),_0x5b6991[_0x5948('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3ed588,'json':!![]};return rp(_0x35201d);}function startRefreshInterval(_0x185f7e){var _0x3290be=schedule[_0x5948('0x47')];if(_0x3290be[_0x185f7e['id']])clearInterval(_0x3290be[_0x185f7e['id']]);_0x3290be[_0x185f7e['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x185f7e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x5948('0x47')]=_0x3290be;}function startAllRefreshIntervals(){return db[_0x5948('0x3d')][_0x5948('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5948('0x3b')](function(_0x27702e){var _0x13f03e=_0x27702e[_0x5948('0x16')](function(_0x398033){return refreshOauth2MicrosoftAccessToken(_0x398033)['then'](function(_0x3fb61c){startRefreshInterval(_0x3fb61c);});});return Promise['all'](_0x13f03e);})[_0x5948('0x49')](function(_0x4e5853){var _0x4da144=_0x4e5853?util[_0x5948('0x4a')](_0x4e5853,{'showHidden':![],'depth':null}):'';logger[_0x5948('0x4b')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x4da144);});}module[_0x5948('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x957c=['https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','data7','/.default','join','replace','{TENANT_ID}','id_token','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','data4','response_mode','form_post','state','nonce','prompt','key','value','oauth2Claims','set','decode','issuer','audience','isAfter','resolve','then','findOne','data3','POST','data5','access_token','data6','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email'];(function(_0x5bc8e6,_0x39ae6c){var _0x4827ba=function(_0xaa7a61){while(--_0xaa7a61){_0x5bc8e6['push'](_0x5bc8e6['shift']());}};_0x4827ba(++_0x39ae6c);}(_0x957c,0x19e));var _0xc957=function(_0x5ecca3,_0x530cdb){_0x5ecca3=_0x5ecca3-0x0;var _0x431f8c=_0x957c[_0x5ecca3];return _0x431f8c;};'use strict';var _=require('lodash');var crypto=require(_0xc957('0x0'));var jwt=require(_0xc957('0x1'));var moment=require(_0xc957('0x2'));var Redis=require('ioredis');var rp=require(_0xc957('0x3'));var util=require(_0xc957('0x4'));var encryptor=require(_0xc957('0x5'));var config=require(_0xc957('0x6'));var logger=require(_0xc957('0x7'))(_0xc957('0x8'));var schedule=require(_0xc957('0x9'));var db=require(_0xc957('0xa'))['db'];config[_0xc957('0xb')]=_[_0xc957('0xc')](config[_0xc957('0xb')],{'host':_0xc957('0xd'),'port':0x18eb});var redis=new Redis(config[_0xc957('0xb')]);var MICROSOFT_AUTH_URL=_0xc957('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xc957('0xf'),_0xc957('0x10'),_0xc957('0x11'),'offline_access',_0xc957('0x12'),_0xc957('0x13'),_0xc957('0x14')],'Dynamics365':[_0xc957('0xf'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xc957('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x37b2f8){var _0x461687=_[_0xc957('0x16')](AZURE_AUTH_SCOPES[_0x37b2f8[_0xc957('0x17')]]);if(_0x37b2f8[_0xc957('0x17')]===_0xc957('0x18'))_0x461687['push'](_0x37b2f8[_0xc957('0x19')]+_0xc957('0x1a'));return _0x461687[_0xc957('0x1b')]('\x20');}function getAccessTokenScope(_0x206899){if(_0x206899[_0xc957('0x17')]==='Outlook365')return _0xc957('0x12');if(_0x206899[_0xc957('0x17')]===_0xc957('0x18'))return _0x206899[_0xc957('0x19')]+_0xc957('0x1a');}function generateMicrosoftAuthorizationUrl(_0x9932a4,_0x2258db){var _0xe4411e=MICROSOFT_AUTH_URL[_0xc957('0x1c')](_0xc957('0x1d'),_0x9932a4['data2']);var _0x3c0160=['code',_0xc957('0x1e')];var _0x30b0df=Buffer[_0xc957('0x1f')](JSON[_0xc957('0x20')]({'id':_0x2258db}))[_0xc957('0x21')]('base64');var _0x1adb9f=crypto[_0xc957('0x22')](0x10)[_0xc957('0x21')](_0xc957('0x23'));var _0x2f5c0d=getAuthorizationScopes(_0x9932a4);var _0xc169c=[{'key':_0xc957('0x24'),'value':_0x9932a4[_0xc957('0x25')]},{'key':_0xc957('0x26'),'value':encodeURIComponent(_0x3c0160[_0xc957('0x1b')]('\x20'))},{'key':'redirect_uri','value':_0x9932a4[_0xc957('0x27')]},{'key':_0xc957('0x28'),'value':_0xc957('0x29')},{'key':'scope','value':encodeURIComponent(_0x2f5c0d)},{'key':_0xc957('0x2a'),'value':_0x30b0df},{'key':_0xc957('0x2b'),'value':_0x1adb9f},{'key':_0xc957('0x2c'),'value':'login'}];var _0x396c98=_0xe4411e+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0xc169c,function(_0x3f3955){return _0x3f3955[_0xc957('0x2d')]+'='+_0x3f3955[_0xc957('0x2e')];})[_0xc957('0x1b')]('&');_0x9932a4[_0xc957('0x2f')]={'issuer':_0xe4411e[_0xc957('0x1c')]('oauth2/',''),'audience':_0x9932a4['data1'],'state':_0x30b0df,'nonce':_0x1adb9f};redis[_0xc957('0x30')](_0x30b0df,JSON[_0xc957('0x20')](_0x9932a4));return _0x396c98;}function isValidIdToken(_0x40a97c,_0x31d138){try{var _0x13d3d1=jwt[_0xc957('0x31')](_0x40a97c,{'complete':!![]});var _0x4c7855=_0x13d3d1['payload'];if(_0x4c7855['iss']!==_0x31d138[_0xc957('0x32')])return![];if(_0x4c7855['aud']!==_0x31d138[_0xc957('0x33')])return![];if(_0x4c7855['nonce']!==_0x31d138['nonce'])return![];if(moment()[_0xc957('0x34')](moment['unix'](_0x4c7855['exp'])))return![];return!![];}catch(_0x2301eb){throw _0x2301eb;}}function refreshOauth2MicrosoftAccessToken(_0x44ce9c){return Promise[_0xc957('0x35')]()[_0xc957('0x36')](function(){if(_0x44ce9c['data3'])return _0x44ce9c;return db['CloudProvider'][_0xc957('0x37')]({'where':{'id':_0x44ce9c['id']},'raw':!![]});})[_0xc957('0x36')](function(_0x29481a){var _0x2b3ded={'grant_type':'refresh_token','refresh_token':_0x29481a['data6'],'scope':getAccessTokenScope(_0x29481a),'redirect_uri':_0x29481a[_0xc957('0x27')],'client_id':_0x29481a[_0xc957('0x25')],'client_secret':encryptor['decryptString'](_0x29481a[_0xc957('0x38')])};var _0x29f956={'method':_0xc957('0x39'),'uri':MICROSOFT_AUTH_URL[_0xc957('0x1c')](_0xc957('0x1d'),_0x29481a['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2b3ded,'json':!![]};return rp(_0x29f956);})['then'](function(_0x2362b7){_0x44ce9c[_0xc957('0x3a')]=_0x2362b7[_0xc957('0x3b')];_0x44ce9c[_0xc957('0x3c')]=_0x2362b7['refresh_token'];return db[_0xc957('0x3d')][_0xc957('0x3e')]({'data5':_0x44ce9c[_0xc957('0x3a')],'data6':_0x44ce9c[_0xc957('0x3c')]},{'where':{'id':_0x44ce9c['id']}});})[_0xc957('0x36')](function(){return _0x44ce9c;})[_0xc957('0x3f')](function(_0x3c0ee8){logger[_0xc957('0x40')](_0xc957('0x41'),_0x44ce9c['id'],_0x3c0ee8);});}function getOauth2MicrosoftAccessToken(_0xb240dc,_0x339604){var _0x49083c={'grant_type':_0xc957('0x42'),'code':_0xb240dc,'scope':getAccessTokenScope(_0x339604),'redirect_uri':_0x339604['data4'],'client_id':_0x339604['data1'],'client_secret':encryptor[_0xc957('0x43')](_0x339604[_0xc957('0x38')])};var _0x47f2c5={'method':_0xc957('0x39'),'uri':MICROSOFT_AUTH_URL[_0xc957('0x1c')](_0xc957('0x1d'),_0x339604['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x49083c,'json':!![]};return rp(_0x47f2c5);}function startRefreshInterval(_0x4aa8eb){var _0x5aee22=schedule[_0xc957('0x44')];if(_0x5aee22[_0x4aa8eb['id']])clearInterval(_0x5aee22[_0x4aa8eb['id']]);_0x5aee22[_0x4aa8eb['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x4aa8eb['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xc957('0x44')]=_0x5aee22;}function startAllRefreshIntervals(){return db[_0xc957('0x3d')][_0xc957('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xc957('0x36')](function(_0x220112){var _0x1b0770=_0x220112[_0xc957('0x16')](function(_0x3909d9){return refreshOauth2MicrosoftAccessToken(_0x3909d9)['then'](function(_0x5809db){startRefreshInterval(_0x5809db);});});return Promise[_0xc957('0x46')](_0x1b0770);})[_0xc957('0x3f')](function(_0x4a5dfe){var _0x1011ae=_0x4a5dfe?util['inspect'](_0x4a5dfe,{'showHidden':![],'depth':null}):'';logger[_0xc957('0x40')](_0xc957('0x47'),_0x1011ae);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index d899460..22db27b 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 _0x9db7=['client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x29d524,_0x1df569){var _0x3949fe=function(_0x35ad47){while(--_0x35ad47){_0x29d524['push'](_0x29d524['shift']());}};_0x3949fe(++_0x1df569);}(_0x9db7,0x1bf));var _0x79db=function(_0x540886,_0x4c6eff){_0x540886=_0x540886-0x0;var _0x1ef0b7=_0x9db7[_0x540886];return _0x1ef0b7;};'use strict';var _=require(_0x79db('0x0'));var util=require(_0x79db('0x1'));var moment=require(_0x79db('0x2'));var BPromise=require(_0x79db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x79db('0x5'));var logger=require(_0x79db('0x6'))('rpc');var config=require(_0x79db('0x7'));var jayson=require(_0x79db('0x8'));var client=jayson[_0x79db('0x9')][_0x79db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7980b1,_0x395883,_0x214bf9){return new BPromise(function(_0x792510,_0x27d02a){return client[_0x79db('0xb')](_0x7980b1,_0x214bf9)[_0x79db('0xc')](function(_0x145a31){logger['info'](_0x79db('0xd'),_0x395883,_0x79db('0xe'));logger[_0x79db('0xf')](_0x79db('0x10'),_0x395883,_0x79db('0xe'),JSON[_0x79db('0x11')](_0x145a31));if(_0x145a31[_0x79db('0x12')]){if(_0x145a31[_0x79db('0x12')][_0x79db('0x13')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x395883,_0x145a31['error'][_0x79db('0x14')]);return _0x27d02a(_0x145a31['error'][_0x79db('0x14')]);}logger['error'](_0x79db('0xd'),_0x395883,_0x145a31[_0x79db('0x12')][_0x79db('0x14')]);return _0x792510(_0x145a31[_0x79db('0x12')][_0x79db('0x14')]);}else{logger[_0x79db('0x15')](_0x79db('0xd'),_0x395883,_0x79db('0xe'));_0x792510(_0x145a31[_0x79db('0x16')][_0x79db('0x14')]);}})[_0x79db('0x17')](function(_0x365889){logger[_0x79db('0x12')]('CloudProvider,\x20%s,\x20%s',_0x395883,_0x365889);_0x27d02a(_0x365889);});});} \ No newline at end of file +var _0x341c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x9c9833,_0x3d5a0d){var _0x184af1=function(_0x2c4076){while(--_0x2c4076){_0x9c9833['push'](_0x9c9833['shift']());}};_0x184af1(++_0x3d5a0d);}(_0x341c,0xcc));var _0xc341=function(_0x25acfe,_0x3797bc){_0x25acfe=_0x25acfe-0x0;var _0x547928=_0x341c[_0x25acfe];return _0x547928;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var moment=require(_0xc341('0x1'));var BPromise=require('bluebird');var rs=require(_0xc341('0x2'));var fs=require('fs');var Redis=require(_0xc341('0x3'));var db=require(_0xc341('0x4'))['db'];var utils=require(_0xc341('0x5'));var logger=require(_0xc341('0x6'))(_0xc341('0x7'));var config=require(_0xc341('0x8'));var jayson=require(_0xc341('0x9'));var client=jayson['client'][_0xc341('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c5b4,_0x296387,_0x31ce96){return new BPromise(function(_0x3e83c9,_0x53aab7){return client[_0xc341('0xb')](_0x13c5b4,_0x31ce96)[_0xc341('0xc')](function(_0x3f08b0){logger[_0xc341('0xd')](_0xc341('0xe'),_0x296387,_0xc341('0xf'));logger['debug'](_0xc341('0x10'),_0x296387,_0xc341('0xf'),JSON[_0xc341('0x11')](_0x3f08b0));if(_0x3f08b0[_0xc341('0x12')]){if(_0x3f08b0[_0xc341('0x12')][_0xc341('0x13')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x296387,_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);return _0x53aab7(_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);}logger[_0xc341('0x12')]('CloudProvider,\x20%s,\x20%s',_0x296387,_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);return _0x3e83c9(_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);}else{logger[_0xc341('0xd')](_0xc341('0xe'),_0x296387,_0xc341('0xf'));_0x3e83c9(_0x3f08b0[_0xc341('0x15')][_0xc341('0x14')]);}})[_0xc341('0x16')](function(_0x1d499c){logger['error']('CloudProvider,\x20%s,\x20%s',_0x296387,_0x1d499c);_0x53aab7(_0x1d499c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 0f3c106..25dbe27 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x59ba39,_0x1af940){var _0x1ace8e=function(_0x2b64be){while(--_0x2b64be){_0x59ba39['push'](_0x59ba39['shift']());}};_0x1ace8e(++_0x1af940);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c6eef,_0x5830f7){_0x1c6eef=_0x1c6eef-0x0;var _0xa8e6f7=_0x2ef3[_0x1c6eef];return _0xa8e6f7;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x55aff3,_0x172871){var _0x4dbd3d=function(_0x425d3d){while(--_0x425d3d){_0x55aff3['push'](_0x55aff3['shift']());}};_0x4dbd3d(++_0x172871);}(_0x2ef3,0xba));var _0x32ef=function(_0x3ed3d4,_0x373389){_0x3ed3d4=_0x3ed3d4-0x0;var _0x190b67=_0x2ef3[_0x3ed3d4];return _0x190b67;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 35032be..3aa3e7b 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 _0xb9c5=['STRING','name'];(function(_0x61d9c8,_0x46dc82){var _0x20319e=function(_0x3a9f89){while(--_0x3a9f89){_0x61d9c8['push'](_0x61d9c8['shift']());}};_0x20319e(++_0x46dc82);}(_0xb9c5,0x14c));var _0x5b9c=function(_0x33d0e7,_0x336442){_0x33d0e7=_0x33d0e7-0x0;var _0x4aff0e=_0xb9c5[_0x33d0e7];return _0x4aff0e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5b9c('0x0')],'unique':_0x5b9c('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5b9c('0x0')]},'companyId':{'type':Sequelize[_0x5b9c('0x0')]},'website':{'type':Sequelize[_0x5b9c('0x0')]},'phone':{'type':Sequelize[_0x5b9c('0x0')]},'fax':{'type':Sequelize[_0x5b9c('0x0')]},'type':{'type':Sequelize[_0x5b9c('0x0')]},'street':{'type':Sequelize[_0x5b9c('0x0')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x5b9c('0x0')]},'country':{'type':Sequelize[_0x5b9c('0x0')]},'email':{'type':Sequelize[_0x5b9c('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x5b9c('0x0')]},'sPostalCode':{'type':Sequelize[_0x5b9c('0x0')]},'sCity':{'type':Sequelize[_0x5b9c('0x0')]},'sCountry':{'type':Sequelize[_0x5b9c('0x0')]},'description':{'type':Sequelize[_0x5b9c('0x0')]}}; \ No newline at end of file +var _0xfa20=['name','sequelize','exports','STRING'];(function(_0x3d5382,_0x375955){var _0x12e3d2=function(_0x16e67b){while(--_0x16e67b){_0x3d5382['push'](_0x3d5382['shift']());}};_0x12e3d2(++_0x375955);}(_0xfa20,0x1d9));var _0x0fa2=function(_0x48fb10,_0xa50a89){_0x48fb10=_0x48fb10-0x0;var _0x534251=_0xfa20[_0x48fb10];return _0x534251;};'use strict';var Sequelize=require(_0x0fa2('0x0'));module[_0x0fa2('0x1')]={'name':{'type':Sequelize[_0x0fa2('0x2')],'unique':_0x0fa2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x0fa2('0x2')]},'website':{'type':Sequelize[_0x0fa2('0x2')]},'phone':{'type':Sequelize[_0x0fa2('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0fa2('0x2')]},'postalCode':{'type':Sequelize[_0x0fa2('0x2')]},'city':{'type':Sequelize[_0x0fa2('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0fa2('0x2')]},'sStreet':{'type':Sequelize[_0x0fa2('0x2')]},'sPostalCode':{'type':Sequelize[_0x0fa2('0x2')]},'sCity':{'type':Sequelize[_0x0fa2('0x2')]},'sCountry':{'type':Sequelize[_0x0fa2('0x2')]},'description':{'type':Sequelize[_0x0fa2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7202cc3..2addd6f 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 _0x9f5b=['squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','stack','name','index','CmCompany','describe','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','addContacts','CmContact','ids','findOne','map','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash'];(function(_0x168bf8,_0xb7f2bc){var _0x271322=function(_0x3e30b6){while(--_0x3e30b6){_0x168bf8['push'](_0x168bf8['shift']());}};_0x271322(++_0xb7f2bc);}(_0x9f5b,0x18c));var _0xb9f5=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x9f5b[_0x2b737c];return _0x466ed5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb9f5('0x0'));var jsonpatch=require(_0xb9f5('0x1'));var rp=require(_0xb9f5('0x2'));var moment=require(_0xb9f5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb9f5('0x4'));var path=require('path');var sox=require(_0xb9f5('0x5'));var csv=require(_0xb9f5('0x6'));var ejs=require(_0xb9f5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9f5('0x8'));var squel=require(_0xb9f5('0x9'));var crypto=require(_0xb9f5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb9f5('0xb'));var toCsv=require(_0xb9f5('0x6'));var querystring=require(_0xb9f5('0xc'));var Papa=require(_0xb9f5('0xd'));var Redis=require('ioredis');var authService=require(_0xb9f5('0xe'));var qs=require(_0xb9f5('0xf'));var as=require(_0xb9f5('0x10'));var hardwareService=require(_0xb9f5('0x11'));var logger=require(_0xb9f5('0x12'))('api');var utils=require(_0xb9f5('0x13'));var config=require(_0xb9f5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb29c63,_0x22784e){_0x22784e=_0x22784e||0xcc;return function(_0x400dce){if(_0x400dce){return _0xb29c63[_0xb9f5('0x15')](_0x22784e);}return _0xb29c63['status'](_0x22784e)[_0xb9f5('0x16')]();};}function respondWithResult(_0x39190f,_0x963a51){_0x963a51=_0x963a51||0xc8;return function(_0xf9bc23){if(_0xf9bc23){return _0x39190f['status'](_0x963a51)[_0xb9f5('0x17')](_0xf9bc23);}};}function respondWithFilteredResult(_0x12c688,_0x2341f5){return function(_0x474865){if(_0x474865){var _0x57f1c0=typeof _0x2341f5[_0xb9f5('0x18')]===_0xb9f5('0x19')&&typeof _0x2341f5[_0xb9f5('0x1a')]===_0xb9f5('0x19');var _0x207175=_0x474865['count'];var _0x4453f7=_0x57f1c0?0x0:_0x2341f5['offset'];var _0x1aa200=_0x57f1c0?_0x474865[_0xb9f5('0x1b')]:_0x2341f5[_0xb9f5('0x18')]+_0x2341f5[_0xb9f5('0x1a')];var _0x57a7e4;if(_0x1aa200>=_0x207175){_0x1aa200=_0x207175;_0x57a7e4=0xc8;}else{_0x57a7e4=0xce;}_0x12c688[_0xb9f5('0x1c')](_0x57a7e4);return _0x12c688[_0xb9f5('0x1d')](_0xb9f5('0x1e'),_0x4453f7+'-'+_0x1aa200+'/'+_0x207175)[_0xb9f5('0x17')](_0x474865);}return null;};}function patchUpdates(_0x4cc32d){return function(_0x37065d){try{jsonpatch[_0xb9f5('0x1f')](_0x37065d,_0x4cc32d,!![]);}catch(_0x25b2bb){return BPromise[_0xb9f5('0x20')](_0x25b2bb);}return _0x37065d[_0xb9f5('0x21')]();};}function saveUpdates(_0x3af981,_0x2f0284){return function(_0x148f1d){if(_0x148f1d){return _0x148f1d[_0xb9f5('0x22')](_0x3af981)[_0xb9f5('0x23')](function(_0x65f2c3){return _0x65f2c3;});}return null;};}function removeEntity(_0x5ca233,_0x36c7e8){return function(_0x3893e0){if(_0x3893e0){return _0x3893e0['destroy']()[_0xb9f5('0x23')](function(){var _0x1959c3=_0x3893e0[_0xb9f5('0x24')]({'plain':!![]});var _0x3c9928=_0xb9f5('0x25');return db[_0xb9f5('0x26')][_0xb9f5('0x27')]({'where':{'type':_0x3c9928,'resourceId':_0x1959c3['id']}})[_0xb9f5('0x23')](function(){return _0x3893e0;});})['then'](function(){_0x5ca233[_0xb9f5('0x1c')](0xcc)[_0xb9f5('0x16')]();});}};}function handleEntityNotFound(_0x51c325,_0x3bf30d){return function(_0x36c1b3){if(!_0x36c1b3){_0x51c325[_0xb9f5('0x15')](0x194);}return _0x36c1b3;};}function handleError(_0x2b22fa,_0x51b395){_0x51b395=_0x51b395||0x1f4;return function(_0x3be2fd){logger['error'](_0x3be2fd[_0xb9f5('0x28')]);if(_0x3be2fd[_0xb9f5('0x29')]){delete _0x3be2fd[_0xb9f5('0x29')];}_0x2b22fa[_0xb9f5('0x1c')](_0x51b395)['send'](_0x3be2fd);};}exports[_0xb9f5('0x2a')]=function(_0x5dd809,_0x4cbd76){var _0x17688b={},_0x35f630={},_0x4e446e={'count':0x0,'rows':[]};return db[_0xb9f5('0x2b')][_0xb9f5('0x2c')]()[_0xb9f5('0x23')](function(_0x421375){_0x35f630[_0xb9f5('0x2d')]=_['keys'](_0x421375);_0x35f630[_0xb9f5('0x2e')]=_[_0xb9f5('0x2f')](_0x5dd809[_0xb9f5('0x2e')]);_0x35f630[_0xb9f5('0x30')]=_['intersection'](_0x35f630['model'],_0x35f630[_0xb9f5('0x2e')]);_0x17688b[_0xb9f5('0x31')]=_[_0xb9f5('0x32')](_0x35f630[_0xb9f5('0x2d')],qs[_0xb9f5('0x33')](_0x5dd809['query']['fields']));_0x17688b[_0xb9f5('0x31')]=_0x17688b['attributes'][_0xb9f5('0x34')]?_0x17688b['attributes']:_0x35f630[_0xb9f5('0x2d')];if(!_0x5dd809['query'][_0xb9f5('0x35')](_0xb9f5('0x36'))){_0x17688b[_0xb9f5('0x1a')]=qs[_0xb9f5('0x1a')](_0x5dd809[_0xb9f5('0x2e')][_0xb9f5('0x1a')]);_0x17688b['offset']=qs[_0xb9f5('0x18')](_0x5dd809['query'][_0xb9f5('0x18')]);}_0x17688b[_0xb9f5('0x37')]=qs[_0xb9f5('0x38')](_0x5dd809[_0xb9f5('0x2e')][_0xb9f5('0x38')]);_0x17688b[_0xb9f5('0x39')]=qs['filters'](_[_0xb9f5('0x3a')](_0x5dd809['query'],_0x35f630[_0xb9f5('0x30')]),_0x421375);if(_0x5dd809[_0xb9f5('0x2e')][_0xb9f5('0x3b')]){_0x17688b['where']=_[_0xb9f5('0x3c')](_0x17688b[_0xb9f5('0x39')],{'$or':_['map'](_0x17688b['attributes'],function(_0x3b2ef1){var _0x4b1a1b={};_0x4b1a1b[_0x3b2ef1]={'$like':'%'+_0x5dd809[_0xb9f5('0x2e')][_0xb9f5('0x3b')]+'%'};return _0x4b1a1b;})});}_0x17688b=_[_0xb9f5('0x3c')]({},_0x17688b,_0x5dd809[_0xb9f5('0x3d')]);var _0x20f1b8={'where':_0x17688b[_0xb9f5('0x39')]};return db['CmCompany']['count'](_0x20f1b8)[_0xb9f5('0x23')](function(_0xe0d125){_0x4e446e[_0xb9f5('0x1b')]=_0xe0d125;if(_0x5dd809[_0xb9f5('0x2e')][_0xb9f5('0x3e')]){_0x17688b[_0xb9f5('0x3f')]=[{'all':!![]}];}return db['CmCompany'][_0xb9f5('0x40')](_0x17688b);})['then'](function(_0x42d1bf){_0x4e446e['rows']=_0x42d1bf;return _0x4e446e;})[_0xb9f5('0x23')](respondWithFilteredResult(_0x4cbd76,_0x17688b))[_0xb9f5('0x41')](handleError(_0x4cbd76,null));})[_0xb9f5('0x41')](handleError(_0x4cbd76,null));};exports['show']=function(_0x1dc586,_0x570eaf){var _0xa6eaea={'raw':![],'where':{'id':_0x1dc586[_0xb9f5('0x42')]['id']}},_0x2b93cc={};_0x2b93cc['model']=_['keys'](db['CmCompany']['rawAttributes']);_0x2b93cc[_0xb9f5('0x2e')]=_[_0xb9f5('0x2f')](_0x1dc586[_0xb9f5('0x2e')]);_0x2b93cc[_0xb9f5('0x30')]=_['intersection'](_0x2b93cc[_0xb9f5('0x2d')],_0x2b93cc['query']);_0xa6eaea[_0xb9f5('0x31')]=_['intersection'](_0x2b93cc[_0xb9f5('0x2d')],qs[_0xb9f5('0x33')](_0x1dc586['query'][_0xb9f5('0x33')]));_0xa6eaea[_0xb9f5('0x31')]=_0xa6eaea['attributes']['length']?_0xa6eaea['attributes']:_0x2b93cc['model'];if(_0x1dc586['query'][_0xb9f5('0x3e')]){_0xa6eaea[_0xb9f5('0x3f')]=[{'all':!![]}];}_0xa6eaea=_[_0xb9f5('0x3c')]({},_0xa6eaea,_0x1dc586[_0xb9f5('0x3d')]);return db[_0xb9f5('0x2b')][_0xb9f5('0x43')](_0xa6eaea)[_0xb9f5('0x23')](handleEntityNotFound(_0x570eaf,null))['then'](respondWithResult(_0x570eaf,null))[_0xb9f5('0x41')](handleError(_0x570eaf,null));};exports[_0xb9f5('0x44')]=function(_0x3c79dd,_0x207f29){return db[_0xb9f5('0x2b')][_0xb9f5('0x44')](_0x3c79dd[_0xb9f5('0x45')],{})[_0xb9f5('0x23')](function(_0x8bbb5b){var _0x4765f5=_0x3c79dd[_0xb9f5('0x46')][_0xb9f5('0x24')]({'plain':!![]});if(!_0x4765f5)throw new Error(_0xb9f5('0x47'));if(_0x4765f5[_0xb9f5('0x48')]===_0xb9f5('0x46')){var _0x35f8c8=_0x8bbb5b['get']({'plain':!![]});var _0x1b73f1=_0xb9f5('0x25');return db['UserProfileSection'][_0xb9f5('0x43')]({'where':{'name':_0x1b73f1,'userProfileId':_0x4765f5[_0xb9f5('0x49')]},'raw':!![]})[_0xb9f5('0x23')](function(_0x22bb21){if(_0x22bb21&&_0x22bb21[_0xb9f5('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x35f8c8[_0xb9f5('0x29')],'resourceId':_0x35f8c8['id'],'type':_0x22bb21[_0xb9f5('0x29')],'sectionId':_0x22bb21['id']},{})['then'](function(){return _0x8bbb5b;});}else{return _0x8bbb5b;}})[_0xb9f5('0x41')](function(_0x3473ff){logger[_0xb9f5('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3473ff);throw _0x3473ff;});}return _0x8bbb5b;})['then'](respondWithResult(_0x207f29,0xc9))[_0xb9f5('0x41')](handleError(_0x207f29,null));};exports[_0xb9f5('0x22')]=function(_0x43f9a8,_0x4d9ab2){if(_0x43f9a8['body']['id']){delete _0x43f9a8[_0xb9f5('0x45')]['id'];}return db[_0xb9f5('0x2b')][_0xb9f5('0x43')]({'where':{'id':_0x43f9a8[_0xb9f5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d9ab2,null))['then'](saveUpdates(_0x43f9a8[_0xb9f5('0x45')],null))[_0xb9f5('0x23')](respondWithResult(_0x4d9ab2,null))[_0xb9f5('0x41')](handleError(_0x4d9ab2,null));};exports[_0xb9f5('0x27')]=function(_0x148069,_0x1f97e5){return db['CmCompany'][_0xb9f5('0x43')]({'where':{'id':_0x148069[_0xb9f5('0x42')]['id']}})[_0xb9f5('0x23')](handleEntityNotFound(_0x1f97e5,null))[_0xb9f5('0x23')](removeEntity(_0x1f97e5,null))[_0xb9f5('0x41')](handleError(_0x1f97e5,null));};exports[_0xb9f5('0x2c')]=function(_0x27626c,_0x29937e){return db['CmCompany']['describe']()[_0xb9f5('0x23')](respondWithResult(_0x29937e,null))[_0xb9f5('0x41')](handleError(_0x29937e,null));};exports[_0xb9f5('0x4c')]=function(_0x557615,_0x1c438a,_0x55f0b6){return db[_0xb9f5('0x4d')][_0xb9f5('0x43')]({'where':{'id':_0x557615[_0xb9f5('0x42')]['id']}})[_0xb9f5('0x23')](handleEntityNotFound(_0x1c438a,null))['then'](function(_0xb89cf){if(_0xb89cf){return _0xb89cf['addContacts'](_0x557615[_0xb9f5('0x45')][_0xb9f5('0x4e')],_['omit'](_0x557615[_0xb9f5('0x45')],[_0xb9f5('0x4e'),'id'])||{});}})[_0xb9f5('0x23')](respondWithResult(_0x1c438a,null))[_0xb9f5('0x41')](handleError(_0x1c438a,null));};exports['getContacts']=function(_0x175fdd,_0x542c6a,_0x42098a){var _0x2955bf={};var _0x3e2504={};var _0x4e3cc3;var _0x40076c;return db[_0xb9f5('0x2b')][_0xb9f5('0x4f')]({'where':{'id':_0x175fdd[_0xb9f5('0x42')]['id']}})[_0xb9f5('0x23')](handleEntityNotFound(_0x542c6a,null))['then'](function(_0x19c139){if(_0x19c139){_0x4e3cc3=_0x19c139;_0x3e2504[_0xb9f5('0x2d')]=_[_0xb9f5('0x2f')](db[_0xb9f5('0x4d')]['rawAttributes']);_0x3e2504['query']=_[_0xb9f5('0x2f')](_0x175fdd['query']);_0x3e2504['filters']=_[_0xb9f5('0x32')](_0x3e2504['model'],_0x3e2504[_0xb9f5('0x2e')]);_0x2955bf[_0xb9f5('0x31')]=_[_0xb9f5('0x32')](_0x3e2504['model'],qs[_0xb9f5('0x33')](_0x175fdd[_0xb9f5('0x2e')][_0xb9f5('0x33')]));_0x2955bf[_0xb9f5('0x31')]=_0x2955bf[_0xb9f5('0x31')]['length']?_0x2955bf['attributes']:_0x3e2504[_0xb9f5('0x2d')];_0x2955bf[_0xb9f5('0x37')]=qs[_0xb9f5('0x38')](_0x175fdd['query']['sort']);_0x2955bf['where']=qs['filters'](_[_0xb9f5('0x3a')](_0x175fdd[_0xb9f5('0x2e')],_0x3e2504['filters']));if(_0x175fdd[_0xb9f5('0x2e')][_0xb9f5('0x3b')]){_0x2955bf[_0xb9f5('0x39')]=_[_0xb9f5('0x3c')](_0x2955bf[_0xb9f5('0x39')],{'$or':_[_0xb9f5('0x50')](_0x2955bf[_0xb9f5('0x31')],function(_0x406eff){var _0x517880={};_0x517880[_0x406eff]={'$like':'%'+_0x175fdd[_0xb9f5('0x2e')][_0xb9f5('0x3b')]+'%'};return _0x517880;})});}_0x2955bf=_[_0xb9f5('0x3c')]({},_0x2955bf,_0x175fdd[_0xb9f5('0x3d')]);return _0x4e3cc3['getContacts'](_0x2955bf);}})['then'](function(_0x2b6252){if(_0x2b6252){_0x40076c=_0x2b6252[_0xb9f5('0x34')];if(!_0x175fdd[_0xb9f5('0x2e')]['hasOwnProperty'](_0xb9f5('0x36'))){_0x2955bf[_0xb9f5('0x1a')]=qs[_0xb9f5('0x1a')](_0x175fdd[_0xb9f5('0x2e')][_0xb9f5('0x1a')]);_0x2955bf['offset']=qs[_0xb9f5('0x18')](_0x175fdd[_0xb9f5('0x2e')][_0xb9f5('0x18')]);}return _0x4e3cc3['getContacts'](_0x2955bf);}})[_0xb9f5('0x23')](function(_0x254e45){if(_0x254e45){return _0x254e45?{'count':_0x40076c,'rows':_0x254e45}:null;}})[_0xb9f5('0x23')](respondWithResult(_0x542c6a,null))['catch'](handleError(_0x542c6a,null));}; \ No newline at end of file +var _0xe5fc=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','CmCompany','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','ids','omit','getContacts','findOne','length','map','nolimit','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x2f91dd,_0x57db75){var _0x436114=function(_0x9c9505){while(--_0x9c9505){_0x2f91dd['push'](_0x2f91dd['shift']());}};_0x436114(++_0x57db75);}(_0xe5fc,0x18a));var _0xce5f=function(_0x4676c8,_0x49db00){_0x4676c8=_0x4676c8-0x0;var _0x30c579=_0xe5fc[_0x4676c8];return _0x30c579;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce5f('0x0'));var zipdir=require(_0xce5f('0x1'));var jsonpatch=require(_0xce5f('0x2'));var rp=require('request-promise');var moment=require(_0xce5f('0x3'));var BPromise=require(_0xce5f('0x4'));var Mustache=require(_0xce5f('0x5'));var util=require('util');var path=require(_0xce5f('0x6'));var sox=require(_0xce5f('0x7'));var csv=require(_0xce5f('0x8'));var ejs=require(_0xce5f('0x9'));var fs=require('fs');var fs_extra=require(_0xce5f('0xa'));var _=require(_0xce5f('0xb'));var squel=require(_0xce5f('0xc'));var crypto=require(_0xce5f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xce5f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xce5f('0xf'));var Papa=require(_0xce5f('0x10'));var Redis=require(_0xce5f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xce5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce5f('0x13'));var logger=require(_0xce5f('0x14'))(_0xce5f('0x15'));var utils=require(_0xce5f('0x16'));var config=require(_0xce5f('0x17'));var licenseUtil=require(_0xce5f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e8698,_0x7aad9d){_0x7aad9d=_0x7aad9d||0xcc;return function(_0x34aabc){if(_0x34aabc){return _0x2e8698[_0xce5f('0x19')](_0x7aad9d);}return _0x2e8698['status'](_0x7aad9d)[_0xce5f('0x1a')]();};}function respondWithResult(_0x161754,_0x18652c){_0x18652c=_0x18652c||0xc8;return function(_0x1fb3d6){if(_0x1fb3d6){return _0x161754[_0xce5f('0x1b')](_0x18652c)['json'](_0x1fb3d6);}};}function respondWithFilteredResult(_0xe62ade,_0x33b56e){return function(_0x5efcdb){if(_0x5efcdb){var _0x461442=typeof _0x33b56e[_0xce5f('0x1c')]===_0xce5f('0x1d')&&typeof _0x33b56e[_0xce5f('0x1e')]===_0xce5f('0x1d');var _0x1fba11=_0x5efcdb['count'];var _0x152476=_0x461442?0x0:_0x33b56e[_0xce5f('0x1c')];var _0x56cbdc=_0x461442?_0x5efcdb[_0xce5f('0x1f')]:_0x33b56e[_0xce5f('0x1c')]+_0x33b56e['limit'];var _0x6c223a;if(_0x56cbdc>=_0x1fba11){_0x56cbdc=_0x1fba11;_0x6c223a=0xc8;}else{_0x6c223a=0xce;}_0xe62ade['status'](_0x6c223a);return _0xe62ade[_0xce5f('0x20')](_0xce5f('0x21'),_0x152476+'-'+_0x56cbdc+'/'+_0x1fba11)['json'](_0x5efcdb);}return null;};}function patchUpdates(_0x131302){return function(_0x204010){try{jsonpatch[_0xce5f('0x22')](_0x204010,_0x131302,!![]);}catch(_0x8f0f26){return BPromise[_0xce5f('0x23')](_0x8f0f26);}return _0x204010['save']();};}function saveUpdates(_0x5e9e17,_0x12b6b1){return function(_0x50a90e){if(_0x50a90e){return _0x50a90e[_0xce5f('0x24')](_0x5e9e17)[_0xce5f('0x25')](function(_0x2e973c){return _0x2e973c;});}return null;};}function removeEntity(_0x2b61d2,_0x4c11fb){return function(_0x3ddb16){if(_0x3ddb16){return _0x3ddb16[_0xce5f('0x26')]()[_0xce5f('0x25')](function(){var _0x436554=_0x3ddb16['get']({'plain':!![]});var _0x51eae7='Companies';return db[_0xce5f('0x27')][_0xce5f('0x26')]({'where':{'type':_0x51eae7,'resourceId':_0x436554['id']}})[_0xce5f('0x25')](function(){return _0x3ddb16;});})['then'](function(){_0x2b61d2[_0xce5f('0x1b')](0xcc)[_0xce5f('0x1a')]();});}};}function handleEntityNotFound(_0x864b16,_0xeda785){return function(_0x4b8bec){if(!_0x4b8bec){_0x864b16[_0xce5f('0x19')](0x194);}return _0x4b8bec;};}function handleError(_0x5f3c31,_0x44802c){_0x44802c=_0x44802c||0x1f4;return function(_0x70f6ef){logger[_0xce5f('0x28')](_0x70f6ef[_0xce5f('0x29')]);if(_0x70f6ef[_0xce5f('0x2a')]){delete _0x70f6ef[_0xce5f('0x2a')];}_0x5f3c31[_0xce5f('0x1b')](_0x44802c)[_0xce5f('0x2b')](_0x70f6ef);};}exports['index']=function(_0x406da7,_0x1afbf3){var _0x5cd4ed={},_0x523e62={},_0x4cd496={'count':0x0,'rows':[]};return db[_0xce5f('0x2c')]['describe']()[_0xce5f('0x25')](function(_0x58c5ae){_0x523e62[_0xce5f('0x2d')]=_[_0xce5f('0x2e')](_0x58c5ae);_0x523e62[_0xce5f('0x2f')]=_[_0xce5f('0x2e')](_0x406da7[_0xce5f('0x2f')]);_0x523e62[_0xce5f('0x30')]=_[_0xce5f('0x31')](_0x523e62[_0xce5f('0x2d')],_0x523e62[_0xce5f('0x2f')]);_0x5cd4ed[_0xce5f('0x32')]=_[_0xce5f('0x31')](_0x523e62[_0xce5f('0x2d')],qs['fields'](_0x406da7[_0xce5f('0x2f')][_0xce5f('0x33')]));_0x5cd4ed[_0xce5f('0x32')]=_0x5cd4ed[_0xce5f('0x32')]['length']?_0x5cd4ed[_0xce5f('0x32')]:_0x523e62[_0xce5f('0x2d')];if(!_0x406da7['query'][_0xce5f('0x34')]('nolimit')){_0x5cd4ed['limit']=qs[_0xce5f('0x1e')](_0x406da7[_0xce5f('0x2f')][_0xce5f('0x1e')]);_0x5cd4ed[_0xce5f('0x1c')]=qs['offset'](_0x406da7[_0xce5f('0x2f')][_0xce5f('0x1c')]);}_0x5cd4ed[_0xce5f('0x35')]=qs[_0xce5f('0x36')](_0x406da7[_0xce5f('0x2f')][_0xce5f('0x36')]);_0x5cd4ed[_0xce5f('0x37')]=qs['filters'](_[_0xce5f('0x38')](_0x406da7['query'],_0x523e62[_0xce5f('0x30')]),_0x58c5ae);if(_0x406da7[_0xce5f('0x2f')][_0xce5f('0x39')]){_0x5cd4ed[_0xce5f('0x37')]=_[_0xce5f('0x3a')](_0x5cd4ed[_0xce5f('0x37')],{'$or':_['map'](_0x5cd4ed[_0xce5f('0x32')],function(_0x3fb98c){var _0x45c98a={};_0x45c98a[_0x3fb98c]={'$like':'%'+_0x406da7[_0xce5f('0x2f')][_0xce5f('0x39')]+'%'};return _0x45c98a;})});}_0x5cd4ed=_[_0xce5f('0x3a')]({},_0x5cd4ed,_0x406da7[_0xce5f('0x3b')]);var _0x506a59={'where':_0x5cd4ed[_0xce5f('0x37')]};return db['CmCompany'][_0xce5f('0x1f')](_0x506a59)['then'](function(_0x1f576d){_0x4cd496[_0xce5f('0x1f')]=_0x1f576d;if(_0x406da7['query'][_0xce5f('0x3c')]){_0x5cd4ed['include']=[{'all':!![]}];}return db[_0xce5f('0x2c')][_0xce5f('0x3d')](_0x5cd4ed);})['then'](function(_0x139e71){_0x4cd496[_0xce5f('0x3e')]=_0x139e71;return _0x4cd496;})['then'](respondWithFilteredResult(_0x1afbf3,_0x5cd4ed))['catch'](handleError(_0x1afbf3,null));})[_0xce5f('0x3f')](handleError(_0x1afbf3,null));};exports['show']=function(_0x1f4b65,_0x3af9b7){var _0xe7c176={'raw':![],'where':{'id':_0x1f4b65['params']['id']}},_0x4849a9={};_0x4849a9['model']=_[_0xce5f('0x2e')](db['CmCompany'][_0xce5f('0x40')]);_0x4849a9[_0xce5f('0x2f')]=_['keys'](_0x1f4b65[_0xce5f('0x2f')]);_0x4849a9[_0xce5f('0x30')]=_[_0xce5f('0x31')](_0x4849a9[_0xce5f('0x2d')],_0x4849a9['query']);_0xe7c176['attributes']=_['intersection'](_0x4849a9['model'],qs['fields'](_0x1f4b65['query'][_0xce5f('0x33')]));_0xe7c176[_0xce5f('0x32')]=_0xe7c176[_0xce5f('0x32')]['length']?_0xe7c176[_0xce5f('0x32')]:_0x4849a9[_0xce5f('0x2d')];if(_0x1f4b65[_0xce5f('0x2f')][_0xce5f('0x3c')]){_0xe7c176['include']=[{'all':!![]}];}_0xe7c176=_[_0xce5f('0x3a')]({},_0xe7c176,_0x1f4b65['options']);return db['CmCompany'][_0xce5f('0x41')](_0xe7c176)[_0xce5f('0x25')](handleEntityNotFound(_0x3af9b7,null))['then'](respondWithResult(_0x3af9b7,null))[_0xce5f('0x3f')](handleError(_0x3af9b7,null));};exports[_0xce5f('0x42')]=function(_0x5c185d,_0x53dedb){return db[_0xce5f('0x2c')]['create'](_0x5c185d[_0xce5f('0x43')],{})['then'](function(_0x17aa6c){var _0x35c0c2=_0x5c185d['user']['get']({'plain':!![]});if(!_0x35c0c2)throw new Error(_0xce5f('0x44'));if(_0x35c0c2[_0xce5f('0x45')]==='user'){var _0x236de9=_0x17aa6c['get']({'plain':!![]});var _0x2179ab=_0xce5f('0x46');return db['UserProfileSection'][_0xce5f('0x41')]({'where':{'name':_0x2179ab,'userProfileId':_0x35c0c2[_0xce5f('0x47')]},'raw':!![]})[_0xce5f('0x25')](function(_0xd52bc5){if(_0xd52bc5&&_0xd52bc5['autoAssociation']===0x0){return db[_0xce5f('0x27')]['create']({'name':_0x236de9[_0xce5f('0x2a')],'resourceId':_0x236de9['id'],'type':_0xd52bc5[_0xce5f('0x2a')],'sectionId':_0xd52bc5['id']},{})[_0xce5f('0x25')](function(){return _0x17aa6c;});}else{return _0x17aa6c;}})[_0xce5f('0x3f')](function(_0x32a11a){logger['error'](_0xce5f('0x48'),_0x32a11a);throw _0x32a11a;});}return _0x17aa6c;})['then'](respondWithResult(_0x53dedb,0xc9))[_0xce5f('0x3f')](handleError(_0x53dedb,null));};exports['update']=function(_0x5690c9,_0x1e7a8d){if(_0x5690c9[_0xce5f('0x43')]['id']){delete _0x5690c9[_0xce5f('0x43')]['id'];}return db[_0xce5f('0x2c')][_0xce5f('0x41')]({'where':{'id':_0x5690c9[_0xce5f('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e7a8d,null))['then'](saveUpdates(_0x5690c9['body'],null))['then'](respondWithResult(_0x1e7a8d,null))[_0xce5f('0x3f')](handleError(_0x1e7a8d,null));};exports[_0xce5f('0x26')]=function(_0x2833a8,_0x232085){return db['CmCompany'][_0xce5f('0x41')]({'where':{'id':_0x2833a8['params']['id']}})['then'](handleEntityNotFound(_0x232085,null))[_0xce5f('0x25')](removeEntity(_0x232085,null))['catch'](handleError(_0x232085,null));};exports[_0xce5f('0x4a')]=function(_0x2684a,_0x56936e){return db[_0xce5f('0x2c')][_0xce5f('0x4a')]()[_0xce5f('0x25')](respondWithResult(_0x56936e,null))[_0xce5f('0x3f')](handleError(_0x56936e,null));};exports[_0xce5f('0x4b')]=function(_0x252180,_0x15b45f,_0x45dbd2){return db[_0xce5f('0x4c')][_0xce5f('0x41')]({'where':{'id':_0x252180[_0xce5f('0x49')]['id']}})[_0xce5f('0x25')](handleEntityNotFound(_0x15b45f,null))[_0xce5f('0x25')](function(_0x5342f9){if(_0x5342f9){return _0x5342f9[_0xce5f('0x4b')](_0x252180['body'][_0xce5f('0x4d')],_[_0xce5f('0x4e')](_0x252180[_0xce5f('0x43')],[_0xce5f('0x4d'),'id'])||{});}})[_0xce5f('0x25')](respondWithResult(_0x15b45f,null))[_0xce5f('0x3f')](handleError(_0x15b45f,null));};exports[_0xce5f('0x4f')]=function(_0x396acc,_0x2b0f39,_0x2db9c5){var _0x13ad6a={};var _0x5bb468={};var _0x28ed94;var _0xa1a5fd;return db[_0xce5f('0x2c')][_0xce5f('0x50')]({'where':{'id':_0x396acc['params']['id']}})[_0xce5f('0x25')](handleEntityNotFound(_0x2b0f39,null))[_0xce5f('0x25')](function(_0x41ed72){if(_0x41ed72){_0x28ed94=_0x41ed72;_0x5bb468[_0xce5f('0x2d')]=_['keys'](db[_0xce5f('0x4c')][_0xce5f('0x40')]);_0x5bb468[_0xce5f('0x2f')]=_['keys'](_0x396acc[_0xce5f('0x2f')]);_0x5bb468[_0xce5f('0x30')]=_[_0xce5f('0x31')](_0x5bb468[_0xce5f('0x2d')],_0x5bb468[_0xce5f('0x2f')]);_0x13ad6a[_0xce5f('0x32')]=_[_0xce5f('0x31')](_0x5bb468[_0xce5f('0x2d')],qs[_0xce5f('0x33')](_0x396acc[_0xce5f('0x2f')][_0xce5f('0x33')]));_0x13ad6a['attributes']=_0x13ad6a[_0xce5f('0x32')][_0xce5f('0x51')]?_0x13ad6a[_0xce5f('0x32')]:_0x5bb468[_0xce5f('0x2d')];_0x13ad6a['order']=qs['sort'](_0x396acc[_0xce5f('0x2f')][_0xce5f('0x36')]);_0x13ad6a[_0xce5f('0x37')]=qs[_0xce5f('0x30')](_[_0xce5f('0x38')](_0x396acc['query'],_0x5bb468[_0xce5f('0x30')]));if(_0x396acc[_0xce5f('0x2f')][_0xce5f('0x39')]){_0x13ad6a[_0xce5f('0x37')]=_['merge'](_0x13ad6a[_0xce5f('0x37')],{'$or':_[_0xce5f('0x52')](_0x13ad6a['attributes'],function(_0x3abb67){var _0x520547={};_0x520547[_0x3abb67]={'$like':'%'+_0x396acc[_0xce5f('0x2f')][_0xce5f('0x39')]+'%'};return _0x520547;})});}_0x13ad6a=_[_0xce5f('0x3a')]({},_0x13ad6a,_0x396acc['options']);return _0x28ed94[_0xce5f('0x4f')](_0x13ad6a);}})[_0xce5f('0x25')](function(_0x1db56a){if(_0x1db56a){_0xa1a5fd=_0x1db56a[_0xce5f('0x51')];if(!_0x396acc[_0xce5f('0x2f')][_0xce5f('0x34')](_0xce5f('0x53'))){_0x13ad6a[_0xce5f('0x1e')]=qs[_0xce5f('0x1e')](_0x396acc['query'][_0xce5f('0x1e')]);_0x13ad6a[_0xce5f('0x1c')]=qs['offset'](_0x396acc[_0xce5f('0x2f')][_0xce5f('0x1c')]);}return _0x28ed94[_0xce5f('0x4f')](_0x13ad6a);}})[_0xce5f('0x25')](function(_0x526029){if(_0x526029){return _0x526029?{'count':_0xa1a5fd,'rows':_0x526029}:null;}})[_0xce5f('0x25')](respondWithResult(_0x2b0f39,null))[_0xce5f('0x3f')](handleError(_0x2b0f39,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ff53a95..3abd759 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 _0x7d8c=['./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x2b3c9d,_0x1c8c0c){var _0x4b8037=function(_0x225327){while(--_0x225327){_0x2b3c9d['push'](_0x2b3c9d['shift']());}};_0x4b8037(++_0x1c8c0c);}(_0x7d8c,0x7d));var _0xc7d8=function(_0x54b0df,_0x5d8e9a){_0x54b0df=_0x54b0df-0x0;var _0x5a0872=_0x7d8c[_0x54b0df];return _0x5a0872;};'use strict';var _=require('lodash');var util=require(_0xc7d8('0x0'));var logger=require(_0xc7d8('0x1'))(_0xc7d8('0x2'));var moment=require(_0xc7d8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7d8('0x4'));var rimraf=require(_0xc7d8('0x5'));var config=require(_0xc7d8('0x6'));var attributes=require(_0xc7d8('0x7'));module[_0xc7d8('0x8')]=function(_0x1c1dfd,_0x228f38){return _0x1c1dfd[_0xc7d8('0x9')](_0xc7d8('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa172=['util','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','define','CmCompany','cm_companies','lodash'];(function(_0x418f0a,_0x21137f){var _0xa6b49=function(_0x3b6802){while(--_0x3b6802){_0x418f0a['push'](_0x418f0a['shift']());}};_0xa6b49(++_0x21137f);}(_0xa172,0xa4));var _0x2a17=function(_0x589301,_0x1a59cd){_0x589301=_0x589301-0x0;var _0x7c5d87=_0xa172[_0x589301];return _0x7c5d87;};'use strict';var _=require(_0x2a17('0x0'));var util=require(_0x2a17('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2a17('0x2'));var BPromise=require(_0x2a17('0x3'));var rp=require(_0x2a17('0x4'));var fs=require('fs');var path=require(_0x2a17('0x5'));var rimraf=require(_0x2a17('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a17('0x7'));module['exports']=function(_0x4d6d74,_0x5c2ff6){return _0x4d6d74[_0x2a17('0x8')](_0x2a17('0x9'),attributes,{'tableName':_0x2a17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index de23667..c0b447e 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 _0xea41=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','error','code','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x25e430,_0xa18ab6){var _0x286e8b=function(_0x4a734a){while(--_0x4a734a){_0x25e430['push'](_0x25e430['shift']());}};_0x286e8b(++_0xa18ab6);}(_0xea41,0x104));var _0x1ea4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xea41[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x1ea4('0x0'));var util=require(_0x1ea4('0x1'));var moment=require(_0x1ea4('0x2'));var BPromise=require(_0x1ea4('0x3'));var rs=require(_0x1ea4('0x4'));var fs=require('fs');var Redis=require(_0x1ea4('0x5'));var db=require(_0x1ea4('0x6'))['db'];var utils=require(_0x1ea4('0x7'));var logger=require(_0x1ea4('0x8'))(_0x1ea4('0x9'));var config=require(_0x1ea4('0xa'));var jayson=require(_0x1ea4('0xb'));var client=jayson[_0x1ea4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337753,_0x4d6f72,_0x4e4cc0){return new BPromise(function(_0x8c7e6,_0x350d38){return client[_0x1ea4('0xd')](_0x337753,_0x4e4cc0)[_0x1ea4('0xe')](function(_0x345ede){logger['info']('CmCompany,\x20%s,\x20%s',_0x4d6f72,_0x1ea4('0xf'));logger[_0x1ea4('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4d6f72,_0x1ea4('0xf'),JSON['stringify'](_0x345ede));if(_0x345ede[_0x1ea4('0x11')]){if(_0x345ede[_0x1ea4('0x11')][_0x1ea4('0x12')]===0x1f4){logger[_0x1ea4('0x11')](_0x1ea4('0x13'),_0x4d6f72,_0x345ede[_0x1ea4('0x11')][_0x1ea4('0x14')]);return _0x350d38(_0x345ede[_0x1ea4('0x11')][_0x1ea4('0x14')]);}logger[_0x1ea4('0x11')](_0x1ea4('0x13'),_0x4d6f72,_0x345ede['error'][_0x1ea4('0x14')]);return _0x8c7e6(_0x345ede['error'][_0x1ea4('0x14')]);}else{logger[_0x1ea4('0x15')](_0x1ea4('0x13'),_0x4d6f72,_0x1ea4('0xf'));_0x8c7e6(_0x345ede[_0x1ea4('0x16')][_0x1ea4('0x14')]);}})[_0x1ea4('0x17')](function(_0x2d2155){logger[_0x1ea4('0x11')](_0x1ea4('0x13'),_0x4d6f72,_0x2d2155);_0x350d38(_0x2d2155);});});} \ No newline at end of file +var _0x324b=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x324b,0x107));var _0xb324=function(_0x4b8e01,_0x263f6a){_0x4b8e01=_0x4b8e01-0x0;var _0x240873=_0x324b[_0x4b8e01];return _0x240873;};'use strict';var _=require(_0xb324('0x0'));var util=require(_0xb324('0x1'));var moment=require(_0xb324('0x2'));var BPromise=require('bluebird');var rs=require(_0xb324('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb324('0x4'))['db'];var utils=require(_0xb324('0x5'));var logger=require('../../config/logger')(_0xb324('0x6'));var config=require(_0xb324('0x7'));var jayson=require(_0xb324('0x8'));var client=jayson[_0xb324('0x9')][_0xb324('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1766d1,_0xafc6c5,_0x24f1d8){return new BPromise(function(_0x26c766,_0x564f36){return client[_0xb324('0xb')](_0x1766d1,_0x24f1d8)[_0xb324('0xc')](function(_0x355c90){logger[_0xb324('0xd')](_0xb324('0xe'),_0xafc6c5,_0xb324('0xf'));logger['debug'](_0xb324('0x10'),_0xafc6c5,_0xb324('0xf'),JSON[_0xb324('0x11')](_0x355c90));if(_0x355c90[_0xb324('0x12')]){if(_0x355c90[_0xb324('0x12')]['code']===0x1f4){logger[_0xb324('0x12')](_0xb324('0xe'),_0xafc6c5,_0x355c90[_0xb324('0x12')][_0xb324('0x13')]);return _0x564f36(_0x355c90[_0xb324('0x12')][_0xb324('0x13')]);}logger[_0xb324('0x12')](_0xb324('0xe'),_0xafc6c5,_0x355c90[_0xb324('0x12')][_0xb324('0x13')]);return _0x26c766(_0x355c90[_0xb324('0x12')][_0xb324('0x13')]);}else{logger[_0xb324('0xd')](_0xb324('0xe'),_0xafc6c5,_0xb324('0xf'));_0x26c766(_0x355c90[_0xb324('0x14')][_0xb324('0x13')]);}})[_0xb324('0x15')](function(_0x325af0){logger[_0xb324('0x12')](_0xb324('0xe'),_0xafc6c5,_0x325af0);_0x564f36(_0x325af0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d32190e..ccbe20b 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 _0xd634=['index','/describe','/:id/contacts','post','addContacts','put','/:id','update','delete','exports','util','path','Router','fs-extra','../../config/environment','./cmCompany.controller','get','isAuthenticated'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xd634,0xf4));var _0x4d63=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xd634[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require('multer');var util=require(_0x4d63('0x0'));var path=require(_0x4d63('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d63('0x2')]();var fs_extra=require(_0x4d63('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d63('0x4'));var controller=require(_0x4d63('0x5'));router[_0x4d63('0x6')]('/',auth[_0x4d63('0x7')](),controller[_0x4d63('0x8')]);router[_0x4d63('0x6')](_0x4d63('0x9'),auth[_0x4d63('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4d63('0x6')](_0x4d63('0xa'),auth[_0x4d63('0x7')](),controller['getContacts']);router[_0x4d63('0xb')]('/',auth[_0x4d63('0x7')](),controller['create']);router['post'](_0x4d63('0xa'),auth['isAuthenticated'](),controller[_0x4d63('0xc')]);router[_0x4d63('0xd')](_0x4d63('0xe'),auth[_0x4d63('0x7')](),controller[_0x4d63('0xf')]);router[_0x4d63('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4d63('0x11')]=router; \ No newline at end of file +var _0x5009=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','exports','multer'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x5009,0x1b4));var _0x9500=function(_0x4a83d7,_0x22bce5){_0x4a83d7=_0x4a83d7-0x0;var _0x5467aa=_0x5009[_0x4a83d7];return _0x5467aa;};'use strict';var multer=require(_0x9500('0x0'));var util=require(_0x9500('0x1'));var path=require(_0x9500('0x2'));var timeout=require(_0x9500('0x3'));var express=require('express');var router=express[_0x9500('0x4')]();var fs_extra=require(_0x9500('0x5'));var auth=require(_0x9500('0x6'));var interaction=require(_0x9500('0x7'));var config=require(_0x9500('0x8'));var controller=require('./cmCompany.controller');router[_0x9500('0x9')]('/',auth[_0x9500('0xa')](),controller[_0x9500('0xb')]);router[_0x9500('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9500('0xc')]);router[_0x9500('0x9')](_0x9500('0xd'),auth[_0x9500('0xa')](),controller[_0x9500('0xe')]);router['get'](_0x9500('0xf'),auth[_0x9500('0xa')](),controller[_0x9500('0x10')]);router[_0x9500('0x11')]('/',auth[_0x9500('0xa')](),controller[_0x9500('0x12')]);router[_0x9500('0x11')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x9500('0x13')]);router[_0x9500('0x14')](_0x9500('0xd'),auth[_0x9500('0xa')](),controller[_0x9500('0x15')]);router['delete'](_0x9500('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9500('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 f5571fc..9665a0b 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 _0x5f66=['sequelize','STRING','INTEGER','DATE'];(function(_0x371f33,_0x278a69){var _0x246c96=function(_0x4f8bad){while(--_0x4f8bad){_0x371f33['push'](_0x371f33['shift']());}};_0x246c96(++_0x278a69);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var Sequelize=require(_0x65f6('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x65f6('0x1')]},'street':{'type':Sequelize[_0x65f6('0x1')]},'postalCode':{'type':Sequelize[_0x65f6('0x1')]},'city':{'type':Sequelize[_0x65f6('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x65f6('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x65f6('0x1')]},'mobile':{'type':Sequelize[_0x65f6('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x65f6('0x1')]},'facebook':{'type':Sequelize[_0x65f6('0x1')]},'fb_data':{'type':Sequelize[_0x65f6('0x1')]},'twitter':{'type':Sequelize[_0x65f6('0x1')]},'skype':{'type':Sequelize[_0x65f6('0x1')]},'teams':{'type':Sequelize[_0x65f6('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x65f6('0x1')]},'telegram':{'type':Sequelize[_0x65f6('0x1')]},'UserId':{'type':Sequelize[_0x65f6('0x2')]},'priority':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x65f6('0x3')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x65f6('0x2')]}}; \ No newline at end of file +var _0xbaf0=['DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x3ab740,_0x5190c6){var _0x1a268d=function(_0xe4580f){while(--_0xe4580f){_0x3ab740['push'](_0x3ab740['shift']());}};_0x1a268d(++_0x5190c6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var Sequelize=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'firstName':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0baf('0x2')]},'street':{'type':Sequelize[_0x0baf('0x2')]},'postalCode':{'type':Sequelize[_0x0baf('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0baf('0x2')]},'dateOfBirth':{'type':Sequelize[_0x0baf('0x2')]},'description':{'type':Sequelize[_0x0baf('0x3')]},'phone':{'type':Sequelize[_0x0baf('0x2')]},'mobile':{'type':Sequelize[_0x0baf('0x2')]},'fax':{'type':Sequelize[_0x0baf('0x2')]},'email':{'type':Sequelize[_0x0baf('0x2')]},'url':{'type':Sequelize[_0x0baf('0x2')]},'facebook':{'type':Sequelize[_0x0baf('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x0baf('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x0baf('0x2')]},'viber':{'type':Sequelize[_0x0baf('0x2')]},'line':{'type':Sequelize[_0x0baf('0x2')]},'wechat':{'type':Sequelize[_0x0baf('0x2')]},'telegram':{'type':Sequelize[_0x0baf('0x2')]},'UserId':{'type':Sequelize[_0x0baf('0x4')]},'priority':{'type':Sequelize[_0x0baf('0x4')](0x2)[_0x0baf('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':Sequelize[_0x0baf('0x7')]},'dialTimezone':{'type':Sequelize[_0x0baf('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 42dde2b..8d8b152 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 _0x5971=['CmHopperFinal','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','utcOffset','each','duplicates','findOrCreate','spread','show','omit','format','cf_%d','timezones','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','findOne','ContactId','include','includeAll','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','server/files/tmp','filename','chmodSync','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','send','upload','createReadStream','file','meta','import','agent','binding','firstName','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','message','exit','error\x20child\x20process','pid','getJourney','mail','chat','sms','openchannel','whatsapp','voice','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','starttime','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','fullname','VoiceCallReport','findAndCountAll','Website','Account','closedAt','thirdDisposition','UserId','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','subject','substatus','threadId','startCase','Interaction','flatten','sortBy','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','socket.io-emitter','redis','register','status','json','offset','undefined','limit','set','update','then','destroy','end','sendStatus','error','name','CmContact','length','keys','startsWith','cf_','push','CmCustomField','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','nolimit','sort','pick','field','color','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','conditions','Tag','split','forEach','union','User','and','uc.UserId\x20=\x20?','value','datetime','castTo','DATE','buildExpression','text','start','hasOwnProperty','isNil','Contact','isEmpty','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','SELECT','clone','order','DESC','having','resolve','user','some','c.ListId\x20IS\x20NULL','map','ListId','sequelize','toString','count','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','find','params','describe','tags','displayName','analytics','findAll','alias','values','columnName','body','get','mergeWith','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','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5971,0x75));var _0x1597=function(_0x1b8a91,_0x65e56f){_0x1b8a91=_0x1b8a91-0x0;var _0x59a12e=_0x5971[_0x1b8a91];return _0x59a12e;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x1597('0x0'));var path=require(_0x1597('0x1'));var fs=require('fs');var _=require(_0x1597('0x2'));var squel=require(_0x1597('0x3'));var Papa=require(_0x1597('0x4'));var Redis=require(_0x1597('0x5'));var qs=require(_0x1597('0x6'));var as=require(_0x1597('0x7'));var logger=require(_0x1597('0x8'))(_0x1597('0x9'));var config=require(_0x1597('0xa'));var shared=require(_0x1597('0xb'));var db=require(_0x1597('0xc'))['db'];config['redis']=_[_0x1597('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1597('0xe'))(new Redis(config[_0x1597('0xf')]));require('./cmContact.socket')[_0x1597('0x10')](socket);function respondWithResult(_0x498b61,_0x29d166){_0x29d166=_0x29d166||0xc8;return function(_0x2b5f36){if(_0x2b5f36){return _0x498b61[_0x1597('0x11')](_0x29d166)[_0x1597('0x12')](_0x2b5f36);}};}function respondWithFilteredResult(_0x1163e0,_0x10df22){return function(_0xae7b8b){if(_0xae7b8b){var _0x200161=typeof _0x10df22[_0x1597('0x13')]===_0x1597('0x14')&&typeof _0x10df22[_0x1597('0x15')]===_0x1597('0x14');var _0x2d8eb3=_0xae7b8b['count'];var _0x3b58eb=_0x200161?0x0:_0x10df22[_0x1597('0x13')];var _0x3b36bb=_0x200161?_0xae7b8b['count']:_0x10df22[_0x1597('0x13')]+_0x10df22[_0x1597('0x15')];var _0x4812a2;if(_0x3b36bb>=_0x2d8eb3){_0x3b36bb=_0x2d8eb3;_0x4812a2=0xc8;}else{_0x4812a2=0xce;}_0x1163e0['status'](_0x4812a2);return _0x1163e0[_0x1597('0x16')]('Content-Range',_0x3b58eb+'-'+_0x3b36bb+'/'+_0x2d8eb3)['json'](_0xae7b8b);}return null;};}function saveUpdates(_0x23bd6b){return function(_0x3764b9){if(_0x3764b9){return _0x3764b9[_0x1597('0x17')](_0x23bd6b)[_0x1597('0x18')](function(_0x489569){return _0x489569;});}return null;};}function removeEntity(_0x4b79e0){return function(_0x4a9f65){if(_0x4a9f65){return _0x4a9f65[_0x1597('0x19')]()[_0x1597('0x18')](function(){_0x4b79e0[_0x1597('0x11')](0xcc)[_0x1597('0x1a')]();});}};}function handleEntityNotFound(_0x484934){return function(_0x134d7b){if(!_0x134d7b){_0x484934[_0x1597('0x1b')](0x194);}return _0x134d7b;};}function handleError(_0xb436e6,_0x16cf8d){_0x16cf8d=_0x16cf8d||0x1f4;return function(_0x413af6){logger[_0x1597('0x1c')](_0x413af6['stack']);if(_0x413af6['name']){delete _0x413af6[_0x1597('0x1d')];}_0xb436e6[_0x1597('0x11')](_0x16cf8d)['send'](_0x413af6);};}exports['index']=function(_0x124f2c,_0x80f68d){var _0x57759e={},_0x2a04b2={},_0x54de6c={'count':0x0,'rows':[]};return db[_0x1597('0x1e')]['describe']()[_0x1597('0x18')](function(_0x973ec0){var _0x3f14f3=[];for(var _0x5aef3a=0x0;_0x5aef3a0x1){_0x4ba674['or'](_0x1597('0x5c'),qs['getFullTextValue'](_0x106008),null);}else{if(qs[_0x1597('0x5d')](_0x106008)){_0x4ba674['or'](_0x1597('0x5e'),_0x106008+'%');_0x4ba674['or'](_0x1597('0x5f'),_0x106008+'%');_0x4ba674['or'](_0x1597('0x60'),_0x106008+'%');_0x4ba674['or'](_0x1597('0x61'),_0x106008+'%');}else if(qs[_0x1597('0x62')](_0x106008)){_0x4ba674['or']('c.email\x20LIKE\x20?',_0x106008+'%');}else{_0x4ba674['or'](_0x1597('0x63'),'%'+_0x106008+'%');_0x4ba674['or']('c.lastName\x20LIKE\x20?','%'+_0x106008+'%');_0x4ba674['or'](_0x1597('0x64'),'%'+_0x106008+'%');}}}}_0x4eb4c7[_0x1597('0x3c')](_0x4ba674);_0x4eb4c7[_0x1597('0x65')](_0x1597('0x66'));var _0x2f6e2d={'type':db[_0x1597('0x67')]['QueryTypes'][_0x1597('0x68')],'raw':!![]};var _0x116a07=_0x4eb4c7[_0x1597('0x69')]()['field']('c.id');if(_0x57759e[_0x1597('0x6a')]){_0x57759e[_0x1597('0x6a')][_0x1597('0x43')](function(_0x5159b2){_0x4eb4c7[_0x1597('0x6a')]('c.'+_0x5159b2[0x0],_0x5159b2[0x1]===_0x1597('0x6b')?![]:!![]);});}if(!_[_0x1597('0x52')](_0x51f160)){_0x4eb4c7[_0x1597('0x6c')](_0x555881);_0x116a07[_0x1597('0x3c')]('t.id\x20IN\x20?',_0x51f160);}BPromise[_0x1597('0x6d')]()['then'](function(){if(!_0x4c2220)return;if(_0x124f2c[_0x1597('0x6e')]['role']!=='agent')return;if(!_[_0x1597('0x6f')](_0x4c2220[_0x1597('0x40')],[_0x1597('0x32'),_0x1597('0x45')])){return _0x124f2c[_0x1597('0x6e')]['getLists']({'attributes':['id'],'raw':!![]})[_0x1597('0x18')](function(_0x2726b6){if(_[_0x1597('0x52')](_0x2726b6)){_0x116a07[_0x1597('0x3c')](_0x1597('0x70'));_0x4eb4c7[_0x1597('0x3c')](_0x1597('0x70'));}else{_0x116a07['where'](_0x1597('0x53'),_[_0x1597('0x71')](_0x2726b6,'id'));_0x4eb4c7['where']('c.ListId\x20IN\x20?',_[_0x1597('0x71')](_0x2726b6,'id'));}});}})[_0x1597('0x18')](function(){if(_0x124f2c[_0x1597('0x6e')]['role']==='agent'&&!_0x4c2220&&!_0x124f2c[_0x1597('0x2a')][_0x1597('0x72')])return[];return db[_0x1597('0x73')][_0x1597('0x2a')](_0x116a07[_0x1597('0x74')](),_0x2f6e2d);})[_0x1597('0x18')](function(_0x1f40b8){_0x54de6c[_0x1597('0x75')]=_0x1f40b8[_0x1597('0x1f')];if(_0x54de6c[_0x1597('0x75')]===0x0)return[];return db[_0x1597('0x73')][_0x1597('0x2a')](_0x2f4b80['toString'](),_0x2f6e2d)['then'](function(_0x241f8e){_0x1e1a2e=_[_0x1597('0x76')](_0x241f8e,'id');_0x2f6e2d=_[_0x1597('0x77')](_0x2f6e2d,{'model':db[_0x1597('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x124f2c[_0x1597('0x2a')][_0x1597('0x2e')]){_0x57759e['attributes'][_0x1597('0x43')](function(_0x29f27f){_0x4eb4c7[_0x1597('0x32')]('c.'+_0x29f27f);});}else{_0x4eb4c7['field'](_0x1597('0x66'));_0x4eb4c7['field'](_0x1597('0x78'));_0x4eb4c7[_0x1597('0x32')](_0x1597('0x79'));_0x4eb4c7[_0x1597('0x32')](_0x1597('0x7a'));_0x4eb4c7[_0x1597('0x32')](_0x1597('0x7b'));_0x4eb4c7[_0x1597('0x32')](_0x1597('0x7c'));_0x4eb4c7['field'](_0x1597('0x7d'));_0x4eb4c7['field'](_0x1597('0x7e'));_0x4eb4c7['field'](_0x1597('0x7f'));_0x4eb4c7[_0x1597('0x32')]('c.deletedAt');_0x4eb4c7[_0x1597('0x32')](_0x1597('0x80'));_0x4eb4c7[_0x1597('0x32')](_0x1597('0x81'),'TagIds');}if(_0x57759e[_0x1597('0x15')])_0x4eb4c7['limit'](_0x57759e[_0x1597('0x15')]);if(_0x57759e[_0x1597('0x13')])_0x4eb4c7[_0x1597('0x13')](_0x57759e[_0x1597('0x13')]);return db[_0x1597('0x73')][_0x1597('0x2a')](_0x4eb4c7[_0x1597('0x74')](),_0x2f6e2d);});})['then'](function(_0x49679e){_0x49679e['forEach'](function(_0x385f4d){if(_0x385f4d[_0x1597('0x82')]){_0x385f4d[_0x1597('0x83')]=[];_0x385f4d[_0x1597('0x82')][_0x1597('0x42')](',')[_0x1597('0x43')](function(_0x231078){_0x385f4d[_0x1597('0x83')]['push'](_0x1e1a2e[_0x231078]);});}delete _0x385f4d[_0x1597('0x82')];});_0x54de6c[_0x1597('0x84')]=_0x49679e;return _0x54de6c;})[_0x1597('0x18')](respondWithFilteredResult(_0x80f68d,_0x57759e));})[_0x1597('0x85')](handleError(_0x80f68d,null));};exports[_0x1597('0x19')]=function(_0x3e7849,_0x493722){return db['CmContact'][_0x1597('0x86')]({'where':{'id':_0x3e7849[_0x1597('0x87')]['id']}})[_0x1597('0x18')](handleEntityNotFound(_0x493722,null))[_0x1597('0x18')](removeEntity(_0x493722,null))[_0x1597('0x85')](handleError(_0x493722,null));};exports['describe']=function(_0x128a0a,_0x1285c6){return db[_0x1597('0x1e')][_0x1597('0x88')]()[_0x1597('0x18')](function(_0x53adba){delete _0x53adba[_0x1597('0x89')];for(var _0x3650e5=0x0;_0x3650e5=_0x1595d9){_0xb3b6cf=_0x1595d9;_0x5cf28b=0xc8;}else{_0x5cf28b=0xce;}_0x58834a[_0x88fa('0x13')](_0x5cf28b);return _0x58834a[_0x88fa('0x14')]('Content-Range',_0x28c673+'-'+_0xb3b6cf+'/'+_0x1595d9)[_0x88fa('0xe')](_0x380215);}return null;};}function saveUpdates(_0x19c09f){return function(_0x35b287){if(_0x35b287){return _0x35b287[_0x88fa('0x15')](_0x19c09f)[_0x88fa('0x16')](function(_0x4500d7){return _0x4500d7;});}return null;};}function removeEntity(_0xaedeff){return function(_0x392424){if(_0x392424){return _0x392424[_0x88fa('0x17')]()['then'](function(){_0xaedeff[_0x88fa('0x13')](0xcc)[_0x88fa('0x18')]();});}};}function handleEntityNotFound(_0x202ddf){return function(_0x315c1d){if(!_0x315c1d){_0x202ddf[_0x88fa('0x19')](0x194);}return _0x315c1d;};}function handleError(_0x1903f1,_0x64246d){_0x64246d=_0x64246d||0x1f4;return function(_0x602451){logger['error'](_0x602451[_0x88fa('0x1a')]);if(_0x602451[_0x88fa('0x1b')]){delete _0x602451['name'];}_0x1903f1[_0x88fa('0x13')](_0x64246d)['send'](_0x602451);};}exports[_0x88fa('0x1c')]=function(_0x4fedf5,_0x28338f){var _0x4a350a={},_0x586eaf={},_0x563499={'count':0x0,'rows':[]};return db[_0x88fa('0x1d')]['describe']()['then'](function(_0x6fc2bb){var _0x13771d=[];for(var _0x4067c2=0x0;_0x4067c20x1){_0x3ea66f['or'](_0x88fa('0x5c'),qs[_0x88fa('0x5d')](_0x58da04),null);}else{if(qs['isNumeric'](_0x58da04)){_0x3ea66f['or']('c.id\x20LIKE\x20?',_0x58da04+'%');_0x3ea66f['or'](_0x88fa('0x5e'),_0x58da04+'%');_0x3ea66f['or'](_0x88fa('0x5f'),_0x58da04+'%');_0x3ea66f['or'](_0x88fa('0x60'),_0x58da04+'%');}else if(qs[_0x88fa('0x61')](_0x58da04)){_0x3ea66f['or'](_0x88fa('0x62'),_0x58da04+'%');}else{_0x3ea66f['or']('c.firstName\x20LIKE\x20?','%'+_0x58da04+'%');_0x3ea66f['or'](_0x88fa('0x63'),'%'+_0x58da04+'%');_0x3ea66f['or'](_0x88fa('0x62'),'%'+_0x58da04+'%');}}}}_0x4f4b13[_0x88fa('0x3d')](_0x3ea66f);_0x4f4b13[_0x88fa('0x64')]('c.id');var _0x46df08={'type':db[_0x88fa('0x65')][_0x88fa('0x66')][_0x88fa('0x67')],'raw':!![]};var _0x8afae5=_0x4f4b13[_0x88fa('0x68')]()[_0x88fa('0x35')](_0x88fa('0x69'));if(_0x4a350a[_0x88fa('0x30')]){_0x4a350a[_0x88fa('0x30')][_0x88fa('0x46')](function(_0x5bf315){_0x4f4b13[_0x88fa('0x30')]('c.'+_0x5bf315[0x0],_0x5bf315[0x1]==='DESC'?![]:!![]);});}if(!_[_0x88fa('0x52')](_0x1bb516)){_0x4f4b13[_0x88fa('0x6a')](_0x5a9c15);_0x8afae5[_0x88fa('0x3d')](_0x88fa('0x6b'),_0x1bb516);}BPromise['resolve']()[_0x88fa('0x16')](function(){if(!_0x2493db)return;if(_0x4fedf5[_0x88fa('0x6c')][_0x88fa('0x6d')]!==_0x88fa('0x6e'))return;if(!_[_0x88fa('0x6f')](_0x2493db[_0x88fa('0x42')],[_0x88fa('0x35'),'User'])){return _0x4fedf5[_0x88fa('0x6c')][_0x88fa('0x70')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10a15d){if(_[_0x88fa('0x52')](_0x10a15d)){_0x8afae5[_0x88fa('0x3d')](_0x88fa('0x71'));_0x4f4b13[_0x88fa('0x3d')](_0x88fa('0x71'));}else{_0x8afae5[_0x88fa('0x3d')](_0x88fa('0x54'),_[_0x88fa('0x45')](_0x10a15d,'id'));_0x4f4b13[_0x88fa('0x3d')](_0x88fa('0x54'),_[_0x88fa('0x45')](_0x10a15d,'id'));}});}})['then'](function(){if(_0x4fedf5[_0x88fa('0x6c')][_0x88fa('0x6d')]===_0x88fa('0x6e')&&!_0x2493db&&!_0x4fedf5['query']['ListId'])return[];return db[_0x88fa('0x72')][_0x88fa('0x2a')](_0x8afae5[_0x88fa('0x73')](),_0x46df08);})[_0x88fa('0x16')](function(_0x390719){_0x563499[_0x88fa('0x11')]=_0x390719[_0x88fa('0x1f')];if(_0x563499['count']===0x0)return[];return db['sequelize'][_0x88fa('0x2a')](_0x4134ba[_0x88fa('0x73')](),_0x46df08)['then'](function(_0x183c86){_0x1a20d0=_[_0x88fa('0x74')](_0x183c86,'id');_0x46df08=_[_0x88fa('0x75')](_0x46df08,{'model':db[_0x88fa('0x1d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4fedf5[_0x88fa('0x2a')][_0x88fa('0x2c')]){_0x4a350a[_0x88fa('0x2d')][_0x88fa('0x46')](function(_0x4f20f5){_0x4f4b13[_0x88fa('0x35')]('c.'+_0x4f20f5);});}else{_0x4f4b13[_0x88fa('0x35')]('c.id');_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x76'));_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x77'));_0x4f4b13[_0x88fa('0x35')]('c.phone');_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x78'));_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x79'));_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x7a'));_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x7b'));_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x7c'));_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x7d'));_0x4f4b13[_0x88fa('0x35')](_0x88fa('0x7e'));_0x4f4b13[_0x88fa('0x35')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x88fa('0x7f'));}if(_0x4a350a[_0x88fa('0x12')])_0x4f4b13[_0x88fa('0x12')](_0x4a350a[_0x88fa('0x12')]);if(_0x4a350a['offset'])_0x4f4b13[_0x88fa('0xf')](_0x4a350a[_0x88fa('0xf')]);return db[_0x88fa('0x72')][_0x88fa('0x2a')](_0x4f4b13['toString'](),_0x46df08);});})['then'](function(_0x18810d){_0x18810d[_0x88fa('0x46')](function(_0x2091a5){if(_0x2091a5['TagIds']){_0x2091a5['Tags']=[];_0x2091a5['TagIds']['split'](',')[_0x88fa('0x46')](function(_0x1874f8){_0x2091a5['Tags'][_0x88fa('0x22')](_0x1a20d0[_0x1874f8]);});}delete _0x2091a5['TagIds'];});_0x563499[_0x88fa('0x80')]=_0x18810d;return _0x563499;})[_0x88fa('0x16')](respondWithFilteredResult(_0x28338f,_0x4a350a));})['catch'](handleError(_0x28338f,null));};exports['destroy']=function(_0x1633e0,_0x3f9a67){return db[_0x88fa('0x1d')][_0x88fa('0x81')]({'where':{'id':_0x1633e0['params']['id']}})['then'](handleEntityNotFound(_0x3f9a67,null))[_0x88fa('0x16')](removeEntity(_0x3f9a67,null))['catch'](handleError(_0x3f9a67,null));};exports[_0x88fa('0x82')]=function(_0xcf7aa1,_0x58154e){return db['CmContact'][_0x88fa('0x82')]()[_0x88fa('0x16')](function(_0x283d46){delete _0x283d46[_0x88fa('0x83')];for(var _0x276470=0x0;_0x276470{}\s\\|]/g,'-');_0x1cb137(null,util[_0x9fce('0x22')]('%s-%s%s',path[_0x9fce('0x23')](_0x89f755['originalname'],path[_0x9fce('0x24')](_0x89f755['originalname'])),Date[_0x9fce('0x25')](),path[_0x9fce('0x24')](_0x89f755['originalname'])));}})});router[_0x9fce('0x16')](_0x9fce('0x26'),upload['single'](_0x9fce('0x27')),controller[_0x9fce('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56cc84,_0x4d59e5,_0x4cf68d){_0x4cf68d(null,path[_0x9fce('0x29')](config[_0x9fce('0x1e')],_0x9fce('0x1f')));},'filename':function(_0x5cc28f,_0x52a8b5,_0x49dc7a){_0x52a8b5[_0x9fce('0x20')]=_0x52a8b5[_0x9fce('0x20')][_0x9fce('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x49dc7a(null,util[_0x9fce('0x22')](_0x9fce('0x2a'),path[_0x9fce('0x23')](_0x52a8b5[_0x9fce('0x20')],path[_0x9fce('0x24')](_0x52a8b5[_0x9fce('0x20')])),Date[_0x9fce('0x25')](),path['extname'](_0x52a8b5[_0x9fce('0x20')])));}})});router[_0x9fce('0x16')](_0x9fce('0x2b'),upload[_0x9fce('0x2c')](_0x9fce('0x27')),controller['upload']);router[_0x9fce('0x16')](_0x9fce('0x2d'),auth[_0x9fce('0xb')](),controller[_0x9fce('0x2e')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9fce('0x2f')]);router[_0x9fce('0x30')]('/:id',auth[_0x9fce('0xb')](),controller['destroy']);module[_0x9fce('0x31')]=router; \ No newline at end of file +var _0x0d17=['getTags','/:id/hoppers','getHopperFinals','/:id/jscripty_sessions','/:id/journey','getJourney','/merge','post','create','root','originalname','format','%s-%s%s','basename','extname','now','file','uploadCsv','diskStorage','join','/upload','upload','/upload/:id','import','put','update','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','/:id/tags'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x0d17,0xbf));var _0x70d1=function(_0x59ff8f,_0x49d383){_0x59ff8f=_0x59ff8f-0x0;var _0x81e079=_0x0d17[_0x59ff8f];return _0x81e079;};'use strict';var multer=require('multer');var util=require(_0x70d1('0x0'));var path=require(_0x70d1('0x1'));var timeout=require(_0x70d1('0x2'));var express=require(_0x70d1('0x3'));var router=express['Router']();var fs_extra=require(_0x70d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x70d1('0x5'));var config=require(_0x70d1('0x6'));var controller=require(_0x70d1('0x7'));router[_0x70d1('0x8')]('/',auth[_0x70d1('0x9')](),controller[_0x70d1('0xa')]);router[_0x70d1('0x8')](_0x70d1('0xb'),auth[_0x70d1('0x9')](),controller['describe']);router[_0x70d1('0x8')](_0x70d1('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x70d1('0xd'),auth[_0x70d1('0x9')](),controller[_0x70d1('0xe')]);router['get'](_0x70d1('0xf'),auth[_0x70d1('0x9')](),controller['getHoppers']);router[_0x70d1('0x8')]('/:id/hopper_histories',auth[_0x70d1('0x9')](),controller['getHopperHistories']);router[_0x70d1('0x8')]('/:id/hopper_finals',auth[_0x70d1('0x9')](),controller[_0x70d1('0x10')]);router[_0x70d1('0x8')](_0x70d1('0x11'),auth['isAuthenticated'](),controller['getJscriptySessions']);router[_0x70d1('0x8')](_0x70d1('0x12'),auth[_0x70d1('0x9')](),controller[_0x70d1('0x13')]);router['post'](_0x70d1('0x14'),auth[_0x70d1('0x9')](),controller['merge']);router[_0x70d1('0x15')]('/',auth[_0x70d1('0x9')](),controller[_0x70d1('0x16')]);router[_0x70d1('0x15')]('/create_many',auth[_0x70d1('0x9')](),controller['bulkCreate']);router[_0x70d1('0x15')](_0x70d1('0xd'),auth[_0x70d1('0x9')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x20c124,_0x1e2d97,_0xfb460d){_0xfb460d(null,path['join'](config[_0x70d1('0x17')],'server/files/tmp'));},'filename':function(_0xef719c,_0x428231,_0x3847fa){_0x428231[_0x70d1('0x18')]=_0x428231['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3847fa(null,util[_0x70d1('0x19')](_0x70d1('0x1a'),path[_0x70d1('0x1b')](_0x428231[_0x70d1('0x18')],path[_0x70d1('0x1c')](_0x428231[_0x70d1('0x18')])),Date[_0x70d1('0x1d')](),path[_0x70d1('0x1c')](_0x428231[_0x70d1('0x18')])));}})});router[_0x70d1('0x15')]('/csv',upload['single'](_0x70d1('0x1e')),controller[_0x70d1('0x1f')]);var upload=multer({'storage':multer[_0x70d1('0x20')]({'destination':function(_0x1f8d9c,_0x4f2443,_0x1a6a61){_0x1a6a61(null,path[_0x70d1('0x21')](config['root'],'server/files/tmp'));},'filename':function(_0x8cddeb,_0x4dbf27,_0x4c6f79){_0x4dbf27[_0x70d1('0x18')]=_0x4dbf27[_0x70d1('0x18')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4c6f79(null,util[_0x70d1('0x19')](_0x70d1('0x1a'),path[_0x70d1('0x1b')](_0x4dbf27['originalname'],path[_0x70d1('0x1c')](_0x4dbf27[_0x70d1('0x18')])),Date[_0x70d1('0x1d')](),path['extname'](_0x4dbf27[_0x70d1('0x18')])));}})});router[_0x70d1('0x15')](_0x70d1('0x22'),upload['single'](_0x70d1('0x1e')),controller[_0x70d1('0x23')]);router[_0x70d1('0x15')](_0x70d1('0x24'),auth[_0x70d1('0x9')](),controller[_0x70d1('0x25')]);router[_0x70d1('0x26')](_0x70d1('0xc'),auth['isAuthenticated'](),controller[_0x70d1('0x27')]);router['delete'](_0x70d1('0xc'),auth[_0x70d1('0x9')](),controller['destroy']);module[_0x70d1('0x28')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2bc9388..c659de8 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 _0xa64c=['type','select','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','long'];(function(_0x4ece4b,_0x5a6f03){var _0x31bd1b=function(_0x259849){while(--_0x259849){_0x4ece4b['push'](_0x4ece4b['shift']());}};_0x31bd1b(++_0x5a6f03);}(_0xa64c,0xce));var _0xca64=function(_0x537deb,_0x1222af){_0x537deb=_0x537deb-0x0;var _0x404355=_0xa64c[_0x537deb];return _0x404355;};'use strict';var Sequelize=require(_0xca64('0x0'));var _=require(_0xca64('0x1'));module[_0xca64('0x2')]={'name':{'type':Sequelize[_0xca64('0x3')],'get':function(_0x272c53){return this[_0xca64('0x4')](_0xca64('0x5'));}},'alias':{'type':Sequelize[_0xca64('0x6')],'allowNull':![],'set':function(_0x1f78e0){this[_0xca64('0x7')]('alias',_0x1f78e0?_0x1f78e0:this[_0xca64('0x4')]('name'));}},'type':{'type':Sequelize[_0xca64('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xca64('0x8')](_0xca64('0x9')),'get':function(){if(this[_0xca64('0x4')](_0xca64('0xa'))===_0xca64('0xb')){return JSON['parse'](this[_0xca64('0x4')](_0xca64('0xc')));}else{return this[_0xca64('0x4')](_0xca64('0xc'));}},'set':function(_0x58c7fe){if(Array[_0xca64('0xd')](_0x58c7fe)){this['setDataValue'](_0xca64('0xc'),JSON[_0xca64('0xe')](_0x58c7fe));}else{this[_0xca64('0x7')](_0xca64('0xc'),_0x58c7fe);}}},'required':{'type':Sequelize[_0xca64('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xca64('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xca64('0x10')](_0xca64('0x11'))}}; \ No newline at end of file +var _0xc9a4=['long','select','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','alias','name','TEXT'];(function(_0x23cc4a,_0x5e8e22){var _0x2a832a=function(_0x2cebc3){while(--_0x2cebc3){_0x23cc4a['push'](_0x23cc4a['shift']());}};_0x2a832a(++_0x5e8e22);}(_0xc9a4,0x15f));var _0x4c9a=function(_0x57d3f5,_0x1377a5){_0x57d3f5=_0x57d3f5-0x0;var _0x57cb5a=_0xc9a4[_0x57d3f5];return _0x57cb5a;};'use strict';var Sequelize=require(_0x4c9a('0x0'));var _=require(_0x4c9a('0x1'));module[_0x4c9a('0x2')]={'name':{'type':Sequelize[_0x4c9a('0x3')],'get':function(_0x4a29f1){return this[_0x4c9a('0x4')]('alias');}},'alias':{'type':Sequelize[_0x4c9a('0x5')],'allowNull':![],'set':function(_0x10fa16){this['setDataValue'](_0x4c9a('0x6'),_0x10fa16?_0x10fa16:this[_0x4c9a('0x4')](_0x4c9a('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x4c9a('0x8')](_0x4c9a('0x9')),'get':function(){if(this[_0x4c9a('0x4')]('type')===_0x4c9a('0xa')){return JSON['parse'](this[_0x4c9a('0x4')]('values'));}else{return this[_0x4c9a('0x4')](_0x4c9a('0xb'));}},'set':function(_0x4b385e){if(Array[_0x4c9a('0xc')](_0x4b385e)){this[_0x4c9a('0xd')]('values',JSON[_0x4c9a('0xe')](_0x4b385e));}else{this['setDataValue'](_0x4c9a('0xb'),_0x4b385e);}}},'required':{'type':Sequelize[_0x4c9a('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4c9a('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4c9a('0x10')](_0x4c9a('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index b6f69a7..80f8bee 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 _0xb761=['../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','format','fast-json-patch','request-promise','moment','util','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x2748fb,_0x35f385){var _0x3652ba=function(_0x293dfc){while(--_0x293dfc){_0x2748fb['push'](_0x2748fb['shift']());}};_0x3652ba(++_0x35f385);}(_0xb761,0x1d4));var _0x1b76=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb761[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1b76('0x0'));var rp=require(_0x1b76('0x1'));var moment=require(_0x1b76('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b76('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x1b76('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b76('0x5'));var _=require('lodash');var squel=require(_0x1b76('0x6'));var crypto=require('crypto');var jsforce=require(_0x1b76('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x1b76('0x4'));var querystring=require('querystring');var Papa=require(_0x1b76('0x8'));var Redis=require(_0x1b76('0x9'));var authService=require(_0x1b76('0xa'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b76('0xb'));var logger=require(_0x1b76('0xc'))(_0x1b76('0xd'));var utils=require(_0x1b76('0xe'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b76('0xf'))['db'];function respondWithStatusCode(_0x587026,_0x33e7e7){_0x33e7e7=_0x33e7e7||0xcc;return function(_0x35eb4b){if(_0x35eb4b){return _0x587026['sendStatus'](_0x33e7e7);}return _0x587026[_0x1b76('0x10')](_0x33e7e7)[_0x1b76('0x11')]();};}function respondWithResult(_0x463479,_0x4ab89f){_0x4ab89f=_0x4ab89f||0xc8;return function(_0x52ed1b){if(_0x52ed1b){return _0x463479[_0x1b76('0x10')](_0x4ab89f)[_0x1b76('0x12')](_0x52ed1b);}};}function respondWithFilteredResult(_0x254969,_0x3f3d19){return function(_0x74c8f4){if(_0x74c8f4){var _0x231582=typeof _0x3f3d19[_0x1b76('0x13')]===_0x1b76('0x14')&&typeof _0x3f3d19[_0x1b76('0x15')]==='undefined';var _0xbd6a0d=_0x74c8f4['count'];var _0x53b54c=_0x231582?0x0:_0x3f3d19['offset'];var _0x361c1c=_0x231582?_0x74c8f4[_0x1b76('0x16')]:_0x3f3d19['offset']+_0x3f3d19[_0x1b76('0x15')];var _0x49000b;if(_0x361c1c>=_0xbd6a0d){_0x361c1c=_0xbd6a0d;_0x49000b=0xc8;}else{_0x49000b=0xce;}_0x254969[_0x1b76('0x10')](_0x49000b);return _0x254969[_0x1b76('0x17')](_0x1b76('0x18'),_0x53b54c+'-'+_0x361c1c+'/'+_0xbd6a0d)['json'](_0x74c8f4);}return null;};}function patchUpdates(_0x266f73){return function(_0x2625e5){try{jsonpatch[_0x1b76('0x19')](_0x2625e5,_0x266f73,!![]);}catch(_0x129746){return BPromise[_0x1b76('0x1a')](_0x129746);}return _0x2625e5[_0x1b76('0x1b')]();};}function saveUpdates(_0x95a8c4,_0x4a86a8){return function(_0x2adc6f){if(_0x2adc6f){return _0x2adc6f[_0x1b76('0x1c')](_0x95a8c4)[_0x1b76('0x1d')](function(_0x24f23c){return _0x24f23c;});}return null;};}function removeEntity(_0x415fba,_0x334a2d){return function(_0x44e5ea){if(_0x44e5ea){return _0x44e5ea[_0x1b76('0x1e')]()[_0x1b76('0x1d')](function(){_0x415fba[_0x1b76('0x10')](0xcc)[_0x1b76('0x11')]();});}};}function handleEntityNotFound(_0x4314df,_0x1c356b){return function(_0x54f194){if(!_0x54f194){_0x4314df[_0x1b76('0x1f')](0x194);}return _0x54f194;};}function handleError(_0x10bdd6,_0x3bd755){_0x3bd755=_0x3bd755||0x1f4;return function(_0x17eb8a){logger[_0x1b76('0x20')](_0x17eb8a[_0x1b76('0x21')]);if(_0x17eb8a[_0x1b76('0x22')]){delete _0x17eb8a[_0x1b76('0x22')];}_0x10bdd6[_0x1b76('0x10')](_0x3bd755)[_0x1b76('0x23')](_0x17eb8a);};}exports[_0x1b76('0x24')]=function(_0x26416c,_0x2722dc){var _0x215dc3={},_0x1da9d5={},_0x5900f9={'count':0x0,'rows':[]};var _0x1f7d60=_[_0x1b76('0x25')](db[_0x1b76('0x26')]['rawAttributes'],function(_0x412602){return{'name':_0x412602[_0x1b76('0x27')],'type':_0x412602['type'][_0x1b76('0x28')]};});_0x1da9d5[_0x1b76('0x29')]=_[_0x1b76('0x2a')](_[_0x1b76('0x25')](_0x1f7d60,'name'),[_0x1b76('0x22')]);_0x1da9d5[_0x1b76('0x2b')]=_[_0x1b76('0x2c')](_0x26416c[_0x1b76('0x2b')]);_0x1da9d5[_0x1b76('0x2d')]=_[_0x1b76('0x2e')](_0x1da9d5[_0x1b76('0x29')],_0x1da9d5[_0x1b76('0x2b')]);_0x215dc3[_0x1b76('0x2f')]=_[_0x1b76('0x2e')](_0x1da9d5[_0x1b76('0x29')],qs[_0x1b76('0x30')](_0x26416c[_0x1b76('0x2b')]['fields']));_0x215dc3[_0x1b76('0x2f')]=_0x215dc3[_0x1b76('0x2f')][_0x1b76('0x31')]?_0x215dc3[_0x1b76('0x2f')]:_0x1da9d5['model'];if(!_0x26416c['query'][_0x1b76('0x32')](_0x1b76('0x33'))){_0x215dc3[_0x1b76('0x15')]=qs[_0x1b76('0x15')](_0x26416c['query']['limit']);_0x215dc3[_0x1b76('0x13')]=qs[_0x1b76('0x13')](_0x26416c['query'][_0x1b76('0x13')]);}_0x215dc3['order']=qs[_0x1b76('0x34')](_0x26416c['query'][_0x1b76('0x34')]);_0x215dc3[_0x1b76('0x35')]=qs[_0x1b76('0x2d')](_['pick'](_0x26416c[_0x1b76('0x2b')],_0x1da9d5[_0x1b76('0x2d')]),_0x1f7d60);if(_0x26416c[_0x1b76('0x2b')][_0x1b76('0x36')]){_0x215dc3['where']=_[_0x1b76('0x37')](_0x215dc3[_0x1b76('0x35')],{'$or':_[_0x1b76('0x25')](_0x1f7d60,function(_0xab214b){if(_0xab214b[_0x1b76('0x38')]!==_0x1b76('0x39')){var _0x5032fb={};_0x5032fb[_0xab214b['name']]={'$like':'%'+_0x26416c[_0x1b76('0x2b')][_0x1b76('0x36')]+'%'};return _0x5032fb;}})});}_0x215dc3=_['merge']({},_0x215dc3,_0x26416c[_0x1b76('0x3a')]);var _0x1c301f={'where':_0x215dc3[_0x1b76('0x35')]};return db[_0x1b76('0x26')]['count'](_0x1c301f)[_0x1b76('0x1d')](function(_0x590a53){_0x5900f9[_0x1b76('0x16')]=_0x590a53;if(_0x26416c[_0x1b76('0x2b')][_0x1b76('0x3b')]){_0x215dc3[_0x1b76('0x3c')]=[{'all':!![]}];}return db[_0x1b76('0x26')]['findAll'](_0x215dc3);})[_0x1b76('0x1d')](function(_0x2ddf13){_0x5900f9[_0x1b76('0x3d')]=_0x2ddf13;return _0x5900f9;})[_0x1b76('0x1d')](respondWithFilteredResult(_0x2722dc,_0x215dc3))[_0x1b76('0x3e')](handleError(_0x2722dc,null));};exports[_0x1b76('0x3f')]=function(_0x127190,_0x5a8145){var _0x179e85={'raw':!![],'where':{'id':_0x127190[_0x1b76('0x40')]['id']}},_0x370b12={};_0x370b12[_0x1b76('0x29')]=_[_0x1b76('0x2c')](db[_0x1b76('0x26')]['rawAttributes']);_0x370b12[_0x1b76('0x2b')]=_[_0x1b76('0x2c')](_0x127190[_0x1b76('0x2b')]);_0x370b12[_0x1b76('0x2d')]=_[_0x1b76('0x2e')](_0x370b12[_0x1b76('0x29')],_0x370b12['query']);_0x179e85[_0x1b76('0x2f')]=_[_0x1b76('0x2e')](_0x370b12[_0x1b76('0x29')],qs[_0x1b76('0x30')](_0x127190['query'][_0x1b76('0x30')]));_0x179e85['attributes']=_0x179e85[_0x1b76('0x2f')][_0x1b76('0x31')]?_0x179e85[_0x1b76('0x2f')]:_0x370b12[_0x1b76('0x29')];if(_0x127190[_0x1b76('0x2b')][_0x1b76('0x3b')]){_0x179e85['include']=[{'all':!![]}];}_0x179e85=_[_0x1b76('0x37')]({},_0x179e85,_0x127190['options']);return db[_0x1b76('0x26')][_0x1b76('0x41')](_0x179e85)[_0x1b76('0x1d')](handleEntityNotFound(_0x5a8145,null))[_0x1b76('0x1d')](respondWithResult(_0x5a8145,null))[_0x1b76('0x3e')](handleError(_0x5a8145,null));};exports[_0x1b76('0x1c')]=function(_0x4ad8a7,_0x2571a1){if(_0x4ad8a7[_0x1b76('0x42')]['id']){delete _0x4ad8a7[_0x1b76('0x42')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x4ad8a7[_0x1b76('0x40')]['id']}})[_0x1b76('0x1d')](handleEntityNotFound(_0x2571a1,null))[_0x1b76('0x1d')](saveUpdates(_0x4ad8a7['body'],null))['then'](respondWithResult(_0x2571a1,null))['catch'](handleError(_0x2571a1,null));};exports['destroy']=function(_0x574212,_0x47a885){return db[_0x1b76('0x26')][_0x1b76('0x41')]({'where':{'id':_0x574212[_0x1b76('0x40')]['id']}})[_0x1b76('0x1d')](handleEntityNotFound(_0x47a885,null))[_0x1b76('0x1d')](removeEntity(_0x47a885,null))[_0x1b76('0x3e')](handleError(_0x47a885,null));};exports[_0x1b76('0x43')]=function(_0x275664,_0x28e525){var _0x1e86de;return db[_0x1b76('0x44')][_0x1b76('0x45')](function(_0x3e5048){return db['CmCustomField']['create'](_0x275664[_0x1b76('0x42')],{'transaction':_0x3e5048})[_0x1b76('0x1d')](function(_0x4da899){_0x1e86de=_0x4da899;var _0x1960db={'type':db[_0x1b76('0x46')][_0x1b76('0x47')],'transaction':_0x3e5048};switch(_0x275664['body'][_0x1b76('0x38')]){case _0x1b76('0x48'):_0x1960db['type']=db[_0x1b76('0x46')][_0x1b76('0x47')];break;case _0x1b76('0x49'):_0x1960db[_0x1b76('0x38')]=db[_0x1b76('0x46')][_0x1b76('0x4a')];break;case'switch':_0x1960db['type']=db[_0x1b76('0x46')][_0x1b76('0x4b')];_0x1960db['defaultValue']=![];break;default:}return db[_0x1b76('0x44')][_0x1b76('0x4c')][_0x1b76('0x4d')](_0x1b76('0x4e'),util[_0x1b76('0x4f')]('cf_%d',_0x1e86de['id']),_0x1960db);})[_0x1b76('0x1d')](function(){return _0x1e86de;});})[_0x1b76('0x1d')](respondWithResult(_0x28e525,0xc9))[_0x1b76('0x3e')](handleError(_0x28e525,null));}; \ No newline at end of file +var _0x48a0=['merge','filter','options','includeAll','include','rows','catch','show','params','body','find','sequelize','transaction','create','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x4a8038,_0xea336c){var _0x38b091=function(_0x2f6c3f){while(--_0x2f6c3f){_0x4a8038['push'](_0x4a8038['shift']());}};_0x38b091(++_0xea336c);}(_0x48a0,0x110));var _0x048a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x48a0[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x048a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x048a('0x1'));var jsonpatch=require(_0x048a('0x2'));var rp=require(_0x048a('0x3'));var moment=require(_0x048a('0x4'));var BPromise=require(_0x048a('0x5'));var Mustache=require(_0x048a('0x6'));var util=require('util');var path=require(_0x048a('0x7'));var sox=require(_0x048a('0x8'));var csv=require(_0x048a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x048a('0xa'));var squel=require(_0x048a('0xb'));var crypto=require(_0x048a('0xc'));var jsforce=require(_0x048a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x048a('0x9'));var querystring=require(_0x048a('0xe'));var Papa=require(_0x048a('0xf'));var Redis=require(_0x048a('0x10'));var authService=require(_0x048a('0x11'));var qs=require(_0x048a('0x12'));var as=require(_0x048a('0x13'));var hardwareService=require(_0x048a('0x14'));var logger=require(_0x048a('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x048a('0x16'));var db=require(_0x048a('0x17'))['db'];function respondWithStatusCode(_0x5ee7eb,_0x16fe7f){_0x16fe7f=_0x16fe7f||0xcc;return function(_0x88e6aa){if(_0x88e6aa){return _0x5ee7eb[_0x048a('0x18')](_0x16fe7f);}return _0x5ee7eb[_0x048a('0x19')](_0x16fe7f)[_0x048a('0x1a')]();};}function respondWithResult(_0x5974cf,_0x453f29){_0x453f29=_0x453f29||0xc8;return function(_0xf27a5f){if(_0xf27a5f){return _0x5974cf[_0x048a('0x19')](_0x453f29)[_0x048a('0x1b')](_0xf27a5f);}};}function respondWithFilteredResult(_0xc65f3d,_0x3604a6){return function(_0x3602e0){if(_0x3602e0){var _0x1085c3=typeof _0x3604a6[_0x048a('0x1c')]===_0x048a('0x1d')&&typeof _0x3604a6[_0x048a('0x1e')]===_0x048a('0x1d');var _0x33c988=_0x3602e0['count'];var _0x45caf7=_0x1085c3?0x0:_0x3604a6[_0x048a('0x1c')];var _0x3dbec3=_0x1085c3?_0x3602e0[_0x048a('0x1f')]:_0x3604a6[_0x048a('0x1c')]+_0x3604a6[_0x048a('0x1e')];var _0x29c610;if(_0x3dbec3>=_0x33c988){_0x3dbec3=_0x33c988;_0x29c610=0xc8;}else{_0x29c610=0xce;}_0xc65f3d[_0x048a('0x19')](_0x29c610);return _0xc65f3d['set']('Content-Range',_0x45caf7+'-'+_0x3dbec3+'/'+_0x33c988)[_0x048a('0x1b')](_0x3602e0);}return null;};}function patchUpdates(_0x169442){return function(_0xb72b84){try{jsonpatch[_0x048a('0x20')](_0xb72b84,_0x169442,!![]);}catch(_0x507e9f){return BPromise['reject'](_0x507e9f);}return _0xb72b84[_0x048a('0x21')]();};}function saveUpdates(_0x2ef30b,_0x4b4676){return function(_0x33f4c3){if(_0x33f4c3){return _0x33f4c3[_0x048a('0x22')](_0x2ef30b)[_0x048a('0x23')](function(_0x126219){return _0x126219;});}return null;};}function removeEntity(_0x4e20f3,_0x278aa7){return function(_0x4268e3){if(_0x4268e3){return _0x4268e3['destroy']()[_0x048a('0x23')](function(){_0x4e20f3[_0x048a('0x19')](0xcc)[_0x048a('0x1a')]();});}};}function handleEntityNotFound(_0x38c887,_0x19295d){return function(_0xa6d2da){if(!_0xa6d2da){_0x38c887['sendStatus'](0x194);}return _0xa6d2da;};}function handleError(_0x43141c,_0x109c6b){_0x109c6b=_0x109c6b||0x1f4;return function(_0x49e199){logger[_0x048a('0x24')](_0x49e199[_0x048a('0x25')]);if(_0x49e199[_0x048a('0x26')]){delete _0x49e199[_0x048a('0x26')];}_0x43141c[_0x048a('0x19')](_0x109c6b)['send'](_0x49e199);};}exports[_0x048a('0x27')]=function(_0x1d0947,_0x142b14){var _0xb2048a={},_0x27e077={},_0x4256be={'count':0x0,'rows':[]};var _0x56908a=_[_0x048a('0x28')](db[_0x048a('0x29')][_0x048a('0x2a')],function(_0x5c089f){return{'name':_0x5c089f[_0x048a('0x2b')],'type':_0x5c089f[_0x048a('0x2c')][_0x048a('0x2d')]};});_0x27e077['model']=_[_0x048a('0x2e')](_[_0x048a('0x28')](_0x56908a,_0x048a('0x26')),['name']);_0x27e077['query']=_[_0x048a('0x2f')](_0x1d0947[_0x048a('0x30')]);_0x27e077[_0x048a('0x31')]=_[_0x048a('0x32')](_0x27e077[_0x048a('0x33')],_0x27e077[_0x048a('0x30')]);_0xb2048a[_0x048a('0x34')]=_[_0x048a('0x32')](_0x27e077[_0x048a('0x33')],qs[_0x048a('0x35')](_0x1d0947['query'][_0x048a('0x35')]));_0xb2048a['attributes']=_0xb2048a[_0x048a('0x34')][_0x048a('0x36')]?_0xb2048a['attributes']:_0x27e077['model'];if(!_0x1d0947[_0x048a('0x30')]['hasOwnProperty'](_0x048a('0x37'))){_0xb2048a[_0x048a('0x1e')]=qs[_0x048a('0x1e')](_0x1d0947[_0x048a('0x30')][_0x048a('0x1e')]);_0xb2048a['offset']=qs[_0x048a('0x1c')](_0x1d0947[_0x048a('0x30')][_0x048a('0x1c')]);}_0xb2048a[_0x048a('0x38')]=qs[_0x048a('0x39')](_0x1d0947[_0x048a('0x30')][_0x048a('0x39')]);_0xb2048a[_0x048a('0x3a')]=qs[_0x048a('0x31')](_[_0x048a('0x3b')](_0x1d0947[_0x048a('0x30')],_0x27e077['filters']),_0x56908a);if(_0x1d0947[_0x048a('0x30')]['filter']){_0xb2048a[_0x048a('0x3a')]=_[_0x048a('0x3c')](_0xb2048a[_0x048a('0x3a')],{'$or':_[_0x048a('0x28')](_0x56908a,function(_0x4ef854){if(_0x4ef854[_0x048a('0x2c')]!=='VIRTUAL'){var _0x5c22d3={};_0x5c22d3[_0x4ef854[_0x048a('0x26')]]={'$like':'%'+_0x1d0947[_0x048a('0x30')][_0x048a('0x3d')]+'%'};return _0x5c22d3;}})});}_0xb2048a=_['merge']({},_0xb2048a,_0x1d0947[_0x048a('0x3e')]);var _0x3160fb={'where':_0xb2048a[_0x048a('0x3a')]};return db['CmCustomField'][_0x048a('0x1f')](_0x3160fb)[_0x048a('0x23')](function(_0x577c1b){_0x4256be['count']=_0x577c1b;if(_0x1d0947['query'][_0x048a('0x3f')]){_0xb2048a[_0x048a('0x40')]=[{'all':!![]}];}return db[_0x048a('0x29')]['findAll'](_0xb2048a);})[_0x048a('0x23')](function(_0x376a33){_0x4256be[_0x048a('0x41')]=_0x376a33;return _0x4256be;})[_0x048a('0x23')](respondWithFilteredResult(_0x142b14,_0xb2048a))[_0x048a('0x42')](handleError(_0x142b14,null));};exports[_0x048a('0x43')]=function(_0x331dbf,_0x5e4714){var _0x4fa888={'raw':!![],'where':{'id':_0x331dbf[_0x048a('0x44')]['id']}},_0x271583={};_0x271583['model']=_[_0x048a('0x2f')](db[_0x048a('0x29')][_0x048a('0x2a')]);_0x271583[_0x048a('0x30')]=_['keys'](_0x331dbf[_0x048a('0x30')]);_0x271583[_0x048a('0x31')]=_[_0x048a('0x32')](_0x271583[_0x048a('0x33')],_0x271583['query']);_0x4fa888[_0x048a('0x34')]=_['intersection'](_0x271583[_0x048a('0x33')],qs[_0x048a('0x35')](_0x331dbf[_0x048a('0x30')][_0x048a('0x35')]));_0x4fa888[_0x048a('0x34')]=_0x4fa888[_0x048a('0x34')][_0x048a('0x36')]?_0x4fa888[_0x048a('0x34')]:_0x271583[_0x048a('0x33')];if(_0x331dbf[_0x048a('0x30')][_0x048a('0x3f')]){_0x4fa888[_0x048a('0x40')]=[{'all':!![]}];}_0x4fa888=_[_0x048a('0x3c')]({},_0x4fa888,_0x331dbf[_0x048a('0x3e')]);return db[_0x048a('0x29')]['find'](_0x4fa888)[_0x048a('0x23')](handleEntityNotFound(_0x5e4714,null))[_0x048a('0x23')](respondWithResult(_0x5e4714,null))[_0x048a('0x42')](handleError(_0x5e4714,null));};exports[_0x048a('0x22')]=function(_0x242006,_0x270866){if(_0x242006[_0x048a('0x45')]['id']){delete _0x242006[_0x048a('0x45')]['id'];}return db[_0x048a('0x29')][_0x048a('0x46')]({'where':{'id':_0x242006[_0x048a('0x44')]['id']}})[_0x048a('0x23')](handleEntityNotFound(_0x270866,null))[_0x048a('0x23')](saveUpdates(_0x242006[_0x048a('0x45')],null))[_0x048a('0x23')](respondWithResult(_0x270866,null))['catch'](handleError(_0x270866,null));};exports['destroy']=function(_0x2128d5,_0x2c415f){return db[_0x048a('0x29')][_0x048a('0x46')]({'where':{'id':_0x2128d5[_0x048a('0x44')]['id']}})[_0x048a('0x23')](handleEntityNotFound(_0x2c415f,null))[_0x048a('0x23')](removeEntity(_0x2c415f,null))['catch'](handleError(_0x2c415f,null));};exports['create']=function(_0x140d13,_0x1c8d69){var _0x3f5159;return db[_0x048a('0x47')][_0x048a('0x48')](function(_0x52e712){return db['CmCustomField'][_0x048a('0x49')](_0x140d13[_0x048a('0x45')],{'transaction':_0x52e712})[_0x048a('0x23')](function(_0x4c7d31){_0x3f5159=_0x4c7d31;var _0x33e3c1={'type':db['Sequelize']['TEXT'],'transaction':_0x52e712};switch(_0x140d13[_0x048a('0x45')][_0x048a('0x2c')]){case'text':_0x33e3c1[_0x048a('0x2c')]=db[_0x048a('0x4a')][_0x048a('0x4b')];break;case _0x048a('0x4c'):_0x33e3c1['type']=db[_0x048a('0x4a')]['INTEGER'];break;case _0x048a('0x4d'):_0x33e3c1[_0x048a('0x2c')]=db[_0x048a('0x4a')][_0x048a('0x4e')];_0x33e3c1[_0x048a('0x4f')]=![];break;default:}return db[_0x048a('0x47')][_0x048a('0x50')]['addColumn'](_0x048a('0x51'),util['format'](_0x048a('0x52'),_0x3f5159['id']),_0x33e3c1);})[_0x048a('0x23')](function(){return _0x3f5159;});})[_0x048a('0x23')](respondWithResult(_0x1c8d69,0xc9))['catch'](handleError(_0x1c8d69,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fd16566..4afed68 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 _0x0087=['bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','api','moment'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0x0087,0x1d7));var _0x7008=function(_0x345a17,_0x3b9d2a){_0x345a17=_0x345a17-0x0;var _0xd0f947=_0x0087[_0x345a17];return _0xd0f947;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7008('0x0'));var moment=require(_0x7008('0x1'));var BPromise=require(_0x7008('0x2'));var rp=require(_0x7008('0x3'));var fs=require('fs');var path=require(_0x7008('0x4'));var rimraf=require(_0x7008('0x5'));var config=require('../../config/environment');var attributes=require(_0x7008('0x6'));module[_0x7008('0x7')]=function(_0x4db77a,_0x455dd5){return _0x4db77a[_0x7008('0x8')](_0x7008('0x9'),attributes,{'tableName':_0x7008('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf901=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x1f5e4a,_0x16111e){var _0x380da7=function(_0x49dbbb){while(--_0x49dbbb){_0x1f5e4a['push'](_0x1f5e4a['shift']());}};_0x380da7(++_0x16111e);}(_0xf901,0x6d));var _0x1f90=function(_0x216dc9,_0x52934b){_0x216dc9=_0x216dc9-0x0;var _0x193a4=_0xf901[_0x216dc9];return _0x193a4;};'use strict';var _=require(_0x1f90('0x0'));var util=require(_0x1f90('0x1'));var logger=require(_0x1f90('0x2'))(_0x1f90('0x3'));var moment=require(_0x1f90('0x4'));var BPromise=require(_0x1f90('0x5'));var rp=require(_0x1f90('0x6'));var fs=require('fs');var path=require(_0x1f90('0x7'));var rimraf=require(_0x1f90('0x8'));var config=require(_0x1f90('0x9'));var attributes=require('./cmCustomField.attributes');module[_0x1f90('0xa')]=function(_0x264788,_0x203f24){return _0x264788[_0x1f90('0xb')](_0x1f90('0xc'),attributes,{'tableName':_0x1f90('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 6585a87..1198191 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 _0xc682=['../../config/environment','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a1e7e,_0xda6073){var _0x598d33=function(_0x3c7f4c){while(--_0x3c7f4c){_0x4a1e7e['push'](_0x4a1e7e['shift']());}};_0x598d33(++_0xda6073);}(_0xc682,0x9c));var _0x2c68=function(_0x1f4621,_0x5a67fc){_0x1f4621=_0x1f4621-0x0;var _0x160177=_0xc682[_0x1f4621];return _0x160177;};'use strict';var _=require(_0x2c68('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c68('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c68('0x2'));var db=require(_0x2c68('0x3'))['db'];var utils=require(_0x2c68('0x4'));var logger=require(_0x2c68('0x5'))('rpc');var config=require(_0x2c68('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53e12c,_0x312bb0,_0x50c120){return new BPromise(function(_0xa68fe6,_0x4abcee){return client[_0x2c68('0x7')](_0x53e12c,_0x50c120)[_0x2c68('0x8')](function(_0x360b5f){logger[_0x2c68('0x9')](_0x2c68('0xa'),_0x312bb0,_0x2c68('0xb'));logger['debug'](_0x2c68('0xc'),_0x312bb0,_0x2c68('0xb'),JSON[_0x2c68('0xd')](_0x360b5f));if(_0x360b5f[_0x2c68('0xe')]){if(_0x360b5f[_0x2c68('0xe')][_0x2c68('0xf')]===0x1f4){logger[_0x2c68('0xe')](_0x2c68('0xa'),_0x312bb0,_0x360b5f[_0x2c68('0xe')][_0x2c68('0x10')]);return _0x4abcee(_0x360b5f[_0x2c68('0xe')][_0x2c68('0x10')]);}logger[_0x2c68('0xe')](_0x2c68('0xa'),_0x312bb0,_0x360b5f[_0x2c68('0xe')][_0x2c68('0x10')]);return _0xa68fe6(_0x360b5f[_0x2c68('0xe')][_0x2c68('0x10')]);}else{logger[_0x2c68('0x9')](_0x2c68('0xa'),_0x312bb0,_0x2c68('0xb'));_0xa68fe6(_0x360b5f['result']['message']);}})[_0x2c68('0x11')](function(_0x42833b){logger[_0x2c68('0xe')]('CmCustomField,\x20%s,\x20%s',_0x312bb0,_0x42833b);_0x4abcee(_0x42833b);});});} \ No newline at end of file +var _0x8212=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','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','bluebird','randomstring','ioredis'];(function(_0x59f5a6,_0x22e5fe){var _0x824ffa=function(_0x283d79){while(--_0x283d79){_0x59f5a6['push'](_0x59f5a6['shift']());}};_0x824ffa(++_0x22e5fe);}(_0x8212,0x1d5));var _0x2821=function(_0x20494e,_0x274e71){_0x20494e=_0x20494e-0x0;var _0x28f4ae=_0x8212[_0x20494e];return _0x28f4ae;};'use strict';var _=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var moment=require(_0x2821('0x2'));var BPromise=require(_0x2821('0x3'));var rs=require(_0x2821('0x4'));var fs=require('fs');var Redis=require(_0x2821('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2821('0x6'));var logger=require(_0x2821('0x7'))(_0x2821('0x8'));var config=require('../../config/environment');var jayson=require(_0x2821('0x9'));var client=jayson[_0x2821('0xa')][_0x2821('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8aa326,_0x149bd4,_0x5e3bd9){return new BPromise(function(_0x78da19,_0x5c9dd8){return client[_0x2821('0xc')](_0x8aa326,_0x5e3bd9)[_0x2821('0xd')](function(_0x3b8bfa){logger['info'](_0x2821('0xe'),_0x149bd4,_0x2821('0xf'));logger[_0x2821('0x10')](_0x2821('0x11'),_0x149bd4,_0x2821('0xf'),JSON[_0x2821('0x12')](_0x3b8bfa));if(_0x3b8bfa[_0x2821('0x13')]){if(_0x3b8bfa[_0x2821('0x13')][_0x2821('0x14')]===0x1f4){logger[_0x2821('0x13')](_0x2821('0xe'),_0x149bd4,_0x3b8bfa['error'][_0x2821('0x15')]);return _0x5c9dd8(_0x3b8bfa[_0x2821('0x13')]['message']);}logger[_0x2821('0x13')](_0x2821('0xe'),_0x149bd4,_0x3b8bfa['error']['message']);return _0x78da19(_0x3b8bfa[_0x2821('0x13')][_0x2821('0x15')]);}else{logger[_0x2821('0x16')](_0x2821('0xe'),_0x149bd4,_0x2821('0xf'));_0x78da19(_0x3b8bfa[_0x2821('0x17')][_0x2821('0x15')]);}})[_0x2821('0x18')](function(_0x187ae7){logger['error'](_0x2821('0xe'),_0x149bd4,_0x187ae7);_0x5c9dd8(_0x187ae7);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ded52de..cb3a37b 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 _0x6f7b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','/:id','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f7b,0x168));var _0xb6f7=function(_0x49f400,_0x49210f){_0x49f400=_0x49f400-0x0;var _0xc84ff0=_0x6f7b[_0x49f400];return _0xc84ff0;};'use strict';var multer=require('multer');var util=require(_0xb6f7('0x0'));var path=require(_0xb6f7('0x1'));var timeout=require(_0xb6f7('0x2'));var express=require(_0xb6f7('0x3'));var router=express[_0xb6f7('0x4')]();var fs_extra=require(_0xb6f7('0x5'));var auth=require(_0xb6f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb6f7('0x7'));var controller=require('./cmCustomField.controller');router[_0xb6f7('0x8')]('/',auth[_0xb6f7('0x9')](),controller[_0xb6f7('0xa')]);router[_0xb6f7('0x8')]('/:id',auth[_0xb6f7('0x9')](),controller[_0xb6f7('0xb')]);router[_0xb6f7('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb6f7('0xd'),auth[_0xb6f7('0x9')](),controller[_0xb6f7('0xe')]);router[_0xb6f7('0xf')](_0xb6f7('0xd'),auth[_0xb6f7('0x9')](),controller[_0xb6f7('0x10')]);module[_0xb6f7('0x11')]=router; \ No newline at end of file +var _0x1e92=['./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e92,0x1df));var _0x21e9=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x1e92[_0x5a79e2];return _0x266c45;};'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')]('/',auth[_0x21e9('0x9')](),controller[_0x21e9('0xa')]);router[_0x21e9('0x8')](_0x21e9('0xb'),auth[_0x21e9('0x9')](),controller['show']);router[_0x21e9('0xc')]('/',auth[_0x21e9('0x9')](),controller[_0x21e9('0xd')]);router[_0x21e9('0xe')]('/:id',auth[_0x21e9('0x9')](),controller['update']);router[_0x21e9('0xf')](_0x21e9('0xb'),auth[_0x21e9('0x9')](),controller[_0x21e9('0x10')]);module[_0x21e9('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 183ba06..eb80494 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 _0x2542=['contactListQueue','moment','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x2542,0x169));var _0x2254=function(_0x41a037,_0x4274d4){_0x41a037=_0x41a037-0x0;var _0x5a274e=_0x2542[_0x41a037];return _0x5a274e;};'use strict';var moment=require(_0x2254('0x0'));var Sequelize=require(_0x2254('0x1'));module[_0x2254('0x2')]={'phone':{'type':Sequelize[_0x2254('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2254('0x4')],'defaultValue':moment()['format'](_0x2254('0x5'))},'countbusyretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2254('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2254('0x4')]},'priority':{'type':Sequelize[_0x2254('0x6')](0x2)[_0x2254('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x2254('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'ListId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'UserId':{'type':Sequelize[_0x2254('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x2254('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x6343=['UNSIGNED','contactListQueue','DATE','exports','STRING','INTEGER','BOOLEAN'];(function(_0x1b8aff,_0x5bd38d){var _0x503165=function(_0x3fdb61){while(--_0x3fdb61){_0x1b8aff['push'](_0x1b8aff['shift']());}};_0x503165(++_0x5bd38d);}(_0x6343,0x168));var _0x3634=function(_0xea44ef,_0x4c0494){_0xea44ef=_0xea44ef-0x0;var _0x233423=_0x6343[_0xea44ef];return _0x233423;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3634('0x0')]={'phone':{'type':Sequelize[_0x3634('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x3634('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3634('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3634('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3634('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x3634('0x2')](0x2)[_0x3634('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x3634('0x5')},'ListId':{'type':Sequelize[_0x3634('0x2')],'unique':_0x3634('0x5')},'UserId':{'type':Sequelize[_0x3634('0x2')]},'VoiceQueueId':{'type':Sequelize[_0x3634('0x2')],'unique':_0x3634('0x5')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3634('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3634('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3634('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3634('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3634('0x6')],'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 fb8577f..6c744a4 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 _0xfba1=['ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$between','$notBetween','$in','$like','$notLike','$notILike','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','count','includeAll','include','findAll','catch','create','body','find','params','describe','destroy','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','VoiceQueueId','queue','ivr','CmContact','ContactId','calleridname','firstName','isNil','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','dialActive','preview','hopperId','recallme','CmList','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x587981,_0x1ce02c){var _0x1b4572=function(_0x71204f){while(--_0x71204f){_0x587981['push'](_0x587981['shift']());}};_0x1b4572(++_0x1ce02c);}(_0xfba1,0x132));var _0x1fba=function(_0x1df1a6,_0x3846d5){_0x1df1a6=_0x1df1a6-0x0;var _0x19847f=_0xfba1[_0x1df1a6];return _0x19847f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fba('0x0'));var zipdir=require(_0x1fba('0x1'));var jsonpatch=require(_0x1fba('0x2'));var rp=require('request-promise');var moment=require(_0x1fba('0x3'));var BPromise=require(_0x1fba('0x4'));var Mustache=require(_0x1fba('0x5'));var util=require(_0x1fba('0x6'));var path=require(_0x1fba('0x7'));var sox=require(_0x1fba('0x8'));var csv=require(_0x1fba('0x9'));var ejs=require(_0x1fba('0xa'));var fs=require('fs');var fs_extra=require(_0x1fba('0xb'));var _=require(_0x1fba('0xc'));var squel=require('squel');var crypto=require(_0x1fba('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1fba('0xe'));var toCsv=require(_0x1fba('0x9'));var querystring=require(_0x1fba('0xf'));var Papa=require(_0x1fba('0x10'));var Redis=require(_0x1fba('0x11'));var authService=require(_0x1fba('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fba('0x13'));var logger=require(_0x1fba('0x14'))(_0x1fba('0x15'));var utils=require(_0x1fba('0x16'));var config=require(_0x1fba('0x17'));var shared=require(_0x1fba('0x17'));var licenseUtil=require(_0x1fba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c0c50,_0x4556ee){_0x4556ee=_0x4556ee||0xcc;return function(_0x3c718b){if(_0x3c718b){return _0x5c0c50[_0x1fba('0x19')](_0x4556ee);}return _0x5c0c50[_0x1fba('0x1a')](_0x4556ee)[_0x1fba('0x1b')]();};}function respondWithResult(_0x16d956,_0x3cc61d){_0x3cc61d=_0x3cc61d||0xc8;return function(_0xbce064){if(_0xbce064){return _0x16d956[_0x1fba('0x1a')](_0x3cc61d)[_0x1fba('0x1c')](_0xbce064);}};}function respondWithFilteredResult(_0x255055,_0x91c3e6){return function(_0x305460){if(_0x305460){var _0xdbbb9c=typeof _0x91c3e6[_0x1fba('0x1d')]===_0x1fba('0x1e')&&typeof _0x91c3e6['limit']==='undefined';var _0x2af978=_0x305460['count'];var _0x5ef4ca=_0xdbbb9c?0x0:_0x91c3e6[_0x1fba('0x1d')];var _0x117cf5=_0xdbbb9c?_0x305460['count']:_0x91c3e6['offset']+_0x91c3e6[_0x1fba('0x1f')];var _0x556179;if(_0x117cf5>=_0x2af978){_0x117cf5=_0x2af978;_0x556179=0xc8;}else{_0x556179=0xce;}_0x255055[_0x1fba('0x1a')](_0x556179);return _0x255055[_0x1fba('0x20')](_0x1fba('0x21'),_0x5ef4ca+'-'+_0x117cf5+'/'+_0x2af978)['json'](_0x305460);}return null;};}function patchUpdates(_0x217d0f){return function(_0x2390a7){try{jsonpatch[_0x1fba('0x22')](_0x2390a7,_0x217d0f,!![]);}catch(_0x57332b){return BPromise[_0x1fba('0x23')](_0x57332b);}return _0x2390a7[_0x1fba('0x24')]();};}function saveUpdates(_0x5d72ac,_0x3b2bb2){return function(_0x2ba0b2){if(_0x2ba0b2){return _0x2ba0b2[_0x1fba('0x25')](_0x5d72ac)[_0x1fba('0x26')](function(_0x343d0b){return _0x343d0b;});}return null;};}function removeEntity(_0x144054,_0x3ed5a9){return function(_0x164bff){if(_0x164bff){return _0x164bff['destroy']()['then'](function(){_0x144054['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x543f57,_0x1e166b){return function(_0x1b8ae6){if(!_0x1b8ae6){_0x543f57[_0x1fba('0x19')](0x194);}return _0x1b8ae6;};}function handleError(_0x16c1e8,_0x2e1949){_0x2e1949=_0x2e1949||0x1f4;return function(_0x698dd5){logger[_0x1fba('0x27')](_0x698dd5[_0x1fba('0x28')]);if(_0x698dd5[_0x1fba('0x29')]){delete _0x698dd5[_0x1fba('0x29')];}_0x16c1e8[_0x1fba('0x1a')](_0x2e1949)['send'](_0x698dd5);};}exports[_0x1fba('0x2a')]=function(_0x45c929,_0x3803ee){var _0x4cc477={},_0x5940cc={},_0x197301={'count':0x0,'rows':[]};var _0x309213=_[_0x1fba('0x2b')](db[_0x1fba('0x2c')][_0x1fba('0x2d')],function(_0x368e6b){return{'name':_0x368e6b[_0x1fba('0x2e')],'type':_0x368e6b['type'][_0x1fba('0x2f')]};});_0x5940cc[_0x1fba('0x30')]=_['map'](_0x309213,'name');_0x5940cc[_0x1fba('0x31')]=_[_0x1fba('0x32')](_0x45c929[_0x1fba('0x31')]);_0x5940cc[_0x1fba('0x33')]=_[_0x1fba('0x34')](_0x5940cc[_0x1fba('0x30')],_0x5940cc[_0x1fba('0x31')]);_0x5940cc[_0x1fba('0x33')]=_[_0x1fba('0x35')](_0x5940cc[_0x1fba('0x33')],[_0x1fba('0x36'),'$or',_0x1fba('0x37'),_0x1fba('0x38'),_0x1fba('0x39'),_0x1fba('0x3a'),_0x1fba('0x3b'),'$eq','$not',_0x1fba('0x3c'),_0x1fba('0x3d'),_0x1fba('0x3e'),'$notIn',_0x1fba('0x3f'),_0x1fba('0x40'),'$iLike',_0x1fba('0x41'),'$like','$overlap','$contains',_0x1fba('0x42'),_0x1fba('0x43')]);_0x4cc477[_0x1fba('0x44')]=_[_0x1fba('0x34')](_0x5940cc[_0x1fba('0x30')],qs['fields'](_0x45c929['query'][_0x1fba('0x45')]));_0x4cc477[_0x1fba('0x44')]=_0x4cc477[_0x1fba('0x44')][_0x1fba('0x46')]?_0x4cc477[_0x1fba('0x44')]:_0x5940cc['model'];if(!_0x45c929['query'][_0x1fba('0x47')](_0x1fba('0x48'))){_0x4cc477[_0x1fba('0x1f')]=qs[_0x1fba('0x1f')](_0x45c929[_0x1fba('0x31')][_0x1fba('0x1f')]);_0x4cc477[_0x1fba('0x1d')]=qs[_0x1fba('0x1d')](_0x45c929[_0x1fba('0x31')]['offset']);}_0x4cc477[_0x1fba('0x49')]=qs[_0x1fba('0x4a')](_0x45c929[_0x1fba('0x31')]['sort']);_0x4cc477['where']=qs[_0x1fba('0x33')](_[_0x1fba('0x4b')](_0x45c929[_0x1fba('0x31')],_0x5940cc[_0x1fba('0x33')]),_0x309213);if(_0x45c929[_0x1fba('0x31')]['filter']){_0x4cc477[_0x1fba('0x4c')]=_[_0x1fba('0x4d')](_0x4cc477[_0x1fba('0x4c')],{'$or':_['map'](_0x309213,function(_0x3763d2){if(_0x3763d2[_0x1fba('0x4e')]!=='VIRTUAL'){var _0x45f09c={};_0x45f09c[_0x3763d2[_0x1fba('0x29')]]={'$like':'%'+_0x45c929['query'][_0x1fba('0x4f')]+'%'};return _0x45f09c;}})});}_0x4cc477=_[_0x1fba('0x4d')]({},_0x4cc477,_0x45c929[_0x1fba('0x50')]);var _0x4f8976={'where':_0x4cc477['where']};return db[_0x1fba('0x2c')]['count'](_0x4f8976)[_0x1fba('0x26')](function(_0x5d5275){_0x197301[_0x1fba('0x51')]=_0x5d5275;if(_0x45c929[_0x1fba('0x31')][_0x1fba('0x52')]){_0x4cc477[_0x1fba('0x53')]=[{'all':!![]}];}return db[_0x1fba('0x2c')][_0x1fba('0x54')](_0x4cc477);})[_0x1fba('0x26')](function(_0xbc25c8){_0x197301['rows']=_0xbc25c8;return _0x197301;})[_0x1fba('0x26')](respondWithFilteredResult(_0x3803ee,_0x4cc477))[_0x1fba('0x55')](handleError(_0x3803ee,null));};exports['show']=function(_0x3f7179,_0x3213ae){var _0x2e8692={'raw':!![],'where':{'id':_0x3f7179['params']['id']}},_0x8d7343={};_0x8d7343[_0x1fba('0x30')]=_['keys'](db[_0x1fba('0x2c')]['rawAttributes']);_0x8d7343[_0x1fba('0x31')]=_[_0x1fba('0x32')](_0x3f7179[_0x1fba('0x31')]);_0x8d7343['filters']=_[_0x1fba('0x34')](_0x8d7343[_0x1fba('0x30')],_0x8d7343[_0x1fba('0x31')]);_0x2e8692[_0x1fba('0x44')]=_[_0x1fba('0x34')](_0x8d7343[_0x1fba('0x30')],qs[_0x1fba('0x45')](_0x3f7179['query'][_0x1fba('0x45')]));_0x2e8692[_0x1fba('0x44')]=_0x2e8692[_0x1fba('0x44')][_0x1fba('0x46')]?_0x2e8692[_0x1fba('0x44')]:_0x8d7343[_0x1fba('0x30')];if(_0x3f7179[_0x1fba('0x31')][_0x1fba('0x52')]){_0x2e8692[_0x1fba('0x53')]=[{'all':!![]}];}_0x2e8692=_[_0x1fba('0x4d')]({},_0x2e8692,_0x3f7179['options']);return db[_0x1fba('0x2c')]['find'](_0x2e8692)[_0x1fba('0x26')](handleEntityNotFound(_0x3213ae,null))['then'](respondWithResult(_0x3213ae,null))[_0x1fba('0x55')](handleError(_0x3213ae,null));};exports[_0x1fba('0x56')]=function(_0x7bf511,_0x4d2a0e){return db[_0x1fba('0x2c')][_0x1fba('0x56')](_0x7bf511[_0x1fba('0x57')],{})[_0x1fba('0x26')](respondWithResult(_0x4d2a0e,0xc9))[_0x1fba('0x55')](handleError(_0x4d2a0e,null));};exports[_0x1fba('0x25')]=function(_0x5a4d7e,_0x3b2fa5){if(_0x5a4d7e[_0x1fba('0x57')]['id']){delete _0x5a4d7e[_0x1fba('0x57')]['id'];}return db['CmHopper'][_0x1fba('0x58')]({'where':{'id':_0x5a4d7e[_0x1fba('0x59')]['id']}})['then'](handleEntityNotFound(_0x3b2fa5,null))[_0x1fba('0x26')](saveUpdates(_0x5a4d7e['body'],null))[_0x1fba('0x26')](respondWithResult(_0x3b2fa5,null))['catch'](handleError(_0x3b2fa5,null));};exports[_0x1fba('0x5a')]=function(_0xb3ccdf,_0x591222){return db['CmHopper'][_0x1fba('0x5a')]()[_0x1fba('0x26')](respondWithResult(_0x591222,null))[_0x1fba('0x55')](handleError(_0x591222,null));};exports[_0x1fba('0x5b')]=function(_0x3dca34,_0xf72e62){var _0x1f6239;return db[_0x1fba('0x2c')][_0x1fba('0x58')]({'where':{'id':_0x3dca34[_0x1fba('0x59')]['id']}})['then'](handleEntityNotFound(_0xf72e62,null))[_0x1fba('0x26')](function(_0x3d0772){if(_0x3d0772){return _0x3d0772[_0x1fba('0x5b')]()[_0x1fba('0x26')](function(_0x1c968f){return _0x1c968f;});}})[_0x1fba('0x26')](function(_0x775753){_0x1f6239=_0x775753;if(_0x775753){if(_0x775753['VoiceQueueId']||_0x775753[_0x1fba('0x5c')]){return db[_0x775753['VoiceQueueId']?_0x1fba('0x5d'):_0x1fba('0x5e')][_0x1fba('0x58')]({'where':{'id':_0x775753['VoiceQueueId']?_0x775753['VoiceQueueId']:_0x775753[_0x1fba('0x5c')]},'attributes':['id',_0x1fba('0x29')],'raw':!![]});}}})[_0x1fba('0x26')](function(_0x5f4393){var _0x1a73bf={};if(_0x5f4393){_['merge'](_0x1a73bf,_[_0x1fba('0x5f')](_0x1f6239[_0x1fba('0x60')],[_0x1fba('0x61'),_0x1fba('0x62'),'id']));_0x1a73bf[_0x1fba('0x63')]=0x15;_0x1a73bf[_0x1fba('0x64')]=_0x1fba('0x65');_0x1a73bf[_0x1fba('0x66')]=_0x5f4393['name'];_0x1a73bf[_0x1fba('0x67')]=_0x3dca34[_0x1fba('0x68')]['name'];_0x1a73bf[_0x1fba('0x69')]=_0x3dca34[_0x1fba('0x68')]['id'];_0x1a73bf[_0x1fba('0x65')]=!![];_0x1a73bf['deletedat']=moment()[_0x1fba('0x6a')](_0x1fba('0x6b'));_0x1a73bf[_0x1fba('0x6c')]=_0x1f6239[_0x1fba('0x6d')];_0x1a73bf[_0x1fba('0x6e')]=_0x1f6239[_0x1fba('0x6f')]?_0x1fba('0x70'):_0x1fba('0x71');return db[_0x1fba('0x72')]['find']({'where':{'id':_0x1a73bf[_0x1fba('0x73')]},'attributes':['firstName','lastName']})['then'](function(_0xf23e2c){if(!_['isNil'](_0xf72e62)&&!_['isNil'](_0xf23e2c['firstName'])){_0x1a73bf[_0x1fba('0x74')]=_0xf23e2c[_0x1fba('0x75')];if(!_[_0x1fba('0x76')](_0xf23e2c[_0x1fba('0x77')])){_0x1a73bf[_0x1fba('0x74')]+='\x20'+_0xf23e2c[_0x1fba('0x77')];}}})[_0x1fba('0x78')](function(){return db[_0x1fba('0x79')][_0x1fba('0x56')](_0x1a73bf);});}})[_0x1fba('0x26')](function(){return _0xf72e62[_0x1fba('0x1a')](0xcc)[_0x1fba('0x1b')]();})['catch'](handleError(_0xf72e62,null));};exports[_0x1fba('0x7a')]=function(_0x5a5e1f,_0x235aec,_0x583d10){var _0x9f4fd9=[];return db['CmContact'][_0x1fba('0x5a')]()[_0x1fba('0x26')](function(_0x53c05e){_0x9f4fd9=_['keys'](_0x53c05e);return _0x5a5e1f[_0x1fba('0x68')][_0x1fba('0x7b')]({'where':{'type':_0x1fba('0x7c'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x1fba('0x7d'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x1fba('0x26')](function(_0x4f884b){if(_0x4f884b&&_0x4f884b[_0x1fba('0x46')]){return db[_0x1fba('0x7e')][_0x1fba('0x7f')](function(_0x21f2bc){var _0x50c1a1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1fba('0x6a')](_0x1fba('0x6b'))},'VoiceQueueId':{'$in':_[_0x1fba('0x2b')](_0x4f884b,'id')},'$or':[{'UserId':null},{'UserId':_0x5a5e1f[_0x1fba('0x68')]['id']}]};var _0x245dc2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4f884b)[_0x1fba('0x4f')]([_0x1fba('0x80'),0x0])['map']('id')[_0x1fba('0x81')]()},'$or':[{'UserId':null},{'UserId':_0x5a5e1f[_0x1fba('0x68')]['id']}]};var _0x524dd1={'$or':[_0x50c1a1,_0x245dc2]};var _0x51b54a=[];if(_0x5a5e1f[_0x1fba('0x57')]['direction']&&_0x5a5e1f[_0x1fba('0x57')][_0x1fba('0x82')]===_0x1fba('0x83')){if(!_[_0x1fba('0x84')](_0x5a5e1f[_0x1fba('0x57')][_0x1fba('0x85')])){_0x524dd1['id']={'$in':_0x5a5e1f[_0x1fba('0x57')][_0x1fba('0x85')]};}_0x51b54a=[['priority',_0x1fba('0x86')],[_0x1fba('0x87'),_0x4f884b[0x0][_0x1fba('0x7d')]==='ASC'?_0x1fba('0x88'):_0x1fba('0x86')],db['sequelize'][_0x1fba('0x89')](_0x1fba('0x8a')),['id',_0x1fba('0x88')]];}else{if(!_[_0x1fba('0x84')](_0x5a5e1f[_0x1fba('0x57')][_0x1fba('0x85')])){_0x524dd1['id']={'$notIn':_0x5a5e1f[_0x1fba('0x57')][_0x1fba('0x85')]};}_0x51b54a=[['priority',_0x1fba('0x88')],[_0x1fba('0x87'),_0x4f884b[0x0][_0x1fba('0x7d')]],db[_0x1fba('0x7e')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x1fba('0x2c')][_0x1fba('0x8b')]({'attributes':['id',_0x1fba('0x8c'),'recallme'],'where':_0x524dd1,'order':_0x51b54a,'transaction':_0x21f2bc,'lock':_0x21f2bc[_0x1fba('0x8d')][_0x1fba('0x8e')],'include':[{'model':db['CmContact'],'as':_0x1fba('0x8f'),'attributes':_0x9f4fd9,'include':[{'model':db[_0x1fba('0x90')],'as':_0x1fba('0x91'),'attributes':['id',_0x1fba('0x29')]}]},{'model':db['CmList'],'as':_0x1fba('0x92'),'attributes':['id',_0x1fba('0x29')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x1fba('0x29'),_0x1fba('0x93')]}]})[_0x1fba('0x26')](function(_0x59bd91){if(_0x59bd91){return _0x59bd91[_0x1fba('0x25')]({'UserId':_0x5a5e1f[_0x1fba('0x68')]['id']},{'transaction':_0x21f2bc});}});});}})[_0x1fba('0x26')](handleEntityNotFound(_0x235aec,null))[_0x1fba('0x26')](respondWithResult(_0x235aec,null))[_0x1fba('0x55')](handleError(_0x235aec,null));};exports['getPreviewRecall']=function(_0x2755ce,_0x17f676,_0x363f83){var _0x397ac2=[];return db[_0x1fba('0x72')]['describe']()['then'](function(_0x1047a8){_0x397ac2=_[_0x1fba('0x32')](_0x1047a8);return _0x2755ce['user'][_0x1fba('0x7b')]({'where':{'type':_0x1fba('0x7c'),'dialActive':!![],'dialMethod':_0x1fba('0x94')},'attributes':['id',_0x1fba('0x7d'),_0x1fba('0x80')],'raw':!![]});})['then'](function(_0x304f6e){if(_0x304f6e&&_0x304f6e[_0x1fba('0x46')]){return db[_0x1fba('0x7e')][_0x1fba('0x7f')](function(_0x5cfe76){var _0x4c6f3f={'active':![],'recallme':!![],'id':_0x2755ce[_0x1fba('0x57')][_0x1fba('0x95')]};return db[_0x1fba('0x2c')][_0x1fba('0x8b')]({'attributes':['id',_0x1fba('0x8c'),_0x1fba('0x96')],'where':_0x4c6f3f,'transaction':_0x5cfe76,'lock':_0x5cfe76[_0x1fba('0x8d')][_0x1fba('0x8e')],'include':[{'model':db['CmContact'],'as':_0x1fba('0x8f'),'attributes':_0x397ac2,'include':[{'model':db[_0x1fba('0x90')],'as':_0x1fba('0x91'),'attributes':['id','name']}]},{'model':db[_0x1fba('0x97')],'as':'List','attributes':['id',_0x1fba('0x29')]},{'model':db[_0x1fba('0x5d')],'as':'Queue','attributes':['id',_0x1fba('0x29'),_0x1fba('0x93')]}]})[_0x1fba('0x26')](function(_0x115980){if(_0x115980){return _0x115980['update']({'UserId':_0x2755ce['user']['id']},{'transaction':_0x5cfe76});}});});}})[_0x1fba('0x26')](handleEntityNotFound(_0x17f676,null))[_0x1fba('0x26')](respondWithResult(_0x17f676,null))[_0x1fba('0x55')](handleError(_0x17f676,null));};exports[_0x1fba('0x98')]=function(_0x5f0b02,_0x5ed996,_0x14d96a){return _0x5f0b02[_0x1fba('0x68')][_0x1fba('0x7b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x1fba('0x94')},'attributes':['id'],'raw':!![]})[_0x1fba('0x26')](function(_0x51eb6e){if(_0x51eb6e&&_0x51eb6e[_0x1fba('0x46')]){return db[_0x1fba('0x2c')][_0x1fba('0x51')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1fba('0x6a')](_0x1fba('0x6b'))},'VoiceQueueId':{'$in':_[_0x1fba('0x2b')](_0x51eb6e,'id')},'$or':[{'UserId':null},{'UserId':_0x5f0b02[_0x1fba('0x68')]['id']}]}});}return 0x0;})[_0x1fba('0x26')](function(_0x18bad8){if(!_[_0x1fba('0x76')](_0x18bad8)&&_['isNumber'](_0x18bad8)){return _0x5ed996[_0x1fba('0x1a')](0xc8)[_0x1fba('0x1c')]({'contacts':_0x18bad8});}else{logger['error'](_0x1fba('0x99'),_0x1fba('0x98'),0x194,_0x1fba('0x9a'));_0x5ed996[_0x1fba('0x19')](0x194);}})[_0x1fba('0x55')](handleError(_0x5ed996,null));};exports[_0x1fba('0x9b')]=function(_0x5ac042,_0x3beaa8,_0x44edbe){var _0x5ac13e=shared[_0x1fba('0x9c')];var _0x16dc82=[];_[_0x1fba('0x2b')](_0x5ac13e,function(_0x4dc29d){_0x16dc82['push']({'id':_0x4dc29d[_0x1fba('0x29')],'name':_0x4dc29d[_0x1fba('0x29')],'utcOffset':_0x4dc29d[_0x1fba('0x9d')]});});return _0x3beaa8['status'](0xc8)[_0x1fba('0x1c')]({'tz':_0x16dc82});};exports['getTimezone']=function(_0x298821,_0x31a80b,_0x30f059){var _0x462aa9=shared[_0x1fba('0x9c')];var _0x3c8bef={};if(!_[_0x1fba('0x76')](_0x462aa9[_0x298821[_0x1fba('0x57')]['id']]))_0x3c8bef=_0x462aa9[_0x298821[_0x1fba('0x57')]['id']];return _0x31a80b[_0x1fba('0x1a')](0xc8)[_0x1fba('0x1c')](_0x3c8bef);}; \ No newline at end of file +var _0xd0be=['$lt','$lte','$ne','$not','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','body','describe','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','getPreview','outbound','preview','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','Company','List','VoiceQueue','Queue','dialActive','getPreviewRecall','getVoiceQueues','findOne','CmList','getOpenContacts','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','getTimezone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopper','rawAttributes','type','key','query','keys','filters','intersection','model','$and','$or','$gte'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0xd0be,0x1a0));var _0xed0b=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0xd0be[_0x2a6fd5];return _0x43c6a4;};'use strict';var emlformat=require(_0xed0b('0x0'));var rimraf=require(_0xed0b('0x1'));var zipdir=require(_0xed0b('0x2'));var jsonpatch=require(_0xed0b('0x3'));var rp=require(_0xed0b('0x4'));var moment=require(_0xed0b('0x5'));var BPromise=require(_0xed0b('0x6'));var Mustache=require(_0xed0b('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xed0b('0x8'));var ejs=require(_0xed0b('0x9'));var fs=require('fs');var fs_extra=require(_0xed0b('0xa'));var _=require(_0xed0b('0xb'));var squel=require(_0xed0b('0xc'));var crypto=require(_0xed0b('0xd'));var jsforce=require(_0xed0b('0xe'));var deskjs=require(_0xed0b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xed0b('0x10'));var Papa=require('papaparse');var Redis=require(_0xed0b('0x11'));var authService=require(_0xed0b('0x12'));var qs=require(_0xed0b('0x13'));var as=require(_0xed0b('0x14'));var hardwareService=require(_0xed0b('0x15'));var logger=require(_0xed0b('0x16'))(_0xed0b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var shared=require(_0xed0b('0x18'));var licenseUtil=require(_0xed0b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2e10,_0x299574){_0x299574=_0x299574||0xcc;return function(_0x1c01e9){if(_0x1c01e9){return _0x5a2e10[_0xed0b('0x1a')](_0x299574);}return _0x5a2e10[_0xed0b('0x1b')](_0x299574)[_0xed0b('0x1c')]();};}function respondWithResult(_0x5afaac,_0x5a15c9){_0x5a15c9=_0x5a15c9||0xc8;return function(_0x10cb42){if(_0x10cb42){return _0x5afaac[_0xed0b('0x1b')](_0x5a15c9)['json'](_0x10cb42);}};}function respondWithFilteredResult(_0x680c4f,_0x1dcad3){return function(_0x43fcb7){if(_0x43fcb7){var _0xb1363f=typeof _0x1dcad3[_0xed0b('0x1d')]==='undefined'&&typeof _0x1dcad3['limit']===_0xed0b('0x1e');var _0x43ac55=_0x43fcb7[_0xed0b('0x1f')];var _0x3e22d3=_0xb1363f?0x0:_0x1dcad3[_0xed0b('0x1d')];var _0x12600a=_0xb1363f?_0x43fcb7[_0xed0b('0x1f')]:_0x1dcad3['offset']+_0x1dcad3[_0xed0b('0x20')];var _0x2d1b66;if(_0x12600a>=_0x43ac55){_0x12600a=_0x43ac55;_0x2d1b66=0xc8;}else{_0x2d1b66=0xce;}_0x680c4f[_0xed0b('0x1b')](_0x2d1b66);return _0x680c4f[_0xed0b('0x21')](_0xed0b('0x22'),_0x3e22d3+'-'+_0x12600a+'/'+_0x43ac55)['json'](_0x43fcb7);}return null;};}function patchUpdates(_0x2e916d){return function(_0x448a51){try{jsonpatch[_0xed0b('0x23')](_0x448a51,_0x2e916d,!![]);}catch(_0x5c5d58){return BPromise[_0xed0b('0x24')](_0x5c5d58);}return _0x448a51[_0xed0b('0x25')]();};}function saveUpdates(_0xbcc55e,_0x56d8de){return function(_0x5680a9){if(_0x5680a9){return _0x5680a9[_0xed0b('0x26')](_0xbcc55e)[_0xed0b('0x27')](function(_0x3d8424){return _0x3d8424;});}return null;};}function removeEntity(_0x36bc17,_0x29a136){return function(_0x37eb14){if(_0x37eb14){return _0x37eb14[_0xed0b('0x28')]()[_0xed0b('0x27')](function(){_0x36bc17[_0xed0b('0x1b')](0xcc)[_0xed0b('0x1c')]();});}};}function handleEntityNotFound(_0x3d2f6d,_0x2d7d22){return function(_0xf7b9b0){if(!_0xf7b9b0){_0x3d2f6d['sendStatus'](0x194);}return _0xf7b9b0;};}function handleError(_0x5a5584,_0xf4de62){_0xf4de62=_0xf4de62||0x1f4;return function(_0x3658a3){logger[_0xed0b('0x29')](_0x3658a3[_0xed0b('0x2a')]);if(_0x3658a3['name']){delete _0x3658a3[_0xed0b('0x2b')];}_0x5a5584[_0xed0b('0x1b')](_0xf4de62)['send'](_0x3658a3);};}exports[_0xed0b('0x2c')]=function(_0x4ef0f4,_0x1f38c2){var _0x4896c3={},_0x1af195={},_0x4dd14c={'count':0x0,'rows':[]};var _0x51ff63=_[_0xed0b('0x2d')](db[_0xed0b('0x2e')][_0xed0b('0x2f')],function(_0x45ca19){return{'name':_0x45ca19['fieldName'],'type':_0x45ca19[_0xed0b('0x30')][_0xed0b('0x31')]};});_0x1af195['model']=_['map'](_0x51ff63,_0xed0b('0x2b'));_0x1af195[_0xed0b('0x32')]=_[_0xed0b('0x33')](_0x4ef0f4[_0xed0b('0x32')]);_0x1af195[_0xed0b('0x34')]=_[_0xed0b('0x35')](_0x1af195[_0xed0b('0x36')],_0x1af195[_0xed0b('0x32')]);_0x1af195[_0xed0b('0x34')]=_['concat'](_0x1af195[_0xed0b('0x34')],[_0xed0b('0x37'),_0xed0b('0x38'),'$gt',_0xed0b('0x39'),_0xed0b('0x3a'),_0xed0b('0x3b'),_0xed0b('0x3c'),'$eq',_0xed0b('0x3d'),'$between',_0xed0b('0x3e'),_0xed0b('0x3f'),_0xed0b('0x40'),_0xed0b('0x41'),_0xed0b('0x42'),'$iLike',_0xed0b('0x43'),'$like',_0xed0b('0x44'),_0xed0b('0x45'),_0xed0b('0x46'),_0xed0b('0x47')]);_0x4896c3[_0xed0b('0x48')]=_[_0xed0b('0x35')](_0x1af195[_0xed0b('0x36')],qs['fields'](_0x4ef0f4[_0xed0b('0x32')][_0xed0b('0x49')]));_0x4896c3[_0xed0b('0x48')]=_0x4896c3[_0xed0b('0x48')][_0xed0b('0x4a')]?_0x4896c3[_0xed0b('0x48')]:_0x1af195[_0xed0b('0x36')];if(!_0x4ef0f4[_0xed0b('0x32')]['hasOwnProperty'](_0xed0b('0x4b'))){_0x4896c3[_0xed0b('0x20')]=qs[_0xed0b('0x20')](_0x4ef0f4[_0xed0b('0x32')][_0xed0b('0x20')]);_0x4896c3[_0xed0b('0x1d')]=qs[_0xed0b('0x1d')](_0x4ef0f4['query'][_0xed0b('0x1d')]);}_0x4896c3[_0xed0b('0x4c')]=qs[_0xed0b('0x4d')](_0x4ef0f4['query'][_0xed0b('0x4d')]);_0x4896c3[_0xed0b('0x4e')]=qs[_0xed0b('0x34')](_[_0xed0b('0x4f')](_0x4ef0f4[_0xed0b('0x32')],_0x1af195['filters']),_0x51ff63);if(_0x4ef0f4[_0xed0b('0x32')][_0xed0b('0x50')]){_0x4896c3[_0xed0b('0x4e')]=_[_0xed0b('0x51')](_0x4896c3[_0xed0b('0x4e')],{'$or':_[_0xed0b('0x2d')](_0x51ff63,function(_0x312151){if(_0x312151[_0xed0b('0x30')]!==_0xed0b('0x52')){var _0x276e63={};_0x276e63[_0x312151['name']]={'$like':'%'+_0x4ef0f4['query'][_0xed0b('0x50')]+'%'};return _0x276e63;}})});}_0x4896c3=_['merge']({},_0x4896c3,_0x4ef0f4[_0xed0b('0x53')]);var _0x7aa96a={'where':_0x4896c3[_0xed0b('0x4e')]};return db[_0xed0b('0x2e')][_0xed0b('0x1f')](_0x7aa96a)[_0xed0b('0x27')](function(_0x152741){_0x4dd14c[_0xed0b('0x1f')]=_0x152741;if(_0x4ef0f4[_0xed0b('0x32')]['includeAll']){_0x4896c3[_0xed0b('0x54')]=[{'all':!![]}];}return db[_0xed0b('0x2e')]['findAll'](_0x4896c3);})[_0xed0b('0x27')](function(_0x176a74){_0x4dd14c[_0xed0b('0x55')]=_0x176a74;return _0x4dd14c;})[_0xed0b('0x27')](respondWithFilteredResult(_0x1f38c2,_0x4896c3))['catch'](handleError(_0x1f38c2,null));};exports[_0xed0b('0x56')]=function(_0x34156c,_0x455828){var _0x220ce8={'raw':!![],'where':{'id':_0x34156c[_0xed0b('0x57')]['id']}},_0x3ae8cd={};_0x3ae8cd['model']=_[_0xed0b('0x33')](db[_0xed0b('0x2e')][_0xed0b('0x2f')]);_0x3ae8cd[_0xed0b('0x32')]=_['keys'](_0x34156c[_0xed0b('0x32')]);_0x3ae8cd['filters']=_[_0xed0b('0x35')](_0x3ae8cd['model'],_0x3ae8cd['query']);_0x220ce8['attributes']=_[_0xed0b('0x35')](_0x3ae8cd[_0xed0b('0x36')],qs[_0xed0b('0x49')](_0x34156c[_0xed0b('0x32')][_0xed0b('0x49')]));_0x220ce8[_0xed0b('0x48')]=_0x220ce8[_0xed0b('0x48')][_0xed0b('0x4a')]?_0x220ce8[_0xed0b('0x48')]:_0x3ae8cd['model'];if(_0x34156c['query'][_0xed0b('0x58')]){_0x220ce8[_0xed0b('0x54')]=[{'all':!![]}];}_0x220ce8=_[_0xed0b('0x51')]({},_0x220ce8,_0x34156c[_0xed0b('0x53')]);return db[_0xed0b('0x2e')][_0xed0b('0x59')](_0x220ce8)[_0xed0b('0x27')](handleEntityNotFound(_0x455828,null))['then'](respondWithResult(_0x455828,null))[_0xed0b('0x5a')](handleError(_0x455828,null));};exports['create']=function(_0x336235,_0x35cb8e){return db[_0xed0b('0x2e')][_0xed0b('0x5b')](_0x336235[_0xed0b('0x5c')],{})[_0xed0b('0x27')](respondWithResult(_0x35cb8e,0xc9))[_0xed0b('0x5a')](handleError(_0x35cb8e,null));};exports['update']=function(_0xc9376c,_0x2913f9){if(_0xc9376c['body']['id']){delete _0xc9376c[_0xed0b('0x5c')]['id'];}return db[_0xed0b('0x2e')][_0xed0b('0x59')]({'where':{'id':_0xc9376c[_0xed0b('0x57')]['id']}})['then'](handleEntityNotFound(_0x2913f9,null))[_0xed0b('0x27')](saveUpdates(_0xc9376c['body'],null))[_0xed0b('0x27')](respondWithResult(_0x2913f9,null))[_0xed0b('0x5a')](handleError(_0x2913f9,null));};exports['describe']=function(_0x5ed5f7,_0xa36a00){return db[_0xed0b('0x2e')][_0xed0b('0x5d')]()['then'](respondWithResult(_0xa36a00,null))[_0xed0b('0x5a')](handleError(_0xa36a00,null));};exports['destroy']=function(_0x2b0a15,_0x55b6a5){var _0x3267d5;return db[_0xed0b('0x2e')]['find']({'where':{'id':_0x2b0a15[_0xed0b('0x57')]['id']}})[_0xed0b('0x27')](handleEntityNotFound(_0x55b6a5,null))[_0xed0b('0x27')](function(_0x1801e5){if(_0x1801e5){return _0x1801e5[_0xed0b('0x28')]()['then'](function(_0x4e09f4){return _0x4e09f4;});}})['then'](function(_0x393bb2){_0x3267d5=_0x393bb2;if(_0x393bb2){if(_0x393bb2[_0xed0b('0x5e')]||_0x393bb2[_0xed0b('0x5f')]){return db[_0x393bb2[_0xed0b('0x5e')]?'VoiceQueue':_0xed0b('0x60')][_0xed0b('0x59')]({'where':{'id':_0x393bb2[_0xed0b('0x5e')]?_0x393bb2['VoiceQueueId']:_0x393bb2[_0xed0b('0x5f')]},'attributes':['id','name'],'raw':!![]});}}})[_0xed0b('0x27')](function(_0x204c03){var _0x4d1854={};if(_0x204c03){_['merge'](_0x4d1854,_[_0xed0b('0x61')](_0x3267d5[_0xed0b('0x62')],[_0xed0b('0x63'),_0xed0b('0x64'),'id']));_0x4d1854[_0xed0b('0x65')]=0x15;_0x4d1854['statedesc']=_0xed0b('0x66');_0x4d1854[_0xed0b('0x67')]=_0x204c03[_0xed0b('0x2b')];_0x4d1854[_0xed0b('0x68')]=_0x2b0a15[_0xed0b('0x69')][_0xed0b('0x2b')];_0x4d1854[_0xed0b('0x6a')]=_0x2b0a15[_0xed0b('0x69')]['id'];_0x4d1854[_0xed0b('0x66')]=!![];_0x4d1854[_0xed0b('0x6b')]=moment()[_0xed0b('0x6c')](_0xed0b('0x6d'));_0x4d1854[_0xed0b('0x6e')]=_0x3267d5[_0xed0b('0x6f')];_0x4d1854[_0xed0b('0x70')]=_0x3267d5[_0xed0b('0x5e')]?_0xed0b('0x71'):_0xed0b('0x72');return db[_0xed0b('0x73')][_0xed0b('0x59')]({'where':{'id':_0x4d1854['ContactId']},'attributes':['firstName',_0xed0b('0x74')]})[_0xed0b('0x27')](function(_0x50deaa){if(!_[_0xed0b('0x75')](_0x55b6a5)&&!_['isNil'](_0x50deaa[_0xed0b('0x76')])){_0x4d1854[_0xed0b('0x77')]=_0x50deaa['firstName'];if(!_[_0xed0b('0x75')](_0x50deaa[_0xed0b('0x74')])){_0x4d1854[_0xed0b('0x77')]+='\x20'+_0x50deaa[_0xed0b('0x74')];}}})[_0xed0b('0x78')](function(){return db['CmHopperFinal']['create'](_0x4d1854);});}})[_0xed0b('0x27')](function(){return _0x55b6a5['status'](0xcc)['end']();})[_0xed0b('0x5a')](handleError(_0x55b6a5,null));};exports[_0xed0b('0x79')]=function(_0x182d4e,_0x6dc1eb,_0x315d5f){var _0x52599d=[];return db['CmContact'][_0xed0b('0x5d')]()[_0xed0b('0x27')](function(_0x7f43ce){_0x52599d=_[_0xed0b('0x33')](_0x7f43ce);return _0x182d4e[_0xed0b('0x69')]['getVoiceQueues']({'where':{'type':_0xed0b('0x7a'),'dialActive':!![],'dialMethod':_0xed0b('0x7b')},'attributes':['id','dialOrderByScheduledAt',_0xed0b('0x7c')],'raw':!![]});})[_0xed0b('0x27')](function(_0x5ed999){if(_0x5ed999&&_0x5ed999['length']){return db[_0xed0b('0x7d')]['transaction'](function(_0x189c94){var _0x4ffdaa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xed0b('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xed0b('0x2d')](_0x5ed999,'id')},'$or':[{'UserId':null},{'UserId':_0x182d4e['user']['id']}]};var _0x5883b5={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5ed999)[_0xed0b('0x50')]([_0xed0b('0x7c'),0x0])[_0xed0b('0x2d')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x182d4e[_0xed0b('0x69')]['id']}]};var _0x48266c={'$or':[_0x4ffdaa,_0x5883b5]};var _0x447984=[];if(_0x182d4e[_0xed0b('0x5c')][_0xed0b('0x7e')]&&_0x182d4e['body'][_0xed0b('0x7e')]===_0xed0b('0x7f')){if(!_[_0xed0b('0x80')](_0x182d4e[_0xed0b('0x5c')][_0xed0b('0x81')])){_0x48266c['id']={'$in':_0x182d4e[_0xed0b('0x5c')]['hopperIds']};}_0x447984=[['priority',_0xed0b('0x82')],[_0xed0b('0x83'),_0x5ed999[0x0]['dialOrderByScheduledAt']==='ASC'?_0xed0b('0x84'):_0xed0b('0x82')],db[_0xed0b('0x7d')][_0xed0b('0x85')](_0xed0b('0x86')),['id',_0xed0b('0x84')]];}else{if(!_[_0xed0b('0x80')](_0x182d4e[_0xed0b('0x5c')][_0xed0b('0x81')])){_0x48266c['id']={'$notIn':_0x182d4e['body'][_0xed0b('0x81')]};}_0x447984=[['priority',_0xed0b('0x84')],[_0xed0b('0x83'),_0x5ed999[0x0][_0xed0b('0x87')]],db[_0xed0b('0x7d')][_0xed0b('0x85')](_0xed0b('0x88')),['id',_0xed0b('0x82')]];}return db[_0xed0b('0x2e')]['findOne']({'attributes':['id',_0xed0b('0x89'),'recallme'],'where':_0x48266c,'order':_0x447984,'transaction':_0x189c94,'lock':_0x189c94[_0xed0b('0x8a')][_0xed0b('0x8b')],'include':[{'model':db['CmContact'],'as':_0xed0b('0x8c'),'attributes':_0x52599d,'include':[{'model':db['CmCompany'],'as':_0xed0b('0x8d'),'attributes':['id',_0xed0b('0x2b')]}]},{'model':db['CmList'],'as':_0xed0b('0x8e'),'attributes':['id',_0xed0b('0x2b')]},{'model':db[_0xed0b('0x8f')],'as':_0xed0b('0x90'),'attributes':['id',_0xed0b('0x2b'),_0xed0b('0x91')]}]})[_0xed0b('0x27')](function(_0x2489cf){if(_0x2489cf){return _0x2489cf[_0xed0b('0x26')]({'UserId':_0x182d4e['user']['id']},{'transaction':_0x189c94});}});});}})[_0xed0b('0x27')](handleEntityNotFound(_0x6dc1eb,null))[_0xed0b('0x27')](respondWithResult(_0x6dc1eb,null))['catch'](handleError(_0x6dc1eb,null));};exports[_0xed0b('0x92')]=function(_0x4be103,_0x2aafb3,_0x23fc78){var _0x61d854=[];return db[_0xed0b('0x73')]['describe']()[_0xed0b('0x27')](function(_0x351504){_0x61d854=_[_0xed0b('0x33')](_0x351504);return _0x4be103['user'][_0xed0b('0x93')]({'where':{'type':_0xed0b('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xed0b('0x87'),_0xed0b('0x7c')],'raw':!![]});})['then'](function(_0x453aa9){if(_0x453aa9&&_0x453aa9[_0xed0b('0x4a')]){return db[_0xed0b('0x7d')]['transaction'](function(_0x507ade){var _0x5e9520={'active':![],'recallme':!![],'id':_0x4be103[_0xed0b('0x5c')]['hopperId']};return db['CmHopper'][_0xed0b('0x94')]({'attributes':['id',_0xed0b('0x89'),'recallme'],'where':_0x5e9520,'transaction':_0x507ade,'lock':_0x507ade[_0xed0b('0x8a')][_0xed0b('0x8b')],'include':[{'model':db[_0xed0b('0x73')],'as':_0xed0b('0x8c'),'attributes':_0x61d854,'include':[{'model':db['CmCompany'],'as':_0xed0b('0x8d'),'attributes':['id',_0xed0b('0x2b')]}]},{'model':db[_0xed0b('0x95')],'as':'List','attributes':['id',_0xed0b('0x2b')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xed0b('0x2b'),_0xed0b('0x91')]}]})[_0xed0b('0x27')](function(_0x467f6f){if(_0x467f6f){return _0x467f6f[_0xed0b('0x26')]({'UserId':_0x4be103[_0xed0b('0x69')]['id']},{'transaction':_0x507ade});}});});}})[_0xed0b('0x27')](handleEntityNotFound(_0x2aafb3,null))['then'](respondWithResult(_0x2aafb3,null))[_0xed0b('0x5a')](handleError(_0x2aafb3,null));};exports[_0xed0b('0x96')]=function(_0x339e04,_0x3a5369,_0x8f99c){return _0x339e04[_0xed0b('0x69')][_0xed0b('0x93')]({'where':{'type':_0xed0b('0x7a'),'dialActive':!![],'dialMethod':_0xed0b('0x7b')},'attributes':['id'],'raw':!![]})['then'](function(_0x93cb59){if(_0x93cb59&&_0x93cb59[_0xed0b('0x4a')]){return db[_0xed0b('0x2e')][_0xed0b('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xed0b('0x6d'))},'VoiceQueueId':{'$in':_[_0xed0b('0x2d')](_0x93cb59,'id')},'$or':[{'UserId':null},{'UserId':_0x339e04['user']['id']}]}});}return 0x0;})[_0xed0b('0x27')](function(_0x2bd146){if(!_[_0xed0b('0x75')](_0x2bd146)&&_[_0xed0b('0x97')](_0x2bd146)){return _0x3a5369[_0xed0b('0x1b')](0xc8)[_0xed0b('0x98')]({'contacts':_0x2bd146});}else{logger[_0xed0b('0x29')](_0xed0b('0x99'),_0xed0b('0x96'),0x194,_0xed0b('0x9a'));_0x3a5369['sendStatus'](0x194);}})['catch'](handleError(_0x3a5369,null));};exports['getTimezones']=function(_0x3618b4,_0x733d1a,_0x12d5b4){var _0x4ae02b=shared[_0xed0b('0x9b')];var _0x530e11=[];_[_0xed0b('0x2d')](_0x4ae02b,function(_0x36539c){_0x530e11[_0xed0b('0x9c')]({'id':_0x36539c[_0xed0b('0x2b')],'name':_0x36539c['name'],'utcOffset':_0x36539c['utcOffset']});});return _0x733d1a['status'](0xc8)[_0xed0b('0x98')]({'tz':_0x530e11});};exports[_0xed0b('0x9d')]=function(_0x43fd19,_0x3bfcef,_0x5be6b2){var _0x50cd18=shared[_0xed0b('0x9b')];var _0x5e3b2a={};if(!_[_0xed0b('0x75')](_0x50cd18[_0x43fd19[_0xed0b('0x5c')]['id']]))_0x5e3b2a=_0x50cd18[_0x43fd19['body']['id']];return _0x3bfcef[_0xed0b('0x1b')](0xc8)['json'](_0x5e3b2a);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 2237d4f..0e4458d 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(_0x508e38,_0x2ef385){var _0x282ff4=function(_0x4a85a8){while(--_0x4a85a8){_0x508e38['push'](_0x508e38['shift']());}};_0x282ff4(++_0x2ef385);}(_0x5d17,0x114));var _0x75d1=function(_0x18bfdb,_0x241d43){_0x18bfdb=_0x18bfdb-0x0;var _0x44334c=_0x5d17[_0x18bfdb];return _0x44334c;};'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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x428c51,_0x2a9235){var _0x5a6b6d=function(_0x265e42){while(--_0x265e42){_0x428c51['push'](_0x428c51['shift']());}};_0x5a6b6d(++_0x2a9235);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]},{'name':_0xd46e('0xd'),'fields':[_0xd46e('0xd')]},{'name':'priority','fields':[_0xd46e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 13ce76a..8e17862 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 _0x8971=['push','includes','all','dataValues','ContactId','active','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','options','raw','limit','include','map','attributes','model','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','where','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','UserId'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x8971,0x7c));var _0x1897=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8971[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x1897('0x0'));var util=require(_0x1897('0x1'));var moment=require(_0x1897('0x2'));var BPromise=require(_0x1897('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1897('0x4'));var db=require(_0x1897('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1897('0x6'));var config=require(_0x1897('0x7'));var jayson=require(_0x1897('0x8'));const {validateExpressRequest}=require(_0x1897('0x9'));var client=jayson['client'][_0x1897('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xefce9c,_0x371a92,_0x26f5b9){return new BPromise(function(_0x261a47,_0x2e65d8){return client[_0x1897('0xb')](_0xefce9c,_0x26f5b9)[_0x1897('0xc')](function(_0x5d1d72){logger[_0x1897('0xd')]('CmHopper,\x20%s,\x20%s',_0x371a92,_0x1897('0xe'));logger[_0x1897('0xf')](_0x1897('0x10'),_0x371a92,'request\x20sent',JSON[_0x1897('0x11')](_0x5d1d72));if(_0x5d1d72['error']){if(_0x5d1d72[_0x1897('0x12')][_0x1897('0x13')]===0x1f4){logger[_0x1897('0x12')](_0x1897('0x14'),_0x371a92,_0x5d1d72[_0x1897('0x12')][_0x1897('0x15')]);return _0x2e65d8(_0x5d1d72[_0x1897('0x12')][_0x1897('0x15')]);}logger[_0x1897('0x12')](_0x1897('0x14'),_0x371a92,_0x5d1d72[_0x1897('0x12')][_0x1897('0x15')]);return _0x261a47(_0x5d1d72[_0x1897('0x12')][_0x1897('0x15')]);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x371a92,_0x1897('0xe'));_0x261a47(_0x5d1d72[_0x1897('0x16')][_0x1897('0x15')]);}})[_0x1897('0x17')](function(_0x580b4f){logger[_0x1897('0x12')](_0x1897('0x14'),_0x371a92,_0x580b4f);_0x2e65d8(_0x580b4f);});});}exports[_0x1897('0x18')]=function(_0x4ed58f){var _0x15992a=this;return new Promise(function(_0x26bf0a,_0x16a600){return db[_0x1897('0x19')]['findAll']({'raw':_0x4ed58f['options']?_0x4ed58f[_0x1897('0x1a')][_0x1897('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ed58f[_0x1897('0x1a')]?_0x4ed58f['options']['where']||null:null,'attributes':_0x4ed58f[_0x1897('0x1a')]?_0x4ed58f[_0x1897('0x1a')]['attributes']||null:null,'limit':_0x4ed58f[_0x1897('0x1a')]?_0x4ed58f[_0x1897('0x1a')][_0x1897('0x1c')]||null:null,'include':_0x4ed58f[_0x1897('0x1a')]?_0x4ed58f[_0x1897('0x1a')][_0x1897('0x1d')]?_[_0x1897('0x1e')](_0x4ed58f[_0x1897('0x1a')]['include'],function(_0x322fa6){return{'model':db[_0x322fa6['model']],'as':_0x322fa6['as'],'attributes':_0x322fa6[_0x1897('0x1f')],'include':_0x322fa6[_0x1897('0x1d')]?_[_0x1897('0x1e')](_0x322fa6[_0x1897('0x1d')],function(_0x3a6ff8){return{'model':db[_0x3a6ff8[_0x1897('0x20')]],'as':_0x3a6ff8['as'],'attributes':_0x3a6ff8[_0x1897('0x1f')],'include':_0x3a6ff8['include']?_[_0x1897('0x1e')](_0x3a6ff8['include'],function(_0x53f929){return{'model':db[_0x53f929[_0x1897('0x20')]],'as':_0x53f929['as'],'attributes':_0x53f929['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1359ed){logger['info']('GetCmHopper',_0x4ed58f);logger['debug']('GetCmHopper',_0x4ed58f,JSON[_0x1897('0x11')](_0x1359ed));_0x26bf0a(_0x1359ed);})[_0x1897('0x17')](function(_0x5242cd){logger[_0x1897('0x12')]('GetCmHopper',_0x5242cd['message'],_0x4ed58f);_0x16a600(_0x15992a['error'](0x1f4,_0x5242cd[_0x1897('0x15')]));});});};exports[_0x1897('0x21')]=function(_0x45bebd){var _0x47e4e1=this;return new Promise(function(_0xbe2054,_0x3b90d0){return db['CmHopper']['find']({'raw':_0x45bebd[_0x1897('0x1a')]?_0x45bebd['options']['raw']===undefined?!![]:![]:!![],'where':_0x45bebd[_0x1897('0x1a')]?_0x45bebd[_0x1897('0x1a')]['where']||null:null,'attributes':_0x45bebd[_0x1897('0x1a')]?_0x45bebd[_0x1897('0x1a')][_0x1897('0x1f')]||null:null,'include':_0x45bebd[_0x1897('0x1a')]?_0x45bebd[_0x1897('0x1a')][_0x1897('0x1d')]?_['map'](_0x45bebd['options'][_0x1897('0x1d')],function(_0x10d00c){return{'model':db[_0x10d00c[_0x1897('0x20')]],'as':_0x10d00c['as'],'attributes':_0x10d00c[_0x1897('0x1f')],'include':_0x10d00c['include']?_['map'](_0x10d00c[_0x1897('0x1d')],function(_0x243008){return{'model':db[_0x243008[_0x1897('0x20')]],'as':_0x243008['as'],'attributes':_0x243008[_0x1897('0x1f')],'include':_0x243008[_0x1897('0x1d')]?_[_0x1897('0x1e')](_0x243008['include'],function(_0x3585b9){return{'model':db[_0x3585b9['model']],'as':_0x3585b9['as'],'attributes':_0x3585b9[_0x1897('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1897('0xc')](function(_0x336625){logger[_0x1897('0xd')]('ShowCmHopper',_0x45bebd);logger['debug'](_0x1897('0x21'),_0x45bebd,JSON[_0x1897('0x11')](_0x336625));_0xbe2054(_0x336625);})[_0x1897('0x17')](function(_0x2c6aa0){logger[_0x1897('0x12')](_0x1897('0x21'),_0x2c6aa0[_0x1897('0x15')],_0x45bebd);_0x3b90d0(_0x47e4e1[_0x1897('0x12')](0x1f4,_0x2c6aa0['message']));});});};exports[_0x1897('0x22')]=function(_0x3c6f23){var _0x3a7ed1=this;return new Promise(function(_0x11da5a,_0x3997b8){return db['CmHopper'][_0x1897('0x23')](_0x3c6f23['body'],{'raw':_0x3c6f23['options']?_0x3c6f23[_0x1897('0x1a')][_0x1897('0x1b')]===undefined?!![]:![]:!![]})[_0x1897('0xc')](function(_0x4ab65e){logger['info'](_0x1897('0x22'),_0x3c6f23);logger[_0x1897('0xf')]('CreateCmHopper',_0x3c6f23,JSON[_0x1897('0x11')](_0x4ab65e));_0x11da5a(_0x4ab65e);})[_0x1897('0x17')](function(_0x5e70f4){logger[_0x1897('0x12')]('CreateCmHopper',_0x5e70f4[_0x1897('0x15')],_0x3c6f23);_0x3997b8(_0x3a7ed1['error'](0x1f4,_0x5e70f4[_0x1897('0x15')]));});});};exports[_0x1897('0x24')]=function(_0x265fa1){var _0x2927b5=this;return new Promise(function(_0x443fc2,_0x4cc574){return db['CmHopper'][_0x1897('0x25')](_0x265fa1[_0x1897('0x26')],{'raw':_0x265fa1[_0x1897('0x1a')]?_0x265fa1[_0x1897('0x1a')][_0x1897('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x265fa1[_0x1897('0x1a')]?_0x265fa1[_0x1897('0x1a')]['where']||null:null,'attributes':_0x265fa1[_0x1897('0x1a')]?_0x265fa1[_0x1897('0x1a')]['attributes']||null:null,'limit':_0x265fa1['options']?_0x265fa1['options']['limit']||null:null})[_0x1897('0xc')](function(_0x3d9715){logger[_0x1897('0xd')]('UpdateCmHopper',_0x265fa1);logger[_0x1897('0xd')](_0x1897('0x27'),JSON[_0x1897('0x11')](_0x265fa1[_0x1897('0x1a')]['where']),_0x265fa1[_0x1897('0x26')]['active']);logger[_0x1897('0xf')](_0x1897('0x24'),_0x265fa1,JSON['stringify'](_0x3d9715));_0x443fc2(_0x3d9715);})[_0x1897('0x17')](function(_0x4dbbc2){logger[_0x1897('0x12')]('UpdateCmHopper',_0x4dbbc2[_0x1897('0x15')],_0x265fa1);_0x4cc574(_0x2927b5['error'](0x1f4,_0x4dbbc2[_0x1897('0x15')]));});});};exports[_0x1897('0x28')]=function(_0x3f1a1f){var _0x32ef9e=this;return new Promise(function(_0x4e59f9,_0x620119){return db[_0x1897('0x19')][_0x1897('0x29')]({'where':_0x3f1a1f[_0x1897('0x1a')]?_0x3f1a1f[_0x1897('0x1a')]['where']||null:null})[_0x1897('0xc')](function(_0x33e58c){logger[_0x1897('0xd')](_0x1897('0x28'),_0x3f1a1f);logger[_0x1897('0xf')](_0x1897('0x28'),_0x3f1a1f,JSON['stringify'](_0x33e58c));_0x4e59f9(_0x33e58c);})[_0x1897('0x17')](function(_0x3112eb){logger[_0x1897('0x12')](_0x1897('0x28'),_0x3112eb['message'],_0x3f1a1f);_0x620119(_0x32ef9e[_0x1897('0x12')](0x1f4,_0x3112eb[_0x1897('0x15')]));});});};exports[_0x1897('0x2a')]=function(_0xf5ca0){var _0x1590e3=this;return new Promise(function(_0x325290,_0x1aec9f){return db[_0x1897('0x2b')][_0x1897('0x2c')]()['then'](function(_0x12a57f){return db[_0x1897('0x2d')]['transaction'](function(_0x2d1795){return db[_0x1897('0x19')][_0x1897('0x2e')]({'where':_0xf5ca0[_0x1897('0x1a')]?_0xf5ca0[_0x1897('0x1a')][_0x1897('0x2f')]||null:null,'attributes':_0xf5ca0[_0x1897('0x1a')]?_0xf5ca0['options']['attributes']||null:null,'limit':_0xf5ca0['options']?_0xf5ca0[_0x1897('0x1a')][_0x1897('0x1c')]||null:null,'order':_0xf5ca0[_0x1897('0x1a')]?_0xf5ca0['options'][_0x1897('0x30')]||null:null,'transaction':_0x2d1795,'lock':_0x2d1795[_0x1897('0x31')][_0x1897('0x32')],'include':[{'model':db[_0x1897('0x2b')],'as':_0x1897('0x33'),'attributes':_['keys'](_0x12a57f)},{'model':db[_0x1897('0x34')],'as':_0x1897('0x35'),'attributes':['id',_0x1897('0x36'),_0x1897('0x37')]}]})[_0x1897('0xc')](function(_0x17dfcc){var _0x5651b6=[];var _0x1e43a9=[];for(var _0x59e2e1=0x0;_0x59e2e1<_0x17dfcc[_0x1897('0x38')];_0x59e2e1+=0x1){var _0x532f94=_0x17dfcc[_0x59e2e1][_0x1897('0x39')];if(_0x532f94===null){_0x5651b6[_0x1897('0x3a')](_0x17dfcc[_0x59e2e1][_0x1897('0x25')](_0xf5ca0[_0x1897('0x26')],{'transaction':_0x2d1795}));}else if(!_0x1e43a9[_0x1897('0x3b')](_0x532f94)){_0x1e43a9[_0x1897('0x3a')](_0x532f94);_0x5651b6[_0x1897('0x3a')](_0x17dfcc[_0x59e2e1][_0x1897('0x25')](_0xf5ca0[_0x1897('0x26')],{'transaction':_0x2d1795}));}}return BPromise[_0x1897('0x3c')](_0x5651b6);});})[_0x1897('0xc')](function(_0x5bc155){logger['info'](_0x1897('0x2a'),_0xf5ca0);if(_0x5bc155['length']>0x0){logger[_0x1897('0xd')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x5bc155[0x0][_0x1897('0x3d')]['id'],_0x5bc155[0x0][_0x1897('0x3d')][_0x1897('0x3e')],_0x5bc155[0x0][_0x1897('0x3d')][_0x1897('0x3f')]);}logger[_0x1897('0xf')]('GetContactDialer',_0xf5ca0,JSON[_0x1897('0x11')](_0x5bc155));_0x325290(_0x5bc155);})['catch'](function(_0x3c54fb){logger[_0x1897('0x12')](_0x1897('0x2a'),_0x3c54fb[_0x1897('0x15')],_0xf5ca0);_0x1aec9f(_0x1590e3['error'](0x1f4,_0x3c54fb[_0x1897('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x503bab){var _0x38f606=this;return new Promise(function(_0xfa4385,_0x18921c){return db[_0x1897('0x2d')][_0x1897('0x40')](function(_0x58dd5e){return db[_0x1897('0x41')]['create'](_0x503bab[_0x1897('0x26')],{'raw':_0x503bab['options']?_0x503bab['options'][_0x1897('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x58dd5e})[_0x1897('0xc')](function(){logger[_0x1897('0xd')](_0x1897('0x42'),JSON[_0x1897('0x11')](_0x503bab[_0x1897('0x1a')]['where']),_0x503bab[_0x1897('0x1a')][_0x1897('0x2f')][_0x1897('0x3f')]);return db[_0x1897('0x19')][_0x1897('0x29')]({'where':_0x503bab[_0x1897('0x1a')]?_0x503bab[_0x1897('0x1a')][_0x1897('0x2f')]||null:null,'transaction':_0x58dd5e});});})['then'](function(_0x4fe7a7){logger['info'](_0x1897('0x43'),_0x503bab);logger[_0x1897('0xf')](_0x1897('0x43'),_0x503bab,JSON[_0x1897('0x11')](_0x4fe7a7));_0xfa4385(_0x4fe7a7);})[_0x1897('0x17')](function(_0x507e5a){logger['error']('MoveContactManagedDialer',_0x507e5a[_0x1897('0x15')],_0x503bab);_0x18921c(_0x38f606[_0x1897('0x12')](0x1f4,_0x507e5a[_0x1897('0x15')]));});});};exports[_0x1897('0x44')]=function(_0x580580){var _0x4ad1cd=this;return new Promise(function(_0x25215b,_0x103390){return db[_0x1897('0x19')][_0x1897('0x2e')]({'raw':_0x580580[_0x1897('0x1a')]?_0x580580[_0x1897('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x580580[_0x1897('0x1a')]?_0x580580[_0x1897('0x1a')][_0x1897('0x2f')]||null:null,'attributes':[[db[_0x1897('0x2d')]['fn']('COUNT',db[_0x1897('0x2d')]['fn']('IF',db[_0x1897('0x2d')]['literal'](_0x1897('0x45')+util[_0x1897('0x46')](_0x1897('0x47'),moment()[_0x1897('0x46')](_0x1897('0x48')))+_0x1897('0x49')))),_0x1897('0x4a')]]})[_0x1897('0xc')](function(_0x53310d){logger[_0x1897('0xd')](_0x1897('0x44'),_0x580580);logger[_0x1897('0xf')]('CountReScheduled',_0x580580,JSON[_0x1897('0x11')](_0x53310d));_0x25215b(_0x53310d);})['catch'](function(_0x3150ad){logger[_0x1897('0x12')](_0x1897('0x44'),_0x3150ad['message'],_0x580580);_0x103390(_0x4ad1cd[_0x1897('0x12')](0x1f4,_0x3150ad[_0x1897('0x15')]));});});};exports['GetContactRecallMe']=function(_0x3bfb56){var _0x1078ec=this;return new Promise(function(_0x38460b,_0x5dd091){return db[_0x1897('0x2b')][_0x1897('0x2c')]()[_0x1897('0xc')](function(_0x18969c){return db[_0x1897('0x2d')][_0x1897('0x40')](function(_0x295ea6){return db[_0x1897('0x19')][_0x1897('0x2e')]({'where':_0x3bfb56['options']?_0x3bfb56[_0x1897('0x1a')][_0x1897('0x2f')]||null:null,'attributes':_0x3bfb56[_0x1897('0x1a')]?_0x3bfb56['options'][_0x1897('0x1f')]||null:null,'limit':0x1,'order':_0x3bfb56['options']?_0x3bfb56['options'][_0x1897('0x30')]||null:null,'group':db['CmHopper'][_0x1897('0x39')],'transaction':_0x295ea6,'lock':_0x295ea6[_0x1897('0x31')][_0x1897('0x32')],'include':_0x3bfb56[_0x1897('0x1a')]?_0x3bfb56[_0x1897('0x1a')]['include']?_[_0x1897('0x1e')](_0x3bfb56[_0x1897('0x1a')][_0x1897('0x1d')],function(_0x46b2f7){return{'model':db[_0x46b2f7[_0x1897('0x20')]],'as':_0x46b2f7['as'],'attributes':_0x46b2f7[_0x1897('0x1f')],'include':_0x46b2f7[_0x1897('0x1d')]?_[_0x1897('0x1e')](_0x46b2f7[_0x1897('0x1d')],function(_0x2ee077){return{'model':db[_0x2ee077[_0x1897('0x20')]],'as':_0x2ee077['as'],'attributes':_0x2ee077['attributes'],'include':_0x2ee077[_0x1897('0x1d')]?_[_0x1897('0x1e')](_0x2ee077[_0x1897('0x1d')],function(_0x41162c){return{'model':db[_0x41162c[_0x1897('0x20')]],'as':_0x41162c['as'],'attributes':_0x41162c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1897('0xc')](function(_0x185b17){var _0x3ba63f=[];for(var _0x4bdaab=0x0;_0x4bdaab<_0x185b17['length'];_0x4bdaab+=0x1){_0x3ba63f[_0x1897('0x3a')](_0x185b17[_0x4bdaab][_0x1897('0x25')](_0x3bfb56[_0x1897('0x26')],{'transaction':_0x295ea6}));}return BPromise[_0x1897('0x3c')](_0x3ba63f);});})[_0x1897('0xc')](function(_0x16e8d7){logger[_0x1897('0xd')](_0x1897('0x4b'),_0x3bfb56);logger[_0x1897('0xf')](_0x1897('0x4b'),_0x3bfb56,JSON[_0x1897('0x11')](_0x16e8d7));_0x38460b(_0x16e8d7);})[_0x1897('0x17')](function(_0x6370b4){logger[_0x1897('0x12')](_0x1897('0x4b'),_0x6370b4[_0x1897('0x15')],_0x3bfb56);_0x5dd091(_0x1078ec[_0x1897('0x12')](0x1f4,_0x6370b4[_0x1897('0x15')]));});});});};exports[_0x1897('0x4c')]=function(_0x15275b){var _0x4dfec0=this;return new Promise(function(_0x2cf127,_0x35d2d2){db[_0x1897('0x2b')][_0x1897('0x2c')]()['then'](function(_0x51aabc){return db[_0x1897('0x19')][_0x1897('0x2e')]({'raw':_0x15275b[_0x1897('0x1a')]?_0x15275b[_0x1897('0x1a')][_0x1897('0x1b')]===undefined?!![]:![]:!![],'where':_0x15275b['options']?_0x15275b[_0x1897('0x1a')][_0x1897('0x2f')]||null:null,'attributes':_0x15275b[_0x1897('0x1a')]?_0x15275b['options'][_0x1897('0x1f')]||null:null,'limit':_0x15275b['options']?_0x15275b[_0x1897('0x1a')]['limit']||null:null,'include':_0x15275b[_0x1897('0x1a')]?_0x15275b[_0x1897('0x1a')][_0x1897('0x1d')]?_['map'](_0x15275b[_0x1897('0x1a')][_0x1897('0x1d')],function(_0x10f243){return{'model':db[_0x10f243[_0x1897('0x20')]],'as':_0x10f243['as'],'attributes':_0x10f243['as']===_0x1897('0x33')?_[_0x1897('0x4d')](_0x51aabc):_0x10f243['attributes'],'include':_0x10f243['include']?_[_0x1897('0x1e')](_0x10f243[_0x1897('0x1d')],function(_0x425aaa){return{'model':db[_0x425aaa[_0x1897('0x20')]],'as':_0x425aaa['as'],'attributes':_0x425aaa[_0x1897('0x1f')],'include':_0x425aaa['include']?_[_0x1897('0x1e')](_0x425aaa[_0x1897('0x1d')],function(_0x2f63a1){return{'model':db[_0x2f63a1[_0x1897('0x20')]],'as':_0x2f63a1['as'],'attributes':_0x2f63a1[_0x1897('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29b9b3){logger[_0x1897('0xd')](_0x1897('0x18'),_0x15275b);logger[_0x1897('0xf')](_0x1897('0x18'),_0x15275b,JSON[_0x1897('0x11')](_0x29b9b3));_0x2cf127(_0x29b9b3);})[_0x1897('0x17')](function(_0x386125){logger[_0x1897('0x12')](_0x1897('0x18'),_0x386125[_0x1897('0x15')],_0x15275b);_0x35d2d2(_0x4dfec0[_0x1897('0x12')](0x1f4,_0x386125[_0x1897('0x15')]));});});});};exports[_0x1897('0x4e')]=function(_0x4854b6){var _0x3a887=this;return new Promise(function(_0x447d64,_0x9fa202){return db[_0x1897('0x2b')][_0x1897('0x4f')]({'raw':!![],'where':{'phone':_0x4854b6[_0x1897('0x1a')][_0x1897('0x2f')]['phone']},'attributes':['id',_0x1897('0x50')],'order':[['id',_0x1897('0x51')]]})[_0x1897('0xc')](function(_0x1f67a9){logger['info'](_0x1897('0x52'),_0x4854b6);logger[_0x1897('0xf')](_0x1897('0x52'),_0x4854b6,JSON[_0x1897('0x11')](_0x1f67a9));_0x447d64(_0x1f67a9);})[_0x1897('0x17')](function(_0x5713ab){logger['error'](_0x1897('0x52'),_0x5713ab['message'],_0x4854b6);_0x9fa202(_0x3a887[_0x1897('0x12')](0x1f4,_0x5713ab['message']));});});};exports[_0x1897('0x53')]=function(_0x2813a4){var _0x4c6704=this;return new Promise(function(_0x13ab54,_0x32ffa4){return db[_0x1897('0x2d')][_0x1897('0x40')](function(_0x49d9b7){return db['CmHopper'][_0x1897('0x25')]({'active':![]},{'where':{},'transaction':_0x49d9b7})[_0x1897('0xc')](function(_0x44733a){logger[_0x1897('0xd')]('ResetActiveCalls',_0x2813a4);logger[_0x1897('0xf')](_0x1897('0x53'),_0x2813a4,JSON[_0x1897('0x11')](_0x44733a));_0x13ab54(_0x44733a);})[_0x1897('0x17')](function(_0x3ce57d){logger[_0x1897('0x12')](_0x1897('0x53'),_0x3ce57d[_0x1897('0x15')],_0x2813a4);_0x32ffa4(_0x4c6704[_0x1897('0x12')](0x1f4,_0x3ce57d['message']));});});});};exports[_0x1897('0x54')]=function(_0x512474){var _0x66c052=this;var _0x226b89=_0x512474[_0x1897('0x26')][_0x1897('0x2f')][_0x1897('0x55')];var _0x19212c=_0x512474[_0x1897('0x26')]['where'][_0x1897('0x56')];return new Promise(function(_0x39de63,_0x1dc181){return db[_0x1897('0x19')][_0x1897('0x2e')]({'where':{'voiceQueueId':_0x226b89,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x1897('0x2d')][_0x1897('0x57')](_0x1897('0x58')+_0x19212c+_0x1897('0x59'))}},'include':[{'model':db[_0x1897('0x2b')],'as':_0x1897('0x33')},{'model':db[_0x1897('0x34')],'as':'Agent','attributes':['id',_0x1897('0x36'),_0x1897('0x37')]},{'model':db[_0x1897('0x5a')],'as':'List'}]})[_0x1897('0xc')](function(_0x1148cf){return db['sequelize'][_0x1897('0x40')](function(_0xcada3d){return db[_0x1897('0x19')][_0x1897('0x25')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x226b89,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x1897('0x2d')][_0x1897('0x57')](_0x1897('0x58')+_0x19212c+_0x1897('0x59'))}},'transaction':_0xcada3d})[_0x1897('0xc')](function(_0x3e3888){_0x39de63(_0x1148cf);})[_0x1897('0x17')](function(_0x119e94){logger[_0x1897('0x12')](_0x1897('0x54'),_0x119e94[_0x1897('0x15')],_0x512474);_0x1dc181(validateExpressRequest);});});})[_0x1897('0x17')](function(_0x379be9){logger[_0x1897('0x12')](_0x1897('0x54'),_0x379be9[_0x1897('0x15')],_0x512474);_0x1dc181(_0x66c052[_0x1897('0x12')](0x1f4,_0x379be9['message']));});});}; \ No newline at end of file +var _0x778a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','twilio/lib/webhooks/webhooks','client','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','ShowCmHopper','find','model','stringify','CreateCmHopper','UpdateCmHopper','body','limit','DestroyCmHopper','destroy','CmContact','describe','order','UPDATE','keys','length','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','GetContactDialer','sequelize','transaction','CmHopperFinal','create','MoveContactManagedDialer','CountReScheduled','COUNT','literal','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','LOCK','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','Agent','name','voicePause','CmList','List','lodash','util','moment','bluebird'];(function(_0x5e6522,_0x4cf870){var _0x2fe288=function(_0x57a5f6){while(--_0x57a5f6){_0x5e6522['push'](_0x5e6522['shift']());}};_0x2fe288(++_0x4cf870);}(_0x778a,0xfe));var _0xa778=function(_0x128561,_0x3f5e94){_0x128561=_0x128561-0x0;var _0x58efaa=_0x778a[_0x128561];return _0x58efaa;};'use strict';var _=require(_0xa778('0x0'));var util=require(_0xa778('0x1'));var moment=require(_0xa778('0x2'));var BPromise=require(_0xa778('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa778('0x4'));var db=require(_0xa778('0x5'))['db'];var utils=require(_0xa778('0x6'));var logger=require(_0xa778('0x7'))('rpc');var config=require(_0xa778('0x8'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0xa778('0x9'));var client=jayson[_0xa778('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54a887,_0x13a8a4,_0x5c6d4b){return new BPromise(function(_0x142853,_0x5a221d){return client['request'](_0x54a887,_0x5c6d4b)[_0xa778('0xb')](function(_0x1a94b2){logger['info'](_0xa778('0xc'),_0x13a8a4,_0xa778('0xd'));logger[_0xa778('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x13a8a4,_0xa778('0xd'),JSON['stringify'](_0x1a94b2));if(_0x1a94b2['error']){if(_0x1a94b2[_0xa778('0xf')][_0xa778('0x10')]===0x1f4){logger[_0xa778('0xf')](_0xa778('0xc'),_0x13a8a4,_0x1a94b2[_0xa778('0xf')]['message']);return _0x5a221d(_0x1a94b2[_0xa778('0xf')][_0xa778('0x11')]);}logger['error'](_0xa778('0xc'),_0x13a8a4,_0x1a94b2[_0xa778('0xf')][_0xa778('0x11')]);return _0x142853(_0x1a94b2[_0xa778('0xf')][_0xa778('0x11')]);}else{logger[_0xa778('0x12')]('CmHopper,\x20%s,\x20%s',_0x13a8a4,'request\x20sent');_0x142853(_0x1a94b2[_0xa778('0x13')][_0xa778('0x11')]);}})[_0xa778('0x14')](function(_0x242b30){logger[_0xa778('0xf')](_0xa778('0xc'),_0x13a8a4,_0x242b30);_0x5a221d(_0x242b30);});});}exports[_0xa778('0x15')]=function(_0x780da2){var _0x116950=this;return new Promise(function(_0x30a395,_0x1590be){return db[_0xa778('0x16')][_0xa778('0x17')]({'raw':_0x780da2[_0xa778('0x18')]?_0x780da2[_0xa778('0x18')][_0xa778('0x19')]===undefined?!![]:![]:!![],'where':_0x780da2[_0xa778('0x18')]?_0x780da2[_0xa778('0x18')][_0xa778('0x1a')]||null:null,'attributes':_0x780da2[_0xa778('0x18')]?_0x780da2['options'][_0xa778('0x1b')]||null:null,'limit':_0x780da2[_0xa778('0x18')]?_0x780da2['options']['limit']||null:null,'include':_0x780da2[_0xa778('0x18')]?_0x780da2['options'][_0xa778('0x1c')]?_[_0xa778('0x1d')](_0x780da2[_0xa778('0x18')][_0xa778('0x1c')],function(_0xa3e535){return{'model':db[_0xa3e535['model']],'as':_0xa3e535['as'],'attributes':_0xa3e535[_0xa778('0x1b')],'include':_0xa3e535[_0xa778('0x1c')]?_[_0xa778('0x1d')](_0xa3e535[_0xa778('0x1c')],function(_0x3ea395){return{'model':db[_0x3ea395['model']],'as':_0x3ea395['as'],'attributes':_0x3ea395[_0xa778('0x1b')],'include':_0x3ea395['include']?_[_0xa778('0x1d')](_0x3ea395[_0xa778('0x1c')],function(_0x2c7418){return{'model':db[_0x2c7418['model']],'as':_0x2c7418['as'],'attributes':_0x2c7418[_0xa778('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa778('0xb')](function(_0x3f8060){logger[_0xa778('0x12')]('GetCmHopper',_0x780da2);logger[_0xa778('0xe')](_0xa778('0x15'),_0x780da2,JSON['stringify'](_0x3f8060));_0x30a395(_0x3f8060);})[_0xa778('0x14')](function(_0x4c598a){logger['error'](_0xa778('0x15'),_0x4c598a[_0xa778('0x11')],_0x780da2);_0x1590be(_0x116950[_0xa778('0xf')](0x1f4,_0x4c598a[_0xa778('0x11')]));});});};exports[_0xa778('0x1e')]=function(_0x45861a){var _0x111d14=this;return new Promise(function(_0x2bff3c,_0x5da4b0){return db[_0xa778('0x16')][_0xa778('0x1f')]({'raw':_0x45861a['options']?_0x45861a[_0xa778('0x18')][_0xa778('0x19')]===undefined?!![]:![]:!![],'where':_0x45861a[_0xa778('0x18')]?_0x45861a[_0xa778('0x18')]['where']||null:null,'attributes':_0x45861a['options']?_0x45861a[_0xa778('0x18')][_0xa778('0x1b')]||null:null,'include':_0x45861a[_0xa778('0x18')]?_0x45861a[_0xa778('0x18')]['include']?_[_0xa778('0x1d')](_0x45861a['options'][_0xa778('0x1c')],function(_0x30672c){return{'model':db[_0x30672c[_0xa778('0x20')]],'as':_0x30672c['as'],'attributes':_0x30672c[_0xa778('0x1b')],'include':_0x30672c[_0xa778('0x1c')]?_[_0xa778('0x1d')](_0x30672c[_0xa778('0x1c')],function(_0x2a22b9){return{'model':db[_0x2a22b9['model']],'as':_0x2a22b9['as'],'attributes':_0x2a22b9[_0xa778('0x1b')],'include':_0x2a22b9[_0xa778('0x1c')]?_[_0xa778('0x1d')](_0x2a22b9[_0xa778('0x1c')],function(_0xb50ebb){return{'model':db[_0xb50ebb[_0xa778('0x20')]],'as':_0xb50ebb['as'],'attributes':_0xb50ebb[_0xa778('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3208ca){logger[_0xa778('0x12')](_0xa778('0x1e'),_0x45861a);logger[_0xa778('0xe')]('ShowCmHopper',_0x45861a,JSON[_0xa778('0x21')](_0x3208ca));_0x2bff3c(_0x3208ca);})[_0xa778('0x14')](function(_0x1ddbb0){logger[_0xa778('0xf')](_0xa778('0x1e'),_0x1ddbb0['message'],_0x45861a);_0x5da4b0(_0x111d14['error'](0x1f4,_0x1ddbb0[_0xa778('0x11')]));});});};exports[_0xa778('0x22')]=function(_0x5353d4){var _0xc37417=this;return new Promise(function(_0x47a790,_0x469b41){return db[_0xa778('0x16')]['create'](_0x5353d4['body'],{'raw':_0x5353d4['options']?_0x5353d4[_0xa778('0x18')][_0xa778('0x19')]===undefined?!![]:![]:!![]})[_0xa778('0xb')](function(_0x42ab03){logger[_0xa778('0x12')](_0xa778('0x22'),_0x5353d4);logger[_0xa778('0xe')]('CreateCmHopper',_0x5353d4,JSON[_0xa778('0x21')](_0x42ab03));_0x47a790(_0x42ab03);})[_0xa778('0x14')](function(_0xad2630){logger['error'](_0xa778('0x22'),_0xad2630[_0xa778('0x11')],_0x5353d4);_0x469b41(_0xc37417[_0xa778('0xf')](0x1f4,_0xad2630[_0xa778('0x11')]));});});};exports[_0xa778('0x23')]=function(_0x2b190d){var _0x1b8b09=this;return new Promise(function(_0x1f795f,_0x3eb57b){return db['CmHopper']['update'](_0x2b190d[_0xa778('0x24')],{'raw':_0x2b190d['options']?_0x2b190d[_0xa778('0x18')][_0xa778('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b190d[_0xa778('0x18')]?_0x2b190d[_0xa778('0x18')][_0xa778('0x1a')]||null:null,'attributes':_0x2b190d['options']?_0x2b190d[_0xa778('0x18')][_0xa778('0x1b')]||null:null,'limit':_0x2b190d[_0xa778('0x18')]?_0x2b190d[_0xa778('0x18')][_0xa778('0x25')]||null:null})['then'](function(_0x3b16d4){logger['info']('UpdateCmHopper',_0x2b190d);logger[_0xa778('0x12')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xa778('0x21')](_0x2b190d[_0xa778('0x18')]['where']),_0x2b190d[_0xa778('0x24')]['active']);logger[_0xa778('0xe')](_0xa778('0x23'),_0x2b190d,JSON['stringify'](_0x3b16d4));_0x1f795f(_0x3b16d4);})[_0xa778('0x14')](function(_0x5554ec){logger[_0xa778('0xf')](_0xa778('0x23'),_0x5554ec[_0xa778('0x11')],_0x2b190d);_0x3eb57b(_0x1b8b09['error'](0x1f4,_0x5554ec[_0xa778('0x11')]));});});};exports[_0xa778('0x26')]=function(_0x5c93bc){var _0x11b5b0=this;return new Promise(function(_0x4b8f38,_0x503b87){return db['CmHopper'][_0xa778('0x27')]({'where':_0x5c93bc[_0xa778('0x18')]?_0x5c93bc[_0xa778('0x18')][_0xa778('0x1a')]||null:null})['then'](function(_0x2011cd){logger[_0xa778('0x12')](_0xa778('0x26'),_0x5c93bc);logger['debug'](_0xa778('0x26'),_0x5c93bc,JSON[_0xa778('0x21')](_0x2011cd));_0x4b8f38(_0x2011cd);})['catch'](function(_0x400314){logger[_0xa778('0xf')](_0xa778('0x26'),_0x400314['message'],_0x5c93bc);_0x503b87(_0x11b5b0[_0xa778('0xf')](0x1f4,_0x400314[_0xa778('0x11')]));});});};exports['GetContactDialer']=function(_0x1e20c0){var _0x2378bd=this;return new Promise(function(_0x3f2370,_0x5294a5){return db[_0xa778('0x28')][_0xa778('0x29')]()[_0xa778('0xb')](function(_0x3a3f64){return db['sequelize']['transaction'](function(_0x38ad7e){return db['CmHopper'][_0xa778('0x17')]({'where':_0x1e20c0[_0xa778('0x18')]?_0x1e20c0[_0xa778('0x18')][_0xa778('0x1a')]||null:null,'attributes':_0x1e20c0[_0xa778('0x18')]?_0x1e20c0[_0xa778('0x18')][_0xa778('0x1b')]||null:null,'limit':_0x1e20c0[_0xa778('0x18')]?_0x1e20c0[_0xa778('0x18')]['limit']||null:null,'order':_0x1e20c0[_0xa778('0x18')]?_0x1e20c0[_0xa778('0x18')][_0xa778('0x2a')]||null:null,'transaction':_0x38ad7e,'lock':_0x38ad7e['LOCK'][_0xa778('0x2b')],'include':[{'model':db[_0xa778('0x28')],'as':'Contact','attributes':_[_0xa778('0x2c')](_0x3a3f64)},{'model':db['User'],'as':'Agent','attributes':['id','name','voicePause']}]})[_0xa778('0xb')](function(_0x5d7201){var _0x2ec8f8=[];var _0x402052=[];for(var _0x3bfed8=0x0;_0x3bfed8<_0x5d7201[_0xa778('0x2d')];_0x3bfed8+=0x1){var _0x250032=_0x5d7201[_0x3bfed8]['UserId'];if(_0x250032===null){_0x2ec8f8[_0xa778('0x2e')](_0x5d7201[_0x3bfed8][_0xa778('0x2f')](_0x1e20c0['body'],{'transaction':_0x38ad7e}));}else if(!_0x402052[_0xa778('0x30')](_0x250032)){_0x402052[_0xa778('0x2e')](_0x250032);_0x2ec8f8[_0xa778('0x2e')](_0x5d7201[_0x3bfed8][_0xa778('0x2f')](_0x1e20c0['body'],{'transaction':_0x38ad7e}));}}return BPromise[_0xa778('0x31')](_0x2ec8f8);});})[_0xa778('0xb')](function(_0x40b37a){logger[_0xa778('0x12')]('GetContactDialer',_0x1e20c0);if(_0x40b37a['length']>0x0){logger['info'](_0xa778('0x32'),_0x40b37a[0x0][_0xa778('0x33')]['id'],_0x40b37a[0x0]['dataValues'][_0xa778('0x34')],_0x40b37a[0x0][_0xa778('0x33')][_0xa778('0x35')]);}logger[_0xa778('0xe')](_0xa778('0x36'),_0x1e20c0,JSON[_0xa778('0x21')](_0x40b37a));_0x3f2370(_0x40b37a);})[_0xa778('0x14')](function(_0x368e08){logger['error'](_0xa778('0x36'),_0x368e08[_0xa778('0x11')],_0x1e20c0);_0x5294a5(_0x2378bd[_0xa778('0xf')](0x1f4,_0x368e08[_0xa778('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0xb41d6d){var _0x258d16=this;return new Promise(function(_0x11a4af,_0x19ec25){return db[_0xa778('0x37')][_0xa778('0x38')](function(_0x331597){return db[_0xa778('0x39')][_0xa778('0x3a')](_0xb41d6d[_0xa778('0x24')],{'raw':_0xb41d6d['options']?_0xb41d6d[_0xa778('0x18')][_0xa778('0x19')]===undefined?!![]:![]:!![],'transaction':_0x331597})[_0xa778('0xb')](function(){logger[_0xa778('0x12')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0xb41d6d[_0xa778('0x18')][_0xa778('0x1a')]),_0xb41d6d[_0xa778('0x18')][_0xa778('0x1a')][_0xa778('0x35')]);return db[_0xa778('0x16')][_0xa778('0x27')]({'where':_0xb41d6d[_0xa778('0x18')]?_0xb41d6d[_0xa778('0x18')][_0xa778('0x1a')]||null:null,'transaction':_0x331597});});})[_0xa778('0xb')](function(_0x491f19){logger['info'](_0xa778('0x3b'),_0xb41d6d);logger[_0xa778('0xe')](_0xa778('0x3b'),_0xb41d6d,JSON[_0xa778('0x21')](_0x491f19));_0x11a4af(_0x491f19);})[_0xa778('0x14')](function(_0x3d941a){logger[_0xa778('0xf')](_0xa778('0x3b'),_0x3d941a[_0xa778('0x11')],_0xb41d6d);_0x19ec25(_0x258d16[_0xa778('0xf')](0x1f4,_0x3d941a[_0xa778('0x11')]));});});};exports[_0xa778('0x3c')]=function(_0x5668f6){var _0x4bd171=this;return new Promise(function(_0x58e428,_0x35dbfa){return db[_0xa778('0x16')][_0xa778('0x17')]({'raw':_0x5668f6[_0xa778('0x18')]?_0x5668f6['options'][_0xa778('0x19')]===undefined?!![]:![]:!![],'where':_0x5668f6[_0xa778('0x18')]?_0x5668f6[_0xa778('0x18')][_0xa778('0x1a')]||null:null,'attributes':[[db[_0xa778('0x37')]['fn'](_0xa778('0x3d'),db['sequelize']['fn']('IF',db[_0xa778('0x37')][_0xa778('0x3e')]('`scheduledat`\x20>=\x20'+util[_0xa778('0x3f')](_0xa778('0x40'),moment()[_0xa778('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xa778('0x41')))),'contactsRescheduled']]})[_0xa778('0xb')](function(_0x1b7d32){logger['info'](_0xa778('0x3c'),_0x5668f6);logger[_0xa778('0xe')](_0xa778('0x3c'),_0x5668f6,JSON['stringify'](_0x1b7d32));_0x58e428(_0x1b7d32);})[_0xa778('0x14')](function(_0x302ebf){logger[_0xa778('0xf')](_0xa778('0x3c'),_0x302ebf[_0xa778('0x11')],_0x5668f6);_0x35dbfa(_0x4bd171[_0xa778('0xf')](0x1f4,_0x302ebf[_0xa778('0x11')]));});});};exports[_0xa778('0x42')]=function(_0x4b2ec0){var _0x512dbe=this;return new Promise(function(_0x5c763c,_0x725142){return db['CmContact'][_0xa778('0x29')]()[_0xa778('0xb')](function(_0x34c596){return db[_0xa778('0x37')][_0xa778('0x38')](function(_0x2319f0){return db[_0xa778('0x16')][_0xa778('0x17')]({'where':_0x4b2ec0[_0xa778('0x18')]?_0x4b2ec0[_0xa778('0x18')]['where']||null:null,'attributes':_0x4b2ec0['options']?_0x4b2ec0[_0xa778('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x4b2ec0[_0xa778('0x18')]?_0x4b2ec0[_0xa778('0x18')][_0xa778('0x2a')]||null:null,'group':db[_0xa778('0x16')]['UserId'],'transaction':_0x2319f0,'lock':_0x2319f0[_0xa778('0x43')][_0xa778('0x2b')],'include':_0x4b2ec0[_0xa778('0x18')]?_0x4b2ec0[_0xa778('0x18')]['include']?_['map'](_0x4b2ec0['options'][_0xa778('0x1c')],function(_0x56c054){return{'model':db[_0x56c054[_0xa778('0x20')]],'as':_0x56c054['as'],'attributes':_0x56c054[_0xa778('0x1b')],'include':_0x56c054[_0xa778('0x1c')]?_[_0xa778('0x1d')](_0x56c054['include'],function(_0x3a1044){return{'model':db[_0x3a1044[_0xa778('0x20')]],'as':_0x3a1044['as'],'attributes':_0x3a1044[_0xa778('0x1b')],'include':_0x3a1044[_0xa778('0x1c')]?_[_0xa778('0x1d')](_0x3a1044['include'],function(_0x4ec472){return{'model':db[_0x4ec472[_0xa778('0x20')]],'as':_0x4ec472['as'],'attributes':_0x4ec472[_0xa778('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x413907){var _0x1a34eb=[];for(var _0x44ddf5=0x0;_0x44ddf5<_0x413907[_0xa778('0x2d')];_0x44ddf5+=0x1){_0x1a34eb['push'](_0x413907[_0x44ddf5][_0xa778('0x2f')](_0x4b2ec0[_0xa778('0x24')],{'transaction':_0x2319f0}));}return BPromise[_0xa778('0x31')](_0x1a34eb);});})['then'](function(_0x50d82c){logger['info'](_0xa778('0x42'),_0x4b2ec0);logger[_0xa778('0xe')](_0xa778('0x42'),_0x4b2ec0,JSON[_0xa778('0x21')](_0x50d82c));_0x5c763c(_0x50d82c);})[_0xa778('0x14')](function(_0x15ea7a){logger[_0xa778('0xf')](_0xa778('0x42'),_0x15ea7a[_0xa778('0x11')],_0x4b2ec0);_0x725142(_0x512dbe[_0xa778('0xf')](0x1f4,_0x15ea7a[_0xa778('0x11')]));});});});};exports[_0xa778('0x44')]=function(_0x54e91c){var _0x44665e=this;return new Promise(function(_0x49c0d5,_0x337878){db[_0xa778('0x28')]['describe']()[_0xa778('0xb')](function(_0x2dded4){return db[_0xa778('0x16')][_0xa778('0x17')]({'raw':_0x54e91c[_0xa778('0x18')]?_0x54e91c[_0xa778('0x18')][_0xa778('0x19')]===undefined?!![]:![]:!![],'where':_0x54e91c[_0xa778('0x18')]?_0x54e91c[_0xa778('0x18')][_0xa778('0x1a')]||null:null,'attributes':_0x54e91c[_0xa778('0x18')]?_0x54e91c[_0xa778('0x18')][_0xa778('0x1b')]||null:null,'limit':_0x54e91c[_0xa778('0x18')]?_0x54e91c[_0xa778('0x18')][_0xa778('0x25')]||null:null,'include':_0x54e91c[_0xa778('0x18')]?_0x54e91c[_0xa778('0x18')][_0xa778('0x1c')]?_[_0xa778('0x1d')](_0x54e91c[_0xa778('0x18')][_0xa778('0x1c')],function(_0x3b7e1e){return{'model':db[_0x3b7e1e[_0xa778('0x20')]],'as':_0x3b7e1e['as'],'attributes':_0x3b7e1e['as']===_0xa778('0x45')?_[_0xa778('0x2c')](_0x2dded4):_0x3b7e1e[_0xa778('0x1b')],'include':_0x3b7e1e[_0xa778('0x1c')]?_[_0xa778('0x1d')](_0x3b7e1e['include'],function(_0x26defe){return{'model':db[_0x26defe[_0xa778('0x20')]],'as':_0x26defe['as'],'attributes':_0x26defe[_0xa778('0x1b')],'include':_0x26defe[_0xa778('0x1c')]?_[_0xa778('0x1d')](_0x26defe[_0xa778('0x1c')],function(_0x399158){return{'model':db[_0x399158[_0xa778('0x20')]],'as':_0x399158['as'],'attributes':_0x399158[_0xa778('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd24fab){logger[_0xa778('0x12')](_0xa778('0x15'),_0x54e91c);logger[_0xa778('0xe')](_0xa778('0x15'),_0x54e91c,JSON['stringify'](_0xd24fab));_0x49c0d5(_0xd24fab);})[_0xa778('0x14')](function(_0x2e180b){logger[_0xa778('0xf')]('GetCmHopper',_0x2e180b[_0xa778('0x11')],_0x54e91c);_0x337878(_0x44665e['error'](0x1f4,_0x2e180b['message']));});});});};exports[_0xa778('0x46')]=function(_0x43ee20){var _0x3c9035=this;return new Promise(function(_0x4764e6,_0x3e2252){return db[_0xa778('0x28')][_0xa778('0x47')]({'raw':!![],'where':{'phone':_0x43ee20[_0xa778('0x18')][_0xa778('0x1a')][_0xa778('0x48')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0xa778('0xb')](function(_0x3157f8){logger['info'](_0xa778('0x49'),_0x43ee20);logger[_0xa778('0xe')]('getContactByPhone',_0x43ee20,JSON[_0xa778('0x21')](_0x3157f8));_0x4764e6(_0x3157f8);})['catch'](function(_0x1ea4eb){logger[_0xa778('0xf')](_0xa778('0x49'),_0x1ea4eb[_0xa778('0x11')],_0x43ee20);_0x3e2252(_0x3c9035[_0xa778('0xf')](0x1f4,_0x1ea4eb[_0xa778('0x11')]));});});};exports[_0xa778('0x4a')]=function(_0x1e4c7c){var _0x1d44b6=this;return new Promise(function(_0x4adc13,_0x4c460e){return db['sequelize'][_0xa778('0x38')](function(_0x400fba){return db[_0xa778('0x16')]['update']({'active':![]},{'where':{},'transaction':_0x400fba})[_0xa778('0xb')](function(_0x41d408){logger['info']('ResetActiveCalls',_0x1e4c7c);logger['debug'](_0xa778('0x4a'),_0x1e4c7c,JSON[_0xa778('0x21')](_0x41d408));_0x4adc13(_0x41d408);})[_0xa778('0x14')](function(_0x32a5fa){logger['error'](_0xa778('0x4a'),_0x32a5fa[_0xa778('0x11')],_0x1e4c7c);_0x4c460e(_0x1d44b6['error'](0x1f4,_0x32a5fa[_0xa778('0x11')]));});});});};exports[_0xa778('0x4b')]=function(_0x547eec){var _0x185757=this;var _0x4d664c=_0x547eec[_0xa778('0x24')][_0xa778('0x1a')][_0xa778('0x4c')];var _0x38788e=_0x547eec[_0xa778('0x24')][_0xa778('0x1a')][_0xa778('0x4d')];return new Promise(function(_0x40b337,_0x530cc4){return db[_0xa778('0x16')][_0xa778('0x17')]({'where':{'voiceQueueId':_0x4d664c,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0xa778('0x3e')](_0xa778('0x4e')+_0x38788e+_0xa778('0x4f'))}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0xa778('0x50')],'as':_0xa778('0x51'),'attributes':['id',_0xa778('0x52'),_0xa778('0x53')]},{'model':db[_0xa778('0x54')],'as':_0xa778('0x55')}]})[_0xa778('0xb')](function(_0x52e191){return db[_0xa778('0x37')][_0xa778('0x38')](function(_0x452b2a){return db['CmHopper'][_0xa778('0x2f')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x4d664c,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0xa778('0x3e')](_0xa778('0x4e')+_0x38788e+_0xa778('0x4f'))}},'transaction':_0x452b2a})[_0xa778('0xb')](function(_0x1be3c2){_0x40b337(_0x52e191);})[_0xa778('0x14')](function(_0x47ebe6){logger[_0xa778('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x47ebe6['message'],_0x547eec);_0x530cc4(validateExpressRequest);});});})[_0xa778('0x14')](function(_0x1bf572){logger[_0xa778('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x1bf572[_0xa778('0x11')],_0x547eec);_0x530cc4(_0x185757[_0xa778('0xf')](0x1f4,_0x1bf572['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c8b6b72..101396f 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 _0x920a=['getTimezone','getPreviewRecall','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','/opencontacts','getOpenContacts','/timezones','show','create','post','/preview','getPreview','/timezone'];(function(_0x5385bd,_0x4b15e6){var _0x3cc83a=function(_0x557a4f){while(--_0x557a4f){_0x5385bd['push'](_0x5385bd['shift']());}};_0x3cc83a(++_0x4b15e6);}(_0x920a,0x1ac));var _0xa920=function(_0x45aea8,_0x1a3f82){_0x45aea8=_0x45aea8-0x0;var _0x25b5e7=_0x920a[_0x45aea8];return _0x25b5e7;};'use strict';var multer=require(_0xa920('0x0'));var util=require('util');var path=require(_0xa920('0x1'));var timeout=require('connect-timeout');var express=require(_0xa920('0x2'));var router=express[_0xa920('0x3')]();var fs_extra=require(_0xa920('0x4'));var auth=require(_0xa920('0x5'));var interaction=require(_0xa920('0x6'));var config=require(_0xa920('0x7'));var controller=require(_0xa920('0x8'));router['get']('/',auth[_0xa920('0x9')](),controller[_0xa920('0xa')]);router[_0xa920('0xb')](_0xa920('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xa920('0xb')](_0xa920('0xd'),auth['isAuthenticated'](),controller[_0xa920('0xe')]);router[_0xa920('0xb')](_0xa920('0xf'),auth[_0xa920('0x9')](),controller['getTimezones']);router[_0xa920('0xb')]('/:id',auth[_0xa920('0x9')](),controller[_0xa920('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa920('0x11')]);router[_0xa920('0x12')](_0xa920('0x13'),auth[_0xa920('0x9')](),controller[_0xa920('0x14')]);router[_0xa920('0x12')](_0xa920('0x15'),auth['isAuthenticated'](),controller[_0xa920('0x16')]);router['post']('/previewrecall',auth['isAuthenticated'](),controller[_0xa920('0x17')]);router[_0xa920('0x18')](_0xa920('0x19'),auth[_0xa920('0x9')](),controller[_0xa920('0x1a')]);router[_0xa920('0x1b')](_0xa920('0x19'),auth[_0xa920('0x9')](),controller[_0xa920('0x1c')]);module[_0xa920('0x1d')]=router; \ No newline at end of file +var _0xcdbd=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','getTimezones','show','post','create','/preview','getPreview','/timezone','/previewrecall','getPreviewRecall','put','/:id','delete','multer','path'];(function(_0x20b96a,_0x56424c){var _0x371718=function(_0x2fa4eb){while(--_0x2fa4eb){_0x20b96a['push'](_0x20b96a['shift']());}};_0x371718(++_0x56424c);}(_0xcdbd,0x15d));var _0xdcdb=function(_0x46e729,_0x9be3fb){_0x46e729=_0x46e729-0x0;var _0x5ccb52=_0xcdbd[_0x46e729];return _0x5ccb52;};'use strict';var multer=require(_0xdcdb('0x0'));var util=require('util');var path=require(_0xdcdb('0x1'));var timeout=require(_0xdcdb('0x2'));var express=require(_0xdcdb('0x3'));var router=express[_0xdcdb('0x4')]();var fs_extra=require(_0xdcdb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdcdb('0x6'));var config=require(_0xdcdb('0x7'));var controller=require(_0xdcdb('0x8'));router[_0xdcdb('0x9')]('/',auth[_0xdcdb('0xa')](),controller[_0xdcdb('0xb')]);router[_0xdcdb('0x9')]('/describe',auth[_0xdcdb('0xa')](),controller[_0xdcdb('0xc')]);router[_0xdcdb('0x9')](_0xdcdb('0xd'),auth[_0xdcdb('0xa')](),controller[_0xdcdb('0xe')]);router[_0xdcdb('0x9')]('/timezones',auth[_0xdcdb('0xa')](),controller[_0xdcdb('0xf')]);router[_0xdcdb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdcdb('0x10')]);router[_0xdcdb('0x11')]('/',auth[_0xdcdb('0xa')](),controller[_0xdcdb('0x12')]);router[_0xdcdb('0x11')](_0xdcdb('0x13'),auth[_0xdcdb('0xa')](),controller[_0xdcdb('0x14')]);router['post'](_0xdcdb('0x15'),auth[_0xdcdb('0xa')](),controller['getTimezone']);router[_0xdcdb('0x11')](_0xdcdb('0x16'),auth[_0xdcdb('0xa')](),controller[_0xdcdb('0x17')]);router[_0xdcdb('0x18')](_0xdcdb('0x19'),auth[_0xdcdb('0xa')](),controller['update']);router[_0xdcdb('0x1a')](_0xdcdb('0x19'),auth[_0xdcdb('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 89fc4c8..f6dc3ab 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 _0x952a=['STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x3ee39a,_0x511194){var _0x28b454=function(_0x80c084){while(--_0x80c084){_0x3ee39a['push'](_0x3ee39a['shift']());}};_0x28b454(++_0x511194);}(_0x952a,0x1b1));var _0xa952=function(_0x7a7889,_0x5d61d7){_0x7a7889=_0x7a7889-0x0;var _0x251510=_0x952a[_0x7a7889];return _0x251510;};'use strict';var moment=require(_0xa952('0x0'));var Sequelize=require(_0xa952('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa952('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa952('0x3')],'unique':_0xa952('0x4')},'ListId':{'type':Sequelize[_0xa952('0x3')],'unique':_0xa952('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa952('0x4')}}; \ No newline at end of file +var _0xc903=['moment','exports','contactListQueue'];(function(_0x5d2be6,_0x235a54){var _0x55a749=function(_0x1bab3b){while(--_0x1bab3b){_0x5d2be6['push'](_0x5d2be6['shift']());}};_0x55a749(++_0x235a54);}(_0xc903,0x177));var _0x3c90=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xc903[_0x1df7b8];return _0x29d911;};'use strict';var moment=require(_0x3c90('0x0'));var Sequelize=require('sequelize');module[_0x3c90('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x3c90('0x2')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3c90('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x3c90('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1d88aef..0ae6154 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 _0x3281=['update','then','destroy','sendStatus','error','name','send','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','length','options','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x1c41f5,_0x443b60){var _0x56a664=function(_0x2e704d){while(--_0x2e704d){_0x1c41f5['push'](_0x1c41f5['shift']());}};_0x56a664(++_0x443b60);}(_0x3281,0xbe));var _0x1328=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3281[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1328('0x0'));var zipdir=require(_0x1328('0x1'));var jsonpatch=require(_0x1328('0x2'));var rp=require(_0x1328('0x3'));var moment=require(_0x1328('0x4'));var BPromise=require(_0x1328('0x5'));var Mustache=require(_0x1328('0x6'));var util=require(_0x1328('0x7'));var path=require(_0x1328('0x8'));var sox=require(_0x1328('0x9'));var csv=require(_0x1328('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1328('0xb'));var _=require(_0x1328('0xc'));var squel=require('squel');var crypto=require(_0x1328('0xd'));var jsforce=require(_0x1328('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1328('0xf'));var Redis=require(_0x1328('0x10'));var authService=require(_0x1328('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1328('0x12'));var logger=require(_0x1328('0x13'))(_0x1328('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1328('0x15'));var db=require(_0x1328('0x16'))['db'];function respondWithStatusCode(_0x4c4f97,_0x24b678){_0x24b678=_0x24b678||0xcc;return function(_0x266253){if(_0x266253){return _0x4c4f97['sendStatus'](_0x24b678);}return _0x4c4f97[_0x1328('0x17')](_0x24b678)[_0x1328('0x18')]();};}function respondWithResult(_0x5503fc,_0x28c40b){_0x28c40b=_0x28c40b||0xc8;return function(_0x438461){if(_0x438461){return _0x5503fc['status'](_0x28c40b)[_0x1328('0x19')](_0x438461);}};}function respondWithFilteredResult(_0x5566d1,_0x512481){return function(_0x18dd7a){if(_0x18dd7a){var _0xdba798=typeof _0x512481[_0x1328('0x1a')]===_0x1328('0x1b')&&typeof _0x512481[_0x1328('0x1c')]===_0x1328('0x1b');var _0x2cbbe7=_0x18dd7a[_0x1328('0x1d')];var _0xd839f9=_0xdba798?0x0:_0x512481['offset'];var _0x50ee36=_0xdba798?_0x18dd7a['count']:_0x512481['offset']+_0x512481[_0x1328('0x1c')];var _0x14d0e9;if(_0x50ee36>=_0x2cbbe7){_0x50ee36=_0x2cbbe7;_0x14d0e9=0xc8;}else{_0x14d0e9=0xce;}_0x5566d1['status'](_0x14d0e9);return _0x5566d1[_0x1328('0x1e')](_0x1328('0x1f'),_0xd839f9+'-'+_0x50ee36+'/'+_0x2cbbe7)[_0x1328('0x19')](_0x18dd7a);}return null;};}function patchUpdates(_0x2ff33d){return function(_0x4becaf){try{jsonpatch[_0x1328('0x20')](_0x4becaf,_0x2ff33d,!![]);}catch(_0x4b0863){return BPromise[_0x1328('0x21')](_0x4b0863);}return _0x4becaf[_0x1328('0x22')]();};}function saveUpdates(_0x496766,_0x533d6e){return function(_0x589573){if(_0x589573){return _0x589573[_0x1328('0x23')](_0x496766)[_0x1328('0x24')](function(_0x4c302d){return _0x4c302d;});}return null;};}function removeEntity(_0x3c9a24,_0xa2d361){return function(_0x5dc825){if(_0x5dc825){return _0x5dc825[_0x1328('0x25')]()[_0x1328('0x24')](function(){_0x3c9a24[_0x1328('0x17')](0xcc)[_0x1328('0x18')]();});}};}function handleEntityNotFound(_0x1ecdc6,_0xb4d68b){return function(_0x14e580){if(!_0x14e580){_0x1ecdc6[_0x1328('0x26')](0x194);}return _0x14e580;};}function handleError(_0x427952,_0x2467d9){_0x2467d9=_0x2467d9||0x1f4;return function(_0x299129){logger[_0x1328('0x27')](_0x299129['stack']);if(_0x299129[_0x1328('0x28')]){delete _0x299129['name'];}_0x427952['status'](_0x2467d9)[_0x1328('0x29')](_0x299129);};}exports['index']=function(_0x4af920,_0x19e29b){var _0x37a296={},_0x4e84f6={},_0x392ee9={'count':0x0,'rows':[]};var _0x565048=_[_0x1328('0x2a')](db[_0x1328('0x2b')][_0x1328('0x2c')],function(_0x4d962a){return{'name':_0x4d962a[_0x1328('0x2d')],'type':_0x4d962a['type'][_0x1328('0x2e')]};});_0x4e84f6[_0x1328('0x2f')]=_['map'](_0x565048,_0x1328('0x28'));_0x4e84f6[_0x1328('0x30')]=_[_0x1328('0x31')](_0x4af920[_0x1328('0x30')]);_0x4e84f6[_0x1328('0x32')]=_[_0x1328('0x33')](_0x4e84f6['model'],_0x4e84f6[_0x1328('0x30')]);_0x37a296['attributes']=_[_0x1328('0x33')](_0x4e84f6[_0x1328('0x2f')],qs[_0x1328('0x34')](_0x4af920[_0x1328('0x30')][_0x1328('0x34')]));_0x37a296[_0x1328('0x35')]=_0x37a296[_0x1328('0x35')]['length']?_0x37a296['attributes']:_0x4e84f6[_0x1328('0x2f')];if(!_0x4af920[_0x1328('0x30')][_0x1328('0x36')](_0x1328('0x37'))){_0x37a296['limit']=qs[_0x1328('0x1c')](_0x4af920['query'][_0x1328('0x1c')]);_0x37a296[_0x1328('0x1a')]=qs[_0x1328('0x1a')](_0x4af920['query'][_0x1328('0x1a')]);}_0x37a296[_0x1328('0x38')]=qs['sort'](_0x4af920[_0x1328('0x30')][_0x1328('0x39')]);_0x37a296[_0x1328('0x3a')]=qs[_0x1328('0x32')](_[_0x1328('0x3b')](_0x4af920['query'],_0x4e84f6['filters']),_0x565048);if(_0x4af920[_0x1328('0x30')]['filter']){_0x37a296[_0x1328('0x3a')]=_[_0x1328('0x3c')](_0x37a296[_0x1328('0x3a')],{'$or':_['map'](_0x565048,function(_0x2ddde1){if(_0x2ddde1[_0x1328('0x3d')]!==_0x1328('0x3e')){var _0x6ee817={};_0x6ee817[_0x2ddde1[_0x1328('0x28')]]={'$like':'%'+_0x4af920['query'][_0x1328('0x3f')]+'%'};return _0x6ee817;}})});}_0x37a296=_[_0x1328('0x3c')]({},_0x37a296,_0x4af920['options']);var _0x4590a9={'where':_0x37a296[_0x1328('0x3a')]};return db[_0x1328('0x2b')][_0x1328('0x1d')](_0x4590a9)[_0x1328('0x24')](function(_0x2e1b6e){_0x392ee9['count']=_0x2e1b6e;if(_0x4af920[_0x1328('0x30')][_0x1328('0x40')]){_0x37a296[_0x1328('0x41')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x37a296);})[_0x1328('0x24')](function(_0x3c0b4e){_0x392ee9[_0x1328('0x42')]=_0x3c0b4e;return _0x392ee9;})[_0x1328('0x24')](respondWithFilteredResult(_0x19e29b,_0x37a296))[_0x1328('0x43')](handleError(_0x19e29b,null));};exports[_0x1328('0x44')]=function(_0x16344b,_0x53befc){var _0x4e3599={'raw':!![],'where':{'id':_0x16344b[_0x1328('0x45')]['id']}},_0x406554={};_0x406554['model']=_[_0x1328('0x31')](db[_0x1328('0x2b')]['rawAttributes']);_0x406554[_0x1328('0x30')]=_[_0x1328('0x31')](_0x16344b['query']);_0x406554[_0x1328('0x32')]=_[_0x1328('0x33')](_0x406554[_0x1328('0x2f')],_0x406554['query']);_0x4e3599['attributes']=_[_0x1328('0x33')](_0x406554[_0x1328('0x2f')],qs[_0x1328('0x34')](_0x16344b[_0x1328('0x30')][_0x1328('0x34')]));_0x4e3599[_0x1328('0x35')]=_0x4e3599['attributes'][_0x1328('0x46')]?_0x4e3599[_0x1328('0x35')]:_0x406554[_0x1328('0x2f')];if(_0x16344b[_0x1328('0x30')]['includeAll']){_0x4e3599[_0x1328('0x41')]=[{'all':!![]}];}_0x4e3599=_['merge']({},_0x4e3599,_0x16344b[_0x1328('0x47')]);return db[_0x1328('0x2b')][_0x1328('0x48')](_0x4e3599)[_0x1328('0x24')](handleEntityNotFound(_0x53befc,null))[_0x1328('0x24')](respondWithResult(_0x53befc,null))[_0x1328('0x43')](handleError(_0x53befc,null));};exports['update']=function(_0x1a5a6c,_0x53ccf5){if(_0x1a5a6c[_0x1328('0x49')]['id']){delete _0x1a5a6c[_0x1328('0x49')]['id'];}return db[_0x1328('0x2b')][_0x1328('0x48')]({'where':{'id':_0x1a5a6c['params']['id']}})['then'](handleEntityNotFound(_0x53ccf5,null))[_0x1328('0x24')](saveUpdates(_0x1a5a6c[_0x1328('0x49')],null))[_0x1328('0x24')](respondWithResult(_0x53ccf5,null))[_0x1328('0x43')](handleError(_0x53ccf5,null));};exports[_0x1328('0x25')]=function(_0x10b4ed,_0x3dabae){return db[_0x1328('0x2b')][_0x1328('0x48')]({'where':{'id':_0x10b4ed[_0x1328('0x45')]['id']}})[_0x1328('0x24')](handleEntityNotFound(_0x3dabae,null))['then'](removeEntity(_0x3dabae,null))['catch'](handleError(_0x3dabae,null));};exports[_0x1328('0x4a')]=function(_0x503898,_0x55c52c){return db[_0x1328('0x2b')][_0x1328('0x4a')]()['then'](respondWithResult(_0x55c52c,null))[_0x1328('0x43')](handleError(_0x55c52c,null));}; \ No newline at end of file +var _0x59f2=['limit','count','set','apply','then','destroy','sendStatus','error','name','send','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','undefined'];(function(_0x13d2d4,_0x1d142b){var _0x3ec793=function(_0x4593f4){while(--_0x4593f4){_0x13d2d4['push'](_0x13d2d4['shift']());}};_0x3ec793(++_0x1d142b);}(_0x59f2,0xb3));var _0x259f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x59f2[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x259f('0x0'));var rp=require('request-promise');var moment=require(_0x259f('0x1'));var BPromise=require(_0x259f('0x2'));var Mustache=require(_0x259f('0x3'));var util=require(_0x259f('0x4'));var path=require('path');var sox=require(_0x259f('0x5'));var csv=require(_0x259f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x259f('0x7'));var squel=require(_0x259f('0x8'));var crypto=require(_0x259f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x259f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x259f('0xb'));var Papa=require(_0x259f('0xc'));var Redis=require(_0x259f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x259f('0xe'));var as=require(_0x259f('0xf'));var hardwareService=require(_0x259f('0x10'));var logger=require('../../config/logger')(_0x259f('0x11'));var utils=require(_0x259f('0x12'));var config=require(_0x259f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314e55,_0x31a57f){_0x31a57f=_0x31a57f||0xcc;return function(_0x4d130f){if(_0x4d130f){return _0x314e55['sendStatus'](_0x31a57f);}return _0x314e55[_0x259f('0x14')](_0x31a57f)[_0x259f('0x15')]();};}function respondWithResult(_0x4007d9,_0xea5fa){_0xea5fa=_0xea5fa||0xc8;return function(_0x12a6ef){if(_0x12a6ef){return _0x4007d9[_0x259f('0x14')](_0xea5fa)[_0x259f('0x16')](_0x12a6ef);}};}function respondWithFilteredResult(_0x421c66,_0x4cb8a3){return function(_0x333c38){if(_0x333c38){var _0x447145=typeof _0x4cb8a3[_0x259f('0x17')]===_0x259f('0x18')&&typeof _0x4cb8a3[_0x259f('0x19')]===_0x259f('0x18');var _0x3303ca=_0x333c38[_0x259f('0x1a')];var _0x6daf07=_0x447145?0x0:_0x4cb8a3[_0x259f('0x17')];var _0x39e4ab=_0x447145?_0x333c38[_0x259f('0x1a')]:_0x4cb8a3['offset']+_0x4cb8a3[_0x259f('0x19')];var _0x4343b5;if(_0x39e4ab>=_0x3303ca){_0x39e4ab=_0x3303ca;_0x4343b5=0xc8;}else{_0x4343b5=0xce;}_0x421c66['status'](_0x4343b5);return _0x421c66[_0x259f('0x1b')]('Content-Range',_0x6daf07+'-'+_0x39e4ab+'/'+_0x3303ca)[_0x259f('0x16')](_0x333c38);}return null;};}function patchUpdates(_0x225d21){return function(_0x4d69c4){try{jsonpatch[_0x259f('0x1c')](_0x4d69c4,_0x225d21,!![]);}catch(_0x395a9e){return BPromise['reject'](_0x395a9e);}return _0x4d69c4['save']();};}function saveUpdates(_0x33b646,_0x3832b0){return function(_0x163d83){if(_0x163d83){return _0x163d83['update'](_0x33b646)[_0x259f('0x1d')](function(_0x55a58e){return _0x55a58e;});}return null;};}function removeEntity(_0xb78775,_0x55a9e0){return function(_0x42b578){if(_0x42b578){return _0x42b578[_0x259f('0x1e')]()[_0x259f('0x1d')](function(){_0xb78775[_0x259f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23079d,_0x4e3413){return function(_0x24de04){if(!_0x24de04){_0x23079d[_0x259f('0x1f')](0x194);}return _0x24de04;};}function handleError(_0x549d37,_0x47bf4b){_0x47bf4b=_0x47bf4b||0x1f4;return function(_0x208698){logger[_0x259f('0x20')](_0x208698['stack']);if(_0x208698[_0x259f('0x21')]){delete _0x208698[_0x259f('0x21')];}_0x549d37[_0x259f('0x14')](_0x47bf4b)[_0x259f('0x22')](_0x208698);};}exports['index']=function(_0x4c339b,_0x341635){var _0x47bf1e={},_0xc32493={},_0x14aef7={'count':0x0,'rows':[]};var _0x535b48=_[_0x259f('0x23')](db[_0x259f('0x24')][_0x259f('0x25')],function(_0x22ef0a){return{'name':_0x22ef0a[_0x259f('0x26')],'type':_0x22ef0a['type'][_0x259f('0x27')]};});_0xc32493[_0x259f('0x28')]=_[_0x259f('0x23')](_0x535b48,_0x259f('0x21'));_0xc32493[_0x259f('0x29')]=_[_0x259f('0x2a')](_0x4c339b[_0x259f('0x29')]);_0xc32493[_0x259f('0x2b')]=_[_0x259f('0x2c')](_0xc32493[_0x259f('0x28')],_0xc32493['query']);_0x47bf1e[_0x259f('0x2d')]=_[_0x259f('0x2c')](_0xc32493['model'],qs[_0x259f('0x2e')](_0x4c339b[_0x259f('0x29')][_0x259f('0x2e')]));_0x47bf1e[_0x259f('0x2d')]=_0x47bf1e[_0x259f('0x2d')][_0x259f('0x2f')]?_0x47bf1e[_0x259f('0x2d')]:_0xc32493[_0x259f('0x28')];if(!_0x4c339b[_0x259f('0x29')][_0x259f('0x30')](_0x259f('0x31'))){_0x47bf1e[_0x259f('0x19')]=qs[_0x259f('0x19')](_0x4c339b[_0x259f('0x29')][_0x259f('0x19')]);_0x47bf1e['offset']=qs[_0x259f('0x17')](_0x4c339b[_0x259f('0x29')][_0x259f('0x17')]);}_0x47bf1e[_0x259f('0x32')]=qs['sort'](_0x4c339b[_0x259f('0x29')][_0x259f('0x33')]);_0x47bf1e['where']=qs[_0x259f('0x2b')](_['pick'](_0x4c339b[_0x259f('0x29')],_0xc32493['filters']),_0x535b48);if(_0x4c339b['query']['filter']){_0x47bf1e[_0x259f('0x34')]=_['merge'](_0x47bf1e[_0x259f('0x34')],{'$or':_['map'](_0x535b48,function(_0x2732ea){if(_0x2732ea[_0x259f('0x35')]!==_0x259f('0x36')){var _0x1cd5c5={};_0x1cd5c5[_0x2732ea[_0x259f('0x21')]]={'$like':'%'+_0x4c339b[_0x259f('0x29')][_0x259f('0x37')]+'%'};return _0x1cd5c5;}})});}_0x47bf1e=_[_0x259f('0x38')]({},_0x47bf1e,_0x4c339b[_0x259f('0x39')]);var _0x122026={'where':_0x47bf1e[_0x259f('0x34')]};return db['CmHopperBlack']['count'](_0x122026)['then'](function(_0x3d402a){_0x14aef7[_0x259f('0x1a')]=_0x3d402a;if(_0x4c339b[_0x259f('0x29')][_0x259f('0x3a')]){_0x47bf1e[_0x259f('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x259f('0x3c')](_0x47bf1e);})[_0x259f('0x1d')](function(_0x5542a1){_0x14aef7[_0x259f('0x3d')]=_0x5542a1;return _0x14aef7;})[_0x259f('0x1d')](respondWithFilteredResult(_0x341635,_0x47bf1e))[_0x259f('0x3e')](handleError(_0x341635,null));};exports[_0x259f('0x3f')]=function(_0x4a01a8,_0xdc25a4){var _0x5ea1e3={'raw':!![],'where':{'id':_0x4a01a8['params']['id']}},_0x45774b={};_0x45774b[_0x259f('0x28')]=_['keys'](db[_0x259f('0x24')][_0x259f('0x25')]);_0x45774b[_0x259f('0x29')]=_[_0x259f('0x2a')](_0x4a01a8[_0x259f('0x29')]);_0x45774b[_0x259f('0x2b')]=_[_0x259f('0x2c')](_0x45774b['model'],_0x45774b[_0x259f('0x29')]);_0x5ea1e3[_0x259f('0x2d')]=_[_0x259f('0x2c')](_0x45774b[_0x259f('0x28')],qs[_0x259f('0x2e')](_0x4a01a8[_0x259f('0x29')]['fields']));_0x5ea1e3[_0x259f('0x2d')]=_0x5ea1e3[_0x259f('0x2d')][_0x259f('0x2f')]?_0x5ea1e3[_0x259f('0x2d')]:_0x45774b[_0x259f('0x28')];if(_0x4a01a8['query'][_0x259f('0x3a')]){_0x5ea1e3[_0x259f('0x3b')]=[{'all':!![]}];}_0x5ea1e3=_['merge']({},_0x5ea1e3,_0x4a01a8[_0x259f('0x39')]);return db[_0x259f('0x24')][_0x259f('0x40')](_0x5ea1e3)['then'](handleEntityNotFound(_0xdc25a4,null))[_0x259f('0x1d')](respondWithResult(_0xdc25a4,null))['catch'](handleError(_0xdc25a4,null));};exports['update']=function(_0xe4ff,_0x114461){if(_0xe4ff[_0x259f('0x41')]['id']){delete _0xe4ff[_0x259f('0x41')]['id'];}return db[_0x259f('0x24')]['find']({'where':{'id':_0xe4ff[_0x259f('0x42')]['id']}})['then'](handleEntityNotFound(_0x114461,null))['then'](saveUpdates(_0xe4ff[_0x259f('0x41')],null))[_0x259f('0x1d')](respondWithResult(_0x114461,null))[_0x259f('0x3e')](handleError(_0x114461,null));};exports[_0x259f('0x1e')]=function(_0x1e6a3f,_0xcbcb44){return db[_0x259f('0x24')][_0x259f('0x40')]({'where':{'id':_0x1e6a3f[_0x259f('0x42')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0xcbcb44,null))[_0x259f('0x1d')](removeEntity(_0xcbcb44,null))['catch'](handleError(_0xcbcb44,null));};exports[_0x259f('0x43')]=function(_0x521a42,_0x47e8a3){return db['CmHopperBlack'][_0x259f('0x43')]()[_0x259f('0x1d')](respondWithResult(_0x47e8a3,null))[_0x259f('0x3e')](handleError(_0x47e8a3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a098f8f..dcf6ba9 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 _0xb752=['bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','define','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xb752,0x125));var _0x2b75=function(_0x5906ee,_0x4cbb5a){_0x5906ee=_0x5906ee-0x0;var _0x26775d=_0xb752[_0x5906ee];return _0x26775d;};'use strict';var _=require(_0x2b75('0x0'));var util=require(_0x2b75('0x1'));var logger=require(_0x2b75('0x2'))(_0x2b75('0x3'));var moment=require('moment');var BPromise=require(_0x2b75('0x4'));var rp=require(_0x2b75('0x5'));var fs=require('fs');var path=require(_0x2b75('0x6'));var rimraf=require('rimraf');var config=require(_0x2b75('0x7'));var attributes=require(_0x2b75('0x8'));module['exports']=function(_0x50a5d1,_0x561098){return _0x50a5d1[_0x2b75('0x9')]('CmHopperBlack',attributes,{'tableName':_0x2b75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa37b=['define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x488435,_0x15a36a){var _0x266b61=function(_0x5d81c3){while(--_0x5d81c3){_0x488435['push'](_0x488435['shift']());}};_0x266b61(++_0x15a36a);}(_0xa37b,0xe3));var _0xba37=function(_0x3f5bf5,_0x498786){_0x3f5bf5=_0x3f5bf5-0x0;var _0x59e229=_0xa37b[_0x3f5bf5];return _0x59e229;};'use strict';var _=require(_0xba37('0x0'));var util=require(_0xba37('0x1'));var logger=require(_0xba37('0x2'))(_0xba37('0x3'));var moment=require(_0xba37('0x4'));var BPromise=require('bluebird');var rp=require(_0xba37('0x5'));var fs=require('fs');var path=require(_0xba37('0x6'));var rimraf=require(_0xba37('0x7'));var config=require(_0xba37('0x8'));var attributes=require(_0xba37('0x9'));module[_0xba37('0xa')]=function(_0x25898e,_0xf2b096){return _0x25898e[_0xba37('0xb')](_0xba37('0xc'),attributes,{'tableName':_0xba37('0xd'),'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 f16f249..33b710b 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 _0xfb2d=['debug','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCmHopperBlack'];(function(_0x183518,_0x51e545){var _0x40afaf=function(_0x1dfd4a){while(--_0x1dfd4a){_0x183518['push'](_0x183518['shift']());}};_0x40afaf(++_0x51e545);}(_0xfb2d,0x95));var _0xdfb2=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0xfb2d[_0x166e96];return _0x553d73;};'use strict';var _=require('lodash');var util=require(_0xdfb2('0x0'));var moment=require(_0xdfb2('0x1'));var BPromise=require('bluebird');var rs=require(_0xdfb2('0x2'));var fs=require('fs');var Redis=require(_0xdfb2('0x3'));var db=require(_0xdfb2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfb2('0x5'))('rpc');var config=require(_0xdfb2('0x6'));var jayson=require(_0xdfb2('0x7'));var client=jayson[_0xdfb2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc54b,_0xf678ce,_0x452b57){return new BPromise(function(_0x55ebbf,_0x2e2d77){return client[_0xdfb2('0x9')](_0x3cc54b,_0x452b57)['then'](function(_0x1bad57){logger[_0xdfb2('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0xf678ce,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xf678ce,_0xdfb2('0xb'),JSON[_0xdfb2('0xc')](_0x1bad57));if(_0x1bad57[_0xdfb2('0xd')]){if(_0x1bad57[_0xdfb2('0xd')][_0xdfb2('0xe')]===0x1f4){logger[_0xdfb2('0xd')](_0xdfb2('0xf'),_0xf678ce,_0x1bad57[_0xdfb2('0xd')][_0xdfb2('0x10')]);return _0x2e2d77(_0x1bad57[_0xdfb2('0xd')][_0xdfb2('0x10')]);}logger['error'](_0xdfb2('0xf'),_0xf678ce,_0x1bad57[_0xdfb2('0xd')][_0xdfb2('0x10')]);return _0x55ebbf(_0x1bad57['error']['message']);}else{logger[_0xdfb2('0xa')](_0xdfb2('0xf'),_0xf678ce,_0xdfb2('0xb'));_0x55ebbf(_0x1bad57[_0xdfb2('0x11')]['message']);}})[_0xdfb2('0x12')](function(_0x1a62fc){logger[_0xdfb2('0xd')](_0xdfb2('0xf'),_0xf678ce,_0x1a62fc);_0x2e2d77(_0x1a62fc);});});}exports['GetCmHopperBlack']=function(_0xc8bf17){var _0x180610=this;return new Promise(function(_0x2d5fe2,_0x1d4058){return db[_0xdfb2('0x13')][_0xdfb2('0x14')]({'raw':_0xc8bf17[_0xdfb2('0x15')]?_0xc8bf17['options'][_0xdfb2('0x16')]===undefined?!![]:![]:!![],'where':_0xc8bf17[_0xdfb2('0x15')]?_0xc8bf17[_0xdfb2('0x15')][_0xdfb2('0x17')]||null:null,'attributes':_0xc8bf17['options']?_0xc8bf17[_0xdfb2('0x15')][_0xdfb2('0x18')]||null:null,'limit':_0xc8bf17[_0xdfb2('0x15')]?_0xc8bf17[_0xdfb2('0x15')][_0xdfb2('0x19')]||null:null,'include':_0xc8bf17[_0xdfb2('0x15')]?_0xc8bf17[_0xdfb2('0x15')][_0xdfb2('0x1a')]?_[_0xdfb2('0x1b')](_0xc8bf17[_0xdfb2('0x15')][_0xdfb2('0x1a')],function(_0x2a04b7){return{'model':db[_0x2a04b7['model']],'as':_0x2a04b7['as'],'attributes':_0x2a04b7['attributes'],'include':_0x2a04b7[_0xdfb2('0x1a')]?_[_0xdfb2('0x1b')](_0x2a04b7[_0xdfb2('0x1a')],function(_0x29d307){return{'model':db[_0x29d307[_0xdfb2('0x1c')]],'as':_0x29d307['as'],'attributes':_0x29d307[_0xdfb2('0x18')],'include':_0x29d307[_0xdfb2('0x1a')]?_[_0xdfb2('0x1b')](_0x29d307[_0xdfb2('0x1a')],function(_0x542f52){return{'model':db[_0x542f52[_0xdfb2('0x1c')]],'as':_0x542f52['as'],'attributes':_0x542f52['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfb2('0x1d')](function(_0x1b5425){logger[_0xdfb2('0xa')](_0xdfb2('0x1e'),_0xc8bf17);logger[_0xdfb2('0x1f')](_0xdfb2('0x1e'),_0xc8bf17,JSON['stringify'](_0x1b5425));_0x2d5fe2(_0x1b5425);})[_0xdfb2('0x12')](function(_0x394937){logger[_0xdfb2('0xd')](_0xdfb2('0x1e'),_0x394937[_0xdfb2('0x10')],_0xc8bf17);_0x1d4058(_0x180610['error'](0x1f4,_0x394937[_0xdfb2('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x4fab83){var _0x12513c=this;return new Promise(function(_0x2749f4,_0x2b5b8a){return db[_0xdfb2('0x13')]['update'](_0x4fab83[_0xdfb2('0x20')],{'raw':_0x4fab83[_0xdfb2('0x15')]?_0x4fab83[_0xdfb2('0x15')][_0xdfb2('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fab83[_0xdfb2('0x15')]?_0x4fab83[_0xdfb2('0x15')]['where']||null:null,'attributes':_0x4fab83[_0xdfb2('0x15')]?_0x4fab83[_0xdfb2('0x15')][_0xdfb2('0x18')]||null:null,'limit':_0x4fab83[_0xdfb2('0x15')]?_0x4fab83[_0xdfb2('0x15')][_0xdfb2('0x19')]||null:null})[_0xdfb2('0x1d')](function(_0x4683c4){logger['info'](_0xdfb2('0x21'),_0x4fab83);logger[_0xdfb2('0x1f')]('UpdateCmHopperBlack',_0x4fab83,JSON[_0xdfb2('0xc')](_0x4683c4));_0x2749f4(_0x4683c4);})[_0xdfb2('0x12')](function(_0x424121){logger[_0xdfb2('0xd')]('UpdateCmHopperBlack',_0x424121['message'],_0x4fab83);_0x2b5b8a(_0x12513c[_0xdfb2('0xd')](0x1f4,_0x424121[_0xdfb2('0x10')]));});});};exports[_0xdfb2('0x22')]=function(_0x1ddb6c){var _0x4d2039=this;return new Promise(function(_0x5c1c71,_0x19c05c){return db[_0xdfb2('0x13')][_0xdfb2('0x23')]({'where':_0x1ddb6c[_0xdfb2('0x15')]?_0x1ddb6c[_0xdfb2('0x15')][_0xdfb2('0x17')]||null:null})[_0xdfb2('0x1d')](function(_0x41f512){logger['info'](_0xdfb2('0x22'),_0x1ddb6c);logger[_0xdfb2('0x1f')](_0xdfb2('0x22'),_0x1ddb6c,JSON[_0xdfb2('0xc')](_0x41f512));_0x5c1c71(_0x41f512);})[_0xdfb2('0x12')](function(_0x4d3731){logger[_0xdfb2('0xd')](_0xdfb2('0x22'),_0x4d3731['message'],_0x1ddb6c);_0x19c05c(_0x4d2039[_0xdfb2('0xd')](0x1f4,_0x4d3731[_0xdfb2('0x10')]));});});}; \ No newline at end of file +var _0xc9eb=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','catch','UpdateCmHopperBlack','body','DestroyCmHopperBlack'];(function(_0x3b68aa,_0x5d0a18){var _0x326b07=function(_0x302a86){while(--_0x302a86){_0x3b68aa['push'](_0x3b68aa['shift']());}};_0x326b07(++_0x5d0a18);}(_0xc9eb,0x1c7));var _0xbc9e=function(_0x3f216b,_0x203686){_0x3f216b=_0x3f216b-0x0;var _0x548b01=_0xc9eb[_0x3f216b];return _0x548b01;};'use strict';var _=require('lodash');var util=require(_0xbc9e('0x0'));var moment=require('moment');var BPromise=require(_0xbc9e('0x1'));var rs=require(_0xbc9e('0x2'));var fs=require('fs');var Redis=require(_0xbc9e('0x3'));var db=require(_0xbc9e('0x4'))['db'];var utils=require(_0xbc9e('0x5'));var logger=require(_0xbc9e('0x6'))(_0xbc9e('0x7'));var config=require(_0xbc9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbc9e('0x9')][_0xbc9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bc00c,_0xf12aee,_0x772d43){return new BPromise(function(_0x43184b,_0x122951){return client['request'](_0x1bc00c,_0x772d43)[_0xbc9e('0xb')](function(_0x4b57d6){logger[_0xbc9e('0xc')](_0xbc9e('0xd'),_0xf12aee,'request\x20sent');logger[_0xbc9e('0xe')](_0xbc9e('0xf'),_0xf12aee,_0xbc9e('0x10'),JSON[_0xbc9e('0x11')](_0x4b57d6));if(_0x4b57d6[_0xbc9e('0x12')]){if(_0x4b57d6[_0xbc9e('0x12')]['code']===0x1f4){logger['error'](_0xbc9e('0xd'),_0xf12aee,_0x4b57d6[_0xbc9e('0x12')][_0xbc9e('0x13')]);return _0x122951(_0x4b57d6[_0xbc9e('0x12')][_0xbc9e('0x13')]);}logger[_0xbc9e('0x12')](_0xbc9e('0xd'),_0xf12aee,_0x4b57d6[_0xbc9e('0x12')][_0xbc9e('0x13')]);return _0x43184b(_0x4b57d6[_0xbc9e('0x12')][_0xbc9e('0x13')]);}else{logger[_0xbc9e('0xc')](_0xbc9e('0xd'),_0xf12aee,_0xbc9e('0x10'));_0x43184b(_0x4b57d6['result'][_0xbc9e('0x13')]);}})['catch'](function(_0x552872){logger[_0xbc9e('0x12')](_0xbc9e('0xd'),_0xf12aee,_0x552872);_0x122951(_0x552872);});});}exports[_0xbc9e('0x14')]=function(_0x27d5f0){var _0x386541=this;return new Promise(function(_0x30eed2,_0x1202bc){return db[_0xbc9e('0x15')][_0xbc9e('0x16')]({'raw':_0x27d5f0['options']?_0x27d5f0[_0xbc9e('0x17')][_0xbc9e('0x18')]===undefined?!![]:![]:!![],'where':_0x27d5f0[_0xbc9e('0x17')]?_0x27d5f0[_0xbc9e('0x17')][_0xbc9e('0x19')]||null:null,'attributes':_0x27d5f0[_0xbc9e('0x17')]?_0x27d5f0['options'][_0xbc9e('0x1a')]||null:null,'limit':_0x27d5f0[_0xbc9e('0x17')]?_0x27d5f0[_0xbc9e('0x17')][_0xbc9e('0x1b')]||null:null,'include':_0x27d5f0[_0xbc9e('0x17')]?_0x27d5f0[_0xbc9e('0x17')]['include']?_['map'](_0x27d5f0[_0xbc9e('0x17')][_0xbc9e('0x1c')],function(_0x4bdb89){return{'model':db[_0x4bdb89[_0xbc9e('0x1d')]],'as':_0x4bdb89['as'],'attributes':_0x4bdb89[_0xbc9e('0x1a')],'include':_0x4bdb89['include']?_[_0xbc9e('0x1e')](_0x4bdb89[_0xbc9e('0x1c')],function(_0x2a0aac){return{'model':db[_0x2a0aac[_0xbc9e('0x1d')]],'as':_0x2a0aac['as'],'attributes':_0x2a0aac[_0xbc9e('0x1a')],'include':_0x2a0aac[_0xbc9e('0x1c')]?_[_0xbc9e('0x1e')](_0x2a0aac[_0xbc9e('0x1c')],function(_0x5b9bf1){return{'model':db[_0x5b9bf1[_0xbc9e('0x1d')]],'as':_0x5b9bf1['as'],'attributes':_0x5b9bf1[_0xbc9e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbc9e('0xb')](function(_0x226e85){logger[_0xbc9e('0xc')]('GetCmHopperBlack',_0x27d5f0);logger[_0xbc9e('0xe')]('GetCmHopperBlack',_0x27d5f0,JSON[_0xbc9e('0x11')](_0x226e85));_0x30eed2(_0x226e85);})[_0xbc9e('0x1f')](function(_0x30cf06){logger['error'](_0xbc9e('0x14'),_0x30cf06['message'],_0x27d5f0);_0x1202bc(_0x386541['error'](0x1f4,_0x30cf06[_0xbc9e('0x13')]));});});};exports[_0xbc9e('0x20')]=function(_0x5176d2){var _0x4a8d6d=this;return new Promise(function(_0x1469e5,_0x246088){return db['CmHopperBlack']['update'](_0x5176d2[_0xbc9e('0x21')],{'raw':_0x5176d2['options']?_0x5176d2[_0xbc9e('0x17')][_0xbc9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5176d2['options']?_0x5176d2[_0xbc9e('0x17')][_0xbc9e('0x19')]||null:null,'attributes':_0x5176d2['options']?_0x5176d2[_0xbc9e('0x17')]['attributes']||null:null,'limit':_0x5176d2[_0xbc9e('0x17')]?_0x5176d2['options'][_0xbc9e('0x1b')]||null:null})[_0xbc9e('0xb')](function(_0x311baf){logger[_0xbc9e('0xc')]('UpdateCmHopperBlack',_0x5176d2);logger[_0xbc9e('0xe')](_0xbc9e('0x20'),_0x5176d2,JSON[_0xbc9e('0x11')](_0x311baf));_0x1469e5(_0x311baf);})[_0xbc9e('0x1f')](function(_0xd4ec80){logger[_0xbc9e('0x12')](_0xbc9e('0x20'),_0xd4ec80[_0xbc9e('0x13')],_0x5176d2);_0x246088(_0x4a8d6d['error'](0x1f4,_0xd4ec80[_0xbc9e('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x3d4845){var _0x4d2b73=this;return new Promise(function(_0x579df8,_0x37f92e){return db[_0xbc9e('0x15')]['destroy']({'where':_0x3d4845[_0xbc9e('0x17')]?_0x3d4845[_0xbc9e('0x17')][_0xbc9e('0x19')]||null:null})['then'](function(_0x2e9438){logger['info'](_0xbc9e('0x22'),_0x3d4845);logger['debug'](_0xbc9e('0x22'),_0x3d4845,JSON[_0xbc9e('0x11')](_0x2e9438));_0x579df8(_0x2e9438);})[_0xbc9e('0x1f')](function(_0x17a43b){logger[_0xbc9e('0x12')](_0xbc9e('0x22'),_0x17a43b[_0xbc9e('0x13')],_0x3d4845);_0x37f92e(_0x4d2b73['error'](0x1f4,_0x17a43b[_0xbc9e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1d3809d..f902bfd 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 _0xfb11=['show','put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xfb11[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xe')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller['update']);router[_0x1fb1('0xf')]('/:id',auth[_0x1fb1('0x7')](),controller['destroy']);module[_0x1fb1('0x10')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','destroy','util','connect-timeout','express'];(function(_0xf79f3e,_0x5c1fef){var _0x4c220d=function(_0x553de1){while(--_0x553de1){_0xf79f3e['push'](_0xf79f3e['shift']());}};_0x4c220d(++_0x5c1fef);}(_0xadb5,0xad));var _0x5adb=function(_0x2eaadc,_0x5ea6be){_0x2eaadc=_0x2eaadc-0x0;var _0x3a62ec=_0xadb5[_0x2eaadc];return _0x3a62ec;};'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('./cmHopperBlack.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller['update']);router['delete'](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 00fc3d3..7a9f57f 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 _0xb132=['DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x2de964,_0x8a4be1){var _0x3db725=function(_0x349a7c){while(--_0x349a7c){_0x2de964['push'](_0x2de964['shift']());}};_0x3db725(++_0x8a4be1);}(_0xb132,0x110));var _0x2b13=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0xb132[_0x452968];return _0xb6f9ae;};'use strict';var Sequelize=require(_0x2b13('0x0'));var moment=require(_0x2b13('0x1'));module['exports']={'state':{'type':Sequelize[_0x2b13('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2b13('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2b13('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2b13('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x2b13('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2b13('0x3')]},'calleridname':{'type':Sequelize[_0x2b13('0x3')]},'starttime':{'type':Sequelize[_0x2b13('0x4')]},'responsetime':{'type':Sequelize[_0x2b13('0x4')]},'answertime':{'type':Sequelize[_0x2b13('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2b13('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2b13('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x2b13('0x3')]},'campaigntype':{'type':Sequelize[_0x2b13('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x2b13('0x3')]},'disposition':{'type':Sequelize[_0x2b13('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2b13('0x3')]},'dispositionat':{'type':Sequelize[_0x2b13('0x4')],'set':function(_0x45ee5b){var _0x23b884=this[_0x2b13('0x5')](_0x2b13('0x6'));if(_0x23b884&&_0x45ee5b){this[_0x2b13('0x7')](_0x2b13('0x8'),moment(_0x45ee5b)['diff'](moment(_0x23b884),_0x2b13('0x9')));}return this['setDataValue'](_0x2b13('0xa'),_0x45ee5b);}},'amd':{'type':Sequelize[_0x2b13('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2b13('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2b13('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2b13('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2b13('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2b13('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2b13('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2b13('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2b13('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2b13('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x087a=['setDataValue','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','diff','seconds'];(function(_0x3e779f,_0x4e05c0){var _0x553999=function(_0x2e5ffa){while(--_0x2e5ffa){_0x3e779f['push'](_0x3e779f['shift']());}};_0x553999(++_0x4e05c0);}(_0x087a,0x86));var _0xa087=function(_0x81aa14,_0x283f55){_0x81aa14=_0x81aa14-0x0;var _0x403a23=_0x087a[_0x81aa14];return _0x403a23;};'use strict';var Sequelize=require(_0xa087('0x0'));var moment=require(_0xa087('0x1'));module[_0xa087('0x2')]={'state':{'type':Sequelize[_0xa087('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xa087('0x4')]},'scheduledat':{'type':Sequelize[_0xa087('0x5')]},'countbusyretry':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa087('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xa087('0x4')]},'originatecalleridname':{'type':Sequelize[_0xa087('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa087('0x4')]},'starttime':{'type':Sequelize[_0xa087('0x5')]},'responsetime':{'type':Sequelize[_0xa087('0x5')]},'answertime':{'type':Sequelize[_0xa087('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa087('0x5')]},'ringtime':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa087('0x4')]},'campaign':{'type':Sequelize[_0xa087('0x4')]},'campaigntype':{'type':Sequelize[_0xa087('0x4')]},'membername':{'type':Sequelize[_0xa087('0x4')]},'reason':{'type':Sequelize[_0xa087('0x4')]},'disposition':{'type':Sequelize[_0xa087('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xa087('0x5')],'set':function(_0x481954){var _0x470429=this[_0xa087('0x6')](_0xa087('0x7'));if(_0x470429&&_0x481954){this['setDataValue']('followuptime',moment(_0x481954)[_0xa087('0x8')](moment(_0x470429),_0xa087('0x9')));}return this[_0xa087('0xa')]('dispositionat',_0x481954);}},'amd':{'type':Sequelize[_0xa087('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa087('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa087('0x5')]},'callback':{'type':Sequelize[_0xa087('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa087('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa087('0x5')]},'recallme':{'type':Sequelize[_0xa087('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa087('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa087('0x3')],'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 b50f1d8..5d31339 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 _0xfdbd=['status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','length','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','params','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','checkContactHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','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'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0xfdbd[_0x470e67];return _0x28bbde;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':!![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['CmHopperFinal']['describe']()[_0xdfdb('0x26')](respondWithResult(_0x273477,null))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports[_0xdfdb('0x24')]=function(_0x4bbb88,_0x36149e){if(_0x4bbb88[_0xdfdb('0x4b')][_0xdfdb('0x4c')]){delete _0x4bbb88[_0xdfdb('0x4b')]['uniqueid'];}return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'uniqueid':_0x4bbb88['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x36149e,null))[_0xdfdb('0x26')](saveUpdates(_0x4bbb88[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x36149e,null))[_0xdfdb('0x49')](handleError(_0x36149e,null));};exports[_0xdfdb('0x4d')]=function(_0x17dfdb,_0x1f5b88,_0x1da7af){return db['CmHopperFinal'][_0xdfdb('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x17dfdb['params']['id']},'attributes':[[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x53')))),'noAnswerContacts'],[db[_0xdfdb('0x4e')]['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x54')))),_0xdfdb('0x55')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x56')))),_0xdfdb('0x57')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x58')))),_0xdfdb('0x59')],[db['sequelize']['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5b')))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')]['literal'](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x1f5b88,null))['then'](respondWithResult(_0x1f5b88,null))[_0xdfdb('0x49')](handleError(_0x1f5b88,null));};exports[_0xdfdb('0x5f')]=function(_0x349cf7,_0x2f69a8,_0x424212){return db[_0xdfdb('0x2d')][_0xdfdb('0x44')]({'raw':![],'where':{'CampaignId':_0x349cf7[_0xdfdb('0x60')]['id']},'attributes':[[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xdfdb('0x61')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x54')))),'busyContacts'],[db['sequelize']['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xdfdb('0x57')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xdfdb('0x59')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x2f69a8,null))[_0xdfdb('0x26')](respondWithResult(_0x2f69a8,null))['catch'](handleError(_0x2f69a8,null));};exports[_0xdfdb('0x62')]=function(_0x198cfa,_0x2831d6,_0x45bfc0){return db[_0xdfdb('0x63')]['find']({'where':{'id':_0x198cfa[_0xdfdb('0x60')]['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x2831d6,null))[_0xdfdb('0x26')](function(_0x1a31b9){var _0x4999c4;if(_0x1a31b9){_0x4999c4=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')](_0xdfdb('0x66'))[_0xdfdb('0x67')]([_0xdfdb('0x68'),_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),_0xdfdb('0x6c'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel['select']()[_0xdfdb('0x6f')](_0xdfdb('0x70'),'phone')[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)','ContactId')[_0xdfdb('0x6f')](_0xdfdb('0x72'),_0xdfdb('0x6b'))[_0xdfdb('0x6f')](_0xdfdb('0x73'),_0xdfdb('0x6c'))[_0xdfdb('0x6f')]('NOW()',_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')]('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id'][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x77'),_0x198cfa[_0xdfdb('0x4b')]['state'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')]('phone')[_0xdfdb('0x74')](_0xdfdb('0x66'))['where']('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id']['toString']()))['where'](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x7c'),_0x198cfa['params']['id'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x7d')))[_0xdfdb('0x7e')](_0xdfdb('0x6a')))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x4999c4);}return[];})[_0xdfdb('0x26')](respondWithResult(_0x2831d6,null))[_0xdfdb('0x49')](handleError(_0x2831d6,null));};exports[_0xdfdb('0x7f')]=function(_0x1b6445,_0x36241c,_0x4c833f){return db['Campaign'][_0xdfdb('0x48')]({'where':{'id':_0x1b6445[_0xdfdb('0x60')]['id']}})['then'](handleEntityNotFound(_0x36241c,null))[_0xdfdb('0x26')](function(_0x50d5d4){var _0x158454;if(_0x50d5d4){_0x158454=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')]('cm_hopper')[_0xdfdb('0x67')](['phone','scheduledAt',_0xdfdb('0x6a'),'ListId',_0xdfdb('0x80'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x70'),_0xdfdb('0x68'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)',_0xdfdb('0x6a'))['field']('ANY_VALUE(ListId)','ListId')['field'](_0xdfdb('0x81'),_0xdfdb('0x80'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x77'),_0x1b6445[_0xdfdb('0x4b')][_0xdfdb('0x83')][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()['field'](_0xdfdb('0x68'))[_0xdfdb('0x74')](_0xdfdb('0x66'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']()))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')]('cm_hopper_final')[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x7d')))['group']('ContactId'))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x158454);}return[];})['then'](respondWithResult(_0x36241c,null))[_0xdfdb('0x49')](handleError(_0x36241c,null));};exports[_0xdfdb('0x84')]=function(_0x1f87d3,_0x1bc293,_0x36b01e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x1f87d3[_0xdfdb('0x4b')]['VoiceQueueId'],'CampaignId':_0x1f87d3[_0xdfdb('0x4b')][_0xdfdb('0x80')],'ContactId':_0x1f87d3[_0xdfdb('0x4b')]['ContactId']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x1bc293,null))[_0xdfdb('0x26')](function(_0x3e0208){if(_0x3e0208){return _0x3e0208;}return null;})[_0xdfdb('0x26')](respondWithResult(_0x1bc293,null))['catch'](handleError(_0x1bc293,null));}; \ No newline at end of file +var _0x4888=['ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','find','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','CmHopperFinal','includeAll','include','rows','catch','params','options','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','select','field','ANY_VALUE(ContactId)','ContactId'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x4888,0x198));var _0x8488=function(_0x4f9617,_0x16a10a){_0x4f9617=_0x4f9617-0x0;var _0x55b7d0=_0x4888[_0x4f9617];return _0x55b7d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':!![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')]()[_0x8488('0x21')](respondWithResult(_0x1f0516,null))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x42')]=function(_0x886a9e,_0x299d8e){if(_0x886a9e[_0x8488('0x43')][_0x8488('0x44')]){delete _0x886a9e[_0x8488('0x43')][_0x8488('0x44')];}return db[_0x8488('0x3a')]['find']({'where':{'uniqueid':_0x886a9e['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x299d8e,null))[_0x8488('0x21')](saveUpdates(_0x886a9e[_0x8488('0x43')],null))[_0x8488('0x21')](respondWithResult(_0x299d8e,null))[_0x8488('0x3e')](handleError(_0x299d8e,null));};exports[_0x8488('0x45')]=function(_0x25f2dc,_0x27dfd2,_0x24fa20){return db['CmHopperFinal'][_0x8488('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x25f2dc[_0x8488('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),_0x8488('0x4c')],[db['sequelize']['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0x8488('0x4d')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x4f')))),'dropContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x52')))),_0x8488('0x53')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x27dfd2,null))[_0x8488('0x21')](respondWithResult(_0x27dfd2,null))[_0x8488('0x3e')](handleError(_0x27dfd2,null));};exports[_0x8488('0x55')]=function(_0x1971f3,_0x24ba2d,_0x4facfb){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x1971f3[_0x8488('0x3f')]['id']},'attributes':[[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x56')))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x57')))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8488('0x58')],[db[_0x8488('0x48')]['fn']('COUNT',db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x24ba2d,null))['then'](respondWithResult(_0x24ba2d,null))[_0x8488('0x3e')](handleError(_0x24ba2d,null));};exports[_0x8488('0x59')]=function(_0x44a50b,_0x5815cb,_0xbee86e){return db[_0x8488('0x5a')]['find']({'where':{'id':_0x44a50b['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x5815cb,null))[_0x8488('0x21')](function(_0xfedfd2){var _0x3ab1b6;if(_0xfedfd2){_0x3ab1b6=squel[_0x8488('0x5b')]()[_0x8488('0x5c')](_0x8488('0x5d'))[_0x8488('0x5e')]([_0x8488('0x5f'),_0x8488('0x60'),'ContactId',_0x8488('0x61'),'VoiceQueueId',_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')]('ANY_VALUE(calleridnum)',_0x8488('0x5f'))[_0x8488('0x65')]('NOW()',_0x8488('0x60'))['field'](_0x8488('0x66'),_0x8488('0x67'))[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x69'),_0x8488('0x6a'))['field'](_0x8488('0x6b'),'createdAt')['field'](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']())[_0x8488('0x35')](_0x8488('0x6e'),_0x44a50b[_0x8488('0x43')][_0x8488('0x6f')][_0x8488('0x70')]())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8488('0x35')](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x72'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x73')))[_0x8488('0x74')]('ContactId'))[_0x8488('0x70')]();return db['sequelize'][_0x8488('0x2c')](_0x3ab1b6);}return[];})['then'](respondWithResult(_0x5815cb,null))[_0x8488('0x3e')](handleError(_0x5815cb,null));};exports[_0x8488('0x75')]=function(_0x267401,_0x1e635a,_0x31ab35){return db[_0x8488('0x76')][_0x8488('0x77')]({'where':{'id':_0x267401[_0x8488('0x3f')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x1e635a,null))[_0x8488('0x21')](function(_0xce1d1a){var _0xc9c221;if(_0xce1d1a){_0xc9c221=squel[_0x8488('0x5b')]()[_0x8488('0x5c')]('cm_hopper')[_0x8488('0x5e')]([_0x8488('0x5f'),'scheduledAt',_0x8488('0x67'),_0x8488('0x61'),_0x8488('0x78'),_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x79'),_0x8488('0x5f'))[_0x8488('0x65')](_0x8488('0x6b'),'scheduledAt')[_0x8488('0x65')](_0x8488('0x66'),'ContactId')[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x7a'),'CampaignId')['field'](_0x8488('0x6b'),_0x8488('0x62'))[_0x8488('0x65')](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')](_0x8488('0x7b'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x6e'),_0x267401[_0x8488('0x43')][_0x8488('0x6f')]['toString']())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x72'))[_0x8488('0x6c')](_0x8488('0x7b'))['where'](_0x8488('0x7c'),_0x267401['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')]('state\x20=\x204'))['group'](_0x8488('0x67')))[_0x8488('0x70')]();return db[_0x8488('0x48')][_0x8488('0x2c')](_0xc9c221);}return[];})[_0x8488('0x21')](respondWithResult(_0x1e635a,null))['catch'](handleError(_0x1e635a,null));};exports[_0x8488('0x7d')]=function(_0x19c5c6,_0x50f773,_0x52c750){return db[_0x8488('0x7e')][_0x8488('0x7f')]({'where':{'VoiceQueueId':_0x19c5c6[_0x8488('0x43')]['VoiceQueueId'],'CampaignId':_0x19c5c6['body'][_0x8488('0x78')],'ContactId':_0x19c5c6[_0x8488('0x43')][_0x8488('0x67')]}})['then'](handleEntityNotFound(_0x50f773,null))[_0x8488('0x21')](function(_0x1e4e51){if(_0x1e4e51){return _0x1e4e51;}return null;})[_0x8488('0x21')](respondWithResult(_0x50f773,null))[_0x8488('0x3e')](handleError(_0x50f773,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 11262a5..a99e32f 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 _0xad92=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x22d506,_0x47e664){var _0x2e2a3c=function(_0x1aad7e){while(--_0x1aad7e){_0x22d506['push'](_0x22d506['shift']());}};_0x2e2a3c(++_0x47e664);}(_0xad92,0x158));var _0x2ad9=function(_0x19ec97,_0x4b2bd9){_0x19ec97=_0x19ec97-0x0;var _0xbff8b7=_0xad92[_0x19ec97];return _0xbff8b7;};'use strict';var _=require(_0x2ad9('0x0'));var util=require(_0x2ad9('0x1'));var logger=require(_0x2ad9('0x2'))(_0x2ad9('0x3'));var moment=require(_0x2ad9('0x4'));var BPromise=require(_0x2ad9('0x5'));var rp=require(_0x2ad9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ad9('0x7'));var config=require(_0x2ad9('0x8'));var attributes=require(_0x2ad9('0x9'));module['exports']=function(_0x3234d1,_0x3a53ec){return _0x3234d1[_0x2ad9('0xa')](_0x2ad9('0xb'),attributes,{'tableName':_0x2ad9('0xc'),'paranoid':![],'indexes':[{'name':_0x2ad9('0xd'),'fields':[_0x2ad9('0xd')]},{'name':'uniqueid','fields':[_0x2ad9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x047d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util'];(function(_0x504c0b,_0xfcd711){var _0x150c1b=function(_0x189af2){while(--_0x189af2){_0x504c0b['push'](_0x504c0b['shift']());}};_0x150c1b(++_0xfcd711);}(_0x047d,0xa7));var _0xd047=function(_0x494421,_0x1c4bdd){_0x494421=_0x494421-0x0;var _0x35e79a=_0x047d[_0x494421];return _0x35e79a;};'use strict';var _=require('lodash');var util=require(_0xd047('0x0'));var logger=require(_0xd047('0x1'))(_0xd047('0x2'));var moment=require(_0xd047('0x3'));var BPromise=require('bluebird');var rp=require(_0xd047('0x4'));var fs=require('fs');var path=require(_0xd047('0x5'));var rimraf=require(_0xd047('0x6'));var config=require(_0xd047('0x7'));var attributes=require(_0xd047('0x8'));module['exports']=function(_0x58eac3,_0xa09814){return _0x58eac3[_0xd047('0x9')](_0xd047('0xa'),attributes,{'tableName':_0xd047('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xd047('0xc')]},{'name':_0xd047('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 397c3e5..418cf6a 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x55df6d,_0x4ab503){var _0x444012=function(_0x1d3f3a){while(--_0x1d3f3a){_0x55df6d['push'](_0x55df6d['shift']());}};_0x444012(++_0x4ab503);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cfe76,_0x1d9d61){_0x3cfe76=_0x3cfe76-0x0;var _0x1f6f12=_0xb10b[_0x3cfe76];return _0x1f6f12;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4c81f6,_0x14692d){var _0x5890e0=function(_0x287e55){while(--_0x287e55){_0x4c81f6['push'](_0x4c81f6['shift']());}};_0x5890e0(++_0x14692d);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b01a2,_0x3b4040){_0x2b01a2=_0x2b01a2-0x0;var _0xcce4ab=_0xb10b[_0x2b01a2];return _0xcce4ab;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 71351de..c8367ec 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 _0x254c=['/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe'];(function(_0x405b3b,_0x580899){var _0x3debc8=function(_0xd20027){while(--_0xd20027){_0x405b3b['push'](_0x405b3b['shift']());}};_0x3debc8(++_0x580899);}(_0x254c,0x135));var _0xc254=function(_0x1f0529,_0x2942c0){_0x1f0529=_0x1f0529-0x0;var _0x5bd106=_0x254c[_0x1f0529];return _0x5bd106;};'use strict';var multer=require(_0xc254('0x0'));var util=require(_0xc254('0x1'));var path=require(_0xc254('0x2'));var timeout=require(_0xc254('0x3'));var express=require(_0xc254('0x4'));var router=express[_0xc254('0x5')]();var fs_extra=require(_0xc254('0x6'));var auth=require(_0xc254('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc254('0x8'));router[_0xc254('0x9')]('/',auth[_0xc254('0xa')](),controller['index']);router[_0xc254('0x9')](_0xc254('0xb'),auth[_0xc254('0xa')](),controller[_0xc254('0xc')]);router[_0xc254('0x9')](_0xc254('0xd'),auth[_0xc254('0xa')](),controller[_0xc254('0xe')]);router['get'](_0xc254('0xf'),auth[_0xc254('0xa')](),controller[_0xc254('0x10')]);router['get'](_0xc254('0x11'),auth[_0xc254('0xa')](),controller[_0xc254('0x12')]);router[_0xc254('0x13')]('/voice/queue/moveContacts/:id',auth[_0xc254('0xa')](),controller[_0xc254('0x14')]);router[_0xc254('0x13')]('/voice/campaign/moveContacts/:id',auth[_0xc254('0xa')](),controller[_0xc254('0x15')]);router[_0xc254('0x13')]('/checkContactHopper',auth[_0xc254('0xa')](),controller[_0xc254('0x16')]);router['put'](_0xc254('0xd'),auth[_0xc254('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x5630=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','multer','util','path','fs-extra','../../components/auth/service'];(function(_0x2b4ffc,_0x1811e6){var _0x26e417=function(_0x574dae){while(--_0x574dae){_0x2b4ffc['push'](_0x2b4ffc['shift']());}};_0x26e417(++_0x1811e6);}(_0x5630,0xc3));var _0x0563=function(_0x3d69aa,_0x155f13){_0x3d69aa=_0x3d69aa-0x0;var _0x54c371=_0x5630[_0x3d69aa];return _0x54c371;};'use strict';var multer=require(_0x0563('0x0'));var util=require(_0x0563('0x1'));var path=require(_0x0563('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0563('0x3'));var auth=require(_0x0563('0x4'));var interaction=require(_0x0563('0x5'));var config=require(_0x0563('0x6'));var controller=require(_0x0563('0x7'));router[_0x0563('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0563('0x8')](_0x0563('0x9'),auth[_0x0563('0xa')](),controller[_0x0563('0xb')]);router['get'](_0x0563('0xc'),auth[_0x0563('0xa')](),controller[_0x0563('0xd')]);router[_0x0563('0x8')](_0x0563('0xe'),auth[_0x0563('0xa')](),controller[_0x0563('0xf')]);router[_0x0563('0x8')]('/campaign/countAttributes/:id',auth[_0x0563('0xa')](),controller[_0x0563('0x10')]);router[_0x0563('0x11')](_0x0563('0x12'),auth[_0x0563('0xa')](),controller[_0x0563('0x13')]);router[_0x0563('0x11')](_0x0563('0x14'),auth[_0x0563('0xa')](),controller[_0x0563('0x15')]);router[_0x0563('0x11')](_0x0563('0x16'),auth['isAuthenticated'](),controller[_0x0563('0x17')]);router[_0x0563('0x18')](_0x0563('0xc'),auth[_0x0563('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f886bde..43cd24c 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 _0x2568=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x1920b5,_0x2addd7){var _0x5911a0=function(_0x5f4ab7){while(--_0x5f4ab7){_0x1920b5['push'](_0x1920b5['shift']());}};_0x5911a0(++_0x2addd7);}(_0x2568,0x148));var _0x8256=function(_0x36394d,_0x54f2e9){_0x36394d=_0x36394d-0x0;var _0x569405=_0x2568[_0x36394d];return _0x569405;};'use strict';var Sequelize=require('sequelize');module[_0x8256('0x0')]={'state':{'type':Sequelize[_0x8256('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8256('0x2')]},'scheduledat':{'type':Sequelize[_0x8256('0x3')]},'countbusyretry':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8256('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x8256('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8256('0x2')]},'calleridnum':{'type':Sequelize[_0x8256('0x2')]},'calleridname':{'type':Sequelize[_0x8256('0x2')]},'starttime':{'type':Sequelize[_0x8256('0x3')]},'responsetime':{'type':Sequelize[_0x8256('0x3')]},'answertime':{'type':Sequelize[_0x8256('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8256('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8256('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8256('0x2')]},'membername':{'type':Sequelize[_0x8256('0x2')]},'reason':{'type':Sequelize[_0x8256('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8256('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8256('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8256('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8256('0x3')]},'recallme':{'type':Sequelize[_0x8256('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8256('0x3')]},'edited':{'type':Sequelize[_0x8256('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8256('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ea9=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x86a8fa,_0x323e96){var _0x551384=function(_0x434c2b){while(--_0x434c2b){_0x86a8fa['push'](_0x86a8fa['shift']());}};_0x551384(++_0x323e96);}(_0x0ea9,0x130));var _0x90ea=function(_0x492d04,_0x38b095){_0x492d04=_0x492d04-0x0;var _0x28737c=_0x0ea9[_0x492d04];return _0x28737c;};'use strict';var Sequelize=require(_0x90ea('0x0'));module[_0x90ea('0x1')]={'state':{'type':Sequelize[_0x90ea('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x90ea('0x3')]},'originatecalleridname':{'type':Sequelize[_0x90ea('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x90ea('0x4')]},'responsetime':{'type':Sequelize[_0x90ea('0x4')]},'answertime':{'type':Sequelize[_0x90ea('0x4')]},'droptime':{'type':Sequelize[_0x90ea('0x4')]},'endtime':{'type':Sequelize[_0x90ea('0x4')]},'ringtime':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x90ea('0x3')]},'campaign':{'type':Sequelize[_0x90ea('0x3')]},'campaigntype':{'type':Sequelize[_0x90ea('0x3')]},'membername':{'type':Sequelize[_0x90ea('0x3')]},'reason':{'type':Sequelize[_0x90ea('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x90ea('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x90ea('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x90ea('0x4')]},'edited':{'type':Sequelize[_0x90ea('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x90ea('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x90ea('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0cc5e3d..df63c42 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 _0x76c7=['rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','Content-Range','apply','reject','destroy','then','sendStatus','stack','name','send','map','CmHopperHistory'];(function(_0x5e46b8,_0x21f878){var _0x2935ac=function(_0x366876){while(--_0x366876){_0x5e46b8['push'](_0x5e46b8['shift']());}};_0x2935ac(++_0x21f878);}(_0x76c7,0x13e));var _0x776c=function(_0x558081,_0x58cec1){_0x558081=_0x558081-0x0;var _0x33d9f3=_0x76c7[_0x558081];return _0x33d9f3;};'use strict';var emlformat=require(_0x776c('0x0'));var rimraf=require(_0x776c('0x1'));var zipdir=require(_0x776c('0x2'));var jsonpatch=require(_0x776c('0x3'));var rp=require('request-promise');var moment=require(_0x776c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x776c('0x5'));var util=require('util');var path=require(_0x776c('0x6'));var sox=require(_0x776c('0x7'));var csv=require(_0x776c('0x8'));var ejs=require(_0x776c('0x9'));var fs=require('fs');var fs_extra=require(_0x776c('0xa'));var _=require('lodash');var squel=require(_0x776c('0xb'));var crypto=require(_0x776c('0xc'));var jsforce=require(_0x776c('0xd'));var deskjs=require(_0x776c('0xe'));var toCsv=require(_0x776c('0x8'));var querystring=require('querystring');var Papa=require(_0x776c('0xf'));var Redis=require(_0x776c('0x10'));var authService=require(_0x776c('0x11'));var qs=require(_0x776c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x776c('0x13'));var logger=require('../../config/logger')(_0x776c('0x14'));var utils=require(_0x776c('0x15'));var config=require(_0x776c('0x16'));var licenseUtil=require(_0x776c('0x17'));var db=require(_0x776c('0x18'))['db'];function respondWithStatusCode(_0x400a1c,_0x1e9b73){_0x1e9b73=_0x1e9b73||0xcc;return function(_0x335b3d){if(_0x335b3d){return _0x400a1c['sendStatus'](_0x1e9b73);}return _0x400a1c[_0x776c('0x19')](_0x1e9b73)[_0x776c('0x1a')]();};}function respondWithResult(_0xd4051,_0x47b63f){_0x47b63f=_0x47b63f||0xc8;return function(_0x5f41e6){if(_0x5f41e6){return _0xd4051[_0x776c('0x19')](_0x47b63f)[_0x776c('0x1b')](_0x5f41e6);}};}function respondWithFilteredResult(_0x1fa6c3,_0x1cae1d){return function(_0x1923d5){if(_0x1923d5){var _0x52b04b=typeof _0x1cae1d['offset']===_0x776c('0x1c')&&typeof _0x1cae1d['limit']===_0x776c('0x1c');var _0x464c58=_0x1923d5['count'];var _0xd37b30=_0x52b04b?0x0:_0x1cae1d['offset'];var _0x8da31a=_0x52b04b?_0x1923d5[_0x776c('0x1d')]:_0x1cae1d[_0x776c('0x1e')]+_0x1cae1d['limit'];var _0x3cfa6;if(_0x8da31a>=_0x464c58){_0x8da31a=_0x464c58;_0x3cfa6=0xc8;}else{_0x3cfa6=0xce;}_0x1fa6c3[_0x776c('0x19')](_0x3cfa6);return _0x1fa6c3['set'](_0x776c('0x1f'),_0xd37b30+'-'+_0x8da31a+'/'+_0x464c58)[_0x776c('0x1b')](_0x1923d5);}return null;};}function patchUpdates(_0xb26c29){return function(_0x4d2a50){try{jsonpatch[_0x776c('0x20')](_0x4d2a50,_0xb26c29,!![]);}catch(_0x17837e){return BPromise[_0x776c('0x21')](_0x17837e);}return _0x4d2a50['save']();};}function saveUpdates(_0x12ec62,_0x5b5031){return function(_0x304159){if(_0x304159){return _0x304159['update'](_0x12ec62)['then'](function(_0x2a1f58){return _0x2a1f58;});}return null;};}function removeEntity(_0x150972,_0x579ff4){return function(_0x34f643){if(_0x34f643){return _0x34f643[_0x776c('0x22')]()[_0x776c('0x23')](function(){_0x150972[_0x776c('0x19')](0xcc)[_0x776c('0x1a')]();});}};}function handleEntityNotFound(_0x2cdacc,_0x1f15da){return function(_0xdb83ce){if(!_0xdb83ce){_0x2cdacc[_0x776c('0x24')](0x194);}return _0xdb83ce;};}function handleError(_0x109088,_0x1a6fbf){_0x1a6fbf=_0x1a6fbf||0x1f4;return function(_0x32706a){logger['error'](_0x32706a[_0x776c('0x25')]);if(_0x32706a['name']){delete _0x32706a[_0x776c('0x26')];}_0x109088[_0x776c('0x19')](_0x1a6fbf)[_0x776c('0x27')](_0x32706a);};}exports['index']=function(_0x3d5a94,_0x1ae8ff){var _0x4e19d5={},_0x2fdff5={},_0xedd48b={'count':0x0,'rows':[]};var _0x3481a6=_[_0x776c('0x28')](db[_0x776c('0x29')][_0x776c('0x2a')],function(_0x26b5a6){return{'name':_0x26b5a6[_0x776c('0x2b')],'type':_0x26b5a6[_0x776c('0x2c')]['key']};});_0x2fdff5[_0x776c('0x2d')]=_[_0x776c('0x28')](_0x3481a6,_0x776c('0x26'));_0x2fdff5[_0x776c('0x2e')]=_[_0x776c('0x2f')](_0x3d5a94[_0x776c('0x2e')]);_0x2fdff5['filters']=_[_0x776c('0x30')](_0x2fdff5[_0x776c('0x2d')],_0x2fdff5[_0x776c('0x2e')]);_0x4e19d5['attributes']=_[_0x776c('0x30')](_0x2fdff5[_0x776c('0x2d')],qs[_0x776c('0x31')](_0x3d5a94[_0x776c('0x2e')][_0x776c('0x31')]));_0x4e19d5[_0x776c('0x32')]=_0x4e19d5[_0x776c('0x32')]['length']?_0x4e19d5['attributes']:_0x2fdff5[_0x776c('0x2d')];if(!_0x3d5a94['query']['hasOwnProperty']('nolimit')){_0x4e19d5['limit']=qs[_0x776c('0x33')](_0x3d5a94[_0x776c('0x2e')][_0x776c('0x33')]);_0x4e19d5[_0x776c('0x1e')]=qs[_0x776c('0x1e')](_0x3d5a94['query'][_0x776c('0x1e')]);}_0x4e19d5[_0x776c('0x34')]=qs[_0x776c('0x35')](_0x3d5a94['query']['sort']);_0x4e19d5[_0x776c('0x36')]=qs[_0x776c('0x37')](_[_0x776c('0x38')](_0x3d5a94[_0x776c('0x2e')],_0x2fdff5['filters']),_0x3481a6);if(_0x3d5a94[_0x776c('0x2e')][_0x776c('0x39')]){_0x4e19d5[_0x776c('0x36')]=_[_0x776c('0x3a')](_0x4e19d5[_0x776c('0x36')],{'$or':_[_0x776c('0x28')](_0x3481a6,function(_0x9fa284){if(_0x9fa284[_0x776c('0x2c')]!=='VIRTUAL'){var _0x1e6458={};_0x1e6458[_0x9fa284[_0x776c('0x26')]]={'$like':'%'+_0x3d5a94[_0x776c('0x2e')]['filter']+'%'};return _0x1e6458;}})});}_0x4e19d5=_[_0x776c('0x3a')]({},_0x4e19d5,_0x3d5a94[_0x776c('0x3b')]);var _0x2950c4={'where':_0x4e19d5[_0x776c('0x36')]};return db[_0x776c('0x29')][_0x776c('0x1d')](_0x2950c4)[_0x776c('0x23')](function(_0x4e4dc6){_0xedd48b[_0x776c('0x1d')]=_0x4e4dc6;if(_0x3d5a94[_0x776c('0x2e')][_0x776c('0x3c')]){_0x4e19d5[_0x776c('0x3d')]=[{'all':!![]}];}return db[_0x776c('0x29')][_0x776c('0x3e')](_0x4e19d5);})[_0x776c('0x23')](function(_0x5b0ab7){_0xedd48b[_0x776c('0x3f')]=_0x5b0ab7;return _0xedd48b;})['then'](respondWithFilteredResult(_0x1ae8ff,_0x4e19d5))[_0x776c('0x40')](handleError(_0x1ae8ff,null));};exports[_0x776c('0x41')]=function(_0x4638a7,_0x4b343f){var _0x39e7a0={'raw':!![],'where':{'id':_0x4638a7[_0x776c('0x42')]['id']}},_0x3bc1d7={};_0x3bc1d7[_0x776c('0x2d')]=_[_0x776c('0x2f')](db[_0x776c('0x29')][_0x776c('0x2a')]);_0x3bc1d7['query']=_[_0x776c('0x2f')](_0x4638a7[_0x776c('0x2e')]);_0x3bc1d7[_0x776c('0x37')]=_['intersection'](_0x3bc1d7['model'],_0x3bc1d7[_0x776c('0x2e')]);_0x39e7a0[_0x776c('0x32')]=_['intersection'](_0x3bc1d7[_0x776c('0x2d')],qs['fields'](_0x4638a7['query'][_0x776c('0x31')]));_0x39e7a0[_0x776c('0x32')]=_0x39e7a0[_0x776c('0x32')][_0x776c('0x43')]?_0x39e7a0[_0x776c('0x32')]:_0x3bc1d7[_0x776c('0x2d')];if(_0x4638a7[_0x776c('0x2e')]['includeAll']){_0x39e7a0[_0x776c('0x3d')]=[{'all':!![]}];}_0x39e7a0=_[_0x776c('0x3a')]({},_0x39e7a0,_0x4638a7[_0x776c('0x3b')]);return db[_0x776c('0x29')][_0x776c('0x44')](_0x39e7a0)[_0x776c('0x23')](handleEntityNotFound(_0x4b343f,null))[_0x776c('0x23')](respondWithResult(_0x4b343f,null))[_0x776c('0x40')](handleError(_0x4b343f,null));};exports[_0x776c('0x45')]=function(_0x2cd5a1,_0x682152){return db[_0x776c('0x29')]['create'](_0x2cd5a1[_0x776c('0x46')],{})[_0x776c('0x23')](respondWithResult(_0x682152,0xc9))[_0x776c('0x40')](handleError(_0x682152,null));};exports[_0x776c('0x47')]=function(_0x5d2589,_0x1a3b61){return db['CmHopperHistory'][_0x776c('0x47')]()['then'](respondWithResult(_0x1a3b61,null))[_0x776c('0x40')](handleError(_0x1a3b61,null));};exports['update']=function(_0x35fb74,_0x303b4f){if(_0x35fb74[_0x776c('0x46')]['uniqueid']){delete _0x35fb74[_0x776c('0x46')]['uniqueid'];}return db[_0x776c('0x29')][_0x776c('0x44')]({'where':{'uniqueid':_0x35fb74[_0x776c('0x42')]['id']}})[_0x776c('0x23')](handleEntityNotFound(_0x303b4f,null))['then'](saveUpdates(_0x35fb74[_0x776c('0x46')],null))[_0x776c('0x23')](respondWithResult(_0x303b4f,null))[_0x776c('0x40')](handleError(_0x303b4f,null));}; \ No newline at end of file +var _0x44ba=['to-csv','ejs','fs-extra','lodash','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','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','CmHopperHistory','findAll','rows','params','length','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','request-promise','mustache','util','path'];(function(_0x1b4bd8,_0x5886b9){var _0x37a716=function(_0x1be7f7){while(--_0x1be7f7){_0x1b4bd8['push'](_0x1b4bd8['shift']());}};_0x37a716(++_0x5886b9);}(_0x44ba,0x1dc));var _0xa44b=function(_0x3382e2,_0x6fbda2){_0x3382e2=_0x3382e2-0x0;var _0x25381b=_0x44ba[_0x3382e2];return _0x25381b;};'use strict';var emlformat=require(_0xa44b('0x0'));var rimraf=require(_0xa44b('0x1'));var zipdir=require(_0xa44b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa44b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa44b('0x4'));var util=require(_0xa44b('0x5'));var path=require(_0xa44b('0x6'));var sox=require('sox');var csv=require(_0xa44b('0x7'));var ejs=require(_0xa44b('0x8'));var fs=require('fs');var fs_extra=require(_0xa44b('0x9'));var _=require(_0xa44b('0xa'));var squel=require('squel');var crypto=require(_0xa44b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa44b('0xc'));var toCsv=require(_0xa44b('0x7'));var querystring=require(_0xa44b('0xd'));var Papa=require(_0xa44b('0xe'));var Redis=require('ioredis');var authService=require(_0xa44b('0xf'));var qs=require(_0xa44b('0x10'));var as=require(_0xa44b('0x11'));var hardwareService=require(_0xa44b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa44b('0x13'));var config=require(_0xa44b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa44b('0x15'))['db'];function respondWithStatusCode(_0xd02a91,_0x13535f){_0x13535f=_0x13535f||0xcc;return function(_0x593b7f){if(_0x593b7f){return _0xd02a91['sendStatus'](_0x13535f);}return _0xd02a91['status'](_0x13535f)['end']();};}function respondWithResult(_0x3b16bf,_0x10a6fb){_0x10a6fb=_0x10a6fb||0xc8;return function(_0x50ceea){if(_0x50ceea){return _0x3b16bf[_0xa44b('0x16')](_0x10a6fb)[_0xa44b('0x17')](_0x50ceea);}};}function respondWithFilteredResult(_0xe0d394,_0x4ff12e){return function(_0x5ebcb4){if(_0x5ebcb4){var _0x4a95ba=typeof _0x4ff12e[_0xa44b('0x18')]===_0xa44b('0x19')&&typeof _0x4ff12e[_0xa44b('0x1a')]===_0xa44b('0x19');var _0x5a24e4=_0x5ebcb4['count'];var _0x10275a=_0x4a95ba?0x0:_0x4ff12e[_0xa44b('0x18')];var _0x4ed607=_0x4a95ba?_0x5ebcb4[_0xa44b('0x1b')]:_0x4ff12e[_0xa44b('0x18')]+_0x4ff12e[_0xa44b('0x1a')];var _0x383316;if(_0x4ed607>=_0x5a24e4){_0x4ed607=_0x5a24e4;_0x383316=0xc8;}else{_0x383316=0xce;}_0xe0d394[_0xa44b('0x16')](_0x383316);return _0xe0d394['set']('Content-Range',_0x10275a+'-'+_0x4ed607+'/'+_0x5a24e4)['json'](_0x5ebcb4);}return null;};}function patchUpdates(_0x25691c){return function(_0x47357d){try{jsonpatch['apply'](_0x47357d,_0x25691c,!![]);}catch(_0x46af9d){return BPromise['reject'](_0x46af9d);}return _0x47357d['save']();};}function saveUpdates(_0x509fea,_0x669b19){return function(_0x223e67){if(_0x223e67){return _0x223e67[_0xa44b('0x1c')](_0x509fea)[_0xa44b('0x1d')](function(_0x36e62e){return _0x36e62e;});}return null;};}function removeEntity(_0x1c1c77,_0x5797dc){return function(_0x4d595a){if(_0x4d595a){return _0x4d595a[_0xa44b('0x1e')]()[_0xa44b('0x1d')](function(){_0x1c1c77['status'](0xcc)[_0xa44b('0x1f')]();});}};}function handleEntityNotFound(_0x41c72b,_0xbd3b29){return function(_0x5bd40a){if(!_0x5bd40a){_0x41c72b['sendStatus'](0x194);}return _0x5bd40a;};}function handleError(_0xb6968d,_0x577148){_0x577148=_0x577148||0x1f4;return function(_0x1f0389){logger[_0xa44b('0x20')](_0x1f0389[_0xa44b('0x21')]);if(_0x1f0389[_0xa44b('0x22')]){delete _0x1f0389[_0xa44b('0x22')];}_0xb6968d[_0xa44b('0x16')](_0x577148)[_0xa44b('0x23')](_0x1f0389);};}exports[_0xa44b('0x24')]=function(_0x191c54,_0x1d7ab7){var _0x469b11={},_0x2becc7={},_0x53742c={'count':0x0,'rows':[]};var _0x4bf2ea=_[_0xa44b('0x25')](db['CmHopperHistory'][_0xa44b('0x26')],function(_0x27076d){return{'name':_0x27076d[_0xa44b('0x27')],'type':_0x27076d['type']['key']};});_0x2becc7[_0xa44b('0x28')]=_[_0xa44b('0x25')](_0x4bf2ea,_0xa44b('0x22'));_0x2becc7['query']=_[_0xa44b('0x29')](_0x191c54[_0xa44b('0x2a')]);_0x2becc7[_0xa44b('0x2b')]=_[_0xa44b('0x2c')](_0x2becc7[_0xa44b('0x28')],_0x2becc7[_0xa44b('0x2a')]);_0x469b11[_0xa44b('0x2d')]=_[_0xa44b('0x2c')](_0x2becc7[_0xa44b('0x28')],qs[_0xa44b('0x2e')](_0x191c54[_0xa44b('0x2a')][_0xa44b('0x2e')]));_0x469b11[_0xa44b('0x2d')]=_0x469b11['attributes']['length']?_0x469b11[_0xa44b('0x2d')]:_0x2becc7[_0xa44b('0x28')];if(!_0x191c54[_0xa44b('0x2a')][_0xa44b('0x2f')]('nolimit')){_0x469b11[_0xa44b('0x1a')]=qs[_0xa44b('0x1a')](_0x191c54['query'][_0xa44b('0x1a')]);_0x469b11[_0xa44b('0x18')]=qs[_0xa44b('0x18')](_0x191c54[_0xa44b('0x2a')][_0xa44b('0x18')]);}_0x469b11['order']=qs[_0xa44b('0x30')](_0x191c54['query']['sort']);_0x469b11[_0xa44b('0x31')]=qs[_0xa44b('0x2b')](_[_0xa44b('0x32')](_0x191c54[_0xa44b('0x2a')],_0x2becc7['filters']),_0x4bf2ea);if(_0x191c54[_0xa44b('0x2a')][_0xa44b('0x33')]){_0x469b11[_0xa44b('0x31')]=_['merge'](_0x469b11['where'],{'$or':_[_0xa44b('0x25')](_0x4bf2ea,function(_0x4feb63){if(_0x4feb63[_0xa44b('0x34')]!==_0xa44b('0x35')){var _0x5c32cb={};_0x5c32cb[_0x4feb63[_0xa44b('0x22')]]={'$like':'%'+_0x191c54[_0xa44b('0x2a')]['filter']+'%'};return _0x5c32cb;}})});}_0x469b11=_[_0xa44b('0x36')]({},_0x469b11,_0x191c54[_0xa44b('0x37')]);var _0x4bb780={'where':_0x469b11[_0xa44b('0x31')]};return db['CmHopperHistory']['count'](_0x4bb780)[_0xa44b('0x1d')](function(_0x4af55e){_0x53742c[_0xa44b('0x1b')]=_0x4af55e;if(_0x191c54[_0xa44b('0x2a')][_0xa44b('0x38')]){_0x469b11[_0xa44b('0x39')]=[{'all':!![]}];}return db[_0xa44b('0x3a')][_0xa44b('0x3b')](_0x469b11);})[_0xa44b('0x1d')](function(_0x3db561){_0x53742c[_0xa44b('0x3c')]=_0x3db561;return _0x53742c;})[_0xa44b('0x1d')](respondWithFilteredResult(_0x1d7ab7,_0x469b11))['catch'](handleError(_0x1d7ab7,null));};exports['show']=function(_0x2cdc21,_0x42f967){var _0x56baff={'raw':!![],'where':{'id':_0x2cdc21[_0xa44b('0x3d')]['id']}},_0x55bc53={};_0x55bc53[_0xa44b('0x28')]=_[_0xa44b('0x29')](db[_0xa44b('0x3a')][_0xa44b('0x26')]);_0x55bc53['query']=_[_0xa44b('0x29')](_0x2cdc21[_0xa44b('0x2a')]);_0x55bc53[_0xa44b('0x2b')]=_['intersection'](_0x55bc53[_0xa44b('0x28')],_0x55bc53['query']);_0x56baff[_0xa44b('0x2d')]=_[_0xa44b('0x2c')](_0x55bc53[_0xa44b('0x28')],qs[_0xa44b('0x2e')](_0x2cdc21['query'][_0xa44b('0x2e')]));_0x56baff[_0xa44b('0x2d')]=_0x56baff[_0xa44b('0x2d')][_0xa44b('0x3e')]?_0x56baff[_0xa44b('0x2d')]:_0x55bc53[_0xa44b('0x28')];if(_0x2cdc21[_0xa44b('0x2a')][_0xa44b('0x38')]){_0x56baff[_0xa44b('0x39')]=[{'all':!![]}];}_0x56baff=_['merge']({},_0x56baff,_0x2cdc21[_0xa44b('0x37')]);return db[_0xa44b('0x3a')][_0xa44b('0x3f')](_0x56baff)[_0xa44b('0x1d')](handleEntityNotFound(_0x42f967,null))['then'](respondWithResult(_0x42f967,null))[_0xa44b('0x40')](handleError(_0x42f967,null));};exports[_0xa44b('0x41')]=function(_0x1a0941,_0x2dbe4f){return db['CmHopperHistory']['create'](_0x1a0941[_0xa44b('0x42')],{})['then'](respondWithResult(_0x2dbe4f,0xc9))['catch'](handleError(_0x2dbe4f,null));};exports[_0xa44b('0x43')]=function(_0x58cada,_0x4b424){return db[_0xa44b('0x3a')][_0xa44b('0x43')]()['then'](respondWithResult(_0x4b424,null))[_0xa44b('0x40')](handleError(_0x4b424,null));};exports[_0xa44b('0x1c')]=function(_0x2441a7,_0x55fb55){if(_0x2441a7[_0xa44b('0x42')][_0xa44b('0x44')]){delete _0x2441a7[_0xa44b('0x42')]['uniqueid'];}return db['CmHopperHistory'][_0xa44b('0x3f')]({'where':{'uniqueid':_0x2441a7[_0xa44b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x55fb55,null))[_0xa44b('0x1d')](saveUpdates(_0x2441a7[_0xa44b('0x42')],null))[_0xa44b('0x1d')](respondWithResult(_0x55fb55,null))[_0xa44b('0x40')](handleError(_0x55fb55,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 335e6bd..d102331 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 _0x11c8=['rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x45e6f9,_0xc9dba3){var _0x47c290=function(_0x24584f){while(--_0x24584f){_0x45e6f9['push'](_0x45e6f9['shift']());}};_0x47c290(++_0xc9dba3);}(_0x11c8,0x19a));var _0x811c=function(_0x425ecd,_0x1e1bed){_0x425ecd=_0x425ecd-0x0;var _0xddc406=_0x11c8[_0x425ecd];return _0xddc406;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var logger=require(_0x811c('0x1'))('api');var moment=require(_0x811c('0x2'));var BPromise=require(_0x811c('0x3'));var rp=require(_0x811c('0x4'));var fs=require('fs');var path=require(_0x811c('0x5'));var rimraf=require(_0x811c('0x6'));var config=require(_0x811c('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x811c('0x8')]=function(_0x40cc07,_0x537216){return _0x40cc07[_0x811c('0x9')](_0x811c('0xa'),attributes,{'tableName':_0x811c('0xb'),'paranoid':![],'indexes':[{'name':_0x811c('0xc'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1fa=['define','cm_hopper_history','endtime','uniqueid','../../config/logger','moment','./cmHopperHistory.attributes'];(function(_0x1eb0bf,_0xcb71ed){var _0x503c0e=function(_0x1afc5f){while(--_0x1afc5f){_0x1eb0bf['push'](_0x1eb0bf['shift']());}};_0x503c0e(++_0xcb71ed);}(_0xb1fa,0x9e));var _0xab1f=function(_0x5866f3,_0x594f5a){_0x5866f3=_0x5866f3-0x0;var _0x51dbf7=_0xb1fa[_0x5866f3];return _0x51dbf7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab1f('0x0'))('api');var moment=require(_0xab1f('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xab1f('0x2'));module['exports']=function(_0x50ada8,_0x4ee73b){return _0x50ada8[_0xab1f('0x3')]('CmHopperHistory',attributes,{'tableName':_0xab1f('0x4'),'paranoid':![],'indexes':[{'name':_0xab1f('0x5'),'fields':['endtime']},{'name':_0xab1f('0x6'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 4fa7ed9..6062100 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 _0x3526=['predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','where','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory','create','options','raw','debug','AvgHandleTime','CmHopperHistory','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null'];(function(_0x2fac89,_0x3f50a0){var _0x4e1d71=function(_0x4e02ae){while(--_0x4e02ae){_0x2fac89['push'](_0x2fac89['shift']());}};_0x4e1d71(++_0x3f50a0);}(_0x3526,0x1db));var _0x6352=function(_0x57e468,_0x4c0814){_0x57e468=_0x57e468-0x0;var _0x391cb4=_0x3526[_0x57e468];return _0x391cb4;};'use strict';var _=require('lodash');var util=require(_0x6352('0x0'));var moment=require(_0x6352('0x1'));var BPromise=require(_0x6352('0x2'));var rs=require(_0x6352('0x3'));var fs=require('fs');var Redis=require(_0x6352('0x4'));var db=require(_0x6352('0x5'))['db'];var utils=require(_0x6352('0x6'));var logger=require(_0x6352('0x7'))(_0x6352('0x8'));var config=require(_0x6352('0x9'));var jayson=require(_0x6352('0xa'));var client=jayson[_0x6352('0xb')][_0x6352('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2271f9,_0x1d5498,_0xdae2f9){return new BPromise(function(_0x342a21,_0x35a296){return client[_0x6352('0xd')](_0x2271f9,_0xdae2f9)[_0x6352('0xe')](function(_0x4d3073){logger[_0x6352('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1d5498,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1d5498,_0x6352('0x10'),JSON[_0x6352('0x11')](_0x4d3073));if(_0x4d3073[_0x6352('0x12')]){if(_0x4d3073[_0x6352('0x12')][_0x6352('0x13')]===0x1f4){logger[_0x6352('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x1d5498,_0x4d3073[_0x6352('0x12')][_0x6352('0x14')]);return _0x35a296(_0x4d3073[_0x6352('0x12')][_0x6352('0x14')]);}logger[_0x6352('0x12')](_0x6352('0x15'),_0x1d5498,_0x4d3073['error']['message']);return _0x342a21(_0x4d3073[_0x6352('0x12')][_0x6352('0x14')]);}else{logger[_0x6352('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1d5498,_0x6352('0x10'));_0x342a21(_0x4d3073[_0x6352('0x16')][_0x6352('0x14')]);}})[_0x6352('0x17')](function(_0x2d0de7){logger[_0x6352('0x12')](_0x6352('0x15'),_0x1d5498,_0x2d0de7);_0x35a296(_0x2d0de7);});});}exports[_0x6352('0x18')]=function(_0x2fcc57){var _0x47646d=this;return new Promise(function(_0x486d35,_0x14ebdc){return db['CmHopperHistory'][_0x6352('0x19')](_0x2fcc57['body'],{'raw':_0x2fcc57[_0x6352('0x1a')]?_0x2fcc57[_0x6352('0x1a')][_0x6352('0x1b')]===undefined?!![]:![]:!![]})[_0x6352('0xe')](function(_0xaf2621){logger[_0x6352('0xf')]('CreateCmHopperHistory',_0x2fcc57);logger[_0x6352('0x1c')](_0x6352('0x18'),_0x2fcc57,JSON[_0x6352('0x11')](_0xaf2621));_0x486d35(_0xaf2621);})[_0x6352('0x17')](function(_0x105755){logger['error']('CreateCmHopperHistory',_0x105755[_0x6352('0x14')],_0x2fcc57);_0x14ebdc(_0x47646d[_0x6352('0x12')](0x1f4,_0x105755[_0x6352('0x14')]));});});};exports[_0x6352('0x1d')]=function(_0x335cfd){var _0x187a62=this;return new Promise(function(_0x5ce583,_0x57e927){return db[_0x6352('0x1e')]['findAll']({'raw':_0x335cfd['options']?_0x335cfd['options'][_0x6352('0x1b')]===undefined?!![]:![]:!![],'where':_0x335cfd[_0x6352('0x1a')]?_0x335cfd[_0x6352('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x6352('0x1f'),db[_0x6352('0x20')][_0x6352('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')](_0x6352('0x23')))),_0x6352('0x24')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')](_0x6352('0x25')))),_0x6352('0x26')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db['sequelize']['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),_0x6352('0x27')],[db[_0x6352('0x20')]['fn'](_0x6352('0x28'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')](_0x6352('0x29')))),_0x6352('0x2a')],[db[_0x6352('0x20')]['fn'](_0x6352('0x28'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')]['literal'](_0x6352('0x2b')))),_0x6352('0x2c')]]})[_0x6352('0xe')](function(_0x408f43){logger['info'](_0x6352('0x1d'),_0x335cfd);logger[_0x6352('0x1c')](_0x6352('0x1d'),_0x335cfd,JSON[_0x6352('0x11')](_0x408f43));_0x5ce583(_0x408f43);})[_0x6352('0x17')](function(_0x514d7d){logger['error']('AvgHandleTime',_0x514d7d[_0x6352('0x14')],_0x335cfd);_0x57e927(_0x187a62[_0x6352('0x12')](0x1f4,_0x514d7d['message']));});});};exports[_0x6352('0x2d')]=function(_0x4ffdd0){var _0x3df1c4=this;return new Promise(function(_0x34b8ef,_0x8ff4d1){return db[_0x6352('0x1e')][_0x6352('0x2e')]({'raw':_0x4ffdd0[_0x6352('0x1a')]?_0x4ffdd0['options'][_0x6352('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ffdd0['options']?_0x4ffdd0['options'][_0x6352('0x2f')]||null:null,'attributes':[['campaign',_0x6352('0x30')],[db[_0x6352('0x20')]['fn']('COUNT',db[_0x6352('0x20')]['fn']('IF',db['sequelize']['literal'](_0x6352('0x31')))),_0x6352('0x32')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')]['literal'](_0x6352('0x33')))),'outboundNoAnswerCallsDay'],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db['sequelize'][_0x6352('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x6352('0x34')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')](_0x6352('0x35')))),_0x6352('0x36')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')]('`state`\x20=\x208,\x201,\x20null'))),_0x6352('0x37')],[db['sequelize']['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db['sequelize'][_0x6352('0x22')](_0x6352('0x38')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6352('0x39')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x6352('0x3a')))),_0x6352('0x3b')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')]['literal'](_0x6352('0x3c')))),'outboundBlacklistCallsDay'],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db['sequelize']['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')](_0x6352('0x3d')))),_0x6352('0x3e')],[db['sequelize']['fn'](_0x6352('0x1f'),db['sequelize']['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')](_0x6352('0x3f')))),_0x6352('0x40')],[db['sequelize']['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')](_0x6352('0x41')))),_0x6352('0x42')],[db['sequelize']['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db['sequelize'][_0x6352('0x22')](_0x6352('0x43')))),_0x6352('0x40')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x6352('0x44')]],'group':[_0x6352('0x45')]})[_0x6352('0xe')](function(_0xa0c13d){logger[_0x6352('0xf')](_0x6352('0x2d'),_0x4ffdd0);logger['debug']('GetVoiceQueueHopperHistory',_0x4ffdd0,JSON['stringify'](_0xa0c13d));_0x34b8ef(_0xa0c13d);})[_0x6352('0x17')](function(_0x15416a){logger[_0x6352('0x12')]('GetVoiceQueueHopperHistory',_0x15416a[_0x6352('0x14')],_0x4ffdd0);_0x8ff4d1(_0x3df1c4['error'](0x1f4,_0x15416a[_0x6352('0x14')]));});});};exports[_0x6352('0x46')]=function(_0x2d9572){var _0x4135b8=this;return new Promise(function(_0x3056ae,_0x31086d){return db[_0x6352('0x1e')]['findAll']({'raw':_0x2d9572[_0x6352('0x1a')]?_0x2d9572['options'][_0x6352('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d9572['options']?_0x2d9572[_0x6352('0x1a')][_0x6352('0x2f')]||null:null,'attributes':[[_0x6352('0x45'),_0x6352('0x30')],[db[_0x6352('0x20')]['fn'](_0x6352('0x1f'),db[_0x6352('0x20')][_0x6352('0x21')]('id')),_0x6352('0x47')],[db['sequelize']['fn']('COUNT',db[_0x6352('0x20')]['fn']('IF',db[_0x6352('0x20')][_0x6352('0x22')](_0x6352('0x23')))),_0x6352('0x48')]],'group':[_0x6352('0x45')]})[_0x6352('0xe')](function(_0x2b06f5){logger[_0x6352('0xf')](_0x6352('0x46'),_0x2d9572);logger[_0x6352('0x1c')]('GetCampaignHopperHistory',_0x2d9572,JSON[_0x6352('0x11')](_0x2b06f5));_0x3056ae(_0x2b06f5);})[_0x6352('0x17')](function(_0x4af12d){logger[_0x6352('0x12')](_0x6352('0x46'),_0x4af12d[_0x6352('0x14')],_0x2d9572);_0x31086d(_0x4135b8[_0x6352('0x12')](0x1f4,_0x4af12d[_0x6352('0x14')]));});});}; \ No newline at end of file +var _0xb3d3=['catch','AvgHandleTime','where','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','info','debug'];(function(_0x3125e5,_0x46aa22){var _0x2d7e4d=function(_0x4edca8){while(--_0x4edca8){_0x3125e5['push'](_0x3125e5['shift']());}};_0x2d7e4d(++_0x46aa22);}(_0xb3d3,0x1ba));var _0x3b3d=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0xb3d3[_0x3b2369];return _0x5a1367;};'use strict';var _=require(_0x3b3d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3b3d('0x1'));var rs=require(_0x3b3d('0x2'));var fs=require('fs');var Redis=require(_0x3b3d('0x3'));var db=require(_0x3b3d('0x4'))['db'];var utils=require(_0x3b3d('0x5'));var logger=require('../../config/logger')(_0x3b3d('0x6'));var config=require(_0x3b3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3b3d('0x8')][_0x3b3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3630da,_0x2045fd,_0x447d36){return new BPromise(function(_0x21ba49,_0x43bc1e){return client[_0x3b3d('0xa')](_0x3630da,_0x447d36)[_0x3b3d('0xb')](function(_0x54622f){logger['info'](_0x3b3d('0xc'),_0x2045fd,_0x3b3d('0xd'));logger['debug'](_0x3b3d('0xe'),_0x2045fd,_0x3b3d('0xd'),JSON[_0x3b3d('0xf')](_0x54622f));if(_0x54622f[_0x3b3d('0x10')]){if(_0x54622f['error'][_0x3b3d('0x11')]===0x1f4){logger['error'](_0x3b3d('0xc'),_0x2045fd,_0x54622f[_0x3b3d('0x10')][_0x3b3d('0x12')]);return _0x43bc1e(_0x54622f[_0x3b3d('0x10')]['message']);}logger[_0x3b3d('0x10')](_0x3b3d('0xc'),_0x2045fd,_0x54622f[_0x3b3d('0x10')]['message']);return _0x21ba49(_0x54622f[_0x3b3d('0x10')][_0x3b3d('0x12')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x2045fd,_0x3b3d('0xd'));_0x21ba49(_0x54622f[_0x3b3d('0x13')][_0x3b3d('0x12')]);}})['catch'](function(_0x2cda55){logger[_0x3b3d('0x10')](_0x3b3d('0xc'),_0x2045fd,_0x2cda55);_0x43bc1e(_0x2cda55);});});}exports[_0x3b3d('0x14')]=function(_0x5b7c08){var _0x304f1e=this;return new Promise(function(_0x4be438,_0x5e9b40){return db[_0x3b3d('0x15')][_0x3b3d('0x16')](_0x5b7c08['body'],{'raw':_0x5b7c08[_0x3b3d('0x17')]?_0x5b7c08[_0x3b3d('0x17')][_0x3b3d('0x18')]===undefined?!![]:![]:!![]})[_0x3b3d('0xb')](function(_0x4d19fa){logger[_0x3b3d('0x19')]('CreateCmHopperHistory',_0x5b7c08);logger[_0x3b3d('0x1a')]('CreateCmHopperHistory',_0x5b7c08,JSON[_0x3b3d('0xf')](_0x4d19fa));_0x4be438(_0x4d19fa);})[_0x3b3d('0x1b')](function(_0x511d7c){logger[_0x3b3d('0x10')]('CreateCmHopperHistory',_0x511d7c[_0x3b3d('0x12')],_0x5b7c08);_0x5e9b40(_0x304f1e[_0x3b3d('0x10')](0x1f4,_0x511d7c[_0x3b3d('0x12')]));});});};exports[_0x3b3d('0x1c')]=function(_0x1da3b4){var _0x22dd9a=this;return new Promise(function(_0x14b9b0,_0x5921ee){return db[_0x3b3d('0x15')]['findAll']({'raw':_0x1da3b4['options']?_0x1da3b4['options'][_0x3b3d('0x18')]===undefined?!![]:![]:!![],'where':_0x1da3b4[_0x3b3d('0x17')]?_0x1da3b4[_0x3b3d('0x17')][_0x3b3d('0x1d')]||null:null,'attributes':[[db[_0x3b3d('0x1e')]['fn']('COUNT',db['sequelize'][_0x3b3d('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x3b3d('0x1e')]['fn']('COUNT',db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x21')))),_0x3b3d('0x22')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0x3b3d('0x24')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn']('AVG',db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x3b3d('0x25')))),_0x3b3d('0x26')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x27'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3b3d('0x28')]]})[_0x3b3d('0xb')](function(_0x488224){logger[_0x3b3d('0x19')](_0x3b3d('0x1c'),_0x1da3b4);logger[_0x3b3d('0x1a')](_0x3b3d('0x1c'),_0x1da3b4,JSON[_0x3b3d('0xf')](_0x488224));_0x14b9b0(_0x488224);})[_0x3b3d('0x1b')](function(_0x22be39){logger[_0x3b3d('0x10')](_0x3b3d('0x1c'),_0x22be39['message'],_0x1da3b4);_0x5921ee(_0x22dd9a[_0x3b3d('0x10')](0x1f4,_0x22be39[_0x3b3d('0x12')]));});});};exports[_0x3b3d('0x29')]=function(_0x36e6d1){var _0x316d2d=this;return new Promise(function(_0xd95271,_0x4439eb){return db['CmHopperHistory'][_0x3b3d('0x2a')]({'raw':_0x36e6d1[_0x3b3d('0x17')]?_0x36e6d1[_0x3b3d('0x17')][_0x3b3d('0x18')]===undefined?!![]:![]:!![],'where':_0x36e6d1[_0x3b3d('0x17')]?_0x36e6d1[_0x3b3d('0x17')][_0x3b3d('0x1d')]||null:null,'attributes':[[_0x3b3d('0x2b'),_0x3b3d('0x2c')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x2d')))),_0x3b3d('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')](_0x3b3d('0x2f')))),_0x3b3d('0x30')],[db['sequelize']['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x31')))),_0x3b3d('0x32')],[db['sequelize']['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')](_0x3b3d('0x33')))),_0x3b3d('0x34')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x35')))),_0x3b3d('0x36')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3b3d('0x37')],[db['sequelize']['fn'](_0x3b3d('0x23'),db['sequelize']['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')]['literal'](_0x3b3d('0x38')))),'outboundBlacklistCallsDay'],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x39')))),_0x3b3d('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')]['literal'](_0x3b3d('0x3b')))),_0x3b3d('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x3b3d('0x3d')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),_0x3b3d('0x3c')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db['sequelize']['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')](_0x3b3d('0x3e')))),_0x3b3d('0x3f')]],'group':[_0x3b3d('0x2b')]})['then'](function(_0x1cb124){logger[_0x3b3d('0x19')]('GetVoiceQueueHopperHistory',_0x36e6d1);logger[_0x3b3d('0x1a')](_0x3b3d('0x29'),_0x36e6d1,JSON[_0x3b3d('0xf')](_0x1cb124));_0xd95271(_0x1cb124);})[_0x3b3d('0x1b')](function(_0x3e0768){logger[_0x3b3d('0x10')](_0x3b3d('0x29'),_0x3e0768[_0x3b3d('0x12')],_0x36e6d1);_0x4439eb(_0x316d2d[_0x3b3d('0x10')](0x1f4,_0x3e0768[_0x3b3d('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x5b33f9){var _0x4a60b2=this;return new Promise(function(_0x1f8183,_0x586bd5){return db[_0x3b3d('0x15')]['findAll']({'raw':_0x5b33f9[_0x3b3d('0x17')]?_0x5b33f9[_0x3b3d('0x17')][_0x3b3d('0x18')]===undefined?!![]:![]:!![],'where':_0x5b33f9[_0x3b3d('0x17')]?_0x5b33f9[_0x3b3d('0x17')]['where']||null:null,'attributes':[[_0x3b3d('0x2b'),'name'],[db[_0x3b3d('0x1e')]['fn']('COUNT',db['sequelize']['col']('id')),_0x3b3d('0x40')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x3b3d('0x41')]],'group':[_0x3b3d('0x2b')]})['then'](function(_0x2c8ca2){logger[_0x3b3d('0x19')](_0x3b3d('0x42'),_0x5b33f9);logger[_0x3b3d('0x1a')]('GetCampaignHopperHistory',_0x5b33f9,JSON[_0x3b3d('0xf')](_0x2c8ca2));_0x1f8183(_0x2c8ca2);})['catch'](function(_0x44a767){logger[_0x3b3d('0x10')](_0x3b3d('0x42'),_0x44a767[_0x3b3d('0x12')],_0x5b33f9);_0x586bd5(_0x4a60b2[_0x3b3d('0x10')](0x1f4,_0x44a767[_0x3b3d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 382166d..d54ad3f 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 _0x82a4=['/describe','describe','/:id','post','create','multer','path','connect-timeout','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x49253a,_0x2c347d){var _0x749351=function(_0x291645){while(--_0x291645){_0x49253a['push'](_0x49253a['shift']());}};_0x749351(++_0x2c347d);}(_0x82a4,0x83));var _0x482a=function(_0x38cfaf,_0x1ce22a){_0x38cfaf=_0x38cfaf-0x0;var _0x1bf5f7=_0x82a4[_0x38cfaf];return _0x1bf5f7;};'use strict';var multer=require(_0x482a('0x0'));var util=require('util');var path=require(_0x482a('0x1'));var timeout=require(_0x482a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x482a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x482a('0x4'));var config=require('../../config/environment');var controller=require(_0x482a('0x5'));router[_0x482a('0x6')]('/',auth[_0x482a('0x7')](),controller[_0x482a('0x8')]);router[_0x482a('0x6')](_0x482a('0x9'),auth[_0x482a('0x7')](),controller[_0x482a('0xa')]);router['get'](_0x482a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x482a('0xc')]('/',auth['isAuthenticated'](),controller[_0x482a('0xd')]);router['put'](_0x482a('0xb'),auth[_0x482a('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x7a2e=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0xd0dc06,_0x4a0de6){var _0x2b264f=function(_0xf17c61){while(--_0xf17c61){_0xd0dc06['push'](_0xd0dc06['shift']());}};_0x2b264f(++_0x4a0de6);}(_0x7a2e,0x190));var _0xe7a2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7a2e[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0xe7a2('0x0'));var path=require('path');var timeout=require(_0xe7a2('0x1'));var express=require(_0xe7a2('0x2'));var router=express[_0xe7a2('0x3')]();var fs_extra=require(_0xe7a2('0x4'));var auth=require(_0xe7a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe7a2('0x6'));var controller=require(_0xe7a2('0x7'));router[_0xe7a2('0x8')]('/',auth['isAuthenticated'](),controller[_0xe7a2('0x9')]);router[_0xe7a2('0x8')]('/describe',auth[_0xe7a2('0xa')](),controller[_0xe7a2('0xb')]);router[_0xe7a2('0x8')](_0xe7a2('0xc'),auth[_0xe7a2('0xa')](),controller[_0xe7a2('0xd')]);router[_0xe7a2('0xe')]('/',auth[_0xe7a2('0xa')](),controller[_0xe7a2('0xf')]);router[_0xe7a2('0x10')](_0xe7a2('0xc'),auth[_0xe7a2('0xa')](),controller[_0xe7a2('0x11')]);module[_0xe7a2('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 4f13f51..536e0cb 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 _0x6c7b=['STRING','sequelize'];(function(_0x4c71e0,_0x1f68be){var _0x52741f=function(_0x15e2ba){while(--_0x15e2ba){_0x4c71e0['push'](_0x4c71e0['shift']());}};_0x52741f(++_0x1f68be);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x56fb38,_0x5dcac3){_0x56fb38=_0x56fb38-0x0;var _0x194e10=_0x6c7b[_0x56fb38];return _0x194e10;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1670=['name','STRING','sequelize','exports'];(function(_0x34f85f,_0x530a5f){var _0xbc748d=function(_0x4f45fa){while(--_0x4f45fa){_0x34f85f['push'](_0x34f85f['shift']());}};_0xbc748d(++_0x530a5f);}(_0x1670,0x9a));var _0x0167=function(_0x56324f,_0x470354){_0x56324f=_0x56324f-0x0;var _0x1197de=_0x1670[_0x56324f];return _0x1197de;};'use strict';var Sequelize=require(_0x0167('0x0'));module[_0x0167('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0167('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x0167('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index cda90e6..761520c 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 _0xf4de=['success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','TEXT','text','type','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','get','Lists','then','error','stack','name','index','map','CmList','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','update','describe','addDisposition','ListId','Disposition','findOne','pick','removeDispositions','addContacts','CmContact','isArray','tags','join','push','ids'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xf4de,0xca));var _0xef4d=function(_0x36fe26,_0x474b1a){_0x36fe26=_0x36fe26-0x0;var _0x37984c=_0xf4de[_0x36fe26];return _0x37984c;};'use strict';var emlformat=require(_0xef4d('0x0'));var rimraf=require(_0xef4d('0x1'));var zipdir=require(_0xef4d('0x2'));var jsonpatch=require(_0xef4d('0x3'));var rp=require(_0xef4d('0x4'));var moment=require(_0xef4d('0x5'));var BPromise=require(_0xef4d('0x6'));var Mustache=require(_0xef4d('0x7'));var util=require(_0xef4d('0x8'));var path=require(_0xef4d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xef4d('0xa'));var fs=require('fs');var fs_extra=require(_0xef4d('0xb'));var _=require(_0xef4d('0xc'));var squel=require(_0xef4d('0xd'));var crypto=require(_0xef4d('0xe'));var jsforce=require(_0xef4d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xef4d('0x10'));var querystring=require(_0xef4d('0x11'));var Papa=require('papaparse');var Redis=require(_0xef4d('0x12'));var authService=require(_0xef4d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef4d('0x14'));var logger=require(_0xef4d('0x15'))(_0xef4d('0x16'));var utils=require(_0xef4d('0x17'));var config=require(_0xef4d('0x18'));var licenseUtil=require(_0xef4d('0x19'));var db=require(_0xef4d('0x1a'))['db'];config[_0xef4d('0x1b')]=_['defaults'](config['redis'],{'host':_0xef4d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xef4d('0x1d'))[_0xef4d('0x1e')](socket);function respondWithStatusCode(_0x240fad,_0x187eb6){_0x187eb6=_0x187eb6||0xcc;return function(_0x3a8889){if(_0x3a8889){return _0x240fad[_0xef4d('0x1f')](_0x187eb6);}return _0x240fad[_0xef4d('0x20')](_0x187eb6)[_0xef4d('0x21')]();};}function respondWithResult(_0x760709,_0x58c53e){_0x58c53e=_0x58c53e||0xc8;return function(_0x68863b){if(_0x68863b){return _0x760709[_0xef4d('0x20')](_0x58c53e)[_0xef4d('0x22')](_0x68863b);}};}function respondWithFilteredResult(_0x3a0963,_0x29647f){return function(_0x45f001){if(_0x45f001){var _0x1b127e=typeof _0x29647f['offset']===_0xef4d('0x23')&&typeof _0x29647f[_0xef4d('0x24')]===_0xef4d('0x23');var _0x331d2c=_0x45f001[_0xef4d('0x25')];var _0x870570=_0x1b127e?0x0:_0x29647f[_0xef4d('0x26')];var _0xdb2267=_0x1b127e?_0x45f001[_0xef4d('0x25')]:_0x29647f['offset']+_0x29647f[_0xef4d('0x24')];var _0x2dfcc2;if(_0xdb2267>=_0x331d2c){_0xdb2267=_0x331d2c;_0x2dfcc2=0xc8;}else{_0x2dfcc2=0xce;}_0x3a0963['status'](_0x2dfcc2);return _0x3a0963[_0xef4d('0x27')](_0xef4d('0x28'),_0x870570+'-'+_0xdb2267+'/'+_0x331d2c)[_0xef4d('0x22')](_0x45f001);}return null;};}function patchUpdates(_0x2b1964){return function(_0x19f81f){try{jsonpatch[_0xef4d('0x29')](_0x19f81f,_0x2b1964,!![]);}catch(_0x1f6cfe){return BPromise[_0xef4d('0x2a')](_0x1f6cfe);}return _0x19f81f['save']();};}function saveUpdates(_0x4298ed,_0x1d964f){return function(_0x1a2cae){if(_0x1a2cae){return _0x1a2cae['update'](_0x4298ed)['then'](function(_0x2d7bd6){return _0x2d7bd6;});}return null;};}function removeEntity(_0x1314d7,_0xf2676d){return function(_0x13ce6c){if(_0x13ce6c){return _0x13ce6c[_0xef4d('0x2b')]()['then'](function(){var _0x36d0fa=_0x13ce6c[_0xef4d('0x2c')]({'plain':!![]});var _0x50cafe=_0xef4d('0x2d');return db['UserProfileResource'][_0xef4d('0x2b')]({'where':{'type':_0x50cafe,'resourceId':_0x36d0fa['id']}})['then'](function(){return _0x13ce6c;});})[_0xef4d('0x2e')](function(){_0x1314d7['status'](0xcc)[_0xef4d('0x21')]();});}};}function handleEntityNotFound(_0x461db0,_0x379133){return function(_0x1e0d3c){if(!_0x1e0d3c){_0x461db0[_0xef4d('0x1f')](0x194);}return _0x1e0d3c;};}function handleError(_0x3a78f9,_0x54167b){_0x54167b=_0x54167b||0x1f4;return function(_0x3d8ce1){logger[_0xef4d('0x2f')](_0x3d8ce1[_0xef4d('0x30')]);if(_0x3d8ce1[_0xef4d('0x31')]){delete _0x3d8ce1[_0xef4d('0x31')];}_0x3a78f9['status'](_0x54167b)['send'](_0x3d8ce1);};}exports[_0xef4d('0x32')]=function(_0x5e3b5a,_0x51fc1f){var _0x4c6117={},_0x841815={},_0xfb79a2={'count':0x0,'rows':[]};var _0x475e34=_[_0xef4d('0x33')](db[_0xef4d('0x34')]['rawAttributes'],function(_0x15b22b){return{'name':_0x15b22b[_0xef4d('0x35')],'type':_0x15b22b['type'][_0xef4d('0x36')]};});_0x841815['model']=_[_0xef4d('0x33')](_0x475e34,'name');_0x841815['query']=_[_0xef4d('0x37')](_0x5e3b5a[_0xef4d('0x38')]);_0x841815[_0xef4d('0x39')]=_[_0xef4d('0x3a')](_0x841815['model'],_0x841815[_0xef4d('0x38')]);_0x4c6117[_0xef4d('0x3b')]=_[_0xef4d('0x3a')](_0x841815[_0xef4d('0x3c')],qs[_0xef4d('0x3d')](_0x5e3b5a[_0xef4d('0x38')][_0xef4d('0x3d')]));_0x4c6117[_0xef4d('0x3b')]=_0x4c6117['attributes'][_0xef4d('0x3e')]?_0x4c6117[_0xef4d('0x3b')]:_0x841815[_0xef4d('0x3c')];if(!_0x5e3b5a[_0xef4d('0x38')][_0xef4d('0x3f')](_0xef4d('0x40'))){_0x4c6117[_0xef4d('0x24')]=qs['limit'](_0x5e3b5a[_0xef4d('0x38')][_0xef4d('0x24')]);_0x4c6117[_0xef4d('0x26')]=qs[_0xef4d('0x26')](_0x5e3b5a[_0xef4d('0x38')][_0xef4d('0x26')]);}_0x4c6117[_0xef4d('0x41')]=qs[_0xef4d('0x42')](_0x5e3b5a['query'][_0xef4d('0x42')]);_0x4c6117[_0xef4d('0x43')]=qs[_0xef4d('0x39')](_['pick'](_0x5e3b5a[_0xef4d('0x38')],_0x841815['filters']),_0x475e34);if(_0x5e3b5a[_0xef4d('0x38')][_0xef4d('0x44')]){_0x4c6117[_0xef4d('0x43')]=_[_0xef4d('0x45')](_0x4c6117[_0xef4d('0x43')],{'$or':_[_0xef4d('0x33')](_0x475e34,function(_0x5e9c90){if(_0x5e9c90['type']!==_0xef4d('0x46')){var _0xe6ae52={};_0xe6ae52[_0x5e9c90[_0xef4d('0x31')]]={'$like':'%'+_0x5e3b5a[_0xef4d('0x38')][_0xef4d('0x44')]+'%'};return _0xe6ae52;}})});}_0x4c6117=_['merge']({},_0x4c6117,_0x5e3b5a[_0xef4d('0x47')]);var _0x56a2ea={'where':_0x4c6117[_0xef4d('0x43')]};return db['CmList'][_0xef4d('0x25')](_0x56a2ea)[_0xef4d('0x2e')](function(_0x555579){_0xfb79a2[_0xef4d('0x25')]=_0x555579;if(_0x5e3b5a[_0xef4d('0x38')][_0xef4d('0x48')]){_0x4c6117[_0xef4d('0x49')]=[{'all':!![]}];}return db['CmList'][_0xef4d('0x4a')](_0x4c6117);})['then'](function(_0x5ae410){_0xfb79a2[_0xef4d('0x4b')]=_0x5ae410;return _0xfb79a2;})[_0xef4d('0x2e')](respondWithFilteredResult(_0x51fc1f,_0x4c6117))['catch'](handleError(_0x51fc1f,null));};exports['show']=function(_0x39963d,_0x306751){var _0x30e72f={'raw':![],'where':{'id':_0x39963d[_0xef4d('0x4c')]['id']}},_0x3f5500={};_0x3f5500['model']=_[_0xef4d('0x37')](db[_0xef4d('0x34')][_0xef4d('0x4d')]);_0x3f5500[_0xef4d('0x38')]=_['keys'](_0x39963d[_0xef4d('0x38')]);_0x3f5500[_0xef4d('0x39')]=_['intersection'](_0x3f5500['model'],_0x3f5500[_0xef4d('0x38')]);_0x30e72f['attributes']=_[_0xef4d('0x3a')](_0x3f5500[_0xef4d('0x3c')],qs[_0xef4d('0x3d')](_0x39963d[_0xef4d('0x38')][_0xef4d('0x3d')]));_0x30e72f[_0xef4d('0x3b')]=_0x30e72f[_0xef4d('0x3b')][_0xef4d('0x3e')]?_0x30e72f[_0xef4d('0x3b')]:_0x3f5500[_0xef4d('0x3c')];if(_0x39963d[_0xef4d('0x38')]['includeAll']){_0x30e72f['include']=[{'all':!![]}];}_0x30e72f=_[_0xef4d('0x45')]({},_0x30e72f,_0x39963d[_0xef4d('0x47')]);return db[_0xef4d('0x34')]['find'](_0x30e72f)['then'](handleEntityNotFound(_0x306751,null))[_0xef4d('0x2e')](respondWithResult(_0x306751,null))[_0xef4d('0x4e')](handleError(_0x306751,null));};exports[_0xef4d('0x4f')]=function(_0x1eced1,_0x3d833c){return db[_0xef4d('0x34')][_0xef4d('0x4f')](_0x1eced1[_0xef4d('0x50')],{})[_0xef4d('0x2e')](function(_0x1d42b4){var _0x43d328=_0x1eced1[_0xef4d('0x51')][_0xef4d('0x2c')]({'plain':!![]});if(!_0x43d328)throw new Error(_0xef4d('0x52'));if(_0x43d328['role']===_0xef4d('0x51')){var _0x51810f=_0x1d42b4['get']({'plain':!![]});var _0x14c130=_0xef4d('0x2d');return db[_0xef4d('0x53')][_0xef4d('0x54')]({'where':{'name':_0x14c130,'userProfileId':_0x43d328[_0xef4d('0x55')]},'raw':!![]})[_0xef4d('0x2e')](function(_0x4afae2){if(_0x4afae2&&_0x4afae2[_0xef4d('0x56')]===0x0){return db['UserProfileResource'][_0xef4d('0x4f')]({'name':_0x51810f[_0xef4d('0x31')],'resourceId':_0x51810f['id'],'type':_0x4afae2['name'],'sectionId':_0x4afae2['id']},{})['then'](function(){return _0x1d42b4;});}else{return _0x1d42b4;}})[_0xef4d('0x4e')](function(_0xfdc434){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfdc434);throw _0xfdc434;});}return _0x1d42b4;})[_0xef4d('0x2e')](respondWithResult(_0x3d833c,0xc9))['catch'](handleError(_0x3d833c,null));};exports[_0xef4d('0x57')]=function(_0x43c44d,_0x54fb95){if(_0x43c44d['body']['id']){delete _0x43c44d[_0xef4d('0x50')]['id'];}return db[_0xef4d('0x34')][_0xef4d('0x54')]({'where':{'id':_0x43c44d[_0xef4d('0x4c')]['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0x54fb95,null))[_0xef4d('0x2e')](saveUpdates(_0x43c44d[_0xef4d('0x50')],null))[_0xef4d('0x2e')](respondWithResult(_0x54fb95,null))[_0xef4d('0x4e')](handleError(_0x54fb95,null));};exports[_0xef4d('0x2b')]=function(_0x38ce52,_0x1b4ada){return db[_0xef4d('0x34')][_0xef4d('0x54')]({'where':{'id':_0x38ce52[_0xef4d('0x4c')]['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0x1b4ada,null))[_0xef4d('0x2e')](removeEntity(_0x1b4ada,null))[_0xef4d('0x4e')](handleError(_0x1b4ada,null));};exports[_0xef4d('0x58')]=function(_0x230754,_0x1f9ee4){return db[_0xef4d('0x34')][_0xef4d('0x58')]()[_0xef4d('0x2e')](respondWithResult(_0x1f9ee4,null))[_0xef4d('0x4e')](handleError(_0x1f9ee4,null));};exports[_0xef4d('0x59')]=function(_0x1726cf,_0x163511,_0x24305e){if(_0x1726cf[_0xef4d('0x50')]['id']){delete _0x1726cf[_0xef4d('0x50')]['id'];}return db[_0xef4d('0x34')]['find']({'where':{'id':_0x1726cf['params']['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0x163511,null))[_0xef4d('0x2e')](function(_0x11433d){if(_0x11433d){_0x1726cf['body'][_0xef4d('0x5a')]=_0x11433d['id'];return db[_0xef4d('0x5b')][_0xef4d('0x4f')](_0x1726cf[_0xef4d('0x50')]);}})[_0xef4d('0x2e')](respondWithResult(_0x163511,null))[_0xef4d('0x4e')](handleError(_0x163511,null));};exports['getDispositions']=function(_0xdc9bd4,_0x5afc0b,_0x486d41){var _0x23b0f3={'raw':![],'where':{}};var _0x16d7e5={};var _0x2a9e2c={'count':0x0,'rows':[]};return db[_0xef4d('0x34')][_0xef4d('0x5c')]({'where':{'id':_0xdc9bd4['params']['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0x5afc0b,null))[_0xef4d('0x2e')](function(_0x2f1a69){if(_0x2f1a69){_0x16d7e5[_0xef4d('0x3c')]=_['keys'](db[_0xef4d('0x5b')]['rawAttributes']);_0x16d7e5[_0xef4d('0x38')]=_[_0xef4d('0x37')](_0xdc9bd4['query']);_0x16d7e5[_0xef4d('0x39')]=_[_0xef4d('0x3a')](_0x16d7e5[_0xef4d('0x3c')],_0x16d7e5[_0xef4d('0x38')]);_0x23b0f3[_0xef4d('0x3b')]=_[_0xef4d('0x3a')](_0x16d7e5[_0xef4d('0x3c')],qs['fields'](_0xdc9bd4[_0xef4d('0x38')][_0xef4d('0x3d')]));_0x23b0f3[_0xef4d('0x3b')]=_0x23b0f3[_0xef4d('0x3b')][_0xef4d('0x3e')]?_0x23b0f3[_0xef4d('0x3b')]:_0x16d7e5['model'];if(!_0xdc9bd4['query'][_0xef4d('0x3f')](_0xef4d('0x40'))){_0x23b0f3[_0xef4d('0x24')]=qs[_0xef4d('0x24')](_0xdc9bd4[_0xef4d('0x38')][_0xef4d('0x24')]);_0x23b0f3['offset']=qs[_0xef4d('0x26')](_0xdc9bd4[_0xef4d('0x38')][_0xef4d('0x26')]);}_0x23b0f3[_0xef4d('0x41')]=qs['sort'](_0xdc9bd4[_0xef4d('0x38')]['sort']);_0x23b0f3[_0xef4d('0x43')]=qs[_0xef4d('0x39')](_[_0xef4d('0x5d')](_0xdc9bd4['query'],_0x16d7e5['filters']));_0x23b0f3[_0xef4d('0x43')][_0xef4d('0x5a')]=_0x2f1a69['id'];if(_0xdc9bd4[_0xef4d('0x38')][_0xef4d('0x44')]){_0x23b0f3[_0xef4d('0x43')]=_[_0xef4d('0x45')](_0x23b0f3['where'],{'$or':_['map'](_0x23b0f3['attributes'],function(_0x133f2b){var _0x4a3361={};_0x4a3361[_0x133f2b]={'$like':'%'+_0xdc9bd4[_0xef4d('0x38')][_0xef4d('0x44')]+'%'};return _0x4a3361;})});}_0x23b0f3=_[_0xef4d('0x45')]({},_0x23b0f3,_0xdc9bd4[_0xef4d('0x47')]);return db[_0xef4d('0x5b')][_0xef4d('0x25')]({'where':_0x23b0f3[_0xef4d('0x43')]})['then'](function(_0x5efadc){_0x2a9e2c['count']=_0x5efadc;if(_0xdc9bd4['query'][_0xef4d('0x48')]){_0x23b0f3[_0xef4d('0x49')]=[{'all':!![]}];}return db[_0xef4d('0x5b')][_0xef4d('0x4a')](_0x23b0f3);})[_0xef4d('0x2e')](function(_0x5da7c5){_0x2a9e2c[_0xef4d('0x4b')]=_0x5da7c5;return _0x2a9e2c;});}})[_0xef4d('0x2e')](respondWithFilteredResult(_0x5afc0b,_0x23b0f3))[_0xef4d('0x4e')](handleError(_0x5afc0b,null));};exports[_0xef4d('0x5e')]=function(_0x22f406,_0x4db1ca,_0x598e19){return db[_0xef4d('0x34')][_0xef4d('0x54')]({'where':{'id':_0x22f406[_0xef4d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4db1ca,null))[_0xef4d('0x2e')](function(_0x588d36){if(_0x588d36){return _0x588d36['removeDispositions'](_0x22f406[_0xef4d('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x4db1ca,null))[_0xef4d('0x4e')](handleError(_0x4db1ca,null));};exports[_0xef4d('0x5f')]=function(_0x2ef517,_0xd91158,_0x5a96a3){return db[_0xef4d('0x34')]['find']({'where':{'id':_0x2ef517['params']['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0xd91158,null))[_0xef4d('0x2e')](function(_0xda5800){if(_0xda5800){var _0xc0f15a=[];var _0x51ded5={'success':[],'errors':[]};return db[_0xef4d('0x60')][_0xef4d('0x58')]()[_0xef4d('0x2e')](function(_0xe2db1a){if(_0x2ef517['body']['tags']&&_[_0xef4d('0x61')](_0x2ef517[_0xef4d('0x50')][_0xef4d('0x62')])){if(_0x2ef517[_0xef4d('0x50')][_0xef4d('0x62')][_0xef4d('0x3e')]){_0x2ef517[_0xef4d('0x50')][_0xef4d('0x62')]=_0x2ef517[_0xef4d('0x50')]['tags'][_0xef4d('0x63')](';')+';';}else{_0x2ef517['body'][_0xef4d('0x62')]=null;}}else{_0x2ef517[_0xef4d('0x50')]['tags']=null;}if(_0x2ef517[_0xef4d('0x50')]&&_['isArray'](_0x2ef517['body'])){for(var _0x4a4578=0x0;_0x4a4578<_0x2ef517['body'][_0xef4d('0x3e')];_0x4a4578+=0x1){_0x2ef517[_0xef4d('0x50')][_0x4a4578]['ListId']=_0x2ef517[_0xef4d('0x4c')]['id'];_0xc0f15a[_0xef4d('0x64')](_0x2ef517['body'][_0x4a4578]);}return BPromise['each'](_0xc0f15a,function(_0x1b21c1){return db['CmContact'][_0xef4d('0x4f')](_['omit'](_0x1b21c1,[_0xef4d('0x65'),'id'])||{},{'fields':_[_0xef4d('0x37')](_0xe2db1a),'raw':!![]})[_0xef4d('0x2e')](function(_0x97c3b2){_0x51ded5[_0xef4d('0x66')]['push'](_0x97c3b2[_0xef4d('0x67')]);})[_0xef4d('0x4e')](function(_0x147cdb){_0x51ded5[_0xef4d('0x68')]['push']({'data':_0x1b21c1,'error':_0x147cdb[_0xef4d('0x69')]});});})[_0xef4d('0x2e')](function(_0x370ef1){return _0x51ded5;})['catch'](function(_0x17d68f){return _0x17d68f;});}else{_0xd91158[_0xef4d('0x20')](0x190)[_0xef4d('0x22')]({'message':_0xef4d('0x6a')});}});}})[_0xef4d('0x2e')](respondWithResult(_0xd91158,null))['catch'](handleError(_0xd91158,null));};exports[_0xef4d('0x6b')]=function(_0x4cb91f,_0x996293,_0x2b98c9){var _0x54e62f;return db[_0xef4d('0x34')][_0xef4d('0x54')]({'where':{'id':_0x4cb91f[_0xef4d('0x4c')]['id']},'include':[{'model':db[_0xef4d('0x6c')],'as':_0xef4d('0x6d')}]})['then'](handleEntityNotFound(_0x996293,null))['then'](function(_0x4d1fa2){if(_0x4d1fa2){_0x54e62f=_0x4d1fa2;return db[_0xef4d('0x60')][_0xef4d('0x4d')];}})[_0xef4d('0x2e')](function(_0x25e3ab){if(_0x25e3ab){var _0x4acb37={};var _0x5f5ddb={};_0x5f5ddb[_0xef4d('0x3c')]=_[_0xef4d('0x6e')](_['keys'](_0x25e3ab),_[_0xef4d('0x33')](_0x54e62f[_0xef4d('0x6d')],function(_0x5eb3fb){return util[_0xef4d('0x6f')](_0xef4d('0x70'),_0x5eb3fb['id']);}));_0x5f5ddb[_0xef4d('0x38')]=_['keys'](_0x4cb91f[_0xef4d('0x38')]);_0x5f5ddb[_0xef4d('0x39')]=_[_0xef4d('0x3a')](_0x5f5ddb[_0xef4d('0x3c')],_0x5f5ddb[_0xef4d('0x38')]);_0x4acb37[_0xef4d('0x3b')]=_[_0xef4d('0x3a')](_0x5f5ddb[_0xef4d('0x3c')],qs[_0xef4d('0x3d')](_0x4cb91f['query']['fields']));_0x4acb37[_0xef4d('0x3b')]=_0x4acb37['attributes'][_0xef4d('0x3e')]?_0x4acb37[_0xef4d('0x3b')]:_0x5f5ddb[_0xef4d('0x3c')];if(!_0x4cb91f[_0xef4d('0x38')][_0xef4d('0x3f')](_0xef4d('0x40'))){_0x4acb37[_0xef4d('0x24')]=qs[_0xef4d('0x24')](_0x4cb91f[_0xef4d('0x38')][_0xef4d('0x24')]);_0x4acb37[_0xef4d('0x26')]=qs[_0xef4d('0x26')](_0x4cb91f[_0xef4d('0x38')]['offset']);}_0x4acb37[_0xef4d('0x41')]=qs['sort'](_0x4cb91f[_0xef4d('0x38')][_0xef4d('0x42')]);_0x4acb37['where']=qs[_0xef4d('0x39')](_['pick'](_0x4cb91f[_0xef4d('0x38')],_0x5f5ddb[_0xef4d('0x39')]));_0x4acb37[_0xef4d('0x71')]=!![];if(_0x4cb91f[_0xef4d('0x38')][_0xef4d('0x44')]){_0x4acb37[_0xef4d('0x43')]=_[_0xef4d('0x45')](_0x4acb37[_0xef4d('0x43')],{'$or':_[_0xef4d('0x33')](_0x4acb37[_0xef4d('0x3b')],function(_0x40977d){var _0x499e93={};_0x499e93[_0x40977d]={'$like':'%'+_0x4cb91f[_0xef4d('0x38')][_0xef4d('0x44')]+'%'};return _0x499e93;})});}_0x4acb37=_[_0xef4d('0x45')]({},_0x4acb37,_0x4cb91f[_0xef4d('0x47')]);return _0x54e62f['getContacts'](_0x4acb37);}})['then'](respondWithResult(_0x996293,null))[_0xef4d('0x4e')](handleError(_0x996293,null));};exports[_0xef4d('0x72')]=function(_0x221e06,_0x5f0b86,_0x48dccb){var _0x589e28;return db[_0xef4d('0x34')][_0xef4d('0x54')]({'where':{'id':_0x221e06[_0xef4d('0x4c')]['id']},'include':[{'model':db[_0xef4d('0x6c')],'as':_0xef4d('0x6d')}]})[_0xef4d('0x2e')](handleEntityNotFound(_0x5f0b86,null))[_0xef4d('0x2e')](function(_0x532da9){if(_0x532da9){_0x589e28=_0x532da9;return db['CmContact'][_0xef4d('0x4d')];}})[_0xef4d('0x2e')](function(_0x3a8a6e){if(_0x3a8a6e){var _0xc0f3dc={};var _0x320c6a={};_0x320c6a[_0xef4d('0x3c')]=_[_0xef4d('0x6e')](_[_0xef4d('0x37')](_0x3a8a6e),_['map'](_0x589e28[_0xef4d('0x6d')],function(_0x4cc864){return util['format']('cf_%d',_0x4cc864['id']);}));_0x320c6a[_0xef4d('0x38')]=_[_0xef4d('0x37')](_0x221e06[_0xef4d('0x38')]);_0x320c6a[_0xef4d('0x39')]=_[_0xef4d('0x3a')](_0x320c6a[_0xef4d('0x3c')],_0x320c6a[_0xef4d('0x38')]);_0xc0f3dc['attributes']=_[_0xef4d('0x3a')](_0x320c6a[_0xef4d('0x3c')],qs[_0xef4d('0x3d')](_0x221e06[_0xef4d('0x38')][_0xef4d('0x3d')]));_0xc0f3dc[_0xef4d('0x3b')]=_0xc0f3dc[_0xef4d('0x3b')]['length']?_0xc0f3dc[_0xef4d('0x3b')]:_0x320c6a[_0xef4d('0x3c')];if(!_0x221e06[_0xef4d('0x38')][_0xef4d('0x3f')](_0xef4d('0x40'))){_0xc0f3dc['limit']=qs[_0xef4d('0x24')](_0x221e06[_0xef4d('0x38')][_0xef4d('0x24')]);_0xc0f3dc[_0xef4d('0x26')]=qs[_0xef4d('0x26')](_0x221e06[_0xef4d('0x38')]['offset']);}_0xc0f3dc[_0xef4d('0x41')]=qs['sort'](_0x221e06[_0xef4d('0x38')][_0xef4d('0x42')]);_0xc0f3dc[_0xef4d('0x43')]=qs['filters'](_[_0xef4d('0x5d')](_0x221e06[_0xef4d('0x38')],_0x320c6a[_0xef4d('0x39')]));_0xc0f3dc[_0xef4d('0x71')]=!![];if(_0x221e06[_0xef4d('0x38')]['filter']){_0xc0f3dc[_0xef4d('0x43')]=_[_0xef4d('0x45')](_0xc0f3dc[_0xef4d('0x43')],{'$or':_[_0xef4d('0x33')](_0xc0f3dc[_0xef4d('0x3b')],function(_0x17e7d7){var _0x30e2db={};_0x30e2db[_0x17e7d7]={'$like':'%'+_0x221e06[_0xef4d('0x38')][_0xef4d('0x44')]+'%'};return _0x30e2db;})});}_0xc0f3dc=_[_0xef4d('0x45')]({},_0xc0f3dc,_0x221e06[_0xef4d('0x47')]);return _0x589e28[_0xef4d('0x6b')](_0xc0f3dc);}})[_0xef4d('0x2e')](function(_0x26b0cf){if(!_[_0xef4d('0x73')](_0x26b0cf)){var _0x1d60a8=toCsv(_0x26b0cf);var _0x3f965c=Date[_0xef4d('0x74')]();fs[_0xef4d('0x75')](util[_0xef4d('0x6f')](_0xef4d('0x76'),_0x589e28['id'],_0x3f965c),_0x1d60a8);_0x5f0b86[_0xef4d('0x77')](_0xef4d('0x78'),_0xef4d('0x79')+util[_0xef4d('0x6f')]('list_%d_%s.csv',_0x589e28['id'],_0x3f965c));_0x5f0b86[_0xef4d('0x77')](_0xef4d('0x7a'),_0xef4d('0x7b'));return _0x5f0b86[_0xef4d('0x7c')](util[_0xef4d('0x6f')](_0xef4d('0x76'),_0x589e28['id'],_0x3f965c));}else{return _0x5f0b86[_0xef4d('0x1f')](0xcc);}})['catch'](handleError(_0x5f0b86,null));};exports[_0xef4d('0x7d')]=function(_0x3ea4fc,_0x5e4ed5,_0x5c7fab){var _0x22e11f;delete _0x3ea4fc[_0xef4d('0x50')]['id'];return db[_0xef4d('0x34')][_0xef4d('0x5c')]({'where':{'id':_0x3ea4fc[_0xef4d('0x4c')]['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0x5e4ed5,null))[_0xef4d('0x2e')](function(_0x5c752b){if(_0x5c752b){return db[_0xef4d('0x7e')]['transaction'](function(_0x207bee){return db[_0xef4d('0x6c')][_0xef4d('0x4f')](_0x3ea4fc[_0xef4d('0x50')],{'transaction':_0x207bee})[_0xef4d('0x2e')](function(_0x22f18f){_0x22e11f=_0x22f18f;return _0x5c752b[_0xef4d('0x7f')](_0x22f18f,{'transaction':_0x207bee});})[_0xef4d('0x2e')](function(){var _0x2e8304={'type':db['Sequelize'][_0xef4d('0x80')],'transaction':_0x207bee};switch(_0x3ea4fc[_0xef4d('0x50')]['type']){case _0xef4d('0x81'):_0x2e8304[_0xef4d('0x82')]=db[_0xef4d('0x83')][_0xef4d('0x80')];break;case _0xef4d('0x84'):_0x2e8304[_0xef4d('0x82')]=db[_0xef4d('0x83')][_0xef4d('0x85')];break;case _0xef4d('0x86'):_0x2e8304['type']=db[_0xef4d('0x83')][_0xef4d('0x87')];_0x2e8304[_0xef4d('0x88')]=![];break;default:}return db[_0xef4d('0x7e')][_0xef4d('0x89')][_0xef4d('0x8a')](_0xef4d('0x8b'),util[_0xef4d('0x6f')](_0xef4d('0x8c'),_0x22e11f['id']),_0x2e8304);})[_0xef4d('0x2e')](function(){return _0x22e11f;});});}})[_0xef4d('0x2e')](respondWithResult(_0x5e4ed5,null))['catch'](handleError(_0x5e4ed5,null));};exports[_0xef4d('0x8d')]=function(_0x4d36e4,_0xf57814,_0x2013ff){var _0x221bd7={};var _0x121dff={};var _0x13ad90;var _0x20a29c;return db[_0xef4d('0x34')][_0xef4d('0x5c')]({'where':{'id':_0x4d36e4[_0xef4d('0x4c')]['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0xf57814,null))[_0xef4d('0x2e')](function(_0x1ff9fb){if(_0x1ff9fb){_0x13ad90=_0x1ff9fb;_0x121dff[_0xef4d('0x3c')]=_[_0xef4d('0x37')](db['CmCustomField']['rawAttributes']);_0x121dff[_0xef4d('0x38')]=_[_0xef4d('0x37')](_0x4d36e4[_0xef4d('0x38')]);_0x121dff[_0xef4d('0x39')]=_['intersection'](_0x121dff[_0xef4d('0x3c')],_0x121dff[_0xef4d('0x38')]);_0x221bd7['attributes']=_['intersection'](_0x121dff['model'],qs[_0xef4d('0x3d')](_0x4d36e4[_0xef4d('0x38')][_0xef4d('0x3d')]));_0x221bd7[_0xef4d('0x3b')]=_0x221bd7[_0xef4d('0x3b')][_0xef4d('0x3e')]?_0x221bd7['attributes']:_0x121dff[_0xef4d('0x3c')];_0x221bd7[_0xef4d('0x41')]=qs[_0xef4d('0x42')](_0x4d36e4[_0xef4d('0x38')]['sort']);_0x221bd7[_0xef4d('0x43')]=qs[_0xef4d('0x39')](_[_0xef4d('0x5d')](_0x4d36e4[_0xef4d('0x38')],_0x121dff[_0xef4d('0x39')]));_0x221bd7[_0xef4d('0x43')]=_['merge'](_0x221bd7[_0xef4d('0x43')],{'$or':[{'ListId':_0x1ff9fb['id']},{'ListId':null}]});if(_0x4d36e4[_0xef4d('0x38')][_0xef4d('0x44')]){_0x221bd7[_0xef4d('0x43')]=_[_0xef4d('0x45')](_0x221bd7[_0xef4d('0x43')],{'$or':_[_0xef4d('0x33')](_0x221bd7['attributes'],function(_0x581acc){var _0x355e87={};_0x355e87[_0x581acc]={'$like':'%'+_0x4d36e4[_0xef4d('0x38')][_0xef4d('0x44')]+'%'};return _0x355e87;})});}_0x221bd7=_[_0xef4d('0x45')]({},_0x221bd7,_0x4d36e4[_0xef4d('0x47')]);return db['CmCustomField'][_0xef4d('0x8e')](_0x221bd7);}})[_0xef4d('0x2e')](respondWithResult(_0xf57814,null))['catch'](handleError(_0xf57814,null));};exports[_0xef4d('0x8f')]=function(_0x1182b7,_0x2fc651,_0x549408){return db[_0xef4d('0x34')][_0xef4d('0x54')]({'where':{'id':_0x1182b7['params']['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0x2fc651,null))[_0xef4d('0x2e')](function(_0x1facf5){if(_0x1facf5){return _0x1facf5['addAgents'](_0x1182b7[_0xef4d('0x50')][_0xef4d('0x65')],_[_0xef4d('0x90')](_0x1182b7['body'],['ids','id'])||{})[_0xef4d('0x91')](function(_0x4c1a17){for(var _0x8256c9=0x0;_0x8256c9<_0x1182b7[_0xef4d('0x50')][_0xef4d('0x65')]['length'];_0x8256c9+=0x1){socket[_0xef4d('0x92')](_0xef4d('0x93'),{'UserId':Number(_0x1182b7['body'][_0xef4d('0x65')][_0x8256c9]),'CmListId':Number(_0x1182b7['params']['id'])});}return _0x4c1a17;});}})[_0xef4d('0x2e')](respondWithResult(_0x2fc651,null))['catch'](handleError(_0x2fc651,null));};exports[_0xef4d('0x94')]=function(_0x1d4471,_0x36ed92,_0x5d06ec){return db[_0xef4d('0x34')][_0xef4d('0x54')]({'where':{'id':_0x1d4471[_0xef4d('0x4c')]['id']}})[_0xef4d('0x2e')](handleEntityNotFound(_0x36ed92,null))['then'](function(_0x3d5440){if(_0x3d5440){return _0x3d5440[_0xef4d('0x94')](_0x1d4471[_0xef4d('0x38')][_0xef4d('0x65')])['then'](function(){if(_[_0xef4d('0x61')](_0x1d4471[_0xef4d('0x38')][_0xef4d('0x65')])){for(var _0x5d5fa9=0x0;_0x5d5fa9<_0x1d4471[_0xef4d('0x38')][_0xef4d('0x65')][_0xef4d('0x3e')];_0x5d5fa9+=0x1){socket[_0xef4d('0x92')](_0xef4d('0x95'),{'UserId':Number(_0x1d4471['query'][_0xef4d('0x65')][_0x5d5fa9]),'CmListId':Number(_0x1d4471[_0xef4d('0x4c')]['id'])});}}else{socket[_0xef4d('0x92')](_0xef4d('0x95'),{'UserId':Number(_0x1d4471[_0xef4d('0x38')][_0xef4d('0x65')]),'CmListId':Number(_0x1d4471[_0xef4d('0x4c')]['id'])});}});}})[_0xef4d('0x2e')](respondWithStatusCode(_0x36ed92,null))[_0xef4d('0x4e')](handleError(_0x36ed92,null));};exports[_0xef4d('0x96')]=function(_0x4d34dc,_0x2e3dd1,_0x991ac8){var _0x3da242={};var _0x1c7d7a={};var _0x55c702;var _0x6308be;return db[_0xef4d('0x34')][_0xef4d('0x5c')]({'where':{'id':_0x4d34dc[_0xef4d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e3dd1,null))[_0xef4d('0x2e')](function(_0x2fd05b){if(_0x2fd05b){_0x55c702=_0x2fd05b;_0x1c7d7a[_0xef4d('0x3c')]=_[_0xef4d('0x37')](db[_0xef4d('0x97')][_0xef4d('0x4d')]);_0x1c7d7a['query']=_[_0xef4d('0x37')](_0x4d34dc[_0xef4d('0x38')]);_0x1c7d7a[_0xef4d('0x39')]=_[_0xef4d('0x3a')](_0x1c7d7a[_0xef4d('0x3c')],_0x1c7d7a[_0xef4d('0x38')]);_0x3da242['attributes']=_[_0xef4d('0x3a')](_0x1c7d7a[_0xef4d('0x3c')],qs['fields'](_0x4d34dc[_0xef4d('0x38')][_0xef4d('0x3d')]));_0x3da242[_0xef4d('0x3b')]=_0x3da242[_0xef4d('0x3b')]['length']?_0x3da242[_0xef4d('0x3b')]:_0x1c7d7a[_0xef4d('0x3c')];_0x3da242['order']=qs[_0xef4d('0x42')](_0x4d34dc[_0xef4d('0x38')]['sort']);_0x3da242[_0xef4d('0x43')]=qs[_0xef4d('0x39')](_[_0xef4d('0x5d')](_0x4d34dc['query'],_0x1c7d7a[_0xef4d('0x39')]));if(_0x4d34dc[_0xef4d('0x38')][_0xef4d('0x44')]){_0x3da242[_0xef4d('0x43')]=_[_0xef4d('0x45')](_0x3da242[_0xef4d('0x43')],{'$or':_['map'](_0x3da242[_0xef4d('0x3b')],function(_0x464997){var _0x478863={};_0x478863[_0x464997]={'$like':'%'+_0x4d34dc['query'][_0xef4d('0x44')]+'%'};return _0x478863;})});}_0x3da242=_[_0xef4d('0x45')]({},_0x3da242,_0x4d34dc[_0xef4d('0x47')]);return _0x55c702[_0xef4d('0x96')](_0x3da242);}})[_0xef4d('0x2e')](function(_0x5a479e){if(_0x5a479e){_0x6308be=_0x5a479e[_0xef4d('0x3e')];if(!_0x4d34dc[_0xef4d('0x38')][_0xef4d('0x3f')](_0xef4d('0x40'))){_0x3da242['limit']=qs[_0xef4d('0x24')](_0x4d34dc[_0xef4d('0x38')][_0xef4d('0x24')]);_0x3da242[_0xef4d('0x26')]=qs[_0xef4d('0x26')](_0x4d34dc[_0xef4d('0x38')][_0xef4d('0x26')]);}return _0x55c702[_0xef4d('0x96')](_0x3da242);}})[_0xef4d('0x2e')](function(_0x4c713a){if(_0x4c713a){return _0x4c713a?{'count':_0x6308be,'rows':_0x4c713a}:null;}})[_0xef4d('0x2e')](respondWithResult(_0x2e3dd1,null))[_0xef4d('0x4e')](handleError(_0x2e3dd1,null));}; \ No newline at end of file +var _0xa641=['setHeader','Content-type','text/csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','error','name','send','index','map','CmList','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','where','options','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','format','isEmpty','now','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xa641,0xaf));var _0x1a64=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xa641[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0x1a64('0x0'));var rimraf=require(_0x1a64('0x1'));var zipdir=require(_0x1a64('0x2'));var jsonpatch=require(_0x1a64('0x3'));var rp=require(_0x1a64('0x4'));var moment=require(_0x1a64('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1a64('0x6'));var util=require(_0x1a64('0x7'));var path=require(_0x1a64('0x8'));var sox=require(_0x1a64('0x9'));var csv=require('to-csv');var ejs=require(_0x1a64('0xa'));var fs=require('fs');var fs_extra=require(_0x1a64('0xb'));var _=require(_0x1a64('0xc'));var squel=require(_0x1a64('0xd'));var crypto=require(_0x1a64('0xe'));var jsforce=require(_0x1a64('0xf'));var deskjs=require(_0x1a64('0x10'));var toCsv=require(_0x1a64('0x11'));var querystring=require(_0x1a64('0x12'));var Papa=require(_0x1a64('0x13'));var Redis=require(_0x1a64('0x14'));var authService=require(_0x1a64('0x15'));var qs=require(_0x1a64('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a64('0x17'));var logger=require('../../config/logger')(_0x1a64('0x18'));var utils=require(_0x1a64('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1a64('0x1a'));var db=require(_0x1a64('0x1b'))['db'];config[_0x1a64('0x1c')]=_[_0x1a64('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a64('0x1e'))(new Redis(config['redis']));require(_0x1a64('0x1f'))['register'](socket);function respondWithStatusCode(_0x41ea97,_0x3d1a7e){_0x3d1a7e=_0x3d1a7e||0xcc;return function(_0x291637){if(_0x291637){return _0x41ea97[_0x1a64('0x20')](_0x3d1a7e);}return _0x41ea97[_0x1a64('0x21')](_0x3d1a7e)[_0x1a64('0x22')]();};}function respondWithResult(_0x15c848,_0x383cb5){_0x383cb5=_0x383cb5||0xc8;return function(_0x138be6){if(_0x138be6){return _0x15c848[_0x1a64('0x21')](_0x383cb5)[_0x1a64('0x23')](_0x138be6);}};}function respondWithFilteredResult(_0x58f8be,_0x5eee90){return function(_0x196059){if(_0x196059){var _0x57328b=typeof _0x5eee90[_0x1a64('0x24')]==='undefined'&&typeof _0x5eee90['limit']===_0x1a64('0x25');var _0x3176f4=_0x196059[_0x1a64('0x26')];var _0x15f8f1=_0x57328b?0x0:_0x5eee90[_0x1a64('0x24')];var _0x8aa7e3=_0x57328b?_0x196059[_0x1a64('0x26')]:_0x5eee90[_0x1a64('0x24')]+_0x5eee90[_0x1a64('0x27')];var _0x5609c7;if(_0x8aa7e3>=_0x3176f4){_0x8aa7e3=_0x3176f4;_0x5609c7=0xc8;}else{_0x5609c7=0xce;}_0x58f8be[_0x1a64('0x21')](_0x5609c7);return _0x58f8be[_0x1a64('0x28')](_0x1a64('0x29'),_0x15f8f1+'-'+_0x8aa7e3+'/'+_0x3176f4)[_0x1a64('0x23')](_0x196059);}return null;};}function patchUpdates(_0x5d66a9){return function(_0x51efce){try{jsonpatch[_0x1a64('0x2a')](_0x51efce,_0x5d66a9,!![]);}catch(_0x45a221){return BPromise[_0x1a64('0x2b')](_0x45a221);}return _0x51efce[_0x1a64('0x2c')]();};}function saveUpdates(_0x54ff17,_0x57010a){return function(_0x4464dc){if(_0x4464dc){return _0x4464dc[_0x1a64('0x2d')](_0x54ff17)[_0x1a64('0x2e')](function(_0x46b126){return _0x46b126;});}return null;};}function removeEntity(_0x1cffd6,_0x577d71){return function(_0x5419dd){if(_0x5419dd){return _0x5419dd[_0x1a64('0x2f')]()[_0x1a64('0x2e')](function(){var _0x401115=_0x5419dd[_0x1a64('0x30')]({'plain':!![]});var _0x23cec3=_0x1a64('0x31');return db['UserProfileResource']['destroy']({'where':{'type':_0x23cec3,'resourceId':_0x401115['id']}})[_0x1a64('0x2e')](function(){return _0x5419dd;});})['then'](function(){_0x1cffd6[_0x1a64('0x21')](0xcc)[_0x1a64('0x22')]();});}};}function handleEntityNotFound(_0x442bc4,_0x37ff8d){return function(_0x1520a4){if(!_0x1520a4){_0x442bc4[_0x1a64('0x20')](0x194);}return _0x1520a4;};}function handleError(_0xae9600,_0x5e2a2c){_0x5e2a2c=_0x5e2a2c||0x1f4;return function(_0x173b87){logger[_0x1a64('0x32')](_0x173b87['stack']);if(_0x173b87['name']){delete _0x173b87[_0x1a64('0x33')];}_0xae9600[_0x1a64('0x21')](_0x5e2a2c)[_0x1a64('0x34')](_0x173b87);};}exports[_0x1a64('0x35')]=function(_0x423654,_0x392100){var _0x5838e4={},_0x22bfd6={},_0x57f4de={'count':0x0,'rows':[]};var _0x1a18e7=_[_0x1a64('0x36')](db[_0x1a64('0x37')]['rawAttributes'],function(_0x41bb60){return{'name':_0x41bb60[_0x1a64('0x38')],'type':_0x41bb60[_0x1a64('0x39')][_0x1a64('0x3a')]};});_0x22bfd6['model']=_[_0x1a64('0x36')](_0x1a18e7,_0x1a64('0x33'));_0x22bfd6[_0x1a64('0x3b')]=_[_0x1a64('0x3c')](_0x423654[_0x1a64('0x3b')]);_0x22bfd6[_0x1a64('0x3d')]=_[_0x1a64('0x3e')](_0x22bfd6[_0x1a64('0x3f')],_0x22bfd6['query']);_0x5838e4[_0x1a64('0x40')]=_['intersection'](_0x22bfd6[_0x1a64('0x3f')],qs[_0x1a64('0x41')](_0x423654['query'][_0x1a64('0x41')]));_0x5838e4['attributes']=_0x5838e4[_0x1a64('0x40')][_0x1a64('0x42')]?_0x5838e4[_0x1a64('0x40')]:_0x22bfd6[_0x1a64('0x3f')];if(!_0x423654[_0x1a64('0x3b')][_0x1a64('0x43')](_0x1a64('0x44'))){_0x5838e4[_0x1a64('0x27')]=qs['limit'](_0x423654['query'][_0x1a64('0x27')]);_0x5838e4[_0x1a64('0x24')]=qs[_0x1a64('0x24')](_0x423654[_0x1a64('0x3b')][_0x1a64('0x24')]);}_0x5838e4[_0x1a64('0x45')]=qs[_0x1a64('0x46')](_0x423654[_0x1a64('0x3b')][_0x1a64('0x46')]);_0x5838e4['where']=qs[_0x1a64('0x3d')](_[_0x1a64('0x47')](_0x423654[_0x1a64('0x3b')],_0x22bfd6['filters']),_0x1a18e7);if(_0x423654[_0x1a64('0x3b')][_0x1a64('0x48')]){_0x5838e4['where']=_['merge'](_0x5838e4['where'],{'$or':_['map'](_0x1a18e7,function(_0x3af281){if(_0x3af281['type']!==_0x1a64('0x49')){var _0x48082f={};_0x48082f[_0x3af281['name']]={'$like':'%'+_0x423654[_0x1a64('0x3b')][_0x1a64('0x48')]+'%'};return _0x48082f;}})});}_0x5838e4=_[_0x1a64('0x4a')]({},_0x5838e4,_0x423654['options']);var _0x210ead={'where':_0x5838e4['where']};return db[_0x1a64('0x37')][_0x1a64('0x26')](_0x210ead)[_0x1a64('0x2e')](function(_0x4a72e4){_0x57f4de[_0x1a64('0x26')]=_0x4a72e4;if(_0x423654[_0x1a64('0x3b')]['includeAll']){_0x5838e4[_0x1a64('0x4b')]=[{'all':!![]}];}return db[_0x1a64('0x37')][_0x1a64('0x4c')](_0x5838e4);})['then'](function(_0x333e85){_0x57f4de[_0x1a64('0x4d')]=_0x333e85;return _0x57f4de;})[_0x1a64('0x2e')](respondWithFilteredResult(_0x392100,_0x5838e4))['catch'](handleError(_0x392100,null));};exports[_0x1a64('0x4e')]=function(_0x1a7e01,_0x2a62f6){var _0x1ba09f={'raw':![],'where':{'id':_0x1a7e01[_0x1a64('0x4f')]['id']}},_0x2c5717={};_0x2c5717[_0x1a64('0x3f')]=_[_0x1a64('0x3c')](db[_0x1a64('0x37')][_0x1a64('0x50')]);_0x2c5717[_0x1a64('0x3b')]=_[_0x1a64('0x3c')](_0x1a7e01[_0x1a64('0x3b')]);_0x2c5717[_0x1a64('0x3d')]=_['intersection'](_0x2c5717[_0x1a64('0x3f')],_0x2c5717['query']);_0x1ba09f[_0x1a64('0x40')]=_['intersection'](_0x2c5717[_0x1a64('0x3f')],qs[_0x1a64('0x41')](_0x1a7e01['query'][_0x1a64('0x41')]));_0x1ba09f['attributes']=_0x1ba09f[_0x1a64('0x40')][_0x1a64('0x42')]?_0x1ba09f['attributes']:_0x2c5717[_0x1a64('0x3f')];if(_0x1a7e01[_0x1a64('0x3b')][_0x1a64('0x51')]){_0x1ba09f['include']=[{'all':!![]}];}_0x1ba09f=_[_0x1a64('0x4a')]({},_0x1ba09f,_0x1a7e01['options']);return db['CmList']['find'](_0x1ba09f)[_0x1a64('0x2e')](handleEntityNotFound(_0x2a62f6,null))[_0x1a64('0x2e')](respondWithResult(_0x2a62f6,null))[_0x1a64('0x52')](handleError(_0x2a62f6,null));};exports['create']=function(_0x24c661,_0x258af4){return db[_0x1a64('0x37')][_0x1a64('0x53')](_0x24c661[_0x1a64('0x54')],{})[_0x1a64('0x2e')](function(_0xa03c5d){var _0x4a7682=_0x24c661[_0x1a64('0x55')][_0x1a64('0x30')]({'plain':!![]});if(!_0x4a7682)throw new Error(_0x1a64('0x56'));if(_0x4a7682[_0x1a64('0x57')]===_0x1a64('0x55')){var _0x5ab44f=_0xa03c5d[_0x1a64('0x30')]({'plain':!![]});var _0x57febe=_0x1a64('0x31');return db[_0x1a64('0x58')][_0x1a64('0x59')]({'where':{'name':_0x57febe,'userProfileId':_0x4a7682[_0x1a64('0x5a')]},'raw':!![]})[_0x1a64('0x2e')](function(_0x42f240){if(_0x42f240&&_0x42f240[_0x1a64('0x5b')]===0x0){return db[_0x1a64('0x5c')][_0x1a64('0x53')]({'name':_0x5ab44f[_0x1a64('0x33')],'resourceId':_0x5ab44f['id'],'type':_0x42f240[_0x1a64('0x33')],'sectionId':_0x42f240['id']},{})[_0x1a64('0x2e')](function(){return _0xa03c5d;});}else{return _0xa03c5d;}})[_0x1a64('0x52')](function(_0x421b66){logger[_0x1a64('0x32')](_0x1a64('0x5d'),_0x421b66);throw _0x421b66;});}return _0xa03c5d;})[_0x1a64('0x2e')](respondWithResult(_0x258af4,0xc9))[_0x1a64('0x52')](handleError(_0x258af4,null));};exports[_0x1a64('0x2d')]=function(_0x4a879b,_0x420688){if(_0x4a879b['body']['id']){delete _0x4a879b[_0x1a64('0x54')]['id'];}return db[_0x1a64('0x37')][_0x1a64('0x59')]({'where':{'id':_0x4a879b[_0x1a64('0x4f')]['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0x420688,null))[_0x1a64('0x2e')](saveUpdates(_0x4a879b[_0x1a64('0x54')],null))[_0x1a64('0x2e')](respondWithResult(_0x420688,null))[_0x1a64('0x52')](handleError(_0x420688,null));};exports[_0x1a64('0x2f')]=function(_0x481f78,_0x57194d){return db[_0x1a64('0x37')]['find']({'where':{'id':_0x481f78['params']['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0x57194d,null))[_0x1a64('0x2e')](removeEntity(_0x57194d,null))['catch'](handleError(_0x57194d,null));};exports['describe']=function(_0x4cea98,_0x1005ae){return db[_0x1a64('0x37')][_0x1a64('0x5e')]()[_0x1a64('0x2e')](respondWithResult(_0x1005ae,null))[_0x1a64('0x52')](handleError(_0x1005ae,null));};exports['addDisposition']=function(_0x5b7a2e,_0xb84862,_0x1dedbd){if(_0x5b7a2e[_0x1a64('0x54')]['id']){delete _0x5b7a2e['body']['id'];}return db[_0x1a64('0x37')][_0x1a64('0x59')]({'where':{'id':_0x5b7a2e[_0x1a64('0x4f')]['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0xb84862,null))[_0x1a64('0x2e')](function(_0x4fb3eb){if(_0x4fb3eb){_0x5b7a2e[_0x1a64('0x54')][_0x1a64('0x5f')]=_0x4fb3eb['id'];return db[_0x1a64('0x60')][_0x1a64('0x53')](_0x5b7a2e[_0x1a64('0x54')]);}})['then'](respondWithResult(_0xb84862,null))[_0x1a64('0x52')](handleError(_0xb84862,null));};exports[_0x1a64('0x61')]=function(_0x26437a,_0x1781d6,_0x5ab626){var _0x514b15={'raw':![],'where':{}};var _0x504447={};var _0x2ce461={'count':0x0,'rows':[]};return db['CmList'][_0x1a64('0x62')]({'where':{'id':_0x26437a[_0x1a64('0x4f')]['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0x1781d6,null))[_0x1a64('0x2e')](function(_0x5654a9){if(_0x5654a9){_0x504447[_0x1a64('0x3f')]=_[_0x1a64('0x3c')](db[_0x1a64('0x60')][_0x1a64('0x50')]);_0x504447['query']=_[_0x1a64('0x3c')](_0x26437a[_0x1a64('0x3b')]);_0x504447['filters']=_[_0x1a64('0x3e')](_0x504447[_0x1a64('0x3f')],_0x504447['query']);_0x514b15['attributes']=_[_0x1a64('0x3e')](_0x504447[_0x1a64('0x3f')],qs[_0x1a64('0x41')](_0x26437a['query'][_0x1a64('0x41')]));_0x514b15[_0x1a64('0x40')]=_0x514b15['attributes'][_0x1a64('0x42')]?_0x514b15['attributes']:_0x504447[_0x1a64('0x3f')];if(!_0x26437a['query'][_0x1a64('0x43')]('nolimit')){_0x514b15[_0x1a64('0x27')]=qs[_0x1a64('0x27')](_0x26437a[_0x1a64('0x3b')]['limit']);_0x514b15[_0x1a64('0x24')]=qs[_0x1a64('0x24')](_0x26437a['query'][_0x1a64('0x24')]);}_0x514b15[_0x1a64('0x45')]=qs[_0x1a64('0x46')](_0x26437a[_0x1a64('0x3b')][_0x1a64('0x46')]);_0x514b15['where']=qs['filters'](_[_0x1a64('0x47')](_0x26437a['query'],_0x504447[_0x1a64('0x3d')]));_0x514b15[_0x1a64('0x63')]['ListId']=_0x5654a9['id'];if(_0x26437a[_0x1a64('0x3b')][_0x1a64('0x48')]){_0x514b15[_0x1a64('0x63')]=_['merge'](_0x514b15[_0x1a64('0x63')],{'$or':_[_0x1a64('0x36')](_0x514b15[_0x1a64('0x40')],function(_0x3c954c){var _0x23a639={};_0x23a639[_0x3c954c]={'$like':'%'+_0x26437a['query'][_0x1a64('0x48')]+'%'};return _0x23a639;})});}_0x514b15=_[_0x1a64('0x4a')]({},_0x514b15,_0x26437a[_0x1a64('0x64')]);return db['Disposition'][_0x1a64('0x26')]({'where':_0x514b15[_0x1a64('0x63')]})[_0x1a64('0x2e')](function(_0x48bb58){_0x2ce461['count']=_0x48bb58;if(_0x26437a[_0x1a64('0x3b')][_0x1a64('0x51')]){_0x514b15[_0x1a64('0x4b')]=[{'all':!![]}];}return db[_0x1a64('0x60')][_0x1a64('0x4c')](_0x514b15);})[_0x1a64('0x2e')](function(_0x683e74){_0x2ce461['rows']=_0x683e74;return _0x2ce461;});}})[_0x1a64('0x2e')](respondWithFilteredResult(_0x1781d6,_0x514b15))[_0x1a64('0x52')](handleError(_0x1781d6,null));};exports[_0x1a64('0x65')]=function(_0x2eed9b,_0x11f7bf,_0x4fc264){return db[_0x1a64('0x37')][_0x1a64('0x59')]({'where':{'id':_0x2eed9b[_0x1a64('0x4f')]['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0x11f7bf,null))['then'](function(_0x4efb7b){if(_0x4efb7b){return _0x4efb7b[_0x1a64('0x65')](_0x2eed9b['query'][_0x1a64('0x66')]);}})['then'](respondWithStatusCode(_0x11f7bf,null))['catch'](handleError(_0x11f7bf,null));};exports[_0x1a64('0x67')]=function(_0x29b9f7,_0x5888ec,_0x322e5d){return db[_0x1a64('0x37')]['find']({'where':{'id':_0x29b9f7['params']['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0x5888ec,null))[_0x1a64('0x2e')](function(_0x290ea7){if(_0x290ea7){var _0x2a0c8d=[];var _0x49a3e0={'success':[],'errors':[]};return db[_0x1a64('0x68')]['describe']()[_0x1a64('0x2e')](function(_0x386793){if(_0x29b9f7[_0x1a64('0x54')][_0x1a64('0x69')]&&_[_0x1a64('0x6a')](_0x29b9f7['body']['tags'])){if(_0x29b9f7[_0x1a64('0x54')]['tags'][_0x1a64('0x42')]){_0x29b9f7[_0x1a64('0x54')][_0x1a64('0x69')]=_0x29b9f7[_0x1a64('0x54')][_0x1a64('0x69')][_0x1a64('0x6b')](';')+';';}else{_0x29b9f7[_0x1a64('0x54')][_0x1a64('0x69')]=null;}}else{_0x29b9f7[_0x1a64('0x54')][_0x1a64('0x69')]=null;}if(_0x29b9f7[_0x1a64('0x54')]&&_[_0x1a64('0x6a')](_0x29b9f7[_0x1a64('0x54')])){for(var _0x8f433d=0x0;_0x8f433d<_0x29b9f7[_0x1a64('0x54')]['length'];_0x8f433d+=0x1){_0x29b9f7[_0x1a64('0x54')][_0x8f433d]['ListId']=_0x29b9f7[_0x1a64('0x4f')]['id'];_0x2a0c8d[_0x1a64('0x6c')](_0x29b9f7[_0x1a64('0x54')][_0x8f433d]);}return BPromise['each'](_0x2a0c8d,function(_0x187ff9){return db[_0x1a64('0x68')][_0x1a64('0x53')](_[_0x1a64('0x6d')](_0x187ff9,['ids','id'])||{},{'fields':_[_0x1a64('0x3c')](_0x386793),'raw':!![]})['then'](function(_0x4dcad6){_0x49a3e0[_0x1a64('0x6e')][_0x1a64('0x6c')](_0x4dcad6['dataValues']);})[_0x1a64('0x52')](function(_0x144d99){_0x49a3e0[_0x1a64('0x6f')][_0x1a64('0x6c')]({'data':_0x187ff9,'error':_0x144d99[_0x1a64('0x70')]});});})['then'](function(_0x2b1238){return _0x49a3e0;})[_0x1a64('0x52')](function(_0x2bcb65){return _0x2bcb65;});}else{_0x5888ec['status'](0x190)[_0x1a64('0x23')]({'message':_0x1a64('0x71')});}});}})[_0x1a64('0x2e')](respondWithResult(_0x5888ec,null))[_0x1a64('0x52')](handleError(_0x5888ec,null));};exports[_0x1a64('0x72')]=function(_0x198b20,_0x592681,_0x151a54){var _0x2ed829;return db[_0x1a64('0x37')]['find']({'where':{'id':_0x198b20['params']['id']},'include':[{'model':db[_0x1a64('0x73')],'as':_0x1a64('0x74')}]})[_0x1a64('0x2e')](handleEntityNotFound(_0x592681,null))[_0x1a64('0x2e')](function(_0x468220){if(_0x468220){_0x2ed829=_0x468220;return db[_0x1a64('0x68')][_0x1a64('0x50')];}})[_0x1a64('0x2e')](function(_0x324073){if(_0x324073){var _0x3f027a={};var _0x38c741={};_0x38c741['model']=_[_0x1a64('0x75')](_[_0x1a64('0x3c')](_0x324073),_[_0x1a64('0x36')](_0x2ed829[_0x1a64('0x74')],function(_0x2ab0a4){return util['format'](_0x1a64('0x76'),_0x2ab0a4['id']);}));_0x38c741[_0x1a64('0x3b')]=_[_0x1a64('0x3c')](_0x198b20[_0x1a64('0x3b')]);_0x38c741['filters']=_[_0x1a64('0x3e')](_0x38c741[_0x1a64('0x3f')],_0x38c741['query']);_0x3f027a[_0x1a64('0x40')]=_[_0x1a64('0x3e')](_0x38c741[_0x1a64('0x3f')],qs[_0x1a64('0x41')](_0x198b20[_0x1a64('0x3b')][_0x1a64('0x41')]));_0x3f027a[_0x1a64('0x40')]=_0x3f027a[_0x1a64('0x40')]['length']?_0x3f027a[_0x1a64('0x40')]:_0x38c741['model'];if(!_0x198b20[_0x1a64('0x3b')][_0x1a64('0x43')]('nolimit')){_0x3f027a['limit']=qs[_0x1a64('0x27')](_0x198b20[_0x1a64('0x3b')][_0x1a64('0x27')]);_0x3f027a['offset']=qs[_0x1a64('0x24')](_0x198b20[_0x1a64('0x3b')][_0x1a64('0x24')]);}_0x3f027a[_0x1a64('0x45')]=qs[_0x1a64('0x46')](_0x198b20[_0x1a64('0x3b')]['sort']);_0x3f027a[_0x1a64('0x63')]=qs[_0x1a64('0x3d')](_[_0x1a64('0x47')](_0x198b20[_0x1a64('0x3b')],_0x38c741[_0x1a64('0x3d')]));_0x3f027a[_0x1a64('0x77')]=!![];if(_0x198b20[_0x1a64('0x3b')][_0x1a64('0x48')]){_0x3f027a[_0x1a64('0x63')]=_[_0x1a64('0x4a')](_0x3f027a[_0x1a64('0x63')],{'$or':_[_0x1a64('0x36')](_0x3f027a[_0x1a64('0x40')],function(_0x5a2598){var _0x3348cb={};_0x3348cb[_0x5a2598]={'$like':'%'+_0x198b20[_0x1a64('0x3b')][_0x1a64('0x48')]+'%'};return _0x3348cb;})});}_0x3f027a=_[_0x1a64('0x4a')]({},_0x3f027a,_0x198b20[_0x1a64('0x64')]);return _0x2ed829[_0x1a64('0x72')](_0x3f027a);}})[_0x1a64('0x2e')](respondWithResult(_0x592681,null))[_0x1a64('0x52')](handleError(_0x592681,null));};exports[_0x1a64('0x78')]=function(_0x3a7850,_0xc2ae29,_0x5c5430){var _0x4586e7;return db[_0x1a64('0x37')][_0x1a64('0x59')]({'where':{'id':_0x3a7850[_0x1a64('0x4f')]['id']},'include':[{'model':db[_0x1a64('0x73')],'as':_0x1a64('0x74')}]})[_0x1a64('0x2e')](handleEntityNotFound(_0xc2ae29,null))[_0x1a64('0x2e')](function(_0x34d9b1){if(_0x34d9b1){_0x4586e7=_0x34d9b1;return db[_0x1a64('0x68')][_0x1a64('0x50')];}})[_0x1a64('0x2e')](function(_0x3a204f){if(_0x3a204f){var _0xcead50={};var _0x33e32e={};_0x33e32e[_0x1a64('0x3f')]=_[_0x1a64('0x75')](_[_0x1a64('0x3c')](_0x3a204f),_[_0x1a64('0x36')](_0x4586e7[_0x1a64('0x74')],function(_0x2bd254){return util[_0x1a64('0x79')]('cf_%d',_0x2bd254['id']);}));_0x33e32e[_0x1a64('0x3b')]=_[_0x1a64('0x3c')](_0x3a7850[_0x1a64('0x3b')]);_0x33e32e[_0x1a64('0x3d')]=_[_0x1a64('0x3e')](_0x33e32e[_0x1a64('0x3f')],_0x33e32e[_0x1a64('0x3b')]);_0xcead50[_0x1a64('0x40')]=_['intersection'](_0x33e32e[_0x1a64('0x3f')],qs[_0x1a64('0x41')](_0x3a7850['query'][_0x1a64('0x41')]));_0xcead50[_0x1a64('0x40')]=_0xcead50[_0x1a64('0x40')][_0x1a64('0x42')]?_0xcead50[_0x1a64('0x40')]:_0x33e32e['model'];if(!_0x3a7850[_0x1a64('0x3b')]['hasOwnProperty'](_0x1a64('0x44'))){_0xcead50[_0x1a64('0x27')]=qs[_0x1a64('0x27')](_0x3a7850['query']['limit']);_0xcead50[_0x1a64('0x24')]=qs[_0x1a64('0x24')](_0x3a7850['query'][_0x1a64('0x24')]);}_0xcead50['order']=qs[_0x1a64('0x46')](_0x3a7850[_0x1a64('0x3b')][_0x1a64('0x46')]);_0xcead50['where']=qs[_0x1a64('0x3d')](_[_0x1a64('0x47')](_0x3a7850['query'],_0x33e32e[_0x1a64('0x3d')]));_0xcead50[_0x1a64('0x77')]=!![];if(_0x3a7850[_0x1a64('0x3b')][_0x1a64('0x48')]){_0xcead50['where']=_[_0x1a64('0x4a')](_0xcead50[_0x1a64('0x63')],{'$or':_[_0x1a64('0x36')](_0xcead50['attributes'],function(_0x20986e){var _0x206452={};_0x206452[_0x20986e]={'$like':'%'+_0x3a7850[_0x1a64('0x3b')][_0x1a64('0x48')]+'%'};return _0x206452;})});}_0xcead50=_[_0x1a64('0x4a')]({},_0xcead50,_0x3a7850['options']);return _0x4586e7[_0x1a64('0x72')](_0xcead50);}})[_0x1a64('0x2e')](function(_0x93daeb){if(!_[_0x1a64('0x7a')](_0x93daeb)){var _0x3d5de0=toCsv(_0x93daeb);var _0x502248=Date[_0x1a64('0x7b')]();fs['writeFileSync'](util[_0x1a64('0x79')](_0x1a64('0x7c'),_0x4586e7['id'],_0x502248),_0x3d5de0);_0xc2ae29['setHeader'](_0x1a64('0x7d'),'attachment;\x20filename='+util[_0x1a64('0x79')](_0x1a64('0x7e'),_0x4586e7['id'],_0x502248));_0xc2ae29[_0x1a64('0x7f')](_0x1a64('0x80'),_0x1a64('0x81'));return _0xc2ae29['download'](util[_0x1a64('0x79')](_0x1a64('0x7c'),_0x4586e7['id'],_0x502248));}else{return _0xc2ae29[_0x1a64('0x20')](0xcc);}})['catch'](handleError(_0xc2ae29,null));};exports[_0x1a64('0x82')]=function(_0x6cd152,_0x4caf93,_0x1e8c56){var _0x54810e;delete _0x6cd152[_0x1a64('0x54')]['id'];return db[_0x1a64('0x37')][_0x1a64('0x62')]({'where':{'id':_0x6cd152['params']['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0x4caf93,null))['then'](function(_0x59481e){if(_0x59481e){return db[_0x1a64('0x83')]['transaction'](function(_0x104518){return db[_0x1a64('0x73')][_0x1a64('0x53')](_0x6cd152[_0x1a64('0x54')],{'transaction':_0x104518})[_0x1a64('0x2e')](function(_0x2ef72b){_0x54810e=_0x2ef72b;return _0x59481e[_0x1a64('0x84')](_0x2ef72b,{'transaction':_0x104518});})['then'](function(){var _0x59f94c={'type':db[_0x1a64('0x85')][_0x1a64('0x86')],'transaction':_0x104518};switch(_0x6cd152['body']['type']){case _0x1a64('0x87'):_0x59f94c[_0x1a64('0x39')]=db[_0x1a64('0x85')][_0x1a64('0x86')];break;case'number':_0x59f94c['type']=db[_0x1a64('0x85')][_0x1a64('0x88')];break;case _0x1a64('0x89'):_0x59f94c['type']=db[_0x1a64('0x85')][_0x1a64('0x8a')];_0x59f94c['defaultValue']=![];break;default:}return db[_0x1a64('0x83')][_0x1a64('0x8b')][_0x1a64('0x8c')](_0x1a64('0x8d'),util[_0x1a64('0x79')](_0x1a64('0x8e'),_0x54810e['id']),_0x59f94c);})['then'](function(){return _0x54810e;});});}})[_0x1a64('0x2e')](respondWithResult(_0x4caf93,null))['catch'](handleError(_0x4caf93,null));};exports[_0x1a64('0x8f')]=function(_0x4e0b87,_0xdcfc45,_0x259040){var _0x536f34={};var _0x210303={};var _0x36771c;var _0x98299d;return db[_0x1a64('0x37')][_0x1a64('0x62')]({'where':{'id':_0x4e0b87[_0x1a64('0x4f')]['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0xdcfc45,null))[_0x1a64('0x2e')](function(_0x2e0cd7){if(_0x2e0cd7){_0x36771c=_0x2e0cd7;_0x210303['model']=_[_0x1a64('0x3c')](db['CmCustomField'][_0x1a64('0x50')]);_0x210303[_0x1a64('0x3b')]=_['keys'](_0x4e0b87[_0x1a64('0x3b')]);_0x210303[_0x1a64('0x3d')]=_['intersection'](_0x210303[_0x1a64('0x3f')],_0x210303[_0x1a64('0x3b')]);_0x536f34[_0x1a64('0x40')]=_['intersection'](_0x210303[_0x1a64('0x3f')],qs[_0x1a64('0x41')](_0x4e0b87['query'][_0x1a64('0x41')]));_0x536f34[_0x1a64('0x40')]=_0x536f34[_0x1a64('0x40')][_0x1a64('0x42')]?_0x536f34[_0x1a64('0x40')]:_0x210303[_0x1a64('0x3f')];_0x536f34[_0x1a64('0x45')]=qs[_0x1a64('0x46')](_0x4e0b87[_0x1a64('0x3b')][_0x1a64('0x46')]);_0x536f34[_0x1a64('0x63')]=qs[_0x1a64('0x3d')](_[_0x1a64('0x47')](_0x4e0b87['query'],_0x210303['filters']));_0x536f34[_0x1a64('0x63')]=_[_0x1a64('0x4a')](_0x536f34['where'],{'$or':[{'ListId':_0x2e0cd7['id']},{'ListId':null}]});if(_0x4e0b87['query'][_0x1a64('0x48')]){_0x536f34['where']=_[_0x1a64('0x4a')](_0x536f34['where'],{'$or':_['map'](_0x536f34[_0x1a64('0x40')],function(_0x16ced9){var _0x12dc98={};_0x12dc98[_0x16ced9]={'$like':'%'+_0x4e0b87[_0x1a64('0x3b')]['filter']+'%'};return _0x12dc98;})});}_0x536f34=_[_0x1a64('0x4a')]({},_0x536f34,_0x4e0b87[_0x1a64('0x64')]);return db['CmCustomField'][_0x1a64('0x90')](_0x536f34);}})[_0x1a64('0x2e')](respondWithResult(_0xdcfc45,null))['catch'](handleError(_0xdcfc45,null));};exports[_0x1a64('0x91')]=function(_0x54c626,_0xb53fab,_0x4d1ca9){return db[_0x1a64('0x37')]['find']({'where':{'id':_0x54c626[_0x1a64('0x4f')]['id']}})['then'](handleEntityNotFound(_0xb53fab,null))['then'](function(_0x4fcdd4){if(_0x4fcdd4){return _0x4fcdd4[_0x1a64('0x91')](_0x54c626[_0x1a64('0x54')]['ids'],_[_0x1a64('0x6d')](_0x54c626[_0x1a64('0x54')],['ids','id'])||{})[_0x1a64('0x92')](function(_0x239238){for(var _0x2e01f5=0x0;_0x2e01f5<_0x54c626[_0x1a64('0x54')][_0x1a64('0x66')][_0x1a64('0x42')];_0x2e01f5+=0x1){socket[_0x1a64('0x93')]('userCmList:save',{'UserId':Number(_0x54c626['body'][_0x1a64('0x66')][_0x2e01f5]),'CmListId':Number(_0x54c626[_0x1a64('0x4f')]['id'])});}return _0x239238;});}})[_0x1a64('0x2e')](respondWithResult(_0xb53fab,null))[_0x1a64('0x52')](handleError(_0xb53fab,null));};exports[_0x1a64('0x94')]=function(_0x3a201f,_0x4b228c,_0x2ff0e4){return db['CmList'][_0x1a64('0x59')]({'where':{'id':_0x3a201f[_0x1a64('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b228c,null))['then'](function(_0x359d94){if(_0x359d94){return _0x359d94[_0x1a64('0x94')](_0x3a201f[_0x1a64('0x3b')][_0x1a64('0x66')])[_0x1a64('0x2e')](function(){if(_[_0x1a64('0x6a')](_0x3a201f['query'][_0x1a64('0x66')])){for(var _0x4ba256=0x0;_0x4ba256<_0x3a201f[_0x1a64('0x3b')][_0x1a64('0x66')][_0x1a64('0x42')];_0x4ba256+=0x1){socket[_0x1a64('0x93')]('userCmList:remove',{'UserId':Number(_0x3a201f[_0x1a64('0x3b')][_0x1a64('0x66')][_0x4ba256]),'CmListId':Number(_0x3a201f[_0x1a64('0x4f')]['id'])});}}else{socket['emit'](_0x1a64('0x95'),{'UserId':Number(_0x3a201f[_0x1a64('0x3b')][_0x1a64('0x66')]),'CmListId':Number(_0x3a201f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4b228c,null))[_0x1a64('0x52')](handleError(_0x4b228c,null));};exports[_0x1a64('0x96')]=function(_0x33c5ff,_0x556b63,_0x2e8212){var _0x1bdf9a={};var _0x3b1877={};var _0x1c3e24;var _0x87cc25;return db[_0x1a64('0x37')]['findOne']({'where':{'id':_0x33c5ff['params']['id']}})[_0x1a64('0x2e')](handleEntityNotFound(_0x556b63,null))[_0x1a64('0x2e')](function(_0x46dab8){if(_0x46dab8){_0x1c3e24=_0x46dab8;_0x3b1877[_0x1a64('0x3f')]=_['keys'](db['User'][_0x1a64('0x50')]);_0x3b1877['query']=_[_0x1a64('0x3c')](_0x33c5ff['query']);_0x3b1877[_0x1a64('0x3d')]=_[_0x1a64('0x3e')](_0x3b1877['model'],_0x3b1877[_0x1a64('0x3b')]);_0x1bdf9a[_0x1a64('0x40')]=_[_0x1a64('0x3e')](_0x3b1877['model'],qs[_0x1a64('0x41')](_0x33c5ff['query'][_0x1a64('0x41')]));_0x1bdf9a[_0x1a64('0x40')]=_0x1bdf9a[_0x1a64('0x40')]['length']?_0x1bdf9a[_0x1a64('0x40')]:_0x3b1877[_0x1a64('0x3f')];_0x1bdf9a[_0x1a64('0x45')]=qs[_0x1a64('0x46')](_0x33c5ff['query'][_0x1a64('0x46')]);_0x1bdf9a['where']=qs['filters'](_['pick'](_0x33c5ff[_0x1a64('0x3b')],_0x3b1877[_0x1a64('0x3d')]));if(_0x33c5ff[_0x1a64('0x3b')][_0x1a64('0x48')]){_0x1bdf9a['where']=_['merge'](_0x1bdf9a[_0x1a64('0x63')],{'$or':_['map'](_0x1bdf9a[_0x1a64('0x40')],function(_0x4f5929){var _0x32385a={};_0x32385a[_0x4f5929]={'$like':'%'+_0x33c5ff[_0x1a64('0x3b')][_0x1a64('0x48')]+'%'};return _0x32385a;})});}_0x1bdf9a=_['merge']({},_0x1bdf9a,_0x33c5ff[_0x1a64('0x64')]);return _0x1c3e24['getAgents'](_0x1bdf9a);}})[_0x1a64('0x2e')](function(_0x7926c6){if(_0x7926c6){_0x87cc25=_0x7926c6['length'];if(!_0x33c5ff[_0x1a64('0x3b')][_0x1a64('0x43')](_0x1a64('0x44'))){_0x1bdf9a['limit']=qs[_0x1a64('0x27')](_0x33c5ff[_0x1a64('0x3b')]['limit']);_0x1bdf9a[_0x1a64('0x24')]=qs[_0x1a64('0x24')](_0x33c5ff[_0x1a64('0x3b')][_0x1a64('0x24')]);}return _0x1c3e24[_0x1a64('0x96')](_0x1bdf9a);}})['then'](function(_0x484041){if(_0x484041){return _0x484041?{'count':_0x87cc25,'rows':_0x484041}:null;}})[_0x1a64('0x2e')](respondWithResult(_0x556b63,null))[_0x1a64('0x52')](handleError(_0x556b63,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a32ec6e..9dbc6ba 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x326f,0xd1));var _0xf326=function(_0x58977a,_0xcb5243){_0x58977a=_0x58977a-0x0;var _0x2cc4a9=_0x326f[_0x58977a];return _0x2cc4a9;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x5fc3[_0x3b594b];return _0x1ea5f8;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index e7d3a8c..7b7b473 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 _0xf109=['CmList','cm_lists','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x3a2ce8,_0x367dfc){var _0x2973a1=function(_0x56a4af){while(--_0x56a4af){_0x3a2ce8['push'](_0x3a2ce8['shift']());}};_0x2973a1(++_0x367dfc);}(_0xf109,0xce));var _0x9f10=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xf109[_0x476bf4];return _0x788ffe;};'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 +var _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x4b8907,_0x141c93){var _0xb88b6e=function(_0x4c8fb2){while(--_0x4c8fb2){_0x4b8907['push'](_0x4b8907['shift']());}};_0xb88b6e(++_0x141c93);}(_0xee5b,0x1f4));var _0xbee5=function(_0x51725c,_0x597023){_0x51725c=_0x51725c-0x0;var _0x47adcd=_0xee5b[_0x51725c];return _0x47adcd;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 4b1aab7..53b9332 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 _0xe44c=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb'];(function(_0x308d18,_0x1eebaa){var _0x4f4bad=function(_0x18eeee){while(--_0x18eeee){_0x308d18['push'](_0x308d18['shift']());}};_0x4f4bad(++_0x1eebaa);}(_0xe44c,0xb4));var _0xce44=function(_0x57c9ac,_0x15e943){_0x57c9ac=_0x57c9ac-0x0;var _0x3d0908=_0xe44c[_0x57c9ac];return _0x3d0908;};'use strict';var _=require('lodash');var util=require(_0xce44('0x0'));var moment=require('moment');var BPromise=require(_0xce44('0x1'));var rs=require(_0xce44('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce44('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce44('0x4'));var config=require(_0xce44('0x5'));var jayson=require(_0xce44('0x6'));var client=jayson[_0xce44('0x7')][_0xce44('0x8')]({'port':0x232a});config[_0xce44('0x9')]=_['defaults'](config[_0xce44('0x9')],{'host':_0xce44('0xa'),'port':0x18eb});var socket=require(_0xce44('0xb'))(new Redis(config[_0xce44('0x9')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x4fa9de,_0x54e1bb,_0x576361){return new BPromise(function(_0x28502f,_0x3ae76d){return client[_0xce44('0xc')](_0x4fa9de,_0x576361)[_0xce44('0xd')](function(_0x58b96c){logger[_0xce44('0xe')](_0xce44('0xf'),_0x54e1bb,_0xce44('0x10'));logger[_0xce44('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x54e1bb,_0xce44('0x10'),JSON[_0xce44('0x12')](_0x58b96c));if(_0x58b96c[_0xce44('0x13')]){if(_0x58b96c[_0xce44('0x13')]['code']===0x1f4){logger['error'](_0xce44('0xf'),_0x54e1bb,_0x58b96c[_0xce44('0x13')][_0xce44('0x14')]);return _0x3ae76d(_0x58b96c[_0xce44('0x13')][_0xce44('0x14')]);}logger[_0xce44('0x13')](_0xce44('0xf'),_0x54e1bb,_0x58b96c['error'][_0xce44('0x14')]);return _0x28502f(_0x58b96c[_0xce44('0x13')][_0xce44('0x14')]);}else{logger[_0xce44('0xe')](_0xce44('0xf'),_0x54e1bb,_0xce44('0x10'));_0x28502f(_0x58b96c[_0xce44('0x15')]['message']);}})[_0xce44('0x16')](function(_0x584638){logger[_0xce44('0x13')]('CmList,\x20%s,\x20%s',_0x54e1bb,_0x584638);_0x3ae76d(_0x584638);});});} \ No newline at end of file +var _0x7675=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis','./cmList.socket','register','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x4558dd,_0x1682a8){var _0x276007=function(_0x51a7f9){while(--_0x51a7f9){_0x4558dd['push'](_0x4558dd['shift']());}};_0x276007(++_0x1682a8);}(_0x7675,0xd6));var _0x5767=function(_0x24f7e8,_0x421cd9){_0x24f7e8=_0x24f7e8-0x0;var _0x12a11b=_0x7675[_0x24f7e8];return _0x12a11b;};'use strict';var _=require('lodash');var util=require(_0x5767('0x0'));var moment=require(_0x5767('0x1'));var BPromise=require(_0x5767('0x2'));var rs=require(_0x5767('0x3'));var fs=require('fs');var Redis=require(_0x5767('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5767('0x5'));var logger=require(_0x5767('0x6'))(_0x5767('0x7'));var config=require('../../config/environment');var jayson=require(_0x5767('0x8'));var client=jayson[_0x5767('0x9')][_0x5767('0xa')]({'port':0x232a});config['redis']=_[_0x5767('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5767('0xc'))(new Redis(config[_0x5767('0xd')]));require(_0x5767('0xe'))[_0x5767('0xf')](socket);function respondWithRpcPromise(_0x17914a,_0x181907,_0x6fbb76){return new BPromise(function(_0x3212d1,_0x57be73){return client['request'](_0x17914a,_0x6fbb76)['then'](function(_0x454079){logger['info'](_0x5767('0x10'),_0x181907,_0x5767('0x11'));logger['debug'](_0x5767('0x12'),_0x181907,_0x5767('0x11'),JSON[_0x5767('0x13')](_0x454079));if(_0x454079[_0x5767('0x14')]){if(_0x454079['error']['code']===0x1f4){logger['error'](_0x5767('0x10'),_0x181907,_0x454079[_0x5767('0x14')][_0x5767('0x15')]);return _0x57be73(_0x454079[_0x5767('0x14')][_0x5767('0x15')]);}logger[_0x5767('0x14')](_0x5767('0x10'),_0x181907,_0x454079[_0x5767('0x14')]['message']);return _0x3212d1(_0x454079[_0x5767('0x14')][_0x5767('0x15')]);}else{logger[_0x5767('0x16')](_0x5767('0x10'),_0x181907,_0x5767('0x11'));_0x3212d1(_0x454079[_0x5767('0x17')]['message']);}})['catch'](function(_0x45473d){logger[_0x5767('0x14')](_0x5767('0x10'),_0x181907,_0x45473d);_0x57be73(_0x45473d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index ab7d0ec..af671fa 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 _0xb7a6=['update','removeListener','./cmList.events','save'];(function(_0x426267,_0x422e6e){var _0x59e163=function(_0x1abaa3){while(--_0x1abaa3){_0x426267['push'](_0x426267['shift']());}};_0x59e163(++_0x422e6e);}(_0xb7a6,0x66));var _0x6b7a=function(_0x65ea6c,_0x1a2d48){_0x65ea6c=_0x65ea6c-0x0;var _0x56e82e=_0xb7a6[_0x65ea6c];return _0x56e82e;};'use strict';var CmListEvents=require(_0x6b7a('0x0'));var events=[_0x6b7a('0x1'),'remove',_0x6b7a('0x2')];function createListener(_0x3626a8,_0x429ca6){return function(_0x48d5a3){_0x429ca6['emit'](_0x3626a8,_0x48d5a3);};}function removeListener(_0x3f50ef,_0x2e33c4){return function(){CmListEvents[_0x6b7a('0x3')](_0x3f50ef,_0x2e33c4);};}exports['register']=function(_0x5df617){for(var _0x122521=0x0,_0x5ca393=events['length'];_0x122521<_0x5ca393;_0x122521++){var _0x10bd01=events[_0x122521];var _0x69fc9e=createListener('cmList:'+_0x10bd01,_0x5df617);CmListEvents['on'](_0x10bd01,_0x69fc9e);}}; \ No newline at end of file +var _0x727b=['save','update','emit','removeListener','register','length','./cmList.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x727b,0xa0));var _0xb727=function(_0xfeecfe,_0x38239d){_0xfeecfe=_0xfeecfe-0x0;var _0x21e1d9=_0x727b[_0xfeecfe];return _0x21e1d9;};'use strict';var CmListEvents=require(_0xb727('0x0'));var events=[_0xb727('0x1'),'remove',_0xb727('0x2')];function createListener(_0x150f81,_0x2ce08d){return function(_0x3a1778){_0x2ce08d[_0xb727('0x3')](_0x150f81,_0x3a1778);};}function removeListener(_0x454ad5,_0x9461c4){return function(){CmListEvents[_0xb727('0x4')](_0x454ad5,_0x9461c4);};}exports[_0xb727('0x5')]=function(_0x5af0a4){for(var _0x973a15=0x0,_0x27fa05=events[_0xb727('0x6')];_0x973a15<_0x27fa05;_0x973a15++){var _0xfe61df=events[_0x973a15];var _0x120ad7=createListener('cmList:'+_0xfe61df,_0x5af0a4);CmListEvents['on'](_0xfe61df,_0x120ad7);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 31cd516..06ab262 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 _0x1631=['show','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addContacts','/:id/fields','addAgents','update','delete','destroy','/:id/dispositions','removeDispositions','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1631,0x173));var _0x1163=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x1631[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x1163('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1163('0x1'));var express=require('express');var router=express[_0x1163('0x2')]();var fs_extra=require(_0x1163('0x3'));var auth=require(_0x1163('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1163('0x5'));var controller=require(_0x1163('0x6'));router[_0x1163('0x7')]('/',auth[_0x1163('0x8')](),controller[_0x1163('0x9')]);router[_0x1163('0x7')](_0x1163('0xa'),auth[_0x1163('0x8')](),controller[_0x1163('0xb')]);router[_0x1163('0x7')](_0x1163('0xc'),auth[_0x1163('0x8')](),controller[_0x1163('0xd')]);router[_0x1163('0x7')]('/:id/dispositions',auth[_0x1163('0x8')](),controller[_0x1163('0xe')]);router[_0x1163('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x1163('0xf')]);router[_0x1163('0x7')](_0x1163('0x10'),auth[_0x1163('0x8')](),controller[_0x1163('0x11')]);router[_0x1163('0x7')]('/:id/fields',auth[_0x1163('0x8')](),controller[_0x1163('0x12')]);router[_0x1163('0x7')](_0x1163('0x13'),auth[_0x1163('0x8')](),controller[_0x1163('0x14')]);router[_0x1163('0x15')]('/',auth[_0x1163('0x8')](),controller[_0x1163('0x16')]);router['post']('/:id/dispositions',auth[_0x1163('0x8')](),controller['addDisposition']);router[_0x1163('0x15')]('/:id/contacts',auth[_0x1163('0x8')](),controller[_0x1163('0x17')]);router['post'](_0x1163('0x18'),auth[_0x1163('0x8')](),controller['addCustomField']);router[_0x1163('0x15')](_0x1163('0x13'),auth[_0x1163('0x8')](),controller[_0x1163('0x19')]);router['put'](_0x1163('0xc'),auth[_0x1163('0x8')](),controller[_0x1163('0x1a')]);router[_0x1163('0x1b')](_0x1163('0xc'),auth['isAuthenticated'](),controller[_0x1163('0x1c')]);router['delete'](_0x1163('0x1d'),auth[_0x1163('0x8')](),controller[_0x1163('0x1e')]);router[_0x1163('0x1b')]('/:id/users',auth[_0x1163('0x8')](),controller['removeAgents']);module[_0x1163('0x1f')]=router; \ No newline at end of file +var _0x2427=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','delete','destroy','multer','util'];(function(_0x5a88f7,_0x5a6c23){var _0x57ad84=function(_0x1fdb8d){while(--_0x1fdb8d){_0x5a88f7['push'](_0x5a88f7['shift']());}};_0x57ad84(++_0x5a6c23);}(_0x2427,0x85));var _0x7242=function(_0x4f89ff,_0x5e466b){_0x4f89ff=_0x4f89ff-0x0;var _0x42f34c=_0x2427[_0x4f89ff];return _0x42f34c;};'use strict';var multer=require(_0x7242('0x0'));var util=require(_0x7242('0x1'));var path=require(_0x7242('0x2'));var timeout=require('connect-timeout');var express=require(_0x7242('0x3'));var router=express[_0x7242('0x4')]();var fs_extra=require(_0x7242('0x5'));var auth=require(_0x7242('0x6'));var interaction=require(_0x7242('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x7242('0x8')]('/',auth[_0x7242('0x9')](),controller[_0x7242('0xa')]);router[_0x7242('0x8')](_0x7242('0xb'),auth[_0x7242('0x9')](),controller['describe']);router[_0x7242('0x8')](_0x7242('0xc'),auth[_0x7242('0x9')](),controller['show']);router[_0x7242('0x8')](_0x7242('0xd'),auth[_0x7242('0x9')](),controller[_0x7242('0xe')]);router[_0x7242('0x8')](_0x7242('0xf'),auth[_0x7242('0x9')](),controller[_0x7242('0x10')]);router[_0x7242('0x8')](_0x7242('0x11'),auth[_0x7242('0x9')](),controller[_0x7242('0x12')]);router['get'](_0x7242('0x13'),auth['isAuthenticated'](),controller[_0x7242('0x14')]);router[_0x7242('0x8')](_0x7242('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0x7242('0x16')]('/',auth[_0x7242('0x9')](),controller[_0x7242('0x17')]);router[_0x7242('0x16')]('/:id/dispositions',auth[_0x7242('0x9')](),controller[_0x7242('0x18')]);router[_0x7242('0x16')](_0x7242('0xf'),auth[_0x7242('0x9')](),controller['addContacts']);router[_0x7242('0x16')]('/:id/fields',auth[_0x7242('0x9')](),controller['addCustomField']);router[_0x7242('0x16')](_0x7242('0x15'),auth[_0x7242('0x9')](),controller['addAgents']);router['put'](_0x7242('0xc'),auth[_0x7242('0x9')](),controller['update']);router[_0x7242('0x19')](_0x7242('0xc'),auth[_0x7242('0x9')](),controller[_0x7242('0x1a')]);router[_0x7242('0x19')](_0x7242('0xd'),auth[_0x7242('0x9')](),controller['removeDispositions']);router['delete'](_0x7242('0x15'),auth['isAuthenticated'](),controller['removeAgents']);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 946b232..2a3d13f 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 _0xf563=['sequelize','getDataValue','field','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf563,0x1f0));var _0x3f56=function(_0x543083,_0x2a7767){_0x543083=_0x543083-0x0;var _0x832f50=_0xf563[_0x543083];return _0x832f50;};'use strict';var Sequelize=require(_0x3f56('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5740ff){return this[_0x3f56('0x1')](_0x3f56('0x2'));}},'field':{'type':Sequelize[_0x3f56('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x3f56('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xac61=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x3194b5,_0x495239){var _0x50f2dc=function(_0x13abed){while(--_0x13abed){_0x3194b5['push'](_0x3194b5['shift']());}};_0x50f2dc(++_0x495239);}(_0xac61,0x161));var _0x1ac6=function(_0x495cf0,_0x50ba5b){_0x495cf0=_0x495cf0-0x0;var _0x32026c=_0xac61[_0x495cf0];return _0x32026c;};'use strict';var Sequelize=require(_0x1ac6('0x0'));module[_0x1ac6('0x1')]={'name':{'type':Sequelize[_0x1ac6('0x2')],'get':function(_0x479110){return this[_0x1ac6('0x3')](_0x1ac6('0x4'));}},'field':{'type':Sequelize[_0x1ac6('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x1ac6('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 80e0a1c..0eff5cf 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x519df1,_0x2e4de1){var _0x2ffd13=function(_0x3db8de){while(--_0x3db8de){_0x519df1['push'](_0x519df1['shift']());}};_0x2ffd13(++_0x2e4de1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x292a21,_0x4e273c){var _0x466603=function(_0x5ad812){while(--_0x5ad812){_0x292a21['push'](_0x292a21['shift']());}};_0x466603(++_0x4e273c);}(_0x7a54,0x106));var _0x47a5=function(_0x4a6621,_0x3236e4){_0x4a6621=_0x4a6621-0x0;var _0x16a82f=_0x7a54[_0x4a6621];return _0x16a82f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 551942f..092ba25 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 _0x6468=['define','Condition','tools_conditions','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6468,0xe7));var _0x8646=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x6468[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x8646('0x0'));var util=require(_0x8646('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8646('0x2'));var BPromise=require('bluebird');var rp=require(_0x8646('0x3'));var fs=require('fs');var path=require(_0x8646('0x4'));var rimraf=require(_0x8646('0x5'));var config=require(_0x8646('0x6'));var attributes=require(_0x8646('0x7'));module[_0x8646('0x8')]=function(_0xd3ff16,_0x44d930){return _0xd3ff16[_0x8646('0x9')](_0x8646('0xa'),attributes,{'tableName':_0x8646('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02d5=['define','tools_conditions','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x5cbb69,_0x53a3fb){var _0x1c3e48=function(_0x297f1b){while(--_0x297f1b){_0x5cbb69['push'](_0x5cbb69['shift']());}};_0x1c3e48(++_0x53a3fb);}(_0x02d5,0xf2));var _0x502d=function(_0x5c8f3e,_0x33ba70){_0x5c8f3e=_0x5c8f3e-0x0;var _0xb55f35=_0x02d5[_0x5c8f3e];return _0xb55f35;};'use strict';var _=require(_0x502d('0x0'));var util=require(_0x502d('0x1'));var logger=require('../../config/logger')(_0x502d('0x2'));var moment=require('moment');var BPromise=require(_0x502d('0x3'));var rp=require(_0x502d('0x4'));var fs=require('fs');var path=require(_0x502d('0x5'));var rimraf=require(_0x502d('0x6'));var config=require(_0x502d('0x7'));var attributes=require(_0x502d('0x8'));module[_0x502d('0x9')]=function(_0x2a030c,_0x77bf76){return _0x2a030c[_0x502d('0xa')]('Condition',attributes,{'tableName':_0x502d('0xb'),'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 025d76e..2bea951 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 _0xf4ef=['client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf4ef,0x18e));var _0xff4e=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xf4ef[_0x470f63];return _0x4f09e2;};'use strict';var _=require('lodash');var util=require(_0xff4e('0x0'));var moment=require(_0xff4e('0x1'));var BPromise=require(_0xff4e('0x2'));var rs=require(_0xff4e('0x3'));var fs=require('fs');var Redis=require(_0xff4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xff4e('0x5'));var logger=require(_0xff4e('0x6'))(_0xff4e('0x7'));var config=require(_0xff4e('0x8'));var jayson=require(_0xff4e('0x9'));var client=jayson[_0xff4e('0xa')][_0xff4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x518a4a,_0x479736,_0x137791){return new BPromise(function(_0x3b46c6,_0x142815){return client[_0xff4e('0xc')](_0x518a4a,_0x137791)[_0xff4e('0xd')](function(_0x32f31e){logger[_0xff4e('0xe')](_0xff4e('0xf'),_0x479736,_0xff4e('0x10'));logger[_0xff4e('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0x479736,_0xff4e('0x10'),JSON[_0xff4e('0x12')](_0x32f31e));if(_0x32f31e[_0xff4e('0x13')]){if(_0x32f31e[_0xff4e('0x13')][_0xff4e('0x14')]===0x1f4){logger[_0xff4e('0x13')](_0xff4e('0xf'),_0x479736,_0x32f31e[_0xff4e('0x13')][_0xff4e('0x15')]);return _0x142815(_0x32f31e['error'][_0xff4e('0x15')]);}logger[_0xff4e('0x13')](_0xff4e('0xf'),_0x479736,_0x32f31e[_0xff4e('0x13')][_0xff4e('0x15')]);return _0x3b46c6(_0x32f31e[_0xff4e('0x13')][_0xff4e('0x15')]);}else{logger[_0xff4e('0xe')](_0xff4e('0xf'),_0x479736,_0xff4e('0x10'));_0x3b46c6(_0x32f31e[_0xff4e('0x16')][_0xff4e('0x15')]);}})[_0xff4e('0x17')](function(_0x2283f2){logger[_0xff4e('0x13')](_0xff4e('0xf'),_0x479736,_0x2283f2);_0x142815(_0x2283f2);});});} \ No newline at end of file +var _0x7993=['http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x84fcc5,_0x3737fe){var _0x3a0ff1=function(_0x2f99af){while(--_0x2f99af){_0x84fcc5['push'](_0x84fcc5['shift']());}};_0x3a0ff1(++_0x3737fe);}(_0x7993,0x9f));var _0x3799=function(_0x53b24c,_0x5a6d82){_0x53b24c=_0x53b24c-0x0;var _0x50bd13=_0x7993[_0x53b24c];return _0x50bd13;};'use strict';var _=require('lodash');var util=require(_0x3799('0x0'));var moment=require(_0x3799('0x1'));var BPromise=require(_0x3799('0x2'));var rs=require(_0x3799('0x3'));var fs=require('fs');var Redis=require(_0x3799('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3799('0x5'));var logger=require('../../config/logger')(_0x3799('0x6'));var config=require(_0x3799('0x7'));var jayson=require(_0x3799('0x8'));var client=jayson['client'][_0x3799('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5098eb,_0x3bfbb1,_0x26d9b9){return new BPromise(function(_0x4ef5ed,_0x13feb9){return client[_0x3799('0xa')](_0x5098eb,_0x26d9b9)['then'](function(_0x2a5165){logger[_0x3799('0xb')](_0x3799('0xc'),_0x3bfbb1,_0x3799('0xd'));logger[_0x3799('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x3bfbb1,'request\x20sent',JSON[_0x3799('0xf')](_0x2a5165));if(_0x2a5165['error']){if(_0x2a5165[_0x3799('0x10')][_0x3799('0x11')]===0x1f4){logger[_0x3799('0x10')]('Condition,\x20%s,\x20%s',_0x3bfbb1,_0x2a5165[_0x3799('0x10')]['message']);return _0x13feb9(_0x2a5165['error'][_0x3799('0x12')]);}logger[_0x3799('0x10')](_0x3799('0xc'),_0x3bfbb1,_0x2a5165['error']['message']);return _0x4ef5ed(_0x2a5165[_0x3799('0x10')]['message']);}else{logger['info'](_0x3799('0xc'),_0x3bfbb1,_0x3799('0xd'));_0x4ef5ed(_0x2a5165[_0x3799('0x13')]['message']);}})[_0x3799('0x14')](function(_0x19d45f){logger[_0x3799('0x10')](_0x3799('0xc'),_0x3bfbb1,_0x19d45f);_0x13feb9(_0x19d45f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index bf1392d..cdfafa6 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 _0x3258=['put','isAuthenticated','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x3258,0x135));var _0x8325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3258[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8325('0x0'));var util=require(_0x8325('0x1'));var path=require(_0x8325('0x2'));var timeout=require(_0x8325('0x3'));var express=require(_0x8325('0x4'));var router=express[_0x8325('0x5')]();var fs_extra=require(_0x8325('0x6'));var auth=require(_0x8325('0x7'));var interaction=require(_0x8325('0x8'));var config=require(_0x8325('0x9'));var controller=require(_0x8325('0xa'));router[_0x8325('0xb')]('/:id',auth[_0x8325('0xc')](),controller['update']);router['delete'](_0x8325('0xd'),auth[_0x8325('0xc')](),controller[_0x8325('0xe')]);module[_0x8325('0xf')]=router; \ No newline at end of file +var _0xa7a2=['multer','util','path','fs-extra','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa7a2,0x1e1));var _0x2a7a=function(_0x21d71a,_0x42b04f){_0x21d71a=_0x21d71a-0x0;var _0xbb1699=_0xa7a2[_0x21d71a];return _0xbb1699;};'use strict';var multer=require(_0x2a7a('0x0'));var util=require(_0x2a7a('0x1'));var path=require(_0x2a7a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2a7a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a7a('0x4'));var controller=require(_0x2a7a('0x5'));router[_0x2a7a('0x6')]('/:id',auth[_0x2a7a('0x7')](),controller[_0x2a7a('0x8')]);router[_0x2a7a('0x9')](_0x2a7a('0xa'),auth[_0x2a7a('0x7')](),controller[_0x2a7a('0xb')]);module[_0x2a7a('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 00b307d..ffdf3c0 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 _0xe706=['STRING','sequelize','exports'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xe706,0xa3));var _0x6e70=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xe706[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4aa766,_0x3394ab){var _0x240412=function(_0xea75df){while(--_0xea75df){_0x4aa766['push'](_0x4aa766['shift']());}};_0x240412(++_0x3394ab);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d915d55..c6c0d23 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 _0x3b39=['custom','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrFaxAccounts','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','pick','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','iframe','attrUrl','attrs','https://'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3b39,0x12f));var _0x93b3=function(_0x486efc,_0x1cca6a){_0x486efc=_0x486efc-0x0;var _0x42ae7e=_0x3b39[_0x486efc];return _0x42ae7e;};'use strict';var emlformat=require(_0x93b3('0x0'));var rimraf=require(_0x93b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93b3('0x2'));var rp=require(_0x93b3('0x3'));var moment=require(_0x93b3('0x4'));var BPromise=require(_0x93b3('0x5'));var Mustache=require(_0x93b3('0x6'));var util=require('util');var path=require(_0x93b3('0x7'));var sox=require('sox');var csv=require(_0x93b3('0x8'));var ejs=require(_0x93b3('0x9'));var fs=require('fs');var fs_extra=require(_0x93b3('0xa'));var _=require('lodash');var squel=require(_0x93b3('0xb'));var crypto=require(_0x93b3('0xc'));var jsforce=require(_0x93b3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x93b3('0x8'));var querystring=require(_0x93b3('0xe'));var Papa=require('papaparse');var Redis=require(_0x93b3('0xf'));var authService=require(_0x93b3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x93b3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93b3('0x12'))(_0x93b3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x93b3('0x14'));var db=require(_0x93b3('0x15'))['db'];config[_0x93b3('0x16')]=_[_0x93b3('0x17')](config[_0x93b3('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x93b3('0x18'))(new Redis(config[_0x93b3('0x16')]));require(_0x93b3('0x19'))['register'](socket);function respondWithStatusCode(_0x471c0b,_0x33eec0){_0x33eec0=_0x33eec0||0xcc;return function(_0x191a63){if(_0x191a63){return _0x471c0b[_0x93b3('0x1a')](_0x33eec0);}return _0x471c0b[_0x93b3('0x1b')](_0x33eec0)[_0x93b3('0x1c')]();};}function respondWithResult(_0x13d9f4,_0x4f62ee){_0x4f62ee=_0x4f62ee||0xc8;return function(_0x4fca58){if(_0x4fca58){return _0x13d9f4['status'](_0x4f62ee)[_0x93b3('0x1d')](_0x4fca58);}};}function respondWithFilteredResult(_0x11e153,_0x553e28){return function(_0x55ad8a){if(_0x55ad8a){var _0x4a1908=typeof _0x553e28['offset']==='undefined'&&typeof _0x553e28[_0x93b3('0x1e')]===_0x93b3('0x1f');var _0xeaf6d8=_0x55ad8a[_0x93b3('0x20')];var _0x141b37=_0x4a1908?0x0:_0x553e28['offset'];var _0xf8e28f=_0x4a1908?_0x55ad8a[_0x93b3('0x20')]:_0x553e28[_0x93b3('0x21')]+_0x553e28[_0x93b3('0x1e')];var _0x369578;if(_0xf8e28f>=_0xeaf6d8){_0xf8e28f=_0xeaf6d8;_0x369578=0xc8;}else{_0x369578=0xce;}_0x11e153[_0x93b3('0x1b')](_0x369578);return _0x11e153[_0x93b3('0x22')](_0x93b3('0x23'),_0x141b37+'-'+_0xf8e28f+'/'+_0xeaf6d8)[_0x93b3('0x1d')](_0x55ad8a);}return null;};}function patchUpdates(_0x4c4e9a){return function(_0x22d307){try{jsonpatch[_0x93b3('0x24')](_0x22d307,_0x4c4e9a,!![]);}catch(_0x4fffa1){return BPromise[_0x93b3('0x25')](_0x4fffa1);}return _0x22d307[_0x93b3('0x26')]();};}function saveUpdates(_0xa2c49c,_0xd1af70){return function(_0x371f6b){if(_0x371f6b){return _0x371f6b[_0x93b3('0x27')](_0xa2c49c)[_0x93b3('0x28')](function(_0x2afd63){return _0x2afd63;});}return null;};}function removeEntity(_0x16d079,_0x18b9dd){return function(_0x143e41){if(_0x143e41){return _0x143e41[_0x93b3('0x29')]()['then'](function(){var _0x459963=_0x143e41[_0x93b3('0x2a')]({'plain':!![]});var _0x4a87ba='CustomDashboards';return db[_0x93b3('0x2b')][_0x93b3('0x29')]({'where':{'type':_0x4a87ba,'resourceId':_0x459963['id']}})[_0x93b3('0x28')](function(){return _0x143e41;});})[_0x93b3('0x28')](function(){_0x16d079[_0x93b3('0x1b')](0xcc)[_0x93b3('0x1c')]();});}};}function handleEntityNotFound(_0x5a3d7c,_0x33a7f1){return function(_0x55b2a2){if(!_0x55b2a2){_0x5a3d7c[_0x93b3('0x1a')](0x194);}return _0x55b2a2;};}function handleError(_0xd84318,_0x5583c4){_0x5583c4=_0x5583c4||0x1f4;return function(_0x207605){logger['error'](_0x207605[_0x93b3('0x2c')]);if(_0x207605[_0x93b3('0x2d')]){delete _0x207605[_0x93b3('0x2d')];}_0xd84318[_0x93b3('0x1b')](_0x5583c4)['send'](_0x207605);};}exports[_0x93b3('0x2e')]=function(_0x40b716,_0x33fcd4){var _0x593269={},_0x61dcde={},_0x5a8f73={'count':0x0,'rows':[]};var _0x11a9c1=_[_0x93b3('0x2f')](db[_0x93b3('0x30')][_0x93b3('0x31')],function(_0x556a7f){return{'name':_0x556a7f[_0x93b3('0x32')],'type':_0x556a7f[_0x93b3('0x33')][_0x93b3('0x34')]};});_0x61dcde[_0x93b3('0x35')]=_[_0x93b3('0x2f')](_0x11a9c1,_0x93b3('0x2d'));_0x61dcde['query']=_[_0x93b3('0x36')](_0x40b716[_0x93b3('0x37')]);_0x61dcde[_0x93b3('0x38')]=_[_0x93b3('0x39')](_0x61dcde[_0x93b3('0x35')],_0x61dcde['query']);_0x593269[_0x93b3('0x3a')]=_[_0x93b3('0x39')](_0x61dcde[_0x93b3('0x35')],qs[_0x93b3('0x3b')](_0x40b716[_0x93b3('0x37')][_0x93b3('0x3b')]));_0x593269[_0x93b3('0x3a')]=_0x593269[_0x93b3('0x3a')]['length']?_0x593269[_0x93b3('0x3a')]:_0x61dcde[_0x93b3('0x35')];if(!_0x40b716[_0x93b3('0x37')]['hasOwnProperty'](_0x93b3('0x3c'))){_0x593269[_0x93b3('0x1e')]=qs[_0x93b3('0x1e')](_0x40b716['query'][_0x93b3('0x1e')]);_0x593269[_0x93b3('0x21')]=qs[_0x93b3('0x21')](_0x40b716[_0x93b3('0x37')][_0x93b3('0x21')]);}_0x593269[_0x93b3('0x3d')]=qs[_0x93b3('0x3e')](_0x40b716[_0x93b3('0x37')][_0x93b3('0x3e')]);_0x593269[_0x93b3('0x3f')]=qs[_0x93b3('0x38')](_['pick'](_0x40b716[_0x93b3('0x37')],_0x61dcde[_0x93b3('0x38')]),_0x11a9c1);if(_0x40b716[_0x93b3('0x37')][_0x93b3('0x40')]){_0x593269['where']=_[_0x93b3('0x41')](_0x593269[_0x93b3('0x3f')],{'$or':_[_0x93b3('0x2f')](_0x11a9c1,function(_0x123d2a){if(_0x123d2a['type']!==_0x93b3('0x42')){var _0xc6af81={};_0xc6af81[_0x123d2a[_0x93b3('0x2d')]]={'$like':'%'+_0x40b716[_0x93b3('0x37')][_0x93b3('0x40')]+'%'};return _0xc6af81;}})});}_0x593269=_[_0x93b3('0x41')]({},_0x593269,_0x40b716[_0x93b3('0x43')]);var _0x1dd187={'where':_0x593269[_0x93b3('0x3f')]};return db['Dashboard'][_0x93b3('0x20')](_0x1dd187)[_0x93b3('0x28')](function(_0x273d33){_0x5a8f73['count']=_0x273d33;if(_0x40b716[_0x93b3('0x37')]['includeAll']){_0x593269[_0x93b3('0x44')]=[{'all':!![]}];}return db[_0x93b3('0x30')][_0x93b3('0x45')](_0x593269);})['then'](function(_0x424770){_0x5a8f73[_0x93b3('0x46')]=_0x424770;return _0x5a8f73;})['then'](respondWithFilteredResult(_0x33fcd4,_0x593269))[_0x93b3('0x47')](handleError(_0x33fcd4,null));};exports[_0x93b3('0x48')]=function(_0x1bfeea,_0x349e2a){var _0x1a583f={'raw':![],'where':{'id':_0x1bfeea[_0x93b3('0x49')]['id']}},_0x5c14ab={};_0x5c14ab[_0x93b3('0x35')]=_['keys'](db[_0x93b3('0x30')][_0x93b3('0x31')]);_0x5c14ab[_0x93b3('0x37')]=_['keys'](_0x1bfeea[_0x93b3('0x37')]);_0x5c14ab[_0x93b3('0x38')]=_['intersection'](_0x5c14ab[_0x93b3('0x35')],_0x5c14ab[_0x93b3('0x37')]);_0x1a583f[_0x93b3('0x3a')]=_['intersection'](_0x5c14ab[_0x93b3('0x35')],qs['fields'](_0x1bfeea['query'][_0x93b3('0x3b')]));_0x1a583f[_0x93b3('0x3a')]=_0x1a583f[_0x93b3('0x3a')][_0x93b3('0x4a')]?_0x1a583f[_0x93b3('0x3a')]:_0x5c14ab[_0x93b3('0x35')];if(_0x1bfeea[_0x93b3('0x37')][_0x93b3('0x4b')]){_0x1a583f[_0x93b3('0x44')]=[{'all':!![]}];}_0x1a583f=_[_0x93b3('0x41')]({},_0x1a583f,_0x1bfeea['options']);return db[_0x93b3('0x30')]['find'](_0x1a583f)[_0x93b3('0x28')](handleEntityNotFound(_0x349e2a,null))[_0x93b3('0x28')](respondWithResult(_0x349e2a,null))[_0x93b3('0x47')](handleError(_0x349e2a,null));};exports['create']=function(_0xb6b5ad,_0x1b5893){return db[_0x93b3('0x30')][_0x93b3('0x4c')](_0xb6b5ad[_0x93b3('0x4d')],{})['then'](function(_0xba5690){var _0x4bafc0=_0xb6b5ad[_0x93b3('0x4e')][_0x93b3('0x2a')]({'plain':!![]});if(!_0x4bafc0)throw new Error(_0x93b3('0x4f'));if(_0x4bafc0[_0x93b3('0x50')]===_0x93b3('0x4e')){var _0x170a4f=_0xba5690[_0x93b3('0x2a')]({'plain':!![]});var _0x4f8b65=_0x93b3('0x51');return db[_0x93b3('0x52')][_0x93b3('0x53')]({'where':{'name':_0x4f8b65,'userProfileId':_0x4bafc0[_0x93b3('0x54')]},'raw':!![]})[_0x93b3('0x28')](function(_0x4a1c90){if(_0x4a1c90&&_0x4a1c90['autoAssociation']===0x0){return db[_0x93b3('0x2b')][_0x93b3('0x4c')]({'name':_0x170a4f[_0x93b3('0x2d')],'resourceId':_0x170a4f['id'],'type':_0x4a1c90[_0x93b3('0x2d')],'sectionId':_0x4a1c90['id']},{})[_0x93b3('0x28')](function(){return _0xba5690;});}else{return _0xba5690;}})[_0x93b3('0x47')](function(_0x3ca856){logger[_0x93b3('0x55')](_0x93b3('0x56'),_0x3ca856);throw _0x3ca856;});}return _0xba5690;})[_0x93b3('0x28')](respondWithResult(_0x1b5893,0xc9))[_0x93b3('0x47')](handleError(_0x1b5893,null));};exports[_0x93b3('0x57')]=function(_0x242a56,_0x3b6c21){var _0x1e14e2={'where':{'id':_0x242a56[_0x93b3('0x49')]['id']}},_0x1e73dd={};_0x1e73dd[_0x93b3('0x35')]=_[_0x93b3('0x36')](db[_0x93b3('0x30')][_0x93b3('0x31')]);_0x1e14e2[_0x93b3('0x3a')]=_['intersection'](_0x1e73dd['model'],qs[_0x93b3('0x3b')](_0x242a56[_0x93b3('0x37')]['fields']));_0x1e14e2[_0x93b3('0x3a')]=_0x1e14e2[_0x93b3('0x3a')][_0x93b3('0x4a')]?_0x1e14e2[_0x93b3('0x3a')]:_0x1e73dd[_0x93b3('0x35')];if(_0x242a56[_0x93b3('0x37')][_0x93b3('0x4b')]){_0x1e14e2[_0x93b3('0x44')]=[{'all':!![]}];}_0x1e14e2=_[_0x93b3('0x41')]({},_0x1e14e2,_0x242a56[_0x93b3('0x43')]);return db[_0x93b3('0x30')][_0x93b3('0x53')](_0x1e14e2)['then'](handleEntityNotFound(_0x3b6c21,null))['then'](function(_0x26b516){if(_0x26b516){var _0x2bc9a5=_0x26b516[_0x93b3('0x2a')]({'plain':!![]});_0x2bc9a5=qs[_0x93b3('0x58')](_0x2bc9a5,['id','createdAt',_0x93b3('0x59')]);_0x242a56[_0x93b3('0x4d')]=_['omit'](_0x242a56[_0x93b3('0x4d')],['id',_0x93b3('0x5a'),_0x93b3('0x59')]);return db['Dashboard'][_0x93b3('0x4c')](_[_0x93b3('0x41')](_0x2bc9a5,_0x242a56[_0x93b3('0x4d')]),{'include':_0x242a56[_0x93b3('0x37')][_0x93b3('0x4b')]?[{'all':!![]}]:undefined})[_0x93b3('0x28')](function(_0xb505e7){var _0x531215=_0x242a56[_0x93b3('0x4e')][_0x93b3('0x2a')]({'plain':!![]});if(!_0x531215)throw new Error(_0x93b3('0x4f'));if(_0x531215[_0x93b3('0x50')]===_0x93b3('0x4e')){var _0xa64d48=_0xb505e7[_0x93b3('0x2a')]({'plain':!![]});var _0x159027=_0x93b3('0x51');return db[_0x93b3('0x52')]['find']({'where':{'name':_0x159027,'userProfileId':_0x531215[_0x93b3('0x54')]},'raw':!![]})[_0x93b3('0x28')](function(_0x2f0050){if(_0x2f0050&&_0x2f0050[_0x93b3('0x5b')]===0x0){return db[_0x93b3('0x2b')]['create']({'name':_0xa64d48[_0x93b3('0x2d')],'resourceId':_0xa64d48['id'],'type':_0x2f0050['name'],'sectionId':_0x2f0050['id']},{})[_0x93b3('0x28')](function(){return _0xb505e7;});}else{return _0xb505e7;}})[_0x93b3('0x47')](function(_0x21e754){logger[_0x93b3('0x55')](_0x93b3('0x56'),_0x21e754);throw _0x21e754;});}return _0xb505e7;});}})[_0x93b3('0x28')](respondWithResult(_0x3b6c21,0xc9))[_0x93b3('0x47')](handleError(_0x3b6c21,null));};exports[_0x93b3('0x27')]=function(_0x5ca6ab,_0x5e698d){if(_0x5ca6ab['body']['id']){delete _0x5ca6ab[_0x93b3('0x4d')]['id'];}return db[_0x93b3('0x30')][_0x93b3('0x53')]({'where':{'id':_0x5ca6ab['params']['id']}})[_0x93b3('0x28')](handleEntityNotFound(_0x5e698d,null))[_0x93b3('0x28')](saveUpdates(_0x5ca6ab[_0x93b3('0x4d')],null))[_0x93b3('0x28')](respondWithResult(_0x5e698d,null))[_0x93b3('0x47')](handleError(_0x5e698d,null));};exports['destroy']=function(_0x3a021f,_0x2b6721){return db[_0x93b3('0x30')][_0x93b3('0x53')]({'where':{'id':_0x3a021f[_0x93b3('0x49')]['id']}})[_0x93b3('0x28')](handleEntityNotFound(_0x2b6721,null))['then'](removeEntity(_0x2b6721,null))[_0x93b3('0x47')](handleError(_0x2b6721,null));};function widgetAttributes(_0x172b4a){try{switch(_0x172b4a['type']){case _0x93b3('0x5c'):return[{'name':_0x93b3('0x5d'),'value':_0x172b4a[_0x93b3('0x5d')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x0]?_0x172b4a[_0x93b3('0x5e')][0x0]['value']:undefined)||_0x93b3('0x5f')}];case _0x93b3('0x60'):return[{'name':'attrPath','value':_0x172b4a['attrPath']||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x0]?_0x172b4a[_0x93b3('0x5e')][0x0][_0x93b3('0x61')]:undefined)||''}];case _0x93b3('0x62'):return[{'name':_0x93b3('0x63'),'value':_0x172b4a['attrHourFormat']||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x0]?_0x172b4a[_0x93b3('0x5e')][0x0][_0x93b3('0x61')]:undefined)||_0x93b3('0x64')},{'name':'attrTimezone','value':_0x172b4a[_0x93b3('0x65')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x1]?_0x172b4a[_0x93b3('0x5e')][0x1][_0x93b3('0x61')]:undefined)||_0x93b3('0x66')},{'name':_0x93b3('0x67'),'value':_0x172b4a[_0x93b3('0x67')]||(_0x172b4a['attrs']&&_0x172b4a[_0x93b3('0x5e')][0x2]?_0x172b4a[_0x93b3('0x5e')][0x2][_0x93b3('0x61')]:undefined)||0xc}];case _0x93b3('0x68'):return[{'name':_0x93b3('0x69'),'value':_0x172b4a[_0x93b3('0x69')]||(_0x172b4a['attrs']&&_0x172b4a[_0x93b3('0x5e')][0x0]?_0x172b4a['attrs'][0x0][_0x93b3('0x61')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x172b4a[_0x93b3('0x6a')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a['attrs'][0x1]?_0x172b4a[_0x93b3('0x5e')][0x1][_0x93b3('0x61')]:undefined)||[]},{'name':_0x93b3('0x67'),'value':_0x172b4a[_0x93b3('0x67')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x2]?_0x172b4a['attrs'][0x2][_0x93b3('0x61')]:undefined)||0x14},{'name':'attrChannel','value':_0x172b4a[_0x93b3('0x6b')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x3]?_0x172b4a[_0x93b3('0x5e')][0x3][_0x93b3('0x61')]:undefined)||_0x93b3('0x6c')},{'name':_0x93b3('0x6d'),'value':_0x172b4a['attrEmailAccounts']||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x4]?_0x172b4a[_0x93b3('0x5e')][0x4][_0x93b3('0x61')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x172b4a['attrFaxAccounts']||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a['attrs'][0x5]?_0x172b4a['attrs'][0x5][_0x93b3('0x61')]:undefined)||''},{'name':_0x93b3('0x6e'),'value':_0x172b4a[_0x93b3('0x6e')]||(_0x172b4a['attrs']&&_0x172b4a[_0x93b3('0x5e')][0x6]?_0x172b4a[_0x93b3('0x5e')][0x6][_0x93b3('0x61')]:undefined)||''},{'name':_0x93b3('0x6f'),'value':_0x172b4a['attrOpenchannelAccounts']||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x7]?_0x172b4a[_0x93b3('0x5e')][0x7][_0x93b3('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x172b4a['attrWhatsappAccounts']||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x8]?_0x172b4a[_0x93b3('0x5e')][0x8][_0x93b3('0x61')]:undefined)||''},{'name':_0x93b3('0x70'),'value':_0x172b4a[_0x93b3('0x70')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x9]?_0x172b4a[_0x93b3('0x5e')][0x9][_0x93b3('0x61')]:undefined)||''}];case _0x93b3('0x71'):case _0x93b3('0x72'):return[{'name':_0x93b3('0x73'),'value':_0x172b4a['attrSerie1']||(_0x172b4a['attrs']&&_0x172b4a['attrs'][0x0]?_0x172b4a[_0x93b3('0x5e')][0x0]['value']:undefined)||_0x93b3('0x74')},{'name':_0x93b3('0x75'),'value':_0x172b4a[_0x93b3('0x75')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a['attrs'][0x1]?_0x172b4a[_0x93b3('0x5e')][0x1][_0x93b3('0x61')]:undefined)||null},{'name':_0x93b3('0x76'),'value':_0x172b4a[_0x93b3('0x76')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x2]?_0x172b4a['attrs'][0x2]['value']:undefined)||null},{'name':_0x93b3('0x6a'),'value':_0x172b4a[_0x93b3('0x6a')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x3]?_0x172b4a[_0x93b3('0x5e')][0x3][_0x93b3('0x61')]:undefined)||[]},{'name':_0x93b3('0x6b'),'value':_0x172b4a[_0x93b3('0x6b')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x4]?_0x172b4a[_0x93b3('0x5e')][0x4]['value']:undefined)||_0x93b3('0x6c')},{'name':'attrEmailAccounts','value':_0x172b4a[_0x93b3('0x6d')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x5]?_0x172b4a[_0x93b3('0x5e')][0x5][_0x93b3('0x61')]:undefined)||''},{'name':_0x93b3('0x77'),'value':_0x172b4a[_0x93b3('0x77')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x6]?_0x172b4a['attrs'][0x6][_0x93b3('0x61')]:undefined)||''},{'name':_0x93b3('0x6e'),'value':_0x172b4a[_0x93b3('0x6e')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x7]?_0x172b4a[_0x93b3('0x5e')][0x7][_0x93b3('0x61')]:undefined)||''},{'name':_0x93b3('0x6f'),'value':_0x172b4a[_0x93b3('0x6f')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x8]?_0x172b4a[_0x93b3('0x5e')][0x8]['value']:undefined)||''},{'name':_0x93b3('0x78'),'value':_0x172b4a[_0x93b3('0x78')]||(_0x172b4a['attrs']&&_0x172b4a[_0x93b3('0x5e')][0x9]?_0x172b4a[_0x93b3('0x5e')][0x9]['value']:undefined)||''},{'name':_0x93b3('0x70'),'value':_0x172b4a[_0x93b3('0x70')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0xa]?_0x172b4a[_0x93b3('0x5e')][0xa]['value']:undefined)||''}];case _0x93b3('0x79'):return[{'name':_0x93b3('0x7a'),'type':_0x172b4a[_0x93b3('0x7b')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x0]?_0x172b4a[_0x93b3('0x5e')][0x0]['type']:undefined)||null,'value':_0x172b4a['attrReport']||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x0]?_0x172b4a[_0x93b3('0x5e')][0x0][_0x93b3('0x61')]:undefined)||null},{'name':_0x93b3('0x7c'),'value':_0x172b4a[_0x93b3('0x7c')]||(_0x172b4a[_0x93b3('0x5e')]&&_0x172b4a[_0x93b3('0x5e')][0x1]?_0x172b4a['attrs'][0x1][_0x93b3('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x5c11aa){logger[_0x93b3('0x55')](_0x93b3('0x7d'),JSON[_0x93b3('0x7e')](_0x5c11aa));return[];}}exports[_0x93b3('0x7f')]=function(_0x154488,_0x283f37,_0x219025){if(_0x154488[_0x93b3('0x4d')]['id']){delete _0x154488[_0x93b3('0x4d')]['id'];}return db[_0x93b3('0x30')][_0x93b3('0x53')]({'where':{'id':_0x154488[_0x93b3('0x49')]['id']}})[_0x93b3('0x28')](handleEntityNotFound(_0x283f37,null))[_0x93b3('0x28')](function(_0x3ab45d){if(_0x3ab45d){_0x154488[_0x93b3('0x4d')][_0x93b3('0x80')]=_0x3ab45d['id'];_0x154488[_0x93b3('0x4d')][_0x93b3('0x5e')]=widgetAttributes(_0x154488[_0x93b3('0x4d')]);return db[_0x93b3('0x81')][_0x93b3('0x4c')](_0x154488[_0x93b3('0x4d')]);}})[_0x93b3('0x28')](respondWithResult(_0x283f37,null))[_0x93b3('0x47')](handleError(_0x283f37,null));};exports[_0x93b3('0x82')]=function(_0x534ec4,_0xf16eb5,_0x4ae8e5){var _0x37b84c={};var _0x5844e3={};var _0x4dac47;var _0x1a1d34;return db['Dashboard']['findOne']({'where':{'id':_0x534ec4[_0x93b3('0x49')]['id']}})[_0x93b3('0x28')](handleEntityNotFound(_0xf16eb5,null))['then'](function(_0x2bc6a3){if(_0x2bc6a3){_0x4dac47=_0x2bc6a3;_0x5844e3[_0x93b3('0x35')]=_[_0x93b3('0x36')](db[_0x93b3('0x81')]['rawAttributes']);_0x5844e3[_0x93b3('0x37')]=_[_0x93b3('0x36')](_0x534ec4[_0x93b3('0x37')]);_0x5844e3['filters']=_['intersection'](_0x5844e3[_0x93b3('0x35')],_0x5844e3[_0x93b3('0x37')]);_0x37b84c[_0x93b3('0x3a')]=_['intersection'](_0x5844e3[_0x93b3('0x35')],qs['fields'](_0x534ec4['query'][_0x93b3('0x3b')]));_0x37b84c['attributes']=_0x37b84c['attributes'][_0x93b3('0x4a')]?_0x37b84c[_0x93b3('0x3a')]:_0x5844e3['model'];_0x37b84c['order']=qs[_0x93b3('0x3e')](_0x534ec4[_0x93b3('0x37')][_0x93b3('0x3e')]);_0x37b84c['where']=qs[_0x93b3('0x38')](_[_0x93b3('0x83')](_0x534ec4[_0x93b3('0x37')],_0x5844e3[_0x93b3('0x38')]));if(_0x534ec4[_0x93b3('0x37')][_0x93b3('0x40')]){_0x37b84c['where']=_['merge'](_0x37b84c[_0x93b3('0x3f')],{'$or':_[_0x93b3('0x2f')](_0x37b84c[_0x93b3('0x3a')],function(_0x29c83b){var _0x37ec58={};_0x37ec58[_0x29c83b]={'$like':'%'+_0x534ec4['query'][_0x93b3('0x40')]+'%'};return _0x37ec58;})});}_0x37b84c=_[_0x93b3('0x41')]({},_0x37b84c,_0x534ec4['options']);return _0x4dac47['getItems'](_0x37b84c);}})[_0x93b3('0x28')](function(_0x26a038){if(_0x26a038){_0x1a1d34=_0x26a038[_0x93b3('0x4a')];if(!_0x534ec4[_0x93b3('0x37')][_0x93b3('0x84')](_0x93b3('0x3c'))){_0x37b84c[_0x93b3('0x1e')]=qs['limit'](_0x534ec4['query']['limit']);_0x37b84c[_0x93b3('0x21')]=qs['offset'](_0x534ec4[_0x93b3('0x37')][_0x93b3('0x21')]);}return _0x4dac47['getItems'](_0x37b84c);}})[_0x93b3('0x28')](function(_0x22afac){if(_0x22afac){return _0x22afac?{'count':_0x1a1d34,'rows':_0x22afac}:null;}})[_0x93b3('0x28')](respondWithResult(_0xf16eb5,null))['catch'](handleError(_0xf16eb5,null));}; \ No newline at end of file +var _0x3cb9=['createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem','findOne','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','sendStatus','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','params','includeAll','find','catch','create','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','body'];(function(_0x5eb49f,_0x1d3cbc){var _0x33d80b=function(_0x3588fe){while(--_0x3588fe){_0x5eb49f['push'](_0x5eb49f['shift']());}};_0x33d80b(++_0x1d3cbc);}(_0x3cb9,0x132));var _0x93cb=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x3cb9[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require(_0x93cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x93cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x93cb('0x2'));var BPromise=require(_0x93cb('0x3'));var Mustache=require(_0x93cb('0x4'));var util=require(_0x93cb('0x5'));var path=require(_0x93cb('0x6'));var sox=require(_0x93cb('0x7'));var csv=require(_0x93cb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93cb('0x9'));var _=require(_0x93cb('0xa'));var squel=require(_0x93cb('0xb'));var crypto=require(_0x93cb('0xc'));var jsforce=require(_0x93cb('0xd'));var deskjs=require(_0x93cb('0xe'));var toCsv=require(_0x93cb('0x8'));var querystring=require(_0x93cb('0xf'));var Papa=require(_0x93cb('0x10'));var Redis=require(_0x93cb('0x11'));var authService=require(_0x93cb('0x12'));var qs=require(_0x93cb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93cb('0x14'));var logger=require(_0x93cb('0x15'))(_0x93cb('0x16'));var utils=require(_0x93cb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x93cb('0x18'));var db=require(_0x93cb('0x19'))['db'];config[_0x93cb('0x1a')]=_[_0x93cb('0x1b')](config[_0x93cb('0x1a')],{'host':_0x93cb('0x1c'),'port':0x18eb});var socket=require(_0x93cb('0x1d'))(new Redis(config['redis']));require(_0x93cb('0x1e'))[_0x93cb('0x1f')](socket);function respondWithStatusCode(_0x137ce6,_0x47771f){_0x47771f=_0x47771f||0xcc;return function(_0x4986a8){if(_0x4986a8){return _0x137ce6['sendStatus'](_0x47771f);}return _0x137ce6['status'](_0x47771f)['end']();};}function respondWithResult(_0x3faf1b,_0x503a6c){_0x503a6c=_0x503a6c||0xc8;return function(_0x594618){if(_0x594618){return _0x3faf1b[_0x93cb('0x20')](_0x503a6c)[_0x93cb('0x21')](_0x594618);}};}function respondWithFilteredResult(_0x2956c9,_0x32d5b1){return function(_0x26618a){if(_0x26618a){var _0x5b6f07=typeof _0x32d5b1[_0x93cb('0x22')]===_0x93cb('0x23')&&typeof _0x32d5b1[_0x93cb('0x24')]===_0x93cb('0x23');var _0x581048=_0x26618a[_0x93cb('0x25')];var _0x396bb=_0x5b6f07?0x0:_0x32d5b1['offset'];var _0x2c564e=_0x5b6f07?_0x26618a[_0x93cb('0x25')]:_0x32d5b1[_0x93cb('0x22')]+_0x32d5b1[_0x93cb('0x24')];var _0xe7407;if(_0x2c564e>=_0x581048){_0x2c564e=_0x581048;_0xe7407=0xc8;}else{_0xe7407=0xce;}_0x2956c9[_0x93cb('0x20')](_0xe7407);return _0x2956c9['set']('Content-Range',_0x396bb+'-'+_0x2c564e+'/'+_0x581048)[_0x93cb('0x21')](_0x26618a);}return null;};}function patchUpdates(_0x1ced27){return function(_0x47bf44){try{jsonpatch['apply'](_0x47bf44,_0x1ced27,!![]);}catch(_0x7bb3d){return BPromise[_0x93cb('0x26')](_0x7bb3d);}return _0x47bf44[_0x93cb('0x27')]();};}function saveUpdates(_0xf703bd,_0xa83eeb){return function(_0x3b36a6){if(_0x3b36a6){return _0x3b36a6[_0x93cb('0x28')](_0xf703bd)[_0x93cb('0x29')](function(_0xb52f01){return _0xb52f01;});}return null;};}function removeEntity(_0x242b9d,_0x337c94){return function(_0x4798cb){if(_0x4798cb){return _0x4798cb[_0x93cb('0x2a')]()[_0x93cb('0x29')](function(){var _0x3ae49e=_0x4798cb[_0x93cb('0x2b')]({'plain':!![]});var _0x4c6aac=_0x93cb('0x2c');return db[_0x93cb('0x2d')][_0x93cb('0x2a')]({'where':{'type':_0x4c6aac,'resourceId':_0x3ae49e['id']}})[_0x93cb('0x29')](function(){return _0x4798cb;});})[_0x93cb('0x29')](function(){_0x242b9d[_0x93cb('0x20')](0xcc)[_0x93cb('0x2e')]();});}};}function handleEntityNotFound(_0x29ab39,_0x397a1d){return function(_0x5b4d4a){if(!_0x5b4d4a){_0x29ab39[_0x93cb('0x2f')](0x194);}return _0x5b4d4a;};}function handleError(_0xa40e70,_0x2ce092){_0x2ce092=_0x2ce092||0x1f4;return function(_0x4e766c){logger['error'](_0x4e766c[_0x93cb('0x30')]);if(_0x4e766c[_0x93cb('0x31')]){delete _0x4e766c['name'];}_0xa40e70[_0x93cb('0x20')](_0x2ce092)[_0x93cb('0x32')](_0x4e766c);};}exports[_0x93cb('0x33')]=function(_0xb1f6dd,_0x57ca8c){var _0x25ebb8={},_0x43566d={},_0x54e950={'count':0x0,'rows':[]};var _0xee0c30=_[_0x93cb('0x34')](db[_0x93cb('0x35')][_0x93cb('0x36')],function(_0x33f8f7){return{'name':_0x33f8f7[_0x93cb('0x37')],'type':_0x33f8f7[_0x93cb('0x38')][_0x93cb('0x39')]};});_0x43566d[_0x93cb('0x3a')]=_['map'](_0xee0c30,_0x93cb('0x31'));_0x43566d[_0x93cb('0x3b')]=_[_0x93cb('0x3c')](_0xb1f6dd[_0x93cb('0x3b')]);_0x43566d[_0x93cb('0x3d')]=_[_0x93cb('0x3e')](_0x43566d[_0x93cb('0x3a')],_0x43566d[_0x93cb('0x3b')]);_0x25ebb8['attributes']=_[_0x93cb('0x3e')](_0x43566d[_0x93cb('0x3a')],qs[_0x93cb('0x3f')](_0xb1f6dd['query'][_0x93cb('0x3f')]));_0x25ebb8['attributes']=_0x25ebb8[_0x93cb('0x40')][_0x93cb('0x41')]?_0x25ebb8[_0x93cb('0x40')]:_0x43566d[_0x93cb('0x3a')];if(!_0xb1f6dd[_0x93cb('0x3b')][_0x93cb('0x42')](_0x93cb('0x43'))){_0x25ebb8[_0x93cb('0x24')]=qs[_0x93cb('0x24')](_0xb1f6dd['query']['limit']);_0x25ebb8['offset']=qs[_0x93cb('0x22')](_0xb1f6dd[_0x93cb('0x3b')][_0x93cb('0x22')]);}_0x25ebb8[_0x93cb('0x44')]=qs[_0x93cb('0x45')](_0xb1f6dd[_0x93cb('0x3b')][_0x93cb('0x45')]);_0x25ebb8[_0x93cb('0x46')]=qs[_0x93cb('0x3d')](_[_0x93cb('0x47')](_0xb1f6dd[_0x93cb('0x3b')],_0x43566d['filters']),_0xee0c30);if(_0xb1f6dd['query'][_0x93cb('0x48')]){_0x25ebb8[_0x93cb('0x46')]=_[_0x93cb('0x49')](_0x25ebb8[_0x93cb('0x46')],{'$or':_['map'](_0xee0c30,function(_0x18418b){if(_0x18418b[_0x93cb('0x38')]!==_0x93cb('0x4a')){var _0xb8b72d={};_0xb8b72d[_0x18418b[_0x93cb('0x31')]]={'$like':'%'+_0xb1f6dd['query']['filter']+'%'};return _0xb8b72d;}})});}_0x25ebb8=_[_0x93cb('0x49')]({},_0x25ebb8,_0xb1f6dd[_0x93cb('0x4b')]);var _0x101db6={'where':_0x25ebb8['where']};return db[_0x93cb('0x35')][_0x93cb('0x25')](_0x101db6)[_0x93cb('0x29')](function(_0x31fd4c){_0x54e950[_0x93cb('0x25')]=_0x31fd4c;if(_0xb1f6dd['query']['includeAll']){_0x25ebb8[_0x93cb('0x4c')]=[{'all':!![]}];}return db[_0x93cb('0x35')]['findAll'](_0x25ebb8);})['then'](function(_0x1f2565){_0x54e950[_0x93cb('0x4d')]=_0x1f2565;return _0x54e950;})[_0x93cb('0x29')](respondWithFilteredResult(_0x57ca8c,_0x25ebb8))['catch'](handleError(_0x57ca8c,null));};exports['show']=function(_0x2ed4c8,_0x4bbf03){var _0x4175b4={'raw':![],'where':{'id':_0x2ed4c8[_0x93cb('0x4e')]['id']}},_0xee007d={};_0xee007d[_0x93cb('0x3a')]=_[_0x93cb('0x3c')](db[_0x93cb('0x35')]['rawAttributes']);_0xee007d['query']=_[_0x93cb('0x3c')](_0x2ed4c8[_0x93cb('0x3b')]);_0xee007d[_0x93cb('0x3d')]=_['intersection'](_0xee007d[_0x93cb('0x3a')],_0xee007d[_0x93cb('0x3b')]);_0x4175b4[_0x93cb('0x40')]=_[_0x93cb('0x3e')](_0xee007d['model'],qs['fields'](_0x2ed4c8[_0x93cb('0x3b')][_0x93cb('0x3f')]));_0x4175b4[_0x93cb('0x40')]=_0x4175b4[_0x93cb('0x40')]['length']?_0x4175b4[_0x93cb('0x40')]:_0xee007d[_0x93cb('0x3a')];if(_0x2ed4c8['query'][_0x93cb('0x4f')]){_0x4175b4[_0x93cb('0x4c')]=[{'all':!![]}];}_0x4175b4=_[_0x93cb('0x49')]({},_0x4175b4,_0x2ed4c8[_0x93cb('0x4b')]);return db['Dashboard'][_0x93cb('0x50')](_0x4175b4)[_0x93cb('0x29')](handleEntityNotFound(_0x4bbf03,null))[_0x93cb('0x29')](respondWithResult(_0x4bbf03,null))[_0x93cb('0x51')](handleError(_0x4bbf03,null));};exports[_0x93cb('0x52')]=function(_0x933754,_0x57b146){return db['Dashboard']['create'](_0x933754['body'],{})[_0x93cb('0x29')](function(_0x50a2ef){var _0x28227a=_0x933754[_0x93cb('0x53')][_0x93cb('0x2b')]({'plain':!![]});if(!_0x28227a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28227a[_0x93cb('0x54')]===_0x93cb('0x53')){var _0x2330d9=_0x50a2ef[_0x93cb('0x2b')]({'plain':!![]});var _0x1d2600='CustomDashboards';return db[_0x93cb('0x55')][_0x93cb('0x50')]({'where':{'name':_0x1d2600,'userProfileId':_0x28227a['userProfileId']},'raw':!![]})['then'](function(_0x389ea0){if(_0x389ea0&&_0x389ea0[_0x93cb('0x56')]===0x0){return db[_0x93cb('0x2d')][_0x93cb('0x52')]({'name':_0x2330d9[_0x93cb('0x31')],'resourceId':_0x2330d9['id'],'type':_0x389ea0[_0x93cb('0x31')],'sectionId':_0x389ea0['id']},{})[_0x93cb('0x29')](function(){return _0x50a2ef;});}else{return _0x50a2ef;}})[_0x93cb('0x51')](function(_0x35b5de){logger[_0x93cb('0x57')](_0x93cb('0x58'),_0x35b5de);throw _0x35b5de;});}return _0x50a2ef;})[_0x93cb('0x29')](respondWithResult(_0x57b146,0xc9))[_0x93cb('0x51')](handleError(_0x57b146,null));};exports[_0x93cb('0x59')]=function(_0x525129,_0xe33ed1){var _0x2fce35={'where':{'id':_0x525129['params']['id']}},_0x34a946={};_0x34a946[_0x93cb('0x3a')]=_[_0x93cb('0x3c')](db['Dashboard'][_0x93cb('0x36')]);_0x2fce35[_0x93cb('0x40')]=_[_0x93cb('0x3e')](_0x34a946[_0x93cb('0x3a')],qs[_0x93cb('0x3f')](_0x525129[_0x93cb('0x3b')][_0x93cb('0x3f')]));_0x2fce35[_0x93cb('0x40')]=_0x2fce35[_0x93cb('0x40')]['length']?_0x2fce35[_0x93cb('0x40')]:_0x34a946[_0x93cb('0x3a')];if(_0x525129['query'][_0x93cb('0x4f')]){_0x2fce35[_0x93cb('0x4c')]=[{'all':!![]}];}_0x2fce35=_[_0x93cb('0x49')]({},_0x2fce35,_0x525129['options']);return db['Dashboard'][_0x93cb('0x50')](_0x2fce35)[_0x93cb('0x29')](handleEntityNotFound(_0xe33ed1,null))[_0x93cb('0x29')](function(_0x1ea842){if(_0x1ea842){var _0xe58c3c=_0x1ea842[_0x93cb('0x2b')]({'plain':!![]});_0xe58c3c=qs['omit'](_0xe58c3c,['id','createdAt',_0x93cb('0x5a')]);_0x525129['body']=_[_0x93cb('0x5b')](_0x525129[_0x93cb('0x5c')],['id',_0x93cb('0x5d'),'updatedAt']);return db[_0x93cb('0x35')][_0x93cb('0x52')](_['merge'](_0xe58c3c,_0x525129['body']),{'include':_0x525129[_0x93cb('0x3b')][_0x93cb('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x290e52){var _0x299ace=_0x525129['user'][_0x93cb('0x2b')]({'plain':!![]});if(!_0x299ace)throw new Error(_0x93cb('0x5e'));if(_0x299ace[_0x93cb('0x54')]===_0x93cb('0x53')){var _0x3985b3=_0x290e52[_0x93cb('0x2b')]({'plain':!![]});var _0x5c7273=_0x93cb('0x2c');return db[_0x93cb('0x55')][_0x93cb('0x50')]({'where':{'name':_0x5c7273,'userProfileId':_0x299ace[_0x93cb('0x5f')]},'raw':!![]})[_0x93cb('0x29')](function(_0x1b389f){if(_0x1b389f&&_0x1b389f[_0x93cb('0x56')]===0x0){return db[_0x93cb('0x2d')]['create']({'name':_0x3985b3['name'],'resourceId':_0x3985b3['id'],'type':_0x1b389f['name'],'sectionId':_0x1b389f['id']},{})[_0x93cb('0x29')](function(){return _0x290e52;});}else{return _0x290e52;}})[_0x93cb('0x51')](function(_0x49123a){logger[_0x93cb('0x57')](_0x93cb('0x58'),_0x49123a);throw _0x49123a;});}return _0x290e52;});}})[_0x93cb('0x29')](respondWithResult(_0xe33ed1,0xc9))[_0x93cb('0x51')](handleError(_0xe33ed1,null));};exports[_0x93cb('0x28')]=function(_0x504f13,_0x5b7ab8){if(_0x504f13['body']['id']){delete _0x504f13[_0x93cb('0x5c')]['id'];}return db[_0x93cb('0x35')][_0x93cb('0x50')]({'where':{'id':_0x504f13[_0x93cb('0x4e')]['id']}})[_0x93cb('0x29')](handleEntityNotFound(_0x5b7ab8,null))['then'](saveUpdates(_0x504f13[_0x93cb('0x5c')],null))[_0x93cb('0x29')](respondWithResult(_0x5b7ab8,null))['catch'](handleError(_0x5b7ab8,null));};exports[_0x93cb('0x2a')]=function(_0x3883a2,_0x42049b){return db[_0x93cb('0x35')]['find']({'where':{'id':_0x3883a2[_0x93cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x42049b,null))['then'](removeEntity(_0x42049b,null))[_0x93cb('0x51')](handleError(_0x42049b,null));};function widgetAttributes(_0x44fa59){try{switch(_0x44fa59[_0x93cb('0x38')]){case _0x93cb('0x60'):return[{'name':_0x93cb('0x61'),'value':_0x44fa59[_0x93cb('0x61')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x0]?_0x44fa59['attrs'][0x0]['value']:undefined)||'https://'}];case _0x93cb('0x63'):return[{'name':'attrPath','value':_0x44fa59[_0x93cb('0x64')]||(_0x44fa59['attrs']&&_0x44fa59[_0x93cb('0x62')][0x0]?_0x44fa59['attrs'][0x0][_0x93cb('0x65')]:undefined)||''}];case _0x93cb('0x66'):return[{'name':_0x93cb('0x67'),'value':_0x44fa59[_0x93cb('0x67')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x0]?_0x44fa59[_0x93cb('0x62')][0x0][_0x93cb('0x65')]:undefined)||_0x93cb('0x68')},{'name':_0x93cb('0x69'),'value':_0x44fa59[_0x93cb('0x69')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x1]?_0x44fa59[_0x93cb('0x62')][0x1][_0x93cb('0x65')]:undefined)||_0x93cb('0x6a')},{'name':'attrFontSize','value':_0x44fa59['attrFontSize']||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x2]?_0x44fa59['attrs'][0x2][_0x93cb('0x65')]:undefined)||0xc}];case _0x93cb('0x6b'):return[{'name':_0x93cb('0x6c'),'value':_0x44fa59[_0x93cb('0x6c')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x0]?_0x44fa59[_0x93cb('0x62')][0x0]['value']:undefined)||'total'},{'name':_0x93cb('0x6d'),'value':_0x44fa59[_0x93cb('0x6d')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x1]?_0x44fa59[_0x93cb('0x62')][0x1][_0x93cb('0x65')]:undefined)||[]},{'name':'attrFontSize','value':_0x44fa59[_0x93cb('0x6e')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x2]?_0x44fa59[_0x93cb('0x62')][0x2][_0x93cb('0x65')]:undefined)||0x14},{'name':_0x93cb('0x6f'),'value':_0x44fa59[_0x93cb('0x6f')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x3]?_0x44fa59[_0x93cb('0x62')][0x3][_0x93cb('0x65')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x44fa59[_0x93cb('0x70')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x4]?_0x44fa59['attrs'][0x4][_0x93cb('0x65')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x44fa59[_0x93cb('0x71')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x5]?_0x44fa59[_0x93cb('0x62')][0x5][_0x93cb('0x65')]:undefined)||''},{'name':_0x93cb('0x72'),'value':_0x44fa59[_0x93cb('0x72')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x6]?_0x44fa59[_0x93cb('0x62')][0x6][_0x93cb('0x65')]:undefined)||''},{'name':_0x93cb('0x73'),'value':_0x44fa59[_0x93cb('0x73')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x7]?_0x44fa59[_0x93cb('0x62')][0x7][_0x93cb('0x65')]:undefined)||''},{'name':_0x93cb('0x74'),'value':_0x44fa59[_0x93cb('0x74')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x8]?_0x44fa59[_0x93cb('0x62')][0x8][_0x93cb('0x65')]:undefined)||''},{'name':_0x93cb('0x75'),'value':_0x44fa59[_0x93cb('0x75')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x9]?_0x44fa59[_0x93cb('0x62')][0x9][_0x93cb('0x65')]:undefined)||''}];case _0x93cb('0x76'):case _0x93cb('0x77'):return[{'name':_0x93cb('0x78'),'value':_0x44fa59[_0x93cb('0x78')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x0]?_0x44fa59['attrs'][0x0][_0x93cb('0x65')]:undefined)||_0x93cb('0x79')},{'name':_0x93cb('0x7a'),'value':_0x44fa59[_0x93cb('0x7a')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x1]?_0x44fa59[_0x93cb('0x62')][0x1][_0x93cb('0x65')]:undefined)||null},{'name':_0x93cb('0x7b'),'value':_0x44fa59[_0x93cb('0x7b')]||(_0x44fa59['attrs']&&_0x44fa59[_0x93cb('0x62')][0x2]?_0x44fa59['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x44fa59['attrVoiceQueues']||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x3]?_0x44fa59[_0x93cb('0x62')][0x3]['value']:undefined)||[]},{'name':_0x93cb('0x6f'),'value':_0x44fa59[_0x93cb('0x6f')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x4]?_0x44fa59[_0x93cb('0x62')][0x4][_0x93cb('0x65')]:undefined)||_0x93cb('0x7c')},{'name':_0x93cb('0x70'),'value':_0x44fa59[_0x93cb('0x70')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x5]?_0x44fa59[_0x93cb('0x62')][0x5][_0x93cb('0x65')]:undefined)||''},{'name':_0x93cb('0x71'),'value':_0x44fa59[_0x93cb('0x71')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x6]?_0x44fa59[_0x93cb('0x62')][0x6][_0x93cb('0x65')]:undefined)||''},{'name':_0x93cb('0x72'),'value':_0x44fa59['attrSmsAccounts']||(_0x44fa59['attrs']&&_0x44fa59[_0x93cb('0x62')][0x7]?_0x44fa59[_0x93cb('0x62')][0x7]['value']:undefined)||''},{'name':_0x93cb('0x73'),'value':_0x44fa59[_0x93cb('0x73')]||(_0x44fa59['attrs']&&_0x44fa59['attrs'][0x8]?_0x44fa59[_0x93cb('0x62')][0x8]['value']:undefined)||''},{'name':_0x93cb('0x74'),'value':_0x44fa59['attrWhatsappAccounts']||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x9]?_0x44fa59[_0x93cb('0x62')][0x9]['value']:undefined)||''},{'name':_0x93cb('0x75'),'value':_0x44fa59[_0x93cb('0x75')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0xa]?_0x44fa59[_0x93cb('0x62')][0xa]['value']:undefined)||''}];case _0x93cb('0x7d'):return[{'name':_0x93cb('0x7e'),'type':_0x44fa59[_0x93cb('0x7f')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x0]?_0x44fa59[_0x93cb('0x62')][0x0][_0x93cb('0x38')]:undefined)||null,'value':_0x44fa59[_0x93cb('0x7e')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59['attrs'][0x0]?_0x44fa59[_0x93cb('0x62')][0x0][_0x93cb('0x65')]:undefined)||null},{'name':_0x93cb('0x80'),'value':_0x44fa59[_0x93cb('0x80')]||(_0x44fa59[_0x93cb('0x62')]&&_0x44fa59[_0x93cb('0x62')][0x1]?_0x44fa59['attrs'][0x1][_0x93cb('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x1f3d77){logger['error']('widgetAttributes:\x20%s',JSON[_0x93cb('0x81')](_0x1f3d77));return[];}}exports[_0x93cb('0x82')]=function(_0x21a21a,_0x47c46f,_0xb8ee42){if(_0x21a21a['body']['id']){delete _0x21a21a[_0x93cb('0x5c')]['id'];}return db[_0x93cb('0x35')][_0x93cb('0x50')]({'where':{'id':_0x21a21a[_0x93cb('0x4e')]['id']}})[_0x93cb('0x29')](handleEntityNotFound(_0x47c46f,null))[_0x93cb('0x29')](function(_0x47ddb7){if(_0x47ddb7){_0x21a21a[_0x93cb('0x5c')]['DashboardId']=_0x47ddb7['id'];_0x21a21a[_0x93cb('0x5c')][_0x93cb('0x62')]=widgetAttributes(_0x21a21a['body']);return db[_0x93cb('0x83')][_0x93cb('0x52')](_0x21a21a['body']);}})['then'](respondWithResult(_0x47c46f,null))[_0x93cb('0x51')](handleError(_0x47c46f,null));};exports['getItems']=function(_0x2c9a7d,_0x325ff6,_0x5d564e){var _0x208e65={};var _0xf51848={};var _0xcbc239;var _0x14255e;return db[_0x93cb('0x35')][_0x93cb('0x84')]({'where':{'id':_0x2c9a7d[_0x93cb('0x4e')]['id']}})[_0x93cb('0x29')](handleEntityNotFound(_0x325ff6,null))['then'](function(_0x232172){if(_0x232172){_0xcbc239=_0x232172;_0xf51848['model']=_[_0x93cb('0x3c')](db['DashboardItem'][_0x93cb('0x36')]);_0xf51848[_0x93cb('0x3b')]=_['keys'](_0x2c9a7d[_0x93cb('0x3b')]);_0xf51848['filters']=_[_0x93cb('0x3e')](_0xf51848[_0x93cb('0x3a')],_0xf51848[_0x93cb('0x3b')]);_0x208e65[_0x93cb('0x40')]=_[_0x93cb('0x3e')](_0xf51848[_0x93cb('0x3a')],qs[_0x93cb('0x3f')](_0x2c9a7d[_0x93cb('0x3b')][_0x93cb('0x3f')]));_0x208e65[_0x93cb('0x40')]=_0x208e65[_0x93cb('0x40')]['length']?_0x208e65[_0x93cb('0x40')]:_0xf51848[_0x93cb('0x3a')];_0x208e65[_0x93cb('0x44')]=qs[_0x93cb('0x45')](_0x2c9a7d[_0x93cb('0x3b')][_0x93cb('0x45')]);_0x208e65['where']=qs['filters'](_[_0x93cb('0x47')](_0x2c9a7d[_0x93cb('0x3b')],_0xf51848[_0x93cb('0x3d')]));if(_0x2c9a7d[_0x93cb('0x3b')]['filter']){_0x208e65[_0x93cb('0x46')]=_[_0x93cb('0x49')](_0x208e65[_0x93cb('0x46')],{'$or':_[_0x93cb('0x34')](_0x208e65[_0x93cb('0x40')],function(_0x287594){var _0x164dbd={};_0x164dbd[_0x287594]={'$like':'%'+_0x2c9a7d[_0x93cb('0x3b')]['filter']+'%'};return _0x164dbd;})});}_0x208e65=_[_0x93cb('0x49')]({},_0x208e65,_0x2c9a7d[_0x93cb('0x4b')]);return _0xcbc239['getItems'](_0x208e65);}})[_0x93cb('0x29')](function(_0x16d5bb){if(_0x16d5bb){_0x14255e=_0x16d5bb[_0x93cb('0x41')];if(!_0x2c9a7d[_0x93cb('0x3b')][_0x93cb('0x42')](_0x93cb('0x43'))){_0x208e65[_0x93cb('0x24')]=qs[_0x93cb('0x24')](_0x2c9a7d[_0x93cb('0x3b')][_0x93cb('0x24')]);_0x208e65[_0x93cb('0x22')]=qs[_0x93cb('0x22')](_0x2c9a7d[_0x93cb('0x3b')]['offset']);}return _0xcbc239['getItems'](_0x208e65);}})['then'](function(_0x126957){if(_0x126957){return _0x126957?{'count':_0x14255e,'rows':_0x126957}:null;}})['then'](respondWithResult(_0x325ff6,null))[_0x93cb('0x51')](handleError(_0x325ff6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 50192b4..d5a46dc 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 _0x79c0=['remove','emit','hasOwnProperty','exports','events','Dashboard','setMaxListeners','save','update'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x79c0,0x82));var _0x079c=function(_0x4fe72c,_0x156f7b){_0x4fe72c=_0x4fe72c-0x0;var _0x4a6ea6=_0x79c0[_0x4fe72c];return _0x4a6ea6;};'use strict';var EventEmitter=require(_0x079c('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x079c('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x079c('0x2')](0x0);var events={'afterCreate':_0x079c('0x3'),'afterUpdate':_0x079c('0x4'),'afterDestroy':_0x079c('0x5')};function emitEvent(_0x53f551){return function(_0x8c5b44,_0x5884db,_0x215798){DashboardEvents[_0x079c('0x6')](_0x53f551+':'+_0x8c5b44['id'],_0x8c5b44);DashboardEvents[_0x079c('0x6')](_0x53f551,_0x8c5b44);_0x215798(null);};}for(var e in events){if(events[_0x079c('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x079c('0x8')]=DashboardEvents; \ No newline at end of file +var _0xeb82=['emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','remove'];(function(_0xcb9073,_0x44198b){var _0x3b1106=function(_0x3b010f){while(--_0x3b010f){_0xcb9073['push'](_0xcb9073['shift']());}};_0x3b1106(++_0x44198b);}(_0xeb82,0xdb));var _0x2eb8=function(_0x497ed4,_0x4cec57){_0x497ed4=_0x497ed4-0x0;var _0x135b8f=_0xeb82[_0x497ed4];return _0x135b8f;};'use strict';var EventEmitter=require(_0x2eb8('0x0'));var Dashboard=require(_0x2eb8('0x1'))['db'][_0x2eb8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2eb8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2eb8('0x4')};function emitEvent(_0x4066c8){return function(_0x2bc94a,_0x5cc158,_0x4a2e2b){DashboardEvents[_0x2eb8('0x5')](_0x4066c8+':'+_0x2bc94a['id'],_0x2bc94a);DashboardEvents['emit'](_0x4066c8,_0x2bc94a);_0x4a2e2b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x2eb8('0x6')](e,emitEvent(event));}}module[_0x2eb8('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 b20a12f..e108002 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 _0x7d98=['moment','request-promise','./dashboard.attributes','exports','Dashboard','lodash','../../config/logger','api'];(function(_0xe65aa7,_0x3ce76b){var _0x31ee36=function(_0x2252a1){while(--_0x2252a1){_0xe65aa7['push'](_0xe65aa7['shift']());}};_0x31ee36(++_0x3ce76b);}(_0x7d98,0x75));var _0x87d9=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0x7d98[_0xd8a8af];return _0x5b7278;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var logger=require(_0x87d9('0x1'))(_0x87d9('0x2'));var moment=require(_0x87d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x87d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x87d9('0x5'));module[_0x87d9('0x6')]=function(_0x2bc9fd,_0x23a797){return _0x2bc9fd['define'](_0x87d9('0x7'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84e6=['request-promise','path','./dashboard.attributes','exports','define','dashboards','lodash','../../config/logger','api','moment'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x84e6,0xce));var _0x684e=function(_0x50cb0a,_0x2c65d3){_0x50cb0a=_0x50cb0a-0x0;var _0x2b1085=_0x84e6[_0x50cb0a];return _0x2b1085;};'use strict';var _=require(_0x684e('0x0'));var util=require('util');var logger=require(_0x684e('0x1'))(_0x684e('0x2'));var moment=require(_0x684e('0x3'));var BPromise=require('bluebird');var rp=require(_0x684e('0x4'));var fs=require('fs');var path=require(_0x684e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x684e('0x6'));module[_0x684e('0x7')]=function(_0x27ed56,_0x27554a){return _0x27ed56[_0x684e('0x8')]('Dashboard',attributes,{'tableName':_0x684e('0x9'),'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 b9dd01e..ffd37a0 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 _0xf777=['Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboard.socket','register','request','info'];(function(_0x56fa72,_0x399e48){var _0x54ddcb=function(_0x2b4251){while(--_0x2b4251){_0x56fa72['push'](_0x56fa72['shift']());}};_0x54ddcb(++_0x399e48);}(_0xf777,0x134));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7f77('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7f77('0x1'));var fs=require('fs');var Redis=require(_0x7f77('0x2'));var db=require(_0x7f77('0x3'))['db'];var utils=require(_0x7f77('0x4'));var logger=require(_0x7f77('0x5'))(_0x7f77('0x6'));var config=require(_0x7f77('0x7'));var jayson=require(_0x7f77('0x8'));var client=jayson[_0x7f77('0x9')][_0x7f77('0xa')]({'port':0x232a});config[_0x7f77('0xb')]=_['defaults'](config[_0x7f77('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f77('0xc'))(new Redis(config['redis']));require(_0x7f77('0xd'))[_0x7f77('0xe')](socket);function respondWithRpcPromise(_0x17bce4,_0x4b7f80,_0x4ab58b){return new BPromise(function(_0x3c3bcd,_0x4b2782){return client[_0x7f77('0xf')](_0x17bce4,_0x4ab58b)['then'](function(_0x3e3e0d){logger[_0x7f77('0x10')](_0x7f77('0x11'),_0x4b7f80,'request\x20sent');logger[_0x7f77('0x12')](_0x7f77('0x13'),_0x4b7f80,_0x7f77('0x14'),JSON[_0x7f77('0x15')](_0x3e3e0d));if(_0x3e3e0d[_0x7f77('0x16')]){if(_0x3e3e0d['error']['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x4b7f80,_0x3e3e0d[_0x7f77('0x16')][_0x7f77('0x17')]);return _0x4b2782(_0x3e3e0d[_0x7f77('0x16')][_0x7f77('0x17')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x4b7f80,_0x3e3e0d[_0x7f77('0x16')][_0x7f77('0x17')]);return _0x3c3bcd(_0x3e3e0d['error'][_0x7f77('0x17')]);}else{logger[_0x7f77('0x10')](_0x7f77('0x11'),_0x4b7f80,_0x7f77('0x14'));_0x3c3bcd(_0x3e3e0d[_0x7f77('0x18')][_0x7f77('0x17')]);}})['catch'](function(_0x189005){logger[_0x7f77('0x16')](_0x7f77('0x11'),_0x4b7f80,_0x189005);_0x4b2782(_0x189005);});});} \ No newline at end of file +var _0x9f89=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0x9f89,0x1de));var _0x99f8=function(_0x4ec40b,_0x242c15){_0x4ec40b=_0x4ec40b-0x0;var _0x360697=_0x9f89[_0x4ec40b];return _0x360697;};'use strict';var _=require('lodash');var util=require(_0x99f8('0x0'));var moment=require(_0x99f8('0x1'));var BPromise=require('bluebird');var rs=require(_0x99f8('0x2'));var fs=require('fs');var Redis=require(_0x99f8('0x3'));var db=require(_0x99f8('0x4'))['db'];var utils=require(_0x99f8('0x5'));var logger=require(_0x99f8('0x6'))(_0x99f8('0x7'));var config=require('../../config/environment');var jayson=require(_0x99f8('0x8'));var client=jayson['client'][_0x99f8('0x9')]({'port':0x232a});config['redis']=_[_0x99f8('0xa')](config[_0x99f8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x99f8('0xc'))(new Redis(config[_0x99f8('0xb')]));require('./dashboard.socket')[_0x99f8('0xd')](socket);function respondWithRpcPromise(_0x45a08b,_0x4dc6f3,_0x33199e){return new BPromise(function(_0x200179,_0x35b998){return client[_0x99f8('0xe')](_0x45a08b,_0x33199e)[_0x99f8('0xf')](function(_0x5f1043){logger[_0x99f8('0x10')](_0x99f8('0x11'),_0x4dc6f3,_0x99f8('0x12'));logger[_0x99f8('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4dc6f3,_0x99f8('0x12'),JSON['stringify'](_0x5f1043));if(_0x5f1043[_0x99f8('0x14')]){if(_0x5f1043['error'][_0x99f8('0x15')]===0x1f4){logger[_0x99f8('0x14')](_0x99f8('0x11'),_0x4dc6f3,_0x5f1043['error'][_0x99f8('0x16')]);return _0x35b998(_0x5f1043[_0x99f8('0x14')][_0x99f8('0x16')]);}logger[_0x99f8('0x14')]('Dashboard,\x20%s,\x20%s',_0x4dc6f3,_0x5f1043[_0x99f8('0x14')][_0x99f8('0x16')]);return _0x200179(_0x5f1043[_0x99f8('0x14')][_0x99f8('0x16')]);}else{logger[_0x99f8('0x10')](_0x99f8('0x11'),_0x4dc6f3,'request\x20sent');_0x200179(_0x5f1043[_0x99f8('0x17')][_0x99f8('0x16')]);}})[_0x99f8('0x18')](function(_0x3f346f){logger[_0x99f8('0x14')](_0x99f8('0x11'),_0x4dc6f3,_0x3f346f);_0x35b998(_0x3f346f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ee07dce..67cd9d9 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 _0xf40a=['remove','update','removeListener','register','length','dashboard:','save'];(function(_0x313100,_0x2a625e){var _0x415164=function(_0xe6ee84){while(--_0xe6ee84){_0x313100['push'](_0x313100['shift']());}};_0x415164(++_0x2a625e);}(_0xf40a,0x1b8));var _0xaf40=function(_0x1bfc72,_0x45f543){_0x1bfc72=_0x1bfc72-0x0;var _0x575ab3=_0xf40a[_0x1bfc72];return _0x575ab3;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xaf40('0x0'),_0xaf40('0x1'),_0xaf40('0x2')];function createListener(_0x1d69a9,_0x4e7e21){return function(_0xd24a2d){_0x4e7e21['emit'](_0x1d69a9,_0xd24a2d);};}function removeListener(_0x4c6a02,_0x505f86){return function(){DashboardEvents[_0xaf40('0x3')](_0x4c6a02,_0x505f86);};}exports[_0xaf40('0x4')]=function(_0x1f256c){for(var _0xa3a854=0x0,_0x4f1e9a=events[_0xaf40('0x5')];_0xa3a854<_0x4f1e9a;_0xa3a854++){var _0x3f6104=events[_0xa3a854];var _0x196a2f=createListener(_0xaf40('0x6')+_0x3f6104,_0x1f256c);DashboardEvents['on'](_0x3f6104,_0x196a2f);}}; \ No newline at end of file +var _0xc282=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x2e3ba3,_0x53b37f){var _0x3e6ecc=function(_0x1882d6){while(--_0x1882d6){_0x2e3ba3['push'](_0x2e3ba3['shift']());}};_0x3e6ecc(++_0x53b37f);}(_0xc282,0x1ee));var _0x2c28=function(_0x3aeff6,_0x1360b3){_0x3aeff6=_0x3aeff6-0x0;var _0x1fa6d5=_0xc282[_0x3aeff6];return _0x1fa6d5;};'use strict';var DashboardEvents=require(_0x2c28('0x0'));var events=[_0x2c28('0x1'),'remove',_0x2c28('0x2')];function createListener(_0x1925a3,_0x24384f){return function(_0x1eff08){_0x24384f[_0x2c28('0x3')](_0x1925a3,_0x1eff08);};}function removeListener(_0x155d0a,_0x3c9a33){return function(){DashboardEvents[_0x2c28('0x4')](_0x155d0a,_0x3c9a33);};}exports[_0x2c28('0x5')]=function(_0x36de75){for(var _0x5e86a5=0x0,_0x2c5d13=events[_0x2c28('0x6')];_0x5e86a5<_0x2c5d13;_0x5e86a5++){var _0x34894d=events[_0x5e86a5];var _0x231c94=createListener(_0x2c28('0x7')+_0x34894d,_0x36de75);DashboardEvents['on'](_0x34894d,_0x231c94);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d7bdb30..d22d9e5 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 _0x994e=['/:id/items','getItems','post','create','/:id/clone','clone','addItem','delete','/:id','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show'];(function(_0x145c0d,_0x2f3411){var _0x15f33f=function(_0x5dab90){while(--_0x5dab90){_0x145c0d['push'](_0x145c0d['shift']());}};_0x15f33f(++_0x2f3411);}(_0x994e,0x1ee));var _0xe994=function(_0x3ef844,_0x5a3e25){_0x3ef844=_0x3ef844-0x0;var _0x5858d4=_0x994e[_0x3ef844];return _0x5858d4;};'use strict';var multer=require('multer');var util=require(_0xe994('0x0'));var path=require(_0xe994('0x1'));var timeout=require(_0xe994('0x2'));var express=require(_0xe994('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe994('0x4'));var interaction=require(_0xe994('0x5'));var config=require(_0xe994('0x6'));var controller=require(_0xe994('0x7'));router[_0xe994('0x8')]('/',auth[_0xe994('0x9')](),controller[_0xe994('0xa')]);router['get']('/:id',auth[_0xe994('0x9')](),controller[_0xe994('0xb')]);router[_0xe994('0x8')](_0xe994('0xc'),auth[_0xe994('0x9')](),controller[_0xe994('0xd')]);router[_0xe994('0xe')]('/',auth['isAuthenticated'](),controller[_0xe994('0xf')]);router[_0xe994('0xe')](_0xe994('0x10'),auth[_0xe994('0x9')](),controller[_0xe994('0x11')]);router['post'](_0xe994('0xc'),auth[_0xe994('0x9')](),controller[_0xe994('0x12')]);router['put']('/:id',auth[_0xe994('0x9')](),controller['update']);router[_0xe994('0x13')](_0xe994('0x14'),auth[_0xe994('0x9')](),controller[_0xe994('0x15')]);module[_0xe994('0x16')]=router; \ No newline at end of file +var _0xe324=['../../config/environment','./dashboard.controller','get','isAuthenticated','show','post','create','/:id/clone','clone','/:id/items','addItem','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x3681a4,_0x1c4e60){var _0x10ce49=function(_0x590f61){while(--_0x590f61){_0x3681a4['push'](_0x3681a4['shift']());}};_0x10ce49(++_0x1c4e60);}(_0xe324,0x186));var _0x4e32=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0xe324[_0x31b5b2];return _0x364f13;};'use strict';var multer=require(_0x4e32('0x0'));var util=require(_0x4e32('0x1'));var path=require(_0x4e32('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e32('0x3')]();var fs_extra=require(_0x4e32('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4e32('0x5'));var config=require(_0x4e32('0x6'));var controller=require(_0x4e32('0x7'));router[_0x4e32('0x8')]('/',auth[_0x4e32('0x9')](),controller['index']);router[_0x4e32('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4e32('0xa')]);router[_0x4e32('0x8')]('/:id/items',auth[_0x4e32('0x9')](),controller['getItems']);router[_0x4e32('0xb')]('/',auth[_0x4e32('0x9')](),controller[_0x4e32('0xc')]);router[_0x4e32('0xb')](_0x4e32('0xd'),auth[_0x4e32('0x9')](),controller[_0x4e32('0xe')]);router['post'](_0x4e32('0xf'),auth[_0x4e32('0x9')](),controller[_0x4e32('0x10')]);router[_0x4e32('0x11')](_0x4e32('0x12'),auth[_0x4e32('0x9')](),controller[_0x4e32('0x13')]);router[_0x4e32('0x14')](_0x4e32('0x12'),auth[_0x4e32('0x9')](),controller['destroy']);module[_0x4e32('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 7c4f336..3efaafe 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 _0x5d58=['attrs','stringify','INTEGER','#2196f3','STRING','TEXT','parse','getDataValue','setDataValue'];(function(_0x19635f,_0x564859){var _0x482132=function(_0x177ea7){while(--_0x177ea7){_0x19635f['push'](_0x19635f['shift']());}};_0x482132(++_0x564859);}(_0x5d58,0x187));var _0x85d5=function(_0x1ae54d,_0x18c53b){_0x1ae54d=_0x1ae54d-0x0;var _0x8ccfb2=_0x5d58[_0x1ae54d];return _0x8ccfb2;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x85d5('0x0')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x85d5('0x1')]('long'),'get':function(){try{return JSON[_0x85d5('0x2')](this[_0x85d5('0x3')]('attrs'));}catch(_0x1eb211){return[];}},'set':function(_0x2d457a){try{this[_0x85d5('0x4')](_0x85d5('0x5'),JSON['stringify'](_0x2d457a));}catch(_0x98c963){this[_0x85d5('0x4')]('attrs',JSON[_0x85d5('0x6')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x85d5('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x85d5('0x7')]},'col':{'type':Sequelize[_0x85d5('0x7')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85d5('0x8'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x85d5('0x0')]},'titleFontSize':{'type':Sequelize[_0x85d5('0x7')],'defaultValue':0xc}}; \ No newline at end of file +var _0xeda8=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','#ffffff','sequelize','squel','exports','STRING'];(function(_0x418330,_0x4c8c2d){var _0x503c9a=function(_0x33ce45){while(--_0x33ce45){_0x418330['push'](_0x418330['shift']());}};_0x503c9a(++_0x4c8c2d);}(_0xeda8,0x104));var _0x8eda=function(_0x1e78ad,_0x39baa8){_0x1e78ad=_0x1e78ad-0x0;var _0x402648=_0xeda8[_0x1e78ad];return _0x402648;};'use strict';var Sequelize=require(_0x8eda('0x0'));var squel=require(_0x8eda('0x1'));var _=require('lodash');module[_0x8eda('0x2')]={'title':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eda('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8eda('0x4')](_0x8eda('0x5')),'get':function(){try{return JSON[_0x8eda('0x6')](this[_0x8eda('0x7')](_0x8eda('0x8')));}catch(_0x22dee9){return[];}},'set':function(_0x1f3556){try{this[_0x8eda('0x9')](_0x8eda('0x8'),JSON['stringify'](_0x1f3556));}catch(_0x28b721){this[_0x8eda('0x9')](_0x8eda('0x8'),JSON[_0x8eda('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':_0x8eda('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eda('0x3')]},'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 0b50a6a..8dffc37 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 _0x16d8=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','show','params','model','keys','query','intersection','attributes','fields','length','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end'];(function(_0x909dfe,_0x36e38a){var _0x5cb58f=function(_0x3f3000){while(--_0x3f3000){_0x909dfe['push'](_0x909dfe['shift']());}};_0x5cb58f(++_0x36e38a);}(_0x16d8,0xa3));var _0x816d=function(_0x291957,_0xac2331){_0x291957=_0x291957-0x0;var _0x319381=_0x16d8[_0x291957];return _0x319381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x816d('0x0'));var zipdir=require(_0x816d('0x1'));var jsonpatch=require(_0x816d('0x2'));var rp=require(_0x816d('0x3'));var moment=require(_0x816d('0x4'));var BPromise=require(_0x816d('0x5'));var Mustache=require(_0x816d('0x6'));var util=require(_0x816d('0x7'));var path=require(_0x816d('0x8'));var sox=require('sox');var csv=require(_0x816d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x816d('0xa'));var _=require(_0x816d('0xb'));var squel=require(_0x816d('0xc'));var crypto=require(_0x816d('0xd'));var jsforce=require(_0x816d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x816d('0x9'));var querystring=require(_0x816d('0xf'));var Papa=require(_0x816d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x816d('0x11'));var hardwareService=require(_0x816d('0x12'));var logger=require(_0x816d('0x13'))(_0x816d('0x14'));var utils=require('../../config/utils');var config=require(_0x816d('0x15'));var licenseUtil=require(_0x816d('0x16'));var db=require(_0x816d('0x17'))['db'];config['redis']=_[_0x816d('0x18')](config[_0x816d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x816d('0x1a'))(new Redis(config[_0x816d('0x19')]));require('./dashboardItem.socket')[_0x816d('0x1b')](socket);function respondWithStatusCode(_0x3a50c8,_0x4e2aa9){_0x4e2aa9=_0x4e2aa9||0xcc;return function(_0x1225c4){if(_0x1225c4){return _0x3a50c8[_0x816d('0x1c')](_0x4e2aa9);}return _0x3a50c8[_0x816d('0x1d')](_0x4e2aa9)[_0x816d('0x1e')]();};}function respondWithResult(_0x61942,_0x212d20){_0x212d20=_0x212d20||0xc8;return function(_0x63847c){if(_0x63847c){return _0x61942[_0x816d('0x1d')](_0x212d20)[_0x816d('0x1f')](_0x63847c);}};}function respondWithFilteredResult(_0x525c3b,_0x33e94c){return function(_0x2cee1c){if(_0x2cee1c){var _0x175e6d=typeof _0x33e94c['offset']===_0x816d('0x20')&&typeof _0x33e94c[_0x816d('0x21')]===_0x816d('0x20');var _0x8bea23=_0x2cee1c[_0x816d('0x22')];var _0x46011d=_0x175e6d?0x0:_0x33e94c['offset'];var _0x40455e=_0x175e6d?_0x2cee1c[_0x816d('0x22')]:_0x33e94c[_0x816d('0x23')]+_0x33e94c[_0x816d('0x21')];var _0x128865;if(_0x40455e>=_0x8bea23){_0x40455e=_0x8bea23;_0x128865=0xc8;}else{_0x128865=0xce;}_0x525c3b[_0x816d('0x1d')](_0x128865);return _0x525c3b[_0x816d('0x24')](_0x816d('0x25'),_0x46011d+'-'+_0x40455e+'/'+_0x8bea23)['json'](_0x2cee1c);}return null;};}function patchUpdates(_0x430009){return function(_0x546944){try{jsonpatch[_0x816d('0x26')](_0x546944,_0x430009,!![]);}catch(_0x2d4ff2){return BPromise[_0x816d('0x27')](_0x2d4ff2);}return _0x546944[_0x816d('0x28')]();};}function saveUpdates(_0x1cf6db,_0x2bdc60){return function(_0x38edc8){if(_0x38edc8){return _0x38edc8[_0x816d('0x29')](_0x1cf6db)[_0x816d('0x2a')](function(_0x3d4410){return _0x3d4410;});}return null;};}function removeEntity(_0x2d2d98,_0xf79dfd){return function(_0x32f944){if(_0x32f944){return _0x32f944[_0x816d('0x2b')]()[_0x816d('0x2a')](function(){_0x2d2d98[_0x816d('0x1d')](0xcc)[_0x816d('0x1e')]();});}};}function handleEntityNotFound(_0x579edb,_0x39247a){return function(_0x6a4acd){if(!_0x6a4acd){_0x579edb[_0x816d('0x1c')](0x194);}return _0x6a4acd;};}function handleError(_0x349486,_0x25d4b5){_0x25d4b5=_0x25d4b5||0x1f4;return function(_0x54c775){logger['error'](_0x54c775['stack']);if(_0x54c775[_0x816d('0x2c')]){delete _0x54c775[_0x816d('0x2c')];}_0x349486[_0x816d('0x1d')](_0x25d4b5)['send'](_0x54c775);};}exports[_0x816d('0x2d')]=function(_0x72a543,_0x30bba2){var _0x510a6={'raw':![],'where':{'id':_0x72a543[_0x816d('0x2e')]['id']}},_0x548734={};_0x548734[_0x816d('0x2f')]=_[_0x816d('0x30')](db['DashboardItem']['rawAttributes']);_0x548734['query']=_['keys'](_0x72a543[_0x816d('0x31')]);_0x548734['filters']=_[_0x816d('0x32')](_0x548734[_0x816d('0x2f')],_0x548734[_0x816d('0x31')]);_0x510a6[_0x816d('0x33')]=_[_0x816d('0x32')](_0x548734['model'],qs['fields'](_0x72a543[_0x816d('0x31')][_0x816d('0x34')]));_0x510a6[_0x816d('0x33')]=_0x510a6['attributes'][_0x816d('0x35')]?_0x510a6[_0x816d('0x33')]:_0x548734[_0x816d('0x2f')];if(_0x72a543[_0x816d('0x31')]['includeAll']){_0x510a6[_0x816d('0x36')]=[{'all':!![]}];}_0x510a6=_[_0x816d('0x37')]({},_0x510a6,_0x72a543[_0x816d('0x38')]);return db[_0x816d('0x39')][_0x816d('0x3a')](_0x510a6)['then'](handleEntityNotFound(_0x30bba2,null))[_0x816d('0x2a')](respondWithResult(_0x30bba2,null))[_0x816d('0x3b')](handleError(_0x30bba2,null));};exports[_0x816d('0x2b')]=function(_0x15bf0e,_0x2c4711){return db[_0x816d('0x39')][_0x816d('0x3a')]({'where':{'id':_0x15bf0e['params']['id']}})[_0x816d('0x2a')](handleEntityNotFound(_0x2c4711,null))[_0x816d('0x2a')](removeEntity(_0x2c4711,null))[_0x816d('0x3b')](handleError(_0x2c4711,null));};function widgetAttributes(_0x3e1adf){try{switch(_0x3e1adf[_0x816d('0x3c')]){case _0x816d('0x3d'):return[{'name':_0x816d('0x3e'),'value':_0x3e1adf[_0x816d('0x3e')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf['attrs'][0x0]?_0x3e1adf[_0x816d('0x3f')][0x0][_0x816d('0x40')]:undefined)||_0x816d('0x41')}];case _0x816d('0x42'):return[{'name':'attrPath','value':_0x3e1adf[_0x816d('0x43')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x0]?_0x3e1adf[_0x816d('0x3f')][0x0][_0x816d('0x40')]:undefined)||''}];case _0x816d('0x44'):return[{'name':_0x816d('0x45'),'value':_0x3e1adf[_0x816d('0x45')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x0]?_0x3e1adf['attrs'][0x0]['value']:undefined)||_0x816d('0x46')},{'name':_0x816d('0x47'),'value':_0x3e1adf[_0x816d('0x47')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x1]?_0x3e1adf[_0x816d('0x3f')][0x1][_0x816d('0x40')]:undefined)||_0x816d('0x48')},{'name':'attrFontSize','value':_0x3e1adf['attrFontSize']||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x2]?_0x3e1adf[_0x816d('0x3f')][0x2][_0x816d('0x40')]:undefined)||0xc}];case _0x816d('0x49'):return[{'name':_0x816d('0x4a'),'value':_0x3e1adf[_0x816d('0x4a')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x0]?_0x3e1adf[_0x816d('0x3f')][0x0][_0x816d('0x40')]:undefined)||_0x816d('0x4b')},{'name':_0x816d('0x4c'),'value':_0x3e1adf[_0x816d('0x4c')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x1]?_0x3e1adf[_0x816d('0x3f')][0x1][_0x816d('0x40')]:undefined)||[]},{'name':_0x816d('0x4d'),'value':_0x3e1adf[_0x816d('0x4d')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x2]?_0x3e1adf[_0x816d('0x3f')][0x2][_0x816d('0x40')]:undefined)||0x14},{'name':_0x816d('0x4e'),'value':_0x3e1adf['attrChannel']||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x3]?_0x3e1adf['attrs'][0x3]['value']:undefined)||_0x816d('0x4f')},{'name':'attrEmailAccounts','value':_0x3e1adf[_0x816d('0x50')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x4]?_0x3e1adf[_0x816d('0x3f')][0x4][_0x816d('0x40')]:undefined)||''},{'name':_0x816d('0x51'),'value':_0x3e1adf['attrFaxAccounts']||(_0x3e1adf['attrs']&&_0x3e1adf['attrs'][0x5]?_0x3e1adf['attrs'][0x5][_0x816d('0x40')]:undefined)||''},{'name':_0x816d('0x52'),'value':_0x3e1adf['attrSmsAccounts']||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf['attrs'][0x6]?_0x3e1adf[_0x816d('0x3f')][0x6][_0x816d('0x40')]:undefined)||''},{'name':_0x816d('0x53'),'value':_0x3e1adf[_0x816d('0x53')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x7]?_0x3e1adf[_0x816d('0x3f')][0x7][_0x816d('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3e1adf['attrWhatsappAccounts']||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x8]?_0x3e1adf[_0x816d('0x3f')][0x8][_0x816d('0x40')]:undefined)||''},{'name':_0x816d('0x54'),'value':_0x3e1adf['attrChatWebsites']||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf['attrs'][0x9]?_0x3e1adf[_0x816d('0x3f')][0x9][_0x816d('0x40')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x3e1adf[_0x816d('0x55')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf['attrs'][0x0]?_0x3e1adf[_0x816d('0x3f')][0x0][_0x816d('0x40')]:undefined)||_0x816d('0x4b')},{'name':_0x816d('0x56'),'value':_0x3e1adf[_0x816d('0x56')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x1]?_0x3e1adf[_0x816d('0x3f')][0x1][_0x816d('0x40')]:undefined)||null},{'name':'attrSerie3','value':_0x3e1adf[_0x816d('0x57')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x2]?_0x3e1adf['attrs'][0x2]['value']:undefined)||null},{'name':_0x816d('0x4c'),'value':_0x3e1adf[_0x816d('0x4c')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x3]?_0x3e1adf[_0x816d('0x3f')][0x3][_0x816d('0x40')]:undefined)||[]},{'name':_0x816d('0x4e'),'value':_0x3e1adf[_0x816d('0x4e')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x4]?_0x3e1adf[_0x816d('0x3f')][0x4][_0x816d('0x40')]:undefined)||'voice'},{'name':_0x816d('0x50'),'value':_0x3e1adf[_0x816d('0x50')]||(_0x3e1adf['attrs']&&_0x3e1adf['attrs'][0x5]?_0x3e1adf[_0x816d('0x3f')][0x5][_0x816d('0x40')]:undefined)||''},{'name':_0x816d('0x51'),'value':_0x3e1adf[_0x816d('0x51')]||(_0x3e1adf['attrs']&&_0x3e1adf[_0x816d('0x3f')][0x6]?_0x3e1adf[_0x816d('0x3f')][0x6][_0x816d('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3e1adf[_0x816d('0x52')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf['attrs'][0x7]?_0x3e1adf[_0x816d('0x3f')][0x7][_0x816d('0x40')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3e1adf[_0x816d('0x53')]||(_0x3e1adf['attrs']&&_0x3e1adf['attrs'][0x8]?_0x3e1adf['attrs'][0x8]['value']:undefined)||''},{'name':_0x816d('0x58'),'value':_0x3e1adf[_0x816d('0x58')]||(_0x3e1adf['attrs']&&_0x3e1adf[_0x816d('0x3f')][0x9]?_0x3e1adf[_0x816d('0x3f')][0x9][_0x816d('0x40')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3e1adf[_0x816d('0x54')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0xa]?_0x3e1adf[_0x816d('0x3f')][0xa]['value']:undefined)||''}];case _0x816d('0x59'):return[{'name':_0x816d('0x5a'),'type':_0x3e1adf[_0x816d('0x5b')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x0]?_0x3e1adf[_0x816d('0x3f')][0x0][_0x816d('0x3c')]:undefined)||null,'value':_0x3e1adf[_0x816d('0x5a')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x0]?_0x3e1adf[_0x816d('0x3f')][0x0][_0x816d('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x3e1adf[_0x816d('0x5c')]||(_0x3e1adf[_0x816d('0x3f')]&&_0x3e1adf[_0x816d('0x3f')][0x1]?_0x3e1adf['attrs'][0x1][_0x816d('0x40')]:undefined)||0x0}];default:return[];}}catch(_0xb5b5d6){logger[_0x816d('0x5d')](_0x816d('0x5e'),JSON['stringify'](_0xb5b5d6));return[];}}exports[_0x816d('0x5f')]=function(_0x2764a2,_0x331e10){if(_0x2764a2[_0x816d('0x60')]){_0x2764a2[_0x816d('0x60')]['attrs']=widgetAttributes(_0x2764a2['body']);}return db[_0x816d('0x39')][_0x816d('0x5f')](_0x2764a2[_0x816d('0x60')],{})[_0x816d('0x2a')](respondWithResult(_0x331e10,0xc9))[_0x816d('0x3b')](handleError(_0x331e10,null));};exports[_0x816d('0x29')]=function(_0x5513ad,_0x483046){if(_0x5513ad['body']['id']){delete _0x5513ad[_0x816d('0x60')]['id'];}_0x5513ad[_0x816d('0x60')][_0x816d('0x3f')]=widgetAttributes(_0x5513ad[_0x816d('0x60')]);return db[_0x816d('0x39')]['find']({'where':{'id':_0x5513ad['params']['id']}})[_0x816d('0x2a')](handleEntityNotFound(_0x483046,null))[_0x816d('0x2a')](saveUpdates(_0x5513ad[_0x816d('0x60')],null))[_0x816d('0x2a')](respondWithResult(_0x483046,null))[_0x816d('0x3b')](handleError(_0x483046,null));}; \ No newline at end of file +var _0x4453=['destroy','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','catch','find','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrEmailAccounts','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then'];(function(_0x2db59f,_0x236c36){var _0x8e74b8=function(_0x230da4){while(--_0x230da4){_0x2db59f['push'](_0x2db59f['shift']());}};_0x8e74b8(++_0x236c36);}(_0x4453,0x9c));var _0x3445=function(_0x37b70d,_0x5baefe){_0x37b70d=_0x37b70d-0x0;var _0x203963=_0x4453[_0x37b70d];return _0x203963;};'use strict';var emlformat=require(_0x3445('0x0'));var rimraf=require(_0x3445('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3445('0x2'));var rp=require(_0x3445('0x3'));var moment=require('moment');var BPromise=require(_0x3445('0x4'));var Mustache=require(_0x3445('0x5'));var util=require(_0x3445('0x6'));var path=require(_0x3445('0x7'));var sox=require(_0x3445('0x8'));var csv=require(_0x3445('0x9'));var ejs=require(_0x3445('0xa'));var fs=require('fs');var fs_extra=require(_0x3445('0xb'));var _=require(_0x3445('0xc'));var squel=require(_0x3445('0xd'));var crypto=require('crypto');var jsforce=require(_0x3445('0xe'));var deskjs=require(_0x3445('0xf'));var toCsv=require(_0x3445('0x9'));var querystring=require(_0x3445('0x10'));var Papa=require(_0x3445('0x11'));var Redis=require(_0x3445('0x12'));var authService=require(_0x3445('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3445('0x14'));var hardwareService=require(_0x3445('0x15'));var logger=require(_0x3445('0x16'))(_0x3445('0x17'));var utils=require('../../config/utils');var config=require(_0x3445('0x18'));var licenseUtil=require(_0x3445('0x19'));var db=require(_0x3445('0x1a'))['db'];config[_0x3445('0x1b')]=_[_0x3445('0x1c')](config[_0x3445('0x1b')],{'host':_0x3445('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3445('0x1e'))['register'](socket);function respondWithStatusCode(_0x23dfc8,_0x548da1){_0x548da1=_0x548da1||0xcc;return function(_0x357816){if(_0x357816){return _0x23dfc8[_0x3445('0x1f')](_0x548da1);}return _0x23dfc8[_0x3445('0x20')](_0x548da1)[_0x3445('0x21')]();};}function respondWithResult(_0x19ecee,_0x31b439){_0x31b439=_0x31b439||0xc8;return function(_0x43cb10){if(_0x43cb10){return _0x19ecee['status'](_0x31b439)[_0x3445('0x22')](_0x43cb10);}};}function respondWithFilteredResult(_0x426fbf,_0x4ba35d){return function(_0x26ea84){if(_0x26ea84){var _0x3948bd=typeof _0x4ba35d[_0x3445('0x23')]===_0x3445('0x24')&&typeof _0x4ba35d[_0x3445('0x25')]===_0x3445('0x24');var _0x21caef=_0x26ea84[_0x3445('0x26')];var _0x3129a4=_0x3948bd?0x0:_0x4ba35d['offset'];var _0x3bea2b=_0x3948bd?_0x26ea84[_0x3445('0x26')]:_0x4ba35d[_0x3445('0x23')]+_0x4ba35d['limit'];var _0x5e0ddc;if(_0x3bea2b>=_0x21caef){_0x3bea2b=_0x21caef;_0x5e0ddc=0xc8;}else{_0x5e0ddc=0xce;}_0x426fbf[_0x3445('0x20')](_0x5e0ddc);return _0x426fbf[_0x3445('0x27')](_0x3445('0x28'),_0x3129a4+'-'+_0x3bea2b+'/'+_0x21caef)['json'](_0x26ea84);}return null;};}function patchUpdates(_0x28b943){return function(_0x3d33e8){try{jsonpatch['apply'](_0x3d33e8,_0x28b943,!![]);}catch(_0x24b7d5){return BPromise['reject'](_0x24b7d5);}return _0x3d33e8[_0x3445('0x29')]();};}function saveUpdates(_0x5718f2,_0x400446){return function(_0x4c71c1){if(_0x4c71c1){return _0x4c71c1[_0x3445('0x2a')](_0x5718f2)[_0x3445('0x2b')](function(_0x10bfe8){return _0x10bfe8;});}return null;};}function removeEntity(_0xece9b6,_0x4d790c){return function(_0xdafe1f){if(_0xdafe1f){return _0xdafe1f[_0x3445('0x2c')]()[_0x3445('0x2b')](function(){_0xece9b6[_0x3445('0x20')](0xcc)[_0x3445('0x21')]();});}};}function handleEntityNotFound(_0x3e53e8,_0x5beb2e){return function(_0x554b66){if(!_0x554b66){_0x3e53e8[_0x3445('0x1f')](0x194);}return _0x554b66;};}function handleError(_0x435e1a,_0x4c318a){_0x4c318a=_0x4c318a||0x1f4;return function(_0x247083){logger[_0x3445('0x2d')](_0x247083[_0x3445('0x2e')]);if(_0x247083[_0x3445('0x2f')]){delete _0x247083['name'];}_0x435e1a[_0x3445('0x20')](_0x4c318a)[_0x3445('0x30')](_0x247083);};}exports[_0x3445('0x31')]=function(_0x4e159d,_0x3ba93e){var _0x22da06={'raw':![],'where':{'id':_0x4e159d['params']['id']}},_0xa1c95b={};_0xa1c95b[_0x3445('0x32')]=_[_0x3445('0x33')](db[_0x3445('0x34')][_0x3445('0x35')]);_0xa1c95b['query']=_['keys'](_0x4e159d[_0x3445('0x36')]);_0xa1c95b['filters']=_[_0x3445('0x37')](_0xa1c95b['model'],_0xa1c95b[_0x3445('0x36')]);_0x22da06[_0x3445('0x38')]=_[_0x3445('0x37')](_0xa1c95b[_0x3445('0x32')],qs[_0x3445('0x39')](_0x4e159d[_0x3445('0x36')][_0x3445('0x39')]));_0x22da06['attributes']=_0x22da06['attributes'][_0x3445('0x3a')]?_0x22da06['attributes']:_0xa1c95b[_0x3445('0x32')];if(_0x4e159d['query'][_0x3445('0x3b')]){_0x22da06[_0x3445('0x3c')]=[{'all':!![]}];}_0x22da06=_[_0x3445('0x3d')]({},_0x22da06,_0x4e159d['options']);return db[_0x3445('0x34')]['find'](_0x22da06)['then'](handleEntityNotFound(_0x3ba93e,null))[_0x3445('0x2b')](respondWithResult(_0x3ba93e,null))[_0x3445('0x3e')](handleError(_0x3ba93e,null));};exports[_0x3445('0x2c')]=function(_0x20ccf6,_0xe625f2){return db[_0x3445('0x34')][_0x3445('0x3f')]({'where':{'id':_0x20ccf6[_0x3445('0x40')]['id']}})[_0x3445('0x2b')](handleEntityNotFound(_0xe625f2,null))[_0x3445('0x2b')](removeEntity(_0xe625f2,null))[_0x3445('0x3e')](handleError(_0xe625f2,null));};function widgetAttributes(_0x2ec660){try{switch(_0x2ec660[_0x3445('0x41')]){case _0x3445('0x42'):return[{'name':_0x3445('0x43'),'value':_0x2ec660[_0x3445('0x43')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x0]?_0x2ec660[_0x3445('0x44')][0x0][_0x3445('0x45')]:undefined)||_0x3445('0x46')}];case _0x3445('0x47'):return[{'name':_0x3445('0x48'),'value':_0x2ec660[_0x3445('0x48')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x0]?_0x2ec660['attrs'][0x0][_0x3445('0x45')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x2ec660[_0x3445('0x49')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x0]?_0x2ec660[_0x3445('0x44')][0x0]['value']:undefined)||_0x3445('0x4a')},{'name':_0x3445('0x4b'),'value':_0x2ec660[_0x3445('0x4b')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x1]?_0x2ec660[_0x3445('0x44')][0x1][_0x3445('0x45')]:undefined)||'0.00'},{'name':_0x3445('0x4c'),'value':_0x2ec660[_0x3445('0x4c')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660['attrs'][0x2]?_0x2ec660[_0x3445('0x44')][0x2][_0x3445('0x45')]:undefined)||0xc}];case _0x3445('0x4d'):return[{'name':_0x3445('0x4e'),'value':_0x2ec660['attrMetric']||(_0x2ec660['attrs']&&_0x2ec660[_0x3445('0x44')][0x0]?_0x2ec660['attrs'][0x0][_0x3445('0x45')]:undefined)||'total'},{'name':_0x3445('0x4f'),'value':_0x2ec660[_0x3445('0x4f')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x1]?_0x2ec660[_0x3445('0x44')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x2ec660[_0x3445('0x4c')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x2]?_0x2ec660[_0x3445('0x44')][0x2]['value']:undefined)||0x14},{'name':_0x3445('0x50'),'value':_0x2ec660[_0x3445('0x50')]||(_0x2ec660['attrs']&&_0x2ec660[_0x3445('0x44')][0x3]?_0x2ec660[_0x3445('0x44')][0x3][_0x3445('0x45')]:undefined)||_0x3445('0x51')},{'name':'attrEmailAccounts','value':_0x2ec660['attrEmailAccounts']||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x4]?_0x2ec660[_0x3445('0x44')][0x4][_0x3445('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2ec660[_0x3445('0x52')]||(_0x2ec660['attrs']&&_0x2ec660[_0x3445('0x44')][0x5]?_0x2ec660['attrs'][0x5][_0x3445('0x45')]:undefined)||''},{'name':_0x3445('0x53'),'value':_0x2ec660['attrSmsAccounts']||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x6]?_0x2ec660[_0x3445('0x44')][0x6][_0x3445('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2ec660['attrOpenchannelAccounts']||(_0x2ec660['attrs']&&_0x2ec660[_0x3445('0x44')][0x7]?_0x2ec660[_0x3445('0x44')][0x7][_0x3445('0x45')]:undefined)||''},{'name':_0x3445('0x54'),'value':_0x2ec660[_0x3445('0x54')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x8]?_0x2ec660[_0x3445('0x44')][0x8][_0x3445('0x45')]:undefined)||''},{'name':_0x3445('0x55'),'value':_0x2ec660[_0x3445('0x55')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x9]?_0x2ec660['attrs'][0x9][_0x3445('0x45')]:undefined)||''}];case _0x3445('0x56'):case'pie-chart':return[{'name':_0x3445('0x57'),'value':_0x2ec660[_0x3445('0x57')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x0]?_0x2ec660['attrs'][0x0][_0x3445('0x45')]:undefined)||_0x3445('0x58')},{'name':'attrSerie2','value':_0x2ec660[_0x3445('0x59')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x1]?_0x2ec660[_0x3445('0x44')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2ec660[_0x3445('0x5a')]||(_0x2ec660['attrs']&&_0x2ec660[_0x3445('0x44')][0x2]?_0x2ec660[_0x3445('0x44')][0x2][_0x3445('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2ec660[_0x3445('0x4f')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x3]?_0x2ec660[_0x3445('0x44')][0x3][_0x3445('0x45')]:undefined)||[]},{'name':_0x3445('0x50'),'value':_0x2ec660['attrChannel']||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x4]?_0x2ec660[_0x3445('0x44')][0x4][_0x3445('0x45')]:undefined)||_0x3445('0x51')},{'name':_0x3445('0x5b'),'value':_0x2ec660[_0x3445('0x5b')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x5]?_0x2ec660[_0x3445('0x44')][0x5][_0x3445('0x45')]:undefined)||''},{'name':_0x3445('0x52'),'value':_0x2ec660[_0x3445('0x52')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x6]?_0x2ec660['attrs'][0x6][_0x3445('0x45')]:undefined)||''},{'name':_0x3445('0x53'),'value':_0x2ec660[_0x3445('0x53')]||(_0x2ec660['attrs']&&_0x2ec660['attrs'][0x7]?_0x2ec660[_0x3445('0x44')][0x7][_0x3445('0x45')]:undefined)||''},{'name':_0x3445('0x5c'),'value':_0x2ec660['attrOpenchannelAccounts']||(_0x2ec660['attrs']&&_0x2ec660[_0x3445('0x44')][0x8]?_0x2ec660['attrs'][0x8]['value']:undefined)||''},{'name':_0x3445('0x54'),'value':_0x2ec660['attrWhatsappAccounts']||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x9]?_0x2ec660[_0x3445('0x44')][0x9][_0x3445('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2ec660[_0x3445('0x55')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0xa]?_0x2ec660[_0x3445('0x44')][0xa][_0x3445('0x45')]:undefined)||''}];case _0x3445('0x5d'):return[{'name':_0x3445('0x5e'),'type':_0x2ec660[_0x3445('0x5f')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660['attrs'][0x0]?_0x2ec660[_0x3445('0x44')][0x0]['type']:undefined)||null,'value':_0x2ec660[_0x3445('0x5e')]||(_0x2ec660['attrs']&&_0x2ec660[_0x3445('0x44')][0x0]?_0x2ec660[_0x3445('0x44')][0x0]['value']:undefined)||null},{'name':_0x3445('0x60'),'value':_0x2ec660[_0x3445('0x60')]||(_0x2ec660[_0x3445('0x44')]&&_0x2ec660[_0x3445('0x44')][0x1]?_0x2ec660['attrs'][0x1][_0x3445('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x489966){logger[_0x3445('0x2d')]('widgetAttributes:\x20%s',JSON[_0x3445('0x61')](_0x489966));return[];}}exports[_0x3445('0x62')]=function(_0x5d5ff8,_0x3a7ebe){if(_0x5d5ff8[_0x3445('0x63')]){_0x5d5ff8[_0x3445('0x63')]['attrs']=widgetAttributes(_0x5d5ff8[_0x3445('0x63')]);}return db[_0x3445('0x34')]['create'](_0x5d5ff8['body'],{})['then'](respondWithResult(_0x3a7ebe,0xc9))[_0x3445('0x3e')](handleError(_0x3a7ebe,null));};exports['update']=function(_0x5695d4,_0x5ebad4){if(_0x5695d4[_0x3445('0x63')]['id']){delete _0x5695d4[_0x3445('0x63')]['id'];}_0x5695d4[_0x3445('0x63')][_0x3445('0x44')]=widgetAttributes(_0x5695d4['body']);return db[_0x3445('0x34')][_0x3445('0x3f')]({'where':{'id':_0x5695d4['params']['id']}})[_0x3445('0x2b')](handleEntityNotFound(_0x5ebad4,null))[_0x3445('0x2b')](saveUpdates(_0x5695d4['body'],null))[_0x3445('0x2b')](respondWithResult(_0x5ebad4,null))['catch'](handleError(_0x5ebad4,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index c856619..6eb4e05 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 _0x7ef1=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1e05d1,_0x146a44){var _0x468192=function(_0x27d0e9){while(--_0x27d0e9){_0x1e05d1['push'](_0x1e05d1['shift']());}};_0x468192(++_0x146a44);}(_0x7ef1,0x12d));var _0x17ef=function(_0x2dd7b0,_0x1e9cae){_0x2dd7b0=_0x2dd7b0-0x0;var _0x39139c=_0x7ef1[_0x2dd7b0];return _0x39139c;};'use strict';var EventEmitter=require(_0x17ef('0x0'));var DashboardItem=require(_0x17ef('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x17ef('0x2')](0x0);var events={'afterCreate':_0x17ef('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b5068){return function(_0x2ff49b,_0x3263ad,_0x3a225c){DashboardItemEvents[_0x17ef('0x4')](_0x1b5068+':'+_0x2ff49b['id'],_0x2ff49b);DashboardItemEvents[_0x17ef('0x4')](_0x1b5068,_0x2ff49b);_0x3a225c(null);};}for(var e in events){if(events[_0x17ef('0x5')](e)){var event=events[e];DashboardItem[_0x17ef('0x6')](e,emitEvent(event));}}module[_0x17ef('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x6735=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x54b20c,_0x24fb1a){var _0x4893d6=function(_0x409c7e){while(--_0x409c7e){_0x54b20c['push'](_0x54b20c['shift']());}};_0x4893d6(++_0x24fb1a);}(_0x6735,0x165));var _0x5673=function(_0x15103f,_0x514202){_0x15103f=_0x15103f-0x0;var _0x5d041d=_0x6735[_0x15103f];return _0x5d041d;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x5673('0x0'))['db'][_0x5673('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5673('0x2')](0x0);var events={'afterCreate':_0x5673('0x3'),'afterUpdate':_0x5673('0x4'),'afterDestroy':_0x5673('0x5')};function emitEvent(_0x25d2e1){return function(_0x42e411,_0x115ea2,_0x1c74bb){DashboardItemEvents['emit'](_0x25d2e1+':'+_0x42e411['id'],_0x42e411);DashboardItemEvents[_0x5673('0x6')](_0x25d2e1,_0x42e411);_0x1c74bb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b3cf46f..2d5cf22 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 _0x92fb=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','util','api','bluebird','request-promise','path'];(function(_0x3f9d5d,_0x4ee8dd){var _0x1b2cd7=function(_0x380e51){while(--_0x380e51){_0x3f9d5d['push'](_0x3f9d5d['shift']());}};_0x1b2cd7(++_0x4ee8dd);}(_0x92fb,0x1b3));var _0xb92f=function(_0x528511,_0x815fd3){_0x528511=_0x528511-0x0;var _0xd1b2b7=_0x92fb[_0x528511];return _0xd1b2b7;};'use strict';var _=require('lodash');var util=require(_0xb92f('0x0'));var logger=require('../../config/logger')(_0xb92f('0x1'));var moment=require('moment');var BPromise=require(_0xb92f('0x2'));var rp=require(_0xb92f('0x3'));var fs=require('fs');var path=require(_0xb92f('0x4'));var rimraf=require('rimraf');var config=require(_0xb92f('0x5'));var attributes=require(_0xb92f('0x6'));module[_0xb92f('0x7')]=function(_0x4dfa40,_0x2f7314){return _0x4dfa40[_0xb92f('0x8')](_0xb92f('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem'];(function(_0x505100,_0x2f4a23){var _0xd2d220=function(_0x232bc5){while(--_0x232bc5){_0x505100['push'](_0x505100['shift']());}};_0xd2d220(++_0x2f4a23);}(_0x6324,0x13b));var _0x4632=function(_0x5b5095,_0x4518d0){_0x5b5095=_0x5b5095-0x0;var _0x54d290=_0x6324[_0x5b5095];return _0x54d290;};'use strict';var _=require('lodash');var util=require(_0x4632('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4632('0x1'));var BPromise=require(_0x4632('0x2'));var rp=require(_0x4632('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4632('0x4'));var config=require(_0x4632('0x5'));var attributes=require(_0x4632('0x6'));module[_0x4632('0x7')]=function(_0x39d265,_0xa77962){return _0x39d265['define'](_0x4632('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 4cf9f3d..ae845d3 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 _0xc283=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xaad974,_0x396049){var _0x3801e9=function(_0x21bfc3){while(--_0x21bfc3){_0xaad974['push'](_0xaad974['shift']());}};_0x3801e9(++_0x396049);}(_0xc283,0x107));var _0x3c28=function(_0x429a71,_0x1ef71e){_0x429a71=_0x429a71-0x0;var _0x23a1e9=_0xc283[_0x429a71];return _0x23a1e9;};'use strict';var _=require('lodash');var util=require(_0x3c28('0x0'));var moment=require(_0x3c28('0x1'));var BPromise=require(_0x3c28('0x2'));var rs=require(_0x3c28('0x3'));var fs=require('fs');var Redis=require(_0x3c28('0x4'));var db=require(_0x3c28('0x5'))['db'];var utils=require(_0x3c28('0x6'));var logger=require(_0x3c28('0x7'))(_0x3c28('0x8'));var config=require(_0x3c28('0x9'));var jayson=require(_0x3c28('0xa'));var client=jayson[_0x3c28('0xb')][_0x3c28('0xc')]({'port':0x232a});config[_0x3c28('0xd')]=_[_0x3c28('0xe')](config[_0x3c28('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c28('0xf'))(new Redis(config[_0x3c28('0xd')]));require('./dashboardItem.socket')[_0x3c28('0x10')](socket);function respondWithRpcPromise(_0x578d74,_0x3d07b2,_0x334ec1){return new BPromise(function(_0x3f733b,_0x209d08){return client[_0x3c28('0x11')](_0x578d74,_0x334ec1)['then'](function(_0x3c1fa3){logger[_0x3c28('0x12')](_0x3c28('0x13'),_0x3d07b2,'request\x20sent');logger[_0x3c28('0x14')](_0x3c28('0x15'),_0x3d07b2,_0x3c28('0x16'),JSON['stringify'](_0x3c1fa3));if(_0x3c1fa3['error']){if(_0x3c1fa3['error']['code']===0x1f4){logger[_0x3c28('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3d07b2,_0x3c1fa3[_0x3c28('0x17')][_0x3c28('0x18')]);return _0x209d08(_0x3c1fa3['error'][_0x3c28('0x18')]);}logger[_0x3c28('0x17')](_0x3c28('0x13'),_0x3d07b2,_0x3c1fa3['error'][_0x3c28('0x18')]);return _0x3f733b(_0x3c1fa3['error'][_0x3c28('0x18')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x3d07b2,_0x3c28('0x16'));_0x3f733b(_0x3c1fa3[_0x3c28('0x19')][_0x3c28('0x18')]);}})[_0x3c28('0x1a')](function(_0x5f410e){logger[_0x3c28('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3d07b2,_0x5f410e);_0x209d08(_0x5f410e);});});} \ No newline at end of file +var _0x1cd5=['localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x1cd5,0xa7));var _0x51cd=function(_0x2345ae,_0x55dc0c){_0x2345ae=_0x2345ae-0x0;var _0x1fa3d3=_0x1cd5[_0x2345ae];return _0x1fa3d3;};'use strict';var _=require(_0x51cd('0x0'));var util=require(_0x51cd('0x1'));var moment=require(_0x51cd('0x2'));var BPromise=require('bluebird');var rs=require(_0x51cd('0x3'));var fs=require('fs');var Redis=require(_0x51cd('0x4'));var db=require(_0x51cd('0x5'))['db'];var utils=require(_0x51cd('0x6'));var logger=require(_0x51cd('0x7'))('rpc');var config=require(_0x51cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x51cd('0x9')][_0x51cd('0xa')]({'port':0x232a});config[_0x51cd('0xb')]=_[_0x51cd('0xc')](config[_0x51cd('0xb')],{'host':_0x51cd('0xd'),'port':0x18eb});var socket=require(_0x51cd('0xe'))(new Redis(config[_0x51cd('0xb')]));require(_0x51cd('0xf'))[_0x51cd('0x10')](socket);function respondWithRpcPromise(_0x59cb69,_0x140632,_0x1c20c6){return new BPromise(function(_0x2529b6,_0x2e6fef){return client[_0x51cd('0x11')](_0x59cb69,_0x1c20c6)[_0x51cd('0x12')](function(_0x546134){logger['info'](_0x51cd('0x13'),_0x140632,'request\x20sent');logger[_0x51cd('0x14')](_0x51cd('0x15'),_0x140632,_0x51cd('0x16'),JSON[_0x51cd('0x17')](_0x546134));if(_0x546134[_0x51cd('0x18')]){if(_0x546134[_0x51cd('0x18')][_0x51cd('0x19')]===0x1f4){logger[_0x51cd('0x18')](_0x51cd('0x13'),_0x140632,_0x546134['error'][_0x51cd('0x1a')]);return _0x2e6fef(_0x546134['error'][_0x51cd('0x1a')]);}logger['error'](_0x51cd('0x13'),_0x140632,_0x546134[_0x51cd('0x18')]['message']);return _0x2529b6(_0x546134[_0x51cd('0x18')][_0x51cd('0x1a')]);}else{logger[_0x51cd('0x1b')](_0x51cd('0x13'),_0x140632,_0x51cd('0x16'));_0x2529b6(_0x546134[_0x51cd('0x1c')][_0x51cd('0x1a')]);}})[_0x51cd('0x1d')](function(_0x382d62){logger[_0x51cd('0x18')](_0x51cd('0x13'),_0x140632,_0x382d62);_0x2e6fef(_0x382d62);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b847127..edd89d7 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 _0xd915=['register','dashboardItem:','save','remove','update','emit','removeListener'];(function(_0xa861aa,_0x2895a4){var _0x1e34de=function(_0x41ed53){while(--_0x41ed53){_0xa861aa['push'](_0xa861aa['shift']());}};_0x1e34de(++_0x2895a4);}(_0xd915,0x8e));var _0x5d91=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xd915[_0x4b2863];return _0x567d67;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x5d91('0x0'),_0x5d91('0x1'),_0x5d91('0x2')];function createListener(_0x5b69de,_0x5b8126){return function(_0x348a3e){_0x5b8126[_0x5d91('0x3')](_0x5b69de,_0x348a3e);};}function removeListener(_0x29dbb6,_0x3b8a58){return function(){DashboardItemEvents[_0x5d91('0x4')](_0x29dbb6,_0x3b8a58);};}exports[_0x5d91('0x5')]=function(_0x2aa485){for(var _0x2d976d=0x0,_0x4b8eb3=events['length'];_0x2d976d<_0x4b8eb3;_0x2d976d++){var _0x44dc07=events[_0x2d976d];var _0x3cf741=createListener(_0x5d91('0x6')+_0x44dc07,_0x2aa485);DashboardItemEvents['on'](_0x44dc07,_0x3cf741);}}; \ No newline at end of file +var _0x97d9=['update','removeListener','dashboardItem:','./dashboardItem.events','save'];(function(_0x78efa2,_0x13bf25){var _0x49a1db=function(_0x29e601){while(--_0x29e601){_0x78efa2['push'](_0x78efa2['shift']());}};_0x49a1db(++_0x13bf25);}(_0x97d9,0x1a7));var _0x997d=function(_0x4e9f55,_0x4d1c4e){_0x4e9f55=_0x4e9f55-0x0;var _0x23b3c1=_0x97d9[_0x4e9f55];return _0x23b3c1;};'use strict';var DashboardItemEvents=require(_0x997d('0x0'));var events=[_0x997d('0x1'),'remove',_0x997d('0x2')];function createListener(_0x4bcaf9,_0x2aedc2){return function(_0xcd092b){_0x2aedc2['emit'](_0x4bcaf9,_0xcd092b);};}function removeListener(_0x306d4b,_0x37ef54){return function(){DashboardItemEvents[_0x997d('0x3')](_0x306d4b,_0x37ef54);};}exports['register']=function(_0x33c7ca){for(var _0x1d9378=0x0,_0x26385e=events['length'];_0x1d9378<_0x26385e;_0x1d9378++){var _0x38c161=events[_0x1d9378];var _0x208157=createListener(_0x997d('0x4')+_0x38c161,_0x33c7ca);DashboardItemEvents['on'](_0x38c161,_0x208157);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 2362963..8fa1cb9 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 _0x2c4b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0x2c4b,0x92));var _0xb2c4=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x2c4b[_0x585d81];return _0x1aca0d;};'use strict';var multer=require(_0xb2c4('0x0'));var util=require(_0xb2c4('0x1'));var path=require(_0xb2c4('0x2'));var timeout=require(_0xb2c4('0x3'));var express=require(_0xb2c4('0x4'));var router=express['Router']();var fs_extra=require(_0xb2c4('0x5'));var auth=require(_0xb2c4('0x6'));var interaction=require(_0xb2c4('0x7'));var config=require(_0xb2c4('0x8'));var controller=require(_0xb2c4('0x9'));router[_0xb2c4('0xa')](_0xb2c4('0xb'),auth[_0xb2c4('0xc')](),controller[_0xb2c4('0xd')]);router[_0xb2c4('0xe')]('/',auth[_0xb2c4('0xc')](),controller[_0xb2c4('0xf')]);router['put'](_0xb2c4('0xb'),auth[_0xb2c4('0xc')](),controller[_0xb2c4('0x10')]);router[_0xb2c4('0x11')]('/:id',auth[_0xb2c4('0xc')](),controller[_0xb2c4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0e3a=['./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x298cfa,_0x3faa7c){var _0x139d81=function(_0x5add44){while(--_0x5add44){_0x298cfa['push'](_0x298cfa['shift']());}};_0x139d81(++_0x3faa7c);}(_0x0e3a,0x1c3));var _0xa0e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0e3a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa0e3('0x0'));var util=require(_0xa0e3('0x1'));var path=require(_0xa0e3('0x2'));var timeout=require(_0xa0e3('0x3'));var express=require(_0xa0e3('0x4'));var router=express[_0xa0e3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa0e3('0x6'));var interaction=require(_0xa0e3('0x7'));var config=require(_0xa0e3('0x8'));var controller=require(_0xa0e3('0x9'));router['get'](_0xa0e3('0xa'),auth[_0xa0e3('0xb')](),controller[_0xa0e3('0xc')]);router[_0xa0e3('0xd')]('/',auth[_0xa0e3('0xb')](),controller[_0xa0e3('0xe')]);router[_0xa0e3('0xf')](_0xa0e3('0xa'),auth[_0xa0e3('0xb')](),controller[_0xa0e3('0x10')]);router[_0xa0e3('0x11')]('/:id',auth[_0xa0e3('0xb')](),controller[_0xa0e3('0x12')]);module[_0xa0e3('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 0d08eb8..9129d45 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 _0xcd04=['STRING','ENUM','first','second','third','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xcd04,0x1e5));var _0x4cd0=function(_0x498633,_0x3c095a){_0x498633=_0x498633-0x0;var _0x56e3fe=_0xcd04[_0x498633];return _0x56e3fe;};'use strict';var Sequelize=require('sequelize');module[_0x4cd0('0x0')]={'name':{'type':Sequelize[_0x4cd0('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x4cd0('0x2')](_0x4cd0('0x3'),_0x4cd0('0x4'),_0x4cd0('0x5')),'allowNull':![],'defaultValue':_0x4cd0('0x3')},'description':{'type':Sequelize[_0x4cd0('0x1')]}}; \ No newline at end of file +var _0xb130=['first','third','STRING','sequelize','exports','ENUM'];(function(_0x3cb86b,_0x3c75f6){var _0x3c10a0=function(_0x71331f){while(--_0x71331f){_0x3cb86b['push'](_0x3cb86b['shift']());}};_0x3c10a0(++_0x3c75f6);}(_0xb130,0x165));var _0x0b13=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xb130[_0x5f5cce];return _0x705ecf;};'use strict';var Sequelize=require(_0x0b13('0x0'));module[_0x0b13('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x0b13('0x2')](_0x0b13('0x3'),'second',_0x0b13('0x4')),'allowNull':![],'defaultValue':_0x0b13('0x3')},'description':{'type':Sequelize[_0x0b13('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6ada12c..b61262c 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 _0x9a14=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','find','params'];(function(_0x1325fb,_0xa9c76e){var _0x52712c=function(_0x15a56d){while(--_0x15a56d){_0x1325fb['push'](_0x1325fb['shift']());}};_0x52712c(++_0xa9c76e);}(_0x9a14,0xa8));var _0x49a1=function(_0x25dfe1,_0x5d385b){_0x25dfe1=_0x25dfe1-0x0;var _0x2464b7=_0x9a14[_0x25dfe1];return _0x2464b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49a1('0x0'));var jsonpatch=require(_0x49a1('0x1'));var rp=require(_0x49a1('0x2'));var moment=require(_0x49a1('0x3'));var BPromise=require(_0x49a1('0x4'));var Mustache=require(_0x49a1('0x5'));var util=require(_0x49a1('0x6'));var path=require(_0x49a1('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(_0x49a1('0x8'));var squel=require(_0x49a1('0x9'));var crypto=require(_0x49a1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x49a1('0xb'));var toCsv=require(_0x49a1('0xc'));var querystring=require(_0x49a1('0xd'));var Papa=require('papaparse');var Redis=require(_0x49a1('0xe'));var authService=require(_0x49a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x49a1('0x10'));var hardwareService=require(_0x49a1('0x11'));var logger=require(_0x49a1('0x12'))(_0x49a1('0x13'));var utils=require(_0x49a1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x49a1('0x15'));var db=require(_0x49a1('0x16'))['db'];function respondWithStatusCode(_0x380db3,_0x58101a){_0x58101a=_0x58101a||0xcc;return function(_0x20138b){if(_0x20138b){return _0x380db3[_0x49a1('0x17')](_0x58101a);}return _0x380db3[_0x49a1('0x18')](_0x58101a)[_0x49a1('0x19')]();};}function respondWithResult(_0x35f2fd,_0x6bce27){_0x6bce27=_0x6bce27||0xc8;return function(_0x278713){if(_0x278713){return _0x35f2fd[_0x49a1('0x18')](_0x6bce27)[_0x49a1('0x1a')](_0x278713);}};}function respondWithFilteredResult(_0x39676e,_0x13fe24){return function(_0x5c6d06){if(_0x5c6d06){var _0x27dff1=typeof _0x13fe24[_0x49a1('0x1b')]===_0x49a1('0x1c')&&typeof _0x13fe24['limit']===_0x49a1('0x1c');var _0x7b53dc=_0x5c6d06['count'];var _0xd93b68=_0x27dff1?0x0:_0x13fe24['offset'];var _0x3c1352=_0x27dff1?_0x5c6d06[_0x49a1('0x1d')]:_0x13fe24['offset']+_0x13fe24[_0x49a1('0x1e')];var _0x508f32;if(_0x3c1352>=_0x7b53dc){_0x3c1352=_0x7b53dc;_0x508f32=0xc8;}else{_0x508f32=0xce;}_0x39676e[_0x49a1('0x18')](_0x508f32);return _0x39676e[_0x49a1('0x1f')](_0x49a1('0x20'),_0xd93b68+'-'+_0x3c1352+'/'+_0x7b53dc)['json'](_0x5c6d06);}return null;};}function patchUpdates(_0x15d7e6){return function(_0x37b66f){try{jsonpatch[_0x49a1('0x21')](_0x37b66f,_0x15d7e6,!![]);}catch(_0x286cb9){return BPromise[_0x49a1('0x22')](_0x286cb9);}return _0x37b66f[_0x49a1('0x23')]();};}function saveUpdates(_0x50aace,_0xe5c860){return function(_0x108d66){if(_0x108d66){return _0x108d66[_0x49a1('0x24')](_0x50aace)['then'](function(_0x12011d){return _0x12011d;});}return null;};}function removeEntity(_0x14a5bf,_0x28785d){return function(_0x4b4bf3){if(_0x4b4bf3){return _0x4b4bf3['destroy']()[_0x49a1('0x25')](function(){var _0x1ed188=_0x4b4bf3[_0x49a1('0x26')]({'plain':!![]});var _0x38c624=_0x49a1('0x27');return db[_0x49a1('0x28')][_0x49a1('0x29')]({'where':{'type':_0x38c624,'resourceId':_0x1ed188['id']}})['then'](function(){return _0x4b4bf3;});})[_0x49a1('0x25')](function(){_0x14a5bf[_0x49a1('0x18')](0xcc)[_0x49a1('0x19')]();});}};}function handleEntityNotFound(_0x2935d1,_0x20af10){return function(_0x1e3f21){if(!_0x1e3f21){_0x2935d1[_0x49a1('0x17')](0x194);}return _0x1e3f21;};}function handleError(_0x232289,_0x5b3842){_0x5b3842=_0x5b3842||0x1f4;return function(_0x3cd5ff){logger['error'](_0x3cd5ff['stack']);if(_0x3cd5ff['name']){delete _0x3cd5ff[_0x49a1('0x2a')];}_0x232289[_0x49a1('0x18')](_0x5b3842)[_0x49a1('0x2b')](_0x3cd5ff);};}exports['index']=function(_0x542be7,_0x22ddf9){var _0x30a265={},_0x330ec6={},_0x2a979c={'count':0x0,'rows':[]};var _0x1c3579=_[_0x49a1('0x2c')](db[_0x49a1('0x2d')][_0x49a1('0x2e')],function(_0x237b32){return{'name':_0x237b32[_0x49a1('0x2f')],'type':_0x237b32[_0x49a1('0x30')][_0x49a1('0x31')]};});_0x330ec6[_0x49a1('0x32')]=_[_0x49a1('0x2c')](_0x1c3579,_0x49a1('0x2a'));_0x330ec6['query']=_[_0x49a1('0x33')](_0x542be7['query']);_0x330ec6['filters']=_[_0x49a1('0x34')](_0x330ec6[_0x49a1('0x32')],_0x330ec6[_0x49a1('0x35')]);_0x30a265['attributes']=_[_0x49a1('0x34')](_0x330ec6[_0x49a1('0x32')],qs['fields'](_0x542be7['query'][_0x49a1('0x36')]));_0x30a265[_0x49a1('0x37')]=_0x30a265[_0x49a1('0x37')][_0x49a1('0x38')]?_0x30a265[_0x49a1('0x37')]:_0x330ec6[_0x49a1('0x32')];if(!_0x542be7[_0x49a1('0x35')][_0x49a1('0x39')](_0x49a1('0x3a'))){_0x30a265[_0x49a1('0x1e')]=qs[_0x49a1('0x1e')](_0x542be7[_0x49a1('0x35')][_0x49a1('0x1e')]);_0x30a265[_0x49a1('0x1b')]=qs[_0x49a1('0x1b')](_0x542be7[_0x49a1('0x35')]['offset']);}_0x30a265[_0x49a1('0x3b')]=qs[_0x49a1('0x3c')](_0x542be7['query'][_0x49a1('0x3c')]);_0x30a265['where']=qs[_0x49a1('0x3d')](_[_0x49a1('0x3e')](_0x542be7['query'],_0x330ec6[_0x49a1('0x3d')]),_0x1c3579);if(_0x542be7[_0x49a1('0x35')][_0x49a1('0x3f')]){_0x30a265[_0x49a1('0x40')]=_[_0x49a1('0x41')](_0x30a265[_0x49a1('0x40')],{'$or':_[_0x49a1('0x2c')](_0x1c3579,function(_0x247469){if(_0x247469[_0x49a1('0x30')]!==_0x49a1('0x42')){var _0x40b60d={};_0x40b60d[_0x247469[_0x49a1('0x2a')]]={'$like':'%'+_0x542be7[_0x49a1('0x35')][_0x49a1('0x3f')]+'%'};return _0x40b60d;}})});}_0x30a265=_[_0x49a1('0x41')]({},_0x30a265,_0x542be7[_0x49a1('0x43')]);var _0x12d742={'where':_0x30a265[_0x49a1('0x40')]};return db['Disposition'][_0x49a1('0x1d')](_0x12d742)[_0x49a1('0x25')](function(_0x7aa1bf){_0x2a979c[_0x49a1('0x1d')]=_0x7aa1bf;if(_0x542be7[_0x49a1('0x35')][_0x49a1('0x44')]){_0x30a265['include']=[{'all':!![]}];}return db[_0x49a1('0x2d')][_0x49a1('0x45')](_0x30a265);})[_0x49a1('0x25')](function(_0x5dddb8){_0x2a979c[_0x49a1('0x46')]=_0x5dddb8;return _0x2a979c;})['then'](respondWithFilteredResult(_0x22ddf9,_0x30a265))['catch'](handleError(_0x22ddf9,null));};exports[_0x49a1('0x47')]=function(_0x174fd8,_0x27bf5a){var _0x45e125={'raw':!![],'where':{'id':_0x174fd8['params']['id']}},_0x1295ca={};_0x1295ca[_0x49a1('0x32')]=_[_0x49a1('0x33')](db[_0x49a1('0x2d')][_0x49a1('0x2e')]);_0x1295ca['query']=_['keys'](_0x174fd8[_0x49a1('0x35')]);_0x1295ca[_0x49a1('0x3d')]=_['intersection'](_0x1295ca[_0x49a1('0x32')],_0x1295ca[_0x49a1('0x35')]);_0x45e125['attributes']=_[_0x49a1('0x34')](_0x1295ca[_0x49a1('0x32')],qs[_0x49a1('0x36')](_0x174fd8[_0x49a1('0x35')][_0x49a1('0x36')]));_0x45e125[_0x49a1('0x37')]=_0x45e125['attributes'][_0x49a1('0x38')]?_0x45e125['attributes']:_0x1295ca[_0x49a1('0x32')];if(_0x174fd8[_0x49a1('0x35')][_0x49a1('0x44')]){_0x45e125[_0x49a1('0x48')]=[{'all':!![]}];}_0x45e125=_[_0x49a1('0x41')]({},_0x45e125,_0x174fd8[_0x49a1('0x43')]);return db[_0x49a1('0x2d')]['find'](_0x45e125)[_0x49a1('0x25')](handleEntityNotFound(_0x27bf5a,null))[_0x49a1('0x25')](respondWithResult(_0x27bf5a,null))[_0x49a1('0x49')](handleError(_0x27bf5a,null));};exports[_0x49a1('0x4a')]=function(_0x57c3df,_0x6a35f6){return db[_0x49a1('0x2d')][_0x49a1('0x4a')](_0x57c3df[_0x49a1('0x4b')],{})[_0x49a1('0x25')](function(_0x37cc84){var _0x3730cd=_0x57c3df[_0x49a1('0x4c')][_0x49a1('0x26')]({'plain':!![]});if(!_0x3730cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3730cd[_0x49a1('0x4d')]===_0x49a1('0x4c')){var _0xd9a544=_0x37cc84[_0x49a1('0x26')]({'plain':!![]});var _0x295c0f=_0x49a1('0x27');return db[_0x49a1('0x4e')]['find']({'where':{'name':_0x295c0f,'userProfileId':_0x3730cd[_0x49a1('0x4f')]},'raw':!![]})['then'](function(_0x45a4be){if(_0x45a4be&&_0x45a4be[_0x49a1('0x50')]===0x0){return db[_0x49a1('0x28')][_0x49a1('0x4a')]({'name':_0xd9a544[_0x49a1('0x2a')],'resourceId':_0xd9a544['id'],'type':_0x45a4be[_0x49a1('0x2a')],'sectionId':_0x45a4be['id']},{})[_0x49a1('0x25')](function(){return _0x37cc84;});}else{return _0x37cc84;}})['catch'](function(_0x19c0d1){logger[_0x49a1('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19c0d1);throw _0x19c0d1;});}return _0x37cc84;})[_0x49a1('0x25')](respondWithResult(_0x6a35f6,0xc9))[_0x49a1('0x49')](handleError(_0x6a35f6,null));};exports[_0x49a1('0x24')]=function(_0x9919f4,_0x9b31ba){if(_0x9919f4['body']['id']){delete _0x9919f4[_0x49a1('0x4b')]['id'];}return db[_0x49a1('0x2d')][_0x49a1('0x52')]({'where':{'id':_0x9919f4[_0x49a1('0x53')]['id']}})[_0x49a1('0x25')](handleEntityNotFound(_0x9b31ba,null))[_0x49a1('0x25')](saveUpdates(_0x9919f4[_0x49a1('0x4b')],null))[_0x49a1('0x25')](respondWithResult(_0x9b31ba,null))[_0x49a1('0x49')](handleError(_0x9b31ba,null));};exports['destroy']=function(_0x3072e1,_0x37e33f){return db[_0x49a1('0x2d')]['find']({'where':{'id':_0x3072e1[_0x49a1('0x53')]['id']}})[_0x49a1('0x25')](handleEntityNotFound(_0x37e33f,null))[_0x49a1('0x25')](removeEntity(_0x37e33f,null))[_0x49a1('0x49')](handleError(_0x37e33f,null));}; \ No newline at end of file +var _0x180d=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x180d,0x19c));var _0xd180=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x180d[_0x13b8f3];return _0x1a6d06;};'use strict';var emlformat=require(_0xd180('0x0'));var rimraf=require(_0xd180('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd180('0x2'));var moment=require(_0xd180('0x3'));var BPromise=require(_0xd180('0x4'));var Mustache=require(_0xd180('0x5'));var util=require(_0xd180('0x6'));var path=require(_0xd180('0x7'));var sox=require(_0xd180('0x8'));var csv=require('to-csv');var ejs=require(_0xd180('0x9'));var fs=require('fs');var fs_extra=require(_0xd180('0xa'));var _=require(_0xd180('0xb'));var squel=require('squel');var crypto=require(_0xd180('0xc'));var jsforce=require(_0xd180('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd180('0xe'));var Redis=require(_0xd180('0xf'));var authService=require(_0xd180('0x10'));var qs=require(_0xd180('0x11'));var as=require(_0xd180('0x12'));var hardwareService=require(_0xd180('0x13'));var logger=require(_0xd180('0x14'))(_0xd180('0x15'));var utils=require(_0xd180('0x16'));var config=require(_0xd180('0x17'));var licenseUtil=require(_0xd180('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xff3b1e,_0x2e5b38){_0x2e5b38=_0x2e5b38||0xcc;return function(_0x241f39){if(_0x241f39){return _0xff3b1e[_0xd180('0x19')](_0x2e5b38);}return _0xff3b1e[_0xd180('0x1a')](_0x2e5b38)[_0xd180('0x1b')]();};}function respondWithResult(_0x238618,_0x16fb5f){_0x16fb5f=_0x16fb5f||0xc8;return function(_0x1ed4f1){if(_0x1ed4f1){return _0x238618[_0xd180('0x1a')](_0x16fb5f)['json'](_0x1ed4f1);}};}function respondWithFilteredResult(_0x340f8a,_0x4d19b9){return function(_0x5be7b4){if(_0x5be7b4){var _0x172a8d=typeof _0x4d19b9[_0xd180('0x1c')]==='undefined'&&typeof _0x4d19b9[_0xd180('0x1d')]===_0xd180('0x1e');var _0x1e4913=_0x5be7b4[_0xd180('0x1f')];var _0x3f10da=_0x172a8d?0x0:_0x4d19b9[_0xd180('0x1c')];var _0x11609f=_0x172a8d?_0x5be7b4[_0xd180('0x1f')]:_0x4d19b9[_0xd180('0x1c')]+_0x4d19b9[_0xd180('0x1d')];var _0x4fe906;if(_0x11609f>=_0x1e4913){_0x11609f=_0x1e4913;_0x4fe906=0xc8;}else{_0x4fe906=0xce;}_0x340f8a['status'](_0x4fe906);return _0x340f8a[_0xd180('0x20')](_0xd180('0x21'),_0x3f10da+'-'+_0x11609f+'/'+_0x1e4913)[_0xd180('0x22')](_0x5be7b4);}return null;};}function patchUpdates(_0x35e69a){return function(_0x878620){try{jsonpatch[_0xd180('0x23')](_0x878620,_0x35e69a,!![]);}catch(_0x360a0f){return BPromise[_0xd180('0x24')](_0x360a0f);}return _0x878620['save']();};}function saveUpdates(_0x59e3b1,_0x48d6e3){return function(_0x2f5dff){if(_0x2f5dff){return _0x2f5dff[_0xd180('0x25')](_0x59e3b1)[_0xd180('0x26')](function(_0x4c5f4d){return _0x4c5f4d;});}return null;};}function removeEntity(_0x44c641,_0x27c5f5){return function(_0x4d11d7){if(_0x4d11d7){return _0x4d11d7[_0xd180('0x27')]()[_0xd180('0x26')](function(){var _0x13b477=_0x4d11d7[_0xd180('0x28')]({'plain':!![]});var _0x22fdc1=_0xd180('0x29');return db[_0xd180('0x2a')][_0xd180('0x27')]({'where':{'type':_0x22fdc1,'resourceId':_0x13b477['id']}})['then'](function(){return _0x4d11d7;});})[_0xd180('0x26')](function(){_0x44c641[_0xd180('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33d73e,_0x530fb7){return function(_0x388cef){if(!_0x388cef){_0x33d73e[_0xd180('0x19')](0x194);}return _0x388cef;};}function handleError(_0x2062c0,_0x4ec72a){_0x4ec72a=_0x4ec72a||0x1f4;return function(_0x3af56e){logger[_0xd180('0x2b')](_0x3af56e[_0xd180('0x2c')]);if(_0x3af56e[_0xd180('0x2d')]){delete _0x3af56e[_0xd180('0x2d')];}_0x2062c0['status'](_0x4ec72a)[_0xd180('0x2e')](_0x3af56e);};}exports[_0xd180('0x2f')]=function(_0x3b8883,_0x68b8){var _0x308171={},_0x5078e7={},_0x37563b={'count':0x0,'rows':[]};var _0x50619c=_[_0xd180('0x30')](db[_0xd180('0x31')][_0xd180('0x32')],function(_0x375e28){return{'name':_0x375e28['fieldName'],'type':_0x375e28[_0xd180('0x33')][_0xd180('0x34')]};});_0x5078e7[_0xd180('0x35')]=_[_0xd180('0x30')](_0x50619c,'name');_0x5078e7[_0xd180('0x36')]=_[_0xd180('0x37')](_0x3b8883['query']);_0x5078e7[_0xd180('0x38')]=_[_0xd180('0x39')](_0x5078e7[_0xd180('0x35')],_0x5078e7[_0xd180('0x36')]);_0x308171[_0xd180('0x3a')]=_[_0xd180('0x39')](_0x5078e7['model'],qs[_0xd180('0x3b')](_0x3b8883[_0xd180('0x36')][_0xd180('0x3b')]));_0x308171[_0xd180('0x3a')]=_0x308171[_0xd180('0x3a')]['length']?_0x308171[_0xd180('0x3a')]:_0x5078e7[_0xd180('0x35')];if(!_0x3b8883[_0xd180('0x36')][_0xd180('0x3c')](_0xd180('0x3d'))){_0x308171['limit']=qs['limit'](_0x3b8883['query'][_0xd180('0x1d')]);_0x308171[_0xd180('0x1c')]=qs[_0xd180('0x1c')](_0x3b8883['query'][_0xd180('0x1c')]);}_0x308171[_0xd180('0x3e')]=qs[_0xd180('0x3f')](_0x3b8883[_0xd180('0x36')]['sort']);_0x308171[_0xd180('0x40')]=qs[_0xd180('0x38')](_[_0xd180('0x41')](_0x3b8883[_0xd180('0x36')],_0x5078e7[_0xd180('0x38')]),_0x50619c);if(_0x3b8883[_0xd180('0x36')][_0xd180('0x42')]){_0x308171[_0xd180('0x40')]=_[_0xd180('0x43')](_0x308171[_0xd180('0x40')],{'$or':_[_0xd180('0x30')](_0x50619c,function(_0x2c553b){if(_0x2c553b['type']!==_0xd180('0x44')){var _0x19dfb8={};_0x19dfb8[_0x2c553b[_0xd180('0x2d')]]={'$like':'%'+_0x3b8883[_0xd180('0x36')][_0xd180('0x42')]+'%'};return _0x19dfb8;}})});}_0x308171=_[_0xd180('0x43')]({},_0x308171,_0x3b8883['options']);var _0x1c19a4={'where':_0x308171[_0xd180('0x40')]};return db[_0xd180('0x31')]['count'](_0x1c19a4)[_0xd180('0x26')](function(_0x285635){_0x37563b[_0xd180('0x1f')]=_0x285635;if(_0x3b8883[_0xd180('0x36')][_0xd180('0x45')]){_0x308171[_0xd180('0x46')]=[{'all':!![]}];}return db['Disposition'][_0xd180('0x47')](_0x308171);})[_0xd180('0x26')](function(_0xbaaaa5){_0x37563b[_0xd180('0x48')]=_0xbaaaa5;return _0x37563b;})['then'](respondWithFilteredResult(_0x68b8,_0x308171))[_0xd180('0x49')](handleError(_0x68b8,null));};exports[_0xd180('0x4a')]=function(_0x4d022a,_0x24a1f8){var _0x33317d={'raw':!![],'where':{'id':_0x4d022a['params']['id']}},_0x102c98={};_0x102c98[_0xd180('0x35')]=_[_0xd180('0x37')](db[_0xd180('0x31')][_0xd180('0x32')]);_0x102c98[_0xd180('0x36')]=_[_0xd180('0x37')](_0x4d022a['query']);_0x102c98[_0xd180('0x38')]=_[_0xd180('0x39')](_0x102c98[_0xd180('0x35')],_0x102c98[_0xd180('0x36')]);_0x33317d['attributes']=_[_0xd180('0x39')](_0x102c98[_0xd180('0x35')],qs[_0xd180('0x3b')](_0x4d022a[_0xd180('0x36')][_0xd180('0x3b')]));_0x33317d[_0xd180('0x3a')]=_0x33317d[_0xd180('0x3a')][_0xd180('0x4b')]?_0x33317d[_0xd180('0x3a')]:_0x102c98['model'];if(_0x4d022a[_0xd180('0x36')]['includeAll']){_0x33317d[_0xd180('0x46')]=[{'all':!![]}];}_0x33317d=_[_0xd180('0x43')]({},_0x33317d,_0x4d022a['options']);return db['Disposition'][_0xd180('0x4c')](_0x33317d)[_0xd180('0x26')](handleEntityNotFound(_0x24a1f8,null))[_0xd180('0x26')](respondWithResult(_0x24a1f8,null))[_0xd180('0x49')](handleError(_0x24a1f8,null));};exports['create']=function(_0x111f3e,_0x1a9f34){return db[_0xd180('0x31')]['create'](_0x111f3e[_0xd180('0x4d')],{})[_0xd180('0x26')](function(_0x5f3002){var _0x34835b=_0x111f3e[_0xd180('0x4e')][_0xd180('0x28')]({'plain':!![]});if(!_0x34835b)throw new Error(_0xd180('0x4f'));if(_0x34835b['role']===_0xd180('0x4e')){var _0x47a5d1=_0x5f3002[_0xd180('0x28')]({'plain':!![]});var _0x3d3b9c='Dispositions';return db['UserProfileSection'][_0xd180('0x4c')]({'where':{'name':_0x3d3b9c,'userProfileId':_0x34835b[_0xd180('0x50')]},'raw':!![]})['then'](function(_0x2cc394){if(_0x2cc394&&_0x2cc394[_0xd180('0x51')]===0x0){return db[_0xd180('0x2a')][_0xd180('0x52')]({'name':_0x47a5d1[_0xd180('0x2d')],'resourceId':_0x47a5d1['id'],'type':_0x2cc394[_0xd180('0x2d')],'sectionId':_0x2cc394['id']},{})['then'](function(){return _0x5f3002;});}else{return _0x5f3002;}})[_0xd180('0x49')](function(_0x2db04e){logger[_0xd180('0x2b')](_0xd180('0x53'),_0x2db04e);throw _0x2db04e;});}return _0x5f3002;})['then'](respondWithResult(_0x1a9f34,0xc9))[_0xd180('0x49')](handleError(_0x1a9f34,null));};exports['update']=function(_0x48bb84,_0x4f7e07){if(_0x48bb84['body']['id']){delete _0x48bb84['body']['id'];}return db[_0xd180('0x31')]['find']({'where':{'id':_0x48bb84['params']['id']}})[_0xd180('0x26')](handleEntityNotFound(_0x4f7e07,null))['then'](saveUpdates(_0x48bb84[_0xd180('0x4d')],null))[_0xd180('0x26')](respondWithResult(_0x4f7e07,null))[_0xd180('0x49')](handleError(_0x4f7e07,null));};exports['destroy']=function(_0x4cf3c5,_0x1f22a7){return db[_0xd180('0x31')][_0xd180('0x4c')]({'where':{'id':_0x4cf3c5[_0xd180('0x54')]['id']}})['then'](handleEntityNotFound(_0x1f22a7,null))[_0xd180('0x26')](removeEntity(_0x1f22a7,null))[_0xd180('0x49')](handleError(_0x1f22a7,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 50bcd5b..bd09edd 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 _0x17e2=['MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','path','../../config/environment','./disposition.attributes','Disposition','tools_dispositions','ListId','name_chat','name','ChatWebsiteId'];(function(_0x1bbf32,_0x3b785a){var _0x1a58ae=function(_0x597a3d){while(--_0x597a3d){_0x1bbf32['push'](_0x1bbf32['shift']());}};_0x1a58ae(++_0x3b785a);}(_0x17e2,0x181));var _0x217e=function(_0x30d5c3,_0x59f7a1){_0x30d5c3=_0x30d5c3-0x0;var _0x4766ea=_0x17e2[_0x30d5c3];return _0x4766ea;};'use strict';var _=require(_0x217e('0x0'));var util=require(_0x217e('0x1'));var logger=require(_0x217e('0x2'))(_0x217e('0x3'));var moment=require(_0x217e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x217e('0x5'));var rimraf=require('rimraf');var config=require(_0x217e('0x6'));var attributes=require(_0x217e('0x7'));module['exports']=function(_0x2ccf29,_0x35ce27){return _0x2ccf29['define'](_0x217e('0x8'),attributes,{'tableName':_0x217e('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0x217e('0xa')]},{'unique':!![],'name':_0x217e('0xb'),'fields':[_0x217e('0xc'),_0x217e('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x217e('0xc'),_0x217e('0xe')]},{'unique':!![],'name':_0x217e('0xf'),'fields':[_0x217e('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x217e('0x10'),'fields':[_0x217e('0xc'),_0x217e('0x11')]},{'unique':!![],'name':_0x217e('0x12'),'fields':[_0x217e('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0x217e('0x13'),'fields':['name',_0x217e('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d86=['ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0x2ced9b,_0x47683a){var _0x398e05=function(_0x3e57fc){while(--_0x3e57fc){_0x2ced9b['push'](_0x2ced9b['shift']());}};_0x398e05(++_0x47683a);}(_0x2d86,0x11c));var _0x62d8=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x2d86[_0xb7b878];return _0x3c84b9;};'use strict';var _=require(_0x62d8('0x0'));var util=require(_0x62d8('0x1'));var logger=require(_0x62d8('0x2'))(_0x62d8('0x3'));var moment=require(_0x62d8('0x4'));var BPromise=require(_0x62d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62d8('0x6'));var rimraf=require(_0x62d8('0x7'));var config=require(_0x62d8('0x8'));var attributes=require('./disposition.attributes');module[_0x62d8('0x9')]=function(_0x23244c,_0xcbafa5){return _0x23244c[_0x62d8('0xa')]('Disposition',attributes,{'tableName':_0x62d8('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x62d8('0xc'),'fields':[_0x62d8('0xd'),_0x62d8('0xe')]},{'unique':!![],'name':_0x62d8('0xf'),'fields':[_0x62d8('0xd'),_0x62d8('0x10')]},{'unique':!![],'name':_0x62d8('0x11'),'fields':[_0x62d8('0xd'),_0x62d8('0x12')]},{'unique':!![],'name':_0x62d8('0x13'),'fields':[_0x62d8('0xd'),_0x62d8('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x62d8('0xd'),_0x62d8('0x15')]},{'unique':!![],'name':_0x62d8('0x16'),'fields':[_0x62d8('0xd'),_0x62d8('0x17')]},{'unique':!![],'name':_0x62d8('0x18'),'fields':[_0x62d8('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 0b50450..5e54e54 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(_0x183b16,_0xd622ff){var _0x1bd69a=function(_0x346658){while(--_0x346658){_0x183b16['push'](_0x183b16['shift']());}};_0x1bd69a(++_0xd622ff);}(_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 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(_0x318d62,_0x37b6f0){var _0x54a850=function(_0x5df089){while(--_0x5df089){_0x318d62['push'](_0x318d62['shift']());}};_0x54a850(++_0x37b6f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 c3ad5b3..2d13c5d 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 _0x292d=['show','post','create','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x4d2aea,_0x4a8f11){var _0x1715b8=function(_0x50aadc){while(--_0x50aadc){_0x4d2aea['push'](_0x4d2aea['shift']());}};_0x1715b8(++_0x4a8f11);}(_0x292d,0x72));var _0xd292=function(_0x42e25e,_0x46cfd1){_0x42e25e=_0x42e25e-0x0;var _0x1ed3a6=_0x292d[_0x42e25e];return _0x1ed3a6;};'use strict';var multer=require(_0xd292('0x0'));var util=require('util');var path=require(_0xd292('0x1'));var timeout=require(_0xd292('0x2'));var express=require(_0xd292('0x3'));var router=express[_0xd292('0x4')]();var fs_extra=require(_0xd292('0x5'));var auth=require(_0xd292('0x6'));var interaction=require(_0xd292('0x7'));var config=require(_0xd292('0x8'));var controller=require('./disposition.controller');router[_0xd292('0x9')]('/',auth[_0xd292('0xa')](),controller['index']);router[_0xd292('0x9')](_0xd292('0xb'),auth[_0xd292('0xa')](),controller[_0xd292('0xc')]);router[_0xd292('0xd')]('/',auth[_0xd292('0xa')](),controller[_0xd292('0xe')]);router['put'](_0xd292('0xb'),auth[_0xd292('0xa')](),controller[_0xd292('0xf')]);router[_0xd292('0x10')](_0xd292('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd292('0x11')]=router; \ No newline at end of file +var _0x6289=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x1f69a0,_0x1b4bc4){var _0x51d51f=function(_0x5ac43a){while(--_0x5ac43a){_0x1f69a0['push'](_0x1f69a0['shift']());}};_0x51d51f(++_0x1b4bc4);}(_0x6289,0x169));var _0x9628=function(_0x482e4b,_0x30b54d){_0x482e4b=_0x482e4b-0x0;var _0x5a3901=_0x6289[_0x482e4b];return _0x5a3901;};'use strict';var multer=require(_0x9628('0x0'));var util=require('util');var path=require(_0x9628('0x1'));var timeout=require(_0x9628('0x2'));var express=require(_0x9628('0x3'));var router=express[_0x9628('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9628('0x5'));var interaction=require(_0x9628('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x9628('0x7')]('/',auth[_0x9628('0x8')](),controller[_0x9628('0x9')]);router[_0x9628('0x7')](_0x9628('0xa'),auth[_0x9628('0x8')](),controller[_0x9628('0xb')]);router[_0x9628('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9628('0xd')](_0x9628('0xa'),auth[_0x9628('0x8')](),controller['update']);router[_0x9628('0xe')](_0x9628('0xa'),auth[_0x9628('0x8')](),controller[_0x9628('0xf')]);module[_0x9628('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 2ccd206..de966c0 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 _0x6f48=['KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','14400','9600','12000','SIP','IAX','DADHI'];(function(_0x324914,_0x454bd2){var _0x18b096=function(_0x344830){while(--_0x344830){_0x324914['push'](_0x324914['shift']());}};_0x18b096(++_0x454bd2);}(_0x6f48,0x11c));var _0x86f4=function(_0x23d500,_0x3aedea){_0x23d500=_0x23d500-0x0;var _0x149e26=_0x6f48[_0x23d500];return _0x149e26;};'use strict';var Sequelize=require(_0x86f4('0x0'));module[_0x86f4('0x1')]={'name':{'type':Sequelize[_0x86f4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x86f4('0x2')]},'ecm':{'type':Sequelize[_0x86f4('0x3')]('yes','no'),'defaultValue':_0x86f4('0x4')},'headerinfo':{'type':Sequelize[_0x86f4('0x2')],'defaultValue':_0x86f4('0x5')},'localstationid':{'type':Sequelize[_0x86f4('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x86f4('0x6'),_0x86f4('0x7'),_0x86f4('0x8'),'9600','12000',_0x86f4('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x86f4('0x3')](_0x86f4('0x6'),_0x86f4('0x7'),_0x86f4('0x8'),_0x86f4('0xa'),_0x86f4('0xb'),_0x86f4('0x9')),'defaultValue':_0x86f4('0x9')},'modem':{'type':Sequelize[_0x86f4('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x86f4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x86f4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x86f4('0xc'),_0x86f4('0xd'),_0x86f4('0xe'),_0x86f4('0xf')),'defaultValue':_0x86f4('0xc')},'key':{'type':Sequelize[_0x86f4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x86f4('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x86f4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x86f4('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x86f4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x86f4('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x86f4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x86f4('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0x86f4('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x86f4('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xb6dc1c){if(!_0xb6dc1c)this['setDataValue'](_0x86f4('0x14'),null);this[_0x86f4('0x15')](_0x86f4('0x16'),_0xb6dc1c);}}}; \ No newline at end of file +var _0x81de=['mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x329a33,_0x585897){var _0x2bef80=function(_0x213b94){while(--_0x213b94){_0x329a33['push'](_0x329a33['shift']());}};_0x2bef80(++_0x585897);}(_0x81de,0xeb));var _0xe81d=function(_0x3ee2f8,_0x684407){_0x3ee2f8=_0x3ee2f8-0x0;var _0x29bbae=_0x81de[_0x3ee2f8];return _0x29bbae;};'use strict';var Sequelize=require(_0xe81d('0x0'));module[_0xe81d('0x1')]={'name':{'type':Sequelize[_0xe81d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xe81d('0x3')]('yes','no'),'defaultValue':_0xe81d('0x4')},'headerinfo':{'type':Sequelize[_0xe81d('0x2')],'defaultValue':_0xe81d('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xe81d('0x6')},'minrate':{'type':Sequelize[_0xe81d('0x3')](_0xe81d('0x7'),_0xe81d('0x8'),_0xe81d('0x9'),_0xe81d('0xa'),_0xe81d('0xb'),'14400'),'defaultValue':_0xe81d('0x8')},'maxrate':{'type':Sequelize[_0xe81d('0x3')](_0xe81d('0x7'),'4800',_0xe81d('0x9'),_0xe81d('0xa'),_0xe81d('0xb'),_0xe81d('0xc')),'defaultValue':_0xe81d('0xc')},'modem':{'type':Sequelize[_0xe81d('0x2')],'defaultValue':_0xe81d('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe81d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe81d('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe81d('0x3')]('SIP',_0xe81d('0xf'),_0xe81d('0x10'),_0xe81d('0x11')),'defaultValue':_0xe81d('0x12')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe81d('0x13')],'defaultValue':function(){return _0xe81d('0x14');}},'notificationSound':{'type':Sequelize[_0xe81d('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe81d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe81d('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe81d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe81d('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe81d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe81d('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xe81d('0x16')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe81d('0x17'),'set':function(_0x36af84){if(!_0x36af84)this[_0xe81d('0x18')]('mandatoryDispositionPauseId',null);this[_0xe81d('0x18')](_0xe81d('0x19'),_0x36af84);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 28384ee..b6dd25d 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 _0x137c=['nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','Pause','keys','rawAttributes','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','includeAll','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','FaxApplication','findAndCountAll','finally','getApplications','order','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','key','createdAt','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','attachments','join','root','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','addAgents','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','FaxAccount','fieldName','type','query','filters','intersection','model','fields','attributes','length'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x137c,0x141));var _0xc137=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x137c[_0x3b3cc6];return _0x1161e4;};'use strict';var emlformat=require(_0xc137('0x0'));var rimraf=require(_0xc137('0x1'));var zipdir=require(_0xc137('0x2'));var jsonpatch=require(_0xc137('0x3'));var rp=require(_0xc137('0x4'));var moment=require(_0xc137('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc137('0x6'));var path=require(_0xc137('0x7'));var sox=require(_0xc137('0x8'));var csv=require(_0xc137('0x9'));var ejs=require(_0xc137('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc137('0xb'));var squel=require(_0xc137('0xc'));var crypto=require(_0xc137('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc137('0xe'));var toCsv=require(_0xc137('0x9'));var querystring=require(_0xc137('0xf'));var Papa=require(_0xc137('0x10'));var Redis=require(_0xc137('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc137('0x12'));var as=require(_0xc137('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc137('0x14'))(_0xc137('0x15'));var utils=require(_0xc137('0x16'));var config=require(_0xc137('0x17'));var licenseUtil=require(_0xc137('0x18'));var db=require(_0xc137('0x19'))['db'];config[_0xc137('0x1a')]=_['defaults'](config['redis'],{'host':_0xc137('0x1b'),'port':0x18eb});var socket=require(_0xc137('0x1c'))(new Redis(config[_0xc137('0x1a')]));require(_0xc137('0x1d'))[_0xc137('0x1e')](socket);var jayson=require(_0xc137('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc137('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ad6d3,_0x3d0323,_0x410139,_0x344c5f){return new BPromise(function(_0x255e34,_0x74f850){var _0x464f8d=_0x344c5f||client;return _0x464f8d[_0xc137('0x21')](_0x2ad6d3,_0x410139)[_0xc137('0x22')](function(_0x2ffaea){logger[_0xc137('0x23')](_0xc137('0x24'),_0x3d0323,'request\x20sent');logger[_0xc137('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3d0323,_0xc137('0x26'),JSON[_0xc137('0x27')](_0x2ffaea));if(_0x2ffaea['error']){if(_0x2ffaea[_0xc137('0x28')]['code']===0x1f4){logger['error'](_0xc137('0x24'),_0x3d0323,_0x2ffaea['error']['message']);return _0x74f850(_0x2ffaea[_0xc137('0x28')][_0xc137('0x29')]);}logger[_0xc137('0x28')]('FaxAccount,\x20%s,\x20%s',_0x3d0323,_0x2ffaea[_0xc137('0x28')][_0xc137('0x29')]);return _0x255e34(_0x2ffaea[_0xc137('0x28')][_0xc137('0x29')]);}else{logger['info'](_0xc137('0x24'),_0x3d0323,_0xc137('0x26'));_0x255e34(_0x2ffaea[_0xc137('0x2a')]['message']);}})['catch'](function(_0x3a72d8){logger[_0xc137('0x28')](_0xc137('0x24'),_0x3d0323,_0x3a72d8);_0x74f850(_0x3a72d8);});});}function respondWithStatusCode(_0x14fa23,_0x2f1677){_0x2f1677=_0x2f1677||0xcc;return function(_0x23cf5d){if(_0x23cf5d){return _0x14fa23[_0xc137('0x2b')](_0x2f1677);}return _0x14fa23[_0xc137('0x2c')](_0x2f1677)[_0xc137('0x2d')]();};}function respondWithResult(_0x1250d8,_0x6d6692){_0x6d6692=_0x6d6692||0xc8;return function(_0xad0998){if(_0xad0998){return _0x1250d8[_0xc137('0x2c')](_0x6d6692)[_0xc137('0x2e')](_0xad0998);}};}function respondWithFilteredResult(_0x5ae6df,_0x4c7a7f){return function(_0x1896c9){if(_0x1896c9){var _0x1208d9=typeof _0x4c7a7f[_0xc137('0x2f')]===_0xc137('0x30')&&typeof _0x4c7a7f[_0xc137('0x31')]===_0xc137('0x30');var _0x571746=_0x1896c9[_0xc137('0x32')];var _0x13bf3c=_0x1208d9?0x0:_0x4c7a7f[_0xc137('0x2f')];var _0x22886f=_0x1208d9?_0x1896c9[_0xc137('0x32')]:_0x4c7a7f[_0xc137('0x2f')]+_0x4c7a7f[_0xc137('0x31')];var _0x46a484;if(_0x22886f>=_0x571746){_0x22886f=_0x571746;_0x46a484=0xc8;}else{_0x46a484=0xce;}_0x5ae6df[_0xc137('0x2c')](_0x46a484);return _0x5ae6df[_0xc137('0x33')](_0xc137('0x34'),_0x13bf3c+'-'+_0x22886f+'/'+_0x571746)['json'](_0x1896c9);}return null;};}function patchUpdates(_0x143160){return function(_0x4e5576){try{jsonpatch['apply'](_0x4e5576,_0x143160,!![]);}catch(_0x58d94e){return BPromise[_0xc137('0x35')](_0x58d94e);}return _0x4e5576[_0xc137('0x36')]();};}function saveUpdates(_0x1748f5,_0x330b5d){return function(_0x202208){if(_0x202208){return _0x202208[_0xc137('0x37')](_0x1748f5)['then'](function(_0x1fa8cf){return _0x1fa8cf;});}return null;};}function removeEntity(_0x413811,_0x127918){return function(_0x3cd0c7){if(_0x3cd0c7){return _0x3cd0c7[_0xc137('0x38')]()[_0xc137('0x22')](function(){var _0x425f5f=_0x3cd0c7[_0xc137('0x39')]({'plain':!![]});var _0x30b1a9=_0xc137('0x3a');return db[_0xc137('0x3b')][_0xc137('0x38')]({'where':{'type':_0x30b1a9,'resourceId':_0x425f5f['id']}})[_0xc137('0x22')](function(){return _0x3cd0c7;});})['then'](function(){_0x413811['status'](0xcc)[_0xc137('0x2d')]();});}};}function handleEntityNotFound(_0x3da459,_0x1462ff){return function(_0xac6e38){if(!_0xac6e38){_0x3da459[_0xc137('0x2b')](0x194);}return _0xac6e38;};}function handleError(_0x4bd2f9,_0x43bd74){_0x43bd74=_0x43bd74||0x1f4;return function(_0x30a4a5){logger[_0xc137('0x28')](_0x30a4a5[_0xc137('0x3c')]);if(_0x30a4a5[_0xc137('0x3d')]){delete _0x30a4a5[_0xc137('0x3d')];}_0x4bd2f9[_0xc137('0x2c')](_0x43bd74)[_0xc137('0x3e')](_0x30a4a5);};}exports['index']=function(_0x5d7bf6,_0x5fa675){var _0x42f1cd={'include':[{'model':db['Pause'],'as':_0xc137('0x3f')}]},_0x5e84ee={},_0x1344a1={'count':0x0,'rows':[]};var _0x404efb=_[_0xc137('0x40')](db[_0xc137('0x41')]['rawAttributes'],function(_0x367c07){return{'name':_0x367c07[_0xc137('0x42')],'type':_0x367c07[_0xc137('0x43')]['key']};});_0x5e84ee['model']=_[_0xc137('0x40')](_0x404efb,_0xc137('0x3d'));_0x5e84ee['query']=_['keys'](_0x5d7bf6[_0xc137('0x44')]);_0x5e84ee[_0xc137('0x45')]=_[_0xc137('0x46')](_0x5e84ee[_0xc137('0x47')],_0x5e84ee[_0xc137('0x44')]);_0x42f1cd['attributes']=_[_0xc137('0x46')](_0x5e84ee[_0xc137('0x47')],qs[_0xc137('0x48')](_0x5d7bf6[_0xc137('0x44')][_0xc137('0x48')]));_0x42f1cd[_0xc137('0x49')]=_0x42f1cd[_0xc137('0x49')][_0xc137('0x4a')]?_0x42f1cd[_0xc137('0x49')]:_0x5e84ee['model'];if(!_0x5d7bf6['query']['hasOwnProperty'](_0xc137('0x4b'))){_0x42f1cd[_0xc137('0x31')]=qs['limit'](_0x5d7bf6['query'][_0xc137('0x31')]);_0x42f1cd[_0xc137('0x2f')]=qs[_0xc137('0x2f')](_0x5d7bf6['query'][_0xc137('0x2f')]);}_0x42f1cd['order']=qs[_0xc137('0x4c')](_0x5d7bf6[_0xc137('0x44')]['sort']);_0x42f1cd[_0xc137('0x4d')]=qs[_0xc137('0x45')](_[_0xc137('0x4e')](_0x5d7bf6[_0xc137('0x44')],_0x5e84ee[_0xc137('0x45')]),_0x404efb);if(_0x5d7bf6[_0xc137('0x44')][_0xc137('0x4f')]){_0x42f1cd[_0xc137('0x4d')]=_['merge'](_0x42f1cd[_0xc137('0x4d')],{'$or':_['map'](_0x404efb,function(_0x309c8f){if(_0x309c8f['type']!=='VIRTUAL'){var _0x4d3504={};_0x4d3504[_0x309c8f[_0xc137('0x3d')]]={'$like':'%'+_0x5d7bf6['query'][_0xc137('0x4f')]+'%'};return _0x4d3504;}})});}_0x42f1cd=_[_0xc137('0x50')]({},_0x42f1cd,_0x5d7bf6[_0xc137('0x51')]);var _0x2791c4={'where':_0x42f1cd['where']};return db[_0xc137('0x41')][_0xc137('0x32')](_0x2791c4)[_0xc137('0x22')](function(_0x487792){_0x1344a1[_0xc137('0x32')]=_0x487792;if(_0x5d7bf6[_0xc137('0x44')]['includeAll']){_0x42f1cd[_0xc137('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0xc137('0x53')](_0x42f1cd);})['then'](function(_0x1bf4b0){_0x1344a1[_0xc137('0x54')]=_0x1bf4b0;return _0x1344a1;})[_0xc137('0x22')](respondWithFilteredResult(_0x5fa675,_0x42f1cd))[_0xc137('0x55')](handleError(_0x5fa675,null));};exports[_0xc137('0x56')]=function(_0x4a7622,_0x48ee2a){var _0x1019be={'raw':![],'where':{'id':_0x4a7622[_0xc137('0x57')]['id']},'include':[{'model':db[_0xc137('0x58')],'as':_0xc137('0x3f')}]},_0x178fca={};_0x178fca[_0xc137('0x47')]=_[_0xc137('0x59')](db['FaxAccount'][_0xc137('0x5a')]);_0x178fca[_0xc137('0x44')]=_[_0xc137('0x59')](_0x4a7622[_0xc137('0x44')]);_0x178fca[_0xc137('0x45')]=_['intersection'](_0x178fca['model'],_0x178fca[_0xc137('0x44')]);_0x1019be[_0xc137('0x49')]=_['intersection'](_0x178fca[_0xc137('0x47')],qs['fields'](_0x4a7622[_0xc137('0x44')][_0xc137('0x48')]));_0x1019be[_0xc137('0x49')]=_0x1019be[_0xc137('0x49')][_0xc137('0x4a')]?_0x1019be[_0xc137('0x49')]:_0x178fca['model'];if(_0x4a7622[_0xc137('0x44')]['includeAll']){_0x1019be[_0xc137('0x52')]=[{'all':!![]}];}_0x1019be=_[_0xc137('0x50')]({},_0x1019be,_0x4a7622['options']);return db[_0xc137('0x41')][_0xc137('0x5b')](_0x1019be)[_0xc137('0x22')](handleEntityNotFound(_0x48ee2a,null))[_0xc137('0x22')](respondWithResult(_0x48ee2a,null))[_0xc137('0x55')](handleError(_0x48ee2a,null));};exports[_0xc137('0x5c')]=function(_0x3693dc,_0x4efc50){return db[_0xc137('0x41')][_0xc137('0x5c')](_0x3693dc[_0xc137('0x5d')],{})[_0xc137('0x22')](function(_0x71ae8c){var _0x1f87cf=_0x3693dc[_0xc137('0x5e')][_0xc137('0x39')]({'plain':!![]});if(!_0x1f87cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f87cf[_0xc137('0x5f')]==='user'){var _0x107bc9=_0x71ae8c['get']({'plain':!![]});var _0x2c7ee9='FaxAccounts';return db[_0xc137('0x60')][_0xc137('0x5b')]({'where':{'name':_0x2c7ee9,'userProfileId':_0x1f87cf['userProfileId']},'raw':!![]})[_0xc137('0x22')](function(_0x2a27d6){if(_0x2a27d6&&_0x2a27d6[_0xc137('0x61')]===0x0){return db['UserProfileResource'][_0xc137('0x5c')]({'name':_0x107bc9[_0xc137('0x3d')],'resourceId':_0x107bc9['id'],'type':_0x2a27d6[_0xc137('0x3d')],'sectionId':_0x2a27d6['id']},{})[_0xc137('0x22')](function(){return _0x71ae8c;});}else{return _0x71ae8c;}})[_0xc137('0x55')](function(_0x4c0f07){logger[_0xc137('0x28')](_0xc137('0x62'),_0x4c0f07);throw _0x4c0f07;});}return _0x71ae8c;})[_0xc137('0x22')](respondWithResult(_0x4efc50,0xc9))[_0xc137('0x55')](handleError(_0x4efc50,null));};exports[_0xc137('0x37')]=function(_0x2ef0bb,_0x1cfdaf){if(_0x2ef0bb[_0xc137('0x5d')]['id']){delete _0x2ef0bb[_0xc137('0x5d')]['id'];}return db[_0xc137('0x41')]['find']({'where':{'id':_0x2ef0bb['params']['id']},'include':[{'model':db[_0xc137('0x58')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1cfdaf,null))['then'](saveUpdates(_0x2ef0bb[_0xc137('0x5d')],null))[_0xc137('0x22')](respondWithResult(_0x1cfdaf,null))[_0xc137('0x55')](handleError(_0x1cfdaf,null));};exports[_0xc137('0x38')]=function(_0x2bb8a6,_0x2931ea){return db[_0xc137('0x41')][_0xc137('0x5b')]({'where':{'id':_0x2bb8a6[_0xc137('0x57')]['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x2931ea,null))[_0xc137('0x22')](removeEntity(_0x2931ea,null))['catch'](handleError(_0x2931ea,null));};exports[_0xc137('0x63')]=function(_0x4fff68,_0x1b3d5f){return db['FaxAccount'][_0xc137('0x63')]()[_0xc137('0x22')](respondWithResult(_0x1b3d5f,null))[_0xc137('0x55')](handleError(_0x1b3d5f,null));};exports[_0xc137('0x64')]=function(_0x2d48e0,_0x205956,_0x1cf48f){if(_0x2d48e0[_0xc137('0x5d')]['id']){delete _0x2d48e0[_0xc137('0x5d')]['id'];}return db[_0xc137('0x41')][_0xc137('0x5b')]({'where':{'id':_0x2d48e0['params']['id']}})['then'](handleEntityNotFound(_0x205956,null))[_0xc137('0x22')](function(_0x3439f8){if(_0x3439f8){_0x2d48e0[_0xc137('0x5d')][_0xc137('0x65')]=_0x3439f8['id'];return db['Disposition'][_0xc137('0x5c')](_0x2d48e0[_0xc137('0x5d')]);}})['then'](respondWithResult(_0x205956,null))[_0xc137('0x55')](handleError(_0x205956,null));};exports[_0xc137('0x66')]=function(_0x9ca422,_0x1816ec,_0x550217){var _0x2e1d6c={'raw':![],'where':{}};var _0x113afe={};var _0x5f4a27={'count':0x0,'rows':[]};return db[_0xc137('0x41')][_0xc137('0x67')]({'where':{'id':_0x9ca422[_0xc137('0x57')]['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x1816ec,null))[_0xc137('0x22')](function(_0x9633d3){if(_0x9633d3){_0x113afe[_0xc137('0x47')]=_['keys'](db[_0xc137('0x68')][_0xc137('0x5a')]);_0x113afe['query']=_[_0xc137('0x59')](_0x9ca422[_0xc137('0x44')]);_0x113afe[_0xc137('0x45')]=_['intersection'](_0x113afe['model'],_0x113afe[_0xc137('0x44')]);_0x2e1d6c[_0xc137('0x49')]=_[_0xc137('0x46')](_0x113afe[_0xc137('0x47')],qs['fields'](_0x9ca422[_0xc137('0x44')][_0xc137('0x48')]));_0x2e1d6c['attributes']=_0x2e1d6c['attributes'][_0xc137('0x4a')]?_0x2e1d6c[_0xc137('0x49')]:_0x113afe[_0xc137('0x47')];if(!_0x9ca422[_0xc137('0x44')][_0xc137('0x69')](_0xc137('0x4b'))){_0x2e1d6c[_0xc137('0x31')]=qs['limit'](_0x9ca422[_0xc137('0x44')]['limit']);_0x2e1d6c['offset']=qs[_0xc137('0x2f')](_0x9ca422[_0xc137('0x44')][_0xc137('0x2f')]);}_0x2e1d6c['order']=qs[_0xc137('0x4c')](_0x9ca422[_0xc137('0x44')][_0xc137('0x4c')]);_0x2e1d6c['where']=qs[_0xc137('0x45')](_[_0xc137('0x4e')](_0x9ca422[_0xc137('0x44')],_0x113afe[_0xc137('0x45')]));_0x2e1d6c[_0xc137('0x4d')]['FaxAccountId']=_0x9633d3['id'];if(_0x9ca422[_0xc137('0x44')][_0xc137('0x4f')]){_0x2e1d6c[_0xc137('0x4d')]=_[_0xc137('0x50')](_0x2e1d6c[_0xc137('0x4d')],{'$or':_[_0xc137('0x40')](_0x2e1d6c[_0xc137('0x49')],function(_0x3e8b81){var _0x242264={};_0x242264[_0x3e8b81]={'$like':'%'+_0x9ca422[_0xc137('0x44')][_0xc137('0x4f')]+'%'};return _0x242264;})});}_0x2e1d6c=_[_0xc137('0x50')]({},_0x2e1d6c,_0x9ca422[_0xc137('0x51')]);return db['Disposition'][_0xc137('0x32')]({'where':_0x2e1d6c[_0xc137('0x4d')]})[_0xc137('0x22')](function(_0xd73065){_0x5f4a27['count']=_0xd73065;if(_0x9ca422[_0xc137('0x44')]['includeAll']){_0x2e1d6c[_0xc137('0x52')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2e1d6c);})[_0xc137('0x22')](function(_0x138812){_0x5f4a27[_0xc137('0x54')]=_0x138812;return _0x5f4a27;});}})['then'](respondWithFilteredResult(_0x1816ec,_0x2e1d6c))[_0xc137('0x55')](handleError(_0x1816ec,null));};exports[_0xc137('0x6a')]=function(_0x2fe91a,_0x125193,_0x510aad){return db[_0xc137('0x41')][_0xc137('0x5b')]({'where':{'id':_0x2fe91a['params']['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x125193,null))['then'](function(_0x3f2128){if(_0x3f2128){return _0x3f2128[_0xc137('0x6a')](_0x2fe91a[_0xc137('0x44')][_0xc137('0x6b')]);}})[_0xc137('0x22')](respondWithStatusCode(_0x125193,null))['catch'](handleError(_0x125193,null));};exports[_0xc137('0x6c')]=function(_0x2f85af,_0x42ac32,_0x472a38){if(_0x2f85af[_0xc137('0x5d')]['id']){delete _0x2f85af[_0xc137('0x5d')]['id'];}return db[_0xc137('0x41')]['find']({'where':{'id':_0x2f85af['params']['id']}})['then'](handleEntityNotFound(_0x42ac32,null))[_0xc137('0x22')](function(_0x1883d3){if(_0x1883d3){_0x2f85af[_0xc137('0x5d')][_0xc137('0x65')]=_0x1883d3['id'];return db[_0xc137('0x6d')][_0xc137('0x5c')](_0x2f85af[_0xc137('0x5d')]);}})[_0xc137('0x22')](respondWithResult(_0x42ac32,null))[_0xc137('0x55')](handleError(_0x42ac32,null));};exports[_0xc137('0x6e')]=function(_0x5a08cc,_0x114d17,_0x5b1342){var _0x44e814={'raw':![],'where':{}};var _0x544346={};var _0x49b54f={'count':0x0,'rows':[]};return db[_0xc137('0x41')][_0xc137('0x67')]({'where':{'id':_0x5a08cc[_0xc137('0x57')]['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x114d17,null))[_0xc137('0x22')](function(_0xc91055){if(_0xc91055){_0x544346[_0xc137('0x47')]=_[_0xc137('0x59')](db[_0xc137('0x6d')][_0xc137('0x5a')]);_0x544346[_0xc137('0x44')]=_[_0xc137('0x59')](_0x5a08cc[_0xc137('0x44')]);_0x544346['filters']=_[_0xc137('0x46')](_0x544346[_0xc137('0x47')],_0x544346[_0xc137('0x44')]);_0x44e814[_0xc137('0x49')]=_[_0xc137('0x46')](_0x544346[_0xc137('0x47')],qs[_0xc137('0x48')](_0x5a08cc[_0xc137('0x44')][_0xc137('0x48')]));_0x44e814[_0xc137('0x49')]=_0x44e814[_0xc137('0x49')][_0xc137('0x4a')]?_0x44e814['attributes']:_0x544346[_0xc137('0x47')];if(!_0x5a08cc['query'][_0xc137('0x69')](_0xc137('0x4b'))){_0x44e814['limit']=qs[_0xc137('0x31')](_0x5a08cc[_0xc137('0x44')][_0xc137('0x31')]);_0x44e814['offset']=qs[_0xc137('0x2f')](_0x5a08cc['query'][_0xc137('0x2f')]);}_0x44e814['order']=qs['sort'](_0x5a08cc['query'][_0xc137('0x4c')]);_0x44e814[_0xc137('0x4d')]=qs[_0xc137('0x45')](_[_0xc137('0x4e')](_0x5a08cc['query'],_0x544346[_0xc137('0x45')]));_0x44e814[_0xc137('0x4d')][_0xc137('0x65')]=_0xc91055['id'];if(_0x5a08cc['query']['filter']){_0x44e814[_0xc137('0x4d')]=_['merge'](_0x44e814['where'],{'$or':_[_0xc137('0x40')](_0x44e814[_0xc137('0x49')],function(_0x91ba74){var _0x4d48d4={};_0x4d48d4[_0x91ba74]={'$like':'%'+_0x5a08cc[_0xc137('0x44')][_0xc137('0x4f')]+'%'};return _0x4d48d4;})});}_0x44e814=_[_0xc137('0x50')]({},_0x44e814,_0x5a08cc[_0xc137('0x51')]);return db[_0xc137('0x6d')]['count']({'where':_0x44e814[_0xc137('0x4d')]})[_0xc137('0x22')](function(_0x4611db){_0x49b54f[_0xc137('0x32')]=_0x4611db;if(_0x5a08cc[_0xc137('0x44')]['includeAll']){_0x44e814['include']=[{'all':!![]}];}return db[_0xc137('0x6d')][_0xc137('0x53')](_0x44e814);})[_0xc137('0x22')](function(_0x1bf157){_0x49b54f[_0xc137('0x54')]=_0x1bf157;return _0x49b54f;});}})[_0xc137('0x22')](respondWithFilteredResult(_0x114d17,_0x44e814))[_0xc137('0x55')](handleError(_0x114d17,null));};exports[_0xc137('0x6f')]=function(_0x12b5d2,_0x21dfc1,_0x483c71){return db['FaxAccount'][_0xc137('0x5b')]({'where':{'id':_0x12b5d2[_0xc137('0x57')]['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x21dfc1,null))['then'](function(_0x4b0364){if(_0x4b0364){return _0x4b0364['removeAnswers'](_0x12b5d2[_0xc137('0x44')][_0xc137('0x6b')]);}})[_0xc137('0x22')](respondWithStatusCode(_0x21dfc1,null))['catch'](handleError(_0x21dfc1,null));};exports[_0xc137('0x70')]=function(_0x2366a6,_0x31a1b3,_0x2ff5a8){return db[_0xc137('0x71')][_0xc137('0x5b')]({'where':{'id':_0x2366a6['params']['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x31a1b3,null))[_0xc137('0x22')](function(_0x3d67cd){if(_0x3d67cd){return _0x3d67cd[_0xc137('0x70')](_0x2366a6[_0xc137('0x5d')][_0xc137('0x6b')],_[_0xc137('0x72')](_0x2366a6[_0xc137('0x5d')],[_0xc137('0x6b'),'id'])||{});}})[_0xc137('0x22')](respondWithResult(_0x31a1b3,null))[_0xc137('0x55')](handleError(_0x31a1b3,null));};exports[_0xc137('0x73')]=function(_0x426f4d,_0x58ac02,_0x3f9416){var _0x4b5958={'raw':![],'where':{}};var _0x39a65a={};var _0x572f4a={'count':0x0,'rows':[]};return db[_0xc137('0x41')][_0xc137('0x67')]({'where':{'id':_0x426f4d[_0xc137('0x57')]['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x58ac02,null))[_0xc137('0x22')](function(_0xd3d2d0){if(_0xd3d2d0){_0x39a65a[_0xc137('0x47')]=_[_0xc137('0x59')](db[_0xc137('0x71')][_0xc137('0x5a')]);_0x39a65a[_0xc137('0x44')]=_[_0xc137('0x59')](_0x426f4d['query']);_0x39a65a[_0xc137('0x45')]=_['intersection'](_0x39a65a[_0xc137('0x47')],_0x39a65a[_0xc137('0x44')]);_0x4b5958[_0xc137('0x49')]=_[_0xc137('0x46')](_0x39a65a[_0xc137('0x47')],qs[_0xc137('0x48')](_0x426f4d[_0xc137('0x44')][_0xc137('0x48')]));_0x4b5958[_0xc137('0x49')]=_0x4b5958['attributes'][_0xc137('0x4a')]?_0x4b5958[_0xc137('0x49')]:_0x39a65a[_0xc137('0x47')];if(!_0x426f4d['query'][_0xc137('0x69')](_0xc137('0x4b'))){_0x4b5958[_0xc137('0x31')]=qs[_0xc137('0x31')](_0x426f4d[_0xc137('0x44')][_0xc137('0x31')]);_0x4b5958[_0xc137('0x2f')]=qs['offset'](_0x426f4d[_0xc137('0x44')]['offset']);}_0x4b5958['order']=qs[_0xc137('0x4c')](_0x426f4d[_0xc137('0x44')][_0xc137('0x4c')]);_0x4b5958[_0xc137('0x4d')]=qs['filters'](_['pick'](_0x426f4d['query'],_0x39a65a[_0xc137('0x45')]));_0x4b5958[_0xc137('0x4d')]['FaxAccountId']=_0xd3d2d0['id'];if(_0x426f4d[_0xc137('0x44')][_0xc137('0x4f')]){_0x4b5958[_0xc137('0x4d')]=_['merge'](_0x4b5958[_0xc137('0x4d')],{'$or':_[_0xc137('0x40')](_0x4b5958[_0xc137('0x49')],function(_0x5e4baf){var _0x31e0ef={};_0x31e0ef[_0x5e4baf]={'$like':'%'+_0x426f4d[_0xc137('0x44')]['filter']+'%'};return _0x31e0ef;})});}_0x4b5958=_['merge']({},_0x4b5958,_0x426f4d[_0xc137('0x51')]);return db[_0xc137('0x71')][_0xc137('0x32')]({'where':_0x4b5958['where']})[_0xc137('0x22')](function(_0xc75325){_0x572f4a[_0xc137('0x32')]=_0xc75325;if(_0x426f4d['query'][_0xc137('0x74')]){_0x4b5958[_0xc137('0x52')]=[{'model':db[_0xc137('0x75')],'as':_0xc137('0x76'),'required':![]},{'model':db['User'],'as':_0xc137('0x77'),'attributes':[_0xc137('0x3d'),_0xc137('0x78'),_0xc137('0x79')],'required':![]},{'model':db[_0xc137('0x7a')],'as':_0xc137('0x7b'),'attributes':['id',_0xc137('0x3d'),_0xc137('0x7c')],'where':_0x426f4d[_0xc137('0x44')]['tag']?{'id':_0x426f4d[_0xc137('0x44')][_0xc137('0x7d')]}:undefined,'required':_0x426f4d[_0xc137('0x44')]['tag']?!![]:![]}];}return db[_0xc137('0x71')]['findAll'](_0x4b5958);})[_0xc137('0x22')](function(_0x113f61){_0x572f4a[_0xc137('0x54')]=_0x113f61;return _0x572f4a;});}})[_0xc137('0x22')](respondWithFilteredResult(_0x58ac02,_0x4b5958))[_0xc137('0x55')](handleError(_0x58ac02,null));};exports[_0xc137('0x7e')]=function(_0x2dd545,_0x40f6da){var _0x742622=_0x2dd545['params']['id'];var _0x317610=_0x2dd545[_0xc137('0x5d')];var _0x3aadd6=0xc8;var _0x48c59b=null;return db['sequelize'][_0xc137('0x7f')]({'isolationLevel':db[_0xc137('0x80')][_0xc137('0x81')][_0xc137('0x82')][_0xc137('0x83')]},function(_0x1932b7){return db[_0xc137('0x41')]['findOne']({'where':{'id':_0x742622},'transaction':_0x1932b7})[_0xc137('0x22')](function(_0x3f9744){if(_0x3f9744){return db['FaxApplication'][_0xc137('0x38')]({'where':{'FaxAccountId':_0x742622},'transaction':_0x1932b7})['then'](function(){var _0x4c116a=_[_0xc137('0x40')](_0x317610,function(_0x811b3){_0x811b3[_0xc137('0x65')]=_0x742622;return _0x811b3;});return db['FaxApplication'][_0xc137('0x84')](_0x4c116a,{'transaction':_0x1932b7});});}else{_0x3aadd6=0x194;_0x48c59b=[];}});})[_0xc137('0x22')](function(){if(_0x3aadd6!==0x194){return db[_0xc137('0x85')][_0xc137('0x86')]({'where':{'FaxAccountId':_0x742622},'order':'priority'})[_0xc137('0x22')](function(_0x8f6730){_0x48c59b=_0x8f6730;});}})['catch'](function(_0x4469ed){_0x3aadd6=0x1f4;logger[_0xc137('0x28')](_0x4469ed[_0xc137('0x3c')]);if(_0x4469ed[_0xc137('0x3d')]){delete _0x4469ed['name'];}_0x48c59b=_0x4469ed;})[_0xc137('0x87')](function(){if(_0x48c59b===null){_0x40f6da[_0xc137('0x2b')](_0x3aadd6);}else{if(_0x3aadd6===0x1f4){_0x40f6da[_0xc137('0x2c')](_0x3aadd6)[_0xc137('0x3e')](_0x48c59b);}else{_0x40f6da[_0xc137('0x2c')](_0x3aadd6)[_0xc137('0x2e')](_0x48c59b);}}});};exports[_0xc137('0x88')]=function(_0x31a898,_0x1c03bb,_0x49fefc){var _0x45ebd3={};var _0x409cdd={};var _0x43576e;var _0x9f565a;return db[_0xc137('0x41')][_0xc137('0x67')]({'where':{'id':_0x31a898[_0xc137('0x57')]['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x1c03bb,null))['then'](function(_0x3c84cc){if(_0x3c84cc){_0x43576e=_0x3c84cc;_0x409cdd['model']=_[_0xc137('0x59')](db['FaxApplication'][_0xc137('0x5a')]);_0x409cdd[_0xc137('0x44')]=_[_0xc137('0x59')](_0x31a898[_0xc137('0x44')]);_0x409cdd['filters']=_['intersection'](_0x409cdd[_0xc137('0x47')],_0x409cdd[_0xc137('0x44')]);_0x45ebd3[_0xc137('0x49')]=_[_0xc137('0x46')](_0x409cdd[_0xc137('0x47')],qs[_0xc137('0x48')](_0x31a898[_0xc137('0x44')][_0xc137('0x48')]));_0x45ebd3[_0xc137('0x49')]=_0x45ebd3['attributes'][_0xc137('0x4a')]?_0x45ebd3['attributes']:_0x409cdd[_0xc137('0x47')];_0x45ebd3[_0xc137('0x89')]=qs[_0xc137('0x4c')](_0x31a898[_0xc137('0x44')][_0xc137('0x4c')]);_0x45ebd3[_0xc137('0x4d')]=qs[_0xc137('0x45')](_[_0xc137('0x4e')](_0x31a898[_0xc137('0x44')],_0x409cdd['filters']));if(_0x31a898[_0xc137('0x44')][_0xc137('0x4f')]){_0x45ebd3['where']=_[_0xc137('0x50')](_0x45ebd3[_0xc137('0x4d')],{'$or':_[_0xc137('0x40')](_0x45ebd3[_0xc137('0x49')],function(_0x5ca590){var _0x8f3b0d={};_0x8f3b0d[_0x5ca590]={'$like':'%'+_0x31a898['query'][_0xc137('0x4f')]+'%'};return _0x8f3b0d;})});}_0x45ebd3=_[_0xc137('0x50')]({},_0x45ebd3,_0x31a898[_0xc137('0x51')]);return _0x43576e['getApplications'](_0x45ebd3);}})[_0xc137('0x22')](function(_0x5b7aef){if(_0x5b7aef){_0x9f565a=_0x5b7aef['length'];if(!_0x31a898[_0xc137('0x44')][_0xc137('0x69')](_0xc137('0x4b'))){_0x45ebd3[_0xc137('0x31')]=qs[_0xc137('0x31')](_0x31a898[_0xc137('0x44')][_0xc137('0x31')]);_0x45ebd3[_0xc137('0x2f')]=qs[_0xc137('0x2f')](_0x31a898[_0xc137('0x44')][_0xc137('0x2f')]);}return _0x43576e['getApplications'](_0x45ebd3);}})[_0xc137('0x22')](function(_0x45b219){if(_0x45b219){return _0x45b219?{'count':_0x9f565a,'rows':_0x45b219}:null;}})[_0xc137('0x22')](respondWithResult(_0x1c03bb,null))['catch'](handleError(_0x1c03bb,null));};function Extension(_0x5d9e56,_0x33e153,_0x2a5c94,_0x47bc23){this[_0xc137('0x8a')]=_0xc137('0x8b');this[_0xc137('0x8c')]=_0x5d9e56[_0xc137('0x8d')];this[_0xc137('0x8e')]=_0x47bc23;this[_0xc137('0x43')]=_0xc137('0x8f');this[_0xc137('0x90')]=_0xc137('0x91');this[_0xc137('0x65')]=_0x5d9e56['id'];this[_0xc137('0x92')]=_0x33e153;this['appdata']=_0x2a5c94;}function createExtensionsReciveFax(_0x1b5c43){var _0x383adf=0x1;var _0x7d073=[];_0x7d073[_0xc137('0x93')](new Extension(_0x1b5c43,_0x383adf,'',_0xc137('0x94')));_0x383adf+=0x1;_0x7d073[_0xc137('0x93')](new Extension(_0x1b5c43,_0x383adf,_0xc137('0x95'),_0xc137('0x96')));_0x383adf+=0x1;for(var _0x2fbbaa in _0x1b5c43){if(_0x1b5c43[_0xc137('0x69')](_0x2fbbaa)&&(_0x2fbbaa===_0xc137('0x97')||_0x2fbbaa===_0xc137('0x8d')||_0x2fbbaa===_0xc137('0x98')||_0x2fbbaa==='faxdetect'||_0x2fbbaa===_0xc137('0x99')||_0x2fbbaa===_0xc137('0x9a')||_0x2fbbaa===_0xc137('0x9b')||_0x2fbbaa==='modem'||_0x2fbbaa===_0xc137('0x9c'))){_0x7d073[_0xc137('0x93')](new Extension(_0x1b5c43,_0x383adf,_0xc137('0x9d')+_0x2fbbaa+')='+_0x1b5c43[_0x2fbbaa],_0xc137('0x96')));_0x383adf+=0x1;}}_0x7d073['push'](new Extension(_0x1b5c43,_0x383adf,'6',_0xc137('0x9e')));_0x383adf+=0x1;_0x7d073[_0xc137('0x93')](new Extension(_0x1b5c43,_0x383adf,'/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',_0xc137('0x9f')));_0x383adf=0x0;return _0x7d073;}exports[_0xc137('0xa0')]=function(_0x3701bb,_0xbaeaf0,_0x291d66){var _0x2cf03c;return db['sequelize'][_0xc137('0x7f')](function(_0x29a3aa){return db[_0xc137('0x41')][_0xc137('0x5c')](_0x3701bb[_0xc137('0x5d')],{'transaction':_0x29a3aa})[_0xc137('0x22')](function(_0x2a7e99){_0x2cf03c=_0x2a7e99[_0xc137('0x39')]({'plain':!![]});return db['VoiceExtension'][_0xc137('0x84')](createExtensionsReciveFax(_0x2cf03c),{'transaction':_0x29a3aa});});})[_0xc137('0x22')](function(){return _0x2cf03c;})[_0xc137('0x22')](respondWithResult(_0xbaeaf0,null))[_0xc137('0x55')](handleError(_0xbaeaf0,null));};exports[_0xc137('0xa1')]=function(_0x45ca04,_0x2661d0,_0x440037){var _0x30a1de;return db[_0xc137('0x80')][_0xc137('0x7f')](function(_0x337085){return db['FaxAccount']['update'](_0x45ca04['body'],{'where':{'id':_0x45ca04[_0xc137('0x5d')]['id']},'transaction':_0x337085})['then'](function(_0x309079){return db['VoiceExtension'][_0xc137('0x38')]({'where':{'FaxAccountId':_0x45ca04[_0xc137('0x5d')]['id']},'transaction':_0x337085})['then'](function(_0x4d5c19){return db[_0xc137('0xa2')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x45ca04['body'],['tech',_0xc137('0xa3'),_0xc137('0xa4'),'updatedAt','TrunkId','ListId'])),{'transaction':_0x337085});});});})['then'](function(){return db['FaxAccount'][_0xc137('0xa5')](_0x45ca04[_0xc137('0x5d')]['id']);})[_0xc137('0x22')](respondWithResult(_0x2661d0,null))['catch'](handleError(_0x2661d0,null));};exports[_0xc137('0xa6')]=function(_0x3a8c1c,_0x4a245f,_0x125131){var _0x41137d={'raw':!![],'where':{}};var _0x8155ac={};var _0x4d63dc={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3a8c1c[_0xc137('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a245f,null))[_0xc137('0x22')](function(_0x13f67d){if(_0x13f67d){_0x8155ac[_0xc137('0x47')]=_[_0xc137('0x59')](db[_0xc137('0xa7')][_0xc137('0x5a')]);_0x8155ac[_0xc137('0x44')]=_[_0xc137('0x59')](_0x3a8c1c[_0xc137('0x44')]);_0x8155ac['filters']=_[_0xc137('0x46')](_0x8155ac[_0xc137('0x47')],_0x8155ac['query']);_0x41137d[_0xc137('0x49')]=_[_0xc137('0x46')](_0x8155ac['model'],qs['fields'](_0x3a8c1c['query'][_0xc137('0x48')]));_0x41137d[_0xc137('0x49')]=_0x41137d['attributes'][_0xc137('0x4a')]?_0x41137d['attributes']:_0x8155ac[_0xc137('0x47')];if(!_0x3a8c1c[_0xc137('0x44')][_0xc137('0x69')](_0xc137('0x4b'))){_0x41137d[_0xc137('0x31')]=qs[_0xc137('0x31')](_0x3a8c1c['query'][_0xc137('0x31')]);_0x41137d[_0xc137('0x2f')]=qs[_0xc137('0x2f')](_0x3a8c1c[_0xc137('0x44')][_0xc137('0x2f')]);}_0x41137d[_0xc137('0x89')]=qs[_0xc137('0x4c')](_0x3a8c1c[_0xc137('0x44')]['sort']);_0x41137d[_0xc137('0x4d')]=qs[_0xc137('0x45')](_[_0xc137('0x4e')](_0x3a8c1c[_0xc137('0x44')],_0x8155ac[_0xc137('0x45')]));_0x41137d[_0xc137('0x4d')][_0xc137('0x65')]=_0x13f67d['id'];if(_0x3a8c1c['query'][_0xc137('0x4f')]){_0x41137d[_0xc137('0x4d')]=_[_0xc137('0x50')](_0x41137d[_0xc137('0x4d')],{'$or':_['map'](_0x41137d[_0xc137('0x49')],function(_0x46a5e1){var _0x1193d4={};_0x1193d4[_0x46a5e1]={'$like':'%'+_0x3a8c1c['query']['filter']+'%'};return _0x1193d4;})});}if(_0x3a8c1c[_0xc137('0x44')][_0xc137('0xa8')]){var _0x48d642=_0x3a8c1c[_0xc137('0x44')][_0xc137('0xa8')][_0xc137('0xa9')](',');var _0x16b662={};_0x16b662[_0x48d642[0x0]]={'$gte':moment(_0x48d642[0x1])[_0xc137('0xaa')](_0xc137('0xab'))};_0x41137d['where']=_[_0xc137('0x50')](_0x41137d[_0xc137('0x4d')],_0x16b662);}_0x41137d=_[_0xc137('0x50')]({},_0x41137d,_0x3a8c1c[_0xc137('0x51')]);return db[_0xc137('0xa7')][_0xc137('0x32')]({'where':_0x41137d[_0xc137('0x4d')]})['then'](function(_0x410770){_0x4d63dc[_0xc137('0x32')]=_0x410770;if(_0x3a8c1c[_0xc137('0x44')]['includeAll']){_0x41137d[_0xc137('0x52')]=[{'all':!![]}];}return db[_0xc137('0xa7')][_0xc137('0x53')](_0x41137d);})['then'](function(_0xca8a13){_0x4d63dc['rows']=_0xca8a13;return _0x4d63dc;});}})[_0xc137('0x22')](respondWithFilteredResult(_0x4a245f,_0x41137d))[_0xc137('0x55')](handleError(_0x4a245f,null));};exports['send']=function(_0x8f1bc6,_0x26eafd,_0x53a721){var _0x224580,_0x1157ed={},_0x190c1c;if(_0x8f1bc6['body']['to']){_0x190c1c=_0x8f1bc6['body']['to'][0x0];}return db[_0xc137('0x41')][_0xc137('0x5b')]({'where':{'id':_0x8f1bc6[_0xc137('0x57')]['id']},'include':[{'model':db[_0xc137('0xac')],'as':_0xc137('0xad'),'include':[{'model':db[_0xc137('0x75')],'as':'Contacts','where':{'fax':_0x190c1c},'limit':0x1,'order':[[_0xc137('0xae'),_0xc137('0xaf')]]}]}]})[_0xc137('0x22')](handleEntityNotFound(_0x26eafd,null))[_0xc137('0x22')](function(_0x466fa7){_0x224580=_0x466fa7;if(_0x8f1bc6[_0xc137('0x5d')]['attachments']&&_0x8f1bc6[_0xc137('0x5d')][_0xc137('0xb0')][_0xc137('0x4a')]){for(var _0x593eab=0x0;_0x593eab<_0x8f1bc6[_0xc137('0x5d')]['attachments'][_0xc137('0x4a')];_0x593eab+=0x1){_0x8f1bc6['body']['attachments'][_0x593eab]={'filename':_0x8f1bc6[_0xc137('0x5d')][_0xc137('0xb0')][_0x593eab]['name'],'id':_0x8f1bc6[_0xc137('0x5d')][_0xc137('0xb0')][_0x593eab]['id'],'path':path[_0xc137('0xb1')](config[_0xc137('0xb2')],'server/files/attachments',_0x8f1bc6[_0xc137('0x5d')]['attachments'][_0x593eab]['basename'])};}}return respondWithRpcPromise(_0xc137('0xb3'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x8f1bc6[_0xc137('0x57')]['id'])?undefined:_0x8f1bc6[_0xc137('0x57')]['id'],'path':_[_0xc137('0xb4')](_0x8f1bc6[_0xc137('0x5d')][_0xc137('0xb0')][0x0][_0xc137('0x7')])?undefined:_0x8f1bc6[_0xc137('0x5d')][_0xc137('0xb0')][0x0][_0xc137('0x7')],'fax':_[_0xc137('0xb4')](_0x8f1bc6[_0xc137('0x5d')]['to'][0x0])?undefined:_0x8f1bc6[_0xc137('0x5d')]['to'][0x0]},client9002);})[_0xc137('0x22')](function(){if(_0x224580){if(_[_0xc137('0xb4')](_0x8f1bc6[_0xc137('0x5d')]['from'])){_0x8f1bc6['body']['from']=util['format'](_0xc137('0xb5'),_0x224580[_0xc137('0x3d')],_0x224580['fax']);}if(_0x224580['List']){if(_0x224580[_0xc137('0xad')][_0xc137('0xb6')]['length']){return _0x224580[_0xc137('0xad')][_0xc137('0xb6')][0x0];}else{return db[_0xc137('0x75')][_0xc137('0x5c')](_[_0xc137('0xb7')](_0x8f1bc6[_0xc137('0x5d')],{'firstName':_0x8f1bc6[_0xc137('0x5d')]['to'][0x0],'phone':_0x8f1bc6[_0xc137('0x5d')]['to'][0x0],'fax':_0x8f1bc6[_0xc137('0x5d')]['to'][0x0],'ListId':_0x224580['ListId']}));}}else{throw new Error(_0xc137('0xb8'));}}else{throw new Error(_0xc137('0xb9'));}})[_0xc137('0x22')](function(_0x2f48f4){if(_0x2f48f4){return db['FaxInteraction']['find']({'where':{'ContactId':_0x2f48f4['id'],'closed':![],'FaxAccountId':_0x224580['id']}})[_0xc137('0x22')](function(_0x378ee3){if(_0x378ee3){return[_0x378ee3,![]];}return db[_0xc137('0x71')][_0xc137('0x5c')]({'UserId':_0x8f1bc6['user']['id'],'ContactId':_0x2f48f4['id'],'FaxAccountId':_0x224580['id'],'fax':_0x8f1bc6[_0xc137('0x5d')]['to'][0x0],'firstMsgDirection':_0xc137('0xba'),'Messages':[_[_0xc137('0x50')](_0x8f1bc6['body'],{'read':![],'body':_0x8f1bc6[_0xc137('0x5d')][_0xc137('0xb0')][0x0][_0xc137('0xbb')],'FaxAccountId':_0x224580['id'],'UserId':_0x8f1bc6[_0xc137('0x5e')]['id'],'ContactId':_0x2f48f4['id'],'AttachmentId':_0x8f1bc6['body'][_0xc137('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xc137('0xa7')],'as':'Messages'}]})[_0xc137('0x22')](function(_0x103527){return[_0x103527,!![]];});});}else{throw new Error(_0xc137('0xbc'));}})['spread'](function(_0x3b794d,_0x1d4563){if(_0x1d4563){return _0x3b794d;}return db[_0xc137('0xa7')]['create']({'direction':_0xc137('0xba'),'read':![],'body':_0x8f1bc6[_0xc137('0x5d')][_0xc137('0xb0')][0x0]['filename'],'FaxAccountId':_0x224580['id'],'FaxInteractionId':_0x3b794d['id'],'UserId':_0x8f1bc6['user']['id'],'ContactId':_0x3b794d[_0xc137('0xbd')],'AttachmentId':_0x8f1bc6[_0xc137('0x5d')][_0xc137('0xb0')][0x0]['id']})[_0xc137('0x22')](function(_0x244211){_0x3b794d[_0xc137('0xbe')][_0xc137('0xbf')]=[];_0x3b794d[_0xc137('0xbe')][_0xc137('0xbf')][_0xc137('0x93')](_0x244211[_0xc137('0xbe')]);return _0x3b794d;});})[_0xc137('0x22')](function(_0x5c0908){respondWithRpcPromise(_0xc137('0xc0'),_0xc137('0xc0'),{'FaxAccountId':_['isNil'](_0x8f1bc6[_0xc137('0x57')]['id'])?undefined:_0x8f1bc6[_0xc137('0x57')]['id'],'path':_[_0xc137('0xb4')](_0x8f1bc6['body'][_0xc137('0xb0')][0x0][_0xc137('0x7')])?undefined:_0x8f1bc6[_0xc137('0x5d')]['attachments'][0x0][_0xc137('0x7')],'fax':_['isNil'](_0x8f1bc6[_0xc137('0x5d')]['to'][0x0])?undefined:_0x8f1bc6[_0xc137('0x5d')]['to'][0x0],'AttachmentId':_0x8f1bc6['body'][_0xc137('0xb0')][0x0]['id']},client9002)[_0xc137('0x22')](function(_0xa95996){logger[_0xc137('0x23')]('SendFaxRpc,\x20%s',_0xa95996);})[_0xc137('0x55')](function(_0x1b4a79){logger['info']('SendFaxRpc,\x20%s',_0x1b4a79);});return _0x5c0908;})[_0xc137('0x22')](respondWithResult(_0x26eafd,null))['catch'](handleError(_0x26eafd,null));};exports[_0xc137('0xc1')]=function(_0x82dd63,_0xb1d117,_0x4e6516){return db[_0xc137('0x41')][_0xc137('0x5b')]({'where':{'id':_0x82dd63[_0xc137('0x57')]['id']}})['then'](handleEntityNotFound(_0xb1d117,null))[_0xc137('0x22')](function(_0x34374c){if(_0x34374c){return _0x34374c['addAgents'](_0x82dd63[_0xc137('0x5d')][_0xc137('0x6b')],_['omit'](_0x82dd63[_0xc137('0x5d')],[_0xc137('0x6b'),'id'])||{})['spread'](function(_0x47ed25){for(var _0x46ff8b=0x0;_0x46ff8b<_0x82dd63[_0xc137('0x5d')][_0xc137('0x6b')][_0xc137('0x4a')];_0x46ff8b+=0x1){socket[_0xc137('0xc2')]('userFaxAccount:save',{'UserId':Number(_0x82dd63[_0xc137('0x5d')][_0xc137('0x6b')][_0x46ff8b]),'FaxAccountId':Number(_0x82dd63[_0xc137('0x57')]['id'])});}return _0x47ed25;});}})[_0xc137('0x22')](respondWithResult(_0xb1d117,null))['catch'](handleError(_0xb1d117,null));};exports[_0xc137('0xc3')]=function(_0x560858,_0x422035,_0x20cff5){return db[_0xc137('0x41')][_0xc137('0x5b')]({'where':{'id':_0x560858[_0xc137('0x57')]['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x422035,null))['then'](function(_0x1cb03d){if(_0x1cb03d){return _0x1cb03d[_0xc137('0xc3')](_0x560858['query']['ids'])[_0xc137('0x22')](function(){if(_[_0xc137('0xc4')](_0x560858[_0xc137('0x44')][_0xc137('0x6b')])){for(var _0x12c430=0x0;_0x12c430<_0x560858[_0xc137('0x44')]['ids'][_0xc137('0x4a')];_0x12c430+=0x1){socket[_0xc137('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x560858['query'][_0xc137('0x6b')][_0x12c430]),'FaxAccountId':Number(_0x560858['params']['id'])});}}else{socket[_0xc137('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x560858[_0xc137('0x44')][_0xc137('0x6b')]),'FaxAccountId':Number(_0x560858[_0xc137('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x422035,null))[_0xc137('0x55')](handleError(_0x422035,null));};exports[_0xc137('0xc5')]=function(_0xc3e37d,_0x4b9676,_0x12d178){var _0x312101={};var _0x44bd60={};var _0x4fa411;var _0x4a5cb0;return db['FaxAccount'][_0xc137('0x67')]({'where':{'id':_0xc3e37d[_0xc137('0x57')]['id']}})[_0xc137('0x22')](handleEntityNotFound(_0x4b9676,null))[_0xc137('0x22')](function(_0x1a869f){if(_0x1a869f){_0x4fa411=_0x1a869f;_0x44bd60[_0xc137('0x47')]=_[_0xc137('0x59')](db['User'][_0xc137('0x5a')]);_0x44bd60[_0xc137('0x44')]=_[_0xc137('0x59')](_0xc3e37d['query']);_0x44bd60[_0xc137('0x45')]=_[_0xc137('0x46')](_0x44bd60[_0xc137('0x47')],_0x44bd60[_0xc137('0x44')]);_0x312101[_0xc137('0x49')]=_[_0xc137('0x46')](_0x44bd60['model'],qs['fields'](_0xc3e37d[_0xc137('0x44')][_0xc137('0x48')]));_0x312101[_0xc137('0x49')]=_0x312101[_0xc137('0x49')][_0xc137('0x4a')]?_0x312101[_0xc137('0x49')]:_0x44bd60['model'];_0x312101[_0xc137('0x89')]=qs[_0xc137('0x4c')](_0xc3e37d['query'][_0xc137('0x4c')]);_0x312101[_0xc137('0x4d')]=qs['filters'](_[_0xc137('0x4e')](_0xc3e37d[_0xc137('0x44')],_0x44bd60[_0xc137('0x45')]));if(_0xc3e37d[_0xc137('0x44')][_0xc137('0x4f')]){_0x312101[_0xc137('0x4d')]=_[_0xc137('0x50')](_0x312101[_0xc137('0x4d')],{'$or':_['map'](_0x312101[_0xc137('0x49')],function(_0x5cab49){var _0x31201e={};_0x31201e[_0x5cab49]={'$like':'%'+_0xc3e37d[_0xc137('0x44')]['filter']+'%'};return _0x31201e;})});}_0x312101=_[_0xc137('0x50')]({},_0x312101,_0xc3e37d[_0xc137('0x51')]);return _0x4fa411[_0xc137('0xc5')](_0x312101);}})[_0xc137('0x22')](function(_0x456346){if(_0x456346){_0x4a5cb0=_0x456346[_0xc137('0x4a')];if(!_0xc3e37d[_0xc137('0x44')][_0xc137('0x69')](_0xc137('0x4b'))){_0x312101['limit']=qs[_0xc137('0x31')](_0xc3e37d[_0xc137('0x44')][_0xc137('0x31')]);_0x312101['offset']=qs[_0xc137('0x2f')](_0xc3e37d[_0xc137('0x44')][_0xc137('0x2f')]);}return _0x4fa411['getAgents'](_0x312101);}})[_0xc137('0x22')](function(_0x5c8450){if(_0x5c8450){return _0x5c8450?{'count':_0x4a5cb0,'rows':_0x5c8450}:null;}})[_0xc137('0x22')](respondWithResult(_0x4b9676,null))[_0xc137('0x55')](handleError(_0x4b9676,null));}; \ No newline at end of file +var _0xd9d3=['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','bulkCreate','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','ListId','findById','$gte','split','format','FaxMessage','CmList','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','emit','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','request','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','show','model','keys','FaxAccount','rawAttributes','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','finally','getApplications','from-voip-provider','exten','localstationid','app','priority','appdata','Answer','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','minrate','t38timeout','FAXOPT('];(function(_0xf10ab2,_0x4139fa){var _0x4c6629=function(_0x1be701){while(--_0x1be701){_0xf10ab2['push'](_0xf10ab2['shift']());}};_0x4c6629(++_0x4139fa);}(_0xd9d3,0x1b8));var _0x3d9d=function(_0x45cf73,_0x491eb1){_0x45cf73=_0x45cf73-0x0;var _0x566baf=_0xd9d3[_0x45cf73];return _0x566baf;};'use strict';var emlformat=require(_0x3d9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d9d('0x1'));var jsonpatch=require(_0x3d9d('0x2'));var rp=require(_0x3d9d('0x3'));var moment=require(_0x3d9d('0x4'));var BPromise=require(_0x3d9d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3d9d('0x6'));var csv=require(_0x3d9d('0x7'));var ejs=require(_0x3d9d('0x8'));var fs=require('fs');var fs_extra=require(_0x3d9d('0x9'));var _=require('lodash');var squel=require(_0x3d9d('0xa'));var crypto=require(_0x3d9d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3d9d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3d9d('0xd'));var Papa=require(_0x3d9d('0xe'));var Redis=require(_0x3d9d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3d9d('0x10'));var as=require(_0x3d9d('0x11'));var hardwareService=require(_0x3d9d('0x12'));var logger=require(_0x3d9d('0x13'))(_0x3d9d('0x14'));var utils=require(_0x3d9d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3d9d('0x16'));var db=require(_0x3d9d('0x17'))['db'];config['redis']=_[_0x3d9d('0x18')](config[_0x3d9d('0x19')],{'host':_0x3d9d('0x1a'),'port':0x18eb});var socket=require(_0x3d9d('0x1b'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x3d9d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3d9d('0x1d')][_0x3d9d('0x1e')]({'port':0x232c});var client9002=jayson[_0x3d9d('0x1d')][_0x3d9d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x49ba09,_0x280364,_0x277f3b,_0x5eebbd){return new BPromise(function(_0x4dfd33,_0x3196cd){var _0x52e077=_0x5eebbd||client;return _0x52e077[_0x3d9d('0x1f')](_0x49ba09,_0x277f3b)['then'](function(_0x276012){logger[_0x3d9d('0x20')]('FaxAccount,\x20%s,\x20%s',_0x280364,'request\x20sent');logger[_0x3d9d('0x21')](_0x3d9d('0x22'),_0x280364,'request\x20sent',JSON[_0x3d9d('0x23')](_0x276012));if(_0x276012['error']){if(_0x276012[_0x3d9d('0x24')][_0x3d9d('0x25')]===0x1f4){logger[_0x3d9d('0x24')](_0x3d9d('0x26'),_0x280364,_0x276012[_0x3d9d('0x24')]['message']);return _0x3196cd(_0x276012[_0x3d9d('0x24')][_0x3d9d('0x27')]);}logger[_0x3d9d('0x24')]('FaxAccount,\x20%s,\x20%s',_0x280364,_0x276012['error'][_0x3d9d('0x27')]);return _0x4dfd33(_0x276012[_0x3d9d('0x24')][_0x3d9d('0x27')]);}else{logger['info'](_0x3d9d('0x26'),_0x280364,'request\x20sent');_0x4dfd33(_0x276012[_0x3d9d('0x28')]['message']);}})[_0x3d9d('0x29')](function(_0x4f1a41){logger[_0x3d9d('0x24')](_0x3d9d('0x26'),_0x280364,_0x4f1a41);_0x3196cd(_0x4f1a41);});});}function respondWithStatusCode(_0x3a0ab5,_0x27ea62){_0x27ea62=_0x27ea62||0xcc;return function(_0x27e4ea){if(_0x27e4ea){return _0x3a0ab5['sendStatus'](_0x27ea62);}return _0x3a0ab5[_0x3d9d('0x2a')](_0x27ea62)[_0x3d9d('0x2b')]();};}function respondWithResult(_0x174888,_0x57f3e2){_0x57f3e2=_0x57f3e2||0xc8;return function(_0x560dd8){if(_0x560dd8){return _0x174888[_0x3d9d('0x2a')](_0x57f3e2)['json'](_0x560dd8);}};}function respondWithFilteredResult(_0x396462,_0x46aa53){return function(_0x213d2d){if(_0x213d2d){var _0x3446e9=typeof _0x46aa53[_0x3d9d('0x2c')]===_0x3d9d('0x2d')&&typeof _0x46aa53[_0x3d9d('0x2e')]==='undefined';var _0x2848d1=_0x213d2d[_0x3d9d('0x2f')];var _0x1451f1=_0x3446e9?0x0:_0x46aa53[_0x3d9d('0x2c')];var _0x55b262=_0x3446e9?_0x213d2d[_0x3d9d('0x2f')]:_0x46aa53[_0x3d9d('0x2c')]+_0x46aa53[_0x3d9d('0x2e')];var _0x43e5ba;if(_0x55b262>=_0x2848d1){_0x55b262=_0x2848d1;_0x43e5ba=0xc8;}else{_0x43e5ba=0xce;}_0x396462['status'](_0x43e5ba);return _0x396462['set'](_0x3d9d('0x30'),_0x1451f1+'-'+_0x55b262+'/'+_0x2848d1)[_0x3d9d('0x31')](_0x213d2d);}return null;};}function patchUpdates(_0x235ef4){return function(_0x5752fc){try{jsonpatch['apply'](_0x5752fc,_0x235ef4,!![]);}catch(_0x2e915e){return BPromise[_0x3d9d('0x32')](_0x2e915e);}return _0x5752fc[_0x3d9d('0x33')]();};}function saveUpdates(_0x594dc6,_0x1f83e9){return function(_0x41c3b3){if(_0x41c3b3){return _0x41c3b3[_0x3d9d('0x34')](_0x594dc6)[_0x3d9d('0x35')](function(_0x470f14){return _0x470f14;});}return null;};}function removeEntity(_0x4c89e2,_0x10d1b3){return function(_0xf2ea3e){if(_0xf2ea3e){return _0xf2ea3e[_0x3d9d('0x36')]()[_0x3d9d('0x35')](function(){var _0x40a6b7=_0xf2ea3e[_0x3d9d('0x37')]({'plain':!![]});var _0x42f9eb='FaxAccounts';return db[_0x3d9d('0x38')]['destroy']({'where':{'type':_0x42f9eb,'resourceId':_0x40a6b7['id']}})[_0x3d9d('0x35')](function(){return _0xf2ea3e;});})[_0x3d9d('0x35')](function(){_0x4c89e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2667,_0x123e1c){return function(_0x2cc8e8){if(!_0x2cc8e8){_0x2a2667['sendStatus'](0x194);}return _0x2cc8e8;};}function handleError(_0x1f80c9,_0x30f069){_0x30f069=_0x30f069||0x1f4;return function(_0x596287){logger[_0x3d9d('0x24')](_0x596287[_0x3d9d('0x39')]);if(_0x596287['name']){delete _0x596287['name'];}_0x1f80c9[_0x3d9d('0x2a')](_0x30f069)[_0x3d9d('0x3a')](_0x596287);};}exports[_0x3d9d('0x3b')]=function(_0x4dabaa,_0x50b820){var _0x5b0968={'include':[{'model':db[_0x3d9d('0x3c')],'as':_0x3d9d('0x3d')}]},_0x506a28={},_0x4c0c0a={'count':0x0,'rows':[]};var _0x3f5656=_[_0x3d9d('0x3e')](db['FaxAccount']['rawAttributes'],function(_0x1b209d){return{'name':_0x1b209d[_0x3d9d('0x3f')],'type':_0x1b209d[_0x3d9d('0x40')][_0x3d9d('0x41')]};});_0x506a28['model']=_[_0x3d9d('0x3e')](_0x3f5656,_0x3d9d('0x42'));_0x506a28[_0x3d9d('0x43')]=_['keys'](_0x4dabaa['query']);_0x506a28[_0x3d9d('0x44')]=_[_0x3d9d('0x45')](_0x506a28['model'],_0x506a28['query']);_0x5b0968[_0x3d9d('0x46')]=_['intersection'](_0x506a28['model'],qs['fields'](_0x4dabaa[_0x3d9d('0x43')][_0x3d9d('0x47')]));_0x5b0968[_0x3d9d('0x46')]=_0x5b0968[_0x3d9d('0x46')][_0x3d9d('0x48')]?_0x5b0968['attributes']:_0x506a28['model'];if(!_0x4dabaa['query']['hasOwnProperty'](_0x3d9d('0x49'))){_0x5b0968[_0x3d9d('0x2e')]=qs[_0x3d9d('0x2e')](_0x4dabaa[_0x3d9d('0x43')][_0x3d9d('0x2e')]);_0x5b0968[_0x3d9d('0x2c')]=qs['offset'](_0x4dabaa[_0x3d9d('0x43')][_0x3d9d('0x2c')]);}_0x5b0968[_0x3d9d('0x4a')]=qs[_0x3d9d('0x4b')](_0x4dabaa['query']['sort']);_0x5b0968[_0x3d9d('0x4c')]=qs[_0x3d9d('0x44')](_[_0x3d9d('0x4d')](_0x4dabaa[_0x3d9d('0x43')],_0x506a28[_0x3d9d('0x44')]),_0x3f5656);if(_0x4dabaa[_0x3d9d('0x43')][_0x3d9d('0x4e')]){_0x5b0968[_0x3d9d('0x4c')]=_[_0x3d9d('0x4f')](_0x5b0968['where'],{'$or':_[_0x3d9d('0x3e')](_0x3f5656,function(_0x7f11f6){if(_0x7f11f6['type']!=='VIRTUAL'){var _0x4d5efc={};_0x4d5efc[_0x7f11f6['name']]={'$like':'%'+_0x4dabaa['query']['filter']+'%'};return _0x4d5efc;}})});}_0x5b0968=_['merge']({},_0x5b0968,_0x4dabaa['options']);var _0x3e72b3={'where':_0x5b0968[_0x3d9d('0x4c')]};return db['FaxAccount']['count'](_0x3e72b3)[_0x3d9d('0x35')](function(_0x375248){_0x4c0c0a['count']=_0x375248;if(_0x4dabaa[_0x3d9d('0x43')]['includeAll']){_0x5b0968[_0x3d9d('0x50')]=[{'all':!![]}];}return db['FaxAccount'][_0x3d9d('0x51')](_0x5b0968);})[_0x3d9d('0x35')](function(_0x9f7271){_0x4c0c0a['rows']=_0x9f7271;return _0x4c0c0a;})[_0x3d9d('0x35')](respondWithFilteredResult(_0x50b820,_0x5b0968))[_0x3d9d('0x29')](handleError(_0x50b820,null));};exports[_0x3d9d('0x52')]=function(_0x28e490,_0x5be99e){var _0x53eb32={'raw':![],'where':{'id':_0x28e490['params']['id']},'include':[{'model':db[_0x3d9d('0x3c')],'as':_0x3d9d('0x3d')}]},_0x262929={};_0x262929[_0x3d9d('0x53')]=_[_0x3d9d('0x54')](db[_0x3d9d('0x55')][_0x3d9d('0x56')]);_0x262929[_0x3d9d('0x43')]=_['keys'](_0x28e490[_0x3d9d('0x43')]);_0x262929['filters']=_[_0x3d9d('0x45')](_0x262929[_0x3d9d('0x53')],_0x262929[_0x3d9d('0x43')]);_0x53eb32[_0x3d9d('0x46')]=_[_0x3d9d('0x45')](_0x262929[_0x3d9d('0x53')],qs['fields'](_0x28e490[_0x3d9d('0x43')][_0x3d9d('0x47')]));_0x53eb32['attributes']=_0x53eb32[_0x3d9d('0x46')][_0x3d9d('0x48')]?_0x53eb32[_0x3d9d('0x46')]:_0x262929['model'];if(_0x28e490['query'][_0x3d9d('0x57')]){_0x53eb32[_0x3d9d('0x50')]=[{'all':!![]}];}_0x53eb32=_[_0x3d9d('0x4f')]({},_0x53eb32,_0x28e490[_0x3d9d('0x58')]);return db[_0x3d9d('0x55')]['find'](_0x53eb32)[_0x3d9d('0x35')](handleEntityNotFound(_0x5be99e,null))[_0x3d9d('0x35')](respondWithResult(_0x5be99e,null))[_0x3d9d('0x29')](handleError(_0x5be99e,null));};exports[_0x3d9d('0x59')]=function(_0x3573a5,_0xa136a5){return db[_0x3d9d('0x55')][_0x3d9d('0x59')](_0x3573a5['body'],{})['then'](function(_0x40d2b8){var _0x426c12=_0x3573a5[_0x3d9d('0x5a')][_0x3d9d('0x37')]({'plain':!![]});if(!_0x426c12)throw new Error(_0x3d9d('0x5b'));if(_0x426c12['role']===_0x3d9d('0x5a')){var _0x3e86a4=_0x40d2b8[_0x3d9d('0x37')]({'plain':!![]});var _0x2c3997=_0x3d9d('0x5c');return db[_0x3d9d('0x5d')][_0x3d9d('0x5e')]({'where':{'name':_0x2c3997,'userProfileId':_0x426c12[_0x3d9d('0x5f')]},'raw':!![]})[_0x3d9d('0x35')](function(_0x38c5f1){if(_0x38c5f1&&_0x38c5f1[_0x3d9d('0x60')]===0x0){return db[_0x3d9d('0x38')][_0x3d9d('0x59')]({'name':_0x3e86a4[_0x3d9d('0x42')],'resourceId':_0x3e86a4['id'],'type':_0x38c5f1[_0x3d9d('0x42')],'sectionId':_0x38c5f1['id']},{})[_0x3d9d('0x35')](function(){return _0x40d2b8;});}else{return _0x40d2b8;}})[_0x3d9d('0x29')](function(_0x1ad345){logger[_0x3d9d('0x24')](_0x3d9d('0x61'),_0x1ad345);throw _0x1ad345;});}return _0x40d2b8;})['then'](respondWithResult(_0xa136a5,0xc9))[_0x3d9d('0x29')](handleError(_0xa136a5,null));};exports['update']=function(_0x34d67e,_0x3399d6){if(_0x34d67e[_0x3d9d('0x62')]['id']){delete _0x34d67e[_0x3d9d('0x62')]['id'];}return db[_0x3d9d('0x55')][_0x3d9d('0x5e')]({'where':{'id':_0x34d67e[_0x3d9d('0x63')]['id']},'include':[{'model':db[_0x3d9d('0x3c')],'as':_0x3d9d('0x3d')}]})[_0x3d9d('0x35')](handleEntityNotFound(_0x3399d6,null))[_0x3d9d('0x35')](saveUpdates(_0x34d67e[_0x3d9d('0x62')],null))[_0x3d9d('0x35')](respondWithResult(_0x3399d6,null))[_0x3d9d('0x29')](handleError(_0x3399d6,null));};exports['destroy']=function(_0xfb02d4,_0x32ccc3){return db[_0x3d9d('0x55')][_0x3d9d('0x5e')]({'where':{'id':_0xfb02d4['params']['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x32ccc3,null))[_0x3d9d('0x35')](removeEntity(_0x32ccc3,null))[_0x3d9d('0x29')](handleError(_0x32ccc3,null));};exports[_0x3d9d('0x64')]=function(_0x163996,_0x585c9d){return db[_0x3d9d('0x55')]['describe']()[_0x3d9d('0x35')](respondWithResult(_0x585c9d,null))[_0x3d9d('0x29')](handleError(_0x585c9d,null));};exports[_0x3d9d('0x65')]=function(_0x36a472,_0x5acedd,_0x55d2ee){if(_0x36a472[_0x3d9d('0x62')]['id']){delete _0x36a472[_0x3d9d('0x62')]['id'];}return db[_0x3d9d('0x55')]['find']({'where':{'id':_0x36a472['params']['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x5acedd,null))[_0x3d9d('0x35')](function(_0x4e06fe){if(_0x4e06fe){_0x36a472[_0x3d9d('0x62')][_0x3d9d('0x66')]=_0x4e06fe['id'];return db[_0x3d9d('0x67')][_0x3d9d('0x59')](_0x36a472[_0x3d9d('0x62')]);}})[_0x3d9d('0x35')](respondWithResult(_0x5acedd,null))[_0x3d9d('0x29')](handleError(_0x5acedd,null));};exports[_0x3d9d('0x68')]=function(_0x4df9a6,_0x28702a,_0xe6d402){var _0xbe66b0={'raw':![],'where':{}};var _0x582e79={};var _0x52a2fe={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3d9d('0x69')]({'where':{'id':_0x4df9a6[_0x3d9d('0x63')]['id']}})['then'](handleEntityNotFound(_0x28702a,null))[_0x3d9d('0x35')](function(_0x219d2d){if(_0x219d2d){_0x582e79['model']=_['keys'](db[_0x3d9d('0x67')]['rawAttributes']);_0x582e79[_0x3d9d('0x43')]=_['keys'](_0x4df9a6[_0x3d9d('0x43')]);_0x582e79[_0x3d9d('0x44')]=_[_0x3d9d('0x45')](_0x582e79[_0x3d9d('0x53')],_0x582e79[_0x3d9d('0x43')]);_0xbe66b0[_0x3d9d('0x46')]=_[_0x3d9d('0x45')](_0x582e79['model'],qs[_0x3d9d('0x47')](_0x4df9a6[_0x3d9d('0x43')][_0x3d9d('0x47')]));_0xbe66b0[_0x3d9d('0x46')]=_0xbe66b0['attributes'][_0x3d9d('0x48')]?_0xbe66b0[_0x3d9d('0x46')]:_0x582e79[_0x3d9d('0x53')];if(!_0x4df9a6[_0x3d9d('0x43')][_0x3d9d('0x6a')](_0x3d9d('0x49'))){_0xbe66b0[_0x3d9d('0x2e')]=qs['limit'](_0x4df9a6[_0x3d9d('0x43')][_0x3d9d('0x2e')]);_0xbe66b0['offset']=qs[_0x3d9d('0x2c')](_0x4df9a6['query'][_0x3d9d('0x2c')]);}_0xbe66b0[_0x3d9d('0x4a')]=qs[_0x3d9d('0x4b')](_0x4df9a6[_0x3d9d('0x43')][_0x3d9d('0x4b')]);_0xbe66b0[_0x3d9d('0x4c')]=qs[_0x3d9d('0x44')](_[_0x3d9d('0x4d')](_0x4df9a6['query'],_0x582e79[_0x3d9d('0x44')]));_0xbe66b0[_0x3d9d('0x4c')][_0x3d9d('0x66')]=_0x219d2d['id'];if(_0x4df9a6[_0x3d9d('0x43')][_0x3d9d('0x4e')]){_0xbe66b0[_0x3d9d('0x4c')]=_[_0x3d9d('0x4f')](_0xbe66b0[_0x3d9d('0x4c')],{'$or':_[_0x3d9d('0x3e')](_0xbe66b0[_0x3d9d('0x46')],function(_0x6f9c79){var _0x297d44={};_0x297d44[_0x6f9c79]={'$like':'%'+_0x4df9a6[_0x3d9d('0x43')][_0x3d9d('0x4e')]+'%'};return _0x297d44;})});}_0xbe66b0=_['merge']({},_0xbe66b0,_0x4df9a6[_0x3d9d('0x58')]);return db[_0x3d9d('0x67')][_0x3d9d('0x2f')]({'where':_0xbe66b0[_0x3d9d('0x4c')]})['then'](function(_0x533749){_0x52a2fe[_0x3d9d('0x2f')]=_0x533749;if(_0x4df9a6[_0x3d9d('0x43')][_0x3d9d('0x57')]){_0xbe66b0[_0x3d9d('0x50')]=[{'all':!![]}];}return db[_0x3d9d('0x67')][_0x3d9d('0x51')](_0xbe66b0);})[_0x3d9d('0x35')](function(_0xd56989){_0x52a2fe[_0x3d9d('0x6b')]=_0xd56989;return _0x52a2fe;});}})[_0x3d9d('0x35')](respondWithFilteredResult(_0x28702a,_0xbe66b0))[_0x3d9d('0x29')](handleError(_0x28702a,null));};exports[_0x3d9d('0x6c')]=function(_0x4a2808,_0x19298b,_0x5a389e){return db[_0x3d9d('0x55')][_0x3d9d('0x5e')]({'where':{'id':_0x4a2808[_0x3d9d('0x63')]['id']}})['then'](handleEntityNotFound(_0x19298b,null))[_0x3d9d('0x35')](function(_0x174412){if(_0x174412){return _0x174412[_0x3d9d('0x6c')](_0x4a2808['query'][_0x3d9d('0x6d')]);}})[_0x3d9d('0x35')](respondWithStatusCode(_0x19298b,null))[_0x3d9d('0x29')](handleError(_0x19298b,null));};exports[_0x3d9d('0x6e')]=function(_0x5aa946,_0x5b1342,_0x381e83){if(_0x5aa946[_0x3d9d('0x62')]['id']){delete _0x5aa946['body']['id'];}return db[_0x3d9d('0x55')][_0x3d9d('0x5e')]({'where':{'id':_0x5aa946[_0x3d9d('0x63')]['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x5b1342,null))[_0x3d9d('0x35')](function(_0x25dd58){if(_0x25dd58){_0x5aa946[_0x3d9d('0x62')][_0x3d9d('0x66')]=_0x25dd58['id'];return db[_0x3d9d('0x6f')][_0x3d9d('0x59')](_0x5aa946[_0x3d9d('0x62')]);}})['then'](respondWithResult(_0x5b1342,null))[_0x3d9d('0x29')](handleError(_0x5b1342,null));};exports[_0x3d9d('0x70')]=function(_0x31259d,_0x2a0dc8,_0x514ec9){var _0x484fdc={'raw':![],'where':{}};var _0x5538ba={};var _0x57bfe0={'count':0x0,'rows':[]};return db[_0x3d9d('0x55')][_0x3d9d('0x69')]({'where':{'id':_0x31259d[_0x3d9d('0x63')]['id']}})['then'](handleEntityNotFound(_0x2a0dc8,null))['then'](function(_0x28c637){if(_0x28c637){_0x5538ba[_0x3d9d('0x53')]=_[_0x3d9d('0x54')](db[_0x3d9d('0x6f')][_0x3d9d('0x56')]);_0x5538ba[_0x3d9d('0x43')]=_[_0x3d9d('0x54')](_0x31259d['query']);_0x5538ba[_0x3d9d('0x44')]=_[_0x3d9d('0x45')](_0x5538ba[_0x3d9d('0x53')],_0x5538ba[_0x3d9d('0x43')]);_0x484fdc[_0x3d9d('0x46')]=_[_0x3d9d('0x45')](_0x5538ba[_0x3d9d('0x53')],qs['fields'](_0x31259d['query'][_0x3d9d('0x47')]));_0x484fdc[_0x3d9d('0x46')]=_0x484fdc[_0x3d9d('0x46')]['length']?_0x484fdc[_0x3d9d('0x46')]:_0x5538ba[_0x3d9d('0x53')];if(!_0x31259d['query']['hasOwnProperty']('nolimit')){_0x484fdc['limit']=qs[_0x3d9d('0x2e')](_0x31259d[_0x3d9d('0x43')][_0x3d9d('0x2e')]);_0x484fdc['offset']=qs[_0x3d9d('0x2c')](_0x31259d['query']['offset']);}_0x484fdc['order']=qs[_0x3d9d('0x4b')](_0x31259d[_0x3d9d('0x43')]['sort']);_0x484fdc[_0x3d9d('0x4c')]=qs[_0x3d9d('0x44')](_[_0x3d9d('0x4d')](_0x31259d['query'],_0x5538ba[_0x3d9d('0x44')]));_0x484fdc[_0x3d9d('0x4c')][_0x3d9d('0x66')]=_0x28c637['id'];if(_0x31259d['query'][_0x3d9d('0x4e')]){_0x484fdc[_0x3d9d('0x4c')]=_[_0x3d9d('0x4f')](_0x484fdc[_0x3d9d('0x4c')],{'$or':_[_0x3d9d('0x3e')](_0x484fdc[_0x3d9d('0x46')],function(_0x3bd355){var _0x985e0a={};_0x985e0a[_0x3bd355]={'$like':'%'+_0x31259d['query']['filter']+'%'};return _0x985e0a;})});}_0x484fdc=_['merge']({},_0x484fdc,_0x31259d[_0x3d9d('0x58')]);return db[_0x3d9d('0x6f')]['count']({'where':_0x484fdc['where']})[_0x3d9d('0x35')](function(_0x2f24b2){_0x57bfe0[_0x3d9d('0x2f')]=_0x2f24b2;if(_0x31259d['query'][_0x3d9d('0x57')]){_0x484fdc[_0x3d9d('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3d9d('0x51')](_0x484fdc);})['then'](function(_0x52d465){_0x57bfe0[_0x3d9d('0x6b')]=_0x52d465;return _0x57bfe0;});}})['then'](respondWithFilteredResult(_0x2a0dc8,_0x484fdc))['catch'](handleError(_0x2a0dc8,null));};exports[_0x3d9d('0x71')]=function(_0x308274,_0x1afd4c,_0x577e7d){return db[_0x3d9d('0x55')][_0x3d9d('0x5e')]({'where':{'id':_0x308274[_0x3d9d('0x63')]['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x1afd4c,null))[_0x3d9d('0x35')](function(_0x104bd3){if(_0x104bd3){return _0x104bd3['removeAnswers'](_0x308274[_0x3d9d('0x43')]['ids']);}})[_0x3d9d('0x35')](respondWithStatusCode(_0x1afd4c,null))[_0x3d9d('0x29')](handleError(_0x1afd4c,null));};exports[_0x3d9d('0x72')]=function(_0x5933d5,_0xe61397,_0x10f588){return db['FaxInteraction'][_0x3d9d('0x5e')]({'where':{'id':_0x5933d5[_0x3d9d('0x63')]['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0xe61397,null))['then'](function(_0x1af4c4){if(_0x1af4c4){return _0x1af4c4[_0x3d9d('0x72')](_0x5933d5['body'][_0x3d9d('0x6d')],_[_0x3d9d('0x73')](_0x5933d5[_0x3d9d('0x62')],['ids','id'])||{});}})[_0x3d9d('0x35')](respondWithResult(_0xe61397,null))[_0x3d9d('0x29')](handleError(_0xe61397,null));};exports['getInteractions']=function(_0x2318d0,_0x14e4a8,_0x1ddd8d){var _0x4db212={'raw':![],'where':{}};var _0x489ff1={};var _0x2c07e8={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3d9d('0x69')]({'where':{'id':_0x2318d0[_0x3d9d('0x63')]['id']}})['then'](handleEntityNotFound(_0x14e4a8,null))[_0x3d9d('0x35')](function(_0x324dfb){if(_0x324dfb){_0x489ff1[_0x3d9d('0x53')]=_['keys'](db[_0x3d9d('0x74')][_0x3d9d('0x56')]);_0x489ff1[_0x3d9d('0x43')]=_[_0x3d9d('0x54')](_0x2318d0[_0x3d9d('0x43')]);_0x489ff1[_0x3d9d('0x44')]=_['intersection'](_0x489ff1['model'],_0x489ff1[_0x3d9d('0x43')]);_0x4db212[_0x3d9d('0x46')]=_[_0x3d9d('0x45')](_0x489ff1[_0x3d9d('0x53')],qs[_0x3d9d('0x47')](_0x2318d0[_0x3d9d('0x43')][_0x3d9d('0x47')]));_0x4db212['attributes']=_0x4db212[_0x3d9d('0x46')]['length']?_0x4db212[_0x3d9d('0x46')]:_0x489ff1['model'];if(!_0x2318d0[_0x3d9d('0x43')]['hasOwnProperty'](_0x3d9d('0x49'))){_0x4db212['limit']=qs[_0x3d9d('0x2e')](_0x2318d0[_0x3d9d('0x43')][_0x3d9d('0x2e')]);_0x4db212[_0x3d9d('0x2c')]=qs['offset'](_0x2318d0[_0x3d9d('0x43')][_0x3d9d('0x2c')]);}_0x4db212[_0x3d9d('0x4a')]=qs['sort'](_0x2318d0[_0x3d9d('0x43')][_0x3d9d('0x4b')]);_0x4db212[_0x3d9d('0x4c')]=qs['filters'](_[_0x3d9d('0x4d')](_0x2318d0[_0x3d9d('0x43')],_0x489ff1['filters']));_0x4db212['where'][_0x3d9d('0x66')]=_0x324dfb['id'];if(_0x2318d0[_0x3d9d('0x43')][_0x3d9d('0x4e')]){_0x4db212[_0x3d9d('0x4c')]=_[_0x3d9d('0x4f')](_0x4db212['where'],{'$or':_[_0x3d9d('0x3e')](_0x4db212[_0x3d9d('0x46')],function(_0x4a69ac){var _0x2aaeb0={};_0x2aaeb0[_0x4a69ac]={'$like':'%'+_0x2318d0[_0x3d9d('0x43')][_0x3d9d('0x4e')]+'%'};return _0x2aaeb0;})});}_0x4db212=_['merge']({},_0x4db212,_0x2318d0[_0x3d9d('0x58')]);return db['FaxInteraction'][_0x3d9d('0x2f')]({'where':_0x4db212[_0x3d9d('0x4c')]})[_0x3d9d('0x35')](function(_0x2766dc){_0x2c07e8[_0x3d9d('0x2f')]=_0x2766dc;if(_0x2318d0['query'][_0x3d9d('0x57')]){_0x4db212[_0x3d9d('0x50')]=[{'model':db[_0x3d9d('0x75')],'as':_0x3d9d('0x76'),'required':![]},{'model':db[_0x3d9d('0x77')],'as':_0x3d9d('0x78'),'attributes':['name',_0x3d9d('0x79'),_0x3d9d('0x7a')],'required':![]},{'model':db[_0x3d9d('0x7b')],'as':_0x3d9d('0x7c'),'attributes':['id','name',_0x3d9d('0x7d')],'where':_0x2318d0[_0x3d9d('0x43')][_0x3d9d('0x7e')]?{'id':_0x2318d0[_0x3d9d('0x43')]['tag']}:undefined,'required':_0x2318d0[_0x3d9d('0x43')][_0x3d9d('0x7e')]?!![]:![]}];}return db[_0x3d9d('0x74')][_0x3d9d('0x51')](_0x4db212);})['then'](function(_0x274279){_0x2c07e8[_0x3d9d('0x6b')]=_0x274279;return _0x2c07e8;});}})[_0x3d9d('0x35')](respondWithFilteredResult(_0x14e4a8,_0x4db212))[_0x3d9d('0x29')](handleError(_0x14e4a8,null));};exports['addApplications']=function(_0xb9e08,_0x2f5c82){var _0x288dfb=_0xb9e08[_0x3d9d('0x63')]['id'];var _0x2c73c2=_0xb9e08['body'];var _0x30c045=0xc8;var _0xa5b3ac=null;return db[_0x3d9d('0x7f')][_0x3d9d('0x80')]({'isolationLevel':db[_0x3d9d('0x7f')][_0x3d9d('0x81')][_0x3d9d('0x82')][_0x3d9d('0x83')]},function(_0x437db4){return db[_0x3d9d('0x55')]['findOne']({'where':{'id':_0x288dfb},'transaction':_0x437db4})['then'](function(_0x3202c3){if(_0x3202c3){return db[_0x3d9d('0x84')][_0x3d9d('0x36')]({'where':{'FaxAccountId':_0x288dfb},'transaction':_0x437db4})[_0x3d9d('0x35')](function(){var _0x5a9f95=_[_0x3d9d('0x3e')](_0x2c73c2,function(_0x4f9aaf){_0x4f9aaf[_0x3d9d('0x66')]=_0x288dfb;return _0x4f9aaf;});return db[_0x3d9d('0x84')]['bulkCreate'](_0x5a9f95,{'transaction':_0x437db4});});}else{_0x30c045=0x194;_0xa5b3ac=[];}});})[_0x3d9d('0x35')](function(){if(_0x30c045!==0x194){return db[_0x3d9d('0x84')]['findAndCountAll']({'where':{'FaxAccountId':_0x288dfb},'order':'priority'})[_0x3d9d('0x35')](function(_0x27bca4){_0xa5b3ac=_0x27bca4;});}})[_0x3d9d('0x29')](function(_0x2bb034){_0x30c045=0x1f4;logger['error'](_0x2bb034[_0x3d9d('0x39')]);if(_0x2bb034[_0x3d9d('0x42')]){delete _0x2bb034['name'];}_0xa5b3ac=_0x2bb034;})[_0x3d9d('0x85')](function(){if(_0xa5b3ac===null){_0x2f5c82['sendStatus'](_0x30c045);}else{if(_0x30c045===0x1f4){_0x2f5c82[_0x3d9d('0x2a')](_0x30c045)[_0x3d9d('0x3a')](_0xa5b3ac);}else{_0x2f5c82[_0x3d9d('0x2a')](_0x30c045)[_0x3d9d('0x31')](_0xa5b3ac);}}});};exports[_0x3d9d('0x86')]=function(_0x596183,_0x534f6e,_0x181852){var _0x536330={};var _0x3b9b28={};var _0x4b40f9;var _0x2dd05e;return db[_0x3d9d('0x55')][_0x3d9d('0x69')]({'where':{'id':_0x596183[_0x3d9d('0x63')]['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x534f6e,null))[_0x3d9d('0x35')](function(_0x571d0b){if(_0x571d0b){_0x4b40f9=_0x571d0b;_0x3b9b28[_0x3d9d('0x53')]=_[_0x3d9d('0x54')](db[_0x3d9d('0x84')][_0x3d9d('0x56')]);_0x3b9b28[_0x3d9d('0x43')]=_[_0x3d9d('0x54')](_0x596183[_0x3d9d('0x43')]);_0x3b9b28['filters']=_[_0x3d9d('0x45')](_0x3b9b28[_0x3d9d('0x53')],_0x3b9b28[_0x3d9d('0x43')]);_0x536330[_0x3d9d('0x46')]=_[_0x3d9d('0x45')](_0x3b9b28[_0x3d9d('0x53')],qs[_0x3d9d('0x47')](_0x596183[_0x3d9d('0x43')][_0x3d9d('0x47')]));_0x536330['attributes']=_0x536330[_0x3d9d('0x46')][_0x3d9d('0x48')]?_0x536330[_0x3d9d('0x46')]:_0x3b9b28[_0x3d9d('0x53')];_0x536330[_0x3d9d('0x4a')]=qs[_0x3d9d('0x4b')](_0x596183[_0x3d9d('0x43')][_0x3d9d('0x4b')]);_0x536330[_0x3d9d('0x4c')]=qs[_0x3d9d('0x44')](_[_0x3d9d('0x4d')](_0x596183['query'],_0x3b9b28[_0x3d9d('0x44')]));if(_0x596183[_0x3d9d('0x43')][_0x3d9d('0x4e')]){_0x536330[_0x3d9d('0x4c')]=_['merge'](_0x536330[_0x3d9d('0x4c')],{'$or':_[_0x3d9d('0x3e')](_0x536330['attributes'],function(_0x2dc5b3){var _0x5f42f1={};_0x5f42f1[_0x2dc5b3]={'$like':'%'+_0x596183[_0x3d9d('0x43')]['filter']+'%'};return _0x5f42f1;})});}_0x536330=_[_0x3d9d('0x4f')]({},_0x536330,_0x596183['options']);return _0x4b40f9[_0x3d9d('0x86')](_0x536330);}})['then'](function(_0x5d59e5){if(_0x5d59e5){_0x2dd05e=_0x5d59e5[_0x3d9d('0x48')];if(!_0x596183['query'][_0x3d9d('0x6a')](_0x3d9d('0x49'))){_0x536330[_0x3d9d('0x2e')]=qs[_0x3d9d('0x2e')](_0x596183[_0x3d9d('0x43')][_0x3d9d('0x2e')]);_0x536330[_0x3d9d('0x2c')]=qs[_0x3d9d('0x2c')](_0x596183[_0x3d9d('0x43')][_0x3d9d('0x2c')]);}return _0x4b40f9[_0x3d9d('0x86')](_0x536330);}})[_0x3d9d('0x35')](function(_0x4e43fa){if(_0x4e43fa){return _0x4e43fa?{'count':_0x2dd05e,'rows':_0x4e43fa}:null;}})[_0x3d9d('0x35')](respondWithResult(_0x534f6e,null))['catch'](handleError(_0x534f6e,null));};function Extension(_0x2c7015,_0x2eb844,_0x54b23d,_0x1ed98c){this['context']=_0x3d9d('0x87');this[_0x3d9d('0x88')]=_0x2c7015[_0x3d9d('0x89')];this[_0x3d9d('0x8a')]=_0x1ed98c;this[_0x3d9d('0x40')]='system';this['description']='Fax\x20Extension';this[_0x3d9d('0x66')]=_0x2c7015['id'];this[_0x3d9d('0x8b')]=_0x2eb844;this[_0x3d9d('0x8c')]=_0x54b23d;}function createExtensionsReciveFax(_0x3930c7){var _0x29ad2e=0x1;var _0x54ce44=[];_0x54ce44['push'](new Extension(_0x3930c7,_0x29ad2e,'',_0x3d9d('0x8d')));_0x29ad2e+=0x1;_0x54ce44[_0x3d9d('0x8e')](new Extension(_0x3930c7,_0x29ad2e,_0x3d9d('0x8f'),'Set'));_0x29ad2e+=0x1;for(var _0x1d1e2c in _0x3930c7){if(_0x3930c7['hasOwnProperty'](_0x1d1e2c)&&(_0x1d1e2c===_0x3d9d('0x90')||_0x1d1e2c===_0x3d9d('0x89')||_0x1d1e2c===_0x3d9d('0x91')||_0x1d1e2c===_0x3d9d('0x92')||_0x1d1e2c===_0x3d9d('0x93')||_0x1d1e2c==='maxrate'||_0x1d1e2c===_0x3d9d('0x94')||_0x1d1e2c==='modem'||_0x1d1e2c===_0x3d9d('0x95'))){_0x54ce44[_0x3d9d('0x8e')](new Extension(_0x3930c7,_0x29ad2e,_0x3d9d('0x96')+_0x1d1e2c+')='+_0x3930c7[_0x1d1e2c],_0x3d9d('0x97')));_0x29ad2e+=0x1;}}_0x54ce44['push'](new Extension(_0x3930c7,_0x29ad2e,'6',_0x3d9d('0x98')));_0x29ad2e+=0x1;_0x54ce44[_0x3d9d('0x8e')](new Extension(_0x3930c7,_0x29ad2e,_0x3d9d('0x99'),_0x3d9d('0x9a')));_0x29ad2e=0x0;return _0x54ce44;}exports[_0x3d9d('0x9b')]=function(_0xa87bd,_0x594722,_0xaa0c18){var _0x15e441;return db[_0x3d9d('0x7f')][_0x3d9d('0x80')](function(_0x162f34){return db[_0x3d9d('0x55')][_0x3d9d('0x59')](_0xa87bd['body'],{'transaction':_0x162f34})[_0x3d9d('0x35')](function(_0x301869){_0x15e441=_0x301869[_0x3d9d('0x37')]({'plain':!![]});return db['VoiceExtension'][_0x3d9d('0x9c')](createExtensionsReciveFax(_0x15e441),{'transaction':_0x162f34});});})[_0x3d9d('0x35')](function(){return _0x15e441;})[_0x3d9d('0x35')](respondWithResult(_0x594722,null))['catch'](handleError(_0x594722,null));};exports[_0x3d9d('0x9d')]=function(_0x44a44b,_0x1fb62b,_0x219dd8){var _0x5c19e8;return db['sequelize']['transaction'](function(_0x1b440d){return db[_0x3d9d('0x55')][_0x3d9d('0x34')](_0x44a44b['body'],{'where':{'id':_0x44a44b[_0x3d9d('0x62')]['id']},'transaction':_0x1b440d})[_0x3d9d('0x35')](function(_0x398e9c){return db[_0x3d9d('0x9e')][_0x3d9d('0x36')]({'where':{'FaxAccountId':_0x44a44b[_0x3d9d('0x62')]['id']},'transaction':_0x1b440d})[_0x3d9d('0x35')](function(_0x5a4b06){return db['VoiceExtension'][_0x3d9d('0x9c')](createExtensionsReciveFax(_[_0x3d9d('0x73')](_0x44a44b[_0x3d9d('0x62')],[_0x3d9d('0x9f'),_0x3d9d('0x41'),_0x3d9d('0xa0'),_0x3d9d('0xa1'),'TrunkId',_0x3d9d('0xa2')])),{'transaction':_0x1b440d});});});})[_0x3d9d('0x35')](function(){return db[_0x3d9d('0x55')][_0x3d9d('0xa3')](_0x44a44b['body']['id']);})[_0x3d9d('0x35')](respondWithResult(_0x1fb62b,null))['catch'](handleError(_0x1fb62b,null));};exports['getMessages']=function(_0x2c3984,_0x2599d2,_0x485fe3){var _0x483050={'raw':!![],'where':{}};var _0x37e379={};var _0x19c702={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3d9d('0x69')]({'where':{'id':_0x2c3984[_0x3d9d('0x63')]['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x2599d2,null))[_0x3d9d('0x35')](function(_0x483d97){if(_0x483d97){_0x37e379[_0x3d9d('0x53')]=_['keys'](db['FaxMessage'][_0x3d9d('0x56')]);_0x37e379[_0x3d9d('0x43')]=_[_0x3d9d('0x54')](_0x2c3984[_0x3d9d('0x43')]);_0x37e379[_0x3d9d('0x44')]=_[_0x3d9d('0x45')](_0x37e379[_0x3d9d('0x53')],_0x37e379[_0x3d9d('0x43')]);_0x483050[_0x3d9d('0x46')]=_[_0x3d9d('0x45')](_0x37e379[_0x3d9d('0x53')],qs['fields'](_0x2c3984[_0x3d9d('0x43')][_0x3d9d('0x47')]));_0x483050[_0x3d9d('0x46')]=_0x483050[_0x3d9d('0x46')][_0x3d9d('0x48')]?_0x483050[_0x3d9d('0x46')]:_0x37e379[_0x3d9d('0x53')];if(!_0x2c3984[_0x3d9d('0x43')]['hasOwnProperty'](_0x3d9d('0x49'))){_0x483050['limit']=qs[_0x3d9d('0x2e')](_0x2c3984['query'][_0x3d9d('0x2e')]);_0x483050[_0x3d9d('0x2c')]=qs[_0x3d9d('0x2c')](_0x2c3984[_0x3d9d('0x43')]['offset']);}_0x483050['order']=qs[_0x3d9d('0x4b')](_0x2c3984[_0x3d9d('0x43')][_0x3d9d('0x4b')]);_0x483050[_0x3d9d('0x4c')]=qs[_0x3d9d('0x44')](_[_0x3d9d('0x4d')](_0x2c3984[_0x3d9d('0x43')],_0x37e379[_0x3d9d('0x44')]));_0x483050['where'][_0x3d9d('0x66')]=_0x483d97['id'];if(_0x2c3984[_0x3d9d('0x43')]['filter']){_0x483050[_0x3d9d('0x4c')]=_[_0x3d9d('0x4f')](_0x483050['where'],{'$or':_['map'](_0x483050['attributes'],function(_0x520372){var _0x5323d6={};_0x5323d6[_0x520372]={'$like':'%'+_0x2c3984[_0x3d9d('0x43')]['filter']+'%'};return _0x5323d6;})});}if(_0x2c3984[_0x3d9d('0x43')][_0x3d9d('0xa4')]){var _0x50b4db=_0x2c3984[_0x3d9d('0x43')]['$gte'][_0x3d9d('0xa5')](',');var _0x5bc3cd={};_0x5bc3cd[_0x50b4db[0x0]]={'$gte':moment(_0x50b4db[0x1])[_0x3d9d('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x483050[_0x3d9d('0x4c')]=_[_0x3d9d('0x4f')](_0x483050[_0x3d9d('0x4c')],_0x5bc3cd);}_0x483050=_[_0x3d9d('0x4f')]({},_0x483050,_0x2c3984[_0x3d9d('0x58')]);return db['FaxMessage'][_0x3d9d('0x2f')]({'where':_0x483050[_0x3d9d('0x4c')]})['then'](function(_0x2afa5c){_0x19c702[_0x3d9d('0x2f')]=_0x2afa5c;if(_0x2c3984[_0x3d9d('0x43')][_0x3d9d('0x57')]){_0x483050[_0x3d9d('0x50')]=[{'all':!![]}];}return db[_0x3d9d('0xa7')][_0x3d9d('0x51')](_0x483050);})['then'](function(_0x1c9f49){_0x19c702[_0x3d9d('0x6b')]=_0x1c9f49;return _0x19c702;});}})[_0x3d9d('0x35')](respondWithFilteredResult(_0x2599d2,_0x483050))[_0x3d9d('0x29')](handleError(_0x2599d2,null));};exports[_0x3d9d('0x3a')]=function(_0x475138,_0x6e3bf3,_0x212cbe){var _0x51e60d,_0x25a9c9={},_0x4a2f54;if(_0x475138[_0x3d9d('0x62')]['to']){_0x4a2f54=_0x475138[_0x3d9d('0x62')]['to'][0x0];}return db[_0x3d9d('0x55')][_0x3d9d('0x5e')]({'where':{'id':_0x475138['params']['id']},'include':[{'model':db[_0x3d9d('0xa8')],'as':'List','include':[{'model':db[_0x3d9d('0x75')],'as':'Contacts','where':{'fax':_0x4a2f54},'limit':0x1,'order':[[_0x3d9d('0xa1'),_0x3d9d('0xa9')]]}]}]})[_0x3d9d('0x35')](handleEntityNotFound(_0x6e3bf3,null))[_0x3d9d('0x35')](function(_0x5f393e){_0x51e60d=_0x5f393e;if(_0x475138[_0x3d9d('0x62')][_0x3d9d('0xaa')]&&_0x475138['body'][_0x3d9d('0xaa')]['length']){for(var _0x543785=0x0;_0x543785<_0x475138[_0x3d9d('0x62')]['attachments'][_0x3d9d('0x48')];_0x543785+=0x1){_0x475138[_0x3d9d('0x62')][_0x3d9d('0xaa')][_0x543785]={'filename':_0x475138['body'][_0x3d9d('0xaa')][_0x543785][_0x3d9d('0x42')],'id':_0x475138['body'][_0x3d9d('0xaa')][_0x543785]['id'],'path':path[_0x3d9d('0xab')](config[_0x3d9d('0xac')],_0x3d9d('0xad'),_0x475138[_0x3d9d('0x62')][_0x3d9d('0xaa')][_0x543785]['basename'])};}}return respondWithRpcPromise(_0x3d9d('0xae'),_0x3d9d('0xae'),{'FaxAccountId':_['isNil'](_0x475138[_0x3d9d('0x63')]['id'])?undefined:_0x475138[_0x3d9d('0x63')]['id'],'path':_[_0x3d9d('0xaf')](_0x475138[_0x3d9d('0x62')]['attachments'][0x0][_0x3d9d('0xb0')])?undefined:_0x475138[_0x3d9d('0x62')][_0x3d9d('0xaa')][0x0]['path'],'fax':_[_0x3d9d('0xaf')](_0x475138['body']['to'][0x0])?undefined:_0x475138[_0x3d9d('0x62')]['to'][0x0]},client9002);})[_0x3d9d('0x35')](function(){if(_0x51e60d){if(_[_0x3d9d('0xaf')](_0x475138[_0x3d9d('0x62')][_0x3d9d('0xb1')])){_0x475138[_0x3d9d('0x62')][_0x3d9d('0xb1')]=util[_0x3d9d('0xa6')](_0x3d9d('0xb2'),_0x51e60d[_0x3d9d('0x42')],_0x51e60d[_0x3d9d('0xb3')]);}if(_0x51e60d[_0x3d9d('0xb4')]){if(_0x51e60d[_0x3d9d('0xb4')]['Contacts'][_0x3d9d('0x48')]){return _0x51e60d['List']['Contacts'][0x0];}else{return db[_0x3d9d('0x75')]['create'](_['defaults'](_0x475138[_0x3d9d('0x62')],{'firstName':_0x475138['body']['to'][0x0],'phone':_0x475138[_0x3d9d('0x62')]['to'][0x0],'fax':_0x475138[_0x3d9d('0x62')]['to'][0x0],'ListId':_0x51e60d['ListId']}));}}else{throw new Error(_0x3d9d('0xb5'));}}else{throw new Error(_0x3d9d('0xb6'));}})[_0x3d9d('0x35')](function(_0x1b31c2){if(_0x1b31c2){return db['FaxInteraction'][_0x3d9d('0x5e')]({'where':{'ContactId':_0x1b31c2['id'],'closed':![],'FaxAccountId':_0x51e60d['id']}})[_0x3d9d('0x35')](function(_0x5f1fb7){if(_0x5f1fb7){return[_0x5f1fb7,![]];}return db[_0x3d9d('0x74')][_0x3d9d('0x59')]({'UserId':_0x475138[_0x3d9d('0x5a')]['id'],'ContactId':_0x1b31c2['id'],'FaxAccountId':_0x51e60d['id'],'fax':_0x475138['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x3d9d('0x4f')](_0x475138[_0x3d9d('0x62')],{'read':![],'body':_0x475138[_0x3d9d('0x62')][_0x3d9d('0xaa')][0x0][_0x3d9d('0xb7')],'FaxAccountId':_0x51e60d['id'],'UserId':_0x475138[_0x3d9d('0x5a')]['id'],'ContactId':_0x1b31c2['id'],'AttachmentId':_0x475138[_0x3d9d('0x62')][_0x3d9d('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x3d9d('0xb8')}]})['then'](function(_0x328324){return[_0x328324,!![]];});});}else{throw new Error(_0x3d9d('0xb9'));}})['spread'](function(_0xcf6668,_0x2afa36){if(_0x2afa36){return _0xcf6668;}return db[_0x3d9d('0xa7')][_0x3d9d('0x59')]({'direction':'out','read':![],'body':_0x475138['body'][_0x3d9d('0xaa')][0x0][_0x3d9d('0xb7')],'FaxAccountId':_0x51e60d['id'],'FaxInteractionId':_0xcf6668['id'],'UserId':_0x475138[_0x3d9d('0x5a')]['id'],'ContactId':_0xcf6668[_0x3d9d('0xba')],'AttachmentId':_0x475138['body'][_0x3d9d('0xaa')][0x0]['id']})[_0x3d9d('0x35')](function(_0x38d06c){_0xcf6668[_0x3d9d('0xbb')][_0x3d9d('0xb8')]=[];_0xcf6668[_0x3d9d('0xbb')][_0x3d9d('0xb8')][_0x3d9d('0x8e')](_0x38d06c[_0x3d9d('0xbb')]);return _0xcf6668;});})[_0x3d9d('0x35')](function(_0x253025){respondWithRpcPromise(_0x3d9d('0xbc'),_0x3d9d('0xbc'),{'FaxAccountId':_['isNil'](_0x475138[_0x3d9d('0x63')]['id'])?undefined:_0x475138[_0x3d9d('0x63')]['id'],'path':_[_0x3d9d('0xaf')](_0x475138[_0x3d9d('0x62')]['attachments'][0x0][_0x3d9d('0xb0')])?undefined:_0x475138[_0x3d9d('0x62')][_0x3d9d('0xaa')][0x0][_0x3d9d('0xb0')],'fax':_[_0x3d9d('0xaf')](_0x475138[_0x3d9d('0x62')]['to'][0x0])?undefined:_0x475138[_0x3d9d('0x62')]['to'][0x0],'AttachmentId':_0x475138['body'][_0x3d9d('0xaa')][0x0]['id']},client9002)[_0x3d9d('0x35')](function(_0x51b35c){logger[_0x3d9d('0x20')](_0x3d9d('0xbd'),_0x51b35c);})[_0x3d9d('0x29')](function(_0x3cc829){logger[_0x3d9d('0x20')](_0x3d9d('0xbd'),_0x3cc829);});return _0x253025;})[_0x3d9d('0x35')](respondWithResult(_0x6e3bf3,null))[_0x3d9d('0x29')](handleError(_0x6e3bf3,null));};exports[_0x3d9d('0xbe')]=function(_0x497f13,_0x22a4b0,_0x448fac){return db[_0x3d9d('0x55')][_0x3d9d('0x5e')]({'where':{'id':_0x497f13['params']['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x22a4b0,null))[_0x3d9d('0x35')](function(_0x1027fc){if(_0x1027fc){return _0x1027fc['addAgents'](_0x497f13['body'][_0x3d9d('0x6d')],_[_0x3d9d('0x73')](_0x497f13[_0x3d9d('0x62')],[_0x3d9d('0x6d'),'id'])||{})[_0x3d9d('0xbf')](function(_0x575bbf){for(var _0x36bd33=0x0;_0x36bd33<_0x497f13[_0x3d9d('0x62')][_0x3d9d('0x6d')][_0x3d9d('0x48')];_0x36bd33+=0x1){socket['emit'](_0x3d9d('0xc0'),{'UserId':Number(_0x497f13['body']['ids'][_0x36bd33]),'FaxAccountId':Number(_0x497f13[_0x3d9d('0x63')]['id'])});}return _0x575bbf;});}})['then'](respondWithResult(_0x22a4b0,null))[_0x3d9d('0x29')](handleError(_0x22a4b0,null));};exports[_0x3d9d('0xc1')]=function(_0x35e5c2,_0x27c3cd,_0x2b32ae){return db[_0x3d9d('0x55')][_0x3d9d('0x5e')]({'where':{'id':_0x35e5c2[_0x3d9d('0x63')]['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x27c3cd,null))[_0x3d9d('0x35')](function(_0x54c3f4){if(_0x54c3f4){return _0x54c3f4[_0x3d9d('0xc1')](_0x35e5c2[_0x3d9d('0x43')][_0x3d9d('0x6d')])['then'](function(){if(_['isArray'](_0x35e5c2[_0x3d9d('0x43')]['ids'])){for(var _0x372488=0x0;_0x372488<_0x35e5c2[_0x3d9d('0x43')][_0x3d9d('0x6d')][_0x3d9d('0x48')];_0x372488+=0x1){socket[_0x3d9d('0xc2')](_0x3d9d('0xc3'),{'UserId':Number(_0x35e5c2[_0x3d9d('0x43')]['ids'][_0x372488]),'FaxAccountId':Number(_0x35e5c2[_0x3d9d('0x63')]['id'])});}}else{socket[_0x3d9d('0xc2')](_0x3d9d('0xc3'),{'UserId':Number(_0x35e5c2[_0x3d9d('0x43')][_0x3d9d('0x6d')]),'FaxAccountId':Number(_0x35e5c2['params']['id'])});}});}})[_0x3d9d('0x35')](respondWithStatusCode(_0x27c3cd,null))[_0x3d9d('0x29')](handleError(_0x27c3cd,null));};exports[_0x3d9d('0xc4')]=function(_0x3482c4,_0x17f109,_0xdd4d55){var _0x233328={};var _0x2ba671={};var _0x5e2e2a;var _0x1976c1;return db[_0x3d9d('0x55')][_0x3d9d('0x69')]({'where':{'id':_0x3482c4[_0x3d9d('0x63')]['id']}})[_0x3d9d('0x35')](handleEntityNotFound(_0x17f109,null))[_0x3d9d('0x35')](function(_0x28f812){if(_0x28f812){_0x5e2e2a=_0x28f812;_0x2ba671[_0x3d9d('0x53')]=_[_0x3d9d('0x54')](db[_0x3d9d('0x77')]['rawAttributes']);_0x2ba671[_0x3d9d('0x43')]=_[_0x3d9d('0x54')](_0x3482c4[_0x3d9d('0x43')]);_0x2ba671[_0x3d9d('0x44')]=_[_0x3d9d('0x45')](_0x2ba671[_0x3d9d('0x53')],_0x2ba671['query']);_0x233328['attributes']=_[_0x3d9d('0x45')](_0x2ba671[_0x3d9d('0x53')],qs[_0x3d9d('0x47')](_0x3482c4[_0x3d9d('0x43')][_0x3d9d('0x47')]));_0x233328[_0x3d9d('0x46')]=_0x233328['attributes'][_0x3d9d('0x48')]?_0x233328[_0x3d9d('0x46')]:_0x2ba671['model'];_0x233328['order']=qs[_0x3d9d('0x4b')](_0x3482c4[_0x3d9d('0x43')][_0x3d9d('0x4b')]);_0x233328[_0x3d9d('0x4c')]=qs['filters'](_[_0x3d9d('0x4d')](_0x3482c4['query'],_0x2ba671[_0x3d9d('0x44')]));if(_0x3482c4[_0x3d9d('0x43')]['filter']){_0x233328[_0x3d9d('0x4c')]=_['merge'](_0x233328[_0x3d9d('0x4c')],{'$or':_[_0x3d9d('0x3e')](_0x233328['attributes'],function(_0xf0fca){var _0xa5902d={};_0xa5902d[_0xf0fca]={'$like':'%'+_0x3482c4[_0x3d9d('0x43')][_0x3d9d('0x4e')]+'%'};return _0xa5902d;})});}_0x233328=_[_0x3d9d('0x4f')]({},_0x233328,_0x3482c4[_0x3d9d('0x58')]);return _0x5e2e2a[_0x3d9d('0xc4')](_0x233328);}})['then'](function(_0x2465ab){if(_0x2465ab){_0x1976c1=_0x2465ab[_0x3d9d('0x48')];if(!_0x3482c4[_0x3d9d('0x43')][_0x3d9d('0x6a')](_0x3d9d('0x49'))){_0x233328[_0x3d9d('0x2e')]=qs['limit'](_0x3482c4[_0x3d9d('0x43')][_0x3d9d('0x2e')]);_0x233328[_0x3d9d('0x2c')]=qs[_0x3d9d('0x2c')](_0x3482c4[_0x3d9d('0x43')][_0x3d9d('0x2c')]);}return _0x5e2e2a[_0x3d9d('0xc4')](_0x233328);}})['then'](function(_0x192a9c){if(_0x192a9c){return _0x192a9c?{'count':_0x1976c1,'rows':_0x192a9c}:null;}})[_0x3d9d('0x35')](respondWithResult(_0x17f109,null))['catch'](handleError(_0x17f109,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cb50ed4..ef88e6c 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 _0xd5eb=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2918e1,_0x9613bc){var _0x2f5165=function(_0x12d6e2){while(--_0x12d6e2){_0x2918e1['push'](_0x2918e1['shift']());}};_0x2f5165(++_0x9613bc);}(_0xd5eb,0x183));var _0xbd5e=function(_0x1bf6b7,_0x12519b){_0x1bf6b7=_0x1bf6b7-0x0;var _0x5e2768=_0xd5eb[_0x1bf6b7];return _0x5e2768;};'use strict';var EventEmitter=require(_0xbd5e('0x0'));var FaxAccount=require(_0xbd5e('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xbd5e('0x2')](0x0);var events={'afterCreate':_0xbd5e('0x3'),'afterUpdate':_0xbd5e('0x4'),'afterDestroy':_0xbd5e('0x5')};function emitEvent(_0x1aa352){return function(_0x381ed9,_0x5005d2,_0x4eedc1){FaxAccountEvents['emit'](_0x1aa352+':'+_0x381ed9['id'],_0x381ed9);FaxAccountEvents[_0xbd5e('0x6')](_0x1aa352,_0x381ed9);_0x4eedc1(null);};}for(var e in events){if(events[_0xbd5e('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xbd5e('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x953d=['../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x3c3bb1,_0x550cd6){var _0x4e74f2=function(_0x29db1d){while(--_0x29db1d){_0x3c3bb1['push'](_0x3c3bb1['shift']());}};_0x4e74f2(++_0x550cd6);}(_0x953d,0x93));var _0xd953=function(_0x406c07,_0x188e1b){_0x406c07=_0x406c07-0x0;var _0x38722c=_0x953d[_0x406c07];return _0x38722c;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xd953('0x0'))['db'][_0xd953('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd953('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd953('0x3'),'afterDestroy':_0xd953('0x4')};function emitEvent(_0x402937){return function(_0x2cc30b,_0x297110,_0x429355){FaxAccountEvents['emit'](_0x402937+':'+_0x2cc30b['id'],_0x2cc30b);FaxAccountEvents[_0xd953('0x5')](_0x402937,_0x2cc30b);_0x429355(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xd953('0x6')](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 0b86bab..60f6ca8 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 _0xcd2a=['define','fax_accounts','lodash','util','api','moment','rimraf'];(function(_0x569eb6,_0x1a2b02){var _0xe86b41=function(_0x1d310f){while(--_0x1d310f){_0x569eb6['push'](_0x569eb6['shift']());}};_0xe86b41(++_0x1a2b02);}(_0xcd2a,0x1bb));var _0xacd2=function(_0x2f023d,_0x29dfe5){_0x2f023d=_0x2f023d-0x0;var _0x4ef240=_0xcd2a[_0x2f023d];return _0x4ef240;};'use strict';var _=require(_0xacd2('0x0'));var util=require(_0xacd2('0x1'));var logger=require('../../config/logger')(_0xacd2('0x2'));var moment=require(_0xacd2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xacd2('0x4'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module['exports']=function(_0x2e687b,_0x551ce3){return _0x2e687b[_0xacd2('0x5')]('FaxAccount',attributes,{'tableName':_0xacd2('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f5=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','../../config/logger','moment','bluebird','request-promise'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0xd2f5,0x19e));var _0x5d2f=function(_0x29ba7b,_0xbedb09){_0x29ba7b=_0x29ba7b-0x0;var _0x526c89=_0xd2f5[_0x29ba7b];return _0x526c89;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d2f('0x0'))('api');var moment=require(_0x5d2f('0x1'));var BPromise=require(_0x5d2f('0x2'));var rp=require(_0x5d2f('0x3'));var fs=require('fs');var path=require(_0x5d2f('0x4'));var rimraf=require(_0x5d2f('0x5'));var config=require(_0x5d2f('0x6'));var attributes=require(_0x5d2f('0x7'));module[_0x5d2f('0x8')]=function(_0x294699,_0x17b09f){return _0x294699['define'](_0x5d2f('0x9'),attributes,{'tableName':_0x5d2f('0xa'),'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 7b6ce22..098fa0e 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 _0x3a63=['isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','account','applications','list','orderBy','priority','Applications','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFaxAccount','FaxAccount','options','where','attributes','limit','include','map','model','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x3a63,0xd0));var _0x33a6=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x3a63[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0x33a6('0x0'));var util=require(_0x33a6('0x1'));var moment=require(_0x33a6('0x2'));var BPromise=require(_0x33a6('0x3'));var rs=require(_0x33a6('0x4'));var fs=require('fs');var Redis=require(_0x33a6('0x5'));var db=require(_0x33a6('0x6'))['db'];var utils=require(_0x33a6('0x7'));var logger=require('../../config/logger')(_0x33a6('0x8'));var config=require(_0x33a6('0x9'));var jayson=require(_0x33a6('0xa'));var client=jayson[_0x33a6('0xb')][_0x33a6('0xc')]({'port':0x232c});config[_0x33a6('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0x33a6('0xe')](socket);function respondWithRpcPromise(_0x545325,_0x40e61b,_0x2e155a){return new BPromise(function(_0x1ee42b,_0x3a482a){return client[_0x33a6('0xf')](_0x545325,_0x2e155a)[_0x33a6('0x10')](function(_0x2f96f3){logger[_0x33a6('0x11')](_0x33a6('0x12'),_0x40e61b,_0x33a6('0x13'));logger[_0x33a6('0x14')](_0x33a6('0x15'),_0x40e61b,_0x33a6('0x13'),JSON[_0x33a6('0x16')](_0x2f96f3));if(_0x2f96f3[_0x33a6('0x17')]){if(_0x2f96f3[_0x33a6('0x17')]['code']===0x1f4){logger[_0x33a6('0x17')](_0x33a6('0x12'),_0x40e61b,_0x2f96f3['error'][_0x33a6('0x18')]);return _0x3a482a(_0x2f96f3[_0x33a6('0x17')][_0x33a6('0x18')]);}logger['error'](_0x33a6('0x12'),_0x40e61b,_0x2f96f3['error'][_0x33a6('0x18')]);return _0x1ee42b(_0x2f96f3[_0x33a6('0x17')][_0x33a6('0x18')]);}else{logger['info'](_0x33a6('0x12'),_0x40e61b,'request\x20sent');_0x1ee42b(_0x2f96f3[_0x33a6('0x19')][_0x33a6('0x18')]);}})['catch'](function(_0x5df5e3){logger[_0x33a6('0x17')](_0x33a6('0x12'),_0x40e61b,_0x5df5e3);_0x3a482a(_0x5df5e3);});});}exports[_0x33a6('0x1a')]=function(_0x14a0b4){var _0x5efef5=this;return new Promise(function(_0xeda3a3,_0xc879e8){return db[_0x33a6('0x1b')]['findAll']({'raw':_0x14a0b4[_0x33a6('0x1c')]?_0x14a0b4[_0x33a6('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x14a0b4[_0x33a6('0x1c')]?_0x14a0b4[_0x33a6('0x1c')][_0x33a6('0x1d')]||null:null,'attributes':_0x14a0b4[_0x33a6('0x1c')]?_0x14a0b4['options'][_0x33a6('0x1e')]||null:null,'limit':_0x14a0b4[_0x33a6('0x1c')]?_0x14a0b4[_0x33a6('0x1c')][_0x33a6('0x1f')]||null:null,'include':_0x14a0b4[_0x33a6('0x1c')]?_0x14a0b4[_0x33a6('0x1c')][_0x33a6('0x20')]?_[_0x33a6('0x21')](_0x14a0b4[_0x33a6('0x1c')][_0x33a6('0x20')],function(_0x271271){return{'model':db[_0x271271[_0x33a6('0x22')]],'as':_0x271271['as'],'attributes':_0x271271[_0x33a6('0x1e')],'include':_0x271271[_0x33a6('0x20')]?_['map'](_0x271271[_0x33a6('0x20')],function(_0xd0e5f9){return{'model':db[_0xd0e5f9[_0x33a6('0x22')]],'as':_0xd0e5f9['as'],'attributes':_0xd0e5f9[_0x33a6('0x1e')],'include':_0xd0e5f9[_0x33a6('0x20')]?_[_0x33a6('0x21')](_0xd0e5f9[_0x33a6('0x20')],function(_0x14c80b){return{'model':db[_0x14c80b[_0x33a6('0x22')]],'as':_0x14c80b['as'],'attributes':_0x14c80b[_0x33a6('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d440d){logger[_0x33a6('0x11')]('GetFaxAccount',_0x14a0b4);logger[_0x33a6('0x14')]('GetFaxAccount',_0x14a0b4,JSON['stringify'](_0x2d440d));_0xeda3a3(_0x2d440d);})['catch'](function(_0x31f32a){logger[_0x33a6('0x17')](_0x33a6('0x1a'),_0x31f32a[_0x33a6('0x18')],_0x14a0b4);_0xc879e8(_0x5efef5[_0x33a6('0x17')](0x1f4,_0x31f32a[_0x33a6('0x18')]));});});};exports['NotifyFaxAccount']=function(_0xb36b85,_0x1c39f1,_0x1a17bb){var _0x34f2d6=this;return new Promise(function(_0x428e28,_0x378c43){var _0x5d0bfe={'body':_0xb36b85[_0x33a6('0x23')],'channel':_0x33a6('0x24')};var _0x4578cf=[];var _0x11aecd=[];var _0x5b0e88={};return db[_0x33a6('0x25')][_0x33a6('0x26')]()['then'](function(_0x103863){if(!_0x103863){throw new db[(_0x33a6('0x27'))][(_0x33a6('0x28'))]('no\x20available\x20attributes');}_0x4578cf=_[_0x33a6('0x29')](_[_0x33a6('0x2a')](_0x103863),[_0x33a6('0x2b'),_0x33a6('0x2c')]);_0x11aecd=_['difference'](_[_0x33a6('0x2a')](_0x103863),[_0x33a6('0x2b'),'updatedAt',_0x33a6('0x2d'),_0x33a6('0x2e')]);if(_0xb36b85[_0x33a6('0x23')]['id']){delete _0xb36b85[_0x33a6('0x23')]['id'];}if(_[_0x33a6('0x2f')](_0xb36b85['body'][_0x33a6('0x30')])){throw new db[(_0x33a6('0x27'))][(_0x33a6('0x28'))]('from\x20is\x20mandatory');}if(_[_0x33a6('0x2f')](_0xb36b85[_0x33a6('0x23')]['body'])||_0xb36b85['body'][_0x33a6('0x23')]===''){throw new db[(_0x33a6('0x27'))][(_0x33a6('0x28'))](_0x33a6('0x31'));}if(_[_0x33a6('0x2f')](_0xb36b85[_0x33a6('0x23')][_0x33a6('0x32')])){throw new db['Sequelize'][(_0x33a6('0x28'))](_0x33a6('0x33')+_0x11aecd);}if(!_['includes'](_0x11aecd,_0xb36b85[_0x33a6('0x23')][_0x33a6('0x32')])){throw new db[(_0x33a6('0x27'))][(_0x33a6('0x28'))](_0x33a6('0x34')+_0x11aecd);}_0x5b0e88[_0xb36b85['body']['mapKey']]=_0xb36b85['body'][_0x33a6('0x30')];})[_0x33a6('0x10')](function(){return db['FaxAccount'][_0x33a6('0x35')]({'where':{'id':_0xb36b85['account']['id']},'include':[{'model':db[_0x33a6('0x36')],'as':_0x33a6('0x37'),'include':[{'model':db['CmContact'],'as':_0x33a6('0x38'),'where':_0x5b0e88,'limit':0x1,'order':[[_0x33a6('0x2c'),_0x33a6('0x39')]]}]},{'model':db[_0x33a6('0x3a')],'as':'Applications'}]});})[_0x33a6('0x10')](function(_0x956860){if(_0x956860&&_0x956860['List']){var _0x4ba8c2=_0x956860['get']({'plain':!![]});_0x5d0bfe[_0x33a6('0x3b')]=_0x4ba8c2;_0x5d0bfe[_0x33a6('0x3c')]=_0x4ba8c2['Applications'];_0x5d0bfe[_0x33a6('0x3d')]=_0x4ba8c2['List'];_0x5d0bfe[_0x33a6('0x3c')]=_[_0x33a6('0x3e')](_0x5d0bfe[_0x33a6('0x3c')],[_0x33a6('0x3f')],['asc']);if(_0x5d0bfe[_0x33a6('0x3b')][_0x33a6('0x40')]){delete _0x5d0bfe[_0x33a6('0x3b')][_0x33a6('0x40')];}if(_0x5d0bfe['account'][_0x33a6('0x37')]&&_0x5d0bfe[_0x33a6('0x3b')]['List'][_0x33a6('0x38')]['length']){return _0x5d0bfe[_0x33a6('0x3b')][_0x33a6('0x37')][_0x33a6('0x38')][0x0];}var _0x1f24da=_['defaults'](_0xb36b85['body'],{'firstName':_0xb36b85[_0x33a6('0x23')][_0x33a6('0x30')],'ListId':_0x4ba8c2[_0x33a6('0x2e')]});_0x1f24da[_0xb36b85[_0x33a6('0x23')][_0x33a6('0x32')]]=_0xb36b85[_0x33a6('0x23')][_0x33a6('0x30')];return db['CmContact'][_0x33a6('0x41')](_0x1f24da,{'fields':_0x4578cf,'raw':!![]});}})[_0x33a6('0x10')](function(_0x4de91e){_0x5d0bfe[_0x33a6('0x42')]=_0x4de91e;if(_0x4de91e){var _0x33540c={'ContactId':_0x4de91e['id'],'FaxAccountId':_0xb36b85['account']['id'],'fax':_0x4de91e['fax']};return db[_0x33a6('0x43')]['find']({'where':{'ContactId':_0x4de91e['id'],'closed':![],'FaxAccountId':_0xb36b85[_0x33a6('0x3b')]['id']}})[_0x33a6('0x10')](function(_0x4aab52){if(_0x4aab52){return[_0x4aab52,![]];}return db[_0x33a6('0x43')]['create'](_0x33540c)[_0x33a6('0x10')](function(_0x63ea0){return[_0x63ea0,!![]];});});}else{throw new Error(_0x33a6('0x44'));}})[_0x33a6('0x45')](function(_0x1bcc0b,_0x3dc501){var _0x5084ca=_0x1bcc0b[_0x33a6('0x46')]({'plain':!![]});if(_0x3dc501){if(_0x5d0bfe['account'][_0x33a6('0x47')]){_0x5d0bfe['applications'][_0x33a6('0x48')]({'id':0x0,'priority':_0x5d0bfe[_0x33a6('0x3c')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x5084ca['created']=!![];}else{_0x5084ca['created']=![];}_0x5d0bfe[_0x33a6('0x49')]=_0x5084ca;return db['FaxMessage']['create']({'body':_0xb36b85[_0x33a6('0x23')][_0x33a6('0x23')],'FaxAccountId':_0xb36b85[_0x33a6('0x3b')]['id'],'FaxInteractionId':_0x1bcc0b['id'],'direction':'in','ContactId':_0x1bcc0b[_0x33a6('0x4a')],'AttachmentId':_0xb36b85[_0x33a6('0x23')][_0x33a6('0x4b')]});})[_0x33a6('0x10')](function(_0x3be8ad){_0x5d0bfe[_0x33a6('0x18')]=_0x3be8ad;if(_0x5d0bfe[_0x33a6('0x49')][_0x33a6('0x4c')]){return db[_0x33a6('0x4d')]['find']({'attributes':['id',_0x33a6('0x4e')],'where':{'id':_0x5d0bfe[_0x33a6('0x49')][_0x33a6('0x4c')]}})[_0x33a6('0x10')](function(_0x4444a4){if(_0x4444a4){_0x5d0bfe[_0x33a6('0x3c')][_0x33a6('0x4f')]({'id':0x0,'priority':0x0,'app':_0x33a6('0x50'),'appdata':_0x4444a4[_0x33a6('0x4e')]+','+(_0x5d0bfe[_0x33a6('0x3b')][_0x33a6('0x51')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x33a6('0x52'),'startRouting',_0x5d0bfe);});}return respondWithRpcPromise(_0x33a6('0x52'),_0x33a6('0x53'),_0x5d0bfe);})['then'](function(_0x55a3ce){_0x428e28(_0x55a3ce);})[_0x33a6('0x54')](function(_0x2029c6){_0x378c43(_0x34f2d6[_0x33a6('0x17')](0x1f4,_0x2029c6[_0x33a6('0x18')]));});});}; \ No newline at end of file +var _0x6eed=['waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','FaxApplication','Applications','List','get','applications','list','orderBy','priority','Contacts','length','ListId','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','agent','name'];(function(_0x1869b8,_0x49008a){var _0x11b021=function(_0x472905){while(--_0x472905){_0x1869b8['push'](_0x1869b8['shift']());}};_0x11b021(++_0x49008a);}(_0x6eed,0x173));var _0xd6ee=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0x6eed[_0x1c73ee];return _0x154f05;};'use strict';var _=require(_0xd6ee('0x0'));var util=require('util');var moment=require(_0xd6ee('0x1'));var BPromise=require(_0xd6ee('0x2'));var rs=require(_0xd6ee('0x3'));var fs=require('fs');var Redis=require(_0xd6ee('0x4'));var db=require(_0xd6ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6ee('0x6'))(_0xd6ee('0x7'));var config=require(_0xd6ee('0x8'));var jayson=require(_0xd6ee('0x9'));var client=jayson[_0xd6ee('0xa')][_0xd6ee('0xb')]({'port':0x232c});config[_0xd6ee('0xc')]=_[_0xd6ee('0xd')](config[_0xd6ee('0xc')],{'host':_0xd6ee('0xe'),'port':0x18eb});var socket=require(_0xd6ee('0xf'))(new Redis(config[_0xd6ee('0xc')]));require(_0xd6ee('0x10'))[_0xd6ee('0x11')](socket);function respondWithRpcPromise(_0x5a0560,_0x2d7081,_0x204e88){return new BPromise(function(_0x360525,_0x407602){return client['request'](_0x5a0560,_0x204e88)['then'](function(_0x453eb8){logger[_0xd6ee('0x12')]('FaxAccount,\x20%s,\x20%s',_0x2d7081,_0xd6ee('0x13'));logger[_0xd6ee('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2d7081,_0xd6ee('0x13'),JSON[_0xd6ee('0x15')](_0x453eb8));if(_0x453eb8[_0xd6ee('0x16')]){if(_0x453eb8['error'][_0xd6ee('0x17')]===0x1f4){logger[_0xd6ee('0x16')](_0xd6ee('0x18'),_0x2d7081,_0x453eb8[_0xd6ee('0x16')][_0xd6ee('0x19')]);return _0x407602(_0x453eb8[_0xd6ee('0x16')][_0xd6ee('0x19')]);}logger[_0xd6ee('0x16')](_0xd6ee('0x18'),_0x2d7081,_0x453eb8[_0xd6ee('0x16')][_0xd6ee('0x19')]);return _0x360525(_0x453eb8[_0xd6ee('0x16')][_0xd6ee('0x19')]);}else{logger[_0xd6ee('0x12')](_0xd6ee('0x18'),_0x2d7081,_0xd6ee('0x13'));_0x360525(_0x453eb8[_0xd6ee('0x1a')][_0xd6ee('0x19')]);}})['catch'](function(_0x5ddecb){logger['error'](_0xd6ee('0x18'),_0x2d7081,_0x5ddecb);_0x407602(_0x5ddecb);});});}exports[_0xd6ee('0x1b')]=function(_0x45404c){var _0x525a9f=this;return new Promise(function(_0x413c1d,_0x1c45e0){return db[_0xd6ee('0x1c')][_0xd6ee('0x1d')]({'raw':_0x45404c[_0xd6ee('0x1e')]?_0x45404c[_0xd6ee('0x1e')][_0xd6ee('0x1f')]===undefined?!![]:![]:!![],'where':_0x45404c[_0xd6ee('0x1e')]?_0x45404c[_0xd6ee('0x1e')][_0xd6ee('0x20')]||null:null,'attributes':_0x45404c[_0xd6ee('0x1e')]?_0x45404c['options'][_0xd6ee('0x21')]||null:null,'limit':_0x45404c[_0xd6ee('0x1e')]?_0x45404c['options'][_0xd6ee('0x22')]||null:null,'include':_0x45404c[_0xd6ee('0x1e')]?_0x45404c['options'][_0xd6ee('0x23')]?_[_0xd6ee('0x24')](_0x45404c['options']['include'],function(_0x541e7d){return{'model':db[_0x541e7d[_0xd6ee('0x25')]],'as':_0x541e7d['as'],'attributes':_0x541e7d[_0xd6ee('0x21')],'include':_0x541e7d['include']?_[_0xd6ee('0x24')](_0x541e7d[_0xd6ee('0x23')],function(_0x57c568){return{'model':db[_0x57c568[_0xd6ee('0x25')]],'as':_0x57c568['as'],'attributes':_0x57c568['attributes'],'include':_0x57c568[_0xd6ee('0x23')]?_[_0xd6ee('0x24')](_0x57c568[_0xd6ee('0x23')],function(_0xd75aa5){return{'model':db[_0xd75aa5[_0xd6ee('0x25')]],'as':_0xd75aa5['as'],'attributes':_0xd75aa5[_0xd6ee('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd6ee('0x26')](function(_0x2bfac5){logger[_0xd6ee('0x12')](_0xd6ee('0x1b'),_0x45404c);logger[_0xd6ee('0x14')](_0xd6ee('0x1b'),_0x45404c,JSON[_0xd6ee('0x15')](_0x2bfac5));_0x413c1d(_0x2bfac5);})[_0xd6ee('0x27')](function(_0x5c3f4d){logger[_0xd6ee('0x16')](_0xd6ee('0x1b'),_0x5c3f4d[_0xd6ee('0x19')],_0x45404c);_0x1c45e0(_0x525a9f[_0xd6ee('0x16')](0x1f4,_0x5c3f4d['message']));});});};exports[_0xd6ee('0x28')]=function(_0x4a5957,_0x5963f2,_0x5c8016){var _0x163ca2=this;return new Promise(function(_0x32cbf9,_0x36f2b2){var _0x3e2dd6={'body':_0x4a5957[_0xd6ee('0x29')],'channel':_0xd6ee('0x2a')};var _0x506a4e=[];var _0xf30fe1=[];var _0x59226d={};return db[_0xd6ee('0x2b')][_0xd6ee('0x2c')]()[_0xd6ee('0x26')](function(_0x103551){if(!_0x103551){throw new db[(_0xd6ee('0x2d'))][(_0xd6ee('0x2e'))]('no\x20available\x20attributes');}_0x506a4e=_[_0xd6ee('0x2f')](_[_0xd6ee('0x30')](_0x103551),[_0xd6ee('0x31'),_0xd6ee('0x32')]);_0xf30fe1=_[_0xd6ee('0x2f')](_[_0xd6ee('0x30')](_0x103551),[_0xd6ee('0x31'),_0xd6ee('0x32'),_0xd6ee('0x33'),'ListId']);if(_0x4a5957['body']['id']){delete _0x4a5957[_0xd6ee('0x29')]['id'];}if(_[_0xd6ee('0x34')](_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x35')])){throw new db[(_0xd6ee('0x2d'))][(_0xd6ee('0x2e'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4a5957[_0xd6ee('0x29')]['body'])||_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x29')]===''){throw new db['Sequelize'][(_0xd6ee('0x2e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x36')])){throw new db['Sequelize'][(_0xd6ee('0x2e'))](_0xd6ee('0x37')+_0xf30fe1);}if(!_[_0xd6ee('0x38')](_0xf30fe1,_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x36')])){throw new db[(_0xd6ee('0x2d'))][(_0xd6ee('0x2e'))](_0xd6ee('0x39')+_0xf30fe1);}_0x59226d[_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x36')]]=_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x35')];})[_0xd6ee('0x26')](function(){return db['FaxAccount'][_0xd6ee('0x3a')]({'where':{'id':_0x4a5957[_0xd6ee('0x3b')]['id']},'include':[{'model':db[_0xd6ee('0x3c')],'as':'List','include':[{'model':db[_0xd6ee('0x2b')],'as':'Contacts','where':_0x59226d,'limit':0x1,'order':[[_0xd6ee('0x32'),'DESC']]}]},{'model':db[_0xd6ee('0x3d')],'as':_0xd6ee('0x3e')}]});})['then'](function(_0x50ed77){if(_0x50ed77&&_0x50ed77[_0xd6ee('0x3f')]){var _0x74fcc0=_0x50ed77[_0xd6ee('0x40')]({'plain':!![]});_0x3e2dd6[_0xd6ee('0x3b')]=_0x74fcc0;_0x3e2dd6[_0xd6ee('0x41')]=_0x74fcc0['Applications'];_0x3e2dd6[_0xd6ee('0x42')]=_0x74fcc0[_0xd6ee('0x3f')];_0x3e2dd6[_0xd6ee('0x41')]=_[_0xd6ee('0x43')](_0x3e2dd6[_0xd6ee('0x41')],[_0xd6ee('0x44')],['asc']);if(_0x3e2dd6[_0xd6ee('0x3b')][_0xd6ee('0x3e')]){delete _0x3e2dd6[_0xd6ee('0x3b')]['Applications'];}if(_0x3e2dd6[_0xd6ee('0x3b')][_0xd6ee('0x3f')]&&_0x3e2dd6['account'][_0xd6ee('0x3f')][_0xd6ee('0x45')][_0xd6ee('0x46')]){return _0x3e2dd6['account'][_0xd6ee('0x3f')][_0xd6ee('0x45')][0x0];}var _0x587935=_['defaults'](_0x4a5957[_0xd6ee('0x29')],{'firstName':_0x4a5957[_0xd6ee('0x29')]['from'],'ListId':_0x74fcc0[_0xd6ee('0x47')]});_0x587935[_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x36')]]=_0x4a5957[_0xd6ee('0x29')]['from'];return db[_0xd6ee('0x2b')]['create'](_0x587935,{'fields':_0x506a4e,'raw':!![]});}})['then'](function(_0xa5d152){_0x3e2dd6['contact']=_0xa5d152;if(_0xa5d152){var _0x167186={'ContactId':_0xa5d152['id'],'FaxAccountId':_0x4a5957['account']['id'],'fax':_0xa5d152[_0xd6ee('0x2a')]};return db['FaxInteraction'][_0xd6ee('0x3a')]({'where':{'ContactId':_0xa5d152['id'],'closed':![],'FaxAccountId':_0x4a5957['account']['id']}})[_0xd6ee('0x26')](function(_0x38e4f7){if(_0x38e4f7){return[_0x38e4f7,![]];}return db[_0xd6ee('0x48')][_0xd6ee('0x49')](_0x167186)[_0xd6ee('0x26')](function(_0x39d289){return[_0x39d289,!![]];});});}else{throw new Error(_0xd6ee('0x4a'));}})['spread'](function(_0x3b14d8,_0x31def2){var _0x17e600=_0x3b14d8[_0xd6ee('0x40')]({'plain':!![]});if(_0x31def2){if(_0x3e2dd6[_0xd6ee('0x3b')][_0xd6ee('0x4b')]){_0x3e2dd6['applications'][_0xd6ee('0x4c')]({'id':0x0,'priority':_0x3e2dd6[_0xd6ee('0x41')][_0xd6ee('0x46')]+0x1,'app':_0xd6ee('0x4d'),'appdata':_0xd6ee('0x4e'),'interval':_0xd6ee('0x4f')});}_0x17e600['created']=!![];}else{_0x17e600['created']=![];}_0x3e2dd6[_0xd6ee('0x50')]=_0x17e600;return db[_0xd6ee('0x51')][_0xd6ee('0x49')]({'body':_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x29')],'FaxAccountId':_0x4a5957[_0xd6ee('0x3b')]['id'],'FaxInteractionId':_0x3b14d8['id'],'direction':'in','ContactId':_0x3b14d8[_0xd6ee('0x52')],'AttachmentId':_0x4a5957[_0xd6ee('0x29')][_0xd6ee('0x53')]});})[_0xd6ee('0x26')](function(_0x2b4c57){_0x3e2dd6[_0xd6ee('0x19')]=_0x2b4c57;if(_0x3e2dd6[_0xd6ee('0x50')][_0xd6ee('0x54')]){return db[_0xd6ee('0x55')][_0xd6ee('0x3a')]({'attributes':['id','name'],'where':{'id':_0x3e2dd6[_0xd6ee('0x50')][_0xd6ee('0x54')]}})[_0xd6ee('0x26')](function(_0xfc1b81){if(_0xfc1b81){_0x3e2dd6[_0xd6ee('0x41')][_0xd6ee('0x56')]({'id':0x0,'priority':0x0,'app':_0xd6ee('0x57'),'appdata':_0xfc1b81[_0xd6ee('0x58')]+','+(_0x3e2dd6['account'][_0xd6ee('0x59')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd6ee('0x5a'),_0xd6ee('0x5b'),_0x3e2dd6);});}return respondWithRpcPromise(_0xd6ee('0x5a'),'startRouting',_0x3e2dd6);})[_0xd6ee('0x26')](function(_0x1e85a7){_0x32cbf9(_0x1e85a7);})['catch'](function(_0x1de801){_0x36f2b2(_0x163ca2[_0xd6ee('0x16')](0x1f4,_0x1de801[_0xd6ee('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f134d67..888b22e 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 _0xde93=['removeListener','register','length','faxAccount:','./faxAccount.events','save','emit'];(function(_0x1e862b,_0x58b945){var _0x171fcd=function(_0x5b8456){while(--_0x5b8456){_0x1e862b['push'](_0x1e862b['shift']());}};_0x171fcd(++_0x58b945);}(_0xde93,0x18c));var _0x3de9=function(_0x544123,_0x48d2c9){_0x544123=_0x544123-0x0;var _0x34dcd4=_0xde93[_0x544123];return _0x34dcd4;};'use strict';var FaxAccountEvents=require(_0x3de9('0x0'));var events=[_0x3de9('0x1'),'remove','update'];function createListener(_0x348666,_0x26ceb3){return function(_0x142a81){_0x26ceb3[_0x3de9('0x2')](_0x348666,_0x142a81);};}function removeListener(_0xb3a402,_0x161586){return function(){FaxAccountEvents[_0x3de9('0x3')](_0xb3a402,_0x161586);};}exports[_0x3de9('0x4')]=function(_0x30bc46){for(var _0x10ecb3=0x0,_0x23eaed=events[_0x3de9('0x5')];_0x10ecb3<_0x23eaed;_0x10ecb3++){var _0x1a376d=events[_0x10ecb3];var _0x302029=createListener(_0x3de9('0x6')+_0x1a376d,_0x30bc46);FaxAccountEvents['on'](_0x1a376d,_0x302029);}}; \ No newline at end of file +var _0x7cc9=['removeListener','length','faxAccount:','./faxAccount.events','save','update','emit'];(function(_0x4e9861,_0x25fe5f){var _0x49802f=function(_0x76932){while(--_0x76932){_0x4e9861['push'](_0x4e9861['shift']());}};_0x49802f(++_0x25fe5f);}(_0x7cc9,0xb2));var _0x97cc=function(_0x1824c9,_0x475d83){_0x1824c9=_0x1824c9-0x0;var _0x3ad7e9=_0x7cc9[_0x1824c9];return _0x3ad7e9;};'use strict';var FaxAccountEvents=require(_0x97cc('0x0'));var events=[_0x97cc('0x1'),'remove',_0x97cc('0x2')];function createListener(_0x2c07dc,_0x31949e){return function(_0x1d0c0c){_0x31949e[_0x97cc('0x3')](_0x2c07dc,_0x1d0c0c);};}function removeListener(_0x5c8207,_0x4de308){return function(){FaxAccountEvents[_0x97cc('0x4')](_0x5c8207,_0x4de308);};}exports['register']=function(_0x163bce){for(var _0xbcb39d=0x0,_0x21ebeb=events[_0x97cc('0x5')];_0xbcb39d<_0x21ebeb;_0xbcb39d++){var _0x15e578=events[_0xbcb39d];var _0x5ab0db=createListener(_0x97cc('0x6')+_0x15e578,_0x163bce);FaxAccountEvents['on'](_0x15e578,_0x5ab0db);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c335a83..c98e790 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(_0x41342e,_0x427f74){var _0x5155e6=function(_0x3c953d){while(--_0x3c953d){_0x41342e['push'](_0x41342e['shift']());}};_0x5155e6(++_0x427f74);}(_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 +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(_0x969407,_0x4b07cd){var _0x1df001=function(_0x33a0f8){while(--_0x33a0f8){_0x969407['push'](_0x969407['shift']());}};_0x1df001(++_0x4b07cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 f0eee16..c43a7cd 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 _0x3df0=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x518502,_0x23df26){var _0x59791d=function(_0x1a9845){while(--_0x1a9845){_0x518502['push'](_0x518502['shift']());}};_0x59791d(++_0x23df26);}(_0x3df0,0xb3));var _0x03df=function(_0x2101f2,_0x405ba2){_0x2101f2=_0x2101f2-0x0;var _0x1dfc10=_0x3df0[_0x2101f2];return _0x1dfc10;};'use strict';var Sequelize=require(_0x03df('0x0'));module['exports']={'priority':{'type':Sequelize[_0x03df('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x03df('0x2')],'allowNull':![],'defaultValue':_0x03df('0x3')},'appdata':{'type':Sequelize[_0x03df('0x4')]()},'description':{'type':Sequelize[_0x03df('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x03df('0x5')}}; \ No newline at end of file +var _0xea08=['STRING','noop','*,*,*,*','sequelize','INTEGER'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0xea08,0x1b6));var _0x8ea0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xea08[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8ea0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8ea0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8ea0('0x2')],'allowNull':![],'defaultValue':_0x8ea0('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8ea0('0x2')]},'interval':{'type':Sequelize[_0x8ea0('0x2')],'defaultValue':_0x8ea0('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d302d13..c8ca401 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 _0xb900=['end','offset','undefined','limit','count','set','Content-Range','json','save','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0xb900,0x19c));var _0x0b90=function(_0x1b1cce,_0x267557){_0x1b1cce=_0x1b1cce-0x0;var _0x5d515d=_0xb900[_0x1b1cce];return _0x5d515d;};'use strict';var emlformat=require(_0x0b90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b90('0x1'));var jsonpatch=require(_0x0b90('0x2'));var rp=require(_0x0b90('0x3'));var moment=require('moment');var BPromise=require(_0x0b90('0x4'));var Mustache=require('mustache');var util=require(_0x0b90('0x5'));var path=require(_0x0b90('0x6'));var sox=require(_0x0b90('0x7'));var csv=require('to-csv');var ejs=require(_0x0b90('0x8'));var fs=require('fs');var fs_extra=require(_0x0b90('0x9'));var _=require(_0x0b90('0xa'));var squel=require(_0x0b90('0xb'));var crypto=require('crypto');var jsforce=require(_0x0b90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0b90('0xd'));var querystring=require(_0x0b90('0xe'));var Papa=require(_0x0b90('0xf'));var Redis=require(_0x0b90('0x10'));var authService=require(_0x0b90('0x11'));var qs=require(_0x0b90('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b90('0x13'))('api');var utils=require(_0x0b90('0x14'));var config=require(_0x0b90('0x15'));var licenseUtil=require(_0x0b90('0x16'));var db=require(_0x0b90('0x17'))['db'];function respondWithStatusCode(_0x5aff51,_0x4759ac){_0x4759ac=_0x4759ac||0xcc;return function(_0x49a357){if(_0x49a357){return _0x5aff51[_0x0b90('0x18')](_0x4759ac);}return _0x5aff51[_0x0b90('0x19')](_0x4759ac)[_0x0b90('0x1a')]();};}function respondWithResult(_0x5a4d49,_0x2194ad){_0x2194ad=_0x2194ad||0xc8;return function(_0x34870a){if(_0x34870a){return _0x5a4d49[_0x0b90('0x19')](_0x2194ad)['json'](_0x34870a);}};}function respondWithFilteredResult(_0x3e2334,_0x476bfa){return function(_0x589917){if(_0x589917){var _0xb10ba1=typeof _0x476bfa[_0x0b90('0x1b')]===_0x0b90('0x1c')&&typeof _0x476bfa[_0x0b90('0x1d')]===_0x0b90('0x1c');var _0x2bab37=_0x589917[_0x0b90('0x1e')];var _0x348de1=_0xb10ba1?0x0:_0x476bfa[_0x0b90('0x1b')];var _0x2a93d7=_0xb10ba1?_0x589917['count']:_0x476bfa['offset']+_0x476bfa[_0x0b90('0x1d')];var _0x318c90;if(_0x2a93d7>=_0x2bab37){_0x2a93d7=_0x2bab37;_0x318c90=0xc8;}else{_0x318c90=0xce;}_0x3e2334['status'](_0x318c90);return _0x3e2334[_0x0b90('0x1f')](_0x0b90('0x20'),_0x348de1+'-'+_0x2a93d7+'/'+_0x2bab37)[_0x0b90('0x21')](_0x589917);}return null;};}function patchUpdates(_0x4aeaee){return function(_0x5f0bba){try{jsonpatch['apply'](_0x5f0bba,_0x4aeaee,!![]);}catch(_0xd8b606){return BPromise['reject'](_0xd8b606);}return _0x5f0bba[_0x0b90('0x22')]();};}function saveUpdates(_0x21e64a,_0x531292){return function(_0x252f7d){if(_0x252f7d){return _0x252f7d['update'](_0x21e64a)[_0x0b90('0x23')](function(_0x31176d){return _0x31176d;});}return null;};}function removeEntity(_0x5c36c8,_0x438a40){return function(_0x395dd5){if(_0x395dd5){return _0x395dd5['destroy']()[_0x0b90('0x23')](function(){_0x5c36c8[_0x0b90('0x19')](0xcc)[_0x0b90('0x1a')]();});}};}function handleEntityNotFound(_0x2ef42d,_0x1d1926){return function(_0x47a556){if(!_0x47a556){_0x2ef42d[_0x0b90('0x18')](0x194);}return _0x47a556;};}function handleError(_0x449bca,_0x47c7a6){_0x47c7a6=_0x47c7a6||0x1f4;return function(_0x16df19){logger[_0x0b90('0x24')](_0x16df19[_0x0b90('0x25')]);if(_0x16df19['name']){delete _0x16df19[_0x0b90('0x26')];}_0x449bca['status'](_0x47c7a6)[_0x0b90('0x27')](_0x16df19);};}exports[_0x0b90('0x28')]=function(_0x50a188,_0xffe9a3){var _0x18ba82={},_0x163db2={},_0x49cb60={'count':0x0,'rows':[]};var _0x2e073c=_[_0x0b90('0x29')](db[_0x0b90('0x2a')][_0x0b90('0x2b')],function(_0x1219b0){return{'name':_0x1219b0[_0x0b90('0x2c')],'type':_0x1219b0[_0x0b90('0x2d')][_0x0b90('0x2e')]};});_0x163db2[_0x0b90('0x2f')]=_[_0x0b90('0x29')](_0x2e073c,'name');_0x163db2[_0x0b90('0x30')]=_[_0x0b90('0x31')](_0x50a188[_0x0b90('0x30')]);_0x163db2[_0x0b90('0x32')]=_[_0x0b90('0x33')](_0x163db2[_0x0b90('0x2f')],_0x163db2[_0x0b90('0x30')]);_0x18ba82['attributes']=_[_0x0b90('0x33')](_0x163db2[_0x0b90('0x2f')],qs[_0x0b90('0x34')](_0x50a188[_0x0b90('0x30')][_0x0b90('0x34')]));_0x18ba82['attributes']=_0x18ba82[_0x0b90('0x35')][_0x0b90('0x36')]?_0x18ba82['attributes']:_0x163db2[_0x0b90('0x2f')];if(!_0x50a188[_0x0b90('0x30')][_0x0b90('0x37')](_0x0b90('0x38'))){_0x18ba82[_0x0b90('0x1d')]=qs[_0x0b90('0x1d')](_0x50a188[_0x0b90('0x30')]['limit']);_0x18ba82[_0x0b90('0x1b')]=qs[_0x0b90('0x1b')](_0x50a188['query']['offset']);}_0x18ba82[_0x0b90('0x39')]=qs['sort'](_0x50a188[_0x0b90('0x30')][_0x0b90('0x3a')]);_0x18ba82[_0x0b90('0x3b')]=qs['filters'](_[_0x0b90('0x3c')](_0x50a188['query'],_0x163db2[_0x0b90('0x32')]),_0x2e073c);if(_0x50a188[_0x0b90('0x30')][_0x0b90('0x3d')]){_0x18ba82['where']=_[_0x0b90('0x3e')](_0x18ba82[_0x0b90('0x3b')],{'$or':_['map'](_0x2e073c,function(_0x2db558){if(_0x2db558[_0x0b90('0x2d')]!==_0x0b90('0x3f')){var _0x1b55e6={};_0x1b55e6[_0x2db558[_0x0b90('0x26')]]={'$like':'%'+_0x50a188['query'][_0x0b90('0x3d')]+'%'};return _0x1b55e6;}})});}_0x18ba82=_[_0x0b90('0x3e')]({},_0x18ba82,_0x50a188[_0x0b90('0x40')]);var _0x583229={'where':_0x18ba82[_0x0b90('0x3b')]};return db[_0x0b90('0x2a')]['count'](_0x583229)['then'](function(_0xa58670){_0x49cb60[_0x0b90('0x1e')]=_0xa58670;if(_0x50a188['query']['includeAll']){_0x18ba82[_0x0b90('0x41')]=[{'all':!![]}];}return db[_0x0b90('0x2a')][_0x0b90('0x42')](_0x18ba82);})['then'](function(_0x4a8743){_0x49cb60['rows']=_0x4a8743;return _0x49cb60;})[_0x0b90('0x23')](respondWithFilteredResult(_0xffe9a3,_0x18ba82))[_0x0b90('0x43')](handleError(_0xffe9a3,null));};exports[_0x0b90('0x44')]=function(_0x4520b2,_0x17b26c){var _0xd753b6={'raw':!![],'where':{'id':_0x4520b2['params']['id']}},_0x3aa309={};_0x3aa309[_0x0b90('0x2f')]=_[_0x0b90('0x31')](db[_0x0b90('0x2a')][_0x0b90('0x2b')]);_0x3aa309[_0x0b90('0x30')]=_['keys'](_0x4520b2[_0x0b90('0x30')]);_0x3aa309[_0x0b90('0x32')]=_[_0x0b90('0x33')](_0x3aa309[_0x0b90('0x2f')],_0x3aa309[_0x0b90('0x30')]);_0xd753b6[_0x0b90('0x35')]=_[_0x0b90('0x33')](_0x3aa309[_0x0b90('0x2f')],qs[_0x0b90('0x34')](_0x4520b2[_0x0b90('0x30')][_0x0b90('0x34')]));_0xd753b6['attributes']=_0xd753b6[_0x0b90('0x35')]['length']?_0xd753b6[_0x0b90('0x35')]:_0x3aa309['model'];if(_0x4520b2[_0x0b90('0x30')]['includeAll']){_0xd753b6[_0x0b90('0x41')]=[{'all':!![]}];}_0xd753b6=_['merge']({},_0xd753b6,_0x4520b2['options']);return db[_0x0b90('0x2a')][_0x0b90('0x45')](_0xd753b6)[_0x0b90('0x23')](handleEntityNotFound(_0x17b26c,null))[_0x0b90('0x23')](respondWithResult(_0x17b26c,null))['catch'](handleError(_0x17b26c,null));};exports[_0x0b90('0x46')]=function(_0x3d7417,_0x350893){return db[_0x0b90('0x2a')]['create'](_0x3d7417['body'],{})[_0x0b90('0x23')](respondWithResult(_0x350893,0xc9))['catch'](handleError(_0x350893,null));};exports['update']=function(_0x320287,_0x235607){if(_0x320287[_0x0b90('0x47')]['id']){delete _0x320287[_0x0b90('0x47')]['id'];}return db[_0x0b90('0x2a')]['find']({'where':{'id':_0x320287['params']['id']}})[_0x0b90('0x23')](handleEntityNotFound(_0x235607,null))[_0x0b90('0x23')](saveUpdates(_0x320287[_0x0b90('0x47')],null))['then'](respondWithResult(_0x235607,null))[_0x0b90('0x43')](handleError(_0x235607,null));};exports[_0x0b90('0x48')]=function(_0x5f510b,_0x3fac65){return db[_0x0b90('0x2a')][_0x0b90('0x45')]({'where':{'id':_0x5f510b['params']['id']}})[_0x0b90('0x23')](handleEntityNotFound(_0x3fac65,null))['then'](removeEntity(_0x3fac65,null))['catch'](handleError(_0x3fac65,null));}; \ No newline at end of file +var _0x5ea1=['rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','destroy','find','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','name','FaxApplication'];(function(_0x3833f4,_0xb7f4ec){var _0x393f0b=function(_0x2eb3a9){while(--_0x2eb3a9){_0x3833f4['push'](_0x3833f4['shift']());}};_0x393f0b(++_0xb7f4ec);}(_0x5ea1,0xa9));var _0x15ea=function(_0xc274df,_0x3d9ab9){_0xc274df=_0xc274df-0x0;var _0x5ebb04=_0x5ea1[_0xc274df];return _0x5ebb04;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x15ea('0x0'));var jsonpatch=require(_0x15ea('0x1'));var rp=require('request-promise');var moment=require(_0x15ea('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x15ea('0x3'));var util=require('util');var path=require(_0x15ea('0x4'));var sox=require(_0x15ea('0x5'));var csv=require(_0x15ea('0x6'));var ejs=require(_0x15ea('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15ea('0x8'));var squel=require('squel');var crypto=require(_0x15ea('0x9'));var jsforce=require(_0x15ea('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x15ea('0x6'));var querystring=require('querystring');var Papa=require(_0x15ea('0xb'));var Redis=require('ioredis');var authService=require(_0x15ea('0xc'));var qs=require(_0x15ea('0xd'));var as=require(_0x15ea('0xe'));var hardwareService=require(_0x15ea('0xf'));var logger=require(_0x15ea('0x10'))(_0x15ea('0x11'));var utils=require('../../config/utils');var config=require(_0x15ea('0x12'));var licenseUtil=require(_0x15ea('0x13'));var db=require(_0x15ea('0x14'))['db'];function respondWithStatusCode(_0x3e6e62,_0x516cb0){_0x516cb0=_0x516cb0||0xcc;return function(_0x8ba7d1){if(_0x8ba7d1){return _0x3e6e62[_0x15ea('0x15')](_0x516cb0);}return _0x3e6e62[_0x15ea('0x16')](_0x516cb0)[_0x15ea('0x17')]();};}function respondWithResult(_0x3dc0a0,_0x520452){_0x520452=_0x520452||0xc8;return function(_0xf66331){if(_0xf66331){return _0x3dc0a0[_0x15ea('0x16')](_0x520452)[_0x15ea('0x18')](_0xf66331);}};}function respondWithFilteredResult(_0x399f22,_0x762207){return function(_0x48be26){if(_0x48be26){var _0x21b3a1=typeof _0x762207[_0x15ea('0x19')]==='undefined'&&typeof _0x762207[_0x15ea('0x1a')]===_0x15ea('0x1b');var _0xf1f6af=_0x48be26[_0x15ea('0x1c')];var _0x3f2432=_0x21b3a1?0x0:_0x762207[_0x15ea('0x19')];var _0x2a265e=_0x21b3a1?_0x48be26[_0x15ea('0x1c')]:_0x762207['offset']+_0x762207[_0x15ea('0x1a')];var _0x4be9b5;if(_0x2a265e>=_0xf1f6af){_0x2a265e=_0xf1f6af;_0x4be9b5=0xc8;}else{_0x4be9b5=0xce;}_0x399f22[_0x15ea('0x16')](_0x4be9b5);return _0x399f22[_0x15ea('0x1d')](_0x15ea('0x1e'),_0x3f2432+'-'+_0x2a265e+'/'+_0xf1f6af)[_0x15ea('0x18')](_0x48be26);}return null;};}function patchUpdates(_0x4c535c){return function(_0x465d44){try{jsonpatch[_0x15ea('0x1f')](_0x465d44,_0x4c535c,!![]);}catch(_0x39b8aa){return BPromise['reject'](_0x39b8aa);}return _0x465d44[_0x15ea('0x20')]();};}function saveUpdates(_0x48237b,_0x511fad){return function(_0x46f383){if(_0x46f383){return _0x46f383[_0x15ea('0x21')](_0x48237b)[_0x15ea('0x22')](function(_0x4165e6){return _0x4165e6;});}return null;};}function removeEntity(_0x335e06,_0x4b3fb2){return function(_0x5d8153){if(_0x5d8153){return _0x5d8153['destroy']()[_0x15ea('0x22')](function(){_0x335e06['status'](0xcc)[_0x15ea('0x17')]();});}};}function handleEntityNotFound(_0x547f25,_0x1e3399){return function(_0x4f01da){if(!_0x4f01da){_0x547f25[_0x15ea('0x15')](0x194);}return _0x4f01da;};}function handleError(_0x567798,_0x157e06){_0x157e06=_0x157e06||0x1f4;return function(_0x26bf2e){logger[_0x15ea('0x23')](_0x26bf2e['stack']);if(_0x26bf2e[_0x15ea('0x24')]){delete _0x26bf2e[_0x15ea('0x24')];}_0x567798[_0x15ea('0x16')](_0x157e06)['send'](_0x26bf2e);};}exports['index']=function(_0x8af1ab,_0x55e331){var _0x140cfa={},_0x6d6583={},_0x37fdcf={'count':0x0,'rows':[]};var _0x4fc974=_['map'](db[_0x15ea('0x25')][_0x15ea('0x26')],function(_0x10cc52){return{'name':_0x10cc52[_0x15ea('0x27')],'type':_0x10cc52[_0x15ea('0x28')]['key']};});_0x6d6583[_0x15ea('0x29')]=_[_0x15ea('0x2a')](_0x4fc974,_0x15ea('0x24'));_0x6d6583[_0x15ea('0x2b')]=_[_0x15ea('0x2c')](_0x8af1ab[_0x15ea('0x2b')]);_0x6d6583[_0x15ea('0x2d')]=_[_0x15ea('0x2e')](_0x6d6583[_0x15ea('0x29')],_0x6d6583[_0x15ea('0x2b')]);_0x140cfa[_0x15ea('0x2f')]=_[_0x15ea('0x2e')](_0x6d6583[_0x15ea('0x29')],qs[_0x15ea('0x30')](_0x8af1ab[_0x15ea('0x2b')][_0x15ea('0x30')]));_0x140cfa[_0x15ea('0x2f')]=_0x140cfa['attributes'][_0x15ea('0x31')]?_0x140cfa[_0x15ea('0x2f')]:_0x6d6583[_0x15ea('0x29')];if(!_0x8af1ab[_0x15ea('0x2b')][_0x15ea('0x32')](_0x15ea('0x33'))){_0x140cfa[_0x15ea('0x1a')]=qs['limit'](_0x8af1ab[_0x15ea('0x2b')]['limit']);_0x140cfa[_0x15ea('0x19')]=qs[_0x15ea('0x19')](_0x8af1ab['query'][_0x15ea('0x19')]);}_0x140cfa['order']=qs[_0x15ea('0x34')](_0x8af1ab[_0x15ea('0x2b')][_0x15ea('0x34')]);_0x140cfa[_0x15ea('0x35')]=qs['filters'](_[_0x15ea('0x36')](_0x8af1ab[_0x15ea('0x2b')],_0x6d6583[_0x15ea('0x2d')]),_0x4fc974);if(_0x8af1ab[_0x15ea('0x2b')][_0x15ea('0x37')]){_0x140cfa[_0x15ea('0x35')]=_[_0x15ea('0x38')](_0x140cfa['where'],{'$or':_['map'](_0x4fc974,function(_0x4d3e92){if(_0x4d3e92[_0x15ea('0x28')]!==_0x15ea('0x39')){var _0x2ca8e3={};_0x2ca8e3[_0x4d3e92[_0x15ea('0x24')]]={'$like':'%'+_0x8af1ab[_0x15ea('0x2b')]['filter']+'%'};return _0x2ca8e3;}})});}_0x140cfa=_[_0x15ea('0x38')]({},_0x140cfa,_0x8af1ab[_0x15ea('0x3a')]);var _0x204b04={'where':_0x140cfa['where']};return db[_0x15ea('0x25')]['count'](_0x204b04)[_0x15ea('0x22')](function(_0x393c1a){_0x37fdcf[_0x15ea('0x1c')]=_0x393c1a;if(_0x8af1ab['query'][_0x15ea('0x3b')]){_0x140cfa['include']=[{'all':!![]}];}return db[_0x15ea('0x25')][_0x15ea('0x3c')](_0x140cfa);})[_0x15ea('0x22')](function(_0xfd672f){_0x37fdcf['rows']=_0xfd672f;return _0x37fdcf;})[_0x15ea('0x22')](respondWithFilteredResult(_0x55e331,_0x140cfa))[_0x15ea('0x3d')](handleError(_0x55e331,null));};exports[_0x15ea('0x3e')]=function(_0x3ea389,_0x36dce6){var _0x37bb86={'raw':!![],'where':{'id':_0x3ea389[_0x15ea('0x3f')]['id']}},_0x3c9e13={};_0x3c9e13['model']=_[_0x15ea('0x2c')](db['FaxApplication'][_0x15ea('0x26')]);_0x3c9e13['query']=_['keys'](_0x3ea389[_0x15ea('0x2b')]);_0x3c9e13['filters']=_[_0x15ea('0x2e')](_0x3c9e13[_0x15ea('0x29')],_0x3c9e13[_0x15ea('0x2b')]);_0x37bb86[_0x15ea('0x2f')]=_[_0x15ea('0x2e')](_0x3c9e13[_0x15ea('0x29')],qs[_0x15ea('0x30')](_0x3ea389[_0x15ea('0x2b')][_0x15ea('0x30')]));_0x37bb86['attributes']=_0x37bb86['attributes']['length']?_0x37bb86[_0x15ea('0x2f')]:_0x3c9e13['model'];if(_0x3ea389[_0x15ea('0x2b')][_0x15ea('0x3b')]){_0x37bb86[_0x15ea('0x40')]=[{'all':!![]}];}_0x37bb86=_[_0x15ea('0x38')]({},_0x37bb86,_0x3ea389[_0x15ea('0x3a')]);return db['FaxApplication']['find'](_0x37bb86)[_0x15ea('0x22')](handleEntityNotFound(_0x36dce6,null))['then'](respondWithResult(_0x36dce6,null))[_0x15ea('0x3d')](handleError(_0x36dce6,null));};exports[_0x15ea('0x41')]=function(_0x3400fc,_0x11a654){return db[_0x15ea('0x25')][_0x15ea('0x41')](_0x3400fc[_0x15ea('0x42')],{})[_0x15ea('0x22')](respondWithResult(_0x11a654,0xc9))[_0x15ea('0x3d')](handleError(_0x11a654,null));};exports['update']=function(_0x1e1c47,_0x2b74a0){if(_0x1e1c47['body']['id']){delete _0x1e1c47[_0x15ea('0x42')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x1e1c47[_0x15ea('0x3f')]['id']}})[_0x15ea('0x22')](handleEntityNotFound(_0x2b74a0,null))[_0x15ea('0x22')](saveUpdates(_0x1e1c47[_0x15ea('0x42')],null))[_0x15ea('0x22')](respondWithResult(_0x2b74a0,null))[_0x15ea('0x3d')](handleError(_0x2b74a0,null));};exports[_0x15ea('0x43')]=function(_0x2de5e8,_0x38bf0f){return db[_0x15ea('0x25')][_0x15ea('0x44')]({'where':{'id':_0x2de5e8[_0x15ea('0x3f')]['id']}})[_0x15ea('0x22')](handleEntityNotFound(_0x38bf0f,null))[_0x15ea('0x22')](removeEntity(_0x38bf0f,null))[_0x15ea('0x3d')](handleError(_0x38bf0f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 7fa298c..a03a489 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 _0x9757=['../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x34a057,_0x3d3299){var _0xf2361f=function(_0x8c3c42){while(--_0x8c3c42){_0x34a057['push'](_0x34a057['shift']());}};_0xf2361f(++_0x3d3299);}(_0x9757,0xca));var _0x7975=function(_0x18b256,_0x3c110f){_0x18b256=_0x18b256-0x0;var _0x2bc0f6=_0x9757[_0x18b256];return _0x2bc0f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7975('0x0'))(_0x7975('0x1'));var moment=require(_0x7975('0x2'));var BPromise=require(_0x7975('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7975('0x4'));var rimraf=require(_0x7975('0x5'));var config=require(_0x7975('0x6'));var attributes=require(_0x7975('0x7'));module[_0x7975('0x8')]=function(_0x4348ad,_0x232963){return _0x4348ad[_0x7975('0x9')](_0x7975('0xa'),attributes,{'tableName':_0x7975('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7975('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4fa1=['bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x439499,_0x218449){var _0x1942e8=function(_0x20a585){while(--_0x20a585){_0x439499['push'](_0x439499['shift']());}};_0x1942e8(++_0x218449);}(_0x4fa1,0x1eb));var _0x14fa=function(_0x51a9b0,_0x197fa1){_0x51a9b0=_0x51a9b0-0x0;var _0x5f1ac4=_0x4fa1[_0x51a9b0];return _0x5f1ac4;};'use strict';var _=require('lodash');var util=require(_0x14fa('0x0'));var logger=require(_0x14fa('0x1'))(_0x14fa('0x2'));var moment=require('moment');var BPromise=require(_0x14fa('0x3'));var rp=require(_0x14fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14fa('0x5'));var config=require(_0x14fa('0x6'));var attributes=require(_0x14fa('0x7'));module[_0x14fa('0x8')]=function(_0xb0cbb7,_0x5012c6){return _0xb0cbb7[_0x14fa('0x9')]('FaxApplication',attributes,{'tableName':_0x14fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14fa('0xb'),'collate':_0x14fa('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index a55d951..69fc7a7 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 _0x5d59=['attributes','limit','then','UpdateFaxApplication','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','body','options','raw','where'];(function(_0x125ee6,_0x5224bd){var _0x215486=function(_0x3df604){while(--_0x3df604){_0x125ee6['push'](_0x125ee6['shift']());}};_0x215486(++_0x5224bd);}(_0x5d59,0x159));var _0x95d5=function(_0x454d94,_0x2d5642){_0x454d94=_0x454d94-0x0;var _0x1389b0=_0x5d59[_0x454d94];return _0x1389b0;};'use strict';var _=require(_0x95d5('0x0'));var util=require(_0x95d5('0x1'));var moment=require(_0x95d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x95d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95d5('0x4'));var logger=require(_0x95d5('0x5'))(_0x95d5('0x6'));var config=require(_0x95d5('0x7'));var jayson=require(_0x95d5('0x8'));var client=jayson['client'][_0x95d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b9e2b,_0x3f8399,_0x57c95f){return new BPromise(function(_0x158e13,_0x196456){return client['request'](_0x2b9e2b,_0x57c95f)['then'](function(_0x542aab){logger[_0x95d5('0xa')](_0x95d5('0xb'),_0x3f8399,_0x95d5('0xc'));logger[_0x95d5('0xd')](_0x95d5('0xe'),_0x3f8399,_0x95d5('0xc'),JSON[_0x95d5('0xf')](_0x542aab));if(_0x542aab[_0x95d5('0x10')]){if(_0x542aab[_0x95d5('0x10')][_0x95d5('0x11')]===0x1f4){logger[_0x95d5('0x10')](_0x95d5('0xb'),_0x3f8399,_0x542aab['error'][_0x95d5('0x12')]);return _0x196456(_0x542aab['error'][_0x95d5('0x12')]);}logger[_0x95d5('0x10')](_0x95d5('0xb'),_0x3f8399,_0x542aab[_0x95d5('0x10')]['message']);return _0x158e13(_0x542aab[_0x95d5('0x10')][_0x95d5('0x12')]);}else{logger[_0x95d5('0xa')](_0x95d5('0xb'),_0x3f8399,_0x95d5('0xc'));_0x158e13(_0x542aab[_0x95d5('0x13')]['message']);}})[_0x95d5('0x14')](function(_0x578647){logger['error'](_0x95d5('0xb'),_0x3f8399,_0x578647);_0x196456(_0x578647);});});}exports['UpdateFaxApplication']=function(_0x4520f2){var _0x5afeb6=this;return new Promise(function(_0x6b4da2,_0x47b1e8){return db[_0x95d5('0x15')][_0x95d5('0x16')](_0x4520f2[_0x95d5('0x17')],{'raw':_0x4520f2[_0x95d5('0x18')]?_0x4520f2[_0x95d5('0x18')][_0x95d5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4520f2['options']?_0x4520f2[_0x95d5('0x18')][_0x95d5('0x1a')]||null:null,'attributes':_0x4520f2['options']?_0x4520f2[_0x95d5('0x18')][_0x95d5('0x1b')]||null:null,'limit':_0x4520f2['options']?_0x4520f2[_0x95d5('0x18')][_0x95d5('0x1c')]||null:null})[_0x95d5('0x1d')](function(_0x26099f){logger[_0x95d5('0xa')](_0x95d5('0x1e'),_0x4520f2);logger[_0x95d5('0xd')](_0x95d5('0x1e'),_0x4520f2,JSON[_0x95d5('0xf')](_0x26099f));_0x6b4da2(_0x26099f);})[_0x95d5('0x14')](function(_0x2425ce){logger[_0x95d5('0x10')](_0x95d5('0x1e'),_0x2425ce[_0x95d5('0x12')],_0x4520f2);_0x47b1e8(_0x5afeb6['error'](0x1f4,_0x2425ce['message']));});});}; \ No newline at end of file +var _0xb889=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4b630,_0x151f86){var _0x24f855=function(_0x2ead2a){while(--_0x2ead2a){_0x4b630['push'](_0x4b630['shift']());}};_0x24f855(++_0x151f86);}(_0xb889,0x16f));var _0x9b88=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xb889[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x9b88('0x0'));var util=require(_0x9b88('0x1'));var moment=require(_0x9b88('0x2'));var BPromise=require(_0x9b88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b88('0x4'));var db=require(_0x9b88('0x5'))['db'];var utils=require(_0x9b88('0x6'));var logger=require(_0x9b88('0x7'))(_0x9b88('0x8'));var config=require(_0x9b88('0x9'));var jayson=require(_0x9b88('0xa'));var client=jayson[_0x9b88('0xb')][_0x9b88('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b1323,_0x53956e,_0x356d21){return new BPromise(function(_0x23b6f0,_0x143302){return client[_0x9b88('0xd')](_0x2b1323,_0x356d21)[_0x9b88('0xe')](function(_0x5c4fc4){logger[_0x9b88('0xf')](_0x9b88('0x10'),_0x53956e,_0x9b88('0x11'));logger[_0x9b88('0x12')](_0x9b88('0x13'),_0x53956e,_0x9b88('0x11'),JSON[_0x9b88('0x14')](_0x5c4fc4));if(_0x5c4fc4[_0x9b88('0x15')]){if(_0x5c4fc4[_0x9b88('0x15')][_0x9b88('0x16')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x53956e,_0x5c4fc4[_0x9b88('0x15')]['message']);return _0x143302(_0x5c4fc4['error'][_0x9b88('0x17')]);}logger[_0x9b88('0x15')](_0x9b88('0x10'),_0x53956e,_0x5c4fc4['error'][_0x9b88('0x17')]);return _0x23b6f0(_0x5c4fc4['error'][_0x9b88('0x17')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x53956e,'request\x20sent');_0x23b6f0(_0x5c4fc4[_0x9b88('0x18')][_0x9b88('0x17')]);}})[_0x9b88('0x19')](function(_0x2d9556){logger[_0x9b88('0x15')](_0x9b88('0x10'),_0x53956e,_0x2d9556);_0x143302(_0x2d9556);});});}exports[_0x9b88('0x1a')]=function(_0x658142){var _0x18a90c=this;return new Promise(function(_0x207c4e,_0x58630c){return db[_0x9b88('0x1b')]['update'](_0x658142[_0x9b88('0x1c')],{'raw':_0x658142[_0x9b88('0x1d')]?_0x658142[_0x9b88('0x1d')][_0x9b88('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x658142[_0x9b88('0x1d')]?_0x658142[_0x9b88('0x1d')][_0x9b88('0x1f')]||null:null,'attributes':_0x658142[_0x9b88('0x1d')]?_0x658142[_0x9b88('0x1d')][_0x9b88('0x20')]||null:null,'limit':_0x658142['options']?_0x658142[_0x9b88('0x1d')][_0x9b88('0x21')]||null:null})[_0x9b88('0xe')](function(_0x235729){logger['info'](_0x9b88('0x1a'),_0x658142);logger[_0x9b88('0x12')](_0x9b88('0x1a'),_0x658142,JSON[_0x9b88('0x14')](_0x235729));_0x207c4e(_0x235729);})[_0x9b88('0x19')](function(_0x271d9c){logger[_0x9b88('0x15')](_0x9b88('0x1a'),_0x271d9c[_0x9b88('0x17')],_0x658142);_0x58630c(_0x18a90c['error'](0x1f4,_0x271d9c[_0x9b88('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 07fa011..d06fcae 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 _0xef0f=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0xef0f,0x168));var _0xfef0=function(_0x2cc3c5,_0x5afa5b){_0x2cc3c5=_0x2cc3c5-0x0;var _0x18b51a=_0xef0f[_0x2cc3c5];return _0x18b51a;};'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['post']('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xd')]);router[_0xfef0('0xe')](_0xfef0('0xb'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xf')]);router[_0xfef0('0x10')](_0xfef0('0xb'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x11')]);module[_0xfef0('0x12')]=router; \ No newline at end of file +var _0x3423=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','path','connect-timeout','express','Router'];(function(_0x20ef58,_0x3292cd){var _0x555fbc=function(_0x1c4b9b){while(--_0x1c4b9b){_0x20ef58['push'](_0x20ef58['shift']());}};_0x555fbc(++_0x3292cd);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0xe')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xf')]);router['put']('/:id',auth[_0x3342('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);module[_0x3342('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c68eb4d..9bce6f4 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 _0xe68f=['DATE','STRING','ENUM','out','sequelize'];(function(_0x3543b2,_0x2e55b0){var _0x249255=function(_0x19f269){while(--_0x19f269){_0x3543b2['push'](_0x3543b2['shift']());}};_0x249255(++_0x2e55b0);}(_0xe68f,0x158));var _0xfe68=function(_0xec6887,_0x2a2226){_0xec6887=_0xec6887-0x0;var _0x2f39a5=_0xe68f[_0xec6887];return _0x2f39a5;};'use strict';var Sequelize=require(_0xfe68('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfe68('0x1')]},'disposition':{'type':Sequelize[_0xfe68('0x2')]},'secondDisposition':{'type':Sequelize[_0xfe68('0x2')]},'thirdDisposition':{'type':Sequelize[_0xfe68('0x2')]},'note':{'type':Sequelize[_0xfe68('0x2')]},'read1stAt':{'type':Sequelize[_0xfe68('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xfe68('0x3')]('in',_0xfe68('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfe68('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xfe68('0x3')]('in',_0xfe68('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x946c=['DATE','ENUM','out','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x946c,0x19b));var _0xc946=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x946c[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0xc946('0x0'));module[_0xc946('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc946('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc946('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc946('0x3')]},'fax':{'type':Sequelize[_0xc946('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc946('0x4')]('in',_0xc946('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc946('0x4')]('in',_0xc946('0x5')),'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 f541689..78d53a7 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 _0xefde=['papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','end','error','name','Users','map','fullname','TagIds','forEach','push','catch','waiting','talking','answered','total','UserId','closed','unmanaged','index','FaxInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','field','color','from','select','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','split','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3d0016,_0x4a37e0){var _0x1dcb28=function(_0x57bef9){while(--_0x57bef9){_0x3d0016['push'](_0x3d0016['shift']());}};_0x1dcb28(++_0x4a37e0);}(_0xefde,0xbf));var _0xeefd=function(_0x419501,_0x3c9959){_0x419501=_0x419501-0x0;var _0x5f10bb=_0xefde[_0x419501];return _0x5f10bb;};'use strict';var emlformat=require(_0xeefd('0x0'));var rimraf=require(_0xeefd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeefd('0x2'));var rp=require(_0xeefd('0x3'));var moment=require(_0xeefd('0x4'));var BPromise=require(_0xeefd('0x5'));var Mustache=require('mustache');var util=require(_0xeefd('0x6'));var path=require('path');var sox=require(_0xeefd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeefd('0x8'));var _=require(_0xeefd('0x9'));var squel=require(_0xeefd('0xa'));var crypto=require(_0xeefd('0xb'));var jsforce=require(_0xeefd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeefd('0xd'));var Redis=require('ioredis');var authService=require(_0xeefd('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeefd('0xf'));var logger=require(_0xeefd('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xeefd('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xeefd('0x12')],{'host':_0xeefd('0x13'),'port':0x18eb});var socket=require(_0xeefd('0x14'))(new Redis(config[_0xeefd('0x12')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4cb3c6,_0x50425e){_0x50425e=_0x50425e||0xcc;return function(_0x5a2558){if(_0x5a2558){return _0x4cb3c6[_0xeefd('0x15')](_0x50425e);}return _0x4cb3c6['status'](_0x50425e)['end']();};}function respondWithResult(_0x4dc0cc,_0x56d887){_0x56d887=_0x56d887||0xc8;return function(_0x5b1ca5){if(_0x5b1ca5){return _0x4dc0cc[_0xeefd('0x16')](_0x56d887)[_0xeefd('0x17')](_0x5b1ca5);}};}function respondWithFilteredResult(_0x3ffcc7,_0x5722f2){return function(_0x4c83b9){if(_0x4c83b9){var _0x13080b=typeof _0x5722f2[_0xeefd('0x18')]===_0xeefd('0x19')&&typeof _0x5722f2[_0xeefd('0x1a')]===_0xeefd('0x19');var _0x506e54=_0x4c83b9[_0xeefd('0x1b')];var _0x2c155e=_0x13080b?0x0:_0x5722f2[_0xeefd('0x18')];var _0x1edaea=_0x13080b?_0x4c83b9[_0xeefd('0x1b')]:_0x5722f2['offset']+_0x5722f2[_0xeefd('0x1a')];var _0x5466eb;if(_0x1edaea>=_0x506e54){_0x1edaea=_0x506e54;_0x5466eb=0xc8;}else{_0x5466eb=0xce;}_0x3ffcc7[_0xeefd('0x16')](_0x5466eb);return _0x3ffcc7[_0xeefd('0x1c')]('Content-Range',_0x2c155e+'-'+_0x1edaea+'/'+_0x506e54)[_0xeefd('0x17')](_0x4c83b9);}return null;};}function patchUpdates(_0x289610){return function(_0x577c4a){try{jsonpatch[_0xeefd('0x1d')](_0x577c4a,_0x289610,!![]);}catch(_0x4905aa){return BPromise[_0xeefd('0x1e')](_0x4905aa);}return _0x577c4a['save']();};}function saveUpdates(_0x450bb9,_0x2e9a7b){return function(_0x5d8e1b){if(_0x5d8e1b){return _0x5d8e1b['update'](_0x450bb9)[_0xeefd('0x1f')](function(_0x4f97d4){return _0x4f97d4;});}return null;};}function removeEntity(_0x3dd899,_0x2e3ab5){return function(_0x54cd9b){if(_0x54cd9b){return _0x54cd9b[_0xeefd('0x20')]()['then'](function(){_0x3dd899['status'](0xcc)[_0xeefd('0x21')]();});}};}function handleEntityNotFound(_0x4df643,_0x2aacc1){return function(_0xf961b1){if(!_0xf961b1){_0x4df643[_0xeefd('0x15')](0x194);}return _0xf961b1;};}function handleError(_0x267f03,_0x41c32e){_0x41c32e=_0x41c32e||0x1f4;return function(_0x51a943){logger[_0xeefd('0x22')](_0x51a943['stack']);if(_0x51a943[_0xeefd('0x23')]){delete _0x51a943[_0xeefd('0x23')];}_0x267f03[_0xeefd('0x16')](_0x41c32e)['send'](_0x51a943);};}function getInteractionUsers(_0x4e6996,_0x37e952){return new BPromise(function(_0x251e23,_0x1bd39f){try{if(_0x37e952[_0x4e6996['id']]){_0x4e6996[_0xeefd('0x24')]=_[_0xeefd('0x25')](_0x37e952[_0x4e6996['id']],function(_0x482d39){return{'id':_0x482d39['id'],'fullname':_0x482d39[_0xeefd('0x26')]};});}}catch(_0x2cd2a8){_0x1bd39f(_0x2cd2a8);}_0x251e23(_0x4e6996);});}function getInteractionTags(_0x55c168,_0x389154){return new BPromise(function(_0x123fd9,_0x19ee8d){try{if(_0x55c168[_0xeefd('0x27')]){_0x55c168['Tags']=[];_0x55c168[_0xeefd('0x27')]['split'](',')[_0xeefd('0x28')](function(_0x474ac5){_0x55c168['Tags'][_0xeefd('0x29')](_0x389154[_0x474ac5]);});}delete _0x55c168[_0xeefd('0x27')];}catch(_0x422268){_0x19ee8d(_0x422268);}_0x123fd9(_0x55c168);});}function updateFaxInteraction(_0x3c13f8,_0x50fb45,_0x2009f2){return new BPromise(function(_0x956240,_0xc5670b){return getInteractionUsers(_0x3c13f8,_0x2009f2)[_0xeefd('0x1f')](function(_0x65e81e){return getInteractionTags(_0x65e81e,_0x50fb45);})['then'](function(_0xb9d613){return getStateInteraction(_0xb9d613);})[_0xeefd('0x1f')](function(_0x2099ff){_0x956240(_0x2099ff);})[_0xeefd('0x2a')](function(_0x46e5f6){_0xc5670b(_0x46e5f6);});});}function getStateInteraction(_0x1dce21){return new BPromise(function(_0x5d3c29){_0x1dce21[_0xeefd('0x2b')]=0x0;_0x1dce21[_0xeefd('0x2c')]=0x0;_0x1dce21[_0xeefd('0x2d')]=0x0;_0x1dce21['unmanaged']=0x0;_0x1dce21[_0xeefd('0x2e')]=0x0;if(!_0x1dce21['closed']&&!_0x1dce21[_0xeefd('0x2f')]){_0x1dce21[_0xeefd('0x2b')]+=0x1;}if(!_0x1dce21['closed']&&_0x1dce21['UserId']){_0x1dce21['talking']+=0x1;if(_0x1dce21['waiting']){_0x1dce21[_0xeefd('0x2b')]-=0x1;}}if(_0x1dce21[_0xeefd('0x30')]&&_0x1dce21[_0xeefd('0x2f')]){_0x1dce21[_0xeefd('0x2d')]+=0x1;if(_0x1dce21['talking']){_0x1dce21['talking']-=0x1;}}if(_0x1dce21['closed']&&!_0x1dce21[_0xeefd('0x2f')]){_0x1dce21[_0xeefd('0x31')]+=0x1;if(_0x1dce21[_0xeefd('0x2b')]){_0x1dce21['waiting']-=0x1;}}_0x1dce21['total']+=0x1;_0x5d3c29(_0x1dce21);});}exports[_0xeefd('0x32')]=function(_0x189074,_0x3e340c){var _0x555f73={},_0x1c0113={},_0x5e8de1={'count':0x0,'rows':[]};var _0x2f0fb8=_[_0xeefd('0x25')](db[_0xeefd('0x33')][_0xeefd('0x34')],function(_0xe51dee){return{'name':_0xe51dee[_0xeefd('0x35')],'type':_0xe51dee['type'][_0xeefd('0x36')]};});_0x1c0113[_0xeefd('0x37')]=_[_0xeefd('0x25')](_0x2f0fb8,'name');_0x1c0113['query']=_[_0xeefd('0x38')](_0x189074[_0xeefd('0x39')]);_0x1c0113[_0xeefd('0x3a')]=_[_0xeefd('0x3b')](_0x1c0113[_0xeefd('0x37')],_0x1c0113[_0xeefd('0x39')]);_0x555f73[_0xeefd('0x3c')]=_[_0xeefd('0x3b')](_0x1c0113[_0xeefd('0x37')],qs[_0xeefd('0x3d')](_0x189074[_0xeefd('0x39')][_0xeefd('0x3d')]));_0x555f73[_0xeefd('0x3c')]=_0x555f73[_0xeefd('0x3c')]['length']?_0x555f73[_0xeefd('0x3c')]:_0x1c0113[_0xeefd('0x37')];if(!_0x189074[_0xeefd('0x39')][_0xeefd('0x3e')](_0xeefd('0x3f'))){_0x555f73[_0xeefd('0x1a')]=qs[_0xeefd('0x1a')](_0x189074[_0xeefd('0x39')]['limit']);_0x555f73[_0xeefd('0x18')]=qs[_0xeefd('0x18')](_0x189074[_0xeefd('0x39')][_0xeefd('0x18')]);}_0x555f73['order']=qs['sort'](_0x189074[_0xeefd('0x39')][_0xeefd('0x40')]);_0x555f73['where']=qs[_0xeefd('0x3a')](_[_0xeefd('0x41')](_0x189074[_0xeefd('0x39')],_0x1c0113[_0xeefd('0x3a')]),_0x2f0fb8);var _0x337b22=[];var _0x29a65f=squel['select']()['field']('id')[_0xeefd('0x42')](_0xeefd('0x23'))[_0xeefd('0x42')](_0xeefd('0x43'))[_0xeefd('0x44')]('tools_tags');var _0x52a9c8=squel[_0xeefd('0x45')]()[_0xeefd('0x42')](_0xeefd('0x46'))[_0xeefd('0x42')]('u.fullname')[_0xeefd('0x42')](_0xeefd('0x47'))[_0xeefd('0x44')](_0xeefd('0x48'),'ui')[_0xeefd('0x49')](_0xeefd('0x4a'),'u',_0xeefd('0x4b'));var _0x15fb69=squel[_0xeefd('0x45')]()[_0xeefd('0x44')](_0xeefd('0x4c'),'i')[_0xeefd('0x49')](_0xeefd('0x4d'),'c',_0xeefd('0x4e'))['left_join'](_0xeefd('0x4a'),'o',_0xeefd('0x4f'))[_0xeefd('0x49')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')[_0xeefd('0x49')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0xeefd('0x49')](_0xeefd('0x50'),'it',_0xeefd('0x51'))[_0xeefd('0x49')](_0xeefd('0x52'),'t','t.id\x20=\x20it.TagId');var _0x40c56d=squel['expr']();var _0x40a885=[];var _0x2f660d=squel['expr']();var _0x1b28f0;if(_0x189074[_0xeefd('0x39')]['search']){_0x1b28f0=as['parseSearch'](_0x189074[_0xeefd('0x39')]['search']);var _0x23c8e6=_0x1b28f0[_0xeefd('0x53')];for(var _0x494067=0x0;_0x494067<_0x1b28f0[_0xeefd('0x54')]['length'];_0x494067++){var _0x5c51ec=_0x1b28f0[_0xeefd('0x54')][_0x494067];var _0x32e2a4='i';var _0x2d2f24=_[_0xeefd('0x55')](_0x2f0fb8,[_0xeefd('0x23'),_0x5c51ec['field']]);if(!_0x2d2f24){switch(_0x5c51ec[_0xeefd('0x42')]){case _0xeefd('0x56'):if(_0x5c51ec[_0xeefd('0x57')]==0x1){_0x15fb69[_0xeefd('0x58')]('`'+_0x5c51ec[_0xeefd('0x42')]+_0xeefd('0x59'));}else{_0x15fb69['having']('`'+_0x5c51ec[_0xeefd('0x42')]+_0xeefd('0x5a'));}break;case _0xeefd('0x5b'):if(_0x5c51ec[_0xeefd('0x5c')]==='$substring'){if(_0x5c51ec[_0xeefd('0x57')]['split']('\x20')[_0xeefd('0x5d')]>0x1){_0x40c56d[_0x23c8e6](_0xeefd('0x5e'),qs['getFullTextValue'](_0x5c51ec[_0xeefd('0x57')]),null);}else{var _0x476e3b='%'+_0x5c51ec[_0xeefd('0x57')]+'%';_0x40c56d[_0x23c8e6](_0xeefd('0x5f'),_0x476e3b,_0x476e3b,_0x476e3b);}}else{_0x2d2f24=_[_0xeefd('0x55')](_0x2f0fb8,[_0xeefd('0x23'),'ContactId']);_0x5c51ec[_0xeefd('0x42')]=_0xeefd('0x60');_0x54eb64=as[_0xeefd('0x61')](_0x32e2a4,_0x2d2f24[_0xeefd('0x62')],_0x5c51ec);_0x40c56d[_0x23c8e6](_0x54eb64[_0xeefd('0x63')],_0x54eb64[_0xeefd('0x57')]['start'],_0x54eb64[_0xeefd('0x57')][_0xeefd('0x21')]);}break;case _0xeefd('0x64'):var _0x335237=_0x5c51ec[_0xeefd('0x57')][_0xeefd('0x65')](',')[_0xeefd('0x25')](function(_0x2b211e){return Number(_0x2b211e);});_0x335237[_0xeefd('0x28')](function(_0x5bbd79){_0x2f660d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5bbd79+',%');});_0x40a885=_['union'](_0x40a885,_0x335237);break;case'User':if(_0x5c51ec['operator']===_0xeefd('0x66')){_0x40c56d[_0x23c8e6](_0xeefd('0x67'),'%'+_0x5c51ec[_0xeefd('0x57')]+'%',null);}else{_0x2d2f24=_[_0xeefd('0x55')](_0x2f0fb8,[_0xeefd('0x23'),'UserId']);_0x5c51ec[_0xeefd('0x42')]=_0xeefd('0x2f');_0x54eb64=as['buildExpression'](_0x32e2a4,_0x2d2f24[_0xeefd('0x62')],_0x5c51ec);_0x40c56d[_0x23c8e6](_0x54eb64[_0xeefd('0x63')],_0x54eb64[_0xeefd('0x57')][_0xeefd('0x68')],_0x54eb64['value'][_0xeefd('0x21')]);}break;case _0xeefd('0x69'):_0x54eb64=as['buildExpression']('me',null,_0x5c51ec);_0x40c56d[_0x23c8e6](_0x54eb64[_0xeefd('0x63')],_0x54eb64[_0xeefd('0x57')][_0xeefd('0x68')],_0x54eb64['value'][_0xeefd('0x21')]);break;}}else{var _0x54eb64=as[_0xeefd('0x61')](_0x32e2a4,_0x2d2f24[_0xeefd('0x62')],_0x5c51ec);_0x40c56d[_0x23c8e6](_0x54eb64['text'],_0x54eb64['value'][_0xeefd('0x68')],_0x54eb64[_0xeefd('0x57')][_0xeefd('0x21')]);}}}else{var _0x2ba966=_(_0x189074[_0xeefd('0x39')])[_0xeefd('0x38')]()[_0xeefd('0x25')](function(_0x56ba6a){return _[_0xeefd('0x6a')](_0x2f0fb8,[_0xeefd('0x23'),_0x56ba6a])?_0x56ba6a:undefined;})['compact']()[_0xeefd('0x57')]();if(!_[_0xeefd('0x6b')](_0x2ba966)){_0x2ba966[_0xeefd('0x28')](function(_0x39a77d){if(_0x39a77d===_0xeefd('0x6c')){_0x15fb69['where'](_0xeefd('0x6d'),[]['concat'](_0x189074[_0xeefd('0x39')][_0x39a77d]));}else if(_0x39a77d===_0xeefd('0x6e')){var _0x30a8f9=JSON[_0xeefd('0x6f')](_0x189074['query'][_0x39a77d])[_0xeefd('0x70')];var _0x4cdd74=JSON[_0xeefd('0x6f')](_0x189074[_0xeefd('0x39')][_0x39a77d])[_0xeefd('0x71')];_0x15fb69[_0xeefd('0x72')](_0xeefd('0x73'),_0x30a8f9,_0x4cdd74);}else{if(_0x189074[_0xeefd('0x39')][_0x39a77d]===_0xeefd('0x74')){_0x15fb69[_0xeefd('0x72')]('i.'+_0x39a77d+_0xeefd('0x75'));}else{_0x15fb69['where']('i.'+_0x39a77d+_0xeefd('0x76'),_0x189074[_0xeefd('0x39')][_0x39a77d]);}}});}if(_0x189074[_0xeefd('0x39')][_0xeefd('0x77')]){if(_0x189074[_0xeefd('0x39')][_0xeefd('0x77')]==0x1){_0x15fb69[_0xeefd('0x58')]('`unreadMessages`\x20=\x200');}else{_0x15fb69[_0xeefd('0x58')](_0xeefd('0x78'));}}if(_0x189074[_0xeefd('0x39')][_0xeefd('0x79')]){_0x40a885=_[_0xeefd('0x7a')](_0x189074[_0xeefd('0x39')][_0xeefd('0x79')])?_0x189074[_0xeefd('0x39')][_0xeefd('0x79')]:new Array(_0x189074[_0xeefd('0x39')][_0xeefd('0x79')]);_0x40a885[_0xeefd('0x28')](function(_0x2dcc49){_0x2f660d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2dcc49+',%');});}if(_0x189074[_0xeefd('0x39')][_0xeefd('0x7b')]){var _0x418f0a=_0x189074[_0xeefd('0x39')]['filter']['replace']('\x5c','\x5c\x5c')[_0xeefd('0x7c')](/'/g,'\x27\x27');if(qs[_0xeefd('0x7d')](_0x418f0a)){_0x40c56d['or']('i.id\x20LIKE\x20?',_0x418f0a+'%')['or']('i.fax\x20LIKE\x20?',_0x418f0a+'%');}_0x40c56d['or'](_0xeefd('0x7e'),_0x418f0a+'%');}}_0x15fb69[_0xeefd('0x72')](_0x40c56d);_0x15fb69[_0xeefd('0x7f')](_0xeefd('0x80'));var _0x1b7b26={'type':db[_0xeefd('0x81')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4e76d3=_0x15fb69[_0xeefd('0x82')]();_0x4e76d3[_0xeefd('0x42')](_0xeefd('0x80'));_0x4e76d3[_0xeefd('0x42')](_0xeefd('0x83'),'unreadMessages');if(_0x555f73[_0xeefd('0x84')]){_0x555f73[_0xeefd('0x84')][_0xeefd('0x28')](function(_0x4ff3de){var _0x3db5e0=_0x4ff3de[0x0]==='contactName'?_0x4ff3de[0x0]:'i.'+_0x4ff3de[0x0];_0x15fb69[_0xeefd('0x84')](_0x3db5e0,_0x4ff3de[0x1]===_0xeefd('0x85')?![]:!![]);});}if(!_[_0xeefd('0x6b')](_0x40a885)){_0x15fb69[_0xeefd('0x58')](_0x2f660d);_0x4e76d3[_0xeefd('0x72')]('t.id\x20IN\x20?',_0x40a885);}BPromise[_0xeefd('0x86')]()[_0xeefd('0x1f')](function(){if(!_0x1b28f0){if(_0x189074[_0xeefd('0x39')][_0xeefd('0x6c')])return;_0x4e76d3[_0xeefd('0x72')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x15fb69[_0xeefd('0x72')](_0xeefd('0x87'));return;}if(_0x189074[_0xeefd('0x88')][_0xeefd('0x89')]!=='agent')return;return _0x189074[_0xeefd('0x88')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xeefd('0x1f')](function(_0xf8063f){if(_['isEmpty'](_0xf8063f)){_0x4e76d3[_0xeefd('0x72')](_0xeefd('0x8a'));_0x15fb69[_0xeefd('0x72')](_0xeefd('0x8a'));}else{_0x4e76d3[_0xeefd('0x72')](_0xeefd('0x6d'),_[_0xeefd('0x25')](_0xf8063f,'id'));_0x15fb69[_0xeefd('0x72')](_0xeefd('0x6d'),_[_0xeefd('0x25')](_0xf8063f,'id'));}});})[_0xeefd('0x1f')](function(){if(_0x189074['user'][_0xeefd('0x89')]===_0xeefd('0x8b')&&!_0x1b28f0&&!_0x189074[_0xeefd('0x39')][_0xeefd('0x6c')])return[];return db['sequelize']['query'](_0x4e76d3['toString'](),_0x1b7b26);})[_0xeefd('0x1f')](function(_0x378dc4){_0x5e8de1[_0xeefd('0x1b')]=_0x378dc4[_0xeefd('0x5d')];if(_0x5e8de1[_0xeefd('0x1b')]===0x0)return[];return db[_0xeefd('0x8c')][_0xeefd('0x39')](_0x29a65f[_0xeefd('0x8d')](),_0x1b7b26)[_0xeefd('0x1f')](function(_0x1bae81){_0x337b22=_['keyBy'](_0x1bae81,'id');_0x1b7b26=_[_0xeefd('0x8e')](_0x1b7b26,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x189074['query'][_0xeefd('0x3d')]){_0x555f73['attributes']['forEach'](function(_0x4e732e){_0x15fb69[_0xeefd('0x42')]('i.'+_0x4e732e);});}else{_0x15fb69['field'](_0xeefd('0x83'),_0xeefd('0x56'));_0x15fb69[_0xeefd('0x42')]('a.key','Account.key');_0x15fb69[_0xeefd('0x42')](_0xeefd('0x8f'),_0xeefd('0x90'));_0x15fb69['field'](_0xeefd('0x91'),_0xeefd('0x92'));_0x15fb69[_0xeefd('0x42')](_0xeefd('0x93'));_0x15fb69[_0xeefd('0x42')](_0xeefd('0x94'),'Contact.firstName');_0x15fb69[_0xeefd('0x42')](_0xeefd('0x95'),_0xeefd('0x96'));_0x15fb69[_0xeefd('0x42')](_0xeefd('0x97'),_0xeefd('0x98'));_0x15fb69['field'](_0xeefd('0x99'),_0xeefd('0x9a'));_0x15fb69['field']('c.mobile',_0xeefd('0x9b'));_0x15fb69[_0xeefd('0x42')](_0xeefd('0x9c'),_0xeefd('0x9d'));_0x15fb69[_0xeefd('0x42')](_0xeefd('0x9e'),'Owner.fullname');_0x15fb69[_0xeefd('0x42')]('o.internal','Owner.internal');_0x15fb69[_0xeefd('0x42')](_0xeefd('0x9f'),_0xeefd('0x27'));}if(_0x555f73[_0xeefd('0x1a')])_0x15fb69[_0xeefd('0x1a')](_0x555f73['limit']);if(_0x555f73[_0xeefd('0x18')])_0x15fb69['offset'](_0x555f73[_0xeefd('0x18')]);return db[_0xeefd('0x8c')][_0xeefd('0x39')](_0x15fb69[_0xeefd('0x8d')](),_0x1b7b26);})['then'](function(_0x20ac40){if(_0x20ac40['length']>0x0)_0x52a9c8[_0xeefd('0x72')](_0xeefd('0xa0'),_[_0xeefd('0x25')](_0x20ac40,'id'));return db['sequelize'][_0xeefd('0x39')](_0x52a9c8[_0xeefd('0x8d')](),_0x1b7b26)[_0xeefd('0x1f')](function(_0xbb714b){var _0x3e4c1f=_[_0xeefd('0xa1')](_0xbb714b,_0xeefd('0xa2'));var _0x5b08a3=[];_0x20ac40[_0xeefd('0x28')](function(_0xd796e5){_0x5b08a3[_0xeefd('0x29')](updateFaxInteraction(_0xd796e5,_0x337b22,_0x3e4c1f));});return BPromise[_0xeefd('0xa3')](_0x5b08a3);});});})['then'](function(_0x15e9f1){_0x5e8de1[_0xeefd('0xa4')]=_0x15e9f1;return _0x5e8de1;})[_0xeefd('0x1f')](respondWithFilteredResult(_0x3e340c,_0x555f73))[_0xeefd('0x2a')](handleError(_0x3e340c,null));};exports[_0xeefd('0xa5')]=function(_0x7223eb,_0x41f50e){var _0x199296={'raw':![],'where':{'id':_0x7223eb[_0xeefd('0xa6')]['id']}},_0x1e2f5c={};_0x1e2f5c[_0xeefd('0x37')]=_[_0xeefd('0x38')](db['FaxInteraction']['rawAttributes']);_0x1e2f5c['query']=_[_0xeefd('0x38')](_0x7223eb[_0xeefd('0x39')]);_0x1e2f5c[_0xeefd('0x3a')]=_[_0xeefd('0x3b')](_0x1e2f5c[_0xeefd('0x37')],_0x1e2f5c[_0xeefd('0x39')]);_0x199296[_0xeefd('0x3c')]=_[_0xeefd('0x3b')](_0x1e2f5c[_0xeefd('0x37')],qs['fields'](_0x7223eb[_0xeefd('0x39')]['fields']));_0x199296['attributes']=_0x199296[_0xeefd('0x3c')][_0xeefd('0x5d')]?_0x199296[_0xeefd('0x3c')]:_0x1e2f5c[_0xeefd('0x37')];if(_0x7223eb[_0xeefd('0x39')][_0xeefd('0xa7')]){_0x199296[_0xeefd('0xa8')]=[{'all':!![]}];}_0x199296=_[_0xeefd('0x8e')]({},_0x199296,_0x7223eb[_0xeefd('0xa9')]);return db['FaxInteraction'][_0xeefd('0x55')](_0x199296)['then'](handleEntityNotFound(_0x41f50e,null))[_0xeefd('0x1f')](respondWithResult(_0x41f50e,null))[_0xeefd('0x2a')](handleError(_0x41f50e,null));};exports[_0xeefd('0xaa')]=function(_0x55cd37,_0x259fe1){return db[_0xeefd('0x33')][_0xeefd('0xaa')](_0x55cd37[_0xeefd('0x69')],{})[_0xeefd('0x1f')](respondWithResult(_0x259fe1,0xc9))[_0xeefd('0x2a')](handleError(_0x259fe1,null));};exports['update']=function(_0x386f7f,_0x19782f){if(_0x386f7f[_0xeefd('0x69')]['id']){delete _0x386f7f[_0xeefd('0x69')]['id'];}return db[_0xeefd('0x33')][_0xeefd('0x55')]({'where':{'id':_0x386f7f[_0xeefd('0xa6')]['id']}})[_0xeefd('0x1f')](handleEntityNotFound(_0x19782f,null))[_0xeefd('0x1f')](saveUpdates(_0x386f7f[_0xeefd('0x69')],null))[_0xeefd('0x1f')](respondWithResult(_0x19782f,null))['catch'](handleError(_0x19782f,null));};exports[_0xeefd('0x20')]=function(_0x4b73a9,_0x1d5726){return db['FaxInteraction'][_0xeefd('0x55')]({'where':{'id':_0x4b73a9['params']['id']}})[_0xeefd('0x1f')](handleEntityNotFound(_0x1d5726,null))[_0xeefd('0x1f')](removeEntity(_0x1d5726,null))[_0xeefd('0x2a')](handleError(_0x1d5726,null));};exports[_0xeefd('0xab')]=function(_0x4cff27,_0x47f3f9){return db[_0xeefd('0x33')][_0xeefd('0xab')]()[_0xeefd('0x1f')](respondWithResult(_0x47f3f9,null))['catch'](handleError(_0x47f3f9,null));};exports[_0xeefd('0xac')]=function(_0x279edf,_0x2d5a5f,_0x53851b){return db[_0xeefd('0xad')][_0xeefd('0x55')]({'where':{'id':_0x279edf[_0xeefd('0xa6')]['id']}})[_0xeefd('0x1f')](handleEntityNotFound(_0x2d5a5f,null))[_0xeefd('0x1f')](function(_0x5c30ce){if(_0x5c30ce){return _0x5c30ce[_0xeefd('0xac')](_0x279edf[_0xeefd('0x69')][_0xeefd('0xae')],_[_0xeefd('0xaf')](_0x279edf[_0xeefd('0x69')],[_0xeefd('0xae'),'id'])||{});}})['then'](respondWithResult(_0x2d5a5f,null))[_0xeefd('0x2a')](handleError(_0x2d5a5f,null));};exports[_0xeefd('0xb0')]=function(_0x195f1a,_0x21fd99,_0x23c14c){var _0x2ebfe7={'raw':![],'where':{}};var _0x360d74={};var _0x176468={'count':0x0,'rows':[]};return db[_0xeefd('0x33')][_0xeefd('0xb1')]({'where':{'id':_0x195f1a[_0xeefd('0xa6')]['id']}})['then'](handleEntityNotFound(_0x21fd99,null))[_0xeefd('0x1f')](function(_0x2447ae){if(_0x2447ae){_0x360d74['model']=_[_0xeefd('0x38')](db['FaxMessage']['rawAttributes']);_0x360d74[_0xeefd('0x39')]=_[_0xeefd('0x38')](_0x195f1a[_0xeefd('0x39')]);_0x360d74[_0xeefd('0x3a')]=_['intersection'](_0x360d74[_0xeefd('0x37')],_0x360d74[_0xeefd('0x39')]);_0x2ebfe7['attributes']=_[_0xeefd('0x3b')](_0x360d74['model'],qs[_0xeefd('0x3d')](_0x195f1a['query'][_0xeefd('0x3d')]));_0x2ebfe7[_0xeefd('0x3c')]=_0x2ebfe7[_0xeefd('0x3c')][_0xeefd('0x5d')]?_0x2ebfe7[_0xeefd('0x3c')]:_0x360d74['model'];if(!_0x195f1a[_0xeefd('0x39')][_0xeefd('0x3e')](_0xeefd('0x3f'))){_0x2ebfe7['limit']=qs[_0xeefd('0x1a')](_0x195f1a['query'][_0xeefd('0x1a')]);_0x2ebfe7[_0xeefd('0x18')]=qs['offset'](_0x195f1a[_0xeefd('0x39')][_0xeefd('0x18')]);}_0x2ebfe7[_0xeefd('0x84')]=qs[_0xeefd('0x40')](_0x195f1a['query']['sort']);_0x2ebfe7[_0xeefd('0x72')]=qs['filters'](_[_0xeefd('0x41')](_0x195f1a[_0xeefd('0x39')],_0x360d74['filters']));_0x2ebfe7['where']['FaxInteractionId']=_0x2447ae['id'];if(_0x195f1a[_0xeefd('0x39')][_0xeefd('0x7b')]){_0x2ebfe7['where']=_[_0xeefd('0x8e')](_0x2ebfe7['where'],{'$or':_[_0xeefd('0x25')](_0x2ebfe7[_0xeefd('0x3c')],function(_0x27045d){var _0x382d1b={};_0x382d1b[_0x27045d]={'$like':'%'+_0x195f1a['query'][_0xeefd('0x7b')]+'%'};return _0x382d1b;})});}if(_0x195f1a[_0xeefd('0x39')][_0xeefd('0x70')]){var _0x18646c=_0x195f1a[_0xeefd('0x39')][_0xeefd('0x70')][_0xeefd('0x65')](',');var _0x4a1847={};_0x4a1847[_0x18646c[0x0]]={'$gte':moment(_0x18646c[0x1])[_0xeefd('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2ebfe7[_0xeefd('0x72')]=_[_0xeefd('0x8e')](_0x2ebfe7[_0xeefd('0x72')],_0x4a1847);}_0x2ebfe7=_[_0xeefd('0x8e')]({},_0x2ebfe7,_0x195f1a[_0xeefd('0xa9')]);return db['FaxMessage'][_0xeefd('0x1b')]({'where':_0x2ebfe7[_0xeefd('0x72')]})[_0xeefd('0x1f')](function(_0x2ad161){_0x176468[_0xeefd('0x1b')]=_0x2ad161;if(_0x195f1a[_0xeefd('0x39')][_0xeefd('0xa7')]){_0x2ebfe7[_0xeefd('0xa8')]=[{'all':!![]}];}return db[_0xeefd('0xad')][_0xeefd('0xb3')](_0x2ebfe7);})['then'](function(_0x2ec5dd){_0x176468[_0xeefd('0xa4')]=_0x2ec5dd;return _0x176468;});}})[_0xeefd('0x1f')](respondWithFilteredResult(_0x21fd99,_0x2ebfe7))[_0xeefd('0x2a')](handleError(_0x21fd99,null));};exports['addTags']=function(_0x21b35e,_0x534dce,_0x267636){return db[_0xeefd('0x33')][_0xeefd('0x55')]({'where':{'id':_0x21b35e[_0xeefd('0xa6')]['id']}})[_0xeefd('0x1f')](handleEntityNotFound(_0x534dce,null))[_0xeefd('0x1f')](function(_0x4fba44){if(_0x4fba44){return _0x4fba44[_0xeefd('0xb4')](_0x21b35e[_0xeefd('0x69')]['ids'],_[_0xeefd('0xaf')](_0x21b35e[_0xeefd('0x69')],['ids','id'])||{})[_0xeefd('0xb5')](function(){return db[_0xeefd('0x64')][_0xeefd('0xb3')]({'attributes':['id',_0xeefd('0x23'),_0xeefd('0x43')],'where':{'id':_0x21b35e[_0xeefd('0x69')]['ids']}});})[_0xeefd('0x1f')](function(_0x1f7b5b){socket[_0xeefd('0xb6')](_0xeefd('0xb7'),{'id':Number(_0x21b35e[_0xeefd('0xa6')]['id']),'tags':_0x1f7b5b||[]});return{'id':Number(_0x21b35e[_0xeefd('0xa6')]['id']),'tags':_0x1f7b5b||[]};});}})[_0xeefd('0x1f')](respondWithResult(_0x534dce,null))[_0xeefd('0x2a')](handleError(_0x534dce,null));};exports['removeTags']=function(_0x2491c9,_0x187222,_0x1d0b4a){return db[_0xeefd('0x33')][_0xeefd('0x55')]({'where':{'id':_0x2491c9[_0xeefd('0xa6')]['id']}})[_0xeefd('0x1f')](handleEntityNotFound(_0x187222,null))['then'](function(_0x3030f3){if(_0x3030f3){return _0x3030f3[_0xeefd('0xb8')](_0x2491c9[_0xeefd('0x39')]['ids']);}})[_0xeefd('0x1f')](respondWithStatusCode(_0x187222,null))[_0xeefd('0x2a')](handleError(_0x187222,null));};exports[_0xeefd('0xb9')]=function(_0x24ba56,_0x54821c){var _0x480f2c=moment()[_0xeefd('0xba')]()[_0xeefd('0x8d')]();var _0x37d871=path[_0xeefd('0xbb')](config['root'],_0xeefd('0xbc'),'files',_0xeefd('0xbd'));var _0x59c2d2=path['join'](config[_0xeefd('0xbe')],_0xeefd('0xbc'),_0xeefd('0xbf'),_0xeefd('0xc0'));var _0x1ab740=path[_0xeefd('0xbb')](_0x37d871,_0x480f2c);var _0x1ecded=util['format'](_0xeefd('0xc1'),_0x24ba56[_0xeefd('0xa6')]['id'],_0x480f2c);var _0x514c07=path[_0xeefd('0xbb')](_0x37d871,_0x1ecded);var _0x15b7ee=[];_0x15b7ee['push']({'model':db[_0xeefd('0xc2')],'as':_0xeefd('0xc2'),'raw':!![]});var _0x3c8d5a=[{'model':db['FaxMessage'],'as':_0xeefd('0xc3'),'attributes':['id',_0xeefd('0x69'),_0xeefd('0x6e')],'include':_0x15b7ee}];return db['FaxInteraction'][_0xeefd('0x55')]({'where':{'id':_0x24ba56[_0xeefd('0xa6')]['id']},'include':_0x3c8d5a})[_0xeefd('0x1f')](handleEntityNotFound(_0x54821c,null))[_0xeefd('0x1f')](function(_0x199a47){if(_0x199a47&&_0x199a47[_0xeefd('0xc3')]){var _0xd8bd0=_0x199a47['get']({'plain':!![]});fs['mkdirSync'](_0x1ab740);for(var _0x48d47f=0x0;_0x48d47f<_0xd8bd0[_0xeefd('0xc3')][_0xeefd('0x5d')];_0x48d47f++){var _0x452f88=_0xd8bd0[_0xeefd('0xc3')][_0x48d47f][_0xeefd('0xc2')];if(_0x452f88){var _0x5d2353=path[_0xeefd('0xbb')](_0x59c2d2,_0x452f88[_0xeefd('0xc4')]);if(fs[_0xeefd('0xc5')](_0x5d2353)){fs[_0xeefd('0xc6')](_0x5d2353)[_0xeefd('0xc7')](fs[_0xeefd('0xc8')](path[_0xeefd('0xbb')](_0x1ab740,_0x452f88['basename'])));}}}return BPromise[_0xeefd('0x86')]()[_0xeefd('0x1f')](function(){return new BPromise(function(_0x1feec7,_0x48f87e){zipdir(_0x1ab740,{'saveTo':_0x514c07},function(_0x346a8c,_0x2d4ef5){if(_0x346a8c)return _0x48f87e(_0x346a8c);return _0x1feec7(_0x2d4ef5);});})[_0xeefd('0x1f')](function(){return new BPromise(function(_0x11a5d3,_0x1bae9c){rimraf(_0x1ab740,function(_0x4f74bd){if(_0x4f74bd)_0x1bae9c(_0x4f74bd);return _0x11a5d3();});});})[_0xeefd('0x1f')](function(){return _0x54821c['download'](_0x514c07,_0x1ecded,function(_0x381452){if(_0x381452){console[_0xeefd('0xc9')](_0xeefd('0xca'),_0x381452);}else{fs[_0xeefd('0xcb')](_0x514c07);}});});});}else{return _0x54821c[_0xeefd('0x15')](0xc8);}})[_0xeefd('0x2a')](handleError(_0x54821c,null));}; \ No newline at end of file +var _0x589d=['limit','count','Content-Range','apply','reject','save','update','then','error','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','talking','total','closed','UserId','waiting','answered','unmanaged','index','FaxInteraction','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','tools_tags','select','u.id','u.fullname','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','text','some','isEmpty','FaxAccountId','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','rows','show','params','rawAttributes','includeAll','options','create','destroy','describe','addMessage','ids','omit','FaxMessage','nolimit','FaxInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','removeTags','download','unix','root','files','tmp','join','server','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','pipe','createWriteStream','basename','unlinkSync','sendStatus','eml-format','rimraf','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x589d,0x19c));var _0xd589=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x589d[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xd589('0x0'));var rimraf=require(_0xd589('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd589('0x2'));var moment=require('moment');var BPromise=require(_0xd589('0x3'));var Mustache=require(_0xd589('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd589('0x5'));var ejs=require(_0xd589('0x6'));var fs=require('fs');var fs_extra=require(_0xd589('0x7'));var _=require(_0xd589('0x8'));var squel=require(_0xd589('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd589('0xa'));var toCsv=require(_0xd589('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd589('0xb'));var authService=require(_0xd589('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xd589('0xd'));var hardwareService=require(_0xd589('0xe'));var logger=require(_0xd589('0xf'))(_0xd589('0x10'));var utils=require(_0xd589('0x11'));var config=require(_0xd589('0x12'));var licenseUtil=require(_0xd589('0x13'));var db=require(_0xd589('0x14'))['db'];config[_0xd589('0x15')]=_[_0xd589('0x16')](config['redis'],{'host':_0xd589('0x17'),'port':0x18eb});var socket=require(_0xd589('0x18'))(new Redis(config[_0xd589('0x15')]));require(_0xd589('0x19'))[_0xd589('0x1a')](socket);function respondWithStatusCode(_0x3c3c9a,_0x1eeca4){_0x1eeca4=_0x1eeca4||0xcc;return function(_0x165970){if(_0x165970){return _0x3c3c9a['sendStatus'](_0x1eeca4);}return _0x3c3c9a[_0xd589('0x1b')](_0x1eeca4)[_0xd589('0x1c')]();};}function respondWithResult(_0x28af3e,_0x2e8bcc){_0x2e8bcc=_0x2e8bcc||0xc8;return function(_0x3ef98b){if(_0x3ef98b){return _0x28af3e[_0xd589('0x1b')](_0x2e8bcc)[_0xd589('0x1d')](_0x3ef98b);}};}function respondWithFilteredResult(_0x3e2d51,_0x261a31){return function(_0x3bc9fb){if(_0x3bc9fb){var _0x20004b=typeof _0x261a31[_0xd589('0x1e')]===_0xd589('0x1f')&&typeof _0x261a31[_0xd589('0x20')]==='undefined';var _0xb0e965=_0x3bc9fb[_0xd589('0x21')];var _0x14a9d3=_0x20004b?0x0:_0x261a31[_0xd589('0x1e')];var _0x2111ef=_0x20004b?_0x3bc9fb[_0xd589('0x21')]:_0x261a31[_0xd589('0x1e')]+_0x261a31[_0xd589('0x20')];var _0x32591b;if(_0x2111ef>=_0xb0e965){_0x2111ef=_0xb0e965;_0x32591b=0xc8;}else{_0x32591b=0xce;}_0x3e2d51[_0xd589('0x1b')](_0x32591b);return _0x3e2d51['set'](_0xd589('0x22'),_0x14a9d3+'-'+_0x2111ef+'/'+_0xb0e965)[_0xd589('0x1d')](_0x3bc9fb);}return null;};}function patchUpdates(_0x31f110){return function(_0x57e759){try{jsonpatch[_0xd589('0x23')](_0x57e759,_0x31f110,!![]);}catch(_0x3bd9e1){return BPromise[_0xd589('0x24')](_0x3bd9e1);}return _0x57e759[_0xd589('0x25')]();};}function saveUpdates(_0x5209f4,_0x4aa320){return function(_0x180be3){if(_0x180be3){return _0x180be3[_0xd589('0x26')](_0x5209f4)[_0xd589('0x27')](function(_0x310922){return _0x310922;});}return null;};}function removeEntity(_0x1075a4,_0x38fe6d){return function(_0x21feaf){if(_0x21feaf){return _0x21feaf['destroy']()[_0xd589('0x27')](function(){_0x1075a4[_0xd589('0x1b')](0xcc)[_0xd589('0x1c')]();});}};}function handleEntityNotFound(_0x5e0001,_0x3dbac2){return function(_0x29ab10){if(!_0x29ab10){_0x5e0001['sendStatus'](0x194);}return _0x29ab10;};}function handleError(_0x5573dc,_0x4b1a72){_0x4b1a72=_0x4b1a72||0x1f4;return function(_0x1128ee){logger[_0xd589('0x28')](_0x1128ee['stack']);if(_0x1128ee[_0xd589('0x29')]){delete _0x1128ee['name'];}_0x5573dc[_0xd589('0x1b')](_0x4b1a72)[_0xd589('0x2a')](_0x1128ee);};}function getInteractionUsers(_0x5dc1ad,_0x2f4f1c){return new BPromise(function(_0xec1cbb,_0x3236e6){try{if(_0x2f4f1c[_0x5dc1ad['id']]){_0x5dc1ad[_0xd589('0x2b')]=_[_0xd589('0x2c')](_0x2f4f1c[_0x5dc1ad['id']],function(_0x49bfa4){return{'id':_0x49bfa4['id'],'fullname':_0x49bfa4[_0xd589('0x2d')]};});}}catch(_0x1aeb69){_0x3236e6(_0x1aeb69);}_0xec1cbb(_0x5dc1ad);});}function getInteractionTags(_0x590900,_0xf83a04){return new BPromise(function(_0xc24d1,_0x136d08){try{if(_0x590900[_0xd589('0x2e')]){_0x590900[_0xd589('0x2f')]=[];_0x590900['TagIds']['split'](',')[_0xd589('0x30')](function(_0x5449d9){_0x590900[_0xd589('0x2f')][_0xd589('0x31')](_0xf83a04[_0x5449d9]);});}delete _0x590900['TagIds'];}catch(_0x2459d0){_0x136d08(_0x2459d0);}_0xc24d1(_0x590900);});}function updateFaxInteraction(_0x2af67a,_0x40e6ae,_0x509c75){return new BPromise(function(_0x512109,_0x1e3e2c){return getInteractionUsers(_0x2af67a,_0x509c75)['then'](function(_0x187e3f){return getInteractionTags(_0x187e3f,_0x40e6ae);})['then'](function(_0x134171){return getStateInteraction(_0x134171);})[_0xd589('0x27')](function(_0x14a88f){_0x512109(_0x14a88f);})[_0xd589('0x32')](function(_0x153d48){_0x1e3e2c(_0x153d48);});});}function getStateInteraction(_0x1a0067){return new BPromise(function(_0x149b00){_0x1a0067['waiting']=0x0;_0x1a0067[_0xd589('0x33')]=0x0;_0x1a0067['answered']=0x0;_0x1a0067['unmanaged']=0x0;_0x1a0067[_0xd589('0x34')]=0x0;if(!_0x1a0067[_0xd589('0x35')]&&!_0x1a0067['UserId']){_0x1a0067['waiting']+=0x1;}if(!_0x1a0067[_0xd589('0x35')]&&_0x1a0067[_0xd589('0x36')]){_0x1a0067[_0xd589('0x33')]+=0x1;if(_0x1a0067[_0xd589('0x37')]){_0x1a0067[_0xd589('0x37')]-=0x1;}}if(_0x1a0067[_0xd589('0x35')]&&_0x1a0067['UserId']){_0x1a0067[_0xd589('0x38')]+=0x1;if(_0x1a0067[_0xd589('0x33')]){_0x1a0067[_0xd589('0x33')]-=0x1;}}if(_0x1a0067['closed']&&!_0x1a0067['UserId']){_0x1a0067[_0xd589('0x39')]+=0x1;if(_0x1a0067[_0xd589('0x37')]){_0x1a0067[_0xd589('0x37')]-=0x1;}}_0x1a0067[_0xd589('0x34')]+=0x1;_0x149b00(_0x1a0067);});}exports[_0xd589('0x3a')]=function(_0x4149db,_0x31f05c){var _0x594afb={},_0x766f31={},_0x1fc6a5={'count':0x0,'rows':[]};var _0x227e0e=_['map'](db[_0xd589('0x3b')]['rawAttributes'],function(_0xb60989){return{'name':_0xb60989[_0xd589('0x3c')],'type':_0xb60989[_0xd589('0x3d')][_0xd589('0x3e')]};});_0x766f31[_0xd589('0x3f')]=_['map'](_0x227e0e,_0xd589('0x29'));_0x766f31['query']=_[_0xd589('0x40')](_0x4149db[_0xd589('0x41')]);_0x766f31[_0xd589('0x42')]=_[_0xd589('0x43')](_0x766f31[_0xd589('0x3f')],_0x766f31['query']);_0x594afb[_0xd589('0x44')]=_[_0xd589('0x43')](_0x766f31[_0xd589('0x3f')],qs[_0xd589('0x45')](_0x4149db[_0xd589('0x41')][_0xd589('0x45')]));_0x594afb[_0xd589('0x44')]=_0x594afb[_0xd589('0x44')][_0xd589('0x46')]?_0x594afb[_0xd589('0x44')]:_0x766f31['model'];if(!_0x4149db[_0xd589('0x41')][_0xd589('0x47')]('nolimit')){_0x594afb[_0xd589('0x20')]=qs[_0xd589('0x20')](_0x4149db[_0xd589('0x41')][_0xd589('0x20')]);_0x594afb[_0xd589('0x1e')]=qs[_0xd589('0x1e')](_0x4149db['query'][_0xd589('0x1e')]);}_0x594afb[_0xd589('0x48')]=qs['sort'](_0x4149db['query'][_0xd589('0x49')]);_0x594afb[_0xd589('0x4a')]=qs[_0xd589('0x42')](_[_0xd589('0x4b')](_0x4149db[_0xd589('0x41')],_0x766f31[_0xd589('0x42')]),_0x227e0e);var _0xbc2e64=[];var _0x1b2884=squel['select']()[_0xd589('0x4c')]('id')['field']('name')['field'](_0xd589('0x4d'))['from'](_0xd589('0x4e'));var _0x4e0752=squel[_0xd589('0x4f')]()['field'](_0xd589('0x50'))[_0xd589('0x4c')](_0xd589('0x51'))[_0xd589('0x4c')]('ui.FaxInteractionId')[_0xd589('0x52')](_0xd589('0x53'),'ui')['left_join'](_0xd589('0x54'),'u',_0xd589('0x55'));var _0x219d73=squel[_0xd589('0x4f')]()[_0xd589('0x52')]('fax_interactions','i')[_0xd589('0x56')](_0xd589('0x57'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd589('0x56')]('users','o',_0xd589('0x58'))[_0xd589('0x56')](_0xd589('0x59'),'a',_0xd589('0x5a'))[_0xd589('0x56')](_0xd589('0x5b'),'me',_0xd589('0x5c'))[_0xd589('0x56')](_0xd589('0x5d'),'it',_0xd589('0x5e'))['left_join'](_0xd589('0x4e'),'t',_0xd589('0x5f'));var _0x49a453=squel[_0xd589('0x60')]();var _0x559c78=[];var _0x3bd06c=squel[_0xd589('0x60')]();var _0x27bb87;if(_0x4149db['query'][_0xd589('0x61')]){_0x27bb87=as[_0xd589('0x62')](_0x4149db[_0xd589('0x41')][_0xd589('0x61')]);var _0x25f940=_0x27bb87[_0xd589('0x63')];for(var _0x522fae=0x0;_0x522fae<_0x27bb87[_0xd589('0x64')][_0xd589('0x46')];_0x522fae++){var _0x41d5fa=_0x27bb87[_0xd589('0x64')][_0x522fae];var _0x5b9fa9='i';var _0x5cde8d=_[_0xd589('0x65')](_0x227e0e,[_0xd589('0x29'),_0x41d5fa[_0xd589('0x4c')]]);if(!_0x5cde8d){switch(_0x41d5fa[_0xd589('0x4c')]){case _0xd589('0x66'):if(_0x41d5fa['value']==0x1){_0x219d73['having']('`'+_0x41d5fa[_0xd589('0x4c')]+_0xd589('0x67'));}else{_0x219d73[_0xd589('0x68')]('`'+_0x41d5fa[_0xd589('0x4c')]+_0xd589('0x69'));}break;case _0xd589('0x6a'):if(_0x41d5fa[_0xd589('0x6b')]==='$substring'){if(_0x41d5fa[_0xd589('0x6c')][_0xd589('0x6d')]('\x20')[_0xd589('0x46')]>0x1){_0x49a453[_0x25f940](_0xd589('0x6e'),qs[_0xd589('0x6f')](_0x41d5fa['value']),null);}else{var _0x21e371='%'+_0x41d5fa[_0xd589('0x6c')]+'%';_0x49a453[_0x25f940]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x21e371,_0x21e371,_0x21e371);}}else{_0x5cde8d=_['find'](_0x227e0e,[_0xd589('0x29'),_0xd589('0x70')]);_0x41d5fa[_0xd589('0x4c')]=_0xd589('0x70');_0xb042b=as['buildExpression'](_0x5b9fa9,_0x5cde8d[_0xd589('0x3d')],_0x41d5fa);_0x49a453[_0x25f940](_0xb042b['text'],_0xb042b[_0xd589('0x6c')][_0xd589('0x71')],_0xb042b[_0xd589('0x6c')][_0xd589('0x1c')]);}break;case _0xd589('0x72'):var _0x55c8cd=_0x41d5fa['value'][_0xd589('0x6d')](',')['map'](function(_0x1acfe2){return Number(_0x1acfe2);});_0x55c8cd[_0xd589('0x30')](function(_0xc2f3cc){_0x3bd06c['or'](_0xd589('0x73'),'%,'+_0xc2f3cc+',%');});_0x559c78=_[_0xd589('0x74')](_0x559c78,_0x55c8cd);break;case'User':if(_0x41d5fa[_0xd589('0x6b')]==='$substring'){_0x49a453[_0x25f940](_0xd589('0x75'),'%'+_0x41d5fa[_0xd589('0x6c')]+'%',null);}else{_0x5cde8d=_[_0xd589('0x65')](_0x227e0e,['name',_0xd589('0x36')]);_0x41d5fa[_0xd589('0x4c')]=_0xd589('0x36');_0xb042b=as['buildExpression'](_0x5b9fa9,_0x5cde8d[_0xd589('0x3d')],_0x41d5fa);_0x49a453[_0x25f940](_0xb042b['text'],_0xb042b[_0xd589('0x6c')][_0xd589('0x71')],_0xb042b[_0xd589('0x6c')]['end']);}break;case _0xd589('0x76'):_0xb042b=as[_0xd589('0x77')]('me',null,_0x41d5fa);_0x49a453[_0x25f940](_0xb042b[_0xd589('0x78')],_0xb042b[_0xd589('0x6c')][_0xd589('0x71')],_0xb042b['value']['end']);break;}}else{var _0xb042b=as[_0xd589('0x77')](_0x5b9fa9,_0x5cde8d[_0xd589('0x3d')],_0x41d5fa);_0x49a453[_0x25f940](_0xb042b[_0xd589('0x78')],_0xb042b[_0xd589('0x6c')][_0xd589('0x71')],_0xb042b[_0xd589('0x6c')][_0xd589('0x1c')]);}}}else{var _0x51d96e=_(_0x4149db[_0xd589('0x41')])[_0xd589('0x40')]()[_0xd589('0x2c')](function(_0x39bbab){return _[_0xd589('0x79')](_0x227e0e,[_0xd589('0x29'),_0x39bbab])?_0x39bbab:undefined;})['compact']()[_0xd589('0x6c')]();if(!_[_0xd589('0x7a')](_0x51d96e)){_0x51d96e[_0xd589('0x30')](function(_0x49287a){if(_0x49287a===_0xd589('0x7b')){_0x219d73['where']('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x4149db[_0xd589('0x41')][_0x49287a]));}else if(_0x49287a===_0xd589('0x7c')){var _0x2b83b1=JSON[_0xd589('0x7d')](_0x4149db[_0xd589('0x41')][_0x49287a])['$gte'];var _0x253a48=JSON[_0xd589('0x7d')](_0x4149db[_0xd589('0x41')][_0x49287a])[_0xd589('0x7e')];_0x219d73[_0xd589('0x4a')](_0xd589('0x7f'),_0x2b83b1,_0x253a48);}else{if(_0x4149db[_0xd589('0x41')][_0x49287a]===_0xd589('0x80')){_0x219d73[_0xd589('0x4a')]('i.'+_0x49287a+'\x20IS\x20NULL');}else{_0x219d73[_0xd589('0x4a')]('i.'+_0x49287a+_0xd589('0x81'),_0x4149db[_0xd589('0x41')][_0x49287a]);}}});}if(_0x4149db[_0xd589('0x41')][_0xd589('0x82')]){if(_0x4149db['query'][_0xd589('0x82')]==0x1){_0x219d73['having'](_0xd589('0x83'));}else{_0x219d73[_0xd589('0x68')](_0xd589('0x84'));}}if(_0x4149db['query'][_0xd589('0x85')]){_0x559c78=_['isArray'](_0x4149db[_0xd589('0x41')][_0xd589('0x85')])?_0x4149db[_0xd589('0x41')]['tag']:new Array(_0x4149db[_0xd589('0x41')][_0xd589('0x85')]);_0x559c78[_0xd589('0x30')](function(_0x25361f){_0x3bd06c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x25361f+',%');});}if(_0x4149db[_0xd589('0x41')][_0xd589('0x86')]){var _0x22aff9=_0x4149db[_0xd589('0x41')][_0xd589('0x86')][_0xd589('0x87')]('\x5c','\x5c\x5c')[_0xd589('0x87')](/'/g,'\x27\x27');if(qs[_0xd589('0x88')](_0x22aff9)){_0x49a453['or'](_0xd589('0x89'),_0x22aff9+'%')['or'](_0xd589('0x8a'),_0x22aff9+'%');}_0x49a453['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x22aff9+'%');}}_0x219d73[_0xd589('0x4a')](_0x49a453);_0x219d73[_0xd589('0x8b')](_0xd589('0x8c'));var _0x3421b6={'type':db[_0xd589('0x8d')][_0xd589('0x8e')][_0xd589('0x8f')],'raw':!![]};var _0x360d1b=_0x219d73['clone']();_0x360d1b[_0xd589('0x4c')]('i.id');_0x360d1b[_0xd589('0x4c')](_0xd589('0x90'),_0xd589('0x66'));if(_0x594afb[_0xd589('0x48')]){_0x594afb['order']['forEach'](function(_0x311462){var _0x54dbaf=_0x311462[0x0]===_0xd589('0x91')?_0x311462[0x0]:'i.'+_0x311462[0x0];_0x219d73[_0xd589('0x48')](_0x54dbaf,_0x311462[0x1]===_0xd589('0x92')?![]:!![]);});}if(!_[_0xd589('0x7a')](_0x559c78)){_0x219d73[_0xd589('0x68')](_0x3bd06c);_0x360d1b[_0xd589('0x4a')](_0xd589('0x93'),_0x559c78);}BPromise[_0xd589('0x94')]()['then'](function(){if(!_0x27bb87){if(_0x4149db[_0xd589('0x41')][_0xd589('0x7b')])return;_0x360d1b[_0xd589('0x4a')](_0xd589('0x95'));_0x219d73[_0xd589('0x4a')](_0xd589('0x95'));return;}if(_0x4149db[_0xd589('0x96')][_0xd589('0x97')]!==_0xd589('0x98'))return;return _0x4149db[_0xd589('0x96')][_0xd589('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2dc6a0){if(_[_0xd589('0x7a')](_0x2dc6a0)){_0x360d1b[_0xd589('0x4a')](_0xd589('0x9a'));_0x219d73[_0xd589('0x4a')](_0xd589('0x9a'));}else{_0x360d1b[_0xd589('0x4a')](_0xd589('0x9b'),_[_0xd589('0x2c')](_0x2dc6a0,'id'));_0x219d73[_0xd589('0x4a')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x2dc6a0,'id'));}});})[_0xd589('0x27')](function(){if(_0x4149db[_0xd589('0x96')]['role']==='agent'&&!_0x27bb87&&!_0x4149db[_0xd589('0x41')][_0xd589('0x7b')])return[];return db[_0xd589('0x9c')][_0xd589('0x41')](_0x360d1b[_0xd589('0x9d')](),_0x3421b6);})[_0xd589('0x27')](function(_0xbdbeea){_0x1fc6a5[_0xd589('0x21')]=_0xbdbeea['length'];if(_0x1fc6a5[_0xd589('0x21')]===0x0)return[];return db[_0xd589('0x9c')][_0xd589('0x41')](_0x1b2884['toString'](),_0x3421b6)[_0xd589('0x27')](function(_0x240709){_0xbc2e64=_['keyBy'](_0x240709,'id');_0x3421b6=_[_0xd589('0x9e')](_0x3421b6,{'model':db[_0xd589('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4149db[_0xd589('0x41')][_0xd589('0x45')]){_0x594afb[_0xd589('0x44')][_0xd589('0x30')](function(_0x1be4bc){_0x219d73[_0xd589('0x4c')]('i.'+_0x1be4bc);});}else{_0x219d73['field'](_0xd589('0x90'),_0xd589('0x66'));_0x219d73['field'](_0xd589('0x9f'),_0xd589('0xa0'));_0x219d73[_0xd589('0x4c')](_0xd589('0xa1'),_0xd589('0xa2'));_0x219d73[_0xd589('0x4c')](_0xd589('0xa3'),_0xd589('0x91'));_0x219d73[_0xd589('0x4c')](_0xd589('0xa4'));_0x219d73[_0xd589('0x4c')]('c.firstName',_0xd589('0xa5'));_0x219d73['field'](_0xd589('0xa6'),_0xd589('0xa7'));_0x219d73[_0xd589('0x4c')](_0xd589('0xa8'),_0xd589('0xa9'));_0x219d73[_0xd589('0x4c')](_0xd589('0xaa'),_0xd589('0xab'));_0x219d73[_0xd589('0x4c')]('c.mobile','Contact.mobile');_0x219d73[_0xd589('0x4c')](_0xd589('0xac'),_0xd589('0xad'));_0x219d73[_0xd589('0x4c')](_0xd589('0xae'),_0xd589('0xaf'));_0x219d73[_0xd589('0x4c')](_0xd589('0xb0'),'Owner.internal');_0x219d73[_0xd589('0x4c')](_0xd589('0xb1'),_0xd589('0x2e'));}if(_0x594afb[_0xd589('0x20')])_0x219d73[_0xd589('0x20')](_0x594afb['limit']);if(_0x594afb['offset'])_0x219d73[_0xd589('0x1e')](_0x594afb[_0xd589('0x1e')]);return db[_0xd589('0x9c')][_0xd589('0x41')](_0x219d73[_0xd589('0x9d')](),_0x3421b6);})[_0xd589('0x27')](function(_0x1eec9e){if(_0x1eec9e[_0xd589('0x46')]>0x0)_0x4e0752[_0xd589('0x4a')](_0xd589('0xb2'),_[_0xd589('0x2c')](_0x1eec9e,'id'));return db['sequelize'][_0xd589('0x41')](_0x4e0752['toString'](),_0x3421b6)['then'](function(_0x113fc2){var _0x2d6d20=_['groupBy'](_0x113fc2,'FaxInteractionId');var _0x31a734=[];_0x1eec9e['forEach'](function(_0x1348f0){_0x31a734['push'](updateFaxInteraction(_0x1348f0,_0xbc2e64,_0x2d6d20));});return BPromise['all'](_0x31a734);});});})['then'](function(_0x1755f5){_0x1fc6a5[_0xd589('0xb3')]=_0x1755f5;return _0x1fc6a5;})[_0xd589('0x27')](respondWithFilteredResult(_0x31f05c,_0x594afb))[_0xd589('0x32')](handleError(_0x31f05c,null));};exports[_0xd589('0xb4')]=function(_0x33ec3f,_0x48aa7f){var _0x4f3d24={'raw':![],'where':{'id':_0x33ec3f[_0xd589('0xb5')]['id']}},_0x1c3b42={};_0x1c3b42[_0xd589('0x3f')]=_[_0xd589('0x40')](db[_0xd589('0x3b')][_0xd589('0xb6')]);_0x1c3b42[_0xd589('0x41')]=_[_0xd589('0x40')](_0x33ec3f['query']);_0x1c3b42[_0xd589('0x42')]=_[_0xd589('0x43')](_0x1c3b42[_0xd589('0x3f')],_0x1c3b42[_0xd589('0x41')]);_0x4f3d24[_0xd589('0x44')]=_[_0xd589('0x43')](_0x1c3b42[_0xd589('0x3f')],qs['fields'](_0x33ec3f['query'][_0xd589('0x45')]));_0x4f3d24[_0xd589('0x44')]=_0x4f3d24[_0xd589('0x44')]['length']?_0x4f3d24['attributes']:_0x1c3b42['model'];if(_0x33ec3f[_0xd589('0x41')][_0xd589('0xb7')]){_0x4f3d24['include']=[{'all':!![]}];}_0x4f3d24=_['merge']({},_0x4f3d24,_0x33ec3f[_0xd589('0xb8')]);return db['FaxInteraction'][_0xd589('0x65')](_0x4f3d24)[_0xd589('0x27')](handleEntityNotFound(_0x48aa7f,null))[_0xd589('0x27')](respondWithResult(_0x48aa7f,null))[_0xd589('0x32')](handleError(_0x48aa7f,null));};exports[_0xd589('0xb9')]=function(_0x6ea8e9,_0x426147){return db[_0xd589('0x3b')]['create'](_0x6ea8e9['body'],{})['then'](respondWithResult(_0x426147,0xc9))[_0xd589('0x32')](handleError(_0x426147,null));};exports[_0xd589('0x26')]=function(_0x5099cc,_0xd1bfe){if(_0x5099cc['body']['id']){delete _0x5099cc[_0xd589('0x76')]['id'];}return db[_0xd589('0x3b')][_0xd589('0x65')]({'where':{'id':_0x5099cc[_0xd589('0xb5')]['id']}})[_0xd589('0x27')](handleEntityNotFound(_0xd1bfe,null))[_0xd589('0x27')](saveUpdates(_0x5099cc['body'],null))[_0xd589('0x27')](respondWithResult(_0xd1bfe,null))[_0xd589('0x32')](handleError(_0xd1bfe,null));};exports[_0xd589('0xba')]=function(_0x33dbd0,_0x23b894){return db[_0xd589('0x3b')][_0xd589('0x65')]({'where':{'id':_0x33dbd0[_0xd589('0xb5')]['id']}})[_0xd589('0x27')](handleEntityNotFound(_0x23b894,null))[_0xd589('0x27')](removeEntity(_0x23b894,null))[_0xd589('0x32')](handleError(_0x23b894,null));};exports[_0xd589('0xbb')]=function(_0x598462,_0x2d33b3){return db[_0xd589('0x3b')][_0xd589('0xbb')]()['then'](respondWithResult(_0x2d33b3,null))[_0xd589('0x32')](handleError(_0x2d33b3,null));};exports['addMessage']=function(_0x3c3f51,_0x44c8a9,_0x57ad11){return db['FaxMessage'][_0xd589('0x65')]({'where':{'id':_0x3c3f51['params']['id']}})['then'](handleEntityNotFound(_0x44c8a9,null))['then'](function(_0x4216bc){if(_0x4216bc){return _0x4216bc[_0xd589('0xbc')](_0x3c3f51[_0xd589('0x76')][_0xd589('0xbd')],_[_0xd589('0xbe')](_0x3c3f51[_0xd589('0x76')],['ids','id'])||{});}})['then'](respondWithResult(_0x44c8a9,null))[_0xd589('0x32')](handleError(_0x44c8a9,null));};exports['getMessages']=function(_0x11ceb9,_0x4e68f2,_0xb5dc91){var _0x3cc1d5={'raw':![],'where':{}};var _0x1af1db={};var _0x4e52d4={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x11ceb9['params']['id']}})[_0xd589('0x27')](handleEntityNotFound(_0x4e68f2,null))['then'](function(_0x57020d){if(_0x57020d){_0x1af1db[_0xd589('0x3f')]=_['keys'](db[_0xd589('0xbf')]['rawAttributes']);_0x1af1db[_0xd589('0x41')]=_[_0xd589('0x40')](_0x11ceb9['query']);_0x1af1db[_0xd589('0x42')]=_[_0xd589('0x43')](_0x1af1db['model'],_0x1af1db[_0xd589('0x41')]);_0x3cc1d5['attributes']=_[_0xd589('0x43')](_0x1af1db[_0xd589('0x3f')],qs[_0xd589('0x45')](_0x11ceb9['query'][_0xd589('0x45')]));_0x3cc1d5['attributes']=_0x3cc1d5[_0xd589('0x44')][_0xd589('0x46')]?_0x3cc1d5['attributes']:_0x1af1db[_0xd589('0x3f')];if(!_0x11ceb9[_0xd589('0x41')]['hasOwnProperty'](_0xd589('0xc0'))){_0x3cc1d5[_0xd589('0x20')]=qs[_0xd589('0x20')](_0x11ceb9[_0xd589('0x41')][_0xd589('0x20')]);_0x3cc1d5[_0xd589('0x1e')]=qs[_0xd589('0x1e')](_0x11ceb9[_0xd589('0x41')]['offset']);}_0x3cc1d5['order']=qs['sort'](_0x11ceb9['query'][_0xd589('0x49')]);_0x3cc1d5[_0xd589('0x4a')]=qs[_0xd589('0x42')](_['pick'](_0x11ceb9[_0xd589('0x41')],_0x1af1db[_0xd589('0x42')]));_0x3cc1d5[_0xd589('0x4a')][_0xd589('0xc1')]=_0x57020d['id'];if(_0x11ceb9[_0xd589('0x41')]['filter']){_0x3cc1d5[_0xd589('0x4a')]=_[_0xd589('0x9e')](_0x3cc1d5[_0xd589('0x4a')],{'$or':_[_0xd589('0x2c')](_0x3cc1d5[_0xd589('0x44')],function(_0x5686c1){var _0x158359={};_0x158359[_0x5686c1]={'$like':'%'+_0x11ceb9[_0xd589('0x41')][_0xd589('0x86')]+'%'};return _0x158359;})});}if(_0x11ceb9['query'][_0xd589('0xc2')]){var _0x1fa412=_0x11ceb9[_0xd589('0x41')][_0xd589('0xc2')][_0xd589('0x6d')](',');var _0x103942={};_0x103942[_0x1fa412[0x0]]={'$gte':moment(_0x1fa412[0x1])[_0xd589('0xc3')](_0xd589('0xc4'))};_0x3cc1d5['where']=_[_0xd589('0x9e')](_0x3cc1d5[_0xd589('0x4a')],_0x103942);}_0x3cc1d5=_[_0xd589('0x9e')]({},_0x3cc1d5,_0x11ceb9[_0xd589('0xb8')]);return db['FaxMessage'][_0xd589('0x21')]({'where':_0x3cc1d5[_0xd589('0x4a')]})['then'](function(_0x15fbb9){_0x4e52d4[_0xd589('0x21')]=_0x15fbb9;if(_0x11ceb9[_0xd589('0x41')][_0xd589('0xb7')]){_0x3cc1d5[_0xd589('0xc5')]=[{'all':!![]}];}return db[_0xd589('0xbf')][_0xd589('0xc6')](_0x3cc1d5);})[_0xd589('0x27')](function(_0x30848e){_0x4e52d4[_0xd589('0xb3')]=_0x30848e;return _0x4e52d4;});}})[_0xd589('0x27')](respondWithFilteredResult(_0x4e68f2,_0x3cc1d5))['catch'](handleError(_0x4e68f2,null));};exports[_0xd589('0xc7')]=function(_0x442e9c,_0x27c998,_0x50069a){return db[_0xd589('0x3b')][_0xd589('0x65')]({'where':{'id':_0x442e9c[_0xd589('0xb5')]['id']}})[_0xd589('0x27')](handleEntityNotFound(_0x27c998,null))[_0xd589('0x27')](function(_0x2018d4){if(_0x2018d4){return _0x2018d4[_0xd589('0xc8')](_0x442e9c['body']['ids'],_[_0xd589('0xbe')](_0x442e9c[_0xd589('0x76')],['ids','id'])||{})[_0xd589('0xc9')](function(){return db['Tag'][_0xd589('0xc6')]({'attributes':['id',_0xd589('0x29'),'color'],'where':{'id':_0x442e9c[_0xd589('0x76')][_0xd589('0xbd')]}});})[_0xd589('0x27')](function(_0x216ad3){socket[_0xd589('0xca')]('faxInteractionTags:save',{'id':Number(_0x442e9c[_0xd589('0xb5')]['id']),'tags':_0x216ad3||[]});return{'id':Number(_0x442e9c[_0xd589('0xb5')]['id']),'tags':_0x216ad3||[]};});}})['then'](respondWithResult(_0x27c998,null))[_0xd589('0x32')](handleError(_0x27c998,null));};exports[_0xd589('0xcb')]=function(_0x5106c3,_0x3b759e,_0x34eac2){return db[_0xd589('0x3b')]['find']({'where':{'id':_0x5106c3['params']['id']}})['then'](handleEntityNotFound(_0x3b759e,null))[_0xd589('0x27')](function(_0x2470d0){if(_0x2470d0){return _0x2470d0[_0xd589('0xcb')](_0x5106c3['query'][_0xd589('0xbd')]);}})[_0xd589('0x27')](respondWithStatusCode(_0x3b759e,null))['catch'](handleError(_0x3b759e,null));};exports[_0xd589('0xcc')]=function(_0x34cb47,_0x4482d4){var _0x13560d=moment()[_0xd589('0xcd')]()[_0xd589('0x9d')]();var _0x306cd0=path['join'](config[_0xd589('0xce')],'server',_0xd589('0xcf'),_0xd589('0xd0'));var _0x12fcd0=path[_0xd589('0xd1')](config[_0xd589('0xce')],_0xd589('0xd2'),_0xd589('0xcf'),'attachments');var _0x59da45=path[_0xd589('0xd1')](_0x306cd0,_0x13560d);var _0x10d0c0=util[_0xd589('0xc3')](_0xd589('0xd3'),_0x34cb47[_0xd589('0xb5')]['id'],_0x13560d);var _0x3d4c06=path[_0xd589('0xd1')](_0x306cd0,_0x10d0c0);var _0x35943e=[];_0x35943e[_0xd589('0x31')]({'model':db[_0xd589('0xd4')],'as':_0xd589('0xd4'),'raw':!![]});var _0x550893=[{'model':db[_0xd589('0xbf')],'as':_0xd589('0xd5'),'attributes':['id',_0xd589('0x76'),'createdAt'],'include':_0x35943e}];return db[_0xd589('0x3b')][_0xd589('0x65')]({'where':{'id':_0x34cb47[_0xd589('0xb5')]['id']},'include':_0x550893})[_0xd589('0x27')](handleEntityNotFound(_0x4482d4,null))[_0xd589('0x27')](function(_0x178bb1){if(_0x178bb1&&_0x178bb1[_0xd589('0xd5')]){var _0x48661c=_0x178bb1[_0xd589('0xd6')]({'plain':!![]});fs[_0xd589('0xd7')](_0x59da45);for(var _0xbf932f=0x0;_0xbf932f<_0x48661c[_0xd589('0xd5')]['length'];_0xbf932f++){var _0x1e389c=_0x48661c[_0xd589('0xd5')][_0xbf932f][_0xd589('0xd4')];if(_0x1e389c){var _0x1bc6dd=path[_0xd589('0xd1')](_0x12fcd0,_0x1e389c['basename']);if(fs[_0xd589('0xd8')](_0x1bc6dd)){fs['createReadStream'](_0x1bc6dd)[_0xd589('0xd9')](fs[_0xd589('0xda')](path[_0xd589('0xd1')](_0x59da45,_0x1e389c[_0xd589('0xdb')])));}}}return BPromise[_0xd589('0x94')]()['then'](function(){return new BPromise(function(_0x242c73,_0x1bc307){zipdir(_0x59da45,{'saveTo':_0x3d4c06},function(_0x2a16e4,_0x1b0039){if(_0x2a16e4)return _0x1bc307(_0x2a16e4);return _0x242c73(_0x1b0039);});})[_0xd589('0x27')](function(){return new BPromise(function(_0x2f7489,_0x328e7e){rimraf(_0x59da45,function(_0x551d4d){if(_0x551d4d)_0x328e7e(_0x551d4d);return _0x2f7489();});});})[_0xd589('0x27')](function(){return _0x4482d4[_0xd589('0xcc')](_0x3d4c06,_0x10d0c0,function(_0xc555fc){if(_0xc555fc){console['log']('err',_0xc555fc);}else{fs[_0xd589('0xdc')](_0x3d4c06);}});});});}else{return _0x4482d4[_0xd589('0xdd')](0xc8);}})[_0xd589('0x32')](handleError(_0x4482d4,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d203fc1..e5a85c0 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 _0xbadc=['unreadMessages','length','emit','catch','hasOwnProperty','hook','../../mysqldb','FaxInteraction','setMaxListeners','remove','getUsers','Users','map','findAll','then','setDataValue'];(function(_0x4e9567,_0x93dc27){var _0xde0bc3=function(_0x5a2328){while(--_0x5a2328){_0x4e9567['push'](_0x4e9567['shift']());}};_0xde0bc3(++_0x93dc27);}(_0xbadc,0x76));var _0xcbad=function(_0x5281ce,_0x210279){_0x5281ce=_0x5281ce-0x0;var _0x138d09=_0xbadc[_0x5281ce];return _0x138d09;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xcbad('0x0'))['db'][_0xcbad('0x1')];var FaxMessage=require(_0xcbad('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xcbad('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcbad('0x3')};function emitEvent(_0x25feac){return function(_0x222362,_0x282d13,_0x48ba1c){_0x222362[_0xcbad('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0xe01049){_0x222362['setDataValue'](_0xcbad('0x5'),_0xe01049[_0xcbad('0x6')](function(_0x6f7dcc){return{'id':_0x6f7dcc['id']};}));return FaxMessage[_0xcbad('0x7')]({'where':{'FaxInteractionId':_0x222362['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcbad('0x8')](function(_0xdf0c5f){_0x222362[_0xcbad('0x9')](_0xcbad('0xa'),_0xdf0c5f[_0xcbad('0xb')]);FaxInteractionEvents[_0xcbad('0xc')](_0x25feac+':'+_0x222362['id'],_0x222362);FaxInteractionEvents[_0xcbad('0xc')](_0x25feac,_0x222362);_0x48ba1c(null);})[_0xcbad('0xd')](_0x48ba1c(null));};}for(var e in events){if(events[_0xcbad('0xe')](e)){var event=events[e];FaxInteraction[_0xcbad('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x174b=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then'];(function(_0x14652e,_0x59fb87){var _0x1e3b87=function(_0x3942f2){while(--_0x3942f2){_0x14652e['push'](_0x14652e['shift']());}};_0x1e3b87(++_0x59fb87);}(_0x174b,0x125));var _0xb174=function(_0x1fde92,_0x5c87b3){_0x1fde92=_0x1fde92-0x0;var _0x22d208=_0x174b[_0x1fde92];return _0x22d208;};'use strict';var EventEmitter=require(_0xb174('0x0'));var FaxInteraction=require(_0xb174('0x1'))['db'][_0xb174('0x2')];var FaxMessage=require(_0xb174('0x1'))['db'][_0xb174('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb174('0x4')](0x0);var events={'afterCreate':_0xb174('0x5'),'afterUpdate':_0xb174('0x6'),'afterDestroy':_0xb174('0x7')};function emitEvent(_0x1a19d4){return function(_0x58303a,_0x57fdde,_0x1c26d4){_0x58303a['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2b63c1){_0x58303a[_0xb174('0x8')](_0xb174('0x9'),_0x2b63c1[_0xb174('0xa')](function(_0x3e4dcc){return{'id':_0x3e4dcc['id']};}));return FaxMessage[_0xb174('0xb')]({'where':{'FaxInteractionId':_0x58303a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb174('0xc')](function(_0x3b4935){_0x58303a['setDataValue']('unreadMessages',_0x3b4935['length']);FaxInteractionEvents[_0xb174('0xd')](_0x1a19d4+':'+_0x58303a['id'],_0x58303a);FaxInteractionEvents[_0xb174('0xd')](_0x1a19d4,_0x58303a);_0x1c26d4(null);})[_0xb174('0xe')](_0x1c26d4(null));};}for(var e in events){if(events[_0xb174('0xf')](e)){var event=events[e];FaxInteraction[_0xb174('0x10')](e,emitEvent(event));}}module[_0xb174('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 30f3f74..d28273c 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 _0xe46d=['./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0xe46d,0x91));var _0xde46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe46d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde46('0x0'));var util=require(_0xde46('0x1'));var logger=require(_0xde46('0x2'))(_0xde46('0x3'));var moment=require('moment');var BPromise=require(_0xde46('0x4'));var rp=require(_0xde46('0x5'));var fs=require('fs');var path=require(_0xde46('0x6'));var rimraf=require(_0xde46('0x7'));var config=require('../../config/environment');var attributes=require(_0xde46('0x8'));module[_0xde46('0x9')]=function(_0x4d0284,_0x18ed54){return _0x4d0284[_0xde46('0xa')](_0xde46('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb5aa4,_0x5faaa6,_0x4d6b0e){if(_0xb5aa4[_0xde46('0xc')](_0xde46('0xd'))){_0xb5aa4[_0xde46('0xe')]=moment()[_0xde46('0xf')](_0xde46('0x10'));}_0x4d6b0e(null,_0xb5aa4);}}});}; \ No newline at end of file +var _0x7c88=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','closed','closedAt','format','lodash','util','../../config/logger','api'];(function(_0x3e8ba4,_0x4a2831){var _0x1b18a6=function(_0x54a86c){while(--_0x54a86c){_0x3e8ba4['push'](_0x3e8ba4['shift']());}};_0x1b18a6(++_0x4a2831);}(_0x7c88,0x194));var _0x87c8=function(_0x5dfceb,_0x55177c){_0x5dfceb=_0x5dfceb-0x0;var _0x3924c2=_0x7c88[_0x5dfceb];return _0x3924c2;};'use strict';var _=require(_0x87c8('0x0'));var util=require(_0x87c8('0x1'));var logger=require(_0x87c8('0x2'))(_0x87c8('0x3'));var moment=require(_0x87c8('0x4'));var BPromise=require(_0x87c8('0x5'));var rp=require(_0x87c8('0x6'));var fs=require('fs');var path=require(_0x87c8('0x7'));var rimraf=require(_0x87c8('0x8'));var config=require(_0x87c8('0x9'));var attributes=require(_0x87c8('0xa'));module[_0x87c8('0xb')]=function(_0x2c59aa,_0x879e0f){return _0x2c59aa['define'](_0x87c8('0xc'),attributes,{'tableName':_0x87c8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28c2b1,_0x5721ea,_0x4892ee){if(_0x28c2b1['changed'](_0x87c8('0xe'))){_0x28c2b1[_0x87c8('0xf')]=moment()[_0x87c8('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4892ee(null,_0x28c2b1);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index b1ece49..6184868 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 _0xef2d=['error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4bcac3,_0x596681){var _0x5f5318=function(_0x382d31){while(--_0x382d31){_0x4bcac3['push'](_0x4bcac3['shift']());}};_0x5f5318(++_0x596681);}(_0xef2d,0x1af));var _0xdef2=function(_0x124593,_0x3e558f){_0x124593=_0x124593-0x0;var _0x23cbb1=_0xef2d[_0x124593];return _0x23cbb1;};'use strict';var _=require(_0xdef2('0x0'));var util=require('util');var moment=require(_0xdef2('0x1'));var BPromise=require('bluebird');var rs=require(_0xdef2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdef2('0x3'))['db'];var utils=require(_0xdef2('0x4'));var logger=require(_0xdef2('0x5'))(_0xdef2('0x6'));var config=require('../../config/environment');var jayson=require(_0xdef2('0x7'));var client=jayson['client'][_0xdef2('0x8')]({'port':0x232a});config[_0xdef2('0x9')]=_[_0xdef2('0xa')](config[_0xdef2('0x9')],{'host':_0xdef2('0xb'),'port':0x18eb});var socket=require(_0xdef2('0xc'))(new Redis(config[_0xdef2('0x9')]));require(_0xdef2('0xd'))[_0xdef2('0xe')](socket);function respondWithRpcPromise(_0x311f5d,_0x2f7201,_0x595c98){return new BPromise(function(_0x4602d1,_0x2b7b88){return client['request'](_0x311f5d,_0x595c98)[_0xdef2('0xf')](function(_0x5dbae9){logger[_0xdef2('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x2f7201,_0xdef2('0x11'));logger[_0xdef2('0x12')](_0xdef2('0x13'),_0x2f7201,_0xdef2('0x11'),JSON['stringify'](_0x5dbae9));if(_0x5dbae9[_0xdef2('0x14')]){if(_0x5dbae9[_0xdef2('0x14')][_0xdef2('0x15')]===0x1f4){logger['error'](_0xdef2('0x16'),_0x2f7201,_0x5dbae9['error']['message']);return _0x2b7b88(_0x5dbae9[_0xdef2('0x14')]['message']);}logger[_0xdef2('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x2f7201,_0x5dbae9[_0xdef2('0x14')][_0xdef2('0x17')]);return _0x4602d1(_0x5dbae9[_0xdef2('0x14')][_0xdef2('0x17')]);}else{logger[_0xdef2('0x10')](_0xdef2('0x16'),_0x2f7201,'request\x20sent');_0x4602d1(_0x5dbae9[_0xdef2('0x18')][_0xdef2('0x17')]);}})[_0xdef2('0x19')](function(_0x4dfdde){logger['error'](_0xdef2('0x16'),_0x2f7201,_0x4dfdde);_0x2b7b88(_0x4dfdde);});});}exports[_0xdef2('0x1a')]=function(_0x44a2a1){var _0x111a61=this;return new Promise(function(_0xc36c97,_0x540e52){return db['FaxInteraction']['update'](_0x44a2a1[_0xdef2('0x1b')],{'raw':_0x44a2a1[_0xdef2('0x1c')]?_0x44a2a1['options'][_0xdef2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a2a1[_0xdef2('0x1c')]?_0x44a2a1[_0xdef2('0x1c')][_0xdef2('0x1e')]||null:null,'attributes':_0x44a2a1[_0xdef2('0x1c')]?_0x44a2a1[_0xdef2('0x1c')][_0xdef2('0x1f')]||null:null,'limit':_0x44a2a1[_0xdef2('0x1c')]?_0x44a2a1[_0xdef2('0x1c')][_0xdef2('0x20')]||null:null})[_0xdef2('0xf')](function(_0x2e81b7){logger[_0xdef2('0x10')](_0xdef2('0x1a'),_0x44a2a1);logger[_0xdef2('0x12')](_0xdef2('0x1a'),_0x44a2a1,JSON[_0xdef2('0x21')](_0x2e81b7));_0xc36c97(_0x2e81b7);})['catch'](function(_0x28f38f){logger[_0xdef2('0x14')](_0xdef2('0x1a'),_0x28f38f[_0xdef2('0x17')],_0x44a2a1);_0x540e52(_0x111a61[_0xdef2('0x14')](0x1f4,_0x28f38f[_0xdef2('0x17')]));});});};exports[_0xdef2('0x22')]=function(_0x446ea0){return new Promise(function(_0x1ec5a9,_0x53484e){return db[_0xdef2('0x23')][_0xdef2('0x24')]({'where':_0x446ea0[_0xdef2('0x1c')]?_0x446ea0['options'][_0xdef2('0x1e')]||null:null})['then'](function(_0x3f9e3c){if(_0x3f9e3c){return _0x3f9e3c[_0xdef2('0x25')](_0x446ea0[_0xdef2('0x1b')][_0xdef2('0x26')],_['omit'](_0x446ea0['body'],[_0xdef2('0x26'),'id'])||{});}})[_0xdef2('0x27')](function(_0x279926){logger['info'](_0xdef2('0x28'),_0x446ea0);logger[_0xdef2('0x12')](_0xdef2('0x28'),_0x446ea0,JSON[_0xdef2('0x21')](_0x279926));_0x1ec5a9(_0x279926);})[_0xdef2('0x19')](function(_0x2b02ea){logger[_0xdef2('0x14')](_0xdef2('0x28'),_0x2b02ea[_0xdef2('0x17')],_0x446ea0);_0x53484e(_this['error'](0x1f4,_0x2b02ea[_0xdef2('0x17')]));});});}; \ No newline at end of file +var _0x634e=['request\x20sent','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','result','catch','FaxInteraction','options','raw','where','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','defaults','socket.io-emitter','redis','./faxInteraction.socket','register','request','then','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x3a4949,_0x24ee14){var _0x22521e=function(_0x37c416){while(--_0x37c416){_0x3a4949['push'](_0x3a4949['shift']());}};_0x22521e(++_0x24ee14);}(_0x634e,0x1b0));var _0xe634=function(_0x22dbd1,_0x47e0bb){_0x22dbd1=_0x22dbd1-0x0;var _0x50a4fd=_0x634e[_0x22dbd1];return _0x50a4fd;};'use strict';var _=require(_0xe634('0x0'));var util=require(_0xe634('0x1'));var moment=require(_0xe634('0x2'));var BPromise=require(_0xe634('0x3'));var rs=require(_0xe634('0x4'));var fs=require('fs');var Redis=require(_0xe634('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe634('0x6'));var logger=require(_0xe634('0x7'))(_0xe634('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe634('0x9')]({'port':0x232a});config['redis']=_[_0xe634('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe634('0xb'))(new Redis(config[_0xe634('0xc')]));require(_0xe634('0xd'))[_0xe634('0xe')](socket);function respondWithRpcPromise(_0x3389a6,_0x1f9520,_0x37fa70){return new BPromise(function(_0xa9da5d,_0x11c282){return client[_0xe634('0xf')](_0x3389a6,_0x37fa70)[_0xe634('0x10')](function(_0x81a25){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x1f9520,'request\x20sent');logger[_0xe634('0x11')](_0xe634('0x12'),_0x1f9520,_0xe634('0x13'),JSON[_0xe634('0x14')](_0x81a25));if(_0x81a25[_0xe634('0x15')]){if(_0x81a25[_0xe634('0x15')][_0xe634('0x16')]===0x1f4){logger[_0xe634('0x15')](_0xe634('0x17'),_0x1f9520,_0x81a25['error'][_0xe634('0x18')]);return _0x11c282(_0x81a25['error'][_0xe634('0x18')]);}logger[_0xe634('0x15')](_0xe634('0x17'),_0x1f9520,_0x81a25['error'][_0xe634('0x18')]);return _0xa9da5d(_0x81a25[_0xe634('0x15')][_0xe634('0x18')]);}else{logger[_0xe634('0x19')](_0xe634('0x17'),_0x1f9520,'request\x20sent');_0xa9da5d(_0x81a25[_0xe634('0x1a')]['message']);}})[_0xe634('0x1b')](function(_0x2e0d43){logger[_0xe634('0x15')](_0xe634('0x17'),_0x1f9520,_0x2e0d43);_0x11c282(_0x2e0d43);});});}exports['UpdateFaxInteraction']=function(_0x5db77d){var _0x5746f4=this;return new Promise(function(_0x24cf80,_0x5386d7){return db[_0xe634('0x1c')]['update'](_0x5db77d['body'],{'raw':_0x5db77d[_0xe634('0x1d')]?_0x5db77d['options'][_0xe634('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db77d[_0xe634('0x1d')]?_0x5db77d[_0xe634('0x1d')][_0xe634('0x1f')]||null:null,'attributes':_0x5db77d[_0xe634('0x1d')]?_0x5db77d[_0xe634('0x1d')][_0xe634('0x20')]||null:null,'limit':_0x5db77d[_0xe634('0x1d')]?_0x5db77d[_0xe634('0x1d')]['limit']||null:null})['then'](function(_0x1d11d8){logger[_0xe634('0x19')](_0xe634('0x21'),_0x5db77d);logger[_0xe634('0x11')](_0xe634('0x21'),_0x5db77d,JSON['stringify'](_0x1d11d8));_0x24cf80(_0x1d11d8);})['catch'](function(_0x166ae1){logger[_0xe634('0x15')](_0xe634('0x21'),_0x166ae1['message'],_0x5db77d);_0x5386d7(_0x5746f4[_0xe634('0x15')](0x1f4,_0x166ae1[_0xe634('0x18')]));});});};exports[_0xe634('0x22')]=function(_0x415c3e){return new Promise(function(_0x6b56cb,_0x2958bb){return db[_0xe634('0x1c')][_0xe634('0x23')]({'where':_0x415c3e[_0xe634('0x1d')]?_0x415c3e[_0xe634('0x1d')]['where']||null:null})['then'](function(_0x52c565){if(_0x52c565){return _0x52c565[_0xe634('0x24')](_0x415c3e[_0xe634('0x25')][_0xe634('0x26')],_['omit'](_0x415c3e[_0xe634('0x25')],[_0xe634('0x26'),'id'])||{});}})[_0xe634('0x27')](function(_0x1ba2b7){logger[_0xe634('0x19')]('AddTags',_0x415c3e);logger[_0xe634('0x11')](_0xe634('0x28'),_0x415c3e,JSON[_0xe634('0x14')](_0x1ba2b7));_0x6b56cb(_0x1ba2b7);})[_0xe634('0x1b')](function(_0x1650bc){logger[_0xe634('0x15')](_0xe634('0x28'),_0x1650bc['message'],_0x415c3e);_0x2958bb(_this[_0xe634('0x15')](0x1f4,_0x1650bc[_0xe634('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ab7e6d0..7429348 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 _0xb14b=['emit','removeListener','register','length','./faxInteraction.events','save','remove','update'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xb14b,0x64));var _0xbb14=function(_0x36b5c8,_0x16c0cf){_0x36b5c8=_0x36b5c8-0x0;var _0x4e70e5=_0xb14b[_0x36b5c8];return _0x4e70e5;};'use strict';var FaxInteractionEvents=require(_0xbb14('0x0'));var events=[_0xbb14('0x1'),_0xbb14('0x2'),_0xbb14('0x3')];function createListener(_0x2bf454,_0x1fcace){return function(_0x2cb259){_0x1fcace[_0xbb14('0x4')](_0x2bf454,_0x2cb259);};}function removeListener(_0x105501,_0x4bf04f){return function(){FaxInteractionEvents[_0xbb14('0x5')](_0x105501,_0x4bf04f);};}exports[_0xbb14('0x6')]=function(_0x1afe61){for(var _0x39255e=0x0,_0x3de457=events[_0xbb14('0x7')];_0x39255e<_0x3de457;_0x39255e++){var _0x2fbe19=events[_0x39255e];var _0x368d14=createListener('faxInteraction:'+_0x2fbe19,_0x1afe61);FaxInteractionEvents['on'](_0x2fbe19,_0x368d14);}}; \ No newline at end of file +var _0xdcb7=['faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener','length'];(function(_0x3e6977,_0xd514e5){var _0x46c173=function(_0x4090c2){while(--_0x4090c2){_0x3e6977['push'](_0x3e6977['shift']());}};_0x46c173(++_0xd514e5);}(_0xdcb7,0x166));var _0x7dcb=function(_0x26acc5,_0x53657e){_0x26acc5=_0x26acc5-0x0;var _0x1d9b7e=_0xdcb7[_0x26acc5];return _0x1d9b7e;};'use strict';var FaxInteractionEvents=require(_0x7dcb('0x0'));var events=['save',_0x7dcb('0x1'),_0x7dcb('0x2')];function createListener(_0x21e1d4,_0x21e0af){return function(_0x405925){_0x21e0af[_0x7dcb('0x3')](_0x21e1d4,_0x405925);};}function removeListener(_0xa8a96b,_0x47ed0b){return function(){FaxInteractionEvents[_0x7dcb('0x4')](_0xa8a96b,_0x47ed0b);};}exports['register']=function(_0x25e25f){for(var _0x5a827a=0x0,_0x2931a0=events[_0x7dcb('0x5')];_0x5a827a<_0x2931a0;_0x5a827a++){var _0x208fe8=events[_0x5a827a];var _0x2907db=createListener(_0x7dcb('0x6')+_0x208fe8,_0x25e25f);FaxInteractionEvents['on'](_0x208fe8,_0x2907db);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1d8a78e..ab3f725 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 _0xb010=['/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','fax','put','/:id','faxinteraction:update','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x10fc9a,_0x78f66a){var _0x1b26d3=function(_0x5847d7){while(--_0x5847d7){_0x10fc9a['push'](_0x10fc9a['shift']());}};_0x1b26d3(++_0x78f66a);}(_0xb010,0x70));var _0x0b01=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb010[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x0b01('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0b01('0x1'));var express=require(_0x0b01('0x2'));var router=express['Router']();var fs_extra=require(_0x0b01('0x3'));var auth=require(_0x0b01('0x4'));var interaction=require(_0x0b01('0x5'));var config=require(_0x0b01('0x6'));var controller=require(_0x0b01('0x7'));router[_0x0b01('0x8')]('/',auth[_0x0b01('0x9')](),controller[_0x0b01('0xa')]);router['get'](_0x0b01('0xb'),auth[_0x0b01('0x9')](),controller[_0x0b01('0xc')]);router[_0x0b01('0x8')]('/:id',auth[_0x0b01('0x9')](),controller['show']);router[_0x0b01('0x8')](_0x0b01('0xd'),auth['isAuthenticated'](),controller[_0x0b01('0xe')]);router[_0x0b01('0x8')](_0x0b01('0xf'),auth[_0x0b01('0x9')](),controller['download']);router[_0x0b01('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0b01('0x10')](_0x0b01('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0x0b01('0x10')](_0x0b01('0x11'),auth[_0x0b01('0x9')](),interaction[_0x0b01('0x12')](_0x0b01('0x13'),'faxinteraction:addtags'),controller['addTags']);router[_0x0b01('0x14')](_0x0b01('0x15'),auth['isAuthenticated'](),interaction[_0x0b01('0x12')](_0x0b01('0x13'),_0x0b01('0x16')),controller[_0x0b01('0x17')]);router['delete'](_0x0b01('0x15'),auth[_0x0b01('0x9')](),interaction['tracked'](_0x0b01('0x13'),'faxinteraction:destroy'),controller['destroy']);router[_0x0b01('0x18')](_0x0b01('0x11'),auth[_0x0b01('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x28c1=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','multer'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0x28c1,0x18f));var _0x128c=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x28c1[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0x128c('0x0'));var util=require(_0x128c('0x1'));var path=require('path');var timeout=require(_0x128c('0x2'));var express=require('express');var router=express[_0x128c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x128c('0x4'));var interaction=require(_0x128c('0x5'));var config=require(_0x128c('0x6'));var controller=require('./faxInteraction.controller');router[_0x128c('0x7')]('/',auth[_0x128c('0x8')](),controller['index']);router[_0x128c('0x7')]('/describe',auth[_0x128c('0x8')](),controller['describe']);router['get'](_0x128c('0x9'),auth['isAuthenticated'](),controller[_0x128c('0xa')]);router[_0x128c('0x7')](_0x128c('0xb'),auth['isAuthenticated'](),controller['getMessages']);router[_0x128c('0x7')](_0x128c('0xc'),auth[_0x128c('0x8')](),controller[_0x128c('0xd')]);router[_0x128c('0xe')]('/',auth[_0x128c('0x8')](),controller[_0x128c('0xf')]);router[_0x128c('0xe')](_0x128c('0xb'),auth[_0x128c('0x8')](),controller['addMessage']);router[_0x128c('0xe')](_0x128c('0x10'),auth['isAuthenticated'](),interaction[_0x128c('0x11')](_0x128c('0x12'),_0x128c('0x13')),controller['addTags']);router['put'](_0x128c('0x9'),auth[_0x128c('0x8')](),interaction[_0x128c('0x11')](_0x128c('0x12'),_0x128c('0x14')),controller[_0x128c('0x15')]);router[_0x128c('0x16')](_0x128c('0x9'),auth[_0x128c('0x8')](),interaction[_0x128c('0x11')](_0x128c('0x12'),_0x128c('0x17')),controller[_0x128c('0x18')]);router[_0x128c('0x16')](_0x128c('0x10'),auth[_0x128c('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8ae99ad..d3e48c9 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 _0x7c8e=['BOOLEAN','ENUM','out','DATE','exports','TEXT','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x2c6c27,_0x583885){_0x2c6c27=_0x2c6c27-0x0;var _0x4bf010=_0x7c8e[_0x2c6c27];return _0x4bf010;};'use strict';var Sequelize=require('sequelize');module[_0xe7c8('0x0')]={'body':{'type':Sequelize[_0xe7c8('0x1')](_0xe7c8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe7c8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe7c8('0x4')]('in',_0xe7c8('0x5')),'defaultValue':_0xe7c8('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe7c8('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe7c8('0x6')]}}; \ No newline at end of file +var _0x402f=['DATE','sequelize','TEXT','ENUM','out'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x402f,0x6f));var _0xf402=function(_0x5d7eb4,_0x3d7093){_0x5d7eb4=_0x5d7eb4-0x0;var _0x35a2fd=_0x402f[_0x5d7eb4];return _0x35a2fd;};'use strict';var Sequelize=require(_0xf402('0x0'));module['exports']={'body':{'type':Sequelize[_0xf402('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf402('0x2')]('in',_0xf402('0x3')),'defaultValue':_0xf402('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xf402('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e70b6d0..0bbd8cb 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 _0xec4e=['show','params','length','find','body','describe','read','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','fullname','email','manual','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','info','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','QueryTypes','User','internal','SIP/%s','create','findOne','fax','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','join','server','files','download','basename','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./faxMessage.socket','register','http','client','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','FaxMessage','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec4e,0xc6));var _0xeec4=function(_0x26dd5,_0x27b03f){_0x26dd5=_0x26dd5-0x0;var _0x47efc1=_0xec4e[_0x26dd5];return _0x47efc1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeec4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeec4('0x1'));var rp=require(_0xeec4('0x2'));var moment=require('moment');var BPromise=require(_0xeec4('0x3'));var Mustache=require(_0xeec4('0x4'));var util=require(_0xeec4('0x5'));var path=require(_0xeec4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeec4('0x7'));var fs=require('fs');var fs_extra=require(_0xeec4('0x8'));var _=require(_0xeec4('0x9'));var squel=require(_0xeec4('0xa'));var crypto=require('crypto');var jsforce=require(_0xeec4('0xb'));var deskjs=require(_0xeec4('0xc'));var toCsv=require(_0xeec4('0xd'));var querystring=require(_0xeec4('0xe'));var Papa=require('papaparse');var Redis=require(_0xeec4('0xf'));var authService=require(_0xeec4('0x10'));var qs=require(_0xeec4('0x11'));var as=require(_0xeec4('0x12'));var hardwareService=require(_0xeec4('0x13'));var logger=require(_0xeec4('0x14'))('api');var utils=require(_0xeec4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeec4('0x16'));var db=require('../../mysqldb')['db'];config[_0xeec4('0x17')]=_[_0xeec4('0x18')](config[_0xeec4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xeec4('0x19'))(new Redis(config[_0xeec4('0x17')]));require(_0xeec4('0x1a'))[_0xeec4('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xeec4('0x1c')]({'port':0x232c});var client9002=jayson[_0xeec4('0x1d')][_0xeec4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xd1f609,_0x2be529,_0x5739a6,_0x34e484){return new BPromise(function(_0x75534c,_0x252444){var _0x3f4257=_0x34e484||client;return _0x3f4257['request'](_0xd1f609,_0x5739a6)['then'](function(_0x4dc373){logger['info'](_0xeec4('0x1e'),_0x2be529,_0xeec4('0x1f'));logger[_0xeec4('0x20')](_0xeec4('0x21'),_0x2be529,_0xeec4('0x1f'),JSON['stringify'](_0x4dc373));if(_0x4dc373[_0xeec4('0x22')]){if(_0x4dc373[_0xeec4('0x22')]['code']===0x1f4){logger[_0xeec4('0x22')](_0xeec4('0x1e'),_0x2be529,_0x4dc373[_0xeec4('0x22')]['message']);return _0x252444(_0x4dc373['error']['message']);}logger[_0xeec4('0x22')]('FaxMessage,\x20%s,\x20%s',_0x2be529,_0x4dc373[_0xeec4('0x22')]['message']);return _0x75534c(_0x4dc373[_0xeec4('0x22')][_0xeec4('0x23')]);}else{logger['info'](_0xeec4('0x1e'),_0x2be529,'request\x20sent');_0x75534c(_0x4dc373[_0xeec4('0x24')][_0xeec4('0x23')]);}})['catch'](function(_0x40fee5){logger[_0xeec4('0x22')](_0xeec4('0x1e'),_0x2be529,_0x40fee5);_0x252444(_0x40fee5);});});}function respondWithStatusCode(_0x5e9733,_0x190f77){_0x190f77=_0x190f77||0xcc;return function(_0x33e4bd){if(_0x33e4bd){return _0x5e9733[_0xeec4('0x25')](_0x190f77);}return _0x5e9733[_0xeec4('0x26')](_0x190f77)['end']();};}function respondWithResult(_0x4b76d2,_0x4d9103){_0x4d9103=_0x4d9103||0xc8;return function(_0x561446){if(_0x561446){return _0x4b76d2[_0xeec4('0x26')](_0x4d9103)['json'](_0x561446);}};}function respondWithFilteredResult(_0x2fba93,_0x340cb9){return function(_0x40a52d){if(_0x40a52d){var _0xabfb6f=typeof _0x340cb9[_0xeec4('0x27')]===_0xeec4('0x28')&&typeof _0x340cb9[_0xeec4('0x29')]===_0xeec4('0x28');var _0x58b143=_0x40a52d[_0xeec4('0x2a')];var _0x2b25b1=_0xabfb6f?0x0:_0x340cb9[_0xeec4('0x27')];var _0x5f3567=_0xabfb6f?_0x40a52d[_0xeec4('0x2a')]:_0x340cb9[_0xeec4('0x27')]+_0x340cb9[_0xeec4('0x29')];var _0x15c553;if(_0x5f3567>=_0x58b143){_0x5f3567=_0x58b143;_0x15c553=0xc8;}else{_0x15c553=0xce;}_0x2fba93[_0xeec4('0x26')](_0x15c553);return _0x2fba93['set'](_0xeec4('0x2b'),_0x2b25b1+'-'+_0x5f3567+'/'+_0x58b143)[_0xeec4('0x2c')](_0x40a52d);}return null;};}function patchUpdates(_0x494a40){return function(_0x7da8d4){try{jsonpatch[_0xeec4('0x2d')](_0x7da8d4,_0x494a40,!![]);}catch(_0x10e837){return BPromise['reject'](_0x10e837);}return _0x7da8d4[_0xeec4('0x2e')]();};}function saveUpdates(_0x34eda1,_0x4b32dc){return function(_0x3ed5a4){if(_0x3ed5a4){return _0x3ed5a4[_0xeec4('0x2f')](_0x34eda1)[_0xeec4('0x30')](function(_0x408f80){return _0x408f80;});}return null;};}function removeEntity(_0x3bc961,_0x58676e){return function(_0x5c10ee){if(_0x5c10ee){return _0x5c10ee[_0xeec4('0x31')]()['then'](function(){_0x3bc961[_0xeec4('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47adc4,_0x6941dc){return function(_0x10fa2c){if(!_0x10fa2c){_0x47adc4['sendStatus'](0x194);}return _0x10fa2c;};}function handleError(_0x5b24ce,_0x26261c){_0x26261c=_0x26261c||0x1f4;return function(_0x5e2087){logger['error'](_0x5e2087[_0xeec4('0x32')]);if(_0x5e2087[_0xeec4('0x33')]){delete _0x5e2087[_0xeec4('0x33')];}_0x5b24ce[_0xeec4('0x26')](_0x26261c)[_0xeec4('0x34')](_0x5e2087);};}exports[_0xeec4('0x35')]=function(_0x6c4471,_0x850e2f){var _0x476dbc={},_0x12d4ac={},_0x5528f9={'count':0x0,'rows':[]};var _0x518627=_['map'](db[_0xeec4('0x36')][_0xeec4('0x37')],function(_0x446b31){return{'name':_0x446b31[_0xeec4('0x38')],'type':_0x446b31['type'][_0xeec4('0x39')]};});_0x12d4ac[_0xeec4('0x3a')]=_[_0xeec4('0x3b')](_0x518627,_0xeec4('0x33'));_0x12d4ac[_0xeec4('0x3c')]=_[_0xeec4('0x3d')](_0x6c4471[_0xeec4('0x3c')]);_0x12d4ac['filters']=_['intersection'](_0x12d4ac[_0xeec4('0x3a')],_0x12d4ac[_0xeec4('0x3c')]);_0x476dbc[_0xeec4('0x3e')]=_[_0xeec4('0x3f')](_0x12d4ac[_0xeec4('0x3a')],qs[_0xeec4('0x40')](_0x6c4471['query'][_0xeec4('0x40')]));_0x476dbc['attributes']=_0x476dbc[_0xeec4('0x3e')]['length']?_0x476dbc[_0xeec4('0x3e')]:_0x12d4ac[_0xeec4('0x3a')];if(!_0x6c4471['query'][_0xeec4('0x41')](_0xeec4('0x42'))){_0x476dbc['limit']=qs[_0xeec4('0x29')](_0x6c4471[_0xeec4('0x3c')][_0xeec4('0x29')]);_0x476dbc[_0xeec4('0x27')]=qs[_0xeec4('0x27')](_0x6c4471[_0xeec4('0x3c')][_0xeec4('0x27')]);}_0x476dbc[_0xeec4('0x43')]=qs[_0xeec4('0x44')](_0x6c4471[_0xeec4('0x3c')]['sort']);_0x476dbc[_0xeec4('0x45')]=qs[_0xeec4('0x46')](_[_0xeec4('0x47')](_0x6c4471['query'],_0x12d4ac[_0xeec4('0x46')]),_0x518627);if(_0x6c4471[_0xeec4('0x3c')][_0xeec4('0x48')]){_0x476dbc['where']=_[_0xeec4('0x49')](_0x476dbc[_0xeec4('0x45')],{'$or':_[_0xeec4('0x3b')](_0x518627,function(_0x4a3122){if(_0x4a3122[_0xeec4('0x4a')]!=='VIRTUAL'){var _0x4aaf5c={};_0x4aaf5c[_0x4a3122[_0xeec4('0x33')]]={'$like':'%'+_0x6c4471[_0xeec4('0x3c')][_0xeec4('0x48')]+'%'};return _0x4aaf5c;}})});}_0x476dbc=_[_0xeec4('0x49')]({},_0x476dbc,_0x6c4471[_0xeec4('0x4b')]);var _0x79892b={'where':_0x476dbc[_0xeec4('0x45')]};return db[_0xeec4('0x36')]['count'](_0x79892b)[_0xeec4('0x30')](function(_0x59c1ad){_0x5528f9[_0xeec4('0x2a')]=_0x59c1ad;if(_0x6c4471[_0xeec4('0x3c')][_0xeec4('0x4c')]){_0x476dbc[_0xeec4('0x4d')]=[{'all':!![]}];}return db[_0xeec4('0x36')]['findAll'](_0x476dbc);})[_0xeec4('0x30')](function(_0x2e8278){_0x5528f9[_0xeec4('0x4e')]=_0x2e8278;return _0x5528f9;})[_0xeec4('0x30')](respondWithFilteredResult(_0x850e2f,_0x476dbc))[_0xeec4('0x4f')](handleError(_0x850e2f,null));};exports[_0xeec4('0x50')]=function(_0x40d15a,_0x4cc16b){var _0xeb06bd={'raw':!![],'where':{'id':_0x40d15a[_0xeec4('0x51')]['id']}},_0x17e4e8={};_0x17e4e8['model']=_['keys'](db[_0xeec4('0x36')][_0xeec4('0x37')]);_0x17e4e8['query']=_[_0xeec4('0x3d')](_0x40d15a[_0xeec4('0x3c')]);_0x17e4e8[_0xeec4('0x46')]=_[_0xeec4('0x3f')](_0x17e4e8['model'],_0x17e4e8[_0xeec4('0x3c')]);_0xeb06bd[_0xeec4('0x3e')]=_['intersection'](_0x17e4e8['model'],qs[_0xeec4('0x40')](_0x40d15a[_0xeec4('0x3c')]['fields']));_0xeb06bd[_0xeec4('0x3e')]=_0xeb06bd[_0xeec4('0x3e')][_0xeec4('0x52')]?_0xeb06bd['attributes']:_0x17e4e8[_0xeec4('0x3a')];if(_0x40d15a['query']['includeAll']){_0xeb06bd[_0xeec4('0x4d')]=[{'all':!![]}];}_0xeb06bd=_[_0xeec4('0x49')]({},_0xeb06bd,_0x40d15a[_0xeec4('0x4b')]);return db[_0xeec4('0x36')][_0xeec4('0x53')](_0xeb06bd)[_0xeec4('0x30')](handleEntityNotFound(_0x4cc16b,null))[_0xeec4('0x30')](respondWithResult(_0x4cc16b,null))['catch'](handleError(_0x4cc16b,null));};exports[_0xeec4('0x2f')]=function(_0x3d6bbc,_0x18e114){if(_0x3d6bbc[_0xeec4('0x54')]['id']){delete _0x3d6bbc[_0xeec4('0x54')]['id'];}return db[_0xeec4('0x36')][_0xeec4('0x53')]({'where':{'id':_0x3d6bbc[_0xeec4('0x51')]['id']}})[_0xeec4('0x30')](handleEntityNotFound(_0x18e114,null))[_0xeec4('0x30')](saveUpdates(_0x3d6bbc['body'],null))[_0xeec4('0x30')](respondWithResult(_0x18e114,null))[_0xeec4('0x4f')](handleError(_0x18e114,null));};exports[_0xeec4('0x31')]=function(_0x1c20b2,_0x1f899c){return db['FaxMessage']['find']({'where':{'id':_0x1c20b2[_0xeec4('0x51')]['id']}})[_0xeec4('0x30')](handleEntityNotFound(_0x1f899c,null))[_0xeec4('0x30')](removeEntity(_0x1f899c,null))['catch'](handleError(_0x1f899c,null));};exports[_0xeec4('0x55')]=function(_0x3a26d6,_0x1043f2){return db[_0xeec4('0x36')][_0xeec4('0x55')]()['then'](respondWithResult(_0x1043f2,null))[_0xeec4('0x4f')](handleError(_0x1043f2,null));};var interaction_log=require(_0xeec4('0x14'))('fax-interactions');exports['accept']=function(_0x1130a0,_0x1c4bbb,_0x5c49ce){var _0x4876e0={'agent':{},'channel':'fax'};if(_0x1130a0[_0xeec4('0x54')]['id']){delete _0x1130a0[_0xeec4('0x54')]['id'];}_0x1130a0[_0xeec4('0x54')][_0xeec4('0x56')]=!![];_0x1130a0[_0xeec4('0x54')]['readAt']=moment()[_0xeec4('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x1130a0[_0xeec4('0x54')][_0xeec4('0x58')]=_0x1130a0['body'][_0xeec4('0x58')]||_0x1130a0[_0xeec4('0x59')]['id'];_0x4876e0[_0xeec4('0x5a')]['id']=_0x1130a0[_0xeec4('0x54')][_0xeec4('0x58')];return db[_0xeec4('0x36')]['find']({'where':{'id':_0x1130a0[_0xeec4('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c4bbb,null))['then'](saveUpdates(_0x1130a0['body'],null))[_0xeec4('0x30')](function(_0x1df779){if(_0x1df779){_0x4876e0[_0xeec4('0x23')]=_0x1df779[_0xeec4('0x5b')]({'plain':!![]});return db[_0xeec4('0x5c')]['find']({'where':{'id':_0x1df779[_0xeec4('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x1c4bbb,null))['then'](function(_0x4e2ae2){if(_0x4e2ae2){return _0x4e2ae2[_0xeec4('0x2f')]({'UserId':_0x1130a0[_0xeec4('0x54')][_0xeec4('0x58')],'read1stAt':_[_0xeec4('0x5e')](_0x4e2ae2[_0xeec4('0x5f')])?moment()[_0xeec4('0x57')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xeec4('0x30')](function(_0x2829c0){if(_0x2829c0){_0x4876e0[_0xeec4('0x60')]=_0x2829c0[_0xeec4('0x5b')]({'plain':!![]});interaction_log['info'](_0xeec4('0x61'),_0x1130a0[_0xeec4('0x59')]['id'],_0x1130a0['user'][_0xeec4('0x33')],_0x1130a0[_0xeec4('0x59')][_0xeec4('0x62')],_0x4876e0[_0xeec4('0x60')]['id'],_0x1130a0[_0xeec4('0x54')]?JSON[_0xeec4('0x63')](_0x1130a0['body']):_0xeec4('0x64'));return respondWithRpcPromise(_0xeec4('0x65'),_0xeec4('0x66'),_0x4876e0);}return null;})[_0xeec4('0x30')](function(_0x532175){var _0x3b6826=_0xeec4('0x67')+_0x532175[_0xeec4('0x23')][_0xeec4('0x68')];return db['sequelize'][_0xeec4('0x3c')](_0x3b6826,{'type':db[_0xeec4('0x69')]['QueryTypes'][_0xeec4('0x6a')],'raw':!![]})[_0xeec4('0x30')](function(_0x391a28){return _0x391a28;});})[_0xeec4('0x30')](function(_0x2a348d){if(_0x2a348d){_0x4876e0[_0xeec4('0x23')][_0xeec4('0x6b')]=_0x2a348d[0x0];if(!_0x1130a0['body'][_0xeec4('0x58')])return;return db['User'][_0xeec4('0x53')]({'where':{'id':_0x1130a0[_0xeec4('0x54')][_0xeec4('0x58')],'role':_0xeec4('0x5a')},'attributes':['id','name',_0xeec4('0x6c'),_0xeec4('0x6d'),'internal'],'raw':!![]});}return null;})[_0xeec4('0x30')](function(_0xfdc463){if(!_0xfdc463)return null;_0x4876e0[_0xeec4('0x23')][_0xeec4('0x5a')]=_0xfdc463;return _0x4876e0;})[_0xeec4('0x30')](function(_0x3a84dc){if(_0x3a84dc){if(_0x1130a0[_0xeec4('0x54')][_0xeec4('0x6e')]){_0x4876e0[_0xeec4('0x23')][_0xeec4('0x6f')]=util[_0xeec4('0x57')]('SIP/%s',_0x1130a0['user']['name']);_0x4876e0[_0xeec4('0x23')][_0xeec4('0x70')]=_0x4876e0[_0xeec4('0x70')];_0x4876e0['message'][_0xeec4('0x71')]=_0x4876e0[_0xeec4('0x70')];_0x4876e0[_0xeec4('0x23')][_0xeec4('0x72')]=_0xeec4('0x73');return respondWithRpcPromise(_0xeec4('0x74'),_0xeec4('0x74'),{'event':_0xeec4('0x75'),'message':_0x4876e0[_0xeec4('0x23')]},client9002)['then'](function(){return _0x4876e0;});}return _0x4876e0;}return null;})[_0xeec4('0x30')](respondWithResult(_0x1c4bbb,null))[_0xeec4('0x4f')](handleError(_0x1c4bbb,null));};var interaction_log=require(_0xeec4('0x14'))('fax-interactions');exports[_0xeec4('0x76')]=function(_0x15c84d,_0x2fa662,_0x25fda9){var _0x1b771f={'agent':{},'channel':'fax'};if(_0x15c84d['body']['id']){delete _0x15c84d['body']['id'];}_0x15c84d['body']['UserId']=_0x15c84d[_0xeec4('0x54')][_0xeec4('0x58')]||_0x15c84d[_0xeec4('0x59')]['id'];_0x1b771f[_0xeec4('0x5a')]['id']=_0x15c84d[_0xeec4('0x54')][_0xeec4('0x58')];return db['FaxMessage'][_0xeec4('0x53')]({'where':{'id':_0x15c84d[_0xeec4('0x51')]['id'],'UserId':null}})[_0xeec4('0x30')](handleEntityNotFound(_0x2fa662,null))[_0xeec4('0x30')](function(_0x57e049){if(_0x57e049){_0x1b771f[_0xeec4('0x23')]=_0x57e049[_0xeec4('0x5b')]({'plain':!![]});return db['FaxInteraction'][_0xeec4('0x53')]({'where':{'id':_0x57e049['FaxInteractionId']}});}return null;})[_0xeec4('0x30')](handleEntityNotFound(_0x2fa662,null))[_0xeec4('0x30')](function(_0x53ea36){if(_0x53ea36){_0x1b771f[_0xeec4('0x60')]=_0x53ea36['get']({'plain':!![]});interaction_log[_0xeec4('0x77')](_0xeec4('0x78'),_0x15c84d[_0xeec4('0x59')]['id'],_0x15c84d[_0xeec4('0x59')][_0xeec4('0x33')],_0x15c84d[_0xeec4('0x59')][_0xeec4('0x62')],_0x1b771f[_0xeec4('0x60')]['id'],_0x15c84d[_0xeec4('0x54')]?JSON[_0xeec4('0x63')](_0x15c84d[_0xeec4('0x54')]):_0xeec4('0x64'));return respondWithRpcPromise(_0xeec4('0x79'),'rejectMessage',_0x1b771f);}return null;})['then'](function(_0x2bd980){var _0xf5bfe2=_0xeec4('0x67')+_0x2bd980[_0xeec4('0x23')][_0xeec4('0x68')];return db[_0xeec4('0x7a')][_0xeec4('0x3c')](_0xf5bfe2,{'type':db[_0xeec4('0x69')][_0xeec4('0x7b')][_0xeec4('0x6a')],'raw':!![]})[_0xeec4('0x30')](function(_0x6ff882){return _0x6ff882;});})[_0xeec4('0x30')](function(_0x36e8f){if(_0x36e8f){_0x1b771f[_0xeec4('0x23')][_0xeec4('0x6b')]=_0x36e8f[0x0];if(!_0x15c84d[_0xeec4('0x54')][_0xeec4('0x58')])return;return db[_0xeec4('0x7c')]['find']({'where':{'id':_0x15c84d[_0xeec4('0x54')][_0xeec4('0x58')],'role':'agent'},'attributes':['id',_0xeec4('0x33'),_0xeec4('0x6c'),_0xeec4('0x6d'),_0xeec4('0x7d')],'raw':!![]});}return null;})[_0xeec4('0x30')](function(_0x3fbf68){if(!_0x3fbf68)return null;_0x1b771f[_0xeec4('0x23')][_0xeec4('0x5a')]=_0x3fbf68;return _0x1b771f;})['then'](function(_0x2dfd75){if(_0x2dfd75){_0x2dfd75[_0xeec4('0x23')][_0xeec4('0x6f')]=util[_0xeec4('0x57')](_0xeec4('0x7e'),_0x15c84d['user']['name']);_0x2dfd75[_0xeec4('0x23')][_0xeec4('0x70')]=_0x1b771f['channel'];_0x2dfd75['message']['motionChannel']=_0x1b771f[_0xeec4('0x70')];_0x2dfd75['message']['event']=_0xeec4('0x76');respondWithRpcPromise(_0xeec4('0x74'),_0xeec4('0x74'),{'event':'rejectmessage','message':_0x2dfd75[_0xeec4('0x23')]},client9002);return _0x1b771f;}return null;})['then'](respondWithResult(_0x2fa662,null))[_0xeec4('0x4f')](handleError(_0x2fa662,null));};exports['create']=function(_0x17ec0e,_0x2edb79){var _0xbfba46;return db[_0xeec4('0x36')][_0xeec4('0x7f')](_0x17ec0e[_0xeec4('0x54')],{})[_0xeec4('0x30')](function(_0x3e0b51){_0xbfba46=_0x3e0b51;return db['CmContact'][_0xeec4('0x80')]({'where':{'id':_0xbfba46[_0xeec4('0x68')]}});})[_0xeec4('0x30')](function(_0x130adb){if(_[_0xeec4('0x5e')](_0x130adb)){return;}else{_0xbfba46[_0xeec4('0x81')]=_0x130adb[_0xeec4('0x81')];return db[_0xeec4('0x82')][_0xeec4('0x80')]({'where':{'id':_0xbfba46[_0xeec4('0x83')]}});}})[_0xeec4('0x30')](function(_0x3df323){return respondWithRpcPromise(_0xeec4('0x84'),_0xeec4('0x84'),{'FaxAccountId':_[_0xeec4('0x5e')](_0x17ec0e['body'])?undefined:_0x17ec0e[_0xeec4('0x54')]['FaxAccountId'],'path':_[_0xeec4('0x5e')](_0x3df323)?undefined:util[_0xeec4('0x57')](_0xeec4('0x85'),_0x3df323['basename']),'fax':_['isNil'](_0xbfba46[_0xeec4('0x81')])?undefined:_0xbfba46[_0xeec4('0x81')],'AttachmentId':_0xbfba46[_0xeec4('0x83')]},client9002);})[_0xeec4('0x30')](respondWithResult(_0x2edb79,0xc9))[_0xeec4('0x4f')](handleError(_0x2edb79,null));};exports['download']=function(_0x1e9395,_0x5af54b){var _0x144da7=path[_0xeec4('0x86')](config['root'],_0xeec4('0x87'),_0xeec4('0x88'),'attachments');return db['FaxMessage'][_0xeec4('0x53')]({'where':{'id':_0x1e9395[_0xeec4('0x51')]['id']},'include':[{'model':db[_0xeec4('0x82')],'as':_0xeec4('0x82')}]})[_0xeec4('0x30')](handleEntityNotFound(_0x5af54b,null))[_0xeec4('0x30')](function(_0xfb4b88){if(_0xfb4b88){return _0x5af54b[_0xeec4('0x89')](path[_0xeec4('0x86')](_0x144da7,_0xfb4b88[_0xeec4('0x82')][_0xeec4('0x8a')]));}})[_0xeec4('0x4f')](handleError(_0x5af54b,null));}; \ No newline at end of file +var _0xcf68=['destroy','stack','send','index','map','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','catch','params','keys','rawAttributes','update','body','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','internal','manual','interface','motionChannel','channel','event','accept','EventManager','../../config/logger','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','contact','SIP/%s','rejectmessage','create','findOne','Attachment','SendFax','basename','AttachmentId','download','join','root','files','attachments','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then'];(function(_0xe45802,_0x15e87b){var _0x262162=function(_0x3519c1){while(--_0x3519c1){_0xe45802['push'](_0xe45802['shift']());}};_0x262162(++_0x15e87b);}(_0xcf68,0x171));var _0x8cf6=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xcf68[_0x279d37];return _0x530173;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cf6('0x0'));var zipdir=require(_0x8cf6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cf6('0x2'));var moment=require(_0x8cf6('0x3'));var BPromise=require(_0x8cf6('0x4'));var Mustache=require(_0x8cf6('0x5'));var util=require(_0x8cf6('0x6'));var path=require(_0x8cf6('0x7'));var sox=require(_0x8cf6('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(_0x8cf6('0x9'));var crypto=require(_0x8cf6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8cf6('0xb'));var toCsv=require(_0x8cf6('0xc'));var querystring=require(_0x8cf6('0xd'));var Papa=require(_0x8cf6('0xe'));var Redis=require(_0x8cf6('0xf'));var authService=require(_0x8cf6('0x10'));var qs=require(_0x8cf6('0x11'));var as=require(_0x8cf6('0x12'));var hardwareService=require(_0x8cf6('0x13'));var logger=require('../../config/logger')(_0x8cf6('0x14'));var utils=require('../../config/utils');var config=require(_0x8cf6('0x15'));var licenseUtil=require(_0x8cf6('0x16'));var db=require(_0x8cf6('0x17'))['db'];config[_0x8cf6('0x18')]=_[_0x8cf6('0x19')](config[_0x8cf6('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cf6('0x18')]));require(_0x8cf6('0x1a'))[_0x8cf6('0x1b')](socket);var jayson=require(_0x8cf6('0x1c'));var client=jayson[_0x8cf6('0x1d')][_0x8cf6('0x1e')]({'port':0x232c});var client9002=jayson[_0x8cf6('0x1d')][_0x8cf6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc07267,_0x597013,_0xe91540,_0x13c551){return new BPromise(function(_0x40f148,_0x2d4edf){var _0x45fb93=_0x13c551||client;return _0x45fb93[_0x8cf6('0x1f')](_0xc07267,_0xe91540)['then'](function(_0x2ecbd7){logger[_0x8cf6('0x20')](_0x8cf6('0x21'),_0x597013,_0x8cf6('0x22'));logger[_0x8cf6('0x23')](_0x8cf6('0x24'),_0x597013,'request\x20sent',JSON[_0x8cf6('0x25')](_0x2ecbd7));if(_0x2ecbd7[_0x8cf6('0x26')]){if(_0x2ecbd7['error'][_0x8cf6('0x27')]===0x1f4){logger[_0x8cf6('0x26')]('FaxMessage,\x20%s,\x20%s',_0x597013,_0x2ecbd7[_0x8cf6('0x26')][_0x8cf6('0x28')]);return _0x2d4edf(_0x2ecbd7[_0x8cf6('0x26')][_0x8cf6('0x28')]);}logger[_0x8cf6('0x26')](_0x8cf6('0x21'),_0x597013,_0x2ecbd7[_0x8cf6('0x26')][_0x8cf6('0x28')]);return _0x40f148(_0x2ecbd7[_0x8cf6('0x26')][_0x8cf6('0x28')]);}else{logger[_0x8cf6('0x20')](_0x8cf6('0x21'),_0x597013,_0x8cf6('0x22'));_0x40f148(_0x2ecbd7[_0x8cf6('0x29')]['message']);}})['catch'](function(_0x40ea77){logger[_0x8cf6('0x26')](_0x8cf6('0x21'),_0x597013,_0x40ea77);_0x2d4edf(_0x40ea77);});});}function respondWithStatusCode(_0x52ab10,_0x5a8896){_0x5a8896=_0x5a8896||0xcc;return function(_0x1f7470){if(_0x1f7470){return _0x52ab10[_0x8cf6('0x2a')](_0x5a8896);}return _0x52ab10[_0x8cf6('0x2b')](_0x5a8896)[_0x8cf6('0x2c')]();};}function respondWithResult(_0x4d83ec,_0x680301){_0x680301=_0x680301||0xc8;return function(_0x323d7b){if(_0x323d7b){return _0x4d83ec['status'](_0x680301)[_0x8cf6('0x2d')](_0x323d7b);}};}function respondWithFilteredResult(_0x20cb3b,_0x202894){return function(_0x48171b){if(_0x48171b){var _0x203fb0=typeof _0x202894[_0x8cf6('0x2e')]===_0x8cf6('0x2f')&&typeof _0x202894[_0x8cf6('0x30')]===_0x8cf6('0x2f');var _0x1cc681=_0x48171b[_0x8cf6('0x31')];var _0x12f4c9=_0x203fb0?0x0:_0x202894[_0x8cf6('0x2e')];var _0x59e11b=_0x203fb0?_0x48171b[_0x8cf6('0x31')]:_0x202894[_0x8cf6('0x2e')]+_0x202894[_0x8cf6('0x30')];var _0x221e80;if(_0x59e11b>=_0x1cc681){_0x59e11b=_0x1cc681;_0x221e80=0xc8;}else{_0x221e80=0xce;}_0x20cb3b[_0x8cf6('0x2b')](_0x221e80);return _0x20cb3b['set']('Content-Range',_0x12f4c9+'-'+_0x59e11b+'/'+_0x1cc681)[_0x8cf6('0x2d')](_0x48171b);}return null;};}function patchUpdates(_0x2cc60f){return function(_0xc0e967){try{jsonpatch[_0x8cf6('0x32')](_0xc0e967,_0x2cc60f,!![]);}catch(_0x2d38ef){return BPromise[_0x8cf6('0x33')](_0x2d38ef);}return _0xc0e967[_0x8cf6('0x34')]();};}function saveUpdates(_0x3c28d3,_0x1a7f97){return function(_0x3f4016){if(_0x3f4016){return _0x3f4016['update'](_0x3c28d3)[_0x8cf6('0x35')](function(_0x160039){return _0x160039;});}return null;};}function removeEntity(_0x3f78e1,_0x5f2691){return function(_0x1b072c){if(_0x1b072c){return _0x1b072c[_0x8cf6('0x36')]()[_0x8cf6('0x35')](function(){_0x3f78e1[_0x8cf6('0x2b')](0xcc)[_0x8cf6('0x2c')]();});}};}function handleEntityNotFound(_0x2de273,_0x244802){return function(_0x4c1a3c){if(!_0x4c1a3c){_0x2de273['sendStatus'](0x194);}return _0x4c1a3c;};}function handleError(_0x1674ab,_0x54c804){_0x54c804=_0x54c804||0x1f4;return function(_0x35daf4){logger[_0x8cf6('0x26')](_0x35daf4[_0x8cf6('0x37')]);if(_0x35daf4['name']){delete _0x35daf4['name'];}_0x1674ab['status'](_0x54c804)[_0x8cf6('0x38')](_0x35daf4);};}exports[_0x8cf6('0x39')]=function(_0x39297e,_0x3f3842){var _0x5a4dbd={},_0x3845fc={},_0x39d9fe={'count':0x0,'rows':[]};var _0x2e70d9=_[_0x8cf6('0x3a')](db['FaxMessage']['rawAttributes'],function(_0x414a5a){return{'name':_0x414a5a[_0x8cf6('0x3b')],'type':_0x414a5a[_0x8cf6('0x3c')]['key']};});_0x3845fc[_0x8cf6('0x3d')]=_['map'](_0x2e70d9,_0x8cf6('0x3e'));_0x3845fc[_0x8cf6('0x3f')]=_['keys'](_0x39297e[_0x8cf6('0x3f')]);_0x3845fc[_0x8cf6('0x40')]=_[_0x8cf6('0x41')](_0x3845fc[_0x8cf6('0x3d')],_0x3845fc[_0x8cf6('0x3f')]);_0x5a4dbd[_0x8cf6('0x42')]=_[_0x8cf6('0x41')](_0x3845fc[_0x8cf6('0x3d')],qs[_0x8cf6('0x43')](_0x39297e['query'][_0x8cf6('0x43')]));_0x5a4dbd[_0x8cf6('0x42')]=_0x5a4dbd[_0x8cf6('0x42')][_0x8cf6('0x44')]?_0x5a4dbd['attributes']:_0x3845fc[_0x8cf6('0x3d')];if(!_0x39297e[_0x8cf6('0x3f')][_0x8cf6('0x45')](_0x8cf6('0x46'))){_0x5a4dbd[_0x8cf6('0x30')]=qs[_0x8cf6('0x30')](_0x39297e['query']['limit']);_0x5a4dbd[_0x8cf6('0x2e')]=qs[_0x8cf6('0x2e')](_0x39297e[_0x8cf6('0x3f')][_0x8cf6('0x2e')]);}_0x5a4dbd['order']=qs[_0x8cf6('0x47')](_0x39297e[_0x8cf6('0x3f')][_0x8cf6('0x47')]);_0x5a4dbd[_0x8cf6('0x48')]=qs[_0x8cf6('0x40')](_[_0x8cf6('0x49')](_0x39297e[_0x8cf6('0x3f')],_0x3845fc[_0x8cf6('0x40')]),_0x2e70d9);if(_0x39297e[_0x8cf6('0x3f')][_0x8cf6('0x4a')]){_0x5a4dbd[_0x8cf6('0x48')]=_[_0x8cf6('0x4b')](_0x5a4dbd[_0x8cf6('0x48')],{'$or':_['map'](_0x2e70d9,function(_0x2fdc7f){if(_0x2fdc7f['type']!==_0x8cf6('0x4c')){var _0x452916={};_0x452916[_0x2fdc7f['name']]={'$like':'%'+_0x39297e[_0x8cf6('0x3f')][_0x8cf6('0x4a')]+'%'};return _0x452916;}})});}_0x5a4dbd=_[_0x8cf6('0x4b')]({},_0x5a4dbd,_0x39297e[_0x8cf6('0x4d')]);var _0x389624={'where':_0x5a4dbd['where']};return db[_0x8cf6('0x4e')]['count'](_0x389624)[_0x8cf6('0x35')](function(_0x37b598){_0x39d9fe[_0x8cf6('0x31')]=_0x37b598;if(_0x39297e[_0x8cf6('0x3f')][_0x8cf6('0x4f')]){_0x5a4dbd[_0x8cf6('0x50')]=[{'all':!![]}];}return db[_0x8cf6('0x4e')][_0x8cf6('0x51')](_0x5a4dbd);})[_0x8cf6('0x35')](function(_0x1bdf59){_0x39d9fe['rows']=_0x1bdf59;return _0x39d9fe;})[_0x8cf6('0x35')](respondWithFilteredResult(_0x3f3842,_0x5a4dbd))[_0x8cf6('0x52')](handleError(_0x3f3842,null));};exports['show']=function(_0x133177,_0x42031a){var _0x1edfc7={'raw':!![],'where':{'id':_0x133177[_0x8cf6('0x53')]['id']}},_0x54b1dc={};_0x54b1dc[_0x8cf6('0x3d')]=_[_0x8cf6('0x54')](db[_0x8cf6('0x4e')][_0x8cf6('0x55')]);_0x54b1dc[_0x8cf6('0x3f')]=_['keys'](_0x133177[_0x8cf6('0x3f')]);_0x54b1dc[_0x8cf6('0x40')]=_[_0x8cf6('0x41')](_0x54b1dc[_0x8cf6('0x3d')],_0x54b1dc['query']);_0x1edfc7[_0x8cf6('0x42')]=_['intersection'](_0x54b1dc[_0x8cf6('0x3d')],qs[_0x8cf6('0x43')](_0x133177['query'][_0x8cf6('0x43')]));_0x1edfc7[_0x8cf6('0x42')]=_0x1edfc7[_0x8cf6('0x42')][_0x8cf6('0x44')]?_0x1edfc7[_0x8cf6('0x42')]:_0x54b1dc[_0x8cf6('0x3d')];if(_0x133177[_0x8cf6('0x3f')][_0x8cf6('0x4f')]){_0x1edfc7[_0x8cf6('0x50')]=[{'all':!![]}];}_0x1edfc7=_[_0x8cf6('0x4b')]({},_0x1edfc7,_0x133177[_0x8cf6('0x4d')]);return db[_0x8cf6('0x4e')]['find'](_0x1edfc7)[_0x8cf6('0x35')](handleEntityNotFound(_0x42031a,null))[_0x8cf6('0x35')](respondWithResult(_0x42031a,null))['catch'](handleError(_0x42031a,null));};exports[_0x8cf6('0x56')]=function(_0x1f1793,_0x2af8ac){if(_0x1f1793['body']['id']){delete _0x1f1793[_0x8cf6('0x57')]['id'];}return db[_0x8cf6('0x4e')]['find']({'where':{'id':_0x1f1793['params']['id']}})[_0x8cf6('0x35')](handleEntityNotFound(_0x2af8ac,null))[_0x8cf6('0x35')](saveUpdates(_0x1f1793[_0x8cf6('0x57')],null))['then'](respondWithResult(_0x2af8ac,null))['catch'](handleError(_0x2af8ac,null));};exports[_0x8cf6('0x36')]=function(_0x49da8f,_0x3715dd){return db[_0x8cf6('0x4e')]['find']({'where':{'id':_0x49da8f[_0x8cf6('0x53')]['id']}})['then'](handleEntityNotFound(_0x3715dd,null))[_0x8cf6('0x35')](removeEntity(_0x3715dd,null))[_0x8cf6('0x52')](handleError(_0x3715dd,null));};exports[_0x8cf6('0x58')]=function(_0x5028df,_0x20e30b){return db['FaxMessage'][_0x8cf6('0x58')]()[_0x8cf6('0x35')](respondWithResult(_0x20e30b,null))[_0x8cf6('0x52')](handleError(_0x20e30b,null));};var interaction_log=require('../../config/logger')(_0x8cf6('0x59'));exports['accept']=function(_0xdbe7f6,_0x4502f9,_0x1e4e87){var _0x369bf4={'agent':{},'channel':'fax'};if(_0xdbe7f6['body']['id']){delete _0xdbe7f6[_0x8cf6('0x57')]['id'];}_0xdbe7f6[_0x8cf6('0x57')][_0x8cf6('0x5a')]=!![];_0xdbe7f6[_0x8cf6('0x57')][_0x8cf6('0x5b')]=moment()[_0x8cf6('0x5c')](_0x8cf6('0x5d'));_0xdbe7f6['body'][_0x8cf6('0x5e')]=_0xdbe7f6[_0x8cf6('0x57')]['UserId']||_0xdbe7f6[_0x8cf6('0x5f')]['id'];_0x369bf4['agent']['id']=_0xdbe7f6[_0x8cf6('0x57')][_0x8cf6('0x5e')];return db[_0x8cf6('0x4e')][_0x8cf6('0x60')]({'where':{'id':_0xdbe7f6[_0x8cf6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4502f9,null))[_0x8cf6('0x35')](saveUpdates(_0xdbe7f6[_0x8cf6('0x57')],null))['then'](function(_0x35d54b){if(_0x35d54b){_0x369bf4[_0x8cf6('0x28')]=_0x35d54b[_0x8cf6('0x61')]({'plain':!![]});return db[_0x8cf6('0x62')]['find']({'where':{'id':_0x35d54b[_0x8cf6('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4502f9,null))[_0x8cf6('0x35')](function(_0x15c978){if(_0x15c978){return _0x15c978[_0x8cf6('0x56')]({'UserId':_0xdbe7f6[_0x8cf6('0x57')][_0x8cf6('0x5e')],'read1stAt':_[_0x8cf6('0x64')](_0x15c978[_0x8cf6('0x65')])?moment()['format'](_0x8cf6('0x5d')):undefined});}return null;})['then'](function(_0x479265){if(_0x479265){_0x369bf4[_0x8cf6('0x66')]=_0x479265[_0x8cf6('0x61')]({'plain':!![]});interaction_log[_0x8cf6('0x20')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xdbe7f6[_0x8cf6('0x5f')]['id'],_0xdbe7f6[_0x8cf6('0x5f')][_0x8cf6('0x3e')],_0xdbe7f6['user']['role'],_0x369bf4[_0x8cf6('0x66')]['id'],_0xdbe7f6[_0x8cf6('0x57')]?JSON[_0x8cf6('0x25')](_0xdbe7f6[_0x8cf6('0x57')]):_0x8cf6('0x67'));return respondWithRpcPromise(_0x8cf6('0x68'),_0x8cf6('0x69'),_0x369bf4);}return null;})[_0x8cf6('0x35')](function(_0x2070e0){var _0x17e334=_0x8cf6('0x6a')+_0x2070e0[_0x8cf6('0x28')][_0x8cf6('0x6b')];return db[_0x8cf6('0x6c')][_0x8cf6('0x3f')](_0x17e334,{'type':db[_0x8cf6('0x6d')][_0x8cf6('0x6e')][_0x8cf6('0x6f')],'raw':!![]})[_0x8cf6('0x35')](function(_0xa25ba6){return _0xa25ba6;});})['then'](function(_0xd52649){if(_0xd52649){_0x369bf4[_0x8cf6('0x28')]['contact']=_0xd52649[0x0];if(!_0xdbe7f6[_0x8cf6('0x57')][_0x8cf6('0x5e')])return;return db[_0x8cf6('0x70')][_0x8cf6('0x60')]({'where':{'id':_0xdbe7f6[_0x8cf6('0x57')]['UserId'],'role':_0x8cf6('0x71')},'attributes':['id',_0x8cf6('0x3e'),_0x8cf6('0x72'),'email',_0x8cf6('0x73')],'raw':!![]});}return null;})['then'](function(_0x1c186e){if(!_0x1c186e)return null;_0x369bf4[_0x8cf6('0x28')]['agent']=_0x1c186e;return _0x369bf4;})[_0x8cf6('0x35')](function(_0x20e166){if(_0x20e166){if(_0xdbe7f6[_0x8cf6('0x57')][_0x8cf6('0x74')]){_0x369bf4[_0x8cf6('0x28')][_0x8cf6('0x75')]=util['format']('SIP/%s',_0xdbe7f6[_0x8cf6('0x5f')]['name']);_0x369bf4[_0x8cf6('0x28')]['channel']=_0x369bf4['channel'];_0x369bf4[_0x8cf6('0x28')][_0x8cf6('0x76')]=_0x369bf4[_0x8cf6('0x77')];_0x369bf4[_0x8cf6('0x28')][_0x8cf6('0x78')]=_0x8cf6('0x79');return respondWithRpcPromise(_0x8cf6('0x7a'),_0x8cf6('0x7a'),{'event':'acceptmessage','message':_0x369bf4[_0x8cf6('0x28')]},client9002)[_0x8cf6('0x35')](function(){return _0x369bf4;});}return _0x369bf4;}return null;})[_0x8cf6('0x35')](respondWithResult(_0x4502f9,null))['catch'](handleError(_0x4502f9,null));};var interaction_log=require(_0x8cf6('0x7b'))(_0x8cf6('0x59'));exports['reject']=function(_0x25c893,_0x49fd23,_0xc6fdb3){var _0x556c36={'agent':{},'channel':_0x8cf6('0x7c')};if(_0x25c893[_0x8cf6('0x57')]['id']){delete _0x25c893[_0x8cf6('0x57')]['id'];}_0x25c893[_0x8cf6('0x57')][_0x8cf6('0x5e')]=_0x25c893[_0x8cf6('0x57')][_0x8cf6('0x5e')]||_0x25c893[_0x8cf6('0x5f')]['id'];_0x556c36['agent']['id']=_0x25c893[_0x8cf6('0x57')][_0x8cf6('0x5e')];return db[_0x8cf6('0x4e')][_0x8cf6('0x60')]({'where':{'id':_0x25c893['params']['id'],'UserId':null}})[_0x8cf6('0x35')](handleEntityNotFound(_0x49fd23,null))[_0x8cf6('0x35')](function(_0x274c86){if(_0x274c86){_0x556c36['message']=_0x274c86[_0x8cf6('0x61')]({'plain':!![]});return db[_0x8cf6('0x62')][_0x8cf6('0x60')]({'where':{'id':_0x274c86[_0x8cf6('0x63')]}});}return null;})[_0x8cf6('0x35')](handleEntityNotFound(_0x49fd23,null))[_0x8cf6('0x35')](function(_0x5c976d){if(_0x5c976d){_0x556c36[_0x8cf6('0x66')]=_0x5c976d[_0x8cf6('0x61')]({'plain':!![]});interaction_log[_0x8cf6('0x20')](_0x8cf6('0x7d'),_0x25c893[_0x8cf6('0x5f')]['id'],_0x25c893['user'][_0x8cf6('0x3e')],_0x25c893['user'][_0x8cf6('0x7e')],_0x556c36[_0x8cf6('0x66')]['id'],_0x25c893['body']?JSON[_0x8cf6('0x25')](_0x25c893[_0x8cf6('0x57')]):_0x8cf6('0x67'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x556c36);}return null;})[_0x8cf6('0x35')](function(_0xdc3ffb){var _0x8bff39=_0x8cf6('0x6a')+_0xdc3ffb[_0x8cf6('0x28')]['ContactId'];return db[_0x8cf6('0x6c')][_0x8cf6('0x3f')](_0x8bff39,{'type':db['Sequelize'][_0x8cf6('0x6e')][_0x8cf6('0x6f')],'raw':!![]})[_0x8cf6('0x35')](function(_0x4597c0){return _0x4597c0;});})[_0x8cf6('0x35')](function(_0x151139){if(_0x151139){_0x556c36[_0x8cf6('0x28')][_0x8cf6('0x7f')]=_0x151139[0x0];if(!_0x25c893[_0x8cf6('0x57')]['UserId'])return;return db[_0x8cf6('0x70')]['find']({'where':{'id':_0x25c893[_0x8cf6('0x57')][_0x8cf6('0x5e')],'role':_0x8cf6('0x71')},'attributes':['id',_0x8cf6('0x3e'),_0x8cf6('0x72'),'email',_0x8cf6('0x73')],'raw':!![]});}return null;})[_0x8cf6('0x35')](function(_0xf1eed5){if(!_0xf1eed5)return null;_0x556c36[_0x8cf6('0x28')][_0x8cf6('0x71')]=_0xf1eed5;return _0x556c36;})[_0x8cf6('0x35')](function(_0x23774d){if(_0x23774d){_0x23774d[_0x8cf6('0x28')]['interface']=util[_0x8cf6('0x5c')](_0x8cf6('0x80'),_0x25c893['user']['name']);_0x23774d['message'][_0x8cf6('0x77')]=_0x556c36[_0x8cf6('0x77')];_0x23774d['message'][_0x8cf6('0x76')]=_0x556c36['channel'];_0x23774d[_0x8cf6('0x28')][_0x8cf6('0x78')]='reject';respondWithRpcPromise(_0x8cf6('0x7a'),_0x8cf6('0x7a'),{'event':_0x8cf6('0x81'),'message':_0x23774d[_0x8cf6('0x28')]},client9002);return _0x556c36;}return null;})[_0x8cf6('0x35')](respondWithResult(_0x49fd23,null))[_0x8cf6('0x52')](handleError(_0x49fd23,null));};exports[_0x8cf6('0x82')]=function(_0x4c7dba,_0x2b87b2){var _0x2f52bd;return db[_0x8cf6('0x4e')][_0x8cf6('0x82')](_0x4c7dba[_0x8cf6('0x57')],{})[_0x8cf6('0x35')](function(_0x203369){_0x2f52bd=_0x203369;return db['CmContact'][_0x8cf6('0x83')]({'where':{'id':_0x2f52bd[_0x8cf6('0x6b')]}});})['then'](function(_0x2e774e){if(_[_0x8cf6('0x64')](_0x2e774e)){return;}else{_0x2f52bd[_0x8cf6('0x7c')]=_0x2e774e['fax'];return db[_0x8cf6('0x84')][_0x8cf6('0x83')]({'where':{'id':_0x2f52bd['AttachmentId']}});}})[_0x8cf6('0x35')](function(_0x4fca67){return respondWithRpcPromise(_0x8cf6('0x85'),_0x8cf6('0x85'),{'FaxAccountId':_[_0x8cf6('0x64')](_0x4c7dba['body'])?undefined:_0x4c7dba[_0x8cf6('0x57')]['FaxAccountId'],'path':_['isNil'](_0x4fca67)?undefined:util[_0x8cf6('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x4fca67[_0x8cf6('0x86')]),'fax':_[_0x8cf6('0x64')](_0x2f52bd[_0x8cf6('0x7c')])?undefined:_0x2f52bd[_0x8cf6('0x7c')],'AttachmentId':_0x2f52bd[_0x8cf6('0x87')]},client9002);})[_0x8cf6('0x35')](respondWithResult(_0x2b87b2,0xc9))[_0x8cf6('0x52')](handleError(_0x2b87b2,null));};exports[_0x8cf6('0x88')]=function(_0x5f2f93,_0xfad604){var _0x154318=path[_0x8cf6('0x89')](config[_0x8cf6('0x8a')],'server',_0x8cf6('0x8b'),_0x8cf6('0x8c'));return db[_0x8cf6('0x4e')][_0x8cf6('0x60')]({'where':{'id':_0x5f2f93['params']['id']},'include':[{'model':db[_0x8cf6('0x84')],'as':'Attachment'}]})[_0x8cf6('0x35')](handleEntityNotFound(_0xfad604,null))[_0x8cf6('0x35')](function(_0x53025d){if(_0x53025d){return _0xfad604[_0x8cf6('0x88')](path['join'](_0x154318,_0x53025d[_0x8cf6('0x84')][_0x8cf6('0x86')]));}})[_0x8cf6('0x52')](handleError(_0xfad604,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 859f53d..242ebdf 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 _0x9aac=['hook','events','FaxMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0xbcbd76,_0x25722b){var _0x503680=function(_0x163649){while(--_0x163649){_0xbcbd76['push'](_0xbcbd76['shift']());}};_0x503680(++_0x25722b);}(_0x9aac,0x135));var _0xc9aa=function(_0xe30d11,_0x3fa953){_0xe30d11=_0xe30d11-0x0;var _0x52b314=_0x9aac[_0xe30d11];return _0x52b314;};'use strict';var EventEmitter=require(_0xc9aa('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xc9aa('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc9aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9aa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8ca086){return function(_0x5c8ce2,_0x28c49c,_0x267772){FaxMessageEvents['emit'](_0x8ca086+':'+_0x5c8ce2['id'],_0x5c8ce2);FaxMessageEvents[_0xc9aa('0x4')](_0x8ca086,_0x5c8ce2);_0x267772(null);};}for(var e in events){if(events[_0xc9aa('0x5')](e)){var event=events[e];FaxMessage[_0xc9aa('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x073d=['hook','exports','../../mysqldb','FaxMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x43cb4d,_0x37a61b){var _0x5611e0=function(_0x39bb39){while(--_0x39bb39){_0x43cb4d['push'](_0x43cb4d['shift']());}};_0x5611e0(++_0x37a61b);}(_0x073d,0xd2));var _0xd073=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0x073d[_0x269c42];return _0x4dad76;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xd073('0x0'))['db'][_0xd073('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd073('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd073('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3ad2eb){return function(_0x423dc8,_0x494f81,_0x11bd94){FaxMessageEvents[_0xd073('0x4')](_0x3ad2eb+':'+_0x423dc8['id'],_0x423dc8);FaxMessageEvents[_0xd073('0x4')](_0x3ad2eb,_0x423dc8);_0x11bd94(null);};}for(var e in events){if(events[_0xd073('0x5')](e)){var event=events[e];FaxMessage[_0xd073('0x6')](e,emitEvent(event));}}module[_0xd073('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 601756d..ae0316f 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 _0xed49=['secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','lodash','util','moment','request-promise','path','rimraf','exports','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x2606f4,_0x7b0faa){var _0x27e501=function(_0x3e7833){while(--_0x3e7833){_0x2606f4['push'](_0x2606f4['shift']());}};_0x27e501(++_0x7b0faa);}(_0xed49,0x86));var _0x9ed4=function(_0x46a662,_0xd89d56){_0x46a662=_0x46a662-0x0;var _0x3c6982=_0xed49[_0x46a662];return _0x3c6982;};'use strict';var _=require(_0x9ed4('0x0'));var util=require(_0x9ed4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9ed4('0x2'));var BPromise=require('bluebird');var rp=require(_0x9ed4('0x3'));var fs=require('fs');var path=require(_0x9ed4('0x4'));var rimraf=require(_0x9ed4('0x5'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x9ed4('0x6')]=function(_0x457ca8,_0xe8b65b){return _0x457ca8['define']('FaxMessage',attributes,{'tableName':_0x9ed4('0x7'),'paranoid':![],'indexes':[{'name':_0x9ed4('0x8'),'fields':[_0x9ed4('0x9')],'type':_0x9ed4('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x553afd,_0x33ab33,_0xf644b8){var _0x5b4208=_0x457ca8[_0x9ed4('0xb')];var _0x3c83e3=_0x553afd[_0x9ed4('0xc')]({'plain':!![]});if(_0x3c83e3[_0x9ed4('0xd')][_0x9ed4('0xe')]()==='in'||_0x3c83e3[_0x9ed4('0xd')][_0x9ed4('0xe')]()===_0x9ed4('0xf')&&!_0x3c83e3[_0x9ed4('0x10')]&&!_[_0x9ed4('0x11')](_0x3c83e3[_0x9ed4('0x12')])){_0x5b4208[_0x9ed4('0x13')][_0x9ed4('0x14')]({'where':{'id':_0x3c83e3[_0x9ed4('0x15')]}})[_0x9ed4('0x16')](function(_0x383542){if(_0x383542){_0x383542[_0x9ed4('0x17')]({'lastMsgAt':_0x3c83e3['createdAt'],'lastMsgDirection':_0x3c83e3[_0x9ed4('0xd')][_0x9ed4('0xe')]()});}})[_0x9ed4('0x18')](function(_0x1b7386){console['error'](_0x1b7386);});}_0xf644b8();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xed86=['out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x3752f1,_0x3a0654){var _0x3059aa=function(_0x1df32a){while(--_0x1df32a){_0x3752f1['push'](_0x3752f1['shift']());}};_0x3059aa(++_0x3a0654);}(_0xed86,0x11d));var _0x6ed8=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0xed86[_0x1034ca];return _0x1a023a;};'use strict';var _=require('lodash');var util=require(_0x6ed8('0x0'));var logger=require(_0x6ed8('0x1'))('api');var moment=require(_0x6ed8('0x2'));var BPromise=require(_0x6ed8('0x3'));var rp=require(_0x6ed8('0x4'));var fs=require('fs');var path=require(_0x6ed8('0x5'));var rimraf=require(_0x6ed8('0x6'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x6ed8('0x7')]=function(_0x24a93a,_0x466ade){return _0x24a93a['define']('FaxMessage',attributes,{'tableName':_0x6ed8('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x6ed8('0x9')],'type':_0x6ed8('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59265e,_0x3c2012,_0x37c239){var _0x112fea=_0x24a93a[_0x6ed8('0xb')];var _0x47477d=_0x59265e[_0x6ed8('0xc')]({'plain':!![]});if(_0x47477d[_0x6ed8('0xd')]['toLowerCase']()==='in'||_0x47477d['direction'][_0x6ed8('0xe')]()===_0x6ed8('0xf')&&!_0x47477d[_0x6ed8('0x10')]&&!_[_0x6ed8('0x11')](_0x47477d[_0x6ed8('0x12')])){_0x112fea[_0x6ed8('0x13')][_0x6ed8('0x14')]({'where':{'id':_0x47477d[_0x6ed8('0x15')]}})[_0x6ed8('0x16')](function(_0x4cbb0e){if(_0x4cbb0e){_0x4cbb0e['update']({'lastMsgAt':_0x47477d['createdAt'],'lastMsgDirection':_0x47477d[_0x6ed8('0xd')][_0x6ed8('0xe')]()});}})['catch'](function(_0x5473fc){console['error'](_0x5473fc);});}_0x37c239();}},'charset':_0x6ed8('0x17'),'collate':_0x6ed8('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a8e4ce0..44062c7 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 _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7bae,0x13b));var _0xe7ba=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7bae[_0x1ddedd];return _0xa3e1ac;};'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});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file +var _0x668b=['./faxMessage.socket','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','FaxMessage','create','body','raw','UpdateFaxMessage','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x1dd052,_0x39c5d8){var _0x4ca95b=function(_0x1b8566){while(--_0x1b8566){_0x1dd052['push'](_0x1dd052['shift']());}};_0x4ca95b(++_0x39c5d8);}(_0x668b,0x140));var _0xb668=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0x668b[_0x4404ff];return _0x5e7b19;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});config[_0xb668('0xa')]=_[_0xb668('0xb')](config[_0xb668('0xa')],{'host':_0xb668('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb668('0xa')]));require(_0xb668('0xd'))[_0xb668('0xe')](socket);function respondWithRpcPromise(_0x16d50d,_0x39b79c,_0x3606a7){return new BPromise(function(_0x45bc39,_0x3616e9){return client['request'](_0x16d50d,_0x3606a7)[_0xb668('0xf')](function(_0x27dbf7){logger[_0xb668('0x10')](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));logger[_0xb668('0x13')](_0xb668('0x14'),_0x39b79c,_0xb668('0x12'),JSON[_0xb668('0x15')](_0x27dbf7));if(_0x27dbf7[_0xb668('0x16')]){if(_0x27dbf7[_0xb668('0x16')][_0xb668('0x17')]===0x1f4){logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x3616e9(_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);}logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x45bc39(_0x27dbf7['error'][_0xb668('0x18')]);}else{logger['info'](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));_0x45bc39(_0x27dbf7['result'][_0xb668('0x18')]);}})[_0xb668('0x19')](function(_0x53ff78){logger[_0xb668('0x16')]('FaxMessage,\x20%s,\x20%s',_0x39b79c,_0x53ff78);_0x3616e9(_0x53ff78);});});}exports[_0xb668('0x1a')]=function(_0x178a5d){var _0x253ba5=this;return new Promise(function(_0x12805a,_0x5d33ae){return db[_0xb668('0x1b')][_0xb668('0x1c')](_0x178a5d[_0xb668('0x1d')],{'raw':_0x178a5d['options']?_0x178a5d['options'][_0xb668('0x1e')]===undefined?!![]:![]:!![]})[_0xb668('0xf')](function(_0x517eee){logger[_0xb668('0x10')]('CreateFaxMessage',_0x178a5d);logger[_0xb668('0x13')]('CreateFaxMessage',_0x178a5d,JSON[_0xb668('0x15')](_0x517eee));_0x12805a(_0x517eee);})[_0xb668('0x19')](function(_0x3f84c7){logger[_0xb668('0x16')](_0xb668('0x1a'),_0x3f84c7[_0xb668('0x18')],_0x178a5d);_0x5d33ae(_0x253ba5['error'](0x1f4,_0x3f84c7[_0xb668('0x18')]));});});};exports[_0xb668('0x1f')]=function(_0x2ab8c2){var _0x49abfd=this;return new Promise(function(_0x5e0cee,_0xe62fce){return db[_0xb668('0x1b')][_0xb668('0x20')](_0x2ab8c2['body'],{'raw':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab8c2['options']?_0x2ab8c2['options'][_0xb668('0x22')]||null:null,'attributes':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2['options'][_0xb668('0x23')]||null:null,'limit':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x24')]||null:null})[_0xb668('0xf')](function(_0x5f36b5){logger[_0xb668('0x10')](_0xb668('0x1f'),_0x2ab8c2);logger['debug'](_0xb668('0x1f'),_0x2ab8c2,JSON['stringify'](_0x5f36b5));_0x5e0cee(_0x5f36b5);})[_0xb668('0x19')](function(_0x406cc5){logger[_0xb668('0x16')](_0xb668('0x1f'),_0x406cc5[_0xb668('0x18')],_0x2ab8c2);_0xe62fce(_0x49abfd[_0xb668('0x16')](0x1f4,_0x406cc5[_0xb668('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ca3b2ab..b095cc6 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 _0x3a87=['faxMessage:','./faxMessage.events','remove','update','emit','removeListener','length'];(function(_0x3546ed,_0x4a7c9d){var _0x27a61a=function(_0x3d1790){while(--_0x3d1790){_0x3546ed['push'](_0x3546ed['shift']());}};_0x27a61a(++_0x4a7c9d);}(_0x3a87,0xfd));var _0x73a8=function(_0x3da72b,_0x4fd809){_0x3da72b=_0x3da72b-0x0;var _0xc64ac4=_0x3a87[_0x3da72b];return _0xc64ac4;};'use strict';var FaxMessageEvents=require(_0x73a8('0x0'));var events=['save',_0x73a8('0x1'),_0x73a8('0x2')];function createListener(_0x40376a,_0x79f8f4){return function(_0x22ce88){_0x79f8f4[_0x73a8('0x3')](_0x40376a,_0x22ce88);};}function removeListener(_0xe7167f,_0xc5505b){return function(){FaxMessageEvents[_0x73a8('0x4')](_0xe7167f,_0xc5505b);};}exports['register']=function(_0x1528ce){for(var _0x5755bd=0x0,_0x5763d8=events[_0x73a8('0x5')];_0x5755bd<_0x5763d8;_0x5755bd++){var _0x5dff7b=events[_0x5755bd];var _0x3a4f01=createListener(_0x73a8('0x6')+_0x5dff7b,_0x1528ce);FaxMessageEvents['on'](_0x5dff7b,_0x3a4f01);}}; \ No newline at end of file +var _0xd784=['removeListener','register','length','faxMessage:','save','remove','update','emit'];(function(_0x3511b8,_0x2f0387){var _0x446d16=function(_0x54c167){while(--_0x54c167){_0x3511b8['push'](_0x3511b8['shift']());}};_0x446d16(++_0x2f0387);}(_0xd784,0x15c));var _0x4d78=function(_0x5f2b26,_0x49f37d){_0x5f2b26=_0x5f2b26-0x0;var _0x107cde=_0xd784[_0x5f2b26];return _0x107cde;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x4d78('0x0'),_0x4d78('0x1'),_0x4d78('0x2')];function createListener(_0x4d66b3,_0x20f670){return function(_0xe66b7c){_0x20f670[_0x4d78('0x3')](_0x4d66b3,_0xe66b7c);};}function removeListener(_0x1f9d16,_0x2f4115){return function(){FaxMessageEvents[_0x4d78('0x4')](_0x1f9d16,_0x2f4115);};}exports[_0x4d78('0x5')]=function(_0x5e4960){for(var _0x58c127=0x0,_0x5c43a6=events[_0x4d78('0x6')];_0x58c127<_0x5c43a6;_0x58c127++){var _0x135ba2=events[_0x58c127];var _0x26ac80=createListener(_0x4d78('0x7')+_0x135ba2,_0x5e4960);FaxMessageEvents['on'](_0x135ba2,_0x26ac80);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index b926c07..c99a09a 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 _0x3140=['download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0xd440ab,_0x4cfdd5){var _0x4f707f=function(_0x16b930){while(--_0x16b930){_0xd440ab['push'](_0xd440ab['shift']());}};_0x4f707f(++_0x4cfdd5);}(_0x3140,0xaf));var _0x0314=function(_0xbc13e1,_0x14d88b){_0xbc13e1=_0xbc13e1-0x0;var _0xa87f5a=_0x3140[_0xbc13e1];return _0xa87f5a;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['describe']);router[_0x0314('0x9')](_0x0314('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0314('0x9')]('/:id/download',auth[_0x0314('0xa')](),controller[_0x0314('0xe')]);router[_0x0314('0xf')]('/',auth[_0x0314('0xa')](),interaction[_0x0314('0x10')](_0x0314('0x11'),'faxmessage:create'),controller[_0x0314('0x12')]);router[_0x0314('0x13')](_0x0314('0xd'),auth[_0x0314('0xa')](),controller[_0x0314('0x14')]);router[_0x0314('0x13')](_0x0314('0x15'),auth['isAuthenticated'](),controller[_0x0314('0x16')]);router[_0x0314('0x13')](_0x0314('0x17'),auth[_0x0314('0xa')](),controller[_0x0314('0x18')]);router[_0x0314('0x19')](_0x0314('0xd'),auth[_0x0314('0xa')](),controller['destroy']);module[_0x0314('0x1a')]=router; \ No newline at end of file +var _0xb332=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','reject','delete','destroy'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xb332,0xd9));var _0x2b33=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xb332[_0x36f47c];return _0x296c55;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./faxMessage.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x2b33('0x9')]);router['get'](_0x2b33('0xa'),auth[_0x2b33('0x7')](),controller[_0x2b33('0xb')]);router[_0x2b33('0x6')]('/:id/download',auth[_0x2b33('0x7')](),controller[_0x2b33('0xc')]);router[_0x2b33('0xd')]('/',auth[_0x2b33('0x7')](),interaction[_0x2b33('0xe')](_0x2b33('0xf'),_0x2b33('0x10')),controller[_0x2b33('0x11')]);router[_0x2b33('0x12')](_0x2b33('0xa'),auth[_0x2b33('0x7')](),controller['update']);router[_0x2b33('0x12')](_0x2b33('0x13'),auth[_0x2b33('0x7')](),controller['accept']);router[_0x2b33('0x12')]('/:id/reject',auth[_0x2b33('0x7')](),controller[_0x2b33('0x14')]);router[_0x2b33('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2b33('0x16')]);module[_0x2b33('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index cbef5ea..b9cae03 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 _0x7d5d=['ENUM','rrmemory','roundrobin','exports','STRING','INTEGER'];(function(_0x45ac0c,_0x2f8a58){var _0x4b4074=function(_0x1ddc53){while(--_0x1ddc53){_0x45ac0c['push'](_0x45ac0c['shift']());}};_0x4b4074(++_0x2f8a58);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0x162572,_0x472ee0){_0x162572=_0x162572-0x0;var _0x31efcf=_0x7d5d[_0x162572];return _0x31efcf;};'use strict';var Sequelize=require('sequelize');module[_0xd7d5('0x0')]={'name':{'type':Sequelize[_0xd7d5('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd7d5('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd7d5('0x3')](_0xd7d5('0x4'),'beepall',_0xd7d5('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd7d5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2cd9=['STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x513d80,_0x1649db){var _0x174463=function(_0x3b3dcd){while(--_0x3b3dcd){_0x513d80['push'](_0x513d80['shift']());}};_0x174463(++_0x1649db);}(_0x2cd9,0x108));var _0x92cd=function(_0x9d14d2,_0x21cec2){_0x9d14d2=_0x9d14d2-0x0;var _0x25b401=_0x2cd9[_0x9d14d2];return _0x25b401;};'use strict';var Sequelize=require(_0x92cd('0x0'));module[_0x92cd('0x1')]={'name':{'type':Sequelize[_0x92cd('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x92cd('0x2')]},'timeout':{'type':Sequelize[_0x92cd('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x92cd('0x4'),_0x92cd('0x5'),_0x92cd('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x92cd('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 41ca256..b1556a3 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 _0x8cf0=['ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','removeTeams','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','offset','limit','count','set','Content-Range','save','then','FaxQueues','UserProfileResource','error','stack','name','send','index','FaxQueue','fieldName','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','findOne','UserFaxQueue','pick','User','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','faxPause','Team','getTeams','addTeams','Agents','online','interface','flatMap','transaction','each','findOrCreate','emit','userFaxQueue:save','ids','select','field','tq.TeamId','from','user_has_teams'];(function(_0x413ddd,_0x15c4de){var _0x2d3849=function(_0x519225){while(--_0x519225){_0x413ddd['push'](_0x413ddd['shift']());}};_0x2d3849(++_0x15c4de);}(_0x8cf0,0x128));var _0x08cf=function(_0x5180c9,_0x38423e){_0x5180c9=_0x5180c9-0x0;var _0x215630=_0x8cf0[_0x5180c9];return _0x215630;};'use strict';var emlformat=require(_0x08cf('0x0'));var rimraf=require(_0x08cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08cf('0x2'));var rp=require('request-promise');var moment=require(_0x08cf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x08cf('0x4'));var util=require(_0x08cf('0x5'));var path=require('path');var sox=require(_0x08cf('0x6'));var csv=require(_0x08cf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08cf('0x8'));var _=require(_0x08cf('0x9'));var squel=require('squel');var crypto=require(_0x08cf('0xa'));var jsforce=require(_0x08cf('0xb'));var deskjs=require(_0x08cf('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x08cf('0xd'));var Redis=require(_0x08cf('0xe'));var authService=require(_0x08cf('0xf'));var qs=require(_0x08cf('0x10'));var as=require(_0x08cf('0x11'));var hardwareService=require(_0x08cf('0x12'));var logger=require(_0x08cf('0x13'))(_0x08cf('0x14'));var utils=require(_0x08cf('0x15'));var config=require(_0x08cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x08cf('0x17'))['db'];config[_0x08cf('0x18')]=_['defaults'](config[_0x08cf('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x08cf('0x19'))(new Redis(config[_0x08cf('0x18')]));require('./faxQueue.socket')[_0x08cf('0x1a')](socket);function respondWithStatusCode(_0x2be958,_0x1afbb7){_0x1afbb7=_0x1afbb7||0xcc;return function(_0x1046db){if(_0x1046db){return _0x2be958[_0x08cf('0x1b')](_0x1afbb7);}return _0x2be958[_0x08cf('0x1c')](_0x1afbb7)['end']();};}function respondWithResult(_0x2553aa,_0x3b4a77){_0x3b4a77=_0x3b4a77||0xc8;return function(_0x145cd3){if(_0x145cd3){return _0x2553aa[_0x08cf('0x1c')](_0x3b4a77)[_0x08cf('0x1d')](_0x145cd3);}};}function respondWithFilteredResult(_0x3fdc0d,_0x51c162){return function(_0x313bc6){if(_0x313bc6){var _0x100db9=typeof _0x51c162[_0x08cf('0x1e')]==='undefined'&&typeof _0x51c162[_0x08cf('0x1f')]==='undefined';var _0x24fd45=_0x313bc6['count'];var _0x1e053b=_0x100db9?0x0:_0x51c162['offset'];var _0x57e4f6=_0x100db9?_0x313bc6[_0x08cf('0x20')]:_0x51c162[_0x08cf('0x1e')]+_0x51c162[_0x08cf('0x1f')];var _0x522b71;if(_0x57e4f6>=_0x24fd45){_0x57e4f6=_0x24fd45;_0x522b71=0xc8;}else{_0x522b71=0xce;}_0x3fdc0d[_0x08cf('0x1c')](_0x522b71);return _0x3fdc0d[_0x08cf('0x21')](_0x08cf('0x22'),_0x1e053b+'-'+_0x57e4f6+'/'+_0x24fd45)['json'](_0x313bc6);}return null;};}function patchUpdates(_0xfa9626){return function(_0x3de1ef){try{jsonpatch['apply'](_0x3de1ef,_0xfa9626,!![]);}catch(_0x4c75c7){return BPromise['reject'](_0x4c75c7);}return _0x3de1ef[_0x08cf('0x23')]();};}function saveUpdates(_0x534f77,_0x20a362){return function(_0x4767b9){if(_0x4767b9){return _0x4767b9['update'](_0x534f77)[_0x08cf('0x24')](function(_0x1b0d57){return _0x1b0d57;});}return null;};}function removeEntity(_0x6b6287,_0x4a92ca){return function(_0x400c8e){if(_0x400c8e){return _0x400c8e['destroy']()['then'](function(){var _0x32ee41=_0x400c8e['get']({'plain':!![]});var _0x1e0970=_0x08cf('0x25');return db[_0x08cf('0x26')]['destroy']({'where':{'type':_0x1e0970,'resourceId':_0x32ee41['id']}})[_0x08cf('0x24')](function(){return _0x400c8e;});})['then'](function(){_0x6b6287['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf514d6,_0x4b6da4){return function(_0x6bb5bd){if(!_0x6bb5bd){_0xf514d6[_0x08cf('0x1b')](0x194);}return _0x6bb5bd;};}function handleError(_0x402ba8,_0x1c9175){_0x1c9175=_0x1c9175||0x1f4;return function(_0x1c3884){logger[_0x08cf('0x27')](_0x1c3884[_0x08cf('0x28')]);if(_0x1c3884['name']){delete _0x1c3884[_0x08cf('0x29')];}_0x402ba8[_0x08cf('0x1c')](_0x1c9175)[_0x08cf('0x2a')](_0x1c3884);};}exports[_0x08cf('0x2b')]=function(_0x5127d3,_0x578a06){var _0x300c4a={},_0x506718={},_0x13e2c4={'count':0x0,'rows':[]};var _0x3653c4=_['map'](db[_0x08cf('0x2c')]['rawAttributes'],function(_0x86cb88){return{'name':_0x86cb88[_0x08cf('0x2d')],'type':_0x86cb88['type']['key']};});_0x506718[_0x08cf('0x2e')]=_[_0x08cf('0x2f')](_0x3653c4,'name');_0x506718[_0x08cf('0x30')]=_[_0x08cf('0x31')](_0x5127d3['query']);_0x506718['filters']=_['intersection'](_0x506718[_0x08cf('0x2e')],_0x506718[_0x08cf('0x30')]);_0x300c4a[_0x08cf('0x32')]=_[_0x08cf('0x33')](_0x506718[_0x08cf('0x2e')],qs['fields'](_0x5127d3['query'][_0x08cf('0x34')]));_0x300c4a[_0x08cf('0x32')]=_0x300c4a[_0x08cf('0x32')][_0x08cf('0x35')]?_0x300c4a[_0x08cf('0x32')]:_0x506718[_0x08cf('0x2e')];if(!_0x5127d3[_0x08cf('0x30')][_0x08cf('0x36')](_0x08cf('0x37'))){_0x300c4a[_0x08cf('0x1f')]=qs['limit'](_0x5127d3['query'][_0x08cf('0x1f')]);_0x300c4a[_0x08cf('0x1e')]=qs[_0x08cf('0x1e')](_0x5127d3[_0x08cf('0x30')]['offset']);}_0x300c4a[_0x08cf('0x38')]=qs['sort'](_0x5127d3['query'][_0x08cf('0x39')]);_0x300c4a['where']=qs[_0x08cf('0x3a')](_['pick'](_0x5127d3[_0x08cf('0x30')],_0x506718[_0x08cf('0x3a')]),_0x3653c4);if(_0x5127d3[_0x08cf('0x30')][_0x08cf('0x3b')]){_0x300c4a[_0x08cf('0x3c')]=_['merge'](_0x300c4a[_0x08cf('0x3c')],{'$or':_[_0x08cf('0x2f')](_0x3653c4,function(_0x491f77){if(_0x491f77[_0x08cf('0x3d')]!==_0x08cf('0x3e')){var _0x496ecf={};_0x496ecf[_0x491f77[_0x08cf('0x29')]]={'$like':'%'+_0x5127d3[_0x08cf('0x30')]['filter']+'%'};return _0x496ecf;}})});}_0x300c4a=_['merge']({},_0x300c4a,_0x5127d3[_0x08cf('0x3f')]);var _0x2279a4={'where':_0x300c4a[_0x08cf('0x3c')]};return db[_0x08cf('0x2c')]['count'](_0x2279a4)[_0x08cf('0x24')](function(_0x31da1c){_0x13e2c4['count']=_0x31da1c;if(_0x5127d3[_0x08cf('0x30')]['includeAll']){_0x300c4a[_0x08cf('0x40')]=[{'all':!![]}];}return db[_0x08cf('0x2c')][_0x08cf('0x41')](_0x300c4a);})['then'](function(_0x3ecf93){_0x13e2c4['rows']=_0x3ecf93;return _0x13e2c4;})[_0x08cf('0x24')](respondWithFilteredResult(_0x578a06,_0x300c4a))[_0x08cf('0x42')](handleError(_0x578a06,null));};exports[_0x08cf('0x43')]=function(_0x2a698d,_0x204527){var _0xc4deed={'raw':!![],'where':{'id':_0x2a698d[_0x08cf('0x44')]['id']}},_0x1e5215={};_0x1e5215[_0x08cf('0x2e')]=_[_0x08cf('0x31')](db['FaxQueue'][_0x08cf('0x45')]);_0x1e5215[_0x08cf('0x30')]=_[_0x08cf('0x31')](_0x2a698d['query']);_0x1e5215[_0x08cf('0x3a')]=_['intersection'](_0x1e5215[_0x08cf('0x2e')],_0x1e5215[_0x08cf('0x30')]);_0xc4deed[_0x08cf('0x32')]=_[_0x08cf('0x33')](_0x1e5215['model'],qs[_0x08cf('0x34')](_0x2a698d['query'][_0x08cf('0x34')]));_0xc4deed[_0x08cf('0x32')]=_0xc4deed[_0x08cf('0x32')][_0x08cf('0x35')]?_0xc4deed['attributes']:_0x1e5215[_0x08cf('0x2e')];if(_0x2a698d['query']['includeAll']){_0xc4deed[_0x08cf('0x40')]=[{'all':!![]}];}_0xc4deed=_[_0x08cf('0x46')]({},_0xc4deed,_0x2a698d[_0x08cf('0x3f')]);return db[_0x08cf('0x2c')][_0x08cf('0x47')](_0xc4deed)[_0x08cf('0x24')](handleEntityNotFound(_0x204527,null))[_0x08cf('0x24')](respondWithResult(_0x204527,null))['catch'](handleError(_0x204527,null));};exports[_0x08cf('0x48')]=function(_0xc70705,_0x4ac50d){return db[_0x08cf('0x2c')][_0x08cf('0x48')](_0xc70705[_0x08cf('0x49')],{})[_0x08cf('0x24')](function(_0x47fee0){var _0x239c1e=_0xc70705[_0x08cf('0x4a')]['get']({'plain':!![]});if(!_0x239c1e)throw new Error(_0x08cf('0x4b'));if(_0x239c1e[_0x08cf('0x4c')]===_0x08cf('0x4a')){var _0x23dbaa=_0x47fee0[_0x08cf('0x4d')]({'plain':!![]});var _0xd792c6=_0x08cf('0x25');return db[_0x08cf('0x4e')][_0x08cf('0x47')]({'where':{'name':_0xd792c6,'userProfileId':_0x239c1e[_0x08cf('0x4f')]},'raw':!![]})[_0x08cf('0x24')](function(_0x7d0c74){if(_0x7d0c74&&_0x7d0c74[_0x08cf('0x50')]===0x0){return db['UserProfileResource'][_0x08cf('0x48')]({'name':_0x23dbaa[_0x08cf('0x29')],'resourceId':_0x23dbaa['id'],'type':_0x7d0c74[_0x08cf('0x29')],'sectionId':_0x7d0c74['id']},{})['then'](function(){return _0x47fee0;});}else{return _0x47fee0;}})[_0x08cf('0x42')](function(_0x1efde7){logger[_0x08cf('0x27')](_0x08cf('0x51'),_0x1efde7);throw _0x1efde7;});}return _0x47fee0;})[_0x08cf('0x24')](respondWithResult(_0x4ac50d,0xc9))[_0x08cf('0x42')](handleError(_0x4ac50d,null));};exports['update']=function(_0x42f80a,_0x3f305f){if(_0x42f80a[_0x08cf('0x49')]['id']){delete _0x42f80a[_0x08cf('0x49')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x42f80a[_0x08cf('0x44')]['id']}})[_0x08cf('0x24')](handleEntityNotFound(_0x3f305f,null))[_0x08cf('0x24')](saveUpdates(_0x42f80a[_0x08cf('0x49')],null))[_0x08cf('0x24')](respondWithResult(_0x3f305f,null))[_0x08cf('0x42')](handleError(_0x3f305f,null));};exports[_0x08cf('0x52')]=function(_0x1d0310,_0x1d8339){return db[_0x08cf('0x2c')][_0x08cf('0x47')]({'where':{'id':_0x1d0310[_0x08cf('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d8339,null))[_0x08cf('0x24')](removeEntity(_0x1d8339,null))[_0x08cf('0x42')](handleError(_0x1d8339,null));};exports[_0x08cf('0x53')]=function(_0x1b2d83,_0xd970aa){return db[_0x08cf('0x2c')][_0x08cf('0x53')]()[_0x08cf('0x24')](respondWithResult(_0xd970aa,null))[_0x08cf('0x42')](handleError(_0xd970aa,null));};exports['getMembers']=function(_0x10846d,_0x41b4bd,_0x1add70){var _0x13a936={'raw':!![],'where':{}},_0x456e2c={},_0x3d28ad;return db[_0x08cf('0x2c')][_0x08cf('0x54')]({'where':{'id':_0x10846d[_0x08cf('0x44')]['id']}})[_0x08cf('0x24')](handleEntityNotFound(_0x41b4bd,null))[_0x08cf('0x24')](function(_0x56cb82){if(_0x56cb82){_0x3d28ad=_0x56cb82[_0x08cf('0x4d')]({'plain':!![]});_0x456e2c[_0x08cf('0x2e')]=_[_0x08cf('0x31')](db[_0x08cf('0x55')][_0x08cf('0x45')]);_0x456e2c[_0x08cf('0x30')]=_[_0x08cf('0x31')](_0x10846d[_0x08cf('0x30')]);_0x456e2c[_0x08cf('0x3a')]=_[_0x08cf('0x33')](_0x456e2c[_0x08cf('0x2e')],_0x456e2c['query']);_0x13a936['attributes']=_[_0x08cf('0x33')](_0x456e2c['model'],qs[_0x08cf('0x34')](_0x10846d['query']['fields']));_0x13a936[_0x08cf('0x32')]=_0x13a936[_0x08cf('0x32')]['length']?_0x13a936[_0x08cf('0x32')]:_0x456e2c[_0x08cf('0x2e')];if(!_0x10846d[_0x08cf('0x30')][_0x08cf('0x36')](_0x08cf('0x37'))){_0x13a936['limit']=qs[_0x08cf('0x1f')](_0x10846d['query'][_0x08cf('0x1f')]);_0x13a936[_0x08cf('0x1e')]=qs['offset'](_0x10846d[_0x08cf('0x30')][_0x08cf('0x1e')]);}_0x13a936[_0x08cf('0x38')]=qs[_0x08cf('0x39')](_0x10846d[_0x08cf('0x30')]['sort']);_0x13a936[_0x08cf('0x3c')]=qs['filters'](_[_0x08cf('0x56')](_0x10846d[_0x08cf('0x30')],_0x456e2c[_0x08cf('0x3a')]));_0x13a936[_0x08cf('0x3c')]['FaxQueueId']=_0x56cb82['id'];if(_0x10846d[_0x08cf('0x30')][_0x08cf('0x3b')]){_0x13a936[_0x08cf('0x3c')]=_[_0x08cf('0x46')](_0x13a936[_0x08cf('0x3c')],{'$or':_[_0x08cf('0x2f')](_0x13a936[_0x08cf('0x32')],function(_0x167ec2){var _0x3faa26={};_0x3faa26[_0x167ec2]={'$like':'%'+_0x10846d[_0x08cf('0x30')][_0x08cf('0x3b')]+'%'};return _0x3faa26;})});}_0x13a936=_[_0x08cf('0x46')]({},_0x13a936,_0x10846d['options']);return db[_0x08cf('0x55')][_0x08cf('0x41')](_0x13a936);}})['then'](function(_0x32cee5){if(_0x32cee5){return db[_0x08cf('0x57')]['findAndCountAll']({'where':{'id':_[_0x08cf('0x2f')](_0x32cee5,_0x08cf('0x58')),'role':_0x08cf('0x59')},'attributes':['id','name','faxPause',_0x08cf('0x5a'),_0x08cf('0x5b')]});}})['then'](function(_0x4e8765){if(_0x4e8765){return{'count':_0x4e8765['count'],'rows':_[_0x08cf('0x2f')](_0x4e8765[_0x08cf('0x5c')],function(_0x2dcfd9){return{'membername':_0x2dcfd9[_0x08cf('0x29')],'UserId':_0x2dcfd9['id'],'queue_name':_0x3d28ad['name'],'FaxQueueId':_0x3d28ad['id'],'interface':util[_0x08cf('0x5d')](_0x08cf('0x5e'),_0x08cf('0x5f'),_0x2dcfd9[_0x08cf('0x29')]),'penalty':0x0,'paused':_0x2dcfd9[_0x08cf('0x60')],'createdAt':_0x2dcfd9[_0x08cf('0x5b')],'updatedAt':_0x2dcfd9[_0x08cf('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x08cf('0x24')](respondWithFilteredResult(_0x41b4bd,_0x13a936))[_0x08cf('0x42')](handleError(_0x41b4bd,null));};exports['getTeams']=function(_0x50df16,_0x3ebcf6,_0x38074e){var _0x135c15={};var _0x1ad108={};var _0x3bf445;var _0x1f28d9;return db['FaxQueue'][_0x08cf('0x54')]({'where':{'id':_0x50df16[_0x08cf('0x44')]['id']}})[_0x08cf('0x24')](handleEntityNotFound(_0x3ebcf6,null))['then'](function(_0x35ce17){if(_0x35ce17){_0x3bf445=_0x35ce17;_0x1ad108[_0x08cf('0x2e')]=_['keys'](db[_0x08cf('0x61')][_0x08cf('0x45')]);_0x1ad108[_0x08cf('0x30')]=_['keys'](_0x50df16['query']);_0x1ad108[_0x08cf('0x3a')]=_[_0x08cf('0x33')](_0x1ad108[_0x08cf('0x2e')],_0x1ad108['query']);_0x135c15[_0x08cf('0x32')]=_[_0x08cf('0x33')](_0x1ad108['model'],qs[_0x08cf('0x34')](_0x50df16[_0x08cf('0x30')]['fields']));_0x135c15[_0x08cf('0x32')]=_0x135c15[_0x08cf('0x32')][_0x08cf('0x35')]?_0x135c15['attributes']:_0x1ad108[_0x08cf('0x2e')];_0x135c15[_0x08cf('0x38')]=qs[_0x08cf('0x39')](_0x50df16[_0x08cf('0x30')][_0x08cf('0x39')]);_0x135c15[_0x08cf('0x3c')]=qs[_0x08cf('0x3a')](_[_0x08cf('0x56')](_0x50df16[_0x08cf('0x30')],_0x1ad108['filters']));if(_0x50df16[_0x08cf('0x30')][_0x08cf('0x3b')]){_0x135c15[_0x08cf('0x3c')]=_['merge'](_0x135c15['where'],{'$or':_[_0x08cf('0x2f')](_0x135c15[_0x08cf('0x32')],function(_0x2c835f){var _0x43f816={};_0x43f816[_0x2c835f]={'$like':'%'+_0x50df16[_0x08cf('0x30')][_0x08cf('0x3b')]+'%'};return _0x43f816;})});}_0x135c15=_['merge']({},_0x135c15,_0x50df16['options']);return _0x3bf445[_0x08cf('0x62')](_0x135c15);}})[_0x08cf('0x24')](function(_0x4eedb0){if(_0x4eedb0){_0x1f28d9=_0x4eedb0['length'];if(!_0x50df16[_0x08cf('0x30')][_0x08cf('0x36')]('nolimit')){_0x135c15[_0x08cf('0x1f')]=qs[_0x08cf('0x1f')](_0x50df16[_0x08cf('0x30')]['limit']);_0x135c15[_0x08cf('0x1e')]=qs[_0x08cf('0x1e')](_0x50df16[_0x08cf('0x30')]['offset']);}return _0x3bf445['getTeams'](_0x135c15);}})['then'](function(_0x56e467){if(_0x56e467){return _0x56e467?{'count':_0x1f28d9,'rows':_0x56e467}:null;}})[_0x08cf('0x24')](respondWithResult(_0x3ebcf6,null))[_0x08cf('0x42')](handleError(_0x3ebcf6,null));};exports[_0x08cf('0x63')]=function(_0xa07840,_0xa51d0e,_0x3247e4){var _0x224586=_0xa07840[_0x08cf('0x49')]['ids'];return db[_0x08cf('0x61')]['findAll']({'where':{'id':_0x224586},'attributes':['id'],'include':[{'model':db[_0x08cf('0x57')],'as':_0x08cf('0x64'),'attributes':['id',_0x08cf('0x29'),_0x08cf('0x65'),'voicePause',_0x08cf('0x66')],'raw':!![]}]})[_0x08cf('0x24')](function(_0x4d1f53){if(_0x4d1f53){var _0x302911=_[_0x08cf('0x67')](_0x4d1f53,function(_0x1bd6be){var _0x390311=_0x1bd6be[_0x08cf('0x4d')]({'plain':!![]});return _0x390311[_0x08cf('0x64')];});return db[_0x08cf('0x2c')][_0x08cf('0x47')]({'where':{'id':_0xa07840[_0x08cf('0x44')]['id']}})[_0x08cf('0x24')](function(_0x81669e){return db['sequelize'][_0x08cf('0x68')](function(_0x255eeb){return _0x81669e[_0x08cf('0x63')](_0x224586,{'transaction':_0x255eeb})[_0x08cf('0x24')](function(){return BPromise[_0x08cf('0x69')](_0x302911,function(_0xf9b74f){return db[_0x08cf('0x55')][_0x08cf('0x6a')]({'where':{'UserId':_0xf9b74f['id'],'FaxQueueId':_0xa07840[_0x08cf('0x44')]['id']},'transaction':_0x255eeb});});})[_0x08cf('0x24')](function(){_0x302911['forEach'](function(_0x180a62){socket[_0x08cf('0x6b')](_0x08cf('0x6c'),{'UserId':_0x180a62['id'],'FaxQueueId':_0x81669e['id']});});});});});}})[_0x08cf('0x24')](respondWithStatusCode(_0xa51d0e,null))['catch'](handleError(_0xa51d0e,null));};exports['removeTeams']=function(_0x2018b2,_0x2c6063,_0x224d2a){return db[_0x08cf('0x61')][_0x08cf('0x41')]({'where':{'id':_0x2018b2['query'][_0x08cf('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x08cf('0x57')],'as':_0x08cf('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2c6063,null))[_0x08cf('0x24')](function(_0xa213f6){var _0x3e5ea0=_[_0x08cf('0x2f')](_0xa213f6,'id');var _0x2df8f7=[];var _0x2b9bd3=[];var _0x577620=squel[_0x08cf('0x6e')]();_0x577620[_0x08cf('0x6f')](_0x08cf('0x70'))[_0x08cf('0x71')]('team_has_fax_queues','tq')['join'](_0x08cf('0x72'),'ut',_0x08cf('0x73'))[_0x08cf('0x3c')](_0x08cf('0x74'),_0x2018b2[_0x08cf('0x44')]['id']);for(var _0x34da77=0x0;_0x34da77<_0xa213f6[_0x08cf('0x35')];_0x34da77+=0x1){let _0x23d27c=_0xa213f6[_0x34da77];for(var _0xc6b8d=0x0;_0xc6b8d<_0x23d27c[_0x08cf('0x64')][_0x08cf('0x35')];_0xc6b8d+=0x1){let _0x4b77df=_0x23d27c[_0x08cf('0x64')][_0xc6b8d];var _0x51f68f=_0x577620[_0x08cf('0x75')]();_0x51f68f['where'](_0x08cf('0x76'),_0x4b77df['id']);_0x2b9bd3[_0x08cf('0x77')](db[_0x08cf('0x78')]['query'](_0x51f68f[_0x08cf('0x79')](),{'type':db[_0x08cf('0x78')][_0x08cf('0x7a')]['SELECT']})[_0x08cf('0x24')](function(_0x27a875){if(_0x27a875['length']===0x1){return _0x4b77df['id'];}else{var _0x111e1f=_[_0x08cf('0x7b')](_[_0x08cf('0x2f')](_0x27a875,_0x08cf('0x7c')),function(_0xa81869){return _[_0x08cf('0x7d')](_0x3e5ea0,_0xa81869);});if(_0x111e1f){return _0x4b77df['id'];}}}));}}return BPromise[_0x08cf('0x7e')](_0x2b9bd3)['then'](function(_0x48207c){_0x2df8f7=_(_0x2df8f7)[_0x08cf('0x7f')](_0x48207c)['compact']()['value']();return db[_0x08cf('0x2c')][_0x08cf('0x47')]({'where':{'id':_0x2018b2[_0x08cf('0x44')]['id']}})[_0x08cf('0x24')](function(_0x4e5c54){return db[_0x08cf('0x78')][_0x08cf('0x68')](function(_0x144bbc){return _0x4e5c54[_0x08cf('0x80')](_0x2018b2[_0x08cf('0x30')]['ids'],{'transaction':_0x144bbc})['then'](function(){if(!_[_0x08cf('0x81')](_0x2df8f7)){return _0x4e5c54['removeAgents'](_0x2df8f7,{'transaction':_0x144bbc});}})[_0x08cf('0x24')](function(){_0x2df8f7['forEach'](function(_0x7fb5fe){socket[_0x08cf('0x6b')](_0x08cf('0x82'),{'UserId':_0x7fb5fe,'FaxQueueId':_0x4e5c54['id']});});});});});});})[_0x08cf('0x24')](respondWithStatusCode(_0x2c6063,null))[_0x08cf('0x42')](handleError(_0x2c6063,null));};exports['addAgents']=function(_0xf72286,_0x1b8125,_0x2b6bab){return db['FaxQueue'][_0x08cf('0x47')]({'where':{'id':_0xf72286['params']['id']}})[_0x08cf('0x24')](handleEntityNotFound(_0x1b8125,null))['then'](function(_0x1b8b6c){if(_0x1b8b6c){return _0x1b8b6c[_0x08cf('0x83')](_0xf72286[_0x08cf('0x49')][_0x08cf('0x6d')],_[_0x08cf('0x84')](_0xf72286['body'],['ids','id'])||{})[_0x08cf('0x85')](function(_0x2642a3){for(var _0x45fc5c=0x0;_0x45fc5c<_0xf72286['body'][_0x08cf('0x6d')][_0x08cf('0x35')];_0x45fc5c+=0x1){socket[_0x08cf('0x6b')](_0x08cf('0x6c'),{'UserId':Number(_0xf72286['body']['ids'][_0x45fc5c]),'FaxQueueId':Number(_0xf72286['params']['id'])});}return _0x2642a3;});}})[_0x08cf('0x24')](respondWithResult(_0x1b8125,null))[_0x08cf('0x42')](handleError(_0x1b8125,null));};exports[_0x08cf('0x86')]=function(_0x39084d,_0x308863,_0x1c55fc){return db['FaxQueue']['find']({'where':{'id':_0x39084d['params']['id']}})[_0x08cf('0x24')](handleEntityNotFound(_0x308863,null))[_0x08cf('0x24')](function(_0x3d7a73){if(_0x3d7a73){return _0x3d7a73[_0x08cf('0x86')](_0x39084d[_0x08cf('0x30')][_0x08cf('0x6d')])[_0x08cf('0x24')](function(){if(_[_0x08cf('0x87')](_0x39084d[_0x08cf('0x30')][_0x08cf('0x6d')])){for(var _0x40d70e=0x0;_0x40d70e<_0x39084d['query'][_0x08cf('0x6d')]['length'];_0x40d70e+=0x1){socket[_0x08cf('0x6b')](_0x08cf('0x82'),{'UserId':Number(_0x39084d[_0x08cf('0x30')][_0x08cf('0x6d')][_0x40d70e]),'FaxQueueId':Number(_0x39084d[_0x08cf('0x44')]['id'])});}}else{socket[_0x08cf('0x6b')](_0x08cf('0x82'),{'UserId':Number(_0x39084d[_0x08cf('0x30')][_0x08cf('0x6d')]),'FaxQueueId':Number(_0x39084d[_0x08cf('0x44')]['id'])});}});}})[_0x08cf('0x24')](respondWithStatusCode(_0x308863,null))[_0x08cf('0x42')](handleError(_0x308863,null));};exports[_0x08cf('0x88')]=function(_0x4fc5a1,_0x46ef10,_0x6d735a){var _0x15ff3f={};var _0x601ce3={};var _0x8680b9;var _0x53292e;return db[_0x08cf('0x2c')]['findOne']({'where':{'id':_0x4fc5a1['params']['id']}})[_0x08cf('0x24')](handleEntityNotFound(_0x46ef10,null))['then'](function(_0x29a43a){if(_0x29a43a){_0x8680b9=_0x29a43a;_0x601ce3[_0x08cf('0x2e')]=_[_0x08cf('0x31')](db[_0x08cf('0x57')][_0x08cf('0x45')]);_0x601ce3[_0x08cf('0x30')]=_[_0x08cf('0x31')](_0x4fc5a1[_0x08cf('0x30')]);_0x601ce3['filters']=_[_0x08cf('0x33')](_0x601ce3[_0x08cf('0x2e')],_0x601ce3['query']);_0x15ff3f[_0x08cf('0x32')]=_['intersection'](_0x601ce3['model'],qs[_0x08cf('0x34')](_0x4fc5a1[_0x08cf('0x30')][_0x08cf('0x34')]));_0x15ff3f[_0x08cf('0x32')]=_0x15ff3f[_0x08cf('0x32')][_0x08cf('0x35')]?_0x15ff3f[_0x08cf('0x32')]:_0x601ce3[_0x08cf('0x2e')];_0x15ff3f[_0x08cf('0x38')]=qs[_0x08cf('0x39')](_0x4fc5a1['query'][_0x08cf('0x39')]);_0x15ff3f['where']=qs[_0x08cf('0x3a')](_[_0x08cf('0x56')](_0x4fc5a1[_0x08cf('0x30')],_0x601ce3[_0x08cf('0x3a')]));if(_0x4fc5a1[_0x08cf('0x30')]['filter']){_0x15ff3f['where']=_[_0x08cf('0x46')](_0x15ff3f[_0x08cf('0x3c')],{'$or':_[_0x08cf('0x2f')](_0x15ff3f[_0x08cf('0x32')],function(_0x3b368c){var _0xf03484={};_0xf03484[_0x3b368c]={'$like':'%'+_0x4fc5a1[_0x08cf('0x30')][_0x08cf('0x3b')]+'%'};return _0xf03484;})});}_0x15ff3f=_['merge']({},_0x15ff3f,_0x4fc5a1[_0x08cf('0x3f')]);return _0x8680b9['getAgents'](_0x15ff3f);}})[_0x08cf('0x24')](function(_0x34816e){if(_0x34816e){_0x53292e=_0x34816e['length'];if(!_0x4fc5a1[_0x08cf('0x30')][_0x08cf('0x36')](_0x08cf('0x37'))){_0x15ff3f[_0x08cf('0x1f')]=qs[_0x08cf('0x1f')](_0x4fc5a1[_0x08cf('0x30')][_0x08cf('0x1f')]);_0x15ff3f[_0x08cf('0x1e')]=qs[_0x08cf('0x1e')](_0x4fc5a1[_0x08cf('0x30')]['offset']);}return _0x8680b9['getAgents'](_0x15ff3f);}})[_0x08cf('0x24')](function(_0x1d391f){if(_0x1d391f){return _0x1d391f?{'count':_0x53292e,'rows':_0x1d391f}:null;}})[_0x08cf('0x24')](respondWithResult(_0x46ef10,null))[_0x08cf('0x42')](handleError(_0x46ef10,null));}; \ No newline at end of file +var _0xfffc=['end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','fields','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','sort','pick','findAndCountAll','UserId','agent','faxPause','updatedAt','format','SIP','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','User','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','sequelize','toString','SELECT','every','TeamId','includes','all','compact','value','transaction','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xfffc,0x70));var _0xcfff=function(_0x39ad47,_0x105809){_0x39ad47=_0x39ad47-0x0;var _0x3b5fad=_0xfffc[_0x39ad47];return _0x3b5fad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfff('0x0'));var zipdir=require(_0xcfff('0x1'));var jsonpatch=require(_0xcfff('0x2'));var rp=require(_0xcfff('0x3'));var moment=require(_0xcfff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcfff('0x5'));var util=require(_0xcfff('0x6'));var path=require(_0xcfff('0x7'));var sox=require(_0xcfff('0x8'));var csv=require(_0xcfff('0x9'));var ejs=require(_0xcfff('0xa'));var fs=require('fs');var fs_extra=require(_0xcfff('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfff('0xc'));var jsforce=require(_0xcfff('0xd'));var deskjs=require(_0xcfff('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcfff('0xf'));var Papa=require(_0xcfff('0x10'));var Redis=require(_0xcfff('0x11'));var authService=require(_0xcfff('0x12'));var qs=require(_0xcfff('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfff('0x14'))(_0xcfff('0x15'));var utils=require(_0xcfff('0x16'));var config=require(_0xcfff('0x17'));var licenseUtil=require(_0xcfff('0x18'));var db=require(_0xcfff('0x19'))['db'];config[_0xcfff('0x1a')]=_['defaults'](config[_0xcfff('0x1a')],{'host':_0xcfff('0x1b'),'port':0x18eb});var socket=require(_0xcfff('0x1c'))(new Redis(config[_0xcfff('0x1a')]));require(_0xcfff('0x1d'))[_0xcfff('0x1e')](socket);function respondWithStatusCode(_0x5718cd,_0x1645b2){_0x1645b2=_0x1645b2||0xcc;return function(_0x1dc64b){if(_0x1dc64b){return _0x5718cd[_0xcfff('0x1f')](_0x1645b2);}return _0x5718cd[_0xcfff('0x20')](_0x1645b2)[_0xcfff('0x21')]();};}function respondWithResult(_0x2c2c5b,_0x48a082){_0x48a082=_0x48a082||0xc8;return function(_0x4dfb44){if(_0x4dfb44){return _0x2c2c5b[_0xcfff('0x20')](_0x48a082)[_0xcfff('0x22')](_0x4dfb44);}};}function respondWithFilteredResult(_0x437d32,_0x3eb5ad){return function(_0x1f86ca){if(_0x1f86ca){var _0xcde05c=typeof _0x3eb5ad['offset']===_0xcfff('0x23')&&typeof _0x3eb5ad[_0xcfff('0x24')]===_0xcfff('0x23');var _0x4c8b9e=_0x1f86ca[_0xcfff('0x25')];var _0x20fa7d=_0xcde05c?0x0:_0x3eb5ad[_0xcfff('0x26')];var _0x39f24c=_0xcde05c?_0x1f86ca['count']:_0x3eb5ad[_0xcfff('0x26')]+_0x3eb5ad[_0xcfff('0x24')];var _0x2c6e39;if(_0x39f24c>=_0x4c8b9e){_0x39f24c=_0x4c8b9e;_0x2c6e39=0xc8;}else{_0x2c6e39=0xce;}_0x437d32[_0xcfff('0x20')](_0x2c6e39);return _0x437d32[_0xcfff('0x27')](_0xcfff('0x28'),_0x20fa7d+'-'+_0x39f24c+'/'+_0x4c8b9e)[_0xcfff('0x22')](_0x1f86ca);}return null;};}function patchUpdates(_0x373f16){return function(_0x2c3adc){try{jsonpatch[_0xcfff('0x29')](_0x2c3adc,_0x373f16,!![]);}catch(_0x57feab){return BPromise['reject'](_0x57feab);}return _0x2c3adc['save']();};}function saveUpdates(_0x18ada8,_0x57724e){return function(_0x5276e1){if(_0x5276e1){return _0x5276e1[_0xcfff('0x2a')](_0x18ada8)[_0xcfff('0x2b')](function(_0x4ef8e0){return _0x4ef8e0;});}return null;};}function removeEntity(_0x56fe50,_0x291fdf){return function(_0x17b0cf){if(_0x17b0cf){return _0x17b0cf[_0xcfff('0x2c')]()[_0xcfff('0x2b')](function(){var _0x424698=_0x17b0cf[_0xcfff('0x2d')]({'plain':!![]});var _0x3505b4=_0xcfff('0x2e');return db[_0xcfff('0x2f')][_0xcfff('0x2c')]({'where':{'type':_0x3505b4,'resourceId':_0x424698['id']}})['then'](function(){return _0x17b0cf;});})['then'](function(){_0x56fe50['status'](0xcc)[_0xcfff('0x21')]();});}};}function handleEntityNotFound(_0x599d6b,_0x43c521){return function(_0xc117ee){if(!_0xc117ee){_0x599d6b[_0xcfff('0x1f')](0x194);}return _0xc117ee;};}function handleError(_0x8237ef,_0x130ad7){_0x130ad7=_0x130ad7||0x1f4;return function(_0x2ffdd3){logger[_0xcfff('0x30')](_0x2ffdd3[_0xcfff('0x31')]);if(_0x2ffdd3[_0xcfff('0x32')]){delete _0x2ffdd3['name'];}_0x8237ef[_0xcfff('0x20')](_0x130ad7)[_0xcfff('0x33')](_0x2ffdd3);};}exports[_0xcfff('0x34')]=function(_0x28ffb5,_0x41494c){var _0x4389f2={},_0x502b41={},_0x2d800d={'count':0x0,'rows':[]};var _0x888792=_['map'](db[_0xcfff('0x35')][_0xcfff('0x36')],function(_0xa951d3){return{'name':_0xa951d3[_0xcfff('0x37')],'type':_0xa951d3[_0xcfff('0x38')]['key']};});_0x502b41[_0xcfff('0x39')]=_[_0xcfff('0x3a')](_0x888792,'name');_0x502b41[_0xcfff('0x3b')]=_[_0xcfff('0x3c')](_0x28ffb5[_0xcfff('0x3b')]);_0x502b41[_0xcfff('0x3d')]=_[_0xcfff('0x3e')](_0x502b41[_0xcfff('0x39')],_0x502b41[_0xcfff('0x3b')]);_0x4389f2[_0xcfff('0x3f')]=_[_0xcfff('0x3e')](_0x502b41[_0xcfff('0x39')],qs['fields'](_0x28ffb5[_0xcfff('0x3b')]['fields']));_0x4389f2[_0xcfff('0x3f')]=_0x4389f2[_0xcfff('0x3f')]['length']?_0x4389f2[_0xcfff('0x3f')]:_0x502b41['model'];if(!_0x28ffb5['query'][_0xcfff('0x40')](_0xcfff('0x41'))){_0x4389f2[_0xcfff('0x24')]=qs[_0xcfff('0x24')](_0x28ffb5[_0xcfff('0x3b')][_0xcfff('0x24')]);_0x4389f2[_0xcfff('0x26')]=qs[_0xcfff('0x26')](_0x28ffb5[_0xcfff('0x3b')]['offset']);}_0x4389f2[_0xcfff('0x42')]=qs['sort'](_0x28ffb5['query']['sort']);_0x4389f2[_0xcfff('0x43')]=qs['filters'](_['pick'](_0x28ffb5[_0xcfff('0x3b')],_0x502b41[_0xcfff('0x3d')]),_0x888792);if(_0x28ffb5['query']['filter']){_0x4389f2[_0xcfff('0x43')]=_['merge'](_0x4389f2[_0xcfff('0x43')],{'$or':_[_0xcfff('0x3a')](_0x888792,function(_0xa8c2c9){if(_0xa8c2c9[_0xcfff('0x38')]!==_0xcfff('0x44')){var _0x154e9d={};_0x154e9d[_0xa8c2c9['name']]={'$like':'%'+_0x28ffb5['query'][_0xcfff('0x45')]+'%'};return _0x154e9d;}})});}_0x4389f2=_[_0xcfff('0x46')]({},_0x4389f2,_0x28ffb5[_0xcfff('0x47')]);var _0x5e7883={'where':_0x4389f2[_0xcfff('0x43')]};return db[_0xcfff('0x35')][_0xcfff('0x25')](_0x5e7883)['then'](function(_0x5d9e06){_0x2d800d['count']=_0x5d9e06;if(_0x28ffb5[_0xcfff('0x3b')][_0xcfff('0x48')]){_0x4389f2[_0xcfff('0x49')]=[{'all':!![]}];}return db[_0xcfff('0x35')][_0xcfff('0x4a')](_0x4389f2);})[_0xcfff('0x2b')](function(_0x16bd85){_0x2d800d[_0xcfff('0x4b')]=_0x16bd85;return _0x2d800d;})[_0xcfff('0x2b')](respondWithFilteredResult(_0x41494c,_0x4389f2))['catch'](handleError(_0x41494c,null));};exports['show']=function(_0xf7f03a,_0x366e37){var _0x401f32={'raw':!![],'where':{'id':_0xf7f03a[_0xcfff('0x4c')]['id']}},_0x4e9bbc={};_0x4e9bbc[_0xcfff('0x39')]=_['keys'](db['FaxQueue'][_0xcfff('0x36')]);_0x4e9bbc[_0xcfff('0x3b')]=_['keys'](_0xf7f03a['query']);_0x4e9bbc[_0xcfff('0x3d')]=_[_0xcfff('0x3e')](_0x4e9bbc[_0xcfff('0x39')],_0x4e9bbc[_0xcfff('0x3b')]);_0x401f32[_0xcfff('0x3f')]=_[_0xcfff('0x3e')](_0x4e9bbc[_0xcfff('0x39')],qs[_0xcfff('0x4d')](_0xf7f03a[_0xcfff('0x3b')][_0xcfff('0x4d')]));_0x401f32[_0xcfff('0x3f')]=_0x401f32[_0xcfff('0x3f')][_0xcfff('0x4e')]?_0x401f32[_0xcfff('0x3f')]:_0x4e9bbc[_0xcfff('0x39')];if(_0xf7f03a[_0xcfff('0x3b')][_0xcfff('0x48')]){_0x401f32[_0xcfff('0x49')]=[{'all':!![]}];}_0x401f32=_[_0xcfff('0x46')]({},_0x401f32,_0xf7f03a[_0xcfff('0x47')]);return db[_0xcfff('0x35')]['find'](_0x401f32)[_0xcfff('0x2b')](handleEntityNotFound(_0x366e37,null))[_0xcfff('0x2b')](respondWithResult(_0x366e37,null))['catch'](handleError(_0x366e37,null));};exports[_0xcfff('0x4f')]=function(_0x11f0a8,_0x4f1e16){return db['FaxQueue'][_0xcfff('0x4f')](_0x11f0a8['body'],{})['then'](function(_0x45885e){var _0x1f612e=_0x11f0a8[_0xcfff('0x50')]['get']({'plain':!![]});if(!_0x1f612e)throw new Error(_0xcfff('0x51'));if(_0x1f612e[_0xcfff('0x52')]===_0xcfff('0x50')){var _0x553ae5=_0x45885e[_0xcfff('0x2d')]({'plain':!![]});var _0xa8fc18=_0xcfff('0x2e');return db[_0xcfff('0x53')][_0xcfff('0x54')]({'where':{'name':_0xa8fc18,'userProfileId':_0x1f612e[_0xcfff('0x55')]},'raw':!![]})[_0xcfff('0x2b')](function(_0x1a1d9a){if(_0x1a1d9a&&_0x1a1d9a[_0xcfff('0x56')]===0x0){return db[_0xcfff('0x2f')][_0xcfff('0x4f')]({'name':_0x553ae5['name'],'resourceId':_0x553ae5['id'],'type':_0x1a1d9a[_0xcfff('0x32')],'sectionId':_0x1a1d9a['id']},{})[_0xcfff('0x2b')](function(){return _0x45885e;});}else{return _0x45885e;}})[_0xcfff('0x57')](function(_0x258bbc){logger[_0xcfff('0x30')](_0xcfff('0x58'),_0x258bbc);throw _0x258bbc;});}return _0x45885e;})['then'](respondWithResult(_0x4f1e16,0xc9))[_0xcfff('0x57')](handleError(_0x4f1e16,null));};exports[_0xcfff('0x2a')]=function(_0x2f1f3a,_0x59609e){if(_0x2f1f3a[_0xcfff('0x59')]['id']){delete _0x2f1f3a['body']['id'];}return db[_0xcfff('0x35')]['find']({'where':{'id':_0x2f1f3a[_0xcfff('0x4c')]['id']}})[_0xcfff('0x2b')](handleEntityNotFound(_0x59609e,null))[_0xcfff('0x2b')](saveUpdates(_0x2f1f3a['body'],null))['then'](respondWithResult(_0x59609e,null))[_0xcfff('0x57')](handleError(_0x59609e,null));};exports['destroy']=function(_0xeb91ea,_0x35efd9){return db[_0xcfff('0x35')][_0xcfff('0x54')]({'where':{'id':_0xeb91ea[_0xcfff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35efd9,null))[_0xcfff('0x2b')](removeEntity(_0x35efd9,null))[_0xcfff('0x57')](handleError(_0x35efd9,null));};exports[_0xcfff('0x5a')]=function(_0x1e3832,_0x290587){return db[_0xcfff('0x35')][_0xcfff('0x5a')]()['then'](respondWithResult(_0x290587,null))[_0xcfff('0x57')](handleError(_0x290587,null));};exports[_0xcfff('0x5b')]=function(_0x1fb079,_0x595fc8,_0x9b5565){var _0x4ddda5={'raw':!![],'where':{}},_0x3f0278={},_0x583261;return db[_0xcfff('0x35')][_0xcfff('0x5c')]({'where':{'id':_0x1fb079[_0xcfff('0x4c')]['id']}})[_0xcfff('0x2b')](handleEntityNotFound(_0x595fc8,null))[_0xcfff('0x2b')](function(_0x26769b){if(_0x26769b){_0x583261=_0x26769b['get']({'plain':!![]});_0x3f0278[_0xcfff('0x39')]=_[_0xcfff('0x3c')](db[_0xcfff('0x5d')][_0xcfff('0x36')]);_0x3f0278['query']=_[_0xcfff('0x3c')](_0x1fb079[_0xcfff('0x3b')]);_0x3f0278['filters']=_[_0xcfff('0x3e')](_0x3f0278['model'],_0x3f0278[_0xcfff('0x3b')]);_0x4ddda5[_0xcfff('0x3f')]=_[_0xcfff('0x3e')](_0x3f0278[_0xcfff('0x39')],qs[_0xcfff('0x4d')](_0x1fb079[_0xcfff('0x3b')][_0xcfff('0x4d')]));_0x4ddda5['attributes']=_0x4ddda5['attributes'][_0xcfff('0x4e')]?_0x4ddda5[_0xcfff('0x3f')]:_0x3f0278[_0xcfff('0x39')];if(!_0x1fb079[_0xcfff('0x3b')][_0xcfff('0x40')](_0xcfff('0x41'))){_0x4ddda5[_0xcfff('0x24')]=qs[_0xcfff('0x24')](_0x1fb079[_0xcfff('0x3b')][_0xcfff('0x24')]);_0x4ddda5[_0xcfff('0x26')]=qs[_0xcfff('0x26')](_0x1fb079['query'][_0xcfff('0x26')]);}_0x4ddda5[_0xcfff('0x42')]=qs[_0xcfff('0x5e')](_0x1fb079[_0xcfff('0x3b')]['sort']);_0x4ddda5[_0xcfff('0x43')]=qs[_0xcfff('0x3d')](_[_0xcfff('0x5f')](_0x1fb079[_0xcfff('0x3b')],_0x3f0278['filters']));_0x4ddda5[_0xcfff('0x43')]['FaxQueueId']=_0x26769b['id'];if(_0x1fb079[_0xcfff('0x3b')][_0xcfff('0x45')]){_0x4ddda5[_0xcfff('0x43')]=_['merge'](_0x4ddda5['where'],{'$or':_[_0xcfff('0x3a')](_0x4ddda5[_0xcfff('0x3f')],function(_0x69a717){var _0x328db6={};_0x328db6[_0x69a717]={'$like':'%'+_0x1fb079['query'][_0xcfff('0x45')]+'%'};return _0x328db6;})});}_0x4ddda5=_[_0xcfff('0x46')]({},_0x4ddda5,_0x1fb079[_0xcfff('0x47')]);return db[_0xcfff('0x5d')][_0xcfff('0x4a')](_0x4ddda5);}})[_0xcfff('0x2b')](function(_0x1e0f54){if(_0x1e0f54){return db['User'][_0xcfff('0x60')]({'where':{'id':_[_0xcfff('0x3a')](_0x1e0f54,_0xcfff('0x61')),'role':_0xcfff('0x62')},'attributes':['id',_0xcfff('0x32'),_0xcfff('0x63'),_0xcfff('0x64'),'createdAt']});}})[_0xcfff('0x2b')](function(_0x341a7e){if(_0x341a7e){return{'count':_0x341a7e[_0xcfff('0x25')],'rows':_[_0xcfff('0x3a')](_0x341a7e[_0xcfff('0x4b')],function(_0x188e7c){return{'membername':_0x188e7c[_0xcfff('0x32')],'UserId':_0x188e7c['id'],'queue_name':_0x583261[_0xcfff('0x32')],'FaxQueueId':_0x583261['id'],'interface':util[_0xcfff('0x65')]('%s/%s',_0xcfff('0x66'),_0x188e7c[_0xcfff('0x32')]),'penalty':0x0,'paused':_0x188e7c[_0xcfff('0x63')],'createdAt':_0x188e7c[_0xcfff('0x67')],'updatedAt':_0x188e7c[_0xcfff('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x595fc8,_0x4ddda5))['catch'](handleError(_0x595fc8,null));};exports[_0xcfff('0x68')]=function(_0x5b563d,_0xb41f1f,_0x2ca4ee){var _0x1dbe70={};var _0x7d1b07={};var _0x5722ad;var _0xd0ea9b;return db[_0xcfff('0x35')][_0xcfff('0x5c')]({'where':{'id':_0x5b563d[_0xcfff('0x4c')]['id']}})[_0xcfff('0x2b')](handleEntityNotFound(_0xb41f1f,null))[_0xcfff('0x2b')](function(_0x3aa92d){if(_0x3aa92d){_0x5722ad=_0x3aa92d;_0x7d1b07[_0xcfff('0x39')]=_[_0xcfff('0x3c')](db[_0xcfff('0x69')][_0xcfff('0x36')]);_0x7d1b07['query']=_[_0xcfff('0x3c')](_0x5b563d[_0xcfff('0x3b')]);_0x7d1b07[_0xcfff('0x3d')]=_['intersection'](_0x7d1b07[_0xcfff('0x39')],_0x7d1b07[_0xcfff('0x3b')]);_0x1dbe70[_0xcfff('0x3f')]=_['intersection'](_0x7d1b07[_0xcfff('0x39')],qs[_0xcfff('0x4d')](_0x5b563d[_0xcfff('0x3b')][_0xcfff('0x4d')]));_0x1dbe70[_0xcfff('0x3f')]=_0x1dbe70[_0xcfff('0x3f')][_0xcfff('0x4e')]?_0x1dbe70[_0xcfff('0x3f')]:_0x7d1b07[_0xcfff('0x39')];_0x1dbe70[_0xcfff('0x42')]=qs['sort'](_0x5b563d[_0xcfff('0x3b')][_0xcfff('0x5e')]);_0x1dbe70[_0xcfff('0x43')]=qs[_0xcfff('0x3d')](_['pick'](_0x5b563d['query'],_0x7d1b07[_0xcfff('0x3d')]));if(_0x5b563d[_0xcfff('0x3b')][_0xcfff('0x45')]){_0x1dbe70['where']=_['merge'](_0x1dbe70['where'],{'$or':_[_0xcfff('0x3a')](_0x1dbe70['attributes'],function(_0x45bd54){var _0x451b57={};_0x451b57[_0x45bd54]={'$like':'%'+_0x5b563d['query'][_0xcfff('0x45')]+'%'};return _0x451b57;})});}_0x1dbe70=_[_0xcfff('0x46')]({},_0x1dbe70,_0x5b563d[_0xcfff('0x47')]);return _0x5722ad[_0xcfff('0x68')](_0x1dbe70);}})['then'](function(_0x239b5a){if(_0x239b5a){_0xd0ea9b=_0x239b5a[_0xcfff('0x4e')];if(!_0x5b563d[_0xcfff('0x3b')][_0xcfff('0x40')](_0xcfff('0x41'))){_0x1dbe70[_0xcfff('0x24')]=qs[_0xcfff('0x24')](_0x5b563d[_0xcfff('0x3b')][_0xcfff('0x24')]);_0x1dbe70['offset']=qs['offset'](_0x5b563d[_0xcfff('0x3b')][_0xcfff('0x26')]);}return _0x5722ad[_0xcfff('0x68')](_0x1dbe70);}})[_0xcfff('0x2b')](function(_0x20b422){if(_0x20b422){return _0x20b422?{'count':_0xd0ea9b,'rows':_0x20b422}:null;}})[_0xcfff('0x2b')](respondWithResult(_0xb41f1f,null))[_0xcfff('0x57')](handleError(_0xb41f1f,null));};exports[_0xcfff('0x6a')]=function(_0x45420e,_0x220f1c,_0x148d47){var _0x2ffc97=_0x45420e[_0xcfff('0x59')]['ids'];return db['Team'][_0xcfff('0x4a')]({'where':{'id':_0x2ffc97},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcfff('0x6b'),'attributes':['id',_0xcfff('0x32'),_0xcfff('0x6c'),_0xcfff('0x6d'),_0xcfff('0x6e')],'raw':!![]}]})[_0xcfff('0x2b')](function(_0x58a407){if(_0x58a407){var _0x8d2b12=_[_0xcfff('0x6f')](_0x58a407,function(_0x1b6d2a){var _0x5ea3e2=_0x1b6d2a[_0xcfff('0x2d')]({'plain':!![]});return _0x5ea3e2['Agents'];});return db[_0xcfff('0x35')][_0xcfff('0x54')]({'where':{'id':_0x45420e[_0xcfff('0x4c')]['id']}})[_0xcfff('0x2b')](function(_0x1c5155){return db['sequelize']['transaction'](function(_0x4972b3){return _0x1c5155[_0xcfff('0x6a')](_0x2ffc97,{'transaction':_0x4972b3})[_0xcfff('0x2b')](function(){return BPromise[_0xcfff('0x70')](_0x8d2b12,function(_0x2dd5c7){return db[_0xcfff('0x5d')][_0xcfff('0x71')]({'where':{'UserId':_0x2dd5c7['id'],'FaxQueueId':_0x45420e[_0xcfff('0x4c')]['id']},'transaction':_0x4972b3});});})[_0xcfff('0x2b')](function(){_0x8d2b12[_0xcfff('0x72')](function(_0x23c539){socket[_0xcfff('0x73')](_0xcfff('0x74'),{'UserId':_0x23c539['id'],'FaxQueueId':_0x1c5155['id']});});});});});}})[_0xcfff('0x2b')](respondWithStatusCode(_0x220f1c,null))['catch'](handleError(_0x220f1c,null));};exports[_0xcfff('0x75')]=function(_0x4a31ea,_0x74d8c3,_0x522c69){return db[_0xcfff('0x69')][_0xcfff('0x4a')]({'where':{'id':_0x4a31ea['query'][_0xcfff('0x76')]},'attributes':['id'],'include':[{'model':db[_0xcfff('0x77')],'as':_0xcfff('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xcfff('0x2b')](handleEntityNotFound(_0x74d8c3,null))['then'](function(_0x43b8a5){var _0x13d9d6=_[_0xcfff('0x3a')](_0x43b8a5,'id');var _0x3d7918=[];var _0x42960a=[];var _0x50cdbd=squel['select']();_0x50cdbd[_0xcfff('0x78')](_0xcfff('0x79'))[_0xcfff('0x7a')](_0xcfff('0x7b'),'tq')[_0xcfff('0x7c')]('user_has_teams','ut',_0xcfff('0x7d'))[_0xcfff('0x43')](_0xcfff('0x7e'),_0x4a31ea[_0xcfff('0x4c')]['id']);for(var _0x3f78c8=0x0;_0x3f78c8<_0x43b8a5[_0xcfff('0x4e')];_0x3f78c8+=0x1){let _0x370b84=_0x43b8a5[_0x3f78c8];for(var _0x404be2=0x0;_0x404be2<_0x370b84[_0xcfff('0x6b')][_0xcfff('0x4e')];_0x404be2+=0x1){let _0x3db70c=_0x370b84['Agents'][_0x404be2];var _0x3ed566=_0x50cdbd[_0xcfff('0x7f')]();_0x3ed566[_0xcfff('0x43')]('ut.UserId\x20=\x20?',_0x3db70c['id']);_0x42960a[_0xcfff('0x80')](db[_0xcfff('0x81')][_0xcfff('0x3b')](_0x3ed566[_0xcfff('0x82')](),{'type':db[_0xcfff('0x81')]['QueryTypes'][_0xcfff('0x83')]})['then'](function(_0x214b9f){if(_0x214b9f[_0xcfff('0x4e')]===0x1){return _0x3db70c['id'];}else{var _0x365bb1=_[_0xcfff('0x84')](_[_0xcfff('0x3a')](_0x214b9f,_0xcfff('0x85')),function(_0x2c0198){return _[_0xcfff('0x86')](_0x13d9d6,_0x2c0198);});if(_0x365bb1){return _0x3db70c['id'];}}}));}}return BPromise[_0xcfff('0x87')](_0x42960a)[_0xcfff('0x2b')](function(_0x955c11){_0x3d7918=_(_0x3d7918)['union'](_0x955c11)[_0xcfff('0x88')]()[_0xcfff('0x89')]();return db[_0xcfff('0x35')][_0xcfff('0x54')]({'where':{'id':_0x4a31ea['params']['id']}})[_0xcfff('0x2b')](function(_0x47e713){return db['sequelize'][_0xcfff('0x8a')](function(_0x1de93c){return _0x47e713[_0xcfff('0x75')](_0x4a31ea[_0xcfff('0x3b')]['ids'],{'transaction':_0x1de93c})[_0xcfff('0x2b')](function(){if(!_['isEmpty'](_0x3d7918)){return _0x47e713[_0xcfff('0x8b')](_0x3d7918,{'transaction':_0x1de93c});}})[_0xcfff('0x2b')](function(){_0x3d7918['forEach'](function(_0x1cd92a){socket[_0xcfff('0x73')](_0xcfff('0x8c'),{'UserId':_0x1cd92a,'FaxQueueId':_0x47e713['id']});});});});});});})[_0xcfff('0x2b')](respondWithStatusCode(_0x74d8c3,null))[_0xcfff('0x57')](handleError(_0x74d8c3,null));};exports[_0xcfff('0x8d')]=function(_0x3bfa62,_0x2f3eb2,_0x4fd196){return db[_0xcfff('0x35')][_0xcfff('0x54')]({'where':{'id':_0x3bfa62[_0xcfff('0x4c')]['id']}})[_0xcfff('0x2b')](handleEntityNotFound(_0x2f3eb2,null))[_0xcfff('0x2b')](function(_0x4ac37a){if(_0x4ac37a){return _0x4ac37a['addAgents'](_0x3bfa62[_0xcfff('0x59')][_0xcfff('0x76')],_['omit'](_0x3bfa62[_0xcfff('0x59')],['ids','id'])||{})[_0xcfff('0x8e')](function(_0x402e7d){for(var _0x68fc8=0x0;_0x68fc8<_0x3bfa62[_0xcfff('0x59')][_0xcfff('0x76')][_0xcfff('0x4e')];_0x68fc8+=0x1){socket[_0xcfff('0x73')](_0xcfff('0x74'),{'UserId':Number(_0x3bfa62[_0xcfff('0x59')][_0xcfff('0x76')][_0x68fc8]),'FaxQueueId':Number(_0x3bfa62[_0xcfff('0x4c')]['id'])});}return _0x402e7d;});}})[_0xcfff('0x2b')](respondWithResult(_0x2f3eb2,null))[_0xcfff('0x57')](handleError(_0x2f3eb2,null));};exports[_0xcfff('0x8b')]=function(_0x4f5a47,_0xe3a25,_0x340b1e){return db[_0xcfff('0x35')]['find']({'where':{'id':_0x4f5a47[_0xcfff('0x4c')]['id']}})[_0xcfff('0x2b')](handleEntityNotFound(_0xe3a25,null))[_0xcfff('0x2b')](function(_0xe555f9){if(_0xe555f9){return _0xe555f9['removeAgents'](_0x4f5a47['query'][_0xcfff('0x76')])[_0xcfff('0x2b')](function(){if(_[_0xcfff('0x8f')](_0x4f5a47[_0xcfff('0x3b')]['ids'])){for(var _0x565186=0x0;_0x565186<_0x4f5a47[_0xcfff('0x3b')][_0xcfff('0x76')][_0xcfff('0x4e')];_0x565186+=0x1){socket[_0xcfff('0x73')](_0xcfff('0x8c'),{'UserId':Number(_0x4f5a47[_0xcfff('0x3b')][_0xcfff('0x76')][_0x565186]),'FaxQueueId':Number(_0x4f5a47[_0xcfff('0x4c')]['id'])});}}else{socket['emit'](_0xcfff('0x8c'),{'UserId':Number(_0x4f5a47[_0xcfff('0x3b')][_0xcfff('0x76')]),'FaxQueueId':Number(_0x4f5a47[_0xcfff('0x4c')]['id'])});}});}})[_0xcfff('0x2b')](respondWithStatusCode(_0xe3a25,null))[_0xcfff('0x57')](handleError(_0xe3a25,null));};exports['getAgents']=function(_0x553a54,_0x1e0ddf,_0x3ccd7f){var _0x16ba5f={};var _0x259cbe={};var _0x47e4a3;var _0x11fa6e;return db[_0xcfff('0x35')]['findOne']({'where':{'id':_0x553a54[_0xcfff('0x4c')]['id']}})[_0xcfff('0x2b')](handleEntityNotFound(_0x1e0ddf,null))[_0xcfff('0x2b')](function(_0x4715f6){if(_0x4715f6){_0x47e4a3=_0x4715f6;_0x259cbe['model']=_[_0xcfff('0x3c')](db['User']['rawAttributes']);_0x259cbe[_0xcfff('0x3b')]=_[_0xcfff('0x3c')](_0x553a54[_0xcfff('0x3b')]);_0x259cbe[_0xcfff('0x3d')]=_[_0xcfff('0x3e')](_0x259cbe[_0xcfff('0x39')],_0x259cbe[_0xcfff('0x3b')]);_0x16ba5f[_0xcfff('0x3f')]=_[_0xcfff('0x3e')](_0x259cbe['model'],qs['fields'](_0x553a54[_0xcfff('0x3b')][_0xcfff('0x4d')]));_0x16ba5f[_0xcfff('0x3f')]=_0x16ba5f[_0xcfff('0x3f')][_0xcfff('0x4e')]?_0x16ba5f[_0xcfff('0x3f')]:_0x259cbe[_0xcfff('0x39')];_0x16ba5f[_0xcfff('0x42')]=qs[_0xcfff('0x5e')](_0x553a54['query'][_0xcfff('0x5e')]);_0x16ba5f[_0xcfff('0x43')]=qs[_0xcfff('0x3d')](_[_0xcfff('0x5f')](_0x553a54['query'],_0x259cbe['filters']));if(_0x553a54[_0xcfff('0x3b')][_0xcfff('0x45')]){_0x16ba5f[_0xcfff('0x43')]=_[_0xcfff('0x46')](_0x16ba5f[_0xcfff('0x43')],{'$or':_['map'](_0x16ba5f[_0xcfff('0x3f')],function(_0x4bd658){var _0xf04380={};_0xf04380[_0x4bd658]={'$like':'%'+_0x553a54['query']['filter']+'%'};return _0xf04380;})});}_0x16ba5f=_['merge']({},_0x16ba5f,_0x553a54[_0xcfff('0x47')]);return _0x47e4a3[_0xcfff('0x90')](_0x16ba5f);}})['then'](function(_0xbec751){if(_0xbec751){_0x11fa6e=_0xbec751[_0xcfff('0x4e')];if(!_0x553a54[_0xcfff('0x3b')][_0xcfff('0x40')]('nolimit')){_0x16ba5f[_0xcfff('0x24')]=qs[_0xcfff('0x24')](_0x553a54[_0xcfff('0x3b')]['limit']);_0x16ba5f[_0xcfff('0x26')]=qs[_0xcfff('0x26')](_0x553a54[_0xcfff('0x3b')][_0xcfff('0x26')]);}return _0x47e4a3[_0xcfff('0x90')](_0x16ba5f);}})[_0xcfff('0x2b')](function(_0x1ab0dc){if(_0x1ab0dc){return _0x1ab0dc?{'count':_0x11fa6e,'rows':_0x1ab0dc}:null;}})[_0xcfff('0x2b')](respondWithResult(_0x1e0ddf,null))['catch'](handleError(_0x1e0ddf,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 854bfd2..da9c478 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 _0xa315=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x8c110a,_0x4c1d23){var _0x2f50fd=function(_0x5f7a37){while(--_0x5f7a37){_0x8c110a['push'](_0x8c110a['shift']());}};_0x2f50fd(++_0x4c1d23);}(_0xa315,0x71));var _0x5a31=function(_0x11309c,_0xe18a74){_0x11309c=_0x11309c-0x0;var _0x3fea9c=_0xa315[_0x11309c];return _0x3fea9c;};'use strict';var EventEmitter=require(_0x5a31('0x0'));var FaxQueue=require(_0x5a31('0x1'))['db'][_0x5a31('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5a31('0x3')](0x0);var events={'afterCreate':_0x5a31('0x4'),'afterUpdate':'update','afterDestroy':_0x5a31('0x5')};function emitEvent(_0x2c6e2a){return function(_0x35ff06,_0x35f946,_0x17f7d6){FaxQueueEvents[_0x5a31('0x6')](_0x2c6e2a+':'+_0x35ff06['id'],_0x35ff06);FaxQueueEvents[_0x5a31('0x6')](_0x2c6e2a,_0x35ff06);_0x17f7d6(null);};}for(var e in events){if(events[_0x5a31('0x7')](e)){var event=events[e];FaxQueue[_0x5a31('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xf31b=['emit','hook','events','FaxQueue','setMaxListeners','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf31b,0x1c2));var _0xbf31=function(_0x3a254d,_0x4e8366){_0x3a254d=_0x3a254d-0x0;var _0x183691=_0xf31b[_0x3a254d];return _0x183691;};'use strict';var EventEmitter=require(_0xbf31('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xbf31('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbf31('0x2')](0x0);var events={'afterCreate':_0xbf31('0x3'),'afterUpdate':'update','afterDestroy':_0xbf31('0x4')};function emitEvent(_0xa0dca9){return function(_0x15d139,_0x11bd54,_0x161caf){FaxQueueEvents[_0xbf31('0x5')](_0xa0dca9+':'+_0x15d139['id'],_0x15d139);FaxQueueEvents['emit'](_0xa0dca9,_0x15d139);_0x161caf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xbf31('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 02be3e5..364cd26 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 _0x3088=['exports','define','fax_queues','lodash','util','moment','bluebird','request-promise','rimraf','./faxQueue.attributes'];(function(_0x4ae2d5,_0x2161c6){var _0x387ea1=function(_0x5b1b5b){while(--_0x5b1b5b){_0x4ae2d5['push'](_0x4ae2d5['shift']());}};_0x387ea1(++_0x2161c6);}(_0x3088,0x193));var _0x8308=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x3088[_0x352e09];return _0x1b7094;};'use strict';var _=require(_0x8308('0x0'));var util=require(_0x8308('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8308('0x2'));var BPromise=require(_0x8308('0x3'));var rp=require(_0x8308('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8308('0x5'));var config=require('../../config/environment');var attributes=require(_0x8308('0x6'));module[_0x8308('0x7')]=function(_0x4e0c15,_0x420131){return _0x4e0c15[_0x8308('0x8')]('FaxQueue',attributes,{'tableName':_0x8308('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues'];(function(_0x2603b4,_0x503100){var _0x12d39c=function(_0x4176e4){while(--_0x4176e4){_0x2603b4['push'](_0x2603b4['shift']());}};_0x12d39c(++_0x503100);}(_0xcdd5,0x186));var _0x5cdd=function(_0x19cae9,_0xd6039b){_0x19cae9=_0x19cae9-0x0;var _0x163452=_0xcdd5[_0x19cae9];return _0x163452;};'use strict';var _=require(_0x5cdd('0x0'));var util=require(_0x5cdd('0x1'));var logger=require(_0x5cdd('0x2'))(_0x5cdd('0x3'));var moment=require(_0x5cdd('0x4'));var BPromise=require(_0x5cdd('0x5'));var rp=require(_0x5cdd('0x6'));var fs=require('fs');var path=require(_0x5cdd('0x7'));var rimraf=require(_0x5cdd('0x8'));var config=require(_0x5cdd('0x9'));var attributes=require(_0x5cdd('0xa'));module[_0x5cdd('0xb')]=function(_0x370d12,_0x22d0e4){return _0x370d12[_0x5cdd('0xc')](_0x5cdd('0xd'),attributes,{'tableName':_0x5cdd('0xe'),'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 886621f..f463fb0 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 _0x77b3=['defaults','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','attributes','map','model','ShowFaxQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis'];(function(_0x549928,_0x363b7a){var _0x941e27=function(_0x280fe6){while(--_0x280fe6){_0x549928['push'](_0x549928['shift']());}};_0x941e27(++_0x363b7a);}(_0x77b3,0x95));var _0x377b=function(_0x29e342,_0x160ebc){_0x29e342=_0x29e342-0x0;var _0x1a0fd7=_0x77b3[_0x29e342];return _0x1a0fd7;};'use strict';var _=require(_0x377b('0x0'));var util=require(_0x377b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x377b('0x2'));var fs=require('fs');var Redis=require(_0x377b('0x3'));var db=require(_0x377b('0x4'))['db'];var utils=require(_0x377b('0x5'));var logger=require(_0x377b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x377b('0x7'));var client=jayson[_0x377b('0x8')][_0x377b('0x9')]({'port':0x232a});config[_0x377b('0xa')]=_[_0x377b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x377b('0xc'))(new Redis(config[_0x377b('0xa')]));require(_0x377b('0xd'))[_0x377b('0xe')](socket);function respondWithRpcPromise(_0x664e0c,_0x1e4a4a,_0x129b04){return new BPromise(function(_0x2ffe6a,_0x188e5e){return client[_0x377b('0xf')](_0x664e0c,_0x129b04)[_0x377b('0x10')](function(_0x27f0a6){logger['info'](_0x377b('0x11'),_0x1e4a4a,'request\x20sent');logger[_0x377b('0x12')](_0x377b('0x13'),_0x1e4a4a,_0x377b('0x14'),JSON['stringify'](_0x27f0a6));if(_0x27f0a6[_0x377b('0x15')]){if(_0x27f0a6['error'][_0x377b('0x16')]===0x1f4){logger['error'](_0x377b('0x11'),_0x1e4a4a,_0x27f0a6[_0x377b('0x15')][_0x377b('0x17')]);return _0x188e5e(_0x27f0a6[_0x377b('0x15')]['message']);}logger[_0x377b('0x15')](_0x377b('0x11'),_0x1e4a4a,_0x27f0a6[_0x377b('0x15')][_0x377b('0x17')]);return _0x2ffe6a(_0x27f0a6[_0x377b('0x15')][_0x377b('0x17')]);}else{logger[_0x377b('0x18')]('FaxQueue,\x20%s,\x20%s',_0x1e4a4a,'request\x20sent');_0x2ffe6a(_0x27f0a6[_0x377b('0x19')][_0x377b('0x17')]);}})[_0x377b('0x1a')](function(_0xbb0935){logger[_0x377b('0x15')]('FaxQueue,\x20%s,\x20%s',_0x1e4a4a,_0xbb0935);_0x188e5e(_0xbb0935);});});}exports[_0x377b('0x1b')]=function(_0x20c3dc){var _0x2fa899=this;return new Promise(function(_0x2bd8ef,_0x2e6ed1){return db[_0x377b('0x1c')][_0x377b('0x1d')]({'raw':_0x20c3dc['options']?_0x20c3dc[_0x377b('0x1e')][_0x377b('0x1f')]===undefined?!![]:![]:!![],'where':_0x20c3dc[_0x377b('0x1e')]?_0x20c3dc[_0x377b('0x1e')][_0x377b('0x20')]||null:null,'attributes':_0x20c3dc[_0x377b('0x1e')]?_0x20c3dc[_0x377b('0x1e')]['attributes']||null:null,'limit':_0x20c3dc[_0x377b('0x1e')]?_0x20c3dc[_0x377b('0x1e')][_0x377b('0x21')]||null:null,'include':_0x20c3dc[_0x377b('0x1e')]?_0x20c3dc[_0x377b('0x1e')][_0x377b('0x22')]?_['map'](_0x20c3dc[_0x377b('0x1e')]['include'],function(_0x1f4327){return{'model':db[_0x1f4327['model']],'as':_0x1f4327['as'],'attributes':_0x1f4327[_0x377b('0x23')],'include':_0x1f4327[_0x377b('0x22')]?_[_0x377b('0x24')](_0x1f4327[_0x377b('0x22')],function(_0x2c9130){return{'model':db[_0x2c9130['model']],'as':_0x2c9130['as'],'attributes':_0x2c9130['attributes'],'include':_0x2c9130['include']?_[_0x377b('0x24')](_0x2c9130[_0x377b('0x22')],function(_0xa0c8b8){return{'model':db[_0xa0c8b8[_0x377b('0x25')]],'as':_0xa0c8b8['as'],'attributes':_0xa0c8b8[_0x377b('0x23')]};}):[]};}):[]};}):[]:[]})[_0x377b('0x10')](function(_0x539454){logger[_0x377b('0x18')](_0x377b('0x1b'),_0x20c3dc);logger[_0x377b('0x12')](_0x377b('0x1b'),_0x20c3dc,JSON['stringify'](_0x539454));_0x2bd8ef(_0x539454);})[_0x377b('0x1a')](function(_0x5ac270){logger['error'](_0x377b('0x1b'),_0x5ac270[_0x377b('0x17')],_0x20c3dc);_0x2e6ed1(_0x2fa899[_0x377b('0x15')](0x1f4,_0x5ac270['message']));});});};exports[_0x377b('0x26')]=function(_0x2e75cf){var _0x345099=this;return new Promise(function(_0x54112c,_0x153aa8){return db[_0x377b('0x1c')][_0x377b('0x27')]({'raw':_0x2e75cf['options']?_0x2e75cf[_0x377b('0x1e')][_0x377b('0x1f')]===undefined?!![]:![]:!![],'where':_0x2e75cf[_0x377b('0x1e')]?_0x2e75cf['options'][_0x377b('0x20')]||null:null,'attributes':_0x2e75cf[_0x377b('0x1e')]?_0x2e75cf[_0x377b('0x1e')][_0x377b('0x23')]||null:null,'include':_0x2e75cf[_0x377b('0x1e')]?_0x2e75cf[_0x377b('0x1e')][_0x377b('0x22')]?_[_0x377b('0x24')](_0x2e75cf[_0x377b('0x1e')][_0x377b('0x22')],function(_0x569c17){return{'model':db[_0x569c17[_0x377b('0x25')]],'as':_0x569c17['as'],'attributes':_0x569c17['attributes'],'include':_0x569c17[_0x377b('0x22')]?_['map'](_0x569c17[_0x377b('0x22')],function(_0x2785c9){return{'model':db[_0x2785c9[_0x377b('0x25')]],'as':_0x2785c9['as'],'attributes':_0x2785c9[_0x377b('0x23')],'include':_0x2785c9['include']?_[_0x377b('0x24')](_0x2785c9[_0x377b('0x22')],function(_0x5a8a66){return{'model':db[_0x5a8a66['model']],'as':_0x5a8a66['as'],'attributes':_0x5a8a66[_0x377b('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5814b8){logger[_0x377b('0x18')]('ShowFaxQueue',_0x2e75cf);logger[_0x377b('0x12')](_0x377b('0x26'),_0x2e75cf,JSON['stringify'](_0x5814b8));_0x54112c(_0x5814b8);})[_0x377b('0x1a')](function(_0xbc2390){logger[_0x377b('0x15')]('ShowFaxQueue',_0xbc2390['message'],_0x2e75cf);_0x153aa8(_0x345099[_0x377b('0x15')](0x1f4,_0xbc2390[_0x377b('0x17')]));});});}; \ No newline at end of file +var _0xbfde=['ShowFaxQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','map','include','model','find'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xbfde,0xbf));var _0xebfd=function(_0x3369d7,_0x4fc97a){_0x3369d7=_0x3369d7-0x0;var _0x1fa167=_0xbfde[_0x3369d7];return _0x1fa167;};'use strict';var _=require(_0xebfd('0x0'));var util=require(_0xebfd('0x1'));var moment=require('moment');var BPromise=require(_0xebfd('0x2'));var rs=require(_0xebfd('0x3'));var fs=require('fs');var Redis=require(_0xebfd('0x4'));var db=require(_0xebfd('0x5'))['db'];var utils=require(_0xebfd('0x6'));var logger=require('../../config/logger')(_0xebfd('0x7'));var config=require(_0xebfd('0x8'));var jayson=require(_0xebfd('0x9'));var client=jayson[_0xebfd('0xa')]['http']({'port':0x232a});config[_0xebfd('0xb')]=_[_0xebfd('0xc')](config[_0xebfd('0xb')],{'host':_0xebfd('0xd'),'port':0x18eb});var socket=require(_0xebfd('0xe'))(new Redis(config[_0xebfd('0xb')]));require(_0xebfd('0xf'))[_0xebfd('0x10')](socket);function respondWithRpcPromise(_0x2f6ce6,_0x5424b5,_0x4401f3){return new BPromise(function(_0x59a979,_0x36e265){return client['request'](_0x2f6ce6,_0x4401f3)[_0xebfd('0x11')](function(_0x3f26d1){logger[_0xebfd('0x12')](_0xebfd('0x13'),_0x5424b5,_0xebfd('0x14'));logger[_0xebfd('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5424b5,'request\x20sent',JSON['stringify'](_0x3f26d1));if(_0x3f26d1[_0xebfd('0x16')]){if(_0x3f26d1[_0xebfd('0x16')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x5424b5,_0x3f26d1[_0xebfd('0x16')][_0xebfd('0x17')]);return _0x36e265(_0x3f26d1[_0xebfd('0x16')][_0xebfd('0x17')]);}logger[_0xebfd('0x16')]('FaxQueue,\x20%s,\x20%s',_0x5424b5,_0x3f26d1[_0xebfd('0x16')][_0xebfd('0x17')]);return _0x59a979(_0x3f26d1[_0xebfd('0x16')][_0xebfd('0x17')]);}else{logger[_0xebfd('0x12')](_0xebfd('0x13'),_0x5424b5,'request\x20sent');_0x59a979(_0x3f26d1[_0xebfd('0x18')][_0xebfd('0x17')]);}})[_0xebfd('0x19')](function(_0x4c2878){logger[_0xebfd('0x16')](_0xebfd('0x13'),_0x5424b5,_0x4c2878);_0x36e265(_0x4c2878);});});}exports[_0xebfd('0x1a')]=function(_0x49f917){var _0x36871=this;return new Promise(function(_0x3d357f,_0xfe5e94){return db[_0xebfd('0x1b')]['findAll']({'raw':_0x49f917['options']?_0x49f917[_0xebfd('0x1c')][_0xebfd('0x1d')]===undefined?!![]:![]:!![],'where':_0x49f917['options']?_0x49f917[_0xebfd('0x1c')][_0xebfd('0x1e')]||null:null,'attributes':_0x49f917[_0xebfd('0x1c')]?_0x49f917[_0xebfd('0x1c')][_0xebfd('0x1f')]||null:null,'limit':_0x49f917[_0xebfd('0x1c')]?_0x49f917[_0xebfd('0x1c')][_0xebfd('0x20')]||null:null,'include':_0x49f917['options']?_0x49f917['options']['include']?_[_0xebfd('0x21')](_0x49f917[_0xebfd('0x1c')][_0xebfd('0x22')],function(_0x1b3101){return{'model':db[_0x1b3101[_0xebfd('0x23')]],'as':_0x1b3101['as'],'attributes':_0x1b3101[_0xebfd('0x1f')],'include':_0x1b3101['include']?_['map'](_0x1b3101['include'],function(_0x4df3f3){return{'model':db[_0x4df3f3[_0xebfd('0x23')]],'as':_0x4df3f3['as'],'attributes':_0x4df3f3['attributes'],'include':_0x4df3f3['include']?_[_0xebfd('0x21')](_0x4df3f3[_0xebfd('0x22')],function(_0x141744){return{'model':db[_0x141744[_0xebfd('0x23')]],'as':_0x141744['as'],'attributes':_0x141744['attributes']};}):[]};}):[]};}):[]:[]})[_0xebfd('0x11')](function(_0x265d92){logger[_0xebfd('0x12')](_0xebfd('0x1a'),_0x49f917);logger['debug']('GetFaxQueue',_0x49f917,JSON['stringify'](_0x265d92));_0x3d357f(_0x265d92);})[_0xebfd('0x19')](function(_0x1fe741){logger[_0xebfd('0x16')](_0xebfd('0x1a'),_0x1fe741[_0xebfd('0x17')],_0x49f917);_0xfe5e94(_0x36871[_0xebfd('0x16')](0x1f4,_0x1fe741[_0xebfd('0x17')]));});});};exports['ShowFaxQueue']=function(_0x1e5100){var _0x4d4df9=this;return new Promise(function(_0x547a78,_0x3e235f){return db[_0xebfd('0x1b')][_0xebfd('0x24')]({'raw':_0x1e5100['options']?_0x1e5100[_0xebfd('0x1c')][_0xebfd('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e5100[_0xebfd('0x1c')]?_0x1e5100[_0xebfd('0x1c')][_0xebfd('0x1e')]||null:null,'attributes':_0x1e5100[_0xebfd('0x1c')]?_0x1e5100[_0xebfd('0x1c')]['attributes']||null:null,'include':_0x1e5100['options']?_0x1e5100[_0xebfd('0x1c')][_0xebfd('0x22')]?_[_0xebfd('0x21')](_0x1e5100['options']['include'],function(_0x16d0c4){return{'model':db[_0x16d0c4[_0xebfd('0x23')]],'as':_0x16d0c4['as'],'attributes':_0x16d0c4[_0xebfd('0x1f')],'include':_0x16d0c4[_0xebfd('0x22')]?_['map'](_0x16d0c4[_0xebfd('0x22')],function(_0x22b79f){return{'model':db[_0x22b79f[_0xebfd('0x23')]],'as':_0x22b79f['as'],'attributes':_0x22b79f[_0xebfd('0x1f')],'include':_0x22b79f['include']?_[_0xebfd('0x21')](_0x22b79f[_0xebfd('0x22')],function(_0x2e0e05){return{'model':db[_0x2e0e05[_0xebfd('0x23')]],'as':_0x2e0e05['as'],'attributes':_0x2e0e05[_0xebfd('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x229893){logger[_0xebfd('0x12')](_0xebfd('0x25'),_0x1e5100);logger[_0xebfd('0x15')](_0xebfd('0x25'),_0x1e5100,JSON['stringify'](_0x229893));_0x547a78(_0x229893);})[_0xebfd('0x19')](function(_0x23af5e){logger['error']('ShowFaxQueue',_0x23af5e[_0xebfd('0x17')],_0x1e5100);_0x3e235f(_0x4d4df9['error'](0x1f4,_0x23af5e[_0xebfd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 040aedb..58fc096 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 _0xd187=['emit','removeListener','register','faxQueue:','./faxQueue.events','save','remove'];(function(_0x4a6468,_0x548b1a){var _0x2d8a06=function(_0x49395b){while(--_0x49395b){_0x4a6468['push'](_0x4a6468['shift']());}};_0x2d8a06(++_0x548b1a);}(_0xd187,0x90));var _0x7d18=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0xd187[_0x52f159];return _0x156799;};'use strict';var FaxQueueEvents=require(_0x7d18('0x0'));var events=[_0x7d18('0x1'),_0x7d18('0x2'),'update'];function createListener(_0xb25ed8,_0x32ee20){return function(_0x2f65f2){_0x32ee20[_0x7d18('0x3')](_0xb25ed8,_0x2f65f2);};}function removeListener(_0x305cf7,_0x2ceb9a){return function(){FaxQueueEvents[_0x7d18('0x4')](_0x305cf7,_0x2ceb9a);};}exports[_0x7d18('0x5')]=function(_0x520109){for(var _0x30e2bd=0x0,_0x4757be=events['length'];_0x30e2bd<_0x4757be;_0x30e2bd++){var _0x2e5993=events[_0x30e2bd];var _0x3ce418=createListener(_0x7d18('0x6')+_0x2e5993,_0x520109);FaxQueueEvents['on'](_0x2e5993,_0x3ce418);}}; \ No newline at end of file +var _0xc76d=['emit','removeListener','length','faxQueue:','./faxQueue.events','remove'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc76d,0xe2));var _0xdc76=function(_0x58e8eb,_0x2ac0c7){_0x58e8eb=_0x58e8eb-0x0;var _0x168540=_0xc76d[_0x58e8eb];return _0x168540;};'use strict';var FaxQueueEvents=require(_0xdc76('0x0'));var events=['save',_0xdc76('0x1'),'update'];function createListener(_0x2b58af,_0x6b32aa){return function(_0x35bf1b){_0x6b32aa[_0xdc76('0x2')](_0x2b58af,_0x35bf1b);};}function removeListener(_0xdce836,_0x27f9e5){return function(){FaxQueueEvents[_0xdc76('0x3')](_0xdce836,_0x27f9e5);};}exports['register']=function(_0x55068b){for(var _0xeb53a0=0x0,_0x5101ea=events[_0xdc76('0x4')];_0xeb53a0<_0x5101ea;_0xeb53a0++){var _0x163157=events[_0xeb53a0];var _0x13526f=createListener(_0xdc76('0x5')+_0x163157,_0x55068b);FaxQueueEvents['on'](_0x163157,_0x13526f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index accf7c8..8fb0046 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','update','delete','removeAgents','exports','multer','util','path'];(function(_0x5064a3,_0x5ec65c){var _0x1eade5=function(_0x19ecf7){while(--_0x19ecf7){_0x5064a3['push'](_0x5064a3['shift']());}};_0x1eade5(++_0x5ec65c);}(_0x2ef3,0xba));var _0x32ef=function(_0x5533be,_0xf38417){_0x5533be=_0x5533be-0x0;var _0x46b5c4=_0x2ef3[_0x5533be];return _0x46b5c4;};'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['getMembers']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['get'](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router['post']('/',auth[_0x32ef('0xb')](),controller[_0x32ef('0x14')]);router['post']('/:id/teams',auth[_0x32ef('0xb')](),controller['addTeams']);router[_0x32ef('0x15')](_0x32ef('0x12'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x32ef('0x17')]);router[_0x32ef('0x18')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x32ef('0x18')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller['removeTeams']);router[_0x32ef('0x18')](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x19')]);module[_0x32ef('0x1a')]=router; \ No newline at end of file +var _0x50e5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x259f93,_0x27bab0){var _0x128e24=function(_0x94c1fb){while(--_0x94c1fb){_0x259f93['push'](_0x259f93['shift']());}};_0x128e24(++_0x27bab0);}(_0x50e5,0xb7));var _0x550e=function(_0x16eb74,_0x456d2e){_0x16eb74=_0x16eb74-0x0;var _0x1c6f47=_0x50e5[_0x16eb74];return _0x1c6f47;};'use strict';var multer=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var path=require('path');var timeout=require(_0x550e('0x2'));var express=require(_0x550e('0x3'));var router=express[_0x550e('0x4')]();var fs_extra=require(_0x550e('0x5'));var auth=require(_0x550e('0x6'));var interaction=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var controller=require(_0x550e('0x9'));router[_0x550e('0xa')]('/',auth[_0x550e('0xb')](),controller[_0x550e('0xc')]);router[_0x550e('0xa')]('/describe',auth[_0x550e('0xb')](),controller[_0x550e('0xd')]);router['get'](_0x550e('0xe'),auth[_0x550e('0xb')](),controller[_0x550e('0xf')]);router['get'](_0x550e('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0x550e('0xa')](_0x550e('0x11'),auth['isAuthenticated'](),controller[_0x550e('0x12')]);router[_0x550e('0xa')](_0x550e('0x13'),auth[_0x550e('0xb')](),controller['getAgents']);router[_0x550e('0x14')]('/',auth['isAuthenticated'](),controller[_0x550e('0x15')]);router['post'](_0x550e('0x11'),auth[_0x550e('0xb')](),controller[_0x550e('0x16')]);router[_0x550e('0x14')](_0x550e('0x13'),auth['isAuthenticated'](),controller[_0x550e('0x17')]);router['put'](_0x550e('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x550e('0x18')](_0x550e('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x550e('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x550e('0x18')](_0x550e('0x13'),auth[_0x550e('0xb')](),controller[_0x550e('0x19')]);module[_0x550e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 69b12b1..e4ae1bd 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 _0x0047=['exports','STRING','DATE','moment','sequelize'];(function(_0x3faa54,_0x1679c8){var _0x46d9e3=function(_0x54b41e){while(--_0x54b41e){_0x3faa54['push'](_0x3faa54['shift']());}};_0x46d9e3(++_0x1679c8);}(_0x0047,0x99));var _0x7004=function(_0x4d121d,_0x3fe733){_0x4d121d=_0x4d121d-0x0;var _0xffa031=_0x0047[_0x4d121d];return _0xffa031;};'use strict';var moment=require(_0x7004('0x0'));var Sequelize=require(_0x7004('0x1'));module[_0x7004('0x2')]={'uniqueid':{'type':Sequelize[_0x7004('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7004('0x3')]},'joinAt':{'type':Sequelize[_0x7004('0x4')]},'leaveAt':{'type':Sequelize[_0x7004('0x4')]},'acceptAt':{'type':Sequelize[_0x7004('0x4')]},'exitAt':{'type':Sequelize[_0x7004('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4677=['DATE','moment','sequelize','exports','STRING'];(function(_0x295e5e,_0x186102){var _0x448501=function(_0x4eb981){while(--_0x4eb981){_0x295e5e['push'](_0x295e5e['shift']());}};_0x448501(++_0x186102);}(_0x4677,0x105));var _0x7467=function(_0x5aceca,_0x94d09){_0x5aceca=_0x5aceca-0x0;var _0x455968=_0x4677[_0x5aceca];return _0x455968;};'use strict';var moment=require(_0x7467('0x0'));var Sequelize=require(_0x7467('0x1'));module[_0x7467('0x2')]={'uniqueid':{'type':Sequelize[_0x7467('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7467('0x3')]},'joinAt':{'type':Sequelize[_0x7467('0x4')]},'leaveAt':{'type':Sequelize[_0x7467('0x4')]},'acceptAt':{'type':Sequelize[_0x7467('0x4')]},'exitAt':{'type':Sequelize[_0x7467('0x4')]},'reason':{'type':Sequelize[_0x7467('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 64a907c..aeea09e 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 _0x705f=['apply','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','pick','where','merge','filter','count','includeAll','FaxQueueReport','findAll','rows','catch','show','rawAttributes','fields','include','options','find','create','body','params','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','Content-Range','json'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x705f,0x75));var _0xf705=function(_0x326407,_0x2c9181){_0x326407=_0x326407-0x0;var _0x1b69f1=_0x705f[_0x326407];return _0x1b69f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf705('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf705('0x1'));var moment=require(_0xf705('0x2'));var BPromise=require(_0xf705('0x3'));var Mustache=require(_0xf705('0x4'));var util=require(_0xf705('0x5'));var path=require(_0xf705('0x6'));var sox=require(_0xf705('0x7'));var csv=require(_0xf705('0x8'));var ejs=require(_0xf705('0x9'));var fs=require('fs');var fs_extra=require(_0xf705('0xa'));var _=require(_0xf705('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf705('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf705('0x8'));var querystring=require(_0xf705('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf705('0xe'));var qs=require(_0xf705('0xf'));var as=require(_0xf705('0x10'));var hardwareService=require(_0xf705('0x11'));var logger=require(_0xf705('0x12'))(_0xf705('0x13'));var utils=require(_0xf705('0x14'));var config=require(_0xf705('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf705('0x16'))['db'];function respondWithStatusCode(_0x296a62,_0xb50c9f){_0xb50c9f=_0xb50c9f||0xcc;return function(_0xf625da){if(_0xf625da){return _0x296a62[_0xf705('0x17')](_0xb50c9f);}return _0x296a62['status'](_0xb50c9f)['end']();};}function respondWithResult(_0x26cb9a,_0x10763f){_0x10763f=_0x10763f||0xc8;return function(_0x15d2e2){if(_0x15d2e2){return _0x26cb9a[_0xf705('0x18')](_0x10763f)['json'](_0x15d2e2);}};}function respondWithFilteredResult(_0x9c7b75,_0x23a64b){return function(_0x4555a8){if(_0x4555a8){var _0x32f48b=typeof _0x23a64b['offset']===_0xf705('0x19')&&typeof _0x23a64b['limit']===_0xf705('0x19');var _0x1c0778=_0x4555a8['count'];var _0xa9a2ca=_0x32f48b?0x0:_0x23a64b['offset'];var _0x425cd6=_0x32f48b?_0x4555a8['count']:_0x23a64b['offset']+_0x23a64b[_0xf705('0x1a')];var _0xfee2a8;if(_0x425cd6>=_0x1c0778){_0x425cd6=_0x1c0778;_0xfee2a8=0xc8;}else{_0xfee2a8=0xce;}_0x9c7b75[_0xf705('0x18')](_0xfee2a8);return _0x9c7b75['set'](_0xf705('0x1b'),_0xa9a2ca+'-'+_0x425cd6+'/'+_0x1c0778)[_0xf705('0x1c')](_0x4555a8);}return null;};}function patchUpdates(_0x8d5b49){return function(_0x57456a){try{jsonpatch[_0xf705('0x1d')](_0x57456a,_0x8d5b49,!![]);}catch(_0x4d34cd){return BPromise['reject'](_0x4d34cd);}return _0x57456a[_0xf705('0x1e')]();};}function saveUpdates(_0x1052a6,_0x2a2fb7){return function(_0x24622b){if(_0x24622b){return _0x24622b[_0xf705('0x1f')](_0x1052a6)[_0xf705('0x20')](function(_0xcab54f){return _0xcab54f;});}return null;};}function removeEntity(_0x10dfc9,_0x424d4e){return function(_0x39dddb){if(_0x39dddb){return _0x39dddb[_0xf705('0x21')]()['then'](function(){_0x10dfc9[_0xf705('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bb4a,_0x4ccff8){return function(_0x5eadda){if(!_0x5eadda){_0x23bb4a[_0xf705('0x17')](0x194);}return _0x5eadda;};}function handleError(_0x33da21,_0x593180){_0x593180=_0x593180||0x1f4;return function(_0x4f5435){logger[_0xf705('0x22')](_0x4f5435[_0xf705('0x23')]);if(_0x4f5435[_0xf705('0x24')]){delete _0x4f5435[_0xf705('0x24')];}_0x33da21[_0xf705('0x18')](_0x593180)['send'](_0x4f5435);};}exports[_0xf705('0x25')]=function(_0x2c4a5d,_0x3a6343){var _0x54f905={},_0x4a09ab={},_0x4a0fd3={'count':0x0,'rows':[]};var _0x54ff43=_[_0xf705('0x26')](db['FaxQueueReport']['rawAttributes'],function(_0x29ac24){return{'name':_0x29ac24[_0xf705('0x27')],'type':_0x29ac24[_0xf705('0x28')][_0xf705('0x29')]};});_0x4a09ab[_0xf705('0x2a')]=_['map'](_0x54ff43,'name');_0x4a09ab[_0xf705('0x2b')]=_[_0xf705('0x2c')](_0x2c4a5d[_0xf705('0x2b')]);_0x4a09ab[_0xf705('0x2d')]=_[_0xf705('0x2e')](_0x4a09ab[_0xf705('0x2a')],_0x4a09ab[_0xf705('0x2b')]);_0x54f905[_0xf705('0x2f')]=_['intersection'](_0x4a09ab[_0xf705('0x2a')],qs['fields'](_0x2c4a5d[_0xf705('0x2b')]['fields']));_0x54f905[_0xf705('0x2f')]=_0x54f905[_0xf705('0x2f')][_0xf705('0x30')]?_0x54f905[_0xf705('0x2f')]:_0x4a09ab[_0xf705('0x2a')];if(!_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x31')]('nolimit')){_0x54f905[_0xf705('0x1a')]=qs[_0xf705('0x1a')](_0x2c4a5d[_0xf705('0x2b')]['limit']);_0x54f905['offset']=qs[_0xf705('0x32')](_0x2c4a5d['query'][_0xf705('0x32')]);}_0x54f905[_0xf705('0x33')]=qs[_0xf705('0x34')](_0x2c4a5d['query'][_0xf705('0x34')]);_0x54f905['where']=qs[_0xf705('0x2d')](_[_0xf705('0x35')](_0x2c4a5d[_0xf705('0x2b')],_0x4a09ab['filters']),_0x54ff43);if(_0x2c4a5d[_0xf705('0x2b')]['filter']){_0x54f905[_0xf705('0x36')]=_[_0xf705('0x37')](_0x54f905[_0xf705('0x36')],{'$or':_[_0xf705('0x26')](_0x54ff43,function(_0x38f9d5){if(_0x38f9d5[_0xf705('0x28')]!=='VIRTUAL'){var _0x2b9902={};_0x2b9902[_0x38f9d5[_0xf705('0x24')]]={'$like':'%'+_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x38')]+'%'};return _0x2b9902;}})});}_0x54f905=_['merge']({},_0x54f905,_0x2c4a5d['options']);var _0x3b02f7={'where':_0x54f905[_0xf705('0x36')]};return db['FaxQueueReport'][_0xf705('0x39')](_0x3b02f7)[_0xf705('0x20')](function(_0x10e28b){_0x4a0fd3['count']=_0x10e28b;if(_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x3a')]){_0x54f905['include']=[{'all':!![]}];}return db[_0xf705('0x3b')][_0xf705('0x3c')](_0x54f905);})[_0xf705('0x20')](function(_0x4382cd){_0x4a0fd3[_0xf705('0x3d')]=_0x4382cd;return _0x4a0fd3;})[_0xf705('0x20')](respondWithFilteredResult(_0x3a6343,_0x54f905))[_0xf705('0x3e')](handleError(_0x3a6343,null));};exports[_0xf705('0x3f')]=function(_0x3355b1,_0x108663){var _0x343f1a={'raw':!![],'where':{'id':_0x3355b1['params']['id']}},_0x50520d={};_0x50520d['model']=_[_0xf705('0x2c')](db[_0xf705('0x3b')][_0xf705('0x40')]);_0x50520d['query']=_[_0xf705('0x2c')](_0x3355b1[_0xf705('0x2b')]);_0x50520d[_0xf705('0x2d')]=_[_0xf705('0x2e')](_0x50520d[_0xf705('0x2a')],_0x50520d[_0xf705('0x2b')]);_0x343f1a['attributes']=_['intersection'](_0x50520d[_0xf705('0x2a')],qs[_0xf705('0x41')](_0x3355b1['query'][_0xf705('0x41')]));_0x343f1a[_0xf705('0x2f')]=_0x343f1a[_0xf705('0x2f')][_0xf705('0x30')]?_0x343f1a['attributes']:_0x50520d[_0xf705('0x2a')];if(_0x3355b1[_0xf705('0x2b')]['includeAll']){_0x343f1a[_0xf705('0x42')]=[{'all':!![]}];}_0x343f1a=_[_0xf705('0x37')]({},_0x343f1a,_0x3355b1[_0xf705('0x43')]);return db[_0xf705('0x3b')][_0xf705('0x44')](_0x343f1a)[_0xf705('0x20')](handleEntityNotFound(_0x108663,null))[_0xf705('0x20')](respondWithResult(_0x108663,null))[_0xf705('0x3e')](handleError(_0x108663,null));};exports[_0xf705('0x45')]=function(_0x4a5a02,_0x5b5463){return db[_0xf705('0x3b')][_0xf705('0x45')](_0x4a5a02['body'],{})[_0xf705('0x20')](respondWithResult(_0x5b5463,0xc9))[_0xf705('0x3e')](handleError(_0x5b5463,null));};exports[_0xf705('0x1f')]=function(_0x2c6861,_0x99c560){if(_0x2c6861[_0xf705('0x46')]['id']){delete _0x2c6861['body']['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x2c6861[_0xf705('0x47')]['id']}})[_0xf705('0x20')](handleEntityNotFound(_0x99c560,null))[_0xf705('0x20')](saveUpdates(_0x2c6861['body'],null))[_0xf705('0x20')](respondWithResult(_0x99c560,null))[_0xf705('0x3e')](handleError(_0x99c560,null));};exports[_0xf705('0x21')]=function(_0x598441,_0x5b8f3f){return db['FaxQueueReport'][_0xf705('0x44')]({'where':{'id':_0x598441[_0xf705('0x47')]['id']}})[_0xf705('0x20')](handleEntityNotFound(_0x5b8f3f,null))[_0xf705('0x20')](removeEntity(_0x5b8f3f,null))[_0xf705('0x3e')](handleError(_0x5b8f3f,null));};exports[_0xf705('0x48')]=function(_0x52a792,_0x149c10){return db[_0xf705('0x3b')][_0xf705('0x48')]()[_0xf705('0x20')](respondWithResult(_0x149c10,null))[_0xf705('0x3e')](handleError(_0x149c10,null));}; \ No newline at end of file +var _0x4fdc=['crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','rows','catch','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x5d322f,_0x28fa05){var _0xc48361=function(_0x5c257f){while(--_0x5c257f){_0x5d322f['push'](_0x5d322f['shift']());}};_0xc48361(++_0x28fa05);}(_0x4fdc,0x84));var _0xc4fd=function(_0x9ebd07,_0x2b782b){_0x9ebd07=_0x9ebd07-0x0;var _0x52b2ee=_0x4fdc[_0x9ebd07];return _0x52b2ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4fd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4fd('0x1'));var rp=require(_0xc4fd('0x2'));var moment=require(_0xc4fd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc4fd('0x4'));var util=require(_0xc4fd('0x5'));var path=require(_0xc4fd('0x6'));var sox=require(_0xc4fd('0x7'));var csv=require(_0xc4fd('0x8'));var ejs=require(_0xc4fd('0x9'));var fs=require('fs');var fs_extra=require(_0xc4fd('0xa'));var _=require('lodash');var squel=require(_0xc4fd('0xb'));var crypto=require(_0xc4fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc4fd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4fd('0xe'));var Redis=require(_0xc4fd('0xf'));var authService=require(_0xc4fd('0x10'));var qs=require(_0xc4fd('0x11'));var as=require(_0xc4fd('0x12'));var hardwareService=require(_0xc4fd('0x13'));var logger=require(_0xc4fd('0x14'))(_0xc4fd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4fd('0x16'));var db=require(_0xc4fd('0x17'))['db'];function respondWithStatusCode(_0x25fc9a,_0x4cecec){_0x4cecec=_0x4cecec||0xcc;return function(_0x31d6c0){if(_0x31d6c0){return _0x25fc9a[_0xc4fd('0x18')](_0x4cecec);}return _0x25fc9a[_0xc4fd('0x19')](_0x4cecec)[_0xc4fd('0x1a')]();};}function respondWithResult(_0x4577a8,_0x29d08c){_0x29d08c=_0x29d08c||0xc8;return function(_0x1d67f0){if(_0x1d67f0){return _0x4577a8[_0xc4fd('0x19')](_0x29d08c)[_0xc4fd('0x1b')](_0x1d67f0);}};}function respondWithFilteredResult(_0x553121,_0x75a44f){return function(_0x4c96e5){if(_0x4c96e5){var _0x5a248c=typeof _0x75a44f[_0xc4fd('0x1c')]===_0xc4fd('0x1d')&&typeof _0x75a44f['limit']==='undefined';var _0x6c739e=_0x4c96e5[_0xc4fd('0x1e')];var _0x2bc246=_0x5a248c?0x0:_0x75a44f[_0xc4fd('0x1c')];var _0xaf6c46=_0x5a248c?_0x4c96e5[_0xc4fd('0x1e')]:_0x75a44f[_0xc4fd('0x1c')]+_0x75a44f['limit'];var _0x1e440f;if(_0xaf6c46>=_0x6c739e){_0xaf6c46=_0x6c739e;_0x1e440f=0xc8;}else{_0x1e440f=0xce;}_0x553121[_0xc4fd('0x19')](_0x1e440f);return _0x553121[_0xc4fd('0x1f')]('Content-Range',_0x2bc246+'-'+_0xaf6c46+'/'+_0x6c739e)['json'](_0x4c96e5);}return null;};}function patchUpdates(_0x1a21ef){return function(_0x254278){try{jsonpatch[_0xc4fd('0x20')](_0x254278,_0x1a21ef,!![]);}catch(_0x3f6fe3){return BPromise[_0xc4fd('0x21')](_0x3f6fe3);}return _0x254278[_0xc4fd('0x22')]();};}function saveUpdates(_0x5bcb6c,_0x5271f8){return function(_0x30900b){if(_0x30900b){return _0x30900b[_0xc4fd('0x23')](_0x5bcb6c)[_0xc4fd('0x24')](function(_0x2eba79){return _0x2eba79;});}return null;};}function removeEntity(_0x1b206b,_0x433eb4){return function(_0x3006ad){if(_0x3006ad){return _0x3006ad[_0xc4fd('0x25')]()[_0xc4fd('0x24')](function(){_0x1b206b['status'](0xcc)[_0xc4fd('0x1a')]();});}};}function handleEntityNotFound(_0x18b1a8,_0x2ce202){return function(_0x2c8831){if(!_0x2c8831){_0x18b1a8[_0xc4fd('0x18')](0x194);}return _0x2c8831;};}function handleError(_0xb6052a,_0x331f1){_0x331f1=_0x331f1||0x1f4;return function(_0x15022d){logger[_0xc4fd('0x26')](_0x15022d['stack']);if(_0x15022d['name']){delete _0x15022d[_0xc4fd('0x27')];}_0xb6052a[_0xc4fd('0x19')](_0x331f1)[_0xc4fd('0x28')](_0x15022d);};}exports[_0xc4fd('0x29')]=function(_0x38ac21,_0x23435e){var _0x546a39={},_0x15d61b={},_0x1b65bd={'count':0x0,'rows':[]};var _0x6b5f5e=_[_0xc4fd('0x2a')](db[_0xc4fd('0x2b')][_0xc4fd('0x2c')],function(_0x193a4a){return{'name':_0x193a4a[_0xc4fd('0x2d')],'type':_0x193a4a['type']['key']};});_0x15d61b[_0xc4fd('0x2e')]=_[_0xc4fd('0x2a')](_0x6b5f5e,_0xc4fd('0x27'));_0x15d61b[_0xc4fd('0x2f')]=_['keys'](_0x38ac21[_0xc4fd('0x2f')]);_0x15d61b['filters']=_[_0xc4fd('0x30')](_0x15d61b[_0xc4fd('0x2e')],_0x15d61b['query']);_0x546a39[_0xc4fd('0x31')]=_[_0xc4fd('0x30')](_0x15d61b[_0xc4fd('0x2e')],qs[_0xc4fd('0x32')](_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x32')]));_0x546a39['attributes']=_0x546a39[_0xc4fd('0x31')][_0xc4fd('0x33')]?_0x546a39[_0xc4fd('0x31')]:_0x15d61b[_0xc4fd('0x2e')];if(!_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x34')](_0xc4fd('0x35'))){_0x546a39['limit']=qs[_0xc4fd('0x36')](_0x38ac21['query']['limit']);_0x546a39[_0xc4fd('0x1c')]=qs['offset'](_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x1c')]);}_0x546a39[_0xc4fd('0x37')]=qs['sort'](_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x38')]);_0x546a39[_0xc4fd('0x39')]=qs[_0xc4fd('0x3a')](_['pick'](_0x38ac21[_0xc4fd('0x2f')],_0x15d61b[_0xc4fd('0x3a')]),_0x6b5f5e);if(_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x3b')]){_0x546a39['where']=_[_0xc4fd('0x3c')](_0x546a39[_0xc4fd('0x39')],{'$or':_['map'](_0x6b5f5e,function(_0xe202af){if(_0xe202af[_0xc4fd('0x3d')]!==_0xc4fd('0x3e')){var _0x337dc7={};_0x337dc7[_0xe202af['name']]={'$like':'%'+_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x3b')]+'%'};return _0x337dc7;}})});}_0x546a39=_['merge']({},_0x546a39,_0x38ac21[_0xc4fd('0x3f')]);var _0x9f2741={'where':_0x546a39[_0xc4fd('0x39')]};return db['FaxQueueReport'][_0xc4fd('0x1e')](_0x9f2741)[_0xc4fd('0x24')](function(_0x18981a){_0x1b65bd[_0xc4fd('0x1e')]=_0x18981a;if(_0x38ac21['query']['includeAll']){_0x546a39[_0xc4fd('0x40')]=[{'all':!![]}];}return db[_0xc4fd('0x2b')]['findAll'](_0x546a39);})[_0xc4fd('0x24')](function(_0xf06c76){_0x1b65bd[_0xc4fd('0x41')]=_0xf06c76;return _0x1b65bd;})[_0xc4fd('0x24')](respondWithFilteredResult(_0x23435e,_0x546a39))[_0xc4fd('0x42')](handleError(_0x23435e,null));};exports['show']=function(_0x3d1584,_0x517fe4){var _0x5c3fe9={'raw':!![],'where':{'id':_0x3d1584[_0xc4fd('0x43')]['id']}},_0xee8027={};_0xee8027['model']=_['keys'](db[_0xc4fd('0x2b')][_0xc4fd('0x2c')]);_0xee8027[_0xc4fd('0x2f')]=_['keys'](_0x3d1584['query']);_0xee8027[_0xc4fd('0x3a')]=_[_0xc4fd('0x30')](_0xee8027[_0xc4fd('0x2e')],_0xee8027[_0xc4fd('0x2f')]);_0x5c3fe9[_0xc4fd('0x31')]=_[_0xc4fd('0x30')](_0xee8027[_0xc4fd('0x2e')],qs[_0xc4fd('0x32')](_0x3d1584[_0xc4fd('0x2f')][_0xc4fd('0x32')]));_0x5c3fe9[_0xc4fd('0x31')]=_0x5c3fe9['attributes'][_0xc4fd('0x33')]?_0x5c3fe9[_0xc4fd('0x31')]:_0xee8027[_0xc4fd('0x2e')];if(_0x3d1584[_0xc4fd('0x2f')]['includeAll']){_0x5c3fe9[_0xc4fd('0x40')]=[{'all':!![]}];}_0x5c3fe9=_[_0xc4fd('0x3c')]({},_0x5c3fe9,_0x3d1584[_0xc4fd('0x3f')]);return db[_0xc4fd('0x2b')][_0xc4fd('0x44')](_0x5c3fe9)[_0xc4fd('0x24')](handleEntityNotFound(_0x517fe4,null))[_0xc4fd('0x24')](respondWithResult(_0x517fe4,null))[_0xc4fd('0x42')](handleError(_0x517fe4,null));};exports[_0xc4fd('0x45')]=function(_0x27b2a6,_0x26a4d2){return db['FaxQueueReport'][_0xc4fd('0x45')](_0x27b2a6[_0xc4fd('0x46')],{})['then'](respondWithResult(_0x26a4d2,0xc9))['catch'](handleError(_0x26a4d2,null));};exports[_0xc4fd('0x23')]=function(_0xebdd81,_0x1a3e0d){if(_0xebdd81[_0xc4fd('0x46')]['id']){delete _0xebdd81[_0xc4fd('0x46')]['id'];}return db['FaxQueueReport'][_0xc4fd('0x44')]({'where':{'id':_0xebdd81[_0xc4fd('0x43')]['id']}})[_0xc4fd('0x24')](handleEntityNotFound(_0x1a3e0d,null))[_0xc4fd('0x24')](saveUpdates(_0xebdd81[_0xc4fd('0x46')],null))[_0xc4fd('0x24')](respondWithResult(_0x1a3e0d,null))[_0xc4fd('0x42')](handleError(_0x1a3e0d,null));};exports['destroy']=function(_0x29d29c,_0x2dad03){return db['FaxQueueReport']['find']({'where':{'id':_0x29d29c[_0xc4fd('0x43')]['id']}})[_0xc4fd('0x24')](handleEntityNotFound(_0x2dad03,null))[_0xc4fd('0x24')](removeEntity(_0x2dad03,null))[_0xc4fd('0x42')](handleError(_0x2dad03,null));};exports[_0xc4fd('0x47')]=function(_0x3999d2,_0x4c5c90){return db[_0xc4fd('0x2b')][_0xc4fd('0x47')]()[_0xc4fd('0x24')](respondWithResult(_0x4c5c90,null))[_0xc4fd('0x42')](handleError(_0x4c5c90,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 773d50c..a6705f1 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x101a9b,_0x12e7d8){var _0x285117=function(_0x190e24){while(--_0x190e24){_0x101a9b['push'](_0x101a9b['shift']());}};_0x285117(++_0x12e7d8);}(_0xabce,0x103));var _0xeabc=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xabce[_0xbb091];return _0x467a04;};'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('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x814b,0x1a2));var _0xb814=function(_0x65cd03,_0x2913ee){_0x65cd03=_0x65cd03-0x0;var _0x21c579=_0x814b[_0x65cd03];return _0x21c579;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 7b04f26..7c5e8e0 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 _0xe4ed=['catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result'];(function(_0x4058bf,_0x3fa909){var _0x3136be=function(_0x1c47ae){while(--_0x1c47ae){_0x4058bf['push'](_0x4058bf['shift']());}};_0x3136be(++_0x3fa909);}(_0xe4ed,0x70));var _0xde4e=function(_0x212cd3,_0x34bd12){_0x212cd3=_0x212cd3-0x0;var _0x413695=_0xe4ed[_0x212cd3];return _0x413695;};'use strict';var _=require(_0xde4e('0x0'));var util=require('util');var moment=require(_0xde4e('0x1'));var BPromise=require(_0xde4e('0x2'));var rs=require(_0xde4e('0x3'));var fs=require('fs');var Redis=require(_0xde4e('0x4'));var db=require(_0xde4e('0x5'))['db'];var utils=require(_0xde4e('0x6'));var logger=require(_0xde4e('0x7'))(_0xde4e('0x8'));var config=require('../../config/environment');var jayson=require(_0xde4e('0x9'));var client=jayson[_0xde4e('0xa')][_0xde4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e4143,_0x530d75,_0x27233b){return new BPromise(function(_0x4b85b3,_0x47424b){return client[_0xde4e('0xc')](_0x1e4143,_0x27233b)[_0xde4e('0xd')](function(_0x24a82b){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x530d75,'request\x20sent');logger[_0xde4e('0xe')](_0xde4e('0xf'),_0x530d75,_0xde4e('0x10'),JSON[_0xde4e('0x11')](_0x24a82b));if(_0x24a82b[_0xde4e('0x12')]){if(_0x24a82b[_0xde4e('0x12')][_0xde4e('0x13')]===0x1f4){logger[_0xde4e('0x12')](_0xde4e('0x14'),_0x530d75,_0x24a82b[_0xde4e('0x12')][_0xde4e('0x15')]);return _0x47424b(_0x24a82b['error'][_0xde4e('0x15')]);}logger[_0xde4e('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x530d75,_0x24a82b['error']['message']);return _0x4b85b3(_0x24a82b[_0xde4e('0x12')][_0xde4e('0x15')]);}else{logger[_0xde4e('0x16')](_0xde4e('0x14'),_0x530d75,'request\x20sent');_0x4b85b3(_0x24a82b[_0xde4e('0x17')][_0xde4e('0x15')]);}})[_0xde4e('0x18')](function(_0x479e27){logger[_0xde4e('0x12')](_0xde4e('0x14'),_0x530d75,_0x479e27);_0x47424b(_0x479e27);});});}exports[_0xde4e('0x19')]=function(_0x29c36f){var _0x533fd9=this;return new Promise(function(_0x197c52,_0x15b440){return db['FaxQueueReport'][_0xde4e('0x1a')](_0x29c36f[_0xde4e('0x1b')],{'raw':_0x29c36f[_0xde4e('0x1c')]?_0x29c36f[_0xde4e('0x1c')][_0xde4e('0x1d')]===undefined?!![]:![]:!![]})[_0xde4e('0xd')](function(_0x429081){logger[_0xde4e('0x16')](_0xde4e('0x19'),_0x29c36f);logger['debug'](_0xde4e('0x19'),_0x29c36f,JSON[_0xde4e('0x11')](_0x429081));_0x197c52(_0x429081);})[_0xde4e('0x18')](function(_0x1c248c){logger[_0xde4e('0x12')](_0xde4e('0x19'),_0x1c248c[_0xde4e('0x15')],_0x29c36f);_0x15b440(_0x533fd9[_0xde4e('0x12')](0x1f4,_0x1c248c[_0xde4e('0x15')]));});});};exports[_0xde4e('0x1e')]=function(_0x1eced3){var _0x6ca552=this;return new Promise(function(_0x4ba423,_0x37ad6e){return db[_0xde4e('0x1f')]['update'](_0x1eced3['body'],{'raw':_0x1eced3[_0xde4e('0x1c')]?_0x1eced3[_0xde4e('0x1c')][_0xde4e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eced3['options']?_0x1eced3[_0xde4e('0x1c')]['where']||null:null,'attributes':_0x1eced3[_0xde4e('0x1c')]?_0x1eced3[_0xde4e('0x1c')][_0xde4e('0x20')]||null:null,'limit':_0x1eced3[_0xde4e('0x1c')]?_0x1eced3[_0xde4e('0x1c')][_0xde4e('0x21')]||null:null})['then'](function(_0x1370d7){logger[_0xde4e('0x16')](_0xde4e('0x1e'),_0x1eced3);logger[_0xde4e('0xe')](_0xde4e('0x1e'),_0x1eced3,JSON[_0xde4e('0x11')](_0x1370d7));_0x4ba423(_0x1370d7);})['catch'](function(_0x1e0b64){logger['error'](_0xde4e('0x1e'),_0x1e0b64[_0xde4e('0x15')],_0x1eced3);_0x37ad6e(_0x6ca552['error'](0x1f4,_0x1e0b64[_0xde4e('0x15')]));});});}; \ No newline at end of file +var _0x91aa=['error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','attributes','limit','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','code'];(function(_0x512e78,_0x5e0e76){var _0x1b9078=function(_0x53d87a){while(--_0x53d87a){_0x512e78['push'](_0x512e78['shift']());}};_0x1b9078(++_0x5e0e76);}(_0x91aa,0x11f));var _0xa91a=function(_0x58c62e,_0x4eb893){_0x58c62e=_0x58c62e-0x0;var _0x107a14=_0x91aa[_0x58c62e];return _0x107a14;};'use strict';var _=require('lodash');var util=require(_0xa91a('0x0'));var moment=require(_0xa91a('0x1'));var BPromise=require(_0xa91a('0x2'));var rs=require(_0xa91a('0x3'));var fs=require('fs');var Redis=require(_0xa91a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa91a('0x5'));var logger=require(_0xa91a('0x6'))(_0xa91a('0x7'));var config=require(_0xa91a('0x8'));var jayson=require(_0xa91a('0x9'));var client=jayson[_0xa91a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59f576,_0x1ea050,_0x1f4231){return new BPromise(function(_0x48e3f1,_0x108a78){return client[_0xa91a('0xb')](_0x59f576,_0x1f4231)[_0xa91a('0xc')](function(_0x4bac08){logger[_0xa91a('0xd')](_0xa91a('0xe'),_0x1ea050,_0xa91a('0xf'));logger[_0xa91a('0x10')](_0xa91a('0x11'),_0x1ea050,_0xa91a('0xf'),JSON['stringify'](_0x4bac08));if(_0x4bac08['error']){if(_0x4bac08['error'][_0xa91a('0x12')]===0x1f4){logger['error'](_0xa91a('0xe'),_0x1ea050,_0x4bac08[_0xa91a('0x13')][_0xa91a('0x14')]);return _0x108a78(_0x4bac08['error'][_0xa91a('0x14')]);}logger['error'](_0xa91a('0xe'),_0x1ea050,_0x4bac08[_0xa91a('0x13')][_0xa91a('0x14')]);return _0x48e3f1(_0x4bac08['error'][_0xa91a('0x14')]);}else{logger[_0xa91a('0xd')](_0xa91a('0xe'),_0x1ea050,'request\x20sent');_0x48e3f1(_0x4bac08[_0xa91a('0x15')][_0xa91a('0x14')]);}})[_0xa91a('0x16')](function(_0x557d4d){logger[_0xa91a('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x1ea050,_0x557d4d);_0x108a78(_0x557d4d);});});}exports[_0xa91a('0x17')]=function(_0x5bac23){var _0x26e53a=this;return new Promise(function(_0x16dee1,_0x48a098){return db[_0xa91a('0x18')][_0xa91a('0x19')](_0x5bac23[_0xa91a('0x1a')],{'raw':_0x5bac23['options']?_0x5bac23[_0xa91a('0x1b')][_0xa91a('0x1c')]===undefined?!![]:![]:!![]})[_0xa91a('0xc')](function(_0x7fa402){logger[_0xa91a('0xd')](_0xa91a('0x17'),_0x5bac23);logger[_0xa91a('0x10')](_0xa91a('0x17'),_0x5bac23,JSON['stringify'](_0x7fa402));_0x16dee1(_0x7fa402);})['catch'](function(_0x40bfa5){logger[_0xa91a('0x13')](_0xa91a('0x17'),_0x40bfa5[_0xa91a('0x14')],_0x5bac23);_0x48a098(_0x26e53a[_0xa91a('0x13')](0x1f4,_0x40bfa5[_0xa91a('0x14')]));});});};exports[_0xa91a('0x1d')]=function(_0x1467c4){var _0x4b417b=this;return new Promise(function(_0x48a0b5,_0x3f00bc){return db['FaxQueueReport'][_0xa91a('0x1e')](_0x1467c4[_0xa91a('0x1a')],{'raw':_0x1467c4['options']?_0x1467c4[_0xa91a('0x1b')][_0xa91a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1467c4[_0xa91a('0x1b')]?_0x1467c4[_0xa91a('0x1b')]['where']||null:null,'attributes':_0x1467c4['options']?_0x1467c4['options'][_0xa91a('0x1f')]||null:null,'limit':_0x1467c4[_0xa91a('0x1b')]?_0x1467c4[_0xa91a('0x1b')][_0xa91a('0x20')]||null:null})['then'](function(_0x5d4aa0){logger[_0xa91a('0xd')](_0xa91a('0x1d'),_0x1467c4);logger[_0xa91a('0x10')](_0xa91a('0x1d'),_0x1467c4,JSON[_0xa91a('0x21')](_0x5d4aa0));_0x48a0b5(_0x5d4aa0);})[_0xa91a('0x16')](function(_0x56d443){logger[_0xa91a('0x13')](_0xa91a('0x1d'),_0x56d443['message'],_0x1467c4);_0x3f00bc(_0x4b417b[_0xa91a('0x13')](0x1f4,_0x56d443[_0xa91a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ab9b8fb..4f394fe 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 _0xe7a7=['get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x3593ab,_0x440001){var _0x7e3f68=function(_0x203b15){while(--_0x203b15){_0x3593ab['push'](_0x3593ab['shift']());}};_0x7e3f68(++_0x440001);}(_0xe7a7,0x16d));var _0x7e7a=function(_0x4ffba9,_0x31e611){_0x4ffba9=_0x4ffba9-0x0;var _0x27d144=_0xe7a7[_0x4ffba9];return _0x27d144;};'use strict';var multer=require(_0x7e7a('0x0'));var util=require('util');var path=require(_0x7e7a('0x1'));var timeout=require(_0x7e7a('0x2'));var express=require(_0x7e7a('0x3'));var router=express[_0x7e7a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7e7a('0x5'));var interaction=require(_0x7e7a('0x6'));var config=require(_0x7e7a('0x7'));var controller=require(_0x7e7a('0x8'));router[_0x7e7a('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e7a('0xa')]);router[_0x7e7a('0x9')](_0x7e7a('0xb'),auth[_0x7e7a('0xc')](),controller[_0x7e7a('0xd')]);router[_0x7e7a('0x9')](_0x7e7a('0xe'),auth[_0x7e7a('0xc')](),controller['show']);router[_0x7e7a('0xf')]('/',auth[_0x7e7a('0xc')](),controller[_0x7e7a('0x10')]);router[_0x7e7a('0x11')]('/:id',auth[_0x7e7a('0xc')](),controller[_0x7e7a('0x12')]);router[_0x7e7a('0x13')](_0x7e7a('0xe'),auth[_0x7e7a('0xc')](),controller[_0x7e7a('0x14')]);module[_0x7e7a('0x15')]=router; \ No newline at end of file +var _0xdd45=['isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get'];(function(_0x1bf741,_0x40c887){var _0xf7d252=function(_0x1874d5){while(--_0x1874d5){_0x1bf741['push'](_0x1bf741['shift']());}};_0xf7d252(++_0x40c887);}(_0xdd45,0x130));var _0x5dd4=function(_0x1acf16,_0x2a8309){_0x1acf16=_0x1acf16-0x0;var _0x54ca49=_0xdd45[_0x1acf16];return _0x54ca49;};'use strict';var multer=require(_0x5dd4('0x0'));var util=require(_0x5dd4('0x1'));var path=require(_0x5dd4('0x2'));var timeout=require(_0x5dd4('0x3'));var express=require(_0x5dd4('0x4'));var router=express[_0x5dd4('0x5')]();var fs_extra=require(_0x5dd4('0x6'));var auth=require(_0x5dd4('0x7'));var interaction=require(_0x5dd4('0x8'));var config=require('../../config/environment');var controller=require(_0x5dd4('0x9'));router[_0x5dd4('0xa')]('/',auth[_0x5dd4('0xb')](),controller[_0x5dd4('0xc')]);router['get'](_0x5dd4('0xd'),auth[_0x5dd4('0xb')](),controller[_0x5dd4('0xe')]);router['get']('/:id',auth[_0x5dd4('0xb')](),controller[_0x5dd4('0xf')]);router['post']('/',auth[_0x5dd4('0xb')](),controller[_0x5dd4('0x10')]);router[_0x5dd4('0x11')](_0x5dd4('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x5dd4('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5dd4('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 49e46e0..96175e6 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x1109ff,_0x1bdee8){var _0x1e42d4=function(_0x9bcfda){while(--_0x9bcfda){_0x1109ff['push'](_0x1109ff['shift']());}};_0x1e42d4(++_0x1bdee8);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x4b84[_0x3f8282];return _0x50f918;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x326b7f,_0x19565f){var _0xffc781=function(_0xcb3f38){while(--_0xcb3f38){_0x326b7f['push'](_0x326b7f['shift']());}};_0xffc781(++_0x19565f);}(_0xaa88,0x137));var _0x8aa8=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0xaa88[_0x509c83];return _0x534626;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 1131806..4d56f68 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 _0x9e0e=['status','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','destroy','sendStatus','error','stack','name','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','then','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xff6bbd,_0x34e0b6){var _0x2a2697=function(_0x2d5d9c){while(--_0x2d5d9c){_0xff6bbd['push'](_0xff6bbd['shift']());}};_0x2a2697(++_0x34e0b6);}(_0x9e0e,0x1a8));var _0xe9e0=function(_0x3b7607,_0x440644){_0x3b7607=_0x3b7607-0x0;var _0xaba951=_0x9e0e[_0x3b7607];return _0xaba951;};'use strict';var emlformat=require(_0xe9e0('0x0'));var rimraf=require(_0xe9e0('0x1'));var zipdir=require(_0xe9e0('0x2'));var jsonpatch=require(_0xe9e0('0x3'));var rp=require(_0xe9e0('0x4'));var moment=require(_0xe9e0('0x5'));var BPromise=require(_0xe9e0('0x6'));var Mustache=require('mustache');var util=require(_0xe9e0('0x7'));var path=require(_0xe9e0('0x8'));var sox=require(_0xe9e0('0x9'));var csv=require(_0xe9e0('0xa'));var ejs=require(_0xe9e0('0xb'));var fs=require('fs');var fs_extra=require(_0xe9e0('0xc'));var _=require(_0xe9e0('0xd'));var squel=require(_0xe9e0('0xe'));var crypto=require('crypto');var jsforce=require(_0xe9e0('0xf'));var deskjs=require(_0xe9e0('0x10'));var toCsv=require(_0xe9e0('0xa'));var querystring=require(_0xe9e0('0x11'));var Papa=require(_0xe9e0('0x12'));var Redis=require(_0xe9e0('0x13'));var authService=require(_0xe9e0('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe9e0('0x15'));var hardwareService=require(_0xe9e0('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe9e0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe9e0('0x18'));var db=require(_0xe9e0('0x19'))['db'];function respondWithStatusCode(_0x37bf57,_0x1c7553){_0x1c7553=_0x1c7553||0xcc;return function(_0x2827be){if(_0x2827be){return _0x37bf57['sendStatus'](_0x1c7553);}return _0x37bf57[_0xe9e0('0x1a')](_0x1c7553)['end']();};}function respondWithResult(_0x5563f2,_0x4b018e){_0x4b018e=_0x4b018e||0xc8;return function(_0x35b775){if(_0x35b775){return _0x5563f2[_0xe9e0('0x1a')](_0x4b018e)['json'](_0x35b775);}};}function respondWithFilteredResult(_0x125838,_0x2f756c){return function(_0x126e7e){if(_0x126e7e){var _0x3247e8=typeof _0x2f756c['offset']==='undefined'&&typeof _0x2f756c[_0xe9e0('0x1b')]===_0xe9e0('0x1c');var _0x59ce87=_0x126e7e[_0xe9e0('0x1d')];var _0x29e6cc=_0x3247e8?0x0:_0x2f756c['offset'];var _0x57e061=_0x3247e8?_0x126e7e['count']:_0x2f756c[_0xe9e0('0x1e')]+_0x2f756c['limit'];var _0x3e8022;if(_0x57e061>=_0x59ce87){_0x57e061=_0x59ce87;_0x3e8022=0xc8;}else{_0x3e8022=0xce;}_0x125838[_0xe9e0('0x1a')](_0x3e8022);return _0x125838[_0xe9e0('0x1f')](_0xe9e0('0x20'),_0x29e6cc+'-'+_0x57e061+'/'+_0x59ce87)[_0xe9e0('0x21')](_0x126e7e);}return null;};}function patchUpdates(_0x4d1040){return function(_0x56f20d){try{jsonpatch['apply'](_0x56f20d,_0x4d1040,!![]);}catch(_0x57994a){return BPromise[_0xe9e0('0x22')](_0x57994a);}return _0x56f20d[_0xe9e0('0x23')]();};}function saveUpdates(_0x35fe9e,_0x49b551){return function(_0x318221){if(_0x318221){return _0x318221[_0xe9e0('0x24')](_0x35fe9e)['then'](function(_0xdc69d4){return _0xdc69d4;});}return null;};}function removeEntity(_0x1f9b21,_0x22c000){return function(_0x4dd310){if(_0x4dd310){return _0x4dd310[_0xe9e0('0x25')]()['then'](function(){_0x1f9b21[_0xe9e0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8c97,_0x1c39e3){return function(_0x4fc6a8){if(!_0x4fc6a8){_0x1b8c97[_0xe9e0('0x26')](0x194);}return _0x4fc6a8;};}function handleError(_0x176536,_0x1976f8){_0x1976f8=_0x1976f8||0x1f4;return function(_0x3a3715){logger[_0xe9e0('0x27')](_0x3a3715[_0xe9e0('0x28')]);if(_0x3a3715[_0xe9e0('0x29')]){delete _0x3a3715[_0xe9e0('0x29')];}_0x176536[_0xe9e0('0x1a')](_0x1976f8)['send'](_0x3a3715);};}exports['index']=function(_0x1a5bb6,_0x199956){var _0x5b9988={},_0x3954e9={},_0x58a307={'count':0x0,'rows':[]};var _0xa3d423=_[_0xe9e0('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x46a031){return{'name':_0x46a031[_0xe9e0('0x2b')],'type':_0x46a031[_0xe9e0('0x2c')][_0xe9e0('0x2d')]};});_0x3954e9[_0xe9e0('0x2e')]=_[_0xe9e0('0x2a')](_0xa3d423,_0xe9e0('0x29'));_0x3954e9['query']=_[_0xe9e0('0x2f')](_0x1a5bb6['query']);_0x3954e9[_0xe9e0('0x30')]=_[_0xe9e0('0x31')](_0x3954e9[_0xe9e0('0x2e')],_0x3954e9[_0xe9e0('0x32')]);_0x5b9988[_0xe9e0('0x33')]=_[_0xe9e0('0x31')](_0x3954e9[_0xe9e0('0x2e')],qs['fields'](_0x1a5bb6[_0xe9e0('0x32')][_0xe9e0('0x34')]));_0x5b9988[_0xe9e0('0x33')]=_0x5b9988[_0xe9e0('0x33')]['length']?_0x5b9988[_0xe9e0('0x33')]:_0x3954e9['model'];if(!_0x1a5bb6[_0xe9e0('0x32')][_0xe9e0('0x35')](_0xe9e0('0x36'))){_0x5b9988['limit']=qs['limit'](_0x1a5bb6['query'][_0xe9e0('0x1b')]);_0x5b9988['offset']=qs[_0xe9e0('0x1e')](_0x1a5bb6[_0xe9e0('0x32')][_0xe9e0('0x1e')]);}_0x5b9988['order']=qs[_0xe9e0('0x37')](_0x1a5bb6['query'][_0xe9e0('0x37')]);_0x5b9988[_0xe9e0('0x38')]=qs['filters'](_['pick'](_0x1a5bb6[_0xe9e0('0x32')],_0x3954e9['filters']),_0xa3d423);if(_0x1a5bb6[_0xe9e0('0x32')][_0xe9e0('0x39')]){_0x5b9988[_0xe9e0('0x38')]=_[_0xe9e0('0x3a')](_0x5b9988[_0xe9e0('0x38')],{'$or':_[_0xe9e0('0x2a')](_0xa3d423,function(_0x1c7968){if(_0x1c7968[_0xe9e0('0x2c')]!==_0xe9e0('0x3b')){var _0x51f98c={};_0x51f98c[_0x1c7968[_0xe9e0('0x29')]]={'$like':'%'+_0x1a5bb6['query']['filter']+'%'};return _0x51f98c;}})});}_0x5b9988=_[_0xe9e0('0x3a')]({},_0x5b9988,_0x1a5bb6[_0xe9e0('0x3c')]);var _0x221974={'where':_0x5b9988[_0xe9e0('0x38')]};return db[_0xe9e0('0x3d')][_0xe9e0('0x1d')](_0x221974)['then'](function(_0x36ef54){_0x58a307['count']=_0x36ef54;if(_0x1a5bb6[_0xe9e0('0x32')][_0xe9e0('0x3e')]){_0x5b9988[_0xe9e0('0x3f')]=[{'all':!![]}];}return db[_0xe9e0('0x3d')]['findAll'](_0x5b9988);})[_0xe9e0('0x40')](function(_0x1e65bb){_0x58a307[_0xe9e0('0x41')]=_0x1e65bb;return _0x58a307;})[_0xe9e0('0x40')](respondWithFilteredResult(_0x199956,_0x5b9988))[_0xe9e0('0x42')](handleError(_0x199956,null));};exports[_0xe9e0('0x43')]=function(_0x558223,_0x341e4f){var _0x375bc7={'raw':!![],'where':{'id':_0x558223[_0xe9e0('0x44')]['id']}},_0x5ac287={};_0x5ac287[_0xe9e0('0x2e')]=_[_0xe9e0('0x2f')](db[_0xe9e0('0x3d')][_0xe9e0('0x45')]);_0x5ac287[_0xe9e0('0x32')]=_[_0xe9e0('0x2f')](_0x558223[_0xe9e0('0x32')]);_0x5ac287[_0xe9e0('0x30')]=_[_0xe9e0('0x31')](_0x5ac287[_0xe9e0('0x2e')],_0x5ac287[_0xe9e0('0x32')]);_0x375bc7[_0xe9e0('0x33')]=_['intersection'](_0x5ac287['model'],qs[_0xe9e0('0x34')](_0x558223[_0xe9e0('0x32')][_0xe9e0('0x34')]));_0x375bc7[_0xe9e0('0x33')]=_0x375bc7['attributes'][_0xe9e0('0x46')]?_0x375bc7[_0xe9e0('0x33')]:_0x5ac287[_0xe9e0('0x2e')];if(_0x558223[_0xe9e0('0x32')][_0xe9e0('0x3e')]){_0x375bc7[_0xe9e0('0x3f')]=[{'all':!![]}];}_0x375bc7=_[_0xe9e0('0x3a')]({},_0x375bc7,_0x558223[_0xe9e0('0x3c')]);return db[_0xe9e0('0x3d')][_0xe9e0('0x47')](_0x375bc7)[_0xe9e0('0x40')](handleEntityNotFound(_0x341e4f,null))['then'](respondWithResult(_0x341e4f,null))[_0xe9e0('0x42')](handleError(_0x341e4f,null));};exports[_0xe9e0('0x48')]=function(_0x330596,_0x1e997d){return db[_0xe9e0('0x3d')]['create'](_0x330596[_0xe9e0('0x49')],{})['then'](respondWithResult(_0x1e997d,0xc9))[_0xe9e0('0x42')](handleError(_0x1e997d,null));};exports[_0xe9e0('0x24')]=function(_0x4247e1,_0x5cb968){if(_0x4247e1[_0xe9e0('0x49')]['id']){delete _0x4247e1[_0xe9e0('0x49')]['id'];}return db['FaxTransferReport'][_0xe9e0('0x47')]({'where':{'id':_0x4247e1[_0xe9e0('0x44')]['id']}})[_0xe9e0('0x40')](handleEntityNotFound(_0x5cb968,null))[_0xe9e0('0x40')](saveUpdates(_0x4247e1[_0xe9e0('0x49')],null))[_0xe9e0('0x40')](respondWithResult(_0x5cb968,null))[_0xe9e0('0x42')](handleError(_0x5cb968,null));};exports[_0xe9e0('0x25')]=function(_0x3faa44,_0x3071e2){return db['FaxTransferReport'][_0xe9e0('0x47')]({'where':{'id':_0x3faa44['params']['id']}})[_0xe9e0('0x40')](handleEntityNotFound(_0x3071e2,null))[_0xe9e0('0x40')](removeEntity(_0x3071e2,null))[_0xe9e0('0x42')](handleError(_0x3071e2,null));};exports[_0xe9e0('0x4a')]=function(_0x3fda9b,_0x589b74){return db[_0xe9e0('0x3d')]['describe']()[_0xe9e0('0x40')](respondWithResult(_0x589b74,null))['catch'](handleError(_0x589b74,null));}; \ No newline at end of file +var _0xb179=['name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack'];(function(_0x319516,_0x270808){var _0x289583=function(_0x522522){while(--_0x522522){_0x319516['push'](_0x319516['shift']());}};_0x289583(++_0x270808);}(_0xb179,0xc2));var _0x9b17=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb179[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x9b17('0x0'));var rimraf=require(_0x9b17('0x1'));var zipdir=require(_0x9b17('0x2'));var jsonpatch=require(_0x9b17('0x3'));var rp=require(_0x9b17('0x4'));var moment=require('moment');var BPromise=require(_0x9b17('0x5'));var Mustache=require(_0x9b17('0x6'));var util=require(_0x9b17('0x7'));var path=require(_0x9b17('0x8'));var sox=require('sox');var csv=require(_0x9b17('0x9'));var ejs=require(_0x9b17('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b17('0xb'));var squel=require('squel');var crypto=require(_0x9b17('0xc'));var jsforce=require(_0x9b17('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9b17('0x9'));var querystring=require(_0x9b17('0xe'));var Papa=require('papaparse');var Redis=require(_0x9b17('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9b17('0x10'));var as=require(_0x9b17('0x11'));var hardwareService=require(_0x9b17('0x12'));var logger=require(_0x9b17('0x13'))(_0x9b17('0x14'));var utils=require(_0x9b17('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9b17('0x16'));var db=require(_0x9b17('0x17'))['db'];function respondWithStatusCode(_0x1601f1,_0x5ec0b6){_0x5ec0b6=_0x5ec0b6||0xcc;return function(_0x2730c0){if(_0x2730c0){return _0x1601f1[_0x9b17('0x18')](_0x5ec0b6);}return _0x1601f1[_0x9b17('0x19')](_0x5ec0b6)[_0x9b17('0x1a')]();};}function respondWithResult(_0x1e268f,_0x2aa31d){_0x2aa31d=_0x2aa31d||0xc8;return function(_0x27b987){if(_0x27b987){return _0x1e268f[_0x9b17('0x19')](_0x2aa31d)[_0x9b17('0x1b')](_0x27b987);}};}function respondWithFilteredResult(_0x337da0,_0x258fd6){return function(_0x48a73c){if(_0x48a73c){var _0x47970f=typeof _0x258fd6['offset']==='undefined'&&typeof _0x258fd6[_0x9b17('0x1c')]==='undefined';var _0x2a0bab=_0x48a73c[_0x9b17('0x1d')];var _0x1c56da=_0x47970f?0x0:_0x258fd6[_0x9b17('0x1e')];var _0xdb80b8=_0x47970f?_0x48a73c[_0x9b17('0x1d')]:_0x258fd6['offset']+_0x258fd6[_0x9b17('0x1c')];var _0x58da76;if(_0xdb80b8>=_0x2a0bab){_0xdb80b8=_0x2a0bab;_0x58da76=0xc8;}else{_0x58da76=0xce;}_0x337da0[_0x9b17('0x19')](_0x58da76);return _0x337da0['set'](_0x9b17('0x1f'),_0x1c56da+'-'+_0xdb80b8+'/'+_0x2a0bab)[_0x9b17('0x1b')](_0x48a73c);}return null;};}function patchUpdates(_0x3a6c55){return function(_0x4a2a01){try{jsonpatch[_0x9b17('0x20')](_0x4a2a01,_0x3a6c55,!![]);}catch(_0x433ad4){return BPromise[_0x9b17('0x21')](_0x433ad4);}return _0x4a2a01[_0x9b17('0x22')]();};}function saveUpdates(_0x164030,_0x4f094f){return function(_0x4a8544){if(_0x4a8544){return _0x4a8544[_0x9b17('0x23')](_0x164030)['then'](function(_0x346482){return _0x346482;});}return null;};}function removeEntity(_0x9d5850,_0x356384){return function(_0x1a013d){if(_0x1a013d){return _0x1a013d[_0x9b17('0x24')]()[_0x9b17('0x25')](function(){_0x9d5850[_0x9b17('0x19')](0xcc)[_0x9b17('0x1a')]();});}};}function handleEntityNotFound(_0x15bc96,_0x18b14d){return function(_0x4afdb4){if(!_0x4afdb4){_0x15bc96['sendStatus'](0x194);}return _0x4afdb4;};}function handleError(_0x4b94df,_0x28a1a6){_0x28a1a6=_0x28a1a6||0x1f4;return function(_0x1983a6){logger[_0x9b17('0x26')](_0x1983a6[_0x9b17('0x27')]);if(_0x1983a6[_0x9b17('0x28')]){delete _0x1983a6[_0x9b17('0x28')];}_0x4b94df['status'](_0x28a1a6)[_0x9b17('0x29')](_0x1983a6);};}exports[_0x9b17('0x2a')]=function(_0x209024,_0x5f4d83){var _0x5544a2={},_0x422d77={},_0x20ed35={'count':0x0,'rows':[]};var _0x3fd6c4=_[_0x9b17('0x2b')](db['FaxTransferReport'][_0x9b17('0x2c')],function(_0x120b68){return{'name':_0x120b68[_0x9b17('0x2d')],'type':_0x120b68['type'][_0x9b17('0x2e')]};});_0x422d77['model']=_[_0x9b17('0x2b')](_0x3fd6c4,_0x9b17('0x28'));_0x422d77[_0x9b17('0x2f')]=_[_0x9b17('0x30')](_0x209024[_0x9b17('0x2f')]);_0x422d77[_0x9b17('0x31')]=_[_0x9b17('0x32')](_0x422d77[_0x9b17('0x33')],_0x422d77[_0x9b17('0x2f')]);_0x5544a2[_0x9b17('0x34')]=_[_0x9b17('0x32')](_0x422d77[_0x9b17('0x33')],qs[_0x9b17('0x35')](_0x209024[_0x9b17('0x2f')][_0x9b17('0x35')]));_0x5544a2['attributes']=_0x5544a2[_0x9b17('0x34')]['length']?_0x5544a2[_0x9b17('0x34')]:_0x422d77[_0x9b17('0x33')];if(!_0x209024[_0x9b17('0x2f')][_0x9b17('0x36')](_0x9b17('0x37'))){_0x5544a2[_0x9b17('0x1c')]=qs[_0x9b17('0x1c')](_0x209024[_0x9b17('0x2f')]['limit']);_0x5544a2['offset']=qs['offset'](_0x209024[_0x9b17('0x2f')][_0x9b17('0x1e')]);}_0x5544a2[_0x9b17('0x38')]=qs[_0x9b17('0x39')](_0x209024['query'][_0x9b17('0x39')]);_0x5544a2['where']=qs['filters'](_[_0x9b17('0x3a')](_0x209024['query'],_0x422d77[_0x9b17('0x31')]),_0x3fd6c4);if(_0x209024[_0x9b17('0x2f')][_0x9b17('0x3b')]){_0x5544a2[_0x9b17('0x3c')]=_[_0x9b17('0x3d')](_0x5544a2[_0x9b17('0x3c')],{'$or':_['map'](_0x3fd6c4,function(_0x310702){if(_0x310702[_0x9b17('0x3e')]!==_0x9b17('0x3f')){var _0x3bfd63={};_0x3bfd63[_0x310702['name']]={'$like':'%'+_0x209024[_0x9b17('0x2f')][_0x9b17('0x3b')]+'%'};return _0x3bfd63;}})});}_0x5544a2=_[_0x9b17('0x3d')]({},_0x5544a2,_0x209024[_0x9b17('0x40')]);var _0x33c19b={'where':_0x5544a2[_0x9b17('0x3c')]};return db[_0x9b17('0x41')]['count'](_0x33c19b)['then'](function(_0x4bd8d6){_0x20ed35[_0x9b17('0x1d')]=_0x4bd8d6;if(_0x209024[_0x9b17('0x2f')][_0x9b17('0x42')]){_0x5544a2[_0x9b17('0x43')]=[{'all':!![]}];}return db[_0x9b17('0x41')][_0x9b17('0x44')](_0x5544a2);})[_0x9b17('0x25')](function(_0x5269b8){_0x20ed35[_0x9b17('0x45')]=_0x5269b8;return _0x20ed35;})[_0x9b17('0x25')](respondWithFilteredResult(_0x5f4d83,_0x5544a2))[_0x9b17('0x46')](handleError(_0x5f4d83,null));};exports[_0x9b17('0x47')]=function(_0x487521,_0x20fc0f){var _0x40b521={'raw':!![],'where':{'id':_0x487521[_0x9b17('0x48')]['id']}},_0x3bc78a={};_0x3bc78a[_0x9b17('0x33')]=_[_0x9b17('0x30')](db[_0x9b17('0x41')][_0x9b17('0x2c')]);_0x3bc78a[_0x9b17('0x2f')]=_[_0x9b17('0x30')](_0x487521[_0x9b17('0x2f')]);_0x3bc78a[_0x9b17('0x31')]=_[_0x9b17('0x32')](_0x3bc78a[_0x9b17('0x33')],_0x3bc78a['query']);_0x40b521[_0x9b17('0x34')]=_[_0x9b17('0x32')](_0x3bc78a[_0x9b17('0x33')],qs[_0x9b17('0x35')](_0x487521[_0x9b17('0x2f')][_0x9b17('0x35')]));_0x40b521[_0x9b17('0x34')]=_0x40b521[_0x9b17('0x34')][_0x9b17('0x49')]?_0x40b521[_0x9b17('0x34')]:_0x3bc78a[_0x9b17('0x33')];if(_0x487521['query']['includeAll']){_0x40b521[_0x9b17('0x43')]=[{'all':!![]}];}_0x40b521=_[_0x9b17('0x3d')]({},_0x40b521,_0x487521[_0x9b17('0x40')]);return db[_0x9b17('0x41')][_0x9b17('0x4a')](_0x40b521)['then'](handleEntityNotFound(_0x20fc0f,null))['then'](respondWithResult(_0x20fc0f,null))[_0x9b17('0x46')](handleError(_0x20fc0f,null));};exports[_0x9b17('0x4b')]=function(_0xfe3da0,_0x2e8530){return db[_0x9b17('0x41')][_0x9b17('0x4b')](_0xfe3da0[_0x9b17('0x4c')],{})[_0x9b17('0x25')](respondWithResult(_0x2e8530,0xc9))['catch'](handleError(_0x2e8530,null));};exports['update']=function(_0x4bf80c,_0x4d3733){if(_0x4bf80c[_0x9b17('0x4c')]['id']){delete _0x4bf80c[_0x9b17('0x4c')]['id'];}return db[_0x9b17('0x41')][_0x9b17('0x4a')]({'where':{'id':_0x4bf80c[_0x9b17('0x48')]['id']}})[_0x9b17('0x25')](handleEntityNotFound(_0x4d3733,null))[_0x9b17('0x25')](saveUpdates(_0x4bf80c[_0x9b17('0x4c')],null))[_0x9b17('0x25')](respondWithResult(_0x4d3733,null))['catch'](handleError(_0x4d3733,null));};exports['destroy']=function(_0x529c99,_0x2554d9){return db[_0x9b17('0x41')]['find']({'where':{'id':_0x529c99[_0x9b17('0x48')]['id']}})[_0x9b17('0x25')](handleEntityNotFound(_0x2554d9,null))[_0x9b17('0x25')](removeEntity(_0x2554d9,null))[_0x9b17('0x46')](handleError(_0x2554d9,null));};exports[_0x9b17('0x4d')]=function(_0x8f5178,_0x5c792d){return db[_0x9b17('0x41')][_0x9b17('0x4d')]()[_0x9b17('0x25')](respondWithResult(_0x5c792d,null))[_0x9b17('0x46')](handleError(_0x5c792d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index fde6c8e..eacc7dd 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 _0x9e38=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x1ecbd4,_0x556696){var _0x4e73d8=function(_0x110821){while(--_0x110821){_0x1ecbd4['push'](_0x1ecbd4['shift']());}};_0x4e73d8(++_0x556696);}(_0x9e38,0x155));var _0x89e3=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x9e38[_0x786e9];return _0x1f891b;};'use strict';var _=require(_0x89e3('0x0'));var util=require(_0x89e3('0x1'));var logger=require(_0x89e3('0x2'))(_0x89e3('0x3'));var moment=require(_0x89e3('0x4'));var BPromise=require(_0x89e3('0x5'));var rp=require(_0x89e3('0x6'));var fs=require('fs');var path=require(_0x89e3('0x7'));var rimraf=require(_0x89e3('0x8'));var config=require(_0x89e3('0x9'));var attributes=require(_0x89e3('0xa'));module[_0x89e3('0xb')]=function(_0x424668,_0x592c1f){return _0x424668[_0x89e3('0xc')](_0x89e3('0xd'),attributes,{'tableName':_0x89e3('0xe'),'paranoid':![],'indexes':[{'name':_0x89e3('0xf'),'fields':[_0x89e3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed3c=['exports','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','./faxTransferReport.attributes'];(function(_0x244fdc,_0x1a0da6){var _0x2a02da=function(_0x5f562d){while(--_0x5f562d){_0x244fdc['push'](_0x244fdc['shift']());}};_0x2a02da(++_0x1a0da6);}(_0xed3c,0x1a6));var _0xced3=function(_0x2fc5db,_0x2253b1){_0x2fc5db=_0x2fc5db-0x0;var _0x1ef11b=_0xed3c[_0x2fc5db];return _0x1ef11b;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xced3('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index a83731d..cf8d732 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 _0x88fe=['rpc','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xdfe6af,_0x2e5e94){var _0x3e56ae=function(_0x13719f){while(--_0x13719f){_0xdfe6af['push'](_0xdfe6af['shift']());}};_0x3e56ae(++_0x2e5e94);}(_0x88fe,0x1f1));var _0xe88f=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0x88fe[_0xf10840];return _0x1fdf7e;};'use strict';var _=require('lodash');var util=require(_0xe88f('0x0'));var moment=require(_0xe88f('0x1'));var BPromise=require(_0xe88f('0x2'));var rs=require(_0xe88f('0x3'));var fs=require('fs');var Redis=require(_0xe88f('0x4'));var db=require(_0xe88f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe88f('0x6'))(_0xe88f('0x7'));var config=require(_0xe88f('0x8'));var jayson=require(_0xe88f('0x9'));var client=jayson[_0xe88f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23a6ba,_0x277f0d,_0x5c95f9){return new BPromise(function(_0x3a5b3e,_0x183bff){return client[_0xe88f('0xb')](_0x23a6ba,_0x5c95f9)['then'](function(_0x89d8ba){logger[_0xe88f('0xc')](_0xe88f('0xd'),_0x277f0d,_0xe88f('0xe'));logger[_0xe88f('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x277f0d,_0xe88f('0xe'),JSON[_0xe88f('0x10')](_0x89d8ba));if(_0x89d8ba[_0xe88f('0x11')]){if(_0x89d8ba['error']['code']===0x1f4){logger[_0xe88f('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x277f0d,_0x89d8ba[_0xe88f('0x11')][_0xe88f('0x12')]);return _0x183bff(_0x89d8ba[_0xe88f('0x11')][_0xe88f('0x12')]);}logger['error'](_0xe88f('0xd'),_0x277f0d,_0x89d8ba['error'][_0xe88f('0x12')]);return _0x3a5b3e(_0x89d8ba[_0xe88f('0x11')][_0xe88f('0x12')]);}else{logger['info'](_0xe88f('0xd'),_0x277f0d,_0xe88f('0xe'));_0x3a5b3e(_0x89d8ba[_0xe88f('0x13')][_0xe88f('0x12')]);}})[_0xe88f('0x14')](function(_0x3dbe66){logger[_0xe88f('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x277f0d,_0x3dbe66);_0x183bff(_0x3dbe66);});});} \ No newline at end of file +var _0x0dc6=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0dc6,0xf4));var _0x60dc=function(_0x194d23,_0x35b80e){_0x194d23=_0x194d23-0x0;var _0x159102=_0x0dc6[_0x194d23];return _0x159102;};'use strict';var _=require(_0x60dc('0x0'));var util=require(_0x60dc('0x1'));var moment=require(_0x60dc('0x2'));var BPromise=require(_0x60dc('0x3'));var rs=require(_0x60dc('0x4'));var fs=require('fs');var Redis=require(_0x60dc('0x5'));var db=require(_0x60dc('0x6'))['db'];var utils=require(_0x60dc('0x7'));var logger=require('../../config/logger')(_0x60dc('0x8'));var config=require('../../config/environment');var jayson=require(_0x60dc('0x9'));var client=jayson[_0x60dc('0xa')][_0x60dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35266f,_0x888409,_0x44c600){return new BPromise(function(_0x4f7e2f,_0x1ee00d){return client['request'](_0x35266f,_0x44c600)[_0x60dc('0xc')](function(_0x5a16d4){logger[_0x60dc('0xd')](_0x60dc('0xe'),_0x888409,'request\x20sent');logger[_0x60dc('0xf')](_0x60dc('0x10'),_0x888409,_0x60dc('0x11'),JSON[_0x60dc('0x12')](_0x5a16d4));if(_0x5a16d4[_0x60dc('0x13')]){if(_0x5a16d4[_0x60dc('0x13')]['code']===0x1f4){logger[_0x60dc('0x13')](_0x60dc('0xe'),_0x888409,_0x5a16d4[_0x60dc('0x13')][_0x60dc('0x14')]);return _0x1ee00d(_0x5a16d4[_0x60dc('0x13')]['message']);}logger[_0x60dc('0x13')](_0x60dc('0xe'),_0x888409,_0x5a16d4[_0x60dc('0x13')][_0x60dc('0x14')]);return _0x4f7e2f(_0x5a16d4['error']['message']);}else{logger[_0x60dc('0xd')](_0x60dc('0xe'),_0x888409,'request\x20sent');_0x4f7e2f(_0x5a16d4['result'][_0x60dc('0x14')]);}})[_0x60dc('0x15')](function(_0x23d303){logger[_0x60dc('0x13')](_0x60dc('0xe'),_0x888409,_0x23d303);_0x1ee00d(_0x23d303);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6f27356..da6c61f 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 _0x00e4=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1229e7,_0x516ba7){var _0x42f7ee=function(_0x40dafb){while(--_0x40dafb){_0x1229e7['push'](_0x1229e7['shift']());}};_0x42f7ee(++_0x516ba7);}(_0x00e4,0x1bd));var _0x400e=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x00e4[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0x400e('0x0'));var util=require(_0x400e('0x1'));var path=require(_0x400e('0x2'));var timeout=require(_0x400e('0x3'));var express=require(_0x400e('0x4'));var router=express['Router']();var fs_extra=require(_0x400e('0x5'));var auth=require(_0x400e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x400e('0x7'));var controller=require(_0x400e('0x8'));router[_0x400e('0x9')]('/',auth[_0x400e('0xa')](),controller[_0x400e('0xb')]);router[_0x400e('0x9')](_0x400e('0xc'),auth[_0x400e('0xa')](),controller[_0x400e('0xd')]);router['get'](_0x400e('0xe'),auth[_0x400e('0xa')](),controller[_0x400e('0xf')]);router[_0x400e('0x10')]('/',auth[_0x400e('0xa')](),controller[_0x400e('0x11')]);router[_0x400e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x400e('0x13')]);router[_0x400e('0x14')](_0x400e('0xe'),auth[_0x400e('0xa')](),controller[_0x400e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4d06=['fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x193253,_0x4f471b){var _0x982b58=function(_0x16ae91){while(--_0x16ae91){_0x193253['push'](_0x193253['shift']());}};_0x982b58(++_0x4f471b);}(_0x4d06,0x127));var _0x64d0=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x4d06[_0x2a55f8];return _0x245efd;};'use strict';var multer=require(_0x64d0('0x0'));var util=require(_0x64d0('0x1'));var path=require('path');var timeout=require(_0x64d0('0x2'));var express=require(_0x64d0('0x3'));var router=express[_0x64d0('0x4')]();var fs_extra=require(_0x64d0('0x5'));var auth=require(_0x64d0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x64d0('0x7'));var controller=require(_0x64d0('0x8'));router[_0x64d0('0x9')]('/',auth[_0x64d0('0xa')](),controller['index']);router[_0x64d0('0x9')](_0x64d0('0xb'),auth[_0x64d0('0xa')](),controller[_0x64d0('0xc')]);router[_0x64d0('0x9')](_0x64d0('0xd'),auth[_0x64d0('0xa')](),controller[_0x64d0('0xe')]);router['post']('/',auth[_0x64d0('0xa')](),controller[_0x64d0('0xf')]);router[_0x64d0('0x10')](_0x64d0('0xd'),auth['isAuthenticated'](),controller[_0x64d0('0x11')]);router[_0x64d0('0x12')](_0x64d0('0xd'),auth[_0x64d0('0xa')](),controller['destroy']);module[_0x64d0('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 9c107a5..b057e2a 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 _0x3253=['Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','util','connect-timeout','express'];(function(_0x169346,_0x5c39ee){var _0x199e80=function(_0x6bf7c0){while(--_0x6bf7c0){_0x169346['push'](_0x169346['shift']());}};_0x199e80(++_0x5c39ee);}(_0x3253,0x11a));var _0x3325=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x3253[_0x5fe69a];return _0x3f1aee;};'use strict';var multer=require('multer');var util=require(_0x3325('0x0'));var path=require('path');var timeout=require(_0x3325('0x1'));var express=require(_0x3325('0x2'));var router=express[_0x3325('0x3')]();var fs_extra=require(_0x3325('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3325('0x5'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x3325('0x6')]('/',auth[_0x3325('0x7')](),controller[_0x3325('0x8')]);router[_0x3325('0x6')](_0x3325('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3325('0x6')](_0x3325('0xa'),auth[_0x3325('0x7')](),controller['getConfigurations']);router[_0x3325('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3325('0xb')]);router[_0x3325('0xc')]('/',auth[_0x3325('0x7')](),controller[_0x3325('0xd')]);router[_0x3325('0xc')](_0x3325('0xa'),auth[_0x3325('0x7')](),controller[_0x3325('0xe')]);router[_0x3325('0xf')](_0x3325('0x9'),auth[_0x3325('0x7')](),controller[_0x3325('0x10')]);router[_0x3325('0x11')](_0x3325('0x9'),auth[_0x3325('0x7')](),controller[_0x3325('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4da0=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4da0,0x13b));var _0x04da=function(_0x2431b0,_0x4ae88e){_0x2431b0=_0x2431b0-0x0;var _0x48a62e=_0x4da0[_0x2431b0];return _0x48a62e;};'use strict';var multer=require(_0x04da('0x0'));var util=require(_0x04da('0x1'));var path=require(_0x04da('0x2'));var timeout=require(_0x04da('0x3'));var express=require('express');var router=express[_0x04da('0x4')]();var fs_extra=require(_0x04da('0x5'));var auth=require(_0x04da('0x6'));var interaction=require(_0x04da('0x7'));var config=require(_0x04da('0x8'));var controller=require('./intDeskAccount.controller');router[_0x04da('0x9')]('/',auth[_0x04da('0xa')](),controller[_0x04da('0xb')]);router[_0x04da('0x9')](_0x04da('0xc'),auth[_0x04da('0xa')](),controller[_0x04da('0xd')]);router[_0x04da('0x9')](_0x04da('0xe'),auth[_0x04da('0xa')](),controller[_0x04da('0xf')]);router[_0x04da('0x9')](_0x04da('0x10'),auth['isAuthenticated'](),controller[_0x04da('0x11')]);router[_0x04da('0x12')]('/',auth['isAuthenticated'](),controller[_0x04da('0x13')]);router[_0x04da('0x12')](_0x04da('0xe'),auth[_0x04da('0xa')](),controller['addConfiguration']);router[_0x04da('0x14')]('/:id',auth[_0x04da('0xa')](),controller['update']);router[_0x04da('0x15')](_0x04da('0xc'),auth['isAuthenticated'](),controller[_0x04da('0x16')]);module[_0x04da('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 509793a..1207d9c 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 _0x167c=['STRING','basic','integrationTab','exports'];(function(_0x420a9e,_0x5b2bf1){var _0x15476e=function(_0x1b43c1){while(--_0x1b43c1){_0x420a9e['push'](_0x420a9e['shift']());}};_0x15476e(++_0x5b2bf1);}(_0x167c,0x12b));var _0xc167=function(_0x41ca72,_0x18aad5){_0x41ca72=_0x41ca72-0x0;var _0x501345=_0x167c[_0x41ca72];return _0x501345;};'use strict';var Sequelize=require('sequelize');module[_0xc167('0x0')]={'name':{'type':Sequelize[_0xc167('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xc167('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xc167('0x1')]},'consumerKey':{'type':Sequelize[_0xc167('0x1')]},'consumerSecret':{'type':Sequelize[_0xc167('0x1')]},'token':{'type':Sequelize[_0xc167('0x1')]},'tokenSecret':{'type':Sequelize[_0xc167('0x1')]},'serverUrl':{'type':Sequelize[_0xc167('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc167('0x3'),'newTab'),'defaultValue':_0xc167('0x3')}}; \ No newline at end of file +var _0xcb6e=['sequelize','exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x144286,_0x2e4f21){var _0xce42be=function(_0x5ba362){while(--_0x5ba362){_0x144286['push'](_0x144286['shift']());}};_0xce42be(++_0x2e4f21);}(_0xcb6e,0xcb));var _0xecb6=function(_0x1039eb,_0x2f1513){_0x1039eb=_0x1039eb-0x0;var _0x15a082=_0xcb6e[_0x1039eb];return _0x15a082;};'use strict';var Sequelize=require(_0xecb6('0x0'));module[_0xecb6('0x1')]={'name':{'type':Sequelize[_0xecb6('0x2')]},'description':{'type':Sequelize[_0xecb6('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xecb6('0x2')]},'authType':{'type':Sequelize[_0xecb6('0x3')](_0xecb6('0x4')),'defaultValue':_0xecb6('0x4')},'password':{'type':Sequelize[_0xecb6('0x2')]},'consumerKey':{'type':Sequelize[_0xecb6('0x2')]},'consumerSecret':{'type':Sequelize[_0xecb6('0x2')]},'token':{'type':Sequelize[_0xecb6('0x2')]},'tokenSecret':{'type':Sequelize[_0xecb6('0x2')]},'serverUrl':{'type':Sequelize[_0xecb6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xecb6('0x3')]('integrationTab',_0xecb6('0x5')),'defaultValue':_0xecb6('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1e118f5..4e2c364 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 _0xce72=['priority','authType','username','password','consumerSecret','token','tokenSecret','substring','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','toString','concat','entries','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','DeskAccount','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','options','find','create','update','body','getConfigurations','findOne','DeskConfiguration','order','nolimit','addConfiguration','Subjects','getDescriptions','DeskField','Descriptions','getFields'];(function(_0x8c0431,_0x412010){var _0x50087a=function(_0x8f0caa){while(--_0x8f0caa){_0x8c0431['push'](_0x8c0431['shift']());}};_0x50087a(++_0x412010);}(_0xce72,0xf1));var _0x2ce7=function(_0x4ed9b4,_0x2a37ec){_0x4ed9b4=_0x4ed9b4-0x0;var _0x38c24b=_0xce72[_0x4ed9b4];return _0x38c24b;};'use strict';var emlformat=require(_0x2ce7('0x0'));var rimraf=require(_0x2ce7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ce7('0x2'));var rp=require(_0x2ce7('0x3'));var moment=require('moment');var BPromise=require(_0x2ce7('0x4'));var Mustache=require(_0x2ce7('0x5'));var util=require(_0x2ce7('0x6'));var path=require(_0x2ce7('0x7'));var sox=require(_0x2ce7('0x8'));var csv=require(_0x2ce7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ce7('0xa'));var _=require(_0x2ce7('0xb'));var squel=require(_0x2ce7('0xc'));var crypto=require(_0x2ce7('0xd'));var jsforce=require(_0x2ce7('0xe'));var deskjs=require(_0x2ce7('0xf'));var toCsv=require(_0x2ce7('0x9'));var querystring=require(_0x2ce7('0x10'));var Papa=require('papaparse');var Redis=require(_0x2ce7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2ce7('0x12'));var as=require(_0x2ce7('0x13'));var hardwareService=require(_0x2ce7('0x14'));var logger=require(_0x2ce7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2ce7('0x16'));var licenseUtil=require(_0x2ce7('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xbb17c4,_0x5927f0){_0x5927f0=_0x5927f0||0xcc;return function(_0x37c885){if(_0x37c885){return _0xbb17c4[_0x2ce7('0x18')](_0x5927f0);}return _0xbb17c4[_0x2ce7('0x19')](_0x5927f0)[_0x2ce7('0x1a')]();};}function respondWithResult(_0x54d624,_0x502db1){_0x502db1=_0x502db1||0xc8;return function(_0xfc3dde){if(_0xfc3dde){return _0x54d624[_0x2ce7('0x19')](_0x502db1)['json'](_0xfc3dde);}};}function respondWithFilteredResult(_0x5e02b7,_0x50f3e1){return function(_0x3c4cec){if(_0x3c4cec){var _0x43be76=typeof _0x50f3e1[_0x2ce7('0x1b')]===_0x2ce7('0x1c')&&typeof _0x50f3e1['limit']==='undefined';var _0x3300c9=_0x3c4cec[_0x2ce7('0x1d')];var _0x518d01=_0x43be76?0x0:_0x50f3e1[_0x2ce7('0x1b')];var _0x4a68ac=_0x43be76?_0x3c4cec[_0x2ce7('0x1d')]:_0x50f3e1['offset']+_0x50f3e1[_0x2ce7('0x1e')];var _0x11c165;if(_0x4a68ac>=_0x3300c9){_0x4a68ac=_0x3300c9;_0x11c165=0xc8;}else{_0x11c165=0xce;}_0x5e02b7[_0x2ce7('0x19')](_0x11c165);return _0x5e02b7[_0x2ce7('0x1f')](_0x2ce7('0x20'),_0x518d01+'-'+_0x4a68ac+'/'+_0x3300c9)[_0x2ce7('0x21')](_0x3c4cec);}return null;};}function patchUpdates(_0x4023f9){return function(_0x435067){try{jsonpatch['apply'](_0x435067,_0x4023f9,!![]);}catch(_0x18044a){return BPromise[_0x2ce7('0x22')](_0x18044a);}return _0x435067[_0x2ce7('0x23')]();};}function saveUpdates(_0x7dc49c,_0x556c77){return function(_0x7f4938){if(_0x7f4938){return _0x7f4938['update'](_0x7dc49c)['then'](function(_0x5706e3){return _0x5706e3;});}return null;};}function removeEntity(_0x36672d,_0x361fd4){return function(_0x34d64b){if(_0x34d64b){return _0x34d64b[_0x2ce7('0x24')]()[_0x2ce7('0x25')](function(){_0x36672d[_0x2ce7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3233cd,_0x2b48d2){return function(_0x4fb3a0){if(!_0x4fb3a0){_0x3233cd[_0x2ce7('0x18')](0x194);}return _0x4fb3a0;};}function handleError(_0xe18c68,_0x3e2783){_0x3e2783=_0x3e2783||0x1f4;return function(_0x37fd6d){logger[_0x2ce7('0x26')](_0x37fd6d[_0x2ce7('0x27')]);if(_0x37fd6d[_0x2ce7('0x28')]){delete _0x37fd6d[_0x2ce7('0x28')];}_0xe18c68[_0x2ce7('0x19')](_0x3e2783)[_0x2ce7('0x29')](_0x37fd6d);};}exports[_0x2ce7('0x2a')]=function(_0xd2a2f0,_0x168321){var _0x13306b={},_0x13d1de={},_0x508451={'count':0x0,'rows':[]};var _0x5dc3ab=_[_0x2ce7('0x2b')](db[_0x2ce7('0x2c')]['rawAttributes'],function(_0x5f0d45){return{'name':_0x5f0d45[_0x2ce7('0x2d')],'type':_0x5f0d45[_0x2ce7('0x2e')]['key']};});_0x13d1de[_0x2ce7('0x2f')]=_['map'](_0x5dc3ab,'name');_0x13d1de['query']=_['keys'](_0xd2a2f0['query']);_0x13d1de['filters']=_['intersection'](_0x13d1de[_0x2ce7('0x2f')],_0x13d1de[_0x2ce7('0x30')]);_0x13306b[_0x2ce7('0x31')]=_[_0x2ce7('0x32')](_0x13d1de[_0x2ce7('0x2f')],qs['fields'](_0xd2a2f0[_0x2ce7('0x30')][_0x2ce7('0x33')]));_0x13306b['attributes']=_0x13306b[_0x2ce7('0x31')][_0x2ce7('0x34')]?_0x13306b[_0x2ce7('0x31')]:_0x13d1de[_0x2ce7('0x2f')];if(!_0xd2a2f0[_0x2ce7('0x30')][_0x2ce7('0x35')]('nolimit')){_0x13306b[_0x2ce7('0x1e')]=qs[_0x2ce7('0x1e')](_0xd2a2f0['query']['limit']);_0x13306b[_0x2ce7('0x1b')]=qs[_0x2ce7('0x1b')](_0xd2a2f0[_0x2ce7('0x30')]['offset']);}_0x13306b['order']=qs[_0x2ce7('0x36')](_0xd2a2f0['query'][_0x2ce7('0x36')]);_0x13306b[_0x2ce7('0x37')]=qs[_0x2ce7('0x38')](_[_0x2ce7('0x39')](_0xd2a2f0['query'],_0x13d1de[_0x2ce7('0x38')]),_0x5dc3ab);if(_0xd2a2f0[_0x2ce7('0x30')][_0x2ce7('0x3a')]){_0x13306b[_0x2ce7('0x37')]=_[_0x2ce7('0x3b')](_0x13306b['where'],{'$or':_[_0x2ce7('0x2b')](_0x5dc3ab,function(_0x48a9c4){if(_0x48a9c4[_0x2ce7('0x2e')]!==_0x2ce7('0x3c')){var _0x56f805={};_0x56f805[_0x48a9c4['name']]={'$like':'%'+_0xd2a2f0[_0x2ce7('0x30')][_0x2ce7('0x3a')]+'%'};return _0x56f805;}})});}_0x13306b=_[_0x2ce7('0x3b')]({},_0x13306b,_0xd2a2f0['options']);var _0x311db1={'where':_0x13306b[_0x2ce7('0x37')]};return db[_0x2ce7('0x2c')][_0x2ce7('0x1d')](_0x311db1)[_0x2ce7('0x25')](function(_0x33674f){_0x508451[_0x2ce7('0x1d')]=_0x33674f;if(_0xd2a2f0[_0x2ce7('0x30')]['includeAll']){_0x13306b[_0x2ce7('0x3d')]=[{'all':!![]}];}return db[_0x2ce7('0x2c')][_0x2ce7('0x3e')](_0x13306b);})[_0x2ce7('0x25')](function(_0x3cb07a){_0x508451[_0x2ce7('0x3f')]=_0x3cb07a;return _0x508451;})[_0x2ce7('0x25')](respondWithFilteredResult(_0x168321,_0x13306b))[_0x2ce7('0x40')](handleError(_0x168321,null));};exports[_0x2ce7('0x41')]=function(_0x1f8ce6,_0x205a1e){var _0x53cbba={'raw':![],'where':{'id':_0x1f8ce6[_0x2ce7('0x42')]['id']}},_0x596d37={};_0x596d37[_0x2ce7('0x2f')]=_[_0x2ce7('0x43')](db['DeskAccount'][_0x2ce7('0x44')]);_0x596d37['query']=_[_0x2ce7('0x43')](_0x1f8ce6[_0x2ce7('0x30')]);_0x596d37[_0x2ce7('0x38')]=_[_0x2ce7('0x32')](_0x596d37[_0x2ce7('0x2f')],_0x596d37[_0x2ce7('0x30')]);_0x53cbba[_0x2ce7('0x31')]=_[_0x2ce7('0x32')](_0x596d37[_0x2ce7('0x2f')],qs[_0x2ce7('0x33')](_0x1f8ce6[_0x2ce7('0x30')][_0x2ce7('0x33')]));_0x53cbba[_0x2ce7('0x31')]=_0x53cbba[_0x2ce7('0x31')][_0x2ce7('0x34')]?_0x53cbba[_0x2ce7('0x31')]:_0x596d37[_0x2ce7('0x2f')];if(_0x1f8ce6[_0x2ce7('0x30')][_0x2ce7('0x45')]){_0x53cbba['include']=[{'all':!![]}];}_0x53cbba=_[_0x2ce7('0x3b')]({},_0x53cbba,_0x1f8ce6[_0x2ce7('0x46')]);return db[_0x2ce7('0x2c')][_0x2ce7('0x47')](_0x53cbba)[_0x2ce7('0x25')](handleEntityNotFound(_0x205a1e,null))['then'](respondWithResult(_0x205a1e,null))[_0x2ce7('0x40')](handleError(_0x205a1e,null));};exports[_0x2ce7('0x48')]=function(_0x5ed661,_0x53ce50){return db[_0x2ce7('0x2c')][_0x2ce7('0x48')](_0x5ed661['body'],{})[_0x2ce7('0x25')](respondWithResult(_0x53ce50,0xc9))[_0x2ce7('0x40')](handleError(_0x53ce50,null));};exports[_0x2ce7('0x49')]=function(_0x5ec3b0,_0x29ecb5){if(_0x5ec3b0[_0x2ce7('0x4a')]['id']){delete _0x5ec3b0[_0x2ce7('0x4a')]['id'];}return db[_0x2ce7('0x2c')]['find']({'where':{'id':_0x5ec3b0[_0x2ce7('0x42')]['id']}})['then'](handleEntityNotFound(_0x29ecb5,null))['then'](saveUpdates(_0x5ec3b0[_0x2ce7('0x4a')],null))[_0x2ce7('0x25')](respondWithResult(_0x29ecb5,null))[_0x2ce7('0x40')](handleError(_0x29ecb5,null));};exports[_0x2ce7('0x24')]=function(_0x36e285,_0x243b6a){return db[_0x2ce7('0x2c')][_0x2ce7('0x47')]({'where':{'id':_0x36e285[_0x2ce7('0x42')]['id']}})['then'](handleEntityNotFound(_0x243b6a,null))[_0x2ce7('0x25')](removeEntity(_0x243b6a,null))['catch'](handleError(_0x243b6a,null));};exports[_0x2ce7('0x4b')]=function(_0x3abf42,_0x265fca,_0x29fa5c){var _0xccd3e5={};var _0x174d53={};var _0x29d68e;var _0x554f0;return db['DeskAccount'][_0x2ce7('0x4c')]({'where':{'id':_0x3abf42['params']['id']}})[_0x2ce7('0x25')](handleEntityNotFound(_0x265fca,null))[_0x2ce7('0x25')](function(_0x48b9b2){if(_0x48b9b2){_0x29d68e=_0x48b9b2;_0x174d53[_0x2ce7('0x2f')]=_[_0x2ce7('0x43')](db[_0x2ce7('0x4d')][_0x2ce7('0x44')]);_0x174d53[_0x2ce7('0x30')]=_['keys'](_0x3abf42['query']);_0x174d53[_0x2ce7('0x38')]=_[_0x2ce7('0x32')](_0x174d53[_0x2ce7('0x2f')],_0x174d53[_0x2ce7('0x30')]);_0xccd3e5[_0x2ce7('0x31')]=_[_0x2ce7('0x32')](_0x174d53[_0x2ce7('0x2f')],qs['fields'](_0x3abf42['query'][_0x2ce7('0x33')]));_0xccd3e5[_0x2ce7('0x31')]=_0xccd3e5['attributes'][_0x2ce7('0x34')]?_0xccd3e5[_0x2ce7('0x31')]:_0x174d53['model'];_0xccd3e5[_0x2ce7('0x4e')]=qs['sort'](_0x3abf42[_0x2ce7('0x30')][_0x2ce7('0x36')]);_0xccd3e5[_0x2ce7('0x37')]=qs[_0x2ce7('0x38')](_[_0x2ce7('0x39')](_0x3abf42[_0x2ce7('0x30')],_0x174d53[_0x2ce7('0x38')]));if(_0x3abf42[_0x2ce7('0x30')][_0x2ce7('0x3a')]){_0xccd3e5[_0x2ce7('0x37')]=_['merge'](_0xccd3e5[_0x2ce7('0x37')],{'$or':_['map'](_0xccd3e5[_0x2ce7('0x31')],function(_0x3c4082){var _0x290ade={};_0x290ade[_0x3c4082]={'$like':'%'+_0x3abf42[_0x2ce7('0x30')][_0x2ce7('0x3a')]+'%'};return _0x290ade;})});}_0xccd3e5=_[_0x2ce7('0x3b')]({},_0xccd3e5,_0x3abf42[_0x2ce7('0x46')]);return _0x29d68e[_0x2ce7('0x4b')](_0xccd3e5);}})[_0x2ce7('0x25')](function(_0x27575a){if(_0x27575a){_0x554f0=_0x27575a['length'];if(!_0x3abf42[_0x2ce7('0x30')]['hasOwnProperty'](_0x2ce7('0x4f'))){_0xccd3e5[_0x2ce7('0x1e')]=qs['limit'](_0x3abf42[_0x2ce7('0x30')][_0x2ce7('0x1e')]);_0xccd3e5[_0x2ce7('0x1b')]=qs[_0x2ce7('0x1b')](_0x3abf42['query'][_0x2ce7('0x1b')]);}return _0x29d68e[_0x2ce7('0x4b')](_0xccd3e5);}})[_0x2ce7('0x25')](function(_0x1b161b){if(_0x1b161b){return _0x1b161b?{'count':_0x554f0,'rows':_0x1b161b}:null;}})['then'](respondWithResult(_0x265fca,null))[_0x2ce7('0x40')](handleError(_0x265fca,null));};exports[_0x2ce7('0x50')]=function(_0x42a2cc,_0x35aace,_0x13140e){if(_0x42a2cc[_0x2ce7('0x4a')]['id']){delete _0x42a2cc[_0x2ce7('0x4a')]['id'];}return db[_0x2ce7('0x2c')][_0x2ce7('0x4c')]({'where':{'id':_0x42a2cc['params']['id']}})['then'](handleEntityNotFound(_0x35aace,null))[_0x2ce7('0x25')](function(_0x2aa1ee){if(_0x2aa1ee){_0x42a2cc[_0x2ce7('0x4a')]['AccountId']=_0x2aa1ee['id'];_0x42a2cc[_0x2ce7('0x4a')][_0x2ce7('0x51')]=integrations['getSubjects'](_0x42a2cc[_0x2ce7('0x4a')]['channel'],_0x42a2cc[_0x2ce7('0x4a')][_0x2ce7('0x2e')]);_0x42a2cc[_0x2ce7('0x4a')]['Descriptions']=integrations[_0x2ce7('0x52')](_0x42a2cc['body']['channel'],_0x42a2cc['body'][_0x2ce7('0x2e')]);return db[_0x2ce7('0x4d')]['create'](_0x42a2cc[_0x2ce7('0x4a')],{'include':[{'model':db[_0x2ce7('0x53')],'as':'Subjects'},{'model':db[_0x2ce7('0x53')],'as':_0x2ce7('0x54')}]});}return null;})[_0x2ce7('0x25')](respondWithResult(_0x35aace,null))['catch'](handleError(_0x35aace,null));};exports[_0x2ce7('0x55')]=function(_0x556523,_0x4ca271,_0x21617d){var _0x5e1506=[{'name':_0x2ce7('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5ef67a='';return db['DeskAccount']['findOne']({'where':{'id':_0x556523[_0x2ce7('0x42')]['id']},'attributes':['id','remoteUri',_0x2ce7('0x57'),_0x2ce7('0x58'),_0x2ce7('0x59'),'consumerKey',_0x2ce7('0x5a'),_0x2ce7('0x5b'),_0x2ce7('0x5c')]})[_0x2ce7('0x25')](handleEntityNotFound(_0x4ca271,null))[_0x2ce7('0x25')](function(_0x3a83d7){if(_0x3a83d7){_0x5ef67a=_0x3a83d7['remoteUri'];var _0x4d0fb1=_0x5ef67a['slice'](-0x1);if(_0x4d0fb1==='/'){_0x5ef67a=_0x5ef67a[_0x2ce7('0x5d')](0x0,_0x5ef67a['lastIndexOf'](_0x4d0fb1));}var _0x42f1ac={'method':'GET','uri':util['format'](_0x2ce7('0x5e'),_0x5ef67a),'headers':{'Content-Type':_0x2ce7('0x5f'),'Accept':_0x2ce7('0x5f')},'json':!![]};if(_0x3a83d7[_0x2ce7('0x57')]===_0x2ce7('0x60')){_0x42f1ac[_0x2ce7('0x61')][_0x2ce7('0x62')]=util[_0x2ce7('0x63')](_0x2ce7('0x64'),new Buffer(util[_0x2ce7('0x63')]('%s:%s',_0x3a83d7['username'],_0x3a83d7[_0x2ce7('0x59')]))[_0x2ce7('0x65')]('base64'));}return rp(_0x42f1ac)[_0x2ce7('0x25')](function(_0x23ac98){return _0x5e1506[_0x2ce7('0x66')](_['map'](_0x23ac98['_embedded'][_0x2ce7('0x67')],function(_0x19cfef){return{'id':_0x19cfef[_0x2ce7('0x28')],'name':_0x19cfef['name'],'type':_0x19cfef[_0x2ce7('0x2e')],'active':_0x19cfef['active'],'label':_0x19cfef[_0x2ce7('0x68')],'custom':!![]};}));});}})[_0x2ce7('0x25')](function(_0x381af6){return{'count':_0x381af6['length'],'rows':_0x381af6};})[_0x2ce7('0x25')](respondWithResult(_0x4ca271,null))[_0x2ce7('0x40')](function(_0x5dd340){var _0xeaa715=_0x556523['query'][_0x2ce7('0x69')]?0x1f4:_0x5dd340[_0x2ce7('0x6a')]||0x1f4;logger[_0x2ce7('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xeaa715,JSON[_0x2ce7('0x6b')](_0x5dd340));delete _0x5dd340[_0x2ce7('0x28')];if(_0xeaa715===0x191){_0xeaa715=0x190;}_0x4ca271[_0x2ce7('0x19')](_0xeaa715)['send'](_0x556523[_0x2ce7('0x30')][_0x2ce7('0x69')]?{'message':_0x2ce7('0x6c'),'statusCode':_0x5dd340[_0x2ce7('0x6a')]}:_0x5dd340);});}; \ No newline at end of file +var _0xa98d=['DeskAccount','include','findAll','rows','catch','show','length','includeAll','create','body','find','params','getConfigurations','findOne','DeskConfiguration','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','priority','authType','password','consumerKey','tokenSecret','remoteUri','substring','lastIndexOf','application/json','basic','headers','Authorization','format','%s:%s','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0xa98d,0x188));var _0xda98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa98d[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xda98('0x0'));var rimraf=require(_0xda98('0x1'));var zipdir=require(_0xda98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda98('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xda98('0x4'));var util=require(_0xda98('0x5'));var path=require('path');var sox=require(_0xda98('0x6'));var csv=require('to-csv');var ejs=require(_0xda98('0x7'));var fs=require('fs');var fs_extra=require(_0xda98('0x8'));var _=require(_0xda98('0x9'));var squel=require(_0xda98('0xa'));var crypto=require('crypto');var jsforce=require(_0xda98('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xda98('0xc'));var querystring=require('querystring');var Papa=require(_0xda98('0xd'));var Redis=require(_0xda98('0xe'));var authService=require(_0xda98('0xf'));var qs=require(_0xda98('0x10'));var as=require(_0xda98('0x11'));var hardwareService=require(_0xda98('0x12'));var logger=require(_0xda98('0x13'))('api');var utils=require(_0xda98('0x14'));var config=require(_0xda98('0x15'));var licenseUtil=require(_0xda98('0x16'));var db=require(_0xda98('0x17'))['db'];var integrations=require(_0xda98('0x18'));function respondWithStatusCode(_0x42edfd,_0x1f3edf){_0x1f3edf=_0x1f3edf||0xcc;return function(_0x1e8ede){if(_0x1e8ede){return _0x42edfd[_0xda98('0x19')](_0x1f3edf);}return _0x42edfd[_0xda98('0x1a')](_0x1f3edf)[_0xda98('0x1b')]();};}function respondWithResult(_0x5507f5,_0x482893){_0x482893=_0x482893||0xc8;return function(_0x51797b){if(_0x51797b){return _0x5507f5['status'](_0x482893)[_0xda98('0x1c')](_0x51797b);}};}function respondWithFilteredResult(_0x35c09e,_0x29f386){return function(_0xf00a25){if(_0xf00a25){var _0x534edd=typeof _0x29f386[_0xda98('0x1d')]===_0xda98('0x1e')&&typeof _0x29f386[_0xda98('0x1f')]===_0xda98('0x1e');var _0x13ab31=_0xf00a25[_0xda98('0x20')];var _0x4540a0=_0x534edd?0x0:_0x29f386[_0xda98('0x1d')];var _0x2b6f32=_0x534edd?_0xf00a25['count']:_0x29f386[_0xda98('0x1d')]+_0x29f386[_0xda98('0x1f')];var _0xf1d076;if(_0x2b6f32>=_0x13ab31){_0x2b6f32=_0x13ab31;_0xf1d076=0xc8;}else{_0xf1d076=0xce;}_0x35c09e[_0xda98('0x1a')](_0xf1d076);return _0x35c09e[_0xda98('0x21')](_0xda98('0x22'),_0x4540a0+'-'+_0x2b6f32+'/'+_0x13ab31)[_0xda98('0x1c')](_0xf00a25);}return null;};}function patchUpdates(_0x360e4c){return function(_0x3b09f7){try{jsonpatch[_0xda98('0x23')](_0x3b09f7,_0x360e4c,!![]);}catch(_0x18d8cc){return BPromise['reject'](_0x18d8cc);}return _0x3b09f7[_0xda98('0x24')]();};}function saveUpdates(_0x337421,_0x5ca3cf){return function(_0x2d6434){if(_0x2d6434){return _0x2d6434[_0xda98('0x25')](_0x337421)[_0xda98('0x26')](function(_0x3015c4){return _0x3015c4;});}return null;};}function removeEntity(_0x481fd7,_0x172fa3){return function(_0x15d5ca){if(_0x15d5ca){return _0x15d5ca[_0xda98('0x27')]()['then'](function(){_0x481fd7['status'](0xcc)[_0xda98('0x1b')]();});}};}function handleEntityNotFound(_0x5da15b,_0x5a6a13){return function(_0x1e868a){if(!_0x1e868a){_0x5da15b['sendStatus'](0x194);}return _0x1e868a;};}function handleError(_0x52b413,_0x20a681){_0x20a681=_0x20a681||0x1f4;return function(_0x426c9f){logger[_0xda98('0x28')](_0x426c9f[_0xda98('0x29')]);if(_0x426c9f[_0xda98('0x2a')]){delete _0x426c9f['name'];}_0x52b413[_0xda98('0x1a')](_0x20a681)[_0xda98('0x2b')](_0x426c9f);};}exports[_0xda98('0x2c')]=function(_0xb53e6c,_0x443c66){var _0x7c690f={},_0x2fb80e={},_0x363db9={'count':0x0,'rows':[]};var _0x554c93=_[_0xda98('0x2d')](db['DeskAccount']['rawAttributes'],function(_0x2fa4a2){return{'name':_0x2fa4a2[_0xda98('0x2e')],'type':_0x2fa4a2[_0xda98('0x2f')][_0xda98('0x30')]};});_0x2fb80e[_0xda98('0x31')]=_[_0xda98('0x2d')](_0x554c93,_0xda98('0x2a'));_0x2fb80e['query']=_[_0xda98('0x32')](_0xb53e6c[_0xda98('0x33')]);_0x2fb80e[_0xda98('0x34')]=_[_0xda98('0x35')](_0x2fb80e[_0xda98('0x31')],_0x2fb80e[_0xda98('0x33')]);_0x7c690f[_0xda98('0x36')]=_['intersection'](_0x2fb80e[_0xda98('0x31')],qs[_0xda98('0x37')](_0xb53e6c[_0xda98('0x33')]['fields']));_0x7c690f[_0xda98('0x36')]=_0x7c690f[_0xda98('0x36')]['length']?_0x7c690f[_0xda98('0x36')]:_0x2fb80e[_0xda98('0x31')];if(!_0xb53e6c[_0xda98('0x33')]['hasOwnProperty'](_0xda98('0x38'))){_0x7c690f[_0xda98('0x1f')]=qs[_0xda98('0x1f')](_0xb53e6c[_0xda98('0x33')]['limit']);_0x7c690f[_0xda98('0x1d')]=qs[_0xda98('0x1d')](_0xb53e6c[_0xda98('0x33')][_0xda98('0x1d')]);}_0x7c690f[_0xda98('0x39')]=qs[_0xda98('0x3a')](_0xb53e6c[_0xda98('0x33')][_0xda98('0x3a')]);_0x7c690f[_0xda98('0x3b')]=qs['filters'](_[_0xda98('0x3c')](_0xb53e6c[_0xda98('0x33')],_0x2fb80e[_0xda98('0x34')]),_0x554c93);if(_0xb53e6c[_0xda98('0x33')]['filter']){_0x7c690f['where']=_[_0xda98('0x3d')](_0x7c690f[_0xda98('0x3b')],{'$or':_[_0xda98('0x2d')](_0x554c93,function(_0x478d91){if(_0x478d91[_0xda98('0x2f')]!==_0xda98('0x3e')){var _0x228c36={};_0x228c36[_0x478d91[_0xda98('0x2a')]]={'$like':'%'+_0xb53e6c['query']['filter']+'%'};return _0x228c36;}})});}_0x7c690f=_['merge']({},_0x7c690f,_0xb53e6c[_0xda98('0x3f')]);var _0x2bcba7={'where':_0x7c690f[_0xda98('0x3b')]};return db[_0xda98('0x40')][_0xda98('0x20')](_0x2bcba7)[_0xda98('0x26')](function(_0x3dcb5a){_0x363db9['count']=_0x3dcb5a;if(_0xb53e6c['query']['includeAll']){_0x7c690f[_0xda98('0x41')]=[{'all':!![]}];}return db[_0xda98('0x40')][_0xda98('0x42')](_0x7c690f);})[_0xda98('0x26')](function(_0x3681b2){_0x363db9[_0xda98('0x43')]=_0x3681b2;return _0x363db9;})[_0xda98('0x26')](respondWithFilteredResult(_0x443c66,_0x7c690f))[_0xda98('0x44')](handleError(_0x443c66,null));};exports[_0xda98('0x45')]=function(_0x3dd28c,_0x138e13){var _0x512059={'raw':![],'where':{'id':_0x3dd28c['params']['id']}},_0x3a355c={};_0x3a355c[_0xda98('0x31')]=_[_0xda98('0x32')](db[_0xda98('0x40')]['rawAttributes']);_0x3a355c[_0xda98('0x33')]=_['keys'](_0x3dd28c[_0xda98('0x33')]);_0x3a355c[_0xda98('0x34')]=_[_0xda98('0x35')](_0x3a355c[_0xda98('0x31')],_0x3a355c[_0xda98('0x33')]);_0x512059[_0xda98('0x36')]=_['intersection'](_0x3a355c['model'],qs[_0xda98('0x37')](_0x3dd28c[_0xda98('0x33')][_0xda98('0x37')]));_0x512059['attributes']=_0x512059[_0xda98('0x36')][_0xda98('0x46')]?_0x512059[_0xda98('0x36')]:_0x3a355c[_0xda98('0x31')];if(_0x3dd28c[_0xda98('0x33')][_0xda98('0x47')]){_0x512059[_0xda98('0x41')]=[{'all':!![]}];}_0x512059=_[_0xda98('0x3d')]({},_0x512059,_0x3dd28c[_0xda98('0x3f')]);return db[_0xda98('0x40')]['find'](_0x512059)['then'](handleEntityNotFound(_0x138e13,null))['then'](respondWithResult(_0x138e13,null))[_0xda98('0x44')](handleError(_0x138e13,null));};exports[_0xda98('0x48')]=function(_0x337540,_0x1f9e67){return db[_0xda98('0x40')][_0xda98('0x48')](_0x337540[_0xda98('0x49')],{})[_0xda98('0x26')](respondWithResult(_0x1f9e67,0xc9))[_0xda98('0x44')](handleError(_0x1f9e67,null));};exports[_0xda98('0x25')]=function(_0x125eca,_0x744e20){if(_0x125eca[_0xda98('0x49')]['id']){delete _0x125eca['body']['id'];}return db['DeskAccount'][_0xda98('0x4a')]({'where':{'id':_0x125eca[_0xda98('0x4b')]['id']}})['then'](handleEntityNotFound(_0x744e20,null))[_0xda98('0x26')](saveUpdates(_0x125eca['body'],null))['then'](respondWithResult(_0x744e20,null))[_0xda98('0x44')](handleError(_0x744e20,null));};exports['destroy']=function(_0x55d359,_0x14b6eb){return db[_0xda98('0x40')]['find']({'where':{'id':_0x55d359[_0xda98('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14b6eb,null))[_0xda98('0x26')](removeEntity(_0x14b6eb,null))[_0xda98('0x44')](handleError(_0x14b6eb,null));};exports[_0xda98('0x4c')]=function(_0x511b93,_0x397368,_0x3245c7){var _0x49b5ae={};var _0x249a63={};var _0x1f9dc5;var _0x29751b;return db[_0xda98('0x40')][_0xda98('0x4d')]({'where':{'id':_0x511b93[_0xda98('0x4b')]['id']}})['then'](handleEntityNotFound(_0x397368,null))[_0xda98('0x26')](function(_0x1d7b7e){if(_0x1d7b7e){_0x1f9dc5=_0x1d7b7e;_0x249a63[_0xda98('0x31')]=_[_0xda98('0x32')](db[_0xda98('0x4e')]['rawAttributes']);_0x249a63['query']=_['keys'](_0x511b93[_0xda98('0x33')]);_0x249a63[_0xda98('0x34')]=_[_0xda98('0x35')](_0x249a63['model'],_0x249a63['query']);_0x49b5ae[_0xda98('0x36')]=_[_0xda98('0x35')](_0x249a63[_0xda98('0x31')],qs[_0xda98('0x37')](_0x511b93['query'][_0xda98('0x37')]));_0x49b5ae['attributes']=_0x49b5ae[_0xda98('0x36')][_0xda98('0x46')]?_0x49b5ae['attributes']:_0x249a63[_0xda98('0x31')];_0x49b5ae[_0xda98('0x39')]=qs[_0xda98('0x3a')](_0x511b93[_0xda98('0x33')][_0xda98('0x3a')]);_0x49b5ae[_0xda98('0x3b')]=qs[_0xda98('0x34')](_[_0xda98('0x3c')](_0x511b93[_0xda98('0x33')],_0x249a63[_0xda98('0x34')]));if(_0x511b93['query'][_0xda98('0x4f')]){_0x49b5ae[_0xda98('0x3b')]=_[_0xda98('0x3d')](_0x49b5ae[_0xda98('0x3b')],{'$or':_[_0xda98('0x2d')](_0x49b5ae[_0xda98('0x36')],function(_0xafffb){var _0x45a743={};_0x45a743[_0xafffb]={'$like':'%'+_0x511b93[_0xda98('0x33')][_0xda98('0x4f')]+'%'};return _0x45a743;})});}_0x49b5ae=_[_0xda98('0x3d')]({},_0x49b5ae,_0x511b93[_0xda98('0x3f')]);return _0x1f9dc5[_0xda98('0x4c')](_0x49b5ae);}})[_0xda98('0x26')](function(_0x5b13ca){if(_0x5b13ca){_0x29751b=_0x5b13ca[_0xda98('0x46')];if(!_0x511b93[_0xda98('0x33')][_0xda98('0x50')]('nolimit')){_0x49b5ae[_0xda98('0x1f')]=qs[_0xda98('0x1f')](_0x511b93[_0xda98('0x33')][_0xda98('0x1f')]);_0x49b5ae[_0xda98('0x1d')]=qs[_0xda98('0x1d')](_0x511b93['query'][_0xda98('0x1d')]);}return _0x1f9dc5[_0xda98('0x4c')](_0x49b5ae);}})[_0xda98('0x26')](function(_0x2375c8){if(_0x2375c8){return _0x2375c8?{'count':_0x29751b,'rows':_0x2375c8}:null;}})[_0xda98('0x26')](respondWithResult(_0x397368,null))[_0xda98('0x44')](handleError(_0x397368,null));};exports[_0xda98('0x51')]=function(_0x1abd4d,_0x22469c,_0x395df6){if(_0x1abd4d[_0xda98('0x49')]['id']){delete _0x1abd4d['body']['id'];}return db['DeskAccount'][_0xda98('0x4d')]({'where':{'id':_0x1abd4d[_0xda98('0x4b')]['id']}})[_0xda98('0x26')](handleEntityNotFound(_0x22469c,null))[_0xda98('0x26')](function(_0x2f35ee){if(_0x2f35ee){_0x1abd4d[_0xda98('0x49')][_0xda98('0x52')]=_0x2f35ee['id'];_0x1abd4d[_0xda98('0x49')][_0xda98('0x53')]=integrations['getSubjects'](_0x1abd4d[_0xda98('0x49')][_0xda98('0x54')],_0x1abd4d[_0xda98('0x49')][_0xda98('0x2f')]);_0x1abd4d[_0xda98('0x49')][_0xda98('0x55')]=integrations[_0xda98('0x56')](_0x1abd4d[_0xda98('0x49')][_0xda98('0x54')],_0x1abd4d[_0xda98('0x49')][_0xda98('0x2f')]);return db[_0xda98('0x4e')][_0xda98('0x48')](_0x1abd4d['body'],{'include':[{'model':db[_0xda98('0x57')],'as':'Subjects'},{'model':db[_0xda98('0x57')],'as':_0xda98('0x55')}]});}return null;})[_0xda98('0x26')](respondWithResult(_0x22469c,null))[_0xda98('0x44')](handleError(_0x22469c,null));};exports['getFields']=function(_0xb2dfd0,_0x720e2d,_0x42a2bf){var _0x18e47b=[{'name':_0xda98('0x58'),'label':_0xda98('0x58'),'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 _0x7da000='';return db['DeskAccount']['findOne']({'where':{'id':_0xb2dfd0[_0xda98('0x4b')]['id']},'attributes':['id','remoteUri',_0xda98('0x59'),'username',_0xda98('0x5a'),_0xda98('0x5b'),'consumerSecret','token',_0xda98('0x5c')]})[_0xda98('0x26')](handleEntityNotFound(_0x720e2d,null))[_0xda98('0x26')](function(_0x5dd112){if(_0x5dd112){_0x7da000=_0x5dd112[_0xda98('0x5d')];var _0x153342=_0x7da000['slice'](-0x1);if(_0x153342==='/'){_0x7da000=_0x7da000[_0xda98('0x5e')](0x0,_0x7da000[_0xda98('0x5f')](_0x153342));}var _0x45f23a={'method':'GET','uri':util['format']('%s/custom_fields',_0x7da000),'headers':{'Content-Type':_0xda98('0x60'),'Accept':'application/json'},'json':!![]};if(_0x5dd112[_0xda98('0x59')]===_0xda98('0x61')){_0x45f23a[_0xda98('0x62')][_0xda98('0x63')]=util[_0xda98('0x64')]('Basic\x20%s',new Buffer(util[_0xda98('0x64')](_0xda98('0x65'),_0x5dd112['username'],_0x5dd112[_0xda98('0x5a')]))[_0xda98('0x66')](_0xda98('0x67')));}return rp(_0x45f23a)[_0xda98('0x26')](function(_0x3f74e7){return _0x18e47b[_0xda98('0x68')](_['map'](_0x3f74e7['_embedded'][_0xda98('0x69')],function(_0x3ce42a){return{'id':_0x3ce42a[_0xda98('0x2a')],'name':_0x3ce42a['name'],'type':_0x3ce42a[_0xda98('0x2f')],'active':_0x3ce42a[_0xda98('0x6a')],'label':_0x3ce42a[_0xda98('0x6b')],'custom':!![]};}));});}})[_0xda98('0x26')](function(_0x39a499){return{'count':_0x39a499['length'],'rows':_0x39a499};})[_0xda98('0x26')](respondWithResult(_0x720e2d,null))[_0xda98('0x44')](function(_0x25064a){var _0x136157=_0xb2dfd0[_0xda98('0x33')][_0xda98('0x6c')]?0x1f4:_0x25064a[_0xda98('0x6d')]||0x1f4;logger['error'](_0xda98('0x6e'),_0xda98('0x6f'),_0x136157,JSON[_0xda98('0x70')](_0x25064a));delete _0x25064a[_0xda98('0x2a')];if(_0x136157===0x191){_0x136157=0x190;}_0x720e2d[_0xda98('0x1a')](_0x136157)['send'](_0xb2dfd0[_0xda98('0x33')][_0xda98('0x6c')]?{'message':_0xda98('0x71'),'statusCode':_0x25064a['statusCode']}:_0x25064a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 658b98e..65633b4 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 _0xc876=['int_desk_accounts','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount'];(function(_0x3ba1a3,_0x3d1a38){var _0x454223=function(_0x417a26){while(--_0x417a26){_0x3ba1a3['push'](_0x3ba1a3['shift']());}};_0x454223(++_0x3d1a38);}(_0xc876,0xfd));var _0x6c87=function(_0x31f0bd,_0x45f95c){_0x31f0bd=_0x31f0bd-0x0;var _0x326629=_0xc876[_0x31f0bd];return _0x326629;};'use strict';var _=require('lodash');var util=require(_0x6c87('0x0'));var logger=require(_0x6c87('0x1'))(_0x6c87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6c87('0x3'));var fs=require('fs');var path=require(_0x6c87('0x4'));var rimraf=require(_0x6c87('0x5'));var config=require(_0x6c87('0x6'));var attributes=require(_0x6c87('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x6c87('0x8')]=function(_0x48363c,_0x499089){return _0x48363c[_0x6c87('0x9')](_0x6c87('0xa'),attributes,{'tableName':_0x6c87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd871=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0xd871,0x160));var _0x1d87=function(_0x5914e5,_0x344eda){_0x5914e5=_0x5914e5-0x0;var _0x4ae525=_0xd871[_0x5914e5];return _0x4ae525;};'use strict';var _=require('lodash');var util=require(_0x1d87('0x0'));var logger=require('../../config/logger')(_0x1d87('0x1'));var moment=require(_0x1d87('0x2'));var BPromise=require(_0x1d87('0x3'));var rp=require(_0x1d87('0x4'));var fs=require('fs');var path=require(_0x1d87('0x5'));var rimraf=require(_0x1d87('0x6'));var config=require(_0x1d87('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x1d87('0x8'));module[_0x1d87('0x9')]=function(_0x403c40,_0x50dd6d){return _0x403c40['define'](_0x1d87('0xa'),attributes,{'tableName':'int_desk_accounts','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 b0b88cb..56c1f11 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 _0x5f97=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','include','map','model','then','GetDeskAccount','ShowDeskAccount','DeskAccount','find','raw','info'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0x5f97,0x1c7));var _0x75f9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f97[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x75f9('0x0'));var moment=require(_0x75f9('0x1'));var BPromise=require('bluebird');var rs=require(_0x75f9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75f9('0x3'))['db'];var utils=require(_0x75f9('0x4'));var logger=require(_0x75f9('0x5'))(_0x75f9('0x6'));var config=require(_0x75f9('0x7'));var jayson=require(_0x75f9('0x8'));var client=jayson['client'][_0x75f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534590,_0x417b9e,_0xd2c00f){return new BPromise(function(_0x1b9f1d,_0x40fdf9){return client['request'](_0x534590,_0xd2c00f)['then'](function(_0x27dfb1){logger['info'](_0x75f9('0xa'),_0x417b9e,'request\x20sent');logger[_0x75f9('0xb')](_0x75f9('0xc'),_0x417b9e,_0x75f9('0xd'),JSON[_0x75f9('0xe')](_0x27dfb1));if(_0x27dfb1[_0x75f9('0xf')]){if(_0x27dfb1[_0x75f9('0xf')][_0x75f9('0x10')]===0x1f4){logger[_0x75f9('0xf')]('DeskAccount,\x20%s,\x20%s',_0x417b9e,_0x27dfb1['error'][_0x75f9('0x11')]);return _0x40fdf9(_0x27dfb1[_0x75f9('0xf')][_0x75f9('0x11')]);}logger[_0x75f9('0xf')](_0x75f9('0xa'),_0x417b9e,_0x27dfb1[_0x75f9('0xf')][_0x75f9('0x11')]);return _0x1b9f1d(_0x27dfb1[_0x75f9('0xf')][_0x75f9('0x11')]);}else{logger['info'](_0x75f9('0xa'),_0x417b9e,'request\x20sent');_0x1b9f1d(_0x27dfb1[_0x75f9('0x12')][_0x75f9('0x11')]);}})[_0x75f9('0x13')](function(_0x54f495){logger[_0x75f9('0xf')]('DeskAccount,\x20%s,\x20%s',_0x417b9e,_0x54f495);_0x40fdf9(_0x54f495);});});}exports['GetDeskAccount']=function(_0xd3a9bb){var _0x3d7947=this;return new Promise(function(_0x1a3f55,_0x5045d4){return db['DeskAccount'][_0x75f9('0x14')]({'raw':_0xd3a9bb[_0x75f9('0x15')]?_0xd3a9bb[_0x75f9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xd3a9bb[_0x75f9('0x15')]?_0xd3a9bb['options'][_0x75f9('0x16')]||null:null,'attributes':_0xd3a9bb[_0x75f9('0x15')]?_0xd3a9bb[_0x75f9('0x15')][_0x75f9('0x17')]||null:null,'limit':_0xd3a9bb['options']?_0xd3a9bb[_0x75f9('0x15')][_0x75f9('0x18')]||null:null,'include':_0xd3a9bb[_0x75f9('0x15')]?_0xd3a9bb[_0x75f9('0x15')][_0x75f9('0x19')]?_[_0x75f9('0x1a')](_0xd3a9bb[_0x75f9('0x15')][_0x75f9('0x19')],function(_0x275228){return{'model':db[_0x275228[_0x75f9('0x1b')]],'as':_0x275228['as'],'attributes':_0x275228[_0x75f9('0x17')],'include':_0x275228[_0x75f9('0x19')]?_[_0x75f9('0x1a')](_0x275228['include'],function(_0xc569ed){return{'model':db[_0xc569ed['model']],'as':_0xc569ed['as'],'attributes':_0xc569ed[_0x75f9('0x17')],'include':_0xc569ed[_0x75f9('0x19')]?_[_0x75f9('0x1a')](_0xc569ed[_0x75f9('0x19')],function(_0x39b4dd){return{'model':db[_0x39b4dd['model']],'as':_0x39b4dd['as'],'attributes':_0x39b4dd[_0x75f9('0x17')]};}):[]};}):[]};}):[]:[]})[_0x75f9('0x1c')](function(_0xcbbbc6){logger['info'](_0x75f9('0x1d'),_0xd3a9bb);logger['debug'](_0x75f9('0x1d'),_0xd3a9bb,JSON[_0x75f9('0xe')](_0xcbbbc6));_0x1a3f55(_0xcbbbc6);})[_0x75f9('0x13')](function(_0x19b428){logger[_0x75f9('0xf')](_0x75f9('0x1d'),_0x19b428[_0x75f9('0x11')],_0xd3a9bb);_0x5045d4(_0x3d7947[_0x75f9('0xf')](0x1f4,_0x19b428[_0x75f9('0x11')]));});});};exports[_0x75f9('0x1e')]=function(_0x3076fa){var _0x227754=this;return new Promise(function(_0x5e7dad,_0x120fa1){return db[_0x75f9('0x1f')][_0x75f9('0x20')]({'raw':_0x3076fa[_0x75f9('0x15')]?_0x3076fa[_0x75f9('0x15')][_0x75f9('0x21')]===undefined?!![]:![]:!![],'where':_0x3076fa[_0x75f9('0x15')]?_0x3076fa[_0x75f9('0x15')][_0x75f9('0x16')]||null:null,'attributes':_0x3076fa[_0x75f9('0x15')]?_0x3076fa['options'][_0x75f9('0x17')]||null:null,'include':_0x3076fa[_0x75f9('0x15')]?_0x3076fa[_0x75f9('0x15')][_0x75f9('0x19')]?_['map'](_0x3076fa['options']['include'],function(_0xe5832c){return{'model':db[_0xe5832c[_0x75f9('0x1b')]],'as':_0xe5832c['as'],'attributes':_0xe5832c[_0x75f9('0x17')],'include':_0xe5832c[_0x75f9('0x19')]?_[_0x75f9('0x1a')](_0xe5832c['include'],function(_0x592570){return{'model':db[_0x592570[_0x75f9('0x1b')]],'as':_0x592570['as'],'attributes':_0x592570[_0x75f9('0x17')],'include':_0x592570[_0x75f9('0x19')]?_[_0x75f9('0x1a')](_0x592570[_0x75f9('0x19')],function(_0x58de9a){return{'model':db[_0x58de9a['model']],'as':_0x58de9a['as'],'attributes':_0x58de9a['attributes']};}):[]};}):[]};}):[]:[]})[_0x75f9('0x1c')](function(_0x56576f){logger[_0x75f9('0x22')](_0x75f9('0x1e'),_0x3076fa);logger[_0x75f9('0xb')]('ShowDeskAccount',_0x3076fa,JSON[_0x75f9('0xe')](_0x56576f));_0x5e7dad(_0x56576f);})[_0x75f9('0x13')](function(_0x2aac9d){logger[_0x75f9('0xf')]('ShowDeskAccount',_0x2aac9d[_0x75f9('0x11')],_0x3076fa);_0x120fa1(_0x227754[_0x75f9('0xf')](0x1f4,_0x2aac9d[_0x75f9('0x11')]));});});}; \ No newline at end of file +var _0x2535=['include','map','model','debug','ShowDeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0x44ab2f,_0x5838be){var _0xbcf44c=function(_0x50674a){while(--_0x50674a){_0x44ab2f['push'](_0x44ab2f['shift']());}};_0xbcf44c(++_0x5838be);}(_0x2535,0x164));var _0x5253=function(_0xa53912,_0x312119){_0xa53912=_0xa53912-0x0;var _0x3d549e=_0x2535[_0xa53912];return _0x3d549e;};'use strict';var _=require('lodash');var util=require(_0x5253('0x0'));var moment=require(_0x5253('0x1'));var BPromise=require(_0x5253('0x2'));var rs=require(_0x5253('0x3'));var fs=require('fs');var Redis=require(_0x5253('0x4'));var db=require(_0x5253('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5253('0x6'))('rpc');var config=require(_0x5253('0x7'));var jayson=require(_0x5253('0x8'));var client=jayson[_0x5253('0x9')][_0x5253('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8d9fe,_0x1e81b4,_0x28d4f6){return new BPromise(function(_0x3419ac,_0x657cad){return client[_0x5253('0xb')](_0x8d9fe,_0x28d4f6)[_0x5253('0xc')](function(_0x2ce54f){logger[_0x5253('0xd')](_0x5253('0xe'),_0x1e81b4,_0x5253('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1e81b4,_0x5253('0xf'),JSON[_0x5253('0x10')](_0x2ce54f));if(_0x2ce54f['error']){if(_0x2ce54f[_0x5253('0x11')][_0x5253('0x12')]===0x1f4){logger['error'](_0x5253('0xe'),_0x1e81b4,_0x2ce54f[_0x5253('0x11')][_0x5253('0x13')]);return _0x657cad(_0x2ce54f[_0x5253('0x11')][_0x5253('0x13')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x1e81b4,_0x2ce54f[_0x5253('0x11')][_0x5253('0x13')]);return _0x3419ac(_0x2ce54f[_0x5253('0x11')][_0x5253('0x13')]);}else{logger['info'](_0x5253('0xe'),_0x1e81b4,'request\x20sent');_0x3419ac(_0x2ce54f[_0x5253('0x14')][_0x5253('0x13')]);}})['catch'](function(_0x2df697){logger[_0x5253('0x11')](_0x5253('0xe'),_0x1e81b4,_0x2df697);_0x657cad(_0x2df697);});});}exports[_0x5253('0x15')]=function(_0x1603d6){var _0x1a510a=this;return new Promise(function(_0x5cc483,_0x36d68e){return db[_0x5253('0x16')][_0x5253('0x17')]({'raw':_0x1603d6[_0x5253('0x18')]?_0x1603d6[_0x5253('0x18')][_0x5253('0x19')]===undefined?!![]:![]:!![],'where':_0x1603d6['options']?_0x1603d6[_0x5253('0x18')][_0x5253('0x1a')]||null:null,'attributes':_0x1603d6[_0x5253('0x18')]?_0x1603d6['options'][_0x5253('0x1b')]||null:null,'limit':_0x1603d6[_0x5253('0x18')]?_0x1603d6[_0x5253('0x18')][_0x5253('0x1c')]||null:null,'include':_0x1603d6[_0x5253('0x18')]?_0x1603d6[_0x5253('0x18')][_0x5253('0x1d')]?_[_0x5253('0x1e')](_0x1603d6[_0x5253('0x18')]['include'],function(_0x556ffa){return{'model':db[_0x556ffa[_0x5253('0x1f')]],'as':_0x556ffa['as'],'attributes':_0x556ffa[_0x5253('0x1b')],'include':_0x556ffa[_0x5253('0x1d')]?_[_0x5253('0x1e')](_0x556ffa['include'],function(_0x19d041){return{'model':db[_0x19d041[_0x5253('0x1f')]],'as':_0x19d041['as'],'attributes':_0x19d041['attributes'],'include':_0x19d041['include']?_[_0x5253('0x1e')](_0x19d041['include'],function(_0x1ba64b){return{'model':db[_0x1ba64b[_0x5253('0x1f')]],'as':_0x1ba64b['as'],'attributes':_0x1ba64b[_0x5253('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5253('0xc')](function(_0x4a2bc9){logger[_0x5253('0xd')](_0x5253('0x15'),_0x1603d6);logger[_0x5253('0x20')](_0x5253('0x15'),_0x1603d6,JSON['stringify'](_0x4a2bc9));_0x5cc483(_0x4a2bc9);})['catch'](function(_0x3b853f){logger['error'](_0x5253('0x15'),_0x3b853f[_0x5253('0x13')],_0x1603d6);_0x36d68e(_0x1a510a['error'](0x1f4,_0x3b853f[_0x5253('0x13')]));});});};exports[_0x5253('0x21')]=function(_0x50a0bb){var _0x3d72a7=this;return new Promise(function(_0x1b2e47,_0x596119){return db[_0x5253('0x16')][_0x5253('0x22')]({'raw':_0x50a0bb['options']?_0x50a0bb[_0x5253('0x18')][_0x5253('0x19')]===undefined?!![]:![]:!![],'where':_0x50a0bb[_0x5253('0x18')]?_0x50a0bb[_0x5253('0x18')][_0x5253('0x1a')]||null:null,'attributes':_0x50a0bb[_0x5253('0x18')]?_0x50a0bb[_0x5253('0x18')][_0x5253('0x1b')]||null:null,'include':_0x50a0bb['options']?_0x50a0bb[_0x5253('0x18')][_0x5253('0x1d')]?_['map'](_0x50a0bb['options'][_0x5253('0x1d')],function(_0x1e5391){return{'model':db[_0x1e5391[_0x5253('0x1f')]],'as':_0x1e5391['as'],'attributes':_0x1e5391[_0x5253('0x1b')],'include':_0x1e5391['include']?_[_0x5253('0x1e')](_0x1e5391[_0x5253('0x1d')],function(_0x155af8){return{'model':db[_0x155af8['model']],'as':_0x155af8['as'],'attributes':_0x155af8[_0x5253('0x1b')],'include':_0x155af8[_0x5253('0x1d')]?_[_0x5253('0x1e')](_0x155af8[_0x5253('0x1d')],function(_0x37c1c2){return{'model':db[_0x37c1c2[_0x5253('0x1f')]],'as':_0x37c1c2['as'],'attributes':_0x37c1c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5253('0xc')](function(_0x239103){logger[_0x5253('0xd')](_0x5253('0x21'),_0x50a0bb);logger[_0x5253('0x20')](_0x5253('0x21'),_0x50a0bb,JSON[_0x5253('0x10')](_0x239103));_0x1b2e47(_0x239103);})['catch'](function(_0x9641e6){logger[_0x5253('0x11')](_0x5253('0x21'),_0x9641e6['message'],_0x50a0bb);_0x596119(_0x3d72a7[_0x5253('0x11')](0x1f4,_0x9641e6[_0x5253('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5886c3b..da7bb0d 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x113d16,_0x2c97d7){var _0x212df6=function(_0x30f000){while(--_0x30f000){_0x113d16['push'](_0x113d16['shift']());}};_0x212df6(++_0x2c97d7);}(_0x34e8,0x12c));var _0x834e=function(_0x23a0f2,_0x5ef187){_0x23a0f2=_0x23a0f2-0x0;var _0x292761=_0x34e8[_0x23a0f2];return _0x292761;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x34d886,_0x5848a3){var _0x214f52=function(_0x538889){while(--_0x538889){_0x34d886['push'](_0x34d886['shift']());}};_0x214f52(++_0x5848a3);}(_0x34e8,0x12c));var _0x834e=function(_0x38b3c2,_0x3f3a9a){_0x38b3c2=_0x38b3c2-0x0;var _0x37d676=_0x34e8[_0x38b3c2];return _0x37d676;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6259047..ca0b63f 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 _0x52f1=['sequelize','STRING'];(function(_0x274876,_0x55aeab){var _0x2c18e1=function(_0x29dc8d){while(--_0x29dc8d){_0x274876['push'](_0x274876['shift']());}};_0x2c18e1(++_0x55aeab);}(_0x52f1,0x196));var _0x152f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x52f1[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x152f('0x0'));module['exports']={'name':{'type':Sequelize[_0x152f('0x1')]},'description':{'type':Sequelize[_0x152f('0x1')]}}; \ No newline at end of file +var _0x507e=['exports','STRING','sequelize'];(function(_0x5dd1f6,_0x45a64e){var _0x57381b=function(_0x3fdab0){while(--_0x3fdab0){_0x5dd1f6['push'](_0x5dd1f6['shift']());}};_0x57381b(++_0x45a64e);}(_0x507e,0x14f));var _0xe507=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x507e[_0x34f701];return _0x3e2429;};'use strict';var Sequelize=require(_0xe507('0x0'));module[_0xe507('0x1')]={'name':{'type':Sequelize[_0xe507('0x2')]},'description':{'type':Sequelize[_0xe507('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 42ba70e..cf67c6c 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 _0x1892=['rows','catch','show','params','include','merge','find','create','body','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll'];(function(_0xc64946,_0x229695){var _0x2f66e5=function(_0x3028d5){while(--_0x3028d5){_0xc64946['push'](_0xc64946['shift']());}};_0x2f66e5(++_0x229695);}(_0x1892,0x6b));var _0x2189=function(_0x1ac8d8,_0x1d74c3){_0x1ac8d8=_0x1ac8d8-0x0;var _0x1de20e=_0x1892[_0x1ac8d8];return _0x1de20e;};'use strict';var emlformat=require(_0x2189('0x0'));var rimraf=require(_0x2189('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2189('0x2'));var rp=require(_0x2189('0x3'));var moment=require(_0x2189('0x4'));var BPromise=require(_0x2189('0x5'));var Mustache=require(_0x2189('0x6'));var util=require(_0x2189('0x7'));var path=require(_0x2189('0x8'));var sox=require(_0x2189('0x9'));var csv=require(_0x2189('0xa'));var ejs=require(_0x2189('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2189('0xc'));var squel=require(_0x2189('0xd'));var crypto=require('crypto');var jsforce=require(_0x2189('0xe'));var deskjs=require(_0x2189('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2189('0x10'));var Papa=require(_0x2189('0x11'));var Redis=require(_0x2189('0x12'));var authService=require(_0x2189('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2189('0x14'));var hardwareService=require(_0x2189('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2189('0x16'));var config=require(_0x2189('0x17'));var licenseUtil=require(_0x2189('0x18'));var db=require(_0x2189('0x19'))['db'];function respondWithStatusCode(_0x564a39,_0x2b1e8d){_0x2b1e8d=_0x2b1e8d||0xcc;return function(_0x1bf444){if(_0x1bf444){return _0x564a39['sendStatus'](_0x2b1e8d);}return _0x564a39[_0x2189('0x1a')](_0x2b1e8d)[_0x2189('0x1b')]();};}function respondWithResult(_0x17425a,_0x1b01bd){_0x1b01bd=_0x1b01bd||0xc8;return function(_0x5a1475){if(_0x5a1475){return _0x17425a[_0x2189('0x1a')](_0x1b01bd)[_0x2189('0x1c')](_0x5a1475);}};}function respondWithFilteredResult(_0x49439f,_0x470f1f){return function(_0x4ef718){if(_0x4ef718){var _0xaf19cb=typeof _0x470f1f[_0x2189('0x1d')]==='undefined'&&typeof _0x470f1f['limit']===_0x2189('0x1e');var _0x45bb52=_0x4ef718[_0x2189('0x1f')];var _0x58105b=_0xaf19cb?0x0:_0x470f1f[_0x2189('0x1d')];var _0x51af48=_0xaf19cb?_0x4ef718[_0x2189('0x1f')]:_0x470f1f[_0x2189('0x1d')]+_0x470f1f['limit'];var _0x3e68fe;if(_0x51af48>=_0x45bb52){_0x51af48=_0x45bb52;_0x3e68fe=0xc8;}else{_0x3e68fe=0xce;}_0x49439f[_0x2189('0x1a')](_0x3e68fe);return _0x49439f[_0x2189('0x20')](_0x2189('0x21'),_0x58105b+'-'+_0x51af48+'/'+_0x45bb52)[_0x2189('0x1c')](_0x4ef718);}return null;};}function patchUpdates(_0x3fb08e){return function(_0x3446a1){try{jsonpatch['apply'](_0x3446a1,_0x3fb08e,!![]);}catch(_0x217884){return BPromise[_0x2189('0x22')](_0x217884);}return _0x3446a1[_0x2189('0x23')]();};}function saveUpdates(_0x25b06a,_0x503431){return function(_0x522966){if(_0x522966){return _0x522966[_0x2189('0x24')](_0x25b06a)[_0x2189('0x25')](function(_0x5a3964){return _0x5a3964;});}return null;};}function removeEntity(_0x10e1fa,_0x1fa44f){return function(_0x218104){if(_0x218104){return _0x218104[_0x2189('0x26')]()['then'](function(){_0x10e1fa['status'](0xcc)[_0x2189('0x1b')]();});}};}function handleEntityNotFound(_0xefe770,_0x3a243f){return function(_0x1d0029){if(!_0x1d0029){_0xefe770[_0x2189('0x27')](0x194);}return _0x1d0029;};}function handleError(_0x47f53b,_0x3249da){_0x3249da=_0x3249da||0x1f4;return function(_0x1227e3){logger[_0x2189('0x28')](_0x1227e3[_0x2189('0x29')]);if(_0x1227e3[_0x2189('0x2a')]){delete _0x1227e3[_0x2189('0x2a')];}_0x47f53b[_0x2189('0x1a')](_0x3249da)[_0x2189('0x2b')](_0x1227e3);};}exports[_0x2189('0x2c')]=function(_0x222abb,_0x5e1590){var _0x123933={},_0x26ad37={},_0x11110b={'count':0x0,'rows':[]};var _0x3989e2=_[_0x2189('0x2d')](db[_0x2189('0x2e')][_0x2189('0x2f')],function(_0x40e112){return{'name':_0x40e112[_0x2189('0x30')],'type':_0x40e112[_0x2189('0x31')]['key']};});_0x26ad37['model']=_[_0x2189('0x2d')](_0x3989e2,_0x2189('0x2a'));_0x26ad37[_0x2189('0x32')]=_[_0x2189('0x33')](_0x222abb['query']);_0x26ad37[_0x2189('0x34')]=_[_0x2189('0x35')](_0x26ad37[_0x2189('0x36')],_0x26ad37[_0x2189('0x32')]);_0x123933[_0x2189('0x37')]=_[_0x2189('0x35')](_0x26ad37[_0x2189('0x36')],qs[_0x2189('0x38')](_0x222abb[_0x2189('0x32')]['fields']));_0x123933[_0x2189('0x37')]=_0x123933[_0x2189('0x37')][_0x2189('0x39')]?_0x123933[_0x2189('0x37')]:_0x26ad37['model'];if(!_0x222abb[_0x2189('0x32')]['hasOwnProperty'](_0x2189('0x3a'))){_0x123933[_0x2189('0x3b')]=qs[_0x2189('0x3b')](_0x222abb[_0x2189('0x32')][_0x2189('0x3b')]);_0x123933[_0x2189('0x1d')]=qs[_0x2189('0x1d')](_0x222abb[_0x2189('0x32')]['offset']);}_0x123933[_0x2189('0x3c')]=qs[_0x2189('0x3d')](_0x222abb[_0x2189('0x32')][_0x2189('0x3d')]);_0x123933[_0x2189('0x3e')]=qs[_0x2189('0x34')](_[_0x2189('0x3f')](_0x222abb['query'],_0x26ad37[_0x2189('0x34')]),_0x3989e2);if(_0x222abb[_0x2189('0x32')][_0x2189('0x40')]){_0x123933[_0x2189('0x3e')]=_['merge'](_0x123933['where'],{'$or':_[_0x2189('0x2d')](_0x3989e2,function(_0x6664c){if(_0x6664c['type']!==_0x2189('0x41')){var _0x26d366={};_0x26d366[_0x6664c['name']]={'$like':'%'+_0x222abb[_0x2189('0x32')][_0x2189('0x40')]+'%'};return _0x26d366;}})});}_0x123933=_['merge']({},_0x123933,_0x222abb[_0x2189('0x42')]);var _0x7bb72d={'where':_0x123933[_0x2189('0x3e')]};return db[_0x2189('0x2e')]['count'](_0x7bb72d)['then'](function(_0x1ed016){_0x11110b[_0x2189('0x1f')]=_0x1ed016;if(_0x222abb['query'][_0x2189('0x43')]){_0x123933['include']=[{'all':!![]}];}return db[_0x2189('0x2e')][_0x2189('0x44')](_0x123933);})[_0x2189('0x25')](function(_0x1fcb9){_0x11110b[_0x2189('0x45')]=_0x1fcb9;return _0x11110b;})[_0x2189('0x25')](respondWithFilteredResult(_0x5e1590,_0x123933))[_0x2189('0x46')](handleError(_0x5e1590,null));};exports[_0x2189('0x47')]=function(_0x5e75f1,_0x7c1e60){var _0x4efaf5={'raw':![],'where':{'id':_0x5e75f1[_0x2189('0x48')]['id']}},_0x54b9bf={};_0x54b9bf[_0x2189('0x36')]=_[_0x2189('0x33')](db['DeskConfiguration']['rawAttributes']);_0x54b9bf[_0x2189('0x32')]=_[_0x2189('0x33')](_0x5e75f1[_0x2189('0x32')]);_0x54b9bf[_0x2189('0x34')]=_[_0x2189('0x35')](_0x54b9bf['model'],_0x54b9bf['query']);_0x4efaf5[_0x2189('0x37')]=_[_0x2189('0x35')](_0x54b9bf[_0x2189('0x36')],qs[_0x2189('0x38')](_0x5e75f1[_0x2189('0x32')][_0x2189('0x38')]));_0x4efaf5[_0x2189('0x37')]=_0x4efaf5['attributes'][_0x2189('0x39')]?_0x4efaf5[_0x2189('0x37')]:_0x54b9bf[_0x2189('0x36')];if(_0x5e75f1['query']['includeAll']){_0x4efaf5[_0x2189('0x49')]=[{'all':!![]}];}_0x4efaf5=_[_0x2189('0x4a')]({},_0x4efaf5,_0x5e75f1[_0x2189('0x42')]);return db['DeskConfiguration'][_0x2189('0x4b')](_0x4efaf5)[_0x2189('0x25')](handleEntityNotFound(_0x7c1e60,null))['then'](respondWithResult(_0x7c1e60,null))['catch'](handleError(_0x7c1e60,null));};exports[_0x2189('0x4c')]=function(_0x1a7db2,_0x58ca00){return db[_0x2189('0x2e')][_0x2189('0x4c')](_0x1a7db2['body'],{})[_0x2189('0x25')](respondWithResult(_0x58ca00,0xc9))[_0x2189('0x46')](handleError(_0x58ca00,null));};exports[_0x2189('0x24')]=function(_0x315da1,_0xf3329e){if(_0x315da1[_0x2189('0x4d')]['id']){delete _0x315da1[_0x2189('0x4d')]['id'];}return db[_0x2189('0x2e')][_0x2189('0x4b')]({'where':{'id':_0x315da1['params']['id']}})['then'](handleEntityNotFound(_0xf3329e,null))[_0x2189('0x25')](saveUpdates(_0x315da1[_0x2189('0x4d')],null))[_0x2189('0x25')](respondWithResult(_0xf3329e,null))[_0x2189('0x46')](handleError(_0xf3329e,null));};exports[_0x2189('0x26')]=function(_0x27ab04,_0x40511d){return db[_0x2189('0x2e')]['find']({'where':{'id':_0x27ab04['params']['id']}})[_0x2189('0x25')](handleEntityNotFound(_0x40511d,null))['then'](removeEntity(_0x40511d,null))[_0x2189('0x46')](handleError(_0x40511d,null));};exports[_0x2189('0x4e')]=function(_0x25ba9f,_0xb1209f,_0x4b65cf){var _0xe91a27={};var _0x4c09a8={};var _0x4d2007;var _0x1ccb8c;return db[_0x2189('0x2e')][_0x2189('0x4f')]({'where':{'id':_0x25ba9f[_0x2189('0x48')]['id']}})['then'](handleEntityNotFound(_0xb1209f,null))[_0x2189('0x25')](function(_0x358cc8){if(_0x358cc8){_0x4d2007=_0x358cc8;_0x4c09a8[_0x2189('0x36')]=_['keys'](db[_0x2189('0x50')][_0x2189('0x2f')]);_0x4c09a8['query']=_['keys'](_0x25ba9f['query']);_0x4c09a8['filters']=_[_0x2189('0x35')](_0x4c09a8[_0x2189('0x36')],_0x4c09a8['query']);_0xe91a27[_0x2189('0x37')]=_['intersection'](_0x4c09a8[_0x2189('0x36')],qs[_0x2189('0x38')](_0x25ba9f[_0x2189('0x32')][_0x2189('0x38')]));_0xe91a27[_0x2189('0x37')]=_0xe91a27[_0x2189('0x37')]['length']?_0xe91a27[_0x2189('0x37')]:_0x4c09a8[_0x2189('0x36')];_0xe91a27[_0x2189('0x3c')]=qs[_0x2189('0x3d')](_0x25ba9f[_0x2189('0x32')][_0x2189('0x3d')]);_0xe91a27[_0x2189('0x3e')]=qs[_0x2189('0x34')](_[_0x2189('0x3f')](_0x25ba9f[_0x2189('0x32')],_0x4c09a8[_0x2189('0x34')]));if(_0x25ba9f['query']['filter']){_0xe91a27[_0x2189('0x3e')]=_[_0x2189('0x4a')](_0xe91a27[_0x2189('0x3e')],{'$or':_[_0x2189('0x2d')](_0xe91a27[_0x2189('0x37')],function(_0x1c7e2e){var _0x311f3a={};_0x311f3a[_0x1c7e2e]={'$like':'%'+_0x25ba9f[_0x2189('0x32')][_0x2189('0x40')]+'%'};return _0x311f3a;})});}_0xe91a27=_[_0x2189('0x4a')]({},_0xe91a27,_0x25ba9f['options']);return _0x4d2007['getFields'](_0xe91a27);}})['then'](function(_0x2c3e54){if(_0x2c3e54){_0x1ccb8c=_0x2c3e54[_0x2189('0x39')];if(!_0x25ba9f['query'][_0x2189('0x51')]('nolimit')){_0xe91a27[_0x2189('0x3b')]=qs[_0x2189('0x3b')](_0x25ba9f['query']['limit']);_0xe91a27[_0x2189('0x1d')]=qs[_0x2189('0x1d')](_0x25ba9f[_0x2189('0x32')][_0x2189('0x1d')]);}return _0x4d2007[_0x2189('0x4e')](_0xe91a27);}})[_0x2189('0x25')](function(_0x774262){if(_0x774262){return _0x774262?{'count':_0x1ccb8c,'rows':_0x774262}:null;}})[_0x2189('0x25')](respondWithResult(_0xb1209f,null))['catch'](handleError(_0xb1209f,null));};exports[_0x2189('0x52')]=function(_0x5dd1aa,_0x4e7dc7,_0x4b402d){var _0x3248ba={};var _0x2ed5ac={};var _0x1532d0;var _0x178073;return db[_0x2189('0x2e')][_0x2189('0x4f')]({'where':{'id':_0x5dd1aa['params']['id']}})[_0x2189('0x25')](handleEntityNotFound(_0x4e7dc7,null))['then'](function(_0x1bc267){if(_0x1bc267){_0x1532d0=_0x1bc267;_0x2ed5ac['model']=_[_0x2189('0x33')](db[_0x2189('0x50')][_0x2189('0x2f')]);_0x2ed5ac[_0x2189('0x32')]=_[_0x2189('0x33')](_0x5dd1aa[_0x2189('0x32')]);_0x2ed5ac[_0x2189('0x34')]=_['intersection'](_0x2ed5ac['model'],_0x2ed5ac[_0x2189('0x32')]);_0x3248ba['attributes']=_[_0x2189('0x35')](_0x2ed5ac[_0x2189('0x36')],qs[_0x2189('0x38')](_0x5dd1aa['query'][_0x2189('0x38')]));_0x3248ba[_0x2189('0x37')]=_0x3248ba['attributes'][_0x2189('0x39')]?_0x3248ba[_0x2189('0x37')]:_0x2ed5ac[_0x2189('0x36')];_0x3248ba[_0x2189('0x3c')]=qs[_0x2189('0x3d')](_0x5dd1aa[_0x2189('0x32')][_0x2189('0x3d')]);_0x3248ba[_0x2189('0x3e')]=qs['filters'](_[_0x2189('0x3f')](_0x5dd1aa[_0x2189('0x32')],_0x2ed5ac[_0x2189('0x34')]));if(_0x5dd1aa[_0x2189('0x32')][_0x2189('0x40')]){_0x3248ba[_0x2189('0x3e')]=_[_0x2189('0x4a')](_0x3248ba['where'],{'$or':_[_0x2189('0x2d')](_0x3248ba[_0x2189('0x37')],function(_0x550d27){var _0x7ddec3={};_0x7ddec3[_0x550d27]={'$like':'%'+_0x5dd1aa[_0x2189('0x32')][_0x2189('0x40')]+'%'};return _0x7ddec3;})});}_0x3248ba=_[_0x2189('0x4a')]({},_0x3248ba,_0x5dd1aa[_0x2189('0x42')]);return _0x1532d0['getSubjects'](_0x3248ba);}})[_0x2189('0x25')](function(_0x23f914){if(_0x23f914){_0x178073=_0x23f914[_0x2189('0x39')];if(!_0x5dd1aa[_0x2189('0x32')][_0x2189('0x51')](_0x2189('0x3a'))){_0x3248ba[_0x2189('0x3b')]=qs[_0x2189('0x3b')](_0x5dd1aa[_0x2189('0x32')]['limit']);_0x3248ba[_0x2189('0x1d')]=qs['offset'](_0x5dd1aa[_0x2189('0x32')][_0x2189('0x1d')]);}return _0x1532d0[_0x2189('0x52')](_0x3248ba);}})[_0x2189('0x25')](function(_0x13f5cf){if(_0x13f5cf){return _0x13f5cf?{'count':_0x178073,'rows':_0x13f5cf}:null;}})[_0x2189('0x25')](respondWithResult(_0x4e7dc7,null))[_0x2189('0x46')](handleError(_0x4e7dc7,null));};exports[_0x2189('0x53')]=function(_0x55eb2e,_0x112ba9,_0x101c4d){var _0x1c7ee0={};var _0x58907f={};var _0x4bc0e3;var _0xee9d10;return db[_0x2189('0x2e')][_0x2189('0x4f')]({'where':{'id':_0x55eb2e[_0x2189('0x48')]['id']}})[_0x2189('0x25')](handleEntityNotFound(_0x112ba9,null))[_0x2189('0x25')](function(_0x3b2b49){if(_0x3b2b49){_0x4bc0e3=_0x3b2b49;_0x58907f['model']=_[_0x2189('0x33')](db['DeskField'][_0x2189('0x2f')]);_0x58907f[_0x2189('0x32')]=_[_0x2189('0x33')](_0x55eb2e[_0x2189('0x32')]);_0x58907f[_0x2189('0x34')]=_[_0x2189('0x35')](_0x58907f['model'],_0x58907f[_0x2189('0x32')]);_0x1c7ee0[_0x2189('0x37')]=_[_0x2189('0x35')](_0x58907f[_0x2189('0x36')],qs[_0x2189('0x38')](_0x55eb2e[_0x2189('0x32')][_0x2189('0x38')]));_0x1c7ee0[_0x2189('0x37')]=_0x1c7ee0[_0x2189('0x37')][_0x2189('0x39')]?_0x1c7ee0[_0x2189('0x37')]:_0x58907f[_0x2189('0x36')];_0x1c7ee0[_0x2189('0x3c')]=qs[_0x2189('0x3d')](_0x55eb2e[_0x2189('0x32')]['sort']);_0x1c7ee0[_0x2189('0x3e')]=qs[_0x2189('0x34')](_['pick'](_0x55eb2e[_0x2189('0x32')],_0x58907f[_0x2189('0x34')]));if(_0x55eb2e['query'][_0x2189('0x40')]){_0x1c7ee0[_0x2189('0x3e')]=_[_0x2189('0x4a')](_0x1c7ee0[_0x2189('0x3e')],{'$or':_[_0x2189('0x2d')](_0x1c7ee0[_0x2189('0x37')],function(_0x379da9){var _0x448ebb={};_0x448ebb[_0x379da9]={'$like':'%'+_0x55eb2e[_0x2189('0x32')][_0x2189('0x40')]+'%'};return _0x448ebb;})});}_0x1c7ee0=_[_0x2189('0x4a')]({},_0x1c7ee0,_0x55eb2e[_0x2189('0x42')]);return _0x4bc0e3[_0x2189('0x53')](_0x1c7ee0);}})[_0x2189('0x25')](function(_0x3492aa){if(_0x3492aa){_0xee9d10=_0x3492aa[_0x2189('0x39')];if(!_0x55eb2e['query']['hasOwnProperty']('nolimit')){_0x1c7ee0[_0x2189('0x3b')]=qs['limit'](_0x55eb2e[_0x2189('0x32')][_0x2189('0x3b')]);_0x1c7ee0[_0x2189('0x1d')]=qs[_0x2189('0x1d')](_0x55eb2e['query'][_0x2189('0x1d')]);}return _0x4bc0e3['getDescriptions'](_0x1c7ee0);}})[_0x2189('0x25')](function(_0x5d9a9c){if(_0x5d9a9c){return _0x5d9a9c?{'count':_0xee9d10,'rows':_0x5d9a9c}:null;}})[_0x2189('0x25')](respondWithResult(_0x112ba9,null))[_0x2189('0x46')](handleError(_0x112ba9,null));};exports['getTags']=function(_0x20d1ff,_0x104934,_0x1ab22c){var _0x199fce={};var _0x431937={};var _0xefa9d7;var _0x41fab5;return db[_0x2189('0x2e')]['findOne']({'where':{'id':_0x20d1ff[_0x2189('0x48')]['id']}})[_0x2189('0x25')](handleEntityNotFound(_0x104934,null))[_0x2189('0x25')](function(_0x2eec93){if(_0x2eec93){_0xefa9d7=_0x2eec93;_0x431937[_0x2189('0x36')]=_[_0x2189('0x33')](db[_0x2189('0x54')][_0x2189('0x2f')]);_0x431937[_0x2189('0x32')]=_[_0x2189('0x33')](_0x20d1ff[_0x2189('0x32')]);_0x431937[_0x2189('0x34')]=_['intersection'](_0x431937[_0x2189('0x36')],_0x431937[_0x2189('0x32')]);_0x199fce[_0x2189('0x37')]=_[_0x2189('0x35')](_0x431937['model'],qs[_0x2189('0x38')](_0x20d1ff[_0x2189('0x32')][_0x2189('0x38')]));_0x199fce[_0x2189('0x37')]=_0x199fce[_0x2189('0x37')]['length']?_0x199fce[_0x2189('0x37')]:_0x431937[_0x2189('0x36')];_0x199fce[_0x2189('0x3c')]=qs['sort'](_0x20d1ff[_0x2189('0x32')][_0x2189('0x3d')]);_0x199fce[_0x2189('0x3e')]=qs['filters'](_[_0x2189('0x3f')](_0x20d1ff['query'],_0x431937[_0x2189('0x34')]));if(_0x20d1ff[_0x2189('0x32')][_0x2189('0x40')]){_0x199fce[_0x2189('0x3e')]=_[_0x2189('0x4a')](_0x199fce[_0x2189('0x3e')],{'$or':_[_0x2189('0x2d')](_0x199fce[_0x2189('0x37')],function(_0x3f208c){var _0x4bde03={};_0x4bde03[_0x3f208c]={'$like':'%'+_0x20d1ff[_0x2189('0x32')][_0x2189('0x40')]+'%'};return _0x4bde03;})});}_0x199fce=_[_0x2189('0x4a')]({},_0x199fce,_0x20d1ff['options']);return _0xefa9d7[_0x2189('0x55')](_0x199fce);}})[_0x2189('0x25')](function(_0x4858e6){if(_0x4858e6){_0x41fab5=_0x4858e6[_0x2189('0x39')];if(!_0x20d1ff['query']['hasOwnProperty'](_0x2189('0x3a'))){_0x199fce[_0x2189('0x3b')]=qs[_0x2189('0x3b')](_0x20d1ff[_0x2189('0x32')]['limit']);_0x199fce['offset']=qs['offset'](_0x20d1ff[_0x2189('0x32')][_0x2189('0x1d')]);}return _0xefa9d7['getTags'](_0x199fce);}})['then'](function(_0x8baaab){if(_0x8baaab){return _0x8baaab?{'count':_0x41fab5,'rows':_0x8baaab}:null;}})[_0x2189('0x25')](respondWithResult(_0x104934,null))[_0x2189('0x46')](handleError(_0x104934,null));};exports[_0x2189('0x56')]=function(_0x1ab219,_0x2e33da,_0x3a7d12){if(_0x1ab219[_0x2189('0x4d')]['id']){delete _0x1ab219[_0x2189('0x4d')]['id'];}return db['DeskConfiguration'][_0x2189('0x4f')]({'where':{'id':_0x1ab219['params']['id']}})[_0x2189('0x25')](handleEntityNotFound(_0x2e33da,null))[_0x2189('0x25')](function(_0x36eaff){if(_0x36eaff){return _0x36eaff[_0x2189('0x56')](_0x1ab219[_0x2189('0x4d')][_0x2189('0x57')]||[]);}return null;})[_0x2189('0x25')](respondWithResult(_0x2e33da,null))[_0x2189('0x46')](handleError(_0x2e33da,null));}; \ No newline at end of file +var _0x093d=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','DeskConfiguration','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','update','body','getFields','DeskField','length','hasOwnProperty','getSubjects','getDescriptions','findOne','getTags','Tag','eml-format','rimraf'];(function(_0x5c3ce0,_0x590bab){var _0x1d41d8=function(_0x37ffe9){while(--_0x37ffe9){_0x5c3ce0['push'](_0x5c3ce0['shift']());}};_0x1d41d8(++_0x590bab);}(_0x093d,0xfd));var _0xd093=function(_0x1be67f,_0x2de2f3){_0x1be67f=_0x1be67f-0x0;var _0x2abef4=_0x093d[_0x1be67f];return _0x2abef4;};'use strict';var emlformat=require(_0xd093('0x0'));var rimraf=require(_0xd093('0x1'));var zipdir=require(_0xd093('0x2'));var jsonpatch=require(_0xd093('0x3'));var rp=require(_0xd093('0x4'));var moment=require(_0xd093('0x5'));var BPromise=require(_0xd093('0x6'));var Mustache=require('mustache');var util=require(_0xd093('0x7'));var path=require(_0xd093('0x8'));var sox=require(_0xd093('0x9'));var csv=require(_0xd093('0xa'));var ejs=require(_0xd093('0xb'));var fs=require('fs');var fs_extra=require(_0xd093('0xc'));var _=require('lodash');var squel=require(_0xd093('0xd'));var crypto=require(_0xd093('0xe'));var jsforce=require(_0xd093('0xf'));var deskjs=require(_0xd093('0x10'));var toCsv=require(_0xd093('0xa'));var querystring=require(_0xd093('0x11'));var Papa=require(_0xd093('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd093('0x13'));var as=require(_0xd093('0x14'));var hardwareService=require(_0xd093('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd093('0x16'));var config=require(_0xd093('0x17'));var licenseUtil=require(_0xd093('0x18'));var db=require(_0xd093('0x19'))['db'];function respondWithStatusCode(_0x21e4f7,_0x4a8a4b){_0x4a8a4b=_0x4a8a4b||0xcc;return function(_0x38d336){if(_0x38d336){return _0x21e4f7['sendStatus'](_0x4a8a4b);}return _0x21e4f7[_0xd093('0x1a')](_0x4a8a4b)['end']();};}function respondWithResult(_0x5c9c2b,_0x4398c2){_0x4398c2=_0x4398c2||0xc8;return function(_0x412302){if(_0x412302){return _0x5c9c2b[_0xd093('0x1a')](_0x4398c2)['json'](_0x412302);}};}function respondWithFilteredResult(_0x71b631,_0x2e3409){return function(_0x4b79bf){if(_0x4b79bf){var _0x49952c=typeof _0x2e3409[_0xd093('0x1b')]==='undefined'&&typeof _0x2e3409[_0xd093('0x1c')]===_0xd093('0x1d');var _0x57dd04=_0x4b79bf['count'];var _0x10fbbc=_0x49952c?0x0:_0x2e3409[_0xd093('0x1b')];var _0x28e2ae=_0x49952c?_0x4b79bf[_0xd093('0x1e')]:_0x2e3409[_0xd093('0x1b')]+_0x2e3409[_0xd093('0x1c')];var _0x500185;if(_0x28e2ae>=_0x57dd04){_0x28e2ae=_0x57dd04;_0x500185=0xc8;}else{_0x500185=0xce;}_0x71b631[_0xd093('0x1a')](_0x500185);return _0x71b631['set'](_0xd093('0x1f'),_0x10fbbc+'-'+_0x28e2ae+'/'+_0x57dd04)[_0xd093('0x20')](_0x4b79bf);}return null;};}function patchUpdates(_0x548ef9){return function(_0x4a9509){try{jsonpatch[_0xd093('0x21')](_0x4a9509,_0x548ef9,!![]);}catch(_0x3ff600){return BPromise[_0xd093('0x22')](_0x3ff600);}return _0x4a9509[_0xd093('0x23')]();};}function saveUpdates(_0x1489f0,_0x2a1337){return function(_0x5d5d4a){if(_0x5d5d4a){return _0x5d5d4a['update'](_0x1489f0)[_0xd093('0x24')](function(_0xceb3d1){return _0xceb3d1;});}return null;};}function removeEntity(_0x3d7dec,_0x37f251){return function(_0x239776){if(_0x239776){return _0x239776[_0xd093('0x25')]()['then'](function(){_0x3d7dec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a9c43,_0x3f6bcf){return function(_0x3b55a3){if(!_0x3b55a3){_0x3a9c43[_0xd093('0x26')](0x194);}return _0x3b55a3;};}function handleError(_0x122aa2,_0x552b19){_0x552b19=_0x552b19||0x1f4;return function(_0x4937db){logger[_0xd093('0x27')](_0x4937db[_0xd093('0x28')]);if(_0x4937db['name']){delete _0x4937db['name'];}_0x122aa2[_0xd093('0x1a')](_0x552b19)[_0xd093('0x29')](_0x4937db);};}exports[_0xd093('0x2a')]=function(_0x18c5e4,_0x398768){var _0x2c537a={},_0x56b789={},_0x42e9f4={'count':0x0,'rows':[]};var _0xa50ca9=_[_0xd093('0x2b')](db[_0xd093('0x2c')][_0xd093('0x2d')],function(_0x1f2fbb){return{'name':_0x1f2fbb['fieldName'],'type':_0x1f2fbb['type'][_0xd093('0x2e')]};});_0x56b789[_0xd093('0x2f')]=_['map'](_0xa50ca9,_0xd093('0x30'));_0x56b789[_0xd093('0x31')]=_[_0xd093('0x32')](_0x18c5e4[_0xd093('0x31')]);_0x56b789[_0xd093('0x33')]=_[_0xd093('0x34')](_0x56b789[_0xd093('0x2f')],_0x56b789[_0xd093('0x31')]);_0x2c537a[_0xd093('0x35')]=_['intersection'](_0x56b789[_0xd093('0x2f')],qs['fields'](_0x18c5e4[_0xd093('0x31')]['fields']));_0x2c537a[_0xd093('0x35')]=_0x2c537a['attributes']['length']?_0x2c537a['attributes']:_0x56b789[_0xd093('0x2f')];if(!_0x18c5e4[_0xd093('0x31')]['hasOwnProperty'](_0xd093('0x36'))){_0x2c537a[_0xd093('0x1c')]=qs[_0xd093('0x1c')](_0x18c5e4['query'][_0xd093('0x1c')]);_0x2c537a['offset']=qs[_0xd093('0x1b')](_0x18c5e4[_0xd093('0x31')][_0xd093('0x1b')]);}_0x2c537a[_0xd093('0x37')]=qs['sort'](_0x18c5e4[_0xd093('0x31')][_0xd093('0x38')]);_0x2c537a['where']=qs['filters'](_[_0xd093('0x39')](_0x18c5e4[_0xd093('0x31')],_0x56b789[_0xd093('0x33')]),_0xa50ca9);if(_0x18c5e4['query'][_0xd093('0x3a')]){_0x2c537a[_0xd093('0x3b')]=_[_0xd093('0x3c')](_0x2c537a[_0xd093('0x3b')],{'$or':_[_0xd093('0x2b')](_0xa50ca9,function(_0x241fed){if(_0x241fed[_0xd093('0x3d')]!==_0xd093('0x3e')){var _0x426396={};_0x426396[_0x241fed['name']]={'$like':'%'+_0x18c5e4['query']['filter']+'%'};return _0x426396;}})});}_0x2c537a=_[_0xd093('0x3c')]({},_0x2c537a,_0x18c5e4[_0xd093('0x3f')]);var _0x42efa0={'where':_0x2c537a[_0xd093('0x3b')]};return db[_0xd093('0x2c')][_0xd093('0x1e')](_0x42efa0)[_0xd093('0x24')](function(_0x22890c){_0x42e9f4['count']=_0x22890c;if(_0x18c5e4[_0xd093('0x31')][_0xd093('0x40')]){_0x2c537a['include']=[{'all':!![]}];}return db[_0xd093('0x2c')][_0xd093('0x41')](_0x2c537a);})[_0xd093('0x24')](function(_0x2d4045){_0x42e9f4[_0xd093('0x42')]=_0x2d4045;return _0x42e9f4;})[_0xd093('0x24')](respondWithFilteredResult(_0x398768,_0x2c537a))[_0xd093('0x43')](handleError(_0x398768,null));};exports[_0xd093('0x44')]=function(_0x332f72,_0x70e9ed){var _0x5db9b0={'raw':![],'where':{'id':_0x332f72[_0xd093('0x45')]['id']}},_0x37264c={};_0x37264c[_0xd093('0x2f')]=_['keys'](db[_0xd093('0x2c')][_0xd093('0x2d')]);_0x37264c[_0xd093('0x31')]=_['keys'](_0x332f72['query']);_0x37264c[_0xd093('0x33')]=_[_0xd093('0x34')](_0x37264c['model'],_0x37264c[_0xd093('0x31')]);_0x5db9b0['attributes']=_[_0xd093('0x34')](_0x37264c[_0xd093('0x2f')],qs[_0xd093('0x46')](_0x332f72['query']['fields']));_0x5db9b0[_0xd093('0x35')]=_0x5db9b0[_0xd093('0x35')]['length']?_0x5db9b0[_0xd093('0x35')]:_0x37264c[_0xd093('0x2f')];if(_0x332f72[_0xd093('0x31')][_0xd093('0x40')]){_0x5db9b0[_0xd093('0x47')]=[{'all':!![]}];}_0x5db9b0=_[_0xd093('0x3c')]({},_0x5db9b0,_0x332f72[_0xd093('0x3f')]);return db[_0xd093('0x2c')][_0xd093('0x48')](_0x5db9b0)[_0xd093('0x24')](handleEntityNotFound(_0x70e9ed,null))[_0xd093('0x24')](respondWithResult(_0x70e9ed,null))[_0xd093('0x43')](handleError(_0x70e9ed,null));};exports[_0xd093('0x49')]=function(_0x1ee91a,_0x140e90){return db[_0xd093('0x2c')][_0xd093('0x49')](_0x1ee91a['body'],{})['then'](respondWithResult(_0x140e90,0xc9))[_0xd093('0x43')](handleError(_0x140e90,null));};exports[_0xd093('0x4a')]=function(_0xea9d56,_0x279a89){if(_0xea9d56['body']['id']){delete _0xea9d56[_0xd093('0x4b')]['id'];}return db[_0xd093('0x2c')][_0xd093('0x48')]({'where':{'id':_0xea9d56[_0xd093('0x45')]['id']}})[_0xd093('0x24')](handleEntityNotFound(_0x279a89,null))[_0xd093('0x24')](saveUpdates(_0xea9d56[_0xd093('0x4b')],null))['then'](respondWithResult(_0x279a89,null))[_0xd093('0x43')](handleError(_0x279a89,null));};exports[_0xd093('0x25')]=function(_0x4da6e8,_0x586260){return db[_0xd093('0x2c')][_0xd093('0x48')]({'where':{'id':_0x4da6e8[_0xd093('0x45')]['id']}})[_0xd093('0x24')](handleEntityNotFound(_0x586260,null))[_0xd093('0x24')](removeEntity(_0x586260,null))[_0xd093('0x43')](handleError(_0x586260,null));};exports[_0xd093('0x4c')]=function(_0x18c36a,_0x2638e0,_0x1592fd){var _0x14f1b2={};var _0x2b6faa={};var _0x80cd68;var _0x506869;return db[_0xd093('0x2c')]['findOne']({'where':{'id':_0x18c36a['params']['id']}})[_0xd093('0x24')](handleEntityNotFound(_0x2638e0,null))[_0xd093('0x24')](function(_0x355b01){if(_0x355b01){_0x80cd68=_0x355b01;_0x2b6faa['model']=_[_0xd093('0x32')](db[_0xd093('0x4d')][_0xd093('0x2d')]);_0x2b6faa[_0xd093('0x31')]=_['keys'](_0x18c36a[_0xd093('0x31')]);_0x2b6faa[_0xd093('0x33')]=_[_0xd093('0x34')](_0x2b6faa[_0xd093('0x2f')],_0x2b6faa[_0xd093('0x31')]);_0x14f1b2[_0xd093('0x35')]=_[_0xd093('0x34')](_0x2b6faa[_0xd093('0x2f')],qs[_0xd093('0x46')](_0x18c36a[_0xd093('0x31')][_0xd093('0x46')]));_0x14f1b2[_0xd093('0x35')]=_0x14f1b2[_0xd093('0x35')][_0xd093('0x4e')]?_0x14f1b2[_0xd093('0x35')]:_0x2b6faa['model'];_0x14f1b2['order']=qs['sort'](_0x18c36a[_0xd093('0x31')]['sort']);_0x14f1b2[_0xd093('0x3b')]=qs[_0xd093('0x33')](_['pick'](_0x18c36a[_0xd093('0x31')],_0x2b6faa['filters']));if(_0x18c36a[_0xd093('0x31')][_0xd093('0x3a')]){_0x14f1b2[_0xd093('0x3b')]=_[_0xd093('0x3c')](_0x14f1b2[_0xd093('0x3b')],{'$or':_[_0xd093('0x2b')](_0x14f1b2[_0xd093('0x35')],function(_0x5f0df4){var _0x4bbea2={};_0x4bbea2[_0x5f0df4]={'$like':'%'+_0x18c36a[_0xd093('0x31')]['filter']+'%'};return _0x4bbea2;})});}_0x14f1b2=_[_0xd093('0x3c')]({},_0x14f1b2,_0x18c36a[_0xd093('0x3f')]);return _0x80cd68['getFields'](_0x14f1b2);}})[_0xd093('0x24')](function(_0x385052){if(_0x385052){_0x506869=_0x385052[_0xd093('0x4e')];if(!_0x18c36a[_0xd093('0x31')][_0xd093('0x4f')](_0xd093('0x36'))){_0x14f1b2[_0xd093('0x1c')]=qs[_0xd093('0x1c')](_0x18c36a[_0xd093('0x31')][_0xd093('0x1c')]);_0x14f1b2[_0xd093('0x1b')]=qs[_0xd093('0x1b')](_0x18c36a[_0xd093('0x31')][_0xd093('0x1b')]);}return _0x80cd68['getFields'](_0x14f1b2);}})[_0xd093('0x24')](function(_0x3a2c0a){if(_0x3a2c0a){return _0x3a2c0a?{'count':_0x506869,'rows':_0x3a2c0a}:null;}})[_0xd093('0x24')](respondWithResult(_0x2638e0,null))['catch'](handleError(_0x2638e0,null));};exports[_0xd093('0x50')]=function(_0x571129,_0x5eebaa,_0xa00a3b){var _0xed1571={};var _0x3f8d57={};var _0xa2ee54;var _0x39ebc4;return db[_0xd093('0x2c')]['findOne']({'where':{'id':_0x571129[_0xd093('0x45')]['id']}})[_0xd093('0x24')](handleEntityNotFound(_0x5eebaa,null))[_0xd093('0x24')](function(_0x5d1170){if(_0x5d1170){_0xa2ee54=_0x5d1170;_0x3f8d57[_0xd093('0x2f')]=_['keys'](db[_0xd093('0x4d')][_0xd093('0x2d')]);_0x3f8d57[_0xd093('0x31')]=_['keys'](_0x571129[_0xd093('0x31')]);_0x3f8d57[_0xd093('0x33')]=_[_0xd093('0x34')](_0x3f8d57[_0xd093('0x2f')],_0x3f8d57['query']);_0xed1571[_0xd093('0x35')]=_[_0xd093('0x34')](_0x3f8d57[_0xd093('0x2f')],qs[_0xd093('0x46')](_0x571129[_0xd093('0x31')][_0xd093('0x46')]));_0xed1571[_0xd093('0x35')]=_0xed1571[_0xd093('0x35')]['length']?_0xed1571[_0xd093('0x35')]:_0x3f8d57[_0xd093('0x2f')];_0xed1571[_0xd093('0x37')]=qs[_0xd093('0x38')](_0x571129[_0xd093('0x31')][_0xd093('0x38')]);_0xed1571['where']=qs[_0xd093('0x33')](_[_0xd093('0x39')](_0x571129[_0xd093('0x31')],_0x3f8d57[_0xd093('0x33')]));if(_0x571129['query'][_0xd093('0x3a')]){_0xed1571[_0xd093('0x3b')]=_[_0xd093('0x3c')](_0xed1571['where'],{'$or':_[_0xd093('0x2b')](_0xed1571[_0xd093('0x35')],function(_0x4a4a83){var _0x4a6f17={};_0x4a6f17[_0x4a4a83]={'$like':'%'+_0x571129['query'][_0xd093('0x3a')]+'%'};return _0x4a6f17;})});}_0xed1571=_[_0xd093('0x3c')]({},_0xed1571,_0x571129['options']);return _0xa2ee54[_0xd093('0x50')](_0xed1571);}})[_0xd093('0x24')](function(_0x193590){if(_0x193590){_0x39ebc4=_0x193590[_0xd093('0x4e')];if(!_0x571129[_0xd093('0x31')][_0xd093('0x4f')](_0xd093('0x36'))){_0xed1571[_0xd093('0x1c')]=qs['limit'](_0x571129[_0xd093('0x31')][_0xd093('0x1c')]);_0xed1571[_0xd093('0x1b')]=qs['offset'](_0x571129[_0xd093('0x31')][_0xd093('0x1b')]);}return _0xa2ee54[_0xd093('0x50')](_0xed1571);}})[_0xd093('0x24')](function(_0x106804){if(_0x106804){return _0x106804?{'count':_0x39ebc4,'rows':_0x106804}:null;}})[_0xd093('0x24')](respondWithResult(_0x5eebaa,null))[_0xd093('0x43')](handleError(_0x5eebaa,null));};exports[_0xd093('0x51')]=function(_0x45b7d8,_0x380bfe,_0x5d5685){var _0x187466={};var _0x4d20bd={};var _0x1f684d;var _0x1206f9;return db[_0xd093('0x2c')][_0xd093('0x52')]({'where':{'id':_0x45b7d8['params']['id']}})[_0xd093('0x24')](handleEntityNotFound(_0x380bfe,null))[_0xd093('0x24')](function(_0xe3a416){if(_0xe3a416){_0x1f684d=_0xe3a416;_0x4d20bd['model']=_[_0xd093('0x32')](db[_0xd093('0x4d')][_0xd093('0x2d')]);_0x4d20bd[_0xd093('0x31')]=_[_0xd093('0x32')](_0x45b7d8[_0xd093('0x31')]);_0x4d20bd[_0xd093('0x33')]=_[_0xd093('0x34')](_0x4d20bd[_0xd093('0x2f')],_0x4d20bd[_0xd093('0x31')]);_0x187466[_0xd093('0x35')]=_[_0xd093('0x34')](_0x4d20bd[_0xd093('0x2f')],qs[_0xd093('0x46')](_0x45b7d8['query']['fields']));_0x187466['attributes']=_0x187466[_0xd093('0x35')][_0xd093('0x4e')]?_0x187466['attributes']:_0x4d20bd[_0xd093('0x2f')];_0x187466['order']=qs[_0xd093('0x38')](_0x45b7d8[_0xd093('0x31')]['sort']);_0x187466['where']=qs[_0xd093('0x33')](_[_0xd093('0x39')](_0x45b7d8[_0xd093('0x31')],_0x4d20bd[_0xd093('0x33')]));if(_0x45b7d8[_0xd093('0x31')][_0xd093('0x3a')]){_0x187466['where']=_[_0xd093('0x3c')](_0x187466[_0xd093('0x3b')],{'$or':_[_0xd093('0x2b')](_0x187466[_0xd093('0x35')],function(_0x2e29e3){var _0x2d41d8={};_0x2d41d8[_0x2e29e3]={'$like':'%'+_0x45b7d8['query']['filter']+'%'};return _0x2d41d8;})});}_0x187466=_[_0xd093('0x3c')]({},_0x187466,_0x45b7d8[_0xd093('0x3f')]);return _0x1f684d['getDescriptions'](_0x187466);}})['then'](function(_0x1184a6){if(_0x1184a6){_0x1206f9=_0x1184a6[_0xd093('0x4e')];if(!_0x45b7d8['query'][_0xd093('0x4f')](_0xd093('0x36'))){_0x187466['limit']=qs[_0xd093('0x1c')](_0x45b7d8['query'][_0xd093('0x1c')]);_0x187466[_0xd093('0x1b')]=qs[_0xd093('0x1b')](_0x45b7d8[_0xd093('0x31')][_0xd093('0x1b')]);}return _0x1f684d[_0xd093('0x51')](_0x187466);}})[_0xd093('0x24')](function(_0x379291){if(_0x379291){return _0x379291?{'count':_0x1206f9,'rows':_0x379291}:null;}})['then'](respondWithResult(_0x380bfe,null))['catch'](handleError(_0x380bfe,null));};exports[_0xd093('0x53')]=function(_0x403bfd,_0xed9c15,_0x499e7b){var _0x272035={};var _0x3bfb76={};var _0x3fead7;var _0x29308d;return db[_0xd093('0x2c')]['findOne']({'where':{'id':_0x403bfd[_0xd093('0x45')]['id']}})[_0xd093('0x24')](handleEntityNotFound(_0xed9c15,null))[_0xd093('0x24')](function(_0x4851ac){if(_0x4851ac){_0x3fead7=_0x4851ac;_0x3bfb76[_0xd093('0x2f')]=_[_0xd093('0x32')](db[_0xd093('0x54')]['rawAttributes']);_0x3bfb76[_0xd093('0x31')]=_[_0xd093('0x32')](_0x403bfd[_0xd093('0x31')]);_0x3bfb76[_0xd093('0x33')]=_[_0xd093('0x34')](_0x3bfb76['model'],_0x3bfb76['query']);_0x272035['attributes']=_[_0xd093('0x34')](_0x3bfb76[_0xd093('0x2f')],qs['fields'](_0x403bfd['query'][_0xd093('0x46')]));_0x272035[_0xd093('0x35')]=_0x272035[_0xd093('0x35')][_0xd093('0x4e')]?_0x272035[_0xd093('0x35')]:_0x3bfb76['model'];_0x272035[_0xd093('0x37')]=qs['sort'](_0x403bfd['query']['sort']);_0x272035[_0xd093('0x3b')]=qs['filters'](_[_0xd093('0x39')](_0x403bfd[_0xd093('0x31')],_0x3bfb76[_0xd093('0x33')]));if(_0x403bfd[_0xd093('0x31')][_0xd093('0x3a')]){_0x272035[_0xd093('0x3b')]=_[_0xd093('0x3c')](_0x272035[_0xd093('0x3b')],{'$or':_[_0xd093('0x2b')](_0x272035[_0xd093('0x35')],function(_0xbd9534){var _0xad700={};_0xad700[_0xbd9534]={'$like':'%'+_0x403bfd['query'][_0xd093('0x3a')]+'%'};return _0xad700;})});}_0x272035=_[_0xd093('0x3c')]({},_0x272035,_0x403bfd[_0xd093('0x3f')]);return _0x3fead7['getTags'](_0x272035);}})[_0xd093('0x24')](function(_0x4a6432){if(_0x4a6432){_0x29308d=_0x4a6432[_0xd093('0x4e')];if(!_0x403bfd[_0xd093('0x31')]['hasOwnProperty'](_0xd093('0x36'))){_0x272035['limit']=qs[_0xd093('0x1c')](_0x403bfd['query'][_0xd093('0x1c')]);_0x272035[_0xd093('0x1b')]=qs[_0xd093('0x1b')](_0x403bfd[_0xd093('0x31')][_0xd093('0x1b')]);}return _0x3fead7['getTags'](_0x272035);}})['then'](function(_0x52b188){if(_0x52b188){return _0x52b188?{'count':_0x29308d,'rows':_0x52b188}:null;}})['then'](respondWithResult(_0xed9c15,null))[_0xd093('0x43')](handleError(_0xed9c15,null));};exports['setTags']=function(_0x14f9be,_0x5146d1,_0x4520b8){if(_0x14f9be[_0xd093('0x4b')]['id']){delete _0x14f9be[_0xd093('0x4b')]['id'];}return db['DeskConfiguration'][_0xd093('0x52')]({'where':{'id':_0x14f9be[_0xd093('0x45')]['id']}})[_0xd093('0x24')](handleEntityNotFound(_0x5146d1,null))[_0xd093('0x24')](function(_0x5ccc4e){if(_0x5ccc4e){return _0x5ccc4e['setTags'](_0x14f9be['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x5146d1,null))[_0xd093('0x43')](handleError(_0x5146d1,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8de5300..6755c33 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 _0xdd45=['bluebird','request-promise','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment'];(function(_0x263901,_0x36ae24){var _0x31f81e=function(_0x3c36d9){while(--_0x3c36d9){_0x263901['push'](_0x263901['shift']());}};_0x31f81e(++_0x36ae24);}(_0xdd45,0x10a));var _0x5dd4=function(_0x264350,_0x5bad2c){_0x264350=_0x264350-0x0;var _0x4217cb=_0xdd45[_0x264350];return _0x4217cb;};'use strict';var _=require(_0x5dd4('0x0'));var util=require('util');var logger=require(_0x5dd4('0x1'))(_0x5dd4('0x2'));var moment=require(_0x5dd4('0x3'));var BPromise=require(_0x5dd4('0x4'));var rp=require(_0x5dd4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5dd4('0x6'));var attributes=require(_0x5dd4('0x7'));module['exports']=function(_0x46dd0e,_0xbb4ae4){return _0x46dd0e['define'](_0x5dd4('0x8'),attributes,{'tableName':_0x5dd4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x826b=['moment','request-promise','path','../../config/environment','DeskConfiguration','../../config/logger','api'];(function(_0x24929c,_0x4c6588){var _0x18de2f=function(_0x426bb6){while(--_0x426bb6){_0x24929c['push'](_0x24929c['shift']());}};_0x18de2f(++_0x4c6588);}(_0x826b,0x139));var _0xb826=function(_0x13bbc5,_0x307449){_0x13bbc5=_0x13bbc5-0x0;var _0x4c14ca=_0x826b[_0x13bbc5];return _0x4c14ca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb826('0x0'))(_0xb826('0x1'));var moment=require(_0xb826('0x2'));var BPromise=require('bluebird');var rp=require(_0xb826('0x3'));var fs=require('fs');var path=require(_0xb826('0x4'));var rimraf=require('rimraf');var config=require(_0xb826('0x5'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x12fdec,_0x1a6d93){return _0x12fdec['define'](_0xb826('0x6'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index b83369a..5917337 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 _0x2432=['message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2432,0x7a));var _0x2243=function(_0x3e6d6e,_0x3f83b7){_0x3e6d6e=_0x3e6d6e-0x0;var _0xbc81d3=_0x2432[_0x3e6d6e];return _0xbc81d3;};'use strict';var _=require(_0x2243('0x0'));var util=require(_0x2243('0x1'));var moment=require(_0x2243('0x2'));var BPromise=require(_0x2243('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2243('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2243('0x5'));var logger=require(_0x2243('0x6'))(_0x2243('0x7'));var config=require(_0x2243('0x8'));var jayson=require(_0x2243('0x9'));var client=jayson[_0x2243('0xa')][_0x2243('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28678a,_0x1c42af,_0x4f196b){return new BPromise(function(_0x440203,_0x128d83){return client[_0x2243('0xc')](_0x28678a,_0x4f196b)[_0x2243('0xd')](function(_0x31a479){logger[_0x2243('0xe')](_0x2243('0xf'),_0x1c42af,_0x2243('0x10'));logger[_0x2243('0x11')](_0x2243('0x12'),_0x1c42af,_0x2243('0x10'),JSON[_0x2243('0x13')](_0x31a479));if(_0x31a479[_0x2243('0x14')]){if(_0x31a479[_0x2243('0x14')][_0x2243('0x15')]===0x1f4){logger[_0x2243('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x1c42af,_0x31a479[_0x2243('0x14')][_0x2243('0x16')]);return _0x128d83(_0x31a479[_0x2243('0x14')][_0x2243('0x16')]);}logger['error'](_0x2243('0xf'),_0x1c42af,_0x31a479['error'][_0x2243('0x16')]);return _0x440203(_0x31a479['error'][_0x2243('0x16')]);}else{logger[_0x2243('0xe')](_0x2243('0xf'),_0x1c42af,_0x2243('0x10'));_0x440203(_0x31a479['result']['message']);}})[_0x2243('0x17')](function(_0x31ca17){logger[_0x2243('0x14')](_0x2243('0xf'),_0x1c42af,_0x31ca17);_0x128d83(_0x31ca17);});});} \ No newline at end of file +var _0xb4f4=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0xf09a90,_0x287572){var _0x5d57d8=function(_0x9afd67){while(--_0x9afd67){_0xf09a90['push'](_0xf09a90['shift']());}};_0x5d57d8(++_0x287572);}(_0xb4f4,0xda));var _0x4b4f=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xb4f4[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x4b4f('0x0'));var util=require(_0x4b4f('0x1'));var moment=require('moment');var BPromise=require(_0x4b4f('0x2'));var rs=require(_0x4b4f('0x3'));var fs=require('fs');var Redis=require(_0x4b4f('0x4'));var db=require(_0x4b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b4f('0x6'))(_0x4b4f('0x7'));var config=require(_0x4b4f('0x8'));var jayson=require(_0x4b4f('0x9'));var client=jayson[_0x4b4f('0xa')][_0x4b4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x405321,_0x58c1e5,_0x5ba9b0){return new BPromise(function(_0x108b4e,_0x2c647f){return client[_0x4b4f('0xc')](_0x405321,_0x5ba9b0)[_0x4b4f('0xd')](function(_0x25e0c9){logger['info'](_0x4b4f('0xe'),_0x58c1e5,_0x4b4f('0xf'));logger[_0x4b4f('0x10')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x58c1e5,_0x4b4f('0xf'),JSON[_0x4b4f('0x11')](_0x25e0c9));if(_0x25e0c9['error']){if(_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x13')]===0x1f4){logger[_0x4b4f('0x12')](_0x4b4f('0xe'),_0x58c1e5,_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);return _0x2c647f(_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x58c1e5,_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);return _0x108b4e(_0x25e0c9['error'][_0x4b4f('0x14')]);}else{logger[_0x4b4f('0x15')](_0x4b4f('0xe'),_0x58c1e5,'request\x20sent');_0x108b4e(_0x25e0c9[_0x4b4f('0x16')][_0x4b4f('0x14')]);}})[_0x4b4f('0x17')](function(_0x57d09a){logger[_0x4b4f('0x12')](_0x4b4f('0xe'),_0x58c1e5,_0x57d09a);_0x2c647f(_0x57d09a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ce1d3d6..83432c8 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 _0x2b10=['put','/:id','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','show','post','create'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x2b10,0x114));var _0x02b1=function(_0x428fd3,_0x2312a4){_0x428fd3=_0x428fd3-0x0;var _0x44dd63=_0x2b10[_0x428fd3];return _0x44dd63;};'use strict';var multer=require(_0x02b1('0x0'));var util=require('util');var path=require(_0x02b1('0x1'));var timeout=require(_0x02b1('0x2'));var express=require(_0x02b1('0x3'));var router=express[_0x02b1('0x4')]();var fs_extra=require(_0x02b1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x02b1('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x02b1('0x7')]('/',auth[_0x02b1('0x8')](),controller[_0x02b1('0x9')]);router[_0x02b1('0x7')]('/:id',auth[_0x02b1('0x8')](),controller[_0x02b1('0xa')]);router[_0x02b1('0xb')]('/',auth[_0x02b1('0x8')](),controller[_0x02b1('0xc')]);router[_0x02b1('0xd')](_0x02b1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x02b1('0xf')](_0x02b1('0xe'),auth[_0x02b1('0x8')](),controller['destroy']);module[_0x02b1('0x10')]=router; \ No newline at end of file +var _0xcb27=['./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xcb27,0x115));var _0x7cb2=function(_0x365f3d,_0x4dbeb2){_0x365f3d=_0x365f3d-0x0;var _0x2f22cc=_0xcb27[_0x365f3d];return _0x2f22cc;};'use strict';var multer=require(_0x7cb2('0x0'));var util=require(_0x7cb2('0x1'));var path=require(_0x7cb2('0x2'));var timeout=require(_0x7cb2('0x3'));var express=require(_0x7cb2('0x4'));var router=express[_0x7cb2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7cb2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7cb2('0x7'));var controller=require(_0x7cb2('0x8'));router[_0x7cb2('0x9')]('/',auth[_0x7cb2('0xa')](),controller['index']);router[_0x7cb2('0x9')](_0x7cb2('0xb'),auth[_0x7cb2('0xa')](),controller[_0x7cb2('0xc')]);router[_0x7cb2('0xd')]('/',auth['isAuthenticated'](),controller[_0x7cb2('0xe')]);router[_0x7cb2('0xf')](_0x7cb2('0xb'),auth[_0x7cb2('0xa')](),controller[_0x7cb2('0x10')]);router['delete'](_0x7cb2('0xb'),auth[_0x7cb2('0xa')](),controller[_0x7cb2('0x11')]);module[_0x7cb2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 4f851cb..bad2ba8 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 _0xf259=['customVariable','BOOLEAN','exports','ENUM','string','variable','STRING'];(function(_0x2a35bf,_0xe9adcd){var _0x1a0cd1=function(_0x53093b){while(--_0x53093b){_0x2a35bf['push'](_0x2a35bf['shift']());}};_0x1a0cd1(++_0xe9adcd);}(_0xf259,0x13d));var _0x9f25=function(_0x1b4d28,_0x188009){_0x1b4d28=_0x1b4d28-0x0;var _0x7bc4c7=_0xf259[_0x1b4d28];return _0x7bc4c7;};'use strict';var Sequelize=require('sequelize');module[_0x9f25('0x0')]={'type':{'type':Sequelize[_0x9f25('0x1')](_0x9f25('0x2'),_0x9f25('0x3'),'customVariable','keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x9f25('0x4')]},'key':{'type':Sequelize[_0x9f25('0x4')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x9f25('0x5'))},'keyContent':{'type':Sequelize[_0x9f25('0x4')]},'idField':{'type':Sequelize[_0x9f25('0x4')]},'nameField':{'type':Sequelize[_0x9f25('0x4')]},'customField':{'type':Sequelize[_0x9f25('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf8d3=['STRING','ENUM','string','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x19e5fa,_0x5bce9d){var _0x35a3a5=function(_0x3545a9){while(--_0x3545a9){_0x19e5fa['push'](_0x19e5fa['shift']());}};_0x35a3a5(++_0x5bce9d);}(_0xf8d3,0x16c));var _0x3f8d=function(_0xac0d3,_0x3d1441){_0xac0d3=_0xac0d3-0x0;var _0x277107=_0xf8d3[_0xac0d3];return _0x277107;};'use strict';var Sequelize=require(_0x3f8d('0x0'));module[_0x3f8d('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x3f8d('0x2'),_0x3f8d('0x3'),_0x3f8d('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3f8d('0x5')]},'key':{'type':Sequelize[_0x3f8d('0x5')]},'keyType':{'type':Sequelize[_0x3f8d('0x6')](_0x3f8d('0x7'),_0x3f8d('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3f8d('0x5')]},'nameField':{'type':Sequelize[_0x3f8d('0x5')]},'customField':{'type':Sequelize[_0x3f8d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 70edd28..5106fa1 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 _0xf198=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','DeskField','key','keys','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','catch','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x32c012,_0xe3c576){var _0x48562e=function(_0x505228){while(--_0x505228){_0x32c012['push'](_0x32c012['shift']());}};_0x48562e(++_0xe3c576);}(_0xf198,0xd1));var _0x8f19=function(_0x168f72,_0x3b170d){_0x168f72=_0x168f72-0x0;var _0x264d18=_0xf198[_0x168f72];return _0x264d18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f19('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f19('0x1'));var rp=require(_0x8f19('0x2'));var moment=require(_0x8f19('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8f19('0x4'));var util=require(_0x8f19('0x5'));var path=require(_0x8f19('0x6'));var sox=require(_0x8f19('0x7'));var csv=require(_0x8f19('0x8'));var ejs=require(_0x8f19('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f19('0xa'));var squel=require(_0x8f19('0xb'));var crypto=require(_0x8f19('0xc'));var jsforce=require(_0x8f19('0xd'));var deskjs=require(_0x8f19('0xe'));var toCsv=require(_0x8f19('0x8'));var querystring=require('querystring');var Papa=require(_0x8f19('0xf'));var Redis=require(_0x8f19('0x10'));var authService=require(_0x8f19('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8f19('0x12'));var hardwareService=require(_0x8f19('0x13'));var logger=require(_0x8f19('0x14'))(_0x8f19('0x15'));var utils=require('../../config/utils');var config=require(_0x8f19('0x16'));var licenseUtil=require(_0x8f19('0x17'));var db=require(_0x8f19('0x18'))['db'];function respondWithStatusCode(_0x1afe2f,_0x18cb33){_0x18cb33=_0x18cb33||0xcc;return function(_0xd01cf6){if(_0xd01cf6){return _0x1afe2f[_0x8f19('0x19')](_0x18cb33);}return _0x1afe2f[_0x8f19('0x1a')](_0x18cb33)['end']();};}function respondWithResult(_0x19a6f2,_0x3d4e76){_0x3d4e76=_0x3d4e76||0xc8;return function(_0x3df500){if(_0x3df500){return _0x19a6f2[_0x8f19('0x1a')](_0x3d4e76)[_0x8f19('0x1b')](_0x3df500);}};}function respondWithFilteredResult(_0x47bae1,_0x81f091){return function(_0x31d441){if(_0x31d441){var _0x43e309=typeof _0x81f091[_0x8f19('0x1c')]===_0x8f19('0x1d')&&typeof _0x81f091[_0x8f19('0x1e')]==='undefined';var _0x5ab156=_0x31d441[_0x8f19('0x1f')];var _0x578607=_0x43e309?0x0:_0x81f091['offset'];var _0x5c3b69=_0x43e309?_0x31d441[_0x8f19('0x1f')]:_0x81f091[_0x8f19('0x1c')]+_0x81f091[_0x8f19('0x1e')];var _0x15df5b;if(_0x5c3b69>=_0x5ab156){_0x5c3b69=_0x5ab156;_0x15df5b=0xc8;}else{_0x15df5b=0xce;}_0x47bae1['status'](_0x15df5b);return _0x47bae1[_0x8f19('0x20')]('Content-Range',_0x578607+'-'+_0x5c3b69+'/'+_0x5ab156)[_0x8f19('0x1b')](_0x31d441);}return null;};}function patchUpdates(_0x16d351){return function(_0x151ad7){try{jsonpatch[_0x8f19('0x21')](_0x151ad7,_0x16d351,!![]);}catch(_0x5348cf){return BPromise[_0x8f19('0x22')](_0x5348cf);}return _0x151ad7[_0x8f19('0x23')]();};}function saveUpdates(_0x5d99a0,_0x2a0ab0){return function(_0x2b5852){if(_0x2b5852){return _0x2b5852['update'](_0x5d99a0)[_0x8f19('0x24')](function(_0x5b00fe){return _0x5b00fe;});}return null;};}function removeEntity(_0xe66f7c,_0x4d340d){return function(_0x409449){if(_0x409449){return _0x409449[_0x8f19('0x25')]()[_0x8f19('0x24')](function(){_0xe66f7c[_0x8f19('0x1a')](0xcc)[_0x8f19('0x26')]();});}};}function handleEntityNotFound(_0x2a8395,_0x5854ac){return function(_0x4c2e19){if(!_0x4c2e19){_0x2a8395[_0x8f19('0x19')](0x194);}return _0x4c2e19;};}function handleError(_0x11d990,_0x41b5d5){_0x41b5d5=_0x41b5d5||0x1f4;return function(_0x59a812){logger[_0x8f19('0x27')](_0x59a812[_0x8f19('0x28')]);if(_0x59a812[_0x8f19('0x29')]){delete _0x59a812[_0x8f19('0x29')];}_0x11d990['status'](_0x41b5d5)[_0x8f19('0x2a')](_0x59a812);};}exports[_0x8f19('0x2b')]=function(_0x282980,_0x365210){var _0x4ab178={},_0x101d71={},_0x2b150e={'count':0x0,'rows':[]};var _0x38ee66=_[_0x8f19('0x2c')](db[_0x8f19('0x2d')]['rawAttributes'],function(_0x251171){return{'name':_0x251171['fieldName'],'type':_0x251171['type'][_0x8f19('0x2e')]};});_0x101d71['model']=_[_0x8f19('0x2c')](_0x38ee66,_0x8f19('0x29'));_0x101d71['query']=_[_0x8f19('0x2f')](_0x282980[_0x8f19('0x30')]);_0x101d71[_0x8f19('0x31')]=_['intersection'](_0x101d71['model'],_0x101d71[_0x8f19('0x30')]);_0x4ab178[_0x8f19('0x32')]=_[_0x8f19('0x33')](_0x101d71[_0x8f19('0x34')],qs[_0x8f19('0x35')](_0x282980[_0x8f19('0x30')][_0x8f19('0x35')]));_0x4ab178[_0x8f19('0x32')]=_0x4ab178[_0x8f19('0x32')][_0x8f19('0x36')]?_0x4ab178['attributes']:_0x101d71['model'];if(!_0x282980['query']['hasOwnProperty'](_0x8f19('0x37'))){_0x4ab178[_0x8f19('0x1e')]=qs[_0x8f19('0x1e')](_0x282980[_0x8f19('0x30')][_0x8f19('0x1e')]);_0x4ab178[_0x8f19('0x1c')]=qs['offset'](_0x282980['query'][_0x8f19('0x1c')]);}_0x4ab178[_0x8f19('0x38')]=qs['sort'](_0x282980[_0x8f19('0x30')][_0x8f19('0x39')]);_0x4ab178['where']=qs[_0x8f19('0x31')](_['pick'](_0x282980['query'],_0x101d71[_0x8f19('0x31')]),_0x38ee66);if(_0x282980[_0x8f19('0x30')]['filter']){_0x4ab178[_0x8f19('0x3a')]=_[_0x8f19('0x3b')](_0x4ab178[_0x8f19('0x3a')],{'$or':_[_0x8f19('0x2c')](_0x38ee66,function(_0x52811f){if(_0x52811f[_0x8f19('0x3c')]!==_0x8f19('0x3d')){var _0x3d9e26={};_0x3d9e26[_0x52811f[_0x8f19('0x29')]]={'$like':'%'+_0x282980[_0x8f19('0x30')][_0x8f19('0x3e')]+'%'};return _0x3d9e26;}})});}_0x4ab178=_[_0x8f19('0x3b')]({},_0x4ab178,_0x282980[_0x8f19('0x3f')]);var _0x13c77a={'where':_0x4ab178['where']};return db[_0x8f19('0x2d')][_0x8f19('0x1f')](_0x13c77a)[_0x8f19('0x24')](function(_0x53a79d){_0x2b150e[_0x8f19('0x1f')]=_0x53a79d;if(_0x282980[_0x8f19('0x30')]['includeAll']){_0x4ab178[_0x8f19('0x40')]=[{'all':!![]}];}return db[_0x8f19('0x2d')]['findAll'](_0x4ab178);})[_0x8f19('0x24')](function(_0x3377b1){_0x2b150e[_0x8f19('0x41')]=_0x3377b1;return _0x2b150e;})[_0x8f19('0x24')](respondWithFilteredResult(_0x365210,_0x4ab178))['catch'](handleError(_0x365210,null));};exports[_0x8f19('0x42')]=function(_0x4750b5,_0x49200c){var _0x53aa13={'raw':!![],'where':{'id':_0x4750b5[_0x8f19('0x43')]['id']}},_0x37d8bd={};_0x37d8bd[_0x8f19('0x34')]=_[_0x8f19('0x2f')](db['DeskField'][_0x8f19('0x44')]);_0x37d8bd[_0x8f19('0x30')]=_['keys'](_0x4750b5['query']);_0x37d8bd[_0x8f19('0x31')]=_[_0x8f19('0x33')](_0x37d8bd[_0x8f19('0x34')],_0x37d8bd[_0x8f19('0x30')]);_0x53aa13[_0x8f19('0x32')]=_[_0x8f19('0x33')](_0x37d8bd[_0x8f19('0x34')],qs[_0x8f19('0x35')](_0x4750b5[_0x8f19('0x30')][_0x8f19('0x35')]));_0x53aa13['attributes']=_0x53aa13[_0x8f19('0x32')][_0x8f19('0x36')]?_0x53aa13[_0x8f19('0x32')]:_0x37d8bd[_0x8f19('0x34')];if(_0x4750b5[_0x8f19('0x30')][_0x8f19('0x45')]){_0x53aa13['include']=[{'all':!![]}];}_0x53aa13=_['merge']({},_0x53aa13,_0x4750b5['options']);return db['DeskField']['find'](_0x53aa13)[_0x8f19('0x24')](handleEntityNotFound(_0x49200c,null))[_0x8f19('0x24')](respondWithResult(_0x49200c,null))[_0x8f19('0x46')](handleError(_0x49200c,null));};exports[_0x8f19('0x47')]=function(_0x383890,_0x57c5d6){return db['DeskField'][_0x8f19('0x47')](_0x383890['body'],{})[_0x8f19('0x24')](respondWithResult(_0x57c5d6,0xc9))[_0x8f19('0x46')](handleError(_0x57c5d6,null));};exports['update']=function(_0x3e664f,_0x3f4df5){if(_0x3e664f['body']['id']){delete _0x3e664f[_0x8f19('0x48')]['id'];}return db['DeskField'][_0x8f19('0x49')]({'where':{'id':_0x3e664f[_0x8f19('0x43')]['id']}})[_0x8f19('0x24')](handleEntityNotFound(_0x3f4df5,null))[_0x8f19('0x24')](saveUpdates(_0x3e664f[_0x8f19('0x48')],null))[_0x8f19('0x24')](respondWithResult(_0x3f4df5,null))['catch'](handleError(_0x3f4df5,null));};exports[_0x8f19('0x25')]=function(_0x36dae5,_0xe179ee){return db[_0x8f19('0x2d')][_0x8f19('0x49')]({'where':{'id':_0x36dae5[_0x8f19('0x43')]['id']}})[_0x8f19('0x24')](handleEntityNotFound(_0xe179ee,null))[_0x8f19('0x24')](removeEntity(_0xe179ee,null))[_0x8f19('0x46')](handleError(_0xe179ee,null));}; \ No newline at end of file +var _0xc21c=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map','DeskField','type','query','intersection','model','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','create','body','destroy','eml-format','rimraf'];(function(_0x148374,_0x13c2cf){var _0x505df4=function(_0x15c568){while(--_0x15c568){_0x148374['push'](_0x148374['shift']());}};_0x505df4(++_0x13c2cf);}(_0xc21c,0x166));var _0xcc21=function(_0x3076d9,_0x16eebd){_0x3076d9=_0x3076d9-0x0;var _0x112a20=_0xc21c[_0x3076d9];return _0x112a20;};'use strict';var emlformat=require(_0xcc21('0x0'));var rimraf=require(_0xcc21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc21('0x2'));var rp=require(_0xcc21('0x3'));var moment=require(_0xcc21('0x4'));var BPromise=require(_0xcc21('0x5'));var Mustache=require('mustache');var util=require(_0xcc21('0x6'));var path=require(_0xcc21('0x7'));var sox=require(_0xcc21('0x8'));var csv=require(_0xcc21('0x9'));var ejs=require(_0xcc21('0xa'));var fs=require('fs');var fs_extra=require(_0xcc21('0xb'));var _=require(_0xcc21('0xc'));var squel=require('squel');var crypto=require(_0xcc21('0xd'));var jsforce=require(_0xcc21('0xe'));var deskjs=require(_0xcc21('0xf'));var toCsv=require(_0xcc21('0x9'));var querystring=require('querystring');var Papa=require(_0xcc21('0x10'));var Redis=require('ioredis');var authService=require(_0xcc21('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcc21('0x12'));var hardwareService=require(_0xcc21('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcc21('0x14'));var config=require(_0xcc21('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc21('0x16'))['db'];function respondWithStatusCode(_0x5a9e2e,_0x3c45c7){_0x3c45c7=_0x3c45c7||0xcc;return function(_0x1b0454){if(_0x1b0454){return _0x5a9e2e[_0xcc21('0x17')](_0x3c45c7);}return _0x5a9e2e['status'](_0x3c45c7)[_0xcc21('0x18')]();};}function respondWithResult(_0x4d183b,_0xdd42cd){_0xdd42cd=_0xdd42cd||0xc8;return function(_0x35b642){if(_0x35b642){return _0x4d183b[_0xcc21('0x19')](_0xdd42cd)[_0xcc21('0x1a')](_0x35b642);}};}function respondWithFilteredResult(_0x6e9b5a,_0x123438){return function(_0x160e8d){if(_0x160e8d){var _0x5b3cd2=typeof _0x123438['offset']===_0xcc21('0x1b')&&typeof _0x123438['limit']===_0xcc21('0x1b');var _0x207b02=_0x160e8d[_0xcc21('0x1c')];var _0x132145=_0x5b3cd2?0x0:_0x123438[_0xcc21('0x1d')];var _0x5a727c=_0x5b3cd2?_0x160e8d[_0xcc21('0x1c')]:_0x123438[_0xcc21('0x1d')]+_0x123438[_0xcc21('0x1e')];var _0x309350;if(_0x5a727c>=_0x207b02){_0x5a727c=_0x207b02;_0x309350=0xc8;}else{_0x309350=0xce;}_0x6e9b5a['status'](_0x309350);return _0x6e9b5a[_0xcc21('0x1f')](_0xcc21('0x20'),_0x132145+'-'+_0x5a727c+'/'+_0x207b02)[_0xcc21('0x1a')](_0x160e8d);}return null;};}function patchUpdates(_0x36cf4e){return function(_0x21e12c){try{jsonpatch['apply'](_0x21e12c,_0x36cf4e,!![]);}catch(_0x668f39){return BPromise[_0xcc21('0x21')](_0x668f39);}return _0x21e12c['save']();};}function saveUpdates(_0x5d8ce3,_0x10f49b){return function(_0x597ecf){if(_0x597ecf){return _0x597ecf[_0xcc21('0x22')](_0x5d8ce3)[_0xcc21('0x23')](function(_0x38ec30){return _0x38ec30;});}return null;};}function removeEntity(_0x44e857,_0x438d6c){return function(_0x266c92){if(_0x266c92){return _0x266c92['destroy']()[_0xcc21('0x23')](function(){_0x44e857['status'](0xcc)[_0xcc21('0x18')]();});}};}function handleEntityNotFound(_0x3a5c4a,_0x3cc9ab){return function(_0x2dcd5e){if(!_0x2dcd5e){_0x3a5c4a['sendStatus'](0x194);}return _0x2dcd5e;};}function handleError(_0xedaa8a,_0x522348){_0x522348=_0x522348||0x1f4;return function(_0x6280ac){logger[_0xcc21('0x24')](_0x6280ac[_0xcc21('0x25')]);if(_0x6280ac[_0xcc21('0x26')]){delete _0x6280ac[_0xcc21('0x26')];}_0xedaa8a[_0xcc21('0x19')](_0x522348)[_0xcc21('0x27')](_0x6280ac);};}exports[_0xcc21('0x28')]=function(_0x1a8fef,_0x4274f1){var _0x5b85b3={},_0x304658={},_0x55caf0={'count':0x0,'rows':[]};var _0x10b19f=_[_0xcc21('0x29')](db[_0xcc21('0x2a')]['rawAttributes'],function(_0x3c6a7e){return{'name':_0x3c6a7e['fieldName'],'type':_0x3c6a7e[_0xcc21('0x2b')]['key']};});_0x304658['model']=_['map'](_0x10b19f,'name');_0x304658[_0xcc21('0x2c')]=_['keys'](_0x1a8fef[_0xcc21('0x2c')]);_0x304658['filters']=_[_0xcc21('0x2d')](_0x304658[_0xcc21('0x2e')],_0x304658[_0xcc21('0x2c')]);_0x5b85b3['attributes']=_[_0xcc21('0x2d')](_0x304658[_0xcc21('0x2e')],qs[_0xcc21('0x2f')](_0x1a8fef[_0xcc21('0x2c')]['fields']));_0x5b85b3['attributes']=_0x5b85b3[_0xcc21('0x30')]['length']?_0x5b85b3[_0xcc21('0x30')]:_0x304658[_0xcc21('0x2e')];if(!_0x1a8fef[_0xcc21('0x2c')]['hasOwnProperty'](_0xcc21('0x31'))){_0x5b85b3['limit']=qs['limit'](_0x1a8fef[_0xcc21('0x2c')][_0xcc21('0x1e')]);_0x5b85b3['offset']=qs[_0xcc21('0x1d')](_0x1a8fef[_0xcc21('0x2c')][_0xcc21('0x1d')]);}_0x5b85b3[_0xcc21('0x32')]=qs[_0xcc21('0x33')](_0x1a8fef[_0xcc21('0x2c')]['sort']);_0x5b85b3[_0xcc21('0x34')]=qs[_0xcc21('0x35')](_[_0xcc21('0x36')](_0x1a8fef[_0xcc21('0x2c')],_0x304658[_0xcc21('0x35')]),_0x10b19f);if(_0x1a8fef['query'][_0xcc21('0x37')]){_0x5b85b3[_0xcc21('0x34')]=_[_0xcc21('0x38')](_0x5b85b3['where'],{'$or':_[_0xcc21('0x29')](_0x10b19f,function(_0x46748e){if(_0x46748e[_0xcc21('0x2b')]!==_0xcc21('0x39')){var _0x4aec97={};_0x4aec97[_0x46748e['name']]={'$like':'%'+_0x1a8fef[_0xcc21('0x2c')][_0xcc21('0x37')]+'%'};return _0x4aec97;}})});}_0x5b85b3=_['merge']({},_0x5b85b3,_0x1a8fef[_0xcc21('0x3a')]);var _0x3a58af={'where':_0x5b85b3[_0xcc21('0x34')]};return db[_0xcc21('0x2a')][_0xcc21('0x1c')](_0x3a58af)[_0xcc21('0x23')](function(_0xd01693){_0x55caf0[_0xcc21('0x1c')]=_0xd01693;if(_0x1a8fef['query'][_0xcc21('0x3b')]){_0x5b85b3[_0xcc21('0x3c')]=[{'all':!![]}];}return db[_0xcc21('0x2a')]['findAll'](_0x5b85b3);})['then'](function(_0x4ab60e){_0x55caf0[_0xcc21('0x3d')]=_0x4ab60e;return _0x55caf0;})[_0xcc21('0x23')](respondWithFilteredResult(_0x4274f1,_0x5b85b3))[_0xcc21('0x3e')](handleError(_0x4274f1,null));};exports[_0xcc21('0x3f')]=function(_0x3799fb,_0x5db3dc){var _0x2ea49b={'raw':!![],'where':{'id':_0x3799fb[_0xcc21('0x40')]['id']}},_0x2a733a={};_0x2a733a[_0xcc21('0x2e')]=_[_0xcc21('0x41')](db[_0xcc21('0x2a')][_0xcc21('0x42')]);_0x2a733a[_0xcc21('0x2c')]=_[_0xcc21('0x41')](_0x3799fb[_0xcc21('0x2c')]);_0x2a733a[_0xcc21('0x35')]=_[_0xcc21('0x2d')](_0x2a733a['model'],_0x2a733a['query']);_0x2ea49b['attributes']=_[_0xcc21('0x2d')](_0x2a733a[_0xcc21('0x2e')],qs[_0xcc21('0x2f')](_0x3799fb['query']['fields']));_0x2ea49b['attributes']=_0x2ea49b[_0xcc21('0x30')][_0xcc21('0x43')]?_0x2ea49b[_0xcc21('0x30')]:_0x2a733a[_0xcc21('0x2e')];if(_0x3799fb[_0xcc21('0x2c')][_0xcc21('0x3b')]){_0x2ea49b[_0xcc21('0x3c')]=[{'all':!![]}];}_0x2ea49b=_['merge']({},_0x2ea49b,_0x3799fb['options']);return db[_0xcc21('0x2a')][_0xcc21('0x44')](_0x2ea49b)[_0xcc21('0x23')](handleEntityNotFound(_0x5db3dc,null))['then'](respondWithResult(_0x5db3dc,null))[_0xcc21('0x3e')](handleError(_0x5db3dc,null));};exports[_0xcc21('0x45')]=function(_0x2dea80,_0x1ecacd){return db['DeskField'][_0xcc21('0x45')](_0x2dea80[_0xcc21('0x46')],{})[_0xcc21('0x23')](respondWithResult(_0x1ecacd,0xc9))[_0xcc21('0x3e')](handleError(_0x1ecacd,null));};exports[_0xcc21('0x22')]=function(_0x8e3e18,_0x241506){if(_0x8e3e18[_0xcc21('0x46')]['id']){delete _0x8e3e18['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x8e3e18['params']['id']}})['then'](handleEntityNotFound(_0x241506,null))[_0xcc21('0x23')](saveUpdates(_0x8e3e18[_0xcc21('0x46')],null))['then'](respondWithResult(_0x241506,null))[_0xcc21('0x3e')](handleError(_0x241506,null));};exports[_0xcc21('0x47')]=function(_0x2cfee1,_0x7e0db3){return db[_0xcc21('0x2a')][_0xcc21('0x44')]({'where':{'id':_0x2cfee1[_0xcc21('0x40')]['id']}})['then'](handleEntityNotFound(_0x7e0db3,null))[_0xcc21('0x23')](removeEntity(_0x7e0db3,null))['catch'](handleError(_0x7e0db3,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d01d729..282c28c 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 _0x63e9=['DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports','define'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x63e9,0x13c));var _0x963e=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x63e9[_0x1ad926];return _0x1b81dc;};'use strict';var _=require(_0x963e('0x0'));var util=require(_0x963e('0x1'));var logger=require(_0x963e('0x2'))(_0x963e('0x3'));var moment=require('moment');var BPromise=require(_0x963e('0x4'));var rp=require(_0x963e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x963e('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x963e('0x7')]=function(_0x58ede6,_0x3cbd26){return _0x58ede6[_0x963e('0x8')](_0x963e('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x963e('0xa'),'fields':[_0x963e('0xb'),_0x963e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf48a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskField','idField','FieldId','lodash','util'];(function(_0x35347f,_0x480454){var _0x2bb2ad=function(_0x4e5a9a){while(--_0x4e5a9a){_0x35347f['push'](_0x35347f['shift']());}};_0x2bb2ad(++_0x480454);}(_0xf48a,0x15c));var _0xaf48=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xf48a[_0x2a0738];return _0x159679;};'use strict';var _=require(_0xaf48('0x0'));var util=require(_0xaf48('0x1'));var logger=require('../../config/logger')(_0xaf48('0x2'));var moment=require(_0xaf48('0x3'));var BPromise=require(_0xaf48('0x4'));var rp=require(_0xaf48('0x5'));var fs=require('fs');var path=require(_0xaf48('0x6'));var rimraf=require(_0xaf48('0x7'));var config=require(_0xaf48('0x8'));var attributes=require('./intDeskField.attributes');module[_0xaf48('0x9')]=function(_0x1ad323,_0x1b81dd){return _0x1ad323[_0xaf48('0xa')](_0xaf48('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xaf48('0xc'),_0xaf48('0xd')],'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 915b0fc..51fb40f 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 _0x90f9=['error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x18a313,_0x54020e){var _0x44ac80=function(_0xf53027){while(--_0xf53027){_0x18a313['push'](_0x18a313['shift']());}};_0x44ac80(++_0x54020e);}(_0x90f9,0xe1));var _0x990f=function(_0x18c007,_0x4e5d35){_0x18c007=_0x18c007-0x0;var _0x4e1bce=_0x90f9[_0x18c007];return _0x4e1bce;};'use strict';var _=require(_0x990f('0x0'));var util=require(_0x990f('0x1'));var moment=require(_0x990f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x990f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x990f('0x4'))('rpc');var config=require(_0x990f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x990f('0x6')][_0x990f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8cfabd,_0x4eea89,_0x1f7a61){return new BPromise(function(_0x14d608,_0x46a25f){return client[_0x990f('0x8')](_0x8cfabd,_0x1f7a61)[_0x990f('0x9')](function(_0x5d7b59){logger[_0x990f('0xa')](_0x990f('0xb'),_0x4eea89,_0x990f('0xc'));logger['debug'](_0x990f('0xd'),_0x4eea89,_0x990f('0xc'),JSON[_0x990f('0xe')](_0x5d7b59));if(_0x5d7b59[_0x990f('0xf')]){if(_0x5d7b59['error'][_0x990f('0x10')]===0x1f4){logger[_0x990f('0xf')]('DeskField,\x20%s,\x20%s',_0x4eea89,_0x5d7b59[_0x990f('0xf')][_0x990f('0x11')]);return _0x46a25f(_0x5d7b59[_0x990f('0xf')][_0x990f('0x11')]);}logger['error'](_0x990f('0xb'),_0x4eea89,_0x5d7b59[_0x990f('0xf')][_0x990f('0x11')]);return _0x14d608(_0x5d7b59[_0x990f('0xf')][_0x990f('0x11')]);}else{logger[_0x990f('0xa')]('DeskField,\x20%s,\x20%s',_0x4eea89,_0x990f('0xc'));_0x14d608(_0x5d7b59[_0x990f('0x12')][_0x990f('0x11')]);}})[_0x990f('0x13')](function(_0x27d91d){logger[_0x990f('0xf')]('DeskField,\x20%s,\x20%s',_0x4eea89,_0x27d91d);_0x46a25f(_0x27d91d);});});} \ No newline at end of file +var _0x9279=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch'];(function(_0x55e645,_0x2e8017){var _0x34c1c3=function(_0x54a995){while(--_0x54a995){_0x55e645['push'](_0x55e645['shift']());}};_0x34c1c3(++_0x2e8017);}(_0x9279,0xcf));var _0x9927=function(_0x209302,_0x5826ac){_0x209302=_0x209302-0x0;var _0x1df8e9=_0x9279[_0x209302];return _0x1df8e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9927('0x0'));var BPromise=require(_0x9927('0x1'));var rs=require(_0x9927('0x2'));var fs=require('fs');var Redis=require(_0x9927('0x3'));var db=require(_0x9927('0x4'))['db'];var utils=require(_0x9927('0x5'));var logger=require(_0x9927('0x6'))(_0x9927('0x7'));var config=require(_0x9927('0x8'));var jayson=require(_0x9927('0x9'));var client=jayson['client'][_0x9927('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5022ad,_0x50ce25,_0x1e3bb6){return new BPromise(function(_0xae7cdf,_0xb56913){return client[_0x9927('0xb')](_0x5022ad,_0x1e3bb6)[_0x9927('0xc')](function(_0x1ba31f){logger[_0x9927('0xd')]('DeskField,\x20%s,\x20%s',_0x50ce25,_0x9927('0xe'));logger['debug'](_0x9927('0xf'),_0x50ce25,_0x9927('0xe'),JSON[_0x9927('0x10')](_0x1ba31f));if(_0x1ba31f[_0x9927('0x11')]){if(_0x1ba31f['error'][_0x9927('0x12')]===0x1f4){logger['error'](_0x9927('0x13'),_0x50ce25,_0x1ba31f[_0x9927('0x11')][_0x9927('0x14')]);return _0xb56913(_0x1ba31f['error'][_0x9927('0x14')]);}logger[_0x9927('0x11')](_0x9927('0x13'),_0x50ce25,_0x1ba31f[_0x9927('0x11')]['message']);return _0xae7cdf(_0x1ba31f[_0x9927('0x11')][_0x9927('0x14')]);}else{logger[_0x9927('0xd')](_0x9927('0x13'),_0x50ce25,'request\x20sent');_0xae7cdf(_0x1ba31f[_0x9927('0x15')][_0x9927('0x14')]);}})[_0x9927('0x16')](function(_0xcb135b){logger[_0x9927('0x11')](_0x9927('0x13'),_0x50ce25,_0xcb135b);_0xb56913(_0xcb135b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b7c9384..237174e 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 _0x38b3=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x38b3,0x8b));var _0x338b=function(_0x3127fc,_0x5a5e8a){_0x3127fc=_0x3127fc-0x0;var _0xe7c92f=_0x38b3[_0x3127fc];return _0xe7c92f;};'use strict';var multer=require(_0x338b('0x0'));var util=require(_0x338b('0x1'));var path=require(_0x338b('0x2'));var timeout=require(_0x338b('0x3'));var express=require('express');var router=express[_0x338b('0x4')]();var fs_extra=require(_0x338b('0x5'));var auth=require(_0x338b('0x6'));var interaction=require(_0x338b('0x7'));var config=require(_0x338b('0x8'));var controller=require(_0x338b('0x9'));router[_0x338b('0xa')]('/',auth[_0x338b('0xb')](),controller['index']);router[_0x338b('0xa')](_0x338b('0xc'),auth[_0x338b('0xb')](),controller[_0x338b('0xd')]);router[_0x338b('0xa')](_0x338b('0xe'),auth[_0x338b('0xb')](),controller[_0x338b('0xf')]);router['get'](_0x338b('0x10'),auth[_0x338b('0xb')](),controller[_0x338b('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x338b('0x12')]);router[_0x338b('0x13')]('/:id/configurations',auth[_0x338b('0xb')](),controller[_0x338b('0x14')]);router['put'](_0x338b('0xc'),auth[_0x338b('0xb')](),controller[_0x338b('0x15')]);router[_0x338b('0x16')]('/:id',auth[_0x338b('0xb')](),controller[_0x338b('0x17')]);module[_0x338b('0x18')]=router; \ No newline at end of file +var _0x14ee=['show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id'];(function(_0x1461aa,_0x22ea83){var _0x305384=function(_0x3e5af6){while(--_0x3e5af6){_0x1461aa['push'](_0x1461aa['shift']());}};_0x305384(++_0x22ea83);}(_0x14ee,0xf1));var _0xe14e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x14ee[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xe14e('0x0'));var util=require('util');var path=require(_0xe14e('0x1'));var timeout=require('connect-timeout');var express=require(_0xe14e('0x2'));var router=express[_0xe14e('0x3')]();var fs_extra=require(_0xe14e('0x4'));var auth=require(_0xe14e('0x5'));var interaction=require(_0xe14e('0x6'));var config=require(_0xe14e('0x7'));var controller=require(_0xe14e('0x8'));router[_0xe14e('0x9')]('/',auth[_0xe14e('0xa')](),controller['index']);router[_0xe14e('0x9')](_0xe14e('0xb'),auth[_0xe14e('0xa')](),controller[_0xe14e('0xc')]);router[_0xe14e('0x9')](_0xe14e('0xd'),auth[_0xe14e('0xa')](),controller['getConfigurations']);router[_0xe14e('0x9')](_0xe14e('0xe'),auth[_0xe14e('0xa')](),controller[_0xe14e('0xf')]);router['post']('/',auth[_0xe14e('0xa')](),controller['create']);router[_0xe14e('0x10')](_0xe14e('0xd'),auth[_0xe14e('0xa')](),controller[_0xe14e('0x11')]);router[_0xe14e('0x12')](_0xe14e('0xb'),auth[_0xe14e('0xa')](),controller[_0xe14e('0x13')]);router[_0xe14e('0x14')]('/:id',auth[_0xe14e('0xa')](),controller[_0xe14e('0x15')]);module[_0xe14e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b82c54f..325e401 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 _0x4351=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2c3ed5,_0x2aa2a6){var _0x347cde=function(_0x412195){while(--_0x412195){_0x2c3ed5['push'](_0x2c3ed5['shift']());}};_0x347cde(++_0x2aa2a6);}(_0x4351,0x1b5));var _0x1435=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x4351[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x1435('0x0'));module[_0x1435('0x1')]={'name':{'type':Sequelize[_0x1435('0x2')]},'username':{'type':Sequelize[_0x1435('0x2')]},'password':{'type':Sequelize[_0x1435('0x2')]},'remoteUri':{'type':Sequelize[_0x1435('0x2')]},'tenantId':{'type':Sequelize[_0x1435('0x2')]},'clientId':{'type':Sequelize[_0x1435('0x2')]},'clientSecret':{'type':Sequelize[_0x1435('0x2')]},'serverUrl':{'type':Sequelize[_0x1435('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1435('0x2')]},'modernAuthentication':{'type':Sequelize[_0x1435('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x126e=['exports','STRING','BOOLEAN'];(function(_0x383329,_0x236c9d){var _0x2285fc=function(_0x4a0613){while(--_0x4a0613){_0x383329['push'](_0x383329['shift']());}};_0x2285fc(++_0x236c9d);}(_0x126e,0x108));var _0xe126=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x126e[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require('sequelize');module[_0xe126('0x0')]={'name':{'type':Sequelize[_0xe126('0x1')]},'username':{'type':Sequelize[_0xe126('0x1')]},'password':{'type':Sequelize[_0xe126('0x1')]},'remoteUri':{'type':Sequelize[_0xe126('0x1')]},'tenantId':{'type':Sequelize[_0xe126('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe126('0x1')]},'serverUrl':{'type':Sequelize[_0xe126('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe126('0x1')]},'modernAuthentication':{'type':Sequelize[_0xe126('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4069284..23100b8 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 _0x1ed5=['responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','isNil','StringAttributeMetadata','DoubleAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','error','stack','Wrong\x20credentials',')/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)','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','set','Content-Range','update','then','destroy','end','sendStatus','name','send','index','map','Dynamics365Account','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','params','find','catch','create','body','findOne','Dynamics365Configuration','rawAttributes','fields','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','slice','substring','format','getFields','ticketType','incident','PhoneCall','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x1ed5,0x1ae));var _0x51ed=function(_0x4b87ef,_0x1aa1ab){_0x4b87ef=_0x4b87ef-0x0;var _0x287e5e=_0x1ed5[_0x4b87ef];return _0x287e5e;};'use strict';var rp=require(_0x51ed('0x0'));var util=require(_0x51ed('0x1'));var _=require(_0x51ed('0x2'));var qs=require(_0x51ed('0x3'));var logger=require(_0x51ed('0x4'))(_0x51ed('0x5'));var db=require(_0x51ed('0x6'))['db'];var integrations=require(_0x51ed('0x7'));function respondWithResult(_0x46779d,_0x329eb6){_0x329eb6=_0x329eb6||0xc8;return function(_0x1c24a9){if(_0x1c24a9){return _0x46779d[_0x51ed('0x8')](_0x329eb6)[_0x51ed('0x9')](_0x1c24a9);}};}function respondWithFilteredResult(_0x19722f,_0x21dbae){return function(_0x587cb0){if(_0x587cb0){var _0x59824f=typeof _0x21dbae[_0x51ed('0xa')]==='undefined'&&typeof _0x21dbae[_0x51ed('0xb')]===_0x51ed('0xc');var _0x522881=_0x587cb0['count'];var _0x36ce61=_0x59824f?0x0:_0x21dbae[_0x51ed('0xa')];var _0x3c88ef=_0x59824f?_0x587cb0['count']:_0x21dbae['offset']+_0x21dbae['limit'];var _0xa49428;if(_0x3c88ef>=_0x522881){_0x3c88ef=_0x522881;_0xa49428=0xc8;}else{_0xa49428=0xce;}_0x19722f[_0x51ed('0x8')](_0xa49428);return _0x19722f[_0x51ed('0xd')](_0x51ed('0xe'),_0x36ce61+'-'+_0x3c88ef+'/'+_0x522881)['json'](_0x587cb0);}return null;};}function saveUpdates(_0x5b1cd1){return function(_0x30beea){if(_0x30beea){return _0x30beea[_0x51ed('0xf')](_0x5b1cd1)[_0x51ed('0x10')](function(_0x325663){return _0x325663;});}return null;};}function removeEntity(_0x5958bc){return function(_0x2acd80){if(_0x2acd80){return _0x2acd80[_0x51ed('0x11')]()[_0x51ed('0x10')](function(){_0x5958bc[_0x51ed('0x8')](0xcc)[_0x51ed('0x12')]();});}};}function handleEntityNotFound(_0xc96ce0){return function(_0x5db8fc){if(!_0x5db8fc){_0xc96ce0[_0x51ed('0x13')](0x194);}return _0x5db8fc;};}function handleError(_0x220740,_0x1dff89){_0x1dff89=_0x1dff89||0x1f4;return function(_0xaa7ec){logger['error'](_0xaa7ec['stack']);if(_0xaa7ec['name']){delete _0xaa7ec[_0x51ed('0x14')];}_0x220740[_0x51ed('0x8')](_0x1dff89)[_0x51ed('0x15')](_0xaa7ec);};}exports[_0x51ed('0x16')]=function(_0xc516a2,_0x3c40eb){var _0x393f81={},_0x184f90={},_0x5935bb={'count':0x0,'rows':[]};var _0x4063ce=_[_0x51ed('0x17')](db[_0x51ed('0x18')]['rawAttributes'],function(_0x51f83f){return{'name':_0x51f83f['fieldName'],'type':_0x51f83f['type']['key']};});_0x184f90[_0x51ed('0x19')]=_[_0x51ed('0x17')](_0x4063ce,'name');_0x184f90[_0x51ed('0x1a')]=_[_0x51ed('0x1b')](_0xc516a2[_0x51ed('0x1a')]);_0x184f90[_0x51ed('0x1c')]=_[_0x51ed('0x1d')](_0x184f90[_0x51ed('0x19')],_0x184f90[_0x51ed('0x1a')]);_0x393f81[_0x51ed('0x1e')]=_['intersection'](_0x184f90[_0x51ed('0x19')],qs['fields'](_0xc516a2['query']['fields']));_0x393f81[_0x51ed('0x1e')]=_0x393f81[_0x51ed('0x1e')][_0x51ed('0x1f')]?_0x393f81['attributes']:_0x184f90[_0x51ed('0x19')];if(!_0xc516a2[_0x51ed('0x1a')][_0x51ed('0x20')]('nolimit')){_0x393f81['limit']=qs[_0x51ed('0xb')](_0xc516a2[_0x51ed('0x1a')][_0x51ed('0xb')]);_0x393f81[_0x51ed('0xa')]=qs[_0x51ed('0xa')](_0xc516a2['query'][_0x51ed('0xa')]);}_0x393f81[_0x51ed('0x21')]=qs[_0x51ed('0x22')](_0xc516a2[_0x51ed('0x1a')]['sort']);_0x393f81['where']=qs[_0x51ed('0x1c')](_[_0x51ed('0x23')](_0xc516a2['query'],_0x184f90[_0x51ed('0x1c')]),_0x4063ce);if(_0xc516a2[_0x51ed('0x1a')][_0x51ed('0x24')]){_0x393f81[_0x51ed('0x25')]=_[_0x51ed('0x26')](_0x393f81[_0x51ed('0x25')],{'$or':_[_0x51ed('0x17')](_0x4063ce,function(_0x1d97a6){if(_0x1d97a6[_0x51ed('0x27')]!==_0x51ed('0x28')){var _0x4cd8d2={};_0x4cd8d2[_0x1d97a6[_0x51ed('0x14')]]={'$like':'%'+_0xc516a2[_0x51ed('0x1a')][_0x51ed('0x24')]+'%'};return _0x4cd8d2;}})});}_0x393f81=_['merge']({},_0x393f81,_0xc516a2[_0x51ed('0x29')]);var _0x84c95a={'where':_0x393f81[_0x51ed('0x25')]};return db['Dynamics365Account']['count'](_0x84c95a)['then'](function(_0x389d51){_0x5935bb['count']=_0x389d51;if(_0xc516a2['query'][_0x51ed('0x2a')]){_0x393f81[_0x51ed('0x2b')]=[{'all':!![]}];}return db[_0x51ed('0x18')]['findAll'](_0x393f81);})[_0x51ed('0x10')](function(_0x14183d){_0x5935bb['rows']=_0x14183d;return _0x5935bb;})[_0x51ed('0x10')](respondWithFilteredResult(_0x3c40eb,_0x393f81))['catch'](handleError(_0x3c40eb,null));};exports['show']=function(_0x2c1e36,_0x32ec4b){var _0x1966cb={'raw':![],'where':{'id':_0x2c1e36[_0x51ed('0x2c')]['id']}},_0x312bb3={};_0x312bb3[_0x51ed('0x19')]=_[_0x51ed('0x1b')](db['Dynamics365Account']['rawAttributes']);_0x312bb3[_0x51ed('0x1a')]=_['keys'](_0x2c1e36[_0x51ed('0x1a')]);_0x312bb3['filters']=_['intersection'](_0x312bb3[_0x51ed('0x19')],_0x312bb3['query']);_0x1966cb[_0x51ed('0x1e')]=_[_0x51ed('0x1d')](_0x312bb3['model'],qs['fields'](_0x2c1e36[_0x51ed('0x1a')]['fields']));_0x1966cb['attributes']=_0x1966cb[_0x51ed('0x1e')][_0x51ed('0x1f')]?_0x1966cb[_0x51ed('0x1e')]:_0x312bb3[_0x51ed('0x19')];if(_0x2c1e36[_0x51ed('0x1a')][_0x51ed('0x2a')]){_0x1966cb[_0x51ed('0x2b')]=[{'all':!![]}];}_0x1966cb=_[_0x51ed('0x26')]({},_0x1966cb,_0x2c1e36['options']);return db[_0x51ed('0x18')][_0x51ed('0x2d')](_0x1966cb)[_0x51ed('0x10')](handleEntityNotFound(_0x32ec4b,null))[_0x51ed('0x10')](respondWithResult(_0x32ec4b,null))[_0x51ed('0x2e')](handleError(_0x32ec4b,null));};exports[_0x51ed('0x2f')]=function(_0x51a302,_0x55918b){return db['Dynamics365Account']['create'](_0x51a302[_0x51ed('0x30')],{})[_0x51ed('0x10')](respondWithResult(_0x55918b,0xc9))[_0x51ed('0x2e')](handleError(_0x55918b,null));};exports[_0x51ed('0xf')]=function(_0x325c6a,_0x59b402){if(_0x325c6a[_0x51ed('0x30')]['id']){delete _0x325c6a[_0x51ed('0x30')]['id'];}return db[_0x51ed('0x18')][_0x51ed('0x2d')]({'where':{'id':_0x325c6a['params']['id']}})['then'](handleEntityNotFound(_0x59b402,null))[_0x51ed('0x10')](saveUpdates(_0x325c6a[_0x51ed('0x30')],null))['then'](respondWithResult(_0x59b402,null))[_0x51ed('0x2e')](handleError(_0x59b402,null));};exports[_0x51ed('0x11')]=function(_0x2d31f2,_0x2987d8){return db[_0x51ed('0x18')][_0x51ed('0x2d')]({'where':{'id':_0x2d31f2['params']['id']}})[_0x51ed('0x10')](handleEntityNotFound(_0x2987d8,null))[_0x51ed('0x10')](removeEntity(_0x2987d8,null))[_0x51ed('0x2e')](handleError(_0x2987d8,null));};exports['getConfigurations']=function(_0x378652,_0x55a4c7){var _0x2a86b9={};var _0x1159b4={};var _0x1646cb;var _0x26a372;return db[_0x51ed('0x18')][_0x51ed('0x31')]({'where':{'id':_0x378652['params']['id']}})[_0x51ed('0x10')](handleEntityNotFound(_0x55a4c7,null))[_0x51ed('0x10')](function(_0x58f81f){if(_0x58f81f){_0x1646cb=_0x58f81f;_0x1159b4[_0x51ed('0x19')]=_[_0x51ed('0x1b')](db[_0x51ed('0x32')][_0x51ed('0x33')]);_0x1159b4[_0x51ed('0x1a')]=_[_0x51ed('0x1b')](_0x378652[_0x51ed('0x1a')]);_0x1159b4[_0x51ed('0x1c')]=_[_0x51ed('0x1d')](_0x1159b4[_0x51ed('0x19')],_0x1159b4[_0x51ed('0x1a')]);_0x2a86b9[_0x51ed('0x1e')]=_['intersection'](_0x1159b4[_0x51ed('0x19')],qs[_0x51ed('0x34')](_0x378652[_0x51ed('0x1a')][_0x51ed('0x34')]));_0x2a86b9[_0x51ed('0x1e')]=_0x2a86b9[_0x51ed('0x1e')][_0x51ed('0x1f')]?_0x2a86b9[_0x51ed('0x1e')]:_0x1159b4[_0x51ed('0x19')];_0x2a86b9[_0x51ed('0x21')]=qs[_0x51ed('0x22')](_0x378652[_0x51ed('0x1a')][_0x51ed('0x22')]);_0x2a86b9['where']=qs['filters'](_[_0x51ed('0x23')](_0x378652['query'],_0x1159b4['filters']));if(_0x378652[_0x51ed('0x1a')]['filter']){_0x2a86b9[_0x51ed('0x25')]=_[_0x51ed('0x26')](_0x2a86b9['where'],{'$or':_[_0x51ed('0x17')](_0x2a86b9[_0x51ed('0x1e')],function(_0x3e5713){var _0x542784={};_0x542784[_0x3e5713]={'$like':'%'+_0x378652['query'][_0x51ed('0x24')]+'%'};return _0x542784;})});}_0x2a86b9=_[_0x51ed('0x26')]({},_0x2a86b9,_0x378652[_0x51ed('0x29')]);return _0x1646cb[_0x51ed('0x35')](_0x2a86b9);}})[_0x51ed('0x10')](function(_0x34d83b){if(_0x34d83b){_0x26a372=_0x34d83b[_0x51ed('0x1f')];if(!_0x378652['query']['hasOwnProperty']('nolimit')){_0x2a86b9['limit']=qs[_0x51ed('0xb')](_0x378652[_0x51ed('0x1a')]['limit']);_0x2a86b9['offset']=qs[_0x51ed('0xa')](_0x378652[_0x51ed('0x1a')][_0x51ed('0xa')]);}return _0x1646cb[_0x51ed('0x35')](_0x2a86b9);}})[_0x51ed('0x10')](function(_0x530a65){if(_0x530a65){return _0x530a65?{'count':_0x26a372,'rows':_0x530a65}:null;}})[_0x51ed('0x10')](respondWithResult(_0x55a4c7,null))[_0x51ed('0x2e')](handleError(_0x55a4c7,null));};exports[_0x51ed('0x36')]=function(_0x52dc05,_0x11edcf){if(_0x52dc05['body']['id']){delete _0x52dc05['body']['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x52dc05['params']['id']}})[_0x51ed('0x10')](handleEntityNotFound(_0x11edcf,null))[_0x51ed('0x10')](function(_0x2b31a9){if(_0x2b31a9){_0x52dc05[_0x51ed('0x30')][_0x51ed('0x37')]=_0x2b31a9['id'];_0x52dc05['body'][_0x51ed('0x38')]=integrations[_0x51ed('0x39')](_0x52dc05['body'][_0x51ed('0x3a')],_0x52dc05[_0x51ed('0x30')][_0x51ed('0x27')]);_0x52dc05[_0x51ed('0x30')][_0x51ed('0x3b')]=integrations[_0x51ed('0x3c')](_0x52dc05[_0x51ed('0x30')][_0x51ed('0x3a')],_0x52dc05['body'][_0x51ed('0x27')]);return db['Dynamics365Configuration'][_0x51ed('0x2f')](_0x52dc05[_0x51ed('0x30')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x51ed('0x3b')}]});}return null;})['then'](respondWithResult(_0x11edcf,null))[_0x51ed('0x2e')](handleError(_0x11edcf,null));};function sanitizeRemoteUri(_0x319aa3){var _0x482810=_0x319aa3[_0x51ed('0x3d')](-0x1);if(_0x482810==='/')return _0x319aa3[_0x51ed('0x3e')](0x0,_0x319aa3['lastIndexOf'](_0x482810));return _0x319aa3;}function getWebApiUrl(_0x3ca9e6){return util[_0x51ed('0x3f')]('%s/api/data/v9.0/',_0x3ca9e6);}exports[_0x51ed('0x40')]=function(_0x192ecd,_0x3b85be){var _0x259430=_0x192ecd[_0x51ed('0x1a')][_0x51ed('0x41')];var _0x59c107=_0x259430===_0x51ed('0x42')?'Incident':_0x51ed('0x43');var _0x567877='';var _0x5174b5='';var _0x5c00b3='';var _0x5d9603='';var _0x33eb3f='';var _0x4da472='';var _0x4104b1='';var _0x363aef='';var _0x2437aa=['title',_0x51ed('0x44'),'customerid',_0x51ed('0x45'),_0x51ed('0x46'),_0x51ed('0x47'),_0x51ed('0x48'),_0x51ed('0x49'),'directioncode','phonecall_activity_parties'];var _0x80abc0=[_0x51ed('0x4a'),_0x51ed('0x4b'),_0x51ed('0x4c'),'billedserviceunits',_0x51ed('0x4d'),_0x51ed('0x4e'),_0x51ed('0x4f'),_0x51ed('0x50'),_0x51ed('0x51'),'createdbyexternalpartyyominame','createdbyname',_0x51ed('0x52'),_0x51ed('0x53'),_0x51ed('0x54'),'createdonbehalfbyyominame',_0x51ed('0x55'),_0x51ed('0x56'),_0x51ed('0x57'),'emailaddress',_0x51ed('0x58'),'entityimage_timestamp','entityimage_url',_0x51ed('0x59'),_0x51ed('0x5a'),_0x51ed('0x5b'),'followupby',_0x51ed('0x5c'),'influencescore','kbarticleidname','lastonholdtime','masteridname',_0x51ed('0x5d'),_0x51ed('0x5e'),_0x51ed('0x5f'),_0x51ed('0x60'),_0x51ed('0x61'),_0x51ed('0x62'),_0x51ed('0x63'),_0x51ed('0x64'),'msdyn_iotalertname',_0x51ed('0x65'),_0x51ed('0x66'),_0x51ed('0x67'),_0x51ed('0x68'),_0x51ed('0x69'),_0x51ed('0x6a'),_0x51ed('0x6b'),_0x51ed('0x6c'),'primarycontactidyominame','prioritycodename',_0x51ed('0x6d'),_0x51ed('0x6e'),_0x51ed('0x6f'),_0x51ed('0x70'),_0x51ed('0x71'),_0x51ed('0x72'),_0x51ed('0x73'),_0x51ed('0x74'),_0x51ed('0x75'),'slaname','socialprofileidname',_0x51ed('0x76'),'statuscode',_0x51ed('0x77'),_0x51ed('0x78'),_0x51ed('0x79'),_0x51ed('0x7a'),'traversedpath',_0x51ed('0x7b'),_0x51ed('0x7c')];var _0x4c2fb4=_0x2437aa[_0x51ed('0x7d')](_0x80abc0);return db[_0x51ed('0x18')]['findOne']({'where':{'id':_0x192ecd[_0x51ed('0x2c')]['id']},'attributes':['id',_0x51ed('0x7e'),_0x51ed('0x7f'),_0x51ed('0x80'),_0x51ed('0x81'),'clientId',_0x51ed('0x82'),'modernAuthentication'],'include':[{'model':db[_0x51ed('0x83')],'as':_0x51ed('0x83'),'attributes':['id',_0x51ed('0x84'),_0x51ed('0x85')]}]})[_0x51ed('0x10')](handleEntityNotFound(_0x3b85be,null))['then'](function(_0xac9094){if(_0xac9094){if(_0xac9094[_0x51ed('0x86')]){_0xac9094[_0x51ed('0x87')]=_0xac9094[_0x51ed('0x83')][_0x51ed('0x84')];_0x363aef=sanitizeRemoteUri(_0xac9094[_0x51ed('0x83')][_0x51ed('0x85')]);_0x4104b1=getWebApiUrl(_0x363aef);return _0xac9094;}_0x363aef=sanitizeRemoteUri(_0xac9094['remoteUri']);_0x4104b1=getWebApiUrl(_0x363aef);var _0x50af53={'method':_0x51ed('0x88'),'uri':_0x51ed('0x89')+_0xac9094['tenantId']+_0x51ed('0x8a'),'form':{'client_id':_0xac9094[_0x51ed('0x8b')],'resource':_0x363aef,'username':_0xac9094[_0x51ed('0x7e')],'password':_0xac9094['password'],'grant_type':_0x51ed('0x7f'),'client_secret':_0xac9094[_0x51ed('0x82')]},'json':!![]};return rp(_0x50af53);}})[_0x51ed('0x10')](function(_0x183158){_0x4da472=_0x183158[_0x51ed('0x87')];var _0x58256d={'method':'GET','uri':encodeURI(_0x4104b1+_0x51ed('0x8c')+_0x59c107+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4da472,'If-None-Match':null,'OData-Version':_0x51ed('0x8d')},'json':!![]};return rp(_0x58256d);})[_0x51ed('0x10')](function(_0x1176bc){var _0x460397=_0x1176bc[_0x51ed('0x8e')][0x0];var _0x2b1776=_0x460397[_0x51ed('0x8f')];var _0x214e47={'method':_0x51ed('0x90'),'uri':_0x4104b1+_0x51ed('0x91')+_0x2b1776+_0x51ed('0x92'),'headers':{'Authorization':_0x51ed('0x93')+_0x4da472,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x214e47);})['then'](function(_0x2d4b1e){_0x567877=_0x2d4b1e;_0x5174b5=_0x567877['Attributes'];_0x5174b5=_[_0x51ed('0x94')](_0x5174b5,function(_0x13f8c9){return!_0x4c2fb4[_0x51ed('0x95')](_0x13f8c9[_0x51ed('0x96')]);});var _0x1ce38b=[];var _0x2cc542=[];_0x5174b5['forEach'](function(_0x3cb291){if(_0x3cb291['@odata.type']){var _0x155f9b=_0x3cb291['@odata.type']['substring'](_0x3cb291[_0x51ed('0x97')][_0x51ed('0x98')]('.')+0x1);if(_0x155f9b===_0x51ed('0x99')){_0x1ce38b[_0x51ed('0x9a')](getSelectList(_0x4104b1,_0x259430,_0x2cc542,_0x567877[_0x51ed('0x8f')],_0x3cb291[_0x51ed('0x8f')],_0x4da472));}}});return Promise[_0x51ed('0x9b')](_0x1ce38b);})[_0x51ed('0x10')](function(_0x58f047){_0x5c00b3=_0x58f047[0x0];var _0x1a52c0=[];var _0x1cddf0=[];_0x5174b5[_0x51ed('0x9c')](function(_0x318aab){if(!_[_0x51ed('0x9d')](_0x318aab[_0x51ed('0x97')])){var _0x46ca89=_0x318aab[_0x51ed('0x97')][_0x51ed('0x3e')](_0x318aab[_0x51ed('0x97')][_0x51ed('0x98')]('.')+0x1);if(_0x46ca89==='BooleanAttributeMetadata'){_0x1a52c0['push'](getBooleanList(_0x4104b1,_0x259430,_0x1cddf0,_0x567877[_0x51ed('0x8f')],_0x318aab[_0x51ed('0x8f')],_0x4da472));}}});return Promise['all'](_0x1a52c0);})[_0x51ed('0x10')](function(_0x4245ab){_0x5d9603=_0x4245ab[0x0];var _0x3e69cf=[];var _0x4a5f02=[];_0x5174b5[_0x51ed('0x9c')](function(_0x5ba043){if(_0x5ba043[_0x51ed('0x97')]){var _0x3c69bb=_0x5ba043[_0x51ed('0x97')][_0x51ed('0x3e')](_0x5ba043[_0x51ed('0x97')][_0x51ed('0x98')]('.')+0x1);if(_0x3c69bb===_0x51ed('0x9e')||_0x3c69bb===_0x51ed('0x9f')||_0x3c69bb==='BigIntAttributeMetadata'||_0x3c69bb==='IntegerAttributeMetadata'||_0x3c69bb==='MemoAttributeMetadata'||_0x3c69bb===_0x51ed('0xa0')||_0x3c69bb==='StatusAttributeMetadata'||_0x3c69bb===_0x51ed('0xa1')||_0x3c69bb===_0x51ed('0xa2')||_0x3c69bb==='DecimalAttributeMetadata'){_0x3e69cf['push'](getInputList(_0x4104b1,_0x259430,_0x3c69bb,_0x4a5f02,_0x567877[_0x51ed('0x8f')],_0x5ba043[_0x51ed('0x8f')],_0x4da472));}}});return Promise[_0x51ed('0x9b')](_0x3e69cf);})[_0x51ed('0x10')](function(_0x24aa42){_0x33eb3f=_0x24aa42[0x0];var _0x40ee5f=_0x5c00b3[_0x51ed('0x7d')](_0x5d9603)[_0x51ed('0x7d')](_0x33eb3f);var _0x416035={'count':_0x40ee5f[_0x51ed('0x1f')],'rows':_0x40ee5f};return _0x416035;})['then'](respondWithResult(_0x3b85be,null))[_0x51ed('0x2e')](function(_0x44b860){var _0xcdfd7d=_0x192ecd[_0x51ed('0x1a')][_0x51ed('0xa3')]?0x1f4:_0x44b860[_0x51ed('0xa4')]||0x1f4;logger[_0x51ed('0xa5')](_0x44b860[_0x51ed('0xa6')]);delete _0x44b860[_0x51ed('0x14')];if(_0xcdfd7d===0x191){_0xcdfd7d=0x190;}_0x3b85be[_0x51ed('0x8')](_0xcdfd7d)[_0x51ed('0x15')](_0x192ecd[_0x51ed('0x1a')]['test']?{'message':_0x51ed('0xa7'),'statusCode':_0x44b860[_0x51ed('0xa4')]}:_0x44b860);});};function getSelectList(_0xcbe2d3,_0x198141,_0x54c4ad,_0x47b24a,_0x241b51,_0x5e4dc0){var _0x372e04={'method':_0x51ed('0x90'),'uri':_0xcbe2d3+'EntityDefinitions('+_0x47b24a+')/Attributes('+_0x241b51+_0x51ed('0xa8')+_0x51ed('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0x5e4dc0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x372e04)[_0x51ed('0x10')](function(_0x501b1e){var _0x1a2626=[];var _0x18a77f=_0x501b1e[_0x51ed('0xaa')][_0x51ed('0xab')];_0x18a77f[_0x51ed('0x9c')](function(_0x2f9e92){_0x1a2626['push']({'name':_0x2f9e92[_0x51ed('0xac')][_0x51ed('0xad')][_0x51ed('0xac')],'value':String(_0x2f9e92[_0x51ed('0xae')])});});var _0x11b318={'id':_0x198141+'_'+_0x501b1e[_0x51ed('0x96')],'name':_0x501b1e['DisplayName'][_0x51ed('0xad')][_0x51ed('0xac')],'custom':![],'options':_0x1a2626};_0x54c4ad[_0x51ed('0x9a')](_0x11b318);return _0x54c4ad;});}function getBooleanList(_0x4301bb,_0x56a346,_0x4b9e43,_0x54ac6c,_0x2c97f7,_0x467381){var _0x41c788={'method':_0x51ed('0x90'),'uri':_0x4301bb+'EntityDefinitions('+_0x54ac6c+')/Attributes('+_0x2c97f7+_0x51ed('0xaf'),'headers':{'Authorization':_0x51ed('0x93')+_0x467381,'If-None-Match':null,'OData-Version':_0x51ed('0x8d')},'json':!![]};return rp(_0x41c788)[_0x51ed('0x10')](function(_0x277543){var _0x1cdff3=[];_0x1cdff3[_0x51ed('0x9a')]({'name':_0x277543['OptionSet']['TrueOption']['Label'][_0x51ed('0xad')][_0x51ed('0xac')],'value':_0x51ed('0xb0')},{'name':_0x277543[_0x51ed('0xaa')][_0x51ed('0xb1')][_0x51ed('0xac')]['UserLocalizedLabel'][_0x51ed('0xac')],'value':'false'});var _0x8e5889={'id':_0x56a346+'_'+_0x277543[_0x51ed('0x96')],'name':_0x277543[_0x51ed('0xb2')][_0x51ed('0xad')][_0x51ed('0xac')],'custom':![],'options':_0x1cdff3};_0x4b9e43[_0x51ed('0x9a')](_0x8e5889);return _0x4b9e43;});}function getInputList(_0x2cd14d,_0x3ca16f,_0x297073,_0x817dcd,_0x1b0a2b,_0x135f93,_0x5a654b){var _0x35d183={'method':_0x51ed('0x90'),'uri':_0x2cd14d+_0x51ed('0x91')+_0x1b0a2b+')/Attributes('+_0x135f93+_0x51ed('0xb3')+_0x297073+_0x51ed('0xb4'),'headers':{'Authorization':_0x51ed('0x93')+_0x5a654b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x35d183)[_0x51ed('0x10')](function(_0x1c6a85){var _0x24ec35={'id':_0x3ca16f+'_'+_0x1c6a85[_0x51ed('0x96')],'name':_0x1c6a85[_0x51ed('0xb2')][_0x51ed('0xad')]?_0x1c6a85[_0x51ed('0xb2')]['UserLocalizedLabel'][_0x51ed('0xac')]:_0x1c6a85['LogicalName'],'custom':![],'options':[]};_0x817dcd[_0x51ed('0x9a')](_0x24ec35);return _0x817dcd;});} \ No newline at end of file +var _0xf6ed=['modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','remoteUri','POST','/oauth2/token','username','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack','send','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','lodash','../../components/parsers/qs','../../config/logger','../../components/integrations/configuration','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','status','end','sendStatus','error','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x36fecb,_0x2f6485){_0x36fecb=_0x36fecb-0x0;var _0x6c9f91=_0xf6ed[_0x36fecb];return _0x6c9f91;};'use strict';var rp=require(_0xdf6e('0x0'));var util=require('util');var _=require(_0xdf6e('0x1'));var qs=require(_0xdf6e('0x2'));var logger=require(_0xdf6e('0x3'))('api');var db=require('../../mysqldb')['db'];var integrations=require(_0xdf6e('0x4'));function respondWithResult(_0x484a22,_0x5f5db0){_0x5f5db0=_0x5f5db0||0xc8;return function(_0x468b96){if(_0x468b96){return _0x484a22['status'](_0x5f5db0)[_0xdf6e('0x5')](_0x468b96);}};}function respondWithFilteredResult(_0x5eb5d1,_0x1efa53){return function(_0x3da81f){if(_0x3da81f){var _0x8bab31=typeof _0x1efa53[_0xdf6e('0x6')]==='undefined'&&typeof _0x1efa53[_0xdf6e('0x7')]===_0xdf6e('0x8');var _0x230c95=_0x3da81f[_0xdf6e('0x9')];var _0x3a8881=_0x8bab31?0x0:_0x1efa53['offset'];var _0x92cde3=_0x8bab31?_0x3da81f['count']:_0x1efa53[_0xdf6e('0x6')]+_0x1efa53['limit'];var _0x336554;if(_0x92cde3>=_0x230c95){_0x92cde3=_0x230c95;_0x336554=0xc8;}else{_0x336554=0xce;}_0x5eb5d1['status'](_0x336554);return _0x5eb5d1[_0xdf6e('0xa')](_0xdf6e('0xb'),_0x3a8881+'-'+_0x92cde3+'/'+_0x230c95)['json'](_0x3da81f);}return null;};}function saveUpdates(_0x12e817){return function(_0x18a504){if(_0x18a504){return _0x18a504[_0xdf6e('0xc')](_0x12e817)[_0xdf6e('0xd')](function(_0xf884ba){return _0xf884ba;});}return null;};}function removeEntity(_0x1aaa3b){return function(_0x500ea4){if(_0x500ea4){return _0x500ea4[_0xdf6e('0xe')]()['then'](function(){_0x1aaa3b[_0xdf6e('0xf')](0xcc)[_0xdf6e('0x10')]();});}};}function handleEntityNotFound(_0x45a3f1){return function(_0x458c86){if(!_0x458c86){_0x45a3f1[_0xdf6e('0x11')](0x194);}return _0x458c86;};}function handleError(_0xa41255,_0x3eb3d3){_0x3eb3d3=_0x3eb3d3||0x1f4;return function(_0x495aed){logger[_0xdf6e('0x12')](_0x495aed['stack']);if(_0x495aed[_0xdf6e('0x13')]){delete _0x495aed[_0xdf6e('0x13')];}_0xa41255['status'](_0x3eb3d3)['send'](_0x495aed);};}exports[_0xdf6e('0x14')]=function(_0x3c6a2e,_0xec1d4f){var _0x5b1827={},_0x2b5ec6={},_0xb5a770={'count':0x0,'rows':[]};var _0x15282f=_[_0xdf6e('0x15')](db[_0xdf6e('0x16')][_0xdf6e('0x17')],function(_0x530290){return{'name':_0x530290[_0xdf6e('0x18')],'type':_0x530290[_0xdf6e('0x19')][_0xdf6e('0x1a')]};});_0x2b5ec6['model']=_[_0xdf6e('0x15')](_0x15282f,'name');_0x2b5ec6[_0xdf6e('0x1b')]=_[_0xdf6e('0x1c')](_0x3c6a2e['query']);_0x2b5ec6[_0xdf6e('0x1d')]=_[_0xdf6e('0x1e')](_0x2b5ec6[_0xdf6e('0x1f')],_0x2b5ec6[_0xdf6e('0x1b')]);_0x5b1827['attributes']=_['intersection'](_0x2b5ec6[_0xdf6e('0x1f')],qs['fields'](_0x3c6a2e[_0xdf6e('0x1b')][_0xdf6e('0x20')]));_0x5b1827[_0xdf6e('0x21')]=_0x5b1827[_0xdf6e('0x21')]['length']?_0x5b1827[_0xdf6e('0x21')]:_0x2b5ec6[_0xdf6e('0x1f')];if(!_0x3c6a2e[_0xdf6e('0x1b')]['hasOwnProperty'](_0xdf6e('0x22'))){_0x5b1827[_0xdf6e('0x7')]=qs[_0xdf6e('0x7')](_0x3c6a2e[_0xdf6e('0x1b')]['limit']);_0x5b1827[_0xdf6e('0x6')]=qs[_0xdf6e('0x6')](_0x3c6a2e['query'][_0xdf6e('0x6')]);}_0x5b1827['order']=qs[_0xdf6e('0x23')](_0x3c6a2e['query'][_0xdf6e('0x23')]);_0x5b1827['where']=qs[_0xdf6e('0x1d')](_[_0xdf6e('0x24')](_0x3c6a2e['query'],_0x2b5ec6[_0xdf6e('0x1d')]),_0x15282f);if(_0x3c6a2e[_0xdf6e('0x1b')][_0xdf6e('0x25')]){_0x5b1827[_0xdf6e('0x26')]=_['merge'](_0x5b1827[_0xdf6e('0x26')],{'$or':_[_0xdf6e('0x15')](_0x15282f,function(_0x31c250){if(_0x31c250[_0xdf6e('0x19')]!==_0xdf6e('0x27')){var _0x2320f0={};_0x2320f0[_0x31c250[_0xdf6e('0x13')]]={'$like':'%'+_0x3c6a2e[_0xdf6e('0x1b')]['filter']+'%'};return _0x2320f0;}})});}_0x5b1827=_['merge']({},_0x5b1827,_0x3c6a2e[_0xdf6e('0x28')]);var _0xae574c={'where':_0x5b1827['where']};return db['Dynamics365Account'][_0xdf6e('0x9')](_0xae574c)[_0xdf6e('0xd')](function(_0x38449c){_0xb5a770[_0xdf6e('0x9')]=_0x38449c;if(_0x3c6a2e[_0xdf6e('0x1b')][_0xdf6e('0x29')]){_0x5b1827[_0xdf6e('0x2a')]=[{'all':!![]}];}return db[_0xdf6e('0x16')][_0xdf6e('0x2b')](_0x5b1827);})['then'](function(_0x5466b0){_0xb5a770[_0xdf6e('0x2c')]=_0x5466b0;return _0xb5a770;})['then'](respondWithFilteredResult(_0xec1d4f,_0x5b1827))[_0xdf6e('0x2d')](handleError(_0xec1d4f,null));};exports[_0xdf6e('0x2e')]=function(_0x5008d8,_0x2fdbb0){var _0x5560e6={'raw':![],'where':{'id':_0x5008d8[_0xdf6e('0x2f')]['id']}},_0x13a525={};_0x13a525['model']=_[_0xdf6e('0x1c')](db['Dynamics365Account'][_0xdf6e('0x17')]);_0x13a525[_0xdf6e('0x1b')]=_[_0xdf6e('0x1c')](_0x5008d8['query']);_0x13a525[_0xdf6e('0x1d')]=_[_0xdf6e('0x1e')](_0x13a525[_0xdf6e('0x1f')],_0x13a525[_0xdf6e('0x1b')]);_0x5560e6[_0xdf6e('0x21')]=_['intersection'](_0x13a525[_0xdf6e('0x1f')],qs[_0xdf6e('0x20')](_0x5008d8[_0xdf6e('0x1b')][_0xdf6e('0x20')]));_0x5560e6['attributes']=_0x5560e6[_0xdf6e('0x21')][_0xdf6e('0x30')]?_0x5560e6[_0xdf6e('0x21')]:_0x13a525[_0xdf6e('0x1f')];if(_0x5008d8[_0xdf6e('0x1b')][_0xdf6e('0x29')]){_0x5560e6['include']=[{'all':!![]}];}_0x5560e6=_[_0xdf6e('0x31')]({},_0x5560e6,_0x5008d8[_0xdf6e('0x28')]);return db[_0xdf6e('0x16')][_0xdf6e('0x32')](_0x5560e6)['then'](handleEntityNotFound(_0x2fdbb0,null))[_0xdf6e('0xd')](respondWithResult(_0x2fdbb0,null))[_0xdf6e('0x2d')](handleError(_0x2fdbb0,null));};exports['create']=function(_0x10ae3f,_0xb9bb9e){return db[_0xdf6e('0x16')][_0xdf6e('0x33')](_0x10ae3f[_0xdf6e('0x34')],{})[_0xdf6e('0xd')](respondWithResult(_0xb9bb9e,0xc9))[_0xdf6e('0x2d')](handleError(_0xb9bb9e,null));};exports[_0xdf6e('0xc')]=function(_0x24f416,_0x4bbad8){if(_0x24f416[_0xdf6e('0x34')]['id']){delete _0x24f416[_0xdf6e('0x34')]['id'];}return db[_0xdf6e('0x16')][_0xdf6e('0x32')]({'where':{'id':_0x24f416[_0xdf6e('0x2f')]['id']}})[_0xdf6e('0xd')](handleEntityNotFound(_0x4bbad8,null))[_0xdf6e('0xd')](saveUpdates(_0x24f416['body'],null))[_0xdf6e('0xd')](respondWithResult(_0x4bbad8,null))['catch'](handleError(_0x4bbad8,null));};exports[_0xdf6e('0xe')]=function(_0x111978,_0x1ba37b){return db[_0xdf6e('0x16')]['find']({'where':{'id':_0x111978[_0xdf6e('0x2f')]['id']}})[_0xdf6e('0xd')](handleEntityNotFound(_0x1ba37b,null))[_0xdf6e('0xd')](removeEntity(_0x1ba37b,null))['catch'](handleError(_0x1ba37b,null));};exports[_0xdf6e('0x35')]=function(_0x33016d,_0x2b466e){var _0xbabf0f={};var _0x321046={};var _0x22a90e;var _0x39fb62;return db[_0xdf6e('0x16')][_0xdf6e('0x36')]({'where':{'id':_0x33016d['params']['id']}})[_0xdf6e('0xd')](handleEntityNotFound(_0x2b466e,null))['then'](function(_0x10a9c8){if(_0x10a9c8){_0x22a90e=_0x10a9c8;_0x321046[_0xdf6e('0x1f')]=_[_0xdf6e('0x1c')](db[_0xdf6e('0x37')][_0xdf6e('0x17')]);_0x321046['query']=_['keys'](_0x33016d['query']);_0x321046['filters']=_['intersection'](_0x321046[_0xdf6e('0x1f')],_0x321046[_0xdf6e('0x1b')]);_0xbabf0f['attributes']=_[_0xdf6e('0x1e')](_0x321046[_0xdf6e('0x1f')],qs[_0xdf6e('0x20')](_0x33016d[_0xdf6e('0x1b')][_0xdf6e('0x20')]));_0xbabf0f[_0xdf6e('0x21')]=_0xbabf0f['attributes'][_0xdf6e('0x30')]?_0xbabf0f[_0xdf6e('0x21')]:_0x321046['model'];_0xbabf0f[_0xdf6e('0x38')]=qs['sort'](_0x33016d[_0xdf6e('0x1b')][_0xdf6e('0x23')]);_0xbabf0f[_0xdf6e('0x26')]=qs[_0xdf6e('0x1d')](_[_0xdf6e('0x24')](_0x33016d['query'],_0x321046[_0xdf6e('0x1d')]));if(_0x33016d[_0xdf6e('0x1b')][_0xdf6e('0x25')]){_0xbabf0f[_0xdf6e('0x26')]=_[_0xdf6e('0x31')](_0xbabf0f[_0xdf6e('0x26')],{'$or':_[_0xdf6e('0x15')](_0xbabf0f[_0xdf6e('0x21')],function(_0x48f0a6){var _0x2da2df={};_0x2da2df[_0x48f0a6]={'$like':'%'+_0x33016d['query'][_0xdf6e('0x25')]+'%'};return _0x2da2df;})});}_0xbabf0f=_[_0xdf6e('0x31')]({},_0xbabf0f,_0x33016d[_0xdf6e('0x28')]);return _0x22a90e[_0xdf6e('0x35')](_0xbabf0f);}})[_0xdf6e('0xd')](function(_0x5768f1){if(_0x5768f1){_0x39fb62=_0x5768f1[_0xdf6e('0x30')];if(!_0x33016d[_0xdf6e('0x1b')]['hasOwnProperty'](_0xdf6e('0x22'))){_0xbabf0f[_0xdf6e('0x7')]=qs['limit'](_0x33016d[_0xdf6e('0x1b')][_0xdf6e('0x7')]);_0xbabf0f['offset']=qs[_0xdf6e('0x6')](_0x33016d['query'][_0xdf6e('0x6')]);}return _0x22a90e['getConfigurations'](_0xbabf0f);}})['then'](function(_0x471348){if(_0x471348){return _0x471348?{'count':_0x39fb62,'rows':_0x471348}:null;}})['then'](respondWithResult(_0x2b466e,null))[_0xdf6e('0x2d')](handleError(_0x2b466e,null));};exports[_0xdf6e('0x39')]=function(_0x2360d3,_0x2bc8bc){if(_0x2360d3[_0xdf6e('0x34')]['id']){delete _0x2360d3[_0xdf6e('0x34')]['id'];}return db[_0xdf6e('0x16')]['findOne']({'where':{'id':_0x2360d3['params']['id']}})[_0xdf6e('0xd')](handleEntityNotFound(_0x2bc8bc,null))[_0xdf6e('0xd')](function(_0x111539){if(_0x111539){_0x2360d3[_0xdf6e('0x34')]['AccountId']=_0x111539['id'];_0x2360d3['body'][_0xdf6e('0x3a')]=integrations[_0xdf6e('0x3b')](_0x2360d3[_0xdf6e('0x34')][_0xdf6e('0x3c')],_0x2360d3['body'][_0xdf6e('0x19')]);_0x2360d3[_0xdf6e('0x34')][_0xdf6e('0x3d')]=integrations['getDescriptions'](_0x2360d3['body'][_0xdf6e('0x3c')],_0x2360d3[_0xdf6e('0x34')][_0xdf6e('0x19')]);return db[_0xdf6e('0x37')][_0xdf6e('0x33')](_0x2360d3['body'],{'include':[{'model':db[_0xdf6e('0x3e')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0xdf6e('0x3d')}]});}return null;})[_0xdf6e('0xd')](respondWithResult(_0x2bc8bc,null))[_0xdf6e('0x2d')](handleError(_0x2bc8bc,null));};function sanitizeRemoteUri(_0x3631a6){var _0x5c601b=_0x3631a6[_0xdf6e('0x3f')](-0x1);if(_0x5c601b==='/')return _0x3631a6[_0xdf6e('0x40')](0x0,_0x3631a6[_0xdf6e('0x41')](_0x5c601b));return _0x3631a6;}function getWebApiUrl(_0x473db0){return util[_0xdf6e('0x42')](_0xdf6e('0x43'),_0x473db0);}exports['getFields']=function(_0x1ce77a,_0x49990d){var _0x3e11f0=_0x1ce77a[_0xdf6e('0x1b')][_0xdf6e('0x44')];var _0x38d8ed=_0x3e11f0==='incident'?'Incident':_0xdf6e('0x45');var _0xfdb8c5='';var _0x1f8cc0='';var _0x5e69b2='';var _0x17cc91='';var _0x18ac18='';var _0x1cdeae='';var _0x4a541f='';var _0x4a9417='';var _0x191aeb=[_0xdf6e('0x46'),_0xdf6e('0x47'),'customerid',_0xdf6e('0x48'),_0xdf6e('0x49'),_0xdf6e('0x4a'),_0xdf6e('0x4b'),_0xdf6e('0x4c'),_0xdf6e('0x4d'),_0xdf6e('0x4e')];var _0x3bde77=[_0xdf6e('0x4f'),_0xdf6e('0x50'),_0xdf6e('0x51'),'billedserviceunits','contactidname',_0xdf6e('0x52'),_0xdf6e('0x53'),_0xdf6e('0x54'),_0xdf6e('0x55'),_0xdf6e('0x56'),_0xdf6e('0x57'),_0xdf6e('0x58'),_0xdf6e('0x59'),'createdonbehalfbyname',_0xdf6e('0x5a'),_0xdf6e('0x5b'),_0xdf6e('0x5c'),_0xdf6e('0x5d'),_0xdf6e('0x5e'),_0xdf6e('0x5f'),_0xdf6e('0x60'),_0xdf6e('0x61'),_0xdf6e('0x62'),_0xdf6e('0x63'),_0xdf6e('0x64'),_0xdf6e('0x65'),'importsequencenumber',_0xdf6e('0x66'),'kbarticleidname',_0xdf6e('0x67'),_0xdf6e('0x68'),_0xdf6e('0x69'),_0xdf6e('0x6a'),_0xdf6e('0x6b'),'modifiedbyyominame',_0xdf6e('0x6c'),_0xdf6e('0x6d'),'modifiedonbehalfbyyominame',_0xdf6e('0x6e'),_0xdf6e('0x6f'),_0xdf6e('0x70'),'onholdtime',_0xdf6e('0x71'),_0xdf6e('0x72'),_0xdf6e('0x73'),_0xdf6e('0x74'),_0xdf6e('0x75'),'primarycontactidname',_0xdf6e('0x76'),'prioritycodename',_0xdf6e('0x77'),'productserialnumber',_0xdf6e('0x78'),_0xdf6e('0x79'),_0xdf6e('0x7a'),'responsiblecontactidname',_0xdf6e('0x7b'),_0xdf6e('0x7c'),_0xdf6e('0x7d'),'slaname',_0xdf6e('0x7e'),'statecode',_0xdf6e('0x7f'),'subjectidname',_0xdf6e('0x80'),_0xdf6e('0x81'),'transactioncurrencyidname',_0xdf6e('0x82'),_0xdf6e('0x83'),_0xdf6e('0x84')];var _0xcfe81=_0x191aeb[_0xdf6e('0x85')](_0x3bde77);return db[_0xdf6e('0x16')][_0xdf6e('0x36')]({'where':{'id':_0x1ce77a['params']['id']},'attributes':['id','username','password','remoteUri',_0xdf6e('0x86'),_0xdf6e('0x87'),_0xdf6e('0x88'),_0xdf6e('0x89')],'include':[{'model':db[_0xdf6e('0x8a')],'as':'CloudProvider','attributes':['id',_0xdf6e('0x8b'),'data7']}]})[_0xdf6e('0xd')](handleEntityNotFound(_0x49990d,null))[_0xdf6e('0xd')](function(_0x5d51d3){if(_0x5d51d3){if(_0x5d51d3[_0xdf6e('0x89')]){_0x5d51d3[_0xdf6e('0x8c')]=_0x5d51d3[_0xdf6e('0x8a')][_0xdf6e('0x8b')];_0x4a9417=sanitizeRemoteUri(_0x5d51d3[_0xdf6e('0x8a')]['data7']);_0x4a541f=getWebApiUrl(_0x4a9417);return _0x5d51d3;}_0x4a9417=sanitizeRemoteUri(_0x5d51d3[_0xdf6e('0x8d')]);_0x4a541f=getWebApiUrl(_0x4a9417);var _0x2286c8={'method':_0xdf6e('0x8e'),'uri':'https://login.microsoftonline.com/'+_0x5d51d3[_0xdf6e('0x86')]+_0xdf6e('0x8f'),'form':{'client_id':_0x5d51d3[_0xdf6e('0x87')],'resource':_0x4a9417,'username':_0x5d51d3[_0xdf6e('0x90')],'password':_0x5d51d3[_0xdf6e('0x91')],'grant_type':_0xdf6e('0x91'),'client_secret':_0x5d51d3[_0xdf6e('0x88')]},'json':!![]};return rp(_0x2286c8);}})[_0xdf6e('0xd')](function(_0x27afae){_0x1cdeae=_0x27afae[_0xdf6e('0x8c')];var _0x469dcb={'method':_0xdf6e('0x92'),'uri':encodeURI(_0x4a541f+_0xdf6e('0x93')+_0x38d8ed+'\x27'),'headers':{'Authorization':_0xdf6e('0x94')+_0x1cdeae,'If-None-Match':null,'OData-Version':_0xdf6e('0x95')},'json':!![]};return rp(_0x469dcb);})[_0xdf6e('0xd')](function(_0x4a103f){var _0xf29b29=_0x4a103f['value'][0x0];var _0x436cc1=_0xf29b29[_0xdf6e('0x96')];var _0xd590e={'method':_0xdf6e('0x92'),'uri':_0x4a541f+_0xdf6e('0x97')+_0x436cc1+_0xdf6e('0x98'),'headers':{'Authorization':_0xdf6e('0x94')+_0x1cdeae,'If-None-Match':null,'OData-Version':_0xdf6e('0x95')},'json':!![]};return rp(_0xd590e);})[_0xdf6e('0xd')](function(_0x4882d3){_0xfdb8c5=_0x4882d3;_0x1f8cc0=_0xfdb8c5[_0xdf6e('0x99')];_0x1f8cc0=_[_0xdf6e('0x9a')](_0x1f8cc0,function(_0x3a39ab){return!_0xcfe81[_0xdf6e('0x9b')](_0x3a39ab[_0xdf6e('0x9c')]);});var _0x1197a0=[];var _0x5af23f=[];_0x1f8cc0[_0xdf6e('0x9d')](function(_0x5595c3){if(_0x5595c3[_0xdf6e('0x9e')]){var _0x1a1efb=_0x5595c3[_0xdf6e('0x9e')][_0xdf6e('0x40')](_0x5595c3[_0xdf6e('0x9e')][_0xdf6e('0x41')]('.')+0x1);if(_0x1a1efb==='PicklistAttributeMetadata'){_0x1197a0[_0xdf6e('0x9f')](getSelectList(_0x4a541f,_0x3e11f0,_0x5af23f,_0xfdb8c5[_0xdf6e('0x96')],_0x5595c3[_0xdf6e('0x96')],_0x1cdeae));}}});return Promise['all'](_0x1197a0);})[_0xdf6e('0xd')](function(_0x116f60){_0x5e69b2=_0x116f60[0x0];var _0x1405e6=[];var _0x5e1392=[];_0x1f8cc0[_0xdf6e('0x9d')](function(_0x1460f9){if(!_['isNil'](_0x1460f9['@odata.type'])){var _0x47c797=_0x1460f9['@odata.type'][_0xdf6e('0x40')](_0x1460f9[_0xdf6e('0x9e')][_0xdf6e('0x41')]('.')+0x1);if(_0x47c797===_0xdf6e('0xa0')){_0x1405e6['push'](getBooleanList(_0x4a541f,_0x3e11f0,_0x5e1392,_0xfdb8c5[_0xdf6e('0x96')],_0x1460f9[_0xdf6e('0x96')],_0x1cdeae));}}});return Promise[_0xdf6e('0xa1')](_0x1405e6);})['then'](function(_0x2535a8){_0x17cc91=_0x2535a8[0x0];var _0xd099e7=[];var _0x4d4e7=[];_0x1f8cc0[_0xdf6e('0x9d')](function(_0x14f2be){if(_0x14f2be[_0xdf6e('0x9e')]){var _0x368da7=_0x14f2be[_0xdf6e('0x9e')][_0xdf6e('0x40')](_0x14f2be[_0xdf6e('0x9e')][_0xdf6e('0x41')]('.')+0x1);if(_0x368da7==='StringAttributeMetadata'||_0x368da7===_0xdf6e('0xa2')||_0x368da7===_0xdf6e('0xa3')||_0x368da7===_0xdf6e('0xa4')||_0x368da7===_0xdf6e('0xa5')||_0x368da7===_0xdf6e('0xa6')||_0x368da7===_0xdf6e('0xa7')||_0x368da7==='EntityNameAttributeMetadata'||_0x368da7===_0xdf6e('0xa8')||_0x368da7===_0xdf6e('0xa9')){_0xd099e7[_0xdf6e('0x9f')](getInputList(_0x4a541f,_0x3e11f0,_0x368da7,_0x4d4e7,_0xfdb8c5[_0xdf6e('0x96')],_0x14f2be[_0xdf6e('0x96')],_0x1cdeae));}}});return Promise[_0xdf6e('0xa1')](_0xd099e7);})[_0xdf6e('0xd')](function(_0xed00e0){_0x18ac18=_0xed00e0[0x0];var _0x3b6607=_0x5e69b2[_0xdf6e('0x85')](_0x17cc91)['concat'](_0x18ac18);var _0x52e74a={'count':_0x3b6607[_0xdf6e('0x30')],'rows':_0x3b6607};return _0x52e74a;})[_0xdf6e('0xd')](respondWithResult(_0x49990d,null))[_0xdf6e('0x2d')](function(_0x1cd0bf){var _0x15536a=_0x1ce77a[_0xdf6e('0x1b')]['test']?0x1f4:_0x1cd0bf[_0xdf6e('0xaa')]||0x1f4;logger['error'](_0x1cd0bf[_0xdf6e('0xab')]);delete _0x1cd0bf[_0xdf6e('0x13')];if(_0x15536a===0x191){_0x15536a=0x190;}_0x49990d['status'](_0x15536a)[_0xdf6e('0xac')](_0x1ce77a['query'][_0xdf6e('0xad')]?{'message':_0xdf6e('0xae'),'statusCode':_0x1cd0bf['statusCode']}:_0x1cd0bf);});};function getSelectList(_0x5c4815,_0x5b678a,_0x150104,_0x1ef3ec,_0x5eebd0,_0x308477){var _0xefb9db={'method':'GET','uri':_0x5c4815+_0xdf6e('0x97')+_0x1ef3ec+_0xdf6e('0xaf')+_0x5eebd0+_0xdf6e('0xb0')+_0xdf6e('0xb1'),'headers':{'Authorization':_0xdf6e('0x94')+_0x308477,'If-None-Match':null,'OData-Version':_0xdf6e('0x95')},'json':!![]};return rp(_0xefb9db)[_0xdf6e('0xd')](function(_0x372aee){var _0x4220f0=[];var _0x260cfc=_0x372aee[_0xdf6e('0xb2')][_0xdf6e('0xb3')];_0x260cfc[_0xdf6e('0x9d')](function(_0x2df94c){_0x4220f0[_0xdf6e('0x9f')]({'name':_0x2df94c['Label']['UserLocalizedLabel'][_0xdf6e('0xb4')],'value':String(_0x2df94c[_0xdf6e('0xb5')])});});var _0x546e32={'id':_0x5b678a+'_'+_0x372aee[_0xdf6e('0x9c')],'name':_0x372aee[_0xdf6e('0xb6')][_0xdf6e('0xb7')][_0xdf6e('0xb4')],'custom':![],'options':_0x4220f0};_0x150104[_0xdf6e('0x9f')](_0x546e32);return _0x150104;});}function getBooleanList(_0x514abc,_0xf3c18a,_0x2b88d6,_0x3c87cc,_0x206df7,_0x1012ce){var _0x5c2890={'method':'GET','uri':_0x514abc+_0xdf6e('0x97')+_0x3c87cc+_0xdf6e('0xaf')+_0x206df7+_0xdf6e('0xb8'),'headers':{'Authorization':'Bearer\x20'+_0x1012ce,'If-None-Match':null,'OData-Version':_0xdf6e('0x95')},'json':!![]};return rp(_0x5c2890)[_0xdf6e('0xd')](function(_0x3ff135){var _0x2ff951=[];_0x2ff951[_0xdf6e('0x9f')]({'name':_0x3ff135['OptionSet'][_0xdf6e('0xb9')]['Label'][_0xdf6e('0xb7')][_0xdf6e('0xb4')],'value':_0xdf6e('0xba')},{'name':_0x3ff135['OptionSet'][_0xdf6e('0xbb')][_0xdf6e('0xb4')]['UserLocalizedLabel']['Label'],'value':_0xdf6e('0xbc')});var _0x39b07d={'id':_0xf3c18a+'_'+_0x3ff135['LogicalName'],'name':_0x3ff135[_0xdf6e('0xb6')][_0xdf6e('0xb7')]['Label'],'custom':![],'options':_0x2ff951};_0x2b88d6[_0xdf6e('0x9f')](_0x39b07d);return _0x2b88d6;});}function getInputList(_0x3e0eeb,_0x1b8cdc,_0x43ee76,_0x183fc4,_0x479184,_0x28364b,_0x4a587a){var _0x45598f={'method':_0xdf6e('0x92'),'uri':_0x3e0eeb+'EntityDefinitions('+_0x479184+_0xdf6e('0xaf')+_0x28364b+_0xdf6e('0xbd')+_0x43ee76+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xdf6e('0x94')+_0x4a587a,'If-None-Match':null,'OData-Version':_0xdf6e('0x95')},'json':!![]};return rp(_0x45598f)[_0xdf6e('0xd')](function(_0x3d1697){var _0x49de39={'id':_0x1b8cdc+'_'+_0x3d1697[_0xdf6e('0x9c')],'name':_0x3d1697['DisplayName'][_0xdf6e('0xb7')]?_0x3d1697[_0xdf6e('0xb6')][_0xdf6e('0xb7')][_0xdf6e('0xb4')]:_0x3d1697['LogicalName'],'custom':![],'options':[]};_0x183fc4[_0xdf6e('0x9f')](_0x49de39);return _0x183fc4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 12bf7d7..799dca2 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x5144eb,_0x4886e2){var _0x192abf=function(_0x5ccce2){while(--_0x5ccce2){_0x5144eb['push'](_0x5144eb['shift']());}};_0x192abf(++_0x4886e2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0xcb91[_0x3ec122];return _0x4ecf41;};'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 a939041..3f05165 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 _0xf902=['ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','map','include','model'];(function(_0x12f155,_0x16a21d){var _0x452490=function(_0x556d72){while(--_0x556d72){_0x12f155['push'](_0x12f155['shift']());}};_0x452490(++_0x16a21d);}(_0xf902,0xc1));var _0x2f90=function(_0x7e4d89,_0x4c8c86){_0x7e4d89=_0x7e4d89-0x0;var _0x147d51=_0xf902[_0x7e4d89];return _0x147d51;};'use strict';var _=require(_0x2f90('0x0'));var util=require(_0x2f90('0x1'));var moment=require(_0x2f90('0x2'));var BPromise=require(_0x2f90('0x3'));var rs=require(_0x2f90('0x4'));var fs=require('fs');var Redis=require(_0x2f90('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2f90('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2f90('0x7'));var client=jayson[_0x2f90('0x8')][_0x2f90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x153feb,_0x5c2ef9,_0x3b87e4){return new BPromise(function(_0x1900f6,_0xb12751){return client['request'](_0x153feb,_0x3b87e4)[_0x2f90('0xa')](function(_0x108f18){logger[_0x2f90('0xb')](_0x2f90('0xc'),_0x5c2ef9,'request\x20sent');logger[_0x2f90('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5c2ef9,_0x2f90('0xe'),JSON[_0x2f90('0xf')](_0x108f18));if(_0x108f18['error']){if(_0x108f18[_0x2f90('0x10')][_0x2f90('0x11')]===0x1f4){logger[_0x2f90('0x10')](_0x2f90('0xc'),_0x5c2ef9,_0x108f18[_0x2f90('0x10')][_0x2f90('0x12')]);return _0xb12751(_0x108f18[_0x2f90('0x10')][_0x2f90('0x12')]);}logger[_0x2f90('0x10')](_0x2f90('0xc'),_0x5c2ef9,_0x108f18[_0x2f90('0x10')][_0x2f90('0x12')]);return _0x1900f6(_0x108f18[_0x2f90('0x10')][_0x2f90('0x12')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5c2ef9,_0x2f90('0xe'));_0x1900f6(_0x108f18[_0x2f90('0x13')][_0x2f90('0x12')]);}})[_0x2f90('0x14')](function(_0xefed8d){logger[_0x2f90('0x10')](_0x2f90('0xc'),_0x5c2ef9,_0xefed8d);_0xb12751(_0xefed8d);});});}exports[_0x2f90('0x15')]=function(_0x55fc5a){var _0x41e901=this;return new Promise(function(_0x5d367f,_0x45d96d){return db[_0x2f90('0x16')][_0x2f90('0x17')]({'raw':_0x55fc5a['options']?_0x55fc5a[_0x2f90('0x18')][_0x2f90('0x19')]===undefined?!![]:![]:!![],'where':_0x55fc5a[_0x2f90('0x18')]?_0x55fc5a['options'][_0x2f90('0x1a')]||null:null,'attributes':_0x55fc5a['options']?_0x55fc5a[_0x2f90('0x18')][_0x2f90('0x1b')]||null:null,'limit':_0x55fc5a['options']?_0x55fc5a['options']['limit']||null:null,'include':_0x55fc5a[_0x2f90('0x18')]?_0x55fc5a[_0x2f90('0x18')]['include']?_[_0x2f90('0x1c')](_0x55fc5a[_0x2f90('0x18')][_0x2f90('0x1d')],function(_0x1c4364){return{'model':db[_0x1c4364[_0x2f90('0x1e')]],'as':_0x1c4364['as'],'attributes':_0x1c4364[_0x2f90('0x1b')],'include':_0x1c4364['include']?_['map'](_0x1c4364['include'],function(_0x5f3c18){return{'model':db[_0x5f3c18['model']],'as':_0x5f3c18['as'],'attributes':_0x5f3c18[_0x2f90('0x1b')],'include':_0x5f3c18[_0x2f90('0x1d')]?_[_0x2f90('0x1c')](_0x5f3c18[_0x2f90('0x1d')],function(_0x32aab4){return{'model':db[_0x32aab4[_0x2f90('0x1e')]],'as':_0x32aab4['as'],'attributes':_0x32aab4[_0x2f90('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fa1d6){logger['info'](_0x2f90('0x15'),_0x55fc5a);logger['debug']('GetDynamics365Account',_0x55fc5a,JSON[_0x2f90('0xf')](_0x2fa1d6));_0x5d367f(_0x2fa1d6);})['catch'](function(_0x3bde15){logger['error'](_0x2f90('0x15'),_0x3bde15[_0x2f90('0x12')],_0x55fc5a);_0x45d96d(_0x41e901['error'](0x1f4,_0x3bde15[_0x2f90('0x12')]));});});};exports[_0x2f90('0x1f')]=function(_0x506066){var _0x1aaaa8=this;return new Promise(function(_0xbb26f9,_0x150713){return db[_0x2f90('0x16')]['find']({'raw':_0x506066[_0x2f90('0x18')]?_0x506066[_0x2f90('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x506066[_0x2f90('0x18')]?_0x506066[_0x2f90('0x18')]['where']||null:null,'attributes':_0x506066[_0x2f90('0x18')]?_0x506066[_0x2f90('0x18')][_0x2f90('0x1b')]||null:null,'include':_0x506066[_0x2f90('0x18')]?_0x506066['options'][_0x2f90('0x1d')]?_[_0x2f90('0x1c')](_0x506066[_0x2f90('0x18')][_0x2f90('0x1d')],function(_0x1e6b43){return{'model':db[_0x1e6b43[_0x2f90('0x1e')]],'as':_0x1e6b43['as'],'attributes':_0x1e6b43['attributes'],'include':_0x1e6b43[_0x2f90('0x1d')]?_[_0x2f90('0x1c')](_0x1e6b43[_0x2f90('0x1d')],function(_0x5c0da7){return{'model':db[_0x5c0da7[_0x2f90('0x1e')]],'as':_0x5c0da7['as'],'attributes':_0x5c0da7[_0x2f90('0x1b')],'include':_0x5c0da7[_0x2f90('0x1d')]?_[_0x2f90('0x1c')](_0x5c0da7[_0x2f90('0x1d')],function(_0x4cff5a){return{'model':db[_0x4cff5a[_0x2f90('0x1e')]],'as':_0x4cff5a['as'],'attributes':_0x4cff5a[_0x2f90('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37a68e){logger[_0x2f90('0xb')]('ShowDynamics365Account',_0x506066);logger[_0x2f90('0xd')]('ShowDynamics365Account',_0x506066,JSON['stringify'](_0x37a68e));_0xbb26f9(_0x37a68e);})[_0x2f90('0x14')](function(_0x14fda2){logger[_0x2f90('0x10')](_0x2f90('0x1f'),_0x14fda2['message'],_0x506066);_0x150713(_0x1aaaa8[_0x2f90('0x10')](0x1f4,_0x14fda2[_0x2f90('0x12')]));});});}; \ No newline at end of file +var _0xd6ec=['then','GetDynamics365Account','debug','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','Dynamics365Account','findAll','options','raw','where','map','include','model','attributes'];(function(_0x309b30,_0x26a8e3){var _0x2cf69f=function(_0x5049ec){while(--_0x5049ec){_0x309b30['push'](_0x309b30['shift']());}};_0x2cf69f(++_0x26a8e3);}(_0xd6ec,0x191));var _0xcd6e=function(_0x36532a,_0x339336){_0x36532a=_0x36532a-0x0;var _0x503f41=_0xd6ec[_0x36532a];return _0x503f41;};'use strict';var _=require(_0xcd6e('0x0'));var util=require(_0xcd6e('0x1'));var moment=require(_0xcd6e('0x2'));var BPromise=require(_0xcd6e('0x3'));var rs=require(_0xcd6e('0x4'));var fs=require('fs');var Redis=require(_0xcd6e('0x5'));var db=require(_0xcd6e('0x6'))['db'];var utils=require(_0xcd6e('0x7'));var logger=require(_0xcd6e('0x8'))(_0xcd6e('0x9'));var config=require(_0xcd6e('0xa'));var jayson=require(_0xcd6e('0xb'));var client=jayson[_0xcd6e('0xc')][_0xcd6e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2df97c,_0x18f65c,_0x552050){return new BPromise(function(_0x81914b,_0x7628d2){return client['request'](_0x2df97c,_0x552050)['then'](function(_0x29c4c8){logger[_0xcd6e('0xe')](_0xcd6e('0xf'),_0x18f65c,'request\x20sent');logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x18f65c,_0xcd6e('0x10'),JSON[_0xcd6e('0x11')](_0x29c4c8));if(_0x29c4c8['error']){if(_0x29c4c8['error'][_0xcd6e('0x12')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x18f65c,_0x29c4c8[_0xcd6e('0x13')][_0xcd6e('0x14')]);return _0x7628d2(_0x29c4c8['error']['message']);}logger[_0xcd6e('0x13')](_0xcd6e('0xf'),_0x18f65c,_0x29c4c8[_0xcd6e('0x13')][_0xcd6e('0x14')]);return _0x81914b(_0x29c4c8[_0xcd6e('0x13')][_0xcd6e('0x14')]);}else{logger[_0xcd6e('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x18f65c,_0xcd6e('0x10'));_0x81914b(_0x29c4c8['result'][_0xcd6e('0x14')]);}})[_0xcd6e('0x15')](function(_0x3eb8c2){logger[_0xcd6e('0x13')](_0xcd6e('0xf'),_0x18f65c,_0x3eb8c2);_0x7628d2(_0x3eb8c2);});});}exports['GetDynamics365Account']=function(_0xa753e1){var _0x2f8e52=this;return new Promise(function(_0x4d76cc,_0x588127){return db[_0xcd6e('0x16')][_0xcd6e('0x17')]({'raw':_0xa753e1[_0xcd6e('0x18')]?_0xa753e1[_0xcd6e('0x18')][_0xcd6e('0x19')]===undefined?!![]:![]:!![],'where':_0xa753e1[_0xcd6e('0x18')]?_0xa753e1[_0xcd6e('0x18')][_0xcd6e('0x1a')]||null:null,'attributes':_0xa753e1['options']?_0xa753e1['options']['attributes']||null:null,'limit':_0xa753e1[_0xcd6e('0x18')]?_0xa753e1['options']['limit']||null:null,'include':_0xa753e1[_0xcd6e('0x18')]?_0xa753e1[_0xcd6e('0x18')]['include']?_[_0xcd6e('0x1b')](_0xa753e1['options']['include'],function(_0x57c293){return{'model':db[_0x57c293['model']],'as':_0x57c293['as'],'attributes':_0x57c293['attributes'],'include':_0x57c293[_0xcd6e('0x1c')]?_[_0xcd6e('0x1b')](_0x57c293[_0xcd6e('0x1c')],function(_0x31aeb7){return{'model':db[_0x31aeb7[_0xcd6e('0x1d')]],'as':_0x31aeb7['as'],'attributes':_0x31aeb7[_0xcd6e('0x1e')],'include':_0x31aeb7[_0xcd6e('0x1c')]?_['map'](_0x31aeb7[_0xcd6e('0x1c')],function(_0x4951fb){return{'model':db[_0x4951fb[_0xcd6e('0x1d')]],'as':_0x4951fb['as'],'attributes':_0x4951fb[_0xcd6e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcd6e('0x1f')](function(_0x107240){logger[_0xcd6e('0xe')](_0xcd6e('0x20'),_0xa753e1);logger[_0xcd6e('0x21')](_0xcd6e('0x20'),_0xa753e1,JSON[_0xcd6e('0x11')](_0x107240));_0x4d76cc(_0x107240);})[_0xcd6e('0x15')](function(_0x578b90){logger[_0xcd6e('0x13')]('GetDynamics365Account',_0x578b90[_0xcd6e('0x14')],_0xa753e1);_0x588127(_0x2f8e52[_0xcd6e('0x13')](0x1f4,_0x578b90[_0xcd6e('0x14')]));});});};exports[_0xcd6e('0x22')]=function(_0x1a8be5){var _0xb565db=this;return new Promise(function(_0xa56bf9,_0x4c8fa5){return db[_0xcd6e('0x16')][_0xcd6e('0x23')]({'raw':_0x1a8be5[_0xcd6e('0x18')]?_0x1a8be5[_0xcd6e('0x18')][_0xcd6e('0x19')]===undefined?!![]:![]:!![],'where':_0x1a8be5['options']?_0x1a8be5[_0xcd6e('0x18')][_0xcd6e('0x1a')]||null:null,'attributes':_0x1a8be5[_0xcd6e('0x18')]?_0x1a8be5[_0xcd6e('0x18')][_0xcd6e('0x1e')]||null:null,'include':_0x1a8be5[_0xcd6e('0x18')]?_0x1a8be5[_0xcd6e('0x18')][_0xcd6e('0x1c')]?_[_0xcd6e('0x1b')](_0x1a8be5[_0xcd6e('0x18')][_0xcd6e('0x1c')],function(_0x5e0a66){return{'model':db[_0x5e0a66[_0xcd6e('0x1d')]],'as':_0x5e0a66['as'],'attributes':_0x5e0a66[_0xcd6e('0x1e')],'include':_0x5e0a66[_0xcd6e('0x1c')]?_[_0xcd6e('0x1b')](_0x5e0a66[_0xcd6e('0x1c')],function(_0x475a82){return{'model':db[_0x475a82[_0xcd6e('0x1d')]],'as':_0x475a82['as'],'attributes':_0x475a82['attributes'],'include':_0x475a82[_0xcd6e('0x1c')]?_['map'](_0x475a82[_0xcd6e('0x1c')],function(_0x5a5e4a){return{'model':db[_0x5a5e4a[_0xcd6e('0x1d')]],'as':_0x5a5e4a['as'],'attributes':_0x5a5e4a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd6e('0x1f')](function(_0x1fe722){logger[_0xcd6e('0xe')](_0xcd6e('0x22'),_0x1a8be5);logger['debug'](_0xcd6e('0x22'),_0x1a8be5,JSON['stringify'](_0x1fe722));_0xa56bf9(_0x1fe722);})[_0xcd6e('0x15')](function(_0x967703){logger[_0xcd6e('0x13')]('ShowDynamics365Account',_0x967703['message'],_0x1a8be5);_0x4c8fa5(_0xb565db[_0xcd6e('0x13')](0x1f4,_0x967703['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5718bc9..9286128 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 _0xb77e=['/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x20beea,_0x5db625){var _0x570955=function(_0x3803d5){while(--_0x3803d5){_0x20beea['push'](_0x20beea['shift']());}};_0x570955(++_0x5db625);}(_0xb77e,0x1e6));var _0xeb77=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xb77e[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0xeb77('0x0'));var util=require(_0xeb77('0x1'));var path=require(_0xeb77('0x2'));var timeout=require(_0xeb77('0x3'));var express=require(_0xeb77('0x4'));var router=express[_0xeb77('0x5')]();var fs_extra=require(_0xeb77('0x6'));var auth=require(_0xeb77('0x7'));var interaction=require(_0xeb77('0x8'));var config=require(_0xeb77('0x9'));var controller=require(_0xeb77('0xa'));router[_0xeb77('0xb')]('/',auth[_0xeb77('0xc')](),controller[_0xeb77('0xd')]);router['get'](_0xeb77('0xe'),auth[_0xeb77('0xc')](),controller[_0xeb77('0xf')]);router[_0xeb77('0xb')](_0xeb77('0x10'),auth[_0xeb77('0xc')](),controller['getFields']);router[_0xeb77('0xb')](_0xeb77('0x11'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xeb77('0xb')](_0xeb77('0x12'),auth[_0xeb77('0xc')](),controller[_0xeb77('0x13')]);router[_0xeb77('0x14')]('/',auth[_0xeb77('0xc')](),controller['create']);router[_0xeb77('0x15')](_0xeb77('0xe'),auth[_0xeb77('0xc')](),controller[_0xeb77('0x16')]);router['delete'](_0xeb77('0xe'),auth[_0xeb77('0xc')](),controller[_0xeb77('0x17')]);module[_0xeb77('0x18')]=router; \ No newline at end of file +var _0x173d=['get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index'];(function(_0x25986b,_0x3a8bc2){var _0xdbcd85=function(_0x190b06){while(--_0x190b06){_0x25986b['push'](_0x25986b['shift']());}};_0xdbcd85(++_0x3a8bc2);}(_0x173d,0x108));var _0xd173=function(_0xb4ff95,_0x1b0788){_0xb4ff95=_0xb4ff95-0x0;var _0xb23346=_0x173d[_0xb4ff95];return _0xb23346;};'use strict';var multer=require('multer');var util=require(_0xd173('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd173('0x1'));var router=express['Router']();var fs_extra=require(_0xd173('0x2'));var auth=require(_0xd173('0x3'));var interaction=require(_0xd173('0x4'));var config=require(_0xd173('0x5'));var controller=require(_0xd173('0x6'));router['get']('/',auth[_0xd173('0x7')](),controller[_0xd173('0x8')]);router[_0xd173('0x9')]('/:id',auth[_0xd173('0x7')](),controller['show']);router[_0xd173('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd173('0xa')]);router[_0xd173('0x9')]('/:id/subjects',auth[_0xd173('0x7')](),controller[_0xd173('0xb')]);router['get'](_0xd173('0xc'),auth[_0xd173('0x7')](),controller[_0xd173('0xd')]);router[_0xd173('0xe')]('/',auth[_0xd173('0x7')](),controller[_0xd173('0xf')]);router[_0xd173('0x10')](_0xd173('0x11'),auth[_0xd173('0x7')](),controller[_0xd173('0x12')]);router[_0xd173('0x13')](_0xd173('0x11'),auth['isAuthenticated'](),controller[_0xd173('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 9d197d4..dd9ca08 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 _0x3032=['nothing','sequelize','exports','STRING','ENUM','phonecall','contact'];(function(_0x322722,_0xc7981c){var _0x5e6eed=function(_0x4761e5){while(--_0x4761e5){_0x322722['push'](_0x322722['shift']());}};_0x5e6eed(++_0xc7981c);}(_0x3032,0xef));var _0x2303=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3032[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2303('0x0'));module[_0x2303('0x1')]={'name':{'type':Sequelize[_0x2303('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x2303('0x3')]('incident',_0x2303('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x2303('0x5'),_0x2303('0x6')),'defaultValue':_0x2303('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x1d03=['ENUM','phonecall','incident','contact','nothing','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d03,0x7d));var _0x31d0=function(_0x34cb50,_0x2e68a0){_0x34cb50=_0x34cb50-0x0;var _0x58c7f7=_0x1d03[_0x34cb50];return _0x58c7f7;};'use strict';var Sequelize=require(_0x31d0('0x0'));module[_0x31d0('0x1')]={'name':{'type':Sequelize[_0x31d0('0x2')]},'description':{'type':Sequelize[_0x31d0('0x2')]},'ticketType':{'type':Sequelize[_0x31d0('0x3')]('incident',_0x31d0('0x4')),'defaultValue':_0x31d0('0x5')},'moduleCreate':{'type':Sequelize[_0x31d0('0x3')](_0x31d0('0x6'),_0x31d0('0x7')),'defaultValue':_0x31d0('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 740ed54..ae19929 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 _0x0657=['Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','findOne','Dynamics365Field','length','sort','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map'];(function(_0xda65c9,_0xfa79a2){var _0x181cb6=function(_0x4312ac){while(--_0x4312ac){_0xda65c9['push'](_0xda65c9['shift']());}};_0x181cb6(++_0xfa79a2);}(_0x0657,0x15c));var _0x7065=function(_0x3754b3,_0x3b3a73){_0x3754b3=_0x3754b3-0x0;var _0x5eebcd=_0x0657[_0x3754b3];return _0x5eebcd;};'use strict';var emlformat=require(_0x7065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7065('0x1'));var rp=require(_0x7065('0x2'));var moment=require('moment');var BPromise=require(_0x7065('0x3'));var Mustache=require(_0x7065('0x4'));var util=require(_0x7065('0x5'));var path=require('path');var sox=require(_0x7065('0x6'));var csv=require('to-csv');var ejs=require(_0x7065('0x7'));var fs=require('fs');var fs_extra=require(_0x7065('0x8'));var _=require(_0x7065('0x9'));var squel=require('squel');var crypto=require(_0x7065('0xa'));var jsforce=require(_0x7065('0xb'));var deskjs=require(_0x7065('0xc'));var toCsv=require(_0x7065('0xd'));var querystring=require(_0x7065('0xe'));var Papa=require('papaparse');var Redis=require(_0x7065('0xf'));var authService=require(_0x7065('0x10'));var qs=require(_0x7065('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7065('0x12'));var logger=require(_0x7065('0x13'))('api');var utils=require(_0x7065('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7065('0x15'));var db=require(_0x7065('0x16'))['db'];function respondWithStatusCode(_0x2854e5,_0x44dfb8){_0x44dfb8=_0x44dfb8||0xcc;return function(_0x2fff41){if(_0x2fff41){return _0x2854e5[_0x7065('0x17')](_0x44dfb8);}return _0x2854e5[_0x7065('0x18')](_0x44dfb8)[_0x7065('0x19')]();};}function respondWithResult(_0x510e9b,_0x4e3592){_0x4e3592=_0x4e3592||0xc8;return function(_0x41c1e3){if(_0x41c1e3){return _0x510e9b[_0x7065('0x18')](_0x4e3592)[_0x7065('0x1a')](_0x41c1e3);}};}function respondWithFilteredResult(_0x2ed02e,_0x2ca66b){return function(_0x8eca7f){if(_0x8eca7f){var _0x3bd439=typeof _0x2ca66b[_0x7065('0x1b')]===_0x7065('0x1c')&&typeof _0x2ca66b[_0x7065('0x1d')]===_0x7065('0x1c');var _0x143ec8=_0x8eca7f[_0x7065('0x1e')];var _0x5ef6b1=_0x3bd439?0x0:_0x2ca66b[_0x7065('0x1b')];var _0x383583=_0x3bd439?_0x8eca7f[_0x7065('0x1e')]:_0x2ca66b[_0x7065('0x1b')]+_0x2ca66b['limit'];var _0x278b74;if(_0x383583>=_0x143ec8){_0x383583=_0x143ec8;_0x278b74=0xc8;}else{_0x278b74=0xce;}_0x2ed02e['status'](_0x278b74);return _0x2ed02e[_0x7065('0x1f')](_0x7065('0x20'),_0x5ef6b1+'-'+_0x383583+'/'+_0x143ec8)[_0x7065('0x1a')](_0x8eca7f);}return null;};}function patchUpdates(_0x134a61){return function(_0x571ac2){try{jsonpatch['apply'](_0x571ac2,_0x134a61,!![]);}catch(_0x20f6e2){return BPromise[_0x7065('0x21')](_0x20f6e2);}return _0x571ac2['save']();};}function saveUpdates(_0x4016cd,_0x2b91a1){return function(_0x4e562a){if(_0x4e562a){return _0x4e562a[_0x7065('0x22')](_0x4016cd)[_0x7065('0x23')](function(_0x3683d5){return _0x3683d5;});}return null;};}function removeEntity(_0x3219da,_0x3f6c85){return function(_0x9ce288){if(_0x9ce288){return _0x9ce288[_0x7065('0x24')]()[_0x7065('0x23')](function(){_0x3219da[_0x7065('0x18')](0xcc)[_0x7065('0x19')]();});}};}function handleEntityNotFound(_0xa6f91d,_0x8c303c){return function(_0x5e795d){if(!_0x5e795d){_0xa6f91d[_0x7065('0x17')](0x194);}return _0x5e795d;};}function handleError(_0x283f59,_0x2d35c7){_0x2d35c7=_0x2d35c7||0x1f4;return function(_0x30b160){logger[_0x7065('0x25')](_0x30b160[_0x7065('0x26')]);if(_0x30b160[_0x7065('0x27')]){delete _0x30b160[_0x7065('0x27')];}_0x283f59[_0x7065('0x18')](_0x2d35c7)[_0x7065('0x28')](_0x30b160);};}exports['index']=function(_0x57cc3e,_0x59e383){var _0x5c6fa4={},_0x84b40c={},_0x118781={'count':0x0,'rows':[]};var _0x1ec1a6=_[_0x7065('0x29')](db[_0x7065('0x2a')][_0x7065('0x2b')],function(_0x3fe9bd){return{'name':_0x3fe9bd[_0x7065('0x2c')],'type':_0x3fe9bd[_0x7065('0x2d')][_0x7065('0x2e')]};});_0x84b40c[_0x7065('0x2f')]=_[_0x7065('0x29')](_0x1ec1a6,_0x7065('0x27'));_0x84b40c[_0x7065('0x30')]=_[_0x7065('0x31')](_0x57cc3e[_0x7065('0x30')]);_0x84b40c[_0x7065('0x32')]=_[_0x7065('0x33')](_0x84b40c[_0x7065('0x2f')],_0x84b40c[_0x7065('0x30')]);_0x5c6fa4[_0x7065('0x34')]=_[_0x7065('0x33')](_0x84b40c[_0x7065('0x2f')],qs[_0x7065('0x35')](_0x57cc3e[_0x7065('0x30')]['fields']));_0x5c6fa4[_0x7065('0x34')]=_0x5c6fa4[_0x7065('0x34')]['length']?_0x5c6fa4['attributes']:_0x84b40c[_0x7065('0x2f')];if(!_0x57cc3e[_0x7065('0x30')][_0x7065('0x36')](_0x7065('0x37'))){_0x5c6fa4[_0x7065('0x1d')]=qs[_0x7065('0x1d')](_0x57cc3e[_0x7065('0x30')]['limit']);_0x5c6fa4['offset']=qs[_0x7065('0x1b')](_0x57cc3e[_0x7065('0x30')]['offset']);}_0x5c6fa4[_0x7065('0x38')]=qs['sort'](_0x57cc3e[_0x7065('0x30')]['sort']);_0x5c6fa4[_0x7065('0x39')]=qs[_0x7065('0x32')](_[_0x7065('0x3a')](_0x57cc3e[_0x7065('0x30')],_0x84b40c['filters']),_0x1ec1a6);if(_0x57cc3e[_0x7065('0x30')][_0x7065('0x3b')]){_0x5c6fa4['where']=_[_0x7065('0x3c')](_0x5c6fa4['where'],{'$or':_[_0x7065('0x29')](_0x1ec1a6,function(_0x3fcc21){if(_0x3fcc21[_0x7065('0x2d')]!==_0x7065('0x3d')){var _0xfc5aad={};_0xfc5aad[_0x3fcc21[_0x7065('0x27')]]={'$like':'%'+_0x57cc3e[_0x7065('0x30')]['filter']+'%'};return _0xfc5aad;}})});}_0x5c6fa4=_['merge']({},_0x5c6fa4,_0x57cc3e[_0x7065('0x3e')]);var _0x3d74ed={'where':_0x5c6fa4[_0x7065('0x39')]};return db[_0x7065('0x2a')][_0x7065('0x1e')](_0x3d74ed)[_0x7065('0x23')](function(_0x303241){_0x118781[_0x7065('0x1e')]=_0x303241;if(_0x57cc3e[_0x7065('0x30')][_0x7065('0x3f')]){_0x5c6fa4['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x7065('0x40')](_0x5c6fa4);})[_0x7065('0x23')](function(_0x1f5d3d){_0x118781[_0x7065('0x41')]=_0x1f5d3d;return _0x118781;})[_0x7065('0x23')](respondWithFilteredResult(_0x59e383,_0x5c6fa4))[_0x7065('0x42')](handleError(_0x59e383,null));};exports[_0x7065('0x43')]=function(_0x2ebc45,_0x30fc08){var _0x29d88b={'raw':![],'where':{'id':_0x2ebc45[_0x7065('0x44')]['id']}},_0x32ddb7={};_0x32ddb7['model']=_['keys'](db[_0x7065('0x2a')]['rawAttributes']);_0x32ddb7[_0x7065('0x30')]=_[_0x7065('0x31')](_0x2ebc45[_0x7065('0x30')]);_0x32ddb7[_0x7065('0x32')]=_[_0x7065('0x33')](_0x32ddb7[_0x7065('0x2f')],_0x32ddb7[_0x7065('0x30')]);_0x29d88b[_0x7065('0x34')]=_[_0x7065('0x33')](_0x32ddb7[_0x7065('0x2f')],qs['fields'](_0x2ebc45[_0x7065('0x30')][_0x7065('0x35')]));_0x29d88b[_0x7065('0x34')]=_0x29d88b[_0x7065('0x34')]['length']?_0x29d88b['attributes']:_0x32ddb7[_0x7065('0x2f')];if(_0x2ebc45[_0x7065('0x30')]['includeAll']){_0x29d88b['include']=[{'all':!![]}];}_0x29d88b=_[_0x7065('0x3c')]({},_0x29d88b,_0x2ebc45[_0x7065('0x3e')]);return db[_0x7065('0x2a')][_0x7065('0x45')](_0x29d88b)[_0x7065('0x23')](handleEntityNotFound(_0x30fc08,null))['then'](respondWithResult(_0x30fc08,null))['catch'](handleError(_0x30fc08,null));};exports['create']=function(_0x4e73b1,_0xff116c){return db['Dynamics365Configuration'][_0x7065('0x46')](_0x4e73b1[_0x7065('0x47')],{})[_0x7065('0x23')](respondWithResult(_0xff116c,0xc9))['catch'](handleError(_0xff116c,null));};exports['update']=function(_0x281479,_0x557bc0){if(_0x281479[_0x7065('0x47')]['id']){delete _0x281479[_0x7065('0x47')]['id'];}return db[_0x7065('0x2a')][_0x7065('0x45')]({'where':{'id':_0x281479[_0x7065('0x44')]['id']}})['then'](handleEntityNotFound(_0x557bc0,null))[_0x7065('0x23')](saveUpdates(_0x281479[_0x7065('0x47')],null))[_0x7065('0x23')](respondWithResult(_0x557bc0,null))[_0x7065('0x42')](handleError(_0x557bc0,null));};exports[_0x7065('0x24')]=function(_0x4a703c,_0x3fdffb){return db[_0x7065('0x2a')][_0x7065('0x45')]({'where':{'id':_0x4a703c[_0x7065('0x44')]['id']}})[_0x7065('0x23')](handleEntityNotFound(_0x3fdffb,null))['then'](removeEntity(_0x3fdffb,null))[_0x7065('0x42')](handleError(_0x3fdffb,null));};exports['getFields']=function(_0x1791b5,_0x2b3902,_0x18c45a){var _0x420c7d={};var _0x57729a={};var _0x163237;var _0x1f0f15;return db[_0x7065('0x2a')][_0x7065('0x48')]({'where':{'id':_0x1791b5[_0x7065('0x44')]['id']}})[_0x7065('0x23')](handleEntityNotFound(_0x2b3902,null))[_0x7065('0x23')](function(_0x26fae8){if(_0x26fae8){_0x163237=_0x26fae8;_0x57729a['model']=_[_0x7065('0x31')](db[_0x7065('0x49')][_0x7065('0x2b')]);_0x57729a['query']=_[_0x7065('0x31')](_0x1791b5[_0x7065('0x30')]);_0x57729a[_0x7065('0x32')]=_[_0x7065('0x33')](_0x57729a[_0x7065('0x2f')],_0x57729a['query']);_0x420c7d[_0x7065('0x34')]=_[_0x7065('0x33')](_0x57729a['model'],qs[_0x7065('0x35')](_0x1791b5[_0x7065('0x30')]['fields']));_0x420c7d[_0x7065('0x34')]=_0x420c7d['attributes'][_0x7065('0x4a')]?_0x420c7d['attributes']:_0x57729a['model'];_0x420c7d[_0x7065('0x38')]=qs['sort'](_0x1791b5[_0x7065('0x30')][_0x7065('0x4b')]);_0x420c7d[_0x7065('0x39')]=qs['filters'](_[_0x7065('0x3a')](_0x1791b5['query'],_0x57729a[_0x7065('0x32')]));if(_0x1791b5[_0x7065('0x30')]['filter']){_0x420c7d[_0x7065('0x39')]=_[_0x7065('0x3c')](_0x420c7d[_0x7065('0x39')],{'$or':_[_0x7065('0x29')](_0x420c7d['attributes'],function(_0x273765){var _0x3a127c={};_0x3a127c[_0x273765]={'$like':'%'+_0x1791b5[_0x7065('0x30')][_0x7065('0x3b')]+'%'};return _0x3a127c;})});}_0x420c7d=_[_0x7065('0x3c')]({},_0x420c7d,_0x1791b5[_0x7065('0x3e')]);return _0x163237['getFields'](_0x420c7d);}})[_0x7065('0x23')](function(_0x21bc5c){if(_0x21bc5c){_0x1f0f15=_0x21bc5c['length'];if(!_0x1791b5[_0x7065('0x30')][_0x7065('0x36')]('nolimit')){_0x420c7d[_0x7065('0x1d')]=qs['limit'](_0x1791b5[_0x7065('0x30')][_0x7065('0x1d')]);_0x420c7d['offset']=qs['offset'](_0x1791b5['query']['offset']);}return _0x163237['getFields'](_0x420c7d);}})['then'](function(_0x18adb9){if(_0x18adb9){return _0x18adb9?{'count':_0x1f0f15,'rows':_0x18adb9}:null;}})['then'](respondWithResult(_0x2b3902,null))['catch'](handleError(_0x2b3902,null));};exports['getSubjects']=function(_0x3babf1,_0x29dd86,_0x28fb86){var _0xa8a697={};var _0x49782e={};var _0x5b0676;var _0x3c3588;return db['Dynamics365Configuration'][_0x7065('0x48')]({'where':{'id':_0x3babf1[_0x7065('0x44')]['id']}})[_0x7065('0x23')](handleEntityNotFound(_0x29dd86,null))[_0x7065('0x23')](function(_0x5ae5ec){if(_0x5ae5ec){_0x5b0676=_0x5ae5ec;_0x49782e[_0x7065('0x2f')]=_[_0x7065('0x31')](db[_0x7065('0x49')][_0x7065('0x2b')]);_0x49782e[_0x7065('0x30')]=_[_0x7065('0x31')](_0x3babf1[_0x7065('0x30')]);_0x49782e[_0x7065('0x32')]=_[_0x7065('0x33')](_0x49782e['model'],_0x49782e['query']);_0xa8a697['attributes']=_[_0x7065('0x33')](_0x49782e[_0x7065('0x2f')],qs[_0x7065('0x35')](_0x3babf1[_0x7065('0x30')][_0x7065('0x35')]));_0xa8a697[_0x7065('0x34')]=_0xa8a697[_0x7065('0x34')][_0x7065('0x4a')]?_0xa8a697[_0x7065('0x34')]:_0x49782e['model'];_0xa8a697[_0x7065('0x38')]=qs[_0x7065('0x4b')](_0x3babf1[_0x7065('0x30')][_0x7065('0x4b')]);_0xa8a697[_0x7065('0x39')]=qs[_0x7065('0x32')](_['pick'](_0x3babf1[_0x7065('0x30')],_0x49782e[_0x7065('0x32')]));if(_0x3babf1[_0x7065('0x30')][_0x7065('0x3b')]){_0xa8a697[_0x7065('0x39')]=_[_0x7065('0x3c')](_0xa8a697['where'],{'$or':_['map'](_0xa8a697['attributes'],function(_0x498c1f){var _0x31b498={};_0x31b498[_0x498c1f]={'$like':'%'+_0x3babf1[_0x7065('0x30')][_0x7065('0x3b')]+'%'};return _0x31b498;})});}_0xa8a697=_[_0x7065('0x3c')]({},_0xa8a697,_0x3babf1[_0x7065('0x3e')]);return _0x5b0676[_0x7065('0x4c')](_0xa8a697);}})[_0x7065('0x23')](function(_0x1dbade){if(_0x1dbade){_0x3c3588=_0x1dbade['length'];if(!_0x3babf1[_0x7065('0x30')][_0x7065('0x36')](_0x7065('0x37'))){_0xa8a697['limit']=qs['limit'](_0x3babf1['query'][_0x7065('0x1d')]);_0xa8a697['offset']=qs[_0x7065('0x1b')](_0x3babf1['query'][_0x7065('0x1b')]);}return _0x5b0676[_0x7065('0x4c')](_0xa8a697);}})['then'](function(_0x2cc290){if(_0x2cc290){return _0x2cc290?{'count':_0x3c3588,'rows':_0x2cc290}:null;}})[_0x7065('0x23')](respondWithResult(_0x29dd86,null))[_0x7065('0x42')](handleError(_0x29dd86,null));};exports[_0x7065('0x4d')]=function(_0x3dbe77,_0x40d103,_0x3b9f0f){var _0x27fe83={};var _0x7c0d86={};var _0x31b9fc;var _0x4fb8ef;return db[_0x7065('0x2a')][_0x7065('0x48')]({'where':{'id':_0x3dbe77['params']['id']}})[_0x7065('0x23')](handleEntityNotFound(_0x40d103,null))['then'](function(_0x26e373){if(_0x26e373){_0x31b9fc=_0x26e373;_0x7c0d86[_0x7065('0x2f')]=_[_0x7065('0x31')](db[_0x7065('0x49')][_0x7065('0x2b')]);_0x7c0d86[_0x7065('0x30')]=_['keys'](_0x3dbe77[_0x7065('0x30')]);_0x7c0d86['filters']=_[_0x7065('0x33')](_0x7c0d86[_0x7065('0x2f')],_0x7c0d86[_0x7065('0x30')]);_0x27fe83['attributes']=_[_0x7065('0x33')](_0x7c0d86[_0x7065('0x2f')],qs[_0x7065('0x35')](_0x3dbe77[_0x7065('0x30')][_0x7065('0x35')]));_0x27fe83['attributes']=_0x27fe83[_0x7065('0x34')][_0x7065('0x4a')]?_0x27fe83[_0x7065('0x34')]:_0x7c0d86['model'];_0x27fe83[_0x7065('0x38')]=qs[_0x7065('0x4b')](_0x3dbe77['query'][_0x7065('0x4b')]);_0x27fe83[_0x7065('0x39')]=qs[_0x7065('0x32')](_['pick'](_0x3dbe77[_0x7065('0x30')],_0x7c0d86[_0x7065('0x32')]));if(_0x3dbe77[_0x7065('0x30')][_0x7065('0x3b')]){_0x27fe83['where']=_['merge'](_0x27fe83[_0x7065('0x39')],{'$or':_[_0x7065('0x29')](_0x27fe83['attributes'],function(_0x1ccfd1){var _0x231b60={};_0x231b60[_0x1ccfd1]={'$like':'%'+_0x3dbe77[_0x7065('0x30')][_0x7065('0x3b')]+'%'};return _0x231b60;})});}_0x27fe83=_['merge']({},_0x27fe83,_0x3dbe77['options']);return _0x31b9fc[_0x7065('0x4d')](_0x27fe83);}})[_0x7065('0x23')](function(_0x10c3d8){if(_0x10c3d8){_0x4fb8ef=_0x10c3d8['length'];if(!_0x3dbe77[_0x7065('0x30')][_0x7065('0x36')](_0x7065('0x37'))){_0x27fe83['limit']=qs[_0x7065('0x1d')](_0x3dbe77[_0x7065('0x30')][_0x7065('0x1d')]);_0x27fe83['offset']=qs['offset'](_0x3dbe77['query'][_0x7065('0x1b')]);}return _0x31b9fc[_0x7065('0x4d')](_0x27fe83);}})[_0x7065('0x23')](function(_0x51bee3){if(_0x51bee3){return _0x51bee3?{'count':_0x4fb8ef,'rows':_0x51bee3}:null;}})[_0x7065('0x23')](respondWithResult(_0x40d103,null))['catch'](handleError(_0x40d103,null));}; \ No newline at end of file +var _0xca4b=['reject','save','update','then','destroy','error','stack','name','index','Dynamics365Configuration','fieldName','type','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','params','rawAttributes','filters','find','create','body','findOne','getFields','catch','Dynamics365Field','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x48d4c6,_0x326707){var _0x26e486=function(_0x2eb8e8){while(--_0x2eb8e8){_0x48d4c6['push'](_0x48d4c6['shift']());}};_0x26e486(++_0x326707);}(_0xca4b,0xc8));var _0xbca4=function(_0x2cb153,_0x3ce02a){_0x2cb153=_0x2cb153-0x0;var _0x4265a6=_0xca4b[_0x2cb153];return _0x4265a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbca4('0x0'));var zipdir=require(_0xbca4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbca4('0x2'));var moment=require('moment');var BPromise=require(_0xbca4('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbca4('0x4'));var sox=require('sox');var csv=require(_0xbca4('0x5'));var ejs=require(_0xbca4('0x6'));var fs=require('fs');var fs_extra=require(_0xbca4('0x7'));var _=require(_0xbca4('0x8'));var squel=require('squel');var crypto=require(_0xbca4('0x9'));var jsforce=require(_0xbca4('0xa'));var deskjs=require(_0xbca4('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbca4('0xc'));var Papa=require(_0xbca4('0xd'));var Redis=require(_0xbca4('0xe'));var authService=require(_0xbca4('0xf'));var qs=require(_0xbca4('0x10'));var as=require(_0xbca4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbca4('0x12'))(_0xbca4('0x13'));var utils=require(_0xbca4('0x14'));var config=require(_0xbca4('0x15'));var licenseUtil=require(_0xbca4('0x16'));var db=require(_0xbca4('0x17'))['db'];function respondWithStatusCode(_0x3512e6,_0x52d682){_0x52d682=_0x52d682||0xcc;return function(_0x520f89){if(_0x520f89){return _0x3512e6['sendStatus'](_0x52d682);}return _0x3512e6[_0xbca4('0x18')](_0x52d682)[_0xbca4('0x19')]();};}function respondWithResult(_0x18685a,_0x1ccc28){_0x1ccc28=_0x1ccc28||0xc8;return function(_0x5da1d8){if(_0x5da1d8){return _0x18685a[_0xbca4('0x18')](_0x1ccc28)[_0xbca4('0x1a')](_0x5da1d8);}};}function respondWithFilteredResult(_0x4531a5,_0x4e2537){return function(_0x69fb68){if(_0x69fb68){var _0x226a1d=typeof _0x4e2537[_0xbca4('0x1b')]===_0xbca4('0x1c')&&typeof _0x4e2537[_0xbca4('0x1d')]===_0xbca4('0x1c');var _0x4dd971=_0x69fb68['count'];var _0xb717c4=_0x226a1d?0x0:_0x4e2537['offset'];var _0x1683d9=_0x226a1d?_0x69fb68[_0xbca4('0x1e')]:_0x4e2537[_0xbca4('0x1b')]+_0x4e2537[_0xbca4('0x1d')];var _0x295823;if(_0x1683d9>=_0x4dd971){_0x1683d9=_0x4dd971;_0x295823=0xc8;}else{_0x295823=0xce;}_0x4531a5[_0xbca4('0x18')](_0x295823);return _0x4531a5[_0xbca4('0x1f')](_0xbca4('0x20'),_0xb717c4+'-'+_0x1683d9+'/'+_0x4dd971)[_0xbca4('0x1a')](_0x69fb68);}return null;};}function patchUpdates(_0x40c8d9){return function(_0x5f0f9d){try{jsonpatch[_0xbca4('0x21')](_0x5f0f9d,_0x40c8d9,!![]);}catch(_0x21bd9e){return BPromise[_0xbca4('0x22')](_0x21bd9e);}return _0x5f0f9d[_0xbca4('0x23')]();};}function saveUpdates(_0x9afe8c,_0x31d0c3){return function(_0x324376){if(_0x324376){return _0x324376[_0xbca4('0x24')](_0x9afe8c)[_0xbca4('0x25')](function(_0x549f1b){return _0x549f1b;});}return null;};}function removeEntity(_0x59ffcd,_0x319f8f){return function(_0x34639b){if(_0x34639b){return _0x34639b[_0xbca4('0x26')]()[_0xbca4('0x25')](function(){_0x59ffcd[_0xbca4('0x18')](0xcc)[_0xbca4('0x19')]();});}};}function handleEntityNotFound(_0x45161c,_0x40b9d0){return function(_0x338d9e){if(!_0x338d9e){_0x45161c['sendStatus'](0x194);}return _0x338d9e;};}function handleError(_0x3542f4,_0x538921){_0x538921=_0x538921||0x1f4;return function(_0x216988){logger[_0xbca4('0x27')](_0x216988[_0xbca4('0x28')]);if(_0x216988[_0xbca4('0x29')]){delete _0x216988['name'];}_0x3542f4[_0xbca4('0x18')](_0x538921)['send'](_0x216988);};}exports[_0xbca4('0x2a')]=function(_0x31ff00,_0x49f537){var _0x23fe4f={},_0x36b3d3={},_0x1a1878={'count':0x0,'rows':[]};var _0x1e986b=_['map'](db[_0xbca4('0x2b')]['rawAttributes'],function(_0x11ebd7){return{'name':_0x11ebd7[_0xbca4('0x2c')],'type':_0x11ebd7[_0xbca4('0x2d')]['key']};});_0x36b3d3['model']=_[_0xbca4('0x2e')](_0x1e986b,_0xbca4('0x29'));_0x36b3d3[_0xbca4('0x2f')]=_[_0xbca4('0x30')](_0x31ff00[_0xbca4('0x2f')]);_0x36b3d3['filters']=_['intersection'](_0x36b3d3[_0xbca4('0x31')],_0x36b3d3['query']);_0x23fe4f[_0xbca4('0x32')]=_[_0xbca4('0x33')](_0x36b3d3[_0xbca4('0x31')],qs[_0xbca4('0x34')](_0x31ff00[_0xbca4('0x2f')][_0xbca4('0x34')]));_0x23fe4f['attributes']=_0x23fe4f[_0xbca4('0x32')][_0xbca4('0x35')]?_0x23fe4f[_0xbca4('0x32')]:_0x36b3d3[_0xbca4('0x31')];if(!_0x31ff00[_0xbca4('0x2f')][_0xbca4('0x36')](_0xbca4('0x37'))){_0x23fe4f[_0xbca4('0x1d')]=qs[_0xbca4('0x1d')](_0x31ff00[_0xbca4('0x2f')][_0xbca4('0x1d')]);_0x23fe4f[_0xbca4('0x1b')]=qs['offset'](_0x31ff00[_0xbca4('0x2f')]['offset']);}_0x23fe4f[_0xbca4('0x38')]=qs[_0xbca4('0x39')](_0x31ff00[_0xbca4('0x2f')][_0xbca4('0x39')]);_0x23fe4f[_0xbca4('0x3a')]=qs['filters'](_[_0xbca4('0x3b')](_0x31ff00['query'],_0x36b3d3['filters']),_0x1e986b);if(_0x31ff00[_0xbca4('0x2f')][_0xbca4('0x3c')]){_0x23fe4f['where']=_['merge'](_0x23fe4f[_0xbca4('0x3a')],{'$or':_['map'](_0x1e986b,function(_0x5425db){if(_0x5425db[_0xbca4('0x2d')]!=='VIRTUAL'){var _0x2f32c6={};_0x2f32c6[_0x5425db[_0xbca4('0x29')]]={'$like':'%'+_0x31ff00[_0xbca4('0x2f')][_0xbca4('0x3c')]+'%'};return _0x2f32c6;}})});}_0x23fe4f=_[_0xbca4('0x3d')]({},_0x23fe4f,_0x31ff00[_0xbca4('0x3e')]);var _0x1479a8={'where':_0x23fe4f[_0xbca4('0x3a')]};return db[_0xbca4('0x2b')][_0xbca4('0x1e')](_0x1479a8)[_0xbca4('0x25')](function(_0x35a7a7){_0x1a1878[_0xbca4('0x1e')]=_0x35a7a7;if(_0x31ff00['query'][_0xbca4('0x3f')]){_0x23fe4f[_0xbca4('0x40')]=[{'all':!![]}];}return db[_0xbca4('0x2b')][_0xbca4('0x41')](_0x23fe4f);})[_0xbca4('0x25')](function(_0x3873a6){_0x1a1878['rows']=_0x3873a6;return _0x1a1878;})['then'](respondWithFilteredResult(_0x49f537,_0x23fe4f))['catch'](handleError(_0x49f537,null));};exports['show']=function(_0x255f6b,_0x11365e){var _0x258b8b={'raw':![],'where':{'id':_0x255f6b[_0xbca4('0x42')]['id']}},_0xdded8e={};_0xdded8e[_0xbca4('0x31')]=_[_0xbca4('0x30')](db[_0xbca4('0x2b')][_0xbca4('0x43')]);_0xdded8e[_0xbca4('0x2f')]=_[_0xbca4('0x30')](_0x255f6b['query']);_0xdded8e[_0xbca4('0x44')]=_[_0xbca4('0x33')](_0xdded8e[_0xbca4('0x31')],_0xdded8e[_0xbca4('0x2f')]);_0x258b8b[_0xbca4('0x32')]=_[_0xbca4('0x33')](_0xdded8e[_0xbca4('0x31')],qs[_0xbca4('0x34')](_0x255f6b['query'][_0xbca4('0x34')]));_0x258b8b['attributes']=_0x258b8b['attributes'][_0xbca4('0x35')]?_0x258b8b[_0xbca4('0x32')]:_0xdded8e['model'];if(_0x255f6b[_0xbca4('0x2f')][_0xbca4('0x3f')]){_0x258b8b[_0xbca4('0x40')]=[{'all':!![]}];}_0x258b8b=_[_0xbca4('0x3d')]({},_0x258b8b,_0x255f6b[_0xbca4('0x3e')]);return db[_0xbca4('0x2b')][_0xbca4('0x45')](_0x258b8b)[_0xbca4('0x25')](handleEntityNotFound(_0x11365e,null))[_0xbca4('0x25')](respondWithResult(_0x11365e,null))['catch'](handleError(_0x11365e,null));};exports[_0xbca4('0x46')]=function(_0x12ff36,_0x1cbfca){return db[_0xbca4('0x2b')][_0xbca4('0x46')](_0x12ff36[_0xbca4('0x47')],{})[_0xbca4('0x25')](respondWithResult(_0x1cbfca,0xc9))['catch'](handleError(_0x1cbfca,null));};exports['update']=function(_0x1031b5,_0x304096){if(_0x1031b5[_0xbca4('0x47')]['id']){delete _0x1031b5[_0xbca4('0x47')]['id'];}return db[_0xbca4('0x2b')][_0xbca4('0x45')]({'where':{'id':_0x1031b5[_0xbca4('0x42')]['id']}})['then'](handleEntityNotFound(_0x304096,null))['then'](saveUpdates(_0x1031b5['body'],null))['then'](respondWithResult(_0x304096,null))['catch'](handleError(_0x304096,null));};exports[_0xbca4('0x26')]=function(_0x403bd9,_0x48bbf0){return db[_0xbca4('0x2b')][_0xbca4('0x45')]({'where':{'id':_0x403bd9[_0xbca4('0x42')]['id']}})[_0xbca4('0x25')](handleEntityNotFound(_0x48bbf0,null))[_0xbca4('0x25')](removeEntity(_0x48bbf0,null))['catch'](handleError(_0x48bbf0,null));};exports['getFields']=function(_0x324b9d,_0x48cf71,_0x560995){var _0x2d2a12={};var _0x5d1a47={};var _0x515c2e;var _0x505780;return db[_0xbca4('0x2b')][_0xbca4('0x48')]({'where':{'id':_0x324b9d['params']['id']}})[_0xbca4('0x25')](handleEntityNotFound(_0x48cf71,null))[_0xbca4('0x25')](function(_0x3b9c38){if(_0x3b9c38){_0x515c2e=_0x3b9c38;_0x5d1a47[_0xbca4('0x31')]=_['keys'](db['Dynamics365Field'][_0xbca4('0x43')]);_0x5d1a47[_0xbca4('0x2f')]=_[_0xbca4('0x30')](_0x324b9d[_0xbca4('0x2f')]);_0x5d1a47['filters']=_[_0xbca4('0x33')](_0x5d1a47[_0xbca4('0x31')],_0x5d1a47[_0xbca4('0x2f')]);_0x2d2a12['attributes']=_['intersection'](_0x5d1a47[_0xbca4('0x31')],qs[_0xbca4('0x34')](_0x324b9d[_0xbca4('0x2f')][_0xbca4('0x34')]));_0x2d2a12[_0xbca4('0x32')]=_0x2d2a12[_0xbca4('0x32')]['length']?_0x2d2a12['attributes']:_0x5d1a47['model'];_0x2d2a12['order']=qs[_0xbca4('0x39')](_0x324b9d[_0xbca4('0x2f')][_0xbca4('0x39')]);_0x2d2a12[_0xbca4('0x3a')]=qs['filters'](_[_0xbca4('0x3b')](_0x324b9d[_0xbca4('0x2f')],_0x5d1a47[_0xbca4('0x44')]));if(_0x324b9d['query'][_0xbca4('0x3c')]){_0x2d2a12[_0xbca4('0x3a')]=_[_0xbca4('0x3d')](_0x2d2a12[_0xbca4('0x3a')],{'$or':_[_0xbca4('0x2e')](_0x2d2a12[_0xbca4('0x32')],function(_0x4f21e0){var _0x30dfb3={};_0x30dfb3[_0x4f21e0]={'$like':'%'+_0x324b9d[_0xbca4('0x2f')][_0xbca4('0x3c')]+'%'};return _0x30dfb3;})});}_0x2d2a12=_[_0xbca4('0x3d')]({},_0x2d2a12,_0x324b9d[_0xbca4('0x3e')]);return _0x515c2e[_0xbca4('0x49')](_0x2d2a12);}})[_0xbca4('0x25')](function(_0x10c8cc){if(_0x10c8cc){_0x505780=_0x10c8cc[_0xbca4('0x35')];if(!_0x324b9d[_0xbca4('0x2f')][_0xbca4('0x36')](_0xbca4('0x37'))){_0x2d2a12[_0xbca4('0x1d')]=qs[_0xbca4('0x1d')](_0x324b9d[_0xbca4('0x2f')][_0xbca4('0x1d')]);_0x2d2a12['offset']=qs[_0xbca4('0x1b')](_0x324b9d['query'][_0xbca4('0x1b')]);}return _0x515c2e[_0xbca4('0x49')](_0x2d2a12);}})[_0xbca4('0x25')](function(_0xd19fe5){if(_0xd19fe5){return _0xd19fe5?{'count':_0x505780,'rows':_0xd19fe5}:null;}})[_0xbca4('0x25')](respondWithResult(_0x48cf71,null))[_0xbca4('0x4a')](handleError(_0x48cf71,null));};exports['getSubjects']=function(_0x97b580,_0x52a718,_0x45c19e){var _0x20e20d={};var _0x3c1bc9={};var _0x5a9359;var _0x2b74b2;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x97b580[_0xbca4('0x42')]['id']}})[_0xbca4('0x25')](handleEntityNotFound(_0x52a718,null))[_0xbca4('0x25')](function(_0x3d7868){if(_0x3d7868){_0x5a9359=_0x3d7868;_0x3c1bc9[_0xbca4('0x31')]=_[_0xbca4('0x30')](db[_0xbca4('0x4b')][_0xbca4('0x43')]);_0x3c1bc9['query']=_[_0xbca4('0x30')](_0x97b580[_0xbca4('0x2f')]);_0x3c1bc9[_0xbca4('0x44')]=_[_0xbca4('0x33')](_0x3c1bc9[_0xbca4('0x31')],_0x3c1bc9[_0xbca4('0x2f')]);_0x20e20d[_0xbca4('0x32')]=_['intersection'](_0x3c1bc9[_0xbca4('0x31')],qs[_0xbca4('0x34')](_0x97b580[_0xbca4('0x2f')][_0xbca4('0x34')]));_0x20e20d[_0xbca4('0x32')]=_0x20e20d[_0xbca4('0x32')][_0xbca4('0x35')]?_0x20e20d['attributes']:_0x3c1bc9[_0xbca4('0x31')];_0x20e20d[_0xbca4('0x38')]=qs[_0xbca4('0x39')](_0x97b580[_0xbca4('0x2f')][_0xbca4('0x39')]);_0x20e20d[_0xbca4('0x3a')]=qs[_0xbca4('0x44')](_[_0xbca4('0x3b')](_0x97b580[_0xbca4('0x2f')],_0x3c1bc9['filters']));if(_0x97b580[_0xbca4('0x2f')][_0xbca4('0x3c')]){_0x20e20d[_0xbca4('0x3a')]=_[_0xbca4('0x3d')](_0x20e20d[_0xbca4('0x3a')],{'$or':_[_0xbca4('0x2e')](_0x20e20d[_0xbca4('0x32')],function(_0xf2a342){var _0x3b2f2b={};_0x3b2f2b[_0xf2a342]={'$like':'%'+_0x97b580[_0xbca4('0x2f')][_0xbca4('0x3c')]+'%'};return _0x3b2f2b;})});}_0x20e20d=_[_0xbca4('0x3d')]({},_0x20e20d,_0x97b580[_0xbca4('0x3e')]);return _0x5a9359[_0xbca4('0x4c')](_0x20e20d);}})[_0xbca4('0x25')](function(_0x119999){if(_0x119999){_0x2b74b2=_0x119999['length'];if(!_0x97b580[_0xbca4('0x2f')][_0xbca4('0x36')](_0xbca4('0x37'))){_0x20e20d[_0xbca4('0x1d')]=qs[_0xbca4('0x1d')](_0x97b580[_0xbca4('0x2f')][_0xbca4('0x1d')]);_0x20e20d['offset']=qs[_0xbca4('0x1b')](_0x97b580[_0xbca4('0x2f')]['offset']);}return _0x5a9359[_0xbca4('0x4c')](_0x20e20d);}})[_0xbca4('0x25')](function(_0x26dece){if(_0x26dece){return _0x26dece?{'count':_0x2b74b2,'rows':_0x26dece}:null;}})[_0xbca4('0x25')](respondWithResult(_0x52a718,null))['catch'](handleError(_0x52a718,null));};exports['getDescriptions']=function(_0x191eb7,_0x37e0c5,_0x4a0195){var _0x4d01fe={};var _0x3f5fee={};var _0x58e4bd;var _0x3fd395;return db[_0xbca4('0x2b')][_0xbca4('0x48')]({'where':{'id':_0x191eb7[_0xbca4('0x42')]['id']}})[_0xbca4('0x25')](handleEntityNotFound(_0x37e0c5,null))[_0xbca4('0x25')](function(_0x528ba3){if(_0x528ba3){_0x58e4bd=_0x528ba3;_0x3f5fee[_0xbca4('0x31')]=_[_0xbca4('0x30')](db[_0xbca4('0x4b')]['rawAttributes']);_0x3f5fee[_0xbca4('0x2f')]=_['keys'](_0x191eb7[_0xbca4('0x2f')]);_0x3f5fee['filters']=_[_0xbca4('0x33')](_0x3f5fee['model'],_0x3f5fee[_0xbca4('0x2f')]);_0x4d01fe[_0xbca4('0x32')]=_['intersection'](_0x3f5fee[_0xbca4('0x31')],qs['fields'](_0x191eb7[_0xbca4('0x2f')][_0xbca4('0x34')]));_0x4d01fe[_0xbca4('0x32')]=_0x4d01fe[_0xbca4('0x32')][_0xbca4('0x35')]?_0x4d01fe[_0xbca4('0x32')]:_0x3f5fee[_0xbca4('0x31')];_0x4d01fe[_0xbca4('0x38')]=qs[_0xbca4('0x39')](_0x191eb7[_0xbca4('0x2f')][_0xbca4('0x39')]);_0x4d01fe[_0xbca4('0x3a')]=qs[_0xbca4('0x44')](_[_0xbca4('0x3b')](_0x191eb7[_0xbca4('0x2f')],_0x3f5fee[_0xbca4('0x44')]));if(_0x191eb7[_0xbca4('0x2f')][_0xbca4('0x3c')]){_0x4d01fe[_0xbca4('0x3a')]=_[_0xbca4('0x3d')](_0x4d01fe[_0xbca4('0x3a')],{'$or':_[_0xbca4('0x2e')](_0x4d01fe['attributes'],function(_0x599933){var _0x21ce61={};_0x21ce61[_0x599933]={'$like':'%'+_0x191eb7['query'][_0xbca4('0x3c')]+'%'};return _0x21ce61;})});}_0x4d01fe=_[_0xbca4('0x3d')]({},_0x4d01fe,_0x191eb7['options']);return _0x58e4bd[_0xbca4('0x4d')](_0x4d01fe);}})['then'](function(_0x3e0c27){if(_0x3e0c27){_0x3fd395=_0x3e0c27['length'];if(!_0x191eb7[_0xbca4('0x2f')][_0xbca4('0x36')]('nolimit')){_0x4d01fe[_0xbca4('0x1d')]=qs[_0xbca4('0x1d')](_0x191eb7['query'][_0xbca4('0x1d')]);_0x4d01fe[_0xbca4('0x1b')]=qs[_0xbca4('0x1b')](_0x191eb7['query'][_0xbca4('0x1b')]);}return _0x58e4bd[_0xbca4('0x4d')](_0x4d01fe);}})['then'](function(_0x43dcb4){if(_0x43dcb4){return _0x43dcb4?{'count':_0x3fd395,'rows':_0x43dcb4}:null;}})['then'](respondWithResult(_0x37e0c5,null))['catch'](handleError(_0x37e0c5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ea97555..04713d6 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0xcb9553,_0x44e01c){var _0x5f0b7d=function(_0x50bcad){while(--_0x50bcad){_0xcb9553['push'](_0xcb9553['shift']());}};_0x5f0b7d(++_0x44e01c);}(_0xedd9,0xfc));var _0x9edd=function(_0x19ef9c,_0x1965d6){_0x19ef9c=_0x19ef9c-0x0;var _0x1fa6df=_0xedd9[_0x19ef9c];return _0x1fa6df;};'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':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x440237,_0x8fcab3){_0x440237=_0x440237-0x0;var _0x32ba00=_0x6f0d[_0x440237];return _0x32ba00;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 78ec5eb..610aaa1 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 _0x22d7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x32bd25,_0x5a449a){var _0x27a2e7=function(_0x2581f6){while(--_0x2581f6){_0x32bd25['push'](_0x32bd25['shift']());}};_0x27a2e7(++_0x5a449a);}(_0x22d7,0x15b));var _0x722d=function(_0x25e995,_0x143cdc){_0x25e995=_0x25e995-0x0;var _0x446a58=_0x22d7[_0x25e995];return _0x446a58;};'use strict';var _=require(_0x722d('0x0'));var util=require(_0x722d('0x1'));var moment=require('moment');var BPromise=require(_0x722d('0x2'));var rs=require(_0x722d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x722d('0x4'))['db'];var utils=require(_0x722d('0x5'));var logger=require(_0x722d('0x6'))(_0x722d('0x7'));var config=require(_0x722d('0x8'));var jayson=require(_0x722d('0x9'));var client=jayson[_0x722d('0xa')][_0x722d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2725c2,_0x36fd39,_0x16591d){return new BPromise(function(_0x20150b,_0x728b7e){return client[_0x722d('0xc')](_0x2725c2,_0x16591d)['then'](function(_0x28b791){logger[_0x722d('0xd')](_0x722d('0xe'),_0x36fd39,_0x722d('0xf'));logger[_0x722d('0x10')](_0x722d('0x11'),_0x36fd39,_0x722d('0xf'),JSON['stringify'](_0x28b791));if(_0x28b791[_0x722d('0x12')]){if(_0x28b791[_0x722d('0x12')][_0x722d('0x13')]===0x1f4){logger[_0x722d('0x12')](_0x722d('0xe'),_0x36fd39,_0x28b791[_0x722d('0x12')]['message']);return _0x728b7e(_0x28b791['error'][_0x722d('0x14')]);}logger['error'](_0x722d('0xe'),_0x36fd39,_0x28b791[_0x722d('0x12')][_0x722d('0x14')]);return _0x20150b(_0x28b791[_0x722d('0x12')][_0x722d('0x14')]);}else{logger[_0x722d('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x36fd39,_0x722d('0xf'));_0x20150b(_0x28b791['result'][_0x722d('0x14')]);}})[_0x722d('0x15')](function(_0x524a2d){logger['error'](_0x722d('0xe'),_0x36fd39,_0x524a2d);_0x728b7e(_0x524a2d);});});} \ No newline at end of file +var _0x74e6=['../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2bf6be,_0x5b23f1){var _0x532ef4=function(_0x3760df){while(--_0x3760df){_0x2bf6be['push'](_0x2bf6be['shift']());}};_0x532ef4(++_0x5b23f1);}(_0x74e6,0x189));var _0x674e=function(_0x753400,_0x26ef10){_0x753400=_0x753400-0x0;var _0x43e1ba=_0x74e6[_0x753400];return _0x43e1ba;};'use strict';var _=require('lodash');var util=require(_0x674e('0x0'));var moment=require('moment');var BPromise=require(_0x674e('0x1'));var rs=require(_0x674e('0x2'));var fs=require('fs');var Redis=require(_0x674e('0x3'));var db=require(_0x674e('0x4'))['db'];var utils=require(_0x674e('0x5'));var logger=require(_0x674e('0x6'))(_0x674e('0x7'));var config=require(_0x674e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8eb752,_0x4edf61,_0x5a1e7a){return new BPromise(function(_0x8b520c,_0x51bd1b){return client[_0x674e('0x9')](_0x8eb752,_0x5a1e7a)[_0x674e('0xa')](function(_0x582cbb){logger[_0x674e('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4edf61,_0x674e('0xc'));logger['debug'](_0x674e('0xd'),_0x4edf61,_0x674e('0xc'),JSON[_0x674e('0xe')](_0x582cbb));if(_0x582cbb[_0x674e('0xf')]){if(_0x582cbb[_0x674e('0xf')][_0x674e('0x10')]===0x1f4){logger[_0x674e('0xf')](_0x674e('0x11'),_0x4edf61,_0x582cbb[_0x674e('0xf')][_0x674e('0x12')]);return _0x51bd1b(_0x582cbb['error'][_0x674e('0x12')]);}logger[_0x674e('0xf')](_0x674e('0x11'),_0x4edf61,_0x582cbb['error']['message']);return _0x8b520c(_0x582cbb[_0x674e('0xf')]['message']);}else{logger[_0x674e('0xb')](_0x674e('0x11'),_0x4edf61,_0x674e('0xc'));_0x8b520c(_0x582cbb[_0x674e('0x13')][_0x674e('0x12')]);}})[_0x674e('0x14')](function(_0x44d5c7){logger['error'](_0x674e('0x11'),_0x4edf61,_0x44d5c7);_0x51bd1b(_0x44d5c7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4625a22..a7d523c 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 _0xe420=['fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5e7fe0,_0x48f825){var _0x4a38d6=function(_0x1d5a28){while(--_0x1d5a28){_0x5e7fe0['push'](_0x5e7fe0['shift']());}};_0x4a38d6(++_0x48f825);}(_0xe420,0x1c8));var _0x0e42=function(_0x245455,_0x3334ad){_0x245455=_0x245455-0x0;var _0x46264b=_0xe420[_0x245455];return _0x46264b;};'use strict';var multer=require(_0x0e42('0x0'));var util=require(_0x0e42('0x1'));var path=require(_0x0e42('0x2'));var timeout=require(_0x0e42('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0e42('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0e42('0x5'));var config=require(_0x0e42('0x6'));var controller=require(_0x0e42('0x7'));router[_0x0e42('0x8')]('/',auth[_0x0e42('0x9')](),controller[_0x0e42('0xa')]);router[_0x0e42('0x8')](_0x0e42('0xb'),auth[_0x0e42('0x9')](),controller[_0x0e42('0xc')]);router[_0x0e42('0xd')]('/',auth[_0x0e42('0x9')](),controller[_0x0e42('0xe')]);router[_0x0e42('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0e42('0x10')]);router[_0x0e42('0x11')](_0x0e42('0xb'),auth[_0x0e42('0x9')](),controller[_0x0e42('0x12')]);module[_0x0e42('0x13')]=router; \ No newline at end of file +var _0x748d=['put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x748d,0x103));var _0xd748=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x748d[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xd748('0x0'));var util=require(_0xd748('0x1'));var path=require('path');var timeout=require(_0xd748('0x2'));var express=require('express');var router=express[_0xd748('0x3')]();var fs_extra=require(_0xd748('0x4'));var auth=require(_0xd748('0x5'));var interaction=require(_0xd748('0x6'));var config=require(_0xd748('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xd748('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd748('0x8')]('/:id',auth[_0xd748('0x9')](),controller[_0xd748('0xa')]);router[_0xd748('0xb')]('/',auth[_0xd748('0x9')](),controller[_0xd748('0xc')]);router[_0xd748('0xd')]('/:id',auth[_0xd748('0x9')](),controller[_0xd748('0xe')]);router['delete']('/:id',auth[_0xd748('0x9')](),controller[_0xd748('0xf')]);module[_0xd748('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 34b4ff7..7d67585 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 _0xe301=['keyValue','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xe301,0x18a));var _0x1e30=function(_0x2506d6,_0x4a8e7e){_0x2506d6=_0x2506d6-0x0;var _0x2907ae=_0xe301[_0x2506d6];return _0x2907ae;};'use strict';var Sequelize=require(_0x1e30('0x0'));module[_0x1e30('0x1')]={'type':{'type':Sequelize[_0x1e30('0x2')](_0x1e30('0x3'),_0x1e30('0x4'),_0x1e30('0x5'),_0x1e30('0x6'),'picklist'),'defaultValue':_0x1e30('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1e30('0x3'),_0x1e30('0x4'),_0x1e30('0x5'))},'keyContent':{'type':Sequelize[_0x1e30('0x7')]},'idField':{'type':Sequelize[_0x1e30('0x7')]},'nameField':{'type':Sequelize[_0x1e30('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1e30('0x7')]}}; \ No newline at end of file +var _0x5dc8=['keyValue','picklist','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x3ba765,_0x20fe44){var _0x4d499e=function(_0x543452){while(--_0x543452){_0x3ba765['push'](_0x3ba765['shift']());}};_0x4d499e(++_0x20fe44);}(_0x5dc8,0x91));var _0x85dc=function(_0xf1b134,_0xb399dd){_0xf1b134=_0xf1b134-0x0;var _0x139dbb=_0x5dc8[_0xf1b134];return _0x139dbb;};'use strict';var Sequelize=require(_0x85dc('0x0'));module[_0x85dc('0x1')]={'type':{'type':Sequelize[_0x85dc('0x2')]('string',_0x85dc('0x3'),_0x85dc('0x4'),_0x85dc('0x5'),_0x85dc('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x85dc('0x7')]},'keyType':{'type':Sequelize[_0x85dc('0x2')](_0x85dc('0x8'),_0x85dc('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x85dc('0x7')]},'idField':{'type':Sequelize[_0x85dc('0x7')]},'nameField':{'type':Sequelize[_0x85dc('0x7')]},'customField':{'type':Sequelize[_0x85dc('0x9')],'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 ea74b41..35eacfe 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 _0xed6e=['status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','includeAll','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4ff138,_0x3b736d){var _0x3856b0=function(_0x59f0bb){while(--_0x59f0bb){_0x4ff138['push'](_0x4ff138['shift']());}};_0x3856b0(++_0x3b736d);}(_0xed6e,0xc7));var _0xeed6=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0xed6e[_0x9cfe28];return _0x54a1d0;};'use strict';var emlformat=require(_0xeed6('0x0'));var rimraf=require(_0xeed6('0x1'));var zipdir=require(_0xeed6('0x2'));var jsonpatch=require(_0xeed6('0x3'));var rp=require(_0xeed6('0x4'));var moment=require('moment');var BPromise=require(_0xeed6('0x5'));var Mustache=require('mustache');var util=require(_0xeed6('0x6'));var path=require(_0xeed6('0x7'));var sox=require(_0xeed6('0x8'));var csv=require(_0xeed6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeed6('0xa'));var crypto=require('crypto');var jsforce=require(_0xeed6('0xb'));var deskjs=require(_0xeed6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeed6('0xd'));var Papa=require(_0xeed6('0xe'));var Redis=require(_0xeed6('0xf'));var authService=require(_0xeed6('0x10'));var qs=require(_0xeed6('0x11'));var as=require(_0xeed6('0x12'));var hardwareService=require(_0xeed6('0x13'));var logger=require(_0xeed6('0x14'))(_0xeed6('0x15'));var utils=require(_0xeed6('0x16'));var config=require(_0xeed6('0x17'));var licenseUtil=require(_0xeed6('0x18'));var db=require(_0xeed6('0x19'))['db'];function respondWithStatusCode(_0x49570d,_0x381bc2){_0x381bc2=_0x381bc2||0xcc;return function(_0x13089c){if(_0x13089c){return _0x49570d['sendStatus'](_0x381bc2);}return _0x49570d[_0xeed6('0x1a')](_0x381bc2)['end']();};}function respondWithResult(_0x70dfe,_0x458495){_0x458495=_0x458495||0xc8;return function(_0x3ab3f2){if(_0x3ab3f2){return _0x70dfe[_0xeed6('0x1a')](_0x458495)[_0xeed6('0x1b')](_0x3ab3f2);}};}function respondWithFilteredResult(_0x1c0048,_0x25abe4){return function(_0x3a5c9c){if(_0x3a5c9c){var _0x3294cc=typeof _0x25abe4['offset']===_0xeed6('0x1c')&&typeof _0x25abe4[_0xeed6('0x1d')]===_0xeed6('0x1c');var _0x4b5e60=_0x3a5c9c[_0xeed6('0x1e')];var _0x253e8b=_0x3294cc?0x0:_0x25abe4['offset'];var _0x5948a2=_0x3294cc?_0x3a5c9c[_0xeed6('0x1e')]:_0x25abe4[_0xeed6('0x1f')]+_0x25abe4[_0xeed6('0x1d')];var _0x153a8c;if(_0x5948a2>=_0x4b5e60){_0x5948a2=_0x4b5e60;_0x153a8c=0xc8;}else{_0x153a8c=0xce;}_0x1c0048[_0xeed6('0x1a')](_0x153a8c);return _0x1c0048['set']('Content-Range',_0x253e8b+'-'+_0x5948a2+'/'+_0x4b5e60)[_0xeed6('0x1b')](_0x3a5c9c);}return null;};}function patchUpdates(_0x11988d){return function(_0x2b5cfc){try{jsonpatch[_0xeed6('0x20')](_0x2b5cfc,_0x11988d,!![]);}catch(_0x54dbf0){return BPromise[_0xeed6('0x21')](_0x54dbf0);}return _0x2b5cfc[_0xeed6('0x22')]();};}function saveUpdates(_0x33dd70,_0x4e821c){return function(_0x4b0078){if(_0x4b0078){return _0x4b0078[_0xeed6('0x23')](_0x33dd70)[_0xeed6('0x24')](function(_0x5868ee){return _0x5868ee;});}return null;};}function removeEntity(_0x65191f,_0x207793){return function(_0x50cafa){if(_0x50cafa){return _0x50cafa[_0xeed6('0x25')]()[_0xeed6('0x24')](function(){_0x65191f[_0xeed6('0x1a')](0xcc)[_0xeed6('0x26')]();});}};}function handleEntityNotFound(_0x1dff62,_0x2cc7db){return function(_0x2ee380){if(!_0x2ee380){_0x1dff62[_0xeed6('0x27')](0x194);}return _0x2ee380;};}function handleError(_0x4b1aaa,_0xb951d7){_0xb951d7=_0xb951d7||0x1f4;return function(_0xb06bc4){logger[_0xeed6('0x28')](_0xb06bc4[_0xeed6('0x29')]);if(_0xb06bc4[_0xeed6('0x2a')]){delete _0xb06bc4['name'];}_0x4b1aaa[_0xeed6('0x1a')](_0xb951d7)[_0xeed6('0x2b')](_0xb06bc4);};}exports[_0xeed6('0x2c')]=function(_0x3e7823,_0x5bbcce){var _0x4936e2={},_0x2f15f7={},_0x135d24={'count':0x0,'rows':[]};var _0xec04d5=_[_0xeed6('0x2d')](db[_0xeed6('0x2e')][_0xeed6('0x2f')],function(_0x4cc585){return{'name':_0x4cc585[_0xeed6('0x30')],'type':_0x4cc585['type'][_0xeed6('0x31')]};});_0x2f15f7[_0xeed6('0x32')]=_[_0xeed6('0x2d')](_0xec04d5,_0xeed6('0x2a'));_0x2f15f7['query']=_[_0xeed6('0x33')](_0x3e7823['query']);_0x2f15f7[_0xeed6('0x34')]=_['intersection'](_0x2f15f7[_0xeed6('0x32')],_0x2f15f7[_0xeed6('0x35')]);_0x4936e2[_0xeed6('0x36')]=_[_0xeed6('0x37')](_0x2f15f7[_0xeed6('0x32')],qs[_0xeed6('0x38')](_0x3e7823['query'][_0xeed6('0x38')]));_0x4936e2[_0xeed6('0x36')]=_0x4936e2[_0xeed6('0x36')][_0xeed6('0x39')]?_0x4936e2['attributes']:_0x2f15f7[_0xeed6('0x32')];if(!_0x3e7823[_0xeed6('0x35')]['hasOwnProperty']('nolimit')){_0x4936e2['limit']=qs[_0xeed6('0x1d')](_0x3e7823[_0xeed6('0x35')][_0xeed6('0x1d')]);_0x4936e2[_0xeed6('0x1f')]=qs[_0xeed6('0x1f')](_0x3e7823[_0xeed6('0x35')][_0xeed6('0x1f')]);}_0x4936e2[_0xeed6('0x3a')]=qs[_0xeed6('0x3b')](_0x3e7823[_0xeed6('0x35')][_0xeed6('0x3b')]);_0x4936e2[_0xeed6('0x3c')]=qs[_0xeed6('0x34')](_[_0xeed6('0x3d')](_0x3e7823[_0xeed6('0x35')],_0x2f15f7[_0xeed6('0x34')]),_0xec04d5);if(_0x3e7823[_0xeed6('0x35')][_0xeed6('0x3e')]){_0x4936e2[_0xeed6('0x3c')]=_[_0xeed6('0x3f')](_0x4936e2[_0xeed6('0x3c')],{'$or':_[_0xeed6('0x2d')](_0xec04d5,function(_0x4c6790){if(_0x4c6790['type']!==_0xeed6('0x40')){var _0x3d487b={};_0x3d487b[_0x4c6790[_0xeed6('0x2a')]]={'$like':'%'+_0x3e7823['query'][_0xeed6('0x3e')]+'%'};return _0x3d487b;}})});}_0x4936e2=_[_0xeed6('0x3f')]({},_0x4936e2,_0x3e7823[_0xeed6('0x41')]);var _0xfe5c80={'where':_0x4936e2['where']};return db['Dynamics365Field'][_0xeed6('0x1e')](_0xfe5c80)['then'](function(_0x23ca86){_0x135d24[_0xeed6('0x1e')]=_0x23ca86;if(_0x3e7823[_0xeed6('0x35')]['includeAll']){_0x4936e2[_0xeed6('0x42')]=[{'all':!![]}];}return db[_0xeed6('0x2e')][_0xeed6('0x43')](_0x4936e2);})[_0xeed6('0x24')](function(_0xd828c7){_0x135d24['rows']=_0xd828c7;return _0x135d24;})[_0xeed6('0x24')](respondWithFilteredResult(_0x5bbcce,_0x4936e2))['catch'](handleError(_0x5bbcce,null));};exports[_0xeed6('0x44')]=function(_0x2caa09,_0x2c58d1){var _0x2fa0f5={'raw':!![],'where':{'id':_0x2caa09['params']['id']}},_0xabbd8b={};_0xabbd8b[_0xeed6('0x32')]=_[_0xeed6('0x33')](db[_0xeed6('0x2e')][_0xeed6('0x2f')]);_0xabbd8b[_0xeed6('0x35')]=_[_0xeed6('0x33')](_0x2caa09['query']);_0xabbd8b[_0xeed6('0x34')]=_[_0xeed6('0x37')](_0xabbd8b[_0xeed6('0x32')],_0xabbd8b[_0xeed6('0x35')]);_0x2fa0f5[_0xeed6('0x36')]=_[_0xeed6('0x37')](_0xabbd8b['model'],qs[_0xeed6('0x38')](_0x2caa09[_0xeed6('0x35')]['fields']));_0x2fa0f5[_0xeed6('0x36')]=_0x2fa0f5[_0xeed6('0x36')][_0xeed6('0x39')]?_0x2fa0f5[_0xeed6('0x36')]:_0xabbd8b[_0xeed6('0x32')];if(_0x2caa09[_0xeed6('0x35')][_0xeed6('0x45')]){_0x2fa0f5[_0xeed6('0x42')]=[{'all':!![]}];}_0x2fa0f5=_[_0xeed6('0x3f')]({},_0x2fa0f5,_0x2caa09[_0xeed6('0x41')]);return db[_0xeed6('0x2e')][_0xeed6('0x46')](_0x2fa0f5)['then'](handleEntityNotFound(_0x2c58d1,null))['then'](respondWithResult(_0x2c58d1,null))[_0xeed6('0x47')](handleError(_0x2c58d1,null));};exports[_0xeed6('0x48')]=function(_0xc8f0d1,_0x1070df){return db['Dynamics365Field']['create'](_0xc8f0d1[_0xeed6('0x49')],{})[_0xeed6('0x24')](respondWithResult(_0x1070df,0xc9))[_0xeed6('0x47')](handleError(_0x1070df,null));};exports[_0xeed6('0x23')]=function(_0x13bd7d,_0x1cfb42){if(_0x13bd7d[_0xeed6('0x49')]['id']){delete _0x13bd7d[_0xeed6('0x49')]['id'];}return db[_0xeed6('0x2e')][_0xeed6('0x46')]({'where':{'id':_0x13bd7d[_0xeed6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1cfb42,null))[_0xeed6('0x24')](saveUpdates(_0x13bd7d['body'],null))[_0xeed6('0x24')](respondWithResult(_0x1cfb42,null))[_0xeed6('0x47')](handleError(_0x1cfb42,null));};exports[_0xeed6('0x25')]=function(_0x557450,_0x23d8b7){return db[_0xeed6('0x2e')][_0xeed6('0x46')]({'where':{'id':_0x557450[_0xeed6('0x4a')]['id']}})[_0xeed6('0x24')](handleEntityNotFound(_0x23d8b7,null))['then'](removeEntity(_0x23d8b7,null))[_0xeed6('0x47')](handleError(_0x23d8b7,null));}; \ No newline at end of file +var _0x681f=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','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','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','intersection','length','includeAll','include','find'];(function(_0x35f2be,_0x3336a8){var _0x4875a8=function(_0x392def){while(--_0x392def){_0x35f2be['push'](_0x35f2be['shift']());}};_0x4875a8(++_0x3336a8);}(_0x681f,0xa0));var _0xf681=function(_0x4a9b3f,_0x158971){_0x4a9b3f=_0x4a9b3f-0x0;var _0x48b4f0=_0x681f[_0x4a9b3f];return _0x48b4f0;};'use strict';var emlformat=require(_0xf681('0x0'));var rimraf=require(_0xf681('0x1'));var zipdir=require(_0xf681('0x2'));var jsonpatch=require(_0xf681('0x3'));var rp=require(_0xf681('0x4'));var moment=require(_0xf681('0x5'));var BPromise=require(_0xf681('0x6'));var Mustache=require(_0xf681('0x7'));var util=require(_0xf681('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf681('0x9'));var ejs=require(_0xf681('0xa'));var fs=require('fs');var fs_extra=require(_0xf681('0xb'));var _=require(_0xf681('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf681('0xd'));var deskjs=require(_0xf681('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf681('0xf'));var Papa=require(_0xf681('0x10'));var Redis=require(_0xf681('0x11'));var authService=require(_0xf681('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf681('0x13'));var hardwareService=require(_0xf681('0x14'));var logger=require(_0xf681('0x15'))(_0xf681('0x16'));var utils=require(_0xf681('0x17'));var config=require(_0xf681('0x18'));var licenseUtil=require(_0xf681('0x19'));var db=require(_0xf681('0x1a'))['db'];function respondWithStatusCode(_0xeea9bc,_0x335438){_0x335438=_0x335438||0xcc;return function(_0x48e2a2){if(_0x48e2a2){return _0xeea9bc[_0xf681('0x1b')](_0x335438);}return _0xeea9bc[_0xf681('0x1c')](_0x335438)['end']();};}function respondWithResult(_0x5a3636,_0x3f66a2){_0x3f66a2=_0x3f66a2||0xc8;return function(_0x2e841d){if(_0x2e841d){return _0x5a3636[_0xf681('0x1c')](_0x3f66a2)[_0xf681('0x1d')](_0x2e841d);}};}function respondWithFilteredResult(_0x1990d8,_0x2a5cfa){return function(_0x125b03){if(_0x125b03){var _0x23e2f9=typeof _0x2a5cfa[_0xf681('0x1e')]===_0xf681('0x1f')&&typeof _0x2a5cfa[_0xf681('0x20')]===_0xf681('0x1f');var _0x313fbd=_0x125b03[_0xf681('0x21')];var _0x2161d6=_0x23e2f9?0x0:_0x2a5cfa[_0xf681('0x1e')];var _0x3e32a2=_0x23e2f9?_0x125b03[_0xf681('0x21')]:_0x2a5cfa['offset']+_0x2a5cfa['limit'];var _0x1b60ad;if(_0x3e32a2>=_0x313fbd){_0x3e32a2=_0x313fbd;_0x1b60ad=0xc8;}else{_0x1b60ad=0xce;}_0x1990d8[_0xf681('0x1c')](_0x1b60ad);return _0x1990d8[_0xf681('0x22')](_0xf681('0x23'),_0x2161d6+'-'+_0x3e32a2+'/'+_0x313fbd)['json'](_0x125b03);}return null;};}function patchUpdates(_0x5ad024){return function(_0x579fd9){try{jsonpatch[_0xf681('0x24')](_0x579fd9,_0x5ad024,!![]);}catch(_0x29c472){return BPromise[_0xf681('0x25')](_0x29c472);}return _0x579fd9[_0xf681('0x26')]();};}function saveUpdates(_0x229913,_0x3e45dc){return function(_0x28fc0c){if(_0x28fc0c){return _0x28fc0c[_0xf681('0x27')](_0x229913)[_0xf681('0x28')](function(_0x8b9a7a){return _0x8b9a7a;});}return null;};}function removeEntity(_0x5cdcf5,_0x13baca){return function(_0x2887fb){if(_0x2887fb){return _0x2887fb[_0xf681('0x29')]()[_0xf681('0x28')](function(){_0x5cdcf5[_0xf681('0x1c')](0xcc)[_0xf681('0x2a')]();});}};}function handleEntityNotFound(_0x1a8b3f,_0x19b7aa){return function(_0x4d3357){if(!_0x4d3357){_0x1a8b3f[_0xf681('0x1b')](0x194);}return _0x4d3357;};}function handleError(_0x551348,_0x13c79f){_0x13c79f=_0x13c79f||0x1f4;return function(_0x43c556){logger[_0xf681('0x2b')](_0x43c556[_0xf681('0x2c')]);if(_0x43c556[_0xf681('0x2d')]){delete _0x43c556['name'];}_0x551348[_0xf681('0x1c')](_0x13c79f)[_0xf681('0x2e')](_0x43c556);};}exports[_0xf681('0x2f')]=function(_0x539545,_0xad99f7){var _0x5903be={},_0x528969={},_0x5268c2={'count':0x0,'rows':[]};var _0x1ee08e=_[_0xf681('0x30')](db[_0xf681('0x31')][_0xf681('0x32')],function(_0x5559d5){return{'name':_0x5559d5[_0xf681('0x33')],'type':_0x5559d5[_0xf681('0x34')][_0xf681('0x35')]};});_0x528969[_0xf681('0x36')]=_[_0xf681('0x30')](_0x1ee08e,_0xf681('0x2d'));_0x528969[_0xf681('0x37')]=_[_0xf681('0x38')](_0x539545[_0xf681('0x37')]);_0x528969[_0xf681('0x39')]=_['intersection'](_0x528969[_0xf681('0x36')],_0x528969[_0xf681('0x37')]);_0x5903be[_0xf681('0x3a')]=_['intersection'](_0x528969['model'],qs[_0xf681('0x3b')](_0x539545[_0xf681('0x37')]['fields']));_0x5903be[_0xf681('0x3a')]=_0x5903be['attributes']['length']?_0x5903be['attributes']:_0x528969[_0xf681('0x36')];if(!_0x539545[_0xf681('0x37')][_0xf681('0x3c')]('nolimit')){_0x5903be[_0xf681('0x20')]=qs[_0xf681('0x20')](_0x539545[_0xf681('0x37')][_0xf681('0x20')]);_0x5903be[_0xf681('0x1e')]=qs['offset'](_0x539545[_0xf681('0x37')][_0xf681('0x1e')]);}_0x5903be['order']=qs[_0xf681('0x3d')](_0x539545[_0xf681('0x37')][_0xf681('0x3d')]);_0x5903be[_0xf681('0x3e')]=qs[_0xf681('0x39')](_['pick'](_0x539545[_0xf681('0x37')],_0x528969[_0xf681('0x39')]),_0x1ee08e);if(_0x539545[_0xf681('0x37')][_0xf681('0x3f')]){_0x5903be['where']=_['merge'](_0x5903be[_0xf681('0x3e')],{'$or':_[_0xf681('0x30')](_0x1ee08e,function(_0x58c3d7){if(_0x58c3d7[_0xf681('0x34')]!==_0xf681('0x40')){var _0x3eb049={};_0x3eb049[_0x58c3d7['name']]={'$like':'%'+_0x539545[_0xf681('0x37')][_0xf681('0x3f')]+'%'};return _0x3eb049;}})});}_0x5903be=_[_0xf681('0x41')]({},_0x5903be,_0x539545[_0xf681('0x42')]);var _0x8cc64d={'where':_0x5903be[_0xf681('0x3e')]};return db[_0xf681('0x31')][_0xf681('0x21')](_0x8cc64d)[_0xf681('0x28')](function(_0x147794){_0x5268c2[_0xf681('0x21')]=_0x147794;if(_0x539545['query']['includeAll']){_0x5903be['include']=[{'all':!![]}];}return db[_0xf681('0x31')][_0xf681('0x43')](_0x5903be);})[_0xf681('0x28')](function(_0xa09fd0){_0x5268c2[_0xf681('0x44')]=_0xa09fd0;return _0x5268c2;})[_0xf681('0x28')](respondWithFilteredResult(_0xad99f7,_0x5903be))[_0xf681('0x45')](handleError(_0xad99f7,null));};exports[_0xf681('0x46')]=function(_0x97fa83,_0x344761){var _0x5bcdda={'raw':!![],'where':{'id':_0x97fa83[_0xf681('0x47')]['id']}},_0x3d8371={};_0x3d8371[_0xf681('0x36')]=_[_0xf681('0x38')](db[_0xf681('0x31')][_0xf681('0x32')]);_0x3d8371[_0xf681('0x37')]=_['keys'](_0x97fa83['query']);_0x3d8371[_0xf681('0x39')]=_['intersection'](_0x3d8371[_0xf681('0x36')],_0x3d8371[_0xf681('0x37')]);_0x5bcdda[_0xf681('0x3a')]=_[_0xf681('0x48')](_0x3d8371['model'],qs['fields'](_0x97fa83['query'][_0xf681('0x3b')]));_0x5bcdda[_0xf681('0x3a')]=_0x5bcdda['attributes'][_0xf681('0x49')]?_0x5bcdda[_0xf681('0x3a')]:_0x3d8371[_0xf681('0x36')];if(_0x97fa83['query'][_0xf681('0x4a')]){_0x5bcdda[_0xf681('0x4b')]=[{'all':!![]}];}_0x5bcdda=_[_0xf681('0x41')]({},_0x5bcdda,_0x97fa83[_0xf681('0x42')]);return db[_0xf681('0x31')][_0xf681('0x4c')](_0x5bcdda)[_0xf681('0x28')](handleEntityNotFound(_0x344761,null))[_0xf681('0x28')](respondWithResult(_0x344761,null))['catch'](handleError(_0x344761,null));};exports['create']=function(_0x4b5150,_0x2b3d88){return db[_0xf681('0x31')][_0xf681('0x4d')](_0x4b5150[_0xf681('0x4e')],{})[_0xf681('0x28')](respondWithResult(_0x2b3d88,0xc9))[_0xf681('0x45')](handleError(_0x2b3d88,null));};exports[_0xf681('0x27')]=function(_0x15f3ba,_0x1f39bf){if(_0x15f3ba['body']['id']){delete _0x15f3ba[_0xf681('0x4e')]['id'];}return db[_0xf681('0x31')][_0xf681('0x4c')]({'where':{'id':_0x15f3ba['params']['id']}})['then'](handleEntityNotFound(_0x1f39bf,null))['then'](saveUpdates(_0x15f3ba[_0xf681('0x4e')],null))[_0xf681('0x28')](respondWithResult(_0x1f39bf,null))[_0xf681('0x45')](handleError(_0x1f39bf,null));};exports[_0xf681('0x29')]=function(_0x2f8967,_0x54f80c){return db['Dynamics365Field'][_0xf681('0x4c')]({'where':{'id':_0x2f8967[_0xf681('0x47')]['id']}})[_0xf681('0x28')](handleEntityNotFound(_0x54f80c,null))[_0xf681('0x28')](removeEntity(_0x54f80c,null))[_0xf681('0x45')](handleError(_0x54f80c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index dcd74b8..340da5f 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 _0x6e84=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x6e84,0x106));var _0x46e8=function(_0x3f6058,_0x32581e){_0x3f6058=_0x3f6058-0x0;var _0x591256=_0x6e84[_0x3f6058];return _0x591256;};'use strict';var _=require(_0x46e8('0x0'));var util=require(_0x46e8('0x1'));var logger=require('../../config/logger')(_0x46e8('0x2'));var moment=require(_0x46e8('0x3'));var BPromise=require(_0x46e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46e8('0x5'));var rimraf=require(_0x46e8('0x6'));var config=require(_0x46e8('0x7'));var attributes=require(_0x46e8('0x8'));module[_0x46e8('0x9')]=function(_0x5ee6d6,_0x1168ec){return _0x5ee6d6[_0x46e8('0xa')](_0x46e8('0xb'),attributes,{'tableName':_0x46e8('0xc'),'paranoid':![],'indexes':[{'name':_0x46e8('0xd'),'fields':[_0x46e8('0xe'),_0x46e8('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4960=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','dynamics365_unique_index','FieldId'];(function(_0x53b50e,_0xc49361){var _0x3f8625=function(_0x4ce88b){while(--_0x4ce88b){_0x53b50e['push'](_0x53b50e['shift']());}};_0x3f8625(++_0xc49361);}(_0x4960,0xb4));var _0x0496=function(_0x1be3d2,_0x19ddd7){_0x1be3d2=_0x1be3d2-0x0;var _0x5dd596=_0x4960[_0x1be3d2];return _0x5dd596;};'use strict';var _=require(_0x0496('0x0'));var util=require(_0x0496('0x1'));var logger=require('../../config/logger')(_0x0496('0x2'));var moment=require('moment');var BPromise=require(_0x0496('0x3'));var rp=require(_0x0496('0x4'));var fs=require('fs');var path=require(_0x0496('0x5'));var rimraf=require(_0x0496('0x6'));var config=require(_0x0496('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x0496('0x8')]=function(_0x5efd20,_0xb6d9a6){return _0x5efd20[_0x0496('0x9')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x0496('0xa'),'fields':['idField',_0x0496('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 70b0cb6..313e5f4 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 _0x5eb7=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x33f614,_0x5242a8){var _0x564db2=function(_0x16d3e0){while(--_0x16d3e0){_0x33f614['push'](_0x33f614['shift']());}};_0x564db2(++_0x5242a8);}(_0x5eb7,0x192));var _0x75eb=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x5eb7[_0x538c70];return _0x42ae01;};'use strict';var _=require('lodash');var util=require(_0x75eb('0x0'));var moment=require(_0x75eb('0x1'));var BPromise=require(_0x75eb('0x2'));var rs=require(_0x75eb('0x3'));var fs=require('fs');var Redis=require(_0x75eb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x75eb('0x5'));var jayson=require(_0x75eb('0x6'));var client=jayson['client'][_0x75eb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d64d4,_0x3a4c09,_0x37f919){return new BPromise(function(_0x2bb3f2,_0x2c64b8){return client[_0x75eb('0x8')](_0x4d64d4,_0x37f919)[_0x75eb('0x9')](function(_0x5a9621){logger[_0x75eb('0xa')](_0x75eb('0xb'),_0x3a4c09,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3a4c09,_0x75eb('0xc'),JSON[_0x75eb('0xd')](_0x5a9621));if(_0x5a9621[_0x75eb('0xe')]){if(_0x5a9621['error'][_0x75eb('0xf')]===0x1f4){logger[_0x75eb('0xe')](_0x75eb('0xb'),_0x3a4c09,_0x5a9621['error'][_0x75eb('0x10')]);return _0x2c64b8(_0x5a9621[_0x75eb('0xe')]['message']);}logger[_0x75eb('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3a4c09,_0x5a9621[_0x75eb('0xe')][_0x75eb('0x10')]);return _0x2bb3f2(_0x5a9621[_0x75eb('0xe')][_0x75eb('0x10')]);}else{logger[_0x75eb('0xa')](_0x75eb('0xb'),_0x3a4c09,_0x75eb('0xc'));_0x2bb3f2(_0x5a9621[_0x75eb('0x11')][_0x75eb('0x10')]);}})[_0x75eb('0x12')](function(_0xf9dd90){logger[_0x75eb('0xe')](_0x75eb('0xb'),_0x3a4c09,_0xf9dd90);_0x2c64b8(_0xf9dd90);});});} \ No newline at end of file +var _0xba4e=['error','code','Dynamics365Field,\x20%s,\x20%s','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3fec75,_0x523d63){var _0x1dc06=function(_0xf83a9){while(--_0xf83a9){_0x3fec75['push'](_0x3fec75['shift']());}};_0x1dc06(++_0x523d63);}(_0xba4e,0x9d));var _0xeba4=function(_0x5ec21d,_0x5d0772){_0x5ec21d=_0x5ec21d-0x0;var _0x43bde8=_0xba4e[_0x5ec21d];return _0x43bde8;};'use strict';var _=require('lodash');var util=require(_0xeba4('0x0'));var moment=require(_0xeba4('0x1'));var BPromise=require(_0xeba4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeba4('0x3'))['db'];var utils=require(_0xeba4('0x4'));var logger=require('../../config/logger')(_0xeba4('0x5'));var config=require(_0xeba4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeba4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf912a9,_0x2b45c1,_0x5e7116){return new BPromise(function(_0x33378f,_0x1d58fb){return client[_0xeba4('0x8')](_0xf912a9,_0x5e7116)[_0xeba4('0x9')](function(_0x27d6d7){logger[_0xeba4('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x2b45c1,_0xeba4('0xb'));logger['debug'](_0xeba4('0xc'),_0x2b45c1,_0xeba4('0xb'),JSON[_0xeba4('0xd')](_0x27d6d7));if(_0x27d6d7[_0xeba4('0xe')]){if(_0x27d6d7[_0xeba4('0xe')][_0xeba4('0xf')]===0x1f4){logger[_0xeba4('0xe')](_0xeba4('0x10'),_0x2b45c1,_0x27d6d7['error'][_0xeba4('0x11')]);return _0x1d58fb(_0x27d6d7['error'][_0xeba4('0x11')]);}logger[_0xeba4('0xe')](_0xeba4('0x10'),_0x2b45c1,_0x27d6d7['error'][_0xeba4('0x11')]);return _0x33378f(_0x27d6d7[_0xeba4('0xe')][_0xeba4('0x11')]);}else{logger[_0xeba4('0xa')](_0xeba4('0x10'),_0x2b45c1,'request\x20sent');_0x33378f(_0x27d6d7[_0xeba4('0x12')][_0xeba4('0x11')]);}})['catch'](function(_0x5ed293){logger[_0xeba4('0xe')](_0xeba4('0x10'),_0x2b45c1,_0x5ed293);_0x1d58fb(_0x5ed293);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c86cf26..1bfb03e 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 _0x9239=['getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x2bb539,_0x141da3){var _0x545913=function(_0x4fd0b4){while(--_0x4fd0b4){_0x2bb539['push'](_0x2bb539['shift']());}};_0x545913(++_0x141da3);}(_0x9239,0x158));var _0x9923=function(_0x4482a2,_0x2b2a5a){_0x4482a2=_0x4482a2-0x0;var _0x40bc84=_0x9239[_0x4482a2];return _0x40bc84;};'use strict';var multer=require(_0x9923('0x0'));var util=require(_0x9923('0x1'));var path=require('path');var timeout=require(_0x9923('0x2'));var express=require(_0x9923('0x3'));var router=express[_0x9923('0x4')]();var fs_extra=require(_0x9923('0x5'));var auth=require(_0x9923('0x6'));var interaction=require(_0x9923('0x7'));var config=require(_0x9923('0x8'));var controller=require(_0x9923('0x9'));router[_0x9923('0xa')]('/',auth[_0x9923('0xb')](),controller[_0x9923('0xc')]);router['get'](_0x9923('0xd'),auth[_0x9923('0xb')](),controller[_0x9923('0xe')]);router[_0x9923('0xa')](_0x9923('0xf'),auth[_0x9923('0xb')](),controller[_0x9923('0x10')]);router[_0x9923('0xa')](_0x9923('0x11'),auth[_0x9923('0xb')](),controller['getFields']);router[_0x9923('0x12')]('/',auth[_0x9923('0xb')](),controller[_0x9923('0x13')]);router['post'](_0x9923('0xf'),auth[_0x9923('0xb')](),controller[_0x9923('0x14')]);router[_0x9923('0x15')](_0x9923('0xd'),auth[_0x9923('0xb')](),controller['update']);router[_0x9923('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9923('0x17')]=router; \ No newline at end of file +var _0x5e65=['post','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x5f482e,_0x1c3801){var _0x187b97=function(_0x566336){while(--_0x566336){_0x5f482e['push'](_0x5f482e['shift']());}};_0x187b97(++_0x1c3801);}(_0x5e65,0x98));var _0x55e6=function(_0x2fb665,_0x5bd820){_0x2fb665=_0x2fb665-0x0;var _0x2b656c=_0x5e65[_0x2fb665];return _0x2b656c;};'use strict';var multer=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var path=require(_0x55e6('0x2'));var timeout=require('connect-timeout');var express=require(_0x55e6('0x3'));var router=express[_0x55e6('0x4')]();var fs_extra=require(_0x55e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x55e6('0x6'));var config=require(_0x55e6('0x7'));var controller=require(_0x55e6('0x8'));router[_0x55e6('0x9')]('/',auth['isAuthenticated'](),controller[_0x55e6('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x55e6('0x9')](_0x55e6('0xb'),auth[_0x55e6('0xc')](),controller[_0x55e6('0xd')]);router[_0x55e6('0x9')](_0x55e6('0xe'),auth[_0x55e6('0xc')](),controller[_0x55e6('0xf')]);router[_0x55e6('0x10')]('/',auth[_0x55e6('0xc')](),controller['create']);router[_0x55e6('0x10')](_0x55e6('0xb'),auth[_0x55e6('0xc')](),controller[_0x55e6('0x11')]);router[_0x55e6('0x12')]('/:id',auth[_0x55e6('0xc')](),controller[_0x55e6('0x13')]);router[_0x55e6('0x14')](_0x55e6('0x15'),auth[_0x55e6('0xc')](),controller[_0x55e6('0x16')]);module[_0x55e6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index dfdbfc1..7b39032 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 _0x9536=['username','remoteUri','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9536,0x179));var _0x6953=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9536[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize[_0x6953('0x2')]},'description':{'type':Sequelize[_0x6953('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6953('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6953('0x2')],'unique':_0x6953('0x4')},'serverUrl':{'type':Sequelize[_0x6953('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1a37=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4b87dc,_0x65bfba){var _0x4c3b12=function(_0xf7ff85){while(--_0xf7ff85){_0x4b87dc['push'](_0x4b87dc['shift']());}};_0x4c3b12(++_0x65bfba);}(_0x1a37,0xb4));var _0x71a3=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x1a37[_0xd09668];return _0x68726;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')]},'description':{'type':Sequelize[_0x71a3('0x2')]},'username':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x3')},'apiKey':{'type':Sequelize[_0x71a3('0x2')]},'remoteUri':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x4')},'serverUrl':{'type':Sequelize[_0x71a3('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 218b0a6..37e7782 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 _0x02f7=['Subjects','Descriptions','channel','FreshdeskField','getFields','remoteUri','slice','substring','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','description','ticket_type','group','company','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','set','reject','save','update','then','destroy','stack','name','send','FreshdeskAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId'];(function(_0x1e61b8,_0x21ca64){var _0xd1d510=function(_0x1a0f40){while(--_0x1a0f40){_0x1e61b8['push'](_0x1e61b8['shift']());}};_0xd1d510(++_0x21ca64);}(_0x02f7,0x1d3));var _0x702f=function(_0x288d17,_0xb1bf09){_0x288d17=_0x288d17-0x0;var _0x5936a9=_0x02f7[_0x288d17];return _0x5936a9;};'use strict';var emlformat=require(_0x702f('0x0'));var rimraf=require(_0x702f('0x1'));var zipdir=require(_0x702f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x702f('0x3'));var moment=require(_0x702f('0x4'));var BPromise=require(_0x702f('0x5'));var Mustache=require(_0x702f('0x6'));var util=require(_0x702f('0x7'));var path=require(_0x702f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x702f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x702f('0xa'));var squel=require(_0x702f('0xb'));var crypto=require(_0x702f('0xc'));var jsforce=require(_0x702f('0xd'));var deskjs=require(_0x702f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x702f('0xf'));var Papa=require(_0x702f('0x10'));var Redis=require(_0x702f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x702f('0x12'));var as=require(_0x702f('0x13'));var hardwareService=require(_0x702f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x702f('0x15'));var config=require(_0x702f('0x16'));var licenseUtil=require(_0x702f('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x702f('0x18'));function respondWithStatusCode(_0x3ac816,_0x4f8528){_0x4f8528=_0x4f8528||0xcc;return function(_0x39c277){if(_0x39c277){return _0x3ac816[_0x702f('0x19')](_0x4f8528);}return _0x3ac816[_0x702f('0x1a')](_0x4f8528)[_0x702f('0x1b')]();};}function respondWithResult(_0x1a714d,_0xe4f824){_0xe4f824=_0xe4f824||0xc8;return function(_0xa07719){if(_0xa07719){return _0x1a714d['status'](_0xe4f824)[_0x702f('0x1c')](_0xa07719);}};}function respondWithFilteredResult(_0x4104ae,_0x3bef6c){return function(_0x67a47e){if(_0x67a47e){var _0x1ab677=typeof _0x3bef6c['offset']==='undefined'&&typeof _0x3bef6c[_0x702f('0x1d')]==='undefined';var _0x922c85=_0x67a47e[_0x702f('0x1e')];var _0xa749fd=_0x1ab677?0x0:_0x3bef6c[_0x702f('0x1f')];var _0x53dd8f=_0x1ab677?_0x67a47e[_0x702f('0x1e')]:_0x3bef6c['offset']+_0x3bef6c['limit'];var _0x429813;if(_0x53dd8f>=_0x922c85){_0x53dd8f=_0x922c85;_0x429813=0xc8;}else{_0x429813=0xce;}_0x4104ae[_0x702f('0x1a')](_0x429813);return _0x4104ae[_0x702f('0x20')]('Content-Range',_0xa749fd+'-'+_0x53dd8f+'/'+_0x922c85)[_0x702f('0x1c')](_0x67a47e);}return null;};}function patchUpdates(_0x218e30){return function(_0x34864e){try{jsonpatch['apply'](_0x34864e,_0x218e30,!![]);}catch(_0x38ecba){return BPromise[_0x702f('0x21')](_0x38ecba);}return _0x34864e[_0x702f('0x22')]();};}function saveUpdates(_0x3f573e,_0x16cc77){return function(_0x431e6d){if(_0x431e6d){return _0x431e6d[_0x702f('0x23')](_0x3f573e)[_0x702f('0x24')](function(_0x1f47a2){return _0x1f47a2;});}return null;};}function removeEntity(_0xc030e5,_0x4699b4){return function(_0x28a0d8){if(_0x28a0d8){return _0x28a0d8[_0x702f('0x25')]()[_0x702f('0x24')](function(){_0xc030e5[_0x702f('0x1a')](0xcc)[_0x702f('0x1b')]();});}};}function handleEntityNotFound(_0x386086,_0x5f2961){return function(_0x3a2aeb){if(!_0x3a2aeb){_0x386086[_0x702f('0x19')](0x194);}return _0x3a2aeb;};}function handleError(_0x46136d,_0x244f42){_0x244f42=_0x244f42||0x1f4;return function(_0x9bb674){logger['error'](_0x9bb674[_0x702f('0x26')]);if(_0x9bb674['name']){delete _0x9bb674[_0x702f('0x27')];}_0x46136d[_0x702f('0x1a')](_0x244f42)[_0x702f('0x28')](_0x9bb674);};}exports['index']=function(_0x573103,_0x10d5c4){var _0x52fa34={},_0x2ee69d={},_0x228d4e={'count':0x0,'rows':[]};var _0x38dde7=_['map'](db[_0x702f('0x29')][_0x702f('0x2a')],function(_0x25e9df){return{'name':_0x25e9df['fieldName'],'type':_0x25e9df['type'][_0x702f('0x2b')]};});_0x2ee69d[_0x702f('0x2c')]=_[_0x702f('0x2d')](_0x38dde7,_0x702f('0x27'));_0x2ee69d[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x573103['query']);_0x2ee69d[_0x702f('0x30')]=_[_0x702f('0x31')](_0x2ee69d[_0x702f('0x2c')],_0x2ee69d[_0x702f('0x2e')]);_0x52fa34[_0x702f('0x32')]=_['intersection'](_0x2ee69d[_0x702f('0x2c')],qs[_0x702f('0x33')](_0x573103[_0x702f('0x2e')]['fields']));_0x52fa34[_0x702f('0x32')]=_0x52fa34[_0x702f('0x32')][_0x702f('0x34')]?_0x52fa34[_0x702f('0x32')]:_0x2ee69d[_0x702f('0x2c')];if(!_0x573103[_0x702f('0x2e')][_0x702f('0x35')](_0x702f('0x36'))){_0x52fa34[_0x702f('0x1d')]=qs[_0x702f('0x1d')](_0x573103[_0x702f('0x2e')]['limit']);_0x52fa34['offset']=qs[_0x702f('0x1f')](_0x573103[_0x702f('0x2e')][_0x702f('0x1f')]);}_0x52fa34[_0x702f('0x37')]=qs[_0x702f('0x38')](_0x573103[_0x702f('0x2e')]['sort']);_0x52fa34[_0x702f('0x39')]=qs[_0x702f('0x30')](_[_0x702f('0x3a')](_0x573103[_0x702f('0x2e')],_0x2ee69d[_0x702f('0x30')]),_0x38dde7);if(_0x573103[_0x702f('0x2e')][_0x702f('0x3b')]){_0x52fa34['where']=_[_0x702f('0x3c')](_0x52fa34[_0x702f('0x39')],{'$or':_[_0x702f('0x2d')](_0x38dde7,function(_0x2bbde4){if(_0x2bbde4[_0x702f('0x3d')]!==_0x702f('0x3e')){var _0x8f1d4={};_0x8f1d4[_0x2bbde4['name']]={'$like':'%'+_0x573103['query'][_0x702f('0x3b')]+'%'};return _0x8f1d4;}})});}_0x52fa34=_[_0x702f('0x3c')]({},_0x52fa34,_0x573103['options']);var _0xed3590={'where':_0x52fa34[_0x702f('0x39')]};return db['FreshdeskAccount'][_0x702f('0x1e')](_0xed3590)[_0x702f('0x24')](function(_0x334630){_0x228d4e[_0x702f('0x1e')]=_0x334630;if(_0x573103[_0x702f('0x2e')][_0x702f('0x3f')]){_0x52fa34[_0x702f('0x40')]=[{'all':!![]}];}return db[_0x702f('0x29')][_0x702f('0x41')](_0x52fa34);})[_0x702f('0x24')](function(_0xbfd3c9){_0x228d4e[_0x702f('0x42')]=_0xbfd3c9;return _0x228d4e;})['then'](respondWithFilteredResult(_0x10d5c4,_0x52fa34))['catch'](handleError(_0x10d5c4,null));};exports[_0x702f('0x43')]=function(_0x161ac4,_0xe8831a){var _0x180e6e={'raw':![],'where':{'id':_0x161ac4[_0x702f('0x44')]['id']}},_0x43f7ad={};_0x43f7ad[_0x702f('0x2c')]=_[_0x702f('0x2f')](db['FreshdeskAccount']['rawAttributes']);_0x43f7ad[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x161ac4[_0x702f('0x2e')]);_0x43f7ad[_0x702f('0x30')]=_['intersection'](_0x43f7ad[_0x702f('0x2c')],_0x43f7ad['query']);_0x180e6e[_0x702f('0x32')]=_[_0x702f('0x31')](_0x43f7ad['model'],qs['fields'](_0x161ac4[_0x702f('0x2e')][_0x702f('0x33')]));_0x180e6e['attributes']=_0x180e6e['attributes'][_0x702f('0x34')]?_0x180e6e[_0x702f('0x32')]:_0x43f7ad[_0x702f('0x2c')];if(_0x161ac4[_0x702f('0x2e')][_0x702f('0x3f')]){_0x180e6e[_0x702f('0x40')]=[{'all':!![]}];}_0x180e6e=_['merge']({},_0x180e6e,_0x161ac4['options']);return db[_0x702f('0x29')][_0x702f('0x45')](_0x180e6e)[_0x702f('0x24')](handleEntityNotFound(_0xe8831a,null))[_0x702f('0x24')](respondWithResult(_0xe8831a,null))[_0x702f('0x46')](handleError(_0xe8831a,null));};exports[_0x702f('0x47')]=function(_0x4d9e5e,_0x2e957b){return db[_0x702f('0x29')]['create'](_0x4d9e5e[_0x702f('0x48')],{})['then'](respondWithResult(_0x2e957b,0xc9))['catch'](handleError(_0x2e957b,null));};exports['update']=function(_0x2c8599,_0x1ae430){if(_0x2c8599['body']['id']){delete _0x2c8599[_0x702f('0x48')]['id'];}return db['FreshdeskAccount'][_0x702f('0x45')]({'where':{'id':_0x2c8599[_0x702f('0x44')]['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x1ae430,null))[_0x702f('0x24')](saveUpdates(_0x2c8599[_0x702f('0x48')],null))[_0x702f('0x24')](respondWithResult(_0x1ae430,null))[_0x702f('0x46')](handleError(_0x1ae430,null));};exports[_0x702f('0x25')]=function(_0x3f378c,_0x8f260d){return db[_0x702f('0x29')][_0x702f('0x45')]({'where':{'id':_0x3f378c['params']['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x8f260d,null))[_0x702f('0x24')](removeEntity(_0x8f260d,null))[_0x702f('0x46')](handleError(_0x8f260d,null));};exports[_0x702f('0x49')]=function(_0x4a7ea9,_0x13cfdc,_0xe28bb5){var _0x1d7a1a={};var _0x1f305a={};var _0x3f1da0;var _0x3f5899;return db['FreshdeskAccount'][_0x702f('0x4a')]({'where':{'id':_0x4a7ea9[_0x702f('0x44')]['id']}})[_0x702f('0x24')](handleEntityNotFound(_0x13cfdc,null))[_0x702f('0x24')](function(_0x541b9b){if(_0x541b9b){_0x3f1da0=_0x541b9b;_0x1f305a[_0x702f('0x2c')]=_[_0x702f('0x2f')](db[_0x702f('0x4b')]['rawAttributes']);_0x1f305a[_0x702f('0x2e')]=_[_0x702f('0x2f')](_0x4a7ea9[_0x702f('0x2e')]);_0x1f305a[_0x702f('0x30')]=_[_0x702f('0x31')](_0x1f305a['model'],_0x1f305a[_0x702f('0x2e')]);_0x1d7a1a['attributes']=_[_0x702f('0x31')](_0x1f305a[_0x702f('0x2c')],qs[_0x702f('0x33')](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x33')]));_0x1d7a1a[_0x702f('0x32')]=_0x1d7a1a[_0x702f('0x32')][_0x702f('0x34')]?_0x1d7a1a[_0x702f('0x32')]:_0x1f305a[_0x702f('0x2c')];_0x1d7a1a['order']=qs['sort'](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x38')]);_0x1d7a1a[_0x702f('0x39')]=qs[_0x702f('0x30')](_[_0x702f('0x3a')](_0x4a7ea9[_0x702f('0x2e')],_0x1f305a[_0x702f('0x30')]));if(_0x4a7ea9['query'][_0x702f('0x3b')]){_0x1d7a1a[_0x702f('0x39')]=_[_0x702f('0x3c')](_0x1d7a1a[_0x702f('0x39')],{'$or':_['map'](_0x1d7a1a['attributes'],function(_0x5e5c82){var _0x23d1d3={};_0x23d1d3[_0x5e5c82]={'$like':'%'+_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x3b')]+'%'};return _0x23d1d3;})});}_0x1d7a1a=_['merge']({},_0x1d7a1a,_0x4a7ea9['options']);return _0x3f1da0[_0x702f('0x49')](_0x1d7a1a);}})[_0x702f('0x24')](function(_0x599a40){if(_0x599a40){_0x3f5899=_0x599a40[_0x702f('0x34')];if(!_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x35')](_0x702f('0x36'))){_0x1d7a1a['limit']=qs[_0x702f('0x1d')](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x1d')]);_0x1d7a1a[_0x702f('0x1f')]=qs['offset'](_0x4a7ea9[_0x702f('0x2e')][_0x702f('0x1f')]);}return _0x3f1da0['getConfigurations'](_0x1d7a1a);}})[_0x702f('0x24')](function(_0x336ef6){if(_0x336ef6){return _0x336ef6?{'count':_0x3f5899,'rows':_0x336ef6}:null;}})[_0x702f('0x24')](respondWithResult(_0x13cfdc,null))[_0x702f('0x46')](handleError(_0x13cfdc,null));};exports[_0x702f('0x4c')]=function(_0x10de2a,_0x32e37b,_0x4facae){if(_0x10de2a[_0x702f('0x48')]['id']){delete _0x10de2a['body']['id'];}return db[_0x702f('0x29')][_0x702f('0x4a')]({'where':{'id':_0x10de2a[_0x702f('0x44')]['id']}})['then'](handleEntityNotFound(_0x32e37b,null))[_0x702f('0x24')](function(_0x4ca7ba){if(_0x4ca7ba){_0x10de2a[_0x702f('0x48')][_0x702f('0x4d')]=_0x4ca7ba['id'];_0x10de2a[_0x702f('0x48')][_0x702f('0x4e')]=integrations['getSubjects'](_0x10de2a[_0x702f('0x48')]['channel'],_0x10de2a[_0x702f('0x48')][_0x702f('0x3d')]);_0x10de2a[_0x702f('0x48')][_0x702f('0x4f')]=integrations['getDescriptions'](_0x10de2a['body'][_0x702f('0x50')],_0x10de2a[_0x702f('0x48')][_0x702f('0x3d')]);return db[_0x702f('0x4b')]['create'](_0x10de2a[_0x702f('0x48')],{'include':[{'model':db[_0x702f('0x51')],'as':_0x702f('0x4e')},{'model':db[_0x702f('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x32e37b,null))[_0x702f('0x46')](handleError(_0x32e37b,null));};exports[_0x702f('0x52')]=function(_0x3ee283,_0x57d505,_0x25709c){var _0x30b74f='';return db['FreshdeskAccount'][_0x702f('0x4a')]({'where':{'id':_0x3ee283[_0x702f('0x44')]['id']},'attributes':['id',_0x702f('0x53'),'apiKey']})['then'](handleEntityNotFound(_0x57d505,null))['then'](function(_0x31efbf){if(_0x31efbf){_0x30b74f=_0x31efbf[_0x702f('0x53')];var _0x1bf58f=_0x30b74f[_0x702f('0x54')](-0x1);if(_0x1bf58f==='/'){_0x30b74f=_0x30b74f[_0x702f('0x55')](0x0,_0x30b74f['lastIndexOf'](_0x1bf58f));}return rp({'method':'GET','uri':util[_0x702f('0x56')](_0x702f('0x57'),_0x30b74f,_0x702f('0x58')),'headers':{'Authorization':util['format'](_0x702f('0x59'),new Buffer(util[_0x702f('0x56')](_0x702f('0x5a'),_0x31efbf[_0x702f('0x5b')]))[_0x702f('0x5c')](_0x702f('0x5d')))},'json':!![]});}})[_0x702f('0x24')](function(_0x13142f){if(_0x13142f){var _0x2b6454=[_0x702f('0x5e'),'subject','agent',_0x702f('0x5f'),_0x702f('0x1a'),'priority','group','source',_0x702f('0x60'),_0x702f('0x61'),_0x702f('0x62')];_['remove'](_0x13142f,function(_0xc86c4b){return _0x2b6454[_0x702f('0x63')](_0xc86c4b['name'])||!_0xc86c4b['default']&&_0xc86c4b['type']!==_0x702f('0x64')&&_0xc86c4b[_0x702f('0x3d')]!==_0x702f('0x65');});return{'count':_0x13142f[_0x702f('0x34')],'rows':_[_0x702f('0x2d')](_0x13142f,function(_0x45ee70){return{'id':_0x45ee70['name'],'name':_0x45ee70[_0x702f('0x66')],'custom':!_0x45ee70['default'],'options':_0x45ee70[_0x702f('0x67')]?_[_0x702f('0x2d')](_0x45ee70[_0x702f('0x67')],function(_0x1daac9){return{'name':_[_0x702f('0x68')](_0x1daac9),'value':_0x1daac9};}):[]};})};}})[_0x702f('0x24')](respondWithResult(_0x57d505,null))[_0x702f('0x46')](function(_0x1ee2c0){var _0x13340e=_0x3ee283[_0x702f('0x2e')][_0x702f('0x69')]?0x1f4:_0x1ee2c0[_0x702f('0x6a')]||0x1f4;logger['error'](_0x702f('0x6b'),_0x702f('0x52'),_0x13340e,JSON['stringify'](_0x1ee2c0));delete _0x1ee2c0['name'];if(_0x13340e===0x191){_0x13340e=0x190;}_0x57d505['status'](_0x13340e)[_0x702f('0x28')](_0x3ee283[_0x702f('0x2e')][_0x702f('0x69')]?{'message':_0x702f('0x6c'),'statusCode':_0x1ee2c0['statusCode']}:_0x1ee2c0);});}; \ No newline at end of file +var _0xd4bd=['custom_dropdown','label','choices','test','statusCode','Wrong\x20credentials','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','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','options','catch','create','update','body','find','getConfigurations','nolimit','addConfiguration','findOne','AccountId','channel','FreshdeskConfiguration','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','includes','default'];(function(_0x58e1b0,_0x64e502){var _0x321c27=function(_0x5df3e0){while(--_0x5df3e0){_0x58e1b0['push'](_0x58e1b0['shift']());}};_0x321c27(++_0x64e502);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x362225,_0x353663){_0x362225=_0x362225-0x0;var _0x42c250=_0xd4bd[_0x362225];return _0x42c250;};'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'];var integrations=require(_0xdd4b('0x19'));function respondWithStatusCode(_0x594339,_0x2a88ab){_0x2a88ab=_0x2a88ab||0xcc;return function(_0x5119cb){if(_0x5119cb){return _0x594339[_0xdd4b('0x1a')](_0x2a88ab);}return _0x594339[_0xdd4b('0x1b')](_0x2a88ab)[_0xdd4b('0x1c')]();};}function respondWithResult(_0x5dc694,_0x327f9e){_0x327f9e=_0x327f9e||0xc8;return function(_0x293397){if(_0x293397){return _0x5dc694['status'](_0x327f9e)['json'](_0x293397);}};}function respondWithFilteredResult(_0x3a7f2a,_0x368842){return function(_0x39f053){if(_0x39f053){var _0x38c850=typeof _0x368842[_0xdd4b('0x1d')]===_0xdd4b('0x1e')&&typeof _0x368842[_0xdd4b('0x1f')]==='undefined';var _0xcc5385=_0x39f053[_0xdd4b('0x20')];var _0xec67fb=_0x38c850?0x0:_0x368842['offset'];var _0x3c7e37=_0x38c850?_0x39f053['count']:_0x368842['offset']+_0x368842[_0xdd4b('0x1f')];var _0x476540;if(_0x3c7e37>=_0xcc5385){_0x3c7e37=_0xcc5385;_0x476540=0xc8;}else{_0x476540=0xce;}_0x3a7f2a['status'](_0x476540);return _0x3a7f2a[_0xdd4b('0x21')](_0xdd4b('0x22'),_0xec67fb+'-'+_0x3c7e37+'/'+_0xcc5385)[_0xdd4b('0x23')](_0x39f053);}return null;};}function patchUpdates(_0x1fbbe7){return function(_0x14a011){try{jsonpatch[_0xdd4b('0x24')](_0x14a011,_0x1fbbe7,!![]);}catch(_0x22af7f){return BPromise['reject'](_0x22af7f);}return _0x14a011['save']();};}function saveUpdates(_0x2325fe,_0x26c32b){return function(_0x3ec51e){if(_0x3ec51e){return _0x3ec51e['update'](_0x2325fe)[_0xdd4b('0x25')](function(_0x1ba012){return _0x1ba012;});}return null;};}function removeEntity(_0x1b55b5,_0x333a3f){return function(_0x10e7ee){if(_0x10e7ee){return _0x10e7ee[_0xdd4b('0x26')]()['then'](function(){_0x1b55b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd6bfcb,_0x304f46){return function(_0x559007){if(!_0x559007){_0xd6bfcb['sendStatus'](0x194);}return _0x559007;};}function handleError(_0x2d4f73,_0x24fa06){_0x24fa06=_0x24fa06||0x1f4;return function(_0x2512bd){logger[_0xdd4b('0x27')](_0x2512bd[_0xdd4b('0x28')]);if(_0x2512bd['name']){delete _0x2512bd[_0xdd4b('0x29')];}_0x2d4f73[_0xdd4b('0x1b')](_0x24fa06)[_0xdd4b('0x2a')](_0x2512bd);};}exports[_0xdd4b('0x2b')]=function(_0x32489f,_0x14a40f){var _0x4de481={},_0x420597={},_0x3c841a={'count':0x0,'rows':[]};var _0x5da4c=_[_0xdd4b('0x2c')](db[_0xdd4b('0x2d')][_0xdd4b('0x2e')],function(_0x448f34){return{'name':_0x448f34[_0xdd4b('0x2f')],'type':_0x448f34[_0xdd4b('0x30')][_0xdd4b('0x31')]};});_0x420597[_0xdd4b('0x32')]=_[_0xdd4b('0x2c')](_0x5da4c,_0xdd4b('0x29'));_0x420597[_0xdd4b('0x33')]=_[_0xdd4b('0x34')](_0x32489f[_0xdd4b('0x33')]);_0x420597['filters']=_['intersection'](_0x420597[_0xdd4b('0x32')],_0x420597[_0xdd4b('0x33')]);_0x4de481[_0xdd4b('0x35')]=_['intersection'](_0x420597[_0xdd4b('0x32')],qs[_0xdd4b('0x36')](_0x32489f['query']['fields']));_0x4de481[_0xdd4b('0x35')]=_0x4de481['attributes'][_0xdd4b('0x37')]?_0x4de481['attributes']:_0x420597['model'];if(!_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x38')]('nolimit')){_0x4de481[_0xdd4b('0x1f')]=qs[_0xdd4b('0x1f')](_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x1f')]);_0x4de481[_0xdd4b('0x1d')]=qs[_0xdd4b('0x1d')](_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x1d')]);}_0x4de481[_0xdd4b('0x39')]=qs[_0xdd4b('0x3a')](_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x3a')]);_0x4de481[_0xdd4b('0x3b')]=qs[_0xdd4b('0x3c')](_[_0xdd4b('0x3d')](_0x32489f['query'],_0x420597[_0xdd4b('0x3c')]),_0x5da4c);if(_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x3e')]){_0x4de481[_0xdd4b('0x3b')]=_[_0xdd4b('0x3f')](_0x4de481[_0xdd4b('0x3b')],{'$or':_[_0xdd4b('0x2c')](_0x5da4c,function(_0x3626ee){if(_0x3626ee[_0xdd4b('0x30')]!==_0xdd4b('0x40')){var _0x3c17f4={};_0x3c17f4[_0x3626ee['name']]={'$like':'%'+_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x3e')]+'%'};return _0x3c17f4;}})});}_0x4de481=_[_0xdd4b('0x3f')]({},_0x4de481,_0x32489f['options']);var _0x3c7cf5={'where':_0x4de481[_0xdd4b('0x3b')]};return db[_0xdd4b('0x2d')][_0xdd4b('0x20')](_0x3c7cf5)[_0xdd4b('0x25')](function(_0x234948){_0x3c841a['count']=_0x234948;if(_0x32489f[_0xdd4b('0x33')][_0xdd4b('0x41')]){_0x4de481[_0xdd4b('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xdd4b('0x43')](_0x4de481);})[_0xdd4b('0x25')](function(_0x9b8c73){_0x3c841a[_0xdd4b('0x44')]=_0x9b8c73;return _0x3c841a;})[_0xdd4b('0x25')](respondWithFilteredResult(_0x14a40f,_0x4de481))['catch'](handleError(_0x14a40f,null));};exports[_0xdd4b('0x45')]=function(_0x44bf64,_0x53d98a){var _0x333bed={'raw':![],'where':{'id':_0x44bf64[_0xdd4b('0x46')]['id']}},_0x4f5baa={};_0x4f5baa['model']=_['keys'](db[_0xdd4b('0x2d')][_0xdd4b('0x2e')]);_0x4f5baa[_0xdd4b('0x33')]=_[_0xdd4b('0x34')](_0x44bf64['query']);_0x4f5baa[_0xdd4b('0x3c')]=_[_0xdd4b('0x47')](_0x4f5baa[_0xdd4b('0x32')],_0x4f5baa[_0xdd4b('0x33')]);_0x333bed[_0xdd4b('0x35')]=_[_0xdd4b('0x47')](_0x4f5baa[_0xdd4b('0x32')],qs['fields'](_0x44bf64['query'][_0xdd4b('0x36')]));_0x333bed['attributes']=_0x333bed[_0xdd4b('0x35')][_0xdd4b('0x37')]?_0x333bed[_0xdd4b('0x35')]:_0x4f5baa[_0xdd4b('0x32')];if(_0x44bf64[_0xdd4b('0x33')]['includeAll']){_0x333bed[_0xdd4b('0x42')]=[{'all':!![]}];}_0x333bed=_[_0xdd4b('0x3f')]({},_0x333bed,_0x44bf64[_0xdd4b('0x48')]);return db[_0xdd4b('0x2d')]['find'](_0x333bed)[_0xdd4b('0x25')](handleEntityNotFound(_0x53d98a,null))[_0xdd4b('0x25')](respondWithResult(_0x53d98a,null))[_0xdd4b('0x49')](handleError(_0x53d98a,null));};exports['create']=function(_0x401152,_0x3655e9){return db['FreshdeskAccount'][_0xdd4b('0x4a')](_0x401152['body'],{})[_0xdd4b('0x25')](respondWithResult(_0x3655e9,0xc9))[_0xdd4b('0x49')](handleError(_0x3655e9,null));};exports[_0xdd4b('0x4b')]=function(_0x3121ee,_0x3233ab){if(_0x3121ee[_0xdd4b('0x4c')]['id']){delete _0x3121ee[_0xdd4b('0x4c')]['id'];}return db[_0xdd4b('0x2d')][_0xdd4b('0x4d')]({'where':{'id':_0x3121ee['params']['id']}})[_0xdd4b('0x25')](handleEntityNotFound(_0x3233ab,null))[_0xdd4b('0x25')](saveUpdates(_0x3121ee[_0xdd4b('0x4c')],null))['then'](respondWithResult(_0x3233ab,null))[_0xdd4b('0x49')](handleError(_0x3233ab,null));};exports[_0xdd4b('0x26')]=function(_0x539f05,_0xcbbf7f){return db[_0xdd4b('0x2d')][_0xdd4b('0x4d')]({'where':{'id':_0x539f05[_0xdd4b('0x46')]['id']}})[_0xdd4b('0x25')](handleEntityNotFound(_0xcbbf7f,null))[_0xdd4b('0x25')](removeEntity(_0xcbbf7f,null))[_0xdd4b('0x49')](handleError(_0xcbbf7f,null));};exports[_0xdd4b('0x4e')]=function(_0xda3cc4,_0xe79da3,_0x488722){var _0x3d79d5={};var _0x5ec06b={};var _0x1b0321;var _0x14b7e7;return db[_0xdd4b('0x2d')]['findOne']({'where':{'id':_0xda3cc4['params']['id']}})['then'](handleEntityNotFound(_0xe79da3,null))[_0xdd4b('0x25')](function(_0x23e373){if(_0x23e373){_0x1b0321=_0x23e373;_0x5ec06b[_0xdd4b('0x32')]=_[_0xdd4b('0x34')](db['FreshdeskConfiguration'][_0xdd4b('0x2e')]);_0x5ec06b[_0xdd4b('0x33')]=_[_0xdd4b('0x34')](_0xda3cc4[_0xdd4b('0x33')]);_0x5ec06b['filters']=_[_0xdd4b('0x47')](_0x5ec06b[_0xdd4b('0x32')],_0x5ec06b[_0xdd4b('0x33')]);_0x3d79d5[_0xdd4b('0x35')]=_[_0xdd4b('0x47')](_0x5ec06b[_0xdd4b('0x32')],qs[_0xdd4b('0x36')](_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x36')]));_0x3d79d5[_0xdd4b('0x35')]=_0x3d79d5[_0xdd4b('0x35')][_0xdd4b('0x37')]?_0x3d79d5['attributes']:_0x5ec06b[_0xdd4b('0x32')];_0x3d79d5[_0xdd4b('0x39')]=qs[_0xdd4b('0x3a')](_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x3a')]);_0x3d79d5[_0xdd4b('0x3b')]=qs['filters'](_['pick'](_0xda3cc4[_0xdd4b('0x33')],_0x5ec06b[_0xdd4b('0x3c')]));if(_0xda3cc4[_0xdd4b('0x33')]['filter']){_0x3d79d5[_0xdd4b('0x3b')]=_[_0xdd4b('0x3f')](_0x3d79d5['where'],{'$or':_[_0xdd4b('0x2c')](_0x3d79d5[_0xdd4b('0x35')],function(_0x55b214){var _0x50e6f4={};_0x50e6f4[_0x55b214]={'$like':'%'+_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x3e')]+'%'};return _0x50e6f4;})});}_0x3d79d5=_[_0xdd4b('0x3f')]({},_0x3d79d5,_0xda3cc4[_0xdd4b('0x48')]);return _0x1b0321[_0xdd4b('0x4e')](_0x3d79d5);}})['then'](function(_0x53ad78){if(_0x53ad78){_0x14b7e7=_0x53ad78[_0xdd4b('0x37')];if(!_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x38')](_0xdd4b('0x4f'))){_0x3d79d5[_0xdd4b('0x1f')]=qs[_0xdd4b('0x1f')](_0xda3cc4[_0xdd4b('0x33')][_0xdd4b('0x1f')]);_0x3d79d5[_0xdd4b('0x1d')]=qs[_0xdd4b('0x1d')](_0xda3cc4[_0xdd4b('0x33')]['offset']);}return _0x1b0321[_0xdd4b('0x4e')](_0x3d79d5);}})[_0xdd4b('0x25')](function(_0x11d189){if(_0x11d189){return _0x11d189?{'count':_0x14b7e7,'rows':_0x11d189}:null;}})[_0xdd4b('0x25')](respondWithResult(_0xe79da3,null))[_0xdd4b('0x49')](handleError(_0xe79da3,null));};exports[_0xdd4b('0x50')]=function(_0x3cb994,_0x414974,_0x5435d4){if(_0x3cb994[_0xdd4b('0x4c')]['id']){delete _0x3cb994['body']['id'];}return db[_0xdd4b('0x2d')][_0xdd4b('0x51')]({'where':{'id':_0x3cb994[_0xdd4b('0x46')]['id']}})['then'](handleEntityNotFound(_0x414974,null))[_0xdd4b('0x25')](function(_0x181c82){if(_0x181c82){_0x3cb994[_0xdd4b('0x4c')][_0xdd4b('0x52')]=_0x181c82['id'];_0x3cb994[_0xdd4b('0x4c')]['Subjects']=integrations['getSubjects'](_0x3cb994[_0xdd4b('0x4c')][_0xdd4b('0x53')],_0x3cb994[_0xdd4b('0x4c')][_0xdd4b('0x30')]);_0x3cb994[_0xdd4b('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x3cb994[_0xdd4b('0x4c')][_0xdd4b('0x53')],_0x3cb994['body'][_0xdd4b('0x30')]);return db[_0xdd4b('0x54')][_0xdd4b('0x4a')](_0x3cb994[_0xdd4b('0x4c')],{'include':[{'model':db[_0xdd4b('0x55')],'as':_0xdd4b('0x56')},{'model':db[_0xdd4b('0x55')],'as':_0xdd4b('0x57')}]});}return null;})[_0xdd4b('0x25')](respondWithResult(_0x414974,null))[_0xdd4b('0x49')](handleError(_0x414974,null));};exports[_0xdd4b('0x58')]=function(_0x42afdd,_0x1cf885,_0x50eebf){var _0x51f666='';return db[_0xdd4b('0x2d')][_0xdd4b('0x51')]({'where':{'id':_0x42afdd[_0xdd4b('0x46')]['id']},'attributes':['id',_0xdd4b('0x59'),_0xdd4b('0x5a')]})['then'](handleEntityNotFound(_0x1cf885,null))[_0xdd4b('0x25')](function(_0x4e3c67){if(_0x4e3c67){_0x51f666=_0x4e3c67[_0xdd4b('0x59')];var _0x3e9afe=_0x51f666[_0xdd4b('0x5b')](-0x1);if(_0x3e9afe==='/'){_0x51f666=_0x51f666[_0xdd4b('0x5c')](0x0,_0x51f666[_0xdd4b('0x5d')](_0x3e9afe));}return rp({'method':'GET','uri':util[_0xdd4b('0x5e')]('%s/%s',_0x51f666,_0xdd4b('0x5f')),'headers':{'Authorization':util['format'](_0xdd4b('0x60'),new Buffer(util[_0xdd4b('0x5e')](_0xdd4b('0x61'),_0x4e3c67['apiKey']))[_0xdd4b('0x62')](_0xdd4b('0x63')))},'json':!![]});}})[_0xdd4b('0x25')](function(_0x3bc6ab){if(_0x3bc6ab){var _0x422fcd=[_0xdd4b('0x64'),_0xdd4b('0x65'),_0xdd4b('0x66'),'description',_0xdd4b('0x1b'),_0xdd4b('0x67'),_0xdd4b('0x68'),_0xdd4b('0x69'),_0xdd4b('0x6a'),_0xdd4b('0x68'),'company'];_['remove'](_0x3bc6ab,function(_0x5b6938){return _0x422fcd[_0xdd4b('0x6b')](_0x5b6938[_0xdd4b('0x29')])||!_0x5b6938[_0xdd4b('0x6c')]&&_0x5b6938[_0xdd4b('0x30')]!=='custom_text'&&_0x5b6938[_0xdd4b('0x30')]!==_0xdd4b('0x6d');});return{'count':_0x3bc6ab['length'],'rows':_[_0xdd4b('0x2c')](_0x3bc6ab,function(_0x4b3eda){return{'id':_0x4b3eda['name'],'name':_0x4b3eda[_0xdd4b('0x6e')],'custom':!_0x4b3eda[_0xdd4b('0x6c')],'options':_0x4b3eda[_0xdd4b('0x6f')]?_['map'](_0x4b3eda[_0xdd4b('0x6f')],function(_0x16b714){return{'name':_['capitalize'](_0x16b714),'value':_0x16b714};}):[]};})};}})[_0xdd4b('0x25')](respondWithResult(_0x1cf885,null))[_0xdd4b('0x49')](function(_0x32169e){var _0x402362=_0x42afdd[_0xdd4b('0x33')][_0xdd4b('0x70')]?0x1f4:_0x32169e[_0xdd4b('0x71')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xdd4b('0x58'),_0x402362,JSON['stringify'](_0x32169e));delete _0x32169e['name'];if(_0x402362===0x191){_0x402362=0x190;}_0x1cf885[_0xdd4b('0x1b')](_0x402362)[_0xdd4b('0x2a')](_0x42afdd[_0xdd4b('0x33')][_0xdd4b('0x70')]?{'message':_0xdd4b('0x72'),'statusCode':_0x32169e[_0xdd4b('0x71')]}:_0x32169e);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f98d7be..72e53bc 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 _0xd3a4=['../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshdeskAccount.attributes'];(function(_0xa3259c,_0x5ccc5b){var _0x1d72a5=function(_0x64ecba){while(--_0x64ecba){_0xa3259c['push'](_0xa3259c['shift']());}};_0x1d72a5(++_0x5ccc5b);}(_0xd3a4,0x117));var _0x4d3a=function(_0x2c619f,_0x1a9503){_0x2c619f=_0x2c619f-0x0;var _0xb8c66a=_0xd3a4[_0x2c619f];return _0xb8c66a;};'use strict';var _=require(_0x4d3a('0x0'));var util=require(_0x4d3a('0x1'));var logger=require(_0x4d3a('0x2'))(_0x4d3a('0x3'));var moment=require(_0x4d3a('0x4'));var BPromise=require(_0x4d3a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d3a('0x6'));var rimraf=require(_0x4d3a('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d3a('0x8'));var integrations=require(_0x4d3a('0x9'));module[_0x4d3a('0xa')]=function(_0x147b08,_0x40e322){return _0x147b08[_0x4d3a('0xb')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x275b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x37db5d,_0x26a74c){var _0xcf563c=function(_0x203b82){while(--_0x203b82){_0x37db5d['push'](_0x37db5d['shift']());}};_0xcf563c(++_0x26a74c);}(_0x275b,0xcc));var _0xb275=function(_0x17a023,_0x5b914e){_0x17a023=_0x17a023-0x0;var _0x3786ab=_0x275b[_0x17a023];return _0x3786ab;};'use strict';var _=require(_0xb275('0x0'));var util=require(_0xb275('0x1'));var logger=require(_0xb275('0x2'))(_0xb275('0x3'));var moment=require(_0xb275('0x4'));var BPromise=require(_0xb275('0x5'));var rp=require(_0xb275('0x6'));var fs=require('fs');var path=require(_0xb275('0x7'));var rimraf=require(_0xb275('0x8'));var config=require(_0xb275('0x9'));var attributes=require(_0xb275('0xa'));var integrations=require(_0xb275('0xb'));module[_0xb275('0xc')]=function(_0x573550,_0x46326e){return _0x573550[_0xb275('0xd')](_0xb275('0xe'),attributes,{'tableName':_0xb275('0xf'),'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 5101e54..f7a025d 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 _0xab53=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','model','map','attributes','then','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xab53,0x12d));var _0x3ab5=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xab53[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x3ab5('0x0'));var util=require(_0x3ab5('0x1'));var moment=require(_0x3ab5('0x2'));var BPromise=require(_0x3ab5('0x3'));var rs=require(_0x3ab5('0x4'));var fs=require('fs');var Redis=require(_0x3ab5('0x5'));var db=require(_0x3ab5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ab5('0x7'))(_0x3ab5('0x8'));var config=require('../../config/environment');var jayson=require(_0x3ab5('0x9'));var client=jayson[_0x3ab5('0xa')][_0x3ab5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40a157,_0x518ea6,_0x564577){return new BPromise(function(_0x4c460e,_0x5d61ed){return client[_0x3ab5('0xc')](_0x40a157,_0x564577)['then'](function(_0x251e33){logger[_0x3ab5('0xd')](_0x3ab5('0xe'),_0x518ea6,_0x3ab5('0xf'));logger[_0x3ab5('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x518ea6,_0x3ab5('0xf'),JSON[_0x3ab5('0x11')](_0x251e33));if(_0x251e33[_0x3ab5('0x12')]){if(_0x251e33[_0x3ab5('0x12')][_0x3ab5('0x13')]===0x1f4){logger[_0x3ab5('0x12')](_0x3ab5('0xe'),_0x518ea6,_0x251e33['error'][_0x3ab5('0x14')]);return _0x5d61ed(_0x251e33[_0x3ab5('0x12')]['message']);}logger[_0x3ab5('0x12')](_0x3ab5('0xe'),_0x518ea6,_0x251e33[_0x3ab5('0x12')]['message']);return _0x4c460e(_0x251e33[_0x3ab5('0x12')][_0x3ab5('0x14')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x518ea6,_0x3ab5('0xf'));_0x4c460e(_0x251e33['result'][_0x3ab5('0x14')]);}})[_0x3ab5('0x15')](function(_0x25f26a){logger[_0x3ab5('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x518ea6,_0x25f26a);_0x5d61ed(_0x25f26a);});});}exports[_0x3ab5('0x16')]=function(_0x5502c6){var _0x3cee68=this;return new Promise(function(_0x1dcf80,_0x59e6a4){return db[_0x3ab5('0x17')][_0x3ab5('0x18')]({'raw':_0x5502c6[_0x3ab5('0x19')]?_0x5502c6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5502c6[_0x3ab5('0x19')]?_0x5502c6['options'][_0x3ab5('0x1a')]||null:null,'attributes':_0x5502c6[_0x3ab5('0x19')]?_0x5502c6[_0x3ab5('0x19')]['attributes']||null:null,'limit':_0x5502c6[_0x3ab5('0x19')]?_0x5502c6[_0x3ab5('0x19')][_0x3ab5('0x1b')]||null:null,'include':_0x5502c6['options']?_0x5502c6[_0x3ab5('0x19')]['include']?_['map'](_0x5502c6[_0x3ab5('0x19')][_0x3ab5('0x1c')],function(_0x429b27){return{'model':db[_0x429b27[_0x3ab5('0x1d')]],'as':_0x429b27['as'],'attributes':_0x429b27['attributes'],'include':_0x429b27[_0x3ab5('0x1c')]?_[_0x3ab5('0x1e')](_0x429b27[_0x3ab5('0x1c')],function(_0x4b532d){return{'model':db[_0x4b532d[_0x3ab5('0x1d')]],'as':_0x4b532d['as'],'attributes':_0x4b532d['attributes'],'include':_0x4b532d['include']?_[_0x3ab5('0x1e')](_0x4b532d[_0x3ab5('0x1c')],function(_0x1728ad){return{'model':db[_0x1728ad[_0x3ab5('0x1d')]],'as':_0x1728ad['as'],'attributes':_0x1728ad[_0x3ab5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3ab5('0x20')](function(_0x469384){logger['info']('GetFreshdeskAccount',_0x5502c6);logger['debug'](_0x3ab5('0x16'),_0x5502c6,JSON['stringify'](_0x469384));_0x1dcf80(_0x469384);})[_0x3ab5('0x15')](function(_0x5b2998){logger[_0x3ab5('0x12')](_0x3ab5('0x16'),_0x5b2998[_0x3ab5('0x14')],_0x5502c6);_0x59e6a4(_0x3cee68[_0x3ab5('0x12')](0x1f4,_0x5b2998['message']));});});};exports['ShowFreshdeskAccount']=function(_0x15b714){var _0x1ae1c0=this;return new Promise(function(_0x3bfc57,_0x3c5836){return db['FreshdeskAccount'][_0x3ab5('0x21')]({'raw':_0x15b714[_0x3ab5('0x19')]?_0x15b714[_0x3ab5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x15b714[_0x3ab5('0x19')]?_0x15b714[_0x3ab5('0x19')][_0x3ab5('0x1a')]||null:null,'attributes':_0x15b714[_0x3ab5('0x19')]?_0x15b714['options'][_0x3ab5('0x1f')]||null:null,'include':_0x15b714[_0x3ab5('0x19')]?_0x15b714['options']['include']?_[_0x3ab5('0x1e')](_0x15b714[_0x3ab5('0x19')]['include'],function(_0x1cad83){return{'model':db[_0x1cad83[_0x3ab5('0x1d')]],'as':_0x1cad83['as'],'attributes':_0x1cad83[_0x3ab5('0x1f')],'include':_0x1cad83[_0x3ab5('0x1c')]?_[_0x3ab5('0x1e')](_0x1cad83['include'],function(_0x24fd70){return{'model':db[_0x24fd70[_0x3ab5('0x1d')]],'as':_0x24fd70['as'],'attributes':_0x24fd70[_0x3ab5('0x1f')],'include':_0x24fd70[_0x3ab5('0x1c')]?_['map'](_0x24fd70[_0x3ab5('0x1c')],function(_0x11a9b7){return{'model':db[_0x11a9b7[_0x3ab5('0x1d')]],'as':_0x11a9b7['as'],'attributes':_0x11a9b7[_0x3ab5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3ab5('0x20')](function(_0x3402ed){logger[_0x3ab5('0xd')](_0x3ab5('0x22'),_0x15b714);logger[_0x3ab5('0x10')](_0x3ab5('0x22'),_0x15b714,JSON['stringify'](_0x3402ed));_0x3bfc57(_0x3402ed);})[_0x3ab5('0x15')](function(_0x316d0e){logger[_0x3ab5('0x12')](_0x3ab5('0x22'),_0x316d0e[_0x3ab5('0x14')],_0x15b714);_0x3c5836(_0x1ae1c0['error'](0x1f4,_0x316d0e[_0x3ab5('0x14')]));});});}; \ No newline at end of file +var _0xe345=['http','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','findAll','options','where','attributes','limit','include','model','map','then','GetFreshdeskAccount','catch','FreshdeskAccount','find','debug','ShowFreshdeskAccount','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0xd00db4,_0x547dbb){var _0x588054=function(_0x2ad613){while(--_0x2ad613){_0xd00db4['push'](_0xd00db4['shift']());}};_0x588054(++_0x547dbb);}(_0xe345,0x99));var _0x5e34=function(_0x4c0ca7,_0x267486){_0x4c0ca7=_0x4c0ca7-0x0;var _0x198a33=_0xe345[_0x4c0ca7];return _0x198a33;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e34('0x0'));var BPromise=require('bluebird');var rs=require(_0x5e34('0x1'));var fs=require('fs');var Redis=require(_0x5e34('0x2'));var db=require(_0x5e34('0x3'))['db'];var utils=require(_0x5e34('0x4'));var logger=require('../../config/logger')(_0x5e34('0x5'));var config=require('../../config/environment');var jayson=require(_0x5e34('0x6'));var client=jayson['client'][_0x5e34('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7f4fcc,_0x1a7ca1,_0x1dc37f){return new BPromise(function(_0x786ddd,_0x1424d1){return client['request'](_0x7f4fcc,_0x1dc37f)['then'](function(_0x4b2a45){logger[_0x5e34('0x8')]('FreshdeskAccount,\x20%s,\x20%s',_0x1a7ca1,_0x5e34('0x9'));logger['debug'](_0x5e34('0xa'),_0x1a7ca1,_0x5e34('0x9'),JSON['stringify'](_0x4b2a45));if(_0x4b2a45[_0x5e34('0xb')]){if(_0x4b2a45[_0x5e34('0xb')][_0x5e34('0xc')]===0x1f4){logger['error'](_0x5e34('0xd'),_0x1a7ca1,_0x4b2a45[_0x5e34('0xb')][_0x5e34('0xe')]);return _0x1424d1(_0x4b2a45[_0x5e34('0xb')]['message']);}logger['error'](_0x5e34('0xd'),_0x1a7ca1,_0x4b2a45[_0x5e34('0xb')][_0x5e34('0xe')]);return _0x786ddd(_0x4b2a45['error'][_0x5e34('0xe')]);}else{logger[_0x5e34('0x8')](_0x5e34('0xd'),_0x1a7ca1,_0x5e34('0x9'));_0x786ddd(_0x4b2a45[_0x5e34('0xf')][_0x5e34('0xe')]);}})['catch'](function(_0x1c78c2){logger[_0x5e34('0xb')](_0x5e34('0xd'),_0x1a7ca1,_0x1c78c2);_0x1424d1(_0x1c78c2);});});}exports['GetFreshdeskAccount']=function(_0x190f93){var _0x38a048=this;return new Promise(function(_0xc17d65,_0x28f85d){return db['FreshdeskAccount'][_0x5e34('0x10')]({'raw':_0x190f93[_0x5e34('0x11')]?_0x190f93[_0x5e34('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x190f93['options']?_0x190f93[_0x5e34('0x11')][_0x5e34('0x12')]||null:null,'attributes':_0x190f93[_0x5e34('0x11')]?_0x190f93['options'][_0x5e34('0x13')]||null:null,'limit':_0x190f93[_0x5e34('0x11')]?_0x190f93[_0x5e34('0x11')][_0x5e34('0x14')]||null:null,'include':_0x190f93[_0x5e34('0x11')]?_0x190f93[_0x5e34('0x11')][_0x5e34('0x15')]?_['map'](_0x190f93['options'][_0x5e34('0x15')],function(_0x7e6721){return{'model':db[_0x7e6721['model']],'as':_0x7e6721['as'],'attributes':_0x7e6721[_0x5e34('0x13')],'include':_0x7e6721['include']?_['map'](_0x7e6721[_0x5e34('0x15')],function(_0x47535d){return{'model':db[_0x47535d[_0x5e34('0x16')]],'as':_0x47535d['as'],'attributes':_0x47535d[_0x5e34('0x13')],'include':_0x47535d[_0x5e34('0x15')]?_[_0x5e34('0x17')](_0x47535d[_0x5e34('0x15')],function(_0x223385){return{'model':db[_0x223385['model']],'as':_0x223385['as'],'attributes':_0x223385[_0x5e34('0x13')]};}):[]};}):[]};}):[]:[]})[_0x5e34('0x18')](function(_0x25f6c3){logger[_0x5e34('0x8')](_0x5e34('0x19'),_0x190f93);logger['debug'](_0x5e34('0x19'),_0x190f93,JSON['stringify'](_0x25f6c3));_0xc17d65(_0x25f6c3);})[_0x5e34('0x1a')](function(_0x25298a){logger[_0x5e34('0xb')](_0x5e34('0x19'),_0x25298a[_0x5e34('0xe')],_0x190f93);_0x28f85d(_0x38a048[_0x5e34('0xb')](0x1f4,_0x25298a[_0x5e34('0xe')]));});});};exports['ShowFreshdeskAccount']=function(_0x2aacb1){var _0x3609da=this;return new Promise(function(_0x211063,_0x522d41){return db[_0x5e34('0x1b')][_0x5e34('0x1c')]({'raw':_0x2aacb1[_0x5e34('0x11')]?_0x2aacb1[_0x5e34('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x2aacb1['options']?_0x2aacb1[_0x5e34('0x11')]['where']||null:null,'attributes':_0x2aacb1[_0x5e34('0x11')]?_0x2aacb1[_0x5e34('0x11')]['attributes']||null:null,'include':_0x2aacb1['options']?_0x2aacb1[_0x5e34('0x11')][_0x5e34('0x15')]?_[_0x5e34('0x17')](_0x2aacb1[_0x5e34('0x11')]['include'],function(_0x461ccc){return{'model':db[_0x461ccc[_0x5e34('0x16')]],'as':_0x461ccc['as'],'attributes':_0x461ccc[_0x5e34('0x13')],'include':_0x461ccc[_0x5e34('0x15')]?_['map'](_0x461ccc[_0x5e34('0x15')],function(_0x5f2296){return{'model':db[_0x5f2296[_0x5e34('0x16')]],'as':_0x5f2296['as'],'attributes':_0x5f2296[_0x5e34('0x13')],'include':_0x5f2296['include']?_[_0x5e34('0x17')](_0x5f2296[_0x5e34('0x15')],function(_0x2057ee){return{'model':db[_0x2057ee[_0x5e34('0x16')]],'as':_0x2057ee['as'],'attributes':_0x2057ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e34('0x18')](function(_0x32d29d){logger[_0x5e34('0x8')]('ShowFreshdeskAccount',_0x2aacb1);logger[_0x5e34('0x1d')](_0x5e34('0x1e'),_0x2aacb1,JSON[_0x5e34('0x1f')](_0x32d29d));_0x211063(_0x32d29d);})[_0x5e34('0x1a')](function(_0x3c1200){logger['error']('ShowFreshdeskAccount',_0x3c1200[_0x5e34('0xe')],_0x2aacb1);_0x522d41(_0x3609da[_0x5e34('0xb')](0x1f4,_0x3c1200[_0x5e34('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8ce66a8..5e29709 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 _0x840b=['Router','fs-extra','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','util'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x840b,0xd7));var _0xb840=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x840b[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require(_0xb840('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb840('0x1')]();var fs_extra=require(_0xb840('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb840('0x3'));var config=require('../../config/environment');var controller=require(_0xb840('0x4'));router['get']('/',auth[_0xb840('0x5')](),controller[_0xb840('0x6')]);router['get'](_0xb840('0x7'),auth[_0xb840('0x5')](),controller[_0xb840('0x8')]);router[_0xb840('0x9')](_0xb840('0xa'),auth[_0xb840('0x5')](),controller[_0xb840('0xb')]);router[_0xb840('0x9')](_0xb840('0xc'),auth['isAuthenticated'](),controller[_0xb840('0xd')]);router[_0xb840('0x9')](_0xb840('0xe'),auth[_0xb840('0x5')](),controller[_0xb840('0xf')]);router[_0xb840('0x9')](_0xb840('0x10'),auth['isAuthenticated'](),controller[_0xb840('0x11')]);router[_0xb840('0x12')]('/',auth[_0xb840('0x5')](),controller[_0xb840('0x13')]);router[_0xb840('0x12')](_0xb840('0x10'),auth[_0xb840('0x5')](),controller[_0xb840('0x14')]);router['put'](_0xb840('0x7'),auth[_0xb840('0x5')](),controller[_0xb840('0x15')]);router[_0xb840('0x16')](_0xb840('0x7'),auth['isAuthenticated'](),controller[_0xb840('0x17')]);module['exports']=router; \ No newline at end of file +var _0x014e=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','exports','multer','path'];(function(_0x2dc3ed,_0x214a1e){var _0x14525c=function(_0x1c775b){while(--_0x1c775b){_0x2dc3ed['push'](_0x2dc3ed['shift']());}};_0x14525c(++_0x214a1e);}(_0x014e,0x18e));var _0xe014=function(_0x535eba,_0x2679f8){_0x535eba=_0x535eba-0x0;var _0x4d422f=_0x014e[_0x535eba];return _0x4d422f;};'use strict';var multer=require(_0xe014('0x0'));var util=require('util');var path=require(_0xe014('0x1'));var timeout=require(_0xe014('0x2'));var express=require(_0xe014('0x3'));var router=express[_0xe014('0x4')]();var fs_extra=require(_0xe014('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe014('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0xe014('0x7')]('/',auth[_0xe014('0x8')](),controller[_0xe014('0x9')]);router[_0xe014('0x7')](_0xe014('0xa'),auth[_0xe014('0x8')](),controller[_0xe014('0xb')]);router[_0xe014('0x7')]('/:id/fields',auth[_0xe014('0x8')](),controller[_0xe014('0xc')]);router['get'](_0xe014('0xd'),auth['isAuthenticated'](),controller[_0xe014('0xe')]);router[_0xe014('0x7')](_0xe014('0xf'),auth[_0xe014('0x8')](),controller['getDescriptions']);router['get'](_0xe014('0x10'),auth[_0xe014('0x8')](),controller[_0xe014('0x11')]);router[_0xe014('0x12')]('/',auth[_0xe014('0x8')](),controller[_0xe014('0x13')]);router['post'](_0xe014('0x10'),auth['isAuthenticated'](),controller[_0xe014('0x14')]);router['put'](_0xe014('0xa'),auth[_0xe014('0x8')](),controller[_0xe014('0x15')]);router[_0xe014('0x16')](_0xe014('0xa'),auth[_0xe014('0x8')](),controller[_0xe014('0x17')]);module[_0xe014('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d22a983..15b274a 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 _0x75a3=['STRING','sequelize','exports'];(function(_0x5b445b,_0xd251da){var _0x1a40fe=function(_0x218fce){while(--_0x218fce){_0x5b445b['push'](_0x5b445b['shift']());}};_0x1a40fe(++_0xd251da);}(_0x75a3,0x6d));var _0x375a=function(_0x13e343,_0x5cfaa4){_0x13e343=_0x13e343-0x0;var _0x53f861=_0x75a3[_0x13e343];return _0x53f861;};'use strict';var Sequelize=require(_0x375a('0x0'));module[_0x375a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x375a('0x2')]}}; \ No newline at end of file +var _0x63fd=['sequelize','STRING'];(function(_0x126ce0,_0x64893e){var _0x557d79=function(_0x314875){while(--_0x314875){_0x126ce0['push'](_0x126ce0['shift']());}};_0x557d79(++_0x64893e);}(_0x63fd,0xc2));var _0xd63f=function(_0x5b7f6f,_0x23670a){_0x5b7f6f=_0x5b7f6f-0x0;var _0x77051a=_0x63fd[_0x5b7f6f];return _0x77051a;};'use strict';var Sequelize=require(_0xd63f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd63f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e69a5b2..37b1dc2 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 _0xf19c=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','keys','find','create','body','params','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis'];(function(_0x82c7c4,_0x3d9534){var _0x1cf158=function(_0x38bbef){while(--_0x38bbef){_0x82c7c4['push'](_0x82c7c4['shift']());}};_0x1cf158(++_0x3d9534);}(_0xf19c,0x93));var _0xcf19=function(_0x1b5763,_0x42dc8a){_0x1b5763=_0x1b5763-0x0;var _0xcd16bc=_0xf19c[_0x1b5763];return _0xcd16bc;};'use strict';var emlformat=require(_0xcf19('0x0'));var rimraf=require(_0xcf19('0x1'));var zipdir=require(_0xcf19('0x2'));var jsonpatch=require(_0xcf19('0x3'));var rp=require('request-promise');var moment=require(_0xcf19('0x4'));var BPromise=require(_0xcf19('0x5'));var Mustache=require(_0xcf19('0x6'));var util=require(_0xcf19('0x7'));var path=require(_0xcf19('0x8'));var sox=require('sox');var csv=require(_0xcf19('0x9'));var ejs=require(_0xcf19('0xa'));var fs=require('fs');var fs_extra=require(_0xcf19('0xb'));var _=require(_0xcf19('0xc'));var squel=require(_0xcf19('0xd'));var crypto=require(_0xcf19('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcf19('0xf'));var toCsv=require(_0xcf19('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcf19('0x10'));var authService=require(_0xcf19('0x11'));var qs=require(_0xcf19('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf19('0x13'));var logger=require(_0xcf19('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xcf19('0x15'));var licenseUtil=require(_0xcf19('0x16'));var db=require(_0xcf19('0x17'))['db'];function respondWithStatusCode(_0x4ca092,_0x69705f){_0x69705f=_0x69705f||0xcc;return function(_0x3c3e81){if(_0x3c3e81){return _0x4ca092[_0xcf19('0x18')](_0x69705f);}return _0x4ca092[_0xcf19('0x19')](_0x69705f)['end']();};}function respondWithResult(_0x39ea2a,_0x13f0d0){_0x13f0d0=_0x13f0d0||0xc8;return function(_0x59461d){if(_0x59461d){return _0x39ea2a[_0xcf19('0x19')](_0x13f0d0)[_0xcf19('0x1a')](_0x59461d);}};}function respondWithFilteredResult(_0x360fe5,_0x14c030){return function(_0x1c4aa6){if(_0x1c4aa6){var _0x47caa3=typeof _0x14c030[_0xcf19('0x1b')]===_0xcf19('0x1c')&&typeof _0x14c030[_0xcf19('0x1d')]==='undefined';var _0x1f4503=_0x1c4aa6[_0xcf19('0x1e')];var _0x474589=_0x47caa3?0x0:_0x14c030[_0xcf19('0x1b')];var _0xde0459=_0x47caa3?_0x1c4aa6[_0xcf19('0x1e')]:_0x14c030[_0xcf19('0x1b')]+_0x14c030[_0xcf19('0x1d')];var _0x4ed452;if(_0xde0459>=_0x1f4503){_0xde0459=_0x1f4503;_0x4ed452=0xc8;}else{_0x4ed452=0xce;}_0x360fe5['status'](_0x4ed452);return _0x360fe5[_0xcf19('0x1f')](_0xcf19('0x20'),_0x474589+'-'+_0xde0459+'/'+_0x1f4503)[_0xcf19('0x1a')](_0x1c4aa6);}return null;};}function patchUpdates(_0x3932d5){return function(_0x390fc1){try{jsonpatch['apply'](_0x390fc1,_0x3932d5,!![]);}catch(_0x4e0036){return BPromise[_0xcf19('0x21')](_0x4e0036);}return _0x390fc1['save']();};}function saveUpdates(_0x3e309d,_0x44cd5f){return function(_0x3999fe){if(_0x3999fe){return _0x3999fe[_0xcf19('0x22')](_0x3e309d)[_0xcf19('0x23')](function(_0x392a0f){return _0x392a0f;});}return null;};}function removeEntity(_0x4d3e22,_0x14d16d){return function(_0x501915){if(_0x501915){return _0x501915[_0xcf19('0x24')]()[_0xcf19('0x23')](function(){_0x4d3e22[_0xcf19('0x19')](0xcc)[_0xcf19('0x25')]();});}};}function handleEntityNotFound(_0x30eb63,_0x5dab60){return function(_0x258931){if(!_0x258931){_0x30eb63[_0xcf19('0x18')](0x194);}return _0x258931;};}function handleError(_0x514df4,_0x2b1b72){_0x2b1b72=_0x2b1b72||0x1f4;return function(_0x5d88fc){logger[_0xcf19('0x26')](_0x5d88fc[_0xcf19('0x27')]);if(_0x5d88fc[_0xcf19('0x28')]){delete _0x5d88fc[_0xcf19('0x28')];}_0x514df4['status'](_0x2b1b72)['send'](_0x5d88fc);};}exports[_0xcf19('0x29')]=function(_0x46ff67,_0x1a59ac){var _0x3a45f0={},_0x24fdbe={},_0x5f2397={'count':0x0,'rows':[]};var _0xe8b421=_[_0xcf19('0x2a')](db['FreshdeskConfiguration'][_0xcf19('0x2b')],function(_0x56a188){return{'name':_0x56a188[_0xcf19('0x2c')],'type':_0x56a188[_0xcf19('0x2d')][_0xcf19('0x2e')]};});_0x24fdbe['model']=_[_0xcf19('0x2a')](_0xe8b421,_0xcf19('0x28'));_0x24fdbe[_0xcf19('0x2f')]=_['keys'](_0x46ff67[_0xcf19('0x2f')]);_0x24fdbe['filters']=_[_0xcf19('0x30')](_0x24fdbe[_0xcf19('0x31')],_0x24fdbe[_0xcf19('0x2f')]);_0x3a45f0[_0xcf19('0x32')]=_['intersection'](_0x24fdbe['model'],qs[_0xcf19('0x33')](_0x46ff67['query'][_0xcf19('0x33')]));_0x3a45f0[_0xcf19('0x32')]=_0x3a45f0[_0xcf19('0x32')][_0xcf19('0x34')]?_0x3a45f0[_0xcf19('0x32')]:_0x24fdbe[_0xcf19('0x31')];if(!_0x46ff67[_0xcf19('0x2f')]['hasOwnProperty'](_0xcf19('0x35'))){_0x3a45f0[_0xcf19('0x1d')]=qs[_0xcf19('0x1d')](_0x46ff67[_0xcf19('0x2f')][_0xcf19('0x1d')]);_0x3a45f0[_0xcf19('0x1b')]=qs[_0xcf19('0x1b')](_0x46ff67[_0xcf19('0x2f')][_0xcf19('0x1b')]);}_0x3a45f0[_0xcf19('0x36')]=qs[_0xcf19('0x37')](_0x46ff67[_0xcf19('0x2f')][_0xcf19('0x37')]);_0x3a45f0['where']=qs[_0xcf19('0x38')](_[_0xcf19('0x39')](_0x46ff67['query'],_0x24fdbe[_0xcf19('0x38')]),_0xe8b421);if(_0x46ff67[_0xcf19('0x2f')][_0xcf19('0x3a')]){_0x3a45f0[_0xcf19('0x3b')]=_[_0xcf19('0x3c')](_0x3a45f0[_0xcf19('0x3b')],{'$or':_[_0xcf19('0x2a')](_0xe8b421,function(_0xfe5245){if(_0xfe5245['type']!=='VIRTUAL'){var _0xc96c26={};_0xc96c26[_0xfe5245[_0xcf19('0x28')]]={'$like':'%'+_0x46ff67[_0xcf19('0x2f')][_0xcf19('0x3a')]+'%'};return _0xc96c26;}})});}_0x3a45f0=_[_0xcf19('0x3c')]({},_0x3a45f0,_0x46ff67[_0xcf19('0x3d')]);var _0x44c38a={'where':_0x3a45f0['where']};return db[_0xcf19('0x3e')][_0xcf19('0x1e')](_0x44c38a)['then'](function(_0x3acfa2){_0x5f2397[_0xcf19('0x1e')]=_0x3acfa2;if(_0x46ff67['query'][_0xcf19('0x3f')]){_0x3a45f0[_0xcf19('0x40')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xcf19('0x41')](_0x3a45f0);})[_0xcf19('0x23')](function(_0x256770){_0x5f2397[_0xcf19('0x42')]=_0x256770;return _0x5f2397;})[_0xcf19('0x23')](respondWithFilteredResult(_0x1a59ac,_0x3a45f0))[_0xcf19('0x43')](handleError(_0x1a59ac,null));};exports['show']=function(_0x38fa91,_0x42c1eb){var _0x3d5d4a={'raw':![],'where':{'id':_0x38fa91['params']['id']}},_0x47ee02={};_0x47ee02[_0xcf19('0x31')]=_['keys'](db[_0xcf19('0x3e')][_0xcf19('0x2b')]);_0x47ee02[_0xcf19('0x2f')]=_[_0xcf19('0x44')](_0x38fa91[_0xcf19('0x2f')]);_0x47ee02[_0xcf19('0x38')]=_[_0xcf19('0x30')](_0x47ee02[_0xcf19('0x31')],_0x47ee02[_0xcf19('0x2f')]);_0x3d5d4a['attributes']=_['intersection'](_0x47ee02[_0xcf19('0x31')],qs[_0xcf19('0x33')](_0x38fa91['query'][_0xcf19('0x33')]));_0x3d5d4a[_0xcf19('0x32')]=_0x3d5d4a[_0xcf19('0x32')][_0xcf19('0x34')]?_0x3d5d4a['attributes']:_0x47ee02[_0xcf19('0x31')];if(_0x38fa91['query'][_0xcf19('0x3f')]){_0x3d5d4a[_0xcf19('0x40')]=[{'all':!![]}];}_0x3d5d4a=_[_0xcf19('0x3c')]({},_0x3d5d4a,_0x38fa91[_0xcf19('0x3d')]);return db[_0xcf19('0x3e')][_0xcf19('0x45')](_0x3d5d4a)[_0xcf19('0x23')](handleEntityNotFound(_0x42c1eb,null))[_0xcf19('0x23')](respondWithResult(_0x42c1eb,null))[_0xcf19('0x43')](handleError(_0x42c1eb,null));};exports[_0xcf19('0x46')]=function(_0x303abc,_0x3bf820){return db[_0xcf19('0x3e')][_0xcf19('0x46')](_0x303abc[_0xcf19('0x47')],{})['then'](respondWithResult(_0x3bf820,0xc9))[_0xcf19('0x43')](handleError(_0x3bf820,null));};exports[_0xcf19('0x22')]=function(_0x235485,_0x298c1d){if(_0x235485[_0xcf19('0x47')]['id']){delete _0x235485[_0xcf19('0x47')]['id'];}return db[_0xcf19('0x3e')][_0xcf19('0x45')]({'where':{'id':_0x235485['params']['id']}})[_0xcf19('0x23')](handleEntityNotFound(_0x298c1d,null))['then'](saveUpdates(_0x235485[_0xcf19('0x47')],null))['then'](respondWithResult(_0x298c1d,null))[_0xcf19('0x43')](handleError(_0x298c1d,null));};exports['destroy']=function(_0x1dfa8f,_0x1ad2c5){return db[_0xcf19('0x3e')][_0xcf19('0x45')]({'where':{'id':_0x1dfa8f[_0xcf19('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ad2c5,null))[_0xcf19('0x23')](removeEntity(_0x1ad2c5,null))['catch'](handleError(_0x1ad2c5,null));};exports['getFields']=function(_0x4bc51a,_0x27805a,_0x27f7f8){var _0x1fcce5={};var _0x42410d={};var _0x22c1d5;var _0x2192fc;return db[_0xcf19('0x3e')][_0xcf19('0x49')]({'where':{'id':_0x4bc51a[_0xcf19('0x48')]['id']}})[_0xcf19('0x23')](handleEntityNotFound(_0x27805a,null))[_0xcf19('0x23')](function(_0x43ed81){if(_0x43ed81){_0x22c1d5=_0x43ed81;_0x42410d['model']=_[_0xcf19('0x44')](db[_0xcf19('0x4a')][_0xcf19('0x2b')]);_0x42410d[_0xcf19('0x2f')]=_[_0xcf19('0x44')](_0x4bc51a[_0xcf19('0x2f')]);_0x42410d[_0xcf19('0x38')]=_[_0xcf19('0x30')](_0x42410d['model'],_0x42410d['query']);_0x1fcce5[_0xcf19('0x32')]=_[_0xcf19('0x30')](_0x42410d['model'],qs[_0xcf19('0x33')](_0x4bc51a[_0xcf19('0x2f')]['fields']));_0x1fcce5[_0xcf19('0x32')]=_0x1fcce5[_0xcf19('0x32')][_0xcf19('0x34')]?_0x1fcce5[_0xcf19('0x32')]:_0x42410d[_0xcf19('0x31')];_0x1fcce5[_0xcf19('0x36')]=qs[_0xcf19('0x37')](_0x4bc51a[_0xcf19('0x2f')][_0xcf19('0x37')]);_0x1fcce5[_0xcf19('0x3b')]=qs['filters'](_[_0xcf19('0x39')](_0x4bc51a[_0xcf19('0x2f')],_0x42410d[_0xcf19('0x38')]));if(_0x4bc51a[_0xcf19('0x2f')][_0xcf19('0x3a')]){_0x1fcce5[_0xcf19('0x3b')]=_['merge'](_0x1fcce5[_0xcf19('0x3b')],{'$or':_[_0xcf19('0x2a')](_0x1fcce5[_0xcf19('0x32')],function(_0x310784){var _0x4dacc8={};_0x4dacc8[_0x310784]={'$like':'%'+_0x4bc51a[_0xcf19('0x2f')]['filter']+'%'};return _0x4dacc8;})});}_0x1fcce5=_[_0xcf19('0x3c')]({},_0x1fcce5,_0x4bc51a[_0xcf19('0x3d')]);return _0x22c1d5['getFields'](_0x1fcce5);}})[_0xcf19('0x23')](function(_0x1efd85){if(_0x1efd85){_0x2192fc=_0x1efd85['length'];if(!_0x4bc51a[_0xcf19('0x2f')][_0xcf19('0x4b')](_0xcf19('0x35'))){_0x1fcce5[_0xcf19('0x1d')]=qs[_0xcf19('0x1d')](_0x4bc51a[_0xcf19('0x2f')][_0xcf19('0x1d')]);_0x1fcce5[_0xcf19('0x1b')]=qs['offset'](_0x4bc51a[_0xcf19('0x2f')][_0xcf19('0x1b')]);}return _0x22c1d5['getFields'](_0x1fcce5);}})[_0xcf19('0x23')](function(_0x2921da){if(_0x2921da){return _0x2921da?{'count':_0x2192fc,'rows':_0x2921da}:null;}})[_0xcf19('0x23')](respondWithResult(_0x27805a,null))[_0xcf19('0x43')](handleError(_0x27805a,null));};exports[_0xcf19('0x4c')]=function(_0x54a420,_0x688cc2,_0x15db70){var _0x3257ec={};var _0x5271b1={};var _0x42d43b;var _0x2ba747;return db[_0xcf19('0x3e')]['findOne']({'where':{'id':_0x54a420[_0xcf19('0x48')]['id']}})[_0xcf19('0x23')](handleEntityNotFound(_0x688cc2,null))[_0xcf19('0x23')](function(_0x210176){if(_0x210176){_0x42d43b=_0x210176;_0x5271b1[_0xcf19('0x31')]=_[_0xcf19('0x44')](db[_0xcf19('0x4a')]['rawAttributes']);_0x5271b1[_0xcf19('0x2f')]=_[_0xcf19('0x44')](_0x54a420[_0xcf19('0x2f')]);_0x5271b1[_0xcf19('0x38')]=_[_0xcf19('0x30')](_0x5271b1[_0xcf19('0x31')],_0x5271b1[_0xcf19('0x2f')]);_0x3257ec[_0xcf19('0x32')]=_[_0xcf19('0x30')](_0x5271b1['model'],qs[_0xcf19('0x33')](_0x54a420[_0xcf19('0x2f')][_0xcf19('0x33')]));_0x3257ec[_0xcf19('0x32')]=_0x3257ec[_0xcf19('0x32')][_0xcf19('0x34')]?_0x3257ec[_0xcf19('0x32')]:_0x5271b1[_0xcf19('0x31')];_0x3257ec[_0xcf19('0x36')]=qs['sort'](_0x54a420[_0xcf19('0x2f')][_0xcf19('0x37')]);_0x3257ec['where']=qs['filters'](_['pick'](_0x54a420[_0xcf19('0x2f')],_0x5271b1['filters']));if(_0x54a420[_0xcf19('0x2f')][_0xcf19('0x3a')]){_0x3257ec[_0xcf19('0x3b')]=_[_0xcf19('0x3c')](_0x3257ec[_0xcf19('0x3b')],{'$or':_[_0xcf19('0x2a')](_0x3257ec[_0xcf19('0x32')],function(_0x1d744f){var _0x15d85c={};_0x15d85c[_0x1d744f]={'$like':'%'+_0x54a420[_0xcf19('0x2f')][_0xcf19('0x3a')]+'%'};return _0x15d85c;})});}_0x3257ec=_[_0xcf19('0x3c')]({},_0x3257ec,_0x54a420[_0xcf19('0x3d')]);return _0x42d43b[_0xcf19('0x4c')](_0x3257ec);}})[_0xcf19('0x23')](function(_0x316e21){if(_0x316e21){_0x2ba747=_0x316e21[_0xcf19('0x34')];if(!_0x54a420['query'][_0xcf19('0x4b')](_0xcf19('0x35'))){_0x3257ec['limit']=qs['limit'](_0x54a420[_0xcf19('0x2f')][_0xcf19('0x1d')]);_0x3257ec[_0xcf19('0x1b')]=qs['offset'](_0x54a420['query']['offset']);}return _0x42d43b[_0xcf19('0x4c')](_0x3257ec);}})['then'](function(_0x1540b9){if(_0x1540b9){return _0x1540b9?{'count':_0x2ba747,'rows':_0x1540b9}:null;}})[_0xcf19('0x23')](respondWithResult(_0x688cc2,null))[_0xcf19('0x43')](handleError(_0x688cc2,null));};exports['getDescriptions']=function(_0x2a7707,_0x4b8a0b,_0x542989){var _0x5393b1={};var _0x4440b5={};var _0x31b844;var _0x285103;return db[_0xcf19('0x3e')][_0xcf19('0x49')]({'where':{'id':_0x2a7707[_0xcf19('0x48')]['id']}})[_0xcf19('0x23')](handleEntityNotFound(_0x4b8a0b,null))[_0xcf19('0x23')](function(_0x3e3a63){if(_0x3e3a63){_0x31b844=_0x3e3a63;_0x4440b5['model']=_[_0xcf19('0x44')](db[_0xcf19('0x4a')][_0xcf19('0x2b')]);_0x4440b5[_0xcf19('0x2f')]=_[_0xcf19('0x44')](_0x2a7707[_0xcf19('0x2f')]);_0x4440b5['filters']=_[_0xcf19('0x30')](_0x4440b5[_0xcf19('0x31')],_0x4440b5['query']);_0x5393b1[_0xcf19('0x32')]=_[_0xcf19('0x30')](_0x4440b5[_0xcf19('0x31')],qs[_0xcf19('0x33')](_0x2a7707['query'][_0xcf19('0x33')]));_0x5393b1[_0xcf19('0x32')]=_0x5393b1[_0xcf19('0x32')]['length']?_0x5393b1[_0xcf19('0x32')]:_0x4440b5[_0xcf19('0x31')];_0x5393b1[_0xcf19('0x36')]=qs[_0xcf19('0x37')](_0x2a7707[_0xcf19('0x2f')]['sort']);_0x5393b1['where']=qs[_0xcf19('0x38')](_[_0xcf19('0x39')](_0x2a7707[_0xcf19('0x2f')],_0x4440b5[_0xcf19('0x38')]));if(_0x2a7707[_0xcf19('0x2f')][_0xcf19('0x3a')]){_0x5393b1[_0xcf19('0x3b')]=_['merge'](_0x5393b1[_0xcf19('0x3b')],{'$or':_[_0xcf19('0x2a')](_0x5393b1[_0xcf19('0x32')],function(_0x4c7e99){var _0x54cbd6={};_0x54cbd6[_0x4c7e99]={'$like':'%'+_0x2a7707[_0xcf19('0x2f')][_0xcf19('0x3a')]+'%'};return _0x54cbd6;})});}_0x5393b1=_[_0xcf19('0x3c')]({},_0x5393b1,_0x2a7707[_0xcf19('0x3d')]);return _0x31b844[_0xcf19('0x4d')](_0x5393b1);}})[_0xcf19('0x23')](function(_0x4590a2){if(_0x4590a2){_0x285103=_0x4590a2[_0xcf19('0x34')];if(!_0x2a7707[_0xcf19('0x2f')][_0xcf19('0x4b')](_0xcf19('0x35'))){_0x5393b1[_0xcf19('0x1d')]=qs[_0xcf19('0x1d')](_0x2a7707[_0xcf19('0x2f')][_0xcf19('0x1d')]);_0x5393b1[_0xcf19('0x1b')]=qs[_0xcf19('0x1b')](_0x2a7707[_0xcf19('0x2f')][_0xcf19('0x1b')]);}return _0x31b844['getDescriptions'](_0x5393b1);}})[_0xcf19('0x23')](function(_0x14b6a4){if(_0x14b6a4){return _0x14b6a4?{'count':_0x285103,'rows':_0x14b6a4}:null;}})[_0xcf19('0x23')](respondWithResult(_0x4b8a0b,null))[_0xcf19('0x43')](handleError(_0x4b8a0b,null));};exports[_0xcf19('0x4e')]=function(_0x29b9aa,_0x5f31c0,_0x41b4b6){var _0x5653ea={};var _0x414e7e={};var _0x41e81a;var _0x4420f4;return db[_0xcf19('0x3e')][_0xcf19('0x49')]({'where':{'id':_0x29b9aa['params']['id']}})[_0xcf19('0x23')](handleEntityNotFound(_0x5f31c0,null))[_0xcf19('0x23')](function(_0x2d462b){if(_0x2d462b){_0x41e81a=_0x2d462b;_0x414e7e[_0xcf19('0x31')]=_[_0xcf19('0x44')](db[_0xcf19('0x4f')][_0xcf19('0x2b')]);_0x414e7e[_0xcf19('0x2f')]=_['keys'](_0x29b9aa[_0xcf19('0x2f')]);_0x414e7e['filters']=_[_0xcf19('0x30')](_0x414e7e[_0xcf19('0x31')],_0x414e7e['query']);_0x5653ea['attributes']=_[_0xcf19('0x30')](_0x414e7e['model'],qs[_0xcf19('0x33')](_0x29b9aa['query']['fields']));_0x5653ea['attributes']=_0x5653ea[_0xcf19('0x32')][_0xcf19('0x34')]?_0x5653ea[_0xcf19('0x32')]:_0x414e7e[_0xcf19('0x31')];_0x5653ea['order']=qs[_0xcf19('0x37')](_0x29b9aa[_0xcf19('0x2f')][_0xcf19('0x37')]);_0x5653ea['where']=qs['filters'](_[_0xcf19('0x39')](_0x29b9aa[_0xcf19('0x2f')],_0x414e7e[_0xcf19('0x38')]));if(_0x29b9aa[_0xcf19('0x2f')][_0xcf19('0x3a')]){_0x5653ea[_0xcf19('0x3b')]=_[_0xcf19('0x3c')](_0x5653ea[_0xcf19('0x3b')],{'$or':_['map'](_0x5653ea[_0xcf19('0x32')],function(_0x3e3b16){var _0x4a937d={};_0x4a937d[_0x3e3b16]={'$like':'%'+_0x29b9aa[_0xcf19('0x2f')][_0xcf19('0x3a')]+'%'};return _0x4a937d;})});}_0x5653ea=_[_0xcf19('0x3c')]({},_0x5653ea,_0x29b9aa[_0xcf19('0x3d')]);return _0x41e81a[_0xcf19('0x4e')](_0x5653ea);}})['then'](function(_0x27251b){if(_0x27251b){_0x4420f4=_0x27251b[_0xcf19('0x34')];if(!_0x29b9aa[_0xcf19('0x2f')]['hasOwnProperty']('nolimit')){_0x5653ea[_0xcf19('0x1d')]=qs[_0xcf19('0x1d')](_0x29b9aa['query'][_0xcf19('0x1d')]);_0x5653ea['offset']=qs['offset'](_0x29b9aa[_0xcf19('0x2f')]['offset']);}return _0x41e81a[_0xcf19('0x4e')](_0x5653ea);}})[_0xcf19('0x23')](function(_0x26a884){if(_0x26a884){return _0x26a884?{'count':_0x4420f4,'rows':_0x26a884}:null;}})[_0xcf19('0x23')](respondWithResult(_0x5f31c0,null))[_0xcf19('0x43')](handleError(_0x5f31c0,null));};exports[_0xcf19('0x50')]=function(_0x19b01b,_0x4a722f,_0x2fb64f){if(_0x19b01b[_0xcf19('0x47')]['id']){delete _0x19b01b[_0xcf19('0x47')]['id'];}return db[_0xcf19('0x3e')][_0xcf19('0x49')]({'where':{'id':_0x19b01b['params']['id']}})[_0xcf19('0x23')](handleEntityNotFound(_0x4a722f,null))['then'](function(_0x526c2b){if(_0x526c2b){return _0x526c2b[_0xcf19('0x50')](_0x19b01b['body'][_0xcf19('0x51')]||[]);}return null;})[_0xcf19('0x23')](respondWithResult(_0x4a722f,null))[_0xcf19('0x43')](handleError(_0x4a722f,null));}; \ No newline at end of file +var _0x6003=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','create','body','find','params','getFields','findOne','FreshdeskField','pick','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0x6003,0xa3));var _0x3600=function(_0x12e0b5,_0x177a9f){_0x12e0b5=_0x12e0b5-0x0;var _0x5ac247=_0x6003[_0x12e0b5];return _0x5ac247;};'use strict';var emlformat=require(_0x3600('0x0'));var rimraf=require(_0x3600('0x1'));var zipdir=require(_0x3600('0x2'));var jsonpatch=require(_0x3600('0x3'));var rp=require(_0x3600('0x4'));var moment=require(_0x3600('0x5'));var BPromise=require(_0x3600('0x6'));var Mustache=require(_0x3600('0x7'));var util=require(_0x3600('0x8'));var path=require('path');var sox=require(_0x3600('0x9'));var csv=require(_0x3600('0xa'));var ejs=require(_0x3600('0xb'));var fs=require('fs');var fs_extra=require(_0x3600('0xc'));var _=require(_0x3600('0xd'));var squel=require(_0x3600('0xe'));var crypto=require(_0x3600('0xf'));var jsforce=require(_0x3600('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3600('0xa'));var querystring=require(_0x3600('0x11'));var Papa=require(_0x3600('0x12'));var Redis=require('ioredis');var authService=require(_0x3600('0x13'));var qs=require(_0x3600('0x14'));var as=require(_0x3600('0x15'));var hardwareService=require(_0x3600('0x16'));var logger=require(_0x3600('0x17'))(_0x3600('0x18'));var utils=require(_0x3600('0x19'));var config=require(_0x3600('0x1a'));var licenseUtil=require(_0x3600('0x1b'));var db=require(_0x3600('0x1c'))['db'];function respondWithStatusCode(_0x5f592e,_0x4eed0b){_0x4eed0b=_0x4eed0b||0xcc;return function(_0x4c3f06){if(_0x4c3f06){return _0x5f592e[_0x3600('0x1d')](_0x4eed0b);}return _0x5f592e[_0x3600('0x1e')](_0x4eed0b)['end']();};}function respondWithResult(_0x509bef,_0x4d9602){_0x4d9602=_0x4d9602||0xc8;return function(_0x5adb92){if(_0x5adb92){return _0x509bef[_0x3600('0x1e')](_0x4d9602)[_0x3600('0x1f')](_0x5adb92);}};}function respondWithFilteredResult(_0x5a3fd9,_0x589d02){return function(_0x1bd135){if(_0x1bd135){var _0xb37834=typeof _0x589d02['offset']===_0x3600('0x20')&&typeof _0x589d02[_0x3600('0x21')]==='undefined';var _0x5c9871=_0x1bd135['count'];var _0x4d63fd=_0xb37834?0x0:_0x589d02[_0x3600('0x22')];var _0x1c70da=_0xb37834?_0x1bd135[_0x3600('0x23')]:_0x589d02[_0x3600('0x22')]+_0x589d02[_0x3600('0x21')];var _0x591c37;if(_0x1c70da>=_0x5c9871){_0x1c70da=_0x5c9871;_0x591c37=0xc8;}else{_0x591c37=0xce;}_0x5a3fd9[_0x3600('0x1e')](_0x591c37);return _0x5a3fd9[_0x3600('0x24')](_0x3600('0x25'),_0x4d63fd+'-'+_0x1c70da+'/'+_0x5c9871)['json'](_0x1bd135);}return null;};}function patchUpdates(_0x43fc52){return function(_0x41ea91){try{jsonpatch['apply'](_0x41ea91,_0x43fc52,!![]);}catch(_0x4a09f3){return BPromise['reject'](_0x4a09f3);}return _0x41ea91['save']();};}function saveUpdates(_0xde059e,_0x36cb5e){return function(_0x2c3a73){if(_0x2c3a73){return _0x2c3a73[_0x3600('0x26')](_0xde059e)[_0x3600('0x27')](function(_0x1b984a){return _0x1b984a;});}return null;};}function removeEntity(_0x222ce1,_0x26a328){return function(_0x3bc0b3){if(_0x3bc0b3){return _0x3bc0b3[_0x3600('0x28')]()['then'](function(){_0x222ce1[_0x3600('0x1e')](0xcc)[_0x3600('0x29')]();});}};}function handleEntityNotFound(_0x2066ea,_0x358056){return function(_0xe4da8d){if(!_0xe4da8d){_0x2066ea[_0x3600('0x1d')](0x194);}return _0xe4da8d;};}function handleError(_0x35dd47,_0x92c3cf){_0x92c3cf=_0x92c3cf||0x1f4;return function(_0x25bc3c){logger[_0x3600('0x2a')](_0x25bc3c[_0x3600('0x2b')]);if(_0x25bc3c['name']){delete _0x25bc3c[_0x3600('0x2c')];}_0x35dd47[_0x3600('0x1e')](_0x92c3cf)[_0x3600('0x2d')](_0x25bc3c);};}exports[_0x3600('0x2e')]=function(_0x599ca0,_0x23433b){var _0x14d1a6={},_0x18cdc3={},_0x11699b={'count':0x0,'rows':[]};var _0x574265=_[_0x3600('0x2f')](db[_0x3600('0x30')][_0x3600('0x31')],function(_0x3f9f1e){return{'name':_0x3f9f1e['fieldName'],'type':_0x3f9f1e['type']['key']};});_0x18cdc3[_0x3600('0x32')]=_[_0x3600('0x2f')](_0x574265,'name');_0x18cdc3[_0x3600('0x33')]=_['keys'](_0x599ca0[_0x3600('0x33')]);_0x18cdc3[_0x3600('0x34')]=_[_0x3600('0x35')](_0x18cdc3[_0x3600('0x32')],_0x18cdc3[_0x3600('0x33')]);_0x14d1a6[_0x3600('0x36')]=_[_0x3600('0x35')](_0x18cdc3[_0x3600('0x32')],qs[_0x3600('0x37')](_0x599ca0[_0x3600('0x33')][_0x3600('0x37')]));_0x14d1a6[_0x3600('0x36')]=_0x14d1a6[_0x3600('0x36')][_0x3600('0x38')]?_0x14d1a6[_0x3600('0x36')]:_0x18cdc3[_0x3600('0x32')];if(!_0x599ca0[_0x3600('0x33')][_0x3600('0x39')]('nolimit')){_0x14d1a6[_0x3600('0x21')]=qs[_0x3600('0x21')](_0x599ca0['query']['limit']);_0x14d1a6[_0x3600('0x22')]=qs[_0x3600('0x22')](_0x599ca0[_0x3600('0x33')][_0x3600('0x22')]);}_0x14d1a6[_0x3600('0x3a')]=qs[_0x3600('0x3b')](_0x599ca0[_0x3600('0x33')][_0x3600('0x3b')]);_0x14d1a6[_0x3600('0x3c')]=qs['filters'](_['pick'](_0x599ca0[_0x3600('0x33')],_0x18cdc3['filters']),_0x574265);if(_0x599ca0[_0x3600('0x33')]['filter']){_0x14d1a6[_0x3600('0x3c')]=_[_0x3600('0x3d')](_0x14d1a6[_0x3600('0x3c')],{'$or':_[_0x3600('0x2f')](_0x574265,function(_0x1a0965){if(_0x1a0965['type']!==_0x3600('0x3e')){var _0x2978f6={};_0x2978f6[_0x1a0965['name']]={'$like':'%'+_0x599ca0[_0x3600('0x33')][_0x3600('0x3f')]+'%'};return _0x2978f6;}})});}_0x14d1a6=_[_0x3600('0x3d')]({},_0x14d1a6,_0x599ca0[_0x3600('0x40')]);var _0x13671f={'where':_0x14d1a6[_0x3600('0x3c')]};return db[_0x3600('0x30')]['count'](_0x13671f)[_0x3600('0x27')](function(_0x112d8a){_0x11699b[_0x3600('0x23')]=_0x112d8a;if(_0x599ca0[_0x3600('0x33')]['includeAll']){_0x14d1a6[_0x3600('0x41')]=[{'all':!![]}];}return db[_0x3600('0x30')][_0x3600('0x42')](_0x14d1a6);})['then'](function(_0x56dc87){_0x11699b[_0x3600('0x43')]=_0x56dc87;return _0x11699b;})['then'](respondWithFilteredResult(_0x23433b,_0x14d1a6))[_0x3600('0x44')](handleError(_0x23433b,null));};exports[_0x3600('0x45')]=function(_0xb580a6,_0x3930a7){var _0x2ea8a2={'raw':![],'where':{'id':_0xb580a6['params']['id']}},_0x2f916f={};_0x2f916f['model']=_[_0x3600('0x46')](db['FreshdeskConfiguration'][_0x3600('0x31')]);_0x2f916f[_0x3600('0x33')]=_[_0x3600('0x46')](_0xb580a6[_0x3600('0x33')]);_0x2f916f[_0x3600('0x34')]=_[_0x3600('0x35')](_0x2f916f[_0x3600('0x32')],_0x2f916f['query']);_0x2ea8a2[_0x3600('0x36')]=_[_0x3600('0x35')](_0x2f916f[_0x3600('0x32')],qs[_0x3600('0x37')](_0xb580a6['query'][_0x3600('0x37')]));_0x2ea8a2[_0x3600('0x36')]=_0x2ea8a2[_0x3600('0x36')][_0x3600('0x38')]?_0x2ea8a2[_0x3600('0x36')]:_0x2f916f['model'];if(_0xb580a6[_0x3600('0x33')]['includeAll']){_0x2ea8a2[_0x3600('0x41')]=[{'all':!![]}];}_0x2ea8a2=_[_0x3600('0x3d')]({},_0x2ea8a2,_0xb580a6[_0x3600('0x40')]);return db[_0x3600('0x30')]['find'](_0x2ea8a2)[_0x3600('0x27')](handleEntityNotFound(_0x3930a7,null))['then'](respondWithResult(_0x3930a7,null))[_0x3600('0x44')](handleError(_0x3930a7,null));};exports[_0x3600('0x47')]=function(_0x4b9f59,_0x259bf0){return db[_0x3600('0x30')]['create'](_0x4b9f59[_0x3600('0x48')],{})[_0x3600('0x27')](respondWithResult(_0x259bf0,0xc9))[_0x3600('0x44')](handleError(_0x259bf0,null));};exports[_0x3600('0x26')]=function(_0x2260c9,_0x1aabe3){if(_0x2260c9[_0x3600('0x48')]['id']){delete _0x2260c9[_0x3600('0x48')]['id'];}return db[_0x3600('0x30')][_0x3600('0x49')]({'where':{'id':_0x2260c9[_0x3600('0x4a')]['id']}})[_0x3600('0x27')](handleEntityNotFound(_0x1aabe3,null))[_0x3600('0x27')](saveUpdates(_0x2260c9['body'],null))['then'](respondWithResult(_0x1aabe3,null))[_0x3600('0x44')](handleError(_0x1aabe3,null));};exports[_0x3600('0x28')]=function(_0x4bf15d,_0x15ce74){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x4bf15d[_0x3600('0x4a')]['id']}})[_0x3600('0x27')](handleEntityNotFound(_0x15ce74,null))[_0x3600('0x27')](removeEntity(_0x15ce74,null))[_0x3600('0x44')](handleError(_0x15ce74,null));};exports[_0x3600('0x4b')]=function(_0x119bec,_0x51aa1b,_0x591cc1){var _0x4625b8={};var _0x376ca2={};var _0x432db5;var _0x3136a2;return db[_0x3600('0x30')][_0x3600('0x4c')]({'where':{'id':_0x119bec[_0x3600('0x4a')]['id']}})[_0x3600('0x27')](handleEntityNotFound(_0x51aa1b,null))['then'](function(_0x2050bc){if(_0x2050bc){_0x432db5=_0x2050bc;_0x376ca2['model']=_['keys'](db[_0x3600('0x4d')][_0x3600('0x31')]);_0x376ca2['query']=_[_0x3600('0x46')](_0x119bec['query']);_0x376ca2[_0x3600('0x34')]=_['intersection'](_0x376ca2[_0x3600('0x32')],_0x376ca2[_0x3600('0x33')]);_0x4625b8[_0x3600('0x36')]=_[_0x3600('0x35')](_0x376ca2[_0x3600('0x32')],qs[_0x3600('0x37')](_0x119bec[_0x3600('0x33')][_0x3600('0x37')]));_0x4625b8[_0x3600('0x36')]=_0x4625b8[_0x3600('0x36')][_0x3600('0x38')]?_0x4625b8[_0x3600('0x36')]:_0x376ca2[_0x3600('0x32')];_0x4625b8[_0x3600('0x3a')]=qs[_0x3600('0x3b')](_0x119bec['query'][_0x3600('0x3b')]);_0x4625b8[_0x3600('0x3c')]=qs[_0x3600('0x34')](_[_0x3600('0x4e')](_0x119bec[_0x3600('0x33')],_0x376ca2['filters']));if(_0x119bec[_0x3600('0x33')][_0x3600('0x3f')]){_0x4625b8[_0x3600('0x3c')]=_[_0x3600('0x3d')](_0x4625b8['where'],{'$or':_[_0x3600('0x2f')](_0x4625b8['attributes'],function(_0x625b46){var _0x270838={};_0x270838[_0x625b46]={'$like':'%'+_0x119bec[_0x3600('0x33')][_0x3600('0x3f')]+'%'};return _0x270838;})});}_0x4625b8=_[_0x3600('0x3d')]({},_0x4625b8,_0x119bec[_0x3600('0x40')]);return _0x432db5[_0x3600('0x4b')](_0x4625b8);}})[_0x3600('0x27')](function(_0x1aad83){if(_0x1aad83){_0x3136a2=_0x1aad83[_0x3600('0x38')];if(!_0x119bec[_0x3600('0x33')][_0x3600('0x39')](_0x3600('0x4f'))){_0x4625b8['limit']=qs[_0x3600('0x21')](_0x119bec[_0x3600('0x33')]['limit']);_0x4625b8[_0x3600('0x22')]=qs[_0x3600('0x22')](_0x119bec[_0x3600('0x33')][_0x3600('0x22')]);}return _0x432db5[_0x3600('0x4b')](_0x4625b8);}})['then'](function(_0x5874a2){if(_0x5874a2){return _0x5874a2?{'count':_0x3136a2,'rows':_0x5874a2}:null;}})[_0x3600('0x27')](respondWithResult(_0x51aa1b,null))[_0x3600('0x44')](handleError(_0x51aa1b,null));};exports['getSubjects']=function(_0x182ef6,_0x54a29c,_0x59d23c){var _0x5f0847={};var _0x2209f9={};var _0x50133e;var _0x22a556;return db[_0x3600('0x30')]['findOne']({'where':{'id':_0x182ef6['params']['id']}})[_0x3600('0x27')](handleEntityNotFound(_0x54a29c,null))[_0x3600('0x27')](function(_0x4b934e){if(_0x4b934e){_0x50133e=_0x4b934e;_0x2209f9['model']=_[_0x3600('0x46')](db[_0x3600('0x4d')]['rawAttributes']);_0x2209f9[_0x3600('0x33')]=_['keys'](_0x182ef6[_0x3600('0x33')]);_0x2209f9[_0x3600('0x34')]=_['intersection'](_0x2209f9[_0x3600('0x32')],_0x2209f9[_0x3600('0x33')]);_0x5f0847['attributes']=_[_0x3600('0x35')](_0x2209f9[_0x3600('0x32')],qs[_0x3600('0x37')](_0x182ef6[_0x3600('0x33')][_0x3600('0x37')]));_0x5f0847[_0x3600('0x36')]=_0x5f0847[_0x3600('0x36')]['length']?_0x5f0847[_0x3600('0x36')]:_0x2209f9[_0x3600('0x32')];_0x5f0847[_0x3600('0x3a')]=qs[_0x3600('0x3b')](_0x182ef6[_0x3600('0x33')]['sort']);_0x5f0847[_0x3600('0x3c')]=qs[_0x3600('0x34')](_[_0x3600('0x4e')](_0x182ef6[_0x3600('0x33')],_0x2209f9[_0x3600('0x34')]));if(_0x182ef6[_0x3600('0x33')][_0x3600('0x3f')]){_0x5f0847[_0x3600('0x3c')]=_['merge'](_0x5f0847['where'],{'$or':_[_0x3600('0x2f')](_0x5f0847['attributes'],function(_0x3fd80d){var _0x39ac37={};_0x39ac37[_0x3fd80d]={'$like':'%'+_0x182ef6[_0x3600('0x33')][_0x3600('0x3f')]+'%'};return _0x39ac37;})});}_0x5f0847=_[_0x3600('0x3d')]({},_0x5f0847,_0x182ef6[_0x3600('0x40')]);return _0x50133e[_0x3600('0x50')](_0x5f0847);}})['then'](function(_0xdad824){if(_0xdad824){_0x22a556=_0xdad824['length'];if(!_0x182ef6['query'][_0x3600('0x39')]('nolimit')){_0x5f0847[_0x3600('0x21')]=qs['limit'](_0x182ef6[_0x3600('0x33')][_0x3600('0x21')]);_0x5f0847[_0x3600('0x22')]=qs[_0x3600('0x22')](_0x182ef6['query'][_0x3600('0x22')]);}return _0x50133e[_0x3600('0x50')](_0x5f0847);}})[_0x3600('0x27')](function(_0x1f58e2){if(_0x1f58e2){return _0x1f58e2?{'count':_0x22a556,'rows':_0x1f58e2}:null;}})['then'](respondWithResult(_0x54a29c,null))[_0x3600('0x44')](handleError(_0x54a29c,null));};exports[_0x3600('0x51')]=function(_0x39b57d,_0x2a7d2e,_0xed6e52){var _0x3180e5={};var _0x3e50e3={};var _0x490a63;var _0x1e379d;return db[_0x3600('0x30')][_0x3600('0x4c')]({'where':{'id':_0x39b57d['params']['id']}})[_0x3600('0x27')](handleEntityNotFound(_0x2a7d2e,null))[_0x3600('0x27')](function(_0x383db3){if(_0x383db3){_0x490a63=_0x383db3;_0x3e50e3['model']=_[_0x3600('0x46')](db['FreshdeskField'][_0x3600('0x31')]);_0x3e50e3[_0x3600('0x33')]=_[_0x3600('0x46')](_0x39b57d[_0x3600('0x33')]);_0x3e50e3[_0x3600('0x34')]=_[_0x3600('0x35')](_0x3e50e3[_0x3600('0x32')],_0x3e50e3['query']);_0x3180e5[_0x3600('0x36')]=_[_0x3600('0x35')](_0x3e50e3['model'],qs[_0x3600('0x37')](_0x39b57d['query'][_0x3600('0x37')]));_0x3180e5['attributes']=_0x3180e5[_0x3600('0x36')][_0x3600('0x38')]?_0x3180e5['attributes']:_0x3e50e3[_0x3600('0x32')];_0x3180e5[_0x3600('0x3a')]=qs['sort'](_0x39b57d[_0x3600('0x33')][_0x3600('0x3b')]);_0x3180e5[_0x3600('0x3c')]=qs[_0x3600('0x34')](_[_0x3600('0x4e')](_0x39b57d[_0x3600('0x33')],_0x3e50e3['filters']));if(_0x39b57d['query'][_0x3600('0x3f')]){_0x3180e5['where']=_[_0x3600('0x3d')](_0x3180e5[_0x3600('0x3c')],{'$or':_['map'](_0x3180e5[_0x3600('0x36')],function(_0x18e780){var _0x206b0c={};_0x206b0c[_0x18e780]={'$like':'%'+_0x39b57d[_0x3600('0x33')][_0x3600('0x3f')]+'%'};return _0x206b0c;})});}_0x3180e5=_['merge']({},_0x3180e5,_0x39b57d[_0x3600('0x40')]);return _0x490a63[_0x3600('0x51')](_0x3180e5);}})[_0x3600('0x27')](function(_0x245758){if(_0x245758){_0x1e379d=_0x245758[_0x3600('0x38')];if(!_0x39b57d[_0x3600('0x33')]['hasOwnProperty'](_0x3600('0x4f'))){_0x3180e5[_0x3600('0x21')]=qs[_0x3600('0x21')](_0x39b57d[_0x3600('0x33')][_0x3600('0x21')]);_0x3180e5[_0x3600('0x22')]=qs['offset'](_0x39b57d[_0x3600('0x33')]['offset']);}return _0x490a63[_0x3600('0x51')](_0x3180e5);}})['then'](function(_0x5bf5ce){if(_0x5bf5ce){return _0x5bf5ce?{'count':_0x1e379d,'rows':_0x5bf5ce}:null;}})[_0x3600('0x27')](respondWithResult(_0x2a7d2e,null))[_0x3600('0x44')](handleError(_0x2a7d2e,null));};exports[_0x3600('0x52')]=function(_0x14c2ae,_0x1db23c,_0x554a96){var _0x13b19c={};var _0x286dbe={};var _0x3a502c;var _0x22b9b6;return db[_0x3600('0x30')][_0x3600('0x4c')]({'where':{'id':_0x14c2ae[_0x3600('0x4a')]['id']}})[_0x3600('0x27')](handleEntityNotFound(_0x1db23c,null))[_0x3600('0x27')](function(_0x7f5448){if(_0x7f5448){_0x3a502c=_0x7f5448;_0x286dbe[_0x3600('0x32')]=_[_0x3600('0x46')](db[_0x3600('0x53')][_0x3600('0x31')]);_0x286dbe[_0x3600('0x33')]=_[_0x3600('0x46')](_0x14c2ae[_0x3600('0x33')]);_0x286dbe['filters']=_[_0x3600('0x35')](_0x286dbe[_0x3600('0x32')],_0x286dbe['query']);_0x13b19c[_0x3600('0x36')]=_['intersection'](_0x286dbe['model'],qs[_0x3600('0x37')](_0x14c2ae[_0x3600('0x33')][_0x3600('0x37')]));_0x13b19c[_0x3600('0x36')]=_0x13b19c[_0x3600('0x36')][_0x3600('0x38')]?_0x13b19c[_0x3600('0x36')]:_0x286dbe[_0x3600('0x32')];_0x13b19c[_0x3600('0x3a')]=qs[_0x3600('0x3b')](_0x14c2ae[_0x3600('0x33')]['sort']);_0x13b19c[_0x3600('0x3c')]=qs['filters'](_[_0x3600('0x4e')](_0x14c2ae[_0x3600('0x33')],_0x286dbe[_0x3600('0x34')]));if(_0x14c2ae['query'][_0x3600('0x3f')]){_0x13b19c['where']=_['merge'](_0x13b19c[_0x3600('0x3c')],{'$or':_['map'](_0x13b19c[_0x3600('0x36')],function(_0x1292c3){var _0x4cbdfc={};_0x4cbdfc[_0x1292c3]={'$like':'%'+_0x14c2ae[_0x3600('0x33')][_0x3600('0x3f')]+'%'};return _0x4cbdfc;})});}_0x13b19c=_['merge']({},_0x13b19c,_0x14c2ae[_0x3600('0x40')]);return _0x3a502c[_0x3600('0x52')](_0x13b19c);}})[_0x3600('0x27')](function(_0x15336f){if(_0x15336f){_0x22b9b6=_0x15336f[_0x3600('0x38')];if(!_0x14c2ae['query'][_0x3600('0x39')](_0x3600('0x4f'))){_0x13b19c[_0x3600('0x21')]=qs['limit'](_0x14c2ae[_0x3600('0x33')]['limit']);_0x13b19c[_0x3600('0x22')]=qs[_0x3600('0x22')](_0x14c2ae[_0x3600('0x33')][_0x3600('0x22')]);}return _0x3a502c[_0x3600('0x52')](_0x13b19c);}})[_0x3600('0x27')](function(_0x3c02e2){if(_0x3c02e2){return _0x3c02e2?{'count':_0x22b9b6,'rows':_0x3c02e2}:null;}})[_0x3600('0x27')](respondWithResult(_0x1db23c,null))[_0x3600('0x44')](handleError(_0x1db23c,null));};exports['setTags']=function(_0x3371d7,_0x33b1de,_0x588ff7){if(_0x3371d7[_0x3600('0x48')]['id']){delete _0x3371d7[_0x3600('0x48')]['id'];}return db[_0x3600('0x30')]['findOne']({'where':{'id':_0x3371d7[_0x3600('0x4a')]['id']}})[_0x3600('0x27')](handleEntityNotFound(_0x33b1de,null))[_0x3600('0x27')](function(_0x13e8d6){if(_0x13e8d6){return _0x13e8d6[_0x3600('0x54')](_0x3371d7[_0x3600('0x48')][_0x3600('0x55')]||[]);}return null;})[_0x3600('0x27')](respondWithResult(_0x33b1de,null))[_0x3600('0x44')](handleError(_0x33b1de,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b980ee6..6c7b7a9 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 _0x550c=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x45aa0c,_0x3b1092){var _0x51b6a5=function(_0x54b824){while(--_0x54b824){_0x45aa0c['push'](_0x45aa0c['shift']());}};_0x51b6a5(++_0x3b1092);}(_0x550c,0x1ec));var _0xc550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc550('0x0'));var util=require(_0xc550('0x1'));var logger=require(_0xc550('0x2'))('api');var moment=require(_0xc550('0x3'));var BPromise=require(_0xc550('0x4'));var rp=require(_0xc550('0x5'));var fs=require('fs');var path=require(_0xc550('0x6'));var rimraf=require(_0xc550('0x7'));var config=require('../../config/environment');var attributes=require(_0xc550('0x8'));module[_0xc550('0x9')]=function(_0x420453,_0x46ad5a){return _0x420453[_0xc550('0xa')](_0xc550('0xb'),attributes,{'tableName':_0xc550('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f22=['../../config/logger','api','moment','request-promise','../../config/environment','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x2efb58,_0x72c0ab){var _0x47be8f=function(_0xc9a694){while(--_0xc9a694){_0x2efb58['push'](_0x2efb58['shift']());}};_0x47be8f(++_0x72c0ab);}(_0x1f22,0xbc));var _0x21f2=function(_0x27d584,_0x4b6700){_0x27d584=_0x27d584-0x0;var _0x43772f=_0x1f22[_0x27d584];return _0x43772f;};'use strict';var _=require(_0x21f2('0x0'));var util=require(_0x21f2('0x1'));var logger=require(_0x21f2('0x2'))(_0x21f2('0x3'));var moment=require(_0x21f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x21f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x21f2('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x21f2('0x7')]=function(_0x5a3205,_0x53e637){return _0x5a3205['define'](_0x21f2('0x8'),attributes,{'tableName':_0x21f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index a2eb2f6..384440a 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 _0xd113=['jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d12b5,_0x3c47b1){var _0x4724a3=function(_0x54465b){while(--_0x54465b){_0x3d12b5['push'](_0x3d12b5['shift']());}};_0x4724a3(++_0x3c47b1);}(_0xd113,0x1b1));var _0x3d11=function(_0x41e270,_0x12d030){_0x41e270=_0x41e270-0x0;var _0x2485c3=_0xd113[_0x41e270];return _0x2485c3;};'use strict';var _=require(_0x3d11('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d11('0x1'));var db=require(_0x3d11('0x2'))['db'];var utils=require(_0x3d11('0x3'));var logger=require(_0x3d11('0x4'))(_0x3d11('0x5'));var config=require(_0x3d11('0x6'));var jayson=require(_0x3d11('0x7'));var client=jayson[_0x3d11('0x8')][_0x3d11('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x267534,_0x5127e3,_0x2bba24){return new BPromise(function(_0x520710,_0xbe388c){return client[_0x3d11('0xa')](_0x267534,_0x2bba24)[_0x3d11('0xb')](function(_0x283e0){logger[_0x3d11('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5127e3,_0x3d11('0xd'));logger[_0x3d11('0xe')](_0x3d11('0xf'),_0x5127e3,_0x3d11('0xd'),JSON[_0x3d11('0x10')](_0x283e0));if(_0x283e0[_0x3d11('0x11')]){if(_0x283e0['error'][_0x3d11('0x12')]===0x1f4){logger[_0x3d11('0x11')](_0x3d11('0x13'),_0x5127e3,_0x283e0['error'][_0x3d11('0x14')]);return _0xbe388c(_0x283e0['error'][_0x3d11('0x14')]);}logger[_0x3d11('0x11')](_0x3d11('0x13'),_0x5127e3,_0x283e0[_0x3d11('0x11')][_0x3d11('0x14')]);return _0x520710(_0x283e0[_0x3d11('0x11')][_0x3d11('0x14')]);}else{logger['info'](_0x3d11('0x13'),_0x5127e3,_0x3d11('0xd'));_0x520710(_0x283e0['result'][_0x3d11('0x14')]);}})[_0x3d11('0x15')](function(_0x5d26f9){logger['error'](_0x3d11('0x13'),_0x5127e3,_0x5d26f9);_0xbe388c(_0x5d26f9);});});} \ No newline at end of file +var _0x1230=['../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x43fcfd,_0x4a8015){var _0x480bb4=function(_0x54461d){while(--_0x54461d){_0x43fcfd['push'](_0x43fcfd['shift']());}};_0x480bb4(++_0x4a8015);}(_0x1230,0x6a));var _0x0123=function(_0x929c56,_0x54a579){_0x929c56=_0x929c56-0x0;var _0x5f0cde=_0x1230[_0x929c56];return _0x5f0cde;};'use strict';var _=require(_0x0123('0x0'));var util=require(_0x0123('0x1'));var moment=require('moment');var BPromise=require(_0x0123('0x2'));var rs=require(_0x0123('0x3'));var fs=require('fs');var Redis=require(_0x0123('0x4'));var db=require(_0x0123('0x5'))['db'];var utils=require(_0x0123('0x6'));var logger=require(_0x0123('0x7'))(_0x0123('0x8'));var config=require(_0x0123('0x9'));var jayson=require(_0x0123('0xa'));var client=jayson[_0x0123('0xb')][_0x0123('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f1b29,_0x229f84,_0x5ad2f1){return new BPromise(function(_0x2c6278,_0x3e0933){return client[_0x0123('0xd')](_0x1f1b29,_0x5ad2f1)['then'](function(_0x341e68){logger[_0x0123('0xe')](_0x0123('0xf'),_0x229f84,'request\x20sent');logger['debug'](_0x0123('0x10'),_0x229f84,'request\x20sent',JSON['stringify'](_0x341e68));if(_0x341e68[_0x0123('0x11')]){if(_0x341e68[_0x0123('0x11')][_0x0123('0x12')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x229f84,_0x341e68[_0x0123('0x11')][_0x0123('0x13')]);return _0x3e0933(_0x341e68[_0x0123('0x11')][_0x0123('0x13')]);}logger[_0x0123('0x11')](_0x0123('0xf'),_0x229f84,_0x341e68[_0x0123('0x11')][_0x0123('0x13')]);return _0x2c6278(_0x341e68[_0x0123('0x11')]['message']);}else{logger[_0x0123('0xe')](_0x0123('0xf'),_0x229f84,_0x0123('0x14'));_0x2c6278(_0x341e68[_0x0123('0x15')][_0x0123('0x13')]);}})[_0x0123('0x16')](function(_0x4e93c8){logger[_0x0123('0x11')](_0x0123('0xf'),_0x229f84,_0x4e93c8);_0x3e0933(_0x4e93c8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a48c216..ff0ae6c 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 _0x4d1b=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','show','post','isAuthenticated','put','update','delete'];(function(_0x23a3d9,_0x24b7b2){var _0x555775=function(_0x26d4ca){while(--_0x26d4ca){_0x23a3d9['push'](_0x23a3d9['shift']());}};_0x555775(++_0x24b7b2);}(_0x4d1b,0xaa));var _0xb4d1=function(_0x437b02,_0x34b630){_0x437b02=_0x437b02-0x0;var _0xf8c681=_0x4d1b[_0x437b02];return _0xf8c681;};'use strict';var multer=require(_0xb4d1('0x0'));var util=require(_0xb4d1('0x1'));var path=require(_0xb4d1('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4d1('0x3'));var router=express[_0xb4d1('0x4')]();var fs_extra=require(_0xb4d1('0x5'));var auth=require(_0xb4d1('0x6'));var interaction=require(_0xb4d1('0x7'));var config=require(_0xb4d1('0x8'));var controller=require(_0xb4d1('0x9'));router[_0xb4d1('0xa')]('/',auth['isAuthenticated'](),controller[_0xb4d1('0xb')]);router[_0xb4d1('0xa')](_0xb4d1('0xc'),auth['isAuthenticated'](),controller[_0xb4d1('0xd')]);router[_0xb4d1('0xe')]('/',auth[_0xb4d1('0xf')](),controller['create']);router[_0xb4d1('0x10')](_0xb4d1('0xc'),auth[_0xb4d1('0xf')](),controller[_0xb4d1('0x11')]);router[_0xb4d1('0x12')](_0xb4d1('0xc'),auth['isAuthenticated'](),controller[_0xb4d1('0x13')]);module[_0xb4d1('0x14')]=router; \ No newline at end of file +var _0xa3a7=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x486c2f,_0x1f05fc){var _0x9a3bab=function(_0x303521){while(--_0x303521){_0x486c2f['push'](_0x486c2f['shift']());}};_0x9a3bab(++_0x1f05fc);}(_0xa3a7,0x13e));var _0x7a3a=function(_0x2210a6,_0x5006b5){_0x2210a6=_0x2210a6-0x0;var _0x7cdf7c=_0xa3a7[_0x2210a6];return _0x7cdf7c;};'use strict';var multer=require(_0x7a3a('0x0'));var util=require('util');var path=require(_0x7a3a('0x1'));var timeout=require(_0x7a3a('0x2'));var express=require(_0x7a3a('0x3'));var router=express['Router']();var fs_extra=require(_0x7a3a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7a3a('0x5'));var config=require(_0x7a3a('0x6'));var controller=require(_0x7a3a('0x7'));router[_0x7a3a('0x8')]('/',auth[_0x7a3a('0x9')](),controller[_0x7a3a('0xa')]);router[_0x7a3a('0x8')]('/:id',auth[_0x7a3a('0x9')](),controller['show']);router[_0x7a3a('0xb')]('/',auth[_0x7a3a('0x9')](),controller[_0x7a3a('0xc')]);router[_0x7a3a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7a3a('0xe')]);router[_0x7a3a('0xf')](_0x7a3a('0x10'),auth[_0x7a3a('0x9')](),controller[_0x7a3a('0x11')]);module[_0x7a3a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d921a83..54ba972 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 _0xa2e3=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2e3,0x195));var _0x3a2e=function(_0xfabe36,_0x27df7b){_0xfabe36=_0xfabe36-0x0;var _0x147474=_0xa2e3[_0xfabe36];return _0x147474;};'use strict';var Sequelize=require(_0x3a2e('0x0'));module[_0x3a2e('0x1')]={'type':{'type':Sequelize[_0x3a2e('0x2')](_0x3a2e('0x3'),_0x3a2e('0x4'),_0x3a2e('0x5'),'keyValue','picklist'),'defaultValue':_0x3a2e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3a2e('0x6')]},'keyType':{'type':Sequelize[_0x3a2e('0x2')](_0x3a2e('0x3'),_0x3a2e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x3a2e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3a2e('0x6')]},'customField':{'type':Sequelize[_0x3a2e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3a2e('0x6')]}}; \ No newline at end of file +var _0x2b52=['customVariable','keyValue','picklist','STRING','ENUM','exports','string','variable'];(function(_0x4e1e37,_0x21c94d){var _0x528769=function(_0xb7b578){while(--_0xb7b578){_0x4e1e37['push'](_0x4e1e37['shift']());}};_0x528769(++_0x21c94d);}(_0x2b52,0x1e5));var _0x22b5=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x2b52[_0x2c5255];return _0x30d0ea;};'use strict';var Sequelize=require('sequelize');module[_0x22b5('0x0')]={'type':{'type':Sequelize['ENUM'](_0x22b5('0x1'),_0x22b5('0x2'),_0x22b5('0x3'),_0x22b5('0x4'),_0x22b5('0x5')),'defaultValue':_0x22b5('0x1')},'content':{'type':Sequelize[_0x22b5('0x6')]},'key':{'type':Sequelize[_0x22b5('0x6')]},'keyType':{'type':Sequelize[_0x22b5('0x7')]('string',_0x22b5('0x2'),_0x22b5('0x3'))},'keyContent':{'type':Sequelize[_0x22b5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x22b5('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 4405478..898fcfc 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 _0x4522=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','type','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','destroy','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5121b9,_0x30d553){var _0x544949=function(_0x136996){while(--_0x136996){_0x5121b9['push'](_0x5121b9['shift']());}};_0x544949(++_0x30d553);}(_0x4522,0x1a0));var _0x2452=function(_0x3a1b9e,_0x1154d5){_0x3a1b9e=_0x3a1b9e-0x0;var _0x323e33=_0x4522[_0x3a1b9e];return _0x323e33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2452('0x0'));var jsonpatch=require(_0x2452('0x1'));var rp=require(_0x2452('0x2'));var moment=require('moment');var BPromise=require(_0x2452('0x3'));var Mustache=require(_0x2452('0x4'));var util=require(_0x2452('0x5'));var path=require(_0x2452('0x6'));var sox=require(_0x2452('0x7'));var csv=require(_0x2452('0x8'));var ejs=require(_0x2452('0x9'));var fs=require('fs');var fs_extra=require(_0x2452('0xa'));var _=require(_0x2452('0xb'));var squel=require(_0x2452('0xc'));var crypto=require(_0x2452('0xd'));var jsforce=require(_0x2452('0xe'));var deskjs=require(_0x2452('0xf'));var toCsv=require(_0x2452('0x8'));var querystring=require(_0x2452('0x10'));var Papa=require(_0x2452('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2452('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2452('0x13'))(_0x2452('0x14'));var utils=require(_0x2452('0x15'));var config=require(_0x2452('0x16'));var licenseUtil=require(_0x2452('0x17'));var db=require(_0x2452('0x18'))['db'];function respondWithStatusCode(_0x2c1e0f,_0x2377b9){_0x2377b9=_0x2377b9||0xcc;return function(_0x4968e8){if(_0x4968e8){return _0x2c1e0f['sendStatus'](_0x2377b9);}return _0x2c1e0f['status'](_0x2377b9)[_0x2452('0x19')]();};}function respondWithResult(_0x4fafa0,_0x33e592){_0x33e592=_0x33e592||0xc8;return function(_0x506cd4){if(_0x506cd4){return _0x4fafa0[_0x2452('0x1a')](_0x33e592)[_0x2452('0x1b')](_0x506cd4);}};}function respondWithFilteredResult(_0x5d0438,_0x1dbadf){return function(_0x47930c){if(_0x47930c){var _0x3dd8cc=typeof _0x1dbadf[_0x2452('0x1c')]===_0x2452('0x1d')&&typeof _0x1dbadf[_0x2452('0x1e')]==='undefined';var _0x2108e4=_0x47930c[_0x2452('0x1f')];var _0x59d89a=_0x3dd8cc?0x0:_0x1dbadf['offset'];var _0x1bfb44=_0x3dd8cc?_0x47930c[_0x2452('0x1f')]:_0x1dbadf[_0x2452('0x1c')]+_0x1dbadf['limit'];var _0x914d2b;if(_0x1bfb44>=_0x2108e4){_0x1bfb44=_0x2108e4;_0x914d2b=0xc8;}else{_0x914d2b=0xce;}_0x5d0438[_0x2452('0x1a')](_0x914d2b);return _0x5d0438[_0x2452('0x20')](_0x2452('0x21'),_0x59d89a+'-'+_0x1bfb44+'/'+_0x2108e4)[_0x2452('0x1b')](_0x47930c);}return null;};}function patchUpdates(_0x1c70cb){return function(_0x3f48c2){try{jsonpatch[_0x2452('0x22')](_0x3f48c2,_0x1c70cb,!![]);}catch(_0x5e921d){return BPromise['reject'](_0x5e921d);}return _0x3f48c2[_0x2452('0x23')]();};}function saveUpdates(_0x32dfe7,_0x4bb3ff){return function(_0x17d0a0){if(_0x17d0a0){return _0x17d0a0[_0x2452('0x24')](_0x32dfe7)[_0x2452('0x25')](function(_0x617ba7){return _0x617ba7;});}return null;};}function removeEntity(_0x285281,_0x397f21){return function(_0x155caa){if(_0x155caa){return _0x155caa['destroy']()[_0x2452('0x25')](function(){_0x285281[_0x2452('0x1a')](0xcc)[_0x2452('0x19')]();});}};}function handleEntityNotFound(_0x231410,_0x3a4326){return function(_0x516fcf){if(!_0x516fcf){_0x231410['sendStatus'](0x194);}return _0x516fcf;};}function handleError(_0x295be0,_0x159ba1){_0x159ba1=_0x159ba1||0x1f4;return function(_0x46fcbb){logger[_0x2452('0x26')](_0x46fcbb[_0x2452('0x27')]);if(_0x46fcbb['name']){delete _0x46fcbb[_0x2452('0x28')];}_0x295be0[_0x2452('0x1a')](_0x159ba1)['send'](_0x46fcbb);};}exports['index']=function(_0x332878,_0xe8d39b){var _0x36cb6c={},_0x28e6ea={},_0x43fde0={'count':0x0,'rows':[]};var _0x258fa6=_['map'](db['FreshdeskField'][_0x2452('0x29')],function(_0x454e0a){return{'name':_0x454e0a[_0x2452('0x2a')],'type':_0x454e0a['type'][_0x2452('0x2b')]};});_0x28e6ea[_0x2452('0x2c')]=_['map'](_0x258fa6,_0x2452('0x28'));_0x28e6ea[_0x2452('0x2d')]=_[_0x2452('0x2e')](_0x332878[_0x2452('0x2d')]);_0x28e6ea[_0x2452('0x2f')]=_[_0x2452('0x30')](_0x28e6ea[_0x2452('0x2c')],_0x28e6ea[_0x2452('0x2d')]);_0x36cb6c[_0x2452('0x31')]=_[_0x2452('0x30')](_0x28e6ea[_0x2452('0x2c')],qs[_0x2452('0x32')](_0x332878[_0x2452('0x2d')]['fields']));_0x36cb6c[_0x2452('0x31')]=_0x36cb6c[_0x2452('0x31')]['length']?_0x36cb6c[_0x2452('0x31')]:_0x28e6ea['model'];if(!_0x332878[_0x2452('0x2d')][_0x2452('0x33')]('nolimit')){_0x36cb6c[_0x2452('0x1e')]=qs[_0x2452('0x1e')](_0x332878[_0x2452('0x2d')]['limit']);_0x36cb6c[_0x2452('0x1c')]=qs[_0x2452('0x1c')](_0x332878['query'][_0x2452('0x1c')]);}_0x36cb6c[_0x2452('0x34')]=qs[_0x2452('0x35')](_0x332878[_0x2452('0x2d')][_0x2452('0x35')]);_0x36cb6c['where']=qs['filters'](_['pick'](_0x332878[_0x2452('0x2d')],_0x28e6ea[_0x2452('0x2f')]),_0x258fa6);if(_0x332878[_0x2452('0x2d')][_0x2452('0x36')]){_0x36cb6c[_0x2452('0x37')]=_['merge'](_0x36cb6c[_0x2452('0x37')],{'$or':_['map'](_0x258fa6,function(_0x5be9b4){if(_0x5be9b4[_0x2452('0x38')]!=='VIRTUAL'){var _0x44ef50={};_0x44ef50[_0x5be9b4[_0x2452('0x28')]]={'$like':'%'+_0x332878['query'][_0x2452('0x36')]+'%'};return _0x44ef50;}})});}_0x36cb6c=_[_0x2452('0x39')]({},_0x36cb6c,_0x332878[_0x2452('0x3a')]);var _0x34d7f9={'where':_0x36cb6c[_0x2452('0x37')]};return db[_0x2452('0x3b')][_0x2452('0x1f')](_0x34d7f9)[_0x2452('0x25')](function(_0x5b864e){_0x43fde0[_0x2452('0x1f')]=_0x5b864e;if(_0x332878['query'][_0x2452('0x3c')]){_0x36cb6c[_0x2452('0x3d')]=[{'all':!![]}];}return db['FreshdeskField'][_0x2452('0x3e')](_0x36cb6c);})[_0x2452('0x25')](function(_0xb4e3f5){_0x43fde0[_0x2452('0x3f')]=_0xb4e3f5;return _0x43fde0;})[_0x2452('0x25')](respondWithFilteredResult(_0xe8d39b,_0x36cb6c))['catch'](handleError(_0xe8d39b,null));};exports[_0x2452('0x40')]=function(_0x29910e,_0x5379a9){var _0xfabbd8={'raw':!![],'where':{'id':_0x29910e[_0x2452('0x41')]['id']}},_0x449b89={};_0x449b89[_0x2452('0x2c')]=_['keys'](db[_0x2452('0x3b')][_0x2452('0x29')]);_0x449b89[_0x2452('0x2d')]=_[_0x2452('0x2e')](_0x29910e[_0x2452('0x2d')]);_0x449b89[_0x2452('0x2f')]=_['intersection'](_0x449b89[_0x2452('0x2c')],_0x449b89['query']);_0xfabbd8[_0x2452('0x31')]=_[_0x2452('0x30')](_0x449b89['model'],qs['fields'](_0x29910e['query']['fields']));_0xfabbd8[_0x2452('0x31')]=_0xfabbd8['attributes'][_0x2452('0x42')]?_0xfabbd8['attributes']:_0x449b89[_0x2452('0x2c')];if(_0x29910e[_0x2452('0x2d')]['includeAll']){_0xfabbd8['include']=[{'all':!![]}];}_0xfabbd8=_[_0x2452('0x39')]({},_0xfabbd8,_0x29910e['options']);return db[_0x2452('0x3b')][_0x2452('0x43')](_0xfabbd8)[_0x2452('0x25')](handleEntityNotFound(_0x5379a9,null))[_0x2452('0x25')](respondWithResult(_0x5379a9,null))['catch'](handleError(_0x5379a9,null));};exports['create']=function(_0x3e4a8b,_0x38615e){return db[_0x2452('0x3b')][_0x2452('0x44')](_0x3e4a8b[_0x2452('0x45')],{})['then'](respondWithResult(_0x38615e,0xc9))[_0x2452('0x46')](handleError(_0x38615e,null));};exports['update']=function(_0x3634f7,_0x53fd05){if(_0x3634f7[_0x2452('0x45')]['id']){delete _0x3634f7[_0x2452('0x45')]['id'];}return db['FreshdeskField'][_0x2452('0x43')]({'where':{'id':_0x3634f7['params']['id']}})[_0x2452('0x25')](handleEntityNotFound(_0x53fd05,null))['then'](saveUpdates(_0x3634f7['body'],null))['then'](respondWithResult(_0x53fd05,null))[_0x2452('0x46')](handleError(_0x53fd05,null));};exports[_0x2452('0x47')]=function(_0x36ebcb,_0x4b705f){return db[_0x2452('0x3b')][_0x2452('0x43')]({'where':{'id':_0x36ebcb[_0x2452('0x41')]['id']}})[_0x2452('0x25')](handleEntityNotFound(_0x4b705f,null))[_0x2452('0x25')](removeEntity(_0x4b705f,null))['catch'](handleError(_0x4b705f,null));}; \ No newline at end of file +var _0x19ea=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','include','findAll','catch','show','fields','includeAll','merge','find','create','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19ea,0xfe));var _0xa19e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x19ea[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require(_0xa19e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa19e('0x1'));var rp=require('request-promise');var moment=require(_0xa19e('0x2'));var BPromise=require(_0xa19e('0x3'));var Mustache=require(_0xa19e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa19e('0x5'));var csv=require(_0xa19e('0x6'));var ejs=require(_0xa19e('0x7'));var fs=require('fs');var fs_extra=require(_0xa19e('0x8'));var _=require(_0xa19e('0x9'));var squel=require(_0xa19e('0xa'));var crypto=require(_0xa19e('0xb'));var jsforce=require(_0xa19e('0xc'));var deskjs=require(_0xa19e('0xd'));var toCsv=require(_0xa19e('0x6'));var querystring=require(_0xa19e('0xe'));var Papa=require('papaparse');var Redis=require(_0xa19e('0xf'));var authService=require(_0xa19e('0x10'));var qs=require(_0xa19e('0x11'));var as=require(_0xa19e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa19e('0x13'))(_0xa19e('0x14'));var utils=require(_0xa19e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa19e('0x16'));var db=require(_0xa19e('0x17'))['db'];function respondWithStatusCode(_0xc781a2,_0x1bd1f5){_0x1bd1f5=_0x1bd1f5||0xcc;return function(_0x35ca5b){if(_0x35ca5b){return _0xc781a2['sendStatus'](_0x1bd1f5);}return _0xc781a2[_0xa19e('0x18')](_0x1bd1f5)[_0xa19e('0x19')]();};}function respondWithResult(_0xa7e0c4,_0x28dedd){_0x28dedd=_0x28dedd||0xc8;return function(_0x564d2a){if(_0x564d2a){return _0xa7e0c4[_0xa19e('0x18')](_0x28dedd)[_0xa19e('0x1a')](_0x564d2a);}};}function respondWithFilteredResult(_0x245bcb,_0x3be281){return function(_0x1fdea2){if(_0x1fdea2){var _0x2598f5=typeof _0x3be281['offset']===_0xa19e('0x1b')&&typeof _0x3be281[_0xa19e('0x1c')]===_0xa19e('0x1b');var _0x256819=_0x1fdea2[_0xa19e('0x1d')];var _0x38e398=_0x2598f5?0x0:_0x3be281[_0xa19e('0x1e')];var _0x530a75=_0x2598f5?_0x1fdea2[_0xa19e('0x1d')]:_0x3be281['offset']+_0x3be281[_0xa19e('0x1c')];var _0x5d05fd;if(_0x530a75>=_0x256819){_0x530a75=_0x256819;_0x5d05fd=0xc8;}else{_0x5d05fd=0xce;}_0x245bcb['status'](_0x5d05fd);return _0x245bcb[_0xa19e('0x1f')](_0xa19e('0x20'),_0x38e398+'-'+_0x530a75+'/'+_0x256819)['json'](_0x1fdea2);}return null;};}function patchUpdates(_0x1cb9f9){return function(_0x3f2060){try{jsonpatch[_0xa19e('0x21')](_0x3f2060,_0x1cb9f9,!![]);}catch(_0x93eb86){return BPromise['reject'](_0x93eb86);}return _0x3f2060[_0xa19e('0x22')]();};}function saveUpdates(_0x33b588,_0x105874){return function(_0x301f6d){if(_0x301f6d){return _0x301f6d[_0xa19e('0x23')](_0x33b588)[_0xa19e('0x24')](function(_0x2a416e){return _0x2a416e;});}return null;};}function removeEntity(_0x20a649,_0xc16a44){return function(_0x536386){if(_0x536386){return _0x536386[_0xa19e('0x25')]()[_0xa19e('0x24')](function(){_0x20a649['status'](0xcc)[_0xa19e('0x19')]();});}};}function handleEntityNotFound(_0x1d3ce6,_0x4e06b8){return function(_0x20b05c){if(!_0x20b05c){_0x1d3ce6[_0xa19e('0x26')](0x194);}return _0x20b05c;};}function handleError(_0x5d5559,_0x40dc1c){_0x40dc1c=_0x40dc1c||0x1f4;return function(_0x10682d){logger[_0xa19e('0x27')](_0x10682d[_0xa19e('0x28')]);if(_0x10682d[_0xa19e('0x29')]){delete _0x10682d[_0xa19e('0x29')];}_0x5d5559[_0xa19e('0x18')](_0x40dc1c)[_0xa19e('0x2a')](_0x10682d);};}exports[_0xa19e('0x2b')]=function(_0x24dd51,_0x30e490){var _0x3d1cae={},_0x1ce643={},_0x475a26={'count':0x0,'rows':[]};var _0xdf0b20=_[_0xa19e('0x2c')](db[_0xa19e('0x2d')][_0xa19e('0x2e')],function(_0x3dcd74){return{'name':_0x3dcd74[_0xa19e('0x2f')],'type':_0x3dcd74['type'][_0xa19e('0x30')]};});_0x1ce643[_0xa19e('0x31')]=_[_0xa19e('0x2c')](_0xdf0b20,_0xa19e('0x29'));_0x1ce643[_0xa19e('0x32')]=_[_0xa19e('0x33')](_0x24dd51['query']);_0x1ce643[_0xa19e('0x34')]=_[_0xa19e('0x35')](_0x1ce643['model'],_0x1ce643[_0xa19e('0x32')]);_0x3d1cae['attributes']=_['intersection'](_0x1ce643[_0xa19e('0x31')],qs['fields'](_0x24dd51['query']['fields']));_0x3d1cae[_0xa19e('0x36')]=_0x3d1cae[_0xa19e('0x36')][_0xa19e('0x37')]?_0x3d1cae['attributes']:_0x1ce643[_0xa19e('0x31')];if(!_0x24dd51[_0xa19e('0x32')][_0xa19e('0x38')](_0xa19e('0x39'))){_0x3d1cae[_0xa19e('0x1c')]=qs[_0xa19e('0x1c')](_0x24dd51['query'][_0xa19e('0x1c')]);_0x3d1cae[_0xa19e('0x1e')]=qs['offset'](_0x24dd51[_0xa19e('0x32')][_0xa19e('0x1e')]);}_0x3d1cae[_0xa19e('0x3a')]=qs['sort'](_0x24dd51['query'][_0xa19e('0x3b')]);_0x3d1cae['where']=qs[_0xa19e('0x34')](_[_0xa19e('0x3c')](_0x24dd51[_0xa19e('0x32')],_0x1ce643[_0xa19e('0x34')]),_0xdf0b20);if(_0x24dd51['query'][_0xa19e('0x3d')]){_0x3d1cae[_0xa19e('0x3e')]=_['merge'](_0x3d1cae[_0xa19e('0x3e')],{'$or':_['map'](_0xdf0b20,function(_0x374201){if(_0x374201[_0xa19e('0x3f')]!==_0xa19e('0x40')){var _0x5ed1ce={};_0x5ed1ce[_0x374201[_0xa19e('0x29')]]={'$like':'%'+_0x24dd51[_0xa19e('0x32')][_0xa19e('0x3d')]+'%'};return _0x5ed1ce;}})});}_0x3d1cae=_['merge']({},_0x3d1cae,_0x24dd51[_0xa19e('0x41')]);var _0x244ee5={'where':_0x3d1cae['where']};return db['FreshdeskField'][_0xa19e('0x1d')](_0x244ee5)[_0xa19e('0x24')](function(_0x5dd159){_0x475a26[_0xa19e('0x1d')]=_0x5dd159;if(_0x24dd51[_0xa19e('0x32')]['includeAll']){_0x3d1cae[_0xa19e('0x42')]=[{'all':!![]}];}return db[_0xa19e('0x2d')][_0xa19e('0x43')](_0x3d1cae);})[_0xa19e('0x24')](function(_0x30fdfb){_0x475a26['rows']=_0x30fdfb;return _0x475a26;})[_0xa19e('0x24')](respondWithFilteredResult(_0x30e490,_0x3d1cae))[_0xa19e('0x44')](handleError(_0x30e490,null));};exports[_0xa19e('0x45')]=function(_0x29d254,_0x124e8c){var _0x51f0f4={'raw':!![],'where':{'id':_0x29d254['params']['id']}},_0x315341={};_0x315341[_0xa19e('0x31')]=_[_0xa19e('0x33')](db['FreshdeskField'][_0xa19e('0x2e')]);_0x315341[_0xa19e('0x32')]=_['keys'](_0x29d254[_0xa19e('0x32')]);_0x315341['filters']=_[_0xa19e('0x35')](_0x315341[_0xa19e('0x31')],_0x315341[_0xa19e('0x32')]);_0x51f0f4[_0xa19e('0x36')]=_[_0xa19e('0x35')](_0x315341[_0xa19e('0x31')],qs[_0xa19e('0x46')](_0x29d254[_0xa19e('0x32')]['fields']));_0x51f0f4[_0xa19e('0x36')]=_0x51f0f4[_0xa19e('0x36')]['length']?_0x51f0f4['attributes']:_0x315341[_0xa19e('0x31')];if(_0x29d254[_0xa19e('0x32')][_0xa19e('0x47')]){_0x51f0f4['include']=[{'all':!![]}];}_0x51f0f4=_[_0xa19e('0x48')]({},_0x51f0f4,_0x29d254[_0xa19e('0x41')]);return db['FreshdeskField'][_0xa19e('0x49')](_0x51f0f4)[_0xa19e('0x24')](handleEntityNotFound(_0x124e8c,null))[_0xa19e('0x24')](respondWithResult(_0x124e8c,null))['catch'](handleError(_0x124e8c,null));};exports[_0xa19e('0x4a')]=function(_0x52cf31,_0x349543){return db[_0xa19e('0x2d')][_0xa19e('0x4a')](_0x52cf31[_0xa19e('0x4b')],{})[_0xa19e('0x24')](respondWithResult(_0x349543,0xc9))['catch'](handleError(_0x349543,null));};exports[_0xa19e('0x23')]=function(_0x4c90fe,_0x4779d8){if(_0x4c90fe['body']['id']){delete _0x4c90fe[_0xa19e('0x4b')]['id'];}return db[_0xa19e('0x2d')][_0xa19e('0x49')]({'where':{'id':_0x4c90fe[_0xa19e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4779d8,null))[_0xa19e('0x24')](saveUpdates(_0x4c90fe[_0xa19e('0x4b')],null))[_0xa19e('0x24')](respondWithResult(_0x4779d8,null))[_0xa19e('0x44')](handleError(_0x4779d8,null));};exports['destroy']=function(_0x454c9f,_0x5ae431){return db[_0xa19e('0x2d')][_0xa19e('0x49')]({'where':{'id':_0x454c9f[_0xa19e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ae431,null))[_0xa19e('0x24')](removeEntity(_0x5ae431,null))[_0xa19e('0x44')](handleError(_0x5ae431,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3d6f7e3..ad137cb 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 _0x9658=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x5534fe,_0x43c22e){var _0x3d1dc2=function(_0x9df12){while(--_0x9df12){_0x5534fe['push'](_0x5534fe['shift']());}};_0x3d1dc2(++_0x43c22e);}(_0x9658,0x6f));var _0x8965=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x9658[_0x9b5bb2];return _0x2e1e92;};'use strict';var _=require(_0x8965('0x0'));var util=require('util');var logger=require(_0x8965('0x1'))(_0x8965('0x2'));var moment=require('moment');var BPromise=require(_0x8965('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8965('0x4'));var rimraf=require(_0x8965('0x5'));var config=require(_0x8965('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x8965('0x7')]=function(_0x20493e,_0x1d0745){return _0x20493e[_0x8965('0x8')](_0x8965('0x9'),attributes,{'tableName':_0x8965('0xa'),'paranoid':![],'indexes':[{'name':_0x8965('0xb'),'fields':[_0x8965('0xc'),_0x8965('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba0b=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','api'];(function(_0x7db2ea,_0x8a262e){var _0x56e42a=function(_0x3851ef){while(--_0x3851ef){_0x7db2ea['push'](_0x7db2ea['shift']());}};_0x56e42a(++_0x8a262e);}(_0xba0b,0x110));var _0xbba0=function(_0x498ac9,_0x3e2f6e){_0x498ac9=_0x498ac9-0x0;var _0x508561=_0xba0b[_0x498ac9];return _0x508561;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbba0('0x0'));var moment=require(_0xbba0('0x1'));var BPromise=require(_0xbba0('0x2'));var rp=require(_0xbba0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbba0('0x4'));var config=require(_0xbba0('0x5'));var attributes=require(_0xbba0('0x6'));module[_0xbba0('0x7')]=function(_0x203830,_0x5bf3d2){return _0x203830[_0xbba0('0x8')](_0xbba0('0x9'),attributes,{'tableName':_0xbba0('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xbba0('0xb'),_0xbba0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 041b5fb..c949520 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 _0x116c=['http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0x116c,0x84));var _0xc116=function(_0xe5ef12,_0x24a119){_0xe5ef12=_0xe5ef12-0x0;var _0xc1a625=_0x116c[_0xe5ef12];return _0xc1a625;};'use strict';var _=require(_0xc116('0x0'));var util=require(_0xc116('0x1'));var moment=require(_0xc116('0x2'));var BPromise=require(_0xc116('0x3'));var rs=require(_0xc116('0x4'));var fs=require('fs');var Redis=require(_0xc116('0x5'));var db=require(_0xc116('0x6'))['db'];var utils=require(_0xc116('0x7'));var logger=require(_0xc116('0x8'))(_0xc116('0x9'));var config=require(_0xc116('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc116('0xb')][_0xc116('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fb641,_0x48033f,_0x49a5c){return new BPromise(function(_0x32a2ce,_0x4c03b9){return client[_0xc116('0xd')](_0x1fb641,_0x49a5c)[_0xc116('0xe')](function(_0x4844c5){logger['info'](_0xc116('0xf'),_0x48033f,'request\x20sent');logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x48033f,_0xc116('0x10'),JSON[_0xc116('0x11')](_0x4844c5));if(_0x4844c5[_0xc116('0x12')]){if(_0x4844c5['error'][_0xc116('0x13')]===0x1f4){logger['error'](_0xc116('0xf'),_0x48033f,_0x4844c5[_0xc116('0x12')][_0xc116('0x14')]);return _0x4c03b9(_0x4844c5['error'][_0xc116('0x14')]);}logger[_0xc116('0x12')](_0xc116('0xf'),_0x48033f,_0x4844c5[_0xc116('0x12')]['message']);return _0x32a2ce(_0x4844c5[_0xc116('0x12')][_0xc116('0x14')]);}else{logger[_0xc116('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x48033f,'request\x20sent');_0x32a2ce(_0x4844c5[_0xc116('0x16')][_0xc116('0x14')]);}})[_0xc116('0x17')](function(_0x1b0b1a){logger[_0xc116('0x12')](_0xc116('0xf'),_0x48033f,_0x1b0b1a);_0x4c03b9(_0x1b0b1a);});});} \ No newline at end of file +var _0xfdbc=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2fc488,_0x191962){var _0x4f7da4=function(_0x43031a){while(--_0x43031a){_0x2fc488['push'](_0x2fc488['shift']());}};_0x4f7da4(++_0x191962);}(_0xfdbc,0x153));var _0xcfdb=function(_0x3b5aa7,_0x141f82){_0x3b5aa7=_0x3b5aa7-0x0;var _0x3769a8=_0xfdbc[_0x3b5aa7];return _0x3769a8;};'use strict';var _=require(_0xcfdb('0x0'));var util=require(_0xcfdb('0x1'));var moment=require(_0xcfdb('0x2'));var BPromise=require(_0xcfdb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfdb('0x4'));var db=require(_0xcfdb('0x5'))['db'];var utils=require(_0xcfdb('0x6'));var logger=require(_0xcfdb('0x7'))(_0xcfdb('0x8'));var config=require(_0xcfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcfdb('0xa')][_0xcfdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bc01e,_0x457ea0,_0x463ff2){return new BPromise(function(_0xa7c4b8,_0x967d63){return client[_0xcfdb('0xc')](_0x4bc01e,_0x463ff2)['then'](function(_0x45bbeb){logger[_0xcfdb('0xd')](_0xcfdb('0xe'),_0x457ea0,_0xcfdb('0xf'));logger['debug'](_0xcfdb('0x10'),_0x457ea0,'request\x20sent',JSON['stringify'](_0x45bbeb));if(_0x45bbeb[_0xcfdb('0x11')]){if(_0x45bbeb[_0xcfdb('0x11')][_0xcfdb('0x12')]===0x1f4){logger[_0xcfdb('0x11')](_0xcfdb('0xe'),_0x457ea0,_0x45bbeb[_0xcfdb('0x11')]['message']);return _0x967d63(_0x45bbeb['error'][_0xcfdb('0x13')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x457ea0,_0x45bbeb[_0xcfdb('0x11')]['message']);return _0xa7c4b8(_0x45bbeb[_0xcfdb('0x11')]['message']);}else{logger[_0xcfdb('0xd')](_0xcfdb('0xe'),_0x457ea0,_0xcfdb('0xf'));_0xa7c4b8(_0x45bbeb[_0xcfdb('0x14')]['message']);}})[_0xcfdb('0x15')](function(_0x8f2111){logger[_0xcfdb('0x11')](_0xcfdb('0xe'),_0x457ea0,_0x8f2111);_0x967d63(_0x8f2111);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b58b642..813a1d3 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 _0xbee3=['isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x28f99,_0x442c51){var _0x2bd031=function(_0x55e7b7){while(--_0x55e7b7){_0x28f99['push'](_0x28f99['shift']());}};_0x2bd031(++_0x442c51);}(_0xbee3,0xd5));var _0x3bee=function(_0x2e6da6,_0x10f6e7){_0x2e6da6=_0x2e6da6-0x0;var _0x2dd631=_0xbee3[_0x2e6da6];return _0x2dd631;};'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('./intFreshsalesAccount.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['getConfigurations']);router[_0x3bee('0x6')](_0x3bee('0xb'),auth[_0x3bee('0x7')](),controller[_0x3bee('0xc')]);router[_0x3bee('0xd')]('/',auth[_0x3bee('0x7')](),controller['create']);router[_0x3bee('0xd')]('/:id/configurations',auth[_0x3bee('0x7')](),controller[_0x3bee('0xe')]);router[_0x3bee('0xf')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x10')]);router[_0x3bee('0x11')]('/:id',auth[_0x3bee('0x7')](),controller[_0x3bee('0x12')]);module[_0x3bee('0x13')]=router; \ No newline at end of file +var _0x91a7=['Router','../../components/auth/service','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update','exports','util','path','connect-timeout'];(function(_0x17c866,_0x3a3e82){var _0x555f77=function(_0x2f7a4c){while(--_0x2f7a4c){_0x17c866['push'](_0x17c866['shift']());}};_0x555f77(++_0x3a3e82);}(_0x91a7,0xe7));var _0x791a=function(_0x2eb0d9,_0x200330){_0x2eb0d9=_0x2eb0d9-0x0;var _0x1ca099=_0x91a7[_0x2eb0d9];return _0x1ca099;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/fields',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0xd')]);router[_0x791a('0xe')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xf')]);router['put']('/:id',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['delete'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b3b966d..321e5d6 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 _0x6a95=['exports','STRING','username','sequelize'];(function(_0x5a5ad8,_0x34911c){var _0x5512e5=function(_0x18cbe6){while(--_0x18cbe6){_0x5a5ad8['push'](_0x5a5ad8['shift']());}};_0x5512e5(++_0x34911c);}(_0x6a95,0x1db));var _0x56a9=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x6a95[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['remoteUri','sequelize','STRING'];(function(_0x2d25a2,_0x134e12){var _0x5ca405=function(_0x224351){while(--_0x224351){_0x2d25a2['push'](_0x2d25a2['shift']());}};_0x5ca405(++_0x134e12);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c24df,_0x2e46a3){_0x2c24df=_0x2c24df-0x0;var _0x309b15=_0xb10b[_0x2c24df];return _0x309b15;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize[_0xbb10('0x1')]},'username':{'type':Sequelize[_0xbb10('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xbb10('0x1')]},'remoteUri':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2')},'serverUrl':{'type':Sequelize[_0xbb10('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 499b007..b4a91e6 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 _0xd249=['FreshsalesConfiguration','create','FreshsalesField','getFields','username','apiKey','remoteUri','substring','GET','format','%s%s','/api/selector/owners','users','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','destroy','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','then','catch','show','params','includeAll','options','find','update','body','getConfigurations','findOne','length','hasOwnProperty','addConfiguration','Subjects','channel','getDescriptions'];(function(_0x1d4465,_0x2636fa){var _0xf66648=function(_0x4d73cd){while(--_0x4d73cd){_0x1d4465['push'](_0x1d4465['shift']());}};_0xf66648(++_0x2636fa);}(_0xd249,0xd6));var _0x9d24=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xd249[_0x4a8bad];return _0x30cf32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d24('0x0'));var zipdir=require(_0x9d24('0x1'));var jsonpatch=require(_0x9d24('0x2'));var rp=require(_0x9d24('0x3'));var moment=require('moment');var BPromise=require(_0x9d24('0x4'));var Mustache=require(_0x9d24('0x5'));var util=require(_0x9d24('0x6'));var path=require('path');var sox=require(_0x9d24('0x7'));var csv=require('to-csv');var ejs=require(_0x9d24('0x8'));var fs=require('fs');var fs_extra=require(_0x9d24('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d24('0xa'));var jsforce=require(_0x9d24('0xb'));var deskjs=require(_0x9d24('0xc'));var toCsv=require(_0x9d24('0xd'));var querystring=require(_0x9d24('0xe'));var Papa=require(_0x9d24('0xf'));var Redis=require(_0x9d24('0x10'));var authService=require(_0x9d24('0x11'));var qs=require(_0x9d24('0x12'));var as=require(_0x9d24('0x13'));var hardwareService=require(_0x9d24('0x14'));var logger=require(_0x9d24('0x15'))(_0x9d24('0x16'));var utils=require(_0x9d24('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9d24('0x18'));var db=require(_0x9d24('0x19'))['db'];var integrations=require(_0x9d24('0x1a'));function respondWithStatusCode(_0x2a71f4,_0x49a519){_0x49a519=_0x49a519||0xcc;return function(_0x241460){if(_0x241460){return _0x2a71f4['sendStatus'](_0x49a519);}return _0x2a71f4[_0x9d24('0x1b')](_0x49a519)[_0x9d24('0x1c')]();};}function respondWithResult(_0x206a17,_0x2bc4d2){_0x2bc4d2=_0x2bc4d2||0xc8;return function(_0x23d852){if(_0x23d852){return _0x206a17['status'](_0x2bc4d2)['json'](_0x23d852);}};}function respondWithFilteredResult(_0x26ebfb,_0x90c36){return function(_0x57199f){if(_0x57199f){var _0x4f482f=typeof _0x90c36['offset']===_0x9d24('0x1d')&&typeof _0x90c36[_0x9d24('0x1e')]===_0x9d24('0x1d');var _0x4789b5=_0x57199f[_0x9d24('0x1f')];var _0x24b812=_0x4f482f?0x0:_0x90c36[_0x9d24('0x20')];var _0x48a563=_0x4f482f?_0x57199f[_0x9d24('0x1f')]:_0x90c36['offset']+_0x90c36[_0x9d24('0x1e')];var _0x11f1c4;if(_0x48a563>=_0x4789b5){_0x48a563=_0x4789b5;_0x11f1c4=0xc8;}else{_0x11f1c4=0xce;}_0x26ebfb[_0x9d24('0x1b')](_0x11f1c4);return _0x26ebfb['set'](_0x9d24('0x21'),_0x24b812+'-'+_0x48a563+'/'+_0x4789b5)[_0x9d24('0x22')](_0x57199f);}return null;};}function patchUpdates(_0x4abf1c){return function(_0x466e86){try{jsonpatch[_0x9d24('0x23')](_0x466e86,_0x4abf1c,!![]);}catch(_0x3ebec9){return BPromise[_0x9d24('0x24')](_0x3ebec9);}return _0x466e86[_0x9d24('0x25')]();};}function saveUpdates(_0x6df9a,_0x2dcc9b){return function(_0x40753f){if(_0x40753f){return _0x40753f['update'](_0x6df9a)['then'](function(_0x26d5d7){return _0x26d5d7;});}return null;};}function removeEntity(_0x4216c0,_0x19bbbf){return function(_0x2e3bb3){if(_0x2e3bb3){return _0x2e3bb3[_0x9d24('0x26')]()['then'](function(){_0x4216c0[_0x9d24('0x1b')](0xcc)[_0x9d24('0x1c')]();});}};}function handleEntityNotFound(_0x131b87,_0x74b4fa){return function(_0x24e3f6){if(!_0x24e3f6){_0x131b87['sendStatus'](0x194);}return _0x24e3f6;};}function handleError(_0x58b2ac,_0x2b6145){_0x2b6145=_0x2b6145||0x1f4;return function(_0x1b2886){logger[_0x9d24('0x27')](_0x1b2886['stack']);if(_0x1b2886[_0x9d24('0x28')]){delete _0x1b2886[_0x9d24('0x28')];}_0x58b2ac[_0x9d24('0x1b')](_0x2b6145)[_0x9d24('0x29')](_0x1b2886);};}exports[_0x9d24('0x2a')]=function(_0x5f41f1,_0x187136){var _0x3aa66c={},_0x56e3af={},_0xd8c620={'count':0x0,'rows':[]};var _0x260ef1=_[_0x9d24('0x2b')](db[_0x9d24('0x2c')][_0x9d24('0x2d')],function(_0x24e837){return{'name':_0x24e837[_0x9d24('0x2e')],'type':_0x24e837[_0x9d24('0x2f')][_0x9d24('0x30')]};});_0x56e3af[_0x9d24('0x31')]=_[_0x9d24('0x2b')](_0x260ef1,_0x9d24('0x28'));_0x56e3af['query']=_[_0x9d24('0x32')](_0x5f41f1[_0x9d24('0x33')]);_0x56e3af[_0x9d24('0x34')]=_[_0x9d24('0x35')](_0x56e3af[_0x9d24('0x31')],_0x56e3af['query']);_0x3aa66c['attributes']=_['intersection'](_0x56e3af['model'],qs[_0x9d24('0x36')](_0x5f41f1['query'][_0x9d24('0x36')]));_0x3aa66c[_0x9d24('0x37')]=_0x3aa66c[_0x9d24('0x37')]['length']?_0x3aa66c[_0x9d24('0x37')]:_0x56e3af[_0x9d24('0x31')];if(!_0x5f41f1[_0x9d24('0x33')]['hasOwnProperty'](_0x9d24('0x38'))){_0x3aa66c[_0x9d24('0x1e')]=qs['limit'](_0x5f41f1[_0x9d24('0x33')]['limit']);_0x3aa66c[_0x9d24('0x20')]=qs['offset'](_0x5f41f1['query'][_0x9d24('0x20')]);}_0x3aa66c[_0x9d24('0x39')]=qs[_0x9d24('0x3a')](_0x5f41f1[_0x9d24('0x33')]['sort']);_0x3aa66c[_0x9d24('0x3b')]=qs['filters'](_[_0x9d24('0x3c')](_0x5f41f1[_0x9d24('0x33')],_0x56e3af[_0x9d24('0x34')]),_0x260ef1);if(_0x5f41f1['query'][_0x9d24('0x3d')]){_0x3aa66c[_0x9d24('0x3b')]=_['merge'](_0x3aa66c['where'],{'$or':_[_0x9d24('0x2b')](_0x260ef1,function(_0x4a2805){if(_0x4a2805[_0x9d24('0x2f')]!==_0x9d24('0x3e')){var _0x67d17b={};_0x67d17b[_0x4a2805['name']]={'$like':'%'+_0x5f41f1[_0x9d24('0x33')][_0x9d24('0x3d')]+'%'};return _0x67d17b;}})});}_0x3aa66c=_[_0x9d24('0x3f')]({},_0x3aa66c,_0x5f41f1['options']);var _0x1db12b={'where':_0x3aa66c[_0x9d24('0x3b')]};return db[_0x9d24('0x2c')][_0x9d24('0x1f')](_0x1db12b)['then'](function(_0x1ab876){_0xd8c620[_0x9d24('0x1f')]=_0x1ab876;if(_0x5f41f1['query']['includeAll']){_0x3aa66c[_0x9d24('0x40')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x9d24('0x41')](_0x3aa66c);})[_0x9d24('0x42')](function(_0x7979e4){_0xd8c620['rows']=_0x7979e4;return _0xd8c620;})['then'](respondWithFilteredResult(_0x187136,_0x3aa66c))[_0x9d24('0x43')](handleError(_0x187136,null));};exports[_0x9d24('0x44')]=function(_0x494de6,_0x490899){var _0xbe2d06={'raw':![],'where':{'id':_0x494de6[_0x9d24('0x45')]['id']}},_0x1ff510={};_0x1ff510[_0x9d24('0x31')]=_[_0x9d24('0x32')](db[_0x9d24('0x2c')]['rawAttributes']);_0x1ff510[_0x9d24('0x33')]=_[_0x9d24('0x32')](_0x494de6[_0x9d24('0x33')]);_0x1ff510[_0x9d24('0x34')]=_[_0x9d24('0x35')](_0x1ff510[_0x9d24('0x31')],_0x1ff510[_0x9d24('0x33')]);_0xbe2d06['attributes']=_['intersection'](_0x1ff510[_0x9d24('0x31')],qs['fields'](_0x494de6[_0x9d24('0x33')]['fields']));_0xbe2d06[_0x9d24('0x37')]=_0xbe2d06[_0x9d24('0x37')]['length']?_0xbe2d06[_0x9d24('0x37')]:_0x1ff510[_0x9d24('0x31')];if(_0x494de6[_0x9d24('0x33')][_0x9d24('0x46')]){_0xbe2d06[_0x9d24('0x40')]=[{'all':!![]}];}_0xbe2d06=_[_0x9d24('0x3f')]({},_0xbe2d06,_0x494de6[_0x9d24('0x47')]);return db[_0x9d24('0x2c')][_0x9d24('0x48')](_0xbe2d06)[_0x9d24('0x42')](handleEntityNotFound(_0x490899,null))[_0x9d24('0x42')](respondWithResult(_0x490899,null))[_0x9d24('0x43')](handleError(_0x490899,null));};exports['create']=function(_0xc1aa38,_0x196fdb){return db[_0x9d24('0x2c')]['create'](_0xc1aa38['body'],{})[_0x9d24('0x42')](respondWithResult(_0x196fdb,0xc9))['catch'](handleError(_0x196fdb,null));};exports[_0x9d24('0x49')]=function(_0x58234b,_0x51b6f0){if(_0x58234b[_0x9d24('0x4a')]['id']){delete _0x58234b[_0x9d24('0x4a')]['id'];}return db[_0x9d24('0x2c')][_0x9d24('0x48')]({'where':{'id':_0x58234b[_0x9d24('0x45')]['id']}})[_0x9d24('0x42')](handleEntityNotFound(_0x51b6f0,null))[_0x9d24('0x42')](saveUpdates(_0x58234b[_0x9d24('0x4a')],null))['then'](respondWithResult(_0x51b6f0,null))[_0x9d24('0x43')](handleError(_0x51b6f0,null));};exports['destroy']=function(_0x331313,_0xc13f08){return db[_0x9d24('0x2c')]['find']({'where':{'id':_0x331313[_0x9d24('0x45')]['id']}})[_0x9d24('0x42')](handleEntityNotFound(_0xc13f08,null))[_0x9d24('0x42')](removeEntity(_0xc13f08,null))[_0x9d24('0x43')](handleError(_0xc13f08,null));};exports[_0x9d24('0x4b')]=function(_0x3844f9,_0x3a3069,_0x59ba32){var _0x9c1da3={};var _0x35e636={};var _0x5acb57;var _0x5a24cc;return db[_0x9d24('0x2c')][_0x9d24('0x4c')]({'where':{'id':_0x3844f9[_0x9d24('0x45')]['id']}})[_0x9d24('0x42')](handleEntityNotFound(_0x3a3069,null))['then'](function(_0x2ec702){if(_0x2ec702){_0x5acb57=_0x2ec702;_0x35e636['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x35e636[_0x9d24('0x33')]=_[_0x9d24('0x32')](_0x3844f9[_0x9d24('0x33')]);_0x35e636['filters']=_[_0x9d24('0x35')](_0x35e636['model'],_0x35e636[_0x9d24('0x33')]);_0x9c1da3['attributes']=_['intersection'](_0x35e636['model'],qs[_0x9d24('0x36')](_0x3844f9[_0x9d24('0x33')]['fields']));_0x9c1da3[_0x9d24('0x37')]=_0x9c1da3['attributes'][_0x9d24('0x4d')]?_0x9c1da3[_0x9d24('0x37')]:_0x35e636['model'];_0x9c1da3['order']=qs[_0x9d24('0x3a')](_0x3844f9[_0x9d24('0x33')][_0x9d24('0x3a')]);_0x9c1da3['where']=qs[_0x9d24('0x34')](_[_0x9d24('0x3c')](_0x3844f9[_0x9d24('0x33')],_0x35e636[_0x9d24('0x34')]));if(_0x3844f9[_0x9d24('0x33')][_0x9d24('0x3d')]){_0x9c1da3['where']=_['merge'](_0x9c1da3[_0x9d24('0x3b')],{'$or':_['map'](_0x9c1da3[_0x9d24('0x37')],function(_0x4ba198){var _0x324230={};_0x324230[_0x4ba198]={'$like':'%'+_0x3844f9[_0x9d24('0x33')][_0x9d24('0x3d')]+'%'};return _0x324230;})});}_0x9c1da3=_[_0x9d24('0x3f')]({},_0x9c1da3,_0x3844f9[_0x9d24('0x47')]);return _0x5acb57['getConfigurations'](_0x9c1da3);}})[_0x9d24('0x42')](function(_0x5c8d72){if(_0x5c8d72){_0x5a24cc=_0x5c8d72[_0x9d24('0x4d')];if(!_0x3844f9[_0x9d24('0x33')][_0x9d24('0x4e')]('nolimit')){_0x9c1da3[_0x9d24('0x1e')]=qs[_0x9d24('0x1e')](_0x3844f9[_0x9d24('0x33')]['limit']);_0x9c1da3['offset']=qs['offset'](_0x3844f9['query']['offset']);}return _0x5acb57[_0x9d24('0x4b')](_0x9c1da3);}})[_0x9d24('0x42')](function(_0x50ffed){if(_0x50ffed){return _0x50ffed?{'count':_0x5a24cc,'rows':_0x50ffed}:null;}})[_0x9d24('0x42')](respondWithResult(_0x3a3069,null))[_0x9d24('0x43')](handleError(_0x3a3069,null));};exports[_0x9d24('0x4f')]=function(_0x63f1b5,_0x41a7f8,_0x4cd33f){if(_0x63f1b5['body']['id']){delete _0x63f1b5[_0x9d24('0x4a')]['id'];}return db[_0x9d24('0x2c')][_0x9d24('0x4c')]({'where':{'id':_0x63f1b5[_0x9d24('0x45')]['id']}})['then'](handleEntityNotFound(_0x41a7f8,null))['then'](function(_0x176c58){if(_0x176c58){_0x63f1b5[_0x9d24('0x4a')]['AccountId']=_0x176c58['id'];_0x63f1b5[_0x9d24('0x4a')][_0x9d24('0x50')]=integrations['getSubjects'](_0x63f1b5[_0x9d24('0x4a')][_0x9d24('0x51')],_0x63f1b5[_0x9d24('0x4a')][_0x9d24('0x2f')]);_0x63f1b5[_0x9d24('0x4a')]['Descriptions']=integrations[_0x9d24('0x52')](_0x63f1b5[_0x9d24('0x4a')][_0x9d24('0x51')],_0x63f1b5['body'][_0x9d24('0x2f')]);return db[_0x9d24('0x53')][_0x9d24('0x54')](_0x63f1b5[_0x9d24('0x4a')],{'include':[{'model':db[_0x9d24('0x55')],'as':'Subjects'},{'model':db[_0x9d24('0x55')],'as':'Descriptions'}]});}return null;})[_0x9d24('0x42')](respondWithResult(_0x41a7f8,null))[_0x9d24('0x43')](handleError(_0x41a7f8,null));};exports[_0x9d24('0x56')]=function(_0x42b40e,_0x1249b1,_0x22a680){var _0x35256a='';var _0xd86599='';return db[_0x9d24('0x2c')]['findOne']({'where':{'id':_0x42b40e['params']['id']},'attributes':['id',_0x9d24('0x57'),'remoteUri',_0x9d24('0x58')]})[_0x9d24('0x42')](handleEntityNotFound(_0x1249b1,null))['then'](function(_0xbc576){if(_0xbc576){_0xd86599=_0xbc576[_0x9d24('0x57')];_0x35256a=_0xbc576[_0x9d24('0x59')];var _0x225d75=_0xbc576[_0x9d24('0x59')]['slice'](-0x1);if(_0x225d75==='/'){_0x35256a=_0x35256a[_0x9d24('0x5a')](0x0,_0x35256a['lastIndexOf'](_0x225d75));}return rp({'method':_0x9d24('0x5b'),'uri':util[_0x9d24('0x5c')](_0x9d24('0x5d'),_0x35256a,_0x9d24('0x5e')),'headers':{'Authorization':'Token\x20token='+_0xbc576[_0x9d24('0x58')]},'json':!![]});}})[_0x9d24('0x42')](function(_0x20523e){if(_0x20523e){var _0x43b0cc=_0x20523e[_0x9d24('0x5f')];var _0x27907e=![];var _0xe61a79=null;for(_0xe61a79=0x0;_0xe61a79<_0x43b0cc[_0x9d24('0x4d')];_0xe61a79++){if(_0x43b0cc[_0xe61a79]['email']===_0xd86599){_0x27907e=!![];}}if(_0x27907e){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x9d24('0x42')](respondWithResult(_0x1249b1,null))[_0x9d24('0x43')](function(_0x4f6a08){var _0x105cdd=_0x42b40e[_0x9d24('0x33')][_0x9d24('0x60')]?0x1f4:_0x4f6a08['statusCode']||0x1f4;logger[_0x9d24('0x27')](_0x9d24('0x61'),'getFields',_0x105cdd,JSON['stringify'](_0x4f6a08));delete _0x4f6a08[_0x9d24('0x28')];if(_0x105cdd===0x191){_0x105cdd=0x190;}_0x1249b1['status'](_0x105cdd)[_0x9d24('0x29')](_0x42b40e[_0x9d24('0x33')][_0x9d24('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0x4f6a08[_0x9d24('0x62')]}:_0x4f6a08);});}; \ No newline at end of file +var _0xfd3e=['Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','FreshsalesAccount','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','update','body','params','getConfigurations','FreshsalesConfiguration','rawAttributes','addConfiguration','findOne','getSubjects','getDescriptions','FreshsalesField','Subjects','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x31e445,_0x3fd26){var _0x1b531e=function(_0x33bb85){while(--_0x33bb85){_0x31e445['push'](_0x31e445['shift']());}};_0x1b531e(++_0x3fd26);}(_0xfd3e,0xcf));var _0xefd3=function(_0x2efd54,_0x241172){_0x2efd54=_0x2efd54-0x0;var _0x3f923e=_0xfd3e[_0x2efd54];return _0x3f923e;};'use strict';var emlformat=require(_0xefd3('0x0'));var rimraf=require(_0xefd3('0x1'));var zipdir=require(_0xefd3('0x2'));var jsonpatch=require(_0xefd3('0x3'));var rp=require(_0xefd3('0x4'));var moment=require(_0xefd3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xefd3('0x6'));var util=require('util');var path=require(_0xefd3('0x7'));var sox=require(_0xefd3('0x8'));var csv=require(_0xefd3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefd3('0xa'));var _=require(_0xefd3('0xb'));var squel=require(_0xefd3('0xc'));var crypto=require(_0xefd3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xefd3('0xe'));var toCsv=require(_0xefd3('0x9'));var querystring=require(_0xefd3('0xf'));var Papa=require(_0xefd3('0x10'));var Redis=require(_0xefd3('0x11'));var authService=require(_0xefd3('0x12'));var qs=require(_0xefd3('0x13'));var as=require(_0xefd3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xefd3('0x15'));var utils=require(_0xefd3('0x16'));var config=require(_0xefd3('0x17'));var licenseUtil=require(_0xefd3('0x18'));var db=require(_0xefd3('0x19'))['db'];var integrations=require(_0xefd3('0x1a'));function respondWithStatusCode(_0x41bc15,_0x5c5229){_0x5c5229=_0x5c5229||0xcc;return function(_0x48e61f){if(_0x48e61f){return _0x41bc15[_0xefd3('0x1b')](_0x5c5229);}return _0x41bc15[_0xefd3('0x1c')](_0x5c5229)[_0xefd3('0x1d')]();};}function respondWithResult(_0x5125a3,_0x496f4f){_0x496f4f=_0x496f4f||0xc8;return function(_0x41406f){if(_0x41406f){return _0x5125a3[_0xefd3('0x1c')](_0x496f4f)[_0xefd3('0x1e')](_0x41406f);}};}function respondWithFilteredResult(_0x5833e0,_0x4336ee){return function(_0x2815f8){if(_0x2815f8){var _0xee6acc=typeof _0x4336ee[_0xefd3('0x1f')]===_0xefd3('0x20')&&typeof _0x4336ee[_0xefd3('0x21')]===_0xefd3('0x20');var _0x4c8736=_0x2815f8[_0xefd3('0x22')];var _0x336cc0=_0xee6acc?0x0:_0x4336ee[_0xefd3('0x1f')];var _0x117134=_0xee6acc?_0x2815f8[_0xefd3('0x22')]:_0x4336ee[_0xefd3('0x1f')]+_0x4336ee[_0xefd3('0x21')];var _0x51e892;if(_0x117134>=_0x4c8736){_0x117134=_0x4c8736;_0x51e892=0xc8;}else{_0x51e892=0xce;}_0x5833e0[_0xefd3('0x1c')](_0x51e892);return _0x5833e0[_0xefd3('0x23')](_0xefd3('0x24'),_0x336cc0+'-'+_0x117134+'/'+_0x4c8736)[_0xefd3('0x1e')](_0x2815f8);}return null;};}function patchUpdates(_0x5c71e9){return function(_0x37f885){try{jsonpatch['apply'](_0x37f885,_0x5c71e9,!![]);}catch(_0x585ea0){return BPromise['reject'](_0x585ea0);}return _0x37f885[_0xefd3('0x25')]();};}function saveUpdates(_0x3f2764,_0x5a68cb){return function(_0x5dd7ee){if(_0x5dd7ee){return _0x5dd7ee['update'](_0x3f2764)[_0xefd3('0x26')](function(_0x10f653){return _0x10f653;});}return null;};}function removeEntity(_0x51de76,_0x1c7e65){return function(_0x2cbe18){if(_0x2cbe18){return _0x2cbe18[_0xefd3('0x27')]()[_0xefd3('0x26')](function(){_0x51de76[_0xefd3('0x1c')](0xcc)[_0xefd3('0x1d')]();});}};}function handleEntityNotFound(_0x4b6c6f,_0xd3ddf){return function(_0x1e1a20){if(!_0x1e1a20){_0x4b6c6f[_0xefd3('0x1b')](0x194);}return _0x1e1a20;};}function handleError(_0x3de94b,_0x516777){_0x516777=_0x516777||0x1f4;return function(_0x4cd077){logger[_0xefd3('0x28')](_0x4cd077[_0xefd3('0x29')]);if(_0x4cd077[_0xefd3('0x2a')]){delete _0x4cd077[_0xefd3('0x2a')];}_0x3de94b[_0xefd3('0x1c')](_0x516777)[_0xefd3('0x2b')](_0x4cd077);};}exports['index']=function(_0x2737dc,_0xd5aaee){var _0x2458a7={},_0xc5917e={},_0x11a8e4={'count':0x0,'rows':[]};var _0x358de9=_['map'](db[_0xefd3('0x2c')]['rawAttributes'],function(_0x54c4d5){return{'name':_0x54c4d5[_0xefd3('0x2d')],'type':_0x54c4d5[_0xefd3('0x2e')][_0xefd3('0x2f')]};});_0xc5917e['model']=_[_0xefd3('0x30')](_0x358de9,_0xefd3('0x2a'));_0xc5917e['query']=_['keys'](_0x2737dc[_0xefd3('0x31')]);_0xc5917e[_0xefd3('0x32')]=_[_0xefd3('0x33')](_0xc5917e[_0xefd3('0x34')],_0xc5917e[_0xefd3('0x31')]);_0x2458a7[_0xefd3('0x35')]=_['intersection'](_0xc5917e[_0xefd3('0x34')],qs[_0xefd3('0x36')](_0x2737dc[_0xefd3('0x31')][_0xefd3('0x36')]));_0x2458a7['attributes']=_0x2458a7['attributes'][_0xefd3('0x37')]?_0x2458a7[_0xefd3('0x35')]:_0xc5917e[_0xefd3('0x34')];if(!_0x2737dc['query'][_0xefd3('0x38')](_0xefd3('0x39'))){_0x2458a7[_0xefd3('0x21')]=qs[_0xefd3('0x21')](_0x2737dc[_0xefd3('0x31')][_0xefd3('0x21')]);_0x2458a7[_0xefd3('0x1f')]=qs['offset'](_0x2737dc['query'][_0xefd3('0x1f')]);}_0x2458a7[_0xefd3('0x3a')]=qs[_0xefd3('0x3b')](_0x2737dc['query'][_0xefd3('0x3b')]);_0x2458a7[_0xefd3('0x3c')]=qs[_0xefd3('0x32')](_[_0xefd3('0x3d')](_0x2737dc[_0xefd3('0x31')],_0xc5917e[_0xefd3('0x32')]),_0x358de9);if(_0x2737dc[_0xefd3('0x31')][_0xefd3('0x3e')]){_0x2458a7['where']=_['merge'](_0x2458a7[_0xefd3('0x3c')],{'$or':_[_0xefd3('0x30')](_0x358de9,function(_0x12b096){if(_0x12b096['type']!==_0xefd3('0x3f')){var _0x3832c4={};_0x3832c4[_0x12b096[_0xefd3('0x2a')]]={'$like':'%'+_0x2737dc['query']['filter']+'%'};return _0x3832c4;}})});}_0x2458a7=_[_0xefd3('0x40')]({},_0x2458a7,_0x2737dc[_0xefd3('0x41')]);var _0x5a7cd1={'where':_0x2458a7[_0xefd3('0x3c')]};return db['FreshsalesAccount']['count'](_0x5a7cd1)[_0xefd3('0x26')](function(_0x32ce08){_0x11a8e4[_0xefd3('0x22')]=_0x32ce08;if(_0x2737dc[_0xefd3('0x31')][_0xefd3('0x42')]){_0x2458a7[_0xefd3('0x43')]=[{'all':!![]}];}return db[_0xefd3('0x2c')][_0xefd3('0x44')](_0x2458a7);})[_0xefd3('0x26')](function(_0x356443){_0x11a8e4[_0xefd3('0x45')]=_0x356443;return _0x11a8e4;})[_0xefd3('0x26')](respondWithFilteredResult(_0xd5aaee,_0x2458a7))[_0xefd3('0x46')](handleError(_0xd5aaee,null));};exports['show']=function(_0x2f0fa6,_0x5285dd){var _0xe92ad9={'raw':![],'where':{'id':_0x2f0fa6['params']['id']}},_0x33bc55={};_0x33bc55['model']=_[_0xefd3('0x47')](db[_0xefd3('0x2c')]['rawAttributes']);_0x33bc55[_0xefd3('0x31')]=_[_0xefd3('0x47')](_0x2f0fa6[_0xefd3('0x31')]);_0x33bc55[_0xefd3('0x32')]=_[_0xefd3('0x33')](_0x33bc55[_0xefd3('0x34')],_0x33bc55[_0xefd3('0x31')]);_0xe92ad9['attributes']=_[_0xefd3('0x33')](_0x33bc55[_0xefd3('0x34')],qs['fields'](_0x2f0fa6[_0xefd3('0x31')]['fields']));_0xe92ad9['attributes']=_0xe92ad9['attributes'][_0xefd3('0x37')]?_0xe92ad9['attributes']:_0x33bc55[_0xefd3('0x34')];if(_0x2f0fa6[_0xefd3('0x31')][_0xefd3('0x42')]){_0xe92ad9[_0xefd3('0x43')]=[{'all':!![]}];}_0xe92ad9=_[_0xefd3('0x40')]({},_0xe92ad9,_0x2f0fa6['options']);return db[_0xefd3('0x2c')][_0xefd3('0x48')](_0xe92ad9)[_0xefd3('0x26')](handleEntityNotFound(_0x5285dd,null))[_0xefd3('0x26')](respondWithResult(_0x5285dd,null))['catch'](handleError(_0x5285dd,null));};exports[_0xefd3('0x49')]=function(_0x1b2ba4,_0x34b462){return db[_0xefd3('0x2c')][_0xefd3('0x49')](_0x1b2ba4['body'],{})[_0xefd3('0x26')](respondWithResult(_0x34b462,0xc9))['catch'](handleError(_0x34b462,null));};exports[_0xefd3('0x4a')]=function(_0x40635e,_0x39e27f){if(_0x40635e[_0xefd3('0x4b')]['id']){delete _0x40635e[_0xefd3('0x4b')]['id'];}return db[_0xefd3('0x2c')][_0xefd3('0x48')]({'where':{'id':_0x40635e[_0xefd3('0x4c')]['id']}})[_0xefd3('0x26')](handleEntityNotFound(_0x39e27f,null))[_0xefd3('0x26')](saveUpdates(_0x40635e[_0xefd3('0x4b')],null))[_0xefd3('0x26')](respondWithResult(_0x39e27f,null))['catch'](handleError(_0x39e27f,null));};exports[_0xefd3('0x27')]=function(_0x40cd56,_0x3275dc){return db['FreshsalesAccount'][_0xefd3('0x48')]({'where':{'id':_0x40cd56['params']['id']}})['then'](handleEntityNotFound(_0x3275dc,null))[_0xefd3('0x26')](removeEntity(_0x3275dc,null))[_0xefd3('0x46')](handleError(_0x3275dc,null));};exports[_0xefd3('0x4d')]=function(_0x39cdd1,_0x2e726d,_0xcd643f){var _0x4f3bf4={};var _0x6fd91={};var _0x1c69e1;var _0x568406;return db[_0xefd3('0x2c')]['findOne']({'where':{'id':_0x39cdd1[_0xefd3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e726d,null))[_0xefd3('0x26')](function(_0x561234){if(_0x561234){_0x1c69e1=_0x561234;_0x6fd91[_0xefd3('0x34')]=_[_0xefd3('0x47')](db[_0xefd3('0x4e')][_0xefd3('0x4f')]);_0x6fd91['query']=_[_0xefd3('0x47')](_0x39cdd1['query']);_0x6fd91[_0xefd3('0x32')]=_[_0xefd3('0x33')](_0x6fd91[_0xefd3('0x34')],_0x6fd91['query']);_0x4f3bf4[_0xefd3('0x35')]=_[_0xefd3('0x33')](_0x6fd91[_0xefd3('0x34')],qs['fields'](_0x39cdd1['query'][_0xefd3('0x36')]));_0x4f3bf4[_0xefd3('0x35')]=_0x4f3bf4['attributes'][_0xefd3('0x37')]?_0x4f3bf4['attributes']:_0x6fd91[_0xefd3('0x34')];_0x4f3bf4['order']=qs[_0xefd3('0x3b')](_0x39cdd1[_0xefd3('0x31')][_0xefd3('0x3b')]);_0x4f3bf4[_0xefd3('0x3c')]=qs[_0xefd3('0x32')](_['pick'](_0x39cdd1['query'],_0x6fd91[_0xefd3('0x32')]));if(_0x39cdd1[_0xefd3('0x31')]['filter']){_0x4f3bf4[_0xefd3('0x3c')]=_['merge'](_0x4f3bf4[_0xefd3('0x3c')],{'$or':_[_0xefd3('0x30')](_0x4f3bf4[_0xefd3('0x35')],function(_0x5b9160){var _0x11cada={};_0x11cada[_0x5b9160]={'$like':'%'+_0x39cdd1[_0xefd3('0x31')][_0xefd3('0x3e')]+'%'};return _0x11cada;})});}_0x4f3bf4=_[_0xefd3('0x40')]({},_0x4f3bf4,_0x39cdd1[_0xefd3('0x41')]);return _0x1c69e1[_0xefd3('0x4d')](_0x4f3bf4);}})[_0xefd3('0x26')](function(_0x4ff837){if(_0x4ff837){_0x568406=_0x4ff837[_0xefd3('0x37')];if(!_0x39cdd1[_0xefd3('0x31')]['hasOwnProperty'](_0xefd3('0x39'))){_0x4f3bf4[_0xefd3('0x21')]=qs[_0xefd3('0x21')](_0x39cdd1[_0xefd3('0x31')]['limit']);_0x4f3bf4[_0xefd3('0x1f')]=qs['offset'](_0x39cdd1[_0xefd3('0x31')]['offset']);}return _0x1c69e1['getConfigurations'](_0x4f3bf4);}})[_0xefd3('0x26')](function(_0x5a64ed){if(_0x5a64ed){return _0x5a64ed?{'count':_0x568406,'rows':_0x5a64ed}:null;}})[_0xefd3('0x26')](respondWithResult(_0x2e726d,null))['catch'](handleError(_0x2e726d,null));};exports[_0xefd3('0x50')]=function(_0x4c48de,_0xf6b1d3,_0x4f81bd){if(_0x4c48de['body']['id']){delete _0x4c48de['body']['id'];}return db[_0xefd3('0x2c')][_0xefd3('0x51')]({'where':{'id':_0x4c48de[_0xefd3('0x4c')]['id']}})[_0xefd3('0x26')](handleEntityNotFound(_0xf6b1d3,null))[_0xefd3('0x26')](function(_0x2c402b){if(_0x2c402b){_0x4c48de[_0xefd3('0x4b')]['AccountId']=_0x2c402b['id'];_0x4c48de[_0xefd3('0x4b')]['Subjects']=integrations[_0xefd3('0x52')](_0x4c48de[_0xefd3('0x4b')]['channel'],_0x4c48de[_0xefd3('0x4b')][_0xefd3('0x2e')]);_0x4c48de[_0xefd3('0x4b')]['Descriptions']=integrations[_0xefd3('0x53')](_0x4c48de[_0xefd3('0x4b')]['channel'],_0x4c48de[_0xefd3('0x4b')][_0xefd3('0x2e')]);return db[_0xefd3('0x4e')][_0xefd3('0x49')](_0x4c48de[_0xefd3('0x4b')],{'include':[{'model':db[_0xefd3('0x54')],'as':_0xefd3('0x55')},{'model':db[_0xefd3('0x54')],'as':_0xefd3('0x56')}]});}return null;})[_0xefd3('0x26')](respondWithResult(_0xf6b1d3,null))['catch'](handleError(_0xf6b1d3,null));};exports[_0xefd3('0x57')]=function(_0x205e5b,_0x44e45d,_0x6ed82b){var _0x1c7cc7='';var _0x1e1818='';return db[_0xefd3('0x2c')]['findOne']({'where':{'id':_0x205e5b[_0xefd3('0x4c')]['id']},'attributes':['id','username',_0xefd3('0x58'),_0xefd3('0x59')]})['then'](handleEntityNotFound(_0x44e45d,null))[_0xefd3('0x26')](function(_0x735608){if(_0x735608){_0x1e1818=_0x735608['username'];_0x1c7cc7=_0x735608['remoteUri'];var _0x8fe84c=_0x735608[_0xefd3('0x58')][_0xefd3('0x5a')](-0x1);if(_0x8fe84c==='/'){_0x1c7cc7=_0x1c7cc7[_0xefd3('0x5b')](0x0,_0x1c7cc7[_0xefd3('0x5c')](_0x8fe84c));}return rp({'method':_0xefd3('0x5d'),'uri':util[_0xefd3('0x5e')]('%s%s',_0x1c7cc7,_0xefd3('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x735608[_0xefd3('0x59')]},'json':!![]});}})['then'](function(_0x8e370){if(_0x8e370){var _0x54690a=_0x8e370[_0xefd3('0x60')];var _0x5f518c=![];var _0x15e7ff=null;for(_0x15e7ff=0x0;_0x15e7ff<_0x54690a[_0xefd3('0x37')];_0x15e7ff++){if(_0x54690a[_0x15e7ff][_0xefd3('0x61')]===_0x1e1818){_0x5f518c=!![];}}if(_0x5f518c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x44e45d,null))[_0xefd3('0x46')](function(_0x3109b1){var _0xfb3f04=_0x205e5b['query'][_0xefd3('0x62')]?0x1f4:_0x3109b1[_0xefd3('0x63')]||0x1f4;logger[_0xefd3('0x28')](_0xefd3('0x64'),_0xefd3('0x57'),_0xfb3f04,JSON[_0xefd3('0x65')](_0x3109b1));delete _0x3109b1[_0xefd3('0x2a')];if(_0xfb3f04===0x191){_0xfb3f04=0x190;}_0x44e45d[_0xefd3('0x1c')](_0xfb3f04)['send'](_0x205e5b['query'][_0xefd3('0x62')]?{'message':_0xefd3('0x66'),'statusCode':_0x3109b1['statusCode']}:_0x3109b1);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4651ba0..1f87b24 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 _0x82c4=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','exports'];(function(_0x487040,_0x46a3b0){var _0xb9a6a2=function(_0x145d68){while(--_0x145d68){_0x487040['push'](_0x487040['shift']());}};_0xb9a6a2(++_0x46a3b0);}(_0x82c4,0x1ca));var _0x482c=function(_0x19a465,_0x47790a){_0x19a465=_0x19a465-0x0;var _0xda00f8=_0x82c4[_0x19a465];return _0xda00f8;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x482c('0x9')]=function(_0x5d7c76,_0xfdb92){return _0x5d7c76[_0x482c('0xa')](_0x482c('0xb'),attributes,{'tableName':_0x482c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x33e4d9,_0x133546){var _0x5d4702=function(_0x2e013f){while(--_0x2e013f){_0x33e4d9['push'](_0x33e4d9['shift']());}};_0x5d4702(++_0x133546);}(_0x687b,0x14a));var _0xb687=function(_0x5ec634,_0xa835b9){_0x5ec634=_0x5ec634-0x0;var _0x5b94a9=_0x687b[_0x5ec634];return _0x5b94a9;};'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'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('FreshsalesAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index e11e893..7a62cd8 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 _0xf61e=['include','map','then','ShowFreshsalesAccount','FreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','model'];(function(_0x4dd2fe,_0x52b2a1){var _0x33378b=function(_0x12f3ba){while(--_0x12f3ba){_0x4dd2fe['push'](_0x4dd2fe['shift']());}};_0x33378b(++_0x52b2a1);}(_0xf61e,0x191));var _0xef61=function(_0x2adda6,_0x53d65d){_0x2adda6=_0x2adda6-0x0;var _0xb37b43=_0xf61e[_0x2adda6];return _0xb37b43;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});}exports[_0xef61('0x17')]=function(_0x22dc1b){var _0xfc36d6=this;return new Promise(function(_0x28315a,_0xdd5e38){return db['FreshsalesAccount'][_0xef61('0x18')]({'raw':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b['options'][_0xef61('0x1a')]===undefined?!![]:![]:!![],'where':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b[_0xef61('0x19')][_0xef61('0x1b')]||null:null,'attributes':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b[_0xef61('0x19')][_0xef61('0x1c')]||null:null,'limit':_0x22dc1b['options']?_0x22dc1b['options'][_0xef61('0x1d')]||null:null,'include':_0x22dc1b['options']?_0x22dc1b[_0xef61('0x19')]['include']?_['map'](_0x22dc1b[_0xef61('0x19')]['include'],function(_0x53181b){return{'model':db[_0x53181b[_0xef61('0x1e')]],'as':_0x53181b['as'],'attributes':_0x53181b[_0xef61('0x1c')],'include':_0x53181b[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x53181b['include'],function(_0x16b144){return{'model':db[_0x16b144['model']],'as':_0x16b144['as'],'attributes':_0x16b144[_0xef61('0x1c')],'include':_0x16b144[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x16b144[_0xef61('0x1f')],function(_0x2155f1){return{'model':db[_0x2155f1[_0xef61('0x1e')]],'as':_0x2155f1['as'],'attributes':_0x2155f1[_0xef61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xef61('0x21')](function(_0x297df7){logger[_0xef61('0xd')](_0xef61('0x17'),_0x22dc1b);logger[_0xef61('0x10')](_0xef61('0x17'),_0x22dc1b,JSON[_0xef61('0x12')](_0x297df7));_0x28315a(_0x297df7);})[_0xef61('0x16')](function(_0x85978){logger[_0xef61('0x13')](_0xef61('0x17'),_0x85978[_0xef61('0x15')],_0x22dc1b);_0xdd5e38(_0xfc36d6[_0xef61('0x13')](0x1f4,_0x85978[_0xef61('0x15')]));});});};exports[_0xef61('0x22')]=function(_0x4f35ad){var _0x51d5d1=this;return new Promise(function(_0x38b522,_0x36713e){return db[_0xef61('0x23')]['find']({'raw':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad[_0xef61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad['options']['where']||null:null,'attributes':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad['options'][_0xef61('0x1c')]||null:null,'include':_0x4f35ad['options']?_0x4f35ad[_0xef61('0x19')][_0xef61('0x1f')]?_[_0xef61('0x20')](_0x4f35ad[_0xef61('0x19')][_0xef61('0x1f')],function(_0x1bdcb9){return{'model':db[_0x1bdcb9[_0xef61('0x1e')]],'as':_0x1bdcb9['as'],'attributes':_0x1bdcb9[_0xef61('0x1c')],'include':_0x1bdcb9[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x1bdcb9['include'],function(_0x569db6){return{'model':db[_0x569db6[_0xef61('0x1e')]],'as':_0x569db6['as'],'attributes':_0x569db6[_0xef61('0x1c')],'include':_0x569db6[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x569db6['include'],function(_0x1c38dc){return{'model':db[_0x1c38dc[_0xef61('0x1e')]],'as':_0x1c38dc['as'],'attributes':_0x1c38dc[_0xef61('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b97b){logger['info'](_0xef61('0x22'),_0x4f35ad);logger['debug']('ShowFreshsalesAccount',_0x4f35ad,JSON['stringify'](_0x59b97b));_0x38b522(_0x59b97b);})[_0xef61('0x16')](function(_0x294063){logger[_0xef61('0x13')]('ShowFreshsalesAccount',_0x294063['message'],_0x4f35ad);_0x36713e(_0x51d5d1['error'](0x1f4,_0x294063[_0xef61('0x15')]));});});}; \ No newline at end of file +var _0xadb5=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','raw','options','where','attributes','limit','include','map','model','debug','ShowFreshsalesAccount','FreshsalesAccount','find','util','bluebird'];(function(_0x59b988,_0x22e531){var _0x39d7ac=function(_0x5de0ba){while(--_0x5de0ba){_0x59b988['push'](_0x59b988['shift']());}};_0x39d7ac(++_0x22e531);}(_0xadb5,0xad));var _0x5adb=function(_0x8f3e22,_0x47e0b3){_0x8f3e22=_0x8f3e22-0x0;var _0x5de59c=_0xadb5[_0x8f3e22];return _0x5de59c;};'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']('FreshsalesAccount,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['FreshsalesAccount'][_0x5adb('0x16')]({'raw':_0x529b65['options']?_0x529b65['options'][_0x5adb('0x17')]===undefined?!![]:![]:!![],'where':_0x529b65[_0x5adb('0x18')]?_0x529b65[_0x5adb('0x18')][_0x5adb('0x19')]||null:null,'attributes':_0x529b65[_0x5adb('0x18')]?_0x529b65['options'][_0x5adb('0x1a')]||null:null,'limit':_0x529b65['options']?_0x529b65['options'][_0x5adb('0x1b')]||null:null,'include':_0x529b65[_0x5adb('0x18')]?_0x529b65[_0x5adb('0x18')][_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x529b65[_0x5adb('0x18')][_0x5adb('0x1c')],function(_0x4ca150){return{'model':db[_0x4ca150[_0x5adb('0x1e')]],'as':_0x4ca150['as'],'attributes':_0x4ca150[_0x5adb('0x1a')],'include':_0x4ca150[_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x4ca150[_0x5adb('0x1c')],function(_0x49f203){return{'model':db[_0x49f203[_0x5adb('0x1e')]],'as':_0x49f203['as'],'attributes':_0x49f203[_0x5adb('0x1a')],'include':_0x49f203['include']?_[_0x5adb('0x1d')](_0x49f203[_0x5adb('0x1c')],function(_0x1a0acd){return{'model':db[_0x1a0acd['model']],'as':_0x1a0acd['as'],'attributes':_0x1a0acd[_0x5adb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5adb('0xb')](function(_0x3a4fca){logger[_0x5adb('0xc')](_0x5adb('0x15'),_0x529b65);logger[_0x5adb('0x1f')]('GetFreshsalesAccount',_0x529b65,JSON['stringify'](_0x3a4fca));_0x5de028(_0x3a4fca);})['catch'](function(_0x39bddd){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x39bddd[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x39bddd['message']));});});};exports[_0x5adb('0x20')]=function(_0x34b793){var _0x372da1=this;return new Promise(function(_0x3b1fed,_0x450169){return db[_0x5adb('0x21')][_0x5adb('0x22')]({'raw':_0x34b793[_0x5adb('0x18')]?_0x34b793[_0x5adb('0x18')][_0x5adb('0x17')]===undefined?!![]:![]:!![],'where':_0x34b793['options']?_0x34b793[_0x5adb('0x18')]['where']||null:null,'attributes':_0x34b793[_0x5adb('0x18')]?_0x34b793[_0x5adb('0x18')]['attributes']||null:null,'include':_0x34b793[_0x5adb('0x18')]?_0x34b793[_0x5adb('0x18')][_0x5adb('0x1c')]?_['map'](_0x34b793[_0x5adb('0x18')][_0x5adb('0x1c')],function(_0x4b5887){return{'model':db[_0x4b5887['model']],'as':_0x4b5887['as'],'attributes':_0x4b5887[_0x5adb('0x1a')],'include':_0x4b5887['include']?_[_0x5adb('0x1d')](_0x4b5887[_0x5adb('0x1c')],function(_0x3c2b07){return{'model':db[_0x3c2b07[_0x5adb('0x1e')]],'as':_0x3c2b07['as'],'attributes':_0x3c2b07[_0x5adb('0x1a')],'include':_0x3c2b07['include']?_[_0x5adb('0x1d')](_0x3c2b07[_0x5adb('0x1c')],function(_0x1c3a5c){return{'model':db[_0x1c3a5c['model']],'as':_0x1c3a5c['as'],'attributes':_0x1c3a5c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5adb('0xb')](function(_0x5d1baa){logger['info'](_0x5adb('0x20'),_0x34b793);logger['debug'](_0x5adb('0x20'),_0x34b793,JSON['stringify'](_0x5d1baa));_0x3b1fed(_0x5d1baa);})[_0x5adb('0x14')](function(_0x4d052f){logger[_0x5adb('0x10')](_0x5adb('0x20'),_0x4d052f['message'],_0x34b793);_0x450169(_0x372da1[_0x5adb('0x10')](0x1f4,_0x4d052f['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2909935..3907566 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 _0x232f=['express','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x3a94ea,_0x4b2f67){var _0x27af25=function(_0x121f28){while(--_0x121f28){_0x3a94ea['push'](_0x3a94ea['shift']());}};_0x27af25(++_0x4b2f67);}(_0x232f,0x1cb));var _0xf232=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x232f[_0x4d9bb2];return _0x3179fe;};'use strict';var multer=require('multer');var util=require(_0xf232('0x0'));var path=require(_0xf232('0x1'));var timeout=require(_0xf232('0x2'));var express=require(_0xf232('0x3'));var router=express[_0xf232('0x4')]();var fs_extra=require(_0xf232('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf232('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xf232('0x7')]('/',auth['isAuthenticated'](),controller[_0xf232('0x8')]);router['get'](_0xf232('0x9'),auth[_0xf232('0xa')](),controller[_0xf232('0xb')]);router['get'](_0xf232('0xc'),auth[_0xf232('0xa')](),controller[_0xf232('0xd')]);router[_0xf232('0x7')](_0xf232('0xe'),auth[_0xf232('0xa')](),controller['getDescriptions']);router['get'](_0xf232('0xf'),auth[_0xf232('0xa')](),controller[_0xf232('0x10')]);router['post']('/',auth[_0xf232('0xa')](),controller[_0xf232('0x11')]);router[_0xf232('0x12')](_0xf232('0x9'),auth['isAuthenticated'](),controller[_0xf232('0x13')]);router['delete']('/:id',auth[_0xf232('0xa')](),controller[_0xf232('0x14')]);module[_0xf232('0x15')]=router; \ No newline at end of file +var _0x7dab=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','getFields'];(function(_0x7970d3,_0x6172b4){var _0x5e94d7=function(_0x113c79){while(--_0x113c79){_0x7970d3['push'](_0x7970d3['shift']());}};_0x5e94d7(++_0x6172b4);}(_0x7dab,0xf6));var _0xb7da=function(_0x17febc,_0x2d8285){_0x17febc=_0x17febc-0x0;var _0x145e1c=_0x7dab[_0x17febc];return _0x145e1c;};'use strict';var multer=require(_0xb7da('0x0'));var util=require(_0xb7da('0x1'));var path=require(_0xb7da('0x2'));var timeout=require(_0xb7da('0x3'));var express=require('express');var router=express[_0xb7da('0x4')]();var fs_extra=require(_0xb7da('0x5'));var auth=require(_0xb7da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb7da('0x7'));var controller=require(_0xb7da('0x8'));router[_0xb7da('0x9')]('/',auth[_0xb7da('0xa')](),controller[_0xb7da('0xb')]);router[_0xb7da('0x9')](_0xb7da('0xc'),auth[_0xb7da('0xa')](),controller[_0xb7da('0xd')]);router[_0xb7da('0x9')](_0xb7da('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xb7da('0x9')](_0xb7da('0xf'),auth[_0xb7da('0xa')](),controller[_0xb7da('0x10')]);router[_0xb7da('0x9')]('/:id/fields',auth[_0xb7da('0xa')](),controller[_0xb7da('0x11')]);router['post']('/',auth[_0xb7da('0xa')](),controller[_0xb7da('0x12')]);router[_0xb7da('0x13')](_0xb7da('0xc'),auth[_0xb7da('0xa')](),controller[_0xb7da('0x14')]);router[_0xb7da('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb7da('0x16')]);module[_0xb7da('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a688135..36a5ab0 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5102=['STRING','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5102,0xc1));var _0x2510=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5102[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x2510('0x0'));module[_0x2510('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2510('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 7ee4d70..fdfe208 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 _0x8b82=['bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','getSubjects','findOne','FreshsalesField','length','order','filter','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','moment'];(function(_0x380c7f,_0x234003){var _0x57f3c2=function(_0x5b0848){while(--_0x5b0848){_0x380c7f['push'](_0x380c7f['shift']());}};_0x57f3c2(++_0x234003);}(_0x8b82,0x182));var _0x28b8=function(_0x4d080d,_0x4269ef){_0x4d080d=_0x4d080d-0x0;var _0x4abb25=_0x8b82[_0x4d080d];return _0x4abb25;};'use strict';var emlformat=require(_0x28b8('0x0'));var rimraf=require(_0x28b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28b8('0x2'));var rp=require('request-promise');var moment=require(_0x28b8('0x3'));var BPromise=require(_0x28b8('0x4'));var Mustache=require('mustache');var util=require(_0x28b8('0x5'));var path=require('path');var sox=require(_0x28b8('0x6'));var csv=require(_0x28b8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28b8('0x8'));var squel=require(_0x28b8('0x9'));var crypto=require(_0x28b8('0xa'));var jsforce=require(_0x28b8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x28b8('0x7'));var querystring=require(_0x28b8('0xc'));var Papa=require(_0x28b8('0xd'));var Redis=require(_0x28b8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x28b8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28b8('0x10'));var logger=require('../../config/logger')(_0x28b8('0x11'));var utils=require('../../config/utils');var config=require(_0x28b8('0x12'));var licenseUtil=require(_0x28b8('0x13'));var db=require(_0x28b8('0x14'))['db'];function respondWithStatusCode(_0x49e366,_0x21c9c6){_0x21c9c6=_0x21c9c6||0xcc;return function(_0x36648f){if(_0x36648f){return _0x49e366[_0x28b8('0x15')](_0x21c9c6);}return _0x49e366[_0x28b8('0x16')](_0x21c9c6)[_0x28b8('0x17')]();};}function respondWithResult(_0x55f6ee,_0x2eeb7c){_0x2eeb7c=_0x2eeb7c||0xc8;return function(_0xd144b0){if(_0xd144b0){return _0x55f6ee[_0x28b8('0x16')](_0x2eeb7c)[_0x28b8('0x18')](_0xd144b0);}};}function respondWithFilteredResult(_0x5211ec,_0x265b26){return function(_0x51e58e){if(_0x51e58e){var _0x269ad9=typeof _0x265b26[_0x28b8('0x19')]===_0x28b8('0x1a')&&typeof _0x265b26[_0x28b8('0x1b')]===_0x28b8('0x1a');var _0x479bd7=_0x51e58e[_0x28b8('0x1c')];var _0x36d669=_0x269ad9?0x0:_0x265b26[_0x28b8('0x19')];var _0x20de35=_0x269ad9?_0x51e58e[_0x28b8('0x1c')]:_0x265b26[_0x28b8('0x19')]+_0x265b26[_0x28b8('0x1b')];var _0x9d9fb8;if(_0x20de35>=_0x479bd7){_0x20de35=_0x479bd7;_0x9d9fb8=0xc8;}else{_0x9d9fb8=0xce;}_0x5211ec[_0x28b8('0x16')](_0x9d9fb8);return _0x5211ec[_0x28b8('0x1d')](_0x28b8('0x1e'),_0x36d669+'-'+_0x20de35+'/'+_0x479bd7)['json'](_0x51e58e);}return null;};}function patchUpdates(_0x2e7982){return function(_0x4a42e3){try{jsonpatch['apply'](_0x4a42e3,_0x2e7982,!![]);}catch(_0xf4c0af){return BPromise['reject'](_0xf4c0af);}return _0x4a42e3[_0x28b8('0x1f')]();};}function saveUpdates(_0x1427ec,_0x2d6b3a){return function(_0x2fd45e){if(_0x2fd45e){return _0x2fd45e['update'](_0x1427ec)[_0x28b8('0x20')](function(_0x44d136){return _0x44d136;});}return null;};}function removeEntity(_0x24b833,_0x32b01e){return function(_0xf0dd22){if(_0xf0dd22){return _0xf0dd22[_0x28b8('0x21')]()[_0x28b8('0x20')](function(){_0x24b833[_0x28b8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2c0fc,_0x698d40){return function(_0x34ba3a){if(!_0x34ba3a){_0xd2c0fc[_0x28b8('0x15')](0x194);}return _0x34ba3a;};}function handleError(_0x376b13,_0x57a09b){_0x57a09b=_0x57a09b||0x1f4;return function(_0x4fc66c){logger[_0x28b8('0x22')](_0x4fc66c[_0x28b8('0x23')]);if(_0x4fc66c[_0x28b8('0x24')]){delete _0x4fc66c[_0x28b8('0x24')];}_0x376b13['status'](_0x57a09b)[_0x28b8('0x25')](_0x4fc66c);};}exports[_0x28b8('0x26')]=function(_0x453f9c,_0x56636b){var _0x553124={},_0x508cd3={},_0x2cdccf={'count':0x0,'rows':[]};var _0x22dea6=_['map'](db['FreshsalesConfiguration'][_0x28b8('0x27')],function(_0x5794ae){return{'name':_0x5794ae[_0x28b8('0x28')],'type':_0x5794ae['type'][_0x28b8('0x29')]};});_0x508cd3['model']=_[_0x28b8('0x2a')](_0x22dea6,_0x28b8('0x24'));_0x508cd3[_0x28b8('0x2b')]=_['keys'](_0x453f9c[_0x28b8('0x2b')]);_0x508cd3[_0x28b8('0x2c')]=_[_0x28b8('0x2d')](_0x508cd3[_0x28b8('0x2e')],_0x508cd3[_0x28b8('0x2b')]);_0x553124['attributes']=_[_0x28b8('0x2d')](_0x508cd3[_0x28b8('0x2e')],qs[_0x28b8('0x2f')](_0x453f9c[_0x28b8('0x2b')][_0x28b8('0x2f')]));_0x553124[_0x28b8('0x30')]=_0x553124[_0x28b8('0x30')]['length']?_0x553124[_0x28b8('0x30')]:_0x508cd3['model'];if(!_0x453f9c[_0x28b8('0x2b')][_0x28b8('0x31')](_0x28b8('0x32'))){_0x553124['limit']=qs[_0x28b8('0x1b')](_0x453f9c[_0x28b8('0x2b')][_0x28b8('0x1b')]);_0x553124[_0x28b8('0x19')]=qs[_0x28b8('0x19')](_0x453f9c[_0x28b8('0x2b')][_0x28b8('0x19')]);}_0x553124['order']=qs[_0x28b8('0x33')](_0x453f9c[_0x28b8('0x2b')][_0x28b8('0x33')]);_0x553124[_0x28b8('0x34')]=qs['filters'](_[_0x28b8('0x35')](_0x453f9c[_0x28b8('0x2b')],_0x508cd3[_0x28b8('0x2c')]),_0x22dea6);if(_0x453f9c[_0x28b8('0x2b')]['filter']){_0x553124[_0x28b8('0x34')]=_['merge'](_0x553124[_0x28b8('0x34')],{'$or':_[_0x28b8('0x2a')](_0x22dea6,function(_0xfeb91b){if(_0xfeb91b['type']!==_0x28b8('0x36')){var _0x18bd09={};_0x18bd09[_0xfeb91b[_0x28b8('0x24')]]={'$like':'%'+_0x453f9c[_0x28b8('0x2b')]['filter']+'%'};return _0x18bd09;}})});}_0x553124=_[_0x28b8('0x37')]({},_0x553124,_0x453f9c[_0x28b8('0x38')]);var _0x457cf7={'where':_0x553124[_0x28b8('0x34')]};return db[_0x28b8('0x39')][_0x28b8('0x1c')](_0x457cf7)[_0x28b8('0x20')](function(_0x320224){_0x2cdccf['count']=_0x320224;if(_0x453f9c[_0x28b8('0x2b')][_0x28b8('0x3a')]){_0x553124[_0x28b8('0x3b')]=[{'all':!![]}];}return db[_0x28b8('0x39')][_0x28b8('0x3c')](_0x553124);})['then'](function(_0x3e3842){_0x2cdccf[_0x28b8('0x3d')]=_0x3e3842;return _0x2cdccf;})[_0x28b8('0x20')](respondWithFilteredResult(_0x56636b,_0x553124))[_0x28b8('0x3e')](handleError(_0x56636b,null));};exports[_0x28b8('0x3f')]=function(_0x3390ec,_0x481ab3){var _0x41f35c={'raw':![],'where':{'id':_0x3390ec[_0x28b8('0x40')]['id']}},_0x1b0d74={};_0x1b0d74[_0x28b8('0x2e')]=_[_0x28b8('0x41')](db[_0x28b8('0x39')][_0x28b8('0x27')]);_0x1b0d74[_0x28b8('0x2b')]=_[_0x28b8('0x41')](_0x3390ec['query']);_0x1b0d74[_0x28b8('0x2c')]=_[_0x28b8('0x2d')](_0x1b0d74[_0x28b8('0x2e')],_0x1b0d74[_0x28b8('0x2b')]);_0x41f35c['attributes']=_[_0x28b8('0x2d')](_0x1b0d74[_0x28b8('0x2e')],qs['fields'](_0x3390ec[_0x28b8('0x2b')]['fields']));_0x41f35c[_0x28b8('0x30')]=_0x41f35c[_0x28b8('0x30')]['length']?_0x41f35c[_0x28b8('0x30')]:_0x1b0d74[_0x28b8('0x2e')];if(_0x3390ec[_0x28b8('0x2b')][_0x28b8('0x3a')]){_0x41f35c[_0x28b8('0x3b')]=[{'all':!![]}];}_0x41f35c=_[_0x28b8('0x37')]({},_0x41f35c,_0x3390ec[_0x28b8('0x38')]);return db[_0x28b8('0x39')]['find'](_0x41f35c)[_0x28b8('0x20')](handleEntityNotFound(_0x481ab3,null))[_0x28b8('0x20')](respondWithResult(_0x481ab3,null))['catch'](handleError(_0x481ab3,null));};exports['create']=function(_0x320197,_0x3d3964){return db[_0x28b8('0x39')][_0x28b8('0x42')](_0x320197[_0x28b8('0x43')],{})['then'](respondWithResult(_0x3d3964,0xc9))['catch'](handleError(_0x3d3964,null));};exports[_0x28b8('0x44')]=function(_0x4a0b00,_0x2d5d1b){if(_0x4a0b00[_0x28b8('0x43')]['id']){delete _0x4a0b00[_0x28b8('0x43')]['id'];}return db['FreshsalesConfiguration'][_0x28b8('0x45')]({'where':{'id':_0x4a0b00['params']['id']}})[_0x28b8('0x20')](handleEntityNotFound(_0x2d5d1b,null))[_0x28b8('0x20')](saveUpdates(_0x4a0b00[_0x28b8('0x43')],null))[_0x28b8('0x20')](respondWithResult(_0x2d5d1b,null))[_0x28b8('0x3e')](handleError(_0x2d5d1b,null));};exports['destroy']=function(_0x43f3ad,_0x318e69){return db[_0x28b8('0x39')][_0x28b8('0x45')]({'where':{'id':_0x43f3ad[_0x28b8('0x40')]['id']}})[_0x28b8('0x20')](handleEntityNotFound(_0x318e69,null))[_0x28b8('0x20')](removeEntity(_0x318e69,null))[_0x28b8('0x3e')](handleError(_0x318e69,null));};exports[_0x28b8('0x46')]=function(_0x1b5d8d,_0x6d7ed,_0x23c8af){var _0x21123a={};var _0x3485b7={};var _0x55e3dc;var _0xee9e9;return db[_0x28b8('0x39')][_0x28b8('0x47')]({'where':{'id':_0x1b5d8d[_0x28b8('0x40')]['id']}})['then'](handleEntityNotFound(_0x6d7ed,null))['then'](function(_0x7c84f9){if(_0x7c84f9){_0x55e3dc=_0x7c84f9;_0x3485b7[_0x28b8('0x2e')]=_[_0x28b8('0x41')](db[_0x28b8('0x48')][_0x28b8('0x27')]);_0x3485b7[_0x28b8('0x2b')]=_[_0x28b8('0x41')](_0x1b5d8d['query']);_0x3485b7[_0x28b8('0x2c')]=_['intersection'](_0x3485b7['model'],_0x3485b7['query']);_0x21123a['attributes']=_[_0x28b8('0x2d')](_0x3485b7['model'],qs[_0x28b8('0x2f')](_0x1b5d8d[_0x28b8('0x2b')][_0x28b8('0x2f')]));_0x21123a[_0x28b8('0x30')]=_0x21123a[_0x28b8('0x30')][_0x28b8('0x49')]?_0x21123a[_0x28b8('0x30')]:_0x3485b7[_0x28b8('0x2e')];_0x21123a[_0x28b8('0x4a')]=qs[_0x28b8('0x33')](_0x1b5d8d[_0x28b8('0x2b')][_0x28b8('0x33')]);_0x21123a[_0x28b8('0x34')]=qs[_0x28b8('0x2c')](_[_0x28b8('0x35')](_0x1b5d8d['query'],_0x3485b7[_0x28b8('0x2c')]));if(_0x1b5d8d['query'][_0x28b8('0x4b')]){_0x21123a[_0x28b8('0x34')]=_['merge'](_0x21123a[_0x28b8('0x34')],{'$or':_[_0x28b8('0x2a')](_0x21123a[_0x28b8('0x30')],function(_0x7644f0){var _0x253aed={};_0x253aed[_0x7644f0]={'$like':'%'+_0x1b5d8d[_0x28b8('0x2b')][_0x28b8('0x4b')]+'%'};return _0x253aed;})});}_0x21123a=_[_0x28b8('0x37')]({},_0x21123a,_0x1b5d8d[_0x28b8('0x38')]);return _0x55e3dc['getSubjects'](_0x21123a);}})[_0x28b8('0x20')](function(_0x2c87bd){if(_0x2c87bd){_0xee9e9=_0x2c87bd['length'];if(!_0x1b5d8d[_0x28b8('0x2b')]['hasOwnProperty'](_0x28b8('0x32'))){_0x21123a['limit']=qs[_0x28b8('0x1b')](_0x1b5d8d[_0x28b8('0x2b')][_0x28b8('0x1b')]);_0x21123a[_0x28b8('0x19')]=qs[_0x28b8('0x19')](_0x1b5d8d['query']['offset']);}return _0x55e3dc[_0x28b8('0x46')](_0x21123a);}})[_0x28b8('0x20')](function(_0x4b961f){if(_0x4b961f){return _0x4b961f?{'count':_0xee9e9,'rows':_0x4b961f}:null;}})[_0x28b8('0x20')](respondWithResult(_0x6d7ed,null))[_0x28b8('0x3e')](handleError(_0x6d7ed,null));};exports[_0x28b8('0x4c')]=function(_0x2a84ad,_0x3bbea8,_0x326b33){var _0x5ccc6a={};var _0x516457={};var _0x1f4e67;var _0x526578;return db[_0x28b8('0x39')][_0x28b8('0x47')]({'where':{'id':_0x2a84ad[_0x28b8('0x40')]['id']}})[_0x28b8('0x20')](handleEntityNotFound(_0x3bbea8,null))[_0x28b8('0x20')](function(_0x592783){if(_0x592783){_0x1f4e67=_0x592783;_0x516457[_0x28b8('0x2e')]=_[_0x28b8('0x41')](db['FreshsalesField'][_0x28b8('0x27')]);_0x516457[_0x28b8('0x2b')]=_[_0x28b8('0x41')](_0x2a84ad[_0x28b8('0x2b')]);_0x516457[_0x28b8('0x2c')]=_[_0x28b8('0x2d')](_0x516457[_0x28b8('0x2e')],_0x516457[_0x28b8('0x2b')]);_0x5ccc6a[_0x28b8('0x30')]=_[_0x28b8('0x2d')](_0x516457[_0x28b8('0x2e')],qs[_0x28b8('0x2f')](_0x2a84ad[_0x28b8('0x2b')][_0x28b8('0x2f')]));_0x5ccc6a[_0x28b8('0x30')]=_0x5ccc6a['attributes']['length']?_0x5ccc6a[_0x28b8('0x30')]:_0x516457[_0x28b8('0x2e')];_0x5ccc6a['order']=qs['sort'](_0x2a84ad[_0x28b8('0x2b')][_0x28b8('0x33')]);_0x5ccc6a[_0x28b8('0x34')]=qs[_0x28b8('0x2c')](_[_0x28b8('0x35')](_0x2a84ad[_0x28b8('0x2b')],_0x516457[_0x28b8('0x2c')]));if(_0x2a84ad['query'][_0x28b8('0x4b')]){_0x5ccc6a['where']=_[_0x28b8('0x37')](_0x5ccc6a[_0x28b8('0x34')],{'$or':_['map'](_0x5ccc6a[_0x28b8('0x30')],function(_0x3fc984){var _0x183db1={};_0x183db1[_0x3fc984]={'$like':'%'+_0x2a84ad[_0x28b8('0x2b')][_0x28b8('0x4b')]+'%'};return _0x183db1;})});}_0x5ccc6a=_[_0x28b8('0x37')]({},_0x5ccc6a,_0x2a84ad[_0x28b8('0x38')]);return _0x1f4e67[_0x28b8('0x4c')](_0x5ccc6a);}})[_0x28b8('0x20')](function(_0xaa3c7c){if(_0xaa3c7c){_0x526578=_0xaa3c7c[_0x28b8('0x49')];if(!_0x2a84ad['query'][_0x28b8('0x31')](_0x28b8('0x32'))){_0x5ccc6a[_0x28b8('0x1b')]=qs[_0x28b8('0x1b')](_0x2a84ad[_0x28b8('0x2b')][_0x28b8('0x1b')]);_0x5ccc6a[_0x28b8('0x19')]=qs['offset'](_0x2a84ad[_0x28b8('0x2b')][_0x28b8('0x19')]);}return _0x1f4e67[_0x28b8('0x4c')](_0x5ccc6a);}})[_0x28b8('0x20')](function(_0x2d03ec){if(_0x2d03ec){return _0x2d03ec?{'count':_0x526578,'rows':_0x2d03ec}:null;}})['then'](respondWithResult(_0x3bbea8,null))[_0x28b8('0x3e')](handleError(_0x3bbea8,null));};exports[_0x28b8('0x4d')]=function(_0x403166,_0x45bfdf,_0x3e39db){var _0x5eca1d={};var _0x41eae7={};var _0x5e171e;var _0x47dd98;return db[_0x28b8('0x39')][_0x28b8('0x47')]({'where':{'id':_0x403166[_0x28b8('0x40')]['id']}})[_0x28b8('0x20')](handleEntityNotFound(_0x45bfdf,null))['then'](function(_0x4485e1){if(_0x4485e1){_0x5e171e=_0x4485e1;_0x41eae7[_0x28b8('0x2e')]=_[_0x28b8('0x41')](db[_0x28b8('0x48')][_0x28b8('0x27')]);_0x41eae7[_0x28b8('0x2b')]=_[_0x28b8('0x41')](_0x403166[_0x28b8('0x2b')]);_0x41eae7[_0x28b8('0x2c')]=_[_0x28b8('0x2d')](_0x41eae7[_0x28b8('0x2e')],_0x41eae7['query']);_0x5eca1d[_0x28b8('0x30')]=_[_0x28b8('0x2d')](_0x41eae7[_0x28b8('0x2e')],qs[_0x28b8('0x2f')](_0x403166[_0x28b8('0x2b')][_0x28b8('0x2f')]));_0x5eca1d[_0x28b8('0x30')]=_0x5eca1d[_0x28b8('0x30')][_0x28b8('0x49')]?_0x5eca1d[_0x28b8('0x30')]:_0x41eae7['model'];_0x5eca1d[_0x28b8('0x4a')]=qs[_0x28b8('0x33')](_0x403166['query']['sort']);_0x5eca1d[_0x28b8('0x34')]=qs[_0x28b8('0x2c')](_[_0x28b8('0x35')](_0x403166[_0x28b8('0x2b')],_0x41eae7[_0x28b8('0x2c')]));if(_0x403166[_0x28b8('0x2b')][_0x28b8('0x4b')]){_0x5eca1d['where']=_['merge'](_0x5eca1d[_0x28b8('0x34')],{'$or':_['map'](_0x5eca1d['attributes'],function(_0x1e6c17){var _0x18279a={};_0x18279a[_0x1e6c17]={'$like':'%'+_0x403166[_0x28b8('0x2b')][_0x28b8('0x4b')]+'%'};return _0x18279a;})});}_0x5eca1d=_['merge']({},_0x5eca1d,_0x403166[_0x28b8('0x38')]);return _0x5e171e['getFields'](_0x5eca1d);}})[_0x28b8('0x20')](function(_0x128cf8){if(_0x128cf8){_0x47dd98=_0x128cf8[_0x28b8('0x49')];if(!_0x403166['query']['hasOwnProperty'](_0x28b8('0x32'))){_0x5eca1d['limit']=qs[_0x28b8('0x1b')](_0x403166[_0x28b8('0x2b')][_0x28b8('0x1b')]);_0x5eca1d['offset']=qs['offset'](_0x403166['query']['offset']);}return _0x5e171e[_0x28b8('0x4d')](_0x5eca1d);}})[_0x28b8('0x20')](function(_0x5111e9){if(_0x5111e9){return _0x5111e9?{'count':_0x47dd98,'rows':_0x5111e9}:null;}})[_0x28b8('0x20')](respondWithResult(_0x45bfdf,null))['catch'](handleError(_0x45bfdf,null));}; \ No newline at end of file +var _0xdc3c=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','getSubjects','getDescriptions','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','error','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x239b5a,_0x56199a){var _0x5a701c=function(_0x3cdf2d){while(--_0x3cdf2d){_0x239b5a['push'](_0x239b5a['shift']());}};_0x5a701c(++_0x56199a);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x4eae77,_0x19602a){_0x4eae77=_0x4eae77-0x0;var _0x5e9bdb=_0xdc3c[_0x4eae77];return _0x5e9bdb;};'use strict';var emlformat=require(_0xcdc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcdc3('0x1'));var jsonpatch=require(_0xcdc3('0x2'));var rp=require(_0xcdc3('0x3'));var moment=require(_0xcdc3('0x4'));var BPromise=require(_0xcdc3('0x5'));var Mustache=require(_0xcdc3('0x6'));var util=require(_0xcdc3('0x7'));var path=require(_0xcdc3('0x8'));var sox=require(_0xcdc3('0x9'));var csv=require(_0xcdc3('0xa'));var ejs=require(_0xcdc3('0xb'));var fs=require('fs');var fs_extra=require(_0xcdc3('0xc'));var _=require(_0xcdc3('0xd'));var squel=require(_0xcdc3('0xe'));var crypto=require(_0xcdc3('0xf'));var jsforce=require(_0xcdc3('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcdc3('0x11'));var Redis=require(_0xcdc3('0x12'));var authService=require(_0xcdc3('0x13'));var qs=require(_0xcdc3('0x14'));var as=require(_0xcdc3('0x15'));var hardwareService=require(_0xcdc3('0x16'));var logger=require(_0xcdc3('0x17'))(_0xcdc3('0x18'));var utils=require(_0xcdc3('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcdc3('0x1a'))['db'];function respondWithStatusCode(_0x1ea112,_0x1c22c5){_0x1c22c5=_0x1c22c5||0xcc;return function(_0x432563){if(_0x432563){return _0x1ea112[_0xcdc3('0x1b')](_0x1c22c5);}return _0x1ea112[_0xcdc3('0x1c')](_0x1c22c5)[_0xcdc3('0x1d')]();};}function respondWithResult(_0x359598,_0x59e23e){_0x59e23e=_0x59e23e||0xc8;return function(_0x2b0466){if(_0x2b0466){return _0x359598['status'](_0x59e23e)[_0xcdc3('0x1e')](_0x2b0466);}};}function respondWithFilteredResult(_0x4c725e,_0x30a02b){return function(_0x1855ec){if(_0x1855ec){var _0x1fc4d8=typeof _0x30a02b[_0xcdc3('0x1f')]===_0xcdc3('0x20')&&typeof _0x30a02b[_0xcdc3('0x21')]===_0xcdc3('0x20');var _0x10da40=_0x1855ec[_0xcdc3('0x22')];var _0xc24bd1=_0x1fc4d8?0x0:_0x30a02b[_0xcdc3('0x1f')];var _0x480c1c=_0x1fc4d8?_0x1855ec[_0xcdc3('0x22')]:_0x30a02b[_0xcdc3('0x1f')]+_0x30a02b[_0xcdc3('0x21')];var _0x502365;if(_0x480c1c>=_0x10da40){_0x480c1c=_0x10da40;_0x502365=0xc8;}else{_0x502365=0xce;}_0x4c725e[_0xcdc3('0x1c')](_0x502365);return _0x4c725e[_0xcdc3('0x23')]('Content-Range',_0xc24bd1+'-'+_0x480c1c+'/'+_0x10da40)['json'](_0x1855ec);}return null;};}function patchUpdates(_0x5777ce){return function(_0x3a3be4){try{jsonpatch['apply'](_0x3a3be4,_0x5777ce,!![]);}catch(_0x2c6fc3){return BPromise[_0xcdc3('0x24')](_0x2c6fc3);}return _0x3a3be4[_0xcdc3('0x25')]();};}function saveUpdates(_0x413b8d,_0x158061){return function(_0x2aa1fa){if(_0x2aa1fa){return _0x2aa1fa[_0xcdc3('0x26')](_0x413b8d)['then'](function(_0x4cc661){return _0x4cc661;});}return null;};}function removeEntity(_0x1d88b3,_0x2bc477){return function(_0xaf9fc8){if(_0xaf9fc8){return _0xaf9fc8[_0xcdc3('0x27')]()['then'](function(){_0x1d88b3[_0xcdc3('0x1c')](0xcc)[_0xcdc3('0x1d')]();});}};}function handleEntityNotFound(_0x499d63,_0x180b2f){return function(_0x4465f6){if(!_0x4465f6){_0x499d63['sendStatus'](0x194);}return _0x4465f6;};}function handleError(_0x32ed62,_0x21a9d3){_0x21a9d3=_0x21a9d3||0x1f4;return function(_0x41efc9){logger[_0xcdc3('0x28')](_0x41efc9[_0xcdc3('0x29')]);if(_0x41efc9[_0xcdc3('0x2a')]){delete _0x41efc9[_0xcdc3('0x2a')];}_0x32ed62[_0xcdc3('0x1c')](_0x21a9d3)['send'](_0x41efc9);};}exports[_0xcdc3('0x2b')]=function(_0x590196,_0x1589b0){var _0x257a9b={},_0x574da2={},_0x27b25e={'count':0x0,'rows':[]};var _0x341d47=_['map'](db[_0xcdc3('0x2c')][_0xcdc3('0x2d')],function(_0x3505cd){return{'name':_0x3505cd[_0xcdc3('0x2e')],'type':_0x3505cd[_0xcdc3('0x2f')]['key']};});_0x574da2[_0xcdc3('0x30')]=_[_0xcdc3('0x31')](_0x341d47,_0xcdc3('0x2a'));_0x574da2[_0xcdc3('0x32')]=_[_0xcdc3('0x33')](_0x590196[_0xcdc3('0x32')]);_0x574da2[_0xcdc3('0x34')]=_[_0xcdc3('0x35')](_0x574da2[_0xcdc3('0x30')],_0x574da2['query']);_0x257a9b[_0xcdc3('0x36')]=_[_0xcdc3('0x35')](_0x574da2[_0xcdc3('0x30')],qs['fields'](_0x590196[_0xcdc3('0x32')][_0xcdc3('0x37')]));_0x257a9b[_0xcdc3('0x36')]=_0x257a9b[_0xcdc3('0x36')][_0xcdc3('0x38')]?_0x257a9b[_0xcdc3('0x36')]:_0x574da2[_0xcdc3('0x30')];if(!_0x590196[_0xcdc3('0x32')][_0xcdc3('0x39')](_0xcdc3('0x3a'))){_0x257a9b[_0xcdc3('0x21')]=qs[_0xcdc3('0x21')](_0x590196[_0xcdc3('0x32')][_0xcdc3('0x21')]);_0x257a9b[_0xcdc3('0x1f')]=qs['offset'](_0x590196[_0xcdc3('0x32')][_0xcdc3('0x1f')]);}_0x257a9b[_0xcdc3('0x3b')]=qs[_0xcdc3('0x3c')](_0x590196[_0xcdc3('0x32')][_0xcdc3('0x3c')]);_0x257a9b['where']=qs[_0xcdc3('0x34')](_[_0xcdc3('0x3d')](_0x590196['query'],_0x574da2[_0xcdc3('0x34')]),_0x341d47);if(_0x590196[_0xcdc3('0x32')][_0xcdc3('0x3e')]){_0x257a9b[_0xcdc3('0x3f')]=_[_0xcdc3('0x40')](_0x257a9b[_0xcdc3('0x3f')],{'$or':_[_0xcdc3('0x31')](_0x341d47,function(_0x30095b){if(_0x30095b[_0xcdc3('0x2f')]!=='VIRTUAL'){var _0x51bd3d={};_0x51bd3d[_0x30095b[_0xcdc3('0x2a')]]={'$like':'%'+_0x590196[_0xcdc3('0x32')]['filter']+'%'};return _0x51bd3d;}})});}_0x257a9b=_[_0xcdc3('0x40')]({},_0x257a9b,_0x590196[_0xcdc3('0x41')]);var _0x571dbc={'where':_0x257a9b[_0xcdc3('0x3f')]};return db[_0xcdc3('0x2c')]['count'](_0x571dbc)[_0xcdc3('0x42')](function(_0x543bf6){_0x27b25e['count']=_0x543bf6;if(_0x590196[_0xcdc3('0x32')][_0xcdc3('0x43')]){_0x257a9b[_0xcdc3('0x44')]=[{'all':!![]}];}return db[_0xcdc3('0x2c')][_0xcdc3('0x45')](_0x257a9b);})[_0xcdc3('0x42')](function(_0x5b2036){_0x27b25e[_0xcdc3('0x46')]=_0x5b2036;return _0x27b25e;})[_0xcdc3('0x42')](respondWithFilteredResult(_0x1589b0,_0x257a9b))[_0xcdc3('0x47')](handleError(_0x1589b0,null));};exports[_0xcdc3('0x48')]=function(_0x33f6ea,_0x32366a){var _0x5b4f10={'raw':![],'where':{'id':_0x33f6ea[_0xcdc3('0x49')]['id']}},_0x174191={};_0x174191[_0xcdc3('0x30')]=_[_0xcdc3('0x33')](db['FreshsalesConfiguration'][_0xcdc3('0x2d')]);_0x174191[_0xcdc3('0x32')]=_[_0xcdc3('0x33')](_0x33f6ea[_0xcdc3('0x32')]);_0x174191[_0xcdc3('0x34')]=_[_0xcdc3('0x35')](_0x174191['model'],_0x174191['query']);_0x5b4f10['attributes']=_[_0xcdc3('0x35')](_0x174191[_0xcdc3('0x30')],qs[_0xcdc3('0x37')](_0x33f6ea[_0xcdc3('0x32')][_0xcdc3('0x37')]));_0x5b4f10[_0xcdc3('0x36')]=_0x5b4f10[_0xcdc3('0x36')][_0xcdc3('0x38')]?_0x5b4f10[_0xcdc3('0x36')]:_0x174191['model'];if(_0x33f6ea[_0xcdc3('0x32')][_0xcdc3('0x43')]){_0x5b4f10[_0xcdc3('0x44')]=[{'all':!![]}];}_0x5b4f10=_[_0xcdc3('0x40')]({},_0x5b4f10,_0x33f6ea[_0xcdc3('0x41')]);return db['FreshsalesConfiguration'][_0xcdc3('0x4a')](_0x5b4f10)[_0xcdc3('0x42')](handleEntityNotFound(_0x32366a,null))[_0xcdc3('0x42')](respondWithResult(_0x32366a,null))[_0xcdc3('0x47')](handleError(_0x32366a,null));};exports[_0xcdc3('0x4b')]=function(_0xea0ca7,_0x1ac500){return db[_0xcdc3('0x2c')][_0xcdc3('0x4b')](_0xea0ca7['body'],{})[_0xcdc3('0x42')](respondWithResult(_0x1ac500,0xc9))[_0xcdc3('0x47')](handleError(_0x1ac500,null));};exports['update']=function(_0x3cf3b1,_0x4fedc0){if(_0x3cf3b1[_0xcdc3('0x4c')]['id']){delete _0x3cf3b1['body']['id'];}return db[_0xcdc3('0x2c')]['find']({'where':{'id':_0x3cf3b1[_0xcdc3('0x49')]['id']}})[_0xcdc3('0x42')](handleEntityNotFound(_0x4fedc0,null))['then'](saveUpdates(_0x3cf3b1[_0xcdc3('0x4c')],null))['then'](respondWithResult(_0x4fedc0,null))[_0xcdc3('0x47')](handleError(_0x4fedc0,null));};exports['destroy']=function(_0x4988ba,_0x154e1b){return db[_0xcdc3('0x2c')][_0xcdc3('0x4a')]({'where':{'id':_0x4988ba[_0xcdc3('0x49')]['id']}})[_0xcdc3('0x42')](handleEntityNotFound(_0x154e1b,null))[_0xcdc3('0x42')](removeEntity(_0x154e1b,null))[_0xcdc3('0x47')](handleError(_0x154e1b,null));};exports['getSubjects']=function(_0x1b6d3b,_0x392fcd,_0x539f29){var _0x58067b={};var _0x753071={};var _0x165d0d;var _0x14ecea;return db['FreshsalesConfiguration'][_0xcdc3('0x4d')]({'where':{'id':_0x1b6d3b[_0xcdc3('0x49')]['id']}})[_0xcdc3('0x42')](handleEntityNotFound(_0x392fcd,null))['then'](function(_0xb840c5){if(_0xb840c5){_0x165d0d=_0xb840c5;_0x753071[_0xcdc3('0x30')]=_[_0xcdc3('0x33')](db['FreshsalesField'][_0xcdc3('0x2d')]);_0x753071[_0xcdc3('0x32')]=_[_0xcdc3('0x33')](_0x1b6d3b[_0xcdc3('0x32')]);_0x753071[_0xcdc3('0x34')]=_[_0xcdc3('0x35')](_0x753071['model'],_0x753071['query']);_0x58067b[_0xcdc3('0x36')]=_['intersection'](_0x753071[_0xcdc3('0x30')],qs[_0xcdc3('0x37')](_0x1b6d3b[_0xcdc3('0x32')][_0xcdc3('0x37')]));_0x58067b[_0xcdc3('0x36')]=_0x58067b['attributes'][_0xcdc3('0x38')]?_0x58067b[_0xcdc3('0x36')]:_0x753071[_0xcdc3('0x30')];_0x58067b['order']=qs[_0xcdc3('0x3c')](_0x1b6d3b['query'][_0xcdc3('0x3c')]);_0x58067b['where']=qs[_0xcdc3('0x34')](_['pick'](_0x1b6d3b[_0xcdc3('0x32')],_0x753071[_0xcdc3('0x34')]));if(_0x1b6d3b[_0xcdc3('0x32')]['filter']){_0x58067b[_0xcdc3('0x3f')]=_[_0xcdc3('0x40')](_0x58067b[_0xcdc3('0x3f')],{'$or':_[_0xcdc3('0x31')](_0x58067b[_0xcdc3('0x36')],function(_0x117491){var _0x205975={};_0x205975[_0x117491]={'$like':'%'+_0x1b6d3b[_0xcdc3('0x32')]['filter']+'%'};return _0x205975;})});}_0x58067b=_[_0xcdc3('0x40')]({},_0x58067b,_0x1b6d3b[_0xcdc3('0x41')]);return _0x165d0d['getSubjects'](_0x58067b);}})[_0xcdc3('0x42')](function(_0x1008d7){if(_0x1008d7){_0x14ecea=_0x1008d7['length'];if(!_0x1b6d3b[_0xcdc3('0x32')][_0xcdc3('0x39')](_0xcdc3('0x3a'))){_0x58067b[_0xcdc3('0x21')]=qs[_0xcdc3('0x21')](_0x1b6d3b[_0xcdc3('0x32')][_0xcdc3('0x21')]);_0x58067b[_0xcdc3('0x1f')]=qs['offset'](_0x1b6d3b['query']['offset']);}return _0x165d0d[_0xcdc3('0x4e')](_0x58067b);}})['then'](function(_0x380ca6){if(_0x380ca6){return _0x380ca6?{'count':_0x14ecea,'rows':_0x380ca6}:null;}})[_0xcdc3('0x42')](respondWithResult(_0x392fcd,null))[_0xcdc3('0x47')](handleError(_0x392fcd,null));};exports[_0xcdc3('0x4f')]=function(_0x2a3224,_0x1222e5,_0x3fa936){var _0x57e61e={};var _0x2f5bea={};var _0x327497;var _0x3d2d59;return db[_0xcdc3('0x2c')][_0xcdc3('0x4d')]({'where':{'id':_0x2a3224[_0xcdc3('0x49')]['id']}})[_0xcdc3('0x42')](handleEntityNotFound(_0x1222e5,null))[_0xcdc3('0x42')](function(_0x26d85b){if(_0x26d85b){_0x327497=_0x26d85b;_0x2f5bea[_0xcdc3('0x30')]=_[_0xcdc3('0x33')](db[_0xcdc3('0x50')][_0xcdc3('0x2d')]);_0x2f5bea[_0xcdc3('0x32')]=_[_0xcdc3('0x33')](_0x2a3224[_0xcdc3('0x32')]);_0x2f5bea['filters']=_[_0xcdc3('0x35')](_0x2f5bea['model'],_0x2f5bea[_0xcdc3('0x32')]);_0x57e61e[_0xcdc3('0x36')]=_[_0xcdc3('0x35')](_0x2f5bea[_0xcdc3('0x30')],qs['fields'](_0x2a3224['query']['fields']));_0x57e61e[_0xcdc3('0x36')]=_0x57e61e[_0xcdc3('0x36')][_0xcdc3('0x38')]?_0x57e61e[_0xcdc3('0x36')]:_0x2f5bea[_0xcdc3('0x30')];_0x57e61e[_0xcdc3('0x3b')]=qs[_0xcdc3('0x3c')](_0x2a3224[_0xcdc3('0x32')][_0xcdc3('0x3c')]);_0x57e61e[_0xcdc3('0x3f')]=qs[_0xcdc3('0x34')](_[_0xcdc3('0x3d')](_0x2a3224[_0xcdc3('0x32')],_0x2f5bea[_0xcdc3('0x34')]));if(_0x2a3224['query'][_0xcdc3('0x3e')]){_0x57e61e[_0xcdc3('0x3f')]=_[_0xcdc3('0x40')](_0x57e61e[_0xcdc3('0x3f')],{'$or':_[_0xcdc3('0x31')](_0x57e61e['attributes'],function(_0x4bcce7){var _0x3e1b0c={};_0x3e1b0c[_0x4bcce7]={'$like':'%'+_0x2a3224[_0xcdc3('0x32')][_0xcdc3('0x3e')]+'%'};return _0x3e1b0c;})});}_0x57e61e=_[_0xcdc3('0x40')]({},_0x57e61e,_0x2a3224[_0xcdc3('0x41')]);return _0x327497[_0xcdc3('0x4f')](_0x57e61e);}})[_0xcdc3('0x42')](function(_0x12dadc){if(_0x12dadc){_0x3d2d59=_0x12dadc['length'];if(!_0x2a3224[_0xcdc3('0x32')][_0xcdc3('0x39')](_0xcdc3('0x3a'))){_0x57e61e[_0xcdc3('0x21')]=qs[_0xcdc3('0x21')](_0x2a3224['query'][_0xcdc3('0x21')]);_0x57e61e[_0xcdc3('0x1f')]=qs['offset'](_0x2a3224['query']['offset']);}return _0x327497['getDescriptions'](_0x57e61e);}})[_0xcdc3('0x42')](function(_0x280462){if(_0x280462){return _0x280462?{'count':_0x3d2d59,'rows':_0x280462}:null;}})[_0xcdc3('0x42')](respondWithResult(_0x1222e5,null))[_0xcdc3('0x47')](handleError(_0x1222e5,null));};exports[_0xcdc3('0x51')]=function(_0x15c382,_0x114482,_0x4c32a0){var _0xad3b12={};var _0x157c26={};var _0x56fd4f;var _0x32cc3a;return db[_0xcdc3('0x2c')][_0xcdc3('0x4d')]({'where':{'id':_0x15c382[_0xcdc3('0x49')]['id']}})[_0xcdc3('0x42')](handleEntityNotFound(_0x114482,null))[_0xcdc3('0x42')](function(_0xb97b1b){if(_0xb97b1b){_0x56fd4f=_0xb97b1b;_0x157c26['model']=_['keys'](db[_0xcdc3('0x50')][_0xcdc3('0x2d')]);_0x157c26[_0xcdc3('0x32')]=_['keys'](_0x15c382[_0xcdc3('0x32')]);_0x157c26['filters']=_[_0xcdc3('0x35')](_0x157c26['model'],_0x157c26[_0xcdc3('0x32')]);_0xad3b12[_0xcdc3('0x36')]=_['intersection'](_0x157c26['model'],qs[_0xcdc3('0x37')](_0x15c382[_0xcdc3('0x32')][_0xcdc3('0x37')]));_0xad3b12[_0xcdc3('0x36')]=_0xad3b12[_0xcdc3('0x36')][_0xcdc3('0x38')]?_0xad3b12[_0xcdc3('0x36')]:_0x157c26[_0xcdc3('0x30')];_0xad3b12[_0xcdc3('0x3b')]=qs[_0xcdc3('0x3c')](_0x15c382[_0xcdc3('0x32')]['sort']);_0xad3b12[_0xcdc3('0x3f')]=qs[_0xcdc3('0x34')](_[_0xcdc3('0x3d')](_0x15c382[_0xcdc3('0x32')],_0x157c26[_0xcdc3('0x34')]));if(_0x15c382[_0xcdc3('0x32')]['filter']){_0xad3b12[_0xcdc3('0x3f')]=_[_0xcdc3('0x40')](_0xad3b12[_0xcdc3('0x3f')],{'$or':_['map'](_0xad3b12['attributes'],function(_0x51c749){var _0xd84019={};_0xd84019[_0x51c749]={'$like':'%'+_0x15c382['query'][_0xcdc3('0x3e')]+'%'};return _0xd84019;})});}_0xad3b12=_[_0xcdc3('0x40')]({},_0xad3b12,_0x15c382[_0xcdc3('0x41')]);return _0x56fd4f[_0xcdc3('0x51')](_0xad3b12);}})[_0xcdc3('0x42')](function(_0x5cc2d9){if(_0x5cc2d9){_0x32cc3a=_0x5cc2d9[_0xcdc3('0x38')];if(!_0x15c382[_0xcdc3('0x32')][_0xcdc3('0x39')]('nolimit')){_0xad3b12[_0xcdc3('0x21')]=qs[_0xcdc3('0x21')](_0x15c382[_0xcdc3('0x32')][_0xcdc3('0x21')]);_0xad3b12[_0xcdc3('0x1f')]=qs['offset'](_0x15c382['query']['offset']);}return _0x56fd4f[_0xcdc3('0x51')](_0xad3b12);}})[_0xcdc3('0x42')](function(_0x466825){if(_0x466825){return _0x466825?{'count':_0x32cc3a,'rows':_0x466825}:null;}})['then'](respondWithResult(_0x114482,null))['catch'](handleError(_0x114482,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9b0b8a1..0f4de05 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 _0x3ff8=['FreshsalesConfiguration','util','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','define'];(function(_0x1e93fa,_0x210f48){var _0xd4e1e6=function(_0x3149da){while(--_0x3149da){_0x1e93fa['push'](_0x1e93fa['shift']());}};_0xd4e1e6(++_0x210f48);}(_0x3ff8,0xc7));var _0x83ff=function(_0x38cd4c,_0x2702cf){_0x38cd4c=_0x38cd4c-0x0;var _0x31f5a4=_0x3ff8[_0x38cd4c];return _0x31f5a4;};'use strict';var _=require('lodash');var util=require(_0x83ff('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x83ff('0x1'));var BPromise=require(_0x83ff('0x2'));var rp=require(_0x83ff('0x3'));var fs=require('fs');var path=require(_0x83ff('0x4'));var rimraf=require(_0x83ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x83ff('0x6'));module['exports']=function(_0x596c5f,_0x47db78){return _0x596c5f[_0x83ff('0x7')](_0x83ff('0x8'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x531d=['lodash','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations'];(function(_0x3683db,_0x1e07cf){var _0x25b361=function(_0x2e8c65){while(--_0x2e8c65){_0x3683db['push'](_0x3683db['shift']());}};_0x25b361(++_0x1e07cf);}(_0x531d,0x132));var _0xd531=function(_0x16b1e3,_0x3e6d04){_0x16b1e3=_0x16b1e3-0x0;var _0x5138e9=_0x531d[_0x16b1e3];return _0x5138e9;};'use strict';var _=require(_0xd531('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd531('0x1'));var rp=require(_0xd531('0x2'));var fs=require('fs');var path=require(_0xd531('0x3'));var rimraf=require('rimraf');var config=require(_0xd531('0x4'));var attributes=require(_0xd531('0x5'));module[_0xd531('0x6')]=function(_0x234889,_0x18a084){return _0x234889[_0xd531('0x7')]('FreshsalesConfiguration',attributes,{'tableName':_0xd531('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 54a47ec..c01428d 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 _0x2f91=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x2577e7,_0x2a4097){var _0x2fcd88=function(_0x13b00d){while(--_0x13b00d){_0x2577e7['push'](_0x2577e7['shift']());}};_0x2fcd88(++_0x2a4097);}(_0x2f91,0xf9));var _0x12f9=function(_0x436291,_0x770cbe){_0x436291=_0x436291-0x0;var _0x59dfc3=_0x2f91[_0x436291];return _0x59dfc3;};'use strict';var _=require(_0x12f9('0x0'));var util=require(_0x12f9('0x1'));var moment=require('moment');var BPromise=require(_0x12f9('0x2'));var rs=require(_0x12f9('0x3'));var fs=require('fs');var Redis=require(_0x12f9('0x4'));var db=require(_0x12f9('0x5'))['db'];var utils=require(_0x12f9('0x6'));var logger=require(_0x12f9('0x7'))(_0x12f9('0x8'));var config=require(_0x12f9('0x9'));var jayson=require(_0x12f9('0xa'));var client=jayson[_0x12f9('0xb')][_0x12f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x215a40,_0x2bb946,_0x1910cc){return new BPromise(function(_0x49e838,_0x56ffdd){return client['request'](_0x215a40,_0x1910cc)['then'](function(_0x28b4db){logger[_0x12f9('0xd')](_0x12f9('0xe'),_0x2bb946,_0x12f9('0xf'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2bb946,'request\x20sent',JSON[_0x12f9('0x10')](_0x28b4db));if(_0x28b4db[_0x12f9('0x11')]){if(_0x28b4db['error'][_0x12f9('0x12')]===0x1f4){logger[_0x12f9('0x11')](_0x12f9('0xe'),_0x2bb946,_0x28b4db[_0x12f9('0x11')]['message']);return _0x56ffdd(_0x28b4db[_0x12f9('0x11')][_0x12f9('0x13')]);}logger['error'](_0x12f9('0xe'),_0x2bb946,_0x28b4db[_0x12f9('0x11')][_0x12f9('0x13')]);return _0x49e838(_0x28b4db[_0x12f9('0x11')]['message']);}else{logger[_0x12f9('0xd')](_0x12f9('0xe'),_0x2bb946,'request\x20sent');_0x49e838(_0x28b4db[_0x12f9('0x14')][_0x12f9('0x13')]);}})[_0x12f9('0x15')](function(_0x28c641){logger['error'](_0x12f9('0xe'),_0x2bb946,_0x28c641);_0x56ffdd(_0x28c641);});});} \ No newline at end of file +var _0xfbb8=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2302af,_0x188370){var _0x89b76=function(_0x3ede7d){while(--_0x3ede7d){_0x2302af['push'](_0x2302af['shift']());}};_0x89b76(++_0x188370);}(_0xfbb8,0x1bf));var _0x8fbb=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0xfbb8[_0x1d5400];return _0x21d9fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8fbb('0x0'));var BPromise=require(_0x8fbb('0x1'));var rs=require(_0x8fbb('0x2'));var fs=require('fs');var Redis=require(_0x8fbb('0x3'));var db=require(_0x8fbb('0x4'))['db'];var utils=require(_0x8fbb('0x5'));var logger=require(_0x8fbb('0x6'))(_0x8fbb('0x7'));var config=require(_0x8fbb('0x8'));var jayson=require(_0x8fbb('0x9'));var client=jayson[_0x8fbb('0xa')][_0x8fbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x304345,_0x172695,_0x2bb9ff){return new BPromise(function(_0x476c3f,_0x4a6631){return client[_0x8fbb('0xc')](_0x304345,_0x2bb9ff)['then'](function(_0x40e9f4){logger[_0x8fbb('0xd')](_0x8fbb('0xe'),_0x172695,_0x8fbb('0xf'));logger[_0x8fbb('0x10')](_0x8fbb('0x11'),_0x172695,_0x8fbb('0xf'),JSON[_0x8fbb('0x12')](_0x40e9f4));if(_0x40e9f4[_0x8fbb('0x13')]){if(_0x40e9f4['error'][_0x8fbb('0x14')]===0x1f4){logger[_0x8fbb('0x13')](_0x8fbb('0xe'),_0x172695,_0x40e9f4[_0x8fbb('0x13')][_0x8fbb('0x15')]);return _0x4a6631(_0x40e9f4[_0x8fbb('0x13')]['message']);}logger['error'](_0x8fbb('0xe'),_0x172695,_0x40e9f4[_0x8fbb('0x13')][_0x8fbb('0x15')]);return _0x476c3f(_0x40e9f4[_0x8fbb('0x13')][_0x8fbb('0x15')]);}else{logger[_0x8fbb('0xd')](_0x8fbb('0xe'),_0x172695,_0x8fbb('0xf'));_0x476c3f(_0x40e9f4[_0x8fbb('0x16')]['message']);}})['catch'](function(_0x5e389b){logger[_0x8fbb('0x13')](_0x8fbb('0xe'),_0x172695,_0x5e389b);_0x4a6631(_0x5e389b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 034f0ed..811a160 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 _0x34e5=['update','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x20d4db,_0x4e82b4){var _0x974b0a=function(_0x3018fd){while(--_0x3018fd){_0x20d4db['push'](_0x20d4db['shift']());}};_0x974b0a(++_0x4e82b4);}(_0x34e5,0x172));var _0x534e=function(_0x3d3a9d,_0x1ebddd){_0x3d3a9d=_0x3d3a9d-0x0;var _0x217d6f=_0x34e5[_0x3d3a9d];return _0x217d6f;};'use strict';var multer=require('multer');var util=require(_0x534e('0x0'));var path=require('path');var timeout=require(_0x534e('0x1'));var express=require(_0x534e('0x2'));var router=express[_0x534e('0x3')]();var fs_extra=require(_0x534e('0x4'));var auth=require(_0x534e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x534e('0x6'));var controller=require(_0x534e('0x7'));router[_0x534e('0x8')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xa')]);router[_0x534e('0x8')](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0xc')]);router[_0x534e('0xd')]('/',auth[_0x534e('0x9')](),controller['create']);router['put'](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0xe')]);router['delete'](_0x534e('0xb'),auth[_0x534e('0x9')](),controller[_0x534e('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd4bd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','index','/:id','isAuthenticated','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x1e7e12,_0x586d42){_0x1e7e12=_0x1e7e12-0x0;var _0x32781c=_0xd4bd[_0x1e7e12];return _0x32781c;};'use strict';var multer=require(_0xdd4b('0x0'));var util=require(_0xdd4b('0x1'));var path=require(_0xdd4b('0x2'));var timeout=require(_0xdd4b('0x3'));var express=require(_0xdd4b('0x4'));var router=express['Router']();var fs_extra=require(_0xdd4b('0x5'));var auth=require(_0xdd4b('0x6'));var interaction=require(_0xdd4b('0x7'));var config=require(_0xdd4b('0x8'));var controller=require(_0xdd4b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd4b('0xa')]);router['get'](_0xdd4b('0xb'),auth[_0xdd4b('0xc')](),controller['show']);router['post']('/',auth[_0xdd4b('0xc')](),controller[_0xdd4b('0xd')]);router['put'](_0xdd4b('0xb'),auth[_0xdd4b('0xc')](),controller[_0xdd4b('0xe')]);router['delete'](_0xdd4b('0xb'),auth[_0xdd4b('0xc')](),controller[_0xdd4b('0xf')]);module[_0xdd4b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ef25325..b55618c 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 _0xa0f5=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xa0f5,0xcb));var _0x5a0f=function(_0x382f2e,_0x51a760){_0x382f2e=_0x382f2e-0x0;var _0xc41dda=_0xa0f5[_0x382f2e];return _0xc41dda;};'use strict';var Sequelize=require(_0x5a0f('0x0'));module[_0x5a0f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5a0f('0x2'),_0x5a0f('0x3'),_0x5a0f('0x4'),_0x5a0f('0x5'),_0x5a0f('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5a0f('0x7')]},'key':{'type':Sequelize[_0x5a0f('0x7')]},'keyType':{'type':Sequelize[_0x5a0f('0x8')](_0x5a0f('0x2'),'variable',_0x5a0f('0x4'))},'keyContent':{'type':Sequelize[_0x5a0f('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5a0f('0x7')]},'customField':{'type':Sequelize[_0x5a0f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a0f('0x7')]}}; \ No newline at end of file +var _0xf26d=['variable','BOOLEAN','sequelize','exports','ENUM','customVariable','picklist','string','STRING'];(function(_0x317c09,_0x4ce12d){var _0x3a404a=function(_0x108f94){while(--_0x108f94){_0x317c09['push'](_0x317c09['shift']());}};_0x3a404a(++_0x4ce12d);}(_0xf26d,0x1c4));var _0xdf26=function(_0x26b7fe,_0x3e9f08){_0x26b7fe=_0x26b7fe-0x0;var _0x4ad65f=_0xf26d[_0x26b7fe];return _0x4ad65f;};'use strict';var Sequelize=require(_0xdf26('0x0'));module[_0xdf26('0x1')]={'type':{'type':Sequelize[_0xdf26('0x2')]('string','variable',_0xdf26('0x3'),'keyValue',_0xdf26('0x4')),'defaultValue':_0xdf26('0x5')},'content':{'type':Sequelize[_0xdf26('0x6')]},'key':{'type':Sequelize[_0xdf26('0x6')]},'keyType':{'type':Sequelize[_0xdf26('0x2')](_0xdf26('0x5'),_0xdf26('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xdf26('0x6')]},'idField':{'type':Sequelize[_0xdf26('0x6')]},'nameField':{'type':Sequelize[_0xdf26('0x6')]},'customField':{'type':Sequelize[_0xdf26('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf26('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ed007f4..1431064 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 _0x19a3=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','stack','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','show','params','keys','length','find','catch','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x9117bb,_0x3cc3d9){var _0x4df1ad=function(_0x1a1e02){while(--_0x1a1e02){_0x9117bb['push'](_0x9117bb['shift']());}};_0x4df1ad(++_0x3cc3d9);}(_0x19a3,0xc1));var _0x319a=function(_0x941fde,_0x10e1ee){_0x941fde=_0x941fde-0x0;var _0x158aeb=_0x19a3[_0x941fde];return _0x158aeb;};'use strict';var emlformat=require(_0x319a('0x0'));var rimraf=require(_0x319a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x319a('0x2'));var moment=require(_0x319a('0x3'));var BPromise=require(_0x319a('0x4'));var Mustache=require(_0x319a('0x5'));var util=require(_0x319a('0x6'));var path=require(_0x319a('0x7'));var sox=require(_0x319a('0x8'));var csv=require(_0x319a('0x9'));var ejs=require(_0x319a('0xa'));var fs=require('fs');var fs_extra=require(_0x319a('0xb'));var _=require(_0x319a('0xc'));var squel=require(_0x319a('0xd'));var crypto=require(_0x319a('0xe'));var jsforce=require(_0x319a('0xf'));var deskjs=require(_0x319a('0x10'));var toCsv=require(_0x319a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x319a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x319a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x319a('0x13'));var logger=require(_0x319a('0x14'))(_0x319a('0x15'));var utils=require('../../config/utils');var config=require(_0x319a('0x16'));var licenseUtil=require(_0x319a('0x17'));var db=require(_0x319a('0x18'))['db'];function respondWithStatusCode(_0x29aedc,_0x5958db){_0x5958db=_0x5958db||0xcc;return function(_0x520ce5){if(_0x520ce5){return _0x29aedc['sendStatus'](_0x5958db);}return _0x29aedc[_0x319a('0x19')](_0x5958db)['end']();};}function respondWithResult(_0x5af038,_0x52774b){_0x52774b=_0x52774b||0xc8;return function(_0x386c39){if(_0x386c39){return _0x5af038[_0x319a('0x19')](_0x52774b)[_0x319a('0x1a')](_0x386c39);}};}function respondWithFilteredResult(_0x4ba51b,_0x4fafc1){return function(_0x22d0e4){if(_0x22d0e4){var _0x40978c=typeof _0x4fafc1[_0x319a('0x1b')]==='undefined'&&typeof _0x4fafc1[_0x319a('0x1c')]==='undefined';var _0x570681=_0x22d0e4[_0x319a('0x1d')];var _0x35e3f6=_0x40978c?0x0:_0x4fafc1[_0x319a('0x1b')];var _0xc1ad9c=_0x40978c?_0x22d0e4[_0x319a('0x1d')]:_0x4fafc1[_0x319a('0x1b')]+_0x4fafc1[_0x319a('0x1c')];var _0x3ff41e;if(_0xc1ad9c>=_0x570681){_0xc1ad9c=_0x570681;_0x3ff41e=0xc8;}else{_0x3ff41e=0xce;}_0x4ba51b[_0x319a('0x19')](_0x3ff41e);return _0x4ba51b[_0x319a('0x1e')](_0x319a('0x1f'),_0x35e3f6+'-'+_0xc1ad9c+'/'+_0x570681)[_0x319a('0x1a')](_0x22d0e4);}return null;};}function patchUpdates(_0x44ada0){return function(_0x51800d){try{jsonpatch['apply'](_0x51800d,_0x44ada0,!![]);}catch(_0x73c78a){return BPromise['reject'](_0x73c78a);}return _0x51800d[_0x319a('0x20')]();};}function saveUpdates(_0x2236be,_0x2acac5){return function(_0x1fae93){if(_0x1fae93){return _0x1fae93[_0x319a('0x21')](_0x2236be)[_0x319a('0x22')](function(_0x24dfe4){return _0x24dfe4;});}return null;};}function removeEntity(_0x28a433,_0x4a56aa){return function(_0x30cbaa){if(_0x30cbaa){return _0x30cbaa[_0x319a('0x23')]()[_0x319a('0x22')](function(){_0x28a433[_0x319a('0x19')](0xcc)[_0x319a('0x24')]();});}};}function handleEntityNotFound(_0x4e2287,_0x318abe){return function(_0x24b965){if(!_0x24b965){_0x4e2287[_0x319a('0x25')](0x194);}return _0x24b965;};}function handleError(_0x412c1c,_0x41a407){_0x41a407=_0x41a407||0x1f4;return function(_0xa6c114){logger[_0x319a('0x26')](_0xa6c114[_0x319a('0x27')]);if(_0xa6c114['name']){delete _0xa6c114['name'];}_0x412c1c['status'](_0x41a407)[_0x319a('0x28')](_0xa6c114);};}exports[_0x319a('0x29')]=function(_0x111a59,_0xdd3681){var _0x175c3d={},_0x29349d={},_0x476e45={'count':0x0,'rows':[]};var _0x2d2a34=_[_0x319a('0x2a')](db[_0x319a('0x2b')][_0x319a('0x2c')],function(_0x21fa55){return{'name':_0x21fa55[_0x319a('0x2d')],'type':_0x21fa55[_0x319a('0x2e')]['key']};});_0x29349d[_0x319a('0x2f')]=_[_0x319a('0x2a')](_0x2d2a34,'name');_0x29349d[_0x319a('0x30')]=_['keys'](_0x111a59['query']);_0x29349d['filters']=_['intersection'](_0x29349d[_0x319a('0x2f')],_0x29349d[_0x319a('0x30')]);_0x175c3d[_0x319a('0x31')]=_[_0x319a('0x32')](_0x29349d['model'],qs[_0x319a('0x33')](_0x111a59[_0x319a('0x30')][_0x319a('0x33')]));_0x175c3d[_0x319a('0x31')]=_0x175c3d[_0x319a('0x31')]['length']?_0x175c3d[_0x319a('0x31')]:_0x29349d[_0x319a('0x2f')];if(!_0x111a59['query'][_0x319a('0x34')](_0x319a('0x35'))){_0x175c3d['limit']=qs[_0x319a('0x1c')](_0x111a59[_0x319a('0x30')][_0x319a('0x1c')]);_0x175c3d['offset']=qs[_0x319a('0x1b')](_0x111a59[_0x319a('0x30')][_0x319a('0x1b')]);}_0x175c3d[_0x319a('0x36')]=qs[_0x319a('0x37')](_0x111a59[_0x319a('0x30')][_0x319a('0x37')]);_0x175c3d[_0x319a('0x38')]=qs['filters'](_[_0x319a('0x39')](_0x111a59[_0x319a('0x30')],_0x29349d['filters']),_0x2d2a34);if(_0x111a59[_0x319a('0x30')][_0x319a('0x3a')]){_0x175c3d[_0x319a('0x38')]=_[_0x319a('0x3b')](_0x175c3d[_0x319a('0x38')],{'$or':_['map'](_0x2d2a34,function(_0x43904c){if(_0x43904c[_0x319a('0x2e')]!==_0x319a('0x3c')){var _0x3e13c6={};_0x3e13c6[_0x43904c['name']]={'$like':'%'+_0x111a59[_0x319a('0x30')][_0x319a('0x3a')]+'%'};return _0x3e13c6;}})});}_0x175c3d=_[_0x319a('0x3b')]({},_0x175c3d,_0x111a59['options']);var _0x47c0fc={'where':_0x175c3d[_0x319a('0x38')]};return db[_0x319a('0x2b')][_0x319a('0x1d')](_0x47c0fc)[_0x319a('0x22')](function(_0x59171b){_0x476e45['count']=_0x59171b;if(_0x111a59[_0x319a('0x30')]['includeAll']){_0x175c3d[_0x319a('0x3d')]=[{'all':!![]}];}return db[_0x319a('0x2b')]['findAll'](_0x175c3d);})['then'](function(_0x51dda7){_0x476e45['rows']=_0x51dda7;return _0x476e45;})[_0x319a('0x22')](respondWithFilteredResult(_0xdd3681,_0x175c3d))['catch'](handleError(_0xdd3681,null));};exports[_0x319a('0x3e')]=function(_0x1e03b6,_0x16b146){var _0x493783={'raw':!![],'where':{'id':_0x1e03b6[_0x319a('0x3f')]['id']}},_0x698be6={};_0x698be6[_0x319a('0x2f')]=_[_0x319a('0x40')](db[_0x319a('0x2b')][_0x319a('0x2c')]);_0x698be6[_0x319a('0x30')]=_[_0x319a('0x40')](_0x1e03b6[_0x319a('0x30')]);_0x698be6['filters']=_[_0x319a('0x32')](_0x698be6[_0x319a('0x2f')],_0x698be6['query']);_0x493783[_0x319a('0x31')]=_[_0x319a('0x32')](_0x698be6[_0x319a('0x2f')],qs['fields'](_0x1e03b6[_0x319a('0x30')][_0x319a('0x33')]));_0x493783[_0x319a('0x31')]=_0x493783['attributes'][_0x319a('0x41')]?_0x493783[_0x319a('0x31')]:_0x698be6[_0x319a('0x2f')];if(_0x1e03b6[_0x319a('0x30')]['includeAll']){_0x493783[_0x319a('0x3d')]=[{'all':!![]}];}_0x493783=_[_0x319a('0x3b')]({},_0x493783,_0x1e03b6['options']);return db[_0x319a('0x2b')][_0x319a('0x42')](_0x493783)['then'](handleEntityNotFound(_0x16b146,null))['then'](respondWithResult(_0x16b146,null))[_0x319a('0x43')](handleError(_0x16b146,null));};exports['create']=function(_0x41e92d,_0x6be786){return db[_0x319a('0x2b')][_0x319a('0x44')](_0x41e92d[_0x319a('0x45')],{})['then'](respondWithResult(_0x6be786,0xc9))['catch'](handleError(_0x6be786,null));};exports[_0x319a('0x21')]=function(_0x4645ca,_0x423b5b){if(_0x4645ca[_0x319a('0x45')]['id']){delete _0x4645ca[_0x319a('0x45')]['id'];}return db[_0x319a('0x2b')]['find']({'where':{'id':_0x4645ca[_0x319a('0x3f')]['id']}})[_0x319a('0x22')](handleEntityNotFound(_0x423b5b,null))[_0x319a('0x22')](saveUpdates(_0x4645ca[_0x319a('0x45')],null))[_0x319a('0x22')](respondWithResult(_0x423b5b,null))['catch'](handleError(_0x423b5b,null));};exports[_0x319a('0x23')]=function(_0x21e6db,_0x1f2fed){return db['FreshsalesField']['find']({'where':{'id':_0x21e6db['params']['id']}})['then'](handleEntityNotFound(_0x1f2fed,null))['then'](removeEntity(_0x1f2fed,null))[_0x319a('0x43')](handleError(_0x1f2fed,null));}; \ No newline at end of file +var _0x9cb8=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','status','send','map','FreshsalesField','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','eml-format','zip-dir','request-promise','moment','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/logger','api','../../config/utils'];(function(_0x40ca6d,_0x4bedbd){var _0x194262=function(_0x2d6765){while(--_0x2d6765){_0x40ca6d['push'](_0x40ca6d['shift']());}};_0x194262(++_0x4bedbd);}(_0x9cb8,0x1b7));var _0x89cb=function(_0x3bcf5d,_0x32e8e2){_0x3bcf5d=_0x3bcf5d-0x0;var _0x4fef8e=_0x9cb8[_0x3bcf5d];return _0x4fef8e;};'use strict';var emlformat=require(_0x89cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89cb('0x2'));var moment=require(_0x89cb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89cb('0x4'));var path=require(_0x89cb('0x5'));var sox=require(_0x89cb('0x6'));var csv=require(_0x89cb('0x7'));var ejs=require(_0x89cb('0x8'));var fs=require('fs');var fs_extra=require(_0x89cb('0x9'));var _=require(_0x89cb('0xa'));var squel=require(_0x89cb('0xb'));var crypto=require(_0x89cb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x89cb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x89cb('0xe'));var Papa=require(_0x89cb('0xf'));var Redis=require('ioredis');var authService=require(_0x89cb('0x10'));var qs=require(_0x89cb('0x11'));var as=require(_0x89cb('0x12'));var hardwareService=require(_0x89cb('0x13'));var logger=require(_0x89cb('0x14'))(_0x89cb('0x15'));var utils=require(_0x89cb('0x16'));var config=require(_0x89cb('0x17'));var licenseUtil=require(_0x89cb('0x18'));var db=require(_0x89cb('0x19'))['db'];function respondWithStatusCode(_0x283107,_0xe985d3){_0xe985d3=_0xe985d3||0xcc;return function(_0x138e75){if(_0x138e75){return _0x283107[_0x89cb('0x1a')](_0xe985d3);}return _0x283107['status'](_0xe985d3)[_0x89cb('0x1b')]();};}function respondWithResult(_0x175b48,_0x1e00c4){_0x1e00c4=_0x1e00c4||0xc8;return function(_0x152e90){if(_0x152e90){return _0x175b48['status'](_0x1e00c4)[_0x89cb('0x1c')](_0x152e90);}};}function respondWithFilteredResult(_0x131c0f,_0x2c2ace){return function(_0x1d172b){if(_0x1d172b){var _0x9f61=typeof _0x2c2ace['offset']==='undefined'&&typeof _0x2c2ace[_0x89cb('0x1d')]===_0x89cb('0x1e');var _0x5f58c9=_0x1d172b[_0x89cb('0x1f')];var _0x2d16a5=_0x9f61?0x0:_0x2c2ace[_0x89cb('0x20')];var _0xdb86bf=_0x9f61?_0x1d172b['count']:_0x2c2ace[_0x89cb('0x20')]+_0x2c2ace[_0x89cb('0x1d')];var _0x567eb6;if(_0xdb86bf>=_0x5f58c9){_0xdb86bf=_0x5f58c9;_0x567eb6=0xc8;}else{_0x567eb6=0xce;}_0x131c0f['status'](_0x567eb6);return _0x131c0f[_0x89cb('0x21')](_0x89cb('0x22'),_0x2d16a5+'-'+_0xdb86bf+'/'+_0x5f58c9)['json'](_0x1d172b);}return null;};}function patchUpdates(_0x10cfbd){return function(_0x37cd0e){try{jsonpatch[_0x89cb('0x23')](_0x37cd0e,_0x10cfbd,!![]);}catch(_0x42925){return BPromise['reject'](_0x42925);}return _0x37cd0e[_0x89cb('0x24')]();};}function saveUpdates(_0x2a06b6,_0x203d3b){return function(_0x362540){if(_0x362540){return _0x362540[_0x89cb('0x25')](_0x2a06b6)[_0x89cb('0x26')](function(_0x366d72){return _0x366d72;});}return null;};}function removeEntity(_0x4a4e32,_0x934a56){return function(_0x2af4cb){if(_0x2af4cb){return _0x2af4cb[_0x89cb('0x27')]()['then'](function(){_0x4a4e32['status'](0xcc)[_0x89cb('0x1b')]();});}};}function handleEntityNotFound(_0xdc5941,_0x36439c){return function(_0x425965){if(!_0x425965){_0xdc5941['sendStatus'](0x194);}return _0x425965;};}function handleError(_0x1dc328,_0x5ade49){_0x5ade49=_0x5ade49||0x1f4;return function(_0x142719){logger[_0x89cb('0x28')](_0x142719[_0x89cb('0x29')]);if(_0x142719['name']){delete _0x142719[_0x89cb('0x2a')];}_0x1dc328[_0x89cb('0x2b')](_0x5ade49)[_0x89cb('0x2c')](_0x142719);};}exports['index']=function(_0x4da8f5,_0x46507c){var _0x326d2f={},_0x4dcecc={},_0x25da73={'count':0x0,'rows':[]};var _0x3ddcd9=_[_0x89cb('0x2d')](db[_0x89cb('0x2e')][_0x89cb('0x2f')],function(_0x25b0c8){return{'name':_0x25b0c8['fieldName'],'type':_0x25b0c8[_0x89cb('0x30')][_0x89cb('0x31')]};});_0x4dcecc[_0x89cb('0x32')]=_[_0x89cb('0x2d')](_0x3ddcd9,'name');_0x4dcecc[_0x89cb('0x33')]=_['keys'](_0x4da8f5['query']);_0x4dcecc['filters']=_[_0x89cb('0x34')](_0x4dcecc[_0x89cb('0x32')],_0x4dcecc[_0x89cb('0x33')]);_0x326d2f[_0x89cb('0x35')]=_[_0x89cb('0x34')](_0x4dcecc[_0x89cb('0x32')],qs[_0x89cb('0x36')](_0x4da8f5[_0x89cb('0x33')][_0x89cb('0x36')]));_0x326d2f[_0x89cb('0x35')]=_0x326d2f[_0x89cb('0x35')][_0x89cb('0x37')]?_0x326d2f[_0x89cb('0x35')]:_0x4dcecc['model'];if(!_0x4da8f5[_0x89cb('0x33')][_0x89cb('0x38')](_0x89cb('0x39'))){_0x326d2f['limit']=qs[_0x89cb('0x1d')](_0x4da8f5[_0x89cb('0x33')]['limit']);_0x326d2f['offset']=qs[_0x89cb('0x20')](_0x4da8f5[_0x89cb('0x33')][_0x89cb('0x20')]);}_0x326d2f['order']=qs[_0x89cb('0x3a')](_0x4da8f5[_0x89cb('0x33')][_0x89cb('0x3a')]);_0x326d2f['where']=qs[_0x89cb('0x3b')](_[_0x89cb('0x3c')](_0x4da8f5[_0x89cb('0x33')],_0x4dcecc[_0x89cb('0x3b')]),_0x3ddcd9);if(_0x4da8f5['query'][_0x89cb('0x3d')]){_0x326d2f[_0x89cb('0x3e')]=_[_0x89cb('0x3f')](_0x326d2f['where'],{'$or':_[_0x89cb('0x2d')](_0x3ddcd9,function(_0xc81c26){if(_0xc81c26['type']!==_0x89cb('0x40')){var _0x27a983={};_0x27a983[_0xc81c26[_0x89cb('0x2a')]]={'$like':'%'+_0x4da8f5['query'][_0x89cb('0x3d')]+'%'};return _0x27a983;}})});}_0x326d2f=_[_0x89cb('0x3f')]({},_0x326d2f,_0x4da8f5[_0x89cb('0x41')]);var _0x2b3d57={'where':_0x326d2f[_0x89cb('0x3e')]};return db[_0x89cb('0x2e')][_0x89cb('0x1f')](_0x2b3d57)['then'](function(_0x490eea){_0x25da73['count']=_0x490eea;if(_0x4da8f5[_0x89cb('0x33')]['includeAll']){_0x326d2f['include']=[{'all':!![]}];}return db[_0x89cb('0x2e')][_0x89cb('0x42')](_0x326d2f);})[_0x89cb('0x26')](function(_0x4c3f19){_0x25da73[_0x89cb('0x43')]=_0x4c3f19;return _0x25da73;})[_0x89cb('0x26')](respondWithFilteredResult(_0x46507c,_0x326d2f))[_0x89cb('0x44')](handleError(_0x46507c,null));};exports[_0x89cb('0x45')]=function(_0x532058,_0x2eba4a){var _0x367db8={'raw':!![],'where':{'id':_0x532058[_0x89cb('0x46')]['id']}},_0xf3e199={};_0xf3e199['model']=_[_0x89cb('0x47')](db[_0x89cb('0x2e')][_0x89cb('0x2f')]);_0xf3e199['query']=_[_0x89cb('0x47')](_0x532058['query']);_0xf3e199[_0x89cb('0x3b')]=_[_0x89cb('0x34')](_0xf3e199[_0x89cb('0x32')],_0xf3e199['query']);_0x367db8[_0x89cb('0x35')]=_['intersection'](_0xf3e199['model'],qs[_0x89cb('0x36')](_0x532058['query']['fields']));_0x367db8['attributes']=_0x367db8[_0x89cb('0x35')]['length']?_0x367db8[_0x89cb('0x35')]:_0xf3e199['model'];if(_0x532058[_0x89cb('0x33')][_0x89cb('0x48')]){_0x367db8[_0x89cb('0x49')]=[{'all':!![]}];}_0x367db8=_[_0x89cb('0x3f')]({},_0x367db8,_0x532058['options']);return db[_0x89cb('0x2e')][_0x89cb('0x4a')](_0x367db8)[_0x89cb('0x26')](handleEntityNotFound(_0x2eba4a,null))[_0x89cb('0x26')](respondWithResult(_0x2eba4a,null))[_0x89cb('0x44')](handleError(_0x2eba4a,null));};exports[_0x89cb('0x4b')]=function(_0x91002,_0x172277){return db[_0x89cb('0x2e')]['create'](_0x91002['body'],{})[_0x89cb('0x26')](respondWithResult(_0x172277,0xc9))[_0x89cb('0x44')](handleError(_0x172277,null));};exports[_0x89cb('0x25')]=function(_0x281d80,_0x3593b4){if(_0x281d80[_0x89cb('0x4c')]['id']){delete _0x281d80[_0x89cb('0x4c')]['id'];}return db[_0x89cb('0x2e')]['find']({'where':{'id':_0x281d80['params']['id']}})[_0x89cb('0x26')](handleEntityNotFound(_0x3593b4,null))['then'](saveUpdates(_0x281d80[_0x89cb('0x4c')],null))[_0x89cb('0x26')](respondWithResult(_0x3593b4,null))[_0x89cb('0x44')](handleError(_0x3593b4,null));};exports['destroy']=function(_0x16c1d0,_0x1b454b){return db['FreshsalesField'][_0x89cb('0x4a')]({'where':{'id':_0x16c1d0['params']['id']}})[_0x89cb('0x26')](handleEntityNotFound(_0x1b454b,null))[_0x89cb('0x26')](removeEntity(_0x1b454b,null))[_0x89cb('0x44')](handleError(_0x1b454b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7a81858..674c5d5 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 _0x5853=['request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x6ca428,_0x2f1930){var _0x42d121=function(_0x34af63){while(--_0x34af63){_0x6ca428['push'](_0x6ca428['shift']());}};_0x42d121(++_0x2f1930);}(_0x5853,0x113));var _0x3585=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x5853[_0x1f7201];return _0x289fd2;};'use strict';var _=require(_0x3585('0x0'));var util=require(_0x3585('0x1'));var logger=require(_0x3585('0x2'))(_0x3585('0x3'));var moment=require(_0x3585('0x4'));var BPromise=require('bluebird');var rp=require(_0x3585('0x5'));var fs=require('fs');var path=require(_0x3585('0x6'));var rimraf=require(_0x3585('0x7'));var config=require(_0x3585('0x8'));var attributes=require(_0x3585('0x9'));module[_0x3585('0xa')]=function(_0x561ebe,_0x2e895d){return _0x561ebe['define']('FreshsalesField',attributes,{'tableName':_0x3585('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3585('0xc'),_0x3585('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4efb=['api','bluebird','path','rimraf','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4efb,0xfa));var _0xb4ef=function(_0x59ef5d,_0x4ae379){_0x59ef5d=_0x59ef5d-0x0;var _0x2eb3b2=_0x4efb[_0x59ef5d];return _0x2eb3b2;};'use strict';var _=require('lodash');var util=require(_0xb4ef('0x0'));var logger=require(_0xb4ef('0x1'))(_0xb4ef('0x2'));var moment=require('moment');var BPromise=require(_0xb4ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4ef('0x4'));var rimraf=require(_0xb4ef('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4ef('0x6'));module['exports']=function(_0x1f69fc,_0xd99454){return _0x1f69fc[_0xb4ef('0x7')](_0xb4ef('0x8'),attributes,{'tableName':_0xb4ef('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb4ef('0xa'),_0xb4ef('0xb')],'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 ee29276..a8bb448 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xe2ae2b,_0x48d240){var _0xa5cac5=function(_0x384b82){while(--_0x384b82){_0xe2ae2b['push'](_0xe2ae2b['shift']());}};_0xa5cac5(++_0x48d240);}(_0x5fab,0x177));var _0xb5fa=function(_0x4fe93e,_0x44f9e2){_0x4fe93e=_0x4fe93e-0x0;var _0x5f1d5a=_0x5fab[_0x4fe93e];return _0x5f1d5a;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x687b,0x14a));var _0xb687=function(_0x574dea,_0x4cf209){_0x574dea=_0x574dea-0x0;var _0x3ed444=_0x687b[_0x574dea];return _0x3ed444;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d79dc1c..4e52f05 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4d24ea,_0x3f5526){var _0x268e16=function(_0x54bb82){while(--_0x54bb82){_0x4d24ea['push'](_0x4d24ea['shift']());}};_0x268e16(++_0x3f5526);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5699c9,_0x4be1a3){var _0x3d8c6d=function(_0x3a0493){while(--_0x3a0493){_0x5699c9['push'](_0x5699c9['shift']());}};_0x3d8c6d(++_0x4be1a3);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index d00b707..315cc54 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 _0x20d8=['STRING','username','ENUM','integrationTab','sequelize','exports'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x20d8,0xee));var _0x820d=function(_0x319784,_0x47e6d4){_0x319784=_0x319784-0x0;var _0x1917da=_0x20d8[_0x319784];return _0x1917da;};'use strict';var Sequelize=require(_0x820d('0x0'));module[_0x820d('0x1')]={'name':{'type':Sequelize[_0x820d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x820d('0x3')},'remoteUri':{'type':Sequelize[_0x820d('0x2')]},'password':{'type':Sequelize[_0x820d('0x2')]},'clientId':{'type':Sequelize[_0x820d('0x2')]},'clientSecret':{'type':Sequelize[_0x820d('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x820d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x820d('0x4')](_0x820d('0x5'),'newTab'),'defaultValue':_0x820d('0x5')}}; \ No newline at end of file +var _0x6b1b=['newTab','exports','STRING','username','ENUM','integrationTab'];(function(_0x5ef1d3,_0x1feca1){var _0x3c990e=function(_0x589ba6){while(--_0x589ba6){_0x5ef1d3['push'](_0x5ef1d3['shift']());}};_0x3c990e(++_0x1feca1);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6b1b[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0xb6b1('0x0')]={'name':{'type':Sequelize[_0xb6b1('0x1')]},'description':{'type':Sequelize[_0xb6b1('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xb6b1('0x2')},'remoteUri':{'type':Sequelize[_0xb6b1('0x1')]},'password':{'type':Sequelize[_0xb6b1('0x1')]},'clientId':{'type':Sequelize[_0xb6b1('0x1')]},'clientSecret':{'type':Sequelize[_0xb6b1('0x1')]},'securityToken':{'type':Sequelize[_0xb6b1('0x1')]},'serverUrl':{'type':Sequelize[_0xb6b1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb6b1('0x3')](_0xb6b1('0x4'),_0xb6b1('0x5')),'defaultValue':_0xb6b1('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 8ca9efb..a966e73 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 _0x75c9=['catch','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','body','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','IsReminderSet','IsRecurrence','string','int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','undefined','count','offset','reject','save','update','then','sendStatus','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create'];(function(_0x4dc9be,_0x17e700){var _0x4d2bb5=function(_0x1d8819){while(--_0x1d8819){_0x4dc9be['push'](_0x4dc9be['shift']());}};_0x4d2bb5(++_0x17e700);}(_0x75c9,0xb2));var _0x975c=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0x75c9[_0x6173fc];return _0x965fbe;};'use strict';var emlformat=require(_0x975c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x975c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x975c('0x2'));var moment=require(_0x975c('0x3'));var BPromise=require(_0x975c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x975c('0x5'));var sox=require(_0x975c('0x6'));var csv=require('to-csv');var ejs=require(_0x975c('0x7'));var fs=require('fs');var fs_extra=require(_0x975c('0x8'));var _=require(_0x975c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x975c('0xa'));var deskjs=require(_0x975c('0xb'));var toCsv=require(_0x975c('0xc'));var querystring=require(_0x975c('0xd'));var Papa=require('papaparse');var Redis=require(_0x975c('0xe'));var authService=require(_0x975c('0xf'));var qs=require(_0x975c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x975c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x975c('0x12'));var licenseUtil=require(_0x975c('0x13'));var db=require(_0x975c('0x14'))['db'];var integrations=require(_0x975c('0x15'));function respondWithStatusCode(_0x4b9bb1,_0x4f3568){_0x4f3568=_0x4f3568||0xcc;return function(_0x1c643a){if(_0x1c643a){return _0x4b9bb1['sendStatus'](_0x4f3568);}return _0x4b9bb1[_0x975c('0x16')](_0x4f3568)[_0x975c('0x17')]();};}function respondWithResult(_0x11339f,_0x1b1e51){_0x1b1e51=_0x1b1e51||0xc8;return function(_0x33e330){if(_0x33e330){return _0x11339f['status'](_0x1b1e51)[_0x975c('0x18')](_0x33e330);}};}function respondWithFilteredResult(_0x53122c,_0x40d8c1){return function(_0x18e198){if(_0x18e198){var _0x5ecf0b=typeof _0x40d8c1['offset']==='undefined'&&typeof _0x40d8c1[_0x975c('0x19')]===_0x975c('0x1a');var _0x30592b=_0x18e198[_0x975c('0x1b')];var _0x37e500=_0x5ecf0b?0x0:_0x40d8c1[_0x975c('0x1c')];var _0x3198a7=_0x5ecf0b?_0x18e198[_0x975c('0x1b')]:_0x40d8c1['offset']+_0x40d8c1[_0x975c('0x19')];var _0x2e9dc5;if(_0x3198a7>=_0x30592b){_0x3198a7=_0x30592b;_0x2e9dc5=0xc8;}else{_0x2e9dc5=0xce;}_0x53122c[_0x975c('0x16')](_0x2e9dc5);return _0x53122c['set']('Content-Range',_0x37e500+'-'+_0x3198a7+'/'+_0x30592b)['json'](_0x18e198);}return null;};}function patchUpdates(_0x2ea41e){return function(_0x114b35){try{jsonpatch['apply'](_0x114b35,_0x2ea41e,!![]);}catch(_0xff170a){return BPromise[_0x975c('0x1d')](_0xff170a);}return _0x114b35[_0x975c('0x1e')]();};}function saveUpdates(_0x1b61c0,_0x3c9013){return function(_0x515a49){if(_0x515a49){return _0x515a49[_0x975c('0x1f')](_0x1b61c0)['then'](function(_0x35a295){return _0x35a295;});}return null;};}function removeEntity(_0x3a9c4b,_0x46cf5c){return function(_0x2664ae){if(_0x2664ae){return _0x2664ae['destroy']()[_0x975c('0x20')](function(){_0x3a9c4b['status'](0xcc)[_0x975c('0x17')]();});}};}function handleEntityNotFound(_0x491179,_0x3b32f9){return function(_0x3d9fa9){if(!_0x3d9fa9){_0x491179[_0x975c('0x21')](0x194);}return _0x3d9fa9;};}function handleError(_0x302852,_0x15b8cd){_0x15b8cd=_0x15b8cd||0x1f4;return function(_0x17b100){logger[_0x975c('0x22')](_0x17b100[_0x975c('0x23')]);if(_0x17b100['name']){delete _0x17b100[_0x975c('0x24')];}_0x302852['status'](_0x15b8cd)['send'](_0x17b100);};}exports[_0x975c('0x25')]=function(_0x2a2f6e,_0x3ae42b){var _0x1dabda={},_0x33ea5d={},_0x21ba2f={'count':0x0,'rows':[]};var _0x33bbc7=_[_0x975c('0x26')](db[_0x975c('0x27')][_0x975c('0x28')],function(_0x3b072e){return{'name':_0x3b072e[_0x975c('0x29')],'type':_0x3b072e[_0x975c('0x2a')][_0x975c('0x2b')]};});_0x33ea5d[_0x975c('0x2c')]=_[_0x975c('0x26')](_0x33bbc7,_0x975c('0x24'));_0x33ea5d['query']=_[_0x975c('0x2d')](_0x2a2f6e[_0x975c('0x2e')]);_0x33ea5d[_0x975c('0x2f')]=_['intersection'](_0x33ea5d[_0x975c('0x2c')],_0x33ea5d[_0x975c('0x2e')]);_0x1dabda[_0x975c('0x30')]=_[_0x975c('0x31')](_0x33ea5d['model'],qs[_0x975c('0x32')](_0x2a2f6e[_0x975c('0x2e')]['fields']));_0x1dabda[_0x975c('0x30')]=_0x1dabda[_0x975c('0x30')][_0x975c('0x33')]?_0x1dabda[_0x975c('0x30')]:_0x33ea5d[_0x975c('0x2c')];if(!_0x2a2f6e[_0x975c('0x2e')][_0x975c('0x34')](_0x975c('0x35'))){_0x1dabda[_0x975c('0x19')]=qs['limit'](_0x2a2f6e['query'][_0x975c('0x19')]);_0x1dabda[_0x975c('0x1c')]=qs[_0x975c('0x1c')](_0x2a2f6e[_0x975c('0x2e')][_0x975c('0x1c')]);}_0x1dabda[_0x975c('0x36')]=qs[_0x975c('0x37')](_0x2a2f6e[_0x975c('0x2e')]['sort']);_0x1dabda[_0x975c('0x38')]=qs['filters'](_[_0x975c('0x39')](_0x2a2f6e[_0x975c('0x2e')],_0x33ea5d['filters']),_0x33bbc7);if(_0x2a2f6e[_0x975c('0x2e')][_0x975c('0x3a')]){_0x1dabda['where']=_['merge'](_0x1dabda[_0x975c('0x38')],{'$or':_[_0x975c('0x26')](_0x33bbc7,function(_0x5b2cc4){if(_0x5b2cc4[_0x975c('0x2a')]!==_0x975c('0x3b')){var _0x2d4fa0={};_0x2d4fa0[_0x5b2cc4['name']]={'$like':'%'+_0x2a2f6e[_0x975c('0x2e')][_0x975c('0x3a')]+'%'};return _0x2d4fa0;}})});}_0x1dabda=_[_0x975c('0x3c')]({},_0x1dabda,_0x2a2f6e[_0x975c('0x3d')]);var _0x177dc3={'where':_0x1dabda['where']};return db[_0x975c('0x27')][_0x975c('0x1b')](_0x177dc3)['then'](function(_0x5320db){_0x21ba2f[_0x975c('0x1b')]=_0x5320db;if(_0x2a2f6e[_0x975c('0x2e')][_0x975c('0x3e')]){_0x1dabda[_0x975c('0x3f')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x975c('0x40')](_0x1dabda);})[_0x975c('0x20')](function(_0x1136d3){_0x21ba2f[_0x975c('0x41')]=_0x1136d3;return _0x21ba2f;})[_0x975c('0x20')](respondWithFilteredResult(_0x3ae42b,_0x1dabda))['catch'](handleError(_0x3ae42b,null));};exports[_0x975c('0x42')]=function(_0x2fb449,_0x399536){var _0x161754={'raw':![],'where':{'id':_0x2fb449[_0x975c('0x43')]['id']}},_0xe8307f={};_0xe8307f['model']=_[_0x975c('0x2d')](db['SalesforceAccount'][_0x975c('0x28')]);_0xe8307f[_0x975c('0x2e')]=_['keys'](_0x2fb449['query']);_0xe8307f[_0x975c('0x2f')]=_[_0x975c('0x31')](_0xe8307f[_0x975c('0x2c')],_0xe8307f['query']);_0x161754[_0x975c('0x30')]=_[_0x975c('0x31')](_0xe8307f[_0x975c('0x2c')],qs[_0x975c('0x32')](_0x2fb449[_0x975c('0x2e')][_0x975c('0x32')]));_0x161754[_0x975c('0x30')]=_0x161754[_0x975c('0x30')][_0x975c('0x33')]?_0x161754[_0x975c('0x30')]:_0xe8307f[_0x975c('0x2c')];if(_0x2fb449[_0x975c('0x2e')][_0x975c('0x3e')]){_0x161754[_0x975c('0x3f')]=[{'all':!![]}];}_0x161754=_[_0x975c('0x3c')]({},_0x161754,_0x2fb449[_0x975c('0x3d')]);return db[_0x975c('0x27')][_0x975c('0x44')](_0x161754)[_0x975c('0x20')](handleEntityNotFound(_0x399536,null))[_0x975c('0x20')](respondWithResult(_0x399536,null))['catch'](handleError(_0x399536,null));};exports[_0x975c('0x45')]=function(_0x4ed9be,_0x491489){return db[_0x975c('0x27')][_0x975c('0x45')](_0x4ed9be['body'],{})['then'](respondWithResult(_0x491489,0xc9))[_0x975c('0x46')](handleError(_0x491489,null));};exports[_0x975c('0x1f')]=function(_0x482db1,_0x2f12c0){if(_0x482db1['body']['id']){delete _0x482db1['body']['id'];}return db[_0x975c('0x27')][_0x975c('0x44')]({'where':{'id':_0x482db1[_0x975c('0x43')]['id']}})[_0x975c('0x20')](handleEntityNotFound(_0x2f12c0,null))['then'](saveUpdates(_0x482db1['body'],null))[_0x975c('0x20')](respondWithResult(_0x2f12c0,null))[_0x975c('0x46')](handleError(_0x2f12c0,null));};exports[_0x975c('0x47')]=function(_0x4ebbe4,_0x130cc9){return db[_0x975c('0x27')][_0x975c('0x44')]({'where':{'id':_0x4ebbe4[_0x975c('0x43')]['id']}})[_0x975c('0x20')](handleEntityNotFound(_0x130cc9,null))[_0x975c('0x20')](removeEntity(_0x130cc9,null))[_0x975c('0x46')](handleError(_0x130cc9,null));};exports[_0x975c('0x48')]=function(_0x1ce472,_0x4d0017,_0x56c7e4){var _0x3136c6={};var _0x54666d={};var _0x54c70c;var _0x16bf75;return db[_0x975c('0x27')][_0x975c('0x49')]({'where':{'id':_0x1ce472[_0x975c('0x43')]['id']}})[_0x975c('0x20')](handleEntityNotFound(_0x4d0017,null))['then'](function(_0x8ac161){if(_0x8ac161){_0x54c70c=_0x8ac161;_0x54666d[_0x975c('0x2c')]=_['keys'](db[_0x975c('0x4a')]['rawAttributes']);_0x54666d[_0x975c('0x2e')]=_[_0x975c('0x2d')](_0x1ce472[_0x975c('0x2e')]);_0x54666d['filters']=_[_0x975c('0x31')](_0x54666d[_0x975c('0x2c')],_0x54666d[_0x975c('0x2e')]);_0x3136c6[_0x975c('0x30')]=_[_0x975c('0x31')](_0x54666d[_0x975c('0x2c')],qs['fields'](_0x1ce472[_0x975c('0x2e')][_0x975c('0x32')]));_0x3136c6['attributes']=_0x3136c6[_0x975c('0x30')]['length']?_0x3136c6['attributes']:_0x54666d[_0x975c('0x2c')];_0x3136c6[_0x975c('0x36')]=qs[_0x975c('0x37')](_0x1ce472[_0x975c('0x2e')][_0x975c('0x37')]);_0x3136c6[_0x975c('0x38')]=qs[_0x975c('0x2f')](_[_0x975c('0x39')](_0x1ce472[_0x975c('0x2e')],_0x54666d[_0x975c('0x2f')]));if(_0x1ce472[_0x975c('0x2e')]['filter']){_0x3136c6['where']=_[_0x975c('0x3c')](_0x3136c6['where'],{'$or':_[_0x975c('0x26')](_0x3136c6[_0x975c('0x30')],function(_0x1c3c64){var _0x33ac5e={};_0x33ac5e[_0x1c3c64]={'$like':'%'+_0x1ce472[_0x975c('0x2e')][_0x975c('0x3a')]+'%'};return _0x33ac5e;})});}_0x3136c6=_[_0x975c('0x3c')]({},_0x3136c6,_0x1ce472[_0x975c('0x3d')]);return _0x54c70c[_0x975c('0x48')](_0x3136c6);}})['then'](function(_0x586ef5){if(_0x586ef5){_0x16bf75=_0x586ef5[_0x975c('0x33')];if(!_0x1ce472[_0x975c('0x2e')][_0x975c('0x34')](_0x975c('0x35'))){_0x3136c6[_0x975c('0x19')]=qs['limit'](_0x1ce472['query'][_0x975c('0x19')]);_0x3136c6[_0x975c('0x1c')]=qs[_0x975c('0x1c')](_0x1ce472['query'][_0x975c('0x1c')]);}return _0x54c70c['getConfigurations'](_0x3136c6);}})[_0x975c('0x20')](function(_0x4dd029){if(_0x4dd029){return _0x4dd029?{'count':_0x16bf75,'rows':_0x4dd029}:null;}})['then'](respondWithResult(_0x4d0017,null))[_0x975c('0x46')](handleError(_0x4d0017,null));};exports[_0x975c('0x4b')]=function(_0x4b78f6,_0x58a6e1,_0xa77c22){if(_0x4b78f6[_0x975c('0x4c')]['id']){delete _0x4b78f6['body']['id'];}return db[_0x975c('0x27')][_0x975c('0x49')]({'where':{'id':_0x4b78f6[_0x975c('0x43')]['id']}})[_0x975c('0x20')](handleEntityNotFound(_0x58a6e1,null))['then'](function(_0x7db485){if(_0x7db485){_0x4b78f6[_0x975c('0x4c')][_0x975c('0x4d')]=_0x7db485['id'];_0x4b78f6['body'][_0x975c('0x4e')]=integrations[_0x975c('0x4f')](_0x4b78f6[_0x975c('0x4c')][_0x975c('0x50')],_0x4b78f6['body'][_0x975c('0x2a')]);_0x4b78f6[_0x975c('0x4c')][_0x975c('0x51')]=integrations['getDescriptions'](_0x4b78f6['body'][_0x975c('0x50')],_0x4b78f6['body']['type']);return db[_0x975c('0x4a')][_0x975c('0x45')](_0x4b78f6[_0x975c('0x4c')],{'include':[{'model':db[_0x975c('0x52')],'as':'Subjects'},{'model':db[_0x975c('0x52')],'as':_0x975c('0x51')}]});}return null;})[_0x975c('0x20')](respondWithResult(_0x58a6e1,null))[_0x975c('0x46')](handleError(_0x58a6e1,null));};exports[_0x975c('0x53')]=function(_0x116279,_0x503442,_0x1151b0){var _0x199380;var _0x43b01e='';var _0x442c60=_0x975c('0x54');return db[_0x975c('0x27')][_0x975c('0x49')]({'where':{'id':_0x116279[_0x975c('0x43')]['id']},'attributes':['id',_0x975c('0x55'),_0x975c('0x56'),_0x975c('0x57'),_0x975c('0x58'),_0x975c('0x59'),_0x975c('0x5a')]})[_0x975c('0x20')](handleEntityNotFound(_0x503442,null))[_0x975c('0x20')](function(_0x1067cb){if(_0x1067cb){_0x43b01e=_0x1067cb[_0x975c('0x55')];var _0x5f2bf5=_0x43b01e['slice'](-0x1);if(_0x5f2bf5==='/'){_0x43b01e=_0x43b01e[_0x975c('0x5b')](0x0,_0x43b01e[_0x975c('0x5c')](_0x5f2bf5));}_0x199380=new jsforce[(_0x975c('0x5d'))]({'oauth2':{'loginUrl':_0x43b01e,'clientId':_0x1067cb['clientId'],'clientSecret':_0x1067cb[_0x975c('0x57')]}});return _0x199380[_0x975c('0x5e')](_0x1067cb[_0x975c('0x58')],_0x1067cb[_0x975c('0x59')][_0x975c('0x5f')](_0x1067cb[_0x975c('0x5a')]));}})[_0x975c('0x20')](function(_0x460e74){if(_0x460e74){if(!_[_0x975c('0x60')](_0x116279[_0x975c('0x2e')][_0x975c('0x61')])){_0x442c60=_0x116279['query']['ticketType'];}return _0x199380[_0x975c('0x62')](_0x442c60)[_0x975c('0x63')]();}})[_0x975c('0x20')](function(_0x3417ac){var _0x492baa=['OwnerId','ActivityDate',_0x975c('0x64'),_0x975c('0x65'),'Subject','Description'];var _0x3414d7=[_0x975c('0x66'),_0x975c('0x67'),'picklist',_0x975c('0x68'),_0x975c('0x69'),_0x975c('0x6a'),_0x975c('0x6b')];if(_0x3417ac){_[_0x975c('0x6c')](_0x3417ac[_0x975c('0x32')],function(_0x5ef6b1){return _0x492baa[_0x975c('0x6d')](_0x5ef6b1[_0x975c('0x24')])||!_0x3414d7['includes'](_0x5ef6b1[_0x975c('0x2a')]);});return{'count':_0x3417ac[_0x975c('0x32')][_0x975c('0x33')],'rows':_['map'](_0x3417ac['fields'],function(_0x35c1fc){return{'id':_0x35c1fc[_0x975c('0x24')],'name':_0x35c1fc[_0x975c('0x6e')],'custom':_0x35c1fc[_0x975c('0x6f')],'options':_0x35c1fc[_0x975c('0x70')][_0x975c('0x33')]>0x0?_['map'](_0x35c1fc[_0x975c('0x70')],function(_0x3245b8){return{'name':_0x3245b8['label'],'value':_0x3245b8[_0x975c('0x71')]};}):_0x35c1fc[_0x975c('0x2a')]=='boolean'?[{'name':_0x975c('0x72'),'value':_0x975c('0x73')},{'name':_0x975c('0x74'),'value':_0x975c('0x75')}]:[]};})};}})['then'](respondWithResult(_0x503442,null))[_0x975c('0x46')](function(_0x22b840){var _0x257f6b=_0x116279[_0x975c('0x2e')]['test']?0x1f4:_0x22b840['statusCode']||0x1f4;logger[_0x975c('0x22')](_0x975c('0x76'),_0x975c('0x53'),_0x257f6b,JSON[_0x975c('0x77')](_0x22b840));delete _0x22b840[_0x975c('0x24')];if(_0x257f6b===0x191){_0x257f6b=0x190;}_0x503442[_0x975c('0x16')](_0x257f6b)[_0x975c('0x78')](_0x116279[_0x975c('0x2e')][_0x975c('0x79')]?{'message':_0x975c('0x7a'),'statusCode':_0x22b840[_0x975c('0x7b')]}:_0x22b840);});}; \ No newline at end of file +var _0x55bd=['includeAll','include','rows','catch','show','params','find','create','update','body','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','phone','includes','label','picklistValues','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','Content-Range','save','then','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options'];(function(_0xf6c699,_0x41ead6){var _0x46fbef=function(_0x3fdf50){while(--_0x3fdf50){_0xf6c699['push'](_0xf6c699['shift']());}};_0x46fbef(++_0x41ead6);}(_0x55bd,0xb8));var _0xd55b=function(_0xf4ad5a,_0x2ce803){_0xf4ad5a=_0xf4ad5a-0x0;var _0x404891=_0x55bd[_0xf4ad5a];return _0x404891;};'use strict';var emlformat=require(_0xd55b('0x0'));var rimraf=require(_0xd55b('0x1'));var zipdir=require(_0xd55b('0x2'));var jsonpatch=require(_0xd55b('0x3'));var rp=require(_0xd55b('0x4'));var moment=require(_0xd55b('0x5'));var BPromise=require(_0xd55b('0x6'));var Mustache=require(_0xd55b('0x7'));var util=require('util');var path=require(_0xd55b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd55b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd55b('0xa'));var squel=require(_0xd55b('0xb'));var crypto=require(_0xd55b('0xc'));var jsforce=require(_0xd55b('0xd'));var deskjs=require(_0xd55b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd55b('0xf'));var Papa=require(_0xd55b('0x10'));var Redis=require(_0xd55b('0x11'));var authService=require(_0xd55b('0x12'));var qs=require(_0xd55b('0x13'));var as=require(_0xd55b('0x14'));var hardwareService=require(_0xd55b('0x15'));var logger=require(_0xd55b('0x16'))(_0xd55b('0x17'));var utils=require(_0xd55b('0x18'));var config=require(_0xd55b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd55b('0x1a'));function respondWithStatusCode(_0x8d39e3,_0xb526a4){_0xb526a4=_0xb526a4||0xcc;return function(_0x3b1efa){if(_0x3b1efa){return _0x8d39e3[_0xd55b('0x1b')](_0xb526a4);}return _0x8d39e3[_0xd55b('0x1c')](_0xb526a4)['end']();};}function respondWithResult(_0x4f721a,_0x2cfd3e){_0x2cfd3e=_0x2cfd3e||0xc8;return function(_0x20ba88){if(_0x20ba88){return _0x4f721a['status'](_0x2cfd3e)[_0xd55b('0x1d')](_0x20ba88);}};}function respondWithFilteredResult(_0x4e481d,_0x19f555){return function(_0x4b8f59){if(_0x4b8f59){var _0x54bdc6=typeof _0x19f555['offset']===_0xd55b('0x1e')&&typeof _0x19f555[_0xd55b('0x1f')]===_0xd55b('0x1e');var _0x165a93=_0x4b8f59[_0xd55b('0x20')];var _0x1af76f=_0x54bdc6?0x0:_0x19f555[_0xd55b('0x21')];var _0x9abc7b=_0x54bdc6?_0x4b8f59[_0xd55b('0x20')]:_0x19f555['offset']+_0x19f555[_0xd55b('0x1f')];var _0x2fe981;if(_0x9abc7b>=_0x165a93){_0x9abc7b=_0x165a93;_0x2fe981=0xc8;}else{_0x2fe981=0xce;}_0x4e481d['status'](_0x2fe981);return _0x4e481d['set'](_0xd55b('0x22'),_0x1af76f+'-'+_0x9abc7b+'/'+_0x165a93)['json'](_0x4b8f59);}return null;};}function patchUpdates(_0x166b05){return function(_0x39739b){try{jsonpatch['apply'](_0x39739b,_0x166b05,!![]);}catch(_0x4431af){return BPromise['reject'](_0x4431af);}return _0x39739b[_0xd55b('0x23')]();};}function saveUpdates(_0x35b786,_0x5f45f8){return function(_0x2d5861){if(_0x2d5861){return _0x2d5861['update'](_0x35b786)[_0xd55b('0x24')](function(_0x4f2f98){return _0x4f2f98;});}return null;};}function removeEntity(_0x1ecd37,_0x500ae0){return function(_0x449a0f){if(_0x449a0f){return _0x449a0f[_0xd55b('0x25')]()[_0xd55b('0x24')](function(){_0x1ecd37[_0xd55b('0x1c')](0xcc)[_0xd55b('0x26')]();});}};}function handleEntityNotFound(_0x37f035,_0x5505db){return function(_0x1e5c1e){if(!_0x1e5c1e){_0x37f035[_0xd55b('0x1b')](0x194);}return _0x1e5c1e;};}function handleError(_0x5e2e9b,_0x3477e7){_0x3477e7=_0x3477e7||0x1f4;return function(_0x2e56ee){logger['error'](_0x2e56ee[_0xd55b('0x27')]);if(_0x2e56ee[_0xd55b('0x28')]){delete _0x2e56ee['name'];}_0x5e2e9b[_0xd55b('0x1c')](_0x3477e7)[_0xd55b('0x29')](_0x2e56ee);};}exports[_0xd55b('0x2a')]=function(_0x470d23,_0x3bc8dc){var _0x312731={},_0x1bf76c={},_0x2c195f={'count':0x0,'rows':[]};var _0x2caadd=_[_0xd55b('0x2b')](db[_0xd55b('0x2c')][_0xd55b('0x2d')],function(_0x2f464e){return{'name':_0x2f464e[_0xd55b('0x2e')],'type':_0x2f464e[_0xd55b('0x2f')][_0xd55b('0x30')]};});_0x1bf76c[_0xd55b('0x31')]=_[_0xd55b('0x2b')](_0x2caadd,_0xd55b('0x28'));_0x1bf76c[_0xd55b('0x32')]=_[_0xd55b('0x33')](_0x470d23[_0xd55b('0x32')]);_0x1bf76c[_0xd55b('0x34')]=_[_0xd55b('0x35')](_0x1bf76c[_0xd55b('0x31')],_0x1bf76c[_0xd55b('0x32')]);_0x312731[_0xd55b('0x36')]=_[_0xd55b('0x35')](_0x1bf76c[_0xd55b('0x31')],qs[_0xd55b('0x37')](_0x470d23[_0xd55b('0x32')]['fields']));_0x312731[_0xd55b('0x36')]=_0x312731[_0xd55b('0x36')][_0xd55b('0x38')]?_0x312731[_0xd55b('0x36')]:_0x1bf76c['model'];if(!_0x470d23[_0xd55b('0x32')]['hasOwnProperty'](_0xd55b('0x39'))){_0x312731[_0xd55b('0x1f')]=qs[_0xd55b('0x1f')](_0x470d23['query']['limit']);_0x312731[_0xd55b('0x21')]=qs[_0xd55b('0x21')](_0x470d23[_0xd55b('0x32')][_0xd55b('0x21')]);}_0x312731[_0xd55b('0x3a')]=qs[_0xd55b('0x3b')](_0x470d23[_0xd55b('0x32')][_0xd55b('0x3b')]);_0x312731[_0xd55b('0x3c')]=qs[_0xd55b('0x34')](_[_0xd55b('0x3d')](_0x470d23[_0xd55b('0x32')],_0x1bf76c[_0xd55b('0x34')]),_0x2caadd);if(_0x470d23['query']['filter']){_0x312731[_0xd55b('0x3c')]=_['merge'](_0x312731[_0xd55b('0x3c')],{'$or':_[_0xd55b('0x2b')](_0x2caadd,function(_0x281919){if(_0x281919['type']!==_0xd55b('0x3e')){var _0x3ed5b9={};_0x3ed5b9[_0x281919[_0xd55b('0x28')]]={'$like':'%'+_0x470d23[_0xd55b('0x32')][_0xd55b('0x3f')]+'%'};return _0x3ed5b9;}})});}_0x312731=_[_0xd55b('0x40')]({},_0x312731,_0x470d23[_0xd55b('0x41')]);var _0x307a8b={'where':_0x312731['where']};return db[_0xd55b('0x2c')][_0xd55b('0x20')](_0x307a8b)[_0xd55b('0x24')](function(_0x52d4dc){_0x2c195f[_0xd55b('0x20')]=_0x52d4dc;if(_0x470d23[_0xd55b('0x32')][_0xd55b('0x42')]){_0x312731[_0xd55b('0x43')]=[{'all':!![]}];}return db[_0xd55b('0x2c')]['findAll'](_0x312731);})['then'](function(_0x48a220){_0x2c195f[_0xd55b('0x44')]=_0x48a220;return _0x2c195f;})[_0xd55b('0x24')](respondWithFilteredResult(_0x3bc8dc,_0x312731))[_0xd55b('0x45')](handleError(_0x3bc8dc,null));};exports[_0xd55b('0x46')]=function(_0x24d98f,_0x3109d2){var _0x3847cd={'raw':![],'where':{'id':_0x24d98f[_0xd55b('0x47')]['id']}},_0x106883={};_0x106883[_0xd55b('0x31')]=_[_0xd55b('0x33')](db[_0xd55b('0x2c')]['rawAttributes']);_0x106883[_0xd55b('0x32')]=_[_0xd55b('0x33')](_0x24d98f['query']);_0x106883[_0xd55b('0x34')]=_[_0xd55b('0x35')](_0x106883[_0xd55b('0x31')],_0x106883[_0xd55b('0x32')]);_0x3847cd[_0xd55b('0x36')]=_[_0xd55b('0x35')](_0x106883['model'],qs[_0xd55b('0x37')](_0x24d98f['query'][_0xd55b('0x37')]));_0x3847cd[_0xd55b('0x36')]=_0x3847cd['attributes']['length']?_0x3847cd[_0xd55b('0x36')]:_0x106883[_0xd55b('0x31')];if(_0x24d98f[_0xd55b('0x32')]['includeAll']){_0x3847cd[_0xd55b('0x43')]=[{'all':!![]}];}_0x3847cd=_[_0xd55b('0x40')]({},_0x3847cd,_0x24d98f['options']);return db[_0xd55b('0x2c')][_0xd55b('0x48')](_0x3847cd)[_0xd55b('0x24')](handleEntityNotFound(_0x3109d2,null))[_0xd55b('0x24')](respondWithResult(_0x3109d2,null))[_0xd55b('0x45')](handleError(_0x3109d2,null));};exports[_0xd55b('0x49')]=function(_0x2dc0c6,_0x2d6433){return db['SalesforceAccount'][_0xd55b('0x49')](_0x2dc0c6['body'],{})[_0xd55b('0x24')](respondWithResult(_0x2d6433,0xc9))[_0xd55b('0x45')](handleError(_0x2d6433,null));};exports[_0xd55b('0x4a')]=function(_0x4157bb,_0x310387){if(_0x4157bb[_0xd55b('0x4b')]['id']){delete _0x4157bb[_0xd55b('0x4b')]['id'];}return db[_0xd55b('0x2c')][_0xd55b('0x48')]({'where':{'id':_0x4157bb[_0xd55b('0x47')]['id']}})['then'](handleEntityNotFound(_0x310387,null))[_0xd55b('0x24')](saveUpdates(_0x4157bb[_0xd55b('0x4b')],null))[_0xd55b('0x24')](respondWithResult(_0x310387,null))['catch'](handleError(_0x310387,null));};exports[_0xd55b('0x25')]=function(_0x1ce3c8,_0x41a834){return db['SalesforceAccount'][_0xd55b('0x48')]({'where':{'id':_0x1ce3c8[_0xd55b('0x47')]['id']}})['then'](handleEntityNotFound(_0x41a834,null))['then'](removeEntity(_0x41a834,null))[_0xd55b('0x45')](handleError(_0x41a834,null));};exports[_0xd55b('0x4c')]=function(_0x49847c,_0xee5754,_0x595375){var _0x4129ca={};var _0x44467f={};var _0x447663;var _0x3ef0bd;return db['SalesforceAccount'][_0xd55b('0x4d')]({'where':{'id':_0x49847c[_0xd55b('0x47')]['id']}})['then'](handleEntityNotFound(_0xee5754,null))[_0xd55b('0x24')](function(_0x367b8f){if(_0x367b8f){_0x447663=_0x367b8f;_0x44467f[_0xd55b('0x31')]=_[_0xd55b('0x33')](db[_0xd55b('0x4e')][_0xd55b('0x2d')]);_0x44467f[_0xd55b('0x32')]=_[_0xd55b('0x33')](_0x49847c[_0xd55b('0x32')]);_0x44467f['filters']=_['intersection'](_0x44467f[_0xd55b('0x31')],_0x44467f[_0xd55b('0x32')]);_0x4129ca['attributes']=_[_0xd55b('0x35')](_0x44467f[_0xd55b('0x31')],qs[_0xd55b('0x37')](_0x49847c['query'][_0xd55b('0x37')]));_0x4129ca[_0xd55b('0x36')]=_0x4129ca['attributes']['length']?_0x4129ca[_0xd55b('0x36')]:_0x44467f[_0xd55b('0x31')];_0x4129ca[_0xd55b('0x3a')]=qs['sort'](_0x49847c['query'][_0xd55b('0x3b')]);_0x4129ca['where']=qs['filters'](_[_0xd55b('0x3d')](_0x49847c['query'],_0x44467f[_0xd55b('0x34')]));if(_0x49847c[_0xd55b('0x32')][_0xd55b('0x3f')]){_0x4129ca['where']=_[_0xd55b('0x40')](_0x4129ca[_0xd55b('0x3c')],{'$or':_[_0xd55b('0x2b')](_0x4129ca[_0xd55b('0x36')],function(_0x11441b){var _0x3b3648={};_0x3b3648[_0x11441b]={'$like':'%'+_0x49847c[_0xd55b('0x32')][_0xd55b('0x3f')]+'%'};return _0x3b3648;})});}_0x4129ca=_[_0xd55b('0x40')]({},_0x4129ca,_0x49847c[_0xd55b('0x41')]);return _0x447663[_0xd55b('0x4c')](_0x4129ca);}})[_0xd55b('0x24')](function(_0x406733){if(_0x406733){_0x3ef0bd=_0x406733[_0xd55b('0x38')];if(!_0x49847c['query'][_0xd55b('0x4f')](_0xd55b('0x39'))){_0x4129ca[_0xd55b('0x1f')]=qs[_0xd55b('0x1f')](_0x49847c[_0xd55b('0x32')][_0xd55b('0x1f')]);_0x4129ca[_0xd55b('0x21')]=qs[_0xd55b('0x21')](_0x49847c[_0xd55b('0x32')][_0xd55b('0x21')]);}return _0x447663['getConfigurations'](_0x4129ca);}})[_0xd55b('0x24')](function(_0x11f82f){if(_0x11f82f){return _0x11f82f?{'count':_0x3ef0bd,'rows':_0x11f82f}:null;}})[_0xd55b('0x24')](respondWithResult(_0xee5754,null))['catch'](handleError(_0xee5754,null));};exports[_0xd55b('0x50')]=function(_0x553bfe,_0x459b75,_0x4c605b){if(_0x553bfe[_0xd55b('0x4b')]['id']){delete _0x553bfe[_0xd55b('0x4b')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x553bfe[_0xd55b('0x47')]['id']}})[_0xd55b('0x24')](handleEntityNotFound(_0x459b75,null))['then'](function(_0x17dd63){if(_0x17dd63){_0x553bfe[_0xd55b('0x4b')][_0xd55b('0x51')]=_0x17dd63['id'];_0x553bfe[_0xd55b('0x4b')][_0xd55b('0x52')]=integrations['getSubjects'](_0x553bfe[_0xd55b('0x4b')][_0xd55b('0x53')],_0x553bfe[_0xd55b('0x4b')]['type']);_0x553bfe['body']['Descriptions']=integrations[_0xd55b('0x54')](_0x553bfe['body']['channel'],_0x553bfe[_0xd55b('0x4b')][_0xd55b('0x2f')]);return db[_0xd55b('0x4e')][_0xd55b('0x49')](_0x553bfe[_0xd55b('0x4b')],{'include':[{'model':db[_0xd55b('0x55')],'as':_0xd55b('0x52')},{'model':db['SalesforceField'],'as':_0xd55b('0x56')}]});}return null;})[_0xd55b('0x24')](respondWithResult(_0x459b75,null))[_0xd55b('0x45')](handleError(_0x459b75,null));};exports[_0xd55b('0x57')]=function(_0x58f7c5,_0x173aff,_0x1e7e69){var _0x537f5d;var _0x2d4ab2='';var _0x555893=_0xd55b('0x58');return db[_0xd55b('0x2c')][_0xd55b('0x4d')]({'where':{'id':_0x58f7c5[_0xd55b('0x47')]['id']},'attributes':['id',_0xd55b('0x59'),_0xd55b('0x5a'),_0xd55b('0x5b'),_0xd55b('0x5c'),_0xd55b('0x5d'),_0xd55b('0x5e')]})[_0xd55b('0x24')](handleEntityNotFound(_0x173aff,null))['then'](function(_0x3d5386){if(_0x3d5386){_0x2d4ab2=_0x3d5386[_0xd55b('0x59')];var _0x4458b8=_0x2d4ab2[_0xd55b('0x5f')](-0x1);if(_0x4458b8==='/'){_0x2d4ab2=_0x2d4ab2['substring'](0x0,_0x2d4ab2[_0xd55b('0x60')](_0x4458b8));}_0x537f5d=new jsforce[(_0xd55b('0x61'))]({'oauth2':{'loginUrl':_0x2d4ab2,'clientId':_0x3d5386[_0xd55b('0x5a')],'clientSecret':_0x3d5386[_0xd55b('0x5b')]}});return _0x537f5d[_0xd55b('0x62')](_0x3d5386['username'],_0x3d5386['password'][_0xd55b('0x63')](_0x3d5386['securityToken']));}})[_0xd55b('0x24')](function(_0xc0bf39){if(_0xc0bf39){if(!_[_0xd55b('0x64')](_0x58f7c5['query'][_0xd55b('0x65')])){_0x555893=_0x58f7c5[_0xd55b('0x32')]['ticketType'];}return _0x537f5d[_0xd55b('0x66')](_0x555893)[_0xd55b('0x67')]();}})[_0xd55b('0x24')](function(_0x57bac3){var _0x43ae4c=['OwnerId',_0xd55b('0x68'),_0xd55b('0x69'),_0xd55b('0x6a'),_0xd55b('0x6b'),_0xd55b('0x6c')];var _0x1b9970=[_0xd55b('0x6d'),_0xd55b('0x6e'),_0xd55b('0x6f'),'boolean',_0xd55b('0x70'),'textarea',_0xd55b('0x71')];if(_0x57bac3){_['remove'](_0x57bac3[_0xd55b('0x37')],function(_0x115c30){return _0x43ae4c['includes'](_0x115c30[_0xd55b('0x28')])||!_0x1b9970[_0xd55b('0x72')](_0x115c30[_0xd55b('0x2f')]);});return{'count':_0x57bac3[_0xd55b('0x37')][_0xd55b('0x38')],'rows':_[_0xd55b('0x2b')](_0x57bac3[_0xd55b('0x37')],function(_0xaf25b9){return{'id':_0xaf25b9[_0xd55b('0x28')],'name':_0xaf25b9[_0xd55b('0x73')],'custom':_0xaf25b9['custom'],'options':_0xaf25b9[_0xd55b('0x74')][_0xd55b('0x38')]>0x0?_[_0xd55b('0x2b')](_0xaf25b9[_0xd55b('0x74')],function(_0x568a0f){return{'name':_0x568a0f[_0xd55b('0x73')],'value':_0x568a0f['value']};}):_0xaf25b9['type']=='boolean'?[{'name':'True','value':'true'},{'name':_0xd55b('0x75'),'value':_0xd55b('0x76')}]:[]};})};}})[_0xd55b('0x24')](respondWithResult(_0x173aff,null))[_0xd55b('0x45')](function(_0x91c77){var _0x28feca=_0x58f7c5[_0xd55b('0x32')][_0xd55b('0x77')]?0x1f4:_0x91c77[_0xd55b('0x78')]||0x1f4;logger[_0xd55b('0x79')](_0xd55b('0x7a'),_0xd55b('0x57'),_0x28feca,JSON[_0xd55b('0x7b')](_0x91c77));delete _0x91c77[_0xd55b('0x28')];if(_0x28feca===0x191){_0x28feca=0x190;}_0x173aff[_0xd55b('0x1c')](_0x28feca)[_0xd55b('0x29')](_0x58f7c5[_0xd55b('0x32')][_0xd55b('0x77')]?{'message':_0xd55b('0x7c'),'statusCode':_0x91c77['statusCode']}:_0x91c77);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 24836aa..c1f5a7c 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 _0x4ac5=['bluebird','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','lodash','util','../../config/logger'];(function(_0x45df7d,_0xe130fa){var _0x51cb41=function(_0x20e909){while(--_0x20e909){_0x45df7d['push'](_0x45df7d['shift']());}};_0x51cb41(++_0xe130fa);}(_0x4ac5,0x1ed));var _0x54ac=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x4ac5[_0x57add2];return _0x4e3670;};'use strict';var _=require(_0x54ac('0x0'));var util=require(_0x54ac('0x1'));var logger=require(_0x54ac('0x2'))('api');var moment=require('moment');var BPromise=require(_0x54ac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x54ac('0x4'));var attributes=require(_0x54ac('0x5'));var integrations=require(_0x54ac('0x6'));module['exports']=function(_0x4a518d,_0x408b97){return _0x4a518d['define'](_0x54ac('0x7'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9378=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount'];(function(_0x1cdc89,_0x4f2a30){var _0x4cc2b8=function(_0x4b5ea9){while(--_0x4b5ea9){_0x1cdc89['push'](_0x1cdc89['shift']());}};_0x4cc2b8(++_0x4f2a30);}(_0x9378,0x14a));var _0x8937=function(_0xba1f0d,_0x558aee){_0xba1f0d=_0xba1f0d-0x0;var _0x495b1e=_0x9378[_0xba1f0d];return _0x495b1e;};'use strict';var _=require(_0x8937('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8937('0x1'));var moment=require(_0x8937('0x2'));var BPromise=require(_0x8937('0x3'));var rp=require(_0x8937('0x4'));var fs=require('fs');var path=require(_0x8937('0x5'));var rimraf=require('rimraf');var config=require(_0x8937('0x6'));var attributes=require(_0x8937('0x7'));var integrations=require(_0x8937('0x8'));module['exports']=function(_0x2c6655,_0x2c5620){return _0x2c6655[_0x8937('0x9')](_0x8937('0xa'),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 fad5964..b900b33 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 _0x392c=['find','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSalesforceAccount'];(function(_0x297f8c,_0x3a8986){var _0x27fd31=function(_0x5105ee){while(--_0x5105ee){_0x297f8c['push'](_0x297f8c['shift']());}};_0x27fd31(++_0x3a8986);}(_0x392c,0x183));var _0xc392=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x392c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc392('0x0'));var util=require(_0xc392('0x1'));var moment=require(_0xc392('0x2'));var BPromise=require('bluebird');var rs=require(_0xc392('0x3'));var fs=require('fs');var Redis=require(_0xc392('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc392('0x5'));var logger=require(_0xc392('0x6'))(_0xc392('0x7'));var config=require(_0xc392('0x8'));var jayson=require(_0xc392('0x9'));var client=jayson[_0xc392('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x400b06,_0x3899ef,_0x2c5058){return new BPromise(function(_0x19ecc0,_0x2f64ca){return client['request'](_0x400b06,_0x2c5058)[_0xc392('0xb')](function(_0x244aec){logger[_0xc392('0xc')](_0xc392('0xd'),_0x3899ef,_0xc392('0xe'));logger['debug'](_0xc392('0xf'),_0x3899ef,_0xc392('0xe'),JSON['stringify'](_0x244aec));if(_0x244aec[_0xc392('0x10')]){if(_0x244aec[_0xc392('0x10')][_0xc392('0x11')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3899ef,_0x244aec[_0xc392('0x10')][_0xc392('0x12')]);return _0x2f64ca(_0x244aec['error'][_0xc392('0x12')]);}logger[_0xc392('0x10')](_0xc392('0xd'),_0x3899ef,_0x244aec[_0xc392('0x10')][_0xc392('0x12')]);return _0x19ecc0(_0x244aec[_0xc392('0x10')]['message']);}else{logger[_0xc392('0xc')](_0xc392('0xd'),_0x3899ef,_0xc392('0xe'));_0x19ecc0(_0x244aec[_0xc392('0x13')][_0xc392('0x12')]);}})[_0xc392('0x14')](function(_0x4e6ee9){logger['error'](_0xc392('0xd'),_0x3899ef,_0x4e6ee9);_0x2f64ca(_0x4e6ee9);});});}exports[_0xc392('0x15')]=function(_0x3c6895){var _0x351f57=this;return new Promise(function(_0x28d196,_0x4b1390){return db[_0xc392('0x16')][_0xc392('0x17')]({'raw':_0x3c6895[_0xc392('0x18')]?_0x3c6895['options'][_0xc392('0x19')]===undefined?!![]:![]:!![],'where':_0x3c6895[_0xc392('0x18')]?_0x3c6895['options'][_0xc392('0x1a')]||null:null,'attributes':_0x3c6895['options']?_0x3c6895[_0xc392('0x18')][_0xc392('0x1b')]||null:null,'limit':_0x3c6895['options']?_0x3c6895[_0xc392('0x18')][_0xc392('0x1c')]||null:null,'include':_0x3c6895[_0xc392('0x18')]?_0x3c6895[_0xc392('0x18')][_0xc392('0x1d')]?_['map'](_0x3c6895[_0xc392('0x18')][_0xc392('0x1d')],function(_0x253368){return{'model':db[_0x253368[_0xc392('0x1e')]],'as':_0x253368['as'],'attributes':_0x253368[_0xc392('0x1b')],'include':_0x253368[_0xc392('0x1d')]?_[_0xc392('0x1f')](_0x253368[_0xc392('0x1d')],function(_0xa6cf4d){return{'model':db[_0xa6cf4d[_0xc392('0x1e')]],'as':_0xa6cf4d['as'],'attributes':_0xa6cf4d[_0xc392('0x1b')],'include':_0xa6cf4d[_0xc392('0x1d')]?_[_0xc392('0x1f')](_0xa6cf4d[_0xc392('0x1d')],function(_0x10389d){return{'model':db[_0x10389d[_0xc392('0x1e')]],'as':_0x10389d['as'],'attributes':_0x10389d[_0xc392('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102ed3){logger['info']('GetSalesforceAccount',_0x3c6895);logger['debug'](_0xc392('0x15'),_0x3c6895,JSON['stringify'](_0x102ed3));_0x28d196(_0x102ed3);})['catch'](function(_0x4d9dbf){logger[_0xc392('0x10')](_0xc392('0x15'),_0x4d9dbf[_0xc392('0x12')],_0x3c6895);_0x4b1390(_0x351f57['error'](0x1f4,_0x4d9dbf[_0xc392('0x12')]));});});};exports[_0xc392('0x20')]=function(_0x31a9ee){var _0x1ba39f=this;return new Promise(function(_0x4d474c,_0x337a69){return db['SalesforceAccount'][_0xc392('0x21')]({'raw':_0x31a9ee[_0xc392('0x18')]?_0x31a9ee[_0xc392('0x18')][_0xc392('0x19')]===undefined?!![]:![]:!![],'where':_0x31a9ee[_0xc392('0x18')]?_0x31a9ee[_0xc392('0x18')][_0xc392('0x1a')]||null:null,'attributes':_0x31a9ee[_0xc392('0x18')]?_0x31a9ee[_0xc392('0x18')]['attributes']||null:null,'include':_0x31a9ee['options']?_0x31a9ee['options']['include']?_[_0xc392('0x1f')](_0x31a9ee[_0xc392('0x18')][_0xc392('0x1d')],function(_0x5c8ca9){return{'model':db[_0x5c8ca9['model']],'as':_0x5c8ca9['as'],'attributes':_0x5c8ca9[_0xc392('0x1b')],'include':_0x5c8ca9['include']?_[_0xc392('0x1f')](_0x5c8ca9['include'],function(_0x3ee2d0){return{'model':db[_0x3ee2d0[_0xc392('0x1e')]],'as':_0x3ee2d0['as'],'attributes':_0x3ee2d0[_0xc392('0x1b')],'include':_0x3ee2d0[_0xc392('0x1d')]?_[_0xc392('0x1f')](_0x3ee2d0[_0xc392('0x1d')],function(_0x1131d0){return{'model':db[_0x1131d0[_0xc392('0x1e')]],'as':_0x1131d0['as'],'attributes':_0x1131d0[_0xc392('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc392('0xb')](function(_0x312c4e){logger[_0xc392('0xc')](_0xc392('0x20'),_0x31a9ee);logger[_0xc392('0x22')](_0xc392('0x20'),_0x31a9ee,JSON['stringify'](_0x312c4e));_0x4d474c(_0x312c4e);})['catch'](function(_0x3367af){logger['error'](_0xc392('0x20'),_0x3367af[_0xc392('0x12')],_0x31a9ee);_0x337a69(_0x1ba39f[_0xc392('0x10')](0x1f4,_0x3367af[_0xc392('0x12')]));});});}; \ No newline at end of file +var _0xeca8=['limit','include','model','map','GetSalesforceAccount','find','where','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SalesforceAccount','findAll','options','raw','attributes'];(function(_0x2766c0,_0xc33273){var _0x202f25=function(_0x12dfd6){while(--_0x12dfd6){_0x2766c0['push'](_0x2766c0['shift']());}};_0x202f25(++_0xc33273);}(_0xeca8,0x1f2));var _0x8eca=function(_0x37bf48,_0x3bf7f6){_0x37bf48=_0x37bf48-0x0;var _0x55ffbf=_0xeca8[_0x37bf48];return _0x55ffbf;};'use strict';var _=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var moment=require(_0x8eca('0x2'));var BPromise=require(_0x8eca('0x3'));var rs=require(_0x8eca('0x4'));var fs=require('fs');var Redis=require(_0x8eca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eca('0x6'));var logger=require('../../config/logger')(_0x8eca('0x7'));var config=require(_0x8eca('0x8'));var jayson=require(_0x8eca('0x9'));var client=jayson['client'][_0x8eca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12c679,_0xe6e3f2,_0x39f40a){return new BPromise(function(_0xedaeca,_0x3b901f){return client['request'](_0x12c679,_0x39f40a)[_0x8eca('0xb')](function(_0x19208c){logger[_0x8eca('0xc')](_0x8eca('0xd'),_0xe6e3f2,_0x8eca('0xe'));logger[_0x8eca('0xf')](_0x8eca('0x10'),_0xe6e3f2,_0x8eca('0xe'),JSON[_0x8eca('0x11')](_0x19208c));if(_0x19208c[_0x8eca('0x12')]){if(_0x19208c['error'][_0x8eca('0x13')]===0x1f4){logger['error'](_0x8eca('0xd'),_0xe6e3f2,_0x19208c[_0x8eca('0x12')]['message']);return _0x3b901f(_0x19208c[_0x8eca('0x12')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xe6e3f2,_0x19208c[_0x8eca('0x12')][_0x8eca('0x14')]);return _0xedaeca(_0x19208c[_0x8eca('0x12')][_0x8eca('0x14')]);}else{logger[_0x8eca('0xc')](_0x8eca('0xd'),_0xe6e3f2,_0x8eca('0xe'));_0xedaeca(_0x19208c['result'][_0x8eca('0x14')]);}})[_0x8eca('0x15')](function(_0x4b8c67){logger[_0x8eca('0x12')](_0x8eca('0xd'),_0xe6e3f2,_0x4b8c67);_0x3b901f(_0x4b8c67);});});}exports['GetSalesforceAccount']=function(_0x500255){var _0xe8e3ec=this;return new Promise(function(_0x4dbb9f,_0x19b583){return db[_0x8eca('0x16')][_0x8eca('0x17')]({'raw':_0x500255[_0x8eca('0x18')]?_0x500255['options'][_0x8eca('0x19')]===undefined?!![]:![]:!![],'where':_0x500255['options']?_0x500255[_0x8eca('0x18')]['where']||null:null,'attributes':_0x500255[_0x8eca('0x18')]?_0x500255[_0x8eca('0x18')][_0x8eca('0x1a')]||null:null,'limit':_0x500255[_0x8eca('0x18')]?_0x500255[_0x8eca('0x18')][_0x8eca('0x1b')]||null:null,'include':_0x500255['options']?_0x500255[_0x8eca('0x18')]['include']?_['map'](_0x500255[_0x8eca('0x18')][_0x8eca('0x1c')],function(_0x2de054){return{'model':db[_0x2de054[_0x8eca('0x1d')]],'as':_0x2de054['as'],'attributes':_0x2de054[_0x8eca('0x1a')],'include':_0x2de054['include']?_[_0x8eca('0x1e')](_0x2de054['include'],function(_0x45b28e){return{'model':db[_0x45b28e[_0x8eca('0x1d')]],'as':_0x45b28e['as'],'attributes':_0x45b28e[_0x8eca('0x1a')],'include':_0x45b28e[_0x8eca('0x1c')]?_[_0x8eca('0x1e')](_0x45b28e[_0x8eca('0x1c')],function(_0x33e4db){return{'model':db[_0x33e4db[_0x8eca('0x1d')]],'as':_0x33e4db['as'],'attributes':_0x33e4db['attributes']};}):[]};}):[]};}):[]:[]})[_0x8eca('0xb')](function(_0x752faf){logger[_0x8eca('0xc')](_0x8eca('0x1f'),_0x500255);logger[_0x8eca('0xf')](_0x8eca('0x1f'),_0x500255,JSON[_0x8eca('0x11')](_0x752faf));_0x4dbb9f(_0x752faf);})[_0x8eca('0x15')](function(_0x36b286){logger['error'](_0x8eca('0x1f'),_0x36b286[_0x8eca('0x14')],_0x500255);_0x19b583(_0xe8e3ec[_0x8eca('0x12')](0x1f4,_0x36b286[_0x8eca('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x1fa79d){var _0x475362=this;return new Promise(function(_0x3701f6,_0x13bcf6){return db[_0x8eca('0x16')][_0x8eca('0x20')]({'raw':_0x1fa79d[_0x8eca('0x18')]?_0x1fa79d[_0x8eca('0x18')][_0x8eca('0x19')]===undefined?!![]:![]:!![],'where':_0x1fa79d['options']?_0x1fa79d['options'][_0x8eca('0x21')]||null:null,'attributes':_0x1fa79d[_0x8eca('0x18')]?_0x1fa79d[_0x8eca('0x18')][_0x8eca('0x1a')]||null:null,'include':_0x1fa79d[_0x8eca('0x18')]?_0x1fa79d[_0x8eca('0x18')][_0x8eca('0x1c')]?_[_0x8eca('0x1e')](_0x1fa79d[_0x8eca('0x18')][_0x8eca('0x1c')],function(_0x49cee8){return{'model':db[_0x49cee8['model']],'as':_0x49cee8['as'],'attributes':_0x49cee8['attributes'],'include':_0x49cee8[_0x8eca('0x1c')]?_[_0x8eca('0x1e')](_0x49cee8[_0x8eca('0x1c')],function(_0x1d680c){return{'model':db[_0x1d680c[_0x8eca('0x1d')]],'as':_0x1d680c['as'],'attributes':_0x1d680c[_0x8eca('0x1a')],'include':_0x1d680c[_0x8eca('0x1c')]?_[_0x8eca('0x1e')](_0x1d680c[_0x8eca('0x1c')],function(_0x22c696){return{'model':db[_0x22c696[_0x8eca('0x1d')]],'as':_0x22c696['as'],'attributes':_0x22c696[_0x8eca('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8eca('0xb')](function(_0x2b767d){logger['info'](_0x8eca('0x22'),_0x1fa79d);logger['debug'](_0x8eca('0x22'),_0x1fa79d,JSON[_0x8eca('0x11')](_0x2b767d));_0x3701f6(_0x2b767d);})['catch'](function(_0x38aa7e){logger['error'](_0x8eca('0x22'),_0x38aa7e[_0x8eca('0x14')],_0x1fa79d);_0x13bcf6(_0x475362[_0x8eca('0x12')](0x1f4,_0x38aa7e[_0x8eca('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1de7db1..84b1672 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x0b0e,0x187));var _0xe0b0=function(_0x139b63,_0x389ca8){_0x139b63=_0x139b63-0x0;var _0x2493f2=_0x0b0e[_0x139b63];return _0x2493f2;};'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['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=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(_0x5555bc,_0x22b194){var _0x50b52b=function(_0x48b550){while(--_0x48b550){_0x5555bc['push'](_0x5555bc['shift']());}};_0x50b52b(++_0x22b194);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a6687,_0x2efd05){_0x3a6687=_0x3a6687-0x0;var _0x47f61f=_0x2ef3[_0x3a6687];return _0x47f61f;};'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 33ee6be..bd660de 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 _0xf4e6=['nothing','contact','sequelize','STRING','ENUM','Task','Case','contact_lead','lead','account_contact_lead','account'];(function(_0x5144e6,_0x561398){var _0x5c1472=function(_0x507424){while(--_0x507424){_0x5144e6['push'](_0x5144e6['shift']());}};_0x5c1472(++_0x561398);}(_0xf4e6,0xa7));var _0x6f4e=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xf4e6[_0x5dc03e];return _0x466a07;};'use strict';var Sequelize=require(_0x6f4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f4e('0x1')]},'description':{'type':Sequelize[_0x6f4e('0x1')]},'ticketType':{'type':Sequelize[_0x6f4e('0x2')](_0x6f4e('0x3'),_0x6f4e('0x4')),'defaultValue':_0x6f4e('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x6f4e('0x5'),'contact',_0x6f4e('0x6'),_0x6f4e('0x7'),_0x6f4e('0x8')),'defaultValue':_0x6f4e('0x5')},'moduleCreate':{'type':Sequelize[_0x6f4e('0x2')](_0x6f4e('0x9'),_0x6f4e('0xa'),_0x6f4e('0x6'),_0x6f4e('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x6f4e('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x6f4e('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x6f4e('0x1')]}}; \ No newline at end of file +var _0x9c54=['Case','ENUM','contact_lead','contact','account','nothing','lead','STRING','sequelize','Task'];(function(_0x2b66ae,_0x6709a7){var _0x1d18b0=function(_0x36e7ff){while(--_0x36e7ff){_0x2b66ae['push'](_0x2b66ae['shift']());}};_0x1d18b0(++_0x6709a7);}(_0x9c54,0x120));var _0x49c5=function(_0x89cf8,_0x459b54){_0x89cf8=_0x89cf8-0x0;var _0x4a0607=_0x9c54[_0x89cf8];return _0x4a0607;};'use strict';var Sequelize=require(_0x49c5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x49c5('0x1'),_0x49c5('0x2')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x49c5('0x3')](_0x49c5('0x4'),_0x49c5('0x5'),'lead','account_contact_lead',_0x49c5('0x6')),'defaultValue':_0x49c5('0x4')},'moduleCreate':{'type':Sequelize[_0x49c5('0x3')](_0x49c5('0x7'),_0x49c5('0x5'),_0x49c5('0x8'),'account'),'defaultValue':_0x49c5('0x8')},'leadId':{'type':Sequelize[_0x49c5('0x9')]},'additionalSearchAccount':{'type':Sequelize[_0x49c5('0x9')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index dd3015b..20d5aca 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 _0xb338=['find','create','body','catch','getFields','findOne','SalesforceField','sort','pick','getSubjects','getDescriptions','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','then','end','error','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','length','nolimit','query','order','where','merge','filter','options','SalesforceConfiguration','includeAll','include','findAll','rows','params'];(function(_0x623c35,_0x3bf04b){var _0x40c468=function(_0x4aec0e){while(--_0x4aec0e){_0x623c35['push'](_0x623c35['shift']());}};_0x40c468(++_0x3bf04b);}(_0xb338,0x130));var _0x8b33=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xb338[_0x533528];return _0x3189f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b33('0x0'));var zipdir=require(_0x8b33('0x1'));var jsonpatch=require(_0x8b33('0x2'));var rp=require(_0x8b33('0x3'));var moment=require('moment');var BPromise=require(_0x8b33('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8b33('0x5'));var sox=require(_0x8b33('0x6'));var csv=require(_0x8b33('0x7'));var ejs=require(_0x8b33('0x8'));var fs=require('fs');var fs_extra=require(_0x8b33('0x9'));var _=require(_0x8b33('0xa'));var squel=require(_0x8b33('0xb'));var crypto=require(_0x8b33('0xc'));var jsforce=require(_0x8b33('0xd'));var deskjs=require(_0x8b33('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b33('0xf'));var qs=require(_0x8b33('0x10'));var as=require(_0x8b33('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b33('0x12'))(_0x8b33('0x13'));var utils=require('../../config/utils');var config=require(_0x8b33('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b33('0x15'))['db'];function respondWithStatusCode(_0x1e1538,_0x459397){_0x459397=_0x459397||0xcc;return function(_0x2c7040){if(_0x2c7040){return _0x1e1538[_0x8b33('0x16')](_0x459397);}return _0x1e1538[_0x8b33('0x17')](_0x459397)['end']();};}function respondWithResult(_0x21e0a5,_0x5dfe5e){_0x5dfe5e=_0x5dfe5e||0xc8;return function(_0x2f0c34){if(_0x2f0c34){return _0x21e0a5['status'](_0x5dfe5e)[_0x8b33('0x18')](_0x2f0c34);}};}function respondWithFilteredResult(_0x569d91,_0x18557f){return function(_0x2f6e2d){if(_0x2f6e2d){var _0x1ac263=typeof _0x18557f[_0x8b33('0x19')]==='undefined'&&typeof _0x18557f[_0x8b33('0x1a')]===_0x8b33('0x1b');var _0x4b4a61=_0x2f6e2d[_0x8b33('0x1c')];var _0x366581=_0x1ac263?0x0:_0x18557f[_0x8b33('0x19')];var _0x288273=_0x1ac263?_0x2f6e2d['count']:_0x18557f['offset']+_0x18557f[_0x8b33('0x1a')];var _0x3c4905;if(_0x288273>=_0x4b4a61){_0x288273=_0x4b4a61;_0x3c4905=0xc8;}else{_0x3c4905=0xce;}_0x569d91[_0x8b33('0x17')](_0x3c4905);return _0x569d91['set'](_0x8b33('0x1d'),_0x366581+'-'+_0x288273+'/'+_0x4b4a61)[_0x8b33('0x18')](_0x2f6e2d);}return null;};}function patchUpdates(_0x513989){return function(_0x598801){try{jsonpatch['apply'](_0x598801,_0x513989,!![]);}catch(_0x526dce){return BPromise[_0x8b33('0x1e')](_0x526dce);}return _0x598801['save']();};}function saveUpdates(_0x256a0c,_0x1fd150){return function(_0x43af80){if(_0x43af80){return _0x43af80['update'](_0x256a0c)[_0x8b33('0x1f')](function(_0x2385f4){return _0x2385f4;});}return null;};}function removeEntity(_0x41b5e1,_0x31ac86){return function(_0x18b892){if(_0x18b892){return _0x18b892['destroy']()[_0x8b33('0x1f')](function(){_0x41b5e1[_0x8b33('0x17')](0xcc)[_0x8b33('0x20')]();});}};}function handleEntityNotFound(_0x33935c,_0x1a36cb){return function(_0x31268c){if(!_0x31268c){_0x33935c[_0x8b33('0x16')](0x194);}return _0x31268c;};}function handleError(_0x554ca6,_0x3a15c2){_0x3a15c2=_0x3a15c2||0x1f4;return function(_0x79ab08){logger[_0x8b33('0x21')](_0x79ab08['stack']);if(_0x79ab08[_0x8b33('0x22')]){delete _0x79ab08['name'];}_0x554ca6['status'](_0x3a15c2)[_0x8b33('0x23')](_0x79ab08);};}exports[_0x8b33('0x24')]=function(_0x520c16,_0x3e0388){var _0x31539b={},_0x58c4f4={},_0x5950cf={'count':0x0,'rows':[]};var _0x118225=_[_0x8b33('0x25')](db['SalesforceConfiguration'][_0x8b33('0x26')],function(_0x420f45){return{'name':_0x420f45['fieldName'],'type':_0x420f45[_0x8b33('0x27')][_0x8b33('0x28')]};});_0x58c4f4[_0x8b33('0x29')]=_[_0x8b33('0x25')](_0x118225,_0x8b33('0x22'));_0x58c4f4['query']=_[_0x8b33('0x2a')](_0x520c16['query']);_0x58c4f4[_0x8b33('0x2b')]=_[_0x8b33('0x2c')](_0x58c4f4[_0x8b33('0x29')],_0x58c4f4['query']);_0x31539b[_0x8b33('0x2d')]=_[_0x8b33('0x2c')](_0x58c4f4[_0x8b33('0x29')],qs[_0x8b33('0x2e')](_0x520c16['query']['fields']));_0x31539b[_0x8b33('0x2d')]=_0x31539b['attributes'][_0x8b33('0x2f')]?_0x31539b[_0x8b33('0x2d')]:_0x58c4f4[_0x8b33('0x29')];if(!_0x520c16['query']['hasOwnProperty'](_0x8b33('0x30'))){_0x31539b[_0x8b33('0x1a')]=qs[_0x8b33('0x1a')](_0x520c16[_0x8b33('0x31')][_0x8b33('0x1a')]);_0x31539b['offset']=qs[_0x8b33('0x19')](_0x520c16[_0x8b33('0x31')][_0x8b33('0x19')]);}_0x31539b[_0x8b33('0x32')]=qs['sort'](_0x520c16[_0x8b33('0x31')]['sort']);_0x31539b[_0x8b33('0x33')]=qs[_0x8b33('0x2b')](_['pick'](_0x520c16[_0x8b33('0x31')],_0x58c4f4[_0x8b33('0x2b')]),_0x118225);if(_0x520c16[_0x8b33('0x31')]['filter']){_0x31539b[_0x8b33('0x33')]=_[_0x8b33('0x34')](_0x31539b[_0x8b33('0x33')],{'$or':_[_0x8b33('0x25')](_0x118225,function(_0x22bea7){if(_0x22bea7['type']!=='VIRTUAL'){var _0x6e4afb={};_0x6e4afb[_0x22bea7[_0x8b33('0x22')]]={'$like':'%'+_0x520c16[_0x8b33('0x31')][_0x8b33('0x35')]+'%'};return _0x6e4afb;}})});}_0x31539b=_[_0x8b33('0x34')]({},_0x31539b,_0x520c16[_0x8b33('0x36')]);var _0x4b050f={'where':_0x31539b[_0x8b33('0x33')]};return db[_0x8b33('0x37')][_0x8b33('0x1c')](_0x4b050f)[_0x8b33('0x1f')](function(_0x22f883){_0x5950cf[_0x8b33('0x1c')]=_0x22f883;if(_0x520c16[_0x8b33('0x31')][_0x8b33('0x38')]){_0x31539b[_0x8b33('0x39')]=[{'all':!![]}];}return db[_0x8b33('0x37')][_0x8b33('0x3a')](_0x31539b);})[_0x8b33('0x1f')](function(_0x26809b){_0x5950cf[_0x8b33('0x3b')]=_0x26809b;return _0x5950cf;})[_0x8b33('0x1f')](respondWithFilteredResult(_0x3e0388,_0x31539b))['catch'](handleError(_0x3e0388,null));};exports['show']=function(_0x2a2a68,_0x3ce07c){var _0x163e64={'raw':![],'where':{'id':_0x2a2a68[_0x8b33('0x3c')]['id']}},_0x5c3a2a={};_0x5c3a2a[_0x8b33('0x29')]=_[_0x8b33('0x2a')](db[_0x8b33('0x37')]['rawAttributes']);_0x5c3a2a[_0x8b33('0x31')]=_[_0x8b33('0x2a')](_0x2a2a68[_0x8b33('0x31')]);_0x5c3a2a['filters']=_[_0x8b33('0x2c')](_0x5c3a2a['model'],_0x5c3a2a[_0x8b33('0x31')]);_0x163e64[_0x8b33('0x2d')]=_[_0x8b33('0x2c')](_0x5c3a2a[_0x8b33('0x29')],qs[_0x8b33('0x2e')](_0x2a2a68[_0x8b33('0x31')][_0x8b33('0x2e')]));_0x163e64[_0x8b33('0x2d')]=_0x163e64['attributes'][_0x8b33('0x2f')]?_0x163e64[_0x8b33('0x2d')]:_0x5c3a2a[_0x8b33('0x29')];if(_0x2a2a68[_0x8b33('0x31')][_0x8b33('0x38')]){_0x163e64[_0x8b33('0x39')]=[{'all':!![]}];}_0x163e64=_['merge']({},_0x163e64,_0x2a2a68[_0x8b33('0x36')]);return db['SalesforceConfiguration'][_0x8b33('0x3d')](_0x163e64)[_0x8b33('0x1f')](handleEntityNotFound(_0x3ce07c,null))[_0x8b33('0x1f')](respondWithResult(_0x3ce07c,null))['catch'](handleError(_0x3ce07c,null));};exports[_0x8b33('0x3e')]=function(_0x305ca0,_0x221ef1){return db[_0x8b33('0x37')][_0x8b33('0x3e')](_0x305ca0[_0x8b33('0x3f')],{})[_0x8b33('0x1f')](respondWithResult(_0x221ef1,0xc9))[_0x8b33('0x40')](handleError(_0x221ef1,null));};exports['update']=function(_0x188ec8,_0x5e96b6){if(_0x188ec8[_0x8b33('0x3f')]['id']){delete _0x188ec8[_0x8b33('0x3f')]['id'];}return db['SalesforceConfiguration'][_0x8b33('0x3d')]({'where':{'id':_0x188ec8[_0x8b33('0x3c')]['id']}})[_0x8b33('0x1f')](handleEntityNotFound(_0x5e96b6,null))[_0x8b33('0x1f')](saveUpdates(_0x188ec8['body'],null))['then'](respondWithResult(_0x5e96b6,null))[_0x8b33('0x40')](handleError(_0x5e96b6,null));};exports['destroy']=function(_0x43beb9,_0x44ab0a){return db[_0x8b33('0x37')]['find']({'where':{'id':_0x43beb9[_0x8b33('0x3c')]['id']}})['then'](handleEntityNotFound(_0x44ab0a,null))[_0x8b33('0x1f')](removeEntity(_0x44ab0a,null))[_0x8b33('0x40')](handleError(_0x44ab0a,null));};exports[_0x8b33('0x41')]=function(_0x5fa9bf,_0x2cb569,_0x580ab6){var _0x104a1e={};var _0x1ed47c={};var _0x4a877a;var _0x4c0ef2;return db['SalesforceConfiguration'][_0x8b33('0x42')]({'where':{'id':_0x5fa9bf['params']['id']}})[_0x8b33('0x1f')](handleEntityNotFound(_0x2cb569,null))[_0x8b33('0x1f')](function(_0x5b50dc){if(_0x5b50dc){_0x4a877a=_0x5b50dc;_0x1ed47c[_0x8b33('0x29')]=_[_0x8b33('0x2a')](db[_0x8b33('0x43')]['rawAttributes']);_0x1ed47c['query']=_[_0x8b33('0x2a')](_0x5fa9bf[_0x8b33('0x31')]);_0x1ed47c[_0x8b33('0x2b')]=_[_0x8b33('0x2c')](_0x1ed47c[_0x8b33('0x29')],_0x1ed47c[_0x8b33('0x31')]);_0x104a1e[_0x8b33('0x2d')]=_[_0x8b33('0x2c')](_0x1ed47c[_0x8b33('0x29')],qs[_0x8b33('0x2e')](_0x5fa9bf[_0x8b33('0x31')]['fields']));_0x104a1e['attributes']=_0x104a1e[_0x8b33('0x2d')][_0x8b33('0x2f')]?_0x104a1e[_0x8b33('0x2d')]:_0x1ed47c[_0x8b33('0x29')];_0x104a1e['order']=qs[_0x8b33('0x44')](_0x5fa9bf['query']['sort']);_0x104a1e[_0x8b33('0x33')]=qs['filters'](_[_0x8b33('0x45')](_0x5fa9bf[_0x8b33('0x31')],_0x1ed47c[_0x8b33('0x2b')]));if(_0x5fa9bf[_0x8b33('0x31')]['filter']){_0x104a1e[_0x8b33('0x33')]=_[_0x8b33('0x34')](_0x104a1e[_0x8b33('0x33')],{'$or':_[_0x8b33('0x25')](_0x104a1e[_0x8b33('0x2d')],function(_0x4b9928){var _0x1146d7={};_0x1146d7[_0x4b9928]={'$like':'%'+_0x5fa9bf['query'][_0x8b33('0x35')]+'%'};return _0x1146d7;})});}_0x104a1e=_[_0x8b33('0x34')]({},_0x104a1e,_0x5fa9bf[_0x8b33('0x36')]);return _0x4a877a['getFields'](_0x104a1e);}})[_0x8b33('0x1f')](function(_0x537994){if(_0x537994){_0x4c0ef2=_0x537994[_0x8b33('0x2f')];if(!_0x5fa9bf['query']['hasOwnProperty'](_0x8b33('0x30'))){_0x104a1e['limit']=qs[_0x8b33('0x1a')](_0x5fa9bf['query']['limit']);_0x104a1e[_0x8b33('0x19')]=qs['offset'](_0x5fa9bf['query'][_0x8b33('0x19')]);}return _0x4a877a[_0x8b33('0x41')](_0x104a1e);}})[_0x8b33('0x1f')](function(_0x2b7f89){if(_0x2b7f89){return _0x2b7f89?{'count':_0x4c0ef2,'rows':_0x2b7f89}:null;}})[_0x8b33('0x1f')](respondWithResult(_0x2cb569,null))[_0x8b33('0x40')](handleError(_0x2cb569,null));};exports[_0x8b33('0x46')]=function(_0x40c115,_0xc90c4e,_0x3156fb){var _0x795341={};var _0x3e5748={};var _0x5ac665;var _0x199c51;return db[_0x8b33('0x37')]['findOne']({'where':{'id':_0x40c115['params']['id']}})[_0x8b33('0x1f')](handleEntityNotFound(_0xc90c4e,null))[_0x8b33('0x1f')](function(_0x1df56e){if(_0x1df56e){_0x5ac665=_0x1df56e;_0x3e5748[_0x8b33('0x29')]=_['keys'](db[_0x8b33('0x43')][_0x8b33('0x26')]);_0x3e5748[_0x8b33('0x31')]=_[_0x8b33('0x2a')](_0x40c115['query']);_0x3e5748[_0x8b33('0x2b')]=_[_0x8b33('0x2c')](_0x3e5748[_0x8b33('0x29')],_0x3e5748['query']);_0x795341[_0x8b33('0x2d')]=_[_0x8b33('0x2c')](_0x3e5748[_0x8b33('0x29')],qs[_0x8b33('0x2e')](_0x40c115['query'][_0x8b33('0x2e')]));_0x795341[_0x8b33('0x2d')]=_0x795341[_0x8b33('0x2d')][_0x8b33('0x2f')]?_0x795341[_0x8b33('0x2d')]:_0x3e5748[_0x8b33('0x29')];_0x795341['order']=qs[_0x8b33('0x44')](_0x40c115[_0x8b33('0x31')]['sort']);_0x795341['where']=qs[_0x8b33('0x2b')](_[_0x8b33('0x45')](_0x40c115[_0x8b33('0x31')],_0x3e5748[_0x8b33('0x2b')]));if(_0x40c115[_0x8b33('0x31')][_0x8b33('0x35')]){_0x795341[_0x8b33('0x33')]=_[_0x8b33('0x34')](_0x795341[_0x8b33('0x33')],{'$or':_['map'](_0x795341['attributes'],function(_0xd19d69){var _0x5232a5={};_0x5232a5[_0xd19d69]={'$like':'%'+_0x40c115[_0x8b33('0x31')]['filter']+'%'};return _0x5232a5;})});}_0x795341=_[_0x8b33('0x34')]({},_0x795341,_0x40c115['options']);return _0x5ac665[_0x8b33('0x46')](_0x795341);}})['then'](function(_0x22af69){if(_0x22af69){_0x199c51=_0x22af69[_0x8b33('0x2f')];if(!_0x40c115[_0x8b33('0x31')]['hasOwnProperty'](_0x8b33('0x30'))){_0x795341[_0x8b33('0x1a')]=qs['limit'](_0x40c115[_0x8b33('0x31')][_0x8b33('0x1a')]);_0x795341[_0x8b33('0x19')]=qs[_0x8b33('0x19')](_0x40c115['query'][_0x8b33('0x19')]);}return _0x5ac665[_0x8b33('0x46')](_0x795341);}})[_0x8b33('0x1f')](function(_0x19e763){if(_0x19e763){return _0x19e763?{'count':_0x199c51,'rows':_0x19e763}:null;}})[_0x8b33('0x1f')](respondWithResult(_0xc90c4e,null))[_0x8b33('0x40')](handleError(_0xc90c4e,null));};exports['getDescriptions']=function(_0x26c019,_0x29317c,_0x546a08){var _0xb16e4f={};var _0x19c93c={};var _0x1761f9;var _0x112333;return db[_0x8b33('0x37')]['findOne']({'where':{'id':_0x26c019['params']['id']}})[_0x8b33('0x1f')](handleEntityNotFound(_0x29317c,null))[_0x8b33('0x1f')](function(_0x39f4d6){if(_0x39f4d6){_0x1761f9=_0x39f4d6;_0x19c93c[_0x8b33('0x29')]=_[_0x8b33('0x2a')](db[_0x8b33('0x43')]['rawAttributes']);_0x19c93c[_0x8b33('0x31')]=_[_0x8b33('0x2a')](_0x26c019[_0x8b33('0x31')]);_0x19c93c['filters']=_[_0x8b33('0x2c')](_0x19c93c[_0x8b33('0x29')],_0x19c93c[_0x8b33('0x31')]);_0xb16e4f[_0x8b33('0x2d')]=_[_0x8b33('0x2c')](_0x19c93c[_0x8b33('0x29')],qs[_0x8b33('0x2e')](_0x26c019['query'][_0x8b33('0x2e')]));_0xb16e4f[_0x8b33('0x2d')]=_0xb16e4f[_0x8b33('0x2d')][_0x8b33('0x2f')]?_0xb16e4f[_0x8b33('0x2d')]:_0x19c93c['model'];_0xb16e4f[_0x8b33('0x32')]=qs['sort'](_0x26c019[_0x8b33('0x31')][_0x8b33('0x44')]);_0xb16e4f['where']=qs[_0x8b33('0x2b')](_['pick'](_0x26c019[_0x8b33('0x31')],_0x19c93c['filters']));if(_0x26c019[_0x8b33('0x31')][_0x8b33('0x35')]){_0xb16e4f[_0x8b33('0x33')]=_[_0x8b33('0x34')](_0xb16e4f[_0x8b33('0x33')],{'$or':_[_0x8b33('0x25')](_0xb16e4f[_0x8b33('0x2d')],function(_0x777bc3){var _0x5729e8={};_0x5729e8[_0x777bc3]={'$like':'%'+_0x26c019[_0x8b33('0x31')][_0x8b33('0x35')]+'%'};return _0x5729e8;})});}_0xb16e4f=_[_0x8b33('0x34')]({},_0xb16e4f,_0x26c019['options']);return _0x1761f9[_0x8b33('0x47')](_0xb16e4f);}})[_0x8b33('0x1f')](function(_0x4c1b0a){if(_0x4c1b0a){_0x112333=_0x4c1b0a['length'];if(!_0x26c019['query'][_0x8b33('0x48')](_0x8b33('0x30'))){_0xb16e4f[_0x8b33('0x1a')]=qs[_0x8b33('0x1a')](_0x26c019[_0x8b33('0x31')][_0x8b33('0x1a')]);_0xb16e4f[_0x8b33('0x19')]=qs['offset'](_0x26c019[_0x8b33('0x31')]['offset']);}return _0x1761f9[_0x8b33('0x47')](_0xb16e4f);}})[_0x8b33('0x1f')](function(_0x5b13c8){if(_0x5b13c8){return _0x5b13c8?{'count':_0x112333,'rows':_0x5b13c8}:null;}})[_0x8b33('0x1f')](respondWithResult(_0x29317c,null))[_0x8b33('0x40')](handleError(_0x29317c,null));}; \ No newline at end of file +var _0xc43b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','length','options','create','body','catch','find','getFields','SalesforceField','order','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x562b09,_0x49d29f){var _0x3d8709=function(_0x234788){while(--_0x234788){_0x562b09['push'](_0x562b09['shift']());}};_0x3d8709(++_0x49d29f);}(_0xc43b,0x1e3));var _0xbc43=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc43b[_0x1b2ff7];return _0x31656a;};'use strict';var emlformat=require(_0xbc43('0x0'));var rimraf=require(_0xbc43('0x1'));var zipdir=require(_0xbc43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbc43('0x3'));var BPromise=require(_0xbc43('0x4'));var Mustache=require(_0xbc43('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbc43('0x6'));var csv=require(_0xbc43('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc43('0x8'));var _=require(_0xbc43('0x9'));var squel=require(_0xbc43('0xa'));var crypto=require(_0xbc43('0xb'));var jsforce=require(_0xbc43('0xc'));var deskjs=require(_0xbc43('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbc43('0xe'));var Papa=require(_0xbc43('0xf'));var Redis=require(_0xbc43('0x10'));var authService=require(_0xbc43('0x11'));var qs=require(_0xbc43('0x12'));var as=require(_0xbc43('0x13'));var hardwareService=require(_0xbc43('0x14'));var logger=require(_0xbc43('0x15'))(_0xbc43('0x16'));var utils=require('../../config/utils');var config=require(_0xbc43('0x17'));var licenseUtil=require(_0xbc43('0x18'));var db=require(_0xbc43('0x19'))['db'];function respondWithStatusCode(_0x5f322c,_0x26e243){_0x26e243=_0x26e243||0xcc;return function(_0x174639){if(_0x174639){return _0x5f322c[_0xbc43('0x1a')](_0x26e243);}return _0x5f322c[_0xbc43('0x1b')](_0x26e243)[_0xbc43('0x1c')]();};}function respondWithResult(_0x1588ac,_0x199c8e){_0x199c8e=_0x199c8e||0xc8;return function(_0x16838b){if(_0x16838b){return _0x1588ac[_0xbc43('0x1b')](_0x199c8e)[_0xbc43('0x1d')](_0x16838b);}};}function respondWithFilteredResult(_0x582c67,_0x2e1401){return function(_0x37bce){if(_0x37bce){var _0x2dd04f=typeof _0x2e1401[_0xbc43('0x1e')]==='undefined'&&typeof _0x2e1401[_0xbc43('0x1f')]===_0xbc43('0x20');var _0x30c93c=_0x37bce[_0xbc43('0x21')];var _0x43602e=_0x2dd04f?0x0:_0x2e1401['offset'];var _0x32e6ee=_0x2dd04f?_0x37bce[_0xbc43('0x21')]:_0x2e1401[_0xbc43('0x1e')]+_0x2e1401['limit'];var _0x5a829a;if(_0x32e6ee>=_0x30c93c){_0x32e6ee=_0x30c93c;_0x5a829a=0xc8;}else{_0x5a829a=0xce;}_0x582c67[_0xbc43('0x1b')](_0x5a829a);return _0x582c67[_0xbc43('0x22')]('Content-Range',_0x43602e+'-'+_0x32e6ee+'/'+_0x30c93c)[_0xbc43('0x1d')](_0x37bce);}return null;};}function patchUpdates(_0x4dbb6e){return function(_0x81b435){try{jsonpatch[_0xbc43('0x23')](_0x81b435,_0x4dbb6e,!![]);}catch(_0x3a29ff){return BPromise['reject'](_0x3a29ff);}return _0x81b435[_0xbc43('0x24')]();};}function saveUpdates(_0x46192f,_0x3c2b52){return function(_0x3eb797){if(_0x3eb797){return _0x3eb797[_0xbc43('0x25')](_0x46192f)[_0xbc43('0x26')](function(_0x16dc30){return _0x16dc30;});}return null;};}function removeEntity(_0x3972c8,_0x301a7a){return function(_0x6a9c9){if(_0x6a9c9){return _0x6a9c9[_0xbc43('0x27')]()[_0xbc43('0x26')](function(){_0x3972c8[_0xbc43('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x268407,_0x492e98){return function(_0x34073c){if(!_0x34073c){_0x268407[_0xbc43('0x1a')](0x194);}return _0x34073c;};}function handleError(_0x172ef9,_0x1f9f17){_0x1f9f17=_0x1f9f17||0x1f4;return function(_0x4a026b){logger[_0xbc43('0x28')](_0x4a026b[_0xbc43('0x29')]);if(_0x4a026b['name']){delete _0x4a026b[_0xbc43('0x2a')];}_0x172ef9[_0xbc43('0x1b')](_0x1f9f17)[_0xbc43('0x2b')](_0x4a026b);};}exports[_0xbc43('0x2c')]=function(_0x25a37b,_0x6d6d92){var _0x12b59e={},_0x5103ca={},_0x16d8b9={'count':0x0,'rows':[]};var _0x1eefad=_[_0xbc43('0x2d')](db[_0xbc43('0x2e')][_0xbc43('0x2f')],function(_0xb16b17){return{'name':_0xb16b17[_0xbc43('0x30')],'type':_0xb16b17[_0xbc43('0x31')]['key']};});_0x5103ca[_0xbc43('0x32')]=_[_0xbc43('0x2d')](_0x1eefad,_0xbc43('0x2a'));_0x5103ca[_0xbc43('0x33')]=_['keys'](_0x25a37b[_0xbc43('0x33')]);_0x5103ca['filters']=_[_0xbc43('0x34')](_0x5103ca[_0xbc43('0x32')],_0x5103ca[_0xbc43('0x33')]);_0x12b59e['attributes']=_[_0xbc43('0x34')](_0x5103ca[_0xbc43('0x32')],qs[_0xbc43('0x35')](_0x25a37b[_0xbc43('0x33')][_0xbc43('0x35')]));_0x12b59e['attributes']=_0x12b59e[_0xbc43('0x36')]['length']?_0x12b59e[_0xbc43('0x36')]:_0x5103ca[_0xbc43('0x32')];if(!_0x25a37b[_0xbc43('0x33')][_0xbc43('0x37')](_0xbc43('0x38'))){_0x12b59e[_0xbc43('0x1f')]=qs[_0xbc43('0x1f')](_0x25a37b['query'][_0xbc43('0x1f')]);_0x12b59e['offset']=qs[_0xbc43('0x1e')](_0x25a37b['query'][_0xbc43('0x1e')]);}_0x12b59e['order']=qs[_0xbc43('0x39')](_0x25a37b['query'][_0xbc43('0x39')]);_0x12b59e[_0xbc43('0x3a')]=qs[_0xbc43('0x3b')](_[_0xbc43('0x3c')](_0x25a37b[_0xbc43('0x33')],_0x5103ca['filters']),_0x1eefad);if(_0x25a37b[_0xbc43('0x33')][_0xbc43('0x3d')]){_0x12b59e['where']=_[_0xbc43('0x3e')](_0x12b59e[_0xbc43('0x3a')],{'$or':_[_0xbc43('0x2d')](_0x1eefad,function(_0x1de208){if(_0x1de208[_0xbc43('0x31')]!==_0xbc43('0x3f')){var _0x35364e={};_0x35364e[_0x1de208[_0xbc43('0x2a')]]={'$like':'%'+_0x25a37b['query'][_0xbc43('0x3d')]+'%'};return _0x35364e;}})});}_0x12b59e=_[_0xbc43('0x3e')]({},_0x12b59e,_0x25a37b['options']);var _0x3c32e0={'where':_0x12b59e[_0xbc43('0x3a')]};return db[_0xbc43('0x2e')][_0xbc43('0x21')](_0x3c32e0)['then'](function(_0x597664){_0x16d8b9[_0xbc43('0x21')]=_0x597664;if(_0x25a37b[_0xbc43('0x33')][_0xbc43('0x40')]){_0x12b59e[_0xbc43('0x41')]=[{'all':!![]}];}return db[_0xbc43('0x2e')][_0xbc43('0x42')](_0x12b59e);})[_0xbc43('0x26')](function(_0x2a2a89){_0x16d8b9[_0xbc43('0x43')]=_0x2a2a89;return _0x16d8b9;})['then'](respondWithFilteredResult(_0x6d6d92,_0x12b59e))['catch'](handleError(_0x6d6d92,null));};exports[_0xbc43('0x44')]=function(_0x633fb1,_0x18ed6f){var _0x30e56e={'raw':![],'where':{'id':_0x633fb1[_0xbc43('0x45')]['id']}},_0x344ed4={};_0x344ed4['model']=_[_0xbc43('0x46')](db[_0xbc43('0x2e')][_0xbc43('0x2f')]);_0x344ed4[_0xbc43('0x33')]=_[_0xbc43('0x46')](_0x633fb1[_0xbc43('0x33')]);_0x344ed4[_0xbc43('0x3b')]=_[_0xbc43('0x34')](_0x344ed4[_0xbc43('0x32')],_0x344ed4['query']);_0x30e56e[_0xbc43('0x36')]=_['intersection'](_0x344ed4[_0xbc43('0x32')],qs[_0xbc43('0x35')](_0x633fb1['query'][_0xbc43('0x35')]));_0x30e56e[_0xbc43('0x36')]=_0x30e56e[_0xbc43('0x36')][_0xbc43('0x47')]?_0x30e56e[_0xbc43('0x36')]:_0x344ed4[_0xbc43('0x32')];if(_0x633fb1[_0xbc43('0x33')][_0xbc43('0x40')]){_0x30e56e[_0xbc43('0x41')]=[{'all':!![]}];}_0x30e56e=_[_0xbc43('0x3e')]({},_0x30e56e,_0x633fb1[_0xbc43('0x48')]);return db['SalesforceConfiguration']['find'](_0x30e56e)[_0xbc43('0x26')](handleEntityNotFound(_0x18ed6f,null))[_0xbc43('0x26')](respondWithResult(_0x18ed6f,null))['catch'](handleError(_0x18ed6f,null));};exports[_0xbc43('0x49')]=function(_0x51d257,_0x4493ff){return db[_0xbc43('0x2e')][_0xbc43('0x49')](_0x51d257[_0xbc43('0x4a')],{})[_0xbc43('0x26')](respondWithResult(_0x4493ff,0xc9))[_0xbc43('0x4b')](handleError(_0x4493ff,null));};exports[_0xbc43('0x25')]=function(_0x161404,_0x364433){if(_0x161404[_0xbc43('0x4a')]['id']){delete _0x161404[_0xbc43('0x4a')]['id'];}return db[_0xbc43('0x2e')][_0xbc43('0x4c')]({'where':{'id':_0x161404[_0xbc43('0x45')]['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x364433,null))[_0xbc43('0x26')](saveUpdates(_0x161404['body'],null))['then'](respondWithResult(_0x364433,null))[_0xbc43('0x4b')](handleError(_0x364433,null));};exports['destroy']=function(_0x3a64db,_0x3b88b3){return db[_0xbc43('0x2e')][_0xbc43('0x4c')]({'where':{'id':_0x3a64db[_0xbc43('0x45')]['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x3b88b3,null))[_0xbc43('0x26')](removeEntity(_0x3b88b3,null))[_0xbc43('0x4b')](handleError(_0x3b88b3,null));};exports[_0xbc43('0x4d')]=function(_0x38c91d,_0x3fcf05,_0x2a8082){var _0x190f16={};var _0x315ee0={};var _0x413725;var _0x502ff4;return db[_0xbc43('0x2e')]['findOne']({'where':{'id':_0x38c91d[_0xbc43('0x45')]['id']}})['then'](handleEntityNotFound(_0x3fcf05,null))['then'](function(_0x1949cd){if(_0x1949cd){_0x413725=_0x1949cd;_0x315ee0['model']=_[_0xbc43('0x46')](db[_0xbc43('0x4e')]['rawAttributes']);_0x315ee0[_0xbc43('0x33')]=_[_0xbc43('0x46')](_0x38c91d[_0xbc43('0x33')]);_0x315ee0[_0xbc43('0x3b')]=_[_0xbc43('0x34')](_0x315ee0[_0xbc43('0x32')],_0x315ee0[_0xbc43('0x33')]);_0x190f16[_0xbc43('0x36')]=_[_0xbc43('0x34')](_0x315ee0[_0xbc43('0x32')],qs[_0xbc43('0x35')](_0x38c91d[_0xbc43('0x33')][_0xbc43('0x35')]));_0x190f16[_0xbc43('0x36')]=_0x190f16[_0xbc43('0x36')][_0xbc43('0x47')]?_0x190f16[_0xbc43('0x36')]:_0x315ee0[_0xbc43('0x32')];_0x190f16[_0xbc43('0x4f')]=qs[_0xbc43('0x39')](_0x38c91d[_0xbc43('0x33')][_0xbc43('0x39')]);_0x190f16[_0xbc43('0x3a')]=qs[_0xbc43('0x3b')](_[_0xbc43('0x3c')](_0x38c91d[_0xbc43('0x33')],_0x315ee0[_0xbc43('0x3b')]));if(_0x38c91d[_0xbc43('0x33')][_0xbc43('0x3d')]){_0x190f16[_0xbc43('0x3a')]=_[_0xbc43('0x3e')](_0x190f16['where'],{'$or':_[_0xbc43('0x2d')](_0x190f16[_0xbc43('0x36')],function(_0x4ed0da){var _0x2637b8={};_0x2637b8[_0x4ed0da]={'$like':'%'+_0x38c91d[_0xbc43('0x33')][_0xbc43('0x3d')]+'%'};return _0x2637b8;})});}_0x190f16=_['merge']({},_0x190f16,_0x38c91d[_0xbc43('0x48')]);return _0x413725[_0xbc43('0x4d')](_0x190f16);}})[_0xbc43('0x26')](function(_0x428cb1){if(_0x428cb1){_0x502ff4=_0x428cb1['length'];if(!_0x38c91d['query']['hasOwnProperty']('nolimit')){_0x190f16['limit']=qs[_0xbc43('0x1f')](_0x38c91d[_0xbc43('0x33')][_0xbc43('0x1f')]);_0x190f16[_0xbc43('0x1e')]=qs[_0xbc43('0x1e')](_0x38c91d[_0xbc43('0x33')][_0xbc43('0x1e')]);}return _0x413725[_0xbc43('0x4d')](_0x190f16);}})[_0xbc43('0x26')](function(_0x2b4f0a){if(_0x2b4f0a){return _0x2b4f0a?{'count':_0x502ff4,'rows':_0x2b4f0a}:null;}})[_0xbc43('0x26')](respondWithResult(_0x3fcf05,null))[_0xbc43('0x4b')](handleError(_0x3fcf05,null));};exports[_0xbc43('0x50')]=function(_0x40b9a9,_0x1d032f,_0x150c0a){var _0x17bb8f={};var _0x529785={};var _0x76a285;var _0x55cd09;return db[_0xbc43('0x2e')]['findOne']({'where':{'id':_0x40b9a9[_0xbc43('0x45')]['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x1d032f,null))[_0xbc43('0x26')](function(_0x59a7a4){if(_0x59a7a4){_0x76a285=_0x59a7a4;_0x529785[_0xbc43('0x32')]=_[_0xbc43('0x46')](db[_0xbc43('0x4e')][_0xbc43('0x2f')]);_0x529785[_0xbc43('0x33')]=_[_0xbc43('0x46')](_0x40b9a9[_0xbc43('0x33')]);_0x529785[_0xbc43('0x3b')]=_[_0xbc43('0x34')](_0x529785['model'],_0x529785[_0xbc43('0x33')]);_0x17bb8f[_0xbc43('0x36')]=_[_0xbc43('0x34')](_0x529785[_0xbc43('0x32')],qs[_0xbc43('0x35')](_0x40b9a9['query']['fields']));_0x17bb8f['attributes']=_0x17bb8f[_0xbc43('0x36')][_0xbc43('0x47')]?_0x17bb8f[_0xbc43('0x36')]:_0x529785['model'];_0x17bb8f['order']=qs[_0xbc43('0x39')](_0x40b9a9[_0xbc43('0x33')][_0xbc43('0x39')]);_0x17bb8f[_0xbc43('0x3a')]=qs[_0xbc43('0x3b')](_[_0xbc43('0x3c')](_0x40b9a9['query'],_0x529785[_0xbc43('0x3b')]));if(_0x40b9a9[_0xbc43('0x33')][_0xbc43('0x3d')]){_0x17bb8f[_0xbc43('0x3a')]=_[_0xbc43('0x3e')](_0x17bb8f[_0xbc43('0x3a')],{'$or':_[_0xbc43('0x2d')](_0x17bb8f[_0xbc43('0x36')],function(_0x12e4f2){var _0x3ea1d0={};_0x3ea1d0[_0x12e4f2]={'$like':'%'+_0x40b9a9[_0xbc43('0x33')][_0xbc43('0x3d')]+'%'};return _0x3ea1d0;})});}_0x17bb8f=_[_0xbc43('0x3e')]({},_0x17bb8f,_0x40b9a9[_0xbc43('0x48')]);return _0x76a285['getSubjects'](_0x17bb8f);}})[_0xbc43('0x26')](function(_0x3dc861){if(_0x3dc861){_0x55cd09=_0x3dc861[_0xbc43('0x47')];if(!_0x40b9a9['query'][_0xbc43('0x37')](_0xbc43('0x38'))){_0x17bb8f[_0xbc43('0x1f')]=qs[_0xbc43('0x1f')](_0x40b9a9[_0xbc43('0x33')][_0xbc43('0x1f')]);_0x17bb8f['offset']=qs[_0xbc43('0x1e')](_0x40b9a9[_0xbc43('0x33')][_0xbc43('0x1e')]);}return _0x76a285['getSubjects'](_0x17bb8f);}})[_0xbc43('0x26')](function(_0x42fbe1){if(_0x42fbe1){return _0x42fbe1?{'count':_0x55cd09,'rows':_0x42fbe1}:null;}})[_0xbc43('0x26')](respondWithResult(_0x1d032f,null))['catch'](handleError(_0x1d032f,null));};exports[_0xbc43('0x51')]=function(_0x4c5c1d,_0x5d62ab,_0x17ec63){var _0x1bb891={};var _0x4e0413={};var _0x344e4f;var _0x26fee9;return db[_0xbc43('0x2e')][_0xbc43('0x52')]({'where':{'id':_0x4c5c1d['params']['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x5d62ab,null))['then'](function(_0x197983){if(_0x197983){_0x344e4f=_0x197983;_0x4e0413['model']=_[_0xbc43('0x46')](db[_0xbc43('0x4e')][_0xbc43('0x2f')]);_0x4e0413['query']=_[_0xbc43('0x46')](_0x4c5c1d['query']);_0x4e0413[_0xbc43('0x3b')]=_['intersection'](_0x4e0413[_0xbc43('0x32')],_0x4e0413['query']);_0x1bb891[_0xbc43('0x36')]=_[_0xbc43('0x34')](_0x4e0413[_0xbc43('0x32')],qs[_0xbc43('0x35')](_0x4c5c1d[_0xbc43('0x33')]['fields']));_0x1bb891[_0xbc43('0x36')]=_0x1bb891[_0xbc43('0x36')][_0xbc43('0x47')]?_0x1bb891[_0xbc43('0x36')]:_0x4e0413['model'];_0x1bb891[_0xbc43('0x4f')]=qs[_0xbc43('0x39')](_0x4c5c1d[_0xbc43('0x33')][_0xbc43('0x39')]);_0x1bb891['where']=qs['filters'](_[_0xbc43('0x3c')](_0x4c5c1d[_0xbc43('0x33')],_0x4e0413[_0xbc43('0x3b')]));if(_0x4c5c1d['query'][_0xbc43('0x3d')]){_0x1bb891[_0xbc43('0x3a')]=_['merge'](_0x1bb891[_0xbc43('0x3a')],{'$or':_[_0xbc43('0x2d')](_0x1bb891['attributes'],function(_0x24ea58){var _0x453562={};_0x453562[_0x24ea58]={'$like':'%'+_0x4c5c1d['query']['filter']+'%'};return _0x453562;})});}_0x1bb891=_[_0xbc43('0x3e')]({},_0x1bb891,_0x4c5c1d[_0xbc43('0x48')]);return _0x344e4f[_0xbc43('0x51')](_0x1bb891);}})[_0xbc43('0x26')](function(_0x825d05){if(_0x825d05){_0x26fee9=_0x825d05[_0xbc43('0x47')];if(!_0x4c5c1d[_0xbc43('0x33')][_0xbc43('0x37')](_0xbc43('0x38'))){_0x1bb891[_0xbc43('0x1f')]=qs[_0xbc43('0x1f')](_0x4c5c1d[_0xbc43('0x33')]['limit']);_0x1bb891[_0xbc43('0x1e')]=qs['offset'](_0x4c5c1d[_0xbc43('0x33')][_0xbc43('0x1e')]);}return _0x344e4f[_0xbc43('0x51')](_0x1bb891);}})[_0xbc43('0x26')](function(_0x28dc4f){if(_0x28dc4f){return _0x28dc4f?{'count':_0x26fee9,'rows':_0x28dc4f}:null;}})[_0xbc43('0x26')](respondWithResult(_0x5d62ab,null))[_0xbc43('0x4b')](handleError(_0x5d62ab,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fb6e5c1..bfdb789 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 _0x120c=['bluebird','request-promise','path','rimraf','define','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0x120c,0x180));var _0xc120=function(_0x2d6e18,_0x34ef7e){_0x2d6e18=_0x2d6e18-0x0;var _0x39bd86=_0x120c[_0x2d6e18];return _0x39bd86;};'use strict';var _=require(_0xc120('0x0'));var util=require(_0xc120('0x1'));var logger=require(_0xc120('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc120('0x3'));var rp=require(_0xc120('0x4'));var fs=require('fs');var path=require(_0xc120('0x5'));var rimraf=require(_0xc120('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x278984,_0x4f02fb){return _0x278984[_0xc120('0x7')]('SalesforceConfiguration',attributes,{'tableName':_0xc120('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf66=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3c8793,_0x1ad3a1){var _0x593da2=function(_0x51c0f6){while(--_0x51c0f6){_0x3c8793['push'](_0x3c8793['shift']());}};_0x593da2(++_0x1ad3a1);}(_0xbf66,0x7b));var _0x6bf6=function(_0x55cd70,_0x3aebcc){_0x55cd70=_0x55cd70-0x0;var _0x29db34=_0xbf66[_0x55cd70];return _0x29db34;};'use strict';var _=require(_0x6bf6('0x0'));var util=require('util');var logger=require(_0x6bf6('0x1'))(_0x6bf6('0x2'));var moment=require(_0x6bf6('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bf6('0x4'));var fs=require('fs');var path=require(_0x6bf6('0x5'));var rimraf=require(_0x6bf6('0x6'));var config=require(_0x6bf6('0x7'));var attributes=require(_0x6bf6('0x8'));module[_0x6bf6('0x9')]=function(_0x1fd304,_0x2d7632){return _0x1fd304[_0x6bf6('0xa')](_0x6bf6('0xb'),attributes,{'tableName':_0x6bf6('0xc'),'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 75817b8..0c1a34d 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 _0x901d=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x173f79,_0x3b2224){var _0x59ce8c=function(_0x4f317a){while(--_0x4f317a){_0x173f79['push'](_0x173f79['shift']());}};_0x59ce8c(++_0x3b2224);}(_0x901d,0x137));var _0xd901=function(_0x539dd0,_0x5635eb){_0x539dd0=_0x539dd0-0x0;var _0x2ce500=_0x901d[_0x539dd0];return _0x2ce500;};'use strict';var _=require(_0xd901('0x0'));var util=require(_0xd901('0x1'));var moment=require(_0xd901('0x2'));var BPromise=require(_0xd901('0x3'));var rs=require(_0xd901('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd901('0x5'))['db'];var utils=require(_0xd901('0x6'));var logger=require(_0xd901('0x7'))(_0xd901('0x8'));var config=require(_0xd901('0x9'));var jayson=require(_0xd901('0xa'));var client=jayson[_0xd901('0xb')][_0xd901('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fd953,_0x110079,_0x59aff8){return new BPromise(function(_0x16304f,_0x917322){return client[_0xd901('0xd')](_0x2fd953,_0x59aff8)[_0xd901('0xe')](function(_0x362a34){logger[_0xd901('0xf')](_0xd901('0x10'),_0x110079,_0xd901('0x11'));logger[_0xd901('0x12')](_0xd901('0x13'),_0x110079,'request\x20sent',JSON['stringify'](_0x362a34));if(_0x362a34[_0xd901('0x14')]){if(_0x362a34['error'][_0xd901('0x15')]===0x1f4){logger[_0xd901('0x14')](_0xd901('0x10'),_0x110079,_0x362a34['error']['message']);return _0x917322(_0x362a34[_0xd901('0x14')]['message']);}logger[_0xd901('0x14')](_0xd901('0x10'),_0x110079,_0x362a34[_0xd901('0x14')][_0xd901('0x16')]);return _0x16304f(_0x362a34[_0xd901('0x14')][_0xd901('0x16')]);}else{logger[_0xd901('0xf')](_0xd901('0x10'),_0x110079,'request\x20sent');_0x16304f(_0x362a34[_0xd901('0x17')][_0xd901('0x16')]);}})['catch'](function(_0x5f3975){logger[_0xd901('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x110079,_0x5f3975);_0x917322(_0x5f3975);});});} \ No newline at end of file +var _0x5146=['lodash','util','moment','ioredis','../../config/utils','rpc','client','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x5146,0x156));var _0x6514=function(_0x185de3,_0xf44cea){_0x185de3=_0x185de3-0x0;var _0x141f16=_0x5146[_0x185de3];return _0x141f16;};'use strict';var _=require(_0x6514('0x0'));var util=require(_0x6514('0x1'));var moment=require(_0x6514('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6514('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6514('0x4'));var logger=require('../../config/logger')(_0x6514('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6514('0x6')][_0x6514('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x466ef3,_0x7b9d55,_0xc13319){return new BPromise(function(_0x61b1f6,_0x1a9e6c){return client[_0x6514('0x8')](_0x466ef3,_0xc13319)[_0x6514('0x9')](function(_0x15d528){logger[_0x6514('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x7b9d55,'request\x20sent');logger[_0x6514('0xb')](_0x6514('0xc'),_0x7b9d55,_0x6514('0xd'),JSON['stringify'](_0x15d528));if(_0x15d528['error']){if(_0x15d528[_0x6514('0xe')]['code']===0x1f4){logger[_0x6514('0xe')](_0x6514('0xf'),_0x7b9d55,_0x15d528[_0x6514('0xe')]['message']);return _0x1a9e6c(_0x15d528[_0x6514('0xe')][_0x6514('0x10')]);}logger[_0x6514('0xe')](_0x6514('0xf'),_0x7b9d55,_0x15d528[_0x6514('0xe')][_0x6514('0x10')]);return _0x61b1f6(_0x15d528[_0x6514('0xe')][_0x6514('0x10')]);}else{logger[_0x6514('0xa')](_0x6514('0xf'),_0x7b9d55,'request\x20sent');_0x61b1f6(_0x15d528[_0x6514('0x11')][_0x6514('0x10')]);}})[_0x6514('0x12')](function(_0x2359ba){logger[_0x6514('0xe')](_0x6514('0xf'),_0x7b9d55,_0x2359ba);_0x1a9e6c(_0x2359ba);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2838770..13f1b7a 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 _0x3636=['destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','put','delete'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x3636,0x86));var _0x6363=function(_0x57acd0,_0x5c8d9f){_0x57acd0=_0x57acd0-0x0;var _0x2f1515=_0x3636[_0x57acd0];return _0x2f1515;};'use strict';var multer=require(_0x6363('0x0'));var util=require('util');var path=require(_0x6363('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6363('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6363('0x3'));var interaction=require(_0x6363('0x4'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x6363('0x5')]('/',auth[_0x6363('0x6')](),controller['index']);router[_0x6363('0x5')](_0x6363('0x7'),auth[_0x6363('0x6')](),controller['show']);router['post']('/',auth[_0x6363('0x6')](),controller['create']);router[_0x6363('0x8')](_0x6363('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x6363('0x9')](_0x6363('0x7'),auth[_0x6363('0x6')](),controller[_0x6363('0xa')]);module[_0x6363('0xb')]=router; \ No newline at end of file +var _0x9ac7=['multer','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','show','post','create'];(function(_0x1e69f2,_0x7a1a24){var _0x4d17a4=function(_0x243edd){while(--_0x243edd){_0x1e69f2['push'](_0x1e69f2['shift']());}};_0x4d17a4(++_0x7a1a24);}(_0x9ac7,0xd1));var _0x79ac=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9ac7[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x79ac('0x0'));var util=require(_0x79ac('0x1'));var path=require(_0x79ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x79ac('0x3'));var router=express['Router']();var fs_extra=require(_0x79ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x79ac('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x79ac('0x6')]('/',auth[_0x79ac('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x79ac('0x8')]);router[_0x79ac('0x9')]('/',auth[_0x79ac('0x7')](),controller[_0x79ac('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x79ac('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 93782d3..85171b8 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 _0x9406=['sequelize','exports','ENUM','string','keyValue','STRING','variable','customVariable'];(function(_0x1e6031,_0x50b48f){var _0xb6f5ce=function(_0x2cca85){while(--_0x2cca85){_0x1e6031['push'](_0x1e6031['shift']());}};_0xb6f5ce(++_0x50b48f);}(_0x9406,0xe0));var _0x6940=function(_0x1ba062,_0x5a1f40){_0x1ba062=_0x1ba062-0x0;var _0x226f84=_0x9406[_0x1ba062];return _0x226f84;};'use strict';var Sequelize=require(_0x6940('0x0'));module[_0x6940('0x1')]={'type':{'type':Sequelize[_0x6940('0x2')](_0x6940('0x3'),'variable','customVariable',_0x6940('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6940('0x5')]},'key':{'type':Sequelize[_0x6940('0x5')]},'keyType':{'type':Sequelize[_0x6940('0x2')](_0x6940('0x3'),_0x6940('0x6'),_0x6940('0x7'))},'keyContent':{'type':Sequelize[_0x6940('0x5')]},'idField':{'type':Sequelize[_0x6940('0x5')]},'variableName':{'type':Sequelize[_0x6940('0x5')]}}; \ No newline at end of file +var _0xd7ee=['string','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x451ca4,_0x316eb7){var _0x490f29=function(_0x2966cd){while(--_0x2966cd){_0x451ca4['push'](_0x451ca4['shift']());}};_0x490f29(++_0x316eb7);}(_0xd7ee,0x6d));var _0xed7e=function(_0x2503aa,_0x4ea0db){_0x2503aa=_0x2503aa-0x0;var _0x44f5e2=_0xd7ee[_0x2503aa];return _0x44f5e2;};'use strict';var Sequelize=require(_0xed7e('0x0'));module[_0xed7e('0x1')]={'type':{'type':Sequelize[_0xed7e('0x2')](_0xed7e('0x3'),'variable','customVariable',_0xed7e('0x4'),_0xed7e('0x5')),'defaultValue':_0xed7e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xed7e('0x6')]},'keyType':{'type':Sequelize[_0xed7e('0x2')](_0xed7e('0x3'),_0xed7e('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xed7e('0x6')]},'variableName':{'type':Sequelize[_0xed7e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d8f5fab..e9281a1 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 _0xd54c=['reject','update','then','name','index','map','SalesforceField','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd54c,0x1c1));var _0xcd54=function(_0xc440b2,_0x54f42d){_0xc440b2=_0xc440b2-0x0;var _0x3ff6b8=_0xd54c[_0xc440b2];return _0x3ff6b8;};'use strict';var emlformat=require(_0xcd54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd54('0x1'));var jsonpatch=require(_0xcd54('0x2'));var rp=require(_0xcd54('0x3'));var moment=require(_0xcd54('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd54('0x5'));var util=require(_0xcd54('0x6'));var path=require(_0xcd54('0x7'));var sox=require('sox');var csv=require(_0xcd54('0x8'));var ejs=require(_0xcd54('0x9'));var fs=require('fs');var fs_extra=require(_0xcd54('0xa'));var _=require(_0xcd54('0xb'));var squel=require(_0xcd54('0xc'));var crypto=require(_0xcd54('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcd54('0xe'));var toCsv=require(_0xcd54('0x8'));var querystring=require('querystring');var Papa=require(_0xcd54('0xf'));var Redis=require(_0xcd54('0x10'));var authService=require(_0xcd54('0x11'));var qs=require(_0xcd54('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd54('0x13'));var logger=require(_0xcd54('0x14'))('api');var utils=require(_0xcd54('0x15'));var config=require(_0xcd54('0x16'));var licenseUtil=require(_0xcd54('0x17'));var db=require(_0xcd54('0x18'))['db'];function respondWithStatusCode(_0x19e90a,_0x2b39d4){_0x2b39d4=_0x2b39d4||0xcc;return function(_0xb00a5c){if(_0xb00a5c){return _0x19e90a[_0xcd54('0x19')](_0x2b39d4);}return _0x19e90a['status'](_0x2b39d4)[_0xcd54('0x1a')]();};}function respondWithResult(_0x3ec75b,_0x1d32bd){_0x1d32bd=_0x1d32bd||0xc8;return function(_0x2605b8){if(_0x2605b8){return _0x3ec75b[_0xcd54('0x1b')](_0x1d32bd)[_0xcd54('0x1c')](_0x2605b8);}};}function respondWithFilteredResult(_0x4c4e02,_0x186c96){return function(_0x45a12f){if(_0x45a12f){var _0x476ed8=typeof _0x186c96[_0xcd54('0x1d')]==='undefined'&&typeof _0x186c96['limit']===_0xcd54('0x1e');var _0x4c332f=_0x45a12f['count'];var _0x31299d=_0x476ed8?0x0:_0x186c96[_0xcd54('0x1d')];var _0x56f245=_0x476ed8?_0x45a12f[_0xcd54('0x1f')]:_0x186c96[_0xcd54('0x1d')]+_0x186c96[_0xcd54('0x20')];var _0x551b3c;if(_0x56f245>=_0x4c332f){_0x56f245=_0x4c332f;_0x551b3c=0xc8;}else{_0x551b3c=0xce;}_0x4c4e02[_0xcd54('0x1b')](_0x551b3c);return _0x4c4e02['set'](_0xcd54('0x21'),_0x31299d+'-'+_0x56f245+'/'+_0x4c332f)[_0xcd54('0x1c')](_0x45a12f);}return null;};}function patchUpdates(_0x5d9e34){return function(_0x15571c){try{jsonpatch['apply'](_0x15571c,_0x5d9e34,!![]);}catch(_0xe2c664){return BPromise[_0xcd54('0x22')](_0xe2c664);}return _0x15571c['save']();};}function saveUpdates(_0x23c7d9,_0x4f6f2e){return function(_0x3fbd6f){if(_0x3fbd6f){return _0x3fbd6f[_0xcd54('0x23')](_0x23c7d9)[_0xcd54('0x24')](function(_0x4563d8){return _0x4563d8;});}return null;};}function removeEntity(_0x5b3a95,_0x26b325){return function(_0x37f33d){if(_0x37f33d){return _0x37f33d['destroy']()[_0xcd54('0x24')](function(){_0x5b3a95[_0xcd54('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bff3b,_0x3968dc){return function(_0x25b309){if(!_0x25b309){_0x3bff3b[_0xcd54('0x19')](0x194);}return _0x25b309;};}function handleError(_0x587ab5,_0x4953a8){_0x4953a8=_0x4953a8||0x1f4;return function(_0x1b8f1b){logger['error'](_0x1b8f1b['stack']);if(_0x1b8f1b['name']){delete _0x1b8f1b[_0xcd54('0x25')];}_0x587ab5[_0xcd54('0x1b')](_0x4953a8)['send'](_0x1b8f1b);};}exports[_0xcd54('0x26')]=function(_0xebf3c3,_0x5d69d8){var _0x35d5cf={},_0x1bef8b={},_0x12c753={'count':0x0,'rows':[]};var _0x159d5b=_[_0xcd54('0x27')](db[_0xcd54('0x28')]['rawAttributes'],function(_0x76076d){return{'name':_0x76076d['fieldName'],'type':_0x76076d[_0xcd54('0x29')][_0xcd54('0x2a')]};});_0x1bef8b[_0xcd54('0x2b')]=_[_0xcd54('0x27')](_0x159d5b,_0xcd54('0x25'));_0x1bef8b[_0xcd54('0x2c')]=_[_0xcd54('0x2d')](_0xebf3c3[_0xcd54('0x2c')]);_0x1bef8b['filters']=_[_0xcd54('0x2e')](_0x1bef8b[_0xcd54('0x2b')],_0x1bef8b[_0xcd54('0x2c')]);_0x35d5cf[_0xcd54('0x2f')]=_['intersection'](_0x1bef8b[_0xcd54('0x2b')],qs[_0xcd54('0x30')](_0xebf3c3[_0xcd54('0x2c')][_0xcd54('0x30')]));_0x35d5cf[_0xcd54('0x2f')]=_0x35d5cf[_0xcd54('0x2f')][_0xcd54('0x31')]?_0x35d5cf[_0xcd54('0x2f')]:_0x1bef8b[_0xcd54('0x2b')];if(!_0xebf3c3[_0xcd54('0x2c')][_0xcd54('0x32')]('nolimit')){_0x35d5cf[_0xcd54('0x20')]=qs[_0xcd54('0x20')](_0xebf3c3[_0xcd54('0x2c')][_0xcd54('0x20')]);_0x35d5cf[_0xcd54('0x1d')]=qs[_0xcd54('0x1d')](_0xebf3c3[_0xcd54('0x2c')][_0xcd54('0x1d')]);}_0x35d5cf['order']=qs[_0xcd54('0x33')](_0xebf3c3[_0xcd54('0x2c')][_0xcd54('0x33')]);_0x35d5cf[_0xcd54('0x34')]=qs[_0xcd54('0x35')](_['pick'](_0xebf3c3['query'],_0x1bef8b[_0xcd54('0x35')]),_0x159d5b);if(_0xebf3c3[_0xcd54('0x2c')][_0xcd54('0x36')]){_0x35d5cf['where']=_[_0xcd54('0x37')](_0x35d5cf[_0xcd54('0x34')],{'$or':_[_0xcd54('0x27')](_0x159d5b,function(_0x2d5e85){if(_0x2d5e85[_0xcd54('0x29')]!=='VIRTUAL'){var _0xe99492={};_0xe99492[_0x2d5e85[_0xcd54('0x25')]]={'$like':'%'+_0xebf3c3['query']['filter']+'%'};return _0xe99492;}})});}_0x35d5cf=_[_0xcd54('0x37')]({},_0x35d5cf,_0xebf3c3['options']);var _0x2982fe={'where':_0x35d5cf[_0xcd54('0x34')]};return db[_0xcd54('0x28')][_0xcd54('0x1f')](_0x2982fe)[_0xcd54('0x24')](function(_0x1f38eb){_0x12c753[_0xcd54('0x1f')]=_0x1f38eb;if(_0xebf3c3[_0xcd54('0x2c')][_0xcd54('0x38')]){_0x35d5cf[_0xcd54('0x39')]=[{'all':!![]}];}return db[_0xcd54('0x28')][_0xcd54('0x3a')](_0x35d5cf);})[_0xcd54('0x24')](function(_0xc6c330){_0x12c753[_0xcd54('0x3b')]=_0xc6c330;return _0x12c753;})['then'](respondWithFilteredResult(_0x5d69d8,_0x35d5cf))[_0xcd54('0x3c')](handleError(_0x5d69d8,null));};exports[_0xcd54('0x3d')]=function(_0x9498e,_0x5d43c9){var _0x372310={'raw':!![],'where':{'id':_0x9498e[_0xcd54('0x3e')]['id']}},_0x13edb4={};_0x13edb4[_0xcd54('0x2b')]=_['keys'](db[_0xcd54('0x28')][_0xcd54('0x3f')]);_0x13edb4[_0xcd54('0x2c')]=_['keys'](_0x9498e[_0xcd54('0x2c')]);_0x13edb4[_0xcd54('0x35')]=_['intersection'](_0x13edb4[_0xcd54('0x2b')],_0x13edb4['query']);_0x372310[_0xcd54('0x2f')]=_[_0xcd54('0x2e')](_0x13edb4[_0xcd54('0x2b')],qs[_0xcd54('0x30')](_0x9498e[_0xcd54('0x2c')]['fields']));_0x372310['attributes']=_0x372310['attributes'][_0xcd54('0x31')]?_0x372310['attributes']:_0x13edb4[_0xcd54('0x2b')];if(_0x9498e[_0xcd54('0x2c')][_0xcd54('0x38')]){_0x372310[_0xcd54('0x39')]=[{'all':!![]}];}_0x372310=_[_0xcd54('0x37')]({},_0x372310,_0x9498e[_0xcd54('0x40')]);return db[_0xcd54('0x28')][_0xcd54('0x41')](_0x372310)[_0xcd54('0x24')](handleEntityNotFound(_0x5d43c9,null))[_0xcd54('0x24')](respondWithResult(_0x5d43c9,null))[_0xcd54('0x3c')](handleError(_0x5d43c9,null));};exports[_0xcd54('0x42')]=function(_0x4eb250,_0x5f3d94){return db['SalesforceField'][_0xcd54('0x42')](_0x4eb250[_0xcd54('0x43')],{})[_0xcd54('0x24')](respondWithResult(_0x5f3d94,0xc9))[_0xcd54('0x3c')](handleError(_0x5f3d94,null));};exports[_0xcd54('0x23')]=function(_0x5d6e2c,_0x304f8a){if(_0x5d6e2c[_0xcd54('0x43')]['id']){delete _0x5d6e2c[_0xcd54('0x43')]['id'];}return db[_0xcd54('0x28')]['find']({'where':{'id':_0x5d6e2c[_0xcd54('0x3e')]['id']}})[_0xcd54('0x24')](handleEntityNotFound(_0x304f8a,null))[_0xcd54('0x24')](saveUpdates(_0x5d6e2c[_0xcd54('0x43')],null))[_0xcd54('0x24')](respondWithResult(_0x304f8a,null))[_0xcd54('0x3c')](handleError(_0x304f8a,null));};exports[_0xcd54('0x44')]=function(_0x1fcb47,_0x285e7d){return db['SalesforceField'][_0xcd54('0x41')]({'where':{'id':_0x1fcb47[_0xcd54('0x3e')]['id']}})[_0xcd54('0x24')](handleEntityNotFound(_0x285e7d,null))[_0xcd54('0x24')](removeEntity(_0x285e7d,null))[_0xcd54('0x3c')](handleError(_0x285e7d,null));}; \ No newline at end of file +var _0x91a7=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','map','SalesforceField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','findAll','rows','catch','params','keys','include','find','create','body','update','eml-format','rimraf','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x50451f,_0x57f99e){var _0x4beb6d=function(_0x180822){while(--_0x180822){_0x50451f['push'](_0x50451f['shift']());}};_0x4beb6d(++_0x57f99e);}(_0x91a7,0x19a));var _0x791a=function(_0x3aa0f4,_0x49fa72){_0x3aa0f4=_0x3aa0f4-0x0;var _0x3ce03e=_0x91a7[_0x3aa0f4];return _0x3ce03e;};'use strict';var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x2'));var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x4'));var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require(_0x791a('0x7'));var fs=require('fs');var fs_extra=require(_0x791a('0x8'));var _=require('lodash');var squel=require(_0x791a('0x9'));var crypto=require(_0x791a('0xa'));var jsforce=require(_0x791a('0xb'));var deskjs=require(_0x791a('0xc'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xd'));var Papa=require(_0x791a('0xe'));var Redis=require(_0x791a('0xf'));var authService=require(_0x791a('0x10'));var qs=require(_0x791a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x791a('0x12'));var logger=require(_0x791a('0x13'))(_0x791a('0x14'));var utils=require(_0x791a('0x15'));var config=require(_0x791a('0x16'));var licenseUtil=require(_0x791a('0x17'));var db=require(_0x791a('0x18'))['db'];function respondWithStatusCode(_0x261c09,_0x1dff17){_0x1dff17=_0x1dff17||0xcc;return function(_0x422126){if(_0x422126){return _0x261c09[_0x791a('0x19')](_0x1dff17);}return _0x261c09['status'](_0x1dff17)[_0x791a('0x1a')]();};}function respondWithResult(_0x1471cd,_0x257812){_0x257812=_0x257812||0xc8;return function(_0x4d606c){if(_0x4d606c){return _0x1471cd[_0x791a('0x1b')](_0x257812)[_0x791a('0x1c')](_0x4d606c);}};}function respondWithFilteredResult(_0x129c61,_0x568979){return function(_0x43745b){if(_0x43745b){var _0x123345=typeof _0x568979[_0x791a('0x1d')]==='undefined'&&typeof _0x568979[_0x791a('0x1e')]==='undefined';var _0x50d24c=_0x43745b['count'];var _0x52fea6=_0x123345?0x0:_0x568979[_0x791a('0x1d')];var _0x323c0a=_0x123345?_0x43745b[_0x791a('0x1f')]:_0x568979[_0x791a('0x1d')]+_0x568979[_0x791a('0x1e')];var _0x393217;if(_0x323c0a>=_0x50d24c){_0x323c0a=_0x50d24c;_0x393217=0xc8;}else{_0x393217=0xce;}_0x129c61[_0x791a('0x1b')](_0x393217);return _0x129c61['set'](_0x791a('0x20'),_0x52fea6+'-'+_0x323c0a+'/'+_0x50d24c)[_0x791a('0x1c')](_0x43745b);}return null;};}function patchUpdates(_0x468080){return function(_0x4ba7c8){try{jsonpatch[_0x791a('0x21')](_0x4ba7c8,_0x468080,!![]);}catch(_0x15d435){return BPromise[_0x791a('0x22')](_0x15d435);}return _0x4ba7c8[_0x791a('0x23')]();};}function saveUpdates(_0x24a5a8,_0x4b22de){return function(_0x2435fd){if(_0x2435fd){return _0x2435fd['update'](_0x24a5a8)[_0x791a('0x24')](function(_0x49b0a5){return _0x49b0a5;});}return null;};}function removeEntity(_0x3869de,_0x2ab3de){return function(_0x1f41b9){if(_0x1f41b9){return _0x1f41b9[_0x791a('0x25')]()['then'](function(){_0x3869de[_0x791a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fbe4e,_0x35cd14){return function(_0x5d084f){if(!_0x5d084f){_0x4fbe4e['sendStatus'](0x194);}return _0x5d084f;};}function handleError(_0xd9d026,_0x4734d3){_0x4734d3=_0x4734d3||0x1f4;return function(_0x519d7f){logger[_0x791a('0x26')](_0x519d7f['stack']);if(_0x519d7f['name']){delete _0x519d7f[_0x791a('0x27')];}_0xd9d026[_0x791a('0x1b')](_0x4734d3)[_0x791a('0x28')](_0x519d7f);};}exports['index']=function(_0x5c8ebc,_0x121454){var _0x273c65={},_0x29556b={},_0x42358a={'count':0x0,'rows':[]};var _0x2b247e=_[_0x791a('0x29')](db[_0x791a('0x2a')][_0x791a('0x2b')],function(_0x16c3b){return{'name':_0x16c3b[_0x791a('0x2c')],'type':_0x16c3b[_0x791a('0x2d')]['key']};});_0x29556b[_0x791a('0x2e')]=_[_0x791a('0x29')](_0x2b247e,_0x791a('0x27'));_0x29556b[_0x791a('0x2f')]=_['keys'](_0x5c8ebc[_0x791a('0x2f')]);_0x29556b[_0x791a('0x30')]=_[_0x791a('0x31')](_0x29556b[_0x791a('0x2e')],_0x29556b[_0x791a('0x2f')]);_0x273c65['attributes']=_[_0x791a('0x31')](_0x29556b['model'],qs[_0x791a('0x32')](_0x5c8ebc['query'][_0x791a('0x32')]));_0x273c65['attributes']=_0x273c65['attributes'][_0x791a('0x33')]?_0x273c65[_0x791a('0x34')]:_0x29556b[_0x791a('0x2e')];if(!_0x5c8ebc[_0x791a('0x2f')][_0x791a('0x35')](_0x791a('0x36'))){_0x273c65[_0x791a('0x1e')]=qs[_0x791a('0x1e')](_0x5c8ebc[_0x791a('0x2f')][_0x791a('0x1e')]);_0x273c65[_0x791a('0x1d')]=qs[_0x791a('0x1d')](_0x5c8ebc[_0x791a('0x2f')][_0x791a('0x1d')]);}_0x273c65[_0x791a('0x37')]=qs[_0x791a('0x38')](_0x5c8ebc[_0x791a('0x2f')][_0x791a('0x38')]);_0x273c65[_0x791a('0x39')]=qs['filters'](_[_0x791a('0x3a')](_0x5c8ebc[_0x791a('0x2f')],_0x29556b[_0x791a('0x30')]),_0x2b247e);if(_0x5c8ebc[_0x791a('0x2f')]['filter']){_0x273c65[_0x791a('0x39')]=_['merge'](_0x273c65[_0x791a('0x39')],{'$or':_[_0x791a('0x29')](_0x2b247e,function(_0x322388){if(_0x322388[_0x791a('0x2d')]!==_0x791a('0x3b')){var _0x4e6653={};_0x4e6653[_0x322388[_0x791a('0x27')]]={'$like':'%'+_0x5c8ebc[_0x791a('0x2f')]['filter']+'%'};return _0x4e6653;}})});}_0x273c65=_[_0x791a('0x3c')]({},_0x273c65,_0x5c8ebc[_0x791a('0x3d')]);var _0x393a96={'where':_0x273c65[_0x791a('0x39')]};return db[_0x791a('0x2a')][_0x791a('0x1f')](_0x393a96)[_0x791a('0x24')](function(_0xcc6e0){_0x42358a[_0x791a('0x1f')]=_0xcc6e0;if(_0x5c8ebc[_0x791a('0x2f')]['includeAll']){_0x273c65['include']=[{'all':!![]}];}return db[_0x791a('0x2a')][_0x791a('0x3e')](_0x273c65);})['then'](function(_0x34c6b6){_0x42358a[_0x791a('0x3f')]=_0x34c6b6;return _0x42358a;})['then'](respondWithFilteredResult(_0x121454,_0x273c65))[_0x791a('0x40')](handleError(_0x121454,null));};exports['show']=function(_0x366405,_0x57e482){var _0x137fdd={'raw':!![],'where':{'id':_0x366405[_0x791a('0x41')]['id']}},_0x4421fe={};_0x4421fe[_0x791a('0x2e')]=_[_0x791a('0x42')](db['SalesforceField'][_0x791a('0x2b')]);_0x4421fe[_0x791a('0x2f')]=_['keys'](_0x366405[_0x791a('0x2f')]);_0x4421fe[_0x791a('0x30')]=_['intersection'](_0x4421fe[_0x791a('0x2e')],_0x4421fe[_0x791a('0x2f')]);_0x137fdd['attributes']=_[_0x791a('0x31')](_0x4421fe[_0x791a('0x2e')],qs['fields'](_0x366405[_0x791a('0x2f')][_0x791a('0x32')]));_0x137fdd['attributes']=_0x137fdd[_0x791a('0x34')][_0x791a('0x33')]?_0x137fdd['attributes']:_0x4421fe['model'];if(_0x366405[_0x791a('0x2f')]['includeAll']){_0x137fdd[_0x791a('0x43')]=[{'all':!![]}];}_0x137fdd=_[_0x791a('0x3c')]({},_0x137fdd,_0x366405[_0x791a('0x3d')]);return db[_0x791a('0x2a')][_0x791a('0x44')](_0x137fdd)['then'](handleEntityNotFound(_0x57e482,null))['then'](respondWithResult(_0x57e482,null))[_0x791a('0x40')](handleError(_0x57e482,null));};exports['create']=function(_0x2fa48c,_0x268b08){return db[_0x791a('0x2a')][_0x791a('0x45')](_0x2fa48c[_0x791a('0x46')],{})[_0x791a('0x24')](respondWithResult(_0x268b08,0xc9))[_0x791a('0x40')](handleError(_0x268b08,null));};exports[_0x791a('0x47')]=function(_0x51f763,_0x53535e){if(_0x51f763[_0x791a('0x46')]['id']){delete _0x51f763[_0x791a('0x46')]['id'];}return db[_0x791a('0x2a')][_0x791a('0x44')]({'where':{'id':_0x51f763['params']['id']}})['then'](handleEntityNotFound(_0x53535e,null))['then'](saveUpdates(_0x51f763[_0x791a('0x46')],null))[_0x791a('0x24')](respondWithResult(_0x53535e,null))[_0x791a('0x40')](handleError(_0x53535e,null));};exports[_0x791a('0x25')]=function(_0x2f41e4,_0x70c6f6){return db['SalesforceField'][_0x791a('0x44')]({'where':{'id':_0x2f41e4['params']['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x70c6f6,null))[_0x791a('0x24')](removeEntity(_0x70c6f6,null))[_0x791a('0x40')](handleError(_0x70c6f6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9f63d38..2ca77ba 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 _0xd0e0=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','int_salesforce_fields','salesforce_unique_index','FieldId'];(function(_0x353730,_0x504fdf){var _0x901b87=function(_0x3adf24){while(--_0x3adf24){_0x353730['push'](_0x353730['shift']());}};_0x901b87(++_0x504fdf);}(_0xd0e0,0xb6));var _0x0d0e=function(_0x13f335,_0x49f649){_0x13f335=_0x13f335-0x0;var _0x1932d5=_0xd0e0[_0x13f335];return _0x1932d5;};'use strict';var _=require(_0x0d0e('0x0'));var util=require('util');var logger=require(_0x0d0e('0x1'))(_0x0d0e('0x2'));var moment=require(_0x0d0e('0x3'));var BPromise=require(_0x0d0e('0x4'));var rp=require(_0x0d0e('0x5'));var fs=require('fs');var path=require(_0x0d0e('0x6'));var rimraf=require(_0x0d0e('0x7'));var config=require(_0x0d0e('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x0d0e('0x9')]=function(_0x56e3c1,_0x319783){return _0x56e3c1['define']('SalesforceField',attributes,{'tableName':_0x0d0e('0xa'),'paranoid':![],'indexes':[{'name':_0x0d0e('0xb'),'fields':['idField',_0x0d0e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd93c=['int_salesforce_fields','salesforce_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','SalesforceField'];(function(_0x24d579,_0x4f0b9f){var _0x32ad64=function(_0x4fe902){while(--_0x4fe902){_0x24d579['push'](_0x24d579['shift']());}};_0x32ad64(++_0x4f0b9f);}(_0xd93c,0x18b));var _0xcd93=function(_0x4a9533,_0x33e1ac){_0x4a9533=_0x4a9533-0x0;var _0x20d0cb=_0xd93c[_0x4a9533];return _0x20d0cb;};'use strict';var _=require('lodash');var util=require(_0xcd93('0x0'));var logger=require(_0xcd93('0x1'))(_0xcd93('0x2'));var moment=require(_0xcd93('0x3'));var BPromise=require(_0xcd93('0x4'));var rp=require(_0xcd93('0x5'));var fs=require('fs');var path=require(_0xcd93('0x6'));var rimraf=require(_0xcd93('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd93('0x8'));module[_0xcd93('0x9')]=function(_0x23794d,_0x31522a){return _0x23794d['define'](_0xcd93('0xa'),attributes,{'tableName':_0xcd93('0xb'),'paranoid':![],'indexes':[{'name':_0xcd93('0xc'),'fields':['idField',_0xcd93('0xd')],'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 b7ae85a..f08caac 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 _0xd915=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment'];(function(_0x2fd898,_0x216b7d){var _0xaca540=function(_0x9b5359){while(--_0x9b5359){_0x2fd898['push'](_0x2fd898['shift']());}};_0xaca540(++_0x216b7d);}(_0xd915,0x1dd));var _0x5d91=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd915[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5d91('0x0'));var util=require(_0x5d91('0x1'));var moment=require(_0x5d91('0x2'));var BPromise=require(_0x5d91('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d91('0x4'));var db=require(_0x5d91('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5d91('0x6'));var config=require(_0x5d91('0x7'));var jayson=require(_0x5d91('0x8'));var client=jayson[_0x5d91('0x9')][_0x5d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x762717,_0x16d7c5,_0x4abb18){return new BPromise(function(_0x61e610,_0xb4c2e5){return client['request'](_0x762717,_0x4abb18)[_0x5d91('0xb')](function(_0x3d0387){logger[_0x5d91('0xc')](_0x5d91('0xd'),_0x16d7c5,_0x5d91('0xe'));logger['debug'](_0x5d91('0xf'),_0x16d7c5,_0x5d91('0xe'),JSON['stringify'](_0x3d0387));if(_0x3d0387['error']){if(_0x3d0387[_0x5d91('0x10')][_0x5d91('0x11')]===0x1f4){logger[_0x5d91('0x10')](_0x5d91('0xd'),_0x16d7c5,_0x3d0387[_0x5d91('0x10')]['message']);return _0xb4c2e5(_0x3d0387[_0x5d91('0x10')][_0x5d91('0x12')]);}logger[_0x5d91('0x10')](_0x5d91('0xd'),_0x16d7c5,_0x3d0387[_0x5d91('0x10')]['message']);return _0x61e610(_0x3d0387[_0x5d91('0x10')][_0x5d91('0x12')]);}else{logger[_0x5d91('0xc')](_0x5d91('0xd'),_0x16d7c5,_0x5d91('0xe'));_0x61e610(_0x3d0387['result'][_0x5d91('0x12')]);}})[_0x5d91('0x13')](function(_0x3f2317){logger[_0x5d91('0x10')]('SalesforceField,\x20%s,\x20%s',_0x16d7c5,_0x3f2317);_0xb4c2e5(_0x3f2317);});});} \ No newline at end of file +var _0x89a9=['info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x89a9,0x18e));var _0x989a=function(_0x418508,_0x583dd0){_0x418508=_0x418508-0x0;var _0x2f1588=_0x89a9[_0x418508];return _0x2f1588;};'use strict';var _=require(_0x989a('0x0'));var util=require(_0x989a('0x1'));var moment=require(_0x989a('0x2'));var BPromise=require(_0x989a('0x3'));var rs=require(_0x989a('0x4'));var fs=require('fs');var Redis=require(_0x989a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x989a('0x6'));var logger=require(_0x989a('0x7'))(_0x989a('0x8'));var config=require(_0x989a('0x9'));var jayson=require(_0x989a('0xa'));var client=jayson[_0x989a('0xb')][_0x989a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f87df,_0x34394d,_0x58ce34){return new BPromise(function(_0x43af79,_0xfdcf86){return client[_0x989a('0xd')](_0x2f87df,_0x58ce34)['then'](function(_0x2bd858){logger['info'](_0x989a('0xe'),_0x34394d,_0x989a('0xf'));logger[_0x989a('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x34394d,_0x989a('0xf'),JSON['stringify'](_0x2bd858));if(_0x2bd858[_0x989a('0x11')]){if(_0x2bd858[_0x989a('0x11')][_0x989a('0x12')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x34394d,_0x2bd858['error']['message']);return _0xfdcf86(_0x2bd858['error'][_0x989a('0x13')]);}logger[_0x989a('0x11')](_0x989a('0xe'),_0x34394d,_0x2bd858['error'][_0x989a('0x13')]);return _0x43af79(_0x2bd858[_0x989a('0x11')][_0x989a('0x13')]);}else{logger[_0x989a('0x14')](_0x989a('0xe'),_0x34394d,_0x989a('0xf'));_0x43af79(_0x2bd858['result'][_0x989a('0x13')]);}})[_0x989a('0x15')](function(_0x2c19cf){logger[_0x989a('0x11')](_0x989a('0xe'),_0x34394d,_0x2c19cf);_0xfdcf86(_0x2c19cf);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index db654b1..a6b2881 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 _0xbc61=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update'];(function(_0xa0dd9a,_0xa3fa57){var _0x1a2392=function(_0x54ed42){while(--_0x54ed42){_0xa0dd9a['push'](_0xa0dd9a['shift']());}};_0x1a2392(++_0xa3fa57);}(_0xbc61,0xdc));var _0x1bc6=function(_0x61c691,_0xdaeb1d){_0x61c691=_0x61c691-0x0;var _0x2f3976=_0xbc61[_0x61c691];return _0x2f3976;};'use strict';var multer=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var path=require(_0x1bc6('0x2'));var timeout=require(_0x1bc6('0x3'));var express=require(_0x1bc6('0x4'));var router=express[_0x1bc6('0x5')]();var fs_extra=require(_0x1bc6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1bc6('0x7'));var config=require(_0x1bc6('0x8'));var controller=require(_0x1bc6('0x9'));router[_0x1bc6('0xa')]('/',auth[_0x1bc6('0xb')](),controller[_0x1bc6('0xc')]);router[_0x1bc6('0xa')]('/:id',auth[_0x1bc6('0xb')](),controller[_0x1bc6('0xd')]);router['get'](_0x1bc6('0xe'),auth[_0x1bc6('0xb')](),controller[_0x1bc6('0xf')]);router[_0x1bc6('0xa')](_0x1bc6('0x10'),auth['isAuthenticated'](),controller[_0x1bc6('0x11')]);router[_0x1bc6('0x12')]('/',auth['isAuthenticated'](),controller[_0x1bc6('0x13')]);router[_0x1bc6('0x12')](_0x1bc6('0xe'),auth['isAuthenticated'](),controller[_0x1bc6('0x14')]);router[_0x1bc6('0x15')]('/:id',auth[_0x1bc6('0xb')](),controller[_0x1bc6('0x16')]);router[_0x1bc6('0x17')](_0x1bc6('0x18'),auth[_0x1bc6('0xb')](),controller[_0x1bc6('0x19')]);module[_0x1bc6('0x1a')]=router; \ No newline at end of file +var _0x4dcb=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put'];(function(_0x16fa23,_0x4bfa6b){var _0xba7e8e=function(_0x2ff52b){while(--_0x2ff52b){_0x16fa23['push'](_0x16fa23['shift']());}};_0xba7e8e(++_0x4bfa6b);}(_0x4dcb,0x153));var _0xb4dc=function(_0x2d49a4,_0x2b4c39){_0x2d49a4=_0x2d49a4-0x0;var _0x52b598=_0x4dcb[_0x2d49a4];return _0x52b598;};'use strict';var multer=require(_0xb4dc('0x0'));var util=require(_0xb4dc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb4dc('0x2'));var router=express[_0xb4dc('0x3')]();var fs_extra=require(_0xb4dc('0x4'));var auth=require(_0xb4dc('0x5'));var interaction=require(_0xb4dc('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xb4dc('0x7')]('/',auth['isAuthenticated'](),controller[_0xb4dc('0x8')]);router['get'](_0xb4dc('0x9'),auth[_0xb4dc('0xa')](),controller[_0xb4dc('0xb')]);router[_0xb4dc('0x7')]('/:id/configurations',auth[_0xb4dc('0xa')](),controller[_0xb4dc('0xc')]);router['get']('/:id/fields',auth[_0xb4dc('0xa')](),controller['getFields']);router[_0xb4dc('0xd')]('/',auth[_0xb4dc('0xa')](),controller[_0xb4dc('0xe')]);router[_0xb4dc('0xd')](_0xb4dc('0xf'),auth[_0xb4dc('0xa')](),controller[_0xb4dc('0x10')]);router[_0xb4dc('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb4dc('0x12')](_0xb4dc('0x9'),auth[_0xb4dc('0xa')](),controller[_0xb4dc('0x13')]);module[_0xb4dc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ef9774d..57f8928 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 _0x777c=['username','remoteUri','STRING'];(function(_0x281062,_0x3eb225){var _0x4becc5=function(_0x37118b){while(--_0x37118b){_0x281062['push'](_0x281062['shift']());}};_0x4becc5(++_0x3eb225);}(_0x777c,0x1c7));var _0xc777=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x777c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc777('0x0')]},'description':{'type':Sequelize[_0xc777('0x0')]},'username':{'type':Sequelize[_0xc777('0x0')],'unique':_0xc777('0x1')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc777('0x0')],'unique':_0xc777('0x2')},'serverUrl':{'type':Sequelize[_0xc777('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x6919=['remoteUri','sequelize','STRING','username'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x6919,0x125));var _0x9691=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x6919[_0xad57ee];return _0x3eaea9;};'use strict';var Sequelize=require(_0x9691('0x0'));module['exports']={'name':{'type':Sequelize[_0x9691('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9691('0x1')],'unique':_0x9691('0x2')},'password':{'type':Sequelize[_0x9691('0x1')]},'email':{'type':Sequelize[_0x9691('0x1')]},'remoteUri':{'type':Sequelize[_0x9691('0x1')],'unique':_0x9691('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7cfbe5f..3495820 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 _0x87ad=['addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','severity','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','ServiceNow\x20error:\x20','test','statusCode','boolean','True','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','ServicenowAccount','include','findAll','rows','show','params','keys','includeAll','catch','create','body','find','getConfigurations','findOne','ServicenowConfiguration','pick'];(function(_0x2f9fae,_0x1705c6){var _0x1d17e2=function(_0x2ec4f0){while(--_0x2ec4f0){_0x2f9fae['push'](_0x2f9fae['shift']());}};_0x1d17e2(++_0x1705c6);}(_0x87ad,0x1e1));var _0xd87a=function(_0x454a61,_0x4ccd0f){_0x454a61=_0x454a61-0x0;var _0xad597=_0x87ad[_0x454a61];return _0xad597;};'use strict';var emlformat=require(_0xd87a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd87a('0x1'));var jsonpatch=require(_0xd87a('0x2'));var rp=require('request-promise');var moment=require(_0xd87a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd87a('0x4'));var util=require(_0xd87a('0x5'));var path=require(_0xd87a('0x6'));var sox=require(_0xd87a('0x7'));var csv=require(_0xd87a('0x8'));var ejs=require(_0xd87a('0x9'));var fs=require('fs');var fs_extra=require(_0xd87a('0xa'));var _=require(_0xd87a('0xb'));var squel=require(_0xd87a('0xc'));var crypto=require('crypto');var jsforce=require(_0xd87a('0xd'));var deskjs=require(_0xd87a('0xe'));var toCsv=require(_0xd87a('0x8'));var querystring=require('querystring');var Papa=require(_0xd87a('0xf'));var Redis=require(_0xd87a('0x10'));var authService=require(_0xd87a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd87a('0x12'));var hardwareService=require(_0xd87a('0x13'));var logger=require(_0xd87a('0x14'))(_0xd87a('0x15'));var utils=require(_0xd87a('0x16'));var config=require(_0xd87a('0x17'));var licenseUtil=require(_0xd87a('0x18'));var db=require(_0xd87a('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xaca72d,_0x62b17a){_0x62b17a=_0x62b17a||0xcc;return function(_0x3e6939){if(_0x3e6939){return _0xaca72d[_0xd87a('0x1a')](_0x62b17a);}return _0xaca72d['status'](_0x62b17a)[_0xd87a('0x1b')]();};}function respondWithResult(_0x54ae95,_0xd65249){_0xd65249=_0xd65249||0xc8;return function(_0x459b75){if(_0x459b75){return _0x54ae95[_0xd87a('0x1c')](_0xd65249)['json'](_0x459b75);}};}function respondWithFilteredResult(_0x1fd070,_0xe82394){return function(_0x1a4d34){if(_0x1a4d34){var _0x5a56c8=typeof _0xe82394[_0xd87a('0x1d')]===_0xd87a('0x1e')&&typeof _0xe82394[_0xd87a('0x1f')]===_0xd87a('0x1e');var _0x463f43=_0x1a4d34[_0xd87a('0x20')];var _0x4642f9=_0x5a56c8?0x0:_0xe82394[_0xd87a('0x1d')];var _0x411b50=_0x5a56c8?_0x1a4d34[_0xd87a('0x20')]:_0xe82394['offset']+_0xe82394[_0xd87a('0x1f')];var _0x362c35;if(_0x411b50>=_0x463f43){_0x411b50=_0x463f43;_0x362c35=0xc8;}else{_0x362c35=0xce;}_0x1fd070[_0xd87a('0x1c')](_0x362c35);return _0x1fd070['set'](_0xd87a('0x21'),_0x4642f9+'-'+_0x411b50+'/'+_0x463f43)[_0xd87a('0x22')](_0x1a4d34);}return null;};}function patchUpdates(_0x334f2f){return function(_0x2b58a){try{jsonpatch['apply'](_0x2b58a,_0x334f2f,!![]);}catch(_0xde7968){return BPromise[_0xd87a('0x23')](_0xde7968);}return _0x2b58a[_0xd87a('0x24')]();};}function saveUpdates(_0x5176f9,_0x3f6a51){return function(_0x23546d){if(_0x23546d){return _0x23546d[_0xd87a('0x25')](_0x5176f9)[_0xd87a('0x26')](function(_0x423fbc){return _0x423fbc;});}return null;};}function removeEntity(_0x15c239,_0x5f2a67){return function(_0x1b2f0a){if(_0x1b2f0a){return _0x1b2f0a[_0xd87a('0x27')]()[_0xd87a('0x26')](function(){_0x15c239[_0xd87a('0x1c')](0xcc)[_0xd87a('0x1b')]();});}};}function handleEntityNotFound(_0x57953a,_0x5f5a6d){return function(_0x5b3cc2){if(!_0x5b3cc2){_0x57953a[_0xd87a('0x1a')](0x194);}return _0x5b3cc2;};}function handleError(_0x45018a,_0xbf600b){_0xbf600b=_0xbf600b||0x1f4;return function(_0x48bc4c){logger[_0xd87a('0x28')](_0x48bc4c[_0xd87a('0x29')]);if(_0x48bc4c['name']){delete _0x48bc4c[_0xd87a('0x2a')];}_0x45018a[_0xd87a('0x1c')](_0xbf600b)[_0xd87a('0x2b')](_0x48bc4c);};}exports['index']=function(_0x5d1c67,_0x2ed750){var _0x1e676a={},_0xc92301={},_0x42700={'count':0x0,'rows':[]};var _0x2194ca=_[_0xd87a('0x2c')](db['ServicenowAccount'][_0xd87a('0x2d')],function(_0x5a75a2){return{'name':_0x5a75a2[_0xd87a('0x2e')],'type':_0x5a75a2[_0xd87a('0x2f')][_0xd87a('0x30')]};});_0xc92301[_0xd87a('0x31')]=_[_0xd87a('0x2c')](_0x2194ca,_0xd87a('0x2a'));_0xc92301['query']=_['keys'](_0x5d1c67[_0xd87a('0x32')]);_0xc92301[_0xd87a('0x33')]=_[_0xd87a('0x34')](_0xc92301[_0xd87a('0x31')],_0xc92301['query']);_0x1e676a[_0xd87a('0x35')]=_[_0xd87a('0x34')](_0xc92301[_0xd87a('0x31')],qs['fields'](_0x5d1c67['query'][_0xd87a('0x36')]));_0x1e676a['attributes']=_0x1e676a['attributes'][_0xd87a('0x37')]?_0x1e676a['attributes']:_0xc92301[_0xd87a('0x31')];if(!_0x5d1c67['query'][_0xd87a('0x38')](_0xd87a('0x39'))){_0x1e676a['limit']=qs['limit'](_0x5d1c67[_0xd87a('0x32')][_0xd87a('0x1f')]);_0x1e676a[_0xd87a('0x1d')]=qs[_0xd87a('0x1d')](_0x5d1c67[_0xd87a('0x32')][_0xd87a('0x1d')]);}_0x1e676a[_0xd87a('0x3a')]=qs['sort'](_0x5d1c67[_0xd87a('0x32')][_0xd87a('0x3b')]);_0x1e676a['where']=qs[_0xd87a('0x33')](_['pick'](_0x5d1c67[_0xd87a('0x32')],_0xc92301[_0xd87a('0x33')]),_0x2194ca);if(_0x5d1c67[_0xd87a('0x32')][_0xd87a('0x3c')]){_0x1e676a['where']=_[_0xd87a('0x3d')](_0x1e676a[_0xd87a('0x3e')],{'$or':_[_0xd87a('0x2c')](_0x2194ca,function(_0x592525){if(_0x592525['type']!=='VIRTUAL'){var _0x15ce2e={};_0x15ce2e[_0x592525[_0xd87a('0x2a')]]={'$like':'%'+_0x5d1c67[_0xd87a('0x32')][_0xd87a('0x3c')]+'%'};return _0x15ce2e;}})});}_0x1e676a=_[_0xd87a('0x3d')]({},_0x1e676a,_0x5d1c67[_0xd87a('0x3f')]);var _0x2b173a={'where':_0x1e676a[_0xd87a('0x3e')]};return db[_0xd87a('0x40')]['count'](_0x2b173a)[_0xd87a('0x26')](function(_0x1e0267){_0x42700[_0xd87a('0x20')]=_0x1e0267;if(_0x5d1c67[_0xd87a('0x32')]['includeAll']){_0x1e676a[_0xd87a('0x41')]=[{'all':!![]}];}return db[_0xd87a('0x40')][_0xd87a('0x42')](_0x1e676a);})['then'](function(_0x568624){_0x42700[_0xd87a('0x43')]=_0x568624;return _0x42700;})[_0xd87a('0x26')](respondWithFilteredResult(_0x2ed750,_0x1e676a))['catch'](handleError(_0x2ed750,null));};exports[_0xd87a('0x44')]=function(_0x33946c,_0x25d220){var _0x50e505={'raw':![],'where':{'id':_0x33946c[_0xd87a('0x45')]['id']}},_0x2a880f={};_0x2a880f[_0xd87a('0x31')]=_[_0xd87a('0x46')](db[_0xd87a('0x40')][_0xd87a('0x2d')]);_0x2a880f[_0xd87a('0x32')]=_['keys'](_0x33946c[_0xd87a('0x32')]);_0x2a880f[_0xd87a('0x33')]=_[_0xd87a('0x34')](_0x2a880f[_0xd87a('0x31')],_0x2a880f['query']);_0x50e505[_0xd87a('0x35')]=_[_0xd87a('0x34')](_0x2a880f['model'],qs[_0xd87a('0x36')](_0x33946c['query'][_0xd87a('0x36')]));_0x50e505[_0xd87a('0x35')]=_0x50e505[_0xd87a('0x35')][_0xd87a('0x37')]?_0x50e505[_0xd87a('0x35')]:_0x2a880f[_0xd87a('0x31')];if(_0x33946c[_0xd87a('0x32')][_0xd87a('0x47')]){_0x50e505[_0xd87a('0x41')]=[{'all':!![]}];}_0x50e505=_[_0xd87a('0x3d')]({},_0x50e505,_0x33946c[_0xd87a('0x3f')]);return db[_0xd87a('0x40')]['find'](_0x50e505)[_0xd87a('0x26')](handleEntityNotFound(_0x25d220,null))['then'](respondWithResult(_0x25d220,null))[_0xd87a('0x48')](handleError(_0x25d220,null));};exports[_0xd87a('0x49')]=function(_0x1ab016,_0x4b423e){return db['ServicenowAccount'][_0xd87a('0x49')](_0x1ab016[_0xd87a('0x4a')],{})['then'](respondWithResult(_0x4b423e,0xc9))[_0xd87a('0x48')](handleError(_0x4b423e,null));};exports['update']=function(_0x3f0016,_0x47ccc6){if(_0x3f0016['body']['id']){delete _0x3f0016[_0xd87a('0x4a')]['id'];}return db['ServicenowAccount'][_0xd87a('0x4b')]({'where':{'id':_0x3f0016[_0xd87a('0x45')]['id']}})['then'](handleEntityNotFound(_0x47ccc6,null))['then'](saveUpdates(_0x3f0016['body'],null))[_0xd87a('0x26')](respondWithResult(_0x47ccc6,null))[_0xd87a('0x48')](handleError(_0x47ccc6,null));};exports[_0xd87a('0x27')]=function(_0x16f369,_0x24c51f){return db[_0xd87a('0x40')][_0xd87a('0x4b')]({'where':{'id':_0x16f369[_0xd87a('0x45')]['id']}})[_0xd87a('0x26')](handleEntityNotFound(_0x24c51f,null))['then'](removeEntity(_0x24c51f,null))[_0xd87a('0x48')](handleError(_0x24c51f,null));};exports[_0xd87a('0x4c')]=function(_0x108206,_0x1d2ada,_0xaf04d0){var _0xef6e14={};var _0x405490={};var _0x55e5fb;var _0x257a82;return db['ServicenowAccount'][_0xd87a('0x4d')]({'where':{'id':_0x108206[_0xd87a('0x45')]['id']}})[_0xd87a('0x26')](handleEntityNotFound(_0x1d2ada,null))[_0xd87a('0x26')](function(_0x52e9d3){if(_0x52e9d3){_0x55e5fb=_0x52e9d3;_0x405490[_0xd87a('0x31')]=_[_0xd87a('0x46')](db[_0xd87a('0x4e')][_0xd87a('0x2d')]);_0x405490[_0xd87a('0x32')]=_['keys'](_0x108206[_0xd87a('0x32')]);_0x405490[_0xd87a('0x33')]=_[_0xd87a('0x34')](_0x405490[_0xd87a('0x31')],_0x405490[_0xd87a('0x32')]);_0xef6e14['attributes']=_[_0xd87a('0x34')](_0x405490[_0xd87a('0x31')],qs[_0xd87a('0x36')](_0x108206['query'][_0xd87a('0x36')]));_0xef6e14[_0xd87a('0x35')]=_0xef6e14[_0xd87a('0x35')][_0xd87a('0x37')]?_0xef6e14['attributes']:_0x405490[_0xd87a('0x31')];_0xef6e14[_0xd87a('0x3a')]=qs['sort'](_0x108206[_0xd87a('0x32')][_0xd87a('0x3b')]);_0xef6e14[_0xd87a('0x3e')]=qs[_0xd87a('0x33')](_[_0xd87a('0x4f')](_0x108206[_0xd87a('0x32')],_0x405490[_0xd87a('0x33')]));if(_0x108206[_0xd87a('0x32')][_0xd87a('0x3c')]){_0xef6e14[_0xd87a('0x3e')]=_['merge'](_0xef6e14['where'],{'$or':_[_0xd87a('0x2c')](_0xef6e14[_0xd87a('0x35')],function(_0x18901c){var _0x35183d={};_0x35183d[_0x18901c]={'$like':'%'+_0x108206[_0xd87a('0x32')]['filter']+'%'};return _0x35183d;})});}_0xef6e14=_[_0xd87a('0x3d')]({},_0xef6e14,_0x108206[_0xd87a('0x3f')]);return _0x55e5fb[_0xd87a('0x4c')](_0xef6e14);}})[_0xd87a('0x26')](function(_0xe1ce70){if(_0xe1ce70){_0x257a82=_0xe1ce70[_0xd87a('0x37')];if(!_0x108206[_0xd87a('0x32')]['hasOwnProperty'](_0xd87a('0x39'))){_0xef6e14['limit']=qs['limit'](_0x108206['query']['limit']);_0xef6e14[_0xd87a('0x1d')]=qs[_0xd87a('0x1d')](_0x108206['query']['offset']);}return _0x55e5fb[_0xd87a('0x4c')](_0xef6e14);}})[_0xd87a('0x26')](function(_0x3e5044){if(_0x3e5044){return _0x3e5044?{'count':_0x257a82,'rows':_0x3e5044}:null;}})[_0xd87a('0x26')](respondWithResult(_0x1d2ada,null))[_0xd87a('0x48')](handleError(_0x1d2ada,null));};exports[_0xd87a('0x50')]=function(_0x2889e1,_0x3019f1,_0x28305d){if(_0x2889e1['body']['id']){delete _0x2889e1['body']['id'];}return db[_0xd87a('0x40')]['findOne']({'where':{'id':_0x2889e1[_0xd87a('0x45')]['id']}})[_0xd87a('0x26')](handleEntityNotFound(_0x3019f1,null))['then'](function(_0x10109c){if(_0x10109c){_0x2889e1['body']['AccountId']=_0x10109c['id'];_0x2889e1[_0xd87a('0x4a')][_0xd87a('0x51')]=integrations[_0xd87a('0x52')](_0x2889e1[_0xd87a('0x4a')][_0xd87a('0x53')],_0x2889e1[_0xd87a('0x4a')][_0xd87a('0x2f')]);_0x2889e1[_0xd87a('0x4a')][_0xd87a('0x54')]=integrations[_0xd87a('0x55')](_0x2889e1['body'][_0xd87a('0x53')],_0x2889e1['body'][_0xd87a('0x2f')]);return db[_0xd87a('0x4e')][_0xd87a('0x49')](_0x2889e1[_0xd87a('0x4a')],{'include':[{'model':db[_0xd87a('0x56')],'as':_0xd87a('0x51')},{'model':db[_0xd87a('0x56')],'as':'Descriptions'}]});}return null;})[_0xd87a('0x26')](respondWithResult(_0x3019f1,null))['catch'](handleError(_0x3019f1,null));};exports[_0xd87a('0x57')]=function(_0x17c394,_0x5edadf,_0x34c77d){var _0xe086d0=[_0xd87a('0x58'),_0xd87a('0x59'),_0xd87a('0x5a'),_0xd87a('0x5b'),_0xd87a('0x5c'),_0xd87a('0x5d'),_0xd87a('0x5e'),'severity',_0xd87a('0x5f')];var _0x31999f=[_0xd87a('0x60'),_0xd87a('0x58'),_0xd87a('0x61'),_0xd87a('0x62'),_0xd87a('0x63'),'sys_updated_on',_0xd87a('0x64'),_0xd87a('0x59'),'approval_history','number',_0xd87a('0x65'),'sys_updated_by',_0xd87a('0x66'),_0xd87a('0x67'),_0xd87a('0x68'),_0xd87a('0x69'),_0xd87a('0x6a'),'sys_created_by',_0xd87a('0x5a'),_0xd87a('0x3a'),_0xd87a('0x6b'),_0xd87a('0x6c'),_0xd87a('0x6d'),_0xd87a('0x6e'),_0xd87a('0x6f'),_0xd87a('0x70'),_0xd87a('0x71'),'business_service',_0xd87a('0x72'),_0xd87a('0x73'),_0xd87a('0x74'),_0xd87a('0x75'),'expected_start',_0xd87a('0x76'),'business_duration',_0xd87a('0x77'),_0xd87a('0x78'),_0xd87a('0x79'),_0xd87a('0x7a'),_0xd87a('0x7b'),_0xd87a('0x7c'),'subcategory',_0xd87a('0x7d'),_0xd87a('0x7e'),_0xd87a('0x5c'),_0xd87a('0x7f'),'delivery_task',_0xd87a('0x80'),'assignment_group',_0xd87a('0x81'),_0xd87a('0x82'),_0xd87a('0x83'),_0xd87a('0x84'),_0xd87a('0x5d'),_0xd87a('0x85'),'close_notes',_0xd87a('0x86'),_0xd87a('0x87'),'parent_incident',_0xd87a('0x88'),_0xd87a('0x89'),_0xd87a('0x8a'),_0xd87a('0x5e'),_0xd87a('0x8b'),_0xd87a('0x8c'),_0xd87a('0x8d'),_0xd87a('0x8e'),_0xd87a('0x8f'),'assigned_to',_0xd87a('0x90'),_0xd87a('0x91'),_0xd87a('0x92'),'approval',_0xd87a('0x93'),_0xd87a('0x94'),_0xd87a('0x95'),_0xd87a('0x96'),'sys_tags',_0xd87a('0x97'),_0xd87a('0x98'),_0xd87a('0x99'),'location',_0xd87a('0x5f')];var _0x3b675c='';var _0x41cd9a='';var _0x29bde4=[];var _0x10a3df='';var _0x13b7d2='';var _0x51cf88=[];var _0x2cc192='';var _0x1de16f='';var _0x583cc3={};var _0x4f42bb='';return db[_0xd87a('0x40')]['findOne']({'where':{'id':_0x17c394[_0xd87a('0x45')]['id']},'attributes':['id',_0xd87a('0x9a'),_0xd87a('0x9b'),_0xd87a('0x9c'),_0xd87a('0x9d'),_0xd87a('0x9e')]})[_0xd87a('0x26')](handleEntityNotFound(_0x5edadf,null))[_0xd87a('0x26')](function(_0x52e924){if(_0x52e924){_0x4f42bb=_0x52e924[_0xd87a('0x9d')];var _0x4fe85d=_0x4f42bb['slice'](-0x1);if(_0x4fe85d==='/'){_0x4f42bb=_0x4f42bb[_0xd87a('0x9f')](0x0,_0x4f42bb[_0xd87a('0xa0')](_0x4fe85d));}_0x1de16f=util[_0xd87a('0xa1')](_0xd87a('0xa2'),_0x4f42bb);_0x2cc192=util[_0xd87a('0xa1')](_0xd87a('0xa3'),_0x4f42bb);_0x583cc3={'user':_0x52e924[_0xd87a('0x9a')],'pass':_0x52e924[_0xd87a('0x9b')]};var _0x210bd3={'method':_0xd87a('0xa4'),'uri':_0x1de16f+_0xd87a('0xa5'),'auth':_0x583cc3,'json':!![]};return rp(_0x210bd3);}})[_0xd87a('0x26')](function(_0x4a6a9c){if(_0x4a6a9c[_0xd87a('0xa6')][_0xd87a('0x37')]>0x0){_0x3b675c=_0x4a6a9c[_0xd87a('0xa6')];}console[_0xd87a('0xa7')](_0xd87a('0xa8'),_0x3b675c);_0x51cf88=[];_0x41cd9a=Object['assign']([],_0x3b675c);_[_0xd87a('0xa9')](_0x41cd9a,function(_0x224cb3){return!_0xe086d0[_0xd87a('0xaa')](_0x224cb3[_0xd87a('0x2a')]);});_0x41cd9a[_0xd87a('0xab')](function(_0x59c3d9){var _0x5dfa06=createFieldObject(_0x2cc192,_0x583cc3,_0x59c3d9[_0xd87a('0xac')],_0x59c3d9['name'],_0x59c3d9[_0xd87a('0xad')],![]);_0x51cf88['push'](_0x5dfa06);});return Promise[_0xd87a('0xae')](_0x51cf88);})[_0xd87a('0x26')](function(_0x569b39){_0x29bde4=_0x569b39;_0x10a3df=Object[_0xd87a('0xaf')]([],_0x3b675c);console[_0xd87a('0xa7')]('TCL:\x20_object',_0x3b675c);_[_0xd87a('0xa9')](_0x10a3df,function(_0x4889d1){return _0x31999f[_0xd87a('0xaa')](_0x4889d1[_0xd87a('0x2a')]);});console[_0xd87a('0xa7')](_0xd87a('0xb0'),_0x10a3df);_0x51cf88=[];_0x10a3df[_0xd87a('0xab')](function(_0x368999){var _0x497827=createFieldObject(_0x2cc192,_0x583cc3,_0x368999[_0xd87a('0xac')],_0x368999[_0xd87a('0x2a')],_0x368999[_0xd87a('0xad')],!![]);_0x51cf88[_0xd87a('0xb1')](_0x497827);});return Promise[_0xd87a('0xae')](_0x51cf88);})[_0xd87a('0x26')](function(_0x4b5d0b){_0x13b7d2=_0x4b5d0b;var _0x2cd1fb=_0x29bde4['concat'](_0x13b7d2);return{'count':_0x2cd1fb[_0xd87a('0x37')],'rows':_0x2cd1fb};})['then'](respondWithResult(_0x5edadf,null))[_0xd87a('0x48')](function(_0x1a1985){console[_0xd87a('0xa7')](_0xd87a('0xb2')+_0x1a1985);var _0x5a4ee6=_0x17c394[_0xd87a('0x32')][_0xd87a('0xb3')]?0x1f4:_0x1a1985[_0xd87a('0xb4')]||0x1f4;logger[_0xd87a('0x28')](_0x1a1985[_0xd87a('0x29')]);delete _0x1a1985[_0xd87a('0x2a')];if(_0x5a4ee6===0x191){_0x5a4ee6=0x190;}_0x5edadf['status'](_0x5a4ee6)[_0xd87a('0x2b')](_0x17c394[_0xd87a('0x32')][_0xd87a('0xb3')]?{'message':'Wrong\x20credentials','statusCode':_0x1a1985['statusCode']}:_0x1a1985);});};function createFieldObject(_0x4f40bc,_0x2b7893,_0x34d989,_0x3bb641,_0x24a45b,_0x4855e4){return new Promise(function(_0x327377,_0x2bf2cb){var _0x596114={'id':_0x3bb641,'name':_0x24a45b,'custom':_0x4855e4};if(_0x34d989===_0xd87a('0xb5')){_0x596114[_0xd87a('0x3f')]=[{'name':_0xd87a('0xb6'),'value':'true'},{'name':'False','value':_0xd87a('0xb7')}];_0x327377(_0x596114);}else{var _0x112f4d={'method':_0xd87a('0xa4'),'uri':_0x4f40bc+_0xd87a('0xb8')+_0x3bb641,'auth':_0x2b7893,'json':!![]};return rp(_0x112f4d)[_0xd87a('0x26')](function(_0x579bc6){var _0x43e22b=[];if(_0x579bc6[_0xd87a('0xa6')][_0xd87a('0x37')]>0x0){_0x579bc6[_0xd87a('0xa6')][_0xd87a('0xab')](function(_0xf721e7){if(_0xf721e7[_0xd87a('0xb9')]===_0xd87a('0xb7')){var _0x31b51b={'name':_0xf721e7[_0xd87a('0xad')],'value':_0xf721e7[_0xd87a('0xba')]};_0x43e22b['push'](_0x31b51b);}});}_0x596114[_0xd87a('0x3f')]=_0x43e22b;if(_0x596114[_0xd87a('0x3f')][_0xd87a('0x37')]>0x0){_0x327377(_0x596114);}else{if(_0x4855e4==![]){_0x327377();}else{_0x327377(_0x596114);}}});}});} \ No newline at end of file +var _0xe149=['includeAll','rows','catch','show','params','ServicenowAccount','find','create','body','nolimit','limit','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','watch_list','upon_reject','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','order','closed_at','delivery_plan','impact','active','business_service','priority','rfc','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','company','assigned_to','severity','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','remove','includes','internalType','label','all','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','ServiceNow\x20error:\x20','stack','test','statusCode','boolean','true','false','sys_choice?sysparm_query=name=incident^element=','value','push','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options'];(function(_0x499ea4,_0x254251){var _0x154ea3=function(_0x5b651f){while(--_0x5b651f){_0x499ea4['push'](_0x499ea4['shift']());}};_0x154ea3(++_0x254251);}(_0xe149,0x11a));var _0x9e14=function(_0x56f57d,_0x452d41){_0x56f57d=_0x56f57d-0x0;var _0x2257cf=_0xe149[_0x56f57d];return _0x2257cf;};'use strict';var emlformat=require(_0x9e14('0x0'));var rimraf=require(_0x9e14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e14('0x2'));var rp=require(_0x9e14('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9e14('0x4'));var util=require('util');var path=require(_0x9e14('0x5'));var sox=require(_0x9e14('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e14('0x7'));var _=require(_0x9e14('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9e14('0x9'));var deskjs=require(_0x9e14('0xa'));var toCsv=require(_0x9e14('0xb'));var querystring=require('querystring');var Papa=require(_0x9e14('0xc'));var Redis=require('ioredis');var authService=require(_0x9e14('0xd'));var qs=require(_0x9e14('0xe'));var as=require(_0x9e14('0xf'));var hardwareService=require(_0x9e14('0x10'));var logger=require(_0x9e14('0x11'))(_0x9e14('0x12'));var utils=require(_0x9e14('0x13'));var config=require(_0x9e14('0x14'));var licenseUtil=require(_0x9e14('0x15'));var db=require(_0x9e14('0x16'))['db'];var integrations=require(_0x9e14('0x17'));function respondWithStatusCode(_0x561f07,_0xce3431){_0xce3431=_0xce3431||0xcc;return function(_0x3c50bf){if(_0x3c50bf){return _0x561f07[_0x9e14('0x18')](_0xce3431);}return _0x561f07[_0x9e14('0x19')](_0xce3431)[_0x9e14('0x1a')]();};}function respondWithResult(_0x1195d3,_0x33a0b6){_0x33a0b6=_0x33a0b6||0xc8;return function(_0x534f3e){if(_0x534f3e){return _0x1195d3[_0x9e14('0x19')](_0x33a0b6)['json'](_0x534f3e);}};}function respondWithFilteredResult(_0x2330e2,_0x178e4d){return function(_0x5960ab){if(_0x5960ab){var _0x4bf58c=typeof _0x178e4d[_0x9e14('0x1b')]===_0x9e14('0x1c')&&typeof _0x178e4d['limit']===_0x9e14('0x1c');var _0x2c897e=_0x5960ab[_0x9e14('0x1d')];var _0x28ba0e=_0x4bf58c?0x0:_0x178e4d[_0x9e14('0x1b')];var _0xaed432=_0x4bf58c?_0x5960ab[_0x9e14('0x1d')]:_0x178e4d[_0x9e14('0x1b')]+_0x178e4d['limit'];var _0x500c51;if(_0xaed432>=_0x2c897e){_0xaed432=_0x2c897e;_0x500c51=0xc8;}else{_0x500c51=0xce;}_0x2330e2['status'](_0x500c51);return _0x2330e2['set'](_0x9e14('0x1e'),_0x28ba0e+'-'+_0xaed432+'/'+_0x2c897e)[_0x9e14('0x1f')](_0x5960ab);}return null;};}function patchUpdates(_0x20d28c){return function(_0x2d0d01){try{jsonpatch['apply'](_0x2d0d01,_0x20d28c,!![]);}catch(_0x4529d6){return BPromise[_0x9e14('0x20')](_0x4529d6);}return _0x2d0d01[_0x9e14('0x21')]();};}function saveUpdates(_0x632a6e,_0x374042){return function(_0x2011dc){if(_0x2011dc){return _0x2011dc[_0x9e14('0x22')](_0x632a6e)[_0x9e14('0x23')](function(_0x2b23c9){return _0x2b23c9;});}return null;};}function removeEntity(_0x4356d0,_0x543342){return function(_0x301e33){if(_0x301e33){return _0x301e33[_0x9e14('0x24')]()[_0x9e14('0x23')](function(){_0x4356d0[_0x9e14('0x19')](0xcc)[_0x9e14('0x1a')]();});}};}function handleEntityNotFound(_0x3ec4d1,_0x780225){return function(_0x4ce17a){if(!_0x4ce17a){_0x3ec4d1[_0x9e14('0x18')](0x194);}return _0x4ce17a;};}function handleError(_0x516947,_0x4271b0){_0x4271b0=_0x4271b0||0x1f4;return function(_0x1a190c){logger[_0x9e14('0x25')](_0x1a190c['stack']);if(_0x1a190c['name']){delete _0x1a190c[_0x9e14('0x26')];}_0x516947['status'](_0x4271b0)[_0x9e14('0x27')](_0x1a190c);};}exports[_0x9e14('0x28')]=function(_0x19f6cb,_0x1ee67a){var _0x5a0f77={},_0x2fd1c1={},_0x4a8694={'count':0x0,'rows':[]};var _0x457c6f=_[_0x9e14('0x29')](db['ServicenowAccount'][_0x9e14('0x2a')],function(_0x44bbd9){return{'name':_0x44bbd9['fieldName'],'type':_0x44bbd9[_0x9e14('0x2b')]['key']};});_0x2fd1c1[_0x9e14('0x2c')]=_[_0x9e14('0x29')](_0x457c6f,'name');_0x2fd1c1[_0x9e14('0x2d')]=_[_0x9e14('0x2e')](_0x19f6cb[_0x9e14('0x2d')]);_0x2fd1c1['filters']=_[_0x9e14('0x2f')](_0x2fd1c1[_0x9e14('0x2c')],_0x2fd1c1[_0x9e14('0x2d')]);_0x5a0f77[_0x9e14('0x30')]=_[_0x9e14('0x2f')](_0x2fd1c1['model'],qs[_0x9e14('0x31')](_0x19f6cb[_0x9e14('0x2d')][_0x9e14('0x31')]));_0x5a0f77[_0x9e14('0x30')]=_0x5a0f77[_0x9e14('0x30')][_0x9e14('0x32')]?_0x5a0f77[_0x9e14('0x30')]:_0x2fd1c1[_0x9e14('0x2c')];if(!_0x19f6cb[_0x9e14('0x2d')][_0x9e14('0x33')]('nolimit')){_0x5a0f77['limit']=qs['limit'](_0x19f6cb[_0x9e14('0x2d')]['limit']);_0x5a0f77[_0x9e14('0x1b')]=qs[_0x9e14('0x1b')](_0x19f6cb['query'][_0x9e14('0x1b')]);}_0x5a0f77['order']=qs[_0x9e14('0x34')](_0x19f6cb['query'][_0x9e14('0x34')]);_0x5a0f77['where']=qs[_0x9e14('0x35')](_[_0x9e14('0x36')](_0x19f6cb['query'],_0x2fd1c1['filters']),_0x457c6f);if(_0x19f6cb['query'][_0x9e14('0x37')]){_0x5a0f77[_0x9e14('0x38')]=_['merge'](_0x5a0f77['where'],{'$or':_[_0x9e14('0x29')](_0x457c6f,function(_0xdf6bfc){if(_0xdf6bfc[_0x9e14('0x2b')]!==_0x9e14('0x39')){var _0x300961={};_0x300961[_0xdf6bfc[_0x9e14('0x26')]]={'$like':'%'+_0x19f6cb[_0x9e14('0x2d')][_0x9e14('0x37')]+'%'};return _0x300961;}})});}_0x5a0f77=_[_0x9e14('0x3a')]({},_0x5a0f77,_0x19f6cb[_0x9e14('0x3b')]);var _0x54de19={'where':_0x5a0f77[_0x9e14('0x38')]};return db['ServicenowAccount'][_0x9e14('0x1d')](_0x54de19)[_0x9e14('0x23')](function(_0x7b82a9){_0x4a8694[_0x9e14('0x1d')]=_0x7b82a9;if(_0x19f6cb[_0x9e14('0x2d')][_0x9e14('0x3c')]){_0x5a0f77['include']=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x5a0f77);})[_0x9e14('0x23')](function(_0x595a1f){_0x4a8694[_0x9e14('0x3d')]=_0x595a1f;return _0x4a8694;})[_0x9e14('0x23')](respondWithFilteredResult(_0x1ee67a,_0x5a0f77))[_0x9e14('0x3e')](handleError(_0x1ee67a,null));};exports[_0x9e14('0x3f')]=function(_0x108bc9,_0x4bdc09){var _0x3a897f={'raw':![],'where':{'id':_0x108bc9[_0x9e14('0x40')]['id']}},_0x1c3187={};_0x1c3187[_0x9e14('0x2c')]=_[_0x9e14('0x2e')](db[_0x9e14('0x41')]['rawAttributes']);_0x1c3187[_0x9e14('0x2d')]=_[_0x9e14('0x2e')](_0x108bc9[_0x9e14('0x2d')]);_0x1c3187[_0x9e14('0x35')]=_[_0x9e14('0x2f')](_0x1c3187[_0x9e14('0x2c')],_0x1c3187[_0x9e14('0x2d')]);_0x3a897f[_0x9e14('0x30')]=_[_0x9e14('0x2f')](_0x1c3187['model'],qs['fields'](_0x108bc9[_0x9e14('0x2d')][_0x9e14('0x31')]));_0x3a897f['attributes']=_0x3a897f[_0x9e14('0x30')][_0x9e14('0x32')]?_0x3a897f['attributes']:_0x1c3187[_0x9e14('0x2c')];if(_0x108bc9[_0x9e14('0x2d')][_0x9e14('0x3c')]){_0x3a897f['include']=[{'all':!![]}];}_0x3a897f=_[_0x9e14('0x3a')]({},_0x3a897f,_0x108bc9[_0x9e14('0x3b')]);return db[_0x9e14('0x41')][_0x9e14('0x42')](_0x3a897f)[_0x9e14('0x23')](handleEntityNotFound(_0x4bdc09,null))[_0x9e14('0x23')](respondWithResult(_0x4bdc09,null))[_0x9e14('0x3e')](handleError(_0x4bdc09,null));};exports[_0x9e14('0x43')]=function(_0x3b758a,_0x3d6e9f){return db[_0x9e14('0x41')][_0x9e14('0x43')](_0x3b758a[_0x9e14('0x44')],{})[_0x9e14('0x23')](respondWithResult(_0x3d6e9f,0xc9))[_0x9e14('0x3e')](handleError(_0x3d6e9f,null));};exports['update']=function(_0x31eddb,_0x522cf2){if(_0x31eddb[_0x9e14('0x44')]['id']){delete _0x31eddb[_0x9e14('0x44')]['id'];}return db[_0x9e14('0x41')][_0x9e14('0x42')]({'where':{'id':_0x31eddb['params']['id']}})['then'](handleEntityNotFound(_0x522cf2,null))[_0x9e14('0x23')](saveUpdates(_0x31eddb[_0x9e14('0x44')],null))[_0x9e14('0x23')](respondWithResult(_0x522cf2,null))[_0x9e14('0x3e')](handleError(_0x522cf2,null));};exports[_0x9e14('0x24')]=function(_0x3dab2a,_0x179f97){return db[_0x9e14('0x41')]['find']({'where':{'id':_0x3dab2a['params']['id']}})['then'](handleEntityNotFound(_0x179f97,null))['then'](removeEntity(_0x179f97,null))['catch'](handleError(_0x179f97,null));};exports['getConfigurations']=function(_0x11f12c,_0x2ffe8f,_0x19a60f){var _0x109e56={};var _0x231dd8={};var _0x52cedf;var _0x284db0;return db[_0x9e14('0x41')]['findOne']({'where':{'id':_0x11f12c[_0x9e14('0x40')]['id']}})[_0x9e14('0x23')](handleEntityNotFound(_0x2ffe8f,null))[_0x9e14('0x23')](function(_0x59598f){if(_0x59598f){_0x52cedf=_0x59598f;_0x231dd8['model']=_[_0x9e14('0x2e')](db['ServicenowConfiguration'][_0x9e14('0x2a')]);_0x231dd8['query']=_[_0x9e14('0x2e')](_0x11f12c[_0x9e14('0x2d')]);_0x231dd8['filters']=_['intersection'](_0x231dd8[_0x9e14('0x2c')],_0x231dd8['query']);_0x109e56[_0x9e14('0x30')]=_[_0x9e14('0x2f')](_0x231dd8['model'],qs[_0x9e14('0x31')](_0x11f12c[_0x9e14('0x2d')][_0x9e14('0x31')]));_0x109e56[_0x9e14('0x30')]=_0x109e56[_0x9e14('0x30')][_0x9e14('0x32')]?_0x109e56[_0x9e14('0x30')]:_0x231dd8[_0x9e14('0x2c')];_0x109e56['order']=qs[_0x9e14('0x34')](_0x11f12c[_0x9e14('0x2d')][_0x9e14('0x34')]);_0x109e56[_0x9e14('0x38')]=qs[_0x9e14('0x35')](_[_0x9e14('0x36')](_0x11f12c[_0x9e14('0x2d')],_0x231dd8['filters']));if(_0x11f12c[_0x9e14('0x2d')][_0x9e14('0x37')]){_0x109e56[_0x9e14('0x38')]=_[_0x9e14('0x3a')](_0x109e56['where'],{'$or':_['map'](_0x109e56[_0x9e14('0x30')],function(_0x406791){var _0x293b74={};_0x293b74[_0x406791]={'$like':'%'+_0x11f12c[_0x9e14('0x2d')][_0x9e14('0x37')]+'%'};return _0x293b74;})});}_0x109e56=_[_0x9e14('0x3a')]({},_0x109e56,_0x11f12c['options']);return _0x52cedf['getConfigurations'](_0x109e56);}})['then'](function(_0x362591){if(_0x362591){_0x284db0=_0x362591[_0x9e14('0x32')];if(!_0x11f12c[_0x9e14('0x2d')][_0x9e14('0x33')](_0x9e14('0x45'))){_0x109e56[_0x9e14('0x46')]=qs['limit'](_0x11f12c[_0x9e14('0x2d')][_0x9e14('0x46')]);_0x109e56['offset']=qs[_0x9e14('0x1b')](_0x11f12c[_0x9e14('0x2d')][_0x9e14('0x1b')]);}return _0x52cedf[_0x9e14('0x47')](_0x109e56);}})['then'](function(_0x3ae252){if(_0x3ae252){return _0x3ae252?{'count':_0x284db0,'rows':_0x3ae252}:null;}})[_0x9e14('0x23')](respondWithResult(_0x2ffe8f,null))[_0x9e14('0x3e')](handleError(_0x2ffe8f,null));};exports['addConfiguration']=function(_0x3b94ff,_0x461a37,_0x35e968){if(_0x3b94ff[_0x9e14('0x44')]['id']){delete _0x3b94ff['body']['id'];}return db[_0x9e14('0x41')][_0x9e14('0x48')]({'where':{'id':_0x3b94ff[_0x9e14('0x40')]['id']}})[_0x9e14('0x23')](handleEntityNotFound(_0x461a37,null))[_0x9e14('0x23')](function(_0x27897f){if(_0x27897f){_0x3b94ff[_0x9e14('0x44')][_0x9e14('0x49')]=_0x27897f['id'];_0x3b94ff[_0x9e14('0x44')]['Subjects']=integrations[_0x9e14('0x4a')](_0x3b94ff['body'][_0x9e14('0x4b')],_0x3b94ff[_0x9e14('0x44')]['type']);_0x3b94ff[_0x9e14('0x44')][_0x9e14('0x4c')]=integrations[_0x9e14('0x4d')](_0x3b94ff[_0x9e14('0x44')][_0x9e14('0x4b')],_0x3b94ff[_0x9e14('0x44')][_0x9e14('0x2b')]);return db[_0x9e14('0x4e')][_0x9e14('0x43')](_0x3b94ff[_0x9e14('0x44')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x9e14('0x4f')],'as':'Descriptions'}]});}return null;})[_0x9e14('0x23')](respondWithResult(_0x461a37,null))[_0x9e14('0x3e')](handleError(_0x461a37,null));};exports[_0x9e14('0x50')]=function(_0x40b031,_0x1c0618,_0xb9bef8){var _0x21b3d4=[_0x9e14('0x51'),_0x9e14('0x52'),_0x9e14('0x53'),_0x9e14('0x54'),_0x9e14('0x55'),_0x9e14('0x56'),'incident_state','severity',_0x9e14('0x57')];var _0x62b8c1=[_0x9e14('0x58'),'made_sla','caused_by',_0x9e14('0x59'),_0x9e14('0x5a'),'sys_updated_on',_0x9e14('0x5b'),_0x9e14('0x52'),_0x9e14('0x5c'),'number',_0x9e14('0x5d'),_0x9e14('0x5e'),_0x9e14('0x5f'),_0x9e14('0x60'),'sys_created_on',_0x9e14('0x61'),_0x9e14('0x62'),_0x9e14('0x63'),'knowledge',_0x9e14('0x64'),'calendar_stc',_0x9e14('0x65'),'cmdb_ci',_0x9e14('0x66'),_0x9e14('0x67'),_0x9e14('0x68'),'work_notes_list',_0x9e14('0x69'),_0x9e14('0x6a'),'sys_domain_path',_0x9e14('0x6b'),'time_worked','expected_start',_0x9e14('0x6c'),'business_duration',_0x9e14('0x6d'),_0x9e14('0x6e'),_0x9e14('0x6f'),_0x9e14('0x70'),_0x9e14('0x71'),_0x9e14('0x72'),_0x9e14('0x54'),'work_notes',_0x9e14('0x73'),_0x9e14('0x55'),_0x9e14('0x74'),'delivery_task','work_start',_0x9e14('0x75'),'business_stc',_0x9e14('0x76'),_0x9e14('0x77'),_0x9e14('0x78'),'notify',_0x9e14('0x79'),'close_notes',_0x9e14('0x7a'),'follow_up',_0x9e14('0x7b'),'sys_id',_0x9e14('0x7c'),_0x9e14('0x7d'),_0x9e14('0x7e'),_0x9e14('0x7f'),_0x9e14('0x80'),_0x9e14('0x81'),'reassignment_count','activity_due',_0x9e14('0x82'),_0x9e14('0x83'),'comments',_0x9e14('0x84'),_0x9e14('0x85'),'comments_and_work_notes',_0x9e14('0x86'),_0x9e14('0x87'),_0x9e14('0x88'),_0x9e14('0x89'),_0x9e14('0x8a'),_0x9e14('0x8b'),_0x9e14('0x8c'),_0x9e14('0x8d'),_0x9e14('0x57')];var _0x350ac6='';var _0x24e55b='';var _0x2266ae=[];var _0x4cbc3b='';var _0x140455='';var _0x4dbe21=[];var _0x1f0735='';var _0x424e52='';var _0x531362={};var _0x37b058='';return db[_0x9e14('0x41')][_0x9e14('0x48')]({'where':{'id':_0x40b031[_0x9e14('0x40')]['id']},'attributes':['id',_0x9e14('0x8e'),'password',_0x9e14('0x8f'),_0x9e14('0x90'),_0x9e14('0x91')]})[_0x9e14('0x23')](handleEntityNotFound(_0x1c0618,null))[_0x9e14('0x23')](function(_0xcc79b2){if(_0xcc79b2){_0x37b058=_0xcc79b2['remoteUri'];var _0x2e7374=_0x37b058['slice'](-0x1);if(_0x2e7374==='/'){_0x37b058=_0x37b058[_0x9e14('0x92')](0x0,_0x37b058['lastIndexOf'](_0x2e7374));}_0x424e52=util[_0x9e14('0x93')](_0x9e14('0x94'),_0x37b058);_0x1f0735=util[_0x9e14('0x93')](_0x9e14('0x95'),_0x37b058);_0x531362={'user':_0xcc79b2[_0x9e14('0x8e')],'pass':_0xcc79b2['password']};var _0x5f2bd6={'method':_0x9e14('0x96'),'uri':_0x424e52+'incident?sysparm_display_value=all','auth':_0x531362,'json':!![]};return rp(_0x5f2bd6);}})[_0x9e14('0x23')](function(_0x29ccbc){if(_0x29ccbc[_0x9e14('0x97')][_0x9e14('0x32')]>0x0){_0x350ac6=_0x29ccbc[_0x9e14('0x97')];}console[_0x9e14('0x98')]('incident\x20table\x20objects',_0x350ac6);_0x4dbe21=[];_0x24e55b=Object['assign']([],_0x350ac6);_[_0x9e14('0x99')](_0x24e55b,function(_0x1dab33){return!_0x21b3d4[_0x9e14('0x9a')](_0x1dab33[_0x9e14('0x26')]);});_0x24e55b['forEach'](function(_0x311ba6){var _0x14cabe=createFieldObject(_0x1f0735,_0x531362,_0x311ba6[_0x9e14('0x9b')],_0x311ba6[_0x9e14('0x26')],_0x311ba6[_0x9e14('0x9c')],![]);_0x4dbe21['push'](_0x14cabe);});return Promise[_0x9e14('0x9d')](_0x4dbe21);})[_0x9e14('0x23')](function(_0x4fb87a){_0x2266ae=_0x4fb87a;_0x4cbc3b=Object[_0x9e14('0x9e')]([],_0x350ac6);console[_0x9e14('0x98')]('TCL:\x20_object',_0x350ac6);_[_0x9e14('0x99')](_0x4cbc3b,function(_0x1629ec){return _0x62b8c1['includes'](_0x1629ec['name']);});console['log'](_0x9e14('0x9f'),_0x4cbc3b);_0x4dbe21=[];_0x4cbc3b[_0x9e14('0xa0')](function(_0xc1832e){var _0x20220c=createFieldObject(_0x1f0735,_0x531362,_0xc1832e[_0x9e14('0x9b')],_0xc1832e[_0x9e14('0x26')],_0xc1832e[_0x9e14('0x9c')],!![]);_0x4dbe21['push'](_0x20220c);});return Promise[_0x9e14('0x9d')](_0x4dbe21);})['then'](function(_0x9c7b9b){_0x140455=_0x9c7b9b;var _0x1844dd=_0x2266ae['concat'](_0x140455);return{'count':_0x1844dd[_0x9e14('0x32')],'rows':_0x1844dd};})['then'](respondWithResult(_0x1c0618,null))[_0x9e14('0x3e')](function(_0x4087ba){console[_0x9e14('0x98')](_0x9e14('0xa1')+_0x4087ba);var _0x258eae=_0x40b031[_0x9e14('0x2d')]['test']?0x1f4:_0x4087ba['statusCode']||0x1f4;logger[_0x9e14('0x25')](_0x4087ba[_0x9e14('0xa2')]);delete _0x4087ba[_0x9e14('0x26')];if(_0x258eae===0x191){_0x258eae=0x190;}_0x1c0618[_0x9e14('0x19')](_0x258eae)[_0x9e14('0x27')](_0x40b031['query'][_0x9e14('0xa3')]?{'message':'Wrong\x20credentials','statusCode':_0x4087ba[_0x9e14('0xa4')]}:_0x4087ba);});};function createFieldObject(_0x271fee,_0x44611b,_0x392e51,_0x81985c,_0x549aa5,_0x3051e1){return new Promise(function(_0x32338d,_0x365978){var _0x165642={'id':_0x81985c,'name':_0x549aa5,'custom':_0x3051e1};if(_0x392e51===_0x9e14('0xa5')){_0x165642[_0x9e14('0x3b')]=[{'name':'True','value':_0x9e14('0xa6')},{'name':'False','value':_0x9e14('0xa7')}];_0x32338d(_0x165642);}else{var _0x44b925={'method':'GET','uri':_0x271fee+_0x9e14('0xa8')+_0x81985c,'auth':_0x44611b,'json':!![]};return rp(_0x44b925)['then'](function(_0x29d621){var _0x5a5a66=[];if(_0x29d621[_0x9e14('0x97')][_0x9e14('0x32')]>0x0){_0x29d621['result'][_0x9e14('0xa0')](function(_0x4151fe){if(_0x4151fe['inactive']==='false'){var _0x32d613={'name':_0x4151fe[_0x9e14('0x9c')],'value':_0x4151fe[_0x9e14('0xa9')]};_0x5a5a66[_0x9e14('0xaa')](_0x32d613);}});}_0x165642[_0x9e14('0x3b')]=_0x5a5a66;if(_0x165642[_0x9e14('0x3b')]['length']>0x0){_0x32338d(_0x165642);}else{if(_0x3051e1==![]){_0x32338d();}else{_0x32338d(_0x165642);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c8d770e..a5c7710 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 _0x53ec=['path','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x53ec,0x192));var _0xc53e=function(_0x5caabb,_0x2b0cc1){_0x5caabb=_0x5caabb-0x0;var _0x2929d8=_0x53ec[_0x5caabb];return _0x2929d8;};'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'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('ServicenowAccount',attributes,{'tableName':_0xc53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x37d588,_0x243ac5){var _0x12e725=function(_0xfe9b16){while(--_0xfe9b16){_0x37d588['push'](_0x37d588['shift']());}};_0x12e725(++_0x243ac5);}(_0xb138,0x1dd));var _0x8b13=function(_0x3cbe8d,_0x5c50ef){_0x3cbe8d=_0x3cbe8d-0x0;var _0x43e843=_0xb138[_0x3cbe8d];return _0x43e843;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8b13('0xa')]=function(_0x13f7bd,_0x5d51b1){return _0x13f7bd[_0x8b13('0xb')](_0x8b13('0xc'),attributes,{'tableName':_0x8b13('0xd'),'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 6324243..7cb0888 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 _0xbb88=['debug','request\x20sent','stringify','error','code','message','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','include','map','model','find','ShowServicenowAccount','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbb88,0x78));var _0x8bb8=function(_0x1b4cab,_0x133714){_0x1b4cab=_0x1b4cab-0x0;var _0x5189d3=_0xbb88[_0x1b4cab];return _0x5189d3;};'use strict';var _=require(_0x8bb8('0x0'));var util=require('util');var moment=require(_0x8bb8('0x1'));var BPromise=require(_0x8bb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bb8('0x3'));var db=require(_0x8bb8('0x4'))['db'];var utils=require(_0x8bb8('0x5'));var logger=require(_0x8bb8('0x6'))(_0x8bb8('0x7'));var config=require(_0x8bb8('0x8'));var jayson=require(_0x8bb8('0x9'));var client=jayson[_0x8bb8('0xa')][_0x8bb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d877f,_0x41da29,_0x54a9e8){return new BPromise(function(_0x47590f,_0x59e36e){return client[_0x8bb8('0xc')](_0x5d877f,_0x54a9e8)[_0x8bb8('0xd')](function(_0x46c064){logger[_0x8bb8('0xe')](_0x8bb8('0xf'),_0x41da29,'request\x20sent');logger[_0x8bb8('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x41da29,_0x8bb8('0x11'),JSON[_0x8bb8('0x12')](_0x46c064));if(_0x46c064[_0x8bb8('0x13')]){if(_0x46c064[_0x8bb8('0x13')][_0x8bb8('0x14')]===0x1f4){logger['error'](_0x8bb8('0xf'),_0x41da29,_0x46c064[_0x8bb8('0x13')][_0x8bb8('0x15')]);return _0x59e36e(_0x46c064[_0x8bb8('0x13')][_0x8bb8('0x15')]);}logger[_0x8bb8('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x41da29,_0x46c064['error'][_0x8bb8('0x15')]);return _0x47590f(_0x46c064[_0x8bb8('0x13')][_0x8bb8('0x15')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x41da29,'request\x20sent');_0x47590f(_0x46c064['result'][_0x8bb8('0x15')]);}})['catch'](function(_0x303ddc){logger[_0x8bb8('0x13')](_0x8bb8('0xf'),_0x41da29,_0x303ddc);_0x59e36e(_0x303ddc);});});}exports[_0x8bb8('0x16')]=function(_0x516121){var _0x17c15b=this;return new Promise(function(_0xbcdb20,_0x5000f8){return db[_0x8bb8('0x17')]['findAll']({'raw':_0x516121[_0x8bb8('0x18')]?_0x516121[_0x8bb8('0x18')][_0x8bb8('0x19')]===undefined?!![]:![]:!![],'where':_0x516121[_0x8bb8('0x18')]?_0x516121['options'][_0x8bb8('0x1a')]||null:null,'attributes':_0x516121[_0x8bb8('0x18')]?_0x516121[_0x8bb8('0x18')][_0x8bb8('0x1b')]||null:null,'limit':_0x516121[_0x8bb8('0x18')]?_0x516121[_0x8bb8('0x18')]['limit']||null:null,'include':_0x516121[_0x8bb8('0x18')]?_0x516121[_0x8bb8('0x18')][_0x8bb8('0x1c')]?_[_0x8bb8('0x1d')](_0x516121[_0x8bb8('0x18')][_0x8bb8('0x1c')],function(_0xcf7bc3){return{'model':db[_0xcf7bc3['model']],'as':_0xcf7bc3['as'],'attributes':_0xcf7bc3[_0x8bb8('0x1b')],'include':_0xcf7bc3[_0x8bb8('0x1c')]?_['map'](_0xcf7bc3[_0x8bb8('0x1c')],function(_0x219b37){return{'model':db[_0x219b37[_0x8bb8('0x1e')]],'as':_0x219b37['as'],'attributes':_0x219b37['attributes'],'include':_0x219b37[_0x8bb8('0x1c')]?_[_0x8bb8('0x1d')](_0x219b37[_0x8bb8('0x1c')],function(_0x325e53){return{'model':db[_0x325e53['model']],'as':_0x325e53['as'],'attributes':_0x325e53['attributes']};}):[]};}):[]};}):[]:[]})[_0x8bb8('0xd')](function(_0x477ba2){logger[_0x8bb8('0xe')](_0x8bb8('0x16'),_0x516121);logger[_0x8bb8('0x10')](_0x8bb8('0x16'),_0x516121,JSON[_0x8bb8('0x12')](_0x477ba2));_0xbcdb20(_0x477ba2);})['catch'](function(_0x108b8d){logger[_0x8bb8('0x13')](_0x8bb8('0x16'),_0x108b8d['message'],_0x516121);_0x5000f8(_0x17c15b['error'](0x1f4,_0x108b8d[_0x8bb8('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x1cb868){var _0x3c068b=this;return new Promise(function(_0x1a782c,_0x2644fe){return db['ServicenowAccount'][_0x8bb8('0x1f')]({'raw':_0x1cb868['options']?_0x1cb868[_0x8bb8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1cb868[_0x8bb8('0x18')]?_0x1cb868[_0x8bb8('0x18')][_0x8bb8('0x1a')]||null:null,'attributes':_0x1cb868[_0x8bb8('0x18')]?_0x1cb868[_0x8bb8('0x18')]['attributes']||null:null,'include':_0x1cb868['options']?_0x1cb868['options'][_0x8bb8('0x1c')]?_[_0x8bb8('0x1d')](_0x1cb868[_0x8bb8('0x18')][_0x8bb8('0x1c')],function(_0x35ba6c){return{'model':db[_0x35ba6c['model']],'as':_0x35ba6c['as'],'attributes':_0x35ba6c['attributes'],'include':_0x35ba6c[_0x8bb8('0x1c')]?_[_0x8bb8('0x1d')](_0x35ba6c[_0x8bb8('0x1c')],function(_0x2d308e){return{'model':db[_0x2d308e['model']],'as':_0x2d308e['as'],'attributes':_0x2d308e[_0x8bb8('0x1b')],'include':_0x2d308e[_0x8bb8('0x1c')]?_['map'](_0x2d308e[_0x8bb8('0x1c')],function(_0x38ac8c){return{'model':db[_0x38ac8c['model']],'as':_0x38ac8c['as'],'attributes':_0x38ac8c[_0x8bb8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8bb8('0xd')](function(_0x23dc2d){logger[_0x8bb8('0xe')](_0x8bb8('0x20'),_0x1cb868);logger['debug'](_0x8bb8('0x20'),_0x1cb868,JSON['stringify'](_0x23dc2d));_0x1a782c(_0x23dc2d);})[_0x8bb8('0x21')](function(_0x414957){logger[_0x8bb8('0x13')](_0x8bb8('0x20'),_0x414957[_0x8bb8('0x15')],_0x1cb868);_0x2644fe(_0x3c068b[_0x8bb8('0x13')](0x1f4,_0x414957['message']));});});}; \ No newline at end of file +var _0xde2b=['catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','ShowServicenowAccount','find','util','bluebird','randomstring','../../config/utils','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x6330a4,_0x31ce3f){var _0x3a9b65=function(_0x5cb8d1){while(--_0x5cb8d1){_0x6330a4['push'](_0x6330a4['shift']());}};_0x3a9b65(++_0x31ce3f);}(_0xde2b,0xed));var _0xbde2=function(_0x51459b,_0x5d77c2){_0x51459b=_0x51459b-0x0;var _0x1ac444=_0xde2b[_0x51459b];return _0x1ac444;};'use strict';var _=require('lodash');var util=require(_0xbde2('0x0'));var moment=require('moment');var BPromise=require(_0xbde2('0x1'));var rs=require(_0xbde2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbde2('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbde2('0x4'));var client=jayson[_0xbde2('0x5')][_0xbde2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x531f2c,_0x360dd8,_0xf62ff7){return new BPromise(function(_0xa73563,_0x13b9fa){return client[_0xbde2('0x7')](_0x531f2c,_0xf62ff7)[_0xbde2('0x8')](function(_0x327fd7){logger[_0xbde2('0x9')](_0xbde2('0xa'),_0x360dd8,_0xbde2('0xb'));logger[_0xbde2('0xc')](_0xbde2('0xd'),_0x360dd8,_0xbde2('0xb'),JSON[_0xbde2('0xe')](_0x327fd7));if(_0x327fd7['error']){if(_0x327fd7['error'][_0xbde2('0xf')]===0x1f4){logger['error'](_0xbde2('0xa'),_0x360dd8,_0x327fd7[_0xbde2('0x10')][_0xbde2('0x11')]);return _0x13b9fa(_0x327fd7[_0xbde2('0x10')][_0xbde2('0x11')]);}logger[_0xbde2('0x10')](_0xbde2('0xa'),_0x360dd8,_0x327fd7['error'][_0xbde2('0x11')]);return _0xa73563(_0x327fd7[_0xbde2('0x10')][_0xbde2('0x11')]);}else{logger[_0xbde2('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x360dd8,'request\x20sent');_0xa73563(_0x327fd7[_0xbde2('0x12')][_0xbde2('0x11')]);}})[_0xbde2('0x13')](function(_0x19a922){logger[_0xbde2('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x360dd8,_0x19a922);_0x13b9fa(_0x19a922);});});}exports[_0xbde2('0x14')]=function(_0x1aaa6c){var _0x2def12=this;return new Promise(function(_0x5d4a45,_0x33ca2d){return db[_0xbde2('0x15')][_0xbde2('0x16')]({'raw':_0x1aaa6c[_0xbde2('0x17')]?_0x1aaa6c[_0xbde2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1aaa6c[_0xbde2('0x17')]?_0x1aaa6c[_0xbde2('0x17')][_0xbde2('0x18')]||null:null,'attributes':_0x1aaa6c[_0xbde2('0x17')]?_0x1aaa6c[_0xbde2('0x17')][_0xbde2('0x19')]||null:null,'limit':_0x1aaa6c[_0xbde2('0x17')]?_0x1aaa6c[_0xbde2('0x17')][_0xbde2('0x1a')]||null:null,'include':_0x1aaa6c[_0xbde2('0x17')]?_0x1aaa6c[_0xbde2('0x17')][_0xbde2('0x1b')]?_[_0xbde2('0x1c')](_0x1aaa6c[_0xbde2('0x17')][_0xbde2('0x1b')],function(_0x5b02ad){return{'model':db[_0x5b02ad[_0xbde2('0x1d')]],'as':_0x5b02ad['as'],'attributes':_0x5b02ad[_0xbde2('0x19')],'include':_0x5b02ad[_0xbde2('0x1b')]?_[_0xbde2('0x1c')](_0x5b02ad[_0xbde2('0x1b')],function(_0xff57fd){return{'model':db[_0xff57fd[_0xbde2('0x1d')]],'as':_0xff57fd['as'],'attributes':_0xff57fd[_0xbde2('0x19')],'include':_0xff57fd['include']?_[_0xbde2('0x1c')](_0xff57fd['include'],function(_0x4f63dc){return{'model':db[_0x4f63dc[_0xbde2('0x1d')]],'as':_0x4f63dc['as'],'attributes':_0x4f63dc[_0xbde2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbde2('0x8')](function(_0x520157){logger[_0xbde2('0x9')]('GetServicenowAccount',_0x1aaa6c);logger[_0xbde2('0xc')](_0xbde2('0x14'),_0x1aaa6c,JSON[_0xbde2('0xe')](_0x520157));_0x5d4a45(_0x520157);})[_0xbde2('0x13')](function(_0x3b546a){logger[_0xbde2('0x10')](_0xbde2('0x14'),_0x3b546a['message'],_0x1aaa6c);_0x33ca2d(_0x2def12[_0xbde2('0x10')](0x1f4,_0x3b546a[_0xbde2('0x11')]));});});};exports[_0xbde2('0x1e')]=function(_0x3191e0){var _0x460c07=this;return new Promise(function(_0x1cdd88,_0x335865){return db[_0xbde2('0x15')][_0xbde2('0x1f')]({'raw':_0x3191e0[_0xbde2('0x17')]?_0x3191e0[_0xbde2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3191e0[_0xbde2('0x17')]?_0x3191e0[_0xbde2('0x17')][_0xbde2('0x18')]||null:null,'attributes':_0x3191e0['options']?_0x3191e0[_0xbde2('0x17')]['attributes']||null:null,'include':_0x3191e0[_0xbde2('0x17')]?_0x3191e0[_0xbde2('0x17')][_0xbde2('0x1b')]?_[_0xbde2('0x1c')](_0x3191e0['options'][_0xbde2('0x1b')],function(_0x2d7481){return{'model':db[_0x2d7481['model']],'as':_0x2d7481['as'],'attributes':_0x2d7481[_0xbde2('0x19')],'include':_0x2d7481[_0xbde2('0x1b')]?_[_0xbde2('0x1c')](_0x2d7481['include'],function(_0x9cd79c){return{'model':db[_0x9cd79c[_0xbde2('0x1d')]],'as':_0x9cd79c['as'],'attributes':_0x9cd79c[_0xbde2('0x19')],'include':_0x9cd79c['include']?_[_0xbde2('0x1c')](_0x9cd79c['include'],function(_0x26ffe2){return{'model':db[_0x26ffe2[_0xbde2('0x1d')]],'as':_0x26ffe2['as'],'attributes':_0x26ffe2[_0xbde2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e1f84){logger[_0xbde2('0x9')](_0xbde2('0x1e'),_0x3191e0);logger['debug'](_0xbde2('0x1e'),_0x3191e0,JSON[_0xbde2('0xe')](_0x5e1f84));_0x1cdd88(_0x5e1f84);})[_0xbde2('0x13')](function(_0x178929){logger[_0xbde2('0x10')](_0xbde2('0x1e'),_0x178929[_0xbde2('0x11')],_0x3191e0);_0x335865(_0x460c07[_0xbde2('0x10')](0x1f4,_0x178929[_0xbde2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 6c396fd..071a0a4 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 _0x271d=['getDescriptions','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show','getFields','getSubjects','/:id/descriptions'];(function(_0x4409eb,_0x4589ee){var _0x3b7010=function(_0x14c49){while(--_0x14c49){_0x4409eb['push'](_0x4409eb['shift']());}};_0x3b7010(++_0x4589ee);}(_0x271d,0x1d6));var _0xd271=function(_0x3dc4ac,_0x5e8363){_0x3dc4ac=_0x3dc4ac-0x0;var _0x351114=_0x271d[_0x3dc4ac];return _0x351114;};'use strict';var multer=require('multer');var util=require(_0xd271('0x0'));var path=require(_0xd271('0x1'));var timeout=require(_0xd271('0x2'));var express=require(_0xd271('0x3'));var router=express[_0xd271('0x4')]();var fs_extra=require(_0xd271('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd271('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0xd271('0x7')]('/',auth[_0xd271('0x8')](),controller[_0xd271('0x9')]);router['get']('/:id',auth[_0xd271('0x8')](),controller[_0xd271('0xa')]);router['get']('/:id/fields',auth[_0xd271('0x8')](),controller[_0xd271('0xb')]);router[_0xd271('0x7')]('/:id/subjects',auth[_0xd271('0x8')](),controller[_0xd271('0xc')]);router['get'](_0xd271('0xd'),auth[_0xd271('0x8')](),controller[_0xd271('0xe')]);router[_0xd271('0xf')]('/',auth[_0xd271('0x8')](),controller[_0xd271('0x10')]);router[_0xd271('0x11')](_0xd271('0x12'),auth[_0xd271('0x8')](),controller[_0xd271('0x13')]);router['delete'](_0xd271('0x12'),auth[_0xd271('0x8')](),controller[_0xd271('0x14')]);module[_0xd271('0x15')]=router; \ No newline at end of file +var _0x40d9=['./intServicenowConfiguration.controller','index','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4cda37,_0x38c555){var _0x1a1785=function(_0x1f3656){while(--_0x1f3656){_0x4cda37['push'](_0x4cda37['shift']());}};_0x1a1785(++_0x38c555);}(_0x40d9,0x1ee));var _0x940d=function(_0x4edcc8,_0x58a804){_0x4edcc8=_0x4edcc8-0x0;var _0x3142d3=_0x40d9[_0x4edcc8];return _0x3142d3;};'use strict';var multer=require(_0x940d('0x0'));var util=require(_0x940d('0x1'));var path=require(_0x940d('0x2'));var timeout=require(_0x940d('0x3'));var express=require(_0x940d('0x4'));var router=express[_0x940d('0x5')]();var fs_extra=require(_0x940d('0x6'));var auth=require(_0x940d('0x7'));var interaction=require(_0x940d('0x8'));var config=require(_0x940d('0x9'));var controller=require(_0x940d('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x940d('0xb')]);router[_0x940d('0xc')](_0x940d('0xd'),auth[_0x940d('0xe')](),controller[_0x940d('0xf')]);router['get']('/:id/fields',auth[_0x940d('0xe')](),controller[_0x940d('0x10')]);router[_0x940d('0xc')](_0x940d('0x11'),auth[_0x940d('0xe')](),controller[_0x940d('0x12')]);router[_0x940d('0xc')](_0x940d('0x13'),auth[_0x940d('0xe')](),controller[_0x940d('0x14')]);router[_0x940d('0x15')]('/',auth[_0x940d('0xe')](),controller[_0x940d('0x16')]);router[_0x940d('0x17')]('/:id',auth[_0x940d('0xe')](),controller[_0x940d('0x18')]);router[_0x940d('0x19')](_0x940d('0xd'),auth[_0x940d('0xe')](),controller[_0x940d('0x1a')]);module[_0x940d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index a47cb43..0787cb3 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 _0x9872=['STRING','sequelize','exports'];(function(_0x5d9938,_0x47929b){var _0x1d1f17=function(_0x23ac33){while(--_0x23ac33){_0x5d9938['push'](_0x5d9938['shift']());}};_0x1d1f17(++_0x47929b);}(_0x9872,0x199));var _0x2987=function(_0x466419,_0x25b982){_0x466419=_0x466419-0x0;var _0x312698=_0x9872[_0x466419];return _0x312698;};'use strict';var Sequelize=require(_0x2987('0x0'));module[_0x2987('0x1')]={'name':{'type':Sequelize[_0x2987('0x2')]},'description':{'type':Sequelize[_0x2987('0x2')]}}; \ No newline at end of file +var _0x6b4a=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b4a,0x197));var _0xa6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa6b4('0x0'));module[_0xa6b4('0x1')]={'name':{'type':Sequelize[_0xa6b4('0x2')]},'description':{'type':Sequelize[_0xa6b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f8874be..52274c1 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 _0x005c=['destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','length','find','create','body','params','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','then'];(function(_0x530bc2,_0x365baa){var _0x43c080=function(_0x185f47){while(--_0x185f47){_0x530bc2['push'](_0x530bc2['shift']());}};_0x43c080(++_0x365baa);}(_0x005c,0x7e));var _0xc005=function(_0x3e4b6f,_0x269661){_0x3e4b6f=_0x3e4b6f-0x0;var _0x3d71a7=_0x005c[_0x3e4b6f];return _0x3d71a7;};'use strict';var emlformat=require(_0xc005('0x0'));var rimraf=require(_0xc005('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc005('0x2'));var moment=require(_0xc005('0x3'));var BPromise=require(_0xc005('0x4'));var Mustache=require(_0xc005('0x5'));var util=require('util');var path=require(_0xc005('0x6'));var sox=require(_0xc005('0x7'));var csv=require(_0xc005('0x8'));var ejs=require(_0xc005('0x9'));var fs=require('fs');var fs_extra=require(_0xc005('0xa'));var _=require(_0xc005('0xb'));var squel=require(_0xc005('0xc'));var crypto=require(_0xc005('0xd'));var jsforce=require(_0xc005('0xe'));var deskjs=require(_0xc005('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc005('0x10'));var Redis=require(_0xc005('0x11'));var authService=require(_0xc005('0x12'));var qs=require(_0xc005('0x13'));var as=require(_0xc005('0x14'));var hardwareService=require(_0xc005('0x15'));var logger=require(_0xc005('0x16'))('api');var utils=require(_0xc005('0x17'));var config=require(_0xc005('0x18'));var licenseUtil=require(_0xc005('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bd893,_0x359de2){_0x359de2=_0x359de2||0xcc;return function(_0x5868d5){if(_0x5868d5){return _0x4bd893[_0xc005('0x1a')](_0x359de2);}return _0x4bd893[_0xc005('0x1b')](_0x359de2)[_0xc005('0x1c')]();};}function respondWithResult(_0xebbea1,_0x4c1b59){_0x4c1b59=_0x4c1b59||0xc8;return function(_0x535289){if(_0x535289){return _0xebbea1[_0xc005('0x1b')](_0x4c1b59)[_0xc005('0x1d')](_0x535289);}};}function respondWithFilteredResult(_0x19d81d,_0x377918){return function(_0x167ffc){if(_0x167ffc){var _0x57bf96=typeof _0x377918['offset']===_0xc005('0x1e')&&typeof _0x377918[_0xc005('0x1f')]==='undefined';var _0x27e555=_0x167ffc[_0xc005('0x20')];var _0x180652=_0x57bf96?0x0:_0x377918['offset'];var _0x4d9267=_0x57bf96?_0x167ffc[_0xc005('0x20')]:_0x377918[_0xc005('0x21')]+_0x377918[_0xc005('0x1f')];var _0x45a7c0;if(_0x4d9267>=_0x27e555){_0x4d9267=_0x27e555;_0x45a7c0=0xc8;}else{_0x45a7c0=0xce;}_0x19d81d[_0xc005('0x1b')](_0x45a7c0);return _0x19d81d[_0xc005('0x22')]('Content-Range',_0x180652+'-'+_0x4d9267+'/'+_0x27e555)[_0xc005('0x1d')](_0x167ffc);}return null;};}function patchUpdates(_0x50d5cd){return function(_0x8db262){try{jsonpatch[_0xc005('0x23')](_0x8db262,_0x50d5cd,!![]);}catch(_0x592f33){return BPromise['reject'](_0x592f33);}return _0x8db262[_0xc005('0x24')]();};}function saveUpdates(_0x3bfa48,_0x1ba0bb){return function(_0x139e28){if(_0x139e28){return _0x139e28['update'](_0x3bfa48)[_0xc005('0x25')](function(_0x3566b1){return _0x3566b1;});}return null;};}function removeEntity(_0x5e949a,_0x1bf75e){return function(_0x3c1a94){if(_0x3c1a94){return _0x3c1a94[_0xc005('0x26')]()[_0xc005('0x25')](function(){_0x5e949a[_0xc005('0x1b')](0xcc)[_0xc005('0x1c')]();});}};}function handleEntityNotFound(_0x32a826,_0x453e2f){return function(_0x151ad8){if(!_0x151ad8){_0x32a826['sendStatus'](0x194);}return _0x151ad8;};}function handleError(_0x56e747,_0x39daa7){_0x39daa7=_0x39daa7||0x1f4;return function(_0x3e7a9f){logger[_0xc005('0x27')](_0x3e7a9f[_0xc005('0x28')]);if(_0x3e7a9f[_0xc005('0x29')]){delete _0x3e7a9f[_0xc005('0x29')];}_0x56e747['status'](_0x39daa7)[_0xc005('0x2a')](_0x3e7a9f);};}exports[_0xc005('0x2b')]=function(_0x5ea87b,_0xd5d987){var _0x412e24={},_0x244a20={},_0x4c8ec6={'count':0x0,'rows':[]};var _0x4af606=_[_0xc005('0x2c')](db[_0xc005('0x2d')][_0xc005('0x2e')],function(_0x202bde){return{'name':_0x202bde[_0xc005('0x2f')],'type':_0x202bde[_0xc005('0x30')][_0xc005('0x31')]};});_0x244a20[_0xc005('0x32')]=_[_0xc005('0x2c')](_0x4af606,'name');_0x244a20[_0xc005('0x33')]=_['keys'](_0x5ea87b[_0xc005('0x33')]);_0x244a20['filters']=_['intersection'](_0x244a20[_0xc005('0x32')],_0x244a20[_0xc005('0x33')]);_0x412e24[_0xc005('0x34')]=_[_0xc005('0x35')](_0x244a20['model'],qs[_0xc005('0x36')](_0x5ea87b[_0xc005('0x33')][_0xc005('0x36')]));_0x412e24['attributes']=_0x412e24['attributes']['length']?_0x412e24[_0xc005('0x34')]:_0x244a20['model'];if(!_0x5ea87b['query'][_0xc005('0x37')](_0xc005('0x38'))){_0x412e24['limit']=qs[_0xc005('0x1f')](_0x5ea87b[_0xc005('0x33')][_0xc005('0x1f')]);_0x412e24[_0xc005('0x21')]=qs[_0xc005('0x21')](_0x5ea87b['query'][_0xc005('0x21')]);}_0x412e24[_0xc005('0x39')]=qs[_0xc005('0x3a')](_0x5ea87b[_0xc005('0x33')][_0xc005('0x3a')]);_0x412e24[_0xc005('0x3b')]=qs[_0xc005('0x3c')](_[_0xc005('0x3d')](_0x5ea87b[_0xc005('0x33')],_0x244a20[_0xc005('0x3c')]),_0x4af606);if(_0x5ea87b[_0xc005('0x33')][_0xc005('0x3e')]){_0x412e24[_0xc005('0x3b')]=_[_0xc005('0x3f')](_0x412e24[_0xc005('0x3b')],{'$or':_[_0xc005('0x2c')](_0x4af606,function(_0x51c801){if(_0x51c801[_0xc005('0x30')]!==_0xc005('0x40')){var _0x50786d={};_0x50786d[_0x51c801[_0xc005('0x29')]]={'$like':'%'+_0x5ea87b[_0xc005('0x33')][_0xc005('0x3e')]+'%'};return _0x50786d;}})});}_0x412e24=_[_0xc005('0x3f')]({},_0x412e24,_0x5ea87b[_0xc005('0x41')]);var _0x183ab3={'where':_0x412e24[_0xc005('0x3b')]};return db[_0xc005('0x2d')][_0xc005('0x20')](_0x183ab3)['then'](function(_0x6c6085){_0x4c8ec6[_0xc005('0x20')]=_0x6c6085;if(_0x5ea87b[_0xc005('0x33')][_0xc005('0x42')]){_0x412e24[_0xc005('0x43')]=[{'all':!![]}];}return db[_0xc005('0x2d')][_0xc005('0x44')](_0x412e24);})[_0xc005('0x25')](function(_0x2aceb2){_0x4c8ec6['rows']=_0x2aceb2;return _0x4c8ec6;})['then'](respondWithFilteredResult(_0xd5d987,_0x412e24))[_0xc005('0x45')](handleError(_0xd5d987,null));};exports[_0xc005('0x46')]=function(_0x12eedb,_0x4be583){var _0x49fa72={'raw':![],'where':{'id':_0x12eedb['params']['id']}},_0x43c5fd={};_0x43c5fd['model']=_[_0xc005('0x47')](db[_0xc005('0x2d')]['rawAttributes']);_0x43c5fd['query']=_[_0xc005('0x47')](_0x12eedb['query']);_0x43c5fd[_0xc005('0x3c')]=_['intersection'](_0x43c5fd[_0xc005('0x32')],_0x43c5fd['query']);_0x49fa72['attributes']=_[_0xc005('0x35')](_0x43c5fd[_0xc005('0x32')],qs['fields'](_0x12eedb[_0xc005('0x33')][_0xc005('0x36')]));_0x49fa72[_0xc005('0x34')]=_0x49fa72[_0xc005('0x34')][_0xc005('0x48')]?_0x49fa72[_0xc005('0x34')]:_0x43c5fd[_0xc005('0x32')];if(_0x12eedb[_0xc005('0x33')][_0xc005('0x42')]){_0x49fa72[_0xc005('0x43')]=[{'all':!![]}];}_0x49fa72=_[_0xc005('0x3f')]({},_0x49fa72,_0x12eedb[_0xc005('0x41')]);return db['ServicenowConfiguration'][_0xc005('0x49')](_0x49fa72)['then'](handleEntityNotFound(_0x4be583,null))['then'](respondWithResult(_0x4be583,null))[_0xc005('0x45')](handleError(_0x4be583,null));};exports[_0xc005('0x4a')]=function(_0x2e0f42,_0x4babb8){return db[_0xc005('0x2d')][_0xc005('0x4a')](_0x2e0f42['body'],{})['then'](respondWithResult(_0x4babb8,0xc9))[_0xc005('0x45')](handleError(_0x4babb8,null));};exports['update']=function(_0x32c8e3,_0x5b0743){if(_0x32c8e3['body']['id']){delete _0x32c8e3[_0xc005('0x4b')]['id'];}return db[_0xc005('0x2d')][_0xc005('0x49')]({'where':{'id':_0x32c8e3['params']['id']}})['then'](handleEntityNotFound(_0x5b0743,null))[_0xc005('0x25')](saveUpdates(_0x32c8e3['body'],null))['then'](respondWithResult(_0x5b0743,null))[_0xc005('0x45')](handleError(_0x5b0743,null));};exports[_0xc005('0x26')]=function(_0x3c8c5d,_0x745602){return db[_0xc005('0x2d')]['find']({'where':{'id':_0x3c8c5d[_0xc005('0x4c')]['id']}})[_0xc005('0x25')](handleEntityNotFound(_0x745602,null))[_0xc005('0x25')](removeEntity(_0x745602,null))[_0xc005('0x45')](handleError(_0x745602,null));};exports['getFields']=function(_0x60ab47,_0x74e908,_0x5448e2){var _0xbab2ed={};var _0x111e96={};var _0x2d3fe7;var _0x5118db;return db[_0xc005('0x2d')][_0xc005('0x4d')]({'where':{'id':_0x60ab47[_0xc005('0x4c')]['id']}})[_0xc005('0x25')](handleEntityNotFound(_0x74e908,null))['then'](function(_0x2f8243){if(_0x2f8243){_0x2d3fe7=_0x2f8243;_0x111e96[_0xc005('0x32')]=_['keys'](db[_0xc005('0x4e')]['rawAttributes']);_0x111e96[_0xc005('0x33')]=_['keys'](_0x60ab47[_0xc005('0x33')]);_0x111e96[_0xc005('0x3c')]=_[_0xc005('0x35')](_0x111e96[_0xc005('0x32')],_0x111e96[_0xc005('0x33')]);_0xbab2ed[_0xc005('0x34')]=_[_0xc005('0x35')](_0x111e96['model'],qs[_0xc005('0x36')](_0x60ab47[_0xc005('0x33')][_0xc005('0x36')]));_0xbab2ed[_0xc005('0x34')]=_0xbab2ed[_0xc005('0x34')][_0xc005('0x48')]?_0xbab2ed[_0xc005('0x34')]:_0x111e96[_0xc005('0x32')];_0xbab2ed[_0xc005('0x39')]=qs['sort'](_0x60ab47[_0xc005('0x33')][_0xc005('0x3a')]);_0xbab2ed['where']=qs[_0xc005('0x3c')](_['pick'](_0x60ab47[_0xc005('0x33')],_0x111e96[_0xc005('0x3c')]));if(_0x60ab47[_0xc005('0x33')][_0xc005('0x3e')]){_0xbab2ed['where']=_[_0xc005('0x3f')](_0xbab2ed[_0xc005('0x3b')],{'$or':_[_0xc005('0x2c')](_0xbab2ed['attributes'],function(_0x9730c4){var _0x4cc775={};_0x4cc775[_0x9730c4]={'$like':'%'+_0x60ab47['query'][_0xc005('0x3e')]+'%'};return _0x4cc775;})});}_0xbab2ed=_['merge']({},_0xbab2ed,_0x60ab47[_0xc005('0x41')]);return _0x2d3fe7[_0xc005('0x4f')](_0xbab2ed);}})[_0xc005('0x25')](function(_0x4e42fd){if(_0x4e42fd){_0x5118db=_0x4e42fd['length'];if(!_0x60ab47[_0xc005('0x33')][_0xc005('0x37')]('nolimit')){_0xbab2ed[_0xc005('0x1f')]=qs[_0xc005('0x1f')](_0x60ab47[_0xc005('0x33')][_0xc005('0x1f')]);_0xbab2ed[_0xc005('0x21')]=qs[_0xc005('0x21')](_0x60ab47[_0xc005('0x33')][_0xc005('0x21')]);}return _0x2d3fe7[_0xc005('0x4f')](_0xbab2ed);}})[_0xc005('0x25')](function(_0x255f7f){if(_0x255f7f){return _0x255f7f?{'count':_0x5118db,'rows':_0x255f7f}:null;}})[_0xc005('0x25')](respondWithResult(_0x74e908,null))[_0xc005('0x45')](handleError(_0x74e908,null));};exports['getSubjects']=function(_0x5470c4,_0x5ec6fd,_0x3271d3){var _0x573c98={};var _0x119e04={};var _0x4cf724;var _0x13c311;return db[_0xc005('0x2d')][_0xc005('0x4d')]({'where':{'id':_0x5470c4['params']['id']}})['then'](handleEntityNotFound(_0x5ec6fd,null))[_0xc005('0x25')](function(_0x34869a){if(_0x34869a){_0x4cf724=_0x34869a;_0x119e04['model']=_[_0xc005('0x47')](db[_0xc005('0x4e')]['rawAttributes']);_0x119e04[_0xc005('0x33')]=_['keys'](_0x5470c4[_0xc005('0x33')]);_0x119e04[_0xc005('0x3c')]=_['intersection'](_0x119e04[_0xc005('0x32')],_0x119e04[_0xc005('0x33')]);_0x573c98['attributes']=_['intersection'](_0x119e04[_0xc005('0x32')],qs[_0xc005('0x36')](_0x5470c4[_0xc005('0x33')]['fields']));_0x573c98['attributes']=_0x573c98[_0xc005('0x34')][_0xc005('0x48')]?_0x573c98[_0xc005('0x34')]:_0x119e04[_0xc005('0x32')];_0x573c98['order']=qs[_0xc005('0x3a')](_0x5470c4[_0xc005('0x33')]['sort']);_0x573c98['where']=qs['filters'](_[_0xc005('0x3d')](_0x5470c4[_0xc005('0x33')],_0x119e04[_0xc005('0x3c')]));if(_0x5470c4[_0xc005('0x33')]['filter']){_0x573c98[_0xc005('0x3b')]=_[_0xc005('0x3f')](_0x573c98[_0xc005('0x3b')],{'$or':_['map'](_0x573c98[_0xc005('0x34')],function(_0x21d5b7){var _0x27be77={};_0x27be77[_0x21d5b7]={'$like':'%'+_0x5470c4[_0xc005('0x33')][_0xc005('0x3e')]+'%'};return _0x27be77;})});}_0x573c98=_[_0xc005('0x3f')]({},_0x573c98,_0x5470c4[_0xc005('0x41')]);return _0x4cf724[_0xc005('0x50')](_0x573c98);}})['then'](function(_0x3224e1){if(_0x3224e1){_0x13c311=_0x3224e1[_0xc005('0x48')];if(!_0x5470c4[_0xc005('0x33')][_0xc005('0x37')](_0xc005('0x38'))){_0x573c98['limit']=qs[_0xc005('0x1f')](_0x5470c4['query']['limit']);_0x573c98[_0xc005('0x21')]=qs[_0xc005('0x21')](_0x5470c4[_0xc005('0x33')][_0xc005('0x21')]);}return _0x4cf724[_0xc005('0x50')](_0x573c98);}})['then'](function(_0x594b38){if(_0x594b38){return _0x594b38?{'count':_0x13c311,'rows':_0x594b38}:null;}})[_0xc005('0x25')](respondWithResult(_0x5ec6fd,null))[_0xc005('0x45')](handleError(_0x5ec6fd,null));};exports[_0xc005('0x51')]=function(_0x2a8447,_0xc52fe,_0x116946){var _0xb88b37={};var _0x2e3f9b={};var _0x3a2b6c;var _0x521d88;return db[_0xc005('0x2d')][_0xc005('0x4d')]({'where':{'id':_0x2a8447['params']['id']}})[_0xc005('0x25')](handleEntityNotFound(_0xc52fe,null))[_0xc005('0x25')](function(_0x19bc42){if(_0x19bc42){_0x3a2b6c=_0x19bc42;_0x2e3f9b[_0xc005('0x32')]=_[_0xc005('0x47')](db[_0xc005('0x4e')][_0xc005('0x2e')]);_0x2e3f9b[_0xc005('0x33')]=_[_0xc005('0x47')](_0x2a8447[_0xc005('0x33')]);_0x2e3f9b[_0xc005('0x3c')]=_[_0xc005('0x35')](_0x2e3f9b['model'],_0x2e3f9b[_0xc005('0x33')]);_0xb88b37[_0xc005('0x34')]=_['intersection'](_0x2e3f9b[_0xc005('0x32')],qs['fields'](_0x2a8447[_0xc005('0x33')][_0xc005('0x36')]));_0xb88b37[_0xc005('0x34')]=_0xb88b37[_0xc005('0x34')][_0xc005('0x48')]?_0xb88b37['attributes']:_0x2e3f9b[_0xc005('0x32')];_0xb88b37[_0xc005('0x39')]=qs[_0xc005('0x3a')](_0x2a8447[_0xc005('0x33')]['sort']);_0xb88b37[_0xc005('0x3b')]=qs[_0xc005('0x3c')](_['pick'](_0x2a8447[_0xc005('0x33')],_0x2e3f9b[_0xc005('0x3c')]));if(_0x2a8447[_0xc005('0x33')][_0xc005('0x3e')]){_0xb88b37['where']=_['merge'](_0xb88b37[_0xc005('0x3b')],{'$or':_[_0xc005('0x2c')](_0xb88b37[_0xc005('0x34')],function(_0x1c46cb){var _0x224e84={};_0x224e84[_0x1c46cb]={'$like':'%'+_0x2a8447[_0xc005('0x33')][_0xc005('0x3e')]+'%'};return _0x224e84;})});}_0xb88b37=_[_0xc005('0x3f')]({},_0xb88b37,_0x2a8447[_0xc005('0x41')]);return _0x3a2b6c[_0xc005('0x51')](_0xb88b37);}})[_0xc005('0x25')](function(_0x4915ae){if(_0x4915ae){_0x521d88=_0x4915ae[_0xc005('0x48')];if(!_0x2a8447[_0xc005('0x33')][_0xc005('0x37')](_0xc005('0x38'))){_0xb88b37[_0xc005('0x1f')]=qs[_0xc005('0x1f')](_0x2a8447[_0xc005('0x33')]['limit']);_0xb88b37[_0xc005('0x21')]=qs[_0xc005('0x21')](_0x2a8447[_0xc005('0x33')][_0xc005('0x21')]);}return _0x3a2b6c[_0xc005('0x51')](_0xb88b37);}})[_0xc005('0x25')](function(_0x1bc374){if(_0x1bc374){return _0x1bc374?{'count':_0x521d88,'rows':_0x1bc374}:null;}})[_0xc005('0x25')](respondWithResult(_0xc52fe,null))[_0xc005('0x45')](handleError(_0xc52fe,null));}; \ No newline at end of file +var _0x4246=['request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','options','find','create','body','update','catch','destroy','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x388eea,_0x340518){var _0x4a175b=function(_0x595f94){while(--_0x595f94){_0x388eea['push'](_0x388eea['shift']());}};_0x4a175b(++_0x340518);}(_0x4246,0xa4));var _0x6424=function(_0x8ade42,_0x2a68fb){_0x8ade42=_0x8ade42-0x0;var _0x256329=_0x4246[_0x8ade42];return _0x256329;};'use strict';var emlformat=require(_0x6424('0x0'));var rimraf=require(_0x6424('0x1'));var zipdir=require(_0x6424('0x2'));var jsonpatch=require(_0x6424('0x3'));var rp=require(_0x6424('0x4'));var moment=require(_0x6424('0x5'));var BPromise=require(_0x6424('0x6'));var Mustache=require(_0x6424('0x7'));var util=require(_0x6424('0x8'));var path=require('path');var sox=require(_0x6424('0x9'));var csv=require('to-csv');var ejs=require(_0x6424('0xa'));var fs=require('fs');var fs_extra=require(_0x6424('0xb'));var _=require(_0x6424('0xc'));var squel=require(_0x6424('0xd'));var crypto=require(_0x6424('0xe'));var jsforce=require(_0x6424('0xf'));var deskjs=require(_0x6424('0x10'));var toCsv=require(_0x6424('0x11'));var querystring=require(_0x6424('0x12'));var Papa=require(_0x6424('0x13'));var Redis=require(_0x6424('0x14'));var authService=require(_0x6424('0x15'));var qs=require(_0x6424('0x16'));var as=require(_0x6424('0x17'));var hardwareService=require(_0x6424('0x18'));var logger=require(_0x6424('0x19'))(_0x6424('0x1a'));var utils=require(_0x6424('0x1b'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46a905,_0xcec93b){_0xcec93b=_0xcec93b||0xcc;return function(_0x4e74bb){if(_0x4e74bb){return _0x46a905[_0x6424('0x1c')](_0xcec93b);}return _0x46a905[_0x6424('0x1d')](_0xcec93b)[_0x6424('0x1e')]();};}function respondWithResult(_0x11aba4,_0x4e1497){_0x4e1497=_0x4e1497||0xc8;return function(_0x1420ed){if(_0x1420ed){return _0x11aba4[_0x6424('0x1d')](_0x4e1497)[_0x6424('0x1f')](_0x1420ed);}};}function respondWithFilteredResult(_0x18dc73,_0x13d37b){return function(_0x5377d1){if(_0x5377d1){var _0x56f60c=typeof _0x13d37b[_0x6424('0x20')]==='undefined'&&typeof _0x13d37b['limit']===_0x6424('0x21');var _0x43ed33=_0x5377d1[_0x6424('0x22')];var _0x5e1451=_0x56f60c?0x0:_0x13d37b[_0x6424('0x20')];var _0x4ad303=_0x56f60c?_0x5377d1[_0x6424('0x22')]:_0x13d37b[_0x6424('0x20')]+_0x13d37b[_0x6424('0x23')];var _0x2796be;if(_0x4ad303>=_0x43ed33){_0x4ad303=_0x43ed33;_0x2796be=0xc8;}else{_0x2796be=0xce;}_0x18dc73[_0x6424('0x1d')](_0x2796be);return _0x18dc73['set'](_0x6424('0x24'),_0x5e1451+'-'+_0x4ad303+'/'+_0x43ed33)[_0x6424('0x1f')](_0x5377d1);}return null;};}function patchUpdates(_0x5dee8c){return function(_0x5bd6b9){try{jsonpatch[_0x6424('0x25')](_0x5bd6b9,_0x5dee8c,!![]);}catch(_0x3b9d71){return BPromise[_0x6424('0x26')](_0x3b9d71);}return _0x5bd6b9['save']();};}function saveUpdates(_0x4e5a6d,_0x131059){return function(_0x20d1f5){if(_0x20d1f5){return _0x20d1f5['update'](_0x4e5a6d)['then'](function(_0x2a8f0d){return _0x2a8f0d;});}return null;};}function removeEntity(_0x12d924,_0x5ebf7d){return function(_0x423f3d){if(_0x423f3d){return _0x423f3d['destroy']()[_0x6424('0x27')](function(){_0x12d924[_0x6424('0x1d')](0xcc)[_0x6424('0x1e')]();});}};}function handleEntityNotFound(_0x2487a6,_0x1e20d6){return function(_0x4286d0){if(!_0x4286d0){_0x2487a6[_0x6424('0x1c')](0x194);}return _0x4286d0;};}function handleError(_0x198a3c,_0x2fa063){_0x2fa063=_0x2fa063||0x1f4;return function(_0x3f5ce0){logger[_0x6424('0x28')](_0x3f5ce0[_0x6424('0x29')]);if(_0x3f5ce0[_0x6424('0x2a')]){delete _0x3f5ce0[_0x6424('0x2a')];}_0x198a3c[_0x6424('0x1d')](_0x2fa063)[_0x6424('0x2b')](_0x3f5ce0);};}exports[_0x6424('0x2c')]=function(_0x1d3afa,_0x31a6a3){var _0x5948d1={},_0x3d125c={},_0x464a8d={'count':0x0,'rows':[]};var _0x25918f=_[_0x6424('0x2d')](db[_0x6424('0x2e')][_0x6424('0x2f')],function(_0x4dd7e5){return{'name':_0x4dd7e5[_0x6424('0x30')],'type':_0x4dd7e5[_0x6424('0x31')][_0x6424('0x32')]};});_0x3d125c[_0x6424('0x33')]=_[_0x6424('0x2d')](_0x25918f,_0x6424('0x2a'));_0x3d125c[_0x6424('0x34')]=_[_0x6424('0x35')](_0x1d3afa[_0x6424('0x34')]);_0x3d125c[_0x6424('0x36')]=_[_0x6424('0x37')](_0x3d125c[_0x6424('0x33')],_0x3d125c[_0x6424('0x34')]);_0x5948d1[_0x6424('0x38')]=_['intersection'](_0x3d125c['model'],qs['fields'](_0x1d3afa['query'][_0x6424('0x39')]));_0x5948d1[_0x6424('0x38')]=_0x5948d1['attributes'][_0x6424('0x3a')]?_0x5948d1[_0x6424('0x38')]:_0x3d125c[_0x6424('0x33')];if(!_0x1d3afa['query'][_0x6424('0x3b')](_0x6424('0x3c'))){_0x5948d1[_0x6424('0x23')]=qs[_0x6424('0x23')](_0x1d3afa[_0x6424('0x34')]['limit']);_0x5948d1[_0x6424('0x20')]=qs[_0x6424('0x20')](_0x1d3afa[_0x6424('0x34')][_0x6424('0x20')]);}_0x5948d1[_0x6424('0x3d')]=qs[_0x6424('0x3e')](_0x1d3afa[_0x6424('0x34')]['sort']);_0x5948d1[_0x6424('0x3f')]=qs['filters'](_[_0x6424('0x40')](_0x1d3afa[_0x6424('0x34')],_0x3d125c['filters']),_0x25918f);if(_0x1d3afa[_0x6424('0x34')][_0x6424('0x41')]){_0x5948d1['where']=_[_0x6424('0x42')](_0x5948d1[_0x6424('0x3f')],{'$or':_[_0x6424('0x2d')](_0x25918f,function(_0x547fa1){if(_0x547fa1['type']!=='VIRTUAL'){var _0xffbdab={};_0xffbdab[_0x547fa1[_0x6424('0x2a')]]={'$like':'%'+_0x1d3afa[_0x6424('0x34')]['filter']+'%'};return _0xffbdab;}})});}_0x5948d1=_['merge']({},_0x5948d1,_0x1d3afa['options']);var _0x15e414={'where':_0x5948d1[_0x6424('0x3f')]};return db['ServicenowConfiguration']['count'](_0x15e414)[_0x6424('0x27')](function(_0x433798){_0x464a8d[_0x6424('0x22')]=_0x433798;if(_0x1d3afa[_0x6424('0x34')][_0x6424('0x43')]){_0x5948d1[_0x6424('0x44')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x6424('0x45')](_0x5948d1);})[_0x6424('0x27')](function(_0x365dab){_0x464a8d['rows']=_0x365dab;return _0x464a8d;})[_0x6424('0x27')](respondWithFilteredResult(_0x31a6a3,_0x5948d1))['catch'](handleError(_0x31a6a3,null));};exports[_0x6424('0x46')]=function(_0x1d7ecc,_0x2a00b1){var _0x12f77b={'raw':![],'where':{'id':_0x1d7ecc[_0x6424('0x47')]['id']}},_0x1920fc={};_0x1920fc[_0x6424('0x33')]=_['keys'](db[_0x6424('0x2e')][_0x6424('0x2f')]);_0x1920fc[_0x6424('0x34')]=_['keys'](_0x1d7ecc[_0x6424('0x34')]);_0x1920fc[_0x6424('0x36')]=_[_0x6424('0x37')](_0x1920fc[_0x6424('0x33')],_0x1920fc[_0x6424('0x34')]);_0x12f77b['attributes']=_['intersection'](_0x1920fc[_0x6424('0x33')],qs[_0x6424('0x39')](_0x1d7ecc[_0x6424('0x34')][_0x6424('0x39')]));_0x12f77b[_0x6424('0x38')]=_0x12f77b['attributes'][_0x6424('0x3a')]?_0x12f77b[_0x6424('0x38')]:_0x1920fc[_0x6424('0x33')];if(_0x1d7ecc['query'][_0x6424('0x43')]){_0x12f77b[_0x6424('0x44')]=[{'all':!![]}];}_0x12f77b=_[_0x6424('0x42')]({},_0x12f77b,_0x1d7ecc[_0x6424('0x48')]);return db[_0x6424('0x2e')][_0x6424('0x49')](_0x12f77b)[_0x6424('0x27')](handleEntityNotFound(_0x2a00b1,null))['then'](respondWithResult(_0x2a00b1,null))['catch'](handleError(_0x2a00b1,null));};exports[_0x6424('0x4a')]=function(_0x181c4e,_0x1a4190){return db[_0x6424('0x2e')]['create'](_0x181c4e[_0x6424('0x4b')],{})[_0x6424('0x27')](respondWithResult(_0x1a4190,0xc9))['catch'](handleError(_0x1a4190,null));};exports[_0x6424('0x4c')]=function(_0x57411a,_0x1af18c){if(_0x57411a['body']['id']){delete _0x57411a['body']['id'];}return db[_0x6424('0x2e')][_0x6424('0x49')]({'where':{'id':_0x57411a[_0x6424('0x47')]['id']}})['then'](handleEntityNotFound(_0x1af18c,null))[_0x6424('0x27')](saveUpdates(_0x57411a[_0x6424('0x4b')],null))[_0x6424('0x27')](respondWithResult(_0x1af18c,null))[_0x6424('0x4d')](handleError(_0x1af18c,null));};exports[_0x6424('0x4e')]=function(_0x3964e7,_0x2402e4){return db['ServicenowConfiguration']['find']({'where':{'id':_0x3964e7[_0x6424('0x47')]['id']}})[_0x6424('0x27')](handleEntityNotFound(_0x2402e4,null))[_0x6424('0x27')](removeEntity(_0x2402e4,null))[_0x6424('0x4d')](handleError(_0x2402e4,null));};exports[_0x6424('0x4f')]=function(_0x3cfa2b,_0x122e65,_0x5e8e67){var _0x35931b={};var _0xf6a8c0={};var _0x198b76;var _0x24786d;return db[_0x6424('0x2e')][_0x6424('0x50')]({'where':{'id':_0x3cfa2b['params']['id']}})['then'](handleEntityNotFound(_0x122e65,null))[_0x6424('0x27')](function(_0x1d47ff){if(_0x1d47ff){_0x198b76=_0x1d47ff;_0xf6a8c0['model']=_[_0x6424('0x35')](db[_0x6424('0x51')]['rawAttributes']);_0xf6a8c0['query']=_[_0x6424('0x35')](_0x3cfa2b[_0x6424('0x34')]);_0xf6a8c0[_0x6424('0x36')]=_[_0x6424('0x37')](_0xf6a8c0[_0x6424('0x33')],_0xf6a8c0[_0x6424('0x34')]);_0x35931b['attributes']=_[_0x6424('0x37')](_0xf6a8c0[_0x6424('0x33')],qs[_0x6424('0x39')](_0x3cfa2b['query']['fields']));_0x35931b['attributes']=_0x35931b[_0x6424('0x38')][_0x6424('0x3a')]?_0x35931b[_0x6424('0x38')]:_0xf6a8c0['model'];_0x35931b[_0x6424('0x3d')]=qs[_0x6424('0x3e')](_0x3cfa2b['query'][_0x6424('0x3e')]);_0x35931b[_0x6424('0x3f')]=qs[_0x6424('0x36')](_[_0x6424('0x40')](_0x3cfa2b[_0x6424('0x34')],_0xf6a8c0[_0x6424('0x36')]));if(_0x3cfa2b['query']['filter']){_0x35931b[_0x6424('0x3f')]=_[_0x6424('0x42')](_0x35931b[_0x6424('0x3f')],{'$or':_[_0x6424('0x2d')](_0x35931b[_0x6424('0x38')],function(_0x98eb35){var _0x5461b8={};_0x5461b8[_0x98eb35]={'$like':'%'+_0x3cfa2b[_0x6424('0x34')][_0x6424('0x41')]+'%'};return _0x5461b8;})});}_0x35931b=_[_0x6424('0x42')]({},_0x35931b,_0x3cfa2b[_0x6424('0x48')]);return _0x198b76[_0x6424('0x4f')](_0x35931b);}})[_0x6424('0x27')](function(_0x542852){if(_0x542852){_0x24786d=_0x542852[_0x6424('0x3a')];if(!_0x3cfa2b['query']['hasOwnProperty'](_0x6424('0x3c'))){_0x35931b[_0x6424('0x23')]=qs[_0x6424('0x23')](_0x3cfa2b[_0x6424('0x34')][_0x6424('0x23')]);_0x35931b[_0x6424('0x20')]=qs[_0x6424('0x20')](_0x3cfa2b['query'][_0x6424('0x20')]);}return _0x198b76['getFields'](_0x35931b);}})['then'](function(_0x8b9e77){if(_0x8b9e77){return _0x8b9e77?{'count':_0x24786d,'rows':_0x8b9e77}:null;}})[_0x6424('0x27')](respondWithResult(_0x122e65,null))[_0x6424('0x4d')](handleError(_0x122e65,null));};exports[_0x6424('0x52')]=function(_0x1a2a38,_0x5ccb54,_0x1336b5){var _0x7e816e={};var _0x3095b9={};var _0x4b584d;var _0x41a559;return db[_0x6424('0x2e')][_0x6424('0x50')]({'where':{'id':_0x1a2a38[_0x6424('0x47')]['id']}})[_0x6424('0x27')](handleEntityNotFound(_0x5ccb54,null))[_0x6424('0x27')](function(_0x56812f){if(_0x56812f){_0x4b584d=_0x56812f;_0x3095b9['model']=_[_0x6424('0x35')](db['ServicenowField']['rawAttributes']);_0x3095b9[_0x6424('0x34')]=_[_0x6424('0x35')](_0x1a2a38['query']);_0x3095b9['filters']=_[_0x6424('0x37')](_0x3095b9[_0x6424('0x33')],_0x3095b9[_0x6424('0x34')]);_0x7e816e[_0x6424('0x38')]=_[_0x6424('0x37')](_0x3095b9[_0x6424('0x33')],qs['fields'](_0x1a2a38['query'][_0x6424('0x39')]));_0x7e816e[_0x6424('0x38')]=_0x7e816e['attributes']['length']?_0x7e816e[_0x6424('0x38')]:_0x3095b9['model'];_0x7e816e['order']=qs[_0x6424('0x3e')](_0x1a2a38[_0x6424('0x34')][_0x6424('0x3e')]);_0x7e816e[_0x6424('0x3f')]=qs[_0x6424('0x36')](_[_0x6424('0x40')](_0x1a2a38[_0x6424('0x34')],_0x3095b9[_0x6424('0x36')]));if(_0x1a2a38[_0x6424('0x34')][_0x6424('0x41')]){_0x7e816e['where']=_[_0x6424('0x42')](_0x7e816e['where'],{'$or':_['map'](_0x7e816e[_0x6424('0x38')],function(_0x58ffb0){var _0x129c5f={};_0x129c5f[_0x58ffb0]={'$like':'%'+_0x1a2a38[_0x6424('0x34')][_0x6424('0x41')]+'%'};return _0x129c5f;})});}_0x7e816e=_[_0x6424('0x42')]({},_0x7e816e,_0x1a2a38['options']);return _0x4b584d[_0x6424('0x52')](_0x7e816e);}})[_0x6424('0x27')](function(_0x10a336){if(_0x10a336){_0x41a559=_0x10a336[_0x6424('0x3a')];if(!_0x1a2a38['query']['hasOwnProperty'](_0x6424('0x3c'))){_0x7e816e['limit']=qs[_0x6424('0x23')](_0x1a2a38[_0x6424('0x34')][_0x6424('0x23')]);_0x7e816e[_0x6424('0x20')]=qs[_0x6424('0x20')](_0x1a2a38['query'][_0x6424('0x20')]);}return _0x4b584d[_0x6424('0x52')](_0x7e816e);}})[_0x6424('0x27')](function(_0x4c0d48){if(_0x4c0d48){return _0x4c0d48?{'count':_0x41a559,'rows':_0x4c0d48}:null;}})[_0x6424('0x27')](respondWithResult(_0x5ccb54,null))['catch'](handleError(_0x5ccb54,null));};exports['getDescriptions']=function(_0x31b289,_0x1adbdf,_0x20d272){var _0x3147e9={};var _0x2f2c82={};var _0x631fb5;var _0x2acbc6;return db[_0x6424('0x2e')][_0x6424('0x50')]({'where':{'id':_0x31b289[_0x6424('0x47')]['id']}})[_0x6424('0x27')](handleEntityNotFound(_0x1adbdf,null))['then'](function(_0x30940){if(_0x30940){_0x631fb5=_0x30940;_0x2f2c82[_0x6424('0x33')]=_['keys'](db['ServicenowField'][_0x6424('0x2f')]);_0x2f2c82[_0x6424('0x34')]=_[_0x6424('0x35')](_0x31b289[_0x6424('0x34')]);_0x2f2c82[_0x6424('0x36')]=_['intersection'](_0x2f2c82[_0x6424('0x33')],_0x2f2c82['query']);_0x3147e9[_0x6424('0x38')]=_['intersection'](_0x2f2c82['model'],qs[_0x6424('0x39')](_0x31b289[_0x6424('0x34')][_0x6424('0x39')]));_0x3147e9[_0x6424('0x38')]=_0x3147e9[_0x6424('0x38')][_0x6424('0x3a')]?_0x3147e9[_0x6424('0x38')]:_0x2f2c82[_0x6424('0x33')];_0x3147e9[_0x6424('0x3d')]=qs[_0x6424('0x3e')](_0x31b289[_0x6424('0x34')][_0x6424('0x3e')]);_0x3147e9[_0x6424('0x3f')]=qs[_0x6424('0x36')](_[_0x6424('0x40')](_0x31b289[_0x6424('0x34')],_0x2f2c82[_0x6424('0x36')]));if(_0x31b289[_0x6424('0x34')][_0x6424('0x41')]){_0x3147e9[_0x6424('0x3f')]=_['merge'](_0x3147e9['where'],{'$or':_[_0x6424('0x2d')](_0x3147e9[_0x6424('0x38')],function(_0x2e75e2){var _0x43dd67={};_0x43dd67[_0x2e75e2]={'$like':'%'+_0x31b289[_0x6424('0x34')]['filter']+'%'};return _0x43dd67;})});}_0x3147e9=_[_0x6424('0x42')]({},_0x3147e9,_0x31b289[_0x6424('0x48')]);return _0x631fb5[_0x6424('0x53')](_0x3147e9);}})[_0x6424('0x27')](function(_0x4c291a){if(_0x4c291a){_0x2acbc6=_0x4c291a['length'];if(!_0x31b289[_0x6424('0x34')][_0x6424('0x3b')](_0x6424('0x3c'))){_0x3147e9[_0x6424('0x23')]=qs['limit'](_0x31b289[_0x6424('0x34')][_0x6424('0x23')]);_0x3147e9[_0x6424('0x20')]=qs[_0x6424('0x20')](_0x31b289['query'][_0x6424('0x20')]);}return _0x631fb5['getDescriptions'](_0x3147e9);}})['then'](function(_0x4dc702){if(_0x4dc702){return _0x4dc702?{'count':_0x2acbc6,'rows':_0x4dc702}:null;}})['then'](respondWithResult(_0x1adbdf,null))[_0x6424('0x4d')](handleError(_0x1adbdf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2b7cfd6..6b3caa8 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 _0x4f9b=['int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','ServicenowConfiguration'];(function(_0x5ea19b,_0xceacfa){var _0x18a9ac=function(_0x4ae80f){while(--_0x4ae80f){_0x5ea19b['push'](_0x5ea19b['shift']());}};_0x18a9ac(++_0xceacfa);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x1bcb52,_0x4d389f){_0x1bcb52=_0x1bcb52-0x0;var _0x1b7865=_0x4f9b[_0x1bcb52];return _0x1b7865;};'use strict';var _=require(_0xb4f9('0x0'));var util=require(_0xb4f9('0x1'));var logger=require(_0xb4f9('0x2'))(_0xb4f9('0x3'));var moment=require(_0xb4f9('0x4'));var BPromise=require(_0xb4f9('0x5'));var rp=require(_0xb4f9('0x6'));var fs=require('fs');var path=require(_0xb4f9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xb4f9('0x8')]=function(_0x38c813,_0x2fa71b){return _0x38c813[_0xb4f9('0x9')](_0xb4f9('0xa'),attributes,{'tableName':_0xb4f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeef7=['../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','rimraf'];(function(_0x673a4a,_0x50e273){var _0x36af23=function(_0x2a4b58){while(--_0x2a4b58){_0x673a4a['push'](_0x673a4a['shift']());}};_0x36af23(++_0x50e273);}(_0xeef7,0x7d));var _0x7eef=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0xeef7[_0x59ab65];return _0x57db9b;};'use strict';var _=require(_0x7eef('0x0'));var util=require(_0x7eef('0x1'));var logger=require('../../config/logger')(_0x7eef('0x2'));var moment=require(_0x7eef('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7eef('0x4'));var config=require(_0x7eef('0x5'));var attributes=require(_0x7eef('0x6'));module['exports']=function(_0x50a702,_0x57b90c){return _0x50a702[_0x7eef('0x7')](_0x7eef('0x8'),attributes,{'tableName':_0x7eef('0x9'),'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 95b9138..a779c6d 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 _0x94a6=['request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x87867b,_0x2cc4fb){var _0xc95e2e=function(_0x5e2300){while(--_0x5e2300){_0x87867b['push'](_0x87867b['shift']());}};_0xc95e2e(++_0x2cc4fb);}(_0x94a6,0x1ec));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x694a('0x0'));var util=require(_0x694a('0x1'));var moment=require('moment');var BPromise=require(_0x694a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x694a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x694a('0x4'));var logger=require(_0x694a('0x5'))(_0x694a('0x6'));var config=require(_0x694a('0x7'));var jayson=require(_0x694a('0x8'));var client=jayson[_0x694a('0x9')][_0x694a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x459677,_0x5e7fbe,_0x5c0a00){return new BPromise(function(_0x3389e2,_0x4ac10e){return client[_0x694a('0xb')](_0x459677,_0x5c0a00)[_0x694a('0xc')](function(_0x394995){logger[_0x694a('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e7fbe,_0x694a('0xe'));logger[_0x694a('0xf')](_0x694a('0x10'),_0x5e7fbe,_0x694a('0xe'),JSON['stringify'](_0x394995));if(_0x394995[_0x694a('0x11')]){if(_0x394995['error'][_0x694a('0x12')]===0x1f4){logger[_0x694a('0x11')](_0x694a('0x13'),_0x5e7fbe,_0x394995[_0x694a('0x11')][_0x694a('0x14')]);return _0x4ac10e(_0x394995[_0x694a('0x11')][_0x694a('0x14')]);}logger[_0x694a('0x11')](_0x694a('0x13'),_0x5e7fbe,_0x394995[_0x694a('0x11')]['message']);return _0x3389e2(_0x394995[_0x694a('0x11')][_0x694a('0x14')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x5e7fbe,_0x694a('0xe'));_0x3389e2(_0x394995[_0x694a('0x15')]['message']);}})[_0x694a('0x16')](function(_0x27b27b){logger[_0x694a('0x11')](_0x694a('0x13'),_0x5e7fbe,_0x27b27b);_0x4ac10e(_0x27b27b);});});} \ No newline at end of file +var _0x8782=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x8782,0x11c));var _0x2878=function(_0x30812e,_0x57c4a5){_0x30812e=_0x30812e-0x0;var _0x48ee58=_0x8782[_0x30812e];return _0x48ee58;};'use strict';var _=require(_0x2878('0x0'));var util=require('util');var moment=require(_0x2878('0x1'));var BPromise=require('bluebird');var rs=require(_0x2878('0x2'));var fs=require('fs');var Redis=require(_0x2878('0x3'));var db=require(_0x2878('0x4'))['db'];var utils=require(_0x2878('0x5'));var logger=require('../../config/logger')(_0x2878('0x6'));var config=require(_0x2878('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2878('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46efb7,_0x4aea95,_0x1e600d){return new BPromise(function(_0x1337f6,_0x51b759){return client['request'](_0x46efb7,_0x1e600d)[_0x2878('0x9')](function(_0x3d08c1){logger[_0x2878('0xa')](_0x2878('0xb'),_0x4aea95,'request\x20sent');logger[_0x2878('0xc')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4aea95,'request\x20sent',JSON['stringify'](_0x3d08c1));if(_0x3d08c1[_0x2878('0xd')]){if(_0x3d08c1[_0x2878('0xd')][_0x2878('0xe')]===0x1f4){logger[_0x2878('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4aea95,_0x3d08c1['error']['message']);return _0x51b759(_0x3d08c1[_0x2878('0xd')][_0x2878('0xf')]);}logger[_0x2878('0xd')](_0x2878('0xb'),_0x4aea95,_0x3d08c1[_0x2878('0xd')][_0x2878('0xf')]);return _0x1337f6(_0x3d08c1[_0x2878('0xd')][_0x2878('0xf')]);}else{logger[_0x2878('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4aea95,_0x2878('0x10'));_0x1337f6(_0x3d08c1[_0x2878('0x11')][_0x2878('0xf')]);}})[_0x2878('0x12')](function(_0x40c2f1){logger[_0x2878('0xd')](_0x2878('0xb'),_0x4aea95,_0x40c2f1);_0x51b759(_0x40c2f1);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e0cb67f..f6e6ca1 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 _0xf9de=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0xf9de,0x1dd));var _0xef9d=function(_0x545867,_0x32f29b){_0x545867=_0x545867-0x0;var _0x5c97af=_0xf9de[_0x545867];return _0x5c97af;};'use strict';var multer=require(_0xef9d('0x0'));var util=require(_0xef9d('0x1'));var path=require(_0xef9d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef9d('0x3')]();var fs_extra=require(_0xef9d('0x4'));var auth=require(_0xef9d('0x5'));var interaction=require(_0xef9d('0x6'));var config=require(_0xef9d('0x7'));var controller=require(_0xef9d('0x8'));router[_0xef9d('0x9')]('/',auth[_0xef9d('0xa')](),controller[_0xef9d('0xb')]);router[_0xef9d('0x9')](_0xef9d('0xc'),auth[_0xef9d('0xa')](),controller[_0xef9d('0xd')]);router[_0xef9d('0xe')]('/',auth['isAuthenticated'](),controller[_0xef9d('0xf')]);router[_0xef9d('0x10')](_0xef9d('0xc'),auth[_0xef9d('0xa')](),controller[_0xef9d('0x11')]);router[_0xef9d('0x12')](_0xef9d('0xc'),auth[_0xef9d('0xa')](),controller[_0xef9d('0x13')]);module[_0xef9d('0x14')]=router; \ No newline at end of file +var _0xa998=['get','isAuthenticated','index','/:id','show','post','put','update','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3cc4c8,_0x114636){var _0xdc0123=function(_0x1c3078){while(--_0x1c3078){_0x3cc4c8['push'](_0x3cc4c8['shift']());}};_0xdc0123(++_0x114636);}(_0xa998,0xf7));var _0x8a99=function(_0x4de37e,_0x219430){_0x4de37e=_0x4de37e-0x0;var _0x5b0687=_0xa998[_0x4de37e];return _0x5b0687;};'use strict';var multer=require('multer');var util=require(_0x8a99('0x0'));var path=require(_0x8a99('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8a99('0x2'));var interaction=require(_0x8a99('0x3'));var config=require(_0x8a99('0x4'));var controller=require('./intServicenowField.controller');router[_0x8a99('0x5')]('/',auth[_0x8a99('0x6')](),controller[_0x8a99('0x7')]);router[_0x8a99('0x5')](_0x8a99('0x8'),auth[_0x8a99('0x6')](),controller[_0x8a99('0x9')]);router[_0x8a99('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8a99('0xb')](_0x8a99('0x8'),auth[_0x8a99('0x6')](),controller[_0x8a99('0xc')]);router['delete'](_0x8a99('0x8'),auth[_0x8a99('0x6')](),controller['destroy']);module[_0x8a99('0xd')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c0ad929..f84add6 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 _0xf158=['variable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x58572c,_0x386076){var _0x1ce1e2=function(_0x5c9aff){while(--_0x5c9aff){_0x58572c['push'](_0x58572c['shift']());}};_0x1ce1e2(++_0x386076);}(_0xf158,0x1d8));var _0x8f15=function(_0x591fdd,_0x51248f){_0x591fdd=_0x591fdd-0x0;var _0x15d93c=_0xf158[_0x591fdd];return _0x15d93c;};'use strict';var Sequelize=require(_0x8f15('0x0'));module[_0x8f15('0x1')]={'type':{'type':Sequelize[_0x8f15('0x2')](_0x8f15('0x3'),_0x8f15('0x4'),'customVariable',_0x8f15('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8f15('0x6')]},'keyType':{'type':Sequelize[_0x8f15('0x2')](_0x8f15('0x3'),_0x8f15('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8f15('0x6')]},'idField':{'type':Sequelize[_0x8f15('0x6')]},'nameField':{'type':Sequelize[_0x8f15('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f15('0x6')]}}; \ No newline at end of file +var _0xf034=['picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xf034,0x70));var _0x4f03=function(_0x525eb3,_0x549ee6){_0x525eb3=_0x525eb3-0x0;var _0x395c23=_0xf034[_0x525eb3];return _0x395c23;};'use strict';var Sequelize=require(_0x4f03('0x0'));module['exports']={'type':{'type':Sequelize[_0x4f03('0x1')](_0x4f03('0x2'),_0x4f03('0x3'),'customVariable',_0x4f03('0x4'),_0x4f03('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4f03('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x4f03('0x3'),_0x4f03('0x7'))},'keyContent':{'type':Sequelize[_0x4f03('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4f03('0x6')]},'customField':{'type':Sequelize[_0x4f03('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 3b95499..c3eba57 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 _0x6b32=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','ServicenowField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','fields','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x6b32,0x10c));var _0x26b3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6b32[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26b3('0x0'));var zipdir=require(_0x26b3('0x1'));var jsonpatch=require(_0x26b3('0x2'));var rp=require(_0x26b3('0x3'));var moment=require(_0x26b3('0x4'));var BPromise=require(_0x26b3('0x5'));var Mustache=require(_0x26b3('0x6'));var util=require(_0x26b3('0x7'));var path=require('path');var sox=require(_0x26b3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26b3('0x9'));var _=require(_0x26b3('0xa'));var squel=require(_0x26b3('0xb'));var crypto=require(_0x26b3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x26b3('0xd'));var querystring=require('querystring');var Papa=require(_0x26b3('0xe'));var Redis=require(_0x26b3('0xf'));var authService=require(_0x26b3('0x10'));var qs=require(_0x26b3('0x11'));var as=require(_0x26b3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26b3('0x13'))('api');var utils=require(_0x26b3('0x14'));var config=require(_0x26b3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x26b3('0x16'))['db'];function respondWithStatusCode(_0x169588,_0x546bed){_0x546bed=_0x546bed||0xcc;return function(_0x1e16a9){if(_0x1e16a9){return _0x169588[_0x26b3('0x17')](_0x546bed);}return _0x169588[_0x26b3('0x18')](_0x546bed)[_0x26b3('0x19')]();};}function respondWithResult(_0xdf26c5,_0x421bac){_0x421bac=_0x421bac||0xc8;return function(_0x3892b0){if(_0x3892b0){return _0xdf26c5[_0x26b3('0x18')](_0x421bac)[_0x26b3('0x1a')](_0x3892b0);}};}function respondWithFilteredResult(_0x15b214,_0x36f0f5){return function(_0x1dfb2c){if(_0x1dfb2c){var _0x3135f6=typeof _0x36f0f5['offset']===_0x26b3('0x1b')&&typeof _0x36f0f5['limit']===_0x26b3('0x1b');var _0x10ae56=_0x1dfb2c[_0x26b3('0x1c')];var _0x421244=_0x3135f6?0x0:_0x36f0f5[_0x26b3('0x1d')];var _0x2dd5ac=_0x3135f6?_0x1dfb2c[_0x26b3('0x1c')]:_0x36f0f5[_0x26b3('0x1d')]+_0x36f0f5[_0x26b3('0x1e')];var _0x56c1e9;if(_0x2dd5ac>=_0x10ae56){_0x2dd5ac=_0x10ae56;_0x56c1e9=0xc8;}else{_0x56c1e9=0xce;}_0x15b214['status'](_0x56c1e9);return _0x15b214[_0x26b3('0x1f')](_0x26b3('0x20'),_0x421244+'-'+_0x2dd5ac+'/'+_0x10ae56)[_0x26b3('0x1a')](_0x1dfb2c);}return null;};}function patchUpdates(_0xc39dbe){return function(_0x5489d7){try{jsonpatch[_0x26b3('0x21')](_0x5489d7,_0xc39dbe,!![]);}catch(_0x42a4a2){return BPromise[_0x26b3('0x22')](_0x42a4a2);}return _0x5489d7[_0x26b3('0x23')]();};}function saveUpdates(_0x3d1a6b,_0xf33801){return function(_0x3a0311){if(_0x3a0311){return _0x3a0311[_0x26b3('0x24')](_0x3d1a6b)[_0x26b3('0x25')](function(_0x1db4cb){return _0x1db4cb;});}return null;};}function removeEntity(_0x2a7bb2,_0x10697d){return function(_0x3b76c0){if(_0x3b76c0){return _0x3b76c0[_0x26b3('0x26')]()[_0x26b3('0x25')](function(){_0x2a7bb2[_0x26b3('0x18')](0xcc)[_0x26b3('0x19')]();});}};}function handleEntityNotFound(_0xd50c1c,_0x580dca){return function(_0x81d4ac){if(!_0x81d4ac){_0xd50c1c[_0x26b3('0x17')](0x194);}return _0x81d4ac;};}function handleError(_0x6f8e18,_0x12d6b5){_0x12d6b5=_0x12d6b5||0x1f4;return function(_0x4156b0){logger[_0x26b3('0x27')](_0x4156b0['stack']);if(_0x4156b0[_0x26b3('0x28')]){delete _0x4156b0[_0x26b3('0x28')];}_0x6f8e18[_0x26b3('0x18')](_0x12d6b5)[_0x26b3('0x29')](_0x4156b0);};}exports[_0x26b3('0x2a')]=function(_0x107f9a,_0x5b05b4){var _0x47e755={},_0x1e6055={},_0x5b5ac8={'count':0x0,'rows':[]};var _0x4e1d1c=_['map'](db[_0x26b3('0x2b')][_0x26b3('0x2c')],function(_0x36f31d){return{'name':_0x36f31d[_0x26b3('0x2d')],'type':_0x36f31d['type'][_0x26b3('0x2e')]};});_0x1e6055[_0x26b3('0x2f')]=_[_0x26b3('0x30')](_0x4e1d1c,_0x26b3('0x28'));_0x1e6055[_0x26b3('0x31')]=_[_0x26b3('0x32')](_0x107f9a[_0x26b3('0x31')]);_0x1e6055[_0x26b3('0x33')]=_[_0x26b3('0x34')](_0x1e6055['model'],_0x1e6055[_0x26b3('0x31')]);_0x47e755[_0x26b3('0x35')]=_[_0x26b3('0x34')](_0x1e6055[_0x26b3('0x2f')],qs['fields'](_0x107f9a[_0x26b3('0x31')]['fields']));_0x47e755['attributes']=_0x47e755[_0x26b3('0x35')][_0x26b3('0x36')]?_0x47e755[_0x26b3('0x35')]:_0x1e6055['model'];if(!_0x107f9a['query'][_0x26b3('0x37')]('nolimit')){_0x47e755[_0x26b3('0x1e')]=qs[_0x26b3('0x1e')](_0x107f9a[_0x26b3('0x31')][_0x26b3('0x1e')]);_0x47e755[_0x26b3('0x1d')]=qs['offset'](_0x107f9a[_0x26b3('0x31')][_0x26b3('0x1d')]);}_0x47e755[_0x26b3('0x38')]=qs['sort'](_0x107f9a[_0x26b3('0x31')][_0x26b3('0x39')]);_0x47e755[_0x26b3('0x3a')]=qs['filters'](_['pick'](_0x107f9a['query'],_0x1e6055['filters']),_0x4e1d1c);if(_0x107f9a[_0x26b3('0x31')]['filter']){_0x47e755[_0x26b3('0x3a')]=_[_0x26b3('0x3b')](_0x47e755['where'],{'$or':_[_0x26b3('0x30')](_0x4e1d1c,function(_0x455351){if(_0x455351['type']!==_0x26b3('0x3c')){var _0x14ff82={};_0x14ff82[_0x455351['name']]={'$like':'%'+_0x107f9a[_0x26b3('0x31')][_0x26b3('0x3d')]+'%'};return _0x14ff82;}})});}_0x47e755=_[_0x26b3('0x3b')]({},_0x47e755,_0x107f9a[_0x26b3('0x3e')]);var _0x23a880={'where':_0x47e755[_0x26b3('0x3a')]};return db['ServicenowField'][_0x26b3('0x1c')](_0x23a880)[_0x26b3('0x25')](function(_0x40025e){_0x5b5ac8['count']=_0x40025e;if(_0x107f9a[_0x26b3('0x31')][_0x26b3('0x3f')]){_0x47e755[_0x26b3('0x40')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x47e755);})[_0x26b3('0x25')](function(_0x4e7709){_0x5b5ac8[_0x26b3('0x41')]=_0x4e7709;return _0x5b5ac8;})['then'](respondWithFilteredResult(_0x5b05b4,_0x47e755))['catch'](handleError(_0x5b05b4,null));};exports[_0x26b3('0x42')]=function(_0x3886dd,_0x3cbb70){var _0x3da095={'raw':!![],'where':{'id':_0x3886dd['params']['id']}},_0x5d9f44={};_0x5d9f44[_0x26b3('0x2f')]=_[_0x26b3('0x32')](db[_0x26b3('0x2b')][_0x26b3('0x2c')]);_0x5d9f44[_0x26b3('0x31')]=_[_0x26b3('0x32')](_0x3886dd['query']);_0x5d9f44[_0x26b3('0x33')]=_[_0x26b3('0x34')](_0x5d9f44[_0x26b3('0x2f')],_0x5d9f44[_0x26b3('0x31')]);_0x3da095[_0x26b3('0x35')]=_['intersection'](_0x5d9f44['model'],qs[_0x26b3('0x43')](_0x3886dd[_0x26b3('0x31')][_0x26b3('0x43')]));_0x3da095[_0x26b3('0x35')]=_0x3da095[_0x26b3('0x35')][_0x26b3('0x36')]?_0x3da095['attributes']:_0x5d9f44[_0x26b3('0x2f')];if(_0x3886dd[_0x26b3('0x31')][_0x26b3('0x3f')]){_0x3da095[_0x26b3('0x40')]=[{'all':!![]}];}_0x3da095=_[_0x26b3('0x3b')]({},_0x3da095,_0x3886dd[_0x26b3('0x3e')]);return db[_0x26b3('0x2b')][_0x26b3('0x44')](_0x3da095)['then'](handleEntityNotFound(_0x3cbb70,null))[_0x26b3('0x25')](respondWithResult(_0x3cbb70,null))[_0x26b3('0x45')](handleError(_0x3cbb70,null));};exports[_0x26b3('0x46')]=function(_0x4f8cba,_0x2cc41a){return db[_0x26b3('0x2b')][_0x26b3('0x46')](_0x4f8cba[_0x26b3('0x47')],{})[_0x26b3('0x25')](respondWithResult(_0x2cc41a,0xc9))[_0x26b3('0x45')](handleError(_0x2cc41a,null));};exports[_0x26b3('0x24')]=function(_0x585871,_0x224f40){if(_0x585871['body']['id']){delete _0x585871['body']['id'];}return db['ServicenowField']['find']({'where':{'id':_0x585871['params']['id']}})['then'](handleEntityNotFound(_0x224f40,null))[_0x26b3('0x25')](saveUpdates(_0x585871[_0x26b3('0x47')],null))[_0x26b3('0x25')](respondWithResult(_0x224f40,null))[_0x26b3('0x45')](handleError(_0x224f40,null));};exports[_0x26b3('0x26')]=function(_0x13d9d0,_0x1e7d12){return db['ServicenowField'][_0x26b3('0x44')]({'where':{'id':_0x13d9d0['params']['id']}})['then'](handleEntityNotFound(_0x1e7d12,null))[_0x26b3('0x25')](removeEntity(_0x1e7d12,null))[_0x26b3('0x45')](handleError(_0x1e7d12,null));}; \ No newline at end of file +var _0xb949=['model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','include','ServicenowField','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x59c7c5,_0x4102db){var _0xbea430=function(_0x9135a2){while(--_0x9135a2){_0x59c7c5['push'](_0x59c7c5['shift']());}};_0xbea430(++_0x4102db);}(_0xb949,0xb9));var _0x9b94=function(_0x5ee38a,_0xc2b579){_0x5ee38a=_0x5ee38a-0x0;var _0x34fc34=_0xb949[_0x5ee38a];return _0x34fc34;};'use strict';var emlformat=require(_0x9b94('0x0'));var rimraf=require(_0x9b94('0x1'));var zipdir=require(_0x9b94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b94('0x3'));var moment=require(_0x9b94('0x4'));var BPromise=require(_0x9b94('0x5'));var Mustache=require(_0x9b94('0x6'));var util=require(_0x9b94('0x7'));var path=require(_0x9b94('0x8'));var sox=require(_0x9b94('0x9'));var csv=require('to-csv');var ejs=require(_0x9b94('0xa'));var fs=require('fs');var fs_extra=require(_0x9b94('0xb'));var _=require(_0x9b94('0xc'));var squel=require(_0x9b94('0xd'));var crypto=require(_0x9b94('0xe'));var jsforce=require(_0x9b94('0xf'));var deskjs=require(_0x9b94('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9b94('0x11'));var Papa=require(_0x9b94('0x12'));var Redis=require(_0x9b94('0x13'));var authService=require(_0x9b94('0x14'));var qs=require(_0x9b94('0x15'));var as=require(_0x9b94('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b94('0x17'))(_0x9b94('0x18'));var utils=require(_0x9b94('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9b94('0x1a'));var db=require(_0x9b94('0x1b'))['db'];function respondWithStatusCode(_0x3a313a,_0x392aa3){_0x392aa3=_0x392aa3||0xcc;return function(_0x358edb){if(_0x358edb){return _0x3a313a[_0x9b94('0x1c')](_0x392aa3);}return _0x3a313a[_0x9b94('0x1d')](_0x392aa3)[_0x9b94('0x1e')]();};}function respondWithResult(_0x5d56af,_0x316aaf){_0x316aaf=_0x316aaf||0xc8;return function(_0x375d78){if(_0x375d78){return _0x5d56af[_0x9b94('0x1d')](_0x316aaf)['json'](_0x375d78);}};}function respondWithFilteredResult(_0x5159ff,_0x421325){return function(_0x3deebc){if(_0x3deebc){var _0x551db9=typeof _0x421325[_0x9b94('0x1f')]===_0x9b94('0x20')&&typeof _0x421325[_0x9b94('0x21')]==='undefined';var _0x2a442e=_0x3deebc['count'];var _0x26a7b0=_0x551db9?0x0:_0x421325['offset'];var _0x2fe966=_0x551db9?_0x3deebc[_0x9b94('0x22')]:_0x421325[_0x9b94('0x1f')]+_0x421325['limit'];var _0xa9e10c;if(_0x2fe966>=_0x2a442e){_0x2fe966=_0x2a442e;_0xa9e10c=0xc8;}else{_0xa9e10c=0xce;}_0x5159ff[_0x9b94('0x1d')](_0xa9e10c);return _0x5159ff[_0x9b94('0x23')](_0x9b94('0x24'),_0x26a7b0+'-'+_0x2fe966+'/'+_0x2a442e)[_0x9b94('0x25')](_0x3deebc);}return null;};}function patchUpdates(_0x23bbd2){return function(_0x221e33){try{jsonpatch[_0x9b94('0x26')](_0x221e33,_0x23bbd2,!![]);}catch(_0x2f66dc){return BPromise[_0x9b94('0x27')](_0x2f66dc);}return _0x221e33['save']();};}function saveUpdates(_0x2273a3,_0x2e37c3){return function(_0x50d65c){if(_0x50d65c){return _0x50d65c[_0x9b94('0x28')](_0x2273a3)[_0x9b94('0x29')](function(_0x2d98e3){return _0x2d98e3;});}return null;};}function removeEntity(_0x3a9e33,_0x5c9a25){return function(_0x58e3d8){if(_0x58e3d8){return _0x58e3d8[_0x9b94('0x2a')]()['then'](function(){_0x3a9e33['status'](0xcc)[_0x9b94('0x1e')]();});}};}function handleEntityNotFound(_0x75d1a3,_0x4ef114){return function(_0x4a12d3){if(!_0x4a12d3){_0x75d1a3[_0x9b94('0x1c')](0x194);}return _0x4a12d3;};}function handleError(_0xfb811,_0x1c3913){_0x1c3913=_0x1c3913||0x1f4;return function(_0x1be72a){logger[_0x9b94('0x2b')](_0x1be72a[_0x9b94('0x2c')]);if(_0x1be72a['name']){delete _0x1be72a['name'];}_0xfb811['status'](_0x1c3913)[_0x9b94('0x2d')](_0x1be72a);};}exports[_0x9b94('0x2e')]=function(_0x614229,_0x35e998){var _0x226f1e={},_0x988081={},_0x32fec6={'count':0x0,'rows':[]};var _0x20e166=_[_0x9b94('0x2f')](db['ServicenowField'][_0x9b94('0x30')],function(_0x2ea396){return{'name':_0x2ea396[_0x9b94('0x31')],'type':_0x2ea396[_0x9b94('0x32')][_0x9b94('0x33')]};});_0x988081[_0x9b94('0x34')]=_['map'](_0x20e166,'name');_0x988081[_0x9b94('0x35')]=_[_0x9b94('0x36')](_0x614229[_0x9b94('0x35')]);_0x988081[_0x9b94('0x37')]=_[_0x9b94('0x38')](_0x988081['model'],_0x988081['query']);_0x226f1e[_0x9b94('0x39')]=_[_0x9b94('0x38')](_0x988081['model'],qs[_0x9b94('0x3a')](_0x614229[_0x9b94('0x35')]['fields']));_0x226f1e[_0x9b94('0x39')]=_0x226f1e[_0x9b94('0x39')][_0x9b94('0x3b')]?_0x226f1e['attributes']:_0x988081[_0x9b94('0x34')];if(!_0x614229[_0x9b94('0x35')]['hasOwnProperty']('nolimit')){_0x226f1e[_0x9b94('0x21')]=qs[_0x9b94('0x21')](_0x614229[_0x9b94('0x35')][_0x9b94('0x21')]);_0x226f1e[_0x9b94('0x1f')]=qs['offset'](_0x614229['query'][_0x9b94('0x1f')]);}_0x226f1e[_0x9b94('0x3c')]=qs[_0x9b94('0x3d')](_0x614229[_0x9b94('0x35')][_0x9b94('0x3d')]);_0x226f1e[_0x9b94('0x3e')]=qs['filters'](_[_0x9b94('0x3f')](_0x614229[_0x9b94('0x35')],_0x988081['filters']),_0x20e166);if(_0x614229[_0x9b94('0x35')][_0x9b94('0x40')]){_0x226f1e[_0x9b94('0x3e')]=_['merge'](_0x226f1e[_0x9b94('0x3e')],{'$or':_[_0x9b94('0x2f')](_0x20e166,function(_0x2a0882){if(_0x2a0882['type']!==_0x9b94('0x41')){var _0x52f3dc={};_0x52f3dc[_0x2a0882['name']]={'$like':'%'+_0x614229['query'][_0x9b94('0x40')]+'%'};return _0x52f3dc;}})});}_0x226f1e=_[_0x9b94('0x42')]({},_0x226f1e,_0x614229[_0x9b94('0x43')]);var _0x45f6cc={'where':_0x226f1e[_0x9b94('0x3e')]};return db['ServicenowField'][_0x9b94('0x22')](_0x45f6cc)[_0x9b94('0x29')](function(_0x441fec){_0x32fec6[_0x9b94('0x22')]=_0x441fec;if(_0x614229[_0x9b94('0x35')]['includeAll']){_0x226f1e[_0x9b94('0x44')]=[{'all':!![]}];}return db[_0x9b94('0x45')][_0x9b94('0x46')](_0x226f1e);})[_0x9b94('0x29')](function(_0x2f715c){_0x32fec6[_0x9b94('0x47')]=_0x2f715c;return _0x32fec6;})[_0x9b94('0x29')](respondWithFilteredResult(_0x35e998,_0x226f1e))[_0x9b94('0x48')](handleError(_0x35e998,null));};exports[_0x9b94('0x49')]=function(_0x3a3146,_0x159305){var _0x6b6220={'raw':!![],'where':{'id':_0x3a3146[_0x9b94('0x4a')]['id']}},_0x53e75c={};_0x53e75c[_0x9b94('0x34')]=_[_0x9b94('0x36')](db[_0x9b94('0x45')][_0x9b94('0x30')]);_0x53e75c[_0x9b94('0x35')]=_['keys'](_0x3a3146[_0x9b94('0x35')]);_0x53e75c[_0x9b94('0x37')]=_[_0x9b94('0x38')](_0x53e75c['model'],_0x53e75c['query']);_0x6b6220[_0x9b94('0x39')]=_[_0x9b94('0x38')](_0x53e75c[_0x9b94('0x34')],qs[_0x9b94('0x3a')](_0x3a3146['query'][_0x9b94('0x3a')]));_0x6b6220[_0x9b94('0x39')]=_0x6b6220['attributes'][_0x9b94('0x3b')]?_0x6b6220[_0x9b94('0x39')]:_0x53e75c[_0x9b94('0x34')];if(_0x3a3146[_0x9b94('0x35')][_0x9b94('0x4b')]){_0x6b6220[_0x9b94('0x44')]=[{'all':!![]}];}_0x6b6220=_[_0x9b94('0x42')]({},_0x6b6220,_0x3a3146[_0x9b94('0x43')]);return db[_0x9b94('0x45')][_0x9b94('0x4c')](_0x6b6220)[_0x9b94('0x29')](handleEntityNotFound(_0x159305,null))[_0x9b94('0x29')](respondWithResult(_0x159305,null))[_0x9b94('0x48')](handleError(_0x159305,null));};exports[_0x9b94('0x4d')]=function(_0xf36ff,_0x572aef){return db[_0x9b94('0x45')]['create'](_0xf36ff[_0x9b94('0x4e')],{})['then'](respondWithResult(_0x572aef,0xc9))[_0x9b94('0x48')](handleError(_0x572aef,null));};exports[_0x9b94('0x28')]=function(_0x4aadde,_0x54c43c){if(_0x4aadde['body']['id']){delete _0x4aadde['body']['id'];}return db[_0x9b94('0x45')]['find']({'where':{'id':_0x4aadde['params']['id']}})[_0x9b94('0x29')](handleEntityNotFound(_0x54c43c,null))[_0x9b94('0x29')](saveUpdates(_0x4aadde[_0x9b94('0x4e')],null))[_0x9b94('0x29')](respondWithResult(_0x54c43c,null))['catch'](handleError(_0x54c43c,null));};exports['destroy']=function(_0x5294fd,_0x14a9d5){return db[_0x9b94('0x45')][_0x9b94('0x4c')]({'where':{'id':_0x5294fd[_0x9b94('0x4a')]['id']}})[_0x9b94('0x29')](handleEntityNotFound(_0x14a9d5,null))['then'](removeEntity(_0x14a9d5,null))['catch'](handleError(_0x14a9d5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 55b1277..084a454 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 _0xc367=['../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0xc367,0x14b));var _0x7c36=function(_0x5694bd,_0x3d29f0){_0x5694bd=_0x5694bd-0x0;var _0x42ca79=_0xc367[_0x5694bd];return _0x42ca79;};'use strict';var _=require(_0x7c36('0x0'));var util=require(_0x7c36('0x1'));var logger=require(_0x7c36('0x2'))(_0x7c36('0x3'));var moment=require(_0x7c36('0x4'));var BPromise=require(_0x7c36('0x5'));var rp=require(_0x7c36('0x6'));var fs=require('fs');var path=require(_0x7c36('0x7'));var rimraf=require(_0x7c36('0x8'));var config=require(_0x7c36('0x9'));var attributes=require(_0x7c36('0xa'));module[_0x7c36('0xb')]=function(_0x28e1c4,_0x44eb37){return _0x28e1c4[_0x7c36('0xc')](_0x7c36('0xd'),attributes,{'tableName':_0x7c36('0xe'),'paranoid':![],'indexes':[{'name':_0x7c36('0xf'),'fields':['idField',_0x7c36('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65f0=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x59255c,_0x365f40){var _0x20c573=function(_0xd68156){while(--_0xd68156){_0x59255c['push'](_0x59255c['shift']());}};_0x20c573(++_0x365f40);}(_0x65f0,0x105));var _0x065f=function(_0x12a96c,_0x3175f3){_0x12a96c=_0x12a96c-0x0;var _0x1a7344=_0x65f0[_0x12a96c];return _0x1a7344;};'use strict';var _=require(_0x065f('0x0'));var util=require(_0x065f('0x1'));var logger=require(_0x065f('0x2'))(_0x065f('0x3'));var moment=require(_0x065f('0x4'));var BPromise=require(_0x065f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x065f('0x6'));var rimraf=require(_0x065f('0x7'));var config=require(_0x065f('0x8'));var attributes=require(_0x065f('0x9'));module[_0x065f('0xa')]=function(_0x48d7ad,_0x2f9cb8){return _0x48d7ad[_0x065f('0xb')](_0x065f('0xc'),attributes,{'tableName':_0x065f('0xd'),'paranoid':![],'indexes':[{'name':_0x065f('0xe'),'fields':['idField',_0x065f('0xf')],'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 60fec03..d9951bd 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x304e0e,_0x2654a3){var _0x4449c8=function(_0x5a9242){while(--_0x5a9242){_0x304e0e['push'](_0x304e0e['shift']());}};_0x4449c8(++_0x2654a3);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1952fd,_0x5416e0){_0x1952fd=_0x1952fd-0x0;var _0x4f554c=_0xf4eb[_0x1952fd];return _0x4f554c;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _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(_0x37abba,_0x14e220){var _0x487ae1=function(_0x56343){while(--_0x56343){_0x37abba['push'](_0x37abba['shift']());}};_0x487ae1(++_0x14e220);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'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 36320e6..e98d3c6 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xc12c5f,_0x8c43f5){var _0x469332=function(_0x216a9b){while(--_0x216a9b){_0xc12c5f['push'](_0xc12c5f['shift']());}};_0x469332(++_0x8c43f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1824e2,_0xaa16ca){var _0x1f2cec=function(_0x1aab6b){while(--_0x1aab6b){_0x1824e2['push'](_0x1824e2['shift']());}};_0x1f2cec(++_0xaa16ca);}(_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/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 b2f011b..38ef61d 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(_0x3d156f,_0x263ab4){var _0x4fdcdb=function(_0x299f6f){while(--_0x299f6f){_0x3d156f['push'](_0x3d156f['shift']());}};_0x4fdcdb(++_0x263ab4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x546017,_0x2a43ca){var _0xb100b3=function(_0xc73fed){while(--_0xc73fed){_0x546017['push'](_0x546017['shift']());}};_0xb100b3(++_0x2a43ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 3672e29..cf28f97 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 _0xcf1d=['stack','name','send','index','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','SugarcrmAccount','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','length','filter','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error'];(function(_0x37ede0,_0x238899){var _0x4a7c39=function(_0xe6fbc1){while(--_0xe6fbc1){_0x37ede0['push'](_0x37ede0['shift']());}};_0x4a7c39(++_0x238899);}(_0xcf1d,0x143));var _0xdcf1=function(_0x1c6af1,_0x3cadc6){_0x1c6af1=_0x1c6af1-0x0;var _0x1ef3a3=_0xcf1d[_0x1c6af1];return _0x1ef3a3;};'use strict';var emlformat=require(_0xdcf1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcf1('0x1'));var jsonpatch=require(_0xdcf1('0x2'));var rp=require(_0xdcf1('0x3'));var moment=require(_0xdcf1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcf1('0x5'));var util=require(_0xdcf1('0x6'));var path=require(_0xdcf1('0x7'));var sox=require(_0xdcf1('0x8'));var csv=require(_0xdcf1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcf1('0xa'));var _=require(_0xdcf1('0xb'));var squel=require(_0xdcf1('0xc'));var crypto=require(_0xdcf1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdcf1('0x9'));var querystring=require(_0xdcf1('0xe'));var Papa=require(_0xdcf1('0xf'));var Redis=require(_0xdcf1('0x10'));var authService=require(_0xdcf1('0x11'));var qs=require(_0xdcf1('0x12'));var as=require(_0xdcf1('0x13'));var hardwareService=require(_0xdcf1('0x14'));var logger=require(_0xdcf1('0x15'))(_0xdcf1('0x16'));var utils=require(_0xdcf1('0x17'));var config=require(_0xdcf1('0x18'));var licenseUtil=require(_0xdcf1('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdcf1('0x1a'));function respondWithStatusCode(_0x1cfc03,_0x4e9e93){_0x4e9e93=_0x4e9e93||0xcc;return function(_0x47d2a2){if(_0x47d2a2){return _0x1cfc03[_0xdcf1('0x1b')](_0x4e9e93);}return _0x1cfc03[_0xdcf1('0x1c')](_0x4e9e93)[_0xdcf1('0x1d')]();};}function respondWithResult(_0x54e9da,_0x22042e){_0x22042e=_0x22042e||0xc8;return function(_0x17069e){if(_0x17069e){return _0x54e9da[_0xdcf1('0x1c')](_0x22042e)[_0xdcf1('0x1e')](_0x17069e);}};}function respondWithFilteredResult(_0x7088e3,_0x5b9cfb){return function(_0x458124){if(_0x458124){var _0x585cb9=typeof _0x5b9cfb[_0xdcf1('0x1f')]===_0xdcf1('0x20')&&typeof _0x5b9cfb[_0xdcf1('0x21')]===_0xdcf1('0x20');var _0x114a8b=_0x458124['count'];var _0x561976=_0x585cb9?0x0:_0x5b9cfb[_0xdcf1('0x1f')];var _0x2444fe=_0x585cb9?_0x458124[_0xdcf1('0x22')]:_0x5b9cfb['offset']+_0x5b9cfb[_0xdcf1('0x21')];var _0x24ca28;if(_0x2444fe>=_0x114a8b){_0x2444fe=_0x114a8b;_0x24ca28=0xc8;}else{_0x24ca28=0xce;}_0x7088e3[_0xdcf1('0x1c')](_0x24ca28);return _0x7088e3[_0xdcf1('0x23')](_0xdcf1('0x24'),_0x561976+'-'+_0x2444fe+'/'+_0x114a8b)['json'](_0x458124);}return null;};}function patchUpdates(_0x5bfa6e){return function(_0x3b3930){try{jsonpatch['apply'](_0x3b3930,_0x5bfa6e,!![]);}catch(_0xbf537){return BPromise[_0xdcf1('0x25')](_0xbf537);}return _0x3b3930[_0xdcf1('0x26')]();};}function saveUpdates(_0x29bf8f,_0x10ccce){return function(_0x23bfaa){if(_0x23bfaa){return _0x23bfaa[_0xdcf1('0x27')](_0x29bf8f)['then'](function(_0x3adede){return _0x3adede;});}return null;};}function removeEntity(_0x3e81ab,_0x506702){return function(_0x526190){if(_0x526190){return _0x526190[_0xdcf1('0x28')]()[_0xdcf1('0x29')](function(){_0x3e81ab[_0xdcf1('0x1c')](0xcc)[_0xdcf1('0x1d')]();});}};}function handleEntityNotFound(_0x42ce88,_0x13f8f5){return function(_0x4addb3){if(!_0x4addb3){_0x42ce88['sendStatus'](0x194);}return _0x4addb3;};}function handleError(_0x326d0f,_0x3c1dd4){_0x3c1dd4=_0x3c1dd4||0x1f4;return function(_0x142a31){logger[_0xdcf1('0x2a')](_0x142a31[_0xdcf1('0x2b')]);if(_0x142a31[_0xdcf1('0x2c')]){delete _0x142a31[_0xdcf1('0x2c')];}_0x326d0f[_0xdcf1('0x1c')](_0x3c1dd4)[_0xdcf1('0x2d')](_0x142a31);};}exports[_0xdcf1('0x2e')]=function(_0x14d70d,_0x1210d3){var _0x487fdd={},_0x22ced3={},_0x5d266e={'count':0x0,'rows':[]};var _0xb4bf25=_['map'](db['SugarcrmAccount']['rawAttributes'],function(_0x1284f1){return{'name':_0x1284f1[_0xdcf1('0x2f')],'type':_0x1284f1[_0xdcf1('0x30')][_0xdcf1('0x31')]};});_0x22ced3['model']=_[_0xdcf1('0x32')](_0xb4bf25,'name');_0x22ced3[_0xdcf1('0x33')]=_[_0xdcf1('0x34')](_0x14d70d['query']);_0x22ced3[_0xdcf1('0x35')]=_[_0xdcf1('0x36')](_0x22ced3[_0xdcf1('0x37')],_0x22ced3[_0xdcf1('0x33')]);_0x487fdd[_0xdcf1('0x38')]=_['intersection'](_0x22ced3[_0xdcf1('0x37')],qs[_0xdcf1('0x39')](_0x14d70d['query'][_0xdcf1('0x39')]));_0x487fdd['attributes']=_0x487fdd[_0xdcf1('0x38')]['length']?_0x487fdd[_0xdcf1('0x38')]:_0x22ced3['model'];if(!_0x14d70d[_0xdcf1('0x33')][_0xdcf1('0x3a')](_0xdcf1('0x3b'))){_0x487fdd['limit']=qs['limit'](_0x14d70d[_0xdcf1('0x33')][_0xdcf1('0x21')]);_0x487fdd[_0xdcf1('0x1f')]=qs[_0xdcf1('0x1f')](_0x14d70d['query'][_0xdcf1('0x1f')]);}_0x487fdd[_0xdcf1('0x3c')]=qs[_0xdcf1('0x3d')](_0x14d70d[_0xdcf1('0x33')][_0xdcf1('0x3d')]);_0x487fdd['where']=qs['filters'](_[_0xdcf1('0x3e')](_0x14d70d[_0xdcf1('0x33')],_0x22ced3['filters']),_0xb4bf25);if(_0x14d70d[_0xdcf1('0x33')]['filter']){_0x487fdd[_0xdcf1('0x3f')]=_[_0xdcf1('0x40')](_0x487fdd[_0xdcf1('0x3f')],{'$or':_['map'](_0xb4bf25,function(_0x4ae70b){if(_0x4ae70b['type']!=='VIRTUAL'){var _0x3c8058={};_0x3c8058[_0x4ae70b[_0xdcf1('0x2c')]]={'$like':'%'+_0x14d70d[_0xdcf1('0x33')]['filter']+'%'};return _0x3c8058;}})});}_0x487fdd=_[_0xdcf1('0x40')]({},_0x487fdd,_0x14d70d[_0xdcf1('0x41')]);var _0x503208={'where':_0x487fdd['where']};return db[_0xdcf1('0x42')][_0xdcf1('0x22')](_0x503208)['then'](function(_0x31546b){_0x5d266e[_0xdcf1('0x22')]=_0x31546b;if(_0x14d70d['query'][_0xdcf1('0x43')]){_0x487fdd[_0xdcf1('0x44')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xdcf1('0x45')](_0x487fdd);})[_0xdcf1('0x29')](function(_0x474955){_0x5d266e[_0xdcf1('0x46')]=_0x474955;return _0x5d266e;})[_0xdcf1('0x29')](respondWithFilteredResult(_0x1210d3,_0x487fdd))['catch'](handleError(_0x1210d3,null));};exports['show']=function(_0xc40b69,_0x440720){var _0x182fe8={'raw':![],'where':{'id':_0xc40b69[_0xdcf1('0x47')]['id']}},_0x35cb0a={};_0x35cb0a[_0xdcf1('0x37')]=_[_0xdcf1('0x34')](db[_0xdcf1('0x42')][_0xdcf1('0x48')]);_0x35cb0a['query']=_[_0xdcf1('0x34')](_0xc40b69[_0xdcf1('0x33')]);_0x35cb0a[_0xdcf1('0x35')]=_[_0xdcf1('0x36')](_0x35cb0a['model'],_0x35cb0a[_0xdcf1('0x33')]);_0x182fe8[_0xdcf1('0x38')]=_[_0xdcf1('0x36')](_0x35cb0a[_0xdcf1('0x37')],qs[_0xdcf1('0x39')](_0xc40b69[_0xdcf1('0x33')][_0xdcf1('0x39')]));_0x182fe8[_0xdcf1('0x38')]=_0x182fe8[_0xdcf1('0x38')]['length']?_0x182fe8[_0xdcf1('0x38')]:_0x35cb0a[_0xdcf1('0x37')];if(_0xc40b69['query'][_0xdcf1('0x43')]){_0x182fe8['include']=[{'all':!![]}];}_0x182fe8=_[_0xdcf1('0x40')]({},_0x182fe8,_0xc40b69[_0xdcf1('0x41')]);return db[_0xdcf1('0x42')][_0xdcf1('0x49')](_0x182fe8)[_0xdcf1('0x29')](handleEntityNotFound(_0x440720,null))['then'](respondWithResult(_0x440720,null))[_0xdcf1('0x4a')](handleError(_0x440720,null));};exports[_0xdcf1('0x4b')]=function(_0x54f74a,_0x4d8adb){return db[_0xdcf1('0x42')][_0xdcf1('0x4b')](_0x54f74a['body'],{})['then'](respondWithResult(_0x4d8adb,0xc9))['catch'](handleError(_0x4d8adb,null));};exports[_0xdcf1('0x27')]=function(_0x91243,_0x4955d2){if(_0x91243[_0xdcf1('0x4c')]['id']){delete _0x91243[_0xdcf1('0x4c')]['id'];}return db[_0xdcf1('0x42')][_0xdcf1('0x49')]({'where':{'id':_0x91243[_0xdcf1('0x47')]['id']}})['then'](handleEntityNotFound(_0x4955d2,null))[_0xdcf1('0x29')](saveUpdates(_0x91243[_0xdcf1('0x4c')],null))['then'](respondWithResult(_0x4955d2,null))[_0xdcf1('0x4a')](handleError(_0x4955d2,null));};exports[_0xdcf1('0x28')]=function(_0x550d5c,_0x3460cd){return db[_0xdcf1('0x42')][_0xdcf1('0x49')]({'where':{'id':_0x550d5c['params']['id']}})[_0xdcf1('0x29')](handleEntityNotFound(_0x3460cd,null))[_0xdcf1('0x29')](removeEntity(_0x3460cd,null))[_0xdcf1('0x4a')](handleError(_0x3460cd,null));};exports[_0xdcf1('0x4d')]=function(_0x4f0516,_0x2dcf42,_0x4cad68){var _0x32fda6={};var _0x959592={};var _0x5721e3;var _0x17713f;return db[_0xdcf1('0x42')][_0xdcf1('0x4e')]({'where':{'id':_0x4f0516['params']['id']}})[_0xdcf1('0x29')](handleEntityNotFound(_0x2dcf42,null))[_0xdcf1('0x29')](function(_0x26a03d){if(_0x26a03d){_0x5721e3=_0x26a03d;_0x959592[_0xdcf1('0x37')]=_[_0xdcf1('0x34')](db[_0xdcf1('0x4f')][_0xdcf1('0x48')]);_0x959592['query']=_[_0xdcf1('0x34')](_0x4f0516['query']);_0x959592[_0xdcf1('0x35')]=_['intersection'](_0x959592[_0xdcf1('0x37')],_0x959592['query']);_0x32fda6[_0xdcf1('0x38')]=_[_0xdcf1('0x36')](_0x959592['model'],qs[_0xdcf1('0x39')](_0x4f0516[_0xdcf1('0x33')][_0xdcf1('0x39')]));_0x32fda6[_0xdcf1('0x38')]=_0x32fda6['attributes'][_0xdcf1('0x50')]?_0x32fda6[_0xdcf1('0x38')]:_0x959592['model'];_0x32fda6[_0xdcf1('0x3c')]=qs[_0xdcf1('0x3d')](_0x4f0516['query'][_0xdcf1('0x3d')]);_0x32fda6[_0xdcf1('0x3f')]=qs[_0xdcf1('0x35')](_[_0xdcf1('0x3e')](_0x4f0516['query'],_0x959592[_0xdcf1('0x35')]));if(_0x4f0516['query'][_0xdcf1('0x51')]){_0x32fda6['where']=_[_0xdcf1('0x40')](_0x32fda6[_0xdcf1('0x3f')],{'$or':_['map'](_0x32fda6['attributes'],function(_0x596e66){var _0x3d4369={};_0x3d4369[_0x596e66]={'$like':'%'+_0x4f0516[_0xdcf1('0x33')][_0xdcf1('0x51')]+'%'};return _0x3d4369;})});}_0x32fda6=_[_0xdcf1('0x40')]({},_0x32fda6,_0x4f0516['options']);return _0x5721e3['getConfigurations'](_0x32fda6);}})[_0xdcf1('0x29')](function(_0x5d8d54){if(_0x5d8d54){_0x17713f=_0x5d8d54[_0xdcf1('0x50')];if(!_0x4f0516[_0xdcf1('0x33')][_0xdcf1('0x3a')]('nolimit')){_0x32fda6[_0xdcf1('0x21')]=qs[_0xdcf1('0x21')](_0x4f0516['query'][_0xdcf1('0x21')]);_0x32fda6[_0xdcf1('0x1f')]=qs[_0xdcf1('0x1f')](_0x4f0516[_0xdcf1('0x33')]['offset']);}return _0x5721e3[_0xdcf1('0x4d')](_0x32fda6);}})['then'](function(_0x175871){if(_0x175871){return _0x175871?{'count':_0x17713f,'rows':_0x175871}:null;}})[_0xdcf1('0x29')](respondWithResult(_0x2dcf42,null))['catch'](handleError(_0x2dcf42,null));};exports[_0xdcf1('0x52')]=function(_0x547cf6,_0x58796a,_0x2142f0){if(_0x547cf6[_0xdcf1('0x4c')]['id']){delete _0x547cf6[_0xdcf1('0x4c')]['id'];}return db['SugarcrmAccount'][_0xdcf1('0x4e')]({'where':{'id':_0x547cf6['params']['id']}})[_0xdcf1('0x29')](handleEntityNotFound(_0x58796a,null))[_0xdcf1('0x29')](function(_0x279e8b){if(_0x279e8b){_0x547cf6[_0xdcf1('0x4c')]['AccountId']=_0x279e8b['id'];_0x547cf6[_0xdcf1('0x4c')][_0xdcf1('0x53')]=integrations[_0xdcf1('0x54')](_0x547cf6['body'][_0xdcf1('0x55')],_0x547cf6[_0xdcf1('0x4c')]['type']);_0x547cf6['body'][_0xdcf1('0x56')]=integrations[_0xdcf1('0x57')](_0x547cf6[_0xdcf1('0x4c')][_0xdcf1('0x55')],_0x547cf6[_0xdcf1('0x4c')][_0xdcf1('0x30')]);return db[_0xdcf1('0x4f')]['create'](_0x547cf6['body'],{'include':[{'model':db[_0xdcf1('0x58')],'as':_0xdcf1('0x53')},{'model':db[_0xdcf1('0x58')],'as':_0xdcf1('0x56')}]});}return null;})[_0xdcf1('0x29')](respondWithResult(_0x58796a,null))[_0xdcf1('0x4a')](handleError(_0x58796a,null));};exports['getFields']=function(_0x5c958e,_0x274dc6,_0x144fb4){var _0x51094b='';var _0x3b4c64=['id',_0xdcf1('0x2c'),_0xdcf1('0x59'),_0xdcf1('0x5a'),'description',_0xdcf1('0x5b'),_0xdcf1('0x5c'),_0xdcf1('0x5d'),_0xdcf1('0x5e'),_0xdcf1('0x5f'),_0xdcf1('0x60'),_0xdcf1('0x61')];return db[_0xdcf1('0x42')]['findOne']({'where':{'id':_0x5c958e[_0xdcf1('0x47')]['id']},'attributes':['id',_0xdcf1('0x62'),_0xdcf1('0x63'),_0xdcf1('0x64')]})[_0xdcf1('0x29')](handleEntityNotFound(_0x274dc6,null))['then'](function(_0x2f5197){if(_0x2f5197){_0x51094b=_0x2f5197[_0xdcf1('0x64')];var _0x332026=_0x51094b['slice'](-0x1);if(_0x332026==='/'){_0x51094b=_0x51094b['substring'](0x0,_0x51094b['lastIndexOf'](_0x332026));}return rp({'method':_0xdcf1('0x65'),'uri':util[_0xdcf1('0x66')](_0xdcf1('0x67'),_0x51094b,_0xdcf1('0x68')),'json':!![],'form':{'method':_0xdcf1('0x69'),'input_type':_0xdcf1('0x6a'),'response_type':_0xdcf1('0x6a'),'rest_data':JSON[_0xdcf1('0x6b')]({'user_auth':{'user_name':_0x2f5197['username'],'password':_0x2f5197[_0xdcf1('0x63')],'encryption':'PLAIN'},'application':_0xdcf1('0x6c')})}});}})[_0xdcf1('0x29')](function(_0x12306d){if(_0x12306d&&_0x12306d[_0xdcf1('0x2c')]!==_0xdcf1('0x6d')&&_0x12306d['name']!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xdcf1('0x66')](_0xdcf1('0x67'),_0x51094b,_0xdcf1('0x68')),'json':!![],'form':{'method':_0xdcf1('0x6e'),'input_type':_0xdcf1('0x6a'),'response_type':'JSON','rest_data':JSON[_0xdcf1('0x6b')]({'session':_0x12306d['id'],'module_name':_0xdcf1('0x6f')})}})['then'](function(_0x3109e4){if(_0x3109e4){var _0xc8430c=_[_0xdcf1('0x70')](_0x3109e4[_0xdcf1('0x71')]);_[_0xdcf1('0x72')](_0xc8430c,function(_0x515a38){return _0x3b4c64[_0xdcf1('0x73')](_0x515a38[_0xdcf1('0x2c')]);});return{'count':_0xc8430c['length'],'rows':_[_0xdcf1('0x32')](_0xc8430c,function(_0x29a7bb){return{'id':_0x29a7bb[_0xdcf1('0x2c')],'name':_0x29a7bb['label'],'custom':_[_0xdcf1('0x74')](_0x29a7bb[_0xdcf1('0x2c')],'_c')?!![]:![],'options':_0x29a7bb[_0xdcf1('0x41')]?_[_0xdcf1('0x32')](_[_0xdcf1('0x70')](_0x29a7bb[_0xdcf1('0x41')]),function(_0x5e06a5){return{'name':_0x5e06a5['value'],'value':_0x5e06a5[_0xdcf1('0x2c')]};}):[]};})};}})[_0xdcf1('0x29')](respondWithResult(_0x274dc6,null))['catch'](function(_0x51f2f3){var _0x488093=_0x5c958e[_0xdcf1('0x33')][_0xdcf1('0x75')]?0x1f4:_0x51f2f3[_0xdcf1('0x76')]||0x1f4;logger[_0xdcf1('0x2a')](_0xdcf1('0x77'),_0xdcf1('0x78'),_0x488093,JSON[_0xdcf1('0x6b')](_0x51f2f3));delete _0x51f2f3['name'];if(_0x488093===0x191){_0x488093=0x190;}_0x274dc6[_0xdcf1('0x1c')](_0x488093)['send'](_0x5c958e[_0xdcf1('0x33')][_0xdcf1('0x75')]?{'message':_0xdcf1('0x79'),'statusCode':_0x51f2f3['statusCode']}:_0x51f2f3);});}else{var _0x4135b4=0x1f4;_0x274dc6[_0xdcf1('0x1c')](_0x4135b4)['send']({'message':_0xdcf1('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x890d=['end','error','stack','name','index','map','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','params','find','create','body','findOne','SugarcrmConfiguration','rawAttributes','length','order','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','remoteUri','slice','substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','values','module_fields','remove','includes','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy'];(function(_0x9a8d87,_0x452cd0){var _0x85cd48=function(_0x5879be){while(--_0x5879be){_0x9a8d87['push'](_0x9a8d87['shift']());}};_0x85cd48(++_0x452cd0);}(_0x890d,0x141));var _0xd890=function(_0x4a48c7,_0x1d8481){_0x4a48c7=_0x4a48c7-0x0;var _0x1324b1=_0x890d[_0x4a48c7];return _0x1324b1;};'use strict';var emlformat=require(_0xd890('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd890('0x1'));var jsonpatch=require(_0xd890('0x2'));var rp=require(_0xd890('0x3'));var moment=require(_0xd890('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd890('0x5'));var util=require(_0xd890('0x6'));var path=require(_0xd890('0x7'));var sox=require(_0xd890('0x8'));var csv=require('to-csv');var ejs=require(_0xd890('0x9'));var fs=require('fs');var fs_extra=require(_0xd890('0xa'));var _=require(_0xd890('0xb'));var squel=require(_0xd890('0xc'));var crypto=require('crypto');var jsforce=require(_0xd890('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd890('0xe'));var querystring=require(_0xd890('0xf'));var Papa=require(_0xd890('0x10'));var Redis=require(_0xd890('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd890('0x12'));var as=require(_0xd890('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd890('0x14'))(_0xd890('0x15'));var utils=require(_0xd890('0x16'));var config=require(_0xd890('0x17'));var licenseUtil=require(_0xd890('0x18'));var db=require(_0xd890('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1fe12d,_0x5cee3f){_0x5cee3f=_0x5cee3f||0xcc;return function(_0x620be2){if(_0x620be2){return _0x1fe12d[_0xd890('0x1a')](_0x5cee3f);}return _0x1fe12d[_0xd890('0x1b')](_0x5cee3f)['end']();};}function respondWithResult(_0x1c82b5,_0x2067e7){_0x2067e7=_0x2067e7||0xc8;return function(_0xafe5c9){if(_0xafe5c9){return _0x1c82b5[_0xd890('0x1b')](_0x2067e7)[_0xd890('0x1c')](_0xafe5c9);}};}function respondWithFilteredResult(_0x219fe1,_0x4cf38e){return function(_0x4b1f3b){if(_0x4b1f3b){var _0x23140c=typeof _0x4cf38e[_0xd890('0x1d')]===_0xd890('0x1e')&&typeof _0x4cf38e[_0xd890('0x1f')]===_0xd890('0x1e');var _0x2360e8=_0x4b1f3b[_0xd890('0x20')];var _0x4e2179=_0x23140c?0x0:_0x4cf38e['offset'];var _0x377f0c=_0x23140c?_0x4b1f3b[_0xd890('0x20')]:_0x4cf38e[_0xd890('0x1d')]+_0x4cf38e['limit'];var _0xab674e;if(_0x377f0c>=_0x2360e8){_0x377f0c=_0x2360e8;_0xab674e=0xc8;}else{_0xab674e=0xce;}_0x219fe1[_0xd890('0x1b')](_0xab674e);return _0x219fe1['set'](_0xd890('0x21'),_0x4e2179+'-'+_0x377f0c+'/'+_0x2360e8)[_0xd890('0x1c')](_0x4b1f3b);}return null;};}function patchUpdates(_0x4097b3){return function(_0x5aad56){try{jsonpatch['apply'](_0x5aad56,_0x4097b3,!![]);}catch(_0x6b97cb){return BPromise[_0xd890('0x22')](_0x6b97cb);}return _0x5aad56[_0xd890('0x23')]();};}function saveUpdates(_0x51d139,_0x3eeab7){return function(_0x49b965){if(_0x49b965){return _0x49b965[_0xd890('0x24')](_0x51d139)[_0xd890('0x25')](function(_0xd96c4d){return _0xd96c4d;});}return null;};}function removeEntity(_0x1c24b9,_0x427615){return function(_0x2efd07){if(_0x2efd07){return _0x2efd07[_0xd890('0x26')]()[_0xd890('0x25')](function(){_0x1c24b9[_0xd890('0x1b')](0xcc)[_0xd890('0x27')]();});}};}function handleEntityNotFound(_0x29e419,_0x510df6){return function(_0xfa9cd){if(!_0xfa9cd){_0x29e419['sendStatus'](0x194);}return _0xfa9cd;};}function handleError(_0x5d553f,_0x157c52){_0x157c52=_0x157c52||0x1f4;return function(_0x13eb46){logger[_0xd890('0x28')](_0x13eb46[_0xd890('0x29')]);if(_0x13eb46[_0xd890('0x2a')]){delete _0x13eb46[_0xd890('0x2a')];}_0x5d553f[_0xd890('0x1b')](_0x157c52)['send'](_0x13eb46);};}exports[_0xd890('0x2b')]=function(_0x5919d6,_0x2d8501){var _0x3ee645={},_0x9d6128={},_0x4da1bf={'count':0x0,'rows':[]};var _0x427c6d=_[_0xd890('0x2c')](db['SugarcrmAccount']['rawAttributes'],function(_0x23e4aa){return{'name':_0x23e4aa['fieldName'],'type':_0x23e4aa[_0xd890('0x2d')]['key']};});_0x9d6128['model']=_[_0xd890('0x2c')](_0x427c6d,_0xd890('0x2a'));_0x9d6128[_0xd890('0x2e')]=_[_0xd890('0x2f')](_0x5919d6[_0xd890('0x2e')]);_0x9d6128[_0xd890('0x30')]=_['intersection'](_0x9d6128[_0xd890('0x31')],_0x9d6128[_0xd890('0x2e')]);_0x3ee645[_0xd890('0x32')]=_[_0xd890('0x33')](_0x9d6128[_0xd890('0x31')],qs[_0xd890('0x34')](_0x5919d6['query'][_0xd890('0x34')]));_0x3ee645[_0xd890('0x32')]=_0x3ee645[_0xd890('0x32')]['length']?_0x3ee645[_0xd890('0x32')]:_0x9d6128[_0xd890('0x31')];if(!_0x5919d6[_0xd890('0x2e')][_0xd890('0x35')]('nolimit')){_0x3ee645[_0xd890('0x1f')]=qs['limit'](_0x5919d6[_0xd890('0x2e')][_0xd890('0x1f')]);_0x3ee645['offset']=qs[_0xd890('0x1d')](_0x5919d6[_0xd890('0x2e')]['offset']);}_0x3ee645['order']=qs[_0xd890('0x36')](_0x5919d6[_0xd890('0x2e')][_0xd890('0x36')]);_0x3ee645[_0xd890('0x37')]=qs['filters'](_['pick'](_0x5919d6[_0xd890('0x2e')],_0x9d6128[_0xd890('0x30')]),_0x427c6d);if(_0x5919d6[_0xd890('0x2e')]['filter']){_0x3ee645[_0xd890('0x37')]=_[_0xd890('0x38')](_0x3ee645[_0xd890('0x37')],{'$or':_[_0xd890('0x2c')](_0x427c6d,function(_0x386495){if(_0x386495[_0xd890('0x2d')]!==_0xd890('0x39')){var _0x803ab8={};_0x803ab8[_0x386495[_0xd890('0x2a')]]={'$like':'%'+_0x5919d6[_0xd890('0x2e')][_0xd890('0x3a')]+'%'};return _0x803ab8;}})});}_0x3ee645=_[_0xd890('0x38')]({},_0x3ee645,_0x5919d6[_0xd890('0x3b')]);var _0x4d7d87={'where':_0x3ee645[_0xd890('0x37')]};return db[_0xd890('0x3c')]['count'](_0x4d7d87)['then'](function(_0x42a38a){_0x4da1bf[_0xd890('0x20')]=_0x42a38a;if(_0x5919d6['query'][_0xd890('0x3d')]){_0x3ee645[_0xd890('0x3e')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xd890('0x3f')](_0x3ee645);})[_0xd890('0x25')](function(_0x150260){_0x4da1bf[_0xd890('0x40')]=_0x150260;return _0x4da1bf;})['then'](respondWithFilteredResult(_0x2d8501,_0x3ee645))[_0xd890('0x41')](handleError(_0x2d8501,null));};exports['show']=function(_0x1d336d,_0x451f9c){var _0x128a53={'raw':![],'where':{'id':_0x1d336d[_0xd890('0x42')]['id']}},_0x4011a1={};_0x4011a1[_0xd890('0x31')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x4011a1['query']=_[_0xd890('0x2f')](_0x1d336d[_0xd890('0x2e')]);_0x4011a1[_0xd890('0x30')]=_[_0xd890('0x33')](_0x4011a1['model'],_0x4011a1[_0xd890('0x2e')]);_0x128a53[_0xd890('0x32')]=_[_0xd890('0x33')](_0x4011a1[_0xd890('0x31')],qs['fields'](_0x1d336d[_0xd890('0x2e')][_0xd890('0x34')]));_0x128a53[_0xd890('0x32')]=_0x128a53[_0xd890('0x32')]['length']?_0x128a53[_0xd890('0x32')]:_0x4011a1[_0xd890('0x31')];if(_0x1d336d[_0xd890('0x2e')][_0xd890('0x3d')]){_0x128a53[_0xd890('0x3e')]=[{'all':!![]}];}_0x128a53=_['merge']({},_0x128a53,_0x1d336d[_0xd890('0x3b')]);return db[_0xd890('0x3c')][_0xd890('0x43')](_0x128a53)[_0xd890('0x25')](handleEntityNotFound(_0x451f9c,null))['then'](respondWithResult(_0x451f9c,null))[_0xd890('0x41')](handleError(_0x451f9c,null));};exports[_0xd890('0x44')]=function(_0x426348,_0x447cda){return db[_0xd890('0x3c')][_0xd890('0x44')](_0x426348[_0xd890('0x45')],{})[_0xd890('0x25')](respondWithResult(_0x447cda,0xc9))[_0xd890('0x41')](handleError(_0x447cda,null));};exports['update']=function(_0x2e49e6,_0x4f1e0e){if(_0x2e49e6['body']['id']){delete _0x2e49e6[_0xd890('0x45')]['id'];}return db[_0xd890('0x3c')][_0xd890('0x43')]({'where':{'id':_0x2e49e6['params']['id']}})[_0xd890('0x25')](handleEntityNotFound(_0x4f1e0e,null))['then'](saveUpdates(_0x2e49e6[_0xd890('0x45')],null))['then'](respondWithResult(_0x4f1e0e,null))[_0xd890('0x41')](handleError(_0x4f1e0e,null));};exports[_0xd890('0x26')]=function(_0x3b098a,_0x2fac2e){return db[_0xd890('0x3c')][_0xd890('0x43')]({'where':{'id':_0x3b098a['params']['id']}})[_0xd890('0x25')](handleEntityNotFound(_0x2fac2e,null))[_0xd890('0x25')](removeEntity(_0x2fac2e,null))['catch'](handleError(_0x2fac2e,null));};exports['getConfigurations']=function(_0x13b508,_0x5aff51,_0x30ae56){var _0x245a11={};var _0x1ee262={};var _0x71d6b4;var _0x4035f4;return db['SugarcrmAccount'][_0xd890('0x46')]({'where':{'id':_0x13b508[_0xd890('0x42')]['id']}})[_0xd890('0x25')](handleEntityNotFound(_0x5aff51,null))['then'](function(_0x521014){if(_0x521014){_0x71d6b4=_0x521014;_0x1ee262[_0xd890('0x31')]=_[_0xd890('0x2f')](db[_0xd890('0x47')][_0xd890('0x48')]);_0x1ee262[_0xd890('0x2e')]=_['keys'](_0x13b508[_0xd890('0x2e')]);_0x1ee262['filters']=_['intersection'](_0x1ee262[_0xd890('0x31')],_0x1ee262['query']);_0x245a11['attributes']=_[_0xd890('0x33')](_0x1ee262['model'],qs[_0xd890('0x34')](_0x13b508['query'][_0xd890('0x34')]));_0x245a11['attributes']=_0x245a11['attributes'][_0xd890('0x49')]?_0x245a11[_0xd890('0x32')]:_0x1ee262[_0xd890('0x31')];_0x245a11[_0xd890('0x4a')]=qs[_0xd890('0x36')](_0x13b508[_0xd890('0x2e')]['sort']);_0x245a11[_0xd890('0x37')]=qs[_0xd890('0x30')](_['pick'](_0x13b508['query'],_0x1ee262[_0xd890('0x30')]));if(_0x13b508['query'][_0xd890('0x3a')]){_0x245a11[_0xd890('0x37')]=_[_0xd890('0x38')](_0x245a11[_0xd890('0x37')],{'$or':_[_0xd890('0x2c')](_0x245a11[_0xd890('0x32')],function(_0x27a10a){var _0x4013cd={};_0x4013cd[_0x27a10a]={'$like':'%'+_0x13b508[_0xd890('0x2e')]['filter']+'%'};return _0x4013cd;})});}_0x245a11=_[_0xd890('0x38')]({},_0x245a11,_0x13b508['options']);return _0x71d6b4[_0xd890('0x4b')](_0x245a11);}})['then'](function(_0x7a10a3){if(_0x7a10a3){_0x4035f4=_0x7a10a3[_0xd890('0x49')];if(!_0x13b508['query'][_0xd890('0x35')](_0xd890('0x4c'))){_0x245a11[_0xd890('0x1f')]=qs[_0xd890('0x1f')](_0x13b508[_0xd890('0x2e')]['limit']);_0x245a11[_0xd890('0x1d')]=qs[_0xd890('0x1d')](_0x13b508[_0xd890('0x2e')][_0xd890('0x1d')]);}return _0x71d6b4[_0xd890('0x4b')](_0x245a11);}})[_0xd890('0x25')](function(_0x4f240a){if(_0x4f240a){return _0x4f240a?{'count':_0x4035f4,'rows':_0x4f240a}:null;}})[_0xd890('0x25')](respondWithResult(_0x5aff51,null))[_0xd890('0x41')](handleError(_0x5aff51,null));};exports[_0xd890('0x4d')]=function(_0x54c6b7,_0x9d5676,_0x4120d8){if(_0x54c6b7[_0xd890('0x45')]['id']){delete _0x54c6b7[_0xd890('0x45')]['id'];}return db[_0xd890('0x3c')][_0xd890('0x46')]({'where':{'id':_0x54c6b7[_0xd890('0x42')]['id']}})['then'](handleEntityNotFound(_0x9d5676,null))['then'](function(_0x2feb9b){if(_0x2feb9b){_0x54c6b7['body']['AccountId']=_0x2feb9b['id'];_0x54c6b7[_0xd890('0x45')][_0xd890('0x4e')]=integrations[_0xd890('0x4f')](_0x54c6b7[_0xd890('0x45')][_0xd890('0x50')],_0x54c6b7[_0xd890('0x45')]['type']);_0x54c6b7[_0xd890('0x45')]['Descriptions']=integrations[_0xd890('0x51')](_0x54c6b7[_0xd890('0x45')][_0xd890('0x50')],_0x54c6b7[_0xd890('0x45')][_0xd890('0x2d')]);return db[_0xd890('0x47')][_0xd890('0x44')](_0x54c6b7[_0xd890('0x45')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0xd890('0x52')],'as':_0xd890('0x53')}]});}return null;})[_0xd890('0x25')](respondWithResult(_0x9d5676,null))['catch'](handleError(_0x9d5676,null));};exports[_0xd890('0x54')]=function(_0x5f4755,_0x25cfee,_0x2a542b){var _0x1b87ad='';var _0x1a8a7a=['id','name',_0xd890('0x55'),'created_by',_0xd890('0x56'),_0xd890('0x57'),_0xd890('0x58'),_0xd890('0x59'),_0xd890('0x5a'),'parent_type',_0xd890('0x5b'),_0xd890('0x5c')];return db[_0xd890('0x3c')][_0xd890('0x46')]({'where':{'id':_0x5f4755[_0xd890('0x42')]['id']},'attributes':['id',_0xd890('0x5d'),'password',_0xd890('0x5e')]})[_0xd890('0x25')](handleEntityNotFound(_0x25cfee,null))[_0xd890('0x25')](function(_0x468008){if(_0x468008){_0x1b87ad=_0x468008[_0xd890('0x5e')];var _0x2836ba=_0x1b87ad[_0xd890('0x5f')](-0x1);if(_0x2836ba==='/'){_0x1b87ad=_0x1b87ad[_0xd890('0x60')](0x0,_0x1b87ad['lastIndexOf'](_0x2836ba));}return rp({'method':_0xd890('0x61'),'uri':util['format'](_0xd890('0x62'),_0x1b87ad,_0xd890('0x63')),'json':!![],'form':{'method':_0xd890('0x64'),'input_type':_0xd890('0x65'),'response_type':'JSON','rest_data':JSON[_0xd890('0x66')]({'user_auth':{'user_name':_0x468008['username'],'password':_0x468008[_0xd890('0x67')],'encryption':'PLAIN'},'application':_0xd890('0x68')})}});}})[_0xd890('0x25')](function(_0x22ad73){if(_0x22ad73&&_0x22ad73['name']!==_0xd890('0x69')&&_0x22ad73['name']!==_0xd890('0x6a')){return rp({'method':_0xd890('0x61'),'uri':util[_0xd890('0x6b')](_0xd890('0x62'),_0x1b87ad,_0xd890('0x63')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xd890('0x65'),'response_type':'JSON','rest_data':JSON[_0xd890('0x66')]({'session':_0x22ad73['id'],'module_name':'Calls'})}})[_0xd890('0x25')](function(_0x2a5698){if(_0x2a5698){var _0x2c9b45=_[_0xd890('0x6c')](_0x2a5698[_0xd890('0x6d')]);_[_0xd890('0x6e')](_0x2c9b45,function(_0x3b7ec1){return _0x1a8a7a[_0xd890('0x6f')](_0x3b7ec1[_0xd890('0x2a')]);});return{'count':_0x2c9b45['length'],'rows':_[_0xd890('0x2c')](_0x2c9b45,function(_0x32e5f9){return{'id':_0x32e5f9[_0xd890('0x2a')],'name':_0x32e5f9[_0xd890('0x70')],'custom':_[_0xd890('0x71')](_0x32e5f9[_0xd890('0x2a')],'_c')?!![]:![],'options':_0x32e5f9[_0xd890('0x3b')]?_[_0xd890('0x2c')](_['values'](_0x32e5f9['options']),function(_0x42ea42){return{'name':_0x42ea42[_0xd890('0x72')],'value':_0x42ea42['name']};}):[]};})};}})['then'](respondWithResult(_0x25cfee,null))[_0xd890('0x41')](function(_0x16e0de){var _0x5725db=_0x5f4755[_0xd890('0x2e')][_0xd890('0x73')]?0x1f4:_0x16e0de['statusCode']||0x1f4;logger[_0xd890('0x28')](_0xd890('0x74'),_0xd890('0x54'),_0x5725db,JSON[_0xd890('0x66')](_0x16e0de));delete _0x16e0de[_0xd890('0x2a')];if(_0x5725db===0x191){_0x5725db=0x190;}_0x25cfee[_0xd890('0x1b')](_0x5725db)[_0xd890('0x75')](_0x5f4755['query'][_0xd890('0x73')]?{'message':_0xd890('0x76'),'statusCode':_0x16e0de[_0xd890('0x77')]}:_0x16e0de);});}else{var _0x5098b3=0x1f4;_0x25cfee['status'](_0x5098b3)[_0xd890('0x75')]({'message':_0xd890('0x76'),'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 ded8287..d4b68ee 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 _0x7b22=['SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x291270,_0x8f4f34){var _0x21e5a3=function(_0x37e40d){while(--_0x37e40d){_0x291270['push'](_0x291270['shift']());}};_0x21e5a3(++_0x8f4f34);}(_0x7b22,0x1e6));var _0x27b2=function(_0x295a92,_0x7d70dc){_0x295a92=_0x295a92-0x0;var _0x3f5dac=_0x7b22[_0x295a92];return _0x3f5dac;};'use strict';var _=require('lodash');var util=require(_0x27b2('0x0'));var logger=require(_0x27b2('0x1'))(_0x27b2('0x2'));var moment=require('moment');var BPromise=require(_0x27b2('0x3'));var rp=require(_0x27b2('0x4'));var fs=require('fs');var path=require(_0x27b2('0x5'));var rimraf=require(_0x27b2('0x6'));var config=require(_0x27b2('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x27b2('0x8'));module['exports']=function(_0x10205b,_0x5dcd80){return _0x10205b['define'](_0x27b2('0x9'),attributes,{'tableName':_0x27b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5797=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x5797,0x89));var _0x7579=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5797[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7579('0x0'));var util=require(_0x7579('0x1'));var logger=require(_0x7579('0x2'))(_0x7579('0x3'));var moment=require(_0x7579('0x4'));var BPromise=require(_0x7579('0x5'));var rp=require(_0x7579('0x6'));var fs=require('fs');var path=require(_0x7579('0x7'));var rimraf=require(_0x7579('0x8'));var config=require('../../config/environment');var attributes=require(_0x7579('0x9'));var integrations=require(_0x7579('0xa'));module[_0x7579('0xb')]=function(_0x28ac0e,_0x4e9093){return _0x28ac0e[_0x7579('0xc')](_0x7579('0xd'),attributes,{'tableName':_0x7579('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 4c633d9..e62c693 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 _0x55ed=['stringify','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0x55ed,0x1da));var _0xd55e=function(_0x292561,_0x2f3ebc){_0x292561=_0x292561-0x0;var _0x114e7c=_0x55ed[_0x292561];return _0x114e7c;};'use strict';var _=require(_0xd55e('0x0'));var util=require(_0xd55e('0x1'));var moment=require(_0xd55e('0x2'));var BPromise=require(_0xd55e('0x3'));var rs=require(_0xd55e('0x4'));var fs=require('fs');var Redis=require(_0xd55e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd55e('0x6'));var logger=require(_0xd55e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd55e('0x8')][_0xd55e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x298df8,_0x5ed78e,_0x399971){return new BPromise(function(_0x5f455b,_0x43bd67){return client[_0xd55e('0xa')](_0x298df8,_0x399971)[_0xd55e('0xb')](function(_0x44f5d8){logger['info'](_0xd55e('0xc'),_0x5ed78e,_0xd55e('0xd'));logger[_0xd55e('0xe')](_0xd55e('0xf'),_0x5ed78e,_0xd55e('0xd'),JSON[_0xd55e('0x10')](_0x44f5d8));if(_0x44f5d8['error']){if(_0x44f5d8[_0xd55e('0x11')]['code']===0x1f4){logger['error'](_0xd55e('0xc'),_0x5ed78e,_0x44f5d8['error'][_0xd55e('0x12')]);return _0x43bd67(_0x44f5d8[_0xd55e('0x11')]['message']);}logger[_0xd55e('0x11')](_0xd55e('0xc'),_0x5ed78e,_0x44f5d8[_0xd55e('0x11')][_0xd55e('0x12')]);return _0x5f455b(_0x44f5d8['error'][_0xd55e('0x12')]);}else{logger[_0xd55e('0x13')](_0xd55e('0xc'),_0x5ed78e,_0xd55e('0xd'));_0x5f455b(_0x44f5d8[_0xd55e('0x14')][_0xd55e('0x12')]);}})[_0xd55e('0x15')](function(_0x54c51a){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5ed78e,_0x54c51a);_0x43bd67(_0x54c51a);});});}exports[_0xd55e('0x16')]=function(_0x434c82){var _0x1dfe70=this;return new Promise(function(_0x239af8,_0x1c4161){return db[_0xd55e('0x17')][_0xd55e('0x18')]({'raw':_0x434c82[_0xd55e('0x19')]?_0x434c82['options'][_0xd55e('0x1a')]===undefined?!![]:![]:!![],'where':_0x434c82[_0xd55e('0x19')]?_0x434c82[_0xd55e('0x19')][_0xd55e('0x1b')]||null:null,'attributes':_0x434c82[_0xd55e('0x19')]?_0x434c82[_0xd55e('0x19')][_0xd55e('0x1c')]||null:null,'limit':_0x434c82['options']?_0x434c82[_0xd55e('0x19')][_0xd55e('0x1d')]||null:null,'include':_0x434c82[_0xd55e('0x19')]?_0x434c82[_0xd55e('0x19')]['include']?_[_0xd55e('0x1e')](_0x434c82[_0xd55e('0x19')][_0xd55e('0x1f')],function(_0x3117cb){return{'model':db[_0x3117cb[_0xd55e('0x20')]],'as':_0x3117cb['as'],'attributes':_0x3117cb[_0xd55e('0x1c')],'include':_0x3117cb[_0xd55e('0x1f')]?_[_0xd55e('0x1e')](_0x3117cb[_0xd55e('0x1f')],function(_0x260af3){return{'model':db[_0x260af3[_0xd55e('0x20')]],'as':_0x260af3['as'],'attributes':_0x260af3['attributes'],'include':_0x260af3['include']?_[_0xd55e('0x1e')](_0x260af3[_0xd55e('0x1f')],function(_0x1d56f2){return{'model':db[_0x1d56f2[_0xd55e('0x20')]],'as':_0x1d56f2['as'],'attributes':_0x1d56f2['attributes']};}):[]};}):[]};}):[]:[]})[_0xd55e('0xb')](function(_0x4931ed){logger['info']('GetSugarcrmAccount',_0x434c82);logger[_0xd55e('0xe')](_0xd55e('0x16'),_0x434c82,JSON[_0xd55e('0x10')](_0x4931ed));_0x239af8(_0x4931ed);})['catch'](function(_0x1b2155){logger[_0xd55e('0x11')](_0xd55e('0x16'),_0x1b2155['message'],_0x434c82);_0x1c4161(_0x1dfe70[_0xd55e('0x11')](0x1f4,_0x1b2155['message']));});});};exports[_0xd55e('0x21')]=function(_0x50927b){var _0x3a35b3=this;return new Promise(function(_0x191712,_0x16f917){return db[_0xd55e('0x17')][_0xd55e('0x22')]({'raw':_0x50927b[_0xd55e('0x19')]?_0x50927b[_0xd55e('0x19')][_0xd55e('0x1a')]===undefined?!![]:![]:!![],'where':_0x50927b['options']?_0x50927b['options'][_0xd55e('0x1b')]||null:null,'attributes':_0x50927b[_0xd55e('0x19')]?_0x50927b[_0xd55e('0x19')][_0xd55e('0x1c')]||null:null,'include':_0x50927b['options']?_0x50927b['options'][_0xd55e('0x1f')]?_[_0xd55e('0x1e')](_0x50927b[_0xd55e('0x19')][_0xd55e('0x1f')],function(_0x4ff2a7){return{'model':db[_0x4ff2a7[_0xd55e('0x20')]],'as':_0x4ff2a7['as'],'attributes':_0x4ff2a7['attributes'],'include':_0x4ff2a7[_0xd55e('0x1f')]?_[_0xd55e('0x1e')](_0x4ff2a7[_0xd55e('0x1f')],function(_0x2119c5){return{'model':db[_0x2119c5[_0xd55e('0x20')]],'as':_0x2119c5['as'],'attributes':_0x2119c5[_0xd55e('0x1c')],'include':_0x2119c5['include']?_[_0xd55e('0x1e')](_0x2119c5[_0xd55e('0x1f')],function(_0x1b06db){return{'model':db[_0x1b06db[_0xd55e('0x20')]],'as':_0x1b06db['as'],'attributes':_0x1b06db['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x248ff8){logger[_0xd55e('0x13')](_0xd55e('0x21'),_0x50927b);logger[_0xd55e('0xe')](_0xd55e('0x21'),_0x50927b,JSON[_0xd55e('0x10')](_0x248ff8));_0x191712(_0x248ff8);})[_0xd55e('0x15')](function(_0x5543e5){logger[_0xd55e('0x11')]('ShowSugarcrmAccount',_0x5543e5['message'],_0x50927b);_0x16f917(_0x3a35b3[_0xd55e('0x11')](0x1f4,_0x5543e5[_0xd55e('0x12')]));});});}; \ No newline at end of file +var _0x3b8c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','attributes','include','map','model','ShowSugarcrmAccount','raw','where','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x3b8c,0xc6));var _0xc3b8=function(_0x24449f,_0x4c3370){_0x24449f=_0x24449f-0x0;var _0x390a2b=_0x3b8c[_0x24449f];return _0x390a2b;};'use strict';var _=require(_0xc3b8('0x0'));var util=require(_0xc3b8('0x1'));var moment=require(_0xc3b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3b8('0x3'));var fs=require('fs');var Redis=require(_0xc3b8('0x4'));var db=require(_0xc3b8('0x5'))['db'];var utils=require(_0xc3b8('0x6'));var logger=require(_0xc3b8('0x7'))(_0xc3b8('0x8'));var config=require(_0xc3b8('0x9'));var jayson=require(_0xc3b8('0xa'));var client=jayson[_0xc3b8('0xb')][_0xc3b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x560bf4,_0x59054c,_0xb6243b){return new BPromise(function(_0x203a80,_0x5a2bef){return client['request'](_0x560bf4,_0xb6243b)[_0xc3b8('0xd')](function(_0x71a1b){logger['info'](_0xc3b8('0xe'),_0x59054c,_0xc3b8('0xf'));logger[_0xc3b8('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x59054c,'request\x20sent',JSON['stringify'](_0x71a1b));if(_0x71a1b[_0xc3b8('0x11')]){if(_0x71a1b[_0xc3b8('0x11')]['code']===0x1f4){logger['error'](_0xc3b8('0xe'),_0x59054c,_0x71a1b[_0xc3b8('0x11')][_0xc3b8('0x12')]);return _0x5a2bef(_0x71a1b[_0xc3b8('0x11')][_0xc3b8('0x12')]);}logger[_0xc3b8('0x11')](_0xc3b8('0xe'),_0x59054c,_0x71a1b[_0xc3b8('0x11')][_0xc3b8('0x12')]);return _0x203a80(_0x71a1b[_0xc3b8('0x11')]['message']);}else{logger[_0xc3b8('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x59054c,_0xc3b8('0xf'));_0x203a80(_0x71a1b[_0xc3b8('0x14')][_0xc3b8('0x12')]);}})[_0xc3b8('0x15')](function(_0x2cbba7){logger[_0xc3b8('0x11')](_0xc3b8('0xe'),_0x59054c,_0x2cbba7);_0x5a2bef(_0x2cbba7);});});}exports[_0xc3b8('0x16')]=function(_0x102b84){var _0x3c14b5=this;return new Promise(function(_0x2743d6,_0x3c5092){return db[_0xc3b8('0x17')][_0xc3b8('0x18')]({'raw':_0x102b84[_0xc3b8('0x19')]?_0x102b84['options']['raw']===undefined?!![]:![]:!![],'where':_0x102b84[_0xc3b8('0x19')]?_0x102b84[_0xc3b8('0x19')]['where']||null:null,'attributes':_0x102b84[_0xc3b8('0x19')]?_0x102b84['options'][_0xc3b8('0x1a')]||null:null,'limit':_0x102b84[_0xc3b8('0x19')]?_0x102b84[_0xc3b8('0x19')]['limit']||null:null,'include':_0x102b84['options']?_0x102b84['options'][_0xc3b8('0x1b')]?_[_0xc3b8('0x1c')](_0x102b84[_0xc3b8('0x19')][_0xc3b8('0x1b')],function(_0x41ec70){return{'model':db[_0x41ec70['model']],'as':_0x41ec70['as'],'attributes':_0x41ec70['attributes'],'include':_0x41ec70['include']?_['map'](_0x41ec70[_0xc3b8('0x1b')],function(_0x43fdc7){return{'model':db[_0x43fdc7[_0xc3b8('0x1d')]],'as':_0x43fdc7['as'],'attributes':_0x43fdc7[_0xc3b8('0x1a')],'include':_0x43fdc7[_0xc3b8('0x1b')]?_['map'](_0x43fdc7[_0xc3b8('0x1b')],function(_0x4f6e90){return{'model':db[_0x4f6e90[_0xc3b8('0x1d')]],'as':_0x4f6e90['as'],'attributes':_0x4f6e90[_0xc3b8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc3b8('0xd')](function(_0x59594c){logger[_0xc3b8('0x13')](_0xc3b8('0x16'),_0x102b84);logger[_0xc3b8('0x10')](_0xc3b8('0x16'),_0x102b84,JSON['stringify'](_0x59594c));_0x2743d6(_0x59594c);})[_0xc3b8('0x15')](function(_0x12bfe0){logger[_0xc3b8('0x11')](_0xc3b8('0x16'),_0x12bfe0[_0xc3b8('0x12')],_0x102b84);_0x3c5092(_0x3c14b5[_0xc3b8('0x11')](0x1f4,_0x12bfe0[_0xc3b8('0x12')]));});});};exports[_0xc3b8('0x1e')]=function(_0x52f723){var _0xf8131a=this;return new Promise(function(_0x299f4c,_0x7a85dc){return db['SugarcrmAccount']['find']({'raw':_0x52f723['options']?_0x52f723['options'][_0xc3b8('0x1f')]===undefined?!![]:![]:!![],'where':_0x52f723[_0xc3b8('0x19')]?_0x52f723[_0xc3b8('0x19')][_0xc3b8('0x20')]||null:null,'attributes':_0x52f723[_0xc3b8('0x19')]?_0x52f723['options'][_0xc3b8('0x1a')]||null:null,'include':_0x52f723[_0xc3b8('0x19')]?_0x52f723[_0xc3b8('0x19')][_0xc3b8('0x1b')]?_[_0xc3b8('0x1c')](_0x52f723[_0xc3b8('0x19')][_0xc3b8('0x1b')],function(_0x4d0e0e){return{'model':db[_0x4d0e0e['model']],'as':_0x4d0e0e['as'],'attributes':_0x4d0e0e[_0xc3b8('0x1a')],'include':_0x4d0e0e['include']?_[_0xc3b8('0x1c')](_0x4d0e0e[_0xc3b8('0x1b')],function(_0x548115){return{'model':db[_0x548115[_0xc3b8('0x1d')]],'as':_0x548115['as'],'attributes':_0x548115[_0xc3b8('0x1a')],'include':_0x548115['include']?_[_0xc3b8('0x1c')](_0x548115['include'],function(_0x303494){return{'model':db[_0x303494['model']],'as':_0x303494['as'],'attributes':_0x303494[_0xc3b8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc3b8('0xd')](function(_0x3f7f76){logger['info'](_0xc3b8('0x1e'),_0x52f723);logger[_0xc3b8('0x10')]('ShowSugarcrmAccount',_0x52f723,JSON[_0xc3b8('0x21')](_0x3f7f76));_0x299f4c(_0x3f7f76);})[_0xc3b8('0x15')](function(_0x7634b8){logger[_0xc3b8('0x11')]('ShowSugarcrmAccount',_0x7634b8[_0xc3b8('0x12')],_0x52f723);_0x7a85dc(_0xf8131a[_0xc3b8('0x11')](0x1f4,_0x7634b8[_0xc3b8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index db9c261..760d86d 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 _0x1016=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','multer','util','path'];(function(_0x53c0bc,_0x42c2ec){var _0x40eac0=function(_0x294119){while(--_0x294119){_0x53c0bc['push'](_0x53c0bc['shift']());}};_0x40eac0(++_0x42c2ec);}(_0x1016,0x87));var _0x6101=function(_0x43b0a8,_0x385b08){_0x43b0a8=_0x43b0a8-0x0;var _0x35b89d=_0x1016[_0x43b0a8];return _0x35b89d;};'use strict';var multer=require(_0x6101('0x0'));var util=require(_0x6101('0x1'));var path=require(_0x6101('0x2'));var timeout=require('connect-timeout');var express=require(_0x6101('0x3'));var router=express['Router']();var fs_extra=require(_0x6101('0x4'));var auth=require(_0x6101('0x5'));var interaction=require(_0x6101('0x6'));var config=require(_0x6101('0x7'));var controller=require(_0x6101('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6101('0x9')](_0x6101('0xa'),auth['isAuthenticated'](),controller[_0x6101('0xb')]);router['get'](_0x6101('0xc'),auth[_0x6101('0xd')](),controller[_0x6101('0xe')]);router['get'](_0x6101('0xf'),auth['isAuthenticated'](),controller[_0x6101('0x10')]);router['get']('/:id/descriptions',auth[_0x6101('0xd')](),controller[_0x6101('0x11')]);router[_0x6101('0x12')]('/',auth[_0x6101('0xd')](),controller['create']);router[_0x6101('0x13')](_0x6101('0xa'),auth[_0x6101('0xd')](),controller[_0x6101('0x14')]);router[_0x6101('0x15')](_0x6101('0xa'),auth[_0x6101('0xd')](),controller[_0x6101('0x16')]);module['exports']=router; \ No newline at end of file +var _0x135a=['get','index','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x3b5e02,_0x535469){var _0x59464c=function(_0x2d11cb){while(--_0x2d11cb){_0x3b5e02['push'](_0x3b5e02['shift']());}};_0x59464c(++_0x535469);}(_0x135a,0x117));var _0xa135=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x135a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa135('0x0'));var util=require('util');var path=require(_0xa135('0x1'));var timeout=require(_0xa135('0x2'));var express=require(_0xa135('0x3'));var router=express[_0xa135('0x4')]();var fs_extra=require(_0xa135('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa135('0x6'));var config=require(_0xa135('0x7'));var controller=require(_0xa135('0x8'));router[_0xa135('0x9')]('/',auth['isAuthenticated'](),controller[_0xa135('0xa')]);router[_0xa135('0x9')]('/:id',auth[_0xa135('0xb')](),controller[_0xa135('0xc')]);router[_0xa135('0x9')]('/:id/fields',auth[_0xa135('0xb')](),controller[_0xa135('0xd')]);router[_0xa135('0x9')](_0xa135('0xe'),auth['isAuthenticated'](),controller[_0xa135('0xf')]);router[_0xa135('0x9')](_0xa135('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xa135('0x11')]('/',auth[_0xa135('0xb')](),controller[_0xa135('0x12')]);router[_0xa135('0x13')]('/:id',auth[_0xa135('0xb')](),controller['update']);router[_0xa135('0x14')](_0xa135('0x15'),auth[_0xa135('0xb')](),controller[_0xa135('0x16')]);module[_0xa135('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 4be05be..ae7945b 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 _0xcf5d=['sequelize','exports','STRING'];(function(_0x25cafa,_0x3cdd2b){var _0x132e11=function(_0x1f24d3){while(--_0x1f24d3){_0x25cafa['push'](_0x25cafa['shift']());}};_0x132e11(++_0x3cdd2b);}(_0xcf5d,0x84));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdcf5('0x0'));module[_0xdcf5('0x1')]={'name':{'type':Sequelize[_0xdcf5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea56=['STRING','sequelize'];(function(_0x1db4dd,_0x2fb37c){var _0x353de4=function(_0x14482a){while(--_0x14482a){_0x1db4dd['push'](_0x1db4dd['shift']());}};_0x353de4(++_0x2fb37c);}(_0xea56,0x1c5));var _0x6ea5=function(_0x90d801,_0x5e10e5){_0x90d801=_0x90d801-0x0;var _0x136d39=_0xea56[_0x90d801];return _0x136d39;};'use strict';var Sequelize=require(_0x6ea5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ea5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b546576..46c4fcc 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 _0x207e=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','params','length','includeAll','options','create','body','findOne','SugarcrmField','map','getFields','pick','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','moment'];(function(_0x5c6310,_0x57afac){var _0x3e6db4=function(_0x5a88e3){while(--_0x5a88e3){_0x5c6310['push'](_0x5c6310['shift']());}};_0x3e6db4(++_0x57afac);}(_0x207e,0x98));var _0xe207=function(_0x50d420,_0x42c997){_0x50d420=_0x50d420-0x0;var _0x5c861e=_0x207e[_0x50d420];return _0x5c861e;};'use strict';var emlformat=require(_0xe207('0x0'));var rimraf=require(_0xe207('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe207('0x2'));var rp=require('request-promise');var moment=require(_0xe207('0x3'));var BPromise=require(_0xe207('0x4'));var Mustache=require(_0xe207('0x5'));var util=require(_0xe207('0x6'));var path=require('path');var sox=require(_0xe207('0x7'));var csv=require(_0xe207('0x8'));var ejs=require(_0xe207('0x9'));var fs=require('fs');var fs_extra=require(_0xe207('0xa'));var _=require(_0xe207('0xb'));var squel=require(_0xe207('0xc'));var crypto=require(_0xe207('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe207('0x8'));var querystring=require(_0xe207('0xe'));var Papa=require(_0xe207('0xf'));var Redis=require(_0xe207('0x10'));var authService=require(_0xe207('0x11'));var qs=require(_0xe207('0x12'));var as=require(_0xe207('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe207('0x14'))(_0xe207('0x15'));var utils=require(_0xe207('0x16'));var config=require(_0xe207('0x17'));var licenseUtil=require(_0xe207('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30e2f8,_0x4d4727){_0x4d4727=_0x4d4727||0xcc;return function(_0x273295){if(_0x273295){return _0x30e2f8[_0xe207('0x19')](_0x4d4727);}return _0x30e2f8[_0xe207('0x1a')](_0x4d4727)[_0xe207('0x1b')]();};}function respondWithResult(_0x1d5b9d,_0x273bba){_0x273bba=_0x273bba||0xc8;return function(_0x38755c){if(_0x38755c){return _0x1d5b9d['status'](_0x273bba)['json'](_0x38755c);}};}function respondWithFilteredResult(_0x284334,_0x37a19d){return function(_0x133099){if(_0x133099){var _0x2e2de2=typeof _0x37a19d[_0xe207('0x1c')]===_0xe207('0x1d')&&typeof _0x37a19d[_0xe207('0x1e')]===_0xe207('0x1d');var _0x5a86ad=_0x133099[_0xe207('0x1f')];var _0x4d6b02=_0x2e2de2?0x0:_0x37a19d[_0xe207('0x1c')];var _0xe721d0=_0x2e2de2?_0x133099[_0xe207('0x1f')]:_0x37a19d['offset']+_0x37a19d[_0xe207('0x1e')];var _0x5279dc;if(_0xe721d0>=_0x5a86ad){_0xe721d0=_0x5a86ad;_0x5279dc=0xc8;}else{_0x5279dc=0xce;}_0x284334[_0xe207('0x1a')](_0x5279dc);return _0x284334[_0xe207('0x20')](_0xe207('0x21'),_0x4d6b02+'-'+_0xe721d0+'/'+_0x5a86ad)[_0xe207('0x22')](_0x133099);}return null;};}function patchUpdates(_0x8541ff){return function(_0x59634e){try{jsonpatch['apply'](_0x59634e,_0x8541ff,!![]);}catch(_0x39b135){return BPromise['reject'](_0x39b135);}return _0x59634e[_0xe207('0x23')]();};}function saveUpdates(_0x342c66,_0x46f90c){return function(_0x330cf9){if(_0x330cf9){return _0x330cf9[_0xe207('0x24')](_0x342c66)[_0xe207('0x25')](function(_0x15a79b){return _0x15a79b;});}return null;};}function removeEntity(_0x597208,_0x431e49){return function(_0x1d8ad2){if(_0x1d8ad2){return _0x1d8ad2[_0xe207('0x26')]()[_0xe207('0x25')](function(){_0x597208[_0xe207('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c1d9f,_0x499dbd){return function(_0x5a1ae9){if(!_0x5a1ae9){_0x1c1d9f['sendStatus'](0x194);}return _0x5a1ae9;};}function handleError(_0x6cc9c3,_0x51244e){_0x51244e=_0x51244e||0x1f4;return function(_0x2d1b2b){logger[_0xe207('0x27')](_0x2d1b2b[_0xe207('0x28')]);if(_0x2d1b2b[_0xe207('0x29')]){delete _0x2d1b2b['name'];}_0x6cc9c3[_0xe207('0x1a')](_0x51244e)['send'](_0x2d1b2b);};}exports['index']=function(_0x5cfd4a,_0x1d6e22){var _0x2bb58e={},_0x11d06c={},_0x22073c={'count':0x0,'rows':[]};var _0x4efd0e=_['map'](db[_0xe207('0x2a')][_0xe207('0x2b')],function(_0x2e6424){return{'name':_0x2e6424[_0xe207('0x2c')],'type':_0x2e6424[_0xe207('0x2d')][_0xe207('0x2e')]};});_0x11d06c['model']=_['map'](_0x4efd0e,_0xe207('0x29'));_0x11d06c[_0xe207('0x2f')]=_[_0xe207('0x30')](_0x5cfd4a['query']);_0x11d06c[_0xe207('0x31')]=_[_0xe207('0x32')](_0x11d06c[_0xe207('0x33')],_0x11d06c[_0xe207('0x2f')]);_0x2bb58e[_0xe207('0x34')]=_[_0xe207('0x32')](_0x11d06c['model'],qs[_0xe207('0x35')](_0x5cfd4a[_0xe207('0x2f')][_0xe207('0x35')]));_0x2bb58e[_0xe207('0x34')]=_0x2bb58e[_0xe207('0x34')]['length']?_0x2bb58e[_0xe207('0x34')]:_0x11d06c['model'];if(!_0x5cfd4a['query']['hasOwnProperty']('nolimit')){_0x2bb58e[_0xe207('0x1e')]=qs[_0xe207('0x1e')](_0x5cfd4a[_0xe207('0x2f')][_0xe207('0x1e')]);_0x2bb58e['offset']=qs['offset'](_0x5cfd4a[_0xe207('0x2f')][_0xe207('0x1c')]);}_0x2bb58e[_0xe207('0x36')]=qs[_0xe207('0x37')](_0x5cfd4a[_0xe207('0x2f')][_0xe207('0x37')]);_0x2bb58e[_0xe207('0x38')]=qs['filters'](_['pick'](_0x5cfd4a['query'],_0x11d06c[_0xe207('0x31')]),_0x4efd0e);if(_0x5cfd4a['query'][_0xe207('0x39')]){_0x2bb58e[_0xe207('0x38')]=_[_0xe207('0x3a')](_0x2bb58e['where'],{'$or':_['map'](_0x4efd0e,function(_0x1713a2){if(_0x1713a2[_0xe207('0x2d')]!==_0xe207('0x3b')){var _0x5b1ba7={};_0x5b1ba7[_0x1713a2['name']]={'$like':'%'+_0x5cfd4a[_0xe207('0x2f')][_0xe207('0x39')]+'%'};return _0x5b1ba7;}})});}_0x2bb58e=_[_0xe207('0x3a')]({},_0x2bb58e,_0x5cfd4a['options']);var _0x4ffd87={'where':_0x2bb58e['where']};return db['SugarcrmConfiguration'][_0xe207('0x1f')](_0x4ffd87)[_0xe207('0x25')](function(_0x5ace2f){_0x22073c[_0xe207('0x1f')]=_0x5ace2f;if(_0x5cfd4a[_0xe207('0x2f')]['includeAll']){_0x2bb58e[_0xe207('0x3c')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x2bb58e);})[_0xe207('0x25')](function(_0x4fd29d){_0x22073c[_0xe207('0x3d')]=_0x4fd29d;return _0x22073c;})[_0xe207('0x25')](respondWithFilteredResult(_0x1d6e22,_0x2bb58e))[_0xe207('0x3e')](handleError(_0x1d6e22,null));};exports[_0xe207('0x3f')]=function(_0x42a9a6,_0x2544f2){var _0x5633cf={'raw':![],'where':{'id':_0x42a9a6[_0xe207('0x40')]['id']}},_0x1f6668={};_0x1f6668[_0xe207('0x33')]=_[_0xe207('0x30')](db[_0xe207('0x2a')][_0xe207('0x2b')]);_0x1f6668[_0xe207('0x2f')]=_['keys'](_0x42a9a6[_0xe207('0x2f')]);_0x1f6668[_0xe207('0x31')]=_[_0xe207('0x32')](_0x1f6668['model'],_0x1f6668['query']);_0x5633cf['attributes']=_['intersection'](_0x1f6668[_0xe207('0x33')],qs[_0xe207('0x35')](_0x42a9a6[_0xe207('0x2f')]['fields']));_0x5633cf[_0xe207('0x34')]=_0x5633cf[_0xe207('0x34')][_0xe207('0x41')]?_0x5633cf[_0xe207('0x34')]:_0x1f6668['model'];if(_0x42a9a6['query'][_0xe207('0x42')]){_0x5633cf['include']=[{'all':!![]}];}_0x5633cf=_[_0xe207('0x3a')]({},_0x5633cf,_0x42a9a6[_0xe207('0x43')]);return db['SugarcrmConfiguration']['find'](_0x5633cf)[_0xe207('0x25')](handleEntityNotFound(_0x2544f2,null))[_0xe207('0x25')](respondWithResult(_0x2544f2,null))[_0xe207('0x3e')](handleError(_0x2544f2,null));};exports[_0xe207('0x44')]=function(_0x99e331,_0x403202){return db[_0xe207('0x2a')][_0xe207('0x44')](_0x99e331[_0xe207('0x45')],{})[_0xe207('0x25')](respondWithResult(_0x403202,0xc9))[_0xe207('0x3e')](handleError(_0x403202,null));};exports[_0xe207('0x24')]=function(_0x2a3faa,_0x53d70d){if(_0x2a3faa['body']['id']){delete _0x2a3faa['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2a3faa[_0xe207('0x40')]['id']}})[_0xe207('0x25')](handleEntityNotFound(_0x53d70d,null))[_0xe207('0x25')](saveUpdates(_0x2a3faa[_0xe207('0x45')],null))[_0xe207('0x25')](respondWithResult(_0x53d70d,null))['catch'](handleError(_0x53d70d,null));};exports[_0xe207('0x26')]=function(_0x5ba0a9,_0xac3c20){return db[_0xe207('0x2a')]['find']({'where':{'id':_0x5ba0a9[_0xe207('0x40')]['id']}})[_0xe207('0x25')](handleEntityNotFound(_0xac3c20,null))[_0xe207('0x25')](removeEntity(_0xac3c20,null))['catch'](handleError(_0xac3c20,null));};exports['getFields']=function(_0x56947c,_0x49a0fe,_0x58dfa9){var _0x2e51be={};var _0x4dc1a1={};var _0x143c49;var _0x1746d0;return db['SugarcrmConfiguration'][_0xe207('0x46')]({'where':{'id':_0x56947c[_0xe207('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a0fe,null))[_0xe207('0x25')](function(_0x10d8d0){if(_0x10d8d0){_0x143c49=_0x10d8d0;_0x4dc1a1[_0xe207('0x33')]=_[_0xe207('0x30')](db[_0xe207('0x47')][_0xe207('0x2b')]);_0x4dc1a1[_0xe207('0x2f')]=_[_0xe207('0x30')](_0x56947c['query']);_0x4dc1a1[_0xe207('0x31')]=_['intersection'](_0x4dc1a1['model'],_0x4dc1a1[_0xe207('0x2f')]);_0x2e51be[_0xe207('0x34')]=_[_0xe207('0x32')](_0x4dc1a1['model'],qs['fields'](_0x56947c[_0xe207('0x2f')][_0xe207('0x35')]));_0x2e51be[_0xe207('0x34')]=_0x2e51be[_0xe207('0x34')][_0xe207('0x41')]?_0x2e51be[_0xe207('0x34')]:_0x4dc1a1[_0xe207('0x33')];_0x2e51be['order']=qs[_0xe207('0x37')](_0x56947c[_0xe207('0x2f')][_0xe207('0x37')]);_0x2e51be[_0xe207('0x38')]=qs[_0xe207('0x31')](_['pick'](_0x56947c[_0xe207('0x2f')],_0x4dc1a1[_0xe207('0x31')]));if(_0x56947c[_0xe207('0x2f')][_0xe207('0x39')]){_0x2e51be[_0xe207('0x38')]=_[_0xe207('0x3a')](_0x2e51be[_0xe207('0x38')],{'$or':_[_0xe207('0x48')](_0x2e51be['attributes'],function(_0x471fdf){var _0x2d6c41={};_0x2d6c41[_0x471fdf]={'$like':'%'+_0x56947c[_0xe207('0x2f')][_0xe207('0x39')]+'%'};return _0x2d6c41;})});}_0x2e51be=_[_0xe207('0x3a')]({},_0x2e51be,_0x56947c[_0xe207('0x43')]);return _0x143c49[_0xe207('0x49')](_0x2e51be);}})[_0xe207('0x25')](function(_0x443560){if(_0x443560){_0x1746d0=_0x443560[_0xe207('0x41')];if(!_0x56947c[_0xe207('0x2f')]['hasOwnProperty']('nolimit')){_0x2e51be[_0xe207('0x1e')]=qs[_0xe207('0x1e')](_0x56947c['query']['limit']);_0x2e51be['offset']=qs[_0xe207('0x1c')](_0x56947c['query'][_0xe207('0x1c')]);}return _0x143c49[_0xe207('0x49')](_0x2e51be);}})[_0xe207('0x25')](function(_0x16c4cf){if(_0x16c4cf){return _0x16c4cf?{'count':_0x1746d0,'rows':_0x16c4cf}:null;}})[_0xe207('0x25')](respondWithResult(_0x49a0fe,null))['catch'](handleError(_0x49a0fe,null));};exports['getSubjects']=function(_0x11fff6,_0x20bd90,_0x584c10){var _0x4113fe={};var _0x39369f={};var _0x457bc0;var _0xc91903;return db['SugarcrmConfiguration'][_0xe207('0x46')]({'where':{'id':_0x11fff6[_0xe207('0x40')]['id']}})[_0xe207('0x25')](handleEntityNotFound(_0x20bd90,null))[_0xe207('0x25')](function(_0x13d6c9){if(_0x13d6c9){_0x457bc0=_0x13d6c9;_0x39369f[_0xe207('0x33')]=_['keys'](db['SugarcrmField'][_0xe207('0x2b')]);_0x39369f['query']=_[_0xe207('0x30')](_0x11fff6['query']);_0x39369f[_0xe207('0x31')]=_['intersection'](_0x39369f[_0xe207('0x33')],_0x39369f[_0xe207('0x2f')]);_0x4113fe['attributes']=_['intersection'](_0x39369f[_0xe207('0x33')],qs['fields'](_0x11fff6['query'][_0xe207('0x35')]));_0x4113fe[_0xe207('0x34')]=_0x4113fe[_0xe207('0x34')]['length']?_0x4113fe['attributes']:_0x39369f['model'];_0x4113fe[_0xe207('0x36')]=qs[_0xe207('0x37')](_0x11fff6['query'][_0xe207('0x37')]);_0x4113fe[_0xe207('0x38')]=qs['filters'](_[_0xe207('0x4a')](_0x11fff6[_0xe207('0x2f')],_0x39369f[_0xe207('0x31')]));if(_0x11fff6[_0xe207('0x2f')][_0xe207('0x39')]){_0x4113fe[_0xe207('0x38')]=_[_0xe207('0x3a')](_0x4113fe[_0xe207('0x38')],{'$or':_['map'](_0x4113fe['attributes'],function(_0x5c5450){var _0x41c4f3={};_0x41c4f3[_0x5c5450]={'$like':'%'+_0x11fff6[_0xe207('0x2f')][_0xe207('0x39')]+'%'};return _0x41c4f3;})});}_0x4113fe=_['merge']({},_0x4113fe,_0x11fff6['options']);return _0x457bc0[_0xe207('0x4b')](_0x4113fe);}})['then'](function(_0x36b8d5){if(_0x36b8d5){_0xc91903=_0x36b8d5[_0xe207('0x41')];if(!_0x11fff6[_0xe207('0x2f')][_0xe207('0x4c')]('nolimit')){_0x4113fe[_0xe207('0x1e')]=qs[_0xe207('0x1e')](_0x11fff6[_0xe207('0x2f')][_0xe207('0x1e')]);_0x4113fe[_0xe207('0x1c')]=qs['offset'](_0x11fff6[_0xe207('0x2f')][_0xe207('0x1c')]);}return _0x457bc0[_0xe207('0x4b')](_0x4113fe);}})['then'](function(_0x5f23f4){if(_0x5f23f4){return _0x5f23f4?{'count':_0xc91903,'rows':_0x5f23f4}:null;}})[_0xe207('0x25')](respondWithResult(_0x20bd90,null))[_0xe207('0x3e')](handleError(_0x20bd90,null));};exports[_0xe207('0x4d')]=function(_0x39caf6,_0x217a19,_0x752b32){var _0x2ea70e={};var _0x45ffdc={};var _0x450ddb;var _0x1f7f73;return db[_0xe207('0x2a')][_0xe207('0x46')]({'where':{'id':_0x39caf6[_0xe207('0x40')]['id']}})[_0xe207('0x25')](handleEntityNotFound(_0x217a19,null))[_0xe207('0x25')](function(_0x284c6d){if(_0x284c6d){_0x450ddb=_0x284c6d;_0x45ffdc[_0xe207('0x33')]=_[_0xe207('0x30')](db['SugarcrmField'][_0xe207('0x2b')]);_0x45ffdc[_0xe207('0x2f')]=_['keys'](_0x39caf6[_0xe207('0x2f')]);_0x45ffdc[_0xe207('0x31')]=_['intersection'](_0x45ffdc['model'],_0x45ffdc[_0xe207('0x2f')]);_0x2ea70e['attributes']=_[_0xe207('0x32')](_0x45ffdc[_0xe207('0x33')],qs['fields'](_0x39caf6[_0xe207('0x2f')]['fields']));_0x2ea70e['attributes']=_0x2ea70e[_0xe207('0x34')]['length']?_0x2ea70e[_0xe207('0x34')]:_0x45ffdc[_0xe207('0x33')];_0x2ea70e[_0xe207('0x36')]=qs['sort'](_0x39caf6[_0xe207('0x2f')][_0xe207('0x37')]);_0x2ea70e[_0xe207('0x38')]=qs['filters'](_['pick'](_0x39caf6[_0xe207('0x2f')],_0x45ffdc[_0xe207('0x31')]));if(_0x39caf6[_0xe207('0x2f')][_0xe207('0x39')]){_0x2ea70e['where']=_[_0xe207('0x3a')](_0x2ea70e['where'],{'$or':_[_0xe207('0x48')](_0x2ea70e[_0xe207('0x34')],function(_0x207b5b){var _0x4be8de={};_0x4be8de[_0x207b5b]={'$like':'%'+_0x39caf6['query'][_0xe207('0x39')]+'%'};return _0x4be8de;})});}_0x2ea70e=_[_0xe207('0x3a')]({},_0x2ea70e,_0x39caf6[_0xe207('0x43')]);return _0x450ddb['getDescriptions'](_0x2ea70e);}})[_0xe207('0x25')](function(_0x19365b){if(_0x19365b){_0x1f7f73=_0x19365b['length'];if(!_0x39caf6[_0xe207('0x2f')][_0xe207('0x4c')]('nolimit')){_0x2ea70e[_0xe207('0x1e')]=qs[_0xe207('0x1e')](_0x39caf6[_0xe207('0x2f')][_0xe207('0x1e')]);_0x2ea70e[_0xe207('0x1c')]=qs['offset'](_0x39caf6['query'][_0xe207('0x1c')]);}return _0x450ddb[_0xe207('0x4d')](_0x2ea70e);}})['then'](function(_0x3709ac){if(_0x3709ac){return _0x3709ac?{'count':_0x1f7f73,'rows':_0x3709ac}:null;}})[_0xe207('0x25')](respondWithResult(_0x217a19,null))[_0xe207('0x3e')](handleError(_0x217a19,null));}; \ No newline at end of file +var _0xc51c=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','SugarcrmConfiguration','body','find','getFields','findOne','SugarcrmField','getSubjects','options','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','apply','reject','save','update','then','destroy','error','name','send','map'];(function(_0x5e4952,_0x22df1d){var _0x51b527=function(_0x29550e){while(--_0x29550e){_0x5e4952['push'](_0x5e4952['shift']());}};_0x51b527(++_0x22df1d);}(_0xc51c,0x104));var _0xcc51=function(_0x20cdda,_0x5bd66b){_0x20cdda=_0x20cdda-0x0;var _0x2e48a7=_0xc51c[_0x20cdda];return _0x2e48a7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcc51('0x0'));var jsonpatch=require(_0xcc51('0x1'));var rp=require(_0xcc51('0x2'));var moment=require(_0xcc51('0x3'));var BPromise=require(_0xcc51('0x4'));var Mustache=require(_0xcc51('0x5'));var util=require(_0xcc51('0x6'));var path=require(_0xcc51('0x7'));var sox=require(_0xcc51('0x8'));var csv=require(_0xcc51('0x9'));var ejs=require(_0xcc51('0xa'));var fs=require('fs');var fs_extra=require(_0xcc51('0xb'));var _=require(_0xcc51('0xc'));var squel=require('squel');var crypto=require(_0xcc51('0xd'));var jsforce=require(_0xcc51('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcc51('0x9'));var querystring=require(_0xcc51('0xf'));var Papa=require(_0xcc51('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcc51('0x11'));var as=require(_0xcc51('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc51('0x13'))(_0xcc51('0x14'));var utils=require('../../config/utils');var config=require(_0xcc51('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc51('0x16'))['db'];function respondWithStatusCode(_0x2c2cd8,_0x334a18){_0x334a18=_0x334a18||0xcc;return function(_0x50f25a){if(_0x50f25a){return _0x2c2cd8[_0xcc51('0x17')](_0x334a18);}return _0x2c2cd8[_0xcc51('0x18')](_0x334a18)[_0xcc51('0x19')]();};}function respondWithResult(_0x425317,_0x4bbf4e){_0x4bbf4e=_0x4bbf4e||0xc8;return function(_0x2ca7ec){if(_0x2ca7ec){return _0x425317[_0xcc51('0x18')](_0x4bbf4e)[_0xcc51('0x1a')](_0x2ca7ec);}};}function respondWithFilteredResult(_0xd86957,_0xf4f85){return function(_0x4030b2){if(_0x4030b2){var _0x1b4be4=typeof _0xf4f85[_0xcc51('0x1b')]==='undefined'&&typeof _0xf4f85[_0xcc51('0x1c')]==='undefined';var _0x507fb9=_0x4030b2['count'];var _0x3db8df=_0x1b4be4?0x0:_0xf4f85[_0xcc51('0x1b')];var _0x5d3aac=_0x1b4be4?_0x4030b2[_0xcc51('0x1d')]:_0xf4f85[_0xcc51('0x1b')]+_0xf4f85[_0xcc51('0x1c')];var _0x55fa41;if(_0x5d3aac>=_0x507fb9){_0x5d3aac=_0x507fb9;_0x55fa41=0xc8;}else{_0x55fa41=0xce;}_0xd86957[_0xcc51('0x18')](_0x55fa41);return _0xd86957['set']('Content-Range',_0x3db8df+'-'+_0x5d3aac+'/'+_0x507fb9)[_0xcc51('0x1a')](_0x4030b2);}return null;};}function patchUpdates(_0x2f6e1a){return function(_0xe8fe76){try{jsonpatch[_0xcc51('0x1e')](_0xe8fe76,_0x2f6e1a,!![]);}catch(_0x5f3feb){return BPromise[_0xcc51('0x1f')](_0x5f3feb);}return _0xe8fe76[_0xcc51('0x20')]();};}function saveUpdates(_0x8eb110,_0x59c2c1){return function(_0x1a70c1){if(_0x1a70c1){return _0x1a70c1[_0xcc51('0x21')](_0x8eb110)[_0xcc51('0x22')](function(_0x184503){return _0x184503;});}return null;};}function removeEntity(_0x5d29ea,_0x54109a){return function(_0x3a0ce4){if(_0x3a0ce4){return _0x3a0ce4[_0xcc51('0x23')]()[_0xcc51('0x22')](function(){_0x5d29ea[_0xcc51('0x18')](0xcc)[_0xcc51('0x19')]();});}};}function handleEntityNotFound(_0x3a97f9,_0x3b6fa6){return function(_0x256e41){if(!_0x256e41){_0x3a97f9[_0xcc51('0x17')](0x194);}return _0x256e41;};}function handleError(_0x571851,_0x9c09c){_0x9c09c=_0x9c09c||0x1f4;return function(_0x30fd90){logger[_0xcc51('0x24')](_0x30fd90['stack']);if(_0x30fd90[_0xcc51('0x25')]){delete _0x30fd90[_0xcc51('0x25')];}_0x571851['status'](_0x9c09c)[_0xcc51('0x26')](_0x30fd90);};}exports['index']=function(_0x47ec38,_0xd937bd){var _0x563250={},_0x2a3c20={},_0x45fa71={'count':0x0,'rows':[]};var _0x138f66=_[_0xcc51('0x27')](db['SugarcrmConfiguration'][_0xcc51('0x28')],function(_0x59753b){return{'name':_0x59753b[_0xcc51('0x29')],'type':_0x59753b[_0xcc51('0x2a')][_0xcc51('0x2b')]};});_0x2a3c20[_0xcc51('0x2c')]=_[_0xcc51('0x27')](_0x138f66,_0xcc51('0x25'));_0x2a3c20[_0xcc51('0x2d')]=_[_0xcc51('0x2e')](_0x47ec38[_0xcc51('0x2d')]);_0x2a3c20[_0xcc51('0x2f')]=_[_0xcc51('0x30')](_0x2a3c20[_0xcc51('0x2c')],_0x2a3c20['query']);_0x563250[_0xcc51('0x31')]=_['intersection'](_0x2a3c20['model'],qs[_0xcc51('0x32')](_0x47ec38[_0xcc51('0x2d')][_0xcc51('0x32')]));_0x563250[_0xcc51('0x31')]=_0x563250[_0xcc51('0x31')][_0xcc51('0x33')]?_0x563250['attributes']:_0x2a3c20['model'];if(!_0x47ec38[_0xcc51('0x2d')][_0xcc51('0x34')](_0xcc51('0x35'))){_0x563250[_0xcc51('0x1c')]=qs['limit'](_0x47ec38[_0xcc51('0x2d')][_0xcc51('0x1c')]);_0x563250['offset']=qs[_0xcc51('0x1b')](_0x47ec38[_0xcc51('0x2d')][_0xcc51('0x1b')]);}_0x563250[_0xcc51('0x36')]=qs['sort'](_0x47ec38[_0xcc51('0x2d')][_0xcc51('0x37')]);_0x563250[_0xcc51('0x38')]=qs[_0xcc51('0x2f')](_[_0xcc51('0x39')](_0x47ec38[_0xcc51('0x2d')],_0x2a3c20[_0xcc51('0x2f')]),_0x138f66);if(_0x47ec38[_0xcc51('0x2d')][_0xcc51('0x3a')]){_0x563250['where']=_[_0xcc51('0x3b')](_0x563250['where'],{'$or':_[_0xcc51('0x27')](_0x138f66,function(_0x31ee35){if(_0x31ee35[_0xcc51('0x2a')]!=='VIRTUAL'){var _0x3d7af1={};_0x3d7af1[_0x31ee35[_0xcc51('0x25')]]={'$like':'%'+_0x47ec38[_0xcc51('0x2d')][_0xcc51('0x3a')]+'%'};return _0x3d7af1;}})});}_0x563250=_[_0xcc51('0x3b')]({},_0x563250,_0x47ec38['options']);var _0x331472={'where':_0x563250[_0xcc51('0x38')]};return db['SugarcrmConfiguration'][_0xcc51('0x1d')](_0x331472)['then'](function(_0x30ad95){_0x45fa71[_0xcc51('0x1d')]=_0x30ad95;if(_0x47ec38[_0xcc51('0x2d')][_0xcc51('0x3c')]){_0x563250[_0xcc51('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xcc51('0x3e')](_0x563250);})['then'](function(_0x219fb9){_0x45fa71['rows']=_0x219fb9;return _0x45fa71;})[_0xcc51('0x22')](respondWithFilteredResult(_0xd937bd,_0x563250))[_0xcc51('0x3f')](handleError(_0xd937bd,null));};exports[_0xcc51('0x40')]=function(_0x2d7684,_0x47a3dc){var _0x9dc6cb={'raw':![],'where':{'id':_0x2d7684[_0xcc51('0x41')]['id']}},_0x12e1d7={};_0x12e1d7[_0xcc51('0x2c')]=_[_0xcc51('0x2e')](db[_0xcc51('0x42')][_0xcc51('0x28')]);_0x12e1d7[_0xcc51('0x2d')]=_[_0xcc51('0x2e')](_0x2d7684[_0xcc51('0x2d')]);_0x12e1d7[_0xcc51('0x2f')]=_['intersection'](_0x12e1d7[_0xcc51('0x2c')],_0x12e1d7[_0xcc51('0x2d')]);_0x9dc6cb['attributes']=_['intersection'](_0x12e1d7[_0xcc51('0x2c')],qs['fields'](_0x2d7684['query']['fields']));_0x9dc6cb[_0xcc51('0x31')]=_0x9dc6cb[_0xcc51('0x31')]['length']?_0x9dc6cb[_0xcc51('0x31')]:_0x12e1d7['model'];if(_0x2d7684[_0xcc51('0x2d')][_0xcc51('0x3c')]){_0x9dc6cb['include']=[{'all':!![]}];}_0x9dc6cb=_[_0xcc51('0x3b')]({},_0x9dc6cb,_0x2d7684['options']);return db['SugarcrmConfiguration']['find'](_0x9dc6cb)[_0xcc51('0x22')](handleEntityNotFound(_0x47a3dc,null))[_0xcc51('0x22')](respondWithResult(_0x47a3dc,null))['catch'](handleError(_0x47a3dc,null));};exports['create']=function(_0x290ab6,_0x3ba780){return db[_0xcc51('0x42')]['create'](_0x290ab6[_0xcc51('0x43')],{})[_0xcc51('0x22')](respondWithResult(_0x3ba780,0xc9))[_0xcc51('0x3f')](handleError(_0x3ba780,null));};exports['update']=function(_0x5c8b22,_0x1d6010){if(_0x5c8b22[_0xcc51('0x43')]['id']){delete _0x5c8b22['body']['id'];}return db[_0xcc51('0x42')]['find']({'where':{'id':_0x5c8b22[_0xcc51('0x41')]['id']}})[_0xcc51('0x22')](handleEntityNotFound(_0x1d6010,null))[_0xcc51('0x22')](saveUpdates(_0x5c8b22[_0xcc51('0x43')],null))[_0xcc51('0x22')](respondWithResult(_0x1d6010,null))[_0xcc51('0x3f')](handleError(_0x1d6010,null));};exports[_0xcc51('0x23')]=function(_0x3d19df,_0x496f7a){return db[_0xcc51('0x42')][_0xcc51('0x44')]({'where':{'id':_0x3d19df[_0xcc51('0x41')]['id']}})[_0xcc51('0x22')](handleEntityNotFound(_0x496f7a,null))[_0xcc51('0x22')](removeEntity(_0x496f7a,null))[_0xcc51('0x3f')](handleError(_0x496f7a,null));};exports[_0xcc51('0x45')]=function(_0x28c27e,_0x50ff5d,_0x92d34a){var _0x2a07d5={};var _0x40c0ac={};var _0x442749;var _0x2cafc5;return db[_0xcc51('0x42')][_0xcc51('0x46')]({'where':{'id':_0x28c27e[_0xcc51('0x41')]['id']}})[_0xcc51('0x22')](handleEntityNotFound(_0x50ff5d,null))[_0xcc51('0x22')](function(_0x47ad64){if(_0x47ad64){_0x442749=_0x47ad64;_0x40c0ac[_0xcc51('0x2c')]=_[_0xcc51('0x2e')](db[_0xcc51('0x47')][_0xcc51('0x28')]);_0x40c0ac[_0xcc51('0x2d')]=_[_0xcc51('0x2e')](_0x28c27e[_0xcc51('0x2d')]);_0x40c0ac[_0xcc51('0x2f')]=_[_0xcc51('0x30')](_0x40c0ac[_0xcc51('0x2c')],_0x40c0ac['query']);_0x2a07d5[_0xcc51('0x31')]=_[_0xcc51('0x30')](_0x40c0ac[_0xcc51('0x2c')],qs[_0xcc51('0x32')](_0x28c27e[_0xcc51('0x2d')][_0xcc51('0x32')]));_0x2a07d5['attributes']=_0x2a07d5[_0xcc51('0x31')][_0xcc51('0x33')]?_0x2a07d5[_0xcc51('0x31')]:_0x40c0ac[_0xcc51('0x2c')];_0x2a07d5[_0xcc51('0x36')]=qs[_0xcc51('0x37')](_0x28c27e[_0xcc51('0x2d')][_0xcc51('0x37')]);_0x2a07d5['where']=qs[_0xcc51('0x2f')](_['pick'](_0x28c27e[_0xcc51('0x2d')],_0x40c0ac[_0xcc51('0x2f')]));if(_0x28c27e[_0xcc51('0x2d')][_0xcc51('0x3a')]){_0x2a07d5[_0xcc51('0x38')]=_['merge'](_0x2a07d5[_0xcc51('0x38')],{'$or':_[_0xcc51('0x27')](_0x2a07d5[_0xcc51('0x31')],function(_0x80c66b){var _0x384400={};_0x384400[_0x80c66b]={'$like':'%'+_0x28c27e[_0xcc51('0x2d')][_0xcc51('0x3a')]+'%'};return _0x384400;})});}_0x2a07d5=_[_0xcc51('0x3b')]({},_0x2a07d5,_0x28c27e['options']);return _0x442749[_0xcc51('0x45')](_0x2a07d5);}})[_0xcc51('0x22')](function(_0x4b500a){if(_0x4b500a){_0x2cafc5=_0x4b500a[_0xcc51('0x33')];if(!_0x28c27e[_0xcc51('0x2d')][_0xcc51('0x34')](_0xcc51('0x35'))){_0x2a07d5[_0xcc51('0x1c')]=qs[_0xcc51('0x1c')](_0x28c27e[_0xcc51('0x2d')][_0xcc51('0x1c')]);_0x2a07d5[_0xcc51('0x1b')]=qs['offset'](_0x28c27e[_0xcc51('0x2d')]['offset']);}return _0x442749[_0xcc51('0x45')](_0x2a07d5);}})[_0xcc51('0x22')](function(_0x3cf3d0){if(_0x3cf3d0){return _0x3cf3d0?{'count':_0x2cafc5,'rows':_0x3cf3d0}:null;}})['then'](respondWithResult(_0x50ff5d,null))[_0xcc51('0x3f')](handleError(_0x50ff5d,null));};exports[_0xcc51('0x48')]=function(_0x4d34ec,_0x2f1d18,_0x16a132){var _0x4c74f6={};var _0x5468a8={};var _0x3bd6d2;var _0x2e8cab;return db['SugarcrmConfiguration'][_0xcc51('0x46')]({'where':{'id':_0x4d34ec[_0xcc51('0x41')]['id']}})[_0xcc51('0x22')](handleEntityNotFound(_0x2f1d18,null))[_0xcc51('0x22')](function(_0xbeb9ab){if(_0xbeb9ab){_0x3bd6d2=_0xbeb9ab;_0x5468a8[_0xcc51('0x2c')]=_[_0xcc51('0x2e')](db[_0xcc51('0x47')][_0xcc51('0x28')]);_0x5468a8[_0xcc51('0x2d')]=_[_0xcc51('0x2e')](_0x4d34ec['query']);_0x5468a8[_0xcc51('0x2f')]=_[_0xcc51('0x30')](_0x5468a8[_0xcc51('0x2c')],_0x5468a8[_0xcc51('0x2d')]);_0x4c74f6['attributes']=_['intersection'](_0x5468a8[_0xcc51('0x2c')],qs[_0xcc51('0x32')](_0x4d34ec[_0xcc51('0x2d')]['fields']));_0x4c74f6[_0xcc51('0x31')]=_0x4c74f6['attributes'][_0xcc51('0x33')]?_0x4c74f6['attributes']:_0x5468a8[_0xcc51('0x2c')];_0x4c74f6[_0xcc51('0x36')]=qs['sort'](_0x4d34ec[_0xcc51('0x2d')][_0xcc51('0x37')]);_0x4c74f6[_0xcc51('0x38')]=qs['filters'](_[_0xcc51('0x39')](_0x4d34ec['query'],_0x5468a8['filters']));if(_0x4d34ec['query']['filter']){_0x4c74f6['where']=_[_0xcc51('0x3b')](_0x4c74f6['where'],{'$or':_['map'](_0x4c74f6[_0xcc51('0x31')],function(_0x31eff6){var _0x35bc4f={};_0x35bc4f[_0x31eff6]={'$like':'%'+_0x4d34ec[_0xcc51('0x2d')][_0xcc51('0x3a')]+'%'};return _0x35bc4f;})});}_0x4c74f6=_[_0xcc51('0x3b')]({},_0x4c74f6,_0x4d34ec['options']);return _0x3bd6d2['getSubjects'](_0x4c74f6);}})[_0xcc51('0x22')](function(_0x259814){if(_0x259814){_0x2e8cab=_0x259814[_0xcc51('0x33')];if(!_0x4d34ec['query'][_0xcc51('0x34')]('nolimit')){_0x4c74f6[_0xcc51('0x1c')]=qs[_0xcc51('0x1c')](_0x4d34ec[_0xcc51('0x2d')][_0xcc51('0x1c')]);_0x4c74f6[_0xcc51('0x1b')]=qs[_0xcc51('0x1b')](_0x4d34ec[_0xcc51('0x2d')][_0xcc51('0x1b')]);}return _0x3bd6d2[_0xcc51('0x48')](_0x4c74f6);}})[_0xcc51('0x22')](function(_0x10a918){if(_0x10a918){return _0x10a918?{'count':_0x2e8cab,'rows':_0x10a918}:null;}})[_0xcc51('0x22')](respondWithResult(_0x2f1d18,null))[_0xcc51('0x3f')](handleError(_0x2f1d18,null));};exports['getDescriptions']=function(_0x4d2ad9,_0x554173,_0x46ff7b){var _0x2b1456={};var _0x1a583d={};var _0x1b77a7;var _0x363de4;return db[_0xcc51('0x42')][_0xcc51('0x46')]({'where':{'id':_0x4d2ad9[_0xcc51('0x41')]['id']}})[_0xcc51('0x22')](handleEntityNotFound(_0x554173,null))[_0xcc51('0x22')](function(_0x27e959){if(_0x27e959){_0x1b77a7=_0x27e959;_0x1a583d['model']=_[_0xcc51('0x2e')](db[_0xcc51('0x47')][_0xcc51('0x28')]);_0x1a583d[_0xcc51('0x2d')]=_[_0xcc51('0x2e')](_0x4d2ad9[_0xcc51('0x2d')]);_0x1a583d[_0xcc51('0x2f')]=_[_0xcc51('0x30')](_0x1a583d[_0xcc51('0x2c')],_0x1a583d[_0xcc51('0x2d')]);_0x2b1456[_0xcc51('0x31')]=_[_0xcc51('0x30')](_0x1a583d['model'],qs[_0xcc51('0x32')](_0x4d2ad9[_0xcc51('0x2d')]['fields']));_0x2b1456[_0xcc51('0x31')]=_0x2b1456[_0xcc51('0x31')]['length']?_0x2b1456[_0xcc51('0x31')]:_0x1a583d[_0xcc51('0x2c')];_0x2b1456[_0xcc51('0x36')]=qs[_0xcc51('0x37')](_0x4d2ad9[_0xcc51('0x2d')][_0xcc51('0x37')]);_0x2b1456[_0xcc51('0x38')]=qs['filters'](_[_0xcc51('0x39')](_0x4d2ad9[_0xcc51('0x2d')],_0x1a583d[_0xcc51('0x2f')]));if(_0x4d2ad9[_0xcc51('0x2d')][_0xcc51('0x3a')]){_0x2b1456[_0xcc51('0x38')]=_['merge'](_0x2b1456[_0xcc51('0x38')],{'$or':_[_0xcc51('0x27')](_0x2b1456['attributes'],function(_0x332cb8){var _0x55b953={};_0x55b953[_0x332cb8]={'$like':'%'+_0x4d2ad9[_0xcc51('0x2d')][_0xcc51('0x3a')]+'%'};return _0x55b953;})});}_0x2b1456=_[_0xcc51('0x3b')]({},_0x2b1456,_0x4d2ad9[_0xcc51('0x49')]);return _0x1b77a7[_0xcc51('0x4a')](_0x2b1456);}})[_0xcc51('0x22')](function(_0x156b19){if(_0x156b19){_0x363de4=_0x156b19[_0xcc51('0x33')];if(!_0x4d2ad9['query'][_0xcc51('0x34')](_0xcc51('0x35'))){_0x2b1456[_0xcc51('0x1c')]=qs[_0xcc51('0x1c')](_0x4d2ad9[_0xcc51('0x2d')]['limit']);_0x2b1456[_0xcc51('0x1b')]=qs[_0xcc51('0x1b')](_0x4d2ad9['query'][_0xcc51('0x1b')]);}return _0x1b77a7[_0xcc51('0x4a')](_0x2b1456);}})[_0xcc51('0x22')](function(_0x307c87){if(_0x307c87){return _0x307c87?{'count':_0x363de4,'rows':_0x307c87}:null;}})[_0xcc51('0x22')](respondWithResult(_0x554173,null))['catch'](handleError(_0x554173,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a41ccbf..d59818d 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 _0x04ec=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','lodash','util','api','request-promise'];(function(_0x48eed7,_0x5e1075){var _0x37ade4=function(_0x4278c5){while(--_0x4278c5){_0x48eed7['push'](_0x48eed7['shift']());}};_0x37ade4(++_0x5e1075);}(_0x04ec,0x15b));var _0xc04e=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x04ec[_0x38854e];return _0x3f8415;};'use strict';var _=require(_0xc04e('0x0'));var util=require(_0xc04e('0x1'));var logger=require('../../config/logger')(_0xc04e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc04e('0x3'));var fs=require('fs');var path=require(_0xc04e('0x4'));var rimraf=require(_0xc04e('0x5'));var config=require(_0xc04e('0x6'));var attributes=require(_0xc04e('0x7'));module[_0xc04e('0x8')]=function(_0x5de6ff,_0x4b678a){return _0x5de6ff['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe09a=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x194d23,_0x35b80e){var _0x159102=function(_0x220342){while(--_0x220342){_0x194d23['push'](_0x194d23['shift']());}};_0x159102(++_0x35b80e);}(_0xe09a,0x112));var _0xae09=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0xe09a[_0x1a21ff];return _0x25afc1;};'use strict';var _=require(_0xae09('0x0'));var util=require(_0xae09('0x1'));var logger=require(_0xae09('0x2'))(_0xae09('0x3'));var moment=require(_0xae09('0x4'));var BPromise=require('bluebird');var rp=require(_0xae09('0x5'));var fs=require('fs');var path=require(_0xae09('0x6'));var rimraf=require('rimraf');var config=require(_0xae09('0x7'));var attributes=require(_0xae09('0x8'));module[_0xae09('0x9')]=function(_0x20e2bd,_0x5689bd){return _0x20e2bd[_0xae09('0xa')](_0xae09('0xb'),attributes,{'tableName':_0xae09('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 12216f1..061f4cc 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 _0x53a6=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0xddef8,_0x23d498){var _0x5c469a=function(_0x5d7af3){while(--_0x5d7af3){_0xddef8['push'](_0xddef8['shift']());}};_0x5c469a(++_0x23d498);}(_0x53a6,0xfa));var _0x653a=function(_0x2e3593,_0xb35bc9){_0x2e3593=_0x2e3593-0x0;var _0x399221=_0x53a6[_0x2e3593];return _0x399221;};'use strict';var _=require(_0x653a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x653a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x653a('0x2'))['db'];var utils=require(_0x653a('0x3'));var logger=require(_0x653a('0x4'))(_0x653a('0x5'));var config=require(_0x653a('0x6'));var jayson=require(_0x653a('0x7'));var client=jayson[_0x653a('0x8')][_0x653a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x162720,_0x3e1554,_0x4fd701){return new BPromise(function(_0x3187d8,_0x4d3b0d){return client[_0x653a('0xa')](_0x162720,_0x4fd701)[_0x653a('0xb')](function(_0xac6565){logger[_0x653a('0xc')](_0x653a('0xd'),_0x3e1554,_0x653a('0xe'));logger[_0x653a('0xf')](_0x653a('0x10'),_0x3e1554,_0x653a('0xe'),JSON[_0x653a('0x11')](_0xac6565));if(_0xac6565['error']){if(_0xac6565[_0x653a('0x12')]['code']===0x1f4){logger[_0x653a('0x12')](_0x653a('0xd'),_0x3e1554,_0xac6565['error']['message']);return _0x4d3b0d(_0xac6565[_0x653a('0x12')][_0x653a('0x13')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3e1554,_0xac6565[_0x653a('0x12')][_0x653a('0x13')]);return _0x3187d8(_0xac6565['error'][_0x653a('0x13')]);}else{logger['info'](_0x653a('0xd'),_0x3e1554,_0x653a('0xe'));_0x3187d8(_0xac6565[_0x653a('0x14')][_0x653a('0x13')]);}})[_0x653a('0x15')](function(_0x1094df){logger['error'](_0x653a('0xd'),_0x3e1554,_0x1094df);_0x4d3b0d(_0x1094df);});});} \ No newline at end of file +var _0x5fa9=['stringify','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x5fa9,0xe2));var _0x95fa=function(_0x437b02,_0x34b630){_0x437b02=_0x437b02-0x0;var _0xf8c681=_0x5fa9[_0x437b02];return _0xf8c681;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x95fa('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95fa('0x1'));var db=require(_0x95fa('0x2'))['db'];var utils=require(_0x95fa('0x3'));var logger=require(_0x95fa('0x4'))('rpc');var config=require(_0x95fa('0x5'));var jayson=require(_0x95fa('0x6'));var client=jayson[_0x95fa('0x7')][_0x95fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24efa3,_0x370fe5,_0x613b5){return new BPromise(function(_0x1c0009,_0x596067){return client[_0x95fa('0x9')](_0x24efa3,_0x613b5)[_0x95fa('0xa')](function(_0x5e1229){logger[_0x95fa('0xb')](_0x95fa('0xc'),_0x370fe5,_0x95fa('0xd'));logger[_0x95fa('0xe')](_0x95fa('0xf'),_0x370fe5,_0x95fa('0xd'),JSON[_0x95fa('0x10')](_0x5e1229));if(_0x5e1229[_0x95fa('0x11')]){if(_0x5e1229[_0x95fa('0x11')][_0x95fa('0x12')]===0x1f4){logger[_0x95fa('0x11')](_0x95fa('0xc'),_0x370fe5,_0x5e1229['error']['message']);return _0x596067(_0x5e1229['error'][_0x95fa('0x13')]);}logger[_0x95fa('0x11')](_0x95fa('0xc'),_0x370fe5,_0x5e1229[_0x95fa('0x11')][_0x95fa('0x13')]);return _0x1c0009(_0x5e1229[_0x95fa('0x11')][_0x95fa('0x13')]);}else{logger[_0x95fa('0xb')](_0x95fa('0xc'),_0x370fe5,_0x95fa('0xd'));_0x1c0009(_0x5e1229[_0x95fa('0x14')][_0x95fa('0x13')]);}})[_0x95fa('0x15')](function(_0x4404a2){logger[_0x95fa('0x11')](_0x95fa('0xc'),_0x370fe5,_0x4404a2);_0x596067(_0x4404a2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1f1ae8c..429a497 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 _0xd291=['../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x29e2c9,_0x25c19b){var _0x52f045=function(_0x295a9b){while(--_0x295a9b){_0x29e2c9['push'](_0x29e2c9['shift']());}};_0x52f045(++_0x25c19b);}(_0xd291,0xde));var _0x1d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd291[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1d29('0x0'));var util=require(_0x1d29('0x1'));var path=require('path');var timeout=require(_0x1d29('0x2'));var express=require(_0x1d29('0x3'));var router=express[_0x1d29('0x4')]();var fs_extra=require(_0x1d29('0x5'));var auth=require(_0x1d29('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d29('0x7'));var controller=require(_0x1d29('0x8'));router[_0x1d29('0x9')]('/',auth[_0x1d29('0xa')](),controller[_0x1d29('0xb')]);router['get'](_0x1d29('0xc'),auth[_0x1d29('0xa')](),controller[_0x1d29('0xd')]);router[_0x1d29('0xe')]('/',auth[_0x1d29('0xa')](),controller[_0x1d29('0xf')]);router['put']('/:id',auth[_0x1d29('0xa')](),controller[_0x1d29('0x10')]);router[_0x1d29('0x11')](_0x1d29('0xc'),auth[_0x1d29('0xa')](),controller[_0x1d29('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3bd0=['fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','express','Router'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x3bd0,0x1c8));var _0x03bd=function(_0x421791,_0x3625d8){_0x421791=_0x421791-0x0;var _0x495838=_0x3bd0[_0x421791];return _0x495838;};'use strict';var multer=require(_0x03bd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x03bd('0x1'));var router=express[_0x03bd('0x2')]();var fs_extra=require(_0x03bd('0x3'));var auth=require(_0x03bd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x03bd('0x5'));var controller=require(_0x03bd('0x6'));router[_0x03bd('0x7')]('/',auth[_0x03bd('0x8')](),controller['index']);router[_0x03bd('0x7')](_0x03bd('0x9'),auth[_0x03bd('0x8')](),controller[_0x03bd('0xa')]);router[_0x03bd('0xb')]('/',auth[_0x03bd('0x8')](),controller[_0x03bd('0xc')]);router['put'](_0x03bd('0x9'),auth[_0x03bd('0x8')](),controller[_0x03bd('0xd')]);router[_0x03bd('0xe')](_0x03bd('0x9'),auth[_0x03bd('0x8')](),controller[_0x03bd('0xf')]);module[_0x03bd('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ee6b3ea..16e1de5 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 _0x0f79=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','variable','customVariable'];(function(_0x34d83a,_0x27d0d1){var _0x226815=function(_0x3b1431){while(--_0x3b1431){_0x34d83a['push'](_0x34d83a['shift']());}};_0x226815(++_0x27d0d1);}(_0x0f79,0xdc));var _0x90f7=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0f79[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require('sequelize');module[_0x90f7('0x0')]={'type':{'type':Sequelize[_0x90f7('0x1')]('string',_0x90f7('0x2'),_0x90f7('0x3'),_0x90f7('0x4'),_0x90f7('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x90f7('0x6')]},'key':{'type':Sequelize[_0x90f7('0x6')]},'keyType':{'type':Sequelize[_0x90f7('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x90f7('0x6')]},'idField':{'type':Sequelize[_0x90f7('0x6')]},'nameField':{'type':Sequelize[_0x90f7('0x6')]},'customField':{'type':Sequelize[_0x90f7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x90f7('0x6')]}}; \ No newline at end of file +var _0x1eb2=['string','variable','STRING','sequelize','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x3c2598,_0x4febe5){var _0x5cda85=function(_0xfe29ec){while(--_0xfe29ec){_0x3c2598['push'](_0x3c2598['shift']());}};_0x5cda85(++_0x4febe5);}(_0x1eb2,0x123));var _0x21eb=function(_0x532573,_0xfc8950){_0x532573=_0x532573-0x0;var _0x3634bd=_0x1eb2[_0x532573];return _0x3634bd;};'use strict';var Sequelize=require(_0x21eb('0x0'));module[_0x21eb('0x1')]={'type':{'type':Sequelize[_0x21eb('0x2')]('string','variable',_0x21eb('0x3'),_0x21eb('0x4'),_0x21eb('0x5')),'defaultValue':_0x21eb('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x21eb('0x6'),_0x21eb('0x7'),_0x21eb('0x3'))},'keyContent':{'type':Sequelize[_0x21eb('0x8')]},'idField':{'type':Sequelize[_0x21eb('0x8')]},'nameField':{'type':Sequelize[_0x21eb('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x21eb('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c3bf4fb..ab78adf 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 _0xa7e6=['find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body'];(function(_0x98ae28,_0x380162){var _0x3f0caa=function(_0x15a8a0){while(--_0x15a8a0){_0x98ae28['push'](_0x98ae28['shift']());}};_0x3f0caa(++_0x380162);}(_0xa7e6,0x98));var _0x6a7e=function(_0x57d4b2,_0x43236a){_0x57d4b2=_0x57d4b2-0x0;var _0x57fc1c=_0xa7e6[_0x57d4b2];return _0x57fc1c;};'use strict';var emlformat=require(_0x6a7e('0x0'));var rimraf=require(_0x6a7e('0x1'));var zipdir=require(_0x6a7e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a7e('0x3'));var moment=require(_0x6a7e('0x4'));var BPromise=require(_0x6a7e('0x5'));var Mustache=require(_0x6a7e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6a7e('0x7'));var csv=require(_0x6a7e('0x8'));var ejs=require(_0x6a7e('0x9'));var fs=require('fs');var fs_extra=require(_0x6a7e('0xa'));var _=require(_0x6a7e('0xb'));var squel=require('squel');var crypto=require(_0x6a7e('0xc'));var jsforce=require(_0x6a7e('0xd'));var deskjs=require(_0x6a7e('0xe'));var toCsv=require(_0x6a7e('0x8'));var querystring=require(_0x6a7e('0xf'));var Papa=require(_0x6a7e('0x10'));var Redis=require(_0x6a7e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6a7e('0x12'));var as=require(_0x6a7e('0x13'));var hardwareService=require(_0x6a7e('0x14'));var logger=require(_0x6a7e('0x15'))(_0x6a7e('0x16'));var utils=require('../../config/utils');var config=require(_0x6a7e('0x17'));var licenseUtil=require(_0x6a7e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xabccbb,_0x2c1e7b){_0x2c1e7b=_0x2c1e7b||0xcc;return function(_0x32de24){if(_0x32de24){return _0xabccbb[_0x6a7e('0x19')](_0x2c1e7b);}return _0xabccbb[_0x6a7e('0x1a')](_0x2c1e7b)[_0x6a7e('0x1b')]();};}function respondWithResult(_0x10a31e,_0x34303f){_0x34303f=_0x34303f||0xc8;return function(_0x2f2546){if(_0x2f2546){return _0x10a31e[_0x6a7e('0x1a')](_0x34303f)[_0x6a7e('0x1c')](_0x2f2546);}};}function respondWithFilteredResult(_0x7368d3,_0x95919a){return function(_0x390b82){if(_0x390b82){var _0x15ff4b=typeof _0x95919a[_0x6a7e('0x1d')]===_0x6a7e('0x1e')&&typeof _0x95919a[_0x6a7e('0x1f')]==='undefined';var _0x502867=_0x390b82[_0x6a7e('0x20')];var _0xd3b024=_0x15ff4b?0x0:_0x95919a['offset'];var _0x565d8d=_0x15ff4b?_0x390b82[_0x6a7e('0x20')]:_0x95919a['offset']+_0x95919a[_0x6a7e('0x1f')];var _0x266bfa;if(_0x565d8d>=_0x502867){_0x565d8d=_0x502867;_0x266bfa=0xc8;}else{_0x266bfa=0xce;}_0x7368d3[_0x6a7e('0x1a')](_0x266bfa);return _0x7368d3[_0x6a7e('0x21')](_0x6a7e('0x22'),_0xd3b024+'-'+_0x565d8d+'/'+_0x502867)['json'](_0x390b82);}return null;};}function patchUpdates(_0x414fb6){return function(_0xb2a506){try{jsonpatch[_0x6a7e('0x23')](_0xb2a506,_0x414fb6,!![]);}catch(_0x2c84f5){return BPromise['reject'](_0x2c84f5);}return _0xb2a506[_0x6a7e('0x24')]();};}function saveUpdates(_0x13ded8,_0x19d528){return function(_0x24971c){if(_0x24971c){return _0x24971c[_0x6a7e('0x25')](_0x13ded8)['then'](function(_0x2c5132){return _0x2c5132;});}return null;};}function removeEntity(_0x3e00cf,_0x2c9c95){return function(_0x1fd543){if(_0x1fd543){return _0x1fd543[_0x6a7e('0x26')]()[_0x6a7e('0x27')](function(){_0x3e00cf['status'](0xcc)[_0x6a7e('0x1b')]();});}};}function handleEntityNotFound(_0x37c78e,_0x59666b){return function(_0x1024c2){if(!_0x1024c2){_0x37c78e[_0x6a7e('0x19')](0x194);}return _0x1024c2;};}function handleError(_0x524b31,_0x3e6af6){_0x3e6af6=_0x3e6af6||0x1f4;return function(_0x517321){logger['error'](_0x517321['stack']);if(_0x517321[_0x6a7e('0x28')]){delete _0x517321[_0x6a7e('0x28')];}_0x524b31[_0x6a7e('0x1a')](_0x3e6af6)['send'](_0x517321);};}exports[_0x6a7e('0x29')]=function(_0x311e24,_0x4b1a61){var _0x917fa5={},_0x1c77c3={},_0x2d0b96={'count':0x0,'rows':[]};var _0x14fa42=_[_0x6a7e('0x2a')](db[_0x6a7e('0x2b')][_0x6a7e('0x2c')],function(_0x4f54dd){return{'name':_0x4f54dd[_0x6a7e('0x2d')],'type':_0x4f54dd[_0x6a7e('0x2e')][_0x6a7e('0x2f')]};});_0x1c77c3[_0x6a7e('0x30')]=_[_0x6a7e('0x2a')](_0x14fa42,_0x6a7e('0x28'));_0x1c77c3[_0x6a7e('0x31')]=_[_0x6a7e('0x32')](_0x311e24['query']);_0x1c77c3['filters']=_[_0x6a7e('0x33')](_0x1c77c3[_0x6a7e('0x30')],_0x1c77c3['query']);_0x917fa5[_0x6a7e('0x34')]=_['intersection'](_0x1c77c3[_0x6a7e('0x30')],qs[_0x6a7e('0x35')](_0x311e24[_0x6a7e('0x31')][_0x6a7e('0x35')]));_0x917fa5[_0x6a7e('0x34')]=_0x917fa5[_0x6a7e('0x34')][_0x6a7e('0x36')]?_0x917fa5['attributes']:_0x1c77c3[_0x6a7e('0x30')];if(!_0x311e24[_0x6a7e('0x31')]['hasOwnProperty'](_0x6a7e('0x37'))){_0x917fa5['limit']=qs['limit'](_0x311e24[_0x6a7e('0x31')]['limit']);_0x917fa5[_0x6a7e('0x1d')]=qs[_0x6a7e('0x1d')](_0x311e24[_0x6a7e('0x31')][_0x6a7e('0x1d')]);}_0x917fa5[_0x6a7e('0x38')]=qs[_0x6a7e('0x39')](_0x311e24[_0x6a7e('0x31')][_0x6a7e('0x39')]);_0x917fa5[_0x6a7e('0x3a')]=qs[_0x6a7e('0x3b')](_[_0x6a7e('0x3c')](_0x311e24['query'],_0x1c77c3['filters']),_0x14fa42);if(_0x311e24[_0x6a7e('0x31')][_0x6a7e('0x3d')]){_0x917fa5[_0x6a7e('0x3a')]=_[_0x6a7e('0x3e')](_0x917fa5[_0x6a7e('0x3a')],{'$or':_[_0x6a7e('0x2a')](_0x14fa42,function(_0x297058){if(_0x297058[_0x6a7e('0x2e')]!==_0x6a7e('0x3f')){var _0x83dfb8={};_0x83dfb8[_0x297058['name']]={'$like':'%'+_0x311e24['query'][_0x6a7e('0x3d')]+'%'};return _0x83dfb8;}})});}_0x917fa5=_[_0x6a7e('0x3e')]({},_0x917fa5,_0x311e24[_0x6a7e('0x40')]);var _0x18a97a={'where':_0x917fa5[_0x6a7e('0x3a')]};return db[_0x6a7e('0x2b')][_0x6a7e('0x20')](_0x18a97a)[_0x6a7e('0x27')](function(_0x1b9ad3){_0x2d0b96[_0x6a7e('0x20')]=_0x1b9ad3;if(_0x311e24[_0x6a7e('0x31')][_0x6a7e('0x41')]){_0x917fa5[_0x6a7e('0x42')]=[{'all':!![]}];}return db[_0x6a7e('0x2b')][_0x6a7e('0x43')](_0x917fa5);})[_0x6a7e('0x27')](function(_0x11738a){_0x2d0b96[_0x6a7e('0x44')]=_0x11738a;return _0x2d0b96;})[_0x6a7e('0x27')](respondWithFilteredResult(_0x4b1a61,_0x917fa5))[_0x6a7e('0x45')](handleError(_0x4b1a61,null));};exports[_0x6a7e('0x46')]=function(_0x960036,_0x36fdfe){var _0x519bb4={'raw':!![],'where':{'id':_0x960036['params']['id']}},_0x516cac={};_0x516cac['model']=_[_0x6a7e('0x32')](db[_0x6a7e('0x2b')]['rawAttributes']);_0x516cac[_0x6a7e('0x31')]=_[_0x6a7e('0x32')](_0x960036[_0x6a7e('0x31')]);_0x516cac[_0x6a7e('0x3b')]=_['intersection'](_0x516cac[_0x6a7e('0x30')],_0x516cac[_0x6a7e('0x31')]);_0x519bb4[_0x6a7e('0x34')]=_[_0x6a7e('0x33')](_0x516cac[_0x6a7e('0x30')],qs[_0x6a7e('0x35')](_0x960036['query'][_0x6a7e('0x35')]));_0x519bb4['attributes']=_0x519bb4['attributes'][_0x6a7e('0x36')]?_0x519bb4[_0x6a7e('0x34')]:_0x516cac[_0x6a7e('0x30')];if(_0x960036[_0x6a7e('0x31')][_0x6a7e('0x41')]){_0x519bb4[_0x6a7e('0x42')]=[{'all':!![]}];}_0x519bb4=_['merge']({},_0x519bb4,_0x960036['options']);return db[_0x6a7e('0x2b')]['find'](_0x519bb4)[_0x6a7e('0x27')](handleEntityNotFound(_0x36fdfe,null))[_0x6a7e('0x27')](respondWithResult(_0x36fdfe,null))[_0x6a7e('0x45')](handleError(_0x36fdfe,null));};exports[_0x6a7e('0x47')]=function(_0x2ef501,_0x5a064e){return db[_0x6a7e('0x2b')]['create'](_0x2ef501[_0x6a7e('0x48')],{})[_0x6a7e('0x27')](respondWithResult(_0x5a064e,0xc9))[_0x6a7e('0x45')](handleError(_0x5a064e,null));};exports['update']=function(_0x1b2757,_0x504aa6){if(_0x1b2757[_0x6a7e('0x48')]['id']){delete _0x1b2757[_0x6a7e('0x48')]['id'];}return db[_0x6a7e('0x2b')][_0x6a7e('0x49')]({'where':{'id':_0x1b2757[_0x6a7e('0x4a')]['id']}})[_0x6a7e('0x27')](handleEntityNotFound(_0x504aa6,null))['then'](saveUpdates(_0x1b2757[_0x6a7e('0x48')],null))[_0x6a7e('0x27')](respondWithResult(_0x504aa6,null))['catch'](handleError(_0x504aa6,null));};exports['destroy']=function(_0x2a974e,_0x1df517){return db[_0x6a7e('0x2b')]['find']({'where':{'id':_0x2a974e['params']['id']}})[_0x6a7e('0x27')](handleEntityNotFound(_0x1df517,null))[_0x6a7e('0x27')](removeEntity(_0x1df517,null))[_0x6a7e('0x45')](handleError(_0x1df517,null));}; \ No newline at end of file +var _0xfd11=['../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','SugarcrmField','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3f44d9,_0x350353){var _0x328df7=function(_0x2c3f18){while(--_0x2c3f18){_0x3f44d9['push'](_0x3f44d9['shift']());}};_0x328df7(++_0x350353);}(_0xfd11,0x155));var _0x1fd1=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0xfd11[_0x43fdf8];return _0x1160c6;};'use strict';var emlformat=require(_0x1fd1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fd1('0x1'));var jsonpatch=require(_0x1fd1('0x2'));var rp=require(_0x1fd1('0x3'));var moment=require(_0x1fd1('0x4'));var BPromise=require(_0x1fd1('0x5'));var Mustache=require('mustache');var util=require(_0x1fd1('0x6'));var path=require(_0x1fd1('0x7'));var sox=require('sox');var csv=require(_0x1fd1('0x8'));var ejs=require(_0x1fd1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fd1('0xa'));var squel=require('squel');var crypto=require(_0x1fd1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1fd1('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1fd1('0xd'));var Redis=require(_0x1fd1('0xe'));var authService=require(_0x1fd1('0xf'));var qs=require(_0x1fd1('0x10'));var as=require(_0x1fd1('0x11'));var hardwareService=require(_0x1fd1('0x12'));var logger=require(_0x1fd1('0x13'))(_0x1fd1('0x14'));var utils=require(_0x1fd1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1fd1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7a51eb,_0x4c1c4e){_0x4c1c4e=_0x4c1c4e||0xcc;return function(_0x48969c){if(_0x48969c){return _0x7a51eb['sendStatus'](_0x4c1c4e);}return _0x7a51eb[_0x1fd1('0x17')](_0x4c1c4e)[_0x1fd1('0x18')]();};}function respondWithResult(_0x2a2cf0,_0x491f49){_0x491f49=_0x491f49||0xc8;return function(_0x2a638a){if(_0x2a638a){return _0x2a2cf0[_0x1fd1('0x17')](_0x491f49)[_0x1fd1('0x19')](_0x2a638a);}};}function respondWithFilteredResult(_0x16ce96,_0xbae338){return function(_0x225e52){if(_0x225e52){var _0x51dbd9=typeof _0xbae338['offset']===_0x1fd1('0x1a')&&typeof _0xbae338[_0x1fd1('0x1b')]==='undefined';var _0xf28ad9=_0x225e52[_0x1fd1('0x1c')];var _0x48a71c=_0x51dbd9?0x0:_0xbae338[_0x1fd1('0x1d')];var _0x34e39c=_0x51dbd9?_0x225e52[_0x1fd1('0x1c')]:_0xbae338[_0x1fd1('0x1d')]+_0xbae338[_0x1fd1('0x1b')];var _0x1df856;if(_0x34e39c>=_0xf28ad9){_0x34e39c=_0xf28ad9;_0x1df856=0xc8;}else{_0x1df856=0xce;}_0x16ce96[_0x1fd1('0x17')](_0x1df856);return _0x16ce96[_0x1fd1('0x1e')](_0x1fd1('0x1f'),_0x48a71c+'-'+_0x34e39c+'/'+_0xf28ad9)[_0x1fd1('0x19')](_0x225e52);}return null;};}function patchUpdates(_0x3ab462){return function(_0x2c8d6a){try{jsonpatch[_0x1fd1('0x20')](_0x2c8d6a,_0x3ab462,!![]);}catch(_0x408133){return BPromise[_0x1fd1('0x21')](_0x408133);}return _0x2c8d6a[_0x1fd1('0x22')]();};}function saveUpdates(_0xd5d127,_0x2bdd49){return function(_0x5779e){if(_0x5779e){return _0x5779e['update'](_0xd5d127)[_0x1fd1('0x23')](function(_0x4a9f50){return _0x4a9f50;});}return null;};}function removeEntity(_0x59a7d9,_0x1d8092){return function(_0x9c5e91){if(_0x9c5e91){return _0x9c5e91[_0x1fd1('0x24')]()[_0x1fd1('0x23')](function(){_0x59a7d9['status'](0xcc)[_0x1fd1('0x18')]();});}};}function handleEntityNotFound(_0x50a358,_0x2ea4c0){return function(_0x381150){if(!_0x381150){_0x50a358[_0x1fd1('0x25')](0x194);}return _0x381150;};}function handleError(_0x4d4ce0,_0x192ca3){_0x192ca3=_0x192ca3||0x1f4;return function(_0x420e5e){logger[_0x1fd1('0x26')](_0x420e5e[_0x1fd1('0x27')]);if(_0x420e5e[_0x1fd1('0x28')]){delete _0x420e5e['name'];}_0x4d4ce0[_0x1fd1('0x17')](_0x192ca3)[_0x1fd1('0x29')](_0x420e5e);};}exports['index']=function(_0x16f9b1,_0x1a3d7a){var _0x436cf6={},_0x993e9f={},_0x1cb987={'count':0x0,'rows':[]};var _0x128085=_[_0x1fd1('0x2a')](db['SugarcrmField'][_0x1fd1('0x2b')],function(_0x185e4f){return{'name':_0x185e4f[_0x1fd1('0x2c')],'type':_0x185e4f[_0x1fd1('0x2d')]['key']};});_0x993e9f[_0x1fd1('0x2e')]=_[_0x1fd1('0x2a')](_0x128085,_0x1fd1('0x28'));_0x993e9f[_0x1fd1('0x2f')]=_['keys'](_0x16f9b1[_0x1fd1('0x2f')]);_0x993e9f[_0x1fd1('0x30')]=_['intersection'](_0x993e9f['model'],_0x993e9f[_0x1fd1('0x2f')]);_0x436cf6[_0x1fd1('0x31')]=_[_0x1fd1('0x32')](_0x993e9f['model'],qs[_0x1fd1('0x33')](_0x16f9b1[_0x1fd1('0x2f')][_0x1fd1('0x33')]));_0x436cf6[_0x1fd1('0x31')]=_0x436cf6[_0x1fd1('0x31')][_0x1fd1('0x34')]?_0x436cf6[_0x1fd1('0x31')]:_0x993e9f[_0x1fd1('0x2e')];if(!_0x16f9b1[_0x1fd1('0x2f')][_0x1fd1('0x35')]('nolimit')){_0x436cf6[_0x1fd1('0x1b')]=qs[_0x1fd1('0x1b')](_0x16f9b1[_0x1fd1('0x2f')]['limit']);_0x436cf6[_0x1fd1('0x1d')]=qs[_0x1fd1('0x1d')](_0x16f9b1[_0x1fd1('0x2f')][_0x1fd1('0x1d')]);}_0x436cf6[_0x1fd1('0x36')]=qs['sort'](_0x16f9b1[_0x1fd1('0x2f')][_0x1fd1('0x37')]);_0x436cf6[_0x1fd1('0x38')]=qs[_0x1fd1('0x30')](_['pick'](_0x16f9b1[_0x1fd1('0x2f')],_0x993e9f[_0x1fd1('0x30')]),_0x128085);if(_0x16f9b1[_0x1fd1('0x2f')][_0x1fd1('0x39')]){_0x436cf6[_0x1fd1('0x38')]=_[_0x1fd1('0x3a')](_0x436cf6['where'],{'$or':_[_0x1fd1('0x2a')](_0x128085,function(_0x837a29){if(_0x837a29['type']!=='VIRTUAL'){var _0xda577c={};_0xda577c[_0x837a29[_0x1fd1('0x28')]]={'$like':'%'+_0x16f9b1[_0x1fd1('0x2f')][_0x1fd1('0x39')]+'%'};return _0xda577c;}})});}_0x436cf6=_[_0x1fd1('0x3a')]({},_0x436cf6,_0x16f9b1[_0x1fd1('0x3b')]);var _0x4ecbf1={'where':_0x436cf6[_0x1fd1('0x38')]};return db['SugarcrmField']['count'](_0x4ecbf1)['then'](function(_0x4bb1a0){_0x1cb987[_0x1fd1('0x1c')]=_0x4bb1a0;if(_0x16f9b1[_0x1fd1('0x2f')][_0x1fd1('0x3c')]){_0x436cf6[_0x1fd1('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0x1fd1('0x3e')](_0x436cf6);})[_0x1fd1('0x23')](function(_0x44706f){_0x1cb987[_0x1fd1('0x3f')]=_0x44706f;return _0x1cb987;})[_0x1fd1('0x23')](respondWithFilteredResult(_0x1a3d7a,_0x436cf6))[_0x1fd1('0x40')](handleError(_0x1a3d7a,null));};exports[_0x1fd1('0x41')]=function(_0x1306a8,_0x232d7b){var _0x3ccf2a={'raw':!![],'where':{'id':_0x1306a8[_0x1fd1('0x42')]['id']}},_0x2f7de4={};_0x2f7de4['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x2f7de4[_0x1fd1('0x2f')]=_[_0x1fd1('0x43')](_0x1306a8[_0x1fd1('0x2f')]);_0x2f7de4['filters']=_[_0x1fd1('0x32')](_0x2f7de4[_0x1fd1('0x2e')],_0x2f7de4['query']);_0x3ccf2a[_0x1fd1('0x31')]=_[_0x1fd1('0x32')](_0x2f7de4[_0x1fd1('0x2e')],qs['fields'](_0x1306a8[_0x1fd1('0x2f')]['fields']));_0x3ccf2a['attributes']=_0x3ccf2a[_0x1fd1('0x31')][_0x1fd1('0x34')]?_0x3ccf2a[_0x1fd1('0x31')]:_0x2f7de4[_0x1fd1('0x2e')];if(_0x1306a8[_0x1fd1('0x2f')][_0x1fd1('0x3c')]){_0x3ccf2a[_0x1fd1('0x3d')]=[{'all':!![]}];}_0x3ccf2a=_['merge']({},_0x3ccf2a,_0x1306a8[_0x1fd1('0x3b')]);return db['SugarcrmField'][_0x1fd1('0x44')](_0x3ccf2a)[_0x1fd1('0x23')](handleEntityNotFound(_0x232d7b,null))[_0x1fd1('0x23')](respondWithResult(_0x232d7b,null))[_0x1fd1('0x40')](handleError(_0x232d7b,null));};exports['create']=function(_0xb0acf,_0xb4c8fc){return db[_0x1fd1('0x45')]['create'](_0xb0acf[_0x1fd1('0x46')],{})[_0x1fd1('0x23')](respondWithResult(_0xb4c8fc,0xc9))['catch'](handleError(_0xb4c8fc,null));};exports[_0x1fd1('0x47')]=function(_0x459e24,_0x5bb323){if(_0x459e24[_0x1fd1('0x46')]['id']){delete _0x459e24[_0x1fd1('0x46')]['id'];}return db[_0x1fd1('0x45')]['find']({'where':{'id':_0x459e24['params']['id']}})[_0x1fd1('0x23')](handleEntityNotFound(_0x5bb323,null))[_0x1fd1('0x23')](saveUpdates(_0x459e24[_0x1fd1('0x46')],null))['then'](respondWithResult(_0x5bb323,null))['catch'](handleError(_0x5bb323,null));};exports['destroy']=function(_0xa01704,_0x29e228){return db[_0x1fd1('0x45')]['find']({'where':{'id':_0xa01704[_0x1fd1('0x42')]['id']}})['then'](handleEntityNotFound(_0x29e228,null))[_0x1fd1('0x23')](removeEntity(_0x29e228,null))[_0x1fd1('0x40')](handleError(_0x29e228,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index fb7c552..6d9dca2 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 _0xdbab=['path','../../config/environment','./intSugarcrmField.attributes','exports','sugarcrm_unique_index','idField','FieldId','util','api','moment','bluebird'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0xdbab,0x80));var _0xbdba=function(_0xfb8f31,_0x2d3880){_0xfb8f31=_0xfb8f31-0x0;var _0x28b6e0=_0xdbab[_0xfb8f31];return _0x28b6e0;};'use strict';var _=require('lodash');var util=require(_0xbdba('0x0'));var logger=require('../../config/logger')(_0xbdba('0x1'));var moment=require(_0xbdba('0x2'));var BPromise=require(_0xbdba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdba('0x4'));var rimraf=require('rimraf');var config=require(_0xbdba('0x5'));var attributes=require(_0xbdba('0x6'));module[_0xbdba('0x7')]=function(_0x4dc065,_0x5c49d2){return _0x4dc065['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xbdba('0x8'),'fields':[_0xbdba('0x9'),_0xbdba('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c36=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x272156,_0x5e4b0d){var _0x1071d0=function(_0x5f1f6b){while(--_0x5f1f6b){_0x272156['push'](_0x272156['shift']());}};_0x1071d0(++_0x5e4b0d);}(_0x2c36,0x1eb));var _0x62c3=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x2c36[_0x2e04ef];return _0x5722b0;};'use strict';var _=require(_0x62c3('0x0'));var util=require(_0x62c3('0x1'));var logger=require(_0x62c3('0x2'))(_0x62c3('0x3'));var moment=require('moment');var BPromise=require(_0x62c3('0x4'));var rp=require(_0x62c3('0x5'));var fs=require('fs');var path=require(_0x62c3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62c3('0x7'));module['exports']=function(_0x5b21fe,_0x44daf3){return _0x5b21fe[_0x62c3('0x8')](_0x62c3('0x9'),attributes,{'tableName':_0x62c3('0xa'),'paranoid':![],'indexes':[{'name':_0x62c3('0xb'),'fields':[_0x62c3('0xc'),_0x62c3('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 9fb4619..6e7e839 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 _0x75f5=['http','request','info','SugarcrmField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x75f5,0x16a));var _0x575f=function(_0x41dfac,_0x278319){_0x41dfac=_0x41dfac-0x0;var _0x12900b=_0x75f5[_0x41dfac];return _0x12900b;};'use strict';var _=require(_0x575f('0x0'));var util=require(_0x575f('0x1'));var moment=require(_0x575f('0x2'));var BPromise=require(_0x575f('0x3'));var rs=require(_0x575f('0x4'));var fs=require('fs');var Redis=require(_0x575f('0x5'));var db=require(_0x575f('0x6'))['db'];var utils=require(_0x575f('0x7'));var logger=require(_0x575f('0x8'))(_0x575f('0x9'));var config=require(_0x575f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x575f('0xb')][_0x575f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f97f4,_0xd6ac00,_0x2adc27){return new BPromise(function(_0x188276,_0x1a192b){return client[_0x575f('0xd')](_0x3f97f4,_0x2adc27)['then'](function(_0xe57777){logger[_0x575f('0xe')](_0x575f('0xf'),_0xd6ac00,'request\x20sent');logger[_0x575f('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xd6ac00,_0x575f('0x11'),JSON[_0x575f('0x12')](_0xe57777));if(_0xe57777[_0x575f('0x13')]){if(_0xe57777[_0x575f('0x13')]['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0xd6ac00,_0xe57777[_0x575f('0x13')][_0x575f('0x14')]);return _0x1a192b(_0xe57777[_0x575f('0x13')]['message']);}logger[_0x575f('0x13')](_0x575f('0xf'),_0xd6ac00,_0xe57777[_0x575f('0x13')][_0x575f('0x14')]);return _0x188276(_0xe57777[_0x575f('0x13')][_0x575f('0x14')]);}else{logger[_0x575f('0xe')]('SugarcrmField,\x20%s,\x20%s',_0xd6ac00,_0x575f('0x11'));_0x188276(_0xe57777[_0x575f('0x15')][_0x575f('0x14')]);}})['catch'](function(_0x959c70){logger['error'](_0x575f('0xf'),_0xd6ac00,_0x959c70);_0x1a192b(_0x959c70);});});} \ No newline at end of file +var _0x8837=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x273747,_0x319a92){var _0xce1ef8=function(_0x40a1cb){while(--_0x40a1cb){_0x273747['push'](_0x273747['shift']());}};_0xce1ef8(++_0x319a92);}(_0x8837,0x161));var _0x7883=function(_0x18c549,_0x41add8){_0x18c549=_0x18c549-0x0;var _0xe7a05c=_0x8837[_0x18c549];return _0xe7a05c;};'use strict';var _=require(_0x7883('0x0'));var util=require('util');var moment=require(_0x7883('0x1'));var BPromise=require('bluebird');var rs=require(_0x7883('0x2'));var fs=require('fs');var Redis=require(_0x7883('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7883('0x4'))(_0x7883('0x5'));var config=require(_0x7883('0x6'));var jayson=require(_0x7883('0x7'));var client=jayson[_0x7883('0x8')][_0x7883('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b2689,_0x3d1e58,_0x39ef3e){return new BPromise(function(_0x1b0160,_0x5dac24){return client[_0x7883('0xa')](_0x3b2689,_0x39ef3e)[_0x7883('0xb')](function(_0x4ec163){logger[_0x7883('0xc')](_0x7883('0xd'),_0x3d1e58,_0x7883('0xe'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3d1e58,'request\x20sent',JSON[_0x7883('0xf')](_0x4ec163));if(_0x4ec163[_0x7883('0x10')]){if(_0x4ec163[_0x7883('0x10')][_0x7883('0x11')]===0x1f4){logger[_0x7883('0x10')](_0x7883('0xd'),_0x3d1e58,_0x4ec163[_0x7883('0x10')]['message']);return _0x5dac24(_0x4ec163[_0x7883('0x10')]['message']);}logger['error'](_0x7883('0xd'),_0x3d1e58,_0x4ec163[_0x7883('0x10')]['message']);return _0x1b0160(_0x4ec163[_0x7883('0x10')][_0x7883('0x12')]);}else{logger['info'](_0x7883('0xd'),_0x3d1e58,_0x7883('0xe'));_0x1b0160(_0x4ec163[_0x7883('0x13')][_0x7883('0x12')]);}})[_0x7883('0x14')](function(_0x4ad7c3){logger['error'](_0x7883('0xd'),_0x3d1e58,_0x4ad7c3);_0x5dac24(_0x4ad7c3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 1489c48..b024f68 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 _0xb73c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer'];(function(_0x3ea566,_0x267b05){var _0x226df2=function(_0x3912d){while(--_0x3912d){_0x3ea566['push'](_0x3ea566['shift']());}};_0x226df2(++_0x267b05);}(_0xb73c,0x1cd));var _0xcb73=function(_0x10b378,_0x1ae977){_0x10b378=_0x10b378-0x0;var _0x46261e=_0xb73c[_0x10b378];return _0x46261e;};'use strict';var multer=require(_0xcb73('0x0'));var util=require('util');var path=require(_0xcb73('0x1'));var timeout=require(_0xcb73('0x2'));var express=require(_0xcb73('0x3'));var router=express[_0xcb73('0x4')]();var fs_extra=require(_0xcb73('0x5'));var auth=require(_0xcb73('0x6'));var interaction=require(_0xcb73('0x7'));var config=require('../../config/environment');var controller=require(_0xcb73('0x8'));router[_0xcb73('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcb73('0xa'),auth[_0xcb73('0xb')](),controller[_0xcb73('0xc')]);router[_0xcb73('0x9')](_0xcb73('0xd'),auth[_0xcb73('0xb')](),controller['getConfigurations']);router[_0xcb73('0x9')]('/:id/fields',auth[_0xcb73('0xb')](),controller[_0xcb73('0xe')]);router[_0xcb73('0xf')]('/',auth[_0xcb73('0xb')](),controller[_0xcb73('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xcb73('0x11')]);router[_0xcb73('0x12')]('/:id',auth[_0xcb73('0xb')](),controller[_0xcb73('0x13')]);router[_0xcb73('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xcb73('0x15')]);module['exports']=router; \ No newline at end of file +var _0x61df=['/:id','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x5e8ee4,_0x539290){var _0x2970f2=function(_0x2b04fb){while(--_0x2b04fb){_0x5e8ee4['push'](_0x5e8ee4['shift']());}};_0x2970f2(++_0x539290);}(_0x61df,0xbd));var _0xf61d=function(_0x17dc38,_0x7b673){_0x17dc38=_0x17dc38-0x0;var _0x379874=_0x61df[_0x17dc38];return _0x379874;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf61d('0x0'));var express=require(_0xf61d('0x1'));var router=express['Router']();var fs_extra=require(_0xf61d('0x2'));var auth=require(_0xf61d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf61d('0x4'));var controller=require(_0xf61d('0x5'));router[_0xf61d('0x6')]('/',auth[_0xf61d('0x7')](),controller[_0xf61d('0x8')]);router[_0xf61d('0x6')]('/:id',auth[_0xf61d('0x7')](),controller['show']);router[_0xf61d('0x6')](_0xf61d('0x9'),auth[_0xf61d('0x7')](),controller[_0xf61d('0xa')]);router[_0xf61d('0x6')](_0xf61d('0xb'),auth[_0xf61d('0x7')](),controller[_0xf61d('0xc')]);router[_0xf61d('0xd')]('/',auth[_0xf61d('0x7')](),controller[_0xf61d('0xe')]);router[_0xf61d('0xd')]('/:id/configurations',auth[_0xf61d('0x7')](),controller['addConfiguration']);router['put'](_0xf61d('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf61d('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf61d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 0ce47e1..ec89d21 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 _0x4908=['STRING','HelpDesk','sequelize','exports'];(function(_0x115bbe,_0x38277a){var _0x365449=function(_0x54e625){while(--_0x54e625){_0x115bbe['push'](_0x115bbe['shift']());}};_0x365449(++_0x38277a);}(_0x4908,0x1aa));var _0x8490=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x4908[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0x8490('0x0'));module[_0x8490('0x1')]={'name':{'type':Sequelize[_0x8490('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8490('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8490('0x2')],'allowNull':![],'defaultValue':_0x8490('0x3')},'remoteUri':{'type':Sequelize[_0x8490('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8490('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7f9a=['STRING','HelpDesk','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f9a,0xe2));var _0xa7f9=function(_0x5b7f24,_0x52a1a8){_0x5b7f24=_0x5b7f24-0x0;var _0x4c1ec9=_0x7f9a[_0x5b7f24];return _0x4c1ec9;};'use strict';var Sequelize=require(_0xa7f9('0x0'));module[_0xa7f9('0x1')]={'name':{'type':Sequelize[_0xa7f9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa7f9('0x2')]},'username':{'type':Sequelize[_0xa7f9('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa7f9('0x2')],'allowNull':![],'defaultValue':_0xa7f9('0x3')},'remoteUri':{'type':Sequelize[_0xa7f9('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa7f9('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa7f9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 83c8068..6b04600 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 _0x3482=['getSubjects','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','getchallenge','success','POST','login','token','GET','describe','result','sessionName','autogenerated','reference','owner','remove','editable','false','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','type','VIRTUAL','options','VtigerAccount','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','VtigerConfiguration','pick','findOne','AccountId','Subjects'];(function(_0x141c2d,_0x134f5a){var _0x274589=function(_0x52c9a2){while(--_0x52c9a2){_0x141c2d['push'](_0x141c2d['shift']());}};_0x274589(++_0x134f5a);}(_0x3482,0x123));var _0x2348=function(_0x48b267,_0x169fc4){_0x48b267=_0x48b267-0x0;var _0x55cc70=_0x3482[_0x48b267];return _0x55cc70;};'use strict';var emlformat=require(_0x2348('0x0'));var rimraf=require(_0x2348('0x1'));var zipdir=require(_0x2348('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2348('0x3'));var moment=require(_0x2348('0x4'));var BPromise=require(_0x2348('0x5'));var Mustache=require('mustache');var util=require(_0x2348('0x6'));var path=require(_0x2348('0x7'));var sox=require(_0x2348('0x8'));var csv=require(_0x2348('0x9'));var ejs=require(_0x2348('0xa'));var fs=require('fs');var fs_extra=require(_0x2348('0xb'));var _=require(_0x2348('0xc'));var squel=require(_0x2348('0xd'));var crypto=require(_0x2348('0xe'));var jsforce=require(_0x2348('0xf'));var deskjs=require(_0x2348('0x10'));var toCsv=require(_0x2348('0x9'));var querystring=require(_0x2348('0x11'));var Papa=require(_0x2348('0x12'));var Redis=require(_0x2348('0x13'));var authService=require(_0x2348('0x14'));var qs=require(_0x2348('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2348('0x16'))(_0x2348('0x17'));var utils=require('../../config/utils');var config=require(_0x2348('0x18'));var licenseUtil=require(_0x2348('0x19'));var db=require(_0x2348('0x1a'))['db'];var integrations=require(_0x2348('0x1b'));function respondWithStatusCode(_0x22108b,_0x1f2904){_0x1f2904=_0x1f2904||0xcc;return function(_0x5a51d1){if(_0x5a51d1){return _0x22108b['sendStatus'](_0x1f2904);}return _0x22108b[_0x2348('0x1c')](_0x1f2904)['end']();};}function respondWithResult(_0x29a068,_0xb24f7b){_0xb24f7b=_0xb24f7b||0xc8;return function(_0x58ef64){if(_0x58ef64){return _0x29a068[_0x2348('0x1c')](_0xb24f7b)['json'](_0x58ef64);}};}function respondWithFilteredResult(_0x4c4f7a,_0x1bcaa6){return function(_0x43220d){if(_0x43220d){var _0xb3aecf=typeof _0x1bcaa6[_0x2348('0x1d')]==='undefined'&&typeof _0x1bcaa6[_0x2348('0x1e')]==='undefined';var _0x483472=_0x43220d[_0x2348('0x1f')];var _0x3e5fd7=_0xb3aecf?0x0:_0x1bcaa6[_0x2348('0x1d')];var _0x3612bb=_0xb3aecf?_0x43220d[_0x2348('0x1f')]:_0x1bcaa6[_0x2348('0x1d')]+_0x1bcaa6[_0x2348('0x1e')];var _0x520d12;if(_0x3612bb>=_0x483472){_0x3612bb=_0x483472;_0x520d12=0xc8;}else{_0x520d12=0xce;}_0x4c4f7a[_0x2348('0x1c')](_0x520d12);return _0x4c4f7a[_0x2348('0x20')](_0x2348('0x21'),_0x3e5fd7+'-'+_0x3612bb+'/'+_0x483472)[_0x2348('0x22')](_0x43220d);}return null;};}function patchUpdates(_0x1617e1){return function(_0x35863b){try{jsonpatch[_0x2348('0x23')](_0x35863b,_0x1617e1,!![]);}catch(_0x30f14b){return BPromise[_0x2348('0x24')](_0x30f14b);}return _0x35863b['save']();};}function saveUpdates(_0x2ed11d,_0x12c8a7){return function(_0x4b0174){if(_0x4b0174){return _0x4b0174[_0x2348('0x25')](_0x2ed11d)[_0x2348('0x26')](function(_0x1fc81b){return _0x1fc81b;});}return null;};}function removeEntity(_0xfb3013,_0x37adf1){return function(_0x17836a){if(_0x17836a){return _0x17836a[_0x2348('0x27')]()[_0x2348('0x26')](function(){_0xfb3013[_0x2348('0x1c')](0xcc)[_0x2348('0x28')]();});}};}function handleEntityNotFound(_0x406b4c,_0x14139c){return function(_0x22c7f9){if(!_0x22c7f9){_0x406b4c[_0x2348('0x29')](0x194);}return _0x22c7f9;};}function handleError(_0x50e2bb,_0x384ef4){_0x384ef4=_0x384ef4||0x1f4;return function(_0x313f29){logger[_0x2348('0x2a')](_0x313f29[_0x2348('0x2b')]);if(_0x313f29[_0x2348('0x2c')]){delete _0x313f29[_0x2348('0x2c')];}_0x50e2bb[_0x2348('0x1c')](_0x384ef4)[_0x2348('0x2d')](_0x313f29);};}exports[_0x2348('0x2e')]=function(_0x58f162,_0x43e31f){var _0x334209={},_0x1c0890={},_0x78b99c={'count':0x0,'rows':[]};var _0x159c40=_['map'](db['VtigerAccount'][_0x2348('0x2f')],function(_0x55da0e){return{'name':_0x55da0e[_0x2348('0x30')],'type':_0x55da0e['type']['key']};});_0x1c0890[_0x2348('0x31')]=_['map'](_0x159c40,'name');_0x1c0890[_0x2348('0x32')]=_[_0x2348('0x33')](_0x58f162[_0x2348('0x32')]);_0x1c0890[_0x2348('0x34')]=_[_0x2348('0x35')](_0x1c0890['model'],_0x1c0890[_0x2348('0x32')]);_0x334209['attributes']=_[_0x2348('0x35')](_0x1c0890[_0x2348('0x31')],qs[_0x2348('0x36')](_0x58f162[_0x2348('0x32')][_0x2348('0x36')]));_0x334209[_0x2348('0x37')]=_0x334209[_0x2348('0x37')][_0x2348('0x38')]?_0x334209[_0x2348('0x37')]:_0x1c0890['model'];if(!_0x58f162[_0x2348('0x32')][_0x2348('0x39')](_0x2348('0x3a'))){_0x334209['limit']=qs[_0x2348('0x1e')](_0x58f162[_0x2348('0x32')]['limit']);_0x334209[_0x2348('0x1d')]=qs['offset'](_0x58f162[_0x2348('0x32')][_0x2348('0x1d')]);}_0x334209[_0x2348('0x3b')]=qs['sort'](_0x58f162[_0x2348('0x32')][_0x2348('0x3c')]);_0x334209['where']=qs[_0x2348('0x34')](_['pick'](_0x58f162[_0x2348('0x32')],_0x1c0890[_0x2348('0x34')]),_0x159c40);if(_0x58f162[_0x2348('0x32')][_0x2348('0x3d')]){_0x334209[_0x2348('0x3e')]=_[_0x2348('0x3f')](_0x334209[_0x2348('0x3e')],{'$or':_[_0x2348('0x40')](_0x159c40,function(_0xf3703){if(_0xf3703[_0x2348('0x41')]!==_0x2348('0x42')){var _0x1b9206={};_0x1b9206[_0xf3703[_0x2348('0x2c')]]={'$like':'%'+_0x58f162[_0x2348('0x32')][_0x2348('0x3d')]+'%'};return _0x1b9206;}})});}_0x334209=_[_0x2348('0x3f')]({},_0x334209,_0x58f162[_0x2348('0x43')]);var _0x564a7f={'where':_0x334209[_0x2348('0x3e')]};return db[_0x2348('0x44')][_0x2348('0x1f')](_0x564a7f)['then'](function(_0x25f0e3){_0x78b99c[_0x2348('0x1f')]=_0x25f0e3;if(_0x58f162['query'][_0x2348('0x45')]){_0x334209[_0x2348('0x46')]=[{'all':!![]}];}return db['VtigerAccount'][_0x2348('0x47')](_0x334209);})['then'](function(_0x598b2c){_0x78b99c['rows']=_0x598b2c;return _0x78b99c;})['then'](respondWithFilteredResult(_0x43e31f,_0x334209))[_0x2348('0x48')](handleError(_0x43e31f,null));};exports[_0x2348('0x49')]=function(_0x3ac03a,_0x4d1ed3){var _0x3ca8ad={'raw':![],'where':{'id':_0x3ac03a[_0x2348('0x4a')]['id']}},_0x2b3ae8={};_0x2b3ae8[_0x2348('0x31')]=_[_0x2348('0x33')](db[_0x2348('0x44')]['rawAttributes']);_0x2b3ae8[_0x2348('0x32')]=_[_0x2348('0x33')](_0x3ac03a[_0x2348('0x32')]);_0x2b3ae8[_0x2348('0x34')]=_['intersection'](_0x2b3ae8[_0x2348('0x31')],_0x2b3ae8[_0x2348('0x32')]);_0x3ca8ad[_0x2348('0x37')]=_[_0x2348('0x35')](_0x2b3ae8[_0x2348('0x31')],qs[_0x2348('0x36')](_0x3ac03a['query'][_0x2348('0x36')]));_0x3ca8ad['attributes']=_0x3ca8ad[_0x2348('0x37')][_0x2348('0x38')]?_0x3ca8ad[_0x2348('0x37')]:_0x2b3ae8[_0x2348('0x31')];if(_0x3ac03a['query'][_0x2348('0x45')]){_0x3ca8ad[_0x2348('0x46')]=[{'all':!![]}];}_0x3ca8ad=_[_0x2348('0x3f')]({},_0x3ca8ad,_0x3ac03a[_0x2348('0x43')]);return db[_0x2348('0x44')][_0x2348('0x4b')](_0x3ca8ad)[_0x2348('0x26')](handleEntityNotFound(_0x4d1ed3,null))[_0x2348('0x26')](respondWithResult(_0x4d1ed3,null))[_0x2348('0x48')](handleError(_0x4d1ed3,null));};exports['create']=function(_0x508bf7,_0x417e1f){return db[_0x2348('0x44')][_0x2348('0x4c')](_0x508bf7[_0x2348('0x4d')],{})[_0x2348('0x26')](respondWithResult(_0x417e1f,0xc9))['catch'](handleError(_0x417e1f,null));};exports[_0x2348('0x25')]=function(_0x15c42f,_0x3f3dea){if(_0x15c42f[_0x2348('0x4d')]['id']){delete _0x15c42f[_0x2348('0x4d')]['id'];}return db[_0x2348('0x44')]['find']({'where':{'id':_0x15c42f['params']['id']}})[_0x2348('0x26')](handleEntityNotFound(_0x3f3dea,null))[_0x2348('0x26')](saveUpdates(_0x15c42f['body'],null))[_0x2348('0x26')](respondWithResult(_0x3f3dea,null))[_0x2348('0x48')](handleError(_0x3f3dea,null));};exports[_0x2348('0x27')]=function(_0x2134f4,_0x297eb5){return db[_0x2348('0x44')][_0x2348('0x4b')]({'where':{'id':_0x2134f4[_0x2348('0x4a')]['id']}})[_0x2348('0x26')](handleEntityNotFound(_0x297eb5,null))[_0x2348('0x26')](removeEntity(_0x297eb5,null))[_0x2348('0x48')](handleError(_0x297eb5,null));};exports[_0x2348('0x4e')]=function(_0x431b88,_0x131972,_0x4ffc65){var _0x1abc5c={};var _0x251af2={};var _0x1fb938;var _0x3d67d1;return db[_0x2348('0x44')]['findOne']({'where':{'id':_0x431b88[_0x2348('0x4a')]['id']}})['then'](handleEntityNotFound(_0x131972,null))['then'](function(_0x20922a){if(_0x20922a){_0x1fb938=_0x20922a;_0x251af2[_0x2348('0x31')]=_[_0x2348('0x33')](db[_0x2348('0x4f')][_0x2348('0x2f')]);_0x251af2[_0x2348('0x32')]=_[_0x2348('0x33')](_0x431b88['query']);_0x251af2[_0x2348('0x34')]=_[_0x2348('0x35')](_0x251af2[_0x2348('0x31')],_0x251af2[_0x2348('0x32')]);_0x1abc5c[_0x2348('0x37')]=_[_0x2348('0x35')](_0x251af2[_0x2348('0x31')],qs[_0x2348('0x36')](_0x431b88['query']['fields']));_0x1abc5c[_0x2348('0x37')]=_0x1abc5c[_0x2348('0x37')][_0x2348('0x38')]?_0x1abc5c['attributes']:_0x251af2[_0x2348('0x31')];_0x1abc5c[_0x2348('0x3b')]=qs[_0x2348('0x3c')](_0x431b88[_0x2348('0x32')]['sort']);_0x1abc5c['where']=qs[_0x2348('0x34')](_[_0x2348('0x50')](_0x431b88[_0x2348('0x32')],_0x251af2[_0x2348('0x34')]));if(_0x431b88[_0x2348('0x32')][_0x2348('0x3d')]){_0x1abc5c[_0x2348('0x3e')]=_[_0x2348('0x3f')](_0x1abc5c[_0x2348('0x3e')],{'$or':_[_0x2348('0x40')](_0x1abc5c[_0x2348('0x37')],function(_0x2c78ff){var _0x2c0e46={};_0x2c0e46[_0x2c78ff]={'$like':'%'+_0x431b88[_0x2348('0x32')][_0x2348('0x3d')]+'%'};return _0x2c0e46;})});}_0x1abc5c=_[_0x2348('0x3f')]({},_0x1abc5c,_0x431b88[_0x2348('0x43')]);return _0x1fb938[_0x2348('0x4e')](_0x1abc5c);}})[_0x2348('0x26')](function(_0x403862){if(_0x403862){_0x3d67d1=_0x403862[_0x2348('0x38')];if(!_0x431b88[_0x2348('0x32')][_0x2348('0x39')]('nolimit')){_0x1abc5c[_0x2348('0x1e')]=qs[_0x2348('0x1e')](_0x431b88[_0x2348('0x32')][_0x2348('0x1e')]);_0x1abc5c[_0x2348('0x1d')]=qs['offset'](_0x431b88[_0x2348('0x32')][_0x2348('0x1d')]);}return _0x1fb938[_0x2348('0x4e')](_0x1abc5c);}})['then'](function(_0x466e27){if(_0x466e27){return _0x466e27?{'count':_0x3d67d1,'rows':_0x466e27}:null;}})[_0x2348('0x26')](respondWithResult(_0x131972,null))[_0x2348('0x48')](handleError(_0x131972,null));};exports['addConfiguration']=function(_0x3dc182,_0x14a861,_0x37c4fc){if(_0x3dc182[_0x2348('0x4d')]['id']){delete _0x3dc182['body']['id'];}return db['VtigerAccount'][_0x2348('0x51')]({'where':{'id':_0x3dc182[_0x2348('0x4a')]['id']}})[_0x2348('0x26')](handleEntityNotFound(_0x14a861,null))[_0x2348('0x26')](function(_0x1b46bd){if(_0x1b46bd){_0x3dc182[_0x2348('0x4d')][_0x2348('0x52')]=_0x1b46bd['id'];_0x3dc182['body'][_0x2348('0x53')]=integrations[_0x2348('0x54')](_0x3dc182[_0x2348('0x4d')]['channel'],_0x3dc182['body']['type']);_0x3dc182['body']['Descriptions']=integrations[_0x2348('0x55')](_0x3dc182[_0x2348('0x4d')][_0x2348('0x56')],_0x3dc182[_0x2348('0x4d')]['type']);return db[_0x2348('0x4f')][_0x2348('0x4c')](_0x3dc182[_0x2348('0x4d')],{'include':[{'model':db[_0x2348('0x57')],'as':_0x2348('0x53')},{'model':db[_0x2348('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x14a861,null))[_0x2348('0x48')](handleError(_0x14a861,null));};var md5=require(_0x2348('0x58'));exports[_0x2348('0x59')]=function(_0x2f6a99,_0x256b02,_0x5240fa){var _0x5afeda=null;var _0xcac094=null;var _0x2082cf=null;var _0x4aeef9=null;var _0x5ad7e9='';return db[_0x2348('0x44')]['findOne']({'where':{'id':_0x2f6a99[_0x2348('0x4a')]['id']},'attributes':['id','name',_0x2348('0x5a'),_0x2348('0x5b'),_0x2348('0x5c'),_0x2348('0x5d'),_0x2348('0x5e'),_0x2348('0x5f')]})[_0x2348('0x26')](handleEntityNotFound(_0x256b02,null))[_0x2348('0x26')](function(_0x42027c){if(_0x42027c){_0x5afeda=_0x42027c[_0x2348('0x5a')];_0xcac094=_0x42027c['accessKey'];_0x2082cf=_0x42027c[_0x2348('0x5c')];_0x5ad7e9=_0x42027c['remoteUri'];var _0x2697d2=_0x5ad7e9['slice'](-0x1);if(_0x2697d2==='/'){_0x5ad7e9=_0x5ad7e9[_0x2348('0x60')](0x0,_0x5ad7e9[_0x2348('0x61')](_0x2697d2));}_0x4aeef9=util[_0x2348('0x62')]('%s/webservice.php',_0x5ad7e9);var _0x188561={'method':'GET','uri':_0x4aeef9,'qs':{'operation':_0x2348('0x63'),'username':_0x42027c[_0x2348('0x5a')]},'json':!![]};return rp(_0x188561);}})['then'](function(_0x5c3b39){if(_0x5c3b39[_0x2348('0x64')]){var _0x153565={'method':_0x2348('0x65'),'uri':_0x4aeef9,'form':{'operation':_0x2348('0x66'),'username':_0x5afeda,'accessKey':md5(_0x5c3b39['result'][_0x2348('0x67')]+_0xcac094)},'json':!![]};return rp(_0x153565);}})[_0x2348('0x26')](function(_0x59f714){if(_0x59f714[_0x2348('0x64')]){var _0x2c15ea={'method':_0x2348('0x68'),'uri':_0x4aeef9,'qs':{'operation':_0x2348('0x69'),'username':_0x5afeda,'sessionName':_0x59f714[_0x2348('0x6a')][_0x2348('0x6b')],'elementType':_0x2082cf},'json':!![]};return rp(_0x2c15ea);}})[_0x2348('0x26')](function(_0x5546d5){if(_0x5546d5[_0x2348('0x64')]){var _0x287111=[_0x2348('0x6c'),_0x2348('0x6d'),_0x2348('0x6e')];_[_0x2348('0x6f')](_0x5546d5[_0x2348('0x6a')][_0x2348('0x36')],function(_0x2af743){return _0x287111['includes'](_0x2af743[_0x2348('0x41')]['name']);});_[_0x2348('0x6f')](_0x5546d5['result'][_0x2348('0x36')],function(_0x1bb920){return _0x1bb920[_0x2348('0x70')]===_0x2348('0x71');});return{'count':_0x5546d5[_0x2348('0x6a')][_0x2348('0x36')][_0x2348('0x38')],'rows':_[_0x2348('0x40')](_0x5546d5[_0x2348('0x6a')][_0x2348('0x36')],function(_0x2abbf9){return{'id':_0x2abbf9['name'],'name':_0x2abbf9['label'],'custom':_[_0x2348('0x72')](_0x2abbf9[_0x2348('0x2c')],_0x2348('0x73'))?!![]:![],'options':_0x2abbf9['type'][_0x2348('0x2c')]===_0x2348('0x74')&&_0x2abbf9[_0x2348('0x41')]['picklistValues']['length']>0x0?_[_0x2348('0x40')](_0x2abbf9[_0x2348('0x41')][_0x2348('0x75')],function(_0x54cc50){return{'name':_0x54cc50['label'],'value':_0x54cc50[_0x2348('0x76')]};}):[]};})};}})[_0x2348('0x26')](respondWithResult(_0x256b02,null))[_0x2348('0x48')](function(_0x7a3d74){console[_0x2348('0x77')](_0x2348('0x78')+_0x7a3d74);var _0xbe4903=_0x2f6a99[_0x2348('0x32')][_0x2348('0x79')]?0x1f4:_0x7a3d74[_0x2348('0x7a')]||0x1f4;logger[_0x2348('0x2a')](_0x2348('0x7b'),'getFields',_0xbe4903,JSON['stringify'](_0x7a3d74));delete _0x7a3d74[_0x2348('0x2c')];if(_0xbe4903===0x191){_0xbe4903=0x190;}_0x256b02[_0x2348('0x1c')](_0xbe4903)[_0x2348('0x2d')](_0x2f6a99['query']['test']?{'message':_0x2348('0x7c'),'statusCode':_0x7a3d74['statusCode']}:_0x7a3d74);});}; \ No newline at end of file +var _0x042a=['getchallenge','success','POST','login','result','token','GET','describe','sessionName','autogenerated','remove','includes','editable','label','startsWith','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','VtigerAccount','count','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','VtigerField','Descriptions','md5','getFields','description','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php'];(function(_0xde3e84,_0x261223){var _0x527c6c=function(_0x16080c){while(--_0x16080c){_0xde3e84['push'](_0xde3e84['shift']());}};_0x527c6c(++_0x261223);}(_0x042a,0x18b));var _0xa042=function(_0x1716af,_0x15dddc){_0x1716af=_0x1716af-0x0;var _0x3ed224=_0x042a[_0x1716af];return _0x3ed224;};'use strict';var emlformat=require(_0xa042('0x0'));var rimraf=require(_0xa042('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa042('0x2'));var moment=require(_0xa042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa042('0x4'));var util=require(_0xa042('0x5'));var path=require(_0xa042('0x6'));var sox=require('sox');var csv=require(_0xa042('0x7'));var ejs=require(_0xa042('0x8'));var fs=require('fs');var fs_extra=require(_0xa042('0x9'));var _=require(_0xa042('0xa'));var squel=require(_0xa042('0xb'));var crypto=require(_0xa042('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa042('0xd'));var toCsv=require(_0xa042('0x7'));var querystring=require(_0xa042('0xe'));var Papa=require(_0xa042('0xf'));var Redis=require(_0xa042('0x10'));var authService=require(_0xa042('0x11'));var qs=require(_0xa042('0x12'));var as=require(_0xa042('0x13'));var hardwareService=require(_0xa042('0x14'));var logger=require('../../config/logger')(_0xa042('0x15'));var utils=require(_0xa042('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa042('0x17'));var db=require(_0xa042('0x18'))['db'];var integrations=require(_0xa042('0x19'));function respondWithStatusCode(_0x1f98ee,_0x5da251){_0x5da251=_0x5da251||0xcc;return function(_0xebbf09){if(_0xebbf09){return _0x1f98ee['sendStatus'](_0x5da251);}return _0x1f98ee['status'](_0x5da251)[_0xa042('0x1a')]();};}function respondWithResult(_0x18604a,_0x337645){_0x337645=_0x337645||0xc8;return function(_0x4dccd0){if(_0x4dccd0){return _0x18604a[_0xa042('0x1b')](_0x337645)[_0xa042('0x1c')](_0x4dccd0);}};}function respondWithFilteredResult(_0x2d68a3,_0x1a3ac5){return function(_0x3630f3){if(_0x3630f3){var _0x4e5efb=typeof _0x1a3ac5['offset']===_0xa042('0x1d')&&typeof _0x1a3ac5['limit']==='undefined';var _0x4b13f5=_0x3630f3['count'];var _0x327586=_0x4e5efb?0x0:_0x1a3ac5[_0xa042('0x1e')];var _0x49a1f0=_0x4e5efb?_0x3630f3['count']:_0x1a3ac5[_0xa042('0x1e')]+_0x1a3ac5[_0xa042('0x1f')];var _0xd0ed0c;if(_0x49a1f0>=_0x4b13f5){_0x49a1f0=_0x4b13f5;_0xd0ed0c=0xc8;}else{_0xd0ed0c=0xce;}_0x2d68a3[_0xa042('0x1b')](_0xd0ed0c);return _0x2d68a3[_0xa042('0x20')](_0xa042('0x21'),_0x327586+'-'+_0x49a1f0+'/'+_0x4b13f5)['json'](_0x3630f3);}return null;};}function patchUpdates(_0x21737a){return function(_0x18b12b){try{jsonpatch[_0xa042('0x22')](_0x18b12b,_0x21737a,!![]);}catch(_0xae8126){return BPromise[_0xa042('0x23')](_0xae8126);}return _0x18b12b['save']();};}function saveUpdates(_0xb73f14,_0x46178c){return function(_0x4eb8c4){if(_0x4eb8c4){return _0x4eb8c4[_0xa042('0x24')](_0xb73f14)['then'](function(_0x47bc3e){return _0x47bc3e;});}return null;};}function removeEntity(_0x41c111,_0x5c1553){return function(_0x36ea55){if(_0x36ea55){return _0x36ea55[_0xa042('0x25')]()['then'](function(){_0x41c111[_0xa042('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44189f,_0x4ca6f2){return function(_0x49738b){if(!_0x49738b){_0x44189f[_0xa042('0x26')](0x194);}return _0x49738b;};}function handleError(_0x5c0ee8,_0x50a07c){_0x50a07c=_0x50a07c||0x1f4;return function(_0x1df12b){logger[_0xa042('0x27')](_0x1df12b[_0xa042('0x28')]);if(_0x1df12b[_0xa042('0x29')]){delete _0x1df12b[_0xa042('0x29')];}_0x5c0ee8['status'](_0x50a07c)[_0xa042('0x2a')](_0x1df12b);};}exports[_0xa042('0x2b')]=function(_0x2262e6,_0x56f5a9){var _0x6fedb5={},_0x14c922={},_0x2946cd={'count':0x0,'rows':[]};var _0x1fdb8a=_[_0xa042('0x2c')](db['VtigerAccount'][_0xa042('0x2d')],function(_0x5a6790){return{'name':_0x5a6790[_0xa042('0x2e')],'type':_0x5a6790[_0xa042('0x2f')]['key']};});_0x14c922[_0xa042('0x30')]=_[_0xa042('0x2c')](_0x1fdb8a,_0xa042('0x29'));_0x14c922[_0xa042('0x31')]=_[_0xa042('0x32')](_0x2262e6[_0xa042('0x31')]);_0x14c922[_0xa042('0x33')]=_[_0xa042('0x34')](_0x14c922[_0xa042('0x30')],_0x14c922['query']);_0x6fedb5[_0xa042('0x35')]=_[_0xa042('0x34')](_0x14c922[_0xa042('0x30')],qs[_0xa042('0x36')](_0x2262e6['query']['fields']));_0x6fedb5['attributes']=_0x6fedb5[_0xa042('0x35')]['length']?_0x6fedb5[_0xa042('0x35')]:_0x14c922[_0xa042('0x30')];if(!_0x2262e6[_0xa042('0x31')][_0xa042('0x37')](_0xa042('0x38'))){_0x6fedb5[_0xa042('0x1f')]=qs[_0xa042('0x1f')](_0x2262e6[_0xa042('0x31')]['limit']);_0x6fedb5[_0xa042('0x1e')]=qs['offset'](_0x2262e6[_0xa042('0x31')][_0xa042('0x1e')]);}_0x6fedb5['order']=qs[_0xa042('0x39')](_0x2262e6['query'][_0xa042('0x39')]);_0x6fedb5[_0xa042('0x3a')]=qs[_0xa042('0x33')](_[_0xa042('0x3b')](_0x2262e6[_0xa042('0x31')],_0x14c922['filters']),_0x1fdb8a);if(_0x2262e6[_0xa042('0x31')][_0xa042('0x3c')]){_0x6fedb5[_0xa042('0x3a')]=_['merge'](_0x6fedb5['where'],{'$or':_['map'](_0x1fdb8a,function(_0x43a07b){if(_0x43a07b[_0xa042('0x2f')]!==_0xa042('0x3d')){var _0xd9b4be={};_0xd9b4be[_0x43a07b[_0xa042('0x29')]]={'$like':'%'+_0x2262e6[_0xa042('0x31')][_0xa042('0x3c')]+'%'};return _0xd9b4be;}})});}_0x6fedb5=_[_0xa042('0x3e')]({},_0x6fedb5,_0x2262e6[_0xa042('0x3f')]);var _0x1de420={'where':_0x6fedb5[_0xa042('0x3a')]};return db[_0xa042('0x40')][_0xa042('0x41')](_0x1de420)[_0xa042('0x42')](function(_0x40cc91){_0x2946cd[_0xa042('0x41')]=_0x40cc91;if(_0x2262e6[_0xa042('0x31')][_0xa042('0x43')]){_0x6fedb5[_0xa042('0x44')]=[{'all':!![]}];}return db[_0xa042('0x40')][_0xa042('0x45')](_0x6fedb5);})['then'](function(_0x3ab1a4){_0x2946cd[_0xa042('0x46')]=_0x3ab1a4;return _0x2946cd;})[_0xa042('0x42')](respondWithFilteredResult(_0x56f5a9,_0x6fedb5))[_0xa042('0x47')](handleError(_0x56f5a9,null));};exports[_0xa042('0x48')]=function(_0x59e663,_0x5a0495){var _0x127190={'raw':![],'where':{'id':_0x59e663['params']['id']}},_0x276129={};_0x276129[_0xa042('0x30')]=_['keys'](db[_0xa042('0x40')][_0xa042('0x2d')]);_0x276129[_0xa042('0x31')]=_[_0xa042('0x32')](_0x59e663[_0xa042('0x31')]);_0x276129[_0xa042('0x33')]=_[_0xa042('0x34')](_0x276129[_0xa042('0x30')],_0x276129[_0xa042('0x31')]);_0x127190[_0xa042('0x35')]=_[_0xa042('0x34')](_0x276129[_0xa042('0x30')],qs[_0xa042('0x36')](_0x59e663[_0xa042('0x31')][_0xa042('0x36')]));_0x127190['attributes']=_0x127190[_0xa042('0x35')][_0xa042('0x49')]?_0x127190[_0xa042('0x35')]:_0x276129[_0xa042('0x30')];if(_0x59e663[_0xa042('0x31')][_0xa042('0x43')]){_0x127190['include']=[{'all':!![]}];}_0x127190=_[_0xa042('0x3e')]({},_0x127190,_0x59e663[_0xa042('0x3f')]);return db['VtigerAccount'][_0xa042('0x4a')](_0x127190)[_0xa042('0x42')](handleEntityNotFound(_0x5a0495,null))[_0xa042('0x42')](respondWithResult(_0x5a0495,null))[_0xa042('0x47')](handleError(_0x5a0495,null));};exports[_0xa042('0x4b')]=function(_0x225cc2,_0x2a0ca0){return db[_0xa042('0x40')][_0xa042('0x4b')](_0x225cc2[_0xa042('0x4c')],{})[_0xa042('0x42')](respondWithResult(_0x2a0ca0,0xc9))[_0xa042('0x47')](handleError(_0x2a0ca0,null));};exports[_0xa042('0x24')]=function(_0x1fb65a,_0x4b4e61){if(_0x1fb65a[_0xa042('0x4c')]['id']){delete _0x1fb65a[_0xa042('0x4c')]['id'];}return db[_0xa042('0x40')][_0xa042('0x4a')]({'where':{'id':_0x1fb65a[_0xa042('0x4d')]['id']}})[_0xa042('0x42')](handleEntityNotFound(_0x4b4e61,null))[_0xa042('0x42')](saveUpdates(_0x1fb65a[_0xa042('0x4c')],null))[_0xa042('0x42')](respondWithResult(_0x4b4e61,null))[_0xa042('0x47')](handleError(_0x4b4e61,null));};exports[_0xa042('0x25')]=function(_0x1db5e6,_0x20ef13){return db[_0xa042('0x40')][_0xa042('0x4a')]({'where':{'id':_0x1db5e6[_0xa042('0x4d')]['id']}})[_0xa042('0x42')](handleEntityNotFound(_0x20ef13,null))['then'](removeEntity(_0x20ef13,null))[_0xa042('0x47')](handleError(_0x20ef13,null));};exports[_0xa042('0x4e')]=function(_0x1fa29f,_0x353e9e,_0x89a50d){var _0x2c14a3={};var _0x4d6bf6={};var _0x40586c;var _0x2085bf;return db[_0xa042('0x40')][_0xa042('0x4f')]({'where':{'id':_0x1fa29f['params']['id']}})[_0xa042('0x42')](handleEntityNotFound(_0x353e9e,null))[_0xa042('0x42')](function(_0x5ac3e7){if(_0x5ac3e7){_0x40586c=_0x5ac3e7;_0x4d6bf6[_0xa042('0x30')]=_[_0xa042('0x32')](db[_0xa042('0x50')][_0xa042('0x2d')]);_0x4d6bf6[_0xa042('0x31')]=_[_0xa042('0x32')](_0x1fa29f[_0xa042('0x31')]);_0x4d6bf6[_0xa042('0x33')]=_[_0xa042('0x34')](_0x4d6bf6['model'],_0x4d6bf6[_0xa042('0x31')]);_0x2c14a3[_0xa042('0x35')]=_[_0xa042('0x34')](_0x4d6bf6['model'],qs['fields'](_0x1fa29f[_0xa042('0x31')][_0xa042('0x36')]));_0x2c14a3[_0xa042('0x35')]=_0x2c14a3[_0xa042('0x35')][_0xa042('0x49')]?_0x2c14a3[_0xa042('0x35')]:_0x4d6bf6['model'];_0x2c14a3[_0xa042('0x51')]=qs['sort'](_0x1fa29f[_0xa042('0x31')]['sort']);_0x2c14a3[_0xa042('0x3a')]=qs[_0xa042('0x33')](_[_0xa042('0x3b')](_0x1fa29f[_0xa042('0x31')],_0x4d6bf6[_0xa042('0x33')]));if(_0x1fa29f[_0xa042('0x31')][_0xa042('0x3c')]){_0x2c14a3['where']=_[_0xa042('0x3e')](_0x2c14a3[_0xa042('0x3a')],{'$or':_[_0xa042('0x2c')](_0x2c14a3['attributes'],function(_0x2649d6){var _0x1aee05={};_0x1aee05[_0x2649d6]={'$like':'%'+_0x1fa29f[_0xa042('0x31')][_0xa042('0x3c')]+'%'};return _0x1aee05;})});}_0x2c14a3=_[_0xa042('0x3e')]({},_0x2c14a3,_0x1fa29f['options']);return _0x40586c[_0xa042('0x4e')](_0x2c14a3);}})[_0xa042('0x42')](function(_0xbebbc7){if(_0xbebbc7){_0x2085bf=_0xbebbc7['length'];if(!_0x1fa29f[_0xa042('0x31')][_0xa042('0x37')](_0xa042('0x38'))){_0x2c14a3[_0xa042('0x1f')]=qs['limit'](_0x1fa29f[_0xa042('0x31')][_0xa042('0x1f')]);_0x2c14a3[_0xa042('0x1e')]=qs['offset'](_0x1fa29f[_0xa042('0x31')][_0xa042('0x1e')]);}return _0x40586c[_0xa042('0x4e')](_0x2c14a3);}})['then'](function(_0x1af148){if(_0x1af148){return _0x1af148?{'count':_0x2085bf,'rows':_0x1af148}:null;}})['then'](respondWithResult(_0x353e9e,null))['catch'](handleError(_0x353e9e,null));};exports[_0xa042('0x52')]=function(_0x5db66c,_0x351f1e,_0x45610a){if(_0x5db66c[_0xa042('0x4c')]['id']){delete _0x5db66c[_0xa042('0x4c')]['id'];}return db[_0xa042('0x40')][_0xa042('0x4f')]({'where':{'id':_0x5db66c[_0xa042('0x4d')]['id']}})[_0xa042('0x42')](handleEntityNotFound(_0x351f1e,null))['then'](function(_0x10904c){if(_0x10904c){_0x5db66c['body'][_0xa042('0x53')]=_0x10904c['id'];_0x5db66c[_0xa042('0x4c')][_0xa042('0x54')]=integrations[_0xa042('0x55')](_0x5db66c[_0xa042('0x4c')][_0xa042('0x56')],_0x5db66c[_0xa042('0x4c')][_0xa042('0x2f')]);_0x5db66c[_0xa042('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x5db66c['body']['channel'],_0x5db66c[_0xa042('0x4c')]['type']);return db[_0xa042('0x50')][_0xa042('0x4b')](_0x5db66c[_0xa042('0x4c')],{'include':[{'model':db[_0xa042('0x57')],'as':_0xa042('0x54')},{'model':db[_0xa042('0x57')],'as':_0xa042('0x58')}]});}return null;})[_0xa042('0x42')](respondWithResult(_0x351f1e,null))['catch'](handleError(_0x351f1e,null));};var md5=require(_0xa042('0x59'));exports[_0xa042('0x5a')]=function(_0x2e9f21,_0x397bfb,_0x1ee0ba){var _0x4b2acd=null;var _0x465553=null;var _0xb907a5=null;var _0x1aa9bf=null;var _0x5de45b='';return db[_0xa042('0x40')][_0xa042('0x4f')]({'where':{'id':_0x2e9f21['params']['id']},'attributes':['id',_0xa042('0x29'),'username',_0xa042('0x5b'),'moduleName',_0xa042('0x5c'),_0xa042('0x5d'),_0xa042('0x5e')]})[_0xa042('0x42')](handleEntityNotFound(_0x397bfb,null))['then'](function(_0x3d512d){if(_0x3d512d){_0x4b2acd=_0x3d512d[_0xa042('0x5f')];_0x465553=_0x3d512d[_0xa042('0x5e')];_0xb907a5=_0x3d512d['moduleName'];_0x5de45b=_0x3d512d['remoteUri'];var _0x33609e=_0x5de45b[_0xa042('0x60')](-0x1);if(_0x33609e==='/'){_0x5de45b=_0x5de45b[_0xa042('0x61')](0x0,_0x5de45b[_0xa042('0x62')](_0x33609e));}_0x1aa9bf=util[_0xa042('0x63')](_0xa042('0x64'),_0x5de45b);var _0x1ca56a={'method':'GET','uri':_0x1aa9bf,'qs':{'operation':_0xa042('0x65'),'username':_0x3d512d[_0xa042('0x5f')]},'json':!![]};return rp(_0x1ca56a);}})[_0xa042('0x42')](function(_0x3150cd){if(_0x3150cd[_0xa042('0x66')]){var _0x49306a={'method':_0xa042('0x67'),'uri':_0x1aa9bf,'form':{'operation':_0xa042('0x68'),'username':_0x4b2acd,'accessKey':md5(_0x3150cd[_0xa042('0x69')][_0xa042('0x6a')]+_0x465553)},'json':!![]};return rp(_0x49306a);}})[_0xa042('0x42')](function(_0x30ab2b){if(_0x30ab2b[_0xa042('0x66')]){var _0x23955c={'method':_0xa042('0x6b'),'uri':_0x1aa9bf,'qs':{'operation':_0xa042('0x6c'),'username':_0x4b2acd,'sessionName':_0x30ab2b[_0xa042('0x69')][_0xa042('0x6d')],'elementType':_0xb907a5},'json':!![]};return rp(_0x23955c);}})[_0xa042('0x42')](function(_0x29d65b){if(_0x29d65b['success']){var _0x331886=[_0xa042('0x6e'),'reference','owner'];_[_0xa042('0x6f')](_0x29d65b[_0xa042('0x69')][_0xa042('0x36')],function(_0x421988){return _0x331886[_0xa042('0x70')](_0x421988[_0xa042('0x2f')][_0xa042('0x29')]);});_[_0xa042('0x6f')](_0x29d65b[_0xa042('0x69')][_0xa042('0x36')],function(_0xff6fea){return _0xff6fea[_0xa042('0x71')]==='false';});return{'count':_0x29d65b[_0xa042('0x69')][_0xa042('0x36')]['length'],'rows':_['map'](_0x29d65b['result'][_0xa042('0x36')],function(_0x11caf5){return{'id':_0x11caf5[_0xa042('0x29')],'name':_0x11caf5[_0xa042('0x72')],'custom':_[_0xa042('0x73')](_0x11caf5[_0xa042('0x29')],'cf_')?!![]:![],'options':_0x11caf5['type']['name']===_0xa042('0x74')&&_0x11caf5[_0xa042('0x2f')]['picklistValues'][_0xa042('0x49')]>0x0?_[_0xa042('0x2c')](_0x11caf5['type'][_0xa042('0x75')],function(_0x315486){return{'name':_0x315486[_0xa042('0x72')],'value':_0x315486[_0xa042('0x76')]};}):[]};})};}})[_0xa042('0x42')](respondWithResult(_0x397bfb,null))[_0xa042('0x47')](function(_0x1fdb62){console['log'](_0xa042('0x77')+_0x1fdb62);var _0x55d76c=_0x2e9f21[_0xa042('0x31')][_0xa042('0x78')]?0x1f4:_0x1fdb62[_0xa042('0x79')]||0x1f4;logger[_0xa042('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xa042('0x5a'),_0x55d76c,JSON[_0xa042('0x7a')](_0x1fdb62));delete _0x1fdb62['name'];if(_0x55d76c===0x191){_0x55d76c=0x190;}_0x397bfb[_0xa042('0x1b')](_0x55d76c)['send'](_0x2e9f21[_0xa042('0x31')][_0xa042('0x78')]?{'message':_0xa042('0x7b'),'statusCode':_0x1fdb62[_0xa042('0x79')]}:_0x1fdb62);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d7b71c4..f1ba17c 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 _0xf148=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerAccount.attributes'];(function(_0x234ce7,_0x3e909c){var _0x57c561=function(_0x8ac1bb){while(--_0x8ac1bb){_0x234ce7['push'](_0x234ce7['shift']());}};_0x57c561(++_0x3e909c);}(_0xf148,0xf4));var _0x8f14=function(_0x41a7a7,_0x1d8527){_0x41a7a7=_0x41a7a7-0x0;var _0x4dcd48=_0xf148[_0x41a7a7];return _0x4dcd48;};'use strict';var _=require(_0x8f14('0x0'));var util=require('util');var logger=require(_0x8f14('0x1'))(_0x8f14('0x2'));var moment=require(_0x8f14('0x3'));var BPromise=require(_0x8f14('0x4'));var rp=require(_0x8f14('0x5'));var fs=require('fs');var path=require(_0x8f14('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f14('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8f14('0x8')]=function(_0x449471,_0xdcbd59){return _0x449471[_0x8f14('0x9')](_0x8f14('0xa'),attributes,{'tableName':_0x8f14('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83dd=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x83dd,0x18f));var _0xd83d=function(_0x195920,_0x4997f6){_0x195920=_0x195920-0x0;var _0x1135a2=_0x83dd[_0x195920];return _0x1135a2;};'use strict';var _=require(_0xd83d('0x0'));var util=require(_0xd83d('0x1'));var logger=require(_0xd83d('0x2'))('api');var moment=require(_0xd83d('0x3'));var BPromise=require(_0xd83d('0x4'));var rp=require(_0xd83d('0x5'));var fs=require('fs');var path=require(_0xd83d('0x6'));var rimraf=require(_0xd83d('0x7'));var config=require(_0xd83d('0x8'));var attributes=require(_0xd83d('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd83d('0xa')]=function(_0x34b155,_0x2a78f5){return _0x34b155['define'](_0xd83d('0xb'),attributes,{'tableName':_0xd83d('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 f19125c..5c729d2 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 _0x878f=['ShowVtigerAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','then','stringify'];(function(_0xdb2328,_0x5f0285){var _0x9d56ee=function(_0x285121){while(--_0x285121){_0xdb2328['push'](_0xdb2328['shift']());}};_0x9d56ee(++_0x5f0285);}(_0x878f,0x173));var _0xf878=function(_0x118791,_0x483e3e){_0x118791=_0x118791-0x0;var _0x31d647=_0x878f[_0x118791];return _0x31d647;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});}exports[_0xf878('0x15')]=function(_0x3b2e1b){var _0x47a91a=this;return new Promise(function(_0x2b2b54,_0x34ae59){return db[_0xf878('0x16')][_0xf878('0x17')]({'raw':_0x3b2e1b[_0xf878('0x18')]?_0x3b2e1b[_0xf878('0x18')][_0xf878('0x19')]===undefined?!![]:![]:!![],'where':_0x3b2e1b['options']?_0x3b2e1b[_0xf878('0x18')][_0xf878('0x1a')]||null:null,'attributes':_0x3b2e1b[_0xf878('0x18')]?_0x3b2e1b['options'][_0xf878('0x1b')]||null:null,'limit':_0x3b2e1b[_0xf878('0x18')]?_0x3b2e1b[_0xf878('0x18')][_0xf878('0x1c')]||null:null,'include':_0x3b2e1b[_0xf878('0x18')]?_0x3b2e1b[_0xf878('0x18')][_0xf878('0x1d')]?_[_0xf878('0x1e')](_0x3b2e1b[_0xf878('0x18')][_0xf878('0x1d')],function(_0x45e61f){return{'model':db[_0x45e61f['model']],'as':_0x45e61f['as'],'attributes':_0x45e61f[_0xf878('0x1b')],'include':_0x45e61f['include']?_[_0xf878('0x1e')](_0x45e61f[_0xf878('0x1d')],function(_0x35b3b4){return{'model':db[_0x35b3b4[_0xf878('0x1f')]],'as':_0x35b3b4['as'],'attributes':_0x35b3b4[_0xf878('0x1b')],'include':_0x35b3b4['include']?_['map'](_0x35b3b4['include'],function(_0x242926){return{'model':db[_0x242926[_0xf878('0x1f')]],'as':_0x242926['as'],'attributes':_0x242926[_0xf878('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfa3e11){logger[_0xf878('0xc')](_0xf878('0x15'),_0x3b2e1b);logger[_0xf878('0x20')](_0xf878('0x15'),_0x3b2e1b,JSON['stringify'](_0xfa3e11));_0x2b2b54(_0xfa3e11);})['catch'](function(_0x9a127d){logger[_0xf878('0x10')]('GetVtigerAccount',_0x9a127d[_0xf878('0x12')],_0x3b2e1b);_0x34ae59(_0x47a91a['error'](0x1f4,_0x9a127d[_0xf878('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x2c61c1){var _0x49e66a=this;return new Promise(function(_0x2630fb,_0x48b151){return db[_0xf878('0x16')][_0xf878('0x21')]({'raw':_0x2c61c1[_0xf878('0x18')]?_0x2c61c1[_0xf878('0x18')][_0xf878('0x19')]===undefined?!![]:![]:!![],'where':_0x2c61c1[_0xf878('0x18')]?_0x2c61c1['options'][_0xf878('0x1a')]||null:null,'attributes':_0x2c61c1[_0xf878('0x18')]?_0x2c61c1[_0xf878('0x18')][_0xf878('0x1b')]||null:null,'include':_0x2c61c1[_0xf878('0x18')]?_0x2c61c1['options'][_0xf878('0x1d')]?_[_0xf878('0x1e')](_0x2c61c1['options'][_0xf878('0x1d')],function(_0xd1ad51){return{'model':db[_0xd1ad51[_0xf878('0x1f')]],'as':_0xd1ad51['as'],'attributes':_0xd1ad51[_0xf878('0x1b')],'include':_0xd1ad51[_0xf878('0x1d')]?_['map'](_0xd1ad51[_0xf878('0x1d')],function(_0x1b09de){return{'model':db[_0x1b09de[_0xf878('0x1f')]],'as':_0x1b09de['as'],'attributes':_0x1b09de[_0xf878('0x1b')],'include':_0x1b09de['include']?_[_0xf878('0x1e')](_0x1b09de['include'],function(_0x4ce1e7){return{'model':db[_0x4ce1e7[_0xf878('0x1f')]],'as':_0x4ce1e7['as'],'attributes':_0x4ce1e7[_0xf878('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf878('0x22')](function(_0x105416){logger[_0xf878('0xc')]('ShowVtigerAccount',_0x2c61c1);logger[_0xf878('0x20')]('ShowVtigerAccount',_0x2c61c1,JSON[_0xf878('0x23')](_0x105416));_0x2630fb(_0x105416);})[_0xf878('0x14')](function(_0x4d4aff){logger[_0xf878('0x10')](_0xf878('0x24'),_0x4d4aff['message'],_0x2c61c1);_0x48b151(_0x49e66a[_0xf878('0x10')](0x1f4,_0x4d4aff[_0xf878('0x12')]));});});}; \ No newline at end of file +var _0xa74f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','limit','attributes','include','map','model','ShowVtigerAccount','find','moment'];(function(_0x4dd1d2,_0x368e7){var _0x4ca6fe=function(_0x3439ea){while(--_0x3439ea){_0x4dd1d2['push'](_0x4dd1d2['shift']());}};_0x4ca6fe(++_0x368e7);}(_0xa74f,0x9a));var _0xfa74=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xa74f[_0x1e91eb];return _0x2af75a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});}exports[_0xfa74('0x13')]=function(_0x51dda1){var _0x4928b6=this;return new Promise(function(_0x31d3c1,_0x25a36b){return db[_0xfa74('0x14')]['findAll']({'raw':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x51dda1['options']?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x51dda1[_0xfa74('0x15')]?_0x51dda1['options']['attributes']||null:null,'limit':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x18')]||null:null,'include':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')]['include']?_['map'](_0x51dda1[_0xfa74('0x15')]['include'],function(_0x48cbd3){return{'model':db[_0x48cbd3['model']],'as':_0x48cbd3['as'],'attributes':_0x48cbd3[_0xfa74('0x19')],'include':_0x48cbd3[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x48cbd3['include'],function(_0x530f99){return{'model':db[_0x530f99[_0xfa74('0x1c')]],'as':_0x530f99['as'],'attributes':_0x530f99[_0xfa74('0x19')],'include':_0x530f99['include']?_[_0xfa74('0x1b')](_0x530f99['include'],function(_0x1a8cf7){return{'model':db[_0x1a8cf7[_0xfa74('0x1c')]],'as':_0x1a8cf7['as'],'attributes':_0x1a8cf7['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1130de){logger[_0xfa74('0x8')](_0xfa74('0x13'),_0x51dda1);logger['debug'](_0xfa74('0x13'),_0x51dda1,JSON[_0xfa74('0xc')](_0x1130de));_0x31d3c1(_0x1130de);})[_0xfa74('0x12')](function(_0x57d90e){logger['error'](_0xfa74('0x13'),_0x57d90e[_0xfa74('0xf')],_0x51dda1);_0x25a36b(_0x4928b6['error'](0x1f4,_0x57d90e['message']));});});};exports[_0xfa74('0x1d')]=function(_0x564060){var _0x2238d4=this;return new Promise(function(_0x4d6d0a,_0x363173){return db[_0xfa74('0x14')][_0xfa74('0x1e')]({'raw':_0x564060[_0xfa74('0x15')]?_0x564060['options'][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x19')]||null:null,'include':_0x564060['options']?_0x564060[_0xfa74('0x15')]['include']?_[_0xfa74('0x1b')](_0x564060[_0xfa74('0x15')][_0xfa74('0x1a')],function(_0x1b5ff0){return{'model':db[_0x1b5ff0['model']],'as':_0x1b5ff0['as'],'attributes':_0x1b5ff0['attributes'],'include':_0x1b5ff0[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x1b5ff0[_0xfa74('0x1a')],function(_0x25863f){return{'model':db[_0x25863f['model']],'as':_0x25863f['as'],'attributes':_0x25863f[_0xfa74('0x19')],'include':_0x25863f[_0xfa74('0x1a')]?_['map'](_0x25863f['include'],function(_0x557510){return{'model':db[_0x557510['model']],'as':_0x557510['as'],'attributes':_0x557510['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1c3b44){logger[_0xfa74('0x8')](_0xfa74('0x1d'),_0x564060);logger[_0xfa74('0xa')](_0xfa74('0x1d'),_0x564060,JSON[_0xfa74('0xc')](_0x1c3b44));_0x4d6d0a(_0x1c3b44);})[_0xfa74('0x12')](function(_0x1a2d52){logger['error'](_0xfa74('0x1d'),_0x1a2d52[_0xfa74('0xf')],_0x564060);_0x363173(_0x2238d4[_0xfa74('0xd')](0x1f4,_0x1a2d52[_0xfa74('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d70e1cf..3ca11e3 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 _0x9233=['isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','post','create','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x281cba,_0x2bc2ea){var _0x57e64f=function(_0x529d88){while(--_0x529d88){_0x281cba['push'](_0x281cba['shift']());}};_0x57e64f(++_0x2bc2ea);}(_0x9233,0x1ba));var _0x3923=function(_0x3f46b0,_0x7a813a){_0x3f46b0=_0x3f46b0-0x0;var _0x2873fe=_0x9233[_0x3f46b0];return _0x2873fe;};'use strict';var multer=require('multer');var util=require(_0x3923('0x0'));var path=require(_0x3923('0x1'));var timeout=require('connect-timeout');var express=require(_0x3923('0x2'));var router=express[_0x3923('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3923('0x4'));var interaction=require(_0x3923('0x5'));var config=require(_0x3923('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x3923('0x7')]('/',auth[_0x3923('0x8')](),controller['index']);router[_0x3923('0x7')](_0x3923('0x9'),auth['isAuthenticated'](),controller[_0x3923('0xa')]);router[_0x3923('0x7')]('/:id/fields',auth[_0x3923('0x8')](),controller['getFields']);router[_0x3923('0x7')](_0x3923('0xb'),auth[_0x3923('0x8')](),controller[_0x3923('0xc')]);router['get'](_0x3923('0xd'),auth[_0x3923('0x8')](),controller['getDescriptions']);router[_0x3923('0xe')]('/',auth['isAuthenticated'](),controller[_0x3923('0xf')]);router['put'](_0x3923('0x9'),auth[_0x3923('0x8')](),controller['update']);router['delete'](_0x3923('0x9'),auth[_0x3923('0x8')](),controller[_0x3923('0x10')]);module[_0x3923('0x11')]=router; \ No newline at end of file +var _0x91a1=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getDescriptions','post','put','update','exports'];(function(_0x3fc796,_0x182706){var _0x3bf157=function(_0x2dcd04){while(--_0x2dcd04){_0x3fc796['push'](_0x3fc796['shift']());}};_0x3bf157(++_0x182706);}(_0x91a1,0xf7));var _0x191a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91a1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x191a('0x0'));var util=require(_0x191a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x191a('0x2'));var router=express[_0x191a('0x3')]();var fs_extra=require(_0x191a('0x4'));var auth=require(_0x191a('0x5'));var interaction=require(_0x191a('0x6'));var config=require(_0x191a('0x7'));var controller=require(_0x191a('0x8'));router[_0x191a('0x9')]('/',auth[_0x191a('0xa')](),controller['index']);router[_0x191a('0x9')](_0x191a('0xb'),auth[_0x191a('0xa')](),controller['show']);router['get'](_0x191a('0xc'),auth[_0x191a('0xa')](),controller[_0x191a('0xd')]);router[_0x191a('0x9')]('/:id/subjects',auth[_0x191a('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x191a('0xa')](),controller[_0x191a('0xe')]);router[_0x191a('0xf')]('/',auth[_0x191a('0xa')](),controller['create']);router[_0x191a('0x10')](_0x191a('0xb'),auth[_0x191a('0xa')](),controller[_0x191a('0x11')]);router['delete'](_0x191a('0xb'),auth[_0x191a('0xa')](),controller['destroy']);module[_0x191a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 0584957..3848eb3 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 _0xb90b=['exports'];(function(_0x175f1b,_0x1a7de0){var _0x2da79a=function(_0x9a0ed7){while(--_0x9a0ed7){_0x175f1b['push'](_0x175f1b['shift']());}};_0x2da79a(++_0x1a7de0);}(_0xb90b,0xa3));var _0xbb90=function(_0x24f5ac,_0x3e7b58){_0x24f5ac=_0x24f5ac-0x0;var _0x4d5b81=_0xb90b[_0x24f5ac];return _0x4d5b81;};'use strict';var Sequelize=require('sequelize');module[_0xbb90('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5508=['exports','STRING','sequelize'];(function(_0x41c49e,_0x21640f){var _0x19ea20=function(_0x52b34a){while(--_0x52b34a){_0x41c49e['push'](_0x41c49e['shift']());}};_0x19ea20(++_0x21640f);}(_0x5508,0x7a));var _0x8550=function(_0x5d44fc,_0x2dc15a){_0x5d44fc=_0x5d44fc-0x0;var _0x16b464=_0x5508[_0x5d44fc];return _0x16b464;};'use strict';var Sequelize=require(_0x8550('0x0'));module[_0x8550('0x1')]={'name':{'type':Sequelize[_0x8550('0x2')]},'description':{'type':Sequelize[_0x8550('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index bcf2654..bdf7a35 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 _0x80b8=['../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','VtigerConfiguration','findAll','rows','catch','show','params','options','find','create','body','getFields','getSubjects','findOne','VtigerField','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3b2266,_0x4c4330){var _0x5eca33=function(_0x1782dc){while(--_0x1782dc){_0x3b2266['push'](_0x3b2266['shift']());}};_0x5eca33(++_0x4c4330);}(_0x80b8,0x175));var _0x880b=function(_0x5c6961,_0x112fb5){_0x5c6961=_0x5c6961-0x0;var _0x7fdfd4=_0x80b8[_0x5c6961];return _0x7fdfd4;};'use strict';var emlformat=require(_0x880b('0x0'));var rimraf=require('rimraf');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(_0x880b('0x6'));var sox=require('sox');var csv=require(_0x880b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x880b('0x8'));var _=require(_0x880b('0x9'));var squel=require(_0x880b('0xa'));var crypto=require('crypto');var jsforce=require(_0x880b('0xb'));var deskjs=require(_0x880b('0xc'));var toCsv=require(_0x880b('0x7'));var querystring=require(_0x880b('0xd'));var Papa=require(_0x880b('0xe'));var Redis=require(_0x880b('0xf'));var authService=require(_0x880b('0x10'));var qs=require(_0x880b('0x11'));var as=require(_0x880b('0x12'));var hardwareService=require(_0x880b('0x13'));var logger=require(_0x880b('0x14'))('api');var utils=require(_0x880b('0x15'));var config=require(_0x880b('0x16'));var licenseUtil=require(_0x880b('0x17'));var db=require(_0x880b('0x18'))['db'];function respondWithStatusCode(_0x339325,_0x360f2d){_0x360f2d=_0x360f2d||0xcc;return function(_0x2cdce9){if(_0x2cdce9){return _0x339325['sendStatus'](_0x360f2d);}return _0x339325[_0x880b('0x19')](_0x360f2d)[_0x880b('0x1a')]();};}function respondWithResult(_0x2b29bc,_0x25dcf3){_0x25dcf3=_0x25dcf3||0xc8;return function(_0x469267){if(_0x469267){return _0x2b29bc[_0x880b('0x19')](_0x25dcf3)['json'](_0x469267);}};}function respondWithFilteredResult(_0x398a1b,_0x401654){return function(_0x3a68d1){if(_0x3a68d1){var _0x54ba4b=typeof _0x401654[_0x880b('0x1b')]==='undefined'&&typeof _0x401654[_0x880b('0x1c')]===_0x880b('0x1d');var _0x1025c3=_0x3a68d1[_0x880b('0x1e')];var _0x429f54=_0x54ba4b?0x0:_0x401654['offset'];var _0x5c33b9=_0x54ba4b?_0x3a68d1['count']:_0x401654[_0x880b('0x1b')]+_0x401654[_0x880b('0x1c')];var _0x1b2eed;if(_0x5c33b9>=_0x1025c3){_0x5c33b9=_0x1025c3;_0x1b2eed=0xc8;}else{_0x1b2eed=0xce;}_0x398a1b[_0x880b('0x19')](_0x1b2eed);return _0x398a1b[_0x880b('0x1f')](_0x880b('0x20'),_0x429f54+'-'+_0x5c33b9+'/'+_0x1025c3)['json'](_0x3a68d1);}return null;};}function patchUpdates(_0x4efeaa){return function(_0xfa2a80){try{jsonpatch[_0x880b('0x21')](_0xfa2a80,_0x4efeaa,!![]);}catch(_0x1dcbfd){return BPromise[_0x880b('0x22')](_0x1dcbfd);}return _0xfa2a80['save']();};}function saveUpdates(_0x1bdedc,_0x308296){return function(_0x4f6298){if(_0x4f6298){return _0x4f6298[_0x880b('0x23')](_0x1bdedc)[_0x880b('0x24')](function(_0x12101f){return _0x12101f;});}return null;};}function removeEntity(_0x2b4ebe,_0x2db56f){return function(_0xaa45c8){if(_0xaa45c8){return _0xaa45c8[_0x880b('0x25')]()[_0x880b('0x24')](function(){_0x2b4ebe['status'](0xcc)[_0x880b('0x1a')]();});}};}function handleEntityNotFound(_0xeed1aa,_0xdaed96){return function(_0x4a1f7e){if(!_0x4a1f7e){_0xeed1aa[_0x880b('0x26')](0x194);}return _0x4a1f7e;};}function handleError(_0x5a05f3,_0x67014){_0x67014=_0x67014||0x1f4;return function(_0x239035){logger['error'](_0x239035[_0x880b('0x27')]);if(_0x239035[_0x880b('0x28')]){delete _0x239035[_0x880b('0x28')];}_0x5a05f3[_0x880b('0x19')](_0x67014)[_0x880b('0x29')](_0x239035);};}exports['index']=function(_0x1c41d7,_0x35cf93){var _0x10649b={},_0x334afc={},_0x185d9f={'count':0x0,'rows':[]};var _0x34b496=_[_0x880b('0x2a')](db['VtigerConfiguration'][_0x880b('0x2b')],function(_0x5382e4){return{'name':_0x5382e4['fieldName'],'type':_0x5382e4[_0x880b('0x2c')][_0x880b('0x2d')]};});_0x334afc[_0x880b('0x2e')]=_[_0x880b('0x2a')](_0x34b496,_0x880b('0x28'));_0x334afc[_0x880b('0x2f')]=_[_0x880b('0x30')](_0x1c41d7['query']);_0x334afc[_0x880b('0x31')]=_[_0x880b('0x32')](_0x334afc['model'],_0x334afc[_0x880b('0x2f')]);_0x10649b[_0x880b('0x33')]=_['intersection'](_0x334afc[_0x880b('0x2e')],qs['fields'](_0x1c41d7['query'][_0x880b('0x34')]));_0x10649b[_0x880b('0x33')]=_0x10649b['attributes'][_0x880b('0x35')]?_0x10649b[_0x880b('0x33')]:_0x334afc[_0x880b('0x2e')];if(!_0x1c41d7[_0x880b('0x2f')][_0x880b('0x36')](_0x880b('0x37'))){_0x10649b[_0x880b('0x1c')]=qs[_0x880b('0x1c')](_0x1c41d7[_0x880b('0x2f')][_0x880b('0x1c')]);_0x10649b[_0x880b('0x1b')]=qs[_0x880b('0x1b')](_0x1c41d7['query']['offset']);}_0x10649b[_0x880b('0x38')]=qs[_0x880b('0x39')](_0x1c41d7[_0x880b('0x2f')][_0x880b('0x39')]);_0x10649b[_0x880b('0x3a')]=qs[_0x880b('0x31')](_[_0x880b('0x3b')](_0x1c41d7[_0x880b('0x2f')],_0x334afc['filters']),_0x34b496);if(_0x1c41d7[_0x880b('0x2f')]['filter']){_0x10649b[_0x880b('0x3a')]=_[_0x880b('0x3c')](_0x10649b[_0x880b('0x3a')],{'$or':_[_0x880b('0x2a')](_0x34b496,function(_0x99fe49){if(_0x99fe49[_0x880b('0x2c')]!==_0x880b('0x3d')){var _0x9fa8fd={};_0x9fa8fd[_0x99fe49[_0x880b('0x28')]]={'$like':'%'+_0x1c41d7[_0x880b('0x2f')][_0x880b('0x3e')]+'%'};return _0x9fa8fd;}})});}_0x10649b=_[_0x880b('0x3c')]({},_0x10649b,_0x1c41d7['options']);var _0x4f4744={'where':_0x10649b['where']};return db['VtigerConfiguration'][_0x880b('0x1e')](_0x4f4744)['then'](function(_0xc73caa){_0x185d9f['count']=_0xc73caa;if(_0x1c41d7['query'][_0x880b('0x3f')]){_0x10649b[_0x880b('0x40')]=[{'all':!![]}];}return db[_0x880b('0x41')][_0x880b('0x42')](_0x10649b);})[_0x880b('0x24')](function(_0x1fafd5){_0x185d9f[_0x880b('0x43')]=_0x1fafd5;return _0x185d9f;})[_0x880b('0x24')](respondWithFilteredResult(_0x35cf93,_0x10649b))[_0x880b('0x44')](handleError(_0x35cf93,null));};exports[_0x880b('0x45')]=function(_0x13db13,_0x247efb){var _0x4a2e83={'raw':![],'where':{'id':_0x13db13[_0x880b('0x46')]['id']}},_0x267dc4={};_0x267dc4[_0x880b('0x2e')]=_[_0x880b('0x30')](db[_0x880b('0x41')][_0x880b('0x2b')]);_0x267dc4[_0x880b('0x2f')]=_[_0x880b('0x30')](_0x13db13[_0x880b('0x2f')]);_0x267dc4[_0x880b('0x31')]=_[_0x880b('0x32')](_0x267dc4[_0x880b('0x2e')],_0x267dc4[_0x880b('0x2f')]);_0x4a2e83[_0x880b('0x33')]=_[_0x880b('0x32')](_0x267dc4[_0x880b('0x2e')],qs[_0x880b('0x34')](_0x13db13[_0x880b('0x2f')]['fields']));_0x4a2e83[_0x880b('0x33')]=_0x4a2e83[_0x880b('0x33')]['length']?_0x4a2e83['attributes']:_0x267dc4[_0x880b('0x2e')];if(_0x13db13[_0x880b('0x2f')][_0x880b('0x3f')]){_0x4a2e83[_0x880b('0x40')]=[{'all':!![]}];}_0x4a2e83=_[_0x880b('0x3c')]({},_0x4a2e83,_0x13db13[_0x880b('0x47')]);return db[_0x880b('0x41')][_0x880b('0x48')](_0x4a2e83)['then'](handleEntityNotFound(_0x247efb,null))['then'](respondWithResult(_0x247efb,null))[_0x880b('0x44')](handleError(_0x247efb,null));};exports[_0x880b('0x49')]=function(_0x579743,_0x1879bd){return db[_0x880b('0x41')][_0x880b('0x49')](_0x579743['body'],{})[_0x880b('0x24')](respondWithResult(_0x1879bd,0xc9))[_0x880b('0x44')](handleError(_0x1879bd,null));};exports['update']=function(_0x3bc1cb,_0x21208d){if(_0x3bc1cb[_0x880b('0x4a')]['id']){delete _0x3bc1cb[_0x880b('0x4a')]['id'];}return db[_0x880b('0x41')][_0x880b('0x48')]({'where':{'id':_0x3bc1cb[_0x880b('0x46')]['id']}})[_0x880b('0x24')](handleEntityNotFound(_0x21208d,null))[_0x880b('0x24')](saveUpdates(_0x3bc1cb[_0x880b('0x4a')],null))['then'](respondWithResult(_0x21208d,null))['catch'](handleError(_0x21208d,null));};exports['destroy']=function(_0x4780b6,_0x4efe35){return db[_0x880b('0x41')]['find']({'where':{'id':_0x4780b6[_0x880b('0x46')]['id']}})[_0x880b('0x24')](handleEntityNotFound(_0x4efe35,null))[_0x880b('0x24')](removeEntity(_0x4efe35,null))[_0x880b('0x44')](handleError(_0x4efe35,null));};exports['getFields']=function(_0x1b43a3,_0x21d133,_0x25adf9){var _0x5abfe9={};var _0x2d8692={};var _0x945a31;var _0x215aa1;return db[_0x880b('0x41')]['findOne']({'where':{'id':_0x1b43a3[_0x880b('0x46')]['id']}})[_0x880b('0x24')](handleEntityNotFound(_0x21d133,null))[_0x880b('0x24')](function(_0x25c40c){if(_0x25c40c){_0x945a31=_0x25c40c;_0x2d8692[_0x880b('0x2e')]=_['keys'](db['VtigerField'][_0x880b('0x2b')]);_0x2d8692[_0x880b('0x2f')]=_[_0x880b('0x30')](_0x1b43a3[_0x880b('0x2f')]);_0x2d8692[_0x880b('0x31')]=_[_0x880b('0x32')](_0x2d8692[_0x880b('0x2e')],_0x2d8692[_0x880b('0x2f')]);_0x5abfe9[_0x880b('0x33')]=_[_0x880b('0x32')](_0x2d8692['model'],qs[_0x880b('0x34')](_0x1b43a3[_0x880b('0x2f')][_0x880b('0x34')]));_0x5abfe9[_0x880b('0x33')]=_0x5abfe9[_0x880b('0x33')][_0x880b('0x35')]?_0x5abfe9['attributes']:_0x2d8692['model'];_0x5abfe9['order']=qs[_0x880b('0x39')](_0x1b43a3[_0x880b('0x2f')][_0x880b('0x39')]);_0x5abfe9[_0x880b('0x3a')]=qs[_0x880b('0x31')](_[_0x880b('0x3b')](_0x1b43a3[_0x880b('0x2f')],_0x2d8692[_0x880b('0x31')]));if(_0x1b43a3[_0x880b('0x2f')][_0x880b('0x3e')]){_0x5abfe9['where']=_[_0x880b('0x3c')](_0x5abfe9[_0x880b('0x3a')],{'$or':_[_0x880b('0x2a')](_0x5abfe9['attributes'],function(_0x2302a6){var _0x4d7b37={};_0x4d7b37[_0x2302a6]={'$like':'%'+_0x1b43a3[_0x880b('0x2f')][_0x880b('0x3e')]+'%'};return _0x4d7b37;})});}_0x5abfe9=_[_0x880b('0x3c')]({},_0x5abfe9,_0x1b43a3[_0x880b('0x47')]);return _0x945a31['getFields'](_0x5abfe9);}})[_0x880b('0x24')](function(_0x39fe9a){if(_0x39fe9a){_0x215aa1=_0x39fe9a[_0x880b('0x35')];if(!_0x1b43a3['query'][_0x880b('0x36')](_0x880b('0x37'))){_0x5abfe9['limit']=qs[_0x880b('0x1c')](_0x1b43a3[_0x880b('0x2f')]['limit']);_0x5abfe9[_0x880b('0x1b')]=qs[_0x880b('0x1b')](_0x1b43a3['query'][_0x880b('0x1b')]);}return _0x945a31[_0x880b('0x4b')](_0x5abfe9);}})[_0x880b('0x24')](function(_0x3d9beb){if(_0x3d9beb){return _0x3d9beb?{'count':_0x215aa1,'rows':_0x3d9beb}:null;}})['then'](respondWithResult(_0x21d133,null))[_0x880b('0x44')](handleError(_0x21d133,null));};exports[_0x880b('0x4c')]=function(_0x19f83d,_0x674682,_0x13a7c6){var _0x273e27={};var _0x46cdb7={};var _0x5224e1;var _0x255626;return db['VtigerConfiguration'][_0x880b('0x4d')]({'where':{'id':_0x19f83d[_0x880b('0x46')]['id']}})[_0x880b('0x24')](handleEntityNotFound(_0x674682,null))[_0x880b('0x24')](function(_0x403a53){if(_0x403a53){_0x5224e1=_0x403a53;_0x46cdb7['model']=_['keys'](db['VtigerField'][_0x880b('0x2b')]);_0x46cdb7[_0x880b('0x2f')]=_[_0x880b('0x30')](_0x19f83d[_0x880b('0x2f')]);_0x46cdb7[_0x880b('0x31')]=_[_0x880b('0x32')](_0x46cdb7[_0x880b('0x2e')],_0x46cdb7[_0x880b('0x2f')]);_0x273e27[_0x880b('0x33')]=_[_0x880b('0x32')](_0x46cdb7['model'],qs[_0x880b('0x34')](_0x19f83d[_0x880b('0x2f')][_0x880b('0x34')]));_0x273e27[_0x880b('0x33')]=_0x273e27[_0x880b('0x33')][_0x880b('0x35')]?_0x273e27[_0x880b('0x33')]:_0x46cdb7[_0x880b('0x2e')];_0x273e27[_0x880b('0x38')]=qs[_0x880b('0x39')](_0x19f83d[_0x880b('0x2f')][_0x880b('0x39')]);_0x273e27[_0x880b('0x3a')]=qs[_0x880b('0x31')](_[_0x880b('0x3b')](_0x19f83d[_0x880b('0x2f')],_0x46cdb7['filters']));if(_0x19f83d[_0x880b('0x2f')][_0x880b('0x3e')]){_0x273e27[_0x880b('0x3a')]=_['merge'](_0x273e27[_0x880b('0x3a')],{'$or':_[_0x880b('0x2a')](_0x273e27[_0x880b('0x33')],function(_0x173dbc){var _0x1fa037={};_0x1fa037[_0x173dbc]={'$like':'%'+_0x19f83d[_0x880b('0x2f')]['filter']+'%'};return _0x1fa037;})});}_0x273e27=_['merge']({},_0x273e27,_0x19f83d['options']);return _0x5224e1[_0x880b('0x4c')](_0x273e27);}})[_0x880b('0x24')](function(_0xb6e651){if(_0xb6e651){_0x255626=_0xb6e651[_0x880b('0x35')];if(!_0x19f83d[_0x880b('0x2f')][_0x880b('0x36')](_0x880b('0x37'))){_0x273e27[_0x880b('0x1c')]=qs[_0x880b('0x1c')](_0x19f83d[_0x880b('0x2f')][_0x880b('0x1c')]);_0x273e27[_0x880b('0x1b')]=qs[_0x880b('0x1b')](_0x19f83d['query'][_0x880b('0x1b')]);}return _0x5224e1[_0x880b('0x4c')](_0x273e27);}})[_0x880b('0x24')](function(_0x3961bb){if(_0x3961bb){return _0x3961bb?{'count':_0x255626,'rows':_0x3961bb}:null;}})[_0x880b('0x24')](respondWithResult(_0x674682,null))['catch'](handleError(_0x674682,null));};exports['getDescriptions']=function(_0x5ef941,_0x369ac4,_0x93f7fd){var _0x2eac32={};var _0x1e9576={};var _0x3184a3;var _0x30790c;return db[_0x880b('0x41')][_0x880b('0x4d')]({'where':{'id':_0x5ef941[_0x880b('0x46')]['id']}})['then'](handleEntityNotFound(_0x369ac4,null))['then'](function(_0x4125c4){if(_0x4125c4){_0x3184a3=_0x4125c4;_0x1e9576[_0x880b('0x2e')]=_['keys'](db[_0x880b('0x4e')]['rawAttributes']);_0x1e9576[_0x880b('0x2f')]=_['keys'](_0x5ef941[_0x880b('0x2f')]);_0x1e9576[_0x880b('0x31')]=_[_0x880b('0x32')](_0x1e9576[_0x880b('0x2e')],_0x1e9576[_0x880b('0x2f')]);_0x2eac32[_0x880b('0x33')]=_['intersection'](_0x1e9576['model'],qs[_0x880b('0x34')](_0x5ef941[_0x880b('0x2f')][_0x880b('0x34')]));_0x2eac32['attributes']=_0x2eac32[_0x880b('0x33')][_0x880b('0x35')]?_0x2eac32['attributes']:_0x1e9576[_0x880b('0x2e')];_0x2eac32['order']=qs['sort'](_0x5ef941['query']['sort']);_0x2eac32[_0x880b('0x3a')]=qs[_0x880b('0x31')](_[_0x880b('0x3b')](_0x5ef941[_0x880b('0x2f')],_0x1e9576[_0x880b('0x31')]));if(_0x5ef941[_0x880b('0x2f')][_0x880b('0x3e')]){_0x2eac32['where']=_[_0x880b('0x3c')](_0x2eac32[_0x880b('0x3a')],{'$or':_[_0x880b('0x2a')](_0x2eac32[_0x880b('0x33')],function(_0x3b6b28){var _0x67a308={};_0x67a308[_0x3b6b28]={'$like':'%'+_0x5ef941[_0x880b('0x2f')][_0x880b('0x3e')]+'%'};return _0x67a308;})});}_0x2eac32=_[_0x880b('0x3c')]({},_0x2eac32,_0x5ef941[_0x880b('0x47')]);return _0x3184a3['getDescriptions'](_0x2eac32);}})[_0x880b('0x24')](function(_0x3639ca){if(_0x3639ca){_0x30790c=_0x3639ca[_0x880b('0x35')];if(!_0x5ef941[_0x880b('0x2f')][_0x880b('0x36')](_0x880b('0x37'))){_0x2eac32[_0x880b('0x1c')]=qs[_0x880b('0x1c')](_0x5ef941[_0x880b('0x2f')][_0x880b('0x1c')]);_0x2eac32[_0x880b('0x1b')]=qs[_0x880b('0x1b')](_0x5ef941[_0x880b('0x2f')][_0x880b('0x1b')]);}return _0x3184a3['getDescriptions'](_0x2eac32);}})[_0x880b('0x24')](function(_0x492d07){if(_0x492d07){return _0x492d07?{'count':_0x30790c,'rows':_0x492d07}:null;}})[_0x880b('0x24')](respondWithResult(_0x369ac4,null))[_0x880b('0x44')](handleError(_0x369ac4,null));}; \ No newline at end of file +var _0xdecb=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','merge','type','VIRTUAL','options','where','VtigerConfiguration','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x50c0cb,_0x38fc04){var _0x515dcb=function(_0x3e2be3){while(--_0x3e2be3){_0x50c0cb['push'](_0x50c0cb['shift']());}};_0x515dcb(++_0x38fc04);}(_0xdecb,0x8f));var _0xbdec=function(_0x34bbb2,_0x3d6603){_0x34bbb2=_0x34bbb2-0x0;var _0x56af0c=_0xdecb[_0x34bbb2];return _0x56af0c;};'use strict';var emlformat=require(_0xbdec('0x0'));var rimraf=require(_0xbdec('0x1'));var zipdir=require(_0xbdec('0x2'));var jsonpatch=require(_0xbdec('0x3'));var rp=require('request-promise');var moment=require(_0xbdec('0x4'));var BPromise=require(_0xbdec('0x5'));var Mustache=require(_0xbdec('0x6'));var util=require(_0xbdec('0x7'));var path=require(_0xbdec('0x8'));var sox=require(_0xbdec('0x9'));var csv=require(_0xbdec('0xa'));var ejs=require(_0xbdec('0xb'));var fs=require('fs');var fs_extra=require(_0xbdec('0xc'));var _=require(_0xbdec('0xd'));var squel=require(_0xbdec('0xe'));var crypto=require(_0xbdec('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbdec('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbdec('0x11'));var Papa=require(_0xbdec('0x12'));var Redis=require(_0xbdec('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbdec('0x14'));var hardwareService=require(_0xbdec('0x15'));var logger=require(_0xbdec('0x16'))(_0xbdec('0x17'));var utils=require(_0xbdec('0x18'));var config=require(_0xbdec('0x19'));var licenseUtil=require(_0xbdec('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388a70,_0x284be8){_0x284be8=_0x284be8||0xcc;return function(_0x2b64e1){if(_0x2b64e1){return _0x388a70['sendStatus'](_0x284be8);}return _0x388a70[_0xbdec('0x1b')](_0x284be8)[_0xbdec('0x1c')]();};}function respondWithResult(_0x119ff6,_0x41c7c6){_0x41c7c6=_0x41c7c6||0xc8;return function(_0x476097){if(_0x476097){return _0x119ff6[_0xbdec('0x1b')](_0x41c7c6)[_0xbdec('0x1d')](_0x476097);}};}function respondWithFilteredResult(_0x4b1f3e,_0x22688d){return function(_0x33537f){if(_0x33537f){var _0x1b78bd=typeof _0x22688d[_0xbdec('0x1e')]===_0xbdec('0x1f')&&typeof _0x22688d[_0xbdec('0x20')]==='undefined';var _0x14da3b=_0x33537f['count'];var _0x5c7fa9=_0x1b78bd?0x0:_0x22688d[_0xbdec('0x1e')];var _0x20b217=_0x1b78bd?_0x33537f[_0xbdec('0x21')]:_0x22688d[_0xbdec('0x1e')]+_0x22688d['limit'];var _0x2e6117;if(_0x20b217>=_0x14da3b){_0x20b217=_0x14da3b;_0x2e6117=0xc8;}else{_0x2e6117=0xce;}_0x4b1f3e[_0xbdec('0x1b')](_0x2e6117);return _0x4b1f3e[_0xbdec('0x22')]('Content-Range',_0x5c7fa9+'-'+_0x20b217+'/'+_0x14da3b)['json'](_0x33537f);}return null;};}function patchUpdates(_0x1a9ac9){return function(_0x564a62){try{jsonpatch[_0xbdec('0x23')](_0x564a62,_0x1a9ac9,!![]);}catch(_0x8c902a){return BPromise['reject'](_0x8c902a);}return _0x564a62['save']();};}function saveUpdates(_0xac378c,_0x5543fc){return function(_0x2637d2){if(_0x2637d2){return _0x2637d2[_0xbdec('0x24')](_0xac378c)['then'](function(_0x1412d3){return _0x1412d3;});}return null;};}function removeEntity(_0x57c839,_0x31930a){return function(_0x46dab1){if(_0x46dab1){return _0x46dab1[_0xbdec('0x25')]()[_0xbdec('0x26')](function(){_0x57c839['status'](0xcc)[_0xbdec('0x1c')]();});}};}function handleEntityNotFound(_0x14da33,_0x3e3560){return function(_0x1bfa41){if(!_0x1bfa41){_0x14da33[_0xbdec('0x27')](0x194);}return _0x1bfa41;};}function handleError(_0x1e8b78,_0xc2db0){_0xc2db0=_0xc2db0||0x1f4;return function(_0x44b32f){logger[_0xbdec('0x28')](_0x44b32f[_0xbdec('0x29')]);if(_0x44b32f[_0xbdec('0x2a')]){delete _0x44b32f['name'];}_0x1e8b78[_0xbdec('0x1b')](_0xc2db0)[_0xbdec('0x2b')](_0x44b32f);};}exports[_0xbdec('0x2c')]=function(_0x415164,_0xb48518){var _0x9586e1={},_0x34476f={},_0x498647={'count':0x0,'rows':[]};var _0x1126c8=_[_0xbdec('0x2d')](db['VtigerConfiguration'][_0xbdec('0x2e')],function(_0x485b49){return{'name':_0x485b49[_0xbdec('0x2f')],'type':_0x485b49['type'][_0xbdec('0x30')]};});_0x34476f[_0xbdec('0x31')]=_[_0xbdec('0x2d')](_0x1126c8,_0xbdec('0x2a'));_0x34476f['query']=_[_0xbdec('0x32')](_0x415164[_0xbdec('0x33')]);_0x34476f['filters']=_[_0xbdec('0x34')](_0x34476f[_0xbdec('0x31')],_0x34476f['query']);_0x9586e1['attributes']=_[_0xbdec('0x34')](_0x34476f[_0xbdec('0x31')],qs[_0xbdec('0x35')](_0x415164[_0xbdec('0x33')][_0xbdec('0x35')]));_0x9586e1[_0xbdec('0x36')]=_0x9586e1[_0xbdec('0x36')][_0xbdec('0x37')]?_0x9586e1[_0xbdec('0x36')]:_0x34476f['model'];if(!_0x415164[_0xbdec('0x33')][_0xbdec('0x38')]('nolimit')){_0x9586e1['limit']=qs[_0xbdec('0x20')](_0x415164[_0xbdec('0x33')][_0xbdec('0x20')]);_0x9586e1['offset']=qs[_0xbdec('0x1e')](_0x415164[_0xbdec('0x33')]['offset']);}_0x9586e1[_0xbdec('0x39')]=qs[_0xbdec('0x3a')](_0x415164[_0xbdec('0x33')][_0xbdec('0x3a')]);_0x9586e1['where']=qs[_0xbdec('0x3b')](_[_0xbdec('0x3c')](_0x415164['query'],_0x34476f['filters']),_0x1126c8);if(_0x415164[_0xbdec('0x33')][_0xbdec('0x3d')]){_0x9586e1['where']=_[_0xbdec('0x3e')](_0x9586e1['where'],{'$or':_[_0xbdec('0x2d')](_0x1126c8,function(_0x433caf){if(_0x433caf[_0xbdec('0x3f')]!==_0xbdec('0x40')){var _0x4a7135={};_0x4a7135[_0x433caf['name']]={'$like':'%'+_0x415164['query'][_0xbdec('0x3d')]+'%'};return _0x4a7135;}})});}_0x9586e1=_[_0xbdec('0x3e')]({},_0x9586e1,_0x415164[_0xbdec('0x41')]);var _0x443607={'where':_0x9586e1[_0xbdec('0x42')]};return db[_0xbdec('0x43')]['count'](_0x443607)[_0xbdec('0x26')](function(_0x5366c1){_0x498647[_0xbdec('0x21')]=_0x5366c1;if(_0x415164[_0xbdec('0x33')]['includeAll']){_0x9586e1[_0xbdec('0x44')]=[{'all':!![]}];}return db[_0xbdec('0x43')][_0xbdec('0x45')](_0x9586e1);})[_0xbdec('0x26')](function(_0x5c9856){_0x498647[_0xbdec('0x46')]=_0x5c9856;return _0x498647;})[_0xbdec('0x26')](respondWithFilteredResult(_0xb48518,_0x9586e1))[_0xbdec('0x47')](handleError(_0xb48518,null));};exports[_0xbdec('0x48')]=function(_0x21703b,_0x5ce7c2){var _0x3e8822={'raw':![],'where':{'id':_0x21703b[_0xbdec('0x49')]['id']}},_0x57f22b={};_0x57f22b['model']=_['keys'](db['VtigerConfiguration'][_0xbdec('0x2e')]);_0x57f22b[_0xbdec('0x33')]=_[_0xbdec('0x32')](_0x21703b['query']);_0x57f22b[_0xbdec('0x3b')]=_[_0xbdec('0x34')](_0x57f22b['model'],_0x57f22b[_0xbdec('0x33')]);_0x3e8822['attributes']=_[_0xbdec('0x34')](_0x57f22b['model'],qs[_0xbdec('0x35')](_0x21703b['query'][_0xbdec('0x35')]));_0x3e8822[_0xbdec('0x36')]=_0x3e8822['attributes']['length']?_0x3e8822[_0xbdec('0x36')]:_0x57f22b['model'];if(_0x21703b[_0xbdec('0x33')][_0xbdec('0x4a')]){_0x3e8822[_0xbdec('0x44')]=[{'all':!![]}];}_0x3e8822=_[_0xbdec('0x3e')]({},_0x3e8822,_0x21703b[_0xbdec('0x41')]);return db[_0xbdec('0x43')][_0xbdec('0x4b')](_0x3e8822)[_0xbdec('0x26')](handleEntityNotFound(_0x5ce7c2,null))[_0xbdec('0x26')](respondWithResult(_0x5ce7c2,null))[_0xbdec('0x47')](handleError(_0x5ce7c2,null));};exports['create']=function(_0x1385a6,_0x120fd8){return db[_0xbdec('0x43')][_0xbdec('0x4c')](_0x1385a6['body'],{})[_0xbdec('0x26')](respondWithResult(_0x120fd8,0xc9))[_0xbdec('0x47')](handleError(_0x120fd8,null));};exports[_0xbdec('0x24')]=function(_0x39689d,_0x44dce3){if(_0x39689d[_0xbdec('0x4d')]['id']){delete _0x39689d[_0xbdec('0x4d')]['id'];}return db[_0xbdec('0x43')][_0xbdec('0x4b')]({'where':{'id':_0x39689d[_0xbdec('0x49')]['id']}})[_0xbdec('0x26')](handleEntityNotFound(_0x44dce3,null))[_0xbdec('0x26')](saveUpdates(_0x39689d[_0xbdec('0x4d')],null))['then'](respondWithResult(_0x44dce3,null))[_0xbdec('0x47')](handleError(_0x44dce3,null));};exports['destroy']=function(_0xd65530,_0x3acfd7){return db[_0xbdec('0x43')][_0xbdec('0x4b')]({'where':{'id':_0xd65530['params']['id']}})[_0xbdec('0x26')](handleEntityNotFound(_0x3acfd7,null))[_0xbdec('0x26')](removeEntity(_0x3acfd7,null))['catch'](handleError(_0x3acfd7,null));};exports[_0xbdec('0x4e')]=function(_0x2da76e,_0x2add87,_0x3ba854){var _0x51e269={};var _0x167568={};var _0x28dd39;var _0x560395;return db['VtigerConfiguration'][_0xbdec('0x4f')]({'where':{'id':_0x2da76e[_0xbdec('0x49')]['id']}})[_0xbdec('0x26')](handleEntityNotFound(_0x2add87,null))[_0xbdec('0x26')](function(_0x27a642){if(_0x27a642){_0x28dd39=_0x27a642;_0x167568[_0xbdec('0x31')]=_[_0xbdec('0x32')](db[_0xbdec('0x50')][_0xbdec('0x2e')]);_0x167568['query']=_['keys'](_0x2da76e[_0xbdec('0x33')]);_0x167568['filters']=_[_0xbdec('0x34')](_0x167568[_0xbdec('0x31')],_0x167568['query']);_0x51e269[_0xbdec('0x36')]=_['intersection'](_0x167568['model'],qs['fields'](_0x2da76e[_0xbdec('0x33')][_0xbdec('0x35')]));_0x51e269[_0xbdec('0x36')]=_0x51e269[_0xbdec('0x36')]['length']?_0x51e269[_0xbdec('0x36')]:_0x167568[_0xbdec('0x31')];_0x51e269['order']=qs['sort'](_0x2da76e[_0xbdec('0x33')][_0xbdec('0x3a')]);_0x51e269['where']=qs[_0xbdec('0x3b')](_[_0xbdec('0x3c')](_0x2da76e[_0xbdec('0x33')],_0x167568['filters']));if(_0x2da76e[_0xbdec('0x33')][_0xbdec('0x3d')]){_0x51e269[_0xbdec('0x42')]=_[_0xbdec('0x3e')](_0x51e269[_0xbdec('0x42')],{'$or':_[_0xbdec('0x2d')](_0x51e269[_0xbdec('0x36')],function(_0x47c365){var _0x4a121f={};_0x4a121f[_0x47c365]={'$like':'%'+_0x2da76e[_0xbdec('0x33')][_0xbdec('0x3d')]+'%'};return _0x4a121f;})});}_0x51e269=_[_0xbdec('0x3e')]({},_0x51e269,_0x2da76e['options']);return _0x28dd39['getFields'](_0x51e269);}})['then'](function(_0x3fea1a){if(_0x3fea1a){_0x560395=_0x3fea1a[_0xbdec('0x37')];if(!_0x2da76e[_0xbdec('0x33')][_0xbdec('0x38')](_0xbdec('0x51'))){_0x51e269[_0xbdec('0x20')]=qs[_0xbdec('0x20')](_0x2da76e[_0xbdec('0x33')][_0xbdec('0x20')]);_0x51e269['offset']=qs['offset'](_0x2da76e[_0xbdec('0x33')][_0xbdec('0x1e')]);}return _0x28dd39[_0xbdec('0x4e')](_0x51e269);}})[_0xbdec('0x26')](function(_0xc4521f){if(_0xc4521f){return _0xc4521f?{'count':_0x560395,'rows':_0xc4521f}:null;}})[_0xbdec('0x26')](respondWithResult(_0x2add87,null))[_0xbdec('0x47')](handleError(_0x2add87,null));};exports[_0xbdec('0x52')]=function(_0x612964,_0x50654d,_0x2426ef){var _0x44559d={};var _0x47d541={};var _0x2c6ab9;var _0x38b431;return db[_0xbdec('0x43')]['findOne']({'where':{'id':_0x612964[_0xbdec('0x49')]['id']}})[_0xbdec('0x26')](handleEntityNotFound(_0x50654d,null))['then'](function(_0x35716e){if(_0x35716e){_0x2c6ab9=_0x35716e;_0x47d541[_0xbdec('0x31')]=_[_0xbdec('0x32')](db[_0xbdec('0x50')][_0xbdec('0x2e')]);_0x47d541[_0xbdec('0x33')]=_[_0xbdec('0x32')](_0x612964[_0xbdec('0x33')]);_0x47d541[_0xbdec('0x3b')]=_[_0xbdec('0x34')](_0x47d541[_0xbdec('0x31')],_0x47d541[_0xbdec('0x33')]);_0x44559d['attributes']=_[_0xbdec('0x34')](_0x47d541[_0xbdec('0x31')],qs['fields'](_0x612964[_0xbdec('0x33')][_0xbdec('0x35')]));_0x44559d[_0xbdec('0x36')]=_0x44559d[_0xbdec('0x36')][_0xbdec('0x37')]?_0x44559d[_0xbdec('0x36')]:_0x47d541[_0xbdec('0x31')];_0x44559d[_0xbdec('0x39')]=qs[_0xbdec('0x3a')](_0x612964['query'][_0xbdec('0x3a')]);_0x44559d[_0xbdec('0x42')]=qs[_0xbdec('0x3b')](_[_0xbdec('0x3c')](_0x612964['query'],_0x47d541[_0xbdec('0x3b')]));if(_0x612964[_0xbdec('0x33')][_0xbdec('0x3d')]){_0x44559d[_0xbdec('0x42')]=_[_0xbdec('0x3e')](_0x44559d[_0xbdec('0x42')],{'$or':_[_0xbdec('0x2d')](_0x44559d[_0xbdec('0x36')],function(_0x591c77){var _0x1b5d4a={};_0x1b5d4a[_0x591c77]={'$like':'%'+_0x612964[_0xbdec('0x33')][_0xbdec('0x3d')]+'%'};return _0x1b5d4a;})});}_0x44559d=_[_0xbdec('0x3e')]({},_0x44559d,_0x612964[_0xbdec('0x41')]);return _0x2c6ab9[_0xbdec('0x52')](_0x44559d);}})[_0xbdec('0x26')](function(_0x197fbb){if(_0x197fbb){_0x38b431=_0x197fbb[_0xbdec('0x37')];if(!_0x612964[_0xbdec('0x33')]['hasOwnProperty'](_0xbdec('0x51'))){_0x44559d[_0xbdec('0x20')]=qs['limit'](_0x612964[_0xbdec('0x33')][_0xbdec('0x20')]);_0x44559d[_0xbdec('0x1e')]=qs[_0xbdec('0x1e')](_0x612964['query']['offset']);}return _0x2c6ab9['getSubjects'](_0x44559d);}})['then'](function(_0x4c1057){if(_0x4c1057){return _0x4c1057?{'count':_0x38b431,'rows':_0x4c1057}:null;}})[_0xbdec('0x26')](respondWithResult(_0x50654d,null))['catch'](handleError(_0x50654d,null));};exports['getDescriptions']=function(_0x310f74,_0x597191,_0xb759e7){var _0x4e0f58={};var _0x32a98d={};var _0x3c5740;var _0xa8a826;return db[_0xbdec('0x43')][_0xbdec('0x4f')]({'where':{'id':_0x310f74[_0xbdec('0x49')]['id']}})[_0xbdec('0x26')](handleEntityNotFound(_0x597191,null))[_0xbdec('0x26')](function(_0xd6bfda){if(_0xd6bfda){_0x3c5740=_0xd6bfda;_0x32a98d[_0xbdec('0x31')]=_[_0xbdec('0x32')](db['VtigerField'][_0xbdec('0x2e')]);_0x32a98d[_0xbdec('0x33')]=_[_0xbdec('0x32')](_0x310f74['query']);_0x32a98d['filters']=_[_0xbdec('0x34')](_0x32a98d[_0xbdec('0x31')],_0x32a98d[_0xbdec('0x33')]);_0x4e0f58[_0xbdec('0x36')]=_[_0xbdec('0x34')](_0x32a98d[_0xbdec('0x31')],qs[_0xbdec('0x35')](_0x310f74[_0xbdec('0x33')]['fields']));_0x4e0f58[_0xbdec('0x36')]=_0x4e0f58[_0xbdec('0x36')]['length']?_0x4e0f58[_0xbdec('0x36')]:_0x32a98d['model'];_0x4e0f58[_0xbdec('0x39')]=qs[_0xbdec('0x3a')](_0x310f74[_0xbdec('0x33')][_0xbdec('0x3a')]);_0x4e0f58[_0xbdec('0x42')]=qs[_0xbdec('0x3b')](_[_0xbdec('0x3c')](_0x310f74[_0xbdec('0x33')],_0x32a98d[_0xbdec('0x3b')]));if(_0x310f74['query']['filter']){_0x4e0f58[_0xbdec('0x42')]=_[_0xbdec('0x3e')](_0x4e0f58[_0xbdec('0x42')],{'$or':_[_0xbdec('0x2d')](_0x4e0f58['attributes'],function(_0x58e178){var _0x342e7c={};_0x342e7c[_0x58e178]={'$like':'%'+_0x310f74['query'][_0xbdec('0x3d')]+'%'};return _0x342e7c;})});}_0x4e0f58=_['merge']({},_0x4e0f58,_0x310f74[_0xbdec('0x41')]);return _0x3c5740[_0xbdec('0x53')](_0x4e0f58);}})[_0xbdec('0x26')](function(_0x5204c2){if(_0x5204c2){_0xa8a826=_0x5204c2[_0xbdec('0x37')];if(!_0x310f74[_0xbdec('0x33')]['hasOwnProperty'](_0xbdec('0x51'))){_0x4e0f58[_0xbdec('0x20')]=qs[_0xbdec('0x20')](_0x310f74[_0xbdec('0x33')]['limit']);_0x4e0f58[_0xbdec('0x1e')]=qs['offset'](_0x310f74['query'][_0xbdec('0x1e')]);}return _0x3c5740[_0xbdec('0x53')](_0x4e0f58);}})[_0xbdec('0x26')](function(_0x54d6b2){if(_0x54d6b2){return _0x54d6b2?{'count':_0xa8a826,'rows':_0x54d6b2}:null;}})[_0xbdec('0x26')](respondWithResult(_0x597191,null))[_0xbdec('0x47')](handleError(_0x597191,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index a49333c..937b0ee 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 _0x6f94=['VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x4ad53f,_0x575459){var _0x9d7b9d=function(_0x25b9e6){while(--_0x25b9e6){_0x4ad53f['push'](_0x4ad53f['shift']());}};_0x9d7b9d(++_0x575459);}(_0x6f94,0x195));var _0x46f9=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x6f94[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x46f9('0x0'));var util=require(_0x46f9('0x1'));var logger=require(_0x46f9('0x2'))(_0x46f9('0x3'));var moment=require('moment');var BPromise=require(_0x46f9('0x4'));var rp=require(_0x46f9('0x5'));var fs=require('fs');var path=require(_0x46f9('0x6'));var rimraf=require('rimraf');var config=require(_0x46f9('0x7'));var attributes=require(_0x46f9('0x8'));module[_0x46f9('0x9')]=function(_0x24b8c8,_0x93df8b){return _0x24b8c8[_0x46f9('0xa')](_0x46f9('0xb'),attributes,{'tableName':_0x46f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c22=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x2cb98a,_0x44a386){var _0x55b013=function(_0x1cf819){while(--_0x1cf819){_0x2cb98a['push'](_0x2cb98a['shift']());}};_0x55b013(++_0x44a386);}(_0x1c22,0x134));var _0x21c2=function(_0x51c197,_0x4194a4){_0x51c197=_0x51c197-0x0;var _0x2c88ed=_0x1c22[_0x51c197];return _0x2c88ed;};'use strict';var _=require(_0x21c2('0x0'));var util=require(_0x21c2('0x1'));var logger=require(_0x21c2('0x2'))('api');var moment=require(_0x21c2('0x3'));var BPromise=require(_0x21c2('0x4'));var rp=require(_0x21c2('0x5'));var fs=require('fs');var path=require(_0x21c2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x21c2('0x7'));module['exports']=function(_0x16a074,_0x5bb277){return _0x16a074[_0x21c2('0x8')](_0x21c2('0x9'),attributes,{'tableName':_0x21c2('0xa'),'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 6b56766..c05c6a4 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 _0x231d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x231d,0x9e));var _0xd231=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x231d[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xd231('0x0'));var util=require(_0xd231('0x1'));var moment=require(_0xd231('0x2'));var BPromise=require(_0xd231('0x3'));var rs=require(_0xd231('0x4'));var fs=require('fs');var Redis=require(_0xd231('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd231('0x6'));var logger=require(_0xd231('0x7'))(_0xd231('0x8'));var config=require(_0xd231('0x9'));var jayson=require(_0xd231('0xa'));var client=jayson['client'][_0xd231('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38a66b,_0x5a6886,_0x4f83fa){return new BPromise(function(_0x2407d5,_0x271fb5){return client[_0xd231('0xc')](_0x38a66b,_0x4f83fa)[_0xd231('0xd')](function(_0x55a363){logger[_0xd231('0xe')](_0xd231('0xf'),_0x5a6886,_0xd231('0x10'));logger['debug'](_0xd231('0x11'),_0x5a6886,_0xd231('0x10'),JSON['stringify'](_0x55a363));if(_0x55a363['error']){if(_0x55a363['error'][_0xd231('0x12')]===0x1f4){logger[_0xd231('0x13')](_0xd231('0xf'),_0x5a6886,_0x55a363[_0xd231('0x13')][_0xd231('0x14')]);return _0x271fb5(_0x55a363[_0xd231('0x13')]['message']);}logger[_0xd231('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x5a6886,_0x55a363[_0xd231('0x13')][_0xd231('0x14')]);return _0x2407d5(_0x55a363[_0xd231('0x13')][_0xd231('0x14')]);}else{logger[_0xd231('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x5a6886,_0xd231('0x10'));_0x2407d5(_0x55a363[_0xd231('0x15')][_0xd231('0x14')]);}})[_0xd231('0x16')](function(_0x46357b){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x5a6886,_0x46357b);_0x271fb5(_0x46357b);});});} \ No newline at end of file +var _0xf9a1=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4f044a,_0x8c8ca1){var _0x1638d3=function(_0x5f2e1d){while(--_0x5f2e1d){_0x4f044a['push'](_0x4f044a['shift']());}};_0x1638d3(++_0x8c8ca1);}(_0xf9a1,0x18e));var _0x1f9a=function(_0x308163,_0x55d0b4){_0x308163=_0x308163-0x0;var _0x4d5b2d=_0xf9a1[_0x308163];return _0x4d5b2d;};'use strict';var _=require('lodash');var util=require(_0x1f9a('0x0'));var moment=require(_0x1f9a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f9a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f9a('0x3'))(_0x1f9a('0x4'));var config=require('../../config/environment');var jayson=require(_0x1f9a('0x5'));var client=jayson[_0x1f9a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x280121,_0x4e3340,_0x200565){return new BPromise(function(_0x54fd5b,_0x1e9fc3){return client['request'](_0x280121,_0x200565)[_0x1f9a('0x7')](function(_0x11b2df){logger['info'](_0x1f9a('0x8'),_0x4e3340,_0x1f9a('0x9'));logger['debug'](_0x1f9a('0xa'),_0x4e3340,_0x1f9a('0x9'),JSON['stringify'](_0x11b2df));if(_0x11b2df['error']){if(_0x11b2df[_0x1f9a('0xb')][_0x1f9a('0xc')]===0x1f4){logger[_0x1f9a('0xb')](_0x1f9a('0x8'),_0x4e3340,_0x11b2df[_0x1f9a('0xb')][_0x1f9a('0xd')]);return _0x1e9fc3(_0x11b2df[_0x1f9a('0xb')][_0x1f9a('0xd')]);}logger[_0x1f9a('0xb')](_0x1f9a('0x8'),_0x4e3340,_0x11b2df[_0x1f9a('0xb')][_0x1f9a('0xd')]);return _0x54fd5b(_0x11b2df['error'][_0x1f9a('0xd')]);}else{logger[_0x1f9a('0xe')](_0x1f9a('0x8'),_0x4e3340,_0x1f9a('0x9'));_0x54fd5b(_0x11b2df[_0x1f9a('0xf')][_0x1f9a('0xd')]);}})[_0x1f9a('0x10')](function(_0x101263){logger[_0x1f9a('0xb')](_0x1f9a('0x8'),_0x4e3340,_0x101263);_0x1e9fc3(_0x101263);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 32c7f43..0b65984 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 _0xabbd=['put','update','/:id','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','isAuthenticated','get','show','post','create'];(function(_0x14741c,_0x4892f5){var _0x1d5907=function(_0x4a34f5){while(--_0x4a34f5){_0x14741c['push'](_0x14741c['shift']());}};_0x1d5907(++_0x4892f5);}(_0xabbd,0xd3));var _0xdabb=function(_0x23576b,_0x1407c5){_0x23576b=_0x23576b-0x0;var _0x17b00d=_0xabbd[_0x23576b];return _0x17b00d;};'use strict';var multer=require(_0xdabb('0x0'));var util=require('util');var path=require(_0xdabb('0x1'));var timeout=require(_0xdabb('0x2'));var express=require('express');var router=express[_0xdabb('0x3')]();var fs_extra=require(_0xdabb('0x4'));var auth=require(_0xdabb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdabb('0x6'));var controller=require(_0xdabb('0x7'));router['get']('/',auth[_0xdabb('0x8')](),controller['index']);router[_0xdabb('0x9')]('/:id',auth[_0xdabb('0x8')](),controller[_0xdabb('0xa')]);router[_0xdabb('0xb')]('/',auth[_0xdabb('0x8')](),controller[_0xdabb('0xc')]);router[_0xdabb('0xd')]('/:id',auth[_0xdabb('0x8')](),controller[_0xdabb('0xe')]);router['delete'](_0xdabb('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8af4=['get','index','/:id','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8af4,0x1ab));var _0x48af=function(_0x5c8a11,_0x10805f){_0x5c8a11=_0x5c8a11-0x0;var _0x116b22=_0x8af4[_0x5c8a11];return _0x116b22;};'use strict';var multer=require(_0x48af('0x0'));var util=require(_0x48af('0x1'));var path=require(_0x48af('0x2'));var timeout=require(_0x48af('0x3'));var express=require(_0x48af('0x4'));var router=express[_0x48af('0x5')]();var fs_extra=require(_0x48af('0x6'));var auth=require(_0x48af('0x7'));var interaction=require(_0x48af('0x8'));var config=require('../../config/environment');var controller=require(_0x48af('0x9'));router[_0x48af('0xa')]('/',auth['isAuthenticated'](),controller[_0x48af('0xb')]);router['get'](_0x48af('0xc'),auth[_0x48af('0xd')](),controller['show']);router['post']('/',auth[_0x48af('0xd')](),controller[_0x48af('0xe')]);router[_0x48af('0xf')](_0x48af('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x48af('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x48af('0x11')]);module[_0x48af('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index ba1e486..51de34a 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 _0x831e=['STRING','ENUM','variable','BOOLEAN','sequelize','exports','customVariable','picklist','string'];(function(_0x3f1cf8,_0x373ddd){var _0x1cc8d2=function(_0x1258e6){while(--_0x1258e6){_0x3f1cf8['push'](_0x3f1cf8['shift']());}};_0x1cc8d2(++_0x373ddd);}(_0x831e,0x1d8));var _0xe831=function(_0x509a87,_0x302ed9){_0x509a87=_0x509a87-0x0;var _0x54b378=_0x831e[_0x509a87];return _0x54b378;};'use strict';var Sequelize=require(_0xe831('0x0'));module[_0xe831('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xe831('0x2'),'keyValue',_0xe831('0x3')),'defaultValue':_0xe831('0x4')},'content':{'type':Sequelize[_0xe831('0x5')]},'key':{'type':Sequelize[_0xe831('0x5')]},'keyType':{'type':Sequelize[_0xe831('0x6')](_0xe831('0x4'),_0xe831('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xe831('0x5')]},'idField':{'type':Sequelize[_0xe831('0x5')]},'nameField':{'type':Sequelize[_0xe831('0x5')]},'customField':{'type':Sequelize[_0xe831('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe831('0x5')]}}; \ No newline at end of file +var _0x9f9c=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x5f13a4,_0x2351d6){var _0x308eef=function(_0x5eb42e){while(--_0x5eb42e){_0x5f13a4['push'](_0x5f13a4['shift']());}};_0x308eef(++_0x2351d6);}(_0x9f9c,0x1d7));var _0xc9f9=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9f9c[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xc9f9('0x0'));module[_0xc9f9('0x1')]={'type':{'type':Sequelize[_0xc9f9('0x2')](_0xc9f9('0x3'),_0xc9f9('0x4'),_0xc9f9('0x5'),'keyValue','picklist'),'defaultValue':_0xc9f9('0x3')},'content':{'type':Sequelize[_0xc9f9('0x6')]},'key':{'type':Sequelize[_0xc9f9('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc9f9('0x3'),_0xc9f9('0x4'),_0xc9f9('0x5'))},'keyContent':{'type':Sequelize[_0xc9f9('0x6')]},'idField':{'type':Sequelize[_0xc9f9('0x6')]},'nameField':{'type':Sequelize[_0xc9f9('0x6')]},'customField':{'type':Sequelize[_0xc9f9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc9f9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9d736ae..996de19 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 _0xf713=['limit','offset','count','set','Content-Range','reject','save','then','destroy','error','name','index','map','VtigerField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x1457e2,_0x393b2d){var _0x2b4dee=function(_0x205d45){while(--_0x205d45){_0x1457e2['push'](_0x1457e2['shift']());}};_0x2b4dee(++_0x393b2d);}(_0xf713,0x74));var _0x3f71=function(_0x58cb21,_0x4737cc){_0x58cb21=_0x58cb21-0x0;var _0x37e679=_0xf713[_0x58cb21];return _0x37e679;};'use strict';var emlformat=require(_0x3f71('0x0'));var rimraf=require(_0x3f71('0x1'));var zipdir=require(_0x3f71('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f71('0x3'));var moment=require(_0x3f71('0x4'));var BPromise=require(_0x3f71('0x5'));var Mustache=require(_0x3f71('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3f71('0x7'));var csv=require(_0x3f71('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f71('0x9'));var squel=require('squel');var crypto=require(_0x3f71('0xa'));var jsforce=require(_0x3f71('0xb'));var deskjs=require(_0x3f71('0xc'));var toCsv=require(_0x3f71('0x8'));var querystring=require('querystring');var Papa=require(_0x3f71('0xd'));var Redis=require(_0x3f71('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3f71('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f71('0x10'));var logger=require(_0x3f71('0x11'))(_0x3f71('0x12'));var utils=require(_0x3f71('0x13'));var config=require(_0x3f71('0x14'));var licenseUtil=require(_0x3f71('0x15'));var db=require(_0x3f71('0x16'))['db'];function respondWithStatusCode(_0x8c393c,_0x573434){_0x573434=_0x573434||0xcc;return function(_0x32e3e2){if(_0x32e3e2){return _0x8c393c[_0x3f71('0x17')](_0x573434);}return _0x8c393c[_0x3f71('0x18')](_0x573434)[_0x3f71('0x19')]();};}function respondWithResult(_0x4c6fd0,_0x386f8f){_0x386f8f=_0x386f8f||0xc8;return function(_0x205c0f){if(_0x205c0f){return _0x4c6fd0[_0x3f71('0x18')](_0x386f8f)[_0x3f71('0x1a')](_0x205c0f);}};}function respondWithFilteredResult(_0x5df79d,_0x3c1e0e){return function(_0x355522){if(_0x355522){var _0xa40be5=typeof _0x3c1e0e['offset']===_0x3f71('0x1b')&&typeof _0x3c1e0e[_0x3f71('0x1c')]==='undefined';var _0x511e84=_0x355522['count'];var _0x2dd596=_0xa40be5?0x0:_0x3c1e0e[_0x3f71('0x1d')];var _0x2dcbf9=_0xa40be5?_0x355522[_0x3f71('0x1e')]:_0x3c1e0e[_0x3f71('0x1d')]+_0x3c1e0e[_0x3f71('0x1c')];var _0x66c9d;if(_0x2dcbf9>=_0x511e84){_0x2dcbf9=_0x511e84;_0x66c9d=0xc8;}else{_0x66c9d=0xce;}_0x5df79d[_0x3f71('0x18')](_0x66c9d);return _0x5df79d[_0x3f71('0x1f')](_0x3f71('0x20'),_0x2dd596+'-'+_0x2dcbf9+'/'+_0x511e84)[_0x3f71('0x1a')](_0x355522);}return null;};}function patchUpdates(_0x235e2e){return function(_0x1296ca){try{jsonpatch['apply'](_0x1296ca,_0x235e2e,!![]);}catch(_0x5b0e14){return BPromise[_0x3f71('0x21')](_0x5b0e14);}return _0x1296ca[_0x3f71('0x22')]();};}function saveUpdates(_0x1c71ba,_0x2c11e7){return function(_0x161d2a){if(_0x161d2a){return _0x161d2a['update'](_0x1c71ba)[_0x3f71('0x23')](function(_0x249241){return _0x249241;});}return null;};}function removeEntity(_0x55eb18,_0x4841ad){return function(_0x10106d){if(_0x10106d){return _0x10106d[_0x3f71('0x24')]()[_0x3f71('0x23')](function(){_0x55eb18[_0x3f71('0x18')](0xcc)[_0x3f71('0x19')]();});}};}function handleEntityNotFound(_0x47ab66,_0xb7e044){return function(_0x18b6dc){if(!_0x18b6dc){_0x47ab66[_0x3f71('0x17')](0x194);}return _0x18b6dc;};}function handleError(_0x8bba2,_0x3a01c3){_0x3a01c3=_0x3a01c3||0x1f4;return function(_0x4ff20d){logger[_0x3f71('0x25')](_0x4ff20d['stack']);if(_0x4ff20d[_0x3f71('0x26')]){delete _0x4ff20d['name'];}_0x8bba2['status'](_0x3a01c3)['send'](_0x4ff20d);};}exports[_0x3f71('0x27')]=function(_0x1862a1,_0x19e475){var _0x40a753={},_0x38bc40={},_0xe5bb1b={'count':0x0,'rows':[]};var _0x22b3dc=_[_0x3f71('0x28')](db[_0x3f71('0x29')]['rawAttributes'],function(_0x223fb8){return{'name':_0x223fb8[_0x3f71('0x2a')],'type':_0x223fb8[_0x3f71('0x2b')][_0x3f71('0x2c')]};});_0x38bc40[_0x3f71('0x2d')]=_[_0x3f71('0x28')](_0x22b3dc,_0x3f71('0x26'));_0x38bc40[_0x3f71('0x2e')]=_[_0x3f71('0x2f')](_0x1862a1[_0x3f71('0x2e')]);_0x38bc40[_0x3f71('0x30')]=_[_0x3f71('0x31')](_0x38bc40[_0x3f71('0x2d')],_0x38bc40[_0x3f71('0x2e')]);_0x40a753['attributes']=_[_0x3f71('0x31')](_0x38bc40['model'],qs[_0x3f71('0x32')](_0x1862a1['query'][_0x3f71('0x32')]));_0x40a753[_0x3f71('0x33')]=_0x40a753[_0x3f71('0x33')]['length']?_0x40a753['attributes']:_0x38bc40['model'];if(!_0x1862a1[_0x3f71('0x2e')][_0x3f71('0x34')](_0x3f71('0x35'))){_0x40a753['limit']=qs['limit'](_0x1862a1[_0x3f71('0x2e')]['limit']);_0x40a753[_0x3f71('0x1d')]=qs[_0x3f71('0x1d')](_0x1862a1['query'][_0x3f71('0x1d')]);}_0x40a753['order']=qs[_0x3f71('0x36')](_0x1862a1[_0x3f71('0x2e')]['sort']);_0x40a753['where']=qs[_0x3f71('0x30')](_[_0x3f71('0x37')](_0x1862a1['query'],_0x38bc40[_0x3f71('0x30')]),_0x22b3dc);if(_0x1862a1[_0x3f71('0x2e')]['filter']){_0x40a753[_0x3f71('0x38')]=_[_0x3f71('0x39')](_0x40a753[_0x3f71('0x38')],{'$or':_[_0x3f71('0x28')](_0x22b3dc,function(_0x3b2b05){if(_0x3b2b05[_0x3f71('0x2b')]!=='VIRTUAL'){var _0x1813d4={};_0x1813d4[_0x3b2b05[_0x3f71('0x26')]]={'$like':'%'+_0x1862a1[_0x3f71('0x2e')]['filter']+'%'};return _0x1813d4;}})});}_0x40a753=_[_0x3f71('0x39')]({},_0x40a753,_0x1862a1[_0x3f71('0x3a')]);var _0xf39aeb={'where':_0x40a753[_0x3f71('0x38')]};return db['VtigerField'][_0x3f71('0x1e')](_0xf39aeb)[_0x3f71('0x23')](function(_0x583663){_0xe5bb1b[_0x3f71('0x1e')]=_0x583663;if(_0x1862a1[_0x3f71('0x2e')][_0x3f71('0x3b')]){_0x40a753[_0x3f71('0x3c')]=[{'all':!![]}];}return db[_0x3f71('0x29')][_0x3f71('0x3d')](_0x40a753);})[_0x3f71('0x23')](function(_0x594f4d){_0xe5bb1b[_0x3f71('0x3e')]=_0x594f4d;return _0xe5bb1b;})[_0x3f71('0x23')](respondWithFilteredResult(_0x19e475,_0x40a753))[_0x3f71('0x3f')](handleError(_0x19e475,null));};exports[_0x3f71('0x40')]=function(_0x2591fa,_0x3859fb){var _0x1b6c79={'raw':!![],'where':{'id':_0x2591fa[_0x3f71('0x41')]['id']}},_0x3aba65={};_0x3aba65['model']=_[_0x3f71('0x2f')](db['VtigerField'][_0x3f71('0x42')]);_0x3aba65[_0x3f71('0x2e')]=_[_0x3f71('0x2f')](_0x2591fa[_0x3f71('0x2e')]);_0x3aba65['filters']=_[_0x3f71('0x31')](_0x3aba65['model'],_0x3aba65[_0x3f71('0x2e')]);_0x1b6c79[_0x3f71('0x33')]=_[_0x3f71('0x31')](_0x3aba65[_0x3f71('0x2d')],qs['fields'](_0x2591fa[_0x3f71('0x2e')][_0x3f71('0x32')]));_0x1b6c79[_0x3f71('0x33')]=_0x1b6c79[_0x3f71('0x33')][_0x3f71('0x43')]?_0x1b6c79[_0x3f71('0x33')]:_0x3aba65['model'];if(_0x2591fa['query'][_0x3f71('0x3b')]){_0x1b6c79[_0x3f71('0x3c')]=[{'all':!![]}];}_0x1b6c79=_[_0x3f71('0x39')]({},_0x1b6c79,_0x2591fa[_0x3f71('0x3a')]);return db[_0x3f71('0x29')][_0x3f71('0x44')](_0x1b6c79)['then'](handleEntityNotFound(_0x3859fb,null))[_0x3f71('0x23')](respondWithResult(_0x3859fb,null))[_0x3f71('0x3f')](handleError(_0x3859fb,null));};exports[_0x3f71('0x45')]=function(_0x4f6298,_0x23c442){return db[_0x3f71('0x29')][_0x3f71('0x45')](_0x4f6298[_0x3f71('0x46')],{})[_0x3f71('0x23')](respondWithResult(_0x23c442,0xc9))[_0x3f71('0x3f')](handleError(_0x23c442,null));};exports[_0x3f71('0x47')]=function(_0x4dbff6,_0x232f85){if(_0x4dbff6[_0x3f71('0x46')]['id']){delete _0x4dbff6[_0x3f71('0x46')]['id'];}return db['VtigerField'][_0x3f71('0x44')]({'where':{'id':_0x4dbff6['params']['id']}})[_0x3f71('0x23')](handleEntityNotFound(_0x232f85,null))[_0x3f71('0x23')](saveUpdates(_0x4dbff6[_0x3f71('0x46')],null))[_0x3f71('0x23')](respondWithResult(_0x232f85,null))[_0x3f71('0x3f')](handleError(_0x232f85,null));};exports[_0x3f71('0x24')]=function(_0x1b8117,_0x320af2){return db[_0x3f71('0x29')][_0x3f71('0x44')]({'where':{'id':_0x1b8117[_0x3f71('0x41')]['id']}})[_0x3f71('0x23')](handleEntityNotFound(_0x320af2,null))[_0x3f71('0x23')](removeEntity(_0x320af2,null))[_0x3f71('0x3f')](handleError(_0x320af2,null));}; \ No newline at end of file +var _0x19bd=['params','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0x19bd,0x131));var _0xd19b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x19bd[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xd19b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd19b('0x1'));var jsonpatch=require(_0xd19b('0x2'));var rp=require(_0xd19b('0x3'));var moment=require(_0xd19b('0x4'));var BPromise=require(_0xd19b('0x5'));var Mustache=require(_0xd19b('0x6'));var util=require(_0xd19b('0x7'));var path=require(_0xd19b('0x8'));var sox=require(_0xd19b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd19b('0xa'));var _=require('lodash');var squel=require(_0xd19b('0xb'));var crypto=require(_0xd19b('0xc'));var jsforce=require(_0xd19b('0xd'));var deskjs=require(_0xd19b('0xe'));var toCsv=require(_0xd19b('0xf'));var querystring=require(_0xd19b('0x10'));var Papa=require(_0xd19b('0x11'));var Redis=require('ioredis');var authService=require(_0xd19b('0x12'));var qs=require(_0xd19b('0x13'));var as=require(_0xd19b('0x14'));var hardwareService=require(_0xd19b('0x15'));var logger=require(_0xd19b('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xd19b('0x17'));var licenseUtil=require(_0xd19b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4a28,_0xe9fd9f){_0xe9fd9f=_0xe9fd9f||0xcc;return function(_0x5c9435){if(_0x5c9435){return _0x5d4a28['sendStatus'](_0xe9fd9f);}return _0x5d4a28[_0xd19b('0x19')](_0xe9fd9f)[_0xd19b('0x1a')]();};}function respondWithResult(_0x26552d,_0x5a8a17){_0x5a8a17=_0x5a8a17||0xc8;return function(_0x4b4397){if(_0x4b4397){return _0x26552d[_0xd19b('0x19')](_0x5a8a17)[_0xd19b('0x1b')](_0x4b4397);}};}function respondWithFilteredResult(_0x11ea9e,_0x3fca61){return function(_0x36b026){if(_0x36b026){var _0x1f57c1=typeof _0x3fca61['offset']===_0xd19b('0x1c')&&typeof _0x3fca61[_0xd19b('0x1d')]==='undefined';var _0x108a8c=_0x36b026[_0xd19b('0x1e')];var _0xad88d7=_0x1f57c1?0x0:_0x3fca61[_0xd19b('0x1f')];var _0x5efb8b=_0x1f57c1?_0x36b026[_0xd19b('0x1e')]:_0x3fca61[_0xd19b('0x1f')]+_0x3fca61['limit'];var _0x51d924;if(_0x5efb8b>=_0x108a8c){_0x5efb8b=_0x108a8c;_0x51d924=0xc8;}else{_0x51d924=0xce;}_0x11ea9e[_0xd19b('0x19')](_0x51d924);return _0x11ea9e[_0xd19b('0x20')](_0xd19b('0x21'),_0xad88d7+'-'+_0x5efb8b+'/'+_0x108a8c)[_0xd19b('0x1b')](_0x36b026);}return null;};}function patchUpdates(_0x36674f){return function(_0x4416c4){try{jsonpatch[_0xd19b('0x22')](_0x4416c4,_0x36674f,!![]);}catch(_0x456c66){return BPromise[_0xd19b('0x23')](_0x456c66);}return _0x4416c4['save']();};}function saveUpdates(_0x28567d,_0x3e571b){return function(_0x4e1803){if(_0x4e1803){return _0x4e1803[_0xd19b('0x24')](_0x28567d)[_0xd19b('0x25')](function(_0x1126f6){return _0x1126f6;});}return null;};}function removeEntity(_0x194606,_0x9d99c3){return function(_0x36afe6){if(_0x36afe6){return _0x36afe6[_0xd19b('0x26')]()[_0xd19b('0x25')](function(){_0x194606['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3529d8,_0x3bdc9e){return function(_0x242ca1){if(!_0x242ca1){_0x3529d8['sendStatus'](0x194);}return _0x242ca1;};}function handleError(_0xeaee49,_0x3bb9bd){_0x3bb9bd=_0x3bb9bd||0x1f4;return function(_0x203293){logger['error'](_0x203293[_0xd19b('0x27')]);if(_0x203293[_0xd19b('0x28')]){delete _0x203293[_0xd19b('0x28')];}_0xeaee49['status'](_0x3bb9bd)[_0xd19b('0x29')](_0x203293);};}exports[_0xd19b('0x2a')]=function(_0x7c291,_0x50ccc6){var _0x2e2af6={},_0x3b611c={},_0x431b0a={'count':0x0,'rows':[]};var _0x361c53=_['map'](db[_0xd19b('0x2b')][_0xd19b('0x2c')],function(_0x5bffe7){return{'name':_0x5bffe7[_0xd19b('0x2d')],'type':_0x5bffe7[_0xd19b('0x2e')][_0xd19b('0x2f')]};});_0x3b611c[_0xd19b('0x30')]=_[_0xd19b('0x31')](_0x361c53,_0xd19b('0x28'));_0x3b611c[_0xd19b('0x32')]=_['keys'](_0x7c291[_0xd19b('0x32')]);_0x3b611c[_0xd19b('0x33')]=_[_0xd19b('0x34')](_0x3b611c[_0xd19b('0x30')],_0x3b611c[_0xd19b('0x32')]);_0x2e2af6[_0xd19b('0x35')]=_[_0xd19b('0x34')](_0x3b611c[_0xd19b('0x30')],qs[_0xd19b('0x36')](_0x7c291[_0xd19b('0x32')][_0xd19b('0x36')]));_0x2e2af6[_0xd19b('0x35')]=_0x2e2af6['attributes'][_0xd19b('0x37')]?_0x2e2af6[_0xd19b('0x35')]:_0x3b611c[_0xd19b('0x30')];if(!_0x7c291[_0xd19b('0x32')][_0xd19b('0x38')](_0xd19b('0x39'))){_0x2e2af6[_0xd19b('0x1d')]=qs[_0xd19b('0x1d')](_0x7c291[_0xd19b('0x32')][_0xd19b('0x1d')]);_0x2e2af6[_0xd19b('0x1f')]=qs[_0xd19b('0x1f')](_0x7c291[_0xd19b('0x32')]['offset']);}_0x2e2af6['order']=qs[_0xd19b('0x3a')](_0x7c291['query']['sort']);_0x2e2af6[_0xd19b('0x3b')]=qs[_0xd19b('0x33')](_[_0xd19b('0x3c')](_0x7c291[_0xd19b('0x32')],_0x3b611c[_0xd19b('0x33')]),_0x361c53);if(_0x7c291[_0xd19b('0x32')][_0xd19b('0x3d')]){_0x2e2af6['where']=_[_0xd19b('0x3e')](_0x2e2af6[_0xd19b('0x3b')],{'$or':_[_0xd19b('0x31')](_0x361c53,function(_0x2427bd){if(_0x2427bd[_0xd19b('0x2e')]!==_0xd19b('0x3f')){var _0x32947a={};_0x32947a[_0x2427bd[_0xd19b('0x28')]]={'$like':'%'+_0x7c291['query'][_0xd19b('0x3d')]+'%'};return _0x32947a;}})});}_0x2e2af6=_[_0xd19b('0x3e')]({},_0x2e2af6,_0x7c291[_0xd19b('0x40')]);var _0x818ed0={'where':_0x2e2af6[_0xd19b('0x3b')]};return db['VtigerField'][_0xd19b('0x1e')](_0x818ed0)[_0xd19b('0x25')](function(_0x4e5fa5){_0x431b0a[_0xd19b('0x1e')]=_0x4e5fa5;if(_0x7c291[_0xd19b('0x32')][_0xd19b('0x41')]){_0x2e2af6['include']=[{'all':!![]}];}return db['VtigerField'][_0xd19b('0x42')](_0x2e2af6);})[_0xd19b('0x25')](function(_0x3b73ed){_0x431b0a[_0xd19b('0x43')]=_0x3b73ed;return _0x431b0a;})['then'](respondWithFilteredResult(_0x50ccc6,_0x2e2af6))[_0xd19b('0x44')](handleError(_0x50ccc6,null));};exports[_0xd19b('0x45')]=function(_0x3049ae,_0x5c3763){var _0x4f5030={'raw':!![],'where':{'id':_0x3049ae[_0xd19b('0x46')]['id']}},_0x532a86={};_0x532a86['model']=_['keys'](db['VtigerField'][_0xd19b('0x2c')]);_0x532a86[_0xd19b('0x32')]=_['keys'](_0x3049ae[_0xd19b('0x32')]);_0x532a86[_0xd19b('0x33')]=_[_0xd19b('0x34')](_0x532a86[_0xd19b('0x30')],_0x532a86[_0xd19b('0x32')]);_0x4f5030[_0xd19b('0x35')]=_['intersection'](_0x532a86[_0xd19b('0x30')],qs[_0xd19b('0x36')](_0x3049ae['query'][_0xd19b('0x36')]));_0x4f5030[_0xd19b('0x35')]=_0x4f5030[_0xd19b('0x35')][_0xd19b('0x37')]?_0x4f5030[_0xd19b('0x35')]:_0x532a86[_0xd19b('0x30')];if(_0x3049ae[_0xd19b('0x32')][_0xd19b('0x41')]){_0x4f5030[_0xd19b('0x47')]=[{'all':!![]}];}_0x4f5030=_[_0xd19b('0x3e')]({},_0x4f5030,_0x3049ae[_0xd19b('0x40')]);return db[_0xd19b('0x2b')][_0xd19b('0x48')](_0x4f5030)[_0xd19b('0x25')](handleEntityNotFound(_0x5c3763,null))[_0xd19b('0x25')](respondWithResult(_0x5c3763,null))['catch'](handleError(_0x5c3763,null));};exports['create']=function(_0x10475f,_0x1bca3d){return db[_0xd19b('0x2b')][_0xd19b('0x49')](_0x10475f[_0xd19b('0x4a')],{})[_0xd19b('0x25')](respondWithResult(_0x1bca3d,0xc9))['catch'](handleError(_0x1bca3d,null));};exports['update']=function(_0xd73709,_0x355cc8){if(_0xd73709[_0xd19b('0x4a')]['id']){delete _0xd73709[_0xd19b('0x4a')]['id'];}return db['VtigerField']['find']({'where':{'id':_0xd73709[_0xd19b('0x46')]['id']}})[_0xd19b('0x25')](handleEntityNotFound(_0x355cc8,null))[_0xd19b('0x25')](saveUpdates(_0xd73709['body'],null))[_0xd19b('0x25')](respondWithResult(_0x355cc8,null))['catch'](handleError(_0x355cc8,null));};exports[_0xd19b('0x26')]=function(_0x1b4e26,_0x5a82e7){return db[_0xd19b('0x2b')][_0xd19b('0x48')]({'where':{'id':_0x1b4e26['params']['id']}})['then'](handleEntityNotFound(_0x5a82e7,null))[_0xd19b('0x25')](removeEntity(_0x5a82e7,null))[_0xd19b('0x44')](handleError(_0x5a82e7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 696c9de..22fb0bd 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 _0x3866=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3866,0x16b));var _0x6386=function(_0x396308,_0x197a90){_0x396308=_0x396308-0x0;var _0x40a50b=_0x3866[_0x396308];return _0x40a50b;};'use strict';var _=require(_0x6386('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6386('0x1'));var moment=require(_0x6386('0x2'));var BPromise=require(_0x6386('0x3'));var rp=require(_0x6386('0x4'));var fs=require('fs');var path=require(_0x6386('0x5'));var rimraf=require(_0x6386('0x6'));var config=require(_0x6386('0x7'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x57282c,_0x55c4d9){return _0x57282c[_0x6386('0x8')](_0x6386('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x6386('0xa'),'fields':[_0x6386('0xb'),_0x6386('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb74=['exports','define','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x47cfb2,_0x550212){var _0x1d5212=function(_0x165365){while(--_0x165365){_0x47cfb2['push'](_0x47cfb2['shift']());}};_0x1d5212(++_0x550212);}(_0xeb74,0x87));var _0x4eb7=function(_0x2d4b2d,_0x903661){_0x2d4b2d=_0x2d4b2d-0x0;var _0x12e382=_0xeb74[_0x2d4b2d];return _0x12e382;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var logger=require(_0x4eb7('0x2'))('api');var moment=require(_0x4eb7('0x3'));var BPromise=require('bluebird');var rp=require(_0x4eb7('0x4'));var fs=require('fs');var path=require(_0x4eb7('0x5'));var rimraf=require(_0x4eb7('0x6'));var config=require(_0x4eb7('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x4eb7('0x8')]=function(_0x49ab6b,_0x3ffd1c){return _0x49ab6b[_0x4eb7('0x9')]('VtigerField',attributes,{'tableName':_0x4eb7('0xa'),'paranoid':![],'indexes':[{'name':_0x4eb7('0xb'),'fields':[_0x4eb7('0xc'),'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 307de9e..abe3c7d 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 _0xf931=['info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x599375,_0xfd0e5b){var _0x17335c=function(_0x1b902a){while(--_0x1b902a){_0x599375['push'](_0x599375['shift']());}};_0x17335c(++_0xfd0e5b);}(_0xf931,0xc5));var _0x1f93=function(_0x3f450e,_0xac734f){_0x3f450e=_0x3f450e-0x0;var _0x2aac28=_0xf931[_0x3f450e];return _0x2aac28;};'use strict';var _=require('lodash');var util=require(_0x1f93('0x0'));var moment=require(_0x1f93('0x1'));var BPromise=require(_0x1f93('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f93('0x3'));var db=require(_0x1f93('0x4'))['db'];var utils=require(_0x1f93('0x5'));var logger=require(_0x1f93('0x6'))(_0x1f93('0x7'));var config=require(_0x1f93('0x8'));var jayson=require(_0x1f93('0x9'));var client=jayson[_0x1f93('0xa')][_0x1f93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33f540,_0x477b44,_0x59587d){return new BPromise(function(_0x312f92,_0x1b218c){return client[_0x1f93('0xc')](_0x33f540,_0x59587d)['then'](function(_0x4f17dc){logger[_0x1f93('0xd')](_0x1f93('0xe'),_0x477b44,_0x1f93('0xf'));logger['debug'](_0x1f93('0x10'),_0x477b44,_0x1f93('0xf'),JSON['stringify'](_0x4f17dc));if(_0x4f17dc['error']){if(_0x4f17dc[_0x1f93('0x11')][_0x1f93('0x12')]===0x1f4){logger['error'](_0x1f93('0xe'),_0x477b44,_0x4f17dc[_0x1f93('0x11')][_0x1f93('0x13')]);return _0x1b218c(_0x4f17dc[_0x1f93('0x11')][_0x1f93('0x13')]);}logger[_0x1f93('0x11')]('VtigerField,\x20%s,\x20%s',_0x477b44,_0x4f17dc[_0x1f93('0x11')]['message']);return _0x312f92(_0x4f17dc[_0x1f93('0x11')][_0x1f93('0x13')]);}else{logger[_0x1f93('0xd')](_0x1f93('0xe'),_0x477b44,'request\x20sent');_0x312f92(_0x4f17dc['result'][_0x1f93('0x13')]);}})[_0x1f93('0x14')](function(_0x12f17e){logger[_0x1f93('0x11')]('VtigerField,\x20%s,\x20%s',_0x477b44,_0x12f17e);_0x1b218c(_0x12f17e);});});} \ No newline at end of file +var _0x4302=['jayson/promise','request','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','info','VtigerField,\x20%s,\x20%s','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4302,0xa3));var _0x2430=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x4302[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x2430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2430('0x1'));var rs=require(_0x2430('0x2'));var fs=require('fs');var Redis=require(_0x2430('0x3'));var db=require(_0x2430('0x4'))['db'];var utils=require(_0x2430('0x5'));var logger=require('../../config/logger')(_0x2430('0x6'));var config=require(_0x2430('0x7'));var jayson=require(_0x2430('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc2cd7e,_0x4b08d3,_0x4ea1b4){return new BPromise(function(_0x4b91c6,_0x3490da){return client[_0x2430('0x9')](_0xc2cd7e,_0x4ea1b4)['then'](function(_0x138677){logger['info']('VtigerField,\x20%s,\x20%s',_0x4b08d3,_0x2430('0xa'));logger[_0x2430('0xb')](_0x2430('0xc'),_0x4b08d3,_0x2430('0xa'),JSON['stringify'](_0x138677));if(_0x138677[_0x2430('0xd')]){if(_0x138677[_0x2430('0xd')][_0x2430('0xe')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x4b08d3,_0x138677['error'][_0x2430('0xf')]);return _0x3490da(_0x138677[_0x2430('0xd')][_0x2430('0xf')]);}logger[_0x2430('0xd')]('VtigerField,\x20%s,\x20%s',_0x4b08d3,_0x138677[_0x2430('0xd')][_0x2430('0xf')]);return _0x4b91c6(_0x138677[_0x2430('0xd')][_0x2430('0xf')]);}else{logger[_0x2430('0x10')](_0x2430('0x11'),_0x4b08d3,'request\x20sent');_0x4b91c6(_0x138677[_0x2430('0x12')]['message']);}})['catch'](function(_0x19c8f8){logger[_0x2430('0xd')](_0x2430('0x11'),_0x4b08d3,_0x19c8f8);_0x3490da(_0x19c8f8);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index dde5768..61d1360 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 _0x7b0d=['util','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer'];(function(_0x297cd1,_0x16c8d1){var _0x274c10=function(_0x2327c9){while(--_0x2327c9){_0x297cd1['push'](_0x297cd1['shift']());}};_0x274c10(++_0x16c8d1);}(_0x7b0d,0x72));var _0xd7b0=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7b0d[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0xd7b0('0x0'));var util=require(_0xd7b0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd7b0('0x2'));var router=express['Router']();var fs_extra=require(_0xd7b0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd7b0('0x4'));var config=require(_0xd7b0('0x5'));var controller=require(_0xd7b0('0x6'));router[_0xd7b0('0x7')]('/',auth[_0xd7b0('0x8')](),controller[_0xd7b0('0x9')]);router[_0xd7b0('0x7')](_0xd7b0('0xa'),auth['isAuthenticated'](),controller[_0xd7b0('0xb')]);router[_0xd7b0('0x7')](_0xd7b0('0xc'),auth[_0xd7b0('0x8')](),controller[_0xd7b0('0xd')]);router[_0xd7b0('0x7')](_0xd7b0('0xe'),auth[_0xd7b0('0x8')](),controller[_0xd7b0('0xf')]);router[_0xd7b0('0x10')]('/',auth[_0xd7b0('0x8')](),controller[_0xd7b0('0x11')]);router[_0xd7b0('0x10')](_0xd7b0('0xc'),auth[_0xd7b0('0x8')](),controller['addConfiguration']);router[_0xd7b0('0x12')]('/:id',auth[_0xd7b0('0x8')](),controller[_0xd7b0('0x13')]);router[_0xd7b0('0x14')](_0xd7b0('0xa'),auth[_0xd7b0('0x8')](),controller[_0xd7b0('0x15')]);module[_0xd7b0('0x16')]=router; \ No newline at end of file +var _0x160c=['post','create','/:id/configurations','put','update','delete','destroy','util','path','connect-timeout','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','show','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x40951a,_0x2cbe60){var _0xdb2028=function(_0x134fa6){while(--_0x134fa6){_0x40951a['push'](_0x40951a['shift']());}};_0xdb2028(++_0x2cbe60);}(_0x160c,0x181));var _0xc160=function(_0x228ecb,_0x555575){_0x228ecb=_0x228ecb-0x0;var _0x3eb1cb=_0x160c[_0x228ecb];return _0x3eb1cb;};'use strict';var multer=require('multer');var util=require(_0xc160('0x0'));var path=require(_0xc160('0x1'));var timeout=require(_0xc160('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc160('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc160('0x4'));var controller=require(_0xc160('0x5'));router[_0xc160('0x6')]('/',auth['isAuthenticated'](),controller[_0xc160('0x7')]);router['get'](_0xc160('0x8'),auth['isAuthenticated'](),controller[_0xc160('0x9')]);router[_0xc160('0x6')]('/:id/configurations',auth[_0xc160('0xa')](),controller[_0xc160('0xb')]);router['get'](_0xc160('0xc'),auth[_0xc160('0xa')](),controller[_0xc160('0xd')]);router[_0xc160('0xe')]('/',auth[_0xc160('0xa')](),controller[_0xc160('0xf')]);router[_0xc160('0xe')](_0xc160('0x10'),auth[_0xc160('0xa')](),controller['addConfiguration']);router[_0xc160('0x11')](_0xc160('0x8'),auth['isAuthenticated'](),controller[_0xc160('0x12')]);router[_0xc160('0x13')](_0xc160('0x8'),auth['isAuthenticated'](),controller[_0xc160('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index dd53551..d3eb0e5 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 _0x2eba=['password','token','integrationTab','exports','STRING','remoteUri','ENUM'];(function(_0x3445a2,_0x4f3fe6){var _0x5751c9=function(_0x53b4ce){while(--_0x53b4ce){_0x3445a2['push'](_0x3445a2['shift']());}};_0x5751c9(++_0x4f3fe6);}(_0x2eba,0xc7));var _0xa2eb=function(_0x28f62f,_0x124cd8){_0x28f62f=_0x28f62f-0x0;var _0x297207=_0x2eba[_0x28f62f];return _0x297207;};'use strict';var Sequelize=require('sequelize');module[_0xa2eb('0x0')]={'name':{'type':Sequelize[_0xa2eb('0x1')]},'description':{'type':Sequelize[_0xa2eb('0x1')]},'username':{'type':Sequelize[_0xa2eb('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa2eb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa2eb('0x2')},'authType':{'type':Sequelize[_0xa2eb('0x3')](_0xa2eb('0x4'),_0xa2eb('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa2eb('0x6'),'newTab'),'defaultValue':_0xa2eb('0x6')}}; \ No newline at end of file +var _0xa899=['exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','sequelize'];(function(_0x1579a9,_0x58db26){var _0x406723=function(_0x3b7ae7){while(--_0x3b7ae7){_0x1579a9['push'](_0x1579a9['shift']());}};_0x406723(++_0x58db26);}(_0xa899,0x155));var _0x9a89=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0xa899[_0x69a451];return _0x3d6ef5;};'use strict';var Sequelize=require(_0x9a89('0x0'));module[_0x9a89('0x1')]={'name':{'type':Sequelize[_0x9a89('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9a89('0x2')],'unique':_0x9a89('0x3')},'password':{'type':Sequelize[_0x9a89('0x2')]},'token':{'type':Sequelize[_0x9a89('0x2')]},'remoteUri':{'type':Sequelize[_0x9a89('0x2')],'unique':_0x9a89('0x4')},'authType':{'type':Sequelize[_0x9a89('0x5')](_0x9a89('0x6'),_0x9a89('0x7')),'defaultValue':_0x9a89('0x6')},'serverUrl':{'type':Sequelize[_0x9a89('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a89('0x5')](_0x9a89('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 58e43cd..815e5e4 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(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x57f8,0x198));var _0x857f=function(_0xe0dee2,_0x35d2a8){_0xe0dee2=_0xe0dee2-0x0;var _0x568ed0=_0x57f8[_0xe0dee2];return _0x568ed0;};'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 _0x9354=['Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','authType','remoteUri','slice','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','ValidationError','subject','description','group','assignee','includes','position','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZendeskAccount','rawAttributes','type','key','keys','query','filters','attributes','model','fields','nolimit','order','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','length','find','create','body','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x9354,0x96));var _0x4935=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0x9354[_0x3beea0];return _0x314eb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];var integrations=require(_0x4935('0x17'));function respondWithStatusCode(_0x3bb388,_0x1c6c22){_0x1c6c22=_0x1c6c22||0xcc;return function(_0x3b246a){if(_0x3b246a){return _0x3bb388[_0x4935('0x18')](_0x1c6c22);}return _0x3bb388[_0x4935('0x19')](_0x1c6c22)[_0x4935('0x1a')]();};}function respondWithResult(_0x57549f,_0x237e28){_0x237e28=_0x237e28||0xc8;return function(_0x1ce1ba){if(_0x1ce1ba){return _0x57549f[_0x4935('0x19')](_0x237e28)[_0x4935('0x1b')](_0x1ce1ba);}};}function respondWithFilteredResult(_0x3652c4,_0x24cc99){return function(_0x395a43){if(_0x395a43){var _0x57d7ed=typeof _0x24cc99[_0x4935('0x1c')]===_0x4935('0x1d')&&typeof _0x24cc99[_0x4935('0x1e')]===_0x4935('0x1d');var _0x1f0e81=_0x395a43[_0x4935('0x1f')];var _0x4ebc63=_0x57d7ed?0x0:_0x24cc99[_0x4935('0x1c')];var _0x145277=_0x57d7ed?_0x395a43['count']:_0x24cc99[_0x4935('0x1c')]+_0x24cc99[_0x4935('0x1e')];var _0x1e7e38;if(_0x145277>=_0x1f0e81){_0x145277=_0x1f0e81;_0x1e7e38=0xc8;}else{_0x1e7e38=0xce;}_0x3652c4['status'](_0x1e7e38);return _0x3652c4['set'](_0x4935('0x20'),_0x4ebc63+'-'+_0x145277+'/'+_0x1f0e81)[_0x4935('0x1b')](_0x395a43);}return null;};}function patchUpdates(_0x1ae059){return function(_0x388422){try{jsonpatch[_0x4935('0x21')](_0x388422,_0x1ae059,!![]);}catch(_0x16ab7c){return BPromise[_0x4935('0x22')](_0x16ab7c);}return _0x388422[_0x4935('0x23')]();};}function saveUpdates(_0x58b2f3,_0x2f520a){return function(_0x320d81){if(_0x320d81){return _0x320d81[_0x4935('0x24')](_0x58b2f3)[_0x4935('0x25')](function(_0x52c65a){return _0x52c65a;});}return null;};}function removeEntity(_0x53530f,_0x4dc1f5){return function(_0x36e76a){if(_0x36e76a){return _0x36e76a[_0x4935('0x26')]()[_0x4935('0x25')](function(){_0x53530f[_0x4935('0x19')](0xcc)[_0x4935('0x1a')]();});}};}function handleEntityNotFound(_0x1c37ba,_0x3784f9){return function(_0x1d53a7){if(!_0x1d53a7){_0x1c37ba[_0x4935('0x18')](0x194);}return _0x1d53a7;};}function handleError(_0xf4abb2,_0x1d08b5){_0x1d08b5=_0x1d08b5||0x1f4;return function(_0x39d07b){logger[_0x4935('0x27')](_0x39d07b[_0x4935('0x28')]);if(_0x39d07b[_0x4935('0x29')]){delete _0x39d07b['name'];}_0xf4abb2['status'](_0x1d08b5)['send'](_0x39d07b);};}exports[_0x4935('0x2a')]=function(_0x76ea7d,_0x4f1163){var _0x3f0707={},_0x20755a={},_0x24a3b6={'count':0x0,'rows':[]};var _0x9fe9f6=_[_0x4935('0x2b')](db[_0x4935('0x2c')][_0x4935('0x2d')],function(_0x2fe6da){return{'name':_0x2fe6da['fieldName'],'type':_0x2fe6da[_0x4935('0x2e')][_0x4935('0x2f')]};});_0x20755a['model']=_['map'](_0x9fe9f6,_0x4935('0x29'));_0x20755a['query']=_[_0x4935('0x30')](_0x76ea7d[_0x4935('0x31')]);_0x20755a[_0x4935('0x32')]=_['intersection'](_0x20755a['model'],_0x20755a[_0x4935('0x31')]);_0x3f0707[_0x4935('0x33')]=_['intersection'](_0x20755a[_0x4935('0x34')],qs[_0x4935('0x35')](_0x76ea7d[_0x4935('0x31')][_0x4935('0x35')]));_0x3f0707[_0x4935('0x33')]=_0x3f0707['attributes']['length']?_0x3f0707[_0x4935('0x33')]:_0x20755a[_0x4935('0x34')];if(!_0x76ea7d['query']['hasOwnProperty'](_0x4935('0x36'))){_0x3f0707['limit']=qs[_0x4935('0x1e')](_0x76ea7d[_0x4935('0x31')][_0x4935('0x1e')]);_0x3f0707[_0x4935('0x1c')]=qs[_0x4935('0x1c')](_0x76ea7d[_0x4935('0x31')]['offset']);}_0x3f0707[_0x4935('0x37')]=qs['sort'](_0x76ea7d[_0x4935('0x31')]['sort']);_0x3f0707[_0x4935('0x38')]=qs['filters'](_[_0x4935('0x39')](_0x76ea7d[_0x4935('0x31')],_0x20755a[_0x4935('0x32')]),_0x9fe9f6);if(_0x76ea7d[_0x4935('0x31')][_0x4935('0x3a')]){_0x3f0707[_0x4935('0x38')]=_[_0x4935('0x3b')](_0x3f0707['where'],{'$or':_['map'](_0x9fe9f6,function(_0x2efc45){if(_0x2efc45['type']!=='VIRTUAL'){var _0x1552b2={};_0x1552b2[_0x2efc45['name']]={'$like':'%'+_0x76ea7d[_0x4935('0x31')][_0x4935('0x3a')]+'%'};return _0x1552b2;}})});}_0x3f0707=_[_0x4935('0x3b')]({},_0x3f0707,_0x76ea7d[_0x4935('0x3c')]);var _0xb366e6={'where':_0x3f0707['where']};return db['ZendeskAccount'][_0x4935('0x1f')](_0xb366e6)[_0x4935('0x25')](function(_0x28f545){_0x24a3b6[_0x4935('0x1f')]=_0x28f545;if(_0x76ea7d[_0x4935('0x31')][_0x4935('0x3d')]){_0x3f0707[_0x4935('0x3e')]=[{'all':!![]}];}return db[_0x4935('0x2c')]['findAll'](_0x3f0707);})['then'](function(_0x213230){_0x24a3b6[_0x4935('0x3f')]=_0x213230;return _0x24a3b6;})['then'](respondWithFilteredResult(_0x4f1163,_0x3f0707))[_0x4935('0x40')](handleError(_0x4f1163,null));};exports[_0x4935('0x41')]=function(_0x4706eb,_0xe5c9f5){var _0x52ab0c={'raw':![],'where':{'id':_0x4706eb[_0x4935('0x42')]['id']}},_0x542689={};_0x542689[_0x4935('0x34')]=_['keys'](db[_0x4935('0x2c')][_0x4935('0x2d')]);_0x542689[_0x4935('0x31')]=_['keys'](_0x4706eb[_0x4935('0x31')]);_0x542689[_0x4935('0x32')]=_[_0x4935('0x43')](_0x542689[_0x4935('0x34')],_0x542689[_0x4935('0x31')]);_0x52ab0c[_0x4935('0x33')]=_[_0x4935('0x43')](_0x542689[_0x4935('0x34')],qs[_0x4935('0x35')](_0x4706eb[_0x4935('0x31')][_0x4935('0x35')]));_0x52ab0c[_0x4935('0x33')]=_0x52ab0c[_0x4935('0x33')][_0x4935('0x44')]?_0x52ab0c[_0x4935('0x33')]:_0x542689[_0x4935('0x34')];if(_0x4706eb[_0x4935('0x31')][_0x4935('0x3d')]){_0x52ab0c['include']=[{'all':!![]}];}_0x52ab0c=_[_0x4935('0x3b')]({},_0x52ab0c,_0x4706eb['options']);return db[_0x4935('0x2c')][_0x4935('0x45')](_0x52ab0c)[_0x4935('0x25')](handleEntityNotFound(_0xe5c9f5,null))[_0x4935('0x25')](respondWithResult(_0xe5c9f5,null))['catch'](handleError(_0xe5c9f5,null));};exports[_0x4935('0x46')]=function(_0x9c8bad,_0x2b34d5){return db[_0x4935('0x2c')][_0x4935('0x46')](_0x9c8bad[_0x4935('0x47')],{})[_0x4935('0x25')](respondWithResult(_0x2b34d5,0xc9))[_0x4935('0x40')](handleError(_0x2b34d5,null));};exports[_0x4935('0x24')]=function(_0x392cba,_0x5d48dd){if(_0x392cba[_0x4935('0x47')]['id']){delete _0x392cba[_0x4935('0x47')]['id'];}return db['ZendeskAccount'][_0x4935('0x45')]({'where':{'id':_0x392cba[_0x4935('0x42')]['id']}})[_0x4935('0x25')](handleEntityNotFound(_0x5d48dd,null))[_0x4935('0x25')](saveUpdates(_0x392cba[_0x4935('0x47')],null))[_0x4935('0x25')](respondWithResult(_0x5d48dd,null))[_0x4935('0x40')](handleError(_0x5d48dd,null));};exports[_0x4935('0x26')]=function(_0x4b9c70,_0x57d0d9){return db['ZendeskAccount']['find']({'where':{'id':_0x4b9c70[_0x4935('0x42')]['id']}})[_0x4935('0x25')](handleEntityNotFound(_0x57d0d9,null))[_0x4935('0x25')](removeEntity(_0x57d0d9,null))[_0x4935('0x40')](handleError(_0x57d0d9,null));};exports[_0x4935('0x48')]=function(_0x487cf3,_0x32e004,_0x4a88db){var _0x2cc0c1={};var _0x345454={};var _0x377ff4;var _0x8196b4;return db[_0x4935('0x2c')][_0x4935('0x49')]({'where':{'id':_0x487cf3[_0x4935('0x42')]['id']}})[_0x4935('0x25')](handleEntityNotFound(_0x32e004,null))['then'](function(_0x24b83b){if(_0x24b83b){_0x377ff4=_0x24b83b;_0x345454['model']=_[_0x4935('0x30')](db[_0x4935('0x4a')]['rawAttributes']);_0x345454[_0x4935('0x31')]=_['keys'](_0x487cf3['query']);_0x345454['filters']=_[_0x4935('0x43')](_0x345454[_0x4935('0x34')],_0x345454[_0x4935('0x31')]);_0x2cc0c1[_0x4935('0x33')]=_[_0x4935('0x43')](_0x345454['model'],qs['fields'](_0x487cf3[_0x4935('0x31')][_0x4935('0x35')]));_0x2cc0c1[_0x4935('0x33')]=_0x2cc0c1['attributes'][_0x4935('0x44')]?_0x2cc0c1[_0x4935('0x33')]:_0x345454[_0x4935('0x34')];_0x2cc0c1[_0x4935('0x37')]=qs['sort'](_0x487cf3[_0x4935('0x31')]['sort']);_0x2cc0c1['where']=qs['filters'](_[_0x4935('0x39')](_0x487cf3[_0x4935('0x31')],_0x345454['filters']));if(_0x487cf3[_0x4935('0x31')][_0x4935('0x3a')]){_0x2cc0c1['where']=_[_0x4935('0x3b')](_0x2cc0c1[_0x4935('0x38')],{'$or':_[_0x4935('0x2b')](_0x2cc0c1[_0x4935('0x33')],function(_0x42ff64){var _0x2d21f0={};_0x2d21f0[_0x42ff64]={'$like':'%'+_0x487cf3[_0x4935('0x31')]['filter']+'%'};return _0x2d21f0;})});}_0x2cc0c1=_[_0x4935('0x3b')]({},_0x2cc0c1,_0x487cf3['options']);return _0x377ff4['getConfigurations'](_0x2cc0c1);}})[_0x4935('0x25')](function(_0xc3fb8f){if(_0xc3fb8f){_0x8196b4=_0xc3fb8f['length'];if(!_0x487cf3['query'][_0x4935('0x4b')](_0x4935('0x36'))){_0x2cc0c1[_0x4935('0x1e')]=qs['limit'](_0x487cf3[_0x4935('0x31')]['limit']);_0x2cc0c1[_0x4935('0x1c')]=qs[_0x4935('0x1c')](_0x487cf3[_0x4935('0x31')][_0x4935('0x1c')]);}return _0x377ff4[_0x4935('0x48')](_0x2cc0c1);}})['then'](function(_0x1eb15d){if(_0x1eb15d){return _0x1eb15d?{'count':_0x8196b4,'rows':_0x1eb15d}:null;}})[_0x4935('0x25')](respondWithResult(_0x32e004,null))['catch'](handleError(_0x32e004,null));};exports[_0x4935('0x4c')]=function(_0x2ae5ee,_0x283b75,_0x2046b2){if(_0x2ae5ee[_0x4935('0x47')]['id']){delete _0x2ae5ee[_0x4935('0x47')]['id'];}return db[_0x4935('0x2c')][_0x4935('0x49')]({'where':{'id':_0x2ae5ee[_0x4935('0x42')]['id']}})[_0x4935('0x25')](handleEntityNotFound(_0x283b75,null))[_0x4935('0x25')](function(_0x5d4435){if(_0x5d4435){_0x2ae5ee[_0x4935('0x47')][_0x4935('0x4d')]=_0x5d4435['id'];_0x2ae5ee[_0x4935('0x47')][_0x4935('0x4e')]=integrations[_0x4935('0x4f')](_0x2ae5ee[_0x4935('0x47')][_0x4935('0x50')],_0x2ae5ee[_0x4935('0x47')][_0x4935('0x2e')]);_0x2ae5ee[_0x4935('0x47')][_0x4935('0x51')]=integrations[_0x4935('0x52')](_0x2ae5ee[_0x4935('0x47')]['channel'],_0x2ae5ee['body'][_0x4935('0x2e')]);return db[_0x4935('0x4a')]['create'](_0x2ae5ee[_0x4935('0x47')],{'include':[{'model':db[_0x4935('0x53')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x4935('0x51')}]});}return null;})[_0x4935('0x25')](respondWithResult(_0x283b75,null))[_0x4935('0x40')](handleError(_0x283b75,null));};exports[_0x4935('0x54')]=function(_0x105e38,_0x5a612b,_0x404b2c){var _0x1f5e21='';return db[_0x4935('0x2c')][_0x4935('0x49')]({'where':{'id':_0x105e38['params']['id']},'attributes':['id',_0x4935('0x55'),'password','token',_0x4935('0x56'),_0x4935('0x57')]})['then'](handleEntityNotFound(_0x5a612b,null))[_0x4935('0x25')](function(_0x22d594){if(_0x22d594){_0x1f5e21=_0x22d594[_0x4935('0x57')];var _0x4c1b82=_0x1f5e21[_0x4935('0x58')](-0x1);if(_0x4c1b82==='/'){_0x1f5e21=_0x1f5e21['substring'](0x0,_0x1f5e21['lastIndexOf'](_0x4c1b82));}var _0x190186={'method':_0x4935('0x59'),'uri':util[_0x4935('0x5a')](_0x4935('0x5b'),_0x1f5e21,_0x4935('0x5c')),'json':!![]};switch(_0x22d594[_0x4935('0x56')]){case _0x4935('0x5d'):_0x190186[_0x4935('0x5e')]={'Authorization':util['format'](_0x4935('0x5f'),new Buffer(util[_0x4935('0x5a')](_0x4935('0x60'),_0x22d594['username'],_0x22d594['password']))[_0x4935('0x61')](_0x4935('0x62')))};break;case'token':_0x190186[_0x4935('0x5e')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x4935('0x5a')](_0x4935('0x63'),_0x22d594[_0x4935('0x55')],_0x22d594['token']))['toString'](_0x4935('0x62')))};break;default:throw new db['Sequelize'][(_0x4935('0x64'))]('Unknown\x20authentication\x20type');}return rp(_0x190186);}})[_0x4935('0x25')](function(_0x91b821){if(_0x91b821){var _0xa5c497=[_0x4935('0x65'),_0x4935('0x66'),_0x4935('0x67'),_0x4935('0x68')];_['remove'](_0x91b821[_0x4935('0x5c')],function(_0x493392){return _0xa5c497[_0x4935('0x69')](_0x493392[_0x4935('0x2e')]);});return{'count':_0x91b821['ticket_fields'][_0x4935('0x44')],'rows':_['map'](_0x91b821[_0x4935('0x5c')],function(_0x402963){return{'id':_0x402963['id'],'name':_0x402963['position']>0x7?_0x402963['title']:_0x402963['type'],'custom':_0x402963[_0x4935('0x6a')]>0x7?!![]:![],'options':_0x402963['system_field_options']?_0x402963['system_field_options']:_0x402963[_0x4935('0x6b')]?_0x402963['custom_field_options']:[]};})};}})[_0x4935('0x25')](respondWithResult(_0x5a612b,null))['catch'](function(_0x497246){var _0x5c5978=_0x105e38[_0x4935('0x31')]['test']?0x1f4:_0x497246[_0x4935('0x6c')]||0x1f4;logger[_0x4935('0x27')](_0x4935('0x6d'),_0x4935('0x54'),_0x5c5978,JSON[_0x4935('0x6e')](_0x497246));delete _0x497246['name'];if(_0x5c5978===0x191){_0x5c5978=0x190;}_0x5a612b[_0x4935('0x19')](_0x5c5978)[_0x4935('0x6f')](_0x105e38['query'][_0x4935('0x70')]?{'message':_0x4935('0x71'),'statusCode':_0x497246['statusCode']}:_0x497246);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d9a9221..83d7ea4 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 _0xd420=['bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api'];(function(_0x2e2747,_0xbc0dda){var _0x5bb81a=function(_0x4d8352){while(--_0x4d8352){_0x2e2747['push'](_0x2e2747['shift']());}};_0x5bb81a(++_0xbc0dda);}(_0xd420,0x147));var _0x0d42=function(_0x5acd2b,_0x25abfb){_0x5acd2b=_0x5acd2b-0x0;var _0x5e7e0d=_0xd420[_0x5acd2b];return _0x5e7e0d;};'use strict';var _=require(_0x0d42('0x0'));var util=require(_0x0d42('0x1'));var logger=require('../../config/logger')(_0x0d42('0x2'));var moment=require('moment');var BPromise=require(_0x0d42('0x3'));var rp=require(_0x0d42('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d42('0x5'));var config=require(_0x0d42('0x6'));var attributes=require(_0x0d42('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3c2255,_0x1ab545){return _0x3c2255[_0x0d42('0x8')](_0x0d42('0x9'),attributes,{'tableName':_0x0d42('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x978f=['../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x381af1,_0x3a99c7){var _0xbe1d23=function(_0x1d8ad6){while(--_0x1d8ad6){_0x381af1['push'](_0x381af1['shift']());}};_0xbe1d23(++_0x3a99c7);}(_0x978f,0x1bd));var _0xf978=function(_0x2bc8e0,_0x38204a){_0x2bc8e0=_0x2bc8e0-0x0;var _0xca8f97=_0x978f[_0x2bc8e0];return _0xca8f97;};'use strict';var _=require(_0xf978('0x0'));var util=require(_0xf978('0x1'));var logger=require(_0xf978('0x2'))(_0xf978('0x3'));var moment=require(_0xf978('0x4'));var BPromise=require(_0xf978('0x5'));var rp=require(_0xf978('0x6'));var fs=require('fs');var path=require(_0xf978('0x7'));var rimraf=require(_0xf978('0x8'));var config=require(_0xf978('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xf978('0xa'));module[_0xf978('0xb')]=function(_0x44be0d,_0x1b51c7){return _0x44be0d['define']('ZendeskAccount',attributes,{'tableName':_0xf978('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 097c41f..217a327 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 _0x6068=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x1e0144,_0x2c824b){var _0x1fa9f8=function(_0x1db012){while(--_0x1db012){_0x1e0144['push'](_0x1e0144['shift']());}};_0x1fa9f8(++_0x2c824b);}(_0x6068,0x81));var _0x8606=function(_0x725574,_0x33b5fa){_0x725574=_0x725574-0x0;var _0x299c6e=_0x6068[_0x725574];return _0x299c6e;};'use strict';var _=require(_0x8606('0x0'));var util=require(_0x8606('0x1'));var moment=require(_0x8606('0x2'));var BPromise=require(_0x8606('0x3'));var rs=require(_0x8606('0x4'));var fs=require('fs');var Redis=require(_0x8606('0x5'));var db=require(_0x8606('0x6'))['db'];var utils=require(_0x8606('0x7'));var logger=require(_0x8606('0x8'))(_0x8606('0x9'));var config=require(_0x8606('0xa'));var jayson=require(_0x8606('0xb'));var client=jayson['client'][_0x8606('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3139ef,_0x56c790,_0x44e01c){return new BPromise(function(_0x1b9ed4,_0x13959d){return client['request'](_0x3139ef,_0x44e01c)[_0x8606('0xd')](function(_0x22b92b){logger[_0x8606('0xe')](_0x8606('0xf'),_0x56c790,_0x8606('0x10'));logger['debug'](_0x8606('0x11'),_0x56c790,'request\x20sent',JSON['stringify'](_0x22b92b));if(_0x22b92b[_0x8606('0x12')]){if(_0x22b92b[_0x8606('0x12')][_0x8606('0x13')]===0x1f4){logger['error'](_0x8606('0xf'),_0x56c790,_0x22b92b[_0x8606('0x12')][_0x8606('0x14')]);return _0x13959d(_0x22b92b['error']['message']);}logger[_0x8606('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x56c790,_0x22b92b[_0x8606('0x12')][_0x8606('0x14')]);return _0x1b9ed4(_0x22b92b[_0x8606('0x12')][_0x8606('0x14')]);}else{logger[_0x8606('0xe')](_0x8606('0xf'),_0x56c790,_0x8606('0x10'));_0x1b9ed4(_0x22b92b[_0x8606('0x15')][_0x8606('0x14')]);}})[_0x8606('0x16')](function(_0xd7559f){logger[_0x8606('0x12')](_0x8606('0xf'),_0x56c790,_0xd7559f);_0x13959d(_0xd7559f);});});}exports[_0x8606('0x17')]=function(_0x58cd73){var _0x1a3693=this;return new Promise(function(_0x237d82,_0x57d902){return db[_0x8606('0x18')][_0x8606('0x19')]({'raw':_0x58cd73[_0x8606('0x1a')]?_0x58cd73[_0x8606('0x1a')][_0x8606('0x1b')]===undefined?!![]:![]:!![],'where':_0x58cd73['options']?_0x58cd73['options'][_0x8606('0x1c')]||null:null,'attributes':_0x58cd73[_0x8606('0x1a')]?_0x58cd73['options'][_0x8606('0x1d')]||null:null,'limit':_0x58cd73[_0x8606('0x1a')]?_0x58cd73[_0x8606('0x1a')][_0x8606('0x1e')]||null:null,'include':_0x58cd73[_0x8606('0x1a')]?_0x58cd73[_0x8606('0x1a')][_0x8606('0x1f')]?_[_0x8606('0x20')](_0x58cd73[_0x8606('0x1a')][_0x8606('0x1f')],function(_0x5bf43e){return{'model':db[_0x5bf43e[_0x8606('0x21')]],'as':_0x5bf43e['as'],'attributes':_0x5bf43e[_0x8606('0x1d')],'include':_0x5bf43e[_0x8606('0x1f')]?_[_0x8606('0x20')](_0x5bf43e['include'],function(_0x3747e3){return{'model':db[_0x3747e3[_0x8606('0x21')]],'as':_0x3747e3['as'],'attributes':_0x3747e3['attributes'],'include':_0x3747e3[_0x8606('0x1f')]?_[_0x8606('0x20')](_0x3747e3[_0x8606('0x1f')],function(_0x2a4e16){return{'model':db[_0x2a4e16[_0x8606('0x21')]],'as':_0x2a4e16['as'],'attributes':_0x2a4e16[_0x8606('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8606('0xd')](function(_0x323f8c){logger[_0x8606('0xe')]('GetZendeskAccount',_0x58cd73);logger['debug'](_0x8606('0x17'),_0x58cd73,JSON[_0x8606('0x22')](_0x323f8c));_0x237d82(_0x323f8c);})[_0x8606('0x16')](function(_0x73f8d1){logger[_0x8606('0x12')]('GetZendeskAccount',_0x73f8d1[_0x8606('0x14')],_0x58cd73);_0x57d902(_0x1a3693[_0x8606('0x12')](0x1f4,_0x73f8d1['message']));});});};exports[_0x8606('0x23')]=function(_0x5d4631){var _0x339703=this;return new Promise(function(_0x346a7c,_0x2c463b){return db[_0x8606('0x18')]['find']({'raw':_0x5d4631[_0x8606('0x1a')]?_0x5d4631[_0x8606('0x1a')][_0x8606('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d4631[_0x8606('0x1a')]?_0x5d4631['options'][_0x8606('0x1c')]||null:null,'attributes':_0x5d4631[_0x8606('0x1a')]?_0x5d4631[_0x8606('0x1a')][_0x8606('0x1d')]||null:null,'include':_0x5d4631[_0x8606('0x1a')]?_0x5d4631[_0x8606('0x1a')][_0x8606('0x1f')]?_[_0x8606('0x20')](_0x5d4631[_0x8606('0x1a')][_0x8606('0x1f')],function(_0x480d46){return{'model':db[_0x480d46[_0x8606('0x21')]],'as':_0x480d46['as'],'attributes':_0x480d46[_0x8606('0x1d')],'include':_0x480d46['include']?_['map'](_0x480d46[_0x8606('0x1f')],function(_0x3ef36d){return{'model':db[_0x3ef36d['model']],'as':_0x3ef36d['as'],'attributes':_0x3ef36d[_0x8606('0x1d')],'include':_0x3ef36d[_0x8606('0x1f')]?_[_0x8606('0x20')](_0x3ef36d[_0x8606('0x1f')],function(_0x4fa57a){return{'model':db[_0x4fa57a[_0x8606('0x21')]],'as':_0x4fa57a['as'],'attributes':_0x4fa57a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8606('0xd')](function(_0x1f8b35){logger[_0x8606('0xe')](_0x8606('0x23'),_0x5d4631);logger['debug'](_0x8606('0x23'),_0x5d4631,JSON[_0x8606('0x22')](_0x1f8b35));_0x346a7c(_0x1f8b35);})[_0x8606('0x16')](function(_0x467163){logger['error'](_0x8606('0x23'),_0x467163[_0x8606('0x14')],_0x5d4631);_0x2c463b(_0x339703[_0x8606('0x12')](0x1f4,_0x467163[_0x8606('0x14')]));});});}; \ No newline at end of file +var _0x36bb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','ZendeskAccount','find','ShowZendeskAccount','lodash','util','moment','randomstring'];(function(_0x4d7732,_0x2a004d){var _0x581449=function(_0x1016e2){while(--_0x1016e2){_0x4d7732['push'](_0x4d7732['shift']());}};_0x581449(++_0x2a004d);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb36b('0x0'));var util=require(_0xb36b('0x1'));var moment=require(_0xb36b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb36b('0x3'));var fs=require('fs');var Redis=require(_0xb36b('0x4'));var db=require(_0xb36b('0x5'))['db'];var utils=require(_0xb36b('0x6'));var logger=require(_0xb36b('0x7'))(_0xb36b('0x8'));var config=require(_0xb36b('0x9'));var jayson=require(_0xb36b('0xa'));var client=jayson[_0xb36b('0xb')][_0xb36b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x181f45,_0x2e9885,_0x229483){return new BPromise(function(_0x30e907,_0x28647b){return client[_0xb36b('0xd')](_0x181f45,_0x229483)[_0xb36b('0xe')](function(_0x38d0d6){logger[_0xb36b('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2e9885,_0xb36b('0x10'));logger[_0xb36b('0x11')](_0xb36b('0x12'),_0x2e9885,'request\x20sent',JSON[_0xb36b('0x13')](_0x38d0d6));if(_0x38d0d6[_0xb36b('0x14')]){if(_0x38d0d6[_0xb36b('0x14')][_0xb36b('0x15')]===0x1f4){logger[_0xb36b('0x14')](_0xb36b('0x16'),_0x2e9885,_0x38d0d6[_0xb36b('0x14')][_0xb36b('0x17')]);return _0x28647b(_0x38d0d6[_0xb36b('0x14')][_0xb36b('0x17')]);}logger[_0xb36b('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x2e9885,_0x38d0d6[_0xb36b('0x14')]['message']);return _0x30e907(_0x38d0d6['error'][_0xb36b('0x17')]);}else{logger[_0xb36b('0xf')](_0xb36b('0x16'),_0x2e9885,_0xb36b('0x10'));_0x30e907(_0x38d0d6[_0xb36b('0x18')][_0xb36b('0x17')]);}})['catch'](function(_0x12f119){logger[_0xb36b('0x14')](_0xb36b('0x16'),_0x2e9885,_0x12f119);_0x28647b(_0x12f119);});});}exports[_0xb36b('0x19')]=function(_0x53ec0e){var _0x154df4=this;return new Promise(function(_0x211a91,_0x81c3de){return db['ZendeskAccount'][_0xb36b('0x1a')]({'raw':_0x53ec0e['options']?_0x53ec0e[_0xb36b('0x1b')][_0xb36b('0x1c')]===undefined?!![]:![]:!![],'where':_0x53ec0e[_0xb36b('0x1b')]?_0x53ec0e[_0xb36b('0x1b')][_0xb36b('0x1d')]||null:null,'attributes':_0x53ec0e[_0xb36b('0x1b')]?_0x53ec0e[_0xb36b('0x1b')]['attributes']||null:null,'limit':_0x53ec0e[_0xb36b('0x1b')]?_0x53ec0e['options'][_0xb36b('0x1e')]||null:null,'include':_0x53ec0e['options']?_0x53ec0e[_0xb36b('0x1b')][_0xb36b('0x1f')]?_[_0xb36b('0x20')](_0x53ec0e[_0xb36b('0x1b')][_0xb36b('0x1f')],function(_0x5f4a25){return{'model':db[_0x5f4a25[_0xb36b('0x21')]],'as':_0x5f4a25['as'],'attributes':_0x5f4a25[_0xb36b('0x22')],'include':_0x5f4a25[_0xb36b('0x1f')]?_['map'](_0x5f4a25[_0xb36b('0x1f')],function(_0x4a58d4){return{'model':db[_0x4a58d4['model']],'as':_0x4a58d4['as'],'attributes':_0x4a58d4['attributes'],'include':_0x4a58d4[_0xb36b('0x1f')]?_[_0xb36b('0x20')](_0x4a58d4[_0xb36b('0x1f')],function(_0x5c4aee){return{'model':db[_0x5c4aee[_0xb36b('0x21')]],'as':_0x5c4aee['as'],'attributes':_0x5c4aee[_0xb36b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb36b('0xe')](function(_0xe3d519){logger['info']('GetZendeskAccount',_0x53ec0e);logger[_0xb36b('0x11')](_0xb36b('0x19'),_0x53ec0e,JSON[_0xb36b('0x13')](_0xe3d519));_0x211a91(_0xe3d519);})[_0xb36b('0x23')](function(_0x4aabf5){logger['error'](_0xb36b('0x19'),_0x4aabf5['message'],_0x53ec0e);_0x81c3de(_0x154df4[_0xb36b('0x14')](0x1f4,_0x4aabf5[_0xb36b('0x17')]));});});};exports['ShowZendeskAccount']=function(_0x95efc5){var _0x24f8bc=this;return new Promise(function(_0xa7802c,_0xb19434){return db[_0xb36b('0x24')][_0xb36b('0x25')]({'raw':_0x95efc5[_0xb36b('0x1b')]?_0x95efc5[_0xb36b('0x1b')][_0xb36b('0x1c')]===undefined?!![]:![]:!![],'where':_0x95efc5[_0xb36b('0x1b')]?_0x95efc5[_0xb36b('0x1b')][_0xb36b('0x1d')]||null:null,'attributes':_0x95efc5['options']?_0x95efc5['options'][_0xb36b('0x22')]||null:null,'include':_0x95efc5[_0xb36b('0x1b')]?_0x95efc5['options'][_0xb36b('0x1f')]?_['map'](_0x95efc5['options'][_0xb36b('0x1f')],function(_0x27863d){return{'model':db[_0x27863d[_0xb36b('0x21')]],'as':_0x27863d['as'],'attributes':_0x27863d['attributes'],'include':_0x27863d['include']?_[_0xb36b('0x20')](_0x27863d[_0xb36b('0x1f')],function(_0x1b1566){return{'model':db[_0x1b1566[_0xb36b('0x21')]],'as':_0x1b1566['as'],'attributes':_0x1b1566[_0xb36b('0x22')],'include':_0x1b1566[_0xb36b('0x1f')]?_['map'](_0x1b1566[_0xb36b('0x1f')],function(_0x5c6ed4){return{'model':db[_0x5c6ed4[_0xb36b('0x21')]],'as':_0x5c6ed4['as'],'attributes':_0x5c6ed4[_0xb36b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb36b('0xe')](function(_0x185bb2){logger[_0xb36b('0xf')](_0xb36b('0x26'),_0x95efc5);logger[_0xb36b('0x11')]('ShowZendeskAccount',_0x95efc5,JSON[_0xb36b('0x13')](_0x185bb2));_0xa7802c(_0x185bb2);})[_0xb36b('0x23')](function(_0x2321f2){logger['error'](_0xb36b('0x26'),_0x2321f2[_0xb36b('0x17')],_0x95efc5);_0xb19434(_0x24f8bc[_0xb36b('0x14')](0x1f4,_0x2321f2[_0xb36b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ecfb1ab..c7fec71 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 _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x53ddab,_0x4ada9d){var _0x5819ac=function(_0x4d5fc8){while(--_0x4d5fc8){_0x53ddab['push'](_0x53ddab['shift']());}};_0x5819ac(++_0x4ada9d);}(_0x4483,0x1a3));var _0x3448=function(_0x5e7b41,_0x25458d){_0x5e7b41=_0x5e7b41-0x0;var _0x3f1352=_0x4483[_0x5e7b41];return _0x3f1352;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x36bab3,_0x19ce33){var _0x2d3989=function(_0x2a4f60){while(--_0x2a4f60){_0x36bab3['push'](_0x36bab3['shift']());}};_0x2d3989(++_0x19ce33);}(_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('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/descriptions',auth[_0x0d8b('0x7')](),controller['getDescriptions']);router[_0x0d8b('0x9')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller['update']);router[_0x0d8b('0x16')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x17')]);module[_0x0d8b('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 05ec1de..e49c7e6 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 _0x9adf=['STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9adf,0x103));var _0xf9ad=function(_0x369298,_0x151c9c){_0x369298=_0x369298-0x0;var _0x5b964d=_0x9adf[_0x369298];return _0x5b964d;};'use strict';var Sequelize=require(_0xf9ad('0x0'));module[_0xf9ad('0x1')]={'name':{'type':Sequelize[_0xf9ad('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xec4b=['STRING','sequelize','exports'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0xec4b,0x1b4));var _0xbec4=function(_0x59b8c3,_0x16fe5d){_0x59b8c3=_0x59b8c3-0x0;var _0x556817=_0xec4b[_0x59b8c3];return _0x556817;};'use strict';var Sequelize=require(_0xbec4('0x0'));module[_0xbec4('0x1')]={'name':{'type':Sequelize[_0xbec4('0x2')]},'description':{'type':Sequelize[_0xbec4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2a56b63..63b2d9d 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 _0x0b46=['then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','options','find','create','body','update','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0x0b46,0x12c));var _0x60b4=function(_0x2330a1,_0x4bb8d3){_0x2330a1=_0x2330a1-0x0;var _0x32c0a6=_0x0b46[_0x2330a1];return _0x32c0a6;};'use strict';var emlformat=require(_0x60b4('0x0'));var rimraf=require(_0x60b4('0x1'));var zipdir=require(_0x60b4('0x2'));var jsonpatch=require(_0x60b4('0x3'));var rp=require(_0x60b4('0x4'));var moment=require(_0x60b4('0x5'));var BPromise=require(_0x60b4('0x6'));var Mustache=require(_0x60b4('0x7'));var util=require('util');var path=require(_0x60b4('0x8'));var sox=require(_0x60b4('0x9'));var csv=require('to-csv');var ejs=require(_0x60b4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60b4('0xb'));var squel=require(_0x60b4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x60b4('0xd'));var toCsv=require(_0x60b4('0xe'));var querystring=require(_0x60b4('0xf'));var Papa=require(_0x60b4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x60b4('0x11'));var as=require(_0x60b4('0x12'));var hardwareService=require(_0x60b4('0x13'));var logger=require('../../config/logger')(_0x60b4('0x14'));var utils=require(_0x60b4('0x15'));var config=require(_0x60b4('0x16'));var licenseUtil=require(_0x60b4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x429f6a,_0x1199a9){_0x1199a9=_0x1199a9||0xcc;return function(_0x473522){if(_0x473522){return _0x429f6a[_0x60b4('0x18')](_0x1199a9);}return _0x429f6a[_0x60b4('0x19')](_0x1199a9)[_0x60b4('0x1a')]();};}function respondWithResult(_0xb9b3aa,_0x362bda){_0x362bda=_0x362bda||0xc8;return function(_0x3fae66){if(_0x3fae66){return _0xb9b3aa['status'](_0x362bda)['json'](_0x3fae66);}};}function respondWithFilteredResult(_0x1d2f9a,_0x48abfd){return function(_0x585a39){if(_0x585a39){var _0x3d80e=typeof _0x48abfd[_0x60b4('0x1b')]==='undefined'&&typeof _0x48abfd['limit']===_0x60b4('0x1c');var _0x2734af=_0x585a39[_0x60b4('0x1d')];var _0x38fcd4=_0x3d80e?0x0:_0x48abfd[_0x60b4('0x1b')];var _0x2207b3=_0x3d80e?_0x585a39[_0x60b4('0x1d')]:_0x48abfd[_0x60b4('0x1b')]+_0x48abfd[_0x60b4('0x1e')];var _0x4998d1;if(_0x2207b3>=_0x2734af){_0x2207b3=_0x2734af;_0x4998d1=0xc8;}else{_0x4998d1=0xce;}_0x1d2f9a[_0x60b4('0x19')](_0x4998d1);return _0x1d2f9a[_0x60b4('0x1f')](_0x60b4('0x20'),_0x38fcd4+'-'+_0x2207b3+'/'+_0x2734af)['json'](_0x585a39);}return null;};}function patchUpdates(_0x49b6ec){return function(_0x214381){try{jsonpatch[_0x60b4('0x21')](_0x214381,_0x49b6ec,!![]);}catch(_0x45d48e){return BPromise[_0x60b4('0x22')](_0x45d48e);}return _0x214381[_0x60b4('0x23')]();};}function saveUpdates(_0x369af3,_0x2febec){return function(_0x19b2ef){if(_0x19b2ef){return _0x19b2ef['update'](_0x369af3)[_0x60b4('0x24')](function(_0x1b31a4){return _0x1b31a4;});}return null;};}function removeEntity(_0x5cd9d8,_0x3de8b8){return function(_0x52e408){if(_0x52e408){return _0x52e408[_0x60b4('0x25')]()[_0x60b4('0x24')](function(){_0x5cd9d8[_0x60b4('0x19')](0xcc)[_0x60b4('0x1a')]();});}};}function handleEntityNotFound(_0x3c9c22,_0x18b5bd){return function(_0x5a2adf){if(!_0x5a2adf){_0x3c9c22[_0x60b4('0x18')](0x194);}return _0x5a2adf;};}function handleError(_0x218026,_0x23488a){_0x23488a=_0x23488a||0x1f4;return function(_0x2d7293){logger[_0x60b4('0x26')](_0x2d7293[_0x60b4('0x27')]);if(_0x2d7293[_0x60b4('0x28')]){delete _0x2d7293[_0x60b4('0x28')];}_0x218026['status'](_0x23488a)[_0x60b4('0x29')](_0x2d7293);};}exports[_0x60b4('0x2a')]=function(_0xc7ab95,_0x7d2b9a){var _0x44c641={},_0x358bbe={},_0x2fc5b5={'count':0x0,'rows':[]};var _0x129ee2=_['map'](db[_0x60b4('0x2b')][_0x60b4('0x2c')],function(_0x3d1809){return{'name':_0x3d1809[_0x60b4('0x2d')],'type':_0x3d1809[_0x60b4('0x2e')]['key']};});_0x358bbe[_0x60b4('0x2f')]=_[_0x60b4('0x30')](_0x129ee2,_0x60b4('0x28'));_0x358bbe['query']=_['keys'](_0xc7ab95[_0x60b4('0x31')]);_0x358bbe[_0x60b4('0x32')]=_['intersection'](_0x358bbe[_0x60b4('0x2f')],_0x358bbe[_0x60b4('0x31')]);_0x44c641['attributes']=_[_0x60b4('0x33')](_0x358bbe[_0x60b4('0x2f')],qs[_0x60b4('0x34')](_0xc7ab95['query'][_0x60b4('0x34')]));_0x44c641[_0x60b4('0x35')]=_0x44c641[_0x60b4('0x35')][_0x60b4('0x36')]?_0x44c641[_0x60b4('0x35')]:_0x358bbe['model'];if(!_0xc7ab95[_0x60b4('0x31')]['hasOwnProperty'](_0x60b4('0x37'))){_0x44c641[_0x60b4('0x1e')]=qs[_0x60b4('0x1e')](_0xc7ab95[_0x60b4('0x31')][_0x60b4('0x1e')]);_0x44c641[_0x60b4('0x1b')]=qs[_0x60b4('0x1b')](_0xc7ab95[_0x60b4('0x31')][_0x60b4('0x1b')]);}_0x44c641[_0x60b4('0x38')]=qs[_0x60b4('0x39')](_0xc7ab95[_0x60b4('0x31')]['sort']);_0x44c641[_0x60b4('0x3a')]=qs[_0x60b4('0x32')](_[_0x60b4('0x3b')](_0xc7ab95[_0x60b4('0x31')],_0x358bbe[_0x60b4('0x32')]),_0x129ee2);if(_0xc7ab95[_0x60b4('0x31')]['filter']){_0x44c641['where']=_[_0x60b4('0x3c')](_0x44c641[_0x60b4('0x3a')],{'$or':_[_0x60b4('0x30')](_0x129ee2,function(_0x2505b7){if(_0x2505b7[_0x60b4('0x2e')]!==_0x60b4('0x3d')){var _0x4a2297={};_0x4a2297[_0x2505b7[_0x60b4('0x28')]]={'$like':'%'+_0xc7ab95[_0x60b4('0x31')][_0x60b4('0x3e')]+'%'};return _0x4a2297;}})});}_0x44c641=_[_0x60b4('0x3c')]({},_0x44c641,_0xc7ab95['options']);var _0x22a50f={'where':_0x44c641[_0x60b4('0x3a')]};return db[_0x60b4('0x2b')][_0x60b4('0x1d')](_0x22a50f)[_0x60b4('0x24')](function(_0x4b7d37){_0x2fc5b5[_0x60b4('0x1d')]=_0x4b7d37;if(_0xc7ab95[_0x60b4('0x31')][_0x60b4('0x3f')]){_0x44c641['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x60b4('0x40')](_0x44c641);})['then'](function(_0x1fe003){_0x2fc5b5[_0x60b4('0x41')]=_0x1fe003;return _0x2fc5b5;})['then'](respondWithFilteredResult(_0x7d2b9a,_0x44c641))[_0x60b4('0x42')](handleError(_0x7d2b9a,null));};exports[_0x60b4('0x43')]=function(_0x50c213,_0x27f0cc){var _0x22a37f={'raw':![],'where':{'id':_0x50c213[_0x60b4('0x44')]['id']}},_0x445998={};_0x445998[_0x60b4('0x2f')]=_['keys'](db[_0x60b4('0x2b')][_0x60b4('0x2c')]);_0x445998[_0x60b4('0x31')]=_[_0x60b4('0x45')](_0x50c213['query']);_0x445998['filters']=_[_0x60b4('0x33')](_0x445998[_0x60b4('0x2f')],_0x445998[_0x60b4('0x31')]);_0x22a37f[_0x60b4('0x35')]=_[_0x60b4('0x33')](_0x445998['model'],qs[_0x60b4('0x34')](_0x50c213['query'][_0x60b4('0x34')]));_0x22a37f['attributes']=_0x22a37f[_0x60b4('0x35')][_0x60b4('0x36')]?_0x22a37f[_0x60b4('0x35')]:_0x445998['model'];if(_0x50c213[_0x60b4('0x31')]['includeAll']){_0x22a37f['include']=[{'all':!![]}];}_0x22a37f=_[_0x60b4('0x3c')]({},_0x22a37f,_0x50c213[_0x60b4('0x46')]);return db['ZendeskConfiguration'][_0x60b4('0x47')](_0x22a37f)[_0x60b4('0x24')](handleEntityNotFound(_0x27f0cc,null))[_0x60b4('0x24')](respondWithResult(_0x27f0cc,null))['catch'](handleError(_0x27f0cc,null));};exports[_0x60b4('0x48')]=function(_0x3b25a9,_0x523325){return db[_0x60b4('0x2b')][_0x60b4('0x48')](_0x3b25a9[_0x60b4('0x49')],{})['then'](respondWithResult(_0x523325,0xc9))[_0x60b4('0x42')](handleError(_0x523325,null));};exports[_0x60b4('0x4a')]=function(_0x2d363f,_0x2c097e){if(_0x2d363f[_0x60b4('0x49')]['id']){delete _0x2d363f['body']['id'];}return db[_0x60b4('0x2b')]['find']({'where':{'id':_0x2d363f[_0x60b4('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c097e,null))['then'](saveUpdates(_0x2d363f[_0x60b4('0x49')],null))['then'](respondWithResult(_0x2c097e,null))['catch'](handleError(_0x2c097e,null));};exports[_0x60b4('0x25')]=function(_0x5d3d2a,_0x2a00e1){return db[_0x60b4('0x2b')][_0x60b4('0x47')]({'where':{'id':_0x5d3d2a[_0x60b4('0x44')]['id']}})[_0x60b4('0x24')](handleEntityNotFound(_0x2a00e1,null))['then'](removeEntity(_0x2a00e1,null))[_0x60b4('0x42')](handleError(_0x2a00e1,null));};exports[_0x60b4('0x4b')]=function(_0x21a2f0,_0x21e81b,_0x2898ee){var _0x5c38f7={};var _0x405d7d={};var _0x5f1bca;var _0x368e95;return db[_0x60b4('0x2b')][_0x60b4('0x4c')]({'where':{'id':_0x21a2f0['params']['id']}})[_0x60b4('0x24')](handleEntityNotFound(_0x21e81b,null))[_0x60b4('0x24')](function(_0x195ad9){if(_0x195ad9){_0x5f1bca=_0x195ad9;_0x405d7d['model']=_['keys'](db[_0x60b4('0x4d')][_0x60b4('0x2c')]);_0x405d7d[_0x60b4('0x31')]=_[_0x60b4('0x45')](_0x21a2f0['query']);_0x405d7d[_0x60b4('0x32')]=_[_0x60b4('0x33')](_0x405d7d[_0x60b4('0x2f')],_0x405d7d['query']);_0x5c38f7[_0x60b4('0x35')]=_[_0x60b4('0x33')](_0x405d7d[_0x60b4('0x2f')],qs['fields'](_0x21a2f0[_0x60b4('0x31')][_0x60b4('0x34')]));_0x5c38f7[_0x60b4('0x35')]=_0x5c38f7['attributes'][_0x60b4('0x36')]?_0x5c38f7[_0x60b4('0x35')]:_0x405d7d[_0x60b4('0x2f')];_0x5c38f7[_0x60b4('0x38')]=qs['sort'](_0x21a2f0[_0x60b4('0x31')][_0x60b4('0x39')]);_0x5c38f7[_0x60b4('0x3a')]=qs['filters'](_[_0x60b4('0x3b')](_0x21a2f0[_0x60b4('0x31')],_0x405d7d[_0x60b4('0x32')]));if(_0x21a2f0[_0x60b4('0x31')][_0x60b4('0x3e')]){_0x5c38f7[_0x60b4('0x3a')]=_[_0x60b4('0x3c')](_0x5c38f7[_0x60b4('0x3a')],{'$or':_['map'](_0x5c38f7['attributes'],function(_0xe52c98){var _0x4e5cbb={};_0x4e5cbb[_0xe52c98]={'$like':'%'+_0x21a2f0[_0x60b4('0x31')][_0x60b4('0x3e')]+'%'};return _0x4e5cbb;})});}_0x5c38f7=_[_0x60b4('0x3c')]({},_0x5c38f7,_0x21a2f0[_0x60b4('0x46')]);return _0x5f1bca[_0x60b4('0x4b')](_0x5c38f7);}})[_0x60b4('0x24')](function(_0x5778cf){if(_0x5778cf){_0x368e95=_0x5778cf[_0x60b4('0x36')];if(!_0x21a2f0[_0x60b4('0x31')][_0x60b4('0x4e')](_0x60b4('0x37'))){_0x5c38f7['limit']=qs[_0x60b4('0x1e')](_0x21a2f0['query'][_0x60b4('0x1e')]);_0x5c38f7[_0x60b4('0x1b')]=qs[_0x60b4('0x1b')](_0x21a2f0[_0x60b4('0x31')][_0x60b4('0x1b')]);}return _0x5f1bca['getFields'](_0x5c38f7);}})[_0x60b4('0x24')](function(_0x5d325f){if(_0x5d325f){return _0x5d325f?{'count':_0x368e95,'rows':_0x5d325f}:null;}})[_0x60b4('0x24')](respondWithResult(_0x21e81b,null))[_0x60b4('0x42')](handleError(_0x21e81b,null));};exports[_0x60b4('0x4f')]=function(_0x221eb1,_0x2d094a,_0x826823){var _0x9c060d={};var _0x4fde0d={};var _0x1eca8d;var _0x8a4f7;return db[_0x60b4('0x2b')][_0x60b4('0x4c')]({'where':{'id':_0x221eb1['params']['id']}})[_0x60b4('0x24')](handleEntityNotFound(_0x2d094a,null))['then'](function(_0x597db5){if(_0x597db5){_0x1eca8d=_0x597db5;_0x4fde0d[_0x60b4('0x2f')]=_[_0x60b4('0x45')](db[_0x60b4('0x4d')]['rawAttributes']);_0x4fde0d[_0x60b4('0x31')]=_[_0x60b4('0x45')](_0x221eb1[_0x60b4('0x31')]);_0x4fde0d['filters']=_[_0x60b4('0x33')](_0x4fde0d['model'],_0x4fde0d[_0x60b4('0x31')]);_0x9c060d['attributes']=_[_0x60b4('0x33')](_0x4fde0d[_0x60b4('0x2f')],qs[_0x60b4('0x34')](_0x221eb1['query'][_0x60b4('0x34')]));_0x9c060d['attributes']=_0x9c060d['attributes']['length']?_0x9c060d[_0x60b4('0x35')]:_0x4fde0d[_0x60b4('0x2f')];_0x9c060d[_0x60b4('0x38')]=qs[_0x60b4('0x39')](_0x221eb1[_0x60b4('0x31')][_0x60b4('0x39')]);_0x9c060d[_0x60b4('0x3a')]=qs[_0x60b4('0x32')](_[_0x60b4('0x3b')](_0x221eb1[_0x60b4('0x31')],_0x4fde0d['filters']));if(_0x221eb1['query'][_0x60b4('0x3e')]){_0x9c060d['where']=_[_0x60b4('0x3c')](_0x9c060d['where'],{'$or':_[_0x60b4('0x30')](_0x9c060d['attributes'],function(_0x29c6b7){var _0x39c4ff={};_0x39c4ff[_0x29c6b7]={'$like':'%'+_0x221eb1[_0x60b4('0x31')]['filter']+'%'};return _0x39c4ff;})});}_0x9c060d=_[_0x60b4('0x3c')]({},_0x9c060d,_0x221eb1[_0x60b4('0x46')]);return _0x1eca8d['getSubjects'](_0x9c060d);}})[_0x60b4('0x24')](function(_0x303152){if(_0x303152){_0x8a4f7=_0x303152[_0x60b4('0x36')];if(!_0x221eb1[_0x60b4('0x31')]['hasOwnProperty'](_0x60b4('0x37'))){_0x9c060d[_0x60b4('0x1e')]=qs['limit'](_0x221eb1[_0x60b4('0x31')][_0x60b4('0x1e')]);_0x9c060d['offset']=qs[_0x60b4('0x1b')](_0x221eb1[_0x60b4('0x31')][_0x60b4('0x1b')]);}return _0x1eca8d[_0x60b4('0x4f')](_0x9c060d);}})[_0x60b4('0x24')](function(_0x1db9bf){if(_0x1db9bf){return _0x1db9bf?{'count':_0x8a4f7,'rows':_0x1db9bf}:null;}})['then'](respondWithResult(_0x2d094a,null))['catch'](handleError(_0x2d094a,null));};exports['getDescriptions']=function(_0x3ce2be,_0x4847b3,_0x51cc6b){var _0x590440={};var _0x59f119={};var _0x47fef3;var _0x22f1aa;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3ce2be[_0x60b4('0x44')]['id']}})[_0x60b4('0x24')](handleEntityNotFound(_0x4847b3,null))['then'](function(_0x3a2a46){if(_0x3a2a46){_0x47fef3=_0x3a2a46;_0x59f119[_0x60b4('0x2f')]=_[_0x60b4('0x45')](db[_0x60b4('0x4d')][_0x60b4('0x2c')]);_0x59f119['query']=_[_0x60b4('0x45')](_0x3ce2be[_0x60b4('0x31')]);_0x59f119[_0x60b4('0x32')]=_[_0x60b4('0x33')](_0x59f119[_0x60b4('0x2f')],_0x59f119[_0x60b4('0x31')]);_0x590440[_0x60b4('0x35')]=_[_0x60b4('0x33')](_0x59f119[_0x60b4('0x2f')],qs[_0x60b4('0x34')](_0x3ce2be[_0x60b4('0x31')][_0x60b4('0x34')]));_0x590440['attributes']=_0x590440[_0x60b4('0x35')][_0x60b4('0x36')]?_0x590440['attributes']:_0x59f119['model'];_0x590440[_0x60b4('0x38')]=qs[_0x60b4('0x39')](_0x3ce2be[_0x60b4('0x31')][_0x60b4('0x39')]);_0x590440['where']=qs[_0x60b4('0x32')](_[_0x60b4('0x3b')](_0x3ce2be['query'],_0x59f119[_0x60b4('0x32')]));if(_0x3ce2be[_0x60b4('0x31')]['filter']){_0x590440['where']=_['merge'](_0x590440[_0x60b4('0x3a')],{'$or':_[_0x60b4('0x30')](_0x590440['attributes'],function(_0x103f30){var _0x240c56={};_0x240c56[_0x103f30]={'$like':'%'+_0x3ce2be[_0x60b4('0x31')][_0x60b4('0x3e')]+'%'};return _0x240c56;})});}_0x590440=_[_0x60b4('0x3c')]({},_0x590440,_0x3ce2be['options']);return _0x47fef3[_0x60b4('0x50')](_0x590440);}})['then'](function(_0x409646){if(_0x409646){_0x22f1aa=_0x409646[_0x60b4('0x36')];if(!_0x3ce2be['query'][_0x60b4('0x4e')]('nolimit')){_0x590440[_0x60b4('0x1e')]=qs['limit'](_0x3ce2be[_0x60b4('0x31')][_0x60b4('0x1e')]);_0x590440[_0x60b4('0x1b')]=qs['offset'](_0x3ce2be[_0x60b4('0x31')][_0x60b4('0x1b')]);}return _0x47fef3['getDescriptions'](_0x590440);}})[_0x60b4('0x24')](function(_0x9be273){if(_0x9be273){return _0x9be273?{'count':_0x22f1aa,'rows':_0x9be273}:null;}})[_0x60b4('0x24')](respondWithResult(_0x4847b3,null))[_0x60b4('0x42')](handleError(_0x4847b3,null));};exports[_0x60b4('0x51')]=function(_0x1c59b0,_0x26a1ea,_0x24f47a){var _0x296a80={};var _0x18a596={};var _0x18d2fd;var _0x56dc4a;return db[_0x60b4('0x2b')]['findOne']({'where':{'id':_0x1c59b0[_0x60b4('0x44')]['id']}})[_0x60b4('0x24')](handleEntityNotFound(_0x26a1ea,null))[_0x60b4('0x24')](function(_0x570785){if(_0x570785){_0x18d2fd=_0x570785;_0x18a596[_0x60b4('0x2f')]=_['keys'](db['Tag'][_0x60b4('0x2c')]);_0x18a596['query']=_[_0x60b4('0x45')](_0x1c59b0[_0x60b4('0x31')]);_0x18a596[_0x60b4('0x32')]=_[_0x60b4('0x33')](_0x18a596[_0x60b4('0x2f')],_0x18a596[_0x60b4('0x31')]);_0x296a80[_0x60b4('0x35')]=_[_0x60b4('0x33')](_0x18a596[_0x60b4('0x2f')],qs[_0x60b4('0x34')](_0x1c59b0[_0x60b4('0x31')][_0x60b4('0x34')]));_0x296a80[_0x60b4('0x35')]=_0x296a80[_0x60b4('0x35')][_0x60b4('0x36')]?_0x296a80[_0x60b4('0x35')]:_0x18a596[_0x60b4('0x2f')];_0x296a80[_0x60b4('0x38')]=qs[_0x60b4('0x39')](_0x1c59b0['query'][_0x60b4('0x39')]);_0x296a80[_0x60b4('0x3a')]=qs[_0x60b4('0x32')](_['pick'](_0x1c59b0[_0x60b4('0x31')],_0x18a596[_0x60b4('0x32')]));if(_0x1c59b0['query']['filter']){_0x296a80['where']=_['merge'](_0x296a80[_0x60b4('0x3a')],{'$or':_[_0x60b4('0x30')](_0x296a80[_0x60b4('0x35')],function(_0x578347){var _0x279fc2={};_0x279fc2[_0x578347]={'$like':'%'+_0x1c59b0['query'][_0x60b4('0x3e')]+'%'};return _0x279fc2;})});}_0x296a80=_[_0x60b4('0x3c')]({},_0x296a80,_0x1c59b0[_0x60b4('0x46')]);return _0x18d2fd[_0x60b4('0x51')](_0x296a80);}})[_0x60b4('0x24')](function(_0x2339f9){if(_0x2339f9){_0x56dc4a=_0x2339f9[_0x60b4('0x36')];if(!_0x1c59b0[_0x60b4('0x31')]['hasOwnProperty'](_0x60b4('0x37'))){_0x296a80['limit']=qs['limit'](_0x1c59b0['query']['limit']);_0x296a80['offset']=qs[_0x60b4('0x1b')](_0x1c59b0['query']['offset']);}return _0x18d2fd[_0x60b4('0x51')](_0x296a80);}})['then'](function(_0x451bf2){if(_0x451bf2){return _0x451bf2?{'count':_0x56dc4a,'rows':_0x451bf2}:null;}})[_0x60b4('0x24')](respondWithResult(_0x26a1ea,null))['catch'](handleError(_0x26a1ea,null));};exports[_0x60b4('0x52')]=function(_0x2d9b9a,_0x13b74a,_0x4bff00){if(_0x2d9b9a[_0x60b4('0x49')]['id']){delete _0x2d9b9a['body']['id'];}return db[_0x60b4('0x2b')][_0x60b4('0x4c')]({'where':{'id':_0x2d9b9a[_0x60b4('0x44')]['id']}})[_0x60b4('0x24')](handleEntityNotFound(_0x13b74a,null))[_0x60b4('0x24')](function(_0x5693a1){if(_0x5693a1){return _0x5693a1[_0x60b4('0x52')](_0x2d9b9a[_0x60b4('0x49')][_0x60b4('0x53')]||[]);}return null;})[_0x60b4('0x24')](respondWithResult(_0x13b74a,null))[_0x60b4('0x42')](handleError(_0x13b74a,null));}; \ No newline at end of file +var _0x9f12=['../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','ZendeskConfiguration','include','findAll','rows','catch','show','includeAll','create','body','params','find','getFields','ZendeskField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils'];(function(_0x2a24bd,_0x4bdb5b){var _0x5d7d83=function(_0x394a36){while(--_0x394a36){_0x2a24bd['push'](_0x2a24bd['shift']());}};_0x5d7d83(++_0x4bdb5b);}(_0x9f12,0xe2));var _0x29f1=function(_0x4c08a2,_0x3c808f){_0x4c08a2=_0x4c08a2-0x0;var _0x1f1fd6=_0x9f12[_0x4c08a2];return _0x1f1fd6;};'use strict';var emlformat=require(_0x29f1('0x0'));var rimraf=require(_0x29f1('0x1'));var zipdir=require(_0x29f1('0x2'));var jsonpatch=require(_0x29f1('0x3'));var rp=require(_0x29f1('0x4'));var moment=require(_0x29f1('0x5'));var BPromise=require(_0x29f1('0x6'));var Mustache=require(_0x29f1('0x7'));var util=require('util');var path=require(_0x29f1('0x8'));var sox=require(_0x29f1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f1('0xa'));var _=require(_0x29f1('0xb'));var squel=require(_0x29f1('0xc'));var crypto=require(_0x29f1('0xd'));var jsforce=require(_0x29f1('0xe'));var deskjs=require(_0x29f1('0xf'));var toCsv=require(_0x29f1('0x10'));var querystring=require(_0x29f1('0x11'));var Papa=require('papaparse');var Redis=require(_0x29f1('0x12'));var authService=require(_0x29f1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x29f1('0x14'))(_0x29f1('0x15'));var utils=require(_0x29f1('0x16'));var config=require(_0x29f1('0x17'));var licenseUtil=require(_0x29f1('0x18'));var db=require(_0x29f1('0x19'))['db'];function respondWithStatusCode(_0x433d1a,_0x222042){_0x222042=_0x222042||0xcc;return function(_0x203b85){if(_0x203b85){return _0x433d1a['sendStatus'](_0x222042);}return _0x433d1a[_0x29f1('0x1a')](_0x222042)[_0x29f1('0x1b')]();};}function respondWithResult(_0x228416,_0x4401df){_0x4401df=_0x4401df||0xc8;return function(_0x396c86){if(_0x396c86){return _0x228416['status'](_0x4401df)['json'](_0x396c86);}};}function respondWithFilteredResult(_0x280404,_0x445166){return function(_0x5d01cb){if(_0x5d01cb){var _0x5c95ba=typeof _0x445166[_0x29f1('0x1c')]===_0x29f1('0x1d')&&typeof _0x445166[_0x29f1('0x1e')]===_0x29f1('0x1d');var _0x58f11d=_0x5d01cb[_0x29f1('0x1f')];var _0x261676=_0x5c95ba?0x0:_0x445166[_0x29f1('0x1c')];var _0x42c194=_0x5c95ba?_0x5d01cb[_0x29f1('0x1f')]:_0x445166[_0x29f1('0x1c')]+_0x445166[_0x29f1('0x1e')];var _0x2d4a88;if(_0x42c194>=_0x58f11d){_0x42c194=_0x58f11d;_0x2d4a88=0xc8;}else{_0x2d4a88=0xce;}_0x280404[_0x29f1('0x1a')](_0x2d4a88);return _0x280404[_0x29f1('0x20')](_0x29f1('0x21'),_0x261676+'-'+_0x42c194+'/'+_0x58f11d)[_0x29f1('0x22')](_0x5d01cb);}return null;};}function patchUpdates(_0x14c19c){return function(_0xd525c8){try{jsonpatch['apply'](_0xd525c8,_0x14c19c,!![]);}catch(_0x30c97f){return BPromise[_0x29f1('0x23')](_0x30c97f);}return _0xd525c8['save']();};}function saveUpdates(_0x2988e1,_0x44ebad){return function(_0x514959){if(_0x514959){return _0x514959[_0x29f1('0x24')](_0x2988e1)[_0x29f1('0x25')](function(_0x3aec33){return _0x3aec33;});}return null;};}function removeEntity(_0x361cc7,_0x67a347){return function(_0x4ca98f){if(_0x4ca98f){return _0x4ca98f[_0x29f1('0x26')]()[_0x29f1('0x25')](function(){_0x361cc7[_0x29f1('0x1a')](0xcc)[_0x29f1('0x1b')]();});}};}function handleEntityNotFound(_0x4b0d4d,_0x3c0c65){return function(_0x3c7736){if(!_0x3c7736){_0x4b0d4d[_0x29f1('0x27')](0x194);}return _0x3c7736;};}function handleError(_0x204179,_0xbad19d){_0xbad19d=_0xbad19d||0x1f4;return function(_0x467bab){logger['error'](_0x467bab[_0x29f1('0x28')]);if(_0x467bab[_0x29f1('0x29')]){delete _0x467bab['name'];}_0x204179[_0x29f1('0x1a')](_0xbad19d)['send'](_0x467bab);};}exports[_0x29f1('0x2a')]=function(_0x5145e5,_0x2f8cf7){var _0x2e29ca={},_0x1dfce1={},_0x24da16={'count':0x0,'rows':[]};var _0x27efec=_[_0x29f1('0x2b')](db['ZendeskConfiguration'][_0x29f1('0x2c')],function(_0x177fc1){return{'name':_0x177fc1['fieldName'],'type':_0x177fc1[_0x29f1('0x2d')]['key']};});_0x1dfce1[_0x29f1('0x2e')]=_[_0x29f1('0x2b')](_0x27efec,_0x29f1('0x29'));_0x1dfce1['query']=_[_0x29f1('0x2f')](_0x5145e5[_0x29f1('0x30')]);_0x1dfce1[_0x29f1('0x31')]=_['intersection'](_0x1dfce1[_0x29f1('0x2e')],_0x1dfce1[_0x29f1('0x30')]);_0x2e29ca[_0x29f1('0x32')]=_[_0x29f1('0x33')](_0x1dfce1[_0x29f1('0x2e')],qs[_0x29f1('0x34')](_0x5145e5[_0x29f1('0x30')]['fields']));_0x2e29ca[_0x29f1('0x32')]=_0x2e29ca[_0x29f1('0x32')][_0x29f1('0x35')]?_0x2e29ca['attributes']:_0x1dfce1[_0x29f1('0x2e')];if(!_0x5145e5[_0x29f1('0x30')]['hasOwnProperty'](_0x29f1('0x36'))){_0x2e29ca['limit']=qs[_0x29f1('0x1e')](_0x5145e5[_0x29f1('0x30')][_0x29f1('0x1e')]);_0x2e29ca['offset']=qs[_0x29f1('0x1c')](_0x5145e5[_0x29f1('0x30')]['offset']);}_0x2e29ca['order']=qs[_0x29f1('0x37')](_0x5145e5[_0x29f1('0x30')][_0x29f1('0x37')]);_0x2e29ca[_0x29f1('0x38')]=qs[_0x29f1('0x31')](_[_0x29f1('0x39')](_0x5145e5['query'],_0x1dfce1[_0x29f1('0x31')]),_0x27efec);if(_0x5145e5[_0x29f1('0x30')]['filter']){_0x2e29ca[_0x29f1('0x38')]=_['merge'](_0x2e29ca['where'],{'$or':_[_0x29f1('0x2b')](_0x27efec,function(_0x65cab1){if(_0x65cab1[_0x29f1('0x2d')]!==_0x29f1('0x3a')){var _0x5b7162={};_0x5b7162[_0x65cab1[_0x29f1('0x29')]]={'$like':'%'+_0x5145e5[_0x29f1('0x30')][_0x29f1('0x3b')]+'%'};return _0x5b7162;}})});}_0x2e29ca=_[_0x29f1('0x3c')]({},_0x2e29ca,_0x5145e5[_0x29f1('0x3d')]);var _0x38682e={'where':_0x2e29ca['where']};return db[_0x29f1('0x3e')]['count'](_0x38682e)[_0x29f1('0x25')](function(_0x5b7fb9){_0x24da16['count']=_0x5b7fb9;if(_0x5145e5[_0x29f1('0x30')]['includeAll']){_0x2e29ca[_0x29f1('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x29f1('0x40')](_0x2e29ca);})[_0x29f1('0x25')](function(_0x5546c5){_0x24da16[_0x29f1('0x41')]=_0x5546c5;return _0x24da16;})['then'](respondWithFilteredResult(_0x2f8cf7,_0x2e29ca))[_0x29f1('0x42')](handleError(_0x2f8cf7,null));};exports[_0x29f1('0x43')]=function(_0x1ca7f9,_0x139175){var _0x4b632b={'raw':![],'where':{'id':_0x1ca7f9['params']['id']}},_0x1ca942={};_0x1ca942[_0x29f1('0x2e')]=_[_0x29f1('0x2f')](db[_0x29f1('0x3e')]['rawAttributes']);_0x1ca942[_0x29f1('0x30')]=_['keys'](_0x1ca7f9[_0x29f1('0x30')]);_0x1ca942[_0x29f1('0x31')]=_['intersection'](_0x1ca942[_0x29f1('0x2e')],_0x1ca942[_0x29f1('0x30')]);_0x4b632b['attributes']=_['intersection'](_0x1ca942[_0x29f1('0x2e')],qs[_0x29f1('0x34')](_0x1ca7f9[_0x29f1('0x30')][_0x29f1('0x34')]));_0x4b632b[_0x29f1('0x32')]=_0x4b632b[_0x29f1('0x32')]['length']?_0x4b632b[_0x29f1('0x32')]:_0x1ca942[_0x29f1('0x2e')];if(_0x1ca7f9['query'][_0x29f1('0x44')]){_0x4b632b[_0x29f1('0x3f')]=[{'all':!![]}];}_0x4b632b=_[_0x29f1('0x3c')]({},_0x4b632b,_0x1ca7f9['options']);return db['ZendeskConfiguration']['find'](_0x4b632b)[_0x29f1('0x25')](handleEntityNotFound(_0x139175,null))[_0x29f1('0x25')](respondWithResult(_0x139175,null))[_0x29f1('0x42')](handleError(_0x139175,null));};exports[_0x29f1('0x45')]=function(_0xec4acc,_0xb4d9c7){return db[_0x29f1('0x3e')][_0x29f1('0x45')](_0xec4acc[_0x29f1('0x46')],{})[_0x29f1('0x25')](respondWithResult(_0xb4d9c7,0xc9))[_0x29f1('0x42')](handleError(_0xb4d9c7,null));};exports['update']=function(_0x3044cd,_0x4df749){if(_0x3044cd['body']['id']){delete _0x3044cd['body']['id'];}return db[_0x29f1('0x3e')]['find']({'where':{'id':_0x3044cd[_0x29f1('0x47')]['id']}})['then'](handleEntityNotFound(_0x4df749,null))[_0x29f1('0x25')](saveUpdates(_0x3044cd[_0x29f1('0x46')],null))[_0x29f1('0x25')](respondWithResult(_0x4df749,null))['catch'](handleError(_0x4df749,null));};exports[_0x29f1('0x26')]=function(_0x3e13c5,_0x4e0c94){return db[_0x29f1('0x3e')][_0x29f1('0x48')]({'where':{'id':_0x3e13c5[_0x29f1('0x47')]['id']}})[_0x29f1('0x25')](handleEntityNotFound(_0x4e0c94,null))['then'](removeEntity(_0x4e0c94,null))['catch'](handleError(_0x4e0c94,null));};exports[_0x29f1('0x49')]=function(_0x267ceb,_0x506096,_0x3d97a1){var _0x8375e1={};var _0x5bdfbd={};var _0xae65a6;var _0xf38c01;return db[_0x29f1('0x3e')]['findOne']({'where':{'id':_0x267ceb[_0x29f1('0x47')]['id']}})[_0x29f1('0x25')](handleEntityNotFound(_0x506096,null))[_0x29f1('0x25')](function(_0x43f40a){if(_0x43f40a){_0xae65a6=_0x43f40a;_0x5bdfbd[_0x29f1('0x2e')]=_[_0x29f1('0x2f')](db[_0x29f1('0x4a')][_0x29f1('0x2c')]);_0x5bdfbd['query']=_[_0x29f1('0x2f')](_0x267ceb['query']);_0x5bdfbd['filters']=_[_0x29f1('0x33')](_0x5bdfbd['model'],_0x5bdfbd['query']);_0x8375e1[_0x29f1('0x32')]=_[_0x29f1('0x33')](_0x5bdfbd[_0x29f1('0x2e')],qs['fields'](_0x267ceb[_0x29f1('0x30')][_0x29f1('0x34')]));_0x8375e1['attributes']=_0x8375e1['attributes'][_0x29f1('0x35')]?_0x8375e1[_0x29f1('0x32')]:_0x5bdfbd[_0x29f1('0x2e')];_0x8375e1[_0x29f1('0x4b')]=qs[_0x29f1('0x37')](_0x267ceb[_0x29f1('0x30')][_0x29f1('0x37')]);_0x8375e1[_0x29f1('0x38')]=qs[_0x29f1('0x31')](_[_0x29f1('0x39')](_0x267ceb[_0x29f1('0x30')],_0x5bdfbd[_0x29f1('0x31')]));if(_0x267ceb[_0x29f1('0x30')][_0x29f1('0x3b')]){_0x8375e1[_0x29f1('0x38')]=_[_0x29f1('0x3c')](_0x8375e1[_0x29f1('0x38')],{'$or':_['map'](_0x8375e1[_0x29f1('0x32')],function(_0x5cd579){var _0x3abb18={};_0x3abb18[_0x5cd579]={'$like':'%'+_0x267ceb[_0x29f1('0x30')]['filter']+'%'};return _0x3abb18;})});}_0x8375e1=_[_0x29f1('0x3c')]({},_0x8375e1,_0x267ceb[_0x29f1('0x3d')]);return _0xae65a6[_0x29f1('0x49')](_0x8375e1);}})['then'](function(_0x3bb8ef){if(_0x3bb8ef){_0xf38c01=_0x3bb8ef[_0x29f1('0x35')];if(!_0x267ceb[_0x29f1('0x30')][_0x29f1('0x4c')]('nolimit')){_0x8375e1['limit']=qs[_0x29f1('0x1e')](_0x267ceb[_0x29f1('0x30')][_0x29f1('0x1e')]);_0x8375e1[_0x29f1('0x1c')]=qs['offset'](_0x267ceb[_0x29f1('0x30')][_0x29f1('0x1c')]);}return _0xae65a6[_0x29f1('0x49')](_0x8375e1);}})[_0x29f1('0x25')](function(_0x126bc8){if(_0x126bc8){return _0x126bc8?{'count':_0xf38c01,'rows':_0x126bc8}:null;}})[_0x29f1('0x25')](respondWithResult(_0x506096,null))[_0x29f1('0x42')](handleError(_0x506096,null));};exports[_0x29f1('0x4d')]=function(_0x6b5e3f,_0x312551,_0x2832c5){var _0x41885a={};var _0x42394a={};var _0x297ad6;var _0xc04d79;return db[_0x29f1('0x3e')][_0x29f1('0x4e')]({'where':{'id':_0x6b5e3f[_0x29f1('0x47')]['id']}})['then'](handleEntityNotFound(_0x312551,null))['then'](function(_0x2c351b){if(_0x2c351b){_0x297ad6=_0x2c351b;_0x42394a[_0x29f1('0x2e')]=_[_0x29f1('0x2f')](db[_0x29f1('0x4a')][_0x29f1('0x2c')]);_0x42394a[_0x29f1('0x30')]=_[_0x29f1('0x2f')](_0x6b5e3f[_0x29f1('0x30')]);_0x42394a[_0x29f1('0x31')]=_[_0x29f1('0x33')](_0x42394a['model'],_0x42394a[_0x29f1('0x30')]);_0x41885a[_0x29f1('0x32')]=_[_0x29f1('0x33')](_0x42394a[_0x29f1('0x2e')],qs[_0x29f1('0x34')](_0x6b5e3f[_0x29f1('0x30')][_0x29f1('0x34')]));_0x41885a[_0x29f1('0x32')]=_0x41885a[_0x29f1('0x32')][_0x29f1('0x35')]?_0x41885a['attributes']:_0x42394a[_0x29f1('0x2e')];_0x41885a[_0x29f1('0x4b')]=qs[_0x29f1('0x37')](_0x6b5e3f['query'][_0x29f1('0x37')]);_0x41885a[_0x29f1('0x38')]=qs[_0x29f1('0x31')](_[_0x29f1('0x39')](_0x6b5e3f['query'],_0x42394a['filters']));if(_0x6b5e3f[_0x29f1('0x30')]['filter']){_0x41885a[_0x29f1('0x38')]=_[_0x29f1('0x3c')](_0x41885a[_0x29f1('0x38')],{'$or':_[_0x29f1('0x2b')](_0x41885a['attributes'],function(_0x40dd25){var _0xab7997={};_0xab7997[_0x40dd25]={'$like':'%'+_0x6b5e3f['query'][_0x29f1('0x3b')]+'%'};return _0xab7997;})});}_0x41885a=_[_0x29f1('0x3c')]({},_0x41885a,_0x6b5e3f[_0x29f1('0x3d')]);return _0x297ad6[_0x29f1('0x4d')](_0x41885a);}})['then'](function(_0x56a608){if(_0x56a608){_0xc04d79=_0x56a608[_0x29f1('0x35')];if(!_0x6b5e3f[_0x29f1('0x30')]['hasOwnProperty'](_0x29f1('0x36'))){_0x41885a[_0x29f1('0x1e')]=qs['limit'](_0x6b5e3f['query'][_0x29f1('0x1e')]);_0x41885a[_0x29f1('0x1c')]=qs['offset'](_0x6b5e3f[_0x29f1('0x30')][_0x29f1('0x1c')]);}return _0x297ad6[_0x29f1('0x4d')](_0x41885a);}})[_0x29f1('0x25')](function(_0x59629a){if(_0x59629a){return _0x59629a?{'count':_0xc04d79,'rows':_0x59629a}:null;}})[_0x29f1('0x25')](respondWithResult(_0x312551,null))[_0x29f1('0x42')](handleError(_0x312551,null));};exports['getDescriptions']=function(_0x3ea066,_0x4aa06b,_0x5cb1fa){var _0xcb7471={};var _0x2af973={};var _0x1d49e1;var _0x260561;return db[_0x29f1('0x3e')]['findOne']({'where':{'id':_0x3ea066['params']['id']}})['then'](handleEntityNotFound(_0x4aa06b,null))['then'](function(_0x1a53c0){if(_0x1a53c0){_0x1d49e1=_0x1a53c0;_0x2af973[_0x29f1('0x2e')]=_[_0x29f1('0x2f')](db['ZendeskField'][_0x29f1('0x2c')]);_0x2af973['query']=_[_0x29f1('0x2f')](_0x3ea066[_0x29f1('0x30')]);_0x2af973[_0x29f1('0x31')]=_['intersection'](_0x2af973[_0x29f1('0x2e')],_0x2af973[_0x29f1('0x30')]);_0xcb7471[_0x29f1('0x32')]=_['intersection'](_0x2af973[_0x29f1('0x2e')],qs[_0x29f1('0x34')](_0x3ea066['query'][_0x29f1('0x34')]));_0xcb7471[_0x29f1('0x32')]=_0xcb7471[_0x29f1('0x32')][_0x29f1('0x35')]?_0xcb7471[_0x29f1('0x32')]:_0x2af973[_0x29f1('0x2e')];_0xcb7471[_0x29f1('0x4b')]=qs[_0x29f1('0x37')](_0x3ea066['query']['sort']);_0xcb7471[_0x29f1('0x38')]=qs[_0x29f1('0x31')](_[_0x29f1('0x39')](_0x3ea066[_0x29f1('0x30')],_0x2af973[_0x29f1('0x31')]));if(_0x3ea066['query']['filter']){_0xcb7471[_0x29f1('0x38')]=_[_0x29f1('0x3c')](_0xcb7471[_0x29f1('0x38')],{'$or':_['map'](_0xcb7471['attributes'],function(_0x43df90){var _0x435617={};_0x435617[_0x43df90]={'$like':'%'+_0x3ea066['query'][_0x29f1('0x3b')]+'%'};return _0x435617;})});}_0xcb7471=_[_0x29f1('0x3c')]({},_0xcb7471,_0x3ea066[_0x29f1('0x3d')]);return _0x1d49e1[_0x29f1('0x4f')](_0xcb7471);}})['then'](function(_0x4780f2){if(_0x4780f2){_0x260561=_0x4780f2[_0x29f1('0x35')];if(!_0x3ea066[_0x29f1('0x30')][_0x29f1('0x4c')]('nolimit')){_0xcb7471[_0x29f1('0x1e')]=qs[_0x29f1('0x1e')](_0x3ea066[_0x29f1('0x30')]['limit']);_0xcb7471[_0x29f1('0x1c')]=qs[_0x29f1('0x1c')](_0x3ea066[_0x29f1('0x30')][_0x29f1('0x1c')]);}return _0x1d49e1[_0x29f1('0x4f')](_0xcb7471);}})[_0x29f1('0x25')](function(_0x2ce676){if(_0x2ce676){return _0x2ce676?{'count':_0x260561,'rows':_0x2ce676}:null;}})['then'](respondWithResult(_0x4aa06b,null))['catch'](handleError(_0x4aa06b,null));};exports[_0x29f1('0x50')]=function(_0x222603,_0x7b8f66,_0x5b1409){var _0x420812={};var _0x1a5aad={};var _0x4b9dc3;var _0x3ede33;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x222603[_0x29f1('0x47')]['id']}})[_0x29f1('0x25')](handleEntityNotFound(_0x7b8f66,null))[_0x29f1('0x25')](function(_0x470d45){if(_0x470d45){_0x4b9dc3=_0x470d45;_0x1a5aad['model']=_['keys'](db[_0x29f1('0x51')]['rawAttributes']);_0x1a5aad[_0x29f1('0x30')]=_[_0x29f1('0x2f')](_0x222603[_0x29f1('0x30')]);_0x1a5aad[_0x29f1('0x31')]=_['intersection'](_0x1a5aad[_0x29f1('0x2e')],_0x1a5aad['query']);_0x420812['attributes']=_[_0x29f1('0x33')](_0x1a5aad[_0x29f1('0x2e')],qs['fields'](_0x222603['query'][_0x29f1('0x34')]));_0x420812[_0x29f1('0x32')]=_0x420812[_0x29f1('0x32')][_0x29f1('0x35')]?_0x420812[_0x29f1('0x32')]:_0x1a5aad[_0x29f1('0x2e')];_0x420812['order']=qs[_0x29f1('0x37')](_0x222603[_0x29f1('0x30')][_0x29f1('0x37')]);_0x420812['where']=qs[_0x29f1('0x31')](_[_0x29f1('0x39')](_0x222603[_0x29f1('0x30')],_0x1a5aad['filters']));if(_0x222603['query']['filter']){_0x420812[_0x29f1('0x38')]=_[_0x29f1('0x3c')](_0x420812[_0x29f1('0x38')],{'$or':_[_0x29f1('0x2b')](_0x420812[_0x29f1('0x32')],function(_0x37ce94){var _0x1026f0={};_0x1026f0[_0x37ce94]={'$like':'%'+_0x222603[_0x29f1('0x30')][_0x29f1('0x3b')]+'%'};return _0x1026f0;})});}_0x420812=_[_0x29f1('0x3c')]({},_0x420812,_0x222603[_0x29f1('0x3d')]);return _0x4b9dc3[_0x29f1('0x50')](_0x420812);}})[_0x29f1('0x25')](function(_0x2dcbbf){if(_0x2dcbbf){_0x3ede33=_0x2dcbbf[_0x29f1('0x35')];if(!_0x222603[_0x29f1('0x30')][_0x29f1('0x4c')](_0x29f1('0x36'))){_0x420812[_0x29f1('0x1e')]=qs['limit'](_0x222603[_0x29f1('0x30')][_0x29f1('0x1e')]);_0x420812['offset']=qs[_0x29f1('0x1c')](_0x222603[_0x29f1('0x30')][_0x29f1('0x1c')]);}return _0x4b9dc3[_0x29f1('0x50')](_0x420812);}})[_0x29f1('0x25')](function(_0x5aa37c){if(_0x5aa37c){return _0x5aa37c?{'count':_0x3ede33,'rows':_0x5aa37c}:null;}})[_0x29f1('0x25')](respondWithResult(_0x7b8f66,null))['catch'](handleError(_0x7b8f66,null));};exports['setTags']=function(_0x57172f,_0x3b6b34,_0x34b0ee){if(_0x57172f[_0x29f1('0x46')]['id']){delete _0x57172f[_0x29f1('0x46')]['id'];}return db[_0x29f1('0x3e')]['findOne']({'where':{'id':_0x57172f[_0x29f1('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b6b34,null))[_0x29f1('0x25')](function(_0x15b8b2){if(_0x15b8b2){return _0x15b8b2['setTags'](_0x57172f[_0x29f1('0x46')][_0x29f1('0x52')]||[]);}return null;})[_0x29f1('0x25')](respondWithResult(_0x3b6b34,null))[_0x29f1('0x42')](handleError(_0x3b6b34,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 69ff8ba..986a66d 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(_0x465f85,_0x5eaca4){var _0x2e8061=function(_0x4e2312){while(--_0x4e2312){_0x465f85['push'](_0x465f85['shift']());}};_0x2e8061(++_0x5eaca4);}(_0x282b,0xec));var _0xb282=function(_0x30cf6d,_0x305a4f){_0x30cf6d=_0x30cf6d-0x0;var _0x56e29c=_0x282b[_0x30cf6d];return _0x56e29c;};'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 _0x351d=['../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x43a3ce,_0x4190a3){var _0xe1a9eb=function(_0x2b9b81){while(--_0x2b9b81){_0x43a3ce['push'](_0x43a3ce['shift']());}};_0xe1a9eb(++_0x4190a3);}(_0x351d,0x90));var _0xd351=function(_0x1536f0,_0x287a17){_0x1536f0=_0x1536f0-0x0;var _0x3fc131=_0x351d[_0x1536f0];return _0x3fc131;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 5fce7dc..7c3acf8 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 _0xa275=['ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error'];(function(_0x56ea6f,_0x15535a){var _0x43ac31=function(_0x1b6d99){while(--_0x1b6d99){_0x56ea6f['push'](_0x56ea6f['shift']());}};_0x43ac31(++_0x15535a);}(_0xa275,0xcc));var _0x5a27=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa275[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5a27('0x0'));var util=require('util');var moment=require(_0x5a27('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a27('0x2'));var db=require(_0x5a27('0x3'))['db'];var utils=require(_0x5a27('0x4'));var logger=require(_0x5a27('0x5'))(_0x5a27('0x6'));var config=require(_0x5a27('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5a27('0x8')][_0x5a27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26354a,_0x42371a,_0x26060b){return new BPromise(function(_0xf0d279,_0x56acf7){return client[_0x5a27('0xa')](_0x26354a,_0x26060b)[_0x5a27('0xb')](function(_0xd52fe3){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x42371a,_0x5a27('0xc'));logger[_0x5a27('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x42371a,_0x5a27('0xc'),JSON[_0x5a27('0xe')](_0xd52fe3));if(_0xd52fe3['error']){if(_0xd52fe3[_0x5a27('0xf')]['code']===0x1f4){logger[_0x5a27('0xf')](_0x5a27('0x10'),_0x42371a,_0xd52fe3[_0x5a27('0xf')]['message']);return _0x56acf7(_0xd52fe3[_0x5a27('0xf')][_0x5a27('0x11')]);}logger[_0x5a27('0xf')](_0x5a27('0x10'),_0x42371a,_0xd52fe3[_0x5a27('0xf')][_0x5a27('0x11')]);return _0xf0d279(_0xd52fe3[_0x5a27('0xf')][_0x5a27('0x11')]);}else{logger['info'](_0x5a27('0x10'),_0x42371a,_0x5a27('0xc'));_0xf0d279(_0xd52fe3[_0x5a27('0x12')][_0x5a27('0x11')]);}})[_0x5a27('0x13')](function(_0x1fcd4d){logger['error'](_0x5a27('0x10'),_0x42371a,_0x1fcd4d);_0x56acf7(_0x1fcd4d);});});} \ No newline at end of file +var _0x33a6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x33a6,0x65));var _0x633a=function(_0x6fa9fa,_0x27e36f){_0x6fa9fa=_0x6fa9fa-0x0;var _0x1eafd8=_0x33a6[_0x6fa9fa];return _0x1eafd8;};'use strict';var _=require(_0x633a('0x0'));var util=require(_0x633a('0x1'));var moment=require(_0x633a('0x2'));var BPromise=require(_0x633a('0x3'));var rs=require(_0x633a('0x4'));var fs=require('fs');var Redis=require(_0x633a('0x5'));var db=require(_0x633a('0x6'))['db'];var utils=require(_0x633a('0x7'));var logger=require(_0x633a('0x8'))(_0x633a('0x9'));var config=require(_0x633a('0xa'));var jayson=require(_0x633a('0xb'));var client=jayson[_0x633a('0xc')][_0x633a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a0098,_0x2c29c5,_0x3761aa){return new BPromise(function(_0x2b55f0,_0x5bd38c){return client[_0x633a('0xe')](_0x1a0098,_0x3761aa)['then'](function(_0x51743d){logger[_0x633a('0xf')](_0x633a('0x10'),_0x2c29c5,_0x633a('0x11'));logger[_0x633a('0x12')](_0x633a('0x13'),_0x2c29c5,_0x633a('0x11'),JSON[_0x633a('0x14')](_0x51743d));if(_0x51743d[_0x633a('0x15')]){if(_0x51743d[_0x633a('0x15')][_0x633a('0x16')]===0x1f4){logger[_0x633a('0x15')](_0x633a('0x10'),_0x2c29c5,_0x51743d['error'][_0x633a('0x17')]);return _0x5bd38c(_0x51743d['error']['message']);}logger[_0x633a('0x15')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2c29c5,_0x51743d[_0x633a('0x15')]['message']);return _0x2b55f0(_0x51743d[_0x633a('0x15')][_0x633a('0x17')]);}else{logger[_0x633a('0xf')](_0x633a('0x10'),_0x2c29c5,_0x633a('0x11'));_0x2b55f0(_0x51743d[_0x633a('0x18')]['message']);}})[_0x633a('0x19')](function(_0x124d4b){logger['error'](_0x633a('0x10'),_0x2c29c5,_0x124d4b);_0x5bd38c(_0x124d4b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d736a03..d85abaf 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 _0x4a65=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4a65,0xd7));var _0x54a6=function(_0x531c45,_0x2fa53a){_0x531c45=_0x531c45-0x0;var _0x5f17e1=_0x4a65[_0x531c45];return _0x5f17e1;};'use strict';var multer=require(_0x54a6('0x0'));var util=require(_0x54a6('0x1'));var path=require(_0x54a6('0x2'));var timeout=require('connect-timeout');var express=require(_0x54a6('0x3'));var router=express[_0x54a6('0x4')]();var fs_extra=require(_0x54a6('0x5'));var auth=require(_0x54a6('0x6'));var interaction=require(_0x54a6('0x7'));var config=require(_0x54a6('0x8'));var controller=require(_0x54a6('0x9'));router[_0x54a6('0xa')]('/',auth['isAuthenticated'](),controller[_0x54a6('0xb')]);router['get'](_0x54a6('0xc'),auth[_0x54a6('0xd')](),controller[_0x54a6('0xe')]);router[_0x54a6('0xf')]('/',auth[_0x54a6('0xd')](),controller[_0x54a6('0x10')]);router[_0x54a6('0x11')](_0x54a6('0xc'),auth[_0x54a6('0xd')](),controller[_0x54a6('0x12')]);router[_0x54a6('0x13')]('/:id',auth[_0x54a6('0xd')](),controller[_0x54a6('0x14')]);module[_0x54a6('0x15')]=router; \ No newline at end of file +var _0x3060=['create','put','/:id','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show','post'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3060,0xb7));var _0x0306=function(_0x2f7ee1,_0x238541){_0x2f7ee1=_0x2f7ee1-0x0;var _0x298295=_0x3060[_0x2f7ee1];return _0x298295;};'use strict';var multer=require('multer');var util=require(_0x0306('0x0'));var path=require(_0x0306('0x1'));var timeout=require(_0x0306('0x2'));var express=require('express');var router=express[_0x0306('0x3')]();var fs_extra=require(_0x0306('0x4'));var auth=require(_0x0306('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0306('0x6'));var controller=require(_0x0306('0x7'));router[_0x0306('0x8')]('/',auth[_0x0306('0x9')](),controller['index']);router[_0x0306('0x8')]('/:id',auth[_0x0306('0x9')](),controller[_0x0306('0xa')]);router[_0x0306('0xb')]('/',auth[_0x0306('0x9')](),controller[_0x0306('0xc')]);router[_0x0306('0xd')](_0x0306('0xe'),auth[_0x0306('0x9')](),controller['update']);router['delete'](_0x0306('0xe'),auth[_0x0306('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d73af26..0100ba9 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 _0xb7a5=['customVariable','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb7a5,0x162));var _0x5b7a=function(_0x863c22,_0x3b1903){_0x863c22=_0x863c22-0x0;var _0x362aaa=_0xb7a5[_0x863c22];return _0x362aaa;};'use strict';var Sequelize=require(_0x5b7a('0x0'));module['exports']={'type':{'type':Sequelize[_0x5b7a('0x1')](_0x5b7a('0x2'),'variable',_0x5b7a('0x3'),'keyValue','picklist'),'defaultValue':_0x5b7a('0x2')},'content':{'type':Sequelize[_0x5b7a('0x4')]},'key':{'type':Sequelize[_0x5b7a('0x4')]},'keyType':{'type':Sequelize[_0x5b7a('0x1')](_0x5b7a('0x2'),_0x5b7a('0x5'),_0x5b7a('0x3'))},'keyContent':{'type':Sequelize[_0x5b7a('0x4')]},'idField':{'type':Sequelize[_0x5b7a('0x4')]},'nameField':{'type':Sequelize[_0x5b7a('0x4')]},'customField':{'type':Sequelize[_0x5b7a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5b7a('0x4')]}}; \ No newline at end of file +var _0xe38a=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist','string'];(function(_0x444d4d,_0x2ca1d8){var _0x32551e=function(_0xe88efc){while(--_0xe88efc){_0x444d4d['push'](_0x444d4d['shift']());}};_0x32551e(++_0x2ca1d8);}(_0xe38a,0x14f));var _0xae38=function(_0x33cf66,_0x30e414){_0x33cf66=_0x33cf66-0x0;var _0x3a400b=_0xe38a[_0x33cf66];return _0x3a400b;};'use strict';var Sequelize=require(_0xae38('0x0'));module[_0xae38('0x1')]={'type':{'type':Sequelize[_0xae38('0x2')]('string',_0xae38('0x3'),_0xae38('0x4'),'keyValue',_0xae38('0x5')),'defaultValue':_0xae38('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xae38('0x6'),_0xae38('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xae38('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xae38('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae38('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f48611c..11c2725 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 _0xa9bb=['set','apply','reject','save','update','then','destroy','error','stack','name','map','ZendeskField','rawAttributes','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','count','includeAll','include','findAll','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0xa9bb,0x1a0));var _0xba9b=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xa9bb[_0x35885a];return _0xe86249;};'use strict';var emlformat=require(_0xba9b('0x0'));var rimraf=require(_0xba9b('0x1'));var zipdir=require(_0xba9b('0x2'));var jsonpatch=require(_0xba9b('0x3'));var rp=require(_0xba9b('0x4'));var moment=require(_0xba9b('0x5'));var BPromise=require(_0xba9b('0x6'));var Mustache=require(_0xba9b('0x7'));var util=require(_0xba9b('0x8'));var path=require(_0xba9b('0x9'));var sox=require(_0xba9b('0xa'));var csv=require(_0xba9b('0xb'));var ejs=require(_0xba9b('0xc'));var fs=require('fs');var fs_extra=require(_0xba9b('0xd'));var _=require('lodash');var squel=require(_0xba9b('0xe'));var crypto=require('crypto');var jsforce=require(_0xba9b('0xf'));var deskjs=require(_0xba9b('0x10'));var toCsv=require(_0xba9b('0xb'));var querystring=require(_0xba9b('0x11'));var Papa=require(_0xba9b('0x12'));var Redis=require(_0xba9b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba9b('0x14'));var logger=require(_0xba9b('0x15'))(_0xba9b('0x16'));var utils=require(_0xba9b('0x17'));var config=require(_0xba9b('0x18'));var licenseUtil=require(_0xba9b('0x19'));var db=require(_0xba9b('0x1a'))['db'];function respondWithStatusCode(_0x134e26,_0x4f5541){_0x4f5541=_0x4f5541||0xcc;return function(_0x4dd7f8){if(_0x4dd7f8){return _0x134e26[_0xba9b('0x1b')](_0x4f5541);}return _0x134e26[_0xba9b('0x1c')](_0x4f5541)[_0xba9b('0x1d')]();};}function respondWithResult(_0x4416a1,_0x1c0fb8){_0x1c0fb8=_0x1c0fb8||0xc8;return function(_0x4a6b7f){if(_0x4a6b7f){return _0x4416a1['status'](_0x1c0fb8)[_0xba9b('0x1e')](_0x4a6b7f);}};}function respondWithFilteredResult(_0x5e3d00,_0x36815a){return function(_0x2c93cc){if(_0x2c93cc){var _0x1ddd7c=typeof _0x36815a[_0xba9b('0x1f')]===_0xba9b('0x20')&&typeof _0x36815a[_0xba9b('0x21')]===_0xba9b('0x20');var _0x1d9c44=_0x2c93cc['count'];var _0x411c06=_0x1ddd7c?0x0:_0x36815a[_0xba9b('0x1f')];var _0x1552cf=_0x1ddd7c?_0x2c93cc['count']:_0x36815a[_0xba9b('0x1f')]+_0x36815a['limit'];var _0x399cb8;if(_0x1552cf>=_0x1d9c44){_0x1552cf=_0x1d9c44;_0x399cb8=0xc8;}else{_0x399cb8=0xce;}_0x5e3d00['status'](_0x399cb8);return _0x5e3d00[_0xba9b('0x22')]('Content-Range',_0x411c06+'-'+_0x1552cf+'/'+_0x1d9c44)['json'](_0x2c93cc);}return null;};}function patchUpdates(_0x4d27ff){return function(_0x1943e8){try{jsonpatch[_0xba9b('0x23')](_0x1943e8,_0x4d27ff,!![]);}catch(_0x48f126){return BPromise[_0xba9b('0x24')](_0x48f126);}return _0x1943e8[_0xba9b('0x25')]();};}function saveUpdates(_0x33555e,_0x4d9188){return function(_0x2bfcb3){if(_0x2bfcb3){return _0x2bfcb3[_0xba9b('0x26')](_0x33555e)[_0xba9b('0x27')](function(_0x1d8cfc){return _0x1d8cfc;});}return null;};}function removeEntity(_0x439cd1,_0x3d1c7a){return function(_0x25e37a){if(_0x25e37a){return _0x25e37a[_0xba9b('0x28')]()['then'](function(){_0x439cd1[_0xba9b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1373bb,_0x5cbdc2){return function(_0x283969){if(!_0x283969){_0x1373bb[_0xba9b('0x1b')](0x194);}return _0x283969;};}function handleError(_0x511747,_0x28d305){_0x28d305=_0x28d305||0x1f4;return function(_0x2241d8){logger[_0xba9b('0x29')](_0x2241d8[_0xba9b('0x2a')]);if(_0x2241d8[_0xba9b('0x2b')]){delete _0x2241d8[_0xba9b('0x2b')];}_0x511747['status'](_0x28d305)['send'](_0x2241d8);};}exports['index']=function(_0x324f43,_0x34ea41){var _0x2d3639={},_0x11564b={},_0x22a8b4={'count':0x0,'rows':[]};var _0x2d0898=_[_0xba9b('0x2c')](db[_0xba9b('0x2d')][_0xba9b('0x2e')],function(_0x4221c1){return{'name':_0x4221c1['fieldName'],'type':_0x4221c1['type']['key']};});_0x11564b['model']=_[_0xba9b('0x2c')](_0x2d0898,'name');_0x11564b[_0xba9b('0x2f')]=_['keys'](_0x324f43[_0xba9b('0x2f')]);_0x11564b['filters']=_['intersection'](_0x11564b[_0xba9b('0x30')],_0x11564b['query']);_0x2d3639[_0xba9b('0x31')]=_[_0xba9b('0x32')](_0x11564b[_0xba9b('0x30')],qs[_0xba9b('0x33')](_0x324f43[_0xba9b('0x2f')][_0xba9b('0x33')]));_0x2d3639[_0xba9b('0x31')]=_0x2d3639[_0xba9b('0x31')][_0xba9b('0x34')]?_0x2d3639['attributes']:_0x11564b[_0xba9b('0x30')];if(!_0x324f43[_0xba9b('0x2f')][_0xba9b('0x35')](_0xba9b('0x36'))){_0x2d3639[_0xba9b('0x21')]=qs[_0xba9b('0x21')](_0x324f43['query'][_0xba9b('0x21')]);_0x2d3639[_0xba9b('0x1f')]=qs[_0xba9b('0x1f')](_0x324f43['query'][_0xba9b('0x1f')]);}_0x2d3639[_0xba9b('0x37')]=qs['sort'](_0x324f43[_0xba9b('0x2f')][_0xba9b('0x38')]);_0x2d3639[_0xba9b('0x39')]=qs[_0xba9b('0x3a')](_[_0xba9b('0x3b')](_0x324f43[_0xba9b('0x2f')],_0x11564b['filters']),_0x2d0898);if(_0x324f43[_0xba9b('0x2f')][_0xba9b('0x3c')]){_0x2d3639[_0xba9b('0x39')]=_[_0xba9b('0x3d')](_0x2d3639['where'],{'$or':_[_0xba9b('0x2c')](_0x2d0898,function(_0x142899){if(_0x142899[_0xba9b('0x3e')]!=='VIRTUAL'){var _0x5b07ae={};_0x5b07ae[_0x142899[_0xba9b('0x2b')]]={'$like':'%'+_0x324f43[_0xba9b('0x2f')][_0xba9b('0x3c')]+'%'};return _0x5b07ae;}})});}_0x2d3639=_[_0xba9b('0x3d')]({},_0x2d3639,_0x324f43[_0xba9b('0x3f')]);var _0x16b8e9={'where':_0x2d3639['where']};return db['ZendeskField'][_0xba9b('0x40')](_0x16b8e9)[_0xba9b('0x27')](function(_0x569fb3){_0x22a8b4[_0xba9b('0x40')]=_0x569fb3;if(_0x324f43['query'][_0xba9b('0x41')]){_0x2d3639[_0xba9b('0x42')]=[{'all':!![]}];}return db[_0xba9b('0x2d')][_0xba9b('0x43')](_0x2d3639);})[_0xba9b('0x27')](function(_0x3ff3b9){_0x22a8b4['rows']=_0x3ff3b9;return _0x22a8b4;})[_0xba9b('0x27')](respondWithFilteredResult(_0x34ea41,_0x2d3639))[_0xba9b('0x44')](handleError(_0x34ea41,null));};exports[_0xba9b('0x45')]=function(_0x779977,_0x84f03){var _0x4c041a={'raw':!![],'where':{'id':_0x779977['params']['id']}},_0x253a4f={};_0x253a4f[_0xba9b('0x30')]=_['keys'](db[_0xba9b('0x2d')][_0xba9b('0x2e')]);_0x253a4f['query']=_[_0xba9b('0x46')](_0x779977[_0xba9b('0x2f')]);_0x253a4f[_0xba9b('0x3a')]=_[_0xba9b('0x32')](_0x253a4f[_0xba9b('0x30')],_0x253a4f[_0xba9b('0x2f')]);_0x4c041a[_0xba9b('0x31')]=_[_0xba9b('0x32')](_0x253a4f[_0xba9b('0x30')],qs[_0xba9b('0x33')](_0x779977[_0xba9b('0x2f')][_0xba9b('0x33')]));_0x4c041a[_0xba9b('0x31')]=_0x4c041a[_0xba9b('0x31')][_0xba9b('0x34')]?_0x4c041a['attributes']:_0x253a4f[_0xba9b('0x30')];if(_0x779977[_0xba9b('0x2f')]['includeAll']){_0x4c041a[_0xba9b('0x42')]=[{'all':!![]}];}_0x4c041a=_[_0xba9b('0x3d')]({},_0x4c041a,_0x779977[_0xba9b('0x3f')]);return db[_0xba9b('0x2d')][_0xba9b('0x47')](_0x4c041a)['then'](handleEntityNotFound(_0x84f03,null))[_0xba9b('0x27')](respondWithResult(_0x84f03,null))['catch'](handleError(_0x84f03,null));};exports[_0xba9b('0x48')]=function(_0x7a5a62,_0x11f91b){return db[_0xba9b('0x2d')][_0xba9b('0x48')](_0x7a5a62['body'],{})[_0xba9b('0x27')](respondWithResult(_0x11f91b,0xc9))[_0xba9b('0x44')](handleError(_0x11f91b,null));};exports[_0xba9b('0x26')]=function(_0x11bcd9,_0x250fb1){if(_0x11bcd9['body']['id']){delete _0x11bcd9[_0xba9b('0x49')]['id'];}return db[_0xba9b('0x2d')][_0xba9b('0x47')]({'where':{'id':_0x11bcd9[_0xba9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x250fb1,null))[_0xba9b('0x27')](saveUpdates(_0x11bcd9[_0xba9b('0x49')],null))['then'](respondWithResult(_0x250fb1,null))[_0xba9b('0x44')](handleError(_0x250fb1,null));};exports[_0xba9b('0x28')]=function(_0x3249e6,_0x330866){return db['ZendeskField'][_0xba9b('0x47')]({'where':{'id':_0x3249e6[_0xba9b('0x4a')]['id']}})[_0xba9b('0x27')](handleEntityNotFound(_0x330866,null))['then'](removeEntity(_0x330866,null))['catch'](handleError(_0x330866,null));}; \ No newline at end of file +var _0x00da=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x4c453a,_0xa400f2){var _0xdfb18b=function(_0x21fe86){while(--_0x21fe86){_0x4c453a['push'](_0x4c453a['shift']());}};_0xdfb18b(++_0xa400f2);}(_0x00da,0x1f0));var _0xa00d=function(_0x262c6b,_0x1a02ec){_0x262c6b=_0x262c6b-0x0;var _0x18d991=_0x00da[_0x262c6b];return _0x18d991;};'use strict';var emlformat=require(_0xa00d('0x0'));var rimraf=require(_0xa00d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa00d('0x2'));var rp=require(_0xa00d('0x3'));var moment=require('moment');var BPromise=require(_0xa00d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa00d('0x5'));var sox=require('sox');var csv=require(_0xa00d('0x6'));var ejs=require(_0xa00d('0x7'));var fs=require('fs');var fs_extra=require(_0xa00d('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa00d('0x9'));var deskjs=require(_0xa00d('0xa'));var toCsv=require(_0xa00d('0x6'));var querystring=require(_0xa00d('0xb'));var Papa=require(_0xa00d('0xc'));var Redis=require('ioredis');var authService=require(_0xa00d('0xd'));var qs=require(_0xa00d('0xe'));var as=require(_0xa00d('0xf'));var hardwareService=require(_0xa00d('0x10'));var logger=require('../../config/logger')(_0xa00d('0x11'));var utils=require(_0xa00d('0x12'));var config=require(_0xa00d('0x13'));var licenseUtil=require(_0xa00d('0x14'));var db=require(_0xa00d('0x15'))['db'];function respondWithStatusCode(_0x4af0a2,_0xf12d36){_0xf12d36=_0xf12d36||0xcc;return function(_0x4adcc4){if(_0x4adcc4){return _0x4af0a2[_0xa00d('0x16')](_0xf12d36);}return _0x4af0a2[_0xa00d('0x17')](_0xf12d36)['end']();};}function respondWithResult(_0x2f30be,_0x1e9a09){_0x1e9a09=_0x1e9a09||0xc8;return function(_0x40081a){if(_0x40081a){return _0x2f30be['status'](_0x1e9a09)[_0xa00d('0x18')](_0x40081a);}};}function respondWithFilteredResult(_0x2a925b,_0x391c10){return function(_0x4e5b8c){if(_0x4e5b8c){var _0x5c3b10=typeof _0x391c10[_0xa00d('0x19')]===_0xa00d('0x1a')&&typeof _0x391c10[_0xa00d('0x1b')]===_0xa00d('0x1a');var _0x53e50a=_0x4e5b8c[_0xa00d('0x1c')];var _0x387232=_0x5c3b10?0x0:_0x391c10['offset'];var _0x33808a=_0x5c3b10?_0x4e5b8c[_0xa00d('0x1c')]:_0x391c10[_0xa00d('0x19')]+_0x391c10[_0xa00d('0x1b')];var _0x56bc29;if(_0x33808a>=_0x53e50a){_0x33808a=_0x53e50a;_0x56bc29=0xc8;}else{_0x56bc29=0xce;}_0x2a925b['status'](_0x56bc29);return _0x2a925b[_0xa00d('0x1d')](_0xa00d('0x1e'),_0x387232+'-'+_0x33808a+'/'+_0x53e50a)[_0xa00d('0x18')](_0x4e5b8c);}return null;};}function patchUpdates(_0x57d5fa){return function(_0x5bb69e){try{jsonpatch[_0xa00d('0x1f')](_0x5bb69e,_0x57d5fa,!![]);}catch(_0x26ca1c){return BPromise[_0xa00d('0x20')](_0x26ca1c);}return _0x5bb69e['save']();};}function saveUpdates(_0x1592dc,_0x8145ab){return function(_0x43fc2a){if(_0x43fc2a){return _0x43fc2a['update'](_0x1592dc)[_0xa00d('0x21')](function(_0x203772){return _0x203772;});}return null;};}function removeEntity(_0x3a2700,_0x5aa834){return function(_0x1e7935){if(_0x1e7935){return _0x1e7935[_0xa00d('0x22')]()[_0xa00d('0x21')](function(){_0x3a2700[_0xa00d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c741b,_0x323f06){return function(_0x42a890){if(!_0x42a890){_0x2c741b[_0xa00d('0x16')](0x194);}return _0x42a890;};}function handleError(_0x10e21f,_0x1ed4cd){_0x1ed4cd=_0x1ed4cd||0x1f4;return function(_0x219d2b){logger[_0xa00d('0x23')](_0x219d2b['stack']);if(_0x219d2b[_0xa00d('0x24')]){delete _0x219d2b[_0xa00d('0x24')];}_0x10e21f[_0xa00d('0x17')](_0x1ed4cd)[_0xa00d('0x25')](_0x219d2b);};}exports[_0xa00d('0x26')]=function(_0x1917f2,_0x48205b){var _0x547116={},_0x1a999c={},_0x29f3fe={'count':0x0,'rows':[]};var _0x5bb46e=_['map'](db[_0xa00d('0x27')][_0xa00d('0x28')],function(_0x5dad20){return{'name':_0x5dad20[_0xa00d('0x29')],'type':_0x5dad20[_0xa00d('0x2a')][_0xa00d('0x2b')]};});_0x1a999c[_0xa00d('0x2c')]=_[_0xa00d('0x2d')](_0x5bb46e,_0xa00d('0x24'));_0x1a999c[_0xa00d('0x2e')]=_['keys'](_0x1917f2[_0xa00d('0x2e')]);_0x1a999c[_0xa00d('0x2f')]=_[_0xa00d('0x30')](_0x1a999c[_0xa00d('0x2c')],_0x1a999c[_0xa00d('0x2e')]);_0x547116[_0xa00d('0x31')]=_[_0xa00d('0x30')](_0x1a999c['model'],qs[_0xa00d('0x32')](_0x1917f2[_0xa00d('0x2e')][_0xa00d('0x32')]));_0x547116[_0xa00d('0x31')]=_0x547116[_0xa00d('0x31')][_0xa00d('0x33')]?_0x547116[_0xa00d('0x31')]:_0x1a999c['model'];if(!_0x1917f2['query'][_0xa00d('0x34')](_0xa00d('0x35'))){_0x547116['limit']=qs[_0xa00d('0x1b')](_0x1917f2[_0xa00d('0x2e')]['limit']);_0x547116[_0xa00d('0x19')]=qs['offset'](_0x1917f2[_0xa00d('0x2e')][_0xa00d('0x19')]);}_0x547116[_0xa00d('0x36')]=qs[_0xa00d('0x37')](_0x1917f2[_0xa00d('0x2e')][_0xa00d('0x37')]);_0x547116[_0xa00d('0x38')]=qs[_0xa00d('0x2f')](_[_0xa00d('0x39')](_0x1917f2[_0xa00d('0x2e')],_0x1a999c[_0xa00d('0x2f')]),_0x5bb46e);if(_0x1917f2[_0xa00d('0x2e')][_0xa00d('0x3a')]){_0x547116[_0xa00d('0x38')]=_[_0xa00d('0x3b')](_0x547116[_0xa00d('0x38')],{'$or':_[_0xa00d('0x2d')](_0x5bb46e,function(_0x30cb32){if(_0x30cb32['type']!==_0xa00d('0x3c')){var _0x40c482={};_0x40c482[_0x30cb32[_0xa00d('0x24')]]={'$like':'%'+_0x1917f2[_0xa00d('0x2e')][_0xa00d('0x3a')]+'%'};return _0x40c482;}})});}_0x547116=_['merge']({},_0x547116,_0x1917f2[_0xa00d('0x3d')]);var _0x5772cf={'where':_0x547116[_0xa00d('0x38')]};return db[_0xa00d('0x27')][_0xa00d('0x1c')](_0x5772cf)['then'](function(_0x39f670){_0x29f3fe[_0xa00d('0x1c')]=_0x39f670;if(_0x1917f2[_0xa00d('0x2e')][_0xa00d('0x3e')]){_0x547116[_0xa00d('0x3f')]=[{'all':!![]}];}return db[_0xa00d('0x27')][_0xa00d('0x40')](_0x547116);})[_0xa00d('0x21')](function(_0xa0280e){_0x29f3fe[_0xa00d('0x41')]=_0xa0280e;return _0x29f3fe;})[_0xa00d('0x21')](respondWithFilteredResult(_0x48205b,_0x547116))[_0xa00d('0x42')](handleError(_0x48205b,null));};exports['show']=function(_0x4cb2eb,_0x1225a2){var _0x96fe84={'raw':!![],'where':{'id':_0x4cb2eb[_0xa00d('0x43')]['id']}},_0x4a9a31={};_0x4a9a31['model']=_[_0xa00d('0x44')](db['ZendeskField'][_0xa00d('0x28')]);_0x4a9a31[_0xa00d('0x2e')]=_[_0xa00d('0x44')](_0x4cb2eb[_0xa00d('0x2e')]);_0x4a9a31['filters']=_['intersection'](_0x4a9a31[_0xa00d('0x2c')],_0x4a9a31[_0xa00d('0x2e')]);_0x96fe84[_0xa00d('0x31')]=_[_0xa00d('0x30')](_0x4a9a31[_0xa00d('0x2c')],qs[_0xa00d('0x32')](_0x4cb2eb[_0xa00d('0x2e')][_0xa00d('0x32')]));_0x96fe84[_0xa00d('0x31')]=_0x96fe84[_0xa00d('0x31')][_0xa00d('0x33')]?_0x96fe84[_0xa00d('0x31')]:_0x4a9a31[_0xa00d('0x2c')];if(_0x4cb2eb[_0xa00d('0x2e')]['includeAll']){_0x96fe84[_0xa00d('0x3f')]=[{'all':!![]}];}_0x96fe84=_[_0xa00d('0x3b')]({},_0x96fe84,_0x4cb2eb['options']);return db[_0xa00d('0x27')][_0xa00d('0x45')](_0x96fe84)['then'](handleEntityNotFound(_0x1225a2,null))[_0xa00d('0x21')](respondWithResult(_0x1225a2,null))[_0xa00d('0x42')](handleError(_0x1225a2,null));};exports[_0xa00d('0x46')]=function(_0x506703,_0x5a1b68){return db[_0xa00d('0x27')][_0xa00d('0x46')](_0x506703['body'],{})['then'](respondWithResult(_0x5a1b68,0xc9))[_0xa00d('0x42')](handleError(_0x5a1b68,null));};exports[_0xa00d('0x47')]=function(_0xa8f68,_0x51f521){if(_0xa8f68[_0xa00d('0x48')]['id']){delete _0xa8f68[_0xa00d('0x48')]['id'];}return db['ZendeskField'][_0xa00d('0x45')]({'where':{'id':_0xa8f68[_0xa00d('0x43')]['id']}})[_0xa00d('0x21')](handleEntityNotFound(_0x51f521,null))[_0xa00d('0x21')](saveUpdates(_0xa8f68['body'],null))[_0xa00d('0x21')](respondWithResult(_0x51f521,null))[_0xa00d('0x42')](handleError(_0x51f521,null));};exports['destroy']=function(_0x4afe47,_0x53db42){return db['ZendeskField'][_0xa00d('0x45')]({'where':{'id':_0x4afe47[_0xa00d('0x43')]['id']}})[_0xa00d('0x21')](handleEntityNotFound(_0x53db42,null))[_0xa00d('0x21')](removeEntity(_0x53db42,null))[_0xa00d('0x42')](handleError(_0x53db42,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a4311da..51c711a 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 _0xb968=['ZendeskField','int_zendesk_fields','idField','FieldId','util','api','moment','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x37bab4,_0x4fa85e){var _0x336d20=function(_0xdd4ab8){while(--_0xdd4ab8){_0x37bab4['push'](_0x37bab4['shift']());}};_0x336d20(++_0x4fa85e);}(_0xb968,0x1d8));var _0x8b96=function(_0x4490cf,_0x166f71){_0x4490cf=_0x4490cf-0x0;var _0x5b171b=_0xb968[_0x4490cf];return _0x5b171b;};'use strict';var _=require('lodash');var util=require(_0x8b96('0x0'));var logger=require('../../config/logger')(_0x8b96('0x1'));var moment=require(_0x8b96('0x2'));var BPromise=require(_0x8b96('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b96('0x4'));var config=require(_0x8b96('0x5'));var attributes=require(_0x8b96('0x6'));module[_0x8b96('0x7')]=function(_0x378f16,_0x3c6254){return _0x378f16[_0x8b96('0x8')](_0x8b96('0x9'),attributes,{'tableName':_0x8b96('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x8b96('0xb'),_0x8b96('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd24b=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId'];(function(_0x361a1b,_0x380b14){var _0x193011=function(_0x37ffe6){while(--_0x37ffe6){_0x361a1b['push'](_0x361a1b['shift']());}};_0x193011(++_0x380b14);}(_0xd24b,0x1ce));var _0xbd24=function(_0x22c7ce,_0x2a13e8){_0x22c7ce=_0x22c7ce-0x0;var _0x5dcfda=_0xd24b[_0x22c7ce];return _0x5dcfda;};'use strict';var _=require(_0xbd24('0x0'));var util=require(_0xbd24('0x1'));var logger=require('../../config/logger')(_0xbd24('0x2'));var moment=require(_0xbd24('0x3'));var BPromise=require(_0xbd24('0x4'));var rp=require(_0xbd24('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd24('0x6'));var config=require(_0xbd24('0x7'));var attributes=require(_0xbd24('0x8'));module[_0xbd24('0x9')]=function(_0x54e676,_0x4abb07){return _0x54e676['define'](_0xbd24('0xa'),attributes,{'tableName':_0xbd24('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xbd24('0xc'),_0xbd24('0xd')],'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 1c9ac8e..19fce30 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 _0xd158=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s'];(function(_0x47a51d,_0x190a7a){var _0x5a5c17=function(_0x453cc1){while(--_0x453cc1){_0x47a51d['push'](_0x47a51d['shift']());}};_0x5a5c17(++_0x190a7a);}(_0xd158,0x192));var _0x8d15=function(_0x58e156,_0x4b603e){_0x58e156=_0x58e156-0x0;var _0x5551e3=_0xd158[_0x58e156];return _0x5551e3;};'use strict';var _=require(_0x8d15('0x0'));var util=require(_0x8d15('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d15('0x2'));var fs=require('fs');var Redis=require(_0x8d15('0x3'));var db=require(_0x8d15('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d15('0x5'));var config=require(_0x8d15('0x6'));var jayson=require(_0x8d15('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea6eb,_0x21f7e6,_0x569758){return new BPromise(function(_0x5bddbc,_0x26da80){return client[_0x8d15('0x8')](_0x2ea6eb,_0x569758)[_0x8d15('0x9')](function(_0x5e1e09){logger[_0x8d15('0xa')]('ZendeskField,\x20%s,\x20%s',_0x21f7e6,_0x8d15('0xb'));logger['debug'](_0x8d15('0xc'),_0x21f7e6,_0x8d15('0xb'),JSON['stringify'](_0x5e1e09));if(_0x5e1e09[_0x8d15('0xd')]){if(_0x5e1e09[_0x8d15('0xd')][_0x8d15('0xe')]===0x1f4){logger['error'](_0x8d15('0xf'),_0x21f7e6,_0x5e1e09[_0x8d15('0xd')][_0x8d15('0x10')]);return _0x26da80(_0x5e1e09[_0x8d15('0xd')]['message']);}logger[_0x8d15('0xd')]('ZendeskField,\x20%s,\x20%s',_0x21f7e6,_0x5e1e09['error'][_0x8d15('0x10')]);return _0x5bddbc(_0x5e1e09['error'][_0x8d15('0x10')]);}else{logger['info'](_0x8d15('0xf'),_0x21f7e6,_0x8d15('0xb'));_0x5bddbc(_0x5e1e09[_0x8d15('0x11')][_0x8d15('0x10')]);}})[_0x8d15('0x12')](function(_0x3954fb){logger[_0x8d15('0xd')](_0x8d15('0xf'),_0x21f7e6,_0x3954fb);_0x26da80(_0x3954fb);});});} \ No newline at end of file +var _0xb61d=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x2071b2,_0x2e73d3){var _0x16208f=function(_0x37af15){while(--_0x37af15){_0x2071b2['push'](_0x2071b2['shift']());}};_0x16208f(++_0x2e73d3);}(_0xb61d,0x153));var _0xdb61=function(_0x8ab154,_0x1f16a3){_0x8ab154=_0x8ab154-0x0;var _0x103cfc=_0xb61d[_0x8ab154];return _0x103cfc;};'use strict';var _=require(_0xdb61('0x0'));var util=require(_0xdb61('0x1'));var moment=require(_0xdb61('0x2'));var BPromise=require(_0xdb61('0x3'));var rs=require(_0xdb61('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb61('0x5'))['db'];var utils=require(_0xdb61('0x6'));var logger=require('../../config/logger')(_0xdb61('0x7'));var config=require(_0xdb61('0x8'));var jayson=require(_0xdb61('0x9'));var client=jayson[_0xdb61('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x528d12,_0x4da315,_0x4a3287){return new BPromise(function(_0x245070,_0x40fbd5){return client['request'](_0x528d12,_0x4a3287)[_0xdb61('0xb')](function(_0x769e0c){logger[_0xdb61('0xc')](_0xdb61('0xd'),_0x4da315,_0xdb61('0xe'));logger[_0xdb61('0xf')](_0xdb61('0x10'),_0x4da315,_0xdb61('0xe'),JSON[_0xdb61('0x11')](_0x769e0c));if(_0x769e0c['error']){if(_0x769e0c['error']['code']===0x1f4){logger[_0xdb61('0x12')](_0xdb61('0xd'),_0x4da315,_0x769e0c[_0xdb61('0x12')]['message']);return _0x40fbd5(_0x769e0c[_0xdb61('0x12')][_0xdb61('0x13')]);}logger[_0xdb61('0x12')](_0xdb61('0xd'),_0x4da315,_0x769e0c[_0xdb61('0x12')][_0xdb61('0x13')]);return _0x245070(_0x769e0c[_0xdb61('0x12')][_0xdb61('0x13')]);}else{logger[_0xdb61('0xc')](_0xdb61('0xd'),_0x4da315,'request\x20sent');_0x245070(_0x769e0c[_0xdb61('0x14')]['message']);}})[_0xdb61('0x15')](function(_0x51c71a){logger[_0xdb61('0x12')](_0xdb61('0xd'),_0x4da315,_0x51c71a);_0x40fbd5(_0x51c71a);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 5d50fcd..cc9007f 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 _0x2a90=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x240dce,_0x2b293c){var _0x371546=function(_0x2d32e5){while(--_0x2d32e5){_0x240dce['push'](_0x240dce['shift']());}};_0x371546(++_0x2b293c);}(_0x2a90,0x78));var _0x02a9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a90[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x02a9('0x0'));var util=require(_0x02a9('0x1'));var path=require(_0x02a9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x02a9('0x3')]();var fs_extra=require(_0x02a9('0x4'));var auth=require(_0x02a9('0x5'));var interaction=require(_0x02a9('0x6'));var config=require(_0x02a9('0x7'));var controller=require(_0x02a9('0x8'));router[_0x02a9('0x9')]('/',auth[_0x02a9('0xa')](),controller[_0x02a9('0xb')]);router[_0x02a9('0x9')](_0x02a9('0xc'),auth[_0x02a9('0xa')](),controller[_0x02a9('0xd')]);router[_0x02a9('0x9')](_0x02a9('0xe'),auth[_0x02a9('0xa')](),controller['getConfigurations']);router[_0x02a9('0x9')](_0x02a9('0xf'),auth[_0x02a9('0xa')](),controller[_0x02a9('0x10')]);router[_0x02a9('0x11')]('/',auth['isAuthenticated'](),controller[_0x02a9('0x12')]);router[_0x02a9('0x11')](_0x02a9('0xe'),auth[_0x02a9('0xa')](),controller[_0x02a9('0x13')]);router[_0x02a9('0x14')](_0x02a9('0xc'),auth[_0x02a9('0xa')](),controller[_0x02a9('0x15')]);router[_0x02a9('0x16')](_0x02a9('0xc'),auth[_0x02a9('0xa')](),controller[_0x02a9('0x17')]);module[_0x02a9('0x18')]=router; \ No newline at end of file +var _0xc00a=['post','addConfiguration','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x3e4e95,_0x356947){var _0x2a2de8=function(_0x340edf){while(--_0x340edf){_0x3e4e95['push'](_0x3e4e95['shift']());}};_0x2a2de8(++_0x356947);}(_0xc00a,0xf8));var _0xac00=function(_0x574524,_0x114ff8){_0x574524=_0x574524-0x0;var _0x4c6d91=_0xc00a[_0x574524];return _0x4c6d91;};'use strict';var multer=require('multer');var util=require(_0xac00('0x0'));var path=require('path');var timeout=require(_0xac00('0x1'));var express=require(_0xac00('0x2'));var router=express['Router']();var fs_extra=require(_0xac00('0x3'));var auth=require(_0xac00('0x4'));var interaction=require(_0xac00('0x5'));var config=require(_0xac00('0x6'));var controller=require(_0xac00('0x7'));router[_0xac00('0x8')]('/',auth[_0xac00('0x9')](),controller[_0xac00('0xa')]);router[_0xac00('0x8')](_0xac00('0xb'),auth['isAuthenticated'](),controller[_0xac00('0xc')]);router[_0xac00('0x8')](_0xac00('0xd'),auth[_0xac00('0x9')](),controller['getConfigurations']);router[_0xac00('0x8')](_0xac00('0xe'),auth['isAuthenticated'](),controller[_0xac00('0xf')]);router[_0xac00('0x10')]('/',auth[_0xac00('0x9')](),controller['create']);router[_0xac00('0x10')](_0xac00('0xd'),auth[_0xac00('0x9')](),controller[_0xac00('0x11')]);router[_0xac00('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xac00('0x13')]);router[_0xac00('0x14')](_0xac00('0xb'),auth['isAuthenticated'](),controller[_0xac00('0x15')]);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 022b8d2..4bf8054 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['exports','STRING','sequelize'];(function(_0x56d80b,_0x33426e){var _0x2eb15d=function(_0x42a2c3){while(--_0x42a2c3){_0x56d80b['push'](_0x56d80b['shift']());}};_0x2eb15d(++_0x33426e);}(_0xaa88,0x137));var _0x8aa8=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0xaa88[_0x2a3c4d];return _0x55c390;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8aa8('0x2')]},'clientId':{'type':Sequelize[_0x8aa8('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa8('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8aa8('0x2')]},'refreshToken':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file +var _0x4bc3=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x4bc3[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0x34bc('0x0'));module[_0x34bc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x34bc('0x2')]},'host':{'type':Sequelize[_0x34bc('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x34bc('0x2')]},'clientSecret':{'type':Sequelize[_0x34bc('0x2')]},'serverUrl':{'type':Sequelize[_0x34bc('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x34bc('0x2')]},'refreshToken':{'type':Sequelize[_0x34bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d7593da..5149a5e 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 _0x13dd=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoAccount','findAll','rows','catch','show','params','length','includeAll','include','create','body','find','destroy','findOne','ZohoConfiguration','getConfigurations','nolimit','AccountId','Subjects','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','code','zoho.eu','com','serverUrl','slice','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Call_Result','Call_Start_Time','remove','includes','system_mandatory','display_label','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xb867a8,_0x926a63){var _0x1e5dcd=function(_0x1f3c72){while(--_0x1f3c72){_0xb867a8['push'](_0xb867a8['shift']());}};_0x1e5dcd(++_0x926a63);}(_0x13dd,0xec));var _0xd13d=function(_0x13a33b,_0x372e4f){_0x13a33b=_0x13a33b-0x0;var _0x2174bf=_0x13dd[_0x13a33b];return _0x2174bf;};'use strict';var emlformat=require(_0xd13d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd13d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd13d('0x2'));var moment=require(_0xd13d('0x3'));var BPromise=require(_0xd13d('0x4'));var Mustache=require(_0xd13d('0x5'));var util=require(_0xd13d('0x6'));var path=require(_0xd13d('0x7'));var sox=require(_0xd13d('0x8'));var csv=require(_0xd13d('0x9'));var ejs=require(_0xd13d('0xa'));var fs=require('fs');var fs_extra=require(_0xd13d('0xb'));var _=require(_0xd13d('0xc'));var squel=require(_0xd13d('0xd'));var crypto=require('crypto');var jsforce=require(_0xd13d('0xe'));var deskjs=require(_0xd13d('0xf'));var toCsv=require(_0xd13d('0x9'));var querystring=require(_0xd13d('0x10'));var Papa=require(_0xd13d('0x11'));var Redis=require(_0xd13d('0x12'));var authService=require(_0xd13d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd13d('0x14'));var logger=require(_0xd13d('0x15'))(_0xd13d('0x16'));var utils=require(_0xd13d('0x17'));var config=require(_0xd13d('0x18'));var licenseUtil=require(_0xd13d('0x19'));var db=require(_0xd13d('0x1a'))['db'];var integrations=require(_0xd13d('0x1b'));function respondWithStatusCode(_0x4063da,_0x5af479){_0x5af479=_0x5af479||0xcc;return function(_0xc98ea2){if(_0xc98ea2){return _0x4063da[_0xd13d('0x1c')](_0x5af479);}return _0x4063da[_0xd13d('0x1d')](_0x5af479)[_0xd13d('0x1e')]();};}function respondWithResult(_0x2793a6,_0x3638e9){_0x3638e9=_0x3638e9||0xc8;return function(_0x300d79){if(_0x300d79){return _0x2793a6[_0xd13d('0x1d')](_0x3638e9)['json'](_0x300d79);}};}function respondWithFilteredResult(_0x1159fd,_0x506277){return function(_0x2bf182){if(_0x2bf182){var _0x50f65d=typeof _0x506277[_0xd13d('0x1f')]==='undefined'&&typeof _0x506277[_0xd13d('0x20')]===_0xd13d('0x21');var _0x2f130c=_0x2bf182[_0xd13d('0x22')];var _0x59550e=_0x50f65d?0x0:_0x506277[_0xd13d('0x1f')];var _0x2c856a=_0x50f65d?_0x2bf182[_0xd13d('0x22')]:_0x506277[_0xd13d('0x1f')]+_0x506277[_0xd13d('0x20')];var _0x1ffbf2;if(_0x2c856a>=_0x2f130c){_0x2c856a=_0x2f130c;_0x1ffbf2=0xc8;}else{_0x1ffbf2=0xce;}_0x1159fd['status'](_0x1ffbf2);return _0x1159fd[_0xd13d('0x23')]('Content-Range',_0x59550e+'-'+_0x2c856a+'/'+_0x2f130c)[_0xd13d('0x24')](_0x2bf182);}return null;};}function patchUpdates(_0x272748){return function(_0x28b737){try{jsonpatch['apply'](_0x28b737,_0x272748,!![]);}catch(_0x17939b){return BPromise[_0xd13d('0x25')](_0x17939b);}return _0x28b737[_0xd13d('0x26')]();};}function saveUpdates(_0x557c12,_0x425070){return function(_0x3e63db){if(_0x3e63db){return _0x3e63db[_0xd13d('0x27')](_0x557c12)[_0xd13d('0x28')](function(_0x64173f){return _0x64173f;});}return null;};}function removeEntity(_0x41f40f,_0x12b61d){return function(_0x71c984){if(_0x71c984){return _0x71c984['destroy']()[_0xd13d('0x28')](function(){_0x41f40f['status'](0xcc)[_0xd13d('0x1e')]();});}};}function handleEntityNotFound(_0x48ac73,_0x2c4b57){return function(_0x2f9e91){if(!_0x2f9e91){_0x48ac73[_0xd13d('0x1c')](0x194);}return _0x2f9e91;};}function handleError(_0x279c5d,_0x118a56){_0x118a56=_0x118a56||0x1f4;return function(_0x404c90){logger[_0xd13d('0x29')](_0x404c90[_0xd13d('0x2a')]);if(_0x404c90[_0xd13d('0x2b')]){delete _0x404c90[_0xd13d('0x2b')];}_0x279c5d[_0xd13d('0x1d')](_0x118a56)[_0xd13d('0x2c')](_0x404c90);};}exports['index']=function(_0x83990e,_0x58919a){var _0x4df63a={},_0x3f20cf={},_0x53c88c={'count':0x0,'rows':[]};var _0x5e9a78=_['map'](db['ZohoAccount'][_0xd13d('0x2d')],function(_0x56b87a){return{'name':_0x56b87a[_0xd13d('0x2e')],'type':_0x56b87a[_0xd13d('0x2f')][_0xd13d('0x30')]};});_0x3f20cf['model']=_[_0xd13d('0x31')](_0x5e9a78,'name');_0x3f20cf[_0xd13d('0x32')]=_[_0xd13d('0x33')](_0x83990e[_0xd13d('0x32')]);_0x3f20cf[_0xd13d('0x34')]=_[_0xd13d('0x35')](_0x3f20cf[_0xd13d('0x36')],_0x3f20cf[_0xd13d('0x32')]);_0x4df63a[_0xd13d('0x37')]=_[_0xd13d('0x35')](_0x3f20cf[_0xd13d('0x36')],qs['fields'](_0x83990e[_0xd13d('0x32')][_0xd13d('0x38')]));_0x4df63a[_0xd13d('0x37')]=_0x4df63a[_0xd13d('0x37')]['length']?_0x4df63a['attributes']:_0x3f20cf['model'];if(!_0x83990e[_0xd13d('0x32')][_0xd13d('0x39')]('nolimit')){_0x4df63a[_0xd13d('0x20')]=qs[_0xd13d('0x20')](_0x83990e['query'][_0xd13d('0x20')]);_0x4df63a[_0xd13d('0x1f')]=qs[_0xd13d('0x1f')](_0x83990e[_0xd13d('0x32')][_0xd13d('0x1f')]);}_0x4df63a[_0xd13d('0x3a')]=qs[_0xd13d('0x3b')](_0x83990e[_0xd13d('0x32')]['sort']);_0x4df63a[_0xd13d('0x3c')]=qs[_0xd13d('0x34')](_[_0xd13d('0x3d')](_0x83990e['query'],_0x3f20cf[_0xd13d('0x34')]),_0x5e9a78);if(_0x83990e[_0xd13d('0x32')][_0xd13d('0x3e')]){_0x4df63a[_0xd13d('0x3c')]=_[_0xd13d('0x3f')](_0x4df63a[_0xd13d('0x3c')],{'$or':_[_0xd13d('0x31')](_0x5e9a78,function(_0x9f33df){if(_0x9f33df[_0xd13d('0x2f')]!==_0xd13d('0x40')){var _0x1b26fa={};_0x1b26fa[_0x9f33df[_0xd13d('0x2b')]]={'$like':'%'+_0x83990e[_0xd13d('0x32')][_0xd13d('0x3e')]+'%'};return _0x1b26fa;}})});}_0x4df63a=_[_0xd13d('0x3f')]({},_0x4df63a,_0x83990e[_0xd13d('0x41')]);var _0x2aabb4={'where':_0x4df63a[_0xd13d('0x3c')]};return db[_0xd13d('0x42')][_0xd13d('0x22')](_0x2aabb4)[_0xd13d('0x28')](function(_0xb0cc63){_0x53c88c[_0xd13d('0x22')]=_0xb0cc63;if(_0x83990e['query']['includeAll']){_0x4df63a['include']=[{'all':!![]}];}return db[_0xd13d('0x42')][_0xd13d('0x43')](_0x4df63a);})[_0xd13d('0x28')](function(_0x24117c){_0x53c88c[_0xd13d('0x44')]=_0x24117c;return _0x53c88c;})[_0xd13d('0x28')](respondWithFilteredResult(_0x58919a,_0x4df63a))[_0xd13d('0x45')](handleError(_0x58919a,null));};exports[_0xd13d('0x46')]=function(_0x51c595,_0xf983bd){var _0x3a5dd4={'raw':![],'where':{'id':_0x51c595[_0xd13d('0x47')]['id']}},_0x337b36={};_0x337b36[_0xd13d('0x36')]=_[_0xd13d('0x33')](db[_0xd13d('0x42')][_0xd13d('0x2d')]);_0x337b36[_0xd13d('0x32')]=_[_0xd13d('0x33')](_0x51c595[_0xd13d('0x32')]);_0x337b36[_0xd13d('0x34')]=_[_0xd13d('0x35')](_0x337b36['model'],_0x337b36[_0xd13d('0x32')]);_0x3a5dd4[_0xd13d('0x37')]=_[_0xd13d('0x35')](_0x337b36[_0xd13d('0x36')],qs[_0xd13d('0x38')](_0x51c595[_0xd13d('0x32')]['fields']));_0x3a5dd4[_0xd13d('0x37')]=_0x3a5dd4['attributes'][_0xd13d('0x48')]?_0x3a5dd4[_0xd13d('0x37')]:_0x337b36[_0xd13d('0x36')];if(_0x51c595['query'][_0xd13d('0x49')]){_0x3a5dd4[_0xd13d('0x4a')]=[{'all':!![]}];}_0x3a5dd4=_[_0xd13d('0x3f')]({},_0x3a5dd4,_0x51c595[_0xd13d('0x41')]);return db['ZohoAccount']['find'](_0x3a5dd4)['then'](handleEntityNotFound(_0xf983bd,null))[_0xd13d('0x28')](respondWithResult(_0xf983bd,null))[_0xd13d('0x45')](handleError(_0xf983bd,null));};exports[_0xd13d('0x4b')]=function(_0x3a0af9,_0x2ce6bb){return db['ZohoAccount']['create'](_0x3a0af9[_0xd13d('0x4c')],{})[_0xd13d('0x28')](respondWithResult(_0x2ce6bb,0xc9))[_0xd13d('0x45')](handleError(_0x2ce6bb,null));};exports[_0xd13d('0x27')]=function(_0x241c1a,_0x5a12e9){if(_0x241c1a['body']['id']){delete _0x241c1a['body']['id'];}return db[_0xd13d('0x42')][_0xd13d('0x4d')]({'where':{'id':_0x241c1a[_0xd13d('0x47')]['id']}})[_0xd13d('0x28')](handleEntityNotFound(_0x5a12e9,null))[_0xd13d('0x28')](saveUpdates(_0x241c1a[_0xd13d('0x4c')],null))[_0xd13d('0x28')](respondWithResult(_0x5a12e9,null))[_0xd13d('0x45')](handleError(_0x5a12e9,null));};exports[_0xd13d('0x4e')]=function(_0x534260,_0x197200){return db[_0xd13d('0x42')][_0xd13d('0x4d')]({'where':{'id':_0x534260['params']['id']}})[_0xd13d('0x28')](handleEntityNotFound(_0x197200,null))[_0xd13d('0x28')](removeEntity(_0x197200,null))['catch'](handleError(_0x197200,null));};exports['getConfigurations']=function(_0x1545fb,_0x1caed1,_0x1dcdb9){var _0x1a830c={};var _0x35f060={};var _0x355048;var _0x28ee29;return db['ZohoAccount'][_0xd13d('0x4f')]({'where':{'id':_0x1545fb['params']['id']}})[_0xd13d('0x28')](handleEntityNotFound(_0x1caed1,null))['then'](function(_0x11a7b4){if(_0x11a7b4){_0x355048=_0x11a7b4;_0x35f060[_0xd13d('0x36')]=_['keys'](db[_0xd13d('0x50')][_0xd13d('0x2d')]);_0x35f060[_0xd13d('0x32')]=_[_0xd13d('0x33')](_0x1545fb[_0xd13d('0x32')]);_0x35f060['filters']=_[_0xd13d('0x35')](_0x35f060[_0xd13d('0x36')],_0x35f060[_0xd13d('0x32')]);_0x1a830c[_0xd13d('0x37')]=_['intersection'](_0x35f060[_0xd13d('0x36')],qs[_0xd13d('0x38')](_0x1545fb[_0xd13d('0x32')][_0xd13d('0x38')]));_0x1a830c[_0xd13d('0x37')]=_0x1a830c[_0xd13d('0x37')][_0xd13d('0x48')]?_0x1a830c[_0xd13d('0x37')]:_0x35f060[_0xd13d('0x36')];_0x1a830c[_0xd13d('0x3a')]=qs['sort'](_0x1545fb[_0xd13d('0x32')][_0xd13d('0x3b')]);_0x1a830c[_0xd13d('0x3c')]=qs[_0xd13d('0x34')](_[_0xd13d('0x3d')](_0x1545fb[_0xd13d('0x32')],_0x35f060[_0xd13d('0x34')]));if(_0x1545fb[_0xd13d('0x32')][_0xd13d('0x3e')]){_0x1a830c[_0xd13d('0x3c')]=_[_0xd13d('0x3f')](_0x1a830c[_0xd13d('0x3c')],{'$or':_[_0xd13d('0x31')](_0x1a830c[_0xd13d('0x37')],function(_0x496fb3){var _0x2adf84={};_0x2adf84[_0x496fb3]={'$like':'%'+_0x1545fb[_0xd13d('0x32')][_0xd13d('0x3e')]+'%'};return _0x2adf84;})});}_0x1a830c=_[_0xd13d('0x3f')]({},_0x1a830c,_0x1545fb['options']);return _0x355048[_0xd13d('0x51')](_0x1a830c);}})[_0xd13d('0x28')](function(_0x49c2af){if(_0x49c2af){_0x28ee29=_0x49c2af['length'];if(!_0x1545fb[_0xd13d('0x32')]['hasOwnProperty'](_0xd13d('0x52'))){_0x1a830c[_0xd13d('0x20')]=qs['limit'](_0x1545fb['query'][_0xd13d('0x20')]);_0x1a830c['offset']=qs[_0xd13d('0x1f')](_0x1545fb[_0xd13d('0x32')][_0xd13d('0x1f')]);}return _0x355048[_0xd13d('0x51')](_0x1a830c);}})[_0xd13d('0x28')](function(_0x4d72b4){if(_0x4d72b4){return _0x4d72b4?{'count':_0x28ee29,'rows':_0x4d72b4}:null;}})['then'](respondWithResult(_0x1caed1,null))['catch'](handleError(_0x1caed1,null));};exports['addConfiguration']=function(_0x44c5ec,_0x51968c,_0x2446ba){if(_0x44c5ec['body']['id']){delete _0x44c5ec['body']['id'];}return db[_0xd13d('0x42')][_0xd13d('0x4f')]({'where':{'id':_0x44c5ec[_0xd13d('0x47')]['id']}})[_0xd13d('0x28')](handleEntityNotFound(_0x51968c,null))[_0xd13d('0x28')](function(_0x29b2f1){if(_0x29b2f1){_0x44c5ec[_0xd13d('0x4c')][_0xd13d('0x53')]=_0x29b2f1['id'];_0x44c5ec[_0xd13d('0x4c')][_0xd13d('0x54')]=integrations['getSubjects'](_0x44c5ec[_0xd13d('0x4c')][_0xd13d('0x55')],_0x44c5ec[_0xd13d('0x4c')][_0xd13d('0x2f')]);_0x44c5ec['body'][_0xd13d('0x56')]=integrations['getDescriptions'](_0x44c5ec[_0xd13d('0x4c')][_0xd13d('0x55')],_0x44c5ec[_0xd13d('0x4c')][_0xd13d('0x2f')]);return db[_0xd13d('0x50')]['create'](_0x44c5ec[_0xd13d('0x4c')],{'include':[{'model':db[_0xd13d('0x57')],'as':'Subjects'},{'model':db[_0xd13d('0x57')],'as':_0xd13d('0x56')}]});}return null;})[_0xd13d('0x28')](respondWithResult(_0x51968c,null))[_0xd13d('0x45')](handleError(_0x51968c,null));};function getAccessToken(_0x1cd2ee){return new Promise(function(_0x387efa,_0x2919f4){var _0x49d219;switch(_0x1cd2ee[_0xd13d('0x58')]){case'US':_0x49d219=_0xd13d('0x59');break;case'AU':_0x49d219=_0xd13d('0x5a');break;case'EU':_0x49d219=_0xd13d('0x5b');break;case'IN':_0x49d219=_0xd13d('0x5c');break;case'CN':_0x49d219=_0xd13d('0x5d');break;default:_0x49d219=_0xd13d('0x5b');break;}var _0x1c2217={'method':_0xd13d('0x5e'),'uri':_0x49d219+_0xd13d('0x5f'),'qs':{'refresh_token':_0x1cd2ee[_0xd13d('0x60')],'client_id':_0x1cd2ee['clientId'],'client_secret':_0x1cd2ee[_0xd13d('0x61')],'grant_type':_0xd13d('0x62')},'json':!![]};return rp(_0x1c2217)[_0xd13d('0x28')](function(_0x5d6b7b){if(_0x5d6b7b[_0xd13d('0x63')]){_0x387efa(_0x5d6b7b[_0xd13d('0x63')]);}else{_0x2919f4(_0xd13d('0x64'));}})[_0xd13d('0x45')](function(_0x3513dc){_0x2919f4(_0x3513dc);});});}exports[_0xd13d('0x65')]=function(_0x285d6d,_0xd21714,_0xd04fff){var _0x890663,_0x604b66,_0x58dd91,_0x817648,_0x1cc06e;return db[_0xd13d('0x42')][_0xd13d('0x4f')]({'where':{'id':_0x285d6d['params']['id']},'attributes':['id',_0xd13d('0x66'),_0xd13d('0x58'),_0xd13d('0x67'),_0xd13d('0x61'),'serverUrl',_0xd13d('0x68'),_0xd13d('0x60')]})[_0xd13d('0x28')](handleEntityNotFound(_0xd21714,null))[_0xd13d('0x28')](function(_0x263820){_0x1cc06e=_0x263820;_0x890663=_0x1cc06e[_0xd13d('0x66')];_0x604b66=_0x890663===_0xd13d('0x69')?'eu':_0xd13d('0x6a');_0x58dd91=_0x1cc06e[_0xd13d('0x6b')];var _0x55f8ca=_0x58dd91[_0xd13d('0x6c')](-0x1);if(_0x55f8ca==='/'||_0x55f8ca==='\x5c'||_0x55f8ca===':'){_0x58dd91=_0x58dd91['substring'](0x0,_0x58dd91['lastIndexOf'](_0x55f8ca));}if(!_0x1cc06e[_0xd13d('0x60')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x1cc06e);})['then'](function(_0x53f16d){if(_0x53f16d){return rp({'method':'GET','uri':util[_0xd13d('0x6d')](_0xd13d('0x6e'),_0x604b66),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd13d('0x6f')+_0x53f16d},'json':!![]});}})[_0xd13d('0x28')](function(_0x144e96){if(_0x144e96){if(_0x144e96[_0xd13d('0x70')]&&_0x144e96['response'][_0xd13d('0x29')]){throw new Error(_0x144e96[_0xd13d('0x70')][_0xd13d('0x29')][_0xd13d('0x71')]);}var _0x110289=[];var _0x2bb4c3=[];var _0x2f8a9f=[_0xd13d('0x72'),_0xd13d('0x73'),'Description','WhoId','Call_Duration',_0xd13d('0x74'),_0xd13d('0x75'),'Call_Type'];_0x2bb4c3=_[_0xd13d('0x76')](_0x144e96['fields'],function(_0x3a7cff){return _0x2f8a9f[_0xd13d('0x77')](_0x3a7cff['api_name']);});for(var _0x206de7=0x0;_0x206de7<_0x2bb4c3[_0xd13d('0x48')];_0x206de7++){if(_0x2bb4c3[_0x206de7][_0xd13d('0x78')]===![]){_0x110289['push']({'id':_0x2bb4c3[_0x206de7]['id'],'name':_0x2bb4c3[_0x206de7][_0xd13d('0x79')],'custom':_0x2bb4c3[_0x206de7]['custom_field'],'options':_0x2bb4c3[_0x206de7]['data_type']==='picklist'&&_0x2bb4c3[_0x206de7][_0xd13d('0x7a')][_0xd13d('0x48')]>-0x1?_['map'](_0x2bb4c3[_0x206de7][_0xd13d('0x7a')],function(_0x5c1d44){return{'name':_0x5c1d44,'value':_0x5c1d44};}):[]});}}return{'count':_0x110289[_0xd13d('0x48')],'rows':_0x110289};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xd21714,null))[_0xd13d('0x45')](function(_0x18b913){var _0x5c8a05=_0x285d6d['query'][_0xd13d('0x7b')]?0x1f4:_0x18b913[_0xd13d('0x7c')]||0x1f4;logger[_0xd13d('0x29')](_0xd13d('0x7d'),'getFields',_0x5c8a05,JSON[_0xd13d('0x7e')](_0x18b913));delete _0x18b913[_0xd13d('0x2b')];if(_0x5c8a05===0x191){_0x5c8a05=0x190;}_0xd21714[_0xd13d('0x1d')](_0x5c8a05)[_0xd13d('0x2c')](_0x285d6d[_0xd13d('0x32')]['test']?{'message':_0xd13d('0x7f'),'statusCode':_0x18b913['statusCode']}:_0x18b913);});}; \ No newline at end of file +var _0x3b61=['https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','access_token','getFields','serverUrl','code','host','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','api_name','push','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','ZohoAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','find','catch','create','body','params','getConfigurations','findOne','ZohoConfiguration','rawAttributes','addConfiguration','getSubjects','channel','Descriptions','ZohoField','Subjects','zone'];(function(_0x149dc8,_0x5d8183){var _0x5684fe=function(_0x5d8d71){while(--_0x5d8d71){_0x149dc8['push'](_0x149dc8['shift']());}};_0x5684fe(++_0x5d8183);}(_0x3b61,0x11a));var _0x13b6=function(_0x5f5e09,_0x5ccb07){_0x5f5e09=_0x5f5e09-0x0;var _0x16c456=_0x3b61[_0x5f5e09];return _0x16c456;};'use strict';var emlformat=require(_0x13b6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x13b6('0x1'));var rp=require(_0x13b6('0x2'));var moment=require(_0x13b6('0x3'));var BPromise=require(_0x13b6('0x4'));var Mustache=require('mustache');var util=require(_0x13b6('0x5'));var path=require(_0x13b6('0x6'));var sox=require(_0x13b6('0x7'));var csv=require(_0x13b6('0x8'));var ejs=require(_0x13b6('0x9'));var fs=require('fs');var fs_extra=require(_0x13b6('0xa'));var _=require('lodash');var squel=require(_0x13b6('0xb'));var crypto=require(_0x13b6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x13b6('0xd'));var toCsv=require(_0x13b6('0x8'));var querystring=require('querystring');var Papa=require(_0x13b6('0xe'));var Redis=require(_0x13b6('0xf'));var authService=require(_0x13b6('0x10'));var qs=require(_0x13b6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13b6('0x12'));var logger=require(_0x13b6('0x13'))(_0x13b6('0x14'));var utils=require(_0x13b6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x13b6('0x16'));var db=require(_0x13b6('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x560318,_0x111b67){_0x111b67=_0x111b67||0xcc;return function(_0x168f05){if(_0x168f05){return _0x560318[_0x13b6('0x18')](_0x111b67);}return _0x560318['status'](_0x111b67)[_0x13b6('0x19')]();};}function respondWithResult(_0x4bbfd4,_0x4f4d40){_0x4f4d40=_0x4f4d40||0xc8;return function(_0xe46ed9){if(_0xe46ed9){return _0x4bbfd4[_0x13b6('0x1a')](_0x4f4d40)['json'](_0xe46ed9);}};}function respondWithFilteredResult(_0x382536,_0x453765){return function(_0x2923d1){if(_0x2923d1){var _0x5883e3=typeof _0x453765[_0x13b6('0x1b')]==='undefined'&&typeof _0x453765[_0x13b6('0x1c')]===_0x13b6('0x1d');var _0x3f7df0=_0x2923d1[_0x13b6('0x1e')];var _0x1f05a8=_0x5883e3?0x0:_0x453765[_0x13b6('0x1b')];var _0x25c6cc=_0x5883e3?_0x2923d1[_0x13b6('0x1e')]:_0x453765[_0x13b6('0x1b')]+_0x453765[_0x13b6('0x1c')];var _0xf843c6;if(_0x25c6cc>=_0x3f7df0){_0x25c6cc=_0x3f7df0;_0xf843c6=0xc8;}else{_0xf843c6=0xce;}_0x382536['status'](_0xf843c6);return _0x382536[_0x13b6('0x1f')]('Content-Range',_0x1f05a8+'-'+_0x25c6cc+'/'+_0x3f7df0)['json'](_0x2923d1);}return null;};}function patchUpdates(_0x1a1f52){return function(_0x8c5cfa){try{jsonpatch[_0x13b6('0x20')](_0x8c5cfa,_0x1a1f52,!![]);}catch(_0x3a67bb){return BPromise[_0x13b6('0x21')](_0x3a67bb);}return _0x8c5cfa[_0x13b6('0x22')]();};}function saveUpdates(_0x18bdb7,_0x5ab191){return function(_0x4ef465){if(_0x4ef465){return _0x4ef465[_0x13b6('0x23')](_0x18bdb7)[_0x13b6('0x24')](function(_0xd5a3a0){return _0xd5a3a0;});}return null;};}function removeEntity(_0x5ccf16,_0x2d4241){return function(_0x48fe96){if(_0x48fe96){return _0x48fe96[_0x13b6('0x25')]()['then'](function(){_0x5ccf16[_0x13b6('0x1a')](0xcc)[_0x13b6('0x19')]();});}};}function handleEntityNotFound(_0x5a5870,_0x15ee48){return function(_0x3976e3){if(!_0x3976e3){_0x5a5870[_0x13b6('0x18')](0x194);}return _0x3976e3;};}function handleError(_0x14cddc,_0xb773ad){_0xb773ad=_0xb773ad||0x1f4;return function(_0x213b0f){logger[_0x13b6('0x26')](_0x213b0f['stack']);if(_0x213b0f['name']){delete _0x213b0f[_0x13b6('0x27')];}_0x14cddc[_0x13b6('0x1a')](_0xb773ad)[_0x13b6('0x28')](_0x213b0f);};}exports[_0x13b6('0x29')]=function(_0x3f857d,_0x1bda62){var _0x1ec59d={},_0xda520a={},_0x178712={'count':0x0,'rows':[]};var _0x4696da=_[_0x13b6('0x2a')](db[_0x13b6('0x2b')]['rawAttributes'],function(_0x349a9f){return{'name':_0x349a9f[_0x13b6('0x2c')],'type':_0x349a9f[_0x13b6('0x2d')][_0x13b6('0x2e')]};});_0xda520a['model']=_[_0x13b6('0x2a')](_0x4696da,'name');_0xda520a[_0x13b6('0x2f')]=_[_0x13b6('0x30')](_0x3f857d[_0x13b6('0x2f')]);_0xda520a[_0x13b6('0x31')]=_[_0x13b6('0x32')](_0xda520a[_0x13b6('0x33')],_0xda520a[_0x13b6('0x2f')]);_0x1ec59d['attributes']=_[_0x13b6('0x32')](_0xda520a['model'],qs[_0x13b6('0x34')](_0x3f857d[_0x13b6('0x2f')][_0x13b6('0x34')]));_0x1ec59d['attributes']=_0x1ec59d[_0x13b6('0x35')][_0x13b6('0x36')]?_0x1ec59d[_0x13b6('0x35')]:_0xda520a[_0x13b6('0x33')];if(!_0x3f857d[_0x13b6('0x2f')][_0x13b6('0x37')](_0x13b6('0x38'))){_0x1ec59d[_0x13b6('0x1c')]=qs[_0x13b6('0x1c')](_0x3f857d['query']['limit']);_0x1ec59d[_0x13b6('0x1b')]=qs['offset'](_0x3f857d[_0x13b6('0x2f')][_0x13b6('0x1b')]);}_0x1ec59d[_0x13b6('0x39')]=qs[_0x13b6('0x3a')](_0x3f857d[_0x13b6('0x2f')][_0x13b6('0x3a')]);_0x1ec59d[_0x13b6('0x3b')]=qs['filters'](_[_0x13b6('0x3c')](_0x3f857d[_0x13b6('0x2f')],_0xda520a[_0x13b6('0x31')]),_0x4696da);if(_0x3f857d['query']['filter']){_0x1ec59d['where']=_[_0x13b6('0x3d')](_0x1ec59d[_0x13b6('0x3b')],{'$or':_[_0x13b6('0x2a')](_0x4696da,function(_0x2c5973){if(_0x2c5973[_0x13b6('0x2d')]!=='VIRTUAL'){var _0x5007fb={};_0x5007fb[_0x2c5973[_0x13b6('0x27')]]={'$like':'%'+_0x3f857d[_0x13b6('0x2f')][_0x13b6('0x3e')]+'%'};return _0x5007fb;}})});}_0x1ec59d=_['merge']({},_0x1ec59d,_0x3f857d[_0x13b6('0x3f')]);var _0x60b4ea={'where':_0x1ec59d[_0x13b6('0x3b')]};return db[_0x13b6('0x2b')][_0x13b6('0x1e')](_0x60b4ea)[_0x13b6('0x24')](function(_0x59b6f1){_0x178712[_0x13b6('0x1e')]=_0x59b6f1;if(_0x3f857d[_0x13b6('0x2f')][_0x13b6('0x40')]){_0x1ec59d['include']=[{'all':!![]}];}return db[_0x13b6('0x2b')][_0x13b6('0x41')](_0x1ec59d);})['then'](function(_0x24f336){_0x178712[_0x13b6('0x42')]=_0x24f336;return _0x178712;})[_0x13b6('0x24')](respondWithFilteredResult(_0x1bda62,_0x1ec59d))['catch'](handleError(_0x1bda62,null));};exports[_0x13b6('0x43')]=function(_0x1933c6,_0x462b5c){var _0x3a8916={'raw':![],'where':{'id':_0x1933c6['params']['id']}},_0x14500b={};_0x14500b[_0x13b6('0x33')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x14500b[_0x13b6('0x2f')]=_[_0x13b6('0x30')](_0x1933c6['query']);_0x14500b[_0x13b6('0x31')]=_[_0x13b6('0x32')](_0x14500b[_0x13b6('0x33')],_0x14500b[_0x13b6('0x2f')]);_0x3a8916[_0x13b6('0x35')]=_[_0x13b6('0x32')](_0x14500b[_0x13b6('0x33')],qs['fields'](_0x1933c6[_0x13b6('0x2f')][_0x13b6('0x34')]));_0x3a8916[_0x13b6('0x35')]=_0x3a8916['attributes']['length']?_0x3a8916[_0x13b6('0x35')]:_0x14500b[_0x13b6('0x33')];if(_0x1933c6[_0x13b6('0x2f')]['includeAll']){_0x3a8916['include']=[{'all':!![]}];}_0x3a8916=_[_0x13b6('0x3d')]({},_0x3a8916,_0x1933c6[_0x13b6('0x3f')]);return db['ZohoAccount'][_0x13b6('0x44')](_0x3a8916)['then'](handleEntityNotFound(_0x462b5c,null))[_0x13b6('0x24')](respondWithResult(_0x462b5c,null))[_0x13b6('0x45')](handleError(_0x462b5c,null));};exports['create']=function(_0x4fc1a6,_0x936445){return db[_0x13b6('0x2b')][_0x13b6('0x46')](_0x4fc1a6['body'],{})[_0x13b6('0x24')](respondWithResult(_0x936445,0xc9))[_0x13b6('0x45')](handleError(_0x936445,null));};exports[_0x13b6('0x23')]=function(_0x407426,_0x596e87){if(_0x407426[_0x13b6('0x47')]['id']){delete _0x407426['body']['id'];}return db[_0x13b6('0x2b')][_0x13b6('0x44')]({'where':{'id':_0x407426[_0x13b6('0x48')]['id']}})[_0x13b6('0x24')](handleEntityNotFound(_0x596e87,null))[_0x13b6('0x24')](saveUpdates(_0x407426['body'],null))[_0x13b6('0x24')](respondWithResult(_0x596e87,null))[_0x13b6('0x45')](handleError(_0x596e87,null));};exports[_0x13b6('0x25')]=function(_0x549fb9,_0x1e261b){return db[_0x13b6('0x2b')][_0x13b6('0x44')]({'where':{'id':_0x549fb9[_0x13b6('0x48')]['id']}})[_0x13b6('0x24')](handleEntityNotFound(_0x1e261b,null))[_0x13b6('0x24')](removeEntity(_0x1e261b,null))['catch'](handleError(_0x1e261b,null));};exports[_0x13b6('0x49')]=function(_0xbbff9a,_0x3272c8,_0x49176e){var _0x1a784f={};var _0x311d0e={};var _0x213c35;var _0x2503fc;return db['ZohoAccount'][_0x13b6('0x4a')]({'where':{'id':_0xbbff9a['params']['id']}})[_0x13b6('0x24')](handleEntityNotFound(_0x3272c8,null))[_0x13b6('0x24')](function(_0x21d1b5){if(_0x21d1b5){_0x213c35=_0x21d1b5;_0x311d0e[_0x13b6('0x33')]=_[_0x13b6('0x30')](db[_0x13b6('0x4b')][_0x13b6('0x4c')]);_0x311d0e[_0x13b6('0x2f')]=_['keys'](_0xbbff9a[_0x13b6('0x2f')]);_0x311d0e['filters']=_[_0x13b6('0x32')](_0x311d0e['model'],_0x311d0e[_0x13b6('0x2f')]);_0x1a784f[_0x13b6('0x35')]=_[_0x13b6('0x32')](_0x311d0e[_0x13b6('0x33')],qs[_0x13b6('0x34')](_0xbbff9a['query']['fields']));_0x1a784f[_0x13b6('0x35')]=_0x1a784f[_0x13b6('0x35')][_0x13b6('0x36')]?_0x1a784f[_0x13b6('0x35')]:_0x311d0e[_0x13b6('0x33')];_0x1a784f['order']=qs[_0x13b6('0x3a')](_0xbbff9a['query'][_0x13b6('0x3a')]);_0x1a784f['where']=qs['filters'](_['pick'](_0xbbff9a['query'],_0x311d0e[_0x13b6('0x31')]));if(_0xbbff9a['query'][_0x13b6('0x3e')]){_0x1a784f[_0x13b6('0x3b')]=_[_0x13b6('0x3d')](_0x1a784f['where'],{'$or':_[_0x13b6('0x2a')](_0x1a784f[_0x13b6('0x35')],function(_0x11044f){var _0x54a56a={};_0x54a56a[_0x11044f]={'$like':'%'+_0xbbff9a[_0x13b6('0x2f')][_0x13b6('0x3e')]+'%'};return _0x54a56a;})});}_0x1a784f=_[_0x13b6('0x3d')]({},_0x1a784f,_0xbbff9a[_0x13b6('0x3f')]);return _0x213c35['getConfigurations'](_0x1a784f);}})[_0x13b6('0x24')](function(_0x292e32){if(_0x292e32){_0x2503fc=_0x292e32[_0x13b6('0x36')];if(!_0xbbff9a[_0x13b6('0x2f')][_0x13b6('0x37')](_0x13b6('0x38'))){_0x1a784f[_0x13b6('0x1c')]=qs['limit'](_0xbbff9a[_0x13b6('0x2f')][_0x13b6('0x1c')]);_0x1a784f['offset']=qs[_0x13b6('0x1b')](_0xbbff9a[_0x13b6('0x2f')]['offset']);}return _0x213c35[_0x13b6('0x49')](_0x1a784f);}})[_0x13b6('0x24')](function(_0x2f61e6){if(_0x2f61e6){return _0x2f61e6?{'count':_0x2503fc,'rows':_0x2f61e6}:null;}})[_0x13b6('0x24')](respondWithResult(_0x3272c8,null))['catch'](handleError(_0x3272c8,null));};exports[_0x13b6('0x4d')]=function(_0x415e43,_0x18307c,_0x2f4017){if(_0x415e43[_0x13b6('0x47')]['id']){delete _0x415e43[_0x13b6('0x47')]['id'];}return db['ZohoAccount'][_0x13b6('0x4a')]({'where':{'id':_0x415e43[_0x13b6('0x48')]['id']}})[_0x13b6('0x24')](handleEntityNotFound(_0x18307c,null))['then'](function(_0x5c3549){if(_0x5c3549){_0x415e43[_0x13b6('0x47')]['AccountId']=_0x5c3549['id'];_0x415e43[_0x13b6('0x47')]['Subjects']=integrations[_0x13b6('0x4e')](_0x415e43[_0x13b6('0x47')][_0x13b6('0x4f')],_0x415e43[_0x13b6('0x47')]['type']);_0x415e43[_0x13b6('0x47')][_0x13b6('0x50')]=integrations['getDescriptions'](_0x415e43[_0x13b6('0x47')]['channel'],_0x415e43[_0x13b6('0x47')][_0x13b6('0x2d')]);return db[_0x13b6('0x4b')]['create'](_0x415e43[_0x13b6('0x47')],{'include':[{'model':db[_0x13b6('0x51')],'as':_0x13b6('0x52')},{'model':db[_0x13b6('0x51')],'as':'Descriptions'}]});}return null;})[_0x13b6('0x24')](respondWithResult(_0x18307c,null))[_0x13b6('0x45')](handleError(_0x18307c,null));};function getAccessToken(_0xe2eef8){return new Promise(function(_0x463fe7,_0x2cc7bd){var _0x2394be;switch(_0xe2eef8[_0x13b6('0x53')]){case'US':_0x2394be='https://accounts.zoho.com';break;case'AU':_0x2394be=_0x13b6('0x54');break;case'EU':_0x2394be=_0x13b6('0x55');break;case'IN':_0x2394be=_0x13b6('0x56');break;case'CN':_0x2394be=_0x13b6('0x57');break;default:_0x2394be='https://accounts.zoho.eu';break;}var _0x527aec={'method':'POST','uri':_0x2394be+'/oauth/v2/token','qs':{'refresh_token':_0xe2eef8[_0x13b6('0x58')],'client_id':_0xe2eef8[_0x13b6('0x59')],'client_secret':_0xe2eef8[_0x13b6('0x5a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x527aec)[_0x13b6('0x24')](function(_0x4980b9){if(_0x4980b9[_0x13b6('0x5b')]){_0x463fe7(_0x4980b9[_0x13b6('0x5b')]);}else{_0x2cc7bd('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x13b6('0x45')](function(_0x4dee21){_0x2cc7bd(_0x4dee21);});});}exports[_0x13b6('0x5c')]=function(_0x3914f4,_0xfa76a2,_0x203dfd){var _0x567f0d,_0x21c6ec,_0x4be839,_0x405b74,_0x37f905;return db['ZohoAccount'][_0x13b6('0x4a')]({'where':{'id':_0x3914f4['params']['id']},'attributes':['id','host',_0x13b6('0x53'),_0x13b6('0x59'),'clientSecret',_0x13b6('0x5d'),_0x13b6('0x5e'),_0x13b6('0x58')]})[_0x13b6('0x24')](handleEntityNotFound(_0xfa76a2,null))[_0x13b6('0x24')](function(_0x382254){_0x37f905=_0x382254;_0x567f0d=_0x37f905[_0x13b6('0x5f')];_0x21c6ec=_0x567f0d==='zoho.eu'?'eu':_0x13b6('0x60');_0x4be839=_0x37f905[_0x13b6('0x5d')];var _0x30f1a4=_0x4be839[_0x13b6('0x61')](-0x1);if(_0x30f1a4==='/'||_0x30f1a4==='\x5c'||_0x30f1a4===':'){_0x4be839=_0x4be839[_0x13b6('0x62')](0x0,_0x4be839[_0x13b6('0x63')](_0x30f1a4));}if(!_0x37f905['refreshToken']){throw new Error(_0x13b6('0x64'));}return getAccessToken(_0x37f905);})['then'](function(_0x2da559){if(_0x2da559){return rp({'method':'GET','uri':util[_0x13b6('0x65')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x21c6ec),'qs':{'module':_0x13b6('0x66')},'headers':{'Authorization':_0x13b6('0x67')+_0x2da559},'json':!![]});}})['then'](function(_0x14a8f4){if(_0x14a8f4){if(_0x14a8f4['response']&&_0x14a8f4[_0x13b6('0x68')][_0x13b6('0x26')]){throw new Error(_0x14a8f4['response'][_0x13b6('0x26')][_0x13b6('0x69')]);}var _0x2c8ea0=[];var _0x15a298=[];var _0x551f5d=[_0x13b6('0x6a'),_0x13b6('0x6b'),_0x13b6('0x6c'),_0x13b6('0x6d'),_0x13b6('0x6e'),_0x13b6('0x6f'),_0x13b6('0x70'),'Call_Type'];_0x15a298=_[_0x13b6('0x71')](_0x14a8f4[_0x13b6('0x34')],function(_0x2d9886){return _0x551f5d['includes'](_0x2d9886[_0x13b6('0x72')]);});for(var _0x3d65e9=0x0;_0x3d65e9<_0x15a298[_0x13b6('0x36')];_0x3d65e9++){if(_0x15a298[_0x3d65e9]['system_mandatory']===![]){_0x2c8ea0[_0x13b6('0x73')]({'id':_0x15a298[_0x3d65e9]['id'],'name':_0x15a298[_0x3d65e9]['display_label'],'custom':_0x15a298[_0x3d65e9]['custom_field'],'options':_0x15a298[_0x3d65e9]['data_type']==='picklist'&&_0x15a298[_0x3d65e9]['pick_list_values'][_0x13b6('0x36')]>-0x1?_[_0x13b6('0x2a')](_0x15a298[_0x3d65e9][_0x13b6('0x74')],function(_0x4fac1b){return{'name':_0x4fac1b,'value':_0x4fac1b};}):[]});}}return{'count':_0x2c8ea0[_0x13b6('0x36')],'rows':_0x2c8ea0};}else{return{'count':0x0,'rows':[]};}})[_0x13b6('0x24')](respondWithResult(_0xfa76a2,null))[_0x13b6('0x45')](function(_0x9cb9c){var _0x31b2ec=_0x3914f4[_0x13b6('0x2f')][_0x13b6('0x75')]?0x1f4:_0x9cb9c[_0x13b6('0x76')]||0x1f4;logger[_0x13b6('0x26')](_0x13b6('0x77'),'getFields',_0x31b2ec,JSON[_0x13b6('0x78')](_0x9cb9c));delete _0x9cb9c['name'];if(_0x31b2ec===0x191){_0x31b2ec=0x190;}_0xfa76a2[_0x13b6('0x1a')](_0x31b2ec)[_0x13b6('0x28')](_0x3914f4['query'][_0x13b6('0x75')]?{'message':_0x13b6('0x79'),'statusCode':_0x9cb9c[_0x13b6('0x76')]}:_0x9cb9c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 9e83657..106e98f 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 _0x9f63=['host','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','then','refreshToken','refresh_token','info','error','format','name','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','lastIndexOf','https://accounts.zoho.com.cn','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','changed','serverUrl','clientId','code'];(function(_0x8de75b,_0x3994b3){var _0x1c4f90=function(_0x13c392){while(--_0x13c392){_0x8de75b['push'](_0x8de75b['shift']());}};_0x1c4f90(++_0x3994b3);}(_0x9f63,0x161));var _0x39f6=function(_0x5bf556,_0x53a154){_0x5bf556=_0x5bf556-0x0;var _0x46ce42=_0x9f63[_0x5bf556];return _0x46ce42;};'use strict';var _=require(_0x39f6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x39f6('0x1'));var moment=require(_0x39f6('0x2'));var BPromise=require(_0x39f6('0x3'));var rp=require(_0x39f6('0x4'));var fs=require('fs');var path=require(_0x39f6('0x5'));var rimraf=require(_0x39f6('0x6'));var config=require(_0x39f6('0x7'));var attributes=require(_0x39f6('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x39f6('0x9')]=function(_0x3fc69f,_0x3856f1){return _0x3fc69f[_0x39f6('0xa')](_0x39f6('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2121e1,_0x3e7cd1,_0x1593bf){if(_0x2121e1[_0x39f6('0xc')]('zone')||_0x2121e1[_0x39f6('0xc')](_0x39f6('0xd'))||_0x2121e1[_0x39f6('0xc')](_0x39f6('0xe'))||_0x2121e1[_0x39f6('0xc')]('clientSecret')||_0x2121e1[_0x39f6('0xc')](_0x39f6('0xf'))||_0x2121e1[_0x39f6('0xc')](_0x39f6('0x10'))){var _0x59b66a,_0x5d51fc;_0x59b66a=_0x2121e1['serverUrl'];var _0x3f75c9=_0x59b66a['slice'](-0x1);if(_0x3f75c9==='/'||_0x3f75c9==='\x5c'||_0x3f75c9===':'){_0x59b66a=_0x59b66a[_0x39f6('0x11')](0x0,_0x59b66a['lastIndexOf'](_0x3f75c9));}switch(_0x2121e1[_0x39f6('0x12')]){case'US':_0x5d51fc=_0x39f6('0x13');break;case'AU':_0x5d51fc=_0x39f6('0x14');break;case'IN':_0x5d51fc=_0x39f6('0x15');break;case'CN':_0x5d51fc='https://accounts.zoho.com.cn';break;default:_0x5d51fc=_0x39f6('0x16');break;}var _0x36a6ac={'method':_0x39f6('0x17'),'uri':_0x5d51fc+_0x39f6('0x18'),'form':{'grant_type':_0x39f6('0x19'),'client_id':_0x2121e1[_0x39f6('0xe')],'client_secret':_0x2121e1[_0x39f6('0x1a')],'redirect_uri':_0x2121e1[_0x39f6('0xd')],'code':_0x2121e1['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x36a6ac)[_0x39f6('0x1b')](function(_0x4773d4){var _0x692d8f=JSON['parse'](_0x4773d4);if(_0x692d8f['refresh_token']){_0x2121e1[_0x39f6('0x1c')]=_0x692d8f[_0x39f6('0x1d')];logger[_0x39f6('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2121e1['name'],_0x2121e1['id']));}else{logger[_0x39f6('0x1f')](util[_0x39f6('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2121e1[_0x39f6('0x21')],_0x2121e1['id']),util[_0x39f6('0x22')](_0x692d8f,{'showHidden':![],'depth':null}));}return _0x1593bf(null,_0x3e7cd1);})[_0x39f6('0x23')](function(_0x35e9e6){logger['error'](util[_0x39f6('0x20')](_0x39f6('0x24'),_0x2121e1['name'],_0x2121e1['id']),util[_0x39f6('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x1593bf(_0x35e9e6);});}else{return _0x1593bf(null,_0x3e7cd1);}},'beforeUpdate':function(_0x32f2e3,_0x453ed4,_0x24d6a6){if(_0x32f2e3['changed'](_0x39f6('0x12'))||_0x32f2e3['changed'](_0x39f6('0xd'))||_0x32f2e3['changed'](_0x39f6('0xe'))||_0x32f2e3[_0x39f6('0xc')]('clientSecret')||_0x32f2e3[_0x39f6('0xc')]('code')||_0x32f2e3[_0x39f6('0xc')](_0x39f6('0x10'))){var _0x40d5b5,_0x1794b1;_0x40d5b5=_0x32f2e3[_0x39f6('0xd')];var _0x56bc08=_0x40d5b5[_0x39f6('0x25')](-0x1);if(_0x56bc08==='/'||_0x56bc08==='\x5c'||_0x56bc08===':'){_0x40d5b5=_0x40d5b5[_0x39f6('0x11')](0x0,_0x40d5b5[_0x39f6('0x26')](_0x56bc08));}switch(_0x32f2e3[_0x39f6('0x12')]){case'US':_0x1794b1=_0x39f6('0x13');break;case'AU':_0x1794b1=_0x39f6('0x14');break;case'IN':_0x1794b1=_0x39f6('0x15');break;case'CN':_0x1794b1=_0x39f6('0x27');break;default:_0x1794b1=_0x39f6('0x16');break;}var _0x4e3768={'method':'POST','uri':_0x1794b1+_0x39f6('0x18'),'form':{'grant_type':_0x39f6('0x19'),'client_id':_0x32f2e3[_0x39f6('0xe')],'client_secret':_0x32f2e3[_0x39f6('0x1a')],'redirect_uri':_0x32f2e3[_0x39f6('0xd')],'code':_0x32f2e3[_0x39f6('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4e3768)[_0x39f6('0x1b')](function(_0x4bf5b7){var _0x4183b1=JSON['parse'](_0x4bf5b7);if(_0x4183b1['refresh_token']){_0x32f2e3['refreshToken']=_0x4183b1[_0x39f6('0x1d')];logger[_0x39f6('0x1e')](util[_0x39f6('0x20')](_0x39f6('0x28'),_0x32f2e3[_0x39f6('0x21')],_0x32f2e3['id']));}else{logger[_0x39f6('0x1f')](util[_0x39f6('0x20')](_0x39f6('0x24'),_0x32f2e3['name'],_0x32f2e3['id']),util['inspect'](_0x4183b1,{'showHidden':![],'depth':null}));}return _0x24d6a6(null,_0x453ed4);})[_0x39f6('0x23')](function(_0x256380){logger[_0x39f6('0x1f')](util[_0x39f6('0x20')](_0x39f6('0x24'),_0x32f2e3[_0x39f6('0x21')],_0x32f2e3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x24d6a6(_0x256380);});}else{return _0x24d6a6(null,_0x453ed4);}}}});}; \ No newline at end of file +var _0x6167=['clientId','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','info','catch','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6167,0x163));var _0x7616=function(_0x1721d7,_0x4e6265){_0x1721d7=_0x1721d7-0x0;var _0x143709=_0x6167[_0x1721d7];return _0x143709;};'use strict';var _=require(_0x7616('0x0'));var util=require('util');var logger=require(_0x7616('0x1'))(_0x7616('0x2'));var moment=require(_0x7616('0x3'));var BPromise=require(_0x7616('0x4'));var rp=require(_0x7616('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7616('0x6'));var attributes=require(_0x7616('0x7'));var integrations=require(_0x7616('0x8'));module['exports']=function(_0xde243a,_0x35e339){return _0xde243a[_0x7616('0x9')](_0x7616('0xa'),attributes,{'tableName':_0x7616('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x40fc1e,_0x1b1438,_0x503208){if(_0x40fc1e['changed']('zone')||_0x40fc1e[_0x7616('0xc')](_0x7616('0xd'))||_0x40fc1e[_0x7616('0xc')]('clientId')||_0x40fc1e[_0x7616('0xc')](_0x7616('0xe'))||_0x40fc1e[_0x7616('0xc')]('code')||_0x40fc1e[_0x7616('0xc')]('host')){var _0x28e7dd,_0x80fca6;_0x28e7dd=_0x40fc1e[_0x7616('0xd')];var _0x33a0de=_0x28e7dd[_0x7616('0xf')](-0x1);if(_0x33a0de==='/'||_0x33a0de==='\x5c'||_0x33a0de===':'){_0x28e7dd=_0x28e7dd[_0x7616('0x10')](0x0,_0x28e7dd[_0x7616('0x11')](_0x33a0de));}switch(_0x40fc1e[_0x7616('0x12')]){case'US':_0x80fca6='https://accounts.zoho.com';break;case'AU':_0x80fca6=_0x7616('0x13');break;case'IN':_0x80fca6='https://accounts.zoho.in';break;case'CN':_0x80fca6='https://accounts.zoho.com.cn';break;default:_0x80fca6=_0x7616('0x14');break;}var _0x233d64={'method':_0x7616('0x15'),'uri':_0x80fca6+_0x7616('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x40fc1e[_0x7616('0x17')],'client_secret':_0x40fc1e['clientSecret'],'redirect_uri':_0x40fc1e[_0x7616('0xd')],'code':_0x40fc1e[_0x7616('0x18')]},'headers':{'Content-Type':_0x7616('0x19')}};return rp(_0x233d64)[_0x7616('0x1a')](function(_0x2e2b92){var _0x362875=JSON[_0x7616('0x1b')](_0x2e2b92);if(_0x362875[_0x7616('0x1c')]){_0x40fc1e[_0x7616('0x1d')]=_0x362875[_0x7616('0x1c')];logger['info'](util['format'](_0x7616('0x1e'),_0x40fc1e[_0x7616('0x1f')],_0x40fc1e['id']));}else{logger[_0x7616('0x20')](util[_0x7616('0x21')](_0x7616('0x22'),_0x40fc1e['name'],_0x40fc1e['id']),util['inspect'](_0x362875,{'showHidden':![],'depth':null}));}return _0x503208(null,_0x1b1438);})['catch'](function(_0x44af3a){logger['error'](util['format'](_0x7616('0x22'),_0x40fc1e['name'],_0x40fc1e['id']),util[_0x7616('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x503208(_0x44af3a);});}else{return _0x503208(null,_0x1b1438);}},'beforeUpdate':function(_0x5b7c6c,_0x1fa1d7,_0x422a41){if(_0x5b7c6c['changed']('zone')||_0x5b7c6c[_0x7616('0xc')](_0x7616('0xd'))||_0x5b7c6c[_0x7616('0xc')](_0x7616('0x17'))||_0x5b7c6c['changed']('clientSecret')||_0x5b7c6c[_0x7616('0xc')](_0x7616('0x18'))||_0x5b7c6c[_0x7616('0xc')](_0x7616('0x24'))){var _0x26cd8a,_0x32be7e;_0x26cd8a=_0x5b7c6c['serverUrl'];var _0x58b9d3=_0x26cd8a[_0x7616('0xf')](-0x1);if(_0x58b9d3==='/'||_0x58b9d3==='\x5c'||_0x58b9d3===':'){_0x26cd8a=_0x26cd8a[_0x7616('0x10')](0x0,_0x26cd8a[_0x7616('0x11')](_0x58b9d3));}switch(_0x5b7c6c[_0x7616('0x12')]){case'US':_0x32be7e=_0x7616('0x25');break;case'AU':_0x32be7e=_0x7616('0x13');break;case'IN':_0x32be7e=_0x7616('0x26');break;case'CN':_0x32be7e=_0x7616('0x27');break;default:_0x32be7e=_0x7616('0x14');break;}var _0x417fd0={'method':'POST','uri':_0x32be7e+_0x7616('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x5b7c6c[_0x7616('0x17')],'client_secret':_0x5b7c6c[_0x7616('0xe')],'redirect_uri':_0x5b7c6c[_0x7616('0xd')],'code':_0x5b7c6c[_0x7616('0x18')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x417fd0)[_0x7616('0x1a')](function(_0x15450a){var _0x2356dc=JSON[_0x7616('0x1b')](_0x15450a);if(_0x2356dc[_0x7616('0x1c')]){_0x5b7c6c['refreshToken']=_0x2356dc[_0x7616('0x1c')];logger[_0x7616('0x28')](util[_0x7616('0x21')](_0x7616('0x1e'),_0x5b7c6c[_0x7616('0x1f')],_0x5b7c6c['id']));}else{logger[_0x7616('0x20')](util[_0x7616('0x21')](_0x7616('0x22'),_0x5b7c6c[_0x7616('0x1f')],_0x5b7c6c['id']),util[_0x7616('0x23')](_0x2356dc,{'showHidden':![],'depth':null}));}return _0x422a41(null,_0x1fa1d7);})[_0x7616('0x29')](function(_0x41476b){logger[_0x7616('0x20')](util[_0x7616('0x21')](_0x7616('0x22'),_0x5b7c6c[_0x7616('0x1f')],_0x5b7c6c['id']),util[_0x7616('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x422a41(_0x41476b);});}else{return _0x422a41(null,_0x1fa1d7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 93bab24..cc17607 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 _0x881e=['../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ZohoAccount','findAll','options','raw','where','limit','include','map','attributes','GetZohoAccount','find','model','ShowZohoAccount','moment','bluebird','ioredis','../../config/utils'];(function(_0x4647bd,_0x18d56d){var _0x1754dd=function(_0x2d4489){while(--_0x2d4489){_0x4647bd['push'](_0x4647bd['shift']());}};_0x1754dd(++_0x18d56d);}(_0x881e,0x146));var _0xe881=function(_0x53786f,_0x33fa65){_0x53786f=_0x53786f-0x0;var _0x49346e=_0x881e[_0x53786f];return _0x49346e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe881('0x0'));var BPromise=require(_0xe881('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe881('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe881('0x3'));var logger=require(_0xe881('0x4'))(_0xe881('0x5'));var config=require(_0xe881('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe881('0x7')][_0xe881('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x561c1c,_0x3f6894,_0x2413dc){return new BPromise(function(_0xe16d23,_0x547217){return client['request'](_0x561c1c,_0x2413dc)[_0xe881('0x9')](function(_0x26e29e){logger[_0xe881('0xa')](_0xe881('0xb'),_0x3f6894,'request\x20sent');logger[_0xe881('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3f6894,_0xe881('0xd'),JSON[_0xe881('0xe')](_0x26e29e));if(_0x26e29e[_0xe881('0xf')]){if(_0x26e29e[_0xe881('0xf')][_0xe881('0x10')]===0x1f4){logger[_0xe881('0xf')](_0xe881('0xb'),_0x3f6894,_0x26e29e['error'][_0xe881('0x11')]);return _0x547217(_0x26e29e[_0xe881('0xf')][_0xe881('0x11')]);}logger['error'](_0xe881('0xb'),_0x3f6894,_0x26e29e['error'][_0xe881('0x11')]);return _0xe16d23(_0x26e29e[_0xe881('0xf')][_0xe881('0x11')]);}else{logger[_0xe881('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x3f6894,_0xe881('0xd'));_0xe16d23(_0x26e29e[_0xe881('0x12')][_0xe881('0x11')]);}})[_0xe881('0x13')](function(_0x59b441){logger[_0xe881('0xf')](_0xe881('0xb'),_0x3f6894,_0x59b441);_0x547217(_0x59b441);});});}exports['GetZohoAccount']=function(_0x592fd0){var _0x22b092=this;return new Promise(function(_0x1cfaa9,_0x3e774a){return db[_0xe881('0x14')][_0xe881('0x15')]({'raw':_0x592fd0[_0xe881('0x16')]?_0x592fd0[_0xe881('0x16')][_0xe881('0x17')]===undefined?!![]:![]:!![],'where':_0x592fd0[_0xe881('0x16')]?_0x592fd0[_0xe881('0x16')][_0xe881('0x18')]||null:null,'attributes':_0x592fd0[_0xe881('0x16')]?_0x592fd0[_0xe881('0x16')]['attributes']||null:null,'limit':_0x592fd0[_0xe881('0x16')]?_0x592fd0[_0xe881('0x16')][_0xe881('0x19')]||null:null,'include':_0x592fd0[_0xe881('0x16')]?_0x592fd0[_0xe881('0x16')][_0xe881('0x1a')]?_[_0xe881('0x1b')](_0x592fd0[_0xe881('0x16')][_0xe881('0x1a')],function(_0xd335a0){return{'model':db[_0xd335a0['model']],'as':_0xd335a0['as'],'attributes':_0xd335a0['attributes'],'include':_0xd335a0[_0xe881('0x1a')]?_['map'](_0xd335a0[_0xe881('0x1a')],function(_0x53bd85){return{'model':db[_0x53bd85['model']],'as':_0x53bd85['as'],'attributes':_0x53bd85['attributes'],'include':_0x53bd85['include']?_[_0xe881('0x1b')](_0x53bd85['include'],function(_0x592d02){return{'model':db[_0x592d02['model']],'as':_0x592d02['as'],'attributes':_0x592d02[_0xe881('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe881('0x9')](function(_0x5c4f82){logger[_0xe881('0xa')](_0xe881('0x1d'),_0x592fd0);logger[_0xe881('0xc')](_0xe881('0x1d'),_0x592fd0,JSON[_0xe881('0xe')](_0x5c4f82));_0x1cfaa9(_0x5c4f82);})[_0xe881('0x13')](function(_0x1aba0d){logger[_0xe881('0xf')]('GetZohoAccount',_0x1aba0d[_0xe881('0x11')],_0x592fd0);_0x3e774a(_0x22b092[_0xe881('0xf')](0x1f4,_0x1aba0d[_0xe881('0x11')]));});});};exports['ShowZohoAccount']=function(_0x134ca0){var _0x5551d5=this;return new Promise(function(_0x18d6f2,_0x4552eb){return db[_0xe881('0x14')][_0xe881('0x1e')]({'raw':_0x134ca0[_0xe881('0x16')]?_0x134ca0[_0xe881('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x134ca0['options']?_0x134ca0[_0xe881('0x16')][_0xe881('0x18')]||null:null,'attributes':_0x134ca0[_0xe881('0x16')]?_0x134ca0[_0xe881('0x16')][_0xe881('0x1c')]||null:null,'include':_0x134ca0[_0xe881('0x16')]?_0x134ca0[_0xe881('0x16')]['include']?_[_0xe881('0x1b')](_0x134ca0['options'][_0xe881('0x1a')],function(_0x38353d){return{'model':db[_0x38353d[_0xe881('0x1f')]],'as':_0x38353d['as'],'attributes':_0x38353d[_0xe881('0x1c')],'include':_0x38353d[_0xe881('0x1a')]?_[_0xe881('0x1b')](_0x38353d[_0xe881('0x1a')],function(_0x4a2126){return{'model':db[_0x4a2126[_0xe881('0x1f')]],'as':_0x4a2126['as'],'attributes':_0x4a2126[_0xe881('0x1c')],'include':_0x4a2126['include']?_[_0xe881('0x1b')](_0x4a2126['include'],function(_0x30c325){return{'model':db[_0x30c325[_0xe881('0x1f')]],'as':_0x30c325['as'],'attributes':_0x30c325[_0xe881('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48945f){logger[_0xe881('0xa')](_0xe881('0x20'),_0x134ca0);logger[_0xe881('0xc')](_0xe881('0x20'),_0x134ca0,JSON[_0xe881('0xe')](_0x48945f));_0x18d6f2(_0x48945f);})[_0xe881('0x13')](function(_0x43f250){logger[_0xe881('0xf')](_0xe881('0x20'),_0x43f250['message'],_0x134ca0);_0x4552eb(_0x5551d5[_0xe881('0xf')](0x1f4,_0x43f250['message']));});});}; \ No newline at end of file +var _0xa057=['../../config/logger','../../config/environment','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model','then','find','raw','ShowZohoAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x111ac6,_0x7bce1){var _0x110ed1=function(_0x245203){while(--_0x245203){_0x111ac6['push'](_0x111ac6['shift']());}};_0x110ed1(++_0x7bce1);}(_0xa057,0x123));var _0x7a05=function(_0x4e3fd0,_0x1b4b89){_0x4e3fd0=_0x4e3fd0-0x0;var _0x50ea4d=_0xa057[_0x4e3fd0];return _0x50ea4d;};'use strict';var _=require(_0x7a05('0x0'));var util=require(_0x7a05('0x1'));var moment=require('moment');var BPromise=require(_0x7a05('0x2'));var rs=require(_0x7a05('0x3'));var fs=require('fs');var Redis=require(_0x7a05('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a05('0x5'));var logger=require(_0x7a05('0x6'))('rpc');var config=require(_0x7a05('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19e056,_0x2572af,_0x560067){return new BPromise(function(_0x32d32f,_0x2135d2){return client[_0x7a05('0x9')](_0x19e056,_0x560067)['then'](function(_0x31841c){logger[_0x7a05('0xa')](_0x7a05('0xb'),_0x2572af,_0x7a05('0xc'));logger[_0x7a05('0xd')](_0x7a05('0xe'),_0x2572af,'request\x20sent',JSON[_0x7a05('0xf')](_0x31841c));if(_0x31841c[_0x7a05('0x10')]){if(_0x31841c['error']['code']===0x1f4){logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x2572af,_0x31841c['error']['message']);return _0x2135d2(_0x31841c['error'][_0x7a05('0x11')]);}logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x2572af,_0x31841c[_0x7a05('0x10')][_0x7a05('0x11')]);return _0x32d32f(_0x31841c[_0x7a05('0x10')][_0x7a05('0x11')]);}else{logger[_0x7a05('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x2572af,'request\x20sent');_0x32d32f(_0x31841c[_0x7a05('0x12')][_0x7a05('0x11')]);}})['catch'](function(_0x5ad0e6){logger[_0x7a05('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2572af,_0x5ad0e6);_0x2135d2(_0x5ad0e6);});});}exports[_0x7a05('0x13')]=function(_0x449d86){var _0x9e6a53=this;return new Promise(function(_0x5a9477,_0x519666){return db[_0x7a05('0x14')]['findAll']({'raw':_0x449d86[_0x7a05('0x15')]?_0x449d86[_0x7a05('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x449d86['options']?_0x449d86['options'][_0x7a05('0x16')]||null:null,'attributes':_0x449d86[_0x7a05('0x15')]?_0x449d86[_0x7a05('0x15')][_0x7a05('0x17')]||null:null,'limit':_0x449d86['options']?_0x449d86[_0x7a05('0x15')][_0x7a05('0x18')]||null:null,'include':_0x449d86[_0x7a05('0x15')]?_0x449d86['options'][_0x7a05('0x19')]?_[_0x7a05('0x1a')](_0x449d86[_0x7a05('0x15')][_0x7a05('0x19')],function(_0x1b62de){return{'model':db[_0x1b62de[_0x7a05('0x1b')]],'as':_0x1b62de['as'],'attributes':_0x1b62de[_0x7a05('0x17')],'include':_0x1b62de[_0x7a05('0x19')]?_[_0x7a05('0x1a')](_0x1b62de[_0x7a05('0x19')],function(_0x2c2390){return{'model':db[_0x2c2390['model']],'as':_0x2c2390['as'],'attributes':_0x2c2390['attributes'],'include':_0x2c2390['include']?_[_0x7a05('0x1a')](_0x2c2390[_0x7a05('0x19')],function(_0x124697){return{'model':db[_0x124697[_0x7a05('0x1b')]],'as':_0x124697['as'],'attributes':_0x124697[_0x7a05('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7a05('0x1c')](function(_0x2fafe7){logger[_0x7a05('0xa')](_0x7a05('0x13'),_0x449d86);logger['debug']('GetZohoAccount',_0x449d86,JSON[_0x7a05('0xf')](_0x2fafe7));_0x5a9477(_0x2fafe7);})['catch'](function(_0x4f26bc){logger[_0x7a05('0x10')](_0x7a05('0x13'),_0x4f26bc[_0x7a05('0x11')],_0x449d86);_0x519666(_0x9e6a53[_0x7a05('0x10')](0x1f4,_0x4f26bc[_0x7a05('0x11')]));});});};exports['ShowZohoAccount']=function(_0x1106ad){var _0x272034=this;return new Promise(function(_0x37dbf1,_0x479c10){return db[_0x7a05('0x14')][_0x7a05('0x1d')]({'raw':_0x1106ad[_0x7a05('0x15')]?_0x1106ad['options'][_0x7a05('0x1e')]===undefined?!![]:![]:!![],'where':_0x1106ad[_0x7a05('0x15')]?_0x1106ad[_0x7a05('0x15')][_0x7a05('0x16')]||null:null,'attributes':_0x1106ad['options']?_0x1106ad[_0x7a05('0x15')]['attributes']||null:null,'include':_0x1106ad[_0x7a05('0x15')]?_0x1106ad[_0x7a05('0x15')]['include']?_[_0x7a05('0x1a')](_0x1106ad[_0x7a05('0x15')][_0x7a05('0x19')],function(_0x4e52bd){return{'model':db[_0x4e52bd[_0x7a05('0x1b')]],'as':_0x4e52bd['as'],'attributes':_0x4e52bd[_0x7a05('0x17')],'include':_0x4e52bd['include']?_[_0x7a05('0x1a')](_0x4e52bd[_0x7a05('0x19')],function(_0x4f0fb6){return{'model':db[_0x4f0fb6['model']],'as':_0x4f0fb6['as'],'attributes':_0x4f0fb6[_0x7a05('0x17')],'include':_0x4f0fb6[_0x7a05('0x19')]?_['map'](_0x4f0fb6[_0x7a05('0x19')],function(_0x39a83c){return{'model':db[_0x39a83c[_0x7a05('0x1b')]],'as':_0x39a83c['as'],'attributes':_0x39a83c[_0x7a05('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44ca67){logger[_0x7a05('0xa')](_0x7a05('0x1f'),_0x1106ad);logger[_0x7a05('0xd')]('ShowZohoAccount',_0x1106ad,JSON['stringify'](_0x44ca67));_0x37dbf1(_0x44ca67);})[_0x7a05('0x20')](function(_0x52edc1){logger[_0x7a05('0x10')]('ShowZohoAccount',_0x52edc1['message'],_0x1106ad);_0x479c10(_0x272034[_0x7a05('0x10')](0x1f4,_0x52edc1[_0x7a05('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 6f693c5..1910b53 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 _0x2851=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','put','/:id','update'];(function(_0xdfd063,_0x49dbc2){var _0x5de615=function(_0x3d2565){while(--_0x3d2565){_0xdfd063['push'](_0xdfd063['shift']());}};_0x5de615(++_0x49dbc2);}(_0x2851,0x92));var _0x1285=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2851[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x1285('0x0'));var util=require(_0x1285('0x1'));var path=require(_0x1285('0x2'));var timeout=require(_0x1285('0x3'));var express=require(_0x1285('0x4'));var router=express[_0x1285('0x5')]();var fs_extra=require(_0x1285('0x6'));var auth=require(_0x1285('0x7'));var interaction=require(_0x1285('0x8'));var config=require(_0x1285('0x9'));var controller=require(_0x1285('0xa'));router[_0x1285('0xb')]('/',auth[_0x1285('0xc')](),controller[_0x1285('0xd')]);router[_0x1285('0xb')]('/:id',auth[_0x1285('0xc')](),controller['show']);router['get'](_0x1285('0xe'),auth[_0x1285('0xc')](),controller['getFields']);router[_0x1285('0xb')](_0x1285('0xf'),auth[_0x1285('0xc')](),controller[_0x1285('0x10')]);router[_0x1285('0xb')]('/:id/descriptions',auth[_0x1285('0xc')](),controller[_0x1285('0x11')]);router[_0x1285('0x12')]('/',auth[_0x1285('0xc')](),controller['create']);router[_0x1285('0x13')](_0x1285('0x14'),auth['isAuthenticated'](),controller[_0x1285('0x15')]);router[_0x1285('0x16')](_0x1285('0x14'),auth[_0x1285('0xc')](),controller['destroy']);module[_0x1285('0x17')]=router; \ No newline at end of file +var _0xeaf5=['../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','show','get','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaf5,0x14b));var _0x5eaf=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xeaf5[_0xffa198];return _0x1e4b50;};'use strict';var multer=require(_0x5eaf('0x0'));var util=require(_0x5eaf('0x1'));var path=require(_0x5eaf('0x2'));var timeout=require(_0x5eaf('0x3'));var express=require(_0x5eaf('0x4'));var router=express['Router']();var fs_extra=require(_0x5eaf('0x5'));var auth=require(_0x5eaf('0x6'));var interaction=require(_0x5eaf('0x7'));var config=require(_0x5eaf('0x8'));var controller=require(_0x5eaf('0x9'));router['get']('/',auth[_0x5eaf('0xa')](),controller[_0x5eaf('0xb')]);router['get']('/:id',auth[_0x5eaf('0xa')](),controller[_0x5eaf('0xc')]);router[_0x5eaf('0xd')](_0x5eaf('0xe'),auth[_0x5eaf('0xa')](),controller['getFields']);router[_0x5eaf('0xd')]('/:id/subjects',auth[_0x5eaf('0xa')](),controller[_0x5eaf('0xf')]);router[_0x5eaf('0xd')](_0x5eaf('0x10'),auth[_0x5eaf('0xa')](),controller[_0x5eaf('0x11')]);router[_0x5eaf('0x12')]('/',auth[_0x5eaf('0xa')](),controller[_0x5eaf('0x13')]);router[_0x5eaf('0x14')](_0x5eaf('0x15'),auth[_0x5eaf('0xa')](),controller[_0x5eaf('0x16')]);router[_0x5eaf('0x17')](_0x5eaf('0x15'),auth['isAuthenticated'](),controller[_0x5eaf('0x18')]);module[_0x5eaf('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index eac79f3..302f6ec 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 _0x1793=['STRING','ENUM','contact','nothing','lead','contact_lead','sequelize','exports'];(function(_0x12ea3c,_0x56f826){var _0x435787=function(_0x1e0c76){while(--_0x1e0c76){_0x12ea3c['push'](_0x12ea3c['shift']());}};_0x435787(++_0x56f826);}(_0x1793,0x1ce));var _0x3179=function(_0x47f19d,_0x30582c){_0x47f19d=_0x47f19d-0x0;var _0x1fc180=_0x1793[_0x47f19d];return _0x1fc180;};'use strict';var Sequelize=require(_0x3179('0x0'));module[_0x3179('0x1')]={'name':{'type':Sequelize[_0x3179('0x2')]},'moduleCreate':{'type':Sequelize[_0x3179('0x3')]('lead',_0x3179('0x4'),_0x3179('0x5')),'defaultValue':_0x3179('0x6')},'moduleSearch':{'type':Sequelize[_0x3179('0x3')](_0x3179('0x7'),'contact','lead'),'defaultValue':_0x3179('0x7')},'description':{'type':Sequelize[_0x3179('0x2')]}}; \ No newline at end of file +var _0x3320=['lead','contact','nothing','contact_lead','exports','STRING'];(function(_0x4c1ce7,_0x3cf13e){var _0x21e803=function(_0x36e59f){while(--_0x36e59f){_0x4c1ce7['push'](_0x4c1ce7['shift']());}};_0x21e803(++_0x3cf13e);}(_0x3320,0x13c));var _0x0332=function(_0x5b0f24,_0x3439ff){_0x5b0f24=_0x5b0f24-0x0;var _0x315d8c=_0x3320[_0x5b0f24];return _0x315d8c;};'use strict';var Sequelize=require('sequelize');module[_0x0332('0x0')]={'name':{'type':Sequelize[_0x0332('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x0332('0x2'),_0x0332('0x3'),_0x0332('0x4')),'defaultValue':_0x0332('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x0332('0x5'),_0x0332('0x3'),_0x0332('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x0332('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index ac7ce1b..50f3dde 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 _0xa429=['getFields','findOne','ZohoField','options','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','find','create','body'];(function(_0x2713e0,_0x16fbf9){var _0x3ce6d7=function(_0x577ed3){while(--_0x577ed3){_0x2713e0['push'](_0x2713e0['shift']());}};_0x3ce6d7(++_0x16fbf9);}(_0xa429,0xa7));var _0x9a42=function(_0x18a4b3,_0x3af36b){_0x18a4b3=_0x18a4b3-0x0;var _0x2b8e43=_0xa429[_0x18a4b3];return _0x2b8e43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a42('0x0'));var zipdir=require(_0x9a42('0x1'));var jsonpatch=require(_0x9a42('0x2'));var rp=require(_0x9a42('0x3'));var moment=require(_0x9a42('0x4'));var BPromise=require(_0x9a42('0x5'));var Mustache=require('mustache');var util=require(_0x9a42('0x6'));var path=require(_0x9a42('0x7'));var sox=require(_0x9a42('0x8'));var csv=require(_0x9a42('0x9'));var ejs=require(_0x9a42('0xa'));var fs=require('fs');var fs_extra=require(_0x9a42('0xb'));var _=require(_0x9a42('0xc'));var squel=require('squel');var crypto=require(_0x9a42('0xd'));var jsforce=require(_0x9a42('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9a42('0x9'));var querystring=require(_0x9a42('0xf'));var Papa=require(_0x9a42('0x10'));var Redis=require(_0x9a42('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a42('0x12'));var hardwareService=require(_0x9a42('0x13'));var logger=require(_0x9a42('0x14'))(_0x9a42('0x15'));var utils=require(_0x9a42('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9a42('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c6a09,_0x556b28){_0x556b28=_0x556b28||0xcc;return function(_0x5cee9d){if(_0x5cee9d){return _0x1c6a09[_0x9a42('0x18')](_0x556b28);}return _0x1c6a09[_0x9a42('0x19')](_0x556b28)[_0x9a42('0x1a')]();};}function respondWithResult(_0x469650,_0x11cbd1){_0x11cbd1=_0x11cbd1||0xc8;return function(_0x1263ab){if(_0x1263ab){return _0x469650[_0x9a42('0x19')](_0x11cbd1)[_0x9a42('0x1b')](_0x1263ab);}};}function respondWithFilteredResult(_0x591889,_0x337c8d){return function(_0x4fdcf1){if(_0x4fdcf1){var _0x4004d6=typeof _0x337c8d[_0x9a42('0x1c')]===_0x9a42('0x1d')&&typeof _0x337c8d[_0x9a42('0x1e')]===_0x9a42('0x1d');var _0x2d2ccb=_0x4fdcf1[_0x9a42('0x1f')];var _0x27db84=_0x4004d6?0x0:_0x337c8d[_0x9a42('0x1c')];var _0x2a75ab=_0x4004d6?_0x4fdcf1[_0x9a42('0x1f')]:_0x337c8d[_0x9a42('0x1c')]+_0x337c8d[_0x9a42('0x1e')];var _0x1c9d9d;if(_0x2a75ab>=_0x2d2ccb){_0x2a75ab=_0x2d2ccb;_0x1c9d9d=0xc8;}else{_0x1c9d9d=0xce;}_0x591889[_0x9a42('0x19')](_0x1c9d9d);return _0x591889[_0x9a42('0x20')](_0x9a42('0x21'),_0x27db84+'-'+_0x2a75ab+'/'+_0x2d2ccb)[_0x9a42('0x1b')](_0x4fdcf1);}return null;};}function patchUpdates(_0x29f026){return function(_0x1ff809){try{jsonpatch['apply'](_0x1ff809,_0x29f026,!![]);}catch(_0x37f0e8){return BPromise[_0x9a42('0x22')](_0x37f0e8);}return _0x1ff809[_0x9a42('0x23')]();};}function saveUpdates(_0x1c24d7,_0xd08548){return function(_0x544ecd){if(_0x544ecd){return _0x544ecd[_0x9a42('0x24')](_0x1c24d7)['then'](function(_0x200e64){return _0x200e64;});}return null;};}function removeEntity(_0x56037c,_0x5f5b5b){return function(_0x57b579){if(_0x57b579){return _0x57b579[_0x9a42('0x25')]()[_0x9a42('0x26')](function(){_0x56037c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x356ad4,_0x2f4204){return function(_0x1536e5){if(!_0x1536e5){_0x356ad4[_0x9a42('0x18')](0x194);}return _0x1536e5;};}function handleError(_0x648778,_0x14d562){_0x14d562=_0x14d562||0x1f4;return function(_0x392a4e){logger[_0x9a42('0x27')](_0x392a4e[_0x9a42('0x28')]);if(_0x392a4e[_0x9a42('0x29')]){delete _0x392a4e['name'];}_0x648778['status'](_0x14d562)[_0x9a42('0x2a')](_0x392a4e);};}exports['index']=function(_0x1c5694,_0x5d920c){var _0x3945a2={},_0x2d3058={},_0xa6d85b={'count':0x0,'rows':[]};var _0x32274f=_[_0x9a42('0x2b')](db[_0x9a42('0x2c')][_0x9a42('0x2d')],function(_0x1bd0f4){return{'name':_0x1bd0f4[_0x9a42('0x2e')],'type':_0x1bd0f4[_0x9a42('0x2f')][_0x9a42('0x30')]};});_0x2d3058[_0x9a42('0x31')]=_[_0x9a42('0x2b')](_0x32274f,_0x9a42('0x29'));_0x2d3058['query']=_[_0x9a42('0x32')](_0x1c5694[_0x9a42('0x33')]);_0x2d3058[_0x9a42('0x34')]=_[_0x9a42('0x35')](_0x2d3058[_0x9a42('0x31')],_0x2d3058[_0x9a42('0x33')]);_0x3945a2[_0x9a42('0x36')]=_[_0x9a42('0x35')](_0x2d3058['model'],qs['fields'](_0x1c5694['query'][_0x9a42('0x37')]));_0x3945a2['attributes']=_0x3945a2[_0x9a42('0x36')][_0x9a42('0x38')]?_0x3945a2[_0x9a42('0x36')]:_0x2d3058[_0x9a42('0x31')];if(!_0x1c5694[_0x9a42('0x33')]['hasOwnProperty'](_0x9a42('0x39'))){_0x3945a2['limit']=qs['limit'](_0x1c5694[_0x9a42('0x33')]['limit']);_0x3945a2[_0x9a42('0x1c')]=qs[_0x9a42('0x1c')](_0x1c5694['query'][_0x9a42('0x1c')]);}_0x3945a2[_0x9a42('0x3a')]=qs[_0x9a42('0x3b')](_0x1c5694[_0x9a42('0x33')][_0x9a42('0x3b')]);_0x3945a2[_0x9a42('0x3c')]=qs[_0x9a42('0x34')](_[_0x9a42('0x3d')](_0x1c5694[_0x9a42('0x33')],_0x2d3058[_0x9a42('0x34')]),_0x32274f);if(_0x1c5694[_0x9a42('0x33')]['filter']){_0x3945a2[_0x9a42('0x3c')]=_[_0x9a42('0x3e')](_0x3945a2[_0x9a42('0x3c')],{'$or':_[_0x9a42('0x2b')](_0x32274f,function(_0x5a5eeb){if(_0x5a5eeb[_0x9a42('0x2f')]!==_0x9a42('0x3f')){var _0x34395c={};_0x34395c[_0x5a5eeb[_0x9a42('0x29')]]={'$like':'%'+_0x1c5694['query'][_0x9a42('0x40')]+'%'};return _0x34395c;}})});}_0x3945a2=_[_0x9a42('0x3e')]({},_0x3945a2,_0x1c5694['options']);var _0x4d2abf={'where':_0x3945a2[_0x9a42('0x3c')]};return db[_0x9a42('0x2c')][_0x9a42('0x1f')](_0x4d2abf)['then'](function(_0x32104e){_0xa6d85b['count']=_0x32104e;if(_0x1c5694[_0x9a42('0x33')][_0x9a42('0x41')]){_0x3945a2[_0x9a42('0x42')]=[{'all':!![]}];}return db[_0x9a42('0x2c')]['findAll'](_0x3945a2);})['then'](function(_0x154001){_0xa6d85b['rows']=_0x154001;return _0xa6d85b;})[_0x9a42('0x26')](respondWithFilteredResult(_0x5d920c,_0x3945a2))[_0x9a42('0x43')](handleError(_0x5d920c,null));};exports[_0x9a42('0x44')]=function(_0x569252,_0x152670){var _0x5469c8={'raw':![],'where':{'id':_0x569252[_0x9a42('0x45')]['id']}},_0x29d06d={};_0x29d06d[_0x9a42('0x31')]=_['keys'](db[_0x9a42('0x2c')]['rawAttributes']);_0x29d06d[_0x9a42('0x33')]=_['keys'](_0x569252[_0x9a42('0x33')]);_0x29d06d[_0x9a42('0x34')]=_['intersection'](_0x29d06d[_0x9a42('0x31')],_0x29d06d['query']);_0x5469c8[_0x9a42('0x36')]=_[_0x9a42('0x35')](_0x29d06d['model'],qs[_0x9a42('0x37')](_0x569252[_0x9a42('0x33')][_0x9a42('0x37')]));_0x5469c8['attributes']=_0x5469c8['attributes'][_0x9a42('0x38')]?_0x5469c8[_0x9a42('0x36')]:_0x29d06d['model'];if(_0x569252[_0x9a42('0x33')]['includeAll']){_0x5469c8[_0x9a42('0x42')]=[{'all':!![]}];}_0x5469c8=_[_0x9a42('0x3e')]({},_0x5469c8,_0x569252['options']);return db['ZohoConfiguration'][_0x9a42('0x46')](_0x5469c8)['then'](handleEntityNotFound(_0x152670,null))['then'](respondWithResult(_0x152670,null))[_0x9a42('0x43')](handleError(_0x152670,null));};exports[_0x9a42('0x47')]=function(_0x13a6d4,_0x5dce93){return db[_0x9a42('0x2c')][_0x9a42('0x47')](_0x13a6d4[_0x9a42('0x48')],{})[_0x9a42('0x26')](respondWithResult(_0x5dce93,0xc9))[_0x9a42('0x43')](handleError(_0x5dce93,null));};exports[_0x9a42('0x24')]=function(_0x180c3e,_0x216aae){if(_0x180c3e[_0x9a42('0x48')]['id']){delete _0x180c3e[_0x9a42('0x48')]['id'];}return db[_0x9a42('0x2c')][_0x9a42('0x46')]({'where':{'id':_0x180c3e[_0x9a42('0x45')]['id']}})[_0x9a42('0x26')](handleEntityNotFound(_0x216aae,null))[_0x9a42('0x26')](saveUpdates(_0x180c3e[_0x9a42('0x48')],null))[_0x9a42('0x26')](respondWithResult(_0x216aae,null))[_0x9a42('0x43')](handleError(_0x216aae,null));};exports[_0x9a42('0x25')]=function(_0x19f8ac,_0x3c5037){return db[_0x9a42('0x2c')][_0x9a42('0x46')]({'where':{'id':_0x19f8ac[_0x9a42('0x45')]['id']}})[_0x9a42('0x26')](handleEntityNotFound(_0x3c5037,null))['then'](removeEntity(_0x3c5037,null))[_0x9a42('0x43')](handleError(_0x3c5037,null));};exports[_0x9a42('0x49')]=function(_0x547561,_0x13f9b4,_0xfba586){var _0x2ccb73={};var _0x13c3f2={};var _0x21f7aa;var _0x293e2d;return db[_0x9a42('0x2c')][_0x9a42('0x4a')]({'where':{'id':_0x547561[_0x9a42('0x45')]['id']}})[_0x9a42('0x26')](handleEntityNotFound(_0x13f9b4,null))['then'](function(_0x32711a){if(_0x32711a){_0x21f7aa=_0x32711a;_0x13c3f2[_0x9a42('0x31')]=_[_0x9a42('0x32')](db[_0x9a42('0x4b')]['rawAttributes']);_0x13c3f2['query']=_[_0x9a42('0x32')](_0x547561[_0x9a42('0x33')]);_0x13c3f2[_0x9a42('0x34')]=_[_0x9a42('0x35')](_0x13c3f2[_0x9a42('0x31')],_0x13c3f2[_0x9a42('0x33')]);_0x2ccb73['attributes']=_[_0x9a42('0x35')](_0x13c3f2[_0x9a42('0x31')],qs[_0x9a42('0x37')](_0x547561[_0x9a42('0x33')][_0x9a42('0x37')]));_0x2ccb73[_0x9a42('0x36')]=_0x2ccb73[_0x9a42('0x36')]['length']?_0x2ccb73[_0x9a42('0x36')]:_0x13c3f2['model'];_0x2ccb73[_0x9a42('0x3a')]=qs['sort'](_0x547561[_0x9a42('0x33')][_0x9a42('0x3b')]);_0x2ccb73[_0x9a42('0x3c')]=qs['filters'](_[_0x9a42('0x3d')](_0x547561[_0x9a42('0x33')],_0x13c3f2[_0x9a42('0x34')]));if(_0x547561[_0x9a42('0x33')][_0x9a42('0x40')]){_0x2ccb73['where']=_[_0x9a42('0x3e')](_0x2ccb73[_0x9a42('0x3c')],{'$or':_[_0x9a42('0x2b')](_0x2ccb73[_0x9a42('0x36')],function(_0x2e1956){var _0x420108={};_0x420108[_0x2e1956]={'$like':'%'+_0x547561[_0x9a42('0x33')][_0x9a42('0x40')]+'%'};return _0x420108;})});}_0x2ccb73=_['merge']({},_0x2ccb73,_0x547561[_0x9a42('0x4c')]);return _0x21f7aa[_0x9a42('0x49')](_0x2ccb73);}})[_0x9a42('0x26')](function(_0xae4d85){if(_0xae4d85){_0x293e2d=_0xae4d85[_0x9a42('0x38')];if(!_0x547561[_0x9a42('0x33')][_0x9a42('0x4d')]('nolimit')){_0x2ccb73['limit']=qs[_0x9a42('0x1e')](_0x547561[_0x9a42('0x33')][_0x9a42('0x1e')]);_0x2ccb73[_0x9a42('0x1c')]=qs[_0x9a42('0x1c')](_0x547561[_0x9a42('0x33')][_0x9a42('0x1c')]);}return _0x21f7aa[_0x9a42('0x49')](_0x2ccb73);}})[_0x9a42('0x26')](function(_0x13e410){if(_0x13e410){return _0x13e410?{'count':_0x293e2d,'rows':_0x13e410}:null;}})[_0x9a42('0x26')](respondWithResult(_0x13f9b4,null))['catch'](handleError(_0x13f9b4,null));};exports[_0x9a42('0x4e')]=function(_0x53be82,_0xef201d,_0x108d6f){var _0x47984c={};var _0x5b6e7b={};var _0x52b074;var _0x51690c;return db[_0x9a42('0x2c')][_0x9a42('0x4a')]({'where':{'id':_0x53be82[_0x9a42('0x45')]['id']}})[_0x9a42('0x26')](handleEntityNotFound(_0xef201d,null))[_0x9a42('0x26')](function(_0x211731){if(_0x211731){_0x52b074=_0x211731;_0x5b6e7b[_0x9a42('0x31')]=_[_0x9a42('0x32')](db[_0x9a42('0x4b')]['rawAttributes']);_0x5b6e7b[_0x9a42('0x33')]=_[_0x9a42('0x32')](_0x53be82['query']);_0x5b6e7b[_0x9a42('0x34')]=_[_0x9a42('0x35')](_0x5b6e7b[_0x9a42('0x31')],_0x5b6e7b[_0x9a42('0x33')]);_0x47984c[_0x9a42('0x36')]=_[_0x9a42('0x35')](_0x5b6e7b[_0x9a42('0x31')],qs[_0x9a42('0x37')](_0x53be82[_0x9a42('0x33')][_0x9a42('0x37')]));_0x47984c[_0x9a42('0x36')]=_0x47984c['attributes'][_0x9a42('0x38')]?_0x47984c[_0x9a42('0x36')]:_0x5b6e7b[_0x9a42('0x31')];_0x47984c[_0x9a42('0x3a')]=qs['sort'](_0x53be82[_0x9a42('0x33')][_0x9a42('0x3b')]);_0x47984c[_0x9a42('0x3c')]=qs[_0x9a42('0x34')](_[_0x9a42('0x3d')](_0x53be82[_0x9a42('0x33')],_0x5b6e7b['filters']));if(_0x53be82[_0x9a42('0x33')][_0x9a42('0x40')]){_0x47984c[_0x9a42('0x3c')]=_[_0x9a42('0x3e')](_0x47984c[_0x9a42('0x3c')],{'$or':_[_0x9a42('0x2b')](_0x47984c[_0x9a42('0x36')],function(_0x2a558c){var _0x870061={};_0x870061[_0x2a558c]={'$like':'%'+_0x53be82[_0x9a42('0x33')][_0x9a42('0x40')]+'%'};return _0x870061;})});}_0x47984c=_['merge']({},_0x47984c,_0x53be82[_0x9a42('0x4c')]);return _0x52b074[_0x9a42('0x4e')](_0x47984c);}})['then'](function(_0x133933){if(_0x133933){_0x51690c=_0x133933[_0x9a42('0x38')];if(!_0x53be82['query'][_0x9a42('0x4d')](_0x9a42('0x39'))){_0x47984c[_0x9a42('0x1e')]=qs[_0x9a42('0x1e')](_0x53be82['query'][_0x9a42('0x1e')]);_0x47984c['offset']=qs[_0x9a42('0x1c')](_0x53be82['query'][_0x9a42('0x1c')]);}return _0x52b074[_0x9a42('0x4e')](_0x47984c);}})[_0x9a42('0x26')](function(_0x45d3fa){if(_0x45d3fa){return _0x45d3fa?{'count':_0x51690c,'rows':_0x45d3fa}:null;}})[_0x9a42('0x26')](respondWithResult(_0xef201d,null))[_0x9a42('0x43')](handleError(_0xef201d,null));};exports[_0x9a42('0x4f')]=function(_0x13089d,_0x1ccd7a,_0x455714){var _0x9c4f0c={};var _0x1f3e40={};var _0x3b5912;var _0x233031;return db[_0x9a42('0x2c')][_0x9a42('0x4a')]({'where':{'id':_0x13089d[_0x9a42('0x45')]['id']}})[_0x9a42('0x26')](handleEntityNotFound(_0x1ccd7a,null))['then'](function(_0xf4f8ad){if(_0xf4f8ad){_0x3b5912=_0xf4f8ad;_0x1f3e40[_0x9a42('0x31')]=_[_0x9a42('0x32')](db[_0x9a42('0x4b')][_0x9a42('0x2d')]);_0x1f3e40[_0x9a42('0x33')]=_['keys'](_0x13089d[_0x9a42('0x33')]);_0x1f3e40[_0x9a42('0x34')]=_[_0x9a42('0x35')](_0x1f3e40[_0x9a42('0x31')],_0x1f3e40[_0x9a42('0x33')]);_0x9c4f0c[_0x9a42('0x36')]=_[_0x9a42('0x35')](_0x1f3e40[_0x9a42('0x31')],qs[_0x9a42('0x37')](_0x13089d[_0x9a42('0x33')][_0x9a42('0x37')]));_0x9c4f0c[_0x9a42('0x36')]=_0x9c4f0c[_0x9a42('0x36')][_0x9a42('0x38')]?_0x9c4f0c['attributes']:_0x1f3e40[_0x9a42('0x31')];_0x9c4f0c[_0x9a42('0x3a')]=qs[_0x9a42('0x3b')](_0x13089d[_0x9a42('0x33')][_0x9a42('0x3b')]);_0x9c4f0c[_0x9a42('0x3c')]=qs[_0x9a42('0x34')](_[_0x9a42('0x3d')](_0x13089d[_0x9a42('0x33')],_0x1f3e40[_0x9a42('0x34')]));if(_0x13089d['query'][_0x9a42('0x40')]){_0x9c4f0c[_0x9a42('0x3c')]=_[_0x9a42('0x3e')](_0x9c4f0c[_0x9a42('0x3c')],{'$or':_[_0x9a42('0x2b')](_0x9c4f0c[_0x9a42('0x36')],function(_0x4681ed){var _0x51dab9={};_0x51dab9[_0x4681ed]={'$like':'%'+_0x13089d[_0x9a42('0x33')]['filter']+'%'};return _0x51dab9;})});}_0x9c4f0c=_['merge']({},_0x9c4f0c,_0x13089d[_0x9a42('0x4c')]);return _0x3b5912[_0x9a42('0x4f')](_0x9c4f0c);}})[_0x9a42('0x26')](function(_0x1d81bd){if(_0x1d81bd){_0x233031=_0x1d81bd['length'];if(!_0x13089d['query'][_0x9a42('0x4d')](_0x9a42('0x39'))){_0x9c4f0c['limit']=qs[_0x9a42('0x1e')](_0x13089d[_0x9a42('0x33')][_0x9a42('0x1e')]);_0x9c4f0c[_0x9a42('0x1c')]=qs[_0x9a42('0x1c')](_0x13089d['query'][_0x9a42('0x1c')]);}return _0x3b5912['getDescriptions'](_0x9c4f0c);}})['then'](function(_0x5a9169){if(_0x5a9169){return _0x5a9169?{'count':_0x233031,'rows':_0x5a9169}:null;}})[_0x9a42('0x26')](respondWithResult(_0x1ccd7a,null))[_0x9a42('0x43')](handleError(_0x1ccd7a,null));}; \ No newline at end of file +var _0x8c41=['json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','ZohoConfiguration','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x118e41,_0x435d7e){var _0x4cbed0=function(_0x14e754){while(--_0x14e754){_0x118e41['push'](_0x118e41['shift']());}};_0x4cbed0(++_0x435d7e);}(_0x8c41,0xd7));var _0x18c4=function(_0x47924d,_0x151375){_0x47924d=_0x47924d-0x0;var _0x4703cc=_0x8c41[_0x47924d];return _0x4703cc;};'use strict';var emlformat=require(_0x18c4('0x0'));var rimraf=require(_0x18c4('0x1'));var zipdir=require(_0x18c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18c4('0x3'));var moment=require(_0x18c4('0x4'));var BPromise=require(_0x18c4('0x5'));var Mustache=require(_0x18c4('0x6'));var util=require(_0x18c4('0x7'));var path=require(_0x18c4('0x8'));var sox=require('sox');var csv=require(_0x18c4('0x9'));var ejs=require(_0x18c4('0xa'));var fs=require('fs');var fs_extra=require(_0x18c4('0xb'));var _=require(_0x18c4('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x18c4('0xd'));var deskjs=require(_0x18c4('0xe'));var toCsv=require(_0x18c4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x18c4('0xf'));var authService=require(_0x18c4('0x10'));var qs=require(_0x18c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18c4('0x12'));var utils=require(_0x18c4('0x13'));var config=require(_0x18c4('0x14'));var licenseUtil=require(_0x18c4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f676,_0x28ade0){_0x28ade0=_0x28ade0||0xcc;return function(_0x4793a7){if(_0x4793a7){return _0x51f676[_0x18c4('0x16')](_0x28ade0);}return _0x51f676[_0x18c4('0x17')](_0x28ade0)[_0x18c4('0x18')]();};}function respondWithResult(_0x1d2ea1,_0x101aa7){_0x101aa7=_0x101aa7||0xc8;return function(_0x314f77){if(_0x314f77){return _0x1d2ea1['status'](_0x101aa7)[_0x18c4('0x19')](_0x314f77);}};}function respondWithFilteredResult(_0x181f01,_0x4cd601){return function(_0x5c7979){if(_0x5c7979){var _0x172c75=typeof _0x4cd601[_0x18c4('0x1a')]==='undefined'&&typeof _0x4cd601[_0x18c4('0x1b')]===_0x18c4('0x1c');var _0xf1e3d0=_0x5c7979[_0x18c4('0x1d')];var _0x5cee75=_0x172c75?0x0:_0x4cd601['offset'];var _0x5131a6=_0x172c75?_0x5c7979[_0x18c4('0x1d')]:_0x4cd601[_0x18c4('0x1a')]+_0x4cd601[_0x18c4('0x1b')];var _0x3de234;if(_0x5131a6>=_0xf1e3d0){_0x5131a6=_0xf1e3d0;_0x3de234=0xc8;}else{_0x3de234=0xce;}_0x181f01['status'](_0x3de234);return _0x181f01[_0x18c4('0x1e')]('Content-Range',_0x5cee75+'-'+_0x5131a6+'/'+_0xf1e3d0)[_0x18c4('0x19')](_0x5c7979);}return null;};}function patchUpdates(_0x398df0){return function(_0x90e3c4){try{jsonpatch[_0x18c4('0x1f')](_0x90e3c4,_0x398df0,!![]);}catch(_0x4b28c7){return BPromise[_0x18c4('0x20')](_0x4b28c7);}return _0x90e3c4[_0x18c4('0x21')]();};}function saveUpdates(_0x19c405,_0x2e88cf){return function(_0x11d0f9){if(_0x11d0f9){return _0x11d0f9[_0x18c4('0x22')](_0x19c405)[_0x18c4('0x23')](function(_0x5815b3){return _0x5815b3;});}return null;};}function removeEntity(_0x2388ab,_0x43eda7){return function(_0x38958e){if(_0x38958e){return _0x38958e[_0x18c4('0x24')]()[_0x18c4('0x23')](function(){_0x2388ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e389e,_0x12999e){return function(_0xe3614){if(!_0xe3614){_0x4e389e['sendStatus'](0x194);}return _0xe3614;};}function handleError(_0x4a8665,_0x5f021d){_0x5f021d=_0x5f021d||0x1f4;return function(_0x48157c){logger[_0x18c4('0x25')](_0x48157c[_0x18c4('0x26')]);if(_0x48157c[_0x18c4('0x27')]){delete _0x48157c[_0x18c4('0x27')];}_0x4a8665[_0x18c4('0x17')](_0x5f021d)[_0x18c4('0x28')](_0x48157c);};}exports[_0x18c4('0x29')]=function(_0x29fe3f,_0x3b027c){var _0x42d8c1={},_0x51f26c={},_0x2205f5={'count':0x0,'rows':[]};var _0x15fa91=_[_0x18c4('0x2a')](db['ZohoConfiguration']['rawAttributes'],function(_0x47ea73){return{'name':_0x47ea73[_0x18c4('0x2b')],'type':_0x47ea73[_0x18c4('0x2c')][_0x18c4('0x2d')]};});_0x51f26c['model']=_[_0x18c4('0x2a')](_0x15fa91,_0x18c4('0x27'));_0x51f26c[_0x18c4('0x2e')]=_[_0x18c4('0x2f')](_0x29fe3f['query']);_0x51f26c[_0x18c4('0x30')]=_[_0x18c4('0x31')](_0x51f26c[_0x18c4('0x32')],_0x51f26c[_0x18c4('0x2e')]);_0x42d8c1[_0x18c4('0x33')]=_['intersection'](_0x51f26c[_0x18c4('0x32')],qs[_0x18c4('0x34')](_0x29fe3f[_0x18c4('0x2e')][_0x18c4('0x34')]));_0x42d8c1[_0x18c4('0x33')]=_0x42d8c1[_0x18c4('0x33')][_0x18c4('0x35')]?_0x42d8c1[_0x18c4('0x33')]:_0x51f26c[_0x18c4('0x32')];if(!_0x29fe3f['query'][_0x18c4('0x36')](_0x18c4('0x37'))){_0x42d8c1[_0x18c4('0x1b')]=qs[_0x18c4('0x1b')](_0x29fe3f[_0x18c4('0x2e')][_0x18c4('0x1b')]);_0x42d8c1[_0x18c4('0x1a')]=qs[_0x18c4('0x1a')](_0x29fe3f['query']['offset']);}_0x42d8c1[_0x18c4('0x38')]=qs[_0x18c4('0x39')](_0x29fe3f[_0x18c4('0x2e')][_0x18c4('0x39')]);_0x42d8c1['where']=qs['filters'](_['pick'](_0x29fe3f[_0x18c4('0x2e')],_0x51f26c[_0x18c4('0x30')]),_0x15fa91);if(_0x29fe3f[_0x18c4('0x2e')][_0x18c4('0x3a')]){_0x42d8c1[_0x18c4('0x3b')]=_[_0x18c4('0x3c')](_0x42d8c1[_0x18c4('0x3b')],{'$or':_['map'](_0x15fa91,function(_0xcac69a){if(_0xcac69a[_0x18c4('0x2c')]!==_0x18c4('0x3d')){var _0x4190c6={};_0x4190c6[_0xcac69a[_0x18c4('0x27')]]={'$like':'%'+_0x29fe3f[_0x18c4('0x2e')]['filter']+'%'};return _0x4190c6;}})});}_0x42d8c1=_[_0x18c4('0x3c')]({},_0x42d8c1,_0x29fe3f[_0x18c4('0x3e')]);var _0x11b5c9={'where':_0x42d8c1[_0x18c4('0x3b')]};return db[_0x18c4('0x3f')][_0x18c4('0x1d')](_0x11b5c9)[_0x18c4('0x23')](function(_0x448a3){_0x2205f5['count']=_0x448a3;if(_0x29fe3f[_0x18c4('0x2e')][_0x18c4('0x40')]){_0x42d8c1[_0x18c4('0x41')]=[{'all':!![]}];}return db[_0x18c4('0x3f')][_0x18c4('0x42')](_0x42d8c1);})[_0x18c4('0x23')](function(_0x8431dc){_0x2205f5[_0x18c4('0x43')]=_0x8431dc;return _0x2205f5;})[_0x18c4('0x23')](respondWithFilteredResult(_0x3b027c,_0x42d8c1))['catch'](handleError(_0x3b027c,null));};exports['show']=function(_0x1dd8cb,_0x1abff2){var _0x3ecd6a={'raw':![],'where':{'id':_0x1dd8cb[_0x18c4('0x44')]['id']}},_0x3b6286={};_0x3b6286[_0x18c4('0x32')]=_[_0x18c4('0x2f')](db[_0x18c4('0x3f')][_0x18c4('0x45')]);_0x3b6286[_0x18c4('0x2e')]=_[_0x18c4('0x2f')](_0x1dd8cb['query']);_0x3b6286[_0x18c4('0x30')]=_[_0x18c4('0x31')](_0x3b6286[_0x18c4('0x32')],_0x3b6286[_0x18c4('0x2e')]);_0x3ecd6a[_0x18c4('0x33')]=_[_0x18c4('0x31')](_0x3b6286['model'],qs[_0x18c4('0x34')](_0x1dd8cb[_0x18c4('0x2e')][_0x18c4('0x34')]));_0x3ecd6a['attributes']=_0x3ecd6a['attributes'][_0x18c4('0x35')]?_0x3ecd6a[_0x18c4('0x33')]:_0x3b6286[_0x18c4('0x32')];if(_0x1dd8cb['query']['includeAll']){_0x3ecd6a[_0x18c4('0x41')]=[{'all':!![]}];}_0x3ecd6a=_[_0x18c4('0x3c')]({},_0x3ecd6a,_0x1dd8cb[_0x18c4('0x3e')]);return db[_0x18c4('0x3f')][_0x18c4('0x46')](_0x3ecd6a)[_0x18c4('0x23')](handleEntityNotFound(_0x1abff2,null))[_0x18c4('0x23')](respondWithResult(_0x1abff2,null))[_0x18c4('0x47')](handleError(_0x1abff2,null));};exports[_0x18c4('0x48')]=function(_0x597acf,_0x47a19a){return db[_0x18c4('0x3f')][_0x18c4('0x48')](_0x597acf[_0x18c4('0x49')],{})[_0x18c4('0x23')](respondWithResult(_0x47a19a,0xc9))[_0x18c4('0x47')](handleError(_0x47a19a,null));};exports[_0x18c4('0x22')]=function(_0x5b3e61,_0x4ee82a){if(_0x5b3e61[_0x18c4('0x49')]['id']){delete _0x5b3e61[_0x18c4('0x49')]['id'];}return db[_0x18c4('0x3f')][_0x18c4('0x46')]({'where':{'id':_0x5b3e61[_0x18c4('0x44')]['id']}})[_0x18c4('0x23')](handleEntityNotFound(_0x4ee82a,null))[_0x18c4('0x23')](saveUpdates(_0x5b3e61[_0x18c4('0x49')],null))[_0x18c4('0x23')](respondWithResult(_0x4ee82a,null))['catch'](handleError(_0x4ee82a,null));};exports['destroy']=function(_0x33520a,_0x454249){return db['ZohoConfiguration']['find']({'where':{'id':_0x33520a[_0x18c4('0x44')]['id']}})[_0x18c4('0x23')](handleEntityNotFound(_0x454249,null))['then'](removeEntity(_0x454249,null))['catch'](handleError(_0x454249,null));};exports[_0x18c4('0x4a')]=function(_0x2d3f94,_0x2cb4cc,_0x33877a){var _0x188e8c={};var _0x5a302c={};var _0x16922e;var _0x513c90;return db['ZohoConfiguration'][_0x18c4('0x4b')]({'where':{'id':_0x2d3f94['params']['id']}})[_0x18c4('0x23')](handleEntityNotFound(_0x2cb4cc,null))['then'](function(_0xc60b27){if(_0xc60b27){_0x16922e=_0xc60b27;_0x5a302c['model']=_['keys'](db[_0x18c4('0x4c')][_0x18c4('0x45')]);_0x5a302c[_0x18c4('0x2e')]=_[_0x18c4('0x2f')](_0x2d3f94['query']);_0x5a302c['filters']=_[_0x18c4('0x31')](_0x5a302c[_0x18c4('0x32')],_0x5a302c[_0x18c4('0x2e')]);_0x188e8c[_0x18c4('0x33')]=_[_0x18c4('0x31')](_0x5a302c['model'],qs['fields'](_0x2d3f94['query'][_0x18c4('0x34')]));_0x188e8c['attributes']=_0x188e8c[_0x18c4('0x33')][_0x18c4('0x35')]?_0x188e8c[_0x18c4('0x33')]:_0x5a302c[_0x18c4('0x32')];_0x188e8c[_0x18c4('0x38')]=qs[_0x18c4('0x39')](_0x2d3f94['query'][_0x18c4('0x39')]);_0x188e8c[_0x18c4('0x3b')]=qs[_0x18c4('0x30')](_[_0x18c4('0x4d')](_0x2d3f94[_0x18c4('0x2e')],_0x5a302c[_0x18c4('0x30')]));if(_0x2d3f94[_0x18c4('0x2e')]['filter']){_0x188e8c[_0x18c4('0x3b')]=_[_0x18c4('0x3c')](_0x188e8c['where'],{'$or':_[_0x18c4('0x2a')](_0x188e8c[_0x18c4('0x33')],function(_0x53124f){var _0x429f8e={};_0x429f8e[_0x53124f]={'$like':'%'+_0x2d3f94[_0x18c4('0x2e')][_0x18c4('0x3a')]+'%'};return _0x429f8e;})});}_0x188e8c=_[_0x18c4('0x3c')]({},_0x188e8c,_0x2d3f94[_0x18c4('0x3e')]);return _0x16922e[_0x18c4('0x4a')](_0x188e8c);}})['then'](function(_0xccad44){if(_0xccad44){_0x513c90=_0xccad44[_0x18c4('0x35')];if(!_0x2d3f94[_0x18c4('0x2e')][_0x18c4('0x36')](_0x18c4('0x37'))){_0x188e8c[_0x18c4('0x1b')]=qs[_0x18c4('0x1b')](_0x2d3f94[_0x18c4('0x2e')][_0x18c4('0x1b')]);_0x188e8c['offset']=qs[_0x18c4('0x1a')](_0x2d3f94[_0x18c4('0x2e')]['offset']);}return _0x16922e[_0x18c4('0x4a')](_0x188e8c);}})['then'](function(_0x368432){if(_0x368432){return _0x368432?{'count':_0x513c90,'rows':_0x368432}:null;}})[_0x18c4('0x23')](respondWithResult(_0x2cb4cc,null))['catch'](handleError(_0x2cb4cc,null));};exports[_0x18c4('0x4e')]=function(_0x1ed9f5,_0x1e2801,_0x10eb50){var _0x24089d={};var _0x390593={};var _0x5bffd8;var _0x36abf8;return db[_0x18c4('0x3f')][_0x18c4('0x4b')]({'where':{'id':_0x1ed9f5[_0x18c4('0x44')]['id']}})[_0x18c4('0x23')](handleEntityNotFound(_0x1e2801,null))[_0x18c4('0x23')](function(_0x1c928a){if(_0x1c928a){_0x5bffd8=_0x1c928a;_0x390593[_0x18c4('0x32')]=_['keys'](db[_0x18c4('0x4c')]['rawAttributes']);_0x390593['query']=_[_0x18c4('0x2f')](_0x1ed9f5[_0x18c4('0x2e')]);_0x390593[_0x18c4('0x30')]=_[_0x18c4('0x31')](_0x390593['model'],_0x390593[_0x18c4('0x2e')]);_0x24089d[_0x18c4('0x33')]=_[_0x18c4('0x31')](_0x390593[_0x18c4('0x32')],qs[_0x18c4('0x34')](_0x1ed9f5[_0x18c4('0x2e')][_0x18c4('0x34')]));_0x24089d[_0x18c4('0x33')]=_0x24089d[_0x18c4('0x33')][_0x18c4('0x35')]?_0x24089d[_0x18c4('0x33')]:_0x390593['model'];_0x24089d[_0x18c4('0x38')]=qs[_0x18c4('0x39')](_0x1ed9f5[_0x18c4('0x2e')][_0x18c4('0x39')]);_0x24089d[_0x18c4('0x3b')]=qs[_0x18c4('0x30')](_[_0x18c4('0x4d')](_0x1ed9f5['query'],_0x390593[_0x18c4('0x30')]));if(_0x1ed9f5[_0x18c4('0x2e')][_0x18c4('0x3a')]){_0x24089d[_0x18c4('0x3b')]=_[_0x18c4('0x3c')](_0x24089d['where'],{'$or':_[_0x18c4('0x2a')](_0x24089d[_0x18c4('0x33')],function(_0x275ba2){var _0x39a8f={};_0x39a8f[_0x275ba2]={'$like':'%'+_0x1ed9f5[_0x18c4('0x2e')][_0x18c4('0x3a')]+'%'};return _0x39a8f;})});}_0x24089d=_['merge']({},_0x24089d,_0x1ed9f5[_0x18c4('0x3e')]);return _0x5bffd8[_0x18c4('0x4e')](_0x24089d);}})[_0x18c4('0x23')](function(_0x3ca641){if(_0x3ca641){_0x36abf8=_0x3ca641[_0x18c4('0x35')];if(!_0x1ed9f5[_0x18c4('0x2e')]['hasOwnProperty'](_0x18c4('0x37'))){_0x24089d['limit']=qs[_0x18c4('0x1b')](_0x1ed9f5[_0x18c4('0x2e')][_0x18c4('0x1b')]);_0x24089d[_0x18c4('0x1a')]=qs[_0x18c4('0x1a')](_0x1ed9f5[_0x18c4('0x2e')][_0x18c4('0x1a')]);}return _0x5bffd8[_0x18c4('0x4e')](_0x24089d);}})[_0x18c4('0x23')](function(_0x3e769e){if(_0x3e769e){return _0x3e769e?{'count':_0x36abf8,'rows':_0x3e769e}:null;}})[_0x18c4('0x23')](respondWithResult(_0x1e2801,null))[_0x18c4('0x47')](handleError(_0x1e2801,null));};exports[_0x18c4('0x4f')]=function(_0xe8cf99,_0x45208a,_0x42b259){var _0x1cdd5c={};var _0x2278e3={};var _0x44c6d3;var _0x446811;return db[_0x18c4('0x3f')][_0x18c4('0x4b')]({'where':{'id':_0xe8cf99[_0x18c4('0x44')]['id']}})[_0x18c4('0x23')](handleEntityNotFound(_0x45208a,null))[_0x18c4('0x23')](function(_0x18b5f1){if(_0x18b5f1){_0x44c6d3=_0x18b5f1;_0x2278e3[_0x18c4('0x32')]=_['keys'](db[_0x18c4('0x4c')]['rawAttributes']);_0x2278e3['query']=_[_0x18c4('0x2f')](_0xe8cf99[_0x18c4('0x2e')]);_0x2278e3[_0x18c4('0x30')]=_[_0x18c4('0x31')](_0x2278e3[_0x18c4('0x32')],_0x2278e3[_0x18c4('0x2e')]);_0x1cdd5c[_0x18c4('0x33')]=_[_0x18c4('0x31')](_0x2278e3['model'],qs[_0x18c4('0x34')](_0xe8cf99['query'][_0x18c4('0x34')]));_0x1cdd5c[_0x18c4('0x33')]=_0x1cdd5c['attributes'][_0x18c4('0x35')]?_0x1cdd5c[_0x18c4('0x33')]:_0x2278e3['model'];_0x1cdd5c[_0x18c4('0x38')]=qs[_0x18c4('0x39')](_0xe8cf99[_0x18c4('0x2e')][_0x18c4('0x39')]);_0x1cdd5c[_0x18c4('0x3b')]=qs[_0x18c4('0x30')](_['pick'](_0xe8cf99[_0x18c4('0x2e')],_0x2278e3[_0x18c4('0x30')]));if(_0xe8cf99[_0x18c4('0x2e')][_0x18c4('0x3a')]){_0x1cdd5c['where']=_[_0x18c4('0x3c')](_0x1cdd5c['where'],{'$or':_['map'](_0x1cdd5c['attributes'],function(_0x1d31da){var _0x461ccb={};_0x461ccb[_0x1d31da]={'$like':'%'+_0xe8cf99[_0x18c4('0x2e')][_0x18c4('0x3a')]+'%'};return _0x461ccb;})});}_0x1cdd5c=_[_0x18c4('0x3c')]({},_0x1cdd5c,_0xe8cf99[_0x18c4('0x3e')]);return _0x44c6d3[_0x18c4('0x4f')](_0x1cdd5c);}})['then'](function(_0x473484){if(_0x473484){_0x446811=_0x473484['length'];if(!_0xe8cf99[_0x18c4('0x2e')][_0x18c4('0x36')](_0x18c4('0x37'))){_0x1cdd5c[_0x18c4('0x1b')]=qs[_0x18c4('0x1b')](_0xe8cf99[_0x18c4('0x2e')][_0x18c4('0x1b')]);_0x1cdd5c[_0x18c4('0x1a')]=qs[_0x18c4('0x1a')](_0xe8cf99[_0x18c4('0x2e')]['offset']);}return _0x44c6d3[_0x18c4('0x4f')](_0x1cdd5c);}})['then'](function(_0x32fca2){if(_0x32fca2){return _0x32fca2?{'count':_0x446811,'rows':_0x32fca2}:null;}})['then'](respondWithResult(_0x45208a,null))[_0x18c4('0x47')](handleError(_0x45208a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6289b9c..6d6cd30 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 _0xa78b=['int_zoho_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x20dc2f,_0x1dbf3f){var _0x50f79d=function(_0x1674da){while(--_0x1674da){_0x20dc2f['push'](_0x20dc2f['shift']());}};_0x50f79d(++_0x1dbf3f);}(_0xa78b,0x1dd));var _0xba78=function(_0x1151cf,_0xaa402a){_0x1151cf=_0x1151cf-0x0;var _0xc6504e=_0xa78b[_0x1151cf];return _0xc6504e;};'use strict';var _=require('lodash');var util=require(_0xba78('0x0'));var logger=require(_0xba78('0x1'))(_0xba78('0x2'));var moment=require(_0xba78('0x3'));var BPromise=require(_0xba78('0x4'));var rp=require(_0xba78('0x5'));var fs=require('fs');var path=require(_0xba78('0x6'));var rimraf=require(_0xba78('0x7'));var config=require(_0xba78('0x8'));var attributes=require(_0xba78('0x9'));module[_0xba78('0xa')]=function(_0x3f582f,_0x2dcce2){return _0x3f582f[_0xba78('0xb')](_0xba78('0xc'),attributes,{'tableName':_0xba78('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xead5=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x492793,_0x45d4e2){var _0x3ee7e0=function(_0x35a155){while(--_0x35a155){_0x492793['push'](_0x492793['shift']());}};_0x3ee7e0(++_0x45d4e2);}(_0xead5,0x168));var _0x5ead=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0xead5[_0x507c81];return _0x368a25;};'use strict';var _=require(_0x5ead('0x0'));var util=require(_0x5ead('0x1'));var logger=require(_0x5ead('0x2'))(_0x5ead('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ead('0x4'));var fs=require('fs');var path=require(_0x5ead('0x5'));var rimraf=require(_0x5ead('0x6'));var config=require(_0x5ead('0x7'));var attributes=require(_0x5ead('0x8'));module[_0x5ead('0x9')]=function(_0x585758,_0x439405){return _0x585758[_0x5ead('0xa')](_0x5ead('0xb'),attributes,{'tableName':_0x5ead('0xc'),'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 a42492f..c87f572 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 _0x2f7d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x4e3bff,_0x54ca13){var _0x58de8e=function(_0x558cfb){while(--_0x558cfb){_0x4e3bff['push'](_0x4e3bff['shift']());}};_0x58de8e(++_0x54ca13);}(_0x2f7d,0x188));var _0xd2f7=function(_0x1cdce9,_0x4a515e){_0x1cdce9=_0x1cdce9-0x0;var _0x820c6d=_0x2f7d[_0x1cdce9];return _0x820c6d;};'use strict';var _=require('lodash');var util=require(_0xd2f7('0x0'));var moment=require(_0xd2f7('0x1'));var BPromise=require(_0xd2f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2f7('0x3'));var db=require(_0xd2f7('0x4'))['db'];var utils=require(_0xd2f7('0x5'));var logger=require(_0xd2f7('0x6'))(_0xd2f7('0x7'));var config=require('../../config/environment');var jayson=require(_0xd2f7('0x8'));var client=jayson[_0xd2f7('0x9')][_0xd2f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x554823,_0x82e59e,_0x4f4ff4){return new BPromise(function(_0x5f2662,_0x4dac3b){return client['request'](_0x554823,_0x4f4ff4)['then'](function(_0x2a7269){logger[_0xd2f7('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x82e59e,_0xd2f7('0xc'));logger[_0xd2f7('0xd')](_0xd2f7('0xe'),_0x82e59e,_0xd2f7('0xc'),JSON[_0xd2f7('0xf')](_0x2a7269));if(_0x2a7269[_0xd2f7('0x10')]){if(_0x2a7269[_0xd2f7('0x10')][_0xd2f7('0x11')]===0x1f4){logger[_0xd2f7('0x10')](_0xd2f7('0x12'),_0x82e59e,_0x2a7269[_0xd2f7('0x10')][_0xd2f7('0x13')]);return _0x4dac3b(_0x2a7269[_0xd2f7('0x10')][_0xd2f7('0x13')]);}logger[_0xd2f7('0x10')](_0xd2f7('0x12'),_0x82e59e,_0x2a7269[_0xd2f7('0x10')][_0xd2f7('0x13')]);return _0x5f2662(_0x2a7269['error'][_0xd2f7('0x13')]);}else{logger[_0xd2f7('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x82e59e,_0xd2f7('0xc'));_0x5f2662(_0x2a7269[_0xd2f7('0x14')][_0xd2f7('0x13')]);}})[_0xd2f7('0x15')](function(_0xf59454){logger['error'](_0xd2f7('0x12'),_0x82e59e,_0xf59454);_0x4dac3b(_0xf59454);});});} \ No newline at end of file +var _0x30e2=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message'];(function(_0x23cacb,_0x284db8){var _0x2a3139=function(_0x4c5956){while(--_0x4c5956){_0x23cacb['push'](_0x23cacb['shift']());}};_0x2a3139(++_0x284db8);}(_0x30e2,0x188));var _0x230e=function(_0x138009,_0x165157){_0x138009=_0x138009-0x0;var _0x19253b=_0x30e2[_0x138009];return _0x19253b;};'use strict';var _=require(_0x230e('0x0'));var util=require(_0x230e('0x1'));var moment=require(_0x230e('0x2'));var BPromise=require(_0x230e('0x3'));var rs=require(_0x230e('0x4'));var fs=require('fs');var Redis=require(_0x230e('0x5'));var db=require(_0x230e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x230e('0x7'))(_0x230e('0x8'));var config=require(_0x230e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x230e('0xa')][_0x230e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af4f3,_0xcad237,_0x2dc457){return new BPromise(function(_0x2cc263,_0x2fc7cc){return client[_0x230e('0xc')](_0x3af4f3,_0x2dc457)['then'](function(_0x41e1f8){logger[_0x230e('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0xcad237,_0x230e('0xe'));logger[_0x230e('0xf')](_0x230e('0x10'),_0xcad237,_0x230e('0xe'),JSON[_0x230e('0x11')](_0x41e1f8));if(_0x41e1f8[_0x230e('0x12')]){if(_0x41e1f8['error'][_0x230e('0x13')]===0x1f4){logger[_0x230e('0x12')](_0x230e('0x14'),_0xcad237,_0x41e1f8['error'][_0x230e('0x15')]);return _0x2fc7cc(_0x41e1f8[_0x230e('0x12')][_0x230e('0x15')]);}logger['error'](_0x230e('0x14'),_0xcad237,_0x41e1f8[_0x230e('0x12')][_0x230e('0x15')]);return _0x2cc263(_0x41e1f8['error'][_0x230e('0x15')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0xcad237,_0x230e('0xe'));_0x2cc263(_0x41e1f8[_0x230e('0x16')][_0x230e('0x15')]);}})['catch'](function(_0x535f11){logger[_0x230e('0x12')](_0x230e('0x14'),_0xcad237,_0x535f11);_0x2fc7cc(_0x535f11);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 6e710d4..8b48724 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 _0x5df4=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports'];(function(_0x1e9417,_0x55a246){var _0x2141c4=function(_0x5cbf33){while(--_0x5cbf33){_0x1e9417['push'](_0x1e9417['shift']());}};_0x2141c4(++_0x55a246);}(_0x5df4,0xab));var _0x45df=function(_0x5e93d1,_0x442f66){_0x5e93d1=_0x5e93d1-0x0;var _0x130126=_0x5df4[_0x5e93d1];return _0x130126;};'use strict';var multer=require(_0x45df('0x0'));var util=require(_0x45df('0x1'));var path=require(_0x45df('0x2'));var timeout=require(_0x45df('0x3'));var express=require(_0x45df('0x4'));var router=express[_0x45df('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x45df('0x6'));var interaction=require(_0x45df('0x7'));var config=require('../../config/environment');var controller=require(_0x45df('0x8'));router[_0x45df('0x9')]('/',auth[_0x45df('0xa')](),controller[_0x45df('0xb')]);router['get'](_0x45df('0xc'),auth[_0x45df('0xa')](),controller[_0x45df('0xd')]);router[_0x45df('0xe')]('/',auth[_0x45df('0xa')](),controller[_0x45df('0xf')]);router[_0x45df('0x10')]('/:id',auth[_0x45df('0xa')](),controller['update']);router[_0x45df('0x11')](_0x45df('0xc'),auth[_0x45df('0xa')](),controller['destroy']);module[_0x45df('0x12')]=router; \ No newline at end of file +var _0x0b9c=['/:id','show','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x3d7057,_0x50045d){var _0x207f05=function(_0x2b8b6c){while(--_0x2b8b6c){_0x3d7057['push'](_0x3d7057['shift']());}};_0x207f05(++_0x50045d);}(_0x0b9c,0x195));var _0xc0b9=function(_0x380315,_0x280f96){_0x380315=_0x380315-0x0;var _0x54cef8=_0x0b9c[_0x380315];return _0x54cef8;};'use strict';var multer=require('multer');var util=require(_0xc0b9('0x0'));var path=require(_0xc0b9('0x1'));var timeout=require(_0xc0b9('0x2'));var express=require(_0xc0b9('0x3'));var router=express[_0xc0b9('0x4')]();var fs_extra=require(_0xc0b9('0x5'));var auth=require(_0xc0b9('0x6'));var interaction=require(_0xc0b9('0x7'));var config=require(_0xc0b9('0x8'));var controller=require(_0xc0b9('0x9'));router[_0xc0b9('0xa')]('/',auth[_0xc0b9('0xb')](),controller[_0xc0b9('0xc')]);router[_0xc0b9('0xa')](_0xc0b9('0xd'),auth['isAuthenticated'](),controller[_0xc0b9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc0b9('0xf')]);router['put'](_0xc0b9('0xd'),auth[_0xc0b9('0xb')](),controller[_0xc0b9('0x10')]);router[_0xc0b9('0x11')]('/:id',auth[_0xc0b9('0xb')](),controller[_0xc0b9('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b9646c0..18989a7 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 _0x7f8e=['sequelize','exports','string','variable','picklist','STRING','ENUM','customVariable'];(function(_0x28dbdf,_0x4615ea){var _0x2b3d46=function(_0x22f040){while(--_0x22f040){_0x28dbdf['push'](_0x28dbdf['shift']());}};_0x2b3d46(++_0x4615ea);}(_0x7f8e,0xc0));var _0xe7f8=function(_0xd27544,_0x5e9fb1){_0xd27544=_0xd27544-0x0;var _0x283d71=_0x7f8e[_0xd27544];return _0x283d71;};'use strict';var Sequelize=require(_0xe7f8('0x0'));module[_0xe7f8('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe7f8('0x2'),_0xe7f8('0x3'),'customVariable','keyValue',_0xe7f8('0x4')),'defaultValue':_0xe7f8('0x2')},'content':{'type':Sequelize[_0xe7f8('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe7f8('0x6')](_0xe7f8('0x2'),_0xe7f8('0x3'),_0xe7f8('0x7'))},'keyContent':{'type':Sequelize[_0xe7f8('0x5')]},'idField':{'type':Sequelize[_0xe7f8('0x5')]},'nameField':{'type':Sequelize[_0xe7f8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe7f8('0x5')]}}; \ No newline at end of file +var _0x8aad=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x2ba187,_0x1533ba){var _0x8b71e7=function(_0xd1a1fc){while(--_0xd1a1fc){_0x2ba187['push'](_0x2ba187['shift']());}};_0x8b71e7(++_0x1533ba);}(_0x8aad,0x1e3));var _0xd8aa=function(_0xc654ef,_0x2a41e7){_0xc654ef=_0xc654ef-0x0;var _0x5332e1=_0x8aad[_0xc654ef];return _0x5332e1;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd8aa('0x2'),_0xd8aa('0x3'),_0xd8aa('0x4'),_0xd8aa('0x5'),_0xd8aa('0x6')),'defaultValue':_0xd8aa('0x2')},'content':{'type':Sequelize[_0xd8aa('0x7')]},'key':{'type':Sequelize[_0xd8aa('0x7')]},'keyType':{'type':Sequelize[_0xd8aa('0x8')](_0xd8aa('0x2'),'variable',_0xd8aa('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd8aa('0x7')]},'nameField':{'type':Sequelize[_0xd8aa('0x7')]},'customField':{'type':Sequelize[_0xd8aa('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd8aa('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 95bafeb..3e7c30c 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 _0xf780=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','count','limit','status','Content-Range','json','apply','reject','save','update','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','ZohoField','then','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x4dab22,_0x59a530){var _0x515653=function(_0x3df7b6){while(--_0x3df7b6){_0x4dab22['push'](_0x4dab22['shift']());}};_0x515653(++_0x59a530);}(_0xf780,0xd3));var _0x0f78=function(_0x3ff0d1,_0x2afe78){_0x3ff0d1=_0x3ff0d1-0x0;var _0x12e4ab=_0xf780[_0x3ff0d1];return _0x12e4ab;};'use strict';var emlformat=require(_0x0f78('0x0'));var rimraf=require(_0x0f78('0x1'));var zipdir=require(_0x0f78('0x2'));var jsonpatch=require(_0x0f78('0x3'));var rp=require(_0x0f78('0x4'));var moment=require(_0x0f78('0x5'));var BPromise=require(_0x0f78('0x6'));var Mustache=require(_0x0f78('0x7'));var util=require('util');var path=require(_0x0f78('0x8'));var sox=require(_0x0f78('0x9'));var csv=require('to-csv');var ejs=require(_0x0f78('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f78('0xb'));var squel=require(_0x0f78('0xc'));var crypto=require(_0x0f78('0xd'));var jsforce=require(_0x0f78('0xe'));var deskjs=require(_0x0f78('0xf'));var toCsv=require(_0x0f78('0x10'));var querystring=require(_0x0f78('0x11'));var Papa=require(_0x0f78('0x12'));var Redis=require(_0x0f78('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f78('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f78('0x15'))(_0x0f78('0x16'));var utils=require('../../config/utils');var config=require(_0x0f78('0x17'));var licenseUtil=require(_0x0f78('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19f24e,_0x3e81a5){_0x3e81a5=_0x3e81a5||0xcc;return function(_0x21dcbd){if(_0x21dcbd){return _0x19f24e[_0x0f78('0x19')](_0x3e81a5);}return _0x19f24e['status'](_0x3e81a5)[_0x0f78('0x1a')]();};}function respondWithResult(_0x4a90ff,_0x520edd){_0x520edd=_0x520edd||0xc8;return function(_0x5e3dda){if(_0x5e3dda){return _0x4a90ff['status'](_0x520edd)['json'](_0x5e3dda);}};}function respondWithFilteredResult(_0xfb422e,_0x1d15ef){return function(_0x13aed3){if(_0x13aed3){var _0x39a834=typeof _0x1d15ef[_0x0f78('0x1b')]===_0x0f78('0x1c')&&typeof _0x1d15ef['limit']===_0x0f78('0x1c');var _0x348d70=_0x13aed3[_0x0f78('0x1d')];var _0x40bccf=_0x39a834?0x0:_0x1d15ef[_0x0f78('0x1b')];var _0x53ee9b=_0x39a834?_0x13aed3[_0x0f78('0x1d')]:_0x1d15ef[_0x0f78('0x1b')]+_0x1d15ef[_0x0f78('0x1e')];var _0x179080;if(_0x53ee9b>=_0x348d70){_0x53ee9b=_0x348d70;_0x179080=0xc8;}else{_0x179080=0xce;}_0xfb422e[_0x0f78('0x1f')](_0x179080);return _0xfb422e['set'](_0x0f78('0x20'),_0x40bccf+'-'+_0x53ee9b+'/'+_0x348d70)[_0x0f78('0x21')](_0x13aed3);}return null;};}function patchUpdates(_0x555db2){return function(_0x1ea714){try{jsonpatch[_0x0f78('0x22')](_0x1ea714,_0x555db2,!![]);}catch(_0x339253){return BPromise[_0x0f78('0x23')](_0x339253);}return _0x1ea714[_0x0f78('0x24')]();};}function saveUpdates(_0x2d5aa9,_0x6302f0){return function(_0x30e25a){if(_0x30e25a){return _0x30e25a[_0x0f78('0x25')](_0x2d5aa9)['then'](function(_0x23a68b){return _0x23a68b;});}return null;};}function removeEntity(_0x4b3db6,_0x54fc6f){return function(_0x5deae4){if(_0x5deae4){return _0x5deae4[_0x0f78('0x26')]()['then'](function(){_0x4b3db6[_0x0f78('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb02c,_0x3658d1){return function(_0x3046c0){if(!_0x3046c0){_0x1eb02c[_0x0f78('0x19')](0x194);}return _0x3046c0;};}function handleError(_0x2a8a8b,_0x492216){_0x492216=_0x492216||0x1f4;return function(_0x4c4c16){logger[_0x0f78('0x27')](_0x4c4c16['stack']);if(_0x4c4c16[_0x0f78('0x28')]){delete _0x4c4c16['name'];}_0x2a8a8b[_0x0f78('0x1f')](_0x492216)[_0x0f78('0x29')](_0x4c4c16);};}exports[_0x0f78('0x2a')]=function(_0x43cd4b,_0x50b8ae){var _0x4ace85={},_0x541e34={},_0x3ca5ca={'count':0x0,'rows':[]};var _0x9fb0cc=_[_0x0f78('0x2b')](db['ZohoField'][_0x0f78('0x2c')],function(_0x2ce8e2){return{'name':_0x2ce8e2[_0x0f78('0x2d')],'type':_0x2ce8e2[_0x0f78('0x2e')]['key']};});_0x541e34[_0x0f78('0x2f')]=_[_0x0f78('0x2b')](_0x9fb0cc,_0x0f78('0x28'));_0x541e34[_0x0f78('0x30')]=_[_0x0f78('0x31')](_0x43cd4b[_0x0f78('0x30')]);_0x541e34[_0x0f78('0x32')]=_[_0x0f78('0x33')](_0x541e34[_0x0f78('0x2f')],_0x541e34[_0x0f78('0x30')]);_0x4ace85['attributes']=_[_0x0f78('0x33')](_0x541e34['model'],qs[_0x0f78('0x34')](_0x43cd4b[_0x0f78('0x30')][_0x0f78('0x34')]));_0x4ace85[_0x0f78('0x35')]=_0x4ace85['attributes'][_0x0f78('0x36')]?_0x4ace85['attributes']:_0x541e34['model'];if(!_0x43cd4b[_0x0f78('0x30')][_0x0f78('0x37')](_0x0f78('0x38'))){_0x4ace85[_0x0f78('0x1e')]=qs['limit'](_0x43cd4b[_0x0f78('0x30')][_0x0f78('0x1e')]);_0x4ace85[_0x0f78('0x1b')]=qs[_0x0f78('0x1b')](_0x43cd4b[_0x0f78('0x30')][_0x0f78('0x1b')]);}_0x4ace85[_0x0f78('0x39')]=qs['sort'](_0x43cd4b['query']['sort']);_0x4ace85[_0x0f78('0x3a')]=qs[_0x0f78('0x32')](_['pick'](_0x43cd4b[_0x0f78('0x30')],_0x541e34['filters']),_0x9fb0cc);if(_0x43cd4b['query']['filter']){_0x4ace85[_0x0f78('0x3a')]=_[_0x0f78('0x3b')](_0x4ace85[_0x0f78('0x3a')],{'$or':_[_0x0f78('0x2b')](_0x9fb0cc,function(_0x4ed47e){if(_0x4ed47e['type']!==_0x0f78('0x3c')){var _0x21f17d={};_0x21f17d[_0x4ed47e[_0x0f78('0x28')]]={'$like':'%'+_0x43cd4b['query'][_0x0f78('0x3d')]+'%'};return _0x21f17d;}})});}_0x4ace85=_['merge']({},_0x4ace85,_0x43cd4b['options']);var _0x414ef1={'where':_0x4ace85[_0x0f78('0x3a')]};return db[_0x0f78('0x3e')][_0x0f78('0x1d')](_0x414ef1)[_0x0f78('0x3f')](function(_0x3d90a4){_0x3ca5ca[_0x0f78('0x1d')]=_0x3d90a4;if(_0x43cd4b[_0x0f78('0x30')][_0x0f78('0x40')]){_0x4ace85[_0x0f78('0x41')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x4ace85);})[_0x0f78('0x3f')](function(_0x3f81f7){_0x3ca5ca[_0x0f78('0x42')]=_0x3f81f7;return _0x3ca5ca;})[_0x0f78('0x3f')](respondWithFilteredResult(_0x50b8ae,_0x4ace85))[_0x0f78('0x43')](handleError(_0x50b8ae,null));};exports[_0x0f78('0x44')]=function(_0x45ba20,_0x118c76){var _0x2b3fcb={'raw':!![],'where':{'id':_0x45ba20[_0x0f78('0x45')]['id']}},_0x2a8877={};_0x2a8877[_0x0f78('0x2f')]=_['keys'](db['ZohoField'][_0x0f78('0x2c')]);_0x2a8877['query']=_[_0x0f78('0x31')](_0x45ba20[_0x0f78('0x30')]);_0x2a8877[_0x0f78('0x32')]=_['intersection'](_0x2a8877[_0x0f78('0x2f')],_0x2a8877[_0x0f78('0x30')]);_0x2b3fcb[_0x0f78('0x35')]=_['intersection'](_0x2a8877[_0x0f78('0x2f')],qs[_0x0f78('0x34')](_0x45ba20['query'][_0x0f78('0x34')]));_0x2b3fcb[_0x0f78('0x35')]=_0x2b3fcb[_0x0f78('0x35')][_0x0f78('0x36')]?_0x2b3fcb['attributes']:_0x2a8877[_0x0f78('0x2f')];if(_0x45ba20[_0x0f78('0x30')]['includeAll']){_0x2b3fcb['include']=[{'all':!![]}];}_0x2b3fcb=_['merge']({},_0x2b3fcb,_0x45ba20[_0x0f78('0x46')]);return db['ZohoField'][_0x0f78('0x47')](_0x2b3fcb)[_0x0f78('0x3f')](handleEntityNotFound(_0x118c76,null))[_0x0f78('0x3f')](respondWithResult(_0x118c76,null))[_0x0f78('0x43')](handleError(_0x118c76,null));};exports[_0x0f78('0x48')]=function(_0x50074c,_0x302123){return db[_0x0f78('0x3e')][_0x0f78('0x48')](_0x50074c[_0x0f78('0x49')],{})[_0x0f78('0x3f')](respondWithResult(_0x302123,0xc9))[_0x0f78('0x43')](handleError(_0x302123,null));};exports[_0x0f78('0x25')]=function(_0xb4e25c,_0x306cbd){if(_0xb4e25c[_0x0f78('0x49')]['id']){delete _0xb4e25c[_0x0f78('0x49')]['id'];}return db[_0x0f78('0x3e')]['find']({'where':{'id':_0xb4e25c[_0x0f78('0x45')]['id']}})['then'](handleEntityNotFound(_0x306cbd,null))[_0x0f78('0x3f')](saveUpdates(_0xb4e25c[_0x0f78('0x49')],null))[_0x0f78('0x3f')](respondWithResult(_0x306cbd,null))[_0x0f78('0x43')](handleError(_0x306cbd,null));};exports[_0x0f78('0x26')]=function(_0x35da43,_0x678b27){return db[_0x0f78('0x3e')][_0x0f78('0x47')]({'where':{'id':_0x35da43['params']['id']}})[_0x0f78('0x3f')](handleEntityNotFound(_0x678b27,null))[_0x0f78('0x3f')](removeEntity(_0x678b27,null))[_0x0f78('0x43')](handleError(_0x678b27,null));}; \ No newline at end of file +var _0x8a16=['body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','end','stack','name','status','send','index','ZohoField','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','params','find','create'];(function(_0xeeac9e,_0x55096a){var _0x4923d6=function(_0x61d6a2){while(--_0x61d6a2){_0xeeac9e['push'](_0xeeac9e['shift']());}};_0x4923d6(++_0x55096a);}(_0x8a16,0xe6));var _0x68a1=function(_0x439103,_0x25bb47){_0x439103=_0x439103-0x0;var _0x5cd01a=_0x8a16[_0x439103];return _0x5cd01a;};'use strict';var emlformat=require(_0x68a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68a1('0x1'));var jsonpatch=require(_0x68a1('0x2'));var rp=require(_0x68a1('0x3'));var moment=require(_0x68a1('0x4'));var BPromise=require(_0x68a1('0x5'));var Mustache=require(_0x68a1('0x6'));var util=require(_0x68a1('0x7'));var path=require('path');var sox=require(_0x68a1('0x8'));var csv=require(_0x68a1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68a1('0xa'));var _=require('lodash');var squel=require(_0x68a1('0xb'));var crypto=require(_0x68a1('0xc'));var jsforce=require(_0x68a1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x68a1('0x9'));var querystring=require(_0x68a1('0xe'));var Papa=require(_0x68a1('0xf'));var Redis=require(_0x68a1('0x10'));var authService=require(_0x68a1('0x11'));var qs=require(_0x68a1('0x12'));var as=require(_0x68a1('0x13'));var hardwareService=require(_0x68a1('0x14'));var logger=require(_0x68a1('0x15'))(_0x68a1('0x16'));var utils=require(_0x68a1('0x17'));var config=require(_0x68a1('0x18'));var licenseUtil=require(_0x68a1('0x19'));var db=require(_0x68a1('0x1a'))['db'];function respondWithStatusCode(_0x4287c0,_0x5b8eaa){_0x5b8eaa=_0x5b8eaa||0xcc;return function(_0x251888){if(_0x251888){return _0x4287c0[_0x68a1('0x1b')](_0x5b8eaa);}return _0x4287c0['status'](_0x5b8eaa)['end']();};}function respondWithResult(_0x2adf1d,_0x19b8c2){_0x19b8c2=_0x19b8c2||0xc8;return function(_0x23f5c3){if(_0x23f5c3){return _0x2adf1d['status'](_0x19b8c2)[_0x68a1('0x1c')](_0x23f5c3);}};}function respondWithFilteredResult(_0x2e8c23,_0x26bafd){return function(_0x488a90){if(_0x488a90){var _0x2b5302=typeof _0x26bafd[_0x68a1('0x1d')]==='undefined'&&typeof _0x26bafd[_0x68a1('0x1e')]===_0x68a1('0x1f');var _0x460908=_0x488a90[_0x68a1('0x20')];var _0x556e03=_0x2b5302?0x0:_0x26bafd[_0x68a1('0x1d')];var _0x32bb5a=_0x2b5302?_0x488a90[_0x68a1('0x20')]:_0x26bafd[_0x68a1('0x1d')]+_0x26bafd[_0x68a1('0x1e')];var _0x11161f;if(_0x32bb5a>=_0x460908){_0x32bb5a=_0x460908;_0x11161f=0xc8;}else{_0x11161f=0xce;}_0x2e8c23['status'](_0x11161f);return _0x2e8c23['set'](_0x68a1('0x21'),_0x556e03+'-'+_0x32bb5a+'/'+_0x460908)[_0x68a1('0x1c')](_0x488a90);}return null;};}function patchUpdates(_0xff55aa){return function(_0x4024df){try{jsonpatch[_0x68a1('0x22')](_0x4024df,_0xff55aa,!![]);}catch(_0x468050){return BPromise['reject'](_0x468050);}return _0x4024df[_0x68a1('0x23')]();};}function saveUpdates(_0x2dfd63,_0x58a616){return function(_0x437b21){if(_0x437b21){return _0x437b21['update'](_0x2dfd63)[_0x68a1('0x24')](function(_0x393ef6){return _0x393ef6;});}return null;};}function removeEntity(_0x19d0ba,_0x592aec){return function(_0x480389){if(_0x480389){return _0x480389[_0x68a1('0x25')]()[_0x68a1('0x24')](function(){_0x19d0ba['status'](0xcc)[_0x68a1('0x26')]();});}};}function handleEntityNotFound(_0x232adb,_0x9e7cb){return function(_0x1e7bc6){if(!_0x1e7bc6){_0x232adb[_0x68a1('0x1b')](0x194);}return _0x1e7bc6;};}function handleError(_0x5081e6,_0x50cb37){_0x50cb37=_0x50cb37||0x1f4;return function(_0x254ba0){logger['error'](_0x254ba0[_0x68a1('0x27')]);if(_0x254ba0[_0x68a1('0x28')]){delete _0x254ba0[_0x68a1('0x28')];}_0x5081e6[_0x68a1('0x29')](_0x50cb37)[_0x68a1('0x2a')](_0x254ba0);};}exports[_0x68a1('0x2b')]=function(_0x1afd28,_0x24de30){var _0x554b14={},_0x786b82={},_0x1c7cb5={'count':0x0,'rows':[]};var _0x3f015c=_['map'](db[_0x68a1('0x2c')][_0x68a1('0x2d')],function(_0x2ee16b){return{'name':_0x2ee16b[_0x68a1('0x2e')],'type':_0x2ee16b['type']['key']};});_0x786b82[_0x68a1('0x2f')]=_[_0x68a1('0x30')](_0x3f015c,_0x68a1('0x28'));_0x786b82[_0x68a1('0x31')]=_[_0x68a1('0x32')](_0x1afd28['query']);_0x786b82[_0x68a1('0x33')]=_[_0x68a1('0x34')](_0x786b82[_0x68a1('0x2f')],_0x786b82[_0x68a1('0x31')]);_0x554b14[_0x68a1('0x35')]=_[_0x68a1('0x34')](_0x786b82['model'],qs[_0x68a1('0x36')](_0x1afd28[_0x68a1('0x31')][_0x68a1('0x36')]));_0x554b14[_0x68a1('0x35')]=_0x554b14[_0x68a1('0x35')][_0x68a1('0x37')]?_0x554b14[_0x68a1('0x35')]:_0x786b82[_0x68a1('0x2f')];if(!_0x1afd28[_0x68a1('0x31')][_0x68a1('0x38')](_0x68a1('0x39'))){_0x554b14[_0x68a1('0x1e')]=qs[_0x68a1('0x1e')](_0x1afd28['query']['limit']);_0x554b14[_0x68a1('0x1d')]=qs[_0x68a1('0x1d')](_0x1afd28[_0x68a1('0x31')][_0x68a1('0x1d')]);}_0x554b14[_0x68a1('0x3a')]=qs['sort'](_0x1afd28['query'][_0x68a1('0x3b')]);_0x554b14[_0x68a1('0x3c')]=qs[_0x68a1('0x33')](_[_0x68a1('0x3d')](_0x1afd28[_0x68a1('0x31')],_0x786b82[_0x68a1('0x33')]),_0x3f015c);if(_0x1afd28[_0x68a1('0x31')]['filter']){_0x554b14['where']=_['merge'](_0x554b14[_0x68a1('0x3c')],{'$or':_[_0x68a1('0x30')](_0x3f015c,function(_0x5be6b9){if(_0x5be6b9[_0x68a1('0x3e')]!==_0x68a1('0x3f')){var _0x26e558={};_0x26e558[_0x5be6b9[_0x68a1('0x28')]]={'$like':'%'+_0x1afd28[_0x68a1('0x31')][_0x68a1('0x40')]+'%'};return _0x26e558;}})});}_0x554b14=_[_0x68a1('0x41')]({},_0x554b14,_0x1afd28[_0x68a1('0x42')]);var _0x45dd97={'where':_0x554b14['where']};return db[_0x68a1('0x2c')][_0x68a1('0x20')](_0x45dd97)[_0x68a1('0x24')](function(_0x45cd8b){_0x1c7cb5[_0x68a1('0x20')]=_0x45cd8b;if(_0x1afd28[_0x68a1('0x31')][_0x68a1('0x43')]){_0x554b14[_0x68a1('0x44')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x554b14);})['then'](function(_0x55fcff){_0x1c7cb5[_0x68a1('0x45')]=_0x55fcff;return _0x1c7cb5;})[_0x68a1('0x24')](respondWithFilteredResult(_0x24de30,_0x554b14))[_0x68a1('0x46')](handleError(_0x24de30,null));};exports['show']=function(_0x1dee33,_0x3c578b){var _0x177e77={'raw':!![],'where':{'id':_0x1dee33[_0x68a1('0x47')]['id']}},_0xc1ec17={};_0xc1ec17[_0x68a1('0x2f')]=_[_0x68a1('0x32')](db[_0x68a1('0x2c')][_0x68a1('0x2d')]);_0xc1ec17[_0x68a1('0x31')]=_[_0x68a1('0x32')](_0x1dee33[_0x68a1('0x31')]);_0xc1ec17[_0x68a1('0x33')]=_[_0x68a1('0x34')](_0xc1ec17[_0x68a1('0x2f')],_0xc1ec17[_0x68a1('0x31')]);_0x177e77[_0x68a1('0x35')]=_[_0x68a1('0x34')](_0xc1ec17[_0x68a1('0x2f')],qs[_0x68a1('0x36')](_0x1dee33['query'][_0x68a1('0x36')]));_0x177e77[_0x68a1('0x35')]=_0x177e77[_0x68a1('0x35')][_0x68a1('0x37')]?_0x177e77['attributes']:_0xc1ec17[_0x68a1('0x2f')];if(_0x1dee33[_0x68a1('0x31')]['includeAll']){_0x177e77[_0x68a1('0x44')]=[{'all':!![]}];}_0x177e77=_[_0x68a1('0x41')]({},_0x177e77,_0x1dee33['options']);return db[_0x68a1('0x2c')][_0x68a1('0x48')](_0x177e77)['then'](handleEntityNotFound(_0x3c578b,null))[_0x68a1('0x24')](respondWithResult(_0x3c578b,null))[_0x68a1('0x46')](handleError(_0x3c578b,null));};exports['create']=function(_0x27c9ff,_0x17c5d3){return db[_0x68a1('0x2c')][_0x68a1('0x49')](_0x27c9ff[_0x68a1('0x4a')],{})[_0x68a1('0x24')](respondWithResult(_0x17c5d3,0xc9))[_0x68a1('0x46')](handleError(_0x17c5d3,null));};exports[_0x68a1('0x4b')]=function(_0x25a300,_0x12bf7a){if(_0x25a300[_0x68a1('0x4a')]['id']){delete _0x25a300[_0x68a1('0x4a')]['id'];}return db[_0x68a1('0x2c')][_0x68a1('0x48')]({'where':{'id':_0x25a300[_0x68a1('0x47')]['id']}})[_0x68a1('0x24')](handleEntityNotFound(_0x12bf7a,null))[_0x68a1('0x24')](saveUpdates(_0x25a300[_0x68a1('0x4a')],null))[_0x68a1('0x24')](respondWithResult(_0x12bf7a,null))[_0x68a1('0x46')](handleError(_0x12bf7a,null));};exports[_0x68a1('0x25')]=function(_0x299108,_0x2c0e30){return db[_0x68a1('0x2c')][_0x68a1('0x48')]({'where':{'id':_0x299108['params']['id']}})[_0x68a1('0x24')](handleEntityNotFound(_0x2c0e30,null))[_0x68a1('0x24')](removeEntity(_0x2c0e30,null))[_0x68a1('0x46')](handleError(_0x2c0e30,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 17db520..9aad920 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 _0x4888=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','FieldId'];(function(_0x281154,_0x3d769d){var _0x378009=function(_0x4a220d){while(--_0x4a220d){_0x281154['push'](_0x281154['shift']());}};_0x378009(++_0x3d769d);}(_0x4888,0x198));var _0x8488=function(_0x1551bc,_0x334b59){_0x1551bc=_0x1551bc-0x0;var _0x228deb=_0x4888[_0x1551bc];return _0x228deb;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require(_0x8488('0x1'))(_0x8488('0x2'));var moment=require(_0x8488('0x3'));var BPromise=require(_0x8488('0x4'));var rp=require(_0x8488('0x5'));var fs=require('fs');var path=require(_0x8488('0x6'));var rimraf=require('rimraf');var config=require(_0x8488('0x7'));var attributes=require(_0x8488('0x8'));module[_0x8488('0x9')]=function(_0x421292,_0x326887){return _0x421292[_0x8488('0xa')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x8488('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ace=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5f1ee2,_0x335912){var _0x4473c3=function(_0x29f622){while(--_0x29f622){_0x5f1ee2['push'](_0x5f1ee2['shift']());}};_0x4473c3(++_0x335912);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x4f4fa8,_0x455a27){_0x4f4fa8=_0x4f4fa8-0x0;var _0x563b7a=_0x8ace[_0x4f4fa8];return _0x563b7a;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));module[_0xe8ac('0xb')]=function(_0x170e14,_0x2b48ec){return _0x170e14['define'](_0xe8ac('0xc'),attributes,{'tableName':_0xe8ac('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xe8ac('0xe')],'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 48fb5f2..e33731b 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 _0xb1be=['error','message','info','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xb1be,0xa5));var _0xeb1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb1be[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xeb1b('0x0'));var util=require('util');var moment=require(_0xeb1b('0x1'));var BPromise=require(_0xeb1b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb1b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb1b('0x4'))(_0xeb1b('0x5'));var config=require(_0xeb1b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeb1b('0x7')][_0xeb1b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4053d8,_0x4d0568,_0x4219fb){return new BPromise(function(_0x4b53ed,_0x2017a8){return client[_0xeb1b('0x9')](_0x4053d8,_0x4219fb)['then'](function(_0x334a8b){logger['info'](_0xeb1b('0xa'),_0x4d0568,_0xeb1b('0xb'));logger[_0xeb1b('0xc')](_0xeb1b('0xd'),_0x4d0568,_0xeb1b('0xb'),JSON[_0xeb1b('0xe')](_0x334a8b));if(_0x334a8b[_0xeb1b('0xf')]){if(_0x334a8b['error']['code']===0x1f4){logger['error'](_0xeb1b('0xa'),_0x4d0568,_0x334a8b['error'][_0xeb1b('0x10')]);return _0x2017a8(_0x334a8b[_0xeb1b('0xf')]['message']);}logger['error'](_0xeb1b('0xa'),_0x4d0568,_0x334a8b['error']['message']);return _0x4b53ed(_0x334a8b[_0xeb1b('0xf')][_0xeb1b('0x10')]);}else{logger[_0xeb1b('0x11')]('ZohoField,\x20%s,\x20%s',_0x4d0568,'request\x20sent');_0x4b53ed(_0x334a8b[_0xeb1b('0x12')][_0xeb1b('0x10')]);}})[_0xeb1b('0x13')](function(_0x16b486){logger[_0xeb1b('0xf')](_0xeb1b('0xa'),_0x4d0568,_0x16b486);_0x2017a8(_0x16b486);});});} \ No newline at end of file +var _0xf049=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring'];(function(_0x3c4fd5,_0x369895){var _0x1a2981=function(_0x336c58){while(--_0x336c58){_0x3c4fd5['push'](_0x3c4fd5['shift']());}};_0x1a2981(++_0x369895);}(_0xf049,0x130));var _0x9f04=function(_0x4698a3,_0xa2aeab){_0x4698a3=_0x4698a3-0x0;var _0x928245=_0xf049[_0x4698a3];return _0x928245;};'use strict';var _=require(_0x9f04('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f04('0x1'));var fs=require('fs');var Redis=require(_0x9f04('0x2'));var db=require(_0x9f04('0x3'))['db'];var utils=require(_0x9f04('0x4'));var logger=require(_0x9f04('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f04('0x6'));var client=jayson['client'][_0x9f04('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29f4d5,_0x3ba105,_0x534512){return new BPromise(function(_0xa14298,_0x25dc13){return client['request'](_0x29f4d5,_0x534512)['then'](function(_0x1eb819){logger[_0x9f04('0x8')](_0x9f04('0x9'),_0x3ba105,_0x9f04('0xa'));logger[_0x9f04('0xb')](_0x9f04('0xc'),_0x3ba105,_0x9f04('0xa'),JSON[_0x9f04('0xd')](_0x1eb819));if(_0x1eb819[_0x9f04('0xe')]){if(_0x1eb819[_0x9f04('0xe')][_0x9f04('0xf')]===0x1f4){logger[_0x9f04('0xe')]('ZohoField,\x20%s,\x20%s',_0x3ba105,_0x1eb819[_0x9f04('0xe')][_0x9f04('0x10')]);return _0x25dc13(_0x1eb819[_0x9f04('0xe')][_0x9f04('0x10')]);}logger[_0x9f04('0xe')]('ZohoField,\x20%s,\x20%s',_0x3ba105,_0x1eb819[_0x9f04('0xe')][_0x9f04('0x10')]);return _0xa14298(_0x1eb819[_0x9f04('0xe')][_0x9f04('0x10')]);}else{logger[_0x9f04('0x8')](_0x9f04('0x9'),_0x3ba105,'request\x20sent');_0xa14298(_0x1eb819['result'][_0x9f04('0x10')]);}})[_0x9f04('0x11')](function(_0x5f13d6){logger[_0x9f04('0xe')](_0x9f04('0x9'),_0x3ba105,_0x5f13d6);_0x25dc13(_0x5f13d6);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 55d6f71..ea3cfc2 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(_0x54d0d9,_0x1f2828){var _0x379ae0=function(_0x1d156a){while(--_0x1d156a){_0x54d0d9['push'](_0x54d0d9['shift']());}};_0x379ae0(++_0x1f2828);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x426a83,_0x3ca4d7){var _0x25c512=function(_0x307ea9){while(--_0x307ea9){_0x426a83['push'](_0x426a83['shift']());}};_0x25c512(++_0x3ca4d7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0xcb91[_0x4599b6];return _0x2e014c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 222c314..3ee6f4f 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 _0xd8c8=['INTEGER','BOOLEAN','STRING','unique_name_and_version'];(function(_0x179b80,_0x440291){var _0x1e8d03=function(_0x466a71){while(--_0x466a71){_0x179b80['push'](_0x179b80['shift']());}};_0x1e8d03(++_0x440291);}(_0xd8c8,0xba));var _0x8d8c=function(_0x4dab67,_0x503b28){_0x4dab67=_0x4dab67-0x0;var _0x1a459b=_0xd8c8[_0x4dab67];return _0x1a459b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8d8c('0x0')],'allowNull':![],'unique':_0x8d8c('0x1')},'version':{'type':Sequelize[_0x8d8c('0x0')],'allowNull':![],'unique':_0x8d8c('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x8d8c('0x0')]},'path':{'type':Sequelize[_0x8d8c('0x0')]},'type':{'type':Sequelize[_0x8d8c('0x0')]},'size':{'type':Sequelize[_0x8d8c('0x2')]},'active':{'type':Sequelize[_0x8d8c('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x8d8c('0x0')]},'logo':{'type':Sequelize[_0x8d8c('0x0')]},'state':{'type':Sequelize[_0x8d8c('0x0')],'unique':'state'},'description':{'type':Sequelize[_0x8d8c('0x0')]},'title':{'type':Sequelize[_0x8d8c('0x0')]},'remoteUri':{'type':Sequelize[_0x8d8c('0x0')]},'link':{'type':Sequelize[_0x8d8c('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0x6a6c=['app.js','BOOLEAN','sequelize','exports','unique_name_and_version','STRING'];(function(_0x54c64a,_0x3e0a93){var _0x42c306=function(_0x2f4a60){while(--_0x2f4a60){_0x54c64a['push'](_0x54c64a['shift']());}};_0x42c306(++_0x3e0a93);}(_0x6a6c,0x1ac));var _0xc6a6=function(_0x5c85c6,_0x4dc2e4){_0x5c85c6=_0x5c85c6-0x0;var _0x7791eb=_0x6a6c[_0x5c85c6];return _0x7791eb;};'use strict';var Sequelize=require(_0xc6a6('0x0'));module[_0xc6a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6a6('0x2')},'version':{'type':Sequelize[_0xc6a6('0x3')],'allowNull':![],'unique':_0xc6a6('0x2')},'main':{'type':Sequelize[_0xc6a6('0x3')],'defaultValue':_0xc6a6('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xc6a6('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xc6a6('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0xc6a6('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc6a6('0x3')]},'link':{'type':Sequelize[_0xc6a6('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index fc3d505..519f9dc 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 _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x66fa,0x117));var _0xa66f=function(_0x538ed8,_0x9dd894){_0x538ed8=_0x538ed8-0x0;var _0x449967=_0x66fa[_0x538ed8];return _0x449967;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file +var _0x2542=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x223f38,_0x4ece37){var _0x4f18b7=function(_0x502d2c){while(--_0x502d2c){_0x223f38['push'](_0x223f38['shift']());}};_0x4f18b7(++_0x4ece37);}(_0x2542,0x169));var _0x2254=function(_0x9252a2,_0x595d3e){_0x9252a2=_0x9252a2-0x0;var _0x5a4105=_0x2542[_0x9252a2];return _0x5a4105;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['Integration'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 97b7276..68df0c0 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 _0xae4e=['api','moment','bluebird','request-promise','path','exports','Integration','integrations','lodash','util','../../config/logger'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0xae4e,0x189));var _0xeae4=function(_0x303f18,_0x5700f9){_0x303f18=_0x303f18-0x0;var _0x13c369=_0xae4e[_0x303f18];return _0x13c369;};'use strict';var _=require(_0xeae4('0x0'));var util=require(_0xeae4('0x1'));var logger=require(_0xeae4('0x2'))(_0xeae4('0x3'));var moment=require(_0xeae4('0x4'));var BPromise=require(_0xeae4('0x5'));var rp=require(_0xeae4('0x6'));var fs=require('fs');var path=require(_0xeae4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0xeae4('0x8')]=function(_0x2c54bd,_0x33e336){return _0x2c54bd['define'](_0xeae4('0x9'),attributes,{'tableName':_0xeae4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab93=['bluebird','request-promise','path','../../config/environment','exports','define','Integration','util','moment'];(function(_0x4392af,_0xec5afe){var _0x9fa8eb=function(_0x41d7a4){while(--_0x41d7a4){_0x4392af['push'](_0x4392af['shift']());}};_0x9fa8eb(++_0xec5afe);}(_0xab93,0x1ae));var _0x3ab9=function(_0x77d414,_0x94cb54){_0x77d414=_0x77d414-0x0;var _0xce5ede=_0xab93[_0x77d414];return _0xce5ede;};'use strict';var _=require('lodash');var util=require(_0x3ab9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3ab9('0x1'));var BPromise=require(_0x3ab9('0x2'));var rp=require(_0x3ab9('0x3'));var fs=require('fs');var path=require(_0x3ab9('0x4'));var rimraf=require('rimraf');var config=require(_0x3ab9('0x5'));var attributes=require('./integration.attributes');module[_0x3ab9('0x6')]=function(_0x343762,_0x4abcc4){return _0x343762[_0x3ab9('0x7')](_0x3ab9('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index ea59292..962d7ec 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x3e8b0c,_0x37c263){var _0x49e6e4=function(_0x410485){while(--_0x410485){_0x3e8b0c['push'](_0x3e8b0c['shift']());}};_0x49e6e4(++_0x37c263);}(_0xdb28,0x106));var _0x8db2=function(_0x3af918,_0x23834a){_0x3af918=_0x3af918-0x0;var _0x5b5429=_0xdb28[_0x3af918];return _0x5b5429;};'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')]('Integration,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x55892c,_0xce573c){var _0x532bad=function(_0x5efe4a){while(--_0x5efe4a){_0x55892c['push'](_0x55892c['shift']());}};_0x532bad(++_0xce573c);}(_0xd943,0x15d));var _0x3d94=function(_0x3a63d9,_0x5c0290){_0x3a63d9=_0x3a63d9-0x0;var _0xb3ea28=_0xd943[_0x3a63d9];return _0xb3ea28;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3404bc1..f997c45 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 _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0xd943,0x15d));var _0x3d94=function(_0x16b745,_0x5251be){_0x16b745=_0x16b745-0x0;var _0x2179c0=_0xd943[_0x16b745];return _0x2179c0;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file +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(_0x1df8bd,_0xe26da5){var _0x512f7d=function(_0x51e916){while(--_0x51e916){_0x1df8bd['push'](_0x1df8bd['shift']());}};_0x512f7d(++_0xe26da5);}(_0xef0f,0x168));var _0xfef0=function(_0x3b9060,_0x3a34af){_0x3b9060=_0x3b9060-0x0;var _0x25fdc9=_0xef0f[_0x3b9060];return _0x25fdc9;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index cf7baca..c643112 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 _0x2e71=['ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2e71,0x12d));var _0x12e7=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x2e71[_0x484c03];return _0x294127;};'use strict';var Sequelize=require(_0x12e7('0x0'));module[_0x12e7('0x1')]={'integration':{'type':Sequelize[_0x12e7('0x2')]},'eventChannel':{'type':Sequelize[_0x12e7('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x12e7('0x2')]},'integrationId':{'type':Sequelize[_0x12e7('0x3')]},'contacts':{'type':Sequelize[_0x12e7('0x2')]},'uniqueid':{'type':Sequelize[_0x12e7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x12e7('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x12e7('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x12e7('0x3')]},'agentcomplete':{'type':Sequelize[_0x12e7('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x12e7('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x12e7('0x3')]},'reason':{'type':Sequelize[_0x12e7('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x12e7('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x12e7('0x4')]},'agentdump':{'type':Sequelize[_0x12e7('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x12e7('0x2')]},'channel':{'type':Sequelize[_0x12e7('0x2')]},'channelstate':{'type':Sequelize[_0x12e7('0x3')]},'channelstatedesc':{'type':Sequelize[_0x12e7('0x2')]},'connectedlinenum':{'type':Sequelize[_0x12e7('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x12e7('0x2')]},'context':{'type':Sequelize[_0x12e7('0x2')]},'exten':{'type':Sequelize[_0x12e7('0x2')]},'priority':{'type':Sequelize[_0x12e7('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x12e7('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x12e7('0x2')]},'destcalleridnum':{'type':Sequelize[_0x12e7('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x12e7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x12e7('0x2')]},'destlanguage':{'type':Sequelize[_0x12e7('0x2')]},'destaccountcode':{'type':Sequelize[_0x12e7('0x2')]},'destcontext':{'type':Sequelize[_0x12e7('0x2')]},'destexten':{'type':Sequelize[_0x12e7('0x2')]},'destpriority':{'type':Sequelize[_0x12e7('0x2')]},'destuniqueid':{'type':Sequelize[_0x12e7('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x12e7('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x12e7('0x2')]},'to':{'type':Sequelize[_0x12e7('0x2')]},'cc':{'type':Sequelize[_0x12e7('0x2')]},'attachment':{'type':Sequelize[_0x12e7('0x6')]},'html':{'type':Sequelize[_0x12e7('0x6')]},'text':{'type':Sequelize[_0x12e7('0x6')]},'status':{'type':Sequelize[_0x12e7('0x7')](_0x12e7('0x8'),'SENDING',_0x12e7('0x9'),_0x12e7('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x12e7('0x2')]},'projectId':{'type':Sequelize[_0x12e7('0x3')]}}; \ No newline at end of file +var _0x5a81=['STRING','INTEGER','BOOLEAN','DATE','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x331781,_0x256278){var _0x1c4f98=function(_0x15f33f){while(--_0x15f33f){_0x331781['push'](_0x331781['shift']());}};_0x1c4f98(++_0x256278);}(_0x5a81,0x142));var _0x15a8=function(_0xde33,_0x579786){_0xde33=_0xde33-0x0;var _0xd28d9d=_0x5a81[_0xde33];return _0xd28d9d;};'use strict';var Sequelize=require(_0x15a8('0x0'));module[_0x15a8('0x1')]={'integration':{'type':Sequelize[_0x15a8('0x2')]},'eventChannel':{'type':Sequelize[_0x15a8('0x2')]},'exitStatus':{'type':Sequelize[_0x15a8('0x2')]},'ticketId':{'type':Sequelize[_0x15a8('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x15a8('0x2')]},'uniqueid':{'type':Sequelize[_0x15a8('0x2')]},'calleridnum':{'type':Sequelize[_0x15a8('0x2')]},'calleridname':{'type':Sequelize[_0x15a8('0x2')]},'queue':{'type':Sequelize[_0x15a8('0x2')]},'interface':{'type':Sequelize[_0x15a8('0x2')]},'membername':{'type':Sequelize[_0x15a8('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x15a8('0x3')]},'agentcomplete':{'type':Sequelize[_0x15a8('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x15a8('0x3')]},'agentacw':{'type':Sequelize[_0x15a8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x15a8('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x15a8('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x15a8('0x5')]},'lastevent':{'type':Sequelize[_0x15a8('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x15a8('0x3')]},'channelstatedesc':{'type':Sequelize[_0x15a8('0x2')]},'connectedlinenum':{'type':Sequelize[_0x15a8('0x2')]},'connectedlinename':{'type':Sequelize[_0x15a8('0x2')]},'language':{'type':Sequelize[_0x15a8('0x2')]},'accountcode':{'type':Sequelize[_0x15a8('0x2')]},'context':{'type':Sequelize[_0x15a8('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15a8('0x2')]},'destchannel':{'type':Sequelize[_0x15a8('0x2')]},'destchannelstate':{'type':Sequelize[_0x15a8('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x15a8('0x2')]},'destcalleridnum':{'type':Sequelize[_0x15a8('0x2')]},'destcalleridname':{'type':Sequelize[_0x15a8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x15a8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x15a8('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x15a8('0x2')]},'destcontext':{'type':Sequelize[_0x15a8('0x2')]},'destexten':{'type':Sequelize[_0x15a8('0x2')]},'destpriority':{'type':Sequelize[_0x15a8('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x15a8('0x2')]},'inReplyTo':{'type':Sequelize[_0x15a8('0x2')]},'subject':{'type':Sequelize[_0x15a8('0x2')]},'from':{'type':Sequelize[_0x15a8('0x2')]},'to':{'type':Sequelize[_0x15a8('0x2')]},'cc':{'type':Sequelize[_0x15a8('0x2')]},'attachment':{'type':Sequelize[_0x15a8('0x6')]},'html':{'type':Sequelize[_0x15a8('0x6')]},'text':{'type':Sequelize[_0x15a8('0x6')]},'status':{'type':Sequelize[_0x15a8('0x7')](_0x15a8('0x8'),_0x15a8('0x9'),_0x15a8('0xa'),_0x15a8('0xb'))},'url':{'type':Sequelize[_0x15a8('0x2')]},'app':{'type':Sequelize[_0x15a8('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index cdf1ba7..613eb38 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 _0x10dc=['map','IntegrationReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x3673ea,_0x405187){var _0x1fc829=function(_0x2509aa){while(--_0x2509aa){_0x3673ea['push'](_0x3673ea['shift']());}};_0x1fc829(++_0x405187);}(_0x10dc,0x151));var _0xc10d=function(_0x5b75c4,_0xca1d42){_0x5b75c4=_0x5b75c4-0x0;var _0x6f2bda=_0x10dc[_0x5b75c4];return _0x6f2bda;};'use strict';var emlformat=require(_0xc10d('0x0'));var rimraf=require(_0xc10d('0x1'));var zipdir=require(_0xc10d('0x2'));var jsonpatch=require(_0xc10d('0x3'));var rp=require('request-promise');var moment=require(_0xc10d('0x4'));var BPromise=require(_0xc10d('0x5'));var Mustache=require('mustache');var util=require(_0xc10d('0x6'));var path=require(_0xc10d('0x7'));var sox=require(_0xc10d('0x8'));var csv=require(_0xc10d('0x9'));var ejs=require(_0xc10d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc10d('0xb'));var squel=require(_0xc10d('0xc'));var crypto=require('crypto');var jsforce=require(_0xc10d('0xd'));var deskjs=require(_0xc10d('0xe'));var toCsv=require(_0xc10d('0x9'));var querystring=require(_0xc10d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc10d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc10d('0x11'))(_0xc10d('0x12'));var utils=require(_0xc10d('0x13'));var config=require(_0xc10d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc10d('0x15'))['db'];function respondWithStatusCode(_0x113cab,_0xd64fcc){_0xd64fcc=_0xd64fcc||0xcc;return function(_0xc10409){if(_0xc10409){return _0x113cab['sendStatus'](_0xd64fcc);}return _0x113cab[_0xc10d('0x16')](_0xd64fcc)[_0xc10d('0x17')]();};}function respondWithResult(_0xa1a434,_0x39d878){_0x39d878=_0x39d878||0xc8;return function(_0x2a6f21){if(_0x2a6f21){return _0xa1a434[_0xc10d('0x16')](_0x39d878)[_0xc10d('0x18')](_0x2a6f21);}};}function respondWithFilteredResult(_0x21aa5d,_0x5c27c2){return function(_0x58e605){if(_0x58e605){var _0xb8f46f=typeof _0x5c27c2['offset']===_0xc10d('0x19')&&typeof _0x5c27c2[_0xc10d('0x1a')]===_0xc10d('0x19');var _0x1f854f=_0x58e605['count'];var _0x45c65d=_0xb8f46f?0x0:_0x5c27c2[_0xc10d('0x1b')];var _0x5ed214=_0xb8f46f?_0x58e605[_0xc10d('0x1c')]:_0x5c27c2[_0xc10d('0x1b')]+_0x5c27c2[_0xc10d('0x1a')];var _0x875b26;if(_0x5ed214>=_0x1f854f){_0x5ed214=_0x1f854f;_0x875b26=0xc8;}else{_0x875b26=0xce;}_0x21aa5d[_0xc10d('0x16')](_0x875b26);return _0x21aa5d[_0xc10d('0x1d')](_0xc10d('0x1e'),_0x45c65d+'-'+_0x5ed214+'/'+_0x1f854f)[_0xc10d('0x18')](_0x58e605);}return null;};}function patchUpdates(_0x3f8c4a){return function(_0x25b725){try{jsonpatch[_0xc10d('0x1f')](_0x25b725,_0x3f8c4a,!![]);}catch(_0x3362a2){return BPromise[_0xc10d('0x20')](_0x3362a2);}return _0x25b725[_0xc10d('0x21')]();};}function saveUpdates(_0x3f4369,_0x4e1a9e){return function(_0x45e3f5){if(_0x45e3f5){return _0x45e3f5[_0xc10d('0x22')](_0x3f4369)[_0xc10d('0x23')](function(_0x5e3437){return _0x5e3437;});}return null;};}function removeEntity(_0x545aa3,_0x3adf48){return function(_0x1041a0){if(_0x1041a0){return _0x1041a0[_0xc10d('0x24')]()[_0xc10d('0x23')](function(){_0x545aa3['status'](0xcc)[_0xc10d('0x17')]();});}};}function handleEntityNotFound(_0x152e27,_0x14bb64){return function(_0x200ebe){if(!_0x200ebe){_0x152e27[_0xc10d('0x25')](0x194);}return _0x200ebe;};}function handleError(_0x42d563,_0x1273fe){_0x1273fe=_0x1273fe||0x1f4;return function(_0x530b07){logger[_0xc10d('0x26')](_0x530b07[_0xc10d('0x27')]);if(_0x530b07[_0xc10d('0x28')]){delete _0x530b07[_0xc10d('0x28')];}_0x42d563['status'](_0x1273fe)[_0xc10d('0x29')](_0x530b07);};}exports[_0xc10d('0x2a')]=function(_0x412956,_0x98e3d0){var _0x4bcf8b={},_0x510107={},_0x2d3022={'count':0x0,'rows':[]};var _0x2dfee4=_[_0xc10d('0x2b')](db[_0xc10d('0x2c')][_0xc10d('0x2d')],function(_0x33736e){return{'name':_0x33736e['fieldName'],'type':_0x33736e[_0xc10d('0x2e')][_0xc10d('0x2f')]};});_0x510107[_0xc10d('0x30')]=_[_0xc10d('0x2b')](_0x2dfee4,_0xc10d('0x28'));_0x510107[_0xc10d('0x31')]=_['keys'](_0x412956[_0xc10d('0x31')]);_0x510107[_0xc10d('0x32')]=_[_0xc10d('0x33')](_0x510107[_0xc10d('0x30')],_0x510107[_0xc10d('0x31')]);_0x4bcf8b[_0xc10d('0x34')]=_['intersection'](_0x510107[_0xc10d('0x30')],qs['fields'](_0x412956[_0xc10d('0x31')][_0xc10d('0x35')]));_0x4bcf8b[_0xc10d('0x34')]=_0x4bcf8b[_0xc10d('0x34')][_0xc10d('0x36')]?_0x4bcf8b[_0xc10d('0x34')]:_0x510107[_0xc10d('0x30')];if(!_0x412956['query'][_0xc10d('0x37')](_0xc10d('0x38'))){_0x4bcf8b[_0xc10d('0x1a')]=qs[_0xc10d('0x1a')](_0x412956[_0xc10d('0x31')]['limit']);_0x4bcf8b[_0xc10d('0x1b')]=qs[_0xc10d('0x1b')](_0x412956[_0xc10d('0x31')][_0xc10d('0x1b')]);}_0x4bcf8b[_0xc10d('0x39')]=qs['sort'](_0x412956[_0xc10d('0x31')]['sort']);_0x4bcf8b[_0xc10d('0x3a')]=qs[_0xc10d('0x32')](_[_0xc10d('0x3b')](_0x412956[_0xc10d('0x31')],_0x510107[_0xc10d('0x32')]),_0x2dfee4);if(_0x412956['query']['filter']){_0x4bcf8b[_0xc10d('0x3a')]=_['merge'](_0x4bcf8b[_0xc10d('0x3a')],{'$or':_[_0xc10d('0x2b')](_0x2dfee4,function(_0x5f2fee){if(_0x5f2fee['type']!==_0xc10d('0x3c')){var _0xfa8889={};_0xfa8889[_0x5f2fee[_0xc10d('0x28')]]={'$like':'%'+_0x412956['query'][_0xc10d('0x3d')]+'%'};return _0xfa8889;}})});}_0x4bcf8b=_[_0xc10d('0x3e')]({},_0x4bcf8b,_0x412956[_0xc10d('0x3f')]);var _0x430168={'where':_0x4bcf8b[_0xc10d('0x3a')]};return db['IntegrationReport']['count'](_0x430168)[_0xc10d('0x23')](function(_0x480775){_0x2d3022[_0xc10d('0x1c')]=_0x480775;if(_0x412956['query'][_0xc10d('0x40')]){_0x4bcf8b[_0xc10d('0x41')]=[{'all':!![]}];}return db['IntegrationReport'][_0xc10d('0x42')](_0x4bcf8b);})[_0xc10d('0x23')](function(_0x2b6f6b){_0x2d3022[_0xc10d('0x43')]=_0x2b6f6b;return _0x2d3022;})[_0xc10d('0x23')](respondWithFilteredResult(_0x98e3d0,_0x4bcf8b))[_0xc10d('0x44')](handleError(_0x98e3d0,null));};exports[_0xc10d('0x45')]=function(_0x4b8e86,_0x5f53c9){var _0x1917e7={'raw':![],'where':{'id':_0x4b8e86['params']['id']}},_0x11ea01={};_0x11ea01[_0xc10d('0x30')]=_[_0xc10d('0x46')](db[_0xc10d('0x2c')][_0xc10d('0x2d')]);_0x11ea01[_0xc10d('0x31')]=_[_0xc10d('0x46')](_0x4b8e86[_0xc10d('0x31')]);_0x11ea01[_0xc10d('0x32')]=_[_0xc10d('0x33')](_0x11ea01[_0xc10d('0x30')],_0x11ea01[_0xc10d('0x31')]);_0x1917e7[_0xc10d('0x34')]=_['intersection'](_0x11ea01[_0xc10d('0x30')],qs[_0xc10d('0x35')](_0x4b8e86['query']['fields']));_0x1917e7[_0xc10d('0x34')]=_0x1917e7[_0xc10d('0x34')][_0xc10d('0x36')]?_0x1917e7['attributes']:_0x11ea01[_0xc10d('0x30')];if(_0x4b8e86['query'][_0xc10d('0x40')]){_0x1917e7[_0xc10d('0x41')]=[{'all':!![]}];}_0x1917e7=_[_0xc10d('0x3e')]({},_0x1917e7,_0x4b8e86[_0xc10d('0x3f')]);return db[_0xc10d('0x2c')][_0xc10d('0x47')](_0x1917e7)[_0xc10d('0x23')](handleEntityNotFound(_0x5f53c9,null))['then'](respondWithResult(_0x5f53c9,null))[_0xc10d('0x44')](handleError(_0x5f53c9,null));};exports[_0xc10d('0x48')]=function(_0x53b05b,_0x20a74a){return db['IntegrationReport']['create'](_0x53b05b[_0xc10d('0x49')],{})[_0xc10d('0x23')](respondWithResult(_0x20a74a,0xc9))[_0xc10d('0x44')](handleError(_0x20a74a,null));};exports[_0xc10d('0x22')]=function(_0x32332e,_0x20dfb8){if(_0x32332e[_0xc10d('0x49')]['id']){delete _0x32332e['body']['id'];}return db[_0xc10d('0x2c')][_0xc10d('0x47')]({'where':{'id':_0x32332e[_0xc10d('0x4a')]['id']}})[_0xc10d('0x23')](handleEntityNotFound(_0x20dfb8,null))['then'](saveUpdates(_0x32332e[_0xc10d('0x49')],null))[_0xc10d('0x23')](respondWithResult(_0x20dfb8,null))[_0xc10d('0x44')](handleError(_0x20dfb8,null));};exports[_0xc10d('0x24')]=function(_0x4f2e0d,_0xfc13a4){return db[_0xc10d('0x2c')][_0xc10d('0x47')]({'where':{'id':_0x4f2e0d['params']['id']}})['then'](handleEntityNotFound(_0xfc13a4,null))[_0xc10d('0x23')](removeEntity(_0xfc13a4,null))['catch'](handleError(_0xfc13a4,null));};exports['describe']=function(_0x2a8347,_0x5eca3b){return db[_0xc10d('0x2c')][_0xc10d('0x4b')]()[_0xc10d('0x23')](respondWithResult(_0x5eca3b,null))[_0xc10d('0x44')](handleError(_0x5eca3b,null));}; \ No newline at end of file +var _0xedfc=['create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','find'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xedfc,0x1c5));var _0xcedf=function(_0x370a91,_0x5300b5){_0x370a91=_0x370a91-0x0;var _0x2e59d8=_0xedfc[_0x370a91];return _0x2e59d8;};'use strict';var emlformat=require(_0xcedf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcedf('0x1'));var rp=require(_0xcedf('0x2'));var moment=require(_0xcedf('0x3'));var BPromise=require(_0xcedf('0x4'));var Mustache=require(_0xcedf('0x5'));var util=require(_0xcedf('0x6'));var path=require(_0xcedf('0x7'));var sox=require(_0xcedf('0x8'));var csv=require(_0xcedf('0x9'));var ejs=require(_0xcedf('0xa'));var fs=require('fs');var fs_extra=require(_0xcedf('0xb'));var _=require(_0xcedf('0xc'));var squel=require(_0xcedf('0xd'));var crypto=require(_0xcedf('0xe'));var jsforce=require(_0xcedf('0xf'));var deskjs=require(_0xcedf('0x10'));var toCsv=require(_0xcedf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcedf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcedf('0x12'));var as=require(_0xcedf('0x13'));var hardwareService=require(_0xcedf('0x14'));var logger=require(_0xcedf('0x15'))(_0xcedf('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcedf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x517b9a,_0x3c2c1e){_0x3c2c1e=_0x3c2c1e||0xcc;return function(_0x5b02e6){if(_0x5b02e6){return _0x517b9a['sendStatus'](_0x3c2c1e);}return _0x517b9a[_0xcedf('0x18')](_0x3c2c1e)[_0xcedf('0x19')]();};}function respondWithResult(_0x43bc09,_0x29111c){_0x29111c=_0x29111c||0xc8;return function(_0x134712){if(_0x134712){return _0x43bc09[_0xcedf('0x18')](_0x29111c)[_0xcedf('0x1a')](_0x134712);}};}function respondWithFilteredResult(_0x1e02c3,_0x9ffade){return function(_0x1ff274){if(_0x1ff274){var _0x26f67d=typeof _0x9ffade[_0xcedf('0x1b')]===_0xcedf('0x1c')&&typeof _0x9ffade[_0xcedf('0x1d')]===_0xcedf('0x1c');var _0x3b0921=_0x1ff274['count'];var _0xea5e01=_0x26f67d?0x0:_0x9ffade[_0xcedf('0x1b')];var _0x4f765c=_0x26f67d?_0x1ff274[_0xcedf('0x1e')]:_0x9ffade[_0xcedf('0x1b')]+_0x9ffade[_0xcedf('0x1d')];var _0xa4cd05;if(_0x4f765c>=_0x3b0921){_0x4f765c=_0x3b0921;_0xa4cd05=0xc8;}else{_0xa4cd05=0xce;}_0x1e02c3['status'](_0xa4cd05);return _0x1e02c3[_0xcedf('0x1f')]('Content-Range',_0xea5e01+'-'+_0x4f765c+'/'+_0x3b0921)[_0xcedf('0x1a')](_0x1ff274);}return null;};}function patchUpdates(_0xa34eb3){return function(_0x470fad){try{jsonpatch[_0xcedf('0x20')](_0x470fad,_0xa34eb3,!![]);}catch(_0x404905){return BPromise[_0xcedf('0x21')](_0x404905);}return _0x470fad['save']();};}function saveUpdates(_0x46dbd3,_0xac89dc){return function(_0x2c5cf7){if(_0x2c5cf7){return _0x2c5cf7[_0xcedf('0x22')](_0x46dbd3)[_0xcedf('0x23')](function(_0x2da228){return _0x2da228;});}return null;};}function removeEntity(_0x4ca695,_0x3f6e4a){return function(_0x188ef1){if(_0x188ef1){return _0x188ef1[_0xcedf('0x24')]()[_0xcedf('0x23')](function(){_0x4ca695['status'](0xcc)[_0xcedf('0x19')]();});}};}function handleEntityNotFound(_0x3a6d6d,_0x49eb51){return function(_0x21725e){if(!_0x21725e){_0x3a6d6d[_0xcedf('0x25')](0x194);}return _0x21725e;};}function handleError(_0xd2f300,_0x4707c1){_0x4707c1=_0x4707c1||0x1f4;return function(_0x38c54b){logger[_0xcedf('0x26')](_0x38c54b[_0xcedf('0x27')]);if(_0x38c54b[_0xcedf('0x28')]){delete _0x38c54b[_0xcedf('0x28')];}_0xd2f300[_0xcedf('0x18')](_0x4707c1)['send'](_0x38c54b);};}exports[_0xcedf('0x29')]=function(_0x2be5ae,_0x3f9517){var _0x1e2bde={},_0x35be19={},_0x24b0e2={'count':0x0,'rows':[]};var _0x1618e9=_[_0xcedf('0x2a')](db[_0xcedf('0x2b')][_0xcedf('0x2c')],function(_0x26562a){return{'name':_0x26562a[_0xcedf('0x2d')],'type':_0x26562a['type'][_0xcedf('0x2e')]};});_0x35be19[_0xcedf('0x2f')]=_['map'](_0x1618e9,'name');_0x35be19[_0xcedf('0x30')]=_[_0xcedf('0x31')](_0x2be5ae['query']);_0x35be19['filters']=_['intersection'](_0x35be19[_0xcedf('0x2f')],_0x35be19[_0xcedf('0x30')]);_0x1e2bde[_0xcedf('0x32')]=_[_0xcedf('0x33')](_0x35be19[_0xcedf('0x2f')],qs[_0xcedf('0x34')](_0x2be5ae[_0xcedf('0x30')][_0xcedf('0x34')]));_0x1e2bde[_0xcedf('0x32')]=_0x1e2bde[_0xcedf('0x32')][_0xcedf('0x35')]?_0x1e2bde['attributes']:_0x35be19[_0xcedf('0x2f')];if(!_0x2be5ae[_0xcedf('0x30')][_0xcedf('0x36')](_0xcedf('0x37'))){_0x1e2bde[_0xcedf('0x1d')]=qs[_0xcedf('0x1d')](_0x2be5ae[_0xcedf('0x30')][_0xcedf('0x1d')]);_0x1e2bde['offset']=qs[_0xcedf('0x1b')](_0x2be5ae[_0xcedf('0x30')][_0xcedf('0x1b')]);}_0x1e2bde[_0xcedf('0x38')]=qs[_0xcedf('0x39')](_0x2be5ae[_0xcedf('0x30')][_0xcedf('0x39')]);_0x1e2bde['where']=qs[_0xcedf('0x3a')](_[_0xcedf('0x3b')](_0x2be5ae[_0xcedf('0x30')],_0x35be19['filters']),_0x1618e9);if(_0x2be5ae['query']['filter']){_0x1e2bde[_0xcedf('0x3c')]=_[_0xcedf('0x3d')](_0x1e2bde['where'],{'$or':_[_0xcedf('0x2a')](_0x1618e9,function(_0x214bbd){if(_0x214bbd[_0xcedf('0x3e')]!=='VIRTUAL'){var _0x4c1c9b={};_0x4c1c9b[_0x214bbd[_0xcedf('0x28')]]={'$like':'%'+_0x2be5ae[_0xcedf('0x30')][_0xcedf('0x3f')]+'%'};return _0x4c1c9b;}})});}_0x1e2bde=_[_0xcedf('0x3d')]({},_0x1e2bde,_0x2be5ae[_0xcedf('0x40')]);var _0x3de914={'where':_0x1e2bde[_0xcedf('0x3c')]};return db['IntegrationReport'][_0xcedf('0x1e')](_0x3de914)[_0xcedf('0x23')](function(_0x46b556){_0x24b0e2[_0xcedf('0x1e')]=_0x46b556;if(_0x2be5ae[_0xcedf('0x30')][_0xcedf('0x41')]){_0x1e2bde[_0xcedf('0x42')]=[{'all':!![]}];}return db[_0xcedf('0x2b')][_0xcedf('0x43')](_0x1e2bde);})[_0xcedf('0x23')](function(_0x45a1ed){_0x24b0e2[_0xcedf('0x44')]=_0x45a1ed;return _0x24b0e2;})[_0xcedf('0x23')](respondWithFilteredResult(_0x3f9517,_0x1e2bde))[_0xcedf('0x45')](handleError(_0x3f9517,null));};exports[_0xcedf('0x46')]=function(_0x67f3bd,_0x3c5ee){var _0x2a4b5b={'raw':![],'where':{'id':_0x67f3bd['params']['id']}},_0x4929f8={};_0x4929f8[_0xcedf('0x2f')]=_[_0xcedf('0x31')](db['IntegrationReport'][_0xcedf('0x2c')]);_0x4929f8[_0xcedf('0x30')]=_['keys'](_0x67f3bd[_0xcedf('0x30')]);_0x4929f8[_0xcedf('0x3a')]=_[_0xcedf('0x33')](_0x4929f8[_0xcedf('0x2f')],_0x4929f8['query']);_0x2a4b5b[_0xcedf('0x32')]=_[_0xcedf('0x33')](_0x4929f8[_0xcedf('0x2f')],qs[_0xcedf('0x34')](_0x67f3bd[_0xcedf('0x30')][_0xcedf('0x34')]));_0x2a4b5b[_0xcedf('0x32')]=_0x2a4b5b[_0xcedf('0x32')][_0xcedf('0x35')]?_0x2a4b5b[_0xcedf('0x32')]:_0x4929f8[_0xcedf('0x2f')];if(_0x67f3bd[_0xcedf('0x30')]['includeAll']){_0x2a4b5b[_0xcedf('0x42')]=[{'all':!![]}];}_0x2a4b5b=_[_0xcedf('0x3d')]({},_0x2a4b5b,_0x67f3bd[_0xcedf('0x40')]);return db[_0xcedf('0x2b')][_0xcedf('0x47')](_0x2a4b5b)[_0xcedf('0x23')](handleEntityNotFound(_0x3c5ee,null))[_0xcedf('0x23')](respondWithResult(_0x3c5ee,null))[_0xcedf('0x45')](handleError(_0x3c5ee,null));};exports[_0xcedf('0x48')]=function(_0xc7190d,_0x960a07){return db[_0xcedf('0x2b')][_0xcedf('0x48')](_0xc7190d[_0xcedf('0x49')],{})[_0xcedf('0x23')](respondWithResult(_0x960a07,0xc9))['catch'](handleError(_0x960a07,null));};exports[_0xcedf('0x22')]=function(_0x22f045,_0x469116){if(_0x22f045[_0xcedf('0x49')]['id']){delete _0x22f045['body']['id'];}return db[_0xcedf('0x2b')][_0xcedf('0x47')]({'where':{'id':_0x22f045['params']['id']}})[_0xcedf('0x23')](handleEntityNotFound(_0x469116,null))[_0xcedf('0x23')](saveUpdates(_0x22f045[_0xcedf('0x49')],null))[_0xcedf('0x23')](respondWithResult(_0x469116,null))['catch'](handleError(_0x469116,null));};exports[_0xcedf('0x24')]=function(_0x5351a9,_0x615267){return db[_0xcedf('0x2b')]['find']({'where':{'id':_0x5351a9[_0xcedf('0x4a')]['id']}})[_0xcedf('0x23')](handleEntityNotFound(_0x615267,null))[_0xcedf('0x23')](removeEntity(_0x615267,null))[_0xcedf('0x45')](handleError(_0x615267,null));};exports['describe']=function(_0xd383e8,_0x5ec6f1){return db[_0xcedf('0x2b')]['describe']()[_0xcedf('0x23')](respondWithResult(_0x5ec6f1,null))[_0xcedf('0x45')](handleError(_0x5ec6f1,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 45b614d..f9aed12 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 _0xbbb5=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa93ea2,_0x1d5e35){var _0x16c081=function(_0xd28218){while(--_0xd28218){_0xa93ea2['push'](_0xa93ea2['shift']());}};_0x16c081(++_0x1d5e35);}(_0xbbb5,0xd5));var _0x5bbb=function(_0xbabf6a,_0x2bf73a){_0xbabf6a=_0xbabf6a-0x0;var _0x1b84a3=_0xbbb5[_0xbabf6a];return _0x1b84a3;};'use strict';var _=require('lodash');var util=require(_0x5bbb('0x0'));var logger=require(_0x5bbb('0x1'))(_0x5bbb('0x2'));var moment=require('moment');var BPromise=require(_0x5bbb('0x3'));var rp=require(_0x5bbb('0x4'));var fs=require('fs');var path=require(_0x5bbb('0x5'));var rimraf=require(_0x5bbb('0x6'));var config=require(_0x5bbb('0x7'));var attributes=require(_0x5bbb('0x8'));module[_0x5bbb('0x9')]=function(_0x1c983c,_0x2e35ea){return _0x1c983c[_0x5bbb('0xa')](_0x5bbb('0xb'),attributes,{'tableName':_0x5bbb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45e4=['report_integration','lodash','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x3cd9c8,_0x96cec4){var _0x1deba3=function(_0xa0f264){while(--_0xa0f264){_0x3cd9c8['push'](_0x3cd9c8['shift']());}};_0x1deba3(++_0x96cec4);}(_0x45e4,0x10f));var _0x445e=function(_0x198de8,_0x3e3308){_0x198de8=_0x198de8-0x0;var _0x404465=_0x45e4[_0x198de8];return _0x404465;};'use strict';var _=require(_0x445e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x445e('0x1'));var moment=require(_0x445e('0x2'));var BPromise=require(_0x445e('0x3'));var rp=require(_0x445e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x445e('0x5'));var attributes=require('./integrationReport.attributes');module[_0x445e('0x6')]=function(_0x561991,_0x179f0f){return _0x561991[_0x445e('0x7')]('IntegrationReport',attributes,{'tableName':_0x445e('0x8'),'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 e655fe9..9b1b905 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 _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x35900e,_0x1f971a){var _0x2119c9=function(_0x48fe00){while(--_0x48fe00){_0x35900e['push'](_0x35900e['shift']());}};_0x2119c9(++_0x1f971a);}(_0x57ca,0x108));var _0xa57c=function(_0x31205e,_0xc98c62){_0x31205e=_0x31205e-0x0;var _0x598571=_0x57ca[_0x31205e];return _0x598571;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x144b33,_0xcea3e0){var _0x36e2a1=function(_0x125dbe){while(--_0x125dbe){_0x144b33['push'](_0x144b33['shift']());}};_0x36e2a1(++_0xcea3e0);}(_0x187d,0x93));var _0xd187=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x187d[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c149212..4da4447 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 _0x482d=['show','/:id/sub_intervals','getIntervals','post','isAuthenticated','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x482d,0x16c));var _0xd482=function(_0x15517d,_0x25ddae){_0x15517d=_0x15517d-0x0;var _0x183038=_0x482d[_0x15517d];return _0x183038;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd482('0x0'));var timeout=require(_0xd482('0x1'));var express=require(_0xd482('0x2'));var router=express[_0xd482('0x3')]();var fs_extra=require(_0xd482('0x4'));var auth=require(_0xd482('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd482('0x6'));var controller=require(_0xd482('0x7'));router[_0xd482('0x8')]('/',auth['isAuthenticated'](),controller[_0xd482('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd482('0xa')]);router[_0xd482('0x8')](_0xd482('0xb'),auth['isAuthenticated'](),controller[_0xd482('0xc')]);router[_0xd482('0xd')]('/',auth[_0xd482('0xe')](),controller[_0xd482('0xf')]);router[_0xd482('0xd')](_0xd482('0xb'),auth[_0xd482('0xe')](),controller[_0xd482('0x10')]);router['post'](_0xd482('0x11'),auth[_0xd482('0xe')](),controller[_0xd482('0x12')]);router[_0xd482('0x13')]('/:id',auth[_0xd482('0xe')](),controller[_0xd482('0x14')]);router[_0xd482('0x15')]('/:id',auth[_0xd482('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa751=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getIntervals','post','create','/:id/sub_intervals','addInterval','addIntervals','put','exports','multer','util','path','connect-timeout','Router'];(function(_0x3b5c3e,_0x53b4ae){var _0x396d82=function(_0x1985e5){while(--_0x1985e5){_0x3b5c3e['push'](_0x3b5c3e['shift']());}};_0x396d82(++_0x53b4ae);}(_0xa751,0x175));var _0x1a75=function(_0x30089b,_0x1bddfd){_0x30089b=_0x30089b-0x0;var _0x4f7ee6=_0xa751[_0x30089b];return _0x4f7ee6;};'use strict';var multer=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var path=require(_0x1a75('0x2'));var timeout=require(_0x1a75('0x3'));var express=require('express');var router=express[_0x1a75('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a75('0x5'));var interaction=require(_0x1a75('0x6'));var config=require(_0x1a75('0x7'));var controller=require('./interval.controller');router[_0x1a75('0x8')]('/',auth[_0x1a75('0x9')](),controller[_0x1a75('0xa')]);router[_0x1a75('0x8')](_0x1a75('0xb'),auth[_0x1a75('0x9')](),controller[_0x1a75('0xc')]);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x1a75('0xd')]);router[_0x1a75('0xe')]('/',auth[_0x1a75('0x9')](),controller[_0x1a75('0xf')]);router[_0x1a75('0xe')](_0x1a75('0x10'),auth[_0x1a75('0x9')](),controller[_0x1a75('0x11')]);router['post']('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x1a75('0x12')]);router[_0x1a75('0x13')](_0x1a75('0xb'),auth[_0x1a75('0x9')](),controller['update']);router['delete'](_0x1a75('0xb'),auth[_0x1a75('0x9')](),controller['destroy']);module[_0x1a75('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 1aa5f35..b76271f 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 _0xb08d=['STRING','exports'];(function(_0x2618c7,_0x238923){var _0x40b96e=function(_0xf089c4){while(--_0xf089c4){_0x2618c7['push'](_0x2618c7['shift']());}};_0x40b96e(++_0x238923);}(_0xb08d,0x123));var _0xdb08=function(_0x23ce5c,_0x2edcac){_0x23ce5c=_0x23ce5c-0x0;var _0x3e6b16=_0xb08d[_0x23ce5c];return _0x3e6b16;};'use strict';var Sequelize=require('sequelize');module[_0xdb08('0x0')]={'name':{'type':Sequelize[_0xdb08('0x1')]},'description':{'type':Sequelize[_0xdb08('0x1')]},'interval':{'type':Sequelize[_0xdb08('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x2071=['STRING','sequelize','exports'];(function(_0x37b004,_0x52d4b7){var _0x180d3d=function(_0x2cbaeb){while(--_0x2cbaeb){_0x37b004['push'](_0x37b004['shift']());}};_0x180d3d(++_0x52d4b7);}(_0x2071,0x1ed));var _0x1207=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x2071[_0x31172e];return _0x414ada;};'use strict';var Sequelize=require(_0x1207('0x0'));module[_0x1207('0x1')]={'name':{'type':Sequelize[_0x1207('0x2')]},'description':{'type':Sequelize[_0x1207('0x2')]},'interval':{'type':Sequelize[_0x1207('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 59b3cf1..c8b0ab7 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 _0xc977=['../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','destroy','then','get','UserProfileResource','end','error','name','send','Interval','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','type','VIRTUAL','filter','merge','options','count','include','findAll','show','keys','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5a8038,_0x10047c){var _0x1ab1fd=function(_0x484d1b){while(--_0x484d1b){_0x5a8038['push'](_0x5a8038['shift']());}};_0x1ab1fd(++_0x10047c);}(_0xc977,0x9a));var _0x7c97=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0xc977[_0x47d6dc];return _0x1a1c93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c97('0x0'));var zipdir=require(_0x7c97('0x1'));var jsonpatch=require(_0x7c97('0x2'));var rp=require(_0x7c97('0x3'));var moment=require('moment');var BPromise=require(_0x7c97('0x4'));var Mustache=require(_0x7c97('0x5'));var util=require(_0x7c97('0x6'));var path=require(_0x7c97('0x7'));var sox=require(_0x7c97('0x8'));var csv=require(_0x7c97('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c97('0xa'));var squel=require(_0x7c97('0xb'));var crypto=require(_0x7c97('0xc'));var jsforce=require(_0x7c97('0xd'));var deskjs=require(_0x7c97('0xe'));var toCsv=require(_0x7c97('0x9'));var querystring=require(_0x7c97('0xf'));var Papa=require(_0x7c97('0x10'));var Redis=require(_0x7c97('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7c97('0x12'));var hardwareService=require(_0x7c97('0x13'));var logger=require(_0x7c97('0x14'))(_0x7c97('0x15'));var utils=require(_0x7c97('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7c97('0x17'));var db=require('../../mysqldb')['db'];var extensions=require(_0x7c97('0x18'));function respondWithStatusCode(_0x3485d8,_0x2a94b5){_0x2a94b5=_0x2a94b5||0xcc;return function(_0x34316a){if(_0x34316a){return _0x3485d8[_0x7c97('0x19')](_0x2a94b5);}return _0x3485d8[_0x7c97('0x1a')](_0x2a94b5)['end']();};}function respondWithResult(_0x5246c9,_0x3136ae){_0x3136ae=_0x3136ae||0xc8;return function(_0x52a198){if(_0x52a198){return _0x5246c9['status'](_0x3136ae)[_0x7c97('0x1b')](_0x52a198);}};}function respondWithFilteredResult(_0x2775ba,_0x3261fe){return function(_0x65f4f8){if(_0x65f4f8){var _0x4bf7bc=typeof _0x3261fe[_0x7c97('0x1c')]===_0x7c97('0x1d')&&typeof _0x3261fe['limit']===_0x7c97('0x1d');var _0x45ae9b=_0x65f4f8['count'];var _0x114629=_0x4bf7bc?0x0:_0x3261fe[_0x7c97('0x1c')];var _0x1316fb=_0x4bf7bc?_0x65f4f8['count']:_0x3261fe[_0x7c97('0x1c')]+_0x3261fe[_0x7c97('0x1e')];var _0xe748f1;if(_0x1316fb>=_0x45ae9b){_0x1316fb=_0x45ae9b;_0xe748f1=0xc8;}else{_0xe748f1=0xce;}_0x2775ba[_0x7c97('0x1a')](_0xe748f1);return _0x2775ba[_0x7c97('0x1f')]('Content-Range',_0x114629+'-'+_0x1316fb+'/'+_0x45ae9b)[_0x7c97('0x1b')](_0x65f4f8);}return null;};}function patchUpdates(_0x1423fe){return function(_0x535c15){try{jsonpatch[_0x7c97('0x20')](_0x535c15,_0x1423fe,!![]);}catch(_0x4d7be0){return BPromise[_0x7c97('0x21')](_0x4d7be0);}return _0x535c15[_0x7c97('0x22')]();};}function saveUpdates(_0x3c017d,_0x2e10ed){return function(_0x5c041e){if(_0x5c041e){return _0x5c041e['update'](_0x3c017d)['then'](function(_0x3f4dda){return _0x3f4dda;});}return null;};}function removeEntity(_0x1417e7,_0xee7e3){return function(_0x57fba7){if(_0x57fba7){return _0x57fba7[_0x7c97('0x23')]()[_0x7c97('0x24')](function(){var _0x1113f4=_0x57fba7[_0x7c97('0x25')]({'plain':!![]});var _0x20ad5e='Intervals';return db[_0x7c97('0x26')]['destroy']({'where':{'type':_0x20ad5e,'resourceId':_0x1113f4['id']}})[_0x7c97('0x24')](function(){return _0x57fba7;});})[_0x7c97('0x24')](function(){_0x1417e7['status'](0xcc)[_0x7c97('0x27')]();});}};}function handleEntityNotFound(_0x1807d4,_0x494bf2){return function(_0x2fb457){if(!_0x2fb457){_0x1807d4[_0x7c97('0x19')](0x194);}return _0x2fb457;};}function handleError(_0xb57474,_0x44a9c2){_0x44a9c2=_0x44a9c2||0x1f4;return function(_0x2b1e56){logger[_0x7c97('0x28')](_0x2b1e56['stack']);if(_0x2b1e56[_0x7c97('0x29')]){delete _0x2b1e56[_0x7c97('0x29')];}_0xb57474[_0x7c97('0x1a')](_0x44a9c2)[_0x7c97('0x2a')](_0x2b1e56);};}exports['index']=function(_0x3a28d1,_0x345a8c){var _0x4e2eaf={},_0x234611={},_0x3ab687={'count':0x0,'rows':[]};var _0x4932b9=_['map'](db[_0x7c97('0x2b')][_0x7c97('0x2c')],function(_0x58fd11){return{'name':_0x58fd11['fieldName'],'type':_0x58fd11['type']['key']};});_0x234611[_0x7c97('0x2d')]=_['map'](_0x4932b9,_0x7c97('0x29'));_0x234611[_0x7c97('0x2e')]=_['keys'](_0x3a28d1[_0x7c97('0x2e')]);_0x234611[_0x7c97('0x2f')]=_[_0x7c97('0x30')](_0x234611['model'],_0x234611[_0x7c97('0x2e')]);_0x4e2eaf[_0x7c97('0x31')]=_[_0x7c97('0x30')](_0x234611[_0x7c97('0x2d')],qs[_0x7c97('0x32')](_0x3a28d1[_0x7c97('0x2e')][_0x7c97('0x32')]));_0x4e2eaf[_0x7c97('0x31')]=_0x4e2eaf['attributes'][_0x7c97('0x33')]?_0x4e2eaf[_0x7c97('0x31')]:_0x234611[_0x7c97('0x2d')];if(!_0x3a28d1[_0x7c97('0x2e')][_0x7c97('0x34')](_0x7c97('0x35'))){_0x4e2eaf[_0x7c97('0x1e')]=qs[_0x7c97('0x1e')](_0x3a28d1['query'][_0x7c97('0x1e')]);_0x4e2eaf[_0x7c97('0x1c')]=qs[_0x7c97('0x1c')](_0x3a28d1[_0x7c97('0x2e')]['offset']);}_0x4e2eaf[_0x7c97('0x36')]=qs[_0x7c97('0x37')](_0x3a28d1['query'][_0x7c97('0x37')]);_0x4e2eaf[_0x7c97('0x38')]=qs['filters'](_[_0x7c97('0x39')](_0x3a28d1[_0x7c97('0x2e')],_0x234611[_0x7c97('0x2f')]),_0x4932b9);if(_0x3a28d1[_0x7c97('0x2e')]['filter']){_0x4e2eaf['where']=_['merge'](_0x4e2eaf['where'],{'$or':_[_0x7c97('0x3a')](_0x4932b9,function(_0x29f324){if(_0x29f324[_0x7c97('0x3b')]!==_0x7c97('0x3c')){var _0x57d68b={};_0x57d68b[_0x29f324[_0x7c97('0x29')]]={'$like':'%'+_0x3a28d1[_0x7c97('0x2e')][_0x7c97('0x3d')]+'%'};return _0x57d68b;}})});}_0x4e2eaf=_[_0x7c97('0x3e')]({},_0x4e2eaf,_0x3a28d1[_0x7c97('0x3f')]);var _0x19dd16={'where':_0x4e2eaf[_0x7c97('0x38')]};return db[_0x7c97('0x2b')][_0x7c97('0x40')](_0x19dd16)[_0x7c97('0x24')](function(_0x5f2788){_0x3ab687['count']=_0x5f2788;if(_0x3a28d1[_0x7c97('0x2e')]['includeAll']){_0x4e2eaf[_0x7c97('0x41')]=[{'all':!![]}];}return db[_0x7c97('0x2b')][_0x7c97('0x42')](_0x4e2eaf);})[_0x7c97('0x24')](function(_0x13e2d6){_0x3ab687['rows']=_0x13e2d6;return _0x3ab687;})[_0x7c97('0x24')](respondWithFilteredResult(_0x345a8c,_0x4e2eaf))['catch'](handleError(_0x345a8c,null));};exports[_0x7c97('0x43')]=function(_0x520751,_0x5eff92){var _0x43f360={'raw':!![],'where':{'id':_0x520751['params']['id']}},_0x1db638={};_0x1db638[_0x7c97('0x2d')]=_['keys'](db['Interval'][_0x7c97('0x2c')]);_0x1db638[_0x7c97('0x2e')]=_[_0x7c97('0x44')](_0x520751[_0x7c97('0x2e')]);_0x1db638['filters']=_[_0x7c97('0x30')](_0x1db638['model'],_0x1db638[_0x7c97('0x2e')]);_0x43f360['attributes']=_[_0x7c97('0x30')](_0x1db638[_0x7c97('0x2d')],qs['fields'](_0x520751[_0x7c97('0x2e')][_0x7c97('0x32')]));_0x43f360[_0x7c97('0x31')]=_0x43f360[_0x7c97('0x31')][_0x7c97('0x33')]?_0x43f360[_0x7c97('0x31')]:_0x1db638[_0x7c97('0x2d')];if(_0x520751['query'][_0x7c97('0x45')]){_0x43f360[_0x7c97('0x41')]=[{'all':!![]}];}_0x43f360=_[_0x7c97('0x3e')]({},_0x43f360,_0x520751[_0x7c97('0x3f')]);return db['Interval']['find'](_0x43f360)[_0x7c97('0x24')](handleEntityNotFound(_0x5eff92,null))[_0x7c97('0x24')](respondWithResult(_0x5eff92,null))[_0x7c97('0x46')](handleError(_0x5eff92,null));};exports[_0x7c97('0x47')]=function(_0x3be77e,_0x4a1281){return db['Interval'][_0x7c97('0x47')](_0x3be77e[_0x7c97('0x48')],{})[_0x7c97('0x24')](function(_0x2fdf38){var _0x10d969=_0x3be77e[_0x7c97('0x49')][_0x7c97('0x25')]({'plain':!![]});if(!_0x10d969)throw new Error(_0x7c97('0x4a'));if(_0x10d969['role']===_0x7c97('0x49')){var _0x57cb8e=_0x2fdf38[_0x7c97('0x25')]({'plain':!![]});var _0x5562ea=_0x7c97('0x4b');return db['UserProfileSection'][_0x7c97('0x4c')]({'where':{'name':_0x5562ea,'userProfileId':_0x10d969[_0x7c97('0x4d')]},'raw':!![]})[_0x7c97('0x24')](function(_0x4fcc6a){if(_0x4fcc6a&&_0x4fcc6a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x57cb8e['name'],'resourceId':_0x57cb8e['id'],'type':_0x4fcc6a[_0x7c97('0x29')],'sectionId':_0x4fcc6a['id']},{})[_0x7c97('0x24')](function(){return _0x2fdf38;});}else{return _0x2fdf38;}})['catch'](function(_0x2238f3){logger[_0x7c97('0x28')](_0x7c97('0x4e'),_0x2238f3);throw _0x2238f3;});}return _0x2fdf38;})[_0x7c97('0x24')](respondWithResult(_0x4a1281,0xc9))[_0x7c97('0x46')](handleError(_0x4a1281,null));};exports[_0x7c97('0x4f')]=function(_0x4fb094,_0x198a46){if(_0x4fb094['body']['id']){delete _0x4fb094[_0x7c97('0x48')]['id'];}return db[_0x7c97('0x2b')][_0x7c97('0x4c')]({'where':{'id':_0x4fb094[_0x7c97('0x50')]['id']}})[_0x7c97('0x24')](handleEntityNotFound(_0x198a46,null))[_0x7c97('0x24')](saveUpdates(_0x4fb094['body'],null))['then'](respondWithResult(_0x198a46,null))[_0x7c97('0x46')](handleError(_0x198a46,null));};exports[_0x7c97('0x23')]=function(_0x1bb7de,_0x4e3dd2){return db[_0x7c97('0x2b')][_0x7c97('0x4c')]({'where':{'id':_0x1bb7de[_0x7c97('0x50')]['id']}})[_0x7c97('0x24')](handleEntityNotFound(_0x4e3dd2,null))[_0x7c97('0x24')](removeEntity(_0x4e3dd2,null))[_0x7c97('0x46')](handleError(_0x4e3dd2,null));};exports[_0x7c97('0x51')]=function(_0x5a9653,_0x418cf4,_0x1884ac){if(_0x5a9653['body']['id']){delete _0x5a9653[_0x7c97('0x48')]['id'];}return db[_0x7c97('0x2b')][_0x7c97('0x4c')]({'where':{'id':_0x5a9653[_0x7c97('0x50')]['id']}})[_0x7c97('0x24')](handleEntityNotFound(_0x418cf4,null))[_0x7c97('0x24')](function(_0x2f5585){if(_0x2f5585){_0x5a9653[_0x7c97('0x48')][_0x7c97('0x52')]=_0x2f5585['id'];return db[_0x7c97('0x2b')][_0x7c97('0x47')](_0x5a9653[_0x7c97('0x48')]);}})[_0x7c97('0x24')](respondWithResult(_0x418cf4,null))[_0x7c97('0x46')](handleError(_0x418cf4,null));};exports[_0x7c97('0x53')]=function(_0x5ac8b8,_0x1cdd55,_0x17bcb2){var _0x338fcc={};var _0x29fe9f={};var _0x553560;var _0x189dbf;return db[_0x7c97('0x2b')][_0x7c97('0x54')]({'where':{'id':_0x5ac8b8[_0x7c97('0x50')]['id']}})[_0x7c97('0x24')](handleEntityNotFound(_0x1cdd55,null))[_0x7c97('0x24')](function(_0x4a80d7){if(_0x4a80d7){_0x553560=_0x4a80d7;_0x29fe9f[_0x7c97('0x2d')]=_[_0x7c97('0x44')](db['Interval'][_0x7c97('0x2c')]);_0x29fe9f['query']=_[_0x7c97('0x44')](_0x5ac8b8['query']);_0x29fe9f['filters']=_['intersection'](_0x29fe9f[_0x7c97('0x2d')],_0x29fe9f['query']);_0x338fcc[_0x7c97('0x31')]=_[_0x7c97('0x30')](_0x29fe9f['model'],qs[_0x7c97('0x32')](_0x5ac8b8[_0x7c97('0x2e')][_0x7c97('0x32')]));_0x338fcc['attributes']=_0x338fcc['attributes'][_0x7c97('0x33')]?_0x338fcc[_0x7c97('0x31')]:_0x29fe9f[_0x7c97('0x2d')];_0x338fcc[_0x7c97('0x36')]=qs[_0x7c97('0x37')](_0x5ac8b8['query'][_0x7c97('0x37')]);_0x338fcc[_0x7c97('0x38')]=qs[_0x7c97('0x2f')](_[_0x7c97('0x39')](_0x5ac8b8['query'],_0x29fe9f[_0x7c97('0x2f')]));if(_0x5ac8b8[_0x7c97('0x2e')]['filter']){_0x338fcc[_0x7c97('0x38')]=_[_0x7c97('0x3e')](_0x338fcc[_0x7c97('0x38')],{'$or':_[_0x7c97('0x3a')](_0x338fcc[_0x7c97('0x31')],function(_0x34d6f9){var _0x44ec82={};_0x44ec82[_0x34d6f9]={'$like':'%'+_0x5ac8b8[_0x7c97('0x2e')]['filter']+'%'};return _0x44ec82;})});}_0x338fcc=_[_0x7c97('0x3e')]({},_0x338fcc,_0x5ac8b8[_0x7c97('0x3f')]);return _0x553560[_0x7c97('0x53')](_0x338fcc);}})[_0x7c97('0x24')](function(_0x4bc6e6){if(_0x4bc6e6){_0x189dbf=_0x4bc6e6[_0x7c97('0x33')];if(!_0x5ac8b8[_0x7c97('0x2e')][_0x7c97('0x34')](_0x7c97('0x35'))){_0x338fcc[_0x7c97('0x1e')]=qs[_0x7c97('0x1e')](_0x5ac8b8[_0x7c97('0x2e')]['limit']);_0x338fcc['offset']=qs[_0x7c97('0x1c')](_0x5ac8b8[_0x7c97('0x2e')][_0x7c97('0x1c')]);}return _0x553560[_0x7c97('0x53')](_0x338fcc);}})[_0x7c97('0x24')](function(_0x6d745b){if(_0x6d745b){return _0x6d745b?{'count':_0x189dbf,'rows':_0x6d745b}:null;}})[_0x7c97('0x24')](respondWithResult(_0x1cdd55,null))[_0x7c97('0x46')](handleError(_0x1cdd55,null));};exports[_0x7c97('0x55')]=function(_0x2fff96,_0x4e9534,_0x5c8ea8){return db[_0x7c97('0x2b')]['findOne']({'where':{'id':_0x2fff96[_0x7c97('0x50')]['id']}})[_0x7c97('0x24')](handleEntityNotFound(_0x4e9534,null))[_0x7c97('0x24')](function(_0x57140b){if(_0x57140b){return db[_0x7c97('0x56')]['transaction'](function(_0x385ab4){return db[_0x7c97('0x2b')][_0x7c97('0x23')]({'where':{'IntervalId':_0x2fff96['params']['id']},'transaction':_0x385ab4})['then'](function(_0x4b0f4b){var _0x28dc71=_[_0x7c97('0x3a')](_0x2fff96[_0x7c97('0x48')],function(_0x1ad8fe){delete _0x1ad8fe['id'];_0x1ad8fe[_0x7c97('0x52')]=_0x2fff96[_0x7c97('0x50')]['id'];return _0x1ad8fe;});return db[_0x7c97('0x2b')][_0x7c97('0x57')](_0x28dc71,{'transaction':_0x385ab4});});})[_0x7c97('0x24')](function(){return db[_0x7c97('0x2b')]['findAll']({'where':{'IntervalId':_0x2fff96[_0x7c97('0x50')]['id']}});});}})['then'](respondWithResult(_0x4e9534,null))[_0x7c97('0x46')](handleError(_0x4e9534,null));}; \ No newline at end of file +var _0xaaf6=['where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','IntervalId','getIntervals','hasOwnProperty','addIntervals','findOne','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Intervals','destroy','error','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','merge'];(function(_0xa9abef,_0x401168){var _0xe29666=function(_0x487c47){while(--_0x487c47){_0xa9abef['push'](_0xa9abef['shift']());}};_0xe29666(++_0x401168);}(_0xaaf6,0x182));var _0x6aaf=function(_0x3f96f0,_0xa755cc){_0x3f96f0=_0x3f96f0-0x0;var _0x338019=_0xaaf6[_0x3f96f0];return _0x338019;};'use strict';var emlformat=require(_0x6aaf('0x0'));var rimraf=require(_0x6aaf('0x1'));var zipdir=require(_0x6aaf('0x2'));var jsonpatch=require(_0x6aaf('0x3'));var rp=require(_0x6aaf('0x4'));var moment=require('moment');var BPromise=require(_0x6aaf('0x5'));var Mustache=require(_0x6aaf('0x6'));var util=require(_0x6aaf('0x7'));var path=require(_0x6aaf('0x8'));var sox=require(_0x6aaf('0x9'));var csv=require('to-csv');var ejs=require(_0x6aaf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6aaf('0xb'));var crypto=require(_0x6aaf('0xc'));var jsforce=require(_0x6aaf('0xd'));var deskjs=require(_0x6aaf('0xe'));var toCsv=require(_0x6aaf('0xf'));var querystring=require(_0x6aaf('0x10'));var Papa=require(_0x6aaf('0x11'));var Redis=require(_0x6aaf('0x12'));var authService=require(_0x6aaf('0x13'));var qs=require(_0x6aaf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6aaf('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6aaf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6aaf('0x17'))['db'];var extensions=require(_0x6aaf('0x18'));function respondWithStatusCode(_0x5eca7b,_0x4d00bb){_0x4d00bb=_0x4d00bb||0xcc;return function(_0x4fcab5){if(_0x4fcab5){return _0x5eca7b[_0x6aaf('0x19')](_0x4d00bb);}return _0x5eca7b[_0x6aaf('0x1a')](_0x4d00bb)[_0x6aaf('0x1b')]();};}function respondWithResult(_0xcf920f,_0x42bca8){_0x42bca8=_0x42bca8||0xc8;return function(_0x317931){if(_0x317931){return _0xcf920f[_0x6aaf('0x1a')](_0x42bca8)[_0x6aaf('0x1c')](_0x317931);}};}function respondWithFilteredResult(_0x2d08a5,_0x427a39){return function(_0x4d92a7){if(_0x4d92a7){var _0x633be8=typeof _0x427a39[_0x6aaf('0x1d')]===_0x6aaf('0x1e')&&typeof _0x427a39[_0x6aaf('0x1f')]===_0x6aaf('0x1e');var _0x3971a3=_0x4d92a7['count'];var _0x2b9f38=_0x633be8?0x0:_0x427a39[_0x6aaf('0x1d')];var _0x3079c6=_0x633be8?_0x4d92a7[_0x6aaf('0x20')]:_0x427a39[_0x6aaf('0x1d')]+_0x427a39[_0x6aaf('0x1f')];var _0x3eaaab;if(_0x3079c6>=_0x3971a3){_0x3079c6=_0x3971a3;_0x3eaaab=0xc8;}else{_0x3eaaab=0xce;}_0x2d08a5['status'](_0x3eaaab);return _0x2d08a5[_0x6aaf('0x21')](_0x6aaf('0x22'),_0x2b9f38+'-'+_0x3079c6+'/'+_0x3971a3)['json'](_0x4d92a7);}return null;};}function patchUpdates(_0x5bd31b){return function(_0x2d9f11){try{jsonpatch[_0x6aaf('0x23')](_0x2d9f11,_0x5bd31b,!![]);}catch(_0x7c6030){return BPromise['reject'](_0x7c6030);}return _0x2d9f11['save']();};}function saveUpdates(_0xd4290d,_0x57d24a){return function(_0x5b58e4){if(_0x5b58e4){return _0x5b58e4['update'](_0xd4290d)[_0x6aaf('0x24')](function(_0x147dbd){return _0x147dbd;});}return null;};}function removeEntity(_0x529d60,_0x5ca30f){return function(_0x179710){if(_0x179710){return _0x179710['destroy']()[_0x6aaf('0x24')](function(){var _0x1dcd0a=_0x179710[_0x6aaf('0x25')]({'plain':!![]});var _0x5cc070=_0x6aaf('0x26');return db['UserProfileResource'][_0x6aaf('0x27')]({'where':{'type':_0x5cc070,'resourceId':_0x1dcd0a['id']}})['then'](function(){return _0x179710;});})['then'](function(){_0x529d60[_0x6aaf('0x1a')](0xcc)[_0x6aaf('0x1b')]();});}};}function handleEntityNotFound(_0x1d1313,_0x52ea63){return function(_0x27322b){if(!_0x27322b){_0x1d1313['sendStatus'](0x194);}return _0x27322b;};}function handleError(_0x3bf1f6,_0x49747f){_0x49747f=_0x49747f||0x1f4;return function(_0x5e7d87){logger[_0x6aaf('0x28')](_0x5e7d87[_0x6aaf('0x29')]);if(_0x5e7d87['name']){delete _0x5e7d87[_0x6aaf('0x2a')];}_0x3bf1f6['status'](_0x49747f)[_0x6aaf('0x2b')](_0x5e7d87);};}exports[_0x6aaf('0x2c')]=function(_0x335f3a,_0x1eb156){var _0x20473b={},_0x5a4793={},_0x7237e5={'count':0x0,'rows':[]};var _0x8f92c2=_[_0x6aaf('0x2d')](db[_0x6aaf('0x2e')][_0x6aaf('0x2f')],function(_0x290efa){return{'name':_0x290efa['fieldName'],'type':_0x290efa[_0x6aaf('0x30')][_0x6aaf('0x31')]};});_0x5a4793[_0x6aaf('0x32')]=_[_0x6aaf('0x2d')](_0x8f92c2,_0x6aaf('0x2a'));_0x5a4793[_0x6aaf('0x33')]=_[_0x6aaf('0x34')](_0x335f3a[_0x6aaf('0x33')]);_0x5a4793['filters']=_['intersection'](_0x5a4793['model'],_0x5a4793[_0x6aaf('0x33')]);_0x20473b['attributes']=_[_0x6aaf('0x35')](_0x5a4793[_0x6aaf('0x32')],qs[_0x6aaf('0x36')](_0x335f3a[_0x6aaf('0x33')][_0x6aaf('0x36')]));_0x20473b[_0x6aaf('0x37')]=_0x20473b['attributes'][_0x6aaf('0x38')]?_0x20473b[_0x6aaf('0x37')]:_0x5a4793['model'];if(!_0x335f3a[_0x6aaf('0x33')]['hasOwnProperty'](_0x6aaf('0x39'))){_0x20473b[_0x6aaf('0x1f')]=qs[_0x6aaf('0x1f')](_0x335f3a[_0x6aaf('0x33')]['limit']);_0x20473b[_0x6aaf('0x1d')]=qs['offset'](_0x335f3a['query']['offset']);}_0x20473b[_0x6aaf('0x3a')]=qs[_0x6aaf('0x3b')](_0x335f3a[_0x6aaf('0x33')][_0x6aaf('0x3b')]);_0x20473b['where']=qs[_0x6aaf('0x3c')](_[_0x6aaf('0x3d')](_0x335f3a[_0x6aaf('0x33')],_0x5a4793['filters']),_0x8f92c2);if(_0x335f3a[_0x6aaf('0x33')][_0x6aaf('0x3e')]){_0x20473b['where']=_[_0x6aaf('0x3f')](_0x20473b[_0x6aaf('0x40')],{'$or':_['map'](_0x8f92c2,function(_0xbc8417){if(_0xbc8417['type']!==_0x6aaf('0x41')){var _0x1c5327={};_0x1c5327[_0xbc8417[_0x6aaf('0x2a')]]={'$like':'%'+_0x335f3a[_0x6aaf('0x33')][_0x6aaf('0x3e')]+'%'};return _0x1c5327;}})});}_0x20473b=_[_0x6aaf('0x3f')]({},_0x20473b,_0x335f3a[_0x6aaf('0x42')]);var _0x16bfb2={'where':_0x20473b[_0x6aaf('0x40')]};return db[_0x6aaf('0x2e')][_0x6aaf('0x20')](_0x16bfb2)[_0x6aaf('0x24')](function(_0x59a1b5){_0x7237e5['count']=_0x59a1b5;if(_0x335f3a[_0x6aaf('0x33')][_0x6aaf('0x43')]){_0x20473b[_0x6aaf('0x44')]=[{'all':!![]}];}return db[_0x6aaf('0x2e')][_0x6aaf('0x45')](_0x20473b);})['then'](function(_0x5cd3ff){_0x7237e5[_0x6aaf('0x46')]=_0x5cd3ff;return _0x7237e5;})[_0x6aaf('0x24')](respondWithFilteredResult(_0x1eb156,_0x20473b))[_0x6aaf('0x47')](handleError(_0x1eb156,null));};exports[_0x6aaf('0x48')]=function(_0x232d5e,_0x2bb3a8){var _0x565f38={'raw':!![],'where':{'id':_0x232d5e[_0x6aaf('0x49')]['id']}},_0x581ed8={};_0x581ed8['model']=_['keys'](db['Interval'][_0x6aaf('0x2f')]);_0x581ed8[_0x6aaf('0x33')]=_[_0x6aaf('0x34')](_0x232d5e[_0x6aaf('0x33')]);_0x581ed8[_0x6aaf('0x3c')]=_[_0x6aaf('0x35')](_0x581ed8['model'],_0x581ed8[_0x6aaf('0x33')]);_0x565f38[_0x6aaf('0x37')]=_['intersection'](_0x581ed8[_0x6aaf('0x32')],qs[_0x6aaf('0x36')](_0x232d5e[_0x6aaf('0x33')][_0x6aaf('0x36')]));_0x565f38[_0x6aaf('0x37')]=_0x565f38[_0x6aaf('0x37')][_0x6aaf('0x38')]?_0x565f38[_0x6aaf('0x37')]:_0x581ed8[_0x6aaf('0x32')];if(_0x232d5e['query'][_0x6aaf('0x43')]){_0x565f38[_0x6aaf('0x44')]=[{'all':!![]}];}_0x565f38=_['merge']({},_0x565f38,_0x232d5e['options']);return db[_0x6aaf('0x2e')][_0x6aaf('0x4a')](_0x565f38)[_0x6aaf('0x24')](handleEntityNotFound(_0x2bb3a8,null))['then'](respondWithResult(_0x2bb3a8,null))[_0x6aaf('0x47')](handleError(_0x2bb3a8,null));};exports['create']=function(_0x1aeb53,_0x39b4a2){return db[_0x6aaf('0x2e')][_0x6aaf('0x4b')](_0x1aeb53[_0x6aaf('0x4c')],{})['then'](function(_0x53146d){var _0x576c53=_0x1aeb53[_0x6aaf('0x4d')]['get']({'plain':!![]});if(!_0x576c53)throw new Error(_0x6aaf('0x4e'));if(_0x576c53['role']==='user'){var _0x4e446d=_0x53146d[_0x6aaf('0x25')]({'plain':!![]});var _0x221a5c=_0x6aaf('0x26');return db[_0x6aaf('0x4f')][_0x6aaf('0x4a')]({'where':{'name':_0x221a5c,'userProfileId':_0x576c53['userProfileId']},'raw':!![]})['then'](function(_0x599001){if(_0x599001&&_0x599001[_0x6aaf('0x50')]===0x0){return db[_0x6aaf('0x51')][_0x6aaf('0x4b')]({'name':_0x4e446d['name'],'resourceId':_0x4e446d['id'],'type':_0x599001[_0x6aaf('0x2a')],'sectionId':_0x599001['id']},{})[_0x6aaf('0x24')](function(){return _0x53146d;});}else{return _0x53146d;}})[_0x6aaf('0x47')](function(_0x3a2e61){logger[_0x6aaf('0x28')](_0x6aaf('0x52'),_0x3a2e61);throw _0x3a2e61;});}return _0x53146d;})[_0x6aaf('0x24')](respondWithResult(_0x39b4a2,0xc9))[_0x6aaf('0x47')](handleError(_0x39b4a2,null));};exports[_0x6aaf('0x53')]=function(_0x254745,_0x1b5e91){if(_0x254745[_0x6aaf('0x4c')]['id']){delete _0x254745[_0x6aaf('0x4c')]['id'];}return db[_0x6aaf('0x2e')][_0x6aaf('0x4a')]({'where':{'id':_0x254745[_0x6aaf('0x49')]['id']}})[_0x6aaf('0x24')](handleEntityNotFound(_0x1b5e91,null))[_0x6aaf('0x24')](saveUpdates(_0x254745['body'],null))[_0x6aaf('0x24')](respondWithResult(_0x1b5e91,null))[_0x6aaf('0x47')](handleError(_0x1b5e91,null));};exports[_0x6aaf('0x27')]=function(_0x4f1519,_0x3ff84d){return db['Interval'][_0x6aaf('0x4a')]({'where':{'id':_0x4f1519[_0x6aaf('0x49')]['id']}})[_0x6aaf('0x24')](handleEntityNotFound(_0x3ff84d,null))['then'](removeEntity(_0x3ff84d,null))[_0x6aaf('0x47')](handleError(_0x3ff84d,null));};exports['addInterval']=function(_0x720829,_0x54f400,_0xad5f75){if(_0x720829[_0x6aaf('0x4c')]['id']){delete _0x720829[_0x6aaf('0x4c')]['id'];}return db[_0x6aaf('0x2e')][_0x6aaf('0x4a')]({'where':{'id':_0x720829[_0x6aaf('0x49')]['id']}})[_0x6aaf('0x24')](handleEntityNotFound(_0x54f400,null))[_0x6aaf('0x24')](function(_0x4e9a55){if(_0x4e9a55){_0x720829['body'][_0x6aaf('0x54')]=_0x4e9a55['id'];return db['Interval'][_0x6aaf('0x4b')](_0x720829[_0x6aaf('0x4c')]);}})[_0x6aaf('0x24')](respondWithResult(_0x54f400,null))[_0x6aaf('0x47')](handleError(_0x54f400,null));};exports[_0x6aaf('0x55')]=function(_0x203e92,_0x5aa6ab,_0x436524){var _0x3b1a59={};var _0x5d1434={};var _0x48e357;var _0x4b7fc1;return db['Interval']['findOne']({'where':{'id':_0x203e92[_0x6aaf('0x49')]['id']}})['then'](handleEntityNotFound(_0x5aa6ab,null))[_0x6aaf('0x24')](function(_0xecdc7f){if(_0xecdc7f){_0x48e357=_0xecdc7f;_0x5d1434['model']=_[_0x6aaf('0x34')](db[_0x6aaf('0x2e')][_0x6aaf('0x2f')]);_0x5d1434[_0x6aaf('0x33')]=_[_0x6aaf('0x34')](_0x203e92[_0x6aaf('0x33')]);_0x5d1434[_0x6aaf('0x3c')]=_[_0x6aaf('0x35')](_0x5d1434[_0x6aaf('0x32')],_0x5d1434[_0x6aaf('0x33')]);_0x3b1a59['attributes']=_[_0x6aaf('0x35')](_0x5d1434[_0x6aaf('0x32')],qs[_0x6aaf('0x36')](_0x203e92[_0x6aaf('0x33')][_0x6aaf('0x36')]));_0x3b1a59[_0x6aaf('0x37')]=_0x3b1a59[_0x6aaf('0x37')][_0x6aaf('0x38')]?_0x3b1a59[_0x6aaf('0x37')]:_0x5d1434[_0x6aaf('0x32')];_0x3b1a59[_0x6aaf('0x3a')]=qs['sort'](_0x203e92['query'][_0x6aaf('0x3b')]);_0x3b1a59[_0x6aaf('0x40')]=qs[_0x6aaf('0x3c')](_['pick'](_0x203e92[_0x6aaf('0x33')],_0x5d1434[_0x6aaf('0x3c')]));if(_0x203e92['query'][_0x6aaf('0x3e')]){_0x3b1a59[_0x6aaf('0x40')]=_[_0x6aaf('0x3f')](_0x3b1a59[_0x6aaf('0x40')],{'$or':_['map'](_0x3b1a59[_0x6aaf('0x37')],function(_0x3ebcf2){var _0x2128e9={};_0x2128e9[_0x3ebcf2]={'$like':'%'+_0x203e92[_0x6aaf('0x33')][_0x6aaf('0x3e')]+'%'};return _0x2128e9;})});}_0x3b1a59=_['merge']({},_0x3b1a59,_0x203e92[_0x6aaf('0x42')]);return _0x48e357[_0x6aaf('0x55')](_0x3b1a59);}})[_0x6aaf('0x24')](function(_0x1c3481){if(_0x1c3481){_0x4b7fc1=_0x1c3481['length'];if(!_0x203e92[_0x6aaf('0x33')][_0x6aaf('0x56')](_0x6aaf('0x39'))){_0x3b1a59[_0x6aaf('0x1f')]=qs[_0x6aaf('0x1f')](_0x203e92['query'][_0x6aaf('0x1f')]);_0x3b1a59[_0x6aaf('0x1d')]=qs[_0x6aaf('0x1d')](_0x203e92[_0x6aaf('0x33')]['offset']);}return _0x48e357['getIntervals'](_0x3b1a59);}})['then'](function(_0x5b2faf){if(_0x5b2faf){return _0x5b2faf?{'count':_0x4b7fc1,'rows':_0x5b2faf}:null;}})['then'](respondWithResult(_0x5aa6ab,null))[_0x6aaf('0x47')](handleError(_0x5aa6ab,null));};exports[_0x6aaf('0x57')]=function(_0x36e3e9,_0x41e96f,_0x360f83){return db['Interval'][_0x6aaf('0x58')]({'where':{'id':_0x36e3e9['params']['id']}})['then'](handleEntityNotFound(_0x41e96f,null))['then'](function(_0x39edb1){if(_0x39edb1){return db['sequelize']['transaction'](function(_0x414fac){return db[_0x6aaf('0x2e')][_0x6aaf('0x27')]({'where':{'IntervalId':_0x36e3e9[_0x6aaf('0x49')]['id']},'transaction':_0x414fac})[_0x6aaf('0x24')](function(_0x5085de){var _0x3d8aa0=_['map'](_0x36e3e9[_0x6aaf('0x4c')],function(_0x56fbd3){delete _0x56fbd3['id'];_0x56fbd3[_0x6aaf('0x54')]=_0x36e3e9[_0x6aaf('0x49')]['id'];return _0x56fbd3;});return db[_0x6aaf('0x2e')][_0x6aaf('0x59')](_0x3d8aa0,{'transaction':_0x414fac});});})[_0x6aaf('0x24')](function(){return db[_0x6aaf('0x2e')]['findAll']({'where':{'IntervalId':_0x36e3e9[_0x6aaf('0x49')]['id']}});});}})[_0x6aaf('0x24')](respondWithResult(_0x41e96f,null))[_0x6aaf('0x47')](handleError(_0x41e96f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 13fbab6..6dd848e 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 _0x0a01=['Interval','tools_intervals','rewrite','api','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x0a01,0x10b));var _0x10a0=function(_0x2b2cf5,_0x2cf1be){_0x2b2cf5=_0x2b2cf5-0x0;var _0x1d8f4a=_0x0a01[_0x2b2cf5];return _0x1d8f4a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x10a0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x10a0('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10a0('0x2'));var config=require(_0x10a0('0x3'));var attributes=require(_0x10a0('0x4'));var extensions=require(_0x10a0('0x5'));module[_0x10a0('0x6')]=function(_0x1d82b6,_0x5441b7){return _0x1d82b6[_0x10a0('0x7')](_0x10a0('0x8'),attributes,{'tableName':_0x10a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xee5289,_0x46fc47){extensions[_0x10a0('0xa')](_0x1d82b6,_0xee5289);},'afterBulkCreate':function(_0x5cfb34,_0x24aede,_0x1b9311){_0x1b9311();extensions[_0x10a0('0xa')](_0x1d82b6,_0x5cfb34[0x0]);},'afterUpdate':function(_0x51ab67,_0x54fb52){extensions[_0x10a0('0xa')](_0x1d82b6,_0x51ab67);},'afterDestroy':function(_0x551b8c,_0x5b030c){extensions[_0x10a0('0xa')](_0x1d82b6,_0x551b8c);}}});}; \ No newline at end of file +var _0x9336=['api','moment','bluebird','request-promise','path','rimraf','./interval.attributes','Interval','tools_intervals','rewrite','lodash','../../config/logger'];(function(_0x3576a6,_0x57ab70){var _0x59241f=function(_0x35fce8){while(--_0x35fce8){_0x3576a6['push'](_0x3576a6['shift']());}};_0x59241f(++_0x57ab70);}(_0x9336,0x112));var _0x6933=function(_0x465ba3,_0x4f2716){_0x465ba3=_0x465ba3-0x0;var _0xdefa92=_0x9336[_0x465ba3];return _0xdefa92;};'use strict';var _=require(_0x6933('0x0'));var util=require('util');var logger=require(_0x6933('0x1'))(_0x6933('0x2'));var moment=require(_0x6933('0x3'));var BPromise=require(_0x6933('0x4'));var rp=require(_0x6933('0x5'));var fs=require('fs');var path=require(_0x6933('0x6'));var rimraf=require(_0x6933('0x7'));var config=require('../../config/environment');var attributes=require(_0x6933('0x8'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x385acb,_0x25403e){return _0x385acb['define'](_0x6933('0x9'),attributes,{'tableName':_0x6933('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xb7aff7,_0xff13c5){extensions[_0x6933('0xb')](_0x385acb,_0xb7aff7);},'afterBulkCreate':function(_0x1bf100,_0x37be45,_0x423504){_0x423504();extensions[_0x6933('0xb')](_0x385acb,_0x1bf100[0x0]);},'afterUpdate':function(_0x4d0cbd,_0x1cf330){extensions[_0x6933('0xb')](_0x385acb,_0x4d0cbd);},'afterDestroy':function(_0x492f41,_0x2b23c4){extensions[_0x6933('0xb')](_0x385acb,_0x492f41);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 97259c2..25d0d85 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(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 32065aa..dcce190 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(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 40d2e53..0ab1c57 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 _0x9dba=['Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','stringify','issuetype'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x9dba,0xb5));var _0xa9db=function(_0xf1507c,_0x23f2a9){_0xf1507c=_0xf1507c-0x0;var _0xc0c469=_0x9dba[_0xf1507c];return _0xc0c469;};'use strict';var BPromise=require(_0xa9db('0x0'));var https=require(_0xa9db('0x1'));var logger=require(_0xa9db('0x2'))('api');var USERNAME=_0xa9db('0x3');var PASSWORD=_0xa9db('0x4');function openIssue(_0x171d3d,_0x43187d){var _0x2acee3={'fields':{'project':{'key':_0x171d3d[_0xa9db('0x5')]||_0xa9db('0x6')},'summary':(_0x171d3d['summary']||_0xa9db('0x7'))+_0xa9db('0x8')+_0x171d3d['ip'],'description':_0x171d3d['description']||JSON[_0xa9db('0x9')](_0x171d3d),'issuetype':{'name':_0x171d3d[_0xa9db('0xa')]||_0xa9db('0xb')}}};_0x2acee3[_0xa9db('0xc')]['customfield_11500']=_0x171d3d[_0xa9db('0xd')];_0x2acee3['fields'][_0xa9db('0xe')]=_0x171d3d[_0xa9db('0xf')];_0x2acee3[_0xa9db('0xc')][_0xa9db('0x10')]=_0x171d3d[_0xa9db('0x11')];_0x2acee3[_0xa9db('0xc')][_0xa9db('0x12')]=_0x171d3d['name'];_0x2acee3[_0xa9db('0xc')][_0xa9db('0x13')]=_0x171d3d[_0xa9db('0x14')];_0x2acee3[_0xa9db('0xc')][_0xa9db('0x15')]=_0x171d3d['ip'];var _0x72eb0a={'host':_0xa9db('0x16'),'port':0x1bb,'path':_0xa9db('0x17'),'method':_0xa9db('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xa9db('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xa9db('0x1a')](_0xa9db('0x1b'))}};var _0x172525=JSON[_0xa9db('0x9')](_0x2acee3);var _0x23bf77=https[_0xa9db('0x1c')](_0x72eb0a,function(_0x2a3362){_0x2a3362[_0xa9db('0x1d')](_0xa9db('0x1e'));var _0x209f2b='';_0x2a3362['on'](_0xa9db('0x1f'),function(_0x52ec7d){_0x209f2b+=_0x52ec7d;});_0x2a3362['on'](_0xa9db('0x20'),function(){if(_0x43187d){return _0x43187d[_0xa9db('0x21')](_0x2a3362[_0xa9db('0x22')])['json'](JSON[_0xa9db('0x23')](_0x209f2b));}});});_0x23bf77['on'](_0xa9db('0x24'),function(_0x2154e0){if(_0x43187d){return _0x43187d[_0xa9db('0x21')](0x1f4)[_0xa9db('0x25')]({'errors':[{'message':_0xa9db('0x26'),'type':_0xa9db('0x27')}]});}});_0x23bf77[_0xa9db('0x28')](_0x172525);_0x23bf77[_0xa9db('0x20')]();}exports[_0xa9db('0x29')]=openIssue;exports['send']=function(_0x328dfd,_0x4012f1){_0x328dfd[_0xa9db('0x2a')]['ip']=_0x328dfd[_0xa9db('0x2b')][_0xa9db('0x2c')]||_0x328dfd[_0xa9db('0x2d')][_0xa9db('0x2e')]||_0x328dfd[_0xa9db('0x2f')]['remoteAddress']||_0x328dfd[_0xa9db('0x2d')][_0xa9db('0x2f')]['remoteAddress'];return openIssue(_0x328dfd[_0xa9db('0x2a')],_0x4012f1);}; \ No newline at end of file +var _0xa4d4=['../../config/logger','support','key','MOTGUI','summary','Report','description','stringify','issuetype','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','request','setEncoding','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird'];(function(_0x38f0ad,_0x4669fc){var _0x4257ff=function(_0xb1710b){while(--_0xb1710b){_0x38f0ad['push'](_0x38f0ad['shift']());}};_0x4257ff(++_0x4669fc);}(_0xa4d4,0x74));var _0x4a4d=function(_0x40f200,_0x16f8ec){_0x40f200=_0x40f200-0x0;var _0x53454c=_0xa4d4[_0x40f200];return _0x53454c;};'use strict';var BPromise=require(_0x4a4d('0x0'));var https=require('https');var logger=require(_0x4a4d('0x1'))('api');var USERNAME=_0x4a4d('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x3df859,_0xdbb026){var _0x54f542={'fields':{'project':{'key':_0x3df859[_0x4a4d('0x3')]||_0x4a4d('0x4')},'summary':(_0x3df859[_0x4a4d('0x5')]||_0x4a4d('0x6'))+'\x20from\x20'+_0x3df859['ip'],'description':_0x3df859[_0x4a4d('0x7')]||JSON[_0x4a4d('0x8')](_0x3df859),'issuetype':{'name':_0x3df859[_0x4a4d('0x9')]||'Bug'}}};_0x54f542[_0x4a4d('0xa')][_0x4a4d('0xb')]=_0x3df859['email'];_0x54f542[_0x4a4d('0xa')][_0x4a4d('0xc')]=_0x3df859[_0x4a4d('0xd')];_0x54f542[_0x4a4d('0xa')][_0x4a4d('0xe')]=_0x3df859[_0x4a4d('0xf')];_0x54f542[_0x4a4d('0xa')][_0x4a4d('0x10')]=_0x3df859['name'];_0x54f542[_0x4a4d('0xa')][_0x4a4d('0x11')]=_0x3df859['reason'];_0x54f542[_0x4a4d('0xa')]['customfield_10102']=_0x3df859['ip'];var _0x27bb46={'host':_0x4a4d('0x12'),'port':0x1bb,'path':_0x4a4d('0x13'),'method':_0x4a4d('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x4a4d('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x4a4d('0x16'))}};var _0x1cf8ff=JSON[_0x4a4d('0x8')](_0x54f542);var _0x23c24c=https[_0x4a4d('0x17')](_0x27bb46,function(_0x5442b3){_0x5442b3[_0x4a4d('0x18')]('utf8');var _0x44b657='';_0x5442b3['on'](_0x4a4d('0x19'),function(_0x25ef95){_0x44b657+=_0x25ef95;});_0x5442b3['on'](_0x4a4d('0x1a'),function(){if(_0xdbb026){return _0xdbb026[_0x4a4d('0x1b')](_0x5442b3[_0x4a4d('0x1c')])[_0x4a4d('0x1d')](JSON[_0x4a4d('0x1e')](_0x44b657));}});});_0x23c24c['on']('error',function(_0x27c210){if(_0xdbb026){return _0xdbb026[_0x4a4d('0x1b')](0x1f4)['json']({'errors':[{'message':_0x4a4d('0x1f'),'type':_0x4a4d('0x20')}]});}});_0x23c24c['write'](_0x1cf8ff);_0x23c24c[_0x4a4d('0x1a')]();}exports['openIssue']=openIssue;exports[_0x4a4d('0x21')]=function(_0x2f67b4,_0x5ddd81){_0x2f67b4[_0x4a4d('0x22')]['ip']=_0x2f67b4['headers'][_0x4a4d('0x23')]||_0x2f67b4[_0x4a4d('0x24')][_0x4a4d('0x25')]||_0x2f67b4[_0x4a4d('0x26')]['remoteAddress']||_0x2f67b4[_0x4a4d('0x24')][_0x4a4d('0x26')][_0x4a4d('0x25')];return openIssue(_0x2f67b4[_0x4a4d('0x22')],_0x5ddd81);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 57fea22..4c6a378 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 _0x702d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x702d,0x147));var _0xd702=function(_0x307a38,_0x2444c7){_0x307a38=_0x307a38-0x0;var _0x3a5e01=_0x702d[_0x307a38];return _0x3a5e01;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')]('/',auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0x13')]);router['delete']('/:id',auth[_0xd702('0xe')](),controller[_0xd702('0x14')]);module[_0xd702('0x15')]=router; \ No newline at end of file +var _0xec56=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x2a2d14,_0x316920){var _0x55e420=function(_0x35356c){while(--_0x35356c){_0x2a2d14['push'](_0x2a2d14['shift']());}};_0x55e420(++_0x316920);}(_0xec56,0x1bd));var _0x6ec5=function(_0x39dfff,_0x5de850){_0x39dfff=_0x39dfff-0x0;var _0x5c2575=_0xec56[_0x39dfff];return _0x5c2575;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['post']('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x10')]);router[_0x6ec5('0x11')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x12')]);router[_0x6ec5('0x13')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x14')]);module[_0x6ec5('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 42147b0..90a2fc7 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x1ec06e,_0x570949){_0x1ec06e=_0x1ec06e-0x0;var _0x1dc9be=_0x7a54[_0x1ec06e];return _0x1dc9be;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0xed477e,_0x571daf){_0xed477e=_0xed477e-0x0;var _0x4eedbc=_0x7a54[_0xed477e];return _0x4eedbc;};'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 7c7cf38..472552e 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 _0x2e88=['moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x38f7b7,_0xd361ff){var _0xf50805=function(_0x2a72e6){while(--_0x2a72e6){_0x38f7b7['push'](_0x38f7b7['shift']());}};_0xf50805(++_0xd361ff);}(_0x2e88,0x95));var _0x82e8=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x2e88[_0x1793de];return _0x4f0309;};'use strict';var emlformat=require(_0x82e8('0x0'));var rimraf=require(_0x82e8('0x1'));var zipdir=require(_0x82e8('0x2'));var jsonpatch=require(_0x82e8('0x3'));var rp=require(_0x82e8('0x4'));var moment=require(_0x82e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x82e8('0x6'));var util=require(_0x82e8('0x7'));var path=require('path');var sox=require(_0x82e8('0x8'));var csv=require(_0x82e8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82e8('0xa'));var _=require(_0x82e8('0xb'));var squel=require(_0x82e8('0xc'));var crypto=require(_0x82e8('0xd'));var jsforce=require(_0x82e8('0xe'));var deskjs=require(_0x82e8('0xf'));var toCsv=require(_0x82e8('0x9'));var querystring=require(_0x82e8('0x10'));var Papa=require(_0x82e8('0x11'));var Redis=require(_0x82e8('0x12'));var authService=require(_0x82e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x82e8('0x14'));var hardwareService=require(_0x82e8('0x15'));var logger=require(_0x82e8('0x16'))(_0x82e8('0x17'));var utils=require(_0x82e8('0x18'));var config=require(_0x82e8('0x19'));var licenseUtil=require(_0x82e8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253a36,_0xdf1b65){_0xdf1b65=_0xdf1b65||0xcc;return function(_0xb6d94a){if(_0xb6d94a){return _0x253a36[_0x82e8('0x1b')](_0xdf1b65);}return _0x253a36[_0x82e8('0x1c')](_0xdf1b65)['end']();};}function respondWithResult(_0x3353e0,_0x2c9569){_0x2c9569=_0x2c9569||0xc8;return function(_0xad6055){if(_0xad6055){return _0x3353e0[_0x82e8('0x1c')](_0x2c9569)['json'](_0xad6055);}};}function respondWithFilteredResult(_0x25b60e,_0x461744){return function(_0x3253d2){if(_0x3253d2){var _0xf53214=typeof _0x461744[_0x82e8('0x1d')]==='undefined'&&typeof _0x461744[_0x82e8('0x1e')]===_0x82e8('0x1f');var _0x574ba2=_0x3253d2[_0x82e8('0x20')];var _0xf287da=_0xf53214?0x0:_0x461744[_0x82e8('0x1d')];var _0x380f44=_0xf53214?_0x3253d2[_0x82e8('0x20')]:_0x461744[_0x82e8('0x1d')]+_0x461744[_0x82e8('0x1e')];var _0x5d7986;if(_0x380f44>=_0x574ba2){_0x380f44=_0x574ba2;_0x5d7986=0xc8;}else{_0x5d7986=0xce;}_0x25b60e[_0x82e8('0x1c')](_0x5d7986);return _0x25b60e[_0x82e8('0x21')](_0x82e8('0x22'),_0xf287da+'-'+_0x380f44+'/'+_0x574ba2)[_0x82e8('0x23')](_0x3253d2);}return null;};}function patchUpdates(_0xbfecf2){return function(_0x5db337){try{jsonpatch[_0x82e8('0x24')](_0x5db337,_0xbfecf2,!![]);}catch(_0x497c48){return BPromise[_0x82e8('0x25')](_0x497c48);}return _0x5db337[_0x82e8('0x26')]();};}function saveUpdates(_0x1475cf,_0x3ab5a2){return function(_0x198c3d){if(_0x198c3d){return _0x198c3d[_0x82e8('0x27')](_0x1475cf)[_0x82e8('0x28')](function(_0x591583){return _0x591583;});}return null;};}function removeEntity(_0x2b82eb,_0x57cc9c){return function(_0x4de0d2){if(_0x4de0d2){return _0x4de0d2['destroy']()[_0x82e8('0x28')](function(){_0x2b82eb['status'](0xcc)[_0x82e8('0x29')]();});}};}function handleEntityNotFound(_0x305710,_0xeff996){return function(_0x488b06){if(!_0x488b06){_0x305710[_0x82e8('0x1b')](0x194);}return _0x488b06;};}function handleError(_0x476602,_0x336015){_0x336015=_0x336015||0x1f4;return function(_0x2400c5){logger[_0x82e8('0x2a')](_0x2400c5['stack']);if(_0x2400c5['name']){delete _0x2400c5[_0x82e8('0x2b')];}_0x476602[_0x82e8('0x1c')](_0x336015)[_0x82e8('0x2c')](_0x2400c5);};}exports[_0x82e8('0x2d')]=function(_0x1c2160,_0x4756ac){var _0x14450e={},_0x1e9eee={},_0x1c2173={'count':0x0,'rows':[]};var _0xf52391=_[_0x82e8('0x2e')](db[_0x82e8('0x2f')][_0x82e8('0x30')],function(_0x4902af){return{'name':_0x4902af[_0x82e8('0x31')],'type':_0x4902af[_0x82e8('0x32')][_0x82e8('0x33')]};});_0x1e9eee[_0x82e8('0x34')]=_[_0x82e8('0x2e')](_0xf52391,_0x82e8('0x2b'));_0x1e9eee[_0x82e8('0x35')]=_[_0x82e8('0x36')](_0x1c2160[_0x82e8('0x35')]);_0x1e9eee[_0x82e8('0x37')]=_[_0x82e8('0x38')](_0x1e9eee['model'],_0x1e9eee[_0x82e8('0x35')]);_0x14450e[_0x82e8('0x39')]=_[_0x82e8('0x38')](_0x1e9eee[_0x82e8('0x34')],qs[_0x82e8('0x3a')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x3a')]));_0x14450e[_0x82e8('0x39')]=_0x14450e['attributes'][_0x82e8('0x3b')]?_0x14450e['attributes']:_0x1e9eee[_0x82e8('0x34')];if(!_0x1c2160[_0x82e8('0x35')]['hasOwnProperty']('nolimit')){_0x14450e[_0x82e8('0x1e')]=qs['limit'](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x1e')]);_0x14450e[_0x82e8('0x1d')]=qs[_0x82e8('0x1d')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x1d')]);}_0x14450e[_0x82e8('0x3c')]=qs[_0x82e8('0x3d')](_0x1c2160[_0x82e8('0x35')][_0x82e8('0x3d')]);_0x14450e[_0x82e8('0x3e')]=qs[_0x82e8('0x37')](_['pick'](_0x1c2160[_0x82e8('0x35')],_0x1e9eee[_0x82e8('0x37')]),_0xf52391);if(_0x1c2160[_0x82e8('0x35')]['filter']){_0x14450e[_0x82e8('0x3e')]=_[_0x82e8('0x3f')](_0x14450e[_0x82e8('0x3e')],{'$or':_[_0x82e8('0x2e')](_0xf52391,function(_0x28e1b2){if(_0x28e1b2[_0x82e8('0x32')]!==_0x82e8('0x40')){var _0x1eceef={};_0x1eceef[_0x28e1b2[_0x82e8('0x2b')]]={'$like':'%'+_0x1c2160[_0x82e8('0x35')][_0x82e8('0x41')]+'%'};return _0x1eceef;}})});}_0x14450e=_['merge']({},_0x14450e,_0x1c2160[_0x82e8('0x42')]);var _0x3f379d={'where':_0x14450e[_0x82e8('0x3e')]};return db[_0x82e8('0x2f')][_0x82e8('0x20')](_0x3f379d)[_0x82e8('0x28')](function(_0x26c6ad){_0x1c2173[_0x82e8('0x20')]=_0x26c6ad;if(_0x1c2160[_0x82e8('0x35')][_0x82e8('0x43')]){_0x14450e[_0x82e8('0x44')]=[{'all':!![]}];}return db[_0x82e8('0x2f')][_0x82e8('0x45')](_0x14450e);})[_0x82e8('0x28')](function(_0x3878af){_0x1c2173['rows']=_0x3878af;return _0x1c2173;})[_0x82e8('0x28')](respondWithFilteredResult(_0x4756ac,_0x14450e))['catch'](handleError(_0x4756ac,null));};exports[_0x82e8('0x46')]=function(_0x2da19b,_0x8428e1){var _0xc996f7={'raw':!![],'where':{'id':_0x2da19b[_0x82e8('0x47')]['id']}},_0x3ff396={};_0x3ff396['model']=_[_0x82e8('0x36')](db['JscriptyAnswerReport'][_0x82e8('0x30')]);_0x3ff396[_0x82e8('0x35')]=_[_0x82e8('0x36')](_0x2da19b[_0x82e8('0x35')]);_0x3ff396[_0x82e8('0x37')]=_['intersection'](_0x3ff396['model'],_0x3ff396[_0x82e8('0x35')]);_0xc996f7['attributes']=_[_0x82e8('0x38')](_0x3ff396['model'],qs['fields'](_0x2da19b['query']['fields']));_0xc996f7[_0x82e8('0x39')]=_0xc996f7[_0x82e8('0x39')]['length']?_0xc996f7[_0x82e8('0x39')]:_0x3ff396[_0x82e8('0x34')];if(_0x2da19b['query'][_0x82e8('0x43')]){_0xc996f7['include']=[{'all':!![]}];}_0xc996f7=_[_0x82e8('0x3f')]({},_0xc996f7,_0x2da19b[_0x82e8('0x42')]);return db[_0x82e8('0x2f')][_0x82e8('0x48')](_0xc996f7)[_0x82e8('0x28')](handleEntityNotFound(_0x8428e1,null))[_0x82e8('0x28')](respondWithResult(_0x8428e1,null))['catch'](handleError(_0x8428e1,null));};exports[_0x82e8('0x49')]=function(_0x40fcae,_0x33c605){return db[_0x82e8('0x2f')]['create'](_0x40fcae[_0x82e8('0x4a')],{})['then'](respondWithResult(_0x33c605,0xc9))[_0x82e8('0x4b')](handleError(_0x33c605,null));};exports['update']=function(_0x25c206,_0xd3290c){if(_0x25c206[_0x82e8('0x4a')]['id']){delete _0x25c206['body']['id'];}return db[_0x82e8('0x2f')]['find']({'where':{'id':_0x25c206['params']['id']}})[_0x82e8('0x28')](handleEntityNotFound(_0xd3290c,null))[_0x82e8('0x28')](saveUpdates(_0x25c206[_0x82e8('0x4a')],null))['then'](respondWithResult(_0xd3290c,null))[_0x82e8('0x4b')](handleError(_0xd3290c,null));};exports['destroy']=function(_0x5735a2,_0x51710a){return db['JscriptyAnswerReport'][_0x82e8('0x48')]({'where':{'id':_0x5735a2[_0x82e8('0x47')]['id']}})[_0x82e8('0x28')](handleEntityNotFound(_0x51710a,null))[_0x82e8('0x28')](removeEntity(_0x51710a,null))['catch'](handleError(_0x51710a,null));};exports[_0x82e8('0x4c')]=function(_0x7b1c26,_0x17f348){return db[_0x82e8('0x2f')][_0x82e8('0x4c')]()[_0x82e8('0x28')](respondWithResult(_0x17f348,null))['catch'](handleError(_0x17f348,null));}; \ No newline at end of file +var _0x8375=['rawAttributes','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x1d0fc2,_0x29face){var _0x9dea77=function(_0xc998a5){while(--_0xc998a5){_0x1d0fc2['push'](_0x1d0fc2['shift']());}};_0x9dea77(++_0x29face);}(_0x8375,0x132));var _0x5837=function(_0x545b9d,_0x5f4fe5){_0x545b9d=_0x545b9d-0x0;var _0xd6814e=_0x8375[_0x545b9d];return _0xd6814e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5837('0x0'));var zipdir=require(_0x5837('0x1'));var jsonpatch=require(_0x5837('0x2'));var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require('mustache');var util=require(_0x5837('0x6'));var path=require(_0x5837('0x7'));var sox=require('sox');var csv=require(_0x5837('0x8'));var ejs=require(_0x5837('0x9'));var fs=require('fs');var fs_extra=require(_0x5837('0xa'));var _=require(_0x5837('0xb'));var squel=require('squel');var crypto=require(_0x5837('0xc'));var jsforce=require(_0x5837('0xd'));var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x8'));var querystring=require(_0x5837('0xf'));var Papa=require(_0x5837('0x10'));var Redis=require(_0x5837('0x11'));var authService=require(_0x5837('0x12'));var qs=require(_0x5837('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5837('0x14'));var logger=require(_0x5837('0x15'))('api');var utils=require(_0x5837('0x16'));var config=require(_0x5837('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x5abd5e,_0x2b0b43){_0x2b0b43=_0x2b0b43||0xcc;return function(_0x3ad5b3){if(_0x3ad5b3){return _0x5abd5e[_0x5837('0x19')](_0x2b0b43);}return _0x5abd5e[_0x5837('0x1a')](_0x2b0b43)['end']();};}function respondWithResult(_0x2b82a9,_0x103b9c){_0x103b9c=_0x103b9c||0xc8;return function(_0x2bc6f6){if(_0x2bc6f6){return _0x2b82a9['status'](_0x103b9c)[_0x5837('0x1b')](_0x2bc6f6);}};}function respondWithFilteredResult(_0x11f16c,_0x2f8af0){return function(_0x23c3af){if(_0x23c3af){var _0x304fe7=typeof _0x2f8af0[_0x5837('0x1c')]==='undefined'&&typeof _0x2f8af0['limit']==='undefined';var _0x37824b=_0x23c3af[_0x5837('0x1d')];var _0x1a5725=_0x304fe7?0x0:_0x2f8af0[_0x5837('0x1c')];var _0x128b4a=_0x304fe7?_0x23c3af[_0x5837('0x1d')]:_0x2f8af0[_0x5837('0x1c')]+_0x2f8af0['limit'];var _0x3c5ec9;if(_0x128b4a>=_0x37824b){_0x128b4a=_0x37824b;_0x3c5ec9=0xc8;}else{_0x3c5ec9=0xce;}_0x11f16c[_0x5837('0x1a')](_0x3c5ec9);return _0x11f16c[_0x5837('0x1e')](_0x5837('0x1f'),_0x1a5725+'-'+_0x128b4a+'/'+_0x37824b)[_0x5837('0x1b')](_0x23c3af);}return null;};}function patchUpdates(_0x50c42c){return function(_0x4bd76c){try{jsonpatch[_0x5837('0x20')](_0x4bd76c,_0x50c42c,!![]);}catch(_0x21c0bf){return BPromise[_0x5837('0x21')](_0x21c0bf);}return _0x4bd76c['save']();};}function saveUpdates(_0x31010b,_0x46786c){return function(_0x4b59b1){if(_0x4b59b1){return _0x4b59b1[_0x5837('0x22')](_0x31010b)[_0x5837('0x23')](function(_0x5e9c2e){return _0x5e9c2e;});}return null;};}function removeEntity(_0x332a90,_0x2709cf){return function(_0x1366c1){if(_0x1366c1){return _0x1366c1['destroy']()[_0x5837('0x23')](function(){_0x332a90['status'](0xcc)[_0x5837('0x24')]();});}};}function handleEntityNotFound(_0x8e5a48,_0x31d25b){return function(_0x3f96b1){if(!_0x3f96b1){_0x8e5a48[_0x5837('0x19')](0x194);}return _0x3f96b1;};}function handleError(_0x1f7f97,_0x22564a){_0x22564a=_0x22564a||0x1f4;return function(_0x1d7285){logger[_0x5837('0x25')](_0x1d7285[_0x5837('0x26')]);if(_0x1d7285[_0x5837('0x27')]){delete _0x1d7285[_0x5837('0x27')];}_0x1f7f97[_0x5837('0x1a')](_0x22564a)[_0x5837('0x28')](_0x1d7285);};}exports[_0x5837('0x29')]=function(_0x5c17dd,_0x321c49){var _0x2818c0={},_0x170cb2={},_0x430bd1={'count':0x0,'rows':[]};var _0x80cfc6=_[_0x5837('0x2a')](db[_0x5837('0x2b')]['rawAttributes'],function(_0x89e7e5){return{'name':_0x89e7e5[_0x5837('0x2c')],'type':_0x89e7e5[_0x5837('0x2d')][_0x5837('0x2e')]};});_0x170cb2['model']=_['map'](_0x80cfc6,_0x5837('0x27'));_0x170cb2[_0x5837('0x2f')]=_[_0x5837('0x30')](_0x5c17dd['query']);_0x170cb2[_0x5837('0x31')]=_[_0x5837('0x32')](_0x170cb2[_0x5837('0x33')],_0x170cb2[_0x5837('0x2f')]);_0x2818c0[_0x5837('0x34')]=_[_0x5837('0x32')](_0x170cb2['model'],qs[_0x5837('0x35')](_0x5c17dd[_0x5837('0x2f')]['fields']));_0x2818c0[_0x5837('0x34')]=_0x2818c0[_0x5837('0x34')][_0x5837('0x36')]?_0x2818c0['attributes']:_0x170cb2['model'];if(!_0x5c17dd['query']['hasOwnProperty'](_0x5837('0x37'))){_0x2818c0['limit']=qs['limit'](_0x5c17dd[_0x5837('0x2f')][_0x5837('0x38')]);_0x2818c0['offset']=qs[_0x5837('0x1c')](_0x5c17dd['query'][_0x5837('0x1c')]);}_0x2818c0[_0x5837('0x39')]=qs['sort'](_0x5c17dd[_0x5837('0x2f')][_0x5837('0x3a')]);_0x2818c0['where']=qs[_0x5837('0x31')](_['pick'](_0x5c17dd[_0x5837('0x2f')],_0x170cb2['filters']),_0x80cfc6);if(_0x5c17dd['query'][_0x5837('0x3b')]){_0x2818c0[_0x5837('0x3c')]=_[_0x5837('0x3d')](_0x2818c0[_0x5837('0x3c')],{'$or':_[_0x5837('0x2a')](_0x80cfc6,function(_0x5ca1ea){if(_0x5ca1ea[_0x5837('0x2d')]!=='VIRTUAL'){var _0x5d29ed={};_0x5d29ed[_0x5ca1ea[_0x5837('0x27')]]={'$like':'%'+_0x5c17dd[_0x5837('0x2f')]['filter']+'%'};return _0x5d29ed;}})});}_0x2818c0=_[_0x5837('0x3d')]({},_0x2818c0,_0x5c17dd[_0x5837('0x3e')]);var _0x414254={'where':_0x2818c0[_0x5837('0x3c')]};return db[_0x5837('0x2b')][_0x5837('0x1d')](_0x414254)[_0x5837('0x23')](function(_0x7b3c75){_0x430bd1[_0x5837('0x1d')]=_0x7b3c75;if(_0x5c17dd['query'][_0x5837('0x3f')]){_0x2818c0['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x5837('0x40')](_0x2818c0);})[_0x5837('0x23')](function(_0x5e6916){_0x430bd1[_0x5837('0x41')]=_0x5e6916;return _0x430bd1;})[_0x5837('0x23')](respondWithFilteredResult(_0x321c49,_0x2818c0))[_0x5837('0x42')](handleError(_0x321c49,null));};exports[_0x5837('0x43')]=function(_0x561f0a,_0x26fd6d){var _0x25237a={'raw':!![],'where':{'id':_0x561f0a[_0x5837('0x44')]['id']}},_0x84eff={};_0x84eff[_0x5837('0x33')]=_['keys'](db[_0x5837('0x2b')][_0x5837('0x45')]);_0x84eff[_0x5837('0x2f')]=_['keys'](_0x561f0a[_0x5837('0x2f')]);_0x84eff[_0x5837('0x31')]=_[_0x5837('0x32')](_0x84eff[_0x5837('0x33')],_0x84eff[_0x5837('0x2f')]);_0x25237a[_0x5837('0x34')]=_[_0x5837('0x32')](_0x84eff[_0x5837('0x33')],qs[_0x5837('0x35')](_0x561f0a[_0x5837('0x2f')][_0x5837('0x35')]));_0x25237a['attributes']=_0x25237a[_0x5837('0x34')][_0x5837('0x36')]?_0x25237a['attributes']:_0x84eff['model'];if(_0x561f0a[_0x5837('0x2f')]['includeAll']){_0x25237a[_0x5837('0x46')]=[{'all':!![]}];}_0x25237a=_[_0x5837('0x3d')]({},_0x25237a,_0x561f0a[_0x5837('0x3e')]);return db[_0x5837('0x2b')]['find'](_0x25237a)[_0x5837('0x23')](handleEntityNotFound(_0x26fd6d,null))[_0x5837('0x23')](respondWithResult(_0x26fd6d,null))[_0x5837('0x42')](handleError(_0x26fd6d,null));};exports[_0x5837('0x47')]=function(_0x3fc3c8,_0x3b1293){return db[_0x5837('0x2b')][_0x5837('0x47')](_0x3fc3c8[_0x5837('0x48')],{})['then'](respondWithResult(_0x3b1293,0xc9))[_0x5837('0x42')](handleError(_0x3b1293,null));};exports[_0x5837('0x22')]=function(_0xd49ba7,_0x16f12f){if(_0xd49ba7[_0x5837('0x48')]['id']){delete _0xd49ba7[_0x5837('0x48')]['id'];}return db['JscriptyAnswerReport'][_0x5837('0x49')]({'where':{'id':_0xd49ba7[_0x5837('0x44')]['id']}})[_0x5837('0x23')](handleEntityNotFound(_0x16f12f,null))[_0x5837('0x23')](saveUpdates(_0xd49ba7[_0x5837('0x48')],null))['then'](respondWithResult(_0x16f12f,null))[_0x5837('0x42')](handleError(_0x16f12f,null));};exports['destroy']=function(_0x105315,_0x345547){return db[_0x5837('0x2b')]['find']({'where':{'id':_0x105315[_0x5837('0x44')]['id']}})[_0x5837('0x23')](handleEntityNotFound(_0x345547,null))[_0x5837('0x23')](removeEntity(_0x345547,null))[_0x5837('0x42')](handleError(_0x345547,null));};exports[_0x5837('0x4a')]=function(_0x424d59,_0x41604b){return db[_0x5837('0x2b')][_0x5837('0x4a')]()['then'](respondWithResult(_0x41604b,null))['catch'](handleError(_0x41604b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7b3ceae..8721286 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 _0xe08f=['api','request-promise','path','../../config/environment','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger'];(function(_0x41f02c,_0x16a69e){var _0x367e7f=function(_0x2ac4c1){while(--_0x2ac4c1){_0x41f02c['push'](_0x41f02c['shift']());}};_0x367e7f(++_0x16a69e);}(_0xe08f,0xb1));var _0xfe08=function(_0x2ed8a8,_0x54603e){_0x2ed8a8=_0x2ed8a8-0x0;var _0x469c2b=_0xe08f[_0x2ed8a8];return _0x469c2b;};'use strict';var _=require(_0xfe08('0x0'));var util=require(_0xfe08('0x1'));var logger=require(_0xfe08('0x2'))(_0xfe08('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfe08('0x4'));var fs=require('fs');var path=require(_0xfe08('0x5'));var rimraf=require('rimraf');var config=require(_0xfe08('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xfe08('0x7')]=function(_0x278594,_0x47bfff){return _0x278594[_0xfe08('0x8')](_0xfe08('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb95=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x351955,_0x2111d7){var _0x32bd44=function(_0x3d2637){while(--_0x3d2637){_0x351955['push'](_0x351955['shift']());}};_0x32bd44(++_0x2111d7);}(_0xcb95,0x87));var _0x5cb9=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xcb95[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x5cb9('0x0'));var util=require(_0x5cb9('0x1'));var logger=require(_0x5cb9('0x2'))(_0x5cb9('0x3'));var moment=require(_0x5cb9('0x4'));var BPromise=require(_0x5cb9('0x5'));var rp=require(_0x5cb9('0x6'));var fs=require('fs');var path=require(_0x5cb9('0x7'));var rimraf=require(_0x5cb9('0x8'));var config=require(_0x5cb9('0x9'));var attributes=require(_0x5cb9('0xa'));module[_0x5cb9('0xb')]=function(_0x768cc1,_0x5e697c){return _0x768cc1[_0x5cb9('0xc')]('JscriptyAnswerReport',attributes,{'tableName':_0x5cb9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 5fcfec6..e96e209 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 _0x4551=['rpc','../../config/environment','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4551,0x15f));var _0x1455=function(_0x1f0533,_0x12f344){_0x1f0533=_0x1f0533-0x0;var _0x498dd3=_0x4551[_0x1f0533];return _0x498dd3;};'use strict';var _=require(_0x1455('0x0'));var util=require(_0x1455('0x1'));var moment=require(_0x1455('0x2'));var BPromise=require(_0x1455('0x3'));var rs=require(_0x1455('0x4'));var fs=require('fs');var Redis=require(_0x1455('0x5'));var db=require(_0x1455('0x6'))['db'];var utils=require(_0x1455('0x7'));var logger=require(_0x1455('0x8'))(_0x1455('0x9'));var config=require(_0x1455('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1455('0xb')][_0x1455('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ebec1,_0x464778,_0x196d6f){return new BPromise(function(_0x553bf5,_0x31fbc4){return client[_0x1455('0xd')](_0x4ebec1,_0x196d6f)[_0x1455('0xe')](function(_0x5bd636){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x464778,'request\x20sent');logger['debug'](_0x1455('0xf'),_0x464778,'request\x20sent',JSON[_0x1455('0x10')](_0x5bd636));if(_0x5bd636[_0x1455('0x11')]){if(_0x5bd636[_0x1455('0x11')][_0x1455('0x12')]===0x1f4){logger[_0x1455('0x11')](_0x1455('0x13'),_0x464778,_0x5bd636[_0x1455('0x11')][_0x1455('0x14')]);return _0x31fbc4(_0x5bd636['error'][_0x1455('0x14')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x464778,_0x5bd636[_0x1455('0x11')][_0x1455('0x14')]);return _0x553bf5(_0x5bd636[_0x1455('0x11')][_0x1455('0x14')]);}else{logger[_0x1455('0x15')](_0x1455('0x13'),_0x464778,'request\x20sent');_0x553bf5(_0x5bd636[_0x1455('0x16')][_0x1455('0x14')]);}})[_0x1455('0x17')](function(_0x40f56c){logger[_0x1455('0x11')](_0x1455('0x13'),_0x464778,_0x40f56c);_0x31fbc4(_0x40f56c);});});} \ No newline at end of file +var _0x043b=['lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0x043b,0x13b));var _0xb043=function(_0x48671c,_0x2b44a3){_0x48671c=_0x48671c-0x0;var _0x32d5e5=_0x043b[_0x48671c];return _0x32d5e5;};'use strict';var _=require(_0xb043('0x0'));var util=require(_0xb043('0x1'));var moment=require(_0xb043('0x2'));var BPromise=require(_0xb043('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb043('0x4'));var logger=require(_0xb043('0x5'))(_0xb043('0x6'));var config=require(_0xb043('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb043('0x8')][_0xb043('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5861f5,_0x1fb3d4,_0x787fee){return new BPromise(function(_0x41fb45,_0x4d57f9){return client[_0xb043('0xa')](_0x5861f5,_0x787fee)[_0xb043('0xb')](function(_0x3608c3){logger[_0xb043('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1fb3d4,_0xb043('0xd'));logger['debug'](_0xb043('0xe'),_0x1fb3d4,_0xb043('0xd'),JSON[_0xb043('0xf')](_0x3608c3));if(_0x3608c3[_0xb043('0x10')]){if(_0x3608c3[_0xb043('0x10')]['code']===0x1f4){logger[_0xb043('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1fb3d4,_0x3608c3[_0xb043('0x10')][_0xb043('0x11')]);return _0x4d57f9(_0x3608c3[_0xb043('0x10')][_0xb043('0x11')]);}logger[_0xb043('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1fb3d4,_0x3608c3[_0xb043('0x10')]['message']);return _0x41fb45(_0x3608c3[_0xb043('0x10')]['message']);}else{logger[_0xb043('0xc')](_0xb043('0x12'),_0x1fb3d4,_0xb043('0xd'));_0x41fb45(_0x3608c3[_0xb043('0x13')][_0xb043('0x11')]);}})[_0xb043('0x14')](function(_0x4dda4c){logger['error'](_0xb043('0x12'),_0x1fb3d4,_0x4dda4c);_0x4d57f9(_0x4dda4c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1e134c1..22feb53 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 _0x6fed=['fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','post','create','/:id/clone','put','update','destroy','exports','multer','path','express','Router'];(function(_0x3e197f,_0x1c985f){var _0x21c35b=function(_0x1c1b0a){while(--_0x1c1b0a){_0x3e197f['push'](_0x3e197f['shift']());}};_0x21c35b(++_0x1c985f);}(_0x6fed,0xec));var _0xd6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fed[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd6fe('0x0'));var util=require('util');var path=require(_0xd6fe('0x1'));var timeout=require('connect-timeout');var express=require(_0xd6fe('0x2'));var router=express[_0xd6fe('0x3')]();var fs_extra=require(_0xd6fe('0x4'));var auth=require(_0xd6fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd6fe('0x6'));var controller=require(_0xd6fe('0x7'));router[_0xd6fe('0x8')]('/',auth[_0xd6fe('0x9')](),controller['index']);router['get'](_0xd6fe('0xa'),auth['isAuthenticated'](),controller[_0xd6fe('0xb')]);router[_0xd6fe('0x8')](_0xd6fe('0xc'),auth[_0xd6fe('0x9')](),controller[_0xd6fe('0xd')]);router[_0xd6fe('0x8')](_0xd6fe('0xe'),auth[_0xd6fe('0x9')](),controller[_0xd6fe('0xf')]);router[_0xd6fe('0x8')](_0xd6fe('0x10'),auth[_0xd6fe('0x9')](),timeout('30s'),controller['getSummary']);router[_0xd6fe('0x11')]('/',auth['isAuthenticated'](),controller[_0xd6fe('0x12')]);router['post'](_0xd6fe('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0xd6fe('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xd6fe('0x15')]);router['delete']('/:id',auth[_0xd6fe('0x9')](),controller[_0xd6fe('0x16')]);module[_0xd6fe('0x17')]=router; \ No newline at end of file +var _0x2216=['delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','clone','update'];(function(_0x50ad68,_0x502ad2){var _0x4dd300=function(_0x2c9b8d){while(--_0x2c9b8d){_0x50ad68['push'](_0x50ad68['shift']());}};_0x4dd300(++_0x502ad2);}(_0x2216,0x87));var _0x6221=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x2216[_0x56482c];return _0x5aae7a;};'use strict';var multer=require('multer');var util=require(_0x6221('0x0'));var path=require(_0x6221('0x1'));var timeout=require(_0x6221('0x2'));var express=require(_0x6221('0x3'));var router=express['Router']();var fs_extra=require(_0x6221('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6221('0x5'));var config=require(_0x6221('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x6221('0x7')](),controller[_0x6221('0x8')]);router[_0x6221('0x9')](_0x6221('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6221('0x9')]('/:id/sessions',auth[_0x6221('0x7')](),controller['getSessions']);router['get'](_0x6221('0xb'),auth[_0x6221('0x7')](),controller[_0x6221('0xc')]);router[_0x6221('0x9')](_0x6221('0xd'),auth[_0x6221('0x7')](),timeout(_0x6221('0xe')),controller[_0x6221('0xf')]);router[_0x6221('0x10')]('/',auth[_0x6221('0x7')](),controller['create']);router['post']('/:id/clone',auth[_0x6221('0x7')](),controller[_0x6221('0x11')]);router['put'](_0x6221('0xa'),auth[_0x6221('0x7')](),controller[_0x6221('0x12')]);router[_0x6221('0x13')](_0x6221('0xa'),auth[_0x6221('0x7')](),controller[_0x6221('0x14')]);module[_0x6221('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 385cdb8..c7f3c11 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 _0x797a=['getDataValue','BOOLEAN','lodash','util','STRING','name','TEXT','long','isObjectLike','formData','stringify','setDataValue','format'];(function(_0x579a44,_0x30af1c){var _0x27afea=function(_0x3745cd){while(--_0x3745cd){_0x579a44['push'](_0x579a44['shift']());}};_0x27afea(++_0x30af1c);}(_0x797a,0x84));var _0xa797=function(_0x429b58,_0x5d207c){_0x429b58=_0x429b58-0x0;var _0x232976=_0x797a[_0x429b58];return _0x232976;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa797('0x0'));var util=require(_0xa797('0x1'));module['exports']={'name':{'type':Sequelize[_0xa797('0x2')],'unique':_0xa797('0x3')},'description':{'type':Sequelize[_0xa797('0x2')]},'formData':{'type':Sequelize[_0xa797('0x4')](_0xa797('0x5')),'set':function(_0x1b1f5){if(_[_0xa797('0x6')](_0x1b1f5)){this['setDataValue'](_0xa797('0x7'),JSON[_0xa797('0x8')](_0x1b1f5));}else if(_['isString'](_0x1b1f5)){this[_0xa797('0x9')](_0xa797('0x7'),_0x1b1f5);}else{this[_0xa797('0x9')](_0xa797('0x7'),util[_0xa797('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xa797('0x3'))||'',this[_0xa797('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa797('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa797('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x5be1=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5be1,0x116));var _0x15be=function(_0x17c938,_0x557096){_0x17c938=_0x17c938-0x0;var _0x2d22b2=_0x5be1[_0x17c938];return _0x2d22b2;};'use strict';var Sequelize=require(_0x15be('0x0'));var _=require(_0x15be('0x1'));var util=require(_0x15be('0x2'));module[_0x15be('0x3')]={'name':{'type':Sequelize[_0x15be('0x4')],'unique':_0x15be('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x15be('0x6')](_0x15be('0x7')),'set':function(_0x5deff6){if(_[_0x15be('0x8')](_0x5deff6)){this[_0x15be('0x9')](_0x15be('0xa'),JSON['stringify'](_0x5deff6));}else if(_[_0x15be('0xb')](_0x5deff6)){this['setDataValue']('formData',_0x5deff6);}else{this['setDataValue'](_0x15be('0xa'),util[_0x15be('0xc')](_0x15be('0xd'),this[_0x15be('0xe')](_0x15be('0x5'))||'',this[_0x15be('0xe')](_0x15be('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x15be('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c5b1d05..b456c78 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 _0x66d4=['omit','createdAt','updatedAt','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','JscriptyProject','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone'];(function(_0x1deb77,_0x258c15){var _0x194f0a=function(_0x240017){while(--_0x240017){_0x1deb77['push'](_0x1deb77['shift']());}};_0x194f0a(++_0x258c15);}(_0x66d4,0x10b));var _0x466d=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x66d4[_0x95411e];return _0x2c8718;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x466d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x466d('0x1'));var rp=require(_0x466d('0x2'));var moment=require(_0x466d('0x3'));var BPromise=require(_0x466d('0x4'));var Mustache=require(_0x466d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x466d('0x6'));var csv=require('to-csv');var ejs=require(_0x466d('0x7'));var fs=require('fs');var fs_extra=require(_0x466d('0x8'));var _=require(_0x466d('0x9'));var squel=require(_0x466d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x466d('0xb'));var toCsv=require(_0x466d('0xc'));var querystring=require(_0x466d('0xd'));var Papa=require(_0x466d('0xe'));var Redis=require('ioredis');var authService=require(_0x466d('0xf'));var qs=require(_0x466d('0x10'));var as=require(_0x466d('0x11'));var hardwareService=require(_0x466d('0x12'));var logger=require(_0x466d('0x13'))(_0x466d('0x14'));var utils=require(_0x466d('0x15'));var config=require(_0x466d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f2f45,_0x261f91){_0x261f91=_0x261f91||0xcc;return function(_0x12e1ea){if(_0x12e1ea){return _0x3f2f45[_0x466d('0x17')](_0x261f91);}return _0x3f2f45[_0x466d('0x18')](_0x261f91)[_0x466d('0x19')]();};}function respondWithResult(_0x3bf1d9,_0x55c500){_0x55c500=_0x55c500||0xc8;return function(_0x3f7aee){if(_0x3f7aee){return _0x3bf1d9[_0x466d('0x18')](_0x55c500)['json'](_0x3f7aee);}};}function respondWithFilteredResult(_0x590ce7,_0x471d4e){return function(_0x1efa66){if(_0x1efa66){var _0x6e9fe2=typeof _0x471d4e[_0x466d('0x1a')]===_0x466d('0x1b')&&typeof _0x471d4e[_0x466d('0x1c')]==='undefined';var _0x111a47=_0x1efa66[_0x466d('0x1d')];var _0x54f580=_0x6e9fe2?0x0:_0x471d4e[_0x466d('0x1a')];var _0x5912fe=_0x6e9fe2?_0x1efa66['count']:_0x471d4e[_0x466d('0x1a')]+_0x471d4e[_0x466d('0x1c')];var _0x1e9bff;if(_0x5912fe>=_0x111a47){_0x5912fe=_0x111a47;_0x1e9bff=0xc8;}else{_0x1e9bff=0xce;}_0x590ce7[_0x466d('0x18')](_0x1e9bff);return _0x590ce7[_0x466d('0x1e')]('Content-Range',_0x54f580+'-'+_0x5912fe+'/'+_0x111a47)[_0x466d('0x1f')](_0x1efa66);}return null;};}function patchUpdates(_0x15f13d){return function(_0x3bb097){try{jsonpatch[_0x466d('0x20')](_0x3bb097,_0x15f13d,!![]);}catch(_0x517269){return BPromise['reject'](_0x517269);}return _0x3bb097[_0x466d('0x21')]();};}function saveUpdates(_0x3c09f4,_0x672e2){return function(_0xd1395c){if(_0xd1395c){return _0xd1395c[_0x466d('0x22')](_0x3c09f4)[_0x466d('0x23')](function(_0x5f056f){return _0x5f056f;});}return null;};}function removeEntity(_0x647db3,_0x112e09){return function(_0x4fb2f1){if(_0x4fb2f1){return _0x4fb2f1[_0x466d('0x24')]()[_0x466d('0x23')](function(){var _0x353394=_0x4fb2f1['get']({'plain':!![]});var _0x35a947='Projects';return db[_0x466d('0x25')][_0x466d('0x24')]({'where':{'type':_0x35a947,'resourceId':_0x353394['id']}})[_0x466d('0x23')](function(){return _0x4fb2f1;});})['then'](function(){_0x647db3[_0x466d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f346,_0x51b08b){return function(_0x267314){if(!_0x267314){_0x51f346[_0x466d('0x17')](0x194);}return _0x267314;};}function handleError(_0x483522,_0x345fff){_0x345fff=_0x345fff||0x1f4;return function(_0x139899){logger[_0x466d('0x26')](_0x139899[_0x466d('0x27')]);if(_0x139899[_0x466d('0x28')]){delete _0x139899[_0x466d('0x28')];}_0x483522[_0x466d('0x18')](_0x345fff)[_0x466d('0x29')](_0x139899);};}exports[_0x466d('0x2a')]=function(_0x2feefd,_0x462d86){var _0x376a55={},_0x18a7bc={},_0x1c9858={'count':0x0,'rows':[]};var _0x3ebc70=_[_0x466d('0x2b')](db['JscriptyProject'][_0x466d('0x2c')],function(_0x15769b){return{'name':_0x15769b[_0x466d('0x2d')],'type':_0x15769b[_0x466d('0x2e')][_0x466d('0x2f')]};});_0x18a7bc[_0x466d('0x30')]=_[_0x466d('0x2b')](_0x3ebc70,_0x466d('0x28'));_0x18a7bc[_0x466d('0x31')]=_[_0x466d('0x32')](_0x2feefd[_0x466d('0x31')]);_0x18a7bc[_0x466d('0x33')]=_[_0x466d('0x34')](_0x18a7bc[_0x466d('0x30')],_0x18a7bc['query']);_0x376a55['attributes']=_[_0x466d('0x34')](_0x18a7bc[_0x466d('0x30')],qs[_0x466d('0x35')](_0x2feefd[_0x466d('0x31')][_0x466d('0x35')]));_0x376a55['attributes']=_0x376a55[_0x466d('0x36')][_0x466d('0x37')]?_0x376a55[_0x466d('0x36')]:_0x18a7bc[_0x466d('0x30')];if(!_0x2feefd['query'][_0x466d('0x38')](_0x466d('0x39'))){_0x376a55[_0x466d('0x1c')]=qs[_0x466d('0x1c')](_0x2feefd[_0x466d('0x31')][_0x466d('0x1c')]);_0x376a55[_0x466d('0x1a')]=qs[_0x466d('0x1a')](_0x2feefd[_0x466d('0x31')][_0x466d('0x1a')]);}_0x376a55[_0x466d('0x3a')]=qs[_0x466d('0x3b')](_0x2feefd[_0x466d('0x31')][_0x466d('0x3b')]);_0x376a55[_0x466d('0x3c')]=qs[_0x466d('0x33')](_[_0x466d('0x3d')](_0x2feefd[_0x466d('0x31')],_0x18a7bc[_0x466d('0x33')]),_0x3ebc70);if(_0x2feefd['query'][_0x466d('0x3e')]){_0x376a55[_0x466d('0x3c')]=_[_0x466d('0x3f')](_0x376a55['where'],{'$or':_[_0x466d('0x2b')](_0x3ebc70,function(_0x11c8b8){if(_0x11c8b8[_0x466d('0x2e')]!==_0x466d('0x40')){var _0x2c30c0={};_0x2c30c0[_0x11c8b8[_0x466d('0x28')]]={'$like':'%'+_0x2feefd['query'][_0x466d('0x3e')]+'%'};return _0x2c30c0;}})});}_0x376a55=_[_0x466d('0x3f')]({},_0x376a55,_0x2feefd['options']);var _0x44692f={'where':_0x376a55[_0x466d('0x3c')]};return db[_0x466d('0x41')]['count'](_0x44692f)[_0x466d('0x23')](function(_0x17ad2f){_0x1c9858[_0x466d('0x1d')]=_0x17ad2f;if(_0x2feefd[_0x466d('0x31')]['includeAll']){_0x376a55[_0x466d('0x42')]=[{'all':!![]}];}return db['JscriptyProject'][_0x466d('0x43')](_0x376a55);})[_0x466d('0x23')](function(_0x3c68bb){_0x1c9858[_0x466d('0x44')]=_0x3c68bb;return _0x1c9858;})[_0x466d('0x23')](respondWithFilteredResult(_0x462d86,_0x376a55))['catch'](handleError(_0x462d86,null));};exports[_0x466d('0x45')]=function(_0x76bc3f,_0x2c1d62){var _0x4ea9da={'raw':![],'where':{'id':_0x76bc3f[_0x466d('0x46')]['id']}},_0x5be696={};_0x5be696[_0x466d('0x30')]=_[_0x466d('0x32')](db[_0x466d('0x41')][_0x466d('0x2c')]);_0x5be696[_0x466d('0x31')]=_[_0x466d('0x32')](_0x76bc3f['query']);_0x5be696[_0x466d('0x33')]=_['intersection'](_0x5be696[_0x466d('0x30')],_0x5be696[_0x466d('0x31')]);_0x4ea9da['attributes']=_[_0x466d('0x34')](_0x5be696[_0x466d('0x30')],qs[_0x466d('0x35')](_0x76bc3f[_0x466d('0x31')][_0x466d('0x35')]));_0x4ea9da[_0x466d('0x36')]=_0x4ea9da[_0x466d('0x36')][_0x466d('0x37')]?_0x4ea9da['attributes']:_0x5be696[_0x466d('0x30')];if(_0x76bc3f[_0x466d('0x31')][_0x466d('0x47')]){_0x4ea9da['include']=[{'all':!![]}];}_0x4ea9da=_[_0x466d('0x3f')]({},_0x4ea9da,_0x76bc3f[_0x466d('0x48')]);return db[_0x466d('0x41')][_0x466d('0x49')](_0x4ea9da)['then'](handleEntityNotFound(_0x2c1d62,null))['then'](respondWithResult(_0x2c1d62,null))[_0x466d('0x4a')](handleError(_0x2c1d62,null));};exports[_0x466d('0x4b')]=function(_0xed3724,_0x1ff58e){return db['JscriptyProject'][_0x466d('0x4b')](_0xed3724[_0x466d('0x4c')],{})[_0x466d('0x23')](function(_0x5ea992){var _0xb4d9a4=_0xed3724['user']['get']({'plain':!![]});if(!_0xb4d9a4)throw new Error(_0x466d('0x4d'));if(_0xb4d9a4[_0x466d('0x4e')]===_0x466d('0x4f')){var _0x3e517f=_0x5ea992[_0x466d('0x50')]({'plain':!![]});var _0x203d13=_0x466d('0x51');return db[_0x466d('0x52')][_0x466d('0x49')]({'where':{'name':_0x203d13,'userProfileId':_0xb4d9a4[_0x466d('0x53')]},'raw':!![]})['then'](function(_0x4d8e48){if(_0x4d8e48&&_0x4d8e48[_0x466d('0x54')]===0x0){return db[_0x466d('0x25')]['create']({'name':_0x3e517f[_0x466d('0x28')],'resourceId':_0x3e517f['id'],'type':_0x4d8e48[_0x466d('0x28')],'sectionId':_0x4d8e48['id']},{})[_0x466d('0x23')](function(){return _0x5ea992;});}else{return _0x5ea992;}})['catch'](function(_0x4b075f){logger[_0x466d('0x26')](_0x466d('0x55'),_0x4b075f);throw _0x4b075f;});}return _0x5ea992;})[_0x466d('0x23')](respondWithResult(_0x1ff58e,0xc9))[_0x466d('0x4a')](handleError(_0x1ff58e,null));};exports[_0x466d('0x56')]=function(_0x328282,_0x4858a5){var _0x227130={'where':{'id':_0x328282['params']['id']}},_0x4a7b2b={};_0x4a7b2b[_0x466d('0x30')]=_[_0x466d('0x32')](db[_0x466d('0x41')][_0x466d('0x2c')]);_0x227130[_0x466d('0x36')]=_['intersection'](_0x4a7b2b[_0x466d('0x30')],qs[_0x466d('0x35')](_0x328282[_0x466d('0x31')][_0x466d('0x35')]));_0x227130[_0x466d('0x36')]=_0x227130[_0x466d('0x36')][_0x466d('0x37')]?_0x227130['attributes']:_0x4a7b2b[_0x466d('0x30')];if(_0x328282[_0x466d('0x31')][_0x466d('0x47')]){_0x227130['include']=[{'all':!![]}];}_0x227130=_[_0x466d('0x3f')]({},_0x227130,_0x328282[_0x466d('0x48')]);return db[_0x466d('0x41')][_0x466d('0x49')](_0x227130)[_0x466d('0x23')](handleEntityNotFound(_0x4858a5,null))[_0x466d('0x23')](function(_0x45d14d){if(_0x45d14d){var _0x2daf7f=_0x45d14d[_0x466d('0x50')]({'plain':!![]});_0x2daf7f=qs[_0x466d('0x57')](_0x2daf7f,['id',_0x466d('0x58'),_0x466d('0x59')]);_0x328282[_0x466d('0x4c')]=_['omit'](_0x328282[_0x466d('0x4c')],['id',_0x466d('0x58'),_0x466d('0x59')]);return db[_0x466d('0x41')][_0x466d('0x4b')](_[_0x466d('0x3f')](_0x2daf7f,_0x328282['body']),{'include':_0x328282[_0x466d('0x31')][_0x466d('0x47')]?[{'all':!![]}]:undefined})[_0x466d('0x23')](function(_0x56a0e0){var _0x19e78e=_0x328282[_0x466d('0x4f')][_0x466d('0x50')]({'plain':!![]});if(!_0x19e78e)throw new Error(_0x466d('0x4d'));if(_0x19e78e[_0x466d('0x4e')]===_0x466d('0x4f')){var _0x106314=_0x56a0e0[_0x466d('0x50')]({'plain':!![]});var _0x3c071c=_0x466d('0x51');return db['UserProfileSection'][_0x466d('0x49')]({'where':{'name':_0x3c071c,'userProfileId':_0x19e78e[_0x466d('0x53')]},'raw':!![]})[_0x466d('0x23')](function(_0x475f89){if(_0x475f89&&_0x475f89[_0x466d('0x54')]===0x0){return db['UserProfileResource'][_0x466d('0x4b')]({'name':_0x106314['name'],'resourceId':_0x106314['id'],'type':_0x475f89['name'],'sectionId':_0x475f89['id']},{})['then'](function(){return _0x56a0e0;});}else{return _0x56a0e0;}})[_0x466d('0x4a')](function(_0x23d7c4){logger[_0x466d('0x26')](_0x466d('0x55'),_0x23d7c4);throw _0x23d7c4;});}return _0x56a0e0;});}})[_0x466d('0x23')](respondWithResult(_0x4858a5,0xc9))[_0x466d('0x4a')](handleError(_0x4858a5,null));};exports[_0x466d('0x22')]=function(_0x1254c3,_0x1730f8){if(_0x1254c3['body']['id']){delete _0x1254c3[_0x466d('0x4c')]['id'];}return db[_0x466d('0x41')][_0x466d('0x49')]({'where':{'id':_0x1254c3[_0x466d('0x46')]['id']}})[_0x466d('0x23')](handleEntityNotFound(_0x1730f8,null))[_0x466d('0x23')](saveUpdates(_0x1254c3[_0x466d('0x4c')],null))[_0x466d('0x23')](respondWithResult(_0x1730f8,null))[_0x466d('0x4a')](handleError(_0x1730f8,null));};exports[_0x466d('0x24')]=function(_0x3211d8,_0x109a17){return db['JscriptyProject'][_0x466d('0x49')]({'where':{'id':_0x3211d8['params']['id']}})[_0x466d('0x23')](handleEntityNotFound(_0x109a17,null))[_0x466d('0x23')](removeEntity(_0x109a17,null))[_0x466d('0x4a')](handleError(_0x109a17,null));};exports['getSessions']=function(_0x2070bd,_0x5193b4,_0x397bf7){var _0x1b7d9c={'raw':!![],'where':{}};var _0x16a621={};var _0x23ddf={'count':0x0,'rows':[]};return db[_0x466d('0x41')][_0x466d('0x5a')]({'where':{'id':_0x2070bd[_0x466d('0x46')]['id']}})[_0x466d('0x23')](handleEntityNotFound(_0x5193b4,null))[_0x466d('0x23')](function(_0xd65e17){if(_0xd65e17){_0x16a621[_0x466d('0x30')]=_[_0x466d('0x32')](db['JscriptySessionReport'][_0x466d('0x2c')]);_0x16a621['query']=_[_0x466d('0x32')](_0x2070bd[_0x466d('0x31')]);_0x16a621[_0x466d('0x33')]=_[_0x466d('0x34')](_0x16a621[_0x466d('0x30')],_0x16a621[_0x466d('0x31')]);_0x1b7d9c['attributes']=_[_0x466d('0x34')](_0x16a621['model'],qs[_0x466d('0x35')](_0x2070bd[_0x466d('0x31')]['fields']));_0x1b7d9c['attributes']=_0x1b7d9c[_0x466d('0x36')]['length']?_0x1b7d9c[_0x466d('0x36')]:_0x16a621[_0x466d('0x30')];if(!_0x2070bd[_0x466d('0x31')][_0x466d('0x38')](_0x466d('0x39'))){_0x1b7d9c[_0x466d('0x1c')]=qs[_0x466d('0x1c')](_0x2070bd['query'][_0x466d('0x1c')]);_0x1b7d9c['offset']=qs['offset'](_0x2070bd['query'][_0x466d('0x1a')]);}_0x1b7d9c[_0x466d('0x3a')]=qs[_0x466d('0x3b')](_0x2070bd[_0x466d('0x31')][_0x466d('0x3b')]);_0x1b7d9c[_0x466d('0x3c')]=qs[_0x466d('0x33')](_[_0x466d('0x3d')](_0x2070bd[_0x466d('0x31')],_0x16a621[_0x466d('0x33')]));_0x1b7d9c[_0x466d('0x3c')][_0x466d('0x5b')]=_0xd65e17['id'];if(_0x2070bd[_0x466d('0x31')]['filter']){_0x1b7d9c[_0x466d('0x3c')]=_[_0x466d('0x3f')](_0x1b7d9c[_0x466d('0x3c')],{'$or':_[_0x466d('0x2b')](_0x1b7d9c[_0x466d('0x36')],function(_0x14357b){var _0x4e66cc={};_0x4e66cc[_0x14357b]={'$like':'%'+_0x2070bd[_0x466d('0x31')]['filter']+'%'};return _0x4e66cc;})});}_0x1b7d9c=_[_0x466d('0x3f')]({},_0x1b7d9c,_0x2070bd[_0x466d('0x48')]);return db[_0x466d('0x5c')][_0x466d('0x1d')]({'where':_0x1b7d9c[_0x466d('0x3c')]})[_0x466d('0x23')](function(_0xc69d3){_0x23ddf['count']=_0xc69d3;if(_0x2070bd[_0x466d('0x31')][_0x466d('0x47')]){_0x1b7d9c['include']=[{'all':!![]}];}return db[_0x466d('0x5c')]['findAll'](_0x1b7d9c);})[_0x466d('0x23')](function(_0x50c7ff){_0x23ddf[_0x466d('0x44')]=_0x50c7ff;return _0x23ddf;});}})[_0x466d('0x23')](respondWithFilteredResult(_0x5193b4,_0x1b7d9c))[_0x466d('0x4a')](handleError(_0x5193b4,null));};exports[_0x466d('0x5d')]=function(_0xf4f53e,_0x3b476b,_0x12e703){var _0x336a29={'raw':!![],'where':{}};var _0x22e94f={};var _0x4796b6={'count':0x0,'rows':[]};return db[_0x466d('0x41')]['findOne']({'where':{'id':_0xf4f53e[_0x466d('0x46')]['id']}})[_0x466d('0x23')](handleEntityNotFound(_0x3b476b,null))['then'](function(_0x469d49){if(_0x469d49){_0x22e94f[_0x466d('0x30')]=_[_0x466d('0x32')](db[_0x466d('0x5e')]['rawAttributes']);_0x22e94f[_0x466d('0x31')]=_['keys'](_0xf4f53e['query']);_0x22e94f[_0x466d('0x33')]=_[_0x466d('0x34')](_0x22e94f[_0x466d('0x30')],_0x22e94f['query']);_0x336a29[_0x466d('0x36')]=_[_0x466d('0x34')](_0x22e94f[_0x466d('0x30')],qs[_0x466d('0x35')](_0xf4f53e['query']['fields']));_0x336a29['attributes']=_0x336a29['attributes'][_0x466d('0x37')]?_0x336a29[_0x466d('0x36')]:_0x22e94f['model'];if(!_0xf4f53e[_0x466d('0x31')][_0x466d('0x38')](_0x466d('0x39'))){_0x336a29['limit']=qs['limit'](_0xf4f53e['query'][_0x466d('0x1c')]);_0x336a29[_0x466d('0x1a')]=qs['offset'](_0xf4f53e[_0x466d('0x31')][_0x466d('0x1a')]);}_0x336a29[_0x466d('0x3a')]=qs[_0x466d('0x3b')](_0xf4f53e['query'][_0x466d('0x3b')]);_0x336a29[_0x466d('0x3c')]=qs['filters'](_['pick'](_0xf4f53e[_0x466d('0x31')],_0x22e94f['filters']));_0x336a29[_0x466d('0x3c')][_0x466d('0x5b')]=_0x469d49['id'];if(_0xf4f53e['query'][_0x466d('0x3e')]){_0x336a29[_0x466d('0x3c')]=_[_0x466d('0x3f')](_0x336a29[_0x466d('0x3c')],{'$or':_[_0x466d('0x2b')](_0x336a29['attributes'],function(_0x5e3ad4){var _0x186045={};_0x186045[_0x5e3ad4]={'$like':'%'+_0xf4f53e[_0x466d('0x31')][_0x466d('0x3e')]+'%'};return _0x186045;})});}_0x336a29=_['merge']({},_0x336a29,_0xf4f53e['options']);return db[_0x466d('0x5e')][_0x466d('0x1d')]({'where':_0x336a29[_0x466d('0x3c')]})['then'](function(_0x2d2f4a){_0x4796b6[_0x466d('0x1d')]=_0x2d2f4a;if(_0xf4f53e[_0x466d('0x31')][_0x466d('0x47')]){_0x336a29[_0x466d('0x42')]=[{'all':!![]}];}return db[_0x466d('0x5e')][_0x466d('0x43')](_0x336a29);})[_0x466d('0x23')](function(_0x12cc9e){_0x4796b6[_0x466d('0x44')]=_0x12cc9e;return _0x4796b6;});}})[_0x466d('0x23')](respondWithFilteredResult(_0x3b476b,_0x336a29))[_0x466d('0x4a')](handleError(_0x3b476b,null));};function char(_0x2cb24b){return _0x466d('0x5f')===typeof _0x2cb24b?String[_0x466d('0x60')][_0x466d('0x20')](null,arguments):_0x2cb24b;}function needsEncapsulation(_0x1c6b4f){return!!_0x1c6b4f&&(_0x1c6b4f[_0x466d('0x61')]()['indexOf'](char(0xd))>=0x0||_0x1c6b4f['toString']()[_0x466d('0x62')](char(0xa))>=0x0||_0x1c6b4f[_0x466d('0x61')]()[_0x466d('0x62')](char(0x2c))>=0x0||_0x1c6b4f['toString']()[_0x466d('0x62')](char(0x22))>=0x0);}function encapsulate(_0x260cee){var _0x3969=char(0x22),_0x5921d0='\x5c'+char(0x22),_0x305035=_0x260cee[_0x466d('0x61')]()['replace'](new RegExp(_0x3969,'g'),_0x5921d0);return _0x3969+_0x305035+_0x3969;}exports[_0x466d('0x63')]=function(_0x5f014a,_0x51da79,_0x2d7b8b){var _0x22636d,_0x4e8dc9;var _0x557fbe={'where':{'ProjectId':_0x5f014a['params']['id']}};if(_0x5f014a['query']['startTime']){_0x557fbe[_0x466d('0x3c')][_0x466d('0x64')]=JSON[_0x466d('0x65')](_0x5f014a[_0x466d('0x31')][_0x466d('0x66')]);}return db[_0x466d('0x5c')][_0x466d('0x43')](_0x557fbe)[_0x466d('0x23')](handleEntityNotFound(_0x51da79,null))[_0x466d('0x23')](function(_0x1e712e){if(_0x1e712e){_0x22636d=_0x1e712e;return db[_0x466d('0x67')][_0x466d('0x43')]({'where':{'SessionId':{'$in':_[_0x466d('0x2b')](_0x22636d,'id')},'ProjectId':_0x5f014a['params']['id']},'order':'-createdAt'});}})[_0x466d('0x23')](handleEntityNotFound(_0x51da79,null))[_0x466d('0x23')](function(_0x594fc5){if(_0x594fc5){_0x4e8dc9=_0x594fc5;var _0x4d7ab7={};for(var _0x6962ad=0x0,_0x56011f=_0x4e8dc9[_0x466d('0x37')];_0x6962ad<_0x56011f;_0x6962ad++){if(!_0x4d7ab7[_0x466d('0x38')](_0x4e8dc9[_0x6962ad]['questionId'])){_0x4d7ab7[_0x4e8dc9[_0x6962ad][_0x466d('0x68')]]=needsEncapsulation(_0x4e8dc9[_0x6962ad][_0x466d('0x69')])?encapsulate(_0x4e8dc9[_0x6962ad]['question']):_0x4e8dc9[_0x6962ad][_0x466d('0x69')];}}var _0x54b325=[],_0x6f4967={};for(var _0x321241=0x0,_0x8e4d93=_0x22636d[_0x466d('0x37')];_0x321241<_0x8e4d93;_0x321241++){_0x6f4967={'ProjectId':_0x5f014a[_0x466d('0x46')]['id'],'SessionId':_0x22636d[_0x321241]['id'],'StartTime':moment(_0x22636d[_0x321241]['starttime'])['format'](_0x466d('0x6a'))};for(var _0x183ab5=0x0,_0x48ffc0=_0x4e8dc9[_0x466d('0x37')];_0x183ab5<_0x48ffc0;_0x183ab5++){if(_0x4e8dc9[_0x183ab5][_0x466d('0x6b')]==_0x22636d[_0x321241]['id']&&_0x4d7ab7[_0x466d('0x38')](_0x4e8dc9[_0x183ab5][_0x466d('0x68')])){_0x6f4967[_0x4d7ab7[_0x4e8dc9[_0x183ab5][_0x466d('0x68')]]]=_0x4e8dc9[_0x183ab5][_0x466d('0x6c')];}}for(var _0x8a4e95 in _0x4d7ab7){if(!_0x6f4967[_0x466d('0x38')](_0x4d7ab7[_0x8a4e95])){_0x6f4967[_0x4d7ab7[_0x8a4e95]]=null;}}_0x54b325[_0x466d('0x6d')](_0x6f4967);}return _0x54b325;}})[_0x466d('0x23')](function(_0x4cf4d9){if(!_['isEmpty'](_0x4cf4d9)){var _0x2f562f=toCsv(_0x4cf4d9);var _0x1c10db=Date[_0x466d('0x6e')]();fs[_0x466d('0x6f')](util[_0x466d('0x70')](_0x466d('0x71'),_0x5f014a[_0x466d('0x46')]['id'],_0x1c10db),_0x2f562f);_0x51da79[_0x466d('0x72')]('Content-disposition','attachment;\x20filename='+util[_0x466d('0x70')]('Jscripty_Project_%d_Summary_%s.csv',_0x5f014a[_0x466d('0x46')]['id'],_0x1c10db));_0x51da79[_0x466d('0x72')](_0x466d('0x73'),_0x466d('0x74'));return _0x51da79[_0x466d('0x75')](util['format'](_0x466d('0x71'),_0x5f014a[_0x466d('0x46')]['id'],_0x1c10db));}else{return _0x51da79[_0x466d('0x17')](0xcc);}})[_0x466d('0x4a')](handleError(_0x51da79,null));}; \ No newline at end of file +var _0x3308=['JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','sendStatus','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','end','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','params','keys','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','JscriptySessionReport','nolimit','order','rows','getAnswers','fromCharCode','toString','indexOf','replace','startTime','starttime','parse'];(function(_0x22e694,_0x2e17de){var _0x4324b0=function(_0x10bebd){while(--_0x10bebd){_0x22e694['push'](_0x22e694['shift']());}};_0x4324b0(++_0x2e17de);}(_0x3308,0x160));var _0x8330=function(_0x466d24,_0x359c73){_0x466d24=_0x466d24-0x0;var _0x3cd518=_0x3308[_0x466d24];return _0x3cd518;};'use strict';var emlformat=require(_0x8330('0x0'));var rimraf=require(_0x8330('0x1'));var zipdir=require(_0x8330('0x2'));var jsonpatch=require(_0x8330('0x3'));var rp=require(_0x8330('0x4'));var moment=require(_0x8330('0x5'));var BPromise=require(_0x8330('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8330('0x7'));var sox=require('sox');var csv=require(_0x8330('0x8'));var ejs=require(_0x8330('0x9'));var fs=require('fs');var fs_extra=require(_0x8330('0xa'));var _=require('lodash');var squel=require(_0x8330('0xb'));var crypto=require(_0x8330('0xc'));var jsforce=require(_0x8330('0xd'));var deskjs=require(_0x8330('0xe'));var toCsv=require(_0x8330('0x8'));var querystring=require(_0x8330('0xf'));var Papa=require('papaparse');var Redis=require(_0x8330('0x10'));var authService=require(_0x8330('0x11'));var qs=require(_0x8330('0x12'));var as=require('../../components/parsers/advancedSearch');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(_0x8330('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12d0ff,_0x1da381){_0x1da381=_0x1da381||0xcc;return function(_0x252953){if(_0x252953){return _0x12d0ff[_0x8330('0x14')](_0x1da381);}return _0x12d0ff[_0x8330('0x15')](_0x1da381)['end']();};}function respondWithResult(_0x199da4,_0x4f0cf0){_0x4f0cf0=_0x4f0cf0||0xc8;return function(_0x293658){if(_0x293658){return _0x199da4[_0x8330('0x15')](_0x4f0cf0)[_0x8330('0x16')](_0x293658);}};}function respondWithFilteredResult(_0x962a55,_0x432aca){return function(_0x28998e){if(_0x28998e){var _0x2c3e2f=typeof _0x432aca[_0x8330('0x17')]===_0x8330('0x18')&&typeof _0x432aca['limit']===_0x8330('0x18');var _0x2486ba=_0x28998e['count'];var _0x25853c=_0x2c3e2f?0x0:_0x432aca[_0x8330('0x17')];var _0x457dc7=_0x2c3e2f?_0x28998e['count']:_0x432aca[_0x8330('0x17')]+_0x432aca['limit'];var _0x396f60;if(_0x457dc7>=_0x2486ba){_0x457dc7=_0x2486ba;_0x396f60=0xc8;}else{_0x396f60=0xce;}_0x962a55[_0x8330('0x15')](_0x396f60);return _0x962a55[_0x8330('0x19')](_0x8330('0x1a'),_0x25853c+'-'+_0x457dc7+'/'+_0x2486ba)['json'](_0x28998e);}return null;};}function patchUpdates(_0x31efc9){return function(_0x518236){try{jsonpatch[_0x8330('0x1b')](_0x518236,_0x31efc9,!![]);}catch(_0x5a62e9){return BPromise[_0x8330('0x1c')](_0x5a62e9);}return _0x518236[_0x8330('0x1d')]();};}function saveUpdates(_0x1b213f,_0x350895){return function(_0x317045){if(_0x317045){return _0x317045[_0x8330('0x1e')](_0x1b213f)[_0x8330('0x1f')](function(_0x467ac4){return _0x467ac4;});}return null;};}function removeEntity(_0x21ddaf,_0x2770ca){return function(_0x3fa722){if(_0x3fa722){return _0x3fa722['destroy']()['then'](function(){var _0x47fc29=_0x3fa722[_0x8330('0x20')]({'plain':!![]});var _0x1fb538=_0x8330('0x21');return db[_0x8330('0x22')][_0x8330('0x23')]({'where':{'type':_0x1fb538,'resourceId':_0x47fc29['id']}})[_0x8330('0x1f')](function(){return _0x3fa722;});})[_0x8330('0x1f')](function(){_0x21ddaf['status'](0xcc)[_0x8330('0x24')]();});}};}function handleEntityNotFound(_0x208eea,_0x545e15){return function(_0x27f0be){if(!_0x27f0be){_0x208eea[_0x8330('0x14')](0x194);}return _0x27f0be;};}function handleError(_0x333661,_0xbd2650){_0xbd2650=_0xbd2650||0x1f4;return function(_0x3cedfb){logger['error'](_0x3cedfb[_0x8330('0x25')]);if(_0x3cedfb['name']){delete _0x3cedfb[_0x8330('0x26')];}_0x333661[_0x8330('0x15')](_0xbd2650)[_0x8330('0x27')](_0x3cedfb);};}exports['index']=function(_0x3af04f,_0x6522be){var _0x553ca2={},_0x10afcc={},_0x56b20c={'count':0x0,'rows':[]};var _0xfdf68a=_[_0x8330('0x28')](db[_0x8330('0x29')][_0x8330('0x2a')],function(_0xcb775f){return{'name':_0xcb775f[_0x8330('0x2b')],'type':_0xcb775f[_0x8330('0x2c')][_0x8330('0x2d')]};});_0x10afcc[_0x8330('0x2e')]=_[_0x8330('0x28')](_0xfdf68a,_0x8330('0x26'));_0x10afcc['query']=_['keys'](_0x3af04f[_0x8330('0x2f')]);_0x10afcc['filters']=_[_0x8330('0x30')](_0x10afcc['model'],_0x10afcc['query']);_0x553ca2[_0x8330('0x31')]=_[_0x8330('0x30')](_0x10afcc[_0x8330('0x2e')],qs[_0x8330('0x32')](_0x3af04f['query'][_0x8330('0x32')]));_0x553ca2['attributes']=_0x553ca2[_0x8330('0x31')][_0x8330('0x33')]?_0x553ca2[_0x8330('0x31')]:_0x10afcc[_0x8330('0x2e')];if(!_0x3af04f[_0x8330('0x2f')][_0x8330('0x34')]('nolimit')){_0x553ca2[_0x8330('0x35')]=qs[_0x8330('0x35')](_0x3af04f[_0x8330('0x2f')][_0x8330('0x35')]);_0x553ca2[_0x8330('0x17')]=qs[_0x8330('0x17')](_0x3af04f[_0x8330('0x2f')][_0x8330('0x17')]);}_0x553ca2['order']=qs['sort'](_0x3af04f[_0x8330('0x2f')][_0x8330('0x36')]);_0x553ca2[_0x8330('0x37')]=qs[_0x8330('0x38')](_[_0x8330('0x39')](_0x3af04f[_0x8330('0x2f')],_0x10afcc[_0x8330('0x38')]),_0xfdf68a);if(_0x3af04f[_0x8330('0x2f')][_0x8330('0x3a')]){_0x553ca2['where']=_[_0x8330('0x3b')](_0x553ca2[_0x8330('0x37')],{'$or':_[_0x8330('0x28')](_0xfdf68a,function(_0x4245b7){if(_0x4245b7[_0x8330('0x2c')]!==_0x8330('0x3c')){var _0x3bf7eb={};_0x3bf7eb[_0x4245b7[_0x8330('0x26')]]={'$like':'%'+_0x3af04f[_0x8330('0x2f')][_0x8330('0x3a')]+'%'};return _0x3bf7eb;}})});}_0x553ca2=_[_0x8330('0x3b')]({},_0x553ca2,_0x3af04f[_0x8330('0x3d')]);var _0x2ca922={'where':_0x553ca2[_0x8330('0x37')]};return db[_0x8330('0x29')][_0x8330('0x3e')](_0x2ca922)['then'](function(_0x2e06fb){_0x56b20c[_0x8330('0x3e')]=_0x2e06fb;if(_0x3af04f[_0x8330('0x2f')][_0x8330('0x3f')]){_0x553ca2['include']=[{'all':!![]}];}return db[_0x8330('0x29')][_0x8330('0x40')](_0x553ca2);})[_0x8330('0x1f')](function(_0x11dabe){_0x56b20c['rows']=_0x11dabe;return _0x56b20c;})[_0x8330('0x1f')](respondWithFilteredResult(_0x6522be,_0x553ca2))['catch'](handleError(_0x6522be,null));};exports['show']=function(_0x1b28c4,_0x4dd2b0){var _0x59c5c6={'raw':![],'where':{'id':_0x1b28c4[_0x8330('0x41')]['id']}},_0x58c0e5={};_0x58c0e5[_0x8330('0x2e')]=_[_0x8330('0x42')](db[_0x8330('0x29')][_0x8330('0x2a')]);_0x58c0e5[_0x8330('0x2f')]=_[_0x8330('0x42')](_0x1b28c4[_0x8330('0x2f')]);_0x58c0e5[_0x8330('0x38')]=_['intersection'](_0x58c0e5[_0x8330('0x2e')],_0x58c0e5[_0x8330('0x2f')]);_0x59c5c6[_0x8330('0x31')]=_[_0x8330('0x30')](_0x58c0e5[_0x8330('0x2e')],qs[_0x8330('0x32')](_0x1b28c4[_0x8330('0x2f')][_0x8330('0x32')]));_0x59c5c6[_0x8330('0x31')]=_0x59c5c6[_0x8330('0x31')][_0x8330('0x33')]?_0x59c5c6[_0x8330('0x31')]:_0x58c0e5['model'];if(_0x1b28c4[_0x8330('0x2f')][_0x8330('0x3f')]){_0x59c5c6[_0x8330('0x43')]=[{'all':!![]}];}_0x59c5c6=_[_0x8330('0x3b')]({},_0x59c5c6,_0x1b28c4[_0x8330('0x3d')]);return db['JscriptyProject'][_0x8330('0x44')](_0x59c5c6)[_0x8330('0x1f')](handleEntityNotFound(_0x4dd2b0,null))[_0x8330('0x1f')](respondWithResult(_0x4dd2b0,null))['catch'](handleError(_0x4dd2b0,null));};exports[_0x8330('0x45')]=function(_0x504a75,_0x4d5466){return db[_0x8330('0x29')][_0x8330('0x45')](_0x504a75[_0x8330('0x46')],{})['then'](function(_0x4bb0f9){var _0x19d6f8=_0x504a75[_0x8330('0x47')][_0x8330('0x20')]({'plain':!![]});if(!_0x19d6f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19d6f8[_0x8330('0x48')]===_0x8330('0x47')){var _0x1c9e8d=_0x4bb0f9['get']({'plain':!![]});var _0x411ad1='Projects';return db[_0x8330('0x49')][_0x8330('0x44')]({'where':{'name':_0x411ad1,'userProfileId':_0x19d6f8[_0x8330('0x4a')]},'raw':!![]})['then'](function(_0x42e4fd){if(_0x42e4fd&&_0x42e4fd[_0x8330('0x4b')]===0x0){return db[_0x8330('0x22')][_0x8330('0x45')]({'name':_0x1c9e8d[_0x8330('0x26')],'resourceId':_0x1c9e8d['id'],'type':_0x42e4fd['name'],'sectionId':_0x42e4fd['id']},{})[_0x8330('0x1f')](function(){return _0x4bb0f9;});}else{return _0x4bb0f9;}})[_0x8330('0x4c')](function(_0x2b4a09){logger[_0x8330('0x4d')](_0x8330('0x4e'),_0x2b4a09);throw _0x2b4a09;});}return _0x4bb0f9;})[_0x8330('0x1f')](respondWithResult(_0x4d5466,0xc9))[_0x8330('0x4c')](handleError(_0x4d5466,null));};exports[_0x8330('0x4f')]=function(_0x2e5ebe,_0x30e92c){var _0x2265da={'where':{'id':_0x2e5ebe[_0x8330('0x41')]['id']}},_0x344eb2={};_0x344eb2['model']=_[_0x8330('0x42')](db['JscriptyProject']['rawAttributes']);_0x2265da[_0x8330('0x31')]=_[_0x8330('0x30')](_0x344eb2[_0x8330('0x2e')],qs[_0x8330('0x32')](_0x2e5ebe['query'][_0x8330('0x32')]));_0x2265da[_0x8330('0x31')]=_0x2265da[_0x8330('0x31')]['length']?_0x2265da[_0x8330('0x31')]:_0x344eb2[_0x8330('0x2e')];if(_0x2e5ebe[_0x8330('0x2f')]['includeAll']){_0x2265da['include']=[{'all':!![]}];}_0x2265da=_[_0x8330('0x3b')]({},_0x2265da,_0x2e5ebe[_0x8330('0x3d')]);return db[_0x8330('0x29')][_0x8330('0x44')](_0x2265da)[_0x8330('0x1f')](handleEntityNotFound(_0x30e92c,null))[_0x8330('0x1f')](function(_0x1eee9e){if(_0x1eee9e){var _0x61d908=_0x1eee9e[_0x8330('0x20')]({'plain':!![]});_0x61d908=qs[_0x8330('0x50')](_0x61d908,['id','createdAt',_0x8330('0x51')]);_0x2e5ebe['body']=_['omit'](_0x2e5ebe[_0x8330('0x46')],['id','createdAt',_0x8330('0x51')]);return db['JscriptyProject'][_0x8330('0x45')](_[_0x8330('0x3b')](_0x61d908,_0x2e5ebe[_0x8330('0x46')]),{'include':_0x2e5ebe[_0x8330('0x2f')]['includeAll']?[{'all':!![]}]:undefined})[_0x8330('0x1f')](function(_0x250e47){var _0x4d84be=_0x2e5ebe[_0x8330('0x47')]['get']({'plain':!![]});if(!_0x4d84be)throw new Error(_0x8330('0x52'));if(_0x4d84be[_0x8330('0x48')]===_0x8330('0x47')){var _0x1455cd=_0x250e47[_0x8330('0x20')]({'plain':!![]});var _0x169666='Projects';return db[_0x8330('0x49')][_0x8330('0x44')]({'where':{'name':_0x169666,'userProfileId':_0x4d84be[_0x8330('0x4a')]},'raw':!![]})[_0x8330('0x1f')](function(_0x4988b5){if(_0x4988b5&&_0x4988b5['autoAssociation']===0x0){return db[_0x8330('0x22')][_0x8330('0x45')]({'name':_0x1455cd[_0x8330('0x26')],'resourceId':_0x1455cd['id'],'type':_0x4988b5[_0x8330('0x26')],'sectionId':_0x4988b5['id']},{})[_0x8330('0x1f')](function(){return _0x250e47;});}else{return _0x250e47;}})['catch'](function(_0x4eca46){logger[_0x8330('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4eca46);throw _0x4eca46;});}return _0x250e47;});}})[_0x8330('0x1f')](respondWithResult(_0x30e92c,0xc9))['catch'](handleError(_0x30e92c,null));};exports[_0x8330('0x1e')]=function(_0x324a36,_0x249a28){if(_0x324a36[_0x8330('0x46')]['id']){delete _0x324a36[_0x8330('0x46')]['id'];}return db[_0x8330('0x29')]['find']({'where':{'id':_0x324a36[_0x8330('0x41')]['id']}})[_0x8330('0x1f')](handleEntityNotFound(_0x249a28,null))[_0x8330('0x1f')](saveUpdates(_0x324a36['body'],null))[_0x8330('0x1f')](respondWithResult(_0x249a28,null))[_0x8330('0x4c')](handleError(_0x249a28,null));};exports['destroy']=function(_0x43807a,_0x4812f1){return db[_0x8330('0x29')][_0x8330('0x44')]({'where':{'id':_0x43807a[_0x8330('0x41')]['id']}})[_0x8330('0x1f')](handleEntityNotFound(_0x4812f1,null))[_0x8330('0x1f')](removeEntity(_0x4812f1,null))[_0x8330('0x4c')](handleError(_0x4812f1,null));};exports['getSessions']=function(_0x380d6c,_0x4b9277,_0x17f124){var _0x219b86={'raw':!![],'where':{}};var _0x4e9dc3={};var _0x1ad7f6={'count':0x0,'rows':[]};return db[_0x8330('0x29')][_0x8330('0x53')]({'where':{'id':_0x380d6c['params']['id']}})[_0x8330('0x1f')](handleEntityNotFound(_0x4b9277,null))[_0x8330('0x1f')](function(_0x2f618e){if(_0x2f618e){_0x4e9dc3[_0x8330('0x2e')]=_['keys'](db[_0x8330('0x54')][_0x8330('0x2a')]);_0x4e9dc3[_0x8330('0x2f')]=_['keys'](_0x380d6c[_0x8330('0x2f')]);_0x4e9dc3['filters']=_[_0x8330('0x30')](_0x4e9dc3[_0x8330('0x2e')],_0x4e9dc3[_0x8330('0x2f')]);_0x219b86[_0x8330('0x31')]=_[_0x8330('0x30')](_0x4e9dc3[_0x8330('0x2e')],qs[_0x8330('0x32')](_0x380d6c[_0x8330('0x2f')][_0x8330('0x32')]));_0x219b86[_0x8330('0x31')]=_0x219b86[_0x8330('0x31')]['length']?_0x219b86['attributes']:_0x4e9dc3['model'];if(!_0x380d6c[_0x8330('0x2f')][_0x8330('0x34')](_0x8330('0x55'))){_0x219b86['limit']=qs[_0x8330('0x35')](_0x380d6c[_0x8330('0x2f')][_0x8330('0x35')]);_0x219b86[_0x8330('0x17')]=qs['offset'](_0x380d6c['query'][_0x8330('0x17')]);}_0x219b86[_0x8330('0x56')]=qs[_0x8330('0x36')](_0x380d6c[_0x8330('0x2f')][_0x8330('0x36')]);_0x219b86[_0x8330('0x37')]=qs[_0x8330('0x38')](_[_0x8330('0x39')](_0x380d6c[_0x8330('0x2f')],_0x4e9dc3['filters']));_0x219b86[_0x8330('0x37')]['ProjectId']=_0x2f618e['id'];if(_0x380d6c[_0x8330('0x2f')]['filter']){_0x219b86[_0x8330('0x37')]=_[_0x8330('0x3b')](_0x219b86[_0x8330('0x37')],{'$or':_[_0x8330('0x28')](_0x219b86[_0x8330('0x31')],function(_0x39115a){var _0x548e86={};_0x548e86[_0x39115a]={'$like':'%'+_0x380d6c[_0x8330('0x2f')]['filter']+'%'};return _0x548e86;})});}_0x219b86=_[_0x8330('0x3b')]({},_0x219b86,_0x380d6c[_0x8330('0x3d')]);return db[_0x8330('0x54')]['count']({'where':_0x219b86[_0x8330('0x37')]})['then'](function(_0x183419){_0x1ad7f6[_0x8330('0x3e')]=_0x183419;if(_0x380d6c['query']['includeAll']){_0x219b86[_0x8330('0x43')]=[{'all':!![]}];}return db[_0x8330('0x54')][_0x8330('0x40')](_0x219b86);})[_0x8330('0x1f')](function(_0x4e8e7a){_0x1ad7f6[_0x8330('0x57')]=_0x4e8e7a;return _0x1ad7f6;});}})[_0x8330('0x1f')](respondWithFilteredResult(_0x4b9277,_0x219b86))['catch'](handleError(_0x4b9277,null));};exports[_0x8330('0x58')]=function(_0x3bb360,_0x418f81,_0x5db852){var _0x2520ce={'raw':!![],'where':{}};var _0x1403b3={};var _0x316d80={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x8330('0x53')]({'where':{'id':_0x3bb360[_0x8330('0x41')]['id']}})[_0x8330('0x1f')](handleEntityNotFound(_0x418f81,null))[_0x8330('0x1f')](function(_0x3bfb4f){if(_0x3bfb4f){_0x1403b3['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x1403b3[_0x8330('0x2f')]=_[_0x8330('0x42')](_0x3bb360['query']);_0x1403b3[_0x8330('0x38')]=_[_0x8330('0x30')](_0x1403b3[_0x8330('0x2e')],_0x1403b3['query']);_0x2520ce['attributes']=_[_0x8330('0x30')](_0x1403b3[_0x8330('0x2e')],qs[_0x8330('0x32')](_0x3bb360[_0x8330('0x2f')][_0x8330('0x32')]));_0x2520ce[_0x8330('0x31')]=_0x2520ce['attributes'][_0x8330('0x33')]?_0x2520ce[_0x8330('0x31')]:_0x1403b3[_0x8330('0x2e')];if(!_0x3bb360[_0x8330('0x2f')][_0x8330('0x34')](_0x8330('0x55'))){_0x2520ce[_0x8330('0x35')]=qs[_0x8330('0x35')](_0x3bb360['query'][_0x8330('0x35')]);_0x2520ce[_0x8330('0x17')]=qs[_0x8330('0x17')](_0x3bb360['query'][_0x8330('0x17')]);}_0x2520ce[_0x8330('0x56')]=qs[_0x8330('0x36')](_0x3bb360[_0x8330('0x2f')][_0x8330('0x36')]);_0x2520ce[_0x8330('0x37')]=qs[_0x8330('0x38')](_['pick'](_0x3bb360[_0x8330('0x2f')],_0x1403b3[_0x8330('0x38')]));_0x2520ce[_0x8330('0x37')]['ProjectId']=_0x3bfb4f['id'];if(_0x3bb360[_0x8330('0x2f')][_0x8330('0x3a')]){_0x2520ce[_0x8330('0x37')]=_[_0x8330('0x3b')](_0x2520ce[_0x8330('0x37')],{'$or':_[_0x8330('0x28')](_0x2520ce['attributes'],function(_0x2c8f77){var _0x23ab95={};_0x23ab95[_0x2c8f77]={'$like':'%'+_0x3bb360['query'][_0x8330('0x3a')]+'%'};return _0x23ab95;})});}_0x2520ce=_[_0x8330('0x3b')]({},_0x2520ce,_0x3bb360[_0x8330('0x3d')]);return db['JscriptyAnswerReport'][_0x8330('0x3e')]({'where':_0x2520ce[_0x8330('0x37')]})[_0x8330('0x1f')](function(_0x1f717c){_0x316d80[_0x8330('0x3e')]=_0x1f717c;if(_0x3bb360[_0x8330('0x2f')][_0x8330('0x3f')]){_0x2520ce[_0x8330('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x8330('0x40')](_0x2520ce);})['then'](function(_0x12d22f){_0x316d80[_0x8330('0x57')]=_0x12d22f;return _0x316d80;});}})[_0x8330('0x1f')](respondWithFilteredResult(_0x418f81,_0x2520ce))[_0x8330('0x4c')](handleError(_0x418f81,null));};function char(_0x5828e9){return'number'===typeof _0x5828e9?String[_0x8330('0x59')][_0x8330('0x1b')](null,arguments):_0x5828e9;}function needsEncapsulation(_0x50aec6){return!!_0x50aec6&&(_0x50aec6[_0x8330('0x5a')]()[_0x8330('0x5b')](char(0xd))>=0x0||_0x50aec6[_0x8330('0x5a')]()[_0x8330('0x5b')](char(0xa))>=0x0||_0x50aec6['toString']()[_0x8330('0x5b')](char(0x2c))>=0x0||_0x50aec6[_0x8330('0x5a')]()[_0x8330('0x5b')](char(0x22))>=0x0);}function encapsulate(_0xd46cba){var _0x32bbf6=char(0x22),_0x1d4999='\x5c'+char(0x22),_0x58a0af=_0xd46cba[_0x8330('0x5a')]()[_0x8330('0x5c')](new RegExp(_0x32bbf6,'g'),_0x1d4999);return _0x32bbf6+_0x58a0af+_0x32bbf6;}exports['getSummary']=function(_0x5812af,_0x102611,_0x4610b6){var _0x459e1b,_0x530490;var _0xaadcdc={'where':{'ProjectId':_0x5812af[_0x8330('0x41')]['id']}};if(_0x5812af[_0x8330('0x2f')][_0x8330('0x5d')]){_0xaadcdc[_0x8330('0x37')][_0x8330('0x5e')]=JSON[_0x8330('0x5f')](_0x5812af['query']['startTime']);}return db[_0x8330('0x54')]['findAll'](_0xaadcdc)[_0x8330('0x1f')](handleEntityNotFound(_0x102611,null))[_0x8330('0x1f')](function(_0x5c9c63){if(_0x5c9c63){_0x459e1b=_0x5c9c63;return db[_0x8330('0x60')]['findAll']({'where':{'SessionId':{'$in':_[_0x8330('0x28')](_0x459e1b,'id')},'ProjectId':_0x5812af[_0x8330('0x41')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x102611,null))[_0x8330('0x1f')](function(_0x1d3a0a){if(_0x1d3a0a){_0x530490=_0x1d3a0a;var _0x1418a4={};for(var _0x23ece8=0x0,_0x2fac86=_0x530490[_0x8330('0x33')];_0x23ece8<_0x2fac86;_0x23ece8++){if(!_0x1418a4[_0x8330('0x34')](_0x530490[_0x23ece8][_0x8330('0x61')])){_0x1418a4[_0x530490[_0x23ece8][_0x8330('0x61')]]=needsEncapsulation(_0x530490[_0x23ece8][_0x8330('0x62')])?encapsulate(_0x530490[_0x23ece8]['question']):_0x530490[_0x23ece8]['question'];}}var _0x2a4355=[],_0x255850={};for(var _0x14eb7b=0x0,_0x329699=_0x459e1b[_0x8330('0x33')];_0x14eb7b<_0x329699;_0x14eb7b++){_0x255850={'ProjectId':_0x5812af['params']['id'],'SessionId':_0x459e1b[_0x14eb7b]['id'],'StartTime':moment(_0x459e1b[_0x14eb7b][_0x8330('0x5e')])['format'](_0x8330('0x63'))};for(var _0x1d785c=0x0,_0x34255f=_0x530490[_0x8330('0x33')];_0x1d785c<_0x34255f;_0x1d785c++){if(_0x530490[_0x1d785c]['SessionId']==_0x459e1b[_0x14eb7b]['id']&&_0x1418a4['hasOwnProperty'](_0x530490[_0x1d785c]['questionId'])){_0x255850[_0x1418a4[_0x530490[_0x1d785c][_0x8330('0x61')]]]=_0x530490[_0x1d785c][_0x8330('0x64')];}}for(var _0x2daaac in _0x1418a4){if(!_0x255850[_0x8330('0x34')](_0x1418a4[_0x2daaac])){_0x255850[_0x1418a4[_0x2daaac]]=null;}}_0x2a4355[_0x8330('0x65')](_0x255850);}return _0x2a4355;}})['then'](function(_0x4353ba){if(!_[_0x8330('0x66')](_0x4353ba)){var _0x37daa6=toCsv(_0x4353ba);var _0x51f66d=Date[_0x8330('0x67')]();fs['writeFileSync'](util[_0x8330('0x68')](_0x8330('0x69'),_0x5812af[_0x8330('0x41')]['id'],_0x51f66d),_0x37daa6);_0x102611['setHeader']('Content-disposition',_0x8330('0x6a')+util[_0x8330('0x68')](_0x8330('0x6b'),_0x5812af[_0x8330('0x41')]['id'],_0x51f66d));_0x102611[_0x8330('0x6c')](_0x8330('0x6d'),_0x8330('0x6e'));return _0x102611[_0x8330('0x6f')](util['format'](_0x8330('0x69'),_0x5812af[_0x8330('0x41')]['id'],_0x51f66d));}else{return _0x102611[_0x8330('0x14')](0xcc);}})['catch'](handleError(_0x102611,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 69e3ae5..5091215 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 _0x67a2=['define','jscripty_projects','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2018b9,_0x325ec5){var _0x4073c2=function(_0x20f268){while(--_0x20f268){_0x2018b9['push'](_0x2018b9['shift']());}};_0x4073c2(++_0x325ec5);}(_0x67a2,0xd3));var _0x267a=function(_0x7c50d1,_0xef867f){_0x7c50d1=_0x7c50d1-0x0;var _0x1389a1=_0x67a2[_0x7c50d1];return _0x1389a1;};'use strict';var _=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var logger=require('../../config/logger')(_0x267a('0x2'));var moment=require(_0x267a('0x3'));var BPromise=require(_0x267a('0x4'));var rp=require(_0x267a('0x5'));var fs=require('fs');var path=require(_0x267a('0x6'));var rimraf=require(_0x267a('0x7'));var config=require(_0x267a('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x17090d,_0x3539d5){return _0x17090d[_0x267a('0x9')]('JscriptyProject',attributes,{'tableName':_0x267a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0bb=['JscriptyProject','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x444a41,_0x2f4714){var _0x10265f=function(_0x19d2e8){while(--_0x19d2e8){_0x444a41['push'](_0x444a41['shift']());}};_0x10265f(++_0x2f4714);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3f2ad0,_0x10d42b){_0x3f2ad0=_0x3f2ad0-0x0;var _0x5a9b8d=_0xd0bb[_0x3f2ad0];return _0x5a9b8d;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 7a861f2..4c024d4 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x47f2c5,_0x40c84b){var _0x38b405=function(_0x22c2aa){while(--_0x22c2aa){_0x47f2c5['push'](_0x47f2c5['shift']());}};_0x38b405(++_0x40c84b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x18e8c7,_0x5d852c){_0x18e8c7=_0x18e8c7-0x0;var _0x2a458c=_0xf4eb[_0x18e8c7];return _0x2a458c;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x339d9c,_0x5ec5a2){var _0x17c848=function(_0xaa760){while(--_0xaa760){_0x339d9c['push'](_0x339d9c['shift']());}};_0x17c848(++_0x5ec5a2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0xcb91[_0xc40b9f];return _0x535b9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7746cec..3436d7c 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 _0xd5ca=['delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x3365ce,_0x531219){var _0x5b60b8=function(_0x2d197b){while(--_0x2d197b){_0x3365ce['push'](_0x3365ce['shift']());}};_0x5b60b8(++_0x531219);}(_0xd5ca,0x169));var _0xad5c=function(_0x5e13cc,_0xa904b){_0x5e13cc=_0x5e13cc-0x0;var _0x3410db=_0xd5ca[_0x5e13cc];return _0x3410db;};'use strict';var multer=require(_0xad5c('0x0'));var util=require(_0xad5c('0x1'));var path=require(_0xad5c('0x2'));var timeout=require(_0xad5c('0x3'));var express=require(_0xad5c('0x4'));var router=express[_0xad5c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xad5c('0x6'));var config=require(_0xad5c('0x7'));var controller=require(_0xad5c('0x8'));router['get']('/',auth[_0xad5c('0x9')](),controller[_0xad5c('0xa')]);router[_0xad5c('0xb')](_0xad5c('0xc'),auth[_0xad5c('0x9')](),controller[_0xad5c('0xd')]);router['get'](_0xad5c('0xe'),auth[_0xad5c('0x9')](),controller[_0xad5c('0xf')]);router[_0xad5c('0x10')]('/',auth[_0xad5c('0x9')](),controller[_0xad5c('0x11')]);router[_0xad5c('0x12')](_0xad5c('0xe'),auth[_0xad5c('0x9')](),controller['update']);router[_0xad5c('0x13')](_0xad5c('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x611a=['isAuthenticated','describe','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x611a,0x143));var _0xa611=function(_0x271a05,_0x51c891){_0x271a05=_0x271a05-0x0;var _0x434450=_0x611a[_0x271a05];return _0x434450;};'use strict';var multer=require(_0xa611('0x0'));var util=require(_0xa611('0x1'));var path=require(_0xa611('0x2'));var timeout=require(_0xa611('0x3'));var express=require(_0xa611('0x4'));var router=express[_0xa611('0x5')]();var fs_extra=require(_0xa611('0x6'));var auth=require(_0xa611('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa611('0x8'));var controller=require(_0xa611('0x9'));router[_0xa611('0xa')]('/',auth['isAuthenticated'](),controller[_0xa611('0xb')]);router[_0xa611('0xa')](_0xa611('0xc'),auth[_0xa611('0xd')](),controller[_0xa611('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa611('0xd')](),controller[_0xa611('0xf')]);router['put'](_0xa611('0x10'),auth[_0xa611('0xd')](),controller[_0xa611('0x11')]);router[_0xa611('0x12')](_0xa611('0x10'),auth[_0xa611('0xd')](),controller[_0xa611('0x13')]);module[_0xa611('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 cc09630..099c460 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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x581e77,_0x4a5bf9){_0x581e77=_0x581e77-0x0;var _0x638fa5=_0x7a54[_0x581e77];return _0x638fa5;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a54,0x106));var _0x47a5=function(_0xcb5980,_0x472e42){_0xcb5980=_0xcb5980-0x0;var _0x5141e0=_0x7a54[_0xcb5980];return _0x5141e0;};'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 33c553f..b2f5559 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 _0xa17f=['name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','apply','update','destroy','then','error','stack'];(function(_0x4d8764,_0xd13d7b){var _0x4e0b49=function(_0x56126a){while(--_0x56126a){_0x4d8764['push'](_0x4d8764['shift']());}};_0x4e0b49(++_0xd13d7b);}(_0xa17f,0xfc));var _0xfa17=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0xa17f[_0x2d91c6];return _0x3a8d19;};'use strict';var emlformat=require(_0xfa17('0x0'));var rimraf=require(_0xfa17('0x1'));var zipdir=require(_0xfa17('0x2'));var jsonpatch=require(_0xfa17('0x3'));var rp=require('request-promise');var moment=require(_0xfa17('0x4'));var BPromise=require(_0xfa17('0x5'));var Mustache=require(_0xfa17('0x6'));var util=require(_0xfa17('0x7'));var path=require(_0xfa17('0x8'));var sox=require('sox');var csv=require(_0xfa17('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa17('0xa'));var _=require(_0xfa17('0xb'));var squel=require(_0xfa17('0xc'));var crypto=require(_0xfa17('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa17('0x9'));var querystring=require(_0xfa17('0xe'));var Papa=require(_0xfa17('0xf'));var Redis=require(_0xfa17('0x10'));var authService=require(_0xfa17('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa17('0x12'));var utils=require(_0xfa17('0x13'));var config=require(_0xfa17('0x14'));var licenseUtil=require(_0xfa17('0x15'));var db=require(_0xfa17('0x16'))['db'];function respondWithStatusCode(_0x1a9650,_0x5107ca){_0x5107ca=_0x5107ca||0xcc;return function(_0x4f7db5){if(_0x4f7db5){return _0x1a9650[_0xfa17('0x17')](_0x5107ca);}return _0x1a9650['status'](_0x5107ca)['end']();};}function respondWithResult(_0x1a76e2,_0x54ee7f){_0x54ee7f=_0x54ee7f||0xc8;return function(_0x5ca5b9){if(_0x5ca5b9){return _0x1a76e2[_0xfa17('0x18')](_0x54ee7f)[_0xfa17('0x19')](_0x5ca5b9);}};}function respondWithFilteredResult(_0x5acd8f,_0xd63e8a){return function(_0x80a136){if(_0x80a136){var _0x3a1de2=typeof _0xd63e8a['offset']==='undefined'&&typeof _0xd63e8a[_0xfa17('0x1a')]===_0xfa17('0x1b');var _0x568c2a=_0x80a136[_0xfa17('0x1c')];var _0x1615f1=_0x3a1de2?0x0:_0xd63e8a[_0xfa17('0x1d')];var _0x1432a9=_0x3a1de2?_0x80a136['count']:_0xd63e8a[_0xfa17('0x1d')]+_0xd63e8a[_0xfa17('0x1a')];var _0x3cfab0;if(_0x1432a9>=_0x568c2a){_0x1432a9=_0x568c2a;_0x3cfab0=0xc8;}else{_0x3cfab0=0xce;}_0x5acd8f[_0xfa17('0x18')](_0x3cfab0);return _0x5acd8f['set']('Content-Range',_0x1615f1+'-'+_0x1432a9+'/'+_0x568c2a)[_0xfa17('0x19')](_0x80a136);}return null;};}function patchUpdates(_0x7dabd7){return function(_0x58c11f){try{jsonpatch[_0xfa17('0x1e')](_0x58c11f,_0x7dabd7,!![]);}catch(_0x4e5bff){return BPromise['reject'](_0x4e5bff);}return _0x58c11f['save']();};}function saveUpdates(_0x82dd10,_0x3f07ea){return function(_0x51157d){if(_0x51157d){return _0x51157d[_0xfa17('0x1f')](_0x82dd10)['then'](function(_0x3cf24c){return _0x3cf24c;});}return null;};}function removeEntity(_0x46f453,_0x2ba461){return function(_0x52e4a5){if(_0x52e4a5){return _0x52e4a5[_0xfa17('0x20')]()[_0xfa17('0x21')](function(){_0x46f453[_0xfa17('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7139aa,_0x1ef0ac){return function(_0x529afa){if(!_0x529afa){_0x7139aa[_0xfa17('0x17')](0x194);}return _0x529afa;};}function handleError(_0x23aaab,_0x5d1bf6){_0x5d1bf6=_0x5d1bf6||0x1f4;return function(_0x2508b5){logger[_0xfa17('0x22')](_0x2508b5[_0xfa17('0x23')]);if(_0x2508b5['name']){delete _0x2508b5[_0xfa17('0x24')];}_0x23aaab[_0xfa17('0x18')](_0x5d1bf6)[_0xfa17('0x25')](_0x2508b5);};}exports[_0xfa17('0x26')]=function(_0x2a0bb4,_0x117b62){var _0x44d956={},_0x59b4ab={},_0x462dc4={'count':0x0,'rows':[]};var _0x3449d6=_[_0xfa17('0x27')](db[_0xfa17('0x28')][_0xfa17('0x29')],function(_0xfe8f14){return{'name':_0xfe8f14[_0xfa17('0x2a')],'type':_0xfe8f14['type'][_0xfa17('0x2b')]};});_0x59b4ab[_0xfa17('0x2c')]=_[_0xfa17('0x27')](_0x3449d6,_0xfa17('0x24'));_0x59b4ab['query']=_[_0xfa17('0x2d')](_0x2a0bb4['query']);_0x59b4ab[_0xfa17('0x2e')]=_['intersection'](_0x59b4ab[_0xfa17('0x2c')],_0x59b4ab['query']);_0x44d956[_0xfa17('0x2f')]=_[_0xfa17('0x30')](_0x59b4ab[_0xfa17('0x2c')],qs[_0xfa17('0x31')](_0x2a0bb4[_0xfa17('0x32')][_0xfa17('0x31')]));_0x44d956[_0xfa17('0x2f')]=_0x44d956[_0xfa17('0x2f')][_0xfa17('0x33')]?_0x44d956[_0xfa17('0x2f')]:_0x59b4ab[_0xfa17('0x2c')];if(!_0x2a0bb4['query'][_0xfa17('0x34')]('nolimit')){_0x44d956[_0xfa17('0x1a')]=qs[_0xfa17('0x1a')](_0x2a0bb4[_0xfa17('0x32')]['limit']);_0x44d956[_0xfa17('0x1d')]=qs[_0xfa17('0x1d')](_0x2a0bb4[_0xfa17('0x32')]['offset']);}_0x44d956[_0xfa17('0x35')]=qs[_0xfa17('0x36')](_0x2a0bb4['query']['sort']);_0x44d956[_0xfa17('0x37')]=qs[_0xfa17('0x2e')](_[_0xfa17('0x38')](_0x2a0bb4[_0xfa17('0x32')],_0x59b4ab['filters']),_0x3449d6);if(_0x2a0bb4['query'][_0xfa17('0x39')]){_0x44d956[_0xfa17('0x37')]=_[_0xfa17('0x3a')](_0x44d956['where'],{'$or':_[_0xfa17('0x27')](_0x3449d6,function(_0x5c60b9){if(_0x5c60b9[_0xfa17('0x3b')]!=='VIRTUAL'){var _0x95e2fe={};_0x95e2fe[_0x5c60b9['name']]={'$like':'%'+_0x2a0bb4['query'][_0xfa17('0x39')]+'%'};return _0x95e2fe;}})});}_0x44d956=_[_0xfa17('0x3a')]({},_0x44d956,_0x2a0bb4[_0xfa17('0x3c')]);var _0x5c3457={'where':_0x44d956[_0xfa17('0x37')]};return db[_0xfa17('0x28')]['count'](_0x5c3457)[_0xfa17('0x21')](function(_0x2bb531){_0x462dc4[_0xfa17('0x1c')]=_0x2bb531;if(_0x2a0bb4[_0xfa17('0x32')][_0xfa17('0x3d')]){_0x44d956[_0xfa17('0x3e')]=[{'all':!![]}];}return db[_0xfa17('0x28')][_0xfa17('0x3f')](_0x44d956);})[_0xfa17('0x21')](function(_0x5ad85e){_0x462dc4[_0xfa17('0x40')]=_0x5ad85e;return _0x462dc4;})[_0xfa17('0x21')](respondWithFilteredResult(_0x117b62,_0x44d956))[_0xfa17('0x41')](handleError(_0x117b62,null));};exports[_0xfa17('0x42')]=function(_0xa6515c,_0x5b55a1){var _0x165ec9={'raw':!![],'where':{'id':_0xa6515c[_0xfa17('0x43')]['id']}},_0x40413f={};_0x40413f['model']=_[_0xfa17('0x2d')](db[_0xfa17('0x28')]['rawAttributes']);_0x40413f[_0xfa17('0x32')]=_[_0xfa17('0x2d')](_0xa6515c[_0xfa17('0x32')]);_0x40413f[_0xfa17('0x2e')]=_[_0xfa17('0x30')](_0x40413f[_0xfa17('0x2c')],_0x40413f[_0xfa17('0x32')]);_0x165ec9[_0xfa17('0x2f')]=_[_0xfa17('0x30')](_0x40413f[_0xfa17('0x2c')],qs['fields'](_0xa6515c[_0xfa17('0x32')][_0xfa17('0x31')]));_0x165ec9[_0xfa17('0x2f')]=_0x165ec9['attributes'][_0xfa17('0x33')]?_0x165ec9[_0xfa17('0x2f')]:_0x40413f[_0xfa17('0x2c')];if(_0xa6515c[_0xfa17('0x32')]['includeAll']){_0x165ec9[_0xfa17('0x3e')]=[{'all':!![]}];}_0x165ec9=_[_0xfa17('0x3a')]({},_0x165ec9,_0xa6515c[_0xfa17('0x3c')]);return db[_0xfa17('0x28')][_0xfa17('0x44')](_0x165ec9)['then'](handleEntityNotFound(_0x5b55a1,null))[_0xfa17('0x21')](respondWithResult(_0x5b55a1,null))['catch'](handleError(_0x5b55a1,null));};exports[_0xfa17('0x45')]=function(_0x380b6d,_0x58edc1){return db[_0xfa17('0x28')]['create'](_0x380b6d[_0xfa17('0x46')],{})[_0xfa17('0x21')](respondWithResult(_0x58edc1,0xc9))[_0xfa17('0x41')](handleError(_0x58edc1,null));};exports[_0xfa17('0x1f')]=function(_0x3dcf53,_0x57942b){if(_0x3dcf53[_0xfa17('0x46')]['id']){delete _0x3dcf53['body']['id'];}return db[_0xfa17('0x28')]['find']({'where':{'id':_0x3dcf53[_0xfa17('0x43')]['id']}})[_0xfa17('0x21')](handleEntityNotFound(_0x57942b,null))[_0xfa17('0x21')](saveUpdates(_0x3dcf53[_0xfa17('0x46')],null))[_0xfa17('0x21')](respondWithResult(_0x57942b,null))[_0xfa17('0x41')](handleError(_0x57942b,null));};exports['destroy']=function(_0x5b799d,_0x219774){return db[_0xfa17('0x28')][_0xfa17('0x44')]({'where':{'id':_0x5b799d[_0xfa17('0x43')]['id']}})[_0xfa17('0x21')](handleEntityNotFound(_0x219774,null))['then'](removeEntity(_0x219774,null))[_0xfa17('0x41')](handleError(_0x219774,null));};exports[_0xfa17('0x47')]=function(_0x52a1b7,_0x5d68fb){return db[_0xfa17('0x28')][_0xfa17('0x47')]()[_0xfa17('0x21')](respondWithResult(_0x5d68fb,null))[_0xfa17('0x41')](handleError(_0x5d68fb,null));}; \ No newline at end of file +var _0x063e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','JscriptyQuestionReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x063e,0x194));var _0xe063=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x063e[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0xe063('0x0'));var rimraf=require(_0xe063('0x1'));var zipdir=require(_0xe063('0x2'));var jsonpatch=require(_0xe063('0x3'));var rp=require(_0xe063('0x4'));var moment=require(_0xe063('0x5'));var BPromise=require(_0xe063('0x6'));var Mustache=require(_0xe063('0x7'));var util=require(_0xe063('0x8'));var path=require(_0xe063('0x9'));var sox=require(_0xe063('0xa'));var csv=require(_0xe063('0xb'));var ejs=require(_0xe063('0xc'));var fs=require('fs');var fs_extra=require(_0xe063('0xd'));var _=require(_0xe063('0xe'));var squel=require(_0xe063('0xf'));var crypto=require(_0xe063('0x10'));var jsforce=require(_0xe063('0x11'));var deskjs=require(_0xe063('0x12'));var toCsv=require(_0xe063('0xb'));var querystring=require(_0xe063('0x13'));var Papa=require(_0xe063('0x14'));var Redis=require(_0xe063('0x15'));var authService=require(_0xe063('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xe063('0x17'));var hardwareService=require(_0xe063('0x18'));var logger=require(_0xe063('0x19'))(_0xe063('0x1a'));var utils=require(_0xe063('0x1b'));var config=require(_0xe063('0x1c'));var licenseUtil=require(_0xe063('0x1d'));var db=require(_0xe063('0x1e'))['db'];function respondWithStatusCode(_0x5000a7,_0x5d2dbe){_0x5d2dbe=_0x5d2dbe||0xcc;return function(_0x4475bd){if(_0x4475bd){return _0x5000a7['sendStatus'](_0x5d2dbe);}return _0x5000a7[_0xe063('0x1f')](_0x5d2dbe)['end']();};}function respondWithResult(_0x79663f,_0x515328){_0x515328=_0x515328||0xc8;return function(_0x1c80fd){if(_0x1c80fd){return _0x79663f[_0xe063('0x1f')](_0x515328)[_0xe063('0x20')](_0x1c80fd);}};}function respondWithFilteredResult(_0x39fab1,_0x263ea8){return function(_0x725cfb){if(_0x725cfb){var _0x392340=typeof _0x263ea8[_0xe063('0x21')]==='undefined'&&typeof _0x263ea8[_0xe063('0x22')]===_0xe063('0x23');var _0x18b6ab=_0x725cfb[_0xe063('0x24')];var _0x381455=_0x392340?0x0:_0x263ea8[_0xe063('0x21')];var _0x565b77=_0x392340?_0x725cfb[_0xe063('0x24')]:_0x263ea8[_0xe063('0x21')]+_0x263ea8['limit'];var _0x17a266;if(_0x565b77>=_0x18b6ab){_0x565b77=_0x18b6ab;_0x17a266=0xc8;}else{_0x17a266=0xce;}_0x39fab1[_0xe063('0x1f')](_0x17a266);return _0x39fab1[_0xe063('0x25')](_0xe063('0x26'),_0x381455+'-'+_0x565b77+'/'+_0x18b6ab)[_0xe063('0x20')](_0x725cfb);}return null;};}function patchUpdates(_0x2291a7){return function(_0x4d44ac){try{jsonpatch[_0xe063('0x27')](_0x4d44ac,_0x2291a7,!![]);}catch(_0x5539b9){return BPromise['reject'](_0x5539b9);}return _0x4d44ac[_0xe063('0x28')]();};}function saveUpdates(_0x5981a3,_0x192d2e){return function(_0x1be65d){if(_0x1be65d){return _0x1be65d[_0xe063('0x29')](_0x5981a3)[_0xe063('0x2a')](function(_0x5623da){return _0x5623da;});}return null;};}function removeEntity(_0x5cfe57,_0x4bd3f4){return function(_0x3219a4){if(_0x3219a4){return _0x3219a4[_0xe063('0x2b')]()[_0xe063('0x2a')](function(){_0x5cfe57[_0xe063('0x1f')](0xcc)[_0xe063('0x2c')]();});}};}function handleEntityNotFound(_0x5ecf78,_0x1efcde){return function(_0x4bb897){if(!_0x4bb897){_0x5ecf78[_0xe063('0x2d')](0x194);}return _0x4bb897;};}function handleError(_0x3cb706,_0x18feff){_0x18feff=_0x18feff||0x1f4;return function(_0x4e8915){logger[_0xe063('0x2e')](_0x4e8915['stack']);if(_0x4e8915['name']){delete _0x4e8915[_0xe063('0x2f')];}_0x3cb706[_0xe063('0x1f')](_0x18feff)[_0xe063('0x30')](_0x4e8915);};}exports[_0xe063('0x31')]=function(_0x1695d5,_0x1af78a){var _0x1221f9={},_0x4e27d2={},_0x541eae={'count':0x0,'rows':[]};var _0x538f65=_[_0xe063('0x32')](db['JscriptyQuestionReport'][_0xe063('0x33')],function(_0x26df6b){return{'name':_0x26df6b[_0xe063('0x34')],'type':_0x26df6b[_0xe063('0x35')]['key']};});_0x4e27d2[_0xe063('0x36')]=_['map'](_0x538f65,_0xe063('0x2f'));_0x4e27d2[_0xe063('0x37')]=_[_0xe063('0x38')](_0x1695d5[_0xe063('0x37')]);_0x4e27d2[_0xe063('0x39')]=_[_0xe063('0x3a')](_0x4e27d2['model'],_0x4e27d2[_0xe063('0x37')]);_0x1221f9[_0xe063('0x3b')]=_[_0xe063('0x3a')](_0x4e27d2[_0xe063('0x36')],qs[_0xe063('0x3c')](_0x1695d5[_0xe063('0x37')]['fields']));_0x1221f9['attributes']=_0x1221f9[_0xe063('0x3b')][_0xe063('0x3d')]?_0x1221f9[_0xe063('0x3b')]:_0x4e27d2[_0xe063('0x36')];if(!_0x1695d5[_0xe063('0x37')][_0xe063('0x3e')](_0xe063('0x3f'))){_0x1221f9[_0xe063('0x22')]=qs[_0xe063('0x22')](_0x1695d5['query'][_0xe063('0x22')]);_0x1221f9[_0xe063('0x21')]=qs['offset'](_0x1695d5['query'][_0xe063('0x21')]);}_0x1221f9[_0xe063('0x40')]=qs[_0xe063('0x41')](_0x1695d5['query'][_0xe063('0x41')]);_0x1221f9['where']=qs['filters'](_['pick'](_0x1695d5[_0xe063('0x37')],_0x4e27d2[_0xe063('0x39')]),_0x538f65);if(_0x1695d5[_0xe063('0x37')]['filter']){_0x1221f9[_0xe063('0x42')]=_[_0xe063('0x43')](_0x1221f9[_0xe063('0x42')],{'$or':_[_0xe063('0x32')](_0x538f65,function(_0x55ebf9){if(_0x55ebf9[_0xe063('0x35')]!=='VIRTUAL'){var _0x2342e8={};_0x2342e8[_0x55ebf9[_0xe063('0x2f')]]={'$like':'%'+_0x1695d5[_0xe063('0x37')][_0xe063('0x44')]+'%'};return _0x2342e8;}})});}_0x1221f9=_[_0xe063('0x43')]({},_0x1221f9,_0x1695d5[_0xe063('0x45')]);var _0x6e845a={'where':_0x1221f9[_0xe063('0x42')]};return db[_0xe063('0x46')][_0xe063('0x24')](_0x6e845a)['then'](function(_0x2a36a2){_0x541eae[_0xe063('0x24')]=_0x2a36a2;if(_0x1695d5[_0xe063('0x37')][_0xe063('0x47')]){_0x1221f9[_0xe063('0x48')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xe063('0x49')](_0x1221f9);})['then'](function(_0x48e98a){_0x541eae['rows']=_0x48e98a;return _0x541eae;})['then'](respondWithFilteredResult(_0x1af78a,_0x1221f9))[_0xe063('0x4a')](handleError(_0x1af78a,null));};exports[_0xe063('0x4b')]=function(_0x53b18c,_0x2eb7c6){var _0x594b86={'raw':!![],'where':{'id':_0x53b18c[_0xe063('0x4c')]['id']}},_0x3c47bc={};_0x3c47bc[_0xe063('0x36')]=_[_0xe063('0x38')](db[_0xe063('0x46')][_0xe063('0x33')]);_0x3c47bc[_0xe063('0x37')]=_[_0xe063('0x38')](_0x53b18c[_0xe063('0x37')]);_0x3c47bc['filters']=_['intersection'](_0x3c47bc['model'],_0x3c47bc['query']);_0x594b86['attributes']=_[_0xe063('0x3a')](_0x3c47bc[_0xe063('0x36')],qs[_0xe063('0x3c')](_0x53b18c[_0xe063('0x37')][_0xe063('0x3c')]));_0x594b86[_0xe063('0x3b')]=_0x594b86[_0xe063('0x3b')][_0xe063('0x3d')]?_0x594b86[_0xe063('0x3b')]:_0x3c47bc[_0xe063('0x36')];if(_0x53b18c[_0xe063('0x37')][_0xe063('0x47')]){_0x594b86[_0xe063('0x48')]=[{'all':!![]}];}_0x594b86=_[_0xe063('0x43')]({},_0x594b86,_0x53b18c[_0xe063('0x45')]);return db[_0xe063('0x46')][_0xe063('0x4d')](_0x594b86)[_0xe063('0x2a')](handleEntityNotFound(_0x2eb7c6,null))[_0xe063('0x2a')](respondWithResult(_0x2eb7c6,null))[_0xe063('0x4a')](handleError(_0x2eb7c6,null));};exports[_0xe063('0x4e')]=function(_0x2d3b3b,_0x2a0be7){return db[_0xe063('0x46')][_0xe063('0x4e')](_0x2d3b3b[_0xe063('0x4f')],{})['then'](respondWithResult(_0x2a0be7,0xc9))['catch'](handleError(_0x2a0be7,null));};exports['update']=function(_0x1bb59a,_0x32fa6a){if(_0x1bb59a[_0xe063('0x4f')]['id']){delete _0x1bb59a['body']['id'];}return db[_0xe063('0x46')][_0xe063('0x4d')]({'where':{'id':_0x1bb59a[_0xe063('0x4c')]['id']}})[_0xe063('0x2a')](handleEntityNotFound(_0x32fa6a,null))[_0xe063('0x2a')](saveUpdates(_0x1bb59a['body'],null))[_0xe063('0x2a')](respondWithResult(_0x32fa6a,null))[_0xe063('0x4a')](handleError(_0x32fa6a,null));};exports['destroy']=function(_0x256b80,_0x1b04fe){return db[_0xe063('0x46')][_0xe063('0x4d')]({'where':{'id':_0x256b80['params']['id']}})[_0xe063('0x2a')](handleEntityNotFound(_0x1b04fe,null))[_0xe063('0x2a')](removeEntity(_0x1b04fe,null))['catch'](handleError(_0x1b04fe,null));};exports['describe']=function(_0x4eaecd,_0x433802){return db['JscriptyQuestionReport'][_0xe063('0x50')]()[_0xe063('0x2a')](respondWithResult(_0x433802,null))[_0xe063('0x4a')](handleError(_0x433802,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 987d04c..eea80db 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 _0x5cdf=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_jscripty_questions','lodash','util'];(function(_0x22f296,_0x26a4ba){var _0x1f7fde=function(_0x1d153a){while(--_0x1d153a){_0x22f296['push'](_0x22f296['shift']());}};_0x1f7fde(++_0x26a4ba);}(_0x5cdf,0x98));var _0xf5cd=function(_0x3fc4fb,_0x58c04d){_0x3fc4fb=_0x3fc4fb-0x0;var _0x48619c=_0x5cdf[_0x3fc4fb];return _0x48619c;};'use strict';var _=require(_0xf5cd('0x0'));var util=require(_0xf5cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf5cd('0x2'));var BPromise=require(_0xf5cd('0x3'));var rp=require(_0xf5cd('0x4'));var fs=require('fs');var path=require(_0xf5cd('0x5'));var rimraf=require(_0xf5cd('0x6'));var config=require(_0xf5cd('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xf5cd('0x8')]=function(_0x410722,_0x44d041){return _0x410722[_0xf5cd('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0xf5cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68cf=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util','../../config/logger','moment'];(function(_0x44184d,_0x3cf139){var _0x8b9ae8=function(_0x553864){while(--_0x553864){_0x44184d['push'](_0x44184d['shift']());}};_0x8b9ae8(++_0x3cf139);}(_0x68cf,0x1dd));var _0xf68c=function(_0x3277a0,_0x1f52aa){_0x3277a0=_0x3277a0-0x0;var _0xe83ee6=_0x68cf[_0x3277a0];return _0xe83ee6;};'use strict';var _=require(_0xf68c('0x0'));var util=require(_0xf68c('0x1'));var logger=require(_0xf68c('0x2'))('api');var moment=require(_0xf68c('0x3'));var BPromise=require(_0xf68c('0x4'));var rp=require(_0xf68c('0x5'));var fs=require('fs');var path=require(_0xf68c('0x6'));var rimraf=require(_0xf68c('0x7'));var config=require(_0xf68c('0x8'));var attributes=require(_0xf68c('0x9'));module[_0xf68c('0xa')]=function(_0x4940cb,_0x487f09){return _0x4940cb[_0xf68c('0xb')]('JscriptyQuestionReport',attributes,{'tableName':_0xf68c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index b37bb21..d1764c6 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 _0x5125=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','code','error'];(function(_0x2ea490,_0x4d3bda){var _0x5add65=function(_0x27dd85){while(--_0x27dd85){_0x2ea490['push'](_0x2ea490['shift']());}};_0x5add65(++_0x4d3bda);}(_0x5125,0x8d));var _0x5512=function(_0x478aa8,_0x1d38dd){_0x478aa8=_0x478aa8-0x0;var _0x117609=_0x5125[_0x478aa8];return _0x117609;};'use strict';var _=require(_0x5512('0x0'));var util=require(_0x5512('0x1'));var moment=require(_0x5512('0x2'));var BPromise=require(_0x5512('0x3'));var rs=require(_0x5512('0x4'));var fs=require('fs');var Redis=require(_0x5512('0x5'));var db=require(_0x5512('0x6'))['db'];var utils=require(_0x5512('0x7'));var logger=require(_0x5512('0x8'))(_0x5512('0x9'));var config=require(_0x5512('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5512('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30f3ab,_0x561421,_0x4a9ff1){return new BPromise(function(_0x5e8456,_0x1ce654){return client[_0x5512('0xc')](_0x30f3ab,_0x4a9ff1)[_0x5512('0xd')](function(_0x346724){logger[_0x5512('0xe')](_0x5512('0xf'),_0x561421,_0x5512('0x10'));logger[_0x5512('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x561421,_0x5512('0x10'),JSON['stringify'](_0x346724));if(_0x346724['error']){if(_0x346724['error'][_0x5512('0x12')]===0x1f4){logger[_0x5512('0x13')](_0x5512('0xf'),_0x561421,_0x346724[_0x5512('0x13')][_0x5512('0x14')]);return _0x1ce654(_0x346724[_0x5512('0x13')][_0x5512('0x14')]);}logger[_0x5512('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x561421,_0x346724[_0x5512('0x13')][_0x5512('0x14')]);return _0x5e8456(_0x346724[_0x5512('0x13')]['message']);}else{logger[_0x5512('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x561421,'request\x20sent');_0x5e8456(_0x346724[_0x5512('0x15')][_0x5512('0x14')]);}})[_0x5512('0x16')](function(_0x5d0f81){logger[_0x5512('0x13')](_0x5512('0xf'),_0x561421,_0x5d0f81);_0x1ce654(_0x5d0f81);});});} \ No newline at end of file +var _0x72ef=['client','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1db8fb,_0x86b841){var _0x1e5502=function(_0x2a38c7){while(--_0x2a38c7){_0x1db8fb['push'](_0x1db8fb['shift']());}};_0x1e5502(++_0x86b841);}(_0x72ef,0x1f1));var _0xf72e=function(_0x1323fd,_0x3558f1){_0x1323fd=_0x1323fd-0x0;var _0x9e562c=_0x72ef[_0x1323fd];return _0x9e562c;};'use strict';var _=require(_0xf72e('0x0'));var util=require('util');var moment=require(_0xf72e('0x1'));var BPromise=require(_0xf72e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf72e('0x3'))['db'];var utils=require(_0xf72e('0x4'));var logger=require(_0xf72e('0x5'))(_0xf72e('0x6'));var config=require(_0xf72e('0x7'));var jayson=require(_0xf72e('0x8'));var client=jayson[_0xf72e('0x9')][_0xf72e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6cc9,_0x56d4b7,_0x3bd853){return new BPromise(function(_0x24ceb5,_0x1969dc){return client['request'](_0x3e6cc9,_0x3bd853)[_0xf72e('0xb')](function(_0xcff4fd){logger['info'](_0xf72e('0xc'),_0x56d4b7,_0xf72e('0xd'));logger[_0xf72e('0xe')](_0xf72e('0xf'),_0x56d4b7,'request\x20sent',JSON[_0xf72e('0x10')](_0xcff4fd));if(_0xcff4fd[_0xf72e('0x11')]){if(_0xcff4fd['error'][_0xf72e('0x12')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x56d4b7,_0xcff4fd[_0xf72e('0x11')][_0xf72e('0x13')]);return _0x1969dc(_0xcff4fd['error'][_0xf72e('0x13')]);}logger[_0xf72e('0x11')](_0xf72e('0xc'),_0x56d4b7,_0xcff4fd[_0xf72e('0x11')]['message']);return _0x24ceb5(_0xcff4fd['error'][_0xf72e('0x13')]);}else{logger[_0xf72e('0x14')](_0xf72e('0xc'),_0x56d4b7,_0xf72e('0xd'));_0x24ceb5(_0xcff4fd[_0xf72e('0x15')][_0xf72e('0x13')]);}})[_0xf72e('0x16')](function(_0xcd297a){logger[_0xf72e('0x11')](_0xf72e('0xc'),_0x56d4b7,_0xcd297a);_0x1969dc(_0xcd297a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5fcb7ce..e53da33 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 _0xcd1d=['update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','create','put'];(function(_0x3196b3,_0x213b1a){var _0x1828ff=function(_0x59bb9a){while(--_0x59bb9a){_0x3196b3['push'](_0x3196b3['shift']());}};_0x1828ff(++_0x213b1a);}(_0xcd1d,0xc2));var _0xdcd1=function(_0x1daca8,_0x5d2957){_0x1daca8=_0x1daca8-0x0;var _0x2dcdd8=_0xcd1d[_0x1daca8];return _0x2dcdd8;};'use strict';var multer=require(_0xdcd1('0x0'));var util=require(_0xdcd1('0x1'));var path=require('path');var timeout=require(_0xdcd1('0x2'));var express=require('express');var router=express[_0xdcd1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdcd1('0x4'));var interaction=require(_0xdcd1('0x5'));var config=require(_0xdcd1('0x6'));var controller=require(_0xdcd1('0x7'));router[_0xdcd1('0x8')]('/',auth[_0xdcd1('0x9')](),controller[_0xdcd1('0xa')]);router[_0xdcd1('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xdcd1('0xb')]);router[_0xdcd1('0x8')](_0xdcd1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdcd1('0x8')]('/:id/questions',auth[_0xdcd1('0x9')](),controller['getQuestions']);router['post']('/',auth[_0xdcd1('0x9')](),controller[_0xdcd1('0xd')]);router[_0xdcd1('0xe')](_0xdcd1('0xc'),auth[_0xdcd1('0x9')](),controller[_0xdcd1('0xf')]);router[_0xdcd1('0x10')](_0xdcd1('0xc'),auth[_0xdcd1('0x9')](),controller[_0xdcd1('0x11')]);module[_0xdcd1('0x12')]=router; \ No newline at end of file +var _0xb939=['fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','/:id/questions','getQuestions','post','delete','destroy','exports','util','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb939,0x1ad));var _0x9b93=function(_0x3e27cd,_0x518688){_0x3e27cd=_0x3e27cd-0x0;var _0x416d4b=_0xb939[_0x3e27cd];return _0x416d4b;};'use strict';var multer=require('multer');var util=require(_0x9b93('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b93('0x1'));var router=express[_0x9b93('0x2')]();var fs_extra=require(_0x9b93('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9b93('0x4'));var config=require(_0x9b93('0x5'));var controller=require(_0x9b93('0x6'));router[_0x9b93('0x7')]('/',auth[_0x9b93('0x8')](),controller[_0x9b93('0x9')]);router['get']('/describe',auth[_0x9b93('0x8')](),controller[_0x9b93('0xa')]);router[_0x9b93('0x7')](_0x9b93('0xb'),auth[_0x9b93('0x8')](),controller['show']);router[_0x9b93('0x7')](_0x9b93('0xc'),auth['isAuthenticated'](),controller[_0x9b93('0xd')]);router[_0x9b93('0xe')]('/',auth[_0x9b93('0x8')](),controller['create']);router['put'](_0x9b93('0xb'),auth[_0x9b93('0x8')](),controller['update']);router[_0x9b93('0xf')]('/:id',auth[_0x9b93('0x8')](),controller[_0x9b93('0x10')]);module[_0x9b93('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d64b447..c647579 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 _0x330c=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','starttime','setDataValue','endtime','format'];(function(_0x5b3eaf,_0x4b5588){var _0x35c66b=function(_0x1b29cc){while(--_0x1b29cc){_0x5b3eaf['push'](_0x5b3eaf['shift']());}};_0x35c66b(++_0x4b5588);}(_0x330c,0x7b));var _0xc330=function(_0x87397f,_0x52a3b1){_0x87397f=_0x87397f-0x0;var _0x53674b=_0x330c[_0x87397f];return _0x53674b;};'use strict';var moment=require('moment');var Sequelize=require(_0xc330('0x0'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x126ea2){this['setDataValue'](_0xc330('0x1'),_0x126ea2);this[_0xc330('0x2')](_0xc330('0x3'),moment()[_0xc330('0x4')](_0xc330('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc330('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc330('0x6')]},'calleridnum':{'type':Sequelize[_0xc330('0x6')]},'completed':{'type':Sequelize[_0xc330('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xebca=['starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xebca,0x1f4));var _0xaebc=function(_0x5c6aa1,_0x5792a2){_0x5c6aa1=_0x5c6aa1-0x0;var _0x23b899=_0xebca[_0x5c6aa1];return _0x23b899;};'use strict';var moment=require(_0xaebc('0x0'));var Sequelize=require(_0xaebc('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xaebc('0x2')],'set':function(_0x5a2e82){this[_0xaebc('0x3')](_0xaebc('0x4'),_0x5a2e82);this['setDataValue'](_0xaebc('0x5'),moment()['format'](_0xaebc('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xaebc('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xaebc('0x7')]},'uniqueid':{'type':Sequelize[_0xaebc('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaebc('0x7')]},'completed':{'type':Sequelize[_0xaebc('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 8949d79..600fb32 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 _0x2f3e=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','keys','include','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','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','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','type','key'];(function(_0x296096,_0x356972){var _0xc4ea79=function(_0x531d10){while(--_0x531d10){_0x296096['push'](_0x296096['shift']());}};_0xc4ea79(++_0x356972);}(_0x2f3e,0xc4));var _0xe2f3=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x2f3e[_0x406e46];return _0x4a3742;};'use strict';var emlformat=require(_0xe2f3('0x0'));var rimraf=require(_0xe2f3('0x1'));var zipdir=require(_0xe2f3('0x2'));var jsonpatch=require(_0xe2f3('0x3'));var rp=require(_0xe2f3('0x4'));var moment=require('moment');var BPromise=require(_0xe2f3('0x5'));var Mustache=require('mustache');var util=require(_0xe2f3('0x6'));var path=require(_0xe2f3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe2f3('0x8'));var fs=require('fs');var fs_extra=require(_0xe2f3('0x9'));var _=require(_0xe2f3('0xa'));var squel=require('squel');var crypto=require(_0xe2f3('0xb'));var jsforce=require(_0xe2f3('0xc'));var deskjs=require(_0xe2f3('0xd'));var toCsv=require(_0xe2f3('0xe'));var querystring=require(_0xe2f3('0xf'));var Papa=require(_0xe2f3('0x10'));var Redis=require('ioredis');var authService=require(_0xe2f3('0x11'));var qs=require(_0xe2f3('0x12'));var as=require(_0xe2f3('0x13'));var hardwareService=require(_0xe2f3('0x14'));var logger=require(_0xe2f3('0x15'))(_0xe2f3('0x16'));var utils=require(_0xe2f3('0x17'));var config=require(_0xe2f3('0x18'));var licenseUtil=require(_0xe2f3('0x19'));var db=require(_0xe2f3('0x1a'))['db'];function respondWithStatusCode(_0x3dc7fa,_0x42e273){_0x42e273=_0x42e273||0xcc;return function(_0x1f3d11){if(_0x1f3d11){return _0x3dc7fa['sendStatus'](_0x42e273);}return _0x3dc7fa[_0xe2f3('0x1b')](_0x42e273)[_0xe2f3('0x1c')]();};}function respondWithResult(_0x2c8df5,_0x3b2c74){_0x3b2c74=_0x3b2c74||0xc8;return function(_0x318771){if(_0x318771){return _0x2c8df5[_0xe2f3('0x1b')](_0x3b2c74)['json'](_0x318771);}};}function respondWithFilteredResult(_0x51abe5,_0x122679){return function(_0x57eca6){if(_0x57eca6){var _0x47add6=typeof _0x122679[_0xe2f3('0x1d')]===_0xe2f3('0x1e')&&typeof _0x122679[_0xe2f3('0x1f')]===_0xe2f3('0x1e');var _0x2aee40=_0x57eca6[_0xe2f3('0x20')];var _0x50062f=_0x47add6?0x0:_0x122679['offset'];var _0x1fedc0=_0x47add6?_0x57eca6['count']:_0x122679[_0xe2f3('0x1d')]+_0x122679[_0xe2f3('0x1f')];var _0x3e48d6;if(_0x1fedc0>=_0x2aee40){_0x1fedc0=_0x2aee40;_0x3e48d6=0xc8;}else{_0x3e48d6=0xce;}_0x51abe5[_0xe2f3('0x1b')](_0x3e48d6);return _0x51abe5[_0xe2f3('0x21')](_0xe2f3('0x22'),_0x50062f+'-'+_0x1fedc0+'/'+_0x2aee40)[_0xe2f3('0x23')](_0x57eca6);}return null;};}function patchUpdates(_0xdd2e82){return function(_0x1a00ad){try{jsonpatch[_0xe2f3('0x24')](_0x1a00ad,_0xdd2e82,!![]);}catch(_0x1a8694){return BPromise[_0xe2f3('0x25')](_0x1a8694);}return _0x1a00ad[_0xe2f3('0x26')]();};}function saveUpdates(_0x2ba073,_0x154fc2){return function(_0x14b532){if(_0x14b532){return _0x14b532['update'](_0x2ba073)['then'](function(_0x50f6bb){return _0x50f6bb;});}return null;};}function removeEntity(_0x10d5ab,_0x16284c){return function(_0x25949b){if(_0x25949b){return _0x25949b[_0xe2f3('0x27')]()[_0xe2f3('0x28')](function(){_0x10d5ab[_0xe2f3('0x1b')](0xcc)[_0xe2f3('0x1c')]();});}};}function handleEntityNotFound(_0x41f8f0,_0x52ebd6){return function(_0x58eebd){if(!_0x58eebd){_0x41f8f0['sendStatus'](0x194);}return _0x58eebd;};}function handleError(_0x35e14a,_0x531b11){_0x531b11=_0x531b11||0x1f4;return function(_0x3d3c88){logger[_0xe2f3('0x29')](_0x3d3c88[_0xe2f3('0x2a')]);if(_0x3d3c88['name']){delete _0x3d3c88[_0xe2f3('0x2b')];}_0x35e14a[_0xe2f3('0x1b')](_0x531b11)[_0xe2f3('0x2c')](_0x3d3c88);};}exports[_0xe2f3('0x2d')]=function(_0x2712e5,_0x141153){var _0x2d31d5={},_0x3224e2={},_0x341faa={'count':0x0,'rows':[]};var _0x33305f=_[_0xe2f3('0x2e')](db[_0xe2f3('0x2f')]['rawAttributes'],function(_0x52a66a){return{'name':_0x52a66a['fieldName'],'type':_0x52a66a[_0xe2f3('0x30')][_0xe2f3('0x31')]};});_0x3224e2[_0xe2f3('0x32')]=_[_0xe2f3('0x2e')](_0x33305f,_0xe2f3('0x2b'));_0x3224e2[_0xe2f3('0x33')]=_['keys'](_0x2712e5['query']);_0x3224e2[_0xe2f3('0x34')]=_[_0xe2f3('0x35')](_0x3224e2[_0xe2f3('0x32')],_0x3224e2[_0xe2f3('0x33')]);_0x2d31d5[_0xe2f3('0x36')]=_['intersection'](_0x3224e2[_0xe2f3('0x32')],qs[_0xe2f3('0x37')](_0x2712e5[_0xe2f3('0x33')][_0xe2f3('0x37')]));_0x2d31d5[_0xe2f3('0x36')]=_0x2d31d5[_0xe2f3('0x36')][_0xe2f3('0x38')]?_0x2d31d5['attributes']:_0x3224e2[_0xe2f3('0x32')];if(!_0x2712e5[_0xe2f3('0x33')][_0xe2f3('0x39')]('nolimit')){_0x2d31d5[_0xe2f3('0x1f')]=qs[_0xe2f3('0x1f')](_0x2712e5[_0xe2f3('0x33')][_0xe2f3('0x1f')]);_0x2d31d5[_0xe2f3('0x1d')]=qs['offset'](_0x2712e5[_0xe2f3('0x33')][_0xe2f3('0x1d')]);}_0x2d31d5['order']=qs['sort'](_0x2712e5[_0xe2f3('0x33')][_0xe2f3('0x3a')]);_0x2d31d5[_0xe2f3('0x3b')]=qs[_0xe2f3('0x34')](_['pick'](_0x2712e5['query'],_0x3224e2[_0xe2f3('0x34')]),_0x33305f);if(_0x2712e5[_0xe2f3('0x33')][_0xe2f3('0x3c')]){_0x2d31d5[_0xe2f3('0x3b')]=_['merge'](_0x2d31d5[_0xe2f3('0x3b')],{'$or':_[_0xe2f3('0x2e')](_0x33305f,function(_0x5b417d){if(_0x5b417d[_0xe2f3('0x30')]!==_0xe2f3('0x3d')){var _0x30b357={};_0x30b357[_0x5b417d[_0xe2f3('0x2b')]]={'$like':'%'+_0x2712e5[_0xe2f3('0x33')]['filter']+'%'};return _0x30b357;}})});}_0x2d31d5=_[_0xe2f3('0x3e')]({},_0x2d31d5,_0x2712e5[_0xe2f3('0x3f')]);var _0x2c3829={'where':_0x2d31d5[_0xe2f3('0x3b')]};return db[_0xe2f3('0x2f')]['count'](_0x2c3829)[_0xe2f3('0x28')](function(_0x3f5693){_0x341faa[_0xe2f3('0x20')]=_0x3f5693;if(_0x2712e5[_0xe2f3('0x33')][_0xe2f3('0x40')]){_0x2d31d5['include']=[{'all':!![]}];}return db[_0xe2f3('0x2f')][_0xe2f3('0x41')](_0x2d31d5);})[_0xe2f3('0x28')](function(_0x3a973d){_0x341faa['rows']=_0x3a973d;return _0x341faa;})[_0xe2f3('0x28')](respondWithFilteredResult(_0x141153,_0x2d31d5))[_0xe2f3('0x42')](handleError(_0x141153,null));};exports[_0xe2f3('0x43')]=function(_0x3b1f85,_0x2117d1){var _0x456a2a={'raw':!![],'where':{'id':_0x3b1f85[_0xe2f3('0x44')]['id']}},_0x572d73={};_0x572d73[_0xe2f3('0x32')]=_['keys'](db[_0xe2f3('0x2f')][_0xe2f3('0x45')]);_0x572d73[_0xe2f3('0x33')]=_[_0xe2f3('0x46')](_0x3b1f85[_0xe2f3('0x33')]);_0x572d73[_0xe2f3('0x34')]=_[_0xe2f3('0x35')](_0x572d73[_0xe2f3('0x32')],_0x572d73['query']);_0x456a2a[_0xe2f3('0x36')]=_['intersection'](_0x572d73['model'],qs[_0xe2f3('0x37')](_0x3b1f85[_0xe2f3('0x33')][_0xe2f3('0x37')]));_0x456a2a[_0xe2f3('0x36')]=_0x456a2a['attributes'][_0xe2f3('0x38')]?_0x456a2a['attributes']:_0x572d73[_0xe2f3('0x32')];if(_0x3b1f85[_0xe2f3('0x33')][_0xe2f3('0x40')]){_0x456a2a[_0xe2f3('0x47')]=[{'all':!![]}];}_0x456a2a=_[_0xe2f3('0x3e')]({},_0x456a2a,_0x3b1f85[_0xe2f3('0x3f')]);return db[_0xe2f3('0x2f')]['find'](_0x456a2a)['then'](handleEntityNotFound(_0x2117d1,null))[_0xe2f3('0x28')](respondWithResult(_0x2117d1,null))[_0xe2f3('0x42')](handleError(_0x2117d1,null));};exports[_0xe2f3('0x48')]=function(_0x253c58,_0x4f6e47){return db[_0xe2f3('0x2f')][_0xe2f3('0x48')](_0x253c58[_0xe2f3('0x49')],{})[_0xe2f3('0x28')](respondWithResult(_0x4f6e47,0xc9))[_0xe2f3('0x42')](handleError(_0x4f6e47,null));};exports['update']=function(_0x3d237f,_0x33bb8c){if(_0x3d237f[_0xe2f3('0x49')]['id']){delete _0x3d237f['body']['id'];}return db['JscriptySessionReport'][_0xe2f3('0x4a')]({'where':{'id':_0x3d237f[_0xe2f3('0x44')]['id']}})[_0xe2f3('0x28')](handleEntityNotFound(_0x33bb8c,null))['then'](saveUpdates(_0x3d237f['body'],null))['then'](respondWithResult(_0x33bb8c,null))[_0xe2f3('0x42')](handleError(_0x33bb8c,null));};exports[_0xe2f3('0x27')]=function(_0x418a9c,_0x50ae8e){return db['JscriptySessionReport']['find']({'where':{'id':_0x418a9c[_0xe2f3('0x44')]['id']}})[_0xe2f3('0x28')](handleEntityNotFound(_0x50ae8e,null))['then'](removeEntity(_0x50ae8e,null))[_0xe2f3('0x42')](handleError(_0x50ae8e,null));};exports[_0xe2f3('0x4b')]=function(_0xe9db06,_0x3d2e6c){return db[_0xe2f3('0x2f')]['describe']()[_0xe2f3('0x28')](respondWithResult(_0x3d2e6c,null))[_0xe2f3('0x42')](handleError(_0x3d2e6c,null));};exports[_0xe2f3('0x4c')]=function(_0xcde226,_0x5f25d2,_0x51134b){var _0x175054={'raw':!![],'where':{}};var _0x470de7={};var _0x55cfa6={'count':0x0,'rows':[]};return db[_0xe2f3('0x2f')][_0xe2f3('0x4d')]({'where':{'id':_0xcde226['params']['id']}})[_0xe2f3('0x28')](handleEntityNotFound(_0x5f25d2,null))[_0xe2f3('0x28')](function(_0x124c41){if(_0x124c41){_0x470de7[_0xe2f3('0x32')]=_['keys'](db[_0xe2f3('0x4e')]['rawAttributes']);_0x470de7[_0xe2f3('0x33')]=_[_0xe2f3('0x46')](_0xcde226[_0xe2f3('0x33')]);_0x470de7['filters']=_[_0xe2f3('0x35')](_0x470de7['model'],_0x470de7[_0xe2f3('0x33')]);_0x175054[_0xe2f3('0x36')]=_[_0xe2f3('0x35')](_0x470de7[_0xe2f3('0x32')],qs['fields'](_0xcde226[_0xe2f3('0x33')][_0xe2f3('0x37')]));_0x175054[_0xe2f3('0x36')]=_0x175054['attributes']['length']?_0x175054[_0xe2f3('0x36')]:_0x470de7[_0xe2f3('0x32')];if(!_0xcde226[_0xe2f3('0x33')]['hasOwnProperty']('nolimit')){_0x175054[_0xe2f3('0x1f')]=qs[_0xe2f3('0x1f')](_0xcde226[_0xe2f3('0x33')]['limit']);_0x175054[_0xe2f3('0x1d')]=qs['offset'](_0xcde226['query'][_0xe2f3('0x1d')]);}_0x175054[_0xe2f3('0x4f')]=qs[_0xe2f3('0x3a')](_0xcde226['query'][_0xe2f3('0x3a')]);_0x175054[_0xe2f3('0x3b')]=qs['filters'](_['pick'](_0xcde226['query'],_0x470de7[_0xe2f3('0x34')]));_0x175054['where'][_0xe2f3('0x50')]=_0x124c41['id'];if(_0xcde226['query'][_0xe2f3('0x3c')]){_0x175054[_0xe2f3('0x3b')]=_[_0xe2f3('0x3e')](_0x175054[_0xe2f3('0x3b')],{'$or':_[_0xe2f3('0x2e')](_0x175054[_0xe2f3('0x36')],function(_0x2d2388){var _0xfef84={};_0xfef84[_0x2d2388]={'$like':'%'+_0xcde226[_0xe2f3('0x33')][_0xe2f3('0x3c')]+'%'};return _0xfef84;})});}_0x175054=_['merge']({},_0x175054,_0xcde226[_0xe2f3('0x3f')]);return db[_0xe2f3('0x4e')][_0xe2f3('0x20')]({'where':_0x175054[_0xe2f3('0x3b')]})['then'](function(_0x4c8c5f){_0x55cfa6[_0xe2f3('0x20')]=_0x4c8c5f;if(_0xcde226[_0xe2f3('0x33')][_0xe2f3('0x40')]){_0x175054[_0xe2f3('0x47')]=[{'all':!![]}];}return db[_0xe2f3('0x4e')]['findAll'](_0x175054);})[_0xe2f3('0x28')](function(_0x3eebfb){_0x55cfa6[_0xe2f3('0x51')]=_0x3eebfb;return _0x55cfa6;});}})[_0xe2f3('0x28')](respondWithFilteredResult(_0x5f25d2,_0x175054))[_0xe2f3('0x42')](handleError(_0x5f25d2,null));}; \ No newline at end of file +var _0xbf11=['type','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','body','update','find','getQuestions','findOne','params','JscriptyQuestionReport','length','nolimit','order','pick','SessionId','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName'];(function(_0xef812f,_0x3fa15c){var _0x253625=function(_0x4b17f9){while(--_0x4b17f9){_0xef812f['push'](_0xef812f['shift']());}};_0x253625(++_0x3fa15c);}(_0xbf11,0x108));var _0x1bf1=function(_0x42e06a,_0x2f5fd1){_0x42e06a=_0x42e06a-0x0;var _0x3d3c90=_0xbf11[_0x42e06a];return _0x3d3c90;};'use strict';var emlformat=require(_0x1bf1('0x0'));var rimraf=require(_0x1bf1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bf1('0x2'));var rp=require('request-promise');var moment=require(_0x1bf1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1bf1('0x4'));var util=require(_0x1bf1('0x5'));var path=require(_0x1bf1('0x6'));var sox=require(_0x1bf1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bf1('0x8'));var squel=require(_0x1bf1('0x9'));var crypto=require(_0x1bf1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1bf1('0xb'));var toCsv=require(_0x1bf1('0xc'));var querystring=require(_0x1bf1('0xd'));var Papa=require(_0x1bf1('0xe'));var Redis=require('ioredis');var authService=require(_0x1bf1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1bf1('0x10'));var hardwareService=require(_0x1bf1('0x11'));var logger=require('../../config/logger')(_0x1bf1('0x12'));var utils=require(_0x1bf1('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ce78,_0x53e448){_0x53e448=_0x53e448||0xcc;return function(_0x7b677f){if(_0x7b677f){return _0x24ce78['sendStatus'](_0x53e448);}return _0x24ce78[_0x1bf1('0x14')](_0x53e448)[_0x1bf1('0x15')]();};}function respondWithResult(_0x3783b2,_0x331dd0){_0x331dd0=_0x331dd0||0xc8;return function(_0x2c2716){if(_0x2c2716){return _0x3783b2[_0x1bf1('0x14')](_0x331dd0)[_0x1bf1('0x16')](_0x2c2716);}};}function respondWithFilteredResult(_0x45693e,_0x5e1446){return function(_0x85a023){if(_0x85a023){var _0x518063=typeof _0x5e1446[_0x1bf1('0x17')]===_0x1bf1('0x18')&&typeof _0x5e1446['limit']===_0x1bf1('0x18');var _0x2459ba=_0x85a023[_0x1bf1('0x19')];var _0x546d52=_0x518063?0x0:_0x5e1446[_0x1bf1('0x17')];var _0x37f81d=_0x518063?_0x85a023[_0x1bf1('0x19')]:_0x5e1446[_0x1bf1('0x17')]+_0x5e1446[_0x1bf1('0x1a')];var _0x41fd39;if(_0x37f81d>=_0x2459ba){_0x37f81d=_0x2459ba;_0x41fd39=0xc8;}else{_0x41fd39=0xce;}_0x45693e['status'](_0x41fd39);return _0x45693e[_0x1bf1('0x1b')](_0x1bf1('0x1c'),_0x546d52+'-'+_0x37f81d+'/'+_0x2459ba)[_0x1bf1('0x16')](_0x85a023);}return null;};}function patchUpdates(_0x24dc0e){return function(_0x3818d8){try{jsonpatch[_0x1bf1('0x1d')](_0x3818d8,_0x24dc0e,!![]);}catch(_0xbeff53){return BPromise[_0x1bf1('0x1e')](_0xbeff53);}return _0x3818d8[_0x1bf1('0x1f')]();};}function saveUpdates(_0x4cdd68,_0x232ceb){return function(_0x466b16){if(_0x466b16){return _0x466b16['update'](_0x4cdd68)[_0x1bf1('0x20')](function(_0x453294){return _0x453294;});}return null;};}function removeEntity(_0x2dc71a,_0x3ec4c6){return function(_0x34db3f){if(_0x34db3f){return _0x34db3f[_0x1bf1('0x21')]()[_0x1bf1('0x20')](function(){_0x2dc71a[_0x1bf1('0x14')](0xcc)[_0x1bf1('0x15')]();});}};}function handleEntityNotFound(_0x3277da,_0x18a2fc){return function(_0x1c933f){if(!_0x1c933f){_0x3277da[_0x1bf1('0x22')](0x194);}return _0x1c933f;};}function handleError(_0x321d4f,_0x2a77c8){_0x2a77c8=_0x2a77c8||0x1f4;return function(_0x47e016){logger[_0x1bf1('0x23')](_0x47e016[_0x1bf1('0x24')]);if(_0x47e016[_0x1bf1('0x25')]){delete _0x47e016[_0x1bf1('0x25')];}_0x321d4f['status'](_0x2a77c8)[_0x1bf1('0x26')](_0x47e016);};}exports[_0x1bf1('0x27')]=function(_0x2d214e,_0x573ab8){var _0x3138a7={},_0x713834={},_0x5cd672={'count':0x0,'rows':[]};var _0x4ec176=_[_0x1bf1('0x28')](db[_0x1bf1('0x29')][_0x1bf1('0x2a')],function(_0x4474e0){return{'name':_0x4474e0[_0x1bf1('0x2b')],'type':_0x4474e0[_0x1bf1('0x2c')]['key']};});_0x713834[_0x1bf1('0x2d')]=_[_0x1bf1('0x28')](_0x4ec176,_0x1bf1('0x25'));_0x713834[_0x1bf1('0x2e')]=_[_0x1bf1('0x2f')](_0x2d214e[_0x1bf1('0x2e')]);_0x713834['filters']=_[_0x1bf1('0x30')](_0x713834['model'],_0x713834['query']);_0x3138a7[_0x1bf1('0x31')]=_[_0x1bf1('0x30')](_0x713834['model'],qs[_0x1bf1('0x32')](_0x2d214e[_0x1bf1('0x2e')][_0x1bf1('0x32')]));_0x3138a7[_0x1bf1('0x31')]=_0x3138a7[_0x1bf1('0x31')]['length']?_0x3138a7[_0x1bf1('0x31')]:_0x713834[_0x1bf1('0x2d')];if(!_0x2d214e[_0x1bf1('0x2e')][_0x1bf1('0x33')]('nolimit')){_0x3138a7['limit']=qs[_0x1bf1('0x1a')](_0x2d214e[_0x1bf1('0x2e')][_0x1bf1('0x1a')]);_0x3138a7[_0x1bf1('0x17')]=qs[_0x1bf1('0x17')](_0x2d214e['query'][_0x1bf1('0x17')]);}_0x3138a7['order']=qs['sort'](_0x2d214e[_0x1bf1('0x2e')][_0x1bf1('0x34')]);_0x3138a7[_0x1bf1('0x35')]=qs[_0x1bf1('0x36')](_['pick'](_0x2d214e[_0x1bf1('0x2e')],_0x713834['filters']),_0x4ec176);if(_0x2d214e['query'][_0x1bf1('0x37')]){_0x3138a7['where']=_[_0x1bf1('0x38')](_0x3138a7[_0x1bf1('0x35')],{'$or':_[_0x1bf1('0x28')](_0x4ec176,function(_0x59f35d){if(_0x59f35d[_0x1bf1('0x2c')]!==_0x1bf1('0x39')){var _0x19b89e={};_0x19b89e[_0x59f35d[_0x1bf1('0x25')]]={'$like':'%'+_0x2d214e[_0x1bf1('0x2e')]['filter']+'%'};return _0x19b89e;}})});}_0x3138a7=_['merge']({},_0x3138a7,_0x2d214e[_0x1bf1('0x3a')]);var _0x1f3c4f={'where':_0x3138a7['where']};return db[_0x1bf1('0x29')][_0x1bf1('0x19')](_0x1f3c4f)['then'](function(_0x122792){_0x5cd672[_0x1bf1('0x19')]=_0x122792;if(_0x2d214e[_0x1bf1('0x2e')][_0x1bf1('0x3b')]){_0x3138a7[_0x1bf1('0x3c')]=[{'all':!![]}];}return db[_0x1bf1('0x29')][_0x1bf1('0x3d')](_0x3138a7);})[_0x1bf1('0x20')](function(_0x408eb8){_0x5cd672[_0x1bf1('0x3e')]=_0x408eb8;return _0x5cd672;})['then'](respondWithFilteredResult(_0x573ab8,_0x3138a7))[_0x1bf1('0x3f')](handleError(_0x573ab8,null));};exports[_0x1bf1('0x40')]=function(_0x13bdf6,_0x3f210f){var _0xf2e2d3={'raw':!![],'where':{'id':_0x13bdf6['params']['id']}},_0x5c7030={};_0x5c7030['model']=_[_0x1bf1('0x2f')](db[_0x1bf1('0x29')][_0x1bf1('0x2a')]);_0x5c7030[_0x1bf1('0x2e')]=_[_0x1bf1('0x2f')](_0x13bdf6[_0x1bf1('0x2e')]);_0x5c7030[_0x1bf1('0x36')]=_[_0x1bf1('0x30')](_0x5c7030['model'],_0x5c7030[_0x1bf1('0x2e')]);_0xf2e2d3[_0x1bf1('0x31')]=_[_0x1bf1('0x30')](_0x5c7030[_0x1bf1('0x2d')],qs['fields'](_0x13bdf6[_0x1bf1('0x2e')][_0x1bf1('0x32')]));_0xf2e2d3['attributes']=_0xf2e2d3['attributes']['length']?_0xf2e2d3[_0x1bf1('0x31')]:_0x5c7030[_0x1bf1('0x2d')];if(_0x13bdf6['query']['includeAll']){_0xf2e2d3[_0x1bf1('0x3c')]=[{'all':!![]}];}_0xf2e2d3=_[_0x1bf1('0x38')]({},_0xf2e2d3,_0x13bdf6[_0x1bf1('0x3a')]);return db[_0x1bf1('0x29')]['find'](_0xf2e2d3)[_0x1bf1('0x20')](handleEntityNotFound(_0x3f210f,null))[_0x1bf1('0x20')](respondWithResult(_0x3f210f,null))['catch'](handleError(_0x3f210f,null));};exports['create']=function(_0x58ab07,_0x590664){return db[_0x1bf1('0x29')]['create'](_0x58ab07[_0x1bf1('0x41')],{})[_0x1bf1('0x20')](respondWithResult(_0x590664,0xc9))['catch'](handleError(_0x590664,null));};exports[_0x1bf1('0x42')]=function(_0x52bb3e,_0x50c9ec){if(_0x52bb3e[_0x1bf1('0x41')]['id']){delete _0x52bb3e['body']['id'];}return db[_0x1bf1('0x29')][_0x1bf1('0x43')]({'where':{'id':_0x52bb3e['params']['id']}})[_0x1bf1('0x20')](handleEntityNotFound(_0x50c9ec,null))[_0x1bf1('0x20')](saveUpdates(_0x52bb3e['body'],null))[_0x1bf1('0x20')](respondWithResult(_0x50c9ec,null))[_0x1bf1('0x3f')](handleError(_0x50c9ec,null));};exports[_0x1bf1('0x21')]=function(_0x3ff684,_0xaad16e){return db[_0x1bf1('0x29')]['find']({'where':{'id':_0x3ff684['params']['id']}})[_0x1bf1('0x20')](handleEntityNotFound(_0xaad16e,null))['then'](removeEntity(_0xaad16e,null))['catch'](handleError(_0xaad16e,null));};exports['describe']=function(_0x202c44,_0x10eba4){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x10eba4,null))[_0x1bf1('0x3f')](handleError(_0x10eba4,null));};exports[_0x1bf1('0x44')]=function(_0x232511,_0x4bb643,_0x3a38f7){var _0x42e5c6={'raw':!![],'where':{}};var _0x118173={};var _0x15cb33={'count':0x0,'rows':[]};return db[_0x1bf1('0x29')][_0x1bf1('0x45')]({'where':{'id':_0x232511[_0x1bf1('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bb643,null))[_0x1bf1('0x20')](function(_0xc2fde5){if(_0xc2fde5){_0x118173['model']=_[_0x1bf1('0x2f')](db[_0x1bf1('0x47')][_0x1bf1('0x2a')]);_0x118173['query']=_[_0x1bf1('0x2f')](_0x232511['query']);_0x118173[_0x1bf1('0x36')]=_[_0x1bf1('0x30')](_0x118173['model'],_0x118173[_0x1bf1('0x2e')]);_0x42e5c6['attributes']=_[_0x1bf1('0x30')](_0x118173[_0x1bf1('0x2d')],qs[_0x1bf1('0x32')](_0x232511[_0x1bf1('0x2e')][_0x1bf1('0x32')]));_0x42e5c6[_0x1bf1('0x31')]=_0x42e5c6[_0x1bf1('0x31')][_0x1bf1('0x48')]?_0x42e5c6[_0x1bf1('0x31')]:_0x118173['model'];if(!_0x232511['query'][_0x1bf1('0x33')](_0x1bf1('0x49'))){_0x42e5c6[_0x1bf1('0x1a')]=qs['limit'](_0x232511[_0x1bf1('0x2e')][_0x1bf1('0x1a')]);_0x42e5c6['offset']=qs['offset'](_0x232511[_0x1bf1('0x2e')]['offset']);}_0x42e5c6[_0x1bf1('0x4a')]=qs['sort'](_0x232511[_0x1bf1('0x2e')][_0x1bf1('0x34')]);_0x42e5c6['where']=qs[_0x1bf1('0x36')](_[_0x1bf1('0x4b')](_0x232511[_0x1bf1('0x2e')],_0x118173['filters']));_0x42e5c6[_0x1bf1('0x35')][_0x1bf1('0x4c')]=_0xc2fde5['id'];if(_0x232511[_0x1bf1('0x2e')][_0x1bf1('0x37')]){_0x42e5c6[_0x1bf1('0x35')]=_[_0x1bf1('0x38')](_0x42e5c6['where'],{'$or':_[_0x1bf1('0x28')](_0x42e5c6[_0x1bf1('0x31')],function(_0x1f2aef){var _0x41e6df={};_0x41e6df[_0x1f2aef]={'$like':'%'+_0x232511[_0x1bf1('0x2e')]['filter']+'%'};return _0x41e6df;})});}_0x42e5c6=_[_0x1bf1('0x38')]({},_0x42e5c6,_0x232511[_0x1bf1('0x3a')]);return db[_0x1bf1('0x47')][_0x1bf1('0x19')]({'where':_0x42e5c6[_0x1bf1('0x35')]})[_0x1bf1('0x20')](function(_0x517e8d){_0x15cb33[_0x1bf1('0x19')]=_0x517e8d;if(_0x232511[_0x1bf1('0x2e')]['includeAll']){_0x42e5c6[_0x1bf1('0x3c')]=[{'all':!![]}];}return db[_0x1bf1('0x47')]['findAll'](_0x42e5c6);})[_0x1bf1('0x20')](function(_0x599c53){_0x15cb33[_0x1bf1('0x3e')]=_0x599c53;return _0x15cb33;});}})[_0x1bf1('0x20')](respondWithFilteredResult(_0x4bb643,_0x42e5c6))[_0x1bf1('0x3f')](handleError(_0x4bb643,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ae162f3..0ffae45 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 _0xc1c6=['moment','request-promise','path','rimraf','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x291617,_0x321bfd){var _0x261729=function(_0x297f38){while(--_0x297f38){_0x291617['push'](_0x291617['shift']());}};_0x261729(++_0x321bfd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x461834,_0x25b9f9){_0x461834=_0x461834-0x0;var _0x12e5ce=_0xc1c6[_0x461834];return _0x12e5ce;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x26fbd9,_0x58d0e4){var _0x9ce764=function(_0x2e425f){while(--_0x2e425f){_0x26fbd9['push'](_0x26fbd9['shift']());}};_0x9ce764(++_0x58d0e4);}(_0x90b1,0x1bb));var _0x190b=function(_0xdfdeb7,_0x29649c){_0xdfdeb7=_0xdfdeb7-0x0;var _0x1db931=_0x90b1[_0xdfdeb7];return _0x1db931;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('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 dde5186..e7fcfc5 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x1c208e,_0x2a0a5b){var _0x5104ff=function(_0x3ca41f){while(--_0x3ca41f){_0x1c208e['push'](_0x1c208e['shift']());}};_0x5104ff(++_0x2a0a5b);}(_0x524e,0x15e));var _0xe524=function(_0x2de8be,_0x321eb0){_0x2de8be=_0x2de8be-0x0;var _0x152500=_0x524e[_0x2de8be];return _0x152500;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x958a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x3a1a17,_0x31f7cb){var _0x34d475=function(_0x4d2d48){while(--_0x4d2d48){_0x3a1a17['push'](_0x3a1a17['shift']());}};_0x34d475(++_0x31f7cb);}(_0x958a,0x128));var _0xa958=function(_0x401c2d,_0x56d65b){_0x401c2d=_0x401c2d-0x0;var _0xc1dd49=_0x958a[_0x401c2d];return _0xc1dd49;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index fda00a5..0ff8833 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 _0xadcf=['fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','util','path','connect-timeout','Router'];(function(_0x143bc1,_0x2f32f9){var _0x350f05=function(_0x55a204){while(--_0x55a204){_0x143bc1['push'](_0x143bc1['shift']());}};_0x350f05(++_0x2f32f9);}(_0xadcf,0x10a));var _0xfadc=function(_0x3f85b3,_0x5870a3){_0x3f85b3=_0x3f85b3-0x0;var _0x741189=_0xadcf[_0x3f85b3];return _0x741189;};'use strict';var multer=require('multer');var util=require(_0xfadc('0x0'));var path=require(_0xfadc('0x1'));var timeout=require(_0xfadc('0x2'));var express=require('express');var router=express[_0xfadc('0x3')]();var fs_extra=require(_0xfadc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfadc('0x5'));var config=require(_0xfadc('0x6'));var controller=require(_0xfadc('0x7'));router[_0xfadc('0x8')]('/',controller[_0xfadc('0x9')]);router[_0xfadc('0xa')](_0xfadc('0xb'),auth[_0xfadc('0xc')](),controller['update']);router[_0xfadc('0x8')](_0xfadc('0xd'),auth[_0xfadc('0xc')](),controller[_0xfadc('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0dc7=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','update','/download_log_file','isAuthenticated','downloadLogFile','exports','util'];(function(_0x51b80a,_0x355fe3){var _0x22fdf0=function(_0x152b3e){while(--_0x152b3e){_0x51b80a['push'](_0x51b80a['shift']());}};_0x22fdf0(++_0x355fe3);}(_0x0dc7,0x15d));var _0x70dc=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0x0dc7[_0x3fb5eb];return _0x481291;};'use strict';var multer=require('multer');var util=require(_0x70dc('0x0'));var path=require(_0x70dc('0x1'));var timeout=require(_0x70dc('0x2'));var express=require('express');var router=express[_0x70dc('0x3')]();var fs_extra=require(_0x70dc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x70dc('0x5'));var config=require(_0x70dc('0x6'));var controller=require('./license.controller');router[_0x70dc('0x7')]('/',controller[_0x70dc('0x8')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x70dc('0x9')]);router[_0x70dc('0x7')](_0x70dc('0xa'),auth[_0x70dc('0xb')](),controller[_0x70dc('0xc')]);module[_0x70dc('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c8b27f5..08427dd 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 _0x573a=['TEXT','STRING','sequelize'];(function(_0x5eed1b,_0x1b60e4){var _0x5eac36=function(_0x4374c9){while(--_0x4374c9){_0x5eed1b['push'](_0x5eed1b['shift']());}};_0x5eac36(++_0x1b60e4);}(_0x573a,0x1df));var _0xa573=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x573a[_0x24259d];return _0x5a701;};'use strict';var Sequelize=require(_0xa573('0x0'));module['exports']={'license':{'type':Sequelize[_0xa573('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xa573('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fec=['TEXT','STRING','sequelize','exports'];(function(_0x366798,_0x30b6e7){var _0x182352=function(_0x4b7df8){while(--_0x4b7df8){_0x366798['push'](_0x366798['shift']());}};_0x182352(++_0x30b6e7);}(_0x5fec,0x1ee));var _0xc5fe=function(_0x2cb55b,_0x53b0a8){_0x2cb55b=_0x2cb55b-0x0;var _0x4ce85e=_0x5fec[_0x2cb55b];return _0x4ce85e;};'use strict';var Sequelize=require(_0xc5fe('0x0'));module[_0xc5fe('0x1')]={'license':{'type':Sequelize[_0xc5fe('0x2')]},'data1':{'type':Sequelize[_0xc5fe('0x3')]},'data2':{'type':Sequelize[_0xc5fe('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 2334206..5087abd 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 _0x96ef=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','getLicense','body','get','checkLicense','key','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x96ef,0x109));var _0xf96e=function(_0x5727f8,_0x4a1444){_0x5727f8=_0x5727f8-0x0;var _0x55dd94=_0x96ef[_0x5727f8];return _0x55dd94;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf96e('0x0'));var jsonpatch=require(_0xf96e('0x1'));var rp=require(_0xf96e('0x2'));var moment=require(_0xf96e('0x3'));var BPromise=require(_0xf96e('0x4'));var Mustache=require(_0xf96e('0x5'));var util=require(_0xf96e('0x6'));var path=require(_0xf96e('0x7'));var sox=require('sox');var csv=require(_0xf96e('0x8'));var ejs=require(_0xf96e('0x9'));var fs=require('fs');var fs_extra=require(_0xf96e('0xa'));var _=require(_0xf96e('0xb'));var squel=require(_0xf96e('0xc'));var crypto=require(_0xf96e('0xd'));var jsforce=require(_0xf96e('0xe'));var deskjs=require(_0xf96e('0xf'));var toCsv=require(_0xf96e('0x8'));var querystring=require(_0xf96e('0x10'));var Papa=require(_0xf96e('0x11'));var Redis=require(_0xf96e('0x12'));var authService=require(_0xf96e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf96e('0x14'));var utils=require(_0xf96e('0x15'));var config=require(_0xf96e('0x16'));var licenseUtil=require(_0xf96e('0x17'));var db=require(_0xf96e('0x18'))['db'];function respondWithStatusCode(_0x4c6ec2,_0x1e5a35){_0x1e5a35=_0x1e5a35||0xcc;return function(_0x1d2a98){if(_0x1d2a98){return _0x4c6ec2[_0xf96e('0x19')](_0x1e5a35);}return _0x4c6ec2['status'](_0x1e5a35)[_0xf96e('0x1a')]();};}function respondWithResult(_0x28ac68,_0x92b65f){_0x92b65f=_0x92b65f||0xc8;return function(_0x42a0b4){if(_0x42a0b4){return _0x28ac68[_0xf96e('0x1b')](_0x92b65f)[_0xf96e('0x1c')](_0x42a0b4);}};}function respondWithFilteredResult(_0x336e8a,_0x56c0a3){return function(_0x508a26){if(_0x508a26){var _0x2e71b6=typeof _0x56c0a3[_0xf96e('0x1d')]===_0xf96e('0x1e')&&typeof _0x56c0a3[_0xf96e('0x1f')]===_0xf96e('0x1e');var _0x4aeefe=_0x508a26[_0xf96e('0x20')];var _0x2f0b34=_0x2e71b6?0x0:_0x56c0a3[_0xf96e('0x1d')];var _0x27259f=_0x2e71b6?_0x508a26['count']:_0x56c0a3[_0xf96e('0x1d')]+_0x56c0a3[_0xf96e('0x1f')];var _0x3b0029;if(_0x27259f>=_0x4aeefe){_0x27259f=_0x4aeefe;_0x3b0029=0xc8;}else{_0x3b0029=0xce;}_0x336e8a[_0xf96e('0x1b')](_0x3b0029);return _0x336e8a[_0xf96e('0x21')](_0xf96e('0x22'),_0x2f0b34+'-'+_0x27259f+'/'+_0x4aeefe)[_0xf96e('0x1c')](_0x508a26);}return null;};}function patchUpdates(_0x175e2c){return function(_0x5be54c){try{jsonpatch[_0xf96e('0x23')](_0x5be54c,_0x175e2c,!![]);}catch(_0x20283c){return BPromise[_0xf96e('0x24')](_0x20283c);}return _0x5be54c[_0xf96e('0x25')]();};}function saveUpdates(_0x18f751,_0x43e603){return function(_0x4df1f2){if(_0x4df1f2){return _0x4df1f2[_0xf96e('0x26')](_0x18f751)[_0xf96e('0x27')](function(_0x356555){return _0x356555;});}return null;};}function removeEntity(_0x45f279,_0x4b4e9c){return function(_0x1ee66b){if(_0x1ee66b){return _0x1ee66b[_0xf96e('0x28')]()[_0xf96e('0x27')](function(){_0x45f279[_0xf96e('0x1b')](0xcc)[_0xf96e('0x1a')]();});}};}function handleEntityNotFound(_0x1fecf1,_0x157529){return function(_0xbd0b2a){if(!_0xbd0b2a){_0x1fecf1['sendStatus'](0x194);}return _0xbd0b2a;};}function handleError(_0x41e245,_0x51836e){_0x51836e=_0x51836e||0x1f4;return function(_0x7f5045){logger[_0xf96e('0x29')](_0x7f5045[_0xf96e('0x2a')]);if(_0x7f5045[_0xf96e('0x2b')]){delete _0x7f5045[_0xf96e('0x2b')];}_0x41e245['status'](_0x51836e)[_0xf96e('0x2c')](_0x7f5045);};}var utilLicense=require(_0xf96e('0x17'));exports[_0xf96e('0x2d')]=function(_0x30ac29,_0x2d6d93){var _0x12aa60={'raw':!![],'where':{'id':0x1}},_0x1d8c1b={};_0x1d8c1b[_0xf96e('0x2e')]=_[_0xf96e('0x2f')](db[_0xf96e('0x30')][_0xf96e('0x31')]);_0x1d8c1b[_0xf96e('0x32')]=_[_0xf96e('0x2f')](_0x30ac29[_0xf96e('0x32')]);_0x1d8c1b[_0xf96e('0x33')]=_[_0xf96e('0x34')](_0x1d8c1b['model'],_0x1d8c1b['query']);_0x12aa60[_0xf96e('0x35')]=_[_0xf96e('0x34')](_0x1d8c1b[_0xf96e('0x2e')],qs[_0xf96e('0x36')](_0x30ac29[_0xf96e('0x32')][_0xf96e('0x36')]));_0x12aa60[_0xf96e('0x35')]=_0x12aa60[_0xf96e('0x35')][_0xf96e('0x37')]?_0x12aa60[_0xf96e('0x35')]:_0x1d8c1b[_0xf96e('0x2e')];_0x12aa60=_['merge']({},_0x12aa60,_0x30ac29['options']);return utilLicense[_0xf96e('0x38')](_0x12aa60)[_0xf96e('0x27')](respondWithResult(_0x2d6d93,null))['catch'](handleError(_0x2d6d93,null));};exports['update']=function(_0x453b2a,_0xb1b3e1){if(_0x453b2a['body']['id']){delete _0x453b2a[_0xf96e('0x39')]['id'];}return db[_0xf96e('0x30')]['find']({'where':{'id':_0x453b2a['params']['id']}})[_0xf96e('0x27')](handleEntityNotFound(_0xb1b3e1,null))[_0xf96e('0x27')](function(_0x1777ec){var _0x4eb09e=_0x1777ec[_0xf96e('0x3a')]({'plain':!![]});return utilLicense[_0xf96e('0x3b')](_0x4eb09e,_0x453b2a[_0xf96e('0x39')][_0xf96e('0x3c')]);})['then'](function(_0x176b38){if(!_0x176b38[_0xf96e('0x3d')]){return saveUpdates(_0x453b2a[_0xf96e('0x39')],null);}return _0x176b38;})[_0xf96e('0x27')](respondWithResult(_0xb1b3e1,null))['catch'](handleError(_0xb1b3e1,null));};exports[_0xf96e('0x3e')]=function(_0xb02ba5,_0x51aaec){var _0x27325b='license-info.log';var _0xa08eba=path[_0xf96e('0x3f')](_0xf96e('0x40'),_0xf96e('0x41'),_0xf96e('0x42'),_0x27325b);_0x51aaec[_0xf96e('0x43')](_0xf96e('0x44'),_0xf96e('0x45')+_0x27325b);_0x51aaec['set'](_0xf96e('0x46'),_0xf96e('0x47'));_0x51aaec[_0xf96e('0x48')](_0xa08eba);}; \ No newline at end of file +var _0x949f=['end','error','stack','name','send','index','keys','License','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','then','catch','body','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','download','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','apply','reject'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x949f,0xa4));var _0xf949=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x949f[_0x2dafbe];return _0x58a45a;};'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(_0xf949('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf949('0x1'));var util=require(_0xf949('0x2'));var path=require(_0xf949('0x3'));var sox=require(_0xf949('0x4'));var csv=require(_0xf949('0x5'));var ejs=require(_0xf949('0x6'));var fs=require('fs');var fs_extra=require(_0xf949('0x7'));var _=require(_0xf949('0x8'));var squel=require(_0xf949('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf949('0xa'));var Papa=require('papaparse');var Redis=require(_0xf949('0xb'));var authService=require(_0xf949('0xc'));var qs=require(_0xf949('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf949('0xe'));var logger=require(_0xf949('0xf'))(_0xf949('0x10'));var utils=require(_0xf949('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf949('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x497a0e,_0x9797be){_0x9797be=_0x9797be||0xcc;return function(_0x52297c){if(_0x52297c){return _0x497a0e[_0xf949('0x13')](_0x9797be);}return _0x497a0e['status'](_0x9797be)['end']();};}function respondWithResult(_0x258a08,_0x3b3ff3){_0x3b3ff3=_0x3b3ff3||0xc8;return function(_0x49c97d){if(_0x49c97d){return _0x258a08[_0xf949('0x14')](_0x3b3ff3)[_0xf949('0x15')](_0x49c97d);}};}function respondWithFilteredResult(_0x5e885c,_0x19e781){return function(_0x220ece){if(_0x220ece){var _0x38bd5a=typeof _0x19e781[_0xf949('0x16')]===_0xf949('0x17')&&typeof _0x19e781['limit']==='undefined';var _0x1dc452=_0x220ece[_0xf949('0x18')];var _0x3c62de=_0x38bd5a?0x0:_0x19e781[_0xf949('0x16')];var _0x4ae3bb=_0x38bd5a?_0x220ece[_0xf949('0x18')]:_0x19e781[_0xf949('0x16')]+_0x19e781[_0xf949('0x19')];var _0x3688bd;if(_0x4ae3bb>=_0x1dc452){_0x4ae3bb=_0x1dc452;_0x3688bd=0xc8;}else{_0x3688bd=0xce;}_0x5e885c[_0xf949('0x14')](_0x3688bd);return _0x5e885c['set']('Content-Range',_0x3c62de+'-'+_0x4ae3bb+'/'+_0x1dc452)['json'](_0x220ece);}return null;};}function patchUpdates(_0x4289ff){return function(_0x291ba8){try{jsonpatch[_0xf949('0x1a')](_0x291ba8,_0x4289ff,!![]);}catch(_0x467e21){return BPromise[_0xf949('0x1b')](_0x467e21);}return _0x291ba8['save']();};}function saveUpdates(_0x22bd5d,_0x1392a9){return function(_0x4b630d){if(_0x4b630d){return _0x4b630d['update'](_0x22bd5d)['then'](function(_0x5a7f88){return _0x5a7f88;});}return null;};}function removeEntity(_0x15f913,_0x330ca3){return function(_0x3ee8a6){if(_0x3ee8a6){return _0x3ee8a6['destroy']()['then'](function(){_0x15f913[_0xf949('0x14')](0xcc)[_0xf949('0x1c')]();});}};}function handleEntityNotFound(_0x158795,_0x26f9b9){return function(_0x19373f){if(!_0x19373f){_0x158795['sendStatus'](0x194);}return _0x19373f;};}function handleError(_0x1f6728,_0x1db27e){_0x1db27e=_0x1db27e||0x1f4;return function(_0x1b9181){logger[_0xf949('0x1d')](_0x1b9181[_0xf949('0x1e')]);if(_0x1b9181[_0xf949('0x1f')]){delete _0x1b9181[_0xf949('0x1f')];}_0x1f6728[_0xf949('0x14')](_0x1db27e)[_0xf949('0x20')](_0x1b9181);};}var utilLicense=require(_0xf949('0x12'));exports[_0xf949('0x21')]=function(_0x15f029,_0x4dd1d7){var _0x1f2faf={'raw':!![],'where':{'id':0x1}},_0x404f80={};_0x404f80['model']=_[_0xf949('0x22')](db[_0xf949('0x23')]['rawAttributes']);_0x404f80[_0xf949('0x24')]=_[_0xf949('0x22')](_0x15f029[_0xf949('0x24')]);_0x404f80[_0xf949('0x25')]=_[_0xf949('0x26')](_0x404f80[_0xf949('0x27')],_0x404f80[_0xf949('0x24')]);_0x1f2faf[_0xf949('0x28')]=_[_0xf949('0x26')](_0x404f80[_0xf949('0x27')],qs[_0xf949('0x29')](_0x15f029[_0xf949('0x24')][_0xf949('0x29')]));_0x1f2faf[_0xf949('0x28')]=_0x1f2faf[_0xf949('0x28')][_0xf949('0x2a')]?_0x1f2faf['attributes']:_0x404f80[_0xf949('0x27')];_0x1f2faf=_[_0xf949('0x2b')]({},_0x1f2faf,_0x15f029[_0xf949('0x2c')]);return utilLicense[_0xf949('0x2d')](_0x1f2faf)[_0xf949('0x2e')](respondWithResult(_0x4dd1d7,null))[_0xf949('0x2f')](handleError(_0x4dd1d7,null));};exports['update']=function(_0x696e50,_0x344e66){if(_0x696e50['body']['id']){delete _0x696e50[_0xf949('0x30')]['id'];}return db['License']['find']({'where':{'id':_0x696e50['params']['id']}})[_0xf949('0x2e')](handleEntityNotFound(_0x344e66,null))[_0xf949('0x2e')](function(_0x334f76){var _0x25c2fc=_0x334f76[_0xf949('0x31')]({'plain':!![]});return utilLicense[_0xf949('0x32')](_0x25c2fc,_0x696e50['body'][_0xf949('0x33')]);})[_0xf949('0x2e')](function(_0x222633){if(!_0x222633[_0xf949('0x34')]){return saveUpdates(_0x696e50[_0xf949('0x30')],null);}return _0x222633;})[_0xf949('0x2e')](respondWithResult(_0x344e66,null))[_0xf949('0x2f')](handleError(_0x344e66,null));};exports[_0xf949('0x35')]=function(_0x233166,_0x445eb1){var _0x1a8d88=_0xf949('0x36');var _0x472d76=path[_0xf949('0x37')](_0xf949('0x38'),_0xf949('0x39'),_0xf949('0x3a'),_0x1a8d88);_0x445eb1['setHeader'](_0xf949('0x3b'),_0xf949('0x3c')+_0x1a8d88);_0x445eb1[_0xf949('0x3d')](_0xf949('0x3e'),'text/plain');_0x445eb1[_0xf949('0x3f')](_0x472d76);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1fc2232..742f9f0 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 _0xde6e=['moment','bluebird','request-promise','../../config/environment','./license.attributes','exports','define','license','lodash','util','../../config/logger'];(function(_0x8493cf,_0x337d0f){var _0xdf8601=function(_0x5b59cf){while(--_0x5b59cf){_0x8493cf['push'](_0x8493cf['shift']());}};_0xdf8601(++_0x337d0f);}(_0xde6e,0xc3));var _0xede6=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0xde6e[_0x1305e3];return _0x1068e9;};'use strict';var _=require(_0xede6('0x0'));var util=require(_0xede6('0x1'));var logger=require(_0xede6('0x2'))('api');var moment=require(_0xede6('0x3'));var BPromise=require(_0xede6('0x4'));var rp=require(_0xede6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xede6('0x6'));var attributes=require(_0xede6('0x7'));module[_0xede6('0x8')]=function(_0x1dec05,_0xe0d606){return _0x1dec05[_0xede6('0x9')]('License',attributes,{'tableName':_0xede6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x393f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','License','license','util','../../config/logger','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x393f,0xf8));var _0xf393=function(_0xf7a75d,_0x4253c7){_0xf7a75d=_0xf7a75d-0x0;var _0x2b74b6=_0x393f[_0xf7a75d];return _0x2b74b6;};'use strict';var _=require('lodash');var util=require(_0xf393('0x0'));var logger=require(_0xf393('0x1'))(_0xf393('0x2'));var moment=require(_0xf393('0x3'));var BPromise=require(_0xf393('0x4'));var rp=require(_0xf393('0x5'));var fs=require('fs');var path=require(_0xf393('0x6'));var rimraf=require(_0xf393('0x7'));var config=require(_0xf393('0x8'));var attributes=require('./license.attributes');module[_0xf393('0x9')]=function(_0x3cc0bc,_0x4e4c5d){return _0x3cc0bc['define'](_0xf393('0xa'),attributes,{'tableName':_0xf393('0xb'),'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 1dbf8a2..1b5ac4e 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 _0xf78e=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x50798b,_0x22ccf8){var _0x4b1d26=function(_0x26107f){while(--_0x26107f){_0x50798b['push'](_0x50798b['shift']());}};_0x4b1d26(++_0x22ccf8);}(_0xf78e,0xc1));var _0xef78=function(_0x356312,_0x4e93b7){_0x356312=_0x356312-0x0;var _0x1b1055=_0xf78e[_0x356312];return _0x1b1055;};'use strict';var _=require(_0xef78('0x0'));var util=require(_0xef78('0x1'));var moment=require(_0xef78('0x2'));var BPromise=require(_0xef78('0x3'));var rs=require(_0xef78('0x4'));var fs=require('fs');var Redis=require(_0xef78('0x5'));var db=require(_0xef78('0x6'))['db'];var utils=require(_0xef78('0x7'));var logger=require('../../config/logger')(_0xef78('0x8'));var config=require(_0xef78('0x9'));var jayson=require(_0xef78('0xa'));var client=jayson[_0xef78('0xb')][_0xef78('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a1a0b,_0x65443d,_0xaa43ba){return new BPromise(function(_0x445356,_0x4201d5){return client[_0xef78('0xd')](_0x5a1a0b,_0xaa43ba)['then'](function(_0x48b9ea){logger['info']('License,\x20%s,\x20%s',_0x65443d,_0xef78('0xe'));logger[_0xef78('0xf')](_0xef78('0x10'),_0x65443d,_0xef78('0xe'),JSON[_0xef78('0x11')](_0x48b9ea));if(_0x48b9ea[_0xef78('0x12')]){if(_0x48b9ea[_0xef78('0x12')][_0xef78('0x13')]===0x1f4){logger[_0xef78('0x12')](_0xef78('0x14'),_0x65443d,_0x48b9ea['error'][_0xef78('0x15')]);return _0x4201d5(_0x48b9ea[_0xef78('0x12')][_0xef78('0x15')]);}logger['error']('License,\x20%s,\x20%s',_0x65443d,_0x48b9ea['error'][_0xef78('0x15')]);return _0x445356(_0x48b9ea['error'][_0xef78('0x15')]);}else{logger[_0xef78('0x16')]('License,\x20%s,\x20%s',_0x65443d,_0xef78('0xe'));_0x445356(_0x48b9ea[_0xef78('0x17')][_0xef78('0x15')]);}})[_0xef78('0x18')](function(_0x230fcb){logger[_0xef78('0x12')]('License,\x20%s,\x20%s',_0x65443d,_0x230fcb);_0x4201d5(_0x230fcb);});});} \ No newline at end of file +var _0x322e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','info','result','util'];(function(_0x35a827,_0x36f6c6){var _0x455e12=function(_0x41c1c9){while(--_0x41c1c9){_0x35a827['push'](_0x35a827['shift']());}};_0x455e12(++_0x36f6c6);}(_0x322e,0x83));var _0xe322=function(_0x8b4bb2,_0x1a4092){_0x8b4bb2=_0x8b4bb2-0x0;var _0xb16263=_0x322e[_0x8b4bb2];return _0xb16263;};'use strict';var _=require('lodash');var util=require(_0xe322('0x0'));var moment=require(_0xe322('0x1'));var BPromise=require(_0xe322('0x2'));var rs=require(_0xe322('0x3'));var fs=require('fs');var Redis=require(_0xe322('0x4'));var db=require(_0xe322('0x5'))['db'];var utils=require(_0xe322('0x6'));var logger=require(_0xe322('0x7'))(_0xe322('0x8'));var config=require(_0xe322('0x9'));var jayson=require(_0xe322('0xa'));var client=jayson[_0xe322('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3139,_0x3a661d,_0x34768d){return new BPromise(function(_0x1b6f7d,_0x5b8c48){return client[_0xe322('0xc')](_0x1f3139,_0x34768d)['then'](function(_0x3871c2){logger['info']('License,\x20%s,\x20%s',_0x3a661d,_0xe322('0xd'));logger[_0xe322('0xe')](_0xe322('0xf'),_0x3a661d,_0xe322('0xd'),JSON['stringify'](_0x3871c2));if(_0x3871c2[_0xe322('0x10')]){if(_0x3871c2[_0xe322('0x10')][_0xe322('0x11')]===0x1f4){logger[_0xe322('0x10')](_0xe322('0x12'),_0x3a661d,_0x3871c2[_0xe322('0x10')]['message']);return _0x5b8c48(_0x3871c2['error'][_0xe322('0x13')]);}logger[_0xe322('0x10')](_0xe322('0x12'),_0x3a661d,_0x3871c2['error'][_0xe322('0x13')]);return _0x1b6f7d(_0x3871c2[_0xe322('0x10')][_0xe322('0x13')]);}else{logger[_0xe322('0x14')](_0xe322('0x12'),_0x3a661d,_0xe322('0xd'));_0x1b6f7d(_0x3871c2[_0xe322('0x15')]['message']);}})['catch'](function(_0x264299){logger['error'](_0xe322('0x12'),_0x3a661d,_0x264299);_0x5b8c48(_0x264299);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c2b20de..2e71724 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 _0x670b=['isAuthenticated','index','/describe','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getInteractions','/:id/applications','getMessages','verifySmtp','/:id/users','getAgents','post','addAnswer','/:id/in_servers','addImap','addSmtp','/:id/interactions','/:id/send','send','addAgents','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller'];(function(_0x3204fc,_0x2d74a4){var _0x2c9784=function(_0x1847b6){while(--_0x1847b6){_0x3204fc['push'](_0x3204fc['shift']());}};_0x2c9784(++_0x2d74a4);}(_0x670b,0xfe));var _0xb670=function(_0x952d8b,_0x33abfb){_0x952d8b=_0x952d8b-0x0;var _0x297762=_0x670b[_0x952d8b];return _0x297762;};'use strict';var multer=require(_0xb670('0x0'));var util=require(_0xb670('0x1'));var path=require(_0xb670('0x2'));var timeout=require(_0xb670('0x3'));var express=require(_0xb670('0x4'));var router=express[_0xb670('0x5')]();var fs_extra=require(_0xb670('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb670('0x7'));var config=require(_0xb670('0x8'));var controller=require(_0xb670('0x9'));router['get']('/',auth[_0xb670('0xa')](),controller[_0xb670('0xb')]);router['get'](_0xb670('0xc'),auth[_0xb670('0xa')](),controller[_0xb670('0xd')]);router[_0xb670('0xe')](_0xb670('0xf'),auth['isAuthenticated'](),controller[_0xb670('0x10')]);router['get'](_0xb670('0x11'),auth[_0xb670('0xa')](),controller[_0xb670('0x12')]);router[_0xb670('0xe')](_0xb670('0x13'),auth['isAuthenticated'](),controller[_0xb670('0x14')]);router['get']('/:id/in_servers',auth[_0xb670('0xa')](),controller[_0xb670('0x15')]);router['get'](_0xb670('0x16'),auth[_0xb670('0xa')](),controller['getSmtp']);router[_0xb670('0xe')]('/:id/interactions',auth[_0xb670('0xa')](),controller[_0xb670('0x17')]);router[_0xb670('0xe')](_0xb670('0x18'),auth[_0xb670('0xa')](),controller['getApplications']);router[_0xb670('0xe')]('/:id/messages',auth[_0xb670('0xa')](),controller[_0xb670('0x19')]);router[_0xb670('0xe')]('/:id/verify',auth[_0xb670('0xa')](),controller[_0xb670('0x1a')]);router[_0xb670('0xe')](_0xb670('0x1b'),auth[_0xb670('0xa')](),controller[_0xb670('0x1c')]);router[_0xb670('0x1d')](_0xb670('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xb670('0xa')](),controller[_0xb670('0x1e')]);router[_0xb670('0x1d')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb670('0x1d')](_0xb670('0x1f'),auth[_0xb670('0xa')](),controller[_0xb670('0x20')]);router[_0xb670('0x1d')]('/:id/out_servers',auth[_0xb670('0xa')](),controller[_0xb670('0x21')]);router[_0xb670('0x1d')](_0xb670('0x22'),auth[_0xb670('0xa')](),controller['addInteraction']);router[_0xb670('0x1d')](_0xb670('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb670('0x1d')](_0xb670('0x23'),auth[_0xb670('0xa')](),controller[_0xb670('0x24')]);router['post'](_0xb670('0x1b'),auth[_0xb670('0xa')](),controller[_0xb670('0x25')]);router['put']('/:id',auth[_0xb670('0xa')](),controller['update']);router[_0xb670('0x26')](_0xb670('0x11'),auth[_0xb670('0xa')](),controller['removeDispositions']);router['delete'](_0xb670('0x13'),auth[_0xb670('0xa')](),controller[_0xb670('0x27')]);router[_0xb670('0x26')](_0xb670('0x1f'),auth[_0xb670('0xa')](),controller['removeImap']);router[_0xb670('0x26')](_0xb670('0x16'),auth[_0xb670('0xa')](),controller[_0xb670('0x28')]);router[_0xb670('0x26')](_0xb670('0xf'),auth[_0xb670('0xa')](),controller[_0xb670('0x29')]);router[_0xb670('0x26')](_0xb670('0x1b'),auth[_0xb670('0xa')](),controller[_0xb670('0x2a')]);module[_0xb670('0x2b')]=router; \ No newline at end of file +var _0xa90f=['update','delete','removeDispositions','removeImap','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','/:id/send','send','put'];(function(_0x3b5fef,_0xbeb843){var _0x401c4c=function(_0xff1c4b){while(--_0xff1c4b){_0x3b5fef['push'](_0x3b5fef['shift']());}};_0x401c4c(++_0xbeb843);}(_0xa90f,0x189));var _0xfa90=function(_0x5cad70,_0xa8e39){_0x5cad70=_0x5cad70-0x0;var _0x2ebbb3=_0xa90f[_0x5cad70];return _0x2ebbb3;};'use strict';var multer=require(_0xfa90('0x0'));var util=require(_0xfa90('0x1'));var path=require('path');var timeout=require(_0xfa90('0x2'));var express=require('express');var router=express[_0xfa90('0x3')]();var fs_extra=require(_0xfa90('0x4'));var auth=require(_0xfa90('0x5'));var interaction=require(_0xfa90('0x6'));var config=require('../../config/environment');var controller=require(_0xfa90('0x7'));router['get']('/',auth[_0xfa90('0x8')](),controller[_0xfa90('0x9')]);router[_0xfa90('0xa')](_0xfa90('0xb'),auth[_0xfa90('0x8')](),controller[_0xfa90('0xc')]);router[_0xfa90('0xa')](_0xfa90('0xd'),auth[_0xfa90('0x8')](),controller[_0xfa90('0xe')]);router[_0xfa90('0xa')](_0xfa90('0xf'),auth['isAuthenticated'](),controller[_0xfa90('0x10')]);router[_0xfa90('0xa')]('/:id/canned_answers',auth[_0xfa90('0x8')](),controller['getAnswers']);router[_0xfa90('0xa')]('/:id/in_servers',auth[_0xfa90('0x8')](),controller[_0xfa90('0x11')]);router[_0xfa90('0xa')](_0xfa90('0x12'),auth[_0xfa90('0x8')](),controller['getSmtp']);router[_0xfa90('0xa')](_0xfa90('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xfa90('0x14'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x15')]);router[_0xfa90('0xa')](_0xfa90('0x16'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x17')]);router['get']('/:id/verify',auth[_0xfa90('0x8')](),controller['verifySmtp']);router['get'](_0xfa90('0x18'),auth['isAuthenticated'](),controller[_0xfa90('0x19')]);router[_0xfa90('0x1a')](_0xfa90('0xf'),auth[_0xfa90('0x8')](),controller['addDisposition']);router[_0xfa90('0x1a')](_0xfa90('0x1b'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x1c')]);router[_0xfa90('0x1a')]('/',auth[_0xfa90('0x8')](),controller[_0xfa90('0x1d')]);router[_0xfa90('0x1a')](_0xfa90('0x1e'),auth['isAuthenticated'](),controller[_0xfa90('0x1f')]);router[_0xfa90('0x1a')](_0xfa90('0x12'),auth['isAuthenticated'](),controller[_0xfa90('0x20')]);router['post'](_0xfa90('0x13'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x21')]);router['post']('/:id/applications',auth[_0xfa90('0x8')](),controller['addApplications']);router[_0xfa90('0x1a')](_0xfa90('0x22'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x23')]);router[_0xfa90('0x1a')]('/:id/users',auth[_0xfa90('0x8')](),controller['addAgents']);router[_0xfa90('0x24')](_0xfa90('0xd'),auth['isAuthenticated'](),controller[_0xfa90('0x25')]);router[_0xfa90('0x26')](_0xfa90('0xf'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x27')]);router[_0xfa90('0x26')](_0xfa90('0x1b'),auth[_0xfa90('0x8')](),controller['removeAnswers']);router[_0xfa90('0x26')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xfa90('0x28')]);router['delete'](_0xfa90('0x12'),auth[_0xfa90('0x8')](),controller['removeSmtp']);router[_0xfa90('0x26')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xfa90('0x26')](_0xfa90('0x18'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x29')]);module[_0xfa90('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index fa50039..5e28686 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 _0x0b53=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x5a9989,_0x4ecdd2){var _0x37493c=function(_0x404f08){while(--_0x404f08){_0x5a9989['push'](_0x5a9989['shift']());}};_0x37493c(++_0x4ecdd2);}(_0x0b53,0x1e0));var _0x30b5=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x0b53[_0x541ea6];return _0x3c3e84;};'use strict';var Sequelize=require(_0x30b5('0x0'));module[_0x30b5('0x1')]={'description':{'type':Sequelize[_0x30b5('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x30b5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x30b5('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x30b5('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x30b5('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x30b5('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x30b5('0x5')},'fontSize':{'type':Sequelize[_0x30b5('0x6')](0x2)[_0x30b5('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x30b5('0x8');}},'notificationSound':{'type':Sequelize[_0x30b5('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x30b5('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x30b5('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x30b5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x30b5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x30b5('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x30b5('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x30b5('0x3')],'defaultValue':![],'comment':_0x30b5('0xa'),'set':function(_0x32169d){if(!_0x32169d)this[_0x30b5('0xb')]('mandatoryDispositionPauseId',null);this[_0x30b5('0xb')]('mandatoryDisposition',_0x32169d);}},'provider':{'type':Sequelize[_0x30b5('0xc')]('gmail',_0x30b5('0xd'),_0x30b5('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x30b5('0xf')](_0x30b5('0x10')))return _0x30b5('0x11');return this[_0x30b5('0xf')](_0x30b5('0x10'));},'set':function(_0x14b230){if(_0x14b230==='custom')_0x14b230=null;return this['setDataValue']('provider',_0x14b230);}}}; \ No newline at end of file +var _0xc45a=['getDataValue','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','provider'];(function(_0x2e76f3,_0x302bd2){var _0x34637f=function(_0x344938){while(--_0x344938){_0x2e76f3['push'](_0x2e76f3['shift']());}};_0x34637f(++_0x302bd2);}(_0xc45a,0x1ee));var _0xac45=function(_0x22059c,_0x5c3148){_0x22059c=_0x22059c-0x0;var _0xd8ae43=_0xc45a[_0x22059c];return _0xd8ae43;};'use strict';var Sequelize=require(_0xac45('0x0'));module['exports']={'description':{'type':Sequelize[_0xac45('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xac45('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xac45('0x3')]},'markAsUnread':{'type':Sequelize[_0xac45('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xac45('0x1')],'allowNull':![],'defaultValue':_0xac45('0x4')},'fontSize':{'type':Sequelize[_0xac45('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xac45('0x6');}},'notificationSound':{'type':Sequelize[_0xac45('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xac45('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xac45('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xac45('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xac45('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xac45('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xac45('0x5')],'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[_0xac45('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x501e40){if(!_0x501e40)this['setDataValue'](_0xac45('0x7'),null);this[_0xac45('0x8')](_0xac45('0x9'),_0x501e40);}},'provider':{'type':Sequelize[_0xac45('0xa')](_0xac45('0xb'),_0xac45('0xc'),_0xac45('0xd'),_0xac45('0xe')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xac45('0xf')))return'custom';return this[_0xac45('0x10')](_0xac45('0xf'));},'set':function(_0x189b81){if(_0x189b81==='custom')_0x189b81=null;return this[_0xac45('0x8')](_0xac45('0xf'),_0x189b81);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index b1b45e1..3775d0a 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 _0xd953=['List\x20not\x20found','subject','attach','out','messageId','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./mailAccount.socket','register','http','request','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','UserProfileResource','end','stack','name','send','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','Imap','rawAttributes','keys','find','body','modernAuthentication','Smtp','secure','CloudProviderId','addDisposition','Disposition','create','findOne','pick','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','provider','custom','ListId','isNil','active','description','user','username','password','pass','service','host','port','authentication','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','order','CmContact','Contact','User','internal','Tag','tag','addApplications','sequelize','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail'];(function(_0x3bec19,_0x2141df){var _0x4431b5=function(_0x51c836){while(--_0x51c836){_0x3bec19['push'](_0x3bec19['shift']());}};_0x4431b5(++_0x2141df);}(_0xd953,0x16c));var _0x3d95=function(_0x16bbaf,_0x2c1a63){_0x16bbaf=_0x16bbaf-0x0;var _0x5bff5f=_0xd953[_0x16bbaf];return _0x5bff5f;};'use strict';var moment=require(_0x3d95('0x0'));var BPromise=require(_0x3d95('0x1'));var util=require('util');var path=require(_0x3d95('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x3d95('0x3'));var qs=require(_0x3d95('0x4'));var logger=require(_0x3d95('0x5'))(_0x3d95('0x6'));var config=require(_0x3d95('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3d95('0x8')](config[_0x3d95('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d95('0xa'))(new Redis(config[_0x3d95('0x9')]));require(_0x3d95('0xb'))[_0x3d95('0xc')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3d95('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x43a64f,_0x2e056f,_0x710173,_0x13085e){return new BPromise(function(_0x399cb5,_0x23f1d7){var _0x148b4f=_0x13085e||client;return _0x148b4f[_0x3d95('0xe')](_0x43a64f,_0x710173)['then'](function(_0x85e802){logger[_0x3d95('0xf')]('MailAccount,\x20%s,\x20%s',_0x2e056f,_0x3d95('0x10'));logger[_0x3d95('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2e056f,_0x3d95('0x10'),JSON[_0x3d95('0x12')](_0x85e802));if(_0x85e802[_0x3d95('0x13')]){if(_0x85e802[_0x3d95('0x13')][_0x3d95('0x14')]===0x1f4){logger[_0x3d95('0x13')](_0x3d95('0x15'),_0x2e056f,_0x85e802[_0x3d95('0x13')][_0x3d95('0x16')]);return _0x23f1d7(_0x85e802['error'][_0x3d95('0x16')]);}logger[_0x3d95('0x13')](_0x3d95('0x15'),_0x2e056f,_0x85e802['error'][_0x3d95('0x16')]);return _0x399cb5(_0x85e802[_0x3d95('0x13')]['message']);}else{logger['info'](_0x3d95('0x15'),_0x2e056f,'request\x20sent');_0x399cb5(_0x85e802[_0x3d95('0x17')]['message']);}})[_0x3d95('0x18')](function(_0x3ab075){logger['error'](_0x3d95('0x15'),_0x2e056f,_0x3ab075);_0x23f1d7(_0x3ab075);});});}function respondWithStatusCode(_0x127ceb,_0x16437c){_0x16437c=_0x16437c||0xcc;return function(_0x2fdecf){if(_0x2fdecf){return _0x127ceb[_0x3d95('0x19')](_0x16437c);}return _0x127ceb[_0x3d95('0x1a')](_0x16437c)['end']();};}function respondWithResult(_0x27e3f2,_0x176e56){_0x176e56=_0x176e56||0xc8;return function(_0x4a3356){if(_0x4a3356){return _0x27e3f2[_0x3d95('0x1a')](_0x176e56)[_0x3d95('0x1b')](_0x4a3356);}};}function respondWithFilteredResult(_0x43d5d3,_0x5e1ac6){return function(_0x570e25){if(_0x570e25){var _0xb9dd24=typeof _0x5e1ac6[_0x3d95('0x1c')]===_0x3d95('0x1d')&&typeof _0x5e1ac6[_0x3d95('0x1e')]===_0x3d95('0x1d');var _0x3d13c8=_0x570e25['count'];var _0x3fa813=_0xb9dd24?0x0:_0x5e1ac6[_0x3d95('0x1c')];var _0x1f6d0b=_0xb9dd24?_0x570e25[_0x3d95('0x1f')]:_0x5e1ac6[_0x3d95('0x1c')]+_0x5e1ac6[_0x3d95('0x1e')];var _0x394d28;if(_0x1f6d0b>=_0x3d13c8){_0x1f6d0b=_0x3d13c8;_0x394d28=0xc8;}else{_0x394d28=0xce;}_0x43d5d3[_0x3d95('0x1a')](_0x394d28);return _0x43d5d3[_0x3d95('0x20')]('Content-Range',_0x3fa813+'-'+_0x1f6d0b+'/'+_0x3d13c8)[_0x3d95('0x1b')](_0x570e25);}return null;};}function saveUpdates(_0x47a84e){return function(_0x265a97){if(_0x265a97){return _0x265a97[_0x3d95('0x21')](_0x47a84e)[_0x3d95('0x22')](function(_0x167126){return _0x167126;});}return null;};}function removeEntity(_0x389e5b){return function(_0x98c3df){if(_0x98c3df){return _0x98c3df[_0x3d95('0x23')]()['then'](function(){var _0x4001d1=_0x98c3df['get']({'plain':!![]});var _0x3a6535='MailAccounts';return db[_0x3d95('0x24')][_0x3d95('0x23')]({'where':{'type':_0x3a6535,'resourceId':_0x4001d1['id']}})[_0x3d95('0x22')](function(){return _0x98c3df;});})['then'](function(){_0x389e5b['status'](0xcc)[_0x3d95('0x25')]();});}};}function handleEntityNotFound(_0x35c62d){return function(_0xe99750){if(!_0xe99750){_0x35c62d[_0x3d95('0x19')](0x194);}return _0xe99750;};}function handleError(_0x35788b,_0x124f75){_0x124f75=_0x124f75||0x1f4;return function(_0x388226){logger[_0x3d95('0x13')](_0x388226[_0x3d95('0x26')]);if(_0x388226[_0x3d95('0x27')]){delete _0x388226['name'];}_0x35788b[_0x3d95('0x1a')](_0x124f75)[_0x3d95('0x28')](_0x388226);};}exports['index']=function(_0x5e4f68,_0x68855d){var _0x5bd0ad={'include':[{'model':db[_0x3d95('0x29')],'as':'Imap'},{'model':db[_0x3d95('0x2a')],'as':'Smtp'},{'model':db[_0x3d95('0x2b')],'as':_0x3d95('0x2c')}]},_0x519edf={},_0x2dd5c6={'count':0x0,'rows':[]};var _0x1cce0a=_[_0x3d95('0x2d')](db[_0x3d95('0x2e')]['rawAttributes'],function(_0x2ed9ff){return{'name':_0x2ed9ff[_0x3d95('0x2f')],'type':_0x2ed9ff[_0x3d95('0x30')][_0x3d95('0x31')]};});_0x519edf[_0x3d95('0x32')]=_[_0x3d95('0x2d')](_0x1cce0a,_0x3d95('0x27'));_0x519edf[_0x3d95('0x33')]=_['keys'](_0x5e4f68[_0x3d95('0x33')]);_0x519edf[_0x3d95('0x34')]=_[_0x3d95('0x35')](_0x519edf[_0x3d95('0x32')],_0x519edf[_0x3d95('0x33')]);_0x5bd0ad[_0x3d95('0x36')]=_[_0x3d95('0x35')](_0x519edf[_0x3d95('0x32')],qs['fields'](_0x5e4f68['query'][_0x3d95('0x37')]));_0x5bd0ad['attributes']=_0x5bd0ad[_0x3d95('0x36')][_0x3d95('0x38')]?_0x5bd0ad[_0x3d95('0x36')]:_0x519edf[_0x3d95('0x32')];if(!_0x5e4f68['query'][_0x3d95('0x39')](_0x3d95('0x3a'))){_0x5bd0ad[_0x3d95('0x1e')]=qs[_0x3d95('0x1e')](_0x5e4f68['query'][_0x3d95('0x1e')]);_0x5bd0ad['offset']=qs[_0x3d95('0x1c')](_0x5e4f68[_0x3d95('0x33')][_0x3d95('0x1c')]);}_0x5bd0ad['order']=qs[_0x3d95('0x3b')](_0x5e4f68[_0x3d95('0x33')]['sort']);_0x5bd0ad[_0x3d95('0x3c')]=qs['filters'](_['pick'](_0x5e4f68[_0x3d95('0x33')],_0x519edf['filters']),_0x1cce0a);if(_0x5e4f68[_0x3d95('0x33')]['filter']){_0x5bd0ad[_0x3d95('0x3c')]=_[_0x3d95('0x3d')](_0x5bd0ad[_0x3d95('0x3c')],{'$or':_[_0x3d95('0x2d')](_0x1cce0a,function(_0x372c9f){if(_0x372c9f[_0x3d95('0x30')]!==_0x3d95('0x3e')){var _0x5d193b={};_0x5d193b[_0x372c9f[_0x3d95('0x27')]]={'$like':'%'+_0x5e4f68['query'][_0x3d95('0x3f')]+'%'};return _0x5d193b;}})});}_0x5bd0ad=_['merge']({},_0x5bd0ad,_0x5e4f68[_0x3d95('0x40')]);var _0x319cf1={'where':_0x5bd0ad['where']};return db['MailAccount'][_0x3d95('0x1f')](_0x319cf1)['then'](function(_0x44dca7){_0x2dd5c6['count']=_0x44dca7;if(_0x5e4f68[_0x3d95('0x33')][_0x3d95('0x41')]){_0x5bd0ad[_0x3d95('0x42')]=[{'all':!![]}];}return db[_0x3d95('0x2e')][_0x3d95('0x43')](_0x5bd0ad);})[_0x3d95('0x22')](function(_0x5c201c){_0x2dd5c6[_0x3d95('0x44')]=_0x5c201c;return _0x2dd5c6;})[_0x3d95('0x22')](respondWithFilteredResult(_0x68855d,_0x5bd0ad))[_0x3d95('0x18')](handleError(_0x68855d,null));};exports['show']=function(_0x2d3a4e,_0x1ab1b9){var _0x1f4e90={'raw':![],'where':{'id':_0x2d3a4e[_0x3d95('0x45')]['id']},'include':[{'model':db[_0x3d95('0x29')],'as':_0x3d95('0x46')},{'model':db[_0x3d95('0x2a')],'as':'Smtp'},{'model':db[_0x3d95('0x2b')],'as':_0x3d95('0x2c')}]},_0x38d183={};_0x38d183[_0x3d95('0x32')]=_['keys'](db[_0x3d95('0x2e')][_0x3d95('0x47')]);_0x38d183[_0x3d95('0x33')]=_[_0x3d95('0x48')](_0x2d3a4e['query']);_0x38d183[_0x3d95('0x34')]=_[_0x3d95('0x35')](_0x38d183[_0x3d95('0x32')],_0x38d183[_0x3d95('0x33')]);_0x1f4e90[_0x3d95('0x36')]=_[_0x3d95('0x35')](_0x38d183[_0x3d95('0x32')],qs[_0x3d95('0x37')](_0x2d3a4e['query'][_0x3d95('0x37')]));_0x1f4e90[_0x3d95('0x36')]=_0x1f4e90[_0x3d95('0x36')][_0x3d95('0x38')]?_0x1f4e90[_0x3d95('0x36')]:_0x38d183[_0x3d95('0x32')];if(_0x2d3a4e[_0x3d95('0x33')]['includeAll']){_0x1f4e90[_0x3d95('0x42')]=[{'all':!![]}];}_0x1f4e90=_[_0x3d95('0x3d')]({},_0x1f4e90,_0x2d3a4e[_0x3d95('0x40')]);return db[_0x3d95('0x2e')][_0x3d95('0x49')](_0x1f4e90)['then'](handleEntityNotFound(_0x1ab1b9,null))[_0x3d95('0x22')](respondWithResult(_0x1ab1b9,null))[_0x3d95('0x18')](handleError(_0x1ab1b9,null));};exports['update']=function(_0x12f9bb,_0x4fe6b6){if(_0x12f9bb[_0x3d95('0x4a')]['id']){delete _0x12f9bb[_0x3d95('0x4a')]['id'];}if(_0x12f9bb[_0x3d95('0x4a')][_0x3d95('0x46')]){if(!_0x12f9bb['body'][_0x3d95('0x46')][_0x3d95('0x4b')]){_0x12f9bb[_0x3d95('0x4a')]['Imap']['CloudProviderId']=null;}}if(_0x12f9bb[_0x3d95('0x4a')][_0x3d95('0x4c')]){if(_0x12f9bb[_0x3d95('0x4a')][_0x3d95('0x4c')][_0x3d95('0x4b')]){_0x12f9bb[_0x3d95('0x4a')][_0x3d95('0x4c')][_0x3d95('0x4d')]=![];}else{_0x12f9bb[_0x3d95('0x4a')][_0x3d95('0x4c')][_0x3d95('0x4e')]=null;}}return db[_0x3d95('0x2e')][_0x3d95('0x49')]({'where':{'id':_0x12f9bb['params']['id']},'include':[{'model':db[_0x3d95('0x29')],'as':_0x3d95('0x46')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x3d95('0x2b')],'as':_0x3d95('0x2c')}]})['then'](handleEntityNotFound(_0x4fe6b6,null))[_0x3d95('0x22')](saveUpdates(_0x12f9bb['body'],null))[_0x3d95('0x22')](function(_0x5a56f1){if(_0x5a56f1&&_0x12f9bb[_0x3d95('0x4a')][_0x3d95('0x46')]){return db[_0x3d95('0x29')][_0x3d95('0x21')](_0x12f9bb[_0x3d95('0x4a')][_0x3d95('0x46')],{'where':{'MailAccountId':_0x5a56f1['id']}})[_0x3d95('0x22')](function(){return _0x5a56f1;});}return _0x5a56f1;})['then'](function(_0x3615e4){if(_0x3615e4&&_0x12f9bb['body'][_0x3d95('0x4c')]){return db[_0x3d95('0x2a')][_0x3d95('0x21')](_0x12f9bb[_0x3d95('0x4a')]['Smtp'],{'where':{'MailAccountId':_0x3615e4['id']}})[_0x3d95('0x22')](function(){return _0x3615e4;});}return _0x3615e4;})[_0x3d95('0x22')](respondWithResult(_0x4fe6b6,null))[_0x3d95('0x18')](handleError(_0x4fe6b6,null));};exports['describe']=function(_0x1adaf2,_0x3c01c8){return db[_0x3d95('0x2e')]['describe']()[_0x3d95('0x22')](respondWithResult(_0x3c01c8,null))[_0x3d95('0x18')](handleError(_0x3c01c8,null));};exports[_0x3d95('0x4f')]=function(_0x83857,_0x3bdc2f){if(_0x83857['body']['id']){delete _0x83857[_0x3d95('0x4a')]['id'];}return db[_0x3d95('0x2e')][_0x3d95('0x49')]({'where':{'id':_0x83857[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x3bdc2f,null))[_0x3d95('0x22')](function(_0x3f4107){if(_0x3f4107){_0x83857['body']['MailAccountId']=_0x3f4107['id'];return db[_0x3d95('0x50')][_0x3d95('0x51')](_0x83857[_0x3d95('0x4a')]);}})[_0x3d95('0x22')](respondWithResult(_0x3bdc2f,null))[_0x3d95('0x18')](handleError(_0x3bdc2f,null));};exports['getDispositions']=function(_0x15819d,_0x5d492b){var _0x9ae4ef={'raw':![],'where':{}};var _0x33fcfd={};var _0x496847={'count':0x0,'rows':[]};return db['MailAccount'][_0x3d95('0x52')]({'where':{'id':_0x15819d['params']['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x5d492b,null))[_0x3d95('0x22')](function(_0x3a7e04){if(_0x3a7e04){_0x33fcfd[_0x3d95('0x32')]=_[_0x3d95('0x48')](db['Disposition']['rawAttributes']);_0x33fcfd[_0x3d95('0x33')]=_[_0x3d95('0x48')](_0x15819d['query']);_0x33fcfd[_0x3d95('0x34')]=_[_0x3d95('0x35')](_0x33fcfd[_0x3d95('0x32')],_0x33fcfd[_0x3d95('0x33')]);_0x9ae4ef['attributes']=_['intersection'](_0x33fcfd['model'],qs[_0x3d95('0x37')](_0x15819d['query'][_0x3d95('0x37')]));_0x9ae4ef['attributes']=_0x9ae4ef[_0x3d95('0x36')]['length']?_0x9ae4ef[_0x3d95('0x36')]:_0x33fcfd[_0x3d95('0x32')];if(!_0x15819d['query'][_0x3d95('0x39')](_0x3d95('0x3a'))){_0x9ae4ef[_0x3d95('0x1e')]=qs[_0x3d95('0x1e')](_0x15819d[_0x3d95('0x33')]['limit']);_0x9ae4ef['offset']=qs['offset'](_0x15819d[_0x3d95('0x33')][_0x3d95('0x1c')]);}_0x9ae4ef['order']=qs[_0x3d95('0x3b')](_0x15819d[_0x3d95('0x33')][_0x3d95('0x3b')]);_0x9ae4ef[_0x3d95('0x3c')]=qs[_0x3d95('0x34')](_[_0x3d95('0x53')](_0x15819d[_0x3d95('0x33')],_0x33fcfd['filters']));_0x9ae4ef['where'][_0x3d95('0x54')]=_0x3a7e04['id'];if(_0x15819d[_0x3d95('0x33')][_0x3d95('0x3f')]){_0x9ae4ef[_0x3d95('0x3c')]=_[_0x3d95('0x3d')](_0x9ae4ef[_0x3d95('0x3c')],{'$or':_[_0x3d95('0x2d')](_0x9ae4ef[_0x3d95('0x36')],function(_0x567848){var _0x5e921a={};_0x5e921a[_0x567848]={'$like':'%'+_0x15819d[_0x3d95('0x33')][_0x3d95('0x3f')]+'%'};return _0x5e921a;})});}_0x9ae4ef=_[_0x3d95('0x3d')]({},_0x9ae4ef,_0x15819d[_0x3d95('0x40')]);return db['Disposition'][_0x3d95('0x1f')]({'where':_0x9ae4ef[_0x3d95('0x3c')]})['then'](function(_0x484939){_0x496847[_0x3d95('0x1f')]=_0x484939;if(_0x15819d[_0x3d95('0x33')][_0x3d95('0x41')]){_0x9ae4ef[_0x3d95('0x42')]=[{'all':!![]}];}return db['Disposition'][_0x3d95('0x43')](_0x9ae4ef);})[_0x3d95('0x22')](function(_0x203b15){_0x496847[_0x3d95('0x44')]=_0x203b15;return _0x496847;});}})[_0x3d95('0x22')](respondWithFilteredResult(_0x5d492b,_0x9ae4ef))[_0x3d95('0x18')](handleError(_0x5d492b,null));};exports[_0x3d95('0x55')]=function(_0x3bdf86,_0x3f6b5d){return db[_0x3d95('0x2e')]['find']({'where':{'id':_0x3bdf86['params']['id']}})['then'](handleEntityNotFound(_0x3f6b5d,null))['then'](function(_0x38246e){if(_0x38246e){return _0x38246e['removeDispositions'](_0x3bdf86[_0x3d95('0x33')][_0x3d95('0x56')]);}})['then'](respondWithStatusCode(_0x3f6b5d,null))['catch'](handleError(_0x3f6b5d,null));};exports[_0x3d95('0x57')]=function(_0x149acb,_0x33c450){if(_0x149acb[_0x3d95('0x4a')]['id']){delete _0x149acb['body']['id'];}return db['MailAccount'][_0x3d95('0x49')]({'where':{'id':_0x149acb[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x33c450,null))[_0x3d95('0x22')](function(_0x4361b0){if(_0x4361b0){_0x149acb['body'][_0x3d95('0x54')]=_0x4361b0['id'];return db[_0x3d95('0x58')][_0x3d95('0x51')](_0x149acb[_0x3d95('0x4a')]);}})[_0x3d95('0x22')](respondWithResult(_0x33c450,null))[_0x3d95('0x18')](handleError(_0x33c450,null));};exports['getAnswers']=function(_0x647db9,_0x1f2ca4){var _0x514ba2={'raw':![],'where':{}};var _0x27051f={};var _0x1e7fce={'count':0x0,'rows':[]};return db[_0x3d95('0x2e')][_0x3d95('0x52')]({'where':{'id':_0x647db9[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x1f2ca4,null))[_0x3d95('0x22')](function(_0xb9ae44){if(_0xb9ae44){_0x27051f[_0x3d95('0x32')]=_['keys'](db[_0x3d95('0x58')][_0x3d95('0x47')]);_0x27051f['query']=_['keys'](_0x647db9[_0x3d95('0x33')]);_0x27051f[_0x3d95('0x34')]=_[_0x3d95('0x35')](_0x27051f['model'],_0x27051f[_0x3d95('0x33')]);_0x514ba2['attributes']=_['intersection'](_0x27051f['model'],qs['fields'](_0x647db9['query'][_0x3d95('0x37')]));_0x514ba2[_0x3d95('0x36')]=_0x514ba2['attributes'][_0x3d95('0x38')]?_0x514ba2['attributes']:_0x27051f[_0x3d95('0x32')];if(!_0x647db9[_0x3d95('0x33')][_0x3d95('0x39')](_0x3d95('0x3a'))){_0x514ba2[_0x3d95('0x1e')]=qs[_0x3d95('0x1e')](_0x647db9[_0x3d95('0x33')][_0x3d95('0x1e')]);_0x514ba2[_0x3d95('0x1c')]=qs['offset'](_0x647db9[_0x3d95('0x33')][_0x3d95('0x1c')]);}_0x514ba2['order']=qs[_0x3d95('0x3b')](_0x647db9[_0x3d95('0x33')][_0x3d95('0x3b')]);_0x514ba2['where']=qs[_0x3d95('0x34')](_[_0x3d95('0x53')](_0x647db9['query'],_0x27051f['filters']));_0x514ba2[_0x3d95('0x3c')]['MailAccountId']=_0xb9ae44['id'];if(_0x647db9['query']['filter']){_0x514ba2['where']=_[_0x3d95('0x3d')](_0x514ba2[_0x3d95('0x3c')],{'$or':_[_0x3d95('0x2d')](_0x514ba2[_0x3d95('0x36')],function(_0x5deff6){var _0x175477={};_0x175477[_0x5deff6]={'$like':'%'+_0x647db9[_0x3d95('0x33')]['filter']+'%'};return _0x175477;})});}_0x514ba2=_[_0x3d95('0x3d')]({},_0x514ba2,_0x647db9[_0x3d95('0x40')]);return db['CannedAnswer']['count']({'where':_0x514ba2['where']})[_0x3d95('0x22')](function(_0x4f5bf4){_0x1e7fce[_0x3d95('0x1f')]=_0x4f5bf4;if(_0x647db9['query'][_0x3d95('0x41')]){_0x514ba2['include']=[{'all':!![]}];}return db[_0x3d95('0x58')][_0x3d95('0x43')](_0x514ba2);})['then'](function(_0x5bf968){_0x1e7fce[_0x3d95('0x44')]=_0x5bf968;return _0x1e7fce;});}})[_0x3d95('0x22')](respondWithFilteredResult(_0x1f2ca4,_0x514ba2))[_0x3d95('0x18')](handleError(_0x1f2ca4,null));};exports[_0x3d95('0x59')]=function(_0x11f904,_0x56b5e9){return db['MailAccount'][_0x3d95('0x49')]({'where':{'id':_0x11f904[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x56b5e9,null))[_0x3d95('0x22')](function(_0xb9fc97){if(_0xb9fc97){return _0xb9fc97['removeAnswers'](_0x11f904[_0x3d95('0x33')][_0x3d95('0x56')]);}})[_0x3d95('0x22')](respondWithStatusCode(_0x56b5e9,null))[_0x3d95('0x18')](handleError(_0x56b5e9,null));};exports[_0x3d95('0x51')]=function(_0x8431e0,_0x199d3b){var _0x2ebc6e={'name':_0x8431e0['body'][_0x3d95('0x27')],'key':_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x31')],'provider':_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x5a')]===_0x3d95('0x5b')?null:_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x5a')],'email':_0x8431e0[_0x3d95('0x4a')]['email'],'ListId':_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x5c')],'active':!_[_0x3d95('0x5d')](_0x8431e0['body'][_0x3d95('0x5e')])?_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x5e')]:!![],'description':_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x5f')]||null,'Imap':{},'Smtp':{}};if(_0x2ebc6e[_0x3d95('0x5a')]){_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x60')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x60')]=_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x61')];_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x62')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x63')]=_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x62')];if(_0x8431e0[_0x3d95('0x4a')]['modernAuthentication']){_0x2ebc6e['Imap'][_0x3d95('0x4b')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x4b')]=!![];_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x4e')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x4e')]=_0x8431e0[_0x3d95('0x4a')]['CloudProviderId'];_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x62')]=_0x2ebc6e[_0x3d95('0x4c')]['pass']=null;_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x4d')]=![];}else{_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x4e')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x4e')]=null;}_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x64')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x64')]=null;_0x2ebc6e['Imap'][_0x3d95('0x65')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x65')]=null;_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x66')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x66')]=null;}else{if(_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x67')]){_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x60')]=_0x2ebc6e['Smtp'][_0x3d95('0x60')]=_0x8431e0[_0x3d95('0x4a')]['username'];_0x2ebc6e[_0x3d95('0x46')]['password']=_0x2ebc6e['Smtp']['pass']=_0x8431e0[_0x3d95('0x4a')]['password'];}else{_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x67')]=_0x2ebc6e['Smtp']['authentication']=![];_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x60')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x60')]=null;_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x62')]=_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x63')]=null;}_0x2ebc6e[_0x3d95('0x46')][_0x3d95('0x65')]=_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x46')][_0x3d95('0x65')];_0x2ebc6e['Imap']['port']=_0x8431e0[_0x3d95('0x4a')]['Imap'][_0x3d95('0x66')];_0x2ebc6e[_0x3d95('0x4c')][_0x3d95('0x65')]=_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x4c')][_0x3d95('0x65')];_0x2ebc6e['Smtp'][_0x3d95('0x66')]=_0x8431e0[_0x3d95('0x4a')][_0x3d95('0x4c')][_0x3d95('0x66')];}return db[_0x3d95('0x2e')][_0x3d95('0x51')](_0x2ebc6e,{'include':[{'model':db[_0x3d95('0x2a')],'as':'Smtp'},{'model':db[_0x3d95('0x29')],'as':'Imap'}]})[_0x3d95('0x22')](function(_0x736d34){var _0x1e3067=_0x8431e0[_0x3d95('0x60')][_0x3d95('0x68')]({'plain':!![]});if(!_0x1e3067)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e3067[_0x3d95('0x69')]===_0x3d95('0x60')){var _0x2fc535=_0x736d34['get']({'plain':!![]});return db[_0x3d95('0x6a')][_0x3d95('0x49')]({'where':{'name':'MailAccounts','userProfileId':_0x1e3067['userProfileId']},'raw':!![]})[_0x3d95('0x22')](function(_0x30ce70){if(_0x30ce70&&_0x30ce70[_0x3d95('0x6b')]===0x0){return db[_0x3d95('0x24')][_0x3d95('0x51')]({'name':_0x2fc535[_0x3d95('0x27')],'resourceId':_0x2fc535['id'],'type':_0x30ce70[_0x3d95('0x27')],'sectionId':_0x30ce70['id']},{})[_0x3d95('0x22')](function(){return _0x736d34;});}else{return _0x736d34;}})[_0x3d95('0x18')](function(_0x531bf7){logger['error'](_0x3d95('0x6c'),_0x531bf7);throw _0x531bf7;});}return _0x736d34;})[_0x3d95('0x22')](respondWithResult(_0x199d3b,0xc9))[_0x3d95('0x18')](handleError(_0x199d3b,null));};exports[_0x3d95('0x6d')]=function(_0x3b778f,_0x206dcf){return db[_0x3d95('0x2e')][_0x3d95('0x52')]({'where':{'id':_0x3b778f['params']['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x206dcf,null))['then'](function(_0x594d31){if(_0x594d31){return _0x594d31[_0x3d95('0x6d')]();}return null;})[_0x3d95('0x22')](respondWithResult(_0x206dcf,null))[_0x3d95('0x18')](handleError(_0x206dcf,null));};exports[_0x3d95('0x6e')]=function(_0x21f957,_0x2eeabf){if(_0x21f957[_0x3d95('0x4a')]['id']){delete _0x21f957[_0x3d95('0x4a')]['id'];}return db[_0x3d95('0x2e')]['find']({'where':{'id':_0x21f957[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x2eeabf,null))[_0x3d95('0x22')](function(_0x52c528){if(_0x52c528){_0x21f957[_0x3d95('0x4a')][_0x3d95('0x54')]=_0x52c528['id'];return db[_0x3d95('0x29')]['create'](_0x21f957[_0x3d95('0x4a')]);}})['then'](respondWithResult(_0x2eeabf,null))['catch'](handleError(_0x2eeabf,null));};exports['removeImap']=function(_0x44131d,_0xaad38e){return db[_0x3d95('0x2e')][_0x3d95('0x52')]({'where':{'id':_0x44131d['params']['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0xaad38e,null))[_0x3d95('0x22')](function(_0x178eb7){if(_0x178eb7){return _0x178eb7[_0x3d95('0x6f')](null);}return null;})['then'](respondWithStatusCode(_0xaad38e,null))[_0x3d95('0x18')](handleError(_0xaad38e,null));};exports[_0x3d95('0x70')]=function(_0x1857b3,_0x56117f){return db[_0x3d95('0x2e')][_0x3d95('0x52')]({'where':{'id':_0x1857b3[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x56117f,null))[_0x3d95('0x22')](function(_0x4e15e0){if(_0x4e15e0){return _0x4e15e0[_0x3d95('0x70')]();}return null;})['then'](respondWithResult(_0x56117f,null))[_0x3d95('0x18')](handleError(_0x56117f,null));};exports[_0x3d95('0x71')]=function(_0x297ef1,_0x1ba98c){if(_0x297ef1['body']['id']){delete _0x297ef1[_0x3d95('0x4a')]['id'];}return db[_0x3d95('0x2e')][_0x3d95('0x49')]({'where':{'id':_0x297ef1[_0x3d95('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ba98c,null))[_0x3d95('0x22')](function(_0x4cbfd3){if(_0x4cbfd3){_0x297ef1[_0x3d95('0x4a')][_0x3d95('0x54')]=_0x4cbfd3['id'];return db['MailServerOut'][_0x3d95('0x51')](_0x297ef1[_0x3d95('0x4a')]);}})['then'](respondWithResult(_0x1ba98c,null))[_0x3d95('0x18')](handleError(_0x1ba98c,null));};exports[_0x3d95('0x72')]=function(_0x2cd8e8,_0x2df7e2){return db['MailAccount'][_0x3d95('0x52')]({'where':{'id':_0x2cd8e8['params']['id']}})['then'](handleEntityNotFound(_0x2df7e2,null))['then'](function(_0x353de9){if(_0x353de9){return _0x353de9[_0x3d95('0x73')](null);}return null;})[_0x3d95('0x22')](respondWithStatusCode(_0x2df7e2,null))['catch'](handleError(_0x2df7e2,null));};exports[_0x3d95('0x74')]=function(_0x3665f9,_0x2f0b3d){return db['MailInteraction'][_0x3d95('0x49')]({'where':{'id':_0x3665f9['params']['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x2f0b3d,null))[_0x3d95('0x22')](function(_0x140181){if(_0x140181){return _0x140181[_0x3d95('0x74')](_0x3665f9[_0x3d95('0x4a')][_0x3d95('0x56')],_[_0x3d95('0x75')](_0x3665f9[_0x3d95('0x4a')],['ids','id'])||{});}})[_0x3d95('0x22')](respondWithResult(_0x2f0b3d,null))[_0x3d95('0x18')](handleError(_0x2f0b3d,null));};exports[_0x3d95('0x76')]=function(_0x43cbdf,_0x4aefb1){var _0x31b140={'raw':![],'where':{}};var _0x15e08b={};var _0x12c3ac={'count':0x0,'rows':[]};return db[_0x3d95('0x2e')][_0x3d95('0x52')]({'where':{'id':_0x43cbdf[_0x3d95('0x45')]['id']}})['then'](handleEntityNotFound(_0x4aefb1,null))[_0x3d95('0x22')](function(_0x4ccaf0){if(_0x4ccaf0){_0x15e08b[_0x3d95('0x32')]=_['keys'](db[_0x3d95('0x77')][_0x3d95('0x47')]);_0x15e08b['query']=_[_0x3d95('0x48')](_0x43cbdf[_0x3d95('0x33')]);_0x15e08b[_0x3d95('0x34')]=_[_0x3d95('0x35')](_0x15e08b['model'],_0x15e08b[_0x3d95('0x33')]);_0x31b140[_0x3d95('0x36')]=_[_0x3d95('0x35')](_0x15e08b[_0x3d95('0x32')],qs[_0x3d95('0x37')](_0x43cbdf[_0x3d95('0x33')]['fields']));_0x31b140[_0x3d95('0x36')]=_0x31b140[_0x3d95('0x36')][_0x3d95('0x38')]?_0x31b140['attributes']:_0x15e08b[_0x3d95('0x32')];if(!_0x43cbdf['query'][_0x3d95('0x39')](_0x3d95('0x3a'))){_0x31b140[_0x3d95('0x1e')]=qs[_0x3d95('0x1e')](_0x43cbdf[_0x3d95('0x33')][_0x3d95('0x1e')]);_0x31b140[_0x3d95('0x1c')]=qs[_0x3d95('0x1c')](_0x43cbdf[_0x3d95('0x33')][_0x3d95('0x1c')]);}_0x31b140[_0x3d95('0x78')]=qs['sort'](_0x43cbdf['query'][_0x3d95('0x3b')]);_0x31b140[_0x3d95('0x3c')]=qs[_0x3d95('0x34')](_[_0x3d95('0x53')](_0x43cbdf[_0x3d95('0x33')],_0x15e08b[_0x3d95('0x34')]));_0x31b140[_0x3d95('0x3c')]['MailAccountId']=_0x4ccaf0['id'];if(_0x43cbdf[_0x3d95('0x33')][_0x3d95('0x3f')]){_0x31b140['where']=_[_0x3d95('0x3d')](_0x31b140[_0x3d95('0x3c')],{'$or':_['map'](_0x31b140[_0x3d95('0x36')],function(_0x170267){var _0x26cd22={};_0x26cd22[_0x170267]={'$like':'%'+_0x43cbdf['query']['filter']+'%'};return _0x26cd22;})});}_0x31b140=_[_0x3d95('0x3d')]({},_0x31b140,_0x43cbdf[_0x3d95('0x40')]);return db[_0x3d95('0x77')][_0x3d95('0x1f')]({'where':_0x31b140[_0x3d95('0x3c')]})[_0x3d95('0x22')](function(_0x389007){_0x12c3ac[_0x3d95('0x1f')]=_0x389007;if(_0x43cbdf[_0x3d95('0x33')][_0x3d95('0x41')]){_0x31b140[_0x3d95('0x42')]=[{'model':db[_0x3d95('0x79')],'as':_0x3d95('0x7a'),'required':![]},{'model':db[_0x3d95('0x7b')],'as':'Owner','attributes':[_0x3d95('0x27'),'fullname',_0x3d95('0x7c')],'required':![]},{'model':db[_0x3d95('0x7d')],'as':'Tags','attributes':['id','name','color'],'where':_0x43cbdf[_0x3d95('0x33')][_0x3d95('0x7e')]?{'id':_0x43cbdf[_0x3d95('0x33')][_0x3d95('0x7e')]}:undefined,'required':_0x43cbdf['query']['tag']?!![]:![]}];}return db[_0x3d95('0x77')][_0x3d95('0x43')](_0x31b140);})[_0x3d95('0x22')](function(_0xc1859b){_0x12c3ac[_0x3d95('0x44')]=_0xc1859b;return _0x12c3ac;});}})[_0x3d95('0x22')](respondWithFilteredResult(_0x4aefb1,_0x31b140))[_0x3d95('0x18')](handleError(_0x4aefb1,null));};exports[_0x3d95('0x7f')]=function addApplications(_0x18acbc,_0x439ee8){var _0x3b3be4=_0x18acbc[_0x3d95('0x45')]['id'];var _0x1ced90=_0x18acbc[_0x3d95('0x4a')];var _0x28a317=0xc8;var _0x2071a8=null;return db[_0x3d95('0x80')]['transaction']({'isolationLevel':db['sequelize'][_0x3d95('0x81')]['ISOLATION_LEVELS'][_0x3d95('0x82')]},function(_0x398747){return db[_0x3d95('0x2e')][_0x3d95('0x52')]({'where':{'id':_0x3b3be4},'transaction':_0x398747})['then'](function(_0x45bdcd){if(_0x45bdcd){return db[_0x3d95('0x83')][_0x3d95('0x23')]({'where':{'MailAccountId':_0x3b3be4},'transaction':_0x398747})['then'](function(){var _0x21f6b3=_['map'](_0x1ced90,function(_0x186c6b){_0x186c6b[_0x3d95('0x54')]=_0x3b3be4;return _0x186c6b;});return db[_0x3d95('0x83')]['bulkCreate'](_0x21f6b3,{'transaction':_0x398747});});}else{_0x28a317=0x194;_0x2071a8=[];}});})[_0x3d95('0x22')](function(){if(_0x28a317!==0x194){return db[_0x3d95('0x83')][_0x3d95('0x84')]({'where':{'MailAccountId':_0x3b3be4},'order':_0x3d95('0x85')})[_0x3d95('0x22')](function(_0x418706){_0x2071a8=_0x418706;});}})[_0x3d95('0x18')](function(_0x6b5596){_0x28a317=0x1f4;logger[_0x3d95('0x13')](_0x6b5596[_0x3d95('0x26')]);if(_0x6b5596[_0x3d95('0x27')]){delete _0x6b5596['name'];}_0x2071a8=_0x6b5596;})[_0x3d95('0x86')](function(){if(_0x2071a8===null){_0x439ee8[_0x3d95('0x19')](_0x28a317);}else{if(_0x28a317===0x1f4){_0x439ee8[_0x3d95('0x1a')](_0x28a317)['send'](_0x2071a8);}else{_0x439ee8['status'](_0x28a317)[_0x3d95('0x1b')](_0x2071a8);}}});};exports['getApplications']=function(_0x2a5b01,_0x2ac680){var _0x29f670={};var _0x5494bf={};var _0x215317;var _0x3f00ed;return db[_0x3d95('0x2e')]['findOne']({'where':{'id':_0x2a5b01[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x2ac680,null))[_0x3d95('0x22')](function(_0x441aaf){if(_0x441aaf){_0x215317=_0x441aaf;_0x5494bf[_0x3d95('0x32')]=_[_0x3d95('0x48')](db['MailApplication'][_0x3d95('0x47')]);_0x5494bf[_0x3d95('0x33')]=_['keys'](_0x2a5b01[_0x3d95('0x33')]);_0x5494bf[_0x3d95('0x34')]=_[_0x3d95('0x35')](_0x5494bf[_0x3d95('0x32')],_0x5494bf[_0x3d95('0x33')]);_0x29f670['attributes']=_['intersection'](_0x5494bf[_0x3d95('0x32')],qs[_0x3d95('0x37')](_0x2a5b01['query'][_0x3d95('0x37')]));_0x29f670[_0x3d95('0x36')]=_0x29f670[_0x3d95('0x36')][_0x3d95('0x38')]?_0x29f670[_0x3d95('0x36')]:_0x5494bf[_0x3d95('0x32')];_0x29f670[_0x3d95('0x78')]=qs[_0x3d95('0x3b')](_0x2a5b01[_0x3d95('0x33')]['sort']);_0x29f670['where']=qs[_0x3d95('0x34')](_[_0x3d95('0x53')](_0x2a5b01[_0x3d95('0x33')],_0x5494bf[_0x3d95('0x34')]));if(_0x2a5b01['query']['filter']){_0x29f670[_0x3d95('0x3c')]=_[_0x3d95('0x3d')](_0x29f670[_0x3d95('0x3c')],{'$or':_['map'](_0x29f670['attributes'],function(_0x47de5e){var _0x177a8e={};_0x177a8e[_0x47de5e]={'$like':'%'+_0x2a5b01[_0x3d95('0x33')]['filter']+'%'};return _0x177a8e;})});}_0x29f670=_[_0x3d95('0x3d')]({},_0x29f670,_0x2a5b01['options']);return _0x215317[_0x3d95('0x87')](_0x29f670);}})[_0x3d95('0x22')](function(_0x22d8ef){if(_0x22d8ef){_0x3f00ed=_0x22d8ef[_0x3d95('0x38')];if(!_0x2a5b01[_0x3d95('0x33')][_0x3d95('0x39')](_0x3d95('0x3a'))){_0x29f670[_0x3d95('0x1e')]=qs[_0x3d95('0x1e')](_0x2a5b01[_0x3d95('0x33')][_0x3d95('0x1e')]);_0x29f670[_0x3d95('0x1c')]=qs[_0x3d95('0x1c')](_0x2a5b01['query']['offset']);}return _0x215317[_0x3d95('0x87')](_0x29f670);}})[_0x3d95('0x22')](function(_0x44d5f3){if(_0x44d5f3){return _0x44d5f3?{'count':_0x3f00ed,'rows':_0x44d5f3}:null;}})[_0x3d95('0x22')](respondWithResult(_0x2ac680,null))[_0x3d95('0x18')](handleError(_0x2ac680,null));};exports[_0x3d95('0x88')]=function(_0x13e66c,_0xe9eaf9){var _0x6294dd={'raw':!![],'where':{}};var _0x54142d={};var _0x391ea2={'count':0x0,'rows':[]};return db[_0x3d95('0x2e')][_0x3d95('0x52')]({'where':{'id':_0x13e66c[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0xe9eaf9,null))['then'](function(_0x4a1512){if(_0x4a1512){_0x54142d[_0x3d95('0x32')]=_[_0x3d95('0x48')](db[_0x3d95('0x89')]['rawAttributes']);_0x54142d[_0x3d95('0x33')]=_[_0x3d95('0x48')](_0x13e66c[_0x3d95('0x33')]);_0x54142d[_0x3d95('0x34')]=_[_0x3d95('0x35')](_0x54142d[_0x3d95('0x32')],_0x54142d[_0x3d95('0x33')]);_0x6294dd[_0x3d95('0x36')]=_[_0x3d95('0x35')](_0x54142d[_0x3d95('0x32')],qs[_0x3d95('0x37')](_0x13e66c[_0x3d95('0x33')]['fields']));_0x6294dd['attributes']=_0x6294dd['attributes'][_0x3d95('0x38')]?_0x6294dd['attributes']:_0x54142d[_0x3d95('0x32')];if(!_0x13e66c[_0x3d95('0x33')][_0x3d95('0x39')](_0x3d95('0x3a'))){_0x6294dd['limit']=qs[_0x3d95('0x1e')](_0x13e66c[_0x3d95('0x33')][_0x3d95('0x1e')]);_0x6294dd[_0x3d95('0x1c')]=qs[_0x3d95('0x1c')](_0x13e66c['query'][_0x3d95('0x1c')]);}_0x6294dd[_0x3d95('0x78')]=qs[_0x3d95('0x3b')](_0x13e66c[_0x3d95('0x33')][_0x3d95('0x3b')]);_0x6294dd[_0x3d95('0x3c')]=qs[_0x3d95('0x34')](_[_0x3d95('0x53')](_0x13e66c[_0x3d95('0x33')],_0x54142d[_0x3d95('0x34')]));_0x6294dd[_0x3d95('0x3c')][_0x3d95('0x54')]=_0x4a1512['id'];if(_0x13e66c['query']['filter']){_0x6294dd['where']=_[_0x3d95('0x3d')](_0x6294dd['where'],{'$or':_[_0x3d95('0x2d')](_0x6294dd[_0x3d95('0x36')],function(_0x33a8c7){var _0xcb85a={};_0xcb85a[_0x33a8c7]={'$like':'%'+_0x13e66c[_0x3d95('0x33')]['filter']+'%'};return _0xcb85a;})});}if(_0x13e66c[_0x3d95('0x33')][_0x3d95('0x8a')]){var _0x438c5c=_0x13e66c[_0x3d95('0x33')][_0x3d95('0x8a')][_0x3d95('0x8b')](',');var _0x1ae3c9={};_0x1ae3c9[_0x438c5c[0x0]]={'$gte':moment(_0x438c5c[0x1])[_0x3d95('0x8c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x6294dd['where']=_[_0x3d95('0x3d')](_0x6294dd[_0x3d95('0x3c')],_0x1ae3c9);}_0x6294dd=_[_0x3d95('0x3d')]({},_0x6294dd,_0x13e66c[_0x3d95('0x40')]);return db[_0x3d95('0x89')][_0x3d95('0x1f')]({'where':_0x6294dd['where']})[_0x3d95('0x22')](function(_0x397aa9){_0x391ea2[_0x3d95('0x1f')]=_0x397aa9;if(_0x13e66c['query']['includeAll']){_0x6294dd[_0x3d95('0x42')]=[{'all':!![]}];}return db['MailMessage'][_0x3d95('0x43')](_0x6294dd);})['then'](function(_0x200e4f){if(_0x13e66c[_0x3d95('0x33')][_0x3d95('0x8d')]===_0x3d95('0x8e')){for(var _0x31d09c=0x0;_0x31d09c<_0x200e4f[_0x3d95('0x38')];_0x31d09c++){_0x200e4f[_0x31d09c]['body']=juice(_0x200e4f[_0x31d09c][_0x3d95('0x4a')]);}}_0x391ea2[_0x3d95('0x44')]=_0x200e4f;return _0x391ea2;});}})[_0x3d95('0x22')](respondWithFilteredResult(_0xe9eaf9,_0x6294dd))['catch'](handleError(_0xe9eaf9,null));};exports['send']=function(_0x4b3d32,_0x4641df){var _0x468608,_0xf9de9f={},_0x1069e3;if(_0x4b3d32[_0x3d95('0x4a')]['to']){_0x1069e3=_0x4b3d32[_0x3d95('0x4a')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x3d95('0x49')]({'where':{'id':_0x4b3d32['params']['id']},'include':[{'model':db['CmList'],'as':_0x3d95('0x8f'),'include':[{'model':db[_0x3d95('0x79')],'as':_0x3d95('0x90'),'where':{'email':_0x1069e3},'limit':0x1,'order':[[_0x3d95('0x91'),_0x3d95('0x92')]]}]},{'model':db[_0x3d95('0x2a')],'as':_0x3d95('0x4c'),'raw':!![],'include':[{'model':db[_0x3d95('0x93')],'as':_0x3d95('0x93'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4641df,null))[_0x3d95('0x22')](function(_0x561141){if(!_0x561141)return;_0x468608=_0x561141;if(!_0x561141[_0x3d95('0x4c')])throw new Error(_0x3d95('0x94'));if(_[_0x3d95('0x5d')](_0x4b3d32[_0x3d95('0x4a')][_0x3d95('0x95')])){_0x4b3d32[_0x3d95('0x4a')]['from']=util['format'](_0x3d95('0x96'),_0x561141[_0x3d95('0x27')],_0x561141['email']||_0x561141['Smtp'][_0x3d95('0x60')]);}if(_0x4b3d32[_0x3d95('0x4a')]['attachments']&&_0x4b3d32['body']['attachments'][_0x3d95('0x38')]){for(var _0x219121=0x0;_0x219121<_0x4b3d32[_0x3d95('0x4a')][_0x3d95('0x97')][_0x3d95('0x38')];_0x219121+=0x1){_0x4b3d32['body'][_0x3d95('0x97')][_0x219121]={'filename':_0x4b3d32[_0x3d95('0x4a')][_0x3d95('0x97')][_0x219121][_0x3d95('0x27')],'path':path[_0x3d95('0x98')](config[_0x3d95('0x99')],_0x3d95('0x9a'),_0x4b3d32[_0x3d95('0x4a')][_0x3d95('0x97')][_0x219121][_0x3d95('0x9b')])};}}var _0x3d43a0=_0x561141[_0x3d95('0x9c')]();return respondWithRpcPromise('SendMail',_0x3d95('0x9d'),{'account':_0x3d43a0,'message':_0x4b3d32[_0x3d95('0x4a')]});})[_0x3d95('0x22')](function(_0x49f13a){if(!_0x49f13a)return;_0xf9de9f=_0x49f13a;if(!_0x468608[_0x3d95('0x8f')])throw new Error(_0x3d95('0x9e'));if(_0x468608[_0x3d95('0x8f')][_0x3d95('0x90')]['length'])return _0x468608[_0x3d95('0x8f')][_0x3d95('0x90')][0x0];return db[_0x3d95('0x79')][_0x3d95('0x51')](_[_0x3d95('0x8')](_0x4b3d32[_0x3d95('0x4a')],{'firstName':_0x4b3d32[_0x3d95('0x4a')]['to'],'email':_0x4b3d32[_0x3d95('0x4a')]['to'],'phone':_0x4b3d32[_0x3d95('0x4a')]['to'],'ListId':_0x468608[_0x3d95('0x5c')]}));})[_0x3d95('0x22')](function(_0xcf47bb){if(!_0xcf47bb)return;var _0x5e6e77={'UserId':_0x4b3d32[_0x3d95('0x60')]['id'],'ContactId':_0xcf47bb['id'],'MailAccountId':_0x468608['id'],'inReplyTo':_0xf9de9f['messageId'],'to':_0x4b3d32[_0x3d95('0x4a')][_0x3d95('0x95')],'cc':_0x4b3d32[_0x3d95('0x4a')]['cc'],'subject':_0x4b3d32[_0x3d95('0x4a')][_0x3d95('0x9f')],'attach':_0x4b3d32[_0x3d95('0x4a')][_0x3d95('0xa0')],'firstMsgDirection':_0x3d95('0xa1'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x3d95('0xa1'),'Messages':[_[_0x3d95('0x3d')](_0x4b3d32[_0x3d95('0x4a')],{'messageId':_0xf9de9f[_0x3d95('0xa2')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x468608['id'],'UserId':_0x4b3d32[_0x3d95('0x60')]['id'],'ContactId':_0xcf47bb['id']})]};if(_0x4b3d32[_0x3d95('0x4a')][_0x3d95('0xa3')]){_0x5e6e77=_[_0x3d95('0x3d')](_0x5e6e77,_0x4b3d32['body'][_0x3d95('0xa3')]);}return db[_0x3d95('0x77')][_0x3d95('0x51')](_0x5e6e77,{'include':[{'model':db['MailMessage'],'as':_0x3d95('0xa4')}]});})[_0x3d95('0x22')](respondWithResult(_0x4641df,null))[_0x3d95('0x18')](handleError(_0x4641df,null));};exports['verifySmtp']=function(_0x564a28,_0x169012){return db[_0x3d95('0x2e')][_0x3d95('0x49')]({'where':{'id':_0x564a28['params']['id']},'include':[{'model':db[_0x3d95('0x2a')],'as':_0x3d95('0x4c'),'raw':!![],'include':[{'model':db[_0x3d95('0x93')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x169012,null))['then'](function(_0x22ca74){if(!_0x22ca74[_0x3d95('0x4c')])return;var _0x4325da=_0x22ca74[_0x3d95('0x9c')]();return respondWithRpcPromise('VerifySmtp',_0x3d95('0xa5'),{'account':_0x4325da});})[_0x3d95('0x22')](respondWithResult(_0x169012,null))[_0x3d95('0x18')](handleError(_0x169012,null));};exports[_0x3d95('0x23')]=function(_0x32e699,_0x656620){return db[_0x3d95('0x2e')][_0x3d95('0x49')]({'where':{'id':_0x32e699[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x656620,null))[_0x3d95('0x22')](function(_0x3bbea3){if(_0x3bbea3&&_0x3bbea3[_0x3d95('0x64')]){throw new db[(_0x3d95('0xa6'))]['ValidationError'](_0x3d95('0xa7'));}return _0x3bbea3;})[_0x3d95('0x22')](removeEntity(_0x656620,null))[_0x3d95('0x18')](handleError(_0x656620,null));};exports[_0x3d95('0xa8')]=function(_0x3642b9,_0x489b56){return db['MailAccount'][_0x3d95('0x49')]({'where':{'id':_0x3642b9[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x489b56,null))[_0x3d95('0x22')](function(_0x17af56){if(_0x17af56){return _0x17af56[_0x3d95('0xa8')](_0x3642b9[_0x3d95('0x4a')][_0x3d95('0x56')],_[_0x3d95('0x75')](_0x3642b9['body'],[_0x3d95('0x56'),'id'])||{})['spread'](function(_0x22fc34){for(var _0x590c19=0x0;_0x590c19<_0x3642b9[_0x3d95('0x4a')][_0x3d95('0x56')]['length'];_0x590c19+=0x1){socket[_0x3d95('0xa9')]('userMailAccount:save',{'UserId':Number(_0x3642b9[_0x3d95('0x4a')][_0x3d95('0x56')][_0x590c19]),'MailAccountId':Number(_0x3642b9[_0x3d95('0x45')]['id'])});}return _0x22fc34;});}})[_0x3d95('0x22')](respondWithResult(_0x489b56,null))[_0x3d95('0x18')](handleError(_0x489b56,null));};exports[_0x3d95('0xaa')]=function(_0x4b3387,_0x58ba2e){return db['MailAccount'][_0x3d95('0x49')]({'where':{'id':_0x4b3387[_0x3d95('0x45')]['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x58ba2e,null))[_0x3d95('0x22')](function(_0x400216){if(_0x400216){return _0x400216[_0x3d95('0xaa')](_0x4b3387[_0x3d95('0x33')][_0x3d95('0x56')])[_0x3d95('0x22')](function(){if(_[_0x3d95('0xab')](_0x4b3387[_0x3d95('0x33')]['ids'])){for(var _0x83efa6=0x0;_0x83efa6<_0x4b3387['query']['ids'][_0x3d95('0x38')];_0x83efa6+=0x1){socket[_0x3d95('0xa9')](_0x3d95('0xac'),{'UserId':Number(_0x4b3387[_0x3d95('0x33')][_0x3d95('0x56')][_0x83efa6]),'MailAccountId':Number(_0x4b3387[_0x3d95('0x45')]['id'])});}}else{socket[_0x3d95('0xa9')](_0x3d95('0xac'),{'UserId':Number(_0x4b3387[_0x3d95('0x33')][_0x3d95('0x56')]),'MailAccountId':Number(_0x4b3387[_0x3d95('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x58ba2e,null))[_0x3d95('0x18')](handleError(_0x58ba2e,null));};exports[_0x3d95('0xad')]=function(_0x52e8ef,_0x76ab24){var _0x3f57f3={};var _0x5f5abe={};var _0x1c598a;var _0x539ba6;return db[_0x3d95('0x2e')][_0x3d95('0x52')]({'where':{'id':_0x52e8ef['params']['id']}})[_0x3d95('0x22')](handleEntityNotFound(_0x76ab24,null))[_0x3d95('0x22')](function(_0x27aef4){if(_0x27aef4){_0x1c598a=_0x27aef4;_0x5f5abe['model']=_[_0x3d95('0x48')](db['User'][_0x3d95('0x47')]);_0x5f5abe[_0x3d95('0x33')]=_[_0x3d95('0x48')](_0x52e8ef[_0x3d95('0x33')]);_0x5f5abe[_0x3d95('0x34')]=_[_0x3d95('0x35')](_0x5f5abe[_0x3d95('0x32')],_0x5f5abe[_0x3d95('0x33')]);_0x3f57f3[_0x3d95('0x36')]=_[_0x3d95('0x35')](_0x5f5abe[_0x3d95('0x32')],qs[_0x3d95('0x37')](_0x52e8ef['query'][_0x3d95('0x37')]));_0x3f57f3['attributes']=_0x3f57f3[_0x3d95('0x36')][_0x3d95('0x38')]?_0x3f57f3[_0x3d95('0x36')]:_0x5f5abe[_0x3d95('0x32')];_0x3f57f3['order']=qs[_0x3d95('0x3b')](_0x52e8ef[_0x3d95('0x33')][_0x3d95('0x3b')]);_0x3f57f3[_0x3d95('0x3c')]=qs[_0x3d95('0x34')](_[_0x3d95('0x53')](_0x52e8ef['query'],_0x5f5abe[_0x3d95('0x34')]));if(_0x52e8ef[_0x3d95('0x33')][_0x3d95('0x3f')]){_0x3f57f3[_0x3d95('0x3c')]=_[_0x3d95('0x3d')](_0x3f57f3[_0x3d95('0x3c')],{'$or':_[_0x3d95('0x2d')](_0x3f57f3[_0x3d95('0x36')],function(_0x362ae0){var _0x4d2020={};_0x4d2020[_0x362ae0]={'$like':'%'+_0x52e8ef[_0x3d95('0x33')][_0x3d95('0x3f')]+'%'};return _0x4d2020;})});}_0x3f57f3=_[_0x3d95('0x3d')]({},_0x3f57f3,_0x52e8ef['options']);return _0x1c598a[_0x3d95('0xad')](_0x3f57f3);}})[_0x3d95('0x22')](function(_0x30b8c2){if(_0x30b8c2){_0x539ba6=_0x30b8c2[_0x3d95('0x38')];if(!_0x52e8ef[_0x3d95('0x33')][_0x3d95('0x39')](_0x3d95('0x3a'))){_0x3f57f3[_0x3d95('0x1e')]=qs[_0x3d95('0x1e')](_0x52e8ef['query']['limit']);_0x3f57f3[_0x3d95('0x1c')]=qs['offset'](_0x52e8ef['query'][_0x3d95('0x1c')]);}return _0x1c598a['getAgents'](_0x3f57f3);}})[_0x3d95('0x22')](function(_0x222f4b){if(_0x222f4b){return _0x222f4b?{'count':_0x539ba6,'rows':_0x222f4b}:null;}})['then'](respondWithResult(_0x76ab24,null))[_0x3d95('0x18')](handleError(_0x76ab24,null));}; \ No newline at end of file +var _0x0e55=['omit','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','finally','send','getApplications','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','juice','ioredis','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','MailAccounts','index','Imap','MailServerOut','Smtp','Pause','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','options','MailAccount','includeAll','findAll','rows','show','MailServerIn','mandatoryDispositionPause','include','merge','body','CloudProviderId','modernAuthentication','secure','find','describe','params','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','provider','custom','email','ListId','isNil','active','description','user','username','password','pass','service','host','port','authentication','role','UserProfileSection','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction'];(function(_0x5fe324,_0x588002){var _0x3f9c81=function(_0x12e28b){while(--_0x12e28b){_0x5fe324['push'](_0x5fe324['shift']());}};_0x3f9c81(++_0x588002);}(_0x0e55,0x1a1));var _0x50e5=function(_0x465305,_0x2b0356){_0x465305=_0x465305-0x0;var _0x5b413e=_0x0e55[_0x465305];return _0x5b413e;};'use strict';var moment=require(_0x50e5('0x0'));var BPromise=require(_0x50e5('0x1'));var util=require(_0x50e5('0x2'));var path=require(_0x50e5('0x3'));var _=require(_0x50e5('0x4'));var juice=require(_0x50e5('0x5'));var Redis=require(_0x50e5('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x50e5('0x7'))['db'];config['redis']=_[_0x50e5('0x8')](config[_0x50e5('0x9')],{'host':_0x50e5('0xa'),'port':0x18eb});var socket=require(_0x50e5('0xb'))(new Redis(config[_0x50e5('0x9')]));require('./mailAccount.socket')[_0x50e5('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x50e5('0xd')]['http']({'port':0x232b});function respondWithRpcPromise(_0x3055dd,_0x422565,_0x517ef1,_0x432c58){return new BPromise(function(_0x35cf21,_0xf0ca4f){var _0x25bc6e=_0x432c58||client;return _0x25bc6e[_0x50e5('0xe')](_0x3055dd,_0x517ef1)['then'](function(_0x3aa6f){logger[_0x50e5('0xf')](_0x50e5('0x10'),_0x422565,_0x50e5('0x11'));logger[_0x50e5('0x12')](_0x50e5('0x13'),_0x422565,_0x50e5('0x11'),JSON[_0x50e5('0x14')](_0x3aa6f));if(_0x3aa6f['error']){if(_0x3aa6f[_0x50e5('0x15')][_0x50e5('0x16')]===0x1f4){logger[_0x50e5('0x15')](_0x50e5('0x10'),_0x422565,_0x3aa6f[_0x50e5('0x15')]['message']);return _0xf0ca4f(_0x3aa6f[_0x50e5('0x15')][_0x50e5('0x17')]);}logger['error'](_0x50e5('0x10'),_0x422565,_0x3aa6f['error'][_0x50e5('0x17')]);return _0x35cf21(_0x3aa6f[_0x50e5('0x15')]['message']);}else{logger['info'](_0x50e5('0x10'),_0x422565,_0x50e5('0x11'));_0x35cf21(_0x3aa6f[_0x50e5('0x18')][_0x50e5('0x17')]);}})[_0x50e5('0x19')](function(_0x484481){logger[_0x50e5('0x15')]('MailAccount,\x20%s,\x20%s',_0x422565,_0x484481);_0xf0ca4f(_0x484481);});});}function respondWithStatusCode(_0x15aca5,_0x5aaee7){_0x5aaee7=_0x5aaee7||0xcc;return function(_0xb06f9){if(_0xb06f9){return _0x15aca5[_0x50e5('0x1a')](_0x5aaee7);}return _0x15aca5[_0x50e5('0x1b')](_0x5aaee7)[_0x50e5('0x1c')]();};}function respondWithResult(_0x185550,_0x4a3985){_0x4a3985=_0x4a3985||0xc8;return function(_0x3ee755){if(_0x3ee755){return _0x185550[_0x50e5('0x1b')](_0x4a3985)[_0x50e5('0x1d')](_0x3ee755);}};}function respondWithFilteredResult(_0x18806c,_0x4a7456){return function(_0x1fb080){if(_0x1fb080){var _0x40b9ad=typeof _0x4a7456['offset']===_0x50e5('0x1e')&&typeof _0x4a7456[_0x50e5('0x1f')]===_0x50e5('0x1e');var _0x4cca4f=_0x1fb080[_0x50e5('0x20')];var _0x2830a3=_0x40b9ad?0x0:_0x4a7456[_0x50e5('0x21')];var _0x261415=_0x40b9ad?_0x1fb080[_0x50e5('0x20')]:_0x4a7456[_0x50e5('0x21')]+_0x4a7456[_0x50e5('0x1f')];var _0xbb7dad;if(_0x261415>=_0x4cca4f){_0x261415=_0x4cca4f;_0xbb7dad=0xc8;}else{_0xbb7dad=0xce;}_0x18806c['status'](_0xbb7dad);return _0x18806c[_0x50e5('0x22')](_0x50e5('0x23'),_0x2830a3+'-'+_0x261415+'/'+_0x4cca4f)[_0x50e5('0x1d')](_0x1fb080);}return null;};}function saveUpdates(_0x160851){return function(_0x246940){if(_0x246940){return _0x246940[_0x50e5('0x24')](_0x160851)[_0x50e5('0x25')](function(_0x5cd819){return _0x5cd819;});}return null;};}function removeEntity(_0x2de827){return function(_0x35a2bf){if(_0x35a2bf){return _0x35a2bf[_0x50e5('0x26')]()[_0x50e5('0x25')](function(){var _0x55bb8d=_0x35a2bf[_0x50e5('0x27')]({'plain':!![]});var _0x42b02e=_0x50e5('0x28');return db['UserProfileResource'][_0x50e5('0x26')]({'where':{'type':_0x42b02e,'resourceId':_0x55bb8d['id']}})[_0x50e5('0x25')](function(){return _0x35a2bf;});})[_0x50e5('0x25')](function(){_0x2de827[_0x50e5('0x1b')](0xcc)[_0x50e5('0x1c')]();});}};}function handleEntityNotFound(_0x49391b){return function(_0x4c332f){if(!_0x4c332f){_0x49391b[_0x50e5('0x1a')](0x194);}return _0x4c332f;};}function handleError(_0x76db4,_0x4041d0){_0x4041d0=_0x4041d0||0x1f4;return function(_0x356732){logger[_0x50e5('0x15')](_0x356732['stack']);if(_0x356732['name']){delete _0x356732['name'];}_0x76db4[_0x50e5('0x1b')](_0x4041d0)['send'](_0x356732);};}exports[_0x50e5('0x29')]=function(_0x1c76d4,_0x30e11d){var _0x3240e6={'include':[{'model':db['MailServerIn'],'as':_0x50e5('0x2a')},{'model':db[_0x50e5('0x2b')],'as':_0x50e5('0x2c')},{'model':db[_0x50e5('0x2d')],'as':'mandatoryDispositionPause'}]},_0x4a4b96={},_0x1b7565={'count':0x0,'rows':[]};var _0x1020ee=_[_0x50e5('0x2e')](db['MailAccount'][_0x50e5('0x2f')],function(_0x566c4f){return{'name':_0x566c4f[_0x50e5('0x30')],'type':_0x566c4f[_0x50e5('0x31')][_0x50e5('0x32')]};});_0x4a4b96[_0x50e5('0x33')]=_[_0x50e5('0x2e')](_0x1020ee,_0x50e5('0x34'));_0x4a4b96[_0x50e5('0x35')]=_[_0x50e5('0x36')](_0x1c76d4[_0x50e5('0x35')]);_0x4a4b96[_0x50e5('0x37')]=_['intersection'](_0x4a4b96[_0x50e5('0x33')],_0x4a4b96[_0x50e5('0x35')]);_0x3240e6[_0x50e5('0x38')]=_[_0x50e5('0x39')](_0x4a4b96[_0x50e5('0x33')],qs[_0x50e5('0x3a')](_0x1c76d4['query']['fields']));_0x3240e6[_0x50e5('0x38')]=_0x3240e6['attributes'][_0x50e5('0x3b')]?_0x3240e6['attributes']:_0x4a4b96['model'];if(!_0x1c76d4[_0x50e5('0x35')]['hasOwnProperty'](_0x50e5('0x3c'))){_0x3240e6[_0x50e5('0x1f')]=qs[_0x50e5('0x1f')](_0x1c76d4[_0x50e5('0x35')][_0x50e5('0x1f')]);_0x3240e6[_0x50e5('0x21')]=qs['offset'](_0x1c76d4[_0x50e5('0x35')][_0x50e5('0x21')]);}_0x3240e6[_0x50e5('0x3d')]=qs[_0x50e5('0x3e')](_0x1c76d4['query'][_0x50e5('0x3e')]);_0x3240e6[_0x50e5('0x3f')]=qs[_0x50e5('0x37')](_[_0x50e5('0x40')](_0x1c76d4[_0x50e5('0x35')],_0x4a4b96[_0x50e5('0x37')]),_0x1020ee);if(_0x1c76d4[_0x50e5('0x35')]['filter']){_0x3240e6[_0x50e5('0x3f')]=_['merge'](_0x3240e6[_0x50e5('0x3f')],{'$or':_[_0x50e5('0x2e')](_0x1020ee,function(_0x3ea0aa){if(_0x3ea0aa['type']!=='VIRTUAL'){var _0x19e9e6={};_0x19e9e6[_0x3ea0aa[_0x50e5('0x34')]]={'$like':'%'+_0x1c76d4[_0x50e5('0x35')][_0x50e5('0x41')]+'%'};return _0x19e9e6;}})});}_0x3240e6=_['merge']({},_0x3240e6,_0x1c76d4[_0x50e5('0x42')]);var _0x3e1c11={'where':_0x3240e6['where']};return db[_0x50e5('0x43')]['count'](_0x3e1c11)['then'](function(_0x106fec){_0x1b7565[_0x50e5('0x20')]=_0x106fec;if(_0x1c76d4[_0x50e5('0x35')][_0x50e5('0x44')]){_0x3240e6['include']=[{'all':!![]}];}return db[_0x50e5('0x43')][_0x50e5('0x45')](_0x3240e6);})[_0x50e5('0x25')](function(_0x126bce){_0x1b7565[_0x50e5('0x46')]=_0x126bce;return _0x1b7565;})[_0x50e5('0x25')](respondWithFilteredResult(_0x30e11d,_0x3240e6))[_0x50e5('0x19')](handleError(_0x30e11d,null));};exports[_0x50e5('0x47')]=function(_0x29e96a,_0x475e27){var _0x2aad00={'raw':![],'where':{'id':_0x29e96a['params']['id']},'include':[{'model':db[_0x50e5('0x48')],'as':_0x50e5('0x2a')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0x50e5('0x49')}]},_0x3ea3fd={};_0x3ea3fd[_0x50e5('0x33')]=_[_0x50e5('0x36')](db[_0x50e5('0x43')][_0x50e5('0x2f')]);_0x3ea3fd[_0x50e5('0x35')]=_['keys'](_0x29e96a[_0x50e5('0x35')]);_0x3ea3fd[_0x50e5('0x37')]=_[_0x50e5('0x39')](_0x3ea3fd[_0x50e5('0x33')],_0x3ea3fd[_0x50e5('0x35')]);_0x2aad00[_0x50e5('0x38')]=_[_0x50e5('0x39')](_0x3ea3fd['model'],qs[_0x50e5('0x3a')](_0x29e96a[_0x50e5('0x35')][_0x50e5('0x3a')]));_0x2aad00[_0x50e5('0x38')]=_0x2aad00[_0x50e5('0x38')][_0x50e5('0x3b')]?_0x2aad00[_0x50e5('0x38')]:_0x3ea3fd[_0x50e5('0x33')];if(_0x29e96a[_0x50e5('0x35')][_0x50e5('0x44')]){_0x2aad00[_0x50e5('0x4a')]=[{'all':!![]}];}_0x2aad00=_[_0x50e5('0x4b')]({},_0x2aad00,_0x29e96a[_0x50e5('0x42')]);return db[_0x50e5('0x43')]['find'](_0x2aad00)['then'](handleEntityNotFound(_0x475e27,null))[_0x50e5('0x25')](respondWithResult(_0x475e27,null))['catch'](handleError(_0x475e27,null));};exports[_0x50e5('0x24')]=function(_0x58cb11,_0x3732ca){if(_0x58cb11[_0x50e5('0x4c')]['id']){delete _0x58cb11[_0x50e5('0x4c')]['id'];}if(_0x58cb11['body'][_0x50e5('0x2a')]){if(!_0x58cb11[_0x50e5('0x4c')]['Imap']['modernAuthentication']){_0x58cb11['body'][_0x50e5('0x2a')][_0x50e5('0x4d')]=null;}}if(_0x58cb11[_0x50e5('0x4c')][_0x50e5('0x2c')]){if(_0x58cb11[_0x50e5('0x4c')][_0x50e5('0x2c')][_0x50e5('0x4e')]){_0x58cb11[_0x50e5('0x4c')][_0x50e5('0x2c')][_0x50e5('0x4f')]=![];}else{_0x58cb11[_0x50e5('0x4c')][_0x50e5('0x2c')][_0x50e5('0x4d')]=null;}}return db['MailAccount'][_0x50e5('0x50')]({'where':{'id':_0x58cb11['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x50e5('0x2b')],'as':_0x50e5('0x2c')},{'model':db[_0x50e5('0x2d')],'as':'mandatoryDispositionPause'}]})[_0x50e5('0x25')](handleEntityNotFound(_0x3732ca,null))[_0x50e5('0x25')](saveUpdates(_0x58cb11[_0x50e5('0x4c')],null))[_0x50e5('0x25')](function(_0x2d50f7){if(_0x2d50f7&&_0x58cb11[_0x50e5('0x4c')][_0x50e5('0x2a')]){return db[_0x50e5('0x48')][_0x50e5('0x24')](_0x58cb11[_0x50e5('0x4c')][_0x50e5('0x2a')],{'where':{'MailAccountId':_0x2d50f7['id']}})[_0x50e5('0x25')](function(){return _0x2d50f7;});}return _0x2d50f7;})[_0x50e5('0x25')](function(_0x550b1d){if(_0x550b1d&&_0x58cb11[_0x50e5('0x4c')][_0x50e5('0x2c')]){return db[_0x50e5('0x2b')][_0x50e5('0x24')](_0x58cb11[_0x50e5('0x4c')][_0x50e5('0x2c')],{'where':{'MailAccountId':_0x550b1d['id']}})[_0x50e5('0x25')](function(){return _0x550b1d;});}return _0x550b1d;})['then'](respondWithResult(_0x3732ca,null))[_0x50e5('0x19')](handleError(_0x3732ca,null));};exports[_0x50e5('0x51')]=function(_0x548570,_0x53cdd0){return db['MailAccount']['describe']()[_0x50e5('0x25')](respondWithResult(_0x53cdd0,null))[_0x50e5('0x19')](handleError(_0x53cdd0,null));};exports['addDisposition']=function(_0x5bb6c5,_0x1e1aa2){if(_0x5bb6c5[_0x50e5('0x4c')]['id']){delete _0x5bb6c5[_0x50e5('0x4c')]['id'];}return db[_0x50e5('0x43')][_0x50e5('0x50')]({'where':{'id':_0x5bb6c5[_0x50e5('0x52')]['id']}})['then'](handleEntityNotFound(_0x1e1aa2,null))['then'](function(_0x23ef68){if(_0x23ef68){_0x5bb6c5[_0x50e5('0x4c')][_0x50e5('0x53')]=_0x23ef68['id'];return db[_0x50e5('0x54')][_0x50e5('0x55')](_0x5bb6c5[_0x50e5('0x4c')]);}})[_0x50e5('0x25')](respondWithResult(_0x1e1aa2,null))[_0x50e5('0x19')](handleError(_0x1e1aa2,null));};exports[_0x50e5('0x56')]=function(_0x2e08f2,_0x4b8bb5){var _0xc52df1={'raw':![],'where':{}};var _0xd27187={};var _0x52f38e={'count':0x0,'rows':[]};return db['MailAccount'][_0x50e5('0x57')]({'where':{'id':_0x2e08f2[_0x50e5('0x52')]['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x4b8bb5,null))[_0x50e5('0x25')](function(_0x14d79f){if(_0x14d79f){_0xd27187[_0x50e5('0x33')]=_['keys'](db[_0x50e5('0x54')][_0x50e5('0x2f')]);_0xd27187[_0x50e5('0x35')]=_[_0x50e5('0x36')](_0x2e08f2[_0x50e5('0x35')]);_0xd27187[_0x50e5('0x37')]=_[_0x50e5('0x39')](_0xd27187['model'],_0xd27187[_0x50e5('0x35')]);_0xc52df1[_0x50e5('0x38')]=_[_0x50e5('0x39')](_0xd27187[_0x50e5('0x33')],qs[_0x50e5('0x3a')](_0x2e08f2[_0x50e5('0x35')][_0x50e5('0x3a')]));_0xc52df1[_0x50e5('0x38')]=_0xc52df1['attributes'][_0x50e5('0x3b')]?_0xc52df1[_0x50e5('0x38')]:_0xd27187[_0x50e5('0x33')];if(!_0x2e08f2[_0x50e5('0x35')][_0x50e5('0x58')](_0x50e5('0x3c'))){_0xc52df1[_0x50e5('0x1f')]=qs[_0x50e5('0x1f')](_0x2e08f2[_0x50e5('0x35')][_0x50e5('0x1f')]);_0xc52df1['offset']=qs[_0x50e5('0x21')](_0x2e08f2['query'][_0x50e5('0x21')]);}_0xc52df1['order']=qs[_0x50e5('0x3e')](_0x2e08f2[_0x50e5('0x35')]['sort']);_0xc52df1['where']=qs[_0x50e5('0x37')](_[_0x50e5('0x40')](_0x2e08f2['query'],_0xd27187['filters']));_0xc52df1['where'][_0x50e5('0x53')]=_0x14d79f['id'];if(_0x2e08f2[_0x50e5('0x35')][_0x50e5('0x41')]){_0xc52df1[_0x50e5('0x3f')]=_[_0x50e5('0x4b')](_0xc52df1[_0x50e5('0x3f')],{'$or':_[_0x50e5('0x2e')](_0xc52df1[_0x50e5('0x38')],function(_0x131545){var _0x5c2e36={};_0x5c2e36[_0x131545]={'$like':'%'+_0x2e08f2[_0x50e5('0x35')][_0x50e5('0x41')]+'%'};return _0x5c2e36;})});}_0xc52df1=_[_0x50e5('0x4b')]({},_0xc52df1,_0x2e08f2[_0x50e5('0x42')]);return db[_0x50e5('0x54')][_0x50e5('0x20')]({'where':_0xc52df1[_0x50e5('0x3f')]})['then'](function(_0x38532c){_0x52f38e[_0x50e5('0x20')]=_0x38532c;if(_0x2e08f2[_0x50e5('0x35')][_0x50e5('0x44')]){_0xc52df1[_0x50e5('0x4a')]=[{'all':!![]}];}return db[_0x50e5('0x54')]['findAll'](_0xc52df1);})[_0x50e5('0x25')](function(_0xdc84a8){_0x52f38e[_0x50e5('0x46')]=_0xdc84a8;return _0x52f38e;});}})[_0x50e5('0x25')](respondWithFilteredResult(_0x4b8bb5,_0xc52df1))[_0x50e5('0x19')](handleError(_0x4b8bb5,null));};exports['removeDispositions']=function(_0x2587be,_0x487c6b){return db['MailAccount']['find']({'where':{'id':_0x2587be[_0x50e5('0x52')]['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x487c6b,null))[_0x50e5('0x25')](function(_0x3dca71){if(_0x3dca71){return _0x3dca71[_0x50e5('0x59')](_0x2587be['query'][_0x50e5('0x5a')]);}})[_0x50e5('0x25')](respondWithStatusCode(_0x487c6b,null))[_0x50e5('0x19')](handleError(_0x487c6b,null));};exports['addAnswer']=function(_0x22547f,_0x3e298f){if(_0x22547f[_0x50e5('0x4c')]['id']){delete _0x22547f[_0x50e5('0x4c')]['id'];}return db[_0x50e5('0x43')][_0x50e5('0x50')]({'where':{'id':_0x22547f[_0x50e5('0x52')]['id']}})['then'](handleEntityNotFound(_0x3e298f,null))[_0x50e5('0x25')](function(_0x1994b3){if(_0x1994b3){_0x22547f['body'][_0x50e5('0x53')]=_0x1994b3['id'];return db['CannedAnswer'][_0x50e5('0x55')](_0x22547f['body']);}})[_0x50e5('0x25')](respondWithResult(_0x3e298f,null))[_0x50e5('0x19')](handleError(_0x3e298f,null));};exports[_0x50e5('0x5b')]=function(_0x50f25a,_0x3a63c8){var _0x2edaa6={'raw':![],'where':{}};var _0x122036={};var _0x10b726={'count':0x0,'rows':[]};return db['MailAccount'][_0x50e5('0x57')]({'where':{'id':_0x50f25a['params']['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x3a63c8,null))[_0x50e5('0x25')](function(_0x315de6){if(_0x315de6){_0x122036[_0x50e5('0x33')]=_[_0x50e5('0x36')](db[_0x50e5('0x5c')][_0x50e5('0x2f')]);_0x122036['query']=_[_0x50e5('0x36')](_0x50f25a[_0x50e5('0x35')]);_0x122036[_0x50e5('0x37')]=_[_0x50e5('0x39')](_0x122036['model'],_0x122036[_0x50e5('0x35')]);_0x2edaa6[_0x50e5('0x38')]=_['intersection'](_0x122036[_0x50e5('0x33')],qs['fields'](_0x50f25a[_0x50e5('0x35')]['fields']));_0x2edaa6['attributes']=_0x2edaa6[_0x50e5('0x38')][_0x50e5('0x3b')]?_0x2edaa6[_0x50e5('0x38')]:_0x122036[_0x50e5('0x33')];if(!_0x50f25a[_0x50e5('0x35')][_0x50e5('0x58')](_0x50e5('0x3c'))){_0x2edaa6['limit']=qs[_0x50e5('0x1f')](_0x50f25a[_0x50e5('0x35')]['limit']);_0x2edaa6['offset']=qs[_0x50e5('0x21')](_0x50f25a[_0x50e5('0x35')]['offset']);}_0x2edaa6['order']=qs[_0x50e5('0x3e')](_0x50f25a[_0x50e5('0x35')][_0x50e5('0x3e')]);_0x2edaa6['where']=qs[_0x50e5('0x37')](_[_0x50e5('0x40')](_0x50f25a[_0x50e5('0x35')],_0x122036[_0x50e5('0x37')]));_0x2edaa6[_0x50e5('0x3f')]['MailAccountId']=_0x315de6['id'];if(_0x50f25a[_0x50e5('0x35')][_0x50e5('0x41')]){_0x2edaa6[_0x50e5('0x3f')]=_[_0x50e5('0x4b')](_0x2edaa6[_0x50e5('0x3f')],{'$or':_[_0x50e5('0x2e')](_0x2edaa6[_0x50e5('0x38')],function(_0x29c3ab){var _0x225bbc={};_0x225bbc[_0x29c3ab]={'$like':'%'+_0x50f25a[_0x50e5('0x35')][_0x50e5('0x41')]+'%'};return _0x225bbc;})});}_0x2edaa6=_['merge']({},_0x2edaa6,_0x50f25a['options']);return db[_0x50e5('0x5c')][_0x50e5('0x20')]({'where':_0x2edaa6[_0x50e5('0x3f')]})[_0x50e5('0x25')](function(_0x861221){_0x10b726[_0x50e5('0x20')]=_0x861221;if(_0x50f25a[_0x50e5('0x35')][_0x50e5('0x44')]){_0x2edaa6[_0x50e5('0x4a')]=[{'all':!![]}];}return db[_0x50e5('0x5c')]['findAll'](_0x2edaa6);})[_0x50e5('0x25')](function(_0x2d5962){_0x10b726[_0x50e5('0x46')]=_0x2d5962;return _0x10b726;});}})[_0x50e5('0x25')](respondWithFilteredResult(_0x3a63c8,_0x2edaa6))[_0x50e5('0x19')](handleError(_0x3a63c8,null));};exports['removeAnswers']=function(_0x373461,_0x5d1fa9){return db[_0x50e5('0x43')][_0x50e5('0x50')]({'where':{'id':_0x373461[_0x50e5('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d1fa9,null))[_0x50e5('0x25')](function(_0x1f4646){if(_0x1f4646){return _0x1f4646[_0x50e5('0x5d')](_0x373461[_0x50e5('0x35')]['ids']);}})[_0x50e5('0x25')](respondWithStatusCode(_0x5d1fa9,null))[_0x50e5('0x19')](handleError(_0x5d1fa9,null));};exports[_0x50e5('0x55')]=function(_0xc9bbf9,_0x31a34f){var _0x5e5beb={'name':_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x34')],'key':_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x32')],'provider':_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x5e')]===_0x50e5('0x5f')?null:_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x5e')],'email':_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x60')],'ListId':_0xc9bbf9['body'][_0x50e5('0x61')],'active':!_[_0x50e5('0x62')](_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x63')])?_0xc9bbf9['body'][_0x50e5('0x63')]:!![],'description':_0xc9bbf9['body'][_0x50e5('0x64')]||null,'Imap':{},'Smtp':{}};if(_0x5e5beb[_0x50e5('0x5e')]){_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x65')]=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x65')]=_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x66')];_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x67')]=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x68')]=_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x67')];if(_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x4e')]){_0x5e5beb['Imap']['modernAuthentication']=_0x5e5beb['Smtp'][_0x50e5('0x4e')]=!![];_0x5e5beb['Imap'][_0x50e5('0x4d')]=_0x5e5beb['Smtp']['CloudProviderId']=_0xc9bbf9[_0x50e5('0x4c')]['CloudProviderId'];_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x67')]=_0x5e5beb['Smtp']['pass']=null;_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x4f')]=![];}else{_0x5e5beb[_0x50e5('0x2a')]['CloudProviderId']=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x4d')]=null;}_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x69')]=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x69')]=null;_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x6a')]=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x6a')]=null;_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x6b')]=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x6b')]=null;}else{if(_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x6c')]){_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x65')]=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x65')]=_0xc9bbf9[_0x50e5('0x4c')]['username'];_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x67')]=_0x5e5beb[_0x50e5('0x2c')]['pass']=_0xc9bbf9[_0x50e5('0x4c')]['password'];}else{_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x6c')]=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x6c')]=![];_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x65')]=_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x65')]=null;_0x5e5beb['Imap'][_0x50e5('0x67')]=_0x5e5beb['Smtp'][_0x50e5('0x68')]=null;}_0x5e5beb['Imap'][_0x50e5('0x6a')]=_0xc9bbf9[_0x50e5('0x4c')]['Imap'][_0x50e5('0x6a')];_0x5e5beb[_0x50e5('0x2a')][_0x50e5('0x6b')]=_0xc9bbf9['body'][_0x50e5('0x2a')]['port'];_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x6a')]=_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x2c')][_0x50e5('0x6a')];_0x5e5beb[_0x50e5('0x2c')][_0x50e5('0x6b')]=_0xc9bbf9[_0x50e5('0x4c')][_0x50e5('0x2c')][_0x50e5('0x6b')];}return db['MailAccount']['create'](_0x5e5beb,{'include':[{'model':db[_0x50e5('0x2b')],'as':_0x50e5('0x2c')},{'model':db[_0x50e5('0x48')],'as':_0x50e5('0x2a')}]})[_0x50e5('0x25')](function(_0x34a98f){var _0x32596d=_0xc9bbf9['user'][_0x50e5('0x27')]({'plain':!![]});if(!_0x32596d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32596d[_0x50e5('0x6d')]===_0x50e5('0x65')){var _0x5b0004=_0x34a98f[_0x50e5('0x27')]({'plain':!![]});return db[_0x50e5('0x6e')][_0x50e5('0x50')]({'where':{'name':'MailAccounts','userProfileId':_0x32596d['userProfileId']},'raw':!![]})['then'](function(_0xfc3836){if(_0xfc3836&&_0xfc3836[_0x50e5('0x6f')]===0x0){return db[_0x50e5('0x70')][_0x50e5('0x55')]({'name':_0x5b0004[_0x50e5('0x34')],'resourceId':_0x5b0004['id'],'type':_0xfc3836[_0x50e5('0x34')],'sectionId':_0xfc3836['id']},{})['then'](function(){return _0x34a98f;});}else{return _0x34a98f;}})[_0x50e5('0x19')](function(_0x54b987){logger[_0x50e5('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54b987);throw _0x54b987;});}return _0x34a98f;})['then'](respondWithResult(_0x31a34f,0xc9))[_0x50e5('0x19')](handleError(_0x31a34f,null));};exports[_0x50e5('0x71')]=function(_0x332c6e,_0xded3ac){return db[_0x50e5('0x43')][_0x50e5('0x57')]({'where':{'id':_0x332c6e['params']['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0xded3ac,null))['then'](function(_0x1b107c){if(_0x1b107c){return _0x1b107c[_0x50e5('0x71')]();}return null;})[_0x50e5('0x25')](respondWithResult(_0xded3ac,null))['catch'](handleError(_0xded3ac,null));};exports[_0x50e5('0x72')]=function(_0x5aa45a,_0x3c15c9){if(_0x5aa45a[_0x50e5('0x4c')]['id']){delete _0x5aa45a[_0x50e5('0x4c')]['id'];}return db[_0x50e5('0x43')][_0x50e5('0x50')]({'where':{'id':_0x5aa45a[_0x50e5('0x52')]['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x3c15c9,null))[_0x50e5('0x25')](function(_0x325a3b){if(_0x325a3b){_0x5aa45a[_0x50e5('0x4c')]['MailAccountId']=_0x325a3b['id'];return db['MailServerIn']['create'](_0x5aa45a['body']);}})[_0x50e5('0x25')](respondWithResult(_0x3c15c9,null))[_0x50e5('0x19')](handleError(_0x3c15c9,null));};exports[_0x50e5('0x73')]=function(_0x4f502a,_0x1b7868){return db[_0x50e5('0x43')][_0x50e5('0x57')]({'where':{'id':_0x4f502a['params']['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x1b7868,null))[_0x50e5('0x25')](function(_0x47083b){if(_0x47083b){return _0x47083b[_0x50e5('0x74')](null);}return null;})[_0x50e5('0x25')](respondWithStatusCode(_0x1b7868,null))[_0x50e5('0x19')](handleError(_0x1b7868,null));};exports['getSmtp']=function(_0x593aa8,_0x55ec0b){return db[_0x50e5('0x43')][_0x50e5('0x57')]({'where':{'id':_0x593aa8[_0x50e5('0x52')]['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x55ec0b,null))[_0x50e5('0x25')](function(_0x415d56){if(_0x415d56){return _0x415d56[_0x50e5('0x75')]();}return null;})[_0x50e5('0x25')](respondWithResult(_0x55ec0b,null))[_0x50e5('0x19')](handleError(_0x55ec0b,null));};exports[_0x50e5('0x76')]=function(_0x34630c,_0xa43b69){if(_0x34630c['body']['id']){delete _0x34630c['body']['id'];}return db[_0x50e5('0x43')]['find']({'where':{'id':_0x34630c['params']['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0xa43b69,null))[_0x50e5('0x25')](function(_0x2586cb){if(_0x2586cb){_0x34630c['body'][_0x50e5('0x53')]=_0x2586cb['id'];return db[_0x50e5('0x2b')][_0x50e5('0x55')](_0x34630c[_0x50e5('0x4c')]);}})[_0x50e5('0x25')](respondWithResult(_0xa43b69,null))['catch'](handleError(_0xa43b69,null));};exports[_0x50e5('0x77')]=function(_0xea38e8,_0x2591a8){return db[_0x50e5('0x43')][_0x50e5('0x57')]({'where':{'id':_0xea38e8[_0x50e5('0x52')]['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x2591a8,null))['then'](function(_0x1c0b4e){if(_0x1c0b4e){return _0x1c0b4e[_0x50e5('0x78')](null);}return null;})['then'](respondWithStatusCode(_0x2591a8,null))[_0x50e5('0x19')](handleError(_0x2591a8,null));};exports[_0x50e5('0x79')]=function(_0x26882a,_0x5dbbe8){return db[_0x50e5('0x7a')][_0x50e5('0x50')]({'where':{'id':_0x26882a[_0x50e5('0x52')]['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x5dbbe8,null))['then'](function(_0xd91099){if(_0xd91099){return _0xd91099[_0x50e5('0x79')](_0x26882a['body'][_0x50e5('0x5a')],_[_0x50e5('0x7b')](_0x26882a[_0x50e5('0x4c')],[_0x50e5('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x5dbbe8,null))[_0x50e5('0x19')](handleError(_0x5dbbe8,null));};exports['getInteractions']=function(_0x51a8bc,_0x3034a0){var _0x57f2a4={'raw':![],'where':{}};var _0x289863={};var _0x3cf76f={'count':0x0,'rows':[]};return db[_0x50e5('0x43')][_0x50e5('0x57')]({'where':{'id':_0x51a8bc['params']['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x3034a0,null))[_0x50e5('0x25')](function(_0x48b3f3){if(_0x48b3f3){_0x289863['model']=_[_0x50e5('0x36')](db[_0x50e5('0x7a')][_0x50e5('0x2f')]);_0x289863[_0x50e5('0x35')]=_[_0x50e5('0x36')](_0x51a8bc[_0x50e5('0x35')]);_0x289863[_0x50e5('0x37')]=_[_0x50e5('0x39')](_0x289863[_0x50e5('0x33')],_0x289863[_0x50e5('0x35')]);_0x57f2a4[_0x50e5('0x38')]=_[_0x50e5('0x39')](_0x289863[_0x50e5('0x33')],qs['fields'](_0x51a8bc[_0x50e5('0x35')][_0x50e5('0x3a')]));_0x57f2a4[_0x50e5('0x38')]=_0x57f2a4[_0x50e5('0x38')][_0x50e5('0x3b')]?_0x57f2a4[_0x50e5('0x38')]:_0x289863[_0x50e5('0x33')];if(!_0x51a8bc['query'][_0x50e5('0x58')](_0x50e5('0x3c'))){_0x57f2a4[_0x50e5('0x1f')]=qs[_0x50e5('0x1f')](_0x51a8bc['query'][_0x50e5('0x1f')]);_0x57f2a4[_0x50e5('0x21')]=qs[_0x50e5('0x21')](_0x51a8bc[_0x50e5('0x35')][_0x50e5('0x21')]);}_0x57f2a4[_0x50e5('0x3d')]=qs[_0x50e5('0x3e')](_0x51a8bc['query'][_0x50e5('0x3e')]);_0x57f2a4[_0x50e5('0x3f')]=qs[_0x50e5('0x37')](_['pick'](_0x51a8bc[_0x50e5('0x35')],_0x289863['filters']));_0x57f2a4[_0x50e5('0x3f')][_0x50e5('0x53')]=_0x48b3f3['id'];if(_0x51a8bc[_0x50e5('0x35')][_0x50e5('0x41')]){_0x57f2a4[_0x50e5('0x3f')]=_[_0x50e5('0x4b')](_0x57f2a4[_0x50e5('0x3f')],{'$or':_[_0x50e5('0x2e')](_0x57f2a4[_0x50e5('0x38')],function(_0x4ea621){var _0x369d20={};_0x369d20[_0x4ea621]={'$like':'%'+_0x51a8bc['query'][_0x50e5('0x41')]+'%'};return _0x369d20;})});}_0x57f2a4=_[_0x50e5('0x4b')]({},_0x57f2a4,_0x51a8bc[_0x50e5('0x42')]);return db[_0x50e5('0x7a')]['count']({'where':_0x57f2a4['where']})['then'](function(_0x122ee2){_0x3cf76f[_0x50e5('0x20')]=_0x122ee2;if(_0x51a8bc['query'][_0x50e5('0x44')]){_0x57f2a4[_0x50e5('0x4a')]=[{'model':db['CmContact'],'as':_0x50e5('0x7c'),'required':![]},{'model':db['User'],'as':_0x50e5('0x7d'),'attributes':[_0x50e5('0x34'),_0x50e5('0x7e'),'internal'],'required':![]},{'model':db[_0x50e5('0x7f')],'as':_0x50e5('0x80'),'attributes':['id',_0x50e5('0x34'),_0x50e5('0x81')],'where':_0x51a8bc[_0x50e5('0x35')]['tag']?{'id':_0x51a8bc[_0x50e5('0x35')][_0x50e5('0x82')]}:undefined,'required':_0x51a8bc[_0x50e5('0x35')][_0x50e5('0x82')]?!![]:![]}];}return db[_0x50e5('0x7a')][_0x50e5('0x45')](_0x57f2a4);})[_0x50e5('0x25')](function(_0x1aa16d){_0x3cf76f[_0x50e5('0x46')]=_0x1aa16d;return _0x3cf76f;});}})[_0x50e5('0x25')](respondWithFilteredResult(_0x3034a0,_0x57f2a4))[_0x50e5('0x19')](handleError(_0x3034a0,null));};exports[_0x50e5('0x83')]=function addApplications(_0x3d4bfc,_0x57207e){var _0x5c6b09=_0x3d4bfc[_0x50e5('0x52')]['id'];var _0x4a660a=_0x3d4bfc[_0x50e5('0x4c')];var _0x5115d6=0xc8;var _0x5b0669=null;return db[_0x50e5('0x84')][_0x50e5('0x85')]({'isolationLevel':db['sequelize'][_0x50e5('0x86')][_0x50e5('0x87')][_0x50e5('0x88')]},function(_0x462a11){return db['MailAccount'][_0x50e5('0x57')]({'where':{'id':_0x5c6b09},'transaction':_0x462a11})[_0x50e5('0x25')](function(_0x37ae1c){if(_0x37ae1c){return db[_0x50e5('0x89')][_0x50e5('0x26')]({'where':{'MailAccountId':_0x5c6b09},'transaction':_0x462a11})['then'](function(){var _0xb974ae=_[_0x50e5('0x2e')](_0x4a660a,function(_0x2ae0b7){_0x2ae0b7['MailAccountId']=_0x5c6b09;return _0x2ae0b7;});return db[_0x50e5('0x89')][_0x50e5('0x8a')](_0xb974ae,{'transaction':_0x462a11});});}else{_0x5115d6=0x194;_0x5b0669=[];}});})['then'](function(){if(_0x5115d6!==0x194){return db[_0x50e5('0x89')]['findAndCountAll']({'where':{'MailAccountId':_0x5c6b09},'order':_0x50e5('0x8b')})[_0x50e5('0x25')](function(_0x215b65){_0x5b0669=_0x215b65;});}})['catch'](function(_0x337585){_0x5115d6=0x1f4;logger[_0x50e5('0x15')](_0x337585[_0x50e5('0x8c')]);if(_0x337585[_0x50e5('0x34')]){delete _0x337585[_0x50e5('0x34')];}_0x5b0669=_0x337585;})[_0x50e5('0x8d')](function(){if(_0x5b0669===null){_0x57207e['sendStatus'](_0x5115d6);}else{if(_0x5115d6===0x1f4){_0x57207e[_0x50e5('0x1b')](_0x5115d6)[_0x50e5('0x8e')](_0x5b0669);}else{_0x57207e[_0x50e5('0x1b')](_0x5115d6)[_0x50e5('0x1d')](_0x5b0669);}}});};exports['getApplications']=function(_0x51a8d3,_0x3869ce){var _0x284e73={};var _0x42fb5d={};var _0x28870c;var _0x49895d;return db[_0x50e5('0x43')][_0x50e5('0x57')]({'where':{'id':_0x51a8d3[_0x50e5('0x52')]['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x3869ce,null))[_0x50e5('0x25')](function(_0x381199){if(_0x381199){_0x28870c=_0x381199;_0x42fb5d[_0x50e5('0x33')]=_['keys'](db[_0x50e5('0x89')]['rawAttributes']);_0x42fb5d[_0x50e5('0x35')]=_[_0x50e5('0x36')](_0x51a8d3[_0x50e5('0x35')]);_0x42fb5d[_0x50e5('0x37')]=_[_0x50e5('0x39')](_0x42fb5d[_0x50e5('0x33')],_0x42fb5d[_0x50e5('0x35')]);_0x284e73[_0x50e5('0x38')]=_['intersection'](_0x42fb5d[_0x50e5('0x33')],qs[_0x50e5('0x3a')](_0x51a8d3[_0x50e5('0x35')][_0x50e5('0x3a')]));_0x284e73[_0x50e5('0x38')]=_0x284e73[_0x50e5('0x38')][_0x50e5('0x3b')]?_0x284e73[_0x50e5('0x38')]:_0x42fb5d[_0x50e5('0x33')];_0x284e73[_0x50e5('0x3d')]=qs['sort'](_0x51a8d3[_0x50e5('0x35')][_0x50e5('0x3e')]);_0x284e73[_0x50e5('0x3f')]=qs[_0x50e5('0x37')](_[_0x50e5('0x40')](_0x51a8d3['query'],_0x42fb5d[_0x50e5('0x37')]));if(_0x51a8d3[_0x50e5('0x35')][_0x50e5('0x41')]){_0x284e73['where']=_[_0x50e5('0x4b')](_0x284e73[_0x50e5('0x3f')],{'$or':_[_0x50e5('0x2e')](_0x284e73[_0x50e5('0x38')],function(_0x2ecfab){var _0x1343d8={};_0x1343d8[_0x2ecfab]={'$like':'%'+_0x51a8d3['query'][_0x50e5('0x41')]+'%'};return _0x1343d8;})});}_0x284e73=_[_0x50e5('0x4b')]({},_0x284e73,_0x51a8d3[_0x50e5('0x42')]);return _0x28870c[_0x50e5('0x8f')](_0x284e73);}})[_0x50e5('0x25')](function(_0x162b69){if(_0x162b69){_0x49895d=_0x162b69[_0x50e5('0x3b')];if(!_0x51a8d3['query']['hasOwnProperty'](_0x50e5('0x3c'))){_0x284e73[_0x50e5('0x1f')]=qs[_0x50e5('0x1f')](_0x51a8d3['query'][_0x50e5('0x1f')]);_0x284e73[_0x50e5('0x21')]=qs['offset'](_0x51a8d3['query']['offset']);}return _0x28870c[_0x50e5('0x8f')](_0x284e73);}})[_0x50e5('0x25')](function(_0x5f386b){if(_0x5f386b){return _0x5f386b?{'count':_0x49895d,'rows':_0x5f386b}:null;}})[_0x50e5('0x25')](respondWithResult(_0x3869ce,null))['catch'](handleError(_0x3869ce,null));};exports['getMessages']=function(_0x46a979,_0x1e8227){var _0x52ec15={'raw':!![],'where':{}};var _0x238cb4={};var _0x30344e={'count':0x0,'rows':[]};return db[_0x50e5('0x43')][_0x50e5('0x57')]({'where':{'id':_0x46a979['params']['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x1e8227,null))['then'](function(_0x3927c0){if(_0x3927c0){_0x238cb4[_0x50e5('0x33')]=_['keys'](db[_0x50e5('0x90')][_0x50e5('0x2f')]);_0x238cb4['query']=_[_0x50e5('0x36')](_0x46a979[_0x50e5('0x35')]);_0x238cb4[_0x50e5('0x37')]=_['intersection'](_0x238cb4[_0x50e5('0x33')],_0x238cb4['query']);_0x52ec15[_0x50e5('0x38')]=_[_0x50e5('0x39')](_0x238cb4['model'],qs[_0x50e5('0x3a')](_0x46a979[_0x50e5('0x35')][_0x50e5('0x3a')]));_0x52ec15[_0x50e5('0x38')]=_0x52ec15[_0x50e5('0x38')][_0x50e5('0x3b')]?_0x52ec15['attributes']:_0x238cb4['model'];if(!_0x46a979[_0x50e5('0x35')][_0x50e5('0x58')](_0x50e5('0x3c'))){_0x52ec15[_0x50e5('0x1f')]=qs['limit'](_0x46a979[_0x50e5('0x35')][_0x50e5('0x1f')]);_0x52ec15['offset']=qs[_0x50e5('0x21')](_0x46a979[_0x50e5('0x35')]['offset']);}_0x52ec15[_0x50e5('0x3d')]=qs[_0x50e5('0x3e')](_0x46a979[_0x50e5('0x35')][_0x50e5('0x3e')]);_0x52ec15[_0x50e5('0x3f')]=qs[_0x50e5('0x37')](_[_0x50e5('0x40')](_0x46a979['query'],_0x238cb4['filters']));_0x52ec15[_0x50e5('0x3f')]['MailAccountId']=_0x3927c0['id'];if(_0x46a979[_0x50e5('0x35')][_0x50e5('0x41')]){_0x52ec15[_0x50e5('0x3f')]=_[_0x50e5('0x4b')](_0x52ec15[_0x50e5('0x3f')],{'$or':_[_0x50e5('0x2e')](_0x52ec15[_0x50e5('0x38')],function(_0x5ed8c9){var _0x119de0={};_0x119de0[_0x5ed8c9]={'$like':'%'+_0x46a979[_0x50e5('0x35')][_0x50e5('0x41')]+'%'};return _0x119de0;})});}if(_0x46a979[_0x50e5('0x35')]['$gte']){var _0x3534d7=_0x46a979[_0x50e5('0x35')]['$gte'][_0x50e5('0x91')](',');var _0x527aa7={};_0x527aa7[_0x3534d7[0x0]]={'$gte':moment(_0x3534d7[0x1])[_0x50e5('0x92')](_0x50e5('0x93'))};_0x52ec15[_0x50e5('0x3f')]=_[_0x50e5('0x4b')](_0x52ec15['where'],_0x527aa7);}_0x52ec15=_[_0x50e5('0x4b')]({},_0x52ec15,_0x46a979[_0x50e5('0x42')]);return db[_0x50e5('0x90')][_0x50e5('0x20')]({'where':_0x52ec15[_0x50e5('0x3f')]})['then'](function(_0x182e9b){_0x30344e[_0x50e5('0x20')]=_0x182e9b;if(_0x46a979[_0x50e5('0x35')]['includeAll']){_0x52ec15[_0x50e5('0x4a')]=[{'all':!![]}];}return db[_0x50e5('0x90')]['findAll'](_0x52ec15);})[_0x50e5('0x25')](function(_0xd97fb0){if(_0x46a979[_0x50e5('0x35')][_0x50e5('0x94')]==='true'){for(var _0x20880c=0x0;_0x20880c<_0xd97fb0[_0x50e5('0x3b')];_0x20880c++){_0xd97fb0[_0x20880c][_0x50e5('0x4c')]=juice(_0xd97fb0[_0x20880c][_0x50e5('0x4c')]);}}_0x30344e[_0x50e5('0x46')]=_0xd97fb0;return _0x30344e;});}})[_0x50e5('0x25')](respondWithFilteredResult(_0x1e8227,_0x52ec15))[_0x50e5('0x19')](handleError(_0x1e8227,null));};exports[_0x50e5('0x8e')]=function(_0x4fa5d4,_0x333fcf){var _0x550f48,_0x6201d3={},_0x1bdb2b;if(_0x4fa5d4[_0x50e5('0x4c')]['to']){_0x1bdb2b=_0x4fa5d4[_0x50e5('0x4c')]['to']['split'](',')[0x0];}return db[_0x50e5('0x43')][_0x50e5('0x50')]({'where':{'id':_0x4fa5d4[_0x50e5('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x50e5('0x95'),'include':[{'model':db['CmContact'],'as':_0x50e5('0x96'),'where':{'email':_0x1bdb2b},'limit':0x1,'order':[[_0x50e5('0x97'),'DESC']]}]},{'model':db[_0x50e5('0x2b')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x50e5('0x98')],'as':_0x50e5('0x98'),'raw':!![]}]}]})[_0x50e5('0x25')](handleEntityNotFound(_0x333fcf,null))[_0x50e5('0x25')](function(_0x4a5b9f){if(!_0x4a5b9f)return;_0x550f48=_0x4a5b9f;if(!_0x4a5b9f[_0x50e5('0x2c')])throw new Error(_0x50e5('0x99'));if(_[_0x50e5('0x62')](_0x4fa5d4[_0x50e5('0x4c')][_0x50e5('0x9a')])){_0x4fa5d4['body']['from']=util[_0x50e5('0x92')](_0x50e5('0x9b'),_0x4a5b9f[_0x50e5('0x34')],_0x4a5b9f['email']||_0x4a5b9f[_0x50e5('0x2c')][_0x50e5('0x65')]);}if(_0x4fa5d4[_0x50e5('0x4c')][_0x50e5('0x9c')]&&_0x4fa5d4[_0x50e5('0x4c')]['attachments'][_0x50e5('0x3b')]){for(var _0x4d5a98=0x0;_0x4d5a98<_0x4fa5d4[_0x50e5('0x4c')][_0x50e5('0x9c')][_0x50e5('0x3b')];_0x4d5a98+=0x1){_0x4fa5d4[_0x50e5('0x4c')]['attachments'][_0x4d5a98]={'filename':_0x4fa5d4[_0x50e5('0x4c')][_0x50e5('0x9c')][_0x4d5a98][_0x50e5('0x34')],'path':path[_0x50e5('0x9d')](config[_0x50e5('0x9e')],_0x50e5('0x9f'),_0x4fa5d4['body'][_0x50e5('0x9c')][_0x4d5a98]['basename'])};}}var _0x2b9e52=_0x4a5b9f['getSmtpOptions']();return respondWithRpcPromise(_0x50e5('0xa0'),_0x50e5('0xa1'),{'account':_0x2b9e52,'message':_0x4fa5d4['body']});})[_0x50e5('0x25')](function(_0x39c65c){if(!_0x39c65c)return;_0x6201d3=_0x39c65c;if(!_0x550f48[_0x50e5('0x95')])throw new Error(_0x50e5('0xa2'));if(_0x550f48[_0x50e5('0x95')][_0x50e5('0x96')]['length'])return _0x550f48[_0x50e5('0x95')]['Contacts'][0x0];return db['CmContact'][_0x50e5('0x55')](_['defaults'](_0x4fa5d4[_0x50e5('0x4c')],{'firstName':_0x4fa5d4[_0x50e5('0x4c')]['to'],'email':_0x4fa5d4['body']['to'],'phone':_0x4fa5d4['body']['to'],'ListId':_0x550f48['ListId']}));})[_0x50e5('0x25')](function(_0xe1caf9){if(!_0xe1caf9)return;var _0x10165c={'UserId':_0x4fa5d4[_0x50e5('0x65')]['id'],'ContactId':_0xe1caf9['id'],'MailAccountId':_0x550f48['id'],'inReplyTo':_0x6201d3[_0x50e5('0xa3')],'to':_0x4fa5d4[_0x50e5('0x4c')][_0x50e5('0x9a')],'cc':_0x4fa5d4['body']['cc'],'subject':_0x4fa5d4[_0x50e5('0x4c')][_0x50e5('0xa4')],'attach':_0x4fa5d4[_0x50e5('0x4c')][_0x50e5('0xa5')],'firstMsgDirection':_0x50e5('0xa6'),'lastMsgAt':moment()[_0x50e5('0x92')](_0x50e5('0x93')),'lastMsgDirection':_0x50e5('0xa6'),'Messages':[_[_0x50e5('0x4b')](_0x4fa5d4[_0x50e5('0x4c')],{'messageId':_0x6201d3[_0x50e5('0xa3')],'sentAt':moment()[_0x50e5('0x92')](_0x50e5('0x93')),'read':!![],'MailAccountId':_0x550f48['id'],'UserId':_0x4fa5d4[_0x50e5('0x65')]['id'],'ContactId':_0xe1caf9['id']})]};if(_0x4fa5d4[_0x50e5('0x4c')][_0x50e5('0xa7')]){_0x10165c=_[_0x50e5('0x4b')](_0x10165c,_0x4fa5d4['body'][_0x50e5('0xa7')]);}return db[_0x50e5('0x7a')][_0x50e5('0x55')](_0x10165c,{'include':[{'model':db[_0x50e5('0x90')],'as':_0x50e5('0xa8')}]});})[_0x50e5('0x25')](respondWithResult(_0x333fcf,null))[_0x50e5('0x19')](handleError(_0x333fcf,null));};exports[_0x50e5('0xa9')]=function(_0x3c89f0,_0x1cfe02){return db['MailAccount']['find']({'where':{'id':_0x3c89f0[_0x50e5('0x52')]['id']},'include':[{'model':db[_0x50e5('0x2b')],'as':_0x50e5('0x2c'),'raw':!![],'include':[{'model':db[_0x50e5('0x98')],'as':'CloudProvider','raw':!![]}]}]})[_0x50e5('0x25')](handleEntityNotFound(_0x1cfe02,null))[_0x50e5('0x25')](function(_0x278e84){if(!_0x278e84[_0x50e5('0x2c')])return;var _0x45baaa=_0x278e84['getSmtpOptions']();return respondWithRpcPromise(_0x50e5('0xaa'),_0x50e5('0xa9'),{'account':_0x45baaa});})[_0x50e5('0x25')](respondWithResult(_0x1cfe02,null))[_0x50e5('0x19')](handleError(_0x1cfe02,null));};exports[_0x50e5('0x26')]=function(_0x3ed364,_0xeb1d92){return db[_0x50e5('0x43')][_0x50e5('0x50')]({'where':{'id':_0x3ed364[_0x50e5('0x52')]['id']}})['then'](handleEntityNotFound(_0xeb1d92,null))['then'](function(_0x3257e7){if(_0x3257e7&&_0x3257e7[_0x50e5('0x69')]){throw new db[(_0x50e5('0xab'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3257e7;})[_0x50e5('0x25')](removeEntity(_0xeb1d92,null))[_0x50e5('0x19')](handleError(_0xeb1d92,null));};exports['addAgents']=function(_0x500a40,_0x439b64){return db[_0x50e5('0x43')][_0x50e5('0x50')]({'where':{'id':_0x500a40['params']['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x439b64,null))['then'](function(_0x5cdb73){if(_0x5cdb73){return _0x5cdb73[_0x50e5('0xac')](_0x500a40[_0x50e5('0x4c')]['ids'],_['omit'](_0x500a40['body'],['ids','id'])||{})[_0x50e5('0xad')](function(_0x32de26){for(var _0x25911e=0x0;_0x25911e<_0x500a40['body'][_0x50e5('0x5a')][_0x50e5('0x3b')];_0x25911e+=0x1){socket[_0x50e5('0xae')](_0x50e5('0xaf'),{'UserId':Number(_0x500a40[_0x50e5('0x4c')][_0x50e5('0x5a')][_0x25911e]),'MailAccountId':Number(_0x500a40['params']['id'])});}return _0x32de26;});}})[_0x50e5('0x25')](respondWithResult(_0x439b64,null))[_0x50e5('0x19')](handleError(_0x439b64,null));};exports[_0x50e5('0xb0')]=function(_0x2ce77d,_0x321493){return db['MailAccount'][_0x50e5('0x50')]({'where':{'id':_0x2ce77d[_0x50e5('0x52')]['id']}})['then'](handleEntityNotFound(_0x321493,null))[_0x50e5('0x25')](function(_0x256239){if(_0x256239){return _0x256239['removeAgents'](_0x2ce77d[_0x50e5('0x35')][_0x50e5('0x5a')])[_0x50e5('0x25')](function(){if(_['isArray'](_0x2ce77d[_0x50e5('0x35')][_0x50e5('0x5a')])){for(var _0x343b76=0x0;_0x343b76<_0x2ce77d[_0x50e5('0x35')][_0x50e5('0x5a')]['length'];_0x343b76+=0x1){socket[_0x50e5('0xae')](_0x50e5('0xb1'),{'UserId':Number(_0x2ce77d['query'][_0x50e5('0x5a')][_0x343b76]),'MailAccountId':Number(_0x2ce77d[_0x50e5('0x52')]['id'])});}}else{socket[_0x50e5('0xae')](_0x50e5('0xb1'),{'UserId':Number(_0x2ce77d[_0x50e5('0x35')][_0x50e5('0x5a')]),'MailAccountId':Number(_0x2ce77d[_0x50e5('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x321493,null))[_0x50e5('0x19')](handleError(_0x321493,null));};exports[_0x50e5('0xb2')]=function(_0x3d1d85,_0x350a0d){var _0x24458a={};var _0x3e3825={};var _0x306bd9;var _0x2f566b;return db['MailAccount'][_0x50e5('0x57')]({'where':{'id':_0x3d1d85[_0x50e5('0x52')]['id']}})[_0x50e5('0x25')](handleEntityNotFound(_0x350a0d,null))[_0x50e5('0x25')](function(_0x53c7b5){if(_0x53c7b5){_0x306bd9=_0x53c7b5;_0x3e3825['model']=_[_0x50e5('0x36')](db[_0x50e5('0xb3')][_0x50e5('0x2f')]);_0x3e3825['query']=_[_0x50e5('0x36')](_0x3d1d85[_0x50e5('0x35')]);_0x3e3825[_0x50e5('0x37')]=_[_0x50e5('0x39')](_0x3e3825[_0x50e5('0x33')],_0x3e3825['query']);_0x24458a['attributes']=_[_0x50e5('0x39')](_0x3e3825[_0x50e5('0x33')],qs[_0x50e5('0x3a')](_0x3d1d85['query'][_0x50e5('0x3a')]));_0x24458a['attributes']=_0x24458a[_0x50e5('0x38')][_0x50e5('0x3b')]?_0x24458a[_0x50e5('0x38')]:_0x3e3825[_0x50e5('0x33')];_0x24458a[_0x50e5('0x3d')]=qs[_0x50e5('0x3e')](_0x3d1d85[_0x50e5('0x35')][_0x50e5('0x3e')]);_0x24458a['where']=qs[_0x50e5('0x37')](_[_0x50e5('0x40')](_0x3d1d85[_0x50e5('0x35')],_0x3e3825[_0x50e5('0x37')]));if(_0x3d1d85['query'][_0x50e5('0x41')]){_0x24458a['where']=_[_0x50e5('0x4b')](_0x24458a['where'],{'$or':_[_0x50e5('0x2e')](_0x24458a[_0x50e5('0x38')],function(_0xc6417b){var _0x1a9b1d={};_0x1a9b1d[_0xc6417b]={'$like':'%'+_0x3d1d85[_0x50e5('0x35')][_0x50e5('0x41')]+'%'};return _0x1a9b1d;})});}_0x24458a=_[_0x50e5('0x4b')]({},_0x24458a,_0x3d1d85[_0x50e5('0x42')]);return _0x306bd9[_0x50e5('0xb2')](_0x24458a);}})[_0x50e5('0x25')](function(_0x40d3ab){if(_0x40d3ab){_0x2f566b=_0x40d3ab[_0x50e5('0x3b')];if(!_0x3d1d85['query']['hasOwnProperty'](_0x50e5('0x3c'))){_0x24458a[_0x50e5('0x1f')]=qs[_0x50e5('0x1f')](_0x3d1d85[_0x50e5('0x35')][_0x50e5('0x1f')]);_0x24458a[_0x50e5('0x21')]=qs[_0x50e5('0x21')](_0x3d1d85['query']['offset']);}return _0x306bd9['getAgents'](_0x24458a);}})['then'](function(_0x5d8e7d){if(_0x5d8e7d){return _0x5d8e7d?{'count':_0x2f566b,'rows':_0x5d8e7d}:null;}})['then'](respondWithResult(_0x350a0d,null))['catch'](handleError(_0x350a0d,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 0b06614..45557df 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 _0x3e4d=['MailAccount','remove','hasOwnProperty','hook','exports','events'];(function(_0x175761,_0x259080){var _0x3a7324=function(_0xfebf0e){while(--_0xfebf0e){_0x175761['push'](_0x175761['shift']());}};_0x3a7324(++_0x259080);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x1eba99,_0x50bc6f){_0x1eba99=_0x1eba99-0x0;var _0x889576=_0x3e4d[_0x1eba99];return _0x889576;};'use strict';var EventEmitter=require(_0xd3e4('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xd3e4('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd3e4('0x2')};function emitEvent(_0x177ec7){return function(_0x2c7be8,_0x5ea48b,_0xc5abea){MailAccountEvents['emit'](_0x177ec7+':'+_0x2c7be8['id'],_0x2c7be8);MailAccountEvents['emit'](_0x177ec7,_0x2c7be8);_0xc5abea(null);};}for(var e in events){if(events[_0xd3e4('0x3')](e)){var event=events[e];MailAccount[_0xd3e4('0x4')](e,emitEvent(event));}}module[_0xd3e4('0x5')]=MailAccountEvents; \ No newline at end of file +var _0x2cfd=['MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xac00ba,_0x2acd0c){var _0x5abe35=function(_0x4667ad){while(--_0x4667ad){_0xac00ba['push'](_0xac00ba['shift']());}};_0x5abe35(++_0x2acd0c);}(_0x2cfd,0x179));var _0xd2cf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2cfd[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xd2cf('0x0'))['db'][_0xd2cf('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd2cf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd2cf('0x3'),'afterDestroy':_0xd2cf('0x4')};function emitEvent(_0x554992){return function(_0x5c688d,_0x595109,_0x3ce2d6){MailAccountEvents[_0xd2cf('0x5')](_0x554992+':'+_0x5c688d['id'],_0x5c688d);MailAccountEvents['emit'](_0x554992,_0x5c688d);_0x3ce2d6(null);};}for(var e in events){if(events[_0xd2cf('0x6')](e)){var event=events[e];MailAccount[_0xd2cf('0x7')](e,emitEvent(event));}}module[_0xd2cf('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 7093e74..2d81ac2 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 _0x5d93=['pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','data5','auth','user'];(function(_0x33508,_0x2d39aa){var _0x37106b=function(_0x33eaf2){while(--_0x33eaf2){_0x33508['push'](_0x33508['shift']());}};_0x37106b(++_0x2d39aa);}(_0x5d93,0xfd));var _0x35d9=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x5d93[_0x26462c];return _0x509a42;};'use strict';var attributes=require(_0x35d9('0x0'));module[_0x35d9('0x1')]=function(_0xf549c9){return _0xf549c9[_0x35d9('0x2')](_0x35d9('0x3'),attributes,{'tableName':_0x35d9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x164a92=this;var _0x196ce3={'id':_0x164a92['id'],'tls':{'rejectUnauthorized':![]}};if(_0x164a92[_0x35d9('0x5')]!==_0x35d9('0x6')){_0x196ce3[_0x35d9('0x7')]=_0x164a92[_0x35d9('0x5')];}else{_0x196ce3[_0x35d9('0x8')]=_0x164a92['Smtp']['host'];_0x196ce3[_0x35d9('0x9')]=_0x164a92[_0x35d9('0xa')][_0x35d9('0x9')];_0x196ce3['secure']=_0x164a92[_0x35d9('0xa')][_0x35d9('0xb')];}if(_0x164a92['Smtp'][_0x35d9('0xc')]){if(_0x164a92[_0x35d9('0xa')][_0x35d9('0xd')]){if(!_0x164a92[_0x35d9('0xa')][_0x35d9('0xe')])throw new Error(_0x35d9('0xf'));_0x196ce3['auth']={'type':_0x35d9('0x10'),'user':_0x164a92['Smtp']['user'],'accessToken':_0x164a92[_0x35d9('0xa')][_0x35d9('0xe')][_0x35d9('0x11')]};}else{_0x196ce3[_0x35d9('0x12')]={'user':_0x164a92[_0x35d9('0xa')][_0x35d9('0x13')],'pass':_0x164a92[_0x35d9('0xa')][_0x35d9('0x14')]};}}return _0x196ce3;}}});}; \ No newline at end of file +var _0xc748=['exports','define','MailAccount','mail_accounts','custom','service','provider','Smtp','host','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc748,0xdb));var _0x8c74=function(_0x543a4e,_0x544f2e){_0x543a4e=_0x543a4e-0x0;var _0x27a3a9=_0xc748[_0x543a4e];return _0x27a3a9;};'use strict';var attributes=require(_0x8c74('0x0'));module[_0x8c74('0x1')]=function(_0x367a0f){return _0x367a0f[_0x8c74('0x2')](_0x8c74('0x3'),attributes,{'tableName':_0x8c74('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2fad23=this;var _0x1227cf={'id':_0x2fad23['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2fad23['provider']!==_0x8c74('0x5')){_0x1227cf[_0x8c74('0x6')]=_0x2fad23[_0x8c74('0x7')];}else{_0x1227cf['host']=_0x2fad23[_0x8c74('0x8')][_0x8c74('0x9')];_0x1227cf['port']=_0x2fad23[_0x8c74('0x8')][_0x8c74('0xa')];_0x1227cf[_0x8c74('0xb')]=_0x2fad23[_0x8c74('0x8')][_0x8c74('0xb')];}if(_0x2fad23[_0x8c74('0x8')]['authentication']){if(_0x2fad23[_0x8c74('0x8')][_0x8c74('0xc')]){if(!_0x2fad23[_0x8c74('0x8')][_0x8c74('0xd')])throw new Error(_0x8c74('0xe'));_0x1227cf[_0x8c74('0xf')]={'type':_0x8c74('0x10'),'user':_0x2fad23[_0x8c74('0x8')][_0x8c74('0x11')],'accessToken':_0x2fad23[_0x8c74('0x8')][_0x8c74('0xd')][_0x8c74('0x12')]};}else{_0x1227cf[_0x8c74('0xf')]={'user':_0x2fad23[_0x8c74('0x8')]['user'],'pass':_0x2fad23[_0x8c74('0x8')][_0x8c74('0x13')]};}}return _0x1227cf;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 642c004..58ce999 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 _0x2542=['MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','push','length','*,*,*,*','Contacts','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','Applications'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0x2542,0x169));var _0x2254=function(_0x1e06a8,_0x24dd97){_0x1e06a8=_0x1e06a8-0x0;var _0x35ab1a=_0x2542[_0x1e06a8];return _0x35ab1a;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var rs=require(_0x2254('0x3'));var Redis=require('ioredis');var db=require(_0x2254('0x4'))['db'];var logger=require('../../config/logger')(_0x2254('0x5'));var config=require(_0x2254('0x6'));var jayson=require(_0x2254('0x7'));var client=jayson[_0x2254('0x8')][_0x2254('0x9')]({'port':0x232c});config['redis']=_[_0x2254('0xa')](config[_0x2254('0xb')],{'host':_0x2254('0xc'),'port':0x18eb});var socket=require(_0x2254('0xd'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xe'))[_0x2254('0xf')](socket);function respondWithRpcPromise(_0xbf1c18,_0xb395da,_0x1ae415){return new BPromise(function(_0x38fb2b,_0x5b1ab9){return client[_0x2254('0x10')](_0xbf1c18,_0x1ae415)[_0x2254('0x11')](function(_0x506abe){logger[_0x2254('0x12')]('MailAccount,\x20%s,\x20%s',_0xb395da,'request\x20sent');logger[_0x2254('0x13')](_0x2254('0x14'),_0xb395da,_0x2254('0x15'),JSON[_0x2254('0x16')](_0x506abe));if(_0x506abe[_0x2254('0x17')]){if(_0x506abe[_0x2254('0x17')]['code']===0x1f4){logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe['error'][_0x2254('0x19')]);return _0x5b1ab9(_0x506abe[_0x2254('0x17')][_0x2254('0x19')]);}logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe[_0x2254('0x17')]['message']);return _0x38fb2b(_0x506abe[_0x2254('0x17')]['message']);}else{logger[_0x2254('0x12')](_0x2254('0x18'),_0xb395da,_0x2254('0x15'));_0x38fb2b(_0x506abe[_0x2254('0x1a')][_0x2254('0x19')]);}})[_0x2254('0x1b')](function(_0x497724){logger['error']('MailAccount,\x20%s,\x20%s',_0xb395da,_0x497724);_0x5b1ab9(_0x497724);});});}exports[_0x2254('0x1c')]=function(_0x3a79f8){var _0x3c3a98=this;return new Promise(function(_0x1f1163,_0x2801d9){return db[_0x2254('0x1d')]['findAll']({'raw':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a79f8['options']?_0x3a79f8['options']['where']||null:null,'attributes':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'limit':_0x3a79f8['options']?_0x3a79f8['options']['limit']||null:null,'include':_0x3a79f8['options']?_0x3a79f8['options']['include']?_[_0x2254('0x21')](_0x3a79f8[_0x2254('0x1e')][_0x2254('0x22')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x23')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x20')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x22')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x23')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x20')],'include':_0x4f6877[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4f6877[_0x2254('0x22')],function(_0x482688){return{'model':db[_0x482688[_0x2254('0x23')]],'as':_0x482688['as'],'attributes':_0x482688[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x37af8b){logger[_0x2254('0x12')](_0x2254('0x1c'),_0x3a79f8);logger[_0x2254('0x13')](_0x2254('0x1c'),_0x3a79f8,JSON[_0x2254('0x16')](_0x37af8b));_0x1f1163(_0x37af8b);})[_0x2254('0x1b')](function(_0x21c641){logger[_0x2254('0x17')](_0x2254('0x1c'),_0x21c641[_0x2254('0x19')],_0x3a79f8);_0x2801d9(_0x3c3a98[_0x2254('0x17')](0x1f4,_0x21c641[_0x2254('0x19')]));});});};exports[_0x2254('0x24')]=function(_0x291894){var _0x2f32f8=this;return new Promise(function(_0x4e3658,_0xe29526){return db[_0x2254('0x1d')][_0x2254('0x25')]({'raw':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x26')]||null:null,'attributes':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'include':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x22')]?_[_0x2254('0x21')](_0x291894[_0x2254('0x1e')]['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x23')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4a2df0[_0x2254('0x22')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x23')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x20')],'include':_0x141ddc[_0x2254('0x22')]?_['map'](_0x141ddc[_0x2254('0x22')],function(_0x192e9f){return{'model':db[_0x192e9f[_0x2254('0x23')]],'as':_0x192e9f['as'],'attributes':_0x192e9f[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x3f6007){if(_0x291894[_0x2254('0x1e')][_0x2254('0x27')]===!![])_0x3f6007[_0x2254('0x28')](_0x2254('0x29'),_0x3f6007['getSmtpOptions']());logger[_0x2254('0x12')](_0x2254('0x24'),_0x291894);logger[_0x2254('0x13')](_0x2254('0x24'),_0x291894,JSON['stringify'](_0x3f6007));_0x4e3658(_0x3f6007);})[_0x2254('0x1b')](function(_0x160fec){logger[_0x2254('0x17')](_0x2254('0x24'),_0x160fec[_0x2254('0x19')],_0x291894);_0xe29526(_0x2f32f8[_0x2254('0x17')](0x1f4,_0x160fec[_0x2254('0x19')]));});});};exports[_0x2254('0x2a')]=function(_0x4db9a8){var _0x362ad1=this;return new Promise(function(_0x5c15d7,_0x1df9c3){var _0x19b580={'body':_0x4db9a8[_0x2254('0x2b')],'channel':_0x2254('0x2c')};var _0x460bb3=_[_0x2254('0x2d')](_[_0x2254('0x2e')](db['CmContact'][_0x2254('0x2f')]),[_0x2254('0x30'),_0x2254('0x31'),_0x2254('0x32'),_0x2254('0x33')]);var _0x57cda2=![];if(_0x4db9a8[_0x2254('0x2b')]['id']){delete _0x4db9a8[_0x2254('0x2b')]['id'];}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')])){return _0x1df9c3(_0x362ad1['error'](0x1f4,_0x2254('0x36')));}if(_['isNil'](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')])||_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')]===''){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x37')));}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x39')+_0x460bb3));}if(!_[_0x2254('0x3a')](_0x460bb3,_0x4db9a8[_0x2254('0x2b')]['mapKey'])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x3b')+_0x460bb3));}var _0x2c5609={};_0x2c5609[_0x4db9a8['body'][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x1d')][_0x2254('0x25')]({'where':{'id':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x3d')],'as':_0x2254('0x3e'),'include':[{'model':db[_0x2254('0x3f')],'as':'Contacts','where':_0x2c5609,'limit':0x1,'order':[[_0x2254('0x31'),_0x2254('0x40')]]}]},{'model':db[_0x2254('0x41')],'as':_0x2254('0x42')},{'model':db[_0x2254('0x43')],'as':_0x2254('0x44'),'include':[{'model':db[_0x2254('0x45')],'as':_0x2254('0x45')}]}]})[_0x2254('0x11')](function(_0xa103ea){if(_0xa103ea&&_0xa103ea['List']){var _0x36b977=_0xa103ea[_0x2254('0x46')]({'plain':!![]});_0x19b580['account']=_[_0x2254('0x47')](_0x36b977,[_0x2254('0x42'),_0x2254('0x3e')]);_0x19b580[_0x2254('0x3c')]['smtpOptions']=_0xa103ea[_0x2254('0x48')]();_0x19b580[_0x2254('0x49')]=_0x36b977['Applications'];_0x19b580[_0x2254('0x4a')]=_0x36b977[_0x2254('0x3e')];_0x19b580[_0x2254('0x49')]=_[_0x2254('0x4b')](_0x19b580['applications'],[_0x2254('0x4c')],[_0x2254('0x4d')]);if(_0x19b580[_0x2254('0x3c')]&&_0x19b580['account']['autoclose']){_0x19b580[_0x2254('0x49')][_0x2254('0x4e')]({'id':0x0,'priority':_0x19b580['applications'][_0x2254('0x4f')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2254('0x50')});}if(_0x19b580[_0x2254('0x3c')][_0x2254('0x42')]){delete _0x19b580[_0x2254('0x3c')][_0x2254('0x42')];}if(_0x19b580['account']['List']){delete _0x19b580[_0x2254('0x3c')]['List'];}if(_0x36b977[_0x2254('0x3e')][_0x2254('0x51')][_0x2254('0x4f')]){return _0x36b977[_0x2254('0x3e')]['Contacts'][0x0];}var _0xd5fb20=_[_0x2254('0xa')](_0x4db9a8['body'],{'firstName':_0x4db9a8['body'][_0x2254('0x35')],'ListId':_0x36b977['ListId']});_0xd5fb20[_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x3f')]['create'](_0xd5fb20);}else{throw new Error('List\x20not\x20found');}})[_0x2254('0x11')](function(_0x5b1bd8){_0x19b580[_0x2254('0x52')]=_0x5b1bd8;if(_0x5b1bd8){if(!_0x4db9a8['body']['message']['messageId']){_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')]=rs[_0x2254('0x54')]()+'\x20'+_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')];}var _0x25137c={'ContactId':_0x5b1bd8['id'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')],'to':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'lastMsgAt':moment()[_0x2254('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2254('0x25')]({'where':{'closed':![],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x57')],'as':_0x2254('0x58'),'attributes':[_0x2254('0x53')],'where':{'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x59')]}}]})[_0x2254('0x11')](function(_0x4a7d36){if(_0x4a7d36){return[_0x4a7d36,![]];}return db['MailInteraction'][_0x2254('0x5a')](_0x25137c)['then'](function(_0x294931){return[_0x294931,!![]];});});}else{throw new Error(_0x2254('0x5b'));}})['spread'](function(_0x3c091e,_0x1b154f){if(_0x3c091e){_0x57cda2=_0x1b154f;if(!_0x1b154f){return _0x3c091e['update']({'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['messageId'],'to':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8['body']['message']['cc'],'subject':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x5c')],'attach':_0x3c091e['attach']?_0x3c091e[_0x2254('0x55')]:_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x2254('0x5d')),'lastMsgAt':moment()['format'](_0x2254('0x5d')),'lastMsgDirection':'in'});}else{return _0x3c091e;}}})[_0x2254('0x11')](function(_0x5ed07f){_0x19b580[_0x2254('0x5e')]=_0x5ed07f[_0x2254('0x46')]({'plain':!![]});_0x19b580['interaction'][_0x2254('0x5f')]=_0x57cda2;return db[_0x2254('0x57')][_0x2254('0x5a')]({'body':_0x4db9a8[_0x2254('0x2b')]['body'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'MailInteractionId':_0x5ed07f['id'],'direction':'in','ContactId':_0x19b580[_0x2254('0x52')]['id'],'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x53')],'from':_0x4db9a8['body'][_0x2254('0x19')]['from'],'to':_0x4db9a8[_0x2254('0x2b')]['message']['to'],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8['body'][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'Attachments':_0x4db9a8['body'][_0x2254('0x19')]['attachments'],'originTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['originTo'],'originCc':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x60')],'bcc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['bcc'],'ChatWebsiteId':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x61')]||null,'originChannel':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x62')]||_0x2254('0x63'),'ChatOfflineMessageId':_0x4db9a8['body'][_0x2254('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2254('0x64')],'as':'Attachments'}]});})['then'](function(_0x4efb07){_0x19b580[_0x2254('0x19')]=_0x4efb07;if(_0x19b580['interaction'][_0x2254('0x65')]){return db[_0x2254('0x66')]['find']({'attributes':['id',_0x2254('0x67')],'where':{'id':_0x19b580[_0x2254('0x5e')][_0x2254('0x65')]}})[_0x2254('0x11')](function(_0x259e10){if(_0x259e10){_0x19b580[_0x2254('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x259e10[_0x2254('0x67')]+','+(_0x19b580[_0x2254('0x3c')][_0x2254('0x68')]||0xa),'interval':_0x2254('0x50')});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);})[_0x2254('0x11')](function(_0x39b95b){_0x5c15d7(_0x39b95b);})['catch'](function(_0x25eb17){_0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x25eb17['message']));});});}; \ No newline at end of file +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(_0x41d2bc,_0x1a7395){var _0x2eb88d=function(_0x4ae478){while(--_0x4ae478){_0x41d2bc['push'](_0x41d2bc['shift']());}};_0x2eb88d(++_0x1a7395);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3234bc,_0x16dd68){_0x3234bc=_0x3234bc-0x0;var _0x16f432=_0xc2c7[_0x3234bc];return _0x16f432;};'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 diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 7090c8a..ecb70cf 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 _0x7cc0=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x44e845,_0x17e1ba){var _0x1a1b94=function(_0x206f1c){while(--_0x206f1c){_0x44e845['push'](_0x44e845['shift']());}};_0x1a1b94(++_0x17e1ba);}(_0x7cc0,0x96));var _0x07cc=function(_0x369538,_0x64a48f){_0x369538=_0x369538-0x0;var _0x159686=_0x7cc0[_0x369538];return _0x159686;};'use strict';var MailAccountEvents=require(_0x07cc('0x0'));var events=[_0x07cc('0x1'),_0x07cc('0x2'),_0x07cc('0x3')];function createListener(_0x363d69,_0x2a9430){return function(_0x914198){_0x2a9430[_0x07cc('0x4')](_0x363d69,_0x914198);};}function removeListener(_0x5dd407,_0x5d9627){return function(){MailAccountEvents[_0x07cc('0x5')](_0x5dd407,_0x5d9627);};}exports[_0x07cc('0x6')]=function(_0x4b8b47){for(var _0x5a6b3d=0x0,_0x328f3b=events[_0x07cc('0x7')];_0x5a6b3d<_0x328f3b;_0x5a6b3d++){var _0x458c24=events[_0x5a6b3d];var _0x2508dd=createListener(_0x07cc('0x8')+_0x458c24,_0x4b8b47);MailAccountEvents['on'](_0x458c24,_0x2508dd);}}; \ No newline at end of file +var _0x0cae=['removeListener','register','mailAccount:','./mailAccount.events','save','update','emit'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x0cae,0xa4));var _0xe0ca=function(_0xc4b1bd,_0x29b248){_0xc4b1bd=_0xc4b1bd-0x0;var _0x13c687=_0x0cae[_0xc4b1bd];return _0x13c687;};'use strict';var MailAccountEvents=require(_0xe0ca('0x0'));var events=[_0xe0ca('0x1'),'remove',_0xe0ca('0x2')];function createListener(_0x4e2629,_0x1d6414){return function(_0x201c22){_0x1d6414[_0xe0ca('0x3')](_0x4e2629,_0x201c22);};}function removeListener(_0x27c0cd,_0x283169){return function(){MailAccountEvents[_0xe0ca('0x4')](_0x27c0cd,_0x283169);};}exports[_0xe0ca('0x5')]=function(_0x3828d5){for(var _0x56075c=0x0,_0x213b96=events['length'];_0x56075c<_0x213b96;_0x56075c++){var _0xe5b6dc=events[_0x56075c];var _0x56fd34=createListener(_0xe0ca('0x6')+_0xe5b6dc,_0x3828d5);MailAccountEvents['on'](_0xe5b6dc,_0x56fd34);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 889dac2..06b7ecc 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 _0xebb9=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','delete','destroy','multer'];(function(_0x5c9380,_0x410fc9){var _0x5a259f=function(_0x536287){while(--_0x536287){_0x5c9380['push'](_0x5c9380['shift']());}};_0x5a259f(++_0x410fc9);}(_0xebb9,0xcf));var _0x9ebb=function(_0x47f331,_0x1f23bd){_0x47f331=_0x47f331-0x0;var _0x56db77=_0xebb9[_0x47f331];return _0x56db77;};'use strict';var multer=require(_0x9ebb('0x0'));var util=require(_0x9ebb('0x1'));var path=require(_0x9ebb('0x2'));var timeout=require(_0x9ebb('0x3'));var express=require(_0x9ebb('0x4'));var router=express[_0x9ebb('0x5')]();var fs_extra=require(_0x9ebb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9ebb('0x7'));var config=require(_0x9ebb('0x8'));var controller=require(_0x9ebb('0x9'));router['get'](_0x9ebb('0xa'),auth[_0x9ebb('0xb')](),controller[_0x9ebb('0xc')]);router[_0x9ebb('0xd')](_0x9ebb('0xa'),auth[_0x9ebb('0xb')](),controller['update']);router[_0x9ebb('0xe')](_0x9ebb('0xa'),auth[_0x9ebb('0xb')](),controller[_0x9ebb('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8f45=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x59fd42,_0x155066){var _0x4278d9=function(_0x2ad8ff){while(--_0x2ad8ff){_0x59fd42['push'](_0x59fd42['shift']());}};_0x4278d9(++_0x155066);}(_0x8f45,0x1e0));var _0x58f4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8f45[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x58f4('0x0'));var path=require(_0x58f4('0x1'));var timeout=require(_0x58f4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x58f4('0x3'));var auth=require(_0x58f4('0x4'));var interaction=require(_0x58f4('0x5'));var config=require(_0x58f4('0x6'));var controller=require(_0x58f4('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x58f4('0x8')](_0x58f4('0x9'),auth[_0x58f4('0xa')](),controller[_0x58f4('0xb')]);router[_0x58f4('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x58f4('0xd')]);module[_0x58f4('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 e2f318d..808ef18 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 _0x882e=['STRING','*,*,*,*','sequelize','INTEGER','noop'];(function(_0x49774e,_0xe81a02){var _0x2ad708=function(_0x1671a2){while(--_0x1671a2){_0x49774e['push'](_0x49774e['shift']());}};_0x2ad708(++_0xe81a02);}(_0x882e,0x1ab));var _0xe882=function(_0x48b690,_0x4f0c3e){_0x48b690=_0x48b690-0x0;var _0x382742=_0x882e[_0x48b690];return _0x382742;};'use strict';var Sequelize=require(_0xe882('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe882('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe882('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe882('0x3')]},'interval':{'type':Sequelize[_0xe882('0x3')],'defaultValue':_0xe882('0x4')}}; \ No newline at end of file +var _0x7c9e=['sequelize','exports','noop','STRING','*,*,*,*'];(function(_0x341053,_0x310529){var _0x1a6af4=function(_0x24c4bf){while(--_0x24c4bf){_0x341053['push'](_0x341053['shift']());}};_0x1a6af4(++_0x310529);}(_0x7c9e,0x18b));var _0xe7c9=function(_0x56f73c,_0x4cdf1c){_0x56f73c=_0x56f73c-0x0;var _0xbc199c=_0x7c9e[_0x56f73c];return _0xbc199c;};'use strict';var Sequelize=require(_0xe7c9('0x0'));module[_0xe7c9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe7c9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe7c9('0x3')]},'interval':{'type':Sequelize[_0xe7c9('0x3')],'defaultValue':_0xe7c9('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index ac45f6f..b3c73fa 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 _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(_0x1ba697,_0x186781){var _0x433b23=function(_0xe5df67){while(--_0xe5df67){_0x1ba697['push'](_0x1ba697['shift']());}};_0x433b23(++_0x186781);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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 +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x641fda,_0x5364a8){var _0x3831f6=function(_0xe0980b){while(--_0xe0980b){_0x641fda['push'](_0x641fda['shift']());}};_0x3831f6(++_0x5364a8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index fec7097..65a7339 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 _0xb71a=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x4fdee1,_0x3f290c){var _0x87826e=function(_0x2cbeaa){while(--_0x2cbeaa){_0x4fdee1['push'](_0x4fdee1['shift']());}};_0x87826e(++_0x3f290c);}(_0xb71a,0x162));var _0xab71=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0xb71a[_0x9d1e6b];return _0x2b3070;};'use strict';var _=require(_0xab71('0x0'));var util=require('util');var logger=require(_0xab71('0x1'))(_0xab71('0x2'));var moment=require(_0xab71('0x3'));var BPromise=require('bluebird');var rp=require(_0xab71('0x4'));var fs=require('fs');var path=require(_0xab71('0x5'));var rimraf=require('rimraf');var config=require(_0xab71('0x6'));var attributes=require(_0xab71('0x7'));module[_0xab71('0x8')]=function(_0x48b096,_0x1353c7){return _0x48b096[_0xab71('0x9')](_0xab71('0xa'),attributes,{'tableName':_0xab71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab71('0xc'),'collate':_0xab71('0xd')});}; \ No newline at end of file +var _0xdf43=['../../config/environment','./mailApplication.attributes','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x60882,_0x36ab14){var _0x15c346=function(_0x1a724f){while(--_0x1a724f){_0x60882['push'](_0x60882['shift']());}};_0x15c346(++_0x36ab14);}(_0xdf43,0xc9));var _0x3df4=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xdf43[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x3df4('0x0'));var util=require(_0x3df4('0x1'));var logger=require(_0x3df4('0x2'))(_0x3df4('0x3'));var moment=require(_0x3df4('0x4'));var BPromise=require('bluebird');var rp=require(_0x3df4('0x5'));var fs=require('fs');var path=require(_0x3df4('0x6'));var rimraf=require('rimraf');var config=require(_0x3df4('0x7'));var attributes=require(_0x3df4('0x8'));module['exports']=function(_0x1ea04d,_0x592a6d){return _0x1ea04d[_0x3df4('0x9')](_0x3df4('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3df4('0xb'),'collate':_0x3df4('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3a31a56..6fab0fe 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 _0x4ca3=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','MailApplication','body','options','raw','where','limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring'];(function(_0x260cda,_0x53f451){var _0x3cc073=function(_0x2b61ec){while(--_0x2b61ec){_0x260cda['push'](_0x260cda['shift']());}};_0x3cc073(++_0x53f451);}(_0x4ca3,0x150));var _0x34ca=function(_0x31efca,_0x4960ee){_0x31efca=_0x31efca-0x0;var _0x28990d=_0x4ca3[_0x31efca];return _0x28990d;};'use strict';var _=require(_0x34ca('0x0'));var util=require(_0x34ca('0x1'));var moment=require(_0x34ca('0x2'));var BPromise=require(_0x34ca('0x3'));var rs=require(_0x34ca('0x4'));var fs=require('fs');var Redis=require(_0x34ca('0x5'));var db=require(_0x34ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x34ca('0x7'));var config=require(_0x34ca('0x8'));var jayson=require(_0x34ca('0x9'));var client=jayson[_0x34ca('0xa')][_0x34ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16f55e,_0x340f9d,_0x1434a8){return new BPromise(function(_0x1656ea,_0x1daf41){return client[_0x34ca('0xc')](_0x16f55e,_0x1434a8)[_0x34ca('0xd')](function(_0x2036c1){logger['info'](_0x34ca('0xe'),_0x340f9d,_0x34ca('0xf'));logger[_0x34ca('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x340f9d,_0x34ca('0xf'),JSON[_0x34ca('0x11')](_0x2036c1));if(_0x2036c1[_0x34ca('0x12')]){if(_0x2036c1[_0x34ca('0x12')][_0x34ca('0x13')]===0x1f4){logger['error'](_0x34ca('0xe'),_0x340f9d,_0x2036c1[_0x34ca('0x12')][_0x34ca('0x14')]);return _0x1daf41(_0x2036c1['error'][_0x34ca('0x14')]);}logger['error'](_0x34ca('0xe'),_0x340f9d,_0x2036c1[_0x34ca('0x12')]['message']);return _0x1656ea(_0x2036c1['error'][_0x34ca('0x14')]);}else{logger[_0x34ca('0x15')](_0x34ca('0xe'),_0x340f9d,_0x34ca('0xf'));_0x1656ea(_0x2036c1[_0x34ca('0x16')][_0x34ca('0x14')]);}})[_0x34ca('0x17')](function(_0x29c1b3){logger[_0x34ca('0x12')]('MailApplication,\x20%s,\x20%s',_0x340f9d,_0x29c1b3);_0x1daf41(_0x29c1b3);});});}exports['UpdateMailApplication']=function(_0x485dc0){var _0x298ef2=this;return new Promise(function(_0x22d566,_0x2466df){return db[_0x34ca('0x18')]['update'](_0x485dc0[_0x34ca('0x19')],{'raw':_0x485dc0[_0x34ca('0x1a')]?_0x485dc0['options'][_0x34ca('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485dc0[_0x34ca('0x1a')]?_0x485dc0[_0x34ca('0x1a')][_0x34ca('0x1c')]||null:null,'attributes':_0x485dc0['options']?_0x485dc0['options']['attributes']||null:null,'limit':_0x485dc0['options']?_0x485dc0[_0x34ca('0x1a')][_0x34ca('0x1d')]||null:null})[_0x34ca('0xd')](function(_0x3cb69a){logger[_0x34ca('0x15')](_0x34ca('0x1e'),_0x485dc0);logger[_0x34ca('0x10')]('UpdateMailApplication',_0x485dc0,JSON[_0x34ca('0x11')](_0x3cb69a));_0x22d566(_0x3cb69a);})[_0x34ca('0x17')](function(_0x59ebd1){logger[_0x34ca('0x12')](_0x34ca('0x1e'),_0x59ebd1[_0x34ca('0x14')],_0x485dc0);_0x2466df(_0x298ef2[_0x34ca('0x12')](0x1f4,_0x59ebd1[_0x34ca('0x14')]));});});}; \ No newline at end of file +var _0xbc5c=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','then','lodash'];(function(_0x38ae2d,_0x4e74ff){var _0x35fe7e=function(_0x2c6dd3){while(--_0x2c6dd3){_0x38ae2d['push'](_0x38ae2d['shift']());}};_0x35fe7e(++_0x4e74ff);}(_0xbc5c,0x1e5));var _0xcbc5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xbc5c[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xcbc5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbc5('0x1'));var rs=require(_0xcbc5('0x2'));var fs=require('fs');var Redis=require(_0xcbc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbc5('0x4'));var logger=require(_0xcbc5('0x5'))('rpc');var config=require(_0xcbc5('0x6'));var jayson=require(_0xcbc5('0x7'));var client=jayson[_0xcbc5('0x8')][_0xcbc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x66cb93,_0x5350d5,_0x464797){return new BPromise(function(_0x145310,_0x228af3){return client['request'](_0x66cb93,_0x464797)['then'](function(_0x10d485){logger[_0xcbc5('0xa')](_0xcbc5('0xb'),_0x5350d5,'request\x20sent');logger[_0xcbc5('0xc')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x5350d5,_0xcbc5('0xd'),JSON['stringify'](_0x10d485));if(_0x10d485[_0xcbc5('0xe')]){if(_0x10d485[_0xcbc5('0xe')][_0xcbc5('0xf')]===0x1f4){logger[_0xcbc5('0xe')](_0xcbc5('0xb'),_0x5350d5,_0x10d485[_0xcbc5('0xe')]['message']);return _0x228af3(_0x10d485[_0xcbc5('0xe')][_0xcbc5('0x10')]);}logger[_0xcbc5('0xe')](_0xcbc5('0xb'),_0x5350d5,_0x10d485[_0xcbc5('0xe')]['message']);return _0x145310(_0x10d485[_0xcbc5('0xe')][_0xcbc5('0x10')]);}else{logger['info'](_0xcbc5('0xb'),_0x5350d5,_0xcbc5('0xd'));_0x145310(_0x10d485[_0xcbc5('0x11')][_0xcbc5('0x10')]);}})[_0xcbc5('0x12')](function(_0x5c7dae){logger['error']('MailApplication,\x20%s,\x20%s',_0x5350d5,_0x5c7dae);_0x228af3(_0x5c7dae);});});}exports[_0xcbc5('0x13')]=function(_0x1f9be0){var _0x4616f4=this;return new Promise(function(_0x118726,_0x240b01){return db[_0xcbc5('0x14')][_0xcbc5('0x15')](_0x1f9be0[_0xcbc5('0x16')],{'raw':_0x1f9be0['options']?_0x1f9be0[_0xcbc5('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f9be0['options']?_0x1f9be0[_0xcbc5('0x17')][_0xcbc5('0x18')]||null:null,'attributes':_0x1f9be0[_0xcbc5('0x17')]?_0x1f9be0['options'][_0xcbc5('0x19')]||null:null,'limit':_0x1f9be0[_0xcbc5('0x17')]?_0x1f9be0[_0xcbc5('0x17')]['limit']||null:null})[_0xcbc5('0x1a')](function(_0xd2ac93){logger[_0xcbc5('0xa')]('UpdateMailApplication',_0x1f9be0);logger[_0xcbc5('0xc')]('UpdateMailApplication',_0x1f9be0,JSON['stringify'](_0xd2ac93));_0x118726(_0xd2ac93);})[_0xcbc5('0x12')](function(_0x86845){logger[_0xcbc5('0xe')]('UpdateMailApplication',_0x86845[_0xcbc5('0x10')],_0x1f9be0);_0x240b01(_0x4616f4[_0xcbc5('0xe')](0x1f4,_0x86845[_0xcbc5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 38b15bd..d780e3b 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 _0xb24e=['get','/describe','/:id','isAuthenticated','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','mail','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller'];(function(_0x5bf840,_0x9fc2ab){var _0x4f4355=function(_0x5bef49){while(--_0x5bef49){_0x5bf840['push'](_0x5bf840['shift']());}};_0x4f4355(++_0x9fc2ab);}(_0xb24e,0x8c));var _0xeb24=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb24e[_0x2641f9];return _0x585741;};'use strict';var express=require('express');var router=express[_0xeb24('0x0')]();var auth=require(_0xeb24('0x1'));var interaction=require(_0xeb24('0x2'));var controller=require(_0xeb24('0x3'));router[_0xeb24('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeb24('0x4')](_0xeb24('0x5'),auth['isAuthenticated'](),controller['describe']);router[_0xeb24('0x4')](_0xeb24('0x6'),auth[_0xeb24('0x7')](),controller['show']);router[_0xeb24('0x4')](_0xeb24('0x8'),auth[_0xeb24('0x7')](),controller[_0xeb24('0x9')]);router['get']('/:id/download',auth[_0xeb24('0x7')](),controller[_0xeb24('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb24('0xb')]);router[_0xeb24('0xc')]('/:id/messages',auth['isAuthenticated'](),controller[_0xeb24('0xd')]);router[_0xeb24('0xc')](_0xeb24('0xe'),auth['isAuthenticated'](),interaction[_0xeb24('0xf')](_0xeb24('0x10'),'mailinteraction:addtags'),controller['addTags']);router[_0xeb24('0x11')](_0xeb24('0x6'),auth[_0xeb24('0x7')](),interaction['tracked'](_0xeb24('0x10'),_0xeb24('0x12')),controller[_0xeb24('0x13')]);router[_0xeb24('0x14')](_0xeb24('0x6'),auth['isAuthenticated'](),interaction[_0xeb24('0xf')](_0xeb24('0x10'),_0xeb24('0x15')),controller[_0xeb24('0x16')]);router[_0xeb24('0x14')](_0xeb24('0xe'),auth[_0xeb24('0x7')](),controller[_0xeb24('0x17')]);module['exports']=router; \ No newline at end of file +var _0x63ea=['/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id/messages','getMessages','download','post','addMessage'];(function(_0x1d0fac,_0x1f344b){var _0x142ed3=function(_0x5b62f2){while(--_0x5b62f2){_0x1d0fac['push'](_0x1d0fac['shift']());}};_0x142ed3(++_0x1f344b);}(_0x63ea,0x15b));var _0xa63e=function(_0x328a6b,_0x26cd83){_0x328a6b=_0x328a6b-0x0;var _0x42fc25=_0x63ea[_0x328a6b];return _0x42fc25;};'use strict';var express=require(_0xa63e('0x0'));var router=express[_0xa63e('0x1')]();var auth=require(_0xa63e('0x2'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router['get']('/',auth[_0xa63e('0x3')](),controller[_0xa63e('0x4')]);router[_0xa63e('0x5')](_0xa63e('0x6'),auth[_0xa63e('0x3')](),controller[_0xa63e('0x7')]);router[_0xa63e('0x5')]('/:id',auth[_0xa63e('0x3')](),controller['show']);router[_0xa63e('0x5')](_0xa63e('0x8'),auth['isAuthenticated'](),controller[_0xa63e('0x9')]);router[_0xa63e('0x5')]('/:id/download',auth[_0xa63e('0x3')](),controller[_0xa63e('0xa')]);router[_0xa63e('0xb')]('/',auth[_0xa63e('0x3')](),controller['create']);router[_0xa63e('0xb')](_0xa63e('0x8'),auth[_0xa63e('0x3')](),controller[_0xa63e('0xc')]);router['post'](_0xa63e('0xd'),auth[_0xa63e('0x3')](),interaction[_0xa63e('0xe')](_0xa63e('0xf'),_0xa63e('0x10')),controller[_0xa63e('0x11')]);router[_0xa63e('0x12')](_0xa63e('0x13'),auth[_0xa63e('0x3')](),interaction[_0xa63e('0xe')](_0xa63e('0xf'),_0xa63e('0x14')),controller[_0xa63e('0x15')]);router[_0xa63e('0x16')](_0xa63e('0x13'),auth[_0xa63e('0x3')](),interaction[_0xa63e('0xe')](_0xa63e('0xf'),_0xa63e('0x17')),controller['destroy']);router[_0xa63e('0x16')](_0xa63e('0xd'),auth[_0xa63e('0x3')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b092c2b..513f793 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 _0x34ab=['exports','BOOLEAN','STRING','long','TEXT','DATE','ENUM','sequelize','iconv'];(function(_0x259cf6,_0x2750ba){var _0x4e1ac4=function(_0x23c9e9){while(--_0x23c9e9){_0x259cf6['push'](_0x259cf6['shift']());}};_0x4e1ac4(++_0x2750ba);}(_0x34ab,0xf1));var _0xb34a=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x34ab[_0x47cfa0];return _0x386b1d;};'use strict';var Sequelize=require(_0xb34a('0x0'));var iconv=require(_0xb34a('0x1'));module[_0xb34a('0x2')]={'closed':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb34a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb34a('0x4')]},'inReplyTo':{'type':Sequelize[_0xb34a('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb34a('0x4')]},'cc':{'type':Sequelize['TEXT'](_0xb34a('0x5'))},'subject':{'type':Sequelize[_0xb34a('0x6')]()},'attach':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb34a('0x7')]},'substatus':{'type':Sequelize[_0xb34a('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xb34a('0x7')]},'firstMsgDirection':{'type':Sequelize[_0xb34a('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb34a('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xb34a('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb34a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8208=['STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8208,0x16d));var _0x8820=function(_0x4e55bc,_0x4cb480){_0x4e55bc=_0x4e55bc-0x0;var _0x304ef5=_0x8208[_0x4e55bc];return _0x304ef5;};'use strict';var Sequelize=require(_0x8820('0x0'));var iconv=require(_0x8820('0x1'));module[_0x8820('0x2')]={'closed':{'type':Sequelize[_0x8820('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8820('0x4')]},'disposition':{'type':Sequelize[_0x8820('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8820('0x5')]},'note':{'type':Sequelize[_0x8820('0x5')]},'inReplyTo':{'type':Sequelize[_0x8820('0x5')](0x1fe)},'to':{'type':Sequelize[_0x8820('0x5')]},'cc':{'type':Sequelize[_0x8820('0x6')](_0x8820('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8820('0x4')]},'substatus':{'type':Sequelize[_0x8820('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8820('0x8')]('in',_0x8820('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8820('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8820('0x8')]('in',_0x8820('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8820('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 f0ac02e..c946877 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 _0xf417=['mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','sqlOperator','conditions','find','unreadMessages','having','Contact','operator','$substring','value','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','start','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','SELECT','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','count','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.MailAccountId','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','create','body','describe','addMessage','ids','getMessages','pick','format','options','findAll','inlineCss','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','unix','join','root','tmp','files','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','headers','Bcc','existsSync','attachments','readFileSync','message%d.eml','download','unlinkSync','rimraf','zip-dir','moment','util','squel','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','set','Content-Range','update','destroy','then','stack','name','send','fullname','TagIds','Tags','push','MailMessage','findOne','plainBody','lastMsgText','trimStart','catch','waiting','answered','unmanaged','total','closed','UserId','talking','index','map','MailInteraction','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users'];(function(_0x1aff57,_0x4aa7b6){var _0x4c35a5=function(_0x48f24b){while(--_0x48f24b){_0x1aff57['push'](_0x1aff57['shift']());}};_0x4c35a5(++_0x4aa7b6);}(_0xf417,0x8f));var _0x7f41=function(_0x109f48,_0x40847c){_0x109f48=_0x109f48-0x0;var _0x197fff=_0xf417[_0x109f48];return _0x197fff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f41('0x0'));var zipdir=require(_0x7f41('0x1'));var moment=require(_0x7f41('0x2'));var BPromise=require('bluebird');var util=require(_0x7f41('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x7f41('0x4'));var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x7f41('0x5'))('api');var config=require(_0x7f41('0x6'));var db=require(_0x7f41('0x7'))['db'];var htmlEntities=require('html-entities');config[_0x7f41('0x8')]=_['defaults'](config[_0x7f41('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f41('0x9'))(new Redis(config[_0x7f41('0x8')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x48b265,_0x55810a){_0x55810a=_0x55810a||0xcc;return function(_0x4bc8ff){if(_0x4bc8ff){return _0x48b265[_0x7f41('0xa')](_0x55810a);}return _0x48b265[_0x7f41('0xb')](_0x55810a)[_0x7f41('0xc')]();};}function respondWithResult(_0x3407b2,_0x637b2d){_0x637b2d=_0x637b2d||0xc8;return function(_0x46dcfe){if(_0x46dcfe){return _0x3407b2[_0x7f41('0xb')](_0x637b2d)['json'](_0x46dcfe);}};}function respondWithFilteredResult(_0x513d36,_0x380ee0){return function(_0x4f5b74){if(_0x4f5b74){var _0x568eea=typeof _0x380ee0[_0x7f41('0xd')]===_0x7f41('0xe')&&typeof _0x380ee0[_0x7f41('0xf')]==='undefined';var _0x212b28=_0x4f5b74['count'];var _0x27c0f6=_0x568eea?0x0:_0x380ee0[_0x7f41('0xd')];var _0xe76241=_0x568eea?_0x4f5b74['count']:_0x380ee0[_0x7f41('0xd')]+_0x380ee0[_0x7f41('0xf')];var _0xdd9671;if(_0xe76241>=_0x212b28){_0xe76241=_0x212b28;_0xdd9671=0xc8;}else{_0xdd9671=0xce;}_0x513d36['status'](_0xdd9671);return _0x513d36[_0x7f41('0x10')](_0x7f41('0x11'),_0x27c0f6+'-'+_0xe76241+'/'+_0x212b28)['json'](_0x4f5b74);}return null;};}function saveUpdates(_0x98210f){return function(_0x473f41){if(_0x473f41){return _0x473f41[_0x7f41('0x12')](_0x98210f)['then'](function(_0x3f6b61){return _0x3f6b61;});}return null;};}function removeEntity(_0x58c86e){return function(_0x503239){if(_0x503239){return _0x503239[_0x7f41('0x13')]()[_0x7f41('0x14')](function(){_0x58c86e[_0x7f41('0xb')](0xcc)[_0x7f41('0xc')]();});}};}function handleEntityNotFound(_0x451efa){return function(_0x3af3f7){if(!_0x3af3f7){_0x451efa['sendStatus'](0x194);}return _0x3af3f7;};}function handleError(_0x5e568d,_0x3e8000){_0x3e8000=_0x3e8000||0x1f4;return function(_0x4c4d12){logger['error'](_0x4c4d12[_0x7f41('0x15')]);if(_0x4c4d12[_0x7f41('0x16')]){delete _0x4c4d12[_0x7f41('0x16')];}_0x5e568d[_0x7f41('0xb')](_0x3e8000)[_0x7f41('0x17')](_0x4c4d12);};}function getInteractionUsers(_0x43b936,_0x39d287){return new BPromise(function(_0x25c42d,_0x4cbee7){try{if(_0x39d287[_0x43b936['id']]){_0x43b936['Users']=_['map'](_0x39d287[_0x43b936['id']],function(_0x51e0f3){return{'id':_0x51e0f3['id'],'fullname':_0x51e0f3[_0x7f41('0x18')]};});}}catch(_0x183ac7){_0x4cbee7(_0x183ac7);}_0x25c42d(_0x43b936);});}function getInteractionTags(_0x55a32a,_0xd0b56c){return new BPromise(function(_0x3d52f7,_0x5b5610){try{if(_0x55a32a['TagIds']){_0x55a32a['Tags']=[];_0x55a32a[_0x7f41('0x19')]['split'](',')['forEach'](function(_0x501076){_0x55a32a[_0x7f41('0x1a')][_0x7f41('0x1b')](_0xd0b56c[_0x501076]);});}delete _0x55a32a['TagIds'];}catch(_0x2b93e4){_0x5b5610(_0x2b93e4);}_0x3d52f7(_0x55a32a);});}function getLastMessageText(_0x2f288e){return new BPromise(function(_0x48a1a5,_0x3be289){return db[_0x7f41('0x1c')][_0x7f41('0x1d')]({'where':{'$and':[{'MailInteractionId':_0x2f288e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0x7f41('0x14')](function(_0x35c91b){if(_0x35c91b&&_0x35c91b[_0x7f41('0x1e')]){_0x2f288e[_0x7f41('0x1f')]=_[_0x7f41('0x20')](_0x35c91b[_0x7f41('0x1e')]);}_0x48a1a5(_0x2f288e);})['catch'](function(_0x1d61a4){_0x3be289(_0x1d61a4);});});}function updateMailInteraction(_0x156853,_0x212170,_0x483f69,_0x4b2332){return new BPromise(function(_0x58394d,_0xf1f9af){return getInteractionUsers(_0x156853,_0x483f69)[_0x7f41('0x14')](function(_0x42fc04){return getInteractionTags(_0x42fc04,_0x212170);})['then'](function(_0x1cb8f1){return getStateInteraction(_0x1cb8f1);})[_0x7f41('0x14')](function(_0x390358){if(_0x4b2332){_0x58394d(getLastMessageText(_0x390358));}else{_0x58394d(_0x390358);}})[_0x7f41('0x21')](function(_0x1a1445){_0xf1f9af(_0x1a1445);});});}function getStateInteraction(_0x354be6){return new BPromise(function(_0x303f1a){_0x354be6[_0x7f41('0x22')]=0x0;_0x354be6['talking']=0x0;_0x354be6[_0x7f41('0x23')]=0x0;_0x354be6[_0x7f41('0x24')]=0x0;_0x354be6[_0x7f41('0x25')]=0x0;if(!_0x354be6[_0x7f41('0x26')]&&!_0x354be6[_0x7f41('0x27')]){_0x354be6[_0x7f41('0x22')]+=0x1;}if(!_0x354be6[_0x7f41('0x26')]&&_0x354be6[_0x7f41('0x27')]){_0x354be6[_0x7f41('0x28')]+=0x1;if(_0x354be6[_0x7f41('0x22')]){_0x354be6[_0x7f41('0x22')]-=0x1;}}if(_0x354be6[_0x7f41('0x26')]&&_0x354be6['UserId']){_0x354be6[_0x7f41('0x23')]+=0x1;if(_0x354be6[_0x7f41('0x28')]){_0x354be6['talking']-=0x1;}}if(_0x354be6[_0x7f41('0x26')]&&!_0x354be6['UserId']){_0x354be6[_0x7f41('0x24')]+=0x1;if(_0x354be6[_0x7f41('0x22')]){_0x354be6[_0x7f41('0x22')]-=0x1;}}_0x354be6['total']+=0x1;_0x303f1a(_0x354be6);});}exports[_0x7f41('0x29')]=function(_0x18ed9a,_0x4a669f){var _0x5896d5={},_0x10da15={},_0x548023={'count':0x0,'rows':[]};var _0x3af652=_[_0x7f41('0x2a')](db[_0x7f41('0x2b')][_0x7f41('0x2c')],function(_0xbd86fd){return{'name':_0xbd86fd[_0x7f41('0x2d')],'type':_0xbd86fd[_0x7f41('0x2e')]['key']};});_0x10da15[_0x7f41('0x2f')]=_[_0x7f41('0x2a')](_0x3af652,_0x7f41('0x16'));_0x10da15[_0x7f41('0x30')]=_[_0x7f41('0x31')](_0x18ed9a[_0x7f41('0x30')]);_0x10da15['filters']=_[_0x7f41('0x32')](_0x10da15[_0x7f41('0x2f')],_0x10da15[_0x7f41('0x30')]);_0x5896d5[_0x7f41('0x33')]=_['intersection'](_0x10da15['model'],qs[_0x7f41('0x34')](_0x18ed9a[_0x7f41('0x30')][_0x7f41('0x34')]));_0x5896d5['attributes']=_0x5896d5[_0x7f41('0x33')][_0x7f41('0x35')]?_0x5896d5['attributes']:_0x10da15[_0x7f41('0x2f')];if(!_0x18ed9a[_0x7f41('0x30')][_0x7f41('0x36')](_0x7f41('0x37'))){_0x5896d5['limit']=qs[_0x7f41('0xf')](_0x18ed9a['query'][_0x7f41('0xf')]);_0x5896d5[_0x7f41('0xd')]=qs[_0x7f41('0xd')](_0x18ed9a[_0x7f41('0x30')]['offset']);}_0x5896d5[_0x7f41('0x38')]=qs[_0x7f41('0x39')](_0x18ed9a[_0x7f41('0x30')]['sort']);_0x5896d5[_0x7f41('0x3a')]=qs['filters'](_['pick'](_0x18ed9a[_0x7f41('0x30')],_0x10da15[_0x7f41('0x3b')]),_0x3af652);var _0x3197e8=[];var _0xdb06d=squel[_0x7f41('0x3c')]()[_0x7f41('0x3d')]('id')[_0x7f41('0x3d')](_0x7f41('0x16'))[_0x7f41('0x3d')](_0x7f41('0x3e'))[_0x7f41('0x3f')](_0x7f41('0x40'));var _0x4ab2ee=squel[_0x7f41('0x3c')]()[_0x7f41('0x3d')](_0x7f41('0x41'))[_0x7f41('0x3d')](_0x7f41('0x42'))[_0x7f41('0x3d')](_0x7f41('0x43'))[_0x7f41('0x3f')](_0x7f41('0x44'),'ui')['left_join'](_0x7f41('0x45'),'u','u.id\x20=\x20ui.UserId');var _0x49ae70=squel[_0x7f41('0x3c')]()[_0x7f41('0x3f')](_0x7f41('0x46'),'i')['left_join'](_0x7f41('0x47'),'c',_0x7f41('0x48'))[_0x7f41('0x49')](_0x7f41('0x45'),'o','o.id\x20=\x20i.UserId')[_0x7f41('0x49')]('mail_accounts','a',_0x7f41('0x4a'))[_0x7f41('0x49')]('mail_messages','me',_0x7f41('0x4b'))[_0x7f41('0x49')](_0x7f41('0x4c'),'it',_0x7f41('0x4d'))['left_join']('tools_tags','t',_0x7f41('0x4e'));var _0x45426d=squel['expr']();var _0x7bbdbe=[];var _0x2a1aa7=squel['expr']();var _0x746573;if(_0x18ed9a[_0x7f41('0x30')]['search']){_0x746573=as['parseSearch'](_0x18ed9a['query']['search']);var _0x91e6a4=_0x746573[_0x7f41('0x4f')];for(var _0x491534=0x0;_0x491534<_0x746573[_0x7f41('0x50')][_0x7f41('0x35')];_0x491534++){var _0xd102d9=_0x746573[_0x7f41('0x50')][_0x491534];var _0x65bfa4='i';var _0x4d62e7=_[_0x7f41('0x51')](_0x3af652,[_0x7f41('0x16'),_0xd102d9[_0x7f41('0x3d')]]);if(!_0x4d62e7){switch(_0xd102d9[_0x7f41('0x3d')]){case _0x7f41('0x52'):if(_0xd102d9['value']==0x1){_0x49ae70[_0x7f41('0x53')]('`'+_0xd102d9[_0x7f41('0x3d')]+'`\x20=\x200');}else{_0x49ae70['having']('`'+_0xd102d9[_0x7f41('0x3d')]+'`\x20>\x200');}break;case _0x7f41('0x54'):if(_0xd102d9[_0x7f41('0x55')]===_0x7f41('0x56')){if(_0xd102d9[_0x7f41('0x57')][_0x7f41('0x58')]('\x20')['length']>0x1){_0x45426d[_0x91e6a4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7f41('0x59')](_0xd102d9[_0x7f41('0x57')]),null);}else{var _0x36915c='%'+_0xd102d9[_0x7f41('0x57')]+'%';_0x45426d[_0x91e6a4](_0x7f41('0x5a'),_0x36915c,_0x36915c,_0x36915c);}}else{_0x4d62e7=_[_0x7f41('0x51')](_0x3af652,['name',_0x7f41('0x5b')]);_0xd102d9[_0x7f41('0x3d')]='ContactId';_0x1e4c06=as[_0x7f41('0x5c')](_0x65bfa4,_0x4d62e7[_0x7f41('0x2e')],_0xd102d9);_0x45426d[_0x91e6a4](_0x1e4c06[_0x7f41('0x5d')],_0x1e4c06[_0x7f41('0x57')]['start'],_0x1e4c06[_0x7f41('0x57')][_0x7f41('0xc')]);}break;case'Tag':var _0x4cdf43=_0xd102d9['value'][_0x7f41('0x58')](',')['map'](function(_0x2934f0){return Number(_0x2934f0);});_0x4cdf43[_0x7f41('0x5e')](function(_0x550d37){_0x2a1aa7['or'](_0x7f41('0x5f'),'%,'+_0x550d37+',%');});_0x7bbdbe=_['union'](_0x7bbdbe,_0x4cdf43);break;case'User':if(_0xd102d9[_0x7f41('0x55')]===_0x7f41('0x56')){_0x45426d[_0x91e6a4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xd102d9[_0x7f41('0x57')]+'%',null);}else{_0x4d62e7=_[_0x7f41('0x51')](_0x3af652,[_0x7f41('0x16'),'UserId']);_0xd102d9[_0x7f41('0x3d')]=_0x7f41('0x27');_0x1e4c06=as[_0x7f41('0x5c')](_0x65bfa4,_0x4d62e7[_0x7f41('0x2e')],_0xd102d9);_0x45426d[_0x91e6a4](_0x1e4c06[_0x7f41('0x5d')],_0x1e4c06[_0x7f41('0x57')][_0x7f41('0x60')],_0x1e4c06[_0x7f41('0x57')][_0x7f41('0xc')]);}break;case _0x7f41('0x1e'):_0x1e4c06=as[_0x7f41('0x5c')]('me',null,_0xd102d9);_0x45426d[_0x91e6a4](_0x1e4c06[_0x7f41('0x5d')],_0x1e4c06[_0x7f41('0x57')][_0x7f41('0x60')],_0x1e4c06[_0x7f41('0x57')][_0x7f41('0xc')]);break;}}else{var _0x1e4c06=as[_0x7f41('0x5c')](_0x65bfa4,_0x4d62e7['type'],_0xd102d9);_0x45426d[_0x91e6a4](_0x1e4c06[_0x7f41('0x5d')],_0x1e4c06['value']['start'],_0x1e4c06[_0x7f41('0x57')][_0x7f41('0xc')]);}}}else{var _0x4c4059=_(_0x18ed9a[_0x7f41('0x30')])[_0x7f41('0x31')]()[_0x7f41('0x2a')](function(_0x46c0b8){return _['some'](_0x3af652,[_0x7f41('0x16'),_0x46c0b8])?_0x46c0b8:undefined;})['compact']()['value']();if(!_[_0x7f41('0x61')](_0x4c4059)){_0x4c4059[_0x7f41('0x5e')](function(_0x3279d9){if(_0x3279d9===_0x7f41('0x62')){_0x49ae70[_0x7f41('0x3a')](_0x7f41('0x63'),[][_0x7f41('0x64')](_0x18ed9a['query'][_0x3279d9]));}else if(_0x3279d9==='createdAt'){var _0x2ecbeb=JSON[_0x7f41('0x65')](_0x18ed9a[_0x7f41('0x30')][_0x3279d9])[_0x7f41('0x66')];var _0x431fe6=JSON[_0x7f41('0x65')](_0x18ed9a[_0x7f41('0x30')][_0x3279d9])[_0x7f41('0x67')];_0x49ae70[_0x7f41('0x3a')](_0x7f41('0x68'),_0x2ecbeb,_0x431fe6);}else{if(_0x18ed9a['query'][_0x3279d9]==='null'){_0x49ae70[_0x7f41('0x3a')]('i.'+_0x3279d9+'\x20IS\x20NULL');}else{_0x49ae70[_0x7f41('0x3a')]('i.'+_0x3279d9+_0x7f41('0x69'),_0x18ed9a[_0x7f41('0x30')][_0x3279d9]);}}});}if(_0x18ed9a['query'][_0x7f41('0x6a')]){if(_0x18ed9a['query'][_0x7f41('0x6a')]==0x1){_0x49ae70['having'](_0x7f41('0x6b'));}else{_0x49ae70[_0x7f41('0x53')](_0x7f41('0x6c'));}}if(_0x18ed9a[_0x7f41('0x30')][_0x7f41('0x6d')]){_0x7bbdbe=_['isArray'](_0x18ed9a[_0x7f41('0x30')]['tag'])?_0x18ed9a[_0x7f41('0x30')][_0x7f41('0x6d')]:new Array(_0x18ed9a[_0x7f41('0x30')][_0x7f41('0x6d')]);_0x7bbdbe[_0x7f41('0x5e')](function(_0x2d347d){_0x2a1aa7['or'](_0x7f41('0x5f'),'%,'+_0x2d347d+',%');});}if(_0x18ed9a[_0x7f41('0x30')][_0x7f41('0x6e')]){var _0x3c1c85=_0x18ed9a[_0x7f41('0x30')]['filter'][_0x7f41('0x6f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7f41('0x70')](_0x3c1c85)){_0x45426d['or'](_0x7f41('0x71'),_0x3c1c85+'%');}else if(qs['isEmail'](_0x3c1c85)){_0x45426d['or'](_0x7f41('0x72'),_0x3c1c85+'%');}else{_0x45426d['or'](_0x7f41('0x73'),qs['getFullTextValue'](_0x3c1c85))['or'](_0x7f41('0x74'),qs[_0x7f41('0x59')](_0x3c1c85));}}}_0x49ae70[_0x7f41('0x3a')](_0x45426d);_0x49ae70['group'](_0x7f41('0x75'));var _0x269f2c={'type':db['Sequelize']['QueryTypes'][_0x7f41('0x76')],'raw':!![]};var _0x40fcf2=_0x49ae70['clone']();_0x40fcf2[_0x7f41('0x3d')](_0x7f41('0x75'));_0x40fcf2['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7f41('0x52'));if(_0x5896d5[_0x7f41('0x38')]){_0x5896d5['order'][_0x7f41('0x5e')](function(_0x4e0060){var _0x2748d1=_0x4e0060[0x0]===_0x7f41('0x77')?_0x4e0060[0x0]:'i.'+_0x4e0060[0x0];_0x49ae70[_0x7f41('0x38')](_0x2748d1,_0x4e0060[0x1]===_0x7f41('0x78')?![]:!![]);});}if(!_[_0x7f41('0x61')](_0x7bbdbe)){_0x49ae70['having'](_0x2a1aa7);_0x40fcf2[_0x7f41('0x3a')](_0x7f41('0x79'),_0x7bbdbe);}BPromise[_0x7f41('0x7a')]()[_0x7f41('0x14')](function(){if(!_0x746573){if(_0x18ed9a[_0x7f41('0x30')][_0x7f41('0x62')])return;_0x40fcf2[_0x7f41('0x3a')](_0x7f41('0x7b'));_0x49ae70['where'](_0x7f41('0x7b'));return;}if(_0x18ed9a[_0x7f41('0x7c')][_0x7f41('0x7d')]!==_0x7f41('0x7e'))return;return _0x18ed9a['user'][_0x7f41('0x7f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x267100){if(_[_0x7f41('0x61')](_0x267100)){_0x40fcf2[_0x7f41('0x3a')](_0x7f41('0x80'));_0x49ae70['where'](_0x7f41('0x80'));}else{_0x40fcf2['where'](_0x7f41('0x63'),_[_0x7f41('0x2a')](_0x267100,'id'));_0x49ae70[_0x7f41('0x3a')](_0x7f41('0x63'),_[_0x7f41('0x2a')](_0x267100,'id'));}});})[_0x7f41('0x14')](function(){if(_0x18ed9a['user'][_0x7f41('0x7d')]===_0x7f41('0x7e')&&!_0x746573&&!_0x18ed9a[_0x7f41('0x30')]['MailAccountId'])return[];return db[_0x7f41('0x81')]['query'](_0x40fcf2['toString'](),_0x269f2c);})[_0x7f41('0x14')](function(_0x2e5a88){_0x548023[_0x7f41('0x82')]=_0x2e5a88[_0x7f41('0x35')];if(_0x548023[_0x7f41('0x82')]===0x0)return[];return db['sequelize'][_0x7f41('0x30')](_0xdb06d[_0x7f41('0x83')](),_0x269f2c)[_0x7f41('0x14')](function(_0x533045){_0x3197e8=_[_0x7f41('0x84')](_0x533045,'id');_0x269f2c=_[_0x7f41('0x85')](_0x269f2c,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18ed9a[_0x7f41('0x30')][_0x7f41('0x34')]){_0x5896d5[_0x7f41('0x33')][_0x7f41('0x5e')](function(_0x41f3d8){_0x49ae70['field']('i.'+_0x41f3d8);});}else{_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x86'),'unreadMessages');_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x87'),_0x7f41('0x88'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x89'),_0x7f41('0x8a'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x8b'),'contactName');_0x49ae70['field'](_0x7f41('0x75'));_0x49ae70['field'](_0x7f41('0x8c'));_0x49ae70['field']('i.updatedAt');_0x49ae70['field']('i.closed');_0x49ae70[_0x7f41('0x3d')]('i.closedAt');_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x8d'));_0x49ae70['field'](_0x7f41('0x8e'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x8f'));_0x49ae70['field'](_0x7f41('0x90'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x91'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x92'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x93'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x94'));_0x49ae70[_0x7f41('0x3d')]('i.to');_0x49ae70['field']('i.ContactId');_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x95'));_0x49ae70[_0x7f41('0x3d')]('i.UserId');_0x49ae70[_0x7f41('0x3d')]('c.firstName','Contact.firstName');_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x96'),_0x7f41('0x97'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x98'),'Contact.email');_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x99'),_0x7f41('0x9a'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x9b'),_0x7f41('0x9c'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0x9d'),'Contact.fax');_0x49ae70['field'](_0x7f41('0x9e'),_0x7f41('0x9f'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0xa0'),_0x7f41('0xa1'));_0x49ae70[_0x7f41('0x3d')](_0x7f41('0xa2'),_0x7f41('0x19'));}if(_0x5896d5[_0x7f41('0xf')])_0x49ae70['limit'](_0x5896d5[_0x7f41('0xf')]);if(_0x5896d5[_0x7f41('0xd')])_0x49ae70[_0x7f41('0xd')](_0x5896d5[_0x7f41('0xd')]);return db[_0x7f41('0x81')][_0x7f41('0x30')](_0x49ae70[_0x7f41('0x83')](),_0x269f2c);})[_0x7f41('0x14')](function(_0x4b270d){if(_0x4b270d[_0x7f41('0x35')]>0x0)_0x4ab2ee['where']('ui.MailInteractionId\x20IN\x20?',_[_0x7f41('0x2a')](_0x4b270d,'id'));return db[_0x7f41('0x81')][_0x7f41('0x30')](_0x4ab2ee['toString'](),_0x269f2c)[_0x7f41('0x14')](function(_0x2d0e77){var _0x25be17=_[_0x7f41('0xa3')](_0x2d0e77,_0x7f41('0xa4'));var _0x34ec52=[];return db[_0x7f41('0xa5')]['findOne']({'attributes':[_0x7f41('0xa6')],'raw':!![]})['then'](function(_0x5e2d1a){var _0x127ef9=_0x5e2d1a[_0x7f41('0xa6')];_0x4b270d['forEach'](function(_0x260d9f){_0x34ec52[_0x7f41('0x1b')](updateMailInteraction(_0x260d9f,_0x3197e8,_0x25be17,_0x127ef9));});return BPromise[_0x7f41('0xa7')](_0x34ec52);});});});})[_0x7f41('0x14')](function(_0x2719cd){_0x548023[_0x7f41('0xa8')]=_0x2719cd;return _0x548023;})['then'](respondWithFilteredResult(_0x4a669f,_0x5896d5))[_0x7f41('0x21')](handleError(_0x4a669f,null));};exports[_0x7f41('0xa9')]=function(_0x25d472,_0x14784f){var _0x4046cd={'raw':![],'where':{'id':_0x25d472[_0x7f41('0xaa')]['id']}},_0x288657={};_0x288657[_0x7f41('0x2f')]=_[_0x7f41('0x31')](db[_0x7f41('0x2b')][_0x7f41('0x2c')]);_0x288657['query']=_[_0x7f41('0x31')](_0x25d472[_0x7f41('0x30')]);_0x288657['filters']=_['intersection'](_0x288657[_0x7f41('0x2f')],_0x288657[_0x7f41('0x30')]);_0x4046cd['attributes']=_['intersection'](_0x288657[_0x7f41('0x2f')],qs[_0x7f41('0x34')](_0x25d472[_0x7f41('0x30')][_0x7f41('0x34')]));_0x4046cd['attributes']=_0x4046cd[_0x7f41('0x33')][_0x7f41('0x35')]?_0x4046cd[_0x7f41('0x33')]:_0x288657[_0x7f41('0x2f')];if(_0x25d472['query'][_0x7f41('0xab')]){_0x4046cd['include']=[{'all':!![]}];}_0x4046cd=_[_0x7f41('0x85')]({},_0x4046cd,_0x25d472['options']);return db[_0x7f41('0x2b')]['find'](_0x4046cd)[_0x7f41('0x14')](handleEntityNotFound(_0x14784f,null))[_0x7f41('0x14')](respondWithResult(_0x14784f,null))[_0x7f41('0x21')](handleError(_0x14784f,null));};exports['create']=function(_0x58a431,_0x2c0467){return db[_0x7f41('0x2b')][_0x7f41('0xac')](_0x58a431[_0x7f41('0xad')],{})['then'](respondWithResult(_0x2c0467,0xc9))[_0x7f41('0x21')](handleError(_0x2c0467,null));};exports['update']=function(_0x4bec4b,_0x361a04){if(_0x4bec4b[_0x7f41('0xad')]['id']){delete _0x4bec4b[_0x7f41('0xad')]['id'];}return db[_0x7f41('0x2b')][_0x7f41('0x51')]({'where':{'id':_0x4bec4b[_0x7f41('0xaa')]['id']}})[_0x7f41('0x14')](handleEntityNotFound(_0x361a04,null))[_0x7f41('0x14')](saveUpdates(_0x4bec4b[_0x7f41('0xad')],null))[_0x7f41('0x14')](respondWithResult(_0x361a04,null))[_0x7f41('0x21')](handleError(_0x361a04,null));};exports[_0x7f41('0x13')]=function(_0x240cdb,_0x568801){return db[_0x7f41('0x2b')][_0x7f41('0x51')]({'where':{'id':_0x240cdb['params']['id']}})['then'](handleEntityNotFound(_0x568801,null))[_0x7f41('0x14')](removeEntity(_0x568801,null))[_0x7f41('0x21')](handleError(_0x568801,null));};exports[_0x7f41('0xae')]=function(_0x21b76a,_0x5be25e){return db['MailInteraction'][_0x7f41('0xae')]()[_0x7f41('0x14')](respondWithResult(_0x5be25e,null))[_0x7f41('0x21')](handleError(_0x5be25e,null));};exports[_0x7f41('0xaf')]=function(_0x18df0c,_0x3c50ad){return db[_0x7f41('0x1c')][_0x7f41('0x51')]({'where':{'id':_0x18df0c[_0x7f41('0xaa')]['id']}})['then'](handleEntityNotFound(_0x3c50ad,null))['then'](function(_0x3aff11){if(_0x3aff11){return _0x3aff11[_0x7f41('0xaf')](_0x18df0c[_0x7f41('0xad')][_0x7f41('0xb0')],_['omit'](_0x18df0c[_0x7f41('0xad')],['ids','id'])||{});}})[_0x7f41('0x14')](respondWithResult(_0x3c50ad,null))[_0x7f41('0x21')](handleError(_0x3c50ad,null));};exports[_0x7f41('0xb1')]=function(_0x43d20d,_0x10d55d){var _0x7ee0c2={'raw':![],'where':{}};var _0x42790d={};var _0x3e176b={'count':0x0,'rows':[]};return db[_0x7f41('0x2b')][_0x7f41('0x1d')]({'where':{'id':_0x43d20d[_0x7f41('0xaa')]['id']}})[_0x7f41('0x14')](handleEntityNotFound(_0x10d55d,null))['then'](function(_0x53345e){if(_0x53345e){_0x42790d[_0x7f41('0x2f')]=_[_0x7f41('0x31')](db[_0x7f41('0x1c')][_0x7f41('0x2c')]);_0x42790d[_0x7f41('0x30')]=_[_0x7f41('0x31')](_0x43d20d[_0x7f41('0x30')]);_0x42790d[_0x7f41('0x3b')]=_[_0x7f41('0x32')](_0x42790d[_0x7f41('0x2f')],_0x42790d[_0x7f41('0x30')]);_0x7ee0c2[_0x7f41('0x33')]=_[_0x7f41('0x32')](_0x42790d[_0x7f41('0x2f')],qs[_0x7f41('0x34')](_0x43d20d[_0x7f41('0x30')][_0x7f41('0x34')]));_0x7ee0c2[_0x7f41('0x33')]=_0x7ee0c2[_0x7f41('0x33')][_0x7f41('0x35')]?_0x7ee0c2[_0x7f41('0x33')]:_0x42790d[_0x7f41('0x2f')];if(!_0x43d20d[_0x7f41('0x30')]['hasOwnProperty'](_0x7f41('0x37'))){_0x7ee0c2[_0x7f41('0xf')]=qs[_0x7f41('0xf')](_0x43d20d[_0x7f41('0x30')][_0x7f41('0xf')]);_0x7ee0c2[_0x7f41('0xd')]=qs[_0x7f41('0xd')](_0x43d20d[_0x7f41('0x30')][_0x7f41('0xd')]);}_0x7ee0c2[_0x7f41('0x38')]=qs[_0x7f41('0x39')](_0x43d20d[_0x7f41('0x30')][_0x7f41('0x39')]);_0x7ee0c2[_0x7f41('0x3a')]=qs['filters'](_[_0x7f41('0xb2')](_0x43d20d[_0x7f41('0x30')],_0x42790d[_0x7f41('0x3b')]));_0x7ee0c2[_0x7f41('0x3a')][_0x7f41('0xa4')]=_0x53345e['id'];if(_0x43d20d[_0x7f41('0x30')]['filter']){_0x7ee0c2[_0x7f41('0x3a')]=_['merge'](_0x7ee0c2[_0x7f41('0x3a')],{'$or':_['map'](_0x7ee0c2[_0x7f41('0x33')],function(_0x4007fb){var _0x58c415={};_0x58c415[_0x4007fb]={'$like':'%'+_0x43d20d[_0x7f41('0x30')][_0x7f41('0x6e')]+'%'};return _0x58c415;})});}if(_0x43d20d['query'][_0x7f41('0x66')]){var _0x4a3792=_0x43d20d[_0x7f41('0x30')]['$gte']['split'](',');var _0x3619a2={};_0x3619a2[_0x4a3792[0x0]]={'$gte':moment(_0x4a3792[0x1])[_0x7f41('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7ee0c2['where']=_[_0x7f41('0x85')](_0x7ee0c2['where'],_0x3619a2);}_0x7ee0c2=_[_0x7f41('0x85')]({},_0x7ee0c2,_0x43d20d[_0x7f41('0xb4')]);return db[_0x7f41('0x1c')][_0x7f41('0x82')]({'where':_0x7ee0c2['where']})[_0x7f41('0x14')](function(_0xb70d27){_0x3e176b[_0x7f41('0x82')]=_0xb70d27;if(_0x43d20d[_0x7f41('0x30')][_0x7f41('0xab')]){_0x7ee0c2['include']=[{'all':!![]}];}return db[_0x7f41('0x1c')][_0x7f41('0xb5')](_0x7ee0c2);})[_0x7f41('0x14')](function(_0x1ad8cd){if(_0x43d20d[_0x7f41('0x30')][_0x7f41('0xb6')]==='true'){for(var _0x3a851f=0x0;_0x3a851f<_0x1ad8cd[_0x7f41('0x35')];_0x3a851f++){_0x1ad8cd[_0x3a851f][_0x7f41('0xad')]=juice(_0x1ad8cd[_0x3a851f][_0x7f41('0xad')]);}}_0x3e176b[_0x7f41('0xa8')]=_0x1ad8cd;return _0x3e176b;});}})[_0x7f41('0x14')](respondWithFilteredResult(_0x10d55d,_0x7ee0c2))['catch'](handleError(_0x10d55d,null));};exports[_0x7f41('0xb7')]=function(_0x351991,_0x50ef09){return db[_0x7f41('0x2b')][_0x7f41('0x51')]({'where':{'id':_0x351991['params']['id']}})[_0x7f41('0x14')](handleEntityNotFound(_0x50ef09,null))[_0x7f41('0x14')](function(_0xabcb4f){if(_0xabcb4f){return _0xabcb4f[_0x7f41('0xb8')](_0x351991[_0x7f41('0xad')][_0x7f41('0xb0')],_['omit'](_0x351991['body'],[_0x7f41('0xb0'),'id'])||{})[_0x7f41('0xb9')](function(){return db['Tag'][_0x7f41('0xb5')]({'attributes':['id',_0x7f41('0x16'),_0x7f41('0x3e')],'where':{'id':_0x351991[_0x7f41('0xad')][_0x7f41('0xb0')]}});})[_0x7f41('0x14')](function(_0x383f12){socket[_0x7f41('0xba')](_0x7f41('0xbb'),{'id':Number(_0x351991['params']['id']),'tags':_0x383f12||[]});return{'id':Number(_0x351991[_0x7f41('0xaa')]['id']),'tags':_0x383f12||[]};});}})['then'](respondWithResult(_0x50ef09,null))[_0x7f41('0x21')](handleError(_0x50ef09,null));};exports[_0x7f41('0xbc')]=function(_0x238e7a,_0x3140af){return db[_0x7f41('0x2b')]['find']({'where':{'id':_0x238e7a[_0x7f41('0xaa')]['id']}})['then'](handleEntityNotFound(_0x3140af,null))[_0x7f41('0x14')](function(_0x31c44e){if(_0x31c44e){return _0x31c44e['removeTags'](_0x238e7a[_0x7f41('0x30')][_0x7f41('0xb0')]);}})[_0x7f41('0x14')](respondWithStatusCode(_0x3140af,null))[_0x7f41('0x21')](handleError(_0x3140af,null));};exports['download']=function(_0x1fbd54,_0x3d2398){var _0x42f178=moment()[_0x7f41('0xbd')]()[_0x7f41('0x83')]();var _0x35a5c6=path[_0x7f41('0xbe')](config[_0x7f41('0xbf')],'server','files',_0x7f41('0xc0'));var _0x31631b=path['join'](config['root'],'server',_0x7f41('0xc1'),'attachments');var _0x5465ea=path['join'](_0x35a5c6,_0x42f178);var _0x491e40=util[_0x7f41('0xb3')](_0x7f41('0xc2'),_0x1fbd54[_0x7f41('0xaa')]['id'],_0x42f178);var _0x31b6b7=path[_0x7f41('0xbe')](_0x35a5c6,_0x491e40);var _0x19fbd7=[];if(_0x1fbd54[_0x7f41('0x30')]['attachments']){_0x19fbd7[_0x7f41('0x1b')]({'model':db[_0x7f41('0xc3')],'as':_0x7f41('0xc4'),'raw':!![]});}var _0x4856ba=[{'model':db[_0x7f41('0x1c')],'as':_0x7f41('0xc5'),'attributes':['id','body',_0x7f41('0x3f'),'to','cc',_0x7f41('0xc6'),_0x7f41('0xc7'),_0x7f41('0xc8')],'where':{'secret':![]},'order':qs[_0x7f41('0x39')]('id'),'include':_0x19fbd7}];return db[_0x7f41('0x2b')][_0x7f41('0x51')]({'where':{'id':_0x1fbd54['params']['id']},'include':_0x4856ba})[_0x7f41('0x14')](handleEntityNotFound(_0x3d2398,null))[_0x7f41('0x14')](function(_0x3273b9){if(_0x3273b9&&_0x3273b9[_0x7f41('0xc5')]){var _0xe35731=_0x3273b9[_0x7f41('0xc9')]({'plain':!![]});fs[_0x7f41('0xca')](_0x5465ea);return BPromise[_0x7f41('0xcb')](_0xe35731[_0x7f41('0xc5')],function(_0xaa9e26,_0x12f780){var _0x55337e={'from':_0xaa9e26[_0x7f41('0x3f')],'to':_0xaa9e26['to'],'subject':_0xaa9e26['subject'],'html':htmlEntities[_0x7f41('0xcc')](_0xaa9e26[_0x7f41('0xad')]),'headers':{'Date':moment(_0xaa9e26[_0x7f41('0xc8')])[_0x7f41('0xb3')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xaa9e26['cc']){_0x55337e[_0x7f41('0xcd')]['Cc']=_0xaa9e26['cc'];}if(_0xaa9e26[_0x7f41('0xc6')]){_0x55337e[_0x7f41('0xcd')][_0x7f41('0xce')]=_0xaa9e26[_0x7f41('0xc6')];}return new BPromise(function(_0x2aa025,_0x48b3a3){if(_0xaa9e26[_0x7f41('0xc4')]){for(var _0x50ea75=0x0;_0x50ea75<_0xaa9e26['Attachments'][_0x7f41('0x35')];_0x50ea75++){var _0x27a817=_0xaa9e26[_0x7f41('0xc4')][_0x50ea75];var _0x24dd93=path['join'](_0x31631b,_0x27a817['basename']);if(fs[_0x7f41('0xcf')](_0x24dd93)){_0x55337e[_0x7f41('0xd0')]['push']({'name':_0x27a817[_0x7f41('0x16')],'contentType':_0x27a817['type'],'data':fs[_0x7f41('0xd1')](_0x24dd93)});}}}emlformat['build'](_0x55337e,function(_0x3aca86,_0x435c67){if(_0x3aca86)return _0x48b3a3(_0x3aca86);fs['writeFileSync'](path[_0x7f41('0xbe')](_0x5465ea,util[_0x7f41('0xb3')](_0x7f41('0xd2'),_0x12f780)),_0x435c67);return _0x2aa025(_0x435c67);});});})[_0x7f41('0x14')](function(){return new BPromise(function(_0x52fc09,_0x2f60a9){zipdir(_0x5465ea,{'saveTo':_0x31b6b7},function(_0x37322c,_0x39cb50){if(_0x37322c)return _0x2f60a9(_0x37322c);return _0x52fc09(_0x39cb50);});})['then'](function(){return new BPromise(function(_0x354336,_0x5d96a1){rimraf(_0x5465ea,function(_0x5cc8a1){if(_0x5cc8a1)_0x5d96a1(_0x5cc8a1);return _0x354336();});});})[_0x7f41('0x14')](function(){return _0x3d2398[_0x7f41('0xd3')](_0x31b6b7,_0x491e40,function(_0x4761c0){if(!_0x4761c0)fs[_0x7f41('0xd4')](_0x31b6b7);});});});}else{return _0x3d2398[_0x7f41('0xa')](0xc8);}})[_0x7f41('0x21')](handleError(_0x3d2398,null));}; \ No newline at end of file +var _0x254a=['toString','keyBy','merge','MailInteraction','unreadMessages','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.lastMsgDirection','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','push','rows','show','params','rawAttributes','includeAll','include','options','create','body','describe','addMessage','ids','omit','getMessages','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Messages','subject','each','headers','bcc','Bcc','Attachments','basename','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','html-entities','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','stack','name','map','fullname','TagIds','split','forEach','Tags','MailMessage','findOne','out','plainBody','-id','trimStart','catch','waiting','talking','total','closed','answered','UserId','unmanaged','index','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','where','pick','field','color','from','tools_tags','select','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','user','agent'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x254a,0x138));var _0xa254=function(_0x1168c2,_0x1ed2ce){_0x1168c2=_0x1168c2-0x0;var _0x5ab8b5=_0x254a[_0x1168c2];return _0x5ab8b5;};'use strict';var emlformat=require(_0xa254('0x0'));var rimraf=require(_0xa254('0x1'));var zipdir=require(_0xa254('0x2'));var moment=require('moment');var BPromise=require(_0xa254('0x3'));var util=require(_0xa254('0x4'));var path=require(_0xa254('0x5'));var fs=require('fs');var _=require(_0xa254('0x6'));var squel=require('squel');var juice=require(_0xa254('0x7'));var Redis=require('ioredis');var qs=require(_0xa254('0x8'));var as=require(_0xa254('0x9'));var logger=require(_0xa254('0xa'))('api');var config=require('../../config/environment');var db=require(_0xa254('0xb'))['db'];var htmlEntities=require(_0xa254('0xc'));config['redis']=_[_0xa254('0xd')](config['redis'],{'host':_0xa254('0xe'),'port':0x18eb});var socket=require(_0xa254('0xf'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xa254('0x10')](socket);function respondWithStatusCode(_0x2a4519,_0x45d83b){_0x45d83b=_0x45d83b||0xcc;return function(_0x9fbdfa){if(_0x9fbdfa){return _0x2a4519[_0xa254('0x11')](_0x45d83b);}return _0x2a4519['status'](_0x45d83b)[_0xa254('0x12')]();};}function respondWithResult(_0x5b5f73,_0x4a2b59){_0x4a2b59=_0x4a2b59||0xc8;return function(_0x264548){if(_0x264548){return _0x5b5f73[_0xa254('0x13')](_0x4a2b59)['json'](_0x264548);}};}function respondWithFilteredResult(_0x22c469,_0x46322b){return function(_0x3f6cc5){if(_0x3f6cc5){var _0x1d8ee5=typeof _0x46322b[_0xa254('0x14')]==='undefined'&&typeof _0x46322b[_0xa254('0x15')]===_0xa254('0x16');var _0x7532b7=_0x3f6cc5[_0xa254('0x17')];var _0x37586e=_0x1d8ee5?0x0:_0x46322b[_0xa254('0x14')];var _0x42af14=_0x1d8ee5?_0x3f6cc5[_0xa254('0x17')]:_0x46322b[_0xa254('0x14')]+_0x46322b['limit'];var _0x547205;if(_0x42af14>=_0x7532b7){_0x42af14=_0x7532b7;_0x547205=0xc8;}else{_0x547205=0xce;}_0x22c469['status'](_0x547205);return _0x22c469[_0xa254('0x18')](_0xa254('0x19'),_0x37586e+'-'+_0x42af14+'/'+_0x7532b7)[_0xa254('0x1a')](_0x3f6cc5);}return null;};}function saveUpdates(_0x2ae27a){return function(_0x353588){if(_0x353588){return _0x353588[_0xa254('0x1b')](_0x2ae27a)[_0xa254('0x1c')](function(_0x4d82f9){return _0x4d82f9;});}return null;};}function removeEntity(_0x428f30){return function(_0x521a34){if(_0x521a34){return _0x521a34[_0xa254('0x1d')]()[_0xa254('0x1c')](function(){_0x428f30['status'](0xcc)[_0xa254('0x12')]();});}};}function handleEntityNotFound(_0x3288b9){return function(_0x53f908){if(!_0x53f908){_0x3288b9['sendStatus'](0x194);}return _0x53f908;};}function handleError(_0x34c7c4,_0xba5a72){_0xba5a72=_0xba5a72||0x1f4;return function(_0x317a82){logger['error'](_0x317a82[_0xa254('0x1e')]);if(_0x317a82[_0xa254('0x1f')]){delete _0x317a82[_0xa254('0x1f')];}_0x34c7c4['status'](_0xba5a72)['send'](_0x317a82);};}function getInteractionUsers(_0xe734d5,_0xcbf8c4){return new BPromise(function(_0x3c2a25,_0x413016){try{if(_0xcbf8c4[_0xe734d5['id']]){_0xe734d5['Users']=_[_0xa254('0x20')](_0xcbf8c4[_0xe734d5['id']],function(_0xdd8c94){return{'id':_0xdd8c94['id'],'fullname':_0xdd8c94[_0xa254('0x21')]};});}}catch(_0x31201b){_0x413016(_0x31201b);}_0x3c2a25(_0xe734d5);});}function getInteractionTags(_0x3e3041,_0x26de45){return new BPromise(function(_0x105bb0,_0xbdef22){try{if(_0x3e3041[_0xa254('0x22')]){_0x3e3041['Tags']=[];_0x3e3041[_0xa254('0x22')][_0xa254('0x23')](',')[_0xa254('0x24')](function(_0x135cf3){_0x3e3041[_0xa254('0x25')]['push'](_0x26de45[_0x135cf3]);});}delete _0x3e3041[_0xa254('0x22')];}catch(_0x102a58){_0xbdef22(_0x102a58);}_0x105bb0(_0x3e3041);});}function getLastMessageText(_0x4dfdc3){return new BPromise(function(_0x72f25a,_0x5c7836){return db[_0xa254('0x26')][_0xa254('0x27')]({'where':{'$and':[{'MailInteractionId':_0x4dfdc3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xa254('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xa254('0x29')],'order':_0xa254('0x2a'),'raw':!![]})[_0xa254('0x1c')](function(_0x4400a7){if(_0x4400a7&&_0x4400a7[_0xa254('0x29')]){_0x4dfdc3['lastMsgText']=_[_0xa254('0x2b')](_0x4400a7[_0xa254('0x29')]);}_0x72f25a(_0x4dfdc3);})[_0xa254('0x2c')](function(_0x63f742){_0x5c7836(_0x63f742);});});}function updateMailInteraction(_0x4837a8,_0x3cef45,_0x3c7cd5,_0x32e66e){return new BPromise(function(_0x50184d,_0x324759){return getInteractionUsers(_0x4837a8,_0x3c7cd5)[_0xa254('0x1c')](function(_0x30735d){return getInteractionTags(_0x30735d,_0x3cef45);})['then'](function(_0xcc8b6f){return getStateInteraction(_0xcc8b6f);})[_0xa254('0x1c')](function(_0x1ba1b4){if(_0x32e66e){_0x50184d(getLastMessageText(_0x1ba1b4));}else{_0x50184d(_0x1ba1b4);}})[_0xa254('0x2c')](function(_0xf54c59){_0x324759(_0xf54c59);});});}function getStateInteraction(_0x667f32){return new BPromise(function(_0x1f37df){_0x667f32[_0xa254('0x2d')]=0x0;_0x667f32[_0xa254('0x2e')]=0x0;_0x667f32['answered']=0x0;_0x667f32['unmanaged']=0x0;_0x667f32[_0xa254('0x2f')]=0x0;if(!_0x667f32[_0xa254('0x30')]&&!_0x667f32['UserId']){_0x667f32[_0xa254('0x2d')]+=0x1;}if(!_0x667f32['closed']&&_0x667f32['UserId']){_0x667f32[_0xa254('0x2e')]+=0x1;if(_0x667f32[_0xa254('0x2d')]){_0x667f32[_0xa254('0x2d')]-=0x1;}}if(_0x667f32[_0xa254('0x30')]&&_0x667f32['UserId']){_0x667f32[_0xa254('0x31')]+=0x1;if(_0x667f32[_0xa254('0x2e')]){_0x667f32[_0xa254('0x2e')]-=0x1;}}if(_0x667f32[_0xa254('0x30')]&&!_0x667f32[_0xa254('0x32')]){_0x667f32[_0xa254('0x33')]+=0x1;if(_0x667f32[_0xa254('0x2d')]){_0x667f32[_0xa254('0x2d')]-=0x1;}}_0x667f32[_0xa254('0x2f')]+=0x1;_0x1f37df(_0x667f32);});}exports[_0xa254('0x34')]=function(_0x3f0bdc,_0x37c4d0){var _0x1b0b72={},_0x543aaf={},_0x4d267c={'count':0x0,'rows':[]};var _0xd29d9e=_[_0xa254('0x20')](db['MailInteraction']['rawAttributes'],function(_0x39f63e){return{'name':_0x39f63e[_0xa254('0x35')],'type':_0x39f63e[_0xa254('0x36')][_0xa254('0x37')]};});_0x543aaf[_0xa254('0x38')]=_[_0xa254('0x20')](_0xd29d9e,_0xa254('0x1f'));_0x543aaf['query']=_[_0xa254('0x39')](_0x3f0bdc[_0xa254('0x3a')]);_0x543aaf[_0xa254('0x3b')]=_[_0xa254('0x3c')](_0x543aaf[_0xa254('0x38')],_0x543aaf[_0xa254('0x3a')]);_0x1b0b72['attributes']=_[_0xa254('0x3c')](_0x543aaf[_0xa254('0x38')],qs[_0xa254('0x3d')](_0x3f0bdc[_0xa254('0x3a')][_0xa254('0x3d')]));_0x1b0b72[_0xa254('0x3e')]=_0x1b0b72[_0xa254('0x3e')][_0xa254('0x3f')]?_0x1b0b72[_0xa254('0x3e')]:_0x543aaf[_0xa254('0x38')];if(!_0x3f0bdc[_0xa254('0x3a')]['hasOwnProperty']('nolimit')){_0x1b0b72[_0xa254('0x15')]=qs[_0xa254('0x15')](_0x3f0bdc[_0xa254('0x3a')]['limit']);_0x1b0b72[_0xa254('0x14')]=qs['offset'](_0x3f0bdc[_0xa254('0x3a')][_0xa254('0x14')]);}_0x1b0b72[_0xa254('0x40')]=qs['sort'](_0x3f0bdc[_0xa254('0x3a')]['sort']);_0x1b0b72[_0xa254('0x41')]=qs[_0xa254('0x3b')](_[_0xa254('0x42')](_0x3f0bdc[_0xa254('0x3a')],_0x543aaf[_0xa254('0x3b')]),_0xd29d9e);var _0x583248=[];var _0x3487b0=squel['select']()[_0xa254('0x43')]('id')[_0xa254('0x43')]('name')[_0xa254('0x43')](_0xa254('0x44'))[_0xa254('0x45')](_0xa254('0x46'));var _0x2ee25a=squel[_0xa254('0x47')]()[_0xa254('0x43')](_0xa254('0x48'))['field']('u.fullname')['field'](_0xa254('0x49'))['from'](_0xa254('0x4a'),'ui')[_0xa254('0x4b')]('users','u',_0xa254('0x4c'));var _0x51efe9=squel[_0xa254('0x47')]()[_0xa254('0x45')](_0xa254('0x4d'),'i')[_0xa254('0x4b')](_0xa254('0x4e'),'c',_0xa254('0x4f'))[_0xa254('0x4b')](_0xa254('0x50'),'o',_0xa254('0x51'))[_0xa254('0x4b')](_0xa254('0x52'),'a','a.id\x20=\x20i.MailAccountId')[_0xa254('0x4b')](_0xa254('0x53'),'me',_0xa254('0x54'))[_0xa254('0x4b')](_0xa254('0x55'),'it',_0xa254('0x56'))['left_join'](_0xa254('0x46'),'t','t.id\x20=\x20it.TagId');var _0x4ad623=squel[_0xa254('0x57')]();var _0x411927=[];var _0x2869b1=squel['expr']();var _0x397772;if(_0x3f0bdc['query'][_0xa254('0x58')]){_0x397772=as[_0xa254('0x59')](_0x3f0bdc[_0xa254('0x3a')][_0xa254('0x58')]);var _0x2a2f7a=_0x397772['sqlOperator'];for(var _0x4229c9=0x0;_0x4229c9<_0x397772[_0xa254('0x5a')][_0xa254('0x3f')];_0x4229c9++){var _0x1f9b09=_0x397772[_0xa254('0x5a')][_0x4229c9];var _0x26e0f5='i';var _0x23de8e=_[_0xa254('0x5b')](_0xd29d9e,['name',_0x1f9b09[_0xa254('0x43')]]);if(!_0x23de8e){switch(_0x1f9b09[_0xa254('0x43')]){case'unreadMessages':if(_0x1f9b09[_0xa254('0x5c')]==0x1){_0x51efe9[_0xa254('0x5d')]('`'+_0x1f9b09[_0xa254('0x43')]+'`\x20=\x200');}else{_0x51efe9['having']('`'+_0x1f9b09[_0xa254('0x43')]+_0xa254('0x5e'));}break;case _0xa254('0x5f'):if(_0x1f9b09[_0xa254('0x60')]==='$substring'){if(_0x1f9b09[_0xa254('0x5c')][_0xa254('0x23')]('\x20')[_0xa254('0x3f')]>0x1){_0x4ad623[_0x2a2f7a](_0xa254('0x61'),qs['getFullTextValue'](_0x1f9b09[_0xa254('0x5c')]),null);}else{var _0x33e427='%'+_0x1f9b09[_0xa254('0x5c')]+'%';_0x4ad623[_0x2a2f7a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x33e427,_0x33e427,_0x33e427);}}else{_0x23de8e=_[_0xa254('0x5b')](_0xd29d9e,[_0xa254('0x1f'),_0xa254('0x62')]);_0x1f9b09['field']=_0xa254('0x62');_0x2b8d83=as[_0xa254('0x63')](_0x26e0f5,_0x23de8e[_0xa254('0x36')],_0x1f9b09);_0x4ad623[_0x2a2f7a](_0x2b8d83[_0xa254('0x64')],_0x2b8d83[_0xa254('0x5c')]['start'],_0x2b8d83['value'][_0xa254('0x12')]);}break;case _0xa254('0x65'):var _0x10f404=_0x1f9b09['value'][_0xa254('0x23')](',')[_0xa254('0x20')](function(_0x4ca4d6){return Number(_0x4ca4d6);});_0x10f404[_0xa254('0x24')](function(_0x32fbf8){_0x2869b1['or'](_0xa254('0x66'),'%,'+_0x32fbf8+',%');});_0x411927=_[_0xa254('0x67')](_0x411927,_0x10f404);break;case _0xa254('0x68'):if(_0x1f9b09[_0xa254('0x60')]===_0xa254('0x69')){_0x4ad623[_0x2a2f7a](_0xa254('0x6a'),'%'+_0x1f9b09['value']+'%',null);}else{_0x23de8e=_[_0xa254('0x5b')](_0xd29d9e,[_0xa254('0x1f'),'UserId']);_0x1f9b09[_0xa254('0x43')]=_0xa254('0x32');_0x2b8d83=as[_0xa254('0x63')](_0x26e0f5,_0x23de8e[_0xa254('0x36')],_0x1f9b09);_0x4ad623[_0x2a2f7a](_0x2b8d83[_0xa254('0x64')],_0x2b8d83[_0xa254('0x5c')][_0xa254('0x6b')],_0x2b8d83[_0xa254('0x5c')][_0xa254('0x12')]);}break;case'plainBody':_0x2b8d83=as['buildExpression']('me',null,_0x1f9b09);_0x4ad623[_0x2a2f7a](_0x2b8d83[_0xa254('0x64')],_0x2b8d83['value'][_0xa254('0x6b')],_0x2b8d83[_0xa254('0x5c')]['end']);break;}}else{var _0x2b8d83=as[_0xa254('0x63')](_0x26e0f5,_0x23de8e[_0xa254('0x36')],_0x1f9b09);_0x4ad623[_0x2a2f7a](_0x2b8d83[_0xa254('0x64')],_0x2b8d83[_0xa254('0x5c')]['start'],_0x2b8d83[_0xa254('0x5c')][_0xa254('0x12')]);}}}else{var _0x1ed280=_(_0x3f0bdc[_0xa254('0x3a')])['keys']()[_0xa254('0x20')](function(_0x445530){return _[_0xa254('0x6c')](_0xd29d9e,['name',_0x445530])?_0x445530:undefined;})[_0xa254('0x6d')]()[_0xa254('0x5c')]();if(!_[_0xa254('0x6e')](_0x1ed280)){_0x1ed280['forEach'](function(_0x482623){if(_0x482623===_0xa254('0x6f')){_0x51efe9[_0xa254('0x41')](_0xa254('0x70'),[][_0xa254('0x71')](_0x3f0bdc[_0xa254('0x3a')][_0x482623]));}else if(_0x482623===_0xa254('0x72')){var _0x10ebdc=JSON[_0xa254('0x73')](_0x3f0bdc[_0xa254('0x3a')][_0x482623])[_0xa254('0x74')];var _0x2a13d5=JSON[_0xa254('0x73')](_0x3f0bdc[_0xa254('0x3a')][_0x482623])[_0xa254('0x75')];_0x51efe9['where'](_0xa254('0x76'),_0x10ebdc,_0x2a13d5);}else{if(_0x3f0bdc[_0xa254('0x3a')][_0x482623]===_0xa254('0x77')){_0x51efe9[_0xa254('0x41')]('i.'+_0x482623+_0xa254('0x78'));}else{_0x51efe9[_0xa254('0x41')]('i.'+_0x482623+_0xa254('0x79'),_0x3f0bdc['query'][_0x482623]);}}});}if(_0x3f0bdc[_0xa254('0x3a')][_0xa254('0x7a')]){if(_0x3f0bdc['query'][_0xa254('0x7a')]==0x1){_0x51efe9[_0xa254('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x51efe9[_0xa254('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x3f0bdc[_0xa254('0x3a')][_0xa254('0x7b')]){_0x411927=_['isArray'](_0x3f0bdc['query']['tag'])?_0x3f0bdc['query'][_0xa254('0x7b')]:new Array(_0x3f0bdc[_0xa254('0x3a')]['tag']);_0x411927[_0xa254('0x24')](function(_0x145d5a){_0x2869b1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x145d5a+',%');});}if(_0x3f0bdc[_0xa254('0x3a')][_0xa254('0x7c')]){var _0x3119df=_0x3f0bdc[_0xa254('0x3a')]['filter'][_0xa254('0x7d')]('\x5c','\x5c\x5c')[_0xa254('0x7d')](/'/g,'\x27\x27');if(qs[_0xa254('0x7e')](_0x3119df)){_0x4ad623['or'](_0xa254('0x7f'),_0x3119df+'%');}else if(qs['isEmail'](_0x3119df)){_0x4ad623['or'](_0xa254('0x80'),_0x3119df+'%');}else{_0x4ad623['or'](_0xa254('0x81'),qs[_0xa254('0x82')](_0x3119df))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa254('0x82')](_0x3119df));}}}_0x51efe9[_0xa254('0x41')](_0x4ad623);_0x51efe9['group'](_0xa254('0x83'));var _0x2c4af={'type':db[_0xa254('0x84')][_0xa254('0x85')][_0xa254('0x86')],'raw':!![]};var _0x50daef=_0x51efe9['clone']();_0x50daef[_0xa254('0x43')](_0xa254('0x83'));_0x50daef[_0xa254('0x43')](_0xa254('0x87'),'unreadMessages');if(_0x1b0b72[_0xa254('0x40')]){_0x1b0b72[_0xa254('0x40')][_0xa254('0x24')](function(_0x2fc15b){var _0x123456=_0x2fc15b[0x0]==='contactName'?_0x2fc15b[0x0]:'i.'+_0x2fc15b[0x0];_0x51efe9[_0xa254('0x40')](_0x123456,_0x2fc15b[0x1]===_0xa254('0x88')?![]:!![]);});}if(!_[_0xa254('0x6e')](_0x411927)){_0x51efe9[_0xa254('0x5d')](_0x2869b1);_0x50daef[_0xa254('0x41')](_0xa254('0x89'),_0x411927);}BPromise['resolve']()['then'](function(){if(!_0x397772){if(_0x3f0bdc[_0xa254('0x3a')][_0xa254('0x6f')])return;_0x50daef[_0xa254('0x41')](_0xa254('0x8a'));_0x51efe9[_0xa254('0x41')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3f0bdc['user'][_0xa254('0x8b')]!=='agent')return;return _0x3f0bdc['user'][_0xa254('0x8c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x199a11){if(_['isEmpty'](_0x199a11)){_0x50daef[_0xa254('0x41')](_0xa254('0x8d'));_0x51efe9[_0xa254('0x41')](_0xa254('0x8d'));}else{_0x50daef[_0xa254('0x41')](_0xa254('0x70'),_[_0xa254('0x20')](_0x199a11,'id'));_0x51efe9[_0xa254('0x41')](_0xa254('0x70'),_[_0xa254('0x20')](_0x199a11,'id'));}});})[_0xa254('0x1c')](function(){if(_0x3f0bdc[_0xa254('0x8e')]['role']===_0xa254('0x8f')&&!_0x397772&&!_0x3f0bdc[_0xa254('0x3a')][_0xa254('0x6f')])return[];return db['sequelize'][_0xa254('0x3a')](_0x50daef[_0xa254('0x90')](),_0x2c4af);})[_0xa254('0x1c')](function(_0x130a1e){_0x4d267c[_0xa254('0x17')]=_0x130a1e['length'];if(_0x4d267c[_0xa254('0x17')]===0x0)return[];return db['sequelize'][_0xa254('0x3a')](_0x3487b0['toString'](),_0x2c4af)['then'](function(_0x137e23){_0x583248=_[_0xa254('0x91')](_0x137e23,'id');_0x2c4af=_[_0xa254('0x92')](_0x2c4af,{'model':db[_0xa254('0x93')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f0bdc[_0xa254('0x3a')]['fields']){_0x1b0b72[_0xa254('0x3e')][_0xa254('0x24')](function(_0x3547cf){_0x51efe9[_0xa254('0x43')]('i.'+_0x3547cf);});}else{_0x51efe9[_0xa254('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa254('0x94'));_0x51efe9[_0xa254('0x43')](_0xa254('0x95'),'Account.key');_0x51efe9[_0xa254('0x43')]('a.mandatoryDisposition',_0xa254('0x96'));_0x51efe9['field'](_0xa254('0x97'),'contactName');_0x51efe9[_0xa254('0x43')](_0xa254('0x83'));_0x51efe9['field'](_0xa254('0x98'));_0x51efe9['field'](_0xa254('0x99'));_0x51efe9[_0xa254('0x43')](_0xa254('0x9a'));_0x51efe9[_0xa254('0x43')]('i.closedAt');_0x51efe9['field']('i.attach');_0x51efe9[_0xa254('0x43')]('i.lastMsgAt');_0x51efe9[_0xa254('0x43')](_0xa254('0x9b'));_0x51efe9[_0xa254('0x43')]('i.subject');_0x51efe9[_0xa254('0x43')](_0xa254('0x9c'));_0x51efe9[_0xa254('0x43')]('i.secondDisposition');_0x51efe9['field'](_0xa254('0x9d'));_0x51efe9['field']('i.substatus');_0x51efe9['field'](_0xa254('0x9e'));_0x51efe9[_0xa254('0x43')](_0xa254('0x9f'));_0x51efe9[_0xa254('0x43')](_0xa254('0xa0'));_0x51efe9[_0xa254('0x43')]('i.UserId');_0x51efe9[_0xa254('0x43')](_0xa254('0xa1'),_0xa254('0xa2'));_0x51efe9[_0xa254('0x43')](_0xa254('0xa3'),_0xa254('0xa4'));_0x51efe9['field']('c.email',_0xa254('0xa5'));_0x51efe9[_0xa254('0x43')](_0xa254('0xa6'),_0xa254('0xa7'));_0x51efe9['field'](_0xa254('0xa8'),_0xa254('0xa9'));_0x51efe9['field'](_0xa254('0xaa'),_0xa254('0xab'));_0x51efe9[_0xa254('0x43')](_0xa254('0xac'),_0xa254('0xad'));_0x51efe9['field'](_0xa254('0xae'),_0xa254('0xaf'));_0x51efe9[_0xa254('0x43')](_0xa254('0xb0'),'TagIds');}if(_0x1b0b72[_0xa254('0x15')])_0x51efe9[_0xa254('0x15')](_0x1b0b72[_0xa254('0x15')]);if(_0x1b0b72[_0xa254('0x14')])_0x51efe9[_0xa254('0x14')](_0x1b0b72[_0xa254('0x14')]);return db['sequelize'][_0xa254('0x3a')](_0x51efe9[_0xa254('0x90')](),_0x2c4af);})[_0xa254('0x1c')](function(_0x438c6b){if(_0x438c6b[_0xa254('0x3f')]>0x0)_0x2ee25a[_0xa254('0x41')](_0xa254('0xb1'),_[_0xa254('0x20')](_0x438c6b,'id'));return db['sequelize'][_0xa254('0x3a')](_0x2ee25a['toString'](),_0x2c4af)[_0xa254('0x1c')](function(_0x13f4bd){var _0x32c41d=_['groupBy'](_0x13f4bd,_0xa254('0xb2'));var _0x55fad1=[];return db[_0xa254('0xb3')]['findOne']({'attributes':[_0xa254('0xb4')],'raw':!![]})[_0xa254('0x1c')](function(_0x19ccd0){var _0x48c281=_0x19ccd0[_0xa254('0xb4')];_0x438c6b['forEach'](function(_0x32c42b){_0x55fad1[_0xa254('0xb5')](updateMailInteraction(_0x32c42b,_0x583248,_0x32c41d,_0x48c281));});return BPromise['all'](_0x55fad1);});});});})['then'](function(_0xc15592){_0x4d267c[_0xa254('0xb6')]=_0xc15592;return _0x4d267c;})[_0xa254('0x1c')](respondWithFilteredResult(_0x37c4d0,_0x1b0b72))[_0xa254('0x2c')](handleError(_0x37c4d0,null));};exports[_0xa254('0xb7')]=function(_0xff123e,_0x595c4b){var _0x2f4e66={'raw':![],'where':{'id':_0xff123e[_0xa254('0xb8')]['id']}},_0x1a69e1={};_0x1a69e1['model']=_[_0xa254('0x39')](db[_0xa254('0x93')][_0xa254('0xb9')]);_0x1a69e1[_0xa254('0x3a')]=_['keys'](_0xff123e[_0xa254('0x3a')]);_0x1a69e1[_0xa254('0x3b')]=_['intersection'](_0x1a69e1['model'],_0x1a69e1[_0xa254('0x3a')]);_0x2f4e66[_0xa254('0x3e')]=_['intersection'](_0x1a69e1['model'],qs[_0xa254('0x3d')](_0xff123e[_0xa254('0x3a')][_0xa254('0x3d')]));_0x2f4e66[_0xa254('0x3e')]=_0x2f4e66[_0xa254('0x3e')][_0xa254('0x3f')]?_0x2f4e66[_0xa254('0x3e')]:_0x1a69e1[_0xa254('0x38')];if(_0xff123e[_0xa254('0x3a')][_0xa254('0xba')]){_0x2f4e66[_0xa254('0xbb')]=[{'all':!![]}];}_0x2f4e66=_[_0xa254('0x92')]({},_0x2f4e66,_0xff123e[_0xa254('0xbc')]);return db[_0xa254('0x93')][_0xa254('0x5b')](_0x2f4e66)[_0xa254('0x1c')](handleEntityNotFound(_0x595c4b,null))[_0xa254('0x1c')](respondWithResult(_0x595c4b,null))['catch'](handleError(_0x595c4b,null));};exports['create']=function(_0x44c5ad,_0x3312be){return db[_0xa254('0x93')][_0xa254('0xbd')](_0x44c5ad['body'],{})[_0xa254('0x1c')](respondWithResult(_0x3312be,0xc9))[_0xa254('0x2c')](handleError(_0x3312be,null));};exports[_0xa254('0x1b')]=function(_0x4de108,_0x21ba63){if(_0x4de108[_0xa254('0xbe')]['id']){delete _0x4de108[_0xa254('0xbe')]['id'];}return db[_0xa254('0x93')]['find']({'where':{'id':_0x4de108[_0xa254('0xb8')]['id']}})[_0xa254('0x1c')](handleEntityNotFound(_0x21ba63,null))[_0xa254('0x1c')](saveUpdates(_0x4de108[_0xa254('0xbe')],null))[_0xa254('0x1c')](respondWithResult(_0x21ba63,null))['catch'](handleError(_0x21ba63,null));};exports['destroy']=function(_0x265218,_0x480ee9){return db[_0xa254('0x93')][_0xa254('0x5b')]({'where':{'id':_0x265218['params']['id']}})[_0xa254('0x1c')](handleEntityNotFound(_0x480ee9,null))[_0xa254('0x1c')](removeEntity(_0x480ee9,null))[_0xa254('0x2c')](handleError(_0x480ee9,null));};exports[_0xa254('0xbf')]=function(_0x3b6af4,_0x192670){return db[_0xa254('0x93')][_0xa254('0xbf')]()[_0xa254('0x1c')](respondWithResult(_0x192670,null))[_0xa254('0x2c')](handleError(_0x192670,null));};exports['addMessage']=function(_0x552a0e,_0x5d3c4d){return db[_0xa254('0x26')][_0xa254('0x5b')]({'where':{'id':_0x552a0e[_0xa254('0xb8')]['id']}})[_0xa254('0x1c')](handleEntityNotFound(_0x5d3c4d,null))[_0xa254('0x1c')](function(_0x103158){if(_0x103158){return _0x103158[_0xa254('0xc0')](_0x552a0e[_0xa254('0xbe')][_0xa254('0xc1')],_[_0xa254('0xc2')](_0x552a0e[_0xa254('0xbe')],[_0xa254('0xc1'),'id'])||{});}})[_0xa254('0x1c')](respondWithResult(_0x5d3c4d,null))['catch'](handleError(_0x5d3c4d,null));};exports[_0xa254('0xc3')]=function(_0x259292,_0x224cf9){var _0x49b9a1={'raw':![],'where':{}};var _0x28923e={};var _0x1b5bdf={'count':0x0,'rows':[]};return db[_0xa254('0x93')]['findOne']({'where':{'id':_0x259292[_0xa254('0xb8')]['id']}})[_0xa254('0x1c')](handleEntityNotFound(_0x224cf9,null))[_0xa254('0x1c')](function(_0x1a8918){if(_0x1a8918){_0x28923e[_0xa254('0x38')]=_[_0xa254('0x39')](db[_0xa254('0x26')][_0xa254('0xb9')]);_0x28923e[_0xa254('0x3a')]=_[_0xa254('0x39')](_0x259292[_0xa254('0x3a')]);_0x28923e[_0xa254('0x3b')]=_['intersection'](_0x28923e['model'],_0x28923e[_0xa254('0x3a')]);_0x49b9a1[_0xa254('0x3e')]=_[_0xa254('0x3c')](_0x28923e['model'],qs['fields'](_0x259292[_0xa254('0x3a')]['fields']));_0x49b9a1[_0xa254('0x3e')]=_0x49b9a1['attributes']['length']?_0x49b9a1['attributes']:_0x28923e[_0xa254('0x38')];if(!_0x259292['query']['hasOwnProperty']('nolimit')){_0x49b9a1[_0xa254('0x15')]=qs[_0xa254('0x15')](_0x259292['query'][_0xa254('0x15')]);_0x49b9a1['offset']=qs['offset'](_0x259292['query']['offset']);}_0x49b9a1[_0xa254('0x40')]=qs['sort'](_0x259292[_0xa254('0x3a')][_0xa254('0xc4')]);_0x49b9a1[_0xa254('0x41')]=qs['filters'](_['pick'](_0x259292[_0xa254('0x3a')],_0x28923e[_0xa254('0x3b')]));_0x49b9a1[_0xa254('0x41')][_0xa254('0xb2')]=_0x1a8918['id'];if(_0x259292['query'][_0xa254('0x7c')]){_0x49b9a1[_0xa254('0x41')]=_[_0xa254('0x92')](_0x49b9a1[_0xa254('0x41')],{'$or':_[_0xa254('0x20')](_0x49b9a1[_0xa254('0x3e')],function(_0x2b7c1e){var _0x5463a3={};_0x5463a3[_0x2b7c1e]={'$like':'%'+_0x259292[_0xa254('0x3a')][_0xa254('0x7c')]+'%'};return _0x5463a3;})});}if(_0x259292[_0xa254('0x3a')][_0xa254('0x74')]){var _0x4dd715=_0x259292[_0xa254('0x3a')][_0xa254('0x74')][_0xa254('0x23')](',');var _0x5b3ac7={};_0x5b3ac7[_0x4dd715[0x0]]={'$gte':moment(_0x4dd715[0x1])[_0xa254('0xc5')](_0xa254('0xc6'))};_0x49b9a1[_0xa254('0x41')]=_['merge'](_0x49b9a1[_0xa254('0x41')],_0x5b3ac7);}_0x49b9a1=_[_0xa254('0x92')]({},_0x49b9a1,_0x259292[_0xa254('0xbc')]);return db[_0xa254('0x26')]['count']({'where':_0x49b9a1[_0xa254('0x41')]})[_0xa254('0x1c')](function(_0x4d5d3e){_0x1b5bdf[_0xa254('0x17')]=_0x4d5d3e;if(_0x259292[_0xa254('0x3a')][_0xa254('0xba')]){_0x49b9a1['include']=[{'all':!![]}];}return db[_0xa254('0x26')][_0xa254('0xc7')](_0x49b9a1);})[_0xa254('0x1c')](function(_0x495999){if(_0x259292[_0xa254('0x3a')][_0xa254('0xc8')]===_0xa254('0xc9')){for(var _0x1162e9=0x0;_0x1162e9<_0x495999['length'];_0x1162e9++){_0x495999[_0x1162e9][_0xa254('0xbe')]=juice(_0x495999[_0x1162e9][_0xa254('0xbe')]);}}_0x1b5bdf[_0xa254('0xb6')]=_0x495999;return _0x1b5bdf;});}})[_0xa254('0x1c')](respondWithFilteredResult(_0x224cf9,_0x49b9a1))[_0xa254('0x2c')](handleError(_0x224cf9,null));};exports[_0xa254('0xca')]=function(_0x2e4bc4,_0x17052b){return db[_0xa254('0x93')][_0xa254('0x5b')]({'where':{'id':_0x2e4bc4[_0xa254('0xb8')]['id']}})['then'](handleEntityNotFound(_0x17052b,null))['then'](function(_0x33053b){if(_0x33053b){return _0x33053b[_0xa254('0xcb')](_0x2e4bc4[_0xa254('0xbe')][_0xa254('0xc1')],_[_0xa254('0xc2')](_0x2e4bc4[_0xa254('0xbe')],['ids','id'])||{})[_0xa254('0xcc')](function(){return db['Tag'][_0xa254('0xc7')]({'attributes':['id',_0xa254('0x1f'),_0xa254('0x44')],'where':{'id':_0x2e4bc4[_0xa254('0xbe')][_0xa254('0xc1')]}});})[_0xa254('0x1c')](function(_0x5b8315){socket[_0xa254('0xcd')](_0xa254('0xce'),{'id':Number(_0x2e4bc4[_0xa254('0xb8')]['id']),'tags':_0x5b8315||[]});return{'id':Number(_0x2e4bc4[_0xa254('0xb8')]['id']),'tags':_0x5b8315||[]};});}})[_0xa254('0x1c')](respondWithResult(_0x17052b,null))['catch'](handleError(_0x17052b,null));};exports['removeTags']=function(_0x357e25,_0x208ec2){return db[_0xa254('0x93')][_0xa254('0x5b')]({'where':{'id':_0x357e25[_0xa254('0xb8')]['id']}})['then'](handleEntityNotFound(_0x208ec2,null))[_0xa254('0x1c')](function(_0x58262c){if(_0x58262c){return _0x58262c[_0xa254('0xcf')](_0x357e25[_0xa254('0x3a')]['ids']);}})[_0xa254('0x1c')](respondWithStatusCode(_0x208ec2,null))[_0xa254('0x2c')](handleError(_0x208ec2,null));};exports[_0xa254('0xd0')]=function(_0x472681,_0x570f2f){var _0x236553=moment()['unix']()['toString']();var _0x183e04=path[_0xa254('0xd1')](config[_0xa254('0xd2')],_0xa254('0xd3'),_0xa254('0xd4'),_0xa254('0xd5'));var _0x1d06b2=path[_0xa254('0xd1')](config[_0xa254('0xd2')],_0xa254('0xd3'),_0xa254('0xd4'),'attachments');var _0x5d6f79=path['join'](_0x183e04,_0x236553);var _0x9c11d7=util[_0xa254('0xc5')](_0xa254('0xd6'),_0x472681[_0xa254('0xb8')]['id'],_0x236553);var _0xe66fd6=path[_0xa254('0xd1')](_0x183e04,_0x9c11d7);var _0x493eb0=[];if(_0x472681[_0xa254('0x3a')][_0xa254('0xd7')]){_0x493eb0['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x2b0398=[{'model':db[_0xa254('0x26')],'as':_0xa254('0xd8'),'attributes':['id',_0xa254('0xbe'),_0xa254('0x45'),'to','cc','bcc',_0xa254('0xd9'),_0xa254('0x72')],'where':{'secret':![]},'order':qs[_0xa254('0xc4')]('id'),'include':_0x493eb0}];return db['MailInteraction']['find']({'where':{'id':_0x472681[_0xa254('0xb8')]['id']},'include':_0x2b0398})[_0xa254('0x1c')](handleEntityNotFound(_0x570f2f,null))[_0xa254('0x1c')](function(_0x4c5b4f){if(_0x4c5b4f&&_0x4c5b4f[_0xa254('0xd8')]){var _0x30ffa8=_0x4c5b4f['get']({'plain':!![]});fs['mkdirSync'](_0x5d6f79);return BPromise[_0xa254('0xda')](_0x30ffa8[_0xa254('0xd8')],function(_0x23c1b6,_0x426ed7){var _0x9ac393={'from':_0x23c1b6['from'],'to':_0x23c1b6['to'],'subject':_0x23c1b6[_0xa254('0xd9')],'html':htmlEntities['decode'](_0x23c1b6['body']),'headers':{'Date':moment(_0x23c1b6['createdAt'])[_0xa254('0xc5')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x23c1b6['cc']){_0x9ac393[_0xa254('0xdb')]['Cc']=_0x23c1b6['cc'];}if(_0x23c1b6[_0xa254('0xdc')]){_0x9ac393[_0xa254('0xdb')][_0xa254('0xdd')]=_0x23c1b6[_0xa254('0xdc')];}return new BPromise(function(_0x42453a,_0x5f10fa){if(_0x23c1b6['Attachments']){for(var _0xe36c4d=0x0;_0xe36c4d<_0x23c1b6[_0xa254('0xde')][_0xa254('0x3f')];_0xe36c4d++){var _0x1f2693=_0x23c1b6['Attachments'][_0xe36c4d];var _0x179ed1=path[_0xa254('0xd1')](_0x1d06b2,_0x1f2693[_0xa254('0xdf')]);if(fs['existsSync'](_0x179ed1)){_0x9ac393[_0xa254('0xd7')][_0xa254('0xb5')]({'name':_0x1f2693[_0xa254('0x1f')],'contentType':_0x1f2693[_0xa254('0x36')],'data':fs['readFileSync'](_0x179ed1)});}}}emlformat[_0xa254('0xe0')](_0x9ac393,function(_0x19cb3e,_0x4a4411){if(_0x19cb3e)return _0x5f10fa(_0x19cb3e);fs[_0xa254('0xe1')](path[_0xa254('0xd1')](_0x5d6f79,util[_0xa254('0xc5')](_0xa254('0xe2'),_0x426ed7)),_0x4a4411);return _0x42453a(_0x4a4411);});});})[_0xa254('0x1c')](function(){return new BPromise(function(_0x284ac0,_0x4429a5){zipdir(_0x5d6f79,{'saveTo':_0xe66fd6},function(_0x99f1a,_0xf04f9a){if(_0x99f1a)return _0x4429a5(_0x99f1a);return _0x284ac0(_0xf04f9a);});})['then'](function(){return new BPromise(function(_0x39dba8,_0x5a0c62){rimraf(_0x5d6f79,function(_0x355ccc){if(_0x355ccc)_0x5a0c62(_0x355ccc);return _0x39dba8();});});})[_0xa254('0x1c')](function(){return _0x570f2f['download'](_0xe66fd6,_0x9c11d7,function(_0x30b9c6){if(!_0x30b9c6)fs[_0xa254('0xe3')](_0xe66fd6);});});});}else{return _0x570f2f['sendStatus'](0xc8);}})[_0xa254('0x2c')](handleError(_0x570f2f,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 538878d..46736d7 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 _0x5019=['update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x5019,0x9d));var _0x9501=function(_0x18f50b,_0x5d0c22){_0x18f50b=_0x18f50b-0x0;var _0x28ce22=_0x5019[_0x18f50b];return _0x28ce22;};'use strict';var EventEmitter=require(_0x9501('0x0'));var MailInteraction=require(_0x9501('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x9501('0x1'))['db'][_0x9501('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9501('0x3')](0x0);var events={'afterCreate':_0x9501('0x4'),'afterUpdate':_0x9501('0x5'),'afterDestroy':_0x9501('0x6')};function emitEvent(_0x9062a8){return function(_0x1dcae5,_0x114dc7,_0x12690e){_0x1dcae5[_0x9501('0x7')]({'attributes':['id'],'raw':!![]})[_0x9501('0x8')](function(_0x2b75a0){_0x1dcae5[_0x9501('0x9')](_0x9501('0xa'),_0x2b75a0[_0x9501('0xb')](function(_0x4c4255){return{'id':_0x4c4255['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1dcae5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9501('0x8')](function(_0x402e32){_0x1dcae5[_0x9501('0x9')](_0x9501('0xc'),_0x402e32[_0x9501('0xd')]);MailInteractionEvents[_0x9501('0xe')](_0x9062a8+':'+_0x1dcae5['id'],_0x1dcae5);MailInteractionEvents[_0x9501('0xe')](_0x9062a8,_0x1dcae5);_0x12690e(null);})[_0x9501('0xf')](_0x12690e(null));};}for(var e in events){if(events[_0x9501('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x9501('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xa516=['length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','unreadMessages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa516,0x95));var _0x6a51=function(_0x546c1c,_0x10ffa3){_0x546c1c=_0x546c1c-0x0;var _0x2b085c=_0xa516[_0x546c1c];return _0x2b085c;};'use strict';var EventEmitter=require(_0x6a51('0x0'));var MailInteraction=require(_0x6a51('0x1'))['db'][_0x6a51('0x2')];var MailMessage=require(_0x6a51('0x1'))['db'][_0x6a51('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6a51('0x4')](0x0);var events={'afterCreate':_0x6a51('0x5'),'afterUpdate':_0x6a51('0x6'),'afterDestroy':_0x6a51('0x7')};function emitEvent(_0x28be13){return function(_0x1e2ea0,_0x2a0626,_0x538c21){_0x1e2ea0[_0x6a51('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x36246a){_0x1e2ea0['setDataValue'](_0x6a51('0x9'),_0x36246a[_0x6a51('0xa')](function(_0x56ca97){return{'id':_0x56ca97['id']};}));return MailMessage[_0x6a51('0xb')]({'where':{'MailInteractionId':_0x1e2ea0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x378462){_0x1e2ea0['setDataValue'](_0x6a51('0xc'),_0x378462[_0x6a51('0xd')]);MailInteractionEvents[_0x6a51('0xe')](_0x28be13+':'+_0x1e2ea0['id'],_0x1e2ea0);MailInteractionEvents[_0x6a51('0xe')](_0x28be13,_0x1e2ea0);_0x538c21(null);})[_0x6a51('0xf')](_0x538c21(null));};}for(var e in events){if(events[_0x6a51('0x10')](e)){var event=events[e];MailInteraction[_0x6a51('0x11')](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 17b70e4..fa6f1cd 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 _0x9c2b=['MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','substatusAt','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x9c2b,0xf2));var _0xb9c2=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x9c2b[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xb9c2('0x0'));var util=require('util');var logger=require(_0xb9c2('0x1'))('api');var moment=require(_0xb9c2('0x2'));var BPromise=require(_0xb9c2('0x3'));var rp=require(_0xb9c2('0x4'));var fs=require('fs');var path=require(_0xb9c2('0x5'));var rimraf=require('rimraf');var config=require(_0xb9c2('0x6'));var attributes=require(_0xb9c2('0x7'));module[_0xb9c2('0x8')]=function(_0x2f4ddf,_0x4b5230){return _0x2f4ddf[_0xb9c2('0x9')](_0xb9c2('0xa'),attributes,{'tableName':_0xb9c2('0xb'),'paranoid':![],'indexes':[{'name':_0xb9c2('0xc'),'fields':[_0xb9c2('0xd'),'to'],'type':_0xb9c2('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32ed6a,_0x4eafc5,_0x2e3991){if(_0x32ed6a['substatus']){_0x32ed6a['substatusAt']=moment()[_0xb9c2('0xf')](_0xb9c2('0x10'));}if(_0x32ed6a[_0xb9c2('0x11')]){_0x32ed6a[_0xb9c2('0x12')]=moment()['format'](_0xb9c2('0x10'));}_0x2e3991(null,_0x4eafc5);},'beforeUpdate':function(_0x2982a9,_0x316edd,_0xbae8a4){if(_0x2982a9[_0xb9c2('0x13')](_0xb9c2('0x14'))){_0x2982a9[_0xb9c2('0x15')]=_0x2982a9[_0xb9c2('0x14')]?moment()['format'](_0xb9c2('0x10')):null;}if(_0x2982a9['changed'](_0xb9c2('0x11'))){_0x2982a9['closedAt']=moment()[_0xb9c2('0xf')](_0xb9c2('0x10'));_0x2982a9['substatus']=null;_0x2982a9[_0xb9c2('0x15')]=null;}_0xbae8a4(null,_0x2982a9);},'afterUpdate':function(_0x111ff9,_0x3a78de,_0x5c5f59){var _0x16da60=_0x2f4ddf[_0xb9c2('0x16')];var _0x362e63=_0x111ff9[_0xb9c2('0x17')]({'plain':!![]});if(_0x362e63[_0xb9c2('0x11')]){return _0x16da60[_0xb9c2('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x362e63['id']}})[_0xb9c2('0x19')](function(){_0x5c5f59();})['catch'](function(_0x2a8e6c){_0x5c5f59(_0x2a8e6c);});}else{_0x5c5f59();}}},'charset':_0xb9c2('0x1a'),'collate':_0xb9c2('0x1b')});}; \ No newline at end of file +var _0x4036=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','MailMessage','update','then','catch','utf8mb4','util'];(function(_0x802465,_0x4fe93b){var _0x5e7be4=function(_0x27e55f){while(--_0x27e55f){_0x802465['push'](_0x802465['shift']());}};_0x5e7be4(++_0x4fe93b);}(_0x4036,0xf2));var _0x6403=function(_0x77c228,_0x222bcb){_0x77c228=_0x77c228-0x0;var _0x28a9f=_0x4036[_0x77c228];return _0x28a9f;};'use strict';var _=require('lodash');var util=require(_0x6403('0x0'));var logger=require('../../config/logger')(_0x6403('0x1'));var moment=require(_0x6403('0x2'));var BPromise=require(_0x6403('0x3'));var rp=require(_0x6403('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6403('0x5'));var config=require(_0x6403('0x6'));var attributes=require(_0x6403('0x7'));module[_0x6403('0x8')]=function(_0x29b58f,_0x439a9c){return _0x29b58f['define'](_0x6403('0x9'),attributes,{'tableName':_0x6403('0xa'),'paranoid':![],'indexes':[{'name':_0x6403('0xb'),'fields':[_0x6403('0xc'),'to'],'type':_0x6403('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d233a,_0x2ae590,_0x5bf453){if(_0x1d233a[_0x6403('0xe')]){_0x1d233a[_0x6403('0xf')]=moment()['format'](_0x6403('0x10'));}if(_0x1d233a[_0x6403('0x11')]){_0x1d233a[_0x6403('0x12')]=moment()[_0x6403('0x13')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5bf453(null,_0x2ae590);},'beforeUpdate':function(_0x30643,_0x297c58,_0x4b0444){if(_0x30643[_0x6403('0x14')](_0x6403('0xe'))){_0x30643[_0x6403('0xf')]=_0x30643['substatus']?moment()[_0x6403('0x13')](_0x6403('0x10')):null;}if(_0x30643[_0x6403('0x14')]('closed')){_0x30643[_0x6403('0x12')]=moment()[_0x6403('0x13')](_0x6403('0x10'));_0x30643[_0x6403('0xe')]=null;_0x30643[_0x6403('0xf')]=null;}_0x4b0444(null,_0x30643);},'afterUpdate':function(_0x4b85b6,_0x5d83b3,_0x2acacd){var _0x544c8c=_0x29b58f[_0x6403('0x15')];var _0xfef894=_0x4b85b6['get']({'plain':!![]});if(_0xfef894[_0x6403('0x11')]){return _0x544c8c[_0x6403('0x16')][_0x6403('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0xfef894['id']}})[_0x6403('0x18')](function(){_0x2acacd();})[_0x6403('0x19')](function(_0x18124a){_0x2acacd(_0x18124a);});}else{_0x2acacd();}}},'charset':_0x6403('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3e59e44..e1b983b 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 _0xfa12=['redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','body','options','attributes','limit','info','where','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x40cb0f,_0x13bb59){var _0x306f07=function(_0x2df08e){while(--_0x2df08e){_0x40cb0f['push'](_0x40cb0f['shift']());}};_0x306f07(++_0x13bb59);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x408e7f,_0x2d8e6a){_0x408e7f=_0x408e7f-0x0;var _0xa9377d=_0xfa12[_0x408e7f];return _0xa9377d;};'use strict';var _=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var moment=require(_0x2fa1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fa1('0x3'));var db=require(_0x2fa1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2fa1('0x5'));var config=require(_0x2fa1('0x6'));var jayson=require(_0x2fa1('0x7'));var client=jayson['client'][_0x2fa1('0x8')]({'port':0x232a});config['redis']=_[_0x2fa1('0x9')](config[_0x2fa1('0xa')],{'host':_0x2fa1('0xb'),'port':0x18eb});var socket=require(_0x2fa1('0xc'))(new Redis(config[_0x2fa1('0xa')]));require(_0x2fa1('0xd'))['register'](socket);function respondWithRpcPromise(_0x23ef94,_0x1a8151,_0x122e9d){return new BPromise(function(_0x249bed,_0xa714a){return client[_0x2fa1('0xe')](_0x23ef94,_0x122e9d)[_0x2fa1('0xf')](function(_0x25cd00){logger['info'](_0x2fa1('0x10'),_0x1a8151,'request\x20sent');logger[_0x2fa1('0x11')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1a8151,_0x2fa1('0x12'),JSON[_0x2fa1('0x13')](_0x25cd00));if(_0x25cd00[_0x2fa1('0x14')]){if(_0x25cd00[_0x2fa1('0x14')][_0x2fa1('0x15')]===0x1f4){logger[_0x2fa1('0x14')]('MailInteraction,\x20%s,\x20%s',_0x1a8151,_0x25cd00[_0x2fa1('0x14')]['message']);return _0xa714a(_0x25cd00[_0x2fa1('0x14')][_0x2fa1('0x16')]);}logger['error'](_0x2fa1('0x10'),_0x1a8151,_0x25cd00[_0x2fa1('0x14')][_0x2fa1('0x16')]);return _0x249bed(_0x25cd00[_0x2fa1('0x14')][_0x2fa1('0x16')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x1a8151,_0x2fa1('0x12'));_0x249bed(_0x25cd00['result'][_0x2fa1('0x16')]);}})[_0x2fa1('0x17')](function(_0x270db4){logger['error'](_0x2fa1('0x10'),_0x1a8151,_0x270db4);_0xa714a(_0x270db4);});});}exports[_0x2fa1('0x18')]=function(_0x5656ca){var _0x1570db=this;return new Promise(function(_0x360644,_0x4c9fbf){return db[_0x2fa1('0x19')]['update'](_0x5656ca[_0x2fa1('0x1a')],{'raw':_0x5656ca['options']?_0x5656ca[_0x2fa1('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5656ca['options']?_0x5656ca[_0x2fa1('0x1b')]['where']||null:null,'attributes':_0x5656ca[_0x2fa1('0x1b')]?_0x5656ca[_0x2fa1('0x1b')][_0x2fa1('0x1c')]||null:null,'limit':_0x5656ca[_0x2fa1('0x1b')]?_0x5656ca['options'][_0x2fa1('0x1d')]||null:null})[_0x2fa1('0xf')](function(_0x3e5147){logger[_0x2fa1('0x1e')](_0x2fa1('0x18'),_0x5656ca);logger['debug'](_0x2fa1('0x18'),_0x5656ca,JSON[_0x2fa1('0x13')](_0x3e5147));_0x360644(_0x3e5147);})[_0x2fa1('0x17')](function(_0x291fb2){logger[_0x2fa1('0x14')](_0x2fa1('0x18'),_0x291fb2[_0x2fa1('0x16')],_0x5656ca);_0x4c9fbf(_0x1570db[_0x2fa1('0x14')](0x1f4,_0x291fb2[_0x2fa1('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0x38eae4){return new Promise(function(_0x4dd643,_0x2f4623){return db[_0x2fa1('0x19')]['find']({'where':_0x38eae4[_0x2fa1('0x1b')]?_0x38eae4[_0x2fa1('0x1b')][_0x2fa1('0x1f')]||null:null})['then'](function(_0x54dd41){if(_0x54dd41){return _0x54dd41['addTags'](_0x38eae4['body'][_0x2fa1('0x20')],_['omit'](_0x38eae4[_0x2fa1('0x1a')],[_0x2fa1('0x20'),'id'])||{});}})[_0x2fa1('0x21')](function(_0x426e6e){logger[_0x2fa1('0x1e')](_0x2fa1('0x22'),_0x38eae4);logger[_0x2fa1('0x11')](_0x2fa1('0x22'),_0x38eae4,JSON[_0x2fa1('0x13')](_0x426e6e));_0x4dd643(_0x426e6e);})[_0x2fa1('0x17')](function(_0x34f8e2){logger[_0x2fa1('0x14')](_0x2fa1('0x22'),_0x34f8e2[_0x2fa1('0x16')],_0x38eae4);_0x2f4623(_this[_0x2fa1('0x14')](0x1f4,_0x34f8e2['message']));});});}; \ No newline at end of file +var _0x019b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','info','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x019b,0xa6));var _0xb019=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x019b[_0x2eb3db];return _0x358f33;};'use strict';var _=require(_0xb019('0x0'));var util=require(_0xb019('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb019('0x2'));var db=require(_0xb019('0x3'))['db'];var utils=require(_0xb019('0x4'));var logger=require(_0xb019('0x5'))(_0xb019('0x6'));var config=require(_0xb019('0x7'));var jayson=require(_0xb019('0x8'));var client=jayson[_0xb019('0x9')][_0xb019('0xa')]({'port':0x232a});config[_0xb019('0xb')]=_[_0xb019('0xc')](config[_0xb019('0xb')],{'host':_0xb019('0xd'),'port':0x18eb});var socket=require(_0xb019('0xe'))(new Redis(config[_0xb019('0xb')]));require(_0xb019('0xf'))[_0xb019('0x10')](socket);function respondWithRpcPromise(_0x2148c4,_0x261e7d,_0x20d8a9){return new BPromise(function(_0x885d95,_0x2b0cbf){return client[_0xb019('0x11')](_0x2148c4,_0x20d8a9)[_0xb019('0x12')](function(_0x2ee45a){logger['info'](_0xb019('0x13'),_0x261e7d,'request\x20sent');logger[_0xb019('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x261e7d,_0xb019('0x15'),JSON[_0xb019('0x16')](_0x2ee45a));if(_0x2ee45a[_0xb019('0x17')]){if(_0x2ee45a[_0xb019('0x17')][_0xb019('0x18')]===0x1f4){logger[_0xb019('0x17')](_0xb019('0x13'),_0x261e7d,_0x2ee45a['error'][_0xb019('0x19')]);return _0x2b0cbf(_0x2ee45a[_0xb019('0x17')][_0xb019('0x19')]);}logger[_0xb019('0x17')](_0xb019('0x13'),_0x261e7d,_0x2ee45a[_0xb019('0x17')][_0xb019('0x19')]);return _0x885d95(_0x2ee45a[_0xb019('0x17')][_0xb019('0x19')]);}else{logger['info'](_0xb019('0x13'),_0x261e7d,_0xb019('0x15'));_0x885d95(_0x2ee45a[_0xb019('0x1a')]['message']);}})[_0xb019('0x1b')](function(_0x19ad0f){logger[_0xb019('0x17')](_0xb019('0x13'),_0x261e7d,_0x19ad0f);_0x2b0cbf(_0x19ad0f);});});}exports[_0xb019('0x1c')]=function(_0x34f344){var _0x3228c7=this;return new Promise(function(_0x83f640,_0x144a9c){return db[_0xb019('0x1d')]['update'](_0x34f344[_0xb019('0x1e')],{'raw':_0x34f344[_0xb019('0x1f')]?_0x34f344[_0xb019('0x1f')][_0xb019('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34f344['options']?_0x34f344['options'][_0xb019('0x21')]||null:null,'attributes':_0x34f344['options']?_0x34f344['options']['attributes']||null:null,'limit':_0x34f344[_0xb019('0x1f')]?_0x34f344[_0xb019('0x1f')]['limit']||null:null})[_0xb019('0x12')](function(_0x579d0d){logger[_0xb019('0x22')](_0xb019('0x1c'),_0x34f344);logger['debug'](_0xb019('0x1c'),_0x34f344,JSON[_0xb019('0x16')](_0x579d0d));_0x83f640(_0x579d0d);})['catch'](function(_0x4e3c57){logger[_0xb019('0x17')](_0xb019('0x1c'),_0x4e3c57[_0xb019('0x19')],_0x34f344);_0x144a9c(_0x3228c7[_0xb019('0x17')](0x1f4,_0x4e3c57[_0xb019('0x19')]));});});};exports[_0xb019('0x23')]=function(_0x3140bd){return new Promise(function(_0x4c7142,_0x5ab1a7){return db[_0xb019('0x1d')][_0xb019('0x24')]({'where':_0x3140bd[_0xb019('0x1f')]?_0x3140bd['options'][_0xb019('0x21')]||null:null})[_0xb019('0x12')](function(_0x3f16a0){if(_0x3f16a0){return _0x3f16a0[_0xb019('0x25')](_0x3140bd[_0xb019('0x1e')][_0xb019('0x26')],_[_0xb019('0x27')](_0x3140bd[_0xb019('0x1e')],[_0xb019('0x26'),'id'])||{});}})[_0xb019('0x28')](function(_0x3c4d33){logger['info'](_0xb019('0x29'),_0x3140bd);logger['debug'](_0xb019('0x29'),_0x3140bd,JSON['stringify'](_0x3c4d33));_0x4c7142(_0x3c4d33);})[_0xb019('0x1b')](function(_0x32da00){logger[_0xb019('0x17')]('AddTags',_0x32da00[_0xb019('0x19')],_0x3140bd);_0x5ab1a7(_this[_0xb019('0x17')](0x1f4,_0x32da00[_0xb019('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 30445aa..2b5ba46 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 _0x8e4f=['remove','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x1905cc,_0x99e86f){var _0x15f952=function(_0x4471c0){while(--_0x4471c0){_0x1905cc['push'](_0x1905cc['shift']());}};_0x15f952(++_0x99e86f);}(_0x8e4f,0xfb));var _0xf8e4=function(_0xd9ac06,_0x5c76a8){_0xd9ac06=_0xd9ac06-0x0;var _0x1c57b7=_0x8e4f[_0xd9ac06];return _0x1c57b7;};'use strict';var MailInteractionEvents=require(_0xf8e4('0x0'));var events=['save',_0xf8e4('0x1'),'update'];function createListener(_0x6c63f3,_0xf4b08){return function(_0x2001c8){_0xf4b08[_0xf8e4('0x2')](_0x6c63f3,_0x2001c8);};}function removeListener(_0x29ca65,_0x3b2091){return function(){MailInteractionEvents[_0xf8e4('0x3')](_0x29ca65,_0x3b2091);};}exports[_0xf8e4('0x4')]=function(_0x552d2d){for(var _0x4d7733=0x0,_0x2d1e38=events[_0xf8e4('0x5')];_0x4d7733<_0x2d1e38;_0x4d7733++){var _0x50b624=events[_0x4d7733];var _0x1d12ce=createListener(_0xf8e4('0x6')+_0x50b624,_0x552d2d);MailInteractionEvents['on'](_0x50b624,_0x1d12ce);}}; \ No newline at end of file +var _0x758f=['length','mailInteraction:','./mailInteraction.events','save','remove','emit','register'];(function(_0x333519,_0x5c7d84){var _0x36caea=function(_0x2871e2){while(--_0x2871e2){_0x333519['push'](_0x333519['shift']());}};_0x36caea(++_0x5c7d84);}(_0x758f,0xe9));var _0xf758=function(_0x176f46,_0x1ae7d4){_0x176f46=_0x176f46-0x0;var _0x3e6691=_0x758f[_0x176f46];return _0x3e6691;};'use strict';var MailInteractionEvents=require(_0xf758('0x0'));var events=[_0xf758('0x1'),_0xf758('0x2'),'update'];function createListener(_0x574f8a,_0x35e63a){return function(_0x50827f){_0x35e63a[_0xf758('0x3')](_0x574f8a,_0x50827f);};}function removeListener(_0x207db9,_0x4c7a5a){return function(){MailInteractionEvents['removeListener'](_0x207db9,_0x4c7a5a);};}exports[_0xf758('0x4')]=function(_0x3aaf4a){for(var _0x709e10=0x0,_0xf2660=events[_0xf758('0x5')];_0x709e10<_0xf2660;_0x709e10++){var _0x232e03=events[_0x709e10];var _0x28b657=createListener(_0xf758('0x6')+_0x232e03,_0x3aaf4a);MailInteractionEvents['on'](_0x232e03,_0x28b657);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3256bf2..99a2937 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 _0x515d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','mail','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x515d,0x104));var _0xd515=function(_0x1f74c5,_0x3f920f){_0x1f74c5=_0x1f74c5-0x0;var _0x1d3e9e=_0x515d[_0x1f74c5];return _0x1d3e9e;};'use strict';var multer=require('multer');var util=require(_0xd515('0x0'));var path=require(_0xd515('0x1'));var timeout=require(_0xd515('0x2'));var express=require(_0xd515('0x3'));var router=express[_0xd515('0x4')]();var fs_extra=require(_0xd515('0x5'));var auth=require(_0xd515('0x6'));var interaction=require(_0xd515('0x7'));var config=require('../../config/environment');var controller=require(_0xd515('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd515('0x9')]);router[_0xd515('0xa')](_0xd515('0xb'),auth[_0xd515('0xc')](),controller[_0xd515('0xd')]);router['get'](_0xd515('0xe'),auth[_0xd515('0xc')](),controller[_0xd515('0xf')]);router[_0xd515('0xa')](_0xd515('0x10'),auth[_0xd515('0xc')](),controller['download']);router[_0xd515('0x11')]('/',auth[_0xd515('0xc')](),interaction[_0xd515('0x12')](_0xd515('0x13'),'mailmessage:create'),controller[_0xd515('0x14')]);router[_0xd515('0x15')](_0xd515('0xe'),auth[_0xd515('0xc')](),controller[_0xd515('0x16')]);router[_0xd515('0x15')](_0xd515('0x17'),auth[_0xd515('0xc')](),controller[_0xd515('0x18')]);router[_0xd515('0x15')](_0xd515('0x19'),auth[_0xd515('0xc')](),controller[_0xd515('0x1a')]);router['delete'](_0xd515('0xe'),auth[_0xd515('0xc')](),controller[_0xd515('0x1b')]);module[_0xd515('0x1c')]=router; \ No newline at end of file +var _0x038d=['isAuthenticated','show','/:id/download','post','mail','mailmessage:create','create','/:id','update','/:id/accept','accept','reject','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','/describe','describe'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x038d,0xae));var _0xd038=function(_0x52fade,_0x859d8b){_0x52fade=_0x52fade-0x0;var _0x2ed716=_0x038d[_0x52fade];return _0x2ed716;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd038('0x0'));var timeout=require(_0xd038('0x1'));var express=require(_0xd038('0x2'));var router=express[_0xd038('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd038('0x4'));var config=require(_0xd038('0x5'));var controller=require(_0xd038('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd038('0x7')](_0xd038('0x8'),auth['isAuthenticated'](),controller[_0xd038('0x9')]);router[_0xd038('0x7')]('/:id',auth[_0xd038('0xa')](),controller[_0xd038('0xb')]);router[_0xd038('0x7')](_0xd038('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xd038('0xd')]('/',auth[_0xd038('0xa')](),interaction['tracked'](_0xd038('0xe'),_0xd038('0xf')),controller[_0xd038('0x10')]);router['put'](_0xd038('0x11'),auth[_0xd038('0xa')](),controller[_0xd038('0x12')]);router['put'](_0xd038('0x13'),auth[_0xd038('0xa')](),controller[_0xd038('0x14')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xd038('0x15')]);router[_0xd038('0x16')]('/:id',auth[_0xd038('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 131d6db..e19fdd2 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 _0xc77d=['INTEGER','BOOLEAN','DATE','ENUM','Email','lodash','exports','TEXT','long','medium','out','STRING'];(function(_0x9b619a,_0x57a0e5){var _0x7c11b=function(_0x44874e){while(--_0x44874e){_0x9b619a['push'](_0x9b619a['shift']());}};_0x7c11b(++_0x57a0e5);}(_0xc77d,0x161));var _0xdc77=function(_0x13dbe4,_0x215885){_0x13dbe4=_0x13dbe4-0x0;var _0x5c41e7=_0xc77d[_0x13dbe4];return _0x5c41e7;};'use strict';var Sequelize=require('sequelize');var _=require(_0xdc77('0x0'));module[_0xdc77('0x1')]={'body':{'type':Sequelize[_0xdc77('0x2')](_0xdc77('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xdc77('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdc77('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xdc77('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xdc77('0x2')](_0xdc77('0x3'))},'cc':{'type':Sequelize[_0xdc77('0x2')](_0xdc77('0x3'))},'bcc':{'type':Sequelize[_0xdc77('0x2')](_0xdc77('0x3'))},'subject':{'type':Sequelize[_0xdc77('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xdc77('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xdc77('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xdc77('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xdc77('0x3'))},'originCc':{'type':Sequelize[_0xdc77('0x2')]('long')},'originChannel':{'type':Sequelize[_0xdc77('0xa')](_0xdc77('0xb'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xaea2=['Chat','sequelize','exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email'];(function(_0x295157,_0x4c5a00){var _0xf7a089=function(_0x216a4c){while(--_0x216a4c){_0x295157['push'](_0x295157['shift']());}};_0xf7a089(++_0x4c5a00);}(_0xaea2,0x9d));var _0x2aea=function(_0x3d3590,_0x23bd12){_0x3d3590=_0x3d3590-0x0;var _0x1348ff=_0xaea2[_0x3d3590];return _0x1348ff;};'use strict';var Sequelize=require(_0x2aea('0x0'));var _=require('lodash');module[_0x2aea('0x1')]={'body':{'type':Sequelize[_0x2aea('0x2')](_0x2aea('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2aea('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2aea('0x5')]('in',_0x2aea('0x6')),'defaultValue':_0x2aea('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2aea('0x7')]},'to':{'type':Sequelize[_0x2aea('0x2')](_0x2aea('0x3'))},'cc':{'type':Sequelize[_0x2aea('0x2')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x2aea('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x2aea('0x8')]},'attach':{'type':Sequelize[_0x2aea('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2aea('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2aea('0x8')]},'originTo':{'type':Sequelize[_0x2aea('0x2')](_0x2aea('0x3'))},'originCc':{'type':Sequelize[_0x2aea('0x2')](_0x2aea('0x3'))},'originChannel':{'type':Sequelize[_0x2aea('0x5')](_0x2aea('0xb'),_0x2aea('0xc')),'defaultValue':_0x2aea('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 28501a1..540508e 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 _0x1100=['event','accept','EventManager','acceptmessage','info','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','reject','fromString','rejectmessage','toString','join','root','files','tmp','message-%s.eml','from','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','Bcc','existsSync','push','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','lodash','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','request','then','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','update','destroy','end','name','send','index','map','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','MailMessage','includeAll','include','findAll','show','params','rawAttributes','length','body','find','describe','create','direction','out','secret','split','MailAccount','CmList','List','Contacts','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','basename','CmContact','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','mail','read','format','UserId','user','agent','get','MailInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel'];(function(_0x2f572e,_0x26bd75){var _0x41e439=function(_0x4ac53a){while(--_0x4ac53a){_0x2f572e['push'](_0x2f572e['shift']());}};_0x41e439(++_0x26bd75);}(_0x1100,0x150));var _0x0110=function(_0x56e19d,_0x52cf4c){_0x56e19d=_0x56e19d-0x0;var _0x1ec92c=_0x1100[_0x56e19d];return _0x1ec92c;};'use strict';var emlformat=require(_0x0110('0x0'));var moment=require(_0x0110('0x1'));var BPromise=require(_0x0110('0x2'));var util=require(_0x0110('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0110('0x4'));var Redis=require('ioredis');var htmlToText=require(_0x0110('0x5'));var qs=require(_0x0110('0x6'));var logger=require(_0x0110('0x7'))('api');var interaction_log=require(_0x0110('0x7'))(_0x0110('0x8'));var config=require(_0x0110('0x9'));var db=require(_0x0110('0xa'))['db'];config[_0x0110('0xb')]=_[_0x0110('0xc')](config['redis'],{'host':_0x0110('0xd'),'port':0x18eb});var socket=require(_0x0110('0xe'))(new Redis(config[_0x0110('0xb')]));var htmlEntities=require('html-entities');require(_0x0110('0xf'))[_0x0110('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0110('0x11')][_0x0110('0x12')]({'port':0x232c});var client9003=jayson[_0x0110('0x11')]['http']({'port':0x232b});var client9002=jayson['client'][_0x0110('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x16484b,_0x5032b9,_0x592f80,_0x3fba5a){return new BPromise(function(_0x4fd51a,_0x551cc3){var _0x367108=_0x3fba5a||client;return _0x367108[_0x0110('0x13')](_0x16484b,_0x592f80)[_0x0110('0x14')](function(_0x2c7f7b){logger['info'](_0x0110('0x15'),_0x5032b9,_0x0110('0x16'));logger[_0x0110('0x17')](_0x0110('0x18'),_0x5032b9,'request\x20sent',JSON[_0x0110('0x19')](_0x2c7f7b));if(_0x2c7f7b['error']){if(_0x2c7f7b[_0x0110('0x1a')][_0x0110('0x1b')]===0x1f4){logger[_0x0110('0x1a')](_0x0110('0x15'),_0x5032b9,_0x2c7f7b['error'][_0x0110('0x1c')]);return _0x551cc3(_0x2c7f7b[_0x0110('0x1a')][_0x0110('0x1c')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x5032b9,_0x2c7f7b[_0x0110('0x1a')][_0x0110('0x1c')]);return _0x4fd51a(_0x2c7f7b[_0x0110('0x1a')][_0x0110('0x1c')]);}else{logger['info'](_0x0110('0x15'),_0x5032b9,_0x0110('0x16'));_0x4fd51a(_0x2c7f7b[_0x0110('0x1d')]['message']);}})[_0x0110('0x1e')](function(_0x1d5433){logger[_0x0110('0x1a')]('MailMessage,\x20%s,\x20%s',_0x5032b9,_0x1d5433);_0x551cc3(_0x1d5433);});});}function respondWithResult(_0x528229,_0x7dab3f){_0x7dab3f=_0x7dab3f||0xc8;return function(_0x5cacf4){if(_0x5cacf4){return _0x528229[_0x0110('0x1f')](_0x7dab3f)[_0x0110('0x20')](_0x5cacf4);}};}function respondWithFilteredResult(_0x2b3181,_0xbe4cbd){return function(_0x4f3d1f){if(_0x4f3d1f){var _0x1c6701=typeof _0xbe4cbd[_0x0110('0x21')]===_0x0110('0x22')&&typeof _0xbe4cbd[_0x0110('0x23')]==='undefined';var _0x3615bd=_0x4f3d1f[_0x0110('0x24')];var _0x2a80fc=_0x1c6701?0x0:_0xbe4cbd['offset'];var _0x2736c5=_0x1c6701?_0x4f3d1f[_0x0110('0x24')]:_0xbe4cbd[_0x0110('0x21')]+_0xbe4cbd['limit'];var _0x964d2;if(_0x2736c5>=_0x3615bd){_0x2736c5=_0x3615bd;_0x964d2=0xc8;}else{_0x964d2=0xce;}_0x2b3181[_0x0110('0x1f')](_0x964d2);return _0x2b3181[_0x0110('0x25')](_0x0110('0x26'),_0x2a80fc+'-'+_0x2736c5+'/'+_0x3615bd)['json'](_0x4f3d1f);}return null;};}function saveUpdates(_0x1cce3c){return function(_0x8a2ed){if(_0x8a2ed){return _0x8a2ed[_0x0110('0x27')](_0x1cce3c)[_0x0110('0x14')](function(_0x3dbbb1){return _0x3dbbb1;});}return null;};}function removeEntity(_0x407fff){return function(_0x12dc5d){if(_0x12dc5d){return _0x12dc5d[_0x0110('0x28')]()[_0x0110('0x14')](function(){_0x407fff[_0x0110('0x1f')](0xcc)[_0x0110('0x29')]();});}};}function handleEntityNotFound(_0x359cb2){return function(_0x16bf76){if(!_0x16bf76){_0x359cb2['sendStatus'](0x194);}return _0x16bf76;};}function handleError(_0x47c10f,_0x268749){_0x268749=_0x268749||0x1f4;return function(_0x3ff6fa){logger[_0x0110('0x1a')](_0x3ff6fa['stack']);if(_0x3ff6fa['name']){delete _0x3ff6fa[_0x0110('0x2a')];}_0x47c10f[_0x0110('0x1f')](_0x268749)[_0x0110('0x2b')](_0x3ff6fa);};}exports[_0x0110('0x2c')]=function(_0x49bf1a,_0x4014bc){var _0x291b16={},_0x48c945={},_0x543aa9={'count':0x0,'rows':[]};var _0x47e33a=_[_0x0110('0x2d')](db['MailMessage']['rawAttributes'],function(_0xdd880){return{'name':_0xdd880['fieldName'],'type':_0xdd880[_0x0110('0x2e')]['key']};});_0x48c945[_0x0110('0x2f')]=_[_0x0110('0x2d')](_0x47e33a,'name');_0x48c945[_0x0110('0x30')]=_[_0x0110('0x31')](_0x49bf1a['query']);_0x48c945[_0x0110('0x32')]=_[_0x0110('0x33')](_0x48c945[_0x0110('0x2f')],_0x48c945[_0x0110('0x30')]);_0x291b16[_0x0110('0x34')]=_[_0x0110('0x33')](_0x48c945[_0x0110('0x2f')],qs[_0x0110('0x35')](_0x49bf1a['query'][_0x0110('0x35')]));_0x291b16[_0x0110('0x34')]=_0x291b16[_0x0110('0x34')]['length']?_0x291b16[_0x0110('0x34')]:_0x48c945[_0x0110('0x2f')];if(!_0x49bf1a[_0x0110('0x30')][_0x0110('0x36')](_0x0110('0x37'))){_0x291b16['limit']=qs[_0x0110('0x23')](_0x49bf1a['query'][_0x0110('0x23')]);_0x291b16[_0x0110('0x21')]=qs[_0x0110('0x21')](_0x49bf1a[_0x0110('0x30')][_0x0110('0x21')]);}_0x291b16[_0x0110('0x38')]=qs[_0x0110('0x39')](_0x49bf1a[_0x0110('0x30')]['sort']);_0x291b16['where']=qs['filters'](_['pick'](_0x49bf1a[_0x0110('0x30')],_0x48c945[_0x0110('0x32')]),_0x47e33a);if(_0x49bf1a[_0x0110('0x30')][_0x0110('0x3a')]){_0x291b16[_0x0110('0x3b')]=_[_0x0110('0x3c')](_0x291b16[_0x0110('0x3b')],{'$or':_[_0x0110('0x2d')](_0x47e33a,function(_0x28f788){if(_0x28f788[_0x0110('0x2e')]!=='VIRTUAL'){var _0x4d073c={};_0x4d073c[_0x28f788['name']]={'$like':'%'+_0x49bf1a[_0x0110('0x30')][_0x0110('0x3a')]+'%'};return _0x4d073c;}})});}_0x291b16=_[_0x0110('0x3c')]({},_0x291b16,_0x49bf1a[_0x0110('0x3d')]);var _0x1caaf7={'where':_0x291b16[_0x0110('0x3b')]};return db[_0x0110('0x3e')]['count'](_0x1caaf7)['then'](function(_0x4663cc){_0x543aa9[_0x0110('0x24')]=_0x4663cc;if(_0x49bf1a[_0x0110('0x30')][_0x0110('0x3f')]){_0x291b16[_0x0110('0x40')]=[{'all':!![]}];}return db[_0x0110('0x3e')][_0x0110('0x41')](_0x291b16);})[_0x0110('0x14')](function(_0x2fdfb0){_0x543aa9['rows']=_0x2fdfb0;return _0x543aa9;})[_0x0110('0x14')](respondWithFilteredResult(_0x4014bc,_0x291b16))[_0x0110('0x1e')](handleError(_0x4014bc,null));};exports[_0x0110('0x42')]=function(_0x526c9a,_0x190b8a){var _0x3ab8b7={'raw':!![],'where':{'id':_0x526c9a[_0x0110('0x43')]['id']}},_0x275755={};_0x275755[_0x0110('0x2f')]=_[_0x0110('0x31')](db[_0x0110('0x3e')][_0x0110('0x44')]);_0x275755[_0x0110('0x30')]=_[_0x0110('0x31')](_0x526c9a['query']);_0x275755[_0x0110('0x32')]=_[_0x0110('0x33')](_0x275755[_0x0110('0x2f')],_0x275755[_0x0110('0x30')]);_0x3ab8b7[_0x0110('0x34')]=_[_0x0110('0x33')](_0x275755[_0x0110('0x2f')],qs[_0x0110('0x35')](_0x526c9a[_0x0110('0x30')]['fields']));_0x3ab8b7['attributes']=_0x3ab8b7[_0x0110('0x34')][_0x0110('0x45')]?_0x3ab8b7[_0x0110('0x34')]:_0x275755[_0x0110('0x2f')];if(_0x526c9a[_0x0110('0x30')][_0x0110('0x3f')]){_0x3ab8b7['include']=[{'all':!![]}];}_0x3ab8b7=_['merge']({},_0x3ab8b7,_0x526c9a[_0x0110('0x3d')]);return db['MailMessage']['find'](_0x3ab8b7)[_0x0110('0x14')](handleEntityNotFound(_0x190b8a,null))['then'](respondWithResult(_0x190b8a,null))[_0x0110('0x1e')](handleError(_0x190b8a,null));};exports[_0x0110('0x27')]=function(_0x24a2e2,_0x3276c2){if(_0x24a2e2['body']['id']){delete _0x24a2e2[_0x0110('0x46')]['id'];}return db[_0x0110('0x3e')]['find']({'where':{'id':_0x24a2e2['params']['id']}})['then'](handleEntityNotFound(_0x3276c2,null))[_0x0110('0x14')](saveUpdates(_0x24a2e2[_0x0110('0x46')],null))[_0x0110('0x14')](respondWithResult(_0x3276c2,null))['catch'](handleError(_0x3276c2,null));};exports[_0x0110('0x28')]=function(_0x1bfcae,_0x6fc7a1){return db[_0x0110('0x3e')][_0x0110('0x47')]({'where':{'id':_0x1bfcae['params']['id']}})['then'](handleEntityNotFound(_0x6fc7a1,null))[_0x0110('0x14')](removeEntity(_0x6fc7a1,null))[_0x0110('0x1e')](handleError(_0x6fc7a1,null));};exports['describe']=function(_0x213116,_0x110949){return db['MailMessage'][_0x0110('0x48')]()[_0x0110('0x14')](respondWithResult(_0x110949,null))[_0x0110('0x1e')](handleError(_0x110949,null));};exports[_0x0110('0x49')]=function(_0x4915ea,_0xe1d898){return db['MailMessage'][_0x0110('0x49')](_0x4915ea['body'])[_0x0110('0x14')](function(_0x5bde24){if(_0x5bde24){if(_0x5bde24[_0x0110('0x4a')]===_0x0110('0x4b')&&!_0x5bde24[_0x0110('0x4c')]){var _0x5d1180,_0x5b612b,_0x258f73;if(_0x4915ea[_0x0110('0x46')]['to']){_0x5b612b=_0x4915ea['body']['to'][_0x0110('0x4d')](',')[0x0];}return db[_0x0110('0x4e')]['findOne']({'where':{'id':_0x5bde24['MailAccountId']},'include':[{'model':db[_0x0110('0x4f')],'as':_0x0110('0x50'),'include':[{'model':db['CmContact'],'as':_0x0110('0x51'),'where':{'email':_0x5b612b},'limit':0x1,'order':[['updatedAt',_0x0110('0x52')]]}]},{'model':db['MailServerOut'],'as':_0x0110('0x53'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0110('0x54'),'raw':!![]}]}]})[_0x0110('0x14')](function(_0x2c8906){_0x5d1180=_0x2c8906;if(!_0x5d1180||!_0x5d1180[_0x0110('0x53')])return;var _0x31c291=_0x5d1180[_0x0110('0x55')]();if(_0x4915ea[_0x0110('0x46')][_0x0110('0x56')]&&_0x4915ea['body']['attachments'][_0x0110('0x45')]){for(var _0x38ea3d=0x0;_0x38ea3d<_0x4915ea['body'][_0x0110('0x56')][_0x0110('0x45')];_0x38ea3d+=0x1){_0x4915ea[_0x0110('0x46')][_0x0110('0x56')][_0x38ea3d]={'filename':_0x4915ea[_0x0110('0x46')][_0x0110('0x56')][_0x38ea3d][_0x0110('0x2a')],'path':path['join'](config['root'],'server/files/attachments',_0x4915ea[_0x0110('0x46')][_0x0110('0x56')][_0x38ea3d][_0x0110('0x57')])};}}_0x258f73={'account':_0x31c291,'message':_0x4915ea[_0x0110('0x46')]};return;})[_0x0110('0x14')](function(){if(_0x5d1180[_0x0110('0x50')]){if(_0x5d1180[_0x0110('0x50')][_0x0110('0x51')][_0x0110('0x45')]){return _0x5d1180[_0x0110('0x50')]['Contacts'][0x0];}else{return db[_0x0110('0x58')][_0x0110('0x49')](_['defaults'](_0x4915ea[_0x0110('0x46')],{'firstName':_0x4915ea[_0x0110('0x46')]['to'],'email':_0x4915ea[_0x0110('0x46')]['to'],'phone':_0x4915ea[_0x0110('0x46')]['to'],'ListId':_0x5d1180[_0x0110('0x59')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x0110('0x14')](function(){if(_0x258f73){return respondWithRpcPromise(_0x0110('0x5a'),_0x0110('0x5b'),_0x258f73,client9003)[_0x0110('0x14')](function(_0x28c40c){return _0x5bde24[_0x0110('0x27')]({'read':!![],'messageId':_0x28c40c['messageId'],'sentAt':moment()['format'](_0x0110('0x5c'))});})[_0x0110('0x1e')](function(_0x4421b0){logger[_0x0110('0x1a')]('%s',JSON[_0x0110('0x19')](_0x4421b0));return _0x5bde24;});}return _0x5bde24;});}return _0x5bde24;}})['then'](respondWithResult(_0xe1d898,0xc9))['catch'](handleError(_0xe1d898,null));};exports['accept']=function(_0x19fc1f,_0xf367cd){var _0x9ed2d1={'agent':{},'channel':_0x0110('0x5d')};if(_0x19fc1f[_0x0110('0x46')]['id']){delete _0x19fc1f[_0x0110('0x46')]['id'];}_0x19fc1f['body'][_0x0110('0x5e')]=!![];_0x19fc1f[_0x0110('0x46')]['readAt']=moment()[_0x0110('0x5f')](_0x0110('0x5c'));_0x19fc1f[_0x0110('0x46')][_0x0110('0x60')]=_0x19fc1f[_0x0110('0x46')][_0x0110('0x60')]||_0x19fc1f[_0x0110('0x61')]['id'];_0x9ed2d1[_0x0110('0x62')]['id']=_0x19fc1f['body'][_0x0110('0x60')];return db['MailMessage'][_0x0110('0x47')]({'where':{'id':_0x19fc1f['params']['id'],'UserId':null}})[_0x0110('0x14')](handleEntityNotFound(_0xf367cd,null))[_0x0110('0x14')](saveUpdates(_0x19fc1f[_0x0110('0x46')],null))['then'](function(_0xddff49){if(_0xddff49){_0x9ed2d1['message']=_0xddff49[_0x0110('0x63')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0xddff49[_0x0110('0x64')]}});}return null;})[_0x0110('0x14')](handleEntityNotFound(_0xf367cd,null))['then'](function(_0x3efe16){if(_0x3efe16){return _0x3efe16[_0x0110('0x27')]({'UserId':_0x19fc1f['body'][_0x0110('0x60')],'read1stAt':_[_0x0110('0x65')](_0x3efe16[_0x0110('0x66')])?moment()[_0x0110('0x5f')](_0x0110('0x5c')):undefined});}return null;})['then'](function(_0xf1f0e6){if(_0xf1f0e6){_0x9ed2d1[_0x0110('0x67')]=_0xf1f0e6['get']({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x19fc1f[_0x0110('0x61')]['id'],_0x19fc1f[_0x0110('0x61')]['name'],_0x19fc1f['user'][_0x0110('0x68')],_0x9ed2d1[_0x0110('0x67')]['id'],_0x19fc1f['body']?JSON['stringify'](_0x19fc1f[_0x0110('0x46')]):_0x0110('0x69'));return respondWithRpcPromise(_0x0110('0x6a'),'acceptMessage',_0x9ed2d1);}return null;})[_0x0110('0x14')](function(_0x13a8e8){var _0x4cc451=_0x0110('0x6b')+_0x13a8e8[_0x0110('0x1c')]['ContactId'];return db[_0x0110('0x6c')][_0x0110('0x30')](_0x4cc451,{'type':db[_0x0110('0x6d')][_0x0110('0x6e')][_0x0110('0x6f')],'raw':!![]})['then'](function(_0x9635e2){return _0x9635e2;});})[_0x0110('0x14')](function(_0x595a94){if(_0x595a94){_0x9ed2d1[_0x0110('0x1c')]['contact']=_0x595a94[0x0];if(!_0x19fc1f[_0x0110('0x46')]['UserId'])return;return db[_0x0110('0x70')][_0x0110('0x47')]({'where':{'id':_0x19fc1f[_0x0110('0x46')]['UserId'],'role':_0x0110('0x62')},'attributes':['id','name',_0x0110('0x71'),_0x0110('0x72'),_0x0110('0x73')],'raw':!![]});}return null;})[_0x0110('0x14')](function(_0x3a6c4d){if(!_0x3a6c4d)return null;_0x9ed2d1[_0x0110('0x1c')][_0x0110('0x62')]=_0x3a6c4d;return _0x9ed2d1;})['then'](function(_0x242398){if(_0x242398){if(_0x19fc1f[_0x0110('0x46')]['manual']){_0x9ed2d1['message'][_0x0110('0x74')]=util[_0x0110('0x5f')](_0x0110('0x75'),_0x19fc1f[_0x0110('0x61')][_0x0110('0x2a')]);_0x9ed2d1[_0x0110('0x1c')][_0x0110('0x76')]=_0x9ed2d1[_0x0110('0x76')];_0x9ed2d1[_0x0110('0x1c')][_0x0110('0x77')]=_0x9ed2d1[_0x0110('0x76')];_0x9ed2d1['message'][_0x0110('0x78')]=_0x0110('0x79');_0x9ed2d1[_0x0110('0x1c')][_0x0110('0x46')]=htmlToText['fromString'](_0x9ed2d1[_0x0110('0x1c')]['body']);return respondWithRpcPromise(_0x0110('0x7a'),_0x0110('0x7a'),{'event':_0x0110('0x7b'),'message':_0x9ed2d1[_0x0110('0x1c')]},client9002)['then'](function(){return _0x9ed2d1;});}return _0x9ed2d1;}return null;})[_0x0110('0x14')](respondWithResult(_0xf367cd,null))[_0x0110('0x1e')](handleError(_0xf367cd,null));};exports['reject']=function(_0x840278,_0x29ef58){var _0x14280f={'agent':{},'channel':_0x0110('0x5d')};if(_0x840278['body']['id']){delete _0x840278['body']['id'];}_0x840278['body'][_0x0110('0x60')]=_0x840278['body'][_0x0110('0x60')]||_0x840278[_0x0110('0x61')]['id'];_0x14280f[_0x0110('0x62')]['id']=_0x840278[_0x0110('0x46')][_0x0110('0x60')];return db[_0x0110('0x3e')][_0x0110('0x47')]({'where':{'id':_0x840278[_0x0110('0x43')]['id'],'UserId':null}})[_0x0110('0x14')](handleEntityNotFound(_0x29ef58,null))[_0x0110('0x14')](function(_0x370011){if(_0x370011){_0x14280f[_0x0110('0x1c')]=_0x370011[_0x0110('0x63')]({'plain':!![]});return db['MailInteraction'][_0x0110('0x47')]({'where':{'id':_0x370011[_0x0110('0x64')]}});}return null;})[_0x0110('0x14')](handleEntityNotFound(_0x29ef58,null))['then'](function(_0x35786f){if(_0x35786f){_0x14280f[_0x0110('0x67')]=_0x35786f[_0x0110('0x63')]({'plain':!![]});interaction_log[_0x0110('0x7c')](_0x0110('0x7d'),_0x840278[_0x0110('0x61')]['id'],_0x840278['user'][_0x0110('0x2a')],_0x840278[_0x0110('0x61')][_0x0110('0x68')],_0x14280f[_0x0110('0x67')]['id'],_0x840278[_0x0110('0x46')]?JSON[_0x0110('0x19')](_0x840278[_0x0110('0x46')]):'null');return respondWithRpcPromise(_0x0110('0x7e'),'rejectMessage',_0x14280f);}return null;})[_0x0110('0x14')](function(_0x5209ad){var _0x15d295=_0x0110('0x6b')+_0x5209ad['message'][_0x0110('0x7f')];return db[_0x0110('0x6c')][_0x0110('0x30')](_0x15d295,{'type':db[_0x0110('0x6d')][_0x0110('0x6e')][_0x0110('0x6f')],'raw':!![]})[_0x0110('0x14')](function(_0xf7ecd){return _0xf7ecd;});})[_0x0110('0x14')](function(_0x2f87ce){if(_0x2f87ce){_0x14280f[_0x0110('0x1c')]['contact']=_0x2f87ce[0x0];if(!_0x840278[_0x0110('0x46')]['UserId'])return;return db[_0x0110('0x70')][_0x0110('0x47')]({'where':{'id':_0x840278[_0x0110('0x46')][_0x0110('0x60')],'role':_0x0110('0x62')},'attributes':['id',_0x0110('0x2a'),_0x0110('0x71'),'email',_0x0110('0x73')],'raw':!![]});}return null;})['then'](function(_0x524ac7){if(!_0x524ac7)return null;_0x14280f[_0x0110('0x1c')][_0x0110('0x62')]=_0x524ac7;return _0x14280f;})[_0x0110('0x14')](function(_0x23f0af){if(_0x23f0af){_0x23f0af[_0x0110('0x1c')][_0x0110('0x74')]=util['format']('SIP/%s',_0x840278[_0x0110('0x61')][_0x0110('0x2a')]);_0x23f0af[_0x0110('0x1c')][_0x0110('0x76')]=_0x14280f['channel'];_0x23f0af[_0x0110('0x1c')]['motionChannel']=_0x14280f[_0x0110('0x76')];_0x23f0af[_0x0110('0x1c')][_0x0110('0x78')]=_0x0110('0x80');_0x23f0af[_0x0110('0x1c')][_0x0110('0x46')]=htmlToText[_0x0110('0x81')](_0x14280f['message']['body']);respondWithRpcPromise('EventManager',_0x0110('0x7a'),{'event':_0x0110('0x82'),'message':_0x23f0af[_0x0110('0x1c')]},client9002);return _0x14280f;}return null;})[_0x0110('0x14')](respondWithResult(_0x29ef58,null))[_0x0110('0x1e')](handleError(_0x29ef58,null));};exports['download']=function(_0x1592f6,_0x456bd0){var _0x5864dc=moment()['unix']()[_0x0110('0x83')]();var _0x2b1333=path[_0x0110('0x84')](config[_0x0110('0x85')],'server',_0x0110('0x86'),_0x0110('0x87'));var _0x25f932=path[_0x0110('0x84')](config[_0x0110('0x85')],'server','files',_0x0110('0x56'));var _0x10e1e5=util[_0x0110('0x5f')](_0x0110('0x88'),_0x5864dc);return db[_0x0110('0x3e')][_0x0110('0x47')]({'where':{'id':_0x1592f6[_0x0110('0x43')]['id']},'attributes':['id',_0x0110('0x46'),_0x0110('0x89'),'to','cc','bcc','subject',_0x0110('0x8a')],'include':_0x1592f6[_0x0110('0x30')]['attachments']?[{'model':db[_0x0110('0x8b')],'as':_0x0110('0x8c')}]:undefined})[_0x0110('0x14')](handleEntityNotFound(_0x456bd0,null))[_0x0110('0x14')](function(_0x1b3126){if(_0x1b3126){var _0x2b40fc=_0x1b3126;var _0x1cc0d4={'from':_0x2b40fc[_0x0110('0x89')],'to':_0x2b40fc['to'],'subject':_0x2b40fc[_0x0110('0x8d')],'html':htmlEntities[_0x0110('0x8e')](_0x2b40fc[_0x0110('0x46')]),'headers':{'Date':moment(_0x2b40fc[_0x0110('0x8a')])[_0x0110('0x5f')](_0x0110('0x8f'))},'attachments':[]};if(_0x1b3126['cc']){_0x1cc0d4['headers']['Cc']=_0x1b3126['cc'];}if(_0x1b3126[_0x0110('0x90')]){_0x1cc0d4['headers'][_0x0110('0x91')]=_0x1b3126[_0x0110('0x90')];}return new BPromise(function(_0x3679b4,_0x142350){if(_0x1b3126[_0x0110('0x8c')]){for(var _0xe0f63c=0x0;_0xe0f63c<_0x1b3126[_0x0110('0x8c')]['length'];_0xe0f63c++){var _0x2bfadf=_0x1b3126[_0x0110('0x8c')][_0xe0f63c];var _0x3224e1=path['join'](_0x25f932,_0x2bfadf[_0x0110('0x57')]);if(fs[_0x0110('0x92')](_0x3224e1)){_0x1cc0d4[_0x0110('0x56')][_0x0110('0x93')]({'name':_0x2bfadf[_0x0110('0x2a')],'contentType':_0x2bfadf[_0x0110('0x2e')],'data':fs['readFileSync'](_0x3224e1)});}}}emlformat[_0x0110('0x94')](_0x1cc0d4,function(_0x35cc67,_0x31eec6){if(_0x35cc67)return _0x142350(_0x35cc67);fs[_0x0110('0x95')](path['join'](_0x2b1333,_0x10e1e5),_0x31eec6);return _0x3679b4(_0x31eec6);});});}})[_0x0110('0x14')](function(_0x50d025){if(_0x50d025){return _0x456bd0[_0x0110('0x96')](path[_0x0110('0x84')](_0x2b1333,_0x10e1e5),_0x10e1e5,function(_0x39dfd7){if(!_0x39dfd7)fs[_0x0110('0x97')](path['join'](_0x2b1333,_0x10e1e5));});}})[_0x0110('0x1e')](handleError(_0x456bd0,null));}; \ No newline at end of file +var _0x57fc=['format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','agent','MailInteraction','MailInteractionId','isNil','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','UserId','User','fullname','email','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','sequelize','internal','rejectmessage','unix','toString','server','files','tmp','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','download','unlinkSync','eml-format','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','catch','status','limit','undefined','count','offset','Content-Range','end','sendStatus','stack','name','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','update','body','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','messageId'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x57fc,0xda));var _0xc57f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57fc[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc57f('0x0'));var moment=require('moment');var BPromise=require(_0xc57f('0x1'));var util=require(_0xc57f('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xc57f('0x3'));var Redis=require(_0xc57f('0x4'));var htmlToText=require('html-to-text');var qs=require(_0xc57f('0x5'));var logger=require(_0xc57f('0x6'))(_0xc57f('0x7'));var interaction_log=require(_0xc57f('0x6'))(_0xc57f('0x8'));var config=require(_0xc57f('0x9'));var db=require(_0xc57f('0xa'))['db'];config[_0xc57f('0xb')]=_[_0xc57f('0xc')](config[_0xc57f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc57f('0xd'))(new Redis(config[_0xc57f('0xb')]));var htmlEntities=require(_0xc57f('0xe'));require(_0xc57f('0xf'))[_0xc57f('0x10')](socket);var jayson=require(_0xc57f('0x11'));var client=jayson[_0xc57f('0x12')]['http']({'port':0x232c});var client9003=jayson[_0xc57f('0x12')][_0xc57f('0x13')]({'port':0x232b});var client9002=jayson[_0xc57f('0x12')][_0xc57f('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x273b04,_0x5b0626,_0x291aba,_0x11a3d7){return new BPromise(function(_0x4ba97c,_0x19182d){var _0x18b081=_0x11a3d7||client;return _0x18b081[_0xc57f('0x14')](_0x273b04,_0x291aba)[_0xc57f('0x15')](function(_0x364aea){logger[_0xc57f('0x16')](_0xc57f('0x17'),_0x5b0626,_0xc57f('0x18'));logger[_0xc57f('0x19')](_0xc57f('0x1a'),_0x5b0626,_0xc57f('0x18'),JSON['stringify'](_0x364aea));if(_0x364aea['error']){if(_0x364aea['error']['code']===0x1f4){logger['error'](_0xc57f('0x17'),_0x5b0626,_0x364aea[_0xc57f('0x1b')][_0xc57f('0x1c')]);return _0x19182d(_0x364aea[_0xc57f('0x1b')][_0xc57f('0x1c')]);}logger[_0xc57f('0x1b')](_0xc57f('0x17'),_0x5b0626,_0x364aea['error'][_0xc57f('0x1c')]);return _0x4ba97c(_0x364aea[_0xc57f('0x1b')]['message']);}else{logger[_0xc57f('0x16')](_0xc57f('0x17'),_0x5b0626,_0xc57f('0x18'));_0x4ba97c(_0x364aea['result'][_0xc57f('0x1c')]);}})[_0xc57f('0x1d')](function(_0x50db4f){logger[_0xc57f('0x1b')](_0xc57f('0x17'),_0x5b0626,_0x50db4f);_0x19182d(_0x50db4f);});});}function respondWithResult(_0x247492,_0x4a6b95){_0x4a6b95=_0x4a6b95||0xc8;return function(_0x5ed343){if(_0x5ed343){return _0x247492[_0xc57f('0x1e')](_0x4a6b95)['json'](_0x5ed343);}};}function respondWithFilteredResult(_0x479ab5,_0x3bfb47){return function(_0x4ecb75){if(_0x4ecb75){var _0x1cac73=typeof _0x3bfb47['offset']==='undefined'&&typeof _0x3bfb47[_0xc57f('0x1f')]===_0xc57f('0x20');var _0x578fdf=_0x4ecb75[_0xc57f('0x21')];var _0x5b84ef=_0x1cac73?0x0:_0x3bfb47[_0xc57f('0x22')];var _0x572fc4=_0x1cac73?_0x4ecb75['count']:_0x3bfb47[_0xc57f('0x22')]+_0x3bfb47[_0xc57f('0x1f')];var _0x453308;if(_0x572fc4>=_0x578fdf){_0x572fc4=_0x578fdf;_0x453308=0xc8;}else{_0x453308=0xce;}_0x479ab5['status'](_0x453308);return _0x479ab5['set'](_0xc57f('0x23'),_0x5b84ef+'-'+_0x572fc4+'/'+_0x578fdf)['json'](_0x4ecb75);}return null;};}function saveUpdates(_0x18602c){return function(_0x1117be){if(_0x1117be){return _0x1117be['update'](_0x18602c)[_0xc57f('0x15')](function(_0x171f8c){return _0x171f8c;});}return null;};}function removeEntity(_0x5bf841){return function(_0x331c12){if(_0x331c12){return _0x331c12['destroy']()['then'](function(){_0x5bf841[_0xc57f('0x1e')](0xcc)[_0xc57f('0x24')]();});}};}function handleEntityNotFound(_0x22e961){return function(_0x579780){if(!_0x579780){_0x22e961[_0xc57f('0x25')](0x194);}return _0x579780;};}function handleError(_0x1e3b3a,_0x22165e){_0x22165e=_0x22165e||0x1f4;return function(_0x57f946){logger[_0xc57f('0x1b')](_0x57f946[_0xc57f('0x26')]);if(_0x57f946[_0xc57f('0x27')]){delete _0x57f946[_0xc57f('0x27')];}_0x1e3b3a[_0xc57f('0x1e')](_0x22165e)['send'](_0x57f946);};}exports['index']=function(_0x38cae1,_0x2da065){var _0x36a002={},_0x4f87fd={},_0x2d0bc8={'count':0x0,'rows':[]};var _0x5bcdff=_[_0xc57f('0x28')](db[_0xc57f('0x29')]['rawAttributes'],function(_0x293f40){return{'name':_0x293f40[_0xc57f('0x2a')],'type':_0x293f40[_0xc57f('0x2b')][_0xc57f('0x2c')]};});_0x4f87fd[_0xc57f('0x2d')]=_[_0xc57f('0x28')](_0x5bcdff,_0xc57f('0x27'));_0x4f87fd[_0xc57f('0x2e')]=_[_0xc57f('0x2f')](_0x38cae1[_0xc57f('0x2e')]);_0x4f87fd[_0xc57f('0x30')]=_[_0xc57f('0x31')](_0x4f87fd[_0xc57f('0x2d')],_0x4f87fd[_0xc57f('0x2e')]);_0x36a002[_0xc57f('0x32')]=_[_0xc57f('0x31')](_0x4f87fd[_0xc57f('0x2d')],qs[_0xc57f('0x33')](_0x38cae1[_0xc57f('0x2e')][_0xc57f('0x33')]));_0x36a002[_0xc57f('0x32')]=_0x36a002[_0xc57f('0x32')]['length']?_0x36a002[_0xc57f('0x32')]:_0x4f87fd[_0xc57f('0x2d')];if(!_0x38cae1[_0xc57f('0x2e')][_0xc57f('0x34')](_0xc57f('0x35'))){_0x36a002['limit']=qs[_0xc57f('0x1f')](_0x38cae1[_0xc57f('0x2e')][_0xc57f('0x1f')]);_0x36a002['offset']=qs[_0xc57f('0x22')](_0x38cae1['query'][_0xc57f('0x22')]);}_0x36a002['order']=qs[_0xc57f('0x36')](_0x38cae1[_0xc57f('0x2e')]['sort']);_0x36a002[_0xc57f('0x37')]=qs[_0xc57f('0x30')](_[_0xc57f('0x38')](_0x38cae1[_0xc57f('0x2e')],_0x4f87fd[_0xc57f('0x30')]),_0x5bcdff);if(_0x38cae1[_0xc57f('0x2e')][_0xc57f('0x39')]){_0x36a002[_0xc57f('0x37')]=_[_0xc57f('0x3a')](_0x36a002[_0xc57f('0x37')],{'$or':_[_0xc57f('0x28')](_0x5bcdff,function(_0x3bdec0){if(_0x3bdec0['type']!==_0xc57f('0x3b')){var _0x421c13={};_0x421c13[_0x3bdec0[_0xc57f('0x27')]]={'$like':'%'+_0x38cae1[_0xc57f('0x2e')][_0xc57f('0x39')]+'%'};return _0x421c13;}})});}_0x36a002=_[_0xc57f('0x3a')]({},_0x36a002,_0x38cae1[_0xc57f('0x3c')]);var _0xe23425={'where':_0x36a002[_0xc57f('0x37')]};return db[_0xc57f('0x29')][_0xc57f('0x21')](_0xe23425)[_0xc57f('0x15')](function(_0x1125e9){_0x2d0bc8[_0xc57f('0x21')]=_0x1125e9;if(_0x38cae1[_0xc57f('0x2e')][_0xc57f('0x3d')]){_0x36a002[_0xc57f('0x3e')]=[{'all':!![]}];}return db[_0xc57f('0x29')][_0xc57f('0x3f')](_0x36a002);})[_0xc57f('0x15')](function(_0x379874){_0x2d0bc8[_0xc57f('0x40')]=_0x379874;return _0x2d0bc8;})[_0xc57f('0x15')](respondWithFilteredResult(_0x2da065,_0x36a002))[_0xc57f('0x1d')](handleError(_0x2da065,null));};exports['show']=function(_0x127a84,_0x233236){var _0x5de8b7={'raw':!![],'where':{'id':_0x127a84[_0xc57f('0x41')]['id']}},_0x1fe6b6={};_0x1fe6b6['model']=_[_0xc57f('0x2f')](db[_0xc57f('0x29')]['rawAttributes']);_0x1fe6b6['query']=_[_0xc57f('0x2f')](_0x127a84[_0xc57f('0x2e')]);_0x1fe6b6[_0xc57f('0x30')]=_['intersection'](_0x1fe6b6['model'],_0x1fe6b6['query']);_0x5de8b7[_0xc57f('0x32')]=_[_0xc57f('0x31')](_0x1fe6b6[_0xc57f('0x2d')],qs[_0xc57f('0x33')](_0x127a84[_0xc57f('0x2e')][_0xc57f('0x33')]));_0x5de8b7[_0xc57f('0x32')]=_0x5de8b7[_0xc57f('0x32')][_0xc57f('0x42')]?_0x5de8b7['attributes']:_0x1fe6b6[_0xc57f('0x2d')];if(_0x127a84['query'][_0xc57f('0x3d')]){_0x5de8b7[_0xc57f('0x3e')]=[{'all':!![]}];}_0x5de8b7=_[_0xc57f('0x3a')]({},_0x5de8b7,_0x127a84['options']);return db[_0xc57f('0x29')][_0xc57f('0x43')](_0x5de8b7)[_0xc57f('0x15')](handleEntityNotFound(_0x233236,null))[_0xc57f('0x15')](respondWithResult(_0x233236,null))[_0xc57f('0x1d')](handleError(_0x233236,null));};exports[_0xc57f('0x44')]=function(_0x3ce44b,_0x3af2a5){if(_0x3ce44b[_0xc57f('0x45')]['id']){delete _0x3ce44b[_0xc57f('0x45')]['id'];}return db[_0xc57f('0x29')][_0xc57f('0x43')]({'where':{'id':_0x3ce44b[_0xc57f('0x41')]['id']}})[_0xc57f('0x15')](handleEntityNotFound(_0x3af2a5,null))[_0xc57f('0x15')](saveUpdates(_0x3ce44b[_0xc57f('0x45')],null))[_0xc57f('0x15')](respondWithResult(_0x3af2a5,null))[_0xc57f('0x1d')](handleError(_0x3af2a5,null));};exports[_0xc57f('0x46')]=function(_0x41576b,_0x4e380a){return db[_0xc57f('0x29')]['find']({'where':{'id':_0x41576b[_0xc57f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e380a,null))[_0xc57f('0x15')](removeEntity(_0x4e380a,null))[_0xc57f('0x1d')](handleError(_0x4e380a,null));};exports['describe']=function(_0x31446d,_0x4c4c19){return db['MailMessage'][_0xc57f('0x47')]()[_0xc57f('0x15')](respondWithResult(_0x4c4c19,null))[_0xc57f('0x1d')](handleError(_0x4c4c19,null));};exports[_0xc57f('0x48')]=function(_0x3c284e,_0x8418d){return db['MailMessage'][_0xc57f('0x48')](_0x3c284e[_0xc57f('0x45')])['then'](function(_0x4ae81e){if(_0x4ae81e){if(_0x4ae81e[_0xc57f('0x49')]===_0xc57f('0x4a')&&!_0x4ae81e[_0xc57f('0x4b')]){var _0x4ca59d,_0x51a454,_0x591d5f;if(_0x3c284e['body']['to']){_0x51a454=_0x3c284e[_0xc57f('0x45')]['to'][_0xc57f('0x4c')](',')[0x0];}return db[_0xc57f('0x4d')][_0xc57f('0x4e')]({'where':{'id':_0x4ae81e[_0xc57f('0x4f')]},'include':[{'model':db[_0xc57f('0x50')],'as':_0xc57f('0x51'),'include':[{'model':db['CmContact'],'as':_0xc57f('0x52'),'where':{'email':_0x51a454},'limit':0x1,'order':[[_0xc57f('0x53'),_0xc57f('0x54')]]}]},{'model':db[_0xc57f('0x55')],'as':_0xc57f('0x56'),'raw':!![],'include':[{'model':db[_0xc57f('0x57')],'as':'CloudProvider','raw':!![]}]}]})[_0xc57f('0x15')](function(_0x435184){_0x4ca59d=_0x435184;if(!_0x4ca59d||!_0x4ca59d[_0xc57f('0x56')])return;var _0x5520e1=_0x4ca59d[_0xc57f('0x58')]();if(_0x3c284e[_0xc57f('0x45')][_0xc57f('0x59')]&&_0x3c284e[_0xc57f('0x45')][_0xc57f('0x59')][_0xc57f('0x42')]){for(var _0x49ccc6=0x0;_0x49ccc6<_0x3c284e['body']['attachments']['length'];_0x49ccc6+=0x1){_0x3c284e['body'][_0xc57f('0x59')][_0x49ccc6]={'filename':_0x3c284e[_0xc57f('0x45')][_0xc57f('0x59')][_0x49ccc6][_0xc57f('0x27')],'path':path[_0xc57f('0x5a')](config[_0xc57f('0x5b')],_0xc57f('0x5c'),_0x3c284e['body'][_0xc57f('0x59')][_0x49ccc6][_0xc57f('0x5d')])};}}_0x591d5f={'account':_0x5520e1,'message':_0x3c284e[_0xc57f('0x45')]};return;})[_0xc57f('0x15')](function(){if(_0x4ca59d['List']){if(_0x4ca59d[_0xc57f('0x51')][_0xc57f('0x52')][_0xc57f('0x42')]){return _0x4ca59d['List']['Contacts'][0x0];}else{return db['CmContact'][_0xc57f('0x48')](_[_0xc57f('0xc')](_0x3c284e[_0xc57f('0x45')],{'firstName':_0x3c284e['body']['to'],'email':_0x3c284e[_0xc57f('0x45')]['to'],'phone':_0x3c284e[_0xc57f('0x45')]['to'],'ListId':_0x4ca59d['ListId']}));}}else{throw new Error(_0xc57f('0x5e'));}})[_0xc57f('0x15')](function(){if(_0x591d5f){return respondWithRpcPromise(_0xc57f('0x5f'),_0xc57f('0x60'),_0x591d5f,client9003)[_0xc57f('0x15')](function(_0x30c080){return _0x4ae81e[_0xc57f('0x44')]({'read':!![],'messageId':_0x30c080[_0xc57f('0x61')],'sentAt':moment()[_0xc57f('0x62')](_0xc57f('0x63'))});})['catch'](function(_0x2ab4d7){logger[_0xc57f('0x1b')]('%s',JSON[_0xc57f('0x64')](_0x2ab4d7));return _0x4ae81e;});}return _0x4ae81e;});}return _0x4ae81e;}})[_0xc57f('0x15')](respondWithResult(_0x8418d,0xc9))[_0xc57f('0x1d')](handleError(_0x8418d,null));};exports[_0xc57f('0x65')]=function(_0x554f03,_0x529f63){var _0xde7652={'agent':{},'channel':_0xc57f('0x66')};if(_0x554f03[_0xc57f('0x45')]['id']){delete _0x554f03[_0xc57f('0x45')]['id'];}_0x554f03[_0xc57f('0x45')][_0xc57f('0x67')]=!![];_0x554f03['body'][_0xc57f('0x68')]=moment()[_0xc57f('0x62')](_0xc57f('0x63'));_0x554f03[_0xc57f('0x45')]['UserId']=_0x554f03[_0xc57f('0x45')]['UserId']||_0x554f03['user']['id'];_0xde7652[_0xc57f('0x69')]['id']=_0x554f03[_0xc57f('0x45')]['UserId'];return db['MailMessage'][_0xc57f('0x43')]({'where':{'id':_0x554f03[_0xc57f('0x41')]['id'],'UserId':null}})[_0xc57f('0x15')](handleEntityNotFound(_0x529f63,null))['then'](saveUpdates(_0x554f03[_0xc57f('0x45')],null))['then'](function(_0x938c72){if(_0x938c72){_0xde7652[_0xc57f('0x1c')]=_0x938c72['get']({'plain':!![]});return db[_0xc57f('0x6a')]['find']({'where':{'id':_0x938c72[_0xc57f('0x6b')]}});}return null;})[_0xc57f('0x15')](handleEntityNotFound(_0x529f63,null))[_0xc57f('0x15')](function(_0x229f4f){if(_0x229f4f){return _0x229f4f[_0xc57f('0x44')]({'UserId':_0x554f03[_0xc57f('0x45')]['UserId'],'read1stAt':_[_0xc57f('0x6c')](_0x229f4f['read1stAt'])?moment()[_0xc57f('0x62')](_0xc57f('0x63')):undefined});}return null;})['then'](function(_0x5d1af4){if(_0x5d1af4){_0xde7652[_0xc57f('0x6d')]=_0x5d1af4[_0xc57f('0x6e')]({'plain':!![]});interaction_log[_0xc57f('0x16')](_0xc57f('0x6f'),_0x554f03[_0xc57f('0x70')]['id'],_0x554f03['user'][_0xc57f('0x27')],_0x554f03['user'][_0xc57f('0x71')],_0xde7652['interaction']['id'],_0x554f03[_0xc57f('0x45')]?JSON[_0xc57f('0x64')](_0x554f03['body']):_0xc57f('0x72'));return respondWithRpcPromise('AcceptMessage',_0xc57f('0x73'),_0xde7652);}return null;})[_0xc57f('0x15')](function(_0x27c25a){var _0x111761=_0xc57f('0x74')+_0x27c25a[_0xc57f('0x1c')][_0xc57f('0x75')];return db['sequelize'][_0xc57f('0x2e')](_0x111761,{'type':db[_0xc57f('0x76')][_0xc57f('0x77')][_0xc57f('0x78')],'raw':!![]})['then'](function(_0x4b228b){return _0x4b228b;});})[_0xc57f('0x15')](function(_0x533751){if(_0x533751){_0xde7652[_0xc57f('0x1c')][_0xc57f('0x79')]=_0x533751[0x0];if(!_0x554f03[_0xc57f('0x45')][_0xc57f('0x7a')])return;return db[_0xc57f('0x7b')]['find']({'where':{'id':_0x554f03['body'][_0xc57f('0x7a')],'role':'agent'},'attributes':['id',_0xc57f('0x27'),_0xc57f('0x7c'),_0xc57f('0x7d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1624f4){if(!_0x1624f4)return null;_0xde7652[_0xc57f('0x1c')][_0xc57f('0x69')]=_0x1624f4;return _0xde7652;})[_0xc57f('0x15')](function(_0x47c3de){if(_0x47c3de){if(_0x554f03['body']['manual']){_0xde7652[_0xc57f('0x1c')][_0xc57f('0x7e')]=util[_0xc57f('0x62')](_0xc57f('0x7f'),_0x554f03[_0xc57f('0x70')][_0xc57f('0x27')]);_0xde7652[_0xc57f('0x1c')][_0xc57f('0x80')]=_0xde7652[_0xc57f('0x80')];_0xde7652[_0xc57f('0x1c')][_0xc57f('0x81')]=_0xde7652[_0xc57f('0x80')];_0xde7652[_0xc57f('0x1c')][_0xc57f('0x82')]=_0xc57f('0x65');_0xde7652[_0xc57f('0x1c')][_0xc57f('0x45')]=htmlToText[_0xc57f('0x83')](_0xde7652[_0xc57f('0x1c')][_0xc57f('0x45')]);return respondWithRpcPromise(_0xc57f('0x84'),_0xc57f('0x84'),{'event':_0xc57f('0x85'),'message':_0xde7652[_0xc57f('0x1c')]},client9002)[_0xc57f('0x15')](function(){return _0xde7652;});}return _0xde7652;}return null;})['then'](respondWithResult(_0x529f63,null))[_0xc57f('0x1d')](handleError(_0x529f63,null));};exports[_0xc57f('0x86')]=function(_0x5eac40,_0x405017){var _0x153ce3={'agent':{},'channel':_0xc57f('0x66')};if(_0x5eac40[_0xc57f('0x45')]['id']){delete _0x5eac40[_0xc57f('0x45')]['id'];}_0x5eac40[_0xc57f('0x45')][_0xc57f('0x7a')]=_0x5eac40[_0xc57f('0x45')][_0xc57f('0x7a')]||_0x5eac40[_0xc57f('0x70')]['id'];_0x153ce3[_0xc57f('0x69')]['id']=_0x5eac40[_0xc57f('0x45')][_0xc57f('0x7a')];return db[_0xc57f('0x29')][_0xc57f('0x43')]({'where':{'id':_0x5eac40['params']['id'],'UserId':null}})[_0xc57f('0x15')](handleEntityNotFound(_0x405017,null))[_0xc57f('0x15')](function(_0xaec06b){if(_0xaec06b){_0x153ce3['message']=_0xaec06b[_0xc57f('0x6e')]({'plain':!![]});return db['MailInteraction'][_0xc57f('0x43')]({'where':{'id':_0xaec06b[_0xc57f('0x6b')]}});}return null;})[_0xc57f('0x15')](handleEntityNotFound(_0x405017,null))[_0xc57f('0x15')](function(_0x1a9bc1){if(_0x1a9bc1){_0x153ce3[_0xc57f('0x6d')]=_0x1a9bc1[_0xc57f('0x6e')]({'plain':!![]});interaction_log[_0xc57f('0x16')](_0xc57f('0x87'),_0x5eac40['user']['id'],_0x5eac40[_0xc57f('0x70')][_0xc57f('0x27')],_0x5eac40['user']['role'],_0x153ce3['interaction']['id'],_0x5eac40[_0xc57f('0x45')]?JSON[_0xc57f('0x64')](_0x5eac40[_0xc57f('0x45')]):_0xc57f('0x72'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x153ce3);}return null;})[_0xc57f('0x15')](function(_0x2205a1){var _0x122202=_0xc57f('0x74')+_0x2205a1[_0xc57f('0x1c')][_0xc57f('0x75')];return db[_0xc57f('0x88')]['query'](_0x122202,{'type':db[_0xc57f('0x76')]['QueryTypes'][_0xc57f('0x78')],'raw':!![]})[_0xc57f('0x15')](function(_0x11e51a){return _0x11e51a;});})[_0xc57f('0x15')](function(_0x4ef4b5){if(_0x4ef4b5){_0x153ce3[_0xc57f('0x1c')]['contact']=_0x4ef4b5[0x0];if(!_0x5eac40[_0xc57f('0x45')][_0xc57f('0x7a')])return;return db[_0xc57f('0x7b')][_0xc57f('0x43')]({'where':{'id':_0x5eac40[_0xc57f('0x45')][_0xc57f('0x7a')],'role':'agent'},'attributes':['id',_0xc57f('0x27'),_0xc57f('0x7c'),'email',_0xc57f('0x89')],'raw':!![]});}return null;})[_0xc57f('0x15')](function(_0xbfe5d0){if(!_0xbfe5d0)return null;_0x153ce3['message']['agent']=_0xbfe5d0;return _0x153ce3;})[_0xc57f('0x15')](function(_0x310a0e){if(_0x310a0e){_0x310a0e[_0xc57f('0x1c')][_0xc57f('0x7e')]=util[_0xc57f('0x62')](_0xc57f('0x7f'),_0x5eac40[_0xc57f('0x70')][_0xc57f('0x27')]);_0x310a0e[_0xc57f('0x1c')]['channel']=_0x153ce3['channel'];_0x310a0e[_0xc57f('0x1c')][_0xc57f('0x81')]=_0x153ce3['channel'];_0x310a0e['message'][_0xc57f('0x82')]=_0xc57f('0x86');_0x310a0e[_0xc57f('0x1c')]['body']=htmlToText[_0xc57f('0x83')](_0x153ce3[_0xc57f('0x1c')]['body']);respondWithRpcPromise(_0xc57f('0x84'),_0xc57f('0x84'),{'event':_0xc57f('0x8a'),'message':_0x310a0e[_0xc57f('0x1c')]},client9002);return _0x153ce3;}return null;})['then'](respondWithResult(_0x405017,null))['catch'](handleError(_0x405017,null));};exports['download']=function(_0x35d831,_0x1bfd0f){var _0x3bd2d2=moment()[_0xc57f('0x8b')]()[_0xc57f('0x8c')]();var _0x554c04=path[_0xc57f('0x5a')](config[_0xc57f('0x5b')],_0xc57f('0x8d'),_0xc57f('0x8e'),_0xc57f('0x8f'));var _0x576f16=path['join'](config['root'],'server',_0xc57f('0x8e'),_0xc57f('0x59'));var _0x37ea76=util[_0xc57f('0x62')]('message-%s.eml',_0x3bd2d2);return db[_0xc57f('0x29')][_0xc57f('0x43')]({'where':{'id':_0x35d831[_0xc57f('0x41')]['id']},'attributes':['id','body','from','to','cc',_0xc57f('0x90'),_0xc57f('0x91'),_0xc57f('0x92')],'include':_0x35d831[_0xc57f('0x2e')][_0xc57f('0x59')]?[{'model':db[_0xc57f('0x93')],'as':_0xc57f('0x94')}]:undefined})['then'](handleEntityNotFound(_0x1bfd0f,null))[_0xc57f('0x15')](function(_0xab31fa){if(_0xab31fa){var _0x57ab5c=_0xab31fa;var _0xd0a966={'from':_0x57ab5c['from'],'to':_0x57ab5c['to'],'subject':_0x57ab5c[_0xc57f('0x91')],'html':htmlEntities[_0xc57f('0x95')](_0x57ab5c[_0xc57f('0x45')]),'headers':{'Date':moment(_0x57ab5c['createdAt'])['format'](_0xc57f('0x96'))},'attachments':[]};if(_0xab31fa['cc']){_0xd0a966['headers']['Cc']=_0xab31fa['cc'];}if(_0xab31fa[_0xc57f('0x90')]){_0xd0a966['headers'][_0xc57f('0x97')]=_0xab31fa[_0xc57f('0x90')];}return new BPromise(function(_0x3d8fab,_0x17f488){if(_0xab31fa[_0xc57f('0x94')]){for(var _0x353b11=0x0;_0x353b11<_0xab31fa[_0xc57f('0x94')][_0xc57f('0x42')];_0x353b11++){var _0x1e55c8=_0xab31fa[_0xc57f('0x94')][_0x353b11];var _0x55fe99=path[_0xc57f('0x5a')](_0x576f16,_0x1e55c8[_0xc57f('0x5d')]);if(fs[_0xc57f('0x98')](_0x55fe99)){_0xd0a966[_0xc57f('0x59')][_0xc57f('0x99')]({'name':_0x1e55c8[_0xc57f('0x27')],'contentType':_0x1e55c8['type'],'data':fs[_0xc57f('0x9a')](_0x55fe99)});}}}emlformat[_0xc57f('0x9b')](_0xd0a966,function(_0x344384,_0x5bed72){if(_0x344384)return _0x17f488(_0x344384);fs['writeFileSync'](path[_0xc57f('0x5a')](_0x554c04,_0x37ea76),_0x5bed72);return _0x3d8fab(_0x5bed72);});});}})[_0xc57f('0x15')](function(_0x286a84){if(_0x286a84){return _0x1bfd0f[_0xc57f('0x9c')](path[_0xc57f('0x5a')](_0x554c04,_0x37ea76),_0x37ea76,function(_0x509bfd){if(!_0x509bfd)fs[_0xc57f('0x9d')](path[_0xc57f('0x5a')](_0x554c04,_0x37ea76));});}})['catch'](handleError(_0x1bfd0f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8d72735..f57fae2 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 _0x9198=['events','../../mysqldb','MailMessage','update','remove','emit','hook'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x9198,0x15e));var _0x8919=function(_0x3023cc,_0x142de2){_0x3023cc=_0x3023cc-0x0;var _0x2f1998=_0x9198[_0x3023cc];return _0x2f1998;};'use strict';var EventEmitter=require(_0x8919('0x0'));var MailMessage=require(_0x8919('0x1'))['db'][_0x8919('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8919('0x3'),'afterDestroy':_0x8919('0x4')};function emitEvent(_0x5eb932){return function(_0x2445c9,_0x24eed7,_0x214b2e){MailMessageEvents[_0x8919('0x5')](_0x5eb932+':'+_0x2445c9['id'],_0x2445c9);MailMessageEvents[_0x8919('0x5')](_0x5eb932,_0x2445c9);_0x214b2e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8919('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xcf75=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','MailMessage'];(function(_0x1a299a,_0x1bd938){var _0x5b9573=function(_0x592eb5){while(--_0x592eb5){_0x1a299a['push'](_0x1a299a['shift']());}};_0x5b9573(++_0x1bd938);}(_0xcf75,0x1cf));var _0x5cf7=function(_0x4beb12,_0x7a4264){_0x4beb12=_0x4beb12-0x0;var _0x2999cc=_0xcf75[_0x4beb12];return _0x2999cc;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x5cf7('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5cf7('0x1')](0x0);var events={'afterCreate':_0x5cf7('0x2'),'afterUpdate':_0x5cf7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2ca2c6){return function(_0xbcc3a,_0x1a82a7,_0xb3125d){MailMessageEvents[_0x5cf7('0x4')](_0x2ca2c6+':'+_0xbcc3a['id'],_0xbcc3a);MailMessageEvents[_0x5cf7('0x4')](_0x2ca2c6,_0xbcc3a);_0xb3125d(null);};}for(var e in events){if(events[_0x5cf7('0x5')](e)){var event=events[e];MailMessage[_0x5cf7('0x6')](e,emitEvent(event));}}module[_0x5cf7('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index eac4cb5..e586a5d 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 _0xe9c5=['models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','body','fromString'];(function(_0x186263,_0x25840f){var _0x4afb3a=function(_0x55e976){while(--_0x55e976){_0x186263['push'](_0x186263['shift']());}};_0x4afb3a(++_0x25840f);}(_0xe9c5,0x113));var _0x5e9c=function(_0x1bde24,_0x2b79b1){_0x1bde24=_0x1bde24-0x0;var _0x44656d=_0xe9c5[_0x1bde24];return _0x44656d;};'use strict';var _=require(_0x5e9c('0x0'));var util=require('util');var logger=require(_0x5e9c('0x1'))(_0x5e9c('0x2'));var moment=require(_0x5e9c('0x3'));var BPromise=require(_0x5e9c('0x4'));var rp=require(_0x5e9c('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e9c('0x6'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x235ab5,_0x2e93aa){return _0x235ab5[_0x5e9c('0x7')](_0x5e9c('0x8'),attributes,{'tableName':_0x5e9c('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5e9c('0xa')]},{'name':'fti_mail_messages','fields':[_0x5e9c('0xb'),'subject'],'type':_0x5e9c('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x43df22,_0x52ec3f,_0x5429f6){if(_0x43df22[_0x5e9c('0xd')]){_0x43df22[_0x5e9c('0xb')]=htmlToText[_0x5e9c('0xe')](_0x43df22[_0x5e9c('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5429f6(null,_0x52ec3f);},'afterCreate':function(_0xcf5e92,_0x4dd98f,_0x4cd778){var _0x40974c=_0x235ab5[_0x5e9c('0xf')];var _0x3541c3=_0xcf5e92[_0x5e9c('0x10')]({'plain':!![]});if(_0x3541c3['direction']['toLowerCase']()==='in'||_0x3541c3[_0x5e9c('0x11')][_0x5e9c('0x12')]()===_0x5e9c('0x13')&&!_0x3541c3[_0x5e9c('0x14')]&&!_[_0x5e9c('0x15')](_0x3541c3[_0x5e9c('0x16')])){_0x40974c['MailInteraction']['findOne']({'where':{'id':_0x3541c3[_0x5e9c('0x17')]}})['then'](function(_0x1193b2){if(_0x1193b2){_0x1193b2[_0x5e9c('0x18')]({'lastMsgAt':_0x3541c3[_0x5e9c('0x19')],'lastMsgDirection':_0x3541c3[_0x5e9c('0x11')][_0x5e9c('0x12')]()});}})[_0x5e9c('0x1a')](function(_0x35d1d9){console[_0x5e9c('0x1b')](_0x35d1d9);});}_0x4cd778();}},'charset':'utf8mb4','collate':_0x5e9c('0x1c')});}; \ No newline at end of file +var _0xed91=['MailMessage','mail_messages','fti_mail_messages','subject','FULLTEXT','fromString','get','direction','toLowerCase','out','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xed91,0xfc));var _0x1ed9=function(_0x11f1c4,_0x50adf3){_0x11f1c4=_0x11f1c4-0x0;var _0x42cad0=_0xed91[_0x11f1c4];return _0x42cad0;};'use strict';var _=require(_0x1ed9('0x0'));var util=require('util');var logger=require(_0x1ed9('0x1'))('api');var moment=require(_0x1ed9('0x2'));var BPromise=require(_0x1ed9('0x3'));var rp=require(_0x1ed9('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x1ed9('0x5'));var rimraf=require('rimraf');var config=require(_0x1ed9('0x6'));var attributes=require('./mailMessage.attributes');module[_0x1ed9('0x7')]=function(_0x377698,_0x513ea8){return _0x377698[_0x1ed9('0x8')](_0x1ed9('0x9'),attributes,{'tableName':_0x1ed9('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x1ed9('0xb'),'fields':['plainBody',_0x1ed9('0xc')],'type':_0x1ed9('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x397fc5,_0x30c1a0,_0x21509f){if(_0x397fc5['body']){_0x397fc5['plainBody']=htmlToText[_0x1ed9('0xe')](_0x397fc5['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x21509f(null,_0x30c1a0);},'afterCreate':function(_0x2d469d,_0x41631f,_0x2eba86){var _0x246b79=_0x377698['models'];var _0x43c2fe=_0x2d469d[_0x1ed9('0xf')]({'plain':!![]});if(_0x43c2fe[_0x1ed9('0x10')][_0x1ed9('0x11')]()==='in'||_0x43c2fe[_0x1ed9('0x10')][_0x1ed9('0x11')]()===_0x1ed9('0x12')&&!_0x43c2fe['secret']&&!_[_0x1ed9('0x13')](_0x43c2fe[_0x1ed9('0x14')])){_0x246b79['MailInteraction'][_0x1ed9('0x15')]({'where':{'id':_0x43c2fe[_0x1ed9('0x16')]}})[_0x1ed9('0x17')](function(_0x155ffe){if(_0x155ffe){_0x155ffe[_0x1ed9('0x18')]({'lastMsgAt':_0x43c2fe[_0x1ed9('0x19')],'lastMsgDirection':_0x43c2fe[_0x1ed9('0x10')][_0x1ed9('0x11')]()});}})['catch'](function(_0x4d0dc9){console[_0x1ed9('0x1a')](_0x4d0dc9);});}_0x2eba86();}},'charset':_0x1ed9('0x1b'),'collate':_0x1ed9('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 00e4955..d5dc131 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 _0xfef3=['raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0xfef3,0x118));var _0x3fef=function(_0x151002,_0x1c9af6){_0x151002=_0x151002-0x0;var _0x1a7a58=_0xfef3[_0x151002];return _0x1a7a58;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});config[_0x3fef('0x9')]=_[_0x3fef('0xa')](config[_0x3fef('0x9')],{'host':_0x3fef('0xb'),'port':0x18eb});var socket=require(_0x3fef('0xc'))(new Redis(config[_0x3fef('0x9')]));require(_0x3fef('0xd'))[_0x3fef('0xe')](socket);function respondWithRpcPromise(_0x307586,_0x67cdd8,_0x16252b){return new BPromise(function(_0x1a7ef7,_0x7cc5b){return client['request'](_0x307586,_0x16252b)[_0x3fef('0xf')](function(_0x3560d9){logger[_0x3fef('0x10')]('MailMessage,\x20%s,\x20%s',_0x67cdd8,_0x3fef('0x11'));logger['debug'](_0x3fef('0x12'),_0x67cdd8,_0x3fef('0x11'),JSON[_0x3fef('0x13')](_0x3560d9));if(_0x3560d9['error']){if(_0x3560d9[_0x3fef('0x14')]['code']===0x1f4){logger[_0x3fef('0x14')](_0x3fef('0x15'),_0x67cdd8,_0x3560d9['error'][_0x3fef('0x16')]);return _0x7cc5b(_0x3560d9[_0x3fef('0x14')][_0x3fef('0x16')]);}logger[_0x3fef('0x14')](_0x3fef('0x15'),_0x67cdd8,_0x3560d9[_0x3fef('0x14')]['message']);return _0x1a7ef7(_0x3560d9[_0x3fef('0x14')][_0x3fef('0x16')]);}else{logger[_0x3fef('0x10')](_0x3fef('0x15'),_0x67cdd8,_0x3fef('0x11'));_0x1a7ef7(_0x3560d9[_0x3fef('0x17')]['message']);}})[_0x3fef('0x18')](function(_0x3eb287){logger['error'](_0x3fef('0x15'),_0x67cdd8,_0x3eb287);_0x7cc5b(_0x3eb287);});});}exports[_0x3fef('0x19')]=function(_0x42e095){var _0x218f91=this;return new Promise(function(_0x245332,_0x2b5226){return db[_0x3fef('0x1a')][_0x3fef('0x1b')](_0x42e095[_0x3fef('0x1c')],{'raw':_0x42e095[_0x3fef('0x1d')]?_0x42e095[_0x3fef('0x1d')][_0x3fef('0x1e')]===undefined?!![]:![]:!![]})[_0x3fef('0xf')](function(_0x39a8ea){logger[_0x3fef('0x10')]('CreateMailMessage',_0x42e095);logger['debug']('CreateMailMessage',_0x42e095,JSON[_0x3fef('0x13')](_0x39a8ea));_0x245332(_0x39a8ea);})[_0x3fef('0x18')](function(_0xa16dc){logger['error'](_0x3fef('0x19'),_0xa16dc['message'],_0x42e095);_0x2b5226(_0x218f91[_0x3fef('0x14')](0x1f4,_0xa16dc[_0x3fef('0x16')]));});});}; \ No newline at end of file +var _0x2da6=['defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','MailMessage','create','body','options','info','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4c54d5,_0x283312){var _0x29110b=function(_0x44cb06){while(--_0x44cb06){_0x4c54d5['push'](_0x4c54d5['shift']());}};_0x29110b(++_0x283312);}(_0x2da6,0x1dd));var _0x62da=function(_0x5f5cdc,_0x50293b){_0x5f5cdc=_0x5f5cdc-0x0;var _0x2819bf=_0x2da6[_0x5f5cdc];return _0x2819bf;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});config[_0x62da('0xc')]=_[_0x62da('0xd')](config[_0x62da('0xc')],{'host':_0x62da('0xe'),'port':0x18eb});var socket=require(_0x62da('0xf'))(new Redis(config['redis']));require(_0x62da('0x10'))[_0x62da('0x11')](socket);function respondWithRpcPromise(_0x2a3d7c,_0x1b68f8,_0x4cd5a2){return new BPromise(function(_0x241090,_0x3afe3b){return client[_0x62da('0x12')](_0x2a3d7c,_0x4cd5a2)[_0x62da('0x13')](function(_0x23be32){logger['info'](_0x62da('0x14'),_0x1b68f8,_0x62da('0x15'));logger[_0x62da('0x16')](_0x62da('0x17'),_0x1b68f8,_0x62da('0x15'),JSON['stringify'](_0x23be32));if(_0x23be32['error']){if(_0x23be32[_0x62da('0x18')][_0x62da('0x19')]===0x1f4){logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x3afe3b(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x241090(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x1b68f8,_0x62da('0x15'));_0x241090(_0x23be32['result'][_0x62da('0x1a')]);}})[_0x62da('0x1b')](function(_0x15b8d0){logger['error'](_0x62da('0x14'),_0x1b68f8,_0x15b8d0);_0x3afe3b(_0x15b8d0);});});}exports['CreateMailMessage']=function(_0x2e6b7e){var _0x37c15d=this;return new Promise(function(_0x3b90c8,_0x2f7b01){return db[_0x62da('0x1c')][_0x62da('0x1d')](_0x2e6b7e[_0x62da('0x1e')],{'raw':_0x2e6b7e[_0x62da('0x1f')]?_0x2e6b7e[_0x62da('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x62da('0x13')](function(_0x866a76){logger[_0x62da('0x20')](_0x62da('0x21'),_0x2e6b7e);logger[_0x62da('0x16')](_0x62da('0x21'),_0x2e6b7e,JSON[_0x62da('0x22')](_0x866a76));_0x3b90c8(_0x866a76);})['catch'](function(_0x55fd3b){logger['error'](_0x62da('0x21'),_0x55fd3b[_0x62da('0x1a')],_0x2e6b7e);_0x2f7b01(_0x37c15d[_0x62da('0x18')](0x1f4,_0x55fd3b[_0x62da('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 45eaf30..2ec4b23 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 _0xd21f=['length','mailMessage:','./mailMessage.events','save','remove','emit','register'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0xd21f,0x175));var _0xfd21=function(_0x2df413,_0x5303ae){_0x2df413=_0x2df413-0x0;var _0x1f5133=_0xd21f[_0x2df413];return _0x1f5133;};'use strict';var MailMessageEvents=require(_0xfd21('0x0'));var events=[_0xfd21('0x1'),_0xfd21('0x2'),'update'];function createListener(_0x19f891,_0x33c8e7){return function(_0x4df845){_0x33c8e7[_0xfd21('0x3')](_0x19f891,_0x4df845);};}function removeListener(_0x4e6d7d,_0xf3bf26){return function(){MailMessageEvents['removeListener'](_0x4e6d7d,_0xf3bf26);};}exports[_0xfd21('0x4')]=function(_0x3ecd51){for(var _0x45cec4=0x0,_0x3483a3=events[_0xfd21('0x5')];_0x45cec4<_0x3483a3;_0x45cec4++){var _0x2d57a9=events[_0x45cec4];var _0x27e47b=createListener(_0xfd21('0x6')+_0x2d57a9,_0x3ecd51);MailMessageEvents['on'](_0x2d57a9,_0x27e47b);}}; \ No newline at end of file +var _0xefe7=['./mailMessage.events','remove','update','emit','length','mailMessage:'];(function(_0x2632ce,_0x77e007){var _0x1e5fed=function(_0x39e3cb){while(--_0x39e3cb){_0x2632ce['push'](_0x2632ce['shift']());}};_0x1e5fed(++_0x77e007);}(_0xefe7,0x168));var _0x7efe=function(_0x4bd9c4,_0x5e0b48){_0x4bd9c4=_0x4bd9c4-0x0;var _0x4048d5=_0xefe7[_0x4bd9c4];return _0x4048d5;};'use strict';var MailMessageEvents=require(_0x7efe('0x0'));var events=['save',_0x7efe('0x1'),_0x7efe('0x2')];function createListener(_0x4986dc,_0x5901c0){return function(_0xb80e9c){_0x5901c0[_0x7efe('0x3')](_0x4986dc,_0xb80e9c);};}function removeListener(_0x5044d0,_0x1e380e){return function(){MailMessageEvents['removeListener'](_0x5044d0,_0x1e380e);};}exports['register']=function(_0x4183a6){for(var _0x43ac91=0x0,_0x6c7f38=events[_0x7efe('0x4')];_0x43ac91<_0x6c7f38;_0x43ac91++){var _0x56093c=events[_0x43ac91];var _0x3f24f3=createListener(_0x7efe('0x5')+_0x56093c,_0x4183a6);MailMessageEvents['on'](_0x56093c,_0x3f24f3);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 508b787..bf70019 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 _0x05c4=['getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0xb5e13f,_0x144237){var _0x12df97=function(_0x193184){while(--_0x193184){_0xb5e13f['push'](_0xb5e13f['shift']());}};_0x12df97(++_0x144237);}(_0x05c4,0x1ca));var _0x405c=function(_0x11fb70,_0x20e8e2){_0x11fb70=_0x11fb70-0x0;var _0x27500b=_0x05c4[_0x11fb70];return _0x27500b;};'use strict';var multer=require(_0x405c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x405c('0x1'));var express=require(_0x405c('0x2'));var router=express[_0x405c('0x3')]();var fs_extra=require(_0x405c('0x4'));var auth=require(_0x405c('0x5'));var interaction=require(_0x405c('0x6'));var config=require(_0x405c('0x7'));var controller=require(_0x405c('0x8'));router[_0x405c('0x9')]('/',auth[_0x405c('0xa')](),controller['index']);router[_0x405c('0x9')](_0x405c('0xb'),auth[_0x405c('0xa')](),controller[_0x405c('0xc')]);router[_0x405c('0x9')](_0x405c('0xd'),auth[_0x405c('0xa')](),controller['show']);router['get'](_0x405c('0xe'),auth[_0x405c('0xa')](),controller['getMembers']);router[_0x405c('0x9')](_0x405c('0xf'),auth[_0x405c('0xa')](),controller[_0x405c('0x10')]);router[_0x405c('0x9')](_0x405c('0x11'),auth['isAuthenticated'](),controller[_0x405c('0x12')]);router[_0x405c('0x13')]('/',auth[_0x405c('0xa')](),controller[_0x405c('0x14')]);router[_0x405c('0x13')](_0x405c('0xf'),auth[_0x405c('0xa')](),controller['addTeams']);router[_0x405c('0x13')](_0x405c('0x11'),auth['isAuthenticated'](),controller[_0x405c('0x15')]);router[_0x405c('0x16')](_0x405c('0xd'),auth[_0x405c('0xa')](),controller[_0x405c('0x17')]);router['delete']('/:id',auth[_0x405c('0xa')](),controller[_0x405c('0x18')]);router[_0x405c('0x19')](_0x405c('0xf'),auth[_0x405c('0xa')](),controller['removeTeams']);router[_0x405c('0x19')]('/:id/users',auth[_0x405c('0xa')](),controller[_0x405c('0x1a')]);module[_0x405c('0x1b')]=router; \ No newline at end of file +var _0xe163=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents'];(function(_0x20219a,_0x24a8b2){var _0x233a45=function(_0x1d167f){while(--_0x1d167f){_0x20219a['push'](_0x20219a['shift']());}};_0x233a45(++_0x24a8b2);}(_0xe163,0x101));var _0x3e16=function(_0x2dee32,_0x5b76b1){_0x2dee32=_0x2dee32-0x0;var _0x87d99f=_0xe163[_0x2dee32];return _0x87d99f;};'use strict';var multer=require(_0x3e16('0x0'));var util=require(_0x3e16('0x1'));var path=require(_0x3e16('0x2'));var timeout=require(_0x3e16('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e16('0x4'));var auth=require(_0x3e16('0x5'));var interaction=require(_0x3e16('0x6'));var config=require(_0x3e16('0x7'));var controller=require(_0x3e16('0x8'));router['get']('/',auth[_0x3e16('0x9')](),controller[_0x3e16('0xa')]);router[_0x3e16('0xb')](_0x3e16('0xc'),auth[_0x3e16('0x9')](),controller[_0x3e16('0xd')]);router['get'](_0x3e16('0xe'),auth[_0x3e16('0x9')](),controller[_0x3e16('0xf')]);router[_0x3e16('0xb')](_0x3e16('0x10'),auth[_0x3e16('0x9')](),controller[_0x3e16('0x11')]);router['get'](_0x3e16('0x12'),auth[_0x3e16('0x9')](),controller[_0x3e16('0x13')]);router['get'](_0x3e16('0x14'),auth[_0x3e16('0x9')](),controller[_0x3e16('0x15')]);router[_0x3e16('0x16')]('/',auth[_0x3e16('0x9')](),controller[_0x3e16('0x17')]);router[_0x3e16('0x16')](_0x3e16('0x12'),auth[_0x3e16('0x9')](),controller[_0x3e16('0x18')]);router['post'](_0x3e16('0x14'),auth[_0x3e16('0x9')](),controller[_0x3e16('0x19')]);router[_0x3e16('0x1a')](_0x3e16('0xe'),auth['isAuthenticated'](),controller[_0x3e16('0x1b')]);router[_0x3e16('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x3e16('0x1d')]);router[_0x3e16('0x1c')](_0x3e16('0x12'),auth[_0x3e16('0x9')](),controller['removeTeams']);router['delete'](_0x3e16('0x14'),auth[_0x3e16('0x9')](),controller[_0x3e16('0x1e')]);module[_0x3e16('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 646489b..05156b3 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 _0x70ea=['ENUM','rrmemory','roundrobin','STRING','name','INTEGER'];(function(_0x114dbf,_0x3dd101){var _0x5953c9=function(_0x39aeb0){while(--_0x39aeb0){_0x114dbf['push'](_0x114dbf['shift']());}};_0x5953c9(++_0x3dd101);}(_0x70ea,0x1d7));var _0xa70e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x70ea[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa70e('0x0')],'unique':_0xa70e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa70e('0x0')]},'timeout':{'type':Sequelize[_0xa70e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa70e('0x3')](_0xa70e('0x4'),'beepall',_0xa70e('0x5'))}}; \ No newline at end of file +var _0xad00=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x23c550,_0x7e41c4){var _0x5635b1=function(_0x68f9ce){while(--_0x68f9ce){_0x23c550['push'](_0x23c550['shift']());}};_0x5635b1(++_0x7e41c4);}(_0xad00,0x90));var _0x0ad0=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0xad00[_0x36fbef];return _0x45e270;};'use strict';var Sequelize=require(_0x0ad0('0x0'));module[_0x0ad0('0x1')]={'name':{'type':Sequelize[_0x0ad0('0x2')],'unique':_0x0ad0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0ad0('0x2')]},'timeout':{'type':Sequelize[_0x0ad0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0ad0('0x5')](_0x0ad0('0x6'),_0x0ad0('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 8c4e73e..094e9f1 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 _0xaac5=['removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','get','destroy','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','params','keys','find','catch','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','pick','MailQueueId','filter','User','findAndCountAll','mailPause','updatedAt','rows','%s/%s','createdAt','getTeams','Team','order','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty'];(function(_0x1cac94,_0x434b70){var _0x1d1983=function(_0x5e95cc){while(--_0x5e95cc){_0x1cac94['push'](_0x1cac94['shift']());}};_0x1d1983(++_0x434b70);}(_0xaac5,0x1b5));var _0x5aac=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xaac5[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5aac('0x0'));var zipdir=require(_0x5aac('0x1'));var jsonpatch=require(_0x5aac('0x2'));var rp=require(_0x5aac('0x3'));var moment=require(_0x5aac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5aac('0x5'));var util=require(_0x5aac('0x6'));var path=require(_0x5aac('0x7'));var sox=require(_0x5aac('0x8'));var csv=require(_0x5aac('0x9'));var ejs=require(_0x5aac('0xa'));var fs=require('fs');var fs_extra=require(_0x5aac('0xb'));var _=require(_0x5aac('0xc'));var squel=require('squel');var crypto=require(_0x5aac('0xd'));var jsforce=require(_0x5aac('0xe'));var deskjs=require(_0x5aac('0xf'));var toCsv=require(_0x5aac('0x9'));var querystring=require(_0x5aac('0x10'));var Papa=require(_0x5aac('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5aac('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5aac('0x13'));var logger=require(_0x5aac('0x14'))(_0x5aac('0x15'));var utils=require(_0x5aac('0x16'));var config=require(_0x5aac('0x17'));var licenseUtil=require(_0x5aac('0x18'));var db=require(_0x5aac('0x19'))['db'];config[_0x5aac('0x1a')]=_['defaults'](config[_0x5aac('0x1a')],{'host':_0x5aac('0x1b'),'port':0x18eb});var socket=require(_0x5aac('0x1c'))(new Redis(config[_0x5aac('0x1a')]));require(_0x5aac('0x1d'))[_0x5aac('0x1e')](socket);function respondWithStatusCode(_0x3dbb24,_0x5090ff){_0x5090ff=_0x5090ff||0xcc;return function(_0x331734){if(_0x331734){return _0x3dbb24[_0x5aac('0x1f')](_0x5090ff);}return _0x3dbb24[_0x5aac('0x20')](_0x5090ff)[_0x5aac('0x21')]();};}function respondWithResult(_0x28c5f6,_0x348c45){_0x348c45=_0x348c45||0xc8;return function(_0x1b991d){if(_0x1b991d){return _0x28c5f6['status'](_0x348c45)[_0x5aac('0x22')](_0x1b991d);}};}function respondWithFilteredResult(_0x22991c,_0xbcdbdf){return function(_0xef5217){if(_0xef5217){var _0x992b1a=typeof _0xbcdbdf['offset']===_0x5aac('0x23')&&typeof _0xbcdbdf[_0x5aac('0x24')]===_0x5aac('0x23');var _0x253e7c=_0xef5217[_0x5aac('0x25')];var _0x3e96dd=_0x992b1a?0x0:_0xbcdbdf[_0x5aac('0x26')];var _0x4f617a=_0x992b1a?_0xef5217[_0x5aac('0x25')]:_0xbcdbdf[_0x5aac('0x26')]+_0xbcdbdf['limit'];var _0x760c37;if(_0x4f617a>=_0x253e7c){_0x4f617a=_0x253e7c;_0x760c37=0xc8;}else{_0x760c37=0xce;}_0x22991c[_0x5aac('0x20')](_0x760c37);return _0x22991c[_0x5aac('0x27')](_0x5aac('0x28'),_0x3e96dd+'-'+_0x4f617a+'/'+_0x253e7c)[_0x5aac('0x22')](_0xef5217);}return null;};}function patchUpdates(_0x366387){return function(_0x1a5fbd){try{jsonpatch[_0x5aac('0x29')](_0x1a5fbd,_0x366387,!![]);}catch(_0x270b96){return BPromise['reject'](_0x270b96);}return _0x1a5fbd['save']();};}function saveUpdates(_0x171b82,_0x1510b3){return function(_0x2e4ed3){if(_0x2e4ed3){return _0x2e4ed3[_0x5aac('0x2a')](_0x171b82)['then'](function(_0x525a76){return _0x525a76;});}return null;};}function removeEntity(_0x24b8f1,_0x230bc3){return function(_0xe62ac1){if(_0xe62ac1){return _0xe62ac1['destroy']()[_0x5aac('0x2b')](function(){var _0x485612=_0xe62ac1[_0x5aac('0x2c')]({'plain':!![]});var _0x5f3915='MailQueues';return db['UserProfileResource'][_0x5aac('0x2d')]({'where':{'type':_0x5f3915,'resourceId':_0x485612['id']}})[_0x5aac('0x2b')](function(){return _0xe62ac1;});})[_0x5aac('0x2b')](function(){_0x24b8f1[_0x5aac('0x20')](0xcc)[_0x5aac('0x21')]();});}};}function handleEntityNotFound(_0x180fef,_0x9171cc){return function(_0x52432e){if(!_0x52432e){_0x180fef[_0x5aac('0x1f')](0x194);}return _0x52432e;};}function handleError(_0x5d0c0e,_0x43eb03){_0x43eb03=_0x43eb03||0x1f4;return function(_0x40b14c){logger['error'](_0x40b14c[_0x5aac('0x2e')]);if(_0x40b14c[_0x5aac('0x2f')]){delete _0x40b14c[_0x5aac('0x2f')];}_0x5d0c0e[_0x5aac('0x20')](_0x43eb03)[_0x5aac('0x30')](_0x40b14c);};}exports[_0x5aac('0x31')]=function(_0x201d68,_0x165ed8){var _0xd4d85c={},_0x391db0={},_0x3993ee={'count':0x0,'rows':[]};var _0x3051e1=_['map'](db[_0x5aac('0x32')][_0x5aac('0x33')],function(_0x1ac35e){return{'name':_0x1ac35e[_0x5aac('0x34')],'type':_0x1ac35e[_0x5aac('0x35')][_0x5aac('0x36')]};});_0x391db0[_0x5aac('0x37')]=_[_0x5aac('0x38')](_0x3051e1,_0x5aac('0x2f'));_0x391db0[_0x5aac('0x39')]=_['keys'](_0x201d68['query']);_0x391db0[_0x5aac('0x3a')]=_['intersection'](_0x391db0[_0x5aac('0x37')],_0x391db0[_0x5aac('0x39')]);_0xd4d85c[_0x5aac('0x3b')]=_[_0x5aac('0x3c')](_0x391db0['model'],qs[_0x5aac('0x3d')](_0x201d68['query'][_0x5aac('0x3d')]));_0xd4d85c['attributes']=_0xd4d85c['attributes'][_0x5aac('0x3e')]?_0xd4d85c[_0x5aac('0x3b')]:_0x391db0[_0x5aac('0x37')];if(!_0x201d68[_0x5aac('0x39')][_0x5aac('0x3f')](_0x5aac('0x40'))){_0xd4d85c[_0x5aac('0x24')]=qs[_0x5aac('0x24')](_0x201d68['query']['limit']);_0xd4d85c[_0x5aac('0x26')]=qs[_0x5aac('0x26')](_0x201d68[_0x5aac('0x39')][_0x5aac('0x26')]);}_0xd4d85c['order']=qs[_0x5aac('0x41')](_0x201d68[_0x5aac('0x39')]['sort']);_0xd4d85c[_0x5aac('0x42')]=qs[_0x5aac('0x3a')](_['pick'](_0x201d68['query'],_0x391db0[_0x5aac('0x3a')]),_0x3051e1);if(_0x201d68[_0x5aac('0x39')]['filter']){_0xd4d85c['where']=_[_0x5aac('0x43')](_0xd4d85c['where'],{'$or':_[_0x5aac('0x38')](_0x3051e1,function(_0x50d0de){if(_0x50d0de[_0x5aac('0x35')]!==_0x5aac('0x44')){var _0x34ef65={};_0x34ef65[_0x50d0de[_0x5aac('0x2f')]]={'$like':'%'+_0x201d68[_0x5aac('0x39')]['filter']+'%'};return _0x34ef65;}})});}_0xd4d85c=_['merge']({},_0xd4d85c,_0x201d68[_0x5aac('0x45')]);var _0x2a5fc7={'where':_0xd4d85c[_0x5aac('0x42')]};return db['MailQueue'][_0x5aac('0x25')](_0x2a5fc7)['then'](function(_0x55dea2){_0x3993ee[_0x5aac('0x25')]=_0x55dea2;if(_0x201d68[_0x5aac('0x39')]['includeAll']){_0xd4d85c[_0x5aac('0x46')]=[{'all':!![]}];}return db[_0x5aac('0x32')][_0x5aac('0x47')](_0xd4d85c);})[_0x5aac('0x2b')](function(_0x19ace6){_0x3993ee['rows']=_0x19ace6;return _0x3993ee;})[_0x5aac('0x2b')](respondWithFilteredResult(_0x165ed8,_0xd4d85c))['catch'](handleError(_0x165ed8,null));};exports['show']=function(_0x1bde32,_0x5419a5){var _0x479482={'raw':!![],'where':{'id':_0x1bde32[_0x5aac('0x48')]['id']}},_0x829f04={};_0x829f04[_0x5aac('0x37')]=_[_0x5aac('0x49')](db[_0x5aac('0x32')][_0x5aac('0x33')]);_0x829f04[_0x5aac('0x39')]=_[_0x5aac('0x49')](_0x1bde32[_0x5aac('0x39')]);_0x829f04[_0x5aac('0x3a')]=_[_0x5aac('0x3c')](_0x829f04[_0x5aac('0x37')],_0x829f04[_0x5aac('0x39')]);_0x479482['attributes']=_[_0x5aac('0x3c')](_0x829f04['model'],qs['fields'](_0x1bde32[_0x5aac('0x39')][_0x5aac('0x3d')]));_0x479482[_0x5aac('0x3b')]=_0x479482['attributes'][_0x5aac('0x3e')]?_0x479482[_0x5aac('0x3b')]:_0x829f04[_0x5aac('0x37')];if(_0x1bde32[_0x5aac('0x39')]['includeAll']){_0x479482[_0x5aac('0x46')]=[{'all':!![]}];}_0x479482=_['merge']({},_0x479482,_0x1bde32[_0x5aac('0x45')]);return db[_0x5aac('0x32')][_0x5aac('0x4a')](_0x479482)['then'](handleEntityNotFound(_0x5419a5,null))[_0x5aac('0x2b')](respondWithResult(_0x5419a5,null))[_0x5aac('0x4b')](handleError(_0x5419a5,null));};exports[_0x5aac('0x4c')]=function(_0x3abfe0,_0x5699d0){return db['MailQueue'][_0x5aac('0x4c')](_0x3abfe0[_0x5aac('0x4d')],{})['then'](function(_0x2e1456){var _0x148391=_0x3abfe0[_0x5aac('0x4e')]['get']({'plain':!![]});if(!_0x148391)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x148391[_0x5aac('0x4f')]==='user'){var _0x2c16d3=_0x2e1456[_0x5aac('0x2c')]({'plain':!![]});var _0x5ad188='MailQueues';return db[_0x5aac('0x50')][_0x5aac('0x4a')]({'where':{'name':_0x5ad188,'userProfileId':_0x148391[_0x5aac('0x51')]},'raw':!![]})[_0x5aac('0x2b')](function(_0x359247){if(_0x359247&&_0x359247['autoAssociation']===0x0){return db[_0x5aac('0x52')][_0x5aac('0x4c')]({'name':_0x2c16d3['name'],'resourceId':_0x2c16d3['id'],'type':_0x359247['name'],'sectionId':_0x359247['id']},{})[_0x5aac('0x2b')](function(){return _0x2e1456;});}else{return _0x2e1456;}})['catch'](function(_0x340c2f){logger[_0x5aac('0x53')](_0x5aac('0x54'),_0x340c2f);throw _0x340c2f;});}return _0x2e1456;})[_0x5aac('0x2b')](respondWithResult(_0x5699d0,0xc9))[_0x5aac('0x4b')](handleError(_0x5699d0,null));};exports[_0x5aac('0x2a')]=function(_0x43f8e0,_0x2e5824){if(_0x43f8e0[_0x5aac('0x4d')]['id']){delete _0x43f8e0[_0x5aac('0x4d')]['id'];}return db[_0x5aac('0x32')][_0x5aac('0x4a')]({'where':{'id':_0x43f8e0[_0x5aac('0x48')]['id']}})[_0x5aac('0x2b')](handleEntityNotFound(_0x2e5824,null))[_0x5aac('0x2b')](saveUpdates(_0x43f8e0[_0x5aac('0x4d')],null))[_0x5aac('0x2b')](respondWithResult(_0x2e5824,null))['catch'](handleError(_0x2e5824,null));};exports['destroy']=function(_0x136408,_0x31c7f7){return db['MailQueue']['find']({'where':{'id':_0x136408[_0x5aac('0x48')]['id']}})[_0x5aac('0x2b')](handleEntityNotFound(_0x31c7f7,null))['then'](removeEntity(_0x31c7f7,null))[_0x5aac('0x4b')](handleError(_0x31c7f7,null));};exports['describe']=function(_0x381800,_0x2383fa){return db[_0x5aac('0x32')][_0x5aac('0x55')]()[_0x5aac('0x2b')](respondWithResult(_0x2383fa,null))[_0x5aac('0x4b')](handleError(_0x2383fa,null));};exports[_0x5aac('0x56')]=function(_0x4659d2,_0x1f7b86,_0x220b0b){var _0x310445={'raw':!![],'where':{}},_0x36a426={},_0xa1bde3;return db['MailQueue'][_0x5aac('0x57')]({'where':{'id':_0x4659d2[_0x5aac('0x48')]['id']}})[_0x5aac('0x2b')](handleEntityNotFound(_0x1f7b86,null))['then'](function(_0x5a0366){if(_0x5a0366){_0xa1bde3=_0x5a0366[_0x5aac('0x2c')]({'plain':!![]});_0x36a426[_0x5aac('0x37')]=_['keys'](db[_0x5aac('0x58')]['rawAttributes']);_0x36a426[_0x5aac('0x39')]=_['keys'](_0x4659d2[_0x5aac('0x39')]);_0x36a426[_0x5aac('0x3a')]=_[_0x5aac('0x3c')](_0x36a426[_0x5aac('0x37')],_0x36a426['query']);_0x310445[_0x5aac('0x3b')]=_[_0x5aac('0x3c')](_0x36a426[_0x5aac('0x37')],qs[_0x5aac('0x3d')](_0x4659d2['query'][_0x5aac('0x3d')]));_0x310445[_0x5aac('0x3b')]=_0x310445[_0x5aac('0x3b')][_0x5aac('0x3e')]?_0x310445[_0x5aac('0x3b')]:_0x36a426['model'];if(!_0x4659d2[_0x5aac('0x39')]['hasOwnProperty'](_0x5aac('0x40'))){_0x310445['limit']=qs['limit'](_0x4659d2[_0x5aac('0x39')][_0x5aac('0x24')]);_0x310445['offset']=qs['offset'](_0x4659d2[_0x5aac('0x39')][_0x5aac('0x26')]);}_0x310445['order']=qs['sort'](_0x4659d2['query'][_0x5aac('0x41')]);_0x310445['where']=qs['filters'](_[_0x5aac('0x59')](_0x4659d2[_0x5aac('0x39')],_0x36a426[_0x5aac('0x3a')]));_0x310445[_0x5aac('0x42')][_0x5aac('0x5a')]=_0x5a0366['id'];if(_0x4659d2[_0x5aac('0x39')][_0x5aac('0x5b')]){_0x310445[_0x5aac('0x42')]=_[_0x5aac('0x43')](_0x310445['where'],{'$or':_['map'](_0x310445['attributes'],function(_0x42c18f){var _0x347eee={};_0x347eee[_0x42c18f]={'$like':'%'+_0x4659d2['query']['filter']+'%'};return _0x347eee;})});}_0x310445=_[_0x5aac('0x43')]({},_0x310445,_0x4659d2['options']);return db['UserMailQueue'][_0x5aac('0x47')](_0x310445);}})[_0x5aac('0x2b')](function(_0x991684){if(_0x991684){return db[_0x5aac('0x5c')][_0x5aac('0x5d')]({'where':{'id':_[_0x5aac('0x38')](_0x991684,'UserId'),'role':'agent'},'attributes':['id',_0x5aac('0x2f'),_0x5aac('0x5e'),_0x5aac('0x5f'),'createdAt']});}})[_0x5aac('0x2b')](function(_0x10ea25){if(_0x10ea25){return{'count':_0x10ea25[_0x5aac('0x25')],'rows':_['map'](_0x10ea25[_0x5aac('0x60')],function(_0x1e5cbb){return{'membername':_0x1e5cbb[_0x5aac('0x2f')],'UserId':_0x1e5cbb['id'],'queue_name':_0xa1bde3['name'],'MailQueueId':_0xa1bde3['id'],'interface':util['format'](_0x5aac('0x61'),'SIP',_0x1e5cbb[_0x5aac('0x2f')]),'penalty':0x0,'paused':_0x1e5cbb[_0x5aac('0x5e')],'createdAt':_0x1e5cbb[_0x5aac('0x62')],'updatedAt':_0x1e5cbb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5aac('0x2b')](respondWithFilteredResult(_0x1f7b86,_0x310445))[_0x5aac('0x4b')](handleError(_0x1f7b86,null));};exports[_0x5aac('0x63')]=function(_0x35db7f,_0xce6c04,_0x49a619){var _0x5d4662={};var _0x2d9ca1={};var _0x472aef;var _0x310c75;return db['MailQueue'][_0x5aac('0x57')]({'where':{'id':_0x35db7f[_0x5aac('0x48')]['id']}})[_0x5aac('0x2b')](handleEntityNotFound(_0xce6c04,null))[_0x5aac('0x2b')](function(_0x1d9267){if(_0x1d9267){_0x472aef=_0x1d9267;_0x2d9ca1[_0x5aac('0x37')]=_[_0x5aac('0x49')](db[_0x5aac('0x64')][_0x5aac('0x33')]);_0x2d9ca1[_0x5aac('0x39')]=_[_0x5aac('0x49')](_0x35db7f['query']);_0x2d9ca1[_0x5aac('0x3a')]=_[_0x5aac('0x3c')](_0x2d9ca1['model'],_0x2d9ca1[_0x5aac('0x39')]);_0x5d4662[_0x5aac('0x3b')]=_['intersection'](_0x2d9ca1[_0x5aac('0x37')],qs[_0x5aac('0x3d')](_0x35db7f[_0x5aac('0x39')][_0x5aac('0x3d')]));_0x5d4662[_0x5aac('0x3b')]=_0x5d4662['attributes'][_0x5aac('0x3e')]?_0x5d4662[_0x5aac('0x3b')]:_0x2d9ca1[_0x5aac('0x37')];_0x5d4662[_0x5aac('0x65')]=qs[_0x5aac('0x41')](_0x35db7f[_0x5aac('0x39')][_0x5aac('0x41')]);_0x5d4662[_0x5aac('0x42')]=qs['filters'](_['pick'](_0x35db7f[_0x5aac('0x39')],_0x2d9ca1[_0x5aac('0x3a')]));if(_0x35db7f[_0x5aac('0x39')][_0x5aac('0x5b')]){_0x5d4662[_0x5aac('0x42')]=_['merge'](_0x5d4662['where'],{'$or':_[_0x5aac('0x38')](_0x5d4662[_0x5aac('0x3b')],function(_0x1cf04b){var _0x2d424f={};_0x2d424f[_0x1cf04b]={'$like':'%'+_0x35db7f[_0x5aac('0x39')][_0x5aac('0x5b')]+'%'};return _0x2d424f;})});}_0x5d4662=_[_0x5aac('0x43')]({},_0x5d4662,_0x35db7f[_0x5aac('0x45')]);return _0x472aef[_0x5aac('0x63')](_0x5d4662);}})[_0x5aac('0x2b')](function(_0x45a3fb){if(_0x45a3fb){_0x310c75=_0x45a3fb[_0x5aac('0x3e')];if(!_0x35db7f[_0x5aac('0x39')][_0x5aac('0x3f')](_0x5aac('0x40'))){_0x5d4662['limit']=qs[_0x5aac('0x24')](_0x35db7f['query'][_0x5aac('0x24')]);_0x5d4662['offset']=qs[_0x5aac('0x26')](_0x35db7f['query'][_0x5aac('0x26')]);}return _0x472aef[_0x5aac('0x63')](_0x5d4662);}})[_0x5aac('0x2b')](function(_0x7c58ec){if(_0x7c58ec){return _0x7c58ec?{'count':_0x310c75,'rows':_0x7c58ec}:null;}})[_0x5aac('0x2b')](respondWithResult(_0xce6c04,null))['catch'](handleError(_0xce6c04,null));};exports['addTeams']=function(_0x463c36,_0x22c61d,_0x343f02){var _0x269ae3=_0x463c36['body']['ids'];return db[_0x5aac('0x64')][_0x5aac('0x47')]({'where':{'id':_0x269ae3},'attributes':['id'],'include':[{'model':db[_0x5aac('0x5c')],'as':_0x5aac('0x66'),'attributes':['id',_0x5aac('0x2f'),_0x5aac('0x67'),_0x5aac('0x68'),_0x5aac('0x69')],'raw':!![]}]})[_0x5aac('0x2b')](function(_0x5cb1c0){if(_0x5cb1c0){var _0x435a2a=_[_0x5aac('0x6a')](_0x5cb1c0,function(_0x270b80){var _0x4989da=_0x270b80['get']({'plain':!![]});return _0x4989da[_0x5aac('0x66')];});return db['MailQueue']['find']({'where':{'id':_0x463c36[_0x5aac('0x48')]['id']}})[_0x5aac('0x2b')](function(_0x5edd0d){return db[_0x5aac('0x6b')][_0x5aac('0x6c')](function(_0x5486f1){return _0x5edd0d[_0x5aac('0x6d')](_0x269ae3,{'transaction':_0x5486f1})[_0x5aac('0x2b')](function(){return BPromise['each'](_0x435a2a,function(_0xd9a3b2){return db[_0x5aac('0x58')]['findOrCreate']({'where':{'UserId':_0xd9a3b2['id'],'MailQueueId':_0x463c36[_0x5aac('0x48')]['id']},'transaction':_0x5486f1});});})[_0x5aac('0x2b')](function(){_0x435a2a['forEach'](function(_0x3e0491){socket[_0x5aac('0x6e')](_0x5aac('0x6f'),{'UserId':_0x3e0491['id'],'MailQueueId':_0x5edd0d['id']});});});});});}})[_0x5aac('0x2b')](respondWithStatusCode(_0x22c61d,null))['catch'](handleError(_0x22c61d,null));};exports[_0x5aac('0x70')]=function(_0x3460b5,_0xefb92a,_0x2bd302){return db[_0x5aac('0x64')][_0x5aac('0x47')]({'where':{'id':_0x3460b5[_0x5aac('0x39')][_0x5aac('0x71')]},'attributes':['id'],'include':[{'model':db[_0x5aac('0x5c')],'as':_0x5aac('0x66'),'attributes':['id'],'raw':!![]}]})[_0x5aac('0x2b')](handleEntityNotFound(_0xefb92a,null))[_0x5aac('0x2b')](function(_0x47b8aa){var _0x321dda=_['map'](_0x47b8aa,'id');var _0x952088=[];var _0x3ed6d5=[];var _0x13114e=squel[_0x5aac('0x72')]();_0x13114e[_0x5aac('0x73')](_0x5aac('0x74'))[_0x5aac('0x75')](_0x5aac('0x76'),'tq')[_0x5aac('0x77')](_0x5aac('0x78'),'ut',_0x5aac('0x79'))[_0x5aac('0x42')](_0x5aac('0x7a'),_0x3460b5['params']['id']);for(var _0x460c35=0x0;_0x460c35<_0x47b8aa[_0x5aac('0x3e')];_0x460c35+=0x1){let _0x51c967=_0x47b8aa[_0x460c35];for(var _0x1d5b30=0x0;_0x1d5b30<_0x51c967[_0x5aac('0x66')][_0x5aac('0x3e')];_0x1d5b30+=0x1){let _0x1d12d2=_0x51c967[_0x5aac('0x66')][_0x1d5b30];var _0x9ebb9a=_0x13114e[_0x5aac('0x7b')]();_0x9ebb9a[_0x5aac('0x42')]('ut.UserId\x20=\x20?',_0x1d12d2['id']);_0x3ed6d5[_0x5aac('0x7c')](db[_0x5aac('0x6b')]['query'](_0x9ebb9a[_0x5aac('0x7d')](),{'type':db[_0x5aac('0x6b')][_0x5aac('0x7e')][_0x5aac('0x7f')]})[_0x5aac('0x2b')](function(_0x199ceb){if(_0x199ceb[_0x5aac('0x3e')]===0x1){return _0x1d12d2['id'];}else{var _0x3dbd42=_[_0x5aac('0x80')](_[_0x5aac('0x38')](_0x199ceb,'TeamId'),function(_0x7f9116){return _[_0x5aac('0x81')](_0x321dda,_0x7f9116);});if(_0x3dbd42){return _0x1d12d2['id'];}}}));}}return BPromise[_0x5aac('0x82')](_0x3ed6d5)[_0x5aac('0x2b')](function(_0x7c0f84){_0x952088=_(_0x952088)[_0x5aac('0x83')](_0x7c0f84)[_0x5aac('0x84')]()[_0x5aac('0x85')]();return db['MailQueue'][_0x5aac('0x4a')]({'where':{'id':_0x3460b5[_0x5aac('0x48')]['id']}})[_0x5aac('0x2b')](function(_0x576d90){return db[_0x5aac('0x6b')][_0x5aac('0x6c')](function(_0x2371a1){return _0x576d90[_0x5aac('0x70')](_0x3460b5[_0x5aac('0x39')]['ids'],{'transaction':_0x2371a1})[_0x5aac('0x2b')](function(){if(!_[_0x5aac('0x86')](_0x952088)){return _0x576d90[_0x5aac('0x87')](_0x952088,{'transaction':_0x2371a1});}})[_0x5aac('0x2b')](function(){_0x952088[_0x5aac('0x88')](function(_0x4f6ac1){socket[_0x5aac('0x6e')](_0x5aac('0x89'),{'UserId':_0x4f6ac1,'MailQueueId':_0x576d90['id']});});});});});});})['then'](respondWithStatusCode(_0xefb92a,null))[_0x5aac('0x4b')](handleError(_0xefb92a,null));};exports[_0x5aac('0x8a')]=function(_0x57ec82,_0x3b38b7,_0x2da0aa){return db[_0x5aac('0x32')][_0x5aac('0x4a')]({'where':{'id':_0x57ec82[_0x5aac('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b38b7,null))[_0x5aac('0x2b')](function(_0x43b68e){if(_0x43b68e){return _0x43b68e[_0x5aac('0x8a')](_0x57ec82[_0x5aac('0x4d')][_0x5aac('0x71')],_[_0x5aac('0x8b')](_0x57ec82[_0x5aac('0x4d')],[_0x5aac('0x71'),'id'])||{})[_0x5aac('0x8c')](function(_0x577323){for(var _0x42aeee=0x0;_0x42aeee<_0x57ec82[_0x5aac('0x4d')][_0x5aac('0x71')]['length'];_0x42aeee+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x57ec82['body'][_0x5aac('0x71')][_0x42aeee]),'MailQueueId':Number(_0x57ec82['params']['id'])});}return _0x577323;});}})[_0x5aac('0x2b')](respondWithResult(_0x3b38b7,null))[_0x5aac('0x4b')](handleError(_0x3b38b7,null));};exports['removeAgents']=function(_0x334f42,_0x509f60,_0x18bf64){return db[_0x5aac('0x32')][_0x5aac('0x4a')]({'where':{'id':_0x334f42[_0x5aac('0x48')]['id']}})['then'](handleEntityNotFound(_0x509f60,null))[_0x5aac('0x2b')](function(_0x34d917){if(_0x34d917){return _0x34d917['removeAgents'](_0x334f42[_0x5aac('0x39')]['ids'])[_0x5aac('0x2b')](function(){if(_[_0x5aac('0x8d')](_0x334f42[_0x5aac('0x39')][_0x5aac('0x71')])){for(var _0x4d9ba4=0x0;_0x4d9ba4<_0x334f42[_0x5aac('0x39')]['ids']['length'];_0x4d9ba4+=0x1){socket[_0x5aac('0x6e')](_0x5aac('0x89'),{'UserId':Number(_0x334f42[_0x5aac('0x39')][_0x5aac('0x71')][_0x4d9ba4]),'MailQueueId':Number(_0x334f42[_0x5aac('0x48')]['id'])});}}else{socket['emit'](_0x5aac('0x89'),{'UserId':Number(_0x334f42[_0x5aac('0x39')]['ids']),'MailQueueId':Number(_0x334f42[_0x5aac('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x509f60,null))['catch'](handleError(_0x509f60,null));};exports[_0x5aac('0x8e')]=function(_0xa1d670,_0x522efc,_0x53a611){var _0x31bee4={};var _0x2678df={};var _0x2cbd04;var _0x352ae5;return db[_0x5aac('0x32')][_0x5aac('0x57')]({'where':{'id':_0xa1d670[_0x5aac('0x48')]['id']}})['then'](handleEntityNotFound(_0x522efc,null))[_0x5aac('0x2b')](function(_0xbcdb85){if(_0xbcdb85){_0x2cbd04=_0xbcdb85;_0x2678df[_0x5aac('0x37')]=_[_0x5aac('0x49')](db[_0x5aac('0x5c')][_0x5aac('0x33')]);_0x2678df['query']=_[_0x5aac('0x49')](_0xa1d670[_0x5aac('0x39')]);_0x2678df[_0x5aac('0x3a')]=_[_0x5aac('0x3c')](_0x2678df[_0x5aac('0x37')],_0x2678df[_0x5aac('0x39')]);_0x31bee4[_0x5aac('0x3b')]=_['intersection'](_0x2678df[_0x5aac('0x37')],qs['fields'](_0xa1d670[_0x5aac('0x39')][_0x5aac('0x3d')]));_0x31bee4[_0x5aac('0x3b')]=_0x31bee4[_0x5aac('0x3b')][_0x5aac('0x3e')]?_0x31bee4[_0x5aac('0x3b')]:_0x2678df[_0x5aac('0x37')];_0x31bee4[_0x5aac('0x65')]=qs[_0x5aac('0x41')](_0xa1d670[_0x5aac('0x39')][_0x5aac('0x41')]);_0x31bee4[_0x5aac('0x42')]=qs[_0x5aac('0x3a')](_[_0x5aac('0x59')](_0xa1d670[_0x5aac('0x39')],_0x2678df['filters']));if(_0xa1d670[_0x5aac('0x39')][_0x5aac('0x5b')]){_0x31bee4[_0x5aac('0x42')]=_[_0x5aac('0x43')](_0x31bee4[_0x5aac('0x42')],{'$or':_['map'](_0x31bee4[_0x5aac('0x3b')],function(_0x4844ab){var _0x12aa7b={};_0x12aa7b[_0x4844ab]={'$like':'%'+_0xa1d670[_0x5aac('0x39')][_0x5aac('0x5b')]+'%'};return _0x12aa7b;})});}_0x31bee4=_['merge']({},_0x31bee4,_0xa1d670[_0x5aac('0x45')]);return _0x2cbd04['getAgents'](_0x31bee4);}})['then'](function(_0x232f3c){if(_0x232f3c){_0x352ae5=_0x232f3c['length'];if(!_0xa1d670[_0x5aac('0x39')]['hasOwnProperty'](_0x5aac('0x40'))){_0x31bee4['limit']=qs[_0x5aac('0x24')](_0xa1d670[_0x5aac('0x39')][_0x5aac('0x24')]);_0x31bee4[_0x5aac('0x26')]=qs[_0x5aac('0x26')](_0xa1d670[_0x5aac('0x39')][_0x5aac('0x26')]);}return _0x2cbd04[_0x5aac('0x8e')](_0x31bee4);}})[_0x5aac('0x2b')](function(_0x3064b0){if(_0x3064b0){return _0x3064b0?{'count':_0x352ae5,'rows':_0x3064b0}:null;}})[_0x5aac('0x2b')](respondWithResult(_0x522efc,null))[_0x5aac('0x4b')](handleError(_0x522efc,null));}; \ No newline at end of file +var _0x7a8b=['mailPause','createdAt','updatedAt','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','get','UserProfileResource','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAndCountAll','UserId','agent','format','%s/%s'];(function(_0x3e904f,_0x3c034a){var _0x41b341=function(_0x5b57b2){while(--_0x5b57b2){_0x3e904f['push'](_0x3e904f['shift']());}};_0x41b341(++_0x3c034a);}(_0x7a8b,0x14a));var _0xb7a8=function(_0xd19cc9,_0x3e8193){_0xd19cc9=_0xd19cc9-0x0;var _0xba8445=_0x7a8b[_0xd19cc9];return _0xba8445;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7a8('0x0'));var zipdir=require(_0xb7a8('0x1'));var jsonpatch=require(_0xb7a8('0x2'));var rp=require(_0xb7a8('0x3'));var moment=require(_0xb7a8('0x4'));var BPromise=require(_0xb7a8('0x5'));var Mustache=require('mustache');var util=require(_0xb7a8('0x6'));var path=require(_0xb7a8('0x7'));var sox=require('sox');var csv=require(_0xb7a8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7a8('0x9'));var squel=require('squel');var crypto=require(_0xb7a8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb7a8('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb7a8('0xc'));var Papa=require('papaparse');var Redis=require(_0xb7a8('0xd'));var authService=require(_0xb7a8('0xe'));var qs=require(_0xb7a8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7a8('0x10'));var logger=require(_0xb7a8('0x11'))(_0xb7a8('0x12'));var utils=require(_0xb7a8('0x13'));var config=require(_0xb7a8('0x14'));var licenseUtil=require(_0xb7a8('0x15'));var db=require(_0xb7a8('0x16'))['db'];config[_0xb7a8('0x17')]=_[_0xb7a8('0x18')](config[_0xb7a8('0x17')],{'host':_0xb7a8('0x19'),'port':0x18eb});var socket=require(_0xb7a8('0x1a'))(new Redis(config[_0xb7a8('0x17')]));require('./mailQueue.socket')[_0xb7a8('0x1b')](socket);function respondWithStatusCode(_0x5dd812,_0x5d7d87){_0x5d7d87=_0x5d7d87||0xcc;return function(_0x78dfce){if(_0x78dfce){return _0x5dd812[_0xb7a8('0x1c')](_0x5d7d87);}return _0x5dd812[_0xb7a8('0x1d')](_0x5d7d87)[_0xb7a8('0x1e')]();};}function respondWithResult(_0x5caf59,_0x5276da){_0x5276da=_0x5276da||0xc8;return function(_0x105bbf){if(_0x105bbf){return _0x5caf59['status'](_0x5276da)[_0xb7a8('0x1f')](_0x105bbf);}};}function respondWithFilteredResult(_0x3980a8,_0x1db323){return function(_0xdcd11a){if(_0xdcd11a){var _0x4a8a21=typeof _0x1db323[_0xb7a8('0x20')]===_0xb7a8('0x21')&&typeof _0x1db323[_0xb7a8('0x22')]===_0xb7a8('0x21');var _0x5c27c6=_0xdcd11a[_0xb7a8('0x23')];var _0x5c8bf8=_0x4a8a21?0x0:_0x1db323[_0xb7a8('0x20')];var _0x480d1a=_0x4a8a21?_0xdcd11a[_0xb7a8('0x23')]:_0x1db323[_0xb7a8('0x20')]+_0x1db323[_0xb7a8('0x22')];var _0x548216;if(_0x480d1a>=_0x5c27c6){_0x480d1a=_0x5c27c6;_0x548216=0xc8;}else{_0x548216=0xce;}_0x3980a8[_0xb7a8('0x1d')](_0x548216);return _0x3980a8['set'](_0xb7a8('0x24'),_0x5c8bf8+'-'+_0x480d1a+'/'+_0x5c27c6)[_0xb7a8('0x1f')](_0xdcd11a);}return null;};}function patchUpdates(_0xe180b7){return function(_0x238877){try{jsonpatch[_0xb7a8('0x25')](_0x238877,_0xe180b7,!![]);}catch(_0x350602){return BPromise['reject'](_0x350602);}return _0x238877['save']();};}function saveUpdates(_0x105747,_0x5de639){return function(_0x4348ed){if(_0x4348ed){return _0x4348ed[_0xb7a8('0x26')](_0x105747)[_0xb7a8('0x27')](function(_0x199413){return _0x199413;});}return null;};}function removeEntity(_0x2b5088,_0x304272){return function(_0x5ed424){if(_0x5ed424){return _0x5ed424['destroy']()[_0xb7a8('0x27')](function(){var _0x4aaaf2=_0x5ed424[_0xb7a8('0x28')]({'plain':!![]});var _0x5b1c5c='MailQueues';return db[_0xb7a8('0x29')]['destroy']({'where':{'type':_0x5b1c5c,'resourceId':_0x4aaaf2['id']}})[_0xb7a8('0x27')](function(){return _0x5ed424;});})[_0xb7a8('0x27')](function(){_0x2b5088[_0xb7a8('0x1d')](0xcc)[_0xb7a8('0x1e')]();});}};}function handleEntityNotFound(_0x3de287,_0x2b655a){return function(_0x10a53b){if(!_0x10a53b){_0x3de287[_0xb7a8('0x1c')](0x194);}return _0x10a53b;};}function handleError(_0x1a837f,_0x1f410c){_0x1f410c=_0x1f410c||0x1f4;return function(_0x22bd3d){logger['error'](_0x22bd3d[_0xb7a8('0x2a')]);if(_0x22bd3d['name']){delete _0x22bd3d[_0xb7a8('0x2b')];}_0x1a837f['status'](_0x1f410c)[_0xb7a8('0x2c')](_0x22bd3d);};}exports[_0xb7a8('0x2d')]=function(_0x46b4a3,_0xf8f0e2){var _0xa8417b={},_0x427cc6={},_0x5a6e1a={'count':0x0,'rows':[]};var _0x41f8b6=_[_0xb7a8('0x2e')](db['MailQueue']['rawAttributes'],function(_0x43ef79){return{'name':_0x43ef79[_0xb7a8('0x2f')],'type':_0x43ef79['type'][_0xb7a8('0x30')]};});_0x427cc6[_0xb7a8('0x31')]=_[_0xb7a8('0x2e')](_0x41f8b6,'name');_0x427cc6[_0xb7a8('0x32')]=_[_0xb7a8('0x33')](_0x46b4a3[_0xb7a8('0x32')]);_0x427cc6[_0xb7a8('0x34')]=_['intersection'](_0x427cc6['model'],_0x427cc6['query']);_0xa8417b[_0xb7a8('0x35')]=_[_0xb7a8('0x36')](_0x427cc6[_0xb7a8('0x31')],qs['fields'](_0x46b4a3[_0xb7a8('0x32')][_0xb7a8('0x37')]));_0xa8417b[_0xb7a8('0x35')]=_0xa8417b['attributes'][_0xb7a8('0x38')]?_0xa8417b[_0xb7a8('0x35')]:_0x427cc6[_0xb7a8('0x31')];if(!_0x46b4a3[_0xb7a8('0x32')][_0xb7a8('0x39')](_0xb7a8('0x3a'))){_0xa8417b[_0xb7a8('0x22')]=qs[_0xb7a8('0x22')](_0x46b4a3['query'][_0xb7a8('0x22')]);_0xa8417b['offset']=qs['offset'](_0x46b4a3[_0xb7a8('0x32')][_0xb7a8('0x20')]);}_0xa8417b[_0xb7a8('0x3b')]=qs['sort'](_0x46b4a3['query'][_0xb7a8('0x3c')]);_0xa8417b[_0xb7a8('0x3d')]=qs[_0xb7a8('0x34')](_[_0xb7a8('0x3e')](_0x46b4a3[_0xb7a8('0x32')],_0x427cc6['filters']),_0x41f8b6);if(_0x46b4a3['query'][_0xb7a8('0x3f')]){_0xa8417b[_0xb7a8('0x3d')]=_['merge'](_0xa8417b['where'],{'$or':_['map'](_0x41f8b6,function(_0x8bca47){if(_0x8bca47[_0xb7a8('0x40')]!==_0xb7a8('0x41')){var _0x136d56={};_0x136d56[_0x8bca47[_0xb7a8('0x2b')]]={'$like':'%'+_0x46b4a3[_0xb7a8('0x32')][_0xb7a8('0x3f')]+'%'};return _0x136d56;}})});}_0xa8417b=_['merge']({},_0xa8417b,_0x46b4a3[_0xb7a8('0x42')]);var _0x4e7b58={'where':_0xa8417b[_0xb7a8('0x3d')]};return db[_0xb7a8('0x43')]['count'](_0x4e7b58)['then'](function(_0x3bd129){_0x5a6e1a[_0xb7a8('0x23')]=_0x3bd129;if(_0x46b4a3['query'][_0xb7a8('0x44')]){_0xa8417b[_0xb7a8('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0xb7a8('0x46')](_0xa8417b);})[_0xb7a8('0x27')](function(_0x183fdd){_0x5a6e1a[_0xb7a8('0x47')]=_0x183fdd;return _0x5a6e1a;})['then'](respondWithFilteredResult(_0xf8f0e2,_0xa8417b))[_0xb7a8('0x48')](handleError(_0xf8f0e2,null));};exports[_0xb7a8('0x49')]=function(_0x4700b9,_0x26c51c){var _0x13bbc6={'raw':!![],'where':{'id':_0x4700b9['params']['id']}},_0x553471={};_0x553471['model']=_[_0xb7a8('0x33')](db['MailQueue'][_0xb7a8('0x4a')]);_0x553471[_0xb7a8('0x32')]=_[_0xb7a8('0x33')](_0x4700b9['query']);_0x553471[_0xb7a8('0x34')]=_[_0xb7a8('0x36')](_0x553471[_0xb7a8('0x31')],_0x553471[_0xb7a8('0x32')]);_0x13bbc6['attributes']=_[_0xb7a8('0x36')](_0x553471[_0xb7a8('0x31')],qs['fields'](_0x4700b9[_0xb7a8('0x32')][_0xb7a8('0x37')]));_0x13bbc6[_0xb7a8('0x35')]=_0x13bbc6[_0xb7a8('0x35')][_0xb7a8('0x38')]?_0x13bbc6[_0xb7a8('0x35')]:_0x553471[_0xb7a8('0x31')];if(_0x4700b9[_0xb7a8('0x32')]['includeAll']){_0x13bbc6[_0xb7a8('0x45')]=[{'all':!![]}];}_0x13bbc6=_[_0xb7a8('0x4b')]({},_0x13bbc6,_0x4700b9[_0xb7a8('0x42')]);return db[_0xb7a8('0x43')][_0xb7a8('0x4c')](_0x13bbc6)[_0xb7a8('0x27')](handleEntityNotFound(_0x26c51c,null))['then'](respondWithResult(_0x26c51c,null))[_0xb7a8('0x48')](handleError(_0x26c51c,null));};exports['create']=function(_0x578346,_0x7c71){return db[_0xb7a8('0x43')]['create'](_0x578346['body'],{})[_0xb7a8('0x27')](function(_0x9b53bb){var _0x4f735d=_0x578346[_0xb7a8('0x4d')]['get']({'plain':!![]});if(!_0x4f735d)throw new Error(_0xb7a8('0x4e'));if(_0x4f735d[_0xb7a8('0x4f')]===_0xb7a8('0x4d')){var _0x1cc00a=_0x9b53bb[_0xb7a8('0x28')]({'plain':!![]});var _0x4c7186=_0xb7a8('0x50');return db[_0xb7a8('0x51')][_0xb7a8('0x4c')]({'where':{'name':_0x4c7186,'userProfileId':_0x4f735d[_0xb7a8('0x52')]},'raw':!![]})['then'](function(_0x3122a6){if(_0x3122a6&&_0x3122a6['autoAssociation']===0x0){return db['UserProfileResource'][_0xb7a8('0x53')]({'name':_0x1cc00a['name'],'resourceId':_0x1cc00a['id'],'type':_0x3122a6[_0xb7a8('0x2b')],'sectionId':_0x3122a6['id']},{})['then'](function(){return _0x9b53bb;});}else{return _0x9b53bb;}})[_0xb7a8('0x48')](function(_0x2f8c0c){logger[_0xb7a8('0x54')](_0xb7a8('0x55'),_0x2f8c0c);throw _0x2f8c0c;});}return _0x9b53bb;})[_0xb7a8('0x27')](respondWithResult(_0x7c71,0xc9))[_0xb7a8('0x48')](handleError(_0x7c71,null));};exports[_0xb7a8('0x26')]=function(_0xb83361,_0x3fd9fb){if(_0xb83361[_0xb7a8('0x56')]['id']){delete _0xb83361[_0xb7a8('0x56')]['id'];}return db[_0xb7a8('0x43')][_0xb7a8('0x4c')]({'where':{'id':_0xb83361[_0xb7a8('0x57')]['id']}})[_0xb7a8('0x27')](handleEntityNotFound(_0x3fd9fb,null))[_0xb7a8('0x27')](saveUpdates(_0xb83361[_0xb7a8('0x56')],null))[_0xb7a8('0x27')](respondWithResult(_0x3fd9fb,null))[_0xb7a8('0x48')](handleError(_0x3fd9fb,null));};exports[_0xb7a8('0x58')]=function(_0x397c22,_0x1938cf){return db[_0xb7a8('0x43')]['find']({'where':{'id':_0x397c22['params']['id']}})[_0xb7a8('0x27')](handleEntityNotFound(_0x1938cf,null))[_0xb7a8('0x27')](removeEntity(_0x1938cf,null))[_0xb7a8('0x48')](handleError(_0x1938cf,null));};exports['describe']=function(_0x5c824d,_0xef32f7){return db[_0xb7a8('0x43')][_0xb7a8('0x59')]()[_0xb7a8('0x27')](respondWithResult(_0xef32f7,null))[_0xb7a8('0x48')](handleError(_0xef32f7,null));};exports[_0xb7a8('0x5a')]=function(_0x562fce,_0xcf210e,_0x1960ab){var _0x48658d={'raw':!![],'where':{}},_0x2a710d={},_0x35683d;return db[_0xb7a8('0x43')][_0xb7a8('0x5b')]({'where':{'id':_0x562fce[_0xb7a8('0x57')]['id']}})[_0xb7a8('0x27')](handleEntityNotFound(_0xcf210e,null))[_0xb7a8('0x27')](function(_0x46bdbf){if(_0x46bdbf){_0x35683d=_0x46bdbf[_0xb7a8('0x28')]({'plain':!![]});_0x2a710d[_0xb7a8('0x31')]=_[_0xb7a8('0x33')](db[_0xb7a8('0x5c')]['rawAttributes']);_0x2a710d['query']=_[_0xb7a8('0x33')](_0x562fce[_0xb7a8('0x32')]);_0x2a710d['filters']=_['intersection'](_0x2a710d[_0xb7a8('0x31')],_0x2a710d[_0xb7a8('0x32')]);_0x48658d[_0xb7a8('0x35')]=_[_0xb7a8('0x36')](_0x2a710d[_0xb7a8('0x31')],qs[_0xb7a8('0x37')](_0x562fce['query'][_0xb7a8('0x37')]));_0x48658d[_0xb7a8('0x35')]=_0x48658d[_0xb7a8('0x35')][_0xb7a8('0x38')]?_0x48658d['attributes']:_0x2a710d['model'];if(!_0x562fce[_0xb7a8('0x32')]['hasOwnProperty'](_0xb7a8('0x3a'))){_0x48658d[_0xb7a8('0x22')]=qs[_0xb7a8('0x22')](_0x562fce[_0xb7a8('0x32')]['limit']);_0x48658d['offset']=qs[_0xb7a8('0x20')](_0x562fce[_0xb7a8('0x32')][_0xb7a8('0x20')]);}_0x48658d[_0xb7a8('0x3b')]=qs[_0xb7a8('0x3c')](_0x562fce[_0xb7a8('0x32')]['sort']);_0x48658d[_0xb7a8('0x3d')]=qs[_0xb7a8('0x34')](_[_0xb7a8('0x3e')](_0x562fce[_0xb7a8('0x32')],_0x2a710d['filters']));_0x48658d[_0xb7a8('0x3d')][_0xb7a8('0x5d')]=_0x46bdbf['id'];if(_0x562fce[_0xb7a8('0x32')][_0xb7a8('0x3f')]){_0x48658d['where']=_['merge'](_0x48658d[_0xb7a8('0x3d')],{'$or':_[_0xb7a8('0x2e')](_0x48658d[_0xb7a8('0x35')],function(_0x4dceb9){var _0x29d482={};_0x29d482[_0x4dceb9]={'$like':'%'+_0x562fce[_0xb7a8('0x32')][_0xb7a8('0x3f')]+'%'};return _0x29d482;})});}_0x48658d=_[_0xb7a8('0x4b')]({},_0x48658d,_0x562fce[_0xb7a8('0x42')]);return db[_0xb7a8('0x5c')][_0xb7a8('0x46')](_0x48658d);}})[_0xb7a8('0x27')](function(_0x15fd4e){if(_0x15fd4e){return db['User'][_0xb7a8('0x5e')]({'where':{'id':_[_0xb7a8('0x2e')](_0x15fd4e,_0xb7a8('0x5f')),'role':_0xb7a8('0x60')},'attributes':['id',_0xb7a8('0x2b'),'mailPause','updatedAt','createdAt']});}})[_0xb7a8('0x27')](function(_0x5b87d9){if(_0x5b87d9){return{'count':_0x5b87d9[_0xb7a8('0x23')],'rows':_[_0xb7a8('0x2e')](_0x5b87d9['rows'],function(_0x3faa78){return{'membername':_0x3faa78[_0xb7a8('0x2b')],'UserId':_0x3faa78['id'],'queue_name':_0x35683d[_0xb7a8('0x2b')],'MailQueueId':_0x35683d['id'],'interface':util[_0xb7a8('0x61')](_0xb7a8('0x62'),'SIP',_0x3faa78['name']),'penalty':0x0,'paused':_0x3faa78[_0xb7a8('0x63')],'createdAt':_0x3faa78[_0xb7a8('0x64')],'updatedAt':_0x3faa78[_0xb7a8('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb7a8('0x27')](respondWithFilteredResult(_0xcf210e,_0x48658d))[_0xb7a8('0x48')](handleError(_0xcf210e,null));};exports[_0xb7a8('0x66')]=function(_0x5ef08a,_0x2ba3ed,_0x5b40e6){var _0x3b6d3b={};var _0x371484={};var _0x6f2327;var _0x3f7f7f;return db[_0xb7a8('0x43')][_0xb7a8('0x5b')]({'where':{'id':_0x5ef08a[_0xb7a8('0x57')]['id']}})[_0xb7a8('0x27')](handleEntityNotFound(_0x2ba3ed,null))[_0xb7a8('0x27')](function(_0x1c3f5c){if(_0x1c3f5c){_0x6f2327=_0x1c3f5c;_0x371484[_0xb7a8('0x31')]=_[_0xb7a8('0x33')](db[_0xb7a8('0x67')]['rawAttributes']);_0x371484[_0xb7a8('0x32')]=_['keys'](_0x5ef08a[_0xb7a8('0x32')]);_0x371484[_0xb7a8('0x34')]=_[_0xb7a8('0x36')](_0x371484[_0xb7a8('0x31')],_0x371484[_0xb7a8('0x32')]);_0x3b6d3b[_0xb7a8('0x35')]=_[_0xb7a8('0x36')](_0x371484[_0xb7a8('0x31')],qs[_0xb7a8('0x37')](_0x5ef08a[_0xb7a8('0x32')][_0xb7a8('0x37')]));_0x3b6d3b['attributes']=_0x3b6d3b[_0xb7a8('0x35')][_0xb7a8('0x38')]?_0x3b6d3b[_0xb7a8('0x35')]:_0x371484['model'];_0x3b6d3b['order']=qs[_0xb7a8('0x3c')](_0x5ef08a[_0xb7a8('0x32')]['sort']);_0x3b6d3b[_0xb7a8('0x3d')]=qs[_0xb7a8('0x34')](_[_0xb7a8('0x3e')](_0x5ef08a[_0xb7a8('0x32')],_0x371484[_0xb7a8('0x34')]));if(_0x5ef08a[_0xb7a8('0x32')][_0xb7a8('0x3f')]){_0x3b6d3b[_0xb7a8('0x3d')]=_[_0xb7a8('0x4b')](_0x3b6d3b['where'],{'$or':_[_0xb7a8('0x2e')](_0x3b6d3b['attributes'],function(_0x34b2cb){var _0x101324={};_0x101324[_0x34b2cb]={'$like':'%'+_0x5ef08a[_0xb7a8('0x32')][_0xb7a8('0x3f')]+'%'};return _0x101324;})});}_0x3b6d3b=_[_0xb7a8('0x4b')]({},_0x3b6d3b,_0x5ef08a[_0xb7a8('0x42')]);return _0x6f2327[_0xb7a8('0x66')](_0x3b6d3b);}})['then'](function(_0x17512c){if(_0x17512c){_0x3f7f7f=_0x17512c[_0xb7a8('0x38')];if(!_0x5ef08a[_0xb7a8('0x32')][_0xb7a8('0x39')](_0xb7a8('0x3a'))){_0x3b6d3b[_0xb7a8('0x22')]=qs['limit'](_0x5ef08a[_0xb7a8('0x32')][_0xb7a8('0x22')]);_0x3b6d3b[_0xb7a8('0x20')]=qs[_0xb7a8('0x20')](_0x5ef08a['query'][_0xb7a8('0x20')]);}return _0x6f2327[_0xb7a8('0x66')](_0x3b6d3b);}})[_0xb7a8('0x27')](function(_0x2ca3ec){if(_0x2ca3ec){return _0x2ca3ec?{'count':_0x3f7f7f,'rows':_0x2ca3ec}:null;}})['then'](respondWithResult(_0x2ba3ed,null))[_0xb7a8('0x48')](handleError(_0x2ba3ed,null));};exports[_0xb7a8('0x68')]=function(_0x42e963,_0x5cb52a,_0x271aa7){var _0x49d32f=_0x42e963[_0xb7a8('0x56')][_0xb7a8('0x69')];return db[_0xb7a8('0x67')][_0xb7a8('0x46')]({'where':{'id':_0x49d32f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb7a8('0x2b'),'online',_0xb7a8('0x6a'),_0xb7a8('0x6b')],'raw':!![]}]})[_0xb7a8('0x27')](function(_0x34bb72){if(_0x34bb72){var _0x5d9c52=_[_0xb7a8('0x6c')](_0x34bb72,function(_0x58ac6f){var _0x5c53e8=_0x58ac6f[_0xb7a8('0x28')]({'plain':!![]});return _0x5c53e8[_0xb7a8('0x6d')];});return db[_0xb7a8('0x43')][_0xb7a8('0x4c')]({'where':{'id':_0x42e963[_0xb7a8('0x57')]['id']}})[_0xb7a8('0x27')](function(_0x330303){return db[_0xb7a8('0x6e')][_0xb7a8('0x6f')](function(_0x1966af){return _0x330303[_0xb7a8('0x68')](_0x49d32f,{'transaction':_0x1966af})['then'](function(){return BPromise[_0xb7a8('0x70')](_0x5d9c52,function(_0x4e1d5d){return db[_0xb7a8('0x5c')]['findOrCreate']({'where':{'UserId':_0x4e1d5d['id'],'MailQueueId':_0x42e963[_0xb7a8('0x57')]['id']},'transaction':_0x1966af});});})[_0xb7a8('0x27')](function(){_0x5d9c52[_0xb7a8('0x71')](function(_0x3c52af){socket[_0xb7a8('0x72')](_0xb7a8('0x73'),{'UserId':_0x3c52af['id'],'MailQueueId':_0x330303['id']});});});});});}})[_0xb7a8('0x27')](respondWithStatusCode(_0x5cb52a,null))[_0xb7a8('0x48')](handleError(_0x5cb52a,null));};exports[_0xb7a8('0x74')]=function(_0xd2e461,_0x19461a,_0xa76dc7){return db['Team'][_0xb7a8('0x46')]({'where':{'id':_0xd2e461[_0xb7a8('0x32')][_0xb7a8('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb7a8('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xb7a8('0x27')](handleEntityNotFound(_0x19461a,null))[_0xb7a8('0x27')](function(_0x5c76d3){var _0x3efc6b=_['map'](_0x5c76d3,'id');var _0x3a9e04=[];var _0x33e0fd=[];var _0x3adcef=squel[_0xb7a8('0x75')]();_0x3adcef[_0xb7a8('0x76')](_0xb7a8('0x77'))[_0xb7a8('0x78')](_0xb7a8('0x79'),'tq')[_0xb7a8('0x7a')](_0xb7a8('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0xd2e461['params']['id']);for(var _0x5a3c37=0x0;_0x5a3c37<_0x5c76d3[_0xb7a8('0x38')];_0x5a3c37+=0x1){let _0x1ec796=_0x5c76d3[_0x5a3c37];for(var _0x573b7e=0x0;_0x573b7e<_0x1ec796[_0xb7a8('0x6d')][_0xb7a8('0x38')];_0x573b7e+=0x1){let _0x1b1ae3=_0x1ec796[_0xb7a8('0x6d')][_0x573b7e];var _0xe748aa=_0x3adcef[_0xb7a8('0x7c')]();_0xe748aa['where'](_0xb7a8('0x7d'),_0x1b1ae3['id']);_0x33e0fd[_0xb7a8('0x7e')](db[_0xb7a8('0x6e')][_0xb7a8('0x32')](_0xe748aa[_0xb7a8('0x7f')](),{'type':db[_0xb7a8('0x6e')][_0xb7a8('0x80')]['SELECT']})[_0xb7a8('0x27')](function(_0x1a32b3){if(_0x1a32b3['length']===0x1){return _0x1b1ae3['id'];}else{var _0x562b0a=_[_0xb7a8('0x81')](_[_0xb7a8('0x2e')](_0x1a32b3,'TeamId'),function(_0x5b84eb){return _[_0xb7a8('0x82')](_0x3efc6b,_0x5b84eb);});if(_0x562b0a){return _0x1b1ae3['id'];}}}));}}return BPromise[_0xb7a8('0x83')](_0x33e0fd)[_0xb7a8('0x27')](function(_0x22257b){_0x3a9e04=_(_0x3a9e04)[_0xb7a8('0x84')](_0x22257b)[_0xb7a8('0x85')]()[_0xb7a8('0x86')]();return db[_0xb7a8('0x43')][_0xb7a8('0x4c')]({'where':{'id':_0xd2e461['params']['id']}})[_0xb7a8('0x27')](function(_0x3267b8){return db[_0xb7a8('0x6e')][_0xb7a8('0x6f')](function(_0x54504f){return _0x3267b8['removeTeams'](_0xd2e461[_0xb7a8('0x32')][_0xb7a8('0x69')],{'transaction':_0x54504f})[_0xb7a8('0x27')](function(){if(!_[_0xb7a8('0x87')](_0x3a9e04)){return _0x3267b8[_0xb7a8('0x88')](_0x3a9e04,{'transaction':_0x54504f});}})['then'](function(){_0x3a9e04[_0xb7a8('0x71')](function(_0x2a27f9){socket[_0xb7a8('0x72')](_0xb7a8('0x89'),{'UserId':_0x2a27f9,'MailQueueId':_0x3267b8['id']});});});});});});})[_0xb7a8('0x27')](respondWithStatusCode(_0x19461a,null))[_0xb7a8('0x48')](handleError(_0x19461a,null));};exports[_0xb7a8('0x8a')]=function(_0x4c47af,_0x68b2da,_0x39a753){return db[_0xb7a8('0x43')][_0xb7a8('0x4c')]({'where':{'id':_0x4c47af['params']['id']}})[_0xb7a8('0x27')](handleEntityNotFound(_0x68b2da,null))['then'](function(_0x2d70b6){if(_0x2d70b6){return _0x2d70b6[_0xb7a8('0x8a')](_0x4c47af[_0xb7a8('0x56')][_0xb7a8('0x69')],_[_0xb7a8('0x8b')](_0x4c47af[_0xb7a8('0x56')],[_0xb7a8('0x69'),'id'])||{})[_0xb7a8('0x8c')](function(_0x164172){for(var _0x10c0ba=0x0;_0x10c0ba<_0x4c47af['body'][_0xb7a8('0x69')]['length'];_0x10c0ba+=0x1){socket[_0xb7a8('0x72')](_0xb7a8('0x73'),{'UserId':Number(_0x4c47af[_0xb7a8('0x56')][_0xb7a8('0x69')][_0x10c0ba]),'MailQueueId':Number(_0x4c47af[_0xb7a8('0x57')]['id'])});}return _0x164172;});}})['then'](respondWithResult(_0x68b2da,null))['catch'](handleError(_0x68b2da,null));};exports[_0xb7a8('0x88')]=function(_0x3e7d5d,_0x2fd803,_0xccb8c1){return db[_0xb7a8('0x43')]['find']({'where':{'id':_0x3e7d5d[_0xb7a8('0x57')]['id']}})[_0xb7a8('0x27')](handleEntityNotFound(_0x2fd803,null))[_0xb7a8('0x27')](function(_0x2827e8){if(_0x2827e8){return _0x2827e8['removeAgents'](_0x3e7d5d[_0xb7a8('0x32')]['ids'])[_0xb7a8('0x27')](function(){if(_[_0xb7a8('0x8d')](_0x3e7d5d['query']['ids'])){for(var _0x3c82f5=0x0;_0x3c82f5<_0x3e7d5d['query'][_0xb7a8('0x69')][_0xb7a8('0x38')];_0x3c82f5+=0x1){socket[_0xb7a8('0x72')](_0xb7a8('0x89'),{'UserId':Number(_0x3e7d5d[_0xb7a8('0x32')]['ids'][_0x3c82f5]),'MailQueueId':Number(_0x3e7d5d[_0xb7a8('0x57')]['id'])});}}else{socket[_0xb7a8('0x72')]('userMailQueue:remove',{'UserId':Number(_0x3e7d5d[_0xb7a8('0x32')][_0xb7a8('0x69')]),'MailQueueId':Number(_0x3e7d5d[_0xb7a8('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fd803,null))[_0xb7a8('0x48')](handleError(_0x2fd803,null));};exports['getAgents']=function(_0x21d267,_0x32f0b0,_0xf36310){var _0x4068d6={};var _0x5f752={};var _0x3ff7ab;var _0x1452ff;return db['MailQueue'][_0xb7a8('0x5b')]({'where':{'id':_0x21d267[_0xb7a8('0x57')]['id']}})[_0xb7a8('0x27')](handleEntityNotFound(_0x32f0b0,null))[_0xb7a8('0x27')](function(_0x31ed05){if(_0x31ed05){_0x3ff7ab=_0x31ed05;_0x5f752[_0xb7a8('0x31')]=_[_0xb7a8('0x33')](db['User'][_0xb7a8('0x4a')]);_0x5f752[_0xb7a8('0x32')]=_['keys'](_0x21d267[_0xb7a8('0x32')]);_0x5f752['filters']=_[_0xb7a8('0x36')](_0x5f752[_0xb7a8('0x31')],_0x5f752[_0xb7a8('0x32')]);_0x4068d6[_0xb7a8('0x35')]=_[_0xb7a8('0x36')](_0x5f752['model'],qs[_0xb7a8('0x37')](_0x21d267[_0xb7a8('0x32')]['fields']));_0x4068d6['attributes']=_0x4068d6[_0xb7a8('0x35')]['length']?_0x4068d6['attributes']:_0x5f752['model'];_0x4068d6[_0xb7a8('0x3b')]=qs['sort'](_0x21d267[_0xb7a8('0x32')]['sort']);_0x4068d6[_0xb7a8('0x3d')]=qs[_0xb7a8('0x34')](_[_0xb7a8('0x3e')](_0x21d267[_0xb7a8('0x32')],_0x5f752['filters']));if(_0x21d267['query'][_0xb7a8('0x3f')]){_0x4068d6[_0xb7a8('0x3d')]=_[_0xb7a8('0x4b')](_0x4068d6['where'],{'$or':_[_0xb7a8('0x2e')](_0x4068d6['attributes'],function(_0x3fcd9b){var _0xff582d={};_0xff582d[_0x3fcd9b]={'$like':'%'+_0x21d267[_0xb7a8('0x32')][_0xb7a8('0x3f')]+'%'};return _0xff582d;})});}_0x4068d6=_['merge']({},_0x4068d6,_0x21d267[_0xb7a8('0x42')]);return _0x3ff7ab[_0xb7a8('0x8e')](_0x4068d6);}})['then'](function(_0x3d2633){if(_0x3d2633){_0x1452ff=_0x3d2633[_0xb7a8('0x38')];if(!_0x21d267['query'][_0xb7a8('0x39')]('nolimit')){_0x4068d6[_0xb7a8('0x22')]=qs[_0xb7a8('0x22')](_0x21d267[_0xb7a8('0x32')][_0xb7a8('0x22')]);_0x4068d6['offset']=qs['offset'](_0x21d267[_0xb7a8('0x32')][_0xb7a8('0x20')]);}return _0x3ff7ab[_0xb7a8('0x8e')](_0x4068d6);}})[_0xb7a8('0x27')](function(_0x5e9bb8){if(_0x5e9bb8){return _0x5e9bb8?{'count':_0x1452ff,'rows':_0x5e9bb8}:null;}})[_0xb7a8('0x27')](respondWithResult(_0x32f0b0,null))[_0xb7a8('0x48')](handleError(_0x32f0b0,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 00123c1..d84ce9d 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 _0x2db9=['update','remove','emit','hook','events','../../mysqldb','MailQueue','save'];(function(_0x81e43f,_0x3c8607){var _0x324ca0=function(_0x40b075){while(--_0x40b075){_0x81e43f['push'](_0x81e43f['shift']());}};_0x324ca0(++_0x3c8607);}(_0x2db9,0x84));var _0x92db=function(_0x2a2749,_0xbd852a){_0x2a2749=_0x2a2749-0x0;var _0x5c1ea6=_0x2db9[_0x2a2749];return _0x5c1ea6;};'use strict';var EventEmitter=require(_0x92db('0x0'));var MailQueue=require(_0x92db('0x1'))['db'][_0x92db('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x92db('0x3'),'afterUpdate':_0x92db('0x4'),'afterDestroy':_0x92db('0x5')};function emitEvent(_0x35f6dc){return function(_0xde32b3,_0x5e89ca,_0x34a72d){MailQueueEvents[_0x92db('0x6')](_0x35f6dc+':'+_0xde32b3['id'],_0xde32b3);MailQueueEvents[_0x92db('0x6')](_0x35f6dc,_0xde32b3);_0x34a72d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x92db('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x4d40=['hasOwnProperty','hook','exports','MailQueue','setMaxListeners','update','remove'];(function(_0x158543,_0x5ed46b){var _0x66758d=function(_0x288fbb){while(--_0x288fbb){_0x158543['push'](_0x158543['shift']());}};_0x66758d(++_0x5ed46b);}(_0x4d40,0x1a0));var _0x04d4=function(_0x5538a4,_0xe0b8b0){_0x5538a4=_0x5538a4-0x0;var _0x530a52=_0x4d40[_0x5538a4];return _0x530a52;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x04d4('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x04d4('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x04d4('0x2'),'afterDestroy':_0x04d4('0x3')};function emitEvent(_0x340f1a){return function(_0x3a4caa,_0x30c6c4,_0x1c233b){MailQueueEvents['emit'](_0x340f1a+':'+_0x3a4caa['id'],_0x3a4caa);MailQueueEvents['emit'](_0x340f1a,_0x3a4caa);_0x1c233b(null);};}for(var e in events){if(events[_0x04d4('0x4')](e)){var event=events[e];MailQueue[_0x04d4('0x5')](e,emitEvent(event));}}module[_0x04d4('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 32dad21..1a22465 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 _0x8677=['./mailQueue.attributes','exports','MailQueue','mail_queues','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x2b12ab,_0x110dd3){var _0x184527=function(_0x5295fe){while(--_0x5295fe){_0x2b12ab['push'](_0x2b12ab['shift']());}};_0x184527(++_0x110dd3);}(_0x8677,0x79));var _0x7867=function(_0x4e7484,_0x4eb649){_0x4e7484=_0x4e7484-0x0;var _0x15b752=_0x8677[_0x4e7484];return _0x15b752;};'use strict';var _=require('lodash');var util=require(_0x7867('0x0'));var logger=require(_0x7867('0x1'))('api');var moment=require(_0x7867('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7867('0x3'));var config=require(_0x7867('0x4'));var attributes=require(_0x7867('0x5'));module[_0x7867('0x6')]=function(_0xde4ad0,_0x527832){return _0xde4ad0['define'](_0x7867('0x7'),attributes,{'tableName':_0x7867('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x394a=['define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./mailQueue.attributes','exports'];(function(_0x30662f,_0x4d202e){var _0x40d038=function(_0x10bb41){while(--_0x10bb41){_0x30662f['push'](_0x30662f['shift']());}};_0x40d038(++_0x4d202e);}(_0x394a,0xb3));var _0xa394=function(_0x382a40,_0x24aa6c){_0x382a40=_0x382a40-0x0;var _0x3d7483=_0x394a[_0x382a40];return _0x3d7483;};'use strict';var _=require(_0xa394('0x0'));var util=require(_0xa394('0x1'));var logger=require(_0xa394('0x2'))('api');var moment=require(_0xa394('0x3'));var BPromise=require(_0xa394('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa394('0x5'));var attributes=require(_0xa394('0x6'));module[_0xa394('0x7')]=function(_0x5ef4a1,_0x5c1509){return _0x5ef4a1[_0xa394('0x8')](_0xa394('0x9'),attributes,{'tableName':_0xa394('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 7495148..d9269d0 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 _0x0dcf=['MailQueue,\x20%s,\x20%s','message','result','catch','findAll','options','where','include','model','attributes','map','GetMailQueue','debug','ShowMailQueue','MailQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailQueue.socket','register','request','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0x0dcf,0x179));var _0xf0dc=function(_0x270089,_0x131d8e){_0x270089=_0x270089-0x0;var _0x9dc1ff=_0x0dcf[_0x270089];return _0x9dc1ff;};'use strict';var _=require(_0xf0dc('0x0'));var util=require(_0xf0dc('0x1'));var moment=require(_0xf0dc('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0dc('0x3'));var fs=require('fs');var Redis=require(_0xf0dc('0x4'));var db=require(_0xf0dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf0dc('0x6'));var jayson=require(_0xf0dc('0x7'));var client=jayson[_0xf0dc('0x8')][_0xf0dc('0x9')]({'port':0x232a});config['redis']=_[_0xf0dc('0xa')](config[_0xf0dc('0xb')],{'host':_0xf0dc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf0dc('0xb')]));require(_0xf0dc('0xd'))[_0xf0dc('0xe')](socket);function respondWithRpcPromise(_0x214db1,_0x591df6,_0x2cb3c8){return new BPromise(function(_0x4a94ce,_0x4ea5cf){return client[_0xf0dc('0xf')](_0x214db1,_0x2cb3c8)[_0xf0dc('0x10')](function(_0x4abce2){logger[_0xf0dc('0x11')]('MailQueue,\x20%s,\x20%s',_0x591df6,_0xf0dc('0x12'));logger['debug'](_0xf0dc('0x13'),_0x591df6,_0xf0dc('0x12'),JSON[_0xf0dc('0x14')](_0x4abce2));if(_0x4abce2[_0xf0dc('0x15')]){if(_0x4abce2[_0xf0dc('0x15')][_0xf0dc('0x16')]===0x1f4){logger[_0xf0dc('0x15')](_0xf0dc('0x17'),_0x591df6,_0x4abce2[_0xf0dc('0x15')][_0xf0dc('0x18')]);return _0x4ea5cf(_0x4abce2[_0xf0dc('0x15')][_0xf0dc('0x18')]);}logger[_0xf0dc('0x15')]('MailQueue,\x20%s,\x20%s',_0x591df6,_0x4abce2[_0xf0dc('0x15')][_0xf0dc('0x18')]);return _0x4a94ce(_0x4abce2['error']['message']);}else{logger[_0xf0dc('0x11')](_0xf0dc('0x17'),_0x591df6,_0xf0dc('0x12'));_0x4a94ce(_0x4abce2[_0xf0dc('0x19')][_0xf0dc('0x18')]);}})[_0xf0dc('0x1a')](function(_0x7081bb){logger['error'](_0xf0dc('0x17'),_0x591df6,_0x7081bb);_0x4ea5cf(_0x7081bb);});});}exports['GetMailQueue']=function(_0x2cec9b){var _0x150e14=this;return new Promise(function(_0x1c7912,_0x2ff443){return db['MailQueue'][_0xf0dc('0x1b')]({'raw':_0x2cec9b[_0xf0dc('0x1c')]?_0x2cec9b[_0xf0dc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2cec9b[_0xf0dc('0x1c')]?_0x2cec9b['options'][_0xf0dc('0x1d')]||null:null,'attributes':_0x2cec9b[_0xf0dc('0x1c')]?_0x2cec9b[_0xf0dc('0x1c')]['attributes']||null:null,'limit':_0x2cec9b[_0xf0dc('0x1c')]?_0x2cec9b['options']['limit']||null:null,'include':_0x2cec9b[_0xf0dc('0x1c')]?_0x2cec9b[_0xf0dc('0x1c')][_0xf0dc('0x1e')]?_['map'](_0x2cec9b[_0xf0dc('0x1c')][_0xf0dc('0x1e')],function(_0x26cfe5){return{'model':db[_0x26cfe5[_0xf0dc('0x1f')]],'as':_0x26cfe5['as'],'attributes':_0x26cfe5[_0xf0dc('0x20')],'include':_0x26cfe5['include']?_[_0xf0dc('0x21')](_0x26cfe5[_0xf0dc('0x1e')],function(_0xc9342e){return{'model':db[_0xc9342e['model']],'as':_0xc9342e['as'],'attributes':_0xc9342e[_0xf0dc('0x20')],'include':_0xc9342e['include']?_[_0xf0dc('0x21')](_0xc9342e[_0xf0dc('0x1e')],function(_0x110ae7){return{'model':db[_0x110ae7[_0xf0dc('0x1f')]],'as':_0x110ae7['as'],'attributes':_0x110ae7[_0xf0dc('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf0dc('0x10')](function(_0x17fe44){logger[_0xf0dc('0x11')](_0xf0dc('0x22'),_0x2cec9b);logger[_0xf0dc('0x23')](_0xf0dc('0x22'),_0x2cec9b,JSON[_0xf0dc('0x14')](_0x17fe44));_0x1c7912(_0x17fe44);})[_0xf0dc('0x1a')](function(_0xedc18b){logger['error'](_0xf0dc('0x22'),_0xedc18b[_0xf0dc('0x18')],_0x2cec9b);_0x2ff443(_0x150e14[_0xf0dc('0x15')](0x1f4,_0xedc18b[_0xf0dc('0x18')]));});});};exports[_0xf0dc('0x24')]=function(_0x4677e4){var _0x13117d=this;return new Promise(function(_0x872c8,_0xb44249){return db[_0xf0dc('0x25')][_0xf0dc('0x26')]({'raw':_0x4677e4[_0xf0dc('0x1c')]?_0x4677e4['options'][_0xf0dc('0x27')]===undefined?!![]:![]:!![],'where':_0x4677e4['options']?_0x4677e4[_0xf0dc('0x1c')]['where']||null:null,'attributes':_0x4677e4['options']?_0x4677e4['options'][_0xf0dc('0x20')]||null:null,'include':_0x4677e4[_0xf0dc('0x1c')]?_0x4677e4['options'][_0xf0dc('0x1e')]?_['map'](_0x4677e4['options'][_0xf0dc('0x1e')],function(_0x233c03){return{'model':db[_0x233c03[_0xf0dc('0x1f')]],'as':_0x233c03['as'],'attributes':_0x233c03[_0xf0dc('0x20')],'include':_0x233c03[_0xf0dc('0x1e')]?_['map'](_0x233c03[_0xf0dc('0x1e')],function(_0x57a01d){return{'model':db[_0x57a01d[_0xf0dc('0x1f')]],'as':_0x57a01d['as'],'attributes':_0x57a01d[_0xf0dc('0x20')],'include':_0x57a01d[_0xf0dc('0x1e')]?_['map'](_0x57a01d[_0xf0dc('0x1e')],function(_0x5e709b){return{'model':db[_0x5e709b[_0xf0dc('0x1f')]],'as':_0x5e709b['as'],'attributes':_0x5e709b[_0xf0dc('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf0dc('0x10')](function(_0x7c4c13){logger[_0xf0dc('0x11')]('ShowMailQueue',_0x4677e4);logger['debug'](_0xf0dc('0x24'),_0x4677e4,JSON[_0xf0dc('0x14')](_0x7c4c13));_0x872c8(_0x7c4c13);})[_0xf0dc('0x1a')](function(_0x13f510){logger['error']('ShowMailQueue',_0x13f510['message'],_0x4677e4);_0xb44249(_0x13117d[_0xf0dc('0x15')](0x1f4,_0x13f510[_0xf0dc('0x18')]));});});}; \ No newline at end of file +var _0xba91=['findAll','options','limit','include','model','attributes','map','ShowMailQueue','MailQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailQueue'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xba91,0xaa));var _0x1ba9=function(_0x4ce6b3,_0x21f58e){_0x4ce6b3=_0x4ce6b3-0x0;var _0x3b9df5=_0xba91[_0x4ce6b3];return _0x3b9df5;};'use strict';var _=require('lodash');var util=require(_0x1ba9('0x0'));var moment=require(_0x1ba9('0x1'));var BPromise=require(_0x1ba9('0x2'));var rs=require(_0x1ba9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ba9('0x4'))['db'];var utils=require(_0x1ba9('0x5'));var logger=require(_0x1ba9('0x6'))(_0x1ba9('0x7'));var config=require(_0x1ba9('0x8'));var jayson=require(_0x1ba9('0x9'));var client=jayson[_0x1ba9('0xa')][_0x1ba9('0xb')]({'port':0x232a});config[_0x1ba9('0xc')]=_[_0x1ba9('0xd')](config[_0x1ba9('0xc')],{'host':_0x1ba9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1ba9('0xf'))[_0x1ba9('0x10')](socket);function respondWithRpcPromise(_0x2809e6,_0x377dea,_0x4fc647){return new BPromise(function(_0x22f66d,_0x5e2162){return client[_0x1ba9('0x11')](_0x2809e6,_0x4fc647)[_0x1ba9('0x12')](function(_0xc435c8){logger[_0x1ba9('0x13')](_0x1ba9('0x14'),_0x377dea,_0x1ba9('0x15'));logger[_0x1ba9('0x16')](_0x1ba9('0x17'),_0x377dea,_0x1ba9('0x15'),JSON['stringify'](_0xc435c8));if(_0xc435c8['error']){if(_0xc435c8[_0x1ba9('0x18')][_0x1ba9('0x19')]===0x1f4){logger['error'](_0x1ba9('0x14'),_0x377dea,_0xc435c8[_0x1ba9('0x18')][_0x1ba9('0x1a')]);return _0x5e2162(_0xc435c8[_0x1ba9('0x18')][_0x1ba9('0x1a')]);}logger['error'](_0x1ba9('0x14'),_0x377dea,_0xc435c8[_0x1ba9('0x18')][_0x1ba9('0x1a')]);return _0x22f66d(_0xc435c8[_0x1ba9('0x18')][_0x1ba9('0x1a')]);}else{logger[_0x1ba9('0x13')](_0x1ba9('0x14'),_0x377dea,_0x1ba9('0x15'));_0x22f66d(_0xc435c8[_0x1ba9('0x1b')][_0x1ba9('0x1a')]);}})[_0x1ba9('0x1c')](function(_0x3ed412){logger[_0x1ba9('0x18')](_0x1ba9('0x14'),_0x377dea,_0x3ed412);_0x5e2162(_0x3ed412);});});}exports[_0x1ba9('0x1d')]=function(_0x3f60d8){var _0x48b2d4=this;return new Promise(function(_0x1f65e7,_0x5721ab){return db['MailQueue'][_0x1ba9('0x1e')]({'raw':_0x3f60d8[_0x1ba9('0x1f')]?_0x3f60d8[_0x1ba9('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3f60d8[_0x1ba9('0x1f')]?_0x3f60d8[_0x1ba9('0x1f')]['where']||null:null,'attributes':_0x3f60d8[_0x1ba9('0x1f')]?_0x3f60d8[_0x1ba9('0x1f')]['attributes']||null:null,'limit':_0x3f60d8['options']?_0x3f60d8['options'][_0x1ba9('0x20')]||null:null,'include':_0x3f60d8['options']?_0x3f60d8[_0x1ba9('0x1f')][_0x1ba9('0x21')]?_['map'](_0x3f60d8[_0x1ba9('0x1f')]['include'],function(_0x502b5f){return{'model':db[_0x502b5f[_0x1ba9('0x22')]],'as':_0x502b5f['as'],'attributes':_0x502b5f[_0x1ba9('0x23')],'include':_0x502b5f[_0x1ba9('0x21')]?_[_0x1ba9('0x24')](_0x502b5f['include'],function(_0x4260da){return{'model':db[_0x4260da[_0x1ba9('0x22')]],'as':_0x4260da['as'],'attributes':_0x4260da['attributes'],'include':_0x4260da[_0x1ba9('0x21')]?_[_0x1ba9('0x24')](_0x4260da['include'],function(_0x534f5f){return{'model':db[_0x534f5f['model']],'as':_0x534f5f['as'],'attributes':_0x534f5f[_0x1ba9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1ba9('0x12')](function(_0x1515f2){logger[_0x1ba9('0x13')](_0x1ba9('0x1d'),_0x3f60d8);logger[_0x1ba9('0x16')](_0x1ba9('0x1d'),_0x3f60d8,JSON['stringify'](_0x1515f2));_0x1f65e7(_0x1515f2);})[_0x1ba9('0x1c')](function(_0x3e13ce){logger[_0x1ba9('0x18')](_0x1ba9('0x1d'),_0x3e13ce['message'],_0x3f60d8);_0x5721ab(_0x48b2d4[_0x1ba9('0x18')](0x1f4,_0x3e13ce['message']));});});};exports[_0x1ba9('0x25')]=function(_0x2e8204){var _0x1a5a42=this;return new Promise(function(_0x23a8e5,_0x4f9a45){return db[_0x1ba9('0x26')][_0x1ba9('0x27')]({'raw':_0x2e8204[_0x1ba9('0x1f')]?_0x2e8204['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e8204[_0x1ba9('0x1f')]?_0x2e8204[_0x1ba9('0x1f')]['where']||null:null,'attributes':_0x2e8204[_0x1ba9('0x1f')]?_0x2e8204['options'][_0x1ba9('0x23')]||null:null,'include':_0x2e8204[_0x1ba9('0x1f')]?_0x2e8204[_0x1ba9('0x1f')][_0x1ba9('0x21')]?_[_0x1ba9('0x24')](_0x2e8204['options'][_0x1ba9('0x21')],function(_0x2c870c){return{'model':db[_0x2c870c[_0x1ba9('0x22')]],'as':_0x2c870c['as'],'attributes':_0x2c870c['attributes'],'include':_0x2c870c['include']?_[_0x1ba9('0x24')](_0x2c870c[_0x1ba9('0x21')],function(_0x37556f){return{'model':db[_0x37556f[_0x1ba9('0x22')]],'as':_0x37556f['as'],'attributes':_0x37556f[_0x1ba9('0x23')],'include':_0x37556f[_0x1ba9('0x21')]?_['map'](_0x37556f['include'],function(_0x47b4e1){return{'model':db[_0x47b4e1[_0x1ba9('0x22')]],'as':_0x47b4e1['as'],'attributes':_0x47b4e1[_0x1ba9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1ba9('0x12')](function(_0x41397c){logger[_0x1ba9('0x13')](_0x1ba9('0x25'),_0x2e8204);logger[_0x1ba9('0x16')](_0x1ba9('0x25'),_0x2e8204,JSON['stringify'](_0x41397c));_0x23a8e5(_0x41397c);})[_0x1ba9('0x1c')](function(_0x414b3d){logger['error'](_0x1ba9('0x25'),_0x414b3d['message'],_0x2e8204);_0x4f9a45(_0x1a5a42[_0x1ba9('0x18')](0x1f4,_0x414b3d[_0x1ba9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7fccb3b..736a701 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 _0x5c3b=['save','remove','update','removeListener','length','mailQueue:','./mailQueue.events'];(function(_0x311df2,_0x5b6291){var _0x2d70d7=function(_0x11d81b){while(--_0x11d81b){_0x311df2['push'](_0x311df2['shift']());}};_0x2d70d7(++_0x5b6291);}(_0x5c3b,0x1d4));var _0xb5c3=function(_0x40ff3b,_0x238af7){_0x40ff3b=_0x40ff3b-0x0;var _0x3ccf4f=_0x5c3b[_0x40ff3b];return _0x3ccf4f;};'use strict';var MailQueueEvents=require(_0xb5c3('0x0'));var events=[_0xb5c3('0x1'),_0xb5c3('0x2'),_0xb5c3('0x3')];function createListener(_0x5bde94,_0x283dcd){return function(_0x5daa66){_0x283dcd['emit'](_0x5bde94,_0x5daa66);};}function removeListener(_0x10a46e,_0x10fcf5){return function(){MailQueueEvents[_0xb5c3('0x4')](_0x10a46e,_0x10fcf5);};}exports['register']=function(_0x26c1f8){for(var _0xacd5c2=0x0,_0x59367c=events[_0xb5c3('0x5')];_0xacd5c2<_0x59367c;_0xacd5c2++){var _0x14fdba=events[_0xacd5c2];var _0x33b44b=createListener(_0xb5c3('0x6')+_0x14fdba,_0x26c1f8);MailQueueEvents['on'](_0x14fdba,_0x33b44b);}}; \ No newline at end of file +var _0x54f7=['mailQueue:','./mailQueue.events','remove','update','emit','register'];(function(_0x4fbe13,_0x543abd){var _0x533119=function(_0x27b273){while(--_0x27b273){_0x4fbe13['push'](_0x4fbe13['shift']());}};_0x533119(++_0x543abd);}(_0x54f7,0x6d));var _0x754f=function(_0xe176ef,_0x2e6271){_0xe176ef=_0xe176ef-0x0;var _0x2ba347=_0x54f7[_0xe176ef];return _0x2ba347;};'use strict';var MailQueueEvents=require(_0x754f('0x0'));var events=['save',_0x754f('0x1'),_0x754f('0x2')];function createListener(_0x5d5864,_0x529e75){return function(_0x33e88c){_0x529e75[_0x754f('0x3')](_0x5d5864,_0x33e88c);};}function removeListener(_0x5675ce,_0x333c0f){return function(){MailQueueEvents['removeListener'](_0x5675ce,_0x333c0f);};}exports[_0x754f('0x4')]=function(_0x4afb3d){for(var _0x5717cc=0x0,_0x3ad713=events['length'];_0x5717cc<_0x3ad713;_0x5717cc++){var _0x502096=events[_0x5717cc];var _0x41247e=createListener(_0x754f('0x5')+_0x502096,_0x4afb3d);MailQueueEvents['on'](_0x502096,_0x41247e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 542ae2a..7aba03f 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 _0xfbf4=['fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfbf4,0x86));var _0x4fbf=function(_0x4c921c,_0x562de9){_0x4c921c=_0x4c921c-0x0;var _0x5533dd=_0xfbf4[_0x4c921c];return _0x5533dd;};'use strict';var multer=require(_0x4fbf('0x0'));var util=require(_0x4fbf('0x1'));var path=require(_0x4fbf('0x2'));var timeout=require(_0x4fbf('0x3'));var express=require(_0x4fbf('0x4'));var router=express[_0x4fbf('0x5')]();var fs_extra=require(_0x4fbf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4fbf('0x7'));var config=require('../../config/environment');var controller=require(_0x4fbf('0x8'));router[_0x4fbf('0x9')]('/',auth[_0x4fbf('0xa')](),controller['index']);router['get'](_0x4fbf('0xb'),auth[_0x4fbf('0xa')](),controller[_0x4fbf('0xc')]);router[_0x4fbf('0x9')](_0x4fbf('0xd'),auth[_0x4fbf('0xa')](),controller[_0x4fbf('0xe')]);router[_0x4fbf('0xf')]('/',auth[_0x4fbf('0xa')](),controller[_0x4fbf('0x10')]);router['put'](_0x4fbf('0xd'),auth[_0x4fbf('0xa')](),controller['update']);router[_0x4fbf('0x11')](_0x4fbf('0xd'),auth['isAuthenticated'](),controller[_0x4fbf('0x12')]);module[_0x4fbf('0x13')]=router; \ No newline at end of file +var _0xfa6f=['/describe','describe','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x40c2cd,_0x2b35cd){var _0x574020=function(_0x4ec818){while(--_0x4ec818){_0x40c2cd['push'](_0x40c2cd['shift']());}};_0x574020(++_0x2b35cd);}(_0xfa6f,0x159));var _0xffa6=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xfa6f[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xffa6('0x0'));var util=require(_0xffa6('0x1'));var path=require(_0xffa6('0x2'));var timeout=require(_0xffa6('0x3'));var express=require(_0xffa6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xffa6('0x5'));var interaction=require(_0xffa6('0x6'));var config=require(_0xffa6('0x7'));var controller=require(_0xffa6('0x8'));router[_0xffa6('0x9')]('/',auth[_0xffa6('0xa')](),controller[_0xffa6('0xb')]);router[_0xffa6('0x9')](_0xffa6('0xc'),auth[_0xffa6('0xa')](),controller[_0xffa6('0xd')]);router['get']('/:id',auth[_0xffa6('0xa')](),controller[_0xffa6('0xe')]);router[_0xffa6('0xf')]('/',auth[_0xffa6('0xa')](),controller[_0xffa6('0x10')]);router[_0xffa6('0x11')]('/:id',auth[_0xffa6('0xa')](),controller['update']);router[_0xffa6('0x12')]('/:id',auth[_0xffa6('0xa')](),controller[_0xffa6('0x13')]);module[_0xffa6('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 18ec02c..8d379c7 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 _0x4fde=['STRING','DATE','exports'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x4fde,0x104));var _0xe4fd=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x4fde[_0x5c14f6];return _0x4949b3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe4fd('0x0')]={'uniqueid':{'type':Sequelize[_0xe4fd('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe4fd('0x1')]},'joinAt':{'type':Sequelize[_0xe4fd('0x2')]},'leaveAt':{'type':Sequelize[_0xe4fd('0x2')]},'acceptAt':{'type':Sequelize[_0xe4fd('0x2')]},'exitAt':{'type':Sequelize[_0xe4fd('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc222=['sequelize','exports','STRING','DATE','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc222,0x144));var _0x2c22=function(_0x870f2,_0x5699f8){_0x870f2=_0x870f2-0x0;var _0x47653c=_0xc222[_0x870f2];return _0x47653c;};'use strict';var moment=require(_0x2c22('0x0'));var Sequelize=require(_0x2c22('0x1'));module[_0x2c22('0x2')]={'uniqueid':{'type':Sequelize[_0x2c22('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2c22('0x3')]},'joinAt':{'type':Sequelize[_0x2c22('0x4')]},'leaveAt':{'type':Sequelize[_0x2c22('0x4')]},'acceptAt':{'type':Sequelize[_0x2c22('0x4')]},'exitAt':{'type':Sequelize[_0x2c22('0x4')]},'reason':{'type':Sequelize[_0x2c22('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index d218644..1f7bcaa 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32b6=['sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x440f91,_0x3e30ee){var _0x256606=function(_0x124efb){while(--_0x124efb){_0x440f91['push'](_0x440f91['shift']());}};_0x256606(++_0x3e30ee);}(_0x32b6,0x1d1));var _0x632b=function(_0xe734df,_0x391344){_0xe734df=_0xe734df-0x0;var _0xfb50c7=_0x32b6[_0xe734df];return _0xfb50c7;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];function respondWithStatusCode(_0xe81378,_0x3d8bed){_0x3d8bed=_0x3d8bed||0xcc;return function(_0x22c182){if(_0x22c182){return _0xe81378['sendStatus'](_0x3d8bed);}return _0xe81378[_0x632b('0x18')](_0x3d8bed)[_0x632b('0x19')]();};}function respondWithResult(_0x9246a6,_0x5a97da){_0x5a97da=_0x5a97da||0xc8;return function(_0x721883){if(_0x721883){return _0x9246a6[_0x632b('0x18')](_0x5a97da)[_0x632b('0x1a')](_0x721883);}};}function respondWithFilteredResult(_0x17ff9b,_0x40d410){return function(_0x21cdd3){if(_0x21cdd3){var _0x4efe39=typeof _0x40d410[_0x632b('0x1b')]==='undefined'&&typeof _0x40d410['limit']===_0x632b('0x1c');var _0x5afa1e=_0x21cdd3[_0x632b('0x1d')];var _0x3bb27f=_0x4efe39?0x0:_0x40d410[_0x632b('0x1b')];var _0x51c894=_0x4efe39?_0x21cdd3[_0x632b('0x1d')]:_0x40d410[_0x632b('0x1b')]+_0x40d410[_0x632b('0x1e')];var _0x3683e4;if(_0x51c894>=_0x5afa1e){_0x51c894=_0x5afa1e;_0x3683e4=0xc8;}else{_0x3683e4=0xce;}_0x17ff9b['status'](_0x3683e4);return _0x17ff9b[_0x632b('0x1f')](_0x632b('0x20'),_0x3bb27f+'-'+_0x51c894+'/'+_0x5afa1e)['json'](_0x21cdd3);}return null;};}function patchUpdates(_0x116f62){return function(_0x50b930){try{jsonpatch['apply'](_0x50b930,_0x116f62,!![]);}catch(_0x1b1092){return BPromise['reject'](_0x1b1092);}return _0x50b930[_0x632b('0x21')]();};}function saveUpdates(_0x1c4530,_0x2a6833){return function(_0x540bfb){if(_0x540bfb){return _0x540bfb[_0x632b('0x22')](_0x1c4530)[_0x632b('0x23')](function(_0x59d83a){return _0x59d83a;});}return null;};}function removeEntity(_0x1db8f5,_0x379dc2){return function(_0x30ffb9){if(_0x30ffb9){return _0x30ffb9[_0x632b('0x24')]()[_0x632b('0x23')](function(){_0x1db8f5[_0x632b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b20,_0x11fe61){return function(_0x4d3a70){if(!_0x4d3a70){_0x5e7b20[_0x632b('0x25')](0x194);}return _0x4d3a70;};}function handleError(_0x954fa0,_0x5d6855){_0x5d6855=_0x5d6855||0x1f4;return function(_0x273e89){logger[_0x632b('0x26')](_0x273e89[_0x632b('0x27')]);if(_0x273e89[_0x632b('0x28')]){delete _0x273e89[_0x632b('0x28')];}_0x954fa0[_0x632b('0x18')](_0x5d6855)[_0x632b('0x29')](_0x273e89);};}exports[_0x632b('0x2a')]=function(_0x33a625,_0x4f8410){var _0x1bb484={},_0x35348e={},_0x1819fa={'count':0x0,'rows':[]};var _0x3999aa=_[_0x632b('0x2b')](db[_0x632b('0x2c')][_0x632b('0x2d')],function(_0x417d62){return{'name':_0x417d62[_0x632b('0x2e')],'type':_0x417d62[_0x632b('0x2f')][_0x632b('0x30')]};});_0x35348e[_0x632b('0x31')]=_[_0x632b('0x2b')](_0x3999aa,_0x632b('0x28'));_0x35348e[_0x632b('0x32')]=_[_0x632b('0x33')](_0x33a625[_0x632b('0x32')]);_0x35348e[_0x632b('0x34')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],_0x35348e['query']);_0x1bb484[_0x632b('0x36')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],qs[_0x632b('0x37')](_0x33a625['query'][_0x632b('0x37')]));_0x1bb484['attributes']=_0x1bb484[_0x632b('0x36')][_0x632b('0x38')]?_0x1bb484['attributes']:_0x35348e[_0x632b('0x31')];if(!_0x33a625[_0x632b('0x32')][_0x632b('0x39')](_0x632b('0x3a'))){_0x1bb484[_0x632b('0x1e')]=qs[_0x632b('0x1e')](_0x33a625[_0x632b('0x32')][_0x632b('0x1e')]);_0x1bb484['offset']=qs['offset'](_0x33a625[_0x632b('0x32')][_0x632b('0x1b')]);}_0x1bb484[_0x632b('0x3b')]=qs[_0x632b('0x3c')](_0x33a625[_0x632b('0x32')][_0x632b('0x3c')]);_0x1bb484[_0x632b('0x3d')]=qs[_0x632b('0x34')](_['pick'](_0x33a625['query'],_0x35348e[_0x632b('0x34')]),_0x3999aa);if(_0x33a625['query'][_0x632b('0x3e')]){_0x1bb484[_0x632b('0x3d')]=_[_0x632b('0x3f')](_0x1bb484[_0x632b('0x3d')],{'$or':_[_0x632b('0x2b')](_0x3999aa,function(_0x38266c){if(_0x38266c[_0x632b('0x2f')]!==_0x632b('0x40')){var _0x2730c2={};_0x2730c2[_0x38266c[_0x632b('0x28')]]={'$like':'%'+_0x33a625[_0x632b('0x32')][_0x632b('0x3e')]+'%'};return _0x2730c2;}})});}_0x1bb484=_[_0x632b('0x3f')]({},_0x1bb484,_0x33a625[_0x632b('0x41')]);var _0x13beaa={'where':_0x1bb484[_0x632b('0x3d')]};return db[_0x632b('0x2c')]['count'](_0x13beaa)['then'](function(_0x58e3cc){_0x1819fa['count']=_0x58e3cc;if(_0x33a625['query'][_0x632b('0x42')]){_0x1bb484['include']=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x1bb484);})[_0x632b('0x23')](function(_0x4490d4){_0x1819fa[_0x632b('0x43')]=_0x4490d4;return _0x1819fa;})[_0x632b('0x23')](respondWithFilteredResult(_0x4f8410,_0x1bb484))['catch'](handleError(_0x4f8410,null));};exports[_0x632b('0x44')]=function(_0x238297,_0x387fce){var _0x4dbe4b={'raw':!![],'where':{'id':_0x238297[_0x632b('0x45')]['id']}},_0x15bb30={};_0x15bb30[_0x632b('0x31')]=_[_0x632b('0x33')](db[_0x632b('0x2c')][_0x632b('0x2d')]);_0x15bb30['query']=_[_0x632b('0x33')](_0x238297[_0x632b('0x32')]);_0x15bb30[_0x632b('0x34')]=_[_0x632b('0x35')](_0x15bb30['model'],_0x15bb30['query']);_0x4dbe4b[_0x632b('0x36')]=_[_0x632b('0x35')](_0x15bb30[_0x632b('0x31')],qs[_0x632b('0x37')](_0x238297[_0x632b('0x32')][_0x632b('0x37')]));_0x4dbe4b['attributes']=_0x4dbe4b[_0x632b('0x36')][_0x632b('0x38')]?_0x4dbe4b[_0x632b('0x36')]:_0x15bb30[_0x632b('0x31')];if(_0x238297[_0x632b('0x32')][_0x632b('0x42')]){_0x4dbe4b[_0x632b('0x46')]=[{'all':!![]}];}_0x4dbe4b=_[_0x632b('0x3f')]({},_0x4dbe4b,_0x238297['options']);return db[_0x632b('0x2c')]['find'](_0x4dbe4b)[_0x632b('0x23')](handleEntityNotFound(_0x387fce,null))['then'](respondWithResult(_0x387fce,null))[_0x632b('0x47')](handleError(_0x387fce,null));};exports[_0x632b('0x48')]=function(_0x16dfc7,_0x2c4561){return db[_0x632b('0x2c')]['create'](_0x16dfc7[_0x632b('0x49')],{})[_0x632b('0x23')](respondWithResult(_0x2c4561,0xc9))[_0x632b('0x47')](handleError(_0x2c4561,null));};exports['update']=function(_0x253aec,_0x16eb80){if(_0x253aec[_0x632b('0x49')]['id']){delete _0x253aec[_0x632b('0x49')]['id'];}return db[_0x632b('0x2c')]['find']({'where':{'id':_0x253aec[_0x632b('0x45')]['id']}})['then'](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x23')](saveUpdates(_0x253aec[_0x632b('0x49')],null))[_0x632b('0x23')](respondWithResult(_0x16eb80,null))[_0x632b('0x47')](handleError(_0x16eb80,null));};exports[_0x632b('0x24')]=function(_0x52785a,_0x4c9b4e){return db[_0x632b('0x2c')][_0x632b('0x4a')]({'where':{'id':_0x52785a[_0x632b('0x45')]['id']}})[_0x632b('0x23')](handleEntityNotFound(_0x4c9b4e,null))[_0x632b('0x23')](removeEntity(_0x4c9b4e,null))[_0x632b('0x47')](handleError(_0x4c9b4e,null));};exports['describe']=function(_0xda006b,_0x1d35b2){return db[_0x632b('0x2c')]['describe']()[_0x632b('0x23')](respondWithResult(_0x1d35b2,null))[_0x632b('0x47')](handleError(_0x1d35b2,null));}; \ No newline at end of file +var _0xb44a=['options','rows','catch','show','params','includeAll','merge','create','body','find','destroy','describe','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','MailQueueReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL'];(function(_0x4853ab,_0x526ff){var _0x3d1b94=function(_0x159b4e){while(--_0x159b4e){_0x4853ab['push'](_0x4853ab['shift']());}};_0x3d1b94(++_0x526ff);}(_0xb44a,0x1c2));var _0xab44=function(_0x5d04ee,_0x2a38ca){_0x5d04ee=_0x5d04ee-0x0;var _0x4a666a=_0xb44a[_0x5d04ee];return _0x4a666a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab44('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab44('0x2'));var util=require('util');var path=require(_0xab44('0x3'));var sox=require(_0xab44('0x4'));var csv=require(_0xab44('0x5'));var ejs=require(_0xab44('0x6'));var fs=require('fs');var fs_extra=require(_0xab44('0x7'));var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x5'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var licenseUtil=require(_0xab44('0x14'));var db=require(_0xab44('0x15'))['db'];function respondWithStatusCode(_0x237c26,_0x52d282){_0x52d282=_0x52d282||0xcc;return function(_0x57fcff){if(_0x57fcff){return _0x237c26[_0xab44('0x16')](_0x52d282);}return _0x237c26['status'](_0x52d282)[_0xab44('0x17')]();};}function respondWithResult(_0x5ae369,_0x25f611){_0x25f611=_0x25f611||0xc8;return function(_0x15b98a){if(_0x15b98a){return _0x5ae369[_0xab44('0x18')](_0x25f611)[_0xab44('0x19')](_0x15b98a);}};}function respondWithFilteredResult(_0x31404d,_0x41701b){return function(_0x4875df){if(_0x4875df){var _0x51251b=typeof _0x41701b[_0xab44('0x1a')]===_0xab44('0x1b')&&typeof _0x41701b[_0xab44('0x1c')]===_0xab44('0x1b');var _0xffdfbc=_0x4875df[_0xab44('0x1d')];var _0x354b09=_0x51251b?0x0:_0x41701b[_0xab44('0x1a')];var _0x310b15=_0x51251b?_0x4875df[_0xab44('0x1d')]:_0x41701b[_0xab44('0x1a')]+_0x41701b['limit'];var _0xb779bb;if(_0x310b15>=_0xffdfbc){_0x310b15=_0xffdfbc;_0xb779bb=0xc8;}else{_0xb779bb=0xce;}_0x31404d[_0xab44('0x18')](_0xb779bb);return _0x31404d[_0xab44('0x1e')](_0xab44('0x1f'),_0x354b09+'-'+_0x310b15+'/'+_0xffdfbc)[_0xab44('0x19')](_0x4875df);}return null;};}function patchUpdates(_0x5123b1){return function(_0xcd426){try{jsonpatch['apply'](_0xcd426,_0x5123b1,!![]);}catch(_0x1f7311){return BPromise[_0xab44('0x20')](_0x1f7311);}return _0xcd426[_0xab44('0x21')]();};}function saveUpdates(_0x355083,_0x486317){return function(_0x3a2b1d){if(_0x3a2b1d){return _0x3a2b1d[_0xab44('0x22')](_0x355083)[_0xab44('0x23')](function(_0x3b17d5){return _0x3b17d5;});}return null;};}function removeEntity(_0x11f0b,_0x402950){return function(_0x43f1c6){if(_0x43f1c6){return _0x43f1c6['destroy']()['then'](function(){_0x11f0b[_0xab44('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2439f3,_0x5a7269){return function(_0x2a1bbc){if(!_0x2a1bbc){_0x2439f3['sendStatus'](0x194);}return _0x2a1bbc;};}function handleError(_0x531583,_0x8e60fa){_0x8e60fa=_0x8e60fa||0x1f4;return function(_0x25287b){logger[_0xab44('0x24')](_0x25287b[_0xab44('0x25')]);if(_0x25287b[_0xab44('0x26')]){delete _0x25287b['name'];}_0x531583[_0xab44('0x18')](_0x8e60fa)[_0xab44('0x27')](_0x25287b);};}exports['index']=function(_0x887b0d,_0xebb7d1){var _0x21131e={},_0x1cd486={},_0x4550c8={'count':0x0,'rows':[]};var _0xdc50a1=_['map'](db[_0xab44('0x28')][_0xab44('0x29')],function(_0x36f9b6){return{'name':_0x36f9b6['fieldName'],'type':_0x36f9b6['type'][_0xab44('0x2a')]};});_0x1cd486['model']=_['map'](_0xdc50a1,_0xab44('0x26'));_0x1cd486[_0xab44('0x2b')]=_[_0xab44('0x2c')](_0x887b0d[_0xab44('0x2b')]);_0x1cd486[_0xab44('0x2d')]=_[_0xab44('0x2e')](_0x1cd486[_0xab44('0x2f')],_0x1cd486[_0xab44('0x2b')]);_0x21131e[_0xab44('0x30')]=_[_0xab44('0x2e')](_0x1cd486[_0xab44('0x2f')],qs[_0xab44('0x31')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x31')]));_0x21131e['attributes']=_0x21131e['attributes'][_0xab44('0x32')]?_0x21131e[_0xab44('0x30')]:_0x1cd486['model'];if(!_0x887b0d[_0xab44('0x2b')][_0xab44('0x33')](_0xab44('0x34'))){_0x21131e[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x1c')]);_0x21131e[_0xab44('0x1a')]=qs[_0xab44('0x1a')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x1a')]);}_0x21131e[_0xab44('0x35')]=qs[_0xab44('0x36')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x36')]);_0x21131e[_0xab44('0x37')]=qs[_0xab44('0x2d')](_[_0xab44('0x38')](_0x887b0d['query'],_0x1cd486[_0xab44('0x2d')]),_0xdc50a1);if(_0x887b0d[_0xab44('0x2b')][_0xab44('0x39')]){_0x21131e[_0xab44('0x37')]=_['merge'](_0x21131e[_0xab44('0x37')],{'$or':_[_0xab44('0x3a')](_0xdc50a1,function(_0xcd077a){if(_0xcd077a[_0xab44('0x3b')]!==_0xab44('0x3c')){var _0x4f5cf3={};_0x4f5cf3[_0xcd077a[_0xab44('0x26')]]={'$like':'%'+_0x887b0d[_0xab44('0x2b')][_0xab44('0x39')]+'%'};return _0x4f5cf3;}})});}_0x21131e=_['merge']({},_0x21131e,_0x887b0d[_0xab44('0x3d')]);var _0x1e26de={'where':_0x21131e[_0xab44('0x37')]};return db[_0xab44('0x28')][_0xab44('0x1d')](_0x1e26de)['then'](function(_0x1de52d){_0x4550c8['count']=_0x1de52d;if(_0x887b0d[_0xab44('0x2b')]['includeAll']){_0x21131e['include']=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x21131e);})['then'](function(_0x120585){_0x4550c8[_0xab44('0x3e')]=_0x120585;return _0x4550c8;})[_0xab44('0x23')](respondWithFilteredResult(_0xebb7d1,_0x21131e))[_0xab44('0x3f')](handleError(_0xebb7d1,null));};exports[_0xab44('0x40')]=function(_0xf3f37a,_0x19d20d){var _0x33641e={'raw':!![],'where':{'id':_0xf3f37a[_0xab44('0x41')]['id']}},_0x4429e6={};_0x4429e6['model']=_[_0xab44('0x2c')](db[_0xab44('0x28')][_0xab44('0x29')]);_0x4429e6[_0xab44('0x2b')]=_['keys'](_0xf3f37a[_0xab44('0x2b')]);_0x4429e6[_0xab44('0x2d')]=_[_0xab44('0x2e')](_0x4429e6[_0xab44('0x2f')],_0x4429e6[_0xab44('0x2b')]);_0x33641e[_0xab44('0x30')]=_['intersection'](_0x4429e6['model'],qs[_0xab44('0x31')](_0xf3f37a[_0xab44('0x2b')][_0xab44('0x31')]));_0x33641e[_0xab44('0x30')]=_0x33641e[_0xab44('0x30')]['length']?_0x33641e[_0xab44('0x30')]:_0x4429e6[_0xab44('0x2f')];if(_0xf3f37a[_0xab44('0x2b')][_0xab44('0x42')]){_0x33641e['include']=[{'all':!![]}];}_0x33641e=_[_0xab44('0x43')]({},_0x33641e,_0xf3f37a[_0xab44('0x3d')]);return db[_0xab44('0x28')]['find'](_0x33641e)[_0xab44('0x23')](handleEntityNotFound(_0x19d20d,null))[_0xab44('0x23')](respondWithResult(_0x19d20d,null))[_0xab44('0x3f')](handleError(_0x19d20d,null));};exports[_0xab44('0x44')]=function(_0x4eeb65,_0x13892d){return db['MailQueueReport'][_0xab44('0x44')](_0x4eeb65[_0xab44('0x45')],{})[_0xab44('0x23')](respondWithResult(_0x13892d,0xc9))[_0xab44('0x3f')](handleError(_0x13892d,null));};exports['update']=function(_0x328891,_0x5497a3){if(_0x328891[_0xab44('0x45')]['id']){delete _0x328891[_0xab44('0x45')]['id'];}return db[_0xab44('0x28')][_0xab44('0x46')]({'where':{'id':_0x328891[_0xab44('0x41')]['id']}})['then'](handleEntityNotFound(_0x5497a3,null))[_0xab44('0x23')](saveUpdates(_0x328891['body'],null))[_0xab44('0x23')](respondWithResult(_0x5497a3,null))[_0xab44('0x3f')](handleError(_0x5497a3,null));};exports[_0xab44('0x47')]=function(_0x50b705,_0x4463f1){return db[_0xab44('0x28')][_0xab44('0x46')]({'where':{'id':_0x50b705[_0xab44('0x41')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x4463f1,null))['then'](removeEntity(_0x4463f1,null))['catch'](handleError(_0x4463f1,null));};exports[_0xab44('0x48')]=function(_0x1b18fb,_0xaa00a1){return db['MailQueueReport'][_0xab44('0x48')]()[_0xab44('0x23')](respondWithResult(_0xaa00a1,null))[_0xab44('0x3f')](handleError(_0xaa00a1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7d30bd7..357ad3c 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 _0xb550=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','bluebird','request-promise','path','./mailQueueReport.attributes','exports','define'];(function(_0x4c4b35,_0x4593ea){var _0x98cd3e=function(_0x52a924){while(--_0x52a924){_0x4c4b35['push'](_0x4c4b35['shift']());}};_0x98cd3e(++_0x4593ea);}(_0xb550,0x183));var _0x0b55=function(_0x41e290,_0x52ec90){_0x41e290=_0x41e290-0x0;var _0x1f4ffa=_0xb550[_0x41e290];return _0x1f4ffa;};'use strict';var _=require(_0x0b55('0x0'));var util=require(_0x0b55('0x1'));var logger=require('../../config/logger')(_0x0b55('0x2'));var moment=require('moment');var BPromise=require(_0x0b55('0x3'));var rp=require(_0x0b55('0x4'));var fs=require('fs');var path=require(_0x0b55('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b55('0x6'));module[_0x0b55('0x7')]=function(_0x3b5007,_0x144baf){return _0x3b5007[_0x0b55('0x8')](_0x0b55('0x9'),attributes,{'tableName':_0x0b55('0xa'),'paranoid':![],'indexes':[{'name':_0x0b55('0xb'),'fields':[_0x0b55('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b06=['moment','bluebird','request-promise','exports','define','MailQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x53df6a,_0x3fadb2){var _0x248985=function(_0x3c6f7f){while(--_0x3c6f7f){_0x53df6a['push'](_0x53df6a['shift']());}};_0x248985(++_0x3fadb2);}(_0x5b06,0xcd));var _0x65b0=function(_0x3f3c80,_0xf3d168){_0x3f3c80=_0x3f3c80-0x0;var _0xa281bc=_0x5b06[_0x3f3c80];return _0xa281bc;};'use strict';var _=require(_0x65b0('0x0'));var util=require('util');var logger=require(_0x65b0('0x1'))('api');var moment=require(_0x65b0('0x2'));var BPromise=require(_0x65b0('0x3'));var rp=require(_0x65b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x65b0('0x5')]=function(_0x1b2d92,_0x53909d){return _0x1b2d92[_0x65b0('0x6')](_0x65b0('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x65b0('0x8'),'fields':[_0x65b0('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 490ca6d..80e2d3d 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x50a70d,_0x18169b){var _0x1d6346=function(_0x49c1cf){while(--_0x49c1cf){_0x50a70d['push'](_0x50a70d['shift']());}};_0x1d6346(++_0x18169b);}(_0x326f,0xd1));var _0xf326=function(_0x46bb05,_0x426833){_0x46bb05=_0x46bb05-0x0;var _0x33527c=_0x326f[_0x46bb05];return _0x33527c;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1266d4,_0x325423){var _0x4698bb=function(_0xf5edd2){while(--_0xf5edd2){_0x1266d4['push'](_0x1266d4['shift']());}};_0x4698bb(++_0x325423);}(_0x1261,0x144));var _0x1126=function(_0x3e3221,_0x392851){_0x3e3221=_0x3e3221-0x0;var _0x190da4=_0x1261[_0x3e3221];return _0x190da4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 392563f..51a2f06 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3bdee5,_0x2eed61){var _0x4ead64=function(_0x1d9873){while(--_0x1d9873){_0x3bdee5['push'](_0x3bdee5['shift']());}};_0x4ead64(++_0x2eed61);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xcb91[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1b3d0d,_0x2e5f97){var _0x4c6f80=function(_0x363c19){while(--_0x363c19){_0x1b3d0d['push'](_0x1b3d0d['shift']());}};_0x4c6f80(++_0x2e5f97);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0xcb91[_0xb4cc12];return _0x8593b5;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3a3bb60..ef2785b 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 _0xa831=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xa831,0x138));var _0x1a83=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xa831[_0xf73c09];return _0xa8923c;};'use strict';var Sequelize=require(_0x1a83('0x0'));module[_0x1a83('0x1')]={'description':{'type':Sequelize[_0x1a83('0x2')]},'host':{'type':Sequelize[_0x1a83('0x2')]},'authentication':{'type':Sequelize[_0x1a83('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1a83('0x2')]},'port':{'type':Sequelize[_0x1a83('0x4')]},'tls':{'type':Sequelize[_0x1a83('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1a83('0x2')],'defaultValue':_0x1a83('0x5')},'connTimeout':{'type':Sequelize[_0x1a83('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1a83('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1a83('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3a2e=['STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x38b042,_0x3a16ac){var _0x2635b1=function(_0x476e27){while(--_0x476e27){_0x38b042['push'](_0x38b042['shift']());}};_0x2635b1(++_0x3a16ac);}(_0x3a2e,0x1f3));var _0xe3a2=function(_0xa7c34c,_0x440707){_0xa7c34c=_0xa7c34c-0x0;var _0x221c45=_0x3a2e[_0xa7c34c];return _0x221c45;};'use strict';var Sequelize=require(_0xe3a2('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe3a2('0x1')]},'authentication':{'type':Sequelize[_0xe3a2('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe3a2('0x1')]},'port':{'type':Sequelize[_0xe3a2('0x3')]},'tls':{'type':Sequelize[_0xe3a2('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe3a2('0x1')],'defaultValue':_0xe3a2('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe3a2('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe3a2('0x1')]},'modernAuthentication':{'type':Sequelize[_0xe3a2('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 318efb8..9b24667 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 _0x090f=['api','moment','path','rimraf','../../config/environment','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x1f9862,_0x1047d7){var _0x5c41b0=function(_0x4790a3){while(--_0x4790a3){_0x1f9862['push'](_0x1f9862['shift']());}};_0x5c41b0(++_0x1047d7);}(_0x090f,0x76));var _0xf090=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x090f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf090('0x0'));var util=require(_0xf090('0x1'));var logger=require(_0xf090('0x2'))(_0xf090('0x3'));var moment=require(_0xf090('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf090('0x5'));var rimraf=require(_0xf090('0x6'));var config=require(_0xf090('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x37fd4b,_0x14c238){return _0x37fd4b[_0xf090('0x8')](_0xf090('0x9'),attributes,{'tableName':_0xf090('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x410b=['exports','define','MailServerIn','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','path','./mailServerIn.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x410b,0x7c));var _0xb410=function(_0x2f8a0a,_0x594e11){_0x2f8a0a=_0x2f8a0a-0x0;var _0x1d985a=_0x410b[_0x2f8a0a];return _0x1d985a;};'use strict';var _=require(_0xb410('0x0'));var util=require(_0xb410('0x1'));var logger=require('../../config/logger')(_0xb410('0x2'));var moment=require(_0xb410('0x3'));var BPromise=require(_0xb410('0x4'));var rp=require(_0xb410('0x5'));var fs=require('fs');var path=require(_0xb410('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb410('0x7'));module[_0xb410('0x8')]=function(_0x12c147,_0x20ffa5){return _0x12c147[_0xb410('0x9')](_0xb410('0xa'),attributes,{'tableName':_0xb410('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5407178..f5d7e43 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 _0xc99a=['http','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailServerIn','MailServerIn','findAll','raw','options','where','limit','include','map','model','attributes','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc99a,0x7c));var _0xac99=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc99a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac99('0x0'));var util=require(_0xac99('0x1'));var moment=require(_0xac99('0x2'));var BPromise=require(_0xac99('0x3'));var rs=require(_0xac99('0x4'));var fs=require('fs');var Redis=require(_0xac99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xac99('0x6'));var logger=require(_0xac99('0x7'))(_0xac99('0x8'));var config=require(_0xac99('0x9'));var jayson=require(_0xac99('0xa'));var client=jayson[_0xac99('0xb')][_0xac99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4594ec,_0x2cb406,_0x1ae607){return new BPromise(function(_0x458f0b,_0x7335c8){return client['request'](_0x4594ec,_0x1ae607)[_0xac99('0xd')](function(_0x326bb5){logger['info'](_0xac99('0xe'),_0x2cb406,_0xac99('0xf'));logger[_0xac99('0x10')](_0xac99('0x11'),_0x2cb406,'request\x20sent',JSON[_0xac99('0x12')](_0x326bb5));if(_0x326bb5[_0xac99('0x13')]){if(_0x326bb5['error']['code']===0x1f4){logger['error'](_0xac99('0xe'),_0x2cb406,_0x326bb5['error'][_0xac99('0x14')]);return _0x7335c8(_0x326bb5[_0xac99('0x13')][_0xac99('0x14')]);}logger[_0xac99('0x13')](_0xac99('0xe'),_0x2cb406,_0x326bb5[_0xac99('0x13')]['message']);return _0x458f0b(_0x326bb5[_0xac99('0x13')]['message']);}else{logger['info'](_0xac99('0xe'),_0x2cb406,_0xac99('0xf'));_0x458f0b(_0x326bb5['result'][_0xac99('0x14')]);}})[_0xac99('0x15')](function(_0xe9f339){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2cb406,_0xe9f339);_0x7335c8(_0xe9f339);});});}exports[_0xac99('0x16')]=function(_0x2d5a20){var _0xa52fe2=this;return new Promise(function(_0x24b408,_0x400b29){return db[_0xac99('0x17')][_0xac99('0x18')]({'raw':_0x2d5a20['options']?_0x2d5a20['options'][_0xac99('0x19')]===undefined?!![]:![]:!![],'where':_0x2d5a20[_0xac99('0x1a')]?_0x2d5a20['options'][_0xac99('0x1b')]||null:null,'attributes':_0x2d5a20[_0xac99('0x1a')]?_0x2d5a20['options']['attributes']||null:null,'limit':_0x2d5a20[_0xac99('0x1a')]?_0x2d5a20[_0xac99('0x1a')][_0xac99('0x1c')]||null:null,'include':_0x2d5a20[_0xac99('0x1a')]?_0x2d5a20[_0xac99('0x1a')][_0xac99('0x1d')]?_[_0xac99('0x1e')](_0x2d5a20[_0xac99('0x1a')][_0xac99('0x1d')],function(_0x50866e){return{'model':db[_0x50866e[_0xac99('0x1f')]],'as':_0x50866e['as'],'attributes':_0x50866e[_0xac99('0x20')],'include':_0x50866e[_0xac99('0x1d')]?_[_0xac99('0x1e')](_0x50866e[_0xac99('0x1d')],function(_0x2d3b43){return{'model':db[_0x2d3b43['model']],'as':_0x2d3b43['as'],'attributes':_0x2d3b43[_0xac99('0x20')],'include':_0x2d3b43[_0xac99('0x1d')]?_[_0xac99('0x1e')](_0x2d3b43[_0xac99('0x1d')],function(_0x586fd3){return{'model':db[_0x586fd3[_0xac99('0x1f')]],'as':_0x586fd3['as'],'attributes':_0x586fd3['attributes']};}):[]};}):[]};}):[]:[]})[_0xac99('0xd')](function(_0x2423fc){logger[_0xac99('0x21')]('GetMailServerIn',_0x2d5a20);logger['debug'](_0xac99('0x16'),_0x2d5a20,JSON['stringify'](_0x2423fc));_0x24b408(_0x2423fc);})['catch'](function(_0xa4b35e){logger[_0xac99('0x13')]('GetMailServerIn',_0xa4b35e['message'],_0x2d5a20);_0x400b29(_0xa52fe2['error'](0x1f4,_0xa4b35e['message']));});});}; \ No newline at end of file +var _0x4060=['GetMailServerIn','MailServerIn','options','where','attributes','limit','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3bbb70,_0x17cbb3){var _0xa0866a=function(_0x2eb6ca){while(--_0x2eb6ca){_0x3bbb70['push'](_0x3bbb70['shift']());}};_0xa0866a(++_0x17cbb3);}(_0x4060,0x89));var _0x0406=function(_0x3ea5c5,_0x387059){_0x3ea5c5=_0x3ea5c5-0x0;var _0x177024=_0x4060[_0x3ea5c5];return _0x177024;};'use strict';var _=require('lodash');var util=require(_0x0406('0x0'));var moment=require('moment');var BPromise=require(_0x0406('0x1'));var rs=require(_0x0406('0x2'));var fs=require('fs');var Redis=require(_0x0406('0x3'));var db=require(_0x0406('0x4'))['db'];var utils=require(_0x0406('0x5'));var logger=require(_0x0406('0x6'))('rpc');var config=require(_0x0406('0x7'));var jayson=require(_0x0406('0x8'));var client=jayson['client'][_0x0406('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x268207,_0x50d503,_0x1a190d){return new BPromise(function(_0x1c99f9,_0x170d59){return client[_0x0406('0xa')](_0x268207,_0x1a190d)[_0x0406('0xb')](function(_0x2be039){logger[_0x0406('0xc')](_0x0406('0xd'),_0x50d503,'request\x20sent');logger[_0x0406('0xe')](_0x0406('0xf'),_0x50d503,_0x0406('0x10'),JSON[_0x0406('0x11')](_0x2be039));if(_0x2be039[_0x0406('0x12')]){if(_0x2be039[_0x0406('0x12')][_0x0406('0x13')]===0x1f4){logger[_0x0406('0x12')]('MailServerIn,\x20%s,\x20%s',_0x50d503,_0x2be039[_0x0406('0x12')][_0x0406('0x14')]);return _0x170d59(_0x2be039[_0x0406('0x12')]['message']);}logger['error'](_0x0406('0xd'),_0x50d503,_0x2be039[_0x0406('0x12')][_0x0406('0x14')]);return _0x1c99f9(_0x2be039[_0x0406('0x12')][_0x0406('0x14')]);}else{logger[_0x0406('0xc')](_0x0406('0xd'),_0x50d503,_0x0406('0x10'));_0x1c99f9(_0x2be039[_0x0406('0x15')][_0x0406('0x14')]);}})[_0x0406('0x16')](function(_0x37bf30){logger[_0x0406('0x12')]('MailServerIn,\x20%s,\x20%s',_0x50d503,_0x37bf30);_0x170d59(_0x37bf30);});});}exports[_0x0406('0x17')]=function(_0x13e3e8){var _0x1afec8=this;return new Promise(function(_0x5ad615,_0x5c186b){return db[_0x0406('0x18')]['findAll']({'raw':_0x13e3e8['options']?_0x13e3e8[_0x0406('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x13e3e8[_0x0406('0x19')]?_0x13e3e8[_0x0406('0x19')][_0x0406('0x1a')]||null:null,'attributes':_0x13e3e8[_0x0406('0x19')]?_0x13e3e8[_0x0406('0x19')][_0x0406('0x1b')]||null:null,'limit':_0x13e3e8[_0x0406('0x19')]?_0x13e3e8['options'][_0x0406('0x1c')]||null:null,'include':_0x13e3e8[_0x0406('0x19')]?_0x13e3e8['options'][_0x0406('0x1d')]?_[_0x0406('0x1e')](_0x13e3e8[_0x0406('0x19')][_0x0406('0x1d')],function(_0x2750d4){return{'model':db[_0x2750d4[_0x0406('0x1f')]],'as':_0x2750d4['as'],'attributes':_0x2750d4['attributes'],'include':_0x2750d4['include']?_[_0x0406('0x1e')](_0x2750d4[_0x0406('0x1d')],function(_0x3fc6ad){return{'model':db[_0x3fc6ad[_0x0406('0x1f')]],'as':_0x3fc6ad['as'],'attributes':_0x3fc6ad['attributes'],'include':_0x3fc6ad[_0x0406('0x1d')]?_[_0x0406('0x1e')](_0x3fc6ad[_0x0406('0x1d')],function(_0x522ac7){return{'model':db[_0x522ac7['model']],'as':_0x522ac7['as'],'attributes':_0x522ac7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5394ff){logger[_0x0406('0xc')]('GetMailServerIn',_0x13e3e8);logger[_0x0406('0xe')]('GetMailServerIn',_0x13e3e8,JSON['stringify'](_0x5394ff));_0x5ad615(_0x5394ff);})[_0x0406('0x16')](function(_0x46fc1a){logger[_0x0406('0x12')](_0x0406('0x17'),_0x46fc1a['message'],_0x13e3e8);_0x5c186b(_0x1afec8['error'](0x1f4,_0x46fc1a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6173453..0ab874c 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(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x11619c,_0x530d37){_0x11619c=_0x11619c-0x0;var _0x150458=_0x7a54[_0x11619c];return _0x150458;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index e4d6101..efab760 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 _0xfff0=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x28caf6,_0x266569){var _0x1aa957=function(_0x46b59b){while(--_0x46b59b){_0x28caf6['push'](_0x28caf6['shift']());}};_0x1aa957(++_0x266569);}(_0xfff0,0x139));var _0x0fff=function(_0x19fb64,_0x46e436){_0x19fb64=_0x19fb64-0x0;var _0x4321f4=_0xfff0[_0x19fb64];return _0x4321f4;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'description':{'type':Sequelize[_0x0fff('0x1')]},'host':{'type':Sequelize[_0x0fff('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x0fff('0x1')]},'port':{'type':Sequelize[_0x0fff('0x2')]},'secure':{'type':Sequelize[_0x0fff('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0fff('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0fff('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d2d=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x5308fd,_0x3c6260){var _0x1d12ea=function(_0x249f44){while(--_0x249f44){_0x5308fd['push'](_0x5308fd['shift']());}};_0x1d12ea(++_0x3c6260);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x41c79b,_0x3949f1){_0x41c79b=_0x41c79b-0x0;var _0x27da3c=_0x1d2d[_0x41c79b];return _0x27da3c;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'description':{'type':Sequelize[_0xd1d2('0x2')]},'host':{'type':Sequelize[_0xd1d2('0x2')]},'user':{'type':Sequelize[_0xd1d2('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd1d2('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd1d2('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xd1d2('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1ced861..2c18add 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 _0x734d=['merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','filter','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x734d,0x131));var _0xd734=function(_0x1686d4,_0x107bc8){_0x1686d4=_0x1686d4-0x0;var _0x248dc8=_0x734d[_0x1686d4];return _0x248dc8;};'use strict';var emlformat=require(_0xd734('0x0'));var rimraf=require(_0xd734('0x1'));var zipdir=require(_0xd734('0x2'));var jsonpatch=require(_0xd734('0x3'));var rp=require(_0xd734('0x4'));var moment=require(_0xd734('0x5'));var BPromise=require(_0xd734('0x6'));var Mustache=require(_0xd734('0x7'));var util=require(_0xd734('0x8'));var path=require(_0xd734('0x9'));var sox=require(_0xd734('0xa'));var csv=require('to-csv');var ejs=require(_0xd734('0xb'));var fs=require('fs');var fs_extra=require(_0xd734('0xc'));var _=require('lodash');var squel=require(_0xd734('0xd'));var crypto=require(_0xd734('0xe'));var jsforce=require(_0xd734('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd734('0x10'));var querystring=require(_0xd734('0x11'));var Papa=require(_0xd734('0x12'));var Redis=require(_0xd734('0x13'));var authService=require(_0xd734('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd734('0x15'));var logger=require(_0xd734('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xd734('0x17'));var licenseUtil=require(_0xd734('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fdaf1,_0x11ac4e){_0x11ac4e=_0x11ac4e||0xcc;return function(_0x2ae8a0){if(_0x2ae8a0){return _0x1fdaf1[_0xd734('0x19')](_0x11ac4e);}return _0x1fdaf1[_0xd734('0x1a')](_0x11ac4e)[_0xd734('0x1b')]();};}function respondWithResult(_0x3cb3a3,_0x2ab775){_0x2ab775=_0x2ab775||0xc8;return function(_0x18b156){if(_0x18b156){return _0x3cb3a3['status'](_0x2ab775)[_0xd734('0x1c')](_0x18b156);}};}function respondWithFilteredResult(_0x226aa2,_0x54403c){return function(_0x2c7b1b){if(_0x2c7b1b){var _0x17e866=typeof _0x54403c[_0xd734('0x1d')]==='undefined'&&typeof _0x54403c[_0xd734('0x1e')]==='undefined';var _0x23cda7=_0x2c7b1b[_0xd734('0x1f')];var _0x245628=_0x17e866?0x0:_0x54403c[_0xd734('0x1d')];var _0x3da23a=_0x17e866?_0x2c7b1b[_0xd734('0x1f')]:_0x54403c['offset']+_0x54403c['limit'];var _0x394e82;if(_0x3da23a>=_0x23cda7){_0x3da23a=_0x23cda7;_0x394e82=0xc8;}else{_0x394e82=0xce;}_0x226aa2[_0xd734('0x1a')](_0x394e82);return _0x226aa2[_0xd734('0x20')](_0xd734('0x21'),_0x245628+'-'+_0x3da23a+'/'+_0x23cda7)['json'](_0x2c7b1b);}return null;};}function patchUpdates(_0x2d088c){return function(_0x432a7c){try{jsonpatch[_0xd734('0x22')](_0x432a7c,_0x2d088c,!![]);}catch(_0x27079c){return BPromise[_0xd734('0x23')](_0x27079c);}return _0x432a7c['save']();};}function saveUpdates(_0x5e8afc,_0x3ac51e){return function(_0x294fbe){if(_0x294fbe){return _0x294fbe[_0xd734('0x24')](_0x5e8afc)[_0xd734('0x25')](function(_0x43ef35){return _0x43ef35;});}return null;};}function removeEntity(_0x5d4d2a,_0x484501){return function(_0x119749){if(_0x119749){return _0x119749['destroy']()[_0xd734('0x25')](function(){_0x5d4d2a['status'](0xcc)[_0xd734('0x1b')]();});}};}function handleEntityNotFound(_0x40bb43,_0xd387c3){return function(_0x19a819){if(!_0x19a819){_0x40bb43[_0xd734('0x19')](0x194);}return _0x19a819;};}function handleError(_0x4e14df,_0x1e56e7){_0x1e56e7=_0x1e56e7||0x1f4;return function(_0x4b06a3){logger[_0xd734('0x26')](_0x4b06a3[_0xd734('0x27')]);if(_0x4b06a3[_0xd734('0x28')]){delete _0x4b06a3[_0xd734('0x28')];}_0x4e14df[_0xd734('0x1a')](_0x1e56e7)[_0xd734('0x29')](_0x4b06a3);};}exports[_0xd734('0x2a')]=function(_0x9dc670,_0xeff2e6){var _0x4c5eac={},_0x28d36c={},_0x449376={'count':0x0,'rows':[]};var _0x1d5b56=_[_0xd734('0x2b')](db[_0xd734('0x2c')][_0xd734('0x2d')],function(_0x3aafee){return{'name':_0x3aafee['fieldName'],'type':_0x3aafee[_0xd734('0x2e')][_0xd734('0x2f')]};});_0x28d36c[_0xd734('0x30')]=_[_0xd734('0x2b')](_0x1d5b56,_0xd734('0x28'));_0x28d36c[_0xd734('0x31')]=_[_0xd734('0x32')](_0x9dc670[_0xd734('0x31')]);_0x28d36c['filters']=_[_0xd734('0x33')](_0x28d36c[_0xd734('0x30')],_0x28d36c[_0xd734('0x31')]);_0x4c5eac[_0xd734('0x34')]=_['intersection'](_0x28d36c['model'],qs[_0xd734('0x35')](_0x9dc670[_0xd734('0x31')]['fields']));_0x4c5eac[_0xd734('0x34')]=_0x4c5eac[_0xd734('0x34')][_0xd734('0x36')]?_0x4c5eac['attributes']:_0x28d36c[_0xd734('0x30')];if(!_0x9dc670[_0xd734('0x31')]['hasOwnProperty']('nolimit')){_0x4c5eac[_0xd734('0x1e')]=qs[_0xd734('0x1e')](_0x9dc670[_0xd734('0x31')][_0xd734('0x1e')]);_0x4c5eac[_0xd734('0x1d')]=qs[_0xd734('0x1d')](_0x9dc670[_0xd734('0x31')][_0xd734('0x1d')]);}_0x4c5eac[_0xd734('0x37')]=qs['sort'](_0x9dc670[_0xd734('0x31')][_0xd734('0x38')]);_0x4c5eac['where']=qs[_0xd734('0x39')](_['pick'](_0x9dc670[_0xd734('0x31')],_0x28d36c[_0xd734('0x39')]),_0x1d5b56);if(_0x9dc670[_0xd734('0x31')][_0xd734('0x3a')]){_0x4c5eac[_0xd734('0x3b')]=_[_0xd734('0x3c')](_0x4c5eac[_0xd734('0x3b')],{'$or':_[_0xd734('0x2b')](_0x1d5b56,function(_0x1f4249){if(_0x1f4249[_0xd734('0x2e')]!==_0xd734('0x3d')){var _0x3de71e={};_0x3de71e[_0x1f4249[_0xd734('0x28')]]={'$like':'%'+_0x9dc670[_0xd734('0x31')]['filter']+'%'};return _0x3de71e;}})});}_0x4c5eac=_['merge']({},_0x4c5eac,_0x9dc670['options']);var _0x431c78={'where':_0x4c5eac[_0xd734('0x3b')]};return db['MailServerOut'][_0xd734('0x1f')](_0x431c78)[_0xd734('0x25')](function(_0x5e43d3){_0x449376['count']=_0x5e43d3;if(_0x9dc670[_0xd734('0x31')][_0xd734('0x3e')]){_0x4c5eac['include']=[{'all':!![]}];}return db[_0xd734('0x2c')][_0xd734('0x3f')](_0x4c5eac);})[_0xd734('0x25')](function(_0x295f53){_0x449376['rows']=_0x295f53;return _0x449376;})[_0xd734('0x25')](respondWithFilteredResult(_0xeff2e6,_0x4c5eac))[_0xd734('0x40')](handleError(_0xeff2e6,null));};exports[_0xd734('0x41')]=function(_0x19c781,_0x4b8a7c){var _0x34b771={'raw':!![],'where':{'id':_0x19c781[_0xd734('0x42')]['id']}},_0x1e4551={};_0x1e4551[_0xd734('0x30')]=_[_0xd734('0x32')](db['MailServerOut']['rawAttributes']);_0x1e4551[_0xd734('0x31')]=_[_0xd734('0x32')](_0x19c781[_0xd734('0x31')]);_0x1e4551[_0xd734('0x39')]=_['intersection'](_0x1e4551[_0xd734('0x30')],_0x1e4551[_0xd734('0x31')]);_0x34b771[_0xd734('0x34')]=_[_0xd734('0x33')](_0x1e4551[_0xd734('0x30')],qs[_0xd734('0x35')](_0x19c781[_0xd734('0x31')][_0xd734('0x35')]));_0x34b771[_0xd734('0x34')]=_0x34b771[_0xd734('0x34')][_0xd734('0x36')]?_0x34b771[_0xd734('0x34')]:_0x1e4551[_0xd734('0x30')];if(_0x19c781[_0xd734('0x31')]['includeAll']){_0x34b771[_0xd734('0x43')]=[{'all':!![]}];}_0x34b771=_[_0xd734('0x3c')]({},_0x34b771,_0x19c781[_0xd734('0x44')]);return db[_0xd734('0x2c')]['find'](_0x34b771)[_0xd734('0x25')](handleEntityNotFound(_0x4b8a7c,null))[_0xd734('0x25')](respondWithResult(_0x4b8a7c,null))[_0xd734('0x40')](handleError(_0x4b8a7c,null));};exports[_0xd734('0x45')]=function(_0x1e9c1f,_0x59b556){return db['MailServerOut'][_0xd734('0x45')](_0x1e9c1f[_0xd734('0x46')],{})['then'](respondWithResult(_0x59b556,0xc9))[_0xd734('0x40')](handleError(_0x59b556,null));};exports[_0xd734('0x24')]=function(_0x2e820d,_0x1fc075){if(_0x2e820d[_0xd734('0x46')]['id']){delete _0x2e820d[_0xd734('0x46')]['id'];}return db[_0xd734('0x2c')][_0xd734('0x47')]({'where':{'id':_0x2e820d[_0xd734('0x42')]['id']}})[_0xd734('0x25')](handleEntityNotFound(_0x1fc075,null))[_0xd734('0x25')](saveUpdates(_0x2e820d[_0xd734('0x46')],null))['then'](respondWithResult(_0x1fc075,null))[_0xd734('0x40')](handleError(_0x1fc075,null));};exports[_0xd734('0x48')]=function(_0x175a34,_0x9bccf8){return db[_0xd734('0x2c')][_0xd734('0x47')]({'where':{'id':_0x175a34[_0xd734('0x42')]['id']}})[_0xd734('0x25')](handleEntityNotFound(_0x9bccf8,null))[_0xd734('0x25')](removeEntity(_0x9bccf8,null))[_0xd734('0x40')](handleError(_0x9bccf8,null));}; \ No newline at end of file +var _0x4ba4=['reject','then','error','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x153da6,_0xc9bfde){var _0xf01a0d=function(_0x409ed5){while(--_0x409ed5){_0x153da6['push'](_0x153da6['shift']());}};_0xf01a0d(++_0xc9bfde);}(_0x4ba4,0x70));var _0x44ba=function(_0x37dd8b,_0x57b8da){_0x37dd8b=_0x37dd8b-0x0;var _0xb1cc6c=_0x4ba4[_0x37dd8b];return _0xb1cc6c;};'use strict';var emlformat=require(_0x44ba('0x0'));var rimraf=require(_0x44ba('0x1'));var zipdir=require(_0x44ba('0x2'));var jsonpatch=require(_0x44ba('0x3'));var rp=require('request-promise');var moment=require(_0x44ba('0x4'));var BPromise=require(_0x44ba('0x5'));var Mustache=require('mustache');var util=require(_0x44ba('0x6'));var path=require('path');var sox=require(_0x44ba('0x7'));var csv=require('to-csv');var ejs=require(_0x44ba('0x8'));var fs=require('fs');var fs_extra=require(_0x44ba('0x9'));var _=require(_0x44ba('0xa'));var squel=require(_0x44ba('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x44ba('0xc'));var toCsv=require(_0x44ba('0xd'));var querystring=require(_0x44ba('0xe'));var Papa=require(_0x44ba('0xf'));var Redis=require('ioredis');var authService=require(_0x44ba('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x44ba('0x11'));var hardwareService=require(_0x44ba('0x12'));var logger=require('../../config/logger')(_0x44ba('0x13'));var utils=require(_0x44ba('0x14'));var config=require(_0x44ba('0x15'));var licenseUtil=require(_0x44ba('0x16'));var db=require(_0x44ba('0x17'))['db'];function respondWithStatusCode(_0x2b244a,_0x3c2477){_0x3c2477=_0x3c2477||0xcc;return function(_0x15a709){if(_0x15a709){return _0x2b244a['sendStatus'](_0x3c2477);}return _0x2b244a[_0x44ba('0x18')](_0x3c2477)[_0x44ba('0x19')]();};}function respondWithResult(_0x4fb7a4,_0x59df97){_0x59df97=_0x59df97||0xc8;return function(_0x3eb7f2){if(_0x3eb7f2){return _0x4fb7a4[_0x44ba('0x18')](_0x59df97)[_0x44ba('0x1a')](_0x3eb7f2);}};}function respondWithFilteredResult(_0x483d40,_0x5b0ac7){return function(_0x1c92a7){if(_0x1c92a7){var _0x4ba67c=typeof _0x5b0ac7[_0x44ba('0x1b')]==='undefined'&&typeof _0x5b0ac7['limit']===_0x44ba('0x1c');var _0x3c5ada=_0x1c92a7[_0x44ba('0x1d')];var _0x2d1406=_0x4ba67c?0x0:_0x5b0ac7[_0x44ba('0x1b')];var _0x372941=_0x4ba67c?_0x1c92a7[_0x44ba('0x1d')]:_0x5b0ac7[_0x44ba('0x1b')]+_0x5b0ac7[_0x44ba('0x1e')];var _0x1801bf;if(_0x372941>=_0x3c5ada){_0x372941=_0x3c5ada;_0x1801bf=0xc8;}else{_0x1801bf=0xce;}_0x483d40['status'](_0x1801bf);return _0x483d40[_0x44ba('0x1f')](_0x44ba('0x20'),_0x2d1406+'-'+_0x372941+'/'+_0x3c5ada)[_0x44ba('0x1a')](_0x1c92a7);}return null;};}function patchUpdates(_0x1d6a47){return function(_0x59cd3d){try{jsonpatch[_0x44ba('0x21')](_0x59cd3d,_0x1d6a47,!![]);}catch(_0x428b30){return BPromise[_0x44ba('0x22')](_0x428b30);}return _0x59cd3d['save']();};}function saveUpdates(_0x25f312,_0xdb4015){return function(_0x401545){if(_0x401545){return _0x401545['update'](_0x25f312)[_0x44ba('0x23')](function(_0x1630f2){return _0x1630f2;});}return null;};}function removeEntity(_0x2e5a0b,_0x450ef7){return function(_0x397a00){if(_0x397a00){return _0x397a00['destroy']()['then'](function(){_0x2e5a0b[_0x44ba('0x18')](0xcc)[_0x44ba('0x19')]();});}};}function handleEntityNotFound(_0x2f5d35,_0x45ed90){return function(_0x164860){if(!_0x164860){_0x2f5d35['sendStatus'](0x194);}return _0x164860;};}function handleError(_0x1513d3,_0x28f599){_0x28f599=_0x28f599||0x1f4;return function(_0x1be8fd){logger[_0x44ba('0x24')](_0x1be8fd[_0x44ba('0x25')]);if(_0x1be8fd[_0x44ba('0x26')]){delete _0x1be8fd[_0x44ba('0x26')];}_0x1513d3['status'](_0x28f599)[_0x44ba('0x27')](_0x1be8fd);};}exports[_0x44ba('0x28')]=function(_0x3f88fe,_0x4126e1){var _0x55ba21={},_0x30cfbd={},_0x4b9c50={'count':0x0,'rows':[]};var _0x2d0c1e=_[_0x44ba('0x29')](db['MailServerOut']['rawAttributes'],function(_0x4598c1){return{'name':_0x4598c1['fieldName'],'type':_0x4598c1[_0x44ba('0x2a')][_0x44ba('0x2b')]};});_0x30cfbd[_0x44ba('0x2c')]=_['map'](_0x2d0c1e,'name');_0x30cfbd[_0x44ba('0x2d')]=_[_0x44ba('0x2e')](_0x3f88fe['query']);_0x30cfbd['filters']=_[_0x44ba('0x2f')](_0x30cfbd[_0x44ba('0x2c')],_0x30cfbd[_0x44ba('0x2d')]);_0x55ba21[_0x44ba('0x30')]=_[_0x44ba('0x2f')](_0x30cfbd[_0x44ba('0x2c')],qs['fields'](_0x3f88fe[_0x44ba('0x2d')][_0x44ba('0x31')]));_0x55ba21['attributes']=_0x55ba21[_0x44ba('0x30')][_0x44ba('0x32')]?_0x55ba21[_0x44ba('0x30')]:_0x30cfbd[_0x44ba('0x2c')];if(!_0x3f88fe[_0x44ba('0x2d')][_0x44ba('0x33')](_0x44ba('0x34'))){_0x55ba21[_0x44ba('0x1e')]=qs[_0x44ba('0x1e')](_0x3f88fe['query'][_0x44ba('0x1e')]);_0x55ba21[_0x44ba('0x1b')]=qs[_0x44ba('0x1b')](_0x3f88fe[_0x44ba('0x2d')][_0x44ba('0x1b')]);}_0x55ba21['order']=qs[_0x44ba('0x35')](_0x3f88fe[_0x44ba('0x2d')][_0x44ba('0x35')]);_0x55ba21[_0x44ba('0x36')]=qs['filters'](_[_0x44ba('0x37')](_0x3f88fe[_0x44ba('0x2d')],_0x30cfbd[_0x44ba('0x38')]),_0x2d0c1e);if(_0x3f88fe[_0x44ba('0x2d')][_0x44ba('0x39')]){_0x55ba21['where']=_[_0x44ba('0x3a')](_0x55ba21['where'],{'$or':_[_0x44ba('0x29')](_0x2d0c1e,function(_0x5e0697){if(_0x5e0697['type']!=='VIRTUAL'){var _0x34e298={};_0x34e298[_0x5e0697[_0x44ba('0x26')]]={'$like':'%'+_0x3f88fe[_0x44ba('0x2d')][_0x44ba('0x39')]+'%'};return _0x34e298;}})});}_0x55ba21=_[_0x44ba('0x3a')]({},_0x55ba21,_0x3f88fe[_0x44ba('0x3b')]);var _0x9ae042={'where':_0x55ba21[_0x44ba('0x36')]};return db[_0x44ba('0x3c')][_0x44ba('0x1d')](_0x9ae042)['then'](function(_0x313e48){_0x4b9c50[_0x44ba('0x1d')]=_0x313e48;if(_0x3f88fe[_0x44ba('0x2d')][_0x44ba('0x3d')]){_0x55ba21[_0x44ba('0x3e')]=[{'all':!![]}];}return db[_0x44ba('0x3c')][_0x44ba('0x3f')](_0x55ba21);})['then'](function(_0x3474dd){_0x4b9c50[_0x44ba('0x40')]=_0x3474dd;return _0x4b9c50;})[_0x44ba('0x23')](respondWithFilteredResult(_0x4126e1,_0x55ba21))[_0x44ba('0x41')](handleError(_0x4126e1,null));};exports[_0x44ba('0x42')]=function(_0x4fa372,_0x5e1ac0){var _0x156859={'raw':!![],'where':{'id':_0x4fa372[_0x44ba('0x43')]['id']}},_0x20f7e5={};_0x20f7e5[_0x44ba('0x2c')]=_['keys'](db[_0x44ba('0x3c')]['rawAttributes']);_0x20f7e5[_0x44ba('0x2d')]=_['keys'](_0x4fa372[_0x44ba('0x2d')]);_0x20f7e5[_0x44ba('0x38')]=_[_0x44ba('0x2f')](_0x20f7e5[_0x44ba('0x2c')],_0x20f7e5[_0x44ba('0x2d')]);_0x156859[_0x44ba('0x30')]=_[_0x44ba('0x2f')](_0x20f7e5[_0x44ba('0x2c')],qs[_0x44ba('0x31')](_0x4fa372['query'][_0x44ba('0x31')]));_0x156859[_0x44ba('0x30')]=_0x156859[_0x44ba('0x30')][_0x44ba('0x32')]?_0x156859['attributes']:_0x20f7e5[_0x44ba('0x2c')];if(_0x4fa372['query'][_0x44ba('0x3d')]){_0x156859['include']=[{'all':!![]}];}_0x156859=_[_0x44ba('0x3a')]({},_0x156859,_0x4fa372[_0x44ba('0x3b')]);return db[_0x44ba('0x3c')][_0x44ba('0x44')](_0x156859)[_0x44ba('0x23')](handleEntityNotFound(_0x5e1ac0,null))[_0x44ba('0x23')](respondWithResult(_0x5e1ac0,null))[_0x44ba('0x41')](handleError(_0x5e1ac0,null));};exports['create']=function(_0x266109,_0x1dedeb){return db[_0x44ba('0x3c')][_0x44ba('0x45')](_0x266109['body'],{})[_0x44ba('0x23')](respondWithResult(_0x1dedeb,0xc9))[_0x44ba('0x41')](handleError(_0x1dedeb,null));};exports[_0x44ba('0x46')]=function(_0x2ae329,_0x44b86f){if(_0x2ae329[_0x44ba('0x47')]['id']){delete _0x2ae329[_0x44ba('0x47')]['id'];}return db[_0x44ba('0x3c')][_0x44ba('0x44')]({'where':{'id':_0x2ae329[_0x44ba('0x43')]['id']}})[_0x44ba('0x23')](handleEntityNotFound(_0x44b86f,null))[_0x44ba('0x23')](saveUpdates(_0x2ae329[_0x44ba('0x47')],null))[_0x44ba('0x23')](respondWithResult(_0x44b86f,null))['catch'](handleError(_0x44b86f,null));};exports[_0x44ba('0x48')]=function(_0x30c4d0,_0x397e0a){return db[_0x44ba('0x3c')]['find']({'where':{'id':_0x30c4d0[_0x44ba('0x43')]['id']}})[_0x44ba('0x23')](handleEntityNotFound(_0x397e0a,null))[_0x44ba('0x23')](removeEntity(_0x397e0a,null))[_0x44ba('0x41')](handleError(_0x397e0a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index ca4ef65..dc6a9f9 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 _0x933d=['define','MailServerOut','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x544b3f,_0x4d8b66){var _0x15787f=function(_0x12467e){while(--_0x12467e){_0x544b3f['push'](_0x544b3f['shift']());}};_0x15787f(++_0x4d8b66);}(_0x933d,0x1c5));var _0xd933=function(_0x35f85e,_0x500bcc){_0x35f85e=_0x35f85e-0x0;var _0x41e71a=_0x933d[_0x35f85e];return _0x41e71a;};'use strict';var _=require(_0xd933('0x0'));var util=require('util');var logger=require(_0xd933('0x1'))('api');var moment=require(_0xd933('0x2'));var BPromise=require(_0xd933('0x3'));var rp=require(_0xd933('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd933('0x5'));var config=require(_0xd933('0x6'));var attributes=require(_0xd933('0x7'));module[_0xd933('0x8')]=function(_0x3674b3,_0x2f4243){return _0x3674b3[_0xd933('0x9')](_0xd933('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde00=['../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d0d1d,_0x4cd118){var _0xd07694=function(_0xed355c){while(--_0xed355c){_0x2d0d1d['push'](_0x2d0d1d['shift']());}};_0xd07694(++_0x4cd118);}(_0xde00,0x19b));var _0x0de0=function(_0x458b0,_0x15f01d){_0x458b0=_0x458b0-0x0;var _0x294e1f=_0xde00[_0x458b0];return _0x294e1f;};'use strict';var _=require(_0x0de0('0x0'));var util=require(_0x0de0('0x1'));var logger=require(_0x0de0('0x2'))(_0x0de0('0x3'));var moment=require(_0x0de0('0x4'));var BPromise=require(_0x0de0('0x5'));var rp=require(_0x0de0('0x6'));var fs=require('fs');var path=require(_0x0de0('0x7'));var rimraf=require(_0x0de0('0x8'));var config=require(_0x0de0('0x9'));var attributes=require(_0x0de0('0xa'));module[_0x0de0('0xb')]=function(_0x3607ec,_0x1608fc){return _0x3607ec[_0x0de0('0xc')](_0x0de0('0xd'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 500439a..adfae12 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4f4674,_0x4da90a){var _0x34ac13=function(_0x532d3c){while(--_0x532d3c){_0x4f4674['push'](_0x4f4674['shift']());}};_0x34ac13(++_0x4da90a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x51fc1d,_0x5838b4){var _0x32e9b3=function(_0x51d1c5){while(--_0x51d1c5){_0x51fc1d['push'](_0x51fc1d['shift']());}};_0x32e9b3(++_0x5838b4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f516d57..89b7822 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 _0x27e1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3e4465,_0xadc29e){var _0xd48d07=function(_0x2960c2){while(--_0x2960c2){_0x3e4465['push'](_0x3e4465['shift']());}};_0xd48d07(++_0xadc29e);}(_0x27e1,0x13a));var _0x127e=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x27e1[_0x3b3cc6];return _0x1161e4;};'use strict';var multer=require(_0x127e('0x0'));var util=require('util');var path=require(_0x127e('0x1'));var timeout=require(_0x127e('0x2'));var express=require(_0x127e('0x3'));var router=express[_0x127e('0x4')]();var fs_extra=require(_0x127e('0x5'));var auth=require(_0x127e('0x6'));var interaction=require(_0x127e('0x7'));var config=require(_0x127e('0x8'));var controller=require(_0x127e('0x9'));router['get']('/',auth[_0x127e('0xa')](),controller[_0x127e('0xb')]);router[_0x127e('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x127e('0xd'),auth[_0x127e('0xa')](),controller[_0x127e('0xe')]);router[_0x127e('0xf')]('/',auth[_0x127e('0xa')](),controller[_0x127e('0x10')]);router[_0x127e('0x11')](_0x127e('0xd'),auth[_0x127e('0xa')](),controller[_0x127e('0x12')]);router['delete'](_0x127e('0xd'),auth[_0x127e('0xa')](),controller['destroy']);module[_0x127e('0x13')]=router; \ No newline at end of file +var _0x7dee=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','create','put','update'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7dee,0x147));var _0xe7de=function(_0x1b14da,_0x3bc244){_0x1b14da=_0x1b14da-0x0;var _0x44241d=_0x7dee[_0x1b14da];return _0x44241d;};'use strict';var multer=require(_0xe7de('0x0'));var util=require(_0xe7de('0x1'));var path=require(_0xe7de('0x2'));var timeout=require(_0xe7de('0x3'));var express=require('express');var router=express[_0xe7de('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe7de('0x5'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0xe7de('0x6')]('/',auth['isAuthenticated'](),controller[_0xe7de('0x7')]);router['get'](_0xe7de('0x8'),auth[_0xe7de('0x9')](),controller[_0xe7de('0xa')]);router[_0xe7de('0x6')](_0xe7de('0xb'),auth[_0xe7de('0x9')](),controller['show']);router['post']('/',auth[_0xe7de('0x9')](),controller[_0xe7de('0xc')]);router[_0xe7de('0xd')](_0xe7de('0xb'),auth['isAuthenticated'](),controller[_0xe7de('0xe')]);router[_0xe7de('0xf')](_0xe7de('0xb'),auth[_0xe7de('0x9')](),controller[_0xe7de('0x10')]);module[_0xe7de('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 df30580..c6de579 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 _0x8085=['name','STRING','sequelize'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x8085,0x71));var _0x5808=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x8085[_0x53abe5];return _0xc1c37e;};'use strict';var Sequelize=require(_0x5808('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5808('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5808('0x2')]}}; \ No newline at end of file +var _0x06f4=['name','STRING','sequelize','exports'];(function(_0x14909b,_0x5be22d){var _0x45c8c5=function(_0x3aabf5){while(--_0x3aabf5){_0x14909b['push'](_0x14909b['shift']());}};_0x45c8c5(++_0x5be22d);}(_0x06f4,0x136));var _0x406f=function(_0x12b1bd,_0x49d4e6){_0x12b1bd=_0x12b1bd-0x0;var _0x384d87=_0x06f4[_0x12b1bd];return _0x384d87;};'use strict';var Sequelize=require(_0x406f('0x0'));module[_0x406f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x406f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x406f('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index c2dbc6c..0ca918d 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 _0x248b=['body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','length','options','find','catch','create'];(function(_0x4ff69a,_0x240ace){var _0x35b2c4=function(_0x4f5c5e){while(--_0x4f5c5e){_0x4ff69a['push'](_0x4ff69a['shift']());}};_0x35b2c4(++_0x240ace);}(_0x248b,0x9a));var _0xb248=function(_0x4e3b43,_0x447312){_0x4e3b43=_0x4e3b43-0x0;var _0x590f8c=_0x248b[_0x4e3b43];return _0x590f8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb248('0x0'));var zipdir=require(_0xb248('0x1'));var jsonpatch=require(_0xb248('0x2'));var rp=require(_0xb248('0x3'));var moment=require('moment');var BPromise=require(_0xb248('0x4'));var Mustache=require(_0xb248('0x5'));var util=require(_0xb248('0x6'));var path=require(_0xb248('0x7'));var sox=require(_0xb248('0x8'));var csv=require('to-csv');var ejs=require(_0xb248('0x9'));var fs=require('fs');var fs_extra=require(_0xb248('0xa'));var _=require(_0xb248('0xb'));var squel=require(_0xb248('0xc'));var crypto=require('crypto');var jsforce=require(_0xb248('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb248('0xe'));var querystring=require(_0xb248('0xf'));var Papa=require('papaparse');var Redis=require(_0xb248('0x10'));var authService=require(_0xb248('0x11'));var qs=require(_0xb248('0x12'));var as=require(_0xb248('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb248('0x14'));var licenseUtil=require(_0xb248('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5341cb,_0x3be227){_0x3be227=_0x3be227||0xcc;return function(_0x1bd0aa){if(_0x1bd0aa){return _0x5341cb[_0xb248('0x16')](_0x3be227);}return _0x5341cb[_0xb248('0x17')](_0x3be227)[_0xb248('0x18')]();};}function respondWithResult(_0x55d46f,_0x3e6381){_0x3e6381=_0x3e6381||0xc8;return function(_0x339749){if(_0x339749){return _0x55d46f[_0xb248('0x17')](_0x3e6381)['json'](_0x339749);}};}function respondWithFilteredResult(_0x58ed90,_0x5b287b){return function(_0x16c4b1){if(_0x16c4b1){var _0x29b8ea=typeof _0x5b287b['offset']===_0xb248('0x19')&&typeof _0x5b287b['limit']===_0xb248('0x19');var _0x5e8d03=_0x16c4b1['count'];var _0x43c915=_0x29b8ea?0x0:_0x5b287b['offset'];var _0x215b54=_0x29b8ea?_0x16c4b1[_0xb248('0x1a')]:_0x5b287b[_0xb248('0x1b')]+_0x5b287b[_0xb248('0x1c')];var _0x313c74;if(_0x215b54>=_0x5e8d03){_0x215b54=_0x5e8d03;_0x313c74=0xc8;}else{_0x313c74=0xce;}_0x58ed90['status'](_0x313c74);return _0x58ed90[_0xb248('0x1d')](_0xb248('0x1e'),_0x43c915+'-'+_0x215b54+'/'+_0x5e8d03)[_0xb248('0x1f')](_0x16c4b1);}return null;};}function patchUpdates(_0x322730){return function(_0x1de90d){try{jsonpatch[_0xb248('0x20')](_0x1de90d,_0x322730,!![]);}catch(_0x189d59){return BPromise[_0xb248('0x21')](_0x189d59);}return _0x1de90d[_0xb248('0x22')]();};}function saveUpdates(_0x251383,_0x14c8c9){return function(_0x4920da){if(_0x4920da){return _0x4920da[_0xb248('0x23')](_0x251383)[_0xb248('0x24')](function(_0x5c8024){return _0x5c8024;});}return null;};}function removeEntity(_0x1873cf,_0x40a762){return function(_0x1c208f){if(_0x1c208f){return _0x1c208f['destroy']()[_0xb248('0x24')](function(){_0x1873cf[_0xb248('0x17')](0xcc)[_0xb248('0x18')]();});}};}function handleEntityNotFound(_0x291ba2,_0x42baba){return function(_0x3a2468){if(!_0x3a2468){_0x291ba2[_0xb248('0x16')](0x194);}return _0x3a2468;};}function handleError(_0x26e9d8,_0x21f22e){_0x21f22e=_0x21f22e||0x1f4;return function(_0x18cde4){logger[_0xb248('0x25')](_0x18cde4[_0xb248('0x26')]);if(_0x18cde4[_0xb248('0x27')]){delete _0x18cde4[_0xb248('0x27')];}_0x26e9d8['status'](_0x21f22e)[_0xb248('0x28')](_0x18cde4);};}exports[_0xb248('0x29')]=function(_0x366a58,_0x20913b){var _0x2b4c0f={},_0x1ccdcd={},_0x1b46b6={'count':0x0,'rows':[]};var _0x1126d5=_[_0xb248('0x2a')](db[_0xb248('0x2b')][_0xb248('0x2c')],function(_0x1d8099){return{'name':_0x1d8099[_0xb248('0x2d')],'type':_0x1d8099[_0xb248('0x2e')][_0xb248('0x2f')]};});_0x1ccdcd['model']=_[_0xb248('0x2a')](_0x1126d5,_0xb248('0x27'));_0x1ccdcd[_0xb248('0x30')]=_[_0xb248('0x31')](_0x366a58[_0xb248('0x30')]);_0x1ccdcd[_0xb248('0x32')]=_['intersection'](_0x1ccdcd['model'],_0x1ccdcd[_0xb248('0x30')]);_0x2b4c0f[_0xb248('0x33')]=_[_0xb248('0x34')](_0x1ccdcd['model'],qs['fields'](_0x366a58[_0xb248('0x30')][_0xb248('0x35')]));_0x2b4c0f[_0xb248('0x33')]=_0x2b4c0f[_0xb248('0x33')]['length']?_0x2b4c0f['attributes']:_0x1ccdcd[_0xb248('0x36')];if(!_0x366a58[_0xb248('0x30')][_0xb248('0x37')](_0xb248('0x38'))){_0x2b4c0f['limit']=qs[_0xb248('0x1c')](_0x366a58[_0xb248('0x30')]['limit']);_0x2b4c0f[_0xb248('0x1b')]=qs['offset'](_0x366a58[_0xb248('0x30')][_0xb248('0x1b')]);}_0x2b4c0f[_0xb248('0x39')]=qs[_0xb248('0x3a')](_0x366a58[_0xb248('0x30')][_0xb248('0x3a')]);_0x2b4c0f[_0xb248('0x3b')]=qs[_0xb248('0x32')](_[_0xb248('0x3c')](_0x366a58['query'],_0x1ccdcd[_0xb248('0x32')]),_0x1126d5);if(_0x366a58[_0xb248('0x30')]['filter']){_0x2b4c0f[_0xb248('0x3b')]=_[_0xb248('0x3d')](_0x2b4c0f[_0xb248('0x3b')],{'$or':_[_0xb248('0x2a')](_0x1126d5,function(_0x4486ef){if(_0x4486ef[_0xb248('0x2e')]!==_0xb248('0x3e')){var _0x5dbe38={};_0x5dbe38[_0x4486ef[_0xb248('0x27')]]={'$like':'%'+_0x366a58['query'][_0xb248('0x3f')]+'%'};return _0x5dbe38;}})});}_0x2b4c0f=_[_0xb248('0x3d')]({},_0x2b4c0f,_0x366a58['options']);var _0x234a07={'where':_0x2b4c0f[_0xb248('0x3b')]};return db['MailSubstatus'][_0xb248('0x1a')](_0x234a07)[_0xb248('0x24')](function(_0x283537){_0x1b46b6[_0xb248('0x1a')]=_0x283537;if(_0x366a58[_0xb248('0x30')][_0xb248('0x40')]){_0x2b4c0f[_0xb248('0x41')]=[{'all':!![]}];}return db[_0xb248('0x2b')]['findAll'](_0x2b4c0f);})[_0xb248('0x24')](function(_0x188682){_0x1b46b6[_0xb248('0x42')]=_0x188682;return _0x1b46b6;})[_0xb248('0x24')](respondWithFilteredResult(_0x20913b,_0x2b4c0f))['catch'](handleError(_0x20913b,null));};exports[_0xb248('0x43')]=function(_0x351624,_0x384a0f){var _0x2baa8a={'raw':!![],'where':{'id':_0x351624[_0xb248('0x44')]['id']}},_0x38a017={};_0x38a017[_0xb248('0x36')]=_[_0xb248('0x31')](db[_0xb248('0x2b')][_0xb248('0x2c')]);_0x38a017['query']=_[_0xb248('0x31')](_0x351624['query']);_0x38a017[_0xb248('0x32')]=_[_0xb248('0x34')](_0x38a017[_0xb248('0x36')],_0x38a017['query']);_0x2baa8a[_0xb248('0x33')]=_[_0xb248('0x34')](_0x38a017['model'],qs[_0xb248('0x35')](_0x351624[_0xb248('0x30')][_0xb248('0x35')]));_0x2baa8a['attributes']=_0x2baa8a['attributes'][_0xb248('0x45')]?_0x2baa8a[_0xb248('0x33')]:_0x38a017[_0xb248('0x36')];if(_0x351624[_0xb248('0x30')][_0xb248('0x40')]){_0x2baa8a[_0xb248('0x41')]=[{'all':!![]}];}_0x2baa8a=_['merge']({},_0x2baa8a,_0x351624[_0xb248('0x46')]);return db['MailSubstatus'][_0xb248('0x47')](_0x2baa8a)[_0xb248('0x24')](handleEntityNotFound(_0x384a0f,null))[_0xb248('0x24')](respondWithResult(_0x384a0f,null))[_0xb248('0x48')](handleError(_0x384a0f,null));};exports[_0xb248('0x49')]=function(_0x33cf16,_0x4babde){return db['MailSubstatus'][_0xb248('0x49')](_0x33cf16[_0xb248('0x4a')],{})[_0xb248('0x24')](respondWithResult(_0x4babde,0xc9))[_0xb248('0x48')](handleError(_0x4babde,null));};exports[_0xb248('0x23')]=function(_0x36959a,_0x473584){if(_0x36959a[_0xb248('0x4a')]['id']){delete _0x36959a[_0xb248('0x4a')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x36959a['params']['id']}})[_0xb248('0x24')](handleEntityNotFound(_0x473584,null))[_0xb248('0x24')](saveUpdates(_0x36959a[_0xb248('0x4a')],null))['then'](respondWithResult(_0x473584,null))[_0xb248('0x48')](handleError(_0x473584,null));};exports['destroy']=function(_0x79d4ca,_0x3d3044){return db[_0xb248('0x2b')][_0xb248('0x47')]({'where':{'id':_0x79d4ca[_0xb248('0x44')]['id']}})[_0xb248('0x24')](handleEntityNotFound(_0x3d3044,null))[_0xb248('0x24')](removeEntity(_0x3d3044,null))[_0xb248('0x48')](handleError(_0x3d3044,null));};exports[_0xb248('0x4b')]=function(_0x274900,_0x3d8b31){return db[_0xb248('0x2b')][_0xb248('0x4b')]()[_0xb248('0x24')](respondWithResult(_0x3d8b31,null))['catch'](handleError(_0x3d8b31,null));}; \ No newline at end of file +var _0xc8ef=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailSubstatus','includeAll','include','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv'];(function(_0xc203d,_0x17eb8b){var _0x416853=function(_0x189324){while(--_0x189324){_0xc203d['push'](_0xc203d['shift']());}};_0x416853(++_0x17eb8b);}(_0xc8ef,0x90));var _0xfc8e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xc8ef[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xfc8e('0x0'));var rimraf=require(_0xfc8e('0x1'));var zipdir=require(_0xfc8e('0x2'));var jsonpatch=require(_0xfc8e('0x3'));var rp=require('request-promise');var moment=require(_0xfc8e('0x4'));var BPromise=require(_0xfc8e('0x5'));var Mustache=require(_0xfc8e('0x6'));var util=require(_0xfc8e('0x7'));var path=require('path');var sox=require(_0xfc8e('0x8'));var csv=require(_0xfc8e('0x9'));var ejs=require(_0xfc8e('0xa'));var fs=require('fs');var fs_extra=require(_0xfc8e('0xb'));var _=require(_0xfc8e('0xc'));var squel=require('squel');var crypto=require(_0xfc8e('0xd'));var jsforce=require(_0xfc8e('0xe'));var deskjs=require(_0xfc8e('0xf'));var toCsv=require(_0xfc8e('0x9'));var querystring=require(_0xfc8e('0x10'));var Papa=require(_0xfc8e('0x11'));var Redis=require(_0xfc8e('0x12'));var authService=require(_0xfc8e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfc8e('0x14'));var hardwareService=require(_0xfc8e('0x15'));var logger=require('../../config/logger')(_0xfc8e('0x16'));var utils=require(_0xfc8e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfc8e('0x18'));var db=require(_0xfc8e('0x19'))['db'];function respondWithStatusCode(_0x187bb8,_0x567fdb){_0x567fdb=_0x567fdb||0xcc;return function(_0x5b637e){if(_0x5b637e){return _0x187bb8[_0xfc8e('0x1a')](_0x567fdb);}return _0x187bb8[_0xfc8e('0x1b')](_0x567fdb)['end']();};}function respondWithResult(_0x55d10f,_0x2d7070){_0x2d7070=_0x2d7070||0xc8;return function(_0x660f53){if(_0x660f53){return _0x55d10f[_0xfc8e('0x1b')](_0x2d7070)['json'](_0x660f53);}};}function respondWithFilteredResult(_0x40b09f,_0x2e9226){return function(_0x466c51){if(_0x466c51){var _0x2739f7=typeof _0x2e9226['offset']===_0xfc8e('0x1c')&&typeof _0x2e9226[_0xfc8e('0x1d')]===_0xfc8e('0x1c');var _0x151701=_0x466c51[_0xfc8e('0x1e')];var _0x4c7e11=_0x2739f7?0x0:_0x2e9226[_0xfc8e('0x1f')];var _0x5c7857=_0x2739f7?_0x466c51[_0xfc8e('0x1e')]:_0x2e9226[_0xfc8e('0x1f')]+_0x2e9226[_0xfc8e('0x1d')];var _0x48e5d5;if(_0x5c7857>=_0x151701){_0x5c7857=_0x151701;_0x48e5d5=0xc8;}else{_0x48e5d5=0xce;}_0x40b09f[_0xfc8e('0x1b')](_0x48e5d5);return _0x40b09f['set'](_0xfc8e('0x20'),_0x4c7e11+'-'+_0x5c7857+'/'+_0x151701)[_0xfc8e('0x21')](_0x466c51);}return null;};}function patchUpdates(_0x82f35f){return function(_0x4e8f1e){try{jsonpatch[_0xfc8e('0x22')](_0x4e8f1e,_0x82f35f,!![]);}catch(_0x7b307){return BPromise[_0xfc8e('0x23')](_0x7b307);}return _0x4e8f1e[_0xfc8e('0x24')]();};}function saveUpdates(_0x5c3be0,_0x404fec){return function(_0x26c8cf){if(_0x26c8cf){return _0x26c8cf[_0xfc8e('0x25')](_0x5c3be0)[_0xfc8e('0x26')](function(_0x3ebab3){return _0x3ebab3;});}return null;};}function removeEntity(_0x17ec2f,_0x327f2d){return function(_0x300ec3){if(_0x300ec3){return _0x300ec3[_0xfc8e('0x27')]()['then'](function(){_0x17ec2f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b7a8,_0x525729){return function(_0x27ffa7){if(!_0x27ffa7){_0x12b7a8['sendStatus'](0x194);}return _0x27ffa7;};}function handleError(_0x2656fa,_0x17dc28){_0x17dc28=_0x17dc28||0x1f4;return function(_0x5b7d49){logger['error'](_0x5b7d49[_0xfc8e('0x28')]);if(_0x5b7d49['name']){delete _0x5b7d49[_0xfc8e('0x29')];}_0x2656fa[_0xfc8e('0x1b')](_0x17dc28)[_0xfc8e('0x2a')](_0x5b7d49);};}exports[_0xfc8e('0x2b')]=function(_0x323d70,_0x4cc084){var _0x111345={},_0x3b2d88={},_0x2d5c27={'count':0x0,'rows':[]};var _0x154cbe=_[_0xfc8e('0x2c')](db['MailSubstatus'][_0xfc8e('0x2d')],function(_0x5eccf1){return{'name':_0x5eccf1[_0xfc8e('0x2e')],'type':_0x5eccf1['type'][_0xfc8e('0x2f')]};});_0x3b2d88[_0xfc8e('0x30')]=_['map'](_0x154cbe,'name');_0x3b2d88[_0xfc8e('0x31')]=_[_0xfc8e('0x32')](_0x323d70[_0xfc8e('0x31')]);_0x3b2d88[_0xfc8e('0x33')]=_['intersection'](_0x3b2d88[_0xfc8e('0x30')],_0x3b2d88[_0xfc8e('0x31')]);_0x111345[_0xfc8e('0x34')]=_[_0xfc8e('0x35')](_0x3b2d88[_0xfc8e('0x30')],qs[_0xfc8e('0x36')](_0x323d70[_0xfc8e('0x31')][_0xfc8e('0x36')]));_0x111345[_0xfc8e('0x34')]=_0x111345[_0xfc8e('0x34')][_0xfc8e('0x37')]?_0x111345[_0xfc8e('0x34')]:_0x3b2d88[_0xfc8e('0x30')];if(!_0x323d70['query'][_0xfc8e('0x38')](_0xfc8e('0x39'))){_0x111345[_0xfc8e('0x1d')]=qs['limit'](_0x323d70[_0xfc8e('0x31')][_0xfc8e('0x1d')]);_0x111345['offset']=qs['offset'](_0x323d70[_0xfc8e('0x31')][_0xfc8e('0x1f')]);}_0x111345[_0xfc8e('0x3a')]=qs[_0xfc8e('0x3b')](_0x323d70[_0xfc8e('0x31')]['sort']);_0x111345[_0xfc8e('0x3c')]=qs[_0xfc8e('0x33')](_[_0xfc8e('0x3d')](_0x323d70[_0xfc8e('0x31')],_0x3b2d88[_0xfc8e('0x33')]),_0x154cbe);if(_0x323d70[_0xfc8e('0x31')][_0xfc8e('0x3e')]){_0x111345[_0xfc8e('0x3c')]=_[_0xfc8e('0x3f')](_0x111345[_0xfc8e('0x3c')],{'$or':_[_0xfc8e('0x2c')](_0x154cbe,function(_0x43e76e){if(_0x43e76e[_0xfc8e('0x40')]!==_0xfc8e('0x41')){var _0x14eb2a={};_0x14eb2a[_0x43e76e[_0xfc8e('0x29')]]={'$like':'%'+_0x323d70['query']['filter']+'%'};return _0x14eb2a;}})});}_0x111345=_[_0xfc8e('0x3f')]({},_0x111345,_0x323d70[_0xfc8e('0x42')]);var _0x241b80={'where':_0x111345[_0xfc8e('0x3c')]};return db[_0xfc8e('0x43')][_0xfc8e('0x1e')](_0x241b80)[_0xfc8e('0x26')](function(_0x1ad050){_0x2d5c27[_0xfc8e('0x1e')]=_0x1ad050;if(_0x323d70['query'][_0xfc8e('0x44')]){_0x111345[_0xfc8e('0x45')]=[{'all':!![]}];}return db[_0xfc8e('0x43')]['findAll'](_0x111345);})[_0xfc8e('0x26')](function(_0x5bf339){_0x2d5c27[_0xfc8e('0x46')]=_0x5bf339;return _0x2d5c27;})[_0xfc8e('0x26')](respondWithFilteredResult(_0x4cc084,_0x111345))['catch'](handleError(_0x4cc084,null));};exports['show']=function(_0x443b14,_0x27a8a3){var _0x585948={'raw':!![],'where':{'id':_0x443b14[_0xfc8e('0x47')]['id']}},_0xc247a7={};_0xc247a7[_0xfc8e('0x30')]=_[_0xfc8e('0x32')](db['MailSubstatus'][_0xfc8e('0x2d')]);_0xc247a7[_0xfc8e('0x31')]=_[_0xfc8e('0x32')](_0x443b14['query']);_0xc247a7[_0xfc8e('0x33')]=_[_0xfc8e('0x35')](_0xc247a7[_0xfc8e('0x30')],_0xc247a7['query']);_0x585948[_0xfc8e('0x34')]=_['intersection'](_0xc247a7['model'],qs[_0xfc8e('0x36')](_0x443b14[_0xfc8e('0x31')][_0xfc8e('0x36')]));_0x585948[_0xfc8e('0x34')]=_0x585948[_0xfc8e('0x34')][_0xfc8e('0x37')]?_0x585948[_0xfc8e('0x34')]:_0xc247a7[_0xfc8e('0x30')];if(_0x443b14[_0xfc8e('0x31')][_0xfc8e('0x44')]){_0x585948[_0xfc8e('0x45')]=[{'all':!![]}];}_0x585948=_[_0xfc8e('0x3f')]({},_0x585948,_0x443b14[_0xfc8e('0x42')]);return db[_0xfc8e('0x43')][_0xfc8e('0x48')](_0x585948)[_0xfc8e('0x26')](handleEntityNotFound(_0x27a8a3,null))[_0xfc8e('0x26')](respondWithResult(_0x27a8a3,null))[_0xfc8e('0x49')](handleError(_0x27a8a3,null));};exports[_0xfc8e('0x4a')]=function(_0x416f7b,_0x16904d){return db[_0xfc8e('0x43')]['create'](_0x416f7b[_0xfc8e('0x4b')],{})[_0xfc8e('0x26')](respondWithResult(_0x16904d,0xc9))['catch'](handleError(_0x16904d,null));};exports[_0xfc8e('0x25')]=function(_0xde18dc,_0x387c4c){if(_0xde18dc[_0xfc8e('0x4b')]['id']){delete _0xde18dc[_0xfc8e('0x4b')]['id'];}return db['MailSubstatus'][_0xfc8e('0x48')]({'where':{'id':_0xde18dc[_0xfc8e('0x47')]['id']}})[_0xfc8e('0x26')](handleEntityNotFound(_0x387c4c,null))[_0xfc8e('0x26')](saveUpdates(_0xde18dc[_0xfc8e('0x4b')],null))['then'](respondWithResult(_0x387c4c,null))['catch'](handleError(_0x387c4c,null));};exports[_0xfc8e('0x27')]=function(_0x380b50,_0x24b116){return db[_0xfc8e('0x43')][_0xfc8e('0x48')]({'where':{'id':_0x380b50[_0xfc8e('0x47')]['id']}})[_0xfc8e('0x26')](handleEntityNotFound(_0x24b116,null))['then'](removeEntity(_0x24b116,null))[_0xfc8e('0x49')](handleError(_0x24b116,null));};exports[_0xfc8e('0x4c')]=function(_0x5aa513,_0x4b3edd){return db[_0xfc8e('0x43')]['describe']()[_0xfc8e('0x26')](respondWithResult(_0x4b3edd,null))['catch'](handleError(_0x4b3edd,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index fb753cd..eb86c98 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 _0x9e9b=['update','emit','events','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x2002a2,_0x3485d2){var _0x3115f9=function(_0x28dd6c){while(--_0x28dd6c){_0x2002a2['push'](_0x2002a2['shift']());}};_0x3115f9(++_0x3485d2);}(_0x9e9b,0xaa));var _0xb9e9=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0x9e9b[_0xe51596];return _0x22c705;};'use strict';var EventEmitter=require(_0xb9e9('0x0'));var MailSubstatus=require(_0xb9e9('0x1'))['db'][_0xb9e9('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xb9e9('0x3')](0x0);var events={'afterUpdate':_0xb9e9('0x4')};function emitEvent(_0x362560){return function(_0x3e2c89,_0x4209a9,_0x3c77fd){MailSubstatusEvents[_0xb9e9('0x5')](_0x362560+':'+_0x3e2c89['id'],_0x3e2c89);MailSubstatusEvents[_0xb9e9('0x5')](_0x362560,_0x3e2c89);_0x3c77fd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x84f4=['update','hasOwnProperty','exports','events','MailSubstatus','setMaxListeners'];(function(_0x1c3e04,_0x7a8925){var _0x4553b1=function(_0xaa60fa){while(--_0xaa60fa){_0x1c3e04['push'](_0x1c3e04['shift']());}};_0x4553b1(++_0x7a8925);}(_0x84f4,0xbd));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x484f('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x484f('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x484f('0x2')](0x0);var events={'afterUpdate':_0x484f('0x3')};function emitEvent(_0xd96a3b){return function(_0x2f3274,_0x500fc4,_0x539698){MailSubstatusEvents['emit'](_0xd96a3b+':'+_0x2f3274['id'],_0x2f3274);MailSubstatusEvents['emit'](_0xd96a3b,_0x2f3274);_0x539698(null);};}for(var e in events){if(events[_0x484f('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x484f('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 1eb86f6..198833b 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 _0xbf5f=['exports','models','mail_substatuses','update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes'];(function(_0x186667,_0x3afde7){var _0x1d13a8=function(_0x1f74b0){while(--_0x1f74b0){_0x186667['push'](_0x186667['shift']());}};_0x1d13a8(++_0x3afde7);}(_0xbf5f,0x19d));var _0xfbf5=function(_0x15b3df,_0x2c3d87){_0x15b3df=_0x15b3df-0x0;var _0x399e0c=_0xbf5f[_0x15b3df];return _0x399e0c;};'use strict';var attributes=require(_0xfbf5('0x0'));module[_0xfbf5('0x1')]=function(_0x4e2e1d){var _0x2013ad=_0x4e2e1d[_0xfbf5('0x2')];return _0x4e2e1d['define']('MailSubstatus',attributes,{'tableName':_0xfbf5('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x449291,_0xcc053f,_0x516054){return _0x2013ad['Condition'][_0xfbf5('0x4')]({'value':_0x449291[_0xfbf5('0x5')]},{'where':{'field':_0xfbf5('0x6'),'value':_0x449291[_0xfbf5('0x7')][_0xfbf5('0x5')]}})[_0xfbf5('0x8')](function(){_0x516054();})['catch'](function(_0x545e20){_0x516054(_0x545e20);});}}});}; \ No newline at end of file +var _0x7c0e=['define','MailSubstatus','Condition','update','name','mailSubstatus','_previousDataValues','catch','./mailSubstatus.attributes','exports','models'];(function(_0x48e163,_0x4229df){var _0x584743=function(_0xcc3d64){while(--_0xcc3d64){_0x48e163['push'](_0x48e163['shift']());}};_0x584743(++_0x4229df);}(_0x7c0e,0xe4));var _0xe7c0=function(_0x5a7c9e,_0x1db0b6){_0x5a7c9e=_0x5a7c9e-0x0;var _0x2a24a9=_0x7c0e[_0x5a7c9e];return _0x2a24a9;};'use strict';var attributes=require(_0xe7c0('0x0'));module[_0xe7c0('0x1')]=function(_0x558ebd){var _0x5190d7=_0x558ebd[_0xe7c0('0x2')];return _0x558ebd[_0xe7c0('0x3')](_0xe7c0('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4a5fad,_0x28121c,_0x2094d8){return _0x5190d7[_0xe7c0('0x5')][_0xe7c0('0x6')]({'value':_0x4a5fad[_0xe7c0('0x7')]},{'where':{'field':_0xe7c0('0x8'),'value':_0x4a5fad[_0xe7c0('0x9')][_0xe7c0('0x7')]}})['then'](function(){_0x2094d8();})[_0xe7c0('0xa')](function(_0x69d9e3){_0x2094d8(_0x69d9e3);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 5fd3aec..2d8392c 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 _0xcda3=['error','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2442f1,_0x434776){var _0x30b208=function(_0x119103){while(--_0x119103){_0x2442f1['push'](_0x2442f1['shift']());}};_0x30b208(++_0x434776);}(_0xcda3,0xb2));var _0x3cda=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xcda3[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x3cda('0x0'));var util=require('util');var moment=require(_0x3cda('0x1'));var BPromise=require('bluebird');var rs=require(_0x3cda('0x2'));var fs=require('fs');var Redis=require(_0x3cda('0x3'));var db=require(_0x3cda('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3cda('0x5'))(_0x3cda('0x6'));var config=require('../../config/environment');var jayson=require(_0x3cda('0x7'));var client=jayson['client'][_0x3cda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3daddd,_0x37ced0,_0x30692b){return new BPromise(function(_0x1778be,_0x3a98b4){return client[_0x3cda('0x9')](_0x3daddd,_0x30692b)['then'](function(_0x33b654){logger['info'](_0x3cda('0xa'),_0x37ced0,'request\x20sent');logger[_0x3cda('0xb')](_0x3cda('0xc'),_0x37ced0,_0x3cda('0xd'),JSON['stringify'](_0x33b654));if(_0x33b654[_0x3cda('0xe')]){if(_0x33b654[_0x3cda('0xe')]['code']===0x1f4){logger['error'](_0x3cda('0xa'),_0x37ced0,_0x33b654[_0x3cda('0xe')][_0x3cda('0xf')]);return _0x3a98b4(_0x33b654[_0x3cda('0xe')][_0x3cda('0xf')]);}logger[_0x3cda('0xe')](_0x3cda('0xa'),_0x37ced0,_0x33b654[_0x3cda('0xe')][_0x3cda('0xf')]);return _0x1778be(_0x33b654['error'][_0x3cda('0xf')]);}else{logger['info'](_0x3cda('0xa'),_0x37ced0,'request\x20sent');_0x1778be(_0x33b654['result'][_0x3cda('0xf')]);}})['catch'](function(_0x50adfb){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x37ced0,_0x50adfb);_0x3a98b4(_0x50adfb);});});} \ No newline at end of file +var _0x2f7a=['../../config/environment','jayson/promise','client','http','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xca04ff,_0xcb449f){var _0x6b547=function(_0xc91e4b){while(--_0xc91e4b){_0xca04ff['push'](_0xca04ff['shift']());}};_0x6b547(++_0xcb449f);}(_0x2f7a,0x151));var _0xa2f7=function(_0x109894,_0x2a8fe5){_0x109894=_0x109894-0x0;var _0x2a8daa=_0x2f7a[_0x109894];return _0x2a8daa;};'use strict';var _=require(_0xa2f7('0x0'));var util=require(_0xa2f7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa2f7('0x2'));var fs=require('fs');var Redis=require(_0xa2f7('0x3'));var db=require(_0xa2f7('0x4'))['db'];var utils=require(_0xa2f7('0x5'));var logger=require(_0xa2f7('0x6'))(_0xa2f7('0x7'));var config=require(_0xa2f7('0x8'));var jayson=require(_0xa2f7('0x9'));var client=jayson[_0xa2f7('0xa')][_0xa2f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb1aa,_0x5211e,_0x22d396){return new BPromise(function(_0x43a488,_0x52ed44){return client['request'](_0x1bb1aa,_0x22d396)[_0xa2f7('0xc')](function(_0x4dc8e6){logger['info'](_0xa2f7('0xd'),_0x5211e,_0xa2f7('0xe'));logger['debug'](_0xa2f7('0xf'),_0x5211e,_0xa2f7('0xe'),JSON[_0xa2f7('0x10')](_0x4dc8e6));if(_0x4dc8e6[_0xa2f7('0x11')]){if(_0x4dc8e6['error'][_0xa2f7('0x12')]===0x1f4){logger[_0xa2f7('0x11')](_0xa2f7('0xd'),_0x5211e,_0x4dc8e6[_0xa2f7('0x11')][_0xa2f7('0x13')]);return _0x52ed44(_0x4dc8e6[_0xa2f7('0x11')][_0xa2f7('0x13')]);}logger[_0xa2f7('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5211e,_0x4dc8e6['error'][_0xa2f7('0x13')]);return _0x43a488(_0x4dc8e6[_0xa2f7('0x11')][_0xa2f7('0x13')]);}else{logger[_0xa2f7('0x14')](_0xa2f7('0xd'),_0x5211e,_0xa2f7('0xe'));_0x43a488(_0x4dc8e6[_0xa2f7('0x15')]['message']);}})[_0xa2f7('0x16')](function(_0x47a597){logger[_0xa2f7('0x11')](_0xa2f7('0xd'),_0x5211e,_0x47a597);_0x52ed44(_0x47a597);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 71a9ee1..6f0d7f8 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 _0xbcfa=['exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put','destroy'];(function(_0x42cbcc,_0xc75c32){var _0x39af24=function(_0x579b33){while(--_0x579b33){_0x42cbcc['push'](_0x42cbcc['shift']());}};_0x39af24(++_0xc75c32);}(_0xbcfa,0x131));var _0xabcf=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xbcfa[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0xabcf('0x0'));var util=require('util');var path=require(_0xabcf('0x1'));var timeout=require('connect-timeout');var express=require(_0xabcf('0x2'));var router=express['Router']();var fs_extra=require(_0xabcf('0x3'));var auth=require(_0xabcf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xabcf('0x5'));var controller=require('./mailTransferReport.controller');router[_0xabcf('0x6')]('/',auth[_0xabcf('0x7')](),controller['index']);router[_0xabcf('0x6')](_0xabcf('0x8'),auth[_0xabcf('0x7')](),controller['describe']);router['get'](_0xabcf('0x9'),auth[_0xabcf('0x7')](),controller[_0xabcf('0xa')]);router[_0xabcf('0xb')]('/',auth[_0xabcf('0x7')](),controller[_0xabcf('0xc')]);router[_0xabcf('0xd')](_0xabcf('0x9'),auth[_0xabcf('0x7')](),controller['update']);router['delete'](_0xabcf('0x9'),auth['isAuthenticated'](),controller[_0xabcf('0xe')]);module[_0xabcf('0xf')]=router; \ No newline at end of file +var _0xe099=['show','create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x9a545,_0x328da0){var _0x18cda7=function(_0x441156){while(--_0x441156){_0x9a545['push'](_0x9a545['shift']());}};_0x18cda7(++_0x328da0);}(_0xe099,0x15a));var _0x9e09=function(_0x5225dd,_0x3e8940){_0x5225dd=_0x5225dd-0x0;var _0x57592d=_0xe099[_0x5225dd];return _0x57592d;};'use strict';var multer=require(_0x9e09('0x0'));var util=require(_0x9e09('0x1'));var path=require('path');var timeout=require(_0x9e09('0x2'));var express=require(_0x9e09('0x3'));var router=express[_0x9e09('0x4')]();var fs_extra=require(_0x9e09('0x5'));var auth=require(_0x9e09('0x6'));var interaction=require(_0x9e09('0x7'));var config=require(_0x9e09('0x8'));var controller=require(_0x9e09('0x9'));router[_0x9e09('0xa')]('/',auth[_0x9e09('0xb')](),controller['index']);router[_0x9e09('0xa')](_0x9e09('0xc'),auth[_0x9e09('0xb')](),controller[_0x9e09('0xd')]);router[_0x9e09('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9e09('0xe')]);router['post']('/',auth[_0x9e09('0xb')](),controller[_0x9e09('0xf')]);router[_0x9e09('0x10')](_0x9e09('0x11'),auth[_0x9e09('0xb')](),controller['update']);router['delete'](_0x9e09('0x11'),auth[_0x9e09('0xb')](),controller[_0x9e09('0x12')]);module[_0x9e09('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index faea97c..7c32727 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3b5f66,_0x1dbfc5){var _0x4aa1a8=function(_0x57c05c){while(--_0x57c05c){_0x3b5f66['push'](_0x3b5f66['shift']());}};_0x4aa1a8(++_0x1dbfc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1c4afd,_0x46d660){var _0x3f3117=function(_0x146ae1){while(--_0x146ae1){_0x1c4afd['push'](_0x1c4afd['shift']());}};_0x3f3117(++_0x46d660);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5de905,_0x53ef0e){_0x5de905=_0x5de905-0x0;var _0x306770=_0xf4eb[_0x5de905];return _0x306770;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 97b323d..63ef8e6 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 _0x5e70=['../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','end','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','include','params','keys','includeAll','options','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x315c33,_0x2adc3c){var _0x237184=function(_0x1990a7){while(--_0x1990a7){_0x315c33['push'](_0x315c33['shift']());}};_0x237184(++_0x2adc3c);}(_0x5e70,0xf8));var _0x05e7=function(_0x5661b7,_0x83c8d0){_0x5661b7=_0x5661b7-0x0;var _0x202cb3=_0x5e70[_0x5661b7];return _0x202cb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05e7('0x0'));var zipdir=require(_0x05e7('0x1'));var jsonpatch=require(_0x05e7('0x2'));var rp=require(_0x05e7('0x3'));var moment=require(_0x05e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x05e7('0x5'));var util=require(_0x05e7('0x6'));var path=require('path');var sox=require(_0x05e7('0x7'));var csv=require(_0x05e7('0x8'));var ejs=require(_0x05e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05e7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x05e7('0xb'));var deskjs=require(_0x05e7('0xc'));var toCsv=require(_0x05e7('0x8'));var querystring=require(_0x05e7('0xd'));var Papa=require('papaparse');var Redis=require(_0x05e7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x05e7('0xf'));var as=require(_0x05e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05e7('0x11'))('api');var utils=require(_0x05e7('0x12'));var config=require(_0x05e7('0x13'));var licenseUtil=require(_0x05e7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa18f,_0x2d31f5){_0x2d31f5=_0x2d31f5||0xcc;return function(_0x153d62){if(_0x153d62){return _0xa18f[_0x05e7('0x15')](_0x2d31f5);}return _0xa18f['status'](_0x2d31f5)['end']();};}function respondWithResult(_0x282ab5,_0x165a1d){_0x165a1d=_0x165a1d||0xc8;return function(_0x2ac8a2){if(_0x2ac8a2){return _0x282ab5[_0x05e7('0x16')](_0x165a1d)[_0x05e7('0x17')](_0x2ac8a2);}};}function respondWithFilteredResult(_0x14a32b,_0x114a7e){return function(_0x5d3215){if(_0x5d3215){var _0x592643=typeof _0x114a7e[_0x05e7('0x18')]==='undefined'&&typeof _0x114a7e[_0x05e7('0x19')]===_0x05e7('0x1a');var _0x19d98c=_0x5d3215[_0x05e7('0x1b')];var _0x493045=_0x592643?0x0:_0x114a7e[_0x05e7('0x18')];var _0x3b111c=_0x592643?_0x5d3215[_0x05e7('0x1b')]:_0x114a7e[_0x05e7('0x18')]+_0x114a7e['limit'];var _0x332682;if(_0x3b111c>=_0x19d98c){_0x3b111c=_0x19d98c;_0x332682=0xc8;}else{_0x332682=0xce;}_0x14a32b[_0x05e7('0x16')](_0x332682);return _0x14a32b['set'](_0x05e7('0x1c'),_0x493045+'-'+_0x3b111c+'/'+_0x19d98c)[_0x05e7('0x17')](_0x5d3215);}return null;};}function patchUpdates(_0x15a612){return function(_0x290e8b){try{jsonpatch[_0x05e7('0x1d')](_0x290e8b,_0x15a612,!![]);}catch(_0x4fcd0a){return BPromise['reject'](_0x4fcd0a);}return _0x290e8b[_0x05e7('0x1e')]();};}function saveUpdates(_0x143020,_0x3c4b48){return function(_0x3f8e41){if(_0x3f8e41){return _0x3f8e41[_0x05e7('0x1f')](_0x143020)[_0x05e7('0x20')](function(_0x34d66c){return _0x34d66c;});}return null;};}function removeEntity(_0x121140,_0x3e1471){return function(_0x3726c1){if(_0x3726c1){return _0x3726c1['destroy']()[_0x05e7('0x20')](function(){_0x121140[_0x05e7('0x16')](0xcc)[_0x05e7('0x21')]();});}};}function handleEntityNotFound(_0x9cfe71,_0x106de5){return function(_0x4168f3){if(!_0x4168f3){_0x9cfe71[_0x05e7('0x15')](0x194);}return _0x4168f3;};}function handleError(_0x342d9f,_0x489cbb){_0x489cbb=_0x489cbb||0x1f4;return function(_0x305aaa){logger[_0x05e7('0x22')](_0x305aaa['stack']);if(_0x305aaa[_0x05e7('0x23')]){delete _0x305aaa['name'];}_0x342d9f[_0x05e7('0x16')](_0x489cbb)[_0x05e7('0x24')](_0x305aaa);};}exports[_0x05e7('0x25')]=function(_0x558e22,_0x5b01e1){var _0xa57f1={},_0x15ac54={},_0xc716fd={'count':0x0,'rows':[]};var _0x82305f=_[_0x05e7('0x26')](db[_0x05e7('0x27')][_0x05e7('0x28')],function(_0x9dca79){return{'name':_0x9dca79[_0x05e7('0x29')],'type':_0x9dca79[_0x05e7('0x2a')]['key']};});_0x15ac54[_0x05e7('0x2b')]=_[_0x05e7('0x26')](_0x82305f,_0x05e7('0x23'));_0x15ac54['query']=_['keys'](_0x558e22[_0x05e7('0x2c')]);_0x15ac54['filters']=_[_0x05e7('0x2d')](_0x15ac54[_0x05e7('0x2b')],_0x15ac54[_0x05e7('0x2c')]);_0xa57f1[_0x05e7('0x2e')]=_[_0x05e7('0x2d')](_0x15ac54[_0x05e7('0x2b')],qs[_0x05e7('0x2f')](_0x558e22[_0x05e7('0x2c')][_0x05e7('0x2f')]));_0xa57f1[_0x05e7('0x2e')]=_0xa57f1['attributes'][_0x05e7('0x30')]?_0xa57f1[_0x05e7('0x2e')]:_0x15ac54[_0x05e7('0x2b')];if(!_0x558e22['query']['hasOwnProperty'](_0x05e7('0x31'))){_0xa57f1[_0x05e7('0x19')]=qs[_0x05e7('0x19')](_0x558e22['query'][_0x05e7('0x19')]);_0xa57f1[_0x05e7('0x18')]=qs[_0x05e7('0x18')](_0x558e22[_0x05e7('0x2c')]['offset']);}_0xa57f1['order']=qs[_0x05e7('0x32')](_0x558e22['query']['sort']);_0xa57f1['where']=qs[_0x05e7('0x33')](_[_0x05e7('0x34')](_0x558e22[_0x05e7('0x2c')],_0x15ac54[_0x05e7('0x33')]),_0x82305f);if(_0x558e22[_0x05e7('0x2c')][_0x05e7('0x35')]){_0xa57f1['where']=_['merge'](_0xa57f1[_0x05e7('0x36')],{'$or':_['map'](_0x82305f,function(_0x7cc1fe){if(_0x7cc1fe[_0x05e7('0x2a')]!==_0x05e7('0x37')){var _0x50f669={};_0x50f669[_0x7cc1fe[_0x05e7('0x23')]]={'$like':'%'+_0x558e22[_0x05e7('0x2c')][_0x05e7('0x35')]+'%'};return _0x50f669;}})});}_0xa57f1=_[_0x05e7('0x38')]({},_0xa57f1,_0x558e22['options']);var _0x56155b={'where':_0xa57f1[_0x05e7('0x36')]};return db[_0x05e7('0x27')]['count'](_0x56155b)['then'](function(_0x10ff2d){_0xc716fd[_0x05e7('0x1b')]=_0x10ff2d;if(_0x558e22[_0x05e7('0x2c')]['includeAll']){_0xa57f1[_0x05e7('0x39')]=[{'all':!![]}];}return db[_0x05e7('0x27')]['findAll'](_0xa57f1);})['then'](function(_0x4de806){_0xc716fd['rows']=_0x4de806;return _0xc716fd;})[_0x05e7('0x20')](respondWithFilteredResult(_0x5b01e1,_0xa57f1))['catch'](handleError(_0x5b01e1,null));};exports['show']=function(_0x3a6819,_0x229737){var _0x45993e={'raw':!![],'where':{'id':_0x3a6819[_0x05e7('0x3a')]['id']}},_0x10934d={};_0x10934d['model']=_[_0x05e7('0x3b')](db[_0x05e7('0x27')]['rawAttributes']);_0x10934d[_0x05e7('0x2c')]=_[_0x05e7('0x3b')](_0x3a6819[_0x05e7('0x2c')]);_0x10934d[_0x05e7('0x33')]=_['intersection'](_0x10934d[_0x05e7('0x2b')],_0x10934d[_0x05e7('0x2c')]);_0x45993e['attributes']=_[_0x05e7('0x2d')](_0x10934d[_0x05e7('0x2b')],qs[_0x05e7('0x2f')](_0x3a6819['query'][_0x05e7('0x2f')]));_0x45993e[_0x05e7('0x2e')]=_0x45993e[_0x05e7('0x2e')][_0x05e7('0x30')]?_0x45993e[_0x05e7('0x2e')]:_0x10934d[_0x05e7('0x2b')];if(_0x3a6819[_0x05e7('0x2c')][_0x05e7('0x3c')]){_0x45993e['include']=[{'all':!![]}];}_0x45993e=_[_0x05e7('0x38')]({},_0x45993e,_0x3a6819[_0x05e7('0x3d')]);return db[_0x05e7('0x27')]['find'](_0x45993e)['then'](handleEntityNotFound(_0x229737,null))[_0x05e7('0x20')](respondWithResult(_0x229737,null))[_0x05e7('0x3e')](handleError(_0x229737,null));};exports[_0x05e7('0x3f')]=function(_0x2aab4e,_0x17bb60){return db[_0x05e7('0x27')][_0x05e7('0x3f')](_0x2aab4e['body'],{})[_0x05e7('0x20')](respondWithResult(_0x17bb60,0xc9))[_0x05e7('0x3e')](handleError(_0x17bb60,null));};exports[_0x05e7('0x1f')]=function(_0xeb409b,_0x1fa239){if(_0xeb409b[_0x05e7('0x40')]['id']){delete _0xeb409b[_0x05e7('0x40')]['id'];}return db[_0x05e7('0x27')][_0x05e7('0x41')]({'where':{'id':_0xeb409b[_0x05e7('0x3a')]['id']}})[_0x05e7('0x20')](handleEntityNotFound(_0x1fa239,null))[_0x05e7('0x20')](saveUpdates(_0xeb409b[_0x05e7('0x40')],null))[_0x05e7('0x20')](respondWithResult(_0x1fa239,null))[_0x05e7('0x3e')](handleError(_0x1fa239,null));};exports['destroy']=function(_0x2c586a,_0x262df7){return db['MailTransferReport'][_0x05e7('0x41')]({'where':{'id':_0x2c586a[_0x05e7('0x3a')]['id']}})[_0x05e7('0x20')](handleEntityNotFound(_0x262df7,null))[_0x05e7('0x20')](removeEntity(_0x262df7,null))['catch'](handleError(_0x262df7,null));};exports[_0x05e7('0x42')]=function(_0x49ff04,_0x3f3561){return db[_0x05e7('0x27')]['describe']()[_0x05e7('0x20')](respondWithResult(_0x3f3561,null))['catch'](handleError(_0x3f3561,null));}; \ No newline at end of file +var _0xe4f1=['error','stack','send','index','map','MailTransferReport','rawAttributes','type','key','name','query','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','rows','show','params','length','include','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','sendStatus'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe4f1,0x1eb));var _0x1e4f=function(_0x5029e8,_0x281ed4){_0x5029e8=_0x5029e8-0x0;var _0x2c3c53=_0xe4f1[_0x5029e8];return _0x2c3c53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e4f('0x0'));var zipdir=require(_0x1e4f('0x1'));var jsonpatch=require(_0x1e4f('0x2'));var rp=require('request-promise');var moment=require(_0x1e4f('0x3'));var BPromise=require(_0x1e4f('0x4'));var Mustache=require(_0x1e4f('0x5'));var util=require(_0x1e4f('0x6'));var path=require(_0x1e4f('0x7'));var sox=require(_0x1e4f('0x8'));var csv=require(_0x1e4f('0x9'));var ejs=require(_0x1e4f('0xa'));var fs=require('fs');var fs_extra=require(_0x1e4f('0xb'));var _=require(_0x1e4f('0xc'));var squel=require(_0x1e4f('0xd'));var crypto=require(_0x1e4f('0xe'));var jsforce=require(_0x1e4f('0xf'));var deskjs=require(_0x1e4f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1e4f('0x11'));var Papa=require(_0x1e4f('0x12'));var Redis=require(_0x1e4f('0x13'));var authService=require(_0x1e4f('0x14'));var qs=require(_0x1e4f('0x15'));var as=require(_0x1e4f('0x16'));var hardwareService=require(_0x1e4f('0x17'));var logger=require('../../config/logger')(_0x1e4f('0x18'));var utils=require(_0x1e4f('0x19'));var config=require(_0x1e4f('0x1a'));var licenseUtil=require(_0x1e4f('0x1b'));var db=require(_0x1e4f('0x1c'))['db'];function respondWithStatusCode(_0x278b58,_0x28fb22){_0x28fb22=_0x28fb22||0xcc;return function(_0x275756){if(_0x275756){return _0x278b58['sendStatus'](_0x28fb22);}return _0x278b58['status'](_0x28fb22)[_0x1e4f('0x1d')]();};}function respondWithResult(_0x2772ba,_0x4f268e){_0x4f268e=_0x4f268e||0xc8;return function(_0x3ac7f6){if(_0x3ac7f6){return _0x2772ba[_0x1e4f('0x1e')](_0x4f268e)['json'](_0x3ac7f6);}};}function respondWithFilteredResult(_0x471934,_0x4e446c){return function(_0x20549c){if(_0x20549c){var _0x217720=typeof _0x4e446c[_0x1e4f('0x1f')]===_0x1e4f('0x20')&&typeof _0x4e446c['limit']===_0x1e4f('0x20');var _0xd8975=_0x20549c[_0x1e4f('0x21')];var _0x40fbe8=_0x217720?0x0:_0x4e446c[_0x1e4f('0x1f')];var _0x20bd3b=_0x217720?_0x20549c[_0x1e4f('0x21')]:_0x4e446c['offset']+_0x4e446c[_0x1e4f('0x22')];var _0x266965;if(_0x20bd3b>=_0xd8975){_0x20bd3b=_0xd8975;_0x266965=0xc8;}else{_0x266965=0xce;}_0x471934[_0x1e4f('0x1e')](_0x266965);return _0x471934[_0x1e4f('0x23')](_0x1e4f('0x24'),_0x40fbe8+'-'+_0x20bd3b+'/'+_0xd8975)['json'](_0x20549c);}return null;};}function patchUpdates(_0x4f5b19){return function(_0x3da221){try{jsonpatch['apply'](_0x3da221,_0x4f5b19,!![]);}catch(_0x111305){return BPromise[_0x1e4f('0x25')](_0x111305);}return _0x3da221[_0x1e4f('0x26')]();};}function saveUpdates(_0x21779f,_0x50eb04){return function(_0x79cf71){if(_0x79cf71){return _0x79cf71['update'](_0x21779f)['then'](function(_0x2dbf11){return _0x2dbf11;});}return null;};}function removeEntity(_0x1a1eb7,_0x2c5c88){return function(_0x4ac965){if(_0x4ac965){return _0x4ac965[_0x1e4f('0x27')]()['then'](function(){_0x1a1eb7[_0x1e4f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9c90d,_0x22ff31){return function(_0x52b0f9){if(!_0x52b0f9){_0xb9c90d[_0x1e4f('0x28')](0x194);}return _0x52b0f9;};}function handleError(_0x10fd66,_0x3503ee){_0x3503ee=_0x3503ee||0x1f4;return function(_0x27c723){logger[_0x1e4f('0x29')](_0x27c723[_0x1e4f('0x2a')]);if(_0x27c723['name']){delete _0x27c723['name'];}_0x10fd66['status'](_0x3503ee)[_0x1e4f('0x2b')](_0x27c723);};}exports[_0x1e4f('0x2c')]=function(_0x464eaa,_0x12d3ac){var _0x6f0d9d={},_0x31b863={},_0x16c093={'count':0x0,'rows':[]};var _0x4e209b=_[_0x1e4f('0x2d')](db[_0x1e4f('0x2e')][_0x1e4f('0x2f')],function(_0x383ddf){return{'name':_0x383ddf['fieldName'],'type':_0x383ddf[_0x1e4f('0x30')][_0x1e4f('0x31')]};});_0x31b863['model']=_[_0x1e4f('0x2d')](_0x4e209b,_0x1e4f('0x32'));_0x31b863[_0x1e4f('0x33')]=_['keys'](_0x464eaa[_0x1e4f('0x33')]);_0x31b863['filters']=_['intersection'](_0x31b863[_0x1e4f('0x34')],_0x31b863[_0x1e4f('0x33')]);_0x6f0d9d['attributes']=_['intersection'](_0x31b863[_0x1e4f('0x34')],qs[_0x1e4f('0x35')](_0x464eaa['query'][_0x1e4f('0x35')]));_0x6f0d9d['attributes']=_0x6f0d9d['attributes']['length']?_0x6f0d9d[_0x1e4f('0x36')]:_0x31b863[_0x1e4f('0x34')];if(!_0x464eaa[_0x1e4f('0x33')][_0x1e4f('0x37')](_0x1e4f('0x38'))){_0x6f0d9d['limit']=qs['limit'](_0x464eaa[_0x1e4f('0x33')][_0x1e4f('0x22')]);_0x6f0d9d[_0x1e4f('0x1f')]=qs[_0x1e4f('0x1f')](_0x464eaa[_0x1e4f('0x33')]['offset']);}_0x6f0d9d[_0x1e4f('0x39')]=qs[_0x1e4f('0x3a')](_0x464eaa[_0x1e4f('0x33')][_0x1e4f('0x3a')]);_0x6f0d9d[_0x1e4f('0x3b')]=qs[_0x1e4f('0x3c')](_['pick'](_0x464eaa['query'],_0x31b863['filters']),_0x4e209b);if(_0x464eaa['query'][_0x1e4f('0x3d')]){_0x6f0d9d[_0x1e4f('0x3b')]=_[_0x1e4f('0x3e')](_0x6f0d9d[_0x1e4f('0x3b')],{'$or':_[_0x1e4f('0x2d')](_0x4e209b,function(_0x8d7a00){if(_0x8d7a00[_0x1e4f('0x30')]!==_0x1e4f('0x3f')){var _0x364a3d={};_0x364a3d[_0x8d7a00['name']]={'$like':'%'+_0x464eaa[_0x1e4f('0x33')][_0x1e4f('0x3d')]+'%'};return _0x364a3d;}})});}_0x6f0d9d=_[_0x1e4f('0x3e')]({},_0x6f0d9d,_0x464eaa[_0x1e4f('0x40')]);var _0x371d34={'where':_0x6f0d9d[_0x1e4f('0x3b')]};return db[_0x1e4f('0x2e')][_0x1e4f('0x21')](_0x371d34)[_0x1e4f('0x41')](function(_0x41a78d){_0x16c093[_0x1e4f('0x21')]=_0x41a78d;if(_0x464eaa[_0x1e4f('0x33')][_0x1e4f('0x42')]){_0x6f0d9d['include']=[{'all':!![]}];}return db[_0x1e4f('0x2e')]['findAll'](_0x6f0d9d);})[_0x1e4f('0x41')](function(_0x4dcbf2){_0x16c093[_0x1e4f('0x43')]=_0x4dcbf2;return _0x16c093;})[_0x1e4f('0x41')](respondWithFilteredResult(_0x12d3ac,_0x6f0d9d))['catch'](handleError(_0x12d3ac,null));};exports[_0x1e4f('0x44')]=function(_0x2aeb02,_0x59f0bd){var _0x4f16b6={'raw':!![],'where':{'id':_0x2aeb02[_0x1e4f('0x45')]['id']}},_0x267bba={};_0x267bba['model']=_['keys'](db[_0x1e4f('0x2e')]['rawAttributes']);_0x267bba[_0x1e4f('0x33')]=_['keys'](_0x2aeb02[_0x1e4f('0x33')]);_0x267bba['filters']=_['intersection'](_0x267bba['model'],_0x267bba[_0x1e4f('0x33')]);_0x4f16b6['attributes']=_['intersection'](_0x267bba['model'],qs[_0x1e4f('0x35')](_0x2aeb02[_0x1e4f('0x33')][_0x1e4f('0x35')]));_0x4f16b6['attributes']=_0x4f16b6[_0x1e4f('0x36')][_0x1e4f('0x46')]?_0x4f16b6[_0x1e4f('0x36')]:_0x267bba[_0x1e4f('0x34')];if(_0x2aeb02[_0x1e4f('0x33')]['includeAll']){_0x4f16b6[_0x1e4f('0x47')]=[{'all':!![]}];}_0x4f16b6=_[_0x1e4f('0x3e')]({},_0x4f16b6,_0x2aeb02[_0x1e4f('0x40')]);return db['MailTransferReport'][_0x1e4f('0x48')](_0x4f16b6)[_0x1e4f('0x41')](handleEntityNotFound(_0x59f0bd,null))[_0x1e4f('0x41')](respondWithResult(_0x59f0bd,null))[_0x1e4f('0x49')](handleError(_0x59f0bd,null));};exports[_0x1e4f('0x4a')]=function(_0x3b17dc,_0x483ff8){return db[_0x1e4f('0x2e')]['create'](_0x3b17dc[_0x1e4f('0x4b')],{})[_0x1e4f('0x41')](respondWithResult(_0x483ff8,0xc9))['catch'](handleError(_0x483ff8,null));};exports['update']=function(_0x36a44f,_0x141ef0){if(_0x36a44f[_0x1e4f('0x4b')]['id']){delete _0x36a44f[_0x1e4f('0x4b')]['id'];}return db[_0x1e4f('0x2e')]['find']({'where':{'id':_0x36a44f[_0x1e4f('0x45')]['id']}})[_0x1e4f('0x41')](handleEntityNotFound(_0x141ef0,null))[_0x1e4f('0x41')](saveUpdates(_0x36a44f[_0x1e4f('0x4b')],null))[_0x1e4f('0x41')](respondWithResult(_0x141ef0,null))[_0x1e4f('0x49')](handleError(_0x141ef0,null));};exports['destroy']=function(_0x15230f,_0x2c9213){return db[_0x1e4f('0x2e')][_0x1e4f('0x48')]({'where':{'id':_0x15230f['params']['id']}})[_0x1e4f('0x41')](handleEntityNotFound(_0x2c9213,null))[_0x1e4f('0x41')](removeEntity(_0x2c9213,null))[_0x1e4f('0x49')](handleError(_0x2c9213,null));};exports['describe']=function(_0x5c895d,_0x45f798){return db[_0x1e4f('0x2e')]['describe']()['then'](respondWithResult(_0x45f798,null))['catch'](handleError(_0x45f798,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8a0a2cf..5b40799 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 _0x9ca8=['define','MailTransferReport','report_mail_transfer','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ca8,0x123));var _0x89ca=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0x9ca8[_0x34b87f];return _0x449805;};'use strict';var _=require('lodash');var util=require(_0x89ca('0x0'));var logger=require('../../config/logger')(_0x89ca('0x1'));var moment=require(_0x89ca('0x2'));var BPromise=require(_0x89ca('0x3'));var rp=require(_0x89ca('0x4'));var fs=require('fs');var path=require(_0x89ca('0x5'));var rimraf=require('rimraf');var config=require(_0x89ca('0x6'));var attributes=require(_0x89ca('0x7'));module[_0x89ca('0x8')]=function(_0x1464be,_0x348f76){return _0x1464be[_0x89ca('0x9')](_0x89ca('0xa'),attributes,{'tableName':_0x89ca('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a39=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x338f11,_0x27e633){var _0x56be6d=function(_0x5919a8){while(--_0x5919a8){_0x338f11['push'](_0x338f11['shift']());}};_0x56be6d(++_0x27e633);}(_0x6a39,0x140));var _0x96a3=function(_0x1ac53b,_0x31c1f1){_0x1ac53b=_0x1ac53b-0x0;var _0x6dcc75=_0x6a39[_0x1ac53b];return _0x6dcc75;};'use strict';var _=require(_0x96a3('0x0'));var util=require(_0x96a3('0x1'));var logger=require(_0x96a3('0x2'))(_0x96a3('0x3'));var moment=require(_0x96a3('0x4'));var BPromise=require(_0x96a3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96a3('0x6'));var rimraf=require(_0x96a3('0x7'));var config=require(_0x96a3('0x8'));var attributes=require(_0x96a3('0x9'));module[_0x96a3('0xa')]=function(_0x21f936,_0x2174a1){return _0x21f936[_0x96a3('0xb')](_0x96a3('0xc'),attributes,{'tableName':_0x96a3('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x96a3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index fba1b64..8dc4242 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 _0xc92b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result'];(function(_0x357951,_0x401c2f){var _0x4a648a=function(_0x32bde8){while(--_0x32bde8){_0x357951['push'](_0x357951['shift']());}};_0x4a648a(++_0x401c2f);}(_0xc92b,0x161));var _0xbc92=function(_0x2332b6,_0x2afec7){_0x2332b6=_0x2332b6-0x0;var _0x5bf3af=_0xc92b[_0x2332b6];return _0x5bf3af;};'use strict';var _=require(_0xbc92('0x0'));var util=require(_0xbc92('0x1'));var moment=require(_0xbc92('0x2'));var BPromise=require(_0xbc92('0x3'));var rs=require(_0xbc92('0x4'));var fs=require('fs');var Redis=require(_0xbc92('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc92('0x6'))(_0xbc92('0x7'));var config=require(_0xbc92('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbc92('0x9')][_0xbc92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1158a0,_0xdb23d2,_0x4d071f){return new BPromise(function(_0x27835f,_0x198cb1){return client['request'](_0x1158a0,_0x4d071f)['then'](function(_0x1d4fef){logger[_0xbc92('0xb')]('MailTransferReport,\x20%s,\x20%s',_0xdb23d2,_0xbc92('0xc'));logger[_0xbc92('0xd')](_0xbc92('0xe'),_0xdb23d2,_0xbc92('0xc'),JSON[_0xbc92('0xf')](_0x1d4fef));if(_0x1d4fef[_0xbc92('0x10')]){if(_0x1d4fef[_0xbc92('0x10')][_0xbc92('0x11')]===0x1f4){logger['error'](_0xbc92('0x12'),_0xdb23d2,_0x1d4fef['error'][_0xbc92('0x13')]);return _0x198cb1(_0x1d4fef[_0xbc92('0x10')][_0xbc92('0x13')]);}logger[_0xbc92('0x10')](_0xbc92('0x12'),_0xdb23d2,_0x1d4fef['error']['message']);return _0x27835f(_0x1d4fef[_0xbc92('0x10')][_0xbc92('0x13')]);}else{logger[_0xbc92('0xb')](_0xbc92('0x12'),_0xdb23d2,_0xbc92('0xc'));_0x27835f(_0x1d4fef[_0xbc92('0x14')][_0xbc92('0x13')]);}})[_0xbc92('0x15')](function(_0x5ed41b){logger[_0xbc92('0x10')](_0xbc92('0x12'),_0xdb23d2,_0x5ed41b);_0x198cb1(_0x5ed41b);});});} \ No newline at end of file +var _0x4613=['info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x329d6c,_0xc9ed0f){var _0x3111f4=function(_0x2e2ce3){while(--_0x2e2ce3){_0x329d6c['push'](_0x329d6c['shift']());}};_0x3111f4(++_0xc9ed0f);}(_0x4613,0x17f));var _0x3461=function(_0x2dd0c7,_0x50a40f){_0x2dd0c7=_0x2dd0c7-0x0;var _0x28139a=_0x4613[_0x2dd0c7];return _0x28139a;};'use strict';var _=require('lodash');var util=require(_0x3461('0x0'));var moment=require(_0x3461('0x1'));var BPromise=require(_0x3461('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3461('0x3'));var db=require(_0x3461('0x4'))['db'];var utils=require(_0x3461('0x5'));var logger=require(_0x3461('0x6'))(_0x3461('0x7'));var config=require(_0x3461('0x8'));var jayson=require(_0x3461('0x9'));var client=jayson['client'][_0x3461('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ab176,_0xd6e3dd,_0x170982){return new BPromise(function(_0x143f6c,_0x49e437){return client[_0x3461('0xb')](_0x3ab176,_0x170982)[_0x3461('0xc')](function(_0x4fd03a){logger[_0x3461('0xd')]('MailTransferReport,\x20%s,\x20%s',_0xd6e3dd,'request\x20sent');logger[_0x3461('0xe')](_0x3461('0xf'),_0xd6e3dd,_0x3461('0x10'),JSON['stringify'](_0x4fd03a));if(_0x4fd03a['error']){if(_0x4fd03a[_0x3461('0x11')]['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0xd6e3dd,_0x4fd03a[_0x3461('0x11')]['message']);return _0x49e437(_0x4fd03a[_0x3461('0x11')]['message']);}logger['error'](_0x3461('0x12'),_0xd6e3dd,_0x4fd03a[_0x3461('0x11')][_0x3461('0x13')]);return _0x143f6c(_0x4fd03a['error'][_0x3461('0x13')]);}else{logger['info'](_0x3461('0x12'),_0xd6e3dd,_0x3461('0x10'));_0x143f6c(_0x4fd03a[_0x3461('0x14')][_0x3461('0x13')]);}})[_0x3461('0x15')](function(_0x288002){logger['error'](_0x3461('0x12'),_0xd6e3dd,_0x288002);_0x49e437(_0x288002);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7a46c06..7e394d0 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 _0x356c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x3efcd5,_0x4a8d63){var _0x1b3333=function(_0x29be93){while(--_0x29be93){_0x3efcd5['push'](_0x3efcd5['shift']());}};_0x1b3333(++_0x4a8d63);}(_0x356c,0x1e0));var _0xc356=function(_0x3f9b98,_0x263db4){_0x3f9b98=_0x3f9b98-0x0;var _0x1df6a2=_0x356c[_0x3f9b98];return _0x1df6a2;};'use strict';var multer=require(_0xc356('0x0'));var util=require('util');var path=require(_0xc356('0x1'));var timeout=require(_0xc356('0x2'));var express=require(_0xc356('0x3'));var router=express[_0xc356('0x4')]();var fs_extra=require(_0xc356('0x5'));var auth=require(_0xc356('0x6'));var interaction=require(_0xc356('0x7'));var config=require(_0xc356('0x8'));var controller=require(_0xc356('0x9'));router[_0xc356('0xa')]('/',auth['isAuthenticated'](),controller[_0xc356('0xb')]);router[_0xc356('0xa')](_0xc356('0xc'),auth['isAuthenticated'](),controller[_0xc356('0xd')]);router[_0xc356('0xa')](_0xc356('0xe'),auth[_0xc356('0xf')](),controller[_0xc356('0x10')]);router[_0xc356('0x11')]('/',auth[_0xc356('0xf')](),controller[_0xc356('0x12')]);router[_0xc356('0x13')](_0xc356('0xe'),auth[_0xc356('0xf')](),controller[_0xc356('0x14')]);router[_0xc356('0x15')](_0xc356('0xe'),auth[_0xc356('0xf')](),controller[_0xc356('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfc85=['../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','show','create','/:id','update','util','path','connect-timeout','express','Router'];(function(_0x30d70c,_0x14e2b4){var _0x4fed9f=function(_0x1639f5){while(--_0x1639f5){_0x30d70c['push'](_0x30d70c['shift']());}};_0x4fed9f(++_0x14e2b4);}(_0xfc85,0x1f3));var _0x5fc8=function(_0xf868f8,_0x3af7d6){_0xf868f8=_0xf868f8-0x0;var _0x399c4c=_0xfc85[_0xf868f8];return _0x399c4c;};'use strict';var multer=require('multer');var util=require(_0x5fc8('0x0'));var path=require(_0x5fc8('0x1'));var timeout=require(_0x5fc8('0x2'));var express=require(_0x5fc8('0x3'));var router=express[_0x5fc8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5fc8('0x5'));var interaction=require(_0x5fc8('0x6'));var config=require(_0x5fc8('0x7'));var controller=require(_0x5fc8('0x8'));router['get']('/',auth[_0x5fc8('0x9')](),controller[_0x5fc8('0xa')]);router[_0x5fc8('0xb')](_0x5fc8('0xc'),auth['isAuthenticated'](),controller[_0x5fc8('0xd')]);router[_0x5fc8('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5fc8('0xe')]);router['post']('/',auth[_0x5fc8('0x9')](),controller[_0x5fc8('0xf')]);router['put'](_0x5fc8('0x10'),auth['isAuthenticated'](),controller[_0x5fc8('0x11')]);router['delete'](_0x5fc8('0x10'),auth[_0x5fc8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 42dfbfc..cb2ccea 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 _0x3c78=['moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','talk:[start]','talk:[queue]','sequelize'];(function(_0x381502,_0x4b48ec){var _0x32ef1f=function(_0x273a1f){while(--_0x273a1f){_0x381502['push'](_0x381502['shift']());}};_0x32ef1f(++_0x4b48ec);}(_0x3c78,0x8b));var _0x83c7=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0x3c78[_0x4bbe00];return _0x3999d2;};'use strict';var Sequelize=require(_0x83c7('0x0'));var moment=require(_0x83c7('0x1'));module[_0x83c7('0x2')]={'channel':{'type':Sequelize[_0x83c7('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x83c7('0x3')]},'type':{'type':Sequelize[_0x83c7('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x83c7('0x4')},'duration':{'type':Sequelize[_0x83c7('0x5')]},'enterAt':{'type':Sequelize[_0x83c7('0x6')]},'exitAt':{'type':Sequelize[_0x83c7('0x6')],'set':function(_0x2debb8){var _0x453858=moment(_0x2debb8);var _0x400ee0=moment(this[_0x83c7('0x7')](_0x83c7('0x8')));var _0x105641=_0x453858[_0x83c7('0x9')](_0x400ee0,'seconds');this[_0x83c7('0xa')](_0x83c7('0xb'),_0x2debb8);this[_0x83c7('0xa')]('duration',_0x105641>=0x0?_0x105641:null);}},'data1':{'type':Sequelize[_0x83c7('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x83c7('0x3')],'comment':_0x83c7('0xc')},'data3':{'type':Sequelize[_0x83c7('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x83c7('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x83c7('0x3')],'comment':_0x83c7('0xd')},'role':{'type':Sequelize[_0x83c7('0x3')]},'internal':{'type':Sequelize[_0x83c7('0x5')]},'uniqueid':{'type':Sequelize[_0x83c7('0x3')]}}; \ No newline at end of file +var _0x957d=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x957d,0xf6));var _0xd957=function(_0x51f427,_0x3ac80a){_0x51f427=_0x51f427-0x0;var _0x332ff5=_0x957d[_0x51f427];return _0x332ff5;};'use strict';var Sequelize=require(_0xd957('0x0'));var moment=require(_0xd957('0x1'));module[_0xd957('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd957('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xd957('0x4'),'comment':_0xd957('0x5')},'duration':{'type':Sequelize[_0xd957('0x6')]},'enterAt':{'type':Sequelize[_0xd957('0x7')]},'exitAt':{'type':Sequelize[_0xd957('0x7')],'set':function(_0x4e5484){var _0x2c56e6=moment(_0x4e5484);var _0x1d17e0=moment(this[_0xd957('0x8')](_0xd957('0x9')));var _0x229c4b=_0x2c56e6[_0xd957('0xa')](_0x1d17e0,_0xd957('0xb'));this[_0xd957('0xc')](_0xd957('0xd'),_0x4e5484);this[_0xd957('0xc')](_0xd957('0xe'),_0x229c4b>=0x0?_0x229c4b:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xd957('0x3')],'comment':_0xd957('0xf')},'data3':{'type':Sequelize[_0xd957('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xd957('0x3')],'comment':_0xd957('0x10')},'data5':{'type':Sequelize[_0xd957('0x3')],'comment':_0xd957('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xd957('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0feaa96..e9e3123 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x34e8,0x12c));var _0x834e=function(_0x5e769a,_0x4c46dd){_0x5e769a=_0x5e769a-0x0;var _0x21e22f=_0x34e8[_0x5e769a];return _0x21e22f;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x55ca,0x126));var _0xa55c=function(_0x21e79a,_0x5a7990){_0x21e79a=_0x21e79a-0x0;var _0x506c02=_0x55ca[_0x21e79a];return _0x506c02;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3552183..f1fcbfa 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 _0x612a=['path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','util','../../config/logger','api','moment','request-promise'];(function(_0x149d43,_0x259067){var _0x334f36=function(_0x1497e3){while(--_0x1497e3){_0x149d43['push'](_0x149d43['shift']());}};_0x334f36(++_0x259067);}(_0x612a,0xa4));var _0xa612=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x612a[_0x4c0622];return _0x1799d8;};'use strict';var _=require('lodash');var util=require(_0xa612('0x0'));var logger=require(_0xa612('0x1'))(_0xa612('0x2'));var moment=require(_0xa612('0x3'));var BPromise=require('bluebird');var rp=require(_0xa612('0x4'));var fs=require('fs');var path=require(_0xa612('0x5'));var rimraf=require(_0xa612('0x6'));var config=require(_0xa612('0x7'));var attributes=require(_0xa612('0x8'));module['exports']=function(_0x220137,_0x127f4a){return _0x220137[_0xa612('0x9')](_0xa612('0xa'),attributes,{'tableName':_0xa612('0xb'),'paranoid':![],'indexes':[{'name':_0xa612('0xc'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x95c9=['path','rimraf','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x33b946,_0x13367f){var _0x36ceb2=function(_0x3025b0){while(--_0x3025b0){_0x33b946['push'](_0x33b946['shift']());}};_0x36ceb2(++_0x13367f);}(_0x95c9,0x12e));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x995c('0x0'));var util=require(_0x995c('0x1'));var logger=require(_0x995c('0x2'))(_0x995c('0x3'));var moment=require('moment');var BPromise=require(_0x995c('0x4'));var rp=require(_0x995c('0x5'));var fs=require('fs');var path=require(_0x995c('0x6'));var rimraf=require(_0x995c('0x7'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module['exports']=function(_0x2deed4,_0x4bcbaa){return _0x2deed4[_0x995c('0x8')](_0x995c('0x9'),attributes,{'tableName':_0x995c('0xa'),'paranoid':![],'indexes':[{'name':_0x995c('0xb'),'fields':[_0x995c('0xc'),_0x995c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b6ee847..cae8e84 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 _0xdd68=['MemberReport','findAll','options','raw','where','attributes','map','include','model','CreateMemberReport','create','body','then','UpdateMemberReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport'];(function(_0x398de1,_0x4771fd){var _0x2a3527=function(_0x41a05){while(--_0x41a05){_0x398de1['push'](_0x398de1['shift']());}};_0x2a3527(++_0x4771fd);}(_0xdd68,0x196));var _0x8dd6=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xdd68[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require(_0x8dd6('0x0'));var util=require('util');var moment=require(_0x8dd6('0x1'));var BPromise=require(_0x8dd6('0x2'));var rs=require(_0x8dd6('0x3'));var fs=require('fs');var Redis=require(_0x8dd6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8dd6('0x5'));var logger=require(_0x8dd6('0x6'))('rpc');var config=require(_0x8dd6('0x7'));var jayson=require(_0x8dd6('0x8'));var client=jayson['client'][_0x8dd6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c021f,_0x476bad,_0x51f78e){return new BPromise(function(_0x199f07,_0x35319b){return client[_0x8dd6('0xa')](_0x4c021f,_0x51f78e)['then'](function(_0x4323ac){logger[_0x8dd6('0xb')](_0x8dd6('0xc'),_0x476bad,_0x8dd6('0xd'));logger[_0x8dd6('0xe')](_0x8dd6('0xf'),_0x476bad,_0x8dd6('0xd'),JSON[_0x8dd6('0x10')](_0x4323ac));if(_0x4323ac[_0x8dd6('0x11')]){if(_0x4323ac[_0x8dd6('0x11')][_0x8dd6('0x12')]===0x1f4){logger[_0x8dd6('0x11')](_0x8dd6('0xc'),_0x476bad,_0x4323ac['error'][_0x8dd6('0x13')]);return _0x35319b(_0x4323ac[_0x8dd6('0x11')][_0x8dd6('0x13')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x476bad,_0x4323ac[_0x8dd6('0x11')]['message']);return _0x199f07(_0x4323ac['error'][_0x8dd6('0x13')]);}else{logger[_0x8dd6('0xb')](_0x8dd6('0xc'),_0x476bad,_0x8dd6('0xd'));_0x199f07(_0x4323ac[_0x8dd6('0x14')][_0x8dd6('0x13')]);}})[_0x8dd6('0x15')](function(_0x3e2fb5){logger[_0x8dd6('0x11')]('MemberReport,\x20%s,\x20%s',_0x476bad,_0x3e2fb5);_0x35319b(_0x3e2fb5);});});}exports[_0x8dd6('0x16')]=function(_0x1f910a){var _0x267d23=this;return new Promise(function(_0x168a30,_0x396b7a){return db[_0x8dd6('0x17')][_0x8dd6('0x18')]({'raw':_0x1f910a[_0x8dd6('0x19')]?_0x1f910a['options'][_0x8dd6('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f910a[_0x8dd6('0x19')]?_0x1f910a['options'][_0x8dd6('0x1b')]||null:null,'attributes':_0x1f910a[_0x8dd6('0x19')]?_0x1f910a[_0x8dd6('0x19')][_0x8dd6('0x1c')]||null:null,'limit':_0x1f910a['options']?_0x1f910a['options']['limit']||null:null,'include':_0x1f910a[_0x8dd6('0x19')]?_0x1f910a[_0x8dd6('0x19')]['include']?_[_0x8dd6('0x1d')](_0x1f910a[_0x8dd6('0x19')][_0x8dd6('0x1e')],function(_0x1485d4){return{'model':db[_0x1485d4[_0x8dd6('0x1f')]],'as':_0x1485d4['as'],'attributes':_0x1485d4['attributes'],'include':_0x1485d4[_0x8dd6('0x1e')]?_[_0x8dd6('0x1d')](_0x1485d4['include'],function(_0x50f513){return{'model':db[_0x50f513[_0x8dd6('0x1f')]],'as':_0x50f513['as'],'attributes':_0x50f513[_0x8dd6('0x1c')],'include':_0x50f513['include']?_[_0x8dd6('0x1d')](_0x50f513[_0x8dd6('0x1e')],function(_0x14cce1){return{'model':db[_0x14cce1[_0x8dd6('0x1f')]],'as':_0x14cce1['as'],'attributes':_0x14cce1[_0x8dd6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46d855){logger[_0x8dd6('0xb')]('GetMemberReport',_0x1f910a);logger['debug'](_0x8dd6('0x16'),_0x1f910a,JSON[_0x8dd6('0x10')](_0x46d855));_0x168a30(_0x46d855);})[_0x8dd6('0x15')](function(_0x44c282){logger[_0x8dd6('0x11')](_0x8dd6('0x16'),_0x44c282[_0x8dd6('0x13')],_0x1f910a);_0x396b7a(_0x267d23[_0x8dd6('0x11')](0x1f4,_0x44c282[_0x8dd6('0x13')]));});});};exports[_0x8dd6('0x20')]=function(_0x15a0f6){var _0x3592d7=this;return new Promise(function(_0x1aff19,_0xbd6b8b){return db[_0x8dd6('0x17')][_0x8dd6('0x21')](_0x15a0f6[_0x8dd6('0x22')],{'raw':_0x15a0f6[_0x8dd6('0x19')]?_0x15a0f6[_0x8dd6('0x19')][_0x8dd6('0x1a')]===undefined?!![]:![]:!![]})[_0x8dd6('0x23')](function(_0x444582){logger['info'](_0x8dd6('0x20'),_0x15a0f6);logger[_0x8dd6('0xe')](_0x8dd6('0x20'),_0x15a0f6,JSON[_0x8dd6('0x10')](_0x444582));_0x1aff19(_0x444582);})['catch'](function(_0x30980c){logger['error']('CreateMemberReport',_0x30980c[_0x8dd6('0x13')],_0x15a0f6);_0xbd6b8b(_0x3592d7[_0x8dd6('0x11')](0x1f4,_0x30980c['message']));});});};exports[_0x8dd6('0x24')]=function(_0x21634a){var _0x18d49a=this;return new Promise(function(_0x1501e6,_0xf35096){return db['MemberReport'][_0x8dd6('0x25')](_0x21634a[_0x8dd6('0x22')],{'raw':_0x21634a[_0x8dd6('0x19')]?_0x21634a[_0x8dd6('0x19')][_0x8dd6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21634a[_0x8dd6('0x19')]?_0x21634a[_0x8dd6('0x19')]['where']||null:null,'attributes':_0x21634a[_0x8dd6('0x19')]?_0x21634a[_0x8dd6('0x19')][_0x8dd6('0x1c')]||null:null,'limit':_0x21634a[_0x8dd6('0x19')]?_0x21634a[_0x8dd6('0x19')][_0x8dd6('0x26')]||null:null})['then'](function(_0x2f9593){logger[_0x8dd6('0xb')](_0x8dd6('0x24'),_0x21634a);logger[_0x8dd6('0xe')](_0x8dd6('0x24'),_0x21634a,JSON[_0x8dd6('0x10')](_0x2f9593));_0x1501e6(_0x2f9593);})[_0x8dd6('0x15')](function(_0x4c8080){logger[_0x8dd6('0x11')](_0x8dd6('0x24'),_0x4c8080[_0x8dd6('0x13')],_0x21634a);_0xf35096(_0x18d49a['error'](0x1f4,_0x4c8080[_0x8dd6('0x13')]));});});}; \ No newline at end of file +var _0xb2ac=['rpc','../../config/environment','jayson/promise','client','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','MemberReport','findAll','options','where','attributes','include','map','model','then','catch','GetMemberReport','CreateMemberReport','raw','UpdateMemberReport','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5cceb8,_0xa8e57a){var _0xeaf4be=function(_0x154250){while(--_0x154250){_0x5cceb8['push'](_0x5cceb8['shift']());}};_0xeaf4be(++_0xa8e57a);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x117af3,_0x211374){_0x117af3=_0x117af3-0x0;var _0x2159e8=_0xb2ac[_0x117af3];return _0x2159e8;};'use strict';var _=require(_0xcb2a('0x0'));var util=require(_0xcb2a('0x1'));var moment=require(_0xcb2a('0x2'));var BPromise=require(_0xcb2a('0x3'));var rs=require(_0xcb2a('0x4'));var fs=require('fs');var Redis=require(_0xcb2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb2a('0x6'));var logger=require(_0xcb2a('0x7'))(_0xcb2a('0x8'));var config=require(_0xcb2a('0x9'));var jayson=require(_0xcb2a('0xa'));var client=jayson[_0xcb2a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8de8,_0x3e87c1,_0x55dddc){return new BPromise(function(_0x5201a8,_0x5c1d8e){return client[_0xcb2a('0xc')](_0x2a8de8,_0x55dddc)['then'](function(_0x13b6b5){logger[_0xcb2a('0xd')](_0xcb2a('0xe'),_0x3e87c1,_0xcb2a('0xf'));logger[_0xcb2a('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x3e87c1,_0xcb2a('0xf'),JSON[_0xcb2a('0x11')](_0x13b6b5));if(_0x13b6b5['error']){if(_0x13b6b5[_0xcb2a('0x12')]['code']===0x1f4){logger['error'](_0xcb2a('0xe'),_0x3e87c1,_0x13b6b5[_0xcb2a('0x12')][_0xcb2a('0x13')]);return _0x5c1d8e(_0x13b6b5[_0xcb2a('0x12')]['message']);}logger[_0xcb2a('0x12')](_0xcb2a('0xe'),_0x3e87c1,_0x13b6b5['error'][_0xcb2a('0x13')]);return _0x5201a8(_0x13b6b5[_0xcb2a('0x12')][_0xcb2a('0x13')]);}else{logger[_0xcb2a('0xd')](_0xcb2a('0xe'),_0x3e87c1,_0xcb2a('0xf'));_0x5201a8(_0x13b6b5[_0xcb2a('0x14')][_0xcb2a('0x13')]);}})['catch'](function(_0x487eec){logger[_0xcb2a('0x12')](_0xcb2a('0xe'),_0x3e87c1,_0x487eec);_0x5c1d8e(_0x487eec);});});}exports['GetMemberReport']=function(_0x4e595b){var _0x60836a=this;return new Promise(function(_0x30014d,_0xb7fbc9){return db[_0xcb2a('0x15')][_0xcb2a('0x16')]({'raw':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')][_0xcb2a('0x18')]||null:null,'attributes':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')][_0xcb2a('0x19')]||null:null,'limit':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')]['limit']||null:null,'include':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')][_0xcb2a('0x1a')]?_[_0xcb2a('0x1b')](_0x4e595b['options'][_0xcb2a('0x1a')],function(_0x644c77){return{'model':db[_0x644c77[_0xcb2a('0x1c')]],'as':_0x644c77['as'],'attributes':_0x644c77[_0xcb2a('0x19')],'include':_0x644c77['include']?_[_0xcb2a('0x1b')](_0x644c77[_0xcb2a('0x1a')],function(_0x20b76a){return{'model':db[_0x20b76a[_0xcb2a('0x1c')]],'as':_0x20b76a['as'],'attributes':_0x20b76a['attributes'],'include':_0x20b76a[_0xcb2a('0x1a')]?_[_0xcb2a('0x1b')](_0x20b76a[_0xcb2a('0x1a')],function(_0x5d70df){return{'model':db[_0x5d70df[_0xcb2a('0x1c')]],'as':_0x5d70df['as'],'attributes':_0x5d70df[_0xcb2a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcb2a('0x1d')](function(_0x231cf9){logger[_0xcb2a('0xd')]('GetMemberReport',_0x4e595b);logger[_0xcb2a('0x10')]('GetMemberReport',_0x4e595b,JSON[_0xcb2a('0x11')](_0x231cf9));_0x30014d(_0x231cf9);})[_0xcb2a('0x1e')](function(_0x294663){logger[_0xcb2a('0x12')](_0xcb2a('0x1f'),_0x294663[_0xcb2a('0x13')],_0x4e595b);_0xb7fbc9(_0x60836a[_0xcb2a('0x12')](0x1f4,_0x294663['message']));});});};exports[_0xcb2a('0x20')]=function(_0xdffa58){var _0x57f7a2=this;return new Promise(function(_0x54ba8d,_0x153fda){return db['MemberReport']['create'](_0xdffa58['body'],{'raw':_0xdffa58[_0xcb2a('0x17')]?_0xdffa58[_0xcb2a('0x17')][_0xcb2a('0x21')]===undefined?!![]:![]:!![]})[_0xcb2a('0x1d')](function(_0x42d50c){logger[_0xcb2a('0xd')](_0xcb2a('0x20'),_0xdffa58);logger[_0xcb2a('0x10')]('CreateMemberReport',_0xdffa58,JSON[_0xcb2a('0x11')](_0x42d50c));_0x54ba8d(_0x42d50c);})[_0xcb2a('0x1e')](function(_0x54b08a){logger[_0xcb2a('0x12')]('CreateMemberReport',_0x54b08a['message'],_0xdffa58);_0x153fda(_0x57f7a2['error'](0x1f4,_0x54b08a[_0xcb2a('0x13')]));});});};exports[_0xcb2a('0x22')]=function(_0x25fabc){var _0x6329c6=this;return new Promise(function(_0x5b744f,_0x382552){return db[_0xcb2a('0x15')]['update'](_0x25fabc[_0xcb2a('0x23')],{'raw':_0x25fabc[_0xcb2a('0x17')]?_0x25fabc[_0xcb2a('0x17')][_0xcb2a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25fabc[_0xcb2a('0x17')]?_0x25fabc[_0xcb2a('0x17')][_0xcb2a('0x18')]||null:null,'attributes':_0x25fabc['options']?_0x25fabc['options'][_0xcb2a('0x19')]||null:null,'limit':_0x25fabc[_0xcb2a('0x17')]?_0x25fabc[_0xcb2a('0x17')][_0xcb2a('0x24')]||null:null})[_0xcb2a('0x1d')](function(_0x437b12){logger['info']('UpdateMemberReport',_0x25fabc);logger[_0xcb2a('0x10')]('UpdateMemberReport',_0x25fabc,JSON[_0xcb2a('0x11')](_0x437b12));_0x5b744f(_0x437b12);})[_0xcb2a('0x1e')](function(_0x55f965){logger[_0xcb2a('0x12')](_0xcb2a('0x22'),_0x55f965['message'],_0x25fabc);_0x382552(_0x6329c6[_0xcb2a('0x12')](0x1f4,_0x55f965[_0xcb2a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 37348ce..9ffa59e 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 _0xe33c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','connect-timeout','express','Router'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0xe33c,0xbc));var _0xce33=function(_0x546136,_0x463a1f){_0x546136=_0x546136-0x0;var _0x20ad4e=_0xe33c[_0x546136];return _0x20ad4e;};'use strict';var multer=require('multer');var util=require(_0xce33('0x0'));var path=require('path');var timeout=require(_0xce33('0x1'));var express=require(_0xce33('0x2'));var router=express[_0xce33('0x3')]();var fs_extra=require(_0xce33('0x4'));var auth=require(_0xce33('0x5'));var interaction=require(_0xce33('0x6'));var config=require(_0xce33('0x7'));var controller=require(_0xce33('0x8'));router[_0xce33('0x9')]('/',controller[_0xce33('0xa')]);module[_0xce33('0xb')]=router; \ No newline at end of file +var _0xf354=['multer','util','connect-timeout','Router','fs-extra','../../config/environment','./migration.controller','get','index','exports'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xf354,0x17c));var _0x4f35=function(_0x4b6928,_0x4369aa){_0x4b6928=_0x4b6928-0x0;var _0x3e6ecb=_0xf354[_0x4b6928];return _0x3e6ecb;};'use strict';var multer=require(_0x4f35('0x0'));var util=require(_0x4f35('0x1'));var path=require('path');var timeout=require(_0x4f35('0x2'));var express=require('express');var router=express[_0x4f35('0x3')]();var fs_extra=require(_0x4f35('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f35('0x5'));var controller=require(_0x4f35('0x6'));router[_0x4f35('0x7')]('/',controller[_0x4f35('0x8')]);module[_0x4f35('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index f850306..fb7a0fa 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 _0xf688=['sequelize','exports','version'];(function(_0x44098b,_0x11a80a){var _0x89b454=function(_0x3b0f90){while(--_0x3b0f90){_0x44098b['push'](_0x44098b['shift']());}};_0x89b454(++_0x11a80a);}(_0xf688,0x1ce));var _0x8f68=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf688[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8f68('0x0'));module[_0x8f68('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x8f68('0x2')}}; \ No newline at end of file +var _0x2bfe=['sequelize','exports','version'];(function(_0x48ddb4,_0x477340){var _0x4fb1f1=function(_0x296fbf){while(--_0x296fbf){_0x48ddb4['push'](_0x48ddb4['shift']());}};_0x4fb1f1(++_0x477340);}(_0x2bfe,0x129));var _0xe2bf=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2bfe[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xe2bf('0x0'));module[_0xe2bf('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xe2bf('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a8b262d..1199b9b 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 _0xee12=['pick','filter','merge','options','include','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','reject','save','then','destroy','sendStatus','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x1c666a,_0x21e9fc){var _0x507f85=function(_0x5f1f4e){while(--_0x5f1f4e){_0x1c666a['push'](_0x1c666a['shift']());}};_0x507f85(++_0x21e9fc);}(_0xee12,0x86));var _0x2ee1=function(_0x168c6c,_0x1bfdac){_0x168c6c=_0x168c6c-0x0;var _0x4d8fea=_0xee12[_0x168c6c];return _0x4d8fea;};'use strict';var emlformat=require(_0x2ee1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ee1('0x1'));var jsonpatch=require(_0x2ee1('0x2'));var rp=require(_0x2ee1('0x3'));var moment=require(_0x2ee1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2ee1('0x5'));var util=require(_0x2ee1('0x6'));var path=require(_0x2ee1('0x7'));var sox=require(_0x2ee1('0x8'));var csv=require(_0x2ee1('0x9'));var ejs=require(_0x2ee1('0xa'));var fs=require('fs');var fs_extra=require(_0x2ee1('0xb'));var _=require('lodash');var squel=require(_0x2ee1('0xc'));var crypto=require('crypto');var jsforce=require(_0x2ee1('0xd'));var deskjs=require(_0x2ee1('0xe'));var toCsv=require(_0x2ee1('0x9'));var querystring=require('querystring');var Papa=require(_0x2ee1('0xf'));var Redis=require('ioredis');var authService=require(_0x2ee1('0x10'));var qs=require(_0x2ee1('0x11'));var as=require(_0x2ee1('0x12'));var hardwareService=require(_0x2ee1('0x13'));var logger=require(_0x2ee1('0x14'))(_0x2ee1('0x15'));var utils=require('../../config/utils');var config=require(_0x2ee1('0x16'));var licenseUtil=require(_0x2ee1('0x17'));var db=require(_0x2ee1('0x18'))['db'];function respondWithStatusCode(_0x5d4fe2,_0x532ece){_0x532ece=_0x532ece||0xcc;return function(_0x2f4fba){if(_0x2f4fba){return _0x5d4fe2['sendStatus'](_0x532ece);}return _0x5d4fe2[_0x2ee1('0x19')](_0x532ece)[_0x2ee1('0x1a')]();};}function respondWithResult(_0x5c9370,_0x563504){_0x563504=_0x563504||0xc8;return function(_0x27854e){if(_0x27854e){return _0x5c9370[_0x2ee1('0x19')](_0x563504)['json'](_0x27854e);}};}function respondWithFilteredResult(_0x334957,_0x30d74b){return function(_0x2728c7){if(_0x2728c7){var _0x31198b=typeof _0x30d74b[_0x2ee1('0x1b')]===_0x2ee1('0x1c')&&typeof _0x30d74b['limit']===_0x2ee1('0x1c');var _0x2f2607=_0x2728c7['count'];var _0x57556b=_0x31198b?0x0:_0x30d74b[_0x2ee1('0x1b')];var _0x41ad5a=_0x31198b?_0x2728c7[_0x2ee1('0x1d')]:_0x30d74b[_0x2ee1('0x1b')]+_0x30d74b['limit'];var _0x280af7;if(_0x41ad5a>=_0x2f2607){_0x41ad5a=_0x2f2607;_0x280af7=0xc8;}else{_0x280af7=0xce;}_0x334957[_0x2ee1('0x19')](_0x280af7);return _0x334957[_0x2ee1('0x1e')]('Content-Range',_0x57556b+'-'+_0x41ad5a+'/'+_0x2f2607)['json'](_0x2728c7);}return null;};}function patchUpdates(_0x4cc1d8){return function(_0x5c7277){try{jsonpatch['apply'](_0x5c7277,_0x4cc1d8,!![]);}catch(_0x8ca07b){return BPromise[_0x2ee1('0x1f')](_0x8ca07b);}return _0x5c7277[_0x2ee1('0x20')]();};}function saveUpdates(_0x6cae96,_0x382d38){return function(_0x4dd05f){if(_0x4dd05f){return _0x4dd05f['update'](_0x6cae96)[_0x2ee1('0x21')](function(_0x5c90dc){return _0x5c90dc;});}return null;};}function removeEntity(_0x16d296,_0x396e20){return function(_0x35a000){if(_0x35a000){return _0x35a000[_0x2ee1('0x22')]()[_0x2ee1('0x21')](function(){_0x16d296[_0x2ee1('0x19')](0xcc)[_0x2ee1('0x1a')]();});}};}function handleEntityNotFound(_0x22a16d,_0x24560b){return function(_0x60be6d){if(!_0x60be6d){_0x22a16d[_0x2ee1('0x23')](0x194);}return _0x60be6d;};}function handleError(_0x2e593e,_0x19b64c){_0x19b64c=_0x19b64c||0x1f4;return function(_0x5ad351){logger['error'](_0x5ad351[_0x2ee1('0x24')]);if(_0x5ad351[_0x2ee1('0x25')]){delete _0x5ad351[_0x2ee1('0x25')];}_0x2e593e['status'](_0x19b64c)[_0x2ee1('0x26')](_0x5ad351);};}exports[_0x2ee1('0x27')]=function(_0x353adf,_0x5a458c){var _0x280808={},_0x4a4f5c={},_0x487b68={'count':0x0,'rows':[]};var _0x5d1320=_[_0x2ee1('0x28')](db[_0x2ee1('0x29')][_0x2ee1('0x2a')],function(_0x2ef874){return{'name':_0x2ef874[_0x2ee1('0x2b')],'type':_0x2ef874[_0x2ee1('0x2c')][_0x2ee1('0x2d')]};});_0x4a4f5c[_0x2ee1('0x2e')]=_[_0x2ee1('0x28')](_0x5d1320,_0x2ee1('0x25'));_0x4a4f5c[_0x2ee1('0x2f')]=_[_0x2ee1('0x30')](_0x353adf['query']);_0x4a4f5c[_0x2ee1('0x31')]=_[_0x2ee1('0x32')](_0x4a4f5c[_0x2ee1('0x2e')],_0x4a4f5c['query']);_0x280808[_0x2ee1('0x33')]=_[_0x2ee1('0x32')](_0x4a4f5c[_0x2ee1('0x2e')],qs[_0x2ee1('0x34')](_0x353adf[_0x2ee1('0x2f')][_0x2ee1('0x34')]));_0x280808['attributes']=_0x280808[_0x2ee1('0x33')]['length']?_0x280808['attributes']:_0x4a4f5c[_0x2ee1('0x2e')];if(!_0x353adf[_0x2ee1('0x2f')][_0x2ee1('0x35')](_0x2ee1('0x36'))){_0x280808[_0x2ee1('0x37')]=qs['limit'](_0x353adf[_0x2ee1('0x2f')][_0x2ee1('0x37')]);_0x280808['offset']=qs[_0x2ee1('0x1b')](_0x353adf[_0x2ee1('0x2f')][_0x2ee1('0x1b')]);}_0x280808['order']=qs[_0x2ee1('0x38')](_0x353adf[_0x2ee1('0x2f')][_0x2ee1('0x38')]);_0x280808[_0x2ee1('0x39')]=qs[_0x2ee1('0x31')](_[_0x2ee1('0x3a')](_0x353adf[_0x2ee1('0x2f')],_0x4a4f5c['filters']),_0x5d1320);if(_0x353adf[_0x2ee1('0x2f')][_0x2ee1('0x3b')]){_0x280808[_0x2ee1('0x39')]=_[_0x2ee1('0x3c')](_0x280808['where'],{'$or':_[_0x2ee1('0x28')](_0x5d1320,function(_0x26adf6){if(_0x26adf6[_0x2ee1('0x2c')]!=='VIRTUAL'){var _0x1ff374={};_0x1ff374[_0x26adf6[_0x2ee1('0x25')]]={'$like':'%'+_0x353adf['query']['filter']+'%'};return _0x1ff374;}})});}_0x280808=_[_0x2ee1('0x3c')]({},_0x280808,_0x353adf[_0x2ee1('0x3d')]);var _0x52df66={'where':_0x280808[_0x2ee1('0x39')]};return db[_0x2ee1('0x29')][_0x2ee1('0x1d')](_0x52df66)[_0x2ee1('0x21')](function(_0x192c3d){_0x487b68['count']=_0x192c3d;if(_0x353adf[_0x2ee1('0x2f')]['includeAll']){_0x280808[_0x2ee1('0x3e')]=[{'all':!![]}];}return db['Migration'][_0x2ee1('0x3f')](_0x280808);})['then'](function(_0x14c8b0){_0x487b68['rows']=_0x14c8b0;return _0x487b68;})[_0x2ee1('0x21')](respondWithFilteredResult(_0x5a458c,_0x280808))['catch'](handleError(_0x5a458c,null));}; \ No newline at end of file +var _0x7079=['filter','merge','VIRTUAL','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x7079,0x93));var _0x9707=function(_0x4bfdb2,_0x49d6a9){_0x4bfdb2=_0x4bfdb2-0x0;var _0x32782c=_0x7079[_0x4bfdb2];return _0x32782c;};'use strict';var emlformat=require(_0x9707('0x0'));var rimraf=require(_0x9707('0x1'));var zipdir=require(_0x9707('0x2'));var jsonpatch=require(_0x9707('0x3'));var rp=require('request-promise');var moment=require(_0x9707('0x4'));var BPromise=require(_0x9707('0x5'));var Mustache=require('mustache');var util=require(_0x9707('0x6'));var path=require(_0x9707('0x7'));var sox=require(_0x9707('0x8'));var csv=require(_0x9707('0x9'));var ejs=require(_0x9707('0xa'));var fs=require('fs');var fs_extra=require(_0x9707('0xb'));var _=require(_0x9707('0xc'));var squel=require(_0x9707('0xd'));var crypto=require(_0x9707('0xe'));var jsforce=require(_0x9707('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9707('0x9'));var querystring=require(_0x9707('0x10'));var Papa=require(_0x9707('0x11'));var Redis=require('ioredis');var authService=require(_0x9707('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9707('0x13'));var hardwareService=require(_0x9707('0x14'));var logger=require('../../config/logger')(_0x9707('0x15'));var utils=require(_0x9707('0x16'));var config=require(_0x9707('0x17'));var licenseUtil=require(_0x9707('0x18'));var db=require(_0x9707('0x19'))['db'];function respondWithStatusCode(_0x5213a8,_0x589756){_0x589756=_0x589756||0xcc;return function(_0x26fa44){if(_0x26fa44){return _0x5213a8[_0x9707('0x1a')](_0x589756);}return _0x5213a8[_0x9707('0x1b')](_0x589756)[_0x9707('0x1c')]();};}function respondWithResult(_0x40c5c5,_0x5e5118){_0x5e5118=_0x5e5118||0xc8;return function(_0x5597d4){if(_0x5597d4){return _0x40c5c5[_0x9707('0x1b')](_0x5e5118)[_0x9707('0x1d')](_0x5597d4);}};}function respondWithFilteredResult(_0x557f9e,_0x428ee9){return function(_0x109e19){if(_0x109e19){var _0x2504ea=typeof _0x428ee9['offset']===_0x9707('0x1e')&&typeof _0x428ee9[_0x9707('0x1f')]==='undefined';var _0x3a5f69=_0x109e19[_0x9707('0x20')];var _0x4d0b11=_0x2504ea?0x0:_0x428ee9['offset'];var _0x47b5bc=_0x2504ea?_0x109e19[_0x9707('0x20')]:_0x428ee9['offset']+_0x428ee9[_0x9707('0x1f')];var _0x16289f;if(_0x47b5bc>=_0x3a5f69){_0x47b5bc=_0x3a5f69;_0x16289f=0xc8;}else{_0x16289f=0xce;}_0x557f9e[_0x9707('0x1b')](_0x16289f);return _0x557f9e['set'](_0x9707('0x21'),_0x4d0b11+'-'+_0x47b5bc+'/'+_0x3a5f69)[_0x9707('0x1d')](_0x109e19);}return null;};}function patchUpdates(_0x300981){return function(_0xbd5995){try{jsonpatch[_0x9707('0x22')](_0xbd5995,_0x300981,!![]);}catch(_0xcf89ae){return BPromise[_0x9707('0x23')](_0xcf89ae);}return _0xbd5995[_0x9707('0x24')]();};}function saveUpdates(_0x4c086e,_0x252c88){return function(_0x4c8d74){if(_0x4c8d74){return _0x4c8d74[_0x9707('0x25')](_0x4c086e)[_0x9707('0x26')](function(_0x3fafcf){return _0x3fafcf;});}return null;};}function removeEntity(_0x1a05cb,_0x3c46cd){return function(_0x5954dd){if(_0x5954dd){return _0x5954dd[_0x9707('0x27')]()['then'](function(){_0x1a05cb[_0x9707('0x1b')](0xcc)[_0x9707('0x1c')]();});}};}function handleEntityNotFound(_0x3f13c3,_0x57c143){return function(_0x429387){if(!_0x429387){_0x3f13c3[_0x9707('0x1a')](0x194);}return _0x429387;};}function handleError(_0x111836,_0x25eb05){_0x25eb05=_0x25eb05||0x1f4;return function(_0x4ffe6c){logger[_0x9707('0x28')](_0x4ffe6c[_0x9707('0x29')]);if(_0x4ffe6c[_0x9707('0x2a')]){delete _0x4ffe6c[_0x9707('0x2a')];}_0x111836[_0x9707('0x1b')](_0x25eb05)['send'](_0x4ffe6c);};}exports['index']=function(_0x18c6be,_0x3e76b9){var _0x25def2={},_0x2d5592={},_0x44bc14={'count':0x0,'rows':[]};var _0x1dd922=_[_0x9707('0x2b')](db['Migration'][_0x9707('0x2c')],function(_0x1c4e33){return{'name':_0x1c4e33[_0x9707('0x2d')],'type':_0x1c4e33[_0x9707('0x2e')][_0x9707('0x2f')]};});_0x2d5592[_0x9707('0x30')]=_[_0x9707('0x2b')](_0x1dd922,_0x9707('0x2a'));_0x2d5592[_0x9707('0x31')]=_['keys'](_0x18c6be[_0x9707('0x31')]);_0x2d5592[_0x9707('0x32')]=_[_0x9707('0x33')](_0x2d5592[_0x9707('0x30')],_0x2d5592[_0x9707('0x31')]);_0x25def2[_0x9707('0x34')]=_[_0x9707('0x33')](_0x2d5592['model'],qs[_0x9707('0x35')](_0x18c6be['query'][_0x9707('0x35')]));_0x25def2['attributes']=_0x25def2[_0x9707('0x34')][_0x9707('0x36')]?_0x25def2[_0x9707('0x34')]:_0x2d5592[_0x9707('0x30')];if(!_0x18c6be[_0x9707('0x31')][_0x9707('0x37')](_0x9707('0x38'))){_0x25def2[_0x9707('0x1f')]=qs[_0x9707('0x1f')](_0x18c6be[_0x9707('0x31')][_0x9707('0x1f')]);_0x25def2['offset']=qs['offset'](_0x18c6be['query'][_0x9707('0x39')]);}_0x25def2['order']=qs[_0x9707('0x3a')](_0x18c6be[_0x9707('0x31')][_0x9707('0x3a')]);_0x25def2[_0x9707('0x3b')]=qs['filters'](_['pick'](_0x18c6be[_0x9707('0x31')],_0x2d5592[_0x9707('0x32')]),_0x1dd922);if(_0x18c6be['query'][_0x9707('0x3c')]){_0x25def2[_0x9707('0x3b')]=_[_0x9707('0x3d')](_0x25def2[_0x9707('0x3b')],{'$or':_['map'](_0x1dd922,function(_0x3f9ab9){if(_0x3f9ab9[_0x9707('0x2e')]!==_0x9707('0x3e')){var _0x4dedfd={};_0x4dedfd[_0x3f9ab9[_0x9707('0x2a')]]={'$like':'%'+_0x18c6be[_0x9707('0x31')]['filter']+'%'};return _0x4dedfd;}})});}_0x25def2=_[_0x9707('0x3d')]({},_0x25def2,_0x18c6be['options']);var _0x31b2a9={'where':_0x25def2[_0x9707('0x3b')]};return db[_0x9707('0x3f')]['count'](_0x31b2a9)[_0x9707('0x26')](function(_0x246d2d){_0x44bc14['count']=_0x246d2d;if(_0x18c6be[_0x9707('0x31')][_0x9707('0x40')]){_0x25def2[_0x9707('0x41')]=[{'all':!![]}];}return db[_0x9707('0x3f')][_0x9707('0x42')](_0x25def2);})[_0x9707('0x26')](function(_0x1a2391){_0x44bc14[_0x9707('0x43')]=_0x1a2391;return _0x44bc14;})[_0x9707('0x26')](respondWithFilteredResult(_0x3e76b9,_0x25def2))[_0x9707('0x44')](handleError(_0x3e76b9,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index db3c735..e6b7cca 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 _0x6280=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations'];(function(_0x11d10a,_0x30ca5c){var _0xeb719a=function(_0x5030e7){while(--_0x5030e7){_0x11d10a['push'](_0x11d10a['shift']());}};_0xeb719a(++_0x30ca5c);}(_0x6280,0xa5));var _0x0628=function(_0x2e3750,_0x55e4bc){_0x2e3750=_0x2e3750-0x0;var _0x5bf015=_0x6280[_0x2e3750];return _0x5bf015;};'use strict';var _=require(_0x0628('0x0'));var util=require(_0x0628('0x1'));var logger=require(_0x0628('0x2'))(_0x0628('0x3'));var moment=require(_0x0628('0x4'));var BPromise=require(_0x0628('0x5'));var rp=require(_0x0628('0x6'));var fs=require('fs');var path=require(_0x0628('0x7'));var rimraf=require(_0x0628('0x8'));var config=require(_0x0628('0x9'));var attributes=require(_0x0628('0xa'));module[_0x0628('0xb')]=function(_0x55973f,_0x18c8bf){return _0x55973f[_0x0628('0xc')](_0x0628('0xd'),attributes,{'tableName':_0x0628('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4572=['./migration.attributes','exports','define','migrations','lodash','api','request-promise','path','../../config/environment'];(function(_0x2bb6b6,_0xc41062){var _0x100ae7=function(_0x920098){while(--_0x920098){_0x2bb6b6['push'](_0x2bb6b6['shift']());}};_0x100ae7(++_0xc41062);}(_0x4572,0x11b));var _0x2457=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x4572[_0x57cbfb];return _0x4cb933;};'use strict';var _=require(_0x2457('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2457('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2457('0x2'));var fs=require('fs');var path=require(_0x2457('0x3'));var rimraf=require('rimraf');var config=require(_0x2457('0x4'));var attributes=require(_0x2457('0x5'));module[_0x2457('0x6')]=function(_0x4cbb53,_0x7b6200){return _0x4cbb53[_0x2457('0x7')]('Migration',attributes,{'tableName':_0x2457('0x8'),'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 6912760..a84c541 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 _0x3308=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4197d4,_0x2f0e58){var _0xaecb49=function(_0x51a4c1){while(--_0x51a4c1){_0x4197d4['push'](_0x4197d4['shift']());}};_0xaecb49(++_0x2f0e58);}(_0x3308,0x160));var _0x8330=function(_0x27c1f6,_0x41e2b9){_0x27c1f6=_0x27c1f6-0x0;var _0x267705=_0x3308[_0x27c1f6];return _0x267705;};'use strict';var _=require(_0x8330('0x0'));var util=require(_0x8330('0x1'));var moment=require(_0x8330('0x2'));var BPromise=require(_0x8330('0x3'));var rs=require(_0x8330('0x4'));var fs=require('fs');var Redis=require(_0x8330('0x5'));var db=require(_0x8330('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8330('0x7'));var config=require('../../config/environment');var jayson=require(_0x8330('0x8'));var client=jayson[_0x8330('0x9')][_0x8330('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59c19e,_0x413cac,_0x1d5fd6){return new BPromise(function(_0x1244a7,_0x2dcc17){return client[_0x8330('0xb')](_0x59c19e,_0x1d5fd6)[_0x8330('0xc')](function(_0x4f917e){logger[_0x8330('0xd')](_0x8330('0xe'),_0x413cac,_0x8330('0xf'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x413cac,'request\x20sent',JSON['stringify'](_0x4f917e));if(_0x4f917e['error']){if(_0x4f917e['error'][_0x8330('0x10')]===0x1f4){logger['error'](_0x8330('0xe'),_0x413cac,_0x4f917e[_0x8330('0x11')][_0x8330('0x12')]);return _0x2dcc17(_0x4f917e[_0x8330('0x11')][_0x8330('0x12')]);}logger['error'](_0x8330('0xe'),_0x413cac,_0x4f917e['error'][_0x8330('0x12')]);return _0x1244a7(_0x4f917e[_0x8330('0x11')][_0x8330('0x12')]);}else{logger[_0x8330('0xd')](_0x8330('0xe'),_0x413cac,_0x8330('0xf'));_0x1244a7(_0x4f917e[_0x8330('0x13')][_0x8330('0x12')]);}})[_0x8330('0x14')](function(_0x4d9662){logger[_0x8330('0x11')](_0x8330('0xe'),_0x413cac,_0x4d9662);_0x2dcc17(_0x4d9662);});});} \ No newline at end of file +var _0x4ded=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','Migration,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x4ded,0x116));var _0xd4de=function(_0x25083f,_0x503500){_0x25083f=_0x25083f-0x0;var _0x11f7e0=_0x4ded[_0x25083f];return _0x11f7e0;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('Migration,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0c689e1..2175b14 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 _0x8814=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','connect-timeout'];(function(_0x5b64fa,_0x437290){var _0x4ebed4=function(_0x24d699){while(--_0x24d699){_0x5b64fa['push'](_0x5b64fa['shift']());}};_0x4ebed4(++_0x437290);}(_0x8814,0x1b8));var _0x4881=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x8814[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0x4881('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4881('0x1'));var express=require('express');var router=express[_0x4881('0x2')]();var fs_extra=require(_0x4881('0x3'));var auth=require(_0x4881('0x4'));var interaction=require(_0x4881('0x5'));var config=require('../../config/environment');var controller=require(_0x4881('0x6'));router[_0x4881('0x7')]('/',auth[_0x4881('0x8')](),controller[_0x4881('0x9')]);router['get'](_0x4881('0xa'),auth['isAuthenticated'](),controller[_0x4881('0xb')]);router[_0x4881('0xc')]('/',auth[_0x4881('0x8')](),controller[_0x4881('0xd')]);router['put'](_0x4881('0xa'),auth[_0x4881('0x8')](),controller['update']);router[_0x4881('0xe')](_0x4881('0xa'),auth[_0x4881('0x8')](),controller[_0x4881('0xf')]);module[_0x4881('0x10')]=router; \ No newline at end of file +var _0x046b=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x1c2e22,_0x31db2b){var _0x53062c=function(_0x31759d){while(--_0x31759d){_0x1c2e22['push'](_0x1c2e22['shift']());}};_0x53062c(++_0x31db2b);}(_0x046b,0x1ba));var _0xb046=function(_0x467aba,_0x4ec941){_0x467aba=_0x467aba-0x0;var _0x379b93=_0x046b[_0x467aba];return _0x379b93;};'use strict';var multer=require(_0xb046('0x0'));var util=require(_0xb046('0x1'));var path=require(_0xb046('0x2'));var timeout=require(_0xb046('0x3'));var express=require('express');var router=express[_0xb046('0x4')]();var fs_extra=require(_0xb046('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb046('0x6'));var config=require(_0xb046('0x7'));var controller=require(_0xb046('0x8'));router[_0xb046('0x9')]('/',auth[_0xb046('0xa')](),controller[_0xb046('0xb')]);router[_0xb046('0x9')](_0xb046('0xc'),auth[_0xb046('0xa')](),controller[_0xb046('0xd')]);router[_0xb046('0xe')]('/',auth[_0xb046('0xa')](),controller[_0xb046('0xf')]);router['put'](_0xb046('0xc'),auth[_0xb046('0xa')](),controller[_0xb046('0x10')]);router[_0xb046('0x11')](_0xb046('0xc'),auth['isAuthenticated'](),controller[_0xb046('0x12')]);module[_0xb046('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 5027a0d..c284ff8 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 _0xbaaa=['sequelize','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x2cde63,_0x54fd0e){var _0x1ced4d=function(_0x388a4c){while(--_0x388a4c){_0x2cde63['push'](_0x2cde63['shift']());}};_0x1ced4d(++_0x54fd0e);}(_0xbaaa,0x150));var _0xabaa=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xbaaa[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0xabaa('0x0'));module['exports']={'type':{'type':Sequelize[_0xabaa('0x1')](_0xabaa('0x2'),_0xabaa('0x3'),_0xabaa('0x4'),_0xabaa('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xabaa('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x81ea=['externip','stun','turn','STRING','sequelize'];(function(_0x49c0ad,_0x2be06b){var _0x4a44d9=function(_0x23d9a6){while(--_0x23d9a6){_0x49c0ad['push'](_0x49c0ad['shift']());}};_0x4a44d9(++_0x2be06b);}(_0x81ea,0xea));var _0xa81e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81ea[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa81e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('localnet',_0xa81e('0x1'),_0xa81e('0x2'),_0xa81e('0x3'))},'value':{'type':Sequelize[_0xa81e('0x4')]},'username':{'type':Sequelize[_0xa81e('0x4')]},'password':{'type':Sequelize[_0xa81e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 493cf83..4013047 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 _0xf1c9=['index','map','Network','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','sequelize','transaction','create','body','STUN','readFileSync','root','render','res_stun_monitor.so','toUpperCase','join','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','TURN','chan_sip.so','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','stringify','code','Network,\x20%s,\x20%s','error','message','info','catch','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','reject','update','then','name','send'];(function(_0x4e9b0d,_0x1ecade){var _0x3c0ba5=function(_0x13dea2){while(--_0x13dea2){_0x4e9b0d['push'](_0x4e9b0d['shift']());}};_0x3c0ba5(++_0x1ecade);}(_0xf1c9,0xa0));var _0x9f1c=function(_0x19fa57,_0x2f3706){_0x19fa57=_0x19fa57-0x0;var _0x1d8274=_0xf1c9[_0x19fa57];return _0x1d8274;};'use strict';var emlformat=require(_0x9f1c('0x0'));var rimraf=require(_0x9f1c('0x1'));var zipdir=require(_0x9f1c('0x2'));var jsonpatch=require(_0x9f1c('0x3'));var rp=require(_0x9f1c('0x4'));var moment=require(_0x9f1c('0x5'));var BPromise=require(_0x9f1c('0x6'));var Mustache=require(_0x9f1c('0x7'));var util=require(_0x9f1c('0x8'));var path=require(_0x9f1c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f1c('0xa'));var _=require('lodash');var squel=require(_0x9f1c('0xb'));var crypto=require(_0x9f1c('0xc'));var jsforce=require(_0x9f1c('0xd'));var deskjs=require(_0x9f1c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f1c('0xf'));var authService=require(_0x9f1c('0x10'));var qs=require(_0x9f1c('0x11'));var as=require(_0x9f1c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f1c('0x13'))(_0x9f1c('0x14'));var utils=require(_0x9f1c('0x15'));var config=require(_0x9f1c('0x16'));var licenseUtil=require(_0x9f1c('0x17'));var db=require(_0x9f1c('0x18'))['db'];var jayson=require(_0x9f1c('0x19'));var client=jayson[_0x9f1c('0x1a')][_0x9f1c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x21d63b,_0x145bd6,_0x5dedd2,_0x5b203b){return new BPromise(function(_0x11c04d,_0x192f62){var _0x1554bb=_0x5b203b||client;return _0x1554bb[_0x9f1c('0x1c')](_0x21d63b,_0x5dedd2)['then'](function(_0x429b4e){logger['info']('Network,\x20%s,\x20%s',_0x145bd6,_0x9f1c('0x1d'));logger[_0x9f1c('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x145bd6,_0x9f1c('0x1d'),JSON[_0x9f1c('0x1f')](_0x429b4e));if(_0x429b4e['error']){if(_0x429b4e['error'][_0x9f1c('0x20')]===0x1f4){logger['error'](_0x9f1c('0x21'),_0x145bd6,_0x429b4e[_0x9f1c('0x22')]['message']);return _0x192f62(_0x429b4e[_0x9f1c('0x22')][_0x9f1c('0x23')]);}logger[_0x9f1c('0x22')](_0x9f1c('0x21'),_0x145bd6,_0x429b4e[_0x9f1c('0x22')]['message']);return _0x11c04d(_0x429b4e[_0x9f1c('0x22')][_0x9f1c('0x23')]);}else{logger[_0x9f1c('0x24')](_0x9f1c('0x21'),_0x145bd6,'request\x20sent');_0x11c04d(_0x429b4e['result'][_0x9f1c('0x23')]);}})[_0x9f1c('0x25')](function(_0x286feb){logger[_0x9f1c('0x22')](_0x9f1c('0x21'),_0x145bd6,_0x286feb);_0x192f62(_0x286feb);});});}function respondWithStatusCode(_0x15c584,_0x464f3d){_0x464f3d=_0x464f3d||0xcc;return function(_0x486771){if(_0x486771){return _0x15c584[_0x9f1c('0x26')](_0x464f3d);}return _0x15c584[_0x9f1c('0x27')](_0x464f3d)[_0x9f1c('0x28')]();};}function respondWithResult(_0x5a63ef,_0x5383f0){_0x5383f0=_0x5383f0||0xc8;return function(_0x452ccb){if(_0x452ccb){return _0x5a63ef[_0x9f1c('0x27')](_0x5383f0)['json'](_0x452ccb);}};}function respondWithFilteredResult(_0x905502,_0x198268){return function(_0x4987d4){if(_0x4987d4){var _0x358543=typeof _0x198268['offset']===_0x9f1c('0x29')&&typeof _0x198268['limit']===_0x9f1c('0x29');var _0x26c3c3=_0x4987d4[_0x9f1c('0x2a')];var _0x1a01e3=_0x358543?0x0:_0x198268['offset'];var _0x4d5d89=_0x358543?_0x4987d4[_0x9f1c('0x2a')]:_0x198268[_0x9f1c('0x2b')]+_0x198268[_0x9f1c('0x2c')];var _0x30da2a;if(_0x4d5d89>=_0x26c3c3){_0x4d5d89=_0x26c3c3;_0x30da2a=0xc8;}else{_0x30da2a=0xce;}_0x905502[_0x9f1c('0x27')](_0x30da2a);return _0x905502['set'](_0x9f1c('0x2d'),_0x1a01e3+'-'+_0x4d5d89+'/'+_0x26c3c3)[_0x9f1c('0x2e')](_0x4987d4);}return null;};}function patchUpdates(_0x5bcbf6){return function(_0x378f7b){try{jsonpatch['apply'](_0x378f7b,_0x5bcbf6,!![]);}catch(_0x139182){return BPromise[_0x9f1c('0x2f')](_0x139182);}return _0x378f7b['save']();};}function saveUpdates(_0x46d7d6,_0x3a3b01){return function(_0x129711){if(_0x129711){return _0x129711[_0x9f1c('0x30')](_0x46d7d6)['then'](function(_0x426826){return _0x426826;});}return null;};}function removeEntity(_0x4b6e6b,_0x148d42){return function(_0x5a5d92){if(_0x5a5d92){return _0x5a5d92['destroy']()[_0x9f1c('0x31')](function(){_0x4b6e6b[_0x9f1c('0x27')](0xcc)[_0x9f1c('0x28')]();});}};}function handleEntityNotFound(_0x118ca3,_0x6a5f98){return function(_0x28ebe0){if(!_0x28ebe0){_0x118ca3[_0x9f1c('0x26')](0x194);}return _0x28ebe0;};}function handleError(_0x580eae,_0x37c2a1){_0x37c2a1=_0x37c2a1||0x1f4;return function(_0x597b22){logger['error'](_0x597b22['stack']);if(_0x597b22['name']){delete _0x597b22[_0x9f1c('0x32')];}_0x580eae[_0x9f1c('0x27')](_0x37c2a1)[_0x9f1c('0x33')](_0x597b22);};}exports[_0x9f1c('0x34')]=function(_0x4d51e3,_0x13236a){var _0x1e5d0d={},_0xc42da2={},_0x1c3d68={'count':0x0,'rows':[]};var _0x1d7bc0=_[_0x9f1c('0x35')](db[_0x9f1c('0x36')][_0x9f1c('0x37')],function(_0x674a1f){return{'name':_0x674a1f[_0x9f1c('0x38')],'type':_0x674a1f[_0x9f1c('0x39')][_0x9f1c('0x3a')]};});_0xc42da2[_0x9f1c('0x3b')]=_[_0x9f1c('0x35')](_0x1d7bc0,_0x9f1c('0x32'));_0xc42da2['query']=_[_0x9f1c('0x3c')](_0x4d51e3[_0x9f1c('0x3d')]);_0xc42da2[_0x9f1c('0x3e')]=_[_0x9f1c('0x3f')](_0xc42da2[_0x9f1c('0x3b')],_0xc42da2[_0x9f1c('0x3d')]);_0x1e5d0d[_0x9f1c('0x40')]=_[_0x9f1c('0x3f')](_0xc42da2[_0x9f1c('0x3b')],qs[_0x9f1c('0x41')](_0x4d51e3[_0x9f1c('0x3d')]['fields']));_0x1e5d0d[_0x9f1c('0x40')]=_0x1e5d0d['attributes'][_0x9f1c('0x42')]?_0x1e5d0d[_0x9f1c('0x40')]:_0xc42da2['model'];if(!_0x4d51e3[_0x9f1c('0x3d')]['hasOwnProperty'](_0x9f1c('0x43'))){_0x1e5d0d['limit']=qs[_0x9f1c('0x2c')](_0x4d51e3['query']['limit']);_0x1e5d0d[_0x9f1c('0x2b')]=qs[_0x9f1c('0x2b')](_0x4d51e3[_0x9f1c('0x3d')][_0x9f1c('0x2b')]);}_0x1e5d0d['order']=qs['sort'](_0x4d51e3[_0x9f1c('0x3d')][_0x9f1c('0x44')]);_0x1e5d0d[_0x9f1c('0x45')]=qs[_0x9f1c('0x3e')](_[_0x9f1c('0x46')](_0x4d51e3['query'],_0xc42da2[_0x9f1c('0x3e')]),_0x1d7bc0);if(_0x4d51e3['query']['filter']){_0x1e5d0d[_0x9f1c('0x45')]=_[_0x9f1c('0x47')](_0x1e5d0d[_0x9f1c('0x45')],{'$or':_[_0x9f1c('0x35')](_0x1d7bc0,function(_0xe4c164){if(_0xe4c164[_0x9f1c('0x39')]!==_0x9f1c('0x48')){var _0x3a8352={};_0x3a8352[_0xe4c164[_0x9f1c('0x32')]]={'$like':'%'+_0x4d51e3['query'][_0x9f1c('0x49')]+'%'};return _0x3a8352;}})});}_0x1e5d0d=_[_0x9f1c('0x47')]({},_0x1e5d0d,_0x4d51e3[_0x9f1c('0x4a')]);var _0xd9ed11={'where':_0x1e5d0d['where']};return db['Network'][_0x9f1c('0x2a')](_0xd9ed11)['then'](function(_0x454e14){_0x1c3d68[_0x9f1c('0x2a')]=_0x454e14;if(_0x4d51e3['query'][_0x9f1c('0x4b')]){_0x1e5d0d[_0x9f1c('0x4c')]=[{'all':!![]}];}return db[_0x9f1c('0x36')][_0x9f1c('0x4d')](_0x1e5d0d);})[_0x9f1c('0x31')](function(_0x507cea){_0x1c3d68[_0x9f1c('0x4e')]=_0x507cea;return _0x1c3d68;})[_0x9f1c('0x31')](respondWithFilteredResult(_0x13236a,_0x1e5d0d))[_0x9f1c('0x25')](handleError(_0x13236a,null));};exports['show']=function(_0x7719e4,_0x12fbe1){var _0x2b0c9f={'raw':!![],'where':{'id':_0x7719e4[_0x9f1c('0x4f')]['id']}},_0xf13e96={};_0xf13e96[_0x9f1c('0x3b')]=_[_0x9f1c('0x3c')](db[_0x9f1c('0x36')][_0x9f1c('0x37')]);_0xf13e96[_0x9f1c('0x3d')]=_[_0x9f1c('0x3c')](_0x7719e4[_0x9f1c('0x3d')]);_0xf13e96[_0x9f1c('0x3e')]=_[_0x9f1c('0x3f')](_0xf13e96['model'],_0xf13e96[_0x9f1c('0x3d')]);_0x2b0c9f[_0x9f1c('0x40')]=_[_0x9f1c('0x3f')](_0xf13e96[_0x9f1c('0x3b')],qs[_0x9f1c('0x41')](_0x7719e4['query'][_0x9f1c('0x41')]));_0x2b0c9f[_0x9f1c('0x40')]=_0x2b0c9f[_0x9f1c('0x40')][_0x9f1c('0x42')]?_0x2b0c9f['attributes']:_0xf13e96[_0x9f1c('0x3b')];if(_0x7719e4[_0x9f1c('0x3d')]['includeAll']){_0x2b0c9f['include']=[{'all':!![]}];}_0x2b0c9f=_[_0x9f1c('0x47')]({},_0x2b0c9f,_0x7719e4[_0x9f1c('0x4a')]);return db['Network'][_0x9f1c('0x50')](_0x2b0c9f)[_0x9f1c('0x31')](handleEntityNotFound(_0x12fbe1,null))['then'](respondWithResult(_0x12fbe1,null))[_0x9f1c('0x25')](handleError(_0x12fbe1,null));};exports['create']=function(_0x3c4b1a,_0x289994,_0x5b8f4c){var _0x2538ea;return db[_0x9f1c('0x51')][_0x9f1c('0x52')](function(_0x37164c){return db[_0x9f1c('0x36')][_0x9f1c('0x53')](_0x3c4b1a[_0x9f1c('0x54')],{'raw':!![]})[_0x9f1c('0x31')](function(_0x1afecc){_0x2538ea=_0x1afecc;return db['Network'][_0x9f1c('0x4d')]({'where':{'type':_0x3c4b1a[_0x9f1c('0x54')][_0x9f1c('0x39')]},'raw':!![]});})[_0x9f1c('0x31')](function(_0x4cc2ba){if(_0x2538ea['type']['toUpperCase']()==_0x9f1c('0x55')){var _0x4f96ea=fs[_0x9f1c('0x56')](path['join'](config[_0x9f1c('0x57')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x4e98b=ejs[_0x9f1c('0x58')](_0x4f96ea,{'networks':_0x4cc2ba||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4e98b);return respondWithRpcPromise('Reload','create',{'module':_0x9f1c('0x59')});}else if(_0x2538ea[_0x9f1c('0x39')][_0x9f1c('0x5a')]()=='TURN'){var _0x272e80=fs[_0x9f1c('0x56')](path[_0x9f1c('0x5b')](config[_0x9f1c('0x57')],_0x9f1c('0x5c')),_0x9f1c('0x5d'));var _0x2cf0b4=ejs['render'](_0x272e80,{'networks':_0x4cc2ba||[]});fs[_0x9f1c('0x5e')](_0x9f1c('0x5f'),_0x2cf0b4);return respondWithRpcPromise(_0x9f1c('0x60'),_0x9f1c('0x53'),{'module':_0x9f1c('0x59')});}else{var _0x25b493=fs[_0x9f1c('0x56')](path[_0x9f1c('0x5b')](config[_0x9f1c('0x57')],_0x9f1c('0x61')),_0x9f1c('0x5d'));var _0x1020d0=ejs['render'](_0x25b493,{'networks':_0x4cc2ba||[]});fs[_0x9f1c('0x5e')](util[_0x9f1c('0x62')](_0x9f1c('0x63'),_0x3c4b1a[_0x9f1c('0x54')][_0x9f1c('0x39')][_0x9f1c('0x64')]()),_0x1020d0);return respondWithRpcPromise(_0x9f1c('0x60'),_0x9f1c('0x53'),{'module':'chan_sip.so'});}return null;})[_0x9f1c('0x31')](function(){return _0x2538ea;});})[_0x9f1c('0x31')](respondWithResult(_0x289994,0xc9))['catch'](handleError(_0x289994,null));};exports[_0x9f1c('0x30')]=function(_0x1f1860,_0x1ec1ca,_0x41c3cf){var _0x4bffba;return db[_0x9f1c('0x51')][_0x9f1c('0x52')](function(_0x2996e7){return db['Network']['find']({'where':{'id':_0x1f1860[_0x9f1c('0x4f')]['id']}})[_0x9f1c('0x31')](handleEntityNotFound(_0x1ec1ca,null))[_0x9f1c('0x31')](saveUpdates(_0x1f1860[_0x9f1c('0x54')],null))[_0x9f1c('0x31')](function(_0xcaa5d4){if(_0xcaa5d4){_0x4bffba=_0xcaa5d4;return db['Network'][_0x9f1c('0x4d')]({'where':{'type':_0x4bffba[_0x9f1c('0x39')]},'raw':!![]});}return null;})[_0x9f1c('0x31')](function(_0x3661dd){if(_0x4bffba[_0x9f1c('0x39')]['toUpperCase']()=='STUN'){var _0x359eb2=fs[_0x9f1c('0x56')](path[_0x9f1c('0x5b')](config['root'],_0x9f1c('0x65')),'utf8');var _0x41c2c0=ejs[_0x9f1c('0x58')](_0x359eb2,{'networks':_0x3661dd||[]});fs['writeFileSync'](_0x9f1c('0x66'),_0x41c2c0);return respondWithRpcPromise(_0x9f1c('0x60'),_0x9f1c('0x30'),{'module':_0x9f1c('0x59')});}else if(_0x4bffba[_0x9f1c('0x39')][_0x9f1c('0x5a')]()==_0x9f1c('0x67')){var _0x3f2437=fs[_0x9f1c('0x56')](path[_0x9f1c('0x5b')](config[_0x9f1c('0x57')],_0x9f1c('0x5c')),_0x9f1c('0x5d'));var _0x1e4e79=ejs['render'](_0x3f2437,{'networks':_0x3661dd||[]});fs[_0x9f1c('0x5e')](_0x9f1c('0x5f'),_0x1e4e79);return respondWithRpcPromise(_0x9f1c('0x60'),'update',{'module':_0x9f1c('0x59')});}else{var _0x5d21c9=fs[_0x9f1c('0x56')](path['join'](config[_0x9f1c('0x57')],_0x9f1c('0x61')),'utf8');var _0x4e9aed=ejs[_0x9f1c('0x58')](_0x5d21c9,{'networks':_0x3661dd||[]});fs[_0x9f1c('0x5e')](util[_0x9f1c('0x62')](_0x9f1c('0x63'),_0x1f1860[_0x9f1c('0x54')]['type'][_0x9f1c('0x64')]()),_0x4e9aed);return respondWithRpcPromise(_0x9f1c('0x60'),_0x9f1c('0x30'),{'module':_0x9f1c('0x68')});}return null;})['then'](function(_0x1f06ff){if(_0x1f06ff){return _0x4bffba;}return null;});})[_0x9f1c('0x31')](respondWithResult(_0x1ec1ca,null))[_0x9f1c('0x25')](handleError(_0x1ec1ca,null));};exports[_0x9f1c('0x69')]=function(_0x5ec27f,_0x53f477,_0x2b1f1d){var _0x51d92d;return db[_0x9f1c('0x36')]['find']({'where':{'id':_0x5ec27f['params']['id']}})[_0x9f1c('0x31')](function(_0x2a6eec){_0x51d92d=_0x2a6eec;return _0x2a6eec;})[_0x9f1c('0x31')](handleEntityNotFound(_0x53f477,null))[_0x9f1c('0x31')](removeEntity(_0x53f477,null))['then'](function(){if(_0x51d92d){return db[_0x9f1c('0x36')][_0x9f1c('0x4d')]({'where':{'type':_0x51d92d[_0x9f1c('0x39')]},'raw':!![]});}})[_0x9f1c('0x31')](function(_0x3b3d32){if(_0x51d92d['type'][_0x9f1c('0x5a')]()=='STUN'){var _0x3582e1=fs[_0x9f1c('0x56')](path[_0x9f1c('0x5b')](config[_0x9f1c('0x57')],_0x9f1c('0x65')),_0x9f1c('0x5d'));var _0x4e30d8=ejs['render'](_0x3582e1,{'networks':_0x3b3d32||[]});fs[_0x9f1c('0x5e')](_0x9f1c('0x66'),_0x4e30d8);return respondWithRpcPromise(_0x9f1c('0x60'),_0x9f1c('0x69'),{'module':_0x9f1c('0x59')});}else if(_0x51d92d[_0x9f1c('0x39')]['toUpperCase']()==_0x9f1c('0x67')){var _0x2eca87=fs[_0x9f1c('0x56')](path[_0x9f1c('0x5b')](config[_0x9f1c('0x57')],_0x9f1c('0x5c')),_0x9f1c('0x5d'));var _0x12c52f=ejs[_0x9f1c('0x58')](_0x2eca87,{'networks':_0x3b3d32||[]});fs[_0x9f1c('0x5e')](_0x9f1c('0x5f'),_0x12c52f);return respondWithRpcPromise(_0x9f1c('0x60'),_0x9f1c('0x69'),{'module':_0x9f1c('0x59')});}else{var _0x3fb157=fs[_0x9f1c('0x56')](path['join'](config[_0x9f1c('0x57')],'server/files/templates/network.ejs'),_0x9f1c('0x5d'));var _0x2d1fb7=ejs['render'](_0x3fb157,{'networks':_0x3b3d32||[]});fs['writeFileSync'](util[_0x9f1c('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x5ec27f[_0x9f1c('0x54')][_0x9f1c('0x39')][_0x9f1c('0x64')]()),_0x2d1fb7);return respondWithRpcPromise(_0x9f1c('0x60'),_0x9f1c('0x69'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x53f477,null));}; \ No newline at end of file +var _0xdee8=['where','pick','filter','merge','findAll','rows','params','includeAll','options','find','sequelize','transaction','create','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','readFileSync','root','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','format','server/files/templates/turn_multiple.ejs','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','json','offset','limit','count','status','set','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort'];(function(_0x366ee5,_0x3135e9){var _0x140139=function(_0x4913ae){while(--_0x4913ae){_0x366ee5['push'](_0x366ee5['shift']());}};_0x140139(++_0x3135e9);}(_0xdee8,0x157));var _0x8dee=function(_0x4cb68b,_0x5b61ac){_0x4cb68b=_0x4cb68b-0x0;var _0x35eed8=_0xdee8[_0x4cb68b];return _0x35eed8;};'use strict';var emlformat=require(_0x8dee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8dee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8dee('0x2'));var moment=require(_0x8dee('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8dee('0x4'));var util=require(_0x8dee('0x5'));var path=require(_0x8dee('0x6'));var sox=require(_0x8dee('0x7'));var csv=require(_0x8dee('0x8'));var ejs=require(_0x8dee('0x9'));var fs=require('fs');var fs_extra=require(_0x8dee('0xa'));var _=require('lodash');var squel=require(_0x8dee('0xb'));var crypto=require(_0x8dee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8dee('0xd'));var toCsv=require(_0x8dee('0x8'));var querystring=require('querystring');var Papa=require(_0x8dee('0xe'));var Redis=require(_0x8dee('0xf'));var authService=require(_0x8dee('0x10'));var qs=require(_0x8dee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dee('0x12'));var logger=require('../../config/logger')(_0x8dee('0x13'));var utils=require(_0x8dee('0x14'));var config=require(_0x8dee('0x15'));var licenseUtil=require(_0x8dee('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x8dee('0x17')][_0x8dee('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2da074,_0x5d2736,_0x26103b,_0x59b755){return new BPromise(function(_0x18dea4,_0x594685){var _0x45e62f=_0x59b755||client;return _0x45e62f[_0x8dee('0x19')](_0x2da074,_0x26103b)[_0x8dee('0x1a')](function(_0x262135){logger[_0x8dee('0x1b')](_0x8dee('0x1c'),_0x5d2736,_0x8dee('0x1d'));logger[_0x8dee('0x1e')](_0x8dee('0x1f'),_0x5d2736,_0x8dee('0x1d'),JSON['stringify'](_0x262135));if(_0x262135[_0x8dee('0x20')]){if(_0x262135[_0x8dee('0x20')]['code']===0x1f4){logger[_0x8dee('0x20')](_0x8dee('0x1c'),_0x5d2736,_0x262135[_0x8dee('0x20')][_0x8dee('0x21')]);return _0x594685(_0x262135[_0x8dee('0x20')][_0x8dee('0x21')]);}logger[_0x8dee('0x20')]('Network,\x20%s,\x20%s',_0x5d2736,_0x262135[_0x8dee('0x20')][_0x8dee('0x21')]);return _0x18dea4(_0x262135[_0x8dee('0x20')][_0x8dee('0x21')]);}else{logger[_0x8dee('0x1b')](_0x8dee('0x1c'),_0x5d2736,'request\x20sent');_0x18dea4(_0x262135[_0x8dee('0x22')][_0x8dee('0x21')]);}})[_0x8dee('0x23')](function(_0x23b592){logger['error'](_0x8dee('0x1c'),_0x5d2736,_0x23b592);_0x594685(_0x23b592);});});}function respondWithStatusCode(_0x4efaaa,_0x33d2a4){_0x33d2a4=_0x33d2a4||0xcc;return function(_0x3b54fb){if(_0x3b54fb){return _0x4efaaa[_0x8dee('0x24')](_0x33d2a4);}return _0x4efaaa['status'](_0x33d2a4)['end']();};}function respondWithResult(_0x2f1304,_0x11bcc5){_0x11bcc5=_0x11bcc5||0xc8;return function(_0x19576f){if(_0x19576f){return _0x2f1304['status'](_0x11bcc5)[_0x8dee('0x25')](_0x19576f);}};}function respondWithFilteredResult(_0x12e897,_0x291c96){return function(_0x1b1ead){if(_0x1b1ead){var _0x1745c8=typeof _0x291c96[_0x8dee('0x26')]==='undefined'&&typeof _0x291c96[_0x8dee('0x27')]==='undefined';var _0x1f123b=_0x1b1ead[_0x8dee('0x28')];var _0xb58833=_0x1745c8?0x0:_0x291c96['offset'];var _0x147a63=_0x1745c8?_0x1b1ead[_0x8dee('0x28')]:_0x291c96[_0x8dee('0x26')]+_0x291c96[_0x8dee('0x27')];var _0x3cd836;if(_0x147a63>=_0x1f123b){_0x147a63=_0x1f123b;_0x3cd836=0xc8;}else{_0x3cd836=0xce;}_0x12e897[_0x8dee('0x29')](_0x3cd836);return _0x12e897[_0x8dee('0x2a')](_0x8dee('0x2b'),_0xb58833+'-'+_0x147a63+'/'+_0x1f123b)['json'](_0x1b1ead);}return null;};}function patchUpdates(_0x55c844){return function(_0xf5584d){try{jsonpatch[_0x8dee('0x2c')](_0xf5584d,_0x55c844,!![]);}catch(_0x1bcd7c){return BPromise['reject'](_0x1bcd7c);}return _0xf5584d[_0x8dee('0x2d')]();};}function saveUpdates(_0x10c749,_0x18b9d4){return function(_0x39be13){if(_0x39be13){return _0x39be13[_0x8dee('0x2e')](_0x10c749)['then'](function(_0x886598){return _0x886598;});}return null;};}function removeEntity(_0x26dd1a,_0x4c19b3){return function(_0x42e80d){if(_0x42e80d){return _0x42e80d[_0x8dee('0x2f')]()[_0x8dee('0x1a')](function(){_0x26dd1a[_0x8dee('0x29')](0xcc)[_0x8dee('0x30')]();});}};}function handleEntityNotFound(_0x1f99e3,_0x518a4c){return function(_0x24c3dd){if(!_0x24c3dd){_0x1f99e3[_0x8dee('0x24')](0x194);}return _0x24c3dd;};}function handleError(_0x35566e,_0x2683bc){_0x2683bc=_0x2683bc||0x1f4;return function(_0x10963c){logger[_0x8dee('0x20')](_0x10963c[_0x8dee('0x31')]);if(_0x10963c[_0x8dee('0x32')]){delete _0x10963c[_0x8dee('0x32')];}_0x35566e['status'](_0x2683bc)[_0x8dee('0x33')](_0x10963c);};}exports[_0x8dee('0x34')]=function(_0x25d324,_0xceacd3){var _0x1c553a={},_0x236581={},_0x32d9b6={'count':0x0,'rows':[]};var _0xd20d8b=_[_0x8dee('0x35')](db[_0x8dee('0x36')][_0x8dee('0x37')],function(_0x5db7d9){return{'name':_0x5db7d9[_0x8dee('0x38')],'type':_0x5db7d9[_0x8dee('0x39')][_0x8dee('0x3a')]};});_0x236581[_0x8dee('0x3b')]=_['map'](_0xd20d8b,_0x8dee('0x32'));_0x236581['query']=_[_0x8dee('0x3c')](_0x25d324[_0x8dee('0x3d')]);_0x236581[_0x8dee('0x3e')]=_[_0x8dee('0x3f')](_0x236581['model'],_0x236581['query']);_0x1c553a[_0x8dee('0x40')]=_['intersection'](_0x236581[_0x8dee('0x3b')],qs[_0x8dee('0x41')](_0x25d324['query'][_0x8dee('0x41')]));_0x1c553a[_0x8dee('0x40')]=_0x1c553a[_0x8dee('0x40')][_0x8dee('0x42')]?_0x1c553a['attributes']:_0x236581[_0x8dee('0x3b')];if(!_0x25d324['query']['hasOwnProperty']('nolimit')){_0x1c553a[_0x8dee('0x27')]=qs['limit'](_0x25d324[_0x8dee('0x3d')][_0x8dee('0x27')]);_0x1c553a[_0x8dee('0x26')]=qs[_0x8dee('0x26')](_0x25d324[_0x8dee('0x3d')][_0x8dee('0x26')]);}_0x1c553a[_0x8dee('0x43')]=qs[_0x8dee('0x44')](_0x25d324[_0x8dee('0x3d')][_0x8dee('0x44')]);_0x1c553a[_0x8dee('0x45')]=qs['filters'](_[_0x8dee('0x46')](_0x25d324['query'],_0x236581[_0x8dee('0x3e')]),_0xd20d8b);if(_0x25d324['query'][_0x8dee('0x47')]){_0x1c553a[_0x8dee('0x45')]=_[_0x8dee('0x48')](_0x1c553a[_0x8dee('0x45')],{'$or':_[_0x8dee('0x35')](_0xd20d8b,function(_0x290c94){if(_0x290c94[_0x8dee('0x39')]!=='VIRTUAL'){var _0x3cf4ce={};_0x3cf4ce[_0x290c94[_0x8dee('0x32')]]={'$like':'%'+_0x25d324[_0x8dee('0x3d')]['filter']+'%'};return _0x3cf4ce;}})});}_0x1c553a=_[_0x8dee('0x48')]({},_0x1c553a,_0x25d324['options']);var _0x114437={'where':_0x1c553a[_0x8dee('0x45')]};return db[_0x8dee('0x36')][_0x8dee('0x28')](_0x114437)['then'](function(_0xc51612){_0x32d9b6[_0x8dee('0x28')]=_0xc51612;if(_0x25d324['query']['includeAll']){_0x1c553a['include']=[{'all':!![]}];}return db[_0x8dee('0x36')][_0x8dee('0x49')](_0x1c553a);})[_0x8dee('0x1a')](function(_0x12650c){_0x32d9b6[_0x8dee('0x4a')]=_0x12650c;return _0x32d9b6;})[_0x8dee('0x1a')](respondWithFilteredResult(_0xceacd3,_0x1c553a))[_0x8dee('0x23')](handleError(_0xceacd3,null));};exports['show']=function(_0xd115de,_0x660b74){var _0x504ea3={'raw':!![],'where':{'id':_0xd115de[_0x8dee('0x4b')]['id']}},_0x4fd5e4={};_0x4fd5e4[_0x8dee('0x3b')]=_[_0x8dee('0x3c')](db[_0x8dee('0x36')][_0x8dee('0x37')]);_0x4fd5e4[_0x8dee('0x3d')]=_['keys'](_0xd115de[_0x8dee('0x3d')]);_0x4fd5e4[_0x8dee('0x3e')]=_[_0x8dee('0x3f')](_0x4fd5e4[_0x8dee('0x3b')],_0x4fd5e4[_0x8dee('0x3d')]);_0x504ea3[_0x8dee('0x40')]=_[_0x8dee('0x3f')](_0x4fd5e4['model'],qs[_0x8dee('0x41')](_0xd115de[_0x8dee('0x3d')][_0x8dee('0x41')]));_0x504ea3['attributes']=_0x504ea3['attributes'][_0x8dee('0x42')]?_0x504ea3[_0x8dee('0x40')]:_0x4fd5e4['model'];if(_0xd115de[_0x8dee('0x3d')][_0x8dee('0x4c')]){_0x504ea3['include']=[{'all':!![]}];}_0x504ea3=_[_0x8dee('0x48')]({},_0x504ea3,_0xd115de[_0x8dee('0x4d')]);return db[_0x8dee('0x36')][_0x8dee('0x4e')](_0x504ea3)[_0x8dee('0x1a')](handleEntityNotFound(_0x660b74,null))[_0x8dee('0x1a')](respondWithResult(_0x660b74,null))[_0x8dee('0x23')](handleError(_0x660b74,null));};exports['create']=function(_0x289642,_0x11bcd5,_0x56c69b){var _0x576997;return db[_0x8dee('0x4f')][_0x8dee('0x50')](function(_0x1fc627){return db[_0x8dee('0x36')][_0x8dee('0x51')](_0x289642['body'],{'raw':!![]})['then'](function(_0x8f7db2){_0x576997=_0x8f7db2;return db[_0x8dee('0x36')][_0x8dee('0x49')]({'where':{'type':_0x289642[_0x8dee('0x52')][_0x8dee('0x39')]},'raw':!![]});})[_0x8dee('0x1a')](function(_0x1bc18a){if(_0x576997[_0x8dee('0x39')][_0x8dee('0x53')]()==_0x8dee('0x54')){var _0x5361c4=fs['readFileSync'](path[_0x8dee('0x55')](config['root'],_0x8dee('0x56')),_0x8dee('0x57'));var _0x3d2ab0=ejs[_0x8dee('0x58')](_0x5361c4,{'networks':_0x1bc18a||[]});fs[_0x8dee('0x59')]('/etc/asterisk/stun_xcally.conf',_0x3d2ab0);return respondWithRpcPromise(_0x8dee('0x5a'),_0x8dee('0x51'),{'module':_0x8dee('0x5b')});}else if(_0x576997['type'][_0x8dee('0x53')]()==_0x8dee('0x5c')){var _0x15b38f=fs[_0x8dee('0x5d')](path[_0x8dee('0x55')](config[_0x8dee('0x5e')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x579f7e=ejs[_0x8dee('0x58')](_0x15b38f,{'networks':_0x1bc18a||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x579f7e);return respondWithRpcPromise('Reload',_0x8dee('0x51'),{'module':_0x8dee('0x5b')});}else{var _0x2c63a3=fs[_0x8dee('0x5d')](path[_0x8dee('0x55')](config[_0x8dee('0x5e')],_0x8dee('0x5f')),_0x8dee('0x57'));var _0x14d66b=ejs[_0x8dee('0x58')](_0x2c63a3,{'networks':_0x1bc18a||[]});fs[_0x8dee('0x59')](util['format'](_0x8dee('0x60'),_0x289642[_0x8dee('0x52')][_0x8dee('0x39')][_0x8dee('0x61')]()),_0x14d66b);return respondWithRpcPromise('Reload',_0x8dee('0x51'),{'module':_0x8dee('0x62')});}return null;})['then'](function(){return _0x576997;});})[_0x8dee('0x1a')](respondWithResult(_0x11bcd5,0xc9))['catch'](handleError(_0x11bcd5,null));};exports[_0x8dee('0x2e')]=function(_0x4d6e40,_0x362424,_0x5070b0){var _0x2b6dd7;return db[_0x8dee('0x4f')][_0x8dee('0x50')](function(_0x3a08c7){return db['Network']['find']({'where':{'id':_0x4d6e40[_0x8dee('0x4b')]['id']}})[_0x8dee('0x1a')](handleEntityNotFound(_0x362424,null))[_0x8dee('0x1a')](saveUpdates(_0x4d6e40['body'],null))[_0x8dee('0x1a')](function(_0x503787){if(_0x503787){_0x2b6dd7=_0x503787;return db[_0x8dee('0x36')][_0x8dee('0x49')]({'where':{'type':_0x2b6dd7[_0x8dee('0x39')]},'raw':!![]});}return null;})[_0x8dee('0x1a')](function(_0x462913){if(_0x2b6dd7[_0x8dee('0x39')][_0x8dee('0x53')]()==_0x8dee('0x54')){var _0x3468b1=fs['readFileSync'](path[_0x8dee('0x55')](config[_0x8dee('0x5e')],_0x8dee('0x56')),_0x8dee('0x57'));var _0x38d996=ejs[_0x8dee('0x58')](_0x3468b1,{'networks':_0x462913||[]});fs['writeFileSync'](_0x8dee('0x63'),_0x38d996);return respondWithRpcPromise(_0x8dee('0x5a'),_0x8dee('0x2e'),{'module':_0x8dee('0x5b')});}else if(_0x2b6dd7[_0x8dee('0x39')][_0x8dee('0x53')]()==_0x8dee('0x5c')){var _0x45f207=fs[_0x8dee('0x5d')](path[_0x8dee('0x55')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x8dee('0x57'));var _0x42946f=ejs[_0x8dee('0x58')](_0x45f207,{'networks':_0x462913||[]});fs[_0x8dee('0x59')](_0x8dee('0x64'),_0x42946f);return respondWithRpcPromise(_0x8dee('0x5a'),_0x8dee('0x2e'),{'module':_0x8dee('0x5b')});}else{var _0x2aeb59=fs[_0x8dee('0x5d')](path[_0x8dee('0x55')](config['root'],'server/files/templates/network.ejs'),_0x8dee('0x57'));var _0x1cac7f=ejs[_0x8dee('0x58')](_0x2aeb59,{'networks':_0x462913||[]});fs[_0x8dee('0x59')](util[_0x8dee('0x65')](_0x8dee('0x60'),_0x4d6e40[_0x8dee('0x52')][_0x8dee('0x39')][_0x8dee('0x61')]()),_0x1cac7f);return respondWithRpcPromise(_0x8dee('0x5a'),_0x8dee('0x2e'),{'module':_0x8dee('0x62')});}return null;})['then'](function(_0x25b729){if(_0x25b729){return _0x2b6dd7;}return null;});})[_0x8dee('0x1a')](respondWithResult(_0x362424,null))['catch'](handleError(_0x362424,null));};exports[_0x8dee('0x2f')]=function(_0x1dacc0,_0x337566,_0x38ff7b){var _0x309e6c;return db[_0x8dee('0x36')][_0x8dee('0x4e')]({'where':{'id':_0x1dacc0[_0x8dee('0x4b')]['id']}})[_0x8dee('0x1a')](function(_0x4c6828){_0x309e6c=_0x4c6828;return _0x4c6828;})['then'](handleEntityNotFound(_0x337566,null))[_0x8dee('0x1a')](removeEntity(_0x337566,null))['then'](function(){if(_0x309e6c){return db[_0x8dee('0x36')]['findAll']({'where':{'type':_0x309e6c[_0x8dee('0x39')]},'raw':!![]});}})[_0x8dee('0x1a')](function(_0x230e4c){if(_0x309e6c[_0x8dee('0x39')][_0x8dee('0x53')]()==_0x8dee('0x54')){var _0x2add1e=fs['readFileSync'](path[_0x8dee('0x55')](config[_0x8dee('0x5e')],_0x8dee('0x56')),'utf8');var _0xf9e8c6=ejs[_0x8dee('0x58')](_0x2add1e,{'networks':_0x230e4c||[]});fs[_0x8dee('0x59')]('/etc/asterisk/stun_xcally.conf',_0xf9e8c6);return respondWithRpcPromise(_0x8dee('0x5a'),'destroy',{'module':_0x8dee('0x5b')});}else if(_0x309e6c[_0x8dee('0x39')]['toUpperCase']()=='TURN'){var _0x563846=fs[_0x8dee('0x5d')](path[_0x8dee('0x55')](config['root'],_0x8dee('0x66')),_0x8dee('0x57'));var _0x5049d0=ejs['render'](_0x563846,{'networks':_0x230e4c||[]});fs['writeFileSync'](_0x8dee('0x64'),_0x5049d0);return respondWithRpcPromise(_0x8dee('0x5a'),_0x8dee('0x2f'),{'module':_0x8dee('0x5b')});}else{var _0x13c77c=fs['readFileSync'](path[_0x8dee('0x55')](config['root'],_0x8dee('0x5f')),_0x8dee('0x57'));var _0x5a7182=ejs[_0x8dee('0x58')](_0x13c77c,{'networks':_0x230e4c||[]});fs[_0x8dee('0x59')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1dacc0[_0x8dee('0x52')][_0x8dee('0x39')][_0x8dee('0x61')]()),_0x5a7182);return respondWithRpcPromise(_0x8dee('0x5a'),_0x8dee('0x2f'),{'module':_0x8dee('0x62')});}return null;})[_0x8dee('0x23')](handleError(_0x337566,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 82a57e1..a717d0b 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 _0x7341=['bluebird','path','rimraf','../../config/environment','./network.attributes','exports','Network','network','../../config/logger','moment'];(function(_0x3bcdd1,_0x381a91){var _0x55071d=function(_0x4c7dab){while(--_0x4c7dab){_0x3bcdd1['push'](_0x3bcdd1['shift']());}};_0x55071d(++_0x381a91);}(_0x7341,0xe4));var _0x1734=function(_0x554d55,_0x13e000){_0x554d55=_0x554d55-0x0;var _0x4e78b6=_0x7341[_0x554d55];return _0x4e78b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1734('0x0'))('api');var moment=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1734('0x3'));var rimraf=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var attributes=require(_0x1734('0x6'));module[_0x1734('0x7')]=function(_0x21efd9,_0x749d97){return _0x21efd9['define'](_0x1734('0x8'),attributes,{'tableName':_0x1734('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','../../config/logger','api'];(function(_0x2610d9,_0x1c7a39){var _0x305ace=function(_0x38f9d6){while(--_0x38f9d6){_0x2610d9['push'](_0x2610d9['shift']());}};_0x305ace(++_0x1c7a39);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'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 30589e3..0a1f96f 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0xa202a3,_0x451dfc){_0xa202a3=_0xa202a3-0x0;var _0x55b3fb=_0x7a54[_0xa202a3];return _0x55b3fb;};'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(_0x384dbe,_0x36f281){var _0x59868a=function(_0x1ee06f){while(--_0x1ee06f){_0x384dbe['push'](_0x384dbe['shift']());}};_0x59868a(++_0x36f281);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 fb8c080..a6d2854 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 _0x80bb=['getInteractions','getAgents','post','create','addAnswer','notify','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x5bec0a,_0x5bf812){var _0x2d17af=function(_0x588858){while(--_0x588858){_0x5bec0a['push'](_0x5bec0a['shift']());}};_0x2d17af(++_0x5bf812);}(_0x80bb,0x167));var _0xb80b=function(_0x16caae,_0x1461ae){_0x16caae=_0x16caae-0x0;var _0x3d2bab=_0x80bb[_0x16caae];return _0x3d2bab;};'use strict';var multer=require(_0xb80b('0x0'));var util=require('util');var path=require(_0xb80b('0x1'));var timeout=require(_0xb80b('0x2'));var express=require(_0xb80b('0x3'));var router=express[_0xb80b('0x4')]();var fs_extra=require(_0xb80b('0x5'));var auth=require(_0xb80b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb80b('0x7'));router[_0xb80b('0x8')]('/',auth[_0xb80b('0x9')](),controller['index']);router[_0xb80b('0x8')](_0xb80b('0xa'),auth[_0xb80b('0x9')](),controller[_0xb80b('0xb')]);router['get'](_0xb80b('0xc'),auth[_0xb80b('0x9')](),controller[_0xb80b('0xd')]);router[_0xb80b('0x8')](_0xb80b('0xe'),auth[_0xb80b('0x9')](),controller[_0xb80b('0xf')]);router[_0xb80b('0x8')](_0xb80b('0x10'),auth['isAuthenticated'](),controller[_0xb80b('0x11')]);router[_0xb80b('0x8')](_0xb80b('0x12'),auth[_0xb80b('0x9')](),controller[_0xb80b('0x13')]);router['get'](_0xb80b('0x14'),auth[_0xb80b('0x9')](),controller[_0xb80b('0x15')]);router['get']('/:id/users',auth[_0xb80b('0x9')](),controller[_0xb80b('0x16')]);router[_0xb80b('0x17')]('/',auth[_0xb80b('0x9')](),controller[_0xb80b('0x18')]);router[_0xb80b('0x17')]('/:id/dispositions',auth[_0xb80b('0x9')](),controller['addDisposition']);router[_0xb80b('0x17')](_0xb80b('0x10'),auth[_0xb80b('0x9')](),controller[_0xb80b('0x19')]);router['post']('/:id/notify',controller[_0xb80b('0x1a')]);router[_0xb80b('0x17')](_0xb80b('0x12'),auth[_0xb80b('0x9')](),controller['addApplications']);router[_0xb80b('0x17')](_0xb80b('0x1b'),auth[_0xb80b('0x9')](),controller[_0xb80b('0x1c')]);router['post'](_0xb80b('0x1d'),auth[_0xb80b('0x9')](),controller[_0xb80b('0x1e')]);router[_0xb80b('0x1f')]('/:id',auth[_0xb80b('0x9')](),controller[_0xb80b('0x20')]);router[_0xb80b('0x21')](_0xb80b('0xc'),auth['isAuthenticated'](),controller[_0xb80b('0x22')]);router['delete'](_0xb80b('0xe'),auth[_0xb80b('0x9')](),controller[_0xb80b('0x23')]);router['delete']('/:id/canned_answers',auth[_0xb80b('0x9')](),controller[_0xb80b('0x24')]);router[_0xb80b('0x21')]('/:id/users',auth['isAuthenticated'](),controller[_0xb80b('0x25')]);module['exports']=router; \ No newline at end of file +var _0x3a07=['isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','/:id/interactions','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x2f7749,_0x2e5f9a){var _0x56bed8=function(_0x5e735f){while(--_0x5e735f){_0x2f7749['push'](_0x2f7749['shift']());}};_0x56bed8(++_0x2e5f9a);}(_0x3a07,0x1e5));var _0x73a0=function(_0x134d50,_0x3aa840){_0x134d50=_0x134d50-0x0;var _0x47f606=_0x3a07[_0x134d50];return _0x47f606;};'use strict';var multer=require(_0x73a0('0x0'));var util=require('util');var path=require(_0x73a0('0x1'));var timeout=require(_0x73a0('0x2'));var express=require(_0x73a0('0x3'));var router=express[_0x73a0('0x4')]();var fs_extra=require(_0x73a0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73a0('0x6'));var config=require(_0x73a0('0x7'));var controller=require('./openchannelAccount.controller');router[_0x73a0('0x8')]('/',auth[_0x73a0('0x9')](),controller[_0x73a0('0xa')]);router[_0x73a0('0x8')](_0x73a0('0xb'),auth[_0x73a0('0x9')](),controller[_0x73a0('0xc')]);router[_0x73a0('0x8')](_0x73a0('0xd'),auth[_0x73a0('0x9')](),controller[_0x73a0('0xe')]);router[_0x73a0('0x8')](_0x73a0('0xf'),auth[_0x73a0('0x9')](),controller[_0x73a0('0x10')]);router['get']('/:id/canned_answers',auth[_0x73a0('0x9')](),controller[_0x73a0('0x11')]);router[_0x73a0('0x8')](_0x73a0('0x12'),auth[_0x73a0('0x9')](),controller['getApplications']);router[_0x73a0('0x8')](_0x73a0('0x13'),auth[_0x73a0('0x9')](),controller['getInteractions']);router[_0x73a0('0x8')]('/:id/users',auth[_0x73a0('0x9')](),controller[_0x73a0('0x14')]);router[_0x73a0('0x15')]('/',auth[_0x73a0('0x9')](),controller[_0x73a0('0x16')]);router[_0x73a0('0x15')](_0x73a0('0xf'),auth[_0x73a0('0x9')](),controller[_0x73a0('0x17')]);router[_0x73a0('0x15')](_0x73a0('0x18'),auth[_0x73a0('0x9')](),controller[_0x73a0('0x19')]);router['post'](_0x73a0('0x1a'),controller[_0x73a0('0x1b')]);router['post'](_0x73a0('0x12'),auth['isAuthenticated'](),controller[_0x73a0('0x1c')]);router['post'](_0x73a0('0x1d'),auth[_0x73a0('0x9')](),controller[_0x73a0('0x1e')]);router[_0x73a0('0x15')]('/:id/send',auth[_0x73a0('0x9')](),controller['send']);router[_0x73a0('0x1f')](_0x73a0('0xd'),auth[_0x73a0('0x9')](),controller[_0x73a0('0x20')]);router['delete'](_0x73a0('0xd'),auth[_0x73a0('0x9')](),controller[_0x73a0('0x21')]);router[_0x73a0('0x22')](_0x73a0('0xf'),auth[_0x73a0('0x9')](),controller[_0x73a0('0x23')]);router[_0x73a0('0x22')](_0x73a0('0x18'),auth[_0x73a0('0x9')](),controller[_0x73a0('0x24')]);router[_0x73a0('0x22')]('/:id/users',auth[_0x73a0('0x9')](),controller['removeAgents']);module[_0x73a0('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4b6d531..d2f8c0d 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 _0x8859=['name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x5e52cd,_0xb33897){var _0x5e367c=function(_0x25f65b){while(--_0x25f65b){_0x5e52cd['push'](_0x5e52cd['shift']());}};_0x5e367c(++_0xb33897);}(_0x8859,0x73));var _0x9885=function(_0x2f4226,_0x4719be){_0x2f4226=_0x2f4226-0x0;var _0x557c45=_0x8859[_0x2f4226];return _0x557c45;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9885('0x0'));module[_0x9885('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9885('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9885('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9885('0x4')]();}},'replyUri':{'type':Sequelize[_0x9885('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9885('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9885('0x5')],'defaultValue':function(){return _0x9885('0x6');}},'notificationSound':{'type':Sequelize[_0x9885('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9885('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9885('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9885('0x3')]},'queueTransfer':{'type':Sequelize[_0x9885('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9885('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9885('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x9885('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4e0125){if(!_0x4e0125)this[_0x9885('0xa')](_0x9885('0xb'),null);this[_0x9885('0xa')](_0x9885('0xc'),_0x4e0125);}}}; \ No newline at end of file +var _0x3edc=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x5e172a,_0x240392){var _0x4d43e1=function(_0x4317ea){while(--_0x4317ea){_0x5e172a['push'](_0x5e172a['shift']());}};_0x4d43e1(++_0x240392);}(_0x3edc,0x16c));var _0xc3ed=function(_0x45f2fe,_0x3534e0){_0x45f2fe=_0x45f2fe-0x0;var _0x511a6d=_0x3edc[_0x45f2fe];return _0x511a6d;};'use strict';var Sequelize=require(_0xc3ed('0x0'));var rs=require(_0xc3ed('0x1'));module[_0xc3ed('0x2')]={'name':{'type':Sequelize[_0xc3ed('0x3')],'unique':_0xc3ed('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xc3ed('0x3')]},'token':{'type':Sequelize[_0xc3ed('0x3')],'defaultValue':function(){return rs[_0xc3ed('0x5')]();}},'replyUri':{'type':Sequelize[_0xc3ed('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc3ed('0x6')],'defaultValue':function(){return _0xc3ed('0x7');}},'notificationSound':{'type':Sequelize[_0xc3ed('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc3ed('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc3ed('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc3ed('0x3')]},'queueTransfer':{'type':Sequelize[_0xc3ed('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc3ed('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc3ed('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc3ed('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xc3ed('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xc3ed('0x8')],'defaultValue':![],'comment':_0xc3ed('0xb'),'set':function(_0x222231){if(!_0x222231)this[_0xc3ed('0xc')](_0xc3ed('0xd'),null);this[_0xc3ed('0xc')](_0xc3ed('0xe'),_0x222231);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index dea7047..a1e9e7a 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 _0xe34e=['../../mysqldb','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','find','OpenchannelAccountId','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','Applications','List','applications','list','orderBy','priority','asc','account','defaults','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','update','interaction','created','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','addApplications','sequelize','transaction','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','DESC','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x37b351,_0x18f664){var _0x56bfef=function(_0x48e19d){while(--_0x48e19d){_0x37b351['push'](_0x37b351['shift']());}};_0x56bfef(++_0x18f664);}(_0xe34e,0xa9));var _0xee34=function(_0x40ef00,_0x3ac5a0){_0x40ef00=_0x40ef00-0x0;var _0x35b5be=_0xe34e[_0x40ef00];return _0x35b5be;};'use strict';var emlformat=require(_0xee34('0x0'));var rimraf=require(_0xee34('0x1'));var zipdir=require(_0xee34('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee34('0x3'));var moment=require(_0xee34('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee34('0x5'));var util=require('util');var path=require(_0xee34('0x6'));var sox=require(_0xee34('0x7'));var csv=require('to-csv');var ejs=require(_0xee34('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee34('0x9'));var squel=require(_0xee34('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xee34('0xb'));var querystring=require(_0xee34('0xc'));var Papa=require(_0xee34('0xd'));var Redis=require(_0xee34('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xee34('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee34('0x10'));var logger=require(_0xee34('0x11'))(_0xee34('0x12'));var utils=require(_0xee34('0x13'));var config=require(_0xee34('0x14'));var licenseUtil=require(_0xee34('0x15'));var db=require(_0xee34('0x16'))['db'];config[_0xee34('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xee34('0x18'))(new Redis(config[_0xee34('0x17')]));require(_0xee34('0x19'))[_0xee34('0x1a')](socket);var jayson=require(_0xee34('0x1b'));var client=jayson[_0xee34('0x1c')][_0xee34('0x1d')]({'port':0x232c});var client9002=jayson[_0xee34('0x1c')][_0xee34('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x165863,_0x34051d,_0x1ccfa4,_0x56f04c){return new BPromise(function(_0x57f7c1,_0x19340d){var _0x47f5d5=_0x56f04c||client;return _0x47f5d5[_0xee34('0x1e')](_0x165863,_0x1ccfa4)[_0xee34('0x1f')](function(_0x265285){logger[_0xee34('0x20')](_0xee34('0x21'),_0x34051d,'request\x20sent');logger['debug'](_0xee34('0x22'),_0x34051d,_0xee34('0x23'),JSON['stringify'](_0x265285));if(_0x265285[_0xee34('0x24')]){if(_0x265285[_0xee34('0x24')][_0xee34('0x25')]===0x1f4){logger[_0xee34('0x24')](_0xee34('0x21'),_0x34051d,_0x265285['error'][_0xee34('0x26')]);return _0x19340d(_0x265285[_0xee34('0x24')][_0xee34('0x26')]);}logger[_0xee34('0x24')](_0xee34('0x21'),_0x34051d,_0x265285[_0xee34('0x24')][_0xee34('0x26')]);return _0x57f7c1(_0x265285['error'][_0xee34('0x26')]);}else{logger[_0xee34('0x20')](_0xee34('0x21'),_0x34051d,_0xee34('0x23'));_0x57f7c1(_0x265285[_0xee34('0x27')][_0xee34('0x26')]);}})[_0xee34('0x28')](function(_0x404833){logger[_0xee34('0x24')](_0xee34('0x21'),_0x34051d,_0x404833);_0x19340d(_0x404833);});});}function respondWithStatusCode(_0x5a6eeb,_0x256c26){_0x256c26=_0x256c26||0xcc;return function(_0x379304){if(_0x379304){return _0x5a6eeb[_0xee34('0x29')](_0x256c26);}return _0x5a6eeb[_0xee34('0x2a')](_0x256c26)[_0xee34('0x2b')]();};}function respondWithResult(_0x2c7f9d,_0x1f7f79){_0x1f7f79=_0x1f7f79||0xc8;return function(_0xfd53d9){if(_0xfd53d9){return _0x2c7f9d['status'](_0x1f7f79)[_0xee34('0x2c')](_0xfd53d9);}};}function respondWithFilteredResult(_0x5d20b7,_0x8d3432){return function(_0x59a623){if(_0x59a623){var _0x1288ec=typeof _0x8d3432[_0xee34('0x2d')]===_0xee34('0x2e')&&typeof _0x8d3432['limit']===_0xee34('0x2e');var _0x137892=_0x59a623[_0xee34('0x2f')];var _0x2d73e1=_0x1288ec?0x0:_0x8d3432[_0xee34('0x2d')];var _0x48d33d=_0x1288ec?_0x59a623[_0xee34('0x2f')]:_0x8d3432[_0xee34('0x2d')]+_0x8d3432[_0xee34('0x30')];var _0x593922;if(_0x48d33d>=_0x137892){_0x48d33d=_0x137892;_0x593922=0xc8;}else{_0x593922=0xce;}_0x5d20b7[_0xee34('0x2a')](_0x593922);return _0x5d20b7[_0xee34('0x31')](_0xee34('0x32'),_0x2d73e1+'-'+_0x48d33d+'/'+_0x137892)['json'](_0x59a623);}return null;};}function patchUpdates(_0x41a13b){return function(_0x21e4f5){try{jsonpatch['apply'](_0x21e4f5,_0x41a13b,!![]);}catch(_0x40b7b4){return BPromise[_0xee34('0x33')](_0x40b7b4);}return _0x21e4f5[_0xee34('0x34')]();};}function saveUpdates(_0x4ad43a,_0x2534c3){return function(_0x590356){if(_0x590356){return _0x590356['update'](_0x4ad43a)[_0xee34('0x1f')](function(_0x98959){return _0x98959;});}return null;};}function removeEntity(_0x42633d,_0x500c10){return function(_0x56cb98){if(_0x56cb98){return _0x56cb98[_0xee34('0x35')]()[_0xee34('0x1f')](function(){var _0x99e7e6=_0x56cb98[_0xee34('0x36')]({'plain':!![]});var _0x290653=_0xee34('0x37');return db[_0xee34('0x38')][_0xee34('0x35')]({'where':{'type':_0x290653,'resourceId':_0x99e7e6['id']}})[_0xee34('0x1f')](function(){return _0x56cb98;});})[_0xee34('0x1f')](function(){_0x42633d[_0xee34('0x2a')](0xcc)[_0xee34('0x2b')]();});}};}function handleEntityNotFound(_0x403a68,_0x1124cc){return function(_0x3b02e4){if(!_0x3b02e4){_0x403a68[_0xee34('0x29')](0x194);}return _0x3b02e4;};}function handleError(_0x4e30e0,_0x393699){_0x393699=_0x393699||0x1f4;return function(_0x260b32){logger[_0xee34('0x24')](_0x260b32['stack']);if(_0x260b32[_0xee34('0x39')]){delete _0x260b32[_0xee34('0x39')];}_0x4e30e0[_0xee34('0x2a')](_0x393699)[_0xee34('0x3a')](_0x260b32);};}exports[_0xee34('0x3b')]=function(_0x131ca2,_0x369ed5){var _0x504d1c={'include':[{'model':db['Pause'],'as':_0xee34('0x3c')}]},_0xd61015={},_0x3b9c80={'count':0x0,'rows':[]};var _0xc932dd=_[_0xee34('0x3d')](db[_0xee34('0x3e')][_0xee34('0x3f')],function(_0x3f5c8a){return{'name':_0x3f5c8a[_0xee34('0x40')],'type':_0x3f5c8a[_0xee34('0x41')][_0xee34('0x42')]};});_0xd61015[_0xee34('0x43')]=_[_0xee34('0x3d')](_0xc932dd,_0xee34('0x39'));_0xd61015[_0xee34('0x44')]=_[_0xee34('0x45')](_0x131ca2['query']);_0xd61015[_0xee34('0x46')]=_[_0xee34('0x47')](_0xd61015['model'],_0xd61015['query']);_0x504d1c[_0xee34('0x48')]=_['intersection'](_0xd61015[_0xee34('0x43')],qs[_0xee34('0x49')](_0x131ca2[_0xee34('0x44')][_0xee34('0x49')]));_0x504d1c[_0xee34('0x48')]=_0x504d1c['attributes'][_0xee34('0x4a')]?_0x504d1c[_0xee34('0x48')]:_0xd61015[_0xee34('0x43')];if(!_0x131ca2[_0xee34('0x44')][_0xee34('0x4b')](_0xee34('0x4c'))){_0x504d1c[_0xee34('0x30')]=qs[_0xee34('0x30')](_0x131ca2[_0xee34('0x44')]['limit']);_0x504d1c[_0xee34('0x2d')]=qs['offset'](_0x131ca2[_0xee34('0x44')]['offset']);}_0x504d1c['order']=qs[_0xee34('0x4d')](_0x131ca2[_0xee34('0x44')]['sort']);_0x504d1c['where']=qs[_0xee34('0x46')](_[_0xee34('0x4e')](_0x131ca2[_0xee34('0x44')],_0xd61015['filters']),_0xc932dd);if(_0x131ca2[_0xee34('0x44')][_0xee34('0x4f')]){_0x504d1c[_0xee34('0x50')]=_[_0xee34('0x51')](_0x504d1c[_0xee34('0x50')],{'$or':_[_0xee34('0x3d')](_0xc932dd,function(_0x3d18d8){if(_0x3d18d8[_0xee34('0x41')]!==_0xee34('0x52')){var _0x5a52e2={};_0x5a52e2[_0x3d18d8[_0xee34('0x39')]]={'$like':'%'+_0x131ca2[_0xee34('0x44')][_0xee34('0x4f')]+'%'};return _0x5a52e2;}})});}_0x504d1c=_[_0xee34('0x51')]({},_0x504d1c,_0x131ca2['options']);var _0x4ecbe9={'where':_0x504d1c[_0xee34('0x50')]};return db[_0xee34('0x3e')]['count'](_0x4ecbe9)[_0xee34('0x1f')](function(_0x472518){_0x3b9c80[_0xee34('0x2f')]=_0x472518;if(_0x131ca2[_0xee34('0x44')][_0xee34('0x53')]){_0x504d1c[_0xee34('0x54')]=[{'all':!![]}];}return db[_0xee34('0x3e')][_0xee34('0x55')](_0x504d1c);})[_0xee34('0x1f')](function(_0x4b15b4){_0x3b9c80[_0xee34('0x56')]=_0x4b15b4;return _0x3b9c80;})['then'](respondWithFilteredResult(_0x369ed5,_0x504d1c))[_0xee34('0x28')](handleError(_0x369ed5,null));};exports['show']=function(_0x472b69,_0x5b0005){var _0x5af869={'raw':![],'where':{'id':_0x472b69[_0xee34('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xee34('0x3c')}]},_0x562d26={};_0x562d26[_0xee34('0x43')]=_[_0xee34('0x45')](db[_0xee34('0x3e')][_0xee34('0x3f')]);_0x562d26[_0xee34('0x44')]=_[_0xee34('0x45')](_0x472b69[_0xee34('0x44')]);_0x562d26['filters']=_[_0xee34('0x47')](_0x562d26[_0xee34('0x43')],_0x562d26[_0xee34('0x44')]);_0x5af869[_0xee34('0x48')]=_[_0xee34('0x47')](_0x562d26[_0xee34('0x43')],qs[_0xee34('0x49')](_0x472b69[_0xee34('0x44')]['fields']));_0x5af869[_0xee34('0x48')]=_0x5af869['attributes'][_0xee34('0x4a')]?_0x5af869[_0xee34('0x48')]:_0x562d26[_0xee34('0x43')];if(_0x472b69['query'][_0xee34('0x53')]){_0x5af869[_0xee34('0x54')]=[{'all':!![]}];}_0x5af869=_[_0xee34('0x51')]({},_0x5af869,_0x472b69[_0xee34('0x58')]);return db[_0xee34('0x3e')]['find'](_0x5af869)[_0xee34('0x1f')](handleEntityNotFound(_0x5b0005,null))[_0xee34('0x1f')](respondWithResult(_0x5b0005,null))['catch'](handleError(_0x5b0005,null));};exports[_0xee34('0x59')]=function(_0x4d0633,_0x4936c1){return db['OpenchannelAccount']['create'](_0x4d0633[_0xee34('0x5a')],{})[_0xee34('0x1f')](function(_0x55ea78){var _0x487184=_0x4d0633[_0xee34('0x5b')][_0xee34('0x36')]({'plain':!![]});if(!_0x487184)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x487184[_0xee34('0x5c')]===_0xee34('0x5b')){var _0x2a28b1=_0x55ea78[_0xee34('0x36')]({'plain':!![]});var _0x272d40=_0xee34('0x37');return db['UserProfileSection']['find']({'where':{'name':_0x272d40,'userProfileId':_0x487184[_0xee34('0x5d')]},'raw':!![]})['then'](function(_0x5cd52f){if(_0x5cd52f&&_0x5cd52f[_0xee34('0x5e')]===0x0){return db[_0xee34('0x38')][_0xee34('0x59')]({'name':_0x2a28b1['name'],'resourceId':_0x2a28b1['id'],'type':_0x5cd52f[_0xee34('0x39')],'sectionId':_0x5cd52f['id']},{})[_0xee34('0x1f')](function(){return _0x55ea78;});}else{return _0x55ea78;}})[_0xee34('0x28')](function(_0x5768b8){logger['error'](_0xee34('0x5f'),_0x5768b8);throw _0x5768b8;});}return _0x55ea78;})['then'](respondWithResult(_0x4936c1,0xc9))[_0xee34('0x28')](handleError(_0x4936c1,null));};exports['update']=function(_0x1a9a5d,_0x26f5b1){if(_0x1a9a5d[_0xee34('0x5a')]['id']){delete _0x1a9a5d[_0xee34('0x5a')]['id'];}return db[_0xee34('0x3e')]['find']({'where':{'id':_0x1a9a5d[_0xee34('0x57')]['id']},'include':[{'model':db[_0xee34('0x60')],'as':_0xee34('0x3c')}]})[_0xee34('0x1f')](handleEntityNotFound(_0x26f5b1,null))[_0xee34('0x1f')](saveUpdates(_0x1a9a5d[_0xee34('0x5a')],null))['then'](respondWithResult(_0x26f5b1,null))['catch'](handleError(_0x26f5b1,null));};exports[_0xee34('0x35')]=function(_0x57b158,_0x6e2123){return db[_0xee34('0x3e')]['find']({'where':{'id':_0x57b158[_0xee34('0x57')]['id']}})['then'](handleEntityNotFound(_0x6e2123,null))['then'](removeEntity(_0x6e2123,null))[_0xee34('0x28')](handleError(_0x6e2123,null));};exports[_0xee34('0x61')]=function(_0x47af4b,_0xb9b437){return db[_0xee34('0x3e')][_0xee34('0x61')]()[_0xee34('0x1f')](respondWithResult(_0xb9b437,null))[_0xee34('0x28')](handleError(_0xb9b437,null));};exports[_0xee34('0x62')]=function(_0x3555d2,_0x30b094,_0x38e4d0){if(_0x3555d2[_0xee34('0x5a')]['id']){delete _0x3555d2[_0xee34('0x5a')]['id'];}return db[_0xee34('0x3e')][_0xee34('0x63')]({'where':{'id':_0x3555d2[_0xee34('0x57')]['id']}})['then'](handleEntityNotFound(_0x30b094,null))[_0xee34('0x1f')](function(_0x40eab1){if(_0x40eab1){_0x3555d2[_0xee34('0x5a')][_0xee34('0x64')]=_0x40eab1['id'];return db[_0xee34('0x65')][_0xee34('0x59')](_0x3555d2[_0xee34('0x5a')]);}})[_0xee34('0x1f')](respondWithResult(_0x30b094,null))[_0xee34('0x28')](handleError(_0x30b094,null));};exports[_0xee34('0x66')]=function(_0x841ddb,_0x206942,_0xdc2dd3){var _0x56b7a2={'raw':![],'where':{}};var _0x566593={};var _0x535904={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xee34('0x67')]({'where':{'id':_0x841ddb['params']['id']}})[_0xee34('0x1f')](handleEntityNotFound(_0x206942,null))[_0xee34('0x1f')](function(_0x576ec2){if(_0x576ec2){_0x566593[_0xee34('0x43')]=_['keys'](db[_0xee34('0x65')]['rawAttributes']);_0x566593[_0xee34('0x44')]=_['keys'](_0x841ddb[_0xee34('0x44')]);_0x566593['filters']=_['intersection'](_0x566593[_0xee34('0x43')],_0x566593[_0xee34('0x44')]);_0x56b7a2['attributes']=_[_0xee34('0x47')](_0x566593[_0xee34('0x43')],qs[_0xee34('0x49')](_0x841ddb[_0xee34('0x44')]['fields']));_0x56b7a2['attributes']=_0x56b7a2['attributes']['length']?_0x56b7a2[_0xee34('0x48')]:_0x566593['model'];if(!_0x841ddb[_0xee34('0x44')][_0xee34('0x4b')](_0xee34('0x4c'))){_0x56b7a2[_0xee34('0x30')]=qs[_0xee34('0x30')](_0x841ddb[_0xee34('0x44')][_0xee34('0x30')]);_0x56b7a2['offset']=qs[_0xee34('0x2d')](_0x841ddb['query']['offset']);}_0x56b7a2[_0xee34('0x68')]=qs[_0xee34('0x4d')](_0x841ddb[_0xee34('0x44')][_0xee34('0x4d')]);_0x56b7a2[_0xee34('0x50')]=qs['filters'](_['pick'](_0x841ddb['query'],_0x566593[_0xee34('0x46')]));_0x56b7a2[_0xee34('0x50')][_0xee34('0x64')]=_0x576ec2['id'];if(_0x841ddb[_0xee34('0x44')][_0xee34('0x4f')]){_0x56b7a2[_0xee34('0x50')]=_[_0xee34('0x51')](_0x56b7a2['where'],{'$or':_[_0xee34('0x3d')](_0x56b7a2[_0xee34('0x48')],function(_0x5e58e6){var _0x178398={};_0x178398[_0x5e58e6]={'$like':'%'+_0x841ddb[_0xee34('0x44')]['filter']+'%'};return _0x178398;})});}_0x56b7a2=_[_0xee34('0x51')]({},_0x56b7a2,_0x841ddb[_0xee34('0x58')]);return db[_0xee34('0x65')]['count']({'where':_0x56b7a2[_0xee34('0x50')]})[_0xee34('0x1f')](function(_0x154a20){_0x535904['count']=_0x154a20;if(_0x841ddb[_0xee34('0x44')][_0xee34('0x53')]){_0x56b7a2[_0xee34('0x54')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x56b7a2);})[_0xee34('0x1f')](function(_0x235174){_0x535904[_0xee34('0x56')]=_0x235174;return _0x535904;});}})[_0xee34('0x1f')](respondWithFilteredResult(_0x206942,_0x56b7a2))[_0xee34('0x28')](handleError(_0x206942,null));};exports[_0xee34('0x69')]=function(_0x24c995,_0x4ce32f,_0x4024f2){return db[_0xee34('0x3e')][_0xee34('0x63')]({'where':{'id':_0x24c995[_0xee34('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ce32f,null))[_0xee34('0x1f')](function(_0x2fc558){if(_0x2fc558){return _0x2fc558['removeDispositions'](_0x24c995[_0xee34('0x44')]['ids']);}})[_0xee34('0x1f')](respondWithStatusCode(_0x4ce32f,null))[_0xee34('0x28')](handleError(_0x4ce32f,null));};exports[_0xee34('0x6a')]=function(_0x46a4e4,_0x329c96,_0xe98690){if(_0x46a4e4[_0xee34('0x5a')]['id']){delete _0x46a4e4['body']['id'];}return db['OpenchannelAccount'][_0xee34('0x63')]({'where':{'id':_0x46a4e4['params']['id']}})[_0xee34('0x1f')](handleEntityNotFound(_0x329c96,null))[_0xee34('0x1f')](function(_0x99a454){if(_0x99a454){_0x46a4e4[_0xee34('0x5a')][_0xee34('0x64')]=_0x99a454['id'];return db[_0xee34('0x6b')][_0xee34('0x59')](_0x46a4e4[_0xee34('0x5a')]);}})[_0xee34('0x1f')](respondWithResult(_0x329c96,null))[_0xee34('0x28')](handleError(_0x329c96,null));};exports[_0xee34('0x6c')]=function(_0x32283f,_0x2494d5,_0x1822a5){var _0x144b9d={'raw':![],'where':{}};var _0x3a7c7f={};var _0x593904={'count':0x0,'rows':[]};return db[_0xee34('0x3e')][_0xee34('0x67')]({'where':{'id':_0x32283f['params']['id']}})[_0xee34('0x1f')](handleEntityNotFound(_0x2494d5,null))['then'](function(_0x33f7f0){if(_0x33f7f0){_0x3a7c7f['model']=_['keys'](db[_0xee34('0x6b')][_0xee34('0x3f')]);_0x3a7c7f[_0xee34('0x44')]=_[_0xee34('0x45')](_0x32283f[_0xee34('0x44')]);_0x3a7c7f[_0xee34('0x46')]=_[_0xee34('0x47')](_0x3a7c7f[_0xee34('0x43')],_0x3a7c7f['query']);_0x144b9d['attributes']=_['intersection'](_0x3a7c7f[_0xee34('0x43')],qs[_0xee34('0x49')](_0x32283f[_0xee34('0x44')][_0xee34('0x49')]));_0x144b9d[_0xee34('0x48')]=_0x144b9d[_0xee34('0x48')][_0xee34('0x4a')]?_0x144b9d[_0xee34('0x48')]:_0x3a7c7f[_0xee34('0x43')];if(!_0x32283f[_0xee34('0x44')][_0xee34('0x4b')](_0xee34('0x4c'))){_0x144b9d[_0xee34('0x30')]=qs[_0xee34('0x30')](_0x32283f[_0xee34('0x44')][_0xee34('0x30')]);_0x144b9d[_0xee34('0x2d')]=qs[_0xee34('0x2d')](_0x32283f[_0xee34('0x44')]['offset']);}_0x144b9d[_0xee34('0x68')]=qs[_0xee34('0x4d')](_0x32283f[_0xee34('0x44')]['sort']);_0x144b9d['where']=qs[_0xee34('0x46')](_[_0xee34('0x4e')](_0x32283f[_0xee34('0x44')],_0x3a7c7f[_0xee34('0x46')]));_0x144b9d[_0xee34('0x50')][_0xee34('0x64')]=_0x33f7f0['id'];if(_0x32283f[_0xee34('0x44')][_0xee34('0x4f')]){_0x144b9d[_0xee34('0x50')]=_[_0xee34('0x51')](_0x144b9d[_0xee34('0x50')],{'$or':_[_0xee34('0x3d')](_0x144b9d[_0xee34('0x48')],function(_0x4de003){var _0x1df49a={};_0x1df49a[_0x4de003]={'$like':'%'+_0x32283f[_0xee34('0x44')][_0xee34('0x4f')]+'%'};return _0x1df49a;})});}_0x144b9d=_[_0xee34('0x51')]({},_0x144b9d,_0x32283f[_0xee34('0x58')]);return db[_0xee34('0x6b')][_0xee34('0x2f')]({'where':_0x144b9d[_0xee34('0x50')]})[_0xee34('0x1f')](function(_0x108a53){_0x593904[_0xee34('0x2f')]=_0x108a53;if(_0x32283f['query']['includeAll']){_0x144b9d['include']=[{'all':!![]}];}return db[_0xee34('0x6b')][_0xee34('0x55')](_0x144b9d);})[_0xee34('0x1f')](function(_0x354edf){_0x593904[_0xee34('0x56')]=_0x354edf;return _0x593904;});}})['then'](respondWithFilteredResult(_0x2494d5,_0x144b9d))[_0xee34('0x28')](handleError(_0x2494d5,null));};exports[_0xee34('0x6d')]=function(_0x25a01d,_0x304b29,_0x4337ab){return db[_0xee34('0x3e')][_0xee34('0x63')]({'where':{'id':_0x25a01d[_0xee34('0x57')]['id']}})[_0xee34('0x1f')](handleEntityNotFound(_0x304b29,null))[_0xee34('0x1f')](function(_0xb18a34){if(_0xb18a34){return _0xb18a34['removeAnswers'](_0x25a01d[_0xee34('0x44')][_0xee34('0x6e')]);}})[_0xee34('0x1f')](respondWithStatusCode(_0x304b29,null))['catch'](handleError(_0x304b29,null));};exports[_0xee34('0x6f')]=function(_0x1a9eb0,_0x2dbc7e,_0x1e73ac){var _0x49c971={'body':_0x1a9eb0['body'],'channel':_0xee34('0x70')};var _0x41f2e1=[];var _0x1404dc=[];var _0x2a3a5e={};var _0x2fade0=![];return db['CmContact'][_0xee34('0x61')]()[_0xee34('0x1f')](function(_0x328591){if(!_0x328591){throw new db[(_0xee34('0x71'))][(_0xee34('0x72'))]('no\x20available\x20attributes');}_0x41f2e1=_[_0xee34('0x73')](_['keys'](_0x328591),[_0xee34('0x74'),_0xee34('0x75')]);_0x1404dc=_[_0xee34('0x73')](_[_0xee34('0x45')](_0x328591),[_0xee34('0x74'),_0xee34('0x75'),_0xee34('0x76'),_0xee34('0x77')]);if(_0x1a9eb0[_0xee34('0x5a')]['id']){delete _0x1a9eb0['body']['id'];}if(_['isNil'](_0x1a9eb0['body'][_0xee34('0x78')])){throw new db[(_0xee34('0x71'))][(_0xee34('0x72'))](_0xee34('0x79'));}if(_[_0xee34('0x7a')](_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x5a')])||_0x1a9eb0['body'][_0xee34('0x5a')]===''){throw new db[(_0xee34('0x71'))][(_0xee34('0x72'))](_0xee34('0x7b'));}if(_[_0xee34('0x7a')](_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x7c')])){throw new db[(_0xee34('0x71'))]['ValidationError'](_0xee34('0x7d')+_0x1404dc);}if(!_['includes'](_0x1404dc,_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x7c')])){throw new db[(_0xee34('0x71'))][(_0xee34('0x72'))](_0xee34('0x7e')+_0x1404dc);}_0x2a3a5e[_0x1a9eb0['body'][_0xee34('0x7c')]]=_0x1a9eb0[_0xee34('0x5a')]['from'];})[_0xee34('0x1f')](function(){return db[_0xee34('0x3e')][_0xee34('0x63')]({'where':{'id':_0x1a9eb0[_0xee34('0x57')]['id']},'include':[{'model':db[_0xee34('0x7f')],'as':'List','include':[{'model':db['CmContact'],'as':_0xee34('0x80'),'where':_0x2a3a5e,'limit':0x1,'order':[[_0xee34('0x75'),'DESC']]}]},{'model':db[_0xee34('0x81')],'as':_0xee34('0x82')}]});})[_0xee34('0x1f')](handleEntityNotFound(_0x2dbc7e,null))[_0xee34('0x1f')](function(_0x5a9f73){if(_0x5a9f73&&_0x5a9f73[_0xee34('0x83')]){_0x49c971['account']=_0x5a9f73;_0x49c971[_0xee34('0x84')]=_0x5a9f73['Applications'];_0x49c971[_0xee34('0x85')]=_0x5a9f73[_0xee34('0x83')];_0x49c971[_0xee34('0x84')]=_[_0xee34('0x86')](_0x49c971[_0xee34('0x84')],[_0xee34('0x87')],[_0xee34('0x88')]);if(_0x49c971[_0xee34('0x89')][_0xee34('0x82')]){delete _0x49c971['account'][_0xee34('0x82')];}if(_0x49c971[_0xee34('0x89')][_0xee34('0x83')]&&_0x49c971['account'][_0xee34('0x83')][_0xee34('0x80')][_0xee34('0x4a')]){return _0x49c971[_0xee34('0x89')][_0xee34('0x83')][_0xee34('0x80')][0x0];}var _0x2f01d6=_[_0xee34('0x8a')](_0x1a9eb0['body'],{'firstName':_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x78')],'ListId':_0x5a9f73['ListId']});_0x2f01d6[_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x7c')]]=_0x1a9eb0[_0xee34('0x5a')]['from'];return db[_0xee34('0x8b')]['create'](_0x2f01d6,{'fields':_0x41f2e1,'raw':!![]});}})[_0xee34('0x1f')](handleEntityNotFound(_0x2dbc7e,null))[_0xee34('0x1f')](function(_0x46ca2b){_0x49c971[_0xee34('0x8c')]=_0x46ca2b;if(_0x46ca2b){var _0x562445={'ContactId':_0x46ca2b['id'],'OpenchannelAccountId':_0x1a9eb0[_0xee34('0x57')]['id'],'from':(_0x46ca2b[_0xee34('0x8d')]||'')+'\x20'+(_0x46ca2b[_0xee34('0x8e')]||'')};var _0x13568c={'OpenchannelAccountId':_0x1a9eb0['params']['id'],'closed':![]};if(_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x8f')]){_0x13568c[_0xee34('0x8f')]=_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x8f')];return db[_0xee34('0x90')][_0xee34('0x63')]({'where':_0x13568c})[_0xee34('0x1f')](function(_0x5490f3){if(_0x5490f3){return[_0x5490f3,![]];}_0x562445[_0xee34('0x8f')]=_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x8f')];_0x562445[_0xee34('0x91')]=_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x91')];return db['OpenchannelInteraction'][_0xee34('0x59')](_0x562445)['then'](function(_0x3cdcc8){return[_0x3cdcc8,!![]];});});}else{_0x13568c[_0xee34('0x8f')]=null;}_0x13568c[_0xee34('0x92')]=_0x46ca2b['id'];return db[_0xee34('0x90')][_0xee34('0x63')]({'where':_0x13568c})['then'](function(_0x205368){if(_0x205368){return[_0x205368,![]];}return db[_0xee34('0x90')]['create'](_0x562445)[_0xee34('0x1f')](function(_0x5c1456){return[_0x5c1456,!![]];});});}})[_0xee34('0x93')](function(_0x239401,_0x85b043){if(_0x239401){_0x2fade0=_0x85b043;if(!_0x85b043){var _0x20674a={'from':(_0x49c971['contact'][_0xee34('0x8d')]||'')+'\x20'+(_0x49c971[_0xee34('0x8c')][_0xee34('0x8e')]||'')};if(_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x8f')]&&_0x1a9eb0[_0xee34('0x5a')]['messageId']&&_0x1a9eb0[_0xee34('0x5a')]['threadId']!=_0x1a9eb0['body']['messageId']){_0x20674a[_0xee34('0x8f')]=_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x94')];}return _0x239401[_0xee34('0x95')](_0x20674a);}else{return _0x239401;}}})[_0xee34('0x1f')](function(_0x4569a1){_0x49c971[_0xee34('0x96')]=_0x4569a1[_0xee34('0x36')]({'plain':!![]});_0x49c971['interaction'][_0xee34('0x97')]=_0x2fade0;if(_0x49c971['interaction'][_0xee34('0x97')]){if(_0x49c971[_0xee34('0x89')]['autoclose']){_0x49c971['applications']['push']({'id':0x0,'priority':_0x49c971[_0xee34('0x84')][_0xee34('0x4a')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xee34('0x98')});}}return db[_0xee34('0x99')][_0xee34('0x59')]({'body':_0x1a9eb0['body'][_0xee34('0x5a')],'OpenchannelAccountId':_0x1a9eb0[_0xee34('0x57')]['id'],'OpenchannelInteractionId':_0x4569a1['id'],'direction':'in','ContactId':_0x49c971[_0xee34('0x8c')]['id'],'AttachmentId':_0x1a9eb0[_0xee34('0x5a')][_0xee34('0x9a')]});})['then'](function(_0x4b3acb){_0x49c971[_0xee34('0x26')]=_0x4b3acb;if(_0x49c971[_0xee34('0x96')]['UserId']){return db['User'][_0xee34('0x63')]({'attributes':['id',_0xee34('0x39')],'where':{'id':_0x49c971['interaction'][_0xee34('0x9b')]}})[_0xee34('0x1f')](function(_0x5b77ef){if(_0x5b77ef){_0x49c971[_0xee34('0x84')][_0xee34('0x9c')]({'id':0x0,'priority':0x0,'app':_0xee34('0x9d'),'appdata':_0x5b77ef[_0xee34('0x39')]+','+(_0x49c971[_0xee34('0x89')][_0xee34('0x9e')]||0xa),'interval':_0xee34('0x98')});_0x49c971['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0xee34('0x9f'),_0x49c971);});}return respondWithRpcPromise(_0xee34('0xa0'),_0xee34('0x9f'),_0x49c971);})[_0xee34('0x1f')](function(_0x2f4969){respondWithRpcPromise('EventManager',_0xee34('0xa1'),{'event':'notify','message':_0x2f4969},client9002);return _0x2f4969;})[_0xee34('0x1f')](respondWithResult(_0x2dbc7e,null))[_0xee34('0x28')](handleError(_0x2dbc7e,null));};exports[_0xee34('0xa2')]=function(_0x1a89bb,_0xe1ed8){var _0x597578=_0x1a89bb[_0xee34('0x57')]['id'];var _0x4676f7=_0x1a89bb[_0xee34('0x5a')];var _0x5066b7=0xc8;var _0x5c2dca=null;return db[_0xee34('0xa3')][_0xee34('0xa4')]({'isolationLevel':db[_0xee34('0xa3')]['Transaction']['ISOLATION_LEVELS'][_0xee34('0xa5')]},function(_0x25487f){return db[_0xee34('0x3e')][_0xee34('0x67')]({'where':{'id':_0x597578},'transaction':_0x25487f})['then'](function(_0x2dbbc9){if(_0x2dbbc9){return db[_0xee34('0x81')][_0xee34('0x35')]({'where':{'OpenchannelAccountId':_0x597578},'transaction':_0x25487f})[_0xee34('0x1f')](function(){var _0x201762=_[_0xee34('0x3d')](_0x4676f7,function(_0x38e7b1){_0x38e7b1['OpenchannelAccountId']=_0x597578;return _0x38e7b1;});return db[_0xee34('0x81')]['bulkCreate'](_0x201762,{'transaction':_0x25487f});});}else{_0x5066b7=0x194;_0x5c2dca=[];}});})[_0xee34('0x1f')](function(){if(_0x5066b7!==0x194){return db[_0xee34('0x81')][_0xee34('0xa6')]({'where':{'OpenchannelAccountId':_0x597578},'order':_0xee34('0x87')})[_0xee34('0x1f')](function(_0x5eba58){_0x5c2dca=_0x5eba58;});}})[_0xee34('0x28')](function(_0x3117a5){_0x5066b7=0x1f4;logger['error'](_0x3117a5[_0xee34('0xa7')]);if(_0x3117a5[_0xee34('0x39')]){delete _0x3117a5[_0xee34('0x39')];}_0x5c2dca=_0x3117a5;})[_0xee34('0xa8')](function(){if(_0x5c2dca===null){_0xe1ed8['sendStatus'](_0x5066b7);}else{if(_0x5066b7===0x1f4){_0xe1ed8[_0xee34('0x2a')](_0x5066b7)['send'](_0x5c2dca);}else{_0xe1ed8[_0xee34('0x2a')](_0x5066b7)[_0xee34('0x2c')](_0x5c2dca);}}});};exports[_0xee34('0xa9')]=function(_0x384fd7,_0x2f6953,_0x246df4){var _0x2f9155={};var _0x23bd34={};var _0x51e908;var _0x182ac3;return db[_0xee34('0x3e')][_0xee34('0x67')]({'where':{'id':_0x384fd7[_0xee34('0x57')]['id']}})['then'](handleEntityNotFound(_0x2f6953,null))['then'](function(_0x5a2d73){if(_0x5a2d73){_0x51e908=_0x5a2d73;_0x23bd34['model']=_[_0xee34('0x45')](db[_0xee34('0x81')][_0xee34('0x3f')]);_0x23bd34[_0xee34('0x44')]=_[_0xee34('0x45')](_0x384fd7[_0xee34('0x44')]);_0x23bd34[_0xee34('0x46')]=_[_0xee34('0x47')](_0x23bd34[_0xee34('0x43')],_0x23bd34[_0xee34('0x44')]);_0x2f9155['attributes']=_[_0xee34('0x47')](_0x23bd34[_0xee34('0x43')],qs[_0xee34('0x49')](_0x384fd7[_0xee34('0x44')][_0xee34('0x49')]));_0x2f9155[_0xee34('0x48')]=_0x2f9155[_0xee34('0x48')][_0xee34('0x4a')]?_0x2f9155[_0xee34('0x48')]:_0x23bd34[_0xee34('0x43')];_0x2f9155[_0xee34('0x68')]=qs[_0xee34('0x4d')](_0x384fd7[_0xee34('0x44')][_0xee34('0x4d')]);_0x2f9155[_0xee34('0x50')]=qs[_0xee34('0x46')](_[_0xee34('0x4e')](_0x384fd7[_0xee34('0x44')],_0x23bd34[_0xee34('0x46')]));if(_0x384fd7['query'][_0xee34('0x4f')]){_0x2f9155[_0xee34('0x50')]=_['merge'](_0x2f9155[_0xee34('0x50')],{'$or':_['map'](_0x2f9155[_0xee34('0x48')],function(_0x14c70b){var _0x1600bb={};_0x1600bb[_0x14c70b]={'$like':'%'+_0x384fd7['query'][_0xee34('0x4f')]+'%'};return _0x1600bb;})});}_0x2f9155=_['merge']({},_0x2f9155,_0x384fd7[_0xee34('0x58')]);return _0x51e908[_0xee34('0xa9')](_0x2f9155);}})[_0xee34('0x1f')](function(_0x555707){if(_0x555707){_0x182ac3=_0x555707[_0xee34('0x4a')];if(!_0x384fd7[_0xee34('0x44')][_0xee34('0x4b')]('nolimit')){_0x2f9155[_0xee34('0x30')]=qs['limit'](_0x384fd7[_0xee34('0x44')]['limit']);_0x2f9155['offset']=qs['offset'](_0x384fd7[_0xee34('0x44')][_0xee34('0x2d')]);}return _0x51e908[_0xee34('0xa9')](_0x2f9155);}})[_0xee34('0x1f')](function(_0x15c9ff){if(_0x15c9ff){return _0x15c9ff?{'count':_0x182ac3,'rows':_0x15c9ff}:null;}})[_0xee34('0x1f')](respondWithResult(_0x2f6953,null))[_0xee34('0x28')](handleError(_0x2f6953,null));};exports['getInteractions']=function(_0x4fc019,_0x43b355,_0x1f10a0){var _0x5565e4={'raw':![],'where':{}};var _0x21c676={};var _0x2d8781={'count':0x0,'rows':[]};return db[_0xee34('0x3e')][_0xee34('0x67')]({'where':{'id':_0x4fc019[_0xee34('0x57')]['id']}})[_0xee34('0x1f')](handleEntityNotFound(_0x43b355,null))['then'](function(_0x46ef2c){if(_0x46ef2c){_0x21c676[_0xee34('0x43')]=_[_0xee34('0x45')](db['OpenchannelInteraction'][_0xee34('0x3f')]);_0x21c676[_0xee34('0x44')]=_[_0xee34('0x45')](_0x4fc019[_0xee34('0x44')]);_0x21c676[_0xee34('0x46')]=_[_0xee34('0x47')](_0x21c676[_0xee34('0x43')],_0x21c676[_0xee34('0x44')]);_0x5565e4['attributes']=_[_0xee34('0x47')](_0x21c676[_0xee34('0x43')],qs[_0xee34('0x49')](_0x4fc019[_0xee34('0x44')][_0xee34('0x49')]));_0x5565e4[_0xee34('0x48')]=_0x5565e4[_0xee34('0x48')][_0xee34('0x4a')]?_0x5565e4[_0xee34('0x48')]:_0x21c676[_0xee34('0x43')];if(!_0x4fc019[_0xee34('0x44')][_0xee34('0x4b')](_0xee34('0x4c'))){_0x5565e4[_0xee34('0x30')]=qs[_0xee34('0x30')](_0x4fc019[_0xee34('0x44')]['limit']);_0x5565e4[_0xee34('0x2d')]=qs[_0xee34('0x2d')](_0x4fc019[_0xee34('0x44')][_0xee34('0x2d')]);}_0x5565e4[_0xee34('0x68')]=qs[_0xee34('0x4d')](_0x4fc019[_0xee34('0x44')]['sort']);_0x5565e4[_0xee34('0x50')]=qs[_0xee34('0x46')](_['pick'](_0x4fc019[_0xee34('0x44')],_0x21c676['filters']));_0x5565e4[_0xee34('0x50')]['OpenchannelAccountId']=_0x46ef2c['id'];if(_0x4fc019[_0xee34('0x44')]['filter']){_0x5565e4[_0xee34('0x50')]=_[_0xee34('0x51')](_0x5565e4[_0xee34('0x50')],{'$or':_[_0xee34('0x3d')](_0x5565e4[_0xee34('0x48')],function(_0x4ffe14){var _0x5c5ebd={};_0x5c5ebd[_0x4ffe14]={'$like':'%'+_0x4fc019[_0xee34('0x44')][_0xee34('0x4f')]+'%'};return _0x5c5ebd;})});}_0x5565e4=_[_0xee34('0x51')]({},_0x5565e4,_0x4fc019[_0xee34('0x58')]);return db[_0xee34('0x90')][_0xee34('0x2f')]({'where':_0x5565e4[_0xee34('0x50')]})['then'](function(_0x14d29b){_0x2d8781['count']=_0x14d29b;if(_0x4fc019[_0xee34('0x44')]['includeAll']){_0x5565e4[_0xee34('0x54')]=[{'model':db[_0xee34('0x8b')],'as':_0xee34('0xaa'),'required':![]},{'model':db[_0xee34('0xab')],'as':_0xee34('0xac'),'attributes':['name',_0xee34('0xad'),_0xee34('0xae')],'required':![]},{'model':db[_0xee34('0xaf')],'as':_0xee34('0xb0'),'attributes':['id',_0xee34('0x39'),_0xee34('0xb1')],'where':_0x4fc019['query'][_0xee34('0xb2')]?{'id':_0x4fc019['query']['tag']}:undefined,'required':_0x4fc019[_0xee34('0x44')][_0xee34('0xb2')]?!![]:![]}];}return db[_0xee34('0x90')][_0xee34('0x55')](_0x5565e4);})[_0xee34('0x1f')](function(_0x5990c2){_0x2d8781[_0xee34('0x56')]=_0x5990c2;return _0x2d8781;});}})['then'](respondWithFilteredResult(_0x43b355,_0x5565e4))[_0xee34('0x28')](handleError(_0x43b355,null));};exports[_0xee34('0xb3')]=function(_0x4c0a32,_0x4b4808,_0x28ef5a){return db[_0xee34('0x3e')][_0xee34('0x63')]({'where':{'id':_0x4c0a32[_0xee34('0x57')]['id']}})[_0xee34('0x1f')](handleEntityNotFound(_0x4b4808,null))[_0xee34('0x1f')](function(_0x155c75){if(_0x155c75){return _0x155c75['addAgents'](_0x4c0a32[_0xee34('0x5a')][_0xee34('0x6e')],_[_0xee34('0xb4')](_0x4c0a32['body'],[_0xee34('0x6e'),'id'])||{})[_0xee34('0x93')](function(_0x116570){for(var _0x3b00e4=0x0;_0x3b00e4<_0x4c0a32[_0xee34('0x5a')]['ids']['length'];_0x3b00e4+=0x1){socket['emit'](_0xee34('0xb5'),{'UserId':Number(_0x4c0a32['body'][_0xee34('0x6e')][_0x3b00e4]),'OpenchannelAccountId':Number(_0x4c0a32[_0xee34('0x57')]['id'])});}return _0x116570;});}})['then'](respondWithResult(_0x4b4808,null))['catch'](handleError(_0x4b4808,null));};exports[_0xee34('0xb6')]=function(_0x34219e,_0x35eb52,_0x5be948){return db[_0xee34('0x3e')]['find']({'where':{'id':_0x34219e[_0xee34('0x57')]['id']}})['then'](handleEntityNotFound(_0x35eb52,null))[_0xee34('0x1f')](function(_0x1e1440){if(_0x1e1440){return _0x1e1440[_0xee34('0xb6')](_0x34219e[_0xee34('0x44')][_0xee34('0x6e')])[_0xee34('0x1f')](function(){if(_[_0xee34('0xb7')](_0x34219e[_0xee34('0x44')][_0xee34('0x6e')])){for(var _0x3df905=0x0;_0x3df905<_0x34219e[_0xee34('0x44')]['ids'][_0xee34('0x4a')];_0x3df905+=0x1){socket[_0xee34('0xb8')](_0xee34('0xb9'),{'UserId':Number(_0x34219e['query']['ids'][_0x3df905]),'OpenchannelAccountId':Number(_0x34219e['params']['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x34219e[_0xee34('0x44')]['ids']),'OpenchannelAccountId':Number(_0x34219e[_0xee34('0x57')]['id'])});}});}})[_0xee34('0x1f')](respondWithStatusCode(_0x35eb52,null))[_0xee34('0x28')](handleError(_0x35eb52,null));};exports[_0xee34('0xba')]=function(_0x46aaec,_0x12cb72,_0x32f76a){var _0xd969b4={};var _0x950ca={};var _0x5889e1;var _0x5cbfe0;return db[_0xee34('0x3e')][_0xee34('0x67')]({'where':{'id':_0x46aaec[_0xee34('0x57')]['id']}})['then'](handleEntityNotFound(_0x12cb72,null))[_0xee34('0x1f')](function(_0x4c140e){if(_0x4c140e){_0x5889e1=_0x4c140e;_0x950ca[_0xee34('0x43')]=_[_0xee34('0x45')](db[_0xee34('0xab')][_0xee34('0x3f')]);_0x950ca[_0xee34('0x44')]=_[_0xee34('0x45')](_0x46aaec['query']);_0x950ca[_0xee34('0x46')]=_[_0xee34('0x47')](_0x950ca[_0xee34('0x43')],_0x950ca[_0xee34('0x44')]);_0xd969b4[_0xee34('0x48')]=_[_0xee34('0x47')](_0x950ca['model'],qs[_0xee34('0x49')](_0x46aaec[_0xee34('0x44')]['fields']));_0xd969b4[_0xee34('0x48')]=_0xd969b4['attributes']['length']?_0xd969b4[_0xee34('0x48')]:_0x950ca['model'];_0xd969b4[_0xee34('0x68')]=qs[_0xee34('0x4d')](_0x46aaec[_0xee34('0x44')]['sort']);_0xd969b4['where']=qs[_0xee34('0x46')](_['pick'](_0x46aaec['query'],_0x950ca[_0xee34('0x46')]));if(_0x46aaec[_0xee34('0x44')]['filter']){_0xd969b4['where']=_[_0xee34('0x51')](_0xd969b4['where'],{'$or':_[_0xee34('0x3d')](_0xd969b4['attributes'],function(_0x37d43f){var _0x239369={};_0x239369[_0x37d43f]={'$like':'%'+_0x46aaec[_0xee34('0x44')][_0xee34('0x4f')]+'%'};return _0x239369;})});}_0xd969b4=_[_0xee34('0x51')]({},_0xd969b4,_0x46aaec[_0xee34('0x58')]);return _0x5889e1[_0xee34('0xba')](_0xd969b4);}})[_0xee34('0x1f')](function(_0x1966be){if(_0x1966be){_0x5cbfe0=_0x1966be[_0xee34('0x4a')];if(!_0x46aaec[_0xee34('0x44')][_0xee34('0x4b')](_0xee34('0x4c'))){_0xd969b4[_0xee34('0x30')]=qs[_0xee34('0x30')](_0x46aaec['query'][_0xee34('0x30')]);_0xd969b4[_0xee34('0x2d')]=qs[_0xee34('0x2d')](_0x46aaec[_0xee34('0x44')][_0xee34('0x2d')]);}return _0x5889e1[_0xee34('0xba')](_0xd969b4);}})['then'](function(_0x274a4a){if(_0x274a4a){return _0x274a4a?{'count':_0x5cbfe0,'rows':_0x274a4a}:null;}})[_0xee34('0x1f')](respondWithResult(_0x12cb72,null))[_0xee34('0x28')](handleError(_0x12cb72,null));};exports[_0xee34('0x3a')]=function(_0x47ea04,_0x445ca2,_0x213b45){var _0x2d5cd1,_0x4597ae,_0x352504;if(_[_0xee34('0x7a')](_0x47ea04['body']['body'])||_0x47ea04['body'][_0xee34('0x5a')]===''){throw new db[(_0xee34('0x71'))][(_0xee34('0x72'))](_0xee34('0x7b'));}if(_['isNil'](_0x47ea04['body']['to'])){}_0x2d5cd1=_0x47ea04['body']['to'];return db[_0xee34('0x3e')][_0xee34('0x67')]({'where':{'id':_0x47ea04['params']['id']}})['then'](handleEntityNotFound(_0x445ca2,null))[_0xee34('0x1f')](function(_0x4ad199){if(_0x4ad199){return db[_0xee34('0x3e')][_0xee34('0x63')]({'where':{'id':_0x4ad199['id']},'include':[{'model':db[_0xee34('0x7f')],'as':_0xee34('0x83'),'include':[{'model':db['CmContact'],'as':_0xee34('0x80'),'where':{[_0x4ad199[_0xee34('0x7c')]]:_0x2d5cd1},'limit':0x1,'order':[['updatedAt',_0xee34('0xbb')]]}]}]})[_0xee34('0x1f')](handleEntityNotFound(_0x445ca2,null))['then'](function(_0x1d60ca){if(_0x1d60ca&&_0x1d60ca[_0xee34('0x83')]){_0x4597ae=_0x1d60ca[_0xee34('0x36')]({'plain':!![]});if(_0x4597ae[_0xee34('0x83')]&&_0x4597ae[_0xee34('0x83')]['Contacts'][_0xee34('0x4a')]){return _0x4597ae[_0xee34('0x83')]['Contacts'][0x0];}return db[_0xee34('0x8b')][_0xee34('0x59')](_[_0xee34('0x8a')](_0x47ea04[_0xee34('0x5a')],{'firstName':_0x2d5cd1,[_0x1d60ca[_0xee34('0x7c')]]:_0x2d5cd1,'phone':_0x2d5cd1,'ListId':_0x4597ae[_0xee34('0x77')]}));}})[_0xee34('0x1f')](handleEntityNotFound(_0x445ca2,null))[_0xee34('0x1f')](function(_0x380e00){if(_0x380e00){_0x352504=_0x380e00;return db[_0xee34('0x90')][_0xee34('0x63')]({'where':{'ContactId':_0x352504['id'],'closed':![],'OpenchannelAccountId':_0x4597ae['id']}})[_0xee34('0x1f')](function(_0x5b5abb){if(_0x5b5abb){return[_0x5b5abb,![]];}return db[_0xee34('0x90')][_0xee34('0x59')]({'UserId':_0x47ea04[_0xee34('0x5b')]['id'],'ContactId':_0x352504['id'],'OpenchannelAccountId':_0x4597ae['id'],'lastMsgDirection':'out','Messages':[_[_0xee34('0x51')](_0x47ea04['body'],{'read':![],'body':_0x47ea04[_0xee34('0x5a')][_0xee34('0x5a')],'OpenchannelAccountId':_0x4597ae['id'],'UserId':_0x47ea04[_0xee34('0x5b')]['id'],'ContactId':_0x352504['id']})]},{'include':[{'model':db[_0xee34('0x99')],'as':_0xee34('0xbc')}]})[_0xee34('0x1f')](function(_0x245208){return[_0x245208,!![]];});});}})[_0xee34('0x93')](function(_0xea33e7,_0x59f921){if(_0x59f921){return _0xea33e7;}return db['OpenchannelMessage'][_0xee34('0x59')](_['merge'](_0x47ea04[_0xee34('0x5a')],{'read':![],'body':_0x47ea04['body'][_0xee34('0x5a')],'OpenchannelAccountId':_0x4597ae['id'],'OpenchannelInteractionId':_0xea33e7['id'],'UserId':_0x47ea04[_0xee34('0x5b')]['id'],'ContactId':_0x352504['id']}))['then'](function(_0x356235){_0xea33e7[_0xee34('0xbd')][_0xee34('0xbc')]=[];_0xea33e7[_0xee34('0xbd')][_0xee34('0xbc')][_0xee34('0xbe')](_0x356235[_0xee34('0xbd')]);return _0xea33e7;});});}})[_0xee34('0x1f')](respondWithResult(_0x445ca2,null))[_0xee34('0x28')](handleError(_0x445ca2,null));}; \ No newline at end of file +var _0x380e=['push','close','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','ListId','out','OpenchannelMessage','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','getDispositions','filter','map','Disposition','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','DESC','OpenchannelApplication','Applications','account','applications','list','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose'];(function(_0x32445f,_0x4205e0){var _0x3716eb=function(_0x365731){while(--_0x365731){_0x32445f['push'](_0x32445f['shift']());}};_0x3716eb(++_0x4205e0);}(_0x380e,0xe3));var _0xe380=function(_0x20cb61,_0x309a0f){_0x20cb61=_0x20cb61-0x0;var _0x4531b1=_0x380e[_0x20cb61];return _0x4531b1;};'use strict';var emlformat=require(_0xe380('0x0'));var rimraf=require(_0xe380('0x1'));var zipdir=require(_0xe380('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe380('0x3'));var moment=require(_0xe380('0x4'));var BPromise=require(_0xe380('0x5'));var Mustache=require('mustache');var util=require(_0xe380('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe380('0x7'));var crypto=require(_0xe380('0x8'));var jsforce=require(_0xe380('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe380('0xa'));var Papa=require(_0xe380('0xb'));var Redis=require(_0xe380('0xc'));var authService=require(_0xe380('0xd'));var qs=require(_0xe380('0xe'));var as=require(_0xe380('0xf'));var hardwareService=require(_0xe380('0x10'));var logger=require(_0xe380('0x11'))(_0xe380('0x12'));var utils=require('../../config/utils');var config=require(_0xe380('0x13'));var licenseUtil=require(_0xe380('0x14'));var db=require('../../mysqldb')['db'];config[_0xe380('0x15')]=_['defaults'](config[_0xe380('0x15')],{'host':_0xe380('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe380('0x17'))['register'](socket);var jayson=require(_0xe380('0x18'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe380('0x19')][_0xe380('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x58b466,_0x37a623,_0x529a58,_0x5402bc){return new BPromise(function(_0x4ff788,_0x11103e){var _0x34aac0=_0x5402bc||client;return _0x34aac0[_0xe380('0x1b')](_0x58b466,_0x529a58)[_0xe380('0x1c')](function(_0x393282){logger[_0xe380('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x37a623,'request\x20sent');logger[_0xe380('0x1e')](_0xe380('0x1f'),_0x37a623,_0xe380('0x20'),JSON['stringify'](_0x393282));if(_0x393282[_0xe380('0x21')]){if(_0x393282['error'][_0xe380('0x22')]===0x1f4){logger[_0xe380('0x21')](_0xe380('0x23'),_0x37a623,_0x393282[_0xe380('0x21')]['message']);return _0x11103e(_0x393282[_0xe380('0x21')]['message']);}logger['error'](_0xe380('0x23'),_0x37a623,_0x393282[_0xe380('0x21')][_0xe380('0x24')]);return _0x4ff788(_0x393282[_0xe380('0x21')][_0xe380('0x24')]);}else{logger[_0xe380('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x37a623,_0xe380('0x20'));_0x4ff788(_0x393282['result'][_0xe380('0x24')]);}})['catch'](function(_0x4e2e35){logger[_0xe380('0x21')](_0xe380('0x23'),_0x37a623,_0x4e2e35);_0x11103e(_0x4e2e35);});});}function respondWithStatusCode(_0x57ead5,_0x38d9ed){_0x38d9ed=_0x38d9ed||0xcc;return function(_0x42d824){if(_0x42d824){return _0x57ead5[_0xe380('0x25')](_0x38d9ed);}return _0x57ead5[_0xe380('0x26')](_0x38d9ed)[_0xe380('0x27')]();};}function respondWithResult(_0x10cfe6,_0x2953a5){_0x2953a5=_0x2953a5||0xc8;return function(_0x31ad00){if(_0x31ad00){return _0x10cfe6[_0xe380('0x26')](_0x2953a5)[_0xe380('0x28')](_0x31ad00);}};}function respondWithFilteredResult(_0x35f595,_0x154da7){return function(_0x403211){if(_0x403211){var _0x40b9d8=typeof _0x154da7['offset']==='undefined'&&typeof _0x154da7[_0xe380('0x29')]===_0xe380('0x2a');var _0xee571d=_0x403211[_0xe380('0x2b')];var _0x5975c8=_0x40b9d8?0x0:_0x154da7[_0xe380('0x2c')];var _0x4af2db=_0x40b9d8?_0x403211[_0xe380('0x2b')]:_0x154da7[_0xe380('0x2c')]+_0x154da7['limit'];var _0x3c910f;if(_0x4af2db>=_0xee571d){_0x4af2db=_0xee571d;_0x3c910f=0xc8;}else{_0x3c910f=0xce;}_0x35f595['status'](_0x3c910f);return _0x35f595[_0xe380('0x2d')](_0xe380('0x2e'),_0x5975c8+'-'+_0x4af2db+'/'+_0xee571d)[_0xe380('0x28')](_0x403211);}return null;};}function patchUpdates(_0x4cc1d1){return function(_0x47d651){try{jsonpatch['apply'](_0x47d651,_0x4cc1d1,!![]);}catch(_0x56f675){return BPromise['reject'](_0x56f675);}return _0x47d651['save']();};}function saveUpdates(_0x5f44a0,_0x5085e3){return function(_0x366470){if(_0x366470){return _0x366470['update'](_0x5f44a0)[_0xe380('0x1c')](function(_0x198a2e){return _0x198a2e;});}return null;};}function removeEntity(_0x541f16,_0x215184){return function(_0x2de136){if(_0x2de136){return _0x2de136['destroy']()[_0xe380('0x1c')](function(){var _0x55e786=_0x2de136[_0xe380('0x2f')]({'plain':!![]});var _0x432fd6=_0xe380('0x30');return db[_0xe380('0x31')][_0xe380('0x32')]({'where':{'type':_0x432fd6,'resourceId':_0x55e786['id']}})['then'](function(){return _0x2de136;});})['then'](function(){_0x541f16[_0xe380('0x26')](0xcc)[_0xe380('0x27')]();});}};}function handleEntityNotFound(_0x5838e5,_0x36a17f){return function(_0x2ff7f7){if(!_0x2ff7f7){_0x5838e5[_0xe380('0x25')](0x194);}return _0x2ff7f7;};}function handleError(_0x2b0cd5,_0x2faf12){_0x2faf12=_0x2faf12||0x1f4;return function(_0x5e9761){logger[_0xe380('0x21')](_0x5e9761[_0xe380('0x33')]);if(_0x5e9761[_0xe380('0x34')]){delete _0x5e9761[_0xe380('0x34')];}_0x2b0cd5[_0xe380('0x26')](_0x2faf12)[_0xe380('0x35')](_0x5e9761);};}exports[_0xe380('0x36')]=function(_0x3b26ba,_0x2f0477){var _0x224e05={'include':[{'model':db[_0xe380('0x37')],'as':_0xe380('0x38')}]},_0x1f928c={},_0x584101={'count':0x0,'rows':[]};var _0x56fba7=_['map'](db[_0xe380('0x39')][_0xe380('0x3a')],function(_0x57144a){return{'name':_0x57144a[_0xe380('0x3b')],'type':_0x57144a[_0xe380('0x3c')]['key']};});_0x1f928c[_0xe380('0x3d')]=_['map'](_0x56fba7,_0xe380('0x34'));_0x1f928c[_0xe380('0x3e')]=_[_0xe380('0x3f')](_0x3b26ba[_0xe380('0x3e')]);_0x1f928c[_0xe380('0x40')]=_[_0xe380('0x41')](_0x1f928c[_0xe380('0x3d')],_0x1f928c['query']);_0x224e05[_0xe380('0x42')]=_[_0xe380('0x41')](_0x1f928c['model'],qs['fields'](_0x3b26ba[_0xe380('0x3e')][_0xe380('0x43')]));_0x224e05[_0xe380('0x42')]=_0x224e05[_0xe380('0x42')][_0xe380('0x44')]?_0x224e05['attributes']:_0x1f928c[_0xe380('0x3d')];if(!_0x3b26ba[_0xe380('0x3e')][_0xe380('0x45')](_0xe380('0x46'))){_0x224e05[_0xe380('0x29')]=qs[_0xe380('0x29')](_0x3b26ba[_0xe380('0x3e')][_0xe380('0x29')]);_0x224e05[_0xe380('0x2c')]=qs[_0xe380('0x2c')](_0x3b26ba[_0xe380('0x3e')]['offset']);}_0x224e05[_0xe380('0x47')]=qs['sort'](_0x3b26ba[_0xe380('0x3e')][_0xe380('0x48')]);_0x224e05[_0xe380('0x49')]=qs[_0xe380('0x40')](_[_0xe380('0x4a')](_0x3b26ba['query'],_0x1f928c['filters']),_0x56fba7);if(_0x3b26ba[_0xe380('0x3e')]['filter']){_0x224e05['where']=_[_0xe380('0x4b')](_0x224e05[_0xe380('0x49')],{'$or':_['map'](_0x56fba7,function(_0x4f62d4){if(_0x4f62d4['type']!==_0xe380('0x4c')){var _0x30e745={};_0x30e745[_0x4f62d4[_0xe380('0x34')]]={'$like':'%'+_0x3b26ba[_0xe380('0x3e')]['filter']+'%'};return _0x30e745;}})});}_0x224e05=_[_0xe380('0x4b')]({},_0x224e05,_0x3b26ba[_0xe380('0x4d')]);var _0x1c7f10={'where':_0x224e05['where']};return db['OpenchannelAccount'][_0xe380('0x2b')](_0x1c7f10)[_0xe380('0x1c')](function(_0x534783){_0x584101[_0xe380('0x2b')]=_0x534783;if(_0x3b26ba['query']['includeAll']){_0x224e05[_0xe380('0x4e')]=[{'all':!![]}];}return db[_0xe380('0x39')][_0xe380('0x4f')](_0x224e05);})[_0xe380('0x1c')](function(_0x3cccd7){_0x584101['rows']=_0x3cccd7;return _0x584101;})['then'](respondWithFilteredResult(_0x2f0477,_0x224e05))[_0xe380('0x50')](handleError(_0x2f0477,null));};exports[_0xe380('0x51')]=function(_0x44a03e,_0x8d8c79){var _0x392272={'raw':![],'where':{'id':_0x44a03e[_0xe380('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xe380('0x38')}]},_0x5532e4={};_0x5532e4[_0xe380('0x3d')]=_[_0xe380('0x3f')](db[_0xe380('0x39')][_0xe380('0x3a')]);_0x5532e4[_0xe380('0x3e')]=_[_0xe380('0x3f')](_0x44a03e[_0xe380('0x3e')]);_0x5532e4[_0xe380('0x40')]=_[_0xe380('0x41')](_0x5532e4[_0xe380('0x3d')],_0x5532e4[_0xe380('0x3e')]);_0x392272[_0xe380('0x42')]=_[_0xe380('0x41')](_0x5532e4[_0xe380('0x3d')],qs['fields'](_0x44a03e[_0xe380('0x3e')][_0xe380('0x43')]));_0x392272[_0xe380('0x42')]=_0x392272[_0xe380('0x42')][_0xe380('0x44')]?_0x392272[_0xe380('0x42')]:_0x5532e4[_0xe380('0x3d')];if(_0x44a03e[_0xe380('0x3e')]['includeAll']){_0x392272[_0xe380('0x4e')]=[{'all':!![]}];}_0x392272=_[_0xe380('0x4b')]({},_0x392272,_0x44a03e[_0xe380('0x4d')]);return db[_0xe380('0x39')][_0xe380('0x53')](_0x392272)[_0xe380('0x1c')](handleEntityNotFound(_0x8d8c79,null))[_0xe380('0x1c')](respondWithResult(_0x8d8c79,null))[_0xe380('0x50')](handleError(_0x8d8c79,null));};exports[_0xe380('0x54')]=function(_0x4bb76f,_0x4a09f5){return db['OpenchannelAccount'][_0xe380('0x54')](_0x4bb76f[_0xe380('0x55')],{})[_0xe380('0x1c')](function(_0x301f8b){var _0x214883=_0x4bb76f[_0xe380('0x56')]['get']({'plain':!![]});if(!_0x214883)throw new Error(_0xe380('0x57'));if(_0x214883[_0xe380('0x58')]===_0xe380('0x56')){var _0xcb7840=_0x301f8b[_0xe380('0x2f')]({'plain':!![]});var _0x11a5a0=_0xe380('0x30');return db[_0xe380('0x59')][_0xe380('0x53')]({'where':{'name':_0x11a5a0,'userProfileId':_0x214883[_0xe380('0x5a')]},'raw':!![]})[_0xe380('0x1c')](function(_0x5e6068){if(_0x5e6068&&_0x5e6068['autoAssociation']===0x0){return db[_0xe380('0x31')][_0xe380('0x54')]({'name':_0xcb7840['name'],'resourceId':_0xcb7840['id'],'type':_0x5e6068[_0xe380('0x34')],'sectionId':_0x5e6068['id']},{})[_0xe380('0x1c')](function(){return _0x301f8b;});}else{return _0x301f8b;}})['catch'](function(_0x5a1716){logger['error'](_0xe380('0x5b'),_0x5a1716);throw _0x5a1716;});}return _0x301f8b;})[_0xe380('0x1c')](respondWithResult(_0x4a09f5,0xc9))[_0xe380('0x50')](handleError(_0x4a09f5,null));};exports[_0xe380('0x5c')]=function(_0xa19e5d,_0x513dc2){if(_0xa19e5d['body']['id']){delete _0xa19e5d[_0xe380('0x55')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xa19e5d['params']['id']},'include':[{'model':db[_0xe380('0x37')],'as':_0xe380('0x38')}]})[_0xe380('0x1c')](handleEntityNotFound(_0x513dc2,null))[_0xe380('0x1c')](saveUpdates(_0xa19e5d[_0xe380('0x55')],null))[_0xe380('0x1c')](respondWithResult(_0x513dc2,null))[_0xe380('0x50')](handleError(_0x513dc2,null));};exports['destroy']=function(_0x1c91a1,_0x249d76){return db[_0xe380('0x39')][_0xe380('0x53')]({'where':{'id':_0x1c91a1[_0xe380('0x52')]['id']}})['then'](handleEntityNotFound(_0x249d76,null))[_0xe380('0x1c')](removeEntity(_0x249d76,null))['catch'](handleError(_0x249d76,null));};exports[_0xe380('0x5d')]=function(_0x85bf3c,_0x1de2d6){return db['OpenchannelAccount'][_0xe380('0x5d')]()[_0xe380('0x1c')](respondWithResult(_0x1de2d6,null))[_0xe380('0x50')](handleError(_0x1de2d6,null));};exports[_0xe380('0x5e')]=function(_0x79fbd2,_0x6262dd,_0x3d4729){if(_0x79fbd2[_0xe380('0x55')]['id']){delete _0x79fbd2[_0xe380('0x55')]['id'];}return db[_0xe380('0x39')][_0xe380('0x53')]({'where':{'id':_0x79fbd2[_0xe380('0x52')]['id']}})[_0xe380('0x1c')](handleEntityNotFound(_0x6262dd,null))[_0xe380('0x1c')](function(_0x3e8deb){if(_0x3e8deb){_0x79fbd2[_0xe380('0x55')][_0xe380('0x5f')]=_0x3e8deb['id'];return db['Disposition'][_0xe380('0x54')](_0x79fbd2[_0xe380('0x55')]);}})['then'](respondWithResult(_0x6262dd,null))[_0xe380('0x50')](handleError(_0x6262dd,null));};exports[_0xe380('0x60')]=function(_0xe0fe0c,_0x466597,_0x6d2f5c){var _0x573fa6={'raw':![],'where':{}};var _0x358530={};var _0x4bd3f8={'count':0x0,'rows':[]};return db[_0xe380('0x39')]['findOne']({'where':{'id':_0xe0fe0c['params']['id']}})['then'](handleEntityNotFound(_0x466597,null))[_0xe380('0x1c')](function(_0x15a1ad){if(_0x15a1ad){_0x358530[_0xe380('0x3d')]=_[_0xe380('0x3f')](db['Disposition']['rawAttributes']);_0x358530[_0xe380('0x3e')]=_[_0xe380('0x3f')](_0xe0fe0c[_0xe380('0x3e')]);_0x358530['filters']=_[_0xe380('0x41')](_0x358530[_0xe380('0x3d')],_0x358530[_0xe380('0x3e')]);_0x573fa6[_0xe380('0x42')]=_[_0xe380('0x41')](_0x358530[_0xe380('0x3d')],qs[_0xe380('0x43')](_0xe0fe0c[_0xe380('0x3e')][_0xe380('0x43')]));_0x573fa6[_0xe380('0x42')]=_0x573fa6[_0xe380('0x42')][_0xe380('0x44')]?_0x573fa6[_0xe380('0x42')]:_0x358530[_0xe380('0x3d')];if(!_0xe0fe0c['query'][_0xe380('0x45')](_0xe380('0x46'))){_0x573fa6[_0xe380('0x29')]=qs[_0xe380('0x29')](_0xe0fe0c[_0xe380('0x3e')][_0xe380('0x29')]);_0x573fa6[_0xe380('0x2c')]=qs['offset'](_0xe0fe0c['query'][_0xe380('0x2c')]);}_0x573fa6[_0xe380('0x47')]=qs[_0xe380('0x48')](_0xe0fe0c[_0xe380('0x3e')]['sort']);_0x573fa6[_0xe380('0x49')]=qs[_0xe380('0x40')](_[_0xe380('0x4a')](_0xe0fe0c['query'],_0x358530[_0xe380('0x40')]));_0x573fa6[_0xe380('0x49')]['OpenchannelAccountId']=_0x15a1ad['id'];if(_0xe0fe0c['query'][_0xe380('0x61')]){_0x573fa6['where']=_[_0xe380('0x4b')](_0x573fa6[_0xe380('0x49')],{'$or':_[_0xe380('0x62')](_0x573fa6[_0xe380('0x42')],function(_0x22eca9){var _0x251bcd={};_0x251bcd[_0x22eca9]={'$like':'%'+_0xe0fe0c[_0xe380('0x3e')][_0xe380('0x61')]+'%'};return _0x251bcd;})});}_0x573fa6=_[_0xe380('0x4b')]({},_0x573fa6,_0xe0fe0c[_0xe380('0x4d')]);return db[_0xe380('0x63')][_0xe380('0x2b')]({'where':_0x573fa6[_0xe380('0x49')]})[_0xe380('0x1c')](function(_0x19c90a){_0x4bd3f8['count']=_0x19c90a;if(_0xe0fe0c[_0xe380('0x3e')][_0xe380('0x64')]){_0x573fa6[_0xe380('0x4e')]=[{'all':!![]}];}return db[_0xe380('0x63')][_0xe380('0x4f')](_0x573fa6);})[_0xe380('0x1c')](function(_0x263bf7){_0x4bd3f8[_0xe380('0x65')]=_0x263bf7;return _0x4bd3f8;});}})[_0xe380('0x1c')](respondWithFilteredResult(_0x466597,_0x573fa6))[_0xe380('0x50')](handleError(_0x466597,null));};exports[_0xe380('0x66')]=function(_0x498578,_0xaf626a,_0x37623c){return db[_0xe380('0x39')][_0xe380('0x53')]({'where':{'id':_0x498578[_0xe380('0x52')]['id']}})['then'](handleEntityNotFound(_0xaf626a,null))[_0xe380('0x1c')](function(_0x5230ca){if(_0x5230ca){return _0x5230ca[_0xe380('0x66')](_0x498578['query'][_0xe380('0x67')]);}})[_0xe380('0x1c')](respondWithStatusCode(_0xaf626a,null))[_0xe380('0x50')](handleError(_0xaf626a,null));};exports[_0xe380('0x68')]=function(_0x3453f0,_0xf1203e,_0x307191){if(_0x3453f0[_0xe380('0x55')]['id']){delete _0x3453f0[_0xe380('0x55')]['id'];}return db[_0xe380('0x39')][_0xe380('0x53')]({'where':{'id':_0x3453f0[_0xe380('0x52')]['id']}})[_0xe380('0x1c')](handleEntityNotFound(_0xf1203e,null))[_0xe380('0x1c')](function(_0xd02a3b){if(_0xd02a3b){_0x3453f0['body']['OpenchannelAccountId']=_0xd02a3b['id'];return db[_0xe380('0x69')][_0xe380('0x54')](_0x3453f0[_0xe380('0x55')]);}})[_0xe380('0x1c')](respondWithResult(_0xf1203e,null))[_0xe380('0x50')](handleError(_0xf1203e,null));};exports['getAnswers']=function(_0xef7b89,_0x4ebeb2,_0x5e2b94){var _0x38f6dc={'raw':![],'where':{}};var _0x5e4a4f={};var _0x5c214f={'count':0x0,'rows':[]};return db[_0xe380('0x39')][_0xe380('0x6a')]({'where':{'id':_0xef7b89[_0xe380('0x52')]['id']}})[_0xe380('0x1c')](handleEntityNotFound(_0x4ebeb2,null))['then'](function(_0x2f7066){if(_0x2f7066){_0x5e4a4f[_0xe380('0x3d')]=_[_0xe380('0x3f')](db[_0xe380('0x69')][_0xe380('0x3a')]);_0x5e4a4f[_0xe380('0x3e')]=_['keys'](_0xef7b89['query']);_0x5e4a4f[_0xe380('0x40')]=_[_0xe380('0x41')](_0x5e4a4f[_0xe380('0x3d')],_0x5e4a4f['query']);_0x38f6dc[_0xe380('0x42')]=_[_0xe380('0x41')](_0x5e4a4f[_0xe380('0x3d')],qs[_0xe380('0x43')](_0xef7b89[_0xe380('0x3e')][_0xe380('0x43')]));_0x38f6dc[_0xe380('0x42')]=_0x38f6dc['attributes']['length']?_0x38f6dc[_0xe380('0x42')]:_0x5e4a4f['model'];if(!_0xef7b89[_0xe380('0x3e')][_0xe380('0x45')]('nolimit')){_0x38f6dc[_0xe380('0x29')]=qs[_0xe380('0x29')](_0xef7b89['query'][_0xe380('0x29')]);_0x38f6dc['offset']=qs['offset'](_0xef7b89[_0xe380('0x3e')][_0xe380('0x2c')]);}_0x38f6dc['order']=qs[_0xe380('0x48')](_0xef7b89[_0xe380('0x3e')][_0xe380('0x48')]);_0x38f6dc['where']=qs[_0xe380('0x40')](_[_0xe380('0x4a')](_0xef7b89[_0xe380('0x3e')],_0x5e4a4f['filters']));_0x38f6dc[_0xe380('0x49')]['OpenchannelAccountId']=_0x2f7066['id'];if(_0xef7b89[_0xe380('0x3e')][_0xe380('0x61')]){_0x38f6dc['where']=_[_0xe380('0x4b')](_0x38f6dc[_0xe380('0x49')],{'$or':_['map'](_0x38f6dc[_0xe380('0x42')],function(_0x490723){var _0x58d1ad={};_0x58d1ad[_0x490723]={'$like':'%'+_0xef7b89[_0xe380('0x3e')][_0xe380('0x61')]+'%'};return _0x58d1ad;})});}_0x38f6dc=_[_0xe380('0x4b')]({},_0x38f6dc,_0xef7b89['options']);return db[_0xe380('0x69')][_0xe380('0x2b')]({'where':_0x38f6dc[_0xe380('0x49')]})[_0xe380('0x1c')](function(_0xcc0e17){_0x5c214f[_0xe380('0x2b')]=_0xcc0e17;if(_0xef7b89['query'][_0xe380('0x64')]){_0x38f6dc[_0xe380('0x4e')]=[{'all':!![]}];}return db[_0xe380('0x69')][_0xe380('0x4f')](_0x38f6dc);})[_0xe380('0x1c')](function(_0x47fd83){_0x5c214f['rows']=_0x47fd83;return _0x5c214f;});}})[_0xe380('0x1c')](respondWithFilteredResult(_0x4ebeb2,_0x38f6dc))[_0xe380('0x50')](handleError(_0x4ebeb2,null));};exports[_0xe380('0x6b')]=function(_0x28f4f5,_0x2b3e13,_0x464bdc){return db['OpenchannelAccount']['find']({'where':{'id':_0x28f4f5[_0xe380('0x52')]['id']}})[_0xe380('0x1c')](handleEntityNotFound(_0x2b3e13,null))[_0xe380('0x1c')](function(_0x4eb889){if(_0x4eb889){return _0x4eb889[_0xe380('0x6b')](_0x28f4f5['query'][_0xe380('0x67')]);}})[_0xe380('0x1c')](respondWithStatusCode(_0x2b3e13,null))['catch'](handleError(_0x2b3e13,null));};exports[_0xe380('0x6c')]=function(_0x25b0e6,_0x67a7ad,_0x356e32){var _0x3c0cb9={'body':_0x25b0e6[_0xe380('0x55')],'channel':_0xe380('0x6d')};var _0x4c3672=[];var _0x1b29cb=[];var _0xc90e43={};var _0x50f02b=![];return db[_0xe380('0x6e')][_0xe380('0x5d')]()['then'](function(_0x5aa039){if(!_0x5aa039){throw new db[(_0xe380('0x6f'))][(_0xe380('0x70'))](_0xe380('0x71'));}_0x4c3672=_[_0xe380('0x72')](_['keys'](_0x5aa039),[_0xe380('0x73'),'updatedAt']);_0x1b29cb=_[_0xe380('0x72')](_[_0xe380('0x3f')](_0x5aa039),['createdAt','updatedAt','CompanyId','ListId']);if(_0x25b0e6[_0xe380('0x55')]['id']){delete _0x25b0e6[_0xe380('0x55')]['id'];}if(_['isNil'](_0x25b0e6['body'][_0xe380('0x74')])){throw new db['Sequelize'][(_0xe380('0x70'))]('from\x20is\x20mandatory');}if(_[_0xe380('0x75')](_0x25b0e6['body']['body'])||_0x25b0e6['body'][_0xe380('0x55')]===''){throw new db[(_0xe380('0x6f'))]['ValidationError'](_0xe380('0x76'));}if(_['isNil'](_0x25b0e6[_0xe380('0x55')][_0xe380('0x77')])){throw new db['Sequelize'][(_0xe380('0x70'))](_0xe380('0x78')+_0x1b29cb);}if(!_[_0xe380('0x79')](_0x1b29cb,_0x25b0e6[_0xe380('0x55')][_0xe380('0x77')])){throw new db[(_0xe380('0x6f'))]['ValidationError'](_0xe380('0x7a')+_0x1b29cb);}_0xc90e43[_0x25b0e6[_0xe380('0x55')]['mapKey']]=_0x25b0e6[_0xe380('0x55')][_0xe380('0x74')];})['then'](function(){return db[_0xe380('0x39')][_0xe380('0x53')]({'where':{'id':_0x25b0e6['params']['id']},'include':[{'model':db[_0xe380('0x7b')],'as':_0xe380('0x7c'),'include':[{'model':db[_0xe380('0x6e')],'as':_0xe380('0x7d'),'where':_0xc90e43,'limit':0x1,'order':[[_0xe380('0x7e'),_0xe380('0x7f')]]}]},{'model':db[_0xe380('0x80')],'as':_0xe380('0x81')}]});})['then'](handleEntityNotFound(_0x67a7ad,null))[_0xe380('0x1c')](function(_0x4959a6){if(_0x4959a6&&_0x4959a6['List']){_0x3c0cb9[_0xe380('0x82')]=_0x4959a6;_0x3c0cb9[_0xe380('0x83')]=_0x4959a6[_0xe380('0x81')];_0x3c0cb9[_0xe380('0x84')]=_0x4959a6[_0xe380('0x7c')];_0x3c0cb9[_0xe380('0x83')]=_['orderBy'](_0x3c0cb9[_0xe380('0x83')],['priority'],['asc']);if(_0x3c0cb9[_0xe380('0x82')][_0xe380('0x81')]){delete _0x3c0cb9['account'][_0xe380('0x81')];}if(_0x3c0cb9['account']['List']&&_0x3c0cb9[_0xe380('0x82')]['List'][_0xe380('0x7d')][_0xe380('0x44')]){return _0x3c0cb9[_0xe380('0x82')][_0xe380('0x7c')][_0xe380('0x7d')][0x0];}var _0x47a951=_[_0xe380('0x85')](_0x25b0e6[_0xe380('0x55')],{'firstName':_0x25b0e6[_0xe380('0x55')][_0xe380('0x74')],'ListId':_0x4959a6['ListId']});_0x47a951[_0x25b0e6[_0xe380('0x55')][_0xe380('0x77')]]=_0x25b0e6[_0xe380('0x55')][_0xe380('0x74')];return db[_0xe380('0x6e')]['create'](_0x47a951,{'fields':_0x4c3672,'raw':!![]});}})['then'](handleEntityNotFound(_0x67a7ad,null))[_0xe380('0x1c')](function(_0x1ca07d){_0x3c0cb9[_0xe380('0x86')]=_0x1ca07d;if(_0x1ca07d){var _0x256312={'ContactId':_0x1ca07d['id'],'OpenchannelAccountId':_0x25b0e6[_0xe380('0x52')]['id'],'from':(_0x1ca07d[_0xe380('0x87')]||'')+'\x20'+(_0x1ca07d[_0xe380('0x88')]||'')};var _0x4a3422={'OpenchannelAccountId':_0x25b0e6[_0xe380('0x52')]['id'],'closed':![]};if(_0x25b0e6['body'][_0xe380('0x89')]){_0x4a3422['threadId']=_0x25b0e6['body'][_0xe380('0x89')];return db[_0xe380('0x8a')][_0xe380('0x53')]({'where':_0x4a3422})[_0xe380('0x1c')](function(_0x4b3faa){if(_0x4b3faa){return[_0x4b3faa,![]];}_0x256312[_0xe380('0x89')]=_0x25b0e6[_0xe380('0x55')][_0xe380('0x89')];_0x256312[_0xe380('0x8b')]=_0x25b0e6[_0xe380('0x55')][_0xe380('0x8b')];return db[_0xe380('0x8a')][_0xe380('0x54')](_0x256312)[_0xe380('0x1c')](function(_0x36eeb1){return[_0x36eeb1,!![]];});});}else{_0x4a3422[_0xe380('0x89')]=null;}_0x4a3422['ContactId']=_0x1ca07d['id'];return db[_0xe380('0x8a')][_0xe380('0x53')]({'where':_0x4a3422})[_0xe380('0x1c')](function(_0x29fce1){if(_0x29fce1){return[_0x29fce1,![]];}return db[_0xe380('0x8a')][_0xe380('0x54')](_0x256312)[_0xe380('0x1c')](function(_0x985509){return[_0x985509,!![]];});});}})[_0xe380('0x8c')](function(_0xc69323,_0x14c982){if(_0xc69323){_0x50f02b=_0x14c982;if(!_0x14c982){var _0x55b2b2={'from':(_0x3c0cb9['contact'][_0xe380('0x87')]||'')+'\x20'+(_0x3c0cb9[_0xe380('0x86')][_0xe380('0x88')]||'')};if(_0x25b0e6['body'][_0xe380('0x89')]&&_0x25b0e6[_0xe380('0x55')]['messageId']&&_0x25b0e6[_0xe380('0x55')][_0xe380('0x89')]!=_0x25b0e6[_0xe380('0x55')][_0xe380('0x8d')]){_0x55b2b2[_0xe380('0x89')]=_0x25b0e6['body'][_0xe380('0x8d')];}return _0xc69323[_0xe380('0x5c')](_0x55b2b2);}else{return _0xc69323;}}})[_0xe380('0x1c')](function(_0x456b77){_0x3c0cb9['interaction']=_0x456b77[_0xe380('0x2f')]({'plain':!![]});_0x3c0cb9[_0xe380('0x8e')][_0xe380('0x8f')]=_0x50f02b;if(_0x3c0cb9[_0xe380('0x8e')][_0xe380('0x8f')]){if(_0x3c0cb9['account'][_0xe380('0x90')]){_0x3c0cb9[_0xe380('0x83')][_0xe380('0x91')]({'id':0x0,'priority':_0x3c0cb9['applications']['length']+0x1,'app':_0xe380('0x92'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xe380('0x54')]({'body':_0x25b0e6[_0xe380('0x55')]['body'],'OpenchannelAccountId':_0x25b0e6[_0xe380('0x52')]['id'],'OpenchannelInteractionId':_0x456b77['id'],'direction':'in','ContactId':_0x3c0cb9[_0xe380('0x86')]['id'],'AttachmentId':_0x25b0e6['body'][_0xe380('0x93')]});})['then'](function(_0x5c9407){_0x3c0cb9[_0xe380('0x24')]=_0x5c9407;if(_0x3c0cb9['interaction'][_0xe380('0x94')]){return db[_0xe380('0x95')]['find']({'attributes':['id',_0xe380('0x34')],'where':{'id':_0x3c0cb9[_0xe380('0x8e')][_0xe380('0x94')]}})['then'](function(_0x3f0408){if(_0x3f0408){_0x3c0cb9[_0xe380('0x83')][_0xe380('0x96')]({'id':0x0,'priority':0x0,'app':_0xe380('0x97'),'appdata':_0x3f0408[_0xe380('0x34')]+','+(_0x3c0cb9[_0xe380('0x82')][_0xe380('0x98')]||0xa),'interval':'*,*,*,*'});_0x3c0cb9[_0xe380('0x99')]=![];}return respondWithRpcPromise(_0xe380('0x9a'),_0xe380('0x9b'),_0x3c0cb9);});}return respondWithRpcPromise(_0xe380('0x9a'),'startRouting',_0x3c0cb9);})['then'](function(_0x3b34d2){respondWithRpcPromise(_0xe380('0x9c'),_0xe380('0x9c'),{'event':_0xe380('0x6c'),'message':_0x3b34d2},client9002);return _0x3b34d2;})[_0xe380('0x1c')](respondWithResult(_0x67a7ad,null))[_0xe380('0x50')](handleError(_0x67a7ad,null));};exports[_0xe380('0x9d')]=function(_0x1b32f4,_0x5b13c3){var _0x5f32f0=_0x1b32f4[_0xe380('0x52')]['id'];var _0x202945=_0x1b32f4[_0xe380('0x55')];var _0x4d3648=0xc8;var _0x571b53=null;return db[_0xe380('0x9e')][_0xe380('0x9f')]({'isolationLevel':db['sequelize']['Transaction'][_0xe380('0xa0')][_0xe380('0xa1')]},function(_0x69296){return db['OpenchannelAccount'][_0xe380('0x6a')]({'where':{'id':_0x5f32f0},'transaction':_0x69296})[_0xe380('0x1c')](function(_0x492f6b){if(_0x492f6b){return db['OpenchannelApplication'][_0xe380('0x32')]({'where':{'OpenchannelAccountId':_0x5f32f0},'transaction':_0x69296})[_0xe380('0x1c')](function(){var _0x5d7b59=_[_0xe380('0x62')](_0x202945,function(_0x5e7594){_0x5e7594[_0xe380('0x5f')]=_0x5f32f0;return _0x5e7594;});return db[_0xe380('0x80')][_0xe380('0xa2')](_0x5d7b59,{'transaction':_0x69296});});}else{_0x4d3648=0x194;_0x571b53=[];}});})[_0xe380('0x1c')](function(){if(_0x4d3648!==0x194){return db[_0xe380('0x80')][_0xe380('0xa3')]({'where':{'OpenchannelAccountId':_0x5f32f0},'order':'priority'})[_0xe380('0x1c')](function(_0x2aaa68){_0x571b53=_0x2aaa68;});}})[_0xe380('0x50')](function(_0x288d18){_0x4d3648=0x1f4;logger['error'](_0x288d18[_0xe380('0x33')]);if(_0x288d18[_0xe380('0x34')]){delete _0x288d18['name'];}_0x571b53=_0x288d18;})[_0xe380('0xa4')](function(){if(_0x571b53===null){_0x5b13c3['sendStatus'](_0x4d3648);}else{if(_0x4d3648===0x1f4){_0x5b13c3[_0xe380('0x26')](_0x4d3648)[_0xe380('0x35')](_0x571b53);}else{_0x5b13c3[_0xe380('0x26')](_0x4d3648)['json'](_0x571b53);}}});};exports[_0xe380('0xa5')]=function(_0x42c834,_0xb889a1,_0x1d3932){var _0x55473e={};var _0x2ab73e={};var _0x3bc360;var _0xf5a48;return db[_0xe380('0x39')]['findOne']({'where':{'id':_0x42c834[_0xe380('0x52')]['id']}})[_0xe380('0x1c')](handleEntityNotFound(_0xb889a1,null))[_0xe380('0x1c')](function(_0x5acd82){if(_0x5acd82){_0x3bc360=_0x5acd82;_0x2ab73e['model']=_['keys'](db[_0xe380('0x80')][_0xe380('0x3a')]);_0x2ab73e['query']=_[_0xe380('0x3f')](_0x42c834[_0xe380('0x3e')]);_0x2ab73e[_0xe380('0x40')]=_['intersection'](_0x2ab73e[_0xe380('0x3d')],_0x2ab73e[_0xe380('0x3e')]);_0x55473e['attributes']=_['intersection'](_0x2ab73e['model'],qs[_0xe380('0x43')](_0x42c834['query'][_0xe380('0x43')]));_0x55473e[_0xe380('0x42')]=_0x55473e['attributes'][_0xe380('0x44')]?_0x55473e[_0xe380('0x42')]:_0x2ab73e[_0xe380('0x3d')];_0x55473e[_0xe380('0x47')]=qs['sort'](_0x42c834['query']['sort']);_0x55473e[_0xe380('0x49')]=qs[_0xe380('0x40')](_['pick'](_0x42c834[_0xe380('0x3e')],_0x2ab73e[_0xe380('0x40')]));if(_0x42c834[_0xe380('0x3e')][_0xe380('0x61')]){_0x55473e[_0xe380('0x49')]=_[_0xe380('0x4b')](_0x55473e[_0xe380('0x49')],{'$or':_['map'](_0x55473e[_0xe380('0x42')],function(_0x4fdc08){var _0x5db0bd={};_0x5db0bd[_0x4fdc08]={'$like':'%'+_0x42c834[_0xe380('0x3e')]['filter']+'%'};return _0x5db0bd;})});}_0x55473e=_[_0xe380('0x4b')]({},_0x55473e,_0x42c834['options']);return _0x3bc360[_0xe380('0xa5')](_0x55473e);}})[_0xe380('0x1c')](function(_0x44f979){if(_0x44f979){_0xf5a48=_0x44f979[_0xe380('0x44')];if(!_0x42c834[_0xe380('0x3e')][_0xe380('0x45')]('nolimit')){_0x55473e[_0xe380('0x29')]=qs[_0xe380('0x29')](_0x42c834[_0xe380('0x3e')][_0xe380('0x29')]);_0x55473e['offset']=qs[_0xe380('0x2c')](_0x42c834[_0xe380('0x3e')][_0xe380('0x2c')]);}return _0x3bc360[_0xe380('0xa5')](_0x55473e);}})[_0xe380('0x1c')](function(_0x4c3291){if(_0x4c3291){return _0x4c3291?{'count':_0xf5a48,'rows':_0x4c3291}:null;}})[_0xe380('0x1c')](respondWithResult(_0xb889a1,null))[_0xe380('0x50')](handleError(_0xb889a1,null));};exports[_0xe380('0xa6')]=function(_0x5504dc,_0x36284f,_0x392b9d){var _0x5f3a3={'raw':![],'where':{}};var _0x91dba3={};var _0x347053={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe380('0x6a')]({'where':{'id':_0x5504dc[_0xe380('0x52')]['id']}})[_0xe380('0x1c')](handleEntityNotFound(_0x36284f,null))[_0xe380('0x1c')](function(_0x472b51){if(_0x472b51){_0x91dba3[_0xe380('0x3d')]=_[_0xe380('0x3f')](db['OpenchannelInteraction'][_0xe380('0x3a')]);_0x91dba3[_0xe380('0x3e')]=_[_0xe380('0x3f')](_0x5504dc[_0xe380('0x3e')]);_0x91dba3['filters']=_[_0xe380('0x41')](_0x91dba3['model'],_0x91dba3[_0xe380('0x3e')]);_0x5f3a3[_0xe380('0x42')]=_[_0xe380('0x41')](_0x91dba3['model'],qs[_0xe380('0x43')](_0x5504dc[_0xe380('0x3e')][_0xe380('0x43')]));_0x5f3a3[_0xe380('0x42')]=_0x5f3a3[_0xe380('0x42')][_0xe380('0x44')]?_0x5f3a3[_0xe380('0x42')]:_0x91dba3[_0xe380('0x3d')];if(!_0x5504dc['query']['hasOwnProperty'](_0xe380('0x46'))){_0x5f3a3[_0xe380('0x29')]=qs['limit'](_0x5504dc[_0xe380('0x3e')][_0xe380('0x29')]);_0x5f3a3[_0xe380('0x2c')]=qs[_0xe380('0x2c')](_0x5504dc[_0xe380('0x3e')]['offset']);}_0x5f3a3['order']=qs[_0xe380('0x48')](_0x5504dc[_0xe380('0x3e')]['sort']);_0x5f3a3[_0xe380('0x49')]=qs[_0xe380('0x40')](_[_0xe380('0x4a')](_0x5504dc[_0xe380('0x3e')],_0x91dba3['filters']));_0x5f3a3[_0xe380('0x49')]['OpenchannelAccountId']=_0x472b51['id'];if(_0x5504dc[_0xe380('0x3e')][_0xe380('0x61')]){_0x5f3a3['where']=_['merge'](_0x5f3a3[_0xe380('0x49')],{'$or':_['map'](_0x5f3a3[_0xe380('0x42')],function(_0x3de9fd){var _0x1e563={};_0x1e563[_0x3de9fd]={'$like':'%'+_0x5504dc[_0xe380('0x3e')][_0xe380('0x61')]+'%'};return _0x1e563;})});}_0x5f3a3=_[_0xe380('0x4b')]({},_0x5f3a3,_0x5504dc[_0xe380('0x4d')]);return db[_0xe380('0x8a')][_0xe380('0x2b')]({'where':_0x5f3a3[_0xe380('0x49')]})[_0xe380('0x1c')](function(_0x1e1af2){_0x347053[_0xe380('0x2b')]=_0x1e1af2;if(_0x5504dc['query']['includeAll']){_0x5f3a3[_0xe380('0x4e')]=[{'model':db[_0xe380('0x6e')],'as':_0xe380('0xa7'),'required':![]},{'model':db[_0xe380('0x95')],'as':_0xe380('0xa8'),'attributes':[_0xe380('0x34'),'fullname',_0xe380('0xa9')],'required':![]},{'model':db['Tag'],'as':_0xe380('0xaa'),'attributes':['id','name',_0xe380('0xab')],'where':_0x5504dc['query'][_0xe380('0xac')]?{'id':_0x5504dc[_0xe380('0x3e')][_0xe380('0xac')]}:undefined,'required':_0x5504dc[_0xe380('0x3e')][_0xe380('0xac')]?!![]:![]}];}return db[_0xe380('0x8a')]['findAll'](_0x5f3a3);})['then'](function(_0x1c6e04){_0x347053['rows']=_0x1c6e04;return _0x347053;});}})[_0xe380('0x1c')](respondWithFilteredResult(_0x36284f,_0x5f3a3))[_0xe380('0x50')](handleError(_0x36284f,null));};exports[_0xe380('0xad')]=function(_0x3e9440,_0x5e4023,_0x307dc1){return db['OpenchannelAccount']['find']({'where':{'id':_0x3e9440[_0xe380('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e4023,null))[_0xe380('0x1c')](function(_0x3b6a4f){if(_0x3b6a4f){return _0x3b6a4f[_0xe380('0xad')](_0x3e9440['body']['ids'],_[_0xe380('0xae')](_0x3e9440[_0xe380('0x55')],[_0xe380('0x67'),'id'])||{})[_0xe380('0x8c')](function(_0xeba16b){for(var _0x117d64=0x0;_0x117d64<_0x3e9440[_0xe380('0x55')][_0xe380('0x67')][_0xe380('0x44')];_0x117d64+=0x1){socket['emit'](_0xe380('0xaf'),{'UserId':Number(_0x3e9440['body']['ids'][_0x117d64]),'OpenchannelAccountId':Number(_0x3e9440[_0xe380('0x52')]['id'])});}return _0xeba16b;});}})['then'](respondWithResult(_0x5e4023,null))[_0xe380('0x50')](handleError(_0x5e4023,null));};exports['removeAgents']=function(_0x3d66e1,_0x547ab2,_0x1c232c){return db['OpenchannelAccount'][_0xe380('0x53')]({'where':{'id':_0x3d66e1[_0xe380('0x52')]['id']}})[_0xe380('0x1c')](handleEntityNotFound(_0x547ab2,null))['then'](function(_0x194c59){if(_0x194c59){return _0x194c59[_0xe380('0xb0')](_0x3d66e1[_0xe380('0x3e')][_0xe380('0x67')])[_0xe380('0x1c')](function(){if(_[_0xe380('0xb1')](_0x3d66e1[_0xe380('0x3e')][_0xe380('0x67')])){for(var _0x19d527=0x0;_0x19d527<_0x3d66e1[_0xe380('0x3e')][_0xe380('0x67')][_0xe380('0x44')];_0x19d527+=0x1){socket[_0xe380('0xb2')](_0xe380('0xb3'),{'UserId':Number(_0x3d66e1[_0xe380('0x3e')]['ids'][_0x19d527]),'OpenchannelAccountId':Number(_0x3d66e1['params']['id'])});}}else{socket[_0xe380('0xb2')](_0xe380('0xb3'),{'UserId':Number(_0x3d66e1[_0xe380('0x3e')][_0xe380('0x67')]),'OpenchannelAccountId':Number(_0x3d66e1['params']['id'])});}});}})[_0xe380('0x1c')](respondWithStatusCode(_0x547ab2,null))['catch'](handleError(_0x547ab2,null));};exports['getAgents']=function(_0x1cfd79,_0x4d7f2b,_0x4bf489){var _0x1b1808={};var _0x5dc42e={};var _0x57c020;var _0x29cdea;return db['OpenchannelAccount'][_0xe380('0x6a')]({'where':{'id':_0x1cfd79[_0xe380('0x52')]['id']}})[_0xe380('0x1c')](handleEntityNotFound(_0x4d7f2b,null))[_0xe380('0x1c')](function(_0x25ef7f){if(_0x25ef7f){_0x57c020=_0x25ef7f;_0x5dc42e[_0xe380('0x3d')]=_[_0xe380('0x3f')](db[_0xe380('0x95')]['rawAttributes']);_0x5dc42e[_0xe380('0x3e')]=_[_0xe380('0x3f')](_0x1cfd79[_0xe380('0x3e')]);_0x5dc42e[_0xe380('0x40')]=_[_0xe380('0x41')](_0x5dc42e[_0xe380('0x3d')],_0x5dc42e[_0xe380('0x3e')]);_0x1b1808['attributes']=_['intersection'](_0x5dc42e[_0xe380('0x3d')],qs[_0xe380('0x43')](_0x1cfd79['query'][_0xe380('0x43')]));_0x1b1808['attributes']=_0x1b1808[_0xe380('0x42')][_0xe380('0x44')]?_0x1b1808['attributes']:_0x5dc42e[_0xe380('0x3d')];_0x1b1808[_0xe380('0x47')]=qs[_0xe380('0x48')](_0x1cfd79[_0xe380('0x3e')][_0xe380('0x48')]);_0x1b1808['where']=qs[_0xe380('0x40')](_['pick'](_0x1cfd79[_0xe380('0x3e')],_0x5dc42e[_0xe380('0x40')]));if(_0x1cfd79[_0xe380('0x3e')][_0xe380('0x61')]){_0x1b1808[_0xe380('0x49')]=_['merge'](_0x1b1808[_0xe380('0x49')],{'$or':_[_0xe380('0x62')](_0x1b1808['attributes'],function(_0x403b55){var _0xd2169c={};_0xd2169c[_0x403b55]={'$like':'%'+_0x1cfd79[_0xe380('0x3e')]['filter']+'%'};return _0xd2169c;})});}_0x1b1808=_[_0xe380('0x4b')]({},_0x1b1808,_0x1cfd79['options']);return _0x57c020[_0xe380('0xb4')](_0x1b1808);}})[_0xe380('0x1c')](function(_0x2c5b03){if(_0x2c5b03){_0x29cdea=_0x2c5b03[_0xe380('0x44')];if(!_0x1cfd79[_0xe380('0x3e')][_0xe380('0x45')](_0xe380('0x46'))){_0x1b1808[_0xe380('0x29')]=qs[_0xe380('0x29')](_0x1cfd79['query'][_0xe380('0x29')]);_0x1b1808[_0xe380('0x2c')]=qs[_0xe380('0x2c')](_0x1cfd79[_0xe380('0x3e')][_0xe380('0x2c')]);}return _0x57c020[_0xe380('0xb4')](_0x1b1808);}})['then'](function(_0x2119cf){if(_0x2119cf){return _0x2119cf?{'count':_0x29cdea,'rows':_0x2119cf}:null;}})[_0xe380('0x1c')](respondWithResult(_0x4d7f2b,null))[_0xe380('0x50')](handleError(_0x4d7f2b,null));};exports['send']=function(_0x622bf4,_0x51c688,_0x649811){var _0x13d3cd,_0x45f176,_0x565471;if(_[_0xe380('0x75')](_0x622bf4[_0xe380('0x55')][_0xe380('0x55')])||_0x622bf4[_0xe380('0x55')][_0xe380('0x55')]===''){throw new db[(_0xe380('0x6f'))][(_0xe380('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x622bf4['body']['to'])){}_0x13d3cd=_0x622bf4[_0xe380('0x55')]['to'];return db[_0xe380('0x39')][_0xe380('0x6a')]({'where':{'id':_0x622bf4['params']['id']}})['then'](handleEntityNotFound(_0x51c688,null))[_0xe380('0x1c')](function(_0x1d6b63){if(_0x1d6b63){return db['OpenchannelAccount'][_0xe380('0x53')]({'where':{'id':_0x1d6b63['id']},'include':[{'model':db['CmList'],'as':_0xe380('0x7c'),'include':[{'model':db[_0xe380('0x6e')],'as':_0xe380('0x7d'),'where':{[_0x1d6b63[_0xe380('0x77')]]:_0x13d3cd},'limit':0x1,'order':[[_0xe380('0x7e'),_0xe380('0x7f')]]}]}]})[_0xe380('0x1c')](handleEntityNotFound(_0x51c688,null))[_0xe380('0x1c')](function(_0x53716d){if(_0x53716d&&_0x53716d[_0xe380('0x7c')]){_0x45f176=_0x53716d[_0xe380('0x2f')]({'plain':!![]});if(_0x45f176[_0xe380('0x7c')]&&_0x45f176['List'][_0xe380('0x7d')][_0xe380('0x44')]){return _0x45f176[_0xe380('0x7c')][_0xe380('0x7d')][0x0];}return db['CmContact'][_0xe380('0x54')](_[_0xe380('0x85')](_0x622bf4[_0xe380('0x55')],{'firstName':_0x13d3cd,[_0x53716d[_0xe380('0x77')]]:_0x13d3cd,'phone':_0x13d3cd,'ListId':_0x45f176[_0xe380('0xb5')]}));}})['then'](handleEntityNotFound(_0x51c688,null))[_0xe380('0x1c')](function(_0x1f1d9c){if(_0x1f1d9c){_0x565471=_0x1f1d9c;return db['OpenchannelInteraction'][_0xe380('0x53')]({'where':{'ContactId':_0x565471['id'],'closed':![],'OpenchannelAccountId':_0x45f176['id']}})['then'](function(_0x5ba192){if(_0x5ba192){return[_0x5ba192,![]];}return db[_0xe380('0x8a')][_0xe380('0x54')]({'UserId':_0x622bf4[_0xe380('0x56')]['id'],'ContactId':_0x565471['id'],'OpenchannelAccountId':_0x45f176['id'],'lastMsgDirection':_0xe380('0xb6'),'Messages':[_[_0xe380('0x4b')](_0x622bf4[_0xe380('0x55')],{'read':![],'body':_0x622bf4[_0xe380('0x55')][_0xe380('0x55')],'OpenchannelAccountId':_0x45f176['id'],'UserId':_0x622bf4[_0xe380('0x56')]['id'],'ContactId':_0x565471['id']})]},{'include':[{'model':db[_0xe380('0xb7')],'as':'Messages'}]})[_0xe380('0x1c')](function(_0x596cfe){return[_0x596cfe,!![]];});});}})[_0xe380('0x8c')](function(_0x6d84d0,_0x1aac13){if(_0x1aac13){return _0x6d84d0;}return db['OpenchannelMessage'][_0xe380('0x54')](_[_0xe380('0x4b')](_0x622bf4[_0xe380('0x55')],{'read':![],'body':_0x622bf4[_0xe380('0x55')][_0xe380('0x55')],'OpenchannelAccountId':_0x45f176['id'],'OpenchannelInteractionId':_0x6d84d0['id'],'UserId':_0x622bf4[_0xe380('0x56')]['id'],'ContactId':_0x565471['id']}))[_0xe380('0x1c')](function(_0x1f24b0){_0x6d84d0[_0xe380('0xb8')][_0xe380('0xb9')]=[];_0x6d84d0['dataValues'][_0xe380('0xb9')][_0xe380('0x91')](_0x1f24b0['dataValues']);return _0x6d84d0;});});}})[_0xe380('0x1c')](respondWithResult(_0x51c688,null))[_0xe380('0x50')](handleError(_0x51c688,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 3f4f9a6..cde743c 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 _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x0bb5,0x148));var _0x50bb=function(_0x4f61dd,_0x44c6a5){_0x4f61dd=_0x4f61dd-0x0;var _0x2b31f6=_0x0bb5[_0x4f61dd];return _0x2b31f6;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x2dae=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x3983f9,_0x366df7){var _0x3e6afb=function(_0x42307d){while(--_0x42307d){_0x3983f9['push'](_0x3983f9['shift']());}};_0x3e6afb(++_0x366df7);}(_0x2dae,0xc3));var _0xe2da=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0x2dae[_0x4e198a];return _0xb84bfe;};'use strict';var EventEmitter=require(_0xe2da('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xe2da('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe2da('0x2')](0x0);var events={'afterCreate':_0xe2da('0x3'),'afterUpdate':_0xe2da('0x4'),'afterDestroy':_0xe2da('0x5')};function emitEvent(_0x481d97){return function(_0x25b9f2,_0x439b5d,_0x77e45e){OpenchannelAccountEvents[_0xe2da('0x6')](_0x481d97+':'+_0x25b9f2['id'],_0x25b9f2);OpenchannelAccountEvents['emit'](_0x481d97,_0x25b9f2);_0x77e45e(null);};}for(var e in events){if(events[_0xe2da('0x7')](e)){var event=events[e];OpenchannelAccount[_0xe2da('0x8')](e,emitEvent(event));}}module[_0xe2da('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 d660417..5cbc053 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(_0x530ba3,_0x5b320e){var _0x534673=function(_0x5c46c4){while(--_0x5c46c4){_0x530ba3['push'](_0x530ba3['shift']());}};_0x534673(++_0x5b320e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x19936d,_0x2be3cc){var _0x26430f=function(_0x5bebab){while(--_0x5bebab){_0x19936d['push'](_0x19936d['shift']());}};_0x26430f(++_0x2be3cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 b270f36..11c9fcc 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 _0xd523=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message'];(function(_0x80dea1,_0x51eaa0){var _0x3c9f74=function(_0x276688){while(--_0x276688){_0x80dea1['push'](_0x80dea1['shift']());}};_0x3c9f74(++_0x51eaa0);}(_0xd523,0x153));var _0x3d52=function(_0x160515,_0x233a55){_0x160515=_0x160515-0x0;var _0x27dfa1=_0xd523[_0x160515];return _0x27dfa1;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3d52('0xb')](config[_0x3d52('0xc')],{'host':_0x3d52('0xd'),'port':0x18eb});var socket=require(_0x3d52('0xe'))(new Redis(config[_0x3d52('0xc')]));require(_0x3d52('0xf'))[_0x3d52('0x10')](socket);function respondWithRpcPromise(_0x2d966e,_0x30ee09,_0x4a5a9a){return new BPromise(function(_0x46c2e6,_0x873de6){return client[_0x3d52('0x11')](_0x2d966e,_0x4a5a9a)[_0x3d52('0x12')](function(_0x2675d2){logger['info'](_0x3d52('0x13'),_0x30ee09,'request\x20sent');logger['debug'](_0x3d52('0x14'),_0x30ee09,_0x3d52('0x15'),JSON['stringify'](_0x2675d2));if(_0x2675d2['error']){if(_0x2675d2['error'][_0x3d52('0x16')]===0x1f4){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x873de6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x46c2e6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}else{logger[_0x3d52('0x19')](_0x3d52('0x13'),_0x30ee09,'request\x20sent');_0x46c2e6(_0x2675d2[_0x3d52('0x1a')][_0x3d52('0x18')]);}})[_0x3d52('0x1b')](function(_0x54a514){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x54a514);_0x873de6(_0x54a514);});});} \ No newline at end of file +var _0xdc9b=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x30f610,_0x34a818){var _0x380d52=function(_0x114b68){while(--_0x114b68){_0x30f610['push'](_0x30f610['shift']());}};_0x380d52(++_0x34a818);}(_0xdc9b,0x70));var _0xbdc9=function(_0x53076f,_0x174a71){_0x53076f=_0x53076f-0x0;var _0x30310b=_0xdc9b[_0x53076f];return _0x30310b;};'use strict';var _=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var moment=require(_0xbdc9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdc9('0x3'));var fs=require('fs');var Redis=require(_0xbdc9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbdc9('0x5'))(_0xbdc9('0x6'));var config=require('../../config/environment');var jayson=require(_0xbdc9('0x7'));var client=jayson[_0xbdc9('0x8')]['http']({'port':0x232a});config[_0xbdc9('0x9')]=_['defaults'](config[_0xbdc9('0x9')],{'host':_0xbdc9('0xa'),'port':0x18eb});var socket=require(_0xbdc9('0xb'))(new Redis(config[_0xbdc9('0x9')]));require(_0xbdc9('0xc'))[_0xbdc9('0xd')](socket);function respondWithRpcPromise(_0x7e6df8,_0x2d1c34,_0x1a6e8f){return new BPromise(function(_0x289f6e,_0x3e58f4){return client[_0xbdc9('0xe')](_0x7e6df8,_0x1a6e8f)[_0xbdc9('0xf')](function(_0xb5a15b){logger[_0xbdc9('0x10')](_0xbdc9('0x11'),_0x2d1c34,_0xbdc9('0x12'));logger[_0xbdc9('0x13')](_0xbdc9('0x14'),_0x2d1c34,_0xbdc9('0x12'),JSON[_0xbdc9('0x15')](_0xb5a15b));if(_0xb5a15b['error']){if(_0xb5a15b[_0xbdc9('0x16')]['code']===0x1f4){logger['error'](_0xbdc9('0x11'),_0x2d1c34,_0xb5a15b[_0xbdc9('0x16')]['message']);return _0x3e58f4(_0xb5a15b[_0xbdc9('0x16')][_0xbdc9('0x17')]);}logger[_0xbdc9('0x16')](_0xbdc9('0x11'),_0x2d1c34,_0xb5a15b[_0xbdc9('0x16')][_0xbdc9('0x17')]);return _0x289f6e(_0xb5a15b['error']['message']);}else{logger[_0xbdc9('0x10')](_0xbdc9('0x11'),_0x2d1c34,_0xbdc9('0x12'));_0x289f6e(_0xb5a15b['result']['message']);}})[_0xbdc9('0x18')](function(_0x2aad7b){logger['error'](_0xbdc9('0x11'),_0x2d1c34,_0x2aad7b);_0x3e58f4(_0x2aad7b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 162b024..996b4d3 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 _0x593e=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x2a1d99,_0x2da036){var _0x2d82a5=function(_0x524ca7){while(--_0x524ca7){_0x2a1d99['push'](_0x2a1d99['shift']());}};_0x2d82a5(++_0x2da036);}(_0x593e,0xcb));var _0xe593=function(_0x131bce,_0x44b2df){_0x131bce=_0x131bce-0x0;var _0x77091=_0x593e[_0x131bce];return _0x77091;};'use strict';var OpenchannelAccountEvents=require(_0xe593('0x0'));var events=[_0xe593('0x1'),_0xe593('0x2'),_0xe593('0x3')];function createListener(_0x43dabb,_0x184a6b){return function(_0x2c7c48){_0x184a6b[_0xe593('0x4')](_0x43dabb,_0x2c7c48);};}function removeListener(_0x550574,_0x8a87e8){return function(){OpenchannelAccountEvents[_0xe593('0x5')](_0x550574,_0x8a87e8);};}exports[_0xe593('0x6')]=function(_0x1e50d3){for(var _0x3b7082=0x0,_0x14cff3=events[_0xe593('0x7')];_0x3b7082<_0x14cff3;_0x3b7082++){var _0x307dad=events[_0x3b7082];var _0x169c08=createListener(_0xe593('0x8')+_0x307dad,_0x1e50d3);OpenchannelAccountEvents['on'](_0x307dad,_0x169c08);}}; \ No newline at end of file +var _0x2746=['update','emit','removeListener','register','length','openchannelAccount:','remove'];(function(_0x355c9b,_0x53dffe){var _0x1b904e=function(_0x31f744){while(--_0x31f744){_0x355c9b['push'](_0x355c9b['shift']());}};_0x1b904e(++_0x53dffe);}(_0x2746,0x19c));var _0x6274=function(_0x58db0f,_0x1d5956){_0x58db0f=_0x58db0f-0x0;var _0x54c015=_0x2746[_0x58db0f];return _0x54c015;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x6274('0x0'),_0x6274('0x1')];function createListener(_0x459232,_0x3bf3b9){return function(_0x3cac45){_0x3bf3b9[_0x6274('0x2')](_0x459232,_0x3cac45);};}function removeListener(_0x4ab07e,_0x52b270){return function(){OpenchannelAccountEvents[_0x6274('0x3')](_0x4ab07e,_0x52b270);};}exports[_0x6274('0x4')]=function(_0x1978ff){for(var _0x534aee=0x0,_0x1d22fb=events[_0x6274('0x5')];_0x534aee<_0x1d22fb;_0x534aee++){var _0x3a8ec1=events[_0x534aee];var _0x3158f6=createListener(_0x6274('0x6')+_0x3a8ec1,_0x1978ff);OpenchannelAccountEvents['on'](_0x3a8ec1,_0x3158f6);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c6e8109..ddae048 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 _0x5796=['put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x1b4c99,_0x5999cd){var _0x522e31=function(_0x4e08e3){while(--_0x4e08e3){_0x1b4c99['push'](_0x1b4c99['shift']());}};_0x522e31(++_0x5999cd);}(_0x5796,0x1f1));var _0x6579=function(_0x2877dd,_0x3f7153){_0x2877dd=_0x2877dd-0x0;var _0x5888b5=_0x5796[_0x2877dd];return _0x5888b5;};'use strict';var multer=require(_0x6579('0x0'));var util=require('util');var path=require(_0x6579('0x1'));var timeout=require(_0x6579('0x2'));var express=require('express');var router=express[_0x6579('0x3')]();var fs_extra=require(_0x6579('0x4'));var auth=require(_0x6579('0x5'));var interaction=require(_0x6579('0x6'));var config=require(_0x6579('0x7'));var controller=require(_0x6579('0x8'));router[_0x6579('0x9')]('/',auth[_0x6579('0xa')](),controller[_0x6579('0xb')]);router[_0x6579('0x9')](_0x6579('0xc'),auth[_0x6579('0xa')](),controller[_0x6579('0xd')]);router[_0x6579('0xe')]('/',auth['isAuthenticated'](),controller[_0x6579('0xf')]);router[_0x6579('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6579('0x11')]);router['delete'](_0x6579('0xc'),auth[_0x6579('0xa')](),controller[_0x6579('0x12')]);module['exports']=router; \ No newline at end of file +var _0x712b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','create','/:id','update','delete','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x712b,0x13f));var _0xb712=function(_0x4b471c,_0x531570){_0x4b471c=_0x4b471c-0x0;var _0x18ad28=_0x712b[_0x4b471c];return _0x18ad28;};'use strict';var multer=require('multer');var util=require(_0xb712('0x0'));var path=require(_0xb712('0x1'));var timeout=require(_0xb712('0x2'));var express=require(_0xb712('0x3'));var router=express['Router']();var fs_extra=require(_0xb712('0x4'));var auth=require(_0xb712('0x5'));var interaction=require(_0xb712('0x6'));var config=require(_0xb712('0x7'));var controller=require(_0xb712('0x8'));router[_0xb712('0x9')]('/',auth[_0xb712('0xa')](),controller[_0xb712('0xb')]);router['get']('/:id',auth[_0xb712('0xa')](),controller[_0xb712('0xc')]);router['post']('/',auth[_0xb712('0xa')](),controller[_0xb712('0xd')]);router['put'](_0xb712('0xe'),auth[_0xb712('0xa')](),controller[_0xb712('0xf')]);router[_0xb712('0x10')](_0xb712('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xb712('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 882e0b2..6261dd1 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 _0x4883=['noop','TEXT','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4883,0x166));var _0x3488=function(_0x8fc126,_0x299b51){_0x8fc126=_0x8fc126-0x0;var _0x14643a=_0x4883[_0x8fc126];return _0x14643a;};'use strict';var Sequelize=require(_0x3488('0x0'));module[_0x3488('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3488('0x2')},'appdata':{'type':Sequelize[_0x3488('0x3')]()},'description':{'type':Sequelize[_0x3488('0x4')]},'interval':{'type':Sequelize[_0x3488('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x524c=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x524c,0xb6));var _0xc524=function(_0x59b22c,_0x425f97){_0x59b22c=_0x59b22c-0x0;var _0x45dcc7=_0x524c[_0x59b22c];return _0x45dcc7;};'use strict';var Sequelize=require(_0xc524('0x0'));module[_0xc524('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc524('0x2')],'allowNull':![],'defaultValue':_0xc524('0x3')},'appdata':{'type':Sequelize[_0xc524('0x4')]()},'description':{'type':Sequelize[_0xc524('0x2')]},'interval':{'type':Sequelize[_0xc524('0x2')],'defaultValue':_0xc524('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 612379e..8f33a37 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 _0x3e74=['create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','OpenchannelApplication','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find'];(function(_0x26cdac,_0x569ff1){var _0x39d56e=function(_0x46b91a){while(--_0x46b91a){_0x26cdac['push'](_0x26cdac['shift']());}};_0x39d56e(++_0x569ff1);}(_0x3e74,0x1ca));var _0x43e7=function(_0x3c587d,_0x1b4853){_0x3c587d=_0x3c587d-0x0;var _0x726ea6=_0x3e74[_0x3c587d];return _0x726ea6;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43e7('0x3'));var moment=require(_0x43e7('0x4'));var BPromise=require(_0x43e7('0x5'));var Mustache=require(_0x43e7('0x6'));var util=require(_0x43e7('0x7'));var path=require(_0x43e7('0x8'));var sox=require(_0x43e7('0x9'));var csv=require(_0x43e7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43e7('0xb'));var _=require(_0x43e7('0xc'));var squel=require(_0x43e7('0xd'));var crypto=require(_0x43e7('0xe'));var jsforce=require(_0x43e7('0xf'));var deskjs=require(_0x43e7('0x10'));var toCsv=require(_0x43e7('0xa'));var querystring=require(_0x43e7('0x11'));var Papa=require('papaparse');var Redis=require(_0x43e7('0x12'));var authService=require(_0x43e7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x43e7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x15'))(_0x43e7('0x16'));var utils=require('../../config/utils');var config=require(_0x43e7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x550198,_0x4337f1){_0x4337f1=_0x4337f1||0xcc;return function(_0x2d9719){if(_0x2d9719){return _0x550198[_0x43e7('0x18')](_0x4337f1);}return _0x550198['status'](_0x4337f1)[_0x43e7('0x19')]();};}function respondWithResult(_0x512f73,_0x504f83){_0x504f83=_0x504f83||0xc8;return function(_0x3de638){if(_0x3de638){return _0x512f73[_0x43e7('0x1a')](_0x504f83)[_0x43e7('0x1b')](_0x3de638);}};}function respondWithFilteredResult(_0x5cab2d,_0x4fb6b3){return function(_0x43ca70){if(_0x43ca70){var _0x2995cb=typeof _0x4fb6b3['offset']===_0x43e7('0x1c')&&typeof _0x4fb6b3[_0x43e7('0x1d')]===_0x43e7('0x1c');var _0x813c8e=_0x43ca70[_0x43e7('0x1e')];var _0x172c04=_0x2995cb?0x0:_0x4fb6b3[_0x43e7('0x1f')];var _0x562fe6=_0x2995cb?_0x43ca70[_0x43e7('0x1e')]:_0x4fb6b3['offset']+_0x4fb6b3[_0x43e7('0x1d')];var _0x2a05b1;if(_0x562fe6>=_0x813c8e){_0x562fe6=_0x813c8e;_0x2a05b1=0xc8;}else{_0x2a05b1=0xce;}_0x5cab2d['status'](_0x2a05b1);return _0x5cab2d[_0x43e7('0x20')](_0x43e7('0x21'),_0x172c04+'-'+_0x562fe6+'/'+_0x813c8e)[_0x43e7('0x1b')](_0x43ca70);}return null;};}function patchUpdates(_0x588b1e){return function(_0x107576){try{jsonpatch[_0x43e7('0x22')](_0x107576,_0x588b1e,!![]);}catch(_0x21b891){return BPromise[_0x43e7('0x23')](_0x21b891);}return _0x107576[_0x43e7('0x24')]();};}function saveUpdates(_0x26f6ff,_0x1d440c){return function(_0x1f59c2){if(_0x1f59c2){return _0x1f59c2[_0x43e7('0x25')](_0x26f6ff)['then'](function(_0x57134c){return _0x57134c;});}return null;};}function removeEntity(_0x507002,_0x3970e9){return function(_0x3d9ef1){if(_0x3d9ef1){return _0x3d9ef1[_0x43e7('0x26')]()[_0x43e7('0x27')](function(){_0x507002['status'](0xcc)[_0x43e7('0x19')]();});}};}function handleEntityNotFound(_0x5ce725,_0x24af81){return function(_0x3ca0a2){if(!_0x3ca0a2){_0x5ce725['sendStatus'](0x194);}return _0x3ca0a2;};}function handleError(_0x2d4f89,_0x196684){_0x196684=_0x196684||0x1f4;return function(_0xf1dab){logger[_0x43e7('0x28')](_0xf1dab[_0x43e7('0x29')]);if(_0xf1dab[_0x43e7('0x2a')]){delete _0xf1dab['name'];}_0x2d4f89[_0x43e7('0x1a')](_0x196684)['send'](_0xf1dab);};}exports[_0x43e7('0x2b')]=function(_0x35a7c9,_0x591bef){var _0x30da81={},_0x546e0d={},_0xf69c38={'count':0x0,'rows':[]};var _0x58a28b=_['map'](db[_0x43e7('0x2c')][_0x43e7('0x2d')],function(_0x39f429){return{'name':_0x39f429[_0x43e7('0x2e')],'type':_0x39f429[_0x43e7('0x2f')]['key']};});_0x546e0d[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x58a28b,_0x43e7('0x2a'));_0x546e0d['query']=_['keys'](_0x35a7c9[_0x43e7('0x32')]);_0x546e0d[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x546e0d[_0x43e7('0x30')],_0x546e0d[_0x43e7('0x32')]);_0x30da81['attributes']=_[_0x43e7('0x34')](_0x546e0d[_0x43e7('0x30')],qs['fields'](_0x35a7c9[_0x43e7('0x32')][_0x43e7('0x35')]));_0x30da81['attributes']=_0x30da81['attributes'][_0x43e7('0x36')]?_0x30da81[_0x43e7('0x37')]:_0x546e0d[_0x43e7('0x30')];if(!_0x35a7c9[_0x43e7('0x32')][_0x43e7('0x38')](_0x43e7('0x39'))){_0x30da81['limit']=qs['limit'](_0x35a7c9[_0x43e7('0x32')][_0x43e7('0x1d')]);_0x30da81[_0x43e7('0x1f')]=qs[_0x43e7('0x1f')](_0x35a7c9[_0x43e7('0x32')][_0x43e7('0x1f')]);}_0x30da81[_0x43e7('0x3a')]=qs['sort'](_0x35a7c9['query'][_0x43e7('0x3b')]);_0x30da81[_0x43e7('0x3c')]=qs[_0x43e7('0x33')](_[_0x43e7('0x3d')](_0x35a7c9[_0x43e7('0x32')],_0x546e0d[_0x43e7('0x33')]),_0x58a28b);if(_0x35a7c9[_0x43e7('0x32')][_0x43e7('0x3e')]){_0x30da81[_0x43e7('0x3c')]=_[_0x43e7('0x3f')](_0x30da81[_0x43e7('0x3c')],{'$or':_[_0x43e7('0x31')](_0x58a28b,function(_0x51cba1){if(_0x51cba1[_0x43e7('0x2f')]!==_0x43e7('0x40')){var _0x5a5cde={};_0x5a5cde[_0x51cba1['name']]={'$like':'%'+_0x35a7c9[_0x43e7('0x32')][_0x43e7('0x3e')]+'%'};return _0x5a5cde;}})});}_0x30da81=_[_0x43e7('0x3f')]({},_0x30da81,_0x35a7c9[_0x43e7('0x41')]);var _0x18a942={'where':_0x30da81[_0x43e7('0x3c')]};return db[_0x43e7('0x2c')]['count'](_0x18a942)['then'](function(_0x5b1223){_0xf69c38[_0x43e7('0x1e')]=_0x5b1223;if(_0x35a7c9['query'][_0x43e7('0x42')]){_0x30da81[_0x43e7('0x43')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x30da81);})[_0x43e7('0x27')](function(_0x13ca12){_0xf69c38[_0x43e7('0x44')]=_0x13ca12;return _0xf69c38;})[_0x43e7('0x27')](respondWithFilteredResult(_0x591bef,_0x30da81))[_0x43e7('0x45')](handleError(_0x591bef,null));};exports[_0x43e7('0x46')]=function(_0x2070a3,_0x11aa86){var _0x5032bc={'raw':!![],'where':{'id':_0x2070a3[_0x43e7('0x47')]['id']}},_0x51f130={};_0x51f130[_0x43e7('0x30')]=_[_0x43e7('0x48')](db[_0x43e7('0x2c')][_0x43e7('0x2d')]);_0x51f130[_0x43e7('0x32')]=_[_0x43e7('0x48')](_0x2070a3[_0x43e7('0x32')]);_0x51f130['filters']=_['intersection'](_0x51f130['model'],_0x51f130['query']);_0x5032bc['attributes']=_[_0x43e7('0x34')](_0x51f130[_0x43e7('0x30')],qs[_0x43e7('0x35')](_0x2070a3[_0x43e7('0x32')]['fields']));_0x5032bc[_0x43e7('0x37')]=_0x5032bc[_0x43e7('0x37')][_0x43e7('0x36')]?_0x5032bc['attributes']:_0x51f130[_0x43e7('0x30')];if(_0x2070a3['query'][_0x43e7('0x42')]){_0x5032bc[_0x43e7('0x43')]=[{'all':!![]}];}_0x5032bc=_['merge']({},_0x5032bc,_0x2070a3[_0x43e7('0x41')]);return db['OpenchannelApplication'][_0x43e7('0x49')](_0x5032bc)[_0x43e7('0x27')](handleEntityNotFound(_0x11aa86,null))[_0x43e7('0x27')](respondWithResult(_0x11aa86,null))['catch'](handleError(_0x11aa86,null));};exports[_0x43e7('0x4a')]=function(_0x26f42f,_0x4715f1){return db[_0x43e7('0x2c')]['create'](_0x26f42f[_0x43e7('0x4b')],{})[_0x43e7('0x27')](respondWithResult(_0x4715f1,0xc9))[_0x43e7('0x45')](handleError(_0x4715f1,null));};exports[_0x43e7('0x25')]=function(_0x1b91ed,_0x3b0fb1){if(_0x1b91ed[_0x43e7('0x4b')]['id']){delete _0x1b91ed[_0x43e7('0x4b')]['id'];}return db[_0x43e7('0x2c')]['find']({'where':{'id':_0x1b91ed['params']['id']}})['then'](handleEntityNotFound(_0x3b0fb1,null))[_0x43e7('0x27')](saveUpdates(_0x1b91ed[_0x43e7('0x4b')],null))[_0x43e7('0x27')](respondWithResult(_0x3b0fb1,null))[_0x43e7('0x45')](handleError(_0x3b0fb1,null));};exports[_0x43e7('0x26')]=function(_0x50f1f4,_0xf05ea6){return db[_0x43e7('0x2c')][_0x43e7('0x49')]({'where':{'id':_0x50f1f4['params']['id']}})[_0x43e7('0x27')](handleEntityNotFound(_0xf05ea6,null))[_0x43e7('0x27')](removeEntity(_0xf05ea6,null))['catch'](handleError(_0xf05ea6,null));}; \ No newline at end of file +var _0x9855=['catch','show','params','keys','rawAttributes','create','body','find','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/logger','api','../../config/utils','../../config/environment','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','type','model','query','intersection','fields','attributes','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9855,0x1be));var _0x5985=function(_0x4cc3f1,_0x54b244){_0x4cc3f1=_0x4cc3f1-0x0;var _0x147dda=_0x9855[_0x4cc3f1];return _0x147dda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5985('0x0'));var zipdir=require(_0x5985('0x1'));var jsonpatch=require(_0x5985('0x2'));var rp=require(_0x5985('0x3'));var moment=require('moment');var BPromise=require(_0x5985('0x4'));var Mustache=require(_0x5985('0x5'));var util=require(_0x5985('0x6'));var path=require('path');var sox=require(_0x5985('0x7'));var csv=require(_0x5985('0x8'));var ejs=require(_0x5985('0x9'));var fs=require('fs');var fs_extra=require(_0x5985('0xa'));var _=require(_0x5985('0xb'));var squel=require('squel');var crypto=require(_0x5985('0xc'));var jsforce=require(_0x5985('0xd'));var deskjs=require(_0x5985('0xe'));var toCsv=require(_0x5985('0x8'));var querystring=require(_0x5985('0xf'));var Papa=require('papaparse');var Redis=require(_0x5985('0x10'));var authService=require(_0x5985('0x11'));var qs=require(_0x5985('0x12'));var as=require(_0x5985('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5985('0x14'))(_0x5985('0x15'));var utils=require(_0x5985('0x16'));var config=require(_0x5985('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c3cd9,_0x2f64b5){_0x2f64b5=_0x2f64b5||0xcc;return function(_0x2c66c4){if(_0x2c66c4){return _0x3c3cd9[_0x5985('0x18')](_0x2f64b5);}return _0x3c3cd9['status'](_0x2f64b5)[_0x5985('0x19')]();};}function respondWithResult(_0x4279c3,_0x529d4b){_0x529d4b=_0x529d4b||0xc8;return function(_0x5ab85e){if(_0x5ab85e){return _0x4279c3['status'](_0x529d4b)['json'](_0x5ab85e);}};}function respondWithFilteredResult(_0x4f2e09,_0x184e91){return function(_0x45517d){if(_0x45517d){var _0xd9d404=typeof _0x184e91[_0x5985('0x1a')]===_0x5985('0x1b')&&typeof _0x184e91['limit']===_0x5985('0x1b');var _0x5e7765=_0x45517d['count'];var _0x536f44=_0xd9d404?0x0:_0x184e91[_0x5985('0x1a')];var _0x953bc7=_0xd9d404?_0x45517d[_0x5985('0x1c')]:_0x184e91['offset']+_0x184e91[_0x5985('0x1d')];var _0x4f507f;if(_0x953bc7>=_0x5e7765){_0x953bc7=_0x5e7765;_0x4f507f=0xc8;}else{_0x4f507f=0xce;}_0x4f2e09[_0x5985('0x1e')](_0x4f507f);return _0x4f2e09[_0x5985('0x1f')](_0x5985('0x20'),_0x536f44+'-'+_0x953bc7+'/'+_0x5e7765)[_0x5985('0x21')](_0x45517d);}return null;};}function patchUpdates(_0x5de1af){return function(_0x16d9c0){try{jsonpatch[_0x5985('0x22')](_0x16d9c0,_0x5de1af,!![]);}catch(_0x3c1ded){return BPromise[_0x5985('0x23')](_0x3c1ded);}return _0x16d9c0[_0x5985('0x24')]();};}function saveUpdates(_0x53a343,_0x5ea7c6){return function(_0x1ac397){if(_0x1ac397){return _0x1ac397[_0x5985('0x25')](_0x53a343)[_0x5985('0x26')](function(_0x4a754a){return _0x4a754a;});}return null;};}function removeEntity(_0x47408b,_0xd9c4dd){return function(_0x2d8a52){if(_0x2d8a52){return _0x2d8a52[_0x5985('0x27')]()[_0x5985('0x26')](function(){_0x47408b[_0x5985('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f099,_0x5b7a9e){return function(_0x2f1c39){if(!_0x2f1c39){_0x41f099[_0x5985('0x18')](0x194);}return _0x2f1c39;};}function handleError(_0x5d2d86,_0x11b0b9){_0x11b0b9=_0x11b0b9||0x1f4;return function(_0x520606){logger[_0x5985('0x28')](_0x520606[_0x5985('0x29')]);if(_0x520606[_0x5985('0x2a')]){delete _0x520606[_0x5985('0x2a')];}_0x5d2d86[_0x5985('0x1e')](_0x11b0b9)[_0x5985('0x2b')](_0x520606);};}exports[_0x5985('0x2c')]=function(_0x205149,_0x4c123d){var _0x4259ac={},_0x2e2556={},_0x1f3598={'count':0x0,'rows':[]};var _0x566ab5=_[_0x5985('0x2d')](db[_0x5985('0x2e')]['rawAttributes'],function(_0x293afe){return{'name':_0x293afe['fieldName'],'type':_0x293afe[_0x5985('0x2f')]['key']};});_0x2e2556[_0x5985('0x30')]=_[_0x5985('0x2d')](_0x566ab5,_0x5985('0x2a'));_0x2e2556[_0x5985('0x31')]=_['keys'](_0x205149[_0x5985('0x31')]);_0x2e2556['filters']=_[_0x5985('0x32')](_0x2e2556[_0x5985('0x30')],_0x2e2556[_0x5985('0x31')]);_0x4259ac['attributes']=_['intersection'](_0x2e2556[_0x5985('0x30')],qs[_0x5985('0x33')](_0x205149[_0x5985('0x31')][_0x5985('0x33')]));_0x4259ac[_0x5985('0x34')]=_0x4259ac['attributes']['length']?_0x4259ac[_0x5985('0x34')]:_0x2e2556[_0x5985('0x30')];if(!_0x205149[_0x5985('0x31')]['hasOwnProperty']('nolimit')){_0x4259ac[_0x5985('0x1d')]=qs[_0x5985('0x1d')](_0x205149[_0x5985('0x31')][_0x5985('0x1d')]);_0x4259ac['offset']=qs[_0x5985('0x1a')](_0x205149[_0x5985('0x31')][_0x5985('0x1a')]);}_0x4259ac[_0x5985('0x35')]=qs[_0x5985('0x36')](_0x205149[_0x5985('0x31')][_0x5985('0x36')]);_0x4259ac['where']=qs[_0x5985('0x37')](_[_0x5985('0x38')](_0x205149[_0x5985('0x31')],_0x2e2556[_0x5985('0x37')]),_0x566ab5);if(_0x205149[_0x5985('0x31')][_0x5985('0x39')]){_0x4259ac[_0x5985('0x3a')]=_[_0x5985('0x3b')](_0x4259ac[_0x5985('0x3a')],{'$or':_[_0x5985('0x2d')](_0x566ab5,function(_0x35fe18){if(_0x35fe18['type']!==_0x5985('0x3c')){var _0x1502be={};_0x1502be[_0x35fe18[_0x5985('0x2a')]]={'$like':'%'+_0x205149[_0x5985('0x31')]['filter']+'%'};return _0x1502be;}})});}_0x4259ac=_[_0x5985('0x3b')]({},_0x4259ac,_0x205149[_0x5985('0x3d')]);var _0x4c4761={'where':_0x4259ac[_0x5985('0x3a')]};return db[_0x5985('0x2e')][_0x5985('0x1c')](_0x4c4761)[_0x5985('0x26')](function(_0x4e080b){_0x1f3598[_0x5985('0x1c')]=_0x4e080b;if(_0x205149[_0x5985('0x31')][_0x5985('0x3e')]){_0x4259ac[_0x5985('0x3f')]=[{'all':!![]}];}return db[_0x5985('0x2e')][_0x5985('0x40')](_0x4259ac);})[_0x5985('0x26')](function(_0x37dc75){_0x1f3598['rows']=_0x37dc75;return _0x1f3598;})[_0x5985('0x26')](respondWithFilteredResult(_0x4c123d,_0x4259ac))[_0x5985('0x41')](handleError(_0x4c123d,null));};exports[_0x5985('0x42')]=function(_0x3d1f4c,_0x37b77e){var _0x3b72bf={'raw':!![],'where':{'id':_0x3d1f4c[_0x5985('0x43')]['id']}},_0x150a14={};_0x150a14[_0x5985('0x30')]=_[_0x5985('0x44')](db[_0x5985('0x2e')][_0x5985('0x45')]);_0x150a14[_0x5985('0x31')]=_[_0x5985('0x44')](_0x3d1f4c[_0x5985('0x31')]);_0x150a14[_0x5985('0x37')]=_[_0x5985('0x32')](_0x150a14[_0x5985('0x30')],_0x150a14[_0x5985('0x31')]);_0x3b72bf[_0x5985('0x34')]=_[_0x5985('0x32')](_0x150a14[_0x5985('0x30')],qs[_0x5985('0x33')](_0x3d1f4c['query'][_0x5985('0x33')]));_0x3b72bf[_0x5985('0x34')]=_0x3b72bf[_0x5985('0x34')]['length']?_0x3b72bf['attributes']:_0x150a14[_0x5985('0x30')];if(_0x3d1f4c[_0x5985('0x31')][_0x5985('0x3e')]){_0x3b72bf['include']=[{'all':!![]}];}_0x3b72bf=_[_0x5985('0x3b')]({},_0x3b72bf,_0x3d1f4c[_0x5985('0x3d')]);return db['OpenchannelApplication']['find'](_0x3b72bf)[_0x5985('0x26')](handleEntityNotFound(_0x37b77e,null))[_0x5985('0x26')](respondWithResult(_0x37b77e,null))[_0x5985('0x41')](handleError(_0x37b77e,null));};exports[_0x5985('0x46')]=function(_0x4e22a1,_0x1c0938){return db['OpenchannelApplication'][_0x5985('0x46')](_0x4e22a1['body'],{})[_0x5985('0x26')](respondWithResult(_0x1c0938,0xc9))[_0x5985('0x41')](handleError(_0x1c0938,null));};exports[_0x5985('0x25')]=function(_0x373af9,_0x57f3bc){if(_0x373af9[_0x5985('0x47')]['id']){delete _0x373af9[_0x5985('0x47')]['id'];}return db[_0x5985('0x2e')][_0x5985('0x48')]({'where':{'id':_0x373af9[_0x5985('0x43')]['id']}})[_0x5985('0x26')](handleEntityNotFound(_0x57f3bc,null))[_0x5985('0x26')](saveUpdates(_0x373af9[_0x5985('0x47')],null))['then'](respondWithResult(_0x57f3bc,null))[_0x5985('0x41')](handleError(_0x57f3bc,null));};exports['destroy']=function(_0x14c204,_0x32f350){return db[_0x5985('0x2e')][_0x5985('0x48')]({'where':{'id':_0x14c204[_0x5985('0x43')]['id']}})[_0x5985('0x26')](handleEntityNotFound(_0x32f350,null))[_0x5985('0x26')](removeEntity(_0x32f350,null))[_0x5985('0x41')](handleError(_0x32f350,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 492b8f5..ff37792 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 _0xcd61=['rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise'];(function(_0x392e3e,_0x386f17){var _0xe331fa=function(_0x55e2b4){while(--_0x55e2b4){_0x392e3e['push'](_0x392e3e['shift']());}};_0xe331fa(++_0x386f17);}(_0xcd61,0x170));var _0x1cd6=function(_0x335ea9,_0x1e7ea8){_0x335ea9=_0x335ea9-0x0;var _0x18864c=_0xcd61[_0x335ea9];return _0x18864c;};'use strict';var _=require('lodash');var util=require(_0x1cd6('0x0'));var logger=require(_0x1cd6('0x1'))('api');var moment=require(_0x1cd6('0x2'));var BPromise=require('bluebird');var rp=require(_0x1cd6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cd6('0x4'));var config=require(_0x1cd6('0x5'));var attributes=require(_0x1cd6('0x6'));module['exports']=function(_0x373662,_0x1ae205){return _0x373662[_0x1cd6('0x7')](_0x1cd6('0x8'),attributes,{'tableName':_0x1cd6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cd6('0xa'),'collate':_0x1cd6('0xb')});}; \ No newline at end of file +var _0x84f4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3481c3,_0x2ce48e){var _0x46a7a0=function(_0x13c771){while(--_0x13c771){_0x3481c3['push'](_0x3481c3['shift']());}};_0x46a7a0(++_0x2ce48e);}(_0x84f4,0x100));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x484f('0x0'));var util=require(_0x484f('0x1'));var logger=require(_0x484f('0x2'))(_0x484f('0x3'));var moment=require(_0x484f('0x4'));var BPromise=require(_0x484f('0x5'));var rp=require(_0x484f('0x6'));var fs=require('fs');var path=require(_0x484f('0x7'));var rimraf=require(_0x484f('0x8'));var config=require('../../config/environment');var attributes=require(_0x484f('0x9'));module[_0x484f('0xa')]=function(_0x445d1a,_0x1eeb58){return _0x445d1a[_0x484f('0xb')](_0x484f('0xc'),attributes,{'tableName':_0x484f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x484f('0xe'),'collate':_0x484f('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d691f82..df66191 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 _0xf143=['debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','attributes','limit','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x3008b7,_0x461f37){var _0x3d6720=function(_0x3feae6){while(--_0x3feae6){_0x3008b7['push'](_0x3008b7['shift']());}};_0x3d6720(++_0x461f37);}(_0xf143,0x1b4));var _0x3f14=function(_0xa911e,_0x1a9f9a){_0xa911e=_0xa911e-0x0;var _0x28bd6f=_0xf143[_0xa911e];return _0x28bd6f;};'use strict';var _=require(_0x3f14('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3f14('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f14('0x2'))['db'];var utils=require(_0x3f14('0x3'));var logger=require(_0x3f14('0x4'))(_0x3f14('0x5'));var config=require(_0x3f14('0x6'));var jayson=require(_0x3f14('0x7'));var client=jayson[_0x3f14('0x8')][_0x3f14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54c91e,_0x713f9c,_0x1f697c){return new BPromise(function(_0x415f84,_0x18d143){return client[_0x3f14('0xa')](_0x54c91e,_0x1f697c)[_0x3f14('0xb')](function(_0x583989){logger[_0x3f14('0xc')](_0x3f14('0xd'),_0x713f9c,'request\x20sent');logger[_0x3f14('0xe')](_0x3f14('0xf'),_0x713f9c,_0x3f14('0x10'),JSON[_0x3f14('0x11')](_0x583989));if(_0x583989[_0x3f14('0x12')]){if(_0x583989[_0x3f14('0x12')][_0x3f14('0x13')]===0x1f4){logger[_0x3f14('0x12')](_0x3f14('0xd'),_0x713f9c,_0x583989[_0x3f14('0x12')]['message']);return _0x18d143(_0x583989[_0x3f14('0x12')][_0x3f14('0x14')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x713f9c,_0x583989[_0x3f14('0x12')][_0x3f14('0x14')]);return _0x415f84(_0x583989['error']['message']);}else{logger[_0x3f14('0xc')](_0x3f14('0xd'),_0x713f9c,'request\x20sent');_0x415f84(_0x583989[_0x3f14('0x15')][_0x3f14('0x14')]);}})[_0x3f14('0x16')](function(_0x5b0bad){logger[_0x3f14('0x12')](_0x3f14('0xd'),_0x713f9c,_0x5b0bad);_0x18d143(_0x5b0bad);});});}exports[_0x3f14('0x17')]=function(_0x30082e){var _0xb7888f=this;return new Promise(function(_0x157f3e,_0x42538d){return db[_0x3f14('0x18')][_0x3f14('0x19')](_0x30082e['body'],{'raw':_0x30082e[_0x3f14('0x1a')]?_0x30082e[_0x3f14('0x1a')][_0x3f14('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30082e[_0x3f14('0x1a')]?_0x30082e[_0x3f14('0x1a')]['where']||null:null,'attributes':_0x30082e[_0x3f14('0x1a')]?_0x30082e['options'][_0x3f14('0x1c')]||null:null,'limit':_0x30082e['options']?_0x30082e['options'][_0x3f14('0x1d')]||null:null})[_0x3f14('0xb')](function(_0x4b74bc){logger[_0x3f14('0xc')](_0x3f14('0x17'),_0x30082e);logger[_0x3f14('0xe')](_0x3f14('0x17'),_0x30082e,JSON['stringify'](_0x4b74bc));_0x157f3e(_0x4b74bc);})[_0x3f14('0x16')](function(_0x13e019){logger['error'](_0x3f14('0x17'),_0x13e019[_0x3f14('0x14')],_0x30082e);_0x42538d(_0xb7888f['error'](0x1f4,_0x13e019[_0x3f14('0x14')]));});});}; \ No newline at end of file +var _0x8711=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelApplication','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication'];(function(_0x5f404b,_0x2b3686){var _0x434512=function(_0x5482d7){while(--_0x5482d7){_0x5f404b['push'](_0x5f404b['shift']());}};_0x434512(++_0x2b3686);}(_0x8711,0xae));var _0x1871=function(_0x5825c4,_0x30a289){_0x5825c4=_0x5825c4-0x0;var _0x5c1b2d=_0x8711[_0x5825c4];return _0x5c1b2d;};'use strict';var _=require(_0x1871('0x0'));var util=require(_0x1871('0x1'));var moment=require('moment');var BPromise=require(_0x1871('0x2'));var rs=require(_0x1871('0x3'));var fs=require('fs');var Redis=require(_0x1871('0x4'));var db=require(_0x1871('0x5'))['db'];var utils=require(_0x1871('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1871('0x7')][_0x1871('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16acee,_0x5541ae,_0x36adc8){return new BPromise(function(_0x148b06,_0x399342){return client['request'](_0x16acee,_0x36adc8)[_0x1871('0x9')](function(_0xc79480){logger[_0x1871('0xa')](_0x1871('0xb'),_0x5541ae,'request\x20sent');logger[_0x1871('0xc')](_0x1871('0xd'),_0x5541ae,_0x1871('0xe'),JSON[_0x1871('0xf')](_0xc79480));if(_0xc79480[_0x1871('0x10')]){if(_0xc79480[_0x1871('0x10')][_0x1871('0x11')]===0x1f4){logger[_0x1871('0x10')](_0x1871('0xb'),_0x5541ae,_0xc79480[_0x1871('0x10')][_0x1871('0x12')]);return _0x399342(_0xc79480[_0x1871('0x10')]['message']);}logger[_0x1871('0x10')](_0x1871('0xb'),_0x5541ae,_0xc79480[_0x1871('0x10')]['message']);return _0x148b06(_0xc79480[_0x1871('0x10')][_0x1871('0x12')]);}else{logger[_0x1871('0xa')](_0x1871('0xb'),_0x5541ae,_0x1871('0xe'));_0x148b06(_0xc79480[_0x1871('0x13')][_0x1871('0x12')]);}})[_0x1871('0x14')](function(_0x103f5d){logger[_0x1871('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x5541ae,_0x103f5d);_0x399342(_0x103f5d);});});}exports['UpdateOpenchannelApplication']=function(_0x25437b){var _0x328304=this;return new Promise(function(_0x2d7429,_0x51a50d){return db[_0x1871('0x15')]['update'](_0x25437b[_0x1871('0x16')],{'raw':_0x25437b[_0x1871('0x17')]?_0x25437b['options'][_0x1871('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25437b[_0x1871('0x17')]?_0x25437b[_0x1871('0x17')][_0x1871('0x19')]||null:null,'attributes':_0x25437b['options']?_0x25437b[_0x1871('0x17')][_0x1871('0x1a')]||null:null,'limit':_0x25437b[_0x1871('0x17')]?_0x25437b[_0x1871('0x17')][_0x1871('0x1b')]||null:null})[_0x1871('0x9')](function(_0x451db9){logger['info'](_0x1871('0x1c'),_0x25437b);logger[_0x1871('0xc')]('UpdateOpenchannelApplication',_0x25437b,JSON[_0x1871('0xf')](_0x451db9));_0x2d7429(_0x451db9);})[_0x1871('0x14')](function(_0x1a9d80){logger[_0x1871('0x10')](_0x1871('0x1c'),_0x1a9d80[_0x1871('0x12')],_0x25437b);_0x51a50d(_0x328304[_0x1871('0x10')](0x1f4,_0x1a9d80[_0x1871('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 555143f..2560de6 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 _0xb85f=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','describe','/:id','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','multer','util'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xb85f,0x166));var _0xfb85=function(_0x4e5333,_0x3f8eb6){_0x4e5333=_0x4e5333-0x0;var _0x4f4e2e=_0xb85f[_0x4e5333];return _0x4f4e2e;};'use strict';var multer=require(_0xfb85('0x0'));var util=require(_0xfb85('0x1'));var path=require('path');var timeout=require(_0xfb85('0x2'));var express=require(_0xfb85('0x3'));var router=express[_0xfb85('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfb85('0x5'));var config=require(_0xfb85('0x6'));var controller=require(_0xfb85('0x7'));router['get']('/',auth[_0xfb85('0x8')](),controller[_0xfb85('0x9')]);router[_0xfb85('0xa')]('/describe',auth[_0xfb85('0x8')](),controller[_0xfb85('0xb')]);router[_0xfb85('0xa')](_0xfb85('0xc'),auth[_0xfb85('0x8')](),controller[_0xfb85('0xd')]);router['get']('/:id/messages',auth[_0xfb85('0x8')](),controller[_0xfb85('0xe')]);router[_0xfb85('0xa')](_0xfb85('0xf'),auth[_0xfb85('0x8')](),controller[_0xfb85('0x10')]);router[_0xfb85('0x11')]('/',auth[_0xfb85('0x8')](),controller['create']);router[_0xfb85('0x11')]('/:id/messages',auth[_0xfb85('0x8')](),controller[_0xfb85('0x12')]);router[_0xfb85('0x11')](_0xfb85('0x13'),auth[_0xfb85('0x8')](),interaction[_0xfb85('0x14')](_0xfb85('0x15'),_0xfb85('0x16')),controller[_0xfb85('0x17')]);router['put'](_0xfb85('0xc'),auth[_0xfb85('0x8')](),interaction[_0xfb85('0x14')](_0xfb85('0x15'),_0xfb85('0x18')),controller[_0xfb85('0x19')]);router['delete']('/:id',auth[_0xfb85('0x8')](),interaction['tracked'](_0xfb85('0x15'),_0xfb85('0x1a')),controller[_0xfb85('0x1b')]);router[_0xfb85('0x1c')]('/:id/tags',auth[_0xfb85('0x8')](),controller[_0xfb85('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x16cc=['Router','fs-extra','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','addMessage','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x279573,_0x132687){var _0x3f7495=function(_0x22fa79){while(--_0x22fa79){_0x279573['push'](_0x279573['shift']());}};_0x3f7495(++_0x132687);}(_0x16cc,0x17b));var _0xc16c=function(_0x342f5e,_0x13c010){_0x342f5e=_0x342f5e-0x0;var _0x341d32=_0x16cc[_0x342f5e];return _0x341d32;};'use strict';var multer=require(_0xc16c('0x0'));var util=require(_0xc16c('0x1'));var path=require(_0xc16c('0x2'));var timeout=require(_0xc16c('0x3'));var express=require(_0xc16c('0x4'));var router=express[_0xc16c('0x5')]();var fs_extra=require(_0xc16c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc16c('0x7'));var controller=require(_0xc16c('0x8'));router[_0xc16c('0x9')]('/',auth[_0xc16c('0xa')](),controller[_0xc16c('0xb')]);router[_0xc16c('0x9')](_0xc16c('0xc'),auth[_0xc16c('0xa')](),controller[_0xc16c('0xd')]);router['get']('/:id',auth[_0xc16c('0xa')](),controller[_0xc16c('0xe')]);router[_0xc16c('0x9')](_0xc16c('0xf'),auth[_0xc16c('0xa')](),controller[_0xc16c('0x10')]);router[_0xc16c('0x9')](_0xc16c('0x11'),auth[_0xc16c('0xa')](),controller[_0xc16c('0x12')]);router['post']('/',auth[_0xc16c('0xa')](),controller['create']);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xc16c('0x13')]);router[_0xc16c('0x14')](_0xc16c('0x15'),auth['isAuthenticated'](),interaction[_0xc16c('0x16')](_0xc16c('0x17'),_0xc16c('0x18')),controller[_0xc16c('0x19')]);router[_0xc16c('0x1a')](_0xc16c('0x1b'),auth[_0xc16c('0xa')](),interaction[_0xc16c('0x16')](_0xc16c('0x17'),'openchannelinteraction:update'),controller[_0xc16c('0x1c')]);router[_0xc16c('0x1d')](_0xc16c('0x1b'),auth['isAuthenticated'](),interaction[_0xc16c('0x16')]('openchannel','openchannelinteraction:destroy'),controller[_0xc16c('0x1e')]);router['delete']('/:id/tags',auth[_0xc16c('0xa')](),controller['removeTags']);module[_0xc16c('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 bce7ec1..1760579 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 _0x43e7=['STRING','DATE','ENUM','sequelize','BOOLEAN'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x43e7,0xda));var _0x743e=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x43e7[_0x193e28];return _0x20ef59;};'use strict';var Sequelize=require(_0x743e('0x0'));module['exports']={'closed':{'type':Sequelize[_0x743e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x743e('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x743e('0x3')]},'threadId':{'type':Sequelize[_0x743e('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x743e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x743e('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc39c=['exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2de893,_0x1ace7b){var _0x3aa2d9=function(_0x50d215){while(--_0x50d215){_0x2de893['push'](_0x2de893['shift']());}};_0x3aa2d9(++_0x1ace7b);}(_0xc39c,0xd2));var _0xcc39=function(_0x426db3,_0x1694a0){_0x426db3=_0x426db3-0x0;var _0x2599b3=_0xc39c[_0x426db3];return _0x2599b3;};'use strict';var Sequelize=require('sequelize');module[_0xcc39('0x0')]={'closed':{'type':Sequelize[_0xcc39('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcc39('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcc39('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcc39('0x3')]},'note':{'type':Sequelize[_0xcc39('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xcc39('0x3')]},'externalUrl':{'type':Sequelize[_0xcc39('0x3')]},'lastMsgAt':{'type':Sequelize[_0xcc39('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xcc39('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xcc39('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xcc39('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6bd6781..ad89d3d 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 _0x6afc=['name','Users','map','fullname','TagIds','Tags','forEach','catch','talking','answered','unmanaged','closed','UserId','waiting','total','rawAttributes','fieldName','model','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','field','color','from','tools_tags','select','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','body','buildExpression','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','unreadMessages','order','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','rows','show','params','OpenchannelInteraction','keys','intersection','includeAll','options','create','describe','addMessage','ids','omit','OpenchannelMessage','format','include','findAll','setTags','spread','emit','removeTags','download','unix','server','join','root','attachments','transcript-%d-%s.zip','Contact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error'];(function(_0xf8e45b,_0x336e08){var _0xb38c41=function(_0x51f9d8){while(--_0x51f9d8){_0xf8e45b['push'](_0xf8e45b['shift']());}};_0xb38c41(++_0x336e08);}(_0x6afc,0xc1));var _0xc6af=function(_0x5eb460,_0x3db92f){_0x5eb460=_0x5eb460-0x0;var _0x42ad1c=_0x6afc[_0x5eb460];return _0x42ad1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6af('0x0'));var zipdir=require(_0xc6af('0x1'));var jsonpatch=require(_0xc6af('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6af('0x3'));var Mustache=require('mustache');var util=require(_0xc6af('0x4'));var path=require(_0xc6af('0x5'));var sox=require('sox');var csv=require(_0xc6af('0x6'));var ejs=require(_0xc6af('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc6af('0x8'));var crypto=require('crypto');var jsforce=require(_0xc6af('0x9'));var deskjs=require(_0xc6af('0xa'));var toCsv=require(_0xc6af('0x6'));var querystring=require(_0xc6af('0xb'));var Papa=require(_0xc6af('0xc'));var Redis=require('ioredis');var authService=require(_0xc6af('0xd'));var qs=require(_0xc6af('0xe'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xc6af('0xf'));var hardwareService=require(_0xc6af('0x10'));var logger=require(_0xc6af('0x11'))(_0xc6af('0x12'));var utils=require(_0xc6af('0x13'));var config=require(_0xc6af('0x14'));var licenseUtil=require(_0xc6af('0x15'));var db=require('../../mysqldb')['db'];config[_0xc6af('0x16')]=_[_0xc6af('0x17')](config['redis'],{'host':_0xc6af('0x18'),'port':0x18eb});var socket=require(_0xc6af('0x19'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xc6af('0x1a')](socket);function respondWithStatusCode(_0x57ac2c,_0x12f791){_0x12f791=_0x12f791||0xcc;return function(_0x3dcb0e){if(_0x3dcb0e){return _0x57ac2c[_0xc6af('0x1b')](_0x12f791);}return _0x57ac2c[_0xc6af('0x1c')](_0x12f791)[_0xc6af('0x1d')]();};}function respondWithResult(_0x567681,_0x3ea7ff){_0x3ea7ff=_0x3ea7ff||0xc8;return function(_0x17a3d2){if(_0x17a3d2){return _0x567681[_0xc6af('0x1c')](_0x3ea7ff)['json'](_0x17a3d2);}};}function respondWithFilteredResult(_0x3b2f51,_0x4ef091){return function(_0x5ba262){if(_0x5ba262){var _0x111193=typeof _0x4ef091['offset']===_0xc6af('0x1e')&&typeof _0x4ef091[_0xc6af('0x1f')]===_0xc6af('0x1e');var _0xde7ea2=_0x5ba262[_0xc6af('0x20')];var _0x4965bb=_0x111193?0x0:_0x4ef091[_0xc6af('0x21')];var _0x72d2ec=_0x111193?_0x5ba262[_0xc6af('0x20')]:_0x4ef091['offset']+_0x4ef091['limit'];var _0x5bacad;if(_0x72d2ec>=_0xde7ea2){_0x72d2ec=_0xde7ea2;_0x5bacad=0xc8;}else{_0x5bacad=0xce;}_0x3b2f51[_0xc6af('0x1c')](_0x5bacad);return _0x3b2f51[_0xc6af('0x22')](_0xc6af('0x23'),_0x4965bb+'-'+_0x72d2ec+'/'+_0xde7ea2)[_0xc6af('0x24')](_0x5ba262);}return null;};}function patchUpdates(_0x1be0b8){return function(_0x277bda){try{jsonpatch[_0xc6af('0x25')](_0x277bda,_0x1be0b8,!![]);}catch(_0x2f9bfa){return BPromise[_0xc6af('0x26')](_0x2f9bfa);}return _0x277bda['save']();};}function saveUpdates(_0x484a60,_0x4fc52e){return function(_0x3befaa){if(_0x3befaa){return _0x3befaa[_0xc6af('0x27')](_0x484a60)[_0xc6af('0x28')](function(_0x4961f2){return _0x4961f2;});}return null;};}function removeEntity(_0x35f520,_0x32323a){return function(_0x24ffb7){if(_0x24ffb7){return _0x24ffb7['destroy']()['then'](function(){_0x35f520[_0xc6af('0x1c')](0xcc)[_0xc6af('0x1d')]();});}};}function handleEntityNotFound(_0x3e309a,_0x442034){return function(_0x1048d3){if(!_0x1048d3){_0x3e309a[_0xc6af('0x1b')](0x194);}return _0x1048d3;};}function handleError(_0x49f788,_0x37864e){_0x37864e=_0x37864e||0x1f4;return function(_0x3e3425){logger[_0xc6af('0x29')](_0x3e3425['stack']);if(_0x3e3425[_0xc6af('0x2a')]){delete _0x3e3425['name'];}_0x49f788['status'](_0x37864e)['send'](_0x3e3425);};}function getInteractionUsers(_0x3bfcc0,_0x2b6f6b){return new BPromise(function(_0x39052f,_0x33e7b2){try{if(_0x2b6f6b[_0x3bfcc0['id']]){_0x3bfcc0[_0xc6af('0x2b')]=_[_0xc6af('0x2c')](_0x2b6f6b[_0x3bfcc0['id']],function(_0x914b4d){return{'id':_0x914b4d['id'],'fullname':_0x914b4d[_0xc6af('0x2d')]};});}}catch(_0x48fd96){_0x33e7b2(_0x48fd96);}_0x39052f(_0x3bfcc0);});}function getInteractionTags(_0x2fdc05,_0x1bee8f){return new BPromise(function(_0x370db5,_0x3df4b0){try{if(_0x2fdc05[_0xc6af('0x2e')]){_0x2fdc05[_0xc6af('0x2f')]=[];_0x2fdc05['TagIds']['split'](',')[_0xc6af('0x30')](function(_0x3af591){_0x2fdc05[_0xc6af('0x2f')]['push'](_0x1bee8f[_0x3af591]);});}delete _0x2fdc05['TagIds'];}catch(_0x3b76d0){_0x3df4b0(_0x3b76d0);}_0x370db5(_0x2fdc05);});}function updateOpenchannelInteraction(_0x106726,_0x106611,_0x2ccd8f){return new BPromise(function(_0x33c765,_0x3fd57e){return getInteractionUsers(_0x106726,_0x2ccd8f)[_0xc6af('0x28')](function(_0x362d45){return getInteractionTags(_0x362d45,_0x106611);})['then'](function(_0x1dbf46){return getStateInteraction(_0x1dbf46);})[_0xc6af('0x28')](function(_0xa9f744){_0x33c765(_0xa9f744);})[_0xc6af('0x31')](function(_0x171893){_0x3fd57e(_0x171893);});});}function getStateInteraction(_0x3870b8){return new BPromise(function(_0x4b8e54){_0x3870b8['waiting']=0x0;_0x3870b8[_0xc6af('0x32')]=0x0;_0x3870b8[_0xc6af('0x33')]=0x0;_0x3870b8[_0xc6af('0x34')]=0x0;_0x3870b8['total']=0x0;if(!_0x3870b8[_0xc6af('0x35')]&&!_0x3870b8[_0xc6af('0x36')]){_0x3870b8[_0xc6af('0x37')]+=0x1;}if(!_0x3870b8[_0xc6af('0x35')]&&_0x3870b8['UserId']){_0x3870b8[_0xc6af('0x32')]+=0x1;if(_0x3870b8[_0xc6af('0x37')]){_0x3870b8[_0xc6af('0x37')]-=0x1;}}if(_0x3870b8['closed']&&_0x3870b8['UserId']){_0x3870b8[_0xc6af('0x33')]+=0x1;if(_0x3870b8[_0xc6af('0x32')]){_0x3870b8[_0xc6af('0x32')]-=0x1;}}if(_0x3870b8[_0xc6af('0x35')]&&!_0x3870b8['UserId']){_0x3870b8[_0xc6af('0x34')]+=0x1;if(_0x3870b8[_0xc6af('0x37')]){_0x3870b8[_0xc6af('0x37')]-=0x1;}}_0x3870b8[_0xc6af('0x38')]+=0x1;_0x4b8e54(_0x3870b8);});}exports['index']=function(_0x44edec,_0x1ffadc){var _0x3a247c={},_0x16dbd7={},_0x3e4bcd={'count':0x0,'rows':[]};var _0x2d9986=_[_0xc6af('0x2c')](db['OpenchannelInteraction'][_0xc6af('0x39')],function(_0x2003ba){return{'name':_0x2003ba[_0xc6af('0x3a')],'type':_0x2003ba['type']['key']};});_0x16dbd7[_0xc6af('0x3b')]=_[_0xc6af('0x2c')](_0x2d9986,_0xc6af('0x2a'));_0x16dbd7['query']=_['keys'](_0x44edec['query']);_0x16dbd7['filters']=_['intersection'](_0x16dbd7[_0xc6af('0x3b')],_0x16dbd7[_0xc6af('0x3c')]);_0x3a247c['attributes']=_['intersection'](_0x16dbd7[_0xc6af('0x3b')],qs['fields'](_0x44edec['query'][_0xc6af('0x3d')]));_0x3a247c[_0xc6af('0x3e')]=_0x3a247c['attributes'][_0xc6af('0x3f')]?_0x3a247c['attributes']:_0x16dbd7[_0xc6af('0x3b')];if(!_0x44edec['query'][_0xc6af('0x40')](_0xc6af('0x41'))){_0x3a247c['limit']=qs[_0xc6af('0x1f')](_0x44edec[_0xc6af('0x3c')][_0xc6af('0x1f')]);_0x3a247c[_0xc6af('0x21')]=qs[_0xc6af('0x21')](_0x44edec['query']['offset']);}_0x3a247c['order']=qs['sort'](_0x44edec[_0xc6af('0x3c')][_0xc6af('0x42')]);_0x3a247c[_0xc6af('0x43')]=qs[_0xc6af('0x44')](_[_0xc6af('0x45')](_0x44edec[_0xc6af('0x3c')],_0x16dbd7[_0xc6af('0x44')]),_0x2d9986);var _0x152d6c=[];var _0x459365=squel['select']()[_0xc6af('0x46')]('id')['field'](_0xc6af('0x2a'))[_0xc6af('0x46')](_0xc6af('0x47'))[_0xc6af('0x48')](_0xc6af('0x49'));var _0x15f87f=squel[_0xc6af('0x4a')]()[_0xc6af('0x46')]('u.id')[_0xc6af('0x46')](_0xc6af('0x4b'))[_0xc6af('0x46')](_0xc6af('0x4c'))[_0xc6af('0x48')](_0xc6af('0x4d'),'ui')[_0xc6af('0x4e')]('users','u',_0xc6af('0x4f'));var _0x70b40b=squel[_0xc6af('0x4a')]()[_0xc6af('0x48')](_0xc6af('0x50'),'i')[_0xc6af('0x4e')](_0xc6af('0x51'),'c',_0xc6af('0x52'))[_0xc6af('0x4e')]('users','o',_0xc6af('0x53'))[_0xc6af('0x4e')](_0xc6af('0x54'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xc6af('0x4e')](_0xc6af('0x55'),'me',_0xc6af('0x56'))['left_join']('openchannel_interaction_has_tags','it',_0xc6af('0x57'))[_0xc6af('0x4e')](_0xc6af('0x49'),'t','t.id\x20=\x20it.TagId');var _0x3da77b=squel[_0xc6af('0x58')]();var _0x99db9c=[];var _0x2d944a=squel[_0xc6af('0x58')]();var _0x4b4a66;if(_0x44edec['query'][_0xc6af('0x59')]){_0x4b4a66=as[_0xc6af('0x5a')](_0x44edec['query'][_0xc6af('0x59')]);var _0x42be8f=_0x4b4a66[_0xc6af('0x5b')];for(var _0x42a9b5=0x0;_0x42a9b5<_0x4b4a66[_0xc6af('0x5c')][_0xc6af('0x3f')];_0x42a9b5++){var _0x485a7d=_0x4b4a66[_0xc6af('0x5c')][_0x42a9b5];var _0x31ca0b='i';var _0x391e46=_[_0xc6af('0x5d')](_0x2d9986,[_0xc6af('0x2a'),_0x485a7d[_0xc6af('0x46')]]);if(!_0x391e46){switch(_0x485a7d['field']){case'unreadMessages':if(_0x485a7d['value']==0x1){_0x70b40b[_0xc6af('0x5e')]('`'+_0x485a7d[_0xc6af('0x46')]+_0xc6af('0x5f'));}else{_0x70b40b[_0xc6af('0x5e')]('`'+_0x485a7d[_0xc6af('0x46')]+'`\x20>\x200');}break;case'Contact':if(_0x485a7d[_0xc6af('0x60')]===_0xc6af('0x61')){if(_0x485a7d[_0xc6af('0x62')][_0xc6af('0x63')]('\x20')[_0xc6af('0x3f')]>0x1){_0x3da77b[_0x42be8f](_0xc6af('0x64'),qs[_0xc6af('0x65')](_0x485a7d[_0xc6af('0x62')]),null);}else{var _0x3c7e62='%'+_0x485a7d[_0xc6af('0x62')]+'%';_0x3da77b[_0x42be8f](_0xc6af('0x66'),_0x3c7e62,_0x3c7e62,_0x3c7e62);}}else{_0x391e46=_['find'](_0x2d9986,['name',_0xc6af('0x67')]);_0x485a7d[_0xc6af('0x46')]=_0xc6af('0x67');_0xbace77=as['buildExpression'](_0x31ca0b,_0x391e46['type'],_0x485a7d);_0x3da77b[_0x42be8f](_0xbace77[_0xc6af('0x68')],_0xbace77['value'][_0xc6af('0x69')],_0xbace77[_0xc6af('0x62')]['end']);}break;case _0xc6af('0x6a'):var _0x4752bc=_0x485a7d[_0xc6af('0x62')]['split'](',')[_0xc6af('0x2c')](function(_0x3230d9){return Number(_0x3230d9);});_0x4752bc[_0xc6af('0x30')](function(_0x5aaf87){_0x2d944a['or'](_0xc6af('0x6b'),'%,'+_0x5aaf87+',%');});_0x99db9c=_[_0xc6af('0x6c')](_0x99db9c,_0x4752bc);break;case _0xc6af('0x6d'):if(_0x485a7d[_0xc6af('0x60')]===_0xc6af('0x61')){_0x3da77b[_0x42be8f](_0xc6af('0x6e'),'%'+_0x485a7d[_0xc6af('0x62')]+'%',null);}else{_0x391e46=_[_0xc6af('0x5d')](_0x2d9986,['name',_0xc6af('0x36')]);_0x485a7d['field']=_0xc6af('0x36');_0xbace77=as['buildExpression'](_0x31ca0b,_0x391e46[_0xc6af('0x6f')],_0x485a7d);_0x3da77b[_0x42be8f](_0xbace77['text'],_0xbace77[_0xc6af('0x62')]['start'],_0xbace77['value'][_0xc6af('0x1d')]);}break;case _0xc6af('0x70'):_0xbace77=as[_0xc6af('0x71')]('me',null,_0x485a7d);_0x3da77b[_0x42be8f](_0xbace77[_0xc6af('0x68')],_0xbace77['value']['start'],_0xbace77[_0xc6af('0x62')][_0xc6af('0x1d')]);break;}}else{var _0xbace77=as[_0xc6af('0x71')](_0x31ca0b,_0x391e46[_0xc6af('0x6f')],_0x485a7d);_0x3da77b[_0x42be8f](_0xbace77['text'],_0xbace77['value'][_0xc6af('0x69')],_0xbace77[_0xc6af('0x62')][_0xc6af('0x1d')]);}}}else{var _0x1fa529=_(_0x44edec['query'])['keys']()[_0xc6af('0x2c')](function(_0x1a63be){return _[_0xc6af('0x72')](_0x2d9986,['name',_0x1a63be])?_0x1a63be:undefined;})[_0xc6af('0x73')]()['value']();if(!_[_0xc6af('0x74')](_0x1fa529)){_0x1fa529[_0xc6af('0x30')](function(_0x5d144e){if(_0x5d144e===_0xc6af('0x75')){_0x70b40b[_0xc6af('0x43')](_0xc6af('0x76'),[]['concat'](_0x44edec['query'][_0x5d144e]));}else if(_0x5d144e===_0xc6af('0x77')){var _0xf05c87=JSON[_0xc6af('0x78')](_0x44edec[_0xc6af('0x3c')][_0x5d144e])[_0xc6af('0x79')];var _0x2e9b55=JSON[_0xc6af('0x78')](_0x44edec['query'][_0x5d144e])['$lte'];_0x70b40b[_0xc6af('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xf05c87,_0x2e9b55);}else{if(_0x44edec[_0xc6af('0x3c')][_0x5d144e]===_0xc6af('0x7a')){_0x70b40b[_0xc6af('0x43')]('i.'+_0x5d144e+'\x20IS\x20NULL');}else{_0x70b40b[_0xc6af('0x43')]('i.'+_0x5d144e+_0xc6af('0x7b'),_0x44edec['query'][_0x5d144e]);}}});}if(_0x44edec[_0xc6af('0x3c')]['read']){if(_0x44edec[_0xc6af('0x3c')][_0xc6af('0x7c')]==0x1){_0x70b40b[_0xc6af('0x5e')](_0xc6af('0x7d'));}else{_0x70b40b['having'](_0xc6af('0x7e'));}}if(_0x44edec['query'][_0xc6af('0x7f')]){_0x99db9c=_['isArray'](_0x44edec[_0xc6af('0x3c')]['tag'])?_0x44edec[_0xc6af('0x3c')][_0xc6af('0x7f')]:new Array(_0x44edec[_0xc6af('0x3c')][_0xc6af('0x7f')]);_0x99db9c[_0xc6af('0x30')](function(_0x492145){_0x2d944a['or'](_0xc6af('0x6b'),'%,'+_0x492145+',%');});}if(_0x44edec['query'][_0xc6af('0x80')]){var _0x232f0e=_0x44edec[_0xc6af('0x3c')]['filter'][_0xc6af('0x81')]('\x5c','\x5c\x5c')[_0xc6af('0x81')](/'/g,'\x27\x27');if(qs[_0xc6af('0x82')](_0x232f0e)){_0x3da77b['or']('i.id\x20LIKE\x20?',_0x232f0e+'%');}else{_0x3da77b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x232f0e))['or'](_0xc6af('0x83'),_0x232f0e+'%')['or'](_0xc6af('0x84'),_0x232f0e+'%');}}}_0x70b40b[_0xc6af('0x43')](_0x3da77b);_0x70b40b[_0xc6af('0x85')](_0xc6af('0x86'));var _0x249569={'type':db[_0xc6af('0x87')]['QueryTypes'][_0xc6af('0x88')],'raw':!![]};var _0x39a02e=_0x70b40b[_0xc6af('0x89')]();_0x39a02e[_0xc6af('0x46')](_0xc6af('0x86'));_0x39a02e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc6af('0x8a'));if(_0x3a247c['order']){_0x3a247c[_0xc6af('0x8b')][_0xc6af('0x30')](function(_0x25d710){var _0x4e49d3=_0x25d710[0x0]===_0xc6af('0x8c')?_0x25d710[0x0]:'i.'+_0x25d710[0x0];_0x70b40b[_0xc6af('0x8b')](_0x4e49d3,_0x25d710[0x1]===_0xc6af('0x8d')?![]:!![]);});}if(!_[_0xc6af('0x74')](_0x99db9c)){_0x70b40b['having'](_0x2d944a);_0x39a02e[_0xc6af('0x43')]('t.id\x20IN\x20?',_0x99db9c);}BPromise[_0xc6af('0x8e')]()[_0xc6af('0x28')](function(){if(!_0x4b4a66){if(_0x44edec['query'][_0xc6af('0x75')])return;_0x39a02e[_0xc6af('0x43')](_0xc6af('0x8f'));_0x70b40b[_0xc6af('0x43')](_0xc6af('0x8f'));return;}if(_0x44edec['user']['role']!=='agent')return;return _0x44edec[_0xc6af('0x90')][_0xc6af('0x91')]({'attributes':['id'],'raw':!![]})[_0xc6af('0x28')](function(_0x822a1){if(_['isEmpty'](_0x822a1)){_0x39a02e['where'](_0xc6af('0x92'));_0x70b40b[_0xc6af('0x43')](_0xc6af('0x92'));}else{_0x39a02e[_0xc6af('0x43')](_0xc6af('0x76'),_['map'](_0x822a1,'id'));_0x70b40b[_0xc6af('0x43')](_0xc6af('0x76'),_[_0xc6af('0x2c')](_0x822a1,'id'));}});})[_0xc6af('0x28')](function(){if(_0x44edec[_0xc6af('0x90')][_0xc6af('0x93')]==='agent'&&!_0x4b4a66&&!_0x44edec[_0xc6af('0x3c')][_0xc6af('0x75')])return[];return db[_0xc6af('0x94')][_0xc6af('0x3c')](_0x39a02e[_0xc6af('0x95')](),_0x249569);})[_0xc6af('0x28')](function(_0x3fb17c){_0x3e4bcd['count']=_0x3fb17c['length'];if(_0x3e4bcd['count']===0x0)return[];return db[_0xc6af('0x94')][_0xc6af('0x3c')](_0x459365['toString'](),_0x249569)[_0xc6af('0x28')](function(_0x4b78b5){_0x152d6c=_[_0xc6af('0x96')](_0x4b78b5,'id');_0x249569=_[_0xc6af('0x97')](_0x249569,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44edec[_0xc6af('0x3c')]['fields']){_0x3a247c[_0xc6af('0x3e')]['forEach'](function(_0x174ee7){_0x70b40b[_0xc6af('0x46')]('i.'+_0x174ee7);});}else{_0x70b40b[_0xc6af('0x46')](_0xc6af('0x98'),_0xc6af('0x8a'));_0x70b40b[_0xc6af('0x46')](_0xc6af('0x99'),_0xc6af('0x9a'));_0x70b40b[_0xc6af('0x46')](_0xc6af('0x9b'),'Account.mandatoryDisposition');_0x70b40b[_0xc6af('0x46')](_0xc6af('0x9c'),_0xc6af('0x8c'));_0x70b40b[_0xc6af('0x46')]('i.*');_0x70b40b['field'](_0xc6af('0x9d'),_0xc6af('0x9e'));_0x70b40b['field'](_0xc6af('0x9f'),'Contact.lastName');_0x70b40b['field'](_0xc6af('0xa0'),_0xc6af('0xa1'));_0x70b40b['field'](_0xc6af('0xa2'),_0xc6af('0xa3'));_0x70b40b[_0xc6af('0x46')](_0xc6af('0xa4'),'Contact.mobile');_0x70b40b[_0xc6af('0x46')](_0xc6af('0xa5'),_0xc6af('0xa6'));_0x70b40b[_0xc6af('0x46')](_0xc6af('0xa7'),_0xc6af('0xa8'));_0x70b40b[_0xc6af('0x46')](_0xc6af('0xa9'),_0xc6af('0xaa'));_0x70b40b[_0xc6af('0x46')](_0xc6af('0xab'),_0xc6af('0x2e'));}if(_0x3a247c[_0xc6af('0x1f')])_0x70b40b['limit'](_0x3a247c['limit']);if(_0x3a247c[_0xc6af('0x21')])_0x70b40b[_0xc6af('0x21')](_0x3a247c['offset']);return db[_0xc6af('0x94')][_0xc6af('0x3c')](_0x70b40b[_0xc6af('0x95')](),_0x249569);})[_0xc6af('0x28')](function(_0x366b51){if(_0x366b51[_0xc6af('0x3f')]>0x0)_0x15f87f[_0xc6af('0x43')](_0xc6af('0xac'),_[_0xc6af('0x2c')](_0x366b51,'id'));return db[_0xc6af('0x94')][_0xc6af('0x3c')](_0x15f87f['toString'](),_0x249569)[_0xc6af('0x28')](function(_0x74267c){var _0xec4daa=_['groupBy'](_0x74267c,_0xc6af('0xad'));var _0xe9e422=[];_0x366b51['forEach'](function(_0x639a22){_0xe9e422[_0xc6af('0xae')](updateOpenchannelInteraction(_0x639a22,_0x152d6c,_0xec4daa));});return BPromise['all'](_0xe9e422);});});})[_0xc6af('0x28')](function(_0x20886e){_0x3e4bcd[_0xc6af('0xaf')]=_0x20886e;return _0x3e4bcd;})[_0xc6af('0x28')](respondWithFilteredResult(_0x1ffadc,_0x3a247c))[_0xc6af('0x31')](handleError(_0x1ffadc,null));};exports[_0xc6af('0xb0')]=function(_0x55b25f,_0x2ccb04){var _0x4b0552={};if(_0x55b25f[_0xc6af('0x3c')][_0xc6af('0x6f')]&&_0x55b25f[_0xc6af('0x3c')][_0xc6af('0x6f')]===_0xc6af('0x48')){_0x4b0552['from']=_0x55b25f[_0xc6af('0xb1')]['id'];}else{_0x4b0552['id']=_0x55b25f[_0xc6af('0xb1')]['id'];}var _0xf1ac5f={'raw':![],'where':_0x4b0552},_0x9f40d2={};_0x9f40d2['model']=_['keys'](db[_0xc6af('0xb2')][_0xc6af('0x39')]);_0x9f40d2[_0xc6af('0x3c')]=_[_0xc6af('0xb3')](_0x55b25f[_0xc6af('0x3c')]);_0x9f40d2['filters']=_['intersection'](_0x9f40d2[_0xc6af('0x3b')],_0x9f40d2['query']);_0xf1ac5f[_0xc6af('0x3e')]=_[_0xc6af('0xb4')](_0x9f40d2[_0xc6af('0x3b')],qs[_0xc6af('0x3d')](_0x55b25f[_0xc6af('0x3c')][_0xc6af('0x3d')]));_0xf1ac5f['attributes']=_0xf1ac5f['attributes'][_0xc6af('0x3f')]?_0xf1ac5f[_0xc6af('0x3e')]:_0x9f40d2[_0xc6af('0x3b')];if(_0x55b25f[_0xc6af('0x3c')][_0xc6af('0xb5')]){_0xf1ac5f['include']=[{'all':!![]}];}_0xf1ac5f=_[_0xc6af('0x97')]({},_0xf1ac5f,_0x55b25f[_0xc6af('0xb6')]);return db[_0xc6af('0xb2')][_0xc6af('0x5d')](_0xf1ac5f)[_0xc6af('0x28')](handleEntityNotFound(_0x2ccb04,null))[_0xc6af('0x28')](respondWithResult(_0x2ccb04,null))[_0xc6af('0x31')](handleError(_0x2ccb04,null));};exports['create']=function(_0x23b57f,_0x1d61e6){return db[_0xc6af('0xb2')][_0xc6af('0xb7')](_0x23b57f[_0xc6af('0x70')],{})['then'](respondWithResult(_0x1d61e6,0xc9))[_0xc6af('0x31')](handleError(_0x1d61e6,null));};exports[_0xc6af('0x27')]=function(_0x24563f,_0xecebb){if(_0x24563f[_0xc6af('0x70')]['id']){delete _0x24563f[_0xc6af('0x70')]['id'];}return db['OpenchannelInteraction'][_0xc6af('0x5d')]({'where':{'id':_0x24563f['params']['id']}})['then'](handleEntityNotFound(_0xecebb,null))[_0xc6af('0x28')](saveUpdates(_0x24563f[_0xc6af('0x70')],null))[_0xc6af('0x28')](respondWithResult(_0xecebb,null))[_0xc6af('0x31')](handleError(_0xecebb,null));};exports['destroy']=function(_0x5dbe73,_0x480d69){return db[_0xc6af('0xb2')][_0xc6af('0x5d')]({'where':{'id':_0x5dbe73[_0xc6af('0xb1')]['id']}})[_0xc6af('0x28')](handleEntityNotFound(_0x480d69,null))['then'](removeEntity(_0x480d69,null))[_0xc6af('0x31')](handleError(_0x480d69,null));};exports[_0xc6af('0xb8')]=function(_0x4426cc,_0x396105){return db['OpenchannelInteraction'][_0xc6af('0xb8')]()[_0xc6af('0x28')](respondWithResult(_0x396105,null))['catch'](handleError(_0x396105,null));};exports['addMessage']=function(_0x260c3c,_0x511d8d,_0x959d57){return db['OpenchannelMessage'][_0xc6af('0x5d')]({'where':{'id':_0x260c3c[_0xc6af('0xb1')]['id']}})['then'](handleEntityNotFound(_0x511d8d,null))['then'](function(_0xb14e4f){if(_0xb14e4f){return _0xb14e4f[_0xc6af('0xb9')](_0x260c3c['body'][_0xc6af('0xba')],_[_0xc6af('0xbb')](_0x260c3c['body'],[_0xc6af('0xba'),'id'])||{});}})['then'](respondWithResult(_0x511d8d,null))['catch'](handleError(_0x511d8d,null));};exports['getMessages']=function(_0x112abb,_0x15a450,_0x466d86){var _0x265b6b={'raw':![],'where':{}};var _0x576eb8={};var _0x2f42d9={'count':0x0,'rows':[]};return db[_0xc6af('0xb2')]['findOne']({'where':{'id':_0x112abb[_0xc6af('0xb1')]['id']}})[_0xc6af('0x28')](handleEntityNotFound(_0x15a450,null))[_0xc6af('0x28')](function(_0x7184a4){if(_0x7184a4){_0x576eb8[_0xc6af('0x3b')]=_[_0xc6af('0xb3')](db[_0xc6af('0xbc')]['rawAttributes']);_0x576eb8[_0xc6af('0x3c')]=_[_0xc6af('0xb3')](_0x112abb[_0xc6af('0x3c')]);_0x576eb8[_0xc6af('0x44')]=_[_0xc6af('0xb4')](_0x576eb8[_0xc6af('0x3b')],_0x576eb8['query']);_0x265b6b[_0xc6af('0x3e')]=_[_0xc6af('0xb4')](_0x576eb8['model'],qs[_0xc6af('0x3d')](_0x112abb[_0xc6af('0x3c')][_0xc6af('0x3d')]));_0x265b6b[_0xc6af('0x3e')]=_0x265b6b[_0xc6af('0x3e')][_0xc6af('0x3f')]?_0x265b6b[_0xc6af('0x3e')]:_0x576eb8['model'];if(!_0x112abb[_0xc6af('0x3c')][_0xc6af('0x40')](_0xc6af('0x41'))){_0x265b6b[_0xc6af('0x1f')]=qs[_0xc6af('0x1f')](_0x112abb['query']['limit']);_0x265b6b['offset']=qs[_0xc6af('0x21')](_0x112abb[_0xc6af('0x3c')][_0xc6af('0x21')]);}_0x265b6b['order']=qs[_0xc6af('0x42')](_0x112abb['query'][_0xc6af('0x42')]);_0x265b6b[_0xc6af('0x43')]=qs[_0xc6af('0x44')](_['pick'](_0x112abb['query'],_0x576eb8[_0xc6af('0x44')]));_0x265b6b['where'][_0xc6af('0xad')]=_0x7184a4['id'];if(_0x112abb[_0xc6af('0x3c')][_0xc6af('0x80')]){_0x265b6b['where']=_[_0xc6af('0x97')](_0x265b6b[_0xc6af('0x43')],{'$or':_[_0xc6af('0x2c')](_0x265b6b[_0xc6af('0x3e')],function(_0x5f4308){var _0x4063d8={};_0x4063d8[_0x5f4308]={'$like':'%'+_0x112abb[_0xc6af('0x3c')][_0xc6af('0x80')]+'%'};return _0x4063d8;})});}if(_0x112abb[_0xc6af('0x3c')]['$gte']){var _0x537074=_0x112abb['query'][_0xc6af('0x79')][_0xc6af('0x63')](',');var _0x469990={};_0x469990[_0x537074[0x0]]={'$gte':moment(_0x537074[0x1])[_0xc6af('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x265b6b[_0xc6af('0x43')]=_['merge'](_0x265b6b[_0xc6af('0x43')],_0x469990);}_0x265b6b=_[_0xc6af('0x97')]({},_0x265b6b,_0x112abb['options']);return db[_0xc6af('0xbc')]['count']({'where':_0x265b6b[_0xc6af('0x43')]})[_0xc6af('0x28')](function(_0x4f5015){_0x2f42d9[_0xc6af('0x20')]=_0x4f5015;if(_0x112abb['query'][_0xc6af('0xb5')]){_0x265b6b[_0xc6af('0xbe')]=[{'all':!![]}];}return db[_0xc6af('0xbc')][_0xc6af('0xbf')](_0x265b6b);})['then'](function(_0x191dcd){_0x2f42d9[_0xc6af('0xaf')]=_0x191dcd;return _0x2f42d9;});}})[_0xc6af('0x28')](respondWithFilteredResult(_0x15a450,_0x265b6b))['catch'](handleError(_0x15a450,null));};exports['addTags']=function(_0x2e39cb,_0x4a5a28,_0x2fcb36){return db[_0xc6af('0xb2')]['find']({'where':{'id':_0x2e39cb[_0xc6af('0xb1')]['id']}})[_0xc6af('0x28')](handleEntityNotFound(_0x4a5a28,null))[_0xc6af('0x28')](function(_0x519681){if(_0x519681){return _0x519681[_0xc6af('0xc0')](_0x2e39cb[_0xc6af('0x70')][_0xc6af('0xba')],_[_0xc6af('0xbb')](_0x2e39cb['body'],[_0xc6af('0xba'),'id'])||{})[_0xc6af('0xc1')](function(){return db[_0xc6af('0x6a')][_0xc6af('0xbf')]({'attributes':['id',_0xc6af('0x2a'),'color'],'where':{'id':_0x2e39cb[_0xc6af('0x70')][_0xc6af('0xba')]}});})[_0xc6af('0x28')](function(_0xa8f8f7){socket[_0xc6af('0xc2')]('openchannelInteractionTags:save',{'id':Number(_0x2e39cb[_0xc6af('0xb1')]['id']),'tags':_0xa8f8f7||[]});return{'id':Number(_0x2e39cb[_0xc6af('0xb1')]['id']),'tags':_0xa8f8f7||[]};});}})['then'](respondWithResult(_0x4a5a28,null))[_0xc6af('0x31')](handleError(_0x4a5a28,null));};exports[_0xc6af('0xc3')]=function(_0x2acaa8,_0x297d43,_0x3dab8a){return db['OpenchannelInteraction'][_0xc6af('0x5d')]({'where':{'id':_0x2acaa8[_0xc6af('0xb1')]['id']}})['then'](handleEntityNotFound(_0x297d43,null))[_0xc6af('0x28')](function(_0x385ba9){if(_0x385ba9){return _0x385ba9['removeTags'](_0x2acaa8[_0xc6af('0x3c')][_0xc6af('0xba')]);}})[_0xc6af('0x28')](respondWithStatusCode(_0x297d43,null))[_0xc6af('0x31')](handleError(_0x297d43,null));};exports[_0xc6af('0xc4')]=function(_0x492fe5,_0x4e95dc){var _0x46adf5=moment()[_0xc6af('0xc5')]()[_0xc6af('0x95')]();var _0x125f00=path['join'](config['root'],_0xc6af('0xc6'),'files','tmp');var _0x23e16a=path[_0xc6af('0xc7')](config[_0xc6af('0xc8')],_0xc6af('0xc6'),'files',_0xc6af('0xc9'));var _0x2153fc=path['join'](_0x125f00,_0x46adf5);var _0x1ef49a=util[_0xc6af('0xbd')](_0xc6af('0xca'),_0x492fe5[_0xc6af('0xb1')]['id'],_0x46adf5);var _0x223383=path[_0xc6af('0xc7')](_0x125f00,_0x1ef49a);var _0x53d967=[];_0x53d967[_0xc6af('0xae')]({'model':db['User'],'as':'User','attributes':['id',_0xc6af('0x2d')],'raw':!![]});_0x53d967[_0xc6af('0xae')]({'model':db['CmContact'],'as':_0xc6af('0xcb'),'attributes':['id',_0xc6af('0xcc'),'lastName'],'raw':!![]});if(_0x492fe5[_0xc6af('0x3c')][_0xc6af('0xc9')]){_0x53d967['push']({'model':db[_0xc6af('0xcd')],'as':_0xc6af('0xcd'),'raw':!![]});}var _0x47633b=[{'model':db['OpenchannelMessage'],'as':_0xc6af('0xce'),'attributes':['id',_0xc6af('0x70'),_0xc6af('0x77'),_0xc6af('0xcf'),_0xc6af('0xd0'),_0xc6af('0x7c')],'include':_0x53d967}];_0x47633b['push']({'model':db[_0xc6af('0xd1')],'as':_0xc6af('0xd2'),'attributes':['id','name']});_0x47633b[_0xc6af('0xae')]({'model':db[_0xc6af('0x6d')],'as':_0xc6af('0xd3'),'attributes':['id',_0xc6af('0x2d')]});return db['OpenchannelInteraction'][_0xc6af('0x5d')]({'where':{'id':_0x492fe5[_0xc6af('0xb1')]['id']},'include':_0x47633b})[_0xc6af('0x28')](handleEntityNotFound(_0x4e95dc,null))[_0xc6af('0x28')](function(_0x1e9a93){if(_0x1e9a93){var _0x26e158=_0x1e9a93['get']({'plain':!![]});fs[_0xc6af('0xd4')](_0x2153fc);var _0x1f278d={'channel':'Openchannel','account':_0x26e158['Account'][_0xc6af('0x2a')],'agent':_0x26e158['Owner']?_0x26e158[_0xc6af('0xd3')][_0xc6af('0x2d')]:'N.A.','createdAt':moment(_0x26e158[_0xc6af('0x77')])[_0xc6af('0xbd')](_0xc6af('0xd5'))['toString'](),'closedAt':_0x26e158[_0xc6af('0x35')]?moment(_0x26e158[_0xc6af('0xd6')])[_0xc6af('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc6af('0x95')]():'','disposition':_0x26e158[_0xc6af('0xd7')],'visibility':_0x26e158[_0xc6af('0xd8')]?_0xc6af('0xd9'):_0xc6af('0xda'),'messages':_(_0x26e158['Messages'])[_0xc6af('0x80')]({'secret':![]})[_0xc6af('0x2c')](function(_0x53172c){if(_0x53172c['Attachment']){var _0x2074e=path[_0xc6af('0xc7')](_0x23e16a,_0x53172c['Attachment'][_0xc6af('0xdb')]);if(fs[_0xc6af('0xdc')](_0x2074e)){fs[_0xc6af('0xdd')](_0x2074e)['pipe'](fs[_0xc6af('0xde')](path[_0xc6af('0xc7')](_0x2153fc,_0x53172c[_0xc6af('0xcd')][_0xc6af('0xdb')])));}}return{'date':moment(_0x53172c[_0xc6af('0x77')])[_0xc6af('0xbd')](_0xc6af('0xd5'))[_0xc6af('0x95')](),'sender':_0x53172c['direction']===_0xc6af('0xdf')?_0x53172c[_0xc6af('0x6d')]?_0x53172c[_0xc6af('0x6d')][_0xc6af('0x2d')]:_0xc6af('0xe0'):_0x53172c[_0xc6af('0xcb')][_0xc6af('0xcc')]+(_0x53172c[_0xc6af('0xcb')]['lastName']?'\x20'+_0x53172c[_0xc6af('0xcb')][_0xc6af('0xe1')]:''),'body':_0x53172c['Attachment']?_0x53172c[_0xc6af('0xcd')]['basename']:_0x53172c['body'],'direction':_0x53172c['direction']===_0xc6af('0xdf')?'A':'C','secret':_0x53172c[_0xc6af('0xd0')],'read':_0x53172c[_0xc6af('0x7c')],'attachment':_0x53172c[_0xc6af('0xcd')]};})[_0xc6af('0x62')]()};return ejs[_0xc6af('0xe2')](path[_0xc6af('0xc7')](config[_0xc6af('0xc8')],_0xc6af('0xc6'),_0xc6af('0xe3'),_0xc6af('0xe4')),{'interaction':_0x1f278d})[_0xc6af('0x28')](function(_0x3d1ee4){var _0x3df2b5=path[_0xc6af('0xc7')](_0x2153fc,_0xc6af('0xe5')+_0x26e158['id']+'-'+_0x46adf5+_0xc6af('0xe6'));var _0x7108f={'path':_0x3df2b5,'channel':_0xc6af('0xe7'),'interactionId':_0x26e158['id']};return pdf[_0xc6af('0xe8')](_0x3d1ee4,_0x7108f);})[_0xc6af('0x28')](function(){return new BPromise(function(_0x51c3ee,_0xf3d25f){zipdir(_0x2153fc,{'saveTo':_0x223383},function(_0x40e8fb,_0x4eb440){if(_0x40e8fb)return _0xf3d25f(_0x40e8fb);return _0x51c3ee(_0x4eb440);});})[_0xc6af('0x28')](function(){return new BPromise(function(_0x2b9c84,_0x11827c){rimraf(_0x2153fc,function(_0x302e76){if(_0x302e76)_0x11827c(_0x302e76);return _0x2b9c84();});});})[_0xc6af('0x28')](function(){return _0x4e95dc[_0xc6af('0xc4')](_0x223383,_0x1ef49a,function(_0x562836){if(_0x562836){console['log'](_0xc6af('0xe9'),_0x562836);}else{fs[_0xc6af('0xea')](_0x223383);}});});});}else{return _0x4e95dc[_0xc6af('0x1b')](0xc8);}})[_0xc6af('0x31')](handleError(_0x4e95dc,null));}; \ No newline at end of file +var _0x01ee=['parseSearch','search','length','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','role','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','rows','params','includeAll','include','options','create','body','OpenchannelMessage','ids','omit','findOne','pick','OpenchannelInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','root','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','fullname','mkdirSync','Openchannel','N.A.','format','closedAt','disposition','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','out','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','Users','map','TagIds','Tags','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','select','field','color','from','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr'];(function(_0x4344a2,_0x4798ee){var _0x3dc2cb=function(_0x1a127d){while(--_0x1a127d){_0x4344a2['push'](_0x4344a2['shift']());}};_0x3dc2cb(++_0x4798ee);}(_0x01ee,0x8f));var _0xe01e=function(_0x2da402,_0x14a691){_0x2da402=_0x2da402-0x0;var _0x31a57d=_0x01ee[_0x2da402];return _0x31a57d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe01e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe01e('0x1'));var rp=require(_0xe01e('0x2'));var moment=require(_0xe01e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe01e('0x4'));var path=require(_0xe01e('0x5'));var sox=require(_0xe01e('0x6'));var csv=require('to-csv');var ejs=require(_0xe01e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe01e('0x8'));var squel=require(_0xe01e('0x9'));var crypto=require(_0xe01e('0xa'));var jsforce=require(_0xe01e('0xb'));var deskjs=require(_0xe01e('0xc'));var toCsv=require(_0xe01e('0xd'));var querystring=require(_0xe01e('0xe'));var Papa=require('papaparse');var Redis=require(_0xe01e('0xf'));var authService=require(_0xe01e('0x10'));var qs=require(_0xe01e('0x11'));var as=require(_0xe01e('0x12'));var pdf=require(_0xe01e('0x13'));var hardwareService=require(_0xe01e('0x14'));var logger=require(_0xe01e('0x15'))(_0xe01e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe01e('0x17'));var db=require('../../mysqldb')['db'];config[_0xe01e('0x18')]=_[_0xe01e('0x19')](config['redis'],{'host':_0xe01e('0x1a'),'port':0x18eb});var socket=require(_0xe01e('0x1b'))(new Redis(config[_0xe01e('0x18')]));require(_0xe01e('0x1c'))[_0xe01e('0x1d')](socket);function respondWithStatusCode(_0x36ad9a,_0x53e366){_0x53e366=_0x53e366||0xcc;return function(_0x551c9c){if(_0x551c9c){return _0x36ad9a['sendStatus'](_0x53e366);}return _0x36ad9a[_0xe01e('0x1e')](_0x53e366)[_0xe01e('0x1f')]();};}function respondWithResult(_0x3ec235,_0x1d5e2a){_0x1d5e2a=_0x1d5e2a||0xc8;return function(_0x5daf36){if(_0x5daf36){return _0x3ec235[_0xe01e('0x1e')](_0x1d5e2a)[_0xe01e('0x20')](_0x5daf36);}};}function respondWithFilteredResult(_0x275887,_0x2392cd){return function(_0x31b39f){if(_0x31b39f){var _0x28e226=typeof _0x2392cd['offset']===_0xe01e('0x21')&&typeof _0x2392cd[_0xe01e('0x22')]===_0xe01e('0x21');var _0x2dbaef=_0x31b39f[_0xe01e('0x23')];var _0x3c6da8=_0x28e226?0x0:_0x2392cd[_0xe01e('0x24')];var _0x2e6540=_0x28e226?_0x31b39f[_0xe01e('0x23')]:_0x2392cd[_0xe01e('0x24')]+_0x2392cd[_0xe01e('0x22')];var _0x4ef0db;if(_0x2e6540>=_0x2dbaef){_0x2e6540=_0x2dbaef;_0x4ef0db=0xc8;}else{_0x4ef0db=0xce;}_0x275887[_0xe01e('0x1e')](_0x4ef0db);return _0x275887[_0xe01e('0x25')](_0xe01e('0x26'),_0x3c6da8+'-'+_0x2e6540+'/'+_0x2dbaef)['json'](_0x31b39f);}return null;};}function patchUpdates(_0x200de0){return function(_0x4e23bf){try{jsonpatch['apply'](_0x4e23bf,_0x200de0,!![]);}catch(_0x20408a){return BPromise[_0xe01e('0x27')](_0x20408a);}return _0x4e23bf[_0xe01e('0x28')]();};}function saveUpdates(_0x16639f,_0x221d41){return function(_0x15c282){if(_0x15c282){return _0x15c282[_0xe01e('0x29')](_0x16639f)['then'](function(_0x5561b0){return _0x5561b0;});}return null;};}function removeEntity(_0x39d1d7,_0xeb1af5){return function(_0x56a7f6){if(_0x56a7f6){return _0x56a7f6[_0xe01e('0x2a')]()[_0xe01e('0x2b')](function(){_0x39d1d7[_0xe01e('0x1e')](0xcc)[_0xe01e('0x1f')]();});}};}function handleEntityNotFound(_0x58a680,_0x27a3ad){return function(_0x390abf){if(!_0x390abf){_0x58a680[_0xe01e('0x2c')](0x194);}return _0x390abf;};}function handleError(_0x2ed1cc,_0x3bb6eb){_0x3bb6eb=_0x3bb6eb||0x1f4;return function(_0x419b7b){logger['error'](_0x419b7b[_0xe01e('0x2d')]);if(_0x419b7b[_0xe01e('0x2e')]){delete _0x419b7b[_0xe01e('0x2e')];}_0x2ed1cc['status'](_0x3bb6eb)[_0xe01e('0x2f')](_0x419b7b);};}function getInteractionUsers(_0x59bcbd,_0x2e2e56){return new BPromise(function(_0x5ba110,_0x37283c){try{if(_0x2e2e56[_0x59bcbd['id']]){_0x59bcbd[_0xe01e('0x30')]=_[_0xe01e('0x31')](_0x2e2e56[_0x59bcbd['id']],function(_0x380630){return{'id':_0x380630['id'],'fullname':_0x380630['fullname']};});}}catch(_0x33d932){_0x37283c(_0x33d932);}_0x5ba110(_0x59bcbd);});}function getInteractionTags(_0x19ef40,_0x343453){return new BPromise(function(_0x6d8da7,_0x21d007){try{if(_0x19ef40[_0xe01e('0x32')]){_0x19ef40[_0xe01e('0x33')]=[];_0x19ef40[_0xe01e('0x32')]['split'](',')[_0xe01e('0x34')](function(_0x3f07ae){_0x19ef40[_0xe01e('0x33')][_0xe01e('0x35')](_0x343453[_0x3f07ae]);});}delete _0x19ef40[_0xe01e('0x32')];}catch(_0x1ab864){_0x21d007(_0x1ab864);}_0x6d8da7(_0x19ef40);});}function updateOpenchannelInteraction(_0x48e8d4,_0x3d144f,_0x52aa2c){return new BPromise(function(_0x504231,_0x151294){return getInteractionUsers(_0x48e8d4,_0x52aa2c)[_0xe01e('0x2b')](function(_0x3ef90a){return getInteractionTags(_0x3ef90a,_0x3d144f);})[_0xe01e('0x2b')](function(_0x415749){return getStateInteraction(_0x415749);})['then'](function(_0x119e49){_0x504231(_0x119e49);})[_0xe01e('0x36')](function(_0x513806){_0x151294(_0x513806);});});}function getStateInteraction(_0x25e70b){return new BPromise(function(_0x198e2e){_0x25e70b[_0xe01e('0x37')]=0x0;_0x25e70b[_0xe01e('0x38')]=0x0;_0x25e70b[_0xe01e('0x39')]=0x0;_0x25e70b[_0xe01e('0x3a')]=0x0;_0x25e70b[_0xe01e('0x3b')]=0x0;if(!_0x25e70b[_0xe01e('0x3c')]&&!_0x25e70b['UserId']){_0x25e70b[_0xe01e('0x37')]+=0x1;}if(!_0x25e70b[_0xe01e('0x3c')]&&_0x25e70b['UserId']){_0x25e70b['talking']+=0x1;if(_0x25e70b[_0xe01e('0x37')]){_0x25e70b[_0xe01e('0x37')]-=0x1;}}if(_0x25e70b[_0xe01e('0x3c')]&&_0x25e70b[_0xe01e('0x3d')]){_0x25e70b[_0xe01e('0x39')]+=0x1;if(_0x25e70b[_0xe01e('0x38')]){_0x25e70b['talking']-=0x1;}}if(_0x25e70b['closed']&&!_0x25e70b[_0xe01e('0x3d')]){_0x25e70b[_0xe01e('0x3a')]+=0x1;if(_0x25e70b['waiting']){_0x25e70b['waiting']-=0x1;}}_0x25e70b[_0xe01e('0x3b')]+=0x1;_0x198e2e(_0x25e70b);});}exports[_0xe01e('0x3e')]=function(_0x547c57,_0x5182ca){var _0x5d7e57={},_0x2ce9fc={},_0xcbd457={'count':0x0,'rows':[]};var _0x13ed34=_[_0xe01e('0x31')](db[_0xe01e('0x3f')][_0xe01e('0x40')],function(_0x379310){return{'name':_0x379310[_0xe01e('0x41')],'type':_0x379310[_0xe01e('0x42')][_0xe01e('0x43')]};});_0x2ce9fc[_0xe01e('0x44')]=_[_0xe01e('0x31')](_0x13ed34,_0xe01e('0x2e'));_0x2ce9fc[_0xe01e('0x45')]=_[_0xe01e('0x46')](_0x547c57[_0xe01e('0x45')]);_0x2ce9fc[_0xe01e('0x47')]=_[_0xe01e('0x48')](_0x2ce9fc[_0xe01e('0x44')],_0x2ce9fc[_0xe01e('0x45')]);_0x5d7e57[_0xe01e('0x49')]=_[_0xe01e('0x48')](_0x2ce9fc[_0xe01e('0x44')],qs[_0xe01e('0x4a')](_0x547c57[_0xe01e('0x45')][_0xe01e('0x4a')]));_0x5d7e57[_0xe01e('0x49')]=_0x5d7e57['attributes']['length']?_0x5d7e57['attributes']:_0x2ce9fc[_0xe01e('0x44')];if(!_0x547c57[_0xe01e('0x45')][_0xe01e('0x4b')](_0xe01e('0x4c'))){_0x5d7e57[_0xe01e('0x22')]=qs[_0xe01e('0x22')](_0x547c57[_0xe01e('0x45')][_0xe01e('0x22')]);_0x5d7e57[_0xe01e('0x24')]=qs['offset'](_0x547c57[_0xe01e('0x45')][_0xe01e('0x24')]);}_0x5d7e57['order']=qs[_0xe01e('0x4d')](_0x547c57[_0xe01e('0x45')]['sort']);_0x5d7e57['where']=qs[_0xe01e('0x47')](_['pick'](_0x547c57['query'],_0x2ce9fc[_0xe01e('0x47')]),_0x13ed34);var _0x4196f7=[];var _0x14a8fe=squel[_0xe01e('0x4e')]()[_0xe01e('0x4f')]('id')['field'](_0xe01e('0x2e'))[_0xe01e('0x4f')](_0xe01e('0x50'))[_0xe01e('0x51')]('tools_tags');var _0x20fa86=squel[_0xe01e('0x4e')]()['field'](_0xe01e('0x52'))['field'](_0xe01e('0x53'))[_0xe01e('0x4f')]('ui.OpenchannelInteractionId')['from'](_0xe01e('0x54'),'ui')[_0xe01e('0x55')](_0xe01e('0x56'),'u',_0xe01e('0x57'));var _0x16780=squel[_0xe01e('0x4e')]()[_0xe01e('0x51')]('openchannel_interactions','i')[_0xe01e('0x55')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe01e('0x55')](_0xe01e('0x56'),'o',_0xe01e('0x58'))['left_join'](_0xe01e('0x59'),'a',_0xe01e('0x5a'))[_0xe01e('0x55')]('openchannel_messages','me',_0xe01e('0x5b'))['left_join'](_0xe01e('0x5c'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xe01e('0x55')]('tools_tags','t',_0xe01e('0x5d'));var _0x26de6b=squel[_0xe01e('0x5e')]();var _0x2839b5=[];var _0x3f7048=squel['expr']();var _0x15d657;if(_0x547c57[_0xe01e('0x45')]['search']){_0x15d657=as[_0xe01e('0x5f')](_0x547c57[_0xe01e('0x45')][_0xe01e('0x60')]);var _0x23306a=_0x15d657['sqlOperator'];for(var _0x4b838d=0x0;_0x4b838d<_0x15d657['conditions'][_0xe01e('0x61')];_0x4b838d++){var _0x259559=_0x15d657['conditions'][_0x4b838d];var _0x2dfbe2='i';var _0x5abdb4=_[_0xe01e('0x62')](_0x13ed34,[_0xe01e('0x2e'),_0x259559[_0xe01e('0x4f')]]);if(!_0x5abdb4){switch(_0x259559[_0xe01e('0x4f')]){case _0xe01e('0x63'):if(_0x259559[_0xe01e('0x64')]==0x1){_0x16780['having']('`'+_0x259559[_0xe01e('0x4f')]+_0xe01e('0x65'));}else{_0x16780[_0xe01e('0x66')]('`'+_0x259559[_0xe01e('0x4f')]+'`\x20>\x200');}break;case _0xe01e('0x67'):if(_0x259559[_0xe01e('0x68')]==='$substring'){if(_0x259559[_0xe01e('0x64')][_0xe01e('0x69')]('\x20')[_0xe01e('0x61')]>0x1){_0x26de6b[_0x23306a](_0xe01e('0x6a'),qs[_0xe01e('0x6b')](_0x259559[_0xe01e('0x64')]),null);}else{var _0x4a6bfb='%'+_0x259559['value']+'%';_0x26de6b[_0x23306a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4a6bfb,_0x4a6bfb,_0x4a6bfb);}}else{_0x5abdb4=_[_0xe01e('0x62')](_0x13ed34,[_0xe01e('0x2e'),_0xe01e('0x6c')]);_0x259559['field']='ContactId';_0x251b6c=as[_0xe01e('0x6d')](_0x2dfbe2,_0x5abdb4[_0xe01e('0x42')],_0x259559);_0x26de6b[_0x23306a](_0x251b6c[_0xe01e('0x6e')],_0x251b6c[_0xe01e('0x64')][_0xe01e('0x6f')],_0x251b6c['value'][_0xe01e('0x1f')]);}break;case _0xe01e('0x70'):var _0x19f7a9=_0x259559[_0xe01e('0x64')]['split'](',')[_0xe01e('0x31')](function(_0x458752){return Number(_0x458752);});_0x19f7a9[_0xe01e('0x34')](function(_0x44f6bf){_0x3f7048['or'](_0xe01e('0x71'),'%,'+_0x44f6bf+',%');});_0x2839b5=_[_0xe01e('0x72')](_0x2839b5,_0x19f7a9);break;case _0xe01e('0x73'):if(_0x259559[_0xe01e('0x68')]===_0xe01e('0x74')){_0x26de6b[_0x23306a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x259559[_0xe01e('0x64')]+'%',null);}else{_0x5abdb4=_['find'](_0x13ed34,[_0xe01e('0x2e'),_0xe01e('0x3d')]);_0x259559[_0xe01e('0x4f')]='UserId';_0x251b6c=as[_0xe01e('0x6d')](_0x2dfbe2,_0x5abdb4['type'],_0x259559);_0x26de6b[_0x23306a](_0x251b6c[_0xe01e('0x6e')],_0x251b6c[_0xe01e('0x64')][_0xe01e('0x6f')],_0x251b6c[_0xe01e('0x64')][_0xe01e('0x1f')]);}break;case'body':_0x251b6c=as[_0xe01e('0x6d')]('me',null,_0x259559);_0x26de6b[_0x23306a](_0x251b6c[_0xe01e('0x6e')],_0x251b6c[_0xe01e('0x64')][_0xe01e('0x6f')],_0x251b6c['value'][_0xe01e('0x1f')]);break;}}else{var _0x251b6c=as['buildExpression'](_0x2dfbe2,_0x5abdb4[_0xe01e('0x42')],_0x259559);_0x26de6b[_0x23306a](_0x251b6c['text'],_0x251b6c['value'][_0xe01e('0x6f')],_0x251b6c[_0xe01e('0x64')][_0xe01e('0x1f')]);}}}else{var _0x2d26c3=_(_0x547c57[_0xe01e('0x45')])[_0xe01e('0x46')]()[_0xe01e('0x31')](function(_0x484d51){return _[_0xe01e('0x75')](_0x13ed34,[_0xe01e('0x2e'),_0x484d51])?_0x484d51:undefined;})[_0xe01e('0x76')]()[_0xe01e('0x64')]();if(!_[_0xe01e('0x77')](_0x2d26c3)){_0x2d26c3[_0xe01e('0x34')](function(_0x11035f){if(_0x11035f===_0xe01e('0x78')){_0x16780[_0xe01e('0x79')](_0xe01e('0x7a'),[][_0xe01e('0x7b')](_0x547c57['query'][_0x11035f]));}else if(_0x11035f===_0xe01e('0x7c')){var _0x3aa76f=JSON['parse'](_0x547c57[_0xe01e('0x45')][_0x11035f])[_0xe01e('0x7d')];var _0x32c18c=JSON[_0xe01e('0x7e')](_0x547c57['query'][_0x11035f])['$lte'];_0x16780[_0xe01e('0x79')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3aa76f,_0x32c18c);}else{if(_0x547c57[_0xe01e('0x45')][_0x11035f]===_0xe01e('0x7f')){_0x16780[_0xe01e('0x79')]('i.'+_0x11035f+_0xe01e('0x80'));}else{_0x16780['where']('i.'+_0x11035f+_0xe01e('0x81'),_0x547c57[_0xe01e('0x45')][_0x11035f]);}}});}if(_0x547c57[_0xe01e('0x45')][_0xe01e('0x82')]){if(_0x547c57[_0xe01e('0x45')][_0xe01e('0x82')]==0x1){_0x16780[_0xe01e('0x66')](_0xe01e('0x83'));}else{_0x16780['having'](_0xe01e('0x84'));}}if(_0x547c57[_0xe01e('0x45')]['tag']){_0x2839b5=_[_0xe01e('0x85')](_0x547c57[_0xe01e('0x45')][_0xe01e('0x86')])?_0x547c57[_0xe01e('0x45')][_0xe01e('0x86')]:new Array(_0x547c57[_0xe01e('0x45')][_0xe01e('0x86')]);_0x2839b5[_0xe01e('0x34')](function(_0x128631){_0x3f7048['or'](_0xe01e('0x71'),'%,'+_0x128631+',%');});}if(_0x547c57[_0xe01e('0x45')][_0xe01e('0x87')]){var _0x3e26b8=_0x547c57[_0xe01e('0x45')]['filter']['replace']('\x5c','\x5c\x5c')[_0xe01e('0x88')](/'/g,'\x27\x27');if(qs[_0xe01e('0x89')](_0x3e26b8)){_0x26de6b['or'](_0xe01e('0x8a'),_0x3e26b8+'%');}else{_0x26de6b['or'](_0xe01e('0x8b'),qs[_0xe01e('0x6b')](_0x3e26b8))['or']('i.from\x20LIKE\x20?',_0x3e26b8+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3e26b8+'%');}}}_0x16780['where'](_0x26de6b);_0x16780[_0xe01e('0x8c')]('i.id');var _0x2063bc={'type':db[_0xe01e('0x8d')][_0xe01e('0x8e')][_0xe01e('0x8f')],'raw':!![]};var _0x217218=_0x16780[_0xe01e('0x90')]();_0x217218[_0xe01e('0x4f')](_0xe01e('0x91'));_0x217218[_0xe01e('0x4f')](_0xe01e('0x92'),_0xe01e('0x63'));if(_0x5d7e57[_0xe01e('0x93')]){_0x5d7e57[_0xe01e('0x93')][_0xe01e('0x34')](function(_0x17d068){var _0x362e6d=_0x17d068[0x0]===_0xe01e('0x94')?_0x17d068[0x0]:'i.'+_0x17d068[0x0];_0x16780[_0xe01e('0x93')](_0x362e6d,_0x17d068[0x1]===_0xe01e('0x95')?![]:!![]);});}if(!_[_0xe01e('0x77')](_0x2839b5)){_0x16780[_0xe01e('0x66')](_0x3f7048);_0x217218[_0xe01e('0x79')](_0xe01e('0x96'),_0x2839b5);}BPromise[_0xe01e('0x97')]()[_0xe01e('0x2b')](function(){if(!_0x15d657){if(_0x547c57[_0xe01e('0x45')][_0xe01e('0x78')])return;_0x217218['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x16780[_0xe01e('0x79')](_0xe01e('0x98'));return;}if(_0x547c57['user']['role']!==_0xe01e('0x99'))return;return _0x547c57[_0xe01e('0x9a')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xe01e('0x2b')](function(_0x3f1411){if(_[_0xe01e('0x77')](_0x3f1411)){_0x217218[_0xe01e('0x79')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x16780['where'](_0xe01e('0x9b'));}else{_0x217218[_0xe01e('0x79')](_0xe01e('0x7a'),_[_0xe01e('0x31')](_0x3f1411,'id'));_0x16780[_0xe01e('0x79')](_0xe01e('0x7a'),_[_0xe01e('0x31')](_0x3f1411,'id'));}});})[_0xe01e('0x2b')](function(){if(_0x547c57[_0xe01e('0x9a')][_0xe01e('0x9c')]===_0xe01e('0x99')&&!_0x15d657&&!_0x547c57[_0xe01e('0x45')][_0xe01e('0x78')])return[];return db['sequelize'][_0xe01e('0x45')](_0x217218[_0xe01e('0x9d')](),_0x2063bc);})[_0xe01e('0x2b')](function(_0x437915){_0xcbd457[_0xe01e('0x23')]=_0x437915[_0xe01e('0x61')];if(_0xcbd457[_0xe01e('0x23')]===0x0)return[];return db['sequelize'][_0xe01e('0x45')](_0x14a8fe['toString'](),_0x2063bc)[_0xe01e('0x2b')](function(_0x464100){_0x4196f7=_[_0xe01e('0x9e')](_0x464100,'id');_0x2063bc=_[_0xe01e('0x9f')](_0x2063bc,{'model':db[_0xe01e('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x547c57[_0xe01e('0x45')][_0xe01e('0x4a')]){_0x5d7e57[_0xe01e('0x49')]['forEach'](function(_0xeb4689){_0x16780[_0xe01e('0x4f')]('i.'+_0xeb4689);});}else{_0x16780[_0xe01e('0x4f')](_0xe01e('0x92'),_0xe01e('0x63'));_0x16780['field'](_0xe01e('0xa0'),_0xe01e('0xa1'));_0x16780[_0xe01e('0x4f')](_0xe01e('0xa2'),'Account.mandatoryDisposition');_0x16780['field'](_0xe01e('0xa3'),_0xe01e('0x94'));_0x16780[_0xe01e('0x4f')]('i.*');_0x16780[_0xe01e('0x4f')]('c.firstName',_0xe01e('0xa4'));_0x16780[_0xe01e('0x4f')](_0xe01e('0xa5'),'Contact.lastName');_0x16780[_0xe01e('0x4f')](_0xe01e('0xa6'),'Contact.email');_0x16780['field'](_0xe01e('0xa7'),_0xe01e('0xa8'));_0x16780['field']('c.mobile',_0xe01e('0xa9'));_0x16780['field'](_0xe01e('0xaa'),_0xe01e('0xab'));_0x16780[_0xe01e('0x4f')](_0xe01e('0xac'),'Owner.fullname');_0x16780[_0xe01e('0x4f')](_0xe01e('0xad'),_0xe01e('0xae'));_0x16780['field'](_0xe01e('0xaf'),_0xe01e('0x32'));}if(_0x5d7e57[_0xe01e('0x22')])_0x16780[_0xe01e('0x22')](_0x5d7e57[_0xe01e('0x22')]);if(_0x5d7e57[_0xe01e('0x24')])_0x16780[_0xe01e('0x24')](_0x5d7e57[_0xe01e('0x24')]);return db[_0xe01e('0xb0')][_0xe01e('0x45')](_0x16780[_0xe01e('0x9d')](),_0x2063bc);})[_0xe01e('0x2b')](function(_0x2e4d2d){if(_0x2e4d2d['length']>0x0)_0x20fa86['where'](_0xe01e('0xb1'),_['map'](_0x2e4d2d,'id'));return db[_0xe01e('0xb0')][_0xe01e('0x45')](_0x20fa86[_0xe01e('0x9d')](),_0x2063bc)['then'](function(_0x518003){var _0x463f40=_[_0xe01e('0xb2')](_0x518003,'OpenchannelInteractionId');var _0xd50aea=[];_0x2e4d2d[_0xe01e('0x34')](function(_0x238f80){_0xd50aea[_0xe01e('0x35')](updateOpenchannelInteraction(_0x238f80,_0x4196f7,_0x463f40));});return BPromise['all'](_0xd50aea);});});})[_0xe01e('0x2b')](function(_0x533f0b){_0xcbd457[_0xe01e('0xb3')]=_0x533f0b;return _0xcbd457;})[_0xe01e('0x2b')](respondWithFilteredResult(_0x5182ca,_0x5d7e57))[_0xe01e('0x36')](handleError(_0x5182ca,null));};exports['show']=function(_0x39103b,_0x963d79){var _0xd0c111={};if(_0x39103b[_0xe01e('0x45')][_0xe01e('0x42')]&&_0x39103b[_0xe01e('0x45')]['type']===_0xe01e('0x51')){_0xd0c111[_0xe01e('0x51')]=_0x39103b[_0xe01e('0xb4')]['id'];}else{_0xd0c111['id']=_0x39103b[_0xe01e('0xb4')]['id'];}var _0x49005c={'raw':![],'where':_0xd0c111},_0x5a8d7e={};_0x5a8d7e['model']=_[_0xe01e('0x46')](db[_0xe01e('0x3f')][_0xe01e('0x40')]);_0x5a8d7e['query']=_[_0xe01e('0x46')](_0x39103b[_0xe01e('0x45')]);_0x5a8d7e[_0xe01e('0x47')]=_[_0xe01e('0x48')](_0x5a8d7e[_0xe01e('0x44')],_0x5a8d7e[_0xe01e('0x45')]);_0x49005c['attributes']=_[_0xe01e('0x48')](_0x5a8d7e[_0xe01e('0x44')],qs['fields'](_0x39103b[_0xe01e('0x45')][_0xe01e('0x4a')]));_0x49005c['attributes']=_0x49005c[_0xe01e('0x49')][_0xe01e('0x61')]?_0x49005c[_0xe01e('0x49')]:_0x5a8d7e['model'];if(_0x39103b[_0xe01e('0x45')][_0xe01e('0xb5')]){_0x49005c[_0xe01e('0xb6')]=[{'all':!![]}];}_0x49005c=_[_0xe01e('0x9f')]({},_0x49005c,_0x39103b[_0xe01e('0xb7')]);return db[_0xe01e('0x3f')][_0xe01e('0x62')](_0x49005c)[_0xe01e('0x2b')](handleEntityNotFound(_0x963d79,null))[_0xe01e('0x2b')](respondWithResult(_0x963d79,null))[_0xe01e('0x36')](handleError(_0x963d79,null));};exports[_0xe01e('0xb8')]=function(_0x591fa4,_0x389831){return db[_0xe01e('0x3f')][_0xe01e('0xb8')](_0x591fa4[_0xe01e('0xb9')],{})[_0xe01e('0x2b')](respondWithResult(_0x389831,0xc9))[_0xe01e('0x36')](handleError(_0x389831,null));};exports[_0xe01e('0x29')]=function(_0x1c4709,_0x1db341){if(_0x1c4709[_0xe01e('0xb9')]['id']){delete _0x1c4709[_0xe01e('0xb9')]['id'];}return db[_0xe01e('0x3f')][_0xe01e('0x62')]({'where':{'id':_0x1c4709[_0xe01e('0xb4')]['id']}})[_0xe01e('0x2b')](handleEntityNotFound(_0x1db341,null))['then'](saveUpdates(_0x1c4709[_0xe01e('0xb9')],null))[_0xe01e('0x2b')](respondWithResult(_0x1db341,null))[_0xe01e('0x36')](handleError(_0x1db341,null));};exports[_0xe01e('0x2a')]=function(_0x2a6d2a,_0x30aecc){return db[_0xe01e('0x3f')][_0xe01e('0x62')]({'where':{'id':_0x2a6d2a['params']['id']}})[_0xe01e('0x2b')](handleEntityNotFound(_0x30aecc,null))['then'](removeEntity(_0x30aecc,null))[_0xe01e('0x36')](handleError(_0x30aecc,null));};exports['describe']=function(_0xf79e66,_0x44d33a){return db[_0xe01e('0x3f')]['describe']()[_0xe01e('0x2b')](respondWithResult(_0x44d33a,null))[_0xe01e('0x36')](handleError(_0x44d33a,null));};exports['addMessage']=function(_0x5479e0,_0x40b3e0,_0x338737){return db[_0xe01e('0xba')][_0xe01e('0x62')]({'where':{'id':_0x5479e0['params']['id']}})[_0xe01e('0x2b')](handleEntityNotFound(_0x40b3e0,null))[_0xe01e('0x2b')](function(_0xe4fe41){if(_0xe4fe41){return _0xe4fe41['addMessage'](_0x5479e0['body'][_0xe01e('0xbb')],_[_0xe01e('0xbc')](_0x5479e0['body'],[_0xe01e('0xbb'),'id'])||{});}})[_0xe01e('0x2b')](respondWithResult(_0x40b3e0,null))[_0xe01e('0x36')](handleError(_0x40b3e0,null));};exports['getMessages']=function(_0x155d48,_0x46f46e,_0x4acefe){var _0x56bb3d={'raw':![],'where':{}};var _0x22853c={};var _0x28885a={'count':0x0,'rows':[]};return db[_0xe01e('0x3f')][_0xe01e('0xbd')]({'where':{'id':_0x155d48[_0xe01e('0xb4')]['id']}})['then'](handleEntityNotFound(_0x46f46e,null))[_0xe01e('0x2b')](function(_0x99c99d){if(_0x99c99d){_0x22853c[_0xe01e('0x44')]=_[_0xe01e('0x46')](db[_0xe01e('0xba')][_0xe01e('0x40')]);_0x22853c['query']=_[_0xe01e('0x46')](_0x155d48[_0xe01e('0x45')]);_0x22853c[_0xe01e('0x47')]=_[_0xe01e('0x48')](_0x22853c['model'],_0x22853c[_0xe01e('0x45')]);_0x56bb3d[_0xe01e('0x49')]=_[_0xe01e('0x48')](_0x22853c['model'],qs[_0xe01e('0x4a')](_0x155d48[_0xe01e('0x45')][_0xe01e('0x4a')]));_0x56bb3d[_0xe01e('0x49')]=_0x56bb3d[_0xe01e('0x49')][_0xe01e('0x61')]?_0x56bb3d['attributes']:_0x22853c[_0xe01e('0x44')];if(!_0x155d48[_0xe01e('0x45')][_0xe01e('0x4b')](_0xe01e('0x4c'))){_0x56bb3d[_0xe01e('0x22')]=qs[_0xe01e('0x22')](_0x155d48['query'][_0xe01e('0x22')]);_0x56bb3d[_0xe01e('0x24')]=qs[_0xe01e('0x24')](_0x155d48[_0xe01e('0x45')][_0xe01e('0x24')]);}_0x56bb3d[_0xe01e('0x93')]=qs[_0xe01e('0x4d')](_0x155d48[_0xe01e('0x45')][_0xe01e('0x4d')]);_0x56bb3d[_0xe01e('0x79')]=qs['filters'](_[_0xe01e('0xbe')](_0x155d48[_0xe01e('0x45')],_0x22853c[_0xe01e('0x47')]));_0x56bb3d['where'][_0xe01e('0xbf')]=_0x99c99d['id'];if(_0x155d48[_0xe01e('0x45')][_0xe01e('0x87')]){_0x56bb3d[_0xe01e('0x79')]=_[_0xe01e('0x9f')](_0x56bb3d[_0xe01e('0x79')],{'$or':_[_0xe01e('0x31')](_0x56bb3d[_0xe01e('0x49')],function(_0x24ba14){var _0x41718d={};_0x41718d[_0x24ba14]={'$like':'%'+_0x155d48[_0xe01e('0x45')][_0xe01e('0x87')]+'%'};return _0x41718d;})});}if(_0x155d48[_0xe01e('0x45')][_0xe01e('0x7d')]){var _0x33f2d0=_0x155d48[_0xe01e('0x45')][_0xe01e('0x7d')][_0xe01e('0x69')](',');var _0x397aaa={};_0x397aaa[_0x33f2d0[0x0]]={'$gte':moment(_0x33f2d0[0x1])['format'](_0xe01e('0xc0'))};_0x56bb3d[_0xe01e('0x79')]=_[_0xe01e('0x9f')](_0x56bb3d['where'],_0x397aaa);}_0x56bb3d=_[_0xe01e('0x9f')]({},_0x56bb3d,_0x155d48[_0xe01e('0xb7')]);return db[_0xe01e('0xba')]['count']({'where':_0x56bb3d[_0xe01e('0x79')]})['then'](function(_0x1413db){_0x28885a['count']=_0x1413db;if(_0x155d48[_0xe01e('0x45')][_0xe01e('0xb5')]){_0x56bb3d[_0xe01e('0xb6')]=[{'all':!![]}];}return db[_0xe01e('0xba')][_0xe01e('0xc1')](_0x56bb3d);})[_0xe01e('0x2b')](function(_0x34fd3f){_0x28885a[_0xe01e('0xb3')]=_0x34fd3f;return _0x28885a;});}})['then'](respondWithFilteredResult(_0x46f46e,_0x56bb3d))['catch'](handleError(_0x46f46e,null));};exports['addTags']=function(_0x104fef,_0x5e9281,_0x3b3632){return db[_0xe01e('0x3f')][_0xe01e('0x62')]({'where':{'id':_0x104fef['params']['id']}})['then'](handleEntityNotFound(_0x5e9281,null))[_0xe01e('0x2b')](function(_0x5645bb){if(_0x5645bb){return _0x5645bb[_0xe01e('0xc2')](_0x104fef['body'][_0xe01e('0xbb')],_[_0xe01e('0xbc')](_0x104fef[_0xe01e('0xb9')],[_0xe01e('0xbb'),'id'])||{})[_0xe01e('0xc3')](function(){return db['Tag'][_0xe01e('0xc1')]({'attributes':['id',_0xe01e('0x2e'),_0xe01e('0x50')],'where':{'id':_0x104fef[_0xe01e('0xb9')][_0xe01e('0xbb')]}});})[_0xe01e('0x2b')](function(_0x34e238){socket['emit'](_0xe01e('0xc4'),{'id':Number(_0x104fef[_0xe01e('0xb4')]['id']),'tags':_0x34e238||[]});return{'id':Number(_0x104fef[_0xe01e('0xb4')]['id']),'tags':_0x34e238||[]};});}})[_0xe01e('0x2b')](respondWithResult(_0x5e9281,null))[_0xe01e('0x36')](handleError(_0x5e9281,null));};exports[_0xe01e('0xc5')]=function(_0x37d5a5,_0x5d3fda,_0x11551a){return db[_0xe01e('0x3f')][_0xe01e('0x62')]({'where':{'id':_0x37d5a5[_0xe01e('0xb4')]['id']}})[_0xe01e('0x2b')](handleEntityNotFound(_0x5d3fda,null))['then'](function(_0xcfe318){if(_0xcfe318){return _0xcfe318[_0xe01e('0xc5')](_0x37d5a5[_0xe01e('0x45')][_0xe01e('0xbb')]);}})[_0xe01e('0x2b')](respondWithStatusCode(_0x5d3fda,null))[_0xe01e('0x36')](handleError(_0x5d3fda,null));};exports[_0xe01e('0xc6')]=function(_0x1ff154,_0x54be21){var _0x3fc4f5=moment()[_0xe01e('0xc7')]()[_0xe01e('0x9d')]();var _0xdc6109=path[_0xe01e('0xc8')](config['root'],_0xe01e('0xc9'),_0xe01e('0xca'),'tmp');var _0x4d3b27=path['join'](config[_0xe01e('0xcb')],'server','files',_0xe01e('0xcc'));var _0x4ecb00=path[_0xe01e('0xc8')](_0xdc6109,_0x3fc4f5);var _0x1afffa=util['format'](_0xe01e('0xcd'),_0x1ff154[_0xe01e('0xb4')]['id'],_0x3fc4f5);var _0x326fc8=path['join'](_0xdc6109,_0x1afffa);var _0x130c6a=[];_0x130c6a[_0xe01e('0x35')]({'model':db[_0xe01e('0x73')],'as':_0xe01e('0x73'),'attributes':['id','fullname'],'raw':!![]});_0x130c6a['push']({'model':db[_0xe01e('0xce')],'as':_0xe01e('0x67'),'attributes':['id',_0xe01e('0xcf'),'lastName'],'raw':!![]});if(_0x1ff154[_0xe01e('0x45')][_0xe01e('0xcc')]){_0x130c6a[_0xe01e('0x35')]({'model':db['Attachment'],'as':_0xe01e('0xd0'),'raw':!![]});}var _0x41c43e=[{'model':db[_0xe01e('0xba')],'as':_0xe01e('0xd1'),'attributes':['id',_0xe01e('0xb9'),'createdAt',_0xe01e('0xd2'),_0xe01e('0xd3'),'read'],'include':_0x130c6a}];_0x41c43e[_0xe01e('0x35')]({'model':db[_0xe01e('0xd4')],'as':_0xe01e('0xd5'),'attributes':['id',_0xe01e('0x2e')]});_0x41c43e[_0xe01e('0x35')]({'model':db[_0xe01e('0x73')],'as':_0xe01e('0xd6'),'attributes':['id',_0xe01e('0xd7')]});return db['OpenchannelInteraction'][_0xe01e('0x62')]({'where':{'id':_0x1ff154[_0xe01e('0xb4')]['id']},'include':_0x41c43e})[_0xe01e('0x2b')](handleEntityNotFound(_0x54be21,null))[_0xe01e('0x2b')](function(_0x32eff0){if(_0x32eff0){var _0x52228e=_0x32eff0['get']({'plain':!![]});fs[_0xe01e('0xd8')](_0x4ecb00);var _0x35a8a9={'channel':_0xe01e('0xd9'),'account':_0x52228e[_0xe01e('0xd5')][_0xe01e('0x2e')],'agent':_0x52228e['Owner']?_0x52228e['Owner'][_0xe01e('0xd7')]:_0xe01e('0xda'),'createdAt':moment(_0x52228e[_0xe01e('0x7c')])[_0xe01e('0xdb')](_0xe01e('0xc0'))[_0xe01e('0x9d')](),'closedAt':_0x52228e[_0xe01e('0x3c')]?moment(_0x52228e[_0xe01e('0xdc')])[_0xe01e('0xdb')](_0xe01e('0xc0'))[_0xe01e('0x9d')]():'','disposition':_0x52228e[_0xe01e('0xdd')],'visibility':_0x52228e[_0xe01e('0xde')]?_0xe01e('0xdf'):_0xe01e('0xe0'),'messages':_(_0x52228e[_0xe01e('0xd1')])[_0xe01e('0x87')]({'secret':![]})[_0xe01e('0x31')](function(_0x2d695d){if(_0x2d695d[_0xe01e('0xd0')]){var _0x440b56=path[_0xe01e('0xc8')](_0x4d3b27,_0x2d695d[_0xe01e('0xd0')]['basename']);if(fs[_0xe01e('0xe1')](_0x440b56)){fs['createReadStream'](_0x440b56)[_0xe01e('0xe2')](fs[_0xe01e('0xe3')](path['join'](_0x4ecb00,_0x2d695d['Attachment'][_0xe01e('0xe4')])));}}return{'date':moment(_0x2d695d[_0xe01e('0x7c')])['format'](_0xe01e('0xc0'))['toString'](),'sender':_0x2d695d['direction']===_0xe01e('0xe5')?_0x2d695d[_0xe01e('0x73')]?_0x2d695d[_0xe01e('0x73')][_0xe01e('0xd7')]:'System':_0x2d695d[_0xe01e('0x67')][_0xe01e('0xcf')]+(_0x2d695d[_0xe01e('0x67')][_0xe01e('0xe6')]?'\x20'+_0x2d695d[_0xe01e('0x67')][_0xe01e('0xe6')]:''),'body':_0x2d695d['Attachment']?_0x2d695d[_0xe01e('0xd0')][_0xe01e('0xe4')]:_0x2d695d[_0xe01e('0xb9')],'direction':_0x2d695d[_0xe01e('0xd2')]===_0xe01e('0xe5')?'A':'C','secret':_0x2d695d['secret'],'read':_0x2d695d[_0xe01e('0x82')],'attachment':_0x2d695d['Attachment']};})[_0xe01e('0x64')]()};return ejs[_0xe01e('0xe7')](path['join'](config[_0xe01e('0xcb')],_0xe01e('0xc9'),_0xe01e('0xe8'),_0xe01e('0xe9')),{'interaction':_0x35a8a9})[_0xe01e('0x2b')](function(_0x46873a){var _0x18dac7=path[_0xe01e('0xc8')](_0x4ecb00,_0xe01e('0xea')+_0x52228e['id']+'-'+_0x3fc4f5+_0xe01e('0xeb'));var _0x111138={'path':_0x18dac7,'channel':_0xe01e('0xd9'),'interactionId':_0x52228e['id']};return pdf['createPdfFromHTML'](_0x46873a,_0x111138);})['then'](function(){return new BPromise(function(_0x4484f6,_0xd1239c){zipdir(_0x4ecb00,{'saveTo':_0x326fc8},function(_0x34f17c,_0x1988e1){if(_0x34f17c)return _0xd1239c(_0x34f17c);return _0x4484f6(_0x1988e1);});})[_0xe01e('0x2b')](function(){return new BPromise(function(_0x224218,_0x22e5ff){rimraf(_0x4ecb00,function(_0x42e07d){if(_0x42e07d)_0x22e5ff(_0x42e07d);return _0x224218();});});})[_0xe01e('0x2b')](function(){return _0x54be21[_0xe01e('0xc6')](_0x326fc8,_0x1afffa,function(_0x14d117){if(_0x14d117){console['log'](_0xe01e('0xec'),_0x14d117);}else{fs[_0xe01e('0xed')](_0x326fc8);}});});});}else{return _0x54be21['sendStatus'](0xc8);}})[_0xe01e('0x36')](handleError(_0x54be21,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index a52db1c..72f9780 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 _0x64f9=['findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map'];(function(_0x26e782,_0x2f9b47){var _0x823b67=function(_0x9ba8fd){while(--_0x9ba8fd){_0x26e782['push'](_0x26e782['shift']());}};_0x823b67(++_0x2f9b47);}(_0x64f9,0x16e));var _0x964f=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x64f9[_0x33c9f8];return _0x2d7004;};'use strict';var EventEmitter=require(_0x964f('0x0'));var OpenchannelInteraction=require(_0x964f('0x1'))['db'][_0x964f('0x2')];var OpenchannelMessage=require(_0x964f('0x1'))['db'][_0x964f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x964f('0x4')](0x0);var events={'afterCreate':_0x964f('0x5'),'afterUpdate':_0x964f('0x6'),'afterDestroy':_0x964f('0x7')};function emitEvent(_0x149449){return function(_0x4dc1ef,_0x344977,_0x7a1c2a){_0x4dc1ef[_0x964f('0x8')]({'attributes':['id'],'raw':!![]})[_0x964f('0x9')](function(_0x804b3a){_0x4dc1ef['setDataValue'](_0x964f('0xa'),_0x804b3a[_0x964f('0xb')](function(_0x37032b){return{'id':_0x37032b['id']};}));return OpenchannelMessage[_0x964f('0xc')]({'where':{'OpenchannelInteractionId':_0x4dc1ef['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51fb77){_0x4dc1ef[_0x964f('0xd')](_0x964f('0xe'),_0x51fb77['length']);OpenchannelInteractionEvents[_0x964f('0xf')](_0x149449+':'+_0x4dc1ef['id'],_0x4dc1ef);OpenchannelInteractionEvents[_0x964f('0xf')](_0x149449,_0x4dc1ef);_0x7a1c2a(null);})[_0x964f('0x10')](_0x7a1c2a(null));};}for(var e in events){if(events[_0x964f('0x11')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc4a5=['events','OpenchannelInteraction','setMaxListeners','save','getUsers','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xc4a5,0x168));var _0x5c4a=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xc4a5[_0x1793de];return _0x4f0309;};'use strict';var EventEmitter=require(_0x5c4a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x5c4a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5c4a('0x2')](0x0);var events={'afterCreate':_0x5c4a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49080e){return function(_0x3b05d1,_0x23cff4,_0x4971a6){_0x3b05d1[_0x5c4a('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x53b723){_0x3b05d1['setDataValue']('Users',_0x53b723['map'](function(_0x953d56){return{'id':_0x953d56['id']};}));return OpenchannelMessage[_0x5c4a('0x5')]({'where':{'OpenchannelInteractionId':_0x3b05d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5c4a('0x6')](function(_0x402ce6){_0x3b05d1[_0x5c4a('0x7')](_0x5c4a('0x8'),_0x402ce6[_0x5c4a('0x9')]);OpenchannelInteractionEvents[_0x5c4a('0xa')](_0x49080e+':'+_0x3b05d1['id'],_0x3b05d1);OpenchannelInteractionEvents[_0x5c4a('0xa')](_0x49080e,_0x3b05d1);_0x4971a6(null);})[_0x5c4a('0xb')](_0x4971a6(null));};}for(var e in events){if(events[_0x5c4a('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x5c4a('0xd')](e,emitEvent(event));}}module[_0x5c4a('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 35835b5..f2f4155 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 _0x5855=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x5855,0xc9));var _0x5585=function(_0x157298,_0x2f1dd2){_0x157298=_0x157298-0x0;var _0x43368c=_0x5855[_0x157298];return _0x43368c;};'use strict';var _=require(_0x5585('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5585('0x1'));var moment=require(_0x5585('0x2'));var BPromise=require(_0x5585('0x3'));var rp=require(_0x5585('0x4'));var fs=require('fs');var path=require(_0x5585('0x5'));var rimraf=require(_0x5585('0x6'));var config=require(_0x5585('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x5585('0x8')]=function(_0x5cf18d,_0x308d61){return _0x5cf18d[_0x5585('0x9')](_0x5585('0xa'),attributes,{'tableName':_0x5585('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5585('0xc'),'collate':_0x5585('0xd'),'hooks':{'beforeUpdate':function(_0x54baa3,_0x294ef9,_0x405af7){if(_0x54baa3['changed'](_0x5585('0xe'))){_0x54baa3['closedAt']=moment()[_0x5585('0xf')](_0x5585('0x10'));}_0x405af7(null,_0x54baa3);}}});}; \ No newline at end of file +var _0x3da3=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x3da3,0xad));var _0x33da=function(_0x243d7e,_0x2b91bb){_0x243d7e=_0x243d7e-0x0;var _0x33f6c6=_0x3da3[_0x243d7e];return _0x33f6c6;};'use strict';var _=require(_0x33da('0x0'));var util=require('util');var logger=require(_0x33da('0x1'))(_0x33da('0x2'));var moment=require(_0x33da('0x3'));var BPromise=require(_0x33da('0x4'));var rp=require(_0x33da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33da('0x6'));var config=require(_0x33da('0x7'));var attributes=require(_0x33da('0x8'));module[_0x33da('0x9')]=function(_0x55a887,_0x2d0323){return _0x55a887['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x33da('0xa'),'collate':_0x33da('0xb'),'hooks':{'beforeUpdate':function(_0x8beb9,_0x367029,_0x22fce1){if(_0x8beb9[_0x33da('0xc')](_0x33da('0xd'))){_0x8beb9[_0x33da('0xe')]=moment()[_0x33da('0xf')](_0x33da('0x10'));}_0x22fce1(null,_0x8beb9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index bf14810..e7f21ad 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 _0x012d=['find','where','then','addTags','ids','omit','spread','AddTags','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','result','message','catch','OpenchannelInteraction','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x514eba,_0x263620){var _0x1599b4=function(_0x5e8898){while(--_0x5e8898){_0x514eba['push'](_0x514eba['shift']());}};_0x1599b4(++_0x263620);}(_0x012d,0x18e));var _0xd012=function(_0x3e1958,_0x47d6e5){_0x3e1958=_0x3e1958-0x0;var _0x3c72f5=_0x012d[_0x3e1958];return _0x3c72f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd012('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd012('0x1'))['db'];var utils=require(_0xd012('0x2'));var logger=require('../../config/logger')(_0xd012('0x3'));var config=require('../../config/environment');var jayson=require(_0xd012('0x4'));var client=jayson[_0xd012('0x5')][_0xd012('0x6')]({'port':0x232a});config[_0xd012('0x7')]=_['defaults'](config[_0xd012('0x7')],{'host':_0xd012('0x8'),'port':0x18eb});var socket=require(_0xd012('0x9'))(new Redis(config[_0xd012('0x7')]));require('./openchannelInteraction.socket')[_0xd012('0xa')](socket);function respondWithRpcPromise(_0x260066,_0x1d3f6e,_0x4870fa){return new BPromise(function(_0x1085e2,_0x1e32b2){return client[_0xd012('0xb')](_0x260066,_0x4870fa)['then'](function(_0x55f8d5){logger[_0xd012('0xc')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1d3f6e,'request\x20sent');logger[_0xd012('0xd')](_0xd012('0xe'),_0x1d3f6e,_0xd012('0xf'),JSON[_0xd012('0x10')](_0x55f8d5));if(_0x55f8d5[_0xd012('0x11')]){if(_0x55f8d5[_0xd012('0x11')]['code']===0x1f4){logger[_0xd012('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1d3f6e,_0x55f8d5[_0xd012('0x11')]['message']);return _0x1e32b2(_0x55f8d5[_0xd012('0x11')]['message']);}logger[_0xd012('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1d3f6e,_0x55f8d5[_0xd012('0x11')]['message']);return _0x1085e2(_0x55f8d5['error']['message']);}else{logger[_0xd012('0xc')](_0xd012('0x12'),_0x1d3f6e,_0xd012('0xf'));_0x1085e2(_0x55f8d5[_0xd012('0x13')][_0xd012('0x14')]);}})[_0xd012('0x15')](function(_0x450906){logger['error'](_0xd012('0x12'),_0x1d3f6e,_0x450906);_0x1e32b2(_0x450906);});});}exports['UpdateOpenchannelInteraction']=function(_0x5c82af){var _0x233727=this;return new Promise(function(_0x48b7fa,_0x306c30){return db[_0xd012('0x16')][_0xd012('0x17')](_0x5c82af[_0xd012('0x18')],{'raw':_0x5c82af[_0xd012('0x19')]?_0x5c82af[_0xd012('0x19')][_0xd012('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c82af['options']?_0x5c82af[_0xd012('0x19')]['where']||null:null,'attributes':_0x5c82af[_0xd012('0x19')]?_0x5c82af[_0xd012('0x19')][_0xd012('0x1b')]||null:null,'limit':_0x5c82af['options']?_0x5c82af[_0xd012('0x19')][_0xd012('0x1c')]||null:null})['then'](function(_0x22f56b){logger[_0xd012('0xc')](_0xd012('0x1d'),_0x5c82af);logger['debug'](_0xd012('0x1d'),_0x5c82af,JSON[_0xd012('0x10')](_0x22f56b));_0x48b7fa(_0x22f56b);})['catch'](function(_0x268930){logger[_0xd012('0x11')]('UpdateOpenchannelInteraction',_0x268930['message'],_0x5c82af);_0x306c30(_0x233727[_0xd012('0x11')](0x1f4,_0x268930[_0xd012('0x14')]));});});};exports[_0xd012('0x1e')]=function(_0x504c85){return new Promise(function(_0x3bee73,_0x59981a){return db[_0xd012('0x16')][_0xd012('0x1f')]({'where':_0x504c85['options']?_0x504c85[_0xd012('0x19')][_0xd012('0x20')]||null:null})[_0xd012('0x21')](function(_0xd6e501){if(_0xd6e501){return _0xd6e501[_0xd012('0x22')](_0x504c85[_0xd012('0x18')][_0xd012('0x23')],_[_0xd012('0x24')](_0x504c85['body'],['ids','id'])||{});}})[_0xd012('0x25')](function(_0x2bc0cd){logger[_0xd012('0xc')](_0xd012('0x26'),_0x504c85);logger[_0xd012('0xd')](_0xd012('0x26'),_0x504c85,JSON[_0xd012('0x10')](_0x2bc0cd));_0x3bee73(_0x2bc0cd);})[_0xd012('0x15')](function(_0xe4be5b){logger[_0xd012('0x11')](_0xd012('0x26'),_0xe4be5b['message'],_0x504c85);_0x59981a(_this[_0xd012('0x11')](0x1f4,_0xe4be5b[_0xd012('0x14')]));});});}; \ No newline at end of file +var _0xc3c6=['catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result'];(function(_0x39a7a3,_0x24cf00){var _0x41e026=function(_0x43e68d){while(--_0x43e68d){_0x39a7a3['push'](_0x39a7a3['shift']());}};_0x41e026(++_0x24cf00);}(_0xc3c6,0x1a0));var _0x6c3c=function(_0x3dd443,_0xe64d5c){_0x3dd443=_0x3dd443-0x0;var _0xe5769b=_0xc3c6[_0x3dd443];return _0xe5769b;};'use strict';var _=require(_0x6c3c('0x0'));var util=require(_0x6c3c('0x1'));var moment=require('moment');var BPromise=require(_0x6c3c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c3c('0x3'));var db=require(_0x6c3c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c3c('0x5'))(_0x6c3c('0x6'));var config=require(_0x6c3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6c3c('0x8')][_0x6c3c('0x9')]({'port':0x232a});config[_0x6c3c('0xa')]=_[_0x6c3c('0xb')](config[_0x6c3c('0xa')],{'host':_0x6c3c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x6c3c('0xd')](socket);function respondWithRpcPromise(_0x365acd,_0x557dff,_0x42a05f){return new BPromise(function(_0x4c6fc3,_0x4bc212){return client[_0x6c3c('0xe')](_0x365acd,_0x42a05f)[_0x6c3c('0xf')](function(_0x510ffb){logger[_0x6c3c('0x10')](_0x6c3c('0x11'),_0x557dff,'request\x20sent');logger[_0x6c3c('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x557dff,_0x6c3c('0x13'),JSON['stringify'](_0x510ffb));if(_0x510ffb[_0x6c3c('0x14')]){if(_0x510ffb[_0x6c3c('0x14')][_0x6c3c('0x15')]===0x1f4){logger[_0x6c3c('0x14')](_0x6c3c('0x11'),_0x557dff,_0x510ffb[_0x6c3c('0x14')][_0x6c3c('0x16')]);return _0x4bc212(_0x510ffb['error'][_0x6c3c('0x16')]);}logger[_0x6c3c('0x14')](_0x6c3c('0x11'),_0x557dff,_0x510ffb[_0x6c3c('0x14')][_0x6c3c('0x16')]);return _0x4c6fc3(_0x510ffb[_0x6c3c('0x14')][_0x6c3c('0x16')]);}else{logger['info'](_0x6c3c('0x11'),_0x557dff,_0x6c3c('0x13'));_0x4c6fc3(_0x510ffb[_0x6c3c('0x17')][_0x6c3c('0x16')]);}})[_0x6c3c('0x18')](function(_0x23e546){logger[_0x6c3c('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x557dff,_0x23e546);_0x4bc212(_0x23e546);});});}exports['UpdateOpenchannelInteraction']=function(_0xdf1757){var _0x5454d5=this;return new Promise(function(_0xaee644,_0x24b353){return db[_0x6c3c('0x19')][_0x6c3c('0x1a')](_0xdf1757[_0x6c3c('0x1b')],{'raw':_0xdf1757[_0x6c3c('0x1c')]?_0xdf1757[_0x6c3c('0x1c')][_0x6c3c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdf1757[_0x6c3c('0x1c')]?_0xdf1757[_0x6c3c('0x1c')][_0x6c3c('0x1e')]||null:null,'attributes':_0xdf1757[_0x6c3c('0x1c')]?_0xdf1757[_0x6c3c('0x1c')][_0x6c3c('0x1f')]||null:null,'limit':_0xdf1757[_0x6c3c('0x1c')]?_0xdf1757[_0x6c3c('0x1c')][_0x6c3c('0x20')]||null:null})[_0x6c3c('0xf')](function(_0xd4df7d){logger[_0x6c3c('0x10')](_0x6c3c('0x21'),_0xdf1757);logger['debug']('UpdateOpenchannelInteraction',_0xdf1757,JSON[_0x6c3c('0x22')](_0xd4df7d));_0xaee644(_0xd4df7d);})[_0x6c3c('0x18')](function(_0x3848b0){logger['error'](_0x6c3c('0x21'),_0x3848b0[_0x6c3c('0x16')],_0xdf1757);_0x24b353(_0x5454d5[_0x6c3c('0x14')](0x1f4,_0x3848b0[_0x6c3c('0x16')]));});});};exports[_0x6c3c('0x23')]=function(_0x43a628){return new Promise(function(_0x581d90,_0x2d18e3){return db['OpenchannelInteraction'][_0x6c3c('0x24')]({'where':_0x43a628[_0x6c3c('0x1c')]?_0x43a628[_0x6c3c('0x1c')]['where']||null:null})[_0x6c3c('0xf')](function(_0x5bc078){if(_0x5bc078){return _0x5bc078[_0x6c3c('0x25')](_0x43a628[_0x6c3c('0x1b')][_0x6c3c('0x26')],_['omit'](_0x43a628[_0x6c3c('0x1b')],['ids','id'])||{});}})['spread'](function(_0x1e3d6e){logger['info'](_0x6c3c('0x27'),_0x43a628);logger[_0x6c3c('0x12')](_0x6c3c('0x27'),_0x43a628,JSON['stringify'](_0x1e3d6e));_0x581d90(_0x1e3d6e);})[_0x6c3c('0x18')](function(_0x1601ab){logger[_0x6c3c('0x14')](_0x6c3c('0x27'),_0x1601ab[_0x6c3c('0x16')],_0x43a628);_0x2d18e3(_this[_0x6c3c('0x14')](0x1f4,_0x1601ab[_0x6c3c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 139abe4..4320fa2 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 _0x8792=['openchannelInteraction:','save','update','emit','register','length'];(function(_0x3215bf,_0x2919a8){var _0x3c2a5c=function(_0x2db83a){while(--_0x2db83a){_0x3215bf['push'](_0x3215bf['shift']());}};_0x3c2a5c(++_0x2919a8);}(_0x8792,0x127));var _0x2879=function(_0x1d9b9c,_0x4d7dc1){_0x1d9b9c=_0x1d9b9c-0x0;var _0x20ccf7=_0x8792[_0x1d9b9c];return _0x20ccf7;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x2879('0x0'),'remove',_0x2879('0x1')];function createListener(_0x95cfd6,_0x2eebba){return function(_0x438a68){_0x2eebba[_0x2879('0x2')](_0x95cfd6,_0x438a68);};}function removeListener(_0xb3c81f,_0x242f40){return function(){OpenchannelInteractionEvents['removeListener'](_0xb3c81f,_0x242f40);};}exports[_0x2879('0x3')]=function(_0x4069ad){for(var _0x2d4780=0x0,_0x67db0e=events[_0x2879('0x4')];_0x2d4780<_0x67db0e;_0x2d4780++){var _0x158818=events[_0x2d4780];var _0x2d171b=createListener(_0x2879('0x5')+_0x158818,_0x4069ad);OpenchannelInteractionEvents['on'](_0x158818,_0x2d171b);}}; \ No newline at end of file +var _0x3378=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3378,0x1e7));var _0x8337=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x3378[_0x3efe87];return _0x56a4cc;};'use strict';var OpenchannelInteractionEvents=require(_0x8337('0x0'));var events=[_0x8337('0x1'),_0x8337('0x2'),'update'];function createListener(_0x59e52b,_0x332eb4){return function(_0x423654){_0x332eb4['emit'](_0x59e52b,_0x423654);};}function removeListener(_0x1c55f7,_0x2ae39f){return function(){OpenchannelInteractionEvents[_0x8337('0x3')](_0x1c55f7,_0x2ae39f);};}exports[_0x8337('0x4')]=function(_0x2ace28){for(var _0x3b6945=0x0,_0x3a83ad=events[_0x8337('0x5')];_0x3b6945<_0x3a83ad;_0x3b6945++){var _0x57c6a2=events[_0x3b6945];var _0x77963e=createListener(_0x8337('0x6')+_0x57c6a2,_0x2ace28);OpenchannelInteractionEvents['on'](_0x57c6a2,_0x77963e);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 3ed17de..512db68 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x456d88,_0x125741){var _0x1201d8=function(_0x275c06){while(--_0x275c06){_0x456d88['push'](_0x456d88['shift']());}};_0x1201d8(++_0x125741);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 8f58331..eeb5ea5 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 _0x18f3=['DATE','STRING','exports','TEXT','medium','ENUM','out'];(function(_0x40956a,_0x43c2b9){var _0x8fa936=function(_0x11bcd1){while(--_0x11bcd1){_0x40956a['push'](_0x40956a['shift']());}};_0x8fa936(++_0x43c2b9);}(_0x18f3,0x19f));var _0x318f=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x18f3[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require('sequelize');module[_0x318f('0x0')]={'body':{'type':Sequelize[_0x318f('0x1')](_0x318f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x318f('0x3')]('in','out'),'defaultValue':_0x318f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x318f('0x5')]},'providerName':{'type':Sequelize[_0x318f('0x6')]},'providerResponse':{'type':Sequelize[_0x318f('0x1')]}}; \ No newline at end of file +var _0xd2bf=['DATE','STRING','TEXT','sequelize','BOOLEAN','out'];(function(_0x506b5a,_0x15f9fe){var _0x35d599=function(_0x359d48){while(--_0x359d48){_0x506b5a['push'](_0x506b5a['shift']());}};_0x35d599(++_0x15f9fe);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xd2bf[_0x26f702];return _0x11417d;};'use strict';var Sequelize=require(_0xfd2b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfd2b('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfd2b('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfd2b('0x2')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfd2b('0x3')]},'providerName':{'type':Sequelize[_0xfd2b('0x4')]},'providerResponse':{'type':Sequelize[_0xfd2b('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 64e368f..8e38405 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 _0x9a72=['motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','email','rejectmessage','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','offset','undefined','limit','count','Content-Range','json','reject','save','destroy','end','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel'];(function(_0x1a6995,_0xe28a03){var _0x50cd4f=function(_0x305983){while(--_0x305983){_0x1a6995['push'](_0x1a6995['shift']());}};_0x50cd4f(++_0xe28a03);}(_0x9a72,0x8e));var _0x29a7=function(_0x2c0ee0,_0x13268e){_0x2c0ee0=_0x2c0ee0-0x0;var _0xe5a129=_0x9a72[_0x2c0ee0];return _0xe5a129;};'use strict';var emlformat=require(_0x29a7('0x0'));var rimraf=require(_0x29a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29a7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x29a7('0x3'));var Mustache=require(_0x29a7('0x4'));var util=require(_0x29a7('0x5'));var path=require(_0x29a7('0x6'));var sox=require('sox');var csv=require(_0x29a7('0x7'));var ejs=require(_0x29a7('0x8'));var fs=require('fs');var fs_extra=require(_0x29a7('0x9'));var _=require(_0x29a7('0xa'));var squel=require(_0x29a7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29a7('0xc'));var toCsv=require(_0x29a7('0x7'));var querystring=require(_0x29a7('0xd'));var Papa=require(_0x29a7('0xe'));var Redis=require(_0x29a7('0xf'));var authService=require(_0x29a7('0x10'));var qs=require(_0x29a7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x29a7('0x12'))(_0x29a7('0x13'));var utils=require(_0x29a7('0x14'));var config=require(_0x29a7('0x15'));var licenseUtil=require(_0x29a7('0x16'));var db=require(_0x29a7('0x17'))['db'];config[_0x29a7('0x18')]=_['defaults'](config[_0x29a7('0x18')],{'host':_0x29a7('0x19'),'port':0x18eb});var socket=require(_0x29a7('0x1a'))(new Redis(config[_0x29a7('0x18')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x29a7('0x1b'));var client=jayson[_0x29a7('0x1c')][_0x29a7('0x1d')]({'port':0x232c});var client9002=jayson[_0x29a7('0x1c')][_0x29a7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4d7c43,_0x2636f5,_0x5b43b9,_0x2110fa){return new BPromise(function(_0x228fe1,_0x14b9c9){var _0x40805b=_0x2110fa||client;return _0x40805b[_0x29a7('0x1e')](_0x4d7c43,_0x5b43b9)[_0x29a7('0x1f')](function(_0x4c0b97){logger[_0x29a7('0x20')](_0x29a7('0x21'),_0x2636f5,_0x29a7('0x22'));logger[_0x29a7('0x23')](_0x29a7('0x24'),_0x2636f5,_0x29a7('0x22'),JSON['stringify'](_0x4c0b97));if(_0x4c0b97[_0x29a7('0x25')]){if(_0x4c0b97[_0x29a7('0x25')][_0x29a7('0x26')]===0x1f4){logger[_0x29a7('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x2636f5,_0x4c0b97[_0x29a7('0x25')]['message']);return _0x14b9c9(_0x4c0b97[_0x29a7('0x25')][_0x29a7('0x27')]);}logger[_0x29a7('0x25')](_0x29a7('0x21'),_0x2636f5,_0x4c0b97[_0x29a7('0x25')][_0x29a7('0x27')]);return _0x228fe1(_0x4c0b97[_0x29a7('0x25')][_0x29a7('0x27')]);}else{logger['info'](_0x29a7('0x21'),_0x2636f5,_0x29a7('0x22'));_0x228fe1(_0x4c0b97[_0x29a7('0x28')][_0x29a7('0x27')]);}})[_0x29a7('0x29')](function(_0x47f8c0){logger[_0x29a7('0x25')](_0x29a7('0x21'),_0x2636f5,_0x47f8c0);_0x14b9c9(_0x47f8c0);});});}function respondWithStatusCode(_0x1116bf,_0xa849c7){_0xa849c7=_0xa849c7||0xcc;return function(_0x5028c2){if(_0x5028c2){return _0x1116bf['sendStatus'](_0xa849c7);}return _0x1116bf['status'](_0xa849c7)['end']();};}function respondWithResult(_0x263a78,_0x1a5a27){_0x1a5a27=_0x1a5a27||0xc8;return function(_0x4204e1){if(_0x4204e1){return _0x263a78[_0x29a7('0x2a')](_0x1a5a27)['json'](_0x4204e1);}};}function respondWithFilteredResult(_0x31dddb,_0x2f84a7){return function(_0x308e3d){if(_0x308e3d){var _0x3e0d47=typeof _0x2f84a7[_0x29a7('0x2b')]===_0x29a7('0x2c')&&typeof _0x2f84a7[_0x29a7('0x2d')]===_0x29a7('0x2c');var _0x1d3bc5=_0x308e3d[_0x29a7('0x2e')];var _0x5b52d5=_0x3e0d47?0x0:_0x2f84a7[_0x29a7('0x2b')];var _0x572f3f=_0x3e0d47?_0x308e3d[_0x29a7('0x2e')]:_0x2f84a7[_0x29a7('0x2b')]+_0x2f84a7['limit'];var _0xe9a62b;if(_0x572f3f>=_0x1d3bc5){_0x572f3f=_0x1d3bc5;_0xe9a62b=0xc8;}else{_0xe9a62b=0xce;}_0x31dddb['status'](_0xe9a62b);return _0x31dddb['set'](_0x29a7('0x2f'),_0x5b52d5+'-'+_0x572f3f+'/'+_0x1d3bc5)[_0x29a7('0x30')](_0x308e3d);}return null;};}function patchUpdates(_0x1036c7){return function(_0x12067c){try{jsonpatch['apply'](_0x12067c,_0x1036c7,!![]);}catch(_0x20ae74){return BPromise[_0x29a7('0x31')](_0x20ae74);}return _0x12067c[_0x29a7('0x32')]();};}function saveUpdates(_0x1cdcff,_0x37d986){return function(_0x348af1){if(_0x348af1){return _0x348af1['update'](_0x1cdcff)[_0x29a7('0x1f')](function(_0x2ec70e){return _0x2ec70e;});}return null;};}function removeEntity(_0x40233e,_0x3f7718){return function(_0x1560f0){if(_0x1560f0){return _0x1560f0[_0x29a7('0x33')]()[_0x29a7('0x1f')](function(){_0x40233e[_0x29a7('0x2a')](0xcc)[_0x29a7('0x34')]();});}};}function handleEntityNotFound(_0xc03682,_0x2383d1){return function(_0x2b203d){if(!_0x2b203d){_0xc03682[_0x29a7('0x35')](0x194);}return _0x2b203d;};}function handleError(_0x33c945,_0x30d2cb){_0x30d2cb=_0x30d2cb||0x1f4;return function(_0x7d8af7){logger[_0x29a7('0x25')](_0x7d8af7[_0x29a7('0x36')]);if(_0x7d8af7[_0x29a7('0x37')]){delete _0x7d8af7[_0x29a7('0x37')];}_0x33c945['status'](_0x30d2cb)[_0x29a7('0x38')](_0x7d8af7);};}exports[_0x29a7('0x39')]=function(_0x1de36b,_0x197d57){var _0xa44e98={},_0x12db0b={},_0x4f2870={'count':0x0,'rows':[]};var _0x1e23bf=_['map'](db[_0x29a7('0x3a')][_0x29a7('0x3b')],function(_0x4abf40){return{'name':_0x4abf40['fieldName'],'type':_0x4abf40[_0x29a7('0x3c')]['key']};});_0x12db0b[_0x29a7('0x3d')]=_[_0x29a7('0x3e')](_0x1e23bf,_0x29a7('0x37'));_0x12db0b[_0x29a7('0x3f')]=_[_0x29a7('0x40')](_0x1de36b[_0x29a7('0x3f')]);_0x12db0b[_0x29a7('0x41')]=_['intersection'](_0x12db0b[_0x29a7('0x3d')],_0x12db0b[_0x29a7('0x3f')]);_0xa44e98[_0x29a7('0x42')]=_[_0x29a7('0x43')](_0x12db0b['model'],qs['fields'](_0x1de36b['query'][_0x29a7('0x44')]));_0xa44e98['attributes']=_0xa44e98[_0x29a7('0x42')]['length']?_0xa44e98['attributes']:_0x12db0b[_0x29a7('0x3d')];if(!_0x1de36b[_0x29a7('0x3f')][_0x29a7('0x45')](_0x29a7('0x46'))){_0xa44e98[_0x29a7('0x2d')]=qs[_0x29a7('0x2d')](_0x1de36b[_0x29a7('0x3f')][_0x29a7('0x2d')]);_0xa44e98['offset']=qs[_0x29a7('0x2b')](_0x1de36b[_0x29a7('0x3f')][_0x29a7('0x2b')]);}_0xa44e98[_0x29a7('0x47')]=qs[_0x29a7('0x48')](_0x1de36b[_0x29a7('0x3f')]['sort']);_0xa44e98['where']=qs[_0x29a7('0x41')](_[_0x29a7('0x49')](_0x1de36b[_0x29a7('0x3f')],_0x12db0b['filters']),_0x1e23bf);if(_0x1de36b[_0x29a7('0x3f')][_0x29a7('0x4a')]){_0xa44e98[_0x29a7('0x4b')]=_[_0x29a7('0x4c')](_0xa44e98[_0x29a7('0x4b')],{'$or':_[_0x29a7('0x3e')](_0x1e23bf,function(_0x2cf6db){if(_0x2cf6db[_0x29a7('0x3c')]!==_0x29a7('0x4d')){var _0x4b6aa6={};_0x4b6aa6[_0x2cf6db[_0x29a7('0x37')]]={'$like':'%'+_0x1de36b['query'][_0x29a7('0x4a')]+'%'};return _0x4b6aa6;}})});}_0xa44e98=_[_0x29a7('0x4c')]({},_0xa44e98,_0x1de36b[_0x29a7('0x4e')]);var _0x5d7f2f={'where':_0xa44e98[_0x29a7('0x4b')]};return db[_0x29a7('0x3a')][_0x29a7('0x2e')](_0x5d7f2f)['then'](function(_0x1aa374){_0x4f2870['count']=_0x1aa374;if(_0x1de36b['query']['includeAll']){_0xa44e98['include']=[{'all':!![]}];}return db[_0x29a7('0x3a')][_0x29a7('0x4f')](_0xa44e98);})[_0x29a7('0x1f')](function(_0x520767){_0x4f2870[_0x29a7('0x50')]=_0x520767;return _0x4f2870;})[_0x29a7('0x1f')](respondWithFilteredResult(_0x197d57,_0xa44e98))[_0x29a7('0x29')](handleError(_0x197d57,null));};exports['show']=function(_0x2e04c5,_0x2a336e){var _0x12943c={'raw':!![],'where':{'id':_0x2e04c5[_0x29a7('0x51')]['id']}},_0x56d035={};_0x56d035[_0x29a7('0x3d')]=_['keys'](db['OpenchannelMessage'][_0x29a7('0x3b')]);_0x56d035[_0x29a7('0x3f')]=_[_0x29a7('0x40')](_0x2e04c5[_0x29a7('0x3f')]);_0x56d035[_0x29a7('0x41')]=_[_0x29a7('0x43')](_0x56d035[_0x29a7('0x3d')],_0x56d035['query']);_0x12943c[_0x29a7('0x42')]=_[_0x29a7('0x43')](_0x56d035['model'],qs[_0x29a7('0x44')](_0x2e04c5['query'][_0x29a7('0x44')]));_0x12943c[_0x29a7('0x42')]=_0x12943c[_0x29a7('0x42')]['length']?_0x12943c[_0x29a7('0x42')]:_0x56d035[_0x29a7('0x3d')];if(_0x2e04c5[_0x29a7('0x3f')][_0x29a7('0x52')]){_0x12943c['include']=[{'all':!![]}];}_0x12943c=_[_0x29a7('0x4c')]({},_0x12943c,_0x2e04c5[_0x29a7('0x4e')]);return db[_0x29a7('0x3a')][_0x29a7('0x53')](_0x12943c)[_0x29a7('0x1f')](handleEntityNotFound(_0x2a336e,null))[_0x29a7('0x1f')](respondWithResult(_0x2a336e,null))[_0x29a7('0x29')](handleError(_0x2a336e,null));};exports[_0x29a7('0x54')]=function(_0x3fc18f,_0x429c12){return db[_0x29a7('0x3a')]['create'](_0x3fc18f[_0x29a7('0x55')],{})[_0x29a7('0x1f')](respondWithResult(_0x429c12,0xc9))[_0x29a7('0x29')](handleError(_0x429c12,null));};exports['update']=function(_0x6638f8,_0x2c0f22){if(_0x6638f8[_0x29a7('0x55')]['id']){delete _0x6638f8[_0x29a7('0x55')]['id'];}return db[_0x29a7('0x3a')][_0x29a7('0x53')]({'where':{'id':_0x6638f8[_0x29a7('0x51')]['id']}})[_0x29a7('0x1f')](handleEntityNotFound(_0x2c0f22,null))[_0x29a7('0x1f')](saveUpdates(_0x6638f8['body'],null))[_0x29a7('0x1f')](respondWithResult(_0x2c0f22,null))[_0x29a7('0x29')](handleError(_0x2c0f22,null));};exports[_0x29a7('0x33')]=function(_0x401011,_0x3ebbb5){return db[_0x29a7('0x3a')]['find']({'where':{'id':_0x401011[_0x29a7('0x51')]['id']}})[_0x29a7('0x1f')](handleEntityNotFound(_0x3ebbb5,null))[_0x29a7('0x1f')](removeEntity(_0x3ebbb5,null))[_0x29a7('0x29')](handleError(_0x3ebbb5,null));};exports[_0x29a7('0x56')]=function(_0x7456c4,_0x213117){return db[_0x29a7('0x3a')][_0x29a7('0x56')]()[_0x29a7('0x1f')](respondWithResult(_0x213117,null))['catch'](handleError(_0x213117,null));};var interaction_log=require('../../config/logger')(_0x29a7('0x57'));exports[_0x29a7('0x58')]=function(_0x5272b5,_0x3a926e,_0x1f8e02){var _0x4a3000={'agent':{},'channel':_0x29a7('0x59')};if(_0x5272b5['body']['id']){delete _0x5272b5[_0x29a7('0x55')]['id'];}_0x5272b5[_0x29a7('0x55')][_0x29a7('0x5a')]=!![];_0x5272b5['body'][_0x29a7('0x5b')]=moment()[_0x29a7('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5272b5[_0x29a7('0x55')][_0x29a7('0x5d')]=_0x5272b5[_0x29a7('0x55')][_0x29a7('0x5d')]||_0x5272b5[_0x29a7('0x5e')]['id'];_0x4a3000[_0x29a7('0x5f')]['id']=_0x5272b5[_0x29a7('0x55')][_0x29a7('0x5d')];return db[_0x29a7('0x3a')][_0x29a7('0x53')]({'where':{'id':_0x5272b5['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3a926e,null))[_0x29a7('0x1f')](saveUpdates(_0x5272b5[_0x29a7('0x55')],null))['then'](function(_0x4015ae){if(_0x4015ae){_0x4a3000[_0x29a7('0x27')]=_0x4015ae[_0x29a7('0x60')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x4015ae[_0x29a7('0x61')]}});}return null;})[_0x29a7('0x1f')](handleEntityNotFound(_0x3a926e,null))[_0x29a7('0x1f')](function(_0x4ad1b0){if(_0x4ad1b0){return _0x4ad1b0[_0x29a7('0x62')]({'UserId':_0x5272b5[_0x29a7('0x55')][_0x29a7('0x5d')],'read1stAt':_[_0x29a7('0x63')](_0x4ad1b0[_0x29a7('0x64')])?moment()['format'](_0x29a7('0x65')):undefined});}return null;})[_0x29a7('0x1f')](function(_0xc8e67){if(_0xc8e67){_0x4a3000['interaction']=_0xc8e67[_0x29a7('0x60')]({'plain':!![]});interaction_log[_0x29a7('0x20')](_0x29a7('0x66'),_0x5272b5[_0x29a7('0x5e')]['id'],_0x5272b5['user'][_0x29a7('0x37')],_0x5272b5['user'][_0x29a7('0x67')],_0x4a3000[_0x29a7('0x68')]['id'],_0x5272b5[_0x29a7('0x55')]?JSON['stringify'](_0x5272b5[_0x29a7('0x55')]):_0x29a7('0x69'));return respondWithRpcPromise(_0x29a7('0x6a'),_0x29a7('0x6b'),_0x4a3000);}return null;})[_0x29a7('0x1f')](function(_0x2ce965){var _0x201f38=_0x29a7('0x6c')+_0x2ce965[_0x29a7('0x27')][_0x29a7('0x6d')];return db[_0x29a7('0x6e')]['query'](_0x201f38,{'type':db['Sequelize']['QueryTypes'][_0x29a7('0x6f')],'raw':!![]})[_0x29a7('0x1f')](function(_0x1d1b21){return _0x1d1b21;});})[_0x29a7('0x1f')](function(_0x29b0fa){if(_0x29b0fa){_0x4a3000[_0x29a7('0x27')][_0x29a7('0x70')]=_0x29b0fa[0x0];if(!_0x5272b5[_0x29a7('0x55')][_0x29a7('0x5d')])return;return db[_0x29a7('0x71')][_0x29a7('0x53')]({'where':{'id':_0x5272b5[_0x29a7('0x55')][_0x29a7('0x5d')],'role':'agent'},'attributes':['id','name',_0x29a7('0x72'),'email',_0x29a7('0x73')],'raw':!![]});}return null;})[_0x29a7('0x1f')](function(_0x4a15ae){if(!_0x4a15ae)return null;_0x4a3000['message'][_0x29a7('0x5f')]=_0x4a15ae;return _0x4a3000;})[_0x29a7('0x1f')](function(_0x2ca088){if(_0x2ca088){if(_0x5272b5[_0x29a7('0x55')][_0x29a7('0x74')]){_0x4a3000['message'][_0x29a7('0x75')]=util[_0x29a7('0x5c')](_0x29a7('0x76'),_0x5272b5[_0x29a7('0x5e')]['name']);_0x4a3000['message'][_0x29a7('0x77')]=_0x4a3000['channel'];_0x4a3000[_0x29a7('0x27')][_0x29a7('0x78')]=_0x4a3000[_0x29a7('0x77')];_0x4a3000[_0x29a7('0x27')][_0x29a7('0x79')]=_0x29a7('0x58');return respondWithRpcPromise(_0x29a7('0x7a'),_0x29a7('0x7a'),{'event':_0x29a7('0x7b'),'message':_0x4a3000[_0x29a7('0x27')]},client9002)[_0x29a7('0x1f')](function(){return _0x4a3000;});}return _0x4a3000;}return null;})[_0x29a7('0x1f')](respondWithResult(_0x3a926e,null))[_0x29a7('0x29')](handleError(_0x3a926e,null));};var interaction_log=require(_0x29a7('0x12'))(_0x29a7('0x57'));exports['reject']=function(_0x9da80d,_0x508f39,_0x363e48){var _0x2d5196={'agent':{},'channel':_0x29a7('0x59')};if(_0x9da80d['body']['id']){delete _0x9da80d[_0x29a7('0x55')]['id'];}_0x9da80d['body'][_0x29a7('0x5d')]=_0x9da80d['body'][_0x29a7('0x5d')]||_0x9da80d[_0x29a7('0x5e')]['id'];_0x2d5196[_0x29a7('0x5f')]['id']=_0x9da80d['body'][_0x29a7('0x5d')];return db['OpenchannelMessage'][_0x29a7('0x53')]({'where':{'id':_0x9da80d[_0x29a7('0x51')]['id'],'UserId':null}})[_0x29a7('0x1f')](handleEntityNotFound(_0x508f39,null))[_0x29a7('0x1f')](function(_0x5eba53){if(_0x5eba53){_0x2d5196[_0x29a7('0x27')]=_0x5eba53[_0x29a7('0x60')]({'plain':!![]});return db[_0x29a7('0x7c')]['find']({'where':{'id':_0x5eba53[_0x29a7('0x61')]}});}return null;})[_0x29a7('0x1f')](handleEntityNotFound(_0x508f39,null))[_0x29a7('0x1f')](function(_0x2afd57){if(_0x2afd57){_0x2d5196['interaction']=_0x2afd57[_0x29a7('0x60')]({'plain':!![]});interaction_log['info'](_0x29a7('0x7d'),_0x9da80d[_0x29a7('0x5e')]['id'],_0x9da80d[_0x29a7('0x5e')]['name'],_0x9da80d[_0x29a7('0x5e')]['role'],_0x2d5196[_0x29a7('0x68')]['id'],_0x9da80d['body']?JSON[_0x29a7('0x7e')](_0x9da80d[_0x29a7('0x55')]):_0x29a7('0x69'));return respondWithRpcPromise(_0x29a7('0x7f'),_0x29a7('0x80'),_0x2d5196);}return null;})['then'](function(_0x545a90){var _0x29de8f=_0x29a7('0x6c')+_0x545a90[_0x29a7('0x27')][_0x29a7('0x6d')];return db[_0x29a7('0x6e')]['query'](_0x29de8f,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x29a7('0x1f')](function(_0x2dabfd){return _0x2dabfd;});})[_0x29a7('0x1f')](function(_0x33a31d){if(_0x33a31d){_0x2d5196['message']['contact']=_0x33a31d[0x0];if(!_0x9da80d[_0x29a7('0x55')][_0x29a7('0x5d')])return;return db[_0x29a7('0x71')][_0x29a7('0x53')]({'where':{'id':_0x9da80d[_0x29a7('0x55')]['UserId'],'role':_0x29a7('0x5f')},'attributes':['id','name',_0x29a7('0x72'),_0x29a7('0x81'),_0x29a7('0x73')],'raw':!![]});}return null;})[_0x29a7('0x1f')](function(_0x106583){if(!_0x106583)return null;_0x2d5196['message'][_0x29a7('0x5f')]=_0x106583;return _0x2d5196;})[_0x29a7('0x1f')](function(_0xb0adec){if(_0xb0adec){_0xb0adec['message'][_0x29a7('0x75')]=util[_0x29a7('0x5c')]('SIP/%s',_0x9da80d[_0x29a7('0x5e')]['name']);_0xb0adec['message']['channel']=_0x2d5196[_0x29a7('0x77')];_0xb0adec[_0x29a7('0x27')][_0x29a7('0x78')]=_0x2d5196['channel'];_0xb0adec['message'][_0x29a7('0x79')]=_0x29a7('0x31');respondWithRpcPromise('EventManager',_0x29a7('0x7a'),{'event':_0x29a7('0x82'),'message':_0xb0adec['message']},client9002);return _0x2d5196;}return null;})[_0x29a7('0x1f')](respondWithResult(_0x508f39,null))['catch'](handleError(_0x508f39,null));}; \ No newline at end of file +var _0x28ca=['manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT','event','rejectmessage','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','body','params','describe','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','email','internal'];(function(_0x163bfa,_0x3e9fd8){var _0x37eeba=function(_0x31e10c){while(--_0x31e10c){_0x163bfa['push'](_0x163bfa['shift']());}};_0x37eeba(++_0x3e9fd8);}(_0x28ca,0x89));var _0xa28c=function(_0x3842ef,_0x1e35ad){_0x3842ef=_0x3842ef-0x0;var _0xb638de=_0x28ca[_0x3842ef];return _0xb638de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa28c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa28c('0x1'));var rp=require(_0xa28c('0x2'));var moment=require(_0xa28c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa28c('0x4'));var util=require(_0xa28c('0x5'));var path=require(_0xa28c('0x6'));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(_0xa28c('0x7'));var squel=require(_0xa28c('0x8'));var crypto=require(_0xa28c('0x9'));var jsforce=require(_0xa28c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa28c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xa28c('0xc'));var as=require(_0xa28c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa28c('0xe'))(_0xa28c('0xf'));var utils=require(_0xa28c('0x10'));var config=require(_0xa28c('0x11'));var licenseUtil=require(_0xa28c('0x12'));var db=require(_0xa28c('0x13'))['db'];config[_0xa28c('0x14')]=_[_0xa28c('0x15')](config['redis'],{'host':_0xa28c('0x16'),'port':0x18eb});var socket=require(_0xa28c('0x17'))(new Redis(config['redis']));require(_0xa28c('0x18'))[_0xa28c('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xa28c('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fb216,_0x3ed0aa,_0x301bba,_0x183a74){return new BPromise(function(_0x292293,_0x426d2a){var _0x32587b=_0x183a74||client;return _0x32587b['request'](_0x4fb216,_0x301bba)[_0xa28c('0x1b')](function(_0x117c37){logger[_0xa28c('0x1c')](_0xa28c('0x1d'),_0x3ed0aa,_0xa28c('0x1e'));logger[_0xa28c('0x1f')](_0xa28c('0x20'),_0x3ed0aa,_0xa28c('0x1e'),JSON[_0xa28c('0x21')](_0x117c37));if(_0x117c37[_0xa28c('0x22')]){if(_0x117c37[_0xa28c('0x22')]['code']===0x1f4){logger[_0xa28c('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x3ed0aa,_0x117c37['error'][_0xa28c('0x23')]);return _0x426d2a(_0x117c37[_0xa28c('0x22')][_0xa28c('0x23')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3ed0aa,_0x117c37['error'][_0xa28c('0x23')]);return _0x292293(_0x117c37['error'][_0xa28c('0x23')]);}else{logger[_0xa28c('0x1c')](_0xa28c('0x1d'),_0x3ed0aa,_0xa28c('0x1e'));_0x292293(_0x117c37[_0xa28c('0x24')][_0xa28c('0x23')]);}})[_0xa28c('0x25')](function(_0xcd4aa0){logger[_0xa28c('0x22')](_0xa28c('0x1d'),_0x3ed0aa,_0xcd4aa0);_0x426d2a(_0xcd4aa0);});});}function respondWithStatusCode(_0x100f23,_0x1dac52){_0x1dac52=_0x1dac52||0xcc;return function(_0x5e1641){if(_0x5e1641){return _0x100f23[_0xa28c('0x26')](_0x1dac52);}return _0x100f23[_0xa28c('0x27')](_0x1dac52)[_0xa28c('0x28')]();};}function respondWithResult(_0x4de067,_0x219002){_0x219002=_0x219002||0xc8;return function(_0x1c7d8f){if(_0x1c7d8f){return _0x4de067['status'](_0x219002)[_0xa28c('0x29')](_0x1c7d8f);}};}function respondWithFilteredResult(_0x2d2912,_0x192c34){return function(_0x4bf435){if(_0x4bf435){var _0x299a00=typeof _0x192c34[_0xa28c('0x2a')]==='undefined'&&typeof _0x192c34[_0xa28c('0x2b')]==='undefined';var _0x4abe50=_0x4bf435[_0xa28c('0x2c')];var _0x110323=_0x299a00?0x0:_0x192c34[_0xa28c('0x2a')];var _0x581ed6=_0x299a00?_0x4bf435['count']:_0x192c34[_0xa28c('0x2a')]+_0x192c34[_0xa28c('0x2b')];var _0x3b1b69;if(_0x581ed6>=_0x4abe50){_0x581ed6=_0x4abe50;_0x3b1b69=0xc8;}else{_0x3b1b69=0xce;}_0x2d2912[_0xa28c('0x27')](_0x3b1b69);return _0x2d2912[_0xa28c('0x2d')](_0xa28c('0x2e'),_0x110323+'-'+_0x581ed6+'/'+_0x4abe50)[_0xa28c('0x29')](_0x4bf435);}return null;};}function patchUpdates(_0x4a7b4c){return function(_0xf6e1fe){try{jsonpatch['apply'](_0xf6e1fe,_0x4a7b4c,!![]);}catch(_0x340a8e){return BPromise[_0xa28c('0x2f')](_0x340a8e);}return _0xf6e1fe[_0xa28c('0x30')]();};}function saveUpdates(_0x3d5ff1,_0x49f935){return function(_0x4895d5){if(_0x4895d5){return _0x4895d5['update'](_0x3d5ff1)[_0xa28c('0x1b')](function(_0x198565){return _0x198565;});}return null;};}function removeEntity(_0x3dab4e,_0x4930d2){return function(_0x12af22){if(_0x12af22){return _0x12af22[_0xa28c('0x31')]()[_0xa28c('0x1b')](function(){_0x3dab4e['status'](0xcc)[_0xa28c('0x28')]();});}};}function handleEntityNotFound(_0x300de7,_0x56eb5a){return function(_0x428049){if(!_0x428049){_0x300de7[_0xa28c('0x26')](0x194);}return _0x428049;};}function handleError(_0xf0a41b,_0x449d83){_0x449d83=_0x449d83||0x1f4;return function(_0x56172d){logger[_0xa28c('0x22')](_0x56172d[_0xa28c('0x32')]);if(_0x56172d[_0xa28c('0x33')]){delete _0x56172d[_0xa28c('0x33')];}_0xf0a41b[_0xa28c('0x27')](_0x449d83)[_0xa28c('0x34')](_0x56172d);};}exports[_0xa28c('0x35')]=function(_0x32e8f9,_0x48f385){var _0x12be89={},_0x4ae375={},_0x1601e4={'count':0x0,'rows':[]};var _0x574ffe=_['map'](db[_0xa28c('0x36')][_0xa28c('0x37')],function(_0x45f50a){return{'name':_0x45f50a[_0xa28c('0x38')],'type':_0x45f50a[_0xa28c('0x39')][_0xa28c('0x3a')]};});_0x4ae375[_0xa28c('0x3b')]=_['map'](_0x574ffe,_0xa28c('0x33'));_0x4ae375[_0xa28c('0x3c')]=_[_0xa28c('0x3d')](_0x32e8f9[_0xa28c('0x3c')]);_0x4ae375[_0xa28c('0x3e')]=_[_0xa28c('0x3f')](_0x4ae375[_0xa28c('0x3b')],_0x4ae375['query']);_0x12be89[_0xa28c('0x40')]=_['intersection'](_0x4ae375['model'],qs[_0xa28c('0x41')](_0x32e8f9['query'][_0xa28c('0x41')]));_0x12be89[_0xa28c('0x40')]=_0x12be89[_0xa28c('0x40')][_0xa28c('0x42')]?_0x12be89[_0xa28c('0x40')]:_0x4ae375[_0xa28c('0x3b')];if(!_0x32e8f9[_0xa28c('0x3c')][_0xa28c('0x43')](_0xa28c('0x44'))){_0x12be89['limit']=qs['limit'](_0x32e8f9[_0xa28c('0x3c')][_0xa28c('0x2b')]);_0x12be89[_0xa28c('0x2a')]=qs[_0xa28c('0x2a')](_0x32e8f9[_0xa28c('0x3c')][_0xa28c('0x2a')]);}_0x12be89[_0xa28c('0x45')]=qs['sort'](_0x32e8f9[_0xa28c('0x3c')][_0xa28c('0x46')]);_0x12be89[_0xa28c('0x47')]=qs['filters'](_[_0xa28c('0x48')](_0x32e8f9[_0xa28c('0x3c')],_0x4ae375[_0xa28c('0x3e')]),_0x574ffe);if(_0x32e8f9[_0xa28c('0x3c')][_0xa28c('0x49')]){_0x12be89[_0xa28c('0x47')]=_[_0xa28c('0x4a')](_0x12be89[_0xa28c('0x47')],{'$or':_[_0xa28c('0x4b')](_0x574ffe,function(_0x5e5d60){if(_0x5e5d60['type']!==_0xa28c('0x4c')){var _0x8008e3={};_0x8008e3[_0x5e5d60[_0xa28c('0x33')]]={'$like':'%'+_0x32e8f9['query'][_0xa28c('0x49')]+'%'};return _0x8008e3;}})});}_0x12be89=_[_0xa28c('0x4a')]({},_0x12be89,_0x32e8f9[_0xa28c('0x4d')]);var _0x127fe4={'where':_0x12be89[_0xa28c('0x47')]};return db[_0xa28c('0x36')][_0xa28c('0x2c')](_0x127fe4)[_0xa28c('0x1b')](function(_0x46d64c){_0x1601e4[_0xa28c('0x2c')]=_0x46d64c;if(_0x32e8f9[_0xa28c('0x3c')][_0xa28c('0x4e')]){_0x12be89['include']=[{'all':!![]}];}return db[_0xa28c('0x36')][_0xa28c('0x4f')](_0x12be89);})[_0xa28c('0x1b')](function(_0x3057d5){_0x1601e4[_0xa28c('0x50')]=_0x3057d5;return _0x1601e4;})['then'](respondWithFilteredResult(_0x48f385,_0x12be89))[_0xa28c('0x25')](handleError(_0x48f385,null));};exports[_0xa28c('0x51')]=function(_0x154039,_0x8044b){var _0x5bd323={'raw':!![],'where':{'id':_0x154039['params']['id']}},_0x15a44e={};_0x15a44e[_0xa28c('0x3b')]=_['keys'](db[_0xa28c('0x36')][_0xa28c('0x37')]);_0x15a44e['query']=_[_0xa28c('0x3d')](_0x154039['query']);_0x15a44e[_0xa28c('0x3e')]=_[_0xa28c('0x3f')](_0x15a44e['model'],_0x15a44e[_0xa28c('0x3c')]);_0x5bd323[_0xa28c('0x40')]=_['intersection'](_0x15a44e['model'],qs[_0xa28c('0x41')](_0x154039['query'][_0xa28c('0x41')]));_0x5bd323[_0xa28c('0x40')]=_0x5bd323['attributes'][_0xa28c('0x42')]?_0x5bd323[_0xa28c('0x40')]:_0x15a44e[_0xa28c('0x3b')];if(_0x154039[_0xa28c('0x3c')]['includeAll']){_0x5bd323[_0xa28c('0x52')]=[{'all':!![]}];}_0x5bd323=_['merge']({},_0x5bd323,_0x154039[_0xa28c('0x4d')]);return db[_0xa28c('0x36')][_0xa28c('0x53')](_0x5bd323)['then'](handleEntityNotFound(_0x8044b,null))[_0xa28c('0x1b')](respondWithResult(_0x8044b,null))[_0xa28c('0x25')](handleError(_0x8044b,null));};exports['create']=function(_0x343356,_0x37c06e){return db[_0xa28c('0x36')][_0xa28c('0x54')](_0x343356[_0xa28c('0x55')],{})[_0xa28c('0x1b')](respondWithResult(_0x37c06e,0xc9))[_0xa28c('0x25')](handleError(_0x37c06e,null));};exports['update']=function(_0x581ea2,_0x4afacd){if(_0x581ea2[_0xa28c('0x55')]['id']){delete _0x581ea2['body']['id'];}return db[_0xa28c('0x36')][_0xa28c('0x53')]({'where':{'id':_0x581ea2[_0xa28c('0x56')]['id']}})[_0xa28c('0x1b')](handleEntityNotFound(_0x4afacd,null))[_0xa28c('0x1b')](saveUpdates(_0x581ea2[_0xa28c('0x55')],null))[_0xa28c('0x1b')](respondWithResult(_0x4afacd,null))[_0xa28c('0x25')](handleError(_0x4afacd,null));};exports['destroy']=function(_0xa84b7b,_0x2020ef){return db[_0xa28c('0x36')][_0xa28c('0x53')]({'where':{'id':_0xa84b7b[_0xa28c('0x56')]['id']}})[_0xa28c('0x1b')](handleEntityNotFound(_0x2020ef,null))['then'](removeEntity(_0x2020ef,null))[_0xa28c('0x25')](handleError(_0x2020ef,null));};exports['describe']=function(_0x13eaaf,_0x2625c4){return db[_0xa28c('0x36')][_0xa28c('0x57')]()['then'](respondWithResult(_0x2625c4,null))['catch'](handleError(_0x2625c4,null));};var interaction_log=require(_0xa28c('0xe'))('openchannel-interactions');exports['accept']=function(_0x5a67de,_0x4c81ef,_0x5c3bd3){var _0x426c02={'agent':{},'channel':_0xa28c('0x58')};if(_0x5a67de[_0xa28c('0x55')]['id']){delete _0x5a67de[_0xa28c('0x55')]['id'];}_0x5a67de[_0xa28c('0x55')][_0xa28c('0x59')]=!![];_0x5a67de['body'][_0xa28c('0x5a')]=moment()[_0xa28c('0x5b')](_0xa28c('0x5c'));_0x5a67de[_0xa28c('0x55')][_0xa28c('0x5d')]=_0x5a67de[_0xa28c('0x55')][_0xa28c('0x5d')]||_0x5a67de[_0xa28c('0x5e')]['id'];_0x426c02[_0xa28c('0x5f')]['id']=_0x5a67de[_0xa28c('0x55')]['UserId'];return db[_0xa28c('0x36')][_0xa28c('0x53')]({'where':{'id':_0x5a67de['params']['id'],'UserId':null}})[_0xa28c('0x1b')](handleEntityNotFound(_0x4c81ef,null))['then'](saveUpdates(_0x5a67de[_0xa28c('0x55')],null))['then'](function(_0x1910a4){if(_0x1910a4){_0x426c02['message']=_0x1910a4[_0xa28c('0x60')]({'plain':!![]});return db[_0xa28c('0x61')][_0xa28c('0x53')]({'where':{'id':_0x1910a4[_0xa28c('0x62')]}});}return null;})[_0xa28c('0x1b')](handleEntityNotFound(_0x4c81ef,null))['then'](function(_0xcd37f6){if(_0xcd37f6){return _0xcd37f6['update']({'UserId':_0x5a67de[_0xa28c('0x55')][_0xa28c('0x5d')],'read1stAt':_[_0xa28c('0x63')](_0xcd37f6[_0xa28c('0x64')])?moment()[_0xa28c('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa28c('0x1b')](function(_0x4d57df){if(_0x4d57df){_0x426c02[_0xa28c('0x65')]=_0x4d57df[_0xa28c('0x60')]({'plain':!![]});interaction_log[_0xa28c('0x1c')](_0xa28c('0x66'),_0x5a67de[_0xa28c('0x5e')]['id'],_0x5a67de[_0xa28c('0x5e')][_0xa28c('0x33')],_0x5a67de[_0xa28c('0x5e')][_0xa28c('0x67')],_0x426c02[_0xa28c('0x65')]['id'],_0x5a67de['body']?JSON[_0xa28c('0x21')](_0x5a67de['body']):_0xa28c('0x68'));return respondWithRpcPromise(_0xa28c('0x69'),_0xa28c('0x6a'),_0x426c02);}return null;})['then'](function(_0x4e7a17){var _0x2b69c6=_0xa28c('0x6b')+_0x4e7a17[_0xa28c('0x23')][_0xa28c('0x6c')];return db[_0xa28c('0x6d')]['query'](_0x2b69c6,{'type':db['Sequelize'][_0xa28c('0x6e')]['SELECT'],'raw':!![]})[_0xa28c('0x1b')](function(_0x42f78b){return _0x42f78b;});})[_0xa28c('0x1b')](function(_0x20d839){if(_0x20d839){_0x426c02[_0xa28c('0x23')][_0xa28c('0x6f')]=_0x20d839[0x0];if(!_0x5a67de[_0xa28c('0x55')]['UserId'])return;return db[_0xa28c('0x70')][_0xa28c('0x53')]({'where':{'id':_0x5a67de['body'][_0xa28c('0x5d')],'role':_0xa28c('0x5f')},'attributes':['id','name','fullname',_0xa28c('0x71'),_0xa28c('0x72')],'raw':!![]});}return null;})[_0xa28c('0x1b')](function(_0x113636){if(!_0x113636)return null;_0x426c02['message'][_0xa28c('0x5f')]=_0x113636;return _0x426c02;})[_0xa28c('0x1b')](function(_0x420d9f){if(_0x420d9f){if(_0x5a67de[_0xa28c('0x55')][_0xa28c('0x73')]){_0x426c02['message'][_0xa28c('0x74')]=util[_0xa28c('0x5b')](_0xa28c('0x75'),_0x5a67de[_0xa28c('0x5e')][_0xa28c('0x33')]);_0x426c02[_0xa28c('0x23')][_0xa28c('0x76')]=_0x426c02['channel'];_0x426c02[_0xa28c('0x23')][_0xa28c('0x77')]=_0x426c02[_0xa28c('0x76')];_0x426c02[_0xa28c('0x23')]['event']='accept';return respondWithRpcPromise('EventManager',_0xa28c('0x78'),{'event':_0xa28c('0x79'),'message':_0x426c02['message']},client9002)[_0xa28c('0x1b')](function(){return _0x426c02;});}return _0x426c02;}return null;})[_0xa28c('0x1b')](respondWithResult(_0x4c81ef,null))[_0xa28c('0x25')](handleError(_0x4c81ef,null));};var interaction_log=require(_0xa28c('0xe'))('openchannel-interactions');exports['reject']=function(_0x1144c9,_0x3ba7e7,_0x33214a){var _0x4ecbf4={'agent':{},'channel':'openchannel'};if(_0x1144c9[_0xa28c('0x55')]['id']){delete _0x1144c9[_0xa28c('0x55')]['id'];}_0x1144c9[_0xa28c('0x55')]['UserId']=_0x1144c9[_0xa28c('0x55')][_0xa28c('0x5d')]||_0x1144c9['user']['id'];_0x4ecbf4[_0xa28c('0x5f')]['id']=_0x1144c9[_0xa28c('0x55')][_0xa28c('0x5d')];return db[_0xa28c('0x36')][_0xa28c('0x53')]({'where':{'id':_0x1144c9[_0xa28c('0x56')]['id'],'UserId':null}})[_0xa28c('0x1b')](handleEntityNotFound(_0x3ba7e7,null))[_0xa28c('0x1b')](function(_0x171a4f){if(_0x171a4f){_0x4ecbf4[_0xa28c('0x23')]=_0x171a4f[_0xa28c('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa28c('0x53')]({'where':{'id':_0x171a4f[_0xa28c('0x62')]}});}return null;})[_0xa28c('0x1b')](handleEntityNotFound(_0x3ba7e7,null))[_0xa28c('0x1b')](function(_0x4b88f6){if(_0x4b88f6){_0x4ecbf4['interaction']=_0x4b88f6[_0xa28c('0x60')]({'plain':!![]});interaction_log[_0xa28c('0x1c')](_0xa28c('0x7a'),_0x1144c9[_0xa28c('0x5e')]['id'],_0x1144c9[_0xa28c('0x5e')][_0xa28c('0x33')],_0x1144c9[_0xa28c('0x5e')]['role'],_0x4ecbf4[_0xa28c('0x65')]['id'],_0x1144c9['body']?JSON['stringify'](_0x1144c9[_0xa28c('0x55')]):_0xa28c('0x68'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4ecbf4);}return null;})[_0xa28c('0x1b')](function(_0x296b32){var _0x4a3128=_0xa28c('0x6b')+_0x296b32[_0xa28c('0x23')][_0xa28c('0x6c')];return db[_0xa28c('0x6d')][_0xa28c('0x3c')](_0x4a3128,{'type':db['Sequelize'][_0xa28c('0x6e')][_0xa28c('0x7b')],'raw':!![]})[_0xa28c('0x1b')](function(_0x20fb2c){return _0x20fb2c;});})[_0xa28c('0x1b')](function(_0x28f3da){if(_0x28f3da){_0x4ecbf4[_0xa28c('0x23')]['contact']=_0x28f3da[0x0];if(!_0x1144c9[_0xa28c('0x55')][_0xa28c('0x5d')])return;return db[_0xa28c('0x70')]['find']({'where':{'id':_0x1144c9[_0xa28c('0x55')][_0xa28c('0x5d')],'role':_0xa28c('0x5f')},'attributes':['id',_0xa28c('0x33'),'fullname',_0xa28c('0x71'),'internal'],'raw':!![]});}return null;})[_0xa28c('0x1b')](function(_0x5d54bd){if(!_0x5d54bd)return null;_0x4ecbf4['message'][_0xa28c('0x5f')]=_0x5d54bd;return _0x4ecbf4;})['then'](function(_0x18e906){if(_0x18e906){_0x18e906['message'][_0xa28c('0x74')]=util[_0xa28c('0x5b')](_0xa28c('0x75'),_0x1144c9['user'][_0xa28c('0x33')]);_0x18e906[_0xa28c('0x23')][_0xa28c('0x76')]=_0x4ecbf4['channel'];_0x18e906[_0xa28c('0x23')][_0xa28c('0x77')]=_0x4ecbf4['channel'];_0x18e906[_0xa28c('0x23')][_0xa28c('0x7c')]=_0xa28c('0x2f');respondWithRpcPromise('EventManager',_0xa28c('0x78'),{'event':_0xa28c('0x7d'),'message':_0x18e906[_0xa28c('0x23')]},client9002);return _0x4ecbf4;}return null;})[_0xa28c('0x1b')](respondWithResult(_0x3ba7e7,null))[_0xa28c('0x25')](handleError(_0x3ba7e7,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 22cd182..6b9a6be 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 _0x2945=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x568814,_0x36a57e){var _0x20f195=function(_0x540283){while(--_0x540283){_0x568814['push'](_0x568814['shift']());}};_0x20f195(++_0x36a57e);}(_0x2945,0x6e));var _0x5294=function(_0x4cecb1,_0x245385){_0x4cecb1=_0x4cecb1-0x0;var _0x3b08ae=_0x2945[_0x4cecb1];return _0x3b08ae;};'use strict';var EventEmitter=require(_0x5294('0x0'));var OpenchannelMessage=require(_0x5294('0x1'))['db'][_0x5294('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5294('0x3')](0x0);var events={'afterCreate':_0x5294('0x4'),'afterUpdate':_0x5294('0x5'),'afterDestroy':_0x5294('0x6')};function emitEvent(_0x4df73c){return function(_0x5b42fb,_0x9451f9,_0x5dd7ef){OpenchannelMessageEvents['emit'](_0x4df73c+':'+_0x5b42fb['id'],_0x5b42fb);OpenchannelMessageEvents[_0x5294('0x7')](_0x4df73c,_0x5b42fb);_0x5dd7ef(null);};}for(var e in events){if(events[_0x5294('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x5294('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x9844=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x406baf,_0x193322){var _0x10e796=function(_0x5cdad5){while(--_0x5cdad5){_0x406baf['push'](_0x406baf['shift']());}};_0x10e796(++_0x193322);}(_0x9844,0xff));var _0x4984=function(_0x542972,_0x2d80b0){_0x542972=_0x542972-0x0;var _0x5a704a=_0x9844[_0x542972];return _0x5a704a;};'use strict';var EventEmitter=require(_0x4984('0x0'));var OpenchannelMessage=require(_0x4984('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4984('0x2')](0x0);var events={'afterCreate':_0x4984('0x3'),'afterUpdate':_0x4984('0x4'),'afterDestroy':_0x4984('0x5')};function emitEvent(_0x3da60b){return function(_0x3f186b,_0x415316,_0x33ca89){OpenchannelMessageEvents[_0x4984('0x6')](_0x3da60b+':'+_0x3f186b['id'],_0x3f186b);OpenchannelMessageEvents[_0x4984('0x6')](_0x3da60b,_0x3f186b);_0x33ca89(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x4984('0x7')](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 b4da4ff..e4c752b 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 _0xf7b4=['OpenchannelInteractionId','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','out','secret','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions'];(function(_0xafa8e5,_0x2aae15){var _0x41ceb6=function(_0x170ba5){while(--_0x170ba5){_0xafa8e5['push'](_0xafa8e5['shift']());}};_0x41ceb6(++_0x2aae15);}(_0xf7b4,0x152));var _0x4f7b=function(_0xb12d99,_0x98950c){_0xb12d99=_0xb12d99-0x0;var _0x421c5b=_0xf7b4[_0xb12d99];return _0x421c5b;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[{'name':_0x4f7b('0xb'),'fields':[_0x4f7b('0xc')],'type':_0x4f7b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c714d,_0x433563,_0x1016e0){var _0x479208=_0x2637f0[_0x4f7b('0xe')];var _0x3a3d6c=_0x5c714d[_0x4f7b('0xf')]({'plain':!![]});if(_0x3a3d6c[_0x4f7b('0x10')][_0x4f7b('0x11')]()==='in'||_0x3a3d6c['direction'][_0x4f7b('0x11')]()==='out'&&!_0x3a3d6c['secret']&&!_[_0x4f7b('0x12')](_0x3a3d6c[_0x4f7b('0x13')])){_0x479208[_0x4f7b('0x14')][_0x4f7b('0x15')]({'where':{'id':_0x3a3d6c['OpenchannelInteractionId']}})[_0x4f7b('0x16')](function(_0x368091){if(_0x368091){_0x368091[_0x4f7b('0x17')]({'lastMsgAt':_0x3a3d6c[_0x4f7b('0x18')],'lastMsgDirection':_0x3a3d6c[_0x4f7b('0x10')][_0x4f7b('0x11')]()});}})[_0x4f7b('0x19')](function(_0x2437cc){console[_0x4f7b('0x1a')](_0x2437cc);});}if(_0x3a3d6c[_0x4f7b('0x10')]===_0x4f7b('0x1b')&&!_0x3a3d6c[_0x4f7b('0x1c')]){var _0x50a161;_0x479208[_0x4f7b('0x1d')]['describe']()['then'](function(_0x24e5cf){return _0x479208[_0x4f7b('0x1e')]['find']({'where':{'id':_0x3a3d6c[_0x4f7b('0x1f')]},'include':[{'model':_0x479208[_0x4f7b('0x14')],'as':_0x4f7b('0x20'),'where':{'id':_0x3a3d6c[_0x4f7b('0x21')]},'limit':0x1,'include':[{'model':_0x479208['CmContact'],'as':_0x4f7b('0x22'),'attributes':_['keys'](_0x24e5cf)}]}]});})[_0x4f7b('0x16')](function(_0x12374b){_0x50a161=_0x12374b[_0x4f7b('0xf')]({'plain':!![]});if(_0x50a161&&_0x50a161[_0x4f7b('0x23')]){logger[_0x4f7b('0x24')](_0x4f7b('0x25'),_0x4f7b('0x26'),util[_0x4f7b('0x27')](_0x4f7b('0x28'),_0x3a3d6c['id'],_0x50a161['replyUri']));if(_0x50a161[_0x4f7b('0x20')]&&_0x50a161[_0x4f7b('0x20')][_0x4f7b('0x29')]){_0x3a3d6c['Interaction']=_[_0x4f7b('0x2a')](_0x50a161[_0x4f7b('0x20')][0x0],'Contact');_0x3a3d6c[_0x4f7b('0x22')]=_0x50a161['Interactions'][0x0][_0x4f7b('0x22')];}var _0x433563={'method':_0x4f7b('0x2b'),'uri':encodeURI(_0x50a161[_0x4f7b('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x433563[_0x4f7b('0x2c')]){case _0x4f7b('0x2d'):_0x433563['qs']=_0x3a3d6c;break;case _0x4f7b('0x2b'):_0x433563[_0x4f7b('0xc')]=_0x3a3d6c;break;}return rp(_0x433563)['then'](function(_0x6c9626){logger[_0x4f7b('0x24')](_0x4f7b('0x25'),'afterCreate',util[_0x4f7b('0x27')](_0x4f7b('0x2e'),_0x3a3d6c['id'],_0x50a161[_0x4f7b('0x23')]));if(_0x6c9626[_0x4f7b('0xc')][_0x4f7b('0x2f')]&&_0x6c9626['body'][_0x4f7b('0x2f')]!=_0x3a3d6c[_0x4f7b('0x30')][_0x4f7b('0x2f')]){return _0x479208['OpenchannelInteraction'][_0x4f7b('0x17')]({'threadId':_0x6c9626['body']['threadId']},{'logging':!![],'where':{'id':_0x3a3d6c[_0x4f7b('0x30')]['id']}});}else{return;}})['then'](function(){return _0x5c714d[_0x4f7b('0x17')]({'read':!![]});})[_0x4f7b('0x19')](function(_0x22f489){logger[_0x4f7b('0x1a')](_0x4f7b('0x25'),_0x4f7b('0x26'),util[_0x4f7b('0x31')](_0x22f489,{'showHidden':![],'depth':null}));_0x1016e0();});}else{_0x1016e0();}})[_0x4f7b('0x32')](function(){_0x1016e0();});}else{_0x1016e0();}}},'charset':_0x4f7b('0x33'),'collate':_0x4f7b('0x34')});}; \ No newline at end of file +var _0xd4a2=['OpenchannelInteractionId','then','createdAt','toLowerCase','catch','error','describe','OpenchannelAccount','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','POST','threadId','update','inspect','finally','utf8mb4','lodash','api','bluebird','path','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne'];(function(_0x4522f9,_0x30e2d6){var _0x7c7088=function(_0x4905f1){while(--_0x4905f1){_0x4522f9['push'](_0x4522f9['shift']());}};_0x7c7088(++_0x30e2d6);}(_0xd4a2,0x173));var _0x2d4a=function(_0x14a40d,_0x3eb50e){_0x14a40d=_0x14a40d-0x0;var _0x334b2f=_0xd4a2[_0x14a40d];return _0x334b2f;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));module[_0x2d4a('0x6')]=function(_0x3a88e2,_0x1ca10b){return _0x3a88e2['define'](_0x2d4a('0x7'),attributes,{'tableName':_0x2d4a('0x8'),'paranoid':![],'indexes':[{'name':_0x2d4a('0x9'),'fields':[_0x2d4a('0xa')],'type':_0x2d4a('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x535b2f,_0xb9f016,_0x113839){var _0x33b786=_0x3a88e2[_0x2d4a('0xc')];var _0x3abbbd=_0x535b2f[_0x2d4a('0xd')]({'plain':!![]});if(_0x3abbbd['direction']['toLowerCase']()==='in'||_0x3abbbd[_0x2d4a('0xe')]['toLowerCase']()===_0x2d4a('0xf')&&!_0x3abbbd[_0x2d4a('0x10')]&&!_[_0x2d4a('0x11')](_0x3abbbd[_0x2d4a('0x12')])){_0x33b786[_0x2d4a('0x13')][_0x2d4a('0x14')]({'where':{'id':_0x3abbbd[_0x2d4a('0x15')]}})[_0x2d4a('0x16')](function(_0x544622){if(_0x544622){_0x544622['update']({'lastMsgAt':_0x3abbbd[_0x2d4a('0x17')],'lastMsgDirection':_0x3abbbd['direction'][_0x2d4a('0x18')]()});}})[_0x2d4a('0x19')](function(_0x11896d){console[_0x2d4a('0x1a')](_0x11896d);});}if(_0x3abbbd['direction']===_0x2d4a('0xf')&&!_0x3abbbd['secret']){var _0x2838fa;_0x33b786['CmContact'][_0x2d4a('0x1b')]()[_0x2d4a('0x16')](function(_0x2188b2){return _0x33b786[_0x2d4a('0x1c')]['find']({'where':{'id':_0x3abbbd['OpenchannelAccountId']},'include':[{'model':_0x33b786['OpenchannelInteraction'],'as':_0x2d4a('0x1d'),'where':{'id':_0x3abbbd[_0x2d4a('0x15')]},'limit':0x1,'include':[{'model':_0x33b786[_0x2d4a('0x1e')],'as':_0x2d4a('0x1f'),'attributes':_[_0x2d4a('0x20')](_0x2188b2)}]}]});})[_0x2d4a('0x16')](function(_0x56445a){_0x2838fa=_0x56445a['get']({'plain':!![]});if(_0x2838fa&&_0x2838fa[_0x2d4a('0x21')]){logger[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x2d4a('0x24'),util[_0x2d4a('0x25')](_0x2d4a('0x26'),_0x3abbbd['id'],_0x2838fa[_0x2d4a('0x21')]));if(_0x2838fa[_0x2d4a('0x1d')]&&_0x2838fa['Interactions'][_0x2d4a('0x27')]){_0x3abbbd[_0x2d4a('0x28')]=_[_0x2d4a('0x29')](_0x2838fa[_0x2d4a('0x1d')][0x0],_0x2d4a('0x1f'));_0x3abbbd[_0x2d4a('0x1f')]=_0x2838fa[_0x2d4a('0x1d')][0x0][_0x2d4a('0x1f')];}var _0xb9f016={'method':'POST','uri':encodeURI(_0x2838fa['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xb9f016[_0x2d4a('0x2a')]){case'GET':_0xb9f016['qs']=_0x3abbbd;break;case _0x2d4a('0x2b'):_0xb9f016[_0x2d4a('0xa')]=_0x3abbbd;break;}return rp(_0xb9f016)[_0x2d4a('0x16')](function(_0x1d2fa6){logger[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x2d4a('0x24'),util[_0x2d4a('0x25')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3abbbd['id'],_0x2838fa[_0x2d4a('0x21')]));if(_0x1d2fa6['body'][_0x2d4a('0x2c')]&&_0x1d2fa6[_0x2d4a('0xa')][_0x2d4a('0x2c')]!=_0x3abbbd[_0x2d4a('0x28')][_0x2d4a('0x2c')]){return _0x33b786[_0x2d4a('0x13')][_0x2d4a('0x2d')]({'threadId':_0x1d2fa6[_0x2d4a('0xa')]['threadId']},{'logging':!![],'where':{'id':_0x3abbbd[_0x2d4a('0x28')]['id']}});}else{return;}})[_0x2d4a('0x16')](function(){return _0x535b2f[_0x2d4a('0x2d')]({'read':!![]});})[_0x2d4a('0x19')](function(_0x2b66af){logger['error'](_0x2d4a('0x23'),_0x2d4a('0x24'),util[_0x2d4a('0x2e')](_0x2b66af,{'showHidden':![],'depth':null}));_0x113839();});}else{_0x113839();}})[_0x2d4a('0x2f')](function(){_0x113839();});}else{_0x113839();}}},'charset':_0x2d4a('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index fcc4601..d727028 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x443ba4,_0x108a3b){var _0x5208e2=function(_0x3e79e3){while(--_0x3e79e3){_0x443ba4['push'](_0x443ba4['shift']());}};_0x5208e2(++_0x108a3b);}(_0x2ef3,0xba));var _0x32ef=function(_0x381725,_0x5088f1){_0x381725=_0x381725-0x0;var _0x5bf1ac=_0x2ef3[_0x381725];return _0x5bf1ac;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3925a2,_0x2bd479){var _0x19d501=function(_0x1c5ca4){while(--_0x1c5ca4){_0x3925a2['push'](_0x3925a2['shift']());}};_0x19d501(++_0x2bd479);}(_0xadb5,0xad));var _0x5adb=function(_0x2e17ba,_0x454b0f){_0x2e17ba=_0x2e17ba-0x0;var _0xc94f6d=_0xadb5[_0x2e17ba];return _0xc94f6d;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1de9089..5e6e49f 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 _0x3f7d=['removeListener','register','length','./openchannelMessage.events','save','remove','emit'];(function(_0x3fbbd0,_0x269a1f){var _0x135c98=function(_0x19cda4){while(--_0x19cda4){_0x3fbbd0['push'](_0x3fbbd0['shift']());}};_0x135c98(++_0x269a1f);}(_0x3f7d,0x18b));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelMessageEvents=require(_0xd3f7('0x0'));var events=[_0xd3f7('0x1'),_0xd3f7('0x2'),'update'];function createListener(_0x2264c0,_0x570927){return function(_0x477d2f){_0x570927[_0xd3f7('0x3')](_0x2264c0,_0x477d2f);};}function removeListener(_0x412e4e,_0x34306d){return function(){OpenchannelMessageEvents[_0xd3f7('0x4')](_0x412e4e,_0x34306d);};}exports[_0xd3f7('0x5')]=function(_0x455841){for(var _0x2122f9=0x0,_0x32438c=events[_0xd3f7('0x6')];_0x2122f9<_0x32438c;_0x2122f9++){var _0x26e439=events[_0x2122f9];var _0x1b6009=createListener('openchannelMessage:'+_0x26e439,_0x455841);OpenchannelMessageEvents['on'](_0x26e439,_0x1b6009);}}; \ No newline at end of file +var _0x3fe9=['emit','removeListener','register','length','./openchannelMessage.events','save'];(function(_0x2c6529,_0x317c37){var _0x12bccb=function(_0x422fc7){while(--_0x422fc7){_0x2c6529['push'](_0x2c6529['shift']());}};_0x12bccb(++_0x317c37);}(_0x3fe9,0x106));var _0x93fe=function(_0x2bb334,_0x8289c9){_0x2bb334=_0x2bb334-0x0;var _0x271761=_0x3fe9[_0x2bb334];return _0x271761;};'use strict';var OpenchannelMessageEvents=require(_0x93fe('0x0'));var events=[_0x93fe('0x1'),'remove','update'];function createListener(_0x363bc1,_0x607ebc){return function(_0x8232f3){_0x607ebc[_0x93fe('0x2')](_0x363bc1,_0x8232f3);};}function removeListener(_0x47e824,_0x409fee){return function(){OpenchannelMessageEvents[_0x93fe('0x3')](_0x47e824,_0x409fee);};}exports[_0x93fe('0x4')]=function(_0x3a1584){for(var _0x5ad293=0x0,_0x3f7195=events[_0x93fe('0x5')];_0x5ad293<_0x3f7195;_0x5ad293++){var _0x148776=events[_0x5ad293];var _0x34cd8a=createListener('openchannelMessage:'+_0x148776,_0x3a1584);OpenchannelMessageEvents['on'](_0x148776,_0x34cd8a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 25050d4..aaa67a1 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 _0x9b1c=['describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x9b1c,0xe7));var _0xc9b1=function(_0x18a6d4,_0x4378dc){_0x18a6d4=_0x18a6d4-0x0;var _0x59a605=_0x9b1c[_0x18a6d4];return _0x59a605;};'use strict';var multer=require(_0xc9b1('0x0'));var util=require(_0xc9b1('0x1'));var path=require('path');var timeout=require(_0xc9b1('0x2'));var express=require('express');var router=express[_0xc9b1('0x3')]();var fs_extra=require(_0xc9b1('0x4'));var auth=require(_0xc9b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9b1('0x6'));var controller=require(_0xc9b1('0x7'));router[_0xc9b1('0x8')]('/',auth[_0xc9b1('0x9')](),controller[_0xc9b1('0xa')]);router[_0xc9b1('0x8')](_0xc9b1('0xb'),auth[_0xc9b1('0x9')](),controller[_0xc9b1('0xc')]);router['get'](_0xc9b1('0xd'),auth[_0xc9b1('0x9')](),controller[_0xc9b1('0xe')]);router[_0xc9b1('0x8')](_0xc9b1('0xf'),auth[_0xc9b1('0x9')](),controller['getMembers']);router[_0xc9b1('0x8')](_0xc9b1('0x10'),auth[_0xc9b1('0x9')](),controller[_0xc9b1('0x11')]);router[_0xc9b1('0x8')](_0xc9b1('0x12'),auth[_0xc9b1('0x9')](),controller[_0xc9b1('0x13')]);router[_0xc9b1('0x14')]('/',auth[_0xc9b1('0x9')](),controller[_0xc9b1('0x15')]);router['post'](_0xc9b1('0x10'),auth['isAuthenticated'](),controller[_0xc9b1('0x16')]);router[_0xc9b1('0x14')](_0xc9b1('0x12'),auth['isAuthenticated'](),controller[_0xc9b1('0x17')]);router[_0xc9b1('0x18')]('/:id',auth[_0xc9b1('0x9')](),controller['update']);router[_0xc9b1('0x19')]('/:id',auth[_0xc9b1('0x9')](),controller['destroy']);router[_0xc9b1('0x19')](_0xc9b1('0x10'),auth[_0xc9b1('0x9')](),controller['removeTeams']);router[_0xc9b1('0x19')](_0xc9b1('0x12'),auth['isAuthenticated'](),controller[_0xc9b1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xa82b=['removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeTeams'];(function(_0x5a31bd,_0x4977f9){var _0x3dc4e8=function(_0x3a7b22){while(--_0x3a7b22){_0x5a31bd['push'](_0x5a31bd['shift']());}};_0x3dc4e8(++_0x4977f9);}(_0xa82b,0x12b));var _0xba82=function(_0x4c6a7f,_0x452cf6){_0x4c6a7f=_0x4c6a7f-0x0;var _0x1a5474=_0xa82b[_0x4c6a7f];return _0x1a5474;};'use strict';var multer=require(_0xba82('0x0'));var util=require(_0xba82('0x1'));var path=require(_0xba82('0x2'));var timeout=require(_0xba82('0x3'));var express=require('express');var router=express[_0xba82('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba82('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba82('0x6'));var controller=require(_0xba82('0x7'));router[_0xba82('0x8')]('/',auth[_0xba82('0x9')](),controller[_0xba82('0xa')]);router[_0xba82('0x8')]('/describe',auth[_0xba82('0x9')](),controller['describe']);router[_0xba82('0x8')](_0xba82('0xb'),auth[_0xba82('0x9')](),controller['show']);router[_0xba82('0x8')](_0xba82('0xc'),auth[_0xba82('0x9')](),controller[_0xba82('0xd')]);router[_0xba82('0x8')](_0xba82('0xe'),auth[_0xba82('0x9')](),controller[_0xba82('0xf')]);router[_0xba82('0x8')](_0xba82('0x10'),auth[_0xba82('0x9')](),controller['getAgents']);router[_0xba82('0x11')]('/',auth[_0xba82('0x9')](),controller[_0xba82('0x12')]);router[_0xba82('0x11')](_0xba82('0xe'),auth[_0xba82('0x9')](),controller[_0xba82('0x13')]);router[_0xba82('0x11')](_0xba82('0x10'),auth[_0xba82('0x9')](),controller[_0xba82('0x14')]);router[_0xba82('0x15')](_0xba82('0xb'),auth['isAuthenticated'](),controller[_0xba82('0x16')]);router['delete'](_0xba82('0xb'),auth[_0xba82('0x9')](),controller['destroy']);router[_0xba82('0x17')]('/:id/teams',auth[_0xba82('0x9')](),controller[_0xba82('0x18')]);router['delete'](_0xba82('0x10'),auth[_0xba82('0x9')](),controller[_0xba82('0x19')]);module[_0xba82('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c92e55a..b3fe792 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 _0xdd23=['STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x360f03,_0x349238){var _0xc0390=function(_0x59bcfc){while(--_0x59bcfc){_0x360f03['push'](_0x360f03['shift']());}};_0xc0390(++_0x349238);}(_0xdd23,0x186));var _0x3dd2=function(_0x44c73d,_0x486a49){_0x44c73d=_0x44c73d-0x0;var _0xe2b045=_0xdd23[_0x44c73d];return _0xe2b045;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3dd2('0x0')],'unique':_0x3dd2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3dd2('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3dd2('0x2')](_0x3dd2('0x3'),_0x3dd2('0x4'),_0x3dd2('0x5'))}}; \ No newline at end of file +var _0x17cb=['name','INTEGER','roundrobin','sequelize','exports','STRING'];(function(_0x40009c,_0x2fa8c0){var _0x2096b6=function(_0x682a83){while(--_0x682a83){_0x40009c['push'](_0x40009c['shift']());}};_0x2096b6(++_0x2fa8c0);}(_0x17cb,0x123));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb17c('0x0'));module[_0xb17c('0x1')]={'name':{'type':Sequelize[_0xb17c('0x2')],'unique':_0xb17c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb17c('0x2')]},'timeout':{'type':Sequelize[_0xb17c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xb17c('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index bf3062e..c5212ef 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 _0x2ae7=['attributes','length','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','show','params','includeAll','find','catch','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','Team','select','team_has_openchannel_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','save','update','destroy','then','get','UserProfileResource','end','error','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','name','query','keys','filters','model','intersection','fields'];(function(_0x3f09a9,_0x2a1758){var _0x854a6d=function(_0x3eff89){while(--_0x3eff89){_0x3f09a9['push'](_0x3f09a9['shift']());}};_0x854a6d(++_0x2a1758);}(_0x2ae7,0xd6));var _0x72ae=function(_0x3398f7,_0x3d6fb4){_0x3398f7=_0x3398f7-0x0;var _0x52ecb9=_0x2ae7[_0x3398f7];return _0x52ecb9;};'use strict';var emlformat=require(_0x72ae('0x0'));var rimraf=require(_0x72ae('0x1'));var zipdir=require(_0x72ae('0x2'));var jsonpatch=require(_0x72ae('0x3'));var rp=require(_0x72ae('0x4'));var moment=require(_0x72ae('0x5'));var BPromise=require(_0x72ae('0x6'));var Mustache=require('mustache');var util=require(_0x72ae('0x7'));var path=require('path');var sox=require(_0x72ae('0x8'));var csv=require(_0x72ae('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72ae('0xa'));var _=require(_0x72ae('0xb'));var squel=require(_0x72ae('0xc'));var crypto=require(_0x72ae('0xd'));var jsforce=require(_0x72ae('0xe'));var deskjs=require(_0x72ae('0xf'));var toCsv=require(_0x72ae('0x9'));var querystring=require(_0x72ae('0x10'));var Papa=require(_0x72ae('0x11'));var Redis=require(_0x72ae('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x72ae('0x13'));var as=require(_0x72ae('0x14'));var hardwareService=require(_0x72ae('0x15'));var logger=require(_0x72ae('0x16'))('api');var utils=require(_0x72ae('0x17'));var config=require(_0x72ae('0x18'));var licenseUtil=require(_0x72ae('0x19'));var db=require(_0x72ae('0x1a'))['db'];config[_0x72ae('0x1b')]=_[_0x72ae('0x1c')](config[_0x72ae('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x72ae('0x1d'))(new Redis(config[_0x72ae('0x1b')]));require(_0x72ae('0x1e'))[_0x72ae('0x1f')](socket);function respondWithStatusCode(_0xe71a41,_0xacac80){_0xacac80=_0xacac80||0xcc;return function(_0x1b610d){if(_0x1b610d){return _0xe71a41[_0x72ae('0x20')](_0xacac80);}return _0xe71a41[_0x72ae('0x21')](_0xacac80)['end']();};}function respondWithResult(_0x1af936,_0x59a251){_0x59a251=_0x59a251||0xc8;return function(_0x3a9a88){if(_0x3a9a88){return _0x1af936[_0x72ae('0x21')](_0x59a251)[_0x72ae('0x22')](_0x3a9a88);}};}function respondWithFilteredResult(_0x2403ae,_0x2fa175){return function(_0x38ee78){if(_0x38ee78){var _0x488b49=typeof _0x2fa175[_0x72ae('0x23')]===_0x72ae('0x24')&&typeof _0x2fa175[_0x72ae('0x25')]==='undefined';var _0xc8ffd5=_0x38ee78[_0x72ae('0x26')];var _0x4779d5=_0x488b49?0x0:_0x2fa175[_0x72ae('0x23')];var _0x28b2b1=_0x488b49?_0x38ee78[_0x72ae('0x26')]:_0x2fa175[_0x72ae('0x23')]+_0x2fa175['limit'];var _0x484d24;if(_0x28b2b1>=_0xc8ffd5){_0x28b2b1=_0xc8ffd5;_0x484d24=0xc8;}else{_0x484d24=0xce;}_0x2403ae['status'](_0x484d24);return _0x2403ae[_0x72ae('0x27')]('Content-Range',_0x4779d5+'-'+_0x28b2b1+'/'+_0xc8ffd5)[_0x72ae('0x22')](_0x38ee78);}return null;};}function patchUpdates(_0x26e733){return function(_0xea94a6){try{jsonpatch['apply'](_0xea94a6,_0x26e733,!![]);}catch(_0xdcd9d2){return BPromise['reject'](_0xdcd9d2);}return _0xea94a6[_0x72ae('0x28')]();};}function saveUpdates(_0x33cecf,_0x240a37){return function(_0xfa5e4b){if(_0xfa5e4b){return _0xfa5e4b[_0x72ae('0x29')](_0x33cecf)['then'](function(_0x4f3f58){return _0x4f3f58;});}return null;};}function removeEntity(_0x54ac9e,_0x1b3b48){return function(_0x2e1d23){if(_0x2e1d23){return _0x2e1d23[_0x72ae('0x2a')]()[_0x72ae('0x2b')](function(){var _0x55fc4e=_0x2e1d23[_0x72ae('0x2c')]({'plain':!![]});var _0x4a8e9='OpenchannelQueues';return db[_0x72ae('0x2d')]['destroy']({'where':{'type':_0x4a8e9,'resourceId':_0x55fc4e['id']}})['then'](function(){return _0x2e1d23;});})[_0x72ae('0x2b')](function(){_0x54ac9e['status'](0xcc)[_0x72ae('0x2e')]();});}};}function handleEntityNotFound(_0x3fc9ec,_0x2a13ba){return function(_0x3cdf61){if(!_0x3cdf61){_0x3fc9ec['sendStatus'](0x194);}return _0x3cdf61;};}function handleError(_0x5bf3a2,_0x2237ac){_0x2237ac=_0x2237ac||0x1f4;return function(_0x9dd790){logger[_0x72ae('0x2f')](_0x9dd790['stack']);if(_0x9dd790['name']){delete _0x9dd790['name'];}_0x5bf3a2[_0x72ae('0x21')](_0x2237ac)[_0x72ae('0x30')](_0x9dd790);};}exports[_0x72ae('0x31')]=function(_0x433003,_0x6338b5){var _0x5e9fb5={},_0x44d3ef={},_0x3c3ec9={'count':0x0,'rows':[]};var _0x5467bb=_[_0x72ae('0x32')](db[_0x72ae('0x33')][_0x72ae('0x34')],function(_0x1892af){return{'name':_0x1892af[_0x72ae('0x35')],'type':_0x1892af[_0x72ae('0x36')]['key']};});_0x44d3ef['model']=_[_0x72ae('0x32')](_0x5467bb,_0x72ae('0x37'));_0x44d3ef[_0x72ae('0x38')]=_[_0x72ae('0x39')](_0x433003[_0x72ae('0x38')]);_0x44d3ef[_0x72ae('0x3a')]=_['intersection'](_0x44d3ef[_0x72ae('0x3b')],_0x44d3ef['query']);_0x5e9fb5['attributes']=_[_0x72ae('0x3c')](_0x44d3ef[_0x72ae('0x3b')],qs[_0x72ae('0x3d')](_0x433003[_0x72ae('0x38')][_0x72ae('0x3d')]));_0x5e9fb5[_0x72ae('0x3e')]=_0x5e9fb5['attributes'][_0x72ae('0x3f')]?_0x5e9fb5[_0x72ae('0x3e')]:_0x44d3ef[_0x72ae('0x3b')];if(!_0x433003[_0x72ae('0x38')]['hasOwnProperty'](_0x72ae('0x40'))){_0x5e9fb5['limit']=qs[_0x72ae('0x25')](_0x433003['query'][_0x72ae('0x25')]);_0x5e9fb5[_0x72ae('0x23')]=qs[_0x72ae('0x23')](_0x433003[_0x72ae('0x38')][_0x72ae('0x23')]);}_0x5e9fb5[_0x72ae('0x41')]=qs[_0x72ae('0x42')](_0x433003[_0x72ae('0x38')][_0x72ae('0x42')]);_0x5e9fb5['where']=qs[_0x72ae('0x3a')](_[_0x72ae('0x43')](_0x433003[_0x72ae('0x38')],_0x44d3ef[_0x72ae('0x3a')]),_0x5467bb);if(_0x433003[_0x72ae('0x38')][_0x72ae('0x44')]){_0x5e9fb5[_0x72ae('0x45')]=_[_0x72ae('0x46')](_0x5e9fb5[_0x72ae('0x45')],{'$or':_[_0x72ae('0x32')](_0x5467bb,function(_0x3216dc){if(_0x3216dc[_0x72ae('0x36')]!=='VIRTUAL'){var _0x665bea={};_0x665bea[_0x3216dc[_0x72ae('0x37')]]={'$like':'%'+_0x433003[_0x72ae('0x38')]['filter']+'%'};return _0x665bea;}})});}_0x5e9fb5=_[_0x72ae('0x46')]({},_0x5e9fb5,_0x433003[_0x72ae('0x47')]);var _0x5c4732={'where':_0x5e9fb5[_0x72ae('0x45')]};return db['OpenchannelQueue']['count'](_0x5c4732)[_0x72ae('0x2b')](function(_0x446074){_0x3c3ec9[_0x72ae('0x26')]=_0x446074;if(_0x433003[_0x72ae('0x38')]['includeAll']){_0x5e9fb5[_0x72ae('0x48')]=[{'all':!![]}];}return db[_0x72ae('0x33')][_0x72ae('0x49')](_0x5e9fb5);})['then'](function(_0x239a1a){_0x3c3ec9['rows']=_0x239a1a;return _0x3c3ec9;})[_0x72ae('0x2b')](respondWithFilteredResult(_0x6338b5,_0x5e9fb5))['catch'](handleError(_0x6338b5,null));};exports[_0x72ae('0x4a')]=function(_0x108378,_0x5ebb9e){var _0x255538={'raw':!![],'where':{'id':_0x108378[_0x72ae('0x4b')]['id']}},_0x1df1ba={};_0x1df1ba[_0x72ae('0x3b')]=_['keys'](db[_0x72ae('0x33')][_0x72ae('0x34')]);_0x1df1ba['query']=_['keys'](_0x108378[_0x72ae('0x38')]);_0x1df1ba['filters']=_[_0x72ae('0x3c')](_0x1df1ba['model'],_0x1df1ba[_0x72ae('0x38')]);_0x255538[_0x72ae('0x3e')]=_[_0x72ae('0x3c')](_0x1df1ba['model'],qs[_0x72ae('0x3d')](_0x108378[_0x72ae('0x38')][_0x72ae('0x3d')]));_0x255538[_0x72ae('0x3e')]=_0x255538['attributes'][_0x72ae('0x3f')]?_0x255538[_0x72ae('0x3e')]:_0x1df1ba[_0x72ae('0x3b')];if(_0x108378[_0x72ae('0x38')][_0x72ae('0x4c')]){_0x255538[_0x72ae('0x48')]=[{'all':!![]}];}_0x255538=_['merge']({},_0x255538,_0x108378[_0x72ae('0x47')]);return db[_0x72ae('0x33')][_0x72ae('0x4d')](_0x255538)[_0x72ae('0x2b')](handleEntityNotFound(_0x5ebb9e,null))[_0x72ae('0x2b')](respondWithResult(_0x5ebb9e,null))[_0x72ae('0x4e')](handleError(_0x5ebb9e,null));};exports[_0x72ae('0x4f')]=function(_0x654a24,_0xe513d){return db[_0x72ae('0x33')][_0x72ae('0x4f')](_0x654a24[_0x72ae('0x50')],{})[_0x72ae('0x2b')](function(_0x597a21){var _0x2f8dcd=_0x654a24['user'][_0x72ae('0x2c')]({'plain':!![]});if(!_0x2f8dcd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8dcd[_0x72ae('0x51')]===_0x72ae('0x52')){var _0x121ba7=_0x597a21['get']({'plain':!![]});var _0x53caf6='OpenchannelQueues';return db[_0x72ae('0x53')][_0x72ae('0x4d')]({'where':{'name':_0x53caf6,'userProfileId':_0x2f8dcd[_0x72ae('0x54')]},'raw':!![]})[_0x72ae('0x2b')](function(_0x5dae91){if(_0x5dae91&&_0x5dae91[_0x72ae('0x55')]===0x0){return db['UserProfileResource'][_0x72ae('0x4f')]({'name':_0x121ba7['name'],'resourceId':_0x121ba7['id'],'type':_0x5dae91[_0x72ae('0x37')],'sectionId':_0x5dae91['id']},{})[_0x72ae('0x2b')](function(){return _0x597a21;});}else{return _0x597a21;}})['catch'](function(_0x3dcd50){logger[_0x72ae('0x2f')](_0x72ae('0x56'),_0x3dcd50);throw _0x3dcd50;});}return _0x597a21;})[_0x72ae('0x2b')](respondWithResult(_0xe513d,0xc9))[_0x72ae('0x4e')](handleError(_0xe513d,null));};exports[_0x72ae('0x29')]=function(_0x4691ca,_0x1b9aa2){if(_0x4691ca[_0x72ae('0x50')]['id']){delete _0x4691ca[_0x72ae('0x50')]['id'];}return db[_0x72ae('0x33')][_0x72ae('0x4d')]({'where':{'id':_0x4691ca[_0x72ae('0x4b')]['id']}})[_0x72ae('0x2b')](handleEntityNotFound(_0x1b9aa2,null))[_0x72ae('0x2b')](saveUpdates(_0x4691ca[_0x72ae('0x50')],null))[_0x72ae('0x2b')](respondWithResult(_0x1b9aa2,null))[_0x72ae('0x4e')](handleError(_0x1b9aa2,null));};exports[_0x72ae('0x2a')]=function(_0x4ce982,_0x5d01e6){return db[_0x72ae('0x33')][_0x72ae('0x4d')]({'where':{'id':_0x4ce982[_0x72ae('0x4b')]['id']}})[_0x72ae('0x2b')](handleEntityNotFound(_0x5d01e6,null))[_0x72ae('0x2b')](removeEntity(_0x5d01e6,null))[_0x72ae('0x4e')](handleError(_0x5d01e6,null));};exports[_0x72ae('0x57')]=function(_0x12b461,_0x14ef29){return db[_0x72ae('0x33')][_0x72ae('0x57')]()[_0x72ae('0x2b')](respondWithResult(_0x14ef29,null))[_0x72ae('0x4e')](handleError(_0x14ef29,null));};exports['getMembers']=function(_0x45ee8d,_0x53c56e,_0x368b2f){var _0x5950cc={'raw':!![],'where':{}},_0x5c9f53={},_0x16dba9;return db[_0x72ae('0x33')][_0x72ae('0x58')]({'where':{'id':_0x45ee8d[_0x72ae('0x4b')]['id']}})[_0x72ae('0x2b')](handleEntityNotFound(_0x53c56e,null))['then'](function(_0x2ecbfa){if(_0x2ecbfa){_0x16dba9=_0x2ecbfa[_0x72ae('0x2c')]({'plain':!![]});_0x5c9f53[_0x72ae('0x3b')]=_[_0x72ae('0x39')](db[_0x72ae('0x59')]['rawAttributes']);_0x5c9f53['query']=_[_0x72ae('0x39')](_0x45ee8d[_0x72ae('0x38')]);_0x5c9f53[_0x72ae('0x3a')]=_[_0x72ae('0x3c')](_0x5c9f53['model'],_0x5c9f53[_0x72ae('0x38')]);_0x5950cc[_0x72ae('0x3e')]=_[_0x72ae('0x3c')](_0x5c9f53['model'],qs[_0x72ae('0x3d')](_0x45ee8d['query'][_0x72ae('0x3d')]));_0x5950cc['attributes']=_0x5950cc[_0x72ae('0x3e')]['length']?_0x5950cc['attributes']:_0x5c9f53[_0x72ae('0x3b')];if(!_0x45ee8d[_0x72ae('0x38')][_0x72ae('0x5a')](_0x72ae('0x40'))){_0x5950cc[_0x72ae('0x25')]=qs[_0x72ae('0x25')](_0x45ee8d[_0x72ae('0x38')]['limit']);_0x5950cc[_0x72ae('0x23')]=qs['offset'](_0x45ee8d['query']['offset']);}_0x5950cc[_0x72ae('0x41')]=qs[_0x72ae('0x42')](_0x45ee8d[_0x72ae('0x38')][_0x72ae('0x42')]);_0x5950cc['where']=qs[_0x72ae('0x3a')](_['pick'](_0x45ee8d[_0x72ae('0x38')],_0x5c9f53[_0x72ae('0x3a')]));_0x5950cc[_0x72ae('0x45')][_0x72ae('0x5b')]=_0x2ecbfa['id'];if(_0x45ee8d[_0x72ae('0x38')][_0x72ae('0x44')]){_0x5950cc[_0x72ae('0x45')]=_[_0x72ae('0x46')](_0x5950cc[_0x72ae('0x45')],{'$or':_[_0x72ae('0x32')](_0x5950cc[_0x72ae('0x3e')],function(_0x1400bc){var _0x446bcd={};_0x446bcd[_0x1400bc]={'$like':'%'+_0x45ee8d['query']['filter']+'%'};return _0x446bcd;})});}_0x5950cc=_[_0x72ae('0x46')]({},_0x5950cc,_0x45ee8d['options']);return db['UserOpenchannelQueue'][_0x72ae('0x49')](_0x5950cc);}})[_0x72ae('0x2b')](function(_0x3539c2){if(_0x3539c2){return db[_0x72ae('0x5c')][_0x72ae('0x5d')]({'where':{'id':_[_0x72ae('0x32')](_0x3539c2,_0x72ae('0x5e')),'role':'agent'},'attributes':['id',_0x72ae('0x37'),_0x72ae('0x5f'),_0x72ae('0x60'),_0x72ae('0x61')]});}})[_0x72ae('0x2b')](function(_0x4d8287){if(_0x4d8287){return{'count':_0x4d8287['count'],'rows':_[_0x72ae('0x32')](_0x4d8287[_0x72ae('0x62')],function(_0x1bc12a){return{'membername':_0x1bc12a[_0x72ae('0x37')],'UserId':_0x1bc12a['id'],'queue_name':_0x16dba9[_0x72ae('0x37')],'OpenchannelQueueId':_0x16dba9['id'],'interface':util['format'](_0x72ae('0x63'),_0x72ae('0x64'),_0x1bc12a[_0x72ae('0x37')]),'penalty':0x0,'paused':_0x1bc12a[_0x72ae('0x5f')],'createdAt':_0x1bc12a['createdAt'],'updatedAt':_0x1bc12a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x72ae('0x2b')](respondWithFilteredResult(_0x53c56e,_0x5950cc))[_0x72ae('0x4e')](handleError(_0x53c56e,null));};exports['getTeams']=function(_0xd78db9,_0x372fed,_0x704818){var _0x1a2b33={};var _0x593be7={};var _0x6be465;var _0x58c77c;return db[_0x72ae('0x33')][_0x72ae('0x58')]({'where':{'id':_0xd78db9['params']['id']}})[_0x72ae('0x2b')](handleEntityNotFound(_0x372fed,null))[_0x72ae('0x2b')](function(_0x386a25){if(_0x386a25){_0x6be465=_0x386a25;_0x593be7['model']=_['keys'](db['Team'][_0x72ae('0x34')]);_0x593be7[_0x72ae('0x38')]=_[_0x72ae('0x39')](_0xd78db9[_0x72ae('0x38')]);_0x593be7[_0x72ae('0x3a')]=_[_0x72ae('0x3c')](_0x593be7[_0x72ae('0x3b')],_0x593be7['query']);_0x1a2b33['attributes']=_['intersection'](_0x593be7[_0x72ae('0x3b')],qs[_0x72ae('0x3d')](_0xd78db9[_0x72ae('0x38')][_0x72ae('0x3d')]));_0x1a2b33[_0x72ae('0x3e')]=_0x1a2b33[_0x72ae('0x3e')][_0x72ae('0x3f')]?_0x1a2b33[_0x72ae('0x3e')]:_0x593be7['model'];_0x1a2b33[_0x72ae('0x41')]=qs[_0x72ae('0x42')](_0xd78db9['query']['sort']);_0x1a2b33[_0x72ae('0x45')]=qs[_0x72ae('0x3a')](_[_0x72ae('0x43')](_0xd78db9['query'],_0x593be7['filters']));if(_0xd78db9[_0x72ae('0x38')][_0x72ae('0x44')]){_0x1a2b33[_0x72ae('0x45')]=_['merge'](_0x1a2b33[_0x72ae('0x45')],{'$or':_[_0x72ae('0x32')](_0x1a2b33[_0x72ae('0x3e')],function(_0x5e616d){var _0x495205={};_0x495205[_0x5e616d]={'$like':'%'+_0xd78db9['query'][_0x72ae('0x44')]+'%'};return _0x495205;})});}_0x1a2b33=_[_0x72ae('0x46')]({},_0x1a2b33,_0xd78db9[_0x72ae('0x47')]);return _0x6be465[_0x72ae('0x65')](_0x1a2b33);}})[_0x72ae('0x2b')](function(_0x1f8573){if(_0x1f8573){_0x58c77c=_0x1f8573[_0x72ae('0x3f')];if(!_0xd78db9[_0x72ae('0x38')][_0x72ae('0x5a')](_0x72ae('0x40'))){_0x1a2b33[_0x72ae('0x25')]=qs[_0x72ae('0x25')](_0xd78db9[_0x72ae('0x38')][_0x72ae('0x25')]);_0x1a2b33[_0x72ae('0x23')]=qs[_0x72ae('0x23')](_0xd78db9[_0x72ae('0x38')][_0x72ae('0x23')]);}return _0x6be465[_0x72ae('0x65')](_0x1a2b33);}})[_0x72ae('0x2b')](function(_0x48b564){if(_0x48b564){return _0x48b564?{'count':_0x58c77c,'rows':_0x48b564}:null;}})[_0x72ae('0x2b')](respondWithResult(_0x372fed,null))[_0x72ae('0x4e')](handleError(_0x372fed,null));};exports[_0x72ae('0x66')]=function(_0x55f20d,_0x1dade8,_0x4e45e2){var _0x4b18f6=_0x55f20d[_0x72ae('0x50')][_0x72ae('0x67')];return db['Team']['findAll']({'where':{'id':_0x4b18f6},'attributes':['id'],'include':[{'model':db[_0x72ae('0x5c')],'as':_0x72ae('0x68'),'attributes':['id',_0x72ae('0x37'),_0x72ae('0x69'),_0x72ae('0x6a'),_0x72ae('0x6b')],'raw':!![]}]})[_0x72ae('0x2b')](function(_0x17a48f){if(_0x17a48f){var _0x34357e=_[_0x72ae('0x6c')](_0x17a48f,function(_0x4e7f91){var _0x166cdd=_0x4e7f91['get']({'plain':!![]});return _0x166cdd[_0x72ae('0x68')];});return db['OpenchannelQueue'][_0x72ae('0x4d')]({'where':{'id':_0x55f20d[_0x72ae('0x4b')]['id']}})[_0x72ae('0x2b')](function(_0xe14a19){return db[_0x72ae('0x6d')]['transaction'](function(_0x21f763){return _0xe14a19[_0x72ae('0x66')](_0x4b18f6,{'transaction':_0x21f763})[_0x72ae('0x2b')](function(){return BPromise[_0x72ae('0x6e')](_0x34357e,function(_0x4bc507){return db[_0x72ae('0x59')][_0x72ae('0x6f')]({'where':{'UserId':_0x4bc507['id'],'OpenchannelQueueId':_0x55f20d[_0x72ae('0x4b')]['id']},'transaction':_0x21f763});});})[_0x72ae('0x2b')](function(){_0x34357e['forEach'](function(_0x126376){socket[_0x72ae('0x70')](_0x72ae('0x71'),{'UserId':_0x126376['id'],'OpenchannelQueueId':_0xe14a19['id']});});});});});}})['then'](respondWithStatusCode(_0x1dade8,null))[_0x72ae('0x4e')](handleError(_0x1dade8,null));};exports[_0x72ae('0x72')]=function(_0x4cdf0e,_0x72abc5,_0xc88b07){return db[_0x72ae('0x73')][_0x72ae('0x49')]({'where':{'id':_0x4cdf0e['query'][_0x72ae('0x67')]},'attributes':['id'],'include':[{'model':db[_0x72ae('0x5c')],'as':_0x72ae('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x72abc5,null))['then'](function(_0x393005){var _0x52473f=_[_0x72ae('0x32')](_0x393005,'id');var _0x1b5bb1=[];var _0x491cf3=[];var _0x5c6638=squel[_0x72ae('0x74')]();_0x5c6638['field']('tq.TeamId')['from'](_0x72ae('0x75'),'tq')['join'](_0x72ae('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x72ae('0x45')]('OpenchannelQueueId\x20=\x20?',_0x4cdf0e[_0x72ae('0x4b')]['id']);for(var _0xbe76ef=0x0;_0xbe76ef<_0x393005[_0x72ae('0x3f')];_0xbe76ef+=0x1){let _0x3df83d=_0x393005[_0xbe76ef];for(var _0x53e578=0x0;_0x53e578<_0x3df83d[_0x72ae('0x68')][_0x72ae('0x3f')];_0x53e578+=0x1){let _0x3151e3=_0x3df83d['Agents'][_0x53e578];var _0x388c25=_0x5c6638[_0x72ae('0x77')]();_0x388c25[_0x72ae('0x45')](_0x72ae('0x78'),_0x3151e3['id']);_0x491cf3[_0x72ae('0x79')](db[_0x72ae('0x6d')][_0x72ae('0x38')](_0x388c25[_0x72ae('0x7a')](),{'type':db[_0x72ae('0x6d')][_0x72ae('0x7b')][_0x72ae('0x7c')]})[_0x72ae('0x2b')](function(_0x19b84e){if(_0x19b84e[_0x72ae('0x3f')]===0x1){return _0x3151e3['id'];}else{var _0xedabf3=_['every'](_[_0x72ae('0x32')](_0x19b84e,_0x72ae('0x7d')),function(_0x4b6e56){return _[_0x72ae('0x7e')](_0x52473f,_0x4b6e56);});if(_0xedabf3){return _0x3151e3['id'];}}}));}}return BPromise[_0x72ae('0x7f')](_0x491cf3)[_0x72ae('0x2b')](function(_0x31b143){_0x1b5bb1=_(_0x1b5bb1)[_0x72ae('0x80')](_0x31b143)[_0x72ae('0x81')]()['value']();return db[_0x72ae('0x33')]['find']({'where':{'id':_0x4cdf0e[_0x72ae('0x4b')]['id']}})['then'](function(_0x36c635){return db['sequelize'][_0x72ae('0x82')](function(_0x542aa4){return _0x36c635['removeTeams'](_0x4cdf0e[_0x72ae('0x38')][_0x72ae('0x67')],{'transaction':_0x542aa4})[_0x72ae('0x2b')](function(){if(!_[_0x72ae('0x83')](_0x1b5bb1)){return _0x36c635['removeAgents'](_0x1b5bb1,{'transaction':_0x542aa4});}})['then'](function(){_0x1b5bb1['forEach'](function(_0xf3ea4e){socket[_0x72ae('0x70')](_0x72ae('0x84'),{'UserId':_0xf3ea4e,'OpenchannelQueueId':_0x36c635['id']});});});});});});})[_0x72ae('0x2b')](respondWithStatusCode(_0x72abc5,null))[_0x72ae('0x4e')](handleError(_0x72abc5,null));};exports['addAgents']=function(_0x1d021e,_0xab7450,_0x3120b0){return db[_0x72ae('0x33')][_0x72ae('0x4d')]({'where':{'id':_0x1d021e[_0x72ae('0x4b')]['id']}})[_0x72ae('0x2b')](handleEntityNotFound(_0xab7450,null))[_0x72ae('0x2b')](function(_0x11e3dd){if(_0x11e3dd){return _0x11e3dd[_0x72ae('0x85')](_0x1d021e['body'][_0x72ae('0x67')],_[_0x72ae('0x86')](_0x1d021e[_0x72ae('0x50')],['ids','id'])||{})[_0x72ae('0x87')](function(_0x3fd76b){for(var _0x5ea232=0x0;_0x5ea232<_0x1d021e[_0x72ae('0x50')][_0x72ae('0x67')][_0x72ae('0x3f')];_0x5ea232+=0x1){socket[_0x72ae('0x70')](_0x72ae('0x71'),{'UserId':Number(_0x1d021e[_0x72ae('0x50')]['ids'][_0x5ea232]),'OpenchannelQueueId':Number(_0x1d021e[_0x72ae('0x4b')]['id'])});}return _0x3fd76b;});}})[_0x72ae('0x2b')](respondWithResult(_0xab7450,null))[_0x72ae('0x4e')](handleError(_0xab7450,null));};exports[_0x72ae('0x88')]=function(_0x5b567f,_0xec8179,_0x51ab11){return db['OpenchannelQueue'][_0x72ae('0x4d')]({'where':{'id':_0x5b567f['params']['id']}})[_0x72ae('0x2b')](handleEntityNotFound(_0xec8179,null))[_0x72ae('0x2b')](function(_0x3f52b3){if(_0x3f52b3){return _0x3f52b3[_0x72ae('0x88')](_0x5b567f['query'][_0x72ae('0x67')])['then'](function(){if(_['isArray'](_0x5b567f[_0x72ae('0x38')][_0x72ae('0x67')])){for(var _0x322abc=0x0;_0x322abc<_0x5b567f[_0x72ae('0x38')][_0x72ae('0x67')][_0x72ae('0x3f')];_0x322abc+=0x1){socket[_0x72ae('0x70')](_0x72ae('0x84'),{'UserId':Number(_0x5b567f[_0x72ae('0x38')][_0x72ae('0x67')][_0x322abc]),'OpenchannelQueueId':Number(_0x5b567f[_0x72ae('0x4b')]['id'])});}}else{socket[_0x72ae('0x70')](_0x72ae('0x84'),{'UserId':Number(_0x5b567f[_0x72ae('0x38')][_0x72ae('0x67')]),'OpenchannelQueueId':Number(_0x5b567f[_0x72ae('0x4b')]['id'])});}});}})[_0x72ae('0x2b')](respondWithStatusCode(_0xec8179,null))[_0x72ae('0x4e')](handleError(_0xec8179,null));};exports['getAgents']=function(_0x42df4e,_0x1fe6ce,_0x344e66){var _0x4cc217={};var _0x3ef44d={};var _0x4a7115;var _0x3aac2e;return db[_0x72ae('0x33')]['findOne']({'where':{'id':_0x42df4e[_0x72ae('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1fe6ce,null))['then'](function(_0x583cb6){if(_0x583cb6){_0x4a7115=_0x583cb6;_0x3ef44d[_0x72ae('0x3b')]=_['keys'](db[_0x72ae('0x5c')][_0x72ae('0x34')]);_0x3ef44d[_0x72ae('0x38')]=_['keys'](_0x42df4e[_0x72ae('0x38')]);_0x3ef44d[_0x72ae('0x3a')]=_[_0x72ae('0x3c')](_0x3ef44d[_0x72ae('0x3b')],_0x3ef44d['query']);_0x4cc217['attributes']=_['intersection'](_0x3ef44d['model'],qs[_0x72ae('0x3d')](_0x42df4e[_0x72ae('0x38')][_0x72ae('0x3d')]));_0x4cc217['attributes']=_0x4cc217['attributes'][_0x72ae('0x3f')]?_0x4cc217[_0x72ae('0x3e')]:_0x3ef44d[_0x72ae('0x3b')];_0x4cc217[_0x72ae('0x41')]=qs[_0x72ae('0x42')](_0x42df4e[_0x72ae('0x38')][_0x72ae('0x42')]);_0x4cc217[_0x72ae('0x45')]=qs[_0x72ae('0x3a')](_[_0x72ae('0x43')](_0x42df4e['query'],_0x3ef44d[_0x72ae('0x3a')]));if(_0x42df4e['query'][_0x72ae('0x44')]){_0x4cc217[_0x72ae('0x45')]=_[_0x72ae('0x46')](_0x4cc217[_0x72ae('0x45')],{'$or':_[_0x72ae('0x32')](_0x4cc217[_0x72ae('0x3e')],function(_0x244d98){var _0x367cf1={};_0x367cf1[_0x244d98]={'$like':'%'+_0x42df4e[_0x72ae('0x38')][_0x72ae('0x44')]+'%'};return _0x367cf1;})});}_0x4cc217=_['merge']({},_0x4cc217,_0x42df4e['options']);return _0x4a7115[_0x72ae('0x89')](_0x4cc217);}})[_0x72ae('0x2b')](function(_0x172d2d){if(_0x172d2d){_0x3aac2e=_0x172d2d[_0x72ae('0x3f')];if(!_0x42df4e[_0x72ae('0x38')][_0x72ae('0x5a')]('nolimit')){_0x4cc217[_0x72ae('0x25')]=qs['limit'](_0x42df4e[_0x72ae('0x38')][_0x72ae('0x25')]);_0x4cc217[_0x72ae('0x23')]=qs[_0x72ae('0x23')](_0x42df4e[_0x72ae('0x38')][_0x72ae('0x23')]);}return _0x4a7115[_0x72ae('0x89')](_0x4cc217);}})[_0x72ae('0x2b')](function(_0x5355ac){if(_0x5355ac){return _0x5355ac?{'count':_0x3aac2e,'rows':_0x5355ac}:null;}})[_0x72ae('0x2b')](respondWithResult(_0x1fe6ce,null))[_0x72ae('0x4e')](handleError(_0x1fe6ce,null));}; \ No newline at end of file +var _0x55d8=['addTeams','ids','findAll','Agents','online','flatMap','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','end','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','OpenchannelQueue','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','filter','options','includeAll','include','rows','catch','show','keys','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','nolimit','order','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team'];(function(_0x248ed0,_0x4f5f88){var _0x5172e3=function(_0x5844de){while(--_0x5844de){_0x248ed0['push'](_0x248ed0['shift']());}};_0x5172e3(++_0x4f5f88);}(_0x55d8,0xaf));var _0x855d=function(_0x15b6c0,_0x903ba4){_0x15b6c0=_0x15b6c0-0x0;var _0x3dbd86=_0x55d8[_0x15b6c0];return _0x3dbd86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x855d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x855d('0x1'));var rp=require('request-promise');var moment=require(_0x855d('0x2'));var BPromise=require(_0x855d('0x3'));var Mustache=require('mustache');var util=require(_0x855d('0x4'));var path=require('path');var sox=require(_0x855d('0x5'));var csv=require(_0x855d('0x6'));var ejs=require(_0x855d('0x7'));var fs=require('fs');var fs_extra=require(_0x855d('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x855d('0x9'));var deskjs=require(_0x855d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x855d('0xb'));var Papa=require(_0x855d('0xc'));var Redis=require('ioredis');var authService=require(_0x855d('0xd'));var qs=require(_0x855d('0xe'));var as=require(_0x855d('0xf'));var hardwareService=require(_0x855d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x855d('0x11'));var config=require(_0x855d('0x12'));var licenseUtil=require(_0x855d('0x13'));var db=require('../../mysqldb')['db'];config[_0x855d('0x14')]=_[_0x855d('0x15')](config[_0x855d('0x14')],{'host':_0x855d('0x16'),'port':0x18eb});var socket=require(_0x855d('0x17'))(new Redis(config[_0x855d('0x14')]));require(_0x855d('0x18'))['register'](socket);function respondWithStatusCode(_0x42d427,_0x5cab6b){_0x5cab6b=_0x5cab6b||0xcc;return function(_0x4746ec){if(_0x4746ec){return _0x42d427['sendStatus'](_0x5cab6b);}return _0x42d427['status'](_0x5cab6b)[_0x855d('0x19')]();};}function respondWithResult(_0x40a9e0,_0xa2f062){_0xa2f062=_0xa2f062||0xc8;return function(_0x33c0d8){if(_0x33c0d8){return _0x40a9e0[_0x855d('0x1a')](_0xa2f062)[_0x855d('0x1b')](_0x33c0d8);}};}function respondWithFilteredResult(_0x93c979,_0x154ba2){return function(_0x2e292a){if(_0x2e292a){var _0x11c423=typeof _0x154ba2['offset']===_0x855d('0x1c')&&typeof _0x154ba2['limit']===_0x855d('0x1c');var _0x1f70df=_0x2e292a['count'];var _0x31c32e=_0x11c423?0x0:_0x154ba2[_0x855d('0x1d')];var _0x14e33e=_0x11c423?_0x2e292a[_0x855d('0x1e')]:_0x154ba2[_0x855d('0x1d')]+_0x154ba2[_0x855d('0x1f')];var _0x1d41b9;if(_0x14e33e>=_0x1f70df){_0x14e33e=_0x1f70df;_0x1d41b9=0xc8;}else{_0x1d41b9=0xce;}_0x93c979[_0x855d('0x1a')](_0x1d41b9);return _0x93c979[_0x855d('0x20')]('Content-Range',_0x31c32e+'-'+_0x14e33e+'/'+_0x1f70df)['json'](_0x2e292a);}return null;};}function patchUpdates(_0x1577b7){return function(_0x2d760c){try{jsonpatch[_0x855d('0x21')](_0x2d760c,_0x1577b7,!![]);}catch(_0x433977){return BPromise[_0x855d('0x22')](_0x433977);}return _0x2d760c[_0x855d('0x23')]();};}function saveUpdates(_0x16bf8c,_0x4341eb){return function(_0x489783){if(_0x489783){return _0x489783[_0x855d('0x24')](_0x16bf8c)[_0x855d('0x25')](function(_0x489ee8){return _0x489ee8;});}return null;};}function removeEntity(_0x8e3d85,_0x53d4b8){return function(_0x46cf0c){if(_0x46cf0c){return _0x46cf0c[_0x855d('0x26')]()['then'](function(){var _0x237072=_0x46cf0c[_0x855d('0x27')]({'plain':!![]});var _0x105c64=_0x855d('0x28');return db[_0x855d('0x29')][_0x855d('0x26')]({'where':{'type':_0x105c64,'resourceId':_0x237072['id']}})[_0x855d('0x25')](function(){return _0x46cf0c;});})[_0x855d('0x25')](function(){_0x8e3d85['status'](0xcc)[_0x855d('0x19')]();});}};}function handleEntityNotFound(_0xc6ba3b,_0x14d24c){return function(_0xa42576){if(!_0xa42576){_0xc6ba3b[_0x855d('0x2a')](0x194);}return _0xa42576;};}function handleError(_0x460d0a,_0xdada18){_0xdada18=_0xdada18||0x1f4;return function(_0x4e5af1){logger[_0x855d('0x2b')](_0x4e5af1[_0x855d('0x2c')]);if(_0x4e5af1[_0x855d('0x2d')]){delete _0x4e5af1['name'];}_0x460d0a['status'](_0xdada18)[_0x855d('0x2e')](_0x4e5af1);};}exports[_0x855d('0x2f')]=function(_0x4270f3,_0x1de207){var _0x318867={},_0x4d84d7={},_0x22e2bd={'count':0x0,'rows':[]};var _0x33cf5a=_['map'](db[_0x855d('0x30')]['rawAttributes'],function(_0x5d0ff8){return{'name':_0x5d0ff8['fieldName'],'type':_0x5d0ff8[_0x855d('0x31')][_0x855d('0x32')]};});_0x4d84d7[_0x855d('0x33')]=_[_0x855d('0x34')](_0x33cf5a,_0x855d('0x2d'));_0x4d84d7[_0x855d('0x35')]=_['keys'](_0x4270f3[_0x855d('0x35')]);_0x4d84d7[_0x855d('0x36')]=_[_0x855d('0x37')](_0x4d84d7['model'],_0x4d84d7[_0x855d('0x35')]);_0x318867[_0x855d('0x38')]=_[_0x855d('0x37')](_0x4d84d7[_0x855d('0x33')],qs[_0x855d('0x39')](_0x4270f3[_0x855d('0x35')]['fields']));_0x318867['attributes']=_0x318867[_0x855d('0x38')][_0x855d('0x3a')]?_0x318867[_0x855d('0x38')]:_0x4d84d7[_0x855d('0x33')];if(!_0x4270f3[_0x855d('0x35')][_0x855d('0x3b')]('nolimit')){_0x318867[_0x855d('0x1f')]=qs[_0x855d('0x1f')](_0x4270f3[_0x855d('0x35')][_0x855d('0x1f')]);_0x318867[_0x855d('0x1d')]=qs[_0x855d('0x1d')](_0x4270f3[_0x855d('0x35')][_0x855d('0x1d')]);}_0x318867['order']=qs[_0x855d('0x3c')](_0x4270f3[_0x855d('0x35')][_0x855d('0x3c')]);_0x318867[_0x855d('0x3d')]=qs[_0x855d('0x36')](_['pick'](_0x4270f3[_0x855d('0x35')],_0x4d84d7[_0x855d('0x36')]),_0x33cf5a);if(_0x4270f3[_0x855d('0x35')]['filter']){_0x318867[_0x855d('0x3d')]=_[_0x855d('0x3e')](_0x318867['where'],{'$or':_[_0x855d('0x34')](_0x33cf5a,function(_0xf4995b){if(_0xf4995b[_0x855d('0x31')]!=='VIRTUAL'){var _0x5c0f1b={};_0x5c0f1b[_0xf4995b[_0x855d('0x2d')]]={'$like':'%'+_0x4270f3[_0x855d('0x35')][_0x855d('0x3f')]+'%'};return _0x5c0f1b;}})});}_0x318867=_[_0x855d('0x3e')]({},_0x318867,_0x4270f3[_0x855d('0x40')]);var _0x5e374b={'where':_0x318867[_0x855d('0x3d')]};return db[_0x855d('0x30')][_0x855d('0x1e')](_0x5e374b)['then'](function(_0x719a3){_0x22e2bd[_0x855d('0x1e')]=_0x719a3;if(_0x4270f3['query'][_0x855d('0x41')]){_0x318867[_0x855d('0x42')]=[{'all':!![]}];}return db[_0x855d('0x30')]['findAll'](_0x318867);})[_0x855d('0x25')](function(_0x46628e){_0x22e2bd[_0x855d('0x43')]=_0x46628e;return _0x22e2bd;})[_0x855d('0x25')](respondWithFilteredResult(_0x1de207,_0x318867))[_0x855d('0x44')](handleError(_0x1de207,null));};exports[_0x855d('0x45')]=function(_0x446da3,_0x12a5fc){var _0x34f1cf={'raw':!![],'where':{'id':_0x446da3['params']['id']}},_0x2f0b9c={};_0x2f0b9c[_0x855d('0x33')]=_[_0x855d('0x46')](db[_0x855d('0x30')]['rawAttributes']);_0x2f0b9c[_0x855d('0x35')]=_[_0x855d('0x46')](_0x446da3[_0x855d('0x35')]);_0x2f0b9c[_0x855d('0x36')]=_[_0x855d('0x37')](_0x2f0b9c[_0x855d('0x33')],_0x2f0b9c[_0x855d('0x35')]);_0x34f1cf[_0x855d('0x38')]=_[_0x855d('0x37')](_0x2f0b9c[_0x855d('0x33')],qs[_0x855d('0x39')](_0x446da3['query']['fields']));_0x34f1cf['attributes']=_0x34f1cf[_0x855d('0x38')][_0x855d('0x3a')]?_0x34f1cf['attributes']:_0x2f0b9c[_0x855d('0x33')];if(_0x446da3[_0x855d('0x35')][_0x855d('0x41')]){_0x34f1cf[_0x855d('0x42')]=[{'all':!![]}];}_0x34f1cf=_[_0x855d('0x3e')]({},_0x34f1cf,_0x446da3[_0x855d('0x40')]);return db['OpenchannelQueue'][_0x855d('0x47')](_0x34f1cf)[_0x855d('0x25')](handleEntityNotFound(_0x12a5fc,null))[_0x855d('0x25')](respondWithResult(_0x12a5fc,null))[_0x855d('0x44')](handleError(_0x12a5fc,null));};exports['create']=function(_0xdcddd3,_0x23f215){return db[_0x855d('0x30')]['create'](_0xdcddd3['body'],{})[_0x855d('0x25')](function(_0x53e0ff){var _0x3dd342=_0xdcddd3[_0x855d('0x48')]['get']({'plain':!![]});if(!_0x3dd342)throw new Error(_0x855d('0x49'));if(_0x3dd342[_0x855d('0x4a')]===_0x855d('0x48')){var _0x5b5318=_0x53e0ff[_0x855d('0x27')]({'plain':!![]});var _0x19e6ad=_0x855d('0x28');return db[_0x855d('0x4b')][_0x855d('0x47')]({'where':{'name':_0x19e6ad,'userProfileId':_0x3dd342['userProfileId']},'raw':!![]})['then'](function(_0xa3a104){if(_0xa3a104&&_0xa3a104[_0x855d('0x4c')]===0x0){return db[_0x855d('0x29')][_0x855d('0x4d')]({'name':_0x5b5318[_0x855d('0x2d')],'resourceId':_0x5b5318['id'],'type':_0xa3a104[_0x855d('0x2d')],'sectionId':_0xa3a104['id']},{})[_0x855d('0x25')](function(){return _0x53e0ff;});}else{return _0x53e0ff;}})[_0x855d('0x44')](function(_0x29ee4e){logger['error'](_0x855d('0x4e'),_0x29ee4e);throw _0x29ee4e;});}return _0x53e0ff;})[_0x855d('0x25')](respondWithResult(_0x23f215,0xc9))[_0x855d('0x44')](handleError(_0x23f215,null));};exports[_0x855d('0x24')]=function(_0x1ca666,_0x4913cd){if(_0x1ca666[_0x855d('0x4f')]['id']){delete _0x1ca666['body']['id'];}return db[_0x855d('0x30')][_0x855d('0x47')]({'where':{'id':_0x1ca666[_0x855d('0x50')]['id']}})[_0x855d('0x25')](handleEntityNotFound(_0x4913cd,null))[_0x855d('0x25')](saveUpdates(_0x1ca666[_0x855d('0x4f')],null))[_0x855d('0x25')](respondWithResult(_0x4913cd,null))['catch'](handleError(_0x4913cd,null));};exports[_0x855d('0x26')]=function(_0x1c2f8a,_0x3c1990){return db[_0x855d('0x30')][_0x855d('0x47')]({'where':{'id':_0x1c2f8a['params']['id']}})[_0x855d('0x25')](handleEntityNotFound(_0x3c1990,null))['then'](removeEntity(_0x3c1990,null))[_0x855d('0x44')](handleError(_0x3c1990,null));};exports[_0x855d('0x51')]=function(_0x12634f,_0x30c1e7){return db[_0x855d('0x30')][_0x855d('0x51')]()['then'](respondWithResult(_0x30c1e7,null))[_0x855d('0x44')](handleError(_0x30c1e7,null));};exports[_0x855d('0x52')]=function(_0x6acc83,_0x43d363,_0x3b42b4){var _0x4bdd23={'raw':!![],'where':{}},_0x224229={},_0x2cbcdd;return db[_0x855d('0x30')][_0x855d('0x53')]({'where':{'id':_0x6acc83[_0x855d('0x50')]['id']}})['then'](handleEntityNotFound(_0x43d363,null))[_0x855d('0x25')](function(_0x5d4882){if(_0x5d4882){_0x2cbcdd=_0x5d4882[_0x855d('0x27')]({'plain':!![]});_0x224229[_0x855d('0x33')]=_['keys'](db[_0x855d('0x54')][_0x855d('0x55')]);_0x224229[_0x855d('0x35')]=_[_0x855d('0x46')](_0x6acc83['query']);_0x224229['filters']=_[_0x855d('0x37')](_0x224229[_0x855d('0x33')],_0x224229['query']);_0x4bdd23[_0x855d('0x38')]=_[_0x855d('0x37')](_0x224229[_0x855d('0x33')],qs[_0x855d('0x39')](_0x6acc83[_0x855d('0x35')]['fields']));_0x4bdd23['attributes']=_0x4bdd23[_0x855d('0x38')][_0x855d('0x3a')]?_0x4bdd23[_0x855d('0x38')]:_0x224229[_0x855d('0x33')];if(!_0x6acc83[_0x855d('0x35')][_0x855d('0x3b')](_0x855d('0x56'))){_0x4bdd23[_0x855d('0x1f')]=qs[_0x855d('0x1f')](_0x6acc83[_0x855d('0x35')][_0x855d('0x1f')]);_0x4bdd23[_0x855d('0x1d')]=qs[_0x855d('0x1d')](_0x6acc83['query'][_0x855d('0x1d')]);}_0x4bdd23[_0x855d('0x57')]=qs[_0x855d('0x3c')](_0x6acc83[_0x855d('0x35')][_0x855d('0x3c')]);_0x4bdd23[_0x855d('0x3d')]=qs[_0x855d('0x36')](_[_0x855d('0x58')](_0x6acc83[_0x855d('0x35')],_0x224229[_0x855d('0x36')]));_0x4bdd23[_0x855d('0x3d')][_0x855d('0x59')]=_0x5d4882['id'];if(_0x6acc83[_0x855d('0x35')][_0x855d('0x3f')]){_0x4bdd23[_0x855d('0x3d')]=_['merge'](_0x4bdd23[_0x855d('0x3d')],{'$or':_[_0x855d('0x34')](_0x4bdd23[_0x855d('0x38')],function(_0x598877){var _0x117693={};_0x117693[_0x598877]={'$like':'%'+_0x6acc83[_0x855d('0x35')][_0x855d('0x3f')]+'%'};return _0x117693;})});}_0x4bdd23=_['merge']({},_0x4bdd23,_0x6acc83[_0x855d('0x40')]);return db[_0x855d('0x54')]['findAll'](_0x4bdd23);}})[_0x855d('0x25')](function(_0x29a6ba){if(_0x29a6ba){return db[_0x855d('0x5a')][_0x855d('0x5b')]({'where':{'id':_[_0x855d('0x34')](_0x29a6ba,_0x855d('0x5c')),'role':_0x855d('0x5d')},'attributes':['id','name',_0x855d('0x5e'),_0x855d('0x5f'),_0x855d('0x60')]});}})['then'](function(_0x40e796){if(_0x40e796){return{'count':_0x40e796[_0x855d('0x1e')],'rows':_[_0x855d('0x34')](_0x40e796[_0x855d('0x43')],function(_0x6293fb){return{'membername':_0x6293fb['name'],'UserId':_0x6293fb['id'],'queue_name':_0x2cbcdd['name'],'OpenchannelQueueId':_0x2cbcdd['id'],'interface':util['format'](_0x855d('0x61'),_0x855d('0x62'),_0x6293fb['name']),'penalty':0x0,'paused':_0x6293fb['openchannelPause'],'createdAt':_0x6293fb[_0x855d('0x60')],'updatedAt':_0x6293fb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x855d('0x25')](respondWithFilteredResult(_0x43d363,_0x4bdd23))[_0x855d('0x44')](handleError(_0x43d363,null));};exports[_0x855d('0x63')]=function(_0x123000,_0x58f573,_0x5a247f){var _0x549e63={};var _0x5dd86a={};var _0x4da5fa;var _0x5957fb;return db['OpenchannelQueue'][_0x855d('0x53')]({'where':{'id':_0x123000[_0x855d('0x50')]['id']}})[_0x855d('0x25')](handleEntityNotFound(_0x58f573,null))['then'](function(_0x1cfc55){if(_0x1cfc55){_0x4da5fa=_0x1cfc55;_0x5dd86a[_0x855d('0x33')]=_['keys'](db[_0x855d('0x64')]['rawAttributes']);_0x5dd86a[_0x855d('0x35')]=_[_0x855d('0x46')](_0x123000[_0x855d('0x35')]);_0x5dd86a[_0x855d('0x36')]=_[_0x855d('0x37')](_0x5dd86a[_0x855d('0x33')],_0x5dd86a[_0x855d('0x35')]);_0x549e63[_0x855d('0x38')]=_[_0x855d('0x37')](_0x5dd86a[_0x855d('0x33')],qs['fields'](_0x123000[_0x855d('0x35')][_0x855d('0x39')]));_0x549e63[_0x855d('0x38')]=_0x549e63['attributes'][_0x855d('0x3a')]?_0x549e63[_0x855d('0x38')]:_0x5dd86a['model'];_0x549e63['order']=qs[_0x855d('0x3c')](_0x123000[_0x855d('0x35')][_0x855d('0x3c')]);_0x549e63['where']=qs[_0x855d('0x36')](_[_0x855d('0x58')](_0x123000['query'],_0x5dd86a['filters']));if(_0x123000[_0x855d('0x35')][_0x855d('0x3f')]){_0x549e63['where']=_[_0x855d('0x3e')](_0x549e63[_0x855d('0x3d')],{'$or':_['map'](_0x549e63[_0x855d('0x38')],function(_0x8cfccb){var _0x3f8196={};_0x3f8196[_0x8cfccb]={'$like':'%'+_0x123000[_0x855d('0x35')][_0x855d('0x3f')]+'%'};return _0x3f8196;})});}_0x549e63=_['merge']({},_0x549e63,_0x123000[_0x855d('0x40')]);return _0x4da5fa[_0x855d('0x63')](_0x549e63);}})[_0x855d('0x25')](function(_0xcd41c7){if(_0xcd41c7){_0x5957fb=_0xcd41c7[_0x855d('0x3a')];if(!_0x123000[_0x855d('0x35')][_0x855d('0x3b')](_0x855d('0x56'))){_0x549e63['limit']=qs[_0x855d('0x1f')](_0x123000[_0x855d('0x35')]['limit']);_0x549e63['offset']=qs[_0x855d('0x1d')](_0x123000[_0x855d('0x35')][_0x855d('0x1d')]);}return _0x4da5fa[_0x855d('0x63')](_0x549e63);}})[_0x855d('0x25')](function(_0x1fedb0){if(_0x1fedb0){return _0x1fedb0?{'count':_0x5957fb,'rows':_0x1fedb0}:null;}})[_0x855d('0x25')](respondWithResult(_0x58f573,null))[_0x855d('0x44')](handleError(_0x58f573,null));};exports[_0x855d('0x65')]=function(_0x36b25b,_0x56aca4,_0x2d7864){var _0x10fa95=_0x36b25b[_0x855d('0x4f')][_0x855d('0x66')];return db[_0x855d('0x64')][_0x855d('0x67')]({'where':{'id':_0x10fa95},'attributes':['id'],'include':[{'model':db[_0x855d('0x5a')],'as':_0x855d('0x68'),'attributes':['id',_0x855d('0x2d'),_0x855d('0x69'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1ffb53){if(_0x1ffb53){var _0x20fa4e=_[_0x855d('0x6a')](_0x1ffb53,function(_0xff9e26){var _0x3dd4a2=_0xff9e26[_0x855d('0x27')]({'plain':!![]});return _0x3dd4a2[_0x855d('0x68')];});return db[_0x855d('0x30')][_0x855d('0x47')]({'where':{'id':_0x36b25b[_0x855d('0x50')]['id']}})['then'](function(_0x364546){return db['sequelize'][_0x855d('0x6b')](function(_0x3c9133){return _0x364546[_0x855d('0x65')](_0x10fa95,{'transaction':_0x3c9133})[_0x855d('0x25')](function(){return BPromise[_0x855d('0x6c')](_0x20fa4e,function(_0xf286c2){return db[_0x855d('0x54')][_0x855d('0x6d')]({'where':{'UserId':_0xf286c2['id'],'OpenchannelQueueId':_0x36b25b[_0x855d('0x50')]['id']},'transaction':_0x3c9133});});})[_0x855d('0x25')](function(){_0x20fa4e['forEach'](function(_0x1d82b0){socket[_0x855d('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x1d82b0['id'],'OpenchannelQueueId':_0x364546['id']});});});});});}})[_0x855d('0x25')](respondWithStatusCode(_0x56aca4,null))[_0x855d('0x44')](handleError(_0x56aca4,null));};exports[_0x855d('0x6f')]=function(_0x152e20,_0x161539,_0x3c3d24){return db[_0x855d('0x64')][_0x855d('0x67')]({'where':{'id':_0x152e20[_0x855d('0x35')][_0x855d('0x66')]},'attributes':['id'],'include':[{'model':db[_0x855d('0x5a')],'as':_0x855d('0x68'),'attributes':['id'],'raw':!![]}]})[_0x855d('0x25')](handleEntityNotFound(_0x161539,null))[_0x855d('0x25')](function(_0x4ae7b6){var _0x14b88e=_[_0x855d('0x34')](_0x4ae7b6,'id');var _0x5efb24=[];var _0x2d0fdb=[];var _0x115e90=squel[_0x855d('0x70')]();_0x115e90[_0x855d('0x71')](_0x855d('0x72'))['from'](_0x855d('0x73'),'tq')[_0x855d('0x74')](_0x855d('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x855d('0x3d')](_0x855d('0x76'),_0x152e20['params']['id']);for(var _0x179610=0x0;_0x179610<_0x4ae7b6[_0x855d('0x3a')];_0x179610+=0x1){let _0x2dd4b4=_0x4ae7b6[_0x179610];for(var _0x55cc4f=0x0;_0x55cc4f<_0x2dd4b4[_0x855d('0x68')][_0x855d('0x3a')];_0x55cc4f+=0x1){let _0x1061ef=_0x2dd4b4[_0x855d('0x68')][_0x55cc4f];var _0xd68512=_0x115e90[_0x855d('0x77')]();_0xd68512[_0x855d('0x3d')](_0x855d('0x78'),_0x1061ef['id']);_0x2d0fdb[_0x855d('0x79')](db['sequelize']['query'](_0xd68512[_0x855d('0x7a')](),{'type':db[_0x855d('0x7b')]['QueryTypes'][_0x855d('0x7c')]})[_0x855d('0x25')](function(_0x3e85d4){if(_0x3e85d4['length']===0x1){return _0x1061ef['id'];}else{var _0x4c4eeb=_[_0x855d('0x7d')](_[_0x855d('0x34')](_0x3e85d4,_0x855d('0x7e')),function(_0x4ad5eb){return _[_0x855d('0x7f')](_0x14b88e,_0x4ad5eb);});if(_0x4c4eeb){return _0x1061ef['id'];}}}));}}return BPromise['all'](_0x2d0fdb)[_0x855d('0x25')](function(_0x20ad83){_0x5efb24=_(_0x5efb24)[_0x855d('0x80')](_0x20ad83)[_0x855d('0x81')]()['value']();return db['OpenchannelQueue'][_0x855d('0x47')]({'where':{'id':_0x152e20[_0x855d('0x50')]['id']}})[_0x855d('0x25')](function(_0x5d4167){return db[_0x855d('0x7b')][_0x855d('0x6b')](function(_0x544653){return _0x5d4167['removeTeams'](_0x152e20['query'][_0x855d('0x66')],{'transaction':_0x544653})['then'](function(){if(!_[_0x855d('0x82')](_0x5efb24)){return _0x5d4167[_0x855d('0x83')](_0x5efb24,{'transaction':_0x544653});}})['then'](function(){_0x5efb24[_0x855d('0x84')](function(_0x1f756c){socket['emit'](_0x855d('0x85'),{'UserId':_0x1f756c,'OpenchannelQueueId':_0x5d4167['id']});});});});});});})['then'](respondWithStatusCode(_0x161539,null))[_0x855d('0x44')](handleError(_0x161539,null));};exports[_0x855d('0x86')]=function(_0xfb18fa,_0x37e55d,_0x28e74c){return db[_0x855d('0x30')][_0x855d('0x47')]({'where':{'id':_0xfb18fa[_0x855d('0x50')]['id']}})[_0x855d('0x25')](handleEntityNotFound(_0x37e55d,null))[_0x855d('0x25')](function(_0x57df25){if(_0x57df25){return _0x57df25['addAgents'](_0xfb18fa[_0x855d('0x4f')][_0x855d('0x66')],_[_0x855d('0x87')](_0xfb18fa[_0x855d('0x4f')],[_0x855d('0x66'),'id'])||{})[_0x855d('0x88')](function(_0x4dbe5e){for(var _0xf7d491=0x0;_0xf7d491<_0xfb18fa[_0x855d('0x4f')]['ids']['length'];_0xf7d491+=0x1){socket[_0x855d('0x6e')]('userOpenchannelQueue:save',{'UserId':Number(_0xfb18fa['body']['ids'][_0xf7d491]),'OpenchannelQueueId':Number(_0xfb18fa[_0x855d('0x50')]['id'])});}return _0x4dbe5e;});}})[_0x855d('0x25')](respondWithResult(_0x37e55d,null))['catch'](handleError(_0x37e55d,null));};exports[_0x855d('0x83')]=function(_0x595bb0,_0x44f5c9,_0x201705){return db[_0x855d('0x30')][_0x855d('0x47')]({'where':{'id':_0x595bb0[_0x855d('0x50')]['id']}})['then'](handleEntityNotFound(_0x44f5c9,null))[_0x855d('0x25')](function(_0x1c2498){if(_0x1c2498){return _0x1c2498[_0x855d('0x83')](_0x595bb0[_0x855d('0x35')][_0x855d('0x66')])['then'](function(){if(_['isArray'](_0x595bb0['query'][_0x855d('0x66')])){for(var _0x233d77=0x0;_0x233d77<_0x595bb0['query'][_0x855d('0x66')][_0x855d('0x3a')];_0x233d77+=0x1){socket[_0x855d('0x6e')](_0x855d('0x85'),{'UserId':Number(_0x595bb0['query'][_0x855d('0x66')][_0x233d77]),'OpenchannelQueueId':Number(_0x595bb0['params']['id'])});}}else{socket[_0x855d('0x6e')](_0x855d('0x85'),{'UserId':Number(_0x595bb0['query'][_0x855d('0x66')]),'OpenchannelQueueId':Number(_0x595bb0[_0x855d('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x44f5c9,null))[_0x855d('0x44')](handleError(_0x44f5c9,null));};exports[_0x855d('0x89')]=function(_0x119c83,_0x3f3848,_0x515ea3){var _0x29f812={};var _0x7f5b1b={};var _0x4c640b;var _0x53c811;return db[_0x855d('0x30')][_0x855d('0x53')]({'where':{'id':_0x119c83[_0x855d('0x50')]['id']}})[_0x855d('0x25')](handleEntityNotFound(_0x3f3848,null))[_0x855d('0x25')](function(_0x4bce47){if(_0x4bce47){_0x4c640b=_0x4bce47;_0x7f5b1b[_0x855d('0x33')]=_[_0x855d('0x46')](db[_0x855d('0x5a')][_0x855d('0x55')]);_0x7f5b1b[_0x855d('0x35')]=_[_0x855d('0x46')](_0x119c83[_0x855d('0x35')]);_0x7f5b1b[_0x855d('0x36')]=_[_0x855d('0x37')](_0x7f5b1b[_0x855d('0x33')],_0x7f5b1b[_0x855d('0x35')]);_0x29f812[_0x855d('0x38')]=_[_0x855d('0x37')](_0x7f5b1b[_0x855d('0x33')],qs[_0x855d('0x39')](_0x119c83[_0x855d('0x35')][_0x855d('0x39')]));_0x29f812[_0x855d('0x38')]=_0x29f812['attributes'][_0x855d('0x3a')]?_0x29f812[_0x855d('0x38')]:_0x7f5b1b[_0x855d('0x33')];_0x29f812[_0x855d('0x57')]=qs[_0x855d('0x3c')](_0x119c83[_0x855d('0x35')][_0x855d('0x3c')]);_0x29f812[_0x855d('0x3d')]=qs[_0x855d('0x36')](_[_0x855d('0x58')](_0x119c83[_0x855d('0x35')],_0x7f5b1b[_0x855d('0x36')]));if(_0x119c83[_0x855d('0x35')][_0x855d('0x3f')]){_0x29f812[_0x855d('0x3d')]=_[_0x855d('0x3e')](_0x29f812[_0x855d('0x3d')],{'$or':_[_0x855d('0x34')](_0x29f812[_0x855d('0x38')],function(_0x5a9cc6){var _0x109c99={};_0x109c99[_0x5a9cc6]={'$like':'%'+_0x119c83[_0x855d('0x35')][_0x855d('0x3f')]+'%'};return _0x109c99;})});}_0x29f812=_[_0x855d('0x3e')]({},_0x29f812,_0x119c83['options']);return _0x4c640b[_0x855d('0x89')](_0x29f812);}})[_0x855d('0x25')](function(_0x3f81bc){if(_0x3f81bc){_0x53c811=_0x3f81bc[_0x855d('0x3a')];if(!_0x119c83[_0x855d('0x35')]['hasOwnProperty']('nolimit')){_0x29f812['limit']=qs[_0x855d('0x1f')](_0x119c83[_0x855d('0x35')][_0x855d('0x1f')]);_0x29f812[_0x855d('0x1d')]=qs['offset'](_0x119c83[_0x855d('0x35')]['offset']);}return _0x4c640b[_0x855d('0x89')](_0x29f812);}})[_0x855d('0x25')](function(_0x2a0ba9){if(_0x2a0ba9){return _0x2a0ba9?{'count':_0x53c811,'rows':_0x2a0ba9}:null;}})[_0x855d('0x25')](respondWithResult(_0x3f3848,null))[_0x855d('0x44')](handleError(_0x3f3848,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index bd57bc4..6cf650b 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 _0xc695=['emit','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc695,0x163));var _0x5c69=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0xc695[_0x4207a6];return _0x42b37a;};'use strict';var EventEmitter=require(_0x5c69('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x5c69('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5c69('0x2')](0x0);var events={'afterCreate':_0x5c69('0x3'),'afterUpdate':_0x5c69('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a1d3f){return function(_0x3daea9,_0x12f3bd,_0x5040cc){OpenchannelQueueEvents[_0x5c69('0x5')](_0x3a1d3f+':'+_0x3daea9['id'],_0x3daea9);OpenchannelQueueEvents['emit'](_0x3a1d3f,_0x3daea9);_0x5040cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x5c69('0x6')](e,emitEvent(event));}}module[_0x5c69('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7f31=['emit','hasOwnProperty','hook','events','OpenchannelQueue','setMaxListeners','save'];(function(_0x140b83,_0x44a67d){var _0x13e810=function(_0x43300e){while(--_0x43300e){_0x140b83['push'](_0x140b83['shift']());}};_0x13e810(++_0x44a67d);}(_0x7f31,0x137));var _0x17f3=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x7f31[_0x29c3b2];return _0x4b3aa7;};'use strict';var EventEmitter=require(_0x17f3('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x17f3('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x17f3('0x2')](0x0);var events={'afterCreate':_0x17f3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3faccf){return function(_0x2195f4,_0x19fdf6,_0x1409f2){OpenchannelQueueEvents['emit'](_0x3faccf+':'+_0x2195f4['id'],_0x2195f4);OpenchannelQueueEvents[_0x17f3('0x4')](_0x3faccf,_0x2195f4);_0x1409f2(null);};}for(var e in events){if(events[_0x17f3('0x5')](e)){var event=events[e];OpenchannelQueue[_0x17f3('0x6')](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 ed966e1..68a4ce6 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 _0xdcff=['./openchannelQueue.attributes','define','lodash','util','moment','bluebird','../../config/environment'];(function(_0x5c49f4,_0x2fa313){var _0x293c9d=function(_0x475b4e){while(--_0x475b4e){_0x5c49f4['push'](_0x5c49f4['shift']());}};_0x293c9d(++_0x2fa313);}(_0xdcff,0x175));var _0xfdcf=function(_0x4e3739,_0x11251d){_0x4e3739=_0x4e3739-0x0;var _0x39ebc4=_0xdcff[_0x4e3739];return _0x39ebc4;};'use strict';var _=require(_0xfdcf('0x0'));var util=require(_0xfdcf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfdcf('0x2'));var BPromise=require(_0xfdcf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfdcf('0x4'));var attributes=require(_0xfdcf('0x5'));module['exports']=function(_0x187755,_0x467ed7){return _0x187755[_0xfdcf('0x6')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdbd=['./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1c08f6,_0x14c077){var _0xbc156a=function(_0x59df22){while(--_0x59df22){_0x1c08f6['push'](_0x1c08f6['shift']());}};_0xbc156a(++_0x14c077);}(_0xcdbd,0x1dc));var _0xdcdb=function(_0x36eb75,_0x193258){_0x36eb75=_0x36eb75-0x0;var _0x539941=_0xcdbd[_0x36eb75];return _0x539941;};'use strict';var _=require('lodash');var util=require(_0xdcdb('0x0'));var logger=require(_0xdcdb('0x1'))(_0xdcdb('0x2'));var moment=require(_0xdcdb('0x3'));var BPromise=require(_0xdcdb('0x4'));var rp=require(_0xdcdb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcdb('0x6'));var config=require(_0xdcdb('0x7'));var attributes=require(_0xdcdb('0x8'));module['exports']=function(_0x14290f,_0x39409d){return _0x14290f['define'](_0xdcdb('0x9'),attributes,{'tableName':_0xdcdb('0xa'),'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 57f0216..3214094 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 _0x828f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','debug','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','ioredis'];(function(_0x37b31d,_0x44e47b){var _0x52773c=function(_0x35d0b2){while(--_0x35d0b2){_0x37b31d['push'](_0x37b31d['shift']());}};_0x52773c(++_0x44e47b);}(_0x828f,0x14b));var _0xf828=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x828f[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xf828('0x0'));var util=require(_0xf828('0x1'));var moment=require(_0xf828('0x2'));var BPromise=require('bluebird');var rs=require(_0xf828('0x3'));var fs=require('fs');var Redis=require(_0xf828('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf828('0x5'));var logger=require(_0xf828('0x6'))(_0xf828('0x7'));var config=require(_0xf828('0x8'));var jayson=require(_0xf828('0x9'));var client=jayson[_0xf828('0xa')][_0xf828('0xb')]({'port':0x232a});config[_0xf828('0xc')]=_[_0xf828('0xd')](config[_0xf828('0xc')],{'host':_0xf828('0xe'),'port':0x18eb});var socket=require(_0xf828('0xf'))(new Redis(config['redis']));require(_0xf828('0x10'))[_0xf828('0x11')](socket);function respondWithRpcPromise(_0x2d1b56,_0x21c7a9,_0x4ebd4c){return new BPromise(function(_0x419884,_0x5f3357){return client[_0xf828('0x12')](_0x2d1b56,_0x4ebd4c)[_0xf828('0x13')](function(_0x1438bb){logger[_0xf828('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x21c7a9,_0xf828('0x15'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x21c7a9,_0xf828('0x15'),JSON[_0xf828('0x16')](_0x1438bb));if(_0x1438bb[_0xf828('0x17')]){if(_0x1438bb[_0xf828('0x17')][_0xf828('0x18')]===0x1f4){logger[_0xf828('0x17')](_0xf828('0x19'),_0x21c7a9,_0x1438bb['error']['message']);return _0x5f3357(_0x1438bb[_0xf828('0x17')]['message']);}logger[_0xf828('0x17')](_0xf828('0x19'),_0x21c7a9,_0x1438bb['error'][_0xf828('0x1a')]);return _0x419884(_0x1438bb['error']['message']);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x21c7a9,_0xf828('0x15'));_0x419884(_0x1438bb[_0xf828('0x1b')]['message']);}})[_0xf828('0x1c')](function(_0x2ca2a3){logger['error'](_0xf828('0x19'),_0x21c7a9,_0x2ca2a3);_0x5f3357(_0x2ca2a3);});});}exports['GetOpenchannelQueue']=function(_0x32ef90){var _0x1952b9=this;return new Promise(function(_0x767a06,_0x5d30e5){return db[_0xf828('0x1d')]['findAll']({'raw':_0x32ef90['options']?_0x32ef90[_0xf828('0x1e')][_0xf828('0x1f')]===undefined?!![]:![]:!![],'where':_0x32ef90[_0xf828('0x1e')]?_0x32ef90[_0xf828('0x1e')][_0xf828('0x20')]||null:null,'attributes':_0x32ef90[_0xf828('0x1e')]?_0x32ef90[_0xf828('0x1e')][_0xf828('0x21')]||null:null,'limit':_0x32ef90[_0xf828('0x1e')]?_0x32ef90[_0xf828('0x1e')][_0xf828('0x22')]||null:null,'include':_0x32ef90['options']?_0x32ef90[_0xf828('0x1e')][_0xf828('0x23')]?_[_0xf828('0x24')](_0x32ef90[_0xf828('0x1e')][_0xf828('0x23')],function(_0x1b1cd9){return{'model':db[_0x1b1cd9[_0xf828('0x25')]],'as':_0x1b1cd9['as'],'attributes':_0x1b1cd9[_0xf828('0x21')],'include':_0x1b1cd9[_0xf828('0x23')]?_[_0xf828('0x24')](_0x1b1cd9['include'],function(_0x1c849c){return{'model':db[_0x1c849c[_0xf828('0x25')]],'as':_0x1c849c['as'],'attributes':_0x1c849c[_0xf828('0x21')],'include':_0x1c849c[_0xf828('0x23')]?_['map'](_0x1c849c[_0xf828('0x23')],function(_0x33177c){return{'model':db[_0x33177c[_0xf828('0x25')]],'as':_0x33177c['as'],'attributes':_0x33177c[_0xf828('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e7e00){logger[_0xf828('0x14')](_0xf828('0x26'),_0x32ef90);logger[_0xf828('0x27')](_0xf828('0x26'),_0x32ef90,JSON[_0xf828('0x16')](_0x2e7e00));_0x767a06(_0x2e7e00);})[_0xf828('0x1c')](function(_0x2b443a){logger[_0xf828('0x17')]('GetOpenchannelQueue',_0x2b443a['message'],_0x32ef90);_0x5d30e5(_0x1952b9[_0xf828('0x17')](0x1f4,_0x2b443a[_0xf828('0x1a')]));});});};exports[_0xf828('0x28')]=function(_0x149d06){var _0x47d589=this;return new Promise(function(_0x520129,_0x31cc08){return db[_0xf828('0x1d')][_0xf828('0x29')]({'raw':_0x149d06[_0xf828('0x1e')]?_0x149d06[_0xf828('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x149d06[_0xf828('0x1e')]?_0x149d06[_0xf828('0x1e')][_0xf828('0x20')]||null:null,'attributes':_0x149d06[_0xf828('0x1e')]?_0x149d06['options'][_0xf828('0x21')]||null:null,'include':_0x149d06[_0xf828('0x1e')]?_0x149d06[_0xf828('0x1e')][_0xf828('0x23')]?_[_0xf828('0x24')](_0x149d06[_0xf828('0x1e')][_0xf828('0x23')],function(_0x59c47d){return{'model':db[_0x59c47d[_0xf828('0x25')]],'as':_0x59c47d['as'],'attributes':_0x59c47d['attributes'],'include':_0x59c47d[_0xf828('0x23')]?_[_0xf828('0x24')](_0x59c47d[_0xf828('0x23')],function(_0x36fa2e){return{'model':db[_0x36fa2e[_0xf828('0x25')]],'as':_0x36fa2e['as'],'attributes':_0x36fa2e[_0xf828('0x21')],'include':_0x36fa2e[_0xf828('0x23')]?_[_0xf828('0x24')](_0x36fa2e[_0xf828('0x23')],function(_0x3504c7){return{'model':db[_0x3504c7[_0xf828('0x25')]],'as':_0x3504c7['as'],'attributes':_0x3504c7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf828('0x13')](function(_0x35f49f){logger[_0xf828('0x14')]('ShowOpenchannelQueue',_0x149d06);logger[_0xf828('0x27')](_0xf828('0x28'),_0x149d06,JSON[_0xf828('0x16')](_0x35f49f));_0x520129(_0x35f49f);})[_0xf828('0x1c')](function(_0x427621){logger[_0xf828('0x17')](_0xf828('0x28'),_0x427621[_0xf828('0x1a')],_0x149d06);_0x31cc08(_0x47d589[_0xf828('0x17')](0x1f4,_0x427621[_0xf828('0x1a')]));});});}; \ No newline at end of file +var _0xc8bf=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','where','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4c25cb,_0xce5c6c){var _0x5a61f2=function(_0x5ad642){while(--_0x5ad642){_0x4c25cb['push'](_0x4c25cb['shift']());}};_0x5a61f2(++_0xce5c6c);}(_0xc8bf,0x1e7));var _0xfc8b=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xc8bf[_0x251e8c];return _0x1e0c1d;};'use strict';var _=require(_0xfc8b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfc8b('0x1'));var rs=require(_0xfc8b('0x2'));var fs=require('fs');var Redis=require(_0xfc8b('0x3'));var db=require(_0xfc8b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc8b('0x5'))(_0xfc8b('0x6'));var config=require(_0xfc8b('0x7'));var jayson=require(_0xfc8b('0x8'));var client=jayson[_0xfc8b('0x9')][_0xfc8b('0xa')]({'port':0x232a});config[_0xfc8b('0xb')]=_['defaults'](config[_0xfc8b('0xb')],{'host':_0xfc8b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc8b('0xb')]));require(_0xfc8b('0xd'))[_0xfc8b('0xe')](socket);function respondWithRpcPromise(_0x1e5ceb,_0x2c42a6,_0xde9a44){return new BPromise(function(_0x235c37,_0x528719){return client[_0xfc8b('0xf')](_0x1e5ceb,_0xde9a44)[_0xfc8b('0x10')](function(_0x339e8c){logger[_0xfc8b('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x2c42a6,_0xfc8b('0x12'));logger[_0xfc8b('0x13')](_0xfc8b('0x14'),_0x2c42a6,'request\x20sent',JSON[_0xfc8b('0x15')](_0x339e8c));if(_0x339e8c[_0xfc8b('0x16')]){if(_0x339e8c[_0xfc8b('0x16')][_0xfc8b('0x17')]===0x1f4){logger[_0xfc8b('0x16')](_0xfc8b('0x18'),_0x2c42a6,_0x339e8c[_0xfc8b('0x16')][_0xfc8b('0x19')]);return _0x528719(_0x339e8c[_0xfc8b('0x16')][_0xfc8b('0x19')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2c42a6,_0x339e8c[_0xfc8b('0x16')]['message']);return _0x235c37(_0x339e8c[_0xfc8b('0x16')][_0xfc8b('0x19')]);}else{logger[_0xfc8b('0x11')](_0xfc8b('0x18'),_0x2c42a6,_0xfc8b('0x12'));_0x235c37(_0x339e8c[_0xfc8b('0x1a')]['message']);}})[_0xfc8b('0x1b')](function(_0x28c1a1){logger[_0xfc8b('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x2c42a6,_0x28c1a1);_0x528719(_0x28c1a1);});});}exports[_0xfc8b('0x1c')]=function(_0x11f1dc){var _0x34f298=this;return new Promise(function(_0x5ec79c,_0x4358e8){return db[_0xfc8b('0x1d')][_0xfc8b('0x1e')]({'raw':_0x11f1dc['options']?_0x11f1dc[_0xfc8b('0x1f')][_0xfc8b('0x20')]===undefined?!![]:![]:!![],'where':_0x11f1dc[_0xfc8b('0x1f')]?_0x11f1dc['options']['where']||null:null,'attributes':_0x11f1dc[_0xfc8b('0x1f')]?_0x11f1dc['options'][_0xfc8b('0x21')]||null:null,'limit':_0x11f1dc[_0xfc8b('0x1f')]?_0x11f1dc['options'][_0xfc8b('0x22')]||null:null,'include':_0x11f1dc[_0xfc8b('0x1f')]?_0x11f1dc['options'][_0xfc8b('0x23')]?_[_0xfc8b('0x24')](_0x11f1dc[_0xfc8b('0x1f')]['include'],function(_0x13e194){return{'model':db[_0x13e194[_0xfc8b('0x25')]],'as':_0x13e194['as'],'attributes':_0x13e194[_0xfc8b('0x21')],'include':_0x13e194[_0xfc8b('0x23')]?_[_0xfc8b('0x24')](_0x13e194[_0xfc8b('0x23')],function(_0x2926f6){return{'model':db[_0x2926f6[_0xfc8b('0x25')]],'as':_0x2926f6['as'],'attributes':_0x2926f6[_0xfc8b('0x21')],'include':_0x2926f6['include']?_['map'](_0x2926f6['include'],function(_0x16eab0){return{'model':db[_0x16eab0['model']],'as':_0x16eab0['as'],'attributes':_0x16eab0['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc8b('0x10')](function(_0x5c9cfa){logger[_0xfc8b('0x11')](_0xfc8b('0x1c'),_0x11f1dc);logger[_0xfc8b('0x13')]('GetOpenchannelQueue',_0x11f1dc,JSON[_0xfc8b('0x15')](_0x5c9cfa));_0x5ec79c(_0x5c9cfa);})[_0xfc8b('0x1b')](function(_0x447dcb){logger[_0xfc8b('0x16')]('GetOpenchannelQueue',_0x447dcb[_0xfc8b('0x19')],_0x11f1dc);_0x4358e8(_0x34f298[_0xfc8b('0x16')](0x1f4,_0x447dcb['message']));});});};exports[_0xfc8b('0x26')]=function(_0x25207c){var _0xad14d6=this;return new Promise(function(_0x1de625,_0x5acdda){return db[_0xfc8b('0x1d')][_0xfc8b('0x27')]({'raw':_0x25207c['options']?_0x25207c['options'][_0xfc8b('0x20')]===undefined?!![]:![]:!![],'where':_0x25207c[_0xfc8b('0x1f')]?_0x25207c['options'][_0xfc8b('0x28')]||null:null,'attributes':_0x25207c[_0xfc8b('0x1f')]?_0x25207c[_0xfc8b('0x1f')]['attributes']||null:null,'include':_0x25207c[_0xfc8b('0x1f')]?_0x25207c[_0xfc8b('0x1f')][_0xfc8b('0x23')]?_['map'](_0x25207c[_0xfc8b('0x1f')][_0xfc8b('0x23')],function(_0x1e7d33){return{'model':db[_0x1e7d33[_0xfc8b('0x25')]],'as':_0x1e7d33['as'],'attributes':_0x1e7d33['attributes'],'include':_0x1e7d33[_0xfc8b('0x23')]?_[_0xfc8b('0x24')](_0x1e7d33[_0xfc8b('0x23')],function(_0x5723cf){return{'model':db[_0x5723cf[_0xfc8b('0x25')]],'as':_0x5723cf['as'],'attributes':_0x5723cf[_0xfc8b('0x21')],'include':_0x5723cf['include']?_[_0xfc8b('0x24')](_0x5723cf['include'],function(_0x99ee04){return{'model':db[_0x99ee04['model']],'as':_0x99ee04['as'],'attributes':_0x99ee04[_0xfc8b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfc8b('0x10')](function(_0x194786){logger['info'](_0xfc8b('0x26'),_0x25207c);logger[_0xfc8b('0x13')](_0xfc8b('0x26'),_0x25207c,JSON[_0xfc8b('0x15')](_0x194786));_0x1de625(_0x194786);})[_0xfc8b('0x1b')](function(_0x15640a){logger[_0xfc8b('0x16')](_0xfc8b('0x26'),_0x15640a[_0xfc8b('0x19')],_0x25207c);_0x5acdda(_0xad14d6[_0xfc8b('0x16')](0x1f4,_0x15640a[_0xfc8b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e9e6470..01369ce 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 _0xdaa3=['removeListener','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x540208,_0x3f038a){var _0x2bc062=function(_0x45a13f){while(--_0x45a13f){_0x540208['push'](_0x540208['shift']());}};_0x2bc062(++_0x3f038a);}(_0xdaa3,0x1d0));var _0x3daa=function(_0x318c48,_0x346c5c){_0x318c48=_0x318c48-0x0;var _0x379c48=_0xdaa3[_0x318c48];return _0x379c48;};'use strict';var OpenchannelQueueEvents=require(_0x3daa('0x0'));var events=[_0x3daa('0x1'),_0x3daa('0x2'),_0x3daa('0x3')];function createListener(_0xa0d205,_0x2e8708){return function(_0x4abce5){_0x2e8708[_0x3daa('0x4')](_0xa0d205,_0x4abce5);};}function removeListener(_0x3797f7,_0x260d5e){return function(){OpenchannelQueueEvents[_0x3daa('0x5')](_0x3797f7,_0x260d5e);};}exports['register']=function(_0x153fef){for(var _0x2ba265=0x0,_0x14363d=events['length'];_0x2ba265<_0x14363d;_0x2ba265++){var _0x53a118=events[_0x2ba265];var _0x263539=createListener(_0x3daa('0x6')+_0x53a118,_0x153fef);OpenchannelQueueEvents['on'](_0x53a118,_0x263539);}}; \ No newline at end of file +var _0x29c9=['save','update','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x2d90c0,_0x23c675){var _0x252a97=function(_0x20f5ac){while(--_0x20f5ac){_0x2d90c0['push'](_0x2d90c0['shift']());}};_0x252a97(++_0x23c675);}(_0x29c9,0x16b));var _0x929c=function(_0x2b2e72,_0x2b6451){_0x2b2e72=_0x2b2e72-0x0;var _0x216ea6=_0x29c9[_0x2b2e72];return _0x216ea6;};'use strict';var OpenchannelQueueEvents=require(_0x929c('0x0'));var events=[_0x929c('0x1'),'remove',_0x929c('0x2')];function createListener(_0x259f93,_0x55280e){return function(_0x396aac){_0x55280e['emit'](_0x259f93,_0x396aac);};}function removeListener(_0x215081,_0x33e25b){return function(){OpenchannelQueueEvents[_0x929c('0x3')](_0x215081,_0x33e25b);};}exports[_0x929c('0x4')]=function(_0xa30d43){for(var _0x49090a=0x0,_0x23fd8e=events[_0x929c('0x5')];_0x49090a<_0x23fd8e;_0x49090a++){var _0x137e94=events[_0x49090a];var _0x3c2dc1=createListener(_0x929c('0x6')+_0x137e94,_0xa30d43);OpenchannelQueueEvents['on'](_0x137e94,_0x3c2dc1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 5a47c66..5e719ba 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 _0xc7ae=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','multer','util','express'];(function(_0x307541,_0x5c4aa8){var _0x7a409c=function(_0x7c21a2){while(--_0x7c21a2){_0x307541['push'](_0x307541['shift']());}};_0x7a409c(++_0x5c4aa8);}(_0xc7ae,0x95));var _0xec7a=function(_0x72ae2d,_0x368d70){_0x72ae2d=_0x72ae2d-0x0;var _0x1a353c=_0xc7ae[_0x72ae2d];return _0x1a353c;};'use strict';var multer=require(_0xec7a('0x0'));var util=require(_0xec7a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xec7a('0x2'));var router=express[_0xec7a('0x3')]();var fs_extra=require(_0xec7a('0x4'));var auth=require(_0xec7a('0x5'));var interaction=require(_0xec7a('0x6'));var config=require('../../config/environment');var controller=require(_0xec7a('0x7'));router[_0xec7a('0x8')]('/',auth[_0xec7a('0x9')](),controller[_0xec7a('0xa')]);router[_0xec7a('0x8')](_0xec7a('0xb'),auth['isAuthenticated'](),controller[_0xec7a('0xc')]);router[_0xec7a('0x8')](_0xec7a('0xd'),auth['isAuthenticated'](),controller[_0xec7a('0xe')]);router['post']('/',auth[_0xec7a('0x9')](),controller[_0xec7a('0xf')]);router['put'](_0xec7a('0xd'),auth[_0xec7a('0x9')](),controller[_0xec7a('0x10')]);router[_0xec7a('0x11')](_0xec7a('0xd'),auth[_0xec7a('0x9')](),controller[_0xec7a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb4cb=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x2919a0,_0x34a1e){var _0x2185da=function(_0x4c6c98){while(--_0x4c6c98){_0x2919a0['push'](_0x2919a0['shift']());}};_0x2185da(++_0x34a1e);}(_0xb4cb,0xb2));var _0xbb4c=function(_0x2067de,_0x57078e){_0x2067de=_0x2067de-0x0;var _0x1a6eb9=_0xb4cb[_0x2067de];return _0x1a6eb9;};'use strict';var multer=require(_0xbb4c('0x0'));var util=require(_0xbb4c('0x1'));var path=require(_0xbb4c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb4c('0x3')]();var fs_extra=require(_0xbb4c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb4c('0x5'));var config=require(_0xbb4c('0x6'));var controller=require(_0xbb4c('0x7'));router[_0xbb4c('0x8')]('/',auth[_0xbb4c('0x9')](),controller['index']);router[_0xbb4c('0x8')]('/describe',auth[_0xbb4c('0x9')](),controller[_0xbb4c('0xa')]);router[_0xbb4c('0x8')](_0xbb4c('0xb'),auth[_0xbb4c('0x9')](),controller[_0xbb4c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb4c('0xd')]);router[_0xbb4c('0xe')](_0xbb4c('0xb'),auth['isAuthenticated'](),controller[_0xbb4c('0xf')]);router[_0xbb4c('0x10')](_0xbb4c('0xb'),auth[_0xbb4c('0x9')](),controller[_0xbb4c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index d9f6f48..5aa8666 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 _0x3c9a=['DATE','moment','sequelize','exports','STRING'];(function(_0x563e34,_0x454c62){var _0x93907f=function(_0x15dcbc){while(--_0x15dcbc){_0x563e34['push'](_0x563e34['shift']());}};_0x93907f(++_0x454c62);}(_0x3c9a,0x13c));var _0xa3c9=function(_0x7e2729,_0x3fc557){_0x7e2729=_0x7e2729-0x0;var _0x578cb4=_0x3c9a[_0x7e2729];return _0x578cb4;};'use strict';var moment=require(_0xa3c9('0x0'));var Sequelize=require(_0xa3c9('0x1'));module[_0xa3c9('0x2')]={'uniqueid':{'type':Sequelize[_0xa3c9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa3c9('0x3')]},'joinAt':{'type':Sequelize[_0xa3c9('0x4')]},'leaveAt':{'type':Sequelize[_0xa3c9('0x4')]},'acceptAt':{'type':Sequelize[_0xa3c9('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa3c9('0x3')]}}; \ No newline at end of file +var _0xbb1c=['sequelize','exports','STRING','DATE','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbb1c,0x199));var _0xcbb1=function(_0x3cae92,_0x1f0697){_0x3cae92=_0x3cae92-0x0;var _0x5ef742=_0xbb1c[_0x3cae92];return _0x5ef742;};'use strict';var moment=require(_0xcbb1('0x0'));var Sequelize=require(_0xcbb1('0x1'));module[_0xcbb1('0x2')]={'uniqueid':{'type':Sequelize[_0xcbb1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcbb1('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcbb1('0x4')]},'acceptAt':{'type':Sequelize[_0xcbb1('0x4')]},'exitAt':{'type':Sequelize[_0xcbb1('0x4')]},'reason':{'type':Sequelize[_0xcbb1('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 7641614..78e9888 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 _0x559e=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','fields','includeAll','create','body','catch','find','params','describe','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3c49fa,_0x3307f5){var _0x3f48d9=function(_0x89d632){while(--_0x89d632){_0x3c49fa['push'](_0x3c49fa['shift']());}};_0x3f48d9(++_0x3307f5);}(_0x559e,0x82));var _0xe559=function(_0x1d4310,_0x262fd3){_0x1d4310=_0x1d4310-0x0;var _0x49c606=_0x559e[_0x1d4310];return _0x49c606;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe559('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe559('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xe559('0x2'));var util=require(_0xe559('0x3'));var path=require(_0xe559('0x4'));var sox=require(_0xe559('0x5'));var csv=require(_0xe559('0x6'));var ejs=require(_0xe559('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe559('0x8'));var squel=require(_0xe559('0x9'));var crypto=require(_0xe559('0xa'));var jsforce=require(_0xe559('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe559('0xc'));var authService=require(_0xe559('0xd'));var qs=require(_0xe559('0xe'));var as=require(_0xe559('0xf'));var hardwareService=require(_0xe559('0x10'));var logger=require(_0xe559('0x11'))(_0xe559('0x12'));var utils=require(_0xe559('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe559('0x14'));var db=require(_0xe559('0x15'))['db'];function respondWithStatusCode(_0x2682a8,_0xe2ed60){_0xe2ed60=_0xe2ed60||0xcc;return function(_0x25808e){if(_0x25808e){return _0x2682a8[_0xe559('0x16')](_0xe2ed60);}return _0x2682a8[_0xe559('0x17')](_0xe2ed60)[_0xe559('0x18')]();};}function respondWithResult(_0x5d7ee5,_0x1d49b0){_0x1d49b0=_0x1d49b0||0xc8;return function(_0x3ce49b){if(_0x3ce49b){return _0x5d7ee5[_0xe559('0x17')](_0x1d49b0)['json'](_0x3ce49b);}};}function respondWithFilteredResult(_0x50f550,_0x4cbf7d){return function(_0x393526){if(_0x393526){var _0x1764ee=typeof _0x4cbf7d['offset']==='undefined'&&typeof _0x4cbf7d[_0xe559('0x19')]==='undefined';var _0x231198=_0x393526[_0xe559('0x1a')];var _0x3f37cf=_0x1764ee?0x0:_0x4cbf7d[_0xe559('0x1b')];var _0x5aef32=_0x1764ee?_0x393526[_0xe559('0x1a')]:_0x4cbf7d[_0xe559('0x1b')]+_0x4cbf7d[_0xe559('0x19')];var _0xa0ac94;if(_0x5aef32>=_0x231198){_0x5aef32=_0x231198;_0xa0ac94=0xc8;}else{_0xa0ac94=0xce;}_0x50f550[_0xe559('0x17')](_0xa0ac94);return _0x50f550['set']('Content-Range',_0x3f37cf+'-'+_0x5aef32+'/'+_0x231198)[_0xe559('0x1c')](_0x393526);}return null;};}function patchUpdates(_0x4bac09){return function(_0x240812){try{jsonpatch[_0xe559('0x1d')](_0x240812,_0x4bac09,!![]);}catch(_0x387381){return BPromise[_0xe559('0x1e')](_0x387381);}return _0x240812[_0xe559('0x1f')]();};}function saveUpdates(_0x4b0a76,_0x193e87){return function(_0x5e9e71){if(_0x5e9e71){return _0x5e9e71[_0xe559('0x20')](_0x4b0a76)[_0xe559('0x21')](function(_0x745cfc){return _0x745cfc;});}return null;};}function removeEntity(_0x3417d4,_0x56e843){return function(_0x4c650e){if(_0x4c650e){return _0x4c650e[_0xe559('0x22')]()[_0xe559('0x21')](function(){_0x3417d4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb663f6,_0x18ff81){return function(_0x2420bb){if(!_0x2420bb){_0xb663f6['sendStatus'](0x194);}return _0x2420bb;};}function handleError(_0x2234ce,_0x3db549){_0x3db549=_0x3db549||0x1f4;return function(_0x1825d2){logger[_0xe559('0x23')](_0x1825d2[_0xe559('0x24')]);if(_0x1825d2[_0xe559('0x25')]){delete _0x1825d2['name'];}_0x2234ce[_0xe559('0x17')](_0x3db549)[_0xe559('0x26')](_0x1825d2);};}exports['index']=function(_0x3accdd,_0x3938b7){var _0xd25e25={},_0x262af7={},_0xe5232a={'count':0x0,'rows':[]};var _0x3bb7f6=_[_0xe559('0x27')](db[_0xe559('0x28')][_0xe559('0x29')],function(_0x3948e4){return{'name':_0x3948e4[_0xe559('0x2a')],'type':_0x3948e4[_0xe559('0x2b')][_0xe559('0x2c')]};});_0x262af7[_0xe559('0x2d')]=_[_0xe559('0x27')](_0x3bb7f6,_0xe559('0x25'));_0x262af7[_0xe559('0x2e')]=_[_0xe559('0x2f')](_0x3accdd[_0xe559('0x2e')]);_0x262af7['filters']=_[_0xe559('0x30')](_0x262af7[_0xe559('0x2d')],_0x262af7['query']);_0xd25e25[_0xe559('0x31')]=_[_0xe559('0x30')](_0x262af7[_0xe559('0x2d')],qs['fields'](_0x3accdd[_0xe559('0x2e')]['fields']));_0xd25e25[_0xe559('0x31')]=_0xd25e25[_0xe559('0x31')][_0xe559('0x32')]?_0xd25e25['attributes']:_0x262af7['model'];if(!_0x3accdd['query'][_0xe559('0x33')](_0xe559('0x34'))){_0xd25e25[_0xe559('0x19')]=qs['limit'](_0x3accdd[_0xe559('0x2e')][_0xe559('0x19')]);_0xd25e25[_0xe559('0x1b')]=qs[_0xe559('0x1b')](_0x3accdd[_0xe559('0x2e')][_0xe559('0x1b')]);}_0xd25e25[_0xe559('0x35')]=qs[_0xe559('0x36')](_0x3accdd['query'][_0xe559('0x36')]);_0xd25e25[_0xe559('0x37')]=qs[_0xe559('0x38')](_[_0xe559('0x39')](_0x3accdd[_0xe559('0x2e')],_0x262af7[_0xe559('0x38')]),_0x3bb7f6);if(_0x3accdd[_0xe559('0x2e')]['filter']){_0xd25e25['where']=_[_0xe559('0x3a')](_0xd25e25[_0xe559('0x37')],{'$or':_['map'](_0x3bb7f6,function(_0x3cfc2d){if(_0x3cfc2d['type']!==_0xe559('0x3b')){var _0x3d2dd3={};_0x3d2dd3[_0x3cfc2d[_0xe559('0x25')]]={'$like':'%'+_0x3accdd[_0xe559('0x2e')][_0xe559('0x3c')]+'%'};return _0x3d2dd3;}})});}_0xd25e25=_[_0xe559('0x3a')]({},_0xd25e25,_0x3accdd[_0xe559('0x3d')]);var _0x3cd0f0={'where':_0xd25e25['where']};return db[_0xe559('0x28')]['count'](_0x3cd0f0)[_0xe559('0x21')](function(_0x32af7d){_0xe5232a[_0xe559('0x1a')]=_0x32af7d;if(_0x3accdd[_0xe559('0x2e')]['includeAll']){_0xd25e25[_0xe559('0x3e')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xe559('0x3f')](_0xd25e25);})['then'](function(_0x1605c7){_0xe5232a[_0xe559('0x40')]=_0x1605c7;return _0xe5232a;})[_0xe559('0x21')](respondWithFilteredResult(_0x3938b7,_0xd25e25))['catch'](handleError(_0x3938b7,null));};exports[_0xe559('0x41')]=function(_0x191f7a,_0x258c66){var _0x2b7c80={'raw':!![],'where':{'id':_0x191f7a['params']['id']}},_0x42320a={};_0x42320a[_0xe559('0x2d')]=_[_0xe559('0x2f')](db['OpenchannelQueueReport'][_0xe559('0x29')]);_0x42320a[_0xe559('0x2e')]=_[_0xe559('0x2f')](_0x191f7a[_0xe559('0x2e')]);_0x42320a[_0xe559('0x38')]=_['intersection'](_0x42320a[_0xe559('0x2d')],_0x42320a[_0xe559('0x2e')]);_0x2b7c80['attributes']=_[_0xe559('0x30')](_0x42320a[_0xe559('0x2d')],qs[_0xe559('0x42')](_0x191f7a[_0xe559('0x2e')][_0xe559('0x42')]));_0x2b7c80[_0xe559('0x31')]=_0x2b7c80[_0xe559('0x31')][_0xe559('0x32')]?_0x2b7c80[_0xe559('0x31')]:_0x42320a[_0xe559('0x2d')];if(_0x191f7a[_0xe559('0x2e')][_0xe559('0x43')]){_0x2b7c80[_0xe559('0x3e')]=[{'all':!![]}];}_0x2b7c80=_['merge']({},_0x2b7c80,_0x191f7a[_0xe559('0x3d')]);return db[_0xe559('0x28')]['find'](_0x2b7c80)['then'](handleEntityNotFound(_0x258c66,null))[_0xe559('0x21')](respondWithResult(_0x258c66,null))['catch'](handleError(_0x258c66,null));};exports[_0xe559('0x44')]=function(_0x4deab2,_0x2b66f3){return db['OpenchannelQueueReport'][_0xe559('0x44')](_0x4deab2[_0xe559('0x45')],{})[_0xe559('0x21')](respondWithResult(_0x2b66f3,0xc9))[_0xe559('0x46')](handleError(_0x2b66f3,null));};exports['update']=function(_0x505577,_0x423c65){if(_0x505577[_0xe559('0x45')]['id']){delete _0x505577[_0xe559('0x45')]['id'];}return db[_0xe559('0x28')][_0xe559('0x47')]({'where':{'id':_0x505577[_0xe559('0x48')]['id']}})['then'](handleEntityNotFound(_0x423c65,null))[_0xe559('0x21')](saveUpdates(_0x505577['body'],null))[_0xe559('0x21')](respondWithResult(_0x423c65,null))['catch'](handleError(_0x423c65,null));};exports[_0xe559('0x22')]=function(_0x2255c7,_0x2f0c87){return db[_0xe559('0x28')][_0xe559('0x47')]({'where':{'id':_0x2255c7['params']['id']}})[_0xe559('0x21')](handleEntityNotFound(_0x2f0c87,null))['then'](removeEntity(_0x2f0c87,null))[_0xe559('0x46')](handleError(_0x2f0c87,null));};exports[_0xe559('0x49')]=function(_0x37d70e,_0x156b63){return db['OpenchannelQueueReport'][_0xe559('0x49')]()['then'](respondWithResult(_0x156b63,null))['catch'](handleError(_0x156b63,null));}; \ No newline at end of file +var _0xc965=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','error','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','params','find','catch','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x4ae024,_0x2e3bfc){var _0x1b0f81=function(_0x52417d){while(--_0x52417d){_0x4ae024['push'](_0x4ae024['shift']());}};_0x1b0f81(++_0x2e3bfc);}(_0xc965,0x1a8));var _0x5c96=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xc965[_0x12d812];return _0x3711ab;};'use strict';var emlformat=require(_0x5c96('0x0'));var rimraf=require(_0x5c96('0x1'));var zipdir=require(_0x5c96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c96('0x3'));var moment=require('moment');var BPromise=require(_0x5c96('0x4'));var Mustache=require(_0x5c96('0x5'));var util=require('util');var path=require(_0x5c96('0x6'));var sox=require(_0x5c96('0x7'));var csv=require(_0x5c96('0x8'));var ejs=require(_0x5c96('0x9'));var fs=require('fs');var fs_extra=require(_0x5c96('0xa'));var _=require(_0x5c96('0xb'));var squel=require('squel');var crypto=require(_0x5c96('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5c96('0xd'));var toCsv=require(_0x5c96('0x8'));var querystring=require(_0x5c96('0xe'));var Papa=require(_0x5c96('0xf'));var Redis=require(_0x5c96('0x10'));var authService=require(_0x5c96('0x11'));var qs=require(_0x5c96('0x12'));var as=require(_0x5c96('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c96('0x14'));var utils=require(_0x5c96('0x15'));var config=require(_0x5c96('0x16'));var licenseUtil=require(_0x5c96('0x17'));var db=require(_0x5c96('0x18'))['db'];function respondWithStatusCode(_0x560f18,_0x245265){_0x245265=_0x245265||0xcc;return function(_0x284249){if(_0x284249){return _0x560f18[_0x5c96('0x19')](_0x245265);}return _0x560f18[_0x5c96('0x1a')](_0x245265)[_0x5c96('0x1b')]();};}function respondWithResult(_0x3ce95e,_0x3e8fc6){_0x3e8fc6=_0x3e8fc6||0xc8;return function(_0x592a54){if(_0x592a54){return _0x3ce95e[_0x5c96('0x1a')](_0x3e8fc6)[_0x5c96('0x1c')](_0x592a54);}};}function respondWithFilteredResult(_0x3bbbfb,_0x460616){return function(_0x2f0190){if(_0x2f0190){var _0x352838=typeof _0x460616[_0x5c96('0x1d')]===_0x5c96('0x1e')&&typeof _0x460616['limit']==='undefined';var _0x4d3d2d=_0x2f0190[_0x5c96('0x1f')];var _0x530442=_0x352838?0x0:_0x460616[_0x5c96('0x1d')];var _0x1acca1=_0x352838?_0x2f0190[_0x5c96('0x1f')]:_0x460616['offset']+_0x460616['limit'];var _0x99efd9;if(_0x1acca1>=_0x4d3d2d){_0x1acca1=_0x4d3d2d;_0x99efd9=0xc8;}else{_0x99efd9=0xce;}_0x3bbbfb['status'](_0x99efd9);return _0x3bbbfb[_0x5c96('0x20')]('Content-Range',_0x530442+'-'+_0x1acca1+'/'+_0x4d3d2d)['json'](_0x2f0190);}return null;};}function patchUpdates(_0x26333d){return function(_0x8e1934){try{jsonpatch[_0x5c96('0x21')](_0x8e1934,_0x26333d,!![]);}catch(_0x20fc8f){return BPromise[_0x5c96('0x22')](_0x20fc8f);}return _0x8e1934[_0x5c96('0x23')]();};}function saveUpdates(_0x440f29,_0x191e6b){return function(_0x4e0923){if(_0x4e0923){return _0x4e0923[_0x5c96('0x24')](_0x440f29)['then'](function(_0x5c1273){return _0x5c1273;});}return null;};}function removeEntity(_0x1f95d6,_0x1022fb){return function(_0x350d36){if(_0x350d36){return _0x350d36['destroy']()[_0x5c96('0x25')](function(){_0x1f95d6[_0x5c96('0x1a')](0xcc)[_0x5c96('0x1b')]();});}};}function handleEntityNotFound(_0x336a16,_0x1a4497){return function(_0x5f0f8c){if(!_0x5f0f8c){_0x336a16[_0x5c96('0x19')](0x194);}return _0x5f0f8c;};}function handleError(_0x156f13,_0x2231ab){_0x2231ab=_0x2231ab||0x1f4;return function(_0x20f15f){logger[_0x5c96('0x26')](_0x20f15f['stack']);if(_0x20f15f[_0x5c96('0x27')]){delete _0x20f15f[_0x5c96('0x27')];}_0x156f13['status'](_0x2231ab)['send'](_0x20f15f);};}exports['index']=function(_0x571db0,_0x268a49){var _0x6ec78f={},_0x380325={},_0x864dfe={'count':0x0,'rows':[]};var _0x1c05ee=_[_0x5c96('0x28')](db['OpenchannelQueueReport'][_0x5c96('0x29')],function(_0x143da2){return{'name':_0x143da2[_0x5c96('0x2a')],'type':_0x143da2['type'][_0x5c96('0x2b')]};});_0x380325[_0x5c96('0x2c')]=_[_0x5c96('0x28')](_0x1c05ee,_0x5c96('0x27'));_0x380325[_0x5c96('0x2d')]=_[_0x5c96('0x2e')](_0x571db0[_0x5c96('0x2d')]);_0x380325[_0x5c96('0x2f')]=_[_0x5c96('0x30')](_0x380325['model'],_0x380325['query']);_0x6ec78f['attributes']=_['intersection'](_0x380325[_0x5c96('0x2c')],qs[_0x5c96('0x31')](_0x571db0[_0x5c96('0x2d')][_0x5c96('0x31')]));_0x6ec78f[_0x5c96('0x32')]=_0x6ec78f['attributes'][_0x5c96('0x33')]?_0x6ec78f[_0x5c96('0x32')]:_0x380325[_0x5c96('0x2c')];if(!_0x571db0['query'][_0x5c96('0x34')](_0x5c96('0x35'))){_0x6ec78f[_0x5c96('0x36')]=qs[_0x5c96('0x36')](_0x571db0['query']['limit']);_0x6ec78f[_0x5c96('0x1d')]=qs[_0x5c96('0x1d')](_0x571db0[_0x5c96('0x2d')][_0x5c96('0x1d')]);}_0x6ec78f['order']=qs[_0x5c96('0x37')](_0x571db0[_0x5c96('0x2d')][_0x5c96('0x37')]);_0x6ec78f[_0x5c96('0x38')]=qs[_0x5c96('0x2f')](_[_0x5c96('0x39')](_0x571db0[_0x5c96('0x2d')],_0x380325[_0x5c96('0x2f')]),_0x1c05ee);if(_0x571db0[_0x5c96('0x2d')][_0x5c96('0x3a')]){_0x6ec78f['where']=_[_0x5c96('0x3b')](_0x6ec78f[_0x5c96('0x38')],{'$or':_[_0x5c96('0x28')](_0x1c05ee,function(_0x345ce2){if(_0x345ce2['type']!==_0x5c96('0x3c')){var _0x3ee3be={};_0x3ee3be[_0x345ce2['name']]={'$like':'%'+_0x571db0[_0x5c96('0x2d')]['filter']+'%'};return _0x3ee3be;}})});}_0x6ec78f=_[_0x5c96('0x3b')]({},_0x6ec78f,_0x571db0[_0x5c96('0x3d')]);var _0x16158={'where':_0x6ec78f[_0x5c96('0x38')]};return db[_0x5c96('0x3e')][_0x5c96('0x1f')](_0x16158)[_0x5c96('0x25')](function(_0x5b6959){_0x864dfe[_0x5c96('0x1f')]=_0x5b6959;if(_0x571db0[_0x5c96('0x2d')][_0x5c96('0x3f')]){_0x6ec78f[_0x5c96('0x40')]=[{'all':!![]}];}return db[_0x5c96('0x3e')][_0x5c96('0x41')](_0x6ec78f);})['then'](function(_0x4cd7cc){_0x864dfe[_0x5c96('0x42')]=_0x4cd7cc;return _0x864dfe;})[_0x5c96('0x25')](respondWithFilteredResult(_0x268a49,_0x6ec78f))['catch'](handleError(_0x268a49,null));};exports['show']=function(_0x171fb4,_0x1eee19){var _0x1a34a0={'raw':!![],'where':{'id':_0x171fb4[_0x5c96('0x43')]['id']}},_0x3da86a={};_0x3da86a[_0x5c96('0x2c')]=_[_0x5c96('0x2e')](db[_0x5c96('0x3e')][_0x5c96('0x29')]);_0x3da86a['query']=_[_0x5c96('0x2e')](_0x171fb4[_0x5c96('0x2d')]);_0x3da86a[_0x5c96('0x2f')]=_[_0x5c96('0x30')](_0x3da86a[_0x5c96('0x2c')],_0x3da86a[_0x5c96('0x2d')]);_0x1a34a0[_0x5c96('0x32')]=_[_0x5c96('0x30')](_0x3da86a[_0x5c96('0x2c')],qs[_0x5c96('0x31')](_0x171fb4[_0x5c96('0x2d')][_0x5c96('0x31')]));_0x1a34a0[_0x5c96('0x32')]=_0x1a34a0['attributes']['length']?_0x1a34a0[_0x5c96('0x32')]:_0x3da86a[_0x5c96('0x2c')];if(_0x171fb4['query'][_0x5c96('0x3f')]){_0x1a34a0[_0x5c96('0x40')]=[{'all':!![]}];}_0x1a34a0=_[_0x5c96('0x3b')]({},_0x1a34a0,_0x171fb4[_0x5c96('0x3d')]);return db['OpenchannelQueueReport'][_0x5c96('0x44')](_0x1a34a0)[_0x5c96('0x25')](handleEntityNotFound(_0x1eee19,null))[_0x5c96('0x25')](respondWithResult(_0x1eee19,null))[_0x5c96('0x45')](handleError(_0x1eee19,null));};exports['create']=function(_0x2ad437,_0x5402c0){return db[_0x5c96('0x3e')]['create'](_0x2ad437[_0x5c96('0x46')],{})[_0x5c96('0x25')](respondWithResult(_0x5402c0,0xc9))[_0x5c96('0x45')](handleError(_0x5402c0,null));};exports[_0x5c96('0x24')]=function(_0x598f4b,_0x482a2a){if(_0x598f4b[_0x5c96('0x46')]['id']){delete _0x598f4b[_0x5c96('0x46')]['id'];}return db[_0x5c96('0x3e')][_0x5c96('0x44')]({'where':{'id':_0x598f4b[_0x5c96('0x43')]['id']}})[_0x5c96('0x25')](handleEntityNotFound(_0x482a2a,null))[_0x5c96('0x25')](saveUpdates(_0x598f4b[_0x5c96('0x46')],null))[_0x5c96('0x25')](respondWithResult(_0x482a2a,null))[_0x5c96('0x45')](handleError(_0x482a2a,null));};exports[_0x5c96('0x47')]=function(_0x3de5e1,_0x36ee60){return db[_0x5c96('0x3e')][_0x5c96('0x44')]({'where':{'id':_0x3de5e1['params']['id']}})[_0x5c96('0x25')](handleEntityNotFound(_0x36ee60,null))[_0x5c96('0x25')](removeEntity(_0x36ee60,null))['catch'](handleError(_0x36ee60,null));};exports[_0x5c96('0x48')]=function(_0x39a8eb,_0x40038b){return db[_0x5c96('0x3e')][_0x5c96('0x48')]()['then'](respondWithResult(_0x40038b,null))[_0x5c96('0x45')](handleError(_0x40038b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3647394..757f638 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x38642c,_0x45a9b6){var _0x1d7856=function(_0x26b92d){while(--_0x26b92d){_0x38642c['push'](_0x38642c['shift']());}};_0x1d7856(++_0x45a9b6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x5fc3[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0xe14b,0x93));var _0xbe14=function(_0x2d5497,_0x4deab3){_0x2d5497=_0x2d5497-0x0;var _0x34d69e=_0xe14b[_0x2d5497];return _0x34d69e;};'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':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 050ae0d..3e27685 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 _0x7382=['error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x38b673,_0x196974){var _0x19b493=function(_0x266676){while(--_0x266676){_0x38b673['push'](_0x38b673['shift']());}};_0x19b493(++_0x196974);}(_0x7382,0x111));var _0x2738=function(_0xa27585,_0x30ca64){_0xa27585=_0xa27585-0x0;var _0xbedcec=_0x7382[_0xa27585];return _0xbedcec;};'use strict';var _=require('lodash');var util=require(_0x2738('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(_0x2738('0x1'));var logger=require(_0x2738('0x2'))(_0x2738('0x3'));var config=require(_0x2738('0x4'));var jayson=require(_0x2738('0x5'));var client=jayson['client'][_0x2738('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2bc38a,_0xd74b07,_0x523aef){return new BPromise(function(_0x4235e7,_0x487d14){return client[_0x2738('0x7')](_0x2bc38a,_0x523aef)['then'](function(_0x476864){logger[_0x2738('0x8')](_0x2738('0x9'),_0xd74b07,'request\x20sent');logger[_0x2738('0xa')](_0x2738('0xb'),_0xd74b07,_0x2738('0xc'),JSON['stringify'](_0x476864));if(_0x476864['error']){if(_0x476864[_0x2738('0xd')][_0x2738('0xe')]===0x1f4){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')][_0x2738('0xf')]);return _0x487d14(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')]['message']);return _0x4235e7(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}else{logger['info'](_0x2738('0x9'),_0xd74b07,'request\x20sent');_0x4235e7(_0x476864[_0x2738('0x10')]['message']);}})[_0x2738('0x11')](function(_0x568065){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x568065);_0x487d14(_0x568065);});});}exports[_0x2738('0x12')]=function(_0x3c6810){var _0x1d0aca=this;return new Promise(function(_0x1e0f57,_0x42685a){return db[_0x2738('0x13')]['create'](_0x3c6810[_0x2738('0x14')],{'raw':_0x3c6810['options']?_0x3c6810[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5a1d61){logger[_0x2738('0x8')](_0x2738('0x12'),_0x3c6810);logger[_0x2738('0xa')](_0x2738('0x12'),_0x3c6810,JSON[_0x2738('0x17')](_0x5a1d61));_0x1e0f57(_0x5a1d61);})[_0x2738('0x11')](function(_0x18e1d8){logger[_0x2738('0xd')](_0x2738('0x12'),_0x18e1d8[_0x2738('0xf')],_0x3c6810);_0x42685a(_0x1d0aca[_0x2738('0xd')](0x1f4,_0x18e1d8['message']));});});};exports[_0x2738('0x18')]=function(_0x537c5f){var _0x51ee19=this;return new Promise(function(_0x3e3b2d,_0x2d8c5b){return db[_0x2738('0x13')][_0x2738('0x19')](_0x537c5f[_0x2738('0x14')],{'raw':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537c5f['options']?_0x537c5f[_0x2738('0x15')]['where']||null:null,'attributes':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')]['attributes']||null:null,'limit':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')]['limit']||null:null})['then'](function(_0x4fad4c){logger['info'](_0x2738('0x18'),_0x537c5f);logger[_0x2738('0xa')](_0x2738('0x18'),_0x537c5f,JSON[_0x2738('0x17')](_0x4fad4c));_0x3e3b2d(_0x4fad4c);})[_0x2738('0x11')](function(_0x2b317c){logger['error'](_0x2738('0x18'),_0x2b317c[_0x2738('0xf')],_0x537c5f);_0x2d8c5b(_0x51ee19[_0x2738('0xd')](0x1f4,_0x2b317c[_0x2738('0xf')]));});});}; \ No newline at end of file +var _0x065e=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','catch','UpdateOpenchannelQueueReport','update','where','limit','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x065e,0x1a7));var _0xe065=function(_0x17db4b,_0x525a72){_0x17db4b=_0x17db4b-0x0;var _0x37cfb9=_0x065e[_0x17db4b];return _0x37cfb9;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x189d72,_0x52403a,_0x267122){return new BPromise(function(_0x5afbd4,_0x273e22){return client[_0xe065('0x8')](_0x189d72,_0x267122)[_0xe065('0x9')](function(_0x114497){logger[_0xe065('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x52403a,_0xe065('0xb'));logger[_0xe065('0xc')](_0xe065('0xd'),_0x52403a,_0xe065('0xb'),JSON[_0xe065('0xe')](_0x114497));if(_0x114497[_0xe065('0xf')]){if(_0x114497['error']['code']===0x1f4){logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x273e22(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x5afbd4(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}else{logger[_0xe065('0xa')](_0xe065('0x10'),_0x52403a,_0xe065('0xb'));_0x5afbd4(_0x114497[_0xe065('0x12')][_0xe065('0x11')]);}})['catch'](function(_0x1ba88d){logger[_0xe065('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x52403a,_0x1ba88d);_0x273e22(_0x1ba88d);});});}exports[_0xe065('0x13')]=function(_0x1d2f7a){var _0x397f05=this;return new Promise(function(_0x14c97c,_0x1e7177){return db[_0xe065('0x14')][_0xe065('0x15')](_0x1d2f7a['body'],{'raw':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a['options'][_0xe065('0x17')]===undefined?!![]:![]:!![]})[_0xe065('0x9')](function(_0x55f55c){logger[_0xe065('0xa')]('CreateOpenchannelQueueReport',_0x1d2f7a);logger[_0xe065('0xc')](_0xe065('0x13'),_0x1d2f7a,JSON[_0xe065('0xe')](_0x55f55c));_0x14c97c(_0x55f55c);})[_0xe065('0x18')](function(_0x3ecd13){logger[_0xe065('0xf')](_0xe065('0x13'),_0x3ecd13[_0xe065('0x11')],_0x1d2f7a);_0x1e7177(_0x397f05[_0xe065('0xf')](0x1f4,_0x3ecd13['message']));});});};exports[_0xe065('0x19')]=function(_0x43b712){var _0x44ec95=this;return new Promise(function(_0x13f6e5,_0x5e8b60){return db['OpenchannelQueueReport'][_0xe065('0x1a')](_0x43b712['body'],{'raw':_0x43b712[_0xe065('0x16')]?_0x43b712[_0xe065('0x16')][_0xe065('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43b712[_0xe065('0x16')]?_0x43b712[_0xe065('0x16')][_0xe065('0x1b')]||null:null,'attributes':_0x43b712[_0xe065('0x16')]?_0x43b712[_0xe065('0x16')]['attributes']||null:null,'limit':_0x43b712['options']?_0x43b712[_0xe065('0x16')][_0xe065('0x1c')]||null:null})[_0xe065('0x9')](function(_0x441e96){logger['info'](_0xe065('0x19'),_0x43b712);logger['debug']('UpdateOpenchannelQueueReport',_0x43b712,JSON[_0xe065('0xe')](_0x441e96));_0x13f6e5(_0x441e96);})[_0xe065('0x18')](function(_0x2aa766){logger['error'](_0xe065('0x19'),_0x2aa766['message'],_0x43b712);_0x5e8b60(_0x44ec95[_0xe065('0xf')](0x1f4,_0x2aa766[_0xe065('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 29da6cc..e24802f 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 _0x4eaf=['show','create','put','/:id','update','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x4d0190,_0x470828){var _0x3da539=function(_0x456347){while(--_0x456347){_0x4d0190['push'](_0x4d0190['shift']());}};_0x3da539(++_0x470828);}(_0x4eaf,0x96));var _0xf4ea=function(_0x54a6c2,_0x2e0c29){_0x54a6c2=_0x54a6c2-0x0;var _0x513e1c=_0x4eaf[_0x54a6c2];return _0x513e1c;};'use strict';var multer=require(_0xf4ea('0x0'));var util=require(_0xf4ea('0x1'));var path=require('path');var timeout=require(_0xf4ea('0x2'));var express=require(_0xf4ea('0x3'));var router=express['Router']();var fs_extra=require(_0xf4ea('0x4'));var auth=require(_0xf4ea('0x5'));var interaction=require(_0xf4ea('0x6'));var config=require(_0xf4ea('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0xf4ea('0x8')]('/',auth['isAuthenticated'](),controller[_0xf4ea('0x9')]);router[_0xf4ea('0x8')](_0xf4ea('0xa'),auth[_0xf4ea('0xb')](),controller['describe']);router[_0xf4ea('0x8')]('/:id',auth[_0xf4ea('0xb')](),controller[_0xf4ea('0xc')]);router['post']('/',auth[_0xf4ea('0xb')](),controller[_0xf4ea('0xd')]);router[_0xf4ea('0xe')](_0xf4ea('0xf'),auth['isAuthenticated'](),controller[_0xf4ea('0x10')]);router['delete'](_0xf4ea('0xf'),auth[_0xf4ea('0xb')](),controller[_0xf4ea('0x11')]);module['exports']=router; \ No newline at end of file +var _0x27b9=['get','/describe','describe','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelTransferReport.controller','isAuthenticated','index'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x27b9,0x115));var _0x927b=function(_0x5c7158,_0x40146f){_0x5c7158=_0x5c7158-0x0;var _0x526bc4=_0x27b9[_0x5c7158];return _0x526bc4;};'use strict';var multer=require(_0x927b('0x0'));var util=require(_0x927b('0x1'));var path=require(_0x927b('0x2'));var timeout=require(_0x927b('0x3'));var express=require(_0x927b('0x4'));var router=express[_0x927b('0x5')]();var fs_extra=require(_0x927b('0x6'));var auth=require(_0x927b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x927b('0x8'));router['get']('/',auth[_0x927b('0x9')](),controller[_0x927b('0xa')]);router[_0x927b('0xb')](_0x927b('0xc'),auth[_0x927b('0x9')](),controller[_0x927b('0xd')]);router[_0x927b('0xb')](_0x927b('0xe'),auth[_0x927b('0x9')](),controller['show']);router['post']('/',auth[_0x927b('0x9')](),controller['create']);router['put']('/:id',auth[_0x927b('0x9')](),controller[_0x927b('0xf')]);router[_0x927b('0x10')](_0x927b('0xe'),auth[_0x927b('0x9')](),controller[_0x927b('0x11')]);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 ddea579..568d694 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x1fd2b1,_0x4075ae){var _0x183a87=function(_0x466aba){while(--_0x466aba){_0x1fd2b1['push'](_0x1fd2b1['shift']());}};_0x183a87(++_0x4075ae);}(_0xedd9,0xfc));var _0x9edd=function(_0x569de1,_0x2d740a){_0x569de1=_0x569de1-0x0;var _0x2395e8=_0xedd9[_0x569de1];return _0x2395e8;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x206de1,_0x42247b){var _0x5bd6a8=function(_0x1b60d1){while(--_0x1b60d1){_0x206de1['push'](_0x206de1['shift']());}};_0x5bd6a8(++_0x42247b);}(_0x008c,0x188));var _0xc008=function(_0x37d317,_0x46dcc1){_0x37d317=_0x37d317-0x0;var _0x2c757f=_0x008c[_0x37d317];return _0x2c757f;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 774c5d2..647307d 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 _0x0cb8=['describe','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy'];(function(_0x4c40b4,_0x221ce8){var _0x4c0810=function(_0x348623){while(--_0x348623){_0x4c40b4['push'](_0x4c40b4['shift']());}};_0x4c0810(++_0x221ce8);}(_0x0cb8,0x9b));var _0x80cb=function(_0x3aba7e,_0x18b386){_0x3aba7e=_0x3aba7e-0x0;var _0x39ebcc=_0x0cb8[_0x3aba7e];return _0x39ebcc;};'use strict';var emlformat=require(_0x80cb('0x0'));var rimraf=require(_0x80cb('0x1'));var zipdir=require(_0x80cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x80cb('0x3'));var Mustache=require('mustache');var util=require(_0x80cb('0x4'));var path=require(_0x80cb('0x5'));var sox=require(_0x80cb('0x6'));var csv=require(_0x80cb('0x7'));var ejs=require(_0x80cb('0x8'));var fs=require('fs');var fs_extra=require(_0x80cb('0x9'));var _=require(_0x80cb('0xa'));var squel=require('squel');var crypto=require(_0x80cb('0xb'));var jsforce=require(_0x80cb('0xc'));var deskjs=require(_0x80cb('0xd'));var toCsv=require(_0x80cb('0x7'));var querystring=require(_0x80cb('0xe'));var Papa=require('papaparse');var Redis=require(_0x80cb('0xf'));var authService=require(_0x80cb('0x10'));var qs=require(_0x80cb('0x11'));var as=require(_0x80cb('0x12'));var hardwareService=require(_0x80cb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x80cb('0x14'));var config=require(_0x80cb('0x15'));var licenseUtil=require(_0x80cb('0x16'));var db=require(_0x80cb('0x17'))['db'];function respondWithStatusCode(_0x4efee8,_0x320d33){_0x320d33=_0x320d33||0xcc;return function(_0x3be0eb){if(_0x3be0eb){return _0x4efee8[_0x80cb('0x18')](_0x320d33);}return _0x4efee8[_0x80cb('0x19')](_0x320d33)[_0x80cb('0x1a')]();};}function respondWithResult(_0x231123,_0x3aede2){_0x3aede2=_0x3aede2||0xc8;return function(_0x12fde7){if(_0x12fde7){return _0x231123[_0x80cb('0x19')](_0x3aede2)[_0x80cb('0x1b')](_0x12fde7);}};}function respondWithFilteredResult(_0x478c05,_0x5c4811){return function(_0x31805a){if(_0x31805a){var _0x593d61=typeof _0x5c4811[_0x80cb('0x1c')]===_0x80cb('0x1d')&&typeof _0x5c4811[_0x80cb('0x1e')]===_0x80cb('0x1d');var _0x189e0b=_0x31805a[_0x80cb('0x1f')];var _0x448959=_0x593d61?0x0:_0x5c4811[_0x80cb('0x1c')];var _0x49dd50=_0x593d61?_0x31805a[_0x80cb('0x1f')]:_0x5c4811[_0x80cb('0x1c')]+_0x5c4811[_0x80cb('0x1e')];var _0x34688b;if(_0x49dd50>=_0x189e0b){_0x49dd50=_0x189e0b;_0x34688b=0xc8;}else{_0x34688b=0xce;}_0x478c05['status'](_0x34688b);return _0x478c05[_0x80cb('0x20')](_0x80cb('0x21'),_0x448959+'-'+_0x49dd50+'/'+_0x189e0b)[_0x80cb('0x1b')](_0x31805a);}return null;};}function patchUpdates(_0x45b54d){return function(_0x51a4fc){try{jsonpatch[_0x80cb('0x22')](_0x51a4fc,_0x45b54d,!![]);}catch(_0x418b22){return BPromise[_0x80cb('0x23')](_0x418b22);}return _0x51a4fc[_0x80cb('0x24')]();};}function saveUpdates(_0x3927e9,_0x4cac7b){return function(_0x413137){if(_0x413137){return _0x413137[_0x80cb('0x25')](_0x3927e9)[_0x80cb('0x26')](function(_0x556b1d){return _0x556b1d;});}return null;};}function removeEntity(_0x231b8d,_0x3e8f9d){return function(_0x4287c6){if(_0x4287c6){return _0x4287c6['destroy']()[_0x80cb('0x26')](function(){_0x231b8d[_0x80cb('0x19')](0xcc)[_0x80cb('0x1a')]();});}};}function handleEntityNotFound(_0x19db6f,_0x439f2c){return function(_0x28bb88){if(!_0x28bb88){_0x19db6f[_0x80cb('0x18')](0x194);}return _0x28bb88;};}function handleError(_0x1c8925,_0x417c2c){_0x417c2c=_0x417c2c||0x1f4;return function(_0x1af7e1){logger['error'](_0x1af7e1[_0x80cb('0x27')]);if(_0x1af7e1[_0x80cb('0x28')]){delete _0x1af7e1[_0x80cb('0x28')];}_0x1c8925[_0x80cb('0x19')](_0x417c2c)[_0x80cb('0x29')](_0x1af7e1);};}exports[_0x80cb('0x2a')]=function(_0x3f6287,_0x483ab0){var _0x557922={},_0x36a96d={},_0x403f20={'count':0x0,'rows':[]};var _0x598508=_[_0x80cb('0x2b')](db['OpenchannelTransferReport'][_0x80cb('0x2c')],function(_0x398b7f){return{'name':_0x398b7f[_0x80cb('0x2d')],'type':_0x398b7f[_0x80cb('0x2e')][_0x80cb('0x2f')]};});_0x36a96d[_0x80cb('0x30')]=_[_0x80cb('0x2b')](_0x598508,_0x80cb('0x28'));_0x36a96d['query']=_[_0x80cb('0x31')](_0x3f6287['query']);_0x36a96d[_0x80cb('0x32')]=_[_0x80cb('0x33')](_0x36a96d[_0x80cb('0x30')],_0x36a96d[_0x80cb('0x34')]);_0x557922[_0x80cb('0x35')]=_['intersection'](_0x36a96d[_0x80cb('0x30')],qs[_0x80cb('0x36')](_0x3f6287[_0x80cb('0x34')][_0x80cb('0x36')]));_0x557922[_0x80cb('0x35')]=_0x557922[_0x80cb('0x35')][_0x80cb('0x37')]?_0x557922[_0x80cb('0x35')]:_0x36a96d['model'];if(!_0x3f6287[_0x80cb('0x34')][_0x80cb('0x38')](_0x80cb('0x39'))){_0x557922[_0x80cb('0x1e')]=qs[_0x80cb('0x1e')](_0x3f6287['query'][_0x80cb('0x1e')]);_0x557922[_0x80cb('0x1c')]=qs[_0x80cb('0x1c')](_0x3f6287[_0x80cb('0x34')][_0x80cb('0x1c')]);}_0x557922['order']=qs[_0x80cb('0x3a')](_0x3f6287[_0x80cb('0x34')][_0x80cb('0x3a')]);_0x557922[_0x80cb('0x3b')]=qs[_0x80cb('0x32')](_['pick'](_0x3f6287[_0x80cb('0x34')],_0x36a96d[_0x80cb('0x32')]),_0x598508);if(_0x3f6287[_0x80cb('0x34')][_0x80cb('0x3c')]){_0x557922['where']=_['merge'](_0x557922['where'],{'$or':_[_0x80cb('0x2b')](_0x598508,function(_0x1309bd){if(_0x1309bd[_0x80cb('0x2e')]!==_0x80cb('0x3d')){var _0x1c3b62={};_0x1c3b62[_0x1309bd[_0x80cb('0x28')]]={'$like':'%'+_0x3f6287[_0x80cb('0x34')]['filter']+'%'};return _0x1c3b62;}})});}_0x557922=_[_0x80cb('0x3e')]({},_0x557922,_0x3f6287[_0x80cb('0x3f')]);var _0x2eec62={'where':_0x557922['where']};return db[_0x80cb('0x40')][_0x80cb('0x1f')](_0x2eec62)['then'](function(_0x366880){_0x403f20[_0x80cb('0x1f')]=_0x366880;if(_0x3f6287['query'][_0x80cb('0x41')]){_0x557922['include']=[{'all':!![]}];}return db[_0x80cb('0x40')][_0x80cb('0x42')](_0x557922);})['then'](function(_0x52feb2){_0x403f20[_0x80cb('0x43')]=_0x52feb2;return _0x403f20;})[_0x80cb('0x26')](respondWithFilteredResult(_0x483ab0,_0x557922))[_0x80cb('0x44')](handleError(_0x483ab0,null));};exports[_0x80cb('0x45')]=function(_0x158a76,_0x5cbe73){var _0x51f656={'raw':!![],'where':{'id':_0x158a76[_0x80cb('0x46')]['id']}},_0x393f25={};_0x393f25[_0x80cb('0x30')]=_[_0x80cb('0x31')](db[_0x80cb('0x40')]['rawAttributes']);_0x393f25['query']=_[_0x80cb('0x31')](_0x158a76['query']);_0x393f25[_0x80cb('0x32')]=_[_0x80cb('0x33')](_0x393f25['model'],_0x393f25[_0x80cb('0x34')]);_0x51f656[_0x80cb('0x35')]=_['intersection'](_0x393f25['model'],qs['fields'](_0x158a76[_0x80cb('0x34')][_0x80cb('0x36')]));_0x51f656['attributes']=_0x51f656['attributes'][_0x80cb('0x37')]?_0x51f656['attributes']:_0x393f25['model'];if(_0x158a76[_0x80cb('0x34')]['includeAll']){_0x51f656[_0x80cb('0x47')]=[{'all':!![]}];}_0x51f656=_[_0x80cb('0x3e')]({},_0x51f656,_0x158a76[_0x80cb('0x3f')]);return db['OpenchannelTransferReport'][_0x80cb('0x48')](_0x51f656)[_0x80cb('0x26')](handleEntityNotFound(_0x5cbe73,null))['then'](respondWithResult(_0x5cbe73,null))[_0x80cb('0x44')](handleError(_0x5cbe73,null));};exports[_0x80cb('0x49')]=function(_0x1c3a81,_0xada8d5){return db[_0x80cb('0x40')][_0x80cb('0x49')](_0x1c3a81[_0x80cb('0x4a')],{})[_0x80cb('0x26')](respondWithResult(_0xada8d5,0xc9))['catch'](handleError(_0xada8d5,null));};exports[_0x80cb('0x25')]=function(_0x75ca31,_0x50b4fb){if(_0x75ca31['body']['id']){delete _0x75ca31[_0x80cb('0x4a')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x75ca31[_0x80cb('0x46')]['id']}})[_0x80cb('0x26')](handleEntityNotFound(_0x50b4fb,null))['then'](saveUpdates(_0x75ca31[_0x80cb('0x4a')],null))[_0x80cb('0x26')](respondWithResult(_0x50b4fb,null))[_0x80cb('0x44')](handleError(_0x50b4fb,null));};exports[_0x80cb('0x4b')]=function(_0x3decef,_0x5c35c5){return db['OpenchannelTransferReport'][_0x80cb('0x48')]({'where':{'id':_0x3decef[_0x80cb('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c35c5,null))[_0x80cb('0x26')](removeEntity(_0x5c35c5,null))[_0x80cb('0x44')](handleError(_0x5c35c5,null));};exports[_0x80cb('0x4c')]=function(_0x579b7e,_0x20ede3){return db[_0x80cb('0x40')][_0x80cb('0x4c')]()['then'](respondWithResult(_0x20ede3,null))[_0x80cb('0x44')](handleError(_0x20ede3,null));}; \ No newline at end of file +var _0x5907=['body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x5907,0x1d7));var _0x7590=function(_0x36a32b,_0x7a3a15){_0x36a32b=_0x36a32b-0x0;var _0x2fa4b2=_0x5907[_0x36a32b];return _0x2fa4b2;};'use strict';var emlformat=require(_0x7590('0x0'));var rimraf=require(_0x7590('0x1'));var zipdir=require(_0x7590('0x2'));var jsonpatch=require(_0x7590('0x3'));var rp=require(_0x7590('0x4'));var moment=require(_0x7590('0x5'));var BPromise=require(_0x7590('0x6'));var Mustache=require('mustache');var util=require(_0x7590('0x7'));var path=require(_0x7590('0x8'));var sox=require(_0x7590('0x9'));var csv=require(_0x7590('0xa'));var ejs=require(_0x7590('0xb'));var fs=require('fs');var fs_extra=require(_0x7590('0xc'));var _=require(_0x7590('0xd'));var squel=require(_0x7590('0xe'));var crypto=require(_0x7590('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7590('0x10'));var toCsv=require(_0x7590('0xa'));var querystring=require(_0x7590('0x11'));var Papa=require('papaparse');var Redis=require(_0x7590('0x12'));var authService=require(_0x7590('0x13'));var qs=require(_0x7590('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7590('0x15'));var logger=require(_0x7590('0x16'))(_0x7590('0x17'));var utils=require(_0x7590('0x18'));var config=require(_0x7590('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x296a44,_0x16534b){_0x16534b=_0x16534b||0xcc;return function(_0x55e3dd){if(_0x55e3dd){return _0x296a44[_0x7590('0x1a')](_0x16534b);}return _0x296a44[_0x7590('0x1b')](_0x16534b)[_0x7590('0x1c')]();};}function respondWithResult(_0x3393b6,_0x4f5074){_0x4f5074=_0x4f5074||0xc8;return function(_0x4a3e6b){if(_0x4a3e6b){return _0x3393b6[_0x7590('0x1b')](_0x4f5074)[_0x7590('0x1d')](_0x4a3e6b);}};}function respondWithFilteredResult(_0x1106ea,_0x23a779){return function(_0x213eb4){if(_0x213eb4){var _0x13e644=typeof _0x23a779[_0x7590('0x1e')]===_0x7590('0x1f')&&typeof _0x23a779[_0x7590('0x20')]===_0x7590('0x1f');var _0x5a2741=_0x213eb4[_0x7590('0x21')];var _0x39394c=_0x13e644?0x0:_0x23a779[_0x7590('0x1e')];var _0x5b03db=_0x13e644?_0x213eb4[_0x7590('0x21')]:_0x23a779[_0x7590('0x1e')]+_0x23a779[_0x7590('0x20')];var _0x4921c1;if(_0x5b03db>=_0x5a2741){_0x5b03db=_0x5a2741;_0x4921c1=0xc8;}else{_0x4921c1=0xce;}_0x1106ea[_0x7590('0x1b')](_0x4921c1);return _0x1106ea['set'](_0x7590('0x22'),_0x39394c+'-'+_0x5b03db+'/'+_0x5a2741)[_0x7590('0x1d')](_0x213eb4);}return null;};}function patchUpdates(_0xa79d47){return function(_0x45e381){try{jsonpatch[_0x7590('0x23')](_0x45e381,_0xa79d47,!![]);}catch(_0x20218f){return BPromise[_0x7590('0x24')](_0x20218f);}return _0x45e381[_0x7590('0x25')]();};}function saveUpdates(_0x5bdde8,_0x41600e){return function(_0x54ad55){if(_0x54ad55){return _0x54ad55[_0x7590('0x26')](_0x5bdde8)['then'](function(_0x2f8edc){return _0x2f8edc;});}return null;};}function removeEntity(_0x418467,_0x199e6c){return function(_0x23e36f){if(_0x23e36f){return _0x23e36f['destroy']()[_0x7590('0x27')](function(){_0x418467[_0x7590('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5944b4,_0x50b129){return function(_0x2c0b6f){if(!_0x2c0b6f){_0x5944b4[_0x7590('0x1a')](0x194);}return _0x2c0b6f;};}function handleError(_0x48a1e2,_0x5b48d8){_0x5b48d8=_0x5b48d8||0x1f4;return function(_0x62411f){logger[_0x7590('0x28')](_0x62411f[_0x7590('0x29')]);if(_0x62411f['name']){delete _0x62411f['name'];}_0x48a1e2['status'](_0x5b48d8)['send'](_0x62411f);};}exports['index']=function(_0xdc2eba,_0x31a28a){var _0x4cb31a={},_0x4c3f70={},_0x485f69={'count':0x0,'rows':[]};var _0x2c1d92=_[_0x7590('0x2a')](db[_0x7590('0x2b')][_0x7590('0x2c')],function(_0x48e992){return{'name':_0x48e992[_0x7590('0x2d')],'type':_0x48e992[_0x7590('0x2e')][_0x7590('0x2f')]};});_0x4c3f70['model']=_['map'](_0x2c1d92,'name');_0x4c3f70[_0x7590('0x30')]=_[_0x7590('0x31')](_0xdc2eba[_0x7590('0x30')]);_0x4c3f70[_0x7590('0x32')]=_['intersection'](_0x4c3f70[_0x7590('0x33')],_0x4c3f70[_0x7590('0x30')]);_0x4cb31a[_0x7590('0x34')]=_[_0x7590('0x35')](_0x4c3f70[_0x7590('0x33')],qs[_0x7590('0x36')](_0xdc2eba[_0x7590('0x30')][_0x7590('0x36')]));_0x4cb31a[_0x7590('0x34')]=_0x4cb31a['attributes'][_0x7590('0x37')]?_0x4cb31a[_0x7590('0x34')]:_0x4c3f70[_0x7590('0x33')];if(!_0xdc2eba[_0x7590('0x30')][_0x7590('0x38')](_0x7590('0x39'))){_0x4cb31a[_0x7590('0x20')]=qs[_0x7590('0x20')](_0xdc2eba[_0x7590('0x30')][_0x7590('0x20')]);_0x4cb31a['offset']=qs[_0x7590('0x1e')](_0xdc2eba['query'][_0x7590('0x1e')]);}_0x4cb31a[_0x7590('0x3a')]=qs[_0x7590('0x3b')](_0xdc2eba[_0x7590('0x30')][_0x7590('0x3b')]);_0x4cb31a[_0x7590('0x3c')]=qs[_0x7590('0x32')](_['pick'](_0xdc2eba[_0x7590('0x30')],_0x4c3f70[_0x7590('0x32')]),_0x2c1d92);if(_0xdc2eba[_0x7590('0x30')][_0x7590('0x3d')]){_0x4cb31a[_0x7590('0x3c')]=_[_0x7590('0x3e')](_0x4cb31a['where'],{'$or':_[_0x7590('0x2a')](_0x2c1d92,function(_0x36dd63){if(_0x36dd63[_0x7590('0x2e')]!==_0x7590('0x3f')){var _0x475842={};_0x475842[_0x36dd63[_0x7590('0x40')]]={'$like':'%'+_0xdc2eba[_0x7590('0x30')][_0x7590('0x3d')]+'%'};return _0x475842;}})});}_0x4cb31a=_['merge']({},_0x4cb31a,_0xdc2eba[_0x7590('0x41')]);var _0x43fc0e={'where':_0x4cb31a['where']};return db[_0x7590('0x2b')][_0x7590('0x21')](_0x43fc0e)[_0x7590('0x27')](function(_0x11c307){_0x485f69[_0x7590('0x21')]=_0x11c307;if(_0xdc2eba[_0x7590('0x30')][_0x7590('0x42')]){_0x4cb31a[_0x7590('0x43')]=[{'all':!![]}];}return db[_0x7590('0x2b')][_0x7590('0x44')](_0x4cb31a);})[_0x7590('0x27')](function(_0x52df69){_0x485f69[_0x7590('0x45')]=_0x52df69;return _0x485f69;})['then'](respondWithFilteredResult(_0x31a28a,_0x4cb31a))[_0x7590('0x46')](handleError(_0x31a28a,null));};exports[_0x7590('0x47')]=function(_0x5c8397,_0x36c233){var _0x2a68c5={'raw':!![],'where':{'id':_0x5c8397[_0x7590('0x48')]['id']}},_0x2480de={};_0x2480de[_0x7590('0x33')]=_[_0x7590('0x31')](db[_0x7590('0x2b')][_0x7590('0x2c')]);_0x2480de[_0x7590('0x30')]=_[_0x7590('0x31')](_0x5c8397[_0x7590('0x30')]);_0x2480de[_0x7590('0x32')]=_['intersection'](_0x2480de['model'],_0x2480de[_0x7590('0x30')]);_0x2a68c5['attributes']=_[_0x7590('0x35')](_0x2480de['model'],qs['fields'](_0x5c8397[_0x7590('0x30')][_0x7590('0x36')]));_0x2a68c5[_0x7590('0x34')]=_0x2a68c5[_0x7590('0x34')][_0x7590('0x37')]?_0x2a68c5['attributes']:_0x2480de['model'];if(_0x5c8397[_0x7590('0x30')][_0x7590('0x42')]){_0x2a68c5[_0x7590('0x43')]=[{'all':!![]}];}_0x2a68c5=_['merge']({},_0x2a68c5,_0x5c8397[_0x7590('0x41')]);return db[_0x7590('0x2b')][_0x7590('0x49')](_0x2a68c5)[_0x7590('0x27')](handleEntityNotFound(_0x36c233,null))['then'](respondWithResult(_0x36c233,null))[_0x7590('0x46')](handleError(_0x36c233,null));};exports[_0x7590('0x4a')]=function(_0xdf29c1,_0xd397ff){return db[_0x7590('0x2b')][_0x7590('0x4a')](_0xdf29c1[_0x7590('0x4b')],{})[_0x7590('0x27')](respondWithResult(_0xd397ff,0xc9))[_0x7590('0x46')](handleError(_0xd397ff,null));};exports['update']=function(_0x248448,_0xb1ed7b){if(_0x248448['body']['id']){delete _0x248448[_0x7590('0x4b')]['id'];}return db[_0x7590('0x2b')]['find']({'where':{'id':_0x248448['params']['id']}})['then'](handleEntityNotFound(_0xb1ed7b,null))[_0x7590('0x27')](saveUpdates(_0x248448[_0x7590('0x4b')],null))[_0x7590('0x27')](respondWithResult(_0xb1ed7b,null))[_0x7590('0x46')](handleError(_0xb1ed7b,null));};exports[_0x7590('0x4c')]=function(_0x8d1473,_0x43f5a2){return db[_0x7590('0x2b')][_0x7590('0x49')]({'where':{'id':_0x8d1473[_0x7590('0x48')]['id']}})['then'](handleEntityNotFound(_0x43f5a2,null))[_0x7590('0x27')](removeEntity(_0x43f5a2,null))['catch'](handleError(_0x43f5a2,null));};exports[_0x7590('0x4d')]=function(_0x47eea3,_0x38c872){return db['OpenchannelTransferReport'][_0x7590('0x4d')]()[_0x7590('0x27')](respondWithResult(_0x38c872,null))['catch'](handleError(_0x38c872,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 61d01e7..788d320 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 _0xb995=['../../config/environment','define','OpenchannelTransferReport','report_openchannel_transfer','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x1b905d,_0xab52f){var _0x199300=function(_0x237b80){while(--_0x237b80){_0x1b905d['push'](_0x1b905d['shift']());}};_0x199300(++_0xab52f);}(_0xb995,0xcc));var _0x5b99=function(_0x2fe364,_0x37da58){_0x2fe364=_0x2fe364-0x0;var _0x40b49c=_0xb995[_0x2fe364];return _0x40b49c;};'use strict';var _=require('lodash');var util=require(_0x5b99('0x0'));var logger=require(_0x5b99('0x1'))(_0x5b99('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5b99('0x3'));var fs=require('fs');var path=require(_0x5b99('0x4'));var rimraf=require(_0x5b99('0x5'));var config=require(_0x5b99('0x6'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x40fde0,_0x234bb9){return _0x40fde0[_0x5b99('0x7')](_0x5b99('0x8'),attributes,{'tableName':_0x5b99('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x774d=['api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x109726,_0x2329b0){var _0x29fd19=function(_0x257060){while(--_0x257060){_0x109726['push'](_0x109726['shift']());}};_0x29fd19(++_0x2329b0);}(_0x774d,0x142));var _0xd774=function(_0x4cbaed,_0x47b284){_0x4cbaed=_0x4cbaed-0x0;var _0x40163e=_0x774d[_0x4cbaed];return _0x40163e;};'use strict';var _=require(_0xd774('0x0'));var util=require(_0xd774('0x1'));var logger=require(_0xd774('0x2'))(_0xd774('0x3'));var moment=require(_0xd774('0x4'));var BPromise=require(_0xd774('0x5'));var rp=require(_0xd774('0x6'));var fs=require('fs');var path=require(_0xd774('0x7'));var rimraf=require(_0xd774('0x8'));var config=require('../../config/environment');var attributes=require(_0xd774('0x9'));module['exports']=function(_0x2c2c21,_0x51cc62){return _0x2c2c21['define'](_0xd774('0xa'),attributes,{'tableName':_0xd774('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd774('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 78ab74f..f0063d4 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 _0xc492=['jayson/promise','http','request','then','info','request\x20sent','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc'];(function(_0x5695da,_0x4399fc){var _0xdca67c=function(_0x143ae3){while(--_0x143ae3){_0x5695da['push'](_0x5695da['shift']());}};_0xdca67c(++_0x4399fc);}(_0xc492,0xd7));var _0x2c49=function(_0x5c84ef,_0x3b36cc){_0x5c84ef=_0x5c84ef-0x0;var _0x39cc4c=_0xc492[_0x5c84ef];return _0x39cc4c;};'use strict';var _=require(_0x2c49('0x0'));var util=require(_0x2c49('0x1'));var moment=require(_0x2c49('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c49('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2c49('0x4'))(_0x2c49('0x5'));var config=require('../../config/environment');var jayson=require(_0x2c49('0x6'));var client=jayson['client'][_0x2c49('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9c10f7,_0x4c76dd,_0xe7b4cb){return new BPromise(function(_0x17f596,_0x26f8c1){return client[_0x2c49('0x8')](_0x9c10f7,_0xe7b4cb)[_0x2c49('0x9')](function(_0x5684e5){logger[_0x2c49('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c76dd,'request\x20sent');logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4c76dd,_0x2c49('0xb'),JSON['stringify'](_0x5684e5));if(_0x5684e5[_0x2c49('0xc')]){if(_0x5684e5[_0x2c49('0xc')]['code']===0x1f4){logger[_0x2c49('0xc')](_0x2c49('0xd'),_0x4c76dd,_0x5684e5[_0x2c49('0xc')][_0x2c49('0xe')]);return _0x26f8c1(_0x5684e5[_0x2c49('0xc')][_0x2c49('0xe')]);}logger['error'](_0x2c49('0xd'),_0x4c76dd,_0x5684e5[_0x2c49('0xc')][_0x2c49('0xe')]);return _0x17f596(_0x5684e5[_0x2c49('0xc')][_0x2c49('0xe')]);}else{logger['info'](_0x2c49('0xd'),_0x4c76dd,_0x2c49('0xb'));_0x17f596(_0x5684e5[_0x2c49('0xf')][_0x2c49('0xe')]);}})[_0x2c49('0x10')](function(_0x88e972){logger[_0x2c49('0xc')](_0x2c49('0xd'),_0x4c76dd,_0x88e972);_0x26f8c1(_0x88e972);});});} \ No newline at end of file +var _0x0fda=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x1e5d50,_0x58a6f8){_0x1e5d50=_0x1e5d50-0x0;var _0x42c1e5=_0x0fda[_0x1e5d50];return _0x42c1e5;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var rs=require(_0xa0fd('0x3'));var fs=require('fs');var Redis=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];var utils=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0fd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x868183,_0x62b109,_0x1aab41){return new BPromise(function(_0x248cca,_0x5d996b){return client[_0xa0fd('0x9')](_0x868183,_0x1aab41)[_0xa0fd('0xa')](function(_0x231ca4){logger[_0xa0fd('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));logger[_0xa0fd('0xd')](_0xa0fd('0xe'),_0x62b109,'request\x20sent',JSON[_0xa0fd('0xf')](_0x231ca4));if(_0x231ca4[_0xa0fd('0x10')]){if(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x11')]===0x1f4){logger[_0xa0fd('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x62b109,_0x231ca4['error'][_0xa0fd('0x12')]);return _0x5d996b(_0x231ca4[_0xa0fd('0x10')]['message']);}logger[_0xa0fd('0x10')](_0xa0fd('0x13'),_0x62b109,_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);return _0x248cca(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);}else{logger[_0xa0fd('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));_0x248cca(_0x231ca4[_0xa0fd('0x14')]['message']);}})['catch'](function(_0x205506){logger[_0xa0fd('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x62b109,_0x205506);_0x5d996b(_0x205506);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 4851e36..1f1c784 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 _0xce27=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util'];(function(_0x53b687,_0x2463da){var _0x410274=function(_0x2de413){while(--_0x2de413){_0x53b687['push'](_0x53b687['shift']());}};_0x410274(++_0x2463da);}(_0xce27,0x1af));var _0x7ce2=function(_0x11d389,_0x50a243){_0x11d389=_0x11d389-0x0;var _0x10a71a=_0xce27[_0x11d389];return _0x10a71a;};'use strict';var multer=require('multer');var util=require(_0x7ce2('0x0'));var path=require(_0x7ce2('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ce2('0x2'));var router=express[_0x7ce2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7ce2('0x4'));var interaction=require(_0x7ce2('0x5'));var config=require(_0x7ce2('0x6'));var controller=require(_0x7ce2('0x7'));router[_0x7ce2('0x8')]('/',auth[_0x7ce2('0x9')](),controller['index']);router[_0x7ce2('0x8')](_0x7ce2('0xa'),auth[_0x7ce2('0x9')](),controller[_0x7ce2('0xb')]);router[_0x7ce2('0xc')]('/',auth[_0x7ce2('0x9')](),controller[_0x7ce2('0xd')]);router['put'](_0x7ce2('0xa'),auth[_0x7ce2('0x9')](),controller[_0x7ce2('0xe')]);router[_0x7ce2('0xf')]('/:id',auth[_0x7ce2('0x9')](),controller[_0x7ce2('0x10')]);module[_0x7ce2('0x11')]=router; \ No newline at end of file +var _0x946e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','/:id','update','delete','exports','multer','util'];(function(_0x2722ea,_0x1074dc){var _0x29c796=function(_0x2b8d22){while(--_0x2b8d22){_0x2722ea['push'](_0x2722ea['shift']());}};_0x29c796(++_0x1074dc);}(_0x946e,0x154));var _0xe946=function(_0x51e587,_0x28de13){_0x51e587=_0x51e587-0x0;var _0x1ecc53=_0x946e[_0x51e587];return _0x1ecc53;};'use strict';var multer=require(_0xe946('0x0'));var util=require(_0xe946('0x1'));var path=require('path');var timeout=require(_0xe946('0x2'));var express=require(_0xe946('0x3'));var router=express[_0xe946('0x4')]();var fs_extra=require(_0xe946('0x5'));var auth=require(_0xe946('0x6'));var interaction=require(_0xe946('0x7'));var config=require(_0xe946('0x8'));var controller=require('./pause.controller');router[_0xe946('0x9')]('/',auth[_0xe946('0xa')](),controller[_0xe946('0xb')]);router['get']('/:id',auth[_0xe946('0xa')](),controller[_0xe946('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe946('0xd')]);router['put'](_0xe946('0xe'),auth[_0xe946('0xa')](),controller[_0xe946('0xf')]);router[_0xe946('0x10')](_0xe946('0xe'),auth[_0xe946('0xa')](),controller['destroy']);module[_0xe946('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2c83ab3..58d51fd 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 _0xf9af=['sequelize','STRING','name'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0xf9af,0x171));var _0xff9a=function(_0x78f155,_0x45d9f2){_0x78f155=_0x78f155-0x0;var _0xfeebe4=_0xf9af[_0x78f155];return _0xfeebe4;};'use strict';var Sequelize=require(_0xff9a('0x0'));module['exports']={'name':{'type':Sequelize[_0xff9a('0x1')],'unique':_0xff9a('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c1d=['sequelize','exports','STRING','name'];(function(_0x4042ed,_0x5b5b84){var _0x89e2c6=function(_0x55c37b){while(--_0x55c37b){_0x4042ed['push'](_0x4042ed['shift']());}};_0x89e2c6(++_0x5b5b84);}(_0x2c1d,0x134));var _0xd2c1=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x2c1d[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require(_0xd2c1('0x0'));module[_0xd2c1('0x1')]={'name':{'type':Sequelize[_0xd2c1('0x2')],'unique':_0xd2c1('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 377ef25..df23230 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 _0x5f48=['../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','get','UserProfileResource','destroy','then','error','stack','name','send','index','map','Pause','fieldName','query','filters','intersection','model','attributes','fields','length','limit','order','sort','where','merge','type','filter','options','includeAll','include','catch','show','params','keys','rawAttributes','create','body','role','user','Pauses','userProfileId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f48,0x1c5));var _0x85f4=function(_0x5d0060,_0x44d247){_0x5d0060=_0x5d0060-0x0;var _0x17be24=_0x5f48[_0x5d0060];return _0x17be24;};'use strict';var emlformat=require(_0x85f4('0x0'));var rimraf=require(_0x85f4('0x1'));var zipdir=require(_0x85f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85f4('0x3'));var moment=require(_0x85f4('0x4'));var BPromise=require(_0x85f4('0x5'));var Mustache=require(_0x85f4('0x6'));var util=require(_0x85f4('0x7'));var path=require(_0x85f4('0x8'));var sox=require(_0x85f4('0x9'));var csv=require(_0x85f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85f4('0xb'));var _=require(_0x85f4('0xc'));var squel=require('squel');var crypto=require(_0x85f4('0xd'));var jsforce=require(_0x85f4('0xe'));var deskjs=require(_0x85f4('0xf'));var toCsv=require(_0x85f4('0xa'));var querystring=require('querystring');var Papa=require(_0x85f4('0x10'));var Redis=require(_0x85f4('0x11'));var authService=require(_0x85f4('0x12'));var qs=require(_0x85f4('0x13'));var as=require(_0x85f4('0x14'));var hardwareService=require(_0x85f4('0x15'));var logger=require(_0x85f4('0x16'))(_0x85f4('0x17'));var utils=require(_0x85f4('0x18'));var config=require(_0x85f4('0x19'));var licenseUtil=require(_0x85f4('0x1a'));var db=require(_0x85f4('0x1b'))['db'];function respondWithStatusCode(_0x319876,_0x24ec8a){_0x24ec8a=_0x24ec8a||0xcc;return function(_0x352ac9){if(_0x352ac9){return _0x319876[_0x85f4('0x1c')](_0x24ec8a);}return _0x319876[_0x85f4('0x1d')](_0x24ec8a)[_0x85f4('0x1e')]();};}function respondWithResult(_0x23b5ee,_0x1fcb66){_0x1fcb66=_0x1fcb66||0xc8;return function(_0x1f3967){if(_0x1f3967){return _0x23b5ee[_0x85f4('0x1d')](_0x1fcb66)[_0x85f4('0x1f')](_0x1f3967);}};}function respondWithFilteredResult(_0x52c2eb,_0x2c53f7){return function(_0x268530){if(_0x268530){var _0x50e209=typeof _0x2c53f7['offset']===_0x85f4('0x20')&&typeof _0x2c53f7['limit']===_0x85f4('0x20');var _0x4caaa2=_0x268530[_0x85f4('0x21')];var _0x25ddd7=_0x50e209?0x0:_0x2c53f7[_0x85f4('0x22')];var _0x1583c9=_0x50e209?_0x268530[_0x85f4('0x21')]:_0x2c53f7[_0x85f4('0x22')]+_0x2c53f7['limit'];var _0x554dd0;if(_0x1583c9>=_0x4caaa2){_0x1583c9=_0x4caaa2;_0x554dd0=0xc8;}else{_0x554dd0=0xce;}_0x52c2eb[_0x85f4('0x1d')](_0x554dd0);return _0x52c2eb[_0x85f4('0x23')]('Content-Range',_0x25ddd7+'-'+_0x1583c9+'/'+_0x4caaa2)[_0x85f4('0x1f')](_0x268530);}return null;};}function patchUpdates(_0x48217a){return function(_0x41e4e7){try{jsonpatch[_0x85f4('0x24')](_0x41e4e7,_0x48217a,!![]);}catch(_0xd709e1){return BPromise[_0x85f4('0x25')](_0xd709e1);}return _0x41e4e7[_0x85f4('0x26')]();};}function saveUpdates(_0x4ed958,_0x1a5049){return function(_0x590ff1){if(_0x590ff1){return _0x590ff1[_0x85f4('0x27')](_0x4ed958)['then'](function(_0x485e80){return _0x485e80;});}return null;};}function removeEntity(_0x5b885b,_0xbb9b89){return function(_0x3e86bd){if(_0x3e86bd){return _0x3e86bd['destroy']()['then'](function(){var _0x3a1d42=_0x3e86bd[_0x85f4('0x28')]({'plain':!![]});var _0x5c4f99='Pauses';return db[_0x85f4('0x29')][_0x85f4('0x2a')]({'where':{'type':_0x5c4f99,'resourceId':_0x3a1d42['id']}})[_0x85f4('0x2b')](function(){return _0x3e86bd;});})[_0x85f4('0x2b')](function(){_0x5b885b[_0x85f4('0x1d')](0xcc)[_0x85f4('0x1e')]();});}};}function handleEntityNotFound(_0x1141d8,_0x522e92){return function(_0x3a2d85){if(!_0x3a2d85){_0x1141d8[_0x85f4('0x1c')](0x194);}return _0x3a2d85;};}function handleError(_0x30e143,_0x5c54f6){_0x5c54f6=_0x5c54f6||0x1f4;return function(_0x5dee0a){logger[_0x85f4('0x2c')](_0x5dee0a[_0x85f4('0x2d')]);if(_0x5dee0a['name']){delete _0x5dee0a[_0x85f4('0x2e')];}_0x30e143['status'](_0x5c54f6)[_0x85f4('0x2f')](_0x5dee0a);};}exports[_0x85f4('0x30')]=function(_0x16ab1f,_0x2fdee4){var _0x66ebfd={},_0x5dfd6d={},_0x5d56e7={'count':0x0,'rows':[]};var _0x1deb94=_[_0x85f4('0x31')](db[_0x85f4('0x32')]['rawAttributes'],function(_0x27ba16){return{'name':_0x27ba16[_0x85f4('0x33')],'type':_0x27ba16['type']['key']};});_0x5dfd6d['model']=_[_0x85f4('0x31')](_0x1deb94,'name');_0x5dfd6d[_0x85f4('0x34')]=_['keys'](_0x16ab1f[_0x85f4('0x34')]);_0x5dfd6d[_0x85f4('0x35')]=_[_0x85f4('0x36')](_0x5dfd6d[_0x85f4('0x37')],_0x5dfd6d[_0x85f4('0x34')]);_0x66ebfd[_0x85f4('0x38')]=_[_0x85f4('0x36')](_0x5dfd6d[_0x85f4('0x37')],qs[_0x85f4('0x39')](_0x16ab1f[_0x85f4('0x34')][_0x85f4('0x39')]));_0x66ebfd[_0x85f4('0x38')]=_0x66ebfd[_0x85f4('0x38')][_0x85f4('0x3a')]?_0x66ebfd[_0x85f4('0x38')]:_0x5dfd6d[_0x85f4('0x37')];if(!_0x16ab1f[_0x85f4('0x34')]['hasOwnProperty']('nolimit')){_0x66ebfd['limit']=qs['limit'](_0x16ab1f['query'][_0x85f4('0x3b')]);_0x66ebfd[_0x85f4('0x22')]=qs['offset'](_0x16ab1f[_0x85f4('0x34')]['offset']);}_0x66ebfd[_0x85f4('0x3c')]=qs[_0x85f4('0x3d')](_0x16ab1f[_0x85f4('0x34')][_0x85f4('0x3d')]);_0x66ebfd[_0x85f4('0x3e')]=qs[_0x85f4('0x35')](_['pick'](_0x16ab1f[_0x85f4('0x34')],_0x5dfd6d[_0x85f4('0x35')]),_0x1deb94);if(_0x16ab1f[_0x85f4('0x34')]['filter']){_0x66ebfd[_0x85f4('0x3e')]=_[_0x85f4('0x3f')](_0x66ebfd[_0x85f4('0x3e')],{'$or':_[_0x85f4('0x31')](_0x1deb94,function(_0x358f24){if(_0x358f24[_0x85f4('0x40')]!=='VIRTUAL'){var _0x163250={};_0x163250[_0x358f24[_0x85f4('0x2e')]]={'$like':'%'+_0x16ab1f['query'][_0x85f4('0x41')]+'%'};return _0x163250;}})});}_0x66ebfd=_[_0x85f4('0x3f')]({},_0x66ebfd,_0x16ab1f[_0x85f4('0x42')]);var _0x37ffee={'where':_0x66ebfd[_0x85f4('0x3e')]};return db[_0x85f4('0x32')]['count'](_0x37ffee)[_0x85f4('0x2b')](function(_0xcd649d){_0x5d56e7['count']=_0xcd649d;if(_0x16ab1f['query'][_0x85f4('0x43')]){_0x66ebfd[_0x85f4('0x44')]=[{'all':!![]}];}return db[_0x85f4('0x32')]['findAll'](_0x66ebfd);})['then'](function(_0x18ebee){_0x5d56e7['rows']=_0x18ebee;return _0x5d56e7;})['then'](respondWithFilteredResult(_0x2fdee4,_0x66ebfd))[_0x85f4('0x45')](handleError(_0x2fdee4,null));};exports[_0x85f4('0x46')]=function(_0x66cacf,_0xd6b46a){var _0x48119d={'raw':!![],'where':{'id':_0x66cacf[_0x85f4('0x47')]['id']}},_0x35f8ba={};_0x35f8ba[_0x85f4('0x37')]=_[_0x85f4('0x48')](db[_0x85f4('0x32')][_0x85f4('0x49')]);_0x35f8ba[_0x85f4('0x34')]=_['keys'](_0x66cacf['query']);_0x35f8ba[_0x85f4('0x35')]=_[_0x85f4('0x36')](_0x35f8ba[_0x85f4('0x37')],_0x35f8ba[_0x85f4('0x34')]);_0x48119d['attributes']=_[_0x85f4('0x36')](_0x35f8ba[_0x85f4('0x37')],qs[_0x85f4('0x39')](_0x66cacf[_0x85f4('0x34')][_0x85f4('0x39')]));_0x48119d['attributes']=_0x48119d['attributes'][_0x85f4('0x3a')]?_0x48119d[_0x85f4('0x38')]:_0x35f8ba[_0x85f4('0x37')];if(_0x66cacf[_0x85f4('0x34')][_0x85f4('0x43')]){_0x48119d[_0x85f4('0x44')]=[{'all':!![]}];}_0x48119d=_[_0x85f4('0x3f')]({},_0x48119d,_0x66cacf[_0x85f4('0x42')]);return db[_0x85f4('0x32')]['find'](_0x48119d)['then'](handleEntityNotFound(_0xd6b46a,null))[_0x85f4('0x2b')](respondWithResult(_0xd6b46a,null))[_0x85f4('0x45')](handleError(_0xd6b46a,null));};exports[_0x85f4('0x4a')]=function(_0x144343,_0x5f4dbf){return db[_0x85f4('0x32')][_0x85f4('0x4a')](_0x144343[_0x85f4('0x4b')],{})[_0x85f4('0x2b')](function(_0x5501b5){var _0x5c02a4=_0x144343['user'][_0x85f4('0x28')]({'plain':!![]});if(!_0x5c02a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c02a4[_0x85f4('0x4c')]===_0x85f4('0x4d')){var _0x12b827=_0x5501b5[_0x85f4('0x28')]({'plain':!![]});var _0x369c1e=_0x85f4('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x369c1e,'userProfileId':_0x5c02a4[_0x85f4('0x4f')]},'raw':!![]})[_0x85f4('0x2b')](function(_0x28a95c){if(_0x28a95c&&_0x28a95c['autoAssociation']===0x0){return db['UserProfileResource'][_0x85f4('0x4a')]({'name':_0x12b827[_0x85f4('0x2e')],'resourceId':_0x12b827['id'],'type':_0x28a95c[_0x85f4('0x2e')],'sectionId':_0x28a95c['id']},{})['then'](function(){return _0x5501b5;});}else{return _0x5501b5;}})[_0x85f4('0x45')](function(_0x323394){logger[_0x85f4('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x323394);throw _0x323394;});}return _0x5501b5;})[_0x85f4('0x2b')](respondWithResult(_0x5f4dbf,0xc9))['catch'](handleError(_0x5f4dbf,null));};exports[_0x85f4('0x27')]=function(_0x35499c,_0x57b03d){if(_0x35499c[_0x85f4('0x4b')]['id']){delete _0x35499c[_0x85f4('0x4b')]['id'];}return db['Pause']['find']({'where':{'id':_0x35499c[_0x85f4('0x47')]['id']}})['then'](handleEntityNotFound(_0x57b03d,null))[_0x85f4('0x2b')](saveUpdates(_0x35499c[_0x85f4('0x4b')],null))[_0x85f4('0x2b')](respondWithResult(_0x57b03d,null))['catch'](handleError(_0x57b03d,null));};exports[_0x85f4('0x2a')]=function(_0x43c529,_0x2fefaf){return db['Pause']['find']({'where':{'id':_0x43c529[_0x85f4('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fefaf,null))[_0x85f4('0x2b')](removeEntity(_0x2fefaf,null))['catch'](handleError(_0x2fefaf,null));}; \ No newline at end of file +var _0x4eee=['stack','name','map','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','sort','where','pick','filter','merge','options','include','Pause','findAll','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error'];(function(_0x25ce0d,_0x49d1fd){var _0x4b3178=function(_0x18e691){while(--_0x18e691){_0x25ce0d['push'](_0x25ce0d['shift']());}};_0x4b3178(++_0x49d1fd);}(_0x4eee,0xfd));var _0xe4ee=function(_0x5cc51f,_0x22c480){_0x5cc51f=_0x5cc51f-0x0;var _0x315a2f=_0x4eee[_0x5cc51f];return _0x315a2f;};'use strict';var emlformat=require(_0xe4ee('0x0'));var rimraf=require(_0xe4ee('0x1'));var zipdir=require(_0xe4ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4ee('0x3'));var moment=require(_0xe4ee('0x4'));var BPromise=require(_0xe4ee('0x5'));var Mustache=require(_0xe4ee('0x6'));var util=require(_0xe4ee('0x7'));var path=require(_0xe4ee('0x8'));var sox=require('sox');var csv=require(_0xe4ee('0x9'));var ejs=require(_0xe4ee('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4ee('0xb'));var squel=require(_0xe4ee('0xc'));var crypto=require(_0xe4ee('0xd'));var jsforce=require(_0xe4ee('0xe'));var deskjs=require(_0xe4ee('0xf'));var toCsv=require(_0xe4ee('0x9'));var querystring=require('querystring');var Papa=require(_0xe4ee('0x10'));var Redis=require(_0xe4ee('0x11'));var authService=require(_0xe4ee('0x12'));var qs=require(_0xe4ee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4ee('0x14'))(_0xe4ee('0x15'));var utils=require(_0xe4ee('0x16'));var config=require(_0xe4ee('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4ee('0x18'))['db'];function respondWithStatusCode(_0x23a34c,_0x5e7292){_0x5e7292=_0x5e7292||0xcc;return function(_0xa64a60){if(_0xa64a60){return _0x23a34c[_0xe4ee('0x19')](_0x5e7292);}return _0x23a34c['status'](_0x5e7292)[_0xe4ee('0x1a')]();};}function respondWithResult(_0x5182a1,_0x13ba26){_0x13ba26=_0x13ba26||0xc8;return function(_0x31ae08){if(_0x31ae08){return _0x5182a1[_0xe4ee('0x1b')](_0x13ba26)[_0xe4ee('0x1c')](_0x31ae08);}};}function respondWithFilteredResult(_0x102262,_0x1aeea7){return function(_0x34c573){if(_0x34c573){var _0x359f15=typeof _0x1aeea7[_0xe4ee('0x1d')]===_0xe4ee('0x1e')&&typeof _0x1aeea7[_0xe4ee('0x1f')]===_0xe4ee('0x1e');var _0x231dcd=_0x34c573[_0xe4ee('0x20')];var _0xac5b30=_0x359f15?0x0:_0x1aeea7[_0xe4ee('0x1d')];var _0x55f79d=_0x359f15?_0x34c573[_0xe4ee('0x20')]:_0x1aeea7[_0xe4ee('0x1d')]+_0x1aeea7[_0xe4ee('0x1f')];var _0x45ec64;if(_0x55f79d>=_0x231dcd){_0x55f79d=_0x231dcd;_0x45ec64=0xc8;}else{_0x45ec64=0xce;}_0x102262[_0xe4ee('0x1b')](_0x45ec64);return _0x102262[_0xe4ee('0x21')](_0xe4ee('0x22'),_0xac5b30+'-'+_0x55f79d+'/'+_0x231dcd)[_0xe4ee('0x1c')](_0x34c573);}return null;};}function patchUpdates(_0x547096){return function(_0x3b5c05){try{jsonpatch[_0xe4ee('0x23')](_0x3b5c05,_0x547096,!![]);}catch(_0x3e35b1){return BPromise[_0xe4ee('0x24')](_0x3e35b1);}return _0x3b5c05['save']();};}function saveUpdates(_0x41b1ed,_0x2ec0b7){return function(_0x4a3ed9){if(_0x4a3ed9){return _0x4a3ed9[_0xe4ee('0x25')](_0x41b1ed)[_0xe4ee('0x26')](function(_0x17b742){return _0x17b742;});}return null;};}function removeEntity(_0x5028c1,_0x1450c5){return function(_0x4b875a){if(_0x4b875a){return _0x4b875a[_0xe4ee('0x27')]()[_0xe4ee('0x26')](function(){var _0x27591c=_0x4b875a[_0xe4ee('0x28')]({'plain':!![]});var _0x15ece1='Pauses';return db[_0xe4ee('0x29')][_0xe4ee('0x27')]({'where':{'type':_0x15ece1,'resourceId':_0x27591c['id']}})[_0xe4ee('0x26')](function(){return _0x4b875a;});})['then'](function(){_0x5028c1[_0xe4ee('0x1b')](0xcc)[_0xe4ee('0x1a')]();});}};}function handleEntityNotFound(_0x1a776f,_0x274f44){return function(_0x40b229){if(!_0x40b229){_0x1a776f[_0xe4ee('0x19')](0x194);}return _0x40b229;};}function handleError(_0x3f9667,_0x174397){_0x174397=_0x174397||0x1f4;return function(_0x2131c9){logger[_0xe4ee('0x2a')](_0x2131c9[_0xe4ee('0x2b')]);if(_0x2131c9[_0xe4ee('0x2c')]){delete _0x2131c9[_0xe4ee('0x2c')];}_0x3f9667[_0xe4ee('0x1b')](_0x174397)['send'](_0x2131c9);};}exports['index']=function(_0x441670,_0x3ea59a){var _0x1ccb8d={},_0x383d24={},_0x504353={'count':0x0,'rows':[]};var _0x38eaa5=_[_0xe4ee('0x2d')](db['Pause'][_0xe4ee('0x2e')],function(_0x445c6c){return{'name':_0x445c6c[_0xe4ee('0x2f')],'type':_0x445c6c['type']['key']};});_0x383d24['model']=_[_0xe4ee('0x2d')](_0x38eaa5,_0xe4ee('0x2c'));_0x383d24[_0xe4ee('0x30')]=_[_0xe4ee('0x31')](_0x441670['query']);_0x383d24[_0xe4ee('0x32')]=_['intersection'](_0x383d24[_0xe4ee('0x33')],_0x383d24[_0xe4ee('0x30')]);_0x1ccb8d[_0xe4ee('0x34')]=_[_0xe4ee('0x35')](_0x383d24[_0xe4ee('0x33')],qs[_0xe4ee('0x36')](_0x441670[_0xe4ee('0x30')][_0xe4ee('0x36')]));_0x1ccb8d['attributes']=_0x1ccb8d[_0xe4ee('0x34')][_0xe4ee('0x37')]?_0x1ccb8d[_0xe4ee('0x34')]:_0x383d24[_0xe4ee('0x33')];if(!_0x441670[_0xe4ee('0x30')]['hasOwnProperty']('nolimit')){_0x1ccb8d[_0xe4ee('0x1f')]=qs[_0xe4ee('0x1f')](_0x441670[_0xe4ee('0x30')]['limit']);_0x1ccb8d['offset']=qs[_0xe4ee('0x1d')](_0x441670['query']['offset']);}_0x1ccb8d['order']=qs[_0xe4ee('0x38')](_0x441670[_0xe4ee('0x30')]['sort']);_0x1ccb8d[_0xe4ee('0x39')]=qs[_0xe4ee('0x32')](_[_0xe4ee('0x3a')](_0x441670[_0xe4ee('0x30')],_0x383d24['filters']),_0x38eaa5);if(_0x441670[_0xe4ee('0x30')][_0xe4ee('0x3b')]){_0x1ccb8d[_0xe4ee('0x39')]=_[_0xe4ee('0x3c')](_0x1ccb8d[_0xe4ee('0x39')],{'$or':_[_0xe4ee('0x2d')](_0x38eaa5,function(_0x2d12f5){if(_0x2d12f5['type']!=='VIRTUAL'){var _0x50ef25={};_0x50ef25[_0x2d12f5[_0xe4ee('0x2c')]]={'$like':'%'+_0x441670[_0xe4ee('0x30')][_0xe4ee('0x3b')]+'%'};return _0x50ef25;}})});}_0x1ccb8d=_[_0xe4ee('0x3c')]({},_0x1ccb8d,_0x441670[_0xe4ee('0x3d')]);var _0x369661={'where':_0x1ccb8d[_0xe4ee('0x39')]};return db['Pause'][_0xe4ee('0x20')](_0x369661)[_0xe4ee('0x26')](function(_0x51d76e){_0x504353[_0xe4ee('0x20')]=_0x51d76e;if(_0x441670[_0xe4ee('0x30')]['includeAll']){_0x1ccb8d[_0xe4ee('0x3e')]=[{'all':!![]}];}return db[_0xe4ee('0x3f')][_0xe4ee('0x40')](_0x1ccb8d);})['then'](function(_0x34ddcb){_0x504353['rows']=_0x34ddcb;return _0x504353;})[_0xe4ee('0x26')](respondWithFilteredResult(_0x3ea59a,_0x1ccb8d))['catch'](handleError(_0x3ea59a,null));};exports['show']=function(_0x48ee49,_0x1b4f6d){var _0x3d6018={'raw':!![],'where':{'id':_0x48ee49[_0xe4ee('0x41')]['id']}},_0x51bf70={};_0x51bf70[_0xe4ee('0x33')]=_[_0xe4ee('0x31')](db['Pause'][_0xe4ee('0x2e')]);_0x51bf70[_0xe4ee('0x30')]=_[_0xe4ee('0x31')](_0x48ee49['query']);_0x51bf70[_0xe4ee('0x32')]=_[_0xe4ee('0x35')](_0x51bf70['model'],_0x51bf70['query']);_0x3d6018['attributes']=_[_0xe4ee('0x35')](_0x51bf70[_0xe4ee('0x33')],qs[_0xe4ee('0x36')](_0x48ee49[_0xe4ee('0x30')]['fields']));_0x3d6018[_0xe4ee('0x34')]=_0x3d6018[_0xe4ee('0x34')]['length']?_0x3d6018[_0xe4ee('0x34')]:_0x51bf70['model'];if(_0x48ee49[_0xe4ee('0x30')][_0xe4ee('0x42')]){_0x3d6018[_0xe4ee('0x3e')]=[{'all':!![]}];}_0x3d6018=_[_0xe4ee('0x3c')]({},_0x3d6018,_0x48ee49[_0xe4ee('0x3d')]);return db[_0xe4ee('0x3f')][_0xe4ee('0x43')](_0x3d6018)[_0xe4ee('0x26')](handleEntityNotFound(_0x1b4f6d,null))[_0xe4ee('0x26')](respondWithResult(_0x1b4f6d,null))['catch'](handleError(_0x1b4f6d,null));};exports['create']=function(_0x3d91d4,_0x4628bf){return db[_0xe4ee('0x3f')][_0xe4ee('0x44')](_0x3d91d4['body'],{})[_0xe4ee('0x26')](function(_0x496efe){var _0x340792=_0x3d91d4['user'][_0xe4ee('0x28')]({'plain':!![]});if(!_0x340792)throw new Error(_0xe4ee('0x45'));if(_0x340792['role']===_0xe4ee('0x46')){var _0x5c2484=_0x496efe[_0xe4ee('0x28')]({'plain':!![]});var _0x55dd24='Pauses';return db['UserProfileSection'][_0xe4ee('0x43')]({'where':{'name':_0x55dd24,'userProfileId':_0x340792['userProfileId']},'raw':!![]})[_0xe4ee('0x26')](function(_0x4272f6){if(_0x4272f6&&_0x4272f6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5c2484[_0xe4ee('0x2c')],'resourceId':_0x5c2484['id'],'type':_0x4272f6[_0xe4ee('0x2c')],'sectionId':_0x4272f6['id']},{})[_0xe4ee('0x26')](function(){return _0x496efe;});}else{return _0x496efe;}})[_0xe4ee('0x47')](function(_0x4972d8){logger[_0xe4ee('0x2a')](_0xe4ee('0x48'),_0x4972d8);throw _0x4972d8;});}return _0x496efe;})['then'](respondWithResult(_0x4628bf,0xc9))[_0xe4ee('0x47')](handleError(_0x4628bf,null));};exports['update']=function(_0x138b36,_0x3a3f6a){if(_0x138b36[_0xe4ee('0x49')]['id']){delete _0x138b36[_0xe4ee('0x49')]['id'];}return db[_0xe4ee('0x3f')][_0xe4ee('0x43')]({'where':{'id':_0x138b36[_0xe4ee('0x41')]['id']}})['then'](handleEntityNotFound(_0x3a3f6a,null))[_0xe4ee('0x26')](saveUpdates(_0x138b36[_0xe4ee('0x49')],null))['then'](respondWithResult(_0x3a3f6a,null))['catch'](handleError(_0x3a3f6a,null));};exports['destroy']=function(_0x44bfce,_0x4ce949){return db['Pause']['find']({'where':{'id':_0x44bfce['params']['id']}})[_0xe4ee('0x26')](handleEntityNotFound(_0x4ce949,null))['then'](removeEntity(_0x4ce949,null))['catch'](handleError(_0x4ce949,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index d5b6b5f..77cc222 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x3d0be4,_0x349f7e){var _0x287405=function(_0x2e39f1){while(--_0x2e39f1){_0x3d0be4['push'](_0x3d0be4['shift']());}};_0x287405(++_0x349f7e);}(_0xf494,0x1c6));var _0x4f49=function(_0x24afde,_0x4ceff2){_0x24afde=_0x24afde-0x0;var _0x22c69b=_0xf494[_0x24afde];return _0x22c69b;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x5262f2,_0x59478f){var _0x7fec6=function(_0x1e128e){while(--_0x1e128e){_0x5262f2['push'](_0x5262f2['shift']());}};_0x7fec6(++_0x59478f);}(_0x326f,0xd1));var _0xf326=function(_0x18ceeb,_0x3f8169){_0x18ceeb=_0x18ceeb-0x0;var _0x136be3=_0x326f[_0x18ceeb];return _0x136be3;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 3db95e4..ac73815 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(_0x208ba9,_0x36b23f){var _0x335560=function(_0xec3e46){while(--_0xec3e46){_0x208ba9['push'](_0x208ba9['shift']());}};_0x335560(++_0x36b23f);}(_0xb10b,0x12a));var _0xbb10=function(_0x18b000,_0x513c1b){_0x18b000=_0x18b000-0x0;var _0xfb7686=_0xb10b[_0x18b000];return _0xfb7686;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x577ea0,_0x3e8658){var _0x5df4fe=function(_0x1a548f){while(--_0x1a548f){_0x577ea0['push'](_0x577ea0['shift']());}};_0x5df4fe(++_0x3e8658);}(_0x7a54,0x106));var _0x47a5=function(_0x6a3989,_0x5585f2){_0x6a3989=_0x6a3989-0x0;var _0x2bccf8=_0x7a54[_0x6a3989];return _0x2bccf8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e4ce8dc..f803311 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 _0x0ba7=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','diskStorage','server/files/plugins','originalname','format','basename','extname','now','post','single','file','upload','webhookPost','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3b3fbf,_0x3162d0){var _0x12f896=function(_0x41db8f){while(--_0x41db8f){_0x3b3fbf['push'](_0x3b3fbf['shift']());}};_0x12f896(++_0x3162d0);}(_0x0ba7,0x16d));var _0x70ba=function(_0x2861fa,_0x19a3be){_0x2861fa=_0x2861fa-0x0;var _0x5720a0=_0x0ba7[_0x2861fa];return _0x5720a0;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),controller[_0x70ba('0xd')]);router[_0x70ba('0x9')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x9')]('/:id/download',auth[_0x70ba('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x70ba('0x10')]({'destination':function(_0x258604,_0xfc4de3,_0x3cf8ab){_0x3cf8ab(null,path['join'](config['root'],_0x70ba('0x11')));},'filename':function(_0x4a2c2e,_0xd6580e,_0x5e94c7){_0xd6580e[_0x70ba('0x12')]=_0xd6580e[_0x70ba('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e94c7(null,util[_0x70ba('0x13')]('%s-%s%s',path[_0x70ba('0x14')](_0xd6580e[_0x70ba('0x12')],path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])),Date[_0x70ba('0x16')](),path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])));}})});router[_0x70ba('0x17')]('/',upload[_0x70ba('0x18')](_0x70ba('0x19')),controller[_0x70ba('0x1a')]);router[_0x70ba('0x17')](_0x70ba('0xc'),controller[_0x70ba('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x70ba('0x1c')]);router[_0x70ba('0x1d')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x1d')]);module[_0x70ba('0x1e')]=router; \ No newline at end of file +var _0xbd50=['extname','post','single','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/webhook','webhookGet','show','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename'];(function(_0x2f6502,_0x703f72){var _0x52013d=function(_0x3931f9){while(--_0x3931f9){_0x2f6502['push'](_0x2f6502['shift']());}};_0x52013d(++_0x703f72);}(_0xbd50,0x196));var _0x0bd5=function(_0x4d05f1,_0x366296){_0x4d05f1=_0x4d05f1-0x0;var _0x487d5d=_0xbd50[_0x4d05f1];return _0x487d5d;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./plugin.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),controller[_0x0bd5('0xc')]);router['get']('/:id',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xa')]('/:id/download',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x210f45,_0x7db86e,_0x4d7d17){_0x4d7d17(null,path[_0x0bd5('0xf')](config[_0x0bd5('0x10')],_0x0bd5('0x11')));},'filename':function(_0x5f49ee,_0x2f7a0c,_0x23982f){_0x2f7a0c[_0x0bd5('0x12')]=_0x2f7a0c[_0x0bd5('0x12')][_0x0bd5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23982f(null,util[_0x0bd5('0x14')](_0x0bd5('0x15'),path[_0x0bd5('0x16')](_0x2f7a0c['originalname'],path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])),Date['now'](),path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])));}})});router[_0x0bd5('0x18')]('/',upload[_0x0bd5('0x19')]('file'),controller[_0x0bd5('0x1a')]);router[_0x0bd5('0x18')](_0x0bd5('0xb'),controller[_0x0bd5('0x1b')]);router[_0x0bd5('0x1c')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1e')]);router[_0x0bd5('0x1f')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1f')]);module[_0x0bd5('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5dccf86..f102917 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 _0x3653=['adminOnly','agentOnly','always','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3653,0x9d));var _0x3365=function(_0x7291bb,_0x51dc64){_0x7291bb=_0x7291bb-0x0;var _0x5bf225=_0x3653[_0x7291bb];return _0x5bf225;};'use strict';var Sequelize=require('sequelize');module[_0x3365('0x0')]={'name':{'type':Sequelize[_0x3365('0x1')]},'type':{'type':Sequelize[_0x3365('0x2')](_0x3365('0x3'),_0x3365('0x4'))},'description':{'type':Sequelize[_0x3365('0x5')]},'version':{'type':Sequelize[_0x3365('0x5')]},'path':{'type':Sequelize[_0x3365('0x1')],'comment':_0x3365('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3365('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x3365('0x8'),_0x3365('0x9'),_0x3365('0xa'),'never'),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x3365('0x1')]},'adminUrl':{'type':Sequelize[_0x3365('0x1')]},'agentUrl':{'type':Sequelize[_0x3365('0x1')]},'scriptName':{'type':Sequelize[_0x3365('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x501b=['ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','STRING','sequelize'];(function(_0x21e877,_0x3cfe80){var _0x1cffdf=function(_0x2ef58e){while(--_0x2ef58e){_0x21e877['push'](_0x21e877['shift']());}};_0x1cffdf(++_0x3cfe80);}(_0x501b,0xe9));var _0xb501=function(_0xdc37c6,_0xc0f850){_0xdc37c6=_0xdc37c6-0x0;var _0x44dc1c=_0x501b[_0xdc37c6];return _0x44dc1c;};'use strict';var Sequelize=require(_0xb501('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb501('0x1')]('html','script')},'description':{'type':Sequelize[_0xb501('0x2')]},'version':{'type':Sequelize[_0xb501('0x2')]},'path':{'type':Sequelize['STRING'],'comment':_0xb501('0x3')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb501('0x4')},'sidebar':{'type':Sequelize[_0xb501('0x1')](_0xb501('0x5'),'agentOnly',_0xb501('0x6'),_0xb501('0x7')),'defaultValue':_0xb501('0x6'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xb501('0x8')]},'adminUrl':{'type':Sequelize[_0xb501('0x8')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xb501('0x8')]},'scriptPath':{'type':Sequelize[_0xb501('0x8')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b1227b3..5a13de1 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 _0x5a41=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','include','catch','show','params','keys','options','find','download','join','root','server/files/plugins','format','createWriteStream','zip','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','dirname','node_modules/**/*','basename','attachments/**/*','finalize','existsSync','Error','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','upload','file','filename','extname','info','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','scriptName','scriptPath','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','destroy','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','hostname','method','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query'];(function(_0x16e8d5,_0x44029a){var _0x10658a=function(_0x127dee){while(--_0x127dee){_0x16e8d5['push'](_0x16e8d5['shift']());}};_0x10658a(++_0x44029a);}(_0x5a41,0x68));var _0x15a4=function(_0x396b44,_0x53777a){_0x396b44=_0x396b44-0x0;var _0x170b96=_0x5a41[_0x396b44];return _0x170b96;};'use strict';var emlformat=require(_0x15a4('0x0'));var rimraf=require(_0x15a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x15a4('0x2'));var BPromise=require(_0x15a4('0x3'));var Mustache=require('mustache');var util=require(_0x15a4('0x4'));var path=require(_0x15a4('0x5'));var sox=require(_0x15a4('0x6'));var csv=require(_0x15a4('0x7'));var ejs=require(_0x15a4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15a4('0x9'));var squel=require(_0x15a4('0xa'));var crypto=require('crypto');var jsforce=require(_0x15a4('0xb'));var deskjs=require(_0x15a4('0xc'));var toCsv=require(_0x15a4('0x7'));var querystring=require(_0x15a4('0xd'));var Papa=require(_0x15a4('0xe'));var extract=require(_0x15a4('0xf'));var rimraf=require(_0x15a4('0x1'));var archiver=require('archiver');var Redis=require(_0x15a4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x15a4('0x11'))(_0x15a4('0x12'));var utils=require(_0x15a4('0x13'));var config=require(_0x15a4('0x14'));var licenseUtil=require(_0x15a4('0x15'));var db=require(_0x15a4('0x16'))['db'];config['redis']=_[_0x15a4('0x17')](config[_0x15a4('0x18')],{'host':_0x15a4('0x19'),'port':0x18eb});var socket=require(_0x15a4('0x1a'))(new Redis(config[_0x15a4('0x18')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x251e00,_0x3bfe31){_0x3bfe31=_0x3bfe31||0xcc;return function(_0x53594a){if(_0x53594a){return _0x251e00[_0x15a4('0x1b')](_0x3bfe31);}return _0x251e00[_0x15a4('0x1c')](_0x3bfe31)[_0x15a4('0x1d')]();};}function respondWithResult(_0x1744ce,_0x5409da){_0x5409da=_0x5409da||0xc8;return function(_0x29613b){if(_0x29613b){return _0x1744ce['status'](_0x5409da)[_0x15a4('0x1e')](_0x29613b);}};}function respondWithFilteredResult(_0x5510b6,_0x14cb93){return function(_0x14f059){if(_0x14f059){var _0x585652=typeof _0x14cb93[_0x15a4('0x1f')]===_0x15a4('0x20')&&typeof _0x14cb93[_0x15a4('0x21')]===_0x15a4('0x20');var _0x343ddb=_0x14f059['count'];var _0x6cbd72=_0x585652?0x0:_0x14cb93[_0x15a4('0x1f')];var _0x277158=_0x585652?_0x14f059[_0x15a4('0x22')]:_0x14cb93['offset']+_0x14cb93[_0x15a4('0x21')];var _0x78bb51;if(_0x277158>=_0x343ddb){_0x277158=_0x343ddb;_0x78bb51=0xc8;}else{_0x78bb51=0xce;}_0x5510b6[_0x15a4('0x1c')](_0x78bb51);return _0x5510b6[_0x15a4('0x23')]('Content-Range',_0x6cbd72+'-'+_0x277158+'/'+_0x343ddb)[_0x15a4('0x1e')](_0x14f059);}return null;};}function patchUpdates(_0xd2adcb){return function(_0x5b42bb){try{jsonpatch[_0x15a4('0x24')](_0x5b42bb,_0xd2adcb,!![]);}catch(_0x1704b2){return BPromise['reject'](_0x1704b2);}return _0x5b42bb[_0x15a4('0x25')]();};}function saveUpdates(_0x4df5a3,_0x1d1b8b){return function(_0x33338e){if(_0x33338e){return _0x33338e['update'](_0x4df5a3)[_0x15a4('0x26')](function(_0x4b250a){return _0x4b250a;});}return null;};}function removeEntity(_0x3243f2,_0x4d6eea){return function(_0x224f21){if(_0x224f21){return _0x224f21['destroy']()[_0x15a4('0x26')](function(){var _0x2d7464=_0x224f21[_0x15a4('0x27')]({'plain':!![]});var _0x453f9c=_0x15a4('0x28');return db[_0x15a4('0x29')]['destroy']({'where':{'type':_0x453f9c,'resourceId':_0x2d7464['id']}})[_0x15a4('0x26')](function(){return _0x224f21;});})[_0x15a4('0x26')](function(){_0x3243f2[_0x15a4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x382850,_0x3dfaa3){return function(_0x4e5c33){if(!_0x4e5c33){_0x382850[_0x15a4('0x1b')](0x194);}return _0x4e5c33;};}function handleError(_0x9fd35f,_0x1255df){_0x1255df=_0x1255df||0x1f4;return function(_0x450cc9){logger[_0x15a4('0x2a')](_0x450cc9[_0x15a4('0x2b')]);if(_0x450cc9[_0x15a4('0x2c')]){delete _0x450cc9['name'];}_0x9fd35f['status'](_0x1255df)[_0x15a4('0x2d')](_0x450cc9);};}exports[_0x15a4('0x2e')]=function(_0x5cb7d5,_0x5a4588){var _0x4b343f={},_0x3dae08={},_0x5051ce={'count':0x0,'rows':[]};var _0x6b0713=_[_0x15a4('0x2f')](db[_0x15a4('0x30')][_0x15a4('0x31')],function(_0x1cac6a){return{'name':_0x1cac6a[_0x15a4('0x32')],'type':_0x1cac6a[_0x15a4('0x33')][_0x15a4('0x34')]};});_0x3dae08[_0x15a4('0x35')]=_[_0x15a4('0x2f')](_0x6b0713,'name');_0x3dae08[_0x15a4('0x36')]=_['keys'](_0x5cb7d5[_0x15a4('0x36')]);_0x3dae08['filters']=_[_0x15a4('0x37')](_0x3dae08[_0x15a4('0x35')],_0x3dae08[_0x15a4('0x36')]);_0x4b343f['attributes']=_[_0x15a4('0x37')](_0x3dae08[_0x15a4('0x35')],qs[_0x15a4('0x38')](_0x5cb7d5[_0x15a4('0x36')][_0x15a4('0x38')]));_0x4b343f['attributes']=_0x4b343f[_0x15a4('0x39')][_0x15a4('0x3a')]?_0x4b343f[_0x15a4('0x39')]:_0x3dae08[_0x15a4('0x35')];if(!_0x5cb7d5['query'][_0x15a4('0x3b')]('nolimit')){_0x4b343f['limit']=qs[_0x15a4('0x21')](_0x5cb7d5[_0x15a4('0x36')][_0x15a4('0x21')]);_0x4b343f[_0x15a4('0x1f')]=qs[_0x15a4('0x1f')](_0x5cb7d5[_0x15a4('0x36')]['offset']);}_0x4b343f[_0x15a4('0x3c')]=qs[_0x15a4('0x3d')](_0x5cb7d5[_0x15a4('0x36')][_0x15a4('0x3d')]);_0x4b343f[_0x15a4('0x3e')]=qs[_0x15a4('0x3f')](_[_0x15a4('0x40')](_0x5cb7d5[_0x15a4('0x36')],_0x3dae08[_0x15a4('0x3f')]),_0x6b0713);if(_0x5cb7d5[_0x15a4('0x36')][_0x15a4('0x41')]){_0x4b343f[_0x15a4('0x3e')]=_['merge'](_0x4b343f[_0x15a4('0x3e')],{'$or':_[_0x15a4('0x2f')](_0x6b0713,function(_0x3146ef){if(_0x3146ef[_0x15a4('0x33')]!=='VIRTUAL'){var _0x16dbb8={};_0x16dbb8[_0x3146ef[_0x15a4('0x2c')]]={'$like':'%'+_0x5cb7d5[_0x15a4('0x36')][_0x15a4('0x41')]+'%'};return _0x16dbb8;}})});}_0x4b343f=_[_0x15a4('0x42')]({},_0x4b343f,_0x5cb7d5['options']);var _0x36e239={'where':_0x4b343f[_0x15a4('0x3e')]};return db[_0x15a4('0x30')][_0x15a4('0x22')](_0x36e239)['then'](function(_0x4cb8fe){_0x5051ce[_0x15a4('0x22')]=_0x4cb8fe;if(_0x5cb7d5[_0x15a4('0x36')][_0x15a4('0x43')]){_0x4b343f[_0x15a4('0x44')]=[{'all':!![]}];}return db[_0x15a4('0x30')]['findAll'](_0x4b343f);})['then'](function(_0x5ae0a){_0x5051ce['rows']=_0x5ae0a;return _0x5051ce;})['then'](respondWithFilteredResult(_0x5a4588,_0x4b343f))[_0x15a4('0x45')](handleError(_0x5a4588,null));};exports[_0x15a4('0x46')]=function(_0x3f5586,_0x455d2e){var _0x13dda3={'raw':!![],'where':{'id':_0x3f5586[_0x15a4('0x47')]['id']}},_0x15931b={};_0x15931b['model']=_[_0x15a4('0x48')](db[_0x15a4('0x30')][_0x15a4('0x31')]);_0x15931b['query']=_[_0x15a4('0x48')](_0x3f5586[_0x15a4('0x36')]);_0x15931b[_0x15a4('0x3f')]=_['intersection'](_0x15931b[_0x15a4('0x35')],_0x15931b[_0x15a4('0x36')]);_0x13dda3['attributes']=_[_0x15a4('0x37')](_0x15931b[_0x15a4('0x35')],qs[_0x15a4('0x38')](_0x3f5586[_0x15a4('0x36')][_0x15a4('0x38')]));_0x13dda3[_0x15a4('0x39')]=_0x13dda3['attributes']['length']?_0x13dda3['attributes']:_0x15931b['model'];if(_0x3f5586[_0x15a4('0x36')]['includeAll']){_0x13dda3[_0x15a4('0x44')]=[{'all':!![]}];}_0x13dda3=_[_0x15a4('0x42')]({},_0x13dda3,_0x3f5586[_0x15a4('0x49')]);return db[_0x15a4('0x30')][_0x15a4('0x4a')](_0x13dda3)['then'](handleEntityNotFound(_0x455d2e,null))[_0x15a4('0x26')](respondWithResult(_0x455d2e,null))[_0x15a4('0x45')](handleError(_0x455d2e,null));};exports[_0x15a4('0x4b')]=function(_0x47ab1a,_0x23a427,_0x5f4f5a){return db[_0x15a4('0x30')][_0x15a4('0x4a')]({'where':{'id':_0x47ab1a['params']['id']},'attributes':[_0x15a4('0x2c'),_0x15a4('0x5')],'raw':!![]})[_0x15a4('0x26')](handleEntityNotFound(_0x23a427,null))[_0x15a4('0x26')](function(_0x3bced6){if(_0x3bced6){var _0xc7bc93=path[_0x15a4('0x4c')](config[_0x15a4('0x4d')],_0x15a4('0x4e'),util[_0x15a4('0x4f')]('%s.zip',path['basename'](_0x3bced6[_0x15a4('0x5')])));var _0x5068e7=fs[_0x15a4('0x50')](_0xc7bc93);var _0x48970b=archiver(_0x15a4('0x51'),{'zlib':{'level':0x9}});_0x48970b['on']('warning',function(_0x362b07){if(_0x362b07[_0x15a4('0x52')]===_0x15a4('0x53')){logger[_0x15a4('0x2a')](_0x362b07);}else{throw new db['Sequelize']['Error'](_0x15a4('0x54'));}});_0x48970b['on'](_0x15a4('0x2a'),function(_0x42bb10){throw new db[(_0x15a4('0x55'))]['Error'](_0x15a4('0x54'));});_0x48970b[_0x15a4('0x56')](_0x5068e7);_0x48970b[_0x15a4('0x57')]('**/*',{'cwd':path[_0x15a4('0x4c')](config['root'],_0x15a4('0x4e'),path[_0x15a4('0x58')](_0x3bced6[_0x15a4('0x5')])),'ignore':[path[_0x15a4('0x4c')](path['basename'](_0x3bced6[_0x15a4('0x5')]),_0x15a4('0x59')),path[_0x15a4('0x4c')](path[_0x15a4('0x5a')](_0x3bced6[_0x15a4('0x5')]),_0x15a4('0x5b'))],'nodir':!![]})[_0x15a4('0x5c')]();_0x5068e7['on']('close',function(){if(!fs[_0x15a4('0x5d')](_0xc7bc93)){throw new db[(_0x15a4('0x55'))][(_0x15a4('0x5e'))](_0x15a4('0x5f'));}return _0x23a427[_0x15a4('0x4b')](_0xc7bc93,util[_0x15a4('0x4f')](_0x15a4('0x60'),path['basename'](_0x3bced6[_0x15a4('0x5')])),function(_0x99007f){if(_0x99007f){throw new db['Sequelize'][(_0x15a4('0x5e'))](_0x15a4('0x61'));}fs[_0x15a4('0x62')](_0xc7bc93);logger['info'](_0x15a4('0x63'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x15a4('0x45')](handleError(_0x23a427,null));};exports[_0x15a4('0x64')]=function(_0x234860,_0x45af75,_0x1a9ca4){var _0x51dbb9=path[_0x15a4('0x5a')](_0x234860[_0x15a4('0x65')][_0x15a4('0x66')],path[_0x15a4('0x67')](_0x234860['file'][_0x15a4('0x66')]));var _0x3b0551=path[_0x15a4('0x4c')](config[_0x15a4('0x4d')],'server/files/plugins',_0x234860[_0x15a4('0x65')][_0x15a4('0x66')]);var _0x3d9ff1=path[_0x15a4('0x4c')](config[_0x15a4('0x4d')],_0x15a4('0x4e'),_0x51dbb9);logger[_0x15a4('0x68')](_0x15a4('0x69'),_0x3b0551);logger[_0x15a4('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x3d9ff1);try{fs[_0x15a4('0x6a')](_0x3b0551,parseInt('0777',0x8));extract(_0x3b0551,{'dir':_0x3d9ff1},function(_0x103080){if(_0x103080){logger[_0x15a4('0x2a')](_0x103080);handleError(_0x103080,!![]);};var _0x11c670=fs[_0x15a4('0x6b')](_0x3d9ff1);if(_0x11c670[_0x15a4('0x3a')]>0x1){removeReferences(_0x3b0551,_0x3d9ff1);logger[_0x15a4('0x2a')]('Invalid\x20plugin\x20structure');return _0x1a9ca4(new Error(_0x15a4('0x6c')));}var _0x3986b8=fs[_0x15a4('0x6d')](path[_0x15a4('0x4c')](_0x3d9ff1,_0x11c670[0x0]));if(_0x3986b8[_0x15a4('0x6e')]()){removeReferences(_0x3b0551,_0x3d9ff1);logger[_0x15a4('0x2a')](_0x15a4('0x6c'));return _0x1a9ca4(new Error(_0x15a4('0x6c')));}if(_0x3986b8[_0x15a4('0x6f')]()){var _0x29a264=fs[_0x15a4('0x6b')](path[_0x15a4('0x4c')](_0x3d9ff1,_0x11c670[0x0]));if(_0x29a264['length']===0x0){removeReferences(_0x3b0551,_0x3d9ff1);logger[_0x15a4('0x2a')](_0x15a4('0x6c'));return _0x1a9ca4(new Error(_0x15a4('0x6c')));}var _0xe37339=_0x29a264['some'](function(_0x30ae32){return _0x30ae32===_0x15a4('0x70');});if(!_0xe37339){return _0x1a9ca4(new Error(_0x15a4('0x71')));}var _0x2e90db=fs[_0x15a4('0x72')](path[_0x15a4('0x4c')](_0x3d9ff1,_0x11c670[0x0],'manifest.json'));var _0x45bae2=JSON[_0x15a4('0x73')](_0x2e90db);if(_0x15a4('0x20')==typeof _0x45bae2[_0x15a4('0x2c')]){return _0x1a9ca4(new Error(_0x15a4('0x74')));}if('undefined'==typeof _0x45bae2[_0x15a4('0x33')]){return _0x1a9ca4(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x15a4('0x20')==typeof _0x45bae2[_0x15a4('0x75')]){return _0x1a9ca4(new Error(_0x15a4('0x76')));}if('undefined'==typeof _0x45bae2[_0x15a4('0x77')]){return _0x1a9ca4(new Error(_0x15a4('0x78')));}if(_0x45bae2['type']===_0x15a4('0x79')){if('undefined'==typeof _0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')]){return _0x1a9ca4(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x15a4('0x20')==typeof _0x45bae2[_0x15a4('0x77')]['views'][_0x15a4('0x7b')]&&_0x15a4('0x20')==typeof _0x45bae2[_0x15a4('0x77')]['views']['agent']){return _0x1a9ca4(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x45bae2[_0x15a4('0x33')]==='script'){if('undefined'==typeof _0x45bae2[_0x15a4('0x77')][_0x15a4('0x7c')]){return _0x1a9ca4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x15a4('0x20')==typeof _0x45bae2[_0x15a4('0x77')][_0x15a4('0x7d')]){return _0x1a9ca4(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1a9ca4(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x199c02=_0x45bae2[_0x15a4('0x2c')];var _0x35433b=_0x45bae2[_0x15a4('0x7e')];var _0x1f6b52=_0x45bae2[_0x15a4('0x33')];var _0x23534d=_0x45bae2[_0x15a4('0x7f')]?_0x45bae2[_0x15a4('0x7f')]:_0x15a4('0x80');var _0x51b931=_0x45bae2[_0x15a4('0x81')]?_0x45bae2[_0x15a4('0x81')]:'icon-apps';var _0x25dad6='';var _0x355942='';var _0x206fae='';var _0x28541e='';var _0xf5617d=_0x45bae2[_0x15a4('0x75')];if(_0x1f6b52===_0x15a4('0x79')){if(_0x15a4('0x20')!=typeof _0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')]['admin']){var _0xcc3758=_0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')][_0x15a4('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x15a4('0x82')](_0xcc3758)){_0x25dad6=path[_0x15a4('0x4c')]('plugins',_0x51dbb9,_0x11c670[0x0],_0xcc3758);}else{_0x25dad6=_0xcc3758;}}else{logger[_0x15a4('0x68')](_0x15a4('0x83'));}if(_0x15a4('0x20')!=typeof _0x45bae2['parameters']['views'][_0x15a4('0x84')]){var _0x16ad09=_0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')][_0x15a4('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x15a4('0x82')](_0x16ad09)){_0x355942=path['join'](_0x15a4('0x85'),_0x51dbb9,_0x11c670[0x0],_0x16ad09);}else{_0x355942=_0x16ad09;}}else{logger[_0x15a4('0x68')](_0x15a4('0x86'));}}else if(_0x1f6b52==='script'){_0x206fae=_0x45bae2[_0x15a4('0x77')][_0x15a4('0x7c')];_0x28541e=_0x45bae2[_0x15a4('0x77')][_0x15a4('0x7d')];if(_0x15a4('0x20')!=typeof _0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')]){if(_0x15a4('0x20')!=typeof _0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')][_0x15a4('0x7b')]){var _0xcc3758=_0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x15a4('0x82')](_0xcc3758)){_0x25dad6=path['join'](_0x15a4('0x85'),_0x51dbb9,_0x11c670[0x0],_0xcc3758);}else{_0x25dad6=_0xcc3758;}}if(_0x15a4('0x20')!=typeof _0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')][_0x15a4('0x84')]){var _0x16ad09=_0x45bae2[_0x15a4('0x77')][_0x15a4('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x15a4('0x82')](_0x16ad09)){_0x355942=path['join'](_0x15a4('0x85'),_0x51dbb9,_0x11c670[0x0],_0x16ad09);}else{_0x355942=_0x16ad09;}}}}var _0x5e3e94={'name':_0x199c02,'description':_0x35433b,'path':path[_0x15a4('0x4c')](_0x51dbb9,_0x11c670[0x0]),'type':_0x1f6b52,'sidebar':_0x23534d,'icon':_0x51b931,'adminUrl':_0x25dad6,'agentUrl':_0x355942,'scriptName':_0x206fae,'scriptPath':_0x28541e,'version':_0xf5617d};removeReferences(_0x3b0551,null);return db[_0x15a4('0x30')][_0x15a4('0x87')](_0x5e3e94)[_0x15a4('0x26')](function(_0x3a8b84){var _0x3b89b9={'role':_0x234860[_0x15a4('0x88')][_0x15a4('0x89')],'userProfileId':_0x234860[_0x15a4('0x88')][_0x15a4('0x8a')]};if(!_0x3b89b9)throw new Error(_0x15a4('0x8b'));if(_0x3b89b9[_0x15a4('0x89')]==='user'){var _0x43f3dc=_0x3a8b84['get']({'plain':!![]});return db[_0x15a4('0x8c')][_0x15a4('0x4a')]({'where':{'name':'Plugins','userProfileId':_0x3b89b9[_0x15a4('0x8a')]},'raw':!![]})[_0x15a4('0x26')](function(_0x4f73dc){if(_0x4f73dc&&_0x4f73dc['autoAssociation']===0x0){return db[_0x15a4('0x29')][_0x15a4('0x87')]({'name':_0x43f3dc['name'],'resourceId':_0x43f3dc['id'],'type':_0x4f73dc[_0x15a4('0x2c')],'sectionId':_0x4f73dc['id']},{})[_0x15a4('0x26')](function(){return _0x3a8b84;});}else{return _0x3a8b84;}})['catch'](function(_0x4ba6a7){logger[_0x15a4('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ba6a7);throw _0x4ba6a7;});}return _0x3a8b84;})[_0x15a4('0x26')](respondWithResult(_0x45af75,null))[_0x15a4('0x45')](handleError(_0x45af75,null));}});}catch(_0xe92558){_0x45af75['status'](0x1f4)[_0x15a4('0x2d')](_0xe92558);}};function removeReferences(_0x308da1,_0xb92ad7){try{if(_0x308da1){fs[_0x15a4('0x62')](_0x308da1);logger['info'](_0x15a4('0x8d'));}if(_0xb92ad7){rimraf(_0xb92ad7,function(){});logger[_0x15a4('0x68')](_0x15a4('0x8e'));}}catch(_0x46110d){logger[_0x15a4('0x2a')](_0x46110d);}}exports[_0x15a4('0x8f')]=function(_0x54f51b,_0x4cd3c1,_0xda2095){return db[_0x15a4('0x30')][_0x15a4('0x4a')]({'where':{'id':_0x54f51b[_0x15a4('0x47')]['id']}})[_0x15a4('0x26')](handleEntityNotFound(_0x4cd3c1,null))[_0x15a4('0x26')](saveUpdates(_0x54f51b[_0x15a4('0x88')],null))[_0x15a4('0x26')](respondWithResult(_0x4cd3c1,null))[_0x15a4('0x45')](handleError(_0x4cd3c1,null));};exports['delete']=function(_0x10b79d,_0x4dcd49,_0x4895c8){return db[_0x15a4('0x30')][_0x15a4('0x4a')]({'where':{'id':_0x10b79d['params']['id']}})[_0x15a4('0x26')](function(_0x4c29a7){if(_0x4c29a7){return _0x4c29a7[_0x15a4('0x90')]();}})['then'](function(_0x43c4ef){rimraf(path[_0x15a4('0x4c')](config[_0x15a4('0x4d')],_0x15a4('0x4e'),path[_0x15a4('0x58')](_0x43c4ef[_0x15a4('0x5')])),function(){});return _0x43c4ef;})['then'](handleEntityNotFound(_0x4dcd49,null))['then'](respondWithStatusCode(_0x4dcd49,null))[_0x15a4('0x45')](handleError(_0x4dcd49,null));};exports[_0x15a4('0x91')]=function(_0x3a099a,_0x59c712,_0x50c014){return BPromise[_0x15a4('0x92')]()[_0x15a4('0x26')](function(){if(!_0x3a099a[_0x15a4('0x36')][_0x15a4('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3a099a[_0x15a4('0x36')]['port']){throw new Error(_0x15a4('0x93'));}var _0x12e2da=_0x3a099a[_0x15a4('0x36')]['hostname']?_0x3a099a[_0x15a4('0x36')]['hostname']+':'+_0x3a099a[_0x15a4('0x36')][_0x15a4('0x94')]:_0x15a4('0x95')+_0x3a099a[_0x15a4('0x36')][_0x15a4('0x94')];var _0x4c3c44=_0x3a099a[_0x15a4('0x36')][_0x15a4('0x1e')]?_0x3a099a[_0x15a4('0x36')]['json']:!![];var _0x2469c5=_0x3a099a['query']['encoding']?_0x3a099a[_0x15a4('0x36')][_0x15a4('0x96')]:null;var _0x34a34c={'method':_0x3a099a['method'],'uri':util[_0x15a4('0x4f')](_0x15a4('0x97'),_0x12e2da,_0x3a099a[_0x15a4('0x36')][_0x15a4('0x5')]),'json':_0x4c3c44,'resolveWithFullResponse':!![],'encoding':_0x2469c5,'qs':_0x3a099a[_0x15a4('0x36')]};if(_0x3a099a[_0x15a4('0x98')]){_0x34a34c['headers']=_0x3a099a[_0x15a4('0x98')];if(_0x34a34c[_0x15a4('0x98')][_0x15a4('0x99')]){delete _0x34a34c[_0x15a4('0x98')]['content-length'];}}if(_0x34a34c[_0x15a4('0x98')][_0x15a4('0x9a')]){delete _0x34a34c[_0x15a4('0x98')][_0x15a4('0x9a')];}return rp(_0x34a34c);})['then'](function(_0x1c6018){if(_0x1c6018){_0x59c712['set'](_0x1c6018[_0x15a4('0x98')]);logger[_0x15a4('0x68')](_0x1c6018['body']);if(_['endsWith'](_0x3a099a[_0x15a4('0x36')][_0x15a4('0x5')],_0x15a4('0x4b'))&&_0x1c6018['statusCode']==0x1f4){return _0x59c712['sendStatus'](_0x1c6018[_0x15a4('0x9b')]);}else{return _0x59c712[_0x15a4('0x1c')](_0x1c6018[_0x15a4('0x9b')])[_0x15a4('0x2d')](_0x1c6018['body']);}}else{return _0x59c712[_0x15a4('0x1b')](0xc8);}})[_0x15a4('0x45')](handleError(_0x59c712,null));};exports[_0x15a4('0x9c')]=function(_0x54e931,_0x3aa764,_0x2325f9){return BPromise[_0x15a4('0x92')]()['then'](function(){if(!_0x54e931[_0x15a4('0x36')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x54e931[_0x15a4('0x36')][_0x15a4('0x94')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x112ed3=_0x54e931['query'][_0x15a4('0x9d')]?_0x54e931['query'][_0x15a4('0x9d')]+':'+_0x54e931[_0x15a4('0x36')][_0x15a4('0x94')]:_0x15a4('0x95')+_0x54e931[_0x15a4('0x36')][_0x15a4('0x94')];var _0x32649f=_0x54e931[_0x15a4('0x36')][_0x15a4('0x1e')]?_0x54e931[_0x15a4('0x36')][_0x15a4('0x1e')]:!![];var _0xee4166=_0x54e931[_0x15a4('0x36')][_0x15a4('0x96')]?_0x54e931[_0x15a4('0x36')][_0x15a4('0x96')]:null;var _0x1c319a={'method':_0x54e931[_0x15a4('0x9e')],'uri':util['format']('%s%s',_0x112ed3,_0x54e931[_0x15a4('0x36')][_0x15a4('0x5')]),'json':_0x32649f,'resolveWithFullResponse':!![],'encoding':_0xee4166,'body':_0x54e931[_0x15a4('0x88')]};if(_0x54e931['headers']){_0x1c319a[_0x15a4('0x98')]=_0x54e931[_0x15a4('0x98')];if(_0x1c319a[_0x15a4('0x98')][_0x15a4('0x99')]){delete _0x1c319a['headers'][_0x15a4('0x99')];}}if(_0x1c319a[_0x15a4('0x98')]['content-type']){delete _0x1c319a[_0x15a4('0x98')][_0x15a4('0x9a')];}return rp(_0x1c319a);})['then'](function(_0x21a968){if(_0x21a968){_0x3aa764[_0x15a4('0x23')](_0x21a968[_0x15a4('0x98')]);logger[_0x15a4('0x68')](_0x21a968['body']);return _0x3aa764[_0x15a4('0x1c')](_0x21a968[_0x15a4('0x9b')])[_0x15a4('0x2d')](_0x21a968[_0x15a4('0x88')]);}else{return _0x3aa764[_0x15a4('0x1b')](0xc8);}})[_0x15a4('0x45')](handleError(_0x3aa764,null));}; \ No newline at end of file +var _0xee6f=['fields','length','nolimit','limit','order','sort','filters','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','catch','show','params','find','download','root','server/files/plugins','format','basename','warning','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','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','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon-apps','html','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','user','UserProfileSection','Plugins','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','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','extract-zip','archiver','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes'];(function(_0x1d6476,_0x221030){var _0x6b1f79=function(_0x4bc1cd){while(--_0x4bc1cd){_0x1d6476['push'](_0x1d6476['shift']());}};_0x6b1f79(++_0x221030);}(_0xee6f,0x119));var _0xfee6=function(_0x566c40,_0x3c2178){_0x566c40=_0x566c40-0x0;var _0x5152ec=_0xee6f[_0x566c40];return _0x5152ec;};'use strict';var emlformat=require(_0xfee6('0x0'));var rimraf=require(_0xfee6('0x1'));var zipdir=require(_0xfee6('0x2'));var jsonpatch=require(_0xfee6('0x3'));var rp=require(_0xfee6('0x4'));var moment=require(_0xfee6('0x5'));var BPromise=require(_0xfee6('0x6'));var Mustache=require(_0xfee6('0x7'));var util=require(_0xfee6('0x8'));var path=require(_0xfee6('0x9'));var sox=require(_0xfee6('0xa'));var csv=require(_0xfee6('0xb'));var ejs=require(_0xfee6('0xc'));var fs=require('fs');var fs_extra=require(_0xfee6('0xd'));var _=require(_0xfee6('0xe'));var squel=require(_0xfee6('0xf'));var crypto=require(_0xfee6('0x10'));var jsforce=require(_0xfee6('0x11'));var deskjs=require(_0xfee6('0x12'));var toCsv=require(_0xfee6('0xb'));var querystring=require(_0xfee6('0x13'));var Papa=require('papaparse');var extract=require(_0xfee6('0x14'));var rimraf=require(_0xfee6('0x1'));var archiver=require(_0xfee6('0x15'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfee6('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfee6('0x17'));var logger=require(_0xfee6('0x18'))(_0xfee6('0x19'));var utils=require(_0xfee6('0x1a'));var config=require(_0xfee6('0x1b'));var licenseUtil=require(_0xfee6('0x1c'));var db=require(_0xfee6('0x1d'))['db'];config['redis']=_[_0xfee6('0x1e')](config[_0xfee6('0x1f')],{'host':_0xfee6('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0xfee6('0x21')](socket);function respondWithStatusCode(_0x3dbcc2,_0x4d95e7){_0x4d95e7=_0x4d95e7||0xcc;return function(_0x4ebc5c){if(_0x4ebc5c){return _0x3dbcc2[_0xfee6('0x22')](_0x4d95e7);}return _0x3dbcc2[_0xfee6('0x23')](_0x4d95e7)[_0xfee6('0x24')]();};}function respondWithResult(_0x257a53,_0x5f0abd){_0x5f0abd=_0x5f0abd||0xc8;return function(_0x58937a){if(_0x58937a){return _0x257a53['status'](_0x5f0abd)[_0xfee6('0x25')](_0x58937a);}};}function respondWithFilteredResult(_0x26764e,_0x3a7bd3){return function(_0x1833a5){if(_0x1833a5){var _0x4f5134=typeof _0x3a7bd3['offset']===_0xfee6('0x26')&&typeof _0x3a7bd3['limit']==='undefined';var _0x311d4a=_0x1833a5[_0xfee6('0x27')];var _0x42e606=_0x4f5134?0x0:_0x3a7bd3[_0xfee6('0x28')];var _0x471f7b=_0x4f5134?_0x1833a5[_0xfee6('0x27')]:_0x3a7bd3[_0xfee6('0x28')]+_0x3a7bd3['limit'];var _0x59e00d;if(_0x471f7b>=_0x311d4a){_0x471f7b=_0x311d4a;_0x59e00d=0xc8;}else{_0x59e00d=0xce;}_0x26764e['status'](_0x59e00d);return _0x26764e[_0xfee6('0x29')](_0xfee6('0x2a'),_0x42e606+'-'+_0x471f7b+'/'+_0x311d4a)[_0xfee6('0x25')](_0x1833a5);}return null;};}function patchUpdates(_0x38935b){return function(_0x104d8){try{jsonpatch[_0xfee6('0x2b')](_0x104d8,_0x38935b,!![]);}catch(_0x2f811b){return BPromise[_0xfee6('0x2c')](_0x2f811b);}return _0x104d8[_0xfee6('0x2d')]();};}function saveUpdates(_0x407cd4,_0x3fbea7){return function(_0xe5ad56){if(_0xe5ad56){return _0xe5ad56[_0xfee6('0x2e')](_0x407cd4)[_0xfee6('0x2f')](function(_0x55523a){return _0x55523a;});}return null;};}function removeEntity(_0x3f1c32,_0x4435b3){return function(_0x5531a9){if(_0x5531a9){return _0x5531a9[_0xfee6('0x30')]()[_0xfee6('0x2f')](function(){var _0x5ec196=_0x5531a9[_0xfee6('0x31')]({'plain':!![]});var _0xdaafd5='Plugins';return db['UserProfileResource'][_0xfee6('0x30')]({'where':{'type':_0xdaafd5,'resourceId':_0x5ec196['id']}})['then'](function(){return _0x5531a9;});})[_0xfee6('0x2f')](function(){_0x3f1c32['status'](0xcc)[_0xfee6('0x24')]();});}};}function handleEntityNotFound(_0x4c9a81,_0x1a9bb6){return function(_0x5cadca){if(!_0x5cadca){_0x4c9a81[_0xfee6('0x22')](0x194);}return _0x5cadca;};}function handleError(_0x434116,_0x35f1c7){_0x35f1c7=_0x35f1c7||0x1f4;return function(_0x137305){logger['error'](_0x137305[_0xfee6('0x32')]);if(_0x137305[_0xfee6('0x33')]){delete _0x137305['name'];}_0x434116[_0xfee6('0x23')](_0x35f1c7)[_0xfee6('0x34')](_0x137305);};}exports[_0xfee6('0x35')]=function(_0x47e8c6,_0x8b5f26){var _0x4b0059={},_0x240f10={},_0xdbe700={'count':0x0,'rows':[]};var _0x3c919a=_[_0xfee6('0x36')](db[_0xfee6('0x37')][_0xfee6('0x38')],function(_0x43114f){return{'name':_0x43114f[_0xfee6('0x39')],'type':_0x43114f[_0xfee6('0x3a')][_0xfee6('0x3b')]};});_0x240f10[_0xfee6('0x3c')]=_['map'](_0x3c919a,'name');_0x240f10['query']=_[_0xfee6('0x3d')](_0x47e8c6[_0xfee6('0x3e')]);_0x240f10['filters']=_[_0xfee6('0x3f')](_0x240f10[_0xfee6('0x3c')],_0x240f10[_0xfee6('0x3e')]);_0x4b0059[_0xfee6('0x40')]=_['intersection'](_0x240f10['model'],qs[_0xfee6('0x41')](_0x47e8c6[_0xfee6('0x3e')][_0xfee6('0x41')]));_0x4b0059[_0xfee6('0x40')]=_0x4b0059[_0xfee6('0x40')][_0xfee6('0x42')]?_0x4b0059['attributes']:_0x240f10[_0xfee6('0x3c')];if(!_0x47e8c6['query']['hasOwnProperty'](_0xfee6('0x43'))){_0x4b0059[_0xfee6('0x44')]=qs[_0xfee6('0x44')](_0x47e8c6[_0xfee6('0x3e')]['limit']);_0x4b0059[_0xfee6('0x28')]=qs[_0xfee6('0x28')](_0x47e8c6[_0xfee6('0x3e')][_0xfee6('0x28')]);}_0x4b0059[_0xfee6('0x45')]=qs[_0xfee6('0x46')](_0x47e8c6[_0xfee6('0x3e')]['sort']);_0x4b0059['where']=qs[_0xfee6('0x47')](_[_0xfee6('0x48')](_0x47e8c6[_0xfee6('0x3e')],_0x240f10[_0xfee6('0x47')]),_0x3c919a);if(_0x47e8c6[_0xfee6('0x3e')][_0xfee6('0x49')]){_0x4b0059['where']=_[_0xfee6('0x4a')](_0x4b0059['where'],{'$or':_[_0xfee6('0x36')](_0x3c919a,function(_0xe9df52){if(_0xe9df52[_0xfee6('0x3a')]!==_0xfee6('0x4b')){var _0x33cae9={};_0x33cae9[_0xe9df52['name']]={'$like':'%'+_0x47e8c6[_0xfee6('0x3e')][_0xfee6('0x49')]+'%'};return _0x33cae9;}})});}_0x4b0059=_[_0xfee6('0x4a')]({},_0x4b0059,_0x47e8c6['options']);var _0x4273a4={'where':_0x4b0059[_0xfee6('0x4c')]};return db[_0xfee6('0x37')][_0xfee6('0x27')](_0x4273a4)['then'](function(_0x315b0f){_0xdbe700['count']=_0x315b0f;if(_0x47e8c6[_0xfee6('0x3e')][_0xfee6('0x4d')]){_0x4b0059[_0xfee6('0x4e')]=[{'all':!![]}];}return db[_0xfee6('0x37')][_0xfee6('0x4f')](_0x4b0059);})[_0xfee6('0x2f')](function(_0x6357f2){_0xdbe700['rows']=_0x6357f2;return _0xdbe700;})['then'](respondWithFilteredResult(_0x8b5f26,_0x4b0059))[_0xfee6('0x50')](handleError(_0x8b5f26,null));};exports[_0xfee6('0x51')]=function(_0x1b8f2a,_0x49c925){var _0x3f4a37={'raw':!![],'where':{'id':_0x1b8f2a[_0xfee6('0x52')]['id']}},_0xb532c6={};_0xb532c6['model']=_['keys'](db['Plugin']['rawAttributes']);_0xb532c6[_0xfee6('0x3e')]=_[_0xfee6('0x3d')](_0x1b8f2a[_0xfee6('0x3e')]);_0xb532c6[_0xfee6('0x47')]=_[_0xfee6('0x3f')](_0xb532c6[_0xfee6('0x3c')],_0xb532c6[_0xfee6('0x3e')]);_0x3f4a37['attributes']=_[_0xfee6('0x3f')](_0xb532c6[_0xfee6('0x3c')],qs[_0xfee6('0x41')](_0x1b8f2a[_0xfee6('0x3e')][_0xfee6('0x41')]));_0x3f4a37[_0xfee6('0x40')]=_0x3f4a37[_0xfee6('0x40')][_0xfee6('0x42')]?_0x3f4a37[_0xfee6('0x40')]:_0xb532c6['model'];if(_0x1b8f2a[_0xfee6('0x3e')][_0xfee6('0x4d')]){_0x3f4a37[_0xfee6('0x4e')]=[{'all':!![]}];}_0x3f4a37=_[_0xfee6('0x4a')]({},_0x3f4a37,_0x1b8f2a['options']);return db[_0xfee6('0x37')][_0xfee6('0x53')](_0x3f4a37)[_0xfee6('0x2f')](handleEntityNotFound(_0x49c925,null))['then'](respondWithResult(_0x49c925,null))[_0xfee6('0x50')](handleError(_0x49c925,null));};exports[_0xfee6('0x54')]=function(_0x354117,_0x30f7e3,_0x31064f){return db[_0xfee6('0x37')]['find']({'where':{'id':_0x354117['params']['id']},'attributes':['name','path'],'raw':!![]})[_0xfee6('0x2f')](handleEntityNotFound(_0x30f7e3,null))['then'](function(_0x101f28){if(_0x101f28){var _0x358a19=path['join'](config[_0xfee6('0x55')],_0xfee6('0x56'),util[_0xfee6('0x57')]('%s.zip',path[_0xfee6('0x58')](_0x101f28[_0xfee6('0x9')])));var _0x2cc474=fs['createWriteStream'](_0x358a19);var _0x2a5ac1=archiver('zip',{'zlib':{'level':0x9}});_0x2a5ac1['on'](_0xfee6('0x59'),function(_0x4149dc){if(_0x4149dc['code']==='ENOENT'){logger[_0xfee6('0x5a')](_0x4149dc);}else{throw new db['Sequelize'][(_0xfee6('0x5b'))](_0xfee6('0x5c'));}});_0x2a5ac1['on']('error',function(_0x14647a){throw new db[(_0xfee6('0x5d'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2a5ac1[_0xfee6('0x5e')](_0x2cc474);_0x2a5ac1[_0xfee6('0x5f')](_0xfee6('0x60'),{'cwd':path[_0xfee6('0x61')](config['root'],_0xfee6('0x56'),path['dirname'](_0x101f28['path'])),'ignore':[path[_0xfee6('0x61')](path['basename'](_0x101f28['path']),_0xfee6('0x62')),path[_0xfee6('0x61')](path['basename'](_0x101f28[_0xfee6('0x9')]),_0xfee6('0x63'))],'nodir':!![]})[_0xfee6('0x64')]();_0x2cc474['on'](_0xfee6('0x65'),function(){if(!fs[_0xfee6('0x66')](_0x358a19)){throw new db['Sequelize'][(_0xfee6('0x5b'))](_0xfee6('0x67'));}return _0x30f7e3[_0xfee6('0x54')](_0x358a19,util[_0xfee6('0x57')]('%s.zip',path['basename'](_0x101f28['path'])),function(_0x23acd7){if(_0x23acd7){throw new db['Sequelize']['Error'](_0xfee6('0x68'));}fs[_0xfee6('0x69')](_0x358a19);logger[_0xfee6('0x6a')](_0xfee6('0x6b'));logger[_0xfee6('0x6a')](_0xfee6('0x6c'));});});}return null;})[_0xfee6('0x50')](handleError(_0x30f7e3,null));};exports['upload']=function(_0x1510fa,_0x66105c,_0x121082){var _0xaa31e3=path['basename'](_0x1510fa[_0xfee6('0x6d')]['filename'],path[_0xfee6('0x6e')](_0x1510fa[_0xfee6('0x6d')][_0xfee6('0x6f')]));var _0x3df5c9=path[_0xfee6('0x61')](config['root'],_0xfee6('0x56'),_0x1510fa[_0xfee6('0x6d')]['filename']);var _0x245e4d=path[_0xfee6('0x61')](config[_0xfee6('0x55')],_0xfee6('0x56'),_0xaa31e3);logger[_0xfee6('0x6a')](_0xfee6('0x70'),_0x3df5c9);logger[_0xfee6('0x6a')]('Plugin\x20upload\x20destination:\x20%s',_0x245e4d);try{fs[_0xfee6('0x71')](_0x3df5c9,parseInt(_0xfee6('0x72'),0x8));extract(_0x3df5c9,{'dir':_0x245e4d},function(_0xca70cc){if(_0xca70cc){logger['error'](_0xca70cc);handleError(_0xca70cc,!![]);};var _0x2350ec=fs['readdirSync'](_0x245e4d);if(_0x2350ec['length']>0x1){removeReferences(_0x3df5c9,_0x245e4d);logger[_0xfee6('0x5a')](_0xfee6('0x73'));return _0x121082(new Error(_0xfee6('0x73')));}var _0x2fade2=fs['lstatSync'](path[_0xfee6('0x61')](_0x245e4d,_0x2350ec[0x0]));if(_0x2fade2[_0xfee6('0x74')]()){removeReferences(_0x3df5c9,_0x245e4d);logger[_0xfee6('0x5a')](_0xfee6('0x73'));return _0x121082(new Error('Invalid\x20plugin\x20structure'));}if(_0x2fade2[_0xfee6('0x75')]()){var _0x1579c7=fs[_0xfee6('0x76')](path[_0xfee6('0x61')](_0x245e4d,_0x2350ec[0x0]));if(_0x1579c7[_0xfee6('0x42')]===0x0){removeReferences(_0x3df5c9,_0x245e4d);logger[_0xfee6('0x5a')](_0xfee6('0x73'));return _0x121082(new Error('Invalid\x20plugin\x20structure'));}var _0x3b058d=_0x1579c7['some'](function(_0x13a5cb){return _0x13a5cb===_0xfee6('0x77');});if(!_0x3b058d){return _0x121082(new Error(_0xfee6('0x78')));}var _0x5595d2=fs[_0xfee6('0x79')](path[_0xfee6('0x61')](_0x245e4d,_0x2350ec[0x0],_0xfee6('0x77')));var _0x5da415=JSON['parse'](_0x5595d2);if('undefined'==typeof _0x5da415['name']){return _0x121082(new Error(_0xfee6('0x7a')));}if(_0xfee6('0x26')==typeof _0x5da415[_0xfee6('0x3a')]){return _0x121082(new Error(_0xfee6('0x7b')));}if(_0xfee6('0x26')==typeof _0x5da415[_0xfee6('0x7c')]){return _0x121082(new Error(_0xfee6('0x7d')));}if(_0xfee6('0x26')==typeof _0x5da415['parameters']){return _0x121082(new Error(_0xfee6('0x7e')));}if(_0x5da415['type']==='html'){if(_0xfee6('0x26')==typeof _0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')]){return _0x121082(new Error(_0xfee6('0x81')));}if(_0xfee6('0x26')==typeof _0x5da415['parameters'][_0xfee6('0x80')][_0xfee6('0x82')]&&_0xfee6('0x26')==typeof _0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')][_0xfee6('0x83')]){return _0x121082(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5da415[_0xfee6('0x3a')]===_0xfee6('0x84')){if(_0xfee6('0x26')==typeof _0x5da415[_0xfee6('0x7f')]['scriptName']){return _0x121082(new Error(_0xfee6('0x85')));}if(_0xfee6('0x26')==typeof _0x5da415[_0xfee6('0x7f')][_0xfee6('0x86')]){return _0x121082(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x121082(new Error(_0xfee6('0x87')));}var _0x39ed21=_0x5da415['name'];var _0x4d910a=_0x5da415[_0xfee6('0x88')];var _0x2e6a44=_0x5da415[_0xfee6('0x3a')];var _0x2a583f=_0x5da415[_0xfee6('0x89')]?_0x5da415[_0xfee6('0x89')]:'always';var _0x138642=_0x5da415['icon']?_0x5da415['icon']:_0xfee6('0x8a');var _0x44f09f='';var _0x3c3f49='';var _0x1df203='';var _0x128b74='';var _0x233879=_0x5da415[_0xfee6('0x7c')];if(_0x2e6a44===_0xfee6('0x8b')){if(_0xfee6('0x26')!=typeof _0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')][_0xfee6('0x82')]){var _0xdb99c3=_0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0xdb99c3)){_0x44f09f=path[_0xfee6('0x61')]('plugins',_0xaa31e3,_0x2350ec[0x0],_0xdb99c3);}else{_0x44f09f=_0xdb99c3;}}else{logger[_0xfee6('0x6a')](_0xfee6('0x8c'));}if(_0xfee6('0x26')!=typeof _0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')]['agent']){var _0x254af2=_0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')][_0xfee6('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfee6('0x8d')](_0x254af2)){_0x3c3f49=path[_0xfee6('0x61')](_0xfee6('0x8e'),_0xaa31e3,_0x2350ec[0x0],_0x254af2);}else{_0x3c3f49=_0x254af2;}}else{logger['info'](_0xfee6('0x8f'));}}else if(_0x2e6a44===_0xfee6('0x84')){_0x1df203=_0x5da415['parameters'][_0xfee6('0x90')];_0x128b74=_0x5da415[_0xfee6('0x7f')][_0xfee6('0x86')];if('undefined'!=typeof _0x5da415[_0xfee6('0x7f')]['views']){if('undefined'!=typeof _0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')][_0xfee6('0x82')]){var _0xdb99c3=_0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xfee6('0x8d')](_0xdb99c3)){_0x44f09f=path[_0xfee6('0x61')](_0xfee6('0x8e'),_0xaa31e3,_0x2350ec[0x0],_0xdb99c3);}else{_0x44f09f=_0xdb99c3;}}if('undefined'!=typeof _0x5da415[_0xfee6('0x7f')]['views'][_0xfee6('0x83')]){var _0x254af2=_0x5da415[_0xfee6('0x7f')][_0xfee6('0x80')][_0xfee6('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfee6('0x8d')](_0x254af2)){_0x3c3f49=path[_0xfee6('0x61')](_0xfee6('0x8e'),_0xaa31e3,_0x2350ec[0x0],_0x254af2);}else{_0x3c3f49=_0x254af2;}}}}var _0x2c675b={'name':_0x39ed21,'description':_0x4d910a,'path':path[_0xfee6('0x61')](_0xaa31e3,_0x2350ec[0x0]),'type':_0x2e6a44,'sidebar':_0x2a583f,'icon':_0x138642,'adminUrl':_0x44f09f,'agentUrl':_0x3c3f49,'scriptName':_0x1df203,'scriptPath':_0x128b74,'version':_0x233879};removeReferences(_0x3df5c9,null);return db[_0xfee6('0x37')][_0xfee6('0x91')](_0x2c675b)[_0xfee6('0x2f')](function(_0x15acae){var _0x1458cd={'role':_0x1510fa[_0xfee6('0x92')][_0xfee6('0x93')],'userProfileId':_0x1510fa[_0xfee6('0x92')][_0xfee6('0x94')]};if(!_0x1458cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1458cd[_0xfee6('0x93')]===_0xfee6('0x95')){var _0xab75f2=_0x15acae['get']({'plain':!![]});return db[_0xfee6('0x96')][_0xfee6('0x53')]({'where':{'name':_0xfee6('0x97'),'userProfileId':_0x1458cd[_0xfee6('0x94')]},'raw':!![]})[_0xfee6('0x2f')](function(_0x32c6b1){if(_0x32c6b1&&_0x32c6b1['autoAssociation']===0x0){return db[_0xfee6('0x98')][_0xfee6('0x91')]({'name':_0xab75f2[_0xfee6('0x33')],'resourceId':_0xab75f2['id'],'type':_0x32c6b1[_0xfee6('0x33')],'sectionId':_0x32c6b1['id']},{})[_0xfee6('0x2f')](function(){return _0x15acae;});}else{return _0x15acae;}})[_0xfee6('0x50')](function(_0x2e9662){logger[_0xfee6('0x5a')](_0xfee6('0x99'),_0x2e9662);throw _0x2e9662;});}return _0x15acae;})[_0xfee6('0x2f')](respondWithResult(_0x66105c,null))[_0xfee6('0x50')](handleError(_0x66105c,null));}});}catch(_0xb4b62b){_0x66105c[_0xfee6('0x23')](0x1f4)['send'](_0xb4b62b);}};function removeReferences(_0x1505fe,_0x1158b1){try{if(_0x1505fe){fs['unlinkSync'](_0x1505fe);logger[_0xfee6('0x6a')](_0xfee6('0x9a'));}if(_0x1158b1){rimraf(_0x1158b1,function(){});logger[_0xfee6('0x6a')]('Extracted\x20folder\x20removed');}}catch(_0x5c85a5){logger[_0xfee6('0x5a')](_0x5c85a5);}}exports[_0xfee6('0x2e')]=function(_0xddcc5f,_0x255e34,_0x20824d){return db[_0xfee6('0x37')]['find']({'where':{'id':_0xddcc5f['params']['id']}})[_0xfee6('0x2f')](handleEntityNotFound(_0x255e34,null))[_0xfee6('0x2f')](saveUpdates(_0xddcc5f[_0xfee6('0x92')],null))['then'](respondWithResult(_0x255e34,null))[_0xfee6('0x50')](handleError(_0x255e34,null));};exports[_0xfee6('0x9b')]=function(_0x2b32dc,_0x3c9c74,_0x242fb1){return db[_0xfee6('0x37')][_0xfee6('0x53')]({'where':{'id':_0x2b32dc['params']['id']}})[_0xfee6('0x2f')](function(_0x43cfff){if(_0x43cfff){return _0x43cfff['destroy']();}})[_0xfee6('0x2f')](function(_0x5b25b5){rimraf(path[_0xfee6('0x61')](config[_0xfee6('0x55')],'server/files/plugins',path[_0xfee6('0x9c')](_0x5b25b5[_0xfee6('0x9')])),function(){});return _0x5b25b5;})[_0xfee6('0x2f')](handleEntityNotFound(_0x3c9c74,null))[_0xfee6('0x2f')](respondWithStatusCode(_0x3c9c74,null))[_0xfee6('0x50')](handleError(_0x3c9c74,null));};exports[_0xfee6('0x9d')]=function(_0x1cb6bf,_0x593868,_0x366906){return BPromise[_0xfee6('0x9e')]()[_0xfee6('0x2f')](function(){if(!_0x1cb6bf[_0xfee6('0x3e')][_0xfee6('0x9')]){throw new Error(_0xfee6('0x9f'));}if(!_0x1cb6bf[_0xfee6('0x3e')][_0xfee6('0xa0')]){throw new Error(_0xfee6('0xa1'));}var _0x1546df=_0x1cb6bf[_0xfee6('0x3e')][_0xfee6('0xa2')]?_0x1cb6bf[_0xfee6('0x3e')]['hostname']+':'+_0x1cb6bf['query'][_0xfee6('0xa0')]:_0xfee6('0xa3')+_0x1cb6bf[_0xfee6('0x3e')][_0xfee6('0xa0')];var _0x344166=_0x1cb6bf[_0xfee6('0x3e')][_0xfee6('0x25')]?_0x1cb6bf[_0xfee6('0x3e')][_0xfee6('0x25')]:!![];var _0x1112b6=_0x1cb6bf[_0xfee6('0x3e')][_0xfee6('0xa4')]?_0x1cb6bf['query'][_0xfee6('0xa4')]:null;var _0x1dfd1d={'method':_0x1cb6bf[_0xfee6('0xa5')],'uri':util['format']('%s%s',_0x1546df,_0x1cb6bf[_0xfee6('0x3e')]['path']),'json':_0x344166,'resolveWithFullResponse':!![],'encoding':_0x1112b6,'qs':_0x1cb6bf[_0xfee6('0x3e')]};if(_0x1cb6bf[_0xfee6('0xa6')]){_0x1dfd1d[_0xfee6('0xa6')]=_0x1cb6bf[_0xfee6('0xa6')];if(_0x1dfd1d['headers']['content-length']){delete _0x1dfd1d[_0xfee6('0xa6')][_0xfee6('0xa7')];}}if(_0x1dfd1d[_0xfee6('0xa6')][_0xfee6('0xa8')]){delete _0x1dfd1d[_0xfee6('0xa6')][_0xfee6('0xa8')];}return rp(_0x1dfd1d);})[_0xfee6('0x2f')](function(_0x50d0c0){if(_0x50d0c0){_0x593868[_0xfee6('0x29')](_0x50d0c0[_0xfee6('0xa6')]);logger[_0xfee6('0x6a')](_0x50d0c0[_0xfee6('0x92')]);if(_[_0xfee6('0xa9')](_0x1cb6bf[_0xfee6('0x3e')][_0xfee6('0x9')],_0xfee6('0x54'))&&_0x50d0c0['statusCode']==0x1f4){return _0x593868[_0xfee6('0x22')](_0x50d0c0[_0xfee6('0xaa')]);}else{return _0x593868[_0xfee6('0x23')](_0x50d0c0[_0xfee6('0xaa')])['send'](_0x50d0c0['body']);}}else{return _0x593868[_0xfee6('0x22')](0xc8);}})[_0xfee6('0x50')](handleError(_0x593868,null));};exports[_0xfee6('0xab')]=function(_0x20f991,_0x492142,_0x438cf3){return BPromise[_0xfee6('0x9e')]()[_0xfee6('0x2f')](function(){if(!_0x20f991[_0xfee6('0x3e')][_0xfee6('0x9')]){throw new Error(_0xfee6('0x9f'));}if(!_0x20f991[_0xfee6('0x3e')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2d4fa9=_0x20f991['query'][_0xfee6('0xa2')]?_0x20f991['query'][_0xfee6('0xa2')]+':'+_0x20f991[_0xfee6('0x3e')][_0xfee6('0xa0')]:_0xfee6('0xa3')+_0x20f991[_0xfee6('0x3e')][_0xfee6('0xa0')];var _0x347e2a=_0x20f991['query'][_0xfee6('0x25')]?_0x20f991[_0xfee6('0x3e')]['json']:!![];var _0x50ca4f=_0x20f991['query'][_0xfee6('0xa4')]?_0x20f991[_0xfee6('0x3e')][_0xfee6('0xa4')]:null;var _0x5af9c5={'method':_0x20f991[_0xfee6('0xa5')],'uri':util[_0xfee6('0x57')](_0xfee6('0xac'),_0x2d4fa9,_0x20f991[_0xfee6('0x3e')][_0xfee6('0x9')]),'json':_0x347e2a,'resolveWithFullResponse':!![],'encoding':_0x50ca4f,'body':_0x20f991['body']};if(_0x20f991[_0xfee6('0xa6')]){_0x5af9c5[_0xfee6('0xa6')]=_0x20f991[_0xfee6('0xa6')];if(_0x5af9c5['headers'][_0xfee6('0xa7')]){delete _0x5af9c5[_0xfee6('0xa6')][_0xfee6('0xa7')];}}if(_0x5af9c5['headers']['content-type']){delete _0x5af9c5[_0xfee6('0xa6')][_0xfee6('0xa8')];}return rp(_0x5af9c5);})['then'](function(_0x5e112b){if(_0x5e112b){_0x492142[_0xfee6('0x29')](_0x5e112b[_0xfee6('0xa6')]);logger['info'](_0x5e112b[_0xfee6('0x92')]);return _0x492142[_0xfee6('0x23')](_0x5e112b[_0xfee6('0xaa')])['send'](_0x5e112b[_0xfee6('0x92')]);}else{return _0x492142['sendStatus'](0xc8);}})[_0xfee6('0x50')](handleError(_0x492142,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a45ab4f..850d194 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 _0x4873=['emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','save'];(function(_0x253dad,_0x3bfafa){var _0x6c42df=function(_0x32fd1c){while(--_0x32fd1c){_0x253dad['push'](_0x253dad['shift']());}};_0x6c42df(++_0x3bfafa);}(_0x4873,0x1df));var _0x3487=function(_0x2cd393,_0x59d2e4){_0x2cd393=_0x2cd393-0x0;var _0x436095=_0x4873[_0x2cd393];return _0x436095;};'use strict';var EventEmitter=require(_0x3487('0x0'));var Plugin=require(_0x3487('0x1'))['db'][_0x3487('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3487('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x24ca51){return function(_0xbc64e7,_0x54ff70,_0x1d6d6c){PluginEvents[_0x3487('0x4')](_0x24ca51+':'+_0xbc64e7['id'],_0xbc64e7);PluginEvents[_0x3487('0x4')](_0x24ca51,_0xbc64e7);_0x1d6d6c(null);};}for(var e in events){if(events[_0x3487('0x5')](e)){var event=events[e];Plugin[_0x3487('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x02ca=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','Plugin'];(function(_0x1a6923,_0x36f813){var _0xe4eaf6=function(_0xf3a63f){while(--_0xf3a63f){_0x1a6923['push'](_0x1a6923['shift']());}};_0xe4eaf6(++_0x36f813);}(_0x02ca,0x97));var _0xa02c=function(_0xfd9455,_0x1bf4e4){_0xfd9455=_0xfd9455-0x0;var _0x345176=_0x02ca[_0xfd9455];return _0x345176;};'use strict';var EventEmitter=require(_0xa02c('0x0'));var Plugin=require('../../mysqldb')['db'][_0xa02c('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xa02c('0x2')](0x0);var events={'afterCreate':_0xa02c('0x3'),'afterUpdate':_0xa02c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x267a6c){return function(_0x18c88a,_0x31c03a,_0xb1afd3){PluginEvents[_0xa02c('0x5')](_0x267a6c+':'+_0x18c88a['id'],_0x18c88a);PluginEvents[_0xa02c('0x5')](_0x267a6c,_0x18c88a);_0xb1afd3(null);};}for(var e in events){if(events[_0xa02c('0x6')](e)){var event=events[e];Plugin[_0xa02c('0x7')](e,emitEvent(event));}}module[_0xa02c('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 128a8b9..017cccc 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 _0xa801=['bluebird','path','rimraf','../../config/environment','define','Plugin','plugins','util','../../config/logger','api'];(function(_0x394480,_0x38ae49){var _0x4ae927=function(_0x1854ec){while(--_0x1854ec){_0x394480['push'](_0x394480['shift']());}};_0x4ae927(++_0x38ae49);}(_0xa801,0xc5));var _0x1a80=function(_0x431ccf,_0xbc5f8e){_0x431ccf=_0x431ccf-0x0;var _0x137494=_0xa801[_0x431ccf];return _0x137494;};'use strict';var _=require('lodash');var util=require(_0x1a80('0x0'));var logger=require(_0x1a80('0x1'))(_0x1a80('0x2'));var moment=require('moment');var BPromise=require(_0x1a80('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a80('0x4'));var rimraf=require(_0x1a80('0x5'));var config=require(_0x1a80('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0x4596a8,_0x44518a){return _0x4596a8[_0x1a80('0x7')](_0x1a80('0x8'),attributes,{'tableName':_0x1a80('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54d7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x230d4b,_0x1aab1e){var _0x1127a3=function(_0x53ee64){while(--_0x53ee64){_0x230d4b['push'](_0x230d4b['shift']());}};_0x1127a3(++_0x1aab1e);}(_0x54d7,0x1d8));var _0x754d=function(_0x32cb35,_0x272ee5){_0x32cb35=_0x32cb35-0x0;var _0x2077ea=_0x54d7[_0x32cb35];return _0x2077ea;};'use strict';var _=require(_0x754d('0x0'));var util=require('util');var logger=require(_0x754d('0x1'))(_0x754d('0x2'));var moment=require(_0x754d('0x3'));var BPromise=require(_0x754d('0x4'));var rp=require(_0x754d('0x5'));var fs=require('fs');var path=require(_0x754d('0x6'));var rimraf=require(_0x754d('0x7'));var config=require(_0x754d('0x8'));var attributes=require('./plugin.attributes');module[_0x754d('0x9')]=function(_0x2eadca,_0x38de39){return _0x2eadca[_0x754d('0xa')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index a258e07..b2b2905 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 _0x0ad2=['then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','CreatePlugin','Plugin','options'];(function(_0x32be62,_0x22e6fd){var _0x1a37e9=function(_0x35a9c1){while(--_0x35a9c1){_0x32be62['push'](_0x32be62['shift']());}};_0x1a37e9(++_0x22e6fd);}(_0x0ad2,0xa1));var _0x20ad=function(_0x4a328d,_0x4c62d6){_0x4a328d=_0x4a328d-0x0;var _0x4410d9=_0x0ad2[_0x4a328d];return _0x4410d9;};'use strict';var _=require(_0x20ad('0x0'));var util=require(_0x20ad('0x1'));var moment=require(_0x20ad('0x2'));var BPromise=require(_0x20ad('0x3'));var rs=require(_0x20ad('0x4'));var fs=require('fs');var Redis=require(_0x20ad('0x5'));var db=require(_0x20ad('0x6'))['db'];var utils=require(_0x20ad('0x7'));var logger=require(_0x20ad('0x8'))(_0x20ad('0x9'));var config=require(_0x20ad('0xa'));var jayson=require(_0x20ad('0xb'));var client=jayson[_0x20ad('0xc')][_0x20ad('0xd')]({'port':0x232a});config[_0x20ad('0xe')]=_[_0x20ad('0xf')](config[_0x20ad('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x20ad('0x10'))(new Redis(config[_0x20ad('0xe')]));require('./plugin.socket')[_0x20ad('0x11')](socket);function respondWithRpcPromise(_0x6273e,_0x1eb7c2,_0x1333cd){return new BPromise(function(_0x24db4c,_0xe529a3){return client[_0x20ad('0x12')](_0x6273e,_0x1333cd)['then'](function(_0x20590a){logger[_0x20ad('0x13')](_0x20ad('0x14'),_0x1eb7c2,'request\x20sent');logger[_0x20ad('0x15')](_0x20ad('0x16'),_0x1eb7c2,'request\x20sent',JSON[_0x20ad('0x17')](_0x20590a));if(_0x20590a[_0x20ad('0x18')]){if(_0x20590a[_0x20ad('0x18')]['code']===0x1f4){logger[_0x20ad('0x18')](_0x20ad('0x14'),_0x1eb7c2,_0x20590a[_0x20ad('0x18')][_0x20ad('0x19')]);return _0xe529a3(_0x20590a[_0x20ad('0x18')][_0x20ad('0x19')]);}logger[_0x20ad('0x18')](_0x20ad('0x14'),_0x1eb7c2,_0x20590a['error'][_0x20ad('0x19')]);return _0x24db4c(_0x20590a['error']['message']);}else{logger[_0x20ad('0x13')]('Plugin,\x20%s,\x20%s',_0x1eb7c2,_0x20ad('0x1a'));_0x24db4c(_0x20590a['result'][_0x20ad('0x19')]);}})[_0x20ad('0x1b')](function(_0x46779c){logger[_0x20ad('0x18')]('Plugin,\x20%s,\x20%s',_0x1eb7c2,_0x46779c);_0xe529a3(_0x46779c);});});}exports[_0x20ad('0x1c')]=function(_0x9e7089){var _0x5eaa97=this;return new Promise(function(_0x453e0b,_0x2aa458){return db[_0x20ad('0x1d')]['create'](_0x9e7089['body'],{'raw':_0x9e7089['options']?_0x9e7089[_0x20ad('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x20ad('0x1f')](function(_0xf897f8){logger[_0x20ad('0x13')](_0x20ad('0x1c'),_0x9e7089);logger[_0x20ad('0x15')](_0x20ad('0x1c'),_0x9e7089,JSON[_0x20ad('0x17')](_0xf897f8));_0x453e0b(_0xf897f8);})[_0x20ad('0x1b')](function(_0x11966a){logger[_0x20ad('0x18')]('CreatePlugin',_0x11966a['message'],_0x9e7089);_0x2aa458(_0x5eaa97['error'](0x1f4,_0x11966a[_0x20ad('0x19')]));});});}; \ No newline at end of file +var _0xe1ee=['client','http','redis','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreatePlugin','create','body','options','raw','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x2bfc91,_0xbd57ba){var _0x5cf514=function(_0x42fa23){while(--_0x42fa23){_0x2bfc91['push'](_0x2bfc91['shift']());}};_0x5cf514(++_0xbd57ba);}(_0xe1ee,0x158));var _0xee1e=function(_0x58a4ac,_0x26f3e7){_0x58a4ac=_0x58a4ac-0x0;var _0x435e2d=_0xe1ee[_0x58a4ac];return _0x435e2d;};'use strict';var _=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var moment=require('moment');var BPromise=require(_0xee1e('0x2'));var rs=require(_0xee1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xee1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee1e('0x6'));var client=jayson[_0xee1e('0x7')][_0xee1e('0x8')]({'port':0x232a});config[_0xee1e('0x9')]=_['defaults'](config[_0xee1e('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xee1e('0xa'))[_0xee1e('0xb')](socket);function respondWithRpcPromise(_0x44d75f,_0x4878b1,_0x5a9f47){return new BPromise(function(_0x38e807,_0x146f70){return client['request'](_0x44d75f,_0x5a9f47)['then'](function(_0x2f55e3){logger[_0xee1e('0xc')](_0xee1e('0xd'),_0x4878b1,_0xee1e('0xe'));logger[_0xee1e('0xf')]('Plugin,\x20%s,\x20%s,\x20%s',_0x4878b1,_0xee1e('0xe'),JSON[_0xee1e('0x10')](_0x2f55e3));if(_0x2f55e3[_0xee1e('0x11')]){if(_0x2f55e3[_0xee1e('0x11')][_0xee1e('0x12')]===0x1f4){logger[_0xee1e('0x11')]('Plugin,\x20%s,\x20%s',_0x4878b1,_0x2f55e3[_0xee1e('0x11')]['message']);return _0x146f70(_0x2f55e3[_0xee1e('0x11')]['message']);}logger[_0xee1e('0x11')]('Plugin,\x20%s,\x20%s',_0x4878b1,_0x2f55e3[_0xee1e('0x11')][_0xee1e('0x13')]);return _0x38e807(_0x2f55e3[_0xee1e('0x11')][_0xee1e('0x13')]);}else{logger[_0xee1e('0xc')](_0xee1e('0xd'),_0x4878b1,_0xee1e('0xe'));_0x38e807(_0x2f55e3['result'][_0xee1e('0x13')]);}})[_0xee1e('0x14')](function(_0x3c2f59){logger[_0xee1e('0x11')](_0xee1e('0xd'),_0x4878b1,_0x3c2f59);_0x146f70(_0x3c2f59);});});}exports[_0xee1e('0x15')]=function(_0x3b190b){var _0x502614=this;return new Promise(function(_0x3de38e,_0x21e0f5){return db['Plugin'][_0xee1e('0x16')](_0x3b190b[_0xee1e('0x17')],{'raw':_0x3b190b['options']?_0x3b190b[_0xee1e('0x18')][_0xee1e('0x19')]===undefined?!![]:![]:!![]})[_0xee1e('0x1a')](function(_0x178549){logger[_0xee1e('0xc')](_0xee1e('0x15'),_0x3b190b);logger['debug'](_0xee1e('0x15'),_0x3b190b,JSON[_0xee1e('0x10')](_0x178549));_0x3de38e(_0x178549);})[_0xee1e('0x14')](function(_0x5c8d99){logger[_0xee1e('0x11')](_0xee1e('0x15'),_0x5c8d99[_0xee1e('0x13')],_0x3b190b);_0x21e0f5(_0x502614['error'](0x1f4,_0x5c8d99['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index e3297a1..23c93a9 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 _0x48e6=['plugin:','./plugin.events','remove','update','emit','length'];(function(_0x31c351,_0x2c7bc1){var _0x1a1c6d=function(_0x24ac6d){while(--_0x24ac6d){_0x31c351['push'](_0x31c351['shift']());}};_0x1a1c6d(++_0x2c7bc1);}(_0x48e6,0x97));var _0x648e=function(_0x7b4990,_0x1ea69b){_0x7b4990=_0x7b4990-0x0;var _0x126273=_0x48e6[_0x7b4990];return _0x126273;};'use strict';var PluginEvents=require(_0x648e('0x0'));var events=['save',_0x648e('0x1'),_0x648e('0x2')];function createListener(_0x56d3e5,_0x287003){return function(_0x4f41ec){_0x287003[_0x648e('0x3')](_0x56d3e5,_0x4f41ec);};}function removeListener(_0x41a618,_0x1b9c1a){return function(){PluginEvents['removeListener'](_0x41a618,_0x1b9c1a);};}exports['register']=function(_0xf821b3){for(var _0x264170=0x0,_0x3c2a80=events[_0x648e('0x4')];_0x264170<_0x3c2a80;_0x264170++){var _0x499f1a=events[_0x264170];var _0x5c89cf=createListener(_0x648e('0x5')+_0x499f1a,_0xf821b3);PluginEvents['on'](_0x499f1a,_0x5c89cf);}}; \ No newline at end of file +var _0x226a=['register','./plugin.events','save','remove','update','emit'];(function(_0x470f1f,_0x1494f4){var _0x1c0abc=function(_0x2b5e1b){while(--_0x2b5e1b){_0x470f1f['push'](_0x470f1f['shift']());}};_0x1c0abc(++_0x1494f4);}(_0x226a,0xeb));var _0xa226=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0x226a[_0x59145a];return _0xf04d7;};'use strict';var PluginEvents=require(_0xa226('0x0'));var events=[_0xa226('0x1'),_0xa226('0x2'),_0xa226('0x3')];function createListener(_0xced670,_0x20cf2a){return function(_0x5686b5){_0x20cf2a[_0xa226('0x4')](_0xced670,_0x5686b5);};}function removeListener(_0x41ec8b,_0x40364a){return function(){PluginEvents['removeListener'](_0x41ec8b,_0x40364a);};}exports[_0xa226('0x5')]=function(_0x1f5618){for(var _0x1b3618=0x0,_0x444bf0=events['length'];_0x1b3618<_0x444bf0;_0x1b3618++){var _0x391fb4=events[_0x1b3618];var _0x32ddb5=createListener('plugin:'+_0x391fb4,_0x1f5618);PluginEvents['on'](_0x391fb4,_0x32ddb5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 44da412..99d062d 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(_0x1a2e14,_0x5ed2ab){var _0x7b8c94=function(_0x16c66a){while(--_0x16c66a){_0x1a2e14['push'](_0x1a2e14['shift']());}};_0x7b8c94(++_0x5ed2ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x151cca,_0x5345ab){var _0x136781=function(_0x2d267e){while(--_0x2d267e){_0x151cca['push'](_0x151cca['shift']());}};_0x136781(++_0x5345ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 cf25e61..0a26455 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 _0x34e5=['info','error','list','then','reject','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','name','npm\x20install'];(function(_0x4bf8b6,_0x2baec7){var _0x4e7375=function(_0xf80783){while(--_0xf80783){_0x4bf8b6['push'](_0x4bf8b6['shift']());}};_0x4e7375(++_0x2baec7);}(_0x34e5,0x172));var _0x534e=function(_0x50edf6,_0x284340){_0x50edf6=_0x50edf6-0x0;var _0x47bbfb=_0x34e5[_0x50edf6];return _0x47bbfb;};'use strict';var _=require('lodash');var pm2=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var path=require(_0x534e('0x2'));var exec=require(_0x534e('0x3'))[_0x534e('0x4')];var BPromise=require(_0x534e('0x5'));function handleEntityNotFound(_0x50b790,_0x11a158){return function(_0x3d8287){if(!_0x3d8287){_0x50b790[_0x534e('0x6')](0x194);;}return _0x3d8287;};}function respondWithResult(_0x117f0c,_0x436a92){_0x436a92=_0x436a92||0xc8;return function(_0x2d0370){if(_0x2d0370){return _0x117f0c[_0x534e('0x7')](_0x436a92)['json'](_0x2d0370);}return null;};}function handleError(_0x24d562,_0x929597){_0x929597=_0x929597||0x1f4;return function(_0xa836bb){logger['error'](_0xa836bb['stack']);if(_0xa836bb[_0x534e('0x8')]){delete _0xa836bb['name'];}_0x24d562[_0x534e('0x7')](_0x929597)['send'](_0xa836bb);};}function execChildProcess(){return new BPromise(function(_0xb30dd6,_0x310b6d){exec(_0x534e('0x9'),function(_0x529726,_0x1b7a5a,_0x229352){logger[_0x534e('0xa')](_0x1b7a5a);logger[_0x534e('0xa')](_0x229352);if(_0x529726){logger[_0x534e('0xb')](_0x529726);return _0x310b6d(_0x529726);}return _0xb30dd6(_0x1b7a5a);});});}exports['index']=function(_0x31d764,_0x23c11c){return pm2[_0x534e('0xc')]()[_0x534e('0xd')](function(_0x359565){if(_0x359565){var _0x478027=_[_0x534e('0xe')](_0x359565,function(_0x17c068){return _0x17c068[_0x534e('0x8')]==='express'||_0x17c068[_0x534e('0x8')]===_0x534e('0xf');});return{'rows':_0x478027,'count':_0x478027['length']};}return null;})['then'](respondWithResult(_0x23c11c,null))[_0x534e('0x10')](handleError(_0x23c11c,null));};exports[_0x534e('0x11')]=function(_0x9297b6,_0x16ad40){return pm2[_0x534e('0x12')](_0x9297b6[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x16ad40,null))['then'](handleEntityNotFound(_0x16ad40,null))[_0x534e('0x10')](handleError(_0x16ad40,null));};exports[_0x534e('0x14')]=function(_0x466d74,_0x1bef0a){if(_0x466d74[_0x534e('0x15')]['name']&&_0x466d74[_0x534e('0x15')][_0x534e('0x16')]){var _0x5f9ae9=path[_0x534e('0x17')](__dirname,_0x534e('0x18'),_0x466d74[_0x534e('0x15')][_0x534e('0x16')]);var _0x85188b=process[_0x534e('0x19')]();process['chdir'](path[_0x534e('0x1a')](_0x5f9ae9));return execChildProcess()[_0x534e('0xd')](function(_0x39466c){process[_0x534e('0x1b')](_0x85188b);return pm2[_0x534e('0x1c')]({'name':_0x466d74[_0x534e('0x15')][_0x534e('0x8')],'script':_0x5f9ae9});})[_0x534e('0xd')](function(_0x53a6ef){pm2[_0x534e('0x1d')]();return _0x53a6ef[0x0];})['then'](respondWithResult(_0x1bef0a,0xc9))[_0x534e('0x10')](handleError(_0x1bef0a,null));}else{return _0x1bef0a[_0x534e('0x7')](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x1f')});}};exports[_0x534e('0x20')]=function(_0x57b216,_0x743974){if(_0x57b216[_0x534e('0x15')]['id']){delete _0x57b216['body']['id'];}var _0x4bd073={'online':_0x534e('0x21'),'stopped':'stop'};if(_0x4bd073[_0x534e('0x22')](_0x57b216[_0x534e('0x15')][_0x534e('0x7')])){return pm2[_0x4bd073[_0x57b216[_0x534e('0x15')][_0x534e('0x7')]]](_0x57b216[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x743974,0xc8))['catch'](handleError(_0x743974,null));}else{return _0x743974['status'](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x23')});}};exports[_0x534e('0x24')]=function(_0x2f1c49,_0x423502){if(_0x2f1c49[_0x534e('0x15')]['id']){delete _0x2f1c49[_0x534e('0x15')]['id'];}if(_0x2f1c49[_0x534e('0x13')]['id']){return pm2[_0x534e('0x25')](_0x2f1c49[_0x534e('0x13')]['id'])[_0x534e('0xd')](function(_0x1d6fb1){pm2['dump']();return _0x1d6fb1[0x0];})[_0x534e('0xd')](respondWithResult(_0x423502,null))[_0x534e('0x10')](handleError(_0x423502,null));}else{return _0x423502['status'](0x1f4)[_0x534e('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xf109=['name','send','info','index','list','express','motion2','then','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','restart','stop','hasOwnProperty','Unknown\x20status','destroy','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','exec','bluebird','sendStatus','status','json','error','stack'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0xf109,0xce));var _0x9f10=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf109[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x9f10('0x0'));var pm2=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var path=require('path');var exec=require('child_process')[_0x9f10('0x3')];var BPromise=require(_0x9f10('0x4'));function handleEntityNotFound(_0x74d0ee,_0x26f01c){return function(_0x4027f4){if(!_0x4027f4){_0x74d0ee[_0x9f10('0x5')](0x194);;}return _0x4027f4;};}function respondWithResult(_0x408fe8,_0xd3137b){_0xd3137b=_0xd3137b||0xc8;return function(_0x227a29){if(_0x227a29){return _0x408fe8[_0x9f10('0x6')](_0xd3137b)[_0x9f10('0x7')](_0x227a29);}return null;};}function handleError(_0x5c8719,_0x42a8cd){_0x42a8cd=_0x42a8cd||0x1f4;return function(_0x3019eb){logger[_0x9f10('0x8')](_0x3019eb[_0x9f10('0x9')]);if(_0x3019eb[_0x9f10('0xa')]){delete _0x3019eb['name'];}_0x5c8719[_0x9f10('0x6')](_0x42a8cd)[_0x9f10('0xb')](_0x3019eb);};}function execChildProcess(){return new BPromise(function(_0x4522d9,_0x4e577d){exec('npm\x20install',function(_0x3fac2b,_0x311935,_0x407336){logger['info'](_0x311935);logger[_0x9f10('0xc')](_0x407336);if(_0x3fac2b){logger[_0x9f10('0x8')](_0x3fac2b);return _0x4e577d(_0x3fac2b);}return _0x4522d9(_0x311935);});});}exports[_0x9f10('0xd')]=function(_0x58067f,_0x9a3ae6){return pm2[_0x9f10('0xe')]()['then'](function(_0x40a48a){if(_0x40a48a){var _0x236e28=_['reject'](_0x40a48a,function(_0x59bcad){return _0x59bcad[_0x9f10('0xa')]===_0x9f10('0xf')||_0x59bcad['name']===_0x9f10('0x10');});return{'rows':_0x236e28,'count':_0x236e28['length']};}return null;})[_0x9f10('0x11')](respondWithResult(_0x9a3ae6,null))[_0x9f10('0x12')](handleError(_0x9a3ae6,null));};exports['show']=function(_0x11cc56,_0xd2950c){return pm2['describe'](_0x11cc56[_0x9f10('0x13')]['id'])['then'](respondWithResult(_0xd2950c,null))[_0x9f10('0x11')](handleEntityNotFound(_0xd2950c,null))['catch'](handleError(_0xd2950c,null));};exports[_0x9f10('0x14')]=function(_0x56fb44,_0x54c262){if(_0x56fb44[_0x9f10('0x15')][_0x9f10('0xa')]&&_0x56fb44[_0x9f10('0x15')][_0x9f10('0x16')]){var _0xa810c=path[_0x9f10('0x17')](__dirname,_0x9f10('0x18'),_0x56fb44['body'][_0x9f10('0x16')]);var _0x58e6ba=process[_0x9f10('0x19')]();process[_0x9f10('0x1a')](path[_0x9f10('0x1b')](_0xa810c));return execChildProcess()['then'](function(_0x2f31fb){process[_0x9f10('0x1a')](_0x58e6ba);return pm2[_0x9f10('0x1c')]({'name':_0x56fb44['body'][_0x9f10('0xa')],'script':_0xa810c});})[_0x9f10('0x11')](function(_0x44b99d){pm2['dump']();return _0x44b99d[0x0];})[_0x9f10('0x11')](respondWithResult(_0x54c262,0xc9))[_0x9f10('0x12')](handleError(_0x54c262,null));}else{return _0x54c262[_0x9f10('0x6')](0x1f4)[_0x9f10('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x5c1800,_0x385a39){if(_0x5c1800['body']['id']){delete _0x5c1800[_0x9f10('0x15')]['id'];}var _0x1de75a={'online':_0x9f10('0x1d'),'stopped':_0x9f10('0x1e')};if(_0x1de75a[_0x9f10('0x1f')](_0x5c1800['body'][_0x9f10('0x6')])){return pm2[_0x1de75a[_0x5c1800[_0x9f10('0x15')][_0x9f10('0x6')]]](_0x5c1800[_0x9f10('0x13')]['id'])[_0x9f10('0x11')](respondWithResult(_0x385a39,0xc8))[_0x9f10('0x12')](handleError(_0x385a39,null));}else{return _0x385a39['status'](0x1f4)[_0x9f10('0xb')]({'message':_0x9f10('0x20')});}};exports[_0x9f10('0x21')]=function(_0x1b03ee,_0x49b3f4){if(_0x1b03ee[_0x9f10('0x15')]['id']){delete _0x1b03ee[_0x9f10('0x15')]['id'];}if(_0x1b03ee[_0x9f10('0x13')]['id']){return pm2['delete'](_0x1b03ee[_0x9f10('0x13')]['id'])['then'](function(_0x1069ba){pm2[_0x9f10('0x22')]();return _0x1069ba[0x0];})[_0x9f10('0x11')](respondWithResult(_0x49b3f4,null))['catch'](handleError(_0x49b3f4,null));}else{return _0x49b3f4[_0x9f10('0x6')](0x1f4)[_0x9f10('0xb')]({'message':_0x9f10('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 431da5a..479b392 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 _0x87b5=['isAuthenticated','getQueues','exports','Router','../../components/auth/service','get','/agents','getAgents','/queues'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x87b5,0xc9));var _0x587b=function(_0x4c9d53,_0x4f837f){_0x4c9d53=_0x4c9d53-0x0;var _0x4a4194=_0x87b5[_0x4c9d53];return _0x4a4194;};'use strict';var express=require('express');var router=express[_0x587b('0x0')]();var auth=require(_0x587b('0x1'));var controller=require('./realtime.controller');router[_0x587b('0x2')](_0x587b('0x3'),auth['isAuthenticated'](),controller[_0x587b('0x4')]);router[_0x587b('0x2')](_0x587b('0x5'),auth[_0x587b('0x6')](),controller[_0x587b('0x7')]);module[_0x587b('0x8')]=router; \ No newline at end of file +var _0x394e=['/queues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x394e,0xf4));var _0xe394=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0x394e[_0x5d3394];return _0x102ca5;};'use strict';var express=require(_0xe394('0x0'));var router=express[_0xe394('0x1')]();var auth=require(_0xe394('0x2'));var controller=require(_0xe394('0x3'));router[_0xe394('0x4')](_0xe394('0x5'),auth[_0xe394('0x6')](),controller[_0xe394('0x7')]);router['get'](_0xe394('0x8'),auth['isAuthenticated'](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index b543b56..a066b42 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 _0x46ed=['smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','rawAttributes','fieldName','key','query','role','getOptions','raw','user','userProfileId','agent','nolimit','sort','UserProfile','getResources','rows','omit','globalStatus','pauseTypeFilter','getQueues','mail','chat','sms','openchannel','fax','channel','includes','Invalid\x20channel','QueueCampaigns','Queues','type','findAndCountAll','all','util','lodash','../../components/parsers/qs','../../config/logger','api','client','http','offset','undefined','limit','count','status','set','Content-Range','error','stack','send','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','agents','loggedInDb','talking','find','pick','filter','queue','name','length','some','connectedlinenum','internal','toString','busy','getMembers','UserId','accountcode','online','voiceStatus','User','Queue','Pause','unknown','unavailable','ringing','isNil','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','idle','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','address','faxPause','chatCapacity','mailCapacity'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x46ed,0x168));var _0xd46e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x46ed[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0xd46e('0x0'));var _=require(_0xd46e('0x1'));var jayson=require('jayson/promise');var qs=require(_0xd46e('0x2'));var logger=require(_0xd46e('0x3'))(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xd46e('0x5')][_0xd46e('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0xd46e('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x1926d9,_0x160bcf){return function(_0x25cf78){if(_0x25cf78){var _0x45e680=typeof _0x160bcf[_0xd46e('0x7')]===_0xd46e('0x8')&&typeof _0x160bcf[_0xd46e('0x9')]===_0xd46e('0x8');var _0x19e4f4=_0x25cf78[_0xd46e('0xa')];var _0x59c88d=_0x45e680?0x0:_0x160bcf[_0xd46e('0x7')];var _0x81235b=_0x45e680?_0x25cf78['count']:_0x160bcf[_0xd46e('0x7')]+_0x160bcf[_0xd46e('0x9')];var _0x3a4397;if(_0x81235b>=_0x19e4f4){_0x81235b=_0x19e4f4;_0x3a4397=0xc8;}else{_0x3a4397=0xce;}_0x1926d9[_0xd46e('0xb')](_0x3a4397);return _0x1926d9[_0xd46e('0xc')](_0xd46e('0xd'),_0x59c88d+'-'+_0x81235b+'/'+_0x19e4f4)['json'](_0x25cf78);}return null;};}function handleError(_0x24c54b,_0x5bc1da){_0x5bc1da=_0x5bc1da||0x1f4;return function(_0x48550b){logger[_0xd46e('0xe')](_0x48550b[_0xd46e('0xf')]);if(_0x48550b['name']){delete _0x48550b['name'];}_0x24c54b[_0xd46e('0xb')](_0x5bc1da)[_0xd46e('0x10')](_0x48550b);};}function getRealtimeAgents(){return new Promise(function(_0x1e9aae,_0x3fdf88){return amiClient['request'](_0xd46e('0x11'),{})[_0xd46e('0x12')](function(_0x417402){if(_0x417402[_0xd46e('0xe')])throw new Error(_0xd46e('0x13'));var _0x47fa8f=_0x417402[_0xd46e('0x14')];return routingClient[_0xd46e('0x15')](_0xd46e('0x11'),{})['then'](function(_0x5ddd04){if(_0x5ddd04[_0xd46e('0xe')])throw new Error(_0xd46e('0x16'));var _0x488690=_0x5ddd04['result'];return _0x1e9aae(_[_0xd46e('0x17')]({},_0x47fa8f,_0x488690));});})[_0xd46e('0x18')](function(_0x362885){_0x3fdf88(_0x362885);});});}function getRealtimeQueues(_0x2273c5,_0x409010){return new Promise(function(_0x312d6f,_0x3b5fa4){var _0x327b7e=_0x409010===_0xd46e('0x19')?amiClient:routingClient;return _0x327b7e[_0xd46e('0x15')](_[_0xd46e('0x1a')](_0x409010)+'Queues',_0x2273c5)[_0xd46e('0x12')](function(_0x1c83fa){if(_0x1c83fa[_0xd46e('0xe')])throw new Error(util[_0xd46e('0x1b')](_0xd46e('0x1c'),_0x409010));return _0x312d6f(_0x1c83fa[_0xd46e('0x14')]);})[_0xd46e('0x18')](function(_0x8a1be){_0x3b5fa4(_0x8a1be);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x62dea5,_0x4cf899){return amiClient[_0xd46e('0x15')]('VoiceQueuesChannels',{})['then'](function(_0x371054){if(_0x371054[_0xd46e('0xe')])throw new Error(_0xd46e('0x1d'));return _0x62dea5(_0x371054[_0xd46e('0x14')]);})[_0xd46e('0x18')](function(_0x180851){_0x4cf899(_0x180851);});});}function initializeQueues(_0x1740d1,_0x4dab6a,_0x45d789,_0x3c301a){var _0xddbce9=[_0xd46e('0x1e'),_0xd46e('0x1f'),_0xd46e('0x20'),'talking',_0xd46e('0x21')];if(_0x45d789===_0xd46e('0x19')&&_0x3c301a===_0xd46e('0x22')){_0xddbce9[_0xd46e('0x23')](_0xd46e('0x24'),_0xd46e('0x25'),_0xd46e('0x26'),_0xd46e('0x27'),_0xd46e('0x28'),_0xd46e('0x29'),_0xd46e('0x2a'),_0xd46e('0x2b'),_0xd46e('0x2c'),'erlangCallToSecond',_0xd46e('0x2d'),_0xd46e('0x2e'),_0xd46e('0x2f'),_0xd46e('0x30'),'dialPredictiveIntervalMinThreshold',_0xd46e('0x31'),_0xd46e('0x32'),'predictiveIntervalAnsweredCalls',_0xd46e('0x33'),_0xd46e('0x34'),'predictiveIntervalAvgHoldtime',_0xd46e('0x35'));}return _0x1740d1[_0xd46e('0x36')](function(_0x1016e2){var _0x4b5e50=_0x1016e2['get']({'plain':!![]});_0x4b5e50[_0xd46e('0x37')]=[];_0x4b5e50[_0xd46e('0x21')]=0x0;_0x4b5e50[_0xd46e('0x38')]=0x0;_0x4b5e50[_0xd46e('0x1e')]=0x0;_0x4b5e50[_0xd46e('0x1f')]=0x0;_0x4b5e50[_0xd46e('0x20')]=0x0;if(_0x45d789===_0xd46e('0x19')){_0x4b5e50[_0xd46e('0x39')]=0x0;_0x4b5e50['busy']=0x0;if(_0x3c301a===_0xd46e('0x22')){_0x4b5e50[_0xd46e('0x24')]=0x0;_0x4b5e50[_0xd46e('0x25')]=0x0;}}var _0x83aec1=_[_0xd46e('0x3a')](_0x4dab6a,['id',_0x4b5e50['id']]);if(_0x83aec1)_[_0xd46e('0x17')](_0x4b5e50,_[_0xd46e('0x3b')](_0x83aec1,_0xddbce9));return _0x4b5e50;});}function updateAgentVoiceStatus(_0x5158e6,_0x163dd0,_0x357212){var _0x59bf31=_[_0xd46e('0x3c')](_0x357212,[_0xd46e('0x3d'),_0x163dd0[_0xd46e('0x3e')]]);if(_0x59bf31[_0xd46e('0x3f')]===0x0)return _0x5158e6['busy']=!![];if(_[_0xd46e('0x40')](_0x59bf31,[_0xd46e('0x41'),_0x5158e6[_0xd46e('0x42')][_0xd46e('0x43')]()]))return _0x5158e6[_0xd46e('0x39')]=!![];if(!_0x5158e6[_0xd46e('0x39')])return _0x5158e6[_0xd46e('0x44')]=!![];}function getVoiceQueueAgents(_0x411318,_0x56e8d2,_0x232e6f,_0x40aa87){var _0xc83ea1=_[_0xd46e('0x3a')](_0x56e8d2,['id',_0x411318['id']]);if(!_0xc83ea1)return _0x411318;return _0xc83ea1[_0xd46e('0x45')]({'raw':!![]})['then'](function(_0x964c66){for(var _0x53e680=0x0;_0x53e680<_0x964c66['length'];_0x53e680++){var _0x4c325f=_['find'](_0x232e6f,['id',_0x964c66[_0x53e680][_0xd46e('0x46')]]);if(!_0x4c325f){_0x4c325f={'id':_0x964c66[_0x53e680]['UserId'],'name':_0x964c66[_0x53e680][_0xd46e('0x46')],'accountcode':'','online':![]};}var _0x40720e={'id':_0x4c325f['id'],'name':_0x4c325f['name'],'internal':_0x4c325f[_0xd46e('0x47')],'online':Boolean(_0x4c325f[_0xd46e('0x48')]),'paused':Boolean(_0x964c66[_0x53e680][_0xd46e('0x21')])};if(_0x4c325f[_0xd46e('0x49')]===_0xd46e('0x39'))updateAgentVoiceStatus(_0x40720e,_0x411318,_0x40aa87);if(_0x40720e[_0xd46e('0x48')])_0x411318[_0xd46e('0x38')]++;if(_0x40720e[_0xd46e('0x44')])_0x411318[_0xd46e('0x44')]++;if(_0x40720e[_0xd46e('0x21')]&&!_0x40720e[_0xd46e('0x44')]&&!_0x40720e['talking'])_0x411318['paused']++;_0x411318['agents'][_0xd46e('0x23')](_0x40720e);}return _0x411318;});}function getQueueAgents(_0x4e1d94,_0x168d35,_0x272f5f){var _0x3fdf67=_0xd46e('0x4a')+_[_0xd46e('0x1a')](_0x272f5f)+_0xd46e('0x4b');var _0x20b238=_0x272f5f+_0xd46e('0x4c');return db[_0x3fdf67]['findAll']({'where':{[_[_0xd46e('0x1a')](_0x272f5f)+'QueueId']:_0x4e1d94['id']},'raw':!![]})[_0xd46e('0x12')](function(_0x196e51){for(var _0x41a983=0x0;_0x41a983<_0x196e51[_0xd46e('0x3f')];_0x41a983++){var _0x45e53a=_['find'](_0x168d35,['id',_0x196e51[_0x41a983][_0xd46e('0x46')]]);if(!_0x45e53a){_0x45e53a={'id':_0x196e51[_0x41a983][_0xd46e('0x46')],'name':_0x196e51[_0x41a983][_0xd46e('0x46')],'online':![],['pauseField']:![]};}var _0xac268d={'id':_0x45e53a['id'],'name':_0x45e53a[_0xd46e('0x3e')],'online':Boolean(_0x45e53a['online']),'paused':Boolean(_0x45e53a[_0x20b238])};if(_0xac268d[_0xd46e('0x48')])_0x4e1d94[_0xd46e('0x38')]++;_0x4e1d94[_0xd46e('0x37')][_0xd46e('0x23')](_0xac268d);}return _0x4e1d94;});}function isIdle(_0x324b0e){return _0x324b0e==='idle'||_0x324b0e===_0xd46e('0x4d')||_0x324b0e===_0xd46e('0x4e')||_0x324b0e===_0xd46e('0x4f')||_[_0xd46e('0x50')](_0x324b0e);}function isAgentPaused(_0x17a0c7,_0x3ed12f){var _0x433204=[_0x17a0c7[_0xd46e('0x51')],_0x17a0c7['faxPause'],_0x17a0c7[_0xd46e('0x52')],_0x17a0c7[_0xd46e('0x53')],_0x17a0c7[_0xd46e('0x54')],_0x17a0c7[_0xd46e('0x55')],_0x17a0c7[_0xd46e('0x56')]];if(!_0x3ed12f)return _['every'](_0x433204);var _0x4ae314=_[_0xd46e('0x3c')](_0x433204);return _0x4ae314[_0xd46e('0x3f')]>0x0&&_0x4ae314[_0xd46e('0x3f')]<_0x433204['length']?!![]:![];}function isAgentIdle(_0x479711){if(_0x479711[_0xd46e('0x49')]!==_0xd46e('0x57')&&_0x479711['voicePause']){_0x479711[_0xd46e('0x49')]=_0xd46e('0x58');return![];}return _[_0xd46e('0x59')]([_0x479711[_0xd46e('0x5a')],_0x479711[_0xd46e('0x5b')],_0x479711[_0xd46e('0x5c')],_0x479711[_0xd46e('0x5d')],_0x479711[_0xd46e('0x5e')],_0x479711['voiceStatus'],_0x479711[_0xd46e('0x5f')]],isIdle);}function getAgentStatus(_0x259a1d){var _0x1c7f92=_0xd46e('0x4d');if(isAgentPaused(_0x259a1d))_0x1c7f92='pause';else if(isAgentPaused(_0x259a1d,!![]))_0x1c7f92='*pause';else if(isAgentIdle(_0x259a1d))_0x1c7f92=_0xd46e('0x57');else _0x1c7f92='busy';return _0x1c7f92;}exports[_0xd46e('0x60')]=function(_0x2af20b,_0x393cb9){var _0x31f7eb={'count':0x0,'rows':[]},_0x5a7870={},_0x38dfa7,_0x492329,_0x2afb57=[_0xd46e('0x61'),'online',_0xd46e('0x62'),_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x63'),_0xd46e('0x42'),_0xd46e('0x65'),_0xd46e('0x51'),_0xd46e('0x53'),_0xd46e('0x52'),_0xd46e('0x54'),_0xd46e('0x56'),_0xd46e('0x66'),_0xd46e('0x55'),_0xd46e('0x67'),'openchannelCapacity',_0xd46e('0x68'),_0xd46e('0x69'),_0xd46e('0x6a'),_0xd46e('0x6b'),'chatCurrentCapacity',_0xd46e('0x6c'),_0xd46e('0x6d'),_0xd46e('0x6e'),_0xd46e('0x6f'),'faxCurrentCapacity',_0xd46e('0x5a'),_0xd46e('0x5d'),'mailStatus','smsStatus',_0xd46e('0x5f'),_0xd46e('0x5b'),_0xd46e('0x49'),'chatStatusTime','openchannelStatusTime',_0xd46e('0x70'),_0xd46e('0x71'),_0xd46e('0x72'),_0xd46e('0x73'),_0xd46e('0x74'),_0xd46e('0x3d'),_0xd46e('0x75'),_0xd46e('0x76'),_0xd46e('0x77'),_0xd46e('0x78'),_0xd46e('0x79')],_0x354739=[_0xd46e('0x51'),_0xd46e('0x53'),_0xd46e('0x52'),_0xd46e('0x54'),_0xd46e('0x56'),'faxPause',_0xd46e('0x55'),_0xd46e('0x48')];Promise[_0xd46e('0x7a')]()['then'](function(){var _0x41b97c=_[_0xd46e('0x36')](db['User'][_0xd46e('0x7b')],function(_0x2c86fe){return{'name':_0x2c86fe[_0xd46e('0x7c')],'type':_0x2c86fe['type'][_0xd46e('0x7d')]};});_0x2af20b[_0xd46e('0x7e')][_0xd46e('0x7f')]='agent';_0x2af20b[_0xd46e('0x7e')]['online']=!![];_0x5a7870=qs[_0xd46e('0x80')](_0x41b97c,_0x2af20b);_0x5a7870[_0xd46e('0x81')]=!![];if(_0x2af20b[_0xd46e('0x82')]['role']===_0xd46e('0x82')){var _0x3edadc={'params':{'id':_0x2af20b[_0xd46e('0x82')][_0xd46e('0x83')]},'query':{'section':_0xd46e('0x11'),'role':_0xd46e('0x84'),'online':!![],'nolimit':_0x2af20b[_0xd46e('0x7e')][_0xd46e('0x85')],'sort':_0x2af20b[_0xd46e('0x7e')][_0xd46e('0x86')],'filter':_0x2af20b[_0xd46e('0x7e')][_0xd46e('0x3c')],'raw':!![]}};return db[_0xd46e('0x87')][_0xd46e('0x88')](_0x3edadc);}return db['User']['findAndCountAll'](_0x5a7870);})[_0xd46e('0x12')](function(_0x3e0ed5){_0x31f7eb[_0xd46e('0xa')]=_0x3e0ed5[_0xd46e('0xa')];_0x38dfa7=_0x3e0ed5[_0xd46e('0x89')];return getRealtimeAgents();})['then'](function(_0x1ed069){_0x492329=_0x1ed069[_0xd46e('0x89')];return _0x38dfa7[_0xd46e('0x36')](function(_0x7fa262){var _0x539db2=_[_0xd46e('0x3a')](_0x492329,['id',_0x7fa262['id']]);if(_0x539db2)_[_0xd46e('0x17')](_0x7fa262,_['pick'](_[_0xd46e('0x8a')](_0x539db2,_0x354739),_0x2afb57));_0x7fa262[_0xd46e('0x8b')]=getAgentStatus(_0x7fa262);return _0x7fa262;});})['then'](function(_0x38e4f8){if(_0x2af20b[_0xd46e('0x7e')]['globalStatusFilter']){var _0x44ba36=_['filter'](_0x38e4f8,[_0xd46e('0x8b'),_0x2af20b[_0xd46e('0x7e')]['globalStatusFilter']]);if(_0x2af20b['query'][_0xd46e('0x8c')]){_0x44ba36=_[_0xd46e('0x3c')](_0x44ba36,[_0xd46e('0x64'),_0x2af20b[_0xd46e('0x7e')]['pauseTypeFilter']]);}}_0x31f7eb[_0xd46e('0x89')]=_0x44ba36||_0x38e4f8;return _0x31f7eb;})[_0xd46e('0x12')](respondWithFilteredResult(_0x393cb9,_0x5a7870))['catch'](handleError(_0x393cb9,null));};exports[_0xd46e('0x8d')]=function(_0x2a2c4f,_0x2d2af0){var _0x1d8e42=[_0xd46e('0x8e'),_0xd46e('0x8f'),_0xd46e('0x90'),_0xd46e('0x91'),_0xd46e('0x92'),'whatsapp',_0xd46e('0x19')];var _0x1c1bae={'count':0x0,'rows':[]},_0x5ce170={},_0x39fe4d,_0x3ba83f,_0x1a28c1,_0x323044,_0x36fb44;Promise[_0xd46e('0x7a')]()['then'](function(){if(_0x2a2c4f['query'][_0xd46e('0x93')]){if(!_[_0xd46e('0x94')](_0x1d8e42,_0x2a2c4f['query']['channel']['toLowerCase']()))throw new Error(_0xd46e('0x95'));_0x39fe4d=_0x2a2c4f[_0xd46e('0x7e')][_0xd46e('0x93')]['toLowerCase']();}var _0x1b3cd8=_[_0xd46e('0x1a')](_0x39fe4d)+_0xd46e('0x4b');var _0x5186c9=_['map'](db[_0x1b3cd8]['rawAttributes'],function(_0x5c0740){return{'name':_0x5c0740[_0xd46e('0x7c')],'type':_0x5c0740['type'][_0xd46e('0x7d')]};});_0x5ce170=qs['getOptions'](_0x5186c9,_0x2a2c4f);if(_0x2a2c4f['user'][_0xd46e('0x7f')]===_0xd46e('0x82')){var _0x3df2c2={'params':{'id':_0x2a2c4f[_0xd46e('0x82')][_0xd46e('0x83')]},'query':{'section':_0x39fe4d===_0xd46e('0x19')&&_0x2a2c4f['query']['type']===_0xd46e('0x22')?_0xd46e('0x96'):_[_0xd46e('0x1a')](_0x39fe4d)+_0xd46e('0x97'),'type':_0x2a2c4f['query'][_0xd46e('0x98')],'nolimit':!![],'sort':_0xd46e('0x3e'),'filter':_0x2a2c4f['query'][_0xd46e('0x3c')]}};return db['UserProfile'][_0xd46e('0x88')](_0x3df2c2);}return db[_0x1b3cd8][_0xd46e('0x99')](_0x5ce170);})['then'](function(_0x59fb83){_0x1c1bae[_0xd46e('0xa')]=_0x59fb83[_0xd46e('0xa')];_0x3ba83f=_0x59fb83[_0xd46e('0x89')];return getRealtimeQueues(_0x2a2c4f,_0x39fe4d);})['then'](function(_0x24230c){_0x323044=_0x24230c[_0xd46e('0x89')];return getRealtimeAgents();})[_0xd46e('0x12')](function(_0x36edb9){_0x1a28c1=_0x36edb9[_0xd46e('0x89')];if(_0x39fe4d!=_0xd46e('0x19'))return;return getRealtimeVoiceQueueChannels();})[_0xd46e('0x12')](function(_0x14b07a){_0x36fb44=_0x14b07a?_0x14b07a[_0xd46e('0x89')]:[];return initializeQueues(_0x3ba83f,_0x323044,_0x39fe4d,_0x2a2c4f[_0xd46e('0x7e')][_0xd46e('0x98')]);})[_0xd46e('0x12')](function(_0x3c476d){var _0x1b2a6d=_0x3c476d[_0xd46e('0x36')](function(_0x1aa930){if(_0x39fe4d===_0xd46e('0x19'))return getVoiceQueueAgents(_0x1aa930,_0x3ba83f,_0x1a28c1,_0x36fb44);else return getQueueAgents(_0x1aa930,_0x1a28c1,_0x39fe4d);});return Promise[_0xd46e('0x9a')](_0x1b2a6d);})['then'](function(_0x3c9713){_0x1c1bae['rows']=_0x3c9713;return _0x1c1bae;})[_0xd46e('0x12')](respondWithFilteredResult(_0x2d2af0,_0x5ce170))[_0xd46e('0x18')](handleError(_0x2d2af0,null));}; \ No newline at end of file +var _0x33af=['agents','User','Queue','findAll','QueueId','idle','unknown','unavailable','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','pause','faxStatus','mailStatus','openchannelStatus','whatsappStatus','*pause','userpic','lastLoginAt','pauseType','chatCapacity','openchannelCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','fieldName','type','key','query','role','agent','raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','pauseTypeFilter','getQueues','chat','sms','fax','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','rawAttributes','getOptions','Queues','all','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','name','send','request','Agents','then','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','voice','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','get','loggedInDb','find','merge','pick','queue','length','some','connectedlinenum','internal','toString','busy','getMembers','UserId','online','voiceStatus'];(function(_0x35b46d,_0x110a43){var _0x28c852=function(_0x2f7dbe){while(--_0x2f7dbe){_0x35b46d['push'](_0x35b46d['shift']());}};_0x28c852(++_0x110a43);}(_0x33af,0xec));var _0xf33a=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0x33af[_0xb0b922];return _0x5dc41e;};'use strict';var util=require('util');var _=require(_0xf33a('0x0'));var jayson=require('jayson/promise');var qs=require(_0xf33a('0x1'));var logger=require(_0xf33a('0x2'))(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var amiClient=jayson[_0xf33a('0x5')][_0xf33a('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0xf33a('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x44cfa5,_0x583e54){return function(_0xc0dd13){if(_0xc0dd13){var _0x384b14=typeof _0x583e54[_0xf33a('0x7')]===_0xf33a('0x8')&&typeof _0x583e54[_0xf33a('0x9')]===_0xf33a('0x8');var _0x52517f=_0xc0dd13[_0xf33a('0xa')];var _0x14eb0e=_0x384b14?0x0:_0x583e54[_0xf33a('0x7')];var _0x457b3b=_0x384b14?_0xc0dd13[_0xf33a('0xa')]:_0x583e54[_0xf33a('0x7')]+_0x583e54['limit'];var _0x4ea282;if(_0x457b3b>=_0x52517f){_0x457b3b=_0x52517f;_0x4ea282=0xc8;}else{_0x4ea282=0xce;}_0x44cfa5[_0xf33a('0xb')](_0x4ea282);return _0x44cfa5[_0xf33a('0xc')](_0xf33a('0xd'),_0x14eb0e+'-'+_0x457b3b+'/'+_0x52517f)[_0xf33a('0xe')](_0xc0dd13);}return null;};}function handleError(_0x338d1b,_0x5959c9){_0x5959c9=_0x5959c9||0x1f4;return function(_0x9f87bc){logger[_0xf33a('0xf')](_0x9f87bc['stack']);if(_0x9f87bc['name']){delete _0x9f87bc[_0xf33a('0x10')];}_0x338d1b[_0xf33a('0xb')](_0x5959c9)[_0xf33a('0x11')](_0x9f87bc);};}function getRealtimeAgents(){return new Promise(function(_0x153bda,_0x1e9be2){return amiClient[_0xf33a('0x12')](_0xf33a('0x13'),{})[_0xf33a('0x14')](function(_0x507cb9){if(_0x507cb9[_0xf33a('0xf')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x75848d=_0x507cb9[_0xf33a('0x15')];return routingClient['request'](_0xf33a('0x13'),{})[_0xf33a('0x14')](function(_0x524109){if(_0x524109[_0xf33a('0xf')])throw new Error(_0xf33a('0x16'));var _0x38d69a=_0x524109[_0xf33a('0x15')];return _0x153bda(_['merge']({},_0x75848d,_0x38d69a));});})[_0xf33a('0x17')](function(_0x366bda){_0x1e9be2(_0x366bda);});});}function getRealtimeQueues(_0x2c295e,_0x30e383){return new Promise(function(_0x412727,_0x6cdf7b){var _0x19986f=_0x30e383===_0xf33a('0x18')?amiClient:routingClient;return _0x19986f[_0xf33a('0x12')](_[_0xf33a('0x19')](_0x30e383)+'Queues',_0x2c295e)[_0xf33a('0x14')](function(_0x272e60){if(_0x272e60[_0xf33a('0xf')])throw new Error(util[_0xf33a('0x1a')](_0xf33a('0x1b'),_0x30e383));return _0x412727(_0x272e60['result']);})[_0xf33a('0x17')](function(_0x5882ba){_0x6cdf7b(_0x5882ba);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x492986,_0x3f9ef7){return amiClient[_0xf33a('0x12')](_0xf33a('0x1c'),{})[_0xf33a('0x14')](function(_0x4b9801){if(_0x4b9801[_0xf33a('0xf')])throw new Error(_0xf33a('0x1d'));return _0x492986(_0x4b9801['result']);})['catch'](function(_0x16ef31){_0x3f9ef7(_0x16ef31);});});}function initializeQueues(_0x5f0a53,_0x5cf981,_0x38eba2,_0x4f60a4){var _0x79d653=['loggedIn',_0xf33a('0x1e'),_0xf33a('0x1f'),_0xf33a('0x20'),_0xf33a('0x21')];if(_0x38eba2===_0xf33a('0x18')&&_0x4f60a4===_0xf33a('0x22')){_0x79d653[_0xf33a('0x23')](_0xf33a('0x24'),_0xf33a('0x25'),_0xf33a('0x26'),_0xf33a('0x27'),_0xf33a('0x28'),_0xf33a('0x29'),_0xf33a('0x2a'),_0xf33a('0x2b'),'erlangCalls',_0xf33a('0x2c'),_0xf33a('0x2d'),_0xf33a('0x2e'),_0xf33a('0x2f'),'dialPredictiveIntervalMaxThreshold',_0xf33a('0x30'),_0xf33a('0x31'),_0xf33a('0x32'),_0xf33a('0x33'),_0xf33a('0x34'),_0xf33a('0x35'),'predictiveIntervalAvgHoldtime',_0xf33a('0x36'));}return _0x5f0a53[_0xf33a('0x37')](function(_0x3956aa){var _0x300007=_0x3956aa[_0xf33a('0x38')]({'plain':!![]});_0x300007['agents']=[];_0x300007['paused']=0x0;_0x300007[_0xf33a('0x39')]=0x0;_0x300007['loggedIn']=0x0;_0x300007['available']=0x0;_0x300007['waiting']=0x0;if(_0x38eba2===_0xf33a('0x18')){_0x300007[_0xf33a('0x20')]=0x0;_0x300007['busy']=0x0;if(_0x4f60a4===_0xf33a('0x22')){_0x300007['pTalking']=0x0;_0x300007[_0xf33a('0x25')]=0x0;}}var _0x1f11b3=_[_0xf33a('0x3a')](_0x5cf981,['id',_0x300007['id']]);if(_0x1f11b3)_[_0xf33a('0x3b')](_0x300007,_[_0xf33a('0x3c')](_0x1f11b3,_0x79d653));return _0x300007;});}function updateAgentVoiceStatus(_0x23c92b,_0x5a4076,_0x16ca8b){var _0x29a39f=_['filter'](_0x16ca8b,[_0xf33a('0x3d'),_0x5a4076[_0xf33a('0x10')]]);if(_0x29a39f[_0xf33a('0x3e')]===0x0)return _0x23c92b['busy']=!![];if(_[_0xf33a('0x3f')](_0x29a39f,[_0xf33a('0x40'),_0x23c92b[_0xf33a('0x41')][_0xf33a('0x42')]()]))return _0x23c92b[_0xf33a('0x20')]=!![];if(!_0x23c92b[_0xf33a('0x20')])return _0x23c92b[_0xf33a('0x43')]=!![];}function getVoiceQueueAgents(_0x128baf,_0xd488ef,_0x5eb1e3,_0x31028b){var _0x3e80b6=_['find'](_0xd488ef,['id',_0x128baf['id']]);if(!_0x3e80b6)return _0x128baf;return _0x3e80b6[_0xf33a('0x44')]({'raw':!![]})['then'](function(_0x548e77){for(var _0x3cff66=0x0;_0x3cff66<_0x548e77[_0xf33a('0x3e')];_0x3cff66++){var _0x4dada1=_[_0xf33a('0x3a')](_0x5eb1e3,['id',_0x548e77[_0x3cff66][_0xf33a('0x45')]]);if(!_0x4dada1){_0x4dada1={'id':_0x548e77[_0x3cff66][_0xf33a('0x45')],'name':_0x548e77[_0x3cff66]['UserId'],'accountcode':'','online':![]};}var _0xab672={'id':_0x4dada1['id'],'name':_0x4dada1[_0xf33a('0x10')],'internal':_0x4dada1['accountcode'],'online':Boolean(_0x4dada1[_0xf33a('0x46')]),'paused':Boolean(_0x548e77[_0x3cff66][_0xf33a('0x21')])};if(_0x4dada1[_0xf33a('0x47')]===_0xf33a('0x20'))updateAgentVoiceStatus(_0xab672,_0x128baf,_0x31028b);if(_0xab672[_0xf33a('0x46')])_0x128baf['loggedInDb']++;if(_0xab672[_0xf33a('0x43')])_0x128baf[_0xf33a('0x43')]++;if(_0xab672[_0xf33a('0x21')]&&!_0xab672[_0xf33a('0x43')]&&!_0xab672[_0xf33a('0x20')])_0x128baf['paused']++;_0x128baf[_0xf33a('0x48')][_0xf33a('0x23')](_0xab672);}return _0x128baf;});}function getQueueAgents(_0x6ae3ef,_0x5da70c,_0x12c448){var _0x43889e=_0xf33a('0x49')+_[_0xf33a('0x19')](_0x12c448)+_0xf33a('0x4a');var _0x6380fa=_0x12c448+'Pause';return db[_0x43889e][_0xf33a('0x4b')]({'where':{[_[_0xf33a('0x19')](_0x12c448)+_0xf33a('0x4c')]:_0x6ae3ef['id']},'raw':!![]})[_0xf33a('0x14')](function(_0x229533){for(var _0x47eea1=0x0;_0x47eea1<_0x229533[_0xf33a('0x3e')];_0x47eea1++){var _0x4e506f=_[_0xf33a('0x3a')](_0x5da70c,['id',_0x229533[_0x47eea1]['UserId']]);if(!_0x4e506f){_0x4e506f={'id':_0x229533[_0x47eea1][_0xf33a('0x45')],'name':_0x229533[_0x47eea1][_0xf33a('0x45')],'online':![],['pauseField']:![]};}var _0x4bcb39={'id':_0x4e506f['id'],'name':_0x4e506f['name'],'online':Boolean(_0x4e506f[_0xf33a('0x46')]),'paused':Boolean(_0x4e506f[_0x6380fa])};if(_0x4bcb39['online'])_0x6ae3ef[_0xf33a('0x39')]++;_0x6ae3ef[_0xf33a('0x48')][_0xf33a('0x23')](_0x4bcb39);}return _0x6ae3ef;});}function isIdle(_0x40ac5b){return _0x40ac5b===_0xf33a('0x4d')||_0x40ac5b===_0xf33a('0x4e')||_0x40ac5b===_0xf33a('0x4f')||_0x40ac5b===_0xf33a('0x50')||_[_0xf33a('0x51')](_0x40ac5b);}function isAgentPaused(_0xbe98a9,_0x704817){var _0x4107b1=[_0xbe98a9[_0xf33a('0x52')],_0xbe98a9[_0xf33a('0x53')],_0xbe98a9[_0xf33a('0x54')],_0xbe98a9[_0xf33a('0x55')],_0xbe98a9[_0xf33a('0x56')],_0xbe98a9[_0xf33a('0x57')],_0xbe98a9[_0xf33a('0x58')]];if(!_0x704817)return _[_0xf33a('0x59')](_0x4107b1);var _0xc0f0d3=_[_0xf33a('0x5a')](_0x4107b1);return _0xc0f0d3[_0xf33a('0x3e')]>0x0&&_0xc0f0d3[_0xf33a('0x3e')]<_0x4107b1[_0xf33a('0x3e')]?!![]:![];}function isAgentIdle(_0x1b15a1){if(_0x1b15a1[_0xf33a('0x47')]!==_0xf33a('0x4d')&&_0x1b15a1[_0xf33a('0x57')]){_0x1b15a1['voiceStatus']=_0xf33a('0x5b');return![];}return _[_0xf33a('0x59')]([_0x1b15a1['chatStatus'],_0x1b15a1[_0xf33a('0x5c')],_0x1b15a1[_0xf33a('0x5d')],_0x1b15a1[_0xf33a('0x5e')],_0x1b15a1['smsStatus'],_0x1b15a1[_0xf33a('0x47')],_0x1b15a1[_0xf33a('0x5f')]],isIdle);}function getAgentStatus(_0x29075a){var _0x599580=_0xf33a('0x4e');if(isAgentPaused(_0x29075a))_0x599580='pause';else if(isAgentPaused(_0x29075a,!![]))_0x599580=_0xf33a('0x60');else if(isAgentIdle(_0x29075a))_0x599580=_0xf33a('0x4d');else _0x599580='busy';return _0x599580;}exports['getAgents']=function(_0x370f94,_0x3ebf4c){var _0x453bb8={'count':0x0,'rows':[]},_0x49957c={},_0x469d75,_0x38c5df,_0x13ecfd=[_0xf33a('0x61'),_0xf33a('0x46'),_0xf33a('0x62'),'lastPauseAt',_0xf33a('0x63'),'lastPauseAt','internal','address',_0xf33a('0x52'),_0xf33a('0x55'),_0xf33a('0x54'),'smsPause',_0xf33a('0x58'),_0xf33a('0x53'),_0xf33a('0x57'),_0xf33a('0x64'),_0xf33a('0x65'),'mailCapacity','smsCapacity','whatsappCapacity',_0xf33a('0x66'),'chatCurrentCapacity',_0xf33a('0x67'),_0xf33a('0x68'),_0xf33a('0x69'),_0xf33a('0x6a'),_0xf33a('0x6b'),_0xf33a('0x6c'),'openchannelStatus',_0xf33a('0x5d'),_0xf33a('0x6d'),_0xf33a('0x5f'),'faxStatus',_0xf33a('0x47'),_0xf33a('0x6e'),_0xf33a('0x6f'),_0xf33a('0x70'),_0xf33a('0x71'),_0xf33a('0x72'),_0xf33a('0x73'),_0xf33a('0x74'),_0xf33a('0x3d'),_0xf33a('0x75'),_0xf33a('0x76'),_0xf33a('0x77'),_0xf33a('0x78'),_0xf33a('0x79')],_0x24f373=['chatPause','openchannelPause',_0xf33a('0x54'),_0xf33a('0x56'),_0xf33a('0x58'),_0xf33a('0x53'),_0xf33a('0x57'),_0xf33a('0x46')];Promise[_0xf33a('0x7a')]()[_0xf33a('0x14')](function(){var _0x5135b9=_[_0xf33a('0x37')](db[_0xf33a('0x49')]['rawAttributes'],function(_0x208e03){return{'name':_0x208e03[_0xf33a('0x7b')],'type':_0x208e03[_0xf33a('0x7c')][_0xf33a('0x7d')]};});_0x370f94[_0xf33a('0x7e')][_0xf33a('0x7f')]=_0xf33a('0x80');_0x370f94[_0xf33a('0x7e')][_0xf33a('0x46')]=!![];_0x49957c=qs['getOptions'](_0x5135b9,_0x370f94);_0x49957c[_0xf33a('0x81')]=!![];if(_0x370f94[_0xf33a('0x82')]['role']===_0xf33a('0x82')){var _0x2ebd7e={'params':{'id':_0x370f94[_0xf33a('0x82')][_0xf33a('0x83')]},'query':{'section':_0xf33a('0x13'),'role':_0xf33a('0x80'),'online':!![],'nolimit':_0x370f94['query'][_0xf33a('0x84')],'sort':_0x370f94[_0xf33a('0x7e')][_0xf33a('0x85')],'filter':_0x370f94[_0xf33a('0x7e')][_0xf33a('0x5a')],'raw':!![]}};return db[_0xf33a('0x86')][_0xf33a('0x87')](_0x2ebd7e);}return db['User'][_0xf33a('0x88')](_0x49957c);})[_0xf33a('0x14')](function(_0x502a80){_0x453bb8['count']=_0x502a80['count'];_0x469d75=_0x502a80[_0xf33a('0x89')];return getRealtimeAgents();})[_0xf33a('0x14')](function(_0xe23c77){_0x38c5df=_0xe23c77[_0xf33a('0x89')];return _0x469d75[_0xf33a('0x37')](function(_0xb3a823){var _0x3eb2c3=_[_0xf33a('0x3a')](_0x38c5df,['id',_0xb3a823['id']]);if(_0x3eb2c3)_[_0xf33a('0x3b')](_0xb3a823,_[_0xf33a('0x3c')](_[_0xf33a('0x8a')](_0x3eb2c3,_0x24f373),_0x13ecfd));_0xb3a823[_0xf33a('0x8b')]=getAgentStatus(_0xb3a823);return _0xb3a823;});})['then'](function(_0x167604){if(_0x370f94['query']['globalStatusFilter']){var _0x40b408=_[_0xf33a('0x5a')](_0x167604,[_0xf33a('0x8b'),_0x370f94['query']['globalStatusFilter']]);if(_0x370f94[_0xf33a('0x7e')]['pauseTypeFilter']){_0x40b408=_[_0xf33a('0x5a')](_0x40b408,[_0xf33a('0x63'),_0x370f94[_0xf33a('0x7e')][_0xf33a('0x8c')]]);}}_0x453bb8[_0xf33a('0x89')]=_0x40b408||_0x167604;return _0x453bb8;})['then'](respondWithFilteredResult(_0x3ebf4c,_0x49957c))['catch'](handleError(_0x3ebf4c,null));};exports[_0xf33a('0x8d')]=function(_0x4425a5,_0x28adb1){var _0xc221fc=['mail',_0xf33a('0x8e'),_0xf33a('0x8f'),'openchannel',_0xf33a('0x90'),_0xf33a('0x91'),_0xf33a('0x18')];var _0x489b73={'count':0x0,'rows':[]},_0x2b571f={},_0x37a991,_0x304e1e,_0x2d5817,_0x4a9a72,_0x1f02b5;Promise[_0xf33a('0x7a')]()[_0xf33a('0x14')](function(){if(_0x4425a5['query'][_0xf33a('0x92')]){if(!_[_0xf33a('0x93')](_0xc221fc,_0x4425a5[_0xf33a('0x7e')][_0xf33a('0x92')][_0xf33a('0x94')]()))throw new Error(_0xf33a('0x95'));_0x37a991=_0x4425a5[_0xf33a('0x7e')][_0xf33a('0x92')][_0xf33a('0x94')]();}var _0x402eaf=_[_0xf33a('0x19')](_0x37a991)+_0xf33a('0x4a');var _0x1add56=_[_0xf33a('0x37')](db[_0x402eaf][_0xf33a('0x96')],function(_0x4a35f8){return{'name':_0x4a35f8[_0xf33a('0x7b')],'type':_0x4a35f8[_0xf33a('0x7c')][_0xf33a('0x7d')]};});_0x2b571f=qs[_0xf33a('0x97')](_0x1add56,_0x4425a5);if(_0x4425a5[_0xf33a('0x82')][_0xf33a('0x7f')]===_0xf33a('0x82')){var _0x2dc012={'params':{'id':_0x4425a5[_0xf33a('0x82')][_0xf33a('0x83')]},'query':{'section':_0x37a991===_0xf33a('0x18')&&_0x4425a5[_0xf33a('0x7e')][_0xf33a('0x7c')]===_0xf33a('0x22')?'QueueCampaigns':_[_0xf33a('0x19')](_0x37a991)+_0xf33a('0x98'),'type':_0x4425a5[_0xf33a('0x7e')][_0xf33a('0x7c')],'nolimit':!![],'sort':'name','filter':_0x4425a5[_0xf33a('0x7e')][_0xf33a('0x5a')]}};return db[_0xf33a('0x86')][_0xf33a('0x87')](_0x2dc012);}return db[_0x402eaf][_0xf33a('0x88')](_0x2b571f);})[_0xf33a('0x14')](function(_0x212e3b){_0x489b73[_0xf33a('0xa')]=_0x212e3b['count'];_0x304e1e=_0x212e3b[_0xf33a('0x89')];return getRealtimeQueues(_0x4425a5,_0x37a991);})[_0xf33a('0x14')](function(_0x9c0b99){_0x4a9a72=_0x9c0b99[_0xf33a('0x89')];return getRealtimeAgents();})['then'](function(_0x4aa4f0){_0x2d5817=_0x4aa4f0[_0xf33a('0x89')];if(_0x37a991!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xf33a('0x14')](function(_0x1595b7){_0x1f02b5=_0x1595b7?_0x1595b7[_0xf33a('0x89')]:[];return initializeQueues(_0x304e1e,_0x4a9a72,_0x37a991,_0x4425a5[_0xf33a('0x7e')]['type']);})['then'](function(_0x465ee9){var _0x5c4a26=_0x465ee9[_0xf33a('0x37')](function(_0x11bb7f){if(_0x37a991===_0xf33a('0x18'))return getVoiceQueueAgents(_0x11bb7f,_0x304e1e,_0x2d5817,_0x1f02b5);else return getQueueAgents(_0x11bb7f,_0x2d5817,_0x37a991);});return Promise[_0xf33a('0x99')](_0x5c4a26);})[_0xf33a('0x14')](function(_0x498708){_0x489b73[_0xf33a('0x89')]=_0x498708;return _0x489b73;})[_0xf33a('0x14')](respondWithFilteredResult(_0x28adb1,_0x2b571f))[_0xf33a('0x17')](handleError(_0x28adb1,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c621762..3c94aee 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(_0x571c3b,_0x2c6850){var _0x546b8e=function(_0x595bb8){while(--_0x595bb8){_0x571c3b['push'](_0x571c3b['shift']());}};_0x546b8e(++_0x2c6850);}(_0x70e0,0x17b));var _0x070e=function(_0x11490c,_0x19788b){_0x11490c=_0x11490c-0x0;var _0x4e5f1=_0x70e0[_0x11490c];return _0x4e5f1;};'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(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 05d64b1..0145383 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 _0x3ca4=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x4e85ec,_0x2913b6){var _0x1c1ab3=function(_0x2c55b6){while(--_0x2c55b6){_0x4e85ec['push'](_0x4e85ec['shift']());}};_0x1c1ab3(++_0x2913b6);}(_0x3ca4,0x17d));var _0x43ca=function(_0x574e93,_0x539da0){_0x574e93=_0x574e93-0x0;var _0x3028a7=_0x3ca4[_0x574e93];return _0x3028a7;};'use strict';var Sequelize=require(_0x43ca('0x0'));module[_0x43ca('0x1')]={'state':{'type':Sequelize[_0x43ca('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x43ca('0x3')]},'starttime':{'type':Sequelize[_0x43ca('0x4')]},'responsetime':{'type':Sequelize[_0x43ca('0x4')]},'ringtime':{'type':Sequelize[_0x43ca('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x43ca('0x3')]},'campaigntype':{'type':Sequelize[_0x43ca('0x3')]},'membername':{'type':Sequelize[_0x43ca('0x3')]}}; \ No newline at end of file +var _0x1b65=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x4aa350,_0x12a9eb){var _0x32a16f=function(_0x658038){while(--_0x658038){_0x4aa350['push'](_0x4aa350['shift']());}};_0x32a16f(++_0x12a9eb);}(_0x1b65,0x1b4));var _0x51b6=function(_0x37026f,_0x2df88f){_0x37026f=_0x37026f-0x0;var _0x40cb74=_0x1b65[_0x37026f];return _0x40cb74;};'use strict';var Sequelize=require(_0x51b6('0x0'));module[_0x51b6('0x1')]={'state':{'type':Sequelize[_0x51b6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x51b6('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x51b6('0x3')]},'starttime':{'type':Sequelize[_0x51b6('0x4')]},'responsetime':{'type':Sequelize[_0x51b6('0x4')]},'ringtime':{'type':Sequelize[_0x51b6('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x51b6('0x3')]},'campaigntype':{'type':Sequelize[_0x51b6('0x3')]},'membername':{'type':Sequelize[_0x51b6('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index ac4484c..9cd27f5 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 _0xabf4=['../../config/logger','api','request-promise','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x3384ae,_0x1568e4){var _0x2223ec=function(_0x5ccae5){while(--_0x5ccae5){_0x3384ae['push'](_0x3384ae['shift']());}};_0x2223ec(++_0x1568e4);}(_0xabf4,0xbc));var _0x4abf=function(_0x4cf31f,_0x285ba6){_0x4cf31f=_0x4cf31f-0x0;var _0x5a2de3=_0xabf4[_0x4cf31f];return _0x5a2de3;};'use strict';var _=require(_0x4abf('0x0'));var util=require(_0x4abf('0x1'));var logger=require(_0x4abf('0x2'))(_0x4abf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4abf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4abf('0x5'));var attributes=require(_0x4abf('0x6'));module[_0x4abf('0x7')]=function(_0x1e846f,_0x51d845){return _0x1e846f['define'](_0x4abf('0x8'),attributes,{'tableName':_0x4abf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfab3=['exports','define','ReportAgentPreview','report_agent_preview','lodash','api','moment','request-promise','rimraf','./reportAgentPreview.attributes'];(function(_0x320f5f,_0x3166ca){var _0x16ff4c=function(_0x20c2db){while(--_0x20c2db){_0x320f5f['push'](_0x320f5f['shift']());}};_0x16ff4c(++_0x3166ca);}(_0xfab3,0x90));var _0x3fab=function(_0x2c41ba,_0x1818b5){_0x2c41ba=_0x2c41ba-0x0;var _0x23d1bd=_0xfab3[_0x2c41ba];return _0x23d1bd;};'use strict';var _=require(_0x3fab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3fab('0x1'));var moment=require(_0x3fab('0x2'));var BPromise=require('bluebird');var rp=require(_0x3fab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3fab('0x4'));var config=require('../../config/environment');var attributes=require(_0x3fab('0x5'));module[_0x3fab('0x6')]=function(_0x2b9812,_0x3d0b28){return _0x2b9812[_0x3fab('0x7')](_0x3fab('0x8'),attributes,{'tableName':_0x3fab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 0078104..37e8032 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 _0x6422=['create','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateReportAgentPreview'];(function(_0x545e77,_0x2629bc){var _0x4c8784=function(_0x4e55a0){while(--_0x4e55a0){_0x545e77['push'](_0x545e77['shift']());}};_0x4c8784(++_0x2629bc);}(_0x6422,0x1ea));var _0x2642=function(_0xf872db,_0x497522){_0xf872db=_0xf872db-0x0;var _0x1fdfe6=_0x6422[_0xf872db];return _0x1fdfe6;};'use strict';var _=require(_0x2642('0x0'));var util=require(_0x2642('0x1'));var moment=require('moment');var BPromise=require(_0x2642('0x2'));var rs=require(_0x2642('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2642('0x4'))['db'];var utils=require(_0x2642('0x5'));var logger=require(_0x2642('0x6'))(_0x2642('0x7'));var config=require(_0x2642('0x8'));var jayson=require(_0x2642('0x9'));var client=jayson[_0x2642('0xa')][_0x2642('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cb2ca,_0x195452,_0x4f2439){return new BPromise(function(_0x4cac2e,_0x2f30c4){return client['request'](_0x4cb2ca,_0x4f2439)[_0x2642('0xc')](function(_0x217d6d){logger[_0x2642('0xd')](_0x2642('0xe'),_0x195452,_0x2642('0xf'));logger[_0x2642('0x10')](_0x2642('0x11'),_0x195452,_0x2642('0xf'),JSON[_0x2642('0x12')](_0x217d6d));if(_0x217d6d['error']){if(_0x217d6d[_0x2642('0x13')]['code']===0x1f4){logger[_0x2642('0x13')](_0x2642('0xe'),_0x195452,_0x217d6d[_0x2642('0x13')][_0x2642('0x14')]);return _0x2f30c4(_0x217d6d[_0x2642('0x13')][_0x2642('0x14')]);}logger[_0x2642('0x13')](_0x2642('0xe'),_0x195452,_0x217d6d[_0x2642('0x13')]['message']);return _0x4cac2e(_0x217d6d['error'][_0x2642('0x14')]);}else{logger[_0x2642('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x195452,_0x2642('0xf'));_0x4cac2e(_0x217d6d['result']['message']);}})[_0x2642('0x15')](function(_0x10b306){logger[_0x2642('0x13')](_0x2642('0xe'),_0x195452,_0x10b306);_0x2f30c4(_0x10b306);});});}exports[_0x2642('0x16')]=function(_0x1ba006){var _0x225164=this;return new Promise(function(_0x2bb863,_0x25852f){return db['ReportAgentPreview'][_0x2642('0x17')](_0x1ba006[_0x2642('0x18')],{'raw':_0x1ba006[_0x2642('0x19')]?_0x1ba006[_0x2642('0x19')][_0x2642('0x1a')]===undefined?!![]:![]:!![]})[_0x2642('0xc')](function(_0x5a50fb){logger[_0x2642('0xd')](_0x2642('0x16'),_0x1ba006);logger[_0x2642('0x10')](_0x2642('0x16'),_0x1ba006,JSON[_0x2642('0x12')](_0x5a50fb));_0x2bb863(_0x5a50fb);})[_0x2642('0x15')](function(_0x2cbd0d){logger['error'](_0x2642('0x16'),_0x2cbd0d['message'],_0x1ba006);_0x25852f(_0x225164[_0x2642('0x13')](0x1f4,_0x2cbd0d[_0x2642('0x14')]));});});}; \ No newline at end of file +var _0x4c08=['client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','code','error','ReportAgentPreview,\x20%s,\x20%s','message','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x5b1fe6,_0x5678f8){var _0x37db41=function(_0x15cbc1){while(--_0x15cbc1){_0x5b1fe6['push'](_0x5b1fe6['shift']());}};_0x37db41(++_0x5678f8);}(_0x4c08,0x1ee));var _0x84c0=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x4c08[_0x4394b6];return _0x360244;};'use strict';var _=require(_0x84c0('0x0'));var util=require('util');var moment=require(_0x84c0('0x1'));var BPromise=require(_0x84c0('0x2'));var rs=require(_0x84c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x84c0('0x4'));var logger=require(_0x84c0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x84c0('0x6')][_0x84c0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bf8bf,_0x4f8c5e,_0x1e3b03){return new BPromise(function(_0x537b6b,_0x47a760){return client[_0x84c0('0x8')](_0x3bf8bf,_0x1e3b03)[_0x84c0('0x9')](function(_0x2a66f5){logger[_0x84c0('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f8c5e,_0x84c0('0xb'));logger[_0x84c0('0xc')](_0x84c0('0xd'),_0x4f8c5e,_0x84c0('0xb'),JSON[_0x84c0('0xe')](_0x2a66f5));if(_0x2a66f5['error']){if(_0x2a66f5['error'][_0x84c0('0xf')]===0x1f4){logger[_0x84c0('0x10')](_0x84c0('0x11'),_0x4f8c5e,_0x2a66f5['error'][_0x84c0('0x12')]);return _0x47a760(_0x2a66f5['error']['message']);}logger[_0x84c0('0x10')](_0x84c0('0x11'),_0x4f8c5e,_0x2a66f5[_0x84c0('0x10')][_0x84c0('0x12')]);return _0x537b6b(_0x2a66f5['error'][_0x84c0('0x12')]);}else{logger[_0x84c0('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f8c5e,_0x84c0('0xb'));_0x537b6b(_0x2a66f5['result'][_0x84c0('0x12')]);}})['catch'](function(_0x2b41f3){logger[_0x84c0('0x10')](_0x84c0('0x11'),_0x4f8c5e,_0x2b41f3);_0x47a760(_0x2b41f3);});});}exports[_0x84c0('0x13')]=function(_0x2464c6){var _0x48736f=this;return new Promise(function(_0x1494f5,_0x5aa3c4){return db[_0x84c0('0x14')][_0x84c0('0x15')](_0x2464c6[_0x84c0('0x16')],{'raw':_0x2464c6['options']?_0x2464c6[_0x84c0('0x17')][_0x84c0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xaa421){logger[_0x84c0('0xa')](_0x84c0('0x13'),_0x2464c6);logger['debug']('CreateReportAgentPreview',_0x2464c6,JSON[_0x84c0('0xe')](_0xaa421));_0x1494f5(_0xaa421);})['catch'](function(_0x1aa8fb){logger['error'](_0x84c0('0x13'),_0x1aa8fb[_0x84c0('0x12')],_0x2464c6);_0x5aa3c4(_0x48736f[_0x84c0('0x10')](0x1f4,_0x1aa8fb[_0x84c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e624a9f..7c7fc81 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 _0xac1e=['/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','/agents/:id/capacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues'];(function(_0x3f596c,_0x3d4f0d){var _0x524da3=function(_0x2381df){while(--_0x2381df){_0x3f596c['push'](_0x3f596c['shift']());}};_0x524da3(++_0x3d4f0d);}(_0xac1e,0x143));var _0xeac1=function(_0x11d1dc,_0x1d7dd1){_0x11d1dc=_0x11d1dc-0x0;var _0x4a2e50=_0xac1e[_0x11d1dc];return _0x4a2e50;};'use strict';var multer=require(_0xeac1('0x0'));var util=require(_0xeac1('0x1'));var path=require(_0xeac1('0x2'));var express=require(_0xeac1('0x3'));var router=express[_0xeac1('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xeac1('0x5'));router['get'](_0xeac1('0x6'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x8')]);router[_0xeac1('0x9')](_0xeac1('0xa'),auth[_0xeac1('0x7')](),controller['voiceChannelMixMonitor']);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xeac1('0x7')](),controller[_0xeac1('0xb')]);router[_0xeac1('0x9')](_0xeac1('0xc'),auth[_0xeac1('0x7')](),controller[_0xeac1('0xd')]);router[_0xeac1('0x9')](_0xeac1('0xe'),auth[_0xeac1('0x7')](),controller['chatQueues']);router['get'](_0xeac1('0xf'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xeac1('0x9')]('/mail/accounts',auth[_0xeac1('0x7')](),controller['mailAccounts']);router['get']('/openchannel/queues',auth['isAuthenticated'](),controller[_0xeac1('0x10')]);router[_0xeac1('0x9')](_0xeac1('0x11'),auth[_0xeac1('0x7')](),controller['smsQueues']);router[_0xeac1('0x9')](_0xeac1('0x12'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x13')]);router[_0xeac1('0x9')](_0xeac1('0x14'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x15')]);router['get'](_0xeac1('0x16'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x17')]);router[_0xeac1('0x9')](_0xeac1('0x18'),auth['isAuthenticated'](),controller[_0xeac1('0x19')]);router['get']('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xeac1('0x1a')]);router[_0xeac1('0x9')](_0xeac1('0x1b'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x1c')]);router[_0xeac1('0x9')](_0xeac1('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0xeac1('0x9')]('/voice/queues/:id',auth[_0xeac1('0x7')](),controller[_0xeac1('0x1e')]);router['put'](_0xeac1('0x1f'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x20')]);router['get'](_0xeac1('0x21'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x22')]);router[_0xeac1('0x9')]('/outbound/channels',auth[_0xeac1('0x7')](),controller[_0xeac1('0x23')]);router[_0xeac1('0x9')]('/agents',auth[_0xeac1('0x7')](),controller[_0xeac1('0x24')]);router['put'](_0xeac1('0x25'),auth[_0xeac1('0x7')](),controller['agentCapacity']);router[_0xeac1('0x9')](_0xeac1('0x26'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x27')]);router[_0xeac1('0x9')](_0xeac1('0x28'),auth[_0xeac1('0x7')](),controller['trunks']);router[_0xeac1('0x9')](_0xeac1('0x29'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x2a')]);router[_0xeac1('0x9')](_0xeac1('0x2b'),auth[_0xeac1('0x7')](),controller['faxAccounts']);router[_0xeac1('0x9')](_0xeac1('0x2c'),auth['isAuthenticated'](),controller[_0xeac1('0x2d')]);router[_0xeac1('0x9')](_0xeac1('0x2e'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x2f')]);router[_0xeac1('0x9')]('/openchannel/queues/waitinginteractions',auth[_0xeac1('0x7')](),controller[_0xeac1('0x30')]);router['get'](_0xeac1('0x31'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x32')]);router[_0xeac1('0x9')](_0xeac1('0x33'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x34')]);router[_0xeac1('0x9')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xeac1('0x35')]);router['get'](_0xeac1('0x36'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x37')]);router[_0xeac1('0x38')](_0xeac1('0x39'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x3a')](_0xeac1('0x3b')));router[_0xeac1('0x9')](_0xeac1('0x3c'),auth[_0xeac1('0x7')](),controller['showMailQueues']);router[_0xeac1('0x38')](_0xeac1('0x3d'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x3a')](_0xeac1('0x3e')));router[_0xeac1('0x9')](_0xeac1('0x3f'),auth[_0xeac1('0x7')](),controller['showChatQueues']);router['post'](_0xeac1('0x40'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x3a')](_0xeac1('0x41')));router[_0xeac1('0x9')](_0xeac1('0x42'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x43')]);router[_0xeac1('0x38')](_0xeac1('0x44'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x3a')](_0xeac1('0x45')));router['get'](_0xeac1('0x46'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x47')]);router[_0xeac1('0x38')](_0xeac1('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0xeac1('0x49')));router[_0xeac1('0x38')](_0xeac1('0x4a'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x3a')]('whatsapp'));router[_0xeac1('0x9')]('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router[_0xeac1('0x9')](_0xeac1('0x4b'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0xeac1('0x38')](_0xeac1('0x4c'),auth[_0xeac1('0x7')](),controller[_0xeac1('0x4d')]);module[_0xeac1('0x4e')]=router; \ No newline at end of file +var _0x314e=['/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/agents','agents'];(function(_0x327ce4,_0x13cdb8){var _0x31d352=function(_0xb542cd){while(--_0xb542cd){_0x327ce4['push'](_0x327ce4['shift']());}};_0x31d352(++_0x13cdb8);}(_0x314e,0x173));var _0xe314=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x314e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe314('0x0'));var util=require(_0xe314('0x1'));var path=require(_0xe314('0x2'));var express=require('express');var router=express[_0xe314('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xe314('0x4'));router[_0xe314('0x5')]('/voice/channels',auth[_0xe314('0x6')](),controller['voiceChannels']);router[_0xe314('0x5')](_0xe314('0x7'),auth[_0xe314('0x6')](),controller['voiceChannelMixMonitor']);router['get'](_0xe314('0x8'),auth[_0xe314('0x6')](),controller[_0xe314('0x9')]);router['get']('/voice/queues',auth[_0xe314('0x6')](),controller[_0xe314('0xa')]);router[_0xe314('0x5')](_0xe314('0xb'),auth[_0xe314('0x6')](),controller[_0xe314('0xc')]);router[_0xe314('0x5')]('/mail/queues',auth['isAuthenticated'](),controller[_0xe314('0xd')]);router[_0xe314('0x5')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xe314('0xe')]);router[_0xe314('0x5')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0xe314('0xf')]);router[_0xe314('0x5')](_0xe314('0x10'),auth[_0xe314('0x6')](),controller[_0xe314('0x11')]);router[_0xe314('0x5')](_0xe314('0x12'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xe314('0x5')]('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0xe314('0x5')]('/voice/queues/preview/:id',auth[_0xe314('0x6')](),controller[_0xe314('0x13')]);router['get'](_0xe314('0x14'),auth[_0xe314('0x6')](),controller[_0xe314('0x15')]);router[_0xe314('0x5')]('/voice/queues/channels/:uniqueid',auth[_0xe314('0x6')](),controller[_0xe314('0x16')]);router[_0xe314('0x5')](_0xe314('0x17'),auth[_0xe314('0x6')](),controller[_0xe314('0x18')]);router[_0xe314('0x5')](_0xe314('0x19'),auth[_0xe314('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0xe314('0x5')](_0xe314('0x1a'),auth['isAuthenticated'](),controller[_0xe314('0x1b')]);router[_0xe314('0x1c')](_0xe314('0x1a'),auth[_0xe314('0x6')](),controller[_0xe314('0x1d')]);router['get'](_0xe314('0x1e'),auth[_0xe314('0x6')](),controller[_0xe314('0x1f')]);router[_0xe314('0x5')]('/outbound/channels',auth[_0xe314('0x6')](),controller['outboundChannels']);router[_0xe314('0x5')](_0xe314('0x20'),auth[_0xe314('0x6')](),controller[_0xe314('0x21')]);router['put'](_0xe314('0x22'),auth[_0xe314('0x6')](),controller[_0xe314('0x23')]);router[_0xe314('0x5')](_0xe314('0x24'),auth[_0xe314('0x6')](),controller[_0xe314('0x25')]);router[_0xe314('0x5')](_0xe314('0x26'),auth['isAuthenticated'](),controller[_0xe314('0x27')]);router[_0xe314('0x5')](_0xe314('0x28'),auth['isAuthenticated'](),controller[_0xe314('0x29')]);router['get'](_0xe314('0x2a'),auth[_0xe314('0x6')](),controller[_0xe314('0x2b')]);router[_0xe314('0x5')]('/chat/queues/waitinginteractions',auth[_0xe314('0x6')](),controller[_0xe314('0x2c')]);router[_0xe314('0x5')](_0xe314('0x2d'),auth[_0xe314('0x6')](),controller[_0xe314('0x2e')]);router[_0xe314('0x5')](_0xe314('0x2f'),auth['isAuthenticated'](),controller[_0xe314('0x30')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0xe314('0x6')](),controller[_0xe314('0x31')]);router['get'](_0xe314('0x32'),auth[_0xe314('0x6')](),controller[_0xe314('0x33')]);router[_0xe314('0x5')](_0xe314('0x34'),auth[_0xe314('0x6')](),controller[_0xe314('0x35')]);router[_0xe314('0x5')](_0xe314('0x36'),auth[_0xe314('0x6')](),controller[_0xe314('0x37')]);router[_0xe314('0x38')](_0xe314('0x39'),auth[_0xe314('0x6')](),controller[_0xe314('0x3a')](_0xe314('0x3b')));router[_0xe314('0x5')](_0xe314('0x3c'),auth[_0xe314('0x6')](),controller[_0xe314('0x3d')]);router['post'](_0xe314('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0xe314('0x3f')));router['get']('/chat/queues/:id',auth[_0xe314('0x6')](),controller[_0xe314('0x40')]);router[_0xe314('0x38')](_0xe314('0x41'),auth[_0xe314('0x6')](),controller[_0xe314('0x3a')](_0xe314('0x42')));router['get'](_0xe314('0x43'),auth[_0xe314('0x6')](),controller['showFaxQueues']);router[_0xe314('0x38')](_0xe314('0x44'),auth[_0xe314('0x6')](),controller['queueNotify'](_0xe314('0x45')));router['get']('/openchannel/queues/:id',auth[_0xe314('0x6')](),controller[_0xe314('0x46')]);router['post'](_0xe314('0x47'),auth[_0xe314('0x6')](),controller[_0xe314('0x3a')]('sms'));router[_0xe314('0x38')](_0xe314('0x48'),auth[_0xe314('0x6')](),controller[_0xe314('0x3a')](_0xe314('0x49')));router[_0xe314('0x5')](_0xe314('0x4a'),auth[_0xe314('0x6')](),controller[_0xe314('0x4b')]);router[_0xe314('0x5')](_0xe314('0x4c'),auth[_0xe314('0x6')](),controller[_0xe314('0x4d')]);router[_0xe314('0x38')](_0xe314('0x4e'),auth[_0xe314('0x6')](),controller[_0xe314('0x4f')]);module[_0xe314('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 82bc8d5..af98f7a 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 _0xed1f=['voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','then','voiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','chat','User','update','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','catch','json','sendStatus','stack','name','status','isNil','rows','find','VoiceChannels','query'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xed1f,0x6a));var _0xfed1=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xed1f[_0x4ae6ef];return _0x3cbb4e;};'use strict';var BPromise=require(_0xfed1('0x0'));var moment=require(_0xfed1('0x1'));var _=require(_0xfed1('0x2'));var util=require(_0xfed1('0x3'));var db=require(_0xfed1('0x4'))['db'];var logger=require(_0xfed1('0x5'))(_0xfed1('0x6'));var jayson=require(_0xfed1('0x7'));var amiClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232a});var mailClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232b});var routingClient=jayson[_0xfed1('0x8')][_0xfed1('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){var _0x42dd5c=_0x2a6082?_0x2a6082:amiClient;return _0x42dd5c[_0xfed1('0xa')](_0x380e18,_0x612b38)['then'](function(_0x1414be){if(_0x1414be[_0xfed1('0xb')]){if(_0x1414be['error'][_0xfed1('0xc')]===0x1f4){return _0x568d48(_0x1414be['error'][_0xfed1('0xd')]);}return _0x2967ef(_0x1414be[_0xfed1('0xb')]['message']);}else{_0x2967ef(_0x1414be['result']);}})[_0xfed1('0xe')](function(_0xe84ba6){_0x568d48(_0xe84ba6);});});}function respondWithResult(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xc8;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['status'](_0x17f4fe)[_0xfed1('0xf')](_0x5a3469);}return _0x569a6e[_0xfed1('0x10')](0x194);};}function handleError(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0x1f4;return function(_0x5b9455){logger['error'](_0x5b9455[_0xfed1('0x11')]);if(_0x5b9455[_0xfed1('0x12')]){delete _0x5b9455[_0xfed1('0x12')];}_0x532537[_0xfed1('0x13')](_0x2dde3a)['send'](_0x5b9455);};}function findById(_0x1a00f6){return function(_0x4af928){if(!_[_0xfed1('0x14')](_0x1a00f6)&&!_[_0xfed1('0x14')](_0x4af928)&&!_['isNil'](_0x4af928[_0xfed1('0x15')])){return _[_0xfed1('0x16')](_0x4af928['rows'],function(_0x59509b){return _0x59509b['id']==_0x1a00f6;});}return null;};}exports['voiceChannels']=function(_0x1e5afb,_0x51f12a){return respondWithRpcPromise(_0xfed1('0x17'),_0x1e5afb[_0xfed1('0x18')])['then'](respondWithResult(_0x51f12a,null))[_0xfed1('0xe')](handleError(_0x51f12a,null));};exports[_0xfed1('0x19')]=function(_0x59ee9d,_0x3ce944){return respondWithRpcPromise(_0xfed1('0x1a'),_[_0xfed1('0x1b')](_0x59ee9d[_0xfed1('0x18')],_0x59ee9d['params']))[_0xfed1('0x1c')](respondWithResult(_0x3ce944,null))['catch'](handleError(_0x3ce944,null));};exports[_0xfed1('0x1d')]=function(_0x1317c8,_0x37c384){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xfed1('0x1b')](_0x1317c8['query'],_0x1317c8[_0xfed1('0x1e')]))[_0xfed1('0x1c')](respondWithResult(_0x37c384,null))[_0xfed1('0xe')](handleError(_0x37c384,null));};exports[_0xfed1('0x1f')]=function(_0x186ecc,_0x1199b7){return respondWithRpcPromise('VoiceQueues',_0x186ecc[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x1199b7,null))['catch'](handleError(_0x1199b7,null));};exports[_0xfed1('0x20')]=function(_0x2b9dd2,_0x1b871a){return respondWithRpcPromise(_0xfed1('0x21'),_0x2b9dd2[_0xfed1('0x18')])[_0xfed1('0x1c')](findById(_0x2b9dd2['params']['id']))[_0xfed1('0x1c')](respondWithResult(_0x1b871a,null))['catch'](handleError(_0x1b871a,null));};exports[_0xfed1('0x22')]=function(_0x4e5249,_0x53b0c9){return respondWithRpcPromise(_0xfed1('0x23'),_[_0xfed1('0x1b')](_0x4e5249[_0xfed1('0x24')],_0x4e5249['params']))[_0xfed1('0x1c')](respondWithResult(_0x53b0c9,null))[_0xfed1('0xe')](handleError(_0x53b0c9,null));};exports[_0xfed1('0x25')]=function(_0x383955,_0x12399f){return respondWithRpcPromise(_0xfed1('0x26'),_['merge'](_0x383955[_0xfed1('0x18')],_0x383955[_0xfed1('0x1e')]))['then'](respondWithResult(_0x12399f,null))['catch'](handleError(_0x12399f,null));};exports[_0xfed1('0x27')]=function(_0x2d10f5,_0x2def09){return respondWithRpcPromise(_0xfed1('0x28'),_0x2d10f5[_0xfed1('0x18')])['then'](respondWithResult(_0x2def09,null))[_0xfed1('0xe')](handleError(_0x2def09,null));};exports[_0xfed1('0x29')]=function(_0x10143b,_0x349de1){return respondWithRpcPromise(_0xfed1('0x2a'),_['merge'](_0x10143b[_0xfed1('0x18')],_0x10143b['params']))[_0xfed1('0x1c')](respondWithResult(_0x349de1,null))[_0xfed1('0xe')](handleError(_0x349de1,null));};exports[_0xfed1('0x2b')]=function(_0x321c1b,_0x1c0523){return respondWithRpcPromise(_0xfed1('0x2c'),_[_0xfed1('0x1b')](_0x321c1b[_0xfed1('0x18')],_0x321c1b['params']))[_0xfed1('0x1c')](respondWithResult(_0x1c0523,null))[_0xfed1('0xe')](handleError(_0x1c0523,null));};exports[_0xfed1('0x2d')]=function(_0x28adfc,_0x57da75){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xfed1('0x1b')](_0x28adfc[_0xfed1('0x18')],_0x28adfc[_0xfed1('0x1e')]))[_0xfed1('0x1c')](respondWithResult(_0x57da75,null))[_0xfed1('0xe')](handleError(_0x57da75,null));};exports[_0xfed1('0x2e')]=function(_0x46a150,_0x2f183c){return respondWithRpcPromise('Outbound',_0x46a150['query'])[_0xfed1('0x1c')](respondWithResult(_0x2f183c,null))[_0xfed1('0xe')](handleError(_0x2f183c,null));};exports['outboundChannels']=function(_0x1dae7c,_0x15339c){return respondWithRpcPromise(_0xfed1('0x2f'),_0x1dae7c[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x15339c,null))[_0xfed1('0xe')](handleError(_0x15339c,null));};exports[_0xfed1('0x30')]=function(_0x4118d4,_0x3c27de){var _0x5f3e1f;return respondWithRpcPromise('Agents',_0x4118d4['query'])[_0xfed1('0x1c')](function(_0x340e3c){_0x5f3e1f=_0x340e3c;return respondWithRpcPromise(_0xfed1('0x31'),_0x4118d4['query'],routingClient);})[_0xfed1('0x1c')](function(_0x4a0b04){return _[_0xfed1('0x1b')]({},_0x4a0b04,_0x5f3e1f);})[_0xfed1('0x1c')](respondWithResult(_0x3c27de,null))[_0xfed1('0xe')](handleError(_0x3c27de,null));};exports['agentCapacity']=function(_0x20bdae,_0x6f1647){if(_0x20bdae[_0xfed1('0x24')]&&_0x20bdae['body'][_0xfed1('0x32')]&&_0x20bdae['user']&&_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')]){for(var _0x229fc7 in _0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')]){if(_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0xfed1('0x34')](_0x229fc7)){db[_0xfed1('0x35')]['findAll']({'where':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'type':_0xfed1('0x36'),'exitAt':null,'uniqueid':_0x20bdae['body']['interaction'][_0x229fc7]&&_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xfed1('0x37')]?{'$notIn':_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7]}:{'$ne':null}}})[_0xfed1('0x1c')](function(_0x2547ee){var _0x24bf7a=moment()[_0xfed1('0x38')](_0xfed1('0x39'));for(var _0x61f65b=0x0,_0x1db6dc=_0x2547ee['length'];_0x61f65b<_0x1db6dc;_0x61f65b+=0x1){_0x2547ee[_0x61f65b][_0xfed1('0x3a')]({'exitAt':_0x24bf7a});}});for(var _0xb61d09=0x0;_0xb61d09<_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xfed1('0x37')];_0xb61d09+=0x1){db[_0xfed1('0x35')]['findOrCreate']({'where':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'type':_0xfed1('0x36'),'uniqueid':_0x20bdae['body'][_0xfed1('0x32')][_0x229fc7][_0xb61d09],'exitAt':null},'defaults':{'channel':_0x229fc7,'membername':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')],'interface':_[_0xfed1('0x14')](_0x20bdae['user'][_0xfed1('0x3b')])?util[_0xfed1('0x38')](_0xfed1('0x3c'),_0x20bdae[_0xfed1('0x33')][_0xfed1('0x12')]):_0x20bdae[_0xfed1('0x33')][_0xfed1('0x3b')],'type':_0xfed1('0x36'),'enterAt':moment()[_0xfed1('0x38')](_0xfed1('0x39')),'role':_0xfed1('0x3d'),'internal':_0x20bdae[_0xfed1('0x33')][_0xfed1('0x3e')],'uniqueid':_0x20bdae[_0xfed1('0x24')][_0xfed1('0x32')][_0x229fc7][_0xb61d09]}});}}}}return respondWithRpcPromise(_0xfed1('0x3f'),{'id':_0x20bdae[_0xfed1('0x1e')]['id'],'capacity':_0x20bdae[_0xfed1('0x24')]['capacity']},routingClient)['then'](respondWithResult(_0x6f1647,null))[_0xfed1('0xe')](handleError(_0x6f1647,null));};exports[_0xfed1('0x40')]=function(_0x5be0c3,_0x1358c1){return respondWithRpcPromise('Telephones',_0x5be0c3[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x1358c1,null))['catch'](handleError(_0x1358c1,null));};exports['trunks']=function(_0x49f696,_0x2376b3){return respondWithRpcPromise(_0xfed1('0x41'),_0x49f696[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x2376b3,null))[_0xfed1('0xe')](handleError(_0x2376b3,null));};exports[_0xfed1('0x42')]=function(_0x1a9f22,_0x144102){return respondWithRpcPromise(_0xfed1('0x43'),_0x1a9f22[_0xfed1('0x18')])['then'](respondWithResult(_0x144102,null))['catch'](handleError(_0x144102,null));};exports[_0xfed1('0x44')]=function(_0x2a2eaa,_0x3f4db7){return respondWithRpcPromise(_0xfed1('0x45'),_0x2a2eaa[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x3f4db7,null))[_0xfed1('0xe')](handleError(_0x3f4db7,null));};exports[_0xfed1('0x46')]=function(_0x117e25,_0x427fa6){return respondWithRpcPromise(_0xfed1('0x45'),_0x117e25[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x117e25[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x427fa6,null))[_0xfed1('0xe')](handleError(_0x427fa6,null));};exports[_0xfed1('0x47')]=function(_0x54eb53,_0x5b167b){return respondWithRpcPromise(_0xfed1('0x48'),_0x54eb53[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x5b167b,null))[_0xfed1('0xe')](handleError(_0x5b167b,null));};exports[_0xfed1('0x49')]=function(_0x41a22a,_0x2ccdc3){return respondWithRpcPromise(_0xfed1('0x48'),_0x41a22a[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x41a22a[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x2ccdc3,null))[_0xfed1('0xe')](handleError(_0x2ccdc3,null));};exports[_0xfed1('0x4a')]=function(_0x59ecc4,_0x30cf99){return respondWithRpcPromise('MailAccounts',_0x59ecc4['query'],mailClient)[_0xfed1('0x1c')](respondWithResult(_0x30cf99,null))['catch'](handleError(_0x30cf99,null));};exports[_0xfed1('0x4b')]=function(_0x5acc45,_0x390fc0){return respondWithRpcPromise(_0xfed1('0x4c'),_0x5acc45['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x390fc0,null))[_0xfed1('0xe')](handleError(_0x390fc0,null));};exports['showOpenchannelQueues']=function(_0x29b51e,_0x41b407){return respondWithRpcPromise(_0xfed1('0x4c'),_0x29b51e[_0xfed1('0x18')],routingClient)['then'](findById(_0x29b51e[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x41b407,null))[_0xfed1('0xe')](handleError(_0x41b407,null));};exports[_0xfed1('0x4d')]=function(_0x23347a,_0xf4e660){return respondWithRpcPromise(_0xfed1('0x4e'),_0x23347a[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0xf4e660,null))[_0xfed1('0xe')](handleError(_0xf4e660,null));};exports[_0xfed1('0x4f')]=function(_0x18e958,_0x4112c1){return respondWithRpcPromise(_0xfed1('0x4e'),_0x18e958[_0xfed1('0x18')],routingClient)['then'](findById(_0x18e958['params']['id']))['then'](respondWithResult(_0x4112c1,null))[_0xfed1('0xe')](handleError(_0x4112c1,null));};exports[_0xfed1('0x50')]=function(_0x3aea22,_0x2fb9b2){return respondWithRpcPromise('WhatsappQueues',_0x3aea22[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0x2fb9b2,null))[_0xfed1('0xe')](handleError(_0x2fb9b2,null));};exports[_0xfed1('0x51')]=function(_0x18af7d,_0x3beef3){return respondWithRpcPromise(_0xfed1('0x52'),_0x18af7d['query'],routingClient)[_0xfed1('0x1c')](findById(_0x18af7d[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x3beef3,null))['catch'](handleError(_0x3beef3,null));};exports[_0xfed1('0x53')]=function(_0x103628,_0x28dbaa){return respondWithRpcPromise(_0xfed1('0x54'),_0x103628['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x28dbaa,null))['catch'](handleError(_0x28dbaa,null));};exports[_0xfed1('0x55')]=function(_0x2d64d3,_0x4b685b){return respondWithRpcPromise('FaxQueues',_0x2d64d3[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](findById(_0x2d64d3[_0xfed1('0x1e')]['id']))[_0xfed1('0x1c')](respondWithResult(_0x4b685b,null))['catch'](handleError(_0x4b685b,null));};exports[_0xfed1('0x56')]=function(_0x440e40,_0x42bc11){return respondWithRpcPromise(_0xfed1('0x57'),_0x440e40[_0xfed1('0x18')])[_0xfed1('0x1c')](respondWithResult(_0x42bc11,null))['catch'](handleError(_0x42bc11,null));};exports[_0xfed1('0x58')]=function(_0x93411d,_0x5ceedd){return respondWithRpcPromise(_0xfed1('0x59'),_0x93411d[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x5ceedd,null))[_0xfed1('0xe')](handleError(_0x5ceedd,null));};exports[_0xfed1('0x5a')]=function(_0x26ecb9,_0x4fc7b5){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x26ecb9[_0xfed1('0x18')],routingClient)['then'](respondWithResult(_0x4fc7b5,null))[_0xfed1('0xe')](handleError(_0x4fc7b5,null));};exports[_0xfed1('0x5b')]=function(_0x5d8742,_0xdc237c){return respondWithRpcPromise(_0xfed1('0x5c'),_0x5d8742[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0xdc237c,null))[_0xfed1('0xe')](handleError(_0xdc237c,null));};exports[_0xfed1('0x5d')]=function(_0x4104fe,_0x49213b){return respondWithRpcPromise(_0xfed1('0x5c'),_0x4104fe[_0xfed1('0x18')],routingClient)['then'](function(_0x544605){if(_0x4104fe[_0xfed1('0x18')]['type']!==undefined){var _0x1f4e2b=_(_0x544605[_0xfed1('0x15')])[_0xfed1('0x5e')]([_0x4104fe['query'][_0xfed1('0x5f')],_0x4104fe[_0xfed1('0x1e')]['id']])[_0xfed1('0x60')](_0xfed1('0x61'))[_0xfed1('0x62')]()['value']();return _0x544605[_0xfed1('0x15')][_0xfed1('0x5e')](function(_0x45348d){return _0x1f4e2b[_0xfed1('0x63')](_0x45348d[_0xfed1('0x61')])>-0x1;});}else{return _0x544605['rows'][_0xfed1('0x5e')](function(_0xe74336){return _0xe74336[_0xfed1('0x61')]===parseInt(_0x4104fe[_0xfed1('0x1e')]['id']);});}})[_0xfed1('0x1c')](respondWithResult(_0x49213b,null))[_0xfed1('0xe')](handleError(_0x49213b,null));};exports[_0xfed1('0x64')]=function(_0x4238bd,_0x390eb0){return respondWithRpcPromise(_0xfed1('0x65'),_0x4238bd['query'],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x390eb0,null))[_0xfed1('0xe')](handleError(_0x390eb0,null));};exports[_0xfed1('0x66')]=function(_0x383d34,_0x194f42){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x383d34[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0x194f42,null))[_0xfed1('0xe')](handleError(_0x194f42,null));};exports[_0xfed1('0x67')]=function(_0x221ed8,_0xb76860){return respondWithRpcPromise(_0xfed1('0x68'),_0x221ed8[_0xfed1('0x18')],routingClient)[_0xfed1('0x1c')](respondWithResult(_0xb76860,null))['catch'](handleError(_0xb76860,null));};exports['queueNotify']=function(_0xc3b72a){return function(_0x547d9c,_0x25cebc){var _0x3ab92e,_0x483b16;var _0x4b355d=_['capitalize'](_0xc3b72a);var _0x304cc0=_0xc3b72a==='chat'?_0xfed1('0x69'):'Account';return db[_0x4b355d+_0xfed1('0x6a')][_0xfed1('0x6b')]({'raw':!![],'where':{'id':_0x547d9c[_0xfed1('0x1e')]['id']}})[_0xfed1('0x1c')](function(_0x3c6ddd){if(_['isNil'](_0x3c6ddd)){throw new Error(_0x4b355d+_0xfed1('0x6c'));}_0x3ab92e=_0x3c6ddd;return db[_0x4b355d+_0xfed1('0x6d')]['findOne']({'where':{'id':_0x547d9c[_0xfed1('0x24')][_0xfed1('0x6e')]},'include':[{'model':db[_0x4b355d+'Interaction'],'as':_0xfed1('0x6f')},{'model':db[_0x4b355d+_0x304cc0],'as':_0xfed1('0x70')}]});})[_0xfed1('0x1c')](function(_0x5cf634){if(_[_0xfed1('0x14')](_0x5cf634)){throw new Error(_0x4b355d+_0xfed1('0x71'));}_0x483b16=_0x5cf634;return _0x5cf634['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xfed1('0x1c')](function(){var _0xc81c8f={'uniqueid':_0xc3b72a+'.'+_0x483b16['id']+'.'+_0x483b16[_0xfed1('0x6f')]['id'],'FromUserId':_0x547d9c['user']['id'],'type':_0xfed1('0x72')};_0xc81c8f[_0x4b355d+_0xfed1('0x73')]=_0x483b16['id'];_0xc81c8f[_0x4b355d+'InteractionId']=_0x483b16['Interaction']['id'];_0xc81c8f[_0xfed1('0x74')+_0x4b355d+_0x304cc0+'Id']=_0x483b16[_0xfed1('0x70')]['id'];_0xc81c8f['To'+_0x4b355d+_0xfed1('0x75')]=_0x3ab92e['id'];return db[_0x4b355d+_0xfed1('0x76')][_0xfed1('0x77')](_0xc81c8f);})[_0xfed1('0x1c')](function(){return respondWithRpcPromise(_0xfed1('0x78'),{'channel':_0xc3b72a,'interaction':_0x483b16[_0xfed1('0x6f')],'message':_0x483b16,'account':_0x483b16[_0xfed1('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfed1('0x72'),'appdata':_0x3ab92e[_0xfed1('0x12')]+','+(_0x483b16[_0xfed1('0x70')]['queueTransferTimeout']||0x12c),'interval':_0xfed1('0x79')}]},routingClient);})[_0xfed1('0x1c')](respondWithResult(_0x25cebc,null))['catch'](handleError(_0x25cebc,null));};};exports[_0xfed1('0x7a')]=function(_0x1f721d,_0x5f5d42){var _0x3d4aee,_0x408ee0;if(_[_0xfed1('0x14')](_0x1f721d[_0xfed1('0x24')]['channel'])){throw new Error(_0xfed1('0x7b'));}var _0x24ab18=_0x1f721d[_0xfed1('0x24')][_0xfed1('0x7c')];var _0x1ecef6=_[_0xfed1('0x7d')](_0x24ab18);var _0x2d0cbb=_0x24ab18===_0xfed1('0x7e')?'Website':_0xfed1('0x70');return db[_0xfed1('0x7f')][_0xfed1('0x6b')]({'raw':!![],'where':{'id':_0x1f721d['params']['id'],'role':_0xfed1('0x3d')}})[_0xfed1('0x1c')](function(_0x45a677){if(_['isNil'](_0x45a677)){throw new Error('Agent\x20not\x20found');}_0x3d4aee=_0x45a677;return db[_0x1ecef6+_0xfed1('0x6d')][_0xfed1('0x6b')]({'where':{'id':_0x1f721d[_0xfed1('0x24')][_0xfed1('0x6e')]},'include':[{'model':db[_0x1ecef6+_0xfed1('0x6f')],'as':_0xfed1('0x6f')},{'model':db[_0x1ecef6+_0x2d0cbb],'as':_0xfed1('0x70')}]});})[_0xfed1('0x1c')](function(_0x130eb2){if(_[_0xfed1('0x14')](_0x130eb2)){throw new Error(_0x1ecef6+_0xfed1('0x71'));}_0x408ee0=_0x130eb2;return _0x130eb2[_0xfed1('0x80')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfed1('0x1c')](function(){var _0x18b086={'uniqueid':_0x24ab18+'.'+_0x408ee0['id']+'.'+_0x408ee0[_0xfed1('0x6f')]['id'],'FromUserId':_0x1f721d[_0xfed1('0x33')]['id'],'type':_0xfed1('0x72'),'ToUserId':_0x3d4aee['id']};_0x18b086[_0x1ecef6+_0xfed1('0x73')]=_0x408ee0['id'];_0x18b086[_0x1ecef6+_0xfed1('0x81')]=_0x408ee0[_0xfed1('0x6f')]['id'];_0x18b086['From'+_0x1ecef6+_0x2d0cbb+'Id']=_0x408ee0[_0xfed1('0x70')]['id'];return db[_0x1ecef6+_0xfed1('0x76')][_0xfed1('0x77')](_0x18b086);})['then'](function(){return respondWithRpcPromise(_0xfed1('0x78'),{'channel':_0x24ab18,'interaction':_0x408ee0[_0xfed1('0x6f')],'message':_0x408ee0,'account':_0x408ee0[_0xfed1('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfed1('0x3d'),'appdata':_0x3d4aee[_0xfed1('0x12')]+','+(_0x408ee0[_0xfed1('0x70')][_0xfed1('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x5f5d42,null))[_0xfed1('0xe')](handleError(_0x5f5d42,null));}; \ No newline at end of file +var _0x24ca=['telephones','Telephones','trunks','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','queue','MessageId','InteractionId','From','QueueId','Start','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','TransferReport','create','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','error','code','message','result','json','sendStatus','stack','status','send','isNil','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','catch','VoiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity'];(function(_0x1883b4,_0x575cee){var _0x364ff6=function(_0x4c8f7d){while(--_0x4c8f7d){_0x1883b4['push'](_0x1883b4['shift']());}};_0x364ff6(++_0x575cee);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x24ca[_0x2dea24];return _0x309d58;};'use strict';var BPromise=require(_0xa24c('0x0'));var moment=require('moment');var _=require(_0xa24c('0x1'));var util=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var logger=require('../../config/logger')(_0xa24c('0x4'));var jayson=require(_0xa24c('0x5'));var amiClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232a});var mailClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232b});var routingClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){var _0x3a5727=_0x9a5013?_0x9a5013:amiClient;return _0x3a5727[_0xa24c('0x8')](_0x2dd348,_0x257264)['then'](function(_0x399f32){if(_0x399f32[_0xa24c('0x9')]){if(_0x399f32[_0xa24c('0x9')][_0xa24c('0xa')]===0x1f4){return _0x42d89c(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}return _0x481196(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}else{_0x481196(_0x399f32[_0xa24c('0xc')]);}})['catch'](function(_0x43bcd3){_0x42d89c(_0x43bcd3);});});}function respondWithResult(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xc8;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['status'](_0xcee4fe)[_0xa24c('0xd')](_0x2c2af8);}return _0x11090c[_0xa24c('0xe')](0x194);};}function handleError(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0x1f4;return function(_0x1cb08e){logger[_0xa24c('0x9')](_0x1cb08e[_0xa24c('0xf')]);if(_0x1cb08e['name']){delete _0x1cb08e['name'];}_0x26ff28[_0xa24c('0x10')](_0x2fcd8b)[_0xa24c('0x11')](_0x1cb08e);};}function findById(_0x49ce53){return function(_0x5babb5){if(!_[_0xa24c('0x12')](_0x49ce53)&&!_[_0xa24c('0x12')](_0x5babb5)&&!_['isNil'](_0x5babb5[_0xa24c('0x13')])){return _['find'](_0x5babb5[_0xa24c('0x13')],function(_0x2a610a){return _0x2a610a['id']==_0x49ce53;});}return null;};}exports[_0xa24c('0x14')]=function(_0xefdbd9,_0x4ff97c){return respondWithRpcPromise(_0xa24c('0x15'),_0xefdbd9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x4ff97c,null))['catch'](handleError(_0x4ff97c,null));};exports['voiceChannelMixMonitor']=function(_0x506424,_0x4cd77e){return respondWithRpcPromise(_0xa24c('0x18'),_[_0xa24c('0x19')](_0x506424[_0xa24c('0x16')],_0x506424[_0xa24c('0x1a')]))['then'](respondWithResult(_0x4cd77e,null))[_0xa24c('0x1b')](handleError(_0x4cd77e,null));};exports['voiceChannelStopMixMonitor']=function(_0x224bca,_0xb81d97){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa24c('0x19')](_0x224bca[_0xa24c('0x16')],_0x224bca[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0xb81d97,null))[_0xa24c('0x1b')](handleError(_0xb81d97,null));};exports['voiceQueues']=function(_0xec9167,_0x5cc9cb){return respondWithRpcPromise(_0xa24c('0x1c'),_0xec9167[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x5cc9cb,null))['catch'](handleError(_0x5cc9cb,null));};exports[_0xa24c('0x1d')]=function(_0x31c4d9,_0x14fd5a){return respondWithRpcPromise(_0xa24c('0x1c'),_0x31c4d9[_0xa24c('0x16')])[_0xa24c('0x17')](findById(_0x31c4d9[_0xa24c('0x1a')]['id']))['then'](respondWithResult(_0x14fd5a,null))[_0xa24c('0x1b')](handleError(_0x14fd5a,null));};exports[_0xa24c('0x1e')]=function(_0x152120,_0x12dbdc){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xa24c('0x19')](_0x152120[_0xa24c('0x1f')],_0x152120[_0xa24c('0x1a')]))['then'](respondWithResult(_0x12dbdc,null))[_0xa24c('0x1b')](handleError(_0x12dbdc,null));};exports[_0xa24c('0x20')]=function(_0x253d83,_0x4ae35c){return respondWithRpcPromise(_0xa24c('0x21'),_['merge'](_0x253d83[_0xa24c('0x16')],_0x253d83[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x4ae35c,null))['catch'](handleError(_0x4ae35c,null));};exports[_0xa24c('0x22')]=function(_0x53f90,_0x1d0379){return respondWithRpcPromise('VoiceQueuesChannels',_0x53f90[_0xa24c('0x16')])['then'](respondWithResult(_0x1d0379,null))[_0xa24c('0x1b')](handleError(_0x1d0379,null));};exports[_0xa24c('0x23')]=function(_0x592198,_0x5680f5){return respondWithRpcPromise(_0xa24c('0x24'),_[_0xa24c('0x19')](_0x592198[_0xa24c('0x16')],_0x592198[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x5680f5,null))[_0xa24c('0x1b')](handleError(_0x5680f5,null));};exports[_0xa24c('0x25')]=function(_0x4b4dc2,_0x39f146){return respondWithRpcPromise(_0xa24c('0x26'),_[_0xa24c('0x19')](_0x4b4dc2[_0xa24c('0x16')],_0x4b4dc2[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x39f146,null))[_0xa24c('0x1b')](handleError(_0x39f146,null));};exports[_0xa24c('0x27')]=function(_0x1ea166,_0x129bb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa24c('0x19')](_0x1ea166[_0xa24c('0x16')],_0x1ea166[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x129bb9,null))['catch'](handleError(_0x129bb9,null));};exports['outbound']=function(_0x19a65f,_0x56ef4d){return respondWithRpcPromise(_0xa24c('0x28'),_0x19a65f[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x56ef4d,null))[_0xa24c('0x1b')](handleError(_0x56ef4d,null));};exports[_0xa24c('0x29')]=function(_0x4c0fb9,_0x532875){return respondWithRpcPromise(_0xa24c('0x2a'),_0x4c0fb9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x532875,null))[_0xa24c('0x1b')](handleError(_0x532875,null));};exports[_0xa24c('0x2b')]=function(_0x472912,_0x5080d0){var _0x56f392;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912[_0xa24c('0x16')])[_0xa24c('0x17')](function(_0x2101f8){_0x56f392=_0x2101f8;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912['query'],routingClient);})[_0xa24c('0x17')](function(_0x7895e){return _['merge']({},_0x7895e,_0x56f392);})['then'](respondWithResult(_0x5080d0,null))[_0xa24c('0x1b')](handleError(_0x5080d0,null));};exports[_0xa24c('0x2d')]=function(_0x231eea,_0x537849){if(_0x231eea['body']&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]&&_0x231eea[_0xa24c('0x2f')]&&_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')]){for(var _0x1b7faf in _0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]){if(_0x231eea['body']['interaction'][_0xa24c('0x31')](_0x1b7faf)){db[_0xa24c('0x32')][_0xa24c('0x33')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea['user'][_0xa24c('0x30')],'type':_0xa24c('0x34'),'exitAt':null,'uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')]?{'$notIn':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]}:{'$ne':null}}})[_0xa24c('0x17')](function(_0x4bbf93){var _0xb8c7a5=moment()[_0xa24c('0x36')](_0xa24c('0x37'));for(var _0x5aa2b2=0x0,_0x3a85cb=_0x4bbf93[_0xa24c('0x35')];_0x5aa2b2<_0x3a85cb;_0x5aa2b2+=0x1){_0x4bbf93[_0x5aa2b2][_0xa24c('0x38')]({'exitAt':_0xb8c7a5});}});for(var _0x31f05b=0x0;_0x31f05b<_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')];_0x31f05b+=0x1){db[_0xa24c('0x32')][_0xa24c('0x39')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'type':'INTERACTION','uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0x31f05b],'exitAt':null},'defaults':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'interface':_[_0xa24c('0x12')](_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3a')])?util[_0xa24c('0x36')](_0xa24c('0x3b'),_0x231eea['user']['name']):_0x231eea[_0xa24c('0x2f')]['interface'],'type':_0xa24c('0x34'),'enterAt':moment()[_0xa24c('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa24c('0x3c'),'internal':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3d')],'uniqueid':_0x231eea['body']['interaction'][_0x1b7faf][_0x31f05b]}});}}}}return respondWithRpcPromise(_0xa24c('0x3e'),{'id':_0x231eea['params']['id'],'capacity':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x3f')]},routingClient)[_0xa24c('0x17')](respondWithResult(_0x537849,null))[_0xa24c('0x1b')](handleError(_0x537849,null));};exports[_0xa24c('0x40')]=function(_0x1fa739,_0x3f3ce6){return respondWithRpcPromise(_0xa24c('0x41'),_0x1fa739[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x3f3ce6,null))['catch'](handleError(_0x3f3ce6,null));};exports[_0xa24c('0x42')]=function(_0x2759c1,_0x233f8e){return respondWithRpcPromise('Trunks',_0x2759c1['query'])['then'](respondWithResult(_0x233f8e,null))[_0xa24c('0x1b')](handleError(_0x233f8e,null));};exports['campaigns']=function(_0x4757ff,_0x21d0fc){return respondWithRpcPromise('Campaigns',_0x4757ff[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x21d0fc,null))[_0xa24c('0x1b')](handleError(_0x21d0fc,null));};exports[_0xa24c('0x43')]=function(_0x162a11,_0x3a72e3){return respondWithRpcPromise(_0xa24c('0x44'),_0x162a11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x3a72e3,null))[_0xa24c('0x1b')](handleError(_0x3a72e3,null));};exports['showChatQueues']=function(_0x5abd45,_0x565f0a){return respondWithRpcPromise('ChatQueues',_0x5abd45['query'],routingClient)[_0xa24c('0x17')](findById(_0x5abd45['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x565f0a,null))[_0xa24c('0x1b')](handleError(_0x565f0a,null));};exports[_0xa24c('0x45')]=function(_0x1a5f17,_0xa371d2){return respondWithRpcPromise(_0xa24c('0x46'),_0x1a5f17[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0xa371d2,null))[_0xa24c('0x1b')](handleError(_0xa371d2,null));};exports[_0xa24c('0x47')]=function(_0x303b7d,_0x37dbbd){return respondWithRpcPromise(_0xa24c('0x46'),_0x303b7d[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0x303b7d['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x37dbbd,null))[_0xa24c('0x1b')](handleError(_0x37dbbd,null));};exports['mailAccounts']=function(_0x1e08bb,_0x179ae1){return respondWithRpcPromise(_0xa24c('0x48'),_0x1e08bb[_0xa24c('0x16')],mailClient)['then'](respondWithResult(_0x179ae1,null))['catch'](handleError(_0x179ae1,null));};exports[_0xa24c('0x49')]=function(_0x5e9631,_0x486040){return respondWithRpcPromise(_0xa24c('0x4a'),_0x5e9631[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x486040,null))[_0xa24c('0x1b')](handleError(_0x486040,null));};exports['showOpenchannelQueues']=function(_0x48a7b2,_0x29b836){return respondWithRpcPromise('OpenchannelQueues',_0x48a7b2['query'],routingClient)[_0xa24c('0x17')](findById(_0x48a7b2[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x29b836,null))['catch'](handleError(_0x29b836,null));};exports[_0xa24c('0x4b')]=function(_0x128e5b,_0x5c3285){return respondWithRpcPromise(_0xa24c('0x4c'),_0x128e5b[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x5c3285,null))['catch'](handleError(_0x5c3285,null));};exports[_0xa24c('0x4d')]=function(_0x34e261,_0x21439a){return respondWithRpcPromise(_0xa24c('0x4c'),_0x34e261[_0xa24c('0x16')],routingClient)['then'](findById(_0x34e261[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x21439a,null))[_0xa24c('0x1b')](handleError(_0x21439a,null));};exports[_0xa24c('0x4e')]=function(_0xab5260,_0x2ca3fa){return respondWithRpcPromise(_0xa24c('0x4f'),_0xab5260['query'],routingClient)[_0xa24c('0x17')](respondWithResult(_0x2ca3fa,null))[_0xa24c('0x1b')](handleError(_0x2ca3fa,null));};exports['showWhatsappQueues']=function(_0xb1048a,_0x3e455b){return respondWithRpcPromise(_0xa24c('0x4f'),_0xb1048a[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xb1048a[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x3e455b,null))[_0xa24c('0x1b')](handleError(_0x3e455b,null));};exports[_0xa24c('0x50')]=function(_0x32ddc3,_0x50141e){return respondWithRpcPromise(_0xa24c('0x51'),_0x32ddc3[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x50141e,null))['catch'](handleError(_0x50141e,null));};exports[_0xa24c('0x52')]=function(_0xfd57fb,_0x2cc592){return respondWithRpcPromise('FaxQueues',_0xfd57fb[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xfd57fb[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x2cc592,null))[_0xa24c('0x1b')](handleError(_0x2cc592,null));};exports[_0xa24c('0x53')]=function(_0x4f9b56,_0x4c374d){return respondWithRpcPromise(_0xa24c('0x54'),_0x4f9b56['query'])[_0xa24c('0x17')](respondWithResult(_0x4c374d,null))[_0xa24c('0x1b')](handleError(_0x4c374d,null));};exports[_0xa24c('0x55')]=function(_0x4073c5,_0x12d715){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4073c5[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x12d715,null))[_0xa24c('0x1b')](handleError(_0x12d715,null));};exports[_0xa24c('0x56')]=function(_0x987aca,_0x389c08){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x987aca[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x389c08,null))[_0xa24c('0x1b')](handleError(_0x389c08,null));};exports[_0xa24c('0x57')]=function(_0x5ebdd1,_0x403bf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5ebdd1[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x403bf1,null))[_0xa24c('0x1b')](handleError(_0x403bf1,null));};exports[_0xa24c('0x58')]=function(_0x5726e1,_0x2e612d){return respondWithRpcPromise(_0xa24c('0x59'),_0x5726e1['query'],routingClient)[_0xa24c('0x17')](function(_0x168a8b){if(_0x5726e1[_0xa24c('0x16')][_0xa24c('0x5a')]!==undefined){var _0x8bd3fb=_(_0x168a8b[_0xa24c('0x13')])[_0xa24c('0x5b')]([_0x5726e1[_0xa24c('0x16')]['type'],_0x5726e1[_0xa24c('0x1a')]['id']])[_0xa24c('0x5c')](_0xa24c('0x5d'))[_0xa24c('0x5e')]()[_0xa24c('0x5f')]();return _0x168a8b[_0xa24c('0x13')][_0xa24c('0x5b')](function(_0x13dbef){return _0x8bd3fb[_0xa24c('0x60')](_0x13dbef[_0xa24c('0x5d')])>-0x1;});}else{return _0x168a8b[_0xa24c('0x13')]['filter'](function(_0x283c5b){return _0x283c5b[_0xa24c('0x5d')]===parseInt(_0x5726e1['params']['id']);});}})[_0xa24c('0x17')](respondWithResult(_0x2e612d,null))[_0xa24c('0x1b')](handleError(_0x2e612d,null));};exports[_0xa24c('0x61')]=function(_0x4f0f11,_0x5b4468){return respondWithRpcPromise(_0xa24c('0x62'),_0x4f0f11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x5b4468,null))[_0xa24c('0x1b')](handleError(_0x5b4468,null));};exports[_0xa24c('0x63')]=function(_0x106178,_0x27a666){return respondWithRpcPromise(_0xa24c('0x64'),_0x106178[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x27a666,null))['catch'](handleError(_0x27a666,null));};exports['faxQueuesWaitingInteractions']=function(_0x263dab,_0x521894){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x263dab[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x521894,null))[_0xa24c('0x1b')](handleError(_0x521894,null));};exports[_0xa24c('0x65')]=function(_0x84ddcc){return function(_0x45b2fe,_0x16f93a){var _0x170b65,_0x2544fc;var _0x4ee10d=_[_0xa24c('0x66')](_0x84ddcc);var _0xa077c8=_0x84ddcc===_0xa24c('0x67')?_0xa24c('0x68'):_0xa24c('0x69');return db[_0x4ee10d+_0xa24c('0x6a')][_0xa24c('0x6b')]({'raw':!![],'where':{'id':_0x45b2fe[_0xa24c('0x1a')]['id']}})[_0xa24c('0x17')](function(_0x3c5495){if(_[_0xa24c('0x12')](_0x3c5495)){throw new Error(_0x4ee10d+_0xa24c('0x6c'));}_0x170b65=_0x3c5495;return db[_0x4ee10d+'Message'][_0xa24c('0x6b')]({'where':{'id':_0x45b2fe[_0xa24c('0x1f')]['messageId']},'include':[{'model':db[_0x4ee10d+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x4ee10d+_0xa077c8],'as':_0xa24c('0x69')}]});})['then'](function(_0x549e07){if(_[_0xa24c('0x12')](_0x549e07)){throw new Error(_0x4ee10d+'\x20Message\x20not\x20found');}_0x2544fc=_0x549e07;return _0x549e07[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4c108f={'uniqueid':_0x84ddcc+'.'+_0x2544fc['id']+'.'+_0x2544fc['Interaction']['id'],'FromUserId':_0x45b2fe[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f')};_0x4c108f[_0x4ee10d+_0xa24c('0x70')]=_0x2544fc['id'];_0x4c108f[_0x4ee10d+_0xa24c('0x71')]=_0x2544fc['Interaction']['id'];_0x4c108f[_0xa24c('0x72')+_0x4ee10d+_0xa077c8+'Id']=_0x2544fc[_0xa24c('0x69')]['id'];_0x4c108f['To'+_0x4ee10d+_0xa24c('0x73')]=_0x170b65['id'];return db[_0x4ee10d+'TransferReport']['create'](_0x4c108f);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x84ddcc,'interaction':_0x2544fc[_0xa24c('0x6d')],'message':_0x2544fc,'account':_0x2544fc['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x170b65[_0xa24c('0x30')]+','+(_0x2544fc['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x16f93a,null))[_0xa24c('0x1b')](handleError(_0x16f93a,null));};};exports[_0xa24c('0x75')]=function(_0xd23eb3,_0x890e15){var _0x12836d,_0x280fa2;if(_[_0xa24c('0x12')](_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x76')])){throw new Error(_0xa24c('0x77'));}var _0x24b28c=_0xd23eb3['body'][_0xa24c('0x76')];var _0x292c22=_['capitalize'](_0x24b28c);var _0x2fd4a2=_0x24b28c==='chat'?'Website':'Account';return db[_0xa24c('0x78')]['findOne']({'raw':!![],'where':{'id':_0xd23eb3[_0xa24c('0x1a')]['id'],'role':'agent'}})[_0xa24c('0x17')](function(_0x144c3b){if(_['isNil'](_0x144c3b)){throw new Error(_0xa24c('0x79'));}_0x12836d=_0x144c3b;return db[_0x292c22+'Message'][_0xa24c('0x6b')]({'where':{'id':_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x7a')]},'include':[{'model':db[_0x292c22+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x292c22+_0x2fd4a2],'as':'Account'}]});})[_0xa24c('0x17')](function(_0x5774d2){if(_[_0xa24c('0x12')](_0x5774d2)){throw new Error(_0x292c22+_0xa24c('0x7b'));}_0x280fa2=_0x5774d2;return _0x5774d2[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4b848d={'uniqueid':_0x24b28c+'.'+_0x280fa2['id']+'.'+_0x280fa2[_0xa24c('0x6d')]['id'],'FromUserId':_0xd23eb3[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f'),'ToUserId':_0x12836d['id']};_0x4b848d[_0x292c22+_0xa24c('0x70')]=_0x280fa2['id'];_0x4b848d[_0x292c22+'InteractionId']=_0x280fa2[_0xa24c('0x6d')]['id'];_0x4b848d[_0xa24c('0x72')+_0x292c22+_0x2fd4a2+'Id']=_0x280fa2[_0xa24c('0x69')]['id'];return db[_0x292c22+_0xa24c('0x7c')][_0xa24c('0x7d')](_0x4b848d);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x24b28c,'interaction':_0x280fa2[_0xa24c('0x6d')],'message':_0x280fa2,'account':_0x280fa2[_0xa24c('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa24c('0x3c'),'appdata':_0x12836d[_0xa24c('0x30')]+','+(_0x280fa2[_0xa24c('0x69')][_0xa24c('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x890e15,null))[_0xa24c('0x1b')](handleError(_0x890e15,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 4e494ff..10da4cd 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 _0x2414=['./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','post','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f26ce,_0x40c07a){var _0xe34723=function(_0x1a87d6){while(--_0x1a87d6){_0x4f26ce['push'](_0x4f26ce['shift']());}};_0xe34723(++_0x40c07a);}(_0x2414,0x8b));var _0x4241=function(_0x26e7c2,_0x569eab){_0x26e7c2=_0x26e7c2-0x0;var _0x2da461=_0x2414[_0x26e7c2];return _0x2da461;};'use strict';var multer=require(_0x4241('0x0'));var util=require(_0x4241('0x1'));var path=require(_0x4241('0x2'));var timeout=require('connect-timeout');var express=require(_0x4241('0x3'));var router=express['Router']();var fs_extra=require(_0x4241('0x4'));var auth=require(_0x4241('0x5'));var interaction=require(_0x4241('0x6'));var config=require(_0x4241('0x7'));var controller=require(_0x4241('0x8'));router[_0x4241('0x9')]('/',auth[_0x4241('0xa')](),controller[_0x4241('0xb')]);router[_0x4241('0x9')](_0x4241('0xc'),auth['isAuthenticated'](),controller[_0x4241('0xd')]);router[_0x4241('0x9')](_0x4241('0xe'),auth['isAuthenticated'](),controller['run']);router[_0x4241('0xf')]('/',auth[_0x4241('0xa')](),controller['create']);router[_0x4241('0x10')](_0x4241('0xc'),auth[_0x4241('0xa')](),controller[_0x4241('0x11')]);router[_0x4241('0x12')]('/:id',auth[_0x4241('0xa')](),controller[_0x4241('0x13')]);module[_0x4241('0x14')]=router; \ No newline at end of file +var _0x21ff=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','show','/:id/run','post','create','put','/:id','update','delete'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x21ff,0x70));var _0xf21f=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0x21ff[_0x8abd64];return _0xd2511e;};'use strict';var multer=require(_0xf21f('0x0'));var util=require(_0xf21f('0x1'));var path=require(_0xf21f('0x2'));var timeout=require('connect-timeout');var express=require(_0xf21f('0x3'));var router=express[_0xf21f('0x4')]();var fs_extra=require(_0xf21f('0x5'));var auth=require(_0xf21f('0x6'));var interaction=require(_0xf21f('0x7'));var config=require(_0xf21f('0x8'));var controller=require(_0xf21f('0x9'));router[_0xf21f('0xa')]('/',auth[_0xf21f('0xb')](),controller['index']);router['get']('/:id',auth[_0xf21f('0xb')](),controller[_0xf21f('0xc')]);router[_0xf21f('0xa')](_0xf21f('0xd'),auth[_0xf21f('0xb')](),controller['run']);router[_0xf21f('0xe')]('/',auth[_0xf21f('0xb')](),controller[_0xf21f('0xf')]);router[_0xf21f('0x10')](_0xf21f('0x11'),auth[_0xf21f('0xb')](),controller[_0xf21f('0x12')]);router[_0xf21f('0x13')](_0xf21f('0x11'),auth['isAuthenticated'](),controller[_0xf21f('0x14')]);module[_0xf21f('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 29f9369..1d38f54 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 _0x8705=['custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','months','weeks','days','hours','minutes','ENUM','csv','pdf','xlsx'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8705,0x132));var _0x5870=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8705[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x5870('0x0'));module[_0x5870('0x1')]={'name':{'type':Sequelize[_0x5870('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5870('0x2')]},'active':{'type':Sequelize[_0x5870('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5870('0x2')],'allowNull':![],'defaultValue':_0x5870('0x4')},'startAt':{'type':Sequelize[_0x5870('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5870('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x5870('0x7'),'quarters',_0x5870('0x8'),_0x5870('0x9'),_0x5870('0xa'),_0x5870('0xb'),_0x5870('0xc')),'allowNull':![],'defaultValue':_0x5870('0xa')},'output':{'type':Sequelize[_0x5870('0xd')](_0x5870('0xe'),_0x5870('0xf'),_0x5870('0x10')),'allowNull':![],'defaultValue':_0x5870('0xe')},'type':{'type':Sequelize[_0x5870('0xd')](_0x5870('0x11'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5870('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x5870('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x5870('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd64f=['INTEGER','years','quarters','weeks','hours','minutes','days','ENUM','csv','xlsx','default','custom','TEXT','STRING','BOOLEAN','DATE'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xd64f,0x1cd));var _0xfd64=function(_0x2ccba8,_0x1372be){_0x2ccba8=_0x2ccba8-0x0;var _0x20a5d9=_0xd64f[_0x2ccba8];return _0x20a5d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfd64('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfd64('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xfd64('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfd64('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfd64('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xfd64('0x4'),_0xfd64('0x5'),'months',_0xfd64('0x6'),'days',_0xfd64('0x7'),_0xfd64('0x8')),'allowNull':![],'defaultValue':_0xfd64('0x9')},'output':{'type':Sequelize[_0xfd64('0xa')](_0xfd64('0xb'),'pdf',_0xfd64('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom',_0xfd64('0xd')),'allowNull':![],'defaultValue':_0xfd64('0xe')},'sendMail':{'type':Sequelize[_0xfd64('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xfd64('0xf')]},'bcc':{'type':Sequelize[_0xfd64('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xfd64('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index ef11e4a..40aa46e 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 _0x618c=['params','keys','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','pick','where','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x589ece,_0x1e84ed){var _0x13cd92=function(_0x1d0a1e){while(--_0x1d0a1e){_0x589ece['push'](_0x589ece['shift']());}};_0x13cd92(++_0x1e84ed);}(_0x618c,0x1f2));var _0xc618=function(_0x406da3,_0x323295){_0x406da3=_0x406da3-0x0;var _0x16bd38=_0x618c[_0x406da3];return _0x16bd38;};'use strict';var emlformat=require(_0xc618('0x0'));var rimraf=require(_0xc618('0x1'));var zipdir=require(_0xc618('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc618('0x3'));var moment=require(_0xc618('0x4'));var BPromise=require(_0xc618('0x5'));var Mustache=require(_0xc618('0x6'));var util=require('util');var path=require(_0xc618('0x7'));var sox=require(_0xc618('0x8'));var csv=require(_0xc618('0x9'));var ejs=require(_0xc618('0xa'));var fs=require('fs');var fs_extra=require(_0xc618('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc618('0xc'));var jsforce=require(_0xc618('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc618('0x9'));var querystring=require(_0xc618('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc618('0xf'));var as=require(_0xc618('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc618('0x11'));var utils=require(_0xc618('0x12'));var config=require(_0xc618('0x13'));var licenseUtil=require(_0xc618('0x14'));var db=require(_0xc618('0x15'))['db'];function respondWithStatusCode(_0x37d594,_0x50dfe5){_0x50dfe5=_0x50dfe5||0xcc;return function(_0xf7323b){if(_0xf7323b){return _0x37d594['sendStatus'](_0x50dfe5);}return _0x37d594[_0xc618('0x16')](_0x50dfe5)[_0xc618('0x17')]();};}function respondWithResult(_0x458845,_0x1b0247){_0x1b0247=_0x1b0247||0xc8;return function(_0x4f1abe){if(_0x4f1abe){return _0x458845[_0xc618('0x16')](_0x1b0247)[_0xc618('0x18')](_0x4f1abe);}};}function respondWithFilteredResult(_0x38a9c6,_0x49548e){return function(_0x50516a){if(_0x50516a){var _0x292810=typeof _0x49548e[_0xc618('0x19')]==='undefined'&&typeof _0x49548e['limit']===_0xc618('0x1a');var _0x3feb04=_0x50516a[_0xc618('0x1b')];var _0xee154a=_0x292810?0x0:_0x49548e['offset'];var _0x51af15=_0x292810?_0x50516a[_0xc618('0x1b')]:_0x49548e[_0xc618('0x19')]+_0x49548e[_0xc618('0x1c')];var _0x5d01e8;if(_0x51af15>=_0x3feb04){_0x51af15=_0x3feb04;_0x5d01e8=0xc8;}else{_0x5d01e8=0xce;}_0x38a9c6[_0xc618('0x16')](_0x5d01e8);return _0x38a9c6[_0xc618('0x1d')](_0xc618('0x1e'),_0xee154a+'-'+_0x51af15+'/'+_0x3feb04)[_0xc618('0x18')](_0x50516a);}return null;};}function patchUpdates(_0xedfd09){return function(_0x472eb9){try{jsonpatch['apply'](_0x472eb9,_0xedfd09,!![]);}catch(_0x3e23a0){return BPromise[_0xc618('0x1f')](_0x3e23a0);}return _0x472eb9[_0xc618('0x20')]();};}function saveUpdates(_0x37c08a,_0x481449){return function(_0x3d3237){if(_0x3d3237){return _0x3d3237[_0xc618('0x21')](_0x37c08a)['then'](function(_0x563ddd){return _0x563ddd;});}return null;};}function removeEntity(_0x57a31a,_0x596cb5){return function(_0x3cc989){if(_0x3cc989){return _0x3cc989[_0xc618('0x22')]()[_0xc618('0x23')](function(){var _0x5bf550=_0x3cc989[_0xc618('0x24')]({'plain':!![]});var _0x3afe47=_0xc618('0x25');return db[_0xc618('0x26')]['destroy']({'where':{'type':_0x3afe47,'resourceId':_0x5bf550['id']}})['then'](function(){return _0x3cc989;});})[_0xc618('0x23')](function(){_0x57a31a[_0xc618('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd5fb5,_0x256823){return function(_0x3ebcf7){if(!_0x3ebcf7){_0xdd5fb5['sendStatus'](0x194);}return _0x3ebcf7;};}function handleError(_0x356b88,_0x2ce392){_0x2ce392=_0x2ce392||0x1f4;return function(_0x5eadca){logger['error'](_0x5eadca[_0xc618('0x27')]);if(_0x5eadca[_0xc618('0x28')]){delete _0x5eadca['name'];}_0x356b88[_0xc618('0x16')](_0x2ce392)[_0xc618('0x29')](_0x5eadca);};}exports[_0xc618('0x2a')]=function(_0x4fc2b7,_0x1077c1){var _0x3b6aba={},_0x48b8dd={},_0x5e36b4={'count':0x0,'rows':[]};var _0x2fa4ec=_['map'](db[_0xc618('0x2b')][_0xc618('0x2c')],function(_0x127e07){return{'name':_0x127e07[_0xc618('0x2d')],'type':_0x127e07[_0xc618('0x2e')][_0xc618('0x2f')]};});_0x48b8dd[_0xc618('0x30')]=_[_0xc618('0x31')](_0x2fa4ec,_0xc618('0x28'));_0x48b8dd[_0xc618('0x32')]=_['keys'](_0x4fc2b7[_0xc618('0x32')]);_0x48b8dd[_0xc618('0x33')]=_[_0xc618('0x34')](_0x48b8dd[_0xc618('0x30')],_0x48b8dd['query']);_0x3b6aba[_0xc618('0x35')]=_[_0xc618('0x34')](_0x48b8dd['model'],qs[_0xc618('0x36')](_0x4fc2b7['query'][_0xc618('0x36')]));_0x3b6aba[_0xc618('0x35')]=_0x3b6aba[_0xc618('0x35')][_0xc618('0x37')]?_0x3b6aba[_0xc618('0x35')]:_0x48b8dd[_0xc618('0x30')];if(!_0x4fc2b7['query']['hasOwnProperty'](_0xc618('0x38'))){_0x3b6aba['limit']=qs['limit'](_0x4fc2b7[_0xc618('0x32')][_0xc618('0x1c')]);_0x3b6aba[_0xc618('0x19')]=qs[_0xc618('0x19')](_0x4fc2b7[_0xc618('0x32')]['offset']);}_0x3b6aba[_0xc618('0x39')]=qs['sort'](_0x4fc2b7[_0xc618('0x32')]['sort']);_0x3b6aba['where']=qs['filters'](_[_0xc618('0x3a')](_0x4fc2b7[_0xc618('0x32')],_0x48b8dd[_0xc618('0x33')]),_0x2fa4ec);if(_0x4fc2b7[_0xc618('0x32')]['filter']){_0x3b6aba[_0xc618('0x3b')]=_['merge'](_0x3b6aba['where'],{'$or':_['map'](_0x2fa4ec,function(_0x2deca3){if(_0x2deca3[_0xc618('0x2e')]!=='VIRTUAL'){var _0x3e2f4d={};_0x3e2f4d[_0x2deca3[_0xc618('0x28')]]={'$like':'%'+_0x4fc2b7[_0xc618('0x32')][_0xc618('0x3c')]+'%'};return _0x3e2f4d;}})});}_0x3b6aba=_[_0xc618('0x3d')]({},_0x3b6aba,_0x4fc2b7[_0xc618('0x3e')]);var _0x1955eb={'where':_0x3b6aba[_0xc618('0x3b')]};return db[_0xc618('0x2b')][_0xc618('0x1b')](_0x1955eb)[_0xc618('0x23')](function(_0x5d54c2){_0x5e36b4[_0xc618('0x1b')]=_0x5d54c2;if(_0x4fc2b7[_0xc618('0x32')][_0xc618('0x3f')]){_0x3b6aba[_0xc618('0x40')]=[{'all':!![]}];}return db[_0xc618('0x2b')][_0xc618('0x41')](_0x3b6aba);})[_0xc618('0x23')](function(_0x1fb305){_0x5e36b4[_0xc618('0x42')]=_0x1fb305;return _0x5e36b4;})[_0xc618('0x23')](respondWithFilteredResult(_0x1077c1,_0x3b6aba))[_0xc618('0x43')](handleError(_0x1077c1,null));};exports[_0xc618('0x44')]=function(_0xdf30f9,_0x57f1cf){var _0x41e5e3={'raw':![],'where':{'id':_0xdf30f9[_0xc618('0x45')]['id']}},_0x19bb44={};_0x19bb44[_0xc618('0x30')]=_['keys'](db[_0xc618('0x2b')]['rawAttributes']);_0x19bb44[_0xc618('0x32')]=_[_0xc618('0x46')](_0xdf30f9['query']);_0x19bb44[_0xc618('0x33')]=_[_0xc618('0x34')](_0x19bb44['model'],_0x19bb44[_0xc618('0x32')]);_0x41e5e3['attributes']=_[_0xc618('0x34')](_0x19bb44[_0xc618('0x30')],qs[_0xc618('0x36')](_0xdf30f9[_0xc618('0x32')][_0xc618('0x36')]));_0x41e5e3[_0xc618('0x35')]=_0x41e5e3[_0xc618('0x35')]['length']?_0x41e5e3[_0xc618('0x35')]:_0x19bb44['model'];if(_0xdf30f9[_0xc618('0x32')][_0xc618('0x3f')]){_0x41e5e3[_0xc618('0x40')]=[{'all':!![]}];}_0x41e5e3=_['merge']({},_0x41e5e3,_0xdf30f9[_0xc618('0x3e')]);return db['Schedule'][_0xc618('0x47')](_0x41e5e3)[_0xc618('0x23')](handleEntityNotFound(_0x57f1cf,null))[_0xc618('0x23')](respondWithResult(_0x57f1cf,null))['catch'](handleError(_0x57f1cf,null));};exports[_0xc618('0x48')]=function(_0xee2400,_0x502d1c){return db[_0xc618('0x2b')][_0xc618('0x48')](_0xee2400[_0xc618('0x49')],{})['then'](function(_0x3e9a82){var _0x4f1a64=_0xee2400[_0xc618('0x4a')][_0xc618('0x24')]({'plain':!![]});if(!_0x4f1a64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f1a64['role']==='user'){var _0x434d0c=_0x3e9a82[_0xc618('0x24')]({'plain':!![]});var _0xb903a8='Scheduler';return db[_0xc618('0x4b')][_0xc618('0x47')]({'where':{'name':_0xb903a8,'userProfileId':_0x4f1a64[_0xc618('0x4c')]},'raw':!![]})[_0xc618('0x23')](function(_0xbac547){if(_0xbac547&&_0xbac547[_0xc618('0x4d')]===0x0){return db[_0xc618('0x26')][_0xc618('0x48')]({'name':_0x434d0c[_0xc618('0x28')],'resourceId':_0x434d0c['id'],'type':_0xbac547['name'],'sectionId':_0xbac547['id']},{})['then'](function(){return _0x3e9a82;});}else{return _0x3e9a82;}})[_0xc618('0x43')](function(_0x316bb3){logger['error'](_0xc618('0x4e'),_0x316bb3);throw _0x316bb3;});}return _0x3e9a82;})['then'](respondWithResult(_0x502d1c,0xc9))[_0xc618('0x43')](handleError(_0x502d1c,null));};exports[_0xc618('0x21')]=function(_0x175629,_0x59a314){if(_0x175629[_0xc618('0x49')]['id']){delete _0x175629['body']['id'];}return db[_0xc618('0x2b')]['find']({'where':{'id':_0x175629[_0xc618('0x45')]['id']}})[_0xc618('0x23')](handleEntityNotFound(_0x59a314,null))['then'](saveUpdates(_0x175629[_0xc618('0x49')],null))[_0xc618('0x23')](respondWithResult(_0x59a314,null))[_0xc618('0x43')](handleError(_0x59a314,null));};exports['destroy']=function(_0x26bc47,_0x8fd35){return db['Schedule'][_0xc618('0x47')]({'where':{'id':_0x26bc47['params']['id']}})[_0xc618('0x23')](handleEntityNotFound(_0x8fd35,null))['then'](removeEntity(_0x8fd35,null))[_0xc618('0x43')](handleError(_0x8fd35,null));};exports[_0xc618('0x4f')]=function(_0x56f053,_0x55a37b,_0x5716e1){var _0x146469=require(_0xc618('0x50'));return db[_0xc618('0x2b')]['find']({'where':{'id':_0x56f053[_0xc618('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x55a37b,null))[_0xc618('0x23')](function(){_0x146469[_0xc618('0x4f')](_0x56f053[_0xc618('0x45')]['id']);})[_0xc618('0x23')](respondWithStatusCode(_0x55a37b,null))['catch'](handleError(_0x55a37b,null));}; \ No newline at end of file +var _0xce9e=['keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','name','send','map','Schedule','rawAttributes','fieldName','type','key','query'];(function(_0x26913d,_0x306f60){var _0x242cec=function(_0x30e185){while(--_0x30e185){_0x26913d['push'](_0x26913d['shift']());}};_0x242cec(++_0x306f60);}(_0xce9e,0x73));var _0xece9=function(_0x119b4b,_0x322a87){_0x119b4b=_0x119b4b-0x0;var _0x2ca4d5=_0xce9e[_0x119b4b];return _0x2ca4d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xece9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xece9('0x1'));var rp=require(_0xece9('0x2'));var moment=require(_0xece9('0x3'));var BPromise=require(_0xece9('0x4'));var Mustache=require(_0xece9('0x5'));var util=require(_0xece9('0x6'));var path=require('path');var sox=require(_0xece9('0x7'));var csv=require('to-csv');var ejs=require(_0xece9('0x8'));var fs=require('fs');var fs_extra=require(_0xece9('0x9'));var _=require(_0xece9('0xa'));var squel=require(_0xece9('0xb'));var crypto=require(_0xece9('0xc'));var jsforce=require(_0xece9('0xd'));var deskjs=require(_0xece9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xece9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xece9('0x10'));var as=require(_0xece9('0x11'));var hardwareService=require(_0xece9('0x12'));var logger=require(_0xece9('0x13'))(_0xece9('0x14'));var utils=require('../../config/utils');var config=require(_0xece9('0x15'));var licenseUtil=require(_0xece9('0x16'));var db=require(_0xece9('0x17'))['db'];function respondWithStatusCode(_0xf0a47b,_0x4b95da){_0x4b95da=_0x4b95da||0xcc;return function(_0x4d8271){if(_0x4d8271){return _0xf0a47b['sendStatus'](_0x4b95da);}return _0xf0a47b[_0xece9('0x18')](_0x4b95da)[_0xece9('0x19')]();};}function respondWithResult(_0x496d35,_0x4891bd){_0x4891bd=_0x4891bd||0xc8;return function(_0x1f0958){if(_0x1f0958){return _0x496d35[_0xece9('0x18')](_0x4891bd)[_0xece9('0x1a')](_0x1f0958);}};}function respondWithFilteredResult(_0x2d9be5,_0x56bd6e){return function(_0x4d5356){if(_0x4d5356){var _0x5c13c8=typeof _0x56bd6e[_0xece9('0x1b')]===_0xece9('0x1c')&&typeof _0x56bd6e[_0xece9('0x1d')]===_0xece9('0x1c');var _0x57a0c9=_0x4d5356[_0xece9('0x1e')];var _0x408f2b=_0x5c13c8?0x0:_0x56bd6e['offset'];var _0x4f7030=_0x5c13c8?_0x4d5356['count']:_0x56bd6e[_0xece9('0x1b')]+_0x56bd6e[_0xece9('0x1d')];var _0x466676;if(_0x4f7030>=_0x57a0c9){_0x4f7030=_0x57a0c9;_0x466676=0xc8;}else{_0x466676=0xce;}_0x2d9be5[_0xece9('0x18')](_0x466676);return _0x2d9be5['set'](_0xece9('0x1f'),_0x408f2b+'-'+_0x4f7030+'/'+_0x57a0c9)[_0xece9('0x1a')](_0x4d5356);}return null;};}function patchUpdates(_0x3e834e){return function(_0x32a14b){try{jsonpatch[_0xece9('0x20')](_0x32a14b,_0x3e834e,!![]);}catch(_0x1d7644){return BPromise[_0xece9('0x21')](_0x1d7644);}return _0x32a14b[_0xece9('0x22')]();};}function saveUpdates(_0x28634b,_0x46f444){return function(_0x376c06){if(_0x376c06){return _0x376c06[_0xece9('0x23')](_0x28634b)[_0xece9('0x24')](function(_0x431e4b){return _0x431e4b;});}return null;};}function removeEntity(_0x547fbf,_0x26e224){return function(_0x3c6831){if(_0x3c6831){return _0x3c6831[_0xece9('0x25')]()[_0xece9('0x24')](function(){var _0x118287=_0x3c6831[_0xece9('0x26')]({'plain':!![]});var _0x4af669=_0xece9('0x27');return db[_0xece9('0x28')]['destroy']({'where':{'type':_0x4af669,'resourceId':_0x118287['id']}})[_0xece9('0x24')](function(){return _0x3c6831;});})[_0xece9('0x24')](function(){_0x547fbf[_0xece9('0x18')](0xcc)[_0xece9('0x19')]();});}};}function handleEntityNotFound(_0x5e80e0,_0x5555c4){return function(_0x15aac4){if(!_0x15aac4){_0x5e80e0[_0xece9('0x29')](0x194);}return _0x15aac4;};}function handleError(_0x8da33f,_0x3ffad4){_0x3ffad4=_0x3ffad4||0x1f4;return function(_0x21a802){logger['error'](_0x21a802['stack']);if(_0x21a802[_0xece9('0x2a')]){delete _0x21a802['name'];}_0x8da33f[_0xece9('0x18')](_0x3ffad4)[_0xece9('0x2b')](_0x21a802);};}exports['index']=function(_0x6a8341,_0x1e4859){var _0x30228c={},_0x1886ba={},_0x5264cf={'count':0x0,'rows':[]};var _0x40914d=_[_0xece9('0x2c')](db[_0xece9('0x2d')][_0xece9('0x2e')],function(_0x36b359){return{'name':_0x36b359[_0xece9('0x2f')],'type':_0x36b359[_0xece9('0x30')][_0xece9('0x31')]};});_0x1886ba['model']=_[_0xece9('0x2c')](_0x40914d,_0xece9('0x2a'));_0x1886ba[_0xece9('0x32')]=_[_0xece9('0x33')](_0x6a8341['query']);_0x1886ba[_0xece9('0x34')]=_['intersection'](_0x1886ba['model'],_0x1886ba[_0xece9('0x32')]);_0x30228c[_0xece9('0x35')]=_[_0xece9('0x36')](_0x1886ba[_0xece9('0x37')],qs[_0xece9('0x38')](_0x6a8341[_0xece9('0x32')][_0xece9('0x38')]));_0x30228c[_0xece9('0x35')]=_0x30228c[_0xece9('0x35')][_0xece9('0x39')]?_0x30228c['attributes']:_0x1886ba['model'];if(!_0x6a8341[_0xece9('0x32')][_0xece9('0x3a')](_0xece9('0x3b'))){_0x30228c[_0xece9('0x1d')]=qs[_0xece9('0x1d')](_0x6a8341[_0xece9('0x32')][_0xece9('0x1d')]);_0x30228c[_0xece9('0x1b')]=qs[_0xece9('0x1b')](_0x6a8341[_0xece9('0x32')]['offset']);}_0x30228c[_0xece9('0x3c')]=qs[_0xece9('0x3d')](_0x6a8341[_0xece9('0x32')][_0xece9('0x3d')]);_0x30228c[_0xece9('0x3e')]=qs['filters'](_[_0xece9('0x3f')](_0x6a8341[_0xece9('0x32')],_0x1886ba[_0xece9('0x34')]),_0x40914d);if(_0x6a8341[_0xece9('0x32')][_0xece9('0x40')]){_0x30228c[_0xece9('0x3e')]=_['merge'](_0x30228c[_0xece9('0x3e')],{'$or':_[_0xece9('0x2c')](_0x40914d,function(_0x3a77c0){if(_0x3a77c0[_0xece9('0x30')]!=='VIRTUAL'){var _0x37d585={};_0x37d585[_0x3a77c0[_0xece9('0x2a')]]={'$like':'%'+_0x6a8341[_0xece9('0x32')][_0xece9('0x40')]+'%'};return _0x37d585;}})});}_0x30228c=_[_0xece9('0x41')]({},_0x30228c,_0x6a8341[_0xece9('0x42')]);var _0x519ade={'where':_0x30228c[_0xece9('0x3e')]};return db['Schedule']['count'](_0x519ade)[_0xece9('0x24')](function(_0x3e0237){_0x5264cf[_0xece9('0x1e')]=_0x3e0237;if(_0x6a8341[_0xece9('0x32')][_0xece9('0x43')]){_0x30228c['include']=[{'all':!![]}];}return db[_0xece9('0x2d')]['findAll'](_0x30228c);})[_0xece9('0x24')](function(_0x278201){_0x5264cf[_0xece9('0x44')]=_0x278201;return _0x5264cf;})[_0xece9('0x24')](respondWithFilteredResult(_0x1e4859,_0x30228c))[_0xece9('0x45')](handleError(_0x1e4859,null));};exports[_0xece9('0x46')]=function(_0x252d55,_0x48f90d){var _0x1801c2={'raw':![],'where':{'id':_0x252d55[_0xece9('0x47')]['id']}},_0x215a41={};_0x215a41[_0xece9('0x37')]=_[_0xece9('0x33')](db[_0xece9('0x2d')][_0xece9('0x2e')]);_0x215a41[_0xece9('0x32')]=_[_0xece9('0x33')](_0x252d55[_0xece9('0x32')]);_0x215a41[_0xece9('0x34')]=_[_0xece9('0x36')](_0x215a41[_0xece9('0x37')],_0x215a41['query']);_0x1801c2[_0xece9('0x35')]=_['intersection'](_0x215a41['model'],qs[_0xece9('0x38')](_0x252d55[_0xece9('0x32')][_0xece9('0x38')]));_0x1801c2[_0xece9('0x35')]=_0x1801c2[_0xece9('0x35')][_0xece9('0x39')]?_0x1801c2['attributes']:_0x215a41[_0xece9('0x37')];if(_0x252d55[_0xece9('0x32')][_0xece9('0x43')]){_0x1801c2[_0xece9('0x48')]=[{'all':!![]}];}_0x1801c2=_[_0xece9('0x41')]({},_0x1801c2,_0x252d55[_0xece9('0x42')]);return db[_0xece9('0x2d')]['find'](_0x1801c2)['then'](handleEntityNotFound(_0x48f90d,null))['then'](respondWithResult(_0x48f90d,null))[_0xece9('0x45')](handleError(_0x48f90d,null));};exports[_0xece9('0x49')]=function(_0xb9c438,_0x448aef){return db[_0xece9('0x2d')]['create'](_0xb9c438['body'],{})[_0xece9('0x24')](function(_0x40a55e){var _0x24478c=_0xb9c438[_0xece9('0x4a')][_0xece9('0x26')]({'plain':!![]});if(!_0x24478c)throw new Error(_0xece9('0x4b'));if(_0x24478c[_0xece9('0x4c')]==='user'){var _0x92e5e5=_0x40a55e[_0xece9('0x26')]({'plain':!![]});var _0x1eb294=_0xece9('0x27');return db['UserProfileSection'][_0xece9('0x4d')]({'where':{'name':_0x1eb294,'userProfileId':_0x24478c['userProfileId']},'raw':!![]})[_0xece9('0x24')](function(_0x23de88){if(_0x23de88&&_0x23de88['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x92e5e5[_0xece9('0x2a')],'resourceId':_0x92e5e5['id'],'type':_0x23de88[_0xece9('0x2a')],'sectionId':_0x23de88['id']},{})['then'](function(){return _0x40a55e;});}else{return _0x40a55e;}})[_0xece9('0x45')](function(_0x13d46a){logger[_0xece9('0x4e')](_0xece9('0x4f'),_0x13d46a);throw _0x13d46a;});}return _0x40a55e;})[_0xece9('0x24')](respondWithResult(_0x448aef,0xc9))[_0xece9('0x45')](handleError(_0x448aef,null));};exports[_0xece9('0x23')]=function(_0x1dec8c,_0xe226c3){if(_0x1dec8c['body']['id']){delete _0x1dec8c[_0xece9('0x50')]['id'];}return db[_0xece9('0x2d')]['find']({'where':{'id':_0x1dec8c['params']['id']}})[_0xece9('0x24')](handleEntityNotFound(_0xe226c3,null))[_0xece9('0x24')](saveUpdates(_0x1dec8c['body'],null))[_0xece9('0x24')](respondWithResult(_0xe226c3,null))[_0xece9('0x45')](handleError(_0xe226c3,null));};exports[_0xece9('0x25')]=function(_0x493c2a,_0x1e1105){return db[_0xece9('0x2d')][_0xece9('0x4d')]({'where':{'id':_0x493c2a[_0xece9('0x47')]['id']}})[_0xece9('0x24')](handleEntityNotFound(_0x1e1105,null))[_0xece9('0x24')](removeEntity(_0x1e1105,null))[_0xece9('0x45')](handleError(_0x1e1105,null));};exports[_0xece9('0x51')]=function(_0x200a5d,_0x4f86be,_0x426d8a){var _0x4a496e=require(_0xece9('0x52'));return db[_0xece9('0x2d')][_0xece9('0x4d')]({'where':{'id':_0x200a5d[_0xece9('0x47')]['id']},'raw':!![]})[_0xece9('0x24')](handleEntityNotFound(_0x4f86be,null))[_0xece9('0x24')](function(){_0x4a496e[_0xece9('0x51')](_0x200a5d[_0xece9('0x47')]['id']);})[_0xece9('0x24')](respondWithStatusCode(_0x4f86be,null))['catch'](handleError(_0x4f86be,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3da3d2e..71e993c 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 _0x4c4e=['request-promise','./schedule.attributes','exports','Schedule','tools_schedules','util','../../config/logger','api','moment'];(function(_0xe7295b,_0x526aa6){var _0x14f83e=function(_0x1e0f72){while(--_0x1e0f72){_0xe7295b['push'](_0xe7295b['shift']());}};_0x14f83e(++_0x526aa6);}(_0x4c4e,0x1f4));var _0xe4c4=function(_0x509b8e,_0x73dbe9){_0x509b8e=_0x509b8e-0x0;var _0x2194ed=_0x4c4e[_0x509b8e];return _0x2194ed;};'use strict';var _=require('lodash');var util=require(_0xe4c4('0x0'));var logger=require(_0xe4c4('0x1'))(_0xe4c4('0x2'));var moment=require(_0xe4c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4c4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe4c4('0x5'));module[_0xe4c4('0x6')]=function(_0x2ee8f0,_0x2edf69){return _0x2ee8f0['define'](_0xe4c4('0x7'),attributes,{'tableName':_0xe4c4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb7=['rimraf','../../config/environment','exports','Schedule','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x282504,_0x56ebd9){var _0x35cfc3=function(_0x562bd5){while(--_0x562bd5){_0x282504['push'](_0x282504['shift']());}};_0x35cfc3(++_0x56ebd9);}(_0x2eb7,0x176));var _0x72eb=function(_0x4e2105,_0x1e5b7f){_0x4e2105=_0x4e2105-0x0;var _0x46dba5=_0x2eb7[_0x4e2105];return _0x46dba5;};'use strict';var _=require(_0x72eb('0x0'));var util=require('util');var logger=require(_0x72eb('0x1'))(_0x72eb('0x2'));var moment=require(_0x72eb('0x3'));var BPromise=require(_0x72eb('0x4'));var rp=require(_0x72eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72eb('0x6'));var config=require(_0x72eb('0x7'));var attributes=require('./schedule.attributes');module[_0x72eb('0x8')]=function(_0x4e6bc1,_0x3a429f){return _0x4e6bc1['define'](_0x72eb('0x9'),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 7036944..e2fe62a 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 _0x0cba=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0cba,0x7d));var _0xa0cb=function(_0x41c88c,_0x381f8d){_0x41c88c=_0x41c88c-0x0;var _0x2c97ea=_0x0cba[_0x41c88c];return _0x2c97ea;};'use strict';var _=require(_0xa0cb('0x0'));var util=require(_0xa0cb('0x1'));var moment=require(_0xa0cb('0x2'));var BPromise=require(_0xa0cb('0x3'));var rs=require(_0xa0cb('0x4'));var fs=require('fs');var Redis=require(_0xa0cb('0x5'));var db=require(_0xa0cb('0x6'))['db'];var utils=require(_0xa0cb('0x7'));var logger=require(_0xa0cb('0x8'))(_0xa0cb('0x9'));var config=require(_0xa0cb('0xa'));var jayson=require(_0xa0cb('0xb'));var client=jayson[_0xa0cb('0xc')][_0xa0cb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x243a0c,_0x3113b5,_0x2ca14c){return new BPromise(function(_0x5ed97b,_0x2b919e){return client[_0xa0cb('0xe')](_0x243a0c,_0x2ca14c)['then'](function(_0x3ef991){logger[_0xa0cb('0xf')](_0xa0cb('0x10'),_0x3113b5,_0xa0cb('0x11'));logger[_0xa0cb('0x12')](_0xa0cb('0x13'),_0x3113b5,_0xa0cb('0x11'),JSON['stringify'](_0x3ef991));if(_0x3ef991[_0xa0cb('0x14')]){if(_0x3ef991[_0xa0cb('0x14')][_0xa0cb('0x15')]===0x1f4){logger[_0xa0cb('0x14')](_0xa0cb('0x10'),_0x3113b5,_0x3ef991[_0xa0cb('0x14')]['message']);return _0x2b919e(_0x3ef991['error']['message']);}logger[_0xa0cb('0x14')](_0xa0cb('0x10'),_0x3113b5,_0x3ef991['error'][_0xa0cb('0x16')]);return _0x5ed97b(_0x3ef991[_0xa0cb('0x14')][_0xa0cb('0x16')]);}else{logger[_0xa0cb('0xf')](_0xa0cb('0x10'),_0x3113b5,'request\x20sent');_0x5ed97b(_0x3ef991[_0xa0cb('0x17')][_0xa0cb('0x16')]);}})[_0xa0cb('0x18')](function(_0x90776e){logger[_0xa0cb('0x14')](_0xa0cb('0x10'),_0x3113b5,_0x90776e);_0x2b919e(_0x90776e);});});} \ No newline at end of file +var _0xf6e1=['../../config/utils','rpc','../../config/environment','client','http','then','info','Schedule,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf6e1,0x12a));var _0x1f6e=function(_0x8d0816,_0xf5678f){_0x8d0816=_0x8d0816-0x0;var _0x50d676=_0xf6e1[_0x8d0816];return _0x50d676;};'use strict';var _=require(_0x1f6e('0x0'));var util=require('util');var moment=require(_0x1f6e('0x1'));var BPromise=require(_0x1f6e('0x2'));var rs=require(_0x1f6e('0x3'));var fs=require('fs');var Redis=require(_0x1f6e('0x4'));var db=require(_0x1f6e('0x5'))['db'];var utils=require(_0x1f6e('0x6'));var logger=require('../../config/logger')(_0x1f6e('0x7'));var config=require(_0x1f6e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1f6e('0x9')][_0x1f6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398df2,_0x277442,_0x3d04d5){return new BPromise(function(_0x26f2a9,_0x384259){return client['request'](_0x398df2,_0x3d04d5)[_0x1f6e('0xb')](function(_0x4666ab){logger[_0x1f6e('0xc')](_0x1f6e('0xd'),_0x277442,'request\x20sent');logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x277442,'request\x20sent',JSON['stringify'](_0x4666ab));if(_0x4666ab['error']){if(_0x4666ab[_0x1f6e('0xe')][_0x1f6e('0xf')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x277442,_0x4666ab[_0x1f6e('0xe')][_0x1f6e('0x10')]);return _0x384259(_0x4666ab['error']['message']);}logger[_0x1f6e('0xe')](_0x1f6e('0xd'),_0x277442,_0x4666ab['error'][_0x1f6e('0x10')]);return _0x26f2a9(_0x4666ab[_0x1f6e('0xe')][_0x1f6e('0x10')]);}else{logger[_0x1f6e('0xc')](_0x1f6e('0xd'),_0x277442,_0x1f6e('0x11'));_0x26f2a9(_0x4666ab['result'][_0x1f6e('0x10')]);}})[_0x1f6e('0x12')](function(_0x1029e1){logger[_0x1f6e('0xe')](_0x1f6e('0xd'),_0x277442,_0x1029e1);_0x384259(_0x1029e1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e4487f3..4afab53 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 _0x8a02=['get','isAuthenticated','index','/describe','describe','/:id','download','post','create','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./screenRecording.controller'];(function(_0x6b8b85,_0x1d7841){var _0x436cad=function(_0x8d40bc){while(--_0x8d40bc){_0x6b8b85['push'](_0x6b8b85['shift']());}};_0x436cad(++_0x1d7841);}(_0x8a02,0x9b));var _0x28a0=function(_0x504a94,_0x55eb08){_0x504a94=_0x504a94-0x0;var _0x388833=_0x8a02[_0x504a94];return _0x388833;};'use strict';var multer=require(_0x28a0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x28a0('0x1'));var express=require(_0x28a0('0x2'));var router=express[_0x28a0('0x3')]();var fs_extra=require(_0x28a0('0x4'));var auth=require(_0x28a0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x28a0('0x6'));router[_0x28a0('0x7')]('/',auth[_0x28a0('0x8')](),controller[_0x28a0('0x9')]);router[_0x28a0('0x7')](_0x28a0('0xa'),auth[_0x28a0('0x8')](),controller[_0x28a0('0xb')]);router[_0x28a0('0x7')](_0x28a0('0xc'),auth[_0x28a0('0x8')](),controller['show']);router[_0x28a0('0x7')]('/:id/download',auth[_0x28a0('0x8')](),controller[_0x28a0('0xd')]);router[_0x28a0('0xe')]('/',auth['isAuthenticated'](),controller[_0x28a0('0xf')]);router['put'](_0x28a0('0xc'),auth[_0x28a0('0x8')](),controller[_0x28a0('0x10')]);router['delete'](_0x28a0('0xc'),auth['isAuthenticated'](),controller[_0x28a0('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfa07=['express','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','put','update','delete','destroy','exports','multer','util','path'];(function(_0x61e96f,_0x1337f9){var _0xda3344=function(_0x170c43){while(--_0x170c43){_0x61e96f['push'](_0x61e96f['shift']());}};_0xda3344(++_0x1337f9);}(_0xfa07,0x1eb));var _0x7fa0=function(_0xb3fe09,_0x4a51ad){_0xb3fe09=_0xb3fe09-0x0;var _0xe44925=_0xfa07[_0xb3fe09];return _0xe44925;};'use strict';var multer=require(_0x7fa0('0x0'));var util=require(_0x7fa0('0x1'));var path=require(_0x7fa0('0x2'));var timeout=require('connect-timeout');var express=require(_0x7fa0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7fa0('0x4'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x7fa0('0x5')]('/',auth['isAuthenticated'](),controller[_0x7fa0('0x6')]);router[_0x7fa0('0x5')](_0x7fa0('0x7'),auth[_0x7fa0('0x8')](),controller[_0x7fa0('0x9')]);router[_0x7fa0('0x5')](_0x7fa0('0xa'),auth['isAuthenticated'](),controller[_0x7fa0('0xb')]);router[_0x7fa0('0x5')](_0x7fa0('0xc'),auth[_0x7fa0('0x8')](),controller[_0x7fa0('0xd')]);router['post']('/',auth[_0x7fa0('0x8')](),controller['create']);router[_0x7fa0('0xe')](_0x7fa0('0xa'),auth[_0x7fa0('0x8')](),controller[_0x7fa0('0xf')]);router[_0x7fa0('0x10')](_0x7fa0('0xa'),auth['isAuthenticated'](),controller[_0x7fa0('0x11')]);module[_0x7fa0('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8501809..5432d44 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 _0x1ab1=['setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','toString','format','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','../../config/environment','value','getDataValue','STRING','replace'];(function(_0x5ad589,_0x40bc56){var _0x2c235d=function(_0x214f55){while(--_0x214f55){_0x5ad589['push'](_0x5ad589['shift']());}};_0x2c235d(++_0x40bc56);}(_0x1ab1,0x12c));var _0x11ab=function(_0x5cf6b1,_0x1b8d83){_0x5cf6b1=_0x5cf6b1-0x0;var _0x324c59=_0x1ab1[_0x5cf6b1];return _0x324c59;};'use strict';var Sequelize=require(_0x11ab('0x0'));var moment=require('moment');var path=require('path');var config=require(_0x11ab('0x1'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x11ab('0x2'))?path['extname'](this[_0x11ab('0x3')](_0x11ab('0x2'))):undefined;}},'interactionid':{'type':Sequelize[_0x11ab('0x4')]},'channel':{'type':Sequelize[_0x11ab('0x4')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3eaf8b){var _0xaf0223=_0x3eaf8b[_0x11ab('0x5')](/\\/g,'/');this[_0x11ab('0x6')](_0x11ab('0x2'),_0xaf0223);}},'rating':{'type':Sequelize[_0x11ab('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1abc4e){this['setDataValue'](_0x11ab('0x8'),moment()[_0x11ab('0x9')](_0x1abc4e,'ms'));this[_0x11ab('0x6')](_0x11ab('0xa'),moment());this['setDataValue'](_0x11ab('0xb'),_0x1abc4e);}},'startedAt':{'type':Sequelize[_0x11ab('0xc')],'get':function(){return moment(this[_0x11ab('0x3')](_0x11ab('0x8')))['format']('MM-DD-YYYY\x20HH:mm')[_0x11ab('0xd')]();}},'closedAt':{'type':Sequelize[_0x11ab('0xc')],'get':function(){return moment(this[_0x11ab('0x3')](_0x11ab('0xa')))[_0x11ab('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x11ab('0xd')]();}},'createdAt':{'type':Sequelize[_0x11ab('0xc')],'get':function(){return moment(this[_0x11ab('0x3')](_0x11ab('0xf')))['format'](_0x11ab('0x10'))[_0x11ab('0xd')]();}},'updatedAt':{'type':Sequelize[_0x11ab('0xc')],'get':function(){return moment(this[_0x11ab('0x3')](_0x11ab('0x11')))[_0x11ab('0xe')](_0x11ab('0x10'))['toString']();}}}; \ No newline at end of file +var _0x9219=['startedAt','duration','DATE','getDataValue','MM-DD-YYYY\x20HH:mm','closedAt','toString','createdAt','format','exports','value','STRING','replace','setDataValue','INTEGER'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x9219,0x19e));var _0x9921=function(_0x465de1,_0x3cddbe){_0x465de1=_0x465de1-0x0;var _0x2799ef=_0x9219[_0x465de1];return _0x2799ef;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0x9921('0x0')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x9921('0x1'))?path['extname'](this['getDataValue'](_0x9921('0x1'))):undefined;}},'interactionid':{'type':Sequelize[_0x9921('0x2')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x9921('0x2')],'set':function(_0x26d1db){var _0x16edb8=_0x26d1db[_0x9921('0x3')](/\\/g,'/');this[_0x9921('0x4')](_0x9921('0x1'),_0x16edb8);}},'rating':{'type':Sequelize[_0x9921('0x5')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5692c8){this['setDataValue'](_0x9921('0x6'),moment()['subtract'](_0x5692c8,'ms'));this[_0x9921('0x4')]('closedAt',moment());this['setDataValue'](_0x9921('0x7'),_0x5692c8);}},'startedAt':{'type':Sequelize[_0x9921('0x8')],'get':function(){return moment(this[_0x9921('0x9')](_0x9921('0x6')))['format'](_0x9921('0xa'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9921('0x9')](_0x9921('0xb')))['format'](_0x9921('0xa'))[_0x9921('0xc')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9921('0x9')](_0x9921('0xd')))[_0x9921('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x9921('0xc')]();}},'updatedAt':{'type':Sequelize[_0x9921('0x8')],'get':function(){return moment(this[_0x9921('0x9')]('updatedAt'))[_0x9921('0xe')](_0x9921('0xa'))[_0x9921('0xc')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2415d6a..ca9945d 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 _0x3e74=['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','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','decryptFile','secrets','server/files/screen_recordings','Sequelize','ValidationError','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0x37e9aa,_0x2f948e){var _0x5df03a=function(_0x349dec){while(--_0x349dec){_0x37e9aa['push'](_0x37e9aa['shift']());}};_0x5df03a(++_0x2f948e);}(_0x3e74,0x175));var _0x43e7=function(_0x16a8a4,_0x13f7da){_0x16a8a4=_0x16a8a4-0x0;var _0x278097=_0x3e74[_0x16a8a4];return _0x278097;};'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('0x2e')](_[_0x43e7('0x27')](_0x50f9f5,'name'),[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0xb1fc63[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x32')]=_['intersection'](_0x4690a6[_0x43e7('0x2d')],_0x4690a6[_0x43e7('0x30')]);_0x33a1a5[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x4690a6['model'],qs['fields'](_0xb1fc63['query'][_0x43e7('0x35')]));_0x33a1a5[_0x43e7('0x33')]=_0x33a1a5[_0x43e7('0x33')][_0x43e7('0x36')]?_0x33a1a5[_0x43e7('0x33')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63['query']['hasOwnProperty']('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5[_0x43e7('0x19')]=qs['offset'](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x19')]);}_0x33a1a5[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x38')]);_0x33a1a5[_0x43e7('0x39')]=qs['filters'](_['pick'](_0xb1fc63['query'],_0x4690a6[_0x43e7('0x32')]),_0x50f9f5);if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x39')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x39')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x2ffd43){if(_0x2ffd43['type']!==_0x43e7('0x3c')){var _0x2b0ffe={};_0x2b0ffe[_0x2ffd43['name']]={'$like':'%'+_0xb1fc63[_0x43e7('0x30')]['filter']+'%'};return _0x2b0ffe;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x3d')]);var _0x1c6f45={'where':_0x33a1a5[_0x43e7('0x39')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x1c6f45)['then'](function(_0x574a93){_0x45b675[_0x43e7('0x1a')]=_0x574a93;if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x33a1a5[_0x43e7('0x3f')]=[{'all':!![]}];}return db[_0x43e7('0x28')]['findAll'](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4227c4){_0x45b675['rows']=_0x4227c4;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x40')]=function(_0x504101,_0x3d81ae){var _0x3b4235={'raw':![],'where':{'id':_0x504101[_0x43e7('0x41')]['id']}},_0x3a5807={};_0x3a5807['model']=_['keys'](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x3a5807[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x504101['query']);_0x3a5807['filters']=_['intersection'](_0x3a5807[_0x43e7('0x2d')],_0x3a5807['query']);_0x3b4235[_0x43e7('0x33')]=_['intersection'](_0x3a5807['model'],qs[_0x43e7('0x35')](_0x504101['query'][_0x43e7('0x35')]));_0x3b4235[_0x43e7('0x33')]=_0x3b4235[_0x43e7('0x33')][_0x43e7('0x36')]?_0x3b4235['attributes']:_0x3a5807[_0x43e7('0x2d')];if(_0x504101[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x3b4235[_0x43e7('0x3f')]=[{'all':!![]}];}_0x3b4235=_[_0x43e7('0x3b')]({},_0x3b4235,_0x504101[_0x43e7('0x3d')]);return db['ScreenRecording']['find'](_0x3b4235)[_0x43e7('0x21')](handleEntityNotFound(_0x3d81ae,null))[_0x43e7('0x21')](respondWithResult(_0x3d81ae,null))[_0x43e7('0x42')](handleError(_0x3d81ae,null));};exports['create']=function(_0x5c1c18,_0x56489b){return db[_0x43e7('0x28')][_0x43e7('0x43')](_0x5c1c18['body'],{})[_0x43e7('0x21')](respondWithResult(_0x56489b,0xc9))[_0x43e7('0x42')](handleError(_0x56489b,null));};exports[_0x43e7('0x20')]=function(_0x560329,_0x593155){if(_0x560329['body']['id']){delete _0x560329['body']['id'];}delete _0x560329[_0x43e7('0x44')][_0x43e7('0x45')];delete _0x560329['body'][_0x43e7('0x46')];delete _0x560329[_0x43e7('0x44')][_0x43e7('0x47')];delete _0x560329[_0x43e7('0x44')]['value'];return db[_0x43e7('0x28')]['find']({'where':{'id':_0x560329['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x593155,null))[_0x43e7('0x21')](saveUpdates(_0x560329[_0x43e7('0x44')],null))[_0x43e7('0x21')](respondWithResult(_0x593155,null))[_0x43e7('0x42')](handleError(_0x593155,null));};exports[_0x43e7('0x48')]=function(_0x1cd87c,_0x256ddd){return db[_0x43e7('0x28')][_0x43e7('0x48')]()['then'](respondWithResult(_0x256ddd,null))[_0x43e7('0x42')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x499c03,_0x39e3ca,_0x4e6f6d){var _0x35b799=require(_0x43e7('0x4a'));var _0x34e2ec=![];var _0x1f561f={};if(_0x499c03[_0x43e7('0x30')]['type']&&_0x499c03['query'][_0x43e7('0x2b')]===_0x43e7('0x4b')){_0x1f561f[_0x43e7('0x4b')]=_0x499c03[_0x43e7('0x41')]['id'];}else{_0x1f561f['id']=_0x499c03[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':_0x1f561f,'attributes':['id',_0x43e7('0x4d')],'raw':!![]})[_0x43e7('0x21')](handleEntityNotFound(_0x39e3ca,null))[_0x43e7('0x21')](function(_0x312306){if(_0x312306){var _0x4ace49=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],'server/files/screen_recordings',_0x312306[_0x43e7('0x4d')]);var _0x220bf2=util[_0x43e7('0x2f')]('%s.cypher',_0x4ace49);if(fs['existsSync'](_0x220bf2)){_0x34e2ec=!![];return _0x35b799[_0x43e7('0x50')](_0x220bf2,_0x4ace49,config[_0x43e7('0x51')]['recording'])[_0x43e7('0x21')](function(){return _0x312306;});}return _0x312306;}})['then'](function(_0x49a6ce){if(_0x49a6ce){var _0x1fa3f6=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],_0x43e7('0x52'),_0x49a6ce[_0x43e7('0x4d')]);if(!fs['existsSync'](_0x1fa3f6)){throw new db[(_0x43e7('0x53'))][(_0x43e7('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x49a6ce[_0x43e7('0x55')]){return _0x39e3ca[_0x43e7('0x49')](_0x1fa3f6,_0x49a6ce[_0x43e7('0x55')]+path['extname'](_0x1fa3f6),function(){if(_0x34e2ec){fs['unlink'](_0x1fa3f6);}});}else{return _0x39e3ca['download'](_0x1fa3f6,function(_0x2ada55){if(_0x34e2ec){fs[_0x43e7('0x56')](_0x1fa3f6);}});}}})[_0x43e7('0x42')](function(_0x3a6404){if(_0x3a6404['message']==='ScreenRecording\x20not\x20found'){_0x39e3ca[_0x43e7('0x1b')](0x194)[_0x43e7('0x25')](_0x43e7('0x57'));}else{return handleError(_0x39e3ca,null);}});};exports[_0x43e7('0x22')]=function(_0x5ea0db,_0x4438c0){return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':{'id':_0x5ea0db[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](function(_0xd41e79){if(_[_0x43e7('0x58')](_0xd41e79)){throw new ReferenceError(_0x43e7('0x59'));}return _0xd41e79;})[_0x43e7('0x21')](function(_0x381208){var _0x252f00=path['join'](config['root'],_0x43e7('0x52'),_0x381208['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x252f00);if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs['existsSync'](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}_0x252f00=_0x252f00+_0x43e7('0x5d');if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs[_0x43e7('0x5e')](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}return _0x381208;})[_0x43e7('0x21')](function(_0x40d0c0){if(!_0x40d0c0)throw new InternalError();return _0x40d0c0[_0x43e7('0x22')]();})['then'](function(){_0x4438c0['status'](0xcc)[_0x43e7('0x15')]();})['catch'](handleError(_0x4438c0,null));}; \ No newline at end of file +var _0xf2ca=['ScreenRecording','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','keys','find','create','catch','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map'];(function(_0x5b7695,_0x139b46){var _0xae72fb=function(_0x97edf8){while(--_0x97edf8){_0x5b7695['push'](_0x5b7695['shift']());}};_0xae72fb(++_0x139b46);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xf2ca[_0x6e1239];return _0x418150;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x3c1ae6,_0xe929b5){return function(_0xff396f){if(!_0xff396f){_0x3c1ae6[_0xaf2c('0x18')](0x194);}return _0xff396f;};}function handleError(_0x4a8dd8,_0x29f8b0){_0x29f8b0=_0x29f8b0||0x1f4;return function(_0x2051be){logger[_0xaf2c('0x24')](_0x2051be[_0xaf2c('0x25')]);if(_0x2051be['name']){delete _0x2051be[_0xaf2c('0x26')];}_0x4a8dd8['status'](_0x29f8b0)[_0xaf2c('0x27')](_0x2051be);};}exports[_0xaf2c('0x28')]=function(_0x15466b,_0x5d685a){var _0x2747bb={},_0x2ea490={},_0x3baee2={'count':0x0,'rows':[]};var _0x4a96d2=_[_0xaf2c('0x29')](db[_0xaf2c('0x2a')][_0xaf2c('0x2b')],function(_0x19364e){return{'name':_0x19364e['fieldName'],'type':_0x19364e[_0xaf2c('0x2c')][_0xaf2c('0x2d')]};});_0x2ea490[_0xaf2c('0x2e')]=_['differenceBy'](_['map'](_0x4a96d2,_0xaf2c('0x26')),['format']);_0x2ea490[_0xaf2c('0x2f')]=_['keys'](_0x15466b[_0xaf2c('0x2f')]);_0x2ea490[_0xaf2c('0x30')]=_['intersection'](_0x2ea490[_0xaf2c('0x2e')],_0x2ea490[_0xaf2c('0x2f')]);_0x2747bb['attributes']=_[_0xaf2c('0x31')](_0x2ea490[_0xaf2c('0x2e')],qs[_0xaf2c('0x32')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x2747bb[_0xaf2c('0x33')]=_0x2747bb['attributes'][_0xaf2c('0x34')]?_0x2747bb['attributes']:_0x2ea490[_0xaf2c('0x2e')];if(!_0x15466b['query'][_0xaf2c('0x35')]('nolimit')){_0x2747bb[_0xaf2c('0x1e')]=qs['limit'](_0x15466b[_0xaf2c('0x2f')]['limit']);_0x2747bb[_0xaf2c('0x1c')]=qs[_0xaf2c('0x1c')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x1c')]);}_0x2747bb[_0xaf2c('0x36')]=qs['sort'](_0x15466b['query'][_0xaf2c('0x37')]);_0x2747bb[_0xaf2c('0x38')]=qs[_0xaf2c('0x30')](_[_0xaf2c('0x39')](_0x15466b[_0xaf2c('0x2f')],_0x2ea490[_0xaf2c('0x30')]),_0x4a96d2);if(_0x15466b['query'][_0xaf2c('0x3a')]){_0x2747bb[_0xaf2c('0x38')]=_['merge'](_0x2747bb[_0xaf2c('0x38')],{'$or':_[_0xaf2c('0x29')](_0x4a96d2,function(_0x25bebd){if(_0x25bebd[_0xaf2c('0x2c')]!==_0xaf2c('0x3b')){var _0x1e8eaf={};_0x1e8eaf[_0x25bebd[_0xaf2c('0x26')]]={'$like':'%'+_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3a')]+'%'};return _0x1e8eaf;}})});}_0x2747bb=_[_0xaf2c('0x3c')]({},_0x2747bb,_0x15466b[_0xaf2c('0x3d')]);var _0x43f606={'where':_0x2747bb[_0xaf2c('0x38')]};return db['ScreenRecording']['count'](_0x43f606)['then'](function(_0x189809){_0x3baee2[_0xaf2c('0x3e')]=_0x189809;if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3f')]){_0x2747bb[_0xaf2c('0x40')]=[{'all':!![]}];}return db[_0xaf2c('0x2a')]['findAll'](_0x2747bb);})[_0xaf2c('0x23')](function(_0x78632a){_0x3baee2[_0xaf2c('0x41')]=_0x78632a;return _0x3baee2;})['then'](respondWithFilteredResult(_0x5d685a,_0x2747bb))['catch'](handleError(_0x5d685a,null));};exports[_0xaf2c('0x42')]=function(_0x4f8440,_0x181787){var _0x25ba26={'raw':![],'where':{'id':_0x4f8440[_0xaf2c('0x43')]['id']}},_0x20fb99={};_0x20fb99['model']=_[_0xaf2c('0x44')](db['ScreenRecording'][_0xaf2c('0x2b')]);_0x20fb99[_0xaf2c('0x2f')]=_['keys'](_0x4f8440[_0xaf2c('0x2f')]);_0x20fb99['filters']=_[_0xaf2c('0x31')](_0x20fb99[_0xaf2c('0x2e')],_0x20fb99[_0xaf2c('0x2f')]);_0x25ba26[_0xaf2c('0x33')]=_[_0xaf2c('0x31')](_0x20fb99[_0xaf2c('0x2e')],qs[_0xaf2c('0x32')](_0x4f8440[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x25ba26['attributes']=_0x25ba26['attributes'][_0xaf2c('0x34')]?_0x25ba26['attributes']:_0x20fb99['model'];if(_0x4f8440['query'][_0xaf2c('0x3f')]){_0x25ba26[_0xaf2c('0x40')]=[{'all':!![]}];}_0x25ba26=_[_0xaf2c('0x3c')]({},_0x25ba26,_0x4f8440[_0xaf2c('0x3d')]);return db['ScreenRecording'][_0xaf2c('0x45')](_0x25ba26)['then'](handleEntityNotFound(_0x181787,null))[_0xaf2c('0x23')](respondWithResult(_0x181787,null))['catch'](handleError(_0x181787,null));};exports[_0xaf2c('0x46')]=function(_0x133e8c,_0x2d01b7){return db[_0xaf2c('0x2a')][_0xaf2c('0x46')](_0x133e8c['body'],{})[_0xaf2c('0x23')](respondWithResult(_0x2d01b7,0xc9))[_0xaf2c('0x47')](handleError(_0x2d01b7,null));};exports['update']=function(_0x4e8efd,_0x367b30){if(_0x4e8efd['body']['id']){delete _0x4e8efd[_0xaf2c('0x48')]['id'];}delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x49')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4a')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4b')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4c')];return db[_0xaf2c('0x2a')][_0xaf2c('0x45')]({'where':{'id':_0x4e8efd['params']['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x367b30,null))[_0xaf2c('0x23')](saveUpdates(_0x4e8efd['body'],null))['then'](respondWithResult(_0x367b30,null))['catch'](handleError(_0x367b30,null));};exports[_0xaf2c('0x4d')]=function(_0x1f6907,_0x551061){return db[_0xaf2c('0x2a')][_0xaf2c('0x4d')]()[_0xaf2c('0x23')](respondWithResult(_0x551061,null))[_0xaf2c('0x47')](handleError(_0x551061,null));};exports[_0xaf2c('0x4e')]=function(_0x170e67,_0x22b1fc,_0x490b95){var _0x2df52e=require(_0xaf2c('0x4f'));var _0x5771e5=![];var _0x245797={};if(_0x170e67[_0xaf2c('0x2f')][_0xaf2c('0x2c')]&&_0x170e67[_0xaf2c('0x2f')][_0xaf2c('0x2c')]===_0xaf2c('0x50')){_0x245797[_0xaf2c('0x50')]=_0x170e67[_0xaf2c('0x43')]['id'];}else{_0x245797['id']=_0x170e67[_0xaf2c('0x43')]['id'];}return db[_0xaf2c('0x2a')][_0xaf2c('0x45')]({'where':_0x245797,'attributes':['id',_0xaf2c('0x4c')],'raw':!![]})[_0xaf2c('0x23')](handleEntityNotFound(_0x22b1fc,null))[_0xaf2c('0x23')](function(_0x297a22){if(_0x297a22){var _0x2d6677=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0x297a22[_0xaf2c('0x4c')]);var _0x5321c3=util[_0xaf2c('0x54')](_0xaf2c('0x55'),_0x2d6677);if(fs[_0xaf2c('0x56')](_0x5321c3)){_0x5771e5=!![];return _0x2df52e['decryptFile'](_0x5321c3,_0x2d6677,config[_0xaf2c('0x57')]['recording'])[_0xaf2c('0x23')](function(){return _0x297a22;});}return _0x297a22;}})[_0xaf2c('0x23')](function(_0xb3ad9){if(_0xb3ad9){var _0x45918b=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0xb3ad9[_0xaf2c('0x4c')]);if(!fs[_0xaf2c('0x56')](_0x45918b)){throw new db['Sequelize'][(_0xaf2c('0x58'))](_0xaf2c('0x59'));}if(_0xb3ad9[_0xaf2c('0x5a')]){return _0x22b1fc[_0xaf2c('0x4e')](_0x45918b,_0xb3ad9[_0xaf2c('0x5a')]+path['extname'](_0x45918b),function(){if(_0x5771e5){fs[_0xaf2c('0x5b')](_0x45918b);}});}else{return _0x22b1fc[_0xaf2c('0x4e')](_0x45918b,function(_0x506000){if(_0x5771e5){fs[_0xaf2c('0x5b')](_0x45918b);}});}}})[_0xaf2c('0x47')](function(_0x4b7070){if(_0x4b7070['message']===_0xaf2c('0x59')){_0x22b1fc[_0xaf2c('0x19')](0x194)[_0xaf2c('0x27')](_0xaf2c('0x5c'));}else{return handleError(_0x22b1fc,null);}});};exports['destroy']=function(_0x36b6f0,_0x3f48f1){return db['ScreenRecording'][_0xaf2c('0x45')]({'where':{'id':_0x36b6f0['params']['id']}})[_0xaf2c('0x23')](function(_0xe6a251){if(_[_0xaf2c('0x5d')](_0xe6a251)){throw new ReferenceError(_0xaf2c('0x5e'));}return _0xe6a251;})[_0xaf2c('0x23')](function(_0x348f7e){var _0x1c9639=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0x348f7e['value']);logger[_0xaf2c('0x5f')](_0xaf2c('0x60'),_0x1c9639);if(!_[_0xaf2c('0x5d')](_0x348f7e[_0xaf2c('0x4c')])&&fs[_0xaf2c('0x56')](_0x1c9639)){logger['info'](_0xaf2c('0x61')+_0x1c9639+_0xaf2c('0x62'));fs[_0xaf2c('0x63')](_0x1c9639);}_0x1c9639=_0x1c9639+_0xaf2c('0x64');if(!_[_0xaf2c('0x5d')](_0x348f7e['value'])&&fs['existsSync'](_0x1c9639)){logger[_0xaf2c('0x5f')](_0xaf2c('0x61')+_0x1c9639+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xaf2c('0x63')](_0x1c9639);}return _0x348f7e;})[_0xaf2c('0x23')](function(_0x2e189b){if(!_0x2e189b)throw new InternalError();return _0x2e189b['destroy']();})[_0xaf2c('0x23')](function(){_0x3f48f1[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();})[_0xaf2c('0x47')](handleError(_0x3f48f1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f1b3a48..4c6aa65 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 _0xa7a8=['ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','define'];(function(_0xa9b0c4,_0x9629fe){var _0x3f1e06=function(_0x5df93c){while(--_0x5df93c){_0xa9b0c4['push'](_0xa9b0c4['shift']());}};_0x3f1e06(++_0x9629fe);}(_0xa7a8,0x12c));var _0x8a7a=function(_0x95b387,_0x2347ea){_0x95b387=_0x95b387-0x0;var _0xc4f8a2=_0xa7a8[_0x95b387];return _0xc4f8a2;};'use strict';var _=require(_0x8a7a('0x0'));var util=require(_0x8a7a('0x1'));var logger=require(_0x8a7a('0x2'))(_0x8a7a('0x3'));var moment=require(_0x8a7a('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a7a('0x6'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module['exports']=function(_0x472946,_0x176253){return _0x472946[_0x8a7a('0x7')](_0x8a7a('0x8'),attributes,{'tableName':_0x8a7a('0x9'),'paranoid':![],'indexes':[{'name':_0x8a7a('0xa'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf203=['screen_recordings','interactionid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf203,0x1c4));var _0x3f20=function(_0x337b1f,_0x5e66b5){_0x337b1f=_0x337b1f-0x0;var _0x14db03=_0xf203[_0x337b1f];return _0x14db03;};'use strict';var _=require(_0x3f20('0x0'));var util=require(_0x3f20('0x1'));var logger=require(_0x3f20('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3f20('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f20('0x4'));var rimraf=require(_0x3f20('0x5'));var config=require(_0x3f20('0x6'));var attributes=require('./screenRecording.attributes');module[_0x3f20('0x7')]=function(_0x5683c6,_0x1a41fa){return _0x5683c6['define']('ScreenRecording',attributes,{'tableName':_0x3f20('0x8'),'paranoid':![],'indexes':[{'name':_0x3f20('0x9'),'fields':[_0x3f20('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b295ffd..42482e4 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 _0x2c5c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ScreenRecording,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util'];(function(_0x155119,_0x237bd4){var _0x5cc2a8=function(_0x533863){while(--_0x533863){_0x155119['push'](_0x155119['shift']());}};_0x5cc2a8(++_0x237bd4);}(_0x2c5c,0x1cc));var _0xc2c5=function(_0x29788b,_0x47376d){_0x29788b=_0x29788b-0x0;var _0xb490e9=_0x2c5c[_0x29788b];return _0xb490e9;};'use strict';var _=require(_0xc2c5('0x0'));var util=require(_0xc2c5('0x1'));var moment=require(_0xc2c5('0x2'));var BPromise=require(_0xc2c5('0x3'));var rs=require(_0xc2c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2c5('0x5'))['db'];var utils=require(_0xc2c5('0x6'));var logger=require(_0xc2c5('0x7'))(_0xc2c5('0x8'));var config=require(_0xc2c5('0x9'));var jayson=require(_0xc2c5('0xa'));var client=jayson['client'][_0xc2c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x225ca7,_0x38a478,_0x3acfea){return new BPromise(function(_0x374cad,_0x264a92){return client[_0xc2c5('0xc')](_0x225ca7,_0x3acfea)['then'](function(_0x13c399){logger[_0xc2c5('0xd')](_0xc2c5('0xe'),_0x38a478,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x38a478,'request\x20sent',JSON[_0xc2c5('0xf')](_0x13c399));if(_0x13c399[_0xc2c5('0x10')]){if(_0x13c399['error'][_0xc2c5('0x11')]===0x1f4){logger[_0xc2c5('0x10')](_0xc2c5('0xe'),_0x38a478,_0x13c399[_0xc2c5('0x10')][_0xc2c5('0x12')]);return _0x264a92(_0x13c399[_0xc2c5('0x10')][_0xc2c5('0x12')]);}logger[_0xc2c5('0x10')](_0xc2c5('0xe'),_0x38a478,_0x13c399['error'][_0xc2c5('0x12')]);return _0x374cad(_0x13c399[_0xc2c5('0x10')][_0xc2c5('0x12')]);}else{logger[_0xc2c5('0xd')](_0xc2c5('0xe'),_0x38a478,_0xc2c5('0x13'));_0x374cad(_0x13c399[_0xc2c5('0x14')]['message']);}})[_0xc2c5('0x15')](function(_0x5d5ee3){logger[_0xc2c5('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x38a478,_0x5d5ee3);_0x264a92(_0x5d5ee3);});});} \ No newline at end of file +var _0x2bf0=['request','then','request\x20sent','debug','code','error','ScreenRecording,\x20%s,\x20%s','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x37fe98,_0x1a0639){var _0x4f7f7d=function(_0x1e9749){while(--_0x1e9749){_0x37fe98['push'](_0x37fe98['shift']());}};_0x4f7f7d(++_0x1a0639);}(_0x2bf0,0x14c));var _0x02bf=function(_0x2c6e2c,_0x40f1cc){_0x2c6e2c=_0x2c6e2c-0x0;var _0x4e49d9=_0x2bf0[_0x2c6e2c];return _0x4e49d9;};'use strict';var _=require(_0x02bf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x02bf('0x1'));var fs=require('fs');var Redis=require(_0x02bf('0x2'));var db=require(_0x02bf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x02bf('0x4'))(_0x02bf('0x5'));var config=require(_0x02bf('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x02bf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21d150,_0x27601d,_0x1cd0af){return new BPromise(function(_0x30c1d4,_0x4faf0d){return client[_0x02bf('0x8')](_0x21d150,_0x1cd0af)[_0x02bf('0x9')](function(_0x193fdc){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x27601d,_0x02bf('0xa'));logger[_0x02bf('0xb')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x27601d,_0x02bf('0xa'),JSON['stringify'](_0x193fdc));if(_0x193fdc['error']){if(_0x193fdc['error'][_0x02bf('0xc')]===0x1f4){logger[_0x02bf('0xd')](_0x02bf('0xe'),_0x27601d,_0x193fdc[_0x02bf('0xd')][_0x02bf('0xf')]);return _0x4faf0d(_0x193fdc[_0x02bf('0xd')]['message']);}logger[_0x02bf('0xd')](_0x02bf('0xe'),_0x27601d,_0x193fdc[_0x02bf('0xd')][_0x02bf('0xf')]);return _0x30c1d4(_0x193fdc[_0x02bf('0xd')][_0x02bf('0xf')]);}else{logger['info'](_0x02bf('0xe'),_0x27601d,_0x02bf('0xa'));_0x30c1d4(_0x193fdc[_0x02bf('0x10')]['message']);}})['catch'](function(_0x4f74fa){logger[_0x02bf('0xd')](_0x02bf('0xe'),_0x27601d,_0x4f74fa);_0x4faf0d(_0x4f74fa);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 8d0b479..b343b11 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 _0x33e8=['getFavicon','diskStorage','join','format','%s%s','logo','extname','originalname','post','addLogo','root','logologin','single','file','addLogoLogin','server/files/images/logos/','addPreferred','favicon','put','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon'];(function(_0x510ebb,_0x60a4c9){var _0x490fe7=function(_0x420e95){while(--_0x420e95){_0x510ebb['push'](_0x510ebb['shift']());}};_0x490fe7(++_0x60a4c9);}(_0x33e8,0x116));var _0x833e=function(_0x5919ba,_0x49758d){_0x5919ba=_0x5919ba-0x0;var _0x4d7f1b=_0x33e8[_0x5919ba];return _0x4d7f1b;};'use strict';var multer=require('multer');var util=require(_0x833e('0x0'));var path=require('path');var timeout=require(_0x833e('0x1'));var express=require(_0x833e('0x2'));var router=express[_0x833e('0x3')]();var fs_extra=require(_0x833e('0x4'));var auth=require(_0x833e('0x5'));var interaction=require(_0x833e('0x6'));var config=require('../../config/environment');var controller=require(_0x833e('0x7'));router[_0x833e('0x8')]('/',auth[_0x833e('0x9')](),controller[_0x833e('0xa')]);router[_0x833e('0x8')]('/now',controller[_0x833e('0xb')]);router[_0x833e('0x8')](_0x833e('0xc'),controller[_0x833e('0xd')]);router['get'](_0x833e('0xe'),controller[_0x833e('0xf')]);router[_0x833e('0x8')](_0x833e('0x10'),controller[_0x833e('0x11')]);router[_0x833e('0x8')](_0x833e('0x12'),controller[_0x833e('0x13')]);router['get'](_0x833e('0x14'),controller[_0x833e('0x15')]);router[_0x833e('0x8')](_0x833e('0x16'),controller[_0x833e('0x17')]);var upload=multer({'storage':multer[_0x833e('0x18')]({'destination':function(_0x3a2468,_0x15543a,_0x179edc){_0x179edc(null,path[_0x833e('0x19')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1efb8d,_0x3b2f03,_0x474ef4){_0x474ef4(null,util[_0x833e('0x1a')](_0x833e('0x1b'),_0x833e('0x1c'),path[_0x833e('0x1d')](_0x3b2f03[_0x833e('0x1e')])));}})});router[_0x833e('0x1f')](_0x833e('0xe'),upload['single']('file'),controller[_0x833e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56f0b1,_0x2facae,_0x1e0ada){_0x1e0ada(null,path[_0x833e('0x19')](config[_0x833e('0x21')],'server/files/images/logos/'));},'filename':function(_0x10ad1a,_0xd4adb4,_0x1fd620){_0x1fd620(null,util[_0x833e('0x1a')](_0x833e('0x1b'),_0x833e('0x22'),path[_0x833e('0x1d')](_0xd4adb4[_0x833e('0x1e')])));}})});router[_0x833e('0x1f')]('/:id/logo_login',upload[_0x833e('0x23')](_0x833e('0x24')),controller[_0x833e('0x25')]);var upload=multer({'storage':multer[_0x833e('0x18')]({'destination':function(_0x158b04,_0x30c04b,_0x433c57){_0x433c57(null,path['join'](config['root'],_0x833e('0x26')));},'filename':function(_0x54808b,_0x15e0a2,_0x5bf884){_0x5bf884(null,util[_0x833e('0x1a')](_0x833e('0x1b'),'preferred',path[_0x833e('0x1d')](_0x15e0a2[_0x833e('0x1e')])));}})});router[_0x833e('0x1f')]('/:id/preferred',upload[_0x833e('0x23')]('file'),controller[_0x833e('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16f4b0,_0x34b804,_0xf0b795){_0xf0b795(null,path[_0x833e('0x19')](config[_0x833e('0x21')],_0x833e('0x26')));},'filename':function(_0x38c78f,_0x1393f2,_0x4e4409){_0x4e4409(null,util[_0x833e('0x1a')]('%s%s',_0x833e('0x28'),path[_0x833e('0x1d')](_0x1393f2['originalname'])));}})});router[_0x833e('0x1f')](_0x833e('0x16'),upload[_0x833e('0x23')](_0x833e('0x24')),controller['addFavicon']);router[_0x833e('0x29')]('/:id',auth[_0x833e('0x9')](),controller['update']);module[_0x833e('0x2a')]=router; \ No newline at end of file +var _0xe6ba=['root','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xe6ba,0xd0));var _0xae6b=function(_0x10d425,_0x17fdb2){_0x10d425=_0x10d425-0x0;var _0x262d31=_0xe6ba[_0x10d425];return _0x262d31;};'use strict';var multer=require('multer');var util=require(_0xae6b('0x0'));var path=require('path');var timeout=require(_0xae6b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xae6b('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xae6b('0x3'));var config=require(_0xae6b('0x4'));var controller=require(_0xae6b('0x5'));router['get']('/',auth[_0xae6b('0x6')](),controller['index']);router[_0xae6b('0x7')]('/now',controller[_0xae6b('0x8')]);router[_0xae6b('0x7')]('/:id',controller[_0xae6b('0x9')]);router[_0xae6b('0x7')](_0xae6b('0xa'),controller[_0xae6b('0xb')]);router[_0xae6b('0x7')](_0xae6b('0xc'),controller[_0xae6b('0xd')]);router['get'](_0xae6b('0xe'),controller[_0xae6b('0xf')]);router[_0xae6b('0x7')](_0xae6b('0x10'),controller[_0xae6b('0x11')]);router['get'](_0xae6b('0x12'),controller[_0xae6b('0x13')]);var upload=multer({'storage':multer[_0xae6b('0x14')]({'destination':function(_0x1f1ce1,_0x40da21,_0x563cab){_0x563cab(null,path[_0xae6b('0x15')](config['root'],_0xae6b('0x16')));},'filename':function(_0x299615,_0x6f9268,_0x57a259){_0x57a259(null,util[_0xae6b('0x17')](_0xae6b('0x18'),_0xae6b('0x19'),path[_0xae6b('0x1a')](_0x6f9268[_0xae6b('0x1b')])));}})});router[_0xae6b('0x1c')](_0xae6b('0xa'),upload[_0xae6b('0x1d')](_0xae6b('0x1e')),controller[_0xae6b('0x1f')]);var upload=multer({'storage':multer[_0xae6b('0x14')]({'destination':function(_0x2bc697,_0x13cd0b,_0x5098a0){_0x5098a0(null,path[_0xae6b('0x15')](config[_0xae6b('0x20')],_0xae6b('0x16')));},'filename':function(_0xcd5eff,_0xa54cf1,_0x2511f5){_0x2511f5(null,util[_0xae6b('0x17')](_0xae6b('0x18'),'logologin',path['extname'](_0xa54cf1[_0xae6b('0x1b')])));}})});router[_0xae6b('0x1c')](_0xae6b('0xc'),upload[_0xae6b('0x1d')](_0xae6b('0x1e')),controller[_0xae6b('0x21')]);var upload=multer({'storage':multer[_0xae6b('0x14')]({'destination':function(_0x553483,_0x79551c,_0x178f8d){_0x178f8d(null,path['join'](config['root'],_0xae6b('0x16')));},'filename':function(_0xab46f4,_0x1350bc,_0x204b2f){_0x204b2f(null,util[_0xae6b('0x17')]('%s%s',_0xae6b('0x22'),path[_0xae6b('0x1a')](_0x1350bc[_0xae6b('0x1b')])));}})});router['post']('/:id/preferred',upload[_0xae6b('0x1d')](_0xae6b('0x1e')),controller[_0xae6b('0x23')]);var upload=multer({'storage':multer[_0xae6b('0x14')]({'destination':function(_0x2df6d6,_0x28f881,_0x660a0a){_0x660a0a(null,path[_0xae6b('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1d2089,_0x38baff,_0x417cab){_0x417cab(null,util[_0xae6b('0x17')]('%s%s',_0xae6b('0x24'),path[_0xae6b('0x1a')](_0x38baff[_0xae6b('0x1b')])));}})});router['post'](_0xae6b('0x12'),upload[_0xae6b('0x1d')](_0xae6b('0x1e')),controller[_0xae6b('0x25')]);router[_0xae6b('0x26')]('/:id',auth[_0xae6b('0x6')](),controller[_0xae6b('0x27')]);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 5b0e4ab..32baa17 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 _0xa547=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','min_internal','min_mailbox','INTEGER'];(function(_0x256455,_0x386945){var _0x4b3825=function(_0x1699ea){while(--_0x1699ea){_0x256455['push'](_0x256455['shift']());}};_0x4b3825(++_0x386945);}(_0xa547,0xb0));var _0x7a54=function(_0x4e1442,_0x3d7ce7){_0x4e1442=_0x4e1442-0x0;var _0x43c962=_0xa547[_0x4e1442];return _0x43c962;};'use strict';var Sequelize=require('sequelize');module[_0x7a54('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x7a54('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x7a54('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7a54('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x7a54('0x4')],'defaultValue':_0x7a54('0x5')},'logo':{'type':Sequelize[_0x7a54('0x4')]},'defaultLogo':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7a54('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x7a54('0x4')]},'turnusername':{'type':Sequelize[_0x7a54('0x4')]},'turnpassword':{'type':Sequelize[_0x7a54('0x4')]},'pageTitle':{'type':Sequelize[_0x7a54('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7a54('0x4')],'defaultValue':_0x7a54('0x7')},'enableEmailPreview':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7a54('0x4')],'defaultValue':_0x7a54('0x8')},'chatTimeout':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7a54('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7a54('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7a54('0x3')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7a54('0x3')]},'sentimentRegion':{'type':Sequelize[_0x7a54('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x7a54('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x7a54('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7a54('0x3')](0x2)[_0x7a54('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x7a54('0x3')](0x2)[_0x7a54('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7a54('0x3')](0x2)[_0x7a54('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x7a54('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7a54('0x3')],'defaultValue':0x14}}; \ No newline at end of file +var _0x5fdc=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x5b7452,_0x20965c){var _0x374384=function(_0x2b6c6d){while(--_0x2b6c6d){_0x5b7452['push'](_0x5b7452['shift']());}};_0x374384(++_0x20965c);}(_0x5fdc,0x127));var _0xc5fd=function(_0x573ecf,_0x560734){_0x573ecf=_0x573ecf-0x0;var _0x232973=_0x5fdc[_0x573ecf];return _0x232973;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'min_internal':{'type':Sequelize[_0xc5fd('0x2')](0xb),'unique':_0xc5fd('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xc5fd('0x2')](0xb),'unique':_0xc5fd('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc5fd('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc5fd('0x5')],'defaultValue':_0xc5fd('0x6')},'logo':{'type':Sequelize[_0xc5fd('0x5')]},'defaultLogo':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc5fd('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc5fd('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xc5fd('0x5')]},'turnusername':{'type':Sequelize[_0xc5fd('0x5')]},'turnpassword':{'type':Sequelize[_0xc5fd('0x5')]},'pageTitle':{'type':Sequelize[_0xc5fd('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc5fd('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xc5fd('0x5')],'defaultValue':_0xc5fd('0x8')},'enableEmailPreview':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xc5fd('0x9')},'chatTimeout':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc5fd('0x5')]},'defaultPreferred':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc5fd('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xc5fd('0x5')]},'defaultFavicon':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc5fd('0x2')]},'sentimentRegion':{'type':Sequelize[_0xc5fd('0x5')]},'language':{'type':Sequelize[_0xc5fd('0x5')]},'bucket':{'type':Sequelize[_0xc5fd('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xc5fd('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xc5fd('0x2')](0x2)[_0xc5fd('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xc5fd('0x2')](0x2)[_0xc5fd('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xc5fd('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xc5fd('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xc5fd('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'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 3af7a17..f805873 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 _0x4a5a=['lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','http','request','then','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','undefined','count','offset','set','Content-Range','reject','save','destroy','stack','name','index','Setting','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','findAll','rows','rawAttributes','length','include','find','update','body','addLogo','file','filename','params','addLogoLogin','loginLogo','../../config/license/util','getLicense','logo','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','\x20not\x20found','download','getLogoLogin','server/files/images/logos','preferred','default_loginLogo.svg','default','existsSync','Sequelize','ValidationError','gdpr','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x38e138,_0x5d08ea){var _0x604149=function(_0xd865bb){while(--_0xd865bb){_0x38e138['push'](_0x38e138['shift']());}};_0x604149(++_0x5d08ea);}(_0x4a5a,0x6e));var _0xa4a5=function(_0x3ca597,_0x42741a){_0x3ca597=_0x3ca597-0x0;var _0x4bd23f=_0x4a5a[_0x3ca597];return _0x4bd23f;};'use strict';var emlformat=require(_0xa4a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4a5('0x1'));var jsonpatch=require(_0xa4a5('0x2'));var rp=require(_0xa4a5('0x3'));var moment=require('moment');var BPromise=require(_0xa4a5('0x4'));var Mustache=require(_0xa4a5('0x5'));var util=require(_0xa4a5('0x6'));var path=require(_0xa4a5('0x7'));var sox=require(_0xa4a5('0x8'));var csv=require(_0xa4a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4a5('0xa'));var squel=require('squel');var crypto=require(_0xa4a5('0xb'));var jsforce=require(_0xa4a5('0xc'));var deskjs=require(_0xa4a5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa4a5('0xe'));var Papa=require('papaparse');var Redis=require(_0xa4a5('0xf'));var authService=require(_0xa4a5('0x10'));var qs=require(_0xa4a5('0x11'));var as=require(_0xa4a5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa4a5('0x13'));var utils=require(_0xa4a5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa4a5('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x3fcd97,_0x26f221,_0x5467ab,_0x5278be){return new BPromise(function(_0x5f444a,_0x4b2ab6){var _0xb5a29d=_0x5278be||client;return _0xb5a29d[_0xa4a5('0x16')](_0x3fcd97,_0x5467ab)[_0xa4a5('0x17')](function(_0x1f321e){logger['info'](_0xa4a5('0x18'),_0x26f221,_0xa4a5('0x19'));logger[_0xa4a5('0x1a')](_0xa4a5('0x1b'),_0x26f221,_0xa4a5('0x19'),JSON[_0xa4a5('0x1c')](_0x1f321e));if(_0x1f321e[_0xa4a5('0x1d')]){if(_0x1f321e[_0xa4a5('0x1d')][_0xa4a5('0x1e')]===0x1f4){logger[_0xa4a5('0x1d')]('Setting,\x20%s,\x20%s',_0x26f221,_0x1f321e[_0xa4a5('0x1d')]['message']);return _0x4b2ab6(_0x1f321e[_0xa4a5('0x1d')][_0xa4a5('0x1f')]);}logger[_0xa4a5('0x1d')](_0xa4a5('0x18'),_0x26f221,_0x1f321e[_0xa4a5('0x1d')]['message']);return _0x5f444a(_0x1f321e[_0xa4a5('0x1d')]['message']);}else{logger['info'](_0xa4a5('0x18'),_0x26f221,_0xa4a5('0x19'));_0x5f444a(_0x1f321e[_0xa4a5('0x20')][_0xa4a5('0x1f')]);}})[_0xa4a5('0x21')](function(_0x32bf00){logger[_0xa4a5('0x1d')](_0xa4a5('0x18'),_0x26f221,_0x32bf00);_0x4b2ab6(_0x32bf00);});});}function respondWithStatusCode(_0x570381,_0xf6e0bf){_0xf6e0bf=_0xf6e0bf||0xcc;return function(_0x18b4ee){if(_0x18b4ee){return _0x570381[_0xa4a5('0x22')](_0xf6e0bf);}return _0x570381[_0xa4a5('0x23')](_0xf6e0bf)[_0xa4a5('0x24')]();};}function respondWithResult(_0x2c48c8,_0xf0d9bd){_0xf0d9bd=_0xf0d9bd||0xc8;return function(_0x364cf5){if(_0x364cf5){return _0x2c48c8['status'](_0xf0d9bd)[_0xa4a5('0x25')](_0x364cf5);}};}function respondWithFilteredResult(_0x337292,_0xbcb7a3){return function(_0x57a526){if(_0x57a526){var _0x4f5663=typeof _0xbcb7a3['offset']==='undefined'&&typeof _0xbcb7a3['limit']===_0xa4a5('0x26');var _0x10bd8c=_0x57a526[_0xa4a5('0x27')];var _0xdcbc5e=_0x4f5663?0x0:_0xbcb7a3[_0xa4a5('0x28')];var _0x5bb174=_0x4f5663?_0x57a526[_0xa4a5('0x27')]:_0xbcb7a3[_0xa4a5('0x28')]+_0xbcb7a3['limit'];var _0x52bb2e;if(_0x5bb174>=_0x10bd8c){_0x5bb174=_0x10bd8c;_0x52bb2e=0xc8;}else{_0x52bb2e=0xce;}_0x337292[_0xa4a5('0x23')](_0x52bb2e);return _0x337292[_0xa4a5('0x29')](_0xa4a5('0x2a'),_0xdcbc5e+'-'+_0x5bb174+'/'+_0x10bd8c)['json'](_0x57a526);}return null;};}function patchUpdates(_0xe2bd){return function(_0x4a5d4b){try{jsonpatch['apply'](_0x4a5d4b,_0xe2bd,!![]);}catch(_0x4e6699){return BPromise[_0xa4a5('0x2b')](_0x4e6699);}return _0x4a5d4b[_0xa4a5('0x2c')]();};}function saveUpdates(_0x5d09b9,_0x2063ba){return function(_0x23bc1f){if(_0x23bc1f){return _0x23bc1f['update'](_0x5d09b9)['then'](function(_0x5bb308){return _0x5bb308;});}return null;};}function removeEntity(_0x3e5e73,_0x4e40a5){return function(_0x4ea22a){if(_0x4ea22a){return _0x4ea22a[_0xa4a5('0x2d')]()[_0xa4a5('0x17')](function(){_0x3e5e73[_0xa4a5('0x23')](0xcc)[_0xa4a5('0x24')]();});}};}function handleEntityNotFound(_0x583204,_0x685729){return function(_0x1e641f){if(!_0x1e641f){_0x583204[_0xa4a5('0x22')](0x194);}return _0x1e641f;};}function handleError(_0x120669,_0x15fbe6){_0x15fbe6=_0x15fbe6||0x1f4;return function(_0x5dc33f){logger[_0xa4a5('0x1d')](_0x5dc33f[_0xa4a5('0x2e')]);if(_0x5dc33f[_0xa4a5('0x2f')]){delete _0x5dc33f[_0xa4a5('0x2f')];}_0x120669['status'](_0x15fbe6)['send'](_0x5dc33f);};}exports[_0xa4a5('0x30')]=function(_0x5b9f74,_0x5b23b4){var _0x340252={},_0x1e1900={},_0x19484d={'count':0x0,'rows':[]};var _0x31888a=_['map'](db[_0xa4a5('0x31')]['rawAttributes'],function(_0x5901bd){return{'name':_0x5901bd[_0xa4a5('0x32')],'type':_0x5901bd[_0xa4a5('0x33')][_0xa4a5('0x34')]};});_0x1e1900[_0xa4a5('0x35')]=_[_0xa4a5('0x36')](_0x31888a,_0xa4a5('0x2f'));_0x1e1900['query']=_[_0xa4a5('0x37')](_0x5b9f74[_0xa4a5('0x38')]);_0x1e1900[_0xa4a5('0x39')]=_[_0xa4a5('0x3a')](_0x1e1900['model'],_0x1e1900[_0xa4a5('0x38')]);_0x340252[_0xa4a5('0x3b')]=_['intersection'](_0x1e1900['model'],qs[_0xa4a5('0x3c')](_0x5b9f74['query'][_0xa4a5('0x3c')]));_0x340252[_0xa4a5('0x3b')]=_0x340252[_0xa4a5('0x3b')]['length']?_0x340252[_0xa4a5('0x3b')]:_0x1e1900['model'];if(!_0x5b9f74[_0xa4a5('0x38')][_0xa4a5('0x3d')](_0xa4a5('0x3e'))){_0x340252[_0xa4a5('0x3f')]=qs[_0xa4a5('0x3f')](_0x5b9f74[_0xa4a5('0x38')][_0xa4a5('0x3f')]);_0x340252[_0xa4a5('0x28')]=qs['offset'](_0x5b9f74[_0xa4a5('0x38')][_0xa4a5('0x28')]);}_0x340252[_0xa4a5('0x40')]=qs[_0xa4a5('0x41')](_0x5b9f74[_0xa4a5('0x38')][_0xa4a5('0x41')]);_0x340252[_0xa4a5('0x42')]=qs[_0xa4a5('0x39')](_['pick'](_0x5b9f74[_0xa4a5('0x38')],_0x1e1900['filters']),_0x31888a);if(_0x5b9f74['query'][_0xa4a5('0x43')]){_0x340252[_0xa4a5('0x42')]=_['merge'](_0x340252[_0xa4a5('0x42')],{'$or':_['map'](_0x31888a,function(_0x35eabe){if(_0x35eabe['type']!==_0xa4a5('0x44')){var _0x46a7c8={};_0x46a7c8[_0x35eabe[_0xa4a5('0x2f')]]={'$like':'%'+_0x5b9f74[_0xa4a5('0x38')]['filter']+'%'};return _0x46a7c8;}})});}_0x340252=_[_0xa4a5('0x45')]({},_0x340252,_0x5b9f74[_0xa4a5('0x46')]);var _0x52bc00={'where':_0x340252[_0xa4a5('0x42')]};return db[_0xa4a5('0x31')][_0xa4a5('0x27')](_0x52bc00)['then'](function(_0x5896e5){_0x19484d[_0xa4a5('0x27')]=_0x5896e5;if(_0x5b9f74[_0xa4a5('0x38')]['includeAll']){_0x340252['include']=[{'all':!![]}];}return db[_0xa4a5('0x31')][_0xa4a5('0x47')](_0x340252);})['then'](function(_0x544a57){_0x19484d[_0xa4a5('0x48')]=_0x544a57;return _0x19484d;})['then'](respondWithFilteredResult(_0x5b23b4,_0x340252))[_0xa4a5('0x21')](handleError(_0x5b23b4,null));};exports['show']=function(_0x1a1842,_0x17d5ab){var _0x296b88={'raw':![],'where':{'id':_0x1a1842['params']['id']}},_0x4bc1a0={};_0x4bc1a0[_0xa4a5('0x35')]=_['keys'](db[_0xa4a5('0x31')][_0xa4a5('0x49')]);_0x4bc1a0['query']=_['keys'](_0x1a1842[_0xa4a5('0x38')]);_0x4bc1a0[_0xa4a5('0x39')]=_['intersection'](_0x4bc1a0[_0xa4a5('0x35')],_0x4bc1a0['query']);_0x296b88['attributes']=_['intersection'](_0x4bc1a0[_0xa4a5('0x35')],qs[_0xa4a5('0x3c')](_0x1a1842[_0xa4a5('0x38')][_0xa4a5('0x3c')]));_0x296b88[_0xa4a5('0x3b')]=_0x296b88[_0xa4a5('0x3b')][_0xa4a5('0x4a')]?_0x296b88[_0xa4a5('0x3b')]:_0x4bc1a0[_0xa4a5('0x35')];if(_0x1a1842['query']['includeAll']){_0x296b88[_0xa4a5('0x4b')]=[{'all':!![]}];}_0x296b88=_[_0xa4a5('0x45')]({},_0x296b88,_0x1a1842[_0xa4a5('0x46')]);return db[_0xa4a5('0x31')][_0xa4a5('0x4c')](_0x296b88)[_0xa4a5('0x17')](handleEntityNotFound(_0x17d5ab,null))['then'](respondWithResult(_0x17d5ab,null))['catch'](handleError(_0x17d5ab,null));};exports[_0xa4a5('0x4d')]=function(_0x834211,_0x4dedc8){if(_0x834211[_0xa4a5('0x4e')]['id']){delete _0x834211['body']['id'];}return db[_0xa4a5('0x31')][_0xa4a5('0x4c')]({'where':{'id':_0x834211['params']['id']}})[_0xa4a5('0x17')](handleEntityNotFound(_0x4dedc8,null))['then'](saveUpdates(_0x834211[_0xa4a5('0x4e')],null))['then'](respondWithResult(_0x4dedc8,null))['catch'](handleError(_0x4dedc8,null));};exports[_0xa4a5('0x4f')]=function(_0x52b3bd,_0x16cf4f,_0x5ef343){if(_0x52b3bd['file']&&_0x52b3bd[_0xa4a5('0x50')][_0xa4a5('0x51')]){_0x52b3bd['body']['logo']=_0x52b3bd[_0xa4a5('0x50')]['filename'];}return db[_0xa4a5('0x31')]['find']({'where':{'id':_0x52b3bd[_0xa4a5('0x52')]['id']}})[_0xa4a5('0x17')](handleEntityNotFound(_0x16cf4f,null))[_0xa4a5('0x17')](saveUpdates(_0x52b3bd[_0xa4a5('0x4e')],null))['then'](respondWithResult(_0x16cf4f,null))[_0xa4a5('0x21')](handleError(_0x16cf4f,null));};exports[_0xa4a5('0x53')]=function(_0x206680,_0x19f9d7,_0x3b96bf){if(_0x206680[_0xa4a5('0x50')]&&_0x206680[_0xa4a5('0x50')]['filename']){_0x206680[_0xa4a5('0x4e')][_0xa4a5('0x54')]=_0x206680[_0xa4a5('0x50')][_0xa4a5('0x51')];}return db[_0xa4a5('0x31')]['find']({'where':{'id':_0x206680[_0xa4a5('0x52')]['id']}})[_0xa4a5('0x17')](handleEntityNotFound(_0x19f9d7,null))[_0xa4a5('0x17')](saveUpdates(_0x206680[_0xa4a5('0x4e')],null))[_0xa4a5('0x17')](respondWithResult(_0x19f9d7,null))[_0xa4a5('0x21')](handleError(_0x19f9d7,null));};var utilLicense=require(_0xa4a5('0x55'));exports['getLogo']=function(_0x1b9869,_0x41bc28,_0x5945a6){var _0x218c21='server/files/images/logos';var _0x1fb9db={'custom':![]};return utilLicense[_0xa4a5('0x56')]()[_0xa4a5('0x17')](function(_0x303315){if(_0x303315){_0x1fb9db=_0x303315;}return db['Setting'][_0xa4a5('0x4c')]({'where':{'id':_0x1b9869['params']['id']},'attributes':[_0xa4a5('0x57'),_0xa4a5('0x54'),'preferred',_0xa4a5('0x58'),_0xa4a5('0x59'),'defaultLoginLogo',_0xa4a5('0x5a'),_0xa4a5('0x5b')],'raw':!![]});})[_0xa4a5('0x17')](handleEntityNotFound(_0x41bc28,null))[_0xa4a5('0x17')](function(_0x56e8cb){if(_0x56e8cb){var _0x23fd6e=_0x56e8cb[_0xa4a5('0x57')]&&fs['existsSync'](path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0x218c21,_['toLower'](_0x56e8cb[_0xa4a5('0x57')])))?path['join'](config[_0xa4a5('0x5d')],_0x218c21,_['toLower'](_0x56e8cb[_0xa4a5('0x57')])):path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0x218c21,_[_0xa4a5('0x5e')](_0xa4a5('0x5f')));var _0x3273a3='default'+_[_0xa4a5('0x60')](_0xa4a5('0x57'));if(_0x56e8cb[_0x3273a3]||!_0x1fb9db[_0xa4a5('0x61')]){_0x23fd6e=path['join'](config['root'],_0x218c21,_[_0xa4a5('0x5e')](_0xa4a5('0x5f')));}if(!fs['existsSync'](_0x23fd6e)){throw new db['Sequelize']['ValidationError'](_[_0xa4a5('0x60')](_0xa4a5('0x57'))+_0xa4a5('0x62'));}return _0x41bc28[_0xa4a5('0x63')](_0x23fd6e);}})['catch'](handleError(_0x41bc28,null));};var utilLicense=require(_0xa4a5('0x55'));exports[_0xa4a5('0x64')]=function(_0x3525e0,_0x2eb2aa,_0x445398){var _0x2e0afb=_0xa4a5('0x65');var _0x5b4fd9={'custom':![]};return utilLicense[_0xa4a5('0x56')]()[_0xa4a5('0x17')](function(_0x8d99df){if(_0x8d99df){_0x5b4fd9=_0x8d99df;}return db[_0xa4a5('0x31')][_0xa4a5('0x4c')]({'where':{'id':_0x3525e0['params']['id']},'attributes':[_0xa4a5('0x57'),_0xa4a5('0x54'),_0xa4a5('0x66'),_0xa4a5('0x58'),_0xa4a5('0x59'),'defaultLoginLogo',_0xa4a5('0x5a'),_0xa4a5('0x5b')],'raw':!![]});})[_0xa4a5('0x17')](handleEntityNotFound(_0x2eb2aa,null))['then'](function(_0x24b092){if(_0x24b092){var _0x9a220f=_0x24b092[_0xa4a5('0x54')]&&fs['existsSync'](path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0x2e0afb,_[_0xa4a5('0x5e')](_0x24b092[_0xa4a5('0x54')])))?path['join'](config[_0xa4a5('0x5d')],_0x2e0afb,_[_0xa4a5('0x5e')](_0x24b092[_0xa4a5('0x54')])):path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0x2e0afb,_[_0xa4a5('0x5e')](_0xa4a5('0x67')));var _0x297006=_0xa4a5('0x68')+_['upperFirst']('loginLogo');if(_0x24b092[_0x297006]||!_0x5b4fd9['custom']){_0x9a220f=path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0x2e0afb,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xa4a5('0x69')](_0x9a220f)){throw new db[(_0xa4a5('0x6a'))][(_0xa4a5('0x6b'))](_['upperFirst']('loginLogo')+_0xa4a5('0x62'));}return _0x2eb2aa[_0xa4a5('0x63')](_0x9a220f);}})[_0xa4a5('0x21')](handleError(_0x2eb2aa,null));};exports[_0xa4a5('0x6c')]=function(_0x212480,_0x8551c){return db['Setting'][_0xa4a5('0x4c')]({'where':{'id':_0x212480[_0xa4a5('0x52')]['id']},'attributes':['securePassword']})[_0xa4a5('0x17')](respondWithResult(_0x8551c,null))['catch'](handleError(_0x8551c,null));};exports[_0xa4a5('0x6d')]=function(_0x1f454e,_0x14a9cd,_0x213db7){if(_0x1f454e[_0xa4a5('0x50')]&&_0x1f454e[_0xa4a5('0x50')][_0xa4a5('0x51')]){_0x1f454e[_0xa4a5('0x4e')][_0xa4a5('0x66')]=_0x1f454e['file']['filename'];}return db[_0xa4a5('0x31')][_0xa4a5('0x4c')]({'where':{'id':_0x1f454e['params']['id']}})[_0xa4a5('0x17')](handleEntityNotFound(_0x14a9cd,null))[_0xa4a5('0x17')](saveUpdates(_0x1f454e['body'],null))[_0xa4a5('0x17')](respondWithResult(_0x14a9cd,null))[_0xa4a5('0x21')](handleError(_0x14a9cd,null));};var utilLicense=require(_0xa4a5('0x55'));exports[_0xa4a5('0x6e')]=function(_0x1ab453,_0x57899a,_0x3dd058){var _0xcc699a=_0xa4a5('0x65');var _0x3e3dbe={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x115ff3){if(_0x115ff3){_0x3e3dbe=_0x115ff3;}return db[_0xa4a5('0x31')][_0xa4a5('0x4c')]({'where':{'id':_0x1ab453['params']['id']},'attributes':[_0xa4a5('0x57'),_0xa4a5('0x54'),_0xa4a5('0x66'),_0xa4a5('0x58'),_0xa4a5('0x59'),_0xa4a5('0x6f'),_0xa4a5('0x5a'),'defaultFavicon'],'raw':!![]});})[_0xa4a5('0x17')](handleEntityNotFound(_0x57899a,null))[_0xa4a5('0x17')](function(_0x228ba9){if(_0x228ba9){var _0x29a5f9=_0x228ba9[_0xa4a5('0x66')]&&fs[_0xa4a5('0x69')](path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0xcc699a,_[_0xa4a5('0x5e')](_0x228ba9[_0xa4a5('0x66')])))?path['join'](config['root'],_0xcc699a,_[_0xa4a5('0x5e')](_0x228ba9[_0xa4a5('0x66')])):path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0xcc699a,_[_0xa4a5('0x5e')](_0xa4a5('0x70')));var _0xeb1cb9='default'+_[_0xa4a5('0x60')]('preferred');if(_0x228ba9[_0xeb1cb9]||!_0x3e3dbe['custom']||!_0x3e3dbe[_0xa4a5('0x66')]){_0x29a5f9=path[_0xa4a5('0x5c')](config['root'],_0xcc699a,_['toLower'](_0xa4a5('0x70')));}if(!fs[_0xa4a5('0x69')](_0x29a5f9)){throw new db[(_0xa4a5('0x6a'))][(_0xa4a5('0x6b'))](_[_0xa4a5('0x60')]('preferred')+_0xa4a5('0x62'));}return _0x57899a[_0xa4a5('0x63')](_0x29a5f9);}})[_0xa4a5('0x21')](handleError(_0x57899a,null));};exports[_0xa4a5('0x71')]=function(_0x3ca0d1,_0x1c4619,_0xe3aa1b){if(_0x3ca0d1[_0xa4a5('0x50')]&&_0x3ca0d1[_0xa4a5('0x50')][_0xa4a5('0x51')]){_0x3ca0d1['body'][_0xa4a5('0x58')]=_0x3ca0d1['file'][_0xa4a5('0x51')];}return db[_0xa4a5('0x31')][_0xa4a5('0x4c')]({'where':{'id':_0x3ca0d1[_0xa4a5('0x52')]['id']}})[_0xa4a5('0x17')](handleEntityNotFound(_0x1c4619,null))['then'](saveUpdates(_0x3ca0d1['body'],null))[_0xa4a5('0x17')](respondWithResult(_0x1c4619,null))['catch'](handleError(_0x1c4619,null));};var utilLicense=require(_0xa4a5('0x55'));exports[_0xa4a5('0x72')]=function(_0x5b059c,_0x30387c,_0x21c7ce){var _0x3bb499='server/files/images/logos';var _0x19245c={'custom':![]};return utilLicense[_0xa4a5('0x56')]()[_0xa4a5('0x17')](function(_0x2f3c83){if(_0x2f3c83){_0x19245c=_0x2f3c83;}return db['Setting'][_0xa4a5('0x4c')]({'where':{'id':_0x5b059c[_0xa4a5('0x52')]['id']},'attributes':[_0xa4a5('0x57'),'loginLogo',_0xa4a5('0x66'),_0xa4a5('0x58'),'defaultLogo',_0xa4a5('0x6f'),'defaultPreferred',_0xa4a5('0x5b')],'raw':!![]});})[_0xa4a5('0x17')](handleEntityNotFound(_0x30387c,null))[_0xa4a5('0x17')](function(_0x8821f6){if(_0x8821f6){var _0x1e1bbd=_0x8821f6[_0xa4a5('0x58')]&&fs[_0xa4a5('0x69')](path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0x3bb499,_[_0xa4a5('0x5e')](_0x8821f6[_0xa4a5('0x58')])))?path['join'](config[_0xa4a5('0x5d')],_0x3bb499,_['toLower'](_0x8821f6[_0xa4a5('0x58')])):path['join'](config['root'],_0x3bb499,_[_0xa4a5('0x5e')](_0xa4a5('0x73')));var _0x1ffa83=_0xa4a5('0x68')+_[_0xa4a5('0x60')]('favicon');if(_0x8821f6[_0x1ffa83]||!_0x19245c[_0xa4a5('0x61')]){_0x1e1bbd=path[_0xa4a5('0x5c')](config[_0xa4a5('0x5d')],_0x3bb499,_[_0xa4a5('0x5e')]('default_favicon.ico'));}if(!fs[_0xa4a5('0x69')](_0x1e1bbd)){throw new db[(_0xa4a5('0x6a'))]['ValidationError'](_['upperFirst'](_0xa4a5('0x58'))+'\x20not\x20found');}return _0x30387c[_0xa4a5('0x63')](_0x1e1bbd);}})[_0xa4a5('0x21')](handleError(_0x30387c,null));};exports[_0xa4a5('0x74')]=function(_0x5183e1,_0x3ea880){var _0x4bea40={'offset':moment()[_0xa4a5('0x75')]()};_0x4bea40[_0xa4a5('0x76')]=moment()[_0xa4a5('0x75')](_0x4bea40[_0xa4a5('0x28')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x3ea880[_0xa4a5('0x23')](0xc8)[_0xa4a5('0x77')](_0x4bea40);}; \ No newline at end of file +var _0xd29c=['stack','name','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','params','body','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','Sequelize','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end'];(function(_0x52ed4a,_0x593b9a){var _0x129392=function(_0x5b1fe9){while(--_0x5b1fe9){_0x52ed4a['push'](_0x52ed4a['shift']());}};_0x129392(++_0x593b9a);}(_0xd29c,0xc9));var _0xcd29=function(_0x535029,_0x13c8e2){_0x535029=_0x535029-0x0;var _0x594f33=_0xd29c[_0x535029];return _0x594f33;};'use strict';var emlformat=require(_0xcd29('0x0'));var rimraf=require(_0xcd29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd29('0x2'));var rp=require(_0xcd29('0x3'));var moment=require(_0xcd29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd29('0x5'));var util=require(_0xcd29('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcd29('0x7'));var ejs=require(_0xcd29('0x8'));var fs=require('fs');var fs_extra=require(_0xcd29('0x9'));var _=require(_0xcd29('0xa'));var squel=require(_0xcd29('0xb'));var crypto=require(_0xcd29('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcd29('0xd'));var toCsv=require(_0xcd29('0x7'));var querystring=require(_0xcd29('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd29('0xf'));var authService=require(_0xcd29('0x10'));var qs=require(_0xcd29('0x11'));var as=require(_0xcd29('0x12'));var hardwareService=require(_0xcd29('0x13'));var logger=require('../../config/logger')(_0xcd29('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd29('0x15'))['db'];var jayson=require(_0xcd29('0x16'));var client=jayson['client'][_0xcd29('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5295fa,_0x2821df,_0x14050f,_0x220f50){return new BPromise(function(_0x22fa17,_0x44f8ee){var _0x31e0e9=_0x220f50||client;return _0x31e0e9[_0xcd29('0x18')](_0x5295fa,_0x14050f)[_0xcd29('0x19')](function(_0x1dcde7){logger[_0xcd29('0x1a')](_0xcd29('0x1b'),_0x2821df,'request\x20sent');logger[_0xcd29('0x1c')](_0xcd29('0x1d'),_0x2821df,_0xcd29('0x1e'),JSON[_0xcd29('0x1f')](_0x1dcde7));if(_0x1dcde7[_0xcd29('0x20')]){if(_0x1dcde7[_0xcd29('0x20')][_0xcd29('0x21')]===0x1f4){logger[_0xcd29('0x20')]('Setting,\x20%s,\x20%s',_0x2821df,_0x1dcde7[_0xcd29('0x20')][_0xcd29('0x22')]);return _0x44f8ee(_0x1dcde7[_0xcd29('0x20')][_0xcd29('0x22')]);}logger[_0xcd29('0x20')](_0xcd29('0x1b'),_0x2821df,_0x1dcde7['error'][_0xcd29('0x22')]);return _0x22fa17(_0x1dcde7['error'][_0xcd29('0x22')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x2821df,'request\x20sent');_0x22fa17(_0x1dcde7[_0xcd29('0x23')][_0xcd29('0x22')]);}})[_0xcd29('0x24')](function(_0x31b7fb){logger['error'](_0xcd29('0x1b'),_0x2821df,_0x31b7fb);_0x44f8ee(_0x31b7fb);});});}function respondWithStatusCode(_0x4a911e,_0x3397e1){_0x3397e1=_0x3397e1||0xcc;return function(_0x250ffd){if(_0x250ffd){return _0x4a911e[_0xcd29('0x25')](_0x3397e1);}return _0x4a911e[_0xcd29('0x26')](_0x3397e1)['end']();};}function respondWithResult(_0x222ac4,_0x54b2e1){_0x54b2e1=_0x54b2e1||0xc8;return function(_0x5c9fd6){if(_0x5c9fd6){return _0x222ac4[_0xcd29('0x26')](_0x54b2e1)[_0xcd29('0x27')](_0x5c9fd6);}};}function respondWithFilteredResult(_0x37b244,_0x1869b8){return function(_0x3c2a93){if(_0x3c2a93){var _0x2bb56a=typeof _0x1869b8[_0xcd29('0x28')]===_0xcd29('0x29')&&typeof _0x1869b8[_0xcd29('0x2a')]===_0xcd29('0x29');var _0x31ac6b=_0x3c2a93[_0xcd29('0x2b')];var _0x5e4269=_0x2bb56a?0x0:_0x1869b8['offset'];var _0x1117c4=_0x2bb56a?_0x3c2a93[_0xcd29('0x2b')]:_0x1869b8[_0xcd29('0x28')]+_0x1869b8[_0xcd29('0x2a')];var _0x4f7f98;if(_0x1117c4>=_0x31ac6b){_0x1117c4=_0x31ac6b;_0x4f7f98=0xc8;}else{_0x4f7f98=0xce;}_0x37b244['status'](_0x4f7f98);return _0x37b244[_0xcd29('0x2c')](_0xcd29('0x2d'),_0x5e4269+'-'+_0x1117c4+'/'+_0x31ac6b)[_0xcd29('0x27')](_0x3c2a93);}return null;};}function patchUpdates(_0x4f9d74){return function(_0x12e77f){try{jsonpatch[_0xcd29('0x2e')](_0x12e77f,_0x4f9d74,!![]);}catch(_0x5b4c37){return BPromise['reject'](_0x5b4c37);}return _0x12e77f[_0xcd29('0x2f')]();};}function saveUpdates(_0x36378b,_0x1d9ce8){return function(_0x5956e1){if(_0x5956e1){return _0x5956e1[_0xcd29('0x30')](_0x36378b)['then'](function(_0x5769c7){return _0x5769c7;});}return null;};}function removeEntity(_0x264fb7,_0x4b051d){return function(_0x17164f){if(_0x17164f){return _0x17164f[_0xcd29('0x31')]()['then'](function(){_0x264fb7[_0xcd29('0x26')](0xcc)[_0xcd29('0x32')]();});}};}function handleEntityNotFound(_0x1efea5,_0xac6a40){return function(_0x237a05){if(!_0x237a05){_0x1efea5['sendStatus'](0x194);}return _0x237a05;};}function handleError(_0x57ea45,_0x5a6f3c){_0x5a6f3c=_0x5a6f3c||0x1f4;return function(_0x2db2d0){logger[_0xcd29('0x20')](_0x2db2d0[_0xcd29('0x33')]);if(_0x2db2d0[_0xcd29('0x34')]){delete _0x2db2d0['name'];}_0x57ea45['status'](_0x5a6f3c)['send'](_0x2db2d0);};}exports[_0xcd29('0x35')]=function(_0x1be197,_0x5857a9){var _0x19b4bd={},_0x1e2405={},_0x590db5={'count':0x0,'rows':[]};var _0x52faf7=_[_0xcd29('0x36')](db[_0xcd29('0x37')][_0xcd29('0x38')],function(_0x548bb8){return{'name':_0x548bb8[_0xcd29('0x39')],'type':_0x548bb8[_0xcd29('0x3a')][_0xcd29('0x3b')]};});_0x1e2405[_0xcd29('0x3c')]=_[_0xcd29('0x36')](_0x52faf7,_0xcd29('0x34'));_0x1e2405[_0xcd29('0x3d')]=_[_0xcd29('0x3e')](_0x1be197[_0xcd29('0x3d')]);_0x1e2405[_0xcd29('0x3f')]=_[_0xcd29('0x40')](_0x1e2405[_0xcd29('0x3c')],_0x1e2405[_0xcd29('0x3d')]);_0x19b4bd[_0xcd29('0x41')]=_['intersection'](_0x1e2405['model'],qs[_0xcd29('0x42')](_0x1be197[_0xcd29('0x3d')][_0xcd29('0x42')]));_0x19b4bd[_0xcd29('0x41')]=_0x19b4bd['attributes'][_0xcd29('0x43')]?_0x19b4bd[_0xcd29('0x41')]:_0x1e2405[_0xcd29('0x3c')];if(!_0x1be197[_0xcd29('0x3d')][_0xcd29('0x44')](_0xcd29('0x45'))){_0x19b4bd[_0xcd29('0x2a')]=qs[_0xcd29('0x2a')](_0x1be197[_0xcd29('0x3d')][_0xcd29('0x2a')]);_0x19b4bd['offset']=qs[_0xcd29('0x28')](_0x1be197[_0xcd29('0x3d')][_0xcd29('0x28')]);}_0x19b4bd[_0xcd29('0x46')]=qs[_0xcd29('0x47')](_0x1be197['query'][_0xcd29('0x47')]);_0x19b4bd[_0xcd29('0x48')]=qs['filters'](_['pick'](_0x1be197[_0xcd29('0x3d')],_0x1e2405['filters']),_0x52faf7);if(_0x1be197[_0xcd29('0x3d')][_0xcd29('0x49')]){_0x19b4bd['where']=_['merge'](_0x19b4bd[_0xcd29('0x48')],{'$or':_[_0xcd29('0x36')](_0x52faf7,function(_0x12b1b9){if(_0x12b1b9[_0xcd29('0x3a')]!==_0xcd29('0x4a')){var _0x545c3c={};_0x545c3c[_0x12b1b9[_0xcd29('0x34')]]={'$like':'%'+_0x1be197['query']['filter']+'%'};return _0x545c3c;}})});}_0x19b4bd=_[_0xcd29('0x4b')]({},_0x19b4bd,_0x1be197[_0xcd29('0x4c')]);var _0x55b2ab={'where':_0x19b4bd[_0xcd29('0x48')]};return db[_0xcd29('0x37')][_0xcd29('0x2b')](_0x55b2ab)[_0xcd29('0x19')](function(_0x46a8cc){_0x590db5[_0xcd29('0x2b')]=_0x46a8cc;if(_0x1be197[_0xcd29('0x3d')][_0xcd29('0x4d')]){_0x19b4bd[_0xcd29('0x4e')]=[{'all':!![]}];}return db[_0xcd29('0x37')][_0xcd29('0x4f')](_0x19b4bd);})['then'](function(_0x2524fd){_0x590db5[_0xcd29('0x50')]=_0x2524fd;return _0x590db5;})['then'](respondWithFilteredResult(_0x5857a9,_0x19b4bd))['catch'](handleError(_0x5857a9,null));};exports[_0xcd29('0x51')]=function(_0x54b516,_0x21ee59){var _0x32dd09={'raw':![],'where':{'id':_0x54b516['params']['id']}},_0x45bc4d={};_0x45bc4d[_0xcd29('0x3c')]=_[_0xcd29('0x3e')](db[_0xcd29('0x37')][_0xcd29('0x38')]);_0x45bc4d[_0xcd29('0x3d')]=_[_0xcd29('0x3e')](_0x54b516[_0xcd29('0x3d')]);_0x45bc4d['filters']=_['intersection'](_0x45bc4d['model'],_0x45bc4d[_0xcd29('0x3d')]);_0x32dd09[_0xcd29('0x41')]=_[_0xcd29('0x40')](_0x45bc4d[_0xcd29('0x3c')],qs[_0xcd29('0x42')](_0x54b516[_0xcd29('0x3d')][_0xcd29('0x42')]));_0x32dd09[_0xcd29('0x41')]=_0x32dd09[_0xcd29('0x41')][_0xcd29('0x43')]?_0x32dd09['attributes']:_0x45bc4d[_0xcd29('0x3c')];if(_0x54b516[_0xcd29('0x3d')][_0xcd29('0x4d')]){_0x32dd09[_0xcd29('0x4e')]=[{'all':!![]}];}_0x32dd09=_['merge']({},_0x32dd09,_0x54b516[_0xcd29('0x4c')]);return db[_0xcd29('0x37')][_0xcd29('0x52')](_0x32dd09)[_0xcd29('0x19')](handleEntityNotFound(_0x21ee59,null))['then'](respondWithResult(_0x21ee59,null))[_0xcd29('0x24')](handleError(_0x21ee59,null));};exports[_0xcd29('0x30')]=function(_0x431dae,_0x15e1e3){if(_0x431dae['body']['id']){delete _0x431dae['body']['id'];}return db['Setting'][_0xcd29('0x52')]({'where':{'id':_0x431dae[_0xcd29('0x53')]['id']}})[_0xcd29('0x19')](handleEntityNotFound(_0x15e1e3,null))['then'](saveUpdates(_0x431dae[_0xcd29('0x54')],null))[_0xcd29('0x19')](respondWithResult(_0x15e1e3,null))[_0xcd29('0x24')](handleError(_0x15e1e3,null));};exports['addLogo']=function(_0x5828e1,_0x3c285d,_0x109198){if(_0x5828e1[_0xcd29('0x55')]&&_0x5828e1['file'][_0xcd29('0x56')]){_0x5828e1['body'][_0xcd29('0x57')]=_0x5828e1['file']['filename'];}return db[_0xcd29('0x37')][_0xcd29('0x52')]({'where':{'id':_0x5828e1[_0xcd29('0x53')]['id']}})[_0xcd29('0x19')](handleEntityNotFound(_0x3c285d,null))[_0xcd29('0x19')](saveUpdates(_0x5828e1[_0xcd29('0x54')],null))['then'](respondWithResult(_0x3c285d,null))[_0xcd29('0x24')](handleError(_0x3c285d,null));};exports[_0xcd29('0x58')]=function(_0x6fafaa,_0x4b2846,_0x1496c7){if(_0x6fafaa[_0xcd29('0x55')]&&_0x6fafaa['file'][_0xcd29('0x56')]){_0x6fafaa[_0xcd29('0x54')][_0xcd29('0x59')]=_0x6fafaa[_0xcd29('0x55')][_0xcd29('0x56')];}return db[_0xcd29('0x37')][_0xcd29('0x52')]({'where':{'id':_0x6fafaa['params']['id']}})[_0xcd29('0x19')](handleEntityNotFound(_0x4b2846,null))['then'](saveUpdates(_0x6fafaa[_0xcd29('0x54')],null))[_0xcd29('0x19')](respondWithResult(_0x4b2846,null))[_0xcd29('0x24')](handleError(_0x4b2846,null));};var utilLicense=require(_0xcd29('0x5a'));exports[_0xcd29('0x5b')]=function(_0x3ada50,_0x4e80cb,_0x142c61){var _0x15e745='server/files/images/logos';var _0x41d9ab={'custom':![]};return utilLicense[_0xcd29('0x5c')]()[_0xcd29('0x19')](function(_0x3a40cc){if(_0x3a40cc){_0x41d9ab=_0x3a40cc;}return db[_0xcd29('0x37')][_0xcd29('0x52')]({'where':{'id':_0x3ada50[_0xcd29('0x53')]['id']},'attributes':[_0xcd29('0x57'),_0xcd29('0x59'),_0xcd29('0x5d'),_0xcd29('0x5e'),_0xcd29('0x5f'),_0xcd29('0x60'),_0xcd29('0x61'),_0xcd29('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x4e80cb,null))[_0xcd29('0x19')](function(_0x5e3bc6){if(_0x5e3bc6){var _0x3a27bc=_0x5e3bc6[_0xcd29('0x57')]&&fs[_0xcd29('0x63')](path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x15e745,_[_0xcd29('0x66')](_0x5e3bc6[_0xcd29('0x57')])))?path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x15e745,_[_0xcd29('0x66')](_0x5e3bc6[_0xcd29('0x57')])):path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x15e745,_['toLower'](_0xcd29('0x67')));var _0x197be1=_0xcd29('0x68')+_[_0xcd29('0x69')](_0xcd29('0x57'));if(_0x5e3bc6[_0x197be1]||!_0x41d9ab[_0xcd29('0x6a')]){_0x3a27bc=path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x15e745,_['toLower'](_0xcd29('0x67')));}if(!fs[_0xcd29('0x63')](_0x3a27bc)){throw new db['Sequelize']['ValidationError'](_[_0xcd29('0x69')](_0xcd29('0x57'))+_0xcd29('0x6b'));}return _0x4e80cb[_0xcd29('0x6c')](_0x3a27bc);}})[_0xcd29('0x24')](handleError(_0x4e80cb,null));};var utilLicense=require(_0xcd29('0x5a'));exports[_0xcd29('0x6d')]=function(_0x503054,_0x2d47bb,_0x3ce288){var _0x36a64f=_0xcd29('0x6e');var _0x419d75={'custom':![]};return utilLicense['getLicense']()[_0xcd29('0x19')](function(_0x2e81d7){if(_0x2e81d7){_0x419d75=_0x2e81d7;}return db['Setting'][_0xcd29('0x52')]({'where':{'id':_0x503054['params']['id']},'attributes':['logo',_0xcd29('0x59'),_0xcd29('0x5d'),_0xcd29('0x5e'),'defaultLogo',_0xcd29('0x60'),_0xcd29('0x61'),_0xcd29('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x2d47bb,null))[_0xcd29('0x19')](function(_0x3586a7){if(_0x3586a7){var _0x306b53=_0x3586a7['loginLogo']&&fs['existsSync'](path[_0xcd29('0x64')](config['root'],_0x36a64f,_[_0xcd29('0x66')](_0x3586a7[_0xcd29('0x59')])))?path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x36a64f,_['toLower'](_0x3586a7['loginLogo'])):path[_0xcd29('0x64')](config['root'],_0x36a64f,_[_0xcd29('0x66')](_0xcd29('0x6f')));var _0x1e5d8a=_0xcd29('0x68')+_[_0xcd29('0x69')](_0xcd29('0x59'));if(_0x3586a7[_0x1e5d8a]||!_0x419d75[_0xcd29('0x6a')]){_0x306b53=path['join'](config[_0xcd29('0x65')],_0x36a64f,_[_0xcd29('0x66')](_0xcd29('0x6f')));}if(!fs[_0xcd29('0x63')](_0x306b53)){throw new db[(_0xcd29('0x70'))][(_0xcd29('0x71'))](_['upperFirst']('loginLogo')+_0xcd29('0x6b'));}return _0x2d47bb[_0xcd29('0x6c')](_0x306b53);}})[_0xcd29('0x24')](handleError(_0x2d47bb,null));};exports[_0xcd29('0x72')]=function(_0x3fe9d1,_0x4e8252){return db[_0xcd29('0x37')][_0xcd29('0x52')]({'where':{'id':_0x3fe9d1[_0xcd29('0x53')]['id']},'attributes':[_0xcd29('0x73')]})['then'](respondWithResult(_0x4e8252,null))['catch'](handleError(_0x4e8252,null));};exports[_0xcd29('0x74')]=function(_0x2bbc77,_0x3bdeb0,_0x448c64){if(_0x2bbc77['file']&&_0x2bbc77['file'][_0xcd29('0x56')]){_0x2bbc77[_0xcd29('0x54')][_0xcd29('0x5d')]=_0x2bbc77[_0xcd29('0x55')][_0xcd29('0x56')];}return db[_0xcd29('0x37')]['find']({'where':{'id':_0x2bbc77['params']['id']}})[_0xcd29('0x19')](handleEntityNotFound(_0x3bdeb0,null))[_0xcd29('0x19')](saveUpdates(_0x2bbc77[_0xcd29('0x54')],null))[_0xcd29('0x19')](respondWithResult(_0x3bdeb0,null))[_0xcd29('0x24')](handleError(_0x3bdeb0,null));};var utilLicense=require('../../config/license/util');exports[_0xcd29('0x75')]=function(_0x4a3901,_0x3e4aba,_0x2a5370){var _0x38fef5=_0xcd29('0x6e');var _0xe85e1b={'custom':![]};return utilLicense[_0xcd29('0x5c')]()[_0xcd29('0x19')](function(_0x2aff34){if(_0x2aff34){_0xe85e1b=_0x2aff34;}return db[_0xcd29('0x37')][_0xcd29('0x52')]({'where':{'id':_0x4a3901[_0xcd29('0x53')]['id']},'attributes':[_0xcd29('0x57'),'loginLogo',_0xcd29('0x5d'),_0xcd29('0x5e'),_0xcd29('0x5f'),_0xcd29('0x60'),'defaultPreferred',_0xcd29('0x62')],'raw':!![]});})[_0xcd29('0x19')](handleEntityNotFound(_0x3e4aba,null))[_0xcd29('0x19')](function(_0x1cdc78){if(_0x1cdc78){var _0x1ae20d=_0x1cdc78[_0xcd29('0x5d')]&&fs[_0xcd29('0x63')](path['join'](config['root'],_0x38fef5,_[_0xcd29('0x66')](_0x1cdc78[_0xcd29('0x5d')])))?path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x38fef5,_[_0xcd29('0x66')](_0x1cdc78[_0xcd29('0x5d')])):path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x38fef5,_[_0xcd29('0x66')]('default_preferred.png'));var _0x28df49=_0xcd29('0x68')+_['upperFirst'](_0xcd29('0x5d'));if(_0x1cdc78[_0x28df49]||!_0xe85e1b['custom']||!_0xe85e1b['preferred']){_0x1ae20d=path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x38fef5,_[_0xcd29('0x66')](_0xcd29('0x76')));}if(!fs[_0xcd29('0x63')](_0x1ae20d)){throw new db[(_0xcd29('0x70'))]['ValidationError'](_[_0xcd29('0x69')](_0xcd29('0x5d'))+_0xcd29('0x6b'));}return _0x3e4aba[_0xcd29('0x6c')](_0x1ae20d);}})[_0xcd29('0x24')](handleError(_0x3e4aba,null));};exports['addFavicon']=function(_0x446d44,_0x44ca5f,_0x56890c){if(_0x446d44[_0xcd29('0x55')]&&_0x446d44[_0xcd29('0x55')][_0xcd29('0x56')]){_0x446d44[_0xcd29('0x54')][_0xcd29('0x5e')]=_0x446d44[_0xcd29('0x55')][_0xcd29('0x56')];}return db['Setting']['find']({'where':{'id':_0x446d44[_0xcd29('0x53')]['id']}})[_0xcd29('0x19')](handleEntityNotFound(_0x44ca5f,null))[_0xcd29('0x19')](saveUpdates(_0x446d44[_0xcd29('0x54')],null))[_0xcd29('0x19')](respondWithResult(_0x44ca5f,null))[_0xcd29('0x24')](handleError(_0x44ca5f,null));};var utilLicense=require(_0xcd29('0x5a'));exports[_0xcd29('0x77')]=function(_0x2c91ff,_0x522eed,_0x566077){var _0x36a884=_0xcd29('0x6e');var _0x1a7efd={'custom':![]};return utilLicense[_0xcd29('0x5c')]()['then'](function(_0x16fb8c){if(_0x16fb8c){_0x1a7efd=_0x16fb8c;}return db[_0xcd29('0x37')]['find']({'where':{'id':_0x2c91ff['params']['id']},'attributes':[_0xcd29('0x57'),_0xcd29('0x59'),_0xcd29('0x5d'),'favicon',_0xcd29('0x5f'),_0xcd29('0x60'),_0xcd29('0x61'),_0xcd29('0x62')],'raw':!![]});})[_0xcd29('0x19')](handleEntityNotFound(_0x522eed,null))[_0xcd29('0x19')](function(_0x111f64){if(_0x111f64){var _0x28ce6d=_0x111f64[_0xcd29('0x5e')]&&fs[_0xcd29('0x63')](path[_0xcd29('0x64')](config['root'],_0x36a884,_[_0xcd29('0x66')](_0x111f64[_0xcd29('0x5e')])))?path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x36a884,_[_0xcd29('0x66')](_0x111f64['favicon'])):path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x36a884,_['toLower'](_0xcd29('0x78')));var _0x4ee4c0=_0xcd29('0x68')+_[_0xcd29('0x69')]('favicon');if(_0x111f64[_0x4ee4c0]||!_0x1a7efd[_0xcd29('0x6a')]){_0x28ce6d=path[_0xcd29('0x64')](config[_0xcd29('0x65')],_0x36a884,_['toLower'](_0xcd29('0x78')));}if(!fs[_0xcd29('0x63')](_0x28ce6d)){throw new db[(_0xcd29('0x70'))][(_0xcd29('0x71'))](_['upperFirst'](_0xcd29('0x5e'))+_0xcd29('0x6b'));}return _0x522eed[_0xcd29('0x6c')](_0x28ce6d);}})[_0xcd29('0x24')](handleError(_0x522eed,null));};exports[_0xcd29('0x79')]=function(_0x448ca3,_0x1d3908){var _0xa52427={'offset':moment()[_0xcd29('0x7a')]()};_0xa52427[_0xcd29('0x7b')]=moment()[_0xcd29('0x7a')](_0xa52427[_0xcd29('0x28')])[_0xcd29('0x7c')](_0xcd29('0x7d'));return _0x1d3908[_0xcd29('0x26')](0xc8)['send'](_0xa52427);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6941f8b..c129da6 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x4397c3,_0x58fff0){var _0x5e73f8=function(_0x45ef37){while(--_0x45ef37){_0x4397c3['push'](_0x4397c3['shift']());}};_0x5e73f8(++_0x58fff0);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a694e,_0x3e4264){_0x4a694e=_0x4a694e-0x0;var _0x23b0ab=_0xedd9[_0x4a694e];return _0x23b0ab;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x008c,0x188));var _0xc008=function(_0x41ecfc,_0x54f670){_0x41ecfc=_0x41ecfc-0x0;var _0x4cdc47=_0x008c[_0x41ecfc];return _0x4cdc47;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3337f67..2a2550e 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 _0x064e=['http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','options','raw','attributes','include','map','model','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x064e,0x1d6));var _0xe064=function(_0x3ce2d4,_0x13a7cd){_0x3ce2d4=_0x3ce2d4-0x0;var _0x3de4b9=_0x064e[_0x3ce2d4];return _0x3de4b9;};'use strict';var _=require(_0xe064('0x0'));var util=require(_0xe064('0x1'));var moment=require(_0xe064('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe064('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe064('0x4'));var logger=require(_0xe064('0x5'))(_0xe064('0x6'));var config=require(_0xe064('0x7'));var jayson=require(_0xe064('0x8'));var client=jayson[_0xe064('0x9')][_0xe064('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x344c1e,_0x4bd5d6,_0x362557){return new BPromise(function(_0x5d7e25,_0x5f2f22){return client[_0xe064('0xb')](_0x344c1e,_0x362557)[_0xe064('0xc')](function(_0x4254d8){logger[_0xe064('0xd')](_0xe064('0xe'),_0x4bd5d6,'request\x20sent');logger[_0xe064('0xf')](_0xe064('0x10'),_0x4bd5d6,_0xe064('0x11'),JSON[_0xe064('0x12')](_0x4254d8));if(_0x4254d8[_0xe064('0x13')]){if(_0x4254d8[_0xe064('0x13')][_0xe064('0x14')]===0x1f4){logger[_0xe064('0x13')](_0xe064('0xe'),_0x4bd5d6,_0x4254d8['error'][_0xe064('0x15')]);return _0x5f2f22(_0x4254d8[_0xe064('0x13')][_0xe064('0x15')]);}logger['error'](_0xe064('0xe'),_0x4bd5d6,_0x4254d8['error']['message']);return _0x5d7e25(_0x4254d8[_0xe064('0x13')][_0xe064('0x15')]);}else{logger['info'](_0xe064('0xe'),_0x4bd5d6,_0xe064('0x11'));_0x5d7e25(_0x4254d8[_0xe064('0x16')]['message']);}})[_0xe064('0x17')](function(_0x3bd087){logger[_0xe064('0x13')](_0xe064('0xe'),_0x4bd5d6,_0x3bd087);_0x5f2f22(_0x3bd087);});});}exports[_0xe064('0x18')]=function(_0x416d0c){var _0x2d84ef=this;return new Promise(function(_0x2ba09a,_0x1f37c2){return db[_0xe064('0x19')]['find']({'raw':_0x416d0c[_0xe064('0x1a')]?_0x416d0c[_0xe064('0x1a')][_0xe064('0x1b')]===undefined?!![]:![]:!![],'where':_0x416d0c[_0xe064('0x1a')]?_0x416d0c['options']['where']||null:null,'attributes':_0x416d0c['options']?_0x416d0c['options'][_0xe064('0x1c')]||null:null,'include':_0x416d0c['options']?_0x416d0c[_0xe064('0x1a')][_0xe064('0x1d')]?_[_0xe064('0x1e')](_0x416d0c[_0xe064('0x1a')][_0xe064('0x1d')],function(_0x41f984){return{'model':db[_0x41f984[_0xe064('0x1f')]],'as':_0x41f984['as'],'attributes':_0x41f984['attributes'],'include':_0x41f984[_0xe064('0x1d')]?_[_0xe064('0x1e')](_0x41f984[_0xe064('0x1d')],function(_0x39d9ad){return{'model':db[_0x39d9ad[_0xe064('0x1f')]],'as':_0x39d9ad['as'],'attributes':_0x39d9ad[_0xe064('0x1c')],'include':_0x39d9ad[_0xe064('0x1d')]?_[_0xe064('0x1e')](_0x39d9ad[_0xe064('0x1d')],function(_0xd55bdc){return{'model':db[_0xd55bdc[_0xe064('0x1f')]],'as':_0xd55bdc['as'],'attributes':_0xd55bdc['attributes']};}):[]};}):[]};}):[]:[]})[_0xe064('0xc')](function(_0x293fdf){logger[_0xe064('0xd')]('ShowSetting',_0x416d0c);logger['debug'](_0xe064('0x18'),_0x416d0c,JSON[_0xe064('0x12')](_0x293fdf));_0x2ba09a(_0x293fdf);})[_0xe064('0x17')](function(_0x4d2b6d){logger[_0xe064('0x13')]('ShowSetting',_0x4d2b6d[_0xe064('0x15')],_0x416d0c);_0x1f37c2(_0x2d84ef[_0xe064('0x13')](0x1f4,_0x4d2b6d[_0xe064('0x15')]));});});}; \ No newline at end of file +var _0x44c5=['request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','catch','ShowSetting','Setting','find','options','where','attributes','include','map','model','stringify','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x15c654,_0x271c93){var _0x5abb00=function(_0x4eef75){while(--_0x4eef75){_0x15c654['push'](_0x15c654['shift']());}};_0x5abb00(++_0x271c93);}(_0x44c5,0x16a));var _0x544c=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x44c5[_0x2a0350];return _0x425220;};'use strict';var _=require(_0x544c('0x0'));var util=require('util');var moment=require(_0x544c('0x1'));var BPromise=require(_0x544c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x544c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x544c('0x4'));var logger=require('../../config/logger')(_0x544c('0x5'));var config=require(_0x544c('0x6'));var jayson=require(_0x544c('0x7'));var client=jayson[_0x544c('0x8')][_0x544c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x207ecd,_0x3dc249,_0x54ddae){return new BPromise(function(_0xbac64c,_0x31490c){return client[_0x544c('0xa')](_0x207ecd,_0x54ddae)[_0x544c('0xb')](function(_0x3491c1){logger['info']('Setting,\x20%s,\x20%s',_0x3dc249,_0x544c('0xc'));logger[_0x544c('0xd')](_0x544c('0xe'),_0x3dc249,_0x544c('0xc'),JSON['stringify'](_0x3491c1));if(_0x3491c1[_0x544c('0xf')]){if(_0x3491c1[_0x544c('0xf')][_0x544c('0x10')]===0x1f4){logger['error'](_0x544c('0x11'),_0x3dc249,_0x3491c1[_0x544c('0xf')]['message']);return _0x31490c(_0x3491c1['error'][_0x544c('0x12')]);}logger[_0x544c('0xf')](_0x544c('0x11'),_0x3dc249,_0x3491c1[_0x544c('0xf')][_0x544c('0x12')]);return _0xbac64c(_0x3491c1['error'][_0x544c('0x12')]);}else{logger[_0x544c('0x13')](_0x544c('0x11'),_0x3dc249,'request\x20sent');_0xbac64c(_0x3491c1['result']['message']);}})[_0x544c('0x14')](function(_0x1d7875){logger['error']('Setting,\x20%s,\x20%s',_0x3dc249,_0x1d7875);_0x31490c(_0x1d7875);});});}exports[_0x544c('0x15')]=function(_0x58992a){var _0x59ec9c=this;return new Promise(function(_0x24834b,_0x4eb5ea){return db[_0x544c('0x16')][_0x544c('0x17')]({'raw':_0x58992a[_0x544c('0x18')]?_0x58992a[_0x544c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x58992a[_0x544c('0x18')]?_0x58992a[_0x544c('0x18')][_0x544c('0x19')]||null:null,'attributes':_0x58992a['options']?_0x58992a[_0x544c('0x18')][_0x544c('0x1a')]||null:null,'include':_0x58992a[_0x544c('0x18')]?_0x58992a[_0x544c('0x18')][_0x544c('0x1b')]?_[_0x544c('0x1c')](_0x58992a[_0x544c('0x18')][_0x544c('0x1b')],function(_0x4291b9){return{'model':db[_0x4291b9[_0x544c('0x1d')]],'as':_0x4291b9['as'],'attributes':_0x4291b9['attributes'],'include':_0x4291b9[_0x544c('0x1b')]?_[_0x544c('0x1c')](_0x4291b9[_0x544c('0x1b')],function(_0x7083f2){return{'model':db[_0x7083f2[_0x544c('0x1d')]],'as':_0x7083f2['as'],'attributes':_0x7083f2[_0x544c('0x1a')],'include':_0x7083f2[_0x544c('0x1b')]?_[_0x544c('0x1c')](_0x7083f2[_0x544c('0x1b')],function(_0x40436b){return{'model':db[_0x40436b[_0x544c('0x1d')]],'as':_0x40436b['as'],'attributes':_0x40436b[_0x544c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x544c('0xb')](function(_0x10aaa7){logger['info'](_0x544c('0x15'),_0x58992a);logger[_0x544c('0xd')](_0x544c('0x15'),_0x58992a,JSON[_0x544c('0x1e')](_0x10aaa7));_0x24834b(_0x10aaa7);})['catch'](function(_0x1f75ae){logger[_0x544c('0xf')](_0x544c('0x15'),_0x1f75ae[_0x544c('0x12')],_0x58992a);_0x4eb5ea(_0x59ec9c['error'](0x1f4,_0x1f75ae[_0x544c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c21d82f..4449657 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 _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x1395ef,_0x5eb589){var _0x42da3a=function(_0x3b0d5a){while(--_0x3b0d5a){_0x1395ef['push'](_0x1395ef['shift']());}};_0x42da3a(++_0x5eb589);}(_0xabce,0x103));var _0xeabc=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xabce[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +var _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x2ee01d,_0x48f7a7){var _0x24bc9f=function(_0x2c23fd){while(--_0x2c23fd){_0x2ee01d['push'](_0x2ee01d['shift']());}};_0x24bc9f(++_0x48f7a7);}(_0x814b,0x1a2));var _0xb814=function(_0xcba291,_0x10e9d5){_0xcba291=_0xcba291-0x0;var _0x162274=_0x814b[_0xcba291];return _0x162274;};'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('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4487903..1c5d7e9 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 _0x0189=['clickatell','bandwidth','csc','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','twilio','skebby','connectel','plivo'];(function(_0x34f456,_0x271849){var _0x589f55=function(_0x32e03d){while(--_0x32e03d){_0x34f456['push'](_0x34f456['shift']());}};_0x589f55(++_0x271849);}(_0x0189,0x141));var _0x9018=function(_0x2d7ebf,_0x27722e){_0x2d7ebf=_0x2d7ebf-0x0;var _0x72b7fb=_0x0189[_0x2d7ebf];return _0x72b7fb;};'use strict';var Sequelize=require(_0x9018('0x0'));var rs=require('randomstring');module[_0x9018('0x1')]={'name':{'type':Sequelize[_0x9018('0x2')],'unique':_0x9018('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9018('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9018('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9018('0x2')],'defaultValue':function(){return rs[_0x9018('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x9018('0x5'),_0x9018('0x6'),_0x9018('0x7'),'clicksend',_0x9018('0x8'),_0x9018('0x9'),_0x9018('0xa'),_0x9018('0xb'),'infobip',_0x9018('0xc'))},'accountSid':{'type':Sequelize[_0x9018('0x2')]},'authId':{'type':Sequelize[_0x9018('0x2')]},'authToken':{'type':Sequelize[_0x9018('0x2')]},'smsMethod':{'type':Sequelize[_0x9018('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9018('0x2')]},'password':{'type':Sequelize[_0x9018('0x2')]},'apiKey':{'type':Sequelize[_0x9018('0x2')]},'applicationId':{'type':Sequelize[_0x9018('0x2')]},'accountId':{'type':Sequelize[_0x9018('0x2')]},'senderString':{'type':Sequelize[_0x9018('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x9018('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9018('0xe')],'defaultValue':function(){return _0x9018('0xf');}},'notificationSound':{'type':Sequelize[_0x9018('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9018('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9018('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9018('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9018('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9018('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9018('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9018('0x10')],'defaultValue':![],'comment':_0x9018('0x12'),'set':function(_0x1f71de){if(!_0x1f71de)this[_0x9018('0x13')](_0x9018('0x14'),null);this['setDataValue'](_0x9018('0x15'),_0x1f71de);}}}; \ No newline at end of file +var _0x1f96=['STRING','ENUM','twilio','skebby','connectel','clickatell','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x1f96,0xc4));var _0x61f9=function(_0x1d057b,_0x1453f1){_0x1d057b=_0x1d057b-0x0;var _0x2c37e3=_0x1f96[_0x1d057b];return _0x2c37e3;};'use strict';var Sequelize=require(_0x61f9('0x0'));var rs=require(_0x61f9('0x1'));module['exports']={'name':{'type':Sequelize[_0x61f9('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x61f9('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x61f9('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x61f9('0x2')]},'type':{'type':Sequelize[_0x61f9('0x3')](_0x61f9('0x4'),_0x61f9('0x5'),_0x61f9('0x6'),'clicksend','plivo',_0x61f9('0x7'),'bandwidth','csc',_0x61f9('0x8'),_0x61f9('0x9'))},'accountSid':{'type':Sequelize[_0x61f9('0x2')]},'authId':{'type':Sequelize[_0x61f9('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x61f9('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x61f9('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x61f9('0x2')]},'accountId':{'type':Sequelize[_0x61f9('0x2')]},'senderString':{'type':Sequelize[_0x61f9('0x2')]},'deliveryReport':{'type':Sequelize[_0x61f9('0xa')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x61f9('0xb')],'defaultValue':function(){return _0x61f9('0xc');}},'notificationSound':{'type':Sequelize[_0x61f9('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x61f9('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x61f9('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x61f9('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x61f9('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x61f9('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x61f9('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x61f9('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x61f9('0xd')],'comment':_0x61f9('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x61f9('0xa')],'defaultValue':![],'comment':_0x61f9('0xf'),'set':function(_0x2e821b){if(!_0x2e821b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x61f9('0x10')](_0x61f9('0x11'),_0x2e821b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2725c4c..a37fc04 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 _0x1eb0=['destroy','get','then','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','SmsAccount','includeAll','include','findAll','rows','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify','sms','SmsApplication','Applications','account','priority','asc','CmContact','Sequelize','ValidationError','updatedAt','difference','createdAt','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','intelepeer','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','omit','defaults','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','User','UserId','unshift','agent','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','READ_COMMITTED','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','inspect','requestid','statusInt','status_code','DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1eb0,0x192));var _0x01eb=function(_0x374ce3,_0x5336a2){_0x374ce3=_0x374ce3-0x0;var _0x4ca91a=_0x1eb0[_0x374ce3];return _0x4ca91a;};'use strict';var emlformat=require(_0x01eb('0x0'));var rimraf=require(_0x01eb('0x1'));var zipdir=require(_0x01eb('0x2'));var jsonpatch=require(_0x01eb('0x3'));var rp=require(_0x01eb('0x4'));var moment=require(_0x01eb('0x5'));var BPromise=require(_0x01eb('0x6'));var Mustache=require(_0x01eb('0x7'));var util=require(_0x01eb('0x8'));var path=require(_0x01eb('0x9'));var sox=require(_0x01eb('0xa'));var csv=require(_0x01eb('0xb'));var ejs=require(_0x01eb('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x01eb('0xd'));var crypto=require(_0x01eb('0xe'));var jsforce=require(_0x01eb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x01eb('0xb'));var querystring=require(_0x01eb('0x10'));var Papa=require(_0x01eb('0x11'));var Redis=require(_0x01eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x01eb('0x13'));var as=require(_0x01eb('0x14'));var hardwareService=require(_0x01eb('0x15'));var logger=require(_0x01eb('0x16'))(_0x01eb('0x17'));var utils=require(_0x01eb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x01eb('0x19'));var db=require(_0x01eb('0x1a'))['db'];config[_0x01eb('0x1b')]=_['defaults'](config[_0x01eb('0x1b')],{'host':_0x01eb('0x1c'),'port':0x18eb});var socket=require(_0x01eb('0x1d'))(new Redis(config[_0x01eb('0x1b')]));require(_0x01eb('0x1e'))[_0x01eb('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x01eb('0x20')][_0x01eb('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x181e54,_0x431503,_0x55522d,_0x3f710f){return new BPromise(function(_0x587512,_0x2c7be8){var _0x54b0fb=_0x3f710f||client;return _0x54b0fb['request'](_0x181e54,_0x55522d)['then'](function(_0x24a432){logger['info'](_0x01eb('0x22'),_0x431503,'request\x20sent');logger[_0x01eb('0x23')](_0x01eb('0x24'),_0x431503,_0x01eb('0x25'),JSON[_0x01eb('0x26')](_0x24a432));if(_0x24a432[_0x01eb('0x27')]){if(_0x24a432['error'][_0x01eb('0x28')]===0x1f4){logger[_0x01eb('0x27')](_0x01eb('0x22'),_0x431503,_0x24a432['error'][_0x01eb('0x29')]);return _0x2c7be8(_0x24a432['error'][_0x01eb('0x29')]);}logger[_0x01eb('0x27')](_0x01eb('0x22'),_0x431503,_0x24a432[_0x01eb('0x27')]['message']);return _0x587512(_0x24a432[_0x01eb('0x27')][_0x01eb('0x29')]);}else{logger['info'](_0x01eb('0x22'),_0x431503,'request\x20sent');_0x587512(_0x24a432[_0x01eb('0x2a')][_0x01eb('0x29')]);}})[_0x01eb('0x2b')](function(_0x5ae60a){logger[_0x01eb('0x27')](_0x01eb('0x22'),_0x431503,_0x5ae60a);_0x2c7be8(_0x5ae60a);});});}function respondWithStatusCode(_0x45129f,_0x1764c5){_0x1764c5=_0x1764c5||0xcc;return function(_0x486c32){if(_0x486c32){return _0x45129f['sendStatus'](_0x1764c5);}return _0x45129f[_0x01eb('0x2c')](_0x1764c5)[_0x01eb('0x2d')]();};}function respondWithResult(_0x2fe27b,_0x11d0ce){_0x11d0ce=_0x11d0ce||0xc8;return function(_0x180595){if(_0x180595){return _0x2fe27b[_0x01eb('0x2c')](_0x11d0ce)[_0x01eb('0x2e')](_0x180595);}};}function respondWithFilteredResult(_0x47099d,_0x2f354c){return function(_0x38fb7d){if(_0x38fb7d){var _0x4f41e1=typeof _0x2f354c[_0x01eb('0x2f')]==='undefined'&&typeof _0x2f354c[_0x01eb('0x30')]==='undefined';var _0x46e9a6=_0x38fb7d[_0x01eb('0x31')];var _0x12d94a=_0x4f41e1?0x0:_0x2f354c[_0x01eb('0x2f')];var _0x259374=_0x4f41e1?_0x38fb7d[_0x01eb('0x31')]:_0x2f354c['offset']+_0x2f354c[_0x01eb('0x30')];var _0x380a30;if(_0x259374>=_0x46e9a6){_0x259374=_0x46e9a6;_0x380a30=0xc8;}else{_0x380a30=0xce;}_0x47099d[_0x01eb('0x2c')](_0x380a30);return _0x47099d[_0x01eb('0x32')](_0x01eb('0x33'),_0x12d94a+'-'+_0x259374+'/'+_0x46e9a6)[_0x01eb('0x2e')](_0x38fb7d);}return null;};}function patchUpdates(_0x31218e){return function(_0x40c683){try{jsonpatch[_0x01eb('0x34')](_0x40c683,_0x31218e,!![]);}catch(_0x5a47d3){return BPromise[_0x01eb('0x35')](_0x5a47d3);}return _0x40c683[_0x01eb('0x36')]();};}function saveUpdates(_0x415e75,_0x460753){return function(_0x27d986){if(_0x27d986){return _0x27d986[_0x01eb('0x37')](_0x415e75)['then'](function(_0x452be7){return _0x452be7;});}return null;};}function removeEntity(_0x277b2c,_0xad28ba){return function(_0xbc73e6){if(_0xbc73e6){return _0xbc73e6[_0x01eb('0x38')]()['then'](function(){var _0x463515=_0xbc73e6[_0x01eb('0x39')]({'plain':!![]});var _0x3d7e76='SmsAccounts';return db['UserProfileResource'][_0x01eb('0x38')]({'where':{'type':_0x3d7e76,'resourceId':_0x463515['id']}})[_0x01eb('0x3a')](function(){return _0xbc73e6;});})[_0x01eb('0x3a')](function(){_0x277b2c[_0x01eb('0x2c')](0xcc)[_0x01eb('0x2d')]();});}};}function handleEntityNotFound(_0x5ab925,_0xca9d80){return function(_0x5c3e35){if(!_0x5c3e35){_0x5ab925[_0x01eb('0x3b')](0x194);}return _0x5c3e35;};}function handleError(_0x318e0,_0x3377e3){_0x3377e3=_0x3377e3||0x1f4;return function(_0x81250c){logger[_0x01eb('0x27')](_0x81250c[_0x01eb('0x3c')]);if(_0x81250c['name']){delete _0x81250c[_0x01eb('0x3d')];}_0x318e0[_0x01eb('0x2c')](_0x3377e3)[_0x01eb('0x3e')](_0x81250c);};}exports[_0x01eb('0x3f')]=function(_0x45fb2a,_0x31a918){var _0x3e1a62={'include':[{'model':db[_0x01eb('0x40')],'as':_0x01eb('0x41')}]},_0x10a0c6={},_0x15e239={'count':0x0,'rows':[]};var _0x574be2=_[_0x01eb('0x42')](db['SmsAccount'][_0x01eb('0x43')],function(_0x47f768){return{'name':_0x47f768[_0x01eb('0x44')],'type':_0x47f768[_0x01eb('0x45')][_0x01eb('0x46')]};});_0x10a0c6['model']=_[_0x01eb('0x42')](_0x574be2,_0x01eb('0x3d'));_0x10a0c6[_0x01eb('0x47')]=_['keys'](_0x45fb2a[_0x01eb('0x47')]);_0x10a0c6[_0x01eb('0x48')]=_[_0x01eb('0x49')](_0x10a0c6[_0x01eb('0x4a')],_0x10a0c6[_0x01eb('0x47')]);_0x3e1a62[_0x01eb('0x4b')]=_['intersection'](_0x10a0c6[_0x01eb('0x4a')],qs[_0x01eb('0x4c')](_0x45fb2a[_0x01eb('0x47')][_0x01eb('0x4c')]));_0x3e1a62['attributes']=_0x3e1a62[_0x01eb('0x4b')]['length']?_0x3e1a62['attributes']:_0x10a0c6[_0x01eb('0x4a')];if(!_0x45fb2a[_0x01eb('0x47')][_0x01eb('0x4d')](_0x01eb('0x4e'))){_0x3e1a62[_0x01eb('0x30')]=qs[_0x01eb('0x30')](_0x45fb2a['query'][_0x01eb('0x30')]);_0x3e1a62[_0x01eb('0x2f')]=qs[_0x01eb('0x2f')](_0x45fb2a[_0x01eb('0x47')][_0x01eb('0x2f')]);}_0x3e1a62[_0x01eb('0x4f')]=qs['sort'](_0x45fb2a[_0x01eb('0x47')][_0x01eb('0x50')]);_0x3e1a62['where']=qs[_0x01eb('0x48')](_['pick'](_0x45fb2a['query'],_0x10a0c6[_0x01eb('0x48')]),_0x574be2);if(_0x45fb2a[_0x01eb('0x47')]['filter']){_0x3e1a62[_0x01eb('0x51')]=_[_0x01eb('0x52')](_0x3e1a62['where'],{'$or':_[_0x01eb('0x42')](_0x574be2,function(_0x2c8bb2){if(_0x2c8bb2[_0x01eb('0x45')]!==_0x01eb('0x53')){var _0xb7b26b={};_0xb7b26b[_0x2c8bb2['name']]={'$like':'%'+_0x45fb2a[_0x01eb('0x47')][_0x01eb('0x54')]+'%'};return _0xb7b26b;}})});}_0x3e1a62=_['merge']({},_0x3e1a62,_0x45fb2a[_0x01eb('0x55')]);var _0x495103={'where':_0x3e1a62['where']};return db[_0x01eb('0x56')][_0x01eb('0x31')](_0x495103)[_0x01eb('0x3a')](function(_0x5a3271){_0x15e239[_0x01eb('0x31')]=_0x5a3271;if(_0x45fb2a[_0x01eb('0x47')][_0x01eb('0x57')]){_0x3e1a62[_0x01eb('0x58')]=[{'all':!![]}];}return db['SmsAccount'][_0x01eb('0x59')](_0x3e1a62);})[_0x01eb('0x3a')](function(_0x19ddec){_0x15e239[_0x01eb('0x5a')]=_0x19ddec;return _0x15e239;})[_0x01eb('0x3a')](respondWithFilteredResult(_0x31a918,_0x3e1a62))[_0x01eb('0x2b')](handleError(_0x31a918,null));};exports['show']=function(_0x1234cb,_0x254539){var _0xd34ca6={'raw':![],'where':{'id':_0x1234cb[_0x01eb('0x5b')]['id']},'include':[{'model':db[_0x01eb('0x40')],'as':_0x01eb('0x41')}]},_0x351322={};_0x351322['model']=_['keys'](db['SmsAccount'][_0x01eb('0x43')]);_0x351322[_0x01eb('0x47')]=_[_0x01eb('0x5c')](_0x1234cb[_0x01eb('0x47')]);_0x351322['filters']=_[_0x01eb('0x49')](_0x351322[_0x01eb('0x4a')],_0x351322[_0x01eb('0x47')]);_0xd34ca6[_0x01eb('0x4b')]=_[_0x01eb('0x49')](_0x351322[_0x01eb('0x4a')],qs[_0x01eb('0x4c')](_0x1234cb[_0x01eb('0x47')][_0x01eb('0x4c')]));_0xd34ca6[_0x01eb('0x4b')]=_0xd34ca6[_0x01eb('0x4b')][_0x01eb('0x5d')]?_0xd34ca6[_0x01eb('0x4b')]:_0x351322[_0x01eb('0x4a')];if(_0x1234cb[_0x01eb('0x47')]['includeAll']){_0xd34ca6[_0x01eb('0x58')]=[{'all':!![]}];}_0xd34ca6=_['merge']({},_0xd34ca6,_0x1234cb[_0x01eb('0x55')]);return db[_0x01eb('0x56')][_0x01eb('0x5e')](_0xd34ca6)[_0x01eb('0x3a')](handleEntityNotFound(_0x254539,null))[_0x01eb('0x3a')](respondWithResult(_0x254539,null))[_0x01eb('0x2b')](handleError(_0x254539,null));};exports['create']=function(_0x350df7,_0x4bb78c){return db[_0x01eb('0x56')][_0x01eb('0x5f')](_0x350df7[_0x01eb('0x60')],{})[_0x01eb('0x3a')](function(_0xc722b7){var _0x10e2ac=_0x350df7[_0x01eb('0x61')][_0x01eb('0x39')]({'plain':!![]});if(!_0x10e2ac)throw new Error(_0x01eb('0x62'));if(_0x10e2ac['role']==='user'){var _0x322fa3=_0xc722b7['get']({'plain':!![]});var _0x3b03bd=_0x01eb('0x63');return db[_0x01eb('0x64')][_0x01eb('0x5e')]({'where':{'name':_0x3b03bd,'userProfileId':_0x10e2ac[_0x01eb('0x65')]},'raw':!![]})['then'](function(_0x2bbbc2){if(_0x2bbbc2&&_0x2bbbc2[_0x01eb('0x66')]===0x0){return db['UserProfileResource'][_0x01eb('0x5f')]({'name':_0x322fa3['name'],'resourceId':_0x322fa3['id'],'type':_0x2bbbc2['name'],'sectionId':_0x2bbbc2['id']},{})['then'](function(){return _0xc722b7;});}else{return _0xc722b7;}})[_0x01eb('0x2b')](function(_0x454029){logger[_0x01eb('0x27')](_0x01eb('0x67'),_0x454029);throw _0x454029;});}return _0xc722b7;})['then'](respondWithResult(_0x4bb78c,0xc9))[_0x01eb('0x2b')](handleError(_0x4bb78c,null));};exports['update']=function(_0x59505b,_0x3c1629){if(_0x59505b[_0x01eb('0x60')]['id']){delete _0x59505b[_0x01eb('0x60')]['id'];}return db[_0x01eb('0x56')]['find']({'where':{'id':_0x59505b['params']['id']},'include':[{'model':db[_0x01eb('0x40')],'as':_0x01eb('0x41')}]})[_0x01eb('0x3a')](handleEntityNotFound(_0x3c1629,null))[_0x01eb('0x3a')](saveUpdates(_0x59505b[_0x01eb('0x60')],null))[_0x01eb('0x3a')](respondWithResult(_0x3c1629,null))['catch'](handleError(_0x3c1629,null));};exports[_0x01eb('0x38')]=function(_0x4cb0a2,_0xc356c4){return db[_0x01eb('0x56')][_0x01eb('0x5e')]({'where':{'id':_0x4cb0a2[_0x01eb('0x5b')]['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0xc356c4,null))[_0x01eb('0x3a')](removeEntity(_0xc356c4,null))[_0x01eb('0x2b')](handleError(_0xc356c4,null));};exports[_0x01eb('0x68')]=function(_0x113641,_0xf8b8e5){return db[_0x01eb('0x56')][_0x01eb('0x68')]()['then'](respondWithResult(_0xf8b8e5,null))[_0x01eb('0x2b')](handleError(_0xf8b8e5,null));};exports[_0x01eb('0x69')]=function(_0x5c3a5d,_0x30f62f,_0x15c792){if(_0x5c3a5d[_0x01eb('0x60')]['id']){delete _0x5c3a5d['body']['id'];}return db[_0x01eb('0x56')][_0x01eb('0x5e')]({'where':{'id':_0x5c3a5d[_0x01eb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x30f62f,null))['then'](function(_0x5d883e){if(_0x5d883e){_0x5c3a5d[_0x01eb('0x60')][_0x01eb('0x6a')]=_0x5d883e['id'];return db['Disposition'][_0x01eb('0x5f')](_0x5c3a5d[_0x01eb('0x60')]);}})[_0x01eb('0x3a')](respondWithResult(_0x30f62f,null))[_0x01eb('0x2b')](handleError(_0x30f62f,null));};exports[_0x01eb('0x6b')]=function(_0x1cf2b9,_0x18a8b5,_0x17d919){var _0x4dd1e7={'raw':![],'where':{}};var _0x372800={};var _0x196bc3={'count':0x0,'rows':[]};return db['SmsAccount'][_0x01eb('0x6c')]({'where':{'id':_0x1cf2b9['params']['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x18a8b5,null))[_0x01eb('0x3a')](function(_0x102347){if(_0x102347){_0x372800[_0x01eb('0x4a')]=_[_0x01eb('0x5c')](db[_0x01eb('0x6d')][_0x01eb('0x43')]);_0x372800[_0x01eb('0x47')]=_[_0x01eb('0x5c')](_0x1cf2b9['query']);_0x372800[_0x01eb('0x48')]=_[_0x01eb('0x49')](_0x372800[_0x01eb('0x4a')],_0x372800[_0x01eb('0x47')]);_0x4dd1e7[_0x01eb('0x4b')]=_[_0x01eb('0x49')](_0x372800[_0x01eb('0x4a')],qs[_0x01eb('0x4c')](_0x1cf2b9[_0x01eb('0x47')][_0x01eb('0x4c')]));_0x4dd1e7['attributes']=_0x4dd1e7['attributes'][_0x01eb('0x5d')]?_0x4dd1e7['attributes']:_0x372800[_0x01eb('0x4a')];if(!_0x1cf2b9[_0x01eb('0x47')][_0x01eb('0x4d')](_0x01eb('0x4e'))){_0x4dd1e7[_0x01eb('0x30')]=qs[_0x01eb('0x30')](_0x1cf2b9[_0x01eb('0x47')][_0x01eb('0x30')]);_0x4dd1e7[_0x01eb('0x2f')]=qs[_0x01eb('0x2f')](_0x1cf2b9['query'][_0x01eb('0x2f')]);}_0x4dd1e7[_0x01eb('0x4f')]=qs[_0x01eb('0x50')](_0x1cf2b9[_0x01eb('0x47')][_0x01eb('0x50')]);_0x4dd1e7[_0x01eb('0x51')]=qs[_0x01eb('0x48')](_['pick'](_0x1cf2b9['query'],_0x372800[_0x01eb('0x48')]));_0x4dd1e7[_0x01eb('0x51')]['SmsAccountId']=_0x102347['id'];if(_0x1cf2b9[_0x01eb('0x47')]['filter']){_0x4dd1e7[_0x01eb('0x51')]=_['merge'](_0x4dd1e7[_0x01eb('0x51')],{'$or':_[_0x01eb('0x42')](_0x4dd1e7[_0x01eb('0x4b')],function(_0x1db13f){var _0x5c153a={};_0x5c153a[_0x1db13f]={'$like':'%'+_0x1cf2b9[_0x01eb('0x47')][_0x01eb('0x54')]+'%'};return _0x5c153a;})});}_0x4dd1e7=_[_0x01eb('0x52')]({},_0x4dd1e7,_0x1cf2b9['options']);return db[_0x01eb('0x6d')][_0x01eb('0x31')]({'where':_0x4dd1e7[_0x01eb('0x51')]})[_0x01eb('0x3a')](function(_0x3abbb5){_0x196bc3['count']=_0x3abbb5;if(_0x1cf2b9[_0x01eb('0x47')][_0x01eb('0x57')]){_0x4dd1e7[_0x01eb('0x58')]=[{'all':!![]}];}return db[_0x01eb('0x6d')]['findAll'](_0x4dd1e7);})[_0x01eb('0x3a')](function(_0x5a87c8){_0x196bc3[_0x01eb('0x5a')]=_0x5a87c8;return _0x196bc3;});}})[_0x01eb('0x3a')](respondWithFilteredResult(_0x18a8b5,_0x4dd1e7))['catch'](handleError(_0x18a8b5,null));};exports['removeDispositions']=function(_0x243288,_0x1b9358,_0x51fbc1){return db[_0x01eb('0x56')][_0x01eb('0x5e')]({'where':{'id':_0x243288[_0x01eb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1b9358,null))['then'](function(_0x8bba24){if(_0x8bba24){return _0x8bba24[_0x01eb('0x6e')](_0x243288[_0x01eb('0x47')]['ids']);}})[_0x01eb('0x3a')](respondWithStatusCode(_0x1b9358,null))['catch'](handleError(_0x1b9358,null));};exports[_0x01eb('0x6f')]=function(_0x374be2,_0x2d9bac,_0xd9994f){if(_0x374be2[_0x01eb('0x60')]['id']){delete _0x374be2[_0x01eb('0x60')]['id'];}return db['SmsAccount'][_0x01eb('0x5e')]({'where':{'id':_0x374be2[_0x01eb('0x5b')]['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x2d9bac,null))[_0x01eb('0x3a')](function(_0x454d4f){if(_0x454d4f){_0x374be2[_0x01eb('0x60')]['SmsAccountId']=_0x454d4f['id'];return db[_0x01eb('0x70')]['create'](_0x374be2[_0x01eb('0x60')]);}})[_0x01eb('0x3a')](respondWithResult(_0x2d9bac,null))[_0x01eb('0x2b')](handleError(_0x2d9bac,null));};exports[_0x01eb('0x71')]=function(_0x5255aa,_0x42dd19,_0xea47c1){var _0x547c31={'raw':![],'where':{}};var _0x32fb3e={};var _0x1589d1={'count':0x0,'rows':[]};return db[_0x01eb('0x56')][_0x01eb('0x6c')]({'where':{'id':_0x5255aa[_0x01eb('0x5b')]['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x42dd19,null))[_0x01eb('0x3a')](function(_0x4ea1dd){if(_0x4ea1dd){_0x32fb3e[_0x01eb('0x4a')]=_['keys'](db[_0x01eb('0x70')][_0x01eb('0x43')]);_0x32fb3e[_0x01eb('0x47')]=_[_0x01eb('0x5c')](_0x5255aa[_0x01eb('0x47')]);_0x32fb3e[_0x01eb('0x48')]=_[_0x01eb('0x49')](_0x32fb3e[_0x01eb('0x4a')],_0x32fb3e[_0x01eb('0x47')]);_0x547c31['attributes']=_[_0x01eb('0x49')](_0x32fb3e[_0x01eb('0x4a')],qs[_0x01eb('0x4c')](_0x5255aa[_0x01eb('0x47')][_0x01eb('0x4c')]));_0x547c31['attributes']=_0x547c31[_0x01eb('0x4b')]['length']?_0x547c31[_0x01eb('0x4b')]:_0x32fb3e['model'];if(!_0x5255aa[_0x01eb('0x47')][_0x01eb('0x4d')](_0x01eb('0x4e'))){_0x547c31[_0x01eb('0x30')]=qs['limit'](_0x5255aa[_0x01eb('0x47')]['limit']);_0x547c31['offset']=qs['offset'](_0x5255aa[_0x01eb('0x47')]['offset']);}_0x547c31[_0x01eb('0x4f')]=qs[_0x01eb('0x50')](_0x5255aa[_0x01eb('0x47')][_0x01eb('0x50')]);_0x547c31['where']=qs[_0x01eb('0x48')](_[_0x01eb('0x72')](_0x5255aa[_0x01eb('0x47')],_0x32fb3e[_0x01eb('0x48')]));_0x547c31[_0x01eb('0x51')]['SmsAccountId']=_0x4ea1dd['id'];if(_0x5255aa['query']['filter']){_0x547c31[_0x01eb('0x51')]=_[_0x01eb('0x52')](_0x547c31[_0x01eb('0x51')],{'$or':_[_0x01eb('0x42')](_0x547c31['attributes'],function(_0x58fe10){var _0x5fac07={};_0x5fac07[_0x58fe10]={'$like':'%'+_0x5255aa[_0x01eb('0x47')][_0x01eb('0x54')]+'%'};return _0x5fac07;})});}_0x547c31=_[_0x01eb('0x52')]({},_0x547c31,_0x5255aa[_0x01eb('0x55')]);return db[_0x01eb('0x70')][_0x01eb('0x31')]({'where':_0x547c31['where']})[_0x01eb('0x3a')](function(_0x46d08f){_0x1589d1['count']=_0x46d08f;if(_0x5255aa[_0x01eb('0x47')][_0x01eb('0x57')]){_0x547c31['include']=[{'all':!![]}];}return db[_0x01eb('0x70')][_0x01eb('0x59')](_0x547c31);})[_0x01eb('0x3a')](function(_0x26df18){_0x1589d1[_0x01eb('0x5a')]=_0x26df18;return _0x1589d1;});}})[_0x01eb('0x3a')](respondWithFilteredResult(_0x42dd19,_0x547c31))[_0x01eb('0x2b')](handleError(_0x42dd19,null));};exports['removeAnswers']=function(_0x4f759d,_0x12d7e8,_0x248695){return db['SmsAccount'][_0x01eb('0x5e')]({'where':{'id':_0x4f759d['params']['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x12d7e8,null))[_0x01eb('0x3a')](function(_0x5e02a7){if(_0x5e02a7){return _0x5e02a7[_0x01eb('0x73')](_0x4f759d[_0x01eb('0x47')]['ids']);}})[_0x01eb('0x3a')](respondWithStatusCode(_0x12d7e8,null))[_0x01eb('0x2b')](handleError(_0x12d7e8,null));};exports[_0x01eb('0x74')]=function(_0x21742b,_0x37d311,_0x5a6f1c){var _0x34c32e={'channel':_0x01eb('0x75')};var _0x44f6c9=[];var _0x5e74bd=[];var _0x4cd938={};return db[_0x01eb('0x56')][_0x01eb('0x5e')]({'where':{'id':_0x21742b[_0x01eb('0x5b')]['id']},'include':[{'model':db[_0x01eb('0x76')],'as':_0x01eb('0x77')}]})[_0x01eb('0x3a')](handleEntityNotFound(_0x37d311,null))[_0x01eb('0x3a')](function(_0x291b6e){_0x34c32e[_0x01eb('0x78')]=_0x291b6e;_0x34c32e['applications']=_['orderBy'](_0x291b6e[_0x01eb('0x77')],[_0x01eb('0x79')],[_0x01eb('0x7a')]);if(_0x34c32e[_0x01eb('0x78')][_0x01eb('0x77')]){delete _0x34c32e[_0x01eb('0x78')][_0x01eb('0x77')];}return db[_0x01eb('0x7b')][_0x01eb('0x68')]();})['then'](function(_0x1baa70){if(!_0x1baa70){throw new db[(_0x01eb('0x7c'))][(_0x01eb('0x7d'))]('no\x20available\x20attributes');}_0x44f6c9=_['difference'](_['keys'](_0x1baa70),['createdAt',_0x01eb('0x7e')]);_0x5e74bd=_[_0x01eb('0x7f')](_[_0x01eb('0x5c')](_0x1baa70),[_0x01eb('0x80'),_0x01eb('0x7e'),_0x01eb('0x81'),'ListId']);_0x34c32e[_0x01eb('0x60')]={'mapKey':_0x01eb('0x82')};if(_0x34c32e[_0x01eb('0x78')][_0x01eb('0x45')]){switch(_0x34c32e[_0x01eb('0x78')][_0x01eb('0x45')]){case _0x01eb('0x83'):_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x85')];_0x34c32e['body'][_0x01eb('0x60')]=_0x21742b['body'][_0x01eb('0x86')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x87')]=_0x21742b['body'][_0x01eb('0x88')];break;case _0x01eb('0x89'):_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')]='+'+_0x21742b['body'][_0x01eb('0x8a')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')]=_0x21742b['body'][_0x01eb('0x8b')];break;case _0x01eb('0x8c'):_0x34c32e['body'][_0x01eb('0x84')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x84')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x29')];break;case _0x01eb('0x8d'):_0x34c32e['body'][_0x01eb('0x84')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x84')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')]=_0x21742b[_0x01eb('0x60')]['body'];_0x34c32e['body'][_0x01eb('0x87')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x8e')];break;case _0x01eb('0x8f'):_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')]=_0x21742b['body'][_0x01eb('0x85')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')]=_0x21742b[_0x01eb('0x60')]['Text'];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x87')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x90')];break;case _0x01eb('0x91'):_0x34c32e['body']['from']='+'+_0x21742b[_0x01eb('0x60')][_0x01eb('0x92')][0x0][_0x01eb('0x84')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x92')][0x0]['text'];_0x34c32e['body'][_0x01eb('0x87')]=_0x21742b[_0x01eb('0x60')]['results'][0x0]['messageId'];break;case _0x01eb('0x93'):_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')]=_0x21742b['body'][_0x01eb('0x94')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x95')][_0x01eb('0x29')];break;case _0x01eb('0x96'):_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')]=_0x21742b[_0x01eb('0x60')]['fromNumber'];_0x34c32e[_0x01eb('0x60')]['body']=_0x21742b[_0x01eb('0x60')][_0x01eb('0x8b')];_0x34c32e['body'][_0x01eb('0x87')]=_0x21742b['body']['replyMessageId'];break;case _0x01eb('0x97'):_0x34c32e[_0x01eb('0x60')][_0x01eb('0x87')]=_0x21742b[_0x01eb('0x60')][0x0][_0x01eb('0x29')]['id'];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')]=_0x21742b[_0x01eb('0x60')][0x0][_0x01eb('0x29')][_0x01eb('0x84')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')]=_0x21742b[_0x01eb('0x60')][0x0][_0x01eb('0x29')][_0x01eb('0x8b')];break;case _0x01eb('0x98'):_0x34c32e['body']['from']=_0x21742b[_0x01eb('0x60')][_0x01eb('0x84')];_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')]=_0x21742b[_0x01eb('0x60')][_0x01eb('0x29')];_0x34c32e['body']['messageId']=_0x21742b[_0x01eb('0x60')]['refid'];break;}}if(_0x34c32e['body']['id']){delete _0x34c32e[_0x01eb('0x60')]['id'];}if(_[_0x01eb('0x99')](_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')])){throw new db[(_0x01eb('0x7c'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x34c32e['body'][_0x01eb('0x60')])||_0x34c32e['body'][_0x01eb('0x60')]===''){throw new db[(_0x01eb('0x7c'))][(_0x01eb('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x01eb('0x99')](_0x34c32e['body'][_0x01eb('0x9a')])){throw new db[(_0x01eb('0x7c'))][(_0x01eb('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e74bd);}if(!_['includes'](_0x5e74bd,_0x34c32e['body'][_0x01eb('0x9a')])){throw new db[(_0x01eb('0x7c'))][(_0x01eb('0x7d'))](_0x01eb('0x9b')+_0x5e74bd);}_0x4cd938[_0x34c32e[_0x01eb('0x60')][_0x01eb('0x9a')]]=_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')];return db['CmList'][_0x01eb('0x5e')]({'where':{'id':_0x34c32e[_0x01eb('0x78')][_0x01eb('0x9c')]},'include':[{'model':db[_0x01eb('0x7b')],'as':_0x01eb('0x9d'),'where':_0x4cd938,'limit':0x1,'order':[['updatedAt',_0x01eb('0x9e')]]}]});})[_0x01eb('0x3a')](handleEntityNotFound(_0x37d311,null))[_0x01eb('0x3a')](function(_0x8a6c6f){if(_0x8a6c6f){_0x34c32e['list']=_[_0x01eb('0x9f')](_0x8a6c6f,[_0x01eb('0x9d')]);if(_0x8a6c6f[_0x01eb('0x9d')]['length']){return _0x8a6c6f[_0x01eb('0x9d')][0x0];}var _0x5345eb=_[_0x01eb('0xa0')](_0x34c32e[_0x01eb('0x60')],{'firstName':_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')],'ListId':_0x8a6c6f['id']});_0x5345eb[_0x34c32e[_0x01eb('0x60')]['mapKey']]=_0x34c32e['body'][_0x01eb('0x84')];return db[_0x01eb('0x7b')][_0x01eb('0x5f')](_0x5345eb,{'fields':_0x44f6c9,'raw':!![]});}})['then'](handleEntityNotFound(_0x37d311,null))[_0x01eb('0x3a')](function(_0x368da6){if(_0x368da6){_0x34c32e['contact']=_0x368da6;var _0x5dd94a={'ContactId':_0x368da6['id'],'phone':_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')],'SmsAccountId':_0x21742b[_0x01eb('0x5b')]['id']};var _0x5e6f09={'ContactId':_0x368da6['id'],'SmsAccountId':_0x21742b[_0x01eb('0x5b')]['id'],'closed':![]};return db[_0x01eb('0xa1')][_0x01eb('0x5e')]({'where':_0x5e6f09})[_0x01eb('0x3a')](function(_0x1c50ca){if(_0x1c50ca){return[_0x1c50ca,![]];}return db[_0x01eb('0xa1')][_0x01eb('0x5f')](_0x5dd94a)[_0x01eb('0x3a')](function(_0x2b14eb){return[_0x2b14eb,!![]];});});}})[_0x01eb('0xa2')](function(_0x11dbac,_0xbcd43b){_0x34c32e['interaction']=_0x11dbac['get']({'plain':!![]});_0x34c32e[_0x01eb('0xa3')][_0x01eb('0xa4')]=![];if(_0xbcd43b){if(_0x34c32e[_0x01eb('0x78')][_0x01eb('0xa5')]){_0x34c32e[_0x01eb('0xa6')][_0x01eb('0xa7')]({'id':0x0,'priority':_0x34c32e[_0x01eb('0xa6')][_0x01eb('0x5d')]+0x1,'app':_0x01eb('0xa8'),'appdata':_0x01eb('0xa9'),'interval':_0x01eb('0xaa')});}_0x34c32e[_0x01eb('0xa3')][_0x01eb('0xa4')]=!![];}return db[_0x01eb('0xab')]['create']({'phone':_0x34c32e[_0x01eb('0x60')][_0x01eb('0x84')],'messageId':_0x34c32e[_0x01eb('0x60')][_0x01eb('0x87')],'body':_0x34c32e[_0x01eb('0x60')][_0x01eb('0x60')],'SmsAccountId':_0x21742b[_0x01eb('0x5b')]['id'],'SmsInteractionId':_0x11dbac['id'],'direction':'in','ContactId':_0x11dbac['ContactId'],'AttachmentId':_0x34c32e['body'][_0x01eb('0xac')]});})['then'](function(_0x3e83ea){_0x34c32e[_0x01eb('0x29')]=_0x3e83ea;if(_0x34c32e[_0x01eb('0xa3')]['UserId']){return db[_0x01eb('0xad')]['find']({'attributes':['id',_0x01eb('0x3d')],'where':{'id':_0x34c32e['interaction'][_0x01eb('0xae')]}})['then'](function(_0x55cf3b){if(_0x55cf3b){_0x34c32e[_0x01eb('0xa6')][_0x01eb('0xaf')]({'id':0x0,'priority':0x0,'app':_0x01eb('0xb0'),'appdata':_0x55cf3b[_0x01eb('0x3d')]+','+(_0x34c32e['account']['waitForTheAssignedAgent']||0xa),'interval':_0x01eb('0xaa')});}return respondWithRpcPromise('Start',_0x01eb('0xb1'),_0x34c32e);});}return respondWithRpcPromise(_0x01eb('0xb2'),'startRouting',_0x34c32e);})['then'](function(_0xeb982a){if(_0xeb982a){var _0xfa48e5=0xc8;var _0xe5931d=_0x01eb('0xb3');logger['info'](_0x01eb('0x24'),_0xe5931d,_0xfa48e5,_0x01eb('0xb4'));logger['debug'](_0x01eb('0xb5'),_0xe5931d,_0xfa48e5,_0x01eb('0xb4'),JSON[_0x01eb('0x26')](_0xeb982a));if(_0x34c32e['account']['type']==='twilio'){return _0x37d311[_0x01eb('0x2c')](_0xfa48e5)[_0x01eb('0x32')](_0x01eb('0xb6'),_0x01eb('0xb7'))[_0x01eb('0x3e')](_0x01eb('0xb8'));}else{return _0x37d311[_0x01eb('0x2c')](_0xfa48e5)[_0x01eb('0x2e')](_0xeb982a);}}})[_0x01eb('0x2b')](handleError(_0x37d311,null));};exports[_0x01eb('0xb9')]=function(_0x1d287b,_0x3401cb){var _0x4a84f3=_0x1d287b[_0x01eb('0x5b')]['id'];var _0x335a14=_0x1d287b['body'];var _0x3baa3f=0xc8;var _0x31314c=null;return db['sequelize'][_0x01eb('0xba')]({'isolationLevel':db[_0x01eb('0xbb')]['Transaction']['ISOLATION_LEVELS'][_0x01eb('0xbc')]},function(_0x4af4f0){return db[_0x01eb('0x56')][_0x01eb('0x6c')]({'where':{'id':_0x4a84f3},'transaction':_0x4af4f0})[_0x01eb('0x3a')](function(_0x1b29c5){if(_0x1b29c5){return db[_0x01eb('0x76')][_0x01eb('0x38')]({'where':{'SmsAccountId':_0x4a84f3},'transaction':_0x4af4f0})[_0x01eb('0x3a')](function(){var _0x2c714f=_[_0x01eb('0x42')](_0x335a14,function(_0x398dc0){_0x398dc0[_0x01eb('0x6a')]=_0x4a84f3;return _0x398dc0;});return db['SmsApplication']['bulkCreate'](_0x2c714f,{'transaction':_0x4af4f0});});}else{_0x3baa3f=0x194;_0x31314c=[];}});})[_0x01eb('0x3a')](function(){if(_0x3baa3f!==0x194){return db[_0x01eb('0x76')]['findAndCountAll']({'where':{'SmsAccountId':_0x4a84f3},'order':'priority'})[_0x01eb('0x3a')](function(_0x5accae){_0x31314c=_0x5accae;});}})[_0x01eb('0x2b')](function(_0x5b8e2f){_0x3baa3f=0x1f4;logger[_0x01eb('0x27')](_0x5b8e2f[_0x01eb('0x3c')]);if(_0x5b8e2f['name']){delete _0x5b8e2f[_0x01eb('0x3d')];}_0x31314c=_0x5b8e2f;})[_0x01eb('0xbd')](function(){if(_0x31314c===null){_0x3401cb[_0x01eb('0x3b')](_0x3baa3f);}else{if(_0x3baa3f===0x1f4){_0x3401cb['status'](_0x3baa3f)[_0x01eb('0x3e')](_0x31314c);}else{_0x3401cb['status'](_0x3baa3f)[_0x01eb('0x2e')](_0x31314c);}}});};exports[_0x01eb('0xbe')]=function(_0x151b22,_0x5d9fcd,_0x370b69){var _0x186a34={};var _0x5b8b9f={};var _0x4860e3;var _0x3008ac;return db['SmsAccount']['findOne']({'where':{'id':_0x151b22[_0x01eb('0x5b')]['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x5d9fcd,null))[_0x01eb('0x3a')](function(_0x172b7e){if(_0x172b7e){_0x4860e3=_0x172b7e;_0x5b8b9f[_0x01eb('0x4a')]=_[_0x01eb('0x5c')](db[_0x01eb('0x76')][_0x01eb('0x43')]);_0x5b8b9f['query']=_['keys'](_0x151b22[_0x01eb('0x47')]);_0x5b8b9f[_0x01eb('0x48')]=_[_0x01eb('0x49')](_0x5b8b9f[_0x01eb('0x4a')],_0x5b8b9f[_0x01eb('0x47')]);_0x186a34[_0x01eb('0x4b')]=_['intersection'](_0x5b8b9f[_0x01eb('0x4a')],qs[_0x01eb('0x4c')](_0x151b22[_0x01eb('0x47')]['fields']));_0x186a34[_0x01eb('0x4b')]=_0x186a34[_0x01eb('0x4b')][_0x01eb('0x5d')]?_0x186a34[_0x01eb('0x4b')]:_0x5b8b9f[_0x01eb('0x4a')];_0x186a34[_0x01eb('0x4f')]=qs[_0x01eb('0x50')](_0x151b22[_0x01eb('0x47')]['sort']);_0x186a34[_0x01eb('0x51')]=qs[_0x01eb('0x48')](_['pick'](_0x151b22['query'],_0x5b8b9f['filters']));if(_0x151b22[_0x01eb('0x47')][_0x01eb('0x54')]){_0x186a34['where']=_['merge'](_0x186a34[_0x01eb('0x51')],{'$or':_[_0x01eb('0x42')](_0x186a34[_0x01eb('0x4b')],function(_0xd1fa){var _0x1a3a1d={};_0x1a3a1d[_0xd1fa]={'$like':'%'+_0x151b22[_0x01eb('0x47')]['filter']+'%'};return _0x1a3a1d;})});}_0x186a34=_['merge']({},_0x186a34,_0x151b22[_0x01eb('0x55')]);return _0x4860e3[_0x01eb('0xbe')](_0x186a34);}})[_0x01eb('0x3a')](function(_0x171213){if(_0x171213){_0x3008ac=_0x171213[_0x01eb('0x5d')];if(!_0x151b22[_0x01eb('0x47')]['hasOwnProperty'](_0x01eb('0x4e'))){_0x186a34[_0x01eb('0x30')]=qs['limit'](_0x151b22['query'][_0x01eb('0x30')]);_0x186a34[_0x01eb('0x2f')]=qs[_0x01eb('0x2f')](_0x151b22[_0x01eb('0x47')]['offset']);}return _0x4860e3[_0x01eb('0xbe')](_0x186a34);}})[_0x01eb('0x3a')](function(_0x3b2219){if(_0x3b2219){return _0x3b2219?{'count':_0x3008ac,'rows':_0x3b2219}:null;}})[_0x01eb('0x3a')](respondWithResult(_0x5d9fcd,null))['catch'](handleError(_0x5d9fcd,null));};exports[_0x01eb('0xbf')]=function(_0x5907a8,_0x2d63fd,_0xdecd2c){var _0x1faaba={'raw':![],'where':{}};var _0x4e6dda={};var _0x181c92={'count':0x0,'rows':[]};return db[_0x01eb('0x56')][_0x01eb('0x6c')]({'where':{'id':_0x5907a8['params']['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x2d63fd,null))[_0x01eb('0x3a')](function(_0x1e0f8b){if(_0x1e0f8b){_0x4e6dda['model']=_['keys'](db[_0x01eb('0xa1')]['rawAttributes']);_0x4e6dda[_0x01eb('0x47')]=_['keys'](_0x5907a8[_0x01eb('0x47')]);_0x4e6dda[_0x01eb('0x48')]=_[_0x01eb('0x49')](_0x4e6dda[_0x01eb('0x4a')],_0x4e6dda[_0x01eb('0x47')]);_0x1faaba['attributes']=_[_0x01eb('0x49')](_0x4e6dda[_0x01eb('0x4a')],qs[_0x01eb('0x4c')](_0x5907a8[_0x01eb('0x47')][_0x01eb('0x4c')]));_0x1faaba['attributes']=_0x1faaba[_0x01eb('0x4b')]['length']?_0x1faaba['attributes']:_0x4e6dda[_0x01eb('0x4a')];if(!_0x5907a8[_0x01eb('0x47')][_0x01eb('0x4d')](_0x01eb('0x4e'))){_0x1faaba[_0x01eb('0x30')]=qs[_0x01eb('0x30')](_0x5907a8[_0x01eb('0x47')]['limit']);_0x1faaba['offset']=qs[_0x01eb('0x2f')](_0x5907a8['query'][_0x01eb('0x2f')]);}_0x1faaba['order']=qs[_0x01eb('0x50')](_0x5907a8[_0x01eb('0x47')][_0x01eb('0x50')]);_0x1faaba['where']=qs['filters'](_[_0x01eb('0x72')](_0x5907a8['query'],_0x4e6dda[_0x01eb('0x48')]));_0x1faaba[_0x01eb('0x51')][_0x01eb('0x6a')]=_0x1e0f8b['id'];if(_0x5907a8['query'][_0x01eb('0x54')]){_0x1faaba[_0x01eb('0x51')]=_['merge'](_0x1faaba['where'],{'$or':_['map'](_0x1faaba[_0x01eb('0x4b')],function(_0x5ae3d3){var _0x4482f0={};_0x4482f0[_0x5ae3d3]={'$like':'%'+_0x5907a8['query']['filter']+'%'};return _0x4482f0;})});}_0x1faaba=_[_0x01eb('0x52')]({},_0x1faaba,_0x5907a8[_0x01eb('0x55')]);return db[_0x01eb('0xa1')][_0x01eb('0x31')]({'where':_0x1faaba['where']})[_0x01eb('0x3a')](function(_0x1cb762){_0x181c92['count']=_0x1cb762;if(_0x5907a8['query']['includeAll']){_0x1faaba[_0x01eb('0x58')]=[{'model':db[_0x01eb('0x7b')],'as':_0x01eb('0xc0'),'required':![]},{'model':db[_0x01eb('0xad')],'as':_0x01eb('0xc1'),'attributes':[_0x01eb('0x3d'),_0x01eb('0xc2'),'internal'],'required':![]},{'model':db[_0x01eb('0xc3')],'as':_0x01eb('0xc4'),'attributes':['id',_0x01eb('0x3d'),'color'],'where':_0x5907a8[_0x01eb('0x47')]['tag']?{'id':_0x5907a8['query']['tag']}:undefined,'required':_0x5907a8[_0x01eb('0x47')][_0x01eb('0xc5')]?!![]:![]}];}return db[_0x01eb('0xa1')][_0x01eb('0x59')](_0x1faaba);})[_0x01eb('0x3a')](function(_0xab3cae){_0x181c92[_0x01eb('0x5a')]=_0xab3cae;return _0x181c92;});}})[_0x01eb('0x3a')](respondWithFilteredResult(_0x2d63fd,_0x1faaba))['catch'](handleError(_0x2d63fd,null));};exports[_0x01eb('0x3e')]=function(_0x57cca7,_0x4fee8f,_0x53c4f4){var _0x5ddd12,_0x1d5b15,_0x316847;if(_[_0x01eb('0x99')](_0x57cca7[_0x01eb('0x60')][_0x01eb('0x60')])||_0x57cca7[_0x01eb('0x60')][_0x01eb('0x60')]===''){throw new db['Sequelize'][(_0x01eb('0x7d'))](_0x01eb('0xc6'));}if(_[_0x01eb('0x99')](_0x57cca7[_0x01eb('0x60')]['to'])){throw new db['Sequelize'][(_0x01eb('0x7d'))](_0x01eb('0xc7'));}_0x5ddd12=_0x57cca7[_0x01eb('0x60')]['to'];return db['SmsAccount'][_0x01eb('0x5e')]({'where':{'id':_0x57cca7[_0x01eb('0x5b')]['id']},'include':[{'model':db[_0x01eb('0xc8')],'as':_0x01eb('0xc9'),'include':[{'model':db['CmContact'],'as':_0x01eb('0x9d'),'where':{'mobile':_0x5ddd12},'limit':0x1,'order':[[_0x01eb('0x7e'),_0x01eb('0x9e')]]}]}]})[_0x01eb('0x3a')](handleEntityNotFound(_0x4fee8f,null))[_0x01eb('0x3a')](function(_0x2bc7b2){if(_0x2bc7b2&&_0x2bc7b2[_0x01eb('0xc9')]){_0x1d5b15=_0x2bc7b2['get']({'plain':!![]});if(_0x1d5b15[_0x01eb('0xc9')]&&_0x1d5b15[_0x01eb('0xc9')][_0x01eb('0x9d')]['length']){return _0x1d5b15[_0x01eb('0xc9')][_0x01eb('0x9d')][0x0];}return db[_0x01eb('0x7b')]['create'](_[_0x01eb('0xa0')](_0x57cca7[_0x01eb('0x60')],{'firstName':_0x5ddd12,'mobile':_0x5ddd12,'phone':_0x5ddd12,'ListId':_0x1d5b15[_0x01eb('0x9c')]}));}})[_0x01eb('0x3a')](handleEntityNotFound(_0x4fee8f,null))[_0x01eb('0x3a')](function(_0x1185dc){if(_0x1185dc){_0x316847=_0x1185dc;return db['SmsInteraction'][_0x01eb('0x5e')]({'where':{'ContactId':_0x316847['id'],'closed':![],'SmsAccountId':_0x1d5b15['id']}})[_0x01eb('0x3a')](function(_0x44a19d){if(_0x44a19d){return[_0x44a19d,![]];}return db[_0x01eb('0xa1')][_0x01eb('0x5f')]({'UserId':_0x57cca7[_0x01eb('0x61')]['id'],'ContactId':_0x316847['id'],'SmsAccountId':_0x1d5b15['id'],'phone':_0x5ddd12,'firstMsgDirection':_0x01eb('0xca'),'Messages':[_[_0x01eb('0x52')](_0x57cca7['body'],{'read':![],'body':_0x57cca7[_0x01eb('0x60')][_0x01eb('0x60')],'phone':_0x5ddd12,'SmsAccountId':_0x1d5b15['id'],'UserId':_0x57cca7[_0x01eb('0x61')]['id'],'ContactId':_0x316847['id']})]},{'include':[{'model':db[_0x01eb('0xab')],'as':_0x01eb('0xcb')}]})[_0x01eb('0x3a')](function(_0x398fd2){return[_0x398fd2,!![]];});});}})['spread'](function(_0x434ad5,_0x12275f){if(_0x12275f){return _0x434ad5;}return db[_0x01eb('0xab')][_0x01eb('0x5f')](_[_0x01eb('0x52')](_0x57cca7['body'],{'read':![],'body':_0x57cca7[_0x01eb('0x60')][_0x01eb('0x60')],'phone':_0x5ddd12,'SmsAccountId':_0x1d5b15['id'],'SmsInteractionId':_0x434ad5['id'],'UserId':_0x57cca7[_0x01eb('0x61')]['id'],'ContactId':_0x316847['id']}))[_0x01eb('0x3a')](function(_0x49336a){_0x434ad5['dataValues'][_0x01eb('0xcb')]=[];_0x434ad5['dataValues'][_0x01eb('0xcb')][_0x01eb('0xa7')](_0x49336a[_0x01eb('0xcc')]);return _0x434ad5;});})[_0x01eb('0x3a')](respondWithResult(_0x4fee8f,null))[_0x01eb('0x2b')](handleError(_0x4fee8f,null));};exports[_0x01eb('0x2c')]=function(_0x18abe4,_0x2a2ae5,_0x554a65){if(_0x18abe4[_0x01eb('0x60')]['id']){delete _0x18abe4[_0x01eb('0x60')]['id'];}var _0x4e44e6,_0x4e779c,_0x45a526;return db[_0x01eb('0x56')][_0x01eb('0x5e')]({'where':{'id':_0x18abe4[_0x01eb('0x5b')]['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x2a2ae5,null))[_0x01eb('0x3a')](function(_0x3f7a7d){if(_0x3f7a7d){_0x45a526=_0x3f7a7d;logger[_0x01eb('0x23')](_0x01eb('0x24'),_0x01eb('0x2c'),'received\x20delivery\x20report\x20from',_0x3f7a7d['type'],util[_0x01eb('0xcd')](_0x18abe4[_0x01eb('0x60')],{'showHidden':![],'depth':null}));switch(_0x3f7a7d[_0x01eb('0x45')]){case _0x01eb('0x89'):if(_0x18abe4[_0x01eb('0x60')]['skebby_dispatch_id']&&_0x18abe4['body'][_0x01eb('0x2c')]){_0x4e779c=_0x18abe4[_0x01eb('0x60')][_0x01eb('0x2c')];return db[_0x01eb('0xab')]['find']({'where':{'messageId':_0x18abe4[_0x01eb('0x60')]['skebby_dispatch_id']}});}break;case _0x01eb('0x8c'):if(_0x18abe4[_0x01eb('0x60')][_0x01eb('0xce')]&&_0x18abe4[_0x01eb('0x60')][_0x01eb('0xcf')]){_0x4e779c=_0x18abe4['body'][_0x01eb('0xcf')];return db[_0x01eb('0xab')][_0x01eb('0x5e')]({'where':{'messageId':_0x18abe4['body'][_0x01eb('0xce')]}});}break;case _0x01eb('0x8d'):if(_0x18abe4[_0x01eb('0x60')]['message_id']&&_0x18abe4[_0x01eb('0x60')][_0x01eb('0xd0')]){_0x4e779c=_0x18abe4[_0x01eb('0x60')][_0x01eb('0xd0')];return db[_0x01eb('0xab')]['find']({'where':{'messageId':_0x18abe4[_0x01eb('0x60')]['message_id']}});}break;case'infobip':var _0x42fb14=_0x18abe4[_0x01eb('0x60')][_0x01eb('0x92')][0x0];if(_0x42fb14[_0x01eb('0x87')]&&_0x42fb14['status']['groupName']===_0x01eb('0xd1')){_0x4e779c=_0x42fb14['status'][_0x01eb('0xd2')];return db[_0x01eb('0xab')][_0x01eb('0x5e')]({'where':{'messageId':_0x42fb14[_0x01eb('0x87')]}});}break;case _0x01eb('0x96'):if(_0x18abe4[_0x01eb('0x60')][_0x01eb('0x87')]&&_0x18abe4[_0x01eb('0x60')][_0x01eb('0x2c')]){_0x4e779c=_0x18abe4[_0x01eb('0x60')][_0x01eb('0x2c')];return db[_0x01eb('0xab')][_0x01eb('0x5e')]({'where':{'messageId':_0x18abe4['body'][_0x01eb('0x87')]}});}break;case _0x01eb('0x97'):if(_0x18abe4['body'][0x0][_0x01eb('0x29')]['id']){_0x4e779c=_0x18abe4[_0x01eb('0x60')][0x0][_0x01eb('0x45')];return db['SmsMessage'][_0x01eb('0x5e')]({'where':{'messageId':_0x18abe4[_0x01eb('0x60')][0x0][_0x01eb('0x29')]['id']}});}break;case _0x01eb('0x98'):if(_0x18abe4[_0x01eb('0x60')][_0x01eb('0xd3')]&&_0x18abe4[_0x01eb('0x60')]['status']){_0x4e779c=_0x18abe4[_0x01eb('0x60')][_0x01eb('0x2c')];return db[_0x01eb('0xab')][_0x01eb('0x5e')]({'where':{'messageId':_0x18abe4['body'][_0x01eb('0xd3')]}});}break;}}})[_0x01eb('0x3a')](handleEntityNotFound(_0x2a2ae5,null))[_0x01eb('0x3a')](function(_0x489369){if(_0x489369){_0x4e44e6=_0x489369;switch(_0x45a526['type']){case _0x01eb('0x89'):if(_0x4e779c===_0x01eb('0xd1')){return _0x4e44e6[_0x01eb('0x37')]({'read':!![]});}else{logger[_0x01eb('0x27')](_0x01eb('0x24'),_0x01eb('0x2c'),_0x01eb('0x89'),util[_0x01eb('0xcd')](_0x18abe4[_0x01eb('0x60')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4e779c==='1'){return _0x4e44e6[_0x01eb('0x37')]({'read':!![]});}else{logger[_0x01eb('0x27')](_0x01eb('0x24'),_0x01eb('0x2c'),'skebby',util[_0x01eb('0xcd')](_0x18abe4[_0x01eb('0x60')],{'showHidden':![],'depth':null}));}break;case _0x01eb('0x8d'):if(!_0x18abe4['body'][_0x01eb('0xd4')]&&_0x4e779c>=0xc8&&_0x4e779c<=0xce){return _0x4e44e6[_0x01eb('0x37')]({'read':!![]});}else{logger[_0x01eb('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x01eb('0x2c'),_0x01eb('0x8d'),util['inspect'](_0x18abe4['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x71ce0e=_0x18abe4[_0x01eb('0x60')][_0x01eb('0x92')][0x0];if(_0x71ce0e['status']['groupName']==='DELIVERED'){return _0x4e44e6[_0x01eb('0x37')]({'read':!![]});}else{logger[_0x01eb('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x01eb('0x2c'),'infobip',util[_0x01eb('0xcd')](_0x18abe4[_0x01eb('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4e779c==_0x01eb('0xd5')||_0x4e779c==_0x01eb('0xd6')){return _0x4e44e6[_0x01eb('0x37')]({'read':!![]});}else{logger[_0x01eb('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x01eb('0x2c'),'clickatell',util[_0x01eb('0xcd')](_0x18abe4[_0x01eb('0x60')],{'showHidden':![],'depth':null}));}break;case _0x01eb('0x97'):if(_0x4e779c==_0x01eb('0xd7')){return _0x4e44e6[_0x01eb('0x37')]({'read':!![]});}else{logger[_0x01eb('0x27')](_0x01eb('0x24'),_0x01eb('0x2c'),_0x01eb('0x97'),util['inspect'](_0x18abe4['body'],{'showHidden':![],'depth':null}));}break;case _0x01eb('0x98'):if(_0x4e779c===_0x01eb('0xd8')||_0x4e779c===_0x01eb('0xd9')){return _0x4e44e6[_0x01eb('0x37')]({'read':!![]});}else{logger[_0x01eb('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x01eb('0x2c'),_0x01eb('0x98'),util['inspect'](_0x18abe4['body'],{'showHidden':![],'depth':null}));}break;}return _0x4e44e6;}})[_0x01eb('0x3a')](respondWithResult(_0x2a2ae5,null))[_0x01eb('0x2b')](handleError(_0x2a2ae5,null));};exports[_0x01eb('0xda')]=function(_0x1bbd06,_0x5a1da9,_0x1e17b3){var _0x2f263a,_0x23a834,_0x43ea9f;return db['SmsAccount'][_0x01eb('0x5e')]({'where':{'id':_0x1bbd06[_0x01eb('0x5b')]['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x5a1da9,null))[_0x01eb('0x3a')](function(_0x37c889){if(_0x37c889){_0x43ea9f=_0x37c889;logger[_0x01eb('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x01eb('0x2c'),_0x01eb('0xdb'),_0x37c889[_0x01eb('0x45')],util['inspect'](_0x1bbd06[_0x01eb('0x47')],{'showHidden':![],'depth':null}));switch(_0x37c889[_0x01eb('0x45')]){case _0x01eb('0x93'):if(_0x1bbd06[_0x01eb('0x47')][_0x01eb('0xdc')]&&_0x1bbd06[_0x01eb('0x47')][_0x01eb('0xdd')]){_0x23a834=_0x1bbd06[_0x01eb('0x47')]['state'];return db[_0x01eb('0xab')][_0x01eb('0x5e')]({'where':{'messageId':_0x1bbd06['query'][_0x01eb('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x5a1da9,null))[_0x01eb('0x3a')](function(_0x3dc99e){if(_0x3dc99e){_0x2f263a=_0x3dc99e;switch(_0x43ea9f['type']){case _0x01eb('0x93'):if(_0x23a834==='2'||_0x23a834==='6'){return _0x2f263a[_0x01eb('0x37')]({'read':!![]});}else{logger[_0x01eb('0x27')](_0x01eb('0x24'),_0x01eb('0x2c'),'csc',util[_0x01eb('0xcd')](_0x1bbd06[_0x01eb('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x2f263a;}})[_0x01eb('0x3a')](respondWithResult(_0x5a1da9,null))[_0x01eb('0x2b')](handleError(_0x5a1da9,null));};exports['addAgents']=function(_0xe86a6c,_0x5f365d,_0x54385f){return db[_0x01eb('0x56')][_0x01eb('0x5e')]({'where':{'id':_0xe86a6c[_0x01eb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5f365d,null))[_0x01eb('0x3a')](function(_0x6b9834){if(_0x6b9834){return _0x6b9834[_0x01eb('0xde')](_0xe86a6c[_0x01eb('0x60')][_0x01eb('0xdf')],_[_0x01eb('0x9f')](_0xe86a6c[_0x01eb('0x60')],['ids','id'])||{})['spread'](function(_0x41c226){for(var _0x40ac67=0x0;_0x40ac67<_0xe86a6c[_0x01eb('0x60')][_0x01eb('0xdf')]['length'];_0x40ac67+=0x1){socket[_0x01eb('0xe0')](_0x01eb('0xe1'),{'UserId':Number(_0xe86a6c[_0x01eb('0x60')]['ids'][_0x40ac67]),'SmsAccountId':Number(_0xe86a6c['params']['id'])});}return _0x41c226;});}})[_0x01eb('0x3a')](respondWithResult(_0x5f365d,null))[_0x01eb('0x2b')](handleError(_0x5f365d,null));};exports['removeAgents']=function(_0x53fa58,_0x495df7,_0x110c6c){return db[_0x01eb('0x56')][_0x01eb('0x5e')]({'where':{'id':_0x53fa58[_0x01eb('0x5b')]['id']}})[_0x01eb('0x3a')](handleEntityNotFound(_0x495df7,null))[_0x01eb('0x3a')](function(_0x58b892){if(_0x58b892){return _0x58b892[_0x01eb('0xe2')](_0x53fa58[_0x01eb('0x47')][_0x01eb('0xdf')])['then'](function(){if(_[_0x01eb('0xe3')](_0x53fa58['query'][_0x01eb('0xdf')])){for(var _0x309ff1=0x0;_0x309ff1<_0x53fa58[_0x01eb('0x47')][_0x01eb('0xdf')][_0x01eb('0x5d')];_0x309ff1+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x53fa58[_0x01eb('0x47')][_0x01eb('0xdf')][_0x309ff1]),'SmsAccountId':Number(_0x53fa58[_0x01eb('0x5b')]['id'])});}}else{socket[_0x01eb('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x53fa58[_0x01eb('0x47')][_0x01eb('0xdf')]),'SmsAccountId':Number(_0x53fa58[_0x01eb('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x495df7,null))[_0x01eb('0x2b')](handleError(_0x495df7,null));};exports[_0x01eb('0xe4')]=function(_0x14cf91,_0x1c5a22,_0x2e856e){var _0x59abdc={};var _0x2d5857={};var _0x35ec99;var _0x309919;return db[_0x01eb('0x56')][_0x01eb('0x6c')]({'where':{'id':_0x14cf91[_0x01eb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1c5a22,null))[_0x01eb('0x3a')](function(_0x30b6d0){if(_0x30b6d0){_0x35ec99=_0x30b6d0;_0x2d5857['model']=_[_0x01eb('0x5c')](db[_0x01eb('0xad')][_0x01eb('0x43')]);_0x2d5857[_0x01eb('0x47')]=_[_0x01eb('0x5c')](_0x14cf91['query']);_0x2d5857[_0x01eb('0x48')]=_['intersection'](_0x2d5857[_0x01eb('0x4a')],_0x2d5857['query']);_0x59abdc[_0x01eb('0x4b')]=_[_0x01eb('0x49')](_0x2d5857[_0x01eb('0x4a')],qs[_0x01eb('0x4c')](_0x14cf91[_0x01eb('0x47')][_0x01eb('0x4c')]));_0x59abdc['attributes']=_0x59abdc[_0x01eb('0x4b')]['length']?_0x59abdc[_0x01eb('0x4b')]:_0x2d5857[_0x01eb('0x4a')];_0x59abdc[_0x01eb('0x4f')]=qs[_0x01eb('0x50')](_0x14cf91[_0x01eb('0x47')]['sort']);_0x59abdc[_0x01eb('0x51')]=qs[_0x01eb('0x48')](_['pick'](_0x14cf91[_0x01eb('0x47')],_0x2d5857[_0x01eb('0x48')]));if(_0x14cf91[_0x01eb('0x47')]['filter']){_0x59abdc[_0x01eb('0x51')]=_[_0x01eb('0x52')](_0x59abdc['where'],{'$or':_[_0x01eb('0x42')](_0x59abdc[_0x01eb('0x4b')],function(_0x2d5c56){var _0x507014={};_0x507014[_0x2d5c56]={'$like':'%'+_0x14cf91['query'][_0x01eb('0x54')]+'%'};return _0x507014;})});}_0x59abdc=_[_0x01eb('0x52')]({},_0x59abdc,_0x14cf91[_0x01eb('0x55')]);return _0x35ec99[_0x01eb('0xe4')](_0x59abdc);}})[_0x01eb('0x3a')](function(_0x38f682){if(_0x38f682){_0x309919=_0x38f682['length'];if(!_0x14cf91['query']['hasOwnProperty'](_0x01eb('0x4e'))){_0x59abdc['limit']=qs['limit'](_0x14cf91[_0x01eb('0x47')][_0x01eb('0x30')]);_0x59abdc['offset']=qs[_0x01eb('0x2f')](_0x14cf91[_0x01eb('0x47')][_0x01eb('0x2f')]);}return _0x35ec99[_0x01eb('0xe4')](_0x59abdc);}})[_0x01eb('0x3a')](function(_0x43f23e){if(_0x43f23e){return _0x43f23e?{'count':_0x309919,'rows':_0x43f23e}:null;}})[_0x01eb('0x3a')](respondWithResult(_0x1c5a22,null))[_0x01eb('0x2b')](handleError(_0x1c5a22,null));}; \ No newline at end of file +var _0xf949=['connectel','message_id','plivo','Text','messageId','MessageUUID','infobip','results','csc','fromNumber','replyMessageId','bandwidth','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','UserId','agent','*,*,*,*','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','rows','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','intelepeer','DELIVRD','message-id','state','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','SmsAccounts','UserProfileResource','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rawAttributes','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','SmsAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','skebby','text'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xf949,0x139));var _0x9f94=function(_0x2b9582,_0x528262){_0x2b9582=_0x2b9582-0x0;var _0xa49e62=_0xf949[_0x2b9582];return _0xa49e62;};'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(_0x9f94('0x0'));var moment=require(_0x9f94('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9f94('0x2'));var path=require(_0x9f94('0x3'));var sox=require(_0x9f94('0x4'));var csv=require(_0x9f94('0x5'));var ejs=require(_0x9f94('0x6'));var fs=require('fs');var fs_extra=require(_0x9f94('0x7'));var _=require(_0x9f94('0x8'));var squel=require(_0x9f94('0x9'));var crypto=require(_0x9f94('0xa'));var jsforce=require(_0x9f94('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9f94('0x5'));var querystring=require('querystring');var Papa=require(_0x9f94('0xc'));var Redis=require(_0x9f94('0xd'));var authService=require(_0x9f94('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9f94('0xf'));var hardwareService=require(_0x9f94('0x10'));var logger=require(_0x9f94('0x11'))('api');var utils=require(_0x9f94('0x12'));var config=require(_0x9f94('0x13'));var licenseUtil=require(_0x9f94('0x14'));var db=require(_0x9f94('0x15'))['db'];config[_0x9f94('0x16')]=_[_0x9f94('0x17')](config[_0x9f94('0x16')],{'host':_0x9f94('0x18'),'port':0x18eb});var socket=require(_0x9f94('0x19'))(new Redis(config[_0x9f94('0x16')]));require(_0x9f94('0x1a'))[_0x9f94('0x1b')](socket);var jayson=require(_0x9f94('0x1c'));var client=jayson[_0x9f94('0x1d')][_0x9f94('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x20204c,_0x194c26,_0x480010,_0x330859){return new BPromise(function(_0x45be92,_0x231590){var _0x1be0f9=_0x330859||client;return _0x1be0f9[_0x9f94('0x1f')](_0x20204c,_0x480010)['then'](function(_0xc79f90){logger[_0x9f94('0x20')](_0x9f94('0x21'),_0x194c26,'request\x20sent');logger[_0x9f94('0x22')](_0x9f94('0x23'),_0x194c26,_0x9f94('0x24'),JSON['stringify'](_0xc79f90));if(_0xc79f90[_0x9f94('0x25')]){if(_0xc79f90[_0x9f94('0x25')][_0x9f94('0x26')]===0x1f4){logger[_0x9f94('0x25')](_0x9f94('0x21'),_0x194c26,_0xc79f90[_0x9f94('0x25')][_0x9f94('0x27')]);return _0x231590(_0xc79f90['error'][_0x9f94('0x27')]);}logger[_0x9f94('0x25')]('SmsAccount,\x20%s,\x20%s',_0x194c26,_0xc79f90[_0x9f94('0x25')][_0x9f94('0x27')]);return _0x45be92(_0xc79f90[_0x9f94('0x25')][_0x9f94('0x27')]);}else{logger[_0x9f94('0x20')](_0x9f94('0x21'),_0x194c26,_0x9f94('0x24'));_0x45be92(_0xc79f90[_0x9f94('0x28')][_0x9f94('0x27')]);}})[_0x9f94('0x29')](function(_0x245517){logger[_0x9f94('0x25')](_0x9f94('0x21'),_0x194c26,_0x245517);_0x231590(_0x245517);});});}function respondWithStatusCode(_0x178ae2,_0x2b55ed){_0x2b55ed=_0x2b55ed||0xcc;return function(_0x5c3563){if(_0x5c3563){return _0x178ae2[_0x9f94('0x2a')](_0x2b55ed);}return _0x178ae2['status'](_0x2b55ed)[_0x9f94('0x2b')]();};}function respondWithResult(_0x1ea901,_0xf4c700){_0xf4c700=_0xf4c700||0xc8;return function(_0x278fc0){if(_0x278fc0){return _0x1ea901[_0x9f94('0x2c')](_0xf4c700)[_0x9f94('0x2d')](_0x278fc0);}};}function respondWithFilteredResult(_0x48fc76,_0x1cc356){return function(_0x1d4ffb){if(_0x1d4ffb){var _0xfc1348=typeof _0x1cc356[_0x9f94('0x2e')]===_0x9f94('0x2f')&&typeof _0x1cc356[_0x9f94('0x30')]===_0x9f94('0x2f');var _0x4b9592=_0x1d4ffb[_0x9f94('0x31')];var _0x49c817=_0xfc1348?0x0:_0x1cc356[_0x9f94('0x2e')];var _0x3b1e70=_0xfc1348?_0x1d4ffb[_0x9f94('0x31')]:_0x1cc356[_0x9f94('0x2e')]+_0x1cc356['limit'];var _0x23dedc;if(_0x3b1e70>=_0x4b9592){_0x3b1e70=_0x4b9592;_0x23dedc=0xc8;}else{_0x23dedc=0xce;}_0x48fc76[_0x9f94('0x2c')](_0x23dedc);return _0x48fc76[_0x9f94('0x32')](_0x9f94('0x33'),_0x49c817+'-'+_0x3b1e70+'/'+_0x4b9592)[_0x9f94('0x2d')](_0x1d4ffb);}return null;};}function patchUpdates(_0x4b03e2){return function(_0x4a6d3a){try{jsonpatch[_0x9f94('0x34')](_0x4a6d3a,_0x4b03e2,!![]);}catch(_0x1fd0db){return BPromise[_0x9f94('0x35')](_0x1fd0db);}return _0x4a6d3a['save']();};}function saveUpdates(_0x19b052,_0x5a8d7e){return function(_0x212244){if(_0x212244){return _0x212244[_0x9f94('0x36')](_0x19b052)[_0x9f94('0x37')](function(_0x41278b){return _0x41278b;});}return null;};}function removeEntity(_0xe82d59,_0xdc50c3){return function(_0x4db72d){if(_0x4db72d){return _0x4db72d[_0x9f94('0x38')]()['then'](function(){var _0x241dda=_0x4db72d[_0x9f94('0x39')]({'plain':!![]});var _0x3bb8ff=_0x9f94('0x3a');return db[_0x9f94('0x3b')][_0x9f94('0x38')]({'where':{'type':_0x3bb8ff,'resourceId':_0x241dda['id']}})[_0x9f94('0x37')](function(){return _0x4db72d;});})[_0x9f94('0x37')](function(){_0xe82d59['status'](0xcc)[_0x9f94('0x2b')]();});}};}function handleEntityNotFound(_0x5d3c66,_0x4080ba){return function(_0x3d4fd2){if(!_0x3d4fd2){_0x5d3c66[_0x9f94('0x2a')](0x194);}return _0x3d4fd2;};}function handleError(_0x1629c7,_0x207598){_0x207598=_0x207598||0x1f4;return function(_0x35d174){logger[_0x9f94('0x25')](_0x35d174['stack']);if(_0x35d174['name']){delete _0x35d174['name'];}_0x1629c7[_0x9f94('0x2c')](_0x207598)['send'](_0x35d174);};}exports[_0x9f94('0x3c')]=function(_0x49b0af,_0x4f757e){var _0x59d96a={'include':[{'model':db[_0x9f94('0x3d')],'as':_0x9f94('0x3e')}]},_0x238fad={},_0x4c63bd={'count':0x0,'rows':[]};var _0x1f5f8d=_[_0x9f94('0x3f')](db[_0x9f94('0x40')]['rawAttributes'],function(_0x4c90f9){return{'name':_0x4c90f9[_0x9f94('0x41')],'type':_0x4c90f9[_0x9f94('0x42')][_0x9f94('0x43')]};});_0x238fad[_0x9f94('0x44')]=_['map'](_0x1f5f8d,'name');_0x238fad['query']=_[_0x9f94('0x45')](_0x49b0af[_0x9f94('0x46')]);_0x238fad[_0x9f94('0x47')]=_[_0x9f94('0x48')](_0x238fad['model'],_0x238fad[_0x9f94('0x46')]);_0x59d96a[_0x9f94('0x49')]=_['intersection'](_0x238fad[_0x9f94('0x44')],qs[_0x9f94('0x4a')](_0x49b0af['query'][_0x9f94('0x4a')]));_0x59d96a['attributes']=_0x59d96a['attributes'][_0x9f94('0x4b')]?_0x59d96a['attributes']:_0x238fad[_0x9f94('0x44')];if(!_0x49b0af[_0x9f94('0x46')]['hasOwnProperty'](_0x9f94('0x4c'))){_0x59d96a[_0x9f94('0x30')]=qs[_0x9f94('0x30')](_0x49b0af[_0x9f94('0x46')]['limit']);_0x59d96a[_0x9f94('0x2e')]=qs[_0x9f94('0x2e')](_0x49b0af[_0x9f94('0x46')][_0x9f94('0x2e')]);}_0x59d96a[_0x9f94('0x4d')]=qs['sort'](_0x49b0af[_0x9f94('0x46')][_0x9f94('0x4e')]);_0x59d96a[_0x9f94('0x4f')]=qs[_0x9f94('0x47')](_[_0x9f94('0x50')](_0x49b0af[_0x9f94('0x46')],_0x238fad[_0x9f94('0x47')]),_0x1f5f8d);if(_0x49b0af['query'][_0x9f94('0x51')]){_0x59d96a[_0x9f94('0x4f')]=_[_0x9f94('0x52')](_0x59d96a[_0x9f94('0x4f')],{'$or':_[_0x9f94('0x3f')](_0x1f5f8d,function(_0x2e5856){if(_0x2e5856[_0x9f94('0x42')]!==_0x9f94('0x53')){var _0x12472e={};_0x12472e[_0x2e5856[_0x9f94('0x54')]]={'$like':'%'+_0x49b0af[_0x9f94('0x46')][_0x9f94('0x51')]+'%'};return _0x12472e;}})});}_0x59d96a=_[_0x9f94('0x52')]({},_0x59d96a,_0x49b0af[_0x9f94('0x55')]);var _0x463252={'where':_0x59d96a[_0x9f94('0x4f')]};return db['SmsAccount'][_0x9f94('0x31')](_0x463252)[_0x9f94('0x37')](function(_0x7554ed){_0x4c63bd[_0x9f94('0x31')]=_0x7554ed;if(_0x49b0af['query'][_0x9f94('0x56')]){_0x59d96a[_0x9f94('0x57')]=[{'all':!![]}];}return db[_0x9f94('0x40')][_0x9f94('0x58')](_0x59d96a);})[_0x9f94('0x37')](function(_0x4f525a){_0x4c63bd['rows']=_0x4f525a;return _0x4c63bd;})['then'](respondWithFilteredResult(_0x4f757e,_0x59d96a))[_0x9f94('0x29')](handleError(_0x4f757e,null));};exports['show']=function(_0x15d250,_0x319c75){var _0x732c8={'raw':![],'where':{'id':_0x15d250['params']['id']},'include':[{'model':db[_0x9f94('0x3d')],'as':'mandatoryDispositionPause'}]},_0x58fb2c={};_0x58fb2c[_0x9f94('0x44')]=_['keys'](db[_0x9f94('0x40')][_0x9f94('0x59')]);_0x58fb2c[_0x9f94('0x46')]=_[_0x9f94('0x45')](_0x15d250[_0x9f94('0x46')]);_0x58fb2c[_0x9f94('0x47')]=_[_0x9f94('0x48')](_0x58fb2c[_0x9f94('0x44')],_0x58fb2c[_0x9f94('0x46')]);_0x732c8[_0x9f94('0x49')]=_[_0x9f94('0x48')](_0x58fb2c['model'],qs[_0x9f94('0x4a')](_0x15d250[_0x9f94('0x46')][_0x9f94('0x4a')]));_0x732c8[_0x9f94('0x49')]=_0x732c8[_0x9f94('0x49')][_0x9f94('0x4b')]?_0x732c8[_0x9f94('0x49')]:_0x58fb2c[_0x9f94('0x44')];if(_0x15d250[_0x9f94('0x46')][_0x9f94('0x56')]){_0x732c8['include']=[{'all':!![]}];}_0x732c8=_[_0x9f94('0x52')]({},_0x732c8,_0x15d250[_0x9f94('0x55')]);return db['SmsAccount'][_0x9f94('0x5a')](_0x732c8)[_0x9f94('0x37')](handleEntityNotFound(_0x319c75,null))['then'](respondWithResult(_0x319c75,null))[_0x9f94('0x29')](handleError(_0x319c75,null));};exports[_0x9f94('0x5b')]=function(_0x56aed4,_0x2521c9){return db['SmsAccount']['create'](_0x56aed4['body'],{})[_0x9f94('0x37')](function(_0xfcaf0b){var _0x5c0dda=_0x56aed4[_0x9f94('0x5c')][_0x9f94('0x39')]({'plain':!![]});if(!_0x5c0dda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c0dda['role']===_0x9f94('0x5c')){var _0x2016fe=_0xfcaf0b[_0x9f94('0x39')]({'plain':!![]});var _0x4df766='SmsAccounts';return db[_0x9f94('0x5d')][_0x9f94('0x5a')]({'where':{'name':_0x4df766,'userProfileId':_0x5c0dda[_0x9f94('0x5e')]},'raw':!![]})['then'](function(_0x4ea8e7){if(_0x4ea8e7&&_0x4ea8e7[_0x9f94('0x5f')]===0x0){return db[_0x9f94('0x3b')][_0x9f94('0x5b')]({'name':_0x2016fe[_0x9f94('0x54')],'resourceId':_0x2016fe['id'],'type':_0x4ea8e7[_0x9f94('0x54')],'sectionId':_0x4ea8e7['id']},{})[_0x9f94('0x37')](function(){return _0xfcaf0b;});}else{return _0xfcaf0b;}})[_0x9f94('0x29')](function(_0x192b69){logger[_0x9f94('0x25')](_0x9f94('0x60'),_0x192b69);throw _0x192b69;});}return _0xfcaf0b;})['then'](respondWithResult(_0x2521c9,0xc9))['catch'](handleError(_0x2521c9,null));};exports[_0x9f94('0x36')]=function(_0x43c3bd,_0x14f199){if(_0x43c3bd[_0x9f94('0x61')]['id']){delete _0x43c3bd['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x43c3bd[_0x9f94('0x62')]['id']},'include':[{'model':db[_0x9f94('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x9f94('0x37')](handleEntityNotFound(_0x14f199,null))[_0x9f94('0x37')](saveUpdates(_0x43c3bd[_0x9f94('0x61')],null))[_0x9f94('0x37')](respondWithResult(_0x14f199,null))[_0x9f94('0x29')](handleError(_0x14f199,null));};exports[_0x9f94('0x38')]=function(_0xda0aaf,_0x553f16){return db[_0x9f94('0x40')][_0x9f94('0x5a')]({'where':{'id':_0xda0aaf['params']['id']}})['then'](handleEntityNotFound(_0x553f16,null))[_0x9f94('0x37')](removeEntity(_0x553f16,null))[_0x9f94('0x29')](handleError(_0x553f16,null));};exports['describe']=function(_0x3ac12f,_0x538c7c){return db[_0x9f94('0x40')]['describe']()[_0x9f94('0x37')](respondWithResult(_0x538c7c,null))[_0x9f94('0x29')](handleError(_0x538c7c,null));};exports['addDisposition']=function(_0x1d8f24,_0x431728,_0x42b704){if(_0x1d8f24[_0x9f94('0x61')]['id']){delete _0x1d8f24[_0x9f94('0x61')]['id'];}return db['SmsAccount'][_0x9f94('0x5a')]({'where':{'id':_0x1d8f24[_0x9f94('0x62')]['id']}})['then'](handleEntityNotFound(_0x431728,null))[_0x9f94('0x37')](function(_0x5c7b0c){if(_0x5c7b0c){_0x1d8f24[_0x9f94('0x61')][_0x9f94('0x63')]=_0x5c7b0c['id'];return db[_0x9f94('0x64')][_0x9f94('0x5b')](_0x1d8f24['body']);}})[_0x9f94('0x37')](respondWithResult(_0x431728,null))['catch'](handleError(_0x431728,null));};exports[_0x9f94('0x65')]=function(_0x2db254,_0x53ba11,_0x11ecb0){var _0x3de6e1={'raw':![],'where':{}};var _0x290e12={};var _0x1f8ff1={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x2db254[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x53ba11,null))['then'](function(_0x514b64){if(_0x514b64){_0x290e12['model']=_[_0x9f94('0x45')](db[_0x9f94('0x64')]['rawAttributes']);_0x290e12['query']=_[_0x9f94('0x45')](_0x2db254['query']);_0x290e12[_0x9f94('0x47')]=_[_0x9f94('0x48')](_0x290e12[_0x9f94('0x44')],_0x290e12['query']);_0x3de6e1[_0x9f94('0x49')]=_['intersection'](_0x290e12[_0x9f94('0x44')],qs[_0x9f94('0x4a')](_0x2db254[_0x9f94('0x46')][_0x9f94('0x4a')]));_0x3de6e1[_0x9f94('0x49')]=_0x3de6e1[_0x9f94('0x49')][_0x9f94('0x4b')]?_0x3de6e1[_0x9f94('0x49')]:_0x290e12[_0x9f94('0x44')];if(!_0x2db254[_0x9f94('0x46')][_0x9f94('0x66')](_0x9f94('0x4c'))){_0x3de6e1['limit']=qs['limit'](_0x2db254[_0x9f94('0x46')]['limit']);_0x3de6e1['offset']=qs[_0x9f94('0x2e')](_0x2db254[_0x9f94('0x46')][_0x9f94('0x2e')]);}_0x3de6e1[_0x9f94('0x4d')]=qs[_0x9f94('0x4e')](_0x2db254[_0x9f94('0x46')][_0x9f94('0x4e')]);_0x3de6e1[_0x9f94('0x4f')]=qs[_0x9f94('0x47')](_[_0x9f94('0x50')](_0x2db254[_0x9f94('0x46')],_0x290e12[_0x9f94('0x47')]));_0x3de6e1[_0x9f94('0x4f')][_0x9f94('0x63')]=_0x514b64['id'];if(_0x2db254['query']['filter']){_0x3de6e1[_0x9f94('0x4f')]=_[_0x9f94('0x52')](_0x3de6e1['where'],{'$or':_[_0x9f94('0x3f')](_0x3de6e1[_0x9f94('0x49')],function(_0x222bb0){var _0x1ccff4={};_0x1ccff4[_0x222bb0]={'$like':'%'+_0x2db254[_0x9f94('0x46')][_0x9f94('0x51')]+'%'};return _0x1ccff4;})});}_0x3de6e1=_[_0x9f94('0x52')]({},_0x3de6e1,_0x2db254[_0x9f94('0x55')]);return db[_0x9f94('0x64')]['count']({'where':_0x3de6e1['where']})[_0x9f94('0x37')](function(_0x54d737){_0x1f8ff1['count']=_0x54d737;if(_0x2db254['query'][_0x9f94('0x56')]){_0x3de6e1['include']=[{'all':!![]}];}return db[_0x9f94('0x64')][_0x9f94('0x58')](_0x3de6e1);})[_0x9f94('0x37')](function(_0x4b537e){_0x1f8ff1['rows']=_0x4b537e;return _0x1f8ff1;});}})['then'](respondWithFilteredResult(_0x53ba11,_0x3de6e1))[_0x9f94('0x29')](handleError(_0x53ba11,null));};exports['removeDispositions']=function(_0x534de5,_0x197e7a,_0x212d9d){return db[_0x9f94('0x40')]['find']({'where':{'id':_0x534de5['params']['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x197e7a,null))[_0x9f94('0x37')](function(_0x521c9d){if(_0x521c9d){return _0x521c9d[_0x9f94('0x67')](_0x534de5[_0x9f94('0x46')][_0x9f94('0x68')]);}})[_0x9f94('0x37')](respondWithStatusCode(_0x197e7a,null))[_0x9f94('0x29')](handleError(_0x197e7a,null));};exports[_0x9f94('0x69')]=function(_0x344b13,_0x415180,_0x4bed43){if(_0x344b13[_0x9f94('0x61')]['id']){delete _0x344b13[_0x9f94('0x61')]['id'];}return db[_0x9f94('0x40')][_0x9f94('0x5a')]({'where':{'id':_0x344b13[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x415180,null))['then'](function(_0x5bfd36){if(_0x5bfd36){_0x344b13[_0x9f94('0x61')][_0x9f94('0x63')]=_0x5bfd36['id'];return db[_0x9f94('0x6a')][_0x9f94('0x5b')](_0x344b13[_0x9f94('0x61')]);}})[_0x9f94('0x37')](respondWithResult(_0x415180,null))[_0x9f94('0x29')](handleError(_0x415180,null));};exports[_0x9f94('0x6b')]=function(_0x5338d3,_0x240118,_0x25a017){var _0x4101d7={'raw':![],'where':{}};var _0x296ded={};var _0x19bb31={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9f94('0x6c')]({'where':{'id':_0x5338d3[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x240118,null))[_0x9f94('0x37')](function(_0x131a55){if(_0x131a55){_0x296ded[_0x9f94('0x44')]=_['keys'](db[_0x9f94('0x6a')][_0x9f94('0x59')]);_0x296ded['query']=_['keys'](_0x5338d3[_0x9f94('0x46')]);_0x296ded['filters']=_['intersection'](_0x296ded['model'],_0x296ded['query']);_0x4101d7[_0x9f94('0x49')]=_[_0x9f94('0x48')](_0x296ded[_0x9f94('0x44')],qs[_0x9f94('0x4a')](_0x5338d3['query'][_0x9f94('0x4a')]));_0x4101d7[_0x9f94('0x49')]=_0x4101d7[_0x9f94('0x49')]['length']?_0x4101d7[_0x9f94('0x49')]:_0x296ded[_0x9f94('0x44')];if(!_0x5338d3[_0x9f94('0x46')]['hasOwnProperty'](_0x9f94('0x4c'))){_0x4101d7[_0x9f94('0x30')]=qs['limit'](_0x5338d3[_0x9f94('0x46')][_0x9f94('0x30')]);_0x4101d7[_0x9f94('0x2e')]=qs[_0x9f94('0x2e')](_0x5338d3[_0x9f94('0x46')][_0x9f94('0x2e')]);}_0x4101d7[_0x9f94('0x4d')]=qs[_0x9f94('0x4e')](_0x5338d3[_0x9f94('0x46')]['sort']);_0x4101d7[_0x9f94('0x4f')]=qs[_0x9f94('0x47')](_[_0x9f94('0x50')](_0x5338d3['query'],_0x296ded[_0x9f94('0x47')]));_0x4101d7['where'][_0x9f94('0x63')]=_0x131a55['id'];if(_0x5338d3[_0x9f94('0x46')]['filter']){_0x4101d7[_0x9f94('0x4f')]=_[_0x9f94('0x52')](_0x4101d7['where'],{'$or':_['map'](_0x4101d7[_0x9f94('0x49')],function(_0x4f1b12){var _0x2dae81={};_0x2dae81[_0x4f1b12]={'$like':'%'+_0x5338d3[_0x9f94('0x46')]['filter']+'%'};return _0x2dae81;})});}_0x4101d7=_[_0x9f94('0x52')]({},_0x4101d7,_0x5338d3[_0x9f94('0x55')]);return db[_0x9f94('0x6a')][_0x9f94('0x31')]({'where':_0x4101d7['where']})[_0x9f94('0x37')](function(_0x1fdd33){_0x19bb31['count']=_0x1fdd33;if(_0x5338d3[_0x9f94('0x46')][_0x9f94('0x56')]){_0x4101d7[_0x9f94('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9f94('0x58')](_0x4101d7);})[_0x9f94('0x37')](function(_0x45e1c9){_0x19bb31['rows']=_0x45e1c9;return _0x19bb31;});}})[_0x9f94('0x37')](respondWithFilteredResult(_0x240118,_0x4101d7))[_0x9f94('0x29')](handleError(_0x240118,null));};exports[_0x9f94('0x6d')]=function(_0x258844,_0x29b2d1,_0x4bf36b){return db[_0x9f94('0x40')][_0x9f94('0x5a')]({'where':{'id':_0x258844['params']['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x29b2d1,null))[_0x9f94('0x37')](function(_0x5f4130){if(_0x5f4130){return _0x5f4130['removeAnswers'](_0x258844[_0x9f94('0x46')][_0x9f94('0x68')]);}})[_0x9f94('0x37')](respondWithStatusCode(_0x29b2d1,null))[_0x9f94('0x29')](handleError(_0x29b2d1,null));};exports[_0x9f94('0x6e')]=function(_0x5be731,_0x4a05d7,_0x25fd04){var _0x270180={'channel':'sms'};var _0x38d6d9=[];var _0x3e7d16=[];var _0x16a96f={};return db[_0x9f94('0x40')][_0x9f94('0x5a')]({'where':{'id':_0x5be731['params']['id']},'include':[{'model':db[_0x9f94('0x6f')],'as':_0x9f94('0x70')}]})[_0x9f94('0x37')](handleEntityNotFound(_0x4a05d7,null))[_0x9f94('0x37')](function(_0x312e58){_0x270180[_0x9f94('0x71')]=_0x312e58;_0x270180[_0x9f94('0x72')]=_[_0x9f94('0x73')](_0x312e58[_0x9f94('0x70')],['priority'],['asc']);if(_0x270180[_0x9f94('0x71')][_0x9f94('0x70')]){delete _0x270180[_0x9f94('0x71')]['Applications'];}return db[_0x9f94('0x74')]['describe']();})[_0x9f94('0x37')](function(_0x87e2d0){if(!_0x87e2d0){throw new db[(_0x9f94('0x75'))][(_0x9f94('0x76'))](_0x9f94('0x77'));}_0x38d6d9=_[_0x9f94('0x78')](_[_0x9f94('0x45')](_0x87e2d0),['createdAt','updatedAt']);_0x3e7d16=_[_0x9f94('0x78')](_['keys'](_0x87e2d0),[_0x9f94('0x79'),_0x9f94('0x7a'),_0x9f94('0x7b'),_0x9f94('0x7c')]);_0x270180[_0x9f94('0x61')]={'mapKey':_0x9f94('0x7d')};if(_0x270180[_0x9f94('0x71')][_0x9f94('0x42')]){switch(_0x270180['account'][_0x9f94('0x42')]){case'twilio':_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')]=_0x5be731['body'][_0x9f94('0x7f')];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x80')];_0x270180[_0x9f94('0x61')]['messageId']=_0x5be731['body']['MessageSid'];break;case _0x9f94('0x81'):_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')]='+'+_0x5be731[_0x9f94('0x61')]['sender'];_0x270180[_0x9f94('0x61')]['body']=_0x5be731['body'][_0x9f94('0x82')];break;case _0x9f94('0x83'):_0x270180['body'][_0x9f94('0x7e')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x7e')];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731[_0x9f94('0x61')]['message'];break;case'clicksend':_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')]=_0x5be731[_0x9f94('0x61')]['from'];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x61')];_0x270180[_0x9f94('0x61')]['messageId']=_0x5be731['body'][_0x9f94('0x84')];break;case _0x9f94('0x85'):_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x7f')];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x86')];_0x270180[_0x9f94('0x61')][_0x9f94('0x87')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x88')];break;case _0x9f94('0x89'):_0x270180['body'][_0x9f94('0x7e')]='+'+_0x5be731['body'][_0x9f94('0x8a')][0x0][_0x9f94('0x7e')];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x8a')][0x0]['text'];_0x270180[_0x9f94('0x61')][_0x9f94('0x87')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x8a')][0x0][_0x9f94('0x87')];break;case _0x9f94('0x8b'):_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')]=_0x5be731['body']['originatingAddress'];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731[_0x9f94('0x61')]['segmentedMessage']['message'];break;case'clickatell':_0x270180['body'][_0x9f94('0x7e')]=_0x5be731['body'][_0x9f94('0x8c')];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731['body'][_0x9f94('0x82')];_0x270180[_0x9f94('0x61')][_0x9f94('0x87')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x8d')];break;case _0x9f94('0x8e'):_0x270180['body']['messageId']=_0x5be731['body'][0x0]['message']['id'];_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')]=_0x5be731['body'][0x0][_0x9f94('0x27')][_0x9f94('0x7e')];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731[_0x9f94('0x61')][0x0][_0x9f94('0x27')][_0x9f94('0x82')];break;case'intelepeer':_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x7e')];_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]=_0x5be731[_0x9f94('0x61')][_0x9f94('0x27')];_0x270180[_0x9f94('0x61')][_0x9f94('0x87')]=_0x5be731['body'][_0x9f94('0x8f')];break;}}if(_0x270180[_0x9f94('0x61')]['id']){delete _0x270180['body']['id'];}if(_[_0x9f94('0x90')](_0x270180['body']['from'])){throw new db[(_0x9f94('0x75'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x9f94('0x90')](_0x270180[_0x9f94('0x61')]['body'])||_0x270180[_0x9f94('0x61')][_0x9f94('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0x9f94('0x91'));}if(_['isNil'](_0x270180[_0x9f94('0x61')]['mapKey'])){throw new db[(_0x9f94('0x75'))][(_0x9f94('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3e7d16);}if(!_['includes'](_0x3e7d16,_0x270180[_0x9f94('0x61')][_0x9f94('0x92')])){throw new db[(_0x9f94('0x75'))][(_0x9f94('0x76'))](_0x9f94('0x93')+_0x3e7d16);}_0x16a96f[_0x270180[_0x9f94('0x61')]['mapKey']]=_0x270180['body'][_0x9f94('0x7e')];return db[_0x9f94('0x94')]['find']({'where':{'id':_0x270180[_0x9f94('0x71')][_0x9f94('0x7c')]},'include':[{'model':db['CmContact'],'as':_0x9f94('0x95'),'where':_0x16a96f,'limit':0x1,'order':[['updatedAt',_0x9f94('0x96')]]}]});})['then'](handleEntityNotFound(_0x4a05d7,null))[_0x9f94('0x37')](function(_0x3b80cb){if(_0x3b80cb){_0x270180[_0x9f94('0x97')]=_[_0x9f94('0x98')](_0x3b80cb,[_0x9f94('0x95')]);if(_0x3b80cb[_0x9f94('0x95')][_0x9f94('0x4b')]){return _0x3b80cb[_0x9f94('0x95')][0x0];}var _0x17461c=_[_0x9f94('0x17')](_0x270180[_0x9f94('0x61')],{'firstName':_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')],'ListId':_0x3b80cb['id']});_0x17461c[_0x270180[_0x9f94('0x61')][_0x9f94('0x92')]]=_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')];return db['CmContact']['create'](_0x17461c,{'fields':_0x38d6d9,'raw':!![]});}})['then'](handleEntityNotFound(_0x4a05d7,null))[_0x9f94('0x37')](function(_0x3133c3){if(_0x3133c3){_0x270180[_0x9f94('0x99')]=_0x3133c3;var _0xa057b2={'ContactId':_0x3133c3['id'],'phone':_0x270180[_0x9f94('0x61')][_0x9f94('0x7e')],'SmsAccountId':_0x5be731[_0x9f94('0x62')]['id']};var _0x26a6a2={'ContactId':_0x3133c3['id'],'SmsAccountId':_0x5be731['params']['id'],'closed':![]};return db['SmsInteraction'][_0x9f94('0x5a')]({'where':_0x26a6a2})[_0x9f94('0x37')](function(_0x53a1af){if(_0x53a1af){return[_0x53a1af,![]];}return db[_0x9f94('0x9a')][_0x9f94('0x5b')](_0xa057b2)[_0x9f94('0x37')](function(_0x2399dc){return[_0x2399dc,!![]];});});}})[_0x9f94('0x9b')](function(_0x2cf3ad,_0x197211){_0x270180['interaction']=_0x2cf3ad['get']({'plain':!![]});_0x270180[_0x9f94('0x9c')][_0x9f94('0x9d')]=![];if(_0x197211){if(_0x270180[_0x9f94('0x71')]['autoclose']){_0x270180['applications']['push']({'id':0x0,'priority':_0x270180[_0x9f94('0x72')]['length']+0x1,'app':_0x9f94('0x9e'),'appdata':_0x9f94('0x9f'),'interval':'*,*,*,*'});}_0x270180[_0x9f94('0x9c')]['created']=!![];}return db[_0x9f94('0xa0')][_0x9f94('0x5b')]({'phone':_0x270180[_0x9f94('0x61')]['from'],'messageId':_0x270180['body']['messageId'],'body':_0x270180[_0x9f94('0x61')][_0x9f94('0x61')],'SmsAccountId':_0x5be731[_0x9f94('0x62')]['id'],'SmsInteractionId':_0x2cf3ad['id'],'direction':'in','ContactId':_0x2cf3ad[_0x9f94('0xa1')],'AttachmentId':_0x270180[_0x9f94('0x61')][_0x9f94('0xa2')]});})['then'](function(_0x1e35f0){_0x270180['message']=_0x1e35f0;if(_0x270180[_0x9f94('0x9c')]['UserId']){return db[_0x9f94('0xa3')]['find']({'attributes':['id',_0x9f94('0x54')],'where':{'id':_0x270180[_0x9f94('0x9c')][_0x9f94('0xa4')]}})['then'](function(_0x22b82c){if(_0x22b82c){_0x270180[_0x9f94('0x72')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9f94('0xa5'),'appdata':_0x22b82c[_0x9f94('0x54')]+','+(_0x270180['account']['waitForTheAssignedAgent']||0xa),'interval':_0x9f94('0xa6')});}return respondWithRpcPromise('Start',_0x9f94('0xa7'),_0x270180);});}return respondWithRpcPromise('Start',_0x9f94('0xa7'),_0x270180);})[_0x9f94('0x37')](function(_0x6bd883){if(_0x6bd883){var _0x4dbd30=0xc8;var _0x42fcda=_0x9f94('0xa8');logger[_0x9f94('0x20')](_0x9f94('0x23'),_0x42fcda,_0x4dbd30,_0x9f94('0xa9'));logger[_0x9f94('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x42fcda,_0x4dbd30,_0x9f94('0xa9'),JSON['stringify'](_0x6bd883));if(_0x270180[_0x9f94('0x71')][_0x9f94('0x42')]==='twilio'){return _0x4a05d7['status'](_0x4dbd30)[_0x9f94('0x32')](_0x9f94('0xaa'),_0x9f94('0xab'))[_0x9f94('0xac')]('\x0a');}else{return _0x4a05d7[_0x9f94('0x2c')](_0x4dbd30)['json'](_0x6bd883);}}})[_0x9f94('0x29')](handleError(_0x4a05d7,null));};exports[_0x9f94('0xad')]=function(_0x129ca5,_0x5664c8){var _0x275e3d=_0x129ca5['params']['id'];var _0x1bad27=_0x129ca5[_0x9f94('0x61')];var _0x47d84c=0xc8;var _0x287eb7=null;return db[_0x9f94('0xae')][_0x9f94('0xaf')]({'isolationLevel':db[_0x9f94('0xae')][_0x9f94('0xb0')][_0x9f94('0xb1')][_0x9f94('0xb2')]},function(_0x1e9d9d){return db[_0x9f94('0x40')][_0x9f94('0x6c')]({'where':{'id':_0x275e3d},'transaction':_0x1e9d9d})[_0x9f94('0x37')](function(_0x2f6538){if(_0x2f6538){return db[_0x9f94('0x6f')][_0x9f94('0x38')]({'where':{'SmsAccountId':_0x275e3d},'transaction':_0x1e9d9d})['then'](function(){var _0x3a44d7=_['map'](_0x1bad27,function(_0x331f91){_0x331f91['SmsAccountId']=_0x275e3d;return _0x331f91;});return db['SmsApplication'][_0x9f94('0xb3')](_0x3a44d7,{'transaction':_0x1e9d9d});});}else{_0x47d84c=0x194;_0x287eb7=[];}});})[_0x9f94('0x37')](function(){if(_0x47d84c!==0x194){return db[_0x9f94('0x6f')][_0x9f94('0xb4')]({'where':{'SmsAccountId':_0x275e3d},'order':_0x9f94('0xb5')})[_0x9f94('0x37')](function(_0x492d46){_0x287eb7=_0x492d46;});}})[_0x9f94('0x29')](function(_0x196a32){_0x47d84c=0x1f4;logger[_0x9f94('0x25')](_0x196a32[_0x9f94('0xb6')]);if(_0x196a32[_0x9f94('0x54')]){delete _0x196a32[_0x9f94('0x54')];}_0x287eb7=_0x196a32;})[_0x9f94('0xb7')](function(){if(_0x287eb7===null){_0x5664c8['sendStatus'](_0x47d84c);}else{if(_0x47d84c===0x1f4){_0x5664c8[_0x9f94('0x2c')](_0x47d84c)[_0x9f94('0xac')](_0x287eb7);}else{_0x5664c8[_0x9f94('0x2c')](_0x47d84c)['json'](_0x287eb7);}}});};exports['getApplications']=function(_0x2d054f,_0x21f542,_0x215855){var _0x30e681={};var _0x3f5424={};var _0x515edf;var _0x7e605e;return db[_0x9f94('0x40')]['findOne']({'where':{'id':_0x2d054f[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x21f542,null))[_0x9f94('0x37')](function(_0x46e61a){if(_0x46e61a){_0x515edf=_0x46e61a;_0x3f5424[_0x9f94('0x44')]=_['keys'](db['SmsApplication'][_0x9f94('0x59')]);_0x3f5424[_0x9f94('0x46')]=_['keys'](_0x2d054f[_0x9f94('0x46')]);_0x3f5424[_0x9f94('0x47')]=_['intersection'](_0x3f5424[_0x9f94('0x44')],_0x3f5424[_0x9f94('0x46')]);_0x30e681[_0x9f94('0x49')]=_[_0x9f94('0x48')](_0x3f5424[_0x9f94('0x44')],qs['fields'](_0x2d054f[_0x9f94('0x46')][_0x9f94('0x4a')]));_0x30e681[_0x9f94('0x49')]=_0x30e681[_0x9f94('0x49')][_0x9f94('0x4b')]?_0x30e681[_0x9f94('0x49')]:_0x3f5424[_0x9f94('0x44')];_0x30e681['order']=qs[_0x9f94('0x4e')](_0x2d054f['query'][_0x9f94('0x4e')]);_0x30e681[_0x9f94('0x4f')]=qs[_0x9f94('0x47')](_[_0x9f94('0x50')](_0x2d054f[_0x9f94('0x46')],_0x3f5424[_0x9f94('0x47')]));if(_0x2d054f[_0x9f94('0x46')][_0x9f94('0x51')]){_0x30e681[_0x9f94('0x4f')]=_['merge'](_0x30e681[_0x9f94('0x4f')],{'$or':_[_0x9f94('0x3f')](_0x30e681['attributes'],function(_0x40bf04){var _0x339ef7={};_0x339ef7[_0x40bf04]={'$like':'%'+_0x2d054f['query'][_0x9f94('0x51')]+'%'};return _0x339ef7;})});}_0x30e681=_[_0x9f94('0x52')]({},_0x30e681,_0x2d054f[_0x9f94('0x55')]);return _0x515edf[_0x9f94('0xb8')](_0x30e681);}})[_0x9f94('0x37')](function(_0x37f1e6){if(_0x37f1e6){_0x7e605e=_0x37f1e6[_0x9f94('0x4b')];if(!_0x2d054f['query'][_0x9f94('0x66')](_0x9f94('0x4c'))){_0x30e681[_0x9f94('0x30')]=qs[_0x9f94('0x30')](_0x2d054f[_0x9f94('0x46')]['limit']);_0x30e681[_0x9f94('0x2e')]=qs['offset'](_0x2d054f['query'][_0x9f94('0x2e')]);}return _0x515edf[_0x9f94('0xb8')](_0x30e681);}})[_0x9f94('0x37')](function(_0x4f5bdc){if(_0x4f5bdc){return _0x4f5bdc?{'count':_0x7e605e,'rows':_0x4f5bdc}:null;}})['then'](respondWithResult(_0x21f542,null))[_0x9f94('0x29')](handleError(_0x21f542,null));};exports[_0x9f94('0xb9')]=function(_0x20ad5c,_0x1bcccc,_0x508b3d){var _0x4a377d={'raw':![],'where':{}};var _0xf5e06b={};var _0x5f4ddf={'count':0x0,'rows':[]};return db[_0x9f94('0x40')][_0x9f94('0x6c')]({'where':{'id':_0x20ad5c[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x1bcccc,null))[_0x9f94('0x37')](function(_0x1a91b8){if(_0x1a91b8){_0xf5e06b[_0x9f94('0x44')]=_[_0x9f94('0x45')](db['SmsInteraction'][_0x9f94('0x59')]);_0xf5e06b[_0x9f94('0x46')]=_['keys'](_0x20ad5c[_0x9f94('0x46')]);_0xf5e06b['filters']=_[_0x9f94('0x48')](_0xf5e06b[_0x9f94('0x44')],_0xf5e06b[_0x9f94('0x46')]);_0x4a377d[_0x9f94('0x49')]=_[_0x9f94('0x48')](_0xf5e06b[_0x9f94('0x44')],qs[_0x9f94('0x4a')](_0x20ad5c[_0x9f94('0x46')][_0x9f94('0x4a')]));_0x4a377d['attributes']=_0x4a377d[_0x9f94('0x49')][_0x9f94('0x4b')]?_0x4a377d[_0x9f94('0x49')]:_0xf5e06b[_0x9f94('0x44')];if(!_0x20ad5c['query']['hasOwnProperty'](_0x9f94('0x4c'))){_0x4a377d[_0x9f94('0x30')]=qs[_0x9f94('0x30')](_0x20ad5c['query'][_0x9f94('0x30')]);_0x4a377d[_0x9f94('0x2e')]=qs[_0x9f94('0x2e')](_0x20ad5c[_0x9f94('0x46')][_0x9f94('0x2e')]);}_0x4a377d[_0x9f94('0x4d')]=qs[_0x9f94('0x4e')](_0x20ad5c[_0x9f94('0x46')][_0x9f94('0x4e')]);_0x4a377d[_0x9f94('0x4f')]=qs[_0x9f94('0x47')](_[_0x9f94('0x50')](_0x20ad5c[_0x9f94('0x46')],_0xf5e06b[_0x9f94('0x47')]));_0x4a377d[_0x9f94('0x4f')][_0x9f94('0x63')]=_0x1a91b8['id'];if(_0x20ad5c['query'][_0x9f94('0x51')]){_0x4a377d['where']=_[_0x9f94('0x52')](_0x4a377d[_0x9f94('0x4f')],{'$or':_[_0x9f94('0x3f')](_0x4a377d[_0x9f94('0x49')],function(_0x33feea){var _0x3155be={};_0x3155be[_0x33feea]={'$like':'%'+_0x20ad5c[_0x9f94('0x46')][_0x9f94('0x51')]+'%'};return _0x3155be;})});}_0x4a377d=_[_0x9f94('0x52')]({},_0x4a377d,_0x20ad5c['options']);return db[_0x9f94('0x9a')]['count']({'where':_0x4a377d[_0x9f94('0x4f')]})[_0x9f94('0x37')](function(_0x3ac1a6){_0x5f4ddf[_0x9f94('0x31')]=_0x3ac1a6;if(_0x20ad5c[_0x9f94('0x46')][_0x9f94('0x56')]){_0x4a377d[_0x9f94('0x57')]=[{'model':db[_0x9f94('0x74')],'as':_0x9f94('0xba'),'required':![]},{'model':db['User'],'as':_0x9f94('0xbb'),'attributes':[_0x9f94('0x54'),_0x9f94('0xbc'),_0x9f94('0xbd')],'required':![]},{'model':db[_0x9f94('0xbe')],'as':'Tags','attributes':['id','name',_0x9f94('0xbf')],'where':_0x20ad5c[_0x9f94('0x46')][_0x9f94('0xc0')]?{'id':_0x20ad5c[_0x9f94('0x46')]['tag']}:undefined,'required':_0x20ad5c[_0x9f94('0x46')][_0x9f94('0xc0')]?!![]:![]}];}return db[_0x9f94('0x9a')]['findAll'](_0x4a377d);})[_0x9f94('0x37')](function(_0x25c05b){_0x5f4ddf[_0x9f94('0xc1')]=_0x25c05b;return _0x5f4ddf;});}})['then'](respondWithFilteredResult(_0x1bcccc,_0x4a377d))[_0x9f94('0x29')](handleError(_0x1bcccc,null));};exports['send']=function(_0x5f15f1,_0x246b5b,_0x481f00){var _0x31b758,_0x5b11a2,_0x48d058;if(_[_0x9f94('0x90')](_0x5f15f1['body'][_0x9f94('0x61')])||_0x5f15f1[_0x9f94('0x61')]['body']===''){throw new db['Sequelize'][(_0x9f94('0x76'))](_0x9f94('0x91'));}if(_[_0x9f94('0x90')](_0x5f15f1['body']['to'])){throw new db[(_0x9f94('0x75'))][(_0x9f94('0x76'))]('to\x20is\x20mandatory');}_0x31b758=_0x5f15f1[_0x9f94('0x61')]['to'];return db['SmsAccount'][_0x9f94('0x5a')]({'where':{'id':_0x5f15f1['params']['id']},'include':[{'model':db[_0x9f94('0x94')],'as':_0x9f94('0xc2'),'include':[{'model':db[_0x9f94('0x74')],'as':_0x9f94('0x95'),'where':{'mobile':_0x31b758},'limit':0x1,'order':[[_0x9f94('0x7a'),_0x9f94('0x96')]]}]}]})['then'](handleEntityNotFound(_0x246b5b,null))[_0x9f94('0x37')](function(_0xdd117a){if(_0xdd117a&&_0xdd117a[_0x9f94('0xc2')]){_0x5b11a2=_0xdd117a[_0x9f94('0x39')]({'plain':!![]});if(_0x5b11a2[_0x9f94('0xc2')]&&_0x5b11a2[_0x9f94('0xc2')]['Contacts'][_0x9f94('0x4b')]){return _0x5b11a2[_0x9f94('0xc2')][_0x9f94('0x95')][0x0];}return db[_0x9f94('0x74')][_0x9f94('0x5b')](_['defaults'](_0x5f15f1[_0x9f94('0x61')],{'firstName':_0x31b758,'mobile':_0x31b758,'phone':_0x31b758,'ListId':_0x5b11a2[_0x9f94('0x7c')]}));}})[_0x9f94('0x37')](handleEntityNotFound(_0x246b5b,null))[_0x9f94('0x37')](function(_0x45763a){if(_0x45763a){_0x48d058=_0x45763a;return db['SmsInteraction'][_0x9f94('0x5a')]({'where':{'ContactId':_0x48d058['id'],'closed':![],'SmsAccountId':_0x5b11a2['id']}})[_0x9f94('0x37')](function(_0x27af1d){if(_0x27af1d){return[_0x27af1d,![]];}return db[_0x9f94('0x9a')][_0x9f94('0x5b')]({'UserId':_0x5f15f1['user']['id'],'ContactId':_0x48d058['id'],'SmsAccountId':_0x5b11a2['id'],'phone':_0x31b758,'firstMsgDirection':_0x9f94('0xc3'),'Messages':[_['merge'](_0x5f15f1[_0x9f94('0x61')],{'read':![],'body':_0x5f15f1[_0x9f94('0x61')]['body'],'phone':_0x31b758,'SmsAccountId':_0x5b11a2['id'],'UserId':_0x5f15f1[_0x9f94('0x5c')]['id'],'ContactId':_0x48d058['id']})]},{'include':[{'model':db[_0x9f94('0xa0')],'as':_0x9f94('0xc4')}]})[_0x9f94('0x37')](function(_0x4872be){return[_0x4872be,!![]];});});}})[_0x9f94('0x9b')](function(_0x51e4a5,_0x3576d6){if(_0x3576d6){return _0x51e4a5;}return db['SmsMessage'][_0x9f94('0x5b')](_[_0x9f94('0x52')](_0x5f15f1['body'],{'read':![],'body':_0x5f15f1[_0x9f94('0x61')][_0x9f94('0x61')],'phone':_0x31b758,'SmsAccountId':_0x5b11a2['id'],'SmsInteractionId':_0x51e4a5['id'],'UserId':_0x5f15f1[_0x9f94('0x5c')]['id'],'ContactId':_0x48d058['id']}))[_0x9f94('0x37')](function(_0x4cb33f){_0x51e4a5[_0x9f94('0xc5')][_0x9f94('0xc4')]=[];_0x51e4a5[_0x9f94('0xc5')][_0x9f94('0xc4')][_0x9f94('0xc6')](_0x4cb33f['dataValues']);return _0x51e4a5;});})['then'](respondWithResult(_0x246b5b,null))['catch'](handleError(_0x246b5b,null));};exports[_0x9f94('0x2c')]=function(_0x4cae79,_0x373c4b,_0x5ccabe){if(_0x4cae79['body']['id']){delete _0x4cae79[_0x9f94('0x61')]['id'];}var _0x3d273e,_0x328323,_0x2c6227;return db[_0x9f94('0x40')][_0x9f94('0x5a')]({'where':{'id':_0x4cae79['params']['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x373c4b,null))[_0x9f94('0x37')](function(_0x247713){if(_0x247713){_0x2c6227=_0x247713;logger['debug'](_0x9f94('0x23'),_0x9f94('0x2c'),_0x9f94('0xc7'),_0x247713[_0x9f94('0x42')],util[_0x9f94('0xc8')](_0x4cae79[_0x9f94('0x61')],{'showHidden':![],'depth':null}));switch(_0x247713[_0x9f94('0x42')]){case _0x9f94('0x81'):if(_0x4cae79[_0x9f94('0x61')]['skebby_dispatch_id']&&_0x4cae79[_0x9f94('0x61')][_0x9f94('0x2c')]){_0x328323=_0x4cae79['body'][_0x9f94('0x2c')];return db[_0x9f94('0xa0')][_0x9f94('0x5a')]({'where':{'messageId':_0x4cae79[_0x9f94('0x61')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x4cae79['body'][_0x9f94('0xc9')]&&_0x4cae79['body'][_0x9f94('0xca')]){_0x328323=_0x4cae79[_0x9f94('0x61')][_0x9f94('0xca')];return db[_0x9f94('0xa0')][_0x9f94('0x5a')]({'where':{'messageId':_0x4cae79[_0x9f94('0x61')][_0x9f94('0xc9')]}});}break;case _0x9f94('0xcb'):if(_0x4cae79['body']['message_id']&&_0x4cae79[_0x9f94('0x61')][_0x9f94('0xcc')]){_0x328323=_0x4cae79[_0x9f94('0x61')]['status_code'];return db['SmsMessage'][_0x9f94('0x5a')]({'where':{'messageId':_0x4cae79[_0x9f94('0x61')]['message_id']}});}break;case _0x9f94('0x89'):var _0x5243e6=_0x4cae79[_0x9f94('0x61')]['results'][0x0];if(_0x5243e6['messageId']&&_0x5243e6[_0x9f94('0x2c')][_0x9f94('0xcd')]===_0x9f94('0xce')){_0x328323=_0x5243e6[_0x9f94('0x2c')][_0x9f94('0xcd')];return db[_0x9f94('0xa0')]['find']({'where':{'messageId':_0x5243e6['messageId']}});}break;case'clickatell':if(_0x4cae79[_0x9f94('0x61')][_0x9f94('0x87')]&&_0x4cae79[_0x9f94('0x61')][_0x9f94('0x2c')]){_0x328323=_0x4cae79[_0x9f94('0x61')][_0x9f94('0x2c')];return db[_0x9f94('0xa0')][_0x9f94('0x5a')]({'where':{'messageId':_0x4cae79[_0x9f94('0x61')][_0x9f94('0x87')]}});}break;case _0x9f94('0x8e'):if(_0x4cae79['body'][0x0][_0x9f94('0x27')]['id']){_0x328323=_0x4cae79['body'][0x0]['type'];return db[_0x9f94('0xa0')][_0x9f94('0x5a')]({'where':{'messageId':_0x4cae79[_0x9f94('0x61')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x4cae79['body'][_0x9f94('0xcf')]&&_0x4cae79[_0x9f94('0x61')][_0x9f94('0x2c')]){_0x328323=_0x4cae79[_0x9f94('0x61')][_0x9f94('0x2c')];return db[_0x9f94('0xa0')][_0x9f94('0x5a')]({'where':{'messageId':_0x4cae79[_0x9f94('0x61')]['redif']}});}break;}}})[_0x9f94('0x37')](handleEntityNotFound(_0x373c4b,null))[_0x9f94('0x37')](function(_0x42022a){if(_0x42022a){_0x3d273e=_0x42022a;switch(_0x2c6227[_0x9f94('0x42')]){case _0x9f94('0x81'):if(_0x328323===_0x9f94('0xce')){return _0x3d273e[_0x9f94('0x36')]({'read':!![]});}else{logger[_0x9f94('0x25')](_0x9f94('0x23'),_0x9f94('0x2c'),'skebby',util['inspect'](_0x4cae79['body'],{'showHidden':![],'depth':null}));}break;case _0x9f94('0x83'):if(_0x328323==='1'){return _0x3d273e[_0x9f94('0x36')]({'read':!![]});}else{logger[_0x9f94('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9f94('0x2c'),'skebby',util[_0x9f94('0xc8')](_0x4cae79['body'],{'showHidden':![],'depth':null}));}break;case _0x9f94('0xcb'):if(!_0x4cae79['body'][_0x9f94('0xd0')]&&_0x328323>=0xc8&&_0x328323<=0xce){return _0x3d273e['update']({'read':!![]});}else{logger['error'](_0x9f94('0x23'),_0x9f94('0x2c'),'clicksend',util['inspect'](_0x4cae79[_0x9f94('0x61')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4f410d=_0x4cae79[_0x9f94('0x61')][_0x9f94('0x8a')][0x0];if(_0x4f410d[_0x9f94('0x2c')]['groupName']==='DELIVERED'){return _0x3d273e[_0x9f94('0x36')]({'read':!![]});}else{logger[_0x9f94('0x25')](_0x9f94('0x23'),_0x9f94('0x2c'),'infobip',util['inspect'](_0x4cae79[_0x9f94('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9f94('0xd1'):if(_0x328323==_0x9f94('0xd2')||_0x328323==_0x9f94('0xd3')){return _0x3d273e[_0x9f94('0x36')]({'read':!![]});}else{logger[_0x9f94('0x25')](_0x9f94('0x23'),_0x9f94('0x2c'),_0x9f94('0xd1'),util[_0x9f94('0xc8')](_0x4cae79[_0x9f94('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9f94('0x8e'):if(_0x328323=='message-delivered'){return _0x3d273e[_0x9f94('0x36')]({'read':!![]});}else{logger[_0x9f94('0x25')](_0x9f94('0x23'),_0x9f94('0x2c'),_0x9f94('0x8e'),util[_0x9f94('0xc8')](_0x4cae79[_0x9f94('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9f94('0xd4'):if(_0x328323===_0x9f94('0xd5')||_0x328323==='ACCEPTD'){return _0x3d273e[_0x9f94('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9f94('0x2c'),_0x9f94('0xd4'),util[_0x9f94('0xc8')](_0x4cae79[_0x9f94('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x3d273e;}})['then'](respondWithResult(_0x373c4b,null))[_0x9f94('0x29')](handleError(_0x373c4b,null));};exports['statusGet']=function(_0x5eb3fa,_0x783ac9,_0x19ce52){var _0x12ce5c,_0x5b4303,_0x91fd1f;return db['SmsAccount'][_0x9f94('0x5a')]({'where':{'id':_0x5eb3fa[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x783ac9,null))[_0x9f94('0x37')](function(_0x5a6ae8){if(_0x5a6ae8){_0x91fd1f=_0x5a6ae8;logger[_0x9f94('0x22')](_0x9f94('0x23'),_0x9f94('0x2c'),_0x9f94('0xc7'),_0x5a6ae8[_0x9f94('0x42')],util['inspect'](_0x5eb3fa['query'],{'showHidden':![],'depth':null}));switch(_0x5a6ae8[_0x9f94('0x42')]){case _0x9f94('0x8b'):if(_0x5eb3fa[_0x9f94('0x46')][_0x9f94('0xd6')]&&_0x5eb3fa[_0x9f94('0x46')][_0x9f94('0xd7')]){_0x5b4303=_0x5eb3fa[_0x9f94('0x46')][_0x9f94('0xd7')];return db['SmsMessage'][_0x9f94('0x5a')]({'where':{'messageId':_0x5eb3fa[_0x9f94('0x46')][_0x9f94('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x783ac9,null))[_0x9f94('0x37')](function(_0x518617){if(_0x518617){_0x12ce5c=_0x518617;switch(_0x91fd1f[_0x9f94('0x42')]){case'csc':if(_0x5b4303==='2'||_0x5b4303==='6'){return _0x12ce5c['update']({'read':!![]});}else{logger[_0x9f94('0x25')](_0x9f94('0x23'),_0x9f94('0x2c'),_0x9f94('0x8b'),util['inspect'](_0x5eb3fa[_0x9f94('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x12ce5c;}})[_0x9f94('0x37')](respondWithResult(_0x783ac9,null))['catch'](handleError(_0x783ac9,null));};exports[_0x9f94('0xd8')]=function(_0x5ad19a,_0x50575d,_0x475174){return db['SmsAccount']['find']({'where':{'id':_0x5ad19a[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x50575d,null))[_0x9f94('0x37')](function(_0x509109){if(_0x509109){return _0x509109['addAgents'](_0x5ad19a['body'][_0x9f94('0x68')],_[_0x9f94('0x98')](_0x5ad19a['body'],[_0x9f94('0x68'),'id'])||{})[_0x9f94('0x9b')](function(_0x402eef){for(var _0x436e72=0x0;_0x436e72<_0x5ad19a[_0x9f94('0x61')]['ids'][_0x9f94('0x4b')];_0x436e72+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x5ad19a[_0x9f94('0x61')]['ids'][_0x436e72]),'SmsAccountId':Number(_0x5ad19a[_0x9f94('0x62')]['id'])});}return _0x402eef;});}})[_0x9f94('0x37')](respondWithResult(_0x50575d,null))['catch'](handleError(_0x50575d,null));};exports[_0x9f94('0xd9')]=function(_0x205325,_0x36d54a,_0x1b5f4c){return db[_0x9f94('0x40')][_0x9f94('0x5a')]({'where':{'id':_0x205325[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x36d54a,null))['then'](function(_0x15b220){if(_0x15b220){return _0x15b220['removeAgents'](_0x205325[_0x9f94('0x46')][_0x9f94('0x68')])[_0x9f94('0x37')](function(){if(_[_0x9f94('0xda')](_0x205325['query'][_0x9f94('0x68')])){for(var _0x1db133=0x0;_0x1db133<_0x205325[_0x9f94('0x46')][_0x9f94('0x68')][_0x9f94('0x4b')];_0x1db133+=0x1){socket[_0x9f94('0xdb')](_0x9f94('0xdc'),{'UserId':Number(_0x205325[_0x9f94('0x46')][_0x9f94('0x68')][_0x1db133]),'SmsAccountId':Number(_0x205325[_0x9f94('0x62')]['id'])});}}else{socket[_0x9f94('0xdb')](_0x9f94('0xdc'),{'UserId':Number(_0x205325['query'][_0x9f94('0x68')]),'SmsAccountId':Number(_0x205325[_0x9f94('0x62')]['id'])});}});}})[_0x9f94('0x37')](respondWithStatusCode(_0x36d54a,null))[_0x9f94('0x29')](handleError(_0x36d54a,null));};exports[_0x9f94('0xdd')]=function(_0x2ebca2,_0x5e1cb7,_0x505705){var _0x367334={};var _0x51e2cf={};var _0x4d0963;var _0x39fd4d;return db[_0x9f94('0x40')][_0x9f94('0x6c')]({'where':{'id':_0x2ebca2[_0x9f94('0x62')]['id']}})[_0x9f94('0x37')](handleEntityNotFound(_0x5e1cb7,null))[_0x9f94('0x37')](function(_0x2081ed){if(_0x2081ed){_0x4d0963=_0x2081ed;_0x51e2cf[_0x9f94('0x44')]=_[_0x9f94('0x45')](db[_0x9f94('0xa3')][_0x9f94('0x59')]);_0x51e2cf['query']=_[_0x9f94('0x45')](_0x2ebca2[_0x9f94('0x46')]);_0x51e2cf[_0x9f94('0x47')]=_[_0x9f94('0x48')](_0x51e2cf[_0x9f94('0x44')],_0x51e2cf[_0x9f94('0x46')]);_0x367334['attributes']=_[_0x9f94('0x48')](_0x51e2cf['model'],qs['fields'](_0x2ebca2[_0x9f94('0x46')][_0x9f94('0x4a')]));_0x367334['attributes']=_0x367334['attributes'][_0x9f94('0x4b')]?_0x367334[_0x9f94('0x49')]:_0x51e2cf['model'];_0x367334[_0x9f94('0x4d')]=qs[_0x9f94('0x4e')](_0x2ebca2[_0x9f94('0x46')][_0x9f94('0x4e')]);_0x367334['where']=qs['filters'](_[_0x9f94('0x50')](_0x2ebca2[_0x9f94('0x46')],_0x51e2cf[_0x9f94('0x47')]));if(_0x2ebca2[_0x9f94('0x46')][_0x9f94('0x51')]){_0x367334['where']=_['merge'](_0x367334[_0x9f94('0x4f')],{'$or':_[_0x9f94('0x3f')](_0x367334[_0x9f94('0x49')],function(_0x280e05){var _0x227343={};_0x227343[_0x280e05]={'$like':'%'+_0x2ebca2[_0x9f94('0x46')][_0x9f94('0x51')]+'%'};return _0x227343;})});}_0x367334=_[_0x9f94('0x52')]({},_0x367334,_0x2ebca2[_0x9f94('0x55')]);return _0x4d0963['getAgents'](_0x367334);}})[_0x9f94('0x37')](function(_0x55dfa0){if(_0x55dfa0){_0x39fd4d=_0x55dfa0[_0x9f94('0x4b')];if(!_0x2ebca2['query'][_0x9f94('0x66')](_0x9f94('0x4c'))){_0x367334[_0x9f94('0x30')]=qs[_0x9f94('0x30')](_0x2ebca2[_0x9f94('0x46')][_0x9f94('0x30')]);_0x367334[_0x9f94('0x2e')]=qs[_0x9f94('0x2e')](_0x2ebca2[_0x9f94('0x46')][_0x9f94('0x2e')]);}return _0x4d0963[_0x9f94('0xdd')](_0x367334);}})['then'](function(_0x151956){if(_0x151956){return _0x151956?{'count':_0x39fd4d,'rows':_0x151956}:null;}})[_0x9f94('0x37')](respondWithResult(_0x5e1cb7,null))[_0x9f94('0x29')](handleError(_0x5e1cb7,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 75d8ef8..b55664c 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 _0x0983=['hook','exports','events','SmsAccount','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x433ab5,_0x16e711){var _0x315911=function(_0x2d24a2){while(--_0x2d24a2){_0x433ab5['push'](_0x433ab5['shift']());}};_0x315911(++_0x16e711);}(_0x0983,0x16a));var _0x3098=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0983[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x3098('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x3098('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3098('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3098('0x3'),'afterDestroy':'remove'};function emitEvent(_0x146ad4){return function(_0x1490d9,_0x3ae967,_0x3ed8cc){SmsAccountEvents[_0x3098('0x4')](_0x146ad4+':'+_0x1490d9['id'],_0x1490d9);SmsAccountEvents['emit'](_0x146ad4,_0x1490d9);_0x3ed8cc(null);};}for(var e in events){if(events[_0x3098('0x5')](e)){var event=events[e];SmsAccount[_0x3098('0x6')](e,emitEvent(event));}}module[_0x3098('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x9b2e=['exports','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5a9ece,_0x2c7bcc){var _0x46e337=function(_0x22ffa5){while(--_0x22ffa5){_0x5a9ece['push'](_0x5a9ece['shift']());}};_0x46e337(++_0x2c7bcc);}(_0x9b2e,0x111));var _0xe9b2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9b2e[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0xe9b2('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe9b2('0x1')](0x0);var events={'afterCreate':_0xe9b2('0x2'),'afterUpdate':_0xe9b2('0x3'),'afterDestroy':_0xe9b2('0x4')};function emitEvent(_0x472dc0){return function(_0x7dd47f,_0x3af353,_0x20046e){SmsAccountEvents[_0xe9b2('0x5')](_0x472dc0+':'+_0x7dd47f['id'],_0x7dd47f);SmsAccountEvents[_0xe9b2('0x5')](_0x472dc0,_0x7dd47f);_0x20046e(null);};}for(var e in events){if(events[_0xe9b2('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xe9b2('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 1d9062b..c72280b 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 _0xd27c=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','api','moment'];(function(_0xd8a3c1,_0x5780bd){var _0x28cad0=function(_0x51850f){while(--_0x51850f){_0xd8a3c1['push'](_0xd8a3c1['shift']());}};_0x28cad0(++_0x5780bd);}(_0xd27c,0x1e8));var _0xcd27=function(_0x411069,_0x16ae05){_0x411069=_0x411069-0x0;var _0x68c645=_0xd27c[_0x411069];return _0x68c645;};'use strict';var _=require(_0xcd27('0x0'));var util=require(_0xcd27('0x1'));var logger=require('../../config/logger')(_0xcd27('0x2'));var moment=require(_0xcd27('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd27('0x4'));var fs=require('fs');var path=require(_0xcd27('0x5'));var rimraf=require(_0xcd27('0x6'));var config=require(_0xcd27('0x7'));var attributes=require(_0xcd27('0x8'));module['exports']=function(_0x42911e,_0x3f8fef){return _0x42911e[_0xcd27('0x9')](_0xcd27('0xa'),attributes,{'tableName':_0xcd27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf379=['define','SmsAccount','lodash','../../config/logger','api','moment','./smsAccount.attributes'];(function(_0x242e41,_0x2beb78){var _0x171510=function(_0x4d8a5a){while(--_0x4d8a5a){_0x242e41['push'](_0x242e41['shift']());}};_0x171510(++_0x2beb78);}(_0xf379,0xcd));var _0x9f37=function(_0x3c0507,_0x303e8f){_0x3c0507=_0x3c0507-0x0;var _0x2fd6f6=_0xf379[_0x3c0507];return _0x2fd6f6;};'use strict';var _=require(_0x9f37('0x0'));var util=require('util');var logger=require(_0x9f37('0x1'))(_0x9f37('0x2'));var moment=require(_0x9f37('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f37('0x4'));module['exports']=function(_0x249a41,_0x107cb8){return _0x249a41[_0x9f37('0x5')](_0x9f37('0x6'),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 060e1db..c141dbb 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 _0x1334=['map','model','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where','include'];(function(_0x279918,_0x50c942){var _0x43db3e=function(_0x4fe927){while(--_0x4fe927){_0x279918['push'](_0x279918['shift']());}};_0x43db3e(++_0x50c942);}(_0x1334,0xa0));var _0x4133=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x1334[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x4133('0x0'));var util=require(_0x4133('0x1'));var moment=require(_0x4133('0x2'));var BPromise=require(_0x4133('0x3'));var rs=require(_0x4133('0x4'));var fs=require('fs');var Redis=require(_0x4133('0x5'));var db=require(_0x4133('0x6'))['db'];var utils=require(_0x4133('0x7'));var logger=require(_0x4133('0x8'))('rpc');var config=require(_0x4133('0x9'));var jayson=require(_0x4133('0xa'));var client=jayson[_0x4133('0xb')][_0x4133('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4133('0xd')],{'host':_0x4133('0xe'),'port':0x18eb});var socket=require(_0x4133('0xf'))(new Redis(config[_0x4133('0xd')]));require(_0x4133('0x10'))['register'](socket);function respondWithRpcPromise(_0x3cfbcc,_0x3ecdfb,_0x4b7fa0){return new BPromise(function(_0xa5c5bd,_0x265e52){return client[_0x4133('0x11')](_0x3cfbcc,_0x4b7fa0)['then'](function(_0x38d0d5){logger[_0x4133('0x12')](_0x4133('0x13'),_0x3ecdfb,_0x4133('0x14'));logger[_0x4133('0x15')](_0x4133('0x16'),_0x3ecdfb,_0x4133('0x14'),JSON[_0x4133('0x17')](_0x38d0d5));if(_0x38d0d5[_0x4133('0x18')]){if(_0x38d0d5['error'][_0x4133('0x19')]===0x1f4){logger[_0x4133('0x18')](_0x4133('0x13'),_0x3ecdfb,_0x38d0d5[_0x4133('0x18')][_0x4133('0x1a')]);return _0x265e52(_0x38d0d5[_0x4133('0x18')][_0x4133('0x1a')]);}logger[_0x4133('0x18')]('SmsAccount,\x20%s,\x20%s',_0x3ecdfb,_0x38d0d5['error']['message']);return _0xa5c5bd(_0x38d0d5[_0x4133('0x18')][_0x4133('0x1a')]);}else{logger[_0x4133('0x12')]('SmsAccount,\x20%s,\x20%s',_0x3ecdfb,_0x4133('0x14'));_0xa5c5bd(_0x38d0d5[_0x4133('0x1b')][_0x4133('0x1a')]);}})[_0x4133('0x1c')](function(_0x4ea119){logger[_0x4133('0x18')](_0x4133('0x13'),_0x3ecdfb,_0x4ea119);_0x265e52(_0x4ea119);});});}exports[_0x4133('0x1d')]=function(_0x59a788){var _0x16faae=this;return new Promise(function(_0x1ae6e4,_0x5de86e){return db['SmsAccount'][_0x4133('0x1e')]({'raw':_0x59a788[_0x4133('0x1f')]?_0x59a788[_0x4133('0x1f')][_0x4133('0x20')]===undefined?!![]:![]:!![],'where':_0x59a788[_0x4133('0x1f')]?_0x59a788['options'][_0x4133('0x21')]||null:null,'attributes':_0x59a788[_0x4133('0x1f')]?_0x59a788[_0x4133('0x1f')]['attributes']||null:null,'include':_0x59a788[_0x4133('0x1f')]?_0x59a788[_0x4133('0x1f')][_0x4133('0x22')]?_[_0x4133('0x23')](_0x59a788[_0x4133('0x1f')][_0x4133('0x22')],function(_0x555d24){return{'model':db[_0x555d24[_0x4133('0x24')]],'as':_0x555d24['as'],'attributes':_0x555d24[_0x4133('0x25')],'include':_0x555d24[_0x4133('0x22')]?_[_0x4133('0x23')](_0x555d24[_0x4133('0x22')],function(_0x3c10d2){return{'model':db[_0x3c10d2[_0x4133('0x24')]],'as':_0x3c10d2['as'],'attributes':_0x3c10d2['attributes'],'include':_0x3c10d2[_0x4133('0x22')]?_[_0x4133('0x23')](_0x3c10d2[_0x4133('0x22')],function(_0x1c5407){return{'model':db[_0x1c5407[_0x4133('0x24')]],'as':_0x1c5407['as'],'attributes':_0x1c5407[_0x4133('0x25')]};}):[]};}):[]};}):[]:[]})[_0x4133('0x26')](function(_0x3ff28f){logger[_0x4133('0x12')](_0x4133('0x1d'),_0x59a788);logger['debug'](_0x4133('0x1d'),_0x59a788,JSON['stringify'](_0x3ff28f));_0x1ae6e4(_0x3ff28f);})['catch'](function(_0x2d31e5){logger[_0x4133('0x18')](_0x4133('0x1d'),_0x2d31e5[_0x4133('0x1a')],_0x59a788);_0x5de86e(_0x16faae[_0x4133('0x18')](0x1f4,_0x2d31e5[_0x4133('0x1a')]));});});}; \ No newline at end of file +var _0xfb06=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','map','include','model','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4abc4d,_0x313e8e){var _0x537e9b=function(_0xdbdb41){while(--_0xdbdb41){_0x4abc4d['push'](_0x4abc4d['shift']());}};_0x537e9b(++_0x313e8e);}(_0xfb06,0x170));var _0x6fb0=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0xfb06[_0x2786ea];return _0x5c38e5;};'use strict';var _=require(_0x6fb0('0x0'));var util=require(_0x6fb0('0x1'));var moment=require(_0x6fb0('0x2'));var BPromise=require(_0x6fb0('0x3'));var rs=require(_0x6fb0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fb0('0x5'))['db'];var utils=require(_0x6fb0('0x6'));var logger=require(_0x6fb0('0x7'))('rpc');var config=require(_0x6fb0('0x8'));var jayson=require(_0x6fb0('0x9'));var client=jayson[_0x6fb0('0xa')][_0x6fb0('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6fb0('0xc')],{'host':_0x6fb0('0xd'),'port':0x18eb});var socket=require(_0x6fb0('0xe'))(new Redis(config[_0x6fb0('0xc')]));require(_0x6fb0('0xf'))[_0x6fb0('0x10')](socket);function respondWithRpcPromise(_0x469bcf,_0x3a384f,_0x20573c){return new BPromise(function(_0x5aa5cd,_0x54e02e){return client[_0x6fb0('0x11')](_0x469bcf,_0x20573c)[_0x6fb0('0x12')](function(_0x4f4591){logger[_0x6fb0('0x13')](_0x6fb0('0x14'),_0x3a384f,_0x6fb0('0x15'));logger[_0x6fb0('0x16')](_0x6fb0('0x17'),_0x3a384f,_0x6fb0('0x15'),JSON[_0x6fb0('0x18')](_0x4f4591));if(_0x4f4591[_0x6fb0('0x19')]){if(_0x4f4591[_0x6fb0('0x19')][_0x6fb0('0x1a')]===0x1f4){logger[_0x6fb0('0x19')](_0x6fb0('0x14'),_0x3a384f,_0x4f4591['error']['message']);return _0x54e02e(_0x4f4591['error']['message']);}logger[_0x6fb0('0x19')](_0x6fb0('0x14'),_0x3a384f,_0x4f4591['error']['message']);return _0x5aa5cd(_0x4f4591[_0x6fb0('0x19')][_0x6fb0('0x1b')]);}else{logger[_0x6fb0('0x13')](_0x6fb0('0x14'),_0x3a384f,_0x6fb0('0x15'));_0x5aa5cd(_0x4f4591['result'][_0x6fb0('0x1b')]);}})[_0x6fb0('0x1c')](function(_0x298c70){logger[_0x6fb0('0x19')](_0x6fb0('0x14'),_0x3a384f,_0x298c70);_0x54e02e(_0x298c70);});});}exports[_0x6fb0('0x1d')]=function(_0x51be8e){var _0x259cbf=this;return new Promise(function(_0x20635f,_0x5838a0){return db[_0x6fb0('0x1e')][_0x6fb0('0x1f')]({'raw':_0x51be8e['options']?_0x51be8e[_0x6fb0('0x20')][_0x6fb0('0x21')]===undefined?!![]:![]:!![],'where':_0x51be8e['options']?_0x51be8e[_0x6fb0('0x20')][_0x6fb0('0x22')]||null:null,'attributes':_0x51be8e[_0x6fb0('0x20')]?_0x51be8e[_0x6fb0('0x20')]['attributes']||null:null,'include':_0x51be8e[_0x6fb0('0x20')]?_0x51be8e['options']['include']?_[_0x6fb0('0x23')](_0x51be8e[_0x6fb0('0x20')][_0x6fb0('0x24')],function(_0x52e461){return{'model':db[_0x52e461[_0x6fb0('0x25')]],'as':_0x52e461['as'],'attributes':_0x52e461['attributes'],'include':_0x52e461['include']?_[_0x6fb0('0x23')](_0x52e461[_0x6fb0('0x24')],function(_0x583e13){return{'model':db[_0x583e13[_0x6fb0('0x25')]],'as':_0x583e13['as'],'attributes':_0x583e13[_0x6fb0('0x26')],'include':_0x583e13[_0x6fb0('0x24')]?_[_0x6fb0('0x23')](_0x583e13[_0x6fb0('0x24')],function(_0x24078f){return{'model':db[_0x24078f[_0x6fb0('0x25')]],'as':_0x24078f['as'],'attributes':_0x24078f[_0x6fb0('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50e69c){logger[_0x6fb0('0x13')](_0x6fb0('0x1d'),_0x51be8e);logger['debug']('ShowSmsAccount',_0x51be8e,JSON[_0x6fb0('0x18')](_0x50e69c));_0x20635f(_0x50e69c);})[_0x6fb0('0x1c')](function(_0x2aeff9){logger[_0x6fb0('0x19')]('ShowSmsAccount',_0x2aeff9['message'],_0x51be8e);_0x5838a0(_0x259cbf[_0x6fb0('0x19')](0x1f4,_0x2aeff9[_0x6fb0('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0169015..d6ccb8c 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 76f4981..b382a04 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x1b9edd,_0x66b166){var _0x4907c4=function(_0x538091){while(--_0x538091){_0x1b9edd['push'](_0x1b9edd['shift']());}};_0x4907c4(++_0x66b166);}(_0x3e74,0x175));var _0x43e7=function(_0x2b60d1,_0x2cd09b){_0x2b60d1=_0x2b60d1-0x0;var _0x175aaa=_0x3e74[_0x2b60d1];return _0x175aaa;};'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 +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0xfada8c,_0xc573e7){var _0x23ad7b=function(_0x1cb560){while(--_0x1cb560){_0xfada8c['push'](_0xfada8c['shift']());}};_0x23ad7b(++_0xc573e7);}(_0x008c,0x188));var _0xc008=function(_0xb4710a,_0x585188){_0xb4710a=_0xb4710a-0x0;var _0x602935=_0x008c[_0xb4710a];return _0x602935;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('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 3c9468e..805955b 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 _0xb9cd=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x523253,_0x3088fb){var _0x465889=function(_0x4c4c54){while(--_0x4c4c54){_0x523253['push'](_0x523253['shift']());}};_0x465889(++_0x3088fb);}(_0xb9cd,0x1e6));var _0xdb9c=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xb9cd[_0x99868f];return _0x27a71b;};'use strict';var Sequelize=require(_0xdb9c('0x0'));module[_0xdb9c('0x1')]={'priority':{'type':Sequelize[_0xdb9c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdb9c('0x3')],'allowNull':![],'defaultValue':_0xdb9c('0x4')},'appdata':{'type':Sequelize[_0xdb9c('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xdb9c('0x3')],'defaultValue':_0xdb9c('0x6')}}; \ No newline at end of file +var _0xfbb7=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3d0f40,_0x174e76){var _0x465307=function(_0x2bbc7e){while(--_0x2bbc7e){_0x3d0f40['push'](_0x3d0f40['shift']());}};_0x465307(++_0x174e76);}(_0xfbb7,0x116));var _0x7fbb=function(_0x3a3227,_0xad1eb1){_0x3a3227=_0x3a3227-0x0;var _0x1f9d46=_0xfbb7[_0x3a3227];return _0x1f9d46;};'use strict';var Sequelize=require(_0x7fbb('0x0'));module[_0x7fbb('0x1')]={'priority':{'type':Sequelize[_0x7fbb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7fbb('0x3')],'allowNull':![],'defaultValue':_0x7fbb('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7fbb('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 3912634..4181ccd 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 _0x368e=['model','query','filters','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','SmsApplication','intersection','length','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x368e,0x192));var _0xe368=function(_0x5addf7,_0x50785e){_0x5addf7=_0x5addf7-0x0;var _0xb0746a=_0x368e[_0x5addf7];return _0xb0746a;};'use strict';var emlformat=require(_0xe368('0x0'));var rimraf=require(_0xe368('0x1'));var zipdir=require(_0xe368('0x2'));var jsonpatch=require(_0xe368('0x3'));var rp=require(_0xe368('0x4'));var moment=require(_0xe368('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe368('0x6'));var path=require(_0xe368('0x7'));var sox=require(_0xe368('0x8'));var csv=require(_0xe368('0x9'));var ejs=require(_0xe368('0xa'));var fs=require('fs');var fs_extra=require(_0xe368('0xb'));var _=require('lodash');var squel=require(_0xe368('0xc'));var crypto=require(_0xe368('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe368('0x9'));var querystring=require(_0xe368('0xe'));var Papa=require(_0xe368('0xf'));var Redis=require('ioredis');var authService=require(_0xe368('0x10'));var qs=require(_0xe368('0x11'));var as=require(_0xe368('0x12'));var hardwareService=require(_0xe368('0x13'));var logger=require(_0xe368('0x14'))(_0xe368('0x15'));var utils=require(_0xe368('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe368('0x17'));var db=require(_0xe368('0x18'))['db'];function respondWithStatusCode(_0x4d6b95,_0x381642){_0x381642=_0x381642||0xcc;return function(_0x13c707){if(_0x13c707){return _0x4d6b95[_0xe368('0x19')](_0x381642);}return _0x4d6b95[_0xe368('0x1a')](_0x381642)[_0xe368('0x1b')]();};}function respondWithResult(_0x44a062,_0x44f65e){_0x44f65e=_0x44f65e||0xc8;return function(_0x87e1d0){if(_0x87e1d0){return _0x44a062[_0xe368('0x1a')](_0x44f65e)[_0xe368('0x1c')](_0x87e1d0);}};}function respondWithFilteredResult(_0x30f589,_0x342d40){return function(_0x2b5845){if(_0x2b5845){var _0x2018e4=typeof _0x342d40[_0xe368('0x1d')]===_0xe368('0x1e')&&typeof _0x342d40[_0xe368('0x1f')]===_0xe368('0x1e');var _0x52d7f1=_0x2b5845[_0xe368('0x20')];var _0x357859=_0x2018e4?0x0:_0x342d40[_0xe368('0x1d')];var _0x98a8ec=_0x2018e4?_0x2b5845[_0xe368('0x20')]:_0x342d40[_0xe368('0x1d')]+_0x342d40[_0xe368('0x1f')];var _0x1a1052;if(_0x98a8ec>=_0x52d7f1){_0x98a8ec=_0x52d7f1;_0x1a1052=0xc8;}else{_0x1a1052=0xce;}_0x30f589[_0xe368('0x1a')](_0x1a1052);return _0x30f589['set']('Content-Range',_0x357859+'-'+_0x98a8ec+'/'+_0x52d7f1)['json'](_0x2b5845);}return null;};}function patchUpdates(_0x317671){return function(_0x2290f0){try{jsonpatch[_0xe368('0x21')](_0x2290f0,_0x317671,!![]);}catch(_0x37d8c3){return BPromise[_0xe368('0x22')](_0x37d8c3);}return _0x2290f0[_0xe368('0x23')]();};}function saveUpdates(_0x3f9433,_0x215a39){return function(_0x18f7ce){if(_0x18f7ce){return _0x18f7ce[_0xe368('0x24')](_0x3f9433)[_0xe368('0x25')](function(_0x53c7b9){return _0x53c7b9;});}return null;};}function removeEntity(_0x360d48,_0x254db7){return function(_0x7da9be){if(_0x7da9be){return _0x7da9be[_0xe368('0x26')]()[_0xe368('0x25')](function(){_0x360d48[_0xe368('0x1a')](0xcc)[_0xe368('0x1b')]();});}};}function handleEntityNotFound(_0x336f9e,_0x31e4b6){return function(_0x210b4c){if(!_0x210b4c){_0x336f9e['sendStatus'](0x194);}return _0x210b4c;};}function handleError(_0x21a3a7,_0x205a6b){_0x205a6b=_0x205a6b||0x1f4;return function(_0x2ce87f){logger['error'](_0x2ce87f[_0xe368('0x27')]);if(_0x2ce87f[_0xe368('0x28')]){delete _0x2ce87f['name'];}_0x21a3a7['status'](_0x205a6b)[_0xe368('0x29')](_0x2ce87f);};}exports[_0xe368('0x2a')]=function(_0x224b4d,_0x592554){var _0x284330={},_0x3fdfc5={},_0x4ed83e={'count':0x0,'rows':[]};var _0x5f6faa=_[_0xe368('0x2b')](db['SmsApplication'][_0xe368('0x2c')],function(_0x386083){return{'name':_0x386083[_0xe368('0x2d')],'type':_0x386083[_0xe368('0x2e')][_0xe368('0x2f')]};});_0x3fdfc5[_0xe368('0x30')]=_[_0xe368('0x2b')](_0x5f6faa,'name');_0x3fdfc5[_0xe368('0x31')]=_['keys'](_0x224b4d['query']);_0x3fdfc5[_0xe368('0x32')]=_['intersection'](_0x3fdfc5[_0xe368('0x30')],_0x3fdfc5['query']);_0x284330[_0xe368('0x33')]=_['intersection'](_0x3fdfc5[_0xe368('0x30')],qs[_0xe368('0x34')](_0x224b4d['query'][_0xe368('0x34')]));_0x284330['attributes']=_0x284330['attributes']['length']?_0x284330[_0xe368('0x33')]:_0x3fdfc5['model'];if(!_0x224b4d[_0xe368('0x31')]['hasOwnProperty'](_0xe368('0x35'))){_0x284330['limit']=qs['limit'](_0x224b4d[_0xe368('0x31')][_0xe368('0x1f')]);_0x284330[_0xe368('0x1d')]=qs[_0xe368('0x1d')](_0x224b4d[_0xe368('0x31')][_0xe368('0x1d')]);}_0x284330[_0xe368('0x36')]=qs[_0xe368('0x37')](_0x224b4d['query']['sort']);_0x284330[_0xe368('0x38')]=qs[_0xe368('0x32')](_['pick'](_0x224b4d['query'],_0x3fdfc5[_0xe368('0x32')]),_0x5f6faa);if(_0x224b4d[_0xe368('0x31')]['filter']){_0x284330[_0xe368('0x38')]=_[_0xe368('0x39')](_0x284330['where'],{'$or':_[_0xe368('0x2b')](_0x5f6faa,function(_0x3c6088){if(_0x3c6088[_0xe368('0x2e')]!==_0xe368('0x3a')){var _0x53de48={};_0x53de48[_0x3c6088[_0xe368('0x28')]]={'$like':'%'+_0x224b4d[_0xe368('0x31')][_0xe368('0x3b')]+'%'};return _0x53de48;}})});}_0x284330=_[_0xe368('0x39')]({},_0x284330,_0x224b4d[_0xe368('0x3c')]);var _0x247f6f={'where':_0x284330[_0xe368('0x38')]};return db['SmsApplication'][_0xe368('0x20')](_0x247f6f)[_0xe368('0x25')](function(_0x3fc659){_0x4ed83e[_0xe368('0x20')]=_0x3fc659;if(_0x224b4d['query']['includeAll']){_0x284330[_0xe368('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0xe368('0x3e')](_0x284330);})['then'](function(_0xdb9991){_0x4ed83e[_0xe368('0x3f')]=_0xdb9991;return _0x4ed83e;})['then'](respondWithFilteredResult(_0x592554,_0x284330))['catch'](handleError(_0x592554,null));};exports[_0xe368('0x40')]=function(_0x1e9cf1,_0x413a78){var _0x15787e={'raw':!![],'where':{'id':_0x1e9cf1[_0xe368('0x41')]['id']}},_0x54c699={};_0x54c699[_0xe368('0x30')]=_[_0xe368('0x42')](db[_0xe368('0x43')][_0xe368('0x2c')]);_0x54c699['query']=_[_0xe368('0x42')](_0x1e9cf1[_0xe368('0x31')]);_0x54c699[_0xe368('0x32')]=_[_0xe368('0x44')](_0x54c699[_0xe368('0x30')],_0x54c699[_0xe368('0x31')]);_0x15787e['attributes']=_[_0xe368('0x44')](_0x54c699[_0xe368('0x30')],qs[_0xe368('0x34')](_0x1e9cf1[_0xe368('0x31')]['fields']));_0x15787e[_0xe368('0x33')]=_0x15787e[_0xe368('0x33')][_0xe368('0x45')]?_0x15787e[_0xe368('0x33')]:_0x54c699['model'];if(_0x1e9cf1[_0xe368('0x31')][_0xe368('0x46')]){_0x15787e[_0xe368('0x3d')]=[{'all':!![]}];}_0x15787e=_[_0xe368('0x39')]({},_0x15787e,_0x1e9cf1[_0xe368('0x3c')]);return db[_0xe368('0x43')][_0xe368('0x47')](_0x15787e)[_0xe368('0x25')](handleEntityNotFound(_0x413a78,null))[_0xe368('0x25')](respondWithResult(_0x413a78,null))[_0xe368('0x48')](handleError(_0x413a78,null));};exports[_0xe368('0x49')]=function(_0x8bdbb1,_0x3d6043){return db['SmsApplication']['create'](_0x8bdbb1[_0xe368('0x4a')],{})[_0xe368('0x25')](respondWithResult(_0x3d6043,0xc9))[_0xe368('0x48')](handleError(_0x3d6043,null));};exports[_0xe368('0x24')]=function(_0x369706,_0x49042a){if(_0x369706[_0xe368('0x4a')]['id']){delete _0x369706['body']['id'];}return db[_0xe368('0x43')]['find']({'where':{'id':_0x369706[_0xe368('0x41')]['id']}})[_0xe368('0x25')](handleEntityNotFound(_0x49042a,null))['then'](saveUpdates(_0x369706[_0xe368('0x4a')],null))['then'](respondWithResult(_0x49042a,null))[_0xe368('0x48')](handleError(_0x49042a,null));};exports[_0xe368('0x26')]=function(_0xcf7fc0,_0x580b63){return db[_0xe368('0x43')][_0xe368('0x47')]({'where':{'id':_0xcf7fc0[_0xe368('0x41')]['id']}})[_0xe368('0x25')](handleEntityNotFound(_0x580b63,null))[_0xe368('0x25')](removeEntity(_0x580b63,null))[_0xe368('0x48')](handleError(_0x580b63,null));}; \ No newline at end of file +var _0x061a=['count','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SmsApplication','include','findAll','rows','then','catch','show','params','keys','create','body','find','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','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','status','end','offset','undefined','limit'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x061a,0x73));var _0xa061=function(_0x412437,_0x356b41){_0x412437=_0x412437-0x0;var _0x2230da=_0x061a[_0x412437];return _0x2230da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa061('0x0'));var rp=require('request-promise');var moment=require(_0xa061('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa061('0x2'));var util=require(_0xa061('0x3'));var path=require(_0xa061('0x4'));var sox=require(_0xa061('0x5'));var csv=require(_0xa061('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa061('0x7'));var _=require(_0xa061('0x8'));var squel=require('squel');var crypto=require(_0xa061('0x9'));var jsforce=require(_0xa061('0xa'));var deskjs=require(_0xa061('0xb'));var toCsv=require(_0xa061('0x6'));var querystring=require('querystring');var Papa=require(_0xa061('0xc'));var Redis=require(_0xa061('0xd'));var authService=require(_0xa061('0xe'));var qs=require(_0xa061('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa061('0x10'));var logger=require(_0xa061('0x11'))(_0xa061('0x12'));var utils=require(_0xa061('0x13'));var config=require(_0xa061('0x14'));var licenseUtil=require(_0xa061('0x15'));var db=require(_0xa061('0x16'))['db'];function respondWithStatusCode(_0xa8fa01,_0x283d4b){_0x283d4b=_0x283d4b||0xcc;return function(_0x4c665c){if(_0x4c665c){return _0xa8fa01[_0xa061('0x17')](_0x283d4b);}return _0xa8fa01[_0xa061('0x18')](_0x283d4b)[_0xa061('0x19')]();};}function respondWithResult(_0x4f81f1,_0x42db0d){_0x42db0d=_0x42db0d||0xc8;return function(_0x62ecb0){if(_0x62ecb0){return _0x4f81f1['status'](_0x42db0d)['json'](_0x62ecb0);}};}function respondWithFilteredResult(_0x310120,_0x403717){return function(_0x18dec7){if(_0x18dec7){var _0x3ca883=typeof _0x403717[_0xa061('0x1a')]===_0xa061('0x1b')&&typeof _0x403717[_0xa061('0x1c')]===_0xa061('0x1b');var _0x2e518a=_0x18dec7[_0xa061('0x1d')];var _0x8301ef=_0x3ca883?0x0:_0x403717[_0xa061('0x1a')];var _0x47ec28=_0x3ca883?_0x18dec7['count']:_0x403717[_0xa061('0x1a')]+_0x403717[_0xa061('0x1c')];var _0x503162;if(_0x47ec28>=_0x2e518a){_0x47ec28=_0x2e518a;_0x503162=0xc8;}else{_0x503162=0xce;}_0x310120[_0xa061('0x18')](_0x503162);return _0x310120[_0xa061('0x1e')](_0xa061('0x1f'),_0x8301ef+'-'+_0x47ec28+'/'+_0x2e518a)[_0xa061('0x20')](_0x18dec7);}return null;};}function patchUpdates(_0x5556bb){return function(_0x4a1e2f){try{jsonpatch[_0xa061('0x21')](_0x4a1e2f,_0x5556bb,!![]);}catch(_0x35d70c){return BPromise[_0xa061('0x22')](_0x35d70c);}return _0x4a1e2f['save']();};}function saveUpdates(_0x43d4b9,_0x28d488){return function(_0x47a815){if(_0x47a815){return _0x47a815[_0xa061('0x23')](_0x43d4b9)['then'](function(_0xde83d0){return _0xde83d0;});}return null;};}function removeEntity(_0xd8932d,_0x3dbec4){return function(_0x229d9f){if(_0x229d9f){return _0x229d9f[_0xa061('0x24')]()['then'](function(){_0xd8932d[_0xa061('0x18')](0xcc)[_0xa061('0x19')]();});}};}function handleEntityNotFound(_0x215640,_0x3db460){return function(_0x432cae){if(!_0x432cae){_0x215640[_0xa061('0x17')](0x194);}return _0x432cae;};}function handleError(_0x59faf2,_0x3b663b){_0x3b663b=_0x3b663b||0x1f4;return function(_0x3839a4){logger[_0xa061('0x25')](_0x3839a4[_0xa061('0x26')]);if(_0x3839a4[_0xa061('0x27')]){delete _0x3839a4[_0xa061('0x27')];}_0x59faf2['status'](_0x3b663b)['send'](_0x3839a4);};}exports[_0xa061('0x28')]=function(_0x1f5c2c,_0x5e8c43){var _0x53eeeb={},_0x1ba384={},_0x310e79={'count':0x0,'rows':[]};var _0xdccd09=_[_0xa061('0x29')](db['SmsApplication'][_0xa061('0x2a')],function(_0x5bb35c){return{'name':_0x5bb35c[_0xa061('0x2b')],'type':_0x5bb35c[_0xa061('0x2c')][_0xa061('0x2d')]};});_0x1ba384['model']=_[_0xa061('0x29')](_0xdccd09,_0xa061('0x27'));_0x1ba384[_0xa061('0x2e')]=_['keys'](_0x1f5c2c[_0xa061('0x2e')]);_0x1ba384[_0xa061('0x2f')]=_[_0xa061('0x30')](_0x1ba384[_0xa061('0x31')],_0x1ba384['query']);_0x53eeeb[_0xa061('0x32')]=_[_0xa061('0x30')](_0x1ba384[_0xa061('0x31')],qs[_0xa061('0x33')](_0x1f5c2c['query'][_0xa061('0x33')]));_0x53eeeb[_0xa061('0x32')]=_0x53eeeb[_0xa061('0x32')]['length']?_0x53eeeb[_0xa061('0x32')]:_0x1ba384[_0xa061('0x31')];if(!_0x1f5c2c[_0xa061('0x2e')][_0xa061('0x34')]('nolimit')){_0x53eeeb[_0xa061('0x1c')]=qs[_0xa061('0x1c')](_0x1f5c2c[_0xa061('0x2e')][_0xa061('0x1c')]);_0x53eeeb[_0xa061('0x1a')]=qs['offset'](_0x1f5c2c['query'][_0xa061('0x1a')]);}_0x53eeeb['order']=qs[_0xa061('0x35')](_0x1f5c2c[_0xa061('0x2e')][_0xa061('0x35')]);_0x53eeeb[_0xa061('0x36')]=qs[_0xa061('0x2f')](_[_0xa061('0x37')](_0x1f5c2c['query'],_0x1ba384['filters']),_0xdccd09);if(_0x1f5c2c[_0xa061('0x2e')][_0xa061('0x38')]){_0x53eeeb[_0xa061('0x36')]=_[_0xa061('0x39')](_0x53eeeb[_0xa061('0x36')],{'$or':_[_0xa061('0x29')](_0xdccd09,function(_0x246d12){if(_0x246d12[_0xa061('0x2c')]!==_0xa061('0x3a')){var _0x57e9fd={};_0x57e9fd[_0x246d12[_0xa061('0x27')]]={'$like':'%'+_0x1f5c2c['query'][_0xa061('0x38')]+'%'};return _0x57e9fd;}})});}_0x53eeeb=_[_0xa061('0x39')]({},_0x53eeeb,_0x1f5c2c[_0xa061('0x3b')]);var _0x4bc5bc={'where':_0x53eeeb[_0xa061('0x36')]};return db[_0xa061('0x3c')][_0xa061('0x1d')](_0x4bc5bc)['then'](function(_0x3d8628){_0x310e79[_0xa061('0x1d')]=_0x3d8628;if(_0x1f5c2c[_0xa061('0x2e')]['includeAll']){_0x53eeeb[_0xa061('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0xa061('0x3e')](_0x53eeeb);})['then'](function(_0x36e316){_0x310e79[_0xa061('0x3f')]=_0x36e316;return _0x310e79;})[_0xa061('0x40')](respondWithFilteredResult(_0x5e8c43,_0x53eeeb))[_0xa061('0x41')](handleError(_0x5e8c43,null));};exports[_0xa061('0x42')]=function(_0x2dc488,_0x5d7143){var _0x5934a1={'raw':!![],'where':{'id':_0x2dc488[_0xa061('0x43')]['id']}},_0x1efcec={};_0x1efcec['model']=_[_0xa061('0x44')](db[_0xa061('0x3c')][_0xa061('0x2a')]);_0x1efcec[_0xa061('0x2e')]=_[_0xa061('0x44')](_0x2dc488[_0xa061('0x2e')]);_0x1efcec[_0xa061('0x2f')]=_[_0xa061('0x30')](_0x1efcec[_0xa061('0x31')],_0x1efcec[_0xa061('0x2e')]);_0x5934a1[_0xa061('0x32')]=_[_0xa061('0x30')](_0x1efcec[_0xa061('0x31')],qs[_0xa061('0x33')](_0x2dc488[_0xa061('0x2e')][_0xa061('0x33')]));_0x5934a1['attributes']=_0x5934a1['attributes']['length']?_0x5934a1[_0xa061('0x32')]:_0x1efcec['model'];if(_0x2dc488[_0xa061('0x2e')]['includeAll']){_0x5934a1['include']=[{'all':!![]}];}_0x5934a1=_['merge']({},_0x5934a1,_0x2dc488[_0xa061('0x3b')]);return db[_0xa061('0x3c')]['find'](_0x5934a1)[_0xa061('0x40')](handleEntityNotFound(_0x5d7143,null))['then'](respondWithResult(_0x5d7143,null))[_0xa061('0x41')](handleError(_0x5d7143,null));};exports[_0xa061('0x45')]=function(_0x59cd07,_0x49247a){return db[_0xa061('0x3c')][_0xa061('0x45')](_0x59cd07[_0xa061('0x46')],{})[_0xa061('0x40')](respondWithResult(_0x49247a,0xc9))[_0xa061('0x41')](handleError(_0x49247a,null));};exports['update']=function(_0x4056c5,_0x4b5e15){if(_0x4056c5['body']['id']){delete _0x4056c5['body']['id'];}return db['SmsApplication'][_0xa061('0x47')]({'where':{'id':_0x4056c5[_0xa061('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b5e15,null))[_0xa061('0x40')](saveUpdates(_0x4056c5[_0xa061('0x46')],null))[_0xa061('0x40')](respondWithResult(_0x4b5e15,null))[_0xa061('0x41')](handleError(_0x4b5e15,null));};exports[_0xa061('0x24')]=function(_0x235749,_0x3012c3){return db['SmsApplication'][_0xa061('0x47')]({'where':{'id':_0x235749[_0xa061('0x43')]['id']}})['then'](handleEntityNotFound(_0x3012c3,null))[_0xa061('0x40')](removeEntity(_0x3012c3,null))['catch'](handleError(_0x3012c3,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c9b9b37..39fd1af 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 _0x1305=['exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes'];(function(_0x164e0f,_0x211c83){var _0xaf4e4b=function(_0x3bacf9){while(--_0x3bacf9){_0x164e0f['push'](_0x164e0f['shift']());}};_0xaf4e4b(++_0x211c83);}(_0x1305,0x17c));var _0x5130=function(_0x14ecb8,_0x22589d){_0x14ecb8=_0x14ecb8-0x0;var _0x1329b9=_0x1305[_0x14ecb8];return _0x1329b9;};'use strict';var _=require(_0x5130('0x0'));var util=require(_0x5130('0x1'));var logger=require(_0x5130('0x2'))(_0x5130('0x3'));var moment=require(_0x5130('0x4'));var BPromise=require(_0x5130('0x5'));var rp=require(_0x5130('0x6'));var fs=require('fs');var path=require(_0x5130('0x7'));var rimraf=require('rimraf');var config=require(_0x5130('0x8'));var attributes=require(_0x5130('0x9'));module[_0x5130('0xa')]=function(_0x3a6b1f,_0x1f0031){return _0x3a6b1f[_0x5130('0xb')](_0x5130('0xc'),attributes,{'tableName':_0x5130('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5130('0xe')});}; \ No newline at end of file +var _0x946e=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x946e,0x148));var _0xe946=function(_0x122cbb,_0x5d2cd4){_0x122cbb=_0x122cbb-0x0;var _0x1b6eb5=_0x946e[_0x122cbb];return _0x1b6eb5;};'use strict';var _=require(_0xe946('0x0'));var util=require(_0xe946('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe946('0x2'));var rp=require(_0xe946('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xe946('0x4')]=function(_0x4a507e,_0x3c9c9a){return _0x4a507e['define'](_0xe946('0x5'),attributes,{'tableName':_0xe946('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe946('0x7'),'collate':_0xe946('0x8')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index fbadaeb..33c6a63 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 _0x40ac=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','debug','request\x20sent','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x40ac,0x1de));var _0xc40a=function(_0x4ab560,_0x5e8fe2){_0x4ab560=_0x4ab560-0x0;var _0xfe1853=_0x40ac[_0x4ab560];return _0xfe1853;};'use strict';var _=require(_0xc40a('0x0'));var util=require('util');var moment=require(_0xc40a('0x1'));var BPromise=require(_0xc40a('0x2'));var rs=require(_0xc40a('0x3'));var fs=require('fs');var Redis=require(_0xc40a('0x4'));var db=require(_0xc40a('0x5'))['db'];var utils=require(_0xc40a('0x6'));var logger=require(_0xc40a('0x7'))('rpc');var config=require(_0xc40a('0x8'));var jayson=require(_0xc40a('0x9'));var client=jayson[_0xc40a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b77c,_0x3f323e,_0x28b55d){return new BPromise(function(_0x5bb1e8,_0xecfe01){return client[_0xc40a('0xb')](_0x59b77c,_0x28b55d)[_0xc40a('0xc')](function(_0x35e0c6){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3f323e,'request\x20sent');logger[_0xc40a('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3f323e,_0xc40a('0xe'),JSON['stringify'](_0x35e0c6));if(_0x35e0c6['error']){if(_0x35e0c6[_0xc40a('0xf')][_0xc40a('0x10')]===0x1f4){logger[_0xc40a('0xf')](_0xc40a('0x11'),_0x3f323e,_0x35e0c6[_0xc40a('0xf')][_0xc40a('0x12')]);return _0xecfe01(_0x35e0c6[_0xc40a('0xf')][_0xc40a('0x12')]);}logger['error'](_0xc40a('0x11'),_0x3f323e,_0x35e0c6[_0xc40a('0xf')]['message']);return _0x5bb1e8(_0x35e0c6[_0xc40a('0xf')]['message']);}else{logger[_0xc40a('0x13')](_0xc40a('0x11'),_0x3f323e,_0xc40a('0xe'));_0x5bb1e8(_0x35e0c6[_0xc40a('0x14')][_0xc40a('0x12')]);}})['catch'](function(_0x3d1502){logger[_0xc40a('0xf')](_0xc40a('0x11'),_0x3f323e,_0x3d1502);_0xecfe01(_0x3d1502);});});} \ No newline at end of file +var _0x0c2b=['code','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0c2b,0x194));var _0xb0c2=function(_0x373d80,_0x177872){_0x373d80=_0x373d80-0x0;var _0x20cc05=_0x0c2b[_0x373d80];return _0x20cc05;};'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']('SmsApplication,\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/smsInteraction/index.js b/server/api/smsInteraction/index.js index 5d8fa8d..decdbba 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 _0x34b7=['/:id/tags','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','delete','destroy'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x34b7,0x196));var _0x734b=function(_0x12c511,_0x2102cc){_0x12c511=_0x12c511-0x0;var _0x208ba2=_0x34b7[_0x12c511];return _0x208ba2;};'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('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x734b('0x7')]('/:id/messages',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0x7')](_0x734b('0xd'),auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xf')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0xf')](_0x734b('0x11'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0xf')]('/:id/tags',auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x15')),controller[_0x734b('0x16')]);router[_0x734b('0x17')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x19')),controller['update']);router[_0x734b('0x1a')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')]('sms','smsinteraction:destroy'),controller[_0x734b('0x1b')]);router[_0x734b('0x1a')](_0x734b('0x1c'),auth[_0x734b('0x8')](),controller[_0x734b('0x1d')]);module[_0x734b('0x1e')]=router; \ No newline at end of file +var _0xb688=['destroy','/:id/tags','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','sms'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb688,0xcf));var _0x8b68=function(_0x23e4b1,_0x5a71dd){_0x23e4b1=_0x23e4b1-0x0;var _0x174327=_0xb688[_0x23e4b1];return _0x174327;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x14')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x14')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x16')]);router[_0x8b68('0x14')]('/:id/tags',auth[_0x8b68('0xc')](),interaction['tracked']('sms',_0x8b68('0x17')),controller[_0x8b68('0x18')]);router[_0x8b68('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x8b68('0x1a')]('sms',_0x8b68('0x1b')),controller[_0x8b68('0x1c')]);router[_0x8b68('0x1d')](_0x8b68('0xe'),auth['isAuthenticated'](),interaction[_0x8b68('0x1a')](_0x8b68('0x1e'),'smsinteraction:destroy'),controller[_0x8b68('0x1f')]);router[_0x8b68('0x1d')](_0x8b68('0x20'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 25ddc7f..46ccdbb 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 _0x102b=['out','ENUM','moment','BOOLEAN','DATE','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x102b,0x1be));var _0xb102=function(_0x4c2d63,_0x4fcf91){_0x4c2d63=_0x4c2d63-0x0;var _0x33b9fa=_0x102b[_0x4c2d63];return _0x33b9fa;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb102('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb102('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb102('0x2')]},'disposition':{'type':Sequelize[_0xb102('0x3')]},'secondDisposition':{'type':Sequelize[_0xb102('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb102('0x3')]},'note':{'type':Sequelize[_0xb102('0x3')]},'phone':{'type':Sequelize[_0xb102('0x3')]},'read1stAt':{'type':Sequelize[_0xb102('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb102('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb102('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb102('0x5')]('in',_0xb102('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb102('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x99fb=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x1f027c,_0xe1d240){var _0x44656f=function(_0x282964){while(--_0x282964){_0x1f027c['push'](_0x1f027c['shift']());}};_0x44656f(++_0xe1d240);}(_0x99fb,0x92));var _0xb99f=function(_0x5c77a6,_0x21eda7){_0x5c77a6=_0x5c77a6-0x0;var _0x2cf0f8=_0x99fb[_0x5c77a6];return _0x2cf0f8;};'use strict';var Sequelize=require(_0xb99f('0x0'));var moment=require('moment');module[_0xb99f('0x1')]={'closed':{'type':Sequelize[_0xb99f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb99f('0x3')]},'disposition':{'type':Sequelize[_0xb99f('0x4')]},'secondDisposition':{'type':Sequelize[_0xb99f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb99f('0x4')]},'phone':{'type':Sequelize[_0xb99f('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb99f('0x5')]('in',_0xb99f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb99f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb99f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index afd1a2a..5524be0 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 _0xe4e0=['having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','includeAll','merge','options','create','destroy','describe','addMessage','SmsMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','closedAt','disposition','out','direction','renderFile','views','transcript-','.pdf','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','SmsInteraction','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','expr','search','conditions','find','unreadMessages','value','`\x20>\x200','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4e0,0x6c));var _0x0e4e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xe4e0[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x0e4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e4e('0x1'));var rp=require(_0x0e4e('0x2'));var moment=require(_0x0e4e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0e4e('0x4'));var path=require(_0x0e4e('0x5'));var sox=require(_0x0e4e('0x6'));var csv=require(_0x0e4e('0x7'));var ejs=require(_0x0e4e('0x8'));var fs=require('fs');var fs_extra=require(_0x0e4e('0x9'));var _=require('lodash');var squel=require(_0x0e4e('0xa'));var crypto=require(_0x0e4e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0e4e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0e4e('0xd'));var Papa=require('papaparse');var Redis=require(_0x0e4e('0xe'));var authService=require(_0x0e4e('0xf'));var qs=require(_0x0e4e('0x10'));var as=require(_0x0e4e('0x11'));var pdf=require(_0x0e4e('0x12'));var hardwareService=require(_0x0e4e('0x13'));var logger=require(_0x0e4e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0e4e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e4e('0x16'))['db'];config[_0x0e4e('0x17')]=_[_0x0e4e('0x18')](config[_0x0e4e('0x17')],{'host':_0x0e4e('0x19'),'port':0x18eb});var socket=require(_0x0e4e('0x1a'))(new Redis(config[_0x0e4e('0x17')]));require(_0x0e4e('0x1b'))[_0x0e4e('0x1c')](socket);function respondWithStatusCode(_0x56f0d8,_0x375bbf){_0x375bbf=_0x375bbf||0xcc;return function(_0x13682c){if(_0x13682c){return _0x56f0d8[_0x0e4e('0x1d')](_0x375bbf);}return _0x56f0d8[_0x0e4e('0x1e')](_0x375bbf)[_0x0e4e('0x1f')]();};}function respondWithResult(_0x433e70,_0x4c134a){_0x4c134a=_0x4c134a||0xc8;return function(_0x236086){if(_0x236086){return _0x433e70[_0x0e4e('0x1e')](_0x4c134a)[_0x0e4e('0x20')](_0x236086);}};}function respondWithFilteredResult(_0x5eebbf,_0x1f5acc){return function(_0x13edc8){if(_0x13edc8){var _0x13555f=typeof _0x1f5acc[_0x0e4e('0x21')]===_0x0e4e('0x22')&&typeof _0x1f5acc[_0x0e4e('0x23')]===_0x0e4e('0x22');var _0x47c59e=_0x13edc8[_0x0e4e('0x24')];var _0x15433f=_0x13555f?0x0:_0x1f5acc[_0x0e4e('0x21')];var _0x5151fb=_0x13555f?_0x13edc8['count']:_0x1f5acc['offset']+_0x1f5acc['limit'];var _0x4c098a;if(_0x5151fb>=_0x47c59e){_0x5151fb=_0x47c59e;_0x4c098a=0xc8;}else{_0x4c098a=0xce;}_0x5eebbf[_0x0e4e('0x1e')](_0x4c098a);return _0x5eebbf[_0x0e4e('0x25')](_0x0e4e('0x26'),_0x15433f+'-'+_0x5151fb+'/'+_0x47c59e)[_0x0e4e('0x20')](_0x13edc8);}return null;};}function patchUpdates(_0x47ec4c){return function(_0x43d16a){try{jsonpatch[_0x0e4e('0x27')](_0x43d16a,_0x47ec4c,!![]);}catch(_0x54b1dc){return BPromise['reject'](_0x54b1dc);}return _0x43d16a['save']();};}function saveUpdates(_0x4ef152,_0x1efb3e){return function(_0xee48db){if(_0xee48db){return _0xee48db[_0x0e4e('0x28')](_0x4ef152)[_0x0e4e('0x29')](function(_0x2d3bc0){return _0x2d3bc0;});}return null;};}function removeEntity(_0x4dbbd4,_0x33e54d){return function(_0x54202b){if(_0x54202b){return _0x54202b['destroy']()['then'](function(){_0x4dbbd4[_0x0e4e('0x1e')](0xcc)[_0x0e4e('0x1f')]();});}};}function handleEntityNotFound(_0x43f98d,_0x409495){return function(_0x118880){if(!_0x118880){_0x43f98d[_0x0e4e('0x1d')](0x194);}return _0x118880;};}function handleError(_0x46fa8b,_0x43db27){_0x43db27=_0x43db27||0x1f4;return function(_0x527431){logger[_0x0e4e('0x2a')](_0x527431[_0x0e4e('0x2b')]);if(_0x527431[_0x0e4e('0x2c')]){delete _0x527431[_0x0e4e('0x2c')];}_0x46fa8b[_0x0e4e('0x1e')](_0x43db27)[_0x0e4e('0x2d')](_0x527431);};}function getInteractionUsers(_0x227606,_0x198371){return new BPromise(function(_0x301d3a,_0x4a3dad){try{if(_0x198371[_0x227606['id']]){_0x227606['Users']=_[_0x0e4e('0x2e')](_0x198371[_0x227606['id']],function(_0x5dfa30){return{'id':_0x5dfa30['id'],'fullname':_0x5dfa30[_0x0e4e('0x2f')]};});}}catch(_0x2b9ba8){_0x4a3dad(_0x2b9ba8);}_0x301d3a(_0x227606);});}function getInteractionTags(_0x23bb43,_0x2c6d27){return new BPromise(function(_0xb10c48,_0x3b779c){try{if(_0x23bb43[_0x0e4e('0x30')]){_0x23bb43[_0x0e4e('0x31')]=[];_0x23bb43[_0x0e4e('0x30')]['split'](',')[_0x0e4e('0x32')](function(_0x21c8c3){_0x23bb43[_0x0e4e('0x31')][_0x0e4e('0x33')](_0x2c6d27[_0x21c8c3]);});}delete _0x23bb43[_0x0e4e('0x30')];}catch(_0x1446bd){_0x3b779c(_0x1446bd);}_0xb10c48(_0x23bb43);});}function updateSmsInteraction(_0x459ed3,_0x207b2a,_0x40b4fe){return new BPromise(function(_0x2c1fbd,_0x4f5bf4){return getInteractionUsers(_0x459ed3,_0x40b4fe)[_0x0e4e('0x29')](function(_0x5e4427){return getInteractionTags(_0x5e4427,_0x207b2a);})[_0x0e4e('0x29')](function(_0x4e4676){return getStateInteraction(_0x4e4676);})[_0x0e4e('0x29')](function(_0x6d3d1b){_0x2c1fbd(_0x6d3d1b);})[_0x0e4e('0x34')](function(_0x493396){_0x4f5bf4(_0x493396);});});}function getStateInteraction(_0x1d71c8){return new BPromise(function(_0x338914){_0x1d71c8[_0x0e4e('0x35')]=0x0;_0x1d71c8[_0x0e4e('0x36')]=0x0;_0x1d71c8['answered']=0x0;_0x1d71c8[_0x0e4e('0x37')]=0x0;_0x1d71c8[_0x0e4e('0x38')]=0x0;if(!_0x1d71c8[_0x0e4e('0x39')]&&!_0x1d71c8[_0x0e4e('0x3a')]){_0x1d71c8[_0x0e4e('0x35')]+=0x1;}if(!_0x1d71c8[_0x0e4e('0x39')]&&_0x1d71c8['UserId']){_0x1d71c8['talking']+=0x1;if(_0x1d71c8[_0x0e4e('0x35')]){_0x1d71c8[_0x0e4e('0x35')]-=0x1;}}if(_0x1d71c8[_0x0e4e('0x39')]&&_0x1d71c8[_0x0e4e('0x3a')]){_0x1d71c8[_0x0e4e('0x3b')]+=0x1;if(_0x1d71c8[_0x0e4e('0x36')]){_0x1d71c8[_0x0e4e('0x36')]-=0x1;}}if(_0x1d71c8['closed']&&!_0x1d71c8[_0x0e4e('0x3a')]){_0x1d71c8[_0x0e4e('0x37')]+=0x1;if(_0x1d71c8[_0x0e4e('0x35')]){_0x1d71c8['waiting']-=0x1;}}_0x1d71c8[_0x0e4e('0x38')]+=0x1;_0x338914(_0x1d71c8);});}exports[_0x0e4e('0x3c')]=function(_0x587152,_0x40fd94){var _0x155cf5={},_0x109580={},_0x48aa54={'count':0x0,'rows':[]};var _0x1b3d4a=_[_0x0e4e('0x2e')](db[_0x0e4e('0x3d')][_0x0e4e('0x3e')],function(_0x3338d2){return{'name':_0x3338d2[_0x0e4e('0x3f')],'type':_0x3338d2['type'][_0x0e4e('0x40')]};});_0x109580[_0x0e4e('0x41')]=_['map'](_0x1b3d4a,_0x0e4e('0x2c'));_0x109580[_0x0e4e('0x42')]=_[_0x0e4e('0x43')](_0x587152[_0x0e4e('0x42')]);_0x109580[_0x0e4e('0x44')]=_['intersection'](_0x109580[_0x0e4e('0x41')],_0x109580[_0x0e4e('0x42')]);_0x155cf5[_0x0e4e('0x45')]=_[_0x0e4e('0x46')](_0x109580[_0x0e4e('0x41')],qs[_0x0e4e('0x47')](_0x587152[_0x0e4e('0x42')][_0x0e4e('0x47')]));_0x155cf5[_0x0e4e('0x45')]=_0x155cf5['attributes'][_0x0e4e('0x48')]?_0x155cf5['attributes']:_0x109580['model'];if(!_0x587152[_0x0e4e('0x42')]['hasOwnProperty'](_0x0e4e('0x49'))){_0x155cf5['limit']=qs[_0x0e4e('0x23')](_0x587152[_0x0e4e('0x42')][_0x0e4e('0x23')]);_0x155cf5['offset']=qs[_0x0e4e('0x21')](_0x587152['query'][_0x0e4e('0x21')]);}_0x155cf5['order']=qs[_0x0e4e('0x4a')](_0x587152['query'][_0x0e4e('0x4a')]);_0x155cf5[_0x0e4e('0x4b')]=qs[_0x0e4e('0x44')](_[_0x0e4e('0x4c')](_0x587152[_0x0e4e('0x42')],_0x109580[_0x0e4e('0x44')]),_0x1b3d4a);var _0x144ee5=[];var _0x116461=squel[_0x0e4e('0x4d')]()[_0x0e4e('0x4e')]('id')[_0x0e4e('0x4e')]('name')[_0x0e4e('0x4e')](_0x0e4e('0x4f'))[_0x0e4e('0x50')]('tools_tags');var _0x1e7e0a=squel[_0x0e4e('0x4d')]()['field']('u.id')[_0x0e4e('0x4e')](_0x0e4e('0x51'))[_0x0e4e('0x4e')](_0x0e4e('0x52'))['from'](_0x0e4e('0x53'),'ui')[_0x0e4e('0x54')](_0x0e4e('0x55'),'u',_0x0e4e('0x56'));var _0x3acaa1=squel[_0x0e4e('0x4d')]()['from']('sms_interactions','i')[_0x0e4e('0x54')](_0x0e4e('0x57'),'c',_0x0e4e('0x58'))['left_join'](_0x0e4e('0x55'),'o',_0x0e4e('0x59'))[_0x0e4e('0x54')](_0x0e4e('0x5a'),'a','a.id\x20=\x20i.SmsAccountId')[_0x0e4e('0x54')](_0x0e4e('0x5b'),'me',_0x0e4e('0x5c'))[_0x0e4e('0x54')](_0x0e4e('0x5d'),'it',_0x0e4e('0x5e'))[_0x0e4e('0x54')](_0x0e4e('0x5f'),'t','t.id\x20=\x20it.TagId');var _0x16f664=squel['expr']();var _0x16eb07=[];var _0x285ed2=squel[_0x0e4e('0x60')]();var _0x16808c;if(_0x587152[_0x0e4e('0x42')][_0x0e4e('0x61')]){_0x16808c=as['parseSearch'](_0x587152['query']['search']);var _0x513b54=_0x16808c['sqlOperator'];for(var _0x4777c1=0x0;_0x4777c1<_0x16808c[_0x0e4e('0x62')][_0x0e4e('0x48')];_0x4777c1++){var _0x3da0b1=_0x16808c[_0x0e4e('0x62')][_0x4777c1];var _0x39119a='i';var _0x4fef2a=_[_0x0e4e('0x63')](_0x1b3d4a,[_0x0e4e('0x2c'),_0x3da0b1[_0x0e4e('0x4e')]]);if(!_0x4fef2a){switch(_0x3da0b1[_0x0e4e('0x4e')]){case _0x0e4e('0x64'):if(_0x3da0b1[_0x0e4e('0x65')]==0x1){_0x3acaa1['having']('`'+_0x3da0b1[_0x0e4e('0x4e')]+'`\x20=\x200');}else{_0x3acaa1['having']('`'+_0x3da0b1[_0x0e4e('0x4e')]+_0x0e4e('0x66'));}break;case'Contact':if(_0x3da0b1[_0x0e4e('0x67')]===_0x0e4e('0x68')){if(_0x3da0b1[_0x0e4e('0x65')][_0x0e4e('0x69')]('\x20')[_0x0e4e('0x48')]>0x1){_0x16f664[_0x513b54]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0e4e('0x6a')](_0x3da0b1['value']),null);}else{var _0x2e6457='%'+_0x3da0b1[_0x0e4e('0x65')]+'%';_0x16f664[_0x513b54](_0x0e4e('0x6b'),_0x2e6457,_0x2e6457,_0x2e6457);}}else{_0x4fef2a=_[_0x0e4e('0x63')](_0x1b3d4a,[_0x0e4e('0x2c'),_0x0e4e('0x6c')]);_0x3da0b1[_0x0e4e('0x4e')]='ContactId';_0x1f7c5d=as[_0x0e4e('0x6d')](_0x39119a,_0x4fef2a[_0x0e4e('0x6e')],_0x3da0b1);_0x16f664[_0x513b54](_0x1f7c5d[_0x0e4e('0x6f')],_0x1f7c5d[_0x0e4e('0x65')][_0x0e4e('0x70')],_0x1f7c5d[_0x0e4e('0x65')]['end']);}break;case _0x0e4e('0x71'):var _0x471612=_0x3da0b1[_0x0e4e('0x65')][_0x0e4e('0x69')](',')[_0x0e4e('0x2e')](function(_0x40cc72){return Number(_0x40cc72);});_0x471612['forEach'](function(_0x3e3c68){_0x285ed2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e3c68+',%');});_0x16eb07=_['union'](_0x16eb07,_0x471612);break;case _0x0e4e('0x72'):if(_0x3da0b1[_0x0e4e('0x67')]==='$substring'){_0x16f664[_0x513b54](_0x0e4e('0x73'),'%'+_0x3da0b1['value']+'%',null);}else{_0x4fef2a=_[_0x0e4e('0x63')](_0x1b3d4a,[_0x0e4e('0x2c'),_0x0e4e('0x3a')]);_0x3da0b1['field']=_0x0e4e('0x3a');_0x1f7c5d=as[_0x0e4e('0x6d')](_0x39119a,_0x4fef2a[_0x0e4e('0x6e')],_0x3da0b1);_0x16f664[_0x513b54](_0x1f7c5d[_0x0e4e('0x6f')],_0x1f7c5d['value'][_0x0e4e('0x70')],_0x1f7c5d[_0x0e4e('0x65')][_0x0e4e('0x1f')]);}break;case _0x0e4e('0x74'):_0x1f7c5d=as[_0x0e4e('0x6d')]('me',null,_0x3da0b1);_0x16f664[_0x513b54](_0x1f7c5d[_0x0e4e('0x6f')],_0x1f7c5d[_0x0e4e('0x65')][_0x0e4e('0x70')],_0x1f7c5d[_0x0e4e('0x65')]['end']);break;}}else{var _0x1f7c5d=as[_0x0e4e('0x6d')](_0x39119a,_0x4fef2a[_0x0e4e('0x6e')],_0x3da0b1);_0x16f664[_0x513b54](_0x1f7c5d[_0x0e4e('0x6f')],_0x1f7c5d[_0x0e4e('0x65')][_0x0e4e('0x70')],_0x1f7c5d[_0x0e4e('0x65')][_0x0e4e('0x1f')]);}}}else{var _0x1a9cdb=_(_0x587152[_0x0e4e('0x42')])[_0x0e4e('0x43')]()[_0x0e4e('0x2e')](function(_0x4e78a5){return _[_0x0e4e('0x75')](_0x1b3d4a,[_0x0e4e('0x2c'),_0x4e78a5])?_0x4e78a5:undefined;})[_0x0e4e('0x76')]()[_0x0e4e('0x65')]();if(!_[_0x0e4e('0x77')](_0x1a9cdb)){_0x1a9cdb[_0x0e4e('0x32')](function(_0x197b7a){if(_0x197b7a===_0x0e4e('0x78')){_0x3acaa1['where'](_0x0e4e('0x79'),[][_0x0e4e('0x7a')](_0x587152[_0x0e4e('0x42')][_0x197b7a]));}else if(_0x197b7a===_0x0e4e('0x7b')){var _0x432abc=JSON['parse'](_0x587152['query'][_0x197b7a])[_0x0e4e('0x7c')];var _0x54893a=JSON[_0x0e4e('0x7d')](_0x587152[_0x0e4e('0x42')][_0x197b7a])['$lte'];_0x3acaa1[_0x0e4e('0x4b')](_0x0e4e('0x7e'),_0x432abc,_0x54893a);}else{if(_0x587152[_0x0e4e('0x42')][_0x197b7a]===_0x0e4e('0x7f')){_0x3acaa1[_0x0e4e('0x4b')]('i.'+_0x197b7a+_0x0e4e('0x80'));}else{_0x3acaa1[_0x0e4e('0x4b')]('i.'+_0x197b7a+'\x20=\x20?',_0x587152[_0x0e4e('0x42')][_0x197b7a]);}}});}if(_0x587152[_0x0e4e('0x42')][_0x0e4e('0x81')]){if(_0x587152['query'][_0x0e4e('0x81')]==0x1){_0x3acaa1[_0x0e4e('0x82')](_0x0e4e('0x83'));}else{_0x3acaa1[_0x0e4e('0x82')](_0x0e4e('0x84'));}}if(_0x587152[_0x0e4e('0x42')][_0x0e4e('0x85')]){_0x16eb07=_[_0x0e4e('0x86')](_0x587152[_0x0e4e('0x42')][_0x0e4e('0x85')])?_0x587152[_0x0e4e('0x42')]['tag']:new Array(_0x587152['query'][_0x0e4e('0x85')]);_0x16eb07['forEach'](function(_0x23c26c){_0x285ed2['or'](_0x0e4e('0x87'),'%,'+_0x23c26c+',%');});}if(_0x587152[_0x0e4e('0x42')][_0x0e4e('0x88')]){var _0xb95fb8=_0x587152[_0x0e4e('0x42')][_0x0e4e('0x88')][_0x0e4e('0x89')]('\x5c','\x5c\x5c')[_0x0e4e('0x89')](/'/g,'\x27\x27');if(qs[_0x0e4e('0x8a')](_0xb95fb8)){_0x16f664['or']('i.id\x20LIKE\x20?',_0xb95fb8+'%')['or'](_0x0e4e('0x8b'),_0xb95fb8+'%');}else{_0x16f664['or'](_0x0e4e('0x8c'),qs['getFullTextValue'](_0xb95fb8))['or'](_0x0e4e('0x8d'),_0xb95fb8+'%');}}}_0x3acaa1[_0x0e4e('0x4b')](_0x16f664);_0x3acaa1['group']('i.id');var _0x404499={'type':db['Sequelize'][_0x0e4e('0x8e')]['SELECT'],'raw':!![]};var _0x27aaa7=_0x3acaa1[_0x0e4e('0x8f')]();_0x27aaa7[_0x0e4e('0x4e')](_0x0e4e('0x90'));_0x27aaa7[_0x0e4e('0x4e')](_0x0e4e('0x91'),'unreadMessages');if(_0x155cf5['order']){_0x155cf5[_0x0e4e('0x92')][_0x0e4e('0x32')](function(_0x580ddb){var _0x4b9376=_0x580ddb[0x0]==='contactName'?_0x580ddb[0x0]:'i.'+_0x580ddb[0x0];_0x3acaa1['order'](_0x4b9376,_0x580ddb[0x1]===_0x0e4e('0x93')?![]:!![]);});}if(!_[_0x0e4e('0x77')](_0x16eb07)){_0x3acaa1['having'](_0x285ed2);_0x27aaa7['where'](_0x0e4e('0x94'),_0x16eb07);}BPromise[_0x0e4e('0x95')]()[_0x0e4e('0x29')](function(){if(!_0x16808c){if(_0x587152[_0x0e4e('0x42')][_0x0e4e('0x78')])return;_0x27aaa7[_0x0e4e('0x4b')](_0x0e4e('0x96'));_0x3acaa1[_0x0e4e('0x4b')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x587152[_0x0e4e('0x97')][_0x0e4e('0x98')]!==_0x0e4e('0x99'))return;return _0x587152[_0x0e4e('0x97')][_0x0e4e('0x9a')]({'attributes':['id'],'raw':!![]})[_0x0e4e('0x29')](function(_0x16aa2b){if(_['isEmpty'](_0x16aa2b)){_0x27aaa7[_0x0e4e('0x4b')](_0x0e4e('0x9b'));_0x3acaa1[_0x0e4e('0x4b')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x27aaa7[_0x0e4e('0x4b')](_0x0e4e('0x79'),_[_0x0e4e('0x2e')](_0x16aa2b,'id'));_0x3acaa1['where'](_0x0e4e('0x79'),_[_0x0e4e('0x2e')](_0x16aa2b,'id'));}});})[_0x0e4e('0x29')](function(){if(_0x587152[_0x0e4e('0x97')][_0x0e4e('0x98')]==='agent'&&!_0x16808c&&!_0x587152[_0x0e4e('0x42')][_0x0e4e('0x78')])return[];return db[_0x0e4e('0x9c')]['query'](_0x27aaa7[_0x0e4e('0x9d')](),_0x404499);})[_0x0e4e('0x29')](function(_0xb3faf3){_0x48aa54[_0x0e4e('0x24')]=_0xb3faf3['length'];if(_0x48aa54[_0x0e4e('0x24')]===0x0)return[];return db['sequelize']['query'](_0x116461[_0x0e4e('0x9d')](),_0x404499)[_0x0e4e('0x29')](function(_0x570d23){_0x144ee5=_[_0x0e4e('0x9e')](_0x570d23,'id');_0x404499=_['merge'](_0x404499,{'model':db[_0x0e4e('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x587152[_0x0e4e('0x42')][_0x0e4e('0x47')]){_0x155cf5[_0x0e4e('0x45')][_0x0e4e('0x32')](function(_0x4494a3){_0x3acaa1[_0x0e4e('0x4e')]('i.'+_0x4494a3);});}else{_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0x91'),_0x0e4e('0x64'));_0x3acaa1['field'](_0x0e4e('0x9f'),_0x0e4e('0xa0'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xa1'),_0x0e4e('0xa2'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xa3'),'contactName');_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xa4'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xa5'),_0x0e4e('0xa6'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xa7'),_0x0e4e('0xa8'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xa9'),_0x0e4e('0xaa'));_0x3acaa1[_0x0e4e('0x4e')]('c.phone',_0x0e4e('0xab'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xac'),_0x0e4e('0xad'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xae'),_0x0e4e('0xaf'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xb0'),'Owner.fullname');_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xb1'),_0x0e4e('0xb2'));_0x3acaa1[_0x0e4e('0x4e')](_0x0e4e('0xb3'),_0x0e4e('0x30'));}if(_0x155cf5[_0x0e4e('0x23')])_0x3acaa1['limit'](_0x155cf5[_0x0e4e('0x23')]);if(_0x155cf5['offset'])_0x3acaa1[_0x0e4e('0x21')](_0x155cf5[_0x0e4e('0x21')]);return db[_0x0e4e('0x9c')][_0x0e4e('0x42')](_0x3acaa1[_0x0e4e('0x9d')](),_0x404499);})['then'](function(_0x24bbcd){if(_0x24bbcd[_0x0e4e('0x48')]>0x0)_0x1e7e0a[_0x0e4e('0x4b')]('ui.SmsInteractionId\x20IN\x20?',_[_0x0e4e('0x2e')](_0x24bbcd,'id'));return db[_0x0e4e('0x9c')][_0x0e4e('0x42')](_0x1e7e0a[_0x0e4e('0x9d')](),_0x404499)[_0x0e4e('0x29')](function(_0x8967f7){var _0x572193=_[_0x0e4e('0xb4')](_0x8967f7,'SmsInteractionId');var _0x973c23=[];_0x24bbcd[_0x0e4e('0x32')](function(_0x9f536b){_0x973c23[_0x0e4e('0x33')](updateSmsInteraction(_0x9f536b,_0x144ee5,_0x572193));});return BPromise[_0x0e4e('0xb5')](_0x973c23);});});})[_0x0e4e('0x29')](function(_0x2c3b8b){_0x48aa54[_0x0e4e('0xb6')]=_0x2c3b8b;return _0x48aa54;})[_0x0e4e('0x29')](respondWithFilteredResult(_0x40fd94,_0x155cf5))[_0x0e4e('0x34')](handleError(_0x40fd94,null));};exports[_0x0e4e('0xb7')]=function(_0x184251,_0x5a25f5){var _0x37e8ec={'raw':![],'where':{'id':_0x184251[_0x0e4e('0xb8')]['id']}},_0x3a9c23={};_0x3a9c23[_0x0e4e('0x41')]=_[_0x0e4e('0x43')](db['SmsInteraction'][_0x0e4e('0x3e')]);_0x3a9c23[_0x0e4e('0x42')]=_[_0x0e4e('0x43')](_0x184251[_0x0e4e('0x42')]);_0x3a9c23[_0x0e4e('0x44')]=_[_0x0e4e('0x46')](_0x3a9c23[_0x0e4e('0x41')],_0x3a9c23[_0x0e4e('0x42')]);_0x37e8ec[_0x0e4e('0x45')]=_[_0x0e4e('0x46')](_0x3a9c23[_0x0e4e('0x41')],qs['fields'](_0x184251[_0x0e4e('0x42')][_0x0e4e('0x47')]));_0x37e8ec[_0x0e4e('0x45')]=_0x37e8ec[_0x0e4e('0x45')][_0x0e4e('0x48')]?_0x37e8ec[_0x0e4e('0x45')]:_0x3a9c23[_0x0e4e('0x41')];if(_0x184251[_0x0e4e('0x42')][_0x0e4e('0xb9')]){_0x37e8ec['include']=[{'all':!![]}];}_0x37e8ec=_[_0x0e4e('0xba')]({},_0x37e8ec,_0x184251[_0x0e4e('0xbb')]);return db['SmsInteraction'][_0x0e4e('0x63')](_0x37e8ec)[_0x0e4e('0x29')](handleEntityNotFound(_0x5a25f5,null))[_0x0e4e('0x29')](respondWithResult(_0x5a25f5,null))[_0x0e4e('0x34')](handleError(_0x5a25f5,null));};exports[_0x0e4e('0xbc')]=function(_0x106401,_0x43fa50){return db[_0x0e4e('0x3d')][_0x0e4e('0xbc')](_0x106401[_0x0e4e('0x74')],{})['then'](respondWithResult(_0x43fa50,0xc9))['catch'](handleError(_0x43fa50,null));};exports['update']=function(_0x5d26de,_0x4b89d4){if(_0x5d26de[_0x0e4e('0x74')]['id']){delete _0x5d26de[_0x0e4e('0x74')]['id'];}return db[_0x0e4e('0x3d')][_0x0e4e('0x63')]({'where':{'id':_0x5d26de['params']['id']}})[_0x0e4e('0x29')](handleEntityNotFound(_0x4b89d4,null))[_0x0e4e('0x29')](saveUpdates(_0x5d26de[_0x0e4e('0x74')],null))[_0x0e4e('0x29')](respondWithResult(_0x4b89d4,null))[_0x0e4e('0x34')](handleError(_0x4b89d4,null));};exports[_0x0e4e('0xbd')]=function(_0x480471,_0x42fd58){return db[_0x0e4e('0x3d')][_0x0e4e('0x63')]({'where':{'id':_0x480471[_0x0e4e('0xb8')]['id']}})['then'](handleEntityNotFound(_0x42fd58,null))[_0x0e4e('0x29')](removeEntity(_0x42fd58,null))[_0x0e4e('0x34')](handleError(_0x42fd58,null));};exports[_0x0e4e('0xbe')]=function(_0x80132f,_0x196e37){return db[_0x0e4e('0x3d')][_0x0e4e('0xbe')]()[_0x0e4e('0x29')](respondWithResult(_0x196e37,null))[_0x0e4e('0x34')](handleError(_0x196e37,null));};exports[_0x0e4e('0xbf')]=function(_0x2e5b71,_0x13dedf,_0x4b0ca8){return db[_0x0e4e('0xc0')][_0x0e4e('0x63')]({'where':{'id':_0x2e5b71[_0x0e4e('0xb8')]['id']}})[_0x0e4e('0x29')](handleEntityNotFound(_0x13dedf,null))[_0x0e4e('0x29')](function(_0x1dc969){if(_0x1dc969){return _0x1dc969[_0x0e4e('0xbf')](_0x2e5b71['body'][_0x0e4e('0xc1')],_['omit'](_0x2e5b71[_0x0e4e('0x74')],['ids','id'])||{});}})[_0x0e4e('0x29')](respondWithResult(_0x13dedf,null))['catch'](handleError(_0x13dedf,null));};exports[_0x0e4e('0xc2')]=function(_0x470026,_0x148b6e,_0x5d76ab){var _0x284aa0={'raw':![],'where':{}};var _0x3caba6={};var _0x834271={'count':0x0,'rows':[]};return db[_0x0e4e('0x3d')][_0x0e4e('0xc3')]({'where':{'id':_0x470026[_0x0e4e('0xb8')]['id']}})['then'](handleEntityNotFound(_0x148b6e,null))[_0x0e4e('0x29')](function(_0x463a5a){if(_0x463a5a){_0x3caba6[_0x0e4e('0x41')]=_[_0x0e4e('0x43')](db[_0x0e4e('0xc0')][_0x0e4e('0x3e')]);_0x3caba6['query']=_[_0x0e4e('0x43')](_0x470026['query']);_0x3caba6[_0x0e4e('0x44')]=_['intersection'](_0x3caba6['model'],_0x3caba6['query']);_0x284aa0[_0x0e4e('0x45')]=_[_0x0e4e('0x46')](_0x3caba6[_0x0e4e('0x41')],qs['fields'](_0x470026[_0x0e4e('0x42')][_0x0e4e('0x47')]));_0x284aa0[_0x0e4e('0x45')]=_0x284aa0[_0x0e4e('0x45')][_0x0e4e('0x48')]?_0x284aa0[_0x0e4e('0x45')]:_0x3caba6[_0x0e4e('0x41')];if(!_0x470026[_0x0e4e('0x42')]['hasOwnProperty'](_0x0e4e('0x49'))){_0x284aa0[_0x0e4e('0x23')]=qs['limit'](_0x470026['query']['limit']);_0x284aa0['offset']=qs['offset'](_0x470026[_0x0e4e('0x42')][_0x0e4e('0x21')]);}_0x284aa0[_0x0e4e('0x92')]=qs[_0x0e4e('0x4a')](_0x470026[_0x0e4e('0x42')][_0x0e4e('0x4a')]);_0x284aa0[_0x0e4e('0x4b')]=qs['filters'](_[_0x0e4e('0x4c')](_0x470026['query'],_0x3caba6[_0x0e4e('0x44')]));_0x284aa0[_0x0e4e('0x4b')]['SmsInteractionId']=_0x463a5a['id'];if(_0x470026[_0x0e4e('0x42')][_0x0e4e('0x88')]){_0x284aa0['where']=_[_0x0e4e('0xba')](_0x284aa0[_0x0e4e('0x4b')],{'$or':_[_0x0e4e('0x2e')](_0x284aa0[_0x0e4e('0x45')],function(_0x25c975){var _0x2a37c6={};_0x2a37c6[_0x25c975]={'$like':'%'+_0x470026['query'][_0x0e4e('0x88')]+'%'};return _0x2a37c6;})});}if(_0x470026[_0x0e4e('0x42')][_0x0e4e('0x7c')]){var _0x45c962=_0x470026[_0x0e4e('0x42')][_0x0e4e('0x7c')]['split'](',');var _0x34082d={};_0x34082d[_0x45c962[0x0]]={'$gte':moment(_0x45c962[0x1])[_0x0e4e('0xc4')](_0x0e4e('0xc5'))};_0x284aa0[_0x0e4e('0x4b')]=_[_0x0e4e('0xba')](_0x284aa0[_0x0e4e('0x4b')],_0x34082d);}_0x284aa0=_['merge']({},_0x284aa0,_0x470026[_0x0e4e('0xbb')]);return db[_0x0e4e('0xc0')][_0x0e4e('0x24')]({'where':_0x284aa0[_0x0e4e('0x4b')]})[_0x0e4e('0x29')](function(_0x4ae851){_0x834271[_0x0e4e('0x24')]=_0x4ae851;if(_0x470026['query']['includeAll']){_0x284aa0[_0x0e4e('0xc6')]=[{'all':!![]}];}return db[_0x0e4e('0xc0')][_0x0e4e('0xc7')](_0x284aa0);})['then'](function(_0x306565){_0x834271[_0x0e4e('0xb6')]=_0x306565;return _0x834271;});}})[_0x0e4e('0x29')](respondWithFilteredResult(_0x148b6e,_0x284aa0))['catch'](handleError(_0x148b6e,null));};exports[_0x0e4e('0xc8')]=function(_0x20c6e0,_0x44a569,_0x1975c2){return db['SmsInteraction'][_0x0e4e('0x63')]({'where':{'id':_0x20c6e0[_0x0e4e('0xb8')]['id']}})[_0x0e4e('0x29')](handleEntityNotFound(_0x44a569,null))[_0x0e4e('0x29')](function(_0x4363ba){if(_0x4363ba){return _0x4363ba[_0x0e4e('0xc9')](_0x20c6e0[_0x0e4e('0x74')]['ids'],_['omit'](_0x20c6e0[_0x0e4e('0x74')],[_0x0e4e('0xc1'),'id'])||{})[_0x0e4e('0xca')](function(){return db[_0x0e4e('0x71')][_0x0e4e('0xc7')]({'attributes':['id',_0x0e4e('0x2c'),'color'],'where':{'id':_0x20c6e0[_0x0e4e('0x74')][_0x0e4e('0xc1')]}});})[_0x0e4e('0x29')](function(_0x3ec305){socket[_0x0e4e('0xcb')](_0x0e4e('0xcc'),{'id':Number(_0x20c6e0[_0x0e4e('0xb8')]['id']),'tags':_0x3ec305||[]});return{'id':Number(_0x20c6e0[_0x0e4e('0xb8')]['id']),'tags':_0x3ec305||[]};});}})[_0x0e4e('0x29')](respondWithResult(_0x44a569,null))[_0x0e4e('0x34')](handleError(_0x44a569,null));};exports[_0x0e4e('0xcd')]=function(_0x2aab00,_0xcb9ee8,_0xdbf780){return db['SmsInteraction'][_0x0e4e('0x63')]({'where':{'id':_0x2aab00[_0x0e4e('0xb8')]['id']}})['then'](handleEntityNotFound(_0xcb9ee8,null))[_0x0e4e('0x29')](function(_0x5c587f){if(_0x5c587f){return _0x5c587f[_0x0e4e('0xcd')](_0x2aab00[_0x0e4e('0x42')]['ids']);}})[_0x0e4e('0x29')](respondWithStatusCode(_0xcb9ee8,null))['catch'](handleError(_0xcb9ee8,null));};exports[_0x0e4e('0xce')]=function(_0x4eed80,_0x51c49b){var _0x32f441=moment()[_0x0e4e('0xcf')]()[_0x0e4e('0x9d')]();var _0x44df89=path['join'](config[_0x0e4e('0xd0')],_0x0e4e('0xd1'),_0x0e4e('0xd2'),_0x0e4e('0xd3'));var _0x45b67a=path[_0x0e4e('0xd4')](config[_0x0e4e('0xd0')],'server',_0x0e4e('0xd2'),_0x0e4e('0xd5'));var _0x2de86b=path[_0x0e4e('0xd4')](_0x44df89,_0x32f441);var _0x53f357=util['format'](_0x0e4e('0xd6'),_0x4eed80['params']['id'],_0x32f441);var _0x223b3d=path['join'](_0x44df89,_0x53f357);var _0x4eeac8=[];_0x4eeac8['push']({'model':db[_0x0e4e('0x72')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x4eeac8[_0x0e4e('0x33')]({'model':db[_0x0e4e('0xd7')],'as':_0x0e4e('0xd8'),'attributes':['id',_0x0e4e('0xd9'),_0x0e4e('0xda')],'raw':!![]});var _0x1b8168=[{'model':db[_0x0e4e('0xc0')],'as':_0x0e4e('0xdb'),'attributes':['id',_0x0e4e('0x74'),_0x0e4e('0x7b'),'direction',_0x0e4e('0xdc'),_0x0e4e('0x81')],'include':_0x4eeac8}];_0x1b8168[_0x0e4e('0x33')]({'model':db[_0x0e4e('0xdd')],'as':_0x0e4e('0xde'),'attributes':['id',_0x0e4e('0x2c')]});_0x1b8168['push']({'model':db[_0x0e4e('0x72')],'as':_0x0e4e('0xdf'),'attributes':['id','fullname']});return db[_0x0e4e('0x3d')][_0x0e4e('0x63')]({'where':{'id':_0x4eed80[_0x0e4e('0xb8')]['id']},'include':_0x1b8168})[_0x0e4e('0x29')](handleEntityNotFound(_0x51c49b,null))[_0x0e4e('0x29')](function(_0x3ba4a0){if(_0x3ba4a0){var _0x35e6c6=_0x3ba4a0[_0x0e4e('0xe0')]({'plain':!![]});fs[_0x0e4e('0xe1')](_0x2de86b);var _0x8c529b={'channel':_0x0e4e('0xe2'),'account':_0x35e6c6['Account'][_0x0e4e('0x2c')],'agent':_0x35e6c6[_0x0e4e('0xdf')]?_0x35e6c6[_0x0e4e('0xdf')][_0x0e4e('0x2f')]:'N.A.','createdAt':moment(_0x35e6c6[_0x0e4e('0x7b')])[_0x0e4e('0xc4')](_0x0e4e('0xc5'))['toString'](),'closedAt':_0x35e6c6['closed']?moment(_0x35e6c6[_0x0e4e('0xe3')])[_0x0e4e('0xc4')](_0x0e4e('0xc5'))['toString']():'','disposition':_0x35e6c6[_0x0e4e('0xe4')],'messages':_(_0x35e6c6[_0x0e4e('0xdb')])['filter']({'secret':![]})[_0x0e4e('0x2e')](function(_0x366e14){return{'date':moment(_0x366e14['createdAt'])[_0x0e4e('0xc4')](_0x0e4e('0xc5'))[_0x0e4e('0x9d')](),'sender':_0x366e14['direction']===_0x0e4e('0xe5')?_0x366e14[_0x0e4e('0x72')]?_0x366e14[_0x0e4e('0x72')]['fullname']:'System':_0x366e14[_0x0e4e('0xd8')][_0x0e4e('0xd9')]+(_0x366e14[_0x0e4e('0xd8')][_0x0e4e('0xda')]?'\x20'+_0x366e14[_0x0e4e('0xd8')][_0x0e4e('0xda')]:''),'body':_0x366e14[_0x0e4e('0x74')],'direction':_0x366e14[_0x0e4e('0xe6')]===_0x0e4e('0xe5')?'A':'C','secret':_0x366e14[_0x0e4e('0xdc')],'read':_0x366e14[_0x0e4e('0x81')]};})[_0x0e4e('0x65')]()};return ejs[_0x0e4e('0xe7')](path['join'](config[_0x0e4e('0xd0')],'server',_0x0e4e('0xe8'),'downloadInteraction.ejs'),{'interaction':_0x8c529b})[_0x0e4e('0x29')](function(_0x36ef65){var _0x520230=path['join'](_0x2de86b,_0x0e4e('0xe9')+_0x35e6c6['id']+'-'+_0x32f441+_0x0e4e('0xea'));var _0x3fd54d={'path':_0x520230,'channel':_0x0e4e('0xe2'),'interactionId':_0x35e6c6['id']};return pdf['createPdfFromHTML'](_0x36ef65,_0x3fd54d);})[_0x0e4e('0x29')](function(){return new BPromise(function(_0x35b58f,_0x157aa2){zipdir(_0x2de86b,{'saveTo':_0x223b3d},function(_0x3d982f,_0x5894b0){if(_0x3d982f)return _0x157aa2(_0x3d982f);return _0x35b58f(_0x5894b0);});})[_0x0e4e('0x29')](function(){return new BPromise(function(_0x2f9b40,_0x396f66){rimraf(_0x2de86b,function(_0x59b698){if(_0x59b698)_0x396f66(_0x59b698);return _0x2f9b40();});});})['then'](function(){return _0x51c49b[_0x0e4e('0xce')](_0x223b3d,_0x53f357,function(_0xef445a){if(_0xef445a){console[_0x0e4e('0xeb')](_0x0e4e('0xec'),_0xef445a);}else{fs[_0x0e4e('0xed')](_0x223b3d);}});});});}else{return _0x51c49b[_0x0e4e('0x1d')](0xc8);}})['catch'](handleError(_0x51c49b,null));}; \ No newline at end of file +var _0x9137=['buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','SmsAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','all','rows','params','SmsInteraction','includeAll','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','SmsInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','spread','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','Contact','Messages','direction','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','out','System','firstName','lastName','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','map','fullname','Tags','TagIds','split','forEach','push','catch','waiting','talking','unmanaged','total','closed','UserId','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','unreadMessages','value','having','`\x20=\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId'];(function(_0x1943d9,_0x245bb8){var _0x4b4f3f=function(_0x3bba90){while(--_0x3bba90){_0x1943d9['push'](_0x1943d9['shift']());}};_0x4b4f3f(++_0x245bb8);}(_0x9137,0x7e));var _0x7913=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0x9137[_0x133fe4];return _0x4c4017;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7913('0x0'));var jsonpatch=require(_0x7913('0x1'));var rp=require(_0x7913('0x2'));var moment=require(_0x7913('0x3'));var BPromise=require(_0x7913('0x4'));var Mustache=require(_0x7913('0x5'));var util=require(_0x7913('0x6'));var path=require(_0x7913('0x7'));var sox=require(_0x7913('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7913('0x9'));var squel=require('squel');var crypto=require(_0x7913('0xa'));var jsforce=require(_0x7913('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7913('0xc'));var querystring=require('querystring');var Papa=require(_0x7913('0xd'));var Redis=require(_0x7913('0xe'));var authService=require(_0x7913('0xf'));var qs=require(_0x7913('0x10'));var as=require(_0x7913('0x11'));var pdf=require(_0x7913('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7913('0x13'))(_0x7913('0x14'));var utils=require(_0x7913('0x15'));var config=require(_0x7913('0x16'));var licenseUtil=require(_0x7913('0x17'));var db=require(_0x7913('0x18'))['db'];config['redis']=_[_0x7913('0x19')](config[_0x7913('0x1a')],{'host':_0x7913('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7913('0x1a')]));require(_0x7913('0x1c'))[_0x7913('0x1d')](socket);function respondWithStatusCode(_0x5784f9,_0x707c59){_0x707c59=_0x707c59||0xcc;return function(_0x57d550){if(_0x57d550){return _0x5784f9[_0x7913('0x1e')](_0x707c59);}return _0x5784f9[_0x7913('0x1f')](_0x707c59)[_0x7913('0x20')]();};}function respondWithResult(_0x6e9cb8,_0x3a2ee6){_0x3a2ee6=_0x3a2ee6||0xc8;return function(_0x1fa7cf){if(_0x1fa7cf){return _0x6e9cb8[_0x7913('0x1f')](_0x3a2ee6)[_0x7913('0x21')](_0x1fa7cf);}};}function respondWithFilteredResult(_0x1e1631,_0x7dbb23){return function(_0x3741eb){if(_0x3741eb){var _0x2b4a1c=typeof _0x7dbb23['offset']===_0x7913('0x22')&&typeof _0x7dbb23[_0x7913('0x23')]===_0x7913('0x22');var _0x5063e3=_0x3741eb[_0x7913('0x24')];var _0x4524b0=_0x2b4a1c?0x0:_0x7dbb23[_0x7913('0x25')];var _0x4cbc09=_0x2b4a1c?_0x3741eb[_0x7913('0x24')]:_0x7dbb23['offset']+_0x7dbb23[_0x7913('0x23')];var _0x11b939;if(_0x4cbc09>=_0x5063e3){_0x4cbc09=_0x5063e3;_0x11b939=0xc8;}else{_0x11b939=0xce;}_0x1e1631['status'](_0x11b939);return _0x1e1631[_0x7913('0x26')]('Content-Range',_0x4524b0+'-'+_0x4cbc09+'/'+_0x5063e3)['json'](_0x3741eb);}return null;};}function patchUpdates(_0x875318){return function(_0x3d0d4c){try{jsonpatch['apply'](_0x3d0d4c,_0x875318,!![]);}catch(_0x2e215a){return BPromise[_0x7913('0x27')](_0x2e215a);}return _0x3d0d4c[_0x7913('0x28')]();};}function saveUpdates(_0x27b9ee,_0x2b18ad){return function(_0x146eb7){if(_0x146eb7){return _0x146eb7[_0x7913('0x29')](_0x27b9ee)[_0x7913('0x2a')](function(_0x228983){return _0x228983;});}return null;};}function removeEntity(_0x22b76a,_0x3932f3){return function(_0x52e9dc){if(_0x52e9dc){return _0x52e9dc[_0x7913('0x2b')]()[_0x7913('0x2a')](function(){_0x22b76a[_0x7913('0x1f')](0xcc)[_0x7913('0x20')]();});}};}function handleEntityNotFound(_0xd66b5d,_0x3c710c){return function(_0x175d2c){if(!_0x175d2c){_0xd66b5d[_0x7913('0x1e')](0x194);}return _0x175d2c;};}function handleError(_0x27a51e,_0x43f0da){_0x43f0da=_0x43f0da||0x1f4;return function(_0x164f02){logger[_0x7913('0x2c')](_0x164f02[_0x7913('0x2d')]);if(_0x164f02['name']){delete _0x164f02[_0x7913('0x2e')];}_0x27a51e[_0x7913('0x1f')](_0x43f0da)[_0x7913('0x2f')](_0x164f02);};}function getInteractionUsers(_0x8bb35a,_0x48e4c2){return new BPromise(function(_0x7f18d9,_0x5ea08e){try{if(_0x48e4c2[_0x8bb35a['id']]){_0x8bb35a['Users']=_[_0x7913('0x30')](_0x48e4c2[_0x8bb35a['id']],function(_0x3c556a){return{'id':_0x3c556a['id'],'fullname':_0x3c556a[_0x7913('0x31')]};});}}catch(_0x45b58d){_0x5ea08e(_0x45b58d);}_0x7f18d9(_0x8bb35a);});}function getInteractionTags(_0x147dc4,_0x9cec78){return new BPromise(function(_0x4982ff,_0xa30d16){try{if(_0x147dc4['TagIds']){_0x147dc4[_0x7913('0x32')]=[];_0x147dc4[_0x7913('0x33')][_0x7913('0x34')](',')[_0x7913('0x35')](function(_0x57423d){_0x147dc4['Tags'][_0x7913('0x36')](_0x9cec78[_0x57423d]);});}delete _0x147dc4[_0x7913('0x33')];}catch(_0x47b9f5){_0xa30d16(_0x47b9f5);}_0x4982ff(_0x147dc4);});}function updateSmsInteraction(_0x2d8f69,_0x4dc4e9,_0x49d788){return new BPromise(function(_0x53b529,_0x524b47){return getInteractionUsers(_0x2d8f69,_0x49d788)['then'](function(_0x49faaf){return getInteractionTags(_0x49faaf,_0x4dc4e9);})[_0x7913('0x2a')](function(_0x5b6619){return getStateInteraction(_0x5b6619);})[_0x7913('0x2a')](function(_0x1eb97b){_0x53b529(_0x1eb97b);})[_0x7913('0x37')](function(_0x2b009f){_0x524b47(_0x2b009f);});});}function getStateInteraction(_0x5f4cc6){return new BPromise(function(_0x1186df){_0x5f4cc6[_0x7913('0x38')]=0x0;_0x5f4cc6[_0x7913('0x39')]=0x0;_0x5f4cc6['answered']=0x0;_0x5f4cc6[_0x7913('0x3a')]=0x0;_0x5f4cc6[_0x7913('0x3b')]=0x0;if(!_0x5f4cc6['closed']&&!_0x5f4cc6['UserId']){_0x5f4cc6[_0x7913('0x38')]+=0x1;}if(!_0x5f4cc6[_0x7913('0x3c')]&&_0x5f4cc6[_0x7913('0x3d')]){_0x5f4cc6['talking']+=0x1;if(_0x5f4cc6[_0x7913('0x38')]){_0x5f4cc6[_0x7913('0x38')]-=0x1;}}if(_0x5f4cc6[_0x7913('0x3c')]&&_0x5f4cc6['UserId']){_0x5f4cc6['answered']+=0x1;if(_0x5f4cc6[_0x7913('0x39')]){_0x5f4cc6['talking']-=0x1;}}if(_0x5f4cc6[_0x7913('0x3c')]&&!_0x5f4cc6[_0x7913('0x3d')]){_0x5f4cc6['unmanaged']+=0x1;if(_0x5f4cc6[_0x7913('0x38')]){_0x5f4cc6[_0x7913('0x38')]-=0x1;}}_0x5f4cc6[_0x7913('0x3b')]+=0x1;_0x1186df(_0x5f4cc6);});}exports['index']=function(_0x554595,_0x54263a){var _0x356e38={},_0x2b7709={},_0x2e3f5a={'count':0x0,'rows':[]};var _0x4d04ce=_[_0x7913('0x30')](db['SmsInteraction'][_0x7913('0x3e')],function(_0x1c5e34){return{'name':_0x1c5e34['fieldName'],'type':_0x1c5e34[_0x7913('0x3f')][_0x7913('0x40')]};});_0x2b7709[_0x7913('0x41')]=_[_0x7913('0x30')](_0x4d04ce,_0x7913('0x2e'));_0x2b7709[_0x7913('0x42')]=_[_0x7913('0x43')](_0x554595['query']);_0x2b7709[_0x7913('0x44')]=_[_0x7913('0x45')](_0x2b7709[_0x7913('0x41')],_0x2b7709[_0x7913('0x42')]);_0x356e38['attributes']=_['intersection'](_0x2b7709['model'],qs[_0x7913('0x46')](_0x554595[_0x7913('0x42')][_0x7913('0x46')]));_0x356e38[_0x7913('0x47')]=_0x356e38['attributes'][_0x7913('0x48')]?_0x356e38[_0x7913('0x47')]:_0x2b7709[_0x7913('0x41')];if(!_0x554595[_0x7913('0x42')][_0x7913('0x49')](_0x7913('0x4a'))){_0x356e38['limit']=qs['limit'](_0x554595[_0x7913('0x42')]['limit']);_0x356e38[_0x7913('0x25')]=qs[_0x7913('0x25')](_0x554595['query'][_0x7913('0x25')]);}_0x356e38[_0x7913('0x4b')]=qs[_0x7913('0x4c')](_0x554595[_0x7913('0x42')][_0x7913('0x4c')]);_0x356e38[_0x7913('0x4d')]=qs['filters'](_[_0x7913('0x4e')](_0x554595[_0x7913('0x42')],_0x2b7709[_0x7913('0x44')]),_0x4d04ce);var _0x4cd3c3=[];var _0x24f1e2=squel[_0x7913('0x4f')]()[_0x7913('0x50')]('id')[_0x7913('0x50')](_0x7913('0x2e'))[_0x7913('0x50')](_0x7913('0x51'))[_0x7913('0x52')](_0x7913('0x53'));var _0xfc4a08=squel[_0x7913('0x4f')]()['field'](_0x7913('0x54'))[_0x7913('0x50')](_0x7913('0x55'))[_0x7913('0x50')](_0x7913('0x56'))[_0x7913('0x52')](_0x7913('0x57'),'ui')['left_join']('users','u',_0x7913('0x58'));var _0x55be37=squel[_0x7913('0x4f')]()[_0x7913('0x52')]('sms_interactions','i')['left_join'](_0x7913('0x59'),'c',_0x7913('0x5a'))[_0x7913('0x5b')](_0x7913('0x5c'),'o',_0x7913('0x5d'))[_0x7913('0x5b')](_0x7913('0x5e'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x7913('0x5f'),'me',_0x7913('0x60'))[_0x7913('0x5b')](_0x7913('0x61'),'it',_0x7913('0x62'))[_0x7913('0x5b')]('tools_tags','t',_0x7913('0x63'));var _0x29bdce=squel['expr']();var _0x5cd5c9=[];var _0x3bf25e=squel['expr']();var _0x157164;if(_0x554595[_0x7913('0x42')][_0x7913('0x64')]){_0x157164=as[_0x7913('0x65')](_0x554595[_0x7913('0x42')][_0x7913('0x64')]);var _0x8f34e5=_0x157164[_0x7913('0x66')];for(var _0x544a90=0x0;_0x544a90<_0x157164['conditions']['length'];_0x544a90++){var _0x6bfa51=_0x157164['conditions'][_0x544a90];var _0x3c1b39='i';var _0x4b8047=_['find'](_0x4d04ce,['name',_0x6bfa51[_0x7913('0x50')]]);if(!_0x4b8047){switch(_0x6bfa51['field']){case _0x7913('0x67'):if(_0x6bfa51[_0x7913('0x68')]==0x1){_0x55be37[_0x7913('0x69')]('`'+_0x6bfa51['field']+_0x7913('0x6a'));}else{_0x55be37[_0x7913('0x69')]('`'+_0x6bfa51[_0x7913('0x50')]+'`\x20>\x200');}break;case'Contact':if(_0x6bfa51[_0x7913('0x6b')]==='$substring'){if(_0x6bfa51[_0x7913('0x68')][_0x7913('0x34')]('\x20')[_0x7913('0x48')]>0x1){_0x29bdce[_0x8f34e5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7913('0x6c')](_0x6bfa51[_0x7913('0x68')]),null);}else{var _0x12669d='%'+_0x6bfa51[_0x7913('0x68')]+'%';_0x29bdce[_0x8f34e5](_0x7913('0x6d'),_0x12669d,_0x12669d,_0x12669d);}}else{_0x4b8047=_[_0x7913('0x6e')](_0x4d04ce,[_0x7913('0x2e'),_0x7913('0x6f')]);_0x6bfa51[_0x7913('0x50')]='ContactId';_0x4102b7=as[_0x7913('0x70')](_0x3c1b39,_0x4b8047[_0x7913('0x3f')],_0x6bfa51);_0x29bdce[_0x8f34e5](_0x4102b7[_0x7913('0x71')],_0x4102b7['value'][_0x7913('0x72')],_0x4102b7[_0x7913('0x68')]['end']);}break;case _0x7913('0x73'):var _0x2d8f67=_0x6bfa51[_0x7913('0x68')][_0x7913('0x34')](',')[_0x7913('0x30')](function(_0x3b1c3b){return Number(_0x3b1c3b);});_0x2d8f67[_0x7913('0x35')](function(_0x43ffc0){_0x3bf25e['or'](_0x7913('0x74'),'%,'+_0x43ffc0+',%');});_0x5cd5c9=_['union'](_0x5cd5c9,_0x2d8f67);break;case _0x7913('0x75'):if(_0x6bfa51[_0x7913('0x6b')]==='$substring'){_0x29bdce[_0x8f34e5](_0x7913('0x76'),'%'+_0x6bfa51[_0x7913('0x68')]+'%',null);}else{_0x4b8047=_[_0x7913('0x6e')](_0x4d04ce,[_0x7913('0x2e'),_0x7913('0x3d')]);_0x6bfa51['field']='UserId';_0x4102b7=as[_0x7913('0x70')](_0x3c1b39,_0x4b8047[_0x7913('0x3f')],_0x6bfa51);_0x29bdce[_0x8f34e5](_0x4102b7[_0x7913('0x71')],_0x4102b7['value']['start'],_0x4102b7['value'][_0x7913('0x20')]);}break;case _0x7913('0x77'):_0x4102b7=as[_0x7913('0x70')]('me',null,_0x6bfa51);_0x29bdce[_0x8f34e5](_0x4102b7['text'],_0x4102b7['value']['start'],_0x4102b7[_0x7913('0x68')][_0x7913('0x20')]);break;}}else{var _0x4102b7=as[_0x7913('0x70')](_0x3c1b39,_0x4b8047[_0x7913('0x3f')],_0x6bfa51);_0x29bdce[_0x8f34e5](_0x4102b7[_0x7913('0x71')],_0x4102b7[_0x7913('0x68')]['start'],_0x4102b7[_0x7913('0x68')][_0x7913('0x20')]);}}}else{var _0x57982e=_(_0x554595[_0x7913('0x42')])[_0x7913('0x43')]()['map'](function(_0x54741d){return _[_0x7913('0x78')](_0x4d04ce,[_0x7913('0x2e'),_0x54741d])?_0x54741d:undefined;})[_0x7913('0x79')]()[_0x7913('0x68')]();if(!_[_0x7913('0x7a')](_0x57982e)){_0x57982e['forEach'](function(_0x2406f0){if(_0x2406f0===_0x7913('0x7b')){_0x55be37['where']('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x554595[_0x7913('0x42')][_0x2406f0]));}else if(_0x2406f0===_0x7913('0x7c')){var _0x1603e2=JSON[_0x7913('0x7d')](_0x554595[_0x7913('0x42')][_0x2406f0])[_0x7913('0x7e')];var _0x28aa14=JSON[_0x7913('0x7d')](_0x554595[_0x7913('0x42')][_0x2406f0])[_0x7913('0x7f')];_0x55be37['where'](_0x7913('0x80'),_0x1603e2,_0x28aa14);}else{if(_0x554595[_0x7913('0x42')][_0x2406f0]===_0x7913('0x81')){_0x55be37[_0x7913('0x4d')]('i.'+_0x2406f0+'\x20IS\x20NULL');}else{_0x55be37[_0x7913('0x4d')]('i.'+_0x2406f0+_0x7913('0x82'),_0x554595[_0x7913('0x42')][_0x2406f0]);}}});}if(_0x554595[_0x7913('0x42')]['read']){if(_0x554595[_0x7913('0x42')][_0x7913('0x83')]==0x1){_0x55be37['having'](_0x7913('0x84'));}else{_0x55be37[_0x7913('0x69')](_0x7913('0x85'));}}if(_0x554595[_0x7913('0x42')][_0x7913('0x86')]){_0x5cd5c9=_['isArray'](_0x554595[_0x7913('0x42')][_0x7913('0x86')])?_0x554595[_0x7913('0x42')][_0x7913('0x86')]:new Array(_0x554595[_0x7913('0x42')]['tag']);_0x5cd5c9[_0x7913('0x35')](function(_0x15bf9d){_0x3bf25e['or'](_0x7913('0x74'),'%,'+_0x15bf9d+',%');});}if(_0x554595['query'][_0x7913('0x87')]){var _0x33bbde=_0x554595[_0x7913('0x42')][_0x7913('0x87')]['replace']('\x5c','\x5c\x5c')[_0x7913('0x88')](/'/g,'\x27\x27');if(qs[_0x7913('0x89')](_0x33bbde)){_0x29bdce['or'](_0x7913('0x8a'),_0x33bbde+'%')['or'](_0x7913('0x8b'),_0x33bbde+'%');}else{_0x29bdce['or'](_0x7913('0x8c'),qs['getFullTextValue'](_0x33bbde))['or'](_0x7913('0x8d'),_0x33bbde+'%');}}}_0x55be37['where'](_0x29bdce);_0x55be37[_0x7913('0x8e')](_0x7913('0x8f'));var _0xcc8324={'type':db[_0x7913('0x90')][_0x7913('0x91')][_0x7913('0x92')],'raw':!![]};var _0x4bf3fa=_0x55be37[_0x7913('0x93')]();_0x4bf3fa['field'](_0x7913('0x8f'));_0x4bf3fa['field'](_0x7913('0x94'),_0x7913('0x67'));if(_0x356e38[_0x7913('0x4b')]){_0x356e38[_0x7913('0x4b')]['forEach'](function(_0xc69c53){var _0x33edb6=_0xc69c53[0x0]===_0x7913('0x95')?_0xc69c53[0x0]:'i.'+_0xc69c53[0x0];_0x55be37['order'](_0x33edb6,_0xc69c53[0x1]===_0x7913('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x5cd5c9)){_0x55be37[_0x7913('0x69')](_0x3bf25e);_0x4bf3fa[_0x7913('0x4d')]('t.id\x20IN\x20?',_0x5cd5c9);}BPromise[_0x7913('0x97')]()[_0x7913('0x2a')](function(){if(!_0x157164){if(_0x554595[_0x7913('0x42')][_0x7913('0x7b')])return;_0x4bf3fa['where'](_0x7913('0x98'));_0x55be37[_0x7913('0x4d')](_0x7913('0x98'));return;}if(_0x554595[_0x7913('0x99')][_0x7913('0x9a')]!==_0x7913('0x9b'))return;return _0x554595[_0x7913('0x99')][_0x7913('0x9c')]({'attributes':['id'],'raw':!![]})[_0x7913('0x2a')](function(_0x36feec){if(_[_0x7913('0x7a')](_0x36feec)){_0x4bf3fa[_0x7913('0x4d')]('i.SmsAccountId\x20IS\x20NULL');_0x55be37[_0x7913('0x4d')](_0x7913('0x9d'));}else{_0x4bf3fa[_0x7913('0x4d')](_0x7913('0x9e'),_[_0x7913('0x30')](_0x36feec,'id'));_0x55be37[_0x7913('0x4d')](_0x7913('0x9e'),_['map'](_0x36feec,'id'));}});})[_0x7913('0x2a')](function(){if(_0x554595[_0x7913('0x99')][_0x7913('0x9a')]===_0x7913('0x9b')&&!_0x157164&&!_0x554595[_0x7913('0x42')][_0x7913('0x7b')])return[];return db[_0x7913('0x9f')][_0x7913('0x42')](_0x4bf3fa[_0x7913('0xa0')](),_0xcc8324);})[_0x7913('0x2a')](function(_0x3b55a1){_0x2e3f5a[_0x7913('0x24')]=_0x3b55a1[_0x7913('0x48')];if(_0x2e3f5a['count']===0x0)return[];return db[_0x7913('0x9f')][_0x7913('0x42')](_0x24f1e2['toString'](),_0xcc8324)['then'](function(_0x3e6136){_0x4cd3c3=_['keyBy'](_0x3e6136,'id');_0xcc8324=_['merge'](_0xcc8324,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x554595['query'][_0x7913('0x46')]){_0x356e38[_0x7913('0x47')][_0x7913('0x35')](function(_0x3bbd2c){_0x55be37[_0x7913('0x50')]('i.'+_0x3bbd2c);});}else{_0x55be37[_0x7913('0x50')](_0x7913('0x94'),'unreadMessages');_0x55be37[_0x7913('0x50')](_0x7913('0xa1'),_0x7913('0xa2'));_0x55be37[_0x7913('0x50')](_0x7913('0xa3'),_0x7913('0xa4'));_0x55be37[_0x7913('0x50')]('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','contactName');_0x55be37['field'](_0x7913('0xa5'));_0x55be37['field'](_0x7913('0xa6'),'Contact.firstName');_0x55be37[_0x7913('0x50')](_0x7913('0xa7'),'Contact.lastName');_0x55be37[_0x7913('0x50')](_0x7913('0xa8'),_0x7913('0xa9'));_0x55be37[_0x7913('0x50')](_0x7913('0xaa'),_0x7913('0xab'));_0x55be37[_0x7913('0x50')](_0x7913('0xac'),_0x7913('0xad'));_0x55be37[_0x7913('0x50')](_0x7913('0xae'),_0x7913('0xaf'));_0x55be37[_0x7913('0x50')](_0x7913('0xb0'),'Owner.fullname');_0x55be37[_0x7913('0x50')]('o.internal',_0x7913('0xb1'));_0x55be37[_0x7913('0x50')](_0x7913('0xb2'),'TagIds');}if(_0x356e38['limit'])_0x55be37[_0x7913('0x23')](_0x356e38[_0x7913('0x23')]);if(_0x356e38[_0x7913('0x25')])_0x55be37[_0x7913('0x25')](_0x356e38[_0x7913('0x25')]);return db[_0x7913('0x9f')]['query'](_0x55be37['toString'](),_0xcc8324);})[_0x7913('0x2a')](function(_0x230523){if(_0x230523[_0x7913('0x48')]>0x0)_0xfc4a08[_0x7913('0x4d')](_0x7913('0xb3'),_[_0x7913('0x30')](_0x230523,'id'));return db['sequelize']['query'](_0xfc4a08[_0x7913('0xa0')](),_0xcc8324)[_0x7913('0x2a')](function(_0x58c4fe){var _0x18403d=_['groupBy'](_0x58c4fe,'SmsInteractionId');var _0x48aa43=[];_0x230523[_0x7913('0x35')](function(_0x289605){_0x48aa43[_0x7913('0x36')](updateSmsInteraction(_0x289605,_0x4cd3c3,_0x18403d));});return BPromise[_0x7913('0xb4')](_0x48aa43);});});})[_0x7913('0x2a')](function(_0x158dfd){_0x2e3f5a[_0x7913('0xb5')]=_0x158dfd;return _0x2e3f5a;})[_0x7913('0x2a')](respondWithFilteredResult(_0x54263a,_0x356e38))[_0x7913('0x37')](handleError(_0x54263a,null));};exports['show']=function(_0x6583ab,_0x271ccf){var _0x3d391f={'raw':![],'where':{'id':_0x6583ab[_0x7913('0xb6')]['id']}},_0x50dd90={};_0x50dd90[_0x7913('0x41')]=_[_0x7913('0x43')](db[_0x7913('0xb7')][_0x7913('0x3e')]);_0x50dd90['query']=_['keys'](_0x6583ab[_0x7913('0x42')]);_0x50dd90['filters']=_[_0x7913('0x45')](_0x50dd90[_0x7913('0x41')],_0x50dd90['query']);_0x3d391f[_0x7913('0x47')]=_[_0x7913('0x45')](_0x50dd90['model'],qs[_0x7913('0x46')](_0x6583ab[_0x7913('0x42')][_0x7913('0x46')]));_0x3d391f[_0x7913('0x47')]=_0x3d391f[_0x7913('0x47')]['length']?_0x3d391f[_0x7913('0x47')]:_0x50dd90[_0x7913('0x41')];if(_0x6583ab[_0x7913('0x42')][_0x7913('0xb8')]){_0x3d391f['include']=[{'all':!![]}];}_0x3d391f=_['merge']({},_0x3d391f,_0x6583ab['options']);return db[_0x7913('0xb7')][_0x7913('0x6e')](_0x3d391f)[_0x7913('0x2a')](handleEntityNotFound(_0x271ccf,null))[_0x7913('0x2a')](respondWithResult(_0x271ccf,null))[_0x7913('0x37')](handleError(_0x271ccf,null));};exports[_0x7913('0xb9')]=function(_0x3bd36d,_0x54110f){return db[_0x7913('0xb7')][_0x7913('0xb9')](_0x3bd36d[_0x7913('0x77')],{})['then'](respondWithResult(_0x54110f,0xc9))[_0x7913('0x37')](handleError(_0x54110f,null));};exports[_0x7913('0x29')]=function(_0x4b6525,_0x500079){if(_0x4b6525[_0x7913('0x77')]['id']){delete _0x4b6525[_0x7913('0x77')]['id'];}return db[_0x7913('0xb7')][_0x7913('0x6e')]({'where':{'id':_0x4b6525[_0x7913('0xb6')]['id']}})[_0x7913('0x2a')](handleEntityNotFound(_0x500079,null))[_0x7913('0x2a')](saveUpdates(_0x4b6525['body'],null))[_0x7913('0x2a')](respondWithResult(_0x500079,null))[_0x7913('0x37')](handleError(_0x500079,null));};exports['destroy']=function(_0x17fac5,_0xff6def){return db['SmsInteraction']['find']({'where':{'id':_0x17fac5[_0x7913('0xb6')]['id']}})[_0x7913('0x2a')](handleEntityNotFound(_0xff6def,null))[_0x7913('0x2a')](removeEntity(_0xff6def,null))[_0x7913('0x37')](handleError(_0xff6def,null));};exports[_0x7913('0xba')]=function(_0x475824,_0xcd0217){return db['SmsInteraction'][_0x7913('0xba')]()['then'](respondWithResult(_0xcd0217,null))[_0x7913('0x37')](handleError(_0xcd0217,null));};exports[_0x7913('0xbb')]=function(_0x50f99,_0x210d59,_0xcbef6c){return db[_0x7913('0xbc')]['find']({'where':{'id':_0x50f99[_0x7913('0xb6')]['id']}})['then'](handleEntityNotFound(_0x210d59,null))[_0x7913('0x2a')](function(_0x36feb7){if(_0x36feb7){return _0x36feb7['addMessage'](_0x50f99[_0x7913('0x77')][_0x7913('0xbd')],_[_0x7913('0xbe')](_0x50f99[_0x7913('0x77')],[_0x7913('0xbd'),'id'])||{});}})[_0x7913('0x2a')](respondWithResult(_0x210d59,null))[_0x7913('0x37')](handleError(_0x210d59,null));};exports[_0x7913('0xbf')]=function(_0x1a177d,_0x58ab74,_0x4e3daf){var _0x35c94d={'raw':![],'where':{}};var _0x465e13={};var _0x555992={'count':0x0,'rows':[]};return db[_0x7913('0xb7')][_0x7913('0xc0')]({'where':{'id':_0x1a177d['params']['id']}})['then'](handleEntityNotFound(_0x58ab74,null))['then'](function(_0x5d3cb3){if(_0x5d3cb3){_0x465e13['model']=_['keys'](db[_0x7913('0xbc')][_0x7913('0x3e')]);_0x465e13[_0x7913('0x42')]=_[_0x7913('0x43')](_0x1a177d[_0x7913('0x42')]);_0x465e13[_0x7913('0x44')]=_['intersection'](_0x465e13[_0x7913('0x41')],_0x465e13['query']);_0x35c94d['attributes']=_[_0x7913('0x45')](_0x465e13[_0x7913('0x41')],qs['fields'](_0x1a177d[_0x7913('0x42')][_0x7913('0x46')]));_0x35c94d[_0x7913('0x47')]=_0x35c94d[_0x7913('0x47')]['length']?_0x35c94d['attributes']:_0x465e13[_0x7913('0x41')];if(!_0x1a177d[_0x7913('0x42')][_0x7913('0x49')]('nolimit')){_0x35c94d[_0x7913('0x23')]=qs[_0x7913('0x23')](_0x1a177d['query']['limit']);_0x35c94d[_0x7913('0x25')]=qs[_0x7913('0x25')](_0x1a177d[_0x7913('0x42')][_0x7913('0x25')]);}_0x35c94d[_0x7913('0x4b')]=qs[_0x7913('0x4c')](_0x1a177d[_0x7913('0x42')][_0x7913('0x4c')]);_0x35c94d[_0x7913('0x4d')]=qs[_0x7913('0x44')](_[_0x7913('0x4e')](_0x1a177d[_0x7913('0x42')],_0x465e13[_0x7913('0x44')]));_0x35c94d['where'][_0x7913('0xc1')]=_0x5d3cb3['id'];if(_0x1a177d[_0x7913('0x42')]['filter']){_0x35c94d[_0x7913('0x4d')]=_[_0x7913('0xc2')](_0x35c94d['where'],{'$or':_['map'](_0x35c94d[_0x7913('0x47')],function(_0x408b1f){var _0xb2df57={};_0xb2df57[_0x408b1f]={'$like':'%'+_0x1a177d[_0x7913('0x42')][_0x7913('0x87')]+'%'};return _0xb2df57;})});}if(_0x1a177d[_0x7913('0x42')][_0x7913('0x7e')]){var _0x585697=_0x1a177d[_0x7913('0x42')]['$gte']['split'](',');var _0x482472={};_0x482472[_0x585697[0x0]]={'$gte':moment(_0x585697[0x1])[_0x7913('0xc3')](_0x7913('0xc4'))};_0x35c94d[_0x7913('0x4d')]=_[_0x7913('0xc2')](_0x35c94d[_0x7913('0x4d')],_0x482472);}_0x35c94d=_[_0x7913('0xc2')]({},_0x35c94d,_0x1a177d[_0x7913('0xc5')]);return db[_0x7913('0xbc')][_0x7913('0x24')]({'where':_0x35c94d[_0x7913('0x4d')]})[_0x7913('0x2a')](function(_0x48a2d0){_0x555992['count']=_0x48a2d0;if(_0x1a177d[_0x7913('0x42')][_0x7913('0xb8')]){_0x35c94d[_0x7913('0xc6')]=[{'all':!![]}];}return db['SmsMessage'][_0x7913('0xc7')](_0x35c94d);})['then'](function(_0x257220){_0x555992['rows']=_0x257220;return _0x555992;});}})[_0x7913('0x2a')](respondWithFilteredResult(_0x58ab74,_0x35c94d))[_0x7913('0x37')](handleError(_0x58ab74,null));};exports['addTags']=function(_0x3c9722,_0x25c76d,_0x1517b3){return db[_0x7913('0xb7')][_0x7913('0x6e')]({'where':{'id':_0x3c9722['params']['id']}})['then'](handleEntityNotFound(_0x25c76d,null))['then'](function(_0x389a77){if(_0x389a77){return _0x389a77['setTags'](_0x3c9722[_0x7913('0x77')][_0x7913('0xbd')],_['omit'](_0x3c9722[_0x7913('0x77')],[_0x7913('0xbd'),'id'])||{})[_0x7913('0xc8')](function(){return db['Tag']['findAll']({'attributes':['id',_0x7913('0x2e'),_0x7913('0x51')],'where':{'id':_0x3c9722['body']['ids']}});})['then'](function(_0x474c6f){socket[_0x7913('0xc9')](_0x7913('0xca'),{'id':Number(_0x3c9722[_0x7913('0xb6')]['id']),'tags':_0x474c6f||[]});return{'id':Number(_0x3c9722[_0x7913('0xb6')]['id']),'tags':_0x474c6f||[]};});}})[_0x7913('0x2a')](respondWithResult(_0x25c76d,null))[_0x7913('0x37')](handleError(_0x25c76d,null));};exports[_0x7913('0xcb')]=function(_0x4b54ba,_0x34b3f9,_0x14c700){return db[_0x7913('0xb7')][_0x7913('0x6e')]({'where':{'id':_0x4b54ba['params']['id']}})[_0x7913('0x2a')](handleEntityNotFound(_0x34b3f9,null))['then'](function(_0x195fed){if(_0x195fed){return _0x195fed[_0x7913('0xcb')](_0x4b54ba[_0x7913('0x42')][_0x7913('0xbd')]);}})['then'](respondWithStatusCode(_0x34b3f9,null))[_0x7913('0x37')](handleError(_0x34b3f9,null));};exports[_0x7913('0xcc')]=function(_0x2770ef,_0x5afcdb){var _0x49ae0b=moment()[_0x7913('0xcd')]()[_0x7913('0xa0')]();var _0x2d9622=path['join'](config[_0x7913('0xce')],_0x7913('0xcf'),_0x7913('0xd0'),_0x7913('0xd1'));var _0x4e3c25=path[_0x7913('0xd2')](config[_0x7913('0xce')],_0x7913('0xcf'),'files',_0x7913('0xd3'));var _0x3b40c5=path[_0x7913('0xd2')](_0x2d9622,_0x49ae0b);var _0xe1b0d=util['format'](_0x7913('0xd4'),_0x2770ef[_0x7913('0xb6')]['id'],_0x49ae0b);var _0xcf7c35=path[_0x7913('0xd2')](_0x2d9622,_0xe1b0d);var _0x57e8fc=[];_0x57e8fc[_0x7913('0x36')]({'model':db['User'],'as':_0x7913('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x57e8fc[_0x7913('0x36')]({'model':db[_0x7913('0xd5')],'as':_0x7913('0xd6'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x2c8bf5=[{'model':db[_0x7913('0xbc')],'as':_0x7913('0xd7'),'attributes':['id',_0x7913('0x77'),_0x7913('0x7c'),_0x7913('0xd8'),_0x7913('0xd9'),_0x7913('0x83')],'include':_0x57e8fc}];_0x2c8bf5[_0x7913('0x36')]({'model':db[_0x7913('0xda')],'as':_0x7913('0xdb'),'attributes':['id',_0x7913('0x2e')]});_0x2c8bf5[_0x7913('0x36')]({'model':db[_0x7913('0x75')],'as':'Owner','attributes':['id',_0x7913('0x31')]});return db[_0x7913('0xb7')][_0x7913('0x6e')]({'where':{'id':_0x2770ef[_0x7913('0xb6')]['id']},'include':_0x2c8bf5})['then'](handleEntityNotFound(_0x5afcdb,null))['then'](function(_0x46f70d){if(_0x46f70d){var _0x258cab=_0x46f70d[_0x7913('0xdc')]({'plain':!![]});fs[_0x7913('0xdd')](_0x3b40c5);var _0x18e0ef={'channel':_0x7913('0xde'),'account':_0x258cab['Account'][_0x7913('0x2e')],'agent':_0x258cab['Owner']?_0x258cab[_0x7913('0xdf')]['fullname']:_0x7913('0xe0'),'createdAt':moment(_0x258cab[_0x7913('0x7c')])[_0x7913('0xc3')](_0x7913('0xc4'))[_0x7913('0xa0')](),'closedAt':_0x258cab[_0x7913('0x3c')]?moment(_0x258cab[_0x7913('0xe1')])[_0x7913('0xc3')](_0x7913('0xc4'))[_0x7913('0xa0')]():'','disposition':_0x258cab[_0x7913('0xe2')],'messages':_(_0x258cab[_0x7913('0xd7')])[_0x7913('0x87')]({'secret':![]})[_0x7913('0x30')](function(_0x26c88f){return{'date':moment(_0x26c88f[_0x7913('0x7c')])[_0x7913('0xc3')](_0x7913('0xc4'))[_0x7913('0xa0')](),'sender':_0x26c88f[_0x7913('0xd8')]===_0x7913('0xe3')?_0x26c88f[_0x7913('0x75')]?_0x26c88f[_0x7913('0x75')][_0x7913('0x31')]:_0x7913('0xe4'):_0x26c88f[_0x7913('0xd6')][_0x7913('0xe5')]+(_0x26c88f['Contact'][_0x7913('0xe6')]?'\x20'+_0x26c88f[_0x7913('0xd6')][_0x7913('0xe6')]:''),'body':_0x26c88f[_0x7913('0x77')],'direction':_0x26c88f[_0x7913('0xd8')]===_0x7913('0xe3')?'A':'C','secret':_0x26c88f[_0x7913('0xd9')],'read':_0x26c88f['read']};})[_0x7913('0x68')]()};return ejs[_0x7913('0xe7')](path[_0x7913('0xd2')](config[_0x7913('0xce')],_0x7913('0xcf'),'views',_0x7913('0xe8')),{'interaction':_0x18e0ef})['then'](function(_0x13cb89){var _0x3f0b87=path['join'](_0x3b40c5,_0x7913('0xe9')+_0x258cab['id']+'-'+_0x49ae0b+'.pdf');var _0x22dcbf={'path':_0x3f0b87,'channel':'Sms','interactionId':_0x258cab['id']};return pdf[_0x7913('0xea')](_0x13cb89,_0x22dcbf);})[_0x7913('0x2a')](function(){return new BPromise(function(_0x352ebb,_0x3c5c71){zipdir(_0x3b40c5,{'saveTo':_0xcf7c35},function(_0x34652f,_0x151d55){if(_0x34652f)return _0x3c5c71(_0x34652f);return _0x352ebb(_0x151d55);});})[_0x7913('0x2a')](function(){return new BPromise(function(_0x321c35,_0x4005ae){rimraf(_0x3b40c5,function(_0x251423){if(_0x251423)_0x4005ae(_0x251423);return _0x321c35();});});})['then'](function(){return _0x5afcdb[_0x7913('0xcc')](_0xcf7c35,_0xe1b0d,function(_0x38f80b){if(_0x38f80b){console[_0x7913('0xeb')](_0x7913('0xec'),_0x38f80b);}else{fs[_0x7913('0xed')](_0xcf7c35);}});});});}else{return _0x5afcdb[_0x7913('0x1e')](0xc8);}})['catch'](handleError(_0x5afcdb,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f929cc1..49a91fb 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 _0x14a0=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','setDataValue','Users','findAll','length','emit','catch'];(function(_0x185018,_0x244994){var _0x2ae95b=function(_0x3e60fd){while(--_0x3e60fd){_0x185018['push'](_0x185018['shift']());}};_0x2ae95b(++_0x244994);}(_0x14a0,0x8e));var _0x014a=function(_0x2fe78c,_0x458be9){_0x2fe78c=_0x2fe78c-0x0;var _0x3f18bc=_0x14a0[_0x2fe78c];return _0x3f18bc;};'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 +var _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x3d55a4,_0x57d61b){var _0x38c5c4=function(_0x1e0daa){while(--_0x1e0daa){_0x3d55a4['push'](_0x3d55a4['shift']());}};_0x38c5c4(++_0x57d61b);}(_0xef0f,0x168));var _0xfef0=function(_0x1815f7,_0x23a13c){_0x1815f7=_0x1815f7-0x0;var _0xb8e434=_0xef0f[_0x1815f7];return _0xb8e434;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 1782b5a..a699e0a 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 _0x8052=['changed','closed','format','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions'];(function(_0x527ea2,_0x5dd6b0){var _0x40f3c4=function(_0x1ade90){while(--_0x1ade90){_0x527ea2['push'](_0x527ea2['shift']());}};_0x40f3c4(++_0x5dd6b0);}(_0x8052,0x113));var _0x2805=function(_0xd27ded,_0x1164e2){_0xd27ded=_0xd27ded-0x0;var _0x5ef850=_0x8052[_0xd27ded];return _0x5ef850;};'use strict';var _=require(_0x2805('0x0'));var util=require(_0x2805('0x1'));var logger=require(_0x2805('0x2'))(_0x2805('0x3'));var moment=require(_0x2805('0x4'));var BPromise=require('bluebird');var rp=require(_0x2805('0x5'));var fs=require('fs');var path=require(_0x2805('0x6'));var rimraf=require(_0x2805('0x7'));var config=require(_0x2805('0x8'));var attributes=require('./smsInteraction.attributes');module[_0x2805('0x9')]=function(_0x297f5f,_0x3cb472){return _0x297f5f[_0x2805('0xa')](_0x2805('0xb'),attributes,{'tableName':_0x2805('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13ced0,_0x26a6e0,_0x151dfa){if(_0x13ced0[_0x2805('0xd')](_0x2805('0xe'))){_0x13ced0['closedAt']=moment()[_0x2805('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x151dfa(null,_0x13ced0);}}});}; \ No newline at end of file +var _0x5bb3=['sms_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x5bb3,0x79));var _0x35bb=function(_0xad7d4c,_0x23ad4a){_0xad7d4c=_0xad7d4c-0x0;var _0xcf0feb=_0x5bb3[_0xad7d4c];return _0xcf0feb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x35bb('0x0'))(_0x35bb('0x1'));var moment=require('moment');var BPromise=require(_0x35bb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35bb('0x3'));var rimraf=require(_0x35bb('0x4'));var config=require('../../config/environment');var attributes=require(_0x35bb('0x5'));module[_0x35bb('0x6')]=function(_0x377c0f,_0x3414a5){return _0x377c0f[_0x35bb('0x7')](_0x35bb('0x8'),attributes,{'tableName':_0x35bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3cc421,_0x8ec6ed,_0x2c9de8){if(_0x3cc421[_0x35bb('0xa')]('closed')){_0x3cc421['closedAt']=moment()[_0x35bb('0xb')](_0x35bb('0xc'));}_0x2c9de8(null,_0x3cc421);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 81fd82a..2a4ab94 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 _0x2407=['defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x55ccdf,_0x495a9b){var _0x25fd51=function(_0xd9abd3){while(--_0xd9abd3){_0x55ccdf['push'](_0x55ccdf['shift']());}};_0x25fd51(++_0x495a9b);}(_0x2407,0x16e));var _0x7240=function(_0x225c0c,_0x5071b1){_0x225c0c=_0x225c0c-0x0;var _0x7d45e6=_0x2407[_0x225c0c];return _0x7d45e6;};'use strict';var _=require(_0x7240('0x0'));var util=require(_0x7240('0x1'));var moment=require(_0x7240('0x2'));var BPromise=require(_0x7240('0x3'));var rs=require(_0x7240('0x4'));var fs=require('fs');var Redis=require(_0x7240('0x5'));var db=require(_0x7240('0x6'))['db'];var utils=require(_0x7240('0x7'));var logger=require(_0x7240('0x8'))(_0x7240('0x9'));var config=require(_0x7240('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7240('0xb')]['http']({'port':0x232a});config['redis']=_[_0x7240('0xc')](config['redis'],{'host':_0x7240('0xd'),'port':0x18eb});var socket=require(_0x7240('0xe'))(new Redis(config['redis']));require(_0x7240('0xf'))[_0x7240('0x10')](socket);function respondWithRpcPromise(_0x370519,_0x2201b,_0x3fa8ea){return new BPromise(function(_0x5c0ae5,_0x4a867b){return client['request'](_0x370519,_0x3fa8ea)[_0x7240('0x11')](function(_0x5e2696){logger['info'](_0x7240('0x12'),_0x2201b,_0x7240('0x13'));logger[_0x7240('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2201b,'request\x20sent',JSON[_0x7240('0x15')](_0x5e2696));if(_0x5e2696[_0x7240('0x16')]){if(_0x5e2696[_0x7240('0x16')][_0x7240('0x17')]===0x1f4){logger[_0x7240('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x2201b,_0x5e2696[_0x7240('0x16')]['message']);return _0x4a867b(_0x5e2696['error'][_0x7240('0x18')]);}logger['error'](_0x7240('0x12'),_0x2201b,_0x5e2696[_0x7240('0x16')][_0x7240('0x18')]);return _0x5c0ae5(_0x5e2696[_0x7240('0x16')][_0x7240('0x18')]);}else{logger[_0x7240('0x19')](_0x7240('0x12'),_0x2201b,'request\x20sent');_0x5c0ae5(_0x5e2696[_0x7240('0x1a')]['message']);}})[_0x7240('0x1b')](function(_0x510466){logger['error'](_0x7240('0x12'),_0x2201b,_0x510466);_0x4a867b(_0x510466);});});}exports['UpdateSmsInteraction']=function(_0x3547f7){var _0x33aba5=this;return new Promise(function(_0x129e0e,_0x3ebd7c){return db[_0x7240('0x1c')][_0x7240('0x1d')](_0x3547f7[_0x7240('0x1e')],{'raw':_0x3547f7['options']?_0x3547f7[_0x7240('0x1f')][_0x7240('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3547f7['options']?_0x3547f7['options'][_0x7240('0x21')]||null:null,'attributes':_0x3547f7[_0x7240('0x1f')]?_0x3547f7[_0x7240('0x1f')][_0x7240('0x22')]||null:null,'limit':_0x3547f7[_0x7240('0x1f')]?_0x3547f7['options'][_0x7240('0x23')]||null:null})[_0x7240('0x11')](function(_0x346442){logger[_0x7240('0x19')](_0x7240('0x24'),_0x3547f7);logger[_0x7240('0x14')](_0x7240('0x24'),_0x3547f7,JSON[_0x7240('0x15')](_0x346442));_0x129e0e(_0x346442);})[_0x7240('0x1b')](function(_0x9ad41a){logger[_0x7240('0x16')](_0x7240('0x24'),_0x9ad41a[_0x7240('0x18')],_0x3547f7);_0x3ebd7c(_0x33aba5[_0x7240('0x16')](0x1f4,_0x9ad41a[_0x7240('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1ac9e4){return new Promise(function(_0x11e7cb,_0x56dec8){return db[_0x7240('0x1c')][_0x7240('0x25')]({'where':_0x1ac9e4['options']?_0x1ac9e4[_0x7240('0x1f')][_0x7240('0x21')]||null:null})['then'](function(_0x28533f){if(_0x28533f){return _0x28533f[_0x7240('0x26')](_0x1ac9e4['body'][_0x7240('0x27')],_['omit'](_0x1ac9e4[_0x7240('0x1e')],['ids','id'])||{});}})[_0x7240('0x28')](function(_0x543f9a){logger[_0x7240('0x19')]('AddTags',_0x1ac9e4);logger['debug'](_0x7240('0x29'),_0x1ac9e4,JSON[_0x7240('0x15')](_0x543f9a));_0x11e7cb(_0x543f9a);})[_0x7240('0x1b')](function(_0x97229c){logger['error'](_0x7240('0x29'),_0x97229c[_0x7240('0x18')],_0x1ac9e4);_0x56dec8(_this[_0x7240('0x16')](0x1f4,_0x97229c[_0x7240('0x18')]));});});}; \ No newline at end of file +var _0x11c6=['catch','AddTagsToSmsInteraction','addTags','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateSmsInteraction','SmsInteraction','body','raw','options','where','attributes','limit','stringify'];(function(_0xb4ad00,_0x50ed45){var _0x9e4efa=function(_0x109a12){while(--_0x109a12){_0xb4ad00['push'](_0xb4ad00['shift']());}};_0x9e4efa(++_0x50ed45);}(_0x11c6,0x1a9));var _0x611c=function(_0x325539,_0x36ad8f){_0x325539=_0x325539-0x0;var _0x47401d=_0x11c6[_0x325539];return _0x47401d;};'use strict';var _=require(_0x611c('0x0'));var util=require(_0x611c('0x1'));var moment=require(_0x611c('0x2'));var BPromise=require('bluebird');var rs=require(_0x611c('0x3'));var fs=require('fs');var Redis=require(_0x611c('0x4'));var db=require(_0x611c('0x5'))['db'];var utils=require(_0x611c('0x6'));var logger=require(_0x611c('0x7'))(_0x611c('0x8'));var config=require(_0x611c('0x9'));var jayson=require(_0x611c('0xa'));var client=jayson[_0x611c('0xb')]['http']({'port':0x232a});config[_0x611c('0xc')]=_[_0x611c('0xd')](config[_0x611c('0xc')],{'host':_0x611c('0xe'),'port':0x18eb});var socket=require(_0x611c('0xf'))(new Redis(config[_0x611c('0xc')]));require(_0x611c('0x10'))['register'](socket);function respondWithRpcPromise(_0x1b2231,_0x336d5d,_0x22b2f0){return new BPromise(function(_0x2d64f6,_0x3f80fa){return client[_0x611c('0x11')](_0x1b2231,_0x22b2f0)[_0x611c('0x12')](function(_0x20c002){logger[_0x611c('0x13')](_0x611c('0x14'),_0x336d5d,_0x611c('0x15'));logger[_0x611c('0x16')](_0x611c('0x17'),_0x336d5d,_0x611c('0x15'),JSON['stringify'](_0x20c002));if(_0x20c002[_0x611c('0x18')]){if(_0x20c002['error'][_0x611c('0x19')]===0x1f4){logger[_0x611c('0x18')](_0x611c('0x14'),_0x336d5d,_0x20c002['error'][_0x611c('0x1a')]);return _0x3f80fa(_0x20c002['error'][_0x611c('0x1a')]);}logger[_0x611c('0x18')](_0x611c('0x14'),_0x336d5d,_0x20c002[_0x611c('0x18')][_0x611c('0x1a')]);return _0x2d64f6(_0x20c002[_0x611c('0x18')][_0x611c('0x1a')]);}else{logger[_0x611c('0x13')](_0x611c('0x14'),_0x336d5d,_0x611c('0x15'));_0x2d64f6(_0x20c002[_0x611c('0x1b')][_0x611c('0x1a')]);}})['catch'](function(_0x32ed47){logger[_0x611c('0x18')](_0x611c('0x14'),_0x336d5d,_0x32ed47);_0x3f80fa(_0x32ed47);});});}exports[_0x611c('0x1c')]=function(_0x536a49){var _0x6ee5a3=this;return new Promise(function(_0x3e3206,_0x4da18e){return db[_0x611c('0x1d')]['update'](_0x536a49[_0x611c('0x1e')],{'raw':_0x536a49['options']?_0x536a49['options'][_0x611c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x536a49[_0x611c('0x20')]?_0x536a49[_0x611c('0x20')][_0x611c('0x21')]||null:null,'attributes':_0x536a49[_0x611c('0x20')]?_0x536a49[_0x611c('0x20')][_0x611c('0x22')]||null:null,'limit':_0x536a49[_0x611c('0x20')]?_0x536a49[_0x611c('0x20')][_0x611c('0x23')]||null:null})[_0x611c('0x12')](function(_0x2df2bc){logger[_0x611c('0x13')](_0x611c('0x1c'),_0x536a49);logger[_0x611c('0x16')]('UpdateSmsInteraction',_0x536a49,JSON[_0x611c('0x24')](_0x2df2bc));_0x3e3206(_0x2df2bc);})[_0x611c('0x25')](function(_0x254d10){logger[_0x611c('0x18')]('UpdateSmsInteraction',_0x254d10[_0x611c('0x1a')],_0x536a49);_0x4da18e(_0x6ee5a3[_0x611c('0x18')](0x1f4,_0x254d10[_0x611c('0x1a')]));});});};exports[_0x611c('0x26')]=function(_0x5d095d){return new Promise(function(_0xdfe81,_0x28e6c0){return db[_0x611c('0x1d')]['find']({'where':_0x5d095d[_0x611c('0x20')]?_0x5d095d[_0x611c('0x20')][_0x611c('0x21')]||null:null})[_0x611c('0x12')](function(_0x3634ec){if(_0x3634ec){return _0x3634ec[_0x611c('0x27')](_0x5d095d[_0x611c('0x1e')][_0x611c('0x28')],_['omit'](_0x5d095d[_0x611c('0x1e')],[_0x611c('0x28'),'id'])||{});}})['spread'](function(_0x2b2782){logger['info'](_0x611c('0x29'),_0x5d095d);logger[_0x611c('0x16')](_0x611c('0x29'),_0x5d095d,JSON[_0x611c('0x24')](_0x2b2782));_0xdfe81(_0x2b2782);})[_0x611c('0x25')](function(_0x301912){logger[_0x611c('0x18')]('AddTags',_0x301912[_0x611c('0x1a')],_0x5d095d);_0x28e6c0(_this[_0x611c('0x18')](0x1f4,_0x301912[_0x611c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5d9ad94..bf17ef7 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 _0x400d=['update','emit','removeListener','length','./smsInteraction.events','save'];(function(_0x45b28f,_0x572cd0){var _0xe8b18b=function(_0x4a464f){while(--_0x4a464f){_0x45b28f['push'](_0x45b28f['shift']());}};_0xe8b18b(++_0x572cd0);}(_0x400d,0x14e));var _0xd400=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x400d[_0x5179a5];return _0x15c8ce;};'use strict';var SmsInteractionEvents=require(_0xd400('0x0'));var events=[_0xd400('0x1'),'remove',_0xd400('0x2')];function createListener(_0x3ef701,_0x22ea64){return function(_0x2adf6a){_0x22ea64[_0xd400('0x3')](_0x3ef701,_0x2adf6a);};}function removeListener(_0x41683c,_0x235c7f){return function(){SmsInteractionEvents[_0xd400('0x4')](_0x41683c,_0x235c7f);};}exports['register']=function(_0x1573a2){for(var _0x5ea00d=0x0,_0x26626d=events[_0xd400('0x5')];_0x5ea00d<_0x26626d;_0x5ea00d++){var _0x5bf9ef=events[_0x5ea00d];var _0x76b758=createListener('smsInteraction:'+_0x5bf9ef,_0x1573a2);SmsInteractionEvents['on'](_0x5bf9ef,_0x76b758);}}; \ No newline at end of file +var _0xd4f1=['register','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0xeb4614,_0x9155e5){var _0x33641b=function(_0x5986f0){while(--_0x5986f0){_0xeb4614['push'](_0xeb4614['shift']());}};_0x33641b(++_0x9155e5);}(_0xd4f1,0xd2));var _0x1d4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4f1[_0x20a584];return _0x4b41a8;};'use strict';var SmsInteractionEvents=require(_0x1d4f('0x0'));var events=[_0x1d4f('0x1'),_0x1d4f('0x2'),_0x1d4f('0x3')];function createListener(_0x1e6d85,_0x4fae3f){return function(_0x5756c0){_0x4fae3f[_0x1d4f('0x4')](_0x1e6d85,_0x5756c0);};}function removeListener(_0x54000a,_0x50f680){return function(){SmsInteractionEvents[_0x1d4f('0x5')](_0x54000a,_0x50f680);};}exports[_0x1d4f('0x6')]=function(_0x1f1e20){for(var _0x4a45dd=0x0,_0x1df6d5=events[_0x1d4f('0x7')];_0x4a45dd<_0x1df6d5;_0x4a45dd++){var _0x35aa71=events[_0x4a45dd];var _0x5ac68d=createListener(_0x1d4f('0x8')+_0x35aa71,_0x1f1e20);SmsInteractionEvents['on'](_0x35aa71,_0x5ac68d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 952f0da..8bae27b 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 _0x96f0=['delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','post','smsmessage:create','/:id/status','put','update','/:id/accept','accept','reject'];(function(_0x4a94d0,_0x374e5d){var _0x50128a=function(_0x595a2c){while(--_0x595a2c){_0x4a94d0['push'](_0x4a94d0['shift']());}};_0x50128a(++_0x374e5d);}(_0x96f0,0x13b));var _0x096f=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x96f0[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x096f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x096f('0x1'));var router=express[_0x096f('0x2')]();var fs_extra=require(_0x096f('0x3'));var auth=require(_0x096f('0x4'));var interaction=require(_0x096f('0x5'));var config=require(_0x096f('0x6'));var controller=require(_0x096f('0x7'));router[_0x096f('0x8')]('/',auth[_0x096f('0x9')](),controller[_0x096f('0xa')]);router[_0x096f('0x8')](_0x096f('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x096f('0xc'),auth[_0x096f('0x9')](),controller['show']);router[_0x096f('0xd')]('/',auth[_0x096f('0x9')](),interaction['tracked']('sms',_0x096f('0xe')),controller['create']);router[_0x096f('0xd')](_0x096f('0xf'),controller['status']);router[_0x096f('0x10')](_0x096f('0xc'),auth[_0x096f('0x9')](),controller[_0x096f('0x11')]);router[_0x096f('0x10')](_0x096f('0x12'),auth['isAuthenticated'](),controller[_0x096f('0x13')]);router['put']('/:id/reject',auth[_0x096f('0x9')](),controller[_0x096f('0x14')]);router[_0x096f('0x15')](_0x096f('0xc'),auth['isAuthenticated'](),controller[_0x096f('0x16')]);module[_0x096f('0x17')]=router; \ No newline at end of file +var _0xbc6b=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','tracked','sms','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x39c139,_0x36e444){var _0x3ee0bc=function(_0x3ba8bb){while(--_0x3ba8bb){_0x39c139['push'](_0x39c139['shift']());}};_0x3ee0bc(++_0x36e444);}(_0xbc6b,0xd4));var _0xbbc6=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0xbc6b[_0x5f46e7];return _0x567e95;};'use strict';var multer=require(_0xbbc6('0x0'));var util=require(_0xbbc6('0x1'));var path=require(_0xbbc6('0x2'));var timeout=require(_0xbbc6('0x3'));var express=require(_0xbbc6('0x4'));var router=express[_0xbbc6('0x5')]();var fs_extra=require(_0xbbc6('0x6'));var auth=require(_0xbbc6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0xbbc6('0x8')]('/',auth[_0xbbc6('0x9')](),controller[_0xbbc6('0xa')]);router[_0xbbc6('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xbbc6('0x8')](_0xbbc6('0xb'),auth[_0xbbc6('0x9')](),controller[_0xbbc6('0xc')]);router[_0xbbc6('0xd')]('/',auth[_0xbbc6('0x9')](),interaction[_0xbbc6('0xe')](_0xbbc6('0xf'),'smsmessage:create'),controller[_0xbbc6('0x10')]);router[_0xbbc6('0xd')]('/:id/status',controller[_0xbbc6('0x11')]);router[_0xbbc6('0x12')](_0xbbc6('0xb'),auth[_0xbbc6('0x9')](),controller[_0xbbc6('0x13')]);router['put'](_0xbbc6('0x14'),auth[_0xbbc6('0x9')](),controller[_0xbbc6('0x15')]);router['put'](_0xbbc6('0x16'),auth[_0xbbc6('0x9')](),controller[_0xbbc6('0x17')]);router[_0xbbc6('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xbbc6('0x19')]);module[_0xbbc6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2f7e39e..26d8eb8 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 _0xec47=['ENUM','out','STRING','TEXT','sequelize','medium','BOOLEAN'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xec47,0x170));var _0x7ec4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xec47[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x7ec4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x7ec4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7ec4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7ec4('0x3')]('in',_0x7ec4('0x4')),'defaultValue':_0x7ec4('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7ec4('0x5')](0xbe)},'phone':{'type':Sequelize[_0x7ec4('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7ec4('0x6')]}}; \ No newline at end of file +var _0xe76a=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x3e49a7,_0x42b22c){var _0x5eb299=function(_0x2d6a22){while(--_0x2d6a22){_0x3e49a7['push'](_0x3e49a7['shift']());}};_0x5eb299(++_0x42b22c);}(_0xe76a,0xd4));var _0xae76=function(_0x197fe4,_0x1626ca){_0x197fe4=_0x197fe4-0x0;var _0xc9a8e2=_0xe76a[_0x197fe4];return _0xc9a8e2;};'use strict';var Sequelize=require(_0xae76('0x0'));module[_0xae76('0x1')]={'body':{'type':Sequelize[_0xae76('0x2')](_0xae76('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xae76('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xae76('0x5')]('in',_0xae76('0x6')),'defaultValue':_0xae76('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xae76('0x7')](0xbe)},'phone':{'type':Sequelize[_0xae76('0x7')]},'readAt':{'type':Sequelize[_0xae76('0x8')]},'secret':{'type':Sequelize[_0xae76('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xae76('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 5cd5483..5c10c76 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 _0x29b6=['fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','rawAttributes','keys','includeAll','create','body','find','params','destroy','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','User','agent','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','interface','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','delivered','Status','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./smsMessage.socket','register','client','http','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','stack','name','index','map','SmsMessage','fieldName','key','model','query','filters','intersection'];(function(_0x4c7ca9,_0x378fc5){var _0x2ba07e=function(_0x48f357){while(--_0x48f357){_0x4c7ca9['push'](_0x4c7ca9['shift']());}};_0x2ba07e(++_0x378fc5);}(_0x29b6,0x17e));var _0x629b=function(_0x4aa1f6,_0x16495f){_0x4aa1f6=_0x4aa1f6-0x0;var _0x4abc07=_0x29b6[_0x4aa1f6];return _0x4abc07;};'use strict';var emlformat=require(_0x629b('0x0'));var rimraf=require(_0x629b('0x1'));var zipdir=require(_0x629b('0x2'));var jsonpatch=require(_0x629b('0x3'));var rp=require(_0x629b('0x4'));var moment=require(_0x629b('0x5'));var BPromise=require(_0x629b('0x6'));var Mustache=require(_0x629b('0x7'));var util=require(_0x629b('0x8'));var path=require(_0x629b('0x9'));var sox=require('sox');var csv=require(_0x629b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x629b('0xb'));var _=require(_0x629b('0xc'));var squel=require(_0x629b('0xd'));var crypto=require(_0x629b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x629b('0xf'));var toCsv=require(_0x629b('0xa'));var querystring=require('querystring');var Papa=require(_0x629b('0x10'));var Redis=require(_0x629b('0x11'));var authService=require(_0x629b('0x12'));var qs=require(_0x629b('0x13'));var as=require(_0x629b('0x14'));var hardwareService=require(_0x629b('0x15'));var logger=require(_0x629b('0x16'))(_0x629b('0x17'));var utils=require(_0x629b('0x18'));var config=require(_0x629b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x629b('0x1a')]=_[_0x629b('0x1b')](config[_0x629b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x629b('0x1c'))(new Redis(config[_0x629b('0x1a')]));require(_0x629b('0x1d'))[_0x629b('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x629b('0x1f')][_0x629b('0x20')]({'port':0x232c});var client9002=jayson[_0x629b('0x1f')][_0x629b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2c1f4f,_0x4ba9ae,_0x2a4d96,_0x4b0cfb){return new BPromise(function(_0x151b93,_0x2b0a74){var _0x204bb4=_0x4b0cfb||client;return _0x204bb4['request'](_0x2c1f4f,_0x2a4d96)[_0x629b('0x21')](function(_0x58f5a8){logger[_0x629b('0x22')]('SmsMessage,\x20%s,\x20%s',_0x4ba9ae,_0x629b('0x23'));logger['debug'](_0x629b('0x24'),_0x4ba9ae,_0x629b('0x23'),JSON[_0x629b('0x25')](_0x58f5a8));if(_0x58f5a8['error']){if(_0x58f5a8[_0x629b('0x26')]['code']===0x1f4){logger[_0x629b('0x26')](_0x629b('0x27'),_0x4ba9ae,_0x58f5a8[_0x629b('0x26')][_0x629b('0x28')]);return _0x2b0a74(_0x58f5a8['error'][_0x629b('0x28')]);}logger['error'](_0x629b('0x27'),_0x4ba9ae,_0x58f5a8[_0x629b('0x26')][_0x629b('0x28')]);return _0x151b93(_0x58f5a8['error'][_0x629b('0x28')]);}else{logger[_0x629b('0x22')](_0x629b('0x27'),_0x4ba9ae,_0x629b('0x23'));_0x151b93(_0x58f5a8[_0x629b('0x29')][_0x629b('0x28')]);}})[_0x629b('0x2a')](function(_0x547b3c){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4ba9ae,_0x547b3c);_0x2b0a74(_0x547b3c);});});}function respondWithStatusCode(_0x58b320,_0x3e1e25){_0x3e1e25=_0x3e1e25||0xcc;return function(_0x31c0b3){if(_0x31c0b3){return _0x58b320[_0x629b('0x2b')](_0x3e1e25);}return _0x58b320[_0x629b('0x2c')](_0x3e1e25)[_0x629b('0x2d')]();};}function respondWithResult(_0x40ae3c,_0x4c1f21){_0x4c1f21=_0x4c1f21||0xc8;return function(_0x43bc04){if(_0x43bc04){return _0x40ae3c[_0x629b('0x2c')](_0x4c1f21)[_0x629b('0x2e')](_0x43bc04);}};}function respondWithFilteredResult(_0x12d5fc,_0x12cc51){return function(_0x16c365){if(_0x16c365){var _0x3ef549=typeof _0x12cc51[_0x629b('0x2f')]==='undefined'&&typeof _0x12cc51['limit']===_0x629b('0x30');var _0x2fb97d=_0x16c365['count'];var _0x1628cb=_0x3ef549?0x0:_0x12cc51['offset'];var _0x86ee7c=_0x3ef549?_0x16c365[_0x629b('0x31')]:_0x12cc51['offset']+_0x12cc51[_0x629b('0x32')];var _0x16d968;if(_0x86ee7c>=_0x2fb97d){_0x86ee7c=_0x2fb97d;_0x16d968=0xc8;}else{_0x16d968=0xce;}_0x12d5fc[_0x629b('0x2c')](_0x16d968);return _0x12d5fc[_0x629b('0x33')](_0x629b('0x34'),_0x1628cb+'-'+_0x86ee7c+'/'+_0x2fb97d)[_0x629b('0x2e')](_0x16c365);}return null;};}function patchUpdates(_0x5550bd){return function(_0x269c0a){try{jsonpatch[_0x629b('0x35')](_0x269c0a,_0x5550bd,!![]);}catch(_0x2b21a3){return BPromise[_0x629b('0x36')](_0x2b21a3);}return _0x269c0a[_0x629b('0x37')]();};}function saveUpdates(_0x3c75cb,_0x198729){return function(_0x1f4cf6){if(_0x1f4cf6){return _0x1f4cf6[_0x629b('0x38')](_0x3c75cb)[_0x629b('0x21')](function(_0x229c50){return _0x229c50;});}return null;};}function removeEntity(_0x1dcc06,_0x2f8b21){return function(_0x4f2e44){if(_0x4f2e44){return _0x4f2e44['destroy']()[_0x629b('0x21')](function(){_0x1dcc06[_0x629b('0x2c')](0xcc)[_0x629b('0x2d')]();});}};}function handleEntityNotFound(_0x25ee68,_0x564590){return function(_0x311e82){if(!_0x311e82){_0x25ee68[_0x629b('0x2b')](0x194);}return _0x311e82;};}function handleError(_0x15ce4c,_0x46f403){_0x46f403=_0x46f403||0x1f4;return function(_0x4c1a34){logger[_0x629b('0x26')](_0x4c1a34[_0x629b('0x39')]);if(_0x4c1a34[_0x629b('0x3a')]){delete _0x4c1a34[_0x629b('0x3a')];}_0x15ce4c[_0x629b('0x2c')](_0x46f403)['send'](_0x4c1a34);};}exports[_0x629b('0x3b')]=function(_0x4024c7,_0x20c488){var _0x37daad={},_0x3b8100={},_0x36f47e={'count':0x0,'rows':[]};var _0x384783=_[_0x629b('0x3c')](db[_0x629b('0x3d')]['rawAttributes'],function(_0x3b2506){return{'name':_0x3b2506[_0x629b('0x3e')],'type':_0x3b2506['type'][_0x629b('0x3f')]};});_0x3b8100[_0x629b('0x40')]=_[_0x629b('0x3c')](_0x384783,_0x629b('0x3a'));_0x3b8100['query']=_['keys'](_0x4024c7[_0x629b('0x41')]);_0x3b8100[_0x629b('0x42')]=_[_0x629b('0x43')](_0x3b8100[_0x629b('0x40')],_0x3b8100[_0x629b('0x41')]);_0x37daad['attributes']=_[_0x629b('0x43')](_0x3b8100[_0x629b('0x40')],qs[_0x629b('0x44')](_0x4024c7[_0x629b('0x41')][_0x629b('0x44')]));_0x37daad['attributes']=_0x37daad['attributes'][_0x629b('0x45')]?_0x37daad[_0x629b('0x46')]:_0x3b8100[_0x629b('0x40')];if(!_0x4024c7[_0x629b('0x41')][_0x629b('0x47')](_0x629b('0x48'))){_0x37daad[_0x629b('0x32')]=qs[_0x629b('0x32')](_0x4024c7['query'][_0x629b('0x32')]);_0x37daad[_0x629b('0x2f')]=qs[_0x629b('0x2f')](_0x4024c7[_0x629b('0x41')][_0x629b('0x2f')]);}_0x37daad['order']=qs['sort'](_0x4024c7[_0x629b('0x41')][_0x629b('0x49')]);_0x37daad[_0x629b('0x4a')]=qs[_0x629b('0x42')](_['pick'](_0x4024c7[_0x629b('0x41')],_0x3b8100['filters']),_0x384783);if(_0x4024c7[_0x629b('0x41')][_0x629b('0x4b')]){_0x37daad['where']=_[_0x629b('0x4c')](_0x37daad[_0x629b('0x4a')],{'$or':_[_0x629b('0x3c')](_0x384783,function(_0x309665){if(_0x309665[_0x629b('0x4d')]!==_0x629b('0x4e')){var _0x4f8a5b={};_0x4f8a5b[_0x309665['name']]={'$like':'%'+_0x4024c7[_0x629b('0x41')][_0x629b('0x4b')]+'%'};return _0x4f8a5b;}})});}_0x37daad=_[_0x629b('0x4c')]({},_0x37daad,_0x4024c7[_0x629b('0x4f')]);var _0x23df71={'where':_0x37daad[_0x629b('0x4a')]};return db[_0x629b('0x3d')]['count'](_0x23df71)['then'](function(_0x4143fe){_0x36f47e['count']=_0x4143fe;if(_0x4024c7[_0x629b('0x41')]['includeAll']){_0x37daad[_0x629b('0x50')]=[{'all':!![]}];}return db[_0x629b('0x3d')][_0x629b('0x51')](_0x37daad);})[_0x629b('0x21')](function(_0x1422dd){_0x36f47e[_0x629b('0x52')]=_0x1422dd;return _0x36f47e;})[_0x629b('0x21')](respondWithFilteredResult(_0x20c488,_0x37daad))[_0x629b('0x2a')](handleError(_0x20c488,null));};exports['show']=function(_0x12cf74,_0x581da4){var _0x34d1bd={'raw':!![],'where':{'id':_0x12cf74['params']['id']}},_0x1ceb2a={};_0x1ceb2a[_0x629b('0x40')]=_['keys'](db['SmsMessage'][_0x629b('0x53')]);_0x1ceb2a[_0x629b('0x41')]=_[_0x629b('0x54')](_0x12cf74[_0x629b('0x41')]);_0x1ceb2a['filters']=_[_0x629b('0x43')](_0x1ceb2a[_0x629b('0x40')],_0x1ceb2a['query']);_0x34d1bd[_0x629b('0x46')]=_[_0x629b('0x43')](_0x1ceb2a[_0x629b('0x40')],qs['fields'](_0x12cf74[_0x629b('0x41')][_0x629b('0x44')]));_0x34d1bd[_0x629b('0x46')]=_0x34d1bd[_0x629b('0x46')][_0x629b('0x45')]?_0x34d1bd['attributes']:_0x1ceb2a['model'];if(_0x12cf74[_0x629b('0x41')][_0x629b('0x55')]){_0x34d1bd[_0x629b('0x50')]=[{'all':!![]}];}_0x34d1bd=_[_0x629b('0x4c')]({},_0x34d1bd,_0x12cf74[_0x629b('0x4f')]);return db[_0x629b('0x3d')]['find'](_0x34d1bd)['then'](handleEntityNotFound(_0x581da4,null))[_0x629b('0x21')](respondWithResult(_0x581da4,null))[_0x629b('0x2a')](handleError(_0x581da4,null));};exports[_0x629b('0x56')]=function(_0x3f819e,_0x264c6f){return db[_0x629b('0x3d')]['create'](_0x3f819e['body'],{})[_0x629b('0x21')](respondWithResult(_0x264c6f,0xc9))[_0x629b('0x2a')](handleError(_0x264c6f,null));};exports['update']=function(_0x4a71c0,_0xc1f151){if(_0x4a71c0[_0x629b('0x57')]['id']){delete _0x4a71c0[_0x629b('0x57')]['id'];}return db[_0x629b('0x3d')][_0x629b('0x58')]({'where':{'id':_0x4a71c0[_0x629b('0x59')]['id']}})['then'](handleEntityNotFound(_0xc1f151,null))[_0x629b('0x21')](saveUpdates(_0x4a71c0[_0x629b('0x57')],null))[_0x629b('0x21')](respondWithResult(_0xc1f151,null))['catch'](handleError(_0xc1f151,null));};exports[_0x629b('0x5a')]=function(_0x26cf93,_0x21bdf8){return db['SmsMessage']['find']({'where':{'id':_0x26cf93[_0x629b('0x59')]['id']}})[_0x629b('0x21')](handleEntityNotFound(_0x21bdf8,null))[_0x629b('0x21')](removeEntity(_0x21bdf8,null))['catch'](handleError(_0x21bdf8,null));};exports[_0x629b('0x5b')]=function(_0x228710,_0x137ed5){return db[_0x629b('0x3d')][_0x629b('0x5b')]()[_0x629b('0x21')](respondWithResult(_0x137ed5,null))['catch'](handleError(_0x137ed5,null));};var interaction_log=require(_0x629b('0x16'))(_0x629b('0x5c'));exports[_0x629b('0x5d')]=function(_0x169f2f,_0x25d9e9,_0x5ea044){var _0x528d33={'agent':{},'channel':'sms'};if(_0x169f2f[_0x629b('0x57')]['id']){delete _0x169f2f[_0x629b('0x57')]['id'];}_0x169f2f[_0x629b('0x57')][_0x629b('0x5e')]=!![];_0x169f2f[_0x629b('0x57')][_0x629b('0x5f')]=moment()[_0x629b('0x60')](_0x629b('0x61'));_0x169f2f[_0x629b('0x57')][_0x629b('0x62')]=_0x169f2f[_0x629b('0x57')][_0x629b('0x62')]||_0x169f2f[_0x629b('0x63')]['id'];_0x528d33['agent']['id']=_0x169f2f[_0x629b('0x57')]['UserId'];return db[_0x629b('0x3d')]['find']({'where':{'id':_0x169f2f['params']['id'],'UserId':null}})[_0x629b('0x21')](handleEntityNotFound(_0x25d9e9,null))['then'](saveUpdates(_0x169f2f['body'],null))['then'](function(_0x5c56e6){if(_0x5c56e6){_0x528d33[_0x629b('0x28')]=_0x5c56e6[_0x629b('0x64')]({'plain':!![]});return db[_0x629b('0x65')][_0x629b('0x58')]({'where':{'id':_0x5c56e6[_0x629b('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x25d9e9,null))[_0x629b('0x21')](function(_0x2532d5){if(_0x2532d5){return _0x2532d5[_0x629b('0x38')]({'UserId':_0x169f2f['body']['UserId'],'read1stAt':_[_0x629b('0x67')](_0x2532d5[_0x629b('0x68')])?moment()[_0x629b('0x60')](_0x629b('0x61')):undefined});}return null;})[_0x629b('0x21')](function(_0x150a8c){if(_0x150a8c){_0x528d33[_0x629b('0x69')]=_0x150a8c[_0x629b('0x64')]({'plain':!![]});interaction_log[_0x629b('0x22')](_0x629b('0x6a'),_0x169f2f[_0x629b('0x63')]['id'],_0x169f2f['user']['name'],_0x169f2f['user'][_0x629b('0x6b')],_0x528d33[_0x629b('0x69')]['id'],_0x169f2f[_0x629b('0x57')]?JSON[_0x629b('0x25')](_0x169f2f[_0x629b('0x57')]):_0x629b('0x6c'));return respondWithRpcPromise(_0x629b('0x6d'),_0x629b('0x6e'),_0x528d33);}return null;})[_0x629b('0x21')](function(_0x1ef3ef){var _0x1fa5c6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ef3ef[_0x629b('0x28')]['ContactId'];return db[_0x629b('0x6f')]['query'](_0x1fa5c6,{'type':db[_0x629b('0x70')][_0x629b('0x71')]['SELECT'],'raw':!![]})[_0x629b('0x21')](function(_0x5a1f6c){return _0x5a1f6c;});})[_0x629b('0x21')](function(_0x2576ac){if(_0x2576ac){_0x528d33[_0x629b('0x28')]['contact']=_0x2576ac[0x0];if(!_0x169f2f[_0x629b('0x57')][_0x629b('0x62')])return;return db[_0x629b('0x72')][_0x629b('0x58')]({'where':{'id':_0x169f2f[_0x629b('0x57')]['UserId'],'role':_0x629b('0x73')},'attributes':['id',_0x629b('0x3a'),_0x629b('0x74'),_0x629b('0x75'),_0x629b('0x76')],'raw':!![]});}return null;})[_0x629b('0x21')](function(_0x477c5a){if(!_0x477c5a)return null;_0x528d33[_0x629b('0x28')][_0x629b('0x73')]=_0x477c5a;return _0x528d33;})[_0x629b('0x21')](function(_0x3045df){if(_0x3045df){if(_0x169f2f[_0x629b('0x57')][_0x629b('0x77')]){_0x528d33[_0x629b('0x28')]['interface']=util[_0x629b('0x60')](_0x629b('0x78'),_0x169f2f['user']['name']);_0x528d33[_0x629b('0x28')][_0x629b('0x79')]=_0x528d33[_0x629b('0x79')];_0x528d33['message']['motionChannel']=_0x528d33[_0x629b('0x79')];_0x528d33[_0x629b('0x28')][_0x629b('0x7a')]=_0x629b('0x5d');return respondWithRpcPromise(_0x629b('0x7b'),_0x629b('0x7b'),{'event':_0x629b('0x7c'),'message':_0x528d33[_0x629b('0x28')]},client9002)[_0x629b('0x21')](function(){return _0x528d33;});}return _0x528d33;}return null;})['then'](respondWithResult(_0x25d9e9,null))['catch'](handleError(_0x25d9e9,null));};var interaction_log=require(_0x629b('0x16'))('sms-interactions');exports[_0x629b('0x36')]=function(_0x120632,_0x37acc8,_0x15f072){var _0x523fc4={'agent':{},'channel':_0x629b('0x7d')};if(_0x120632[_0x629b('0x57')]['id']){delete _0x120632[_0x629b('0x57')]['id'];}_0x120632[_0x629b('0x57')][_0x629b('0x62')]=_0x120632[_0x629b('0x57')][_0x629b('0x62')]||_0x120632[_0x629b('0x63')]['id'];_0x523fc4[_0x629b('0x73')]['id']=_0x120632[_0x629b('0x57')][_0x629b('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x120632[_0x629b('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x37acc8,null))[_0x629b('0x21')](function(_0x557aa0){if(_0x557aa0){_0x523fc4['message']=_0x557aa0[_0x629b('0x64')]({'plain':!![]});return db[_0x629b('0x65')][_0x629b('0x58')]({'where':{'id':_0x557aa0[_0x629b('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x37acc8,null))[_0x629b('0x21')](function(_0x48e31e){if(_0x48e31e){_0x523fc4['interaction']=_0x48e31e['get']({'plain':!![]});interaction_log[_0x629b('0x22')](_0x629b('0x7e'),_0x120632[_0x629b('0x63')]['id'],_0x120632[_0x629b('0x63')][_0x629b('0x3a')],_0x120632['user'][_0x629b('0x6b')],_0x523fc4[_0x629b('0x69')]['id'],_0x120632[_0x629b('0x57')]?JSON[_0x629b('0x25')](_0x120632['body']):'null');return respondWithRpcPromise(_0x629b('0x7f'),_0x629b('0x80'),_0x523fc4);}return null;})[_0x629b('0x21')](function(_0x4f51cb){var _0x14585f=_0x629b('0x81')+_0x4f51cb['message'][_0x629b('0x82')];return db['sequelize'][_0x629b('0x41')](_0x14585f,{'type':db[_0x629b('0x70')][_0x629b('0x71')][_0x629b('0x83')],'raw':!![]})[_0x629b('0x21')](function(_0x1f5496){return _0x1f5496;});})[_0x629b('0x21')](function(_0x429485){if(_0x429485){_0x523fc4[_0x629b('0x28')][_0x629b('0x84')]=_0x429485[0x0];if(!_0x120632['body'][_0x629b('0x62')])return;return db[_0x629b('0x72')][_0x629b('0x58')]({'where':{'id':_0x120632[_0x629b('0x57')][_0x629b('0x62')],'role':_0x629b('0x73')},'attributes':['id',_0x629b('0x3a'),_0x629b('0x74'),_0x629b('0x75'),'internal'],'raw':!![]});}return null;})[_0x629b('0x21')](function(_0x14cf48){if(!_0x14cf48)return null;_0x523fc4[_0x629b('0x28')][_0x629b('0x73')]=_0x14cf48;return _0x523fc4;})['then'](function(_0x4e4339){if(_0x4e4339){_0x4e4339['message'][_0x629b('0x85')]=util[_0x629b('0x60')]('SIP/%s',_0x120632[_0x629b('0x63')][_0x629b('0x3a')]);_0x4e4339[_0x629b('0x28')][_0x629b('0x79')]=_0x523fc4[_0x629b('0x79')];_0x4e4339[_0x629b('0x28')][_0x629b('0x86')]=_0x523fc4['channel'];_0x4e4339[_0x629b('0x28')][_0x629b('0x7a')]=_0x629b('0x36');respondWithRpcPromise(_0x629b('0x7b'),'EventManager',{'event':_0x629b('0x87'),'message':_0x4e4339[_0x629b('0x28')]},client9002);return _0x523fc4;}return null;})[_0x629b('0x21')](respondWithResult(_0x37acc8,null))['catch'](handleError(_0x37acc8,null));};exports['status']=function(_0x1c1948,_0x410fa8,_0x3f8bc0){if(_0x1c1948[_0x629b('0x57')]['id']){delete _0x1c1948[_0x629b('0x57')]['id'];}var _0x4dfe08;return db[_0x629b('0x3d')][_0x629b('0x58')]({'where':{'id':_0x1c1948[_0x629b('0x59')]['id']}})['then'](handleEntityNotFound(_0x410fa8,null))[_0x629b('0x21')](function(_0x28f494){if(_0x28f494){_0x4dfe08=_0x28f494;return db[_0x629b('0x88')][_0x629b('0x58')]({'where':{'id':_0x28f494[_0x629b('0x89')]}});}})[_0x629b('0x21')](handleEntityNotFound(_0x410fa8,null))['then'](function(_0x5d0cdd){if(_0x5d0cdd){logger['debug'](_0x629b('0x24'),_0x629b('0x2c'),_0x629b('0x8a'),_0x5d0cdd[_0x629b('0x4d')],util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));switch(_0x5d0cdd['type']){case _0x629b('0x8c'):if(_0x1c1948[_0x629b('0x57')][_0x629b('0x8d')]&&_0x1c1948[_0x629b('0x57')][_0x629b('0x8d')]===_0x4dfe08[_0x629b('0x8e')]){return _0x4dfe08['update']({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),_0x629b('0x8c'),util['inspect'](_0x1c1948['body'],{'showHidden':![],'depth':null}));}break;case _0x629b('0x8f'):if(_0x1c1948[_0x629b('0x57')][_0x629b('0x90')]&&_0x1c1948[_0x629b('0x57')][_0x629b('0x90')]===_0x4dfe08[_0x629b('0x8e')]&&_[_0x629b('0x91')](['sent',_0x629b('0x92')],_0x1c1948[_0x629b('0x57')][_0x629b('0x93')])>=0x0){return _0x4dfe08[_0x629b('0x38')]({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),'plivio',util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));}break;case _0x629b('0x94'):var _0x1a1007=_0x1c1948[_0x629b('0x57')]['results'][0x0];if(_0x1a1007[_0x629b('0x2c')]['groupName']===_0x629b('0x95')){return _0x4dfe08['update']({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),'infobip',util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4dfe08;}})[_0x629b('0x21')](respondWithResult(_0x410fa8,null))['catch'](handleError(_0x410fa8,null));}; \ No newline at end of file +var _0xd94d=['intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','keys','body','find','params','destroy','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','../../config/logger','get','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','event','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','delivered','Status','plivio','infobip','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','filters'];(function(_0xefdef7,_0x295747){var _0x26297e=function(_0x58c7ad){while(--_0x58c7ad){_0xefdef7['push'](_0xefdef7['shift']());}};_0x26297e(++_0x295747);}(_0xd94d,0x16f));var _0xdd94=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd94d[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd94('0x0'));var zipdir=require(_0xdd94('0x1'));var jsonpatch=require(_0xdd94('0x2'));var rp=require('request-promise');var moment=require(_0xdd94('0x3'));var BPromise=require(_0xdd94('0x4'));var Mustache=require(_0xdd94('0x5'));var util=require(_0xdd94('0x6'));var path=require(_0xdd94('0x7'));var sox=require(_0xdd94('0x8'));var csv=require(_0xdd94('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd94('0xa'));var _=require(_0xdd94('0xb'));var squel=require('squel');var crypto=require(_0xdd94('0xc'));var jsforce=require(_0xdd94('0xd'));var deskjs=require(_0xdd94('0xe'));var toCsv=require(_0xdd94('0x9'));var querystring=require(_0xdd94('0xf'));var Papa=require(_0xdd94('0x10'));var Redis=require(_0xdd94('0x11'));var authService=require(_0xdd94('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd94('0x13'));var logger=require('../../config/logger')(_0xdd94('0x14'));var utils=require(_0xdd94('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdd94('0x16')]=_['defaults'](config[_0xdd94('0x16')],{'host':_0xdd94('0x17'),'port':0x18eb});var socket=require(_0xdd94('0x18'))(new Redis(config[_0xdd94('0x16')]));require(_0xdd94('0x19'))[_0xdd94('0x1a')](socket);var jayson=require(_0xdd94('0x1b'));var client=jayson[_0xdd94('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xdd94('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x203d6c,_0x19ec9c,_0x1746e6,_0x5e691d){return new BPromise(function(_0x430b65,_0x1ce12a){var _0x1d81c9=_0x5e691d||client;return _0x1d81c9[_0xdd94('0x1d')](_0x203d6c,_0x1746e6)[_0xdd94('0x1e')](function(_0x5ab4ad){logger[_0xdd94('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x19ec9c,_0xdd94('0x20'));logger[_0xdd94('0x21')](_0xdd94('0x22'),_0x19ec9c,_0xdd94('0x20'),JSON[_0xdd94('0x23')](_0x5ab4ad));if(_0x5ab4ad[_0xdd94('0x24')]){if(_0x5ab4ad[_0xdd94('0x24')]['code']===0x1f4){logger[_0xdd94('0x24')](_0xdd94('0x25'),_0x19ec9c,_0x5ab4ad[_0xdd94('0x24')][_0xdd94('0x26')]);return _0x1ce12a(_0x5ab4ad[_0xdd94('0x24')]['message']);}logger['error'](_0xdd94('0x25'),_0x19ec9c,_0x5ab4ad[_0xdd94('0x24')]['message']);return _0x430b65(_0x5ab4ad[_0xdd94('0x24')][_0xdd94('0x26')]);}else{logger['info'](_0xdd94('0x25'),_0x19ec9c,_0xdd94('0x20'));_0x430b65(_0x5ab4ad[_0xdd94('0x27')]['message']);}})['catch'](function(_0x3c4c20){logger['error']('SmsMessage,\x20%s,\x20%s',_0x19ec9c,_0x3c4c20);_0x1ce12a(_0x3c4c20);});});}function respondWithStatusCode(_0x510810,_0x371ded){_0x371ded=_0x371ded||0xcc;return function(_0x452bca){if(_0x452bca){return _0x510810[_0xdd94('0x28')](_0x371ded);}return _0x510810['status'](_0x371ded)[_0xdd94('0x29')]();};}function respondWithResult(_0x343ec5,_0x5b02d4){_0x5b02d4=_0x5b02d4||0xc8;return function(_0x5d7b7f){if(_0x5d7b7f){return _0x343ec5[_0xdd94('0x2a')](_0x5b02d4)[_0xdd94('0x2b')](_0x5d7b7f);}};}function respondWithFilteredResult(_0x368dca,_0x4e6102){return function(_0x3e9e43){if(_0x3e9e43){var _0x32f913=typeof _0x4e6102['offset']===_0xdd94('0x2c')&&typeof _0x4e6102[_0xdd94('0x2d')]==='undefined';var _0x39d377=_0x3e9e43[_0xdd94('0x2e')];var _0x28d26a=_0x32f913?0x0:_0x4e6102[_0xdd94('0x2f')];var _0x522d14=_0x32f913?_0x3e9e43['count']:_0x4e6102[_0xdd94('0x2f')]+_0x4e6102[_0xdd94('0x2d')];var _0x572975;if(_0x522d14>=_0x39d377){_0x522d14=_0x39d377;_0x572975=0xc8;}else{_0x572975=0xce;}_0x368dca[_0xdd94('0x2a')](_0x572975);return _0x368dca['set'](_0xdd94('0x30'),_0x28d26a+'-'+_0x522d14+'/'+_0x39d377)[_0xdd94('0x2b')](_0x3e9e43);}return null;};}function patchUpdates(_0x197562){return function(_0x1d430f){try{jsonpatch[_0xdd94('0x31')](_0x1d430f,_0x197562,!![]);}catch(_0x1ef850){return BPromise[_0xdd94('0x32')](_0x1ef850);}return _0x1d430f[_0xdd94('0x33')]();};}function saveUpdates(_0x17c756,_0xdce260){return function(_0x5b148a){if(_0x5b148a){return _0x5b148a[_0xdd94('0x34')](_0x17c756)['then'](function(_0x21c660){return _0x21c660;});}return null;};}function removeEntity(_0x54ea76,_0x21c538){return function(_0x3f4d0d){if(_0x3f4d0d){return _0x3f4d0d['destroy']()['then'](function(){_0x54ea76[_0xdd94('0x2a')](0xcc)[_0xdd94('0x29')]();});}};}function handleEntityNotFound(_0x38262e,_0x2729cf){return function(_0x28ce99){if(!_0x28ce99){_0x38262e[_0xdd94('0x28')](0x194);}return _0x28ce99;};}function handleError(_0x4fbdd6,_0x334e56){_0x334e56=_0x334e56||0x1f4;return function(_0x27c9db){logger[_0xdd94('0x24')](_0x27c9db[_0xdd94('0x35')]);if(_0x27c9db['name']){delete _0x27c9db[_0xdd94('0x36')];}_0x4fbdd6[_0xdd94('0x2a')](_0x334e56)[_0xdd94('0x37')](_0x27c9db);};}exports[_0xdd94('0x38')]=function(_0x59cb72,_0x215c16){var _0x43828d={},_0x22b197={},_0x4ae60c={'count':0x0,'rows':[]};var _0x21251e=_[_0xdd94('0x39')](db[_0xdd94('0x3a')][_0xdd94('0x3b')],function(_0x1f6ee3){return{'name':_0x1f6ee3[_0xdd94('0x3c')],'type':_0x1f6ee3[_0xdd94('0x3d')]['key']};});_0x22b197[_0xdd94('0x3e')]=_['map'](_0x21251e,'name');_0x22b197['query']=_['keys'](_0x59cb72[_0xdd94('0x3f')]);_0x22b197[_0xdd94('0x40')]=_[_0xdd94('0x41')](_0x22b197[_0xdd94('0x3e')],_0x22b197[_0xdd94('0x3f')]);_0x43828d[_0xdd94('0x42')]=_[_0xdd94('0x41')](_0x22b197['model'],qs['fields'](_0x59cb72[_0xdd94('0x3f')]['fields']));_0x43828d[_0xdd94('0x42')]=_0x43828d['attributes'][_0xdd94('0x43')]?_0x43828d[_0xdd94('0x42')]:_0x22b197['model'];if(!_0x59cb72[_0xdd94('0x3f')][_0xdd94('0x44')](_0xdd94('0x45'))){_0x43828d[_0xdd94('0x2d')]=qs[_0xdd94('0x2d')](_0x59cb72['query'][_0xdd94('0x2d')]);_0x43828d[_0xdd94('0x2f')]=qs[_0xdd94('0x2f')](_0x59cb72[_0xdd94('0x3f')][_0xdd94('0x2f')]);}_0x43828d[_0xdd94('0x46')]=qs[_0xdd94('0x47')](_0x59cb72[_0xdd94('0x3f')]['sort']);_0x43828d[_0xdd94('0x48')]=qs['filters'](_[_0xdd94('0x49')](_0x59cb72[_0xdd94('0x3f')],_0x22b197[_0xdd94('0x40')]),_0x21251e);if(_0x59cb72[_0xdd94('0x3f')][_0xdd94('0x4a')]){_0x43828d[_0xdd94('0x48')]=_[_0xdd94('0x4b')](_0x43828d[_0xdd94('0x48')],{'$or':_[_0xdd94('0x39')](_0x21251e,function(_0x1e3031){if(_0x1e3031[_0xdd94('0x3d')]!==_0xdd94('0x4c')){var _0x300216={};_0x300216[_0x1e3031[_0xdd94('0x36')]]={'$like':'%'+_0x59cb72['query'][_0xdd94('0x4a')]+'%'};return _0x300216;}})});}_0x43828d=_['merge']({},_0x43828d,_0x59cb72[_0xdd94('0x4d')]);var _0x2b62de={'where':_0x43828d['where']};return db[_0xdd94('0x3a')][_0xdd94('0x2e')](_0x2b62de)[_0xdd94('0x1e')](function(_0x278486){_0x4ae60c[_0xdd94('0x2e')]=_0x278486;if(_0x59cb72[_0xdd94('0x3f')][_0xdd94('0x4e')]){_0x43828d['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x43828d);})['then'](function(_0x3eb488){_0x4ae60c['rows']=_0x3eb488;return _0x4ae60c;})['then'](respondWithFilteredResult(_0x215c16,_0x43828d))[_0xdd94('0x4f')](handleError(_0x215c16,null));};exports[_0xdd94('0x50')]=function(_0x2e6af9,_0xa3235b){var _0x22eaf8={'raw':!![],'where':{'id':_0x2e6af9['params']['id']}},_0x49b2eb={};_0x49b2eb['model']=_[_0xdd94('0x51')](db[_0xdd94('0x3a')][_0xdd94('0x3b')]);_0x49b2eb[_0xdd94('0x3f')]=_[_0xdd94('0x51')](_0x2e6af9['query']);_0x49b2eb[_0xdd94('0x40')]=_[_0xdd94('0x41')](_0x49b2eb[_0xdd94('0x3e')],_0x49b2eb[_0xdd94('0x3f')]);_0x22eaf8['attributes']=_['intersection'](_0x49b2eb['model'],qs['fields'](_0x2e6af9[_0xdd94('0x3f')]['fields']));_0x22eaf8[_0xdd94('0x42')]=_0x22eaf8[_0xdd94('0x42')][_0xdd94('0x43')]?_0x22eaf8[_0xdd94('0x42')]:_0x49b2eb[_0xdd94('0x3e')];if(_0x2e6af9[_0xdd94('0x3f')][_0xdd94('0x4e')]){_0x22eaf8['include']=[{'all':!![]}];}_0x22eaf8=_['merge']({},_0x22eaf8,_0x2e6af9[_0xdd94('0x4d')]);return db[_0xdd94('0x3a')]['find'](_0x22eaf8)['then'](handleEntityNotFound(_0xa3235b,null))[_0xdd94('0x1e')](respondWithResult(_0xa3235b,null))[_0xdd94('0x4f')](handleError(_0xa3235b,null));};exports['create']=function(_0x2df39a,_0x39547a){return db[_0xdd94('0x3a')]['create'](_0x2df39a[_0xdd94('0x52')],{})[_0xdd94('0x1e')](respondWithResult(_0x39547a,0xc9))[_0xdd94('0x4f')](handleError(_0x39547a,null));};exports[_0xdd94('0x34')]=function(_0x5eec26,_0x37823f){if(_0x5eec26['body']['id']){delete _0x5eec26[_0xdd94('0x52')]['id'];}return db['SmsMessage'][_0xdd94('0x53')]({'where':{'id':_0x5eec26[_0xdd94('0x54')]['id']}})['then'](handleEntityNotFound(_0x37823f,null))['then'](saveUpdates(_0x5eec26['body'],null))['then'](respondWithResult(_0x37823f,null))[_0xdd94('0x4f')](handleError(_0x37823f,null));};exports[_0xdd94('0x55')]=function(_0x557bd4,_0x3ce13d){return db['SmsMessage'][_0xdd94('0x53')]({'where':{'id':_0x557bd4['params']['id']}})[_0xdd94('0x1e')](handleEntityNotFound(_0x3ce13d,null))['then'](removeEntity(_0x3ce13d,null))[_0xdd94('0x4f')](handleError(_0x3ce13d,null));};exports[_0xdd94('0x56')]=function(_0x26710a,_0x16005d){return db[_0xdd94('0x3a')][_0xdd94('0x56')]()[_0xdd94('0x1e')](respondWithResult(_0x16005d,null))[_0xdd94('0x4f')](handleError(_0x16005d,null));};var interaction_log=require('../../config/logger')(_0xdd94('0x57'));exports[_0xdd94('0x58')]=function(_0x5e3283,_0x47516a,_0xdb7b7a){var _0x365552={'agent':{},'channel':_0xdd94('0x59')};if(_0x5e3283[_0xdd94('0x52')]['id']){delete _0x5e3283[_0xdd94('0x52')]['id'];}_0x5e3283[_0xdd94('0x52')][_0xdd94('0x5a')]=!![];_0x5e3283[_0xdd94('0x52')][_0xdd94('0x5b')]=moment()[_0xdd94('0x5c')](_0xdd94('0x5d'));_0x5e3283[_0xdd94('0x52')][_0xdd94('0x5e')]=_0x5e3283[_0xdd94('0x52')][_0xdd94('0x5e')]||_0x5e3283['user']['id'];_0x365552[_0xdd94('0x5f')]['id']=_0x5e3283[_0xdd94('0x52')][_0xdd94('0x5e')];return db['SmsMessage'][_0xdd94('0x53')]({'where':{'id':_0x5e3283[_0xdd94('0x54')]['id'],'UserId':null}})[_0xdd94('0x1e')](handleEntityNotFound(_0x47516a,null))[_0xdd94('0x1e')](saveUpdates(_0x5e3283[_0xdd94('0x52')],null))['then'](function(_0x249cf5){if(_0x249cf5){_0x365552[_0xdd94('0x26')]=_0x249cf5['get']({'plain':!![]});return db[_0xdd94('0x60')][_0xdd94('0x53')]({'where':{'id':_0x249cf5[_0xdd94('0x61')]}});}return null;})[_0xdd94('0x1e')](handleEntityNotFound(_0x47516a,null))[_0xdd94('0x1e')](function(_0x34bfb5){if(_0x34bfb5){return _0x34bfb5[_0xdd94('0x34')]({'UserId':_0x5e3283[_0xdd94('0x52')][_0xdd94('0x5e')],'read1stAt':_[_0xdd94('0x62')](_0x34bfb5[_0xdd94('0x63')])?moment()[_0xdd94('0x5c')](_0xdd94('0x5d')):undefined});}return null;})[_0xdd94('0x1e')](function(_0x32c1cd){if(_0x32c1cd){_0x365552[_0xdd94('0x64')]=_0x32c1cd['get']({'plain':!![]});interaction_log[_0xdd94('0x1f')](_0xdd94('0x65'),_0x5e3283[_0xdd94('0x66')]['id'],_0x5e3283['user'][_0xdd94('0x36')],_0x5e3283[_0xdd94('0x66')][_0xdd94('0x67')],_0x365552[_0xdd94('0x64')]['id'],_0x5e3283[_0xdd94('0x52')]?JSON[_0xdd94('0x23')](_0x5e3283[_0xdd94('0x52')]):_0xdd94('0x68'));return respondWithRpcPromise(_0xdd94('0x69'),_0xdd94('0x6a'),_0x365552);}return null;})[_0xdd94('0x1e')](function(_0xd0c998){var _0xb905a7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd0c998['message']['ContactId'];return db[_0xdd94('0x6b')][_0xdd94('0x3f')](_0xb905a7,{'type':db['Sequelize'][_0xdd94('0x6c')][_0xdd94('0x6d')],'raw':!![]})[_0xdd94('0x1e')](function(_0x4adf49){return _0x4adf49;});})[_0xdd94('0x1e')](function(_0x1f18d2){if(_0x1f18d2){_0x365552[_0xdd94('0x26')][_0xdd94('0x6e')]=_0x1f18d2[0x0];if(!_0x5e3283[_0xdd94('0x52')]['UserId'])return;return db[_0xdd94('0x6f')]['find']({'where':{'id':_0x5e3283[_0xdd94('0x52')][_0xdd94('0x5e')],'role':_0xdd94('0x5f')},'attributes':['id',_0xdd94('0x36'),_0xdd94('0x70'),'email',_0xdd94('0x71')],'raw':!![]});}return null;})[_0xdd94('0x1e')](function(_0x214e61){if(!_0x214e61)return null;_0x365552[_0xdd94('0x26')][_0xdd94('0x5f')]=_0x214e61;return _0x365552;})[_0xdd94('0x1e')](function(_0x4e166a){if(_0x4e166a){if(_0x5e3283['body']['manual']){_0x365552[_0xdd94('0x26')][_0xdd94('0x72')]=util[_0xdd94('0x5c')](_0xdd94('0x73'),_0x5e3283[_0xdd94('0x66')][_0xdd94('0x36')]);_0x365552[_0xdd94('0x26')][_0xdd94('0x74')]=_0x365552[_0xdd94('0x74')];_0x365552[_0xdd94('0x26')][_0xdd94('0x75')]=_0x365552[_0xdd94('0x74')];_0x365552[_0xdd94('0x26')]['event']=_0xdd94('0x58');return respondWithRpcPromise('EventManager',_0xdd94('0x76'),{'event':_0xdd94('0x77'),'message':_0x365552[_0xdd94('0x26')]},client9002)['then'](function(){return _0x365552;});}return _0x365552;}return null;})[_0xdd94('0x1e')](respondWithResult(_0x47516a,null))[_0xdd94('0x4f')](handleError(_0x47516a,null));};var interaction_log=require(_0xdd94('0x78'))(_0xdd94('0x57'));exports[_0xdd94('0x32')]=function(_0x12d19e,_0x4bf335,_0x8651a9){var _0x150369={'agent':{},'channel':_0xdd94('0x59')};if(_0x12d19e[_0xdd94('0x52')]['id']){delete _0x12d19e[_0xdd94('0x52')]['id'];}_0x12d19e[_0xdd94('0x52')][_0xdd94('0x5e')]=_0x12d19e[_0xdd94('0x52')]['UserId']||_0x12d19e[_0xdd94('0x66')]['id'];_0x150369[_0xdd94('0x5f')]['id']=_0x12d19e[_0xdd94('0x52')][_0xdd94('0x5e')];return db[_0xdd94('0x3a')][_0xdd94('0x53')]({'where':{'id':_0x12d19e['params']['id'],'UserId':null}})[_0xdd94('0x1e')](handleEntityNotFound(_0x4bf335,null))[_0xdd94('0x1e')](function(_0x54bc39){if(_0x54bc39){_0x150369[_0xdd94('0x26')]=_0x54bc39[_0xdd94('0x79')]({'plain':!![]});return db[_0xdd94('0x60')][_0xdd94('0x53')]({'where':{'id':_0x54bc39['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4bf335,null))[_0xdd94('0x1e')](function(_0x5b903e){if(_0x5b903e){_0x150369[_0xdd94('0x64')]=_0x5b903e[_0xdd94('0x79')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12d19e[_0xdd94('0x66')]['id'],_0x12d19e['user'][_0xdd94('0x36')],_0x12d19e[_0xdd94('0x66')]['role'],_0x150369[_0xdd94('0x64')]['id'],_0x12d19e[_0xdd94('0x52')]?JSON[_0xdd94('0x23')](_0x12d19e['body']):'null');return respondWithRpcPromise(_0xdd94('0x7a'),_0xdd94('0x7b'),_0x150369);}return null;})[_0xdd94('0x1e')](function(_0x4da4ea){var _0x11976f=_0xdd94('0x7c')+_0x4da4ea[_0xdd94('0x26')][_0xdd94('0x7d')];return db['sequelize']['query'](_0x11976f,{'type':db[_0xdd94('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})[_0xdd94('0x1e')](function(_0x2aa246){return _0x2aa246;});})[_0xdd94('0x1e')](function(_0x5e4428){if(_0x5e4428){_0x150369['message']['contact']=_0x5e4428[0x0];if(!_0x12d19e['body'][_0xdd94('0x5e')])return;return db[_0xdd94('0x6f')]['find']({'where':{'id':_0x12d19e['body'][_0xdd94('0x5e')],'role':_0xdd94('0x5f')},'attributes':['id',_0xdd94('0x36'),_0xdd94('0x70'),'email',_0xdd94('0x71')],'raw':!![]});}return null;})[_0xdd94('0x1e')](function(_0x1e9992){if(!_0x1e9992)return null;_0x150369[_0xdd94('0x26')]['agent']=_0x1e9992;return _0x150369;})['then'](function(_0x3dc4da){if(_0x3dc4da){_0x3dc4da[_0xdd94('0x26')][_0xdd94('0x72')]=util[_0xdd94('0x5c')](_0xdd94('0x73'),_0x12d19e['user'][_0xdd94('0x36')]);_0x3dc4da[_0xdd94('0x26')][_0xdd94('0x74')]=_0x150369[_0xdd94('0x74')];_0x3dc4da[_0xdd94('0x26')]['motionChannel']=_0x150369[_0xdd94('0x74')];_0x3dc4da['message'][_0xdd94('0x7f')]=_0xdd94('0x32');respondWithRpcPromise(_0xdd94('0x76'),'EventManager',{'event':'rejectmessage','message':_0x3dc4da[_0xdd94('0x26')]},client9002);return _0x150369;}return null;})[_0xdd94('0x1e')](respondWithResult(_0x4bf335,null))[_0xdd94('0x4f')](handleError(_0x4bf335,null));};exports[_0xdd94('0x2a')]=function(_0x1c280b,_0x4f3025,_0x3c244b){if(_0x1c280b['body']['id']){delete _0x1c280b['body']['id'];}var _0x166bae;return db[_0xdd94('0x3a')][_0xdd94('0x53')]({'where':{'id':_0x1c280b[_0xdd94('0x54')]['id']}})[_0xdd94('0x1e')](handleEntityNotFound(_0x4f3025,null))['then'](function(_0x3f8458){if(_0x3f8458){_0x166bae=_0x3f8458;return db[_0xdd94('0x80')]['find']({'where':{'id':_0x3f8458[_0xdd94('0x81')]}});}})[_0xdd94('0x1e')](handleEntityNotFound(_0x4f3025,null))[_0xdd94('0x1e')](function(_0x3160d9){if(_0x3160d9){logger['debug'](_0xdd94('0x22'),_0xdd94('0x2a'),'received\x20delivery\x20report\x20from',_0x3160d9[_0xdd94('0x3d')],util[_0xdd94('0x82')](_0x1c280b[_0xdd94('0x52')],{'showHidden':![],'depth':null}));switch(_0x3160d9[_0xdd94('0x3d')]){case _0xdd94('0x83'):if(_0x1c280b[_0xdd94('0x52')][_0xdd94('0x84')]&&_0x1c280b['body'][_0xdd94('0x84')]===_0x166bae['messageId']){return _0x166bae[_0xdd94('0x34')]({'read':!![]});}else{logger[_0xdd94('0x24')](_0xdd94('0x85'),'status',_0xdd94('0x83'),util[_0xdd94('0x82')](_0x1c280b[_0xdd94('0x52')],{'showHidden':![],'depth':null}));}break;case _0xdd94('0x86'):if(_0x1c280b[_0xdd94('0x52')][_0xdd94('0x87')]&&_0x1c280b['body'][_0xdd94('0x87')]===_0x166bae[_0xdd94('0x88')]&&_[_0xdd94('0x89')](['sent',_0xdd94('0x8a')],_0x1c280b[_0xdd94('0x52')][_0xdd94('0x8b')])>=0x0){return _0x166bae['update']({'read':!![]});}else{logger[_0xdd94('0x24')](_0xdd94('0x85'),_0xdd94('0x2a'),_0xdd94('0x8c'),util[_0xdd94('0x82')](_0x1c280b['body'],{'showHidden':![],'depth':null}));}break;case _0xdd94('0x8d'):var _0x4c32b0=_0x1c280b['body']['results'][0x0];if(_0x4c32b0['status'][_0xdd94('0x8e')]===_0xdd94('0x8f')){return _0x166bae['update']({'read':!![]});}else{logger[_0xdd94('0x24')](_0xdd94('0x85'),_0xdd94('0x2a'),_0xdd94('0x8d'),util[_0xdd94('0x82')](_0x1c280b['body'],{'showHidden':![],'depth':null}));}break;}return _0x166bae;}})[_0xdd94('0x1e')](respondWithResult(_0x4f3025,null))[_0xdd94('0x4f')](handleError(_0x4f3025,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 9d5b6e5..bcfe178 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 _0xb9ae=['SmsMessage','save','update','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x463a68,_0x2509e1){var _0x22d4ca=function(_0x23921c){while(--_0x23921c){_0x463a68['push'](_0x463a68['shift']());}};_0x22d4ca(++_0x2509e1);}(_0xb9ae,0x91));var _0xeb9a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb9ae[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xeb9a('0x0'));var SmsMessage=require(_0xeb9a('0x1'))['db'][_0xeb9a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb9a('0x3'),'afterUpdate':_0xeb9a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x264876){return function(_0x1b58f5,_0xbf8862,_0x5a451f){SmsMessageEvents['emit'](_0x264876+':'+_0x1b58f5['id'],_0x1b58f5);SmsMessageEvents['emit'](_0x264876,_0x1b58f5);_0x5a451f(null);};}for(var e in events){if(events[_0xeb9a('0x5')](e)){var event=events[e];SmsMessage[_0xeb9a('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x9721=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0xd118a2,_0x39db74){var _0x18c67a=function(_0x263e30){while(--_0x263e30){_0xd118a2['push'](_0xd118a2['shift']());}};_0x18c67a(++_0x39db74);}(_0x9721,0x185));var _0x1972=function(_0x1c6592,_0x16aad8){_0x1c6592=_0x1c6592-0x0;var _0x4f8d04=_0x9721[_0x1c6592];return _0x4f8d04;};'use strict';var EventEmitter=require(_0x1972('0x0'));var SmsMessage=require(_0x1972('0x1'))['db'][_0x1972('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1972('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x14c136){return function(_0x1589ea,_0x1d8d05,_0x300afe){SmsMessageEvents[_0x1972('0x4')](_0x14c136+':'+_0x1589ea['id'],_0x1589ea);SmsMessageEvents[_0x1972('0x4')](_0x14c136,_0x1589ea);_0x300afe(null);};}for(var e in events){if(events[_0x1972('0x5')](e)){var event=events[e];SmsMessage[_0x1972('0x6')](e,emitEvent(event));}}module[_0x1972('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 13588af..48bc3e6 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 _0xb403=['/api/sms/messages/','/status?token=','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','login?username=','username','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','http_code','data','queued_count','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','token','IBSSO\x20','messages','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','sort','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','refid','status','message','intelepeer','Token\x20not\x20received','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','SmsInteraction','SmsInteractionId','update','createdAt','catch','secret','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','phone','authToken','create','remote'];(function(_0xeeaea0,_0x5a85f2){var _0x5c1bc9=function(_0x22c37b){while(--_0x22c37b){_0xeeaea0['push'](_0xeeaea0['shift']());}};_0x5c1bc9(++_0x5a85f2);}(_0xb403,0xcc));var _0x3b40=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xb403[_0x27d958];return _0x53e63e;};'use strict';var _=require('lodash');var util=require(_0x3b40('0x0'));var logger=require(_0x3b40('0x1'))(_0x3b40('0x2'));var moment=require(_0x3b40('0x3'));var BPromise=require(_0x3b40('0x4'));var rp=require(_0x3b40('0x5'));var fs=require('fs');var path=require(_0x3b40('0x6'));var rimraf=require('rimraf');var config=require(_0x3b40('0x7'));var attributes=require(_0x3b40('0x8'));module[_0x3b40('0x9')]=function(_0x4d4e50,_0x1591fb){return _0x4d4e50['define'](_0x3b40('0xa'),attributes,{'tableName':_0x3b40('0xb'),'paranoid':![],'indexes':[{'name':_0x3b40('0xc'),'fields':[_0x3b40('0xc')]},{'name':_0x3b40('0xd'),'fields':[_0x3b40('0xe')],'type':_0x3b40('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24847e,_0x1e2663,_0x54bfc6){var _0x106302=_0x4d4e50[_0x3b40('0x10')];var _0xe43e73=_0x24847e[_0x3b40('0x11')]({'plain':!![]});if(_0xe43e73['direction'][_0x3b40('0x12')]()==='in'||_0xe43e73[_0x3b40('0x13')][_0x3b40('0x12')]()===_0x3b40('0x14')&&!_0xe43e73['secret']&&!_[_0x3b40('0x15')](_0xe43e73[_0x3b40('0x16')])&&!_[_0x3b40('0x15')](_0xe43e73['SmsInteractionId'])){_0x106302[_0x3b40('0x17')]['findOne']({'where':{'id':_0xe43e73[_0x3b40('0x18')]}})['then'](function(_0x336822){if(_0x336822){_0x336822[_0x3b40('0x19')]({'lastMsgAt':_0xe43e73[_0x3b40('0x1a')],'lastMsgDirection':_0xe43e73[_0x3b40('0x13')]['toLowerCase']()});}})[_0x3b40('0x1b')](function(_0x3cb7de){console['error'](_0x3cb7de);});}if(_0xe43e73[_0x3b40('0x13')]===_0x3b40('0x14')&&!_0xe43e73[_0x3b40('0x1c')]){var _0x151019;_0x106302[_0x3b40('0x1d')][_0x3b40('0x1e')]({'where':{'id':_0xe43e73[_0x3b40('0x1f')]},'raw':!![]})[_0x3b40('0x20')](function(_0x144ad8){_0x151019=_0x144ad8;if(_0x151019&&_0x151019[_0x3b40('0x21')]){switch(_0x151019['type']){case _0x3b40('0x22'):var _0x575590=require(_0x3b40('0x22'));if(_0x151019[_0x3b40('0x23')]&&_0x151019['authToken']&&_0x151019[_0x3b40('0x24')]){var _0x1f22fc=new _0x575590(_0x151019[_0x3b40('0x23')],_0x151019[_0x3b40('0x25')]);_0x1f22fc['messages'][_0x3b40('0x26')]({'body':_0xe43e73['body'],'to':_0xe43e73['phone'],'from':_0x151019[_0x3b40('0x24')],'statusCallback':_0x151019[_0x3b40('0x27')]+_0x3b40('0x28')+_0xe43e73['id']+_0x3b40('0x29')+_0x151019['token']})[_0x3b40('0x20')](function(_0x1e7db4){if(_0x1e7db4[_0x3b40('0x2a')]){return _0x24847e[_0x3b40('0x19')]({'messageId':_0x1e7db4[_0x3b40('0x2a')]});}})[_0x3b40('0x1b')](function(_0x2691f4){logger[_0x3b40('0x2b')](_0x3b40('0x2c'),'afterCreate','twilio',util[_0x3b40('0x2d')](_0x2691f4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x22'),_0x3b40('0x2f'));}break;case _0x3b40('0x30'):var _0x10fba6=_0x3b40('0x31');if(_0x151019['username']&&_0x151019['password']){var _0x44a856={'recipient':[_0xe43e73[_0x3b40('0x24')]],'message':_0xe43e73[_0x3b40('0xe')],'message_type':_0x151019[_0x3b40('0x32')]};if(_0x151019[_0x3b40('0x32')]&&_0x151019['smsMethod']!=='SI'){_0x44a856['sender']=_0x151019[_0x3b40('0x24')];}var _0x58dc7d={'url':_0x10fba6+_0x3b40('0x33')+_0x151019[_0x3b40('0x34')]+'&password='+_0x151019['password'],'method':_0x3b40('0x35')};rp(_0x58dc7d)[_0x3b40('0x20')](function(_0x2e3ad9){var _0x5658ed=_0x2e3ad9['split'](';');var _0x35f9ee={'user_key':_0x5658ed[0x0],'session_key':_0x5658ed[0x1]};_0x58dc7d={'url':_0x10fba6+_0x3b40('0x36'),'method':_0x3b40('0x37'),'headers':{'user_key':_0x35f9ee[_0x3b40('0x38')],'Session_key':_0x35f9ee[_0x3b40('0x39')]},'json':!![],'body':_0x44a856};return rp(_0x58dc7d);})[_0x3b40('0x20')](function(_0x1d43d2){if(_0x1d43d2[_0x3b40('0x3a')]>=0x1){var _0x845a42={'messageId':_0x1d43d2[_0x3b40('0x3b')]};if(_0x151019['smsMethod']!=='GP'||!_0x151019[_0x3b40('0x3c')]){_0x845a42[_0x3b40('0x3d')]=!![];}return _0x24847e[_0x3b40('0x19')](_0x845a42);}else{return logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x30'),util[_0x3b40('0x2d')](_0x1d43d2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x45b2d6){return logger['error'](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x30'),util[_0x3b40('0x2d')](_0x45b2d6,{'showHidden':![],'depth':null}));});}else{logger[_0x3b40('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3b40('0x2e'),_0x3b40('0x30'),_0x3b40('0x3e'));}break;case _0x3b40('0x3f'):if(_0x151019[_0x3b40('0x25')]){var _0x10c3cb={'recipient':_0xe43e73['phone'],'message':_0xe43e73[_0x3b40('0xe')],'sender':_0x151019[_0x3b40('0x40')]||_0x151019['phone'],'authorization':_0x151019[_0x3b40('0x25')]};var _0x1e2663={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x10c3cb,'json':!![]};rp(_0x1e2663)['then'](function(_0x3acac9){var _0xd982c9={'messageId':_0x3acac9['requestid']};if(!_0x151019[_0x3b40('0x3c')]){_0xd982c9[_0x3b40('0x3d')]=!![];}return _0x24847e[_0x3b40('0x19')](_0xd982c9);})[_0x3b40('0x1b')](function(_0x555c30){logger[_0x3b40('0x2b')](_0x3b40('0x2c'),'afterCreate',_0x3b40('0x3f'),util[_0x3b40('0x2d')](_0x555c30,{'showHidden':![],'depth':null}));});}else{logger[_0x3b40('0x2b')](_0x3b40('0x2c'),'afterCreate','connectel',_0x3b40('0x41'));}break;case _0x3b40('0x42'):if(_0x151019['username']&&_0x151019[_0x3b40('0x43')]){var _0x10c3cb={'messages':[{'source':_0x3b40('0x44'),'to':_0xe43e73[_0x3b40('0x24')],'body':_0xe43e73['body'],'from':_0x151019[_0x3b40('0x40')]||_0x151019['phone']}]};var _0x487ec2=util['format'](_0x3b40('0x45'),_0x151019[_0x3b40('0x34')],_0x151019[_0x3b40('0x43')]);var _0x1e2663={'method':_0x3b40('0x37'),'uri':_0x3b40('0x46'),'body':_0x10c3cb,'headers':{'Authorization':util[_0x3b40('0x47')](_0x3b40('0x48'),new Buffer(_0x487ec2)['toString']('base64'))},'json':!![]};rp(_0x1e2663)[_0x3b40('0x20')](function(_0x1bc9b2){if(_0x1bc9b2[_0x3b40('0x49')]>=0xc8&&_0x1bc9b2[_0x3b40('0x49')]<=0xce){if(_0x1bc9b2[_0x3b40('0x4a')]&&_0x1bc9b2[_0x3b40('0x4a')][_0x3b40('0x4b')]>0x0){var _0x14ca2d=_['head'](_0x1bc9b2[_0x3b40('0x4a')]['messages']);var _0x3672d2={'messageId':_0x14ca2d['message_id']};if(!_0x151019[_0x3b40('0x3c')]){_0x3672d2[_0x3b40('0x3d')]=!![];}return _0x24847e['update'](_0x3672d2);}else{logger[_0x3b40('0x2b')](_0x3b40('0x2c'),'afterCreate',_0x3b40('0x4c'),util[_0x3b40('0x2d')](_0x1bc9b2,{'showHidden':![],'depth':null}));}}else{logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),'clickSend',util[_0x3b40('0x2d')](_0x1bc9b2,{'showHidden':![],'depth':null}));}})[_0x3b40('0x1b')](function(_0x3b337e){logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x4c'),util[_0x3b40('0x2d')](_0x3b337e,{'showHidden':![],'depth':null}));});}else{logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x4c'),_0x3b40('0x3e'));}break;case'plivo':if(_0x151019[_0x3b40('0x4d')]&&_0x151019[_0x3b40('0x25')]){var _0x10c3cb={'dst':_0xe43e73[_0x3b40('0x24')],'text':_0xe43e73[_0x3b40('0xe')],'src':_0x151019[_0x3b40('0x40')]||_0x151019[_0x3b40('0x24')],'url':_0x151019[_0x3b40('0x27')]+_0x3b40('0x28')+_0xe43e73['id']+_0x3b40('0x29')+_0x151019['token']};var _0x487ec2=util[_0x3b40('0x47')]('%s:%s',_0x151019[_0x3b40('0x4d')],_0x151019[_0x3b40('0x25')]);var _0x1e2663={'method':_0x3b40('0x37'),'uri':util[_0x3b40('0x47')](_0x3b40('0x4e'),_0x151019[_0x3b40('0x4d')]),'body':_0x10c3cb,'headers':{'Authorization':util[_0x3b40('0x47')]('Basic\x20%s',new Buffer(_0x487ec2)[_0x3b40('0x4f')](_0x3b40('0x50')))},'json':!![]};rp(_0x1e2663)[_0x3b40('0x20')](function(_0x4e16d0){var _0x958ae0={'messageId':_0x4e16d0['message_uuid'][0x0]};return _0x24847e[_0x3b40('0x19')](_0x958ae0);})[_0x3b40('0x1b')](function(_0x181a21){logger[_0x3b40('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3b40('0x2e'),_0x3b40('0x51'),util['inspect'](_0x181a21,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3b40('0x51'),_0x3b40('0x52'));}break;case'infobip':if(_0x151019[_0x3b40('0x34')]&&_0x151019[_0x3b40('0x43')]){if(_0x151019[_0x3b40('0x53')]){var _0xc172f5={'method':_0x3b40('0x37'),'uri':_0x151019[_0x3b40('0x53')]+_0x3b40('0x54'),'body':{'username':_0x151019[_0x3b40('0x34')],'password':_0x151019[_0x3b40('0x43')]},'json':!![]};return rp(_0xc172f5)[_0x3b40('0x20')](function(_0x184596){var _0x34d8c0={'method':_0x3b40('0x37'),'uri':_0x151019[_0x3b40('0x53')]+_0x3b40('0x55'),'body':{'messages':[{'from':_0x151019[_0x3b40('0x24')],'destinations':[{'to':_0xe43e73['phone']}],'text':_0xe43e73[_0x3b40('0xe')],'notifyUrl':_0x151019[_0x3b40('0x27')]+_0x3b40('0x28')+_0xe43e73['id']+_0x3b40('0x29')+_0x151019[_0x3b40('0x56')],'notifyContentType':'application/json','callbackData':_0x151019['phone']+';'+_0xe43e73[_0x3b40('0xe')]}]},'headers':{'Authorization':_0x3b40('0x57')+_0x184596[_0x3b40('0x56')]},'json':!![]};return rp(_0x34d8c0)[_0x3b40('0x20')](function(_0x116d32){if(_0x116d32[_0x3b40('0x58')]){var _0x4965b6={'messageId':_0x116d32[_0x3b40('0x58')][0x0]['messageId']};if(!_0x151019['deliveryReport']){_0x4965b6[_0x3b40('0x3d')]=!![];}return _0x24847e[_0x3b40('0x19')](_0x4965b6);}else{return logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x59'),util[_0x3b40('0x2d')](_0x116d32,{'showHidden':![],'depth':null}));}});})[_0x3b40('0x1b')](function(_0xf57d6d){return logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x59'),util['inspect'](_0xf57d6d,{'showHidden':![],'depth':null}));});}else{logger[_0x3b40('0x2b')](_0x3b40('0x2c'),'afterCreate','infobip',_0x3b40('0x5a'));}}else{logger[_0x3b40('0x2b')](_0x3b40('0x2c'),'afterCreate',_0x3b40('0x59'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3b40('0x5b'):var _0x4abcf9=require(_0x3b40('0x5c'));if(_0x151019[_0x3b40('0x5d')]){var _0x48350e={};_0x48350e['login']=_0x151019['username'];_0x48350e['phone']=_0xe43e73['phone'];_0x48350e['sender']=_0x151019[_0x3b40('0x24')];_0x48350e[_0x3b40('0x5e')]=_0xe43e73[_0x3b40('0xe')];_0x48350e['timestamp']=+new Date();var _0x32b28e='';var _0x7f6bff='';var _0x2a7421=Object[_0x3b40('0x5f')](_0x48350e);_0x2a7421[_0x3b40('0x60')]();for(var _0x26725e=0x0;_0x26725e<_0x2a7421['length'];_0x26725e++){if(_0x32b28e!=''){_0x32b28e+='&';}_0x32b28e+=_0x2a7421[_0x26725e]+'='+encodeURIComponent(_0x48350e[_0x2a7421[_0x26725e]]);_0x7f6bff+=_0x48350e[_0x2a7421[_0x26725e]];}_0x7f6bff+=_0x151019[_0x3b40('0x5d')];_0x7f6bff=_0x4abcf9[_0x3b40('0x61')](_0x3b40('0x62'))[_0x3b40('0x19')](_0x7f6bff)[_0x3b40('0x63')]('hex');if(_0x32b28e!==''){_0x32b28e+='&';}_0x32b28e+=_0x3b40('0x64')+_0x7f6bff;var _0x58dc7d={'method':_0x3b40('0x35'),'uri':_0x151019[_0x3b40('0x53')]+_0x3b40('0x65')+_0x32b28e,'json':!![]};return rp(_0x58dc7d)[_0x3b40('0x20')](function(_0x605d27){var _0xb016=Object[_0x3b40('0x5f')](_0x605d27);if(_0x605d27[_0xb016[0x0]][_0x3b40('0x2b')]&&parseInt(_0x605d27[_0xb016[0x0]][_0x3b40('0x2b')])===0x0){var _0x10b32e={'messageId':_0x605d27[_0xb016[0x0]][_0x3b40('0x66')]};if(!_0x151019[_0x3b40('0x3c')]){_0x10b32e[_0x3b40('0x3d')]=!![];}return _0x24847e[_0x3b40('0x19')](_0x10b32e);}else{return logger[_0x3b40('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3b40('0x2e'),_0x3b40('0x5b'),util[_0x3b40('0x2d')](_0x605d27[_0x3b40('0x2b')],{'showHidden':![],'depth':null}));}})[_0x3b40('0x1b')](function(_0x5d7dc4){return logger[_0x3b40('0x2b')](_0x3b40('0x2c'),'afterCreate',_0x3b40('0x5b'),util[_0x3b40('0x2d')](_0x5d7dc4,{'showHidden':![],'depth':null}));});}else{logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0x3b40('0x67'):if(_0x151019['apiKey']){var _0x42c0f0={'method':_0x3b40('0x37'),'uri':_0x3b40('0x68'),'headers':{'Authorization':_0x151019[_0x3b40('0x5d')]},'body':{'content':_0xe43e73[_0x3b40('0xe')],'to':[_0xe43e73[_0x3b40('0x24')]],'from':_0x151019['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x3b40('0x69')},'json':!![]};rp(_0x42c0f0)['then'](function(_0x5e6e65){if(!_0x5e6e65[_0x3b40('0x2b')]){var _0x13e3e2={'messageId':_0x5e6e65[_0x3b40('0x58')][0x0][_0x3b40('0x6a')]};if(!_0x151019[_0x3b40('0x3c')]){_0x13e3e2[_0x3b40('0x3d')]=!![];}return _0x24847e['update'](_0x13e3e2);}else{return logger['error'](_0x3b40('0x2c'),'afterCreate','clickatell',util[_0x3b40('0x2d')](_0x5e6e65[_0x3b40('0x2b')],{'showHidden':![],'depth':null}));}})[_0x3b40('0x1b')](function(_0x575c59){return logger[_0x3b40('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3b40('0x2e'),_0x3b40('0x67'),util[_0x3b40('0x2d')](_0x575c59,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x67'),_0x3b40('0x6b'));}break;case _0x3b40('0x6c'):if(_0x151019[_0x3b40('0x34')]&&_0x151019[_0x3b40('0x43')]){var _0x487ec2=util[_0x3b40('0x47')]('%s:%s',_0x151019['username'],_0x151019['password']);var _0x1e2663={'method':_0x3b40('0x37'),'uri':_0x3b40('0x6d')+_0x151019['accountId']+_0x3b40('0x6e'),'body':{'to':[_0xe43e73['phone']],'text':_0xe43e73[_0x3b40('0xe')],'from':_0x151019[_0x3b40('0x24')],'applicationId':_0x151019[_0x3b40('0x6f')]},'headers':{'Authorization':util[_0x3b40('0x47')](_0x3b40('0x48'),new Buffer(_0x487ec2)[_0x3b40('0x4f')](_0x3b40('0x50')))},'json':!![]};rp(_0x1e2663)[_0x3b40('0x20')](function(_0x5ca525){if(_0x5ca525['id']){var _0x5ce3b9={'messageId':_0x5ca525['id']};return _0x24847e[_0x3b40('0x19')](_0x5ce3b9);}else{logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x6c'),util[_0x3b40('0x2d')](_0x5ca525,{'showHidden':![],'depth':null}));}})[_0x3b40('0x1b')](function(_0x3cabc3){logger[_0x3b40('0x2b')](_0x3b40('0x2c'),'afterCreate',_0x3b40('0x6c'),util['inspect'](_0x3cabc3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x6c'),_0x3b40('0x3e'));}break;case'intelepeer':if(_0x151019[_0x3b40('0x5d')]){var _0x422824={};var _0x58dc7d={'method':'POST','uri':_0x3b40('0x70'),'headers':{'Authorization':_0x3b40('0x71')+_0x151019[_0x3b40('0x5d')],'Content-Type':_0x3b40('0x72')},'body':{'from':_0x151019[_0x3b40('0x24')],'to':_0xe43e73[_0x3b40('0x24')],'text':_0xe43e73[_0x3b40('0xe')]},'json':!![]};return rp(_0x58dc7d)[_0x3b40('0x20')](function(_0x27a8da){if(_0x27a8da[_0x3b40('0x73')]==0xca){_0x422824['message']=_0x27a8da;var _0x40870b={'method':_0x3b40('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x151019[_0x3b40('0x5d')],'Content-Type':_0x3b40('0x72')},'body':{'refid':_0x422824['message'][_0x3b40('0x74')]},'json':!![]};return rp(_0x40870b)[_0x3b40('0x20')](function(_0x1091ab){_0x422824[_0x3b40('0x75')]=_0x1091ab;var _0x4706bd={'messageId':_0x422824[_0x3b40('0x76')][_0x3b40('0x74')],'read':!![]};return _0x24847e[_0x3b40('0x19')](_0x4706bd);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3b40('0x2e'),_0x3b40('0x77'),util[_0x3b40('0x2d')](_0x27a8da,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5b4816){return logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x77'),util[_0x3b40('0x2d')](_0x5b4816,{'showHidden':![],'depth':null}));});}else{return logger[_0x3b40('0x2b')](_0x3b40('0x2c'),_0x3b40('0x2e'),_0x3b40('0x77'),_0x3b40('0x78'));}break;}}})['finally'](function(){_0x54bfc6();});}else{_0x54bfc6();}}},'charset':_0x3b40('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x840e=['accountSid','phone','messages','create','body','remote','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','&password=','password','GET','then','split','sms','user_key','session_key','internal_order_id','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','/status?token=','authId','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','deliveryReport','csc','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','update','createdAt','error','secret','SmsAccount','find','type','twilio'];(function(_0x19f44e,_0x31c9a4){var _0x313385=function(_0x2126dd){while(--_0x2126dd){_0x19f44e['push'](_0x19f44e['shift']());}};_0x313385(++_0x31c9a4);}(_0x840e,0xde));var _0xe840=function(_0x3703eb,_0x1c7cde){_0x3703eb=_0x3703eb-0x0;var _0x190bdc=_0x840e[_0x3703eb];return _0x190bdc;};'use strict';var _=require(_0xe840('0x0'));var util=require(_0xe840('0x1'));var logger=require('../../config/logger')(_0xe840('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe840('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe840('0x4'));var attributes=require(_0xe840('0x5'));module[_0xe840('0x6')]=function(_0x172c5d,_0x336895){return _0x172c5d[_0xe840('0x7')](_0xe840('0x8'),attributes,{'tableName':_0xe840('0x9'),'paranoid':![],'indexes':[{'name':_0xe840('0xa'),'fields':[_0xe840('0xa')]},{'name':_0xe840('0xb'),'fields':['body'],'type':_0xe840('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1193be,_0x53eba0,_0x5411dd){var _0x14f01a=_0x172c5d[_0xe840('0xd')];var _0x3bb400=_0x1193be['get']({'plain':!![]});if(_0x3bb400[_0xe840('0xe')][_0xe840('0xf')]()==='in'||_0x3bb400[_0xe840('0xe')]['toLowerCase']()===_0xe840('0x10')&&!_0x3bb400['secret']&&!_[_0xe840('0x11')](_0x3bb400[_0xe840('0x12')])&&!_['isNil'](_0x3bb400[_0xe840('0x13')])){_0x14f01a[_0xe840('0x14')][_0xe840('0x15')]({'where':{'id':_0x3bb400['SmsInteractionId']}})['then'](function(_0x531299){if(_0x531299){_0x531299[_0xe840('0x16')]({'lastMsgAt':_0x3bb400[_0xe840('0x17')],'lastMsgDirection':_0x3bb400['direction']['toLowerCase']()});}})['catch'](function(_0x1fdfce){console[_0xe840('0x18')](_0x1fdfce);});}if(_0x3bb400['direction']===_0xe840('0x10')&&!_0x3bb400[_0xe840('0x19')]){var _0x561937;_0x14f01a[_0xe840('0x1a')][_0xe840('0x1b')]({'where':{'id':_0x3bb400['SmsAccountId']},'raw':!![]})['then'](function(_0x50cbb5){_0x561937=_0x50cbb5;if(_0x561937&&_0x561937[_0xe840('0x1c')]){switch(_0x561937['type']){case _0xe840('0x1d'):var _0x2a1978=require(_0xe840('0x1d'));if(_0x561937[_0xe840('0x1e')]&&_0x561937['authToken']&&_0x561937[_0xe840('0x1f')]){var _0x1e3d05=new _0x2a1978(_0x561937[_0xe840('0x1e')],_0x561937['authToken']);_0x1e3d05[_0xe840('0x20')][_0xe840('0x21')]({'body':_0x3bb400[_0xe840('0x22')],'to':_0x3bb400[_0xe840('0x1f')],'from':_0x561937[_0xe840('0x1f')],'statusCallback':_0x561937[_0xe840('0x23')]+_0xe840('0x24')+_0x3bb400['id']+'/status?token='+_0x561937[_0xe840('0x25')]})['then'](function(_0x5e512d){if(_0x5e512d[_0xe840('0x26')]){return _0x1193be[_0xe840('0x16')]({'messageId':_0x5e512d['sid']});}})[_0xe840('0x27')](function(_0xefa7b2){logger['error'](_0xe840('0x28'),'afterCreate',_0xe840('0x1d'),util['inspect'](_0xefa7b2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x1d'),_0xe840('0x2a'));}break;case _0xe840('0x2b'):var _0x53a778=_0xe840('0x2c');if(_0x561937['username']&&_0x561937['password']){var _0x328f35={'recipient':[_0x3bb400[_0xe840('0x1f')]],'message':_0x3bb400['body'],'message_type':_0x561937[_0xe840('0x2d')]};if(_0x561937[_0xe840('0x2d')]&&_0x561937[_0xe840('0x2d')]!=='SI'){_0x328f35[_0xe840('0x2e')]=_0x561937[_0xe840('0x1f')];}var _0x27e1c5={'url':_0x53a778+_0xe840('0x2f')+_0x561937['username']+_0xe840('0x30')+_0x561937[_0xe840('0x31')],'method':_0xe840('0x32')};rp(_0x27e1c5)[_0xe840('0x33')](function(_0x446131){var _0xcde218=_0x446131[_0xe840('0x34')](';');var _0x3c0b67={'user_key':_0xcde218[0x0],'session_key':_0xcde218[0x1]};_0x27e1c5={'url':_0x53a778+_0xe840('0x35'),'method':'POST','headers':{'user_key':_0x3c0b67[_0xe840('0x36')],'Session_key':_0x3c0b67[_0xe840('0x37')]},'json':!![],'body':_0x328f35};return rp(_0x27e1c5);})[_0xe840('0x33')](function(_0xea22b9){if(_0xea22b9['total_sent']>=0x1){var _0x399412={'messageId':_0xea22b9[_0xe840('0x38')]};if(_0x561937[_0xe840('0x2d')]!=='GP'||!_0x561937['deliveryReport']){_0x399412[_0xe840('0x39')]=!![];}return _0x1193be[_0xe840('0x16')](_0x399412);}else{return logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),'skebby',util[_0xe840('0x3a')](_0xea22b9,{'showHidden':![],'depth':null}));}})[_0xe840('0x27')](function(_0x14388a){return logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x2b'),util['inspect'](_0x14388a,{'showHidden':![],'depth':null}));});}else{logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x2b'),_0xe840('0x3b'));}break;case _0xe840('0x3c'):if(_0x561937[_0xe840('0x3d')]){var _0x8fd3fa={'recipient':_0x3bb400['phone'],'message':_0x3bb400[_0xe840('0x22')],'sender':_0x561937[_0xe840('0x3e')]||_0x561937['phone'],'authorization':_0x561937[_0xe840('0x3d')]};var _0x53eba0={'method':_0xe840('0x3f'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x8fd3fa,'json':!![]};rp(_0x53eba0)[_0xe840('0x33')](function(_0x92ee9b){var _0x384ae6={'messageId':_0x92ee9b[_0xe840('0x40')]};if(!_0x561937['deliveryReport']){_0x384ae6[_0xe840('0x39')]=!![];}return _0x1193be[_0xe840('0x16')](_0x384ae6);})[_0xe840('0x27')](function(_0x4fed9d){logger[_0xe840('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x3c'),util[_0xe840('0x3a')](_0x4fed9d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x3c'),_0xe840('0x41'));}break;case _0xe840('0x42'):if(_0x561937[_0xe840('0x43')]&&_0x561937['password']){var _0x8fd3fa={'messages':[{'source':_0xe840('0x44'),'to':_0x3bb400[_0xe840('0x1f')],'body':_0x3bb400[_0xe840('0x22')],'from':_0x561937['senderString']||_0x561937[_0xe840('0x1f')]}]};var _0x2a5243=util[_0xe840('0x45')](_0xe840('0x46'),_0x561937[_0xe840('0x43')],_0x561937['password']);var _0x53eba0={'method':_0xe840('0x3f'),'uri':_0xe840('0x47'),'body':_0x8fd3fa,'headers':{'Authorization':util[_0xe840('0x45')](_0xe840('0x48'),new Buffer(_0x2a5243)['toString'](_0xe840('0x49')))},'json':!![]};rp(_0x53eba0)['then'](function(_0x484a12){if(_0x484a12[_0xe840('0x4a')]>=0xc8&&_0x484a12[_0xe840('0x4a')]<=0xce){if(_0x484a12['data']&&_0x484a12[_0xe840('0x4b')][_0xe840('0x4c')]>0x0){var _0x49e003=_[_0xe840('0x4d')](_0x484a12[_0xe840('0x4b')]['messages']);var _0x5a2f7e={'messageId':_0x49e003[_0xe840('0x4e')]};if(!_0x561937['deliveryReport']){_0x5a2f7e['read']=!![];}return _0x1193be[_0xe840('0x16')](_0x5a2f7e);}else{logger[_0xe840('0x18')](_0xe840('0x28'),'afterCreate','clickSend',util[_0xe840('0x3a')](_0x484a12,{'showHidden':![],'depth':null}));}}else{logger[_0xe840('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x4f'),util[_0xe840('0x3a')](_0x484a12,{'showHidden':![],'depth':null}));}})[_0xe840('0x27')](function(_0x31d2fe){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x4f'),util[_0xe840('0x3a')](_0x31d2fe,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x4f'),_0xe840('0x3b'));}break;case _0xe840('0x50'):if(_0x561937['authId']&&_0x561937[_0xe840('0x3d')]){var _0x8fd3fa={'dst':_0x3bb400[_0xe840('0x1f')],'text':_0x3bb400[_0xe840('0x22')],'src':_0x561937[_0xe840('0x3e')]||_0x561937[_0xe840('0x1f')],'url':_0x561937[_0xe840('0x23')]+_0xe840('0x24')+_0x3bb400['id']+_0xe840('0x51')+_0x561937['token']};var _0x2a5243=util[_0xe840('0x45')]('%s:%s',_0x561937[_0xe840('0x52')],_0x561937['authToken']);var _0x53eba0={'method':_0xe840('0x3f'),'uri':util[_0xe840('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0x561937[_0xe840('0x52')]),'body':_0x8fd3fa,'headers':{'Authorization':util['format'](_0xe840('0x48'),new Buffer(_0x2a5243)['toString']('base64'))},'json':!![]};rp(_0x53eba0)[_0xe840('0x33')](function(_0x2b6710){var _0x5f9a54={'messageId':_0x2b6710['message_uuid'][0x0]};return _0x1193be[_0xe840('0x16')](_0x5f9a54);})[_0xe840('0x27')](function(_0x3fc657){logger[_0xe840('0x18')](_0xe840('0x28'),'afterCreate',_0xe840('0x50'),util[_0xe840('0x3a')](_0x3fc657,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x50'),_0xe840('0x53'));}break;case _0xe840('0x54'):if(_0x561937['username']&&_0x561937[_0xe840('0x31')]){if(_0x561937[_0xe840('0x55')]){var _0x223253={'method':'POST','uri':_0x561937['baseUrl']+_0xe840('0x56'),'body':{'username':_0x561937['username'],'password':_0x561937[_0xe840('0x31')]},'json':!![]};return rp(_0x223253)[_0xe840('0x33')](function(_0x541f67){var _0x55c017={'method':'POST','uri':_0x561937[_0xe840('0x55')]+_0xe840('0x57'),'body':{'messages':[{'from':_0x561937[_0xe840('0x1f')],'destinations':[{'to':_0x3bb400[_0xe840('0x1f')]}],'text':_0x3bb400[_0xe840('0x22')],'notifyUrl':_0x561937[_0xe840('0x23')]+_0xe840('0x24')+_0x3bb400['id']+_0xe840('0x51')+_0x561937[_0xe840('0x25')],'notifyContentType':_0xe840('0x58'),'callbackData':_0x561937[_0xe840('0x1f')]+';'+_0x3bb400[_0xe840('0x22')]}]},'headers':{'Authorization':_0xe840('0x59')+_0x541f67[_0xe840('0x25')]},'json':!![]};return rp(_0x55c017)[_0xe840('0x33')](function(_0x46f304){if(_0x46f304[_0xe840('0x20')]){var _0x2ec9ea={'messageId':_0x46f304['messages'][0x0]['messageId']};if(!_0x561937[_0xe840('0x5a')]){_0x2ec9ea[_0xe840('0x39')]=!![];}return _0x1193be['update'](_0x2ec9ea);}else{return logger['error'](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x54'),util['inspect'](_0x46f304,{'showHidden':![],'depth':null}));}});})[_0xe840('0x27')](function(_0x52587c){return logger[_0xe840('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x54'),util[_0xe840('0x3a')](_0x52587c,{'showHidden':![],'depth':null}));});}else{logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x54'),_0xe840('0x3b'));}break;case _0xe840('0x5b'):var _0x2f0014=require('crypto');if(_0x561937[_0xe840('0x5c')]){var _0x25b202={};_0x25b202[_0xe840('0x5d')]=_0x561937[_0xe840('0x43')];_0x25b202[_0xe840('0x1f')]=_0x3bb400[_0xe840('0x1f')];_0x25b202[_0xe840('0x2e')]=_0x561937['phone'];_0x25b202[_0xe840('0x5e')]=_0x3bb400['body'];_0x25b202[_0xe840('0x5f')]=+new Date();var _0xf64dca='';var _0x4184b6='';var _0x4dc044=Object[_0xe840('0x60')](_0x25b202);_0x4dc044[_0xe840('0x61')]();for(var _0x50fae3=0x0;_0x50fae3<_0x4dc044[_0xe840('0x62')];_0x50fae3++){if(_0xf64dca!=''){_0xf64dca+='&';}_0xf64dca+=_0x4dc044[_0x50fae3]+'='+encodeURIComponent(_0x25b202[_0x4dc044[_0x50fae3]]);_0x4184b6+=_0x25b202[_0x4dc044[_0x50fae3]];}_0x4184b6+=_0x561937['apiKey'];_0x4184b6=_0x2f0014[_0xe840('0x63')](_0xe840('0x64'))[_0xe840('0x16')](_0x4184b6)[_0xe840('0x65')]('hex');if(_0xf64dca!==''){_0xf64dca+='&';}_0xf64dca+=_0xe840('0x66')+_0x4184b6;var _0x27e1c5={'method':_0xe840('0x32'),'uri':_0x561937[_0xe840('0x55')]+_0xe840('0x67')+_0xf64dca,'json':!![]};return rp(_0x27e1c5)[_0xe840('0x33')](function(_0x4bc504){var _0x2c294e=Object['keys'](_0x4bc504);if(_0x4bc504[_0x2c294e[0x0]]['error']&&parseInt(_0x4bc504[_0x2c294e[0x0]][_0xe840('0x18')])===0x0){var _0xc74ce5={'messageId':_0x4bc504[_0x2c294e[0x0]][_0xe840('0x68')]};if(!_0x561937[_0xe840('0x5a')]){_0xc74ce5['read']=!![];}return _0x1193be[_0xe840('0x16')](_0xc74ce5);}else{return logger[_0xe840('0x18')](_0xe840('0x28'),'afterCreate',_0xe840('0x5b'),util[_0xe840('0x3a')](_0x4bc504[_0xe840('0x18')],{'showHidden':![],'depth':null}));}})[_0xe840('0x27')](function(_0x257537){return logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x5b'),util[_0xe840('0x3a')](_0x257537,{'showHidden':![],'depth':null}));});}else{logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x5b'),_0xe840('0x69'));}break;case _0xe840('0x6a'):if(_0x561937[_0xe840('0x5c')]){var _0x173686={'method':_0xe840('0x3f'),'uri':_0xe840('0x6b'),'headers':{'Authorization':_0x561937[_0xe840('0x5c')]},'body':{'content':_0x3bb400[_0xe840('0x22')],'to':[_0x3bb400[_0xe840('0x1f')]],'from':_0x561937[_0xe840('0x1f')],'binary':![],'clientMessageId':_0xe840('0x6c'),'charset':_0xe840('0x6d')},'json':!![]};rp(_0x173686)['then'](function(_0x140e6d){if(!_0x140e6d['error']){var _0x4f9dbb={'messageId':_0x140e6d[_0xe840('0x20')][0x0][_0xe840('0x6e')]};if(!_0x561937[_0xe840('0x5a')]){_0x4f9dbb[_0xe840('0x39')]=!![];}return _0x1193be['update'](_0x4f9dbb);}else{return logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x6a'),util[_0xe840('0x3a')](_0x140e6d[_0xe840('0x18')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x492707){return logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),'clickatell',util['inspect'](_0x492707,{'showHidden':![],'depth':null}));});}else{logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x6a'),_0xe840('0x69'));}break;case _0xe840('0x6f'):if(_0x561937[_0xe840('0x43')]&&_0x561937['password']){var _0x2a5243=util[_0xe840('0x45')]('%s:%s',_0x561937[_0xe840('0x43')],_0x561937[_0xe840('0x31')]);var _0x53eba0={'method':'POST','uri':_0xe840('0x70')+_0x561937[_0xe840('0x71')]+'/messages','body':{'to':[_0x3bb400['phone']],'text':_0x3bb400['body'],'from':_0x561937[_0xe840('0x1f')],'applicationId':_0x561937[_0xe840('0x72')]},'headers':{'Authorization':util[_0xe840('0x45')](_0xe840('0x48'),new Buffer(_0x2a5243)['toString'](_0xe840('0x49')))},'json':!![]};rp(_0x53eba0)[_0xe840('0x33')](function(_0x21a538){if(_0x21a538['id']){var _0x3235a0={'messageId':_0x21a538['id']};return _0x1193be[_0xe840('0x16')](_0x3235a0);}else{logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),'bandwidth',util[_0xe840('0x3a')](_0x21a538,{'showHidden':![],'depth':null}));}})[_0xe840('0x27')](function(_0x3aa675){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x6f'),util[_0xe840('0x3a')](_0x3aa675,{'showHidden':![],'depth':null}));});}else{logger[_0xe840('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x6f'),_0xe840('0x3b'));}break;case'intelepeer':if(_0x561937[_0xe840('0x5c')]){var _0x3e5c3b={};var _0x27e1c5={'method':_0xe840('0x3f'),'uri':_0xe840('0x73'),'headers':{'Authorization':_0xe840('0x74')+_0x561937[_0xe840('0x5c')],'Content-Type':_0xe840('0x58')},'body':{'from':_0x561937[_0xe840('0x1f')],'to':_0x3bb400[_0xe840('0x1f')],'text':_0x3bb400[_0xe840('0x22')]},'json':!![]};return rp(_0x27e1c5)['then'](function(_0x6ffbf8){if(_0x6ffbf8['code']==0xca){_0x3e5c3b['message']=_0x6ffbf8;var _0x5ad142={'method':_0xe840('0x3f'),'uri':_0xe840('0x75'),'headers':{'Authorization':_0xe840('0x74')+_0x561937[_0xe840('0x5c')],'Content-Type':_0xe840('0x58')},'body':{'refid':_0x3e5c3b['message'][_0xe840('0x76')]},'json':!![]};return rp(_0x5ad142)[_0xe840('0x33')](function(_0x33d2a7){_0x3e5c3b[_0xe840('0x77')]=_0x33d2a7;var _0x98d456={'messageId':_0x3e5c3b[_0xe840('0x78')][_0xe840('0x76')],'read':!![]};return _0x1193be[_0xe840('0x16')](_0x98d456);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x79'),util['inspect'](_0x6ffbf8,{'showHidden':![],'depth':null}));}})[_0xe840('0x27')](function(_0x547b11){return logger[_0xe840('0x18')](_0xe840('0x28'),_0xe840('0x29'),_0xe840('0x79'),util['inspect'](_0x547b11,{'showHidden':![],'depth':null}));});}else{return logger[_0xe840('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe840('0x29'),_0xe840('0x79'),_0xe840('0x7a'));}break;}}})[_0xe840('0x7b')](function(){_0x5411dd();});}else{_0x5411dd();}}},'charset':_0xe840('0x7c'),'collate':_0xe840('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index afe4e40..5d5508f 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 _0x9ef0=['options','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x156006,_0x591a15){var _0x18237f=function(_0x58d1db){while(--_0x58d1db){_0x156006['push'](_0x156006['shift']());}};_0x18237f(++_0x591a15);}(_0x9ef0,0xda));var _0x09ef=function(_0x3f1ab4,_0x3752a7){_0x3f1ab4=_0x3f1ab4-0x0;var _0x3c2565=_0x9ef0[_0x3f1ab4];return _0x3c2565;};'use strict';var _=require('lodash');var util=require(_0x09ef('0x0'));var moment=require(_0x09ef('0x1'));var BPromise=require(_0x09ef('0x2'));var rs=require(_0x09ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09ef('0x4'))['db'];var utils=require(_0x09ef('0x5'));var logger=require('../../config/logger')(_0x09ef('0x6'));var config=require(_0x09ef('0x7'));var jayson=require(_0x09ef('0x8'));var client=jayson[_0x09ef('0x9')][_0x09ef('0xa')]({'port':0x232a});config[_0x09ef('0xb')]=_[_0x09ef('0xc')](config[_0x09ef('0xb')],{'host':_0x09ef('0xd'),'port':0x18eb});var socket=require(_0x09ef('0xe'))(new Redis(config[_0x09ef('0xb')]));require(_0x09ef('0xf'))[_0x09ef('0x10')](socket);function respondWithRpcPromise(_0x588942,_0x3ae77a,_0x16365a){return new BPromise(function(_0x55329d,_0x13b965){return client[_0x09ef('0x11')](_0x588942,_0x16365a)[_0x09ef('0x12')](function(_0x435a68){logger[_0x09ef('0x13')](_0x09ef('0x14'),_0x3ae77a,_0x09ef('0x15'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ae77a,'request\x20sent',JSON[_0x09ef('0x16')](_0x435a68));if(_0x435a68[_0x09ef('0x17')]){if(_0x435a68['error']['code']===0x1f4){logger[_0x09ef('0x17')](_0x09ef('0x14'),_0x3ae77a,_0x435a68['error']['message']);return _0x13b965(_0x435a68[_0x09ef('0x17')][_0x09ef('0x18')]);}logger[_0x09ef('0x17')](_0x09ef('0x14'),_0x3ae77a,_0x435a68['error']['message']);return _0x55329d(_0x435a68[_0x09ef('0x17')]['message']);}else{logger[_0x09ef('0x13')]('SmsMessage,\x20%s,\x20%s',_0x3ae77a,_0x09ef('0x15'));_0x55329d(_0x435a68[_0x09ef('0x19')][_0x09ef('0x18')]);}})[_0x09ef('0x1a')](function(_0x107a1a){logger['error'](_0x09ef('0x14'),_0x3ae77a,_0x107a1a);_0x13b965(_0x107a1a);});});}exports[_0x09ef('0x1b')]=function(_0x416514){var _0x18e6b7=this;return new Promise(function(_0x38a2b3,_0x2e142a){return db[_0x09ef('0x1c')][_0x09ef('0x1d')](_0x416514['body'],{'raw':_0x416514[_0x09ef('0x1e')]?_0x416514[_0x09ef('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x09ef('0x12')](function(_0x29b0e7){logger[_0x09ef('0x13')](_0x09ef('0x1b'),_0x416514);logger['debug'](_0x09ef('0x1b'),_0x416514,JSON[_0x09ef('0x16')](_0x29b0e7));_0x38a2b3(_0x29b0e7);})[_0x09ef('0x1a')](function(_0x267b24){logger[_0x09ef('0x17')](_0x09ef('0x1b'),_0x267b24[_0x09ef('0x18')],_0x416514);_0x2e142a(_0x18e6b7[_0x09ef('0x17')](0x1f4,_0x267b24[_0x09ef('0x18')]));});});}; \ No newline at end of file +var _0x2970=['defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsMessage,\x20%s,\x20%s','request\x20sent','result','catch','CreateSmsMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis'];(function(_0x2e924e,_0x21ff80){var _0x543e8f=function(_0x2c78b2){while(--_0x2c78b2){_0x2e924e['push'](_0x2e924e['shift']());}};_0x543e8f(++_0x21ff80);}(_0x2970,0x13e));var _0x0297=function(_0x56d0b2,_0x2f7c9e){_0x56d0b2=_0x56d0b2-0x0;var _0x37e421=_0x2970[_0x56d0b2];return _0x37e421;};'use strict';var _=require(_0x0297('0x0'));var util=require(_0x0297('0x1'));var moment=require('moment');var BPromise=require(_0x0297('0x2'));var rs=require(_0x0297('0x3'));var fs=require('fs');var Redis=require(_0x0297('0x4'));var db=require(_0x0297('0x5'))['db'];var utils=require(_0x0297('0x6'));var logger=require(_0x0297('0x7'))('rpc');var config=require(_0x0297('0x8'));var jayson=require(_0x0297('0x9'));var client=jayson[_0x0297('0xa')]['http']({'port':0x232a});config[_0x0297('0xb')]=_[_0x0297('0xc')](config['redis'],{'host':_0x0297('0xd'),'port':0x18eb});var socket=require(_0x0297('0xe'))(new Redis(config[_0x0297('0xb')]));require(_0x0297('0xf'))['register'](socket);function respondWithRpcPromise(_0x3eeb25,_0x2fbee9,_0x3bb734){return new BPromise(function(_0x8f5e1,_0x45465f){return client[_0x0297('0x10')](_0x3eeb25,_0x3bb734)[_0x0297('0x11')](function(_0x5058f8){logger[_0x0297('0x12')]('SmsMessage,\x20%s,\x20%s',_0x2fbee9,'request\x20sent');logger[_0x0297('0x13')](_0x0297('0x14'),_0x2fbee9,'request\x20sent',JSON[_0x0297('0x15')](_0x5058f8));if(_0x5058f8[_0x0297('0x16')]){if(_0x5058f8[_0x0297('0x16')]['code']===0x1f4){logger[_0x0297('0x16')]('SmsMessage,\x20%s,\x20%s',_0x2fbee9,_0x5058f8['error']['message']);return _0x45465f(_0x5058f8[_0x0297('0x16')][_0x0297('0x17')]);}logger['error'](_0x0297('0x18'),_0x2fbee9,_0x5058f8['error']['message']);return _0x8f5e1(_0x5058f8[_0x0297('0x16')][_0x0297('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x2fbee9,_0x0297('0x19'));_0x8f5e1(_0x5058f8[_0x0297('0x1a')]['message']);}})[_0x0297('0x1b')](function(_0x217af9){logger[_0x0297('0x16')](_0x0297('0x18'),_0x2fbee9,_0x217af9);_0x45465f(_0x217af9);});});}exports[_0x0297('0x1c')]=function(_0x3ff9f7){var _0x4a5435=this;return new Promise(function(_0x302f47,_0x2757a8){return db['SmsMessage'][_0x0297('0x1d')](_0x3ff9f7[_0x0297('0x1e')],{'raw':_0x3ff9f7[_0x0297('0x1f')]?_0x3ff9f7[_0x0297('0x1f')][_0x0297('0x20')]===undefined?!![]:![]:!![]})[_0x0297('0x11')](function(_0x407e13){logger['info'](_0x0297('0x1c'),_0x3ff9f7);logger[_0x0297('0x13')]('CreateSmsMessage',_0x3ff9f7,JSON['stringify'](_0x407e13));_0x302f47(_0x407e13);})[_0x0297('0x1b')](function(_0xa82bfb){logger[_0x0297('0x16')](_0x0297('0x1c'),_0xa82bfb[_0x0297('0x17')],_0x3ff9f7);_0x2757a8(_0x4a5435['error'](0x1f4,_0xa82bfb['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 2e7e89d..ed7c978 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 _0xab69=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0xab69,0x75));var _0x9ab6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xab69[_0x2c91e9];return _0x13f0ff;};'use strict';var SmsMessageEvents=require(_0x9ab6('0x0'));var events=[_0x9ab6('0x1'),_0x9ab6('0x2'),'update'];function createListener(_0x3d6911,_0x4726ba){return function(_0x3303c5){_0x4726ba[_0x9ab6('0x3')](_0x3d6911,_0x3303c5);};}function removeListener(_0x5b2448,_0x164d1b){return function(){SmsMessageEvents[_0x9ab6('0x4')](_0x5b2448,_0x164d1b);};}exports[_0x9ab6('0x5')]=function(_0x3e1547){for(var _0x1c2cc7=0x0,_0x3f16d5=events[_0x9ab6('0x6')];_0x1c2cc7<_0x3f16d5;_0x1c2cc7++){var _0x184e58=events[_0x1c2cc7];var _0x4e7bc0=createListener(_0x9ab6('0x7')+_0x184e58,_0x3e1547);SmsMessageEvents['on'](_0x184e58,_0x4e7bc0);}}; \ No newline at end of file +var _0xbf8d=['save','remove','update','emit','register','length','smsMessage:','./smsMessage.events'];(function(_0xadd31d,_0x13cf50){var _0x24e526=function(_0x31cd8c){while(--_0x31cd8c){_0xadd31d['push'](_0xadd31d['shift']());}};_0x24e526(++_0x13cf50);}(_0xbf8d,0xb7));var _0xdbf8=function(_0x27442d,_0x3a3df2){_0x27442d=_0x27442d-0x0;var _0x43e32f=_0xbf8d[_0x27442d];return _0x43e32f;};'use strict';var SmsMessageEvents=require(_0xdbf8('0x0'));var events=[_0xdbf8('0x1'),_0xdbf8('0x2'),_0xdbf8('0x3')];function createListener(_0x5c43a4,_0x2fb918){return function(_0x14f11f){_0x2fb918[_0xdbf8('0x4')](_0x5c43a4,_0x14f11f);};}function removeListener(_0x14d59f,_0x1b96b3){return function(){SmsMessageEvents['removeListener'](_0x14d59f,_0x1b96b3);};}exports[_0xdbf8('0x5')]=function(_0x18d322){for(var _0x2eed92=0x0,_0x1d1620=events[_0xdbf8('0x6')];_0x2eed92<_0x1d1620;_0x2eed92++){var _0x1e5f63=events[_0x2eed92];var _0x4b4b5c=createListener(_0xdbf8('0x7')+_0x1e5f63,_0x18d322);SmsMessageEvents['on'](_0x1e5f63,_0x4b4b5c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5b68586..b350bbe 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 _0xf92f=['/:id/users','put','/:id','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id/teams','getTeams','getAgents','create','post','addTeams'];(function(_0x25c1b6,_0x15e7ee){var _0x252d58=function(_0xfb970d){while(--_0xfb970d){_0x25c1b6['push'](_0x25c1b6['shift']());}};_0x252d58(++_0x15e7ee);}(_0xf92f,0x6a));var _0xff92=function(_0x37c1d4,_0x4d142c){_0x37c1d4=_0x37c1d4-0x0;var _0x1bb9b4=_0xf92f[_0x37c1d4];return _0x1bb9b4;};'use strict';var multer=require(_0xff92('0x0'));var util=require(_0xff92('0x1'));var path=require(_0xff92('0x2'));var timeout=require(_0xff92('0x3'));var express=require(_0xff92('0x4'));var router=express[_0xff92('0x5')]();var fs_extra=require(_0xff92('0x6'));var auth=require(_0xff92('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xff92('0x8'));var controller=require(_0xff92('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xff92('0xa')]('/describe',auth[_0xff92('0xb')](),controller[_0xff92('0xc')]);router[_0xff92('0xa')]('/:id',auth[_0xff92('0xb')](),controller['show']);router['get']('/:id/members',auth[_0xff92('0xb')](),controller['getMembers']);router[_0xff92('0xa')](_0xff92('0xd'),auth[_0xff92('0xb')](),controller[_0xff92('0xe')]);router[_0xff92('0xa')]('/:id/users',auth[_0xff92('0xb')](),controller[_0xff92('0xf')]);router['post']('/',auth[_0xff92('0xb')](),controller[_0xff92('0x10')]);router[_0xff92('0x11')](_0xff92('0xd'),auth[_0xff92('0xb')](),controller[_0xff92('0x12')]);router['post'](_0xff92('0x13'),auth[_0xff92('0xb')](),controller['addAgents']);router[_0xff92('0x14')](_0xff92('0x15'),auth[_0xff92('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xff92('0x16')](_0xff92('0xd'),auth[_0xff92('0xb')](),controller[_0xff92('0x17')]);router[_0xff92('0x16')](_0xff92('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xff92('0x18')]=router; \ No newline at end of file +var _0x713d=['get','index','/describe','isAuthenticated','describe','/:id','getMembers','getTeams','getAgents','post','create','addAgents','update','delete','/:id/teams','removeTeams','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x5b21eb,_0x540b6d){var _0x279c63=function(_0x21a9a0){while(--_0x21a9a0){_0x5b21eb['push'](_0x5b21eb['shift']());}};_0x279c63(++_0x540b6d);}(_0x713d,0x16f));var _0xd713=function(_0x55a6aa,_0x2867c6){_0x55a6aa=_0x55a6aa-0x0;var _0x4fb57f=_0x713d[_0x55a6aa];return _0x4fb57f;};'use strict';var multer=require('multer');var util=require(_0xd713('0x0'));var path=require(_0xd713('0x1'));var timeout=require(_0xd713('0x2'));var express=require(_0xd713('0x3'));var router=express[_0xd713('0x4')]();var fs_extra=require(_0xd713('0x5'));var auth=require(_0xd713('0x6'));var interaction=require(_0xd713('0x7'));var config=require(_0xd713('0x8'));var controller=require(_0xd713('0x9'));router[_0xd713('0xa')]('/',auth['isAuthenticated'](),controller[_0xd713('0xb')]);router[_0xd713('0xa')](_0xd713('0xc'),auth[_0xd713('0xd')](),controller[_0xd713('0xe')]);router[_0xd713('0xa')](_0xd713('0xf'),auth[_0xd713('0xd')](),controller['show']);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xd713('0x10')]);router[_0xd713('0xa')]('/:id/teams',auth[_0xd713('0xd')](),controller[_0xd713('0x11')]);router[_0xd713('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xd713('0x12')]);router[_0xd713('0x13')]('/',auth['isAuthenticated'](),controller[_0xd713('0x14')]);router[_0xd713('0x13')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xd713('0xd')](),controller[_0xd713('0x15')]);router['put'](_0xd713('0xf'),auth['isAuthenticated'](),controller[_0xd713('0x16')]);router[_0xd713('0x17')](_0xd713('0xf'),auth[_0xd713('0xd')](),controller['destroy']);router[_0xd713('0x17')](_0xd713('0x18'),auth[_0xd713('0xd')](),controller[_0xd713('0x19')]);router['delete'](_0xd713('0x1a'),auth[_0xd713('0xd')](),controller[_0xd713('0x1b')]);module[_0xd713('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 38751de..9f25e10 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 _0x7f4f=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x35cf09,_0x5e86eb){var _0x3063f8=function(_0x55187a){while(--_0x55187a){_0x35cf09['push'](_0x35cf09['shift']());}};_0x3063f8(++_0x5e86eb);}(_0x7f4f,0xfd));var _0xf7f4=function(_0x1967dc,_0x2b8fbe){_0x1967dc=_0x1967dc-0x0;var _0x220571=_0x7f4f[_0x1967dc];return _0x220571;};'use strict';var Sequelize=require(_0xf7f4('0x0'));module[_0xf7f4('0x1')]={'name':{'type':Sequelize[_0xf7f4('0x2')],'unique':_0xf7f4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf7f4('0x2')]},'timeout':{'type':Sequelize[_0xf7f4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf7f4('0x5'),_0xf7f4('0x6'),_0xf7f4('0x7'))}}; \ No newline at end of file +var _0x131e=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x12753e,_0x354fc9){var _0x5ead42=function(_0x290302){while(--_0x290302){_0x12753e['push'](_0x12753e['shift']());}};_0x5ead42(++_0x354fc9);}(_0x131e,0x1da));var _0xe131=function(_0xad75fe,_0x47a786){_0xad75fe=_0xad75fe-0x0;var _0x4cdd31=_0x131e[_0xad75fe];return _0x4cdd31;};'use strict';var Sequelize=require(_0xe131('0x0'));module[_0xe131('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe131('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe131('0x3')]},'timeout':{'type':Sequelize[_0xe131('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe131('0x5')](_0xe131('0x6'),_0xe131('0x7'),_0xe131('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0d60a40..4b1af8a 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 _0x0344=['smsPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Team','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','SmsQueues','UserProfileResource','stack','name','send','index','map','SmsQueue','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','error','describe','getMembers','findOne','UserSmsQueue','order','pick','SmsQueueId','User','findAndCountAll','UserId','agent'];(function(_0x360e5c,_0x1d60de){var _0x3629ea=function(_0x3f12b6){while(--_0x3f12b6){_0x360e5c['push'](_0x360e5c['shift']());}};_0x3629ea(++_0x1d60de);}(_0x0344,0x14b));var _0x4034=function(_0x5909d9,_0x51c8fe){_0x5909d9=_0x5909d9-0x0;var _0x4697cb=_0x0344[_0x5909d9];return _0x4697cb;};'use strict';var emlformat=require(_0x4034('0x0'));var rimraf=require(_0x4034('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4034('0x2'));var rp=require(_0x4034('0x3'));var moment=require(_0x4034('0x4'));var BPromise=require(_0x4034('0x5'));var Mustache=require('mustache');var util=require(_0x4034('0x6'));var path=require('path');var sox=require(_0x4034('0x7'));var csv=require(_0x4034('0x8'));var ejs=require(_0x4034('0x9'));var fs=require('fs');var fs_extra=require(_0x4034('0xa'));var _=require(_0x4034('0xb'));var squel=require(_0x4034('0xc'));var crypto=require('crypto');var jsforce=require(_0x4034('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4034('0x8'));var querystring=require(_0x4034('0xe'));var Papa=require(_0x4034('0xf'));var Redis=require(_0x4034('0x10'));var authService=require(_0x4034('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4034('0x12'));var hardwareService=require(_0x4034('0x13'));var logger=require(_0x4034('0x14'))(_0x4034('0x15'));var utils=require(_0x4034('0x16'));var config=require(_0x4034('0x17'));var licenseUtil=require(_0x4034('0x18'));var db=require(_0x4034('0x19'))['db'];config[_0x4034('0x1a')]=_[_0x4034('0x1b')](config[_0x4034('0x1a')],{'host':_0x4034('0x1c'),'port':0x18eb});var socket=require(_0x4034('0x1d'))(new Redis(config[_0x4034('0x1a')]));require(_0x4034('0x1e'))[_0x4034('0x1f')](socket);function respondWithStatusCode(_0xd0d7c5,_0x24262e){_0x24262e=_0x24262e||0xcc;return function(_0x2ba558){if(_0x2ba558){return _0xd0d7c5[_0x4034('0x20')](_0x24262e);}return _0xd0d7c5['status'](_0x24262e)['end']();};}function respondWithResult(_0x1feeb2,_0xdc75b4){_0xdc75b4=_0xdc75b4||0xc8;return function(_0x152ece){if(_0x152ece){return _0x1feeb2[_0x4034('0x21')](_0xdc75b4)['json'](_0x152ece);}};}function respondWithFilteredResult(_0x18e70d,_0x1f1517){return function(_0x9b479b){if(_0x9b479b){var _0x35d057=typeof _0x1f1517['offset']===_0x4034('0x22')&&typeof _0x1f1517[_0x4034('0x23')]===_0x4034('0x22');var _0x546c63=_0x9b479b['count'];var _0x1164ad=_0x35d057?0x0:_0x1f1517[_0x4034('0x24')];var _0xc59ed8=_0x35d057?_0x9b479b[_0x4034('0x25')]:_0x1f1517[_0x4034('0x24')]+_0x1f1517[_0x4034('0x23')];var _0x3e2d14;if(_0xc59ed8>=_0x546c63){_0xc59ed8=_0x546c63;_0x3e2d14=0xc8;}else{_0x3e2d14=0xce;}_0x18e70d[_0x4034('0x21')](_0x3e2d14);return _0x18e70d[_0x4034('0x26')](_0x4034('0x27'),_0x1164ad+'-'+_0xc59ed8+'/'+_0x546c63)[_0x4034('0x28')](_0x9b479b);}return null;};}function patchUpdates(_0x2cd6f5){return function(_0xdb4ae8){try{jsonpatch[_0x4034('0x29')](_0xdb4ae8,_0x2cd6f5,!![]);}catch(_0x53c85a){return BPromise[_0x4034('0x2a')](_0x53c85a);}return _0xdb4ae8['save']();};}function saveUpdates(_0x56f72b,_0x10c83e){return function(_0x101812){if(_0x101812){return _0x101812[_0x4034('0x2b')](_0x56f72b)[_0x4034('0x2c')](function(_0x19dcf7){return _0x19dcf7;});}return null;};}function removeEntity(_0x49b7e6,_0xba421a){return function(_0x599b31){if(_0x599b31){return _0x599b31[_0x4034('0x2d')]()[_0x4034('0x2c')](function(){var _0x1f23b1=_0x599b31['get']({'plain':!![]});var _0x136cc9=_0x4034('0x2e');return db[_0x4034('0x2f')]['destroy']({'where':{'type':_0x136cc9,'resourceId':_0x1f23b1['id']}})[_0x4034('0x2c')](function(){return _0x599b31;});})[_0x4034('0x2c')](function(){_0x49b7e6[_0x4034('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ba21,_0x35edc5){return function(_0x174a8c){if(!_0x174a8c){_0x55ba21[_0x4034('0x20')](0x194);}return _0x174a8c;};}function handleError(_0x5e3902,_0x3fa1df){_0x3fa1df=_0x3fa1df||0x1f4;return function(_0x239191){logger['error'](_0x239191[_0x4034('0x30')]);if(_0x239191[_0x4034('0x31')]){delete _0x239191[_0x4034('0x31')];}_0x5e3902[_0x4034('0x21')](_0x3fa1df)[_0x4034('0x32')](_0x239191);};}exports[_0x4034('0x33')]=function(_0x55336b,_0x19d09e){var _0x37dc31={},_0x3eb6c6={},_0x599da3={'count':0x0,'rows':[]};var _0x59b2fe=_[_0x4034('0x34')](db[_0x4034('0x35')]['rawAttributes'],function(_0x224215){return{'name':_0x224215[_0x4034('0x36')],'type':_0x224215[_0x4034('0x37')]['key']};});_0x3eb6c6[_0x4034('0x38')]=_[_0x4034('0x34')](_0x59b2fe,_0x4034('0x31'));_0x3eb6c6['query']=_[_0x4034('0x39')](_0x55336b['query']);_0x3eb6c6[_0x4034('0x3a')]=_[_0x4034('0x3b')](_0x3eb6c6[_0x4034('0x38')],_0x3eb6c6[_0x4034('0x3c')]);_0x37dc31[_0x4034('0x3d')]=_[_0x4034('0x3b')](_0x3eb6c6[_0x4034('0x38')],qs['fields'](_0x55336b['query'][_0x4034('0x3e')]));_0x37dc31[_0x4034('0x3d')]=_0x37dc31[_0x4034('0x3d')][_0x4034('0x3f')]?_0x37dc31[_0x4034('0x3d')]:_0x3eb6c6[_0x4034('0x38')];if(!_0x55336b[_0x4034('0x3c')][_0x4034('0x40')](_0x4034('0x41'))){_0x37dc31[_0x4034('0x23')]=qs[_0x4034('0x23')](_0x55336b[_0x4034('0x3c')][_0x4034('0x23')]);_0x37dc31['offset']=qs['offset'](_0x55336b['query'][_0x4034('0x24')]);}_0x37dc31['order']=qs[_0x4034('0x42')](_0x55336b[_0x4034('0x3c')][_0x4034('0x42')]);_0x37dc31[_0x4034('0x43')]=qs[_0x4034('0x3a')](_['pick'](_0x55336b[_0x4034('0x3c')],_0x3eb6c6[_0x4034('0x3a')]),_0x59b2fe);if(_0x55336b[_0x4034('0x3c')][_0x4034('0x44')]){_0x37dc31[_0x4034('0x43')]=_[_0x4034('0x45')](_0x37dc31[_0x4034('0x43')],{'$or':_[_0x4034('0x34')](_0x59b2fe,function(_0x20b319){if(_0x20b319[_0x4034('0x37')]!==_0x4034('0x46')){var _0x27f75a={};_0x27f75a[_0x20b319[_0x4034('0x31')]]={'$like':'%'+_0x55336b[_0x4034('0x3c')][_0x4034('0x44')]+'%'};return _0x27f75a;}})});}_0x37dc31=_['merge']({},_0x37dc31,_0x55336b[_0x4034('0x47')]);var _0x4f404b={'where':_0x37dc31[_0x4034('0x43')]};return db[_0x4034('0x35')][_0x4034('0x25')](_0x4f404b)['then'](function(_0x3e17ec){_0x599da3[_0x4034('0x25')]=_0x3e17ec;if(_0x55336b['query'][_0x4034('0x48')]){_0x37dc31[_0x4034('0x49')]=[{'all':!![]}];}return db[_0x4034('0x35')][_0x4034('0x4a')](_0x37dc31);})[_0x4034('0x2c')](function(_0xa59bb1){_0x599da3['rows']=_0xa59bb1;return _0x599da3;})[_0x4034('0x2c')](respondWithFilteredResult(_0x19d09e,_0x37dc31))[_0x4034('0x4b')](handleError(_0x19d09e,null));};exports[_0x4034('0x4c')]=function(_0x1ade2e,_0x32b90){var _0x42c776={'raw':!![],'where':{'id':_0x1ade2e[_0x4034('0x4d')]['id']}},_0x15bd97={};_0x15bd97[_0x4034('0x38')]=_[_0x4034('0x39')](db[_0x4034('0x35')][_0x4034('0x4e')]);_0x15bd97[_0x4034('0x3c')]=_[_0x4034('0x39')](_0x1ade2e[_0x4034('0x3c')]);_0x15bd97['filters']=_[_0x4034('0x3b')](_0x15bd97[_0x4034('0x38')],_0x15bd97[_0x4034('0x3c')]);_0x42c776[_0x4034('0x3d')]=_[_0x4034('0x3b')](_0x15bd97[_0x4034('0x38')],qs[_0x4034('0x3e')](_0x1ade2e['query'][_0x4034('0x3e')]));_0x42c776[_0x4034('0x3d')]=_0x42c776[_0x4034('0x3d')]['length']?_0x42c776[_0x4034('0x3d')]:_0x15bd97[_0x4034('0x38')];if(_0x1ade2e[_0x4034('0x3c')]['includeAll']){_0x42c776['include']=[{'all':!![]}];}_0x42c776=_[_0x4034('0x45')]({},_0x42c776,_0x1ade2e['options']);return db['SmsQueue']['find'](_0x42c776)[_0x4034('0x2c')](handleEntityNotFound(_0x32b90,null))[_0x4034('0x2c')](respondWithResult(_0x32b90,null))[_0x4034('0x4b')](handleError(_0x32b90,null));};exports[_0x4034('0x4f')]=function(_0x3a59a8,_0x34ce2b){return db[_0x4034('0x35')][_0x4034('0x4f')](_0x3a59a8[_0x4034('0x50')],{})[_0x4034('0x2c')](function(_0x568a15){var _0x3e8706=_0x3a59a8[_0x4034('0x51')]['get']({'plain':!![]});if(!_0x3e8706)throw new Error(_0x4034('0x52'));if(_0x3e8706['role']===_0x4034('0x51')){var _0x537079=_0x568a15[_0x4034('0x53')]({'plain':!![]});var _0x4124c3='SmsQueues';return db[_0x4034('0x54')][_0x4034('0x55')]({'where':{'name':_0x4124c3,'userProfileId':_0x3e8706['userProfileId']},'raw':!![]})[_0x4034('0x2c')](function(_0x4e50b0){if(_0x4e50b0&&_0x4e50b0['autoAssociation']===0x0){return db[_0x4034('0x2f')]['create']({'name':_0x537079[_0x4034('0x31')],'resourceId':_0x537079['id'],'type':_0x4e50b0[_0x4034('0x31')],'sectionId':_0x4e50b0['id']},{})[_0x4034('0x2c')](function(){return _0x568a15;});}else{return _0x568a15;}})[_0x4034('0x4b')](function(_0x521dea){logger[_0x4034('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x521dea);throw _0x521dea;});}return _0x568a15;})[_0x4034('0x2c')](respondWithResult(_0x34ce2b,0xc9))[_0x4034('0x4b')](handleError(_0x34ce2b,null));};exports[_0x4034('0x2b')]=function(_0x1a5062,_0x309319){if(_0x1a5062['body']['id']){delete _0x1a5062[_0x4034('0x50')]['id'];}return db[_0x4034('0x35')][_0x4034('0x55')]({'where':{'id':_0x1a5062[_0x4034('0x4d')]['id']}})[_0x4034('0x2c')](handleEntityNotFound(_0x309319,null))[_0x4034('0x2c')](saveUpdates(_0x1a5062['body'],null))[_0x4034('0x2c')](respondWithResult(_0x309319,null))['catch'](handleError(_0x309319,null));};exports[_0x4034('0x2d')]=function(_0x4810f2,_0x2963dd){return db[_0x4034('0x35')][_0x4034('0x55')]({'where':{'id':_0x4810f2[_0x4034('0x4d')]['id']}})[_0x4034('0x2c')](handleEntityNotFound(_0x2963dd,null))[_0x4034('0x2c')](removeEntity(_0x2963dd,null))['catch'](handleError(_0x2963dd,null));};exports['describe']=function(_0x4cae0e,_0x5a3995){return db[_0x4034('0x35')][_0x4034('0x57')]()['then'](respondWithResult(_0x5a3995,null))[_0x4034('0x4b')](handleError(_0x5a3995,null));};exports[_0x4034('0x58')]=function(_0x246fee,_0x1f66ae,_0x2e738b){var _0x231c38={'raw':!![],'where':{}},_0x1cc3de={},_0x45f36e;return db[_0x4034('0x35')][_0x4034('0x59')]({'where':{'id':_0x246fee[_0x4034('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f66ae,null))[_0x4034('0x2c')](function(_0x49b217){if(_0x49b217){_0x45f36e=_0x49b217[_0x4034('0x53')]({'plain':!![]});_0x1cc3de[_0x4034('0x38')]=_[_0x4034('0x39')](db[_0x4034('0x5a')]['rawAttributes']);_0x1cc3de['query']=_[_0x4034('0x39')](_0x246fee[_0x4034('0x3c')]);_0x1cc3de[_0x4034('0x3a')]=_[_0x4034('0x3b')](_0x1cc3de[_0x4034('0x38')],_0x1cc3de['query']);_0x231c38[_0x4034('0x3d')]=_[_0x4034('0x3b')](_0x1cc3de[_0x4034('0x38')],qs[_0x4034('0x3e')](_0x246fee['query'][_0x4034('0x3e')]));_0x231c38['attributes']=_0x231c38['attributes'][_0x4034('0x3f')]?_0x231c38[_0x4034('0x3d')]:_0x1cc3de[_0x4034('0x38')];if(!_0x246fee[_0x4034('0x3c')][_0x4034('0x40')](_0x4034('0x41'))){_0x231c38['limit']=qs[_0x4034('0x23')](_0x246fee[_0x4034('0x3c')][_0x4034('0x23')]);_0x231c38[_0x4034('0x24')]=qs[_0x4034('0x24')](_0x246fee[_0x4034('0x3c')]['offset']);}_0x231c38[_0x4034('0x5b')]=qs[_0x4034('0x42')](_0x246fee[_0x4034('0x3c')][_0x4034('0x42')]);_0x231c38[_0x4034('0x43')]=qs[_0x4034('0x3a')](_[_0x4034('0x5c')](_0x246fee[_0x4034('0x3c')],_0x1cc3de['filters']));_0x231c38[_0x4034('0x43')][_0x4034('0x5d')]=_0x49b217['id'];if(_0x246fee['query'][_0x4034('0x44')]){_0x231c38[_0x4034('0x43')]=_['merge'](_0x231c38[_0x4034('0x43')],{'$or':_[_0x4034('0x34')](_0x231c38[_0x4034('0x3d')],function(_0xe59843){var _0x493b7a={};_0x493b7a[_0xe59843]={'$like':'%'+_0x246fee[_0x4034('0x3c')][_0x4034('0x44')]+'%'};return _0x493b7a;})});}_0x231c38=_[_0x4034('0x45')]({},_0x231c38,_0x246fee[_0x4034('0x47')]);return db[_0x4034('0x5a')][_0x4034('0x4a')](_0x231c38);}})[_0x4034('0x2c')](function(_0x58279c){if(_0x58279c){return db[_0x4034('0x5e')][_0x4034('0x5f')]({'where':{'id':_[_0x4034('0x34')](_0x58279c,_0x4034('0x60')),'role':_0x4034('0x61')},'attributes':['id','name',_0x4034('0x62'),_0x4034('0x63'),_0x4034('0x64')]});}})[_0x4034('0x2c')](function(_0x44ae6d){if(_0x44ae6d){return{'count':_0x44ae6d[_0x4034('0x25')],'rows':_[_0x4034('0x34')](_0x44ae6d['rows'],function(_0x5b63e9){return{'membername':_0x5b63e9[_0x4034('0x31')],'UserId':_0x5b63e9['id'],'queue_name':_0x45f36e[_0x4034('0x31')],'SmsQueueId':_0x45f36e['id'],'interface':util[_0x4034('0x65')]('%s/%s',_0x4034('0x66'),_0x5b63e9[_0x4034('0x31')]),'penalty':0x0,'paused':_0x5b63e9[_0x4034('0x62')],'createdAt':_0x5b63e9[_0x4034('0x64')],'updatedAt':_0x5b63e9[_0x4034('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4034('0x2c')](respondWithFilteredResult(_0x1f66ae,_0x231c38))[_0x4034('0x4b')](handleError(_0x1f66ae,null));};exports[_0x4034('0x67')]=function(_0x54d887,_0x162d19,_0x4e87f9){var _0xba6ee6={};var _0x3261c6={};var _0xcfe333;var _0x90a43d;return db['SmsQueue']['findOne']({'where':{'id':_0x54d887['params']['id']}})[_0x4034('0x2c')](handleEntityNotFound(_0x162d19,null))['then'](function(_0xe77dcf){if(_0xe77dcf){_0xcfe333=_0xe77dcf;_0x3261c6[_0x4034('0x38')]=_[_0x4034('0x39')](db['Team'][_0x4034('0x4e')]);_0x3261c6[_0x4034('0x3c')]=_[_0x4034('0x39')](_0x54d887[_0x4034('0x3c')]);_0x3261c6[_0x4034('0x3a')]=_[_0x4034('0x3b')](_0x3261c6[_0x4034('0x38')],_0x3261c6[_0x4034('0x3c')]);_0xba6ee6[_0x4034('0x3d')]=_[_0x4034('0x3b')](_0x3261c6[_0x4034('0x38')],qs[_0x4034('0x3e')](_0x54d887[_0x4034('0x3c')][_0x4034('0x3e')]));_0xba6ee6[_0x4034('0x3d')]=_0xba6ee6['attributes'][_0x4034('0x3f')]?_0xba6ee6['attributes']:_0x3261c6['model'];_0xba6ee6[_0x4034('0x5b')]=qs[_0x4034('0x42')](_0x54d887[_0x4034('0x3c')][_0x4034('0x42')]);_0xba6ee6['where']=qs['filters'](_[_0x4034('0x5c')](_0x54d887['query'],_0x3261c6[_0x4034('0x3a')]));if(_0x54d887[_0x4034('0x3c')][_0x4034('0x44')]){_0xba6ee6[_0x4034('0x43')]=_['merge'](_0xba6ee6[_0x4034('0x43')],{'$or':_['map'](_0xba6ee6['attributes'],function(_0x33c739){var _0xe91081={};_0xe91081[_0x33c739]={'$like':'%'+_0x54d887[_0x4034('0x3c')]['filter']+'%'};return _0xe91081;})});}_0xba6ee6=_['merge']({},_0xba6ee6,_0x54d887[_0x4034('0x47')]);return _0xcfe333[_0x4034('0x67')](_0xba6ee6);}})['then'](function(_0xb5cf2b){if(_0xb5cf2b){_0x90a43d=_0xb5cf2b[_0x4034('0x3f')];if(!_0x54d887[_0x4034('0x3c')][_0x4034('0x40')](_0x4034('0x41'))){_0xba6ee6[_0x4034('0x23')]=qs[_0x4034('0x23')](_0x54d887[_0x4034('0x3c')][_0x4034('0x23')]);_0xba6ee6[_0x4034('0x24')]=qs['offset'](_0x54d887['query'][_0x4034('0x24')]);}return _0xcfe333[_0x4034('0x67')](_0xba6ee6);}})[_0x4034('0x2c')](function(_0x5e2926){if(_0x5e2926){return _0x5e2926?{'count':_0x90a43d,'rows':_0x5e2926}:null;}})[_0x4034('0x2c')](respondWithResult(_0x162d19,null))['catch'](handleError(_0x162d19,null));};exports[_0x4034('0x68')]=function(_0x30fd03,_0x28f560,_0x42770d){var _0x4c18c5=_0x30fd03[_0x4034('0x50')][_0x4034('0x69')];return db['Team']['findAll']({'where':{'id':_0x4c18c5},'attributes':['id'],'include':[{'model':db[_0x4034('0x5e')],'as':_0x4034('0x6a'),'attributes':['id',_0x4034('0x31'),_0x4034('0x6b'),'voicePause',_0x4034('0x6c')],'raw':!![]}]})[_0x4034('0x2c')](function(_0x5aceba){if(_0x5aceba){var _0x562518=_[_0x4034('0x6d')](_0x5aceba,function(_0x9b9d74){var _0x3cfcb3=_0x9b9d74['get']({'plain':!![]});return _0x3cfcb3[_0x4034('0x6a')];});return db[_0x4034('0x35')][_0x4034('0x55')]({'where':{'id':_0x30fd03[_0x4034('0x4d')]['id']}})[_0x4034('0x2c')](function(_0x4d2793){return db[_0x4034('0x6e')][_0x4034('0x6f')](function(_0x2044a5){return _0x4d2793[_0x4034('0x68')](_0x4c18c5,{'transaction':_0x2044a5})[_0x4034('0x2c')](function(){return BPromise[_0x4034('0x70')](_0x562518,function(_0x43b8c2){return db[_0x4034('0x5a')][_0x4034('0x71')]({'where':{'UserId':_0x43b8c2['id'],'SmsQueueId':_0x30fd03[_0x4034('0x4d')]['id']},'transaction':_0x2044a5});});})['then'](function(){_0x562518[_0x4034('0x72')](function(_0x395598){socket[_0x4034('0x73')](_0x4034('0x74'),{'UserId':_0x395598['id'],'SmsQueueId':_0x4d2793['id']});});});});});}})[_0x4034('0x2c')](respondWithStatusCode(_0x28f560,null))[_0x4034('0x4b')](handleError(_0x28f560,null));};exports[_0x4034('0x75')]=function(_0x506efe,_0x2f9c68,_0x4e22ec){return db[_0x4034('0x76')][_0x4034('0x4a')]({'where':{'id':_0x506efe[_0x4034('0x3c')][_0x4034('0x69')]},'attributes':['id'],'include':[{'model':db[_0x4034('0x5e')],'as':_0x4034('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x4034('0x2c')](handleEntityNotFound(_0x2f9c68,null))[_0x4034('0x2c')](function(_0x298acb){var _0x283014=_[_0x4034('0x34')](_0x298acb,'id');var _0x27a8a3=[];var _0x2d47e9=[];var _0x2d5f07=squel[_0x4034('0x77')]();_0x2d5f07['field'](_0x4034('0x78'))[_0x4034('0x79')](_0x4034('0x7a'),'tq')[_0x4034('0x7b')]('user_has_teams','ut',_0x4034('0x7c'))[_0x4034('0x43')](_0x4034('0x7d'),_0x506efe[_0x4034('0x4d')]['id']);for(var _0x54d075=0x0;_0x54d075<_0x298acb[_0x4034('0x3f')];_0x54d075+=0x1){let _0x312097=_0x298acb[_0x54d075];for(var _0x15ec4f=0x0;_0x15ec4f<_0x312097['Agents']['length'];_0x15ec4f+=0x1){let _0x49023b=_0x312097['Agents'][_0x15ec4f];var _0x5c9742=_0x2d5f07[_0x4034('0x7e')]();_0x5c9742[_0x4034('0x43')](_0x4034('0x7f'),_0x49023b['id']);_0x2d47e9[_0x4034('0x80')](db['sequelize']['query'](_0x5c9742['toString'](),{'type':db[_0x4034('0x6e')]['QueryTypes'][_0x4034('0x81')]})[_0x4034('0x2c')](function(_0x52f3c8){if(_0x52f3c8[_0x4034('0x3f')]===0x1){return _0x49023b['id'];}else{var _0x2ebf9d=_[_0x4034('0x82')](_[_0x4034('0x34')](_0x52f3c8,_0x4034('0x83')),function(_0x21aff4){return _[_0x4034('0x84')](_0x283014,_0x21aff4);});if(_0x2ebf9d){return _0x49023b['id'];}}}));}}return BPromise[_0x4034('0x85')](_0x2d47e9)['then'](function(_0x26d55e){_0x27a8a3=_(_0x27a8a3)[_0x4034('0x86')](_0x26d55e)['compact']()[_0x4034('0x87')]();return db[_0x4034('0x35')][_0x4034('0x55')]({'where':{'id':_0x506efe[_0x4034('0x4d')]['id']}})[_0x4034('0x2c')](function(_0x3560c2){return db[_0x4034('0x6e')]['transaction'](function(_0xa16b24){return _0x3560c2[_0x4034('0x75')](_0x506efe[_0x4034('0x3c')][_0x4034('0x69')],{'transaction':_0xa16b24})[_0x4034('0x2c')](function(){if(!_[_0x4034('0x88')](_0x27a8a3)){return _0x3560c2[_0x4034('0x89')](_0x27a8a3,{'transaction':_0xa16b24});}})[_0x4034('0x2c')](function(){_0x27a8a3[_0x4034('0x72')](function(_0x7b0528){socket[_0x4034('0x73')](_0x4034('0x8a'),{'UserId':_0x7b0528,'SmsQueueId':_0x3560c2['id']});});});});});});})[_0x4034('0x2c')](respondWithStatusCode(_0x2f9c68,null))[_0x4034('0x4b')](handleError(_0x2f9c68,null));};exports[_0x4034('0x8b')]=function(_0x31145a,_0x4841fc,_0x1921e0){return db['SmsQueue']['find']({'where':{'id':_0x31145a['params']['id']}})[_0x4034('0x2c')](handleEntityNotFound(_0x4841fc,null))['then'](function(_0x3f617a){if(_0x3f617a){return _0x3f617a[_0x4034('0x8b')](_0x31145a['body'][_0x4034('0x69')],_['omit'](_0x31145a[_0x4034('0x50')],[_0x4034('0x69'),'id'])||{})[_0x4034('0x8c')](function(_0x4ed19c){for(var _0x59aca2=0x0;_0x59aca2<_0x31145a[_0x4034('0x50')][_0x4034('0x69')]['length'];_0x59aca2+=0x1){socket[_0x4034('0x73')](_0x4034('0x74'),{'UserId':Number(_0x31145a[_0x4034('0x50')]['ids'][_0x59aca2]),'SmsQueueId':Number(_0x31145a['params']['id'])});}return _0x4ed19c;});}})['then'](respondWithResult(_0x4841fc,null))['catch'](handleError(_0x4841fc,null));};exports['removeAgents']=function(_0x47adf8,_0x3166b7,_0x44a682){return db[_0x4034('0x35')][_0x4034('0x55')]({'where':{'id':_0x47adf8['params']['id']}})['then'](handleEntityNotFound(_0x3166b7,null))[_0x4034('0x2c')](function(_0x116519){if(_0x116519){return _0x116519['removeAgents'](_0x47adf8['query'][_0x4034('0x69')])[_0x4034('0x2c')](function(){if(_[_0x4034('0x8d')](_0x47adf8[_0x4034('0x3c')][_0x4034('0x69')])){for(var _0x3ce787=0x0;_0x3ce787<_0x47adf8[_0x4034('0x3c')]['ids'][_0x4034('0x3f')];_0x3ce787+=0x1){socket[_0x4034('0x73')](_0x4034('0x8a'),{'UserId':Number(_0x47adf8[_0x4034('0x3c')][_0x4034('0x69')][_0x3ce787]),'SmsQueueId':Number(_0x47adf8[_0x4034('0x4d')]['id'])});}}else{socket[_0x4034('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x47adf8['query'][_0x4034('0x69')]),'SmsQueueId':Number(_0x47adf8[_0x4034('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x3166b7,null))[_0x4034('0x4b')](handleError(_0x3166b7,null));};exports[_0x4034('0x8e')]=function(_0x409516,_0x35a36d,_0x361447){var _0x11afe0={};var _0x440ca9={};var _0x9c00d9;var _0x4439e8;return db[_0x4034('0x35')][_0x4034('0x59')]({'where':{'id':_0x409516[_0x4034('0x4d')]['id']}})['then'](handleEntityNotFound(_0x35a36d,null))[_0x4034('0x2c')](function(_0x51754c){if(_0x51754c){_0x9c00d9=_0x51754c;_0x440ca9[_0x4034('0x38')]=_['keys'](db[_0x4034('0x5e')]['rawAttributes']);_0x440ca9[_0x4034('0x3c')]=_[_0x4034('0x39')](_0x409516['query']);_0x440ca9[_0x4034('0x3a')]=_[_0x4034('0x3b')](_0x440ca9[_0x4034('0x38')],_0x440ca9[_0x4034('0x3c')]);_0x11afe0[_0x4034('0x3d')]=_['intersection'](_0x440ca9[_0x4034('0x38')],qs['fields'](_0x409516[_0x4034('0x3c')][_0x4034('0x3e')]));_0x11afe0[_0x4034('0x3d')]=_0x11afe0[_0x4034('0x3d')][_0x4034('0x3f')]?_0x11afe0[_0x4034('0x3d')]:_0x440ca9[_0x4034('0x38')];_0x11afe0['order']=qs['sort'](_0x409516[_0x4034('0x3c')]['sort']);_0x11afe0[_0x4034('0x43')]=qs[_0x4034('0x3a')](_[_0x4034('0x5c')](_0x409516[_0x4034('0x3c')],_0x440ca9[_0x4034('0x3a')]));if(_0x409516[_0x4034('0x3c')]['filter']){_0x11afe0[_0x4034('0x43')]=_[_0x4034('0x45')](_0x11afe0[_0x4034('0x43')],{'$or':_[_0x4034('0x34')](_0x11afe0[_0x4034('0x3d')],function(_0x585c0c){var _0xed1687={};_0xed1687[_0x585c0c]={'$like':'%'+_0x409516['query'][_0x4034('0x44')]+'%'};return _0xed1687;})});}_0x11afe0=_[_0x4034('0x45')]({},_0x11afe0,_0x409516[_0x4034('0x47')]);return _0x9c00d9['getAgents'](_0x11afe0);}})[_0x4034('0x2c')](function(_0x444de6){if(_0x444de6){_0x4439e8=_0x444de6[_0x4034('0x3f')];if(!_0x409516[_0x4034('0x3c')][_0x4034('0x40')]('nolimit')){_0x11afe0[_0x4034('0x23')]=qs[_0x4034('0x23')](_0x409516[_0x4034('0x3c')][_0x4034('0x23')]);_0x11afe0['offset']=qs[_0x4034('0x24')](_0x409516[_0x4034('0x3c')][_0x4034('0x24')]);}return _0x9c00d9[_0x4034('0x8e')](_0x11afe0);}})['then'](function(_0x168dff){if(_0x168dff){return _0x168dff?{'count':_0x4439e8,'rows':_0x168dff}:null;}})['then'](respondWithResult(_0x35a36d,null))[_0x4034('0x4b')](handleError(_0x35a36d,null));}; \ No newline at end of file +var _0x150c=['tq.TeamId','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','SmsQueues','UserProfileResource','then','error','name','map','SmsQueue','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','pick','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','findAll','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select'];(function(_0x210449,_0x1e96cf){var _0x911c0a=function(_0x4b4ac5){while(--_0x4b4ac5){_0x210449['push'](_0x210449['shift']());}};_0x911c0a(++_0x1e96cf);}(_0x150c,0x12b));var _0xc150=function(_0x2f2a0d,_0x5d1976){_0x2f2a0d=_0x2f2a0d-0x0;var _0x823f5e=_0x150c[_0x2f2a0d];return _0x823f5e;};'use strict';var emlformat=require(_0xc150('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc150('0x1'));var rp=require(_0xc150('0x2'));var moment=require(_0xc150('0x3'));var BPromise=require(_0xc150('0x4'));var Mustache=require(_0xc150('0x5'));var util=require(_0xc150('0x6'));var path=require(_0xc150('0x7'));var sox=require(_0xc150('0x8'));var csv=require(_0xc150('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc150('0xa'));var crypto=require(_0xc150('0xb'));var jsforce=require(_0xc150('0xc'));var deskjs=require(_0xc150('0xd'));var toCsv=require(_0xc150('0x9'));var querystring=require(_0xc150('0xe'));var Papa=require(_0xc150('0xf'));var Redis=require(_0xc150('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc150('0x11'));var hardwareService=require(_0xc150('0x12'));var logger=require(_0xc150('0x13'))(_0xc150('0x14'));var utils=require(_0xc150('0x15'));var config=require(_0xc150('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc150('0x17'))['db'];config['redis']=_[_0xc150('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc150('0x19')]));require('./smsQueue.socket')[_0xc150('0x1a')](socket);function respondWithStatusCode(_0x56278a,_0xd3793c){_0xd3793c=_0xd3793c||0xcc;return function(_0x28c84b){if(_0x28c84b){return _0x56278a[_0xc150('0x1b')](_0xd3793c);}return _0x56278a[_0xc150('0x1c')](_0xd3793c)[_0xc150('0x1d')]();};}function respondWithResult(_0xc165b1,_0x438360){_0x438360=_0x438360||0xc8;return function(_0x51dd50){if(_0x51dd50){return _0xc165b1[_0xc150('0x1c')](_0x438360)[_0xc150('0x1e')](_0x51dd50);}};}function respondWithFilteredResult(_0x2c3b4c,_0x55bd37){return function(_0x53a7ba){if(_0x53a7ba){var _0x2795ef=typeof _0x55bd37[_0xc150('0x1f')]===_0xc150('0x20')&&typeof _0x55bd37[_0xc150('0x21')]===_0xc150('0x20');var _0x290bdb=_0x53a7ba[_0xc150('0x22')];var _0x92317e=_0x2795ef?0x0:_0x55bd37[_0xc150('0x1f')];var _0x4095aa=_0x2795ef?_0x53a7ba[_0xc150('0x22')]:_0x55bd37[_0xc150('0x1f')]+_0x55bd37[_0xc150('0x21')];var _0x4933f3;if(_0x4095aa>=_0x290bdb){_0x4095aa=_0x290bdb;_0x4933f3=0xc8;}else{_0x4933f3=0xce;}_0x2c3b4c[_0xc150('0x1c')](_0x4933f3);return _0x2c3b4c[_0xc150('0x23')](_0xc150('0x24'),_0x92317e+'-'+_0x4095aa+'/'+_0x290bdb)[_0xc150('0x1e')](_0x53a7ba);}return null;};}function patchUpdates(_0x3be79f){return function(_0x22ee90){try{jsonpatch[_0xc150('0x25')](_0x22ee90,_0x3be79f,!![]);}catch(_0x31d4ce){return BPromise[_0xc150('0x26')](_0x31d4ce);}return _0x22ee90['save']();};}function saveUpdates(_0x3af267,_0x1f7bc7){return function(_0x164fcd){if(_0x164fcd){return _0x164fcd[_0xc150('0x27')](_0x3af267)['then'](function(_0x2261aa){return _0x2261aa;});}return null;};}function removeEntity(_0xe66596,_0x3351dd){return function(_0x489262){if(_0x489262){return _0x489262[_0xc150('0x28')]()['then'](function(){var _0x4e630c=_0x489262[_0xc150('0x29')]({'plain':!![]});var _0xeab65d=_0xc150('0x2a');return db[_0xc150('0x2b')][_0xc150('0x28')]({'where':{'type':_0xeab65d,'resourceId':_0x4e630c['id']}})[_0xc150('0x2c')](function(){return _0x489262;});})[_0xc150('0x2c')](function(){_0xe66596[_0xc150('0x1c')](0xcc)[_0xc150('0x1d')]();});}};}function handleEntityNotFound(_0x1f7990,_0x3cca69){return function(_0x275355){if(!_0x275355){_0x1f7990[_0xc150('0x1b')](0x194);}return _0x275355;};}function handleError(_0x38cfae,_0x369e6c){_0x369e6c=_0x369e6c||0x1f4;return function(_0x5124a9){logger[_0xc150('0x2d')](_0x5124a9['stack']);if(_0x5124a9[_0xc150('0x2e')]){delete _0x5124a9[_0xc150('0x2e')];}_0x38cfae[_0xc150('0x1c')](_0x369e6c)['send'](_0x5124a9);};}exports['index']=function(_0xb24c31,_0x2a48a6){var _0x4df4c8={},_0x1ea3dd={},_0x247d64={'count':0x0,'rows':[]};var _0x35885e=_[_0xc150('0x2f')](db[_0xc150('0x30')][_0xc150('0x31')],function(_0x533764){return{'name':_0x533764[_0xc150('0x32')],'type':_0x533764[_0xc150('0x33')]['key']};});_0x1ea3dd['model']=_[_0xc150('0x2f')](_0x35885e,_0xc150('0x2e'));_0x1ea3dd[_0xc150('0x34')]=_['keys'](_0xb24c31[_0xc150('0x34')]);_0x1ea3dd[_0xc150('0x35')]=_['intersection'](_0x1ea3dd[_0xc150('0x36')],_0x1ea3dd[_0xc150('0x34')]);_0x4df4c8[_0xc150('0x37')]=_[_0xc150('0x38')](_0x1ea3dd['model'],qs[_0xc150('0x39')](_0xb24c31[_0xc150('0x34')][_0xc150('0x39')]));_0x4df4c8['attributes']=_0x4df4c8['attributes'][_0xc150('0x3a')]?_0x4df4c8['attributes']:_0x1ea3dd[_0xc150('0x36')];if(!_0xb24c31['query'][_0xc150('0x3b')](_0xc150('0x3c'))){_0x4df4c8[_0xc150('0x21')]=qs[_0xc150('0x21')](_0xb24c31['query'][_0xc150('0x21')]);_0x4df4c8[_0xc150('0x1f')]=qs['offset'](_0xb24c31[_0xc150('0x34')][_0xc150('0x1f')]);}_0x4df4c8[_0xc150('0x3d')]=qs[_0xc150('0x3e')](_0xb24c31['query']['sort']);_0x4df4c8[_0xc150('0x3f')]=qs['filters'](_['pick'](_0xb24c31[_0xc150('0x34')],_0x1ea3dd[_0xc150('0x35')]),_0x35885e);if(_0xb24c31[_0xc150('0x34')][_0xc150('0x40')]){_0x4df4c8['where']=_[_0xc150('0x41')](_0x4df4c8[_0xc150('0x3f')],{'$or':_[_0xc150('0x2f')](_0x35885e,function(_0x22cece){if(_0x22cece['type']!==_0xc150('0x42')){var _0x4d9576={};_0x4d9576[_0x22cece[_0xc150('0x2e')]]={'$like':'%'+_0xb24c31[_0xc150('0x34')][_0xc150('0x40')]+'%'};return _0x4d9576;}})});}_0x4df4c8=_[_0xc150('0x41')]({},_0x4df4c8,_0xb24c31['options']);var _0x1a621f={'where':_0x4df4c8['where']};return db[_0xc150('0x30')]['count'](_0x1a621f)[_0xc150('0x2c')](function(_0xf562d1){_0x247d64['count']=_0xf562d1;if(_0xb24c31[_0xc150('0x34')][_0xc150('0x43')]){_0x4df4c8[_0xc150('0x44')]=[{'all':!![]}];}return db[_0xc150('0x30')]['findAll'](_0x4df4c8);})[_0xc150('0x2c')](function(_0x3e5b7d){_0x247d64[_0xc150('0x45')]=_0x3e5b7d;return _0x247d64;})[_0xc150('0x2c')](respondWithFilteredResult(_0x2a48a6,_0x4df4c8))[_0xc150('0x46')](handleError(_0x2a48a6,null));};exports[_0xc150('0x47')]=function(_0x5a2e37,_0xe91115){var _0x30d367={'raw':!![],'where':{'id':_0x5a2e37[_0xc150('0x48')]['id']}},_0x398cde={};_0x398cde[_0xc150('0x36')]=_[_0xc150('0x49')](db['SmsQueue'][_0xc150('0x31')]);_0x398cde[_0xc150('0x34')]=_[_0xc150('0x49')](_0x5a2e37[_0xc150('0x34')]);_0x398cde['filters']=_[_0xc150('0x38')](_0x398cde[_0xc150('0x36')],_0x398cde[_0xc150('0x34')]);_0x30d367['attributes']=_[_0xc150('0x38')](_0x398cde[_0xc150('0x36')],qs[_0xc150('0x39')](_0x5a2e37[_0xc150('0x34')][_0xc150('0x39')]));_0x30d367['attributes']=_0x30d367['attributes'][_0xc150('0x3a')]?_0x30d367['attributes']:_0x398cde[_0xc150('0x36')];if(_0x5a2e37['query'][_0xc150('0x43')]){_0x30d367[_0xc150('0x44')]=[{'all':!![]}];}_0x30d367=_[_0xc150('0x41')]({},_0x30d367,_0x5a2e37[_0xc150('0x4a')]);return db[_0xc150('0x30')]['find'](_0x30d367)['then'](handleEntityNotFound(_0xe91115,null))['then'](respondWithResult(_0xe91115,null))[_0xc150('0x46')](handleError(_0xe91115,null));};exports['create']=function(_0x387cbe,_0x47ff59){return db[_0xc150('0x30')][_0xc150('0x4b')](_0x387cbe['body'],{})[_0xc150('0x2c')](function(_0x2458ed){var _0x394301=_0x387cbe[_0xc150('0x4c')][_0xc150('0x29')]({'plain':!![]});if(!_0x394301)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x394301[_0xc150('0x4d')]===_0xc150('0x4c')){var _0x25f563=_0x2458ed[_0xc150('0x29')]({'plain':!![]});var _0x15982d='SmsQueues';return db[_0xc150('0x4e')][_0xc150('0x4f')]({'where':{'name':_0x15982d,'userProfileId':_0x394301[_0xc150('0x50')]},'raw':!![]})[_0xc150('0x2c')](function(_0x50f18f){if(_0x50f18f&&_0x50f18f[_0xc150('0x51')]===0x0){return db[_0xc150('0x2b')][_0xc150('0x4b')]({'name':_0x25f563[_0xc150('0x2e')],'resourceId':_0x25f563['id'],'type':_0x50f18f[_0xc150('0x2e')],'sectionId':_0x50f18f['id']},{})[_0xc150('0x2c')](function(){return _0x2458ed;});}else{return _0x2458ed;}})[_0xc150('0x46')](function(_0x17caa9){logger[_0xc150('0x2d')](_0xc150('0x52'),_0x17caa9);throw _0x17caa9;});}return _0x2458ed;})[_0xc150('0x2c')](respondWithResult(_0x47ff59,0xc9))['catch'](handleError(_0x47ff59,null));};exports[_0xc150('0x27')]=function(_0x47a8af,_0x439407){if(_0x47a8af[_0xc150('0x53')]['id']){delete _0x47a8af[_0xc150('0x53')]['id'];}return db[_0xc150('0x30')][_0xc150('0x4f')]({'where':{'id':_0x47a8af[_0xc150('0x48')]['id']}})[_0xc150('0x2c')](handleEntityNotFound(_0x439407,null))[_0xc150('0x2c')](saveUpdates(_0x47a8af['body'],null))[_0xc150('0x2c')](respondWithResult(_0x439407,null))[_0xc150('0x46')](handleError(_0x439407,null));};exports['destroy']=function(_0x17f8e8,_0x159445){return db['SmsQueue'][_0xc150('0x4f')]({'where':{'id':_0x17f8e8['params']['id']}})['then'](handleEntityNotFound(_0x159445,null))['then'](removeEntity(_0x159445,null))['catch'](handleError(_0x159445,null));};exports['describe']=function(_0x1ca470,_0x5e0030){return db['SmsQueue'][_0xc150('0x54')]()[_0xc150('0x2c')](respondWithResult(_0x5e0030,null))[_0xc150('0x46')](handleError(_0x5e0030,null));};exports[_0xc150('0x55')]=function(_0x13c6aa,_0x1189dd,_0x28478a){var _0x5b9b5a={'raw':!![],'where':{}},_0x45b4ba={},_0x23e1b8;return db[_0xc150('0x30')][_0xc150('0x56')]({'where':{'id':_0x13c6aa[_0xc150('0x48')]['id']}})[_0xc150('0x2c')](handleEntityNotFound(_0x1189dd,null))['then'](function(_0x3d8748){if(_0x3d8748){_0x23e1b8=_0x3d8748[_0xc150('0x29')]({'plain':!![]});_0x45b4ba['model']=_[_0xc150('0x49')](db[_0xc150('0x57')][_0xc150('0x31')]);_0x45b4ba[_0xc150('0x34')]=_[_0xc150('0x49')](_0x13c6aa[_0xc150('0x34')]);_0x45b4ba['filters']=_[_0xc150('0x38')](_0x45b4ba[_0xc150('0x36')],_0x45b4ba[_0xc150('0x34')]);_0x5b9b5a[_0xc150('0x37')]=_['intersection'](_0x45b4ba[_0xc150('0x36')],qs['fields'](_0x13c6aa[_0xc150('0x34')]['fields']));_0x5b9b5a[_0xc150('0x37')]=_0x5b9b5a[_0xc150('0x37')][_0xc150('0x3a')]?_0x5b9b5a[_0xc150('0x37')]:_0x45b4ba[_0xc150('0x36')];if(!_0x13c6aa[_0xc150('0x34')][_0xc150('0x3b')](_0xc150('0x3c'))){_0x5b9b5a['limit']=qs[_0xc150('0x21')](_0x13c6aa['query'][_0xc150('0x21')]);_0x5b9b5a[_0xc150('0x1f')]=qs[_0xc150('0x1f')](_0x13c6aa['query'][_0xc150('0x1f')]);}_0x5b9b5a[_0xc150('0x3d')]=qs['sort'](_0x13c6aa[_0xc150('0x34')][_0xc150('0x3e')]);_0x5b9b5a[_0xc150('0x3f')]=qs[_0xc150('0x35')](_[_0xc150('0x58')](_0x13c6aa[_0xc150('0x34')],_0x45b4ba[_0xc150('0x35')]));_0x5b9b5a[_0xc150('0x3f')]['SmsQueueId']=_0x3d8748['id'];if(_0x13c6aa[_0xc150('0x34')]['filter']){_0x5b9b5a[_0xc150('0x3f')]=_['merge'](_0x5b9b5a['where'],{'$or':_[_0xc150('0x2f')](_0x5b9b5a[_0xc150('0x37')],function(_0x847e43){var _0x50a751={};_0x50a751[_0x847e43]={'$like':'%'+_0x13c6aa[_0xc150('0x34')][_0xc150('0x40')]+'%'};return _0x50a751;})});}_0x5b9b5a=_[_0xc150('0x41')]({},_0x5b9b5a,_0x13c6aa[_0xc150('0x4a')]);return db[_0xc150('0x57')]['findAll'](_0x5b9b5a);}})['then'](function(_0x463c84){if(_0x463c84){return db['User'][_0xc150('0x59')]({'where':{'id':_[_0xc150('0x2f')](_0x463c84,_0xc150('0x5a')),'role':_0xc150('0x5b')},'attributes':['id',_0xc150('0x2e'),_0xc150('0x5c'),_0xc150('0x5d'),_0xc150('0x5e')]});}})[_0xc150('0x2c')](function(_0x2218ce){if(_0x2218ce){return{'count':_0x2218ce['count'],'rows':_[_0xc150('0x2f')](_0x2218ce[_0xc150('0x45')],function(_0x30a2cb){return{'membername':_0x30a2cb[_0xc150('0x2e')],'UserId':_0x30a2cb['id'],'queue_name':_0x23e1b8['name'],'SmsQueueId':_0x23e1b8['id'],'interface':util[_0xc150('0x5f')](_0xc150('0x60'),_0xc150('0x61'),_0x30a2cb[_0xc150('0x2e')]),'penalty':0x0,'paused':_0x30a2cb[_0xc150('0x5c')],'createdAt':_0x30a2cb[_0xc150('0x5e')],'updatedAt':_0x30a2cb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1189dd,_0x5b9b5a))[_0xc150('0x46')](handleError(_0x1189dd,null));};exports[_0xc150('0x62')]=function(_0x4d5d75,_0x54c5f4,_0x21d14e){var _0x20d84a={};var _0xccb5cb={};var _0x1ec2d0;var _0x18b968;return db[_0xc150('0x30')][_0xc150('0x56')]({'where':{'id':_0x4d5d75[_0xc150('0x48')]['id']}})['then'](handleEntityNotFound(_0x54c5f4,null))['then'](function(_0x4e8699){if(_0x4e8699){_0x1ec2d0=_0x4e8699;_0xccb5cb[_0xc150('0x36')]=_[_0xc150('0x49')](db[_0xc150('0x63')][_0xc150('0x31')]);_0xccb5cb[_0xc150('0x34')]=_[_0xc150('0x49')](_0x4d5d75[_0xc150('0x34')]);_0xccb5cb['filters']=_[_0xc150('0x38')](_0xccb5cb[_0xc150('0x36')],_0xccb5cb[_0xc150('0x34')]);_0x20d84a['attributes']=_[_0xc150('0x38')](_0xccb5cb[_0xc150('0x36')],qs[_0xc150('0x39')](_0x4d5d75[_0xc150('0x34')][_0xc150('0x39')]));_0x20d84a['attributes']=_0x20d84a[_0xc150('0x37')][_0xc150('0x3a')]?_0x20d84a[_0xc150('0x37')]:_0xccb5cb[_0xc150('0x36')];_0x20d84a['order']=qs[_0xc150('0x3e')](_0x4d5d75[_0xc150('0x34')][_0xc150('0x3e')]);_0x20d84a[_0xc150('0x3f')]=qs[_0xc150('0x35')](_['pick'](_0x4d5d75[_0xc150('0x34')],_0xccb5cb['filters']));if(_0x4d5d75[_0xc150('0x34')]['filter']){_0x20d84a[_0xc150('0x3f')]=_['merge'](_0x20d84a[_0xc150('0x3f')],{'$or':_['map'](_0x20d84a[_0xc150('0x37')],function(_0x5676d3){var _0x48e96a={};_0x48e96a[_0x5676d3]={'$like':'%'+_0x4d5d75['query']['filter']+'%'};return _0x48e96a;})});}_0x20d84a=_['merge']({},_0x20d84a,_0x4d5d75[_0xc150('0x4a')]);return _0x1ec2d0[_0xc150('0x62')](_0x20d84a);}})[_0xc150('0x2c')](function(_0x289666){if(_0x289666){_0x18b968=_0x289666[_0xc150('0x3a')];if(!_0x4d5d75[_0xc150('0x34')]['hasOwnProperty'](_0xc150('0x3c'))){_0x20d84a[_0xc150('0x21')]=qs[_0xc150('0x21')](_0x4d5d75['query'][_0xc150('0x21')]);_0x20d84a[_0xc150('0x1f')]=qs[_0xc150('0x1f')](_0x4d5d75[_0xc150('0x34')][_0xc150('0x1f')]);}return _0x1ec2d0[_0xc150('0x62')](_0x20d84a);}})[_0xc150('0x2c')](function(_0x33a052){if(_0x33a052){return _0x33a052?{'count':_0x18b968,'rows':_0x33a052}:null;}})[_0xc150('0x2c')](respondWithResult(_0x54c5f4,null))[_0xc150('0x46')](handleError(_0x54c5f4,null));};exports[_0xc150('0x64')]=function(_0x4954d9,_0x167688,_0x198b4b){var _0x29e51b=_0x4954d9[_0xc150('0x53')][_0xc150('0x65')];return db[_0xc150('0x63')][_0xc150('0x66')]({'where':{'id':_0x29e51b},'attributes':['id'],'include':[{'model':db[_0xc150('0x67')],'as':_0xc150('0x68'),'attributes':['id','name',_0xc150('0x69'),_0xc150('0x6a'),_0xc150('0x6b')],'raw':!![]}]})[_0xc150('0x2c')](function(_0x193c24){if(_0x193c24){var _0x4a42e0=_[_0xc150('0x6c')](_0x193c24,function(_0x44df9d){var _0xa050a1=_0x44df9d[_0xc150('0x29')]({'plain':!![]});return _0xa050a1[_0xc150('0x68')];});return db[_0xc150('0x30')][_0xc150('0x4f')]({'where':{'id':_0x4954d9[_0xc150('0x48')]['id']}})['then'](function(_0x1e73c5){return db[_0xc150('0x6d')][_0xc150('0x6e')](function(_0x2ec01b){return _0x1e73c5[_0xc150('0x64')](_0x29e51b,{'transaction':_0x2ec01b})[_0xc150('0x2c')](function(){return BPromise[_0xc150('0x6f')](_0x4a42e0,function(_0x33445c){return db[_0xc150('0x57')][_0xc150('0x70')]({'where':{'UserId':_0x33445c['id'],'SmsQueueId':_0x4954d9[_0xc150('0x48')]['id']},'transaction':_0x2ec01b});});})['then'](function(){_0x4a42e0[_0xc150('0x71')](function(_0xd44e75){socket[_0xc150('0x72')](_0xc150('0x73'),{'UserId':_0xd44e75['id'],'SmsQueueId':_0x1e73c5['id']});});});});});}})[_0xc150('0x2c')](respondWithStatusCode(_0x167688,null))[_0xc150('0x46')](handleError(_0x167688,null));};exports[_0xc150('0x74')]=function(_0x3c431e,_0x21a7f2,_0x102991){return db[_0xc150('0x63')]['findAll']({'where':{'id':_0x3c431e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xc150('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21a7f2,null))[_0xc150('0x2c')](function(_0x5b898b){var _0x20b989=_[_0xc150('0x2f')](_0x5b898b,'id');var _0x4ef818=[];var _0x4f33bf=[];var _0x19a48f=squel[_0xc150('0x75')]();_0x19a48f['field'](_0xc150('0x76'))['from'](_0xc150('0x77'),'tq')[_0xc150('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc150('0x3f')](_0xc150('0x79'),_0x3c431e[_0xc150('0x48')]['id']);for(var _0x52eec7=0x0;_0x52eec7<_0x5b898b[_0xc150('0x3a')];_0x52eec7+=0x1){let _0x4d0cfc=_0x5b898b[_0x52eec7];for(var _0x401d3d=0x0;_0x401d3d<_0x4d0cfc[_0xc150('0x68')]['length'];_0x401d3d+=0x1){let _0x2838f1=_0x4d0cfc[_0xc150('0x68')][_0x401d3d];var _0x3e4045=_0x19a48f[_0xc150('0x7a')]();_0x3e4045[_0xc150('0x3f')]('ut.UserId\x20=\x20?',_0x2838f1['id']);_0x4f33bf[_0xc150('0x7b')](db[_0xc150('0x6d')][_0xc150('0x34')](_0x3e4045[_0xc150('0x7c')](),{'type':db[_0xc150('0x6d')][_0xc150('0x7d')][_0xc150('0x7e')]})[_0xc150('0x2c')](function(_0x4aaac1){if(_0x4aaac1[_0xc150('0x3a')]===0x1){return _0x2838f1['id'];}else{var _0x596fb2=_[_0xc150('0x7f')](_[_0xc150('0x2f')](_0x4aaac1,_0xc150('0x80')),function(_0x34aa99){return _[_0xc150('0x81')](_0x20b989,_0x34aa99);});if(_0x596fb2){return _0x2838f1['id'];}}}));}}return BPromise[_0xc150('0x82')](_0x4f33bf)[_0xc150('0x2c')](function(_0x3c3e02){_0x4ef818=_(_0x4ef818)[_0xc150('0x83')](_0x3c3e02)['compact']()[_0xc150('0x84')]();return db['SmsQueue'][_0xc150('0x4f')]({'where':{'id':_0x3c431e['params']['id']}})[_0xc150('0x2c')](function(_0x3b00ae){return db[_0xc150('0x6d')][_0xc150('0x6e')](function(_0x99ac82){return _0x3b00ae[_0xc150('0x74')](_0x3c431e[_0xc150('0x34')][_0xc150('0x65')],{'transaction':_0x99ac82})[_0xc150('0x2c')](function(){if(!_[_0xc150('0x85')](_0x4ef818)){return _0x3b00ae[_0xc150('0x86')](_0x4ef818,{'transaction':_0x99ac82});}})['then'](function(){_0x4ef818[_0xc150('0x71')](function(_0x471c72){socket['emit'](_0xc150('0x87'),{'UserId':_0x471c72,'SmsQueueId':_0x3b00ae['id']});});});});});});})[_0xc150('0x2c')](respondWithStatusCode(_0x21a7f2,null))[_0xc150('0x46')](handleError(_0x21a7f2,null));};exports['addAgents']=function(_0x548528,_0x28f6f0,_0x1acd62){return db[_0xc150('0x30')][_0xc150('0x4f')]({'where':{'id':_0x548528[_0xc150('0x48')]['id']}})[_0xc150('0x2c')](handleEntityNotFound(_0x28f6f0,null))['then'](function(_0x3caeba){if(_0x3caeba){return _0x3caeba[_0xc150('0x88')](_0x548528[_0xc150('0x53')][_0xc150('0x65')],_['omit'](_0x548528['body'],['ids','id'])||{})['spread'](function(_0x57f1b7){for(var _0x5dd6cb=0x0;_0x5dd6cb<_0x548528[_0xc150('0x53')][_0xc150('0x65')][_0xc150('0x3a')];_0x5dd6cb+=0x1){socket['emit'](_0xc150('0x73'),{'UserId':Number(_0x548528[_0xc150('0x53')][_0xc150('0x65')][_0x5dd6cb]),'SmsQueueId':Number(_0x548528[_0xc150('0x48')]['id'])});}return _0x57f1b7;});}})[_0xc150('0x2c')](respondWithResult(_0x28f6f0,null))[_0xc150('0x46')](handleError(_0x28f6f0,null));};exports[_0xc150('0x86')]=function(_0x576298,_0x42f776,_0x3ec978){return db[_0xc150('0x30')][_0xc150('0x4f')]({'where':{'id':_0x576298[_0xc150('0x48')]['id']}})[_0xc150('0x2c')](handleEntityNotFound(_0x42f776,null))[_0xc150('0x2c')](function(_0x2618e2){if(_0x2618e2){return _0x2618e2['removeAgents'](_0x576298[_0xc150('0x34')][_0xc150('0x65')])[_0xc150('0x2c')](function(){if(_[_0xc150('0x89')](_0x576298[_0xc150('0x34')][_0xc150('0x65')])){for(var _0x24ec41=0x0;_0x24ec41<_0x576298[_0xc150('0x34')]['ids'][_0xc150('0x3a')];_0x24ec41+=0x1){socket[_0xc150('0x72')](_0xc150('0x87'),{'UserId':Number(_0x576298['query'][_0xc150('0x65')][_0x24ec41]),'SmsQueueId':Number(_0x576298[_0xc150('0x48')]['id'])});}}else{socket[_0xc150('0x72')](_0xc150('0x87'),{'UserId':Number(_0x576298['query']['ids']),'SmsQueueId':Number(_0x576298[_0xc150('0x48')]['id'])});}});}})[_0xc150('0x2c')](respondWithStatusCode(_0x42f776,null))['catch'](handleError(_0x42f776,null));};exports['getAgents']=function(_0x294a91,_0x5136bb,_0x70df9){var _0x506168={};var _0xe0edb0={};var _0x3b889c;var _0x8596e6;return db['SmsQueue'][_0xc150('0x56')]({'where':{'id':_0x294a91['params']['id']}})[_0xc150('0x2c')](handleEntityNotFound(_0x5136bb,null))[_0xc150('0x2c')](function(_0x4df8b2){if(_0x4df8b2){_0x3b889c=_0x4df8b2;_0xe0edb0[_0xc150('0x36')]=_[_0xc150('0x49')](db[_0xc150('0x67')][_0xc150('0x31')]);_0xe0edb0[_0xc150('0x34')]=_[_0xc150('0x49')](_0x294a91[_0xc150('0x34')]);_0xe0edb0[_0xc150('0x35')]=_[_0xc150('0x38')](_0xe0edb0['model'],_0xe0edb0[_0xc150('0x34')]);_0x506168[_0xc150('0x37')]=_['intersection'](_0xe0edb0[_0xc150('0x36')],qs[_0xc150('0x39')](_0x294a91[_0xc150('0x34')]['fields']));_0x506168['attributes']=_0x506168[_0xc150('0x37')][_0xc150('0x3a')]?_0x506168[_0xc150('0x37')]:_0xe0edb0[_0xc150('0x36')];_0x506168[_0xc150('0x3d')]=qs[_0xc150('0x3e')](_0x294a91['query'][_0xc150('0x3e')]);_0x506168['where']=qs['filters'](_['pick'](_0x294a91[_0xc150('0x34')],_0xe0edb0[_0xc150('0x35')]));if(_0x294a91[_0xc150('0x34')][_0xc150('0x40')]){_0x506168[_0xc150('0x3f')]=_[_0xc150('0x41')](_0x506168[_0xc150('0x3f')],{'$or':_[_0xc150('0x2f')](_0x506168[_0xc150('0x37')],function(_0x6b4e27){var _0x38bedd={};_0x38bedd[_0x6b4e27]={'$like':'%'+_0x294a91[_0xc150('0x34')][_0xc150('0x40')]+'%'};return _0x38bedd;})});}_0x506168=_[_0xc150('0x41')]({},_0x506168,_0x294a91['options']);return _0x3b889c['getAgents'](_0x506168);}})['then'](function(_0x599ed2){if(_0x599ed2){_0x8596e6=_0x599ed2[_0xc150('0x3a')];if(!_0x294a91[_0xc150('0x34')][_0xc150('0x3b')](_0xc150('0x3c'))){_0x506168[_0xc150('0x21')]=qs[_0xc150('0x21')](_0x294a91[_0xc150('0x34')][_0xc150('0x21')]);_0x506168[_0xc150('0x1f')]=qs[_0xc150('0x1f')](_0x294a91['query'][_0xc150('0x1f')]);}return _0x3b889c[_0xc150('0x8a')](_0x506168);}})['then'](function(_0x6f5193){if(_0x6f5193){return _0x6f5193?{'count':_0x8596e6,'rows':_0x6f5193}:null;}})[_0xc150('0x2c')](respondWithResult(_0x5136bb,null))[_0xc150('0x46')](handleError(_0x5136bb,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index cf36385..4be0894 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 _0x50ad=['exports','events','remove','emit','hasOwnProperty'];(function(_0x227351,_0x58e0b3){var _0x2c958d=function(_0x4a677e){while(--_0x4a677e){_0x227351['push'](_0x227351['shift']());}};_0x2c958d(++_0x58e0b3);}(_0x50ad,0xfb));var _0xd50a=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x50ad[_0x24b477];return _0x4041a6;};'use strict';var EventEmitter=require(_0xd50a('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd50a('0x1')};function emitEvent(_0x486bad){return function(_0x1ffd54,_0x292537,_0x81a136){SmsQueueEvents[_0xd50a('0x2')](_0x486bad+':'+_0x1ffd54['id'],_0x1ffd54);SmsQueueEvents['emit'](_0x486bad,_0x1ffd54);_0x81a136(null);};}for(var e in events){if(events[_0xd50a('0x3')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xd50a('0x4')]=SmsQueueEvents; \ No newline at end of file +var _0x9783=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x4e2272,_0x2e1ae0){var _0x45511c=function(_0x285414){while(--_0x285414){_0x4e2272['push'](_0x4e2272['shift']());}};_0x45511c(++_0x2e1ae0);}(_0x9783,0x1f2));var _0x3978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9783[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3978('0x0'));var SmsQueue=require(_0x3978('0x1'))['db'][_0x3978('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3978('0x3')](0x0);var events={'afterCreate':_0x3978('0x4'),'afterUpdate':_0x3978('0x5'),'afterDestroy':_0x3978('0x6')};function emitEvent(_0x51be55){return function(_0x4f7c70,_0x15057d,_0x130e1b){SmsQueueEvents[_0x3978('0x7')](_0x51be55+':'+_0x4f7c70['id'],_0x4f7c70);SmsQueueEvents[_0x3978('0x7')](_0x51be55,_0x4f7c70);_0x130e1b(null);};}for(var e in events){if(events[_0x3978('0x8')](e)){var event=events[e];SmsQueue[_0x3978('0x9')](e,emitEvent(event));}}module[_0x3978('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 785103b..1537edb 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 _0x8ed6=['bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','../../config/logger','moment'];(function(_0x1b903c,_0x3e369c){var _0x41b5ed=function(_0x12ee24){while(--_0x12ee24){_0x1b903c['push'](_0x1b903c['shift']());}};_0x41b5ed(++_0x3e369c);}(_0x8ed6,0x97));var _0x68ed=function(_0xe548e9,_0x552a2b){_0xe548e9=_0xe548e9-0x0;var _0x25c58d=_0x8ed6[_0xe548e9];return _0x25c58d;};'use strict';var _=require(_0x68ed('0x0'));var util=require('util');var logger=require(_0x68ed('0x1'))('api');var moment=require(_0x68ed('0x2'));var BPromise=require(_0x68ed('0x3'));var rp=require(_0x68ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ed('0x5'));var config=require(_0x68ed('0x6'));var attributes=require(_0x68ed('0x7'));module[_0x68ed('0x8')]=function(_0xad7d6d,_0x463c8b){return _0xad7d6d['define'](_0x68ed('0x9'),attributes,{'tableName':_0x68ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f4a=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','moment','bluebird','path','rimraf'];(function(_0x3b3642,_0x3a2286){var _0x3a0b8c=function(_0x5d92bb){while(--_0x5d92bb){_0x3b3642['push'](_0x3b3642['shift']());}};_0x3a0b8c(++_0x3a2286);}(_0x0f4a,0x186));var _0xa0f4=function(_0x336cda,_0x3a7718){_0x336cda=_0x336cda-0x0;var _0x190b40=_0x0f4a[_0x336cda];return _0x190b40;};'use strict';var _=require(_0xa0f4('0x0'));var util=require(_0xa0f4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0f4('0x2'));var BPromise=require(_0xa0f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0f4('0x4'));var rimraf=require(_0xa0f4('0x5'));var config=require(_0xa0f4('0x6'));var attributes=require(_0xa0f4('0x7'));module[_0xa0f4('0x8')]=function(_0x4e1e7f,_0x75333e){return _0x4e1e7f[_0xa0f4('0x9')](_0xa0f4('0xa'),attributes,{'tableName':'sms_queues','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 5a87977..0839034 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 _0x1221=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','then','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','include','map','model','attributes','ShowSmsQueue','lodash'];(function(_0x4d0d97,_0xf4be3a){var _0x5310ff=function(_0x365f91){while(--_0x365f91){_0x4d0d97['push'](_0x4d0d97['shift']());}};_0x5310ff(++_0xf4be3a);}(_0x1221,0x1e0));var _0x1122=function(_0x265f30,_0x33e263){_0x265f30=_0x265f30-0x0;var _0x30a9bd=_0x1221[_0x265f30];return _0x30a9bd;};'use strict';var _=require(_0x1122('0x0'));var util=require(_0x1122('0x1'));var moment=require(_0x1122('0x2'));var BPromise=require(_0x1122('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1122('0x4'));var db=require(_0x1122('0x5'))['db'];var utils=require(_0x1122('0x6'));var logger=require(_0x1122('0x7'))(_0x1122('0x8'));var config=require(_0x1122('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1122('0xa')]['http']({'port':0x232a});config['redis']=_[_0x1122('0xb')](config[_0x1122('0xc')],{'host':_0x1122('0xd'),'port':0x18eb});var socket=require(_0x1122('0xe'))(new Redis(config[_0x1122('0xc')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2a16a4,_0x23d61f,_0x34ec47){return new BPromise(function(_0x3ce8cf,_0x3bc949){return client['request'](_0x2a16a4,_0x34ec47)[_0x1122('0xf')](function(_0xb341eb){logger['info'](_0x1122('0x10'),_0x23d61f,'request\x20sent');logger[_0x1122('0x11')](_0x1122('0x12'),_0x23d61f,_0x1122('0x13'),JSON[_0x1122('0x14')](_0xb341eb));if(_0xb341eb[_0x1122('0x15')]){if(_0xb341eb[_0x1122('0x15')][_0x1122('0x16')]===0x1f4){logger[_0x1122('0x15')](_0x1122('0x10'),_0x23d61f,_0xb341eb[_0x1122('0x15')][_0x1122('0x17')]);return _0x3bc949(_0xb341eb[_0x1122('0x15')][_0x1122('0x17')]);}logger[_0x1122('0x15')](_0x1122('0x10'),_0x23d61f,_0xb341eb[_0x1122('0x15')][_0x1122('0x17')]);return _0x3ce8cf(_0xb341eb[_0x1122('0x15')][_0x1122('0x17')]);}else{logger[_0x1122('0x18')](_0x1122('0x10'),_0x23d61f,'request\x20sent');_0x3ce8cf(_0xb341eb['result'][_0x1122('0x17')]);}})[_0x1122('0x19')](function(_0x1bad7a){logger['error'](_0x1122('0x10'),_0x23d61f,_0x1bad7a);_0x3bc949(_0x1bad7a);});});}exports[_0x1122('0x1a')]=function(_0x407fda){var _0x1732ae=this;return new Promise(function(_0x4b4f05,_0x41b16a){return db[_0x1122('0x1b')][_0x1122('0x1c')]({'raw':_0x407fda[_0x1122('0x1d')]?_0x407fda[_0x1122('0x1d')][_0x1122('0x1e')]===undefined?!![]:![]:!![],'where':_0x407fda[_0x1122('0x1d')]?_0x407fda[_0x1122('0x1d')][_0x1122('0x1f')]||null:null,'attributes':_0x407fda[_0x1122('0x1d')]?_0x407fda[_0x1122('0x1d')]['attributes']||null:null,'limit':_0x407fda[_0x1122('0x1d')]?_0x407fda[_0x1122('0x1d')]['limit']||null:null,'include':_0x407fda['options']?_0x407fda[_0x1122('0x1d')][_0x1122('0x20')]?_[_0x1122('0x21')](_0x407fda['options'][_0x1122('0x20')],function(_0x1c6402){return{'model':db[_0x1c6402[_0x1122('0x22')]],'as':_0x1c6402['as'],'attributes':_0x1c6402[_0x1122('0x23')],'include':_0x1c6402['include']?_[_0x1122('0x21')](_0x1c6402[_0x1122('0x20')],function(_0x2048ef){return{'model':db[_0x2048ef[_0x1122('0x22')]],'as':_0x2048ef['as'],'attributes':_0x2048ef['attributes'],'include':_0x2048ef[_0x1122('0x20')]?_['map'](_0x2048ef[_0x1122('0x20')],function(_0x53d817){return{'model':db[_0x53d817[_0x1122('0x22')]],'as':_0x53d817['as'],'attributes':_0x53d817['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x211552){logger[_0x1122('0x18')](_0x1122('0x1a'),_0x407fda);logger[_0x1122('0x11')](_0x1122('0x1a'),_0x407fda,JSON[_0x1122('0x14')](_0x211552));_0x4b4f05(_0x211552);})[_0x1122('0x19')](function(_0x4d6d10){logger[_0x1122('0x15')](_0x1122('0x1a'),_0x4d6d10[_0x1122('0x17')],_0x407fda);_0x41b16a(_0x1732ae[_0x1122('0x15')](0x1f4,_0x4d6d10['message']));});});};exports[_0x1122('0x24')]=function(_0x22b087){var _0x1dfe20=this;return new Promise(function(_0x18bfa4,_0x59ef74){return db[_0x1122('0x1b')]['find']({'raw':_0x22b087[_0x1122('0x1d')]?_0x22b087['options']['raw']===undefined?!![]:![]:!![],'where':_0x22b087[_0x1122('0x1d')]?_0x22b087['options'][_0x1122('0x1f')]||null:null,'attributes':_0x22b087[_0x1122('0x1d')]?_0x22b087[_0x1122('0x1d')][_0x1122('0x23')]||null:null,'include':_0x22b087[_0x1122('0x1d')]?_0x22b087[_0x1122('0x1d')][_0x1122('0x20')]?_['map'](_0x22b087['options'][_0x1122('0x20')],function(_0x253493){return{'model':db[_0x253493[_0x1122('0x22')]],'as':_0x253493['as'],'attributes':_0x253493['attributes'],'include':_0x253493[_0x1122('0x20')]?_[_0x1122('0x21')](_0x253493[_0x1122('0x20')],function(_0x9dbff4){return{'model':db[_0x9dbff4[_0x1122('0x22')]],'as':_0x9dbff4['as'],'attributes':_0x9dbff4[_0x1122('0x23')],'include':_0x9dbff4[_0x1122('0x20')]?_['map'](_0x9dbff4[_0x1122('0x20')],function(_0x11a424){return{'model':db[_0x11a424[_0x1122('0x22')]],'as':_0x11a424['as'],'attributes':_0x11a424[_0x1122('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1122('0xf')](function(_0x1698cb){logger[_0x1122('0x18')](_0x1122('0x24'),_0x22b087);logger[_0x1122('0x11')]('ShowSmsQueue',_0x22b087,JSON[_0x1122('0x14')](_0x1698cb));_0x18bfa4(_0x1698cb);})[_0x1122('0x19')](function(_0x54aae5){logger[_0x1122('0x15')](_0x1122('0x24'),_0x54aae5[_0x1122('0x17')],_0x22b087);_0x59ef74(_0x1dfe20['error'](0x1f4,_0x54aae5['message']));});});}; \ No newline at end of file +var _0xbc74=['request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','SmsQueue','findAll','options','raw','where','attributes','include','model','map','then','GetSmsQueue','debug','ShowSmsQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','SmsQueue,\x20%s,\x20%s'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xbc74,0x1c3));var _0x4bc7=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbc74[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x4bc7('0x0'));var util=require(_0x4bc7('0x1'));var moment=require(_0x4bc7('0x2'));var BPromise=require('bluebird');var rs=require(_0x4bc7('0x3'));var fs=require('fs');var Redis=require(_0x4bc7('0x4'));var db=require(_0x4bc7('0x5'))['db'];var utils=require(_0x4bc7('0x6'));var logger=require('../../config/logger')(_0x4bc7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4bc7('0x8')][_0x4bc7('0x9')]({'port':0x232a});config[_0x4bc7('0xa')]=_[_0x4bc7('0xb')](config[_0x4bc7('0xa')],{'host':_0x4bc7('0xc'),'port':0x18eb});var socket=require(_0x4bc7('0xd'))(new Redis(config[_0x4bc7('0xa')]));require(_0x4bc7('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ad6b0,_0x1f2101,_0x3bfee0){return new BPromise(function(_0x39ef26,_0x48e26d){return client[_0x4bc7('0xf')](_0x4ad6b0,_0x3bfee0)['then'](function(_0xbe6ee6){logger['info'](_0x4bc7('0x10'),_0x1f2101,_0x4bc7('0x11'));logger['debug'](_0x4bc7('0x12'),_0x1f2101,_0x4bc7('0x11'),JSON[_0x4bc7('0x13')](_0xbe6ee6));if(_0xbe6ee6[_0x4bc7('0x14')]){if(_0xbe6ee6[_0x4bc7('0x14')]['code']===0x1f4){logger['error'](_0x4bc7('0x10'),_0x1f2101,_0xbe6ee6[_0x4bc7('0x14')][_0x4bc7('0x15')]);return _0x48e26d(_0xbe6ee6[_0x4bc7('0x14')][_0x4bc7('0x15')]);}logger['error'](_0x4bc7('0x10'),_0x1f2101,_0xbe6ee6[_0x4bc7('0x14')][_0x4bc7('0x15')]);return _0x39ef26(_0xbe6ee6[_0x4bc7('0x14')][_0x4bc7('0x15')]);}else{logger[_0x4bc7('0x16')](_0x4bc7('0x10'),_0x1f2101,_0x4bc7('0x11'));_0x39ef26(_0xbe6ee6[_0x4bc7('0x17')][_0x4bc7('0x15')]);}})[_0x4bc7('0x18')](function(_0x344670){logger[_0x4bc7('0x14')]('SmsQueue,\x20%s,\x20%s',_0x1f2101,_0x344670);_0x48e26d(_0x344670);});});}exports['GetSmsQueue']=function(_0x4a6928){var _0x7a7b1c=this;return new Promise(function(_0xf90971,_0x3eba05){return db[_0x4bc7('0x19')][_0x4bc7('0x1a')]({'raw':_0x4a6928[_0x4bc7('0x1b')]?_0x4a6928[_0x4bc7('0x1b')][_0x4bc7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a6928['options']?_0x4a6928[_0x4bc7('0x1b')][_0x4bc7('0x1d')]||null:null,'attributes':_0x4a6928['options']?_0x4a6928['options'][_0x4bc7('0x1e')]||null:null,'limit':_0x4a6928[_0x4bc7('0x1b')]?_0x4a6928[_0x4bc7('0x1b')]['limit']||null:null,'include':_0x4a6928[_0x4bc7('0x1b')]?_0x4a6928[_0x4bc7('0x1b')][_0x4bc7('0x1f')]?_['map'](_0x4a6928[_0x4bc7('0x1b')][_0x4bc7('0x1f')],function(_0x3a621c){return{'model':db[_0x3a621c[_0x4bc7('0x20')]],'as':_0x3a621c['as'],'attributes':_0x3a621c['attributes'],'include':_0x3a621c[_0x4bc7('0x1f')]?_[_0x4bc7('0x21')](_0x3a621c['include'],function(_0x582df0){return{'model':db[_0x582df0[_0x4bc7('0x20')]],'as':_0x582df0['as'],'attributes':_0x582df0[_0x4bc7('0x1e')],'include':_0x582df0[_0x4bc7('0x1f')]?_['map'](_0x582df0[_0x4bc7('0x1f')],function(_0x4de6ea){return{'model':db[_0x4de6ea[_0x4bc7('0x20')]],'as':_0x4de6ea['as'],'attributes':_0x4de6ea[_0x4bc7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4bc7('0x22')](function(_0x48ba2f){logger[_0x4bc7('0x16')](_0x4bc7('0x23'),_0x4a6928);logger[_0x4bc7('0x24')]('GetSmsQueue',_0x4a6928,JSON['stringify'](_0x48ba2f));_0xf90971(_0x48ba2f);})[_0x4bc7('0x18')](function(_0x3c3b69){logger['error'](_0x4bc7('0x23'),_0x3c3b69[_0x4bc7('0x15')],_0x4a6928);_0x3eba05(_0x7a7b1c[_0x4bc7('0x14')](0x1f4,_0x3c3b69[_0x4bc7('0x15')]));});});};exports[_0x4bc7('0x25')]=function(_0x3c89bc){var _0x477d8e=this;return new Promise(function(_0x2c26c5,_0x45133b){return db[_0x4bc7('0x19')][_0x4bc7('0x26')]({'raw':_0x3c89bc[_0x4bc7('0x1b')]?_0x3c89bc[_0x4bc7('0x1b')][_0x4bc7('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c89bc[_0x4bc7('0x1b')]?_0x3c89bc[_0x4bc7('0x1b')]['where']||null:null,'attributes':_0x3c89bc[_0x4bc7('0x1b')]?_0x3c89bc[_0x4bc7('0x1b')][_0x4bc7('0x1e')]||null:null,'include':_0x3c89bc[_0x4bc7('0x1b')]?_0x3c89bc[_0x4bc7('0x1b')][_0x4bc7('0x1f')]?_[_0x4bc7('0x21')](_0x3c89bc[_0x4bc7('0x1b')][_0x4bc7('0x1f')],function(_0x14fb89){return{'model':db[_0x14fb89[_0x4bc7('0x20')]],'as':_0x14fb89['as'],'attributes':_0x14fb89['attributes'],'include':_0x14fb89[_0x4bc7('0x1f')]?_[_0x4bc7('0x21')](_0x14fb89['include'],function(_0x419e7e){return{'model':db[_0x419e7e['model']],'as':_0x419e7e['as'],'attributes':_0x419e7e[_0x4bc7('0x1e')],'include':_0x419e7e['include']?_['map'](_0x419e7e['include'],function(_0x1d28a5){return{'model':db[_0x1d28a5[_0x4bc7('0x20')]],'as':_0x1d28a5['as'],'attributes':_0x1d28a5[_0x4bc7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4bc7('0x22')](function(_0x254c06){logger[_0x4bc7('0x16')](_0x4bc7('0x25'),_0x3c89bc);logger[_0x4bc7('0x24')]('ShowSmsQueue',_0x3c89bc,JSON[_0x4bc7('0x13')](_0x254c06));_0x2c26c5(_0x254c06);})['catch'](function(_0x524a37){logger[_0x4bc7('0x14')]('ShowSmsQueue',_0x524a37['message'],_0x3c89bc);_0x45133b(_0x477d8e['error'](0x1f4,_0x524a37['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2ace23b..5bab29a 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 _0xaf68=['smsQueue:','./smsQueue.events','save','remove','update','removeListener','register','length'];(function(_0x44d0ee,_0x1a50d8){var _0x4424fc=function(_0x284f25){while(--_0x284f25){_0x44d0ee['push'](_0x44d0ee['shift']());}};_0x4424fc(++_0x1a50d8);}(_0xaf68,0x151));var _0x8af6=function(_0x5500f4,_0x28837c){_0x5500f4=_0x5500f4-0x0;var _0x4bfda4=_0xaf68[_0x5500f4];return _0x4bfda4;};'use strict';var SmsQueueEvents=require(_0x8af6('0x0'));var events=[_0x8af6('0x1'),_0x8af6('0x2'),_0x8af6('0x3')];function createListener(_0x55bec3,_0x61193d){return function(_0x10b9f3){_0x61193d['emit'](_0x55bec3,_0x10b9f3);};}function removeListener(_0x27e08b,_0x2f013c){return function(){SmsQueueEvents[_0x8af6('0x4')](_0x27e08b,_0x2f013c);};}exports[_0x8af6('0x5')]=function(_0x55eadf){for(var _0x49a595=0x0,_0x3e54f6=events[_0x8af6('0x6')];_0x49a595<_0x3e54f6;_0x49a595++){var _0x54e074=events[_0x49a595];var _0x20d5f9=createListener(_0x8af6('0x7')+_0x54e074,_0x55eadf);SmsQueueEvents['on'](_0x54e074,_0x20d5f9);}}; \ No newline at end of file +var _0x0c52=['smsQueue:','./smsQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c52,0xa9));var _0x20c5=function(_0x29c9fe,_0x56c9d6){_0x29c9fe=_0x29c9fe-0x0;var _0x41778a=_0x0c52[_0x29c9fe];return _0x41778a;};'use strict';var SmsQueueEvents=require(_0x20c5('0x0'));var events=['save',_0x20c5('0x1'),_0x20c5('0x2')];function createListener(_0xb402d7,_0x217e55){return function(_0xabe313){_0x217e55[_0x20c5('0x3')](_0xb402d7,_0xabe313);};}function removeListener(_0x2ee475,_0x10605){return function(){SmsQueueEvents[_0x20c5('0x4')](_0x2ee475,_0x10605);};}exports[_0x20c5('0x5')]=function(_0x2a9dde){for(var _0x2085f1=0x0,_0x9625bc=events[_0x20c5('0x6')];_0x2085f1<_0x9625bc;_0x2085f1++){var _0x4cc464=events[_0x2085f1];var _0x3f167f=createListener(_0x20c5('0x7')+_0x4cc464,_0x2a9dde);SmsQueueEvents['on'](_0x4cc464,_0x3f167f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 5f50d21..12ccdf3 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 _0xceee=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','create','update','/:id','destroy','exports'];(function(_0x53a456,_0x1c3d73){var _0x19bf77=function(_0x252263){while(--_0x252263){_0x53a456['push'](_0x53a456['shift']());}};_0x19bf77(++_0x1c3d73);}(_0xceee,0xbb));var _0xecee=function(_0x1a5d02,_0x240865){_0x1a5d02=_0x1a5d02-0x0;var _0x1d3c69=_0xceee[_0x1a5d02];return _0x1d3c69;};'use strict';var multer=require(_0xecee('0x0'));var util=require(_0xecee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xecee('0x2'));var router=express[_0xecee('0x3')]();var fs_extra=require(_0xecee('0x4'));var auth=require(_0xecee('0x5'));var interaction=require(_0xecee('0x6'));var config=require(_0xecee('0x7'));var controller=require('./smsQueueReport.controller');router[_0xecee('0x8')]('/',auth[_0xecee('0x9')](),controller[_0xecee('0xa')]);router[_0xecee('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xecee('0xb')]);router[_0xecee('0x8')]('/:id',auth[_0xecee('0x9')](),controller['show']);router['post']('/',auth[_0xecee('0x9')](),controller[_0xecee('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xecee('0xd')]);router['delete'](_0xecee('0xe'),auth['isAuthenticated'](),controller[_0xecee('0xf')]);module[_0xecee('0x10')]=router; \ No newline at end of file +var _0x6f72=['update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x6f72,0xae));var _0x26f7=function(_0x27472b,_0x1e5ca1){_0x27472b=_0x27472b-0x0;var _0x249243=_0x6f72[_0x27472b];return _0x249243;};'use strict';var multer=require('multer');var util=require(_0x26f7('0x0'));var path=require(_0x26f7('0x1'));var timeout=require(_0x26f7('0x2'));var express=require('express');var router=express[_0x26f7('0x3')]();var fs_extra=require(_0x26f7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x26f7('0x5'));var config=require(_0x26f7('0x6'));var controller=require('./smsQueueReport.controller');router[_0x26f7('0x7')]('/',auth['isAuthenticated'](),controller[_0x26f7('0x8')]);router['get'](_0x26f7('0x9'),auth[_0x26f7('0xa')](),controller['describe']);router['get'](_0x26f7('0xb'),auth[_0x26f7('0xa')](),controller[_0x26f7('0xc')]);router[_0x26f7('0xd')]('/',auth[_0x26f7('0xa')](),controller[_0x26f7('0xe')]);router[_0x26f7('0xf')](_0x26f7('0xb'),auth['isAuthenticated'](),controller[_0x26f7('0x10')]);router['delete'](_0x26f7('0xb'),auth[_0x26f7('0xa')](),controller[_0x26f7('0x11')]);module[_0x26f7('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 9c1d476..d3caceb 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 _0x6316=['STRING','DATE','moment'];(function(_0x52b674,_0x4186bc){var _0x19a812=function(_0x1fab03){while(--_0x1fab03){_0x52b674['push'](_0x52b674['shift']());}};_0x19a812(++_0x4186bc);}(_0x6316,0x1d6));var _0x6631=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6316[_0x432682];return _0x463d05;};'use strict';var moment=require(_0x6631('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6631('0x1')]},'joinAt':{'type':Sequelize[_0x6631('0x2')]},'leaveAt':{'type':Sequelize[_0x6631('0x2')]},'acceptAt':{'type':Sequelize[_0x6631('0x2')]},'exitAt':{'type':Sequelize[_0x6631('0x2')]},'reason':{'type':Sequelize[_0x6631('0x1')]}}; \ No newline at end of file +var _0x3ba1=['sequelize','STRING','DATE','moment'];(function(_0x175513,_0x217e30){var _0x6b1769=function(_0x2790a5){while(--_0x2790a5){_0x175513['push'](_0x175513['shift']());}};_0x6b1769(++_0x217e30);}(_0x3ba1,0x10f));var _0x13ba=function(_0x36c14d,_0x1d8ac9){_0x36c14d=_0x36c14d-0x0;var _0x59087f=_0x3ba1[_0x36c14d];return _0x59087f;};'use strict';var moment=require(_0x13ba('0x0'));var Sequelize=require(_0x13ba('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x13ba('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x13ba('0x2')]},'joinAt':{'type':Sequelize[_0x13ba('0x3')]},'leaveAt':{'type':Sequelize[_0x13ba('0x3')]},'acceptAt':{'type':Sequelize[_0x13ba('0x3')]},'exitAt':{'type':Sequelize[_0x13ba('0x3')]},'reason':{'type':Sequelize[_0x13ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 658d7d1..32f2577 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 _0xbcb0=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','SmsQueueReport','rows','then','catch','show','params','rawAttributes','include','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','sendStatus','error','name','send','map','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x4aec32,_0x3f8e0e){var _0xefb8ba=function(_0x295e57){while(--_0x295e57){_0x4aec32['push'](_0x4aec32['shift']());}};_0xefb8ba(++_0x3f8e0e);}(_0xbcb0,0x1a5));var _0x0bcb=function(_0x1c420e,_0x15ead7){_0x1c420e=_0x1c420e-0x0;var _0x1930e6=_0xbcb0[_0x1c420e];return _0x1930e6;};'use strict';var emlformat=require(_0x0bcb('0x0'));var rimraf=require(_0x0bcb('0x1'));var zipdir=require(_0x0bcb('0x2'));var jsonpatch=require(_0x0bcb('0x3'));var rp=require(_0x0bcb('0x4'));var moment=require('moment');var BPromise=require(_0x0bcb('0x5'));var Mustache=require(_0x0bcb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0bcb('0x7'));var csv=require(_0x0bcb('0x8'));var ejs=require(_0x0bcb('0x9'));var fs=require('fs');var fs_extra=require(_0x0bcb('0xa'));var _=require('lodash');var squel=require(_0x0bcb('0xb'));var crypto=require(_0x0bcb('0xc'));var jsforce=require(_0x0bcb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0bcb('0x8'));var querystring=require(_0x0bcb('0xe'));var Papa=require(_0x0bcb('0xf'));var Redis=require(_0x0bcb('0x10'));var authService=require(_0x0bcb('0x11'));var qs=require(_0x0bcb('0x12'));var as=require(_0x0bcb('0x13'));var hardwareService=require(_0x0bcb('0x14'));var logger=require(_0x0bcb('0x15'))(_0x0bcb('0x16'));var utils=require(_0x0bcb('0x17'));var config=require(_0x0bcb('0x18'));var licenseUtil=require(_0x0bcb('0x19'));var db=require(_0x0bcb('0x1a'))['db'];function respondWithStatusCode(_0x275996,_0x54438c){_0x54438c=_0x54438c||0xcc;return function(_0x33b0b5){if(_0x33b0b5){return _0x275996['sendStatus'](_0x54438c);}return _0x275996['status'](_0x54438c)[_0x0bcb('0x1b')]();};}function respondWithResult(_0x4a0672,_0xef775c){_0xef775c=_0xef775c||0xc8;return function(_0x31991c){if(_0x31991c){return _0x4a0672['status'](_0xef775c)[_0x0bcb('0x1c')](_0x31991c);}};}function respondWithFilteredResult(_0x5df4af,_0x2f5c81){return function(_0x490ddc){if(_0x490ddc){var _0x6d23b1=typeof _0x2f5c81[_0x0bcb('0x1d')]===_0x0bcb('0x1e')&&typeof _0x2f5c81[_0x0bcb('0x1f')]===_0x0bcb('0x1e');var _0x35e879=_0x490ddc[_0x0bcb('0x20')];var _0x1d4b27=_0x6d23b1?0x0:_0x2f5c81[_0x0bcb('0x1d')];var _0x34f81c=_0x6d23b1?_0x490ddc[_0x0bcb('0x20')]:_0x2f5c81[_0x0bcb('0x1d')]+_0x2f5c81['limit'];var _0x2bc0c3;if(_0x34f81c>=_0x35e879){_0x34f81c=_0x35e879;_0x2bc0c3=0xc8;}else{_0x2bc0c3=0xce;}_0x5df4af[_0x0bcb('0x21')](_0x2bc0c3);return _0x5df4af[_0x0bcb('0x22')](_0x0bcb('0x23'),_0x1d4b27+'-'+_0x34f81c+'/'+_0x35e879)[_0x0bcb('0x1c')](_0x490ddc);}return null;};}function patchUpdates(_0x2c4e9b){return function(_0x434f3a){try{jsonpatch[_0x0bcb('0x24')](_0x434f3a,_0x2c4e9b,!![]);}catch(_0x31a9dd){return BPromise[_0x0bcb('0x25')](_0x31a9dd);}return _0x434f3a[_0x0bcb('0x26')]();};}function saveUpdates(_0x4b681d,_0x400e9d){return function(_0x570630){if(_0x570630){return _0x570630['update'](_0x4b681d)['then'](function(_0x4d0a1f){return _0x4d0a1f;});}return null;};}function removeEntity(_0x43fec2,_0x224314){return function(_0x5e5bad){if(_0x5e5bad){return _0x5e5bad[_0x0bcb('0x27')]()['then'](function(){_0x43fec2[_0x0bcb('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573aed,_0x18741b){return function(_0x50e106){if(!_0x50e106){_0x573aed[_0x0bcb('0x28')](0x194);}return _0x50e106;};}function handleError(_0x7db9ee,_0x51ade5){_0x51ade5=_0x51ade5||0x1f4;return function(_0x2bbf4b){logger[_0x0bcb('0x29')](_0x2bbf4b['stack']);if(_0x2bbf4b[_0x0bcb('0x2a')]){delete _0x2bbf4b['name'];}_0x7db9ee[_0x0bcb('0x21')](_0x51ade5)[_0x0bcb('0x2b')](_0x2bbf4b);};}exports['index']=function(_0x122425,_0x2e9f94){var _0x5628e3={},_0x2d991c={},_0x461a85={'count':0x0,'rows':[]};var _0x49e086=_[_0x0bcb('0x2c')](db['SmsQueueReport']['rawAttributes'],function(_0x25fe77){return{'name':_0x25fe77[_0x0bcb('0x2d')],'type':_0x25fe77[_0x0bcb('0x2e')][_0x0bcb('0x2f')]};});_0x2d991c[_0x0bcb('0x30')]=_['map'](_0x49e086,_0x0bcb('0x2a'));_0x2d991c[_0x0bcb('0x31')]=_[_0x0bcb('0x32')](_0x122425[_0x0bcb('0x31')]);_0x2d991c[_0x0bcb('0x33')]=_['intersection'](_0x2d991c[_0x0bcb('0x30')],_0x2d991c['query']);_0x5628e3[_0x0bcb('0x34')]=_[_0x0bcb('0x35')](_0x2d991c[_0x0bcb('0x30')],qs[_0x0bcb('0x36')](_0x122425[_0x0bcb('0x31')][_0x0bcb('0x36')]));_0x5628e3[_0x0bcb('0x34')]=_0x5628e3[_0x0bcb('0x34')][_0x0bcb('0x37')]?_0x5628e3['attributes']:_0x2d991c[_0x0bcb('0x30')];if(!_0x122425[_0x0bcb('0x31')][_0x0bcb('0x38')](_0x0bcb('0x39'))){_0x5628e3[_0x0bcb('0x1f')]=qs[_0x0bcb('0x1f')](_0x122425[_0x0bcb('0x31')]['limit']);_0x5628e3[_0x0bcb('0x1d')]=qs['offset'](_0x122425['query'][_0x0bcb('0x1d')]);}_0x5628e3[_0x0bcb('0x3a')]=qs[_0x0bcb('0x3b')](_0x122425['query']['sort']);_0x5628e3[_0x0bcb('0x3c')]=qs['filters'](_[_0x0bcb('0x3d')](_0x122425[_0x0bcb('0x31')],_0x2d991c[_0x0bcb('0x33')]),_0x49e086);if(_0x122425[_0x0bcb('0x31')]['filter']){_0x5628e3['where']=_['merge'](_0x5628e3[_0x0bcb('0x3c')],{'$or':_['map'](_0x49e086,function(_0x41c32d){if(_0x41c32d[_0x0bcb('0x2e')]!==_0x0bcb('0x3e')){var _0x4532f7={};_0x4532f7[_0x41c32d['name']]={'$like':'%'+_0x122425['query']['filter']+'%'};return _0x4532f7;}})});}_0x5628e3=_[_0x0bcb('0x3f')]({},_0x5628e3,_0x122425[_0x0bcb('0x40')]);var _0x1a9a5d={'where':_0x5628e3[_0x0bcb('0x3c')]};return db['SmsQueueReport'][_0x0bcb('0x20')](_0x1a9a5d)['then'](function(_0x5b6b58){_0x461a85[_0x0bcb('0x20')]=_0x5b6b58;if(_0x122425[_0x0bcb('0x31')][_0x0bcb('0x41')]){_0x5628e3['include']=[{'all':!![]}];}return db[_0x0bcb('0x42')]['findAll'](_0x5628e3);})['then'](function(_0xcdcf65){_0x461a85[_0x0bcb('0x43')]=_0xcdcf65;return _0x461a85;})[_0x0bcb('0x44')](respondWithFilteredResult(_0x2e9f94,_0x5628e3))[_0x0bcb('0x45')](handleError(_0x2e9f94,null));};exports[_0x0bcb('0x46')]=function(_0x17db3f,_0x2e9d28){var _0x2b28eb={'raw':!![],'where':{'id':_0x17db3f[_0x0bcb('0x47')]['id']}},_0x556d25={};_0x556d25[_0x0bcb('0x30')]=_[_0x0bcb('0x32')](db[_0x0bcb('0x42')][_0x0bcb('0x48')]);_0x556d25[_0x0bcb('0x31')]=_['keys'](_0x17db3f[_0x0bcb('0x31')]);_0x556d25['filters']=_[_0x0bcb('0x35')](_0x556d25[_0x0bcb('0x30')],_0x556d25[_0x0bcb('0x31')]);_0x2b28eb[_0x0bcb('0x34')]=_[_0x0bcb('0x35')](_0x556d25[_0x0bcb('0x30')],qs[_0x0bcb('0x36')](_0x17db3f['query'][_0x0bcb('0x36')]));_0x2b28eb[_0x0bcb('0x34')]=_0x2b28eb[_0x0bcb('0x34')][_0x0bcb('0x37')]?_0x2b28eb[_0x0bcb('0x34')]:_0x556d25['model'];if(_0x17db3f[_0x0bcb('0x31')][_0x0bcb('0x41')]){_0x2b28eb[_0x0bcb('0x49')]=[{'all':!![]}];}_0x2b28eb=_[_0x0bcb('0x3f')]({},_0x2b28eb,_0x17db3f[_0x0bcb('0x40')]);return db[_0x0bcb('0x42')]['find'](_0x2b28eb)[_0x0bcb('0x44')](handleEntityNotFound(_0x2e9d28,null))['then'](respondWithResult(_0x2e9d28,null))[_0x0bcb('0x45')](handleError(_0x2e9d28,null));};exports[_0x0bcb('0x4a')]=function(_0x5cd85f,_0x22d16a){return db[_0x0bcb('0x42')][_0x0bcb('0x4a')](_0x5cd85f['body'],{})[_0x0bcb('0x44')](respondWithResult(_0x22d16a,0xc9))[_0x0bcb('0x45')](handleError(_0x22d16a,null));};exports[_0x0bcb('0x4b')]=function(_0x5f0a34,_0x5b550d){if(_0x5f0a34[_0x0bcb('0x4c')]['id']){delete _0x5f0a34[_0x0bcb('0x4c')]['id'];}return db['SmsQueueReport'][_0x0bcb('0x4d')]({'where':{'id':_0x5f0a34[_0x0bcb('0x47')]['id']}})[_0x0bcb('0x44')](handleEntityNotFound(_0x5b550d,null))[_0x0bcb('0x44')](saveUpdates(_0x5f0a34[_0x0bcb('0x4c')],null))[_0x0bcb('0x44')](respondWithResult(_0x5b550d,null))[_0x0bcb('0x45')](handleError(_0x5b550d,null));};exports[_0x0bcb('0x27')]=function(_0x24b4f1,_0xea505d){return db[_0x0bcb('0x42')][_0x0bcb('0x4d')]({'where':{'id':_0x24b4f1[_0x0bcb('0x47')]['id']}})['then'](handleEntityNotFound(_0xea505d,null))['then'](removeEntity(_0xea505d,null))[_0x0bcb('0x45')](handleError(_0xea505d,null));};exports[_0x0bcb('0x4e')]=function(_0x3b33b1,_0x10deeb){return db['SmsQueueReport'][_0x0bcb('0x4e')]()[_0x0bcb('0x44')](respondWithResult(_0x10deeb,null))[_0x0bcb('0x45')](handleError(_0x10deeb,null));}; \ No newline at end of file +var _0x830a=['../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x830a,0x169));var _0xa830=function(_0x122e03,_0x4d1dca){_0x122e03=_0x122e03-0x0;var _0x22d881=_0x830a[_0x122e03];return _0x22d881;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa830('0x0'));var zipdir=require(_0xa830('0x1'));var jsonpatch=require(_0xa830('0x2'));var rp=require(_0xa830('0x3'));var moment=require('moment');var BPromise=require(_0xa830('0x4'));var Mustache=require(_0xa830('0x5'));var util=require('util');var path=require(_0xa830('0x6'));var sox=require(_0xa830('0x7'));var csv=require('to-csv');var ejs=require(_0xa830('0x8'));var fs=require('fs');var fs_extra=require(_0xa830('0x9'));var _=require(_0xa830('0xa'));var squel=require(_0xa830('0xb'));var crypto=require('crypto');var jsforce=require(_0xa830('0xc'));var deskjs=require(_0xa830('0xd'));var toCsv=require(_0xa830('0xe'));var querystring=require('querystring');var Papa=require(_0xa830('0xf'));var Redis=require(_0xa830('0x10'));var authService=require(_0xa830('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa830('0x12'));var hardwareService=require(_0xa830('0x13'));var logger=require('../../config/logger')(_0xa830('0x14'));var utils=require(_0xa830('0x15'));var config=require(_0xa830('0x16'));var licenseUtil=require(_0xa830('0x17'));var db=require(_0xa830('0x18'))['db'];function respondWithStatusCode(_0x251e10,_0x149248){_0x149248=_0x149248||0xcc;return function(_0x2cd9f3){if(_0x2cd9f3){return _0x251e10['sendStatus'](_0x149248);}return _0x251e10[_0xa830('0x19')](_0x149248)[_0xa830('0x1a')]();};}function respondWithResult(_0x4df1f9,_0x430811){_0x430811=_0x430811||0xc8;return function(_0x401065){if(_0x401065){return _0x4df1f9['status'](_0x430811)['json'](_0x401065);}};}function respondWithFilteredResult(_0x345920,_0x365f88){return function(_0x3352f9){if(_0x3352f9){var _0x299ff2=typeof _0x365f88[_0xa830('0x1b')]===_0xa830('0x1c')&&typeof _0x365f88[_0xa830('0x1d')]===_0xa830('0x1c');var _0x5da878=_0x3352f9[_0xa830('0x1e')];var _0x5633e0=_0x299ff2?0x0:_0x365f88[_0xa830('0x1b')];var _0x19fd78=_0x299ff2?_0x3352f9['count']:_0x365f88[_0xa830('0x1b')]+_0x365f88[_0xa830('0x1d')];var _0x5da5cf;if(_0x19fd78>=_0x5da878){_0x19fd78=_0x5da878;_0x5da5cf=0xc8;}else{_0x5da5cf=0xce;}_0x345920[_0xa830('0x19')](_0x5da5cf);return _0x345920[_0xa830('0x1f')](_0xa830('0x20'),_0x5633e0+'-'+_0x19fd78+'/'+_0x5da878)[_0xa830('0x21')](_0x3352f9);}return null;};}function patchUpdates(_0x58d93a){return function(_0x1feeba){try{jsonpatch[_0xa830('0x22')](_0x1feeba,_0x58d93a,!![]);}catch(_0x46d6ae){return BPromise[_0xa830('0x23')](_0x46d6ae);}return _0x1feeba['save']();};}function saveUpdates(_0xbe8099,_0x1b5b63){return function(_0x3f79c1){if(_0x3f79c1){return _0x3f79c1[_0xa830('0x24')](_0xbe8099)['then'](function(_0x2abc58){return _0x2abc58;});}return null;};}function removeEntity(_0x3eba5b,_0x1e6c5d){return function(_0x524d09){if(_0x524d09){return _0x524d09['destroy']()[_0xa830('0x25')](function(){_0x3eba5b[_0xa830('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a50d3,_0x1aaa61){return function(_0x4f7115){if(!_0x4f7115){_0x1a50d3[_0xa830('0x26')](0x194);}return _0x4f7115;};}function handleError(_0x679a2a,_0x37f42d){_0x37f42d=_0x37f42d||0x1f4;return function(_0x4317fe){logger[_0xa830('0x27')](_0x4317fe[_0xa830('0x28')]);if(_0x4317fe[_0xa830('0x29')]){delete _0x4317fe[_0xa830('0x29')];}_0x679a2a[_0xa830('0x19')](_0x37f42d)['send'](_0x4317fe);};}exports[_0xa830('0x2a')]=function(_0xee9158,_0x4bb17a){var _0x8b4048={},_0x434ff7={},_0x38be21={'count':0x0,'rows':[]};var _0x45457b=_[_0xa830('0x2b')](db[_0xa830('0x2c')][_0xa830('0x2d')],function(_0x4d45ec){return{'name':_0x4d45ec[_0xa830('0x2e')],'type':_0x4d45ec[_0xa830('0x2f')][_0xa830('0x30')]};});_0x434ff7[_0xa830('0x31')]=_[_0xa830('0x2b')](_0x45457b,_0xa830('0x29'));_0x434ff7[_0xa830('0x32')]=_[_0xa830('0x33')](_0xee9158['query']);_0x434ff7[_0xa830('0x34')]=_[_0xa830('0x35')](_0x434ff7['model'],_0x434ff7[_0xa830('0x32')]);_0x8b4048[_0xa830('0x36')]=_[_0xa830('0x35')](_0x434ff7[_0xa830('0x31')],qs[_0xa830('0x37')](_0xee9158[_0xa830('0x32')][_0xa830('0x37')]));_0x8b4048['attributes']=_0x8b4048[_0xa830('0x36')]['length']?_0x8b4048['attributes']:_0x434ff7[_0xa830('0x31')];if(!_0xee9158[_0xa830('0x32')]['hasOwnProperty'](_0xa830('0x38'))){_0x8b4048[_0xa830('0x1d')]=qs['limit'](_0xee9158[_0xa830('0x32')]['limit']);_0x8b4048[_0xa830('0x1b')]=qs[_0xa830('0x1b')](_0xee9158[_0xa830('0x32')]['offset']);}_0x8b4048[_0xa830('0x39')]=qs[_0xa830('0x3a')](_0xee9158[_0xa830('0x32')][_0xa830('0x3a')]);_0x8b4048[_0xa830('0x3b')]=qs['filters'](_[_0xa830('0x3c')](_0xee9158[_0xa830('0x32')],_0x434ff7[_0xa830('0x34')]),_0x45457b);if(_0xee9158[_0xa830('0x32')][_0xa830('0x3d')]){_0x8b4048[_0xa830('0x3b')]=_[_0xa830('0x3e')](_0x8b4048[_0xa830('0x3b')],{'$or':_['map'](_0x45457b,function(_0x362073){if(_0x362073[_0xa830('0x2f')]!==_0xa830('0x3f')){var _0x31c296={};_0x31c296[_0x362073[_0xa830('0x29')]]={'$like':'%'+_0xee9158[_0xa830('0x32')]['filter']+'%'};return _0x31c296;}})});}_0x8b4048=_[_0xa830('0x3e')]({},_0x8b4048,_0xee9158[_0xa830('0x40')]);var _0x57cc6d={'where':_0x8b4048[_0xa830('0x3b')]};return db[_0xa830('0x2c')][_0xa830('0x1e')](_0x57cc6d)[_0xa830('0x25')](function(_0x159a5c){_0x38be21['count']=_0x159a5c;if(_0xee9158['query'][_0xa830('0x41')]){_0x8b4048[_0xa830('0x42')]=[{'all':!![]}];}return db[_0xa830('0x2c')]['findAll'](_0x8b4048);})[_0xa830('0x25')](function(_0x19ca6e){_0x38be21[_0xa830('0x43')]=_0x19ca6e;return _0x38be21;})['then'](respondWithFilteredResult(_0x4bb17a,_0x8b4048))[_0xa830('0x44')](handleError(_0x4bb17a,null));};exports[_0xa830('0x45')]=function(_0x432f47,_0x503add){var _0x253563={'raw':!![],'where':{'id':_0x432f47[_0xa830('0x46')]['id']}},_0x531aa9={};_0x531aa9[_0xa830('0x31')]=_[_0xa830('0x33')](db[_0xa830('0x2c')]['rawAttributes']);_0x531aa9[_0xa830('0x32')]=_[_0xa830('0x33')](_0x432f47['query']);_0x531aa9[_0xa830('0x34')]=_[_0xa830('0x35')](_0x531aa9[_0xa830('0x31')],_0x531aa9[_0xa830('0x32')]);_0x253563[_0xa830('0x36')]=_[_0xa830('0x35')](_0x531aa9[_0xa830('0x31')],qs[_0xa830('0x37')](_0x432f47[_0xa830('0x32')][_0xa830('0x37')]));_0x253563[_0xa830('0x36')]=_0x253563[_0xa830('0x36')][_0xa830('0x47')]?_0x253563['attributes']:_0x531aa9[_0xa830('0x31')];if(_0x432f47[_0xa830('0x32')]['includeAll']){_0x253563[_0xa830('0x42')]=[{'all':!![]}];}_0x253563=_[_0xa830('0x3e')]({},_0x253563,_0x432f47[_0xa830('0x40')]);return db['SmsQueueReport']['find'](_0x253563)['then'](handleEntityNotFound(_0x503add,null))[_0xa830('0x25')](respondWithResult(_0x503add,null))[_0xa830('0x44')](handleError(_0x503add,null));};exports[_0xa830('0x48')]=function(_0x3e6a64,_0x4caf8d){return db[_0xa830('0x2c')][_0xa830('0x48')](_0x3e6a64[_0xa830('0x49')],{})['then'](respondWithResult(_0x4caf8d,0xc9))['catch'](handleError(_0x4caf8d,null));};exports['update']=function(_0x306244,_0x2e1c10){if(_0x306244[_0xa830('0x49')]['id']){delete _0x306244[_0xa830('0x49')]['id'];}return db['SmsQueueReport'][_0xa830('0x4a')]({'where':{'id':_0x306244[_0xa830('0x46')]['id']}})[_0xa830('0x25')](handleEntityNotFound(_0x2e1c10,null))[_0xa830('0x25')](saveUpdates(_0x306244[_0xa830('0x49')],null))[_0xa830('0x25')](respondWithResult(_0x2e1c10,null))[_0xa830('0x44')](handleError(_0x2e1c10,null));};exports[_0xa830('0x4b')]=function(_0x146fd3,_0x3026b8){return db[_0xa830('0x2c')][_0xa830('0x4a')]({'where':{'id':_0x146fd3[_0xa830('0x46')]['id']}})[_0xa830('0x25')](handleEntityNotFound(_0x3026b8,null))[_0xa830('0x25')](removeEntity(_0x3026b8,null))[_0xa830('0x44')](handleError(_0x3026b8,null));};exports['describe']=function(_0x29bd3b,_0x567655){return db[_0xa830('0x2c')][_0xa830('0x4c')]()[_0xa830('0x25')](respondWithResult(_0x567655,null))[_0xa830('0x44')](handleError(_0x567655,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 14bd859..35ab2a3 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3ddabf,_0x2a634f){var _0x27184c=function(_0x26248e){while(--_0x26248e){_0x3ddabf['push'](_0x3ddabf['shift']());}};_0x27184c(++_0x2a634f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb7e7[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 5dadcfa..0f41497 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 _0x8d23=['CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','create','body','options','raw','then'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8d23,0x8b));var _0x38d2=function(_0x580b92,_0xbe72a6){_0x580b92=_0x580b92-0x0;var _0x25d964=_0x8d23[_0x580b92];return _0x25d964;};'use strict';var _=require(_0x38d2('0x0'));var util=require('util');var moment=require(_0x38d2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38d2('0x2'));var db=require(_0x38d2('0x3'))['db'];var utils=require(_0x38d2('0x4'));var logger=require(_0x38d2('0x5'))(_0x38d2('0x6'));var config=require(_0x38d2('0x7'));var jayson=require(_0x38d2('0x8'));var client=jayson[_0x38d2('0x9')][_0x38d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1461ce,_0x542f30,_0x942087){return new BPromise(function(_0x55b0af,_0x509e19){return client[_0x38d2('0xb')](_0x1461ce,_0x942087)['then'](function(_0x2f4705){logger[_0x38d2('0xc')](_0x38d2('0xd'),_0x542f30,_0x38d2('0xe'));logger[_0x38d2('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x542f30,'request\x20sent',JSON[_0x38d2('0x10')](_0x2f4705));if(_0x2f4705['error']){if(_0x2f4705[_0x38d2('0x11')][_0x38d2('0x12')]===0x1f4){logger[_0x38d2('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x542f30,_0x2f4705['error']['message']);return _0x509e19(_0x2f4705[_0x38d2('0x11')]['message']);}logger[_0x38d2('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x542f30,_0x2f4705[_0x38d2('0x11')][_0x38d2('0x13')]);return _0x55b0af(_0x2f4705[_0x38d2('0x11')]['message']);}else{logger[_0x38d2('0xc')](_0x38d2('0xd'),_0x542f30,_0x38d2('0xe'));_0x55b0af(_0x2f4705['result']['message']);}})[_0x38d2('0x14')](function(_0x4849ab){logger[_0x38d2('0x11')](_0x38d2('0xd'),_0x542f30,_0x4849ab);_0x509e19(_0x4849ab);});});}exports['CreateSmsQueueReport']=function(_0x16626){var _0x470f93=this;return new Promise(function(_0x862c3,_0x320475){return db['SmsQueueReport'][_0x38d2('0x15')](_0x16626[_0x38d2('0x16')],{'raw':_0x16626['options']?_0x16626[_0x38d2('0x17')][_0x38d2('0x18')]===undefined?!![]:![]:!![]})[_0x38d2('0x19')](function(_0x4ce166){logger[_0x38d2('0xc')](_0x38d2('0x1a'),_0x16626);logger[_0x38d2('0xf')](_0x38d2('0x1a'),_0x16626,JSON[_0x38d2('0x10')](_0x4ce166));_0x862c3(_0x4ce166);})[_0x38d2('0x14')](function(_0x174563){logger['error']('CreateSmsQueueReport',_0x174563[_0x38d2('0x13')],_0x16626);_0x320475(_0x470f93[_0x38d2('0x11')](0x1f4,_0x174563[_0x38d2('0x13')]));});});};exports[_0x38d2('0x1b')]=function(_0x41fbf0){var _0x374280=this;return new Promise(function(_0xab882a,_0x101f00){return db[_0x38d2('0x1c')][_0x38d2('0x1d')](_0x41fbf0[_0x38d2('0x16')],{'raw':_0x41fbf0[_0x38d2('0x17')]?_0x41fbf0['options'][_0x38d2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41fbf0['options']?_0x41fbf0[_0x38d2('0x17')][_0x38d2('0x1e')]||null:null,'attributes':_0x41fbf0['options']?_0x41fbf0[_0x38d2('0x17')][_0x38d2('0x1f')]||null:null,'limit':_0x41fbf0[_0x38d2('0x17')]?_0x41fbf0[_0x38d2('0x17')][_0x38d2('0x20')]||null:null})[_0x38d2('0x19')](function(_0x1aefc0){logger[_0x38d2('0xc')](_0x38d2('0x1b'),_0x41fbf0);logger[_0x38d2('0xf')](_0x38d2('0x1b'),_0x41fbf0,JSON[_0x38d2('0x10')](_0x1aefc0));_0xab882a(_0x1aefc0);})[_0x38d2('0x14')](function(_0x2f9533){logger[_0x38d2('0x11')]('UpdateSmsQueueReport',_0x2f9533[_0x38d2('0x13')],_0x41fbf0);_0x101f00(_0x374280[_0x38d2('0x11')](0x1f4,_0x2f9533[_0x38d2('0x13')]));});});}; \ No newline at end of file +var _0xc8c9=['message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2ba663,_0x45247c){var _0x2b54a9=function(_0x4fce55){while(--_0x4fce55){_0x2ba663['push'](_0x2ba663['shift']());}};_0x2b54a9(++_0x45247c);}(_0xc8c9,0x72));var _0x9c8c=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xc8c9[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require(_0x9c8c('0x0'));var util=require(_0x9c8c('0x1'));var moment=require(_0x9c8c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9c8c('0x3'));var logger=require(_0x9c8c('0x4'))(_0x9c8c('0x5'));var config=require(_0x9c8c('0x6'));var jayson=require(_0x9c8c('0x7'));var client=jayson[_0x9c8c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x565989,_0x519abf,_0x40727e){return new BPromise(function(_0x197b82,_0x1b4a56){return client[_0x9c8c('0x9')](_0x565989,_0x40727e)[_0x9c8c('0xa')](function(_0x97a4a0){logger['info'](_0x9c8c('0xb'),_0x519abf,_0x9c8c('0xc'));logger[_0x9c8c('0xd')](_0x9c8c('0xe'),_0x519abf,_0x9c8c('0xc'),JSON[_0x9c8c('0xf')](_0x97a4a0));if(_0x97a4a0[_0x9c8c('0x10')]){if(_0x97a4a0[_0x9c8c('0x10')][_0x9c8c('0x11')]===0x1f4){logger[_0x9c8c('0x10')](_0x9c8c('0xb'),_0x519abf,_0x97a4a0['error']['message']);return _0x1b4a56(_0x97a4a0[_0x9c8c('0x10')]['message']);}logger[_0x9c8c('0x10')](_0x9c8c('0xb'),_0x519abf,_0x97a4a0[_0x9c8c('0x10')][_0x9c8c('0x12')]);return _0x197b82(_0x97a4a0[_0x9c8c('0x10')][_0x9c8c('0x12')]);}else{logger[_0x9c8c('0x13')](_0x9c8c('0xb'),_0x519abf,_0x9c8c('0xc'));_0x197b82(_0x97a4a0[_0x9c8c('0x14')]['message']);}})[_0x9c8c('0x15')](function(_0x52a698){logger[_0x9c8c('0x10')](_0x9c8c('0xb'),_0x519abf,_0x52a698);_0x1b4a56(_0x52a698);});});}exports[_0x9c8c('0x16')]=function(_0x366cca){var _0x5bd4e0=this;return new Promise(function(_0x489df0,_0x4e2359){return db[_0x9c8c('0x17')][_0x9c8c('0x18')](_0x366cca['body'],{'raw':_0x366cca[_0x9c8c('0x19')]?_0x366cca['options'][_0x9c8c('0x1a')]===undefined?!![]:![]:!![]})[_0x9c8c('0xa')](function(_0x591d21){logger[_0x9c8c('0x13')](_0x9c8c('0x16'),_0x366cca);logger['debug'](_0x9c8c('0x16'),_0x366cca,JSON[_0x9c8c('0xf')](_0x591d21));_0x489df0(_0x591d21);})[_0x9c8c('0x15')](function(_0x2f63a6){logger[_0x9c8c('0x10')](_0x9c8c('0x16'),_0x2f63a6[_0x9c8c('0x12')],_0x366cca);_0x4e2359(_0x5bd4e0[_0x9c8c('0x10')](0x1f4,_0x2f63a6[_0x9c8c('0x12')]));});});};exports[_0x9c8c('0x1b')]=function(_0x3c42d2){var _0x633277=this;return new Promise(function(_0x25ce71,_0x1f02b5){return db['SmsQueueReport'][_0x9c8c('0x1c')](_0x3c42d2[_0x9c8c('0x1d')],{'raw':_0x3c42d2[_0x9c8c('0x19')]?_0x3c42d2[_0x9c8c('0x19')][_0x9c8c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c42d2[_0x9c8c('0x19')]?_0x3c42d2[_0x9c8c('0x19')][_0x9c8c('0x1e')]||null:null,'attributes':_0x3c42d2[_0x9c8c('0x19')]?_0x3c42d2[_0x9c8c('0x19')][_0x9c8c('0x1f')]||null:null,'limit':_0x3c42d2['options']?_0x3c42d2['options'][_0x9c8c('0x20')]||null:null})[_0x9c8c('0xa')](function(_0x49842c){logger[_0x9c8c('0x13')]('UpdateSmsQueueReport',_0x3c42d2);logger['debug']('UpdateSmsQueueReport',_0x3c42d2,JSON[_0x9c8c('0xf')](_0x49842c));_0x25ce71(_0x49842c);})['catch'](function(_0x3fde81){logger[_0x9c8c('0x10')](_0x9c8c('0x1b'),_0x3fde81[_0x9c8c('0x12')],_0x3c42d2);_0x1f02b5(_0x633277[_0x9c8c('0x10')](0x1f4,_0x3fde81['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 97ddb4a..9636928 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 _0x4006=['path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4006,0x1c7));var _0x6400=function(_0x30942e,_0x5ef683){_0x30942e=_0x30942e-0x0;var _0x4fe670=_0x4006[_0x30942e];return _0x4fe670;};'use strict';var multer=require('multer');var util=require(_0x6400('0x0'));var path=require(_0x6400('0x1'));var timeout=require(_0x6400('0x2'));var express=require(_0x6400('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6400('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6400('0x5'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x6400('0x6')](),controller['index']);router[_0x6400('0x7')](_0x6400('0x8'),auth[_0x6400('0x6')](),controller[_0x6400('0x9')]);router['get'](_0x6400('0xa'),auth[_0x6400('0x6')](),controller[_0x6400('0xb')]);router[_0x6400('0xc')]('/',auth[_0x6400('0x6')](),controller[_0x6400('0xd')]);router[_0x6400('0xe')](_0x6400('0xa'),auth[_0x6400('0x6')](),controller[_0x6400('0xf')]);router[_0x6400('0x10')]('/:id',auth[_0x6400('0x6')](),controller[_0x6400('0x11')]);module[_0x6400('0x12')]=router; \ No newline at end of file +var _0xca9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xca9e,0x136));var _0xeca9=function(_0x15580c,_0x56cf27){_0x15580c=_0x15580c-0x0;var _0x34995b=_0xca9e[_0x15580c];return _0x34995b;};'use strict';var multer=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var path=require(_0xeca9('0x2'));var timeout=require(_0xeca9('0x3'));var express=require(_0xeca9('0x4'));var router=express[_0xeca9('0x5')]();var fs_extra=require(_0xeca9('0x6'));var auth=require(_0xeca9('0x7'));var interaction=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var controller=require(_0xeca9('0xa'));router[_0xeca9('0xb')]('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0xd')]);router['get'](_0xeca9('0xe'),auth[_0xeca9('0xc')](),controller['describe']);router['get'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x10')]);router['post']('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0x11')]);router[_0xeca9('0x12')](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x13')]);router['delete'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller['destroy']);module[_0xeca9('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index bda59f0..d1939bf 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x59df82,_0x4cf8f9){var _0x163c1c=function(_0x1976ea){while(--_0x1976ea){_0x59df82['push'](_0x59df82['shift']());}};_0x163c1c(++_0x4cf8f9);}(_0xedd9,0xfc));var _0x9edd=function(_0x12564a,_0x286a8b){_0x12564a=_0x12564a-0x0;var _0x3d1678=_0xedd9[_0x12564a];return _0x3d1678;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xd73467,_0x162a6){var _0x25c77d=function(_0x522022){while(--_0x522022){_0xd73467['push'](_0xd73467['shift']());}};_0x25c77d(++_0x162a6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0xcb91[_0x1ebe90];return _0x447c82;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 81d853d..508d417 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 _0x7b8d=['create','describe','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','SmsTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','includeAll','include','rows','catch','show','params','options','find'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x7b8d,0x126));var _0xd7b8=function(_0x44afca,_0x58d28b){_0x44afca=_0x44afca-0x0;var _0x380bc4=_0x7b8d[_0x44afca];return _0x380bc4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd7b8('0x0'));var jsonpatch=require(_0xd7b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd7b8('0x2'));var Mustache=require(_0xd7b8('0x3'));var util=require(_0xd7b8('0x4'));var path=require(_0xd7b8('0x5'));var sox=require(_0xd7b8('0x6'));var csv=require(_0xd7b8('0x7'));var ejs=require(_0xd7b8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7b8('0x9'));var squel=require(_0xd7b8('0xa'));var crypto=require(_0xd7b8('0xb'));var jsforce=require(_0xd7b8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd7b8('0x7'));var querystring=require(_0xd7b8('0xd'));var Papa=require(_0xd7b8('0xe'));var Redis=require('ioredis');var authService=require(_0xd7b8('0xf'));var qs=require(_0xd7b8('0x10'));var as=require(_0xd7b8('0x11'));var hardwareService=require(_0xd7b8('0x12'));var logger=require(_0xd7b8('0x13'))(_0xd7b8('0x14'));var utils=require(_0xd7b8('0x15'));var config=require(_0xd7b8('0x16'));var licenseUtil=require(_0xd7b8('0x17'));var db=require(_0xd7b8('0x18'))['db'];function respondWithStatusCode(_0x444ca5,_0x1a0bfc){_0x1a0bfc=_0x1a0bfc||0xcc;return function(_0x1d6fc2){if(_0x1d6fc2){return _0x444ca5[_0xd7b8('0x19')](_0x1a0bfc);}return _0x444ca5[_0xd7b8('0x1a')](_0x1a0bfc)['end']();};}function respondWithResult(_0x19c7d7,_0x2e7ba9){_0x2e7ba9=_0x2e7ba9||0xc8;return function(_0x45fe91){if(_0x45fe91){return _0x19c7d7[_0xd7b8('0x1a')](_0x2e7ba9)[_0xd7b8('0x1b')](_0x45fe91);}};}function respondWithFilteredResult(_0x25a9a9,_0x2aad6f){return function(_0x29aca4){if(_0x29aca4){var _0x131ff7=typeof _0x2aad6f[_0xd7b8('0x1c')]===_0xd7b8('0x1d')&&typeof _0x2aad6f[_0xd7b8('0x1e')]===_0xd7b8('0x1d');var _0x351e1c=_0x29aca4[_0xd7b8('0x1f')];var _0x227190=_0x131ff7?0x0:_0x2aad6f[_0xd7b8('0x1c')];var _0x48bd8b=_0x131ff7?_0x29aca4[_0xd7b8('0x1f')]:_0x2aad6f[_0xd7b8('0x1c')]+_0x2aad6f['limit'];var _0x5d2028;if(_0x48bd8b>=_0x351e1c){_0x48bd8b=_0x351e1c;_0x5d2028=0xc8;}else{_0x5d2028=0xce;}_0x25a9a9[_0xd7b8('0x1a')](_0x5d2028);return _0x25a9a9[_0xd7b8('0x20')](_0xd7b8('0x21'),_0x227190+'-'+_0x48bd8b+'/'+_0x351e1c)[_0xd7b8('0x1b')](_0x29aca4);}return null;};}function patchUpdates(_0x2599e8){return function(_0x33ebb3){try{jsonpatch['apply'](_0x33ebb3,_0x2599e8,!![]);}catch(_0x328154){return BPromise[_0xd7b8('0x22')](_0x328154);}return _0x33ebb3[_0xd7b8('0x23')]();};}function saveUpdates(_0x5a88d0,_0x58023f){return function(_0x9b995b){if(_0x9b995b){return _0x9b995b[_0xd7b8('0x24')](_0x5a88d0)[_0xd7b8('0x25')](function(_0x5326d0){return _0x5326d0;});}return null;};}function removeEntity(_0x32d99e,_0x5c72e9){return function(_0x1d3015){if(_0x1d3015){return _0x1d3015[_0xd7b8('0x26')]()[_0xd7b8('0x25')](function(){_0x32d99e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1abbab,_0x214dba){return function(_0x39e61c){if(!_0x39e61c){_0x1abbab[_0xd7b8('0x19')](0x194);}return _0x39e61c;};}function handleError(_0x52567f,_0x557bf0){_0x557bf0=_0x557bf0||0x1f4;return function(_0x8b37d9){logger['error'](_0x8b37d9[_0xd7b8('0x27')]);if(_0x8b37d9[_0xd7b8('0x28')]){delete _0x8b37d9[_0xd7b8('0x28')];}_0x52567f['status'](_0x557bf0)[_0xd7b8('0x29')](_0x8b37d9);};}exports['index']=function(_0x11f913,_0x44cb47){var _0x126d18={},_0xe81a={},_0x5dc4fe={'count':0x0,'rows':[]};var _0x16e057=_['map'](db[_0xd7b8('0x2a')][_0xd7b8('0x2b')],function(_0x9d5414){return{'name':_0x9d5414[_0xd7b8('0x2c')],'type':_0x9d5414[_0xd7b8('0x2d')]['key']};});_0xe81a[_0xd7b8('0x2e')]=_['map'](_0x16e057,'name');_0xe81a[_0xd7b8('0x2f')]=_[_0xd7b8('0x30')](_0x11f913['query']);_0xe81a[_0xd7b8('0x31')]=_[_0xd7b8('0x32')](_0xe81a['model'],_0xe81a['query']);_0x126d18[_0xd7b8('0x33')]=_[_0xd7b8('0x32')](_0xe81a[_0xd7b8('0x2e')],qs['fields'](_0x11f913['query'][_0xd7b8('0x34')]));_0x126d18[_0xd7b8('0x33')]=_0x126d18[_0xd7b8('0x33')][_0xd7b8('0x35')]?_0x126d18[_0xd7b8('0x33')]:_0xe81a['model'];if(!_0x11f913[_0xd7b8('0x2f')][_0xd7b8('0x36')](_0xd7b8('0x37'))){_0x126d18[_0xd7b8('0x1e')]=qs[_0xd7b8('0x1e')](_0x11f913[_0xd7b8('0x2f')][_0xd7b8('0x1e')]);_0x126d18[_0xd7b8('0x1c')]=qs[_0xd7b8('0x1c')](_0x11f913[_0xd7b8('0x2f')][_0xd7b8('0x1c')]);}_0x126d18[_0xd7b8('0x38')]=qs[_0xd7b8('0x39')](_0x11f913[_0xd7b8('0x2f')][_0xd7b8('0x39')]);_0x126d18[_0xd7b8('0x3a')]=qs[_0xd7b8('0x31')](_[_0xd7b8('0x3b')](_0x11f913['query'],_0xe81a[_0xd7b8('0x31')]),_0x16e057);if(_0x11f913[_0xd7b8('0x2f')][_0xd7b8('0x3c')]){_0x126d18[_0xd7b8('0x3a')]=_['merge'](_0x126d18[_0xd7b8('0x3a')],{'$or':_[_0xd7b8('0x3d')](_0x16e057,function(_0x578277){if(_0x578277[_0xd7b8('0x2d')]!==_0xd7b8('0x3e')){var _0x191c21={};_0x191c21[_0x578277[_0xd7b8('0x28')]]={'$like':'%'+_0x11f913[_0xd7b8('0x2f')]['filter']+'%'};return _0x191c21;}})});}_0x126d18=_['merge']({},_0x126d18,_0x11f913['options']);var _0x37cefd={'where':_0x126d18['where']};return db['SmsTransferReport'][_0xd7b8('0x1f')](_0x37cefd)['then'](function(_0x3a7f90){_0x5dc4fe[_0xd7b8('0x1f')]=_0x3a7f90;if(_0x11f913[_0xd7b8('0x2f')][_0xd7b8('0x3f')]){_0x126d18[_0xd7b8('0x40')]=[{'all':!![]}];}return db[_0xd7b8('0x2a')]['findAll'](_0x126d18);})[_0xd7b8('0x25')](function(_0x3afa4e){_0x5dc4fe[_0xd7b8('0x41')]=_0x3afa4e;return _0x5dc4fe;})[_0xd7b8('0x25')](respondWithFilteredResult(_0x44cb47,_0x126d18))[_0xd7b8('0x42')](handleError(_0x44cb47,null));};exports[_0xd7b8('0x43')]=function(_0x764478,_0x125c3f){var _0x174970={'raw':!![],'where':{'id':_0x764478[_0xd7b8('0x44')]['id']}},_0x21fbbc={};_0x21fbbc[_0xd7b8('0x2e')]=_[_0xd7b8('0x30')](db['SmsTransferReport']['rawAttributes']);_0x21fbbc['query']=_['keys'](_0x764478[_0xd7b8('0x2f')]);_0x21fbbc[_0xd7b8('0x31')]=_[_0xd7b8('0x32')](_0x21fbbc['model'],_0x21fbbc[_0xd7b8('0x2f')]);_0x174970[_0xd7b8('0x33')]=_[_0xd7b8('0x32')](_0x21fbbc[_0xd7b8('0x2e')],qs[_0xd7b8('0x34')](_0x764478[_0xd7b8('0x2f')]['fields']));_0x174970[_0xd7b8('0x33')]=_0x174970[_0xd7b8('0x33')]['length']?_0x174970[_0xd7b8('0x33')]:_0x21fbbc[_0xd7b8('0x2e')];if(_0x764478['query']['includeAll']){_0x174970[_0xd7b8('0x40')]=[{'all':!![]}];}_0x174970=_['merge']({},_0x174970,_0x764478[_0xd7b8('0x45')]);return db[_0xd7b8('0x2a')][_0xd7b8('0x46')](_0x174970)['then'](handleEntityNotFound(_0x125c3f,null))[_0xd7b8('0x25')](respondWithResult(_0x125c3f,null))[_0xd7b8('0x42')](handleError(_0x125c3f,null));};exports[_0xd7b8('0x47')]=function(_0x1e12af,_0xca9939){return db[_0xd7b8('0x2a')][_0xd7b8('0x47')](_0x1e12af['body'],{})['then'](respondWithResult(_0xca9939,0xc9))['catch'](handleError(_0xca9939,null));};exports[_0xd7b8('0x24')]=function(_0x236e76,_0x3dfec5){if(_0x236e76['body']['id']){delete _0x236e76['body']['id'];}return db[_0xd7b8('0x2a')]['find']({'where':{'id':_0x236e76['params']['id']}})['then'](handleEntityNotFound(_0x3dfec5,null))[_0xd7b8('0x25')](saveUpdates(_0x236e76['body'],null))[_0xd7b8('0x25')](respondWithResult(_0x3dfec5,null))[_0xd7b8('0x42')](handleError(_0x3dfec5,null));};exports[_0xd7b8('0x26')]=function(_0x2b23a6,_0x2c7480){return db['SmsTransferReport'][_0xd7b8('0x46')]({'where':{'id':_0x2b23a6[_0xd7b8('0x44')]['id']}})[_0xd7b8('0x25')](handleEntityNotFound(_0x2c7480,null))['then'](removeEntity(_0x2c7480,null))[_0xd7b8('0x42')](handleError(_0x2c7480,null));};exports[_0xd7b8('0x48')]=function(_0x4a71ef,_0x5dddce){return db['SmsTransferReport'][_0xd7b8('0x48')]()['then'](respondWithResult(_0x5dddce,null))[_0xd7b8('0x42')](handleError(_0x5dddce,null));}; \ No newline at end of file +var _0x9aca=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','apply','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','SmsTransferReport','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5265da,_0x1eac7e){var _0x2cd309=function(_0x114e2c){while(--_0x114e2c){_0x5265da['push'](_0x5265da['shift']());}};_0x2cd309(++_0x1eac7e);}(_0x9aca,0x84));var _0xa9ac=function(_0x481e1f,_0x3d5996){_0x481e1f=_0x481e1f-0x0;var _0x1c4426=_0x9aca[_0x481e1f];return _0x1c4426;};'use strict';var emlformat=require(_0xa9ac('0x0'));var rimraf=require(_0xa9ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9ac('0x2'));var rp=require(_0xa9ac('0x3'));var moment=require(_0xa9ac('0x4'));var BPromise=require(_0xa9ac('0x5'));var Mustache=require(_0xa9ac('0x6'));var util=require(_0xa9ac('0x7'));var path=require(_0xa9ac('0x8'));var sox=require('sox');var csv=require(_0xa9ac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ac('0xa'));var _=require(_0xa9ac('0xb'));var squel=require(_0xa9ac('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa9ac('0xd'));var Papa=require(_0xa9ac('0xe'));var Redis=require(_0xa9ac('0xf'));var authService=require(_0xa9ac('0x10'));var qs=require(_0xa9ac('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9ac('0x12'));var logger=require(_0xa9ac('0x13'))(_0xa9ac('0x14'));var utils=require(_0xa9ac('0x15'));var config=require(_0xa9ac('0x16'));var licenseUtil=require(_0xa9ac('0x17'));var db=require(_0xa9ac('0x18'))['db'];function respondWithStatusCode(_0x58ca0f,_0x2cb756){_0x2cb756=_0x2cb756||0xcc;return function(_0x2be946){if(_0x2be946){return _0x58ca0f[_0xa9ac('0x19')](_0x2cb756);}return _0x58ca0f[_0xa9ac('0x1a')](_0x2cb756)['end']();};}function respondWithResult(_0x29c54c,_0x436e0f){_0x436e0f=_0x436e0f||0xc8;return function(_0x46f441){if(_0x46f441){return _0x29c54c[_0xa9ac('0x1a')](_0x436e0f)[_0xa9ac('0x1b')](_0x46f441);}};}function respondWithFilteredResult(_0x1ab2fe,_0x34fc37){return function(_0x40b12f){if(_0x40b12f){var _0x173cd3=typeof _0x34fc37['offset']===_0xa9ac('0x1c')&&typeof _0x34fc37['limit']===_0xa9ac('0x1c');var _0x2232e3=_0x40b12f[_0xa9ac('0x1d')];var _0x5c3aa3=_0x173cd3?0x0:_0x34fc37['offset'];var _0x1bdcd3=_0x173cd3?_0x40b12f[_0xa9ac('0x1d')]:_0x34fc37[_0xa9ac('0x1e')]+_0x34fc37[_0xa9ac('0x1f')];var _0x1399b1;if(_0x1bdcd3>=_0x2232e3){_0x1bdcd3=_0x2232e3;_0x1399b1=0xc8;}else{_0x1399b1=0xce;}_0x1ab2fe['status'](_0x1399b1);return _0x1ab2fe['set']('Content-Range',_0x5c3aa3+'-'+_0x1bdcd3+'/'+_0x2232e3)['json'](_0x40b12f);}return null;};}function patchUpdates(_0x86ae25){return function(_0x596a65){try{jsonpatch[_0xa9ac('0x20')](_0x596a65,_0x86ae25,!![]);}catch(_0x57609e){return BPromise['reject'](_0x57609e);}return _0x596a65[_0xa9ac('0x21')]();};}function saveUpdates(_0x50ba51,_0x42506d){return function(_0x225ce9){if(_0x225ce9){return _0x225ce9[_0xa9ac('0x22')](_0x50ba51)[_0xa9ac('0x23')](function(_0x1e4a84){return _0x1e4a84;});}return null;};}function removeEntity(_0xc12e38,_0x14626f){return function(_0xf8d5b1){if(_0xf8d5b1){return _0xf8d5b1[_0xa9ac('0x24')]()['then'](function(){_0xc12e38[_0xa9ac('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x867511,_0x214dac){return function(_0x551dbd){if(!_0x551dbd){_0x867511[_0xa9ac('0x19')](0x194);}return _0x551dbd;};}function handleError(_0x469c47,_0x53ea23){_0x53ea23=_0x53ea23||0x1f4;return function(_0x1abee8){logger[_0xa9ac('0x25')](_0x1abee8['stack']);if(_0x1abee8[_0xa9ac('0x26')]){delete _0x1abee8[_0xa9ac('0x26')];}_0x469c47[_0xa9ac('0x1a')](_0x53ea23)[_0xa9ac('0x27')](_0x1abee8);};}exports[_0xa9ac('0x28')]=function(_0x2af2b8,_0x56e8a9){var _0x24a86a={},_0x4e885e={},_0x63671a={'count':0x0,'rows':[]};var _0x372bc4=_[_0xa9ac('0x29')](db['SmsTransferReport'][_0xa9ac('0x2a')],function(_0x16b3d0){return{'name':_0x16b3d0[_0xa9ac('0x2b')],'type':_0x16b3d0[_0xa9ac('0x2c')][_0xa9ac('0x2d')]};});_0x4e885e['model']=_[_0xa9ac('0x29')](_0x372bc4,_0xa9ac('0x26'));_0x4e885e[_0xa9ac('0x2e')]=_[_0xa9ac('0x2f')](_0x2af2b8[_0xa9ac('0x2e')]);_0x4e885e[_0xa9ac('0x30')]=_[_0xa9ac('0x31')](_0x4e885e['model'],_0x4e885e[_0xa9ac('0x2e')]);_0x24a86a['attributes']=_[_0xa9ac('0x31')](_0x4e885e[_0xa9ac('0x32')],qs[_0xa9ac('0x33')](_0x2af2b8[_0xa9ac('0x2e')][_0xa9ac('0x33')]));_0x24a86a[_0xa9ac('0x34')]=_0x24a86a[_0xa9ac('0x34')]['length']?_0x24a86a[_0xa9ac('0x34')]:_0x4e885e[_0xa9ac('0x32')];if(!_0x2af2b8[_0xa9ac('0x2e')][_0xa9ac('0x35')](_0xa9ac('0x36'))){_0x24a86a[_0xa9ac('0x1f')]=qs['limit'](_0x2af2b8[_0xa9ac('0x2e')][_0xa9ac('0x1f')]);_0x24a86a['offset']=qs[_0xa9ac('0x1e')](_0x2af2b8['query'][_0xa9ac('0x1e')]);}_0x24a86a['order']=qs[_0xa9ac('0x37')](_0x2af2b8[_0xa9ac('0x2e')]['sort']);_0x24a86a[_0xa9ac('0x38')]=qs['filters'](_[_0xa9ac('0x39')](_0x2af2b8[_0xa9ac('0x2e')],_0x4e885e[_0xa9ac('0x30')]),_0x372bc4);if(_0x2af2b8[_0xa9ac('0x2e')]['filter']){_0x24a86a[_0xa9ac('0x38')]=_[_0xa9ac('0x3a')](_0x24a86a[_0xa9ac('0x38')],{'$or':_[_0xa9ac('0x29')](_0x372bc4,function(_0x22a569){if(_0x22a569[_0xa9ac('0x2c')]!==_0xa9ac('0x3b')){var _0x2c5b59={};_0x2c5b59[_0x22a569['name']]={'$like':'%'+_0x2af2b8[_0xa9ac('0x2e')][_0xa9ac('0x3c')]+'%'};return _0x2c5b59;}})});}_0x24a86a=_[_0xa9ac('0x3a')]({},_0x24a86a,_0x2af2b8[_0xa9ac('0x3d')]);var _0x3f7b5e={'where':_0x24a86a[_0xa9ac('0x38')]};return db[_0xa9ac('0x3e')][_0xa9ac('0x1d')](_0x3f7b5e)[_0xa9ac('0x23')](function(_0x5dcaa1){_0x63671a[_0xa9ac('0x1d')]=_0x5dcaa1;if(_0x2af2b8[_0xa9ac('0x2e')][_0xa9ac('0x3f')]){_0x24a86a['include']=[{'all':!![]}];}return db[_0xa9ac('0x3e')][_0xa9ac('0x40')](_0x24a86a);})[_0xa9ac('0x23')](function(_0x56af58){_0x63671a[_0xa9ac('0x41')]=_0x56af58;return _0x63671a;})['then'](respondWithFilteredResult(_0x56e8a9,_0x24a86a))[_0xa9ac('0x42')](handleError(_0x56e8a9,null));};exports[_0xa9ac('0x43')]=function(_0x4dbd4b,_0x2f5cbc){var _0x56748d={'raw':!![],'where':{'id':_0x4dbd4b[_0xa9ac('0x44')]['id']}},_0x24a71d={};_0x24a71d['model']=_[_0xa9ac('0x2f')](db['SmsTransferReport'][_0xa9ac('0x2a')]);_0x24a71d['query']=_[_0xa9ac('0x2f')](_0x4dbd4b[_0xa9ac('0x2e')]);_0x24a71d[_0xa9ac('0x30')]=_['intersection'](_0x24a71d['model'],_0x24a71d['query']);_0x56748d[_0xa9ac('0x34')]=_['intersection'](_0x24a71d[_0xa9ac('0x32')],qs[_0xa9ac('0x33')](_0x4dbd4b['query'][_0xa9ac('0x33')]));_0x56748d['attributes']=_0x56748d[_0xa9ac('0x34')][_0xa9ac('0x45')]?_0x56748d[_0xa9ac('0x34')]:_0x24a71d[_0xa9ac('0x32')];if(_0x4dbd4b[_0xa9ac('0x2e')][_0xa9ac('0x3f')]){_0x56748d[_0xa9ac('0x46')]=[{'all':!![]}];}_0x56748d=_[_0xa9ac('0x3a')]({},_0x56748d,_0x4dbd4b[_0xa9ac('0x3d')]);return db[_0xa9ac('0x3e')][_0xa9ac('0x47')](_0x56748d)[_0xa9ac('0x23')](handleEntityNotFound(_0x2f5cbc,null))[_0xa9ac('0x23')](respondWithResult(_0x2f5cbc,null))[_0xa9ac('0x42')](handleError(_0x2f5cbc,null));};exports['create']=function(_0x3c509a,_0x3aeb0a){return db[_0xa9ac('0x3e')][_0xa9ac('0x48')](_0x3c509a['body'],{})[_0xa9ac('0x23')](respondWithResult(_0x3aeb0a,0xc9))[_0xa9ac('0x42')](handleError(_0x3aeb0a,null));};exports[_0xa9ac('0x22')]=function(_0x9fabf2,_0x27b976){if(_0x9fabf2['body']['id']){delete _0x9fabf2[_0xa9ac('0x49')]['id'];}return db[_0xa9ac('0x3e')][_0xa9ac('0x47')]({'where':{'id':_0x9fabf2[_0xa9ac('0x44')]['id']}})[_0xa9ac('0x23')](handleEntityNotFound(_0x27b976,null))['then'](saveUpdates(_0x9fabf2[_0xa9ac('0x49')],null))[_0xa9ac('0x23')](respondWithResult(_0x27b976,null))[_0xa9ac('0x42')](handleError(_0x27b976,null));};exports['destroy']=function(_0x3a1462,_0x2f228f){return db[_0xa9ac('0x3e')]['find']({'where':{'id':_0x3a1462[_0xa9ac('0x44')]['id']}})[_0xa9ac('0x23')](handleEntityNotFound(_0x2f228f,null))[_0xa9ac('0x23')](removeEntity(_0x2f228f,null))[_0xa9ac('0x42')](handleError(_0x2f228f,null));};exports[_0xa9ac('0x4a')]=function(_0x356860,_0x343075){return db[_0xa9ac('0x3e')][_0xa9ac('0x4a')]()['then'](respondWithResult(_0x343075,null))[_0xa9ac('0x42')](handleError(_0x343075,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 8796e38..4b2ad1d 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 _0x01e8=['lodash','util','../../config/logger','moment','request-promise','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid'];(function(_0x2412ea,_0x11a2d1){var _0xdb290a=function(_0xb980fb){while(--_0xb980fb){_0x2412ea['push'](_0x2412ea['shift']());}};_0xdb290a(++_0x11a2d1);}(_0x01e8,0x6e));var _0x801e=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x01e8[_0x1c156e];return _0x58fc22;};'use strict';var _=require(_0x801e('0x0'));var util=require(_0x801e('0x1'));var logger=require(_0x801e('0x2'))('api');var moment=require(_0x801e('0x3'));var BPromise=require('bluebird');var rp=require(_0x801e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x801e('0x5'));var config=require('../../config/environment');var attributes=require(_0x801e('0x6'));module[_0x801e('0x7')]=function(_0x4994df,_0x2d4898){return _0x4994df[_0x801e('0x8')](_0x801e('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x801e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fec=['rimraf','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c5dce,_0x33eb99){var _0x1b4ef5=function(_0x5b5ce3){while(--_0x5b5ce3){_0x4c5dce['push'](_0x4c5dce['shift']());}};_0x1b4ef5(++_0x33eb99);}(_0x7fec,0x6e));var _0xc7fe=function(_0x1ffc7b,_0x3bf94b){_0x1ffc7b=_0x1ffc7b-0x0;var _0x298139=_0x7fec[_0x1ffc7b];return _0x298139;};'use strict';var _=require(_0xc7fe('0x0'));var util=require(_0xc7fe('0x1'));var logger=require(_0xc7fe('0x2'))(_0xc7fe('0x3'));var moment=require(_0xc7fe('0x4'));var BPromise=require(_0xc7fe('0x5'));var rp=require(_0xc7fe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7fe('0x7'));var config=require('../../config/environment');var attributes=require(_0xc7fe('0x8'));module[_0xc7fe('0x9')]=function(_0x2b7f4a,_0x5eafa3){return _0x2b7f4a['define'](_0xc7fe('0xa'),attributes,{'tableName':_0xc7fe('0xb'),'paranoid':![],'indexes':[{'name':_0xc7fe('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 82a7caa..ac2f419 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 _0x1b94=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util'];(function(_0x8a2e9d,_0xa7a01c){var _0xf64cdd=function(_0x491bd2){while(--_0x491bd2){_0x8a2e9d['push'](_0x8a2e9d['shift']());}};_0xf64cdd(++_0xa7a01c);}(_0x1b94,0x1f2));var _0x41b9=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x1b94[_0x616290];return _0x453879;};'use strict';var _=require(_0x41b9('0x0'));var util=require(_0x41b9('0x1'));var moment=require(_0x41b9('0x2'));var BPromise=require(_0x41b9('0x3'));var rs=require(_0x41b9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41b9('0x5'))['db'];var utils=require(_0x41b9('0x6'));var logger=require(_0x41b9('0x7'))('rpc');var config=require(_0x41b9('0x8'));var jayson=require(_0x41b9('0x9'));var client=jayson[_0x41b9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x310fd8,_0x3e9325,_0x2a0eed){return new BPromise(function(_0x37b187,_0x1cb1d6){return client['request'](_0x310fd8,_0x2a0eed)[_0x41b9('0xb')](function(_0x23d89b){logger['info'](_0x41b9('0xc'),_0x3e9325,_0x41b9('0xd'));logger['debug'](_0x41b9('0xe'),_0x3e9325,_0x41b9('0xd'),JSON['stringify'](_0x23d89b));if(_0x23d89b[_0x41b9('0xf')]){if(_0x23d89b['error'][_0x41b9('0x10')]===0x1f4){logger['error'](_0x41b9('0xc'),_0x3e9325,_0x23d89b[_0x41b9('0xf')][_0x41b9('0x11')]);return _0x1cb1d6(_0x23d89b[_0x41b9('0xf')][_0x41b9('0x11')]);}logger['error'](_0x41b9('0xc'),_0x3e9325,_0x23d89b[_0x41b9('0xf')]['message']);return _0x37b187(_0x23d89b[_0x41b9('0xf')][_0x41b9('0x11')]);}else{logger[_0x41b9('0x12')](_0x41b9('0xc'),_0x3e9325,'request\x20sent');_0x37b187(_0x23d89b['result']['message']);}})[_0x41b9('0x13')](function(_0x432cd7){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x3e9325,_0x432cd7);_0x1cb1d6(_0x432cd7);});});} \ No newline at end of file +var _0x029b=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x029b,0x66));var _0xb029=function(_0x179fc0,_0x3dec69){_0x179fc0=_0x179fc0-0x0;var _0x577091=_0x029b[_0x179fc0];return _0x577091;};'use strict';var _=require(_0xb029('0x0'));var util=require(_0xb029('0x1'));var moment=require('moment');var BPromise=require(_0xb029('0x2'));var rs=require(_0xb029('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb029('0x4'))['db'];var utils=require(_0xb029('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb029('0x6'));var jayson=require(_0xb029('0x7'));var client=jayson[_0xb029('0x8')][_0xb029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15871f,_0x48b100,_0x38e856){return new BPromise(function(_0x48b3d0,_0x3fffd9){return client['request'](_0x15871f,_0x38e856)[_0xb029('0xa')](function(_0x5a8bb7){logger[_0xb029('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x48b100,_0xb029('0xc'));logger[_0xb029('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x48b100,_0xb029('0xc'),JSON[_0xb029('0xe')](_0x5a8bb7));if(_0x5a8bb7[_0xb029('0xf')]){if(_0x5a8bb7[_0xb029('0xf')][_0xb029('0x10')]===0x1f4){logger['error'](_0xb029('0x11'),_0x48b100,_0x5a8bb7['error'][_0xb029('0x12')]);return _0x3fffd9(_0x5a8bb7[_0xb029('0xf')][_0xb029('0x12')]);}logger[_0xb029('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x48b100,_0x5a8bb7[_0xb029('0xf')][_0xb029('0x12')]);return _0x48b3d0(_0x5a8bb7[_0xb029('0xf')]['message']);}else{logger[_0xb029('0xb')](_0xb029('0x11'),_0x48b100,_0xb029('0xc'));_0x48b3d0(_0x5a8bb7[_0xb029('0x13')][_0xb029('0x12')]);}})[_0xb029('0x14')](function(_0x185292){logger[_0xb029('0xf')](_0xb029('0x11'),_0x48b100,_0x185292);_0x3fffd9(_0x185292);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b2e5ca7..9c83485 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 _0xa0eb=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','index','get','/:id','isAuthenticated','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','format','%s-%s%s','now','post','file','create','put','update','delete'];(function(_0x3d61c6,_0x4571e6){var _0x47e0df=function(_0x25adfd){while(--_0x25adfd){_0x3d61c6['push'](_0x3d61c6['shift']());}};_0x47e0df(++_0x4571e6);}(_0xa0eb,0x1b3));var _0xba0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa0eb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xba0e('0x0'));var util=require(_0xba0e('0x1'));var path=require(_0xba0e('0x2'));var timeout=require(_0xba0e('0x3'));var express=require(_0xba0e('0x4'));var router=express[_0xba0e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xba0e('0x6'));var interaction=require(_0xba0e('0x7'));var config=require(_0xba0e('0x8'));var controller=require(_0xba0e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xba0e('0xa')]);router[_0xba0e('0xb')](_0xba0e('0xc'),auth[_0xba0e('0xd')](),controller['show']);router['get'](_0xba0e('0xe'),auth[_0xba0e('0xd')](),controller[_0xba0e('0xf')]);var upload=multer({'storage':multer[_0xba0e('0x10')]({'destination':function(_0x3dc0e1,_0x29bf49,_0x2ba4a4){_0x2ba4a4(null,path['join'](config[_0xba0e('0x11')],_0xba0e('0x12')));},'filename':function(_0x22d5ed,_0x517713,_0x2c0088){_0x517713[_0xba0e('0x13')]=_0x517713[_0xba0e('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c0088(null,util[_0xba0e('0x14')](_0xba0e('0x15'),path['basename'](_0x517713['originalname'],path['extname'](_0x517713[_0xba0e('0x13')])),Date[_0xba0e('0x16')](),path['extname'](_0x517713[_0xba0e('0x13')])));}})});router[_0xba0e('0x17')]('/',upload['single'](_0xba0e('0x18')),controller[_0xba0e('0x19')]);router[_0xba0e('0x1a')](_0xba0e('0xc'),auth[_0xba0e('0xd')](),controller[_0xba0e('0x1b')]);router[_0xba0e('0x1c')](_0xba0e('0xc'),auth[_0xba0e('0xd')](),controller[_0xba0e('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xe441=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','/:id','get','download','diskStorage','join','server/files/sounds/original/','originalname','replace','basename','extname','now','post','single','file','create','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xe441,0xeb));var _0x1e44=function(_0x58d04a,_0x262f5a){_0x58d04a=_0x58d04a-0x0;var _0x32aae5=_0xe441[_0x58d04a];return _0x32aae5;};'use strict';var multer=require(_0x1e44('0x0'));var util=require(_0x1e44('0x1'));var path=require(_0x1e44('0x2'));var timeout=require(_0x1e44('0x3'));var express=require(_0x1e44('0x4'));var router=express['Router']();var fs_extra=require(_0x1e44('0x5'));var auth=require(_0x1e44('0x6'));var interaction=require(_0x1e44('0x7'));var config=require(_0x1e44('0x8'));var controller=require(_0x1e44('0x9'));router['get']('/',auth[_0x1e44('0xa')](),controller[_0x1e44('0xb')]);router['get'](_0x1e44('0xc'),auth[_0x1e44('0xa')](),controller['show']);router[_0x1e44('0xd')]('/:id/download',auth[_0x1e44('0xa')](),controller[_0x1e44('0xe')]);var upload=multer({'storage':multer[_0x1e44('0xf')]({'destination':function(_0x37d301,_0x255b06,_0x411197){_0x411197(null,path[_0x1e44('0x10')](config['root'],_0x1e44('0x11')));},'filename':function(_0x10c046,_0xc498c5,_0x15a1e){_0xc498c5[_0x1e44('0x12')]=_0xc498c5['originalname'][_0x1e44('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x15a1e(null,util['format']('%s-%s%s',path[_0x1e44('0x14')](_0xc498c5['originalname'],path[_0x1e44('0x15')](_0xc498c5[_0x1e44('0x12')])),Date[_0x1e44('0x16')](),path[_0x1e44('0x15')](_0xc498c5['originalname'])));}})});router[_0x1e44('0x17')]('/',upload[_0x1e44('0x18')](_0x1e44('0x19')),controller[_0x1e44('0x1a')]);router['put']('/:id',auth[_0x1e44('0xa')](),controller[_0x1e44('0x1b')]);router['delete'](_0x1e44('0xc'),auth[_0x1e44('0xa')](),controller[_0x1e44('0x1c')]);module[_0x1e44('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 67b58e0..d0784d7 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 _0x9282=['BIGINT','exports','name','STRING','FLOAT','INTEGER'];(function(_0x4499cf,_0xe955f6){var _0x350713=function(_0xb7fedb){while(--_0xb7fedb){_0x4499cf['push'](_0x4499cf['shift']());}};_0x350713(++_0xe955f6);}(_0x9282,0x1f3));var _0x2928=function(_0x127ed7,_0x18c2c5){_0x127ed7=_0x127ed7-0x0;var _0x17c7bb=_0x9282[_0x127ed7];return _0x17c7bb;};'use strict';var Sequelize=require('sequelize');module[_0x2928('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x2928('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2928('0x2')]},'display_name':{'type':Sequelize[_0x2928('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x2928('0x2')]},'original_duration':{'type':Sequelize[_0x2928('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x2928('0x4')]},'original_bitRate':{'type':Sequelize[_0x2928('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x2928('0x2')]},'converted_duration':{'type':Sequelize[_0x2928('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x2928('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x2928('0x4')]}}; \ No newline at end of file +var _0xfbb0=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x950bb0,_0x24f5b0){var _0x3e9366=function(_0x568ca6){while(--_0x568ca6){_0x950bb0['push'](_0x950bb0['shift']());}};_0x3e9366(++_0x24f5b0);}(_0xfbb0,0x115));var _0x0fbb=function(_0x3761c4,_0x428018){_0x3761c4=_0x3761c4-0x0;var _0x5d0c56=_0xfbb0[_0x3761c4];return _0x5d0c56;};'use strict';var Sequelize=require(_0x0fbb('0x0'));module[_0x0fbb('0x1')]={'name':{'type':Sequelize[_0x0fbb('0x2')],'unique':_0x0fbb('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0fbb('0x2')]},'display_name':{'type':Sequelize[_0x0fbb('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x0fbb('0x2')]},'original_format':{'type':Sequelize[_0x0fbb('0x2')]},'original_duration':{'type':Sequelize[_0x0fbb('0x4')]},'original_sampleCount':{'type':Sequelize[_0x0fbb('0x5')]},'original_channelCount':{'type':Sequelize[_0x0fbb('0x6')]},'original_bitRate':{'type':Sequelize[_0x0fbb('0x5')]},'original_sampleRate':{'type':Sequelize[_0x0fbb('0x6')]},'converted_format':{'type':Sequelize[_0x0fbb('0x2')]},'converted_duration':{'type':Sequelize[_0x0fbb('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x0fbb('0x6')]},'converted_bitRate':{'type':Sequelize[_0x0fbb('0x5')]},'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 9c4d3f0..edfa3fb 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 _0xda7d=['includeAll','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','duration','converted_sampleCount','converted_channelCount','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Sounds','error','stack','name','send','map','Sound','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','include','findAll','rows','catch','show','params','keys'];(function(_0x23426d,_0x2575cd){var _0x4f98dc=function(_0xadeb08){while(--_0xadeb08){_0x23426d['push'](_0x23426d['shift']());}};_0x4f98dc(++_0x2575cd);}(_0xda7d,0xaf));var _0xdda7=function(_0x34efa6,_0x343fe2){_0x34efa6=_0x34efa6-0x0;var _0x469490=_0xda7d[_0x34efa6];return _0x469490;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdda7('0x0'));var jsonpatch=require(_0xdda7('0x1'));var rp=require(_0xdda7('0x2'));var moment=require('moment');var BPromise=require(_0xdda7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdda7('0x4'));var sox=require(_0xdda7('0x5'));var csv=require(_0xdda7('0x6'));var ejs=require(_0xdda7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdda7('0x8'));var squel=require(_0xdda7('0x9'));var crypto=require(_0xdda7('0xa'));var jsforce=require(_0xdda7('0xb'));var deskjs=require(_0xdda7('0xc'));var toCsv=require(_0xdda7('0x6'));var querystring=require(_0xdda7('0xd'));var Papa=require(_0xdda7('0xe'));var Redis=require(_0xdda7('0xf'));var authService=require(_0xdda7('0x10'));var qs=require(_0xdda7('0x11'));var as=require(_0xdda7('0x12'));var hardwareService=require(_0xdda7('0x13'));var logger=require(_0xdda7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xdda7('0x15'));var licenseUtil=require(_0xdda7('0x16'));var db=require(_0xdda7('0x17'))['db'];function respondWithStatusCode(_0x523990,_0x35fd6d){_0x35fd6d=_0x35fd6d||0xcc;return function(_0x28975b){if(_0x28975b){return _0x523990[_0xdda7('0x18')](_0x35fd6d);}return _0x523990[_0xdda7('0x19')](_0x35fd6d)[_0xdda7('0x1a')]();};}function respondWithResult(_0x1db7bd,_0x4793ab){_0x4793ab=_0x4793ab||0xc8;return function(_0x361fd8){if(_0x361fd8){return _0x1db7bd['status'](_0x4793ab)[_0xdda7('0x1b')](_0x361fd8);}};}function respondWithFilteredResult(_0x2d4635,_0x28e605){return function(_0x1f7e2c){if(_0x1f7e2c){var _0x342932=typeof _0x28e605[_0xdda7('0x1c')]===_0xdda7('0x1d')&&typeof _0x28e605[_0xdda7('0x1e')]===_0xdda7('0x1d');var _0xa7c703=_0x1f7e2c[_0xdda7('0x1f')];var _0x4e9690=_0x342932?0x0:_0x28e605[_0xdda7('0x1c')];var _0x19762c=_0x342932?_0x1f7e2c[_0xdda7('0x1f')]:_0x28e605[_0xdda7('0x1c')]+_0x28e605[_0xdda7('0x1e')];var _0x44d936;if(_0x19762c>=_0xa7c703){_0x19762c=_0xa7c703;_0x44d936=0xc8;}else{_0x44d936=0xce;}_0x2d4635[_0xdda7('0x19')](_0x44d936);return _0x2d4635[_0xdda7('0x20')](_0xdda7('0x21'),_0x4e9690+'-'+_0x19762c+'/'+_0xa7c703)['json'](_0x1f7e2c);}return null;};}function patchUpdates(_0x3f8f3f){return function(_0x4c273d){try{jsonpatch[_0xdda7('0x22')](_0x4c273d,_0x3f8f3f,!![]);}catch(_0x4fdfc9){return BPromise['reject'](_0x4fdfc9);}return _0x4c273d['save']();};}function saveUpdates(_0x2f1e28,_0x4bbe87){return function(_0x254de5){if(_0x254de5){return _0x254de5[_0xdda7('0x23')](_0x2f1e28)[_0xdda7('0x24')](function(_0x3b3065){return _0x3b3065;});}return null;};}function removeEntity(_0x2840e0,_0x47ff79){return function(_0x62a49e){if(_0x62a49e){return _0x62a49e[_0xdda7('0x25')]()['then'](function(){var _0x4dca59=_0x62a49e[_0xdda7('0x26')]({'plain':!![]});var _0x152456=_0xdda7('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x152456,'resourceId':_0x4dca59['id']}})[_0xdda7('0x24')](function(){return _0x62a49e;});})[_0xdda7('0x24')](function(){_0x2840e0[_0xdda7('0x19')](0xcc)[_0xdda7('0x1a')]();});}};}function handleEntityNotFound(_0x31965c,_0x2b73e8){return function(_0x45afbe){if(!_0x45afbe){_0x31965c['sendStatus'](0x194);}return _0x45afbe;};}function handleError(_0x467c5c,_0x3099e1){_0x3099e1=_0x3099e1||0x1f4;return function(_0xc5d1d4){logger[_0xdda7('0x28')](_0xc5d1d4[_0xdda7('0x29')]);if(_0xc5d1d4['name']){delete _0xc5d1d4[_0xdda7('0x2a')];}_0x467c5c[_0xdda7('0x19')](_0x3099e1)[_0xdda7('0x2b')](_0xc5d1d4);};}exports['index']=function(_0x3a9383,_0x7d41fb){var _0x54afeb={},_0x32153a={},_0x1c5ac0={'count':0x0,'rows':[]};var _0x2d0dda=_[_0xdda7('0x2c')](db[_0xdda7('0x2d')][_0xdda7('0x2e')],function(_0x3fd84e){return{'name':_0x3fd84e['fieldName'],'type':_0x3fd84e[_0xdda7('0x2f')]['key']};});_0x32153a[_0xdda7('0x30')]=_[_0xdda7('0x2c')](_0x2d0dda,_0xdda7('0x2a'));_0x32153a[_0xdda7('0x31')]=_['keys'](_0x3a9383[_0xdda7('0x31')]);_0x32153a[_0xdda7('0x32')]=_['intersection'](_0x32153a['model'],_0x32153a[_0xdda7('0x31')]);_0x54afeb[_0xdda7('0x33')]=_[_0xdda7('0x34')](_0x32153a[_0xdda7('0x30')],qs['fields'](_0x3a9383[_0xdda7('0x31')][_0xdda7('0x35')]));_0x54afeb['attributes']=_0x54afeb[_0xdda7('0x33')][_0xdda7('0x36')]?_0x54afeb[_0xdda7('0x33')]:_0x32153a[_0xdda7('0x30')];if(!_0x3a9383[_0xdda7('0x31')][_0xdda7('0x37')](_0xdda7('0x38'))){_0x54afeb[_0xdda7('0x1e')]=qs[_0xdda7('0x1e')](_0x3a9383['query']['limit']);_0x54afeb[_0xdda7('0x1c')]=qs[_0xdda7('0x1c')](_0x3a9383[_0xdda7('0x31')][_0xdda7('0x1c')]);}_0x54afeb[_0xdda7('0x39')]=qs[_0xdda7('0x3a')](_0x3a9383[_0xdda7('0x31')][_0xdda7('0x3a')]);_0x54afeb[_0xdda7('0x3b')]=qs[_0xdda7('0x32')](_['pick'](_0x3a9383[_0xdda7('0x31')],_0x32153a[_0xdda7('0x32')]),_0x2d0dda);if(_0x3a9383[_0xdda7('0x31')]['filter']){_0x54afeb[_0xdda7('0x3b')]=_[_0xdda7('0x3c')](_0x54afeb['where'],{'$or':_[_0xdda7('0x2c')](_0x2d0dda,function(_0x3c58ea){if(_0x3c58ea[_0xdda7('0x2f')]!=='VIRTUAL'){var _0x1fe9b0={};_0x1fe9b0[_0x3c58ea[_0xdda7('0x2a')]]={'$like':'%'+_0x3a9383[_0xdda7('0x31')]['filter']+'%'};return _0x1fe9b0;}})});}_0x54afeb=_[_0xdda7('0x3c')]({},_0x54afeb,_0x3a9383[_0xdda7('0x3d')]);var _0x17515f={'where':_0x54afeb['where']};return db[_0xdda7('0x2d')]['count'](_0x17515f)['then'](function(_0x2d57ab){_0x1c5ac0[_0xdda7('0x1f')]=_0x2d57ab;if(_0x3a9383[_0xdda7('0x31')]['includeAll']){_0x54afeb[_0xdda7('0x3e')]=[{'all':!![]}];}return db[_0xdda7('0x2d')][_0xdda7('0x3f')](_0x54afeb);})[_0xdda7('0x24')](function(_0x293d45){_0x1c5ac0[_0xdda7('0x40')]=_0x293d45;return _0x1c5ac0;})[_0xdda7('0x24')](respondWithFilteredResult(_0x7d41fb,_0x54afeb))[_0xdda7('0x41')](handleError(_0x7d41fb,null));};exports[_0xdda7('0x42')]=function(_0x3f5295,_0x13b5c3){var _0x220116={'raw':!![],'where':{'id':_0x3f5295[_0xdda7('0x43')]['id']}},_0x451334={};_0x451334[_0xdda7('0x30')]=_[_0xdda7('0x44')](db[_0xdda7('0x2d')][_0xdda7('0x2e')]);_0x451334[_0xdda7('0x31')]=_['keys'](_0x3f5295[_0xdda7('0x31')]);_0x451334[_0xdda7('0x32')]=_[_0xdda7('0x34')](_0x451334[_0xdda7('0x30')],_0x451334[_0xdda7('0x31')]);_0x220116[_0xdda7('0x33')]=_[_0xdda7('0x34')](_0x451334[_0xdda7('0x30')],qs[_0xdda7('0x35')](_0x3f5295['query'][_0xdda7('0x35')]));_0x220116[_0xdda7('0x33')]=_0x220116['attributes'][_0xdda7('0x36')]?_0x220116[_0xdda7('0x33')]:_0x451334[_0xdda7('0x30')];if(_0x3f5295[_0xdda7('0x31')][_0xdda7('0x45')]){_0x220116[_0xdda7('0x3e')]=[{'all':!![]}];}_0x220116=_[_0xdda7('0x3c')]({},_0x220116,_0x3f5295[_0xdda7('0x3d')]);return db['Sound'][_0xdda7('0x46')](_0x220116)[_0xdda7('0x24')](handleEntityNotFound(_0x13b5c3,null))['then'](respondWithResult(_0x13b5c3,null))[_0xdda7('0x41')](handleError(_0x13b5c3,null));};exports[_0xdda7('0x47')]=function(_0x46f0aa,_0x188acc,_0x27ce33){return db[_0xdda7('0x2d')][_0xdda7('0x46')]({'where':{'id':_0x46f0aa[_0xdda7('0x43')]['id']},'attributes':[_0xdda7('0x2a'),_0xdda7('0x48'),_0xdda7('0x49')],'raw':!![]})[_0xdda7('0x24')](handleEntityNotFound(_0x188acc,null))[_0xdda7('0x24')](function(_0x162b17){if(_0x162b17){if(!fs['existsSync'](path[_0xdda7('0x4a')](config[_0xdda7('0x4b')],_0xdda7('0x4c'),_0x162b17['save_name']+'.'+_0x162b17[_0xdda7('0x49')]))){throw new db[(_0xdda7('0x4d'))][(_0xdda7('0x4e'))](_0xdda7('0x4f'));}return _0x188acc[_0xdda7('0x47')](path[_0xdda7('0x4a')](config[_0xdda7('0x4b')],_0xdda7('0x4c'),util['format'](_0xdda7('0x50'),_0x162b17[_0xdda7('0x48')],_0x162b17[_0xdda7('0x49')])),util[_0xdda7('0x51')](_0xdda7('0x50'),_0x162b17[_0xdda7('0x2a')],_0x162b17[_0xdda7('0x49')]));}return null;})[_0xdda7('0x41')](handleError(_0x188acc,null));};exports[_0xdda7('0x52')]=function(_0x24f308,_0x37ffcf,_0xb23dc){var _0x159b85={'name':path[_0xdda7('0x53')](_0x24f308[_0xdda7('0x54')][_0xdda7('0x55')],path['extname'](_0x24f308['file'][_0xdda7('0x55')])),'save_name':path['basename'](_0x24f308[_0xdda7('0x54')]['filename'],path['extname'](_0x24f308['file'][_0xdda7('0x56')])),'original_format':path[_0xdda7('0x57')](_0x24f308['file'][_0xdda7('0x55')])[_0xdda7('0x58')](0x1),'converted_format':'wav'};var _0x234dff=path[_0xdda7('0x4a')](config[_0xdda7('0x4b')],_0xdda7('0x59'),_0x24f308[_0xdda7('0x54')][_0xdda7('0x56')]);var _0x539ec6=path[_0xdda7('0x4a')](config[_0xdda7('0x4b')],_0xdda7('0x4c'),util[_0xdda7('0x51')](_0xdda7('0x50'),path[_0xdda7('0x53')](_0x24f308[_0xdda7('0x54')][_0xdda7('0x56')],path[_0xdda7('0x57')](_0x24f308[_0xdda7('0x54')][_0xdda7('0x56')])),_0x159b85[_0xdda7('0x49')]));logger[_0xdda7('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x234dff);logger[_0xdda7('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x539ec6);try{fs[_0xdda7('0x5b')](_0x234dff,parseInt(_0xdda7('0x5c'),0x8));var _0x5c077c=sox[_0xdda7('0x5d')](_0x234dff,_0x539ec6,{'sampleRate':0x1f40,'format':_0xdda7('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5c077c['on']('error',function(_0x2d44d2){fs[_0xdda7('0x5f')](_0x234dff);_0x37ffcf['status'](0x1f4)[_0xdda7('0x2b')](_0x2d44d2);});_0x5c077c['on'](_0xdda7('0x60'),function(_0x396918){_0x159b85[_0xdda7('0x61')]=isNaN(_0x396918['duration'])?null:_0x396918['duration']*0x3e8;_0x159b85['original_sampleCount']=isNaN(_0x396918[_0xdda7('0x62')])?null:_0x396918[_0xdda7('0x62')];_0x159b85['original_channelCount']=isNaN(_0x396918[_0xdda7('0x63')])?null:_0x396918['channelCount'];_0x159b85[_0xdda7('0x64')]=isNaN(_0x396918[_0xdda7('0x65')])?null:_0x396918[_0xdda7('0x65')];_0x159b85[_0xdda7('0x66')]=isNaN(_0x396918[_0xdda7('0x67')])?null:_0x396918[_0xdda7('0x67')];});_0x5c077c['on']('dest',function(_0x46b748){_0x159b85[_0xdda7('0x68')]=isNaN(_0x46b748[_0xdda7('0x69')])?null:_0x46b748[_0xdda7('0x69')]*0x3e8;_0x159b85[_0xdda7('0x6a')]=isNaN(_0x46b748[_0xdda7('0x62')])?null:_0x46b748[_0xdda7('0x62')];_0x159b85[_0xdda7('0x6b')]=isNaN(_0x46b748[_0xdda7('0x63')])?null:_0x46b748[_0xdda7('0x63')];_0x159b85['converted_bitRate']=isNaN(_0x46b748[_0xdda7('0x65')])?null:_0x46b748[_0xdda7('0x65')];_0x159b85['converted_sampleRate']=isNaN(_0x46b748[_0xdda7('0x67')])?null:_0x46b748['sampleRate'];});_0x5c077c['on'](_0xdda7('0x1a'),function(){fs['chmodSync'](_0x539ec6,parseInt('0777',0x8));return db[_0xdda7('0x2d')]['create'](_0x159b85)[_0xdda7('0x24')](function(_0x1fc7a3){var _0x4d507e={'role':_0x24f308[_0xdda7('0x6c')][_0xdda7('0x6d')],'userProfileId':_0x24f308[_0xdda7('0x6c')][_0xdda7('0x6e')]};if(!_0x4d507e)throw new Error(_0xdda7('0x6f'));if(_0x4d507e[_0xdda7('0x6d')]===_0xdda7('0x70')){var _0x3f11be=_0x1fc7a3[_0xdda7('0x26')]({'plain':!![]});return db[_0xdda7('0x71')][_0xdda7('0x46')]({'where':{'name':'Sounds','userProfileId':_0x4d507e[_0xdda7('0x6e')]},'raw':!![]})[_0xdda7('0x24')](function(_0x44c65b){if(_0x44c65b&&_0x44c65b[_0xdda7('0x72')]===0x0){return db[_0xdda7('0x73')][_0xdda7('0x52')]({'name':_0x3f11be['name'],'resourceId':_0x3f11be['id'],'type':_0x44c65b[_0xdda7('0x2a')],'sectionId':_0x44c65b['id']},{})['then'](function(){return _0x1fc7a3;});}else{return _0x1fc7a3;}})[_0xdda7('0x41')](function(_0x32aa90){logger[_0xdda7('0x28')](_0xdda7('0x74'),_0x32aa90);throw _0x32aa90;});}return _0x1fc7a3;})[_0xdda7('0x24')](respondWithResult(_0x37ffcf,null))['catch'](handleError(_0x37ffcf,null));});_0x5c077c[_0xdda7('0x75')]();}catch(_0x180770){_0x37ffcf[_0xdda7('0x19')](0x1f4)['send'](_0x180770);}};exports['update']=function(_0x45a154,_0x2e0861,_0x2d5b4e){return db[_0xdda7('0x2d')][_0xdda7('0x46')]({'where':{'id':_0x45a154[_0xdda7('0x43')]['id']}})[_0xdda7('0x24')](handleEntityNotFound(_0x2e0861,null))[_0xdda7('0x24')](saveUpdates(_[_0xdda7('0x76')](_0x45a154[_0xdda7('0x6c')],['name',_0xdda7('0x77')]),null))['then'](respondWithResult(_0x2e0861,null))[_0xdda7('0x41')](handleError(_0x2e0861,null));};exports[_0xdda7('0x78')]=function(_0x2304c3,_0x35ce51,_0x4a013c){return db[_0xdda7('0x2d')]['find']({'where':{'id':_0x2304c3[_0xdda7('0x43')]['id']}})[_0xdda7('0x24')](function(_0x184c32){if(_0x184c32){return _0x184c32[_0xdda7('0x25')]();}})['then'](function(_0x365b87){var _0x1989cf=path[_0xdda7('0x4a')](config[_0xdda7('0x4b')],_0xdda7('0x59'),util['format'](_0xdda7('0x50'),_0x365b87[_0xdda7('0x48')],_0x365b87[_0xdda7('0x79')]));var _0x2b2f08=path['join'](config['root'],_0xdda7('0x4c'),util[_0xdda7('0x51')](_0xdda7('0x50'),_0x365b87[_0xdda7('0x48')],_0x365b87['converted_format']));fs['unlinkSync'](_0x1989cf);fs[_0xdda7('0x5f')](_0x2b2f08);return _0x365b87;})[_0xdda7('0x24')](function(_0x33c6c1){if(_0x33c6c1){return _0x35ce51[_0xdda7('0x19')](0xcc)[_0xdda7('0x1a')]();}})['then'](handleEntityNotFound(_0x35ce51,null))[_0xdda7('0x41')](handleError(_0x35ce51,null));}; \ No newline at end of file +var _0xda5c=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','root','format','%s.%s','create','basename','originalname','file','extname','filename','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','name','index','map','Sound','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x49aa46,_0x3e1752){var _0x26a8dc=function(_0x445250){while(--_0x445250){_0x49aa46['push'](_0x49aa46['shift']());}};_0x26a8dc(++_0x3e1752);}(_0xda5c,0x1b7));var _0xcda5=function(_0x761f58,_0xb41bed){_0x761f58=_0x761f58-0x0;var _0x4ec5b4=_0xda5c[_0x761f58];return _0x4ec5b4;};'use strict';var emlformat=require(_0xcda5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcda5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcda5('0x2'));var moment=require(_0xcda5('0x3'));var BPromise=require(_0xcda5('0x4'));var Mustache=require(_0xcda5('0x5'));var util=require('util');var path=require(_0xcda5('0x6'));var sox=require(_0xcda5('0x7'));var csv=require(_0xcda5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcda5('0x9'));var squel=require(_0xcda5('0xa'));var crypto=require(_0xcda5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcda5('0xc'));var toCsv=require(_0xcda5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcda5('0xd'));var authService=require(_0xcda5('0xe'));var qs=require(_0xcda5('0xf'));var as=require(_0xcda5('0x10'));var hardwareService=require(_0xcda5('0x11'));var logger=require(_0xcda5('0x12'))(_0xcda5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcda5('0x14'));var db=require(_0xcda5('0x15'))['db'];function respondWithStatusCode(_0x72c8ef,_0x15e7bf){_0x15e7bf=_0x15e7bf||0xcc;return function(_0x7dc71a){if(_0x7dc71a){return _0x72c8ef[_0xcda5('0x16')](_0x15e7bf);}return _0x72c8ef[_0xcda5('0x17')](_0x15e7bf)[_0xcda5('0x18')]();};}function respondWithResult(_0x105189,_0x13a88e){_0x13a88e=_0x13a88e||0xc8;return function(_0x48867c){if(_0x48867c){return _0x105189['status'](_0x13a88e)['json'](_0x48867c);}};}function respondWithFilteredResult(_0x376a91,_0x5bad40){return function(_0x2b7f3d){if(_0x2b7f3d){var _0x14b166=typeof _0x5bad40[_0xcda5('0x19')]===_0xcda5('0x1a')&&typeof _0x5bad40[_0xcda5('0x1b')]===_0xcda5('0x1a');var _0x1f3246=_0x2b7f3d[_0xcda5('0x1c')];var _0x44e1b5=_0x14b166?0x0:_0x5bad40[_0xcda5('0x19')];var _0x3e70f3=_0x14b166?_0x2b7f3d[_0xcda5('0x1c')]:_0x5bad40[_0xcda5('0x19')]+_0x5bad40[_0xcda5('0x1b')];var _0xd0c5f;if(_0x3e70f3>=_0x1f3246){_0x3e70f3=_0x1f3246;_0xd0c5f=0xc8;}else{_0xd0c5f=0xce;}_0x376a91[_0xcda5('0x17')](_0xd0c5f);return _0x376a91[_0xcda5('0x1d')]('Content-Range',_0x44e1b5+'-'+_0x3e70f3+'/'+_0x1f3246)[_0xcda5('0x1e')](_0x2b7f3d);}return null;};}function patchUpdates(_0x3e449d){return function(_0x2c9220){try{jsonpatch[_0xcda5('0x1f')](_0x2c9220,_0x3e449d,!![]);}catch(_0x3dffd8){return BPromise[_0xcda5('0x20')](_0x3dffd8);}return _0x2c9220[_0xcda5('0x21')]();};}function saveUpdates(_0x580ee6,_0x5716ce){return function(_0x50efda){if(_0x50efda){return _0x50efda[_0xcda5('0x22')](_0x580ee6)[_0xcda5('0x23')](function(_0xc72f6b){return _0xc72f6b;});}return null;};}function removeEntity(_0xffabcd,_0x1b37f6){return function(_0x396b93){if(_0x396b93){return _0x396b93[_0xcda5('0x24')]()[_0xcda5('0x23')](function(){var _0x208cbb=_0x396b93['get']({'plain':!![]});var _0x517adb=_0xcda5('0x25');return db[_0xcda5('0x26')][_0xcda5('0x24')]({'where':{'type':_0x517adb,'resourceId':_0x208cbb['id']}})[_0xcda5('0x23')](function(){return _0x396b93;});})['then'](function(){_0xffabcd['status'](0xcc)[_0xcda5('0x18')]();});}};}function handleEntityNotFound(_0x29af04,_0x2e2cd7){return function(_0x32c659){if(!_0x32c659){_0x29af04[_0xcda5('0x16')](0x194);}return _0x32c659;};}function handleError(_0x104845,_0x414cb8){_0x414cb8=_0x414cb8||0x1f4;return function(_0x45c850){logger[_0xcda5('0x27')](_0x45c850['stack']);if(_0x45c850[_0xcda5('0x28')]){delete _0x45c850[_0xcda5('0x28')];}_0x104845[_0xcda5('0x17')](_0x414cb8)['send'](_0x45c850);};}exports[_0xcda5('0x29')]=function(_0x4491ac,_0x1f8601){var _0xcf760b={},_0x443e9d={},_0x53e39d={'count':0x0,'rows':[]};var _0x43bbf4=_[_0xcda5('0x2a')](db[_0xcda5('0x2b')][_0xcda5('0x2c')],function(_0x11273c){return{'name':_0x11273c['fieldName'],'type':_0x11273c[_0xcda5('0x2d')][_0xcda5('0x2e')]};});_0x443e9d['model']=_[_0xcda5('0x2a')](_0x43bbf4,_0xcda5('0x28'));_0x443e9d[_0xcda5('0x2f')]=_[_0xcda5('0x30')](_0x4491ac['query']);_0x443e9d[_0xcda5('0x31')]=_[_0xcda5('0x32')](_0x443e9d[_0xcda5('0x33')],_0x443e9d['query']);_0xcf760b[_0xcda5('0x34')]=_[_0xcda5('0x32')](_0x443e9d[_0xcda5('0x33')],qs[_0xcda5('0x35')](_0x4491ac['query']['fields']));_0xcf760b[_0xcda5('0x34')]=_0xcf760b[_0xcda5('0x34')][_0xcda5('0x36')]?_0xcf760b['attributes']:_0x443e9d[_0xcda5('0x33')];if(!_0x4491ac[_0xcda5('0x2f')][_0xcda5('0x37')](_0xcda5('0x38'))){_0xcf760b[_0xcda5('0x1b')]=qs['limit'](_0x4491ac['query'][_0xcda5('0x1b')]);_0xcf760b[_0xcda5('0x19')]=qs['offset'](_0x4491ac[_0xcda5('0x2f')]['offset']);}_0xcf760b[_0xcda5('0x39')]=qs[_0xcda5('0x3a')](_0x4491ac['query'][_0xcda5('0x3a')]);_0xcf760b[_0xcda5('0x3b')]=qs[_0xcda5('0x31')](_[_0xcda5('0x3c')](_0x4491ac[_0xcda5('0x2f')],_0x443e9d[_0xcda5('0x31')]),_0x43bbf4);if(_0x4491ac[_0xcda5('0x2f')][_0xcda5('0x3d')]){_0xcf760b['where']=_[_0xcda5('0x3e')](_0xcf760b[_0xcda5('0x3b')],{'$or':_[_0xcda5('0x2a')](_0x43bbf4,function(_0x477042){if(_0x477042[_0xcda5('0x2d')]!==_0xcda5('0x3f')){var _0x41d41a={};_0x41d41a[_0x477042[_0xcda5('0x28')]]={'$like':'%'+_0x4491ac['query'][_0xcda5('0x3d')]+'%'};return _0x41d41a;}})});}_0xcf760b=_[_0xcda5('0x3e')]({},_0xcf760b,_0x4491ac[_0xcda5('0x40')]);var _0x7bc6c8={'where':_0xcf760b['where']};return db['Sound'][_0xcda5('0x1c')](_0x7bc6c8)[_0xcda5('0x23')](function(_0x5219da){_0x53e39d[_0xcda5('0x1c')]=_0x5219da;if(_0x4491ac[_0xcda5('0x2f')][_0xcda5('0x41')]){_0xcf760b[_0xcda5('0x42')]=[{'all':!![]}];}return db[_0xcda5('0x2b')][_0xcda5('0x43')](_0xcf760b);})['then'](function(_0x1dc7cb){_0x53e39d[_0xcda5('0x44')]=_0x1dc7cb;return _0x53e39d;})['then'](respondWithFilteredResult(_0x1f8601,_0xcf760b))[_0xcda5('0x45')](handleError(_0x1f8601,null));};exports[_0xcda5('0x46')]=function(_0x4059e2,_0x4bb2d3){var _0x1a88a4={'raw':!![],'where':{'id':_0x4059e2[_0xcda5('0x47')]['id']}},_0x51f3fb={};_0x51f3fb[_0xcda5('0x33')]=_[_0xcda5('0x30')](db['Sound'][_0xcda5('0x2c')]);_0x51f3fb[_0xcda5('0x2f')]=_[_0xcda5('0x30')](_0x4059e2[_0xcda5('0x2f')]);_0x51f3fb[_0xcda5('0x31')]=_[_0xcda5('0x32')](_0x51f3fb['model'],_0x51f3fb['query']);_0x1a88a4[_0xcda5('0x34')]=_[_0xcda5('0x32')](_0x51f3fb[_0xcda5('0x33')],qs[_0xcda5('0x35')](_0x4059e2[_0xcda5('0x2f')]['fields']));_0x1a88a4[_0xcda5('0x34')]=_0x1a88a4[_0xcda5('0x34')][_0xcda5('0x36')]?_0x1a88a4[_0xcda5('0x34')]:_0x51f3fb[_0xcda5('0x33')];if(_0x4059e2[_0xcda5('0x2f')][_0xcda5('0x41')]){_0x1a88a4[_0xcda5('0x42')]=[{'all':!![]}];}_0x1a88a4=_[_0xcda5('0x3e')]({},_0x1a88a4,_0x4059e2[_0xcda5('0x40')]);return db['Sound'][_0xcda5('0x48')](_0x1a88a4)[_0xcda5('0x23')](handleEntityNotFound(_0x4bb2d3,null))['then'](respondWithResult(_0x4bb2d3,null))[_0xcda5('0x45')](handleError(_0x4bb2d3,null));};exports[_0xcda5('0x49')]=function(_0x249054,_0x26a75b,_0x56bf51){return db[_0xcda5('0x2b')][_0xcda5('0x48')]({'where':{'id':_0x249054[_0xcda5('0x47')]['id']},'attributes':[_0xcda5('0x28'),_0xcda5('0x4a'),_0xcda5('0x4b')],'raw':!![]})[_0xcda5('0x23')](handleEntityNotFound(_0x26a75b,null))[_0xcda5('0x23')](function(_0x535eb0){if(_0x535eb0){if(!fs[_0xcda5('0x4c')](path[_0xcda5('0x4d')](config['root'],_0xcda5('0x4e'),_0x535eb0[_0xcda5('0x4a')]+'.'+_0x535eb0[_0xcda5('0x4b')]))){throw new db[(_0xcda5('0x4f'))][(_0xcda5('0x50'))]('Sound\x20not\x20found');}return _0x26a75b[_0xcda5('0x49')](path[_0xcda5('0x4d')](config[_0xcda5('0x51')],'server/files/sounds/converted',util[_0xcda5('0x52')](_0xcda5('0x53'),_0x535eb0[_0xcda5('0x4a')],_0x535eb0[_0xcda5('0x4b')])),util['format'](_0xcda5('0x53'),_0x535eb0[_0xcda5('0x28')],_0x535eb0[_0xcda5('0x4b')]));}return null;})[_0xcda5('0x45')](handleError(_0x26a75b,null));};exports[_0xcda5('0x54')]=function(_0x5b4a07,_0x3b4a5b,_0x594ccf){var _0x254e44={'name':path[_0xcda5('0x55')](_0x5b4a07['file'][_0xcda5('0x56')],path['extname'](_0x5b4a07[_0xcda5('0x57')][_0xcda5('0x56')])),'save_name':path['basename'](_0x5b4a07[_0xcda5('0x57')]['filename'],path[_0xcda5('0x58')](_0x5b4a07['file'][_0xcda5('0x59')])),'original_format':path[_0xcda5('0x58')](_0x5b4a07[_0xcda5('0x57')][_0xcda5('0x56')])['substring'](0x1),'converted_format':_0xcda5('0x5a')};var _0x15736a=path['join'](config[_0xcda5('0x51')],_0xcda5('0x5b'),_0x5b4a07[_0xcda5('0x57')][_0xcda5('0x59')]);var _0xa132a=path[_0xcda5('0x4d')](config[_0xcda5('0x51')],_0xcda5('0x4e'),util['format'](_0xcda5('0x53'),path[_0xcda5('0x55')](_0x5b4a07[_0xcda5('0x57')]['filename'],path[_0xcda5('0x58')](_0x5b4a07[_0xcda5('0x57')][_0xcda5('0x59')])),_0x254e44[_0xcda5('0x4b')]));logger['info'](_0xcda5('0x5c'),_0x15736a);logger['info'](_0xcda5('0x5d'),_0xa132a);try{fs[_0xcda5('0x5e')](_0x15736a,parseInt('0777',0x8));var _0x337b7c=sox[_0xcda5('0x5f')](_0x15736a,_0xa132a,{'sampleRate':0x1f40,'format':_0xcda5('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x337b7c['on'](_0xcda5('0x27'),function(_0x42ba17){fs[_0xcda5('0x60')](_0x15736a);_0x3b4a5b[_0xcda5('0x17')](0x1f4)[_0xcda5('0x61')](_0x42ba17);});_0x337b7c['on'](_0xcda5('0x62'),function(_0x4c1177){_0x254e44[_0xcda5('0x63')]=isNaN(_0x4c1177[_0xcda5('0x64')])?null:_0x4c1177['duration']*0x3e8;_0x254e44[_0xcda5('0x65')]=isNaN(_0x4c1177[_0xcda5('0x66')])?null:_0x4c1177['sampleCount'];_0x254e44[_0xcda5('0x67')]=isNaN(_0x4c1177[_0xcda5('0x68')])?null:_0x4c1177[_0xcda5('0x68')];_0x254e44[_0xcda5('0x69')]=isNaN(_0x4c1177['bitRate'])?null:_0x4c1177['bitRate'];_0x254e44['original_sampleRate']=isNaN(_0x4c1177[_0xcda5('0x6a')])?null:_0x4c1177[_0xcda5('0x6a')];});_0x337b7c['on'](_0xcda5('0x6b'),function(_0x362aae){_0x254e44[_0xcda5('0x6c')]=isNaN(_0x362aae[_0xcda5('0x64')])?null:_0x362aae[_0xcda5('0x64')]*0x3e8;_0x254e44['converted_sampleCount']=isNaN(_0x362aae[_0xcda5('0x66')])?null:_0x362aae[_0xcda5('0x66')];_0x254e44[_0xcda5('0x6d')]=isNaN(_0x362aae['channelCount'])?null:_0x362aae['channelCount'];_0x254e44[_0xcda5('0x6e')]=isNaN(_0x362aae[_0xcda5('0x6f')])?null:_0x362aae[_0xcda5('0x6f')];_0x254e44[_0xcda5('0x70')]=isNaN(_0x362aae[_0xcda5('0x6a')])?null:_0x362aae[_0xcda5('0x6a')];});_0x337b7c['on'](_0xcda5('0x18'),function(){fs[_0xcda5('0x5e')](_0xa132a,parseInt('0777',0x8));return db[_0xcda5('0x2b')][_0xcda5('0x54')](_0x254e44)[_0xcda5('0x23')](function(_0x3a81cf){var _0x238ea6={'role':_0x5b4a07[_0xcda5('0x71')][_0xcda5('0x72')],'userProfileId':_0x5b4a07['body'][_0xcda5('0x73')]};if(!_0x238ea6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x238ea6[_0xcda5('0x72')]===_0xcda5('0x74')){var _0x12d68f=_0x3a81cf['get']({'plain':!![]});return db[_0xcda5('0x75')]['find']({'where':{'name':'Sounds','userProfileId':_0x238ea6[_0xcda5('0x73')]},'raw':!![]})[_0xcda5('0x23')](function(_0x5b3483){if(_0x5b3483&&_0x5b3483[_0xcda5('0x76')]===0x0){return db[_0xcda5('0x26')][_0xcda5('0x54')]({'name':_0x12d68f[_0xcda5('0x28')],'resourceId':_0x12d68f['id'],'type':_0x5b3483[_0xcda5('0x28')],'sectionId':_0x5b3483['id']},{})[_0xcda5('0x23')](function(){return _0x3a81cf;});}else{return _0x3a81cf;}})[_0xcda5('0x45')](function(_0x43d980){logger[_0xcda5('0x27')](_0xcda5('0x77'),_0x43d980);throw _0x43d980;});}return _0x3a81cf;})['then'](respondWithResult(_0x3b4a5b,null))[_0xcda5('0x45')](handleError(_0x3b4a5b,null));});_0x337b7c[_0xcda5('0x78')]();}catch(_0x254ecb){_0x3b4a5b['status'](0x1f4)['send'](_0x254ecb);}};exports[_0xcda5('0x22')]=function(_0x2c2217,_0x30dbca,_0x51340c){return db[_0xcda5('0x2b')][_0xcda5('0x48')]({'where':{'id':_0x2c2217[_0xcda5('0x47')]['id']}})[_0xcda5('0x23')](handleEntityNotFound(_0x30dbca,null))['then'](saveUpdates(_['pick'](_0x2c2217[_0xcda5('0x71')],[_0xcda5('0x28'),_0xcda5('0x79')]),null))[_0xcda5('0x23')](respondWithResult(_0x30dbca,null))[_0xcda5('0x45')](handleError(_0x30dbca,null));};exports[_0xcda5('0x7a')]=function(_0x457b08,_0x5a8f9e,_0x830bc3){return db[_0xcda5('0x2b')][_0xcda5('0x48')]({'where':{'id':_0x457b08[_0xcda5('0x47')]['id']}})[_0xcda5('0x23')](function(_0x53080f){if(_0x53080f){return _0x53080f[_0xcda5('0x24')]();}})['then'](function(_0x3d5ee8){var _0x40d1c3=path[_0xcda5('0x4d')](config[_0xcda5('0x51')],_0xcda5('0x5b'),util[_0xcda5('0x52')](_0xcda5('0x53'),_0x3d5ee8[_0xcda5('0x4a')],_0x3d5ee8[_0xcda5('0x7b')]));var _0x318c78=path[_0xcda5('0x4d')](config['root'],_0xcda5('0x4e'),util[_0xcda5('0x52')](_0xcda5('0x53'),_0x3d5ee8['save_name'],_0x3d5ee8[_0xcda5('0x4b')]));fs[_0xcda5('0x60')](_0x40d1c3);fs[_0xcda5('0x60')](_0x318c78);return _0x3d5ee8;})[_0xcda5('0x23')](function(_0x51b70c){if(_0x51b70c){return _0x5a8f9e[_0xcda5('0x17')](0xcc)[_0xcda5('0x18')]();}})[_0xcda5('0x23')](handleEntityNotFound(_0x5a8f9e,null))['catch'](handleError(_0x5a8f9e,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 33698df..e0eeb9d 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 _0x6614=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds'];(function(_0x4283c0,_0xc694d5){var _0x6b47ab=function(_0x4a8f0){while(--_0x4a8f0){_0x4283c0['push'](_0x4283c0['shift']());}};_0x6b47ab(++_0xc694d5);}(_0x6614,0x174));var _0x4661=function(_0x20952d,_0x4eddd5){_0x20952d=_0x20952d-0x0;var _0x3b24d5=_0x6614[_0x20952d];return _0x3b24d5;};'use strict';var _=require(_0x4661('0x0'));var util=require(_0x4661('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4661('0x2'));var BPromise=require(_0x4661('0x3'));var rp=require(_0x4661('0x4'));var fs=require('fs');var path=require(_0x4661('0x5'));var rimraf=require(_0x4661('0x6'));var config=require(_0x4661('0x7'));var attributes=require(_0x4661('0x8'));module[_0x4661('0x9')]=function(_0xa17801,_0x488bfa){return _0xa17801[_0x4661('0xa')]('Sound',attributes,{'tableName':_0x4661('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x929e=['request-promise','path','rimraf','./sound.attributes','exports','Sound','tools_sounds','lodash','util','api','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x929e,0x1bf));var _0xe929=function(_0x237d73,_0x458926){_0x237d73=_0x237d73-0x0;var _0x1c333d=_0x929e[_0x237d73];return _0x1c333d;};'use strict';var _=require(_0xe929('0x0'));var util=require(_0xe929('0x1'));var logger=require('../../config/logger')(_0xe929('0x2'));var moment=require(_0xe929('0x3'));var BPromise=require('bluebird');var rp=require(_0xe929('0x4'));var fs=require('fs');var path=require(_0xe929('0x5'));var rimraf=require(_0xe929('0x6'));var config=require('../../config/environment');var attributes=require(_0xe929('0x7'));module[_0xe929('0x8')]=function(_0x306481,_0xe3e935){return _0x306481['define'](_0xe929('0x9'),attributes,{'tableName':_0xe929('0xa'),'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 046e755..ca9af1d 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 _0x4da2=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSound','Sound','options','raw','attributes','map','include','model','catch','lodash','bluebird'];(function(_0x125425,_0x4b6bab){var _0xd04dc4=function(_0x37fc01){while(--_0x37fc01){_0x125425['push'](_0x125425['shift']());}};_0xd04dc4(++_0x4b6bab);}(_0x4da2,0xc9));var _0x24da=function(_0x153519,_0x2900de){_0x153519=_0x153519-0x0;var _0x2e1b73=_0x4da2[_0x153519];return _0x2e1b73;};'use strict';var _=require(_0x24da('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x24da('0x1'));var rs=require(_0x24da('0x2'));var fs=require('fs');var Redis=require(_0x24da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x24da('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x24da('0x5'));var jayson=require(_0x24da('0x6'));var client=jayson[_0x24da('0x7')][_0x24da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b190a,_0x1d2a12,_0x3d2980){return new BPromise(function(_0x4425c0,_0x549c44){return client['request'](_0x4b190a,_0x3d2980)[_0x24da('0x9')](function(_0x2d33d7){logger[_0x24da('0xa')](_0x24da('0xb'),_0x1d2a12,'request\x20sent');logger[_0x24da('0xc')](_0x24da('0xd'),_0x1d2a12,_0x24da('0xe'),JSON[_0x24da('0xf')](_0x2d33d7));if(_0x2d33d7[_0x24da('0x10')]){if(_0x2d33d7[_0x24da('0x10')][_0x24da('0x11')]===0x1f4){logger[_0x24da('0x10')]('Sound,\x20%s,\x20%s',_0x1d2a12,_0x2d33d7[_0x24da('0x10')]['message']);return _0x549c44(_0x2d33d7[_0x24da('0x10')][_0x24da('0x12')]);}logger['error'](_0x24da('0xb'),_0x1d2a12,_0x2d33d7[_0x24da('0x10')][_0x24da('0x12')]);return _0x4425c0(_0x2d33d7['error'][_0x24da('0x12')]);}else{logger[_0x24da('0xa')](_0x24da('0xb'),_0x1d2a12,_0x24da('0xe'));_0x4425c0(_0x2d33d7[_0x24da('0x13')][_0x24da('0x12')]);}})['catch'](function(_0x45e90d){logger['error']('Sound,\x20%s,\x20%s',_0x1d2a12,_0x45e90d);_0x549c44(_0x45e90d);});});}exports[_0x24da('0x14')]=function(_0xcb9a60){var _0x4a15ac=this;return new Promise(function(_0x38609b,_0x48cccc){return db[_0x24da('0x15')]['find']({'raw':_0xcb9a60[_0x24da('0x16')]?_0xcb9a60[_0x24da('0x16')][_0x24da('0x17')]===undefined?!![]:![]:!![],'where':_0xcb9a60[_0x24da('0x16')]?_0xcb9a60[_0x24da('0x16')]['where']||null:null,'attributes':_0xcb9a60[_0x24da('0x16')]?_0xcb9a60['options'][_0x24da('0x18')]||null:null,'include':_0xcb9a60[_0x24da('0x16')]?_0xcb9a60[_0x24da('0x16')]['include']?_[_0x24da('0x19')](_0xcb9a60['options'][_0x24da('0x1a')],function(_0x471993){return{'model':db[_0x471993[_0x24da('0x1b')]],'as':_0x471993['as'],'attributes':_0x471993[_0x24da('0x18')],'include':_0x471993[_0x24da('0x1a')]?_[_0x24da('0x19')](_0x471993[_0x24da('0x1a')],function(_0x1165c8){return{'model':db[_0x1165c8[_0x24da('0x1b')]],'as':_0x1165c8['as'],'attributes':_0x1165c8[_0x24da('0x18')],'include':_0x1165c8[_0x24da('0x1a')]?_[_0x24da('0x19')](_0x1165c8['include'],function(_0x480547){return{'model':db[_0x480547[_0x24da('0x1b')]],'as':_0x480547['as'],'attributes':_0x480547['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17d6e8){logger['info'](_0x24da('0x14'),_0xcb9a60);logger[_0x24da('0xc')]('ShowSound',_0xcb9a60,JSON[_0x24da('0xf')](_0x17d6e8));_0x38609b(_0x17d6e8);})[_0x24da('0x1c')](function(_0x10637d){logger['error'](_0x24da('0x14'),_0x10637d[_0x24da('0x12')],_0xcb9a60);_0x48cccc(_0x4a15ac['error'](0x1f4,_0x10637d[_0x24da('0x12')]));});});}; \ No newline at end of file +var _0x99e8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','Sound','find','options','where','attributes','include','map','model','ShowSound','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x23e751,_0x27973f){var _0xa121f4=function(_0x41c723){while(--_0x41c723){_0x23e751['push'](_0x23e751['shift']());}};_0xa121f4(++_0x27973f);}(_0x99e8,0x121));var _0x899e=function(_0x171b13,_0xd20a5){_0x171b13=_0x171b13-0x0;var _0xb9c8e1=_0x99e8[_0x171b13];return _0xb9c8e1;};'use strict';var _=require(_0x899e('0x0'));var util=require('util');var moment=require(_0x899e('0x1'));var BPromise=require(_0x899e('0x2'));var rs=require(_0x899e('0x3'));var fs=require('fs');var Redis=require(_0x899e('0x4'));var db=require(_0x899e('0x5'))['db'];var utils=require(_0x899e('0x6'));var logger=require(_0x899e('0x7'))(_0x899e('0x8'));var config=require(_0x899e('0x9'));var jayson=require(_0x899e('0xa'));var client=jayson[_0x899e('0xb')][_0x899e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24d54f,_0x3672e1,_0x21df2b){return new BPromise(function(_0x17c33b,_0xa99ebf){return client[_0x899e('0xd')](_0x24d54f,_0x21df2b)[_0x899e('0xe')](function(_0x48a44f){logger[_0x899e('0xf')](_0x899e('0x10'),_0x3672e1,_0x899e('0x11'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x3672e1,_0x899e('0x11'),JSON[_0x899e('0x12')](_0x48a44f));if(_0x48a44f[_0x899e('0x13')]){if(_0x48a44f[_0x899e('0x13')][_0x899e('0x14')]===0x1f4){logger['error'](_0x899e('0x10'),_0x3672e1,_0x48a44f[_0x899e('0x13')][_0x899e('0x15')]);return _0xa99ebf(_0x48a44f[_0x899e('0x13')][_0x899e('0x15')]);}logger['error'](_0x899e('0x10'),_0x3672e1,_0x48a44f[_0x899e('0x13')][_0x899e('0x15')]);return _0x17c33b(_0x48a44f[_0x899e('0x13')][_0x899e('0x15')]);}else{logger[_0x899e('0xf')]('Sound,\x20%s,\x20%s',_0x3672e1,_0x899e('0x11'));_0x17c33b(_0x48a44f[_0x899e('0x16')]['message']);}})['catch'](function(_0x5efdda){logger['error'](_0x899e('0x10'),_0x3672e1,_0x5efdda);_0xa99ebf(_0x5efdda);});});}exports['ShowSound']=function(_0x4d1da1){var _0x466483=this;return new Promise(function(_0xd68921,_0x4b67a2){return db[_0x899e('0x17')][_0x899e('0x18')]({'raw':_0x4d1da1[_0x899e('0x19')]?_0x4d1da1[_0x899e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4d1da1[_0x899e('0x19')]?_0x4d1da1[_0x899e('0x19')][_0x899e('0x1a')]||null:null,'attributes':_0x4d1da1[_0x899e('0x19')]?_0x4d1da1[_0x899e('0x19')][_0x899e('0x1b')]||null:null,'include':_0x4d1da1[_0x899e('0x19')]?_0x4d1da1[_0x899e('0x19')][_0x899e('0x1c')]?_[_0x899e('0x1d')](_0x4d1da1[_0x899e('0x19')]['include'],function(_0x5b8b44){return{'model':db[_0x5b8b44['model']],'as':_0x5b8b44['as'],'attributes':_0x5b8b44['attributes'],'include':_0x5b8b44['include']?_[_0x899e('0x1d')](_0x5b8b44['include'],function(_0x22d253){return{'model':db[_0x22d253[_0x899e('0x1e')]],'as':_0x22d253['as'],'attributes':_0x22d253[_0x899e('0x1b')],'include':_0x22d253[_0x899e('0x1c')]?_['map'](_0x22d253[_0x899e('0x1c')],function(_0x59c0d3){return{'model':db[_0x59c0d3['model']],'as':_0x59c0d3['as'],'attributes':_0x59c0d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x899e('0xe')](function(_0x2aa90a){logger[_0x899e('0xf')](_0x899e('0x1f'),_0x4d1da1);logger['debug'](_0x899e('0x1f'),_0x4d1da1,JSON[_0x899e('0x12')](_0x2aa90a));_0xd68921(_0x2aa90a);})[_0x899e('0x20')](function(_0xc56d1a){logger[_0x899e('0x13')](_0x899e('0x1f'),_0xc56d1a[_0x899e('0x15')],_0x4d1da1);_0x4b67a2(_0x466483[_0x899e('0x13')](0x1f4,_0xc56d1a['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 825b02b..a99d963 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x1dd15c,_0x119f10){var _0x10807e=function(_0x51bd3f){while(--_0x51bd3f){_0x1dd15c['push'](_0x1dd15c['shift']());}};_0x10807e(++_0x119f10);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'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('./squareMessage.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0xb')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router['put']('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0x9'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x117473,_0x485375){var _0x38711a=function(_0x33e119){while(--_0x33e119){_0x117473['push'](_0x117473['shift']());}};_0x38711a(++_0x485375);}(_0x4fc2,0x111));var _0x24fc=function(_0x23cfaf,_0x1d8545){_0x23cfaf=_0x23cfaf-0x0;var _0xf8af44=_0x4fc2[_0x23cfaf];return _0xf8af44;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 95dc7fa..b09ad88 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 _0xf881=['TEXT','STRING','out'];(function(_0x5ad8d4,_0x12357c){var _0x6a7715=function(_0x59be0f){while(--_0x59be0f){_0x5ad8d4['push'](_0x5ad8d4['shift']());}};_0x6a7715(++_0x12357c);}(_0xf881,0x12a));var _0x1f88=function(_0x3482a8,_0x1472e7){_0x3482a8=_0x3482a8-0x0;var _0x5c0db6=_0xf881[_0x3482a8];return _0x5c0db6;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x1f88('0x0')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x1f88('0x1'),'allowNull':![]},'providerName':{'type':Sequelize[_0x1f88('0x0')]},'providerResponse':{'type':Sequelize[_0x1f88('0x2')]}}; \ No newline at end of file +var _0xcb3d=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0xee8e21,_0x22f714){var _0x33c04d=function(_0x227eb8){while(--_0x227eb8){_0xee8e21['push'](_0xee8e21['shift']());}};_0x33c04d(++_0x22f714);}(_0xcb3d,0xdc));var _0xdcb3=function(_0x2e2a2a,_0x3ceb6f){_0x2e2a2a=_0x2e2a2a-0x0;var _0x1dafd1=_0xcb3d[_0x2e2a2a];return _0x1dafd1;};'use strict';var Sequelize=require(_0xdcb3('0x0'));module[_0xdcb3('0x1')]={'uniqueid':{'type':Sequelize[_0xdcb3('0x2')]},'body':{'type':Sequelize[_0xdcb3('0x3')](_0xdcb3('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xdcb3('0x5')]('in','out'),'defaultValue':_0xdcb3('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xdcb3('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c3acad9..85d2f8c 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 _0x6075=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','type','key','query','intersection','model','attributes','fields','length','order','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6075,0x8a));var _0x5607=function(_0x4f6195,_0x2b5d26){_0x4f6195=_0x4f6195-0x0;var _0x5b981b=_0x6075[_0x4f6195];return _0x5b981b;};'use strict';var emlformat=require(_0x5607('0x0'));var rimraf=require(_0x5607('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5607('0x2'));var rp=require(_0x5607('0x3'));var moment=require(_0x5607('0x4'));var BPromise=require(_0x5607('0x5'));var Mustache=require(_0x5607('0x6'));var util=require('util');var path=require(_0x5607('0x7'));var sox=require(_0x5607('0x8'));var csv=require(_0x5607('0x9'));var ejs=require(_0x5607('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5607('0xb'));var squel=require(_0x5607('0xc'));var crypto=require(_0x5607('0xd'));var jsforce=require(_0x5607('0xe'));var deskjs=require(_0x5607('0xf'));var toCsv=require(_0x5607('0x9'));var querystring=require(_0x5607('0x10'));var Papa=require('papaparse');var Redis=require(_0x5607('0x11'));var authService=require(_0x5607('0x12'));var qs=require(_0x5607('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5607('0x14'));var logger=require(_0x5607('0x15'))(_0x5607('0x16'));var utils=require(_0x5607('0x17'));var config=require(_0x5607('0x18'));var licenseUtil=require(_0x5607('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44872b,_0xb6c49e){_0xb6c49e=_0xb6c49e||0xcc;return function(_0x494892){if(_0x494892){return _0x44872b[_0x5607('0x1a')](_0xb6c49e);}return _0x44872b[_0x5607('0x1b')](_0xb6c49e)[_0x5607('0x1c')]();};}function respondWithResult(_0x11b1c5,_0x554789){_0x554789=_0x554789||0xc8;return function(_0x130e16){if(_0x130e16){return _0x11b1c5[_0x5607('0x1b')](_0x554789)[_0x5607('0x1d')](_0x130e16);}};}function respondWithFilteredResult(_0x19527e,_0x205560){return function(_0x32beb4){if(_0x32beb4){var _0x17fd47=typeof _0x205560['offset']==='undefined'&&typeof _0x205560[_0x5607('0x1e')]===_0x5607('0x1f');var _0x652fca=_0x32beb4[_0x5607('0x20')];var _0x1f440e=_0x17fd47?0x0:_0x205560[_0x5607('0x21')];var _0x29a44c=_0x17fd47?_0x32beb4[_0x5607('0x20')]:_0x205560[_0x5607('0x21')]+_0x205560[_0x5607('0x1e')];var _0xfbf0a5;if(_0x29a44c>=_0x652fca){_0x29a44c=_0x652fca;_0xfbf0a5=0xc8;}else{_0xfbf0a5=0xce;}_0x19527e[_0x5607('0x1b')](_0xfbf0a5);return _0x19527e['set'](_0x5607('0x22'),_0x1f440e+'-'+_0x29a44c+'/'+_0x652fca)[_0x5607('0x1d')](_0x32beb4);}return null;};}function patchUpdates(_0x3e1cae){return function(_0x2718a4){try{jsonpatch[_0x5607('0x23')](_0x2718a4,_0x3e1cae,!![]);}catch(_0x4a815f){return BPromise[_0x5607('0x24')](_0x4a815f);}return _0x2718a4[_0x5607('0x25')]();};}function saveUpdates(_0x15a25a,_0x17e265){return function(_0xa15b9d){if(_0xa15b9d){return _0xa15b9d[_0x5607('0x26')](_0x15a25a)[_0x5607('0x27')](function(_0x52c835){return _0x52c835;});}return null;};}function removeEntity(_0x468dcb,_0x195622){return function(_0x162b52){if(_0x162b52){return _0x162b52[_0x5607('0x28')]()[_0x5607('0x27')](function(){_0x468dcb[_0x5607('0x1b')](0xcc)[_0x5607('0x1c')]();});}};}function handleEntityNotFound(_0x5785b6,_0x276fc4){return function(_0x51065a){if(!_0x51065a){_0x5785b6[_0x5607('0x1a')](0x194);}return _0x51065a;};}function handleError(_0x4ee2c9,_0x1a52ff){_0x1a52ff=_0x1a52ff||0x1f4;return function(_0x20a228){logger[_0x5607('0x29')](_0x20a228[_0x5607('0x2a')]);if(_0x20a228[_0x5607('0x2b')]){delete _0x20a228['name'];}_0x4ee2c9[_0x5607('0x1b')](_0x1a52ff)['send'](_0x20a228);};}exports[_0x5607('0x2c')]=function(_0x23fa77,_0x3bf55c){var _0x3967d7={},_0x2d20c6={},_0x1f15f9={'count':0x0,'rows':[]};var _0x5d8e04=_[_0x5607('0x2d')](db[_0x5607('0x2e')][_0x5607('0x2f')],function(_0x17920c){return{'name':_0x17920c['fieldName'],'type':_0x17920c[_0x5607('0x30')][_0x5607('0x31')]};});_0x2d20c6['model']=_[_0x5607('0x2d')](_0x5d8e04,'name');_0x2d20c6[_0x5607('0x32')]=_['keys'](_0x23fa77['query']);_0x2d20c6['filters']=_[_0x5607('0x33')](_0x2d20c6[_0x5607('0x34')],_0x2d20c6[_0x5607('0x32')]);_0x3967d7[_0x5607('0x35')]=_[_0x5607('0x33')](_0x2d20c6[_0x5607('0x34')],qs[_0x5607('0x36')](_0x23fa77['query']['fields']));_0x3967d7[_0x5607('0x35')]=_0x3967d7[_0x5607('0x35')][_0x5607('0x37')]?_0x3967d7['attributes']:_0x2d20c6[_0x5607('0x34')];if(!_0x23fa77[_0x5607('0x32')]['hasOwnProperty']('nolimit')){_0x3967d7[_0x5607('0x1e')]=qs[_0x5607('0x1e')](_0x23fa77[_0x5607('0x32')]['limit']);_0x3967d7[_0x5607('0x21')]=qs[_0x5607('0x21')](_0x23fa77['query']['offset']);}_0x3967d7[_0x5607('0x38')]=qs['sort'](_0x23fa77[_0x5607('0x32')]['sort']);_0x3967d7[_0x5607('0x39')]=qs['filters'](_[_0x5607('0x3a')](_0x23fa77[_0x5607('0x32')],_0x2d20c6[_0x5607('0x3b')]),_0x5d8e04);if(_0x23fa77['query'][_0x5607('0x3c')]){_0x3967d7['where']=_[_0x5607('0x3d')](_0x3967d7[_0x5607('0x39')],{'$or':_[_0x5607('0x2d')](_0x5d8e04,function(_0x14cd36){if(_0x14cd36[_0x5607('0x30')]!==_0x5607('0x3e')){var _0x3dbf26={};_0x3dbf26[_0x14cd36['name']]={'$like':'%'+_0x23fa77['query'][_0x5607('0x3c')]+'%'};return _0x3dbf26;}})});}_0x3967d7=_[_0x5607('0x3d')]({},_0x3967d7,_0x23fa77[_0x5607('0x3f')]);var _0x1e1bca={'where':_0x3967d7[_0x5607('0x39')]};return db[_0x5607('0x2e')]['count'](_0x1e1bca)[_0x5607('0x27')](function(_0x5ca121){_0x1f15f9[_0x5607('0x20')]=_0x5ca121;if(_0x23fa77[_0x5607('0x32')][_0x5607('0x40')]){_0x3967d7[_0x5607('0x41')]=[{'all':!![]}];}return db[_0x5607('0x2e')][_0x5607('0x42')](_0x3967d7);})[_0x5607('0x27')](function(_0x307e73){_0x1f15f9[_0x5607('0x43')]=_0x307e73;return _0x1f15f9;})[_0x5607('0x27')](respondWithFilteredResult(_0x3bf55c,_0x3967d7))[_0x5607('0x44')](handleError(_0x3bf55c,null));};exports[_0x5607('0x45')]=function(_0x23dd8e,_0xd3e2ee){var _0x59ebf4={'raw':!![],'where':{'id':_0x23dd8e[_0x5607('0x46')]['id']}},_0xfd1d13={};_0xfd1d13[_0x5607('0x34')]=_[_0x5607('0x47')](db[_0x5607('0x2e')][_0x5607('0x2f')]);_0xfd1d13['query']=_['keys'](_0x23dd8e[_0x5607('0x32')]);_0xfd1d13[_0x5607('0x3b')]=_['intersection'](_0xfd1d13[_0x5607('0x34')],_0xfd1d13['query']);_0x59ebf4['attributes']=_[_0x5607('0x33')](_0xfd1d13[_0x5607('0x34')],qs[_0x5607('0x36')](_0x23dd8e[_0x5607('0x32')]['fields']));_0x59ebf4[_0x5607('0x35')]=_0x59ebf4[_0x5607('0x35')]['length']?_0x59ebf4[_0x5607('0x35')]:_0xfd1d13[_0x5607('0x34')];if(_0x23dd8e['query']['includeAll']){_0x59ebf4[_0x5607('0x41')]=[{'all':!![]}];}_0x59ebf4=_[_0x5607('0x3d')]({},_0x59ebf4,_0x23dd8e[_0x5607('0x3f')]);return db[_0x5607('0x2e')][_0x5607('0x48')](_0x59ebf4)[_0x5607('0x27')](handleEntityNotFound(_0xd3e2ee,null))[_0x5607('0x27')](respondWithResult(_0xd3e2ee,null))[_0x5607('0x44')](handleError(_0xd3e2ee,null));};exports[_0x5607('0x49')]=function(_0x3f0d95,_0x33f842){return db[_0x5607('0x2e')][_0x5607('0x49')](_0x3f0d95['body'],{})[_0x5607('0x27')](respondWithResult(_0x33f842,0xc9))[_0x5607('0x44')](handleError(_0x33f842,null));};exports[_0x5607('0x26')]=function(_0x4b204f,_0x20fab2){if(_0x4b204f[_0x5607('0x4a')]['id']){delete _0x4b204f['body']['id'];}return db[_0x5607('0x2e')][_0x5607('0x48')]({'where':{'id':_0x4b204f['params']['id']}})['then'](handleEntityNotFound(_0x20fab2,null))[_0x5607('0x27')](saveUpdates(_0x4b204f[_0x5607('0x4a')],null))['then'](respondWithResult(_0x20fab2,null))[_0x5607('0x44')](handleError(_0x20fab2,null));};exports['destroy']=function(_0x598b1a,_0x4b4d4e){return db[_0x5607('0x2e')][_0x5607('0x48')]({'where':{'id':_0x598b1a[_0x5607('0x46')]['id']}})[_0x5607('0x27')](handleEntityNotFound(_0x4b4d4e,null))[_0x5607('0x27')](removeEntity(_0x4b4d4e,null))['catch'](handleError(_0x4b4d4e,null));}; \ No newline at end of file +var _0xc38e=['save','update','then','destroy','end','error','stack','name','index','map','SquareMessage','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x38e3f4,_0x3d9a48){var _0x465f45=function(_0x1304c9){while(--_0x1304c9){_0x38e3f4['push'](_0x38e3f4['shift']());}};_0x465f45(++_0x3d9a48);}(_0xc38e,0x19e));var _0xec38=function(_0x42ca5d,_0x4efe2f){_0x42ca5d=_0x42ca5d-0x0;var _0x4b1aa6=_0xc38e[_0x42ca5d];return _0x4b1aa6;};'use strict';var emlformat=require(_0xec38('0x0'));var rimraf=require(_0xec38('0x1'));var zipdir=require(_0xec38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec38('0x3'));var moment=require(_0xec38('0x4'));var BPromise=require(_0xec38('0x5'));var Mustache=require(_0xec38('0x6'));var util=require('util');var path=require(_0xec38('0x7'));var sox=require(_0xec38('0x8'));var csv=require(_0xec38('0x9'));var ejs=require(_0xec38('0xa'));var fs=require('fs');var fs_extra=require(_0xec38('0xb'));var _=require(_0xec38('0xc'));var squel=require('squel');var crypto=require(_0xec38('0xd'));var jsforce=require(_0xec38('0xe'));var deskjs=require(_0xec38('0xf'));var toCsv=require(_0xec38('0x9'));var querystring=require(_0xec38('0x10'));var Papa=require(_0xec38('0x11'));var Redis=require(_0xec38('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xec38('0x13'));var as=require(_0xec38('0x14'));var hardwareService=require(_0xec38('0x15'));var logger=require(_0xec38('0x16'))(_0xec38('0x17'));var utils=require(_0xec38('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3952dd,_0xb69c2d){_0xb69c2d=_0xb69c2d||0xcc;return function(_0x36b393){if(_0x36b393){return _0x3952dd[_0xec38('0x19')](_0xb69c2d);}return _0x3952dd[_0xec38('0x1a')](_0xb69c2d)['end']();};}function respondWithResult(_0x15e2bc,_0x278c83){_0x278c83=_0x278c83||0xc8;return function(_0x434513){if(_0x434513){return _0x15e2bc[_0xec38('0x1a')](_0x278c83)[_0xec38('0x1b')](_0x434513);}};}function respondWithFilteredResult(_0x403f5c,_0x3f3c4b){return function(_0x465c13){if(_0x465c13){var _0x1d45e4=typeof _0x3f3c4b[_0xec38('0x1c')]==='undefined'&&typeof _0x3f3c4b[_0xec38('0x1d')]===_0xec38('0x1e');var _0x3c96f5=_0x465c13[_0xec38('0x1f')];var _0x6d6b1=_0x1d45e4?0x0:_0x3f3c4b['offset'];var _0x10b349=_0x1d45e4?_0x465c13[_0xec38('0x1f')]:_0x3f3c4b[_0xec38('0x1c')]+_0x3f3c4b['limit'];var _0x20c8ae;if(_0x10b349>=_0x3c96f5){_0x10b349=_0x3c96f5;_0x20c8ae=0xc8;}else{_0x20c8ae=0xce;}_0x403f5c[_0xec38('0x1a')](_0x20c8ae);return _0x403f5c[_0xec38('0x20')](_0xec38('0x21'),_0x6d6b1+'-'+_0x10b349+'/'+_0x3c96f5)['json'](_0x465c13);}return null;};}function patchUpdates(_0x4c6d76){return function(_0x5a257c){try{jsonpatch[_0xec38('0x22')](_0x5a257c,_0x4c6d76,!![]);}catch(_0x547c29){return BPromise[_0xec38('0x23')](_0x547c29);}return _0x5a257c[_0xec38('0x24')]();};}function saveUpdates(_0x155f51,_0x12d655){return function(_0x53349b){if(_0x53349b){return _0x53349b[_0xec38('0x25')](_0x155f51)[_0xec38('0x26')](function(_0x417629){return _0x417629;});}return null;};}function removeEntity(_0x91f682,_0x3ed00c){return function(_0x2e7edb){if(_0x2e7edb){return _0x2e7edb[_0xec38('0x27')]()[_0xec38('0x26')](function(){_0x91f682[_0xec38('0x1a')](0xcc)[_0xec38('0x28')]();});}};}function handleEntityNotFound(_0x32be18,_0x4d4ec7){return function(_0x8a2a60){if(!_0x8a2a60){_0x32be18[_0xec38('0x19')](0x194);}return _0x8a2a60;};}function handleError(_0x542d88,_0x18f227){_0x18f227=_0x18f227||0x1f4;return function(_0x312671){logger[_0xec38('0x29')](_0x312671[_0xec38('0x2a')]);if(_0x312671['name']){delete _0x312671[_0xec38('0x2b')];}_0x542d88['status'](_0x18f227)['send'](_0x312671);};}exports[_0xec38('0x2c')]=function(_0x22c3ee,_0x25f178){var _0xe3fdba={},_0x577241={},_0x1b9c1b={'count':0x0,'rows':[]};var _0x496bf5=_[_0xec38('0x2d')](db[_0xec38('0x2e')][_0xec38('0x2f')],function(_0x437cce){return{'name':_0x437cce['fieldName'],'type':_0x437cce[_0xec38('0x30')]['key']};});_0x577241[_0xec38('0x31')]=_['map'](_0x496bf5,_0xec38('0x2b'));_0x577241[_0xec38('0x32')]=_[_0xec38('0x33')](_0x22c3ee['query']);_0x577241['filters']=_[_0xec38('0x34')](_0x577241['model'],_0x577241[_0xec38('0x32')]);_0xe3fdba[_0xec38('0x35')]=_['intersection'](_0x577241[_0xec38('0x31')],qs[_0xec38('0x36')](_0x22c3ee['query'][_0xec38('0x36')]));_0xe3fdba[_0xec38('0x35')]=_0xe3fdba[_0xec38('0x35')][_0xec38('0x37')]?_0xe3fdba[_0xec38('0x35')]:_0x577241[_0xec38('0x31')];if(!_0x22c3ee[_0xec38('0x32')][_0xec38('0x38')](_0xec38('0x39'))){_0xe3fdba['limit']=qs[_0xec38('0x1d')](_0x22c3ee[_0xec38('0x32')][_0xec38('0x1d')]);_0xe3fdba[_0xec38('0x1c')]=qs['offset'](_0x22c3ee[_0xec38('0x32')][_0xec38('0x1c')]);}_0xe3fdba[_0xec38('0x3a')]=qs[_0xec38('0x3b')](_0x22c3ee[_0xec38('0x32')][_0xec38('0x3b')]);_0xe3fdba['where']=qs[_0xec38('0x3c')](_['pick'](_0x22c3ee['query'],_0x577241[_0xec38('0x3c')]),_0x496bf5);if(_0x22c3ee[_0xec38('0x32')][_0xec38('0x3d')]){_0xe3fdba['where']=_[_0xec38('0x3e')](_0xe3fdba[_0xec38('0x3f')],{'$or':_[_0xec38('0x2d')](_0x496bf5,function(_0x5314f7){if(_0x5314f7['type']!==_0xec38('0x40')){var _0x5b6b4a={};_0x5b6b4a[_0x5314f7[_0xec38('0x2b')]]={'$like':'%'+_0x22c3ee['query'][_0xec38('0x3d')]+'%'};return _0x5b6b4a;}})});}_0xe3fdba=_[_0xec38('0x3e')]({},_0xe3fdba,_0x22c3ee[_0xec38('0x41')]);var _0x3c0b52={'where':_0xe3fdba[_0xec38('0x3f')]};return db[_0xec38('0x2e')][_0xec38('0x1f')](_0x3c0b52)['then'](function(_0x22dc64){_0x1b9c1b[_0xec38('0x1f')]=_0x22dc64;if(_0x22c3ee[_0xec38('0x32')][_0xec38('0x42')]){_0xe3fdba[_0xec38('0x43')]=[{'all':!![]}];}return db[_0xec38('0x2e')][_0xec38('0x44')](_0xe3fdba);})[_0xec38('0x26')](function(_0x5a897c){_0x1b9c1b[_0xec38('0x45')]=_0x5a897c;return _0x1b9c1b;})[_0xec38('0x26')](respondWithFilteredResult(_0x25f178,_0xe3fdba))[_0xec38('0x46')](handleError(_0x25f178,null));};exports['show']=function(_0x28c668,_0x54ba30){var _0x43cb4f={'raw':!![],'where':{'id':_0x28c668['params']['id']}},_0x1637a2={};_0x1637a2[_0xec38('0x31')]=_['keys'](db['SquareMessage'][_0xec38('0x2f')]);_0x1637a2[_0xec38('0x32')]=_[_0xec38('0x33')](_0x28c668[_0xec38('0x32')]);_0x1637a2[_0xec38('0x3c')]=_[_0xec38('0x34')](_0x1637a2[_0xec38('0x31')],_0x1637a2[_0xec38('0x32')]);_0x43cb4f[_0xec38('0x35')]=_['intersection'](_0x1637a2[_0xec38('0x31')],qs[_0xec38('0x36')](_0x28c668[_0xec38('0x32')][_0xec38('0x36')]));_0x43cb4f['attributes']=_0x43cb4f[_0xec38('0x35')]['length']?_0x43cb4f[_0xec38('0x35')]:_0x1637a2[_0xec38('0x31')];if(_0x28c668[_0xec38('0x32')][_0xec38('0x42')]){_0x43cb4f[_0xec38('0x43')]=[{'all':!![]}];}_0x43cb4f=_['merge']({},_0x43cb4f,_0x28c668[_0xec38('0x41')]);return db[_0xec38('0x2e')][_0xec38('0x47')](_0x43cb4f)['then'](handleEntityNotFound(_0x54ba30,null))[_0xec38('0x26')](respondWithResult(_0x54ba30,null))[_0xec38('0x46')](handleError(_0x54ba30,null));};exports[_0xec38('0x48')]=function(_0x3ebf1d,_0x1ec948){return db[_0xec38('0x2e')][_0xec38('0x48')](_0x3ebf1d[_0xec38('0x49')],{})[_0xec38('0x26')](respondWithResult(_0x1ec948,0xc9))[_0xec38('0x46')](handleError(_0x1ec948,null));};exports[_0xec38('0x25')]=function(_0x5eb2df,_0x53a182){if(_0x5eb2df[_0xec38('0x49')]['id']){delete _0x5eb2df[_0xec38('0x49')]['id'];}return db[_0xec38('0x2e')][_0xec38('0x47')]({'where':{'id':_0x5eb2df[_0xec38('0x4a')]['id']}})[_0xec38('0x26')](handleEntityNotFound(_0x53a182,null))[_0xec38('0x26')](saveUpdates(_0x5eb2df[_0xec38('0x49')],null))[_0xec38('0x26')](respondWithResult(_0x53a182,null))[_0xec38('0x46')](handleError(_0x53a182,null));};exports[_0xec38('0x27')]=function(_0x3a5ba2,_0x131fad){return db[_0xec38('0x2e')]['find']({'where':{'id':_0x3a5ba2[_0xec38('0x4a')]['id']}})[_0xec38('0x26')](handleEntityNotFound(_0x131fad,null))[_0xec38('0x26')](removeEntity(_0x131fad,null))[_0xec38('0x46')](handleError(_0x131fad,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 78d827f..66f7bd4 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 _0xbf2a=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareMessage.attributes','exports','define','SquareMessage','lodash'];(function(_0x4d5721,_0x51a33d){var _0x88a224=function(_0x2b2609){while(--_0x2b2609){_0x4d5721['push'](_0x4d5721['shift']());}};_0x88a224(++_0x51a33d);}(_0xbf2a,0xb3));var _0xabf2=function(_0x428d55,_0x4e5e47){_0x428d55=_0x428d55-0x0;var _0x4ba5fc=_0xbf2a[_0x428d55];return _0x4ba5fc;};'use strict';var _=require(_0xabf2('0x0'));var util=require(_0xabf2('0x1'));var logger=require(_0xabf2('0x2'))(_0xabf2('0x3'));var moment=require(_0xabf2('0x4'));var BPromise=require(_0xabf2('0x5'));var rp=require(_0xabf2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabf2('0x7'));var config=require('../../config/environment');var attributes=require(_0xabf2('0x8'));module[_0xabf2('0x9')]=function(_0x1da61d,_0x33ee26){return _0x1da61d[_0xabf2('0xa')](_0xabf2('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0642=['rimraf','./squareMessage.attributes','SquareMessage','square_messages','util','request-promise','path'];(function(_0x56c2c2,_0x17f162){var _0x38a51d=function(_0x1dd1e2){while(--_0x1dd1e2){_0x56c2c2['push'](_0x56c2c2['shift']());}};_0x38a51d(++_0x17f162);}(_0x0642,0x1e7));var _0x2064=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x0642[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require('lodash');var util=require(_0x2064('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2064('0x1'));var fs=require('fs');var path=require(_0x2064('0x2'));var rimraf=require(_0x2064('0x3'));var config=require('../../config/environment');var attributes=require(_0x2064('0x4'));module['exports']=function(_0x41074f,_0x3c6070){return _0x41074f['define'](_0x2064('0x5'),attributes,{'tableName':_0x2064('0x6'),'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 afe19b2..419e497 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 _0x1753=['SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x1753,0x8b));var _0x3175=function(_0x5722a4,_0x3410c6){_0x5722a4=_0x5722a4-0x0;var _0x431ce4=_0x1753[_0x5722a4];return _0x431ce4;};'use strict';var _=require(_0x3175('0x0'));var util=require(_0x3175('0x1'));var moment=require(_0x3175('0x2'));var BPromise=require(_0x3175('0x3'));var rs=require(_0x3175('0x4'));var fs=require('fs');var Redis=require(_0x3175('0x5'));var db=require(_0x3175('0x6'))['db'];var utils=require(_0x3175('0x7'));var logger=require(_0x3175('0x8'))('rpc');var config=require(_0x3175('0x9'));var jayson=require(_0x3175('0xa'));var client=jayson[_0x3175('0xb')][_0x3175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x414c69,_0x4abcb5,_0x5d1c51){return new BPromise(function(_0x412a93,_0x58f5c8){return client[_0x3175('0xd')](_0x414c69,_0x5d1c51)[_0x3175('0xe')](function(_0x442d2a){logger[_0x3175('0xf')](_0x3175('0x10'),_0x4abcb5,_0x3175('0x11'));logger['debug'](_0x3175('0x12'),_0x4abcb5,_0x3175('0x11'),JSON[_0x3175('0x13')](_0x442d2a));if(_0x442d2a['error']){if(_0x442d2a[_0x3175('0x14')][_0x3175('0x15')]===0x1f4){logger[_0x3175('0x14')](_0x3175('0x10'),_0x4abcb5,_0x442d2a[_0x3175('0x14')][_0x3175('0x16')]);return _0x58f5c8(_0x442d2a[_0x3175('0x14')]['message']);}logger[_0x3175('0x14')](_0x3175('0x10'),_0x4abcb5,_0x442d2a[_0x3175('0x14')][_0x3175('0x16')]);return _0x412a93(_0x442d2a[_0x3175('0x14')][_0x3175('0x16')]);}else{logger['info'](_0x3175('0x10'),_0x4abcb5,_0x3175('0x11'));_0x412a93(_0x442d2a[_0x3175('0x17')][_0x3175('0x16')]);}})[_0x3175('0x18')](function(_0x54ae1f){logger[_0x3175('0x14')]('SquareMessage,\x20%s,\x20%s',_0x4abcb5,_0x54ae1f);_0x58f5c8(_0x54ae1f);});});}exports[_0x3175('0x19')]=function(_0x1f484a){var _0x3bd61c=this;return new Promise(function(_0x1239cb,_0x245457){return db[_0x3175('0x1a')]['create'](_0x1f484a[_0x3175('0x1b')],{'raw':_0x1f484a[_0x3175('0x1c')]?_0x1f484a[_0x3175('0x1c')][_0x3175('0x1d')]===undefined?!![]:![]:!![]})[_0x3175('0xe')](function(_0x40e247){logger[_0x3175('0xf')](_0x3175('0x19'),_0x1f484a);logger[_0x3175('0x1e')](_0x3175('0x19'),_0x1f484a,JSON[_0x3175('0x13')](_0x40e247));_0x1239cb(_0x40e247);})[_0x3175('0x18')](function(_0x28e7b4){logger[_0x3175('0x14')](_0x3175('0x19'),_0x28e7b4[_0x3175('0x16')],_0x1f484a);_0x245457(_0x3bd61c[_0x3175('0x14')](0x1f4,_0x28e7b4['message']));});});}; \ No newline at end of file +var _0x4910=['raw','stringify','lodash','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateSquareMessage','create'];(function(_0x50004c,_0x55215d){var _0x3c8b0=function(_0x32028f){while(--_0x32028f){_0x50004c['push'](_0x50004c['shift']());}};_0x3c8b0(++_0x55215d);}(_0x4910,0x191));var _0x0491=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4910[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0491('0x0'));var util=require('util');var moment=require(_0x0491('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0491('0x2'))['db'];var utils=require(_0x0491('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x0491('0x4'));var jayson=require(_0x0491('0x5'));var client=jayson[_0x0491('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x394aee,_0x34621f,_0x549725){return new BPromise(function(_0x15a76a,_0x4b318f){return client[_0x0491('0x7')](_0x394aee,_0x549725)[_0x0491('0x8')](function(_0x2f502d){logger[_0x0491('0x9')](_0x0491('0xa'),_0x34621f,_0x0491('0xb'));logger[_0x0491('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x34621f,_0x0491('0xb'),JSON['stringify'](_0x2f502d));if(_0x2f502d[_0x0491('0xd')]){if(_0x2f502d[_0x0491('0xd')]['code']===0x1f4){logger[_0x0491('0xd')](_0x0491('0xa'),_0x34621f,_0x2f502d['error'][_0x0491('0xe')]);return _0x4b318f(_0x2f502d[_0x0491('0xd')][_0x0491('0xe')]);}logger['error'](_0x0491('0xa'),_0x34621f,_0x2f502d['error'][_0x0491('0xe')]);return _0x15a76a(_0x2f502d[_0x0491('0xd')]['message']);}else{logger[_0x0491('0x9')](_0x0491('0xa'),_0x34621f,_0x0491('0xb'));_0x15a76a(_0x2f502d[_0x0491('0xf')][_0x0491('0xe')]);}})[_0x0491('0x10')](function(_0x43a6ca){logger[_0x0491('0xd')](_0x0491('0xa'),_0x34621f,_0x43a6ca);_0x4b318f(_0x43a6ca);});});}exports[_0x0491('0x11')]=function(_0x33ccb5){var _0x1643e7=this;return new Promise(function(_0x36358b,_0x48fbba){return db['SquareMessage'][_0x0491('0x12')](_0x33ccb5['body'],{'raw':_0x33ccb5['options']?_0x33ccb5['options'][_0x0491('0x13')]===undefined?!![]:![]:!![]})[_0x0491('0x8')](function(_0x2289a3){logger[_0x0491('0x9')](_0x0491('0x11'),_0x33ccb5);logger['debug'](_0x0491('0x11'),_0x33ccb5,JSON[_0x0491('0x14')](_0x2289a3));_0x36358b(_0x2289a3);})[_0x0491('0x10')](function(_0x339770){logger[_0x0491('0xd')](_0x0491('0x11'),_0x339770[_0x0491('0xe')],_0x33ccb5);_0x48fbba(_0x1643e7[_0x0491('0xd')](0x1f4,_0x339770[_0x0491('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7cccd21..b2b72d8 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 _0x49de=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','post'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x49de,0xf4));var _0xe49d=function(_0x466186,_0x2276fb){_0x466186=_0x466186-0x0;var _0x1ee9af=_0x49de[_0x466186];return _0x1ee9af;};'use strict';var multer=require(_0xe49d('0x0'));var util=require(_0xe49d('0x1'));var path=require(_0xe49d('0x2'));var timeout=require(_0xe49d('0x3'));var express=require(_0xe49d('0x4'));var router=express['Router']();var fs_extra=require(_0xe49d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe49d('0x6'));var controller=require(_0xe49d('0x7'));router[_0xe49d('0x8')]('/',auth[_0xe49d('0x9')](),controller[_0xe49d('0xa')]);router[_0xe49d('0x8')](_0xe49d('0xb'),auth[_0xe49d('0x9')](),controller[_0xe49d('0xc')]);router[_0xe49d('0x8')](_0xe49d('0xd'),auth[_0xe49d('0x9')](),timeout(_0xe49d('0xe')),controller['test']);router[_0xe49d('0xf')]('/',auth[_0xe49d('0x9')](),controller['create']);router[_0xe49d('0x10')](_0xe49d('0xb'),auth[_0xe49d('0x9')](),controller['update']);router[_0xe49d('0x11')](_0xe49d('0xb'),auth['isAuthenticated'](),controller[_0xe49d('0x12')]);module[_0xe49d('0x13')]=router; \ No newline at end of file +var _0x8cd7=['create','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','test','post'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8cd7,0x159));var _0x78cd=function(_0x3aecfa,_0x5bb070){_0x3aecfa=_0x3aecfa-0x0;var _0x228b31=_0x8cd7[_0x3aecfa];return _0x228b31;};'use strict';var multer=require(_0x78cd('0x0'));var util=require('util');var path=require(_0x78cd('0x1'));var timeout=require(_0x78cd('0x2'));var express=require(_0x78cd('0x3'));var router=express['Router']();var fs_extra=require(_0x78cd('0x4'));var auth=require(_0x78cd('0x5'));var interaction=require(_0x78cd('0x6'));var config=require(_0x78cd('0x7'));var controller=require(_0x78cd('0x8'));router[_0x78cd('0x9')]('/',auth[_0x78cd('0xa')](),controller[_0x78cd('0xb')]);router[_0x78cd('0x9')](_0x78cd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x78cd('0x9')](_0x78cd('0xd'),auth[_0x78cd('0xa')](),timeout('15s'),controller[_0x78cd('0xe')]);router[_0x78cd('0xf')]('/',auth[_0x78cd('0xa')](),controller[_0x78cd('0x10')]);router['put'](_0x78cd('0xc'),auth[_0x78cd('0xa')](),controller['update']);router[_0x78cd('0x11')](_0x78cd('0xc'),auth[_0x78cd('0xa')](),controller[_0x78cd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 784755c..899671d 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 _0x67e0=['STRING','sequelize','exports'];(function(_0x5a1c1b,_0x3e9004){var _0x48b509=function(_0x3d26fb){while(--_0x3d26fb){_0x5a1c1b['push'](_0x5a1c1b['shift']());}};_0x48b509(++_0x3e9004);}(_0x67e0,0x139));var _0x067e=function(_0x239786,_0x471f27){_0x239786=_0x239786-0x0;var _0x3f15e2=_0x67e0[_0x239786];return _0x3f15e2;};'use strict';var Sequelize=require(_0x067e('0x0'));module[_0x067e('0x1')]={'name':{'type':Sequelize[_0x067e('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x067e('0x2')]},'description':{'type':Sequelize[_0x067e('0x2')]}}; \ No newline at end of file +var _0x7aa2=['name','sequelize','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7aa2,0x199));var _0x27aa=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x7aa2[_0x44268d];return _0x4be92d;};'use strict';var Sequelize=require(_0x27aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x27aa('0x1')],'unique':_0x27aa('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x27aa('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 296421a..391cbe1 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 _0x8eb0=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','key','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','VIRTUAL','include','findAll','rows','show','merge','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','params','test','dsn','odbc','openSync','closeSync','rimraf'];(function(_0x1bfdb1,_0x132a27){var _0x2f15e9=function(_0x43f810){while(--_0x43f810){_0x1bfdb1['push'](_0x1bfdb1['shift']());}};_0x2f15e9(++_0x132a27);}(_0x8eb0,0x1bc));var _0x08eb=function(_0x2486be,_0x5d7dd2){_0x2486be=_0x2486be-0x0;var _0x24042b=_0x8eb0[_0x2486be];return _0x24042b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x08eb('0x0'));var zipdir=require(_0x08eb('0x1'));var jsonpatch=require(_0x08eb('0x2'));var rp=require(_0x08eb('0x3'));var moment=require(_0x08eb('0x4'));var BPromise=require(_0x08eb('0x5'));var Mustache=require(_0x08eb('0x6'));var util=require(_0x08eb('0x7'));var path=require(_0x08eb('0x8'));var sox=require(_0x08eb('0x9'));var csv=require(_0x08eb('0xa'));var ejs=require(_0x08eb('0xb'));var fs=require('fs');var fs_extra=require(_0x08eb('0xc'));var _=require('lodash');var squel=require(_0x08eb('0xd'));var crypto=require(_0x08eb('0xe'));var jsforce=require(_0x08eb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08eb('0x10'));var Papa=require(_0x08eb('0x11'));var Redis=require(_0x08eb('0x12'));var authService=require(_0x08eb('0x13'));var qs=require(_0x08eb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08eb('0x15'));var logger=require(_0x08eb('0x16'))(_0x08eb('0x17'));var utils=require('../../config/utils');var config=require(_0x08eb('0x18'));var licenseUtil=require(_0x08eb('0x19'));var db=require(_0x08eb('0x1a'))['db'];function respondWithStatusCode(_0x327d67,_0x31d7e5){_0x31d7e5=_0x31d7e5||0xcc;return function(_0x53f19b){if(_0x53f19b){return _0x327d67[_0x08eb('0x1b')](_0x31d7e5);}return _0x327d67[_0x08eb('0x1c')](_0x31d7e5)[_0x08eb('0x1d')]();};}function respondWithResult(_0x37f374,_0x111812){_0x111812=_0x111812||0xc8;return function(_0x43a2ea){if(_0x43a2ea){return _0x37f374['status'](_0x111812)[_0x08eb('0x1e')](_0x43a2ea);}};}function respondWithFilteredResult(_0x2546bb,_0x214ada){return function(_0x43e5cc){if(_0x43e5cc){var _0x499825=typeof _0x214ada['offset']==='undefined'&&typeof _0x214ada[_0x08eb('0x1f')]===_0x08eb('0x20');var _0x2df2a6=_0x43e5cc[_0x08eb('0x21')];var _0x4c3c32=_0x499825?0x0:_0x214ada[_0x08eb('0x22')];var _0x1a66b1=_0x499825?_0x43e5cc['count']:_0x214ada[_0x08eb('0x22')]+_0x214ada[_0x08eb('0x1f')];var _0x2e5f16;if(_0x1a66b1>=_0x2df2a6){_0x1a66b1=_0x2df2a6;_0x2e5f16=0xc8;}else{_0x2e5f16=0xce;}_0x2546bb[_0x08eb('0x1c')](_0x2e5f16);return _0x2546bb[_0x08eb('0x23')](_0x08eb('0x24'),_0x4c3c32+'-'+_0x1a66b1+'/'+_0x2df2a6)[_0x08eb('0x1e')](_0x43e5cc);}return null;};}function patchUpdates(_0x509b56){return function(_0x1679c9){try{jsonpatch[_0x08eb('0x25')](_0x1679c9,_0x509b56,!![]);}catch(_0x36b807){return BPromise[_0x08eb('0x26')](_0x36b807);}return _0x1679c9['save']();};}function saveUpdates(_0x3044a5,_0x26a7b5){return function(_0x158c9a){if(_0x158c9a){return _0x158c9a[_0x08eb('0x27')](_0x3044a5)[_0x08eb('0x28')](function(_0x1eb4b9){return _0x1eb4b9;});}return null;};}function removeEntity(_0x20178d,_0x1ffb51){return function(_0x20865f){if(_0x20865f){return _0x20865f[_0x08eb('0x29')]()[_0x08eb('0x28')](function(){var _0x465e02=_0x20865f[_0x08eb('0x2a')]({'plain':!![]});var _0x282c7c=_0x08eb('0x2b');return db['UserProfileResource'][_0x08eb('0x29')]({'where':{'type':_0x282c7c,'resourceId':_0x465e02['id']}})[_0x08eb('0x28')](function(){return _0x20865f;});})[_0x08eb('0x28')](function(){_0x20178d[_0x08eb('0x1c')](0xcc)[_0x08eb('0x1d')]();});}};}function handleEntityNotFound(_0x1e761c,_0x4eed20){return function(_0x58c60a){if(!_0x58c60a){_0x1e761c['sendStatus'](0x194);}return _0x58c60a;};}function handleError(_0x4346e9,_0x2f2671){_0x2f2671=_0x2f2671||0x1f4;return function(_0x5cef1b){logger['error'](_0x5cef1b[_0x08eb('0x2c')]);if(_0x5cef1b['name']){delete _0x5cef1b[_0x08eb('0x2d')];}_0x4346e9[_0x08eb('0x1c')](_0x2f2671)[_0x08eb('0x2e')](_0x5cef1b);};}exports['index']=function(_0x4f5e2b,_0x595fee){var _0x2fa7b6={},_0x350eb1={},_0x44836c={'count':0x0,'rows':[]};var _0x2cffc1=_['map'](db[_0x08eb('0x2f')][_0x08eb('0x30')],function(_0x1220b5){return{'name':_0x1220b5[_0x08eb('0x31')],'type':_0x1220b5[_0x08eb('0x32')][_0x08eb('0x33')]};});_0x350eb1['model']=_[_0x08eb('0x34')](_0x2cffc1,_0x08eb('0x2d'));_0x350eb1['query']=_[_0x08eb('0x35')](_0x4f5e2b[_0x08eb('0x36')]);_0x350eb1[_0x08eb('0x37')]=_['intersection'](_0x350eb1[_0x08eb('0x38')],_0x350eb1[_0x08eb('0x36')]);_0x2fa7b6['attributes']=_[_0x08eb('0x39')](_0x350eb1[_0x08eb('0x38')],qs[_0x08eb('0x3a')](_0x4f5e2b['query']['fields']));_0x2fa7b6[_0x08eb('0x3b')]=_0x2fa7b6[_0x08eb('0x3b')][_0x08eb('0x3c')]?_0x2fa7b6[_0x08eb('0x3b')]:_0x350eb1[_0x08eb('0x38')];if(!_0x4f5e2b[_0x08eb('0x36')][_0x08eb('0x3d')]('nolimit')){_0x2fa7b6['limit']=qs[_0x08eb('0x1f')](_0x4f5e2b[_0x08eb('0x36')]['limit']);_0x2fa7b6['offset']=qs[_0x08eb('0x22')](_0x4f5e2b[_0x08eb('0x36')][_0x08eb('0x22')]);}_0x2fa7b6['order']=qs['sort'](_0x4f5e2b['query'][_0x08eb('0x3e')]);_0x2fa7b6[_0x08eb('0x3f')]=qs[_0x08eb('0x37')](_['pick'](_0x4f5e2b['query'],_0x350eb1[_0x08eb('0x37')]),_0x2cffc1);if(_0x4f5e2b[_0x08eb('0x36')][_0x08eb('0x40')]){_0x2fa7b6[_0x08eb('0x3f')]=_['merge'](_0x2fa7b6[_0x08eb('0x3f')],{'$or':_[_0x08eb('0x34')](_0x2cffc1,function(_0x39096e){if(_0x39096e[_0x08eb('0x32')]!==_0x08eb('0x41')){var _0x552721={};_0x552721[_0x39096e[_0x08eb('0x2d')]]={'$like':'%'+_0x4f5e2b[_0x08eb('0x36')][_0x08eb('0x40')]+'%'};return _0x552721;}})});}_0x2fa7b6=_['merge']({},_0x2fa7b6,_0x4f5e2b['options']);var _0x39bc53={'where':_0x2fa7b6[_0x08eb('0x3f')]};return db[_0x08eb('0x2f')]['count'](_0x39bc53)[_0x08eb('0x28')](function(_0x1e4aec){_0x44836c[_0x08eb('0x21')]=_0x1e4aec;if(_0x4f5e2b[_0x08eb('0x36')]['includeAll']){_0x2fa7b6[_0x08eb('0x42')]=[{'all':!![]}];}return db[_0x08eb('0x2f')][_0x08eb('0x43')](_0x2fa7b6);})[_0x08eb('0x28')](function(_0x2ab8c3){_0x44836c[_0x08eb('0x44')]=_0x2ab8c3;return _0x44836c;})[_0x08eb('0x28')](respondWithFilteredResult(_0x595fee,_0x2fa7b6))['catch'](handleError(_0x595fee,null));};exports[_0x08eb('0x45')]=function(_0x22d5a3,_0x2c6e2d){var _0x254c82={'raw':!![],'where':{'id':_0x22d5a3['params']['id']}},_0xa44bd8={};_0xa44bd8[_0x08eb('0x38')]=_[_0x08eb('0x35')](db['SquareOdbc'][_0x08eb('0x30')]);_0xa44bd8[_0x08eb('0x36')]=_['keys'](_0x22d5a3[_0x08eb('0x36')]);_0xa44bd8[_0x08eb('0x37')]=_['intersection'](_0xa44bd8[_0x08eb('0x38')],_0xa44bd8['query']);_0x254c82[_0x08eb('0x3b')]=_[_0x08eb('0x39')](_0xa44bd8[_0x08eb('0x38')],qs['fields'](_0x22d5a3['query'][_0x08eb('0x3a')]));_0x254c82['attributes']=_0x254c82[_0x08eb('0x3b')][_0x08eb('0x3c')]?_0x254c82['attributes']:_0xa44bd8[_0x08eb('0x38')];if(_0x22d5a3[_0x08eb('0x36')]['includeAll']){_0x254c82['include']=[{'all':!![]}];}_0x254c82=_[_0x08eb('0x46')]({},_0x254c82,_0x22d5a3[_0x08eb('0x47')]);return db['SquareOdbc'][_0x08eb('0x48')](_0x254c82)[_0x08eb('0x28')](handleEntityNotFound(_0x2c6e2d,null))['then'](respondWithResult(_0x2c6e2d,null))[_0x08eb('0x49')](handleError(_0x2c6e2d,null));};exports['create']=function(_0x105a65,_0x1b1bd2){return db[_0x08eb('0x2f')][_0x08eb('0x4a')](_0x105a65['body'],{})['then'](function(_0x4372fc){var _0x38a29f=_0x105a65['user'][_0x08eb('0x2a')]({'plain':!![]});if(!_0x38a29f)throw new Error(_0x08eb('0x4b'));if(_0x38a29f[_0x08eb('0x4c')]===_0x08eb('0x4d')){var _0x3e310a=_0x4372fc['get']({'plain':!![]});var _0x4790ba=_0x08eb('0x2b');return db[_0x08eb('0x4e')][_0x08eb('0x48')]({'where':{'name':_0x4790ba,'userProfileId':_0x38a29f[_0x08eb('0x4f')]},'raw':!![]})[_0x08eb('0x28')](function(_0x1189d8){if(_0x1189d8&&_0x1189d8[_0x08eb('0x50')]===0x0){return db[_0x08eb('0x51')][_0x08eb('0x4a')]({'name':_0x3e310a[_0x08eb('0x2d')],'resourceId':_0x3e310a['id'],'type':_0x1189d8[_0x08eb('0x2d')],'sectionId':_0x1189d8['id']},{})['then'](function(){return _0x4372fc;});}else{return _0x4372fc;}})[_0x08eb('0x49')](function(_0x22d359){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22d359);throw _0x22d359;});}return _0x4372fc;})[_0x08eb('0x28')](respondWithResult(_0x1b1bd2,0xc9))['catch'](handleError(_0x1b1bd2,null));};exports[_0x08eb('0x27')]=function(_0x594142,_0x2e1838){if(_0x594142[_0x08eb('0x52')]['id']){delete _0x594142[_0x08eb('0x52')]['id'];}return db[_0x08eb('0x2f')][_0x08eb('0x48')]({'where':{'id':_0x594142[_0x08eb('0x53')]['id']}})[_0x08eb('0x28')](handleEntityNotFound(_0x2e1838,null))['then'](saveUpdates(_0x594142['body'],null))[_0x08eb('0x28')](respondWithResult(_0x2e1838,null))[_0x08eb('0x49')](handleError(_0x2e1838,null));};exports[_0x08eb('0x29')]=function(_0x58b6ec,_0x438bf5){return db[_0x08eb('0x2f')][_0x08eb('0x48')]({'where':{'id':_0x58b6ec[_0x08eb('0x53')]['id']}})[_0x08eb('0x28')](handleEntityNotFound(_0x438bf5,null))[_0x08eb('0x28')](removeEntity(_0x438bf5,null))[_0x08eb('0x49')](handleError(_0x438bf5,null));};exports[_0x08eb('0x54')]=function(_0x161839,_0x466f91,_0x4c09ee){var _0x16bb29;return db[_0x08eb('0x2f')][_0x08eb('0x48')]({'where':{'id':_0x161839[_0x08eb('0x53')]['id']},'attributes':['id',_0x08eb('0x55')]})['then'](handleEntityNotFound(_0x466f91,null))[_0x08eb('0x28')](function(_0x90294f){if(_0x90294f){var _0x511fe9=require(_0x08eb('0x56'))();_0x511fe9[_0x08eb('0x57')](_0x90294f[_0x08eb('0x55')]);_0x511fe9[_0x08eb('0x58')]();return _0x90294f;}})['then'](respondWithResult(_0x466f91,null))[_0x08eb('0x49')](handleError(_0x466f91,null));}; \ No newline at end of file +var _0x2dd9=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','error','stack','name','map','SquareOdbc','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','find','create','user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','moment','mustache','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x42d3cb,_0x37a5aa){var _0x1cef5f=function(_0x2a44b0){while(--_0x2a44b0){_0x42d3cb['push'](_0x42d3cb['shift']());}};_0x1cef5f(++_0x37a5aa);}(_0x2dd9,0x13a));var _0x92dd=function(_0x3df7af,_0x27802b){_0x3df7af=_0x3df7af-0x0;var _0x1e29f9=_0x2dd9[_0x3df7af];return _0x1e29f9;};'use strict';var emlformat=require(_0x92dd('0x0'));var rimraf=require(_0x92dd('0x1'));var zipdir=require(_0x92dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x92dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x92dd('0x4'));var util=require('util');var path=require(_0x92dd('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x92dd('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92dd('0x7'));var squel=require(_0x92dd('0x8'));var crypto=require(_0x92dd('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x92dd('0xa'));var querystring=require(_0x92dd('0xb'));var Papa=require(_0x92dd('0xc'));var Redis=require('ioredis');var authService=require(_0x92dd('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x92dd('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92dd('0xf'))(_0x92dd('0x10'));var utils=require(_0x92dd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x92dd('0x12'));var db=require(_0x92dd('0x13'))['db'];function respondWithStatusCode(_0x3d90a4,_0x1d5539){_0x1d5539=_0x1d5539||0xcc;return function(_0x252dbb){if(_0x252dbb){return _0x3d90a4['sendStatus'](_0x1d5539);}return _0x3d90a4[_0x92dd('0x14')](_0x1d5539)[_0x92dd('0x15')]();};}function respondWithResult(_0x895689,_0x2f9cd4){_0x2f9cd4=_0x2f9cd4||0xc8;return function(_0x21b9e4){if(_0x21b9e4){return _0x895689['status'](_0x2f9cd4)[_0x92dd('0x16')](_0x21b9e4);}};}function respondWithFilteredResult(_0x2374a7,_0x5daf38){return function(_0x2985ee){if(_0x2985ee){var _0x175577=typeof _0x5daf38[_0x92dd('0x17')]===_0x92dd('0x18')&&typeof _0x5daf38[_0x92dd('0x19')]==='undefined';var _0x4f7d0e=_0x2985ee[_0x92dd('0x1a')];var _0x4e0399=_0x175577?0x0:_0x5daf38[_0x92dd('0x17')];var _0x4bf861=_0x175577?_0x2985ee['count']:_0x5daf38[_0x92dd('0x17')]+_0x5daf38[_0x92dd('0x19')];var _0x436474;if(_0x4bf861>=_0x4f7d0e){_0x4bf861=_0x4f7d0e;_0x436474=0xc8;}else{_0x436474=0xce;}_0x2374a7[_0x92dd('0x14')](_0x436474);return _0x2374a7[_0x92dd('0x1b')](_0x92dd('0x1c'),_0x4e0399+'-'+_0x4bf861+'/'+_0x4f7d0e)['json'](_0x2985ee);}return null;};}function patchUpdates(_0x2a2988){return function(_0x30b841){try{jsonpatch[_0x92dd('0x1d')](_0x30b841,_0x2a2988,!![]);}catch(_0x5095db){return BPromise[_0x92dd('0x1e')](_0x5095db);}return _0x30b841['save']();};}function saveUpdates(_0x53c00c,_0x1b71e6){return function(_0x4bf685){if(_0x4bf685){return _0x4bf685[_0x92dd('0x1f')](_0x53c00c)['then'](function(_0x4eeb17){return _0x4eeb17;});}return null;};}function removeEntity(_0x2e02f7,_0x5971c9){return function(_0xb142d){if(_0xb142d){return _0xb142d[_0x92dd('0x20')]()[_0x92dd('0x21')](function(){var _0x7fc16=_0xb142d[_0x92dd('0x22')]({'plain':!![]});var _0x516d6a='ODBC';return db[_0x92dd('0x23')][_0x92dd('0x20')]({'where':{'type':_0x516d6a,'resourceId':_0x7fc16['id']}})[_0x92dd('0x21')](function(){return _0xb142d;});})[_0x92dd('0x21')](function(){_0x2e02f7['status'](0xcc)[_0x92dd('0x15')]();});}};}function handleEntityNotFound(_0x1bbd8c,_0x291eb0){return function(_0xf953c9){if(!_0xf953c9){_0x1bbd8c['sendStatus'](0x194);}return _0xf953c9;};}function handleError(_0x4571b2,_0x290bb3){_0x290bb3=_0x290bb3||0x1f4;return function(_0x48198f){logger[_0x92dd('0x24')](_0x48198f[_0x92dd('0x25')]);if(_0x48198f[_0x92dd('0x26')]){delete _0x48198f[_0x92dd('0x26')];}_0x4571b2['status'](_0x290bb3)['send'](_0x48198f);};}exports['index']=function(_0x216d12,_0x44cfe9){var _0x24a3d1={},_0x10df12={},_0x165701={'count':0x0,'rows':[]};var _0x3b4045=_[_0x92dd('0x27')](db[_0x92dd('0x28')][_0x92dd('0x29')],function(_0x4aa3ce){return{'name':_0x4aa3ce[_0x92dd('0x2a')],'type':_0x4aa3ce['type'][_0x92dd('0x2b')]};});_0x10df12['model']=_[_0x92dd('0x27')](_0x3b4045,_0x92dd('0x26'));_0x10df12[_0x92dd('0x2c')]=_['keys'](_0x216d12[_0x92dd('0x2c')]);_0x10df12[_0x92dd('0x2d')]=_[_0x92dd('0x2e')](_0x10df12[_0x92dd('0x2f')],_0x10df12[_0x92dd('0x2c')]);_0x24a3d1[_0x92dd('0x30')]=_[_0x92dd('0x2e')](_0x10df12['model'],qs[_0x92dd('0x31')](_0x216d12[_0x92dd('0x2c')][_0x92dd('0x31')]));_0x24a3d1[_0x92dd('0x30')]=_0x24a3d1[_0x92dd('0x30')][_0x92dd('0x32')]?_0x24a3d1['attributes']:_0x10df12['model'];if(!_0x216d12[_0x92dd('0x2c')][_0x92dd('0x33')](_0x92dd('0x34'))){_0x24a3d1['limit']=qs['limit'](_0x216d12[_0x92dd('0x2c')][_0x92dd('0x19')]);_0x24a3d1[_0x92dd('0x17')]=qs['offset'](_0x216d12[_0x92dd('0x2c')][_0x92dd('0x17')]);}_0x24a3d1[_0x92dd('0x35')]=qs['sort'](_0x216d12[_0x92dd('0x2c')][_0x92dd('0x36')]);_0x24a3d1[_0x92dd('0x37')]=qs[_0x92dd('0x2d')](_[_0x92dd('0x38')](_0x216d12[_0x92dd('0x2c')],_0x10df12[_0x92dd('0x2d')]),_0x3b4045);if(_0x216d12[_0x92dd('0x2c')][_0x92dd('0x39')]){_0x24a3d1[_0x92dd('0x37')]=_[_0x92dd('0x3a')](_0x24a3d1[_0x92dd('0x37')],{'$or':_[_0x92dd('0x27')](_0x3b4045,function(_0x42e301){if(_0x42e301[_0x92dd('0x3b')]!=='VIRTUAL'){var _0x3072f9={};_0x3072f9[_0x42e301['name']]={'$like':'%'+_0x216d12['query']['filter']+'%'};return _0x3072f9;}})});}_0x24a3d1=_[_0x92dd('0x3a')]({},_0x24a3d1,_0x216d12[_0x92dd('0x3c')]);var _0x13aedc={'where':_0x24a3d1['where']};return db[_0x92dd('0x28')]['count'](_0x13aedc)['then'](function(_0x3af516){_0x165701[_0x92dd('0x1a')]=_0x3af516;if(_0x216d12[_0x92dd('0x2c')][_0x92dd('0x3d')]){_0x24a3d1[_0x92dd('0x3e')]=[{'all':!![]}];}return db[_0x92dd('0x28')]['findAll'](_0x24a3d1);})[_0x92dd('0x21')](function(_0x1ea0e2){_0x165701[_0x92dd('0x3f')]=_0x1ea0e2;return _0x165701;})[_0x92dd('0x21')](respondWithFilteredResult(_0x44cfe9,_0x24a3d1))[_0x92dd('0x40')](handleError(_0x44cfe9,null));};exports[_0x92dd('0x41')]=function(_0x305df0,_0x4ec76d){var _0x513869={'raw':!![],'where':{'id':_0x305df0[_0x92dd('0x42')]['id']}},_0x398d7c={};_0x398d7c[_0x92dd('0x2f')]=_[_0x92dd('0x43')](db[_0x92dd('0x28')][_0x92dd('0x29')]);_0x398d7c[_0x92dd('0x2c')]=_[_0x92dd('0x43')](_0x305df0[_0x92dd('0x2c')]);_0x398d7c['filters']=_[_0x92dd('0x2e')](_0x398d7c[_0x92dd('0x2f')],_0x398d7c[_0x92dd('0x2c')]);_0x513869[_0x92dd('0x30')]=_[_0x92dd('0x2e')](_0x398d7c[_0x92dd('0x2f')],qs[_0x92dd('0x31')](_0x305df0[_0x92dd('0x2c')][_0x92dd('0x31')]));_0x513869[_0x92dd('0x30')]=_0x513869[_0x92dd('0x30')][_0x92dd('0x32')]?_0x513869[_0x92dd('0x30')]:_0x398d7c['model'];if(_0x305df0[_0x92dd('0x2c')]['includeAll']){_0x513869[_0x92dd('0x3e')]=[{'all':!![]}];}_0x513869=_[_0x92dd('0x3a')]({},_0x513869,_0x305df0[_0x92dd('0x3c')]);return db[_0x92dd('0x28')][_0x92dd('0x44')](_0x513869)[_0x92dd('0x21')](handleEntityNotFound(_0x4ec76d,null))['then'](respondWithResult(_0x4ec76d,null))['catch'](handleError(_0x4ec76d,null));};exports[_0x92dd('0x45')]=function(_0x1b1573,_0x570eee){return db['SquareOdbc'][_0x92dd('0x45')](_0x1b1573['body'],{})['then'](function(_0x2bd980){var _0x3df450=_0x1b1573[_0x92dd('0x46')][_0x92dd('0x22')]({'plain':!![]});if(!_0x3df450)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3df450[_0x92dd('0x47')]===_0x92dd('0x46')){var _0x5a64b2=_0x2bd980[_0x92dd('0x22')]({'plain':!![]});var _0x4759ec=_0x92dd('0x48');return db[_0x92dd('0x49')][_0x92dd('0x44')]({'where':{'name':_0x4759ec,'userProfileId':_0x3df450[_0x92dd('0x4a')]},'raw':!![]})['then'](function(_0x829ca2){if(_0x829ca2&&_0x829ca2[_0x92dd('0x4b')]===0x0){return db[_0x92dd('0x23')]['create']({'name':_0x5a64b2[_0x92dd('0x26')],'resourceId':_0x5a64b2['id'],'type':_0x829ca2['name'],'sectionId':_0x829ca2['id']},{})['then'](function(){return _0x2bd980;});}else{return _0x2bd980;}})[_0x92dd('0x40')](function(_0x14d6e1){logger['error'](_0x92dd('0x4c'),_0x14d6e1);throw _0x14d6e1;});}return _0x2bd980;})[_0x92dd('0x21')](respondWithResult(_0x570eee,0xc9))['catch'](handleError(_0x570eee,null));};exports[_0x92dd('0x1f')]=function(_0x41cebc,_0x4f8f84){if(_0x41cebc[_0x92dd('0x4d')]['id']){delete _0x41cebc[_0x92dd('0x4d')]['id'];}return db[_0x92dd('0x28')][_0x92dd('0x44')]({'where':{'id':_0x41cebc['params']['id']}})[_0x92dd('0x21')](handleEntityNotFound(_0x4f8f84,null))['then'](saveUpdates(_0x41cebc['body'],null))['then'](respondWithResult(_0x4f8f84,null))[_0x92dd('0x40')](handleError(_0x4f8f84,null));};exports[_0x92dd('0x20')]=function(_0x4ff0aa,_0x335380){return db[_0x92dd('0x28')]['find']({'where':{'id':_0x4ff0aa[_0x92dd('0x42')]['id']}})['then'](handleEntityNotFound(_0x335380,null))[_0x92dd('0x21')](removeEntity(_0x335380,null))['catch'](handleError(_0x335380,null));};exports[_0x92dd('0x4e')]=function(_0x250025,_0x4dab6a,_0x530671){var _0x2264cf;return db[_0x92dd('0x28')][_0x92dd('0x44')]({'where':{'id':_0x250025[_0x92dd('0x42')]['id']},'attributes':['id',_0x92dd('0x4f')]})[_0x92dd('0x21')](handleEntityNotFound(_0x4dab6a,null))[_0x92dd('0x21')](function(_0x22be4a){if(_0x22be4a){var _0x1e9745=require(_0x92dd('0x50'))();_0x1e9745['openSync'](_0x22be4a['dsn']);_0x1e9745[_0x92dd('0x51')]();return _0x22be4a;}})['then'](respondWithResult(_0x4dab6a,null))['catch'](handleError(_0x4dab6a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 00dd8e6..0a90a66 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 _0x6765=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','square_odbc','lodash'];(function(_0x2104a9,_0x2a3d5c){var _0x391bea=function(_0x90742c){while(--_0x90742c){_0x2104a9['push'](_0x2104a9['shift']());}};_0x391bea(++_0x2a3d5c);}(_0x6765,0x10d));var _0x5676=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x6765[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x5676('0x0'));var util=require(_0x5676('0x1'));var logger=require(_0x5676('0x2'))(_0x5676('0x3'));var moment=require('moment');var BPromise=require(_0x5676('0x4'));var rp=require(_0x5676('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5676('0x6'));var config=require(_0x5676('0x7'));var attributes=require(_0x5676('0x8'));module['exports']=function(_0x849350,_0x1a72fa){return _0x849350['define']('SquareOdbc',attributes,{'tableName':_0x5676('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4556=['util','../../config/logger','api','bluebird','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x30d992,_0x2e1800){var _0x2ca356=function(_0x197b6c){while(--_0x197b6c){_0x30d992['push'](_0x30d992['shift']());}};_0x2ca356(++_0x2e1800);}(_0x4556,0x17f));var _0x6455=function(_0x8dc2aa,_0x2e2cbb){_0x8dc2aa=_0x8dc2aa-0x0;var _0x1262ab=_0x4556[_0x8dc2aa];return _0x1262ab;};'use strict';var _=require(_0x6455('0x0'));var util=require(_0x6455('0x1'));var logger=require(_0x6455('0x2'))(_0x6455('0x3'));var moment=require('moment');var BPromise=require(_0x6455('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6455('0x5'));var rimraf=require(_0x6455('0x6'));var config=require('../../config/environment');var attributes=require(_0x6455('0x7'));module[_0x6455('0x8')]=function(_0x1b42b3,_0x3bd8b3){return _0x1b42b3[_0x6455('0x9')](_0x6455('0xa'),attributes,{'tableName':_0x6455('0xb'),'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 3974056..d7e991f 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 _0x5a5f=['request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareOdbc','options','where','include','map','model','attributes','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1e24ce,_0x3d22ba){var _0x4b91af=function(_0xafbe36){while(--_0xafbe36){_0x1e24ce['push'](_0x1e24ce['shift']());}};_0x4b91af(++_0x3d22ba);}(_0x5a5f,0x1a1));var _0xf5a5=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x5a5f[_0x1b2422];return _0x376573;};'use strict';var _=require(_0xf5a5('0x0'));var util=require(_0xf5a5('0x1'));var moment=require(_0xf5a5('0x2'));var BPromise=require(_0xf5a5('0x3'));var rs=require(_0xf5a5('0x4'));var fs=require('fs');var Redis=require(_0xf5a5('0x5'));var db=require(_0xf5a5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5a5('0x7'))('rpc');var config=require(_0xf5a5('0x8'));var jayson=require(_0xf5a5('0x9'));var client=jayson[_0xf5a5('0xa')][_0xf5a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd5a91,_0x3e0823,_0x1c5ebb){return new BPromise(function(_0x1535de,_0x4ff3b8){return client[_0xf5a5('0xc')](_0xd5a91,_0x1c5ebb)[_0xf5a5('0xd')](function(_0x4810c0){logger['info'](_0xf5a5('0xe'),_0x3e0823,_0xf5a5('0xf'));logger[_0xf5a5('0x10')](_0xf5a5('0x11'),_0x3e0823,'request\x20sent',JSON[_0xf5a5('0x12')](_0x4810c0));if(_0x4810c0['error']){if(_0x4810c0[_0xf5a5('0x13')][_0xf5a5('0x14')]===0x1f4){logger[_0xf5a5('0x13')](_0xf5a5('0xe'),_0x3e0823,_0x4810c0['error'][_0xf5a5('0x15')]);return _0x4ff3b8(_0x4810c0[_0xf5a5('0x13')][_0xf5a5('0x15')]);}logger[_0xf5a5('0x13')](_0xf5a5('0xe'),_0x3e0823,_0x4810c0[_0xf5a5('0x13')][_0xf5a5('0x15')]);return _0x1535de(_0x4810c0['error'][_0xf5a5('0x15')]);}else{logger[_0xf5a5('0x16')](_0xf5a5('0xe'),_0x3e0823,'request\x20sent');_0x1535de(_0x4810c0[_0xf5a5('0x17')][_0xf5a5('0x15')]);}})[_0xf5a5('0x18')](function(_0x119e8f){logger['error'](_0xf5a5('0xe'),_0x3e0823,_0x119e8f);_0x4ff3b8(_0x119e8f);});});}exports['ShowSquareOdbc']=function(_0x10baab){var _0x30c133=this;return new Promise(function(_0x30bea9,_0x30fd34){return db[_0xf5a5('0x19')]['find']({'raw':_0x10baab['options']?_0x10baab[_0xf5a5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x10baab[_0xf5a5('0x1a')]?_0x10baab[_0xf5a5('0x1a')][_0xf5a5('0x1b')]||null:null,'attributes':_0x10baab[_0xf5a5('0x1a')]?_0x10baab[_0xf5a5('0x1a')]['attributes']||null:null,'include':_0x10baab['options']?_0x10baab[_0xf5a5('0x1a')][_0xf5a5('0x1c')]?_[_0xf5a5('0x1d')](_0x10baab[_0xf5a5('0x1a')][_0xf5a5('0x1c')],function(_0x5d0eae){return{'model':db[_0x5d0eae[_0xf5a5('0x1e')]],'as':_0x5d0eae['as'],'attributes':_0x5d0eae[_0xf5a5('0x1f')],'include':_0x5d0eae[_0xf5a5('0x1c')]?_['map'](_0x5d0eae['include'],function(_0xfd843d){return{'model':db[_0xfd843d['model']],'as':_0xfd843d['as'],'attributes':_0xfd843d[_0xf5a5('0x1f')],'include':_0xfd843d[_0xf5a5('0x1c')]?_[_0xf5a5('0x1d')](_0xfd843d[_0xf5a5('0x1c')],function(_0x26b6e3){return{'model':db[_0x26b6e3['model']],'as':_0x26b6e3['as'],'attributes':_0x26b6e3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1131ca){logger[_0xf5a5('0x16')](_0xf5a5('0x20'),_0x10baab);logger['debug'](_0xf5a5('0x20'),_0x10baab,JSON['stringify'](_0x1131ca));_0x30bea9(_0x1131ca);})[_0xf5a5('0x18')](function(_0x57b4c0){logger[_0xf5a5('0x13')]('ShowSquareOdbc',_0x57b4c0[_0xf5a5('0x15')],_0x10baab);_0x30fd34(_0x30c133['error'](0x1f4,_0x57b4c0['message']));});});}; \ No newline at end of file +var _0x7815=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model'];(function(_0xb3a472,_0x2ee7b0){var _0x499e32=function(_0x3a2625){while(--_0x3a2625){_0xb3a472['push'](_0xb3a472['shift']());}};_0x499e32(++_0x2ee7b0);}(_0x7815,0x96));var _0x5781=function(_0x47247f,_0x228687){_0x47247f=_0x47247f-0x0;var _0x5a551d=_0x7815[_0x47247f];return _0x5a551d;};'use strict';var _=require('lodash');var util=require(_0x5781('0x0'));var moment=require(_0x5781('0x1'));var BPromise=require(_0x5781('0x2'));var rs=require(_0x5781('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5781('0x4'))['db'];var utils=require(_0x5781('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5781('0x6'));var jayson=require(_0x5781('0x7'));var client=jayson[_0x5781('0x8')][_0x5781('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad0f2,_0x131745,_0x2ae9bc){return new BPromise(function(_0x11cbd1,_0x41ab36){return client['request'](_0x3ad0f2,_0x2ae9bc)[_0x5781('0xa')](function(_0x2557ab){logger[_0x5781('0xb')](_0x5781('0xc'),_0x131745,'request\x20sent');logger[_0x5781('0xd')](_0x5781('0xe'),_0x131745,_0x5781('0xf'),JSON[_0x5781('0x10')](_0x2557ab));if(_0x2557ab[_0x5781('0x11')]){if(_0x2557ab[_0x5781('0x11')]['code']===0x1f4){logger[_0x5781('0x11')](_0x5781('0xc'),_0x131745,_0x2557ab['error'][_0x5781('0x12')]);return _0x41ab36(_0x2557ab['error'][_0x5781('0x12')]);}logger[_0x5781('0x11')](_0x5781('0xc'),_0x131745,_0x2557ab['error']['message']);return _0x11cbd1(_0x2557ab[_0x5781('0x11')]['message']);}else{logger[_0x5781('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x131745,_0x5781('0xf'));_0x11cbd1(_0x2557ab[_0x5781('0x13')][_0x5781('0x12')]);}})[_0x5781('0x14')](function(_0x148350){logger[_0x5781('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x131745,_0x148350);_0x41ab36(_0x148350);});});}exports[_0x5781('0x15')]=function(_0x200700){var _0x3680a2=this;return new Promise(function(_0x404c4e,_0x4dba66){return db[_0x5781('0x16')][_0x5781('0x17')]({'raw':_0x200700[_0x5781('0x18')]?_0x200700['options'][_0x5781('0x19')]===undefined?!![]:![]:!![],'where':_0x200700[_0x5781('0x18')]?_0x200700['options']['where']||null:null,'attributes':_0x200700[_0x5781('0x18')]?_0x200700[_0x5781('0x18')][_0x5781('0x1a')]||null:null,'include':_0x200700[_0x5781('0x18')]?_0x200700[_0x5781('0x18')][_0x5781('0x1b')]?_[_0x5781('0x1c')](_0x200700['options'][_0x5781('0x1b')],function(_0x5d5e6){return{'model':db[_0x5d5e6[_0x5781('0x1d')]],'as':_0x5d5e6['as'],'attributes':_0x5d5e6['attributes'],'include':_0x5d5e6[_0x5781('0x1b')]?_[_0x5781('0x1c')](_0x5d5e6[_0x5781('0x1b')],function(_0x4e6857){return{'model':db[_0x4e6857[_0x5781('0x1d')]],'as':_0x4e6857['as'],'attributes':_0x4e6857[_0x5781('0x1a')],'include':_0x4e6857['include']?_[_0x5781('0x1c')](_0x4e6857['include'],function(_0x2df24e){return{'model':db[_0x2df24e[_0x5781('0x1d')]],'as':_0x2df24e['as'],'attributes':_0x2df24e[_0x5781('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x200722){logger[_0x5781('0xb')](_0x5781('0x15'),_0x200700);logger[_0x5781('0xd')](_0x5781('0x15'),_0x200700,JSON[_0x5781('0x10')](_0x200722));_0x404c4e(_0x200722);})[_0x5781('0x14')](function(_0x4fc097){logger[_0x5781('0x11')](_0x5781('0x15'),_0x4fc097['message'],_0x200700);_0x4dba66(_0x3680a2[_0x5781('0x11')](0x1f4,_0x4fc097['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index ac48831..d96d320 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 _0x0e3b=['addUsers','put','/:id','update','delete','removeUsers','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/users','getUsers','create','post'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0e3b,0x125));var _0xb0e3=function(_0x266703,_0x120c3b){_0x266703=_0x266703-0x0;var _0x37d275=_0x0e3b[_0x266703];return _0x37d275;};'use strict';var multer=require(_0xb0e3('0x0'));var util=require(_0xb0e3('0x1'));var path=require(_0xb0e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0e3('0x3'));var router=express[_0xb0e3('0x4')]();var fs_extra=require(_0xb0e3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb0e3('0x6'));var config=require(_0xb0e3('0x7'));var controller=require('./squareProject.controller');router[_0xb0e3('0x8')]('/',auth[_0xb0e3('0x9')](),controller[_0xb0e3('0xa')]);router[_0xb0e3('0x8')]('/:id',auth[_0xb0e3('0x9')](),controller['show']);router[_0xb0e3('0x8')](_0xb0e3('0xb'),auth[_0xb0e3('0x9')](),controller[_0xb0e3('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb0e3('0xd')]);router[_0xb0e3('0xe')](_0xb0e3('0xb'),auth[_0xb0e3('0x9')](),controller[_0xb0e3('0xf')]);router[_0xb0e3('0x10')](_0xb0e3('0x11'),auth[_0xb0e3('0x9')](),controller[_0xb0e3('0x12')]);router[_0xb0e3('0x13')](_0xb0e3('0x11'),auth['isAuthenticated'](),controller['destroy']);router[_0xb0e3('0x13')](_0xb0e3('0xb'),auth['isAuthenticated'](),controller[_0xb0e3('0x14')]);module[_0xb0e3('0x15')]=router; \ No newline at end of file +var _0x723c=['/:id/users','getUsers','create','post','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show'];(function(_0x5e27a9,_0x307830){var _0x23ef89=function(_0x3c4487){while(--_0x3c4487){_0x5e27a9['push'](_0x5e27a9['shift']());}};_0x23ef89(++_0x307830);}(_0x723c,0x1ad));var _0xc723=function(_0x2c8548,_0x340352){_0x2c8548=_0x2c8548-0x0;var _0x35778b=_0x723c[_0x2c8548];return _0x35778b;};'use strict';var multer=require('multer');var util=require(_0xc723('0x0'));var path=require(_0xc723('0x1'));var timeout=require('connect-timeout');var express=require(_0xc723('0x2'));var router=express['Router']();var fs_extra=require(_0xc723('0x3'));var auth=require(_0xc723('0x4'));var interaction=require(_0xc723('0x5'));var config=require(_0xc723('0x6'));var controller=require(_0xc723('0x7'));router[_0xc723('0x8')]('/',auth[_0xc723('0x9')](),controller['index']);router[_0xc723('0x8')](_0xc723('0xa'),auth['isAuthenticated'](),controller[_0xc723('0xb')]);router[_0xc723('0x8')](_0xc723('0xc'),auth[_0xc723('0x9')](),controller[_0xc723('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc723('0xe')]);router[_0xc723('0xf')](_0xc723('0xc'),auth[_0xc723('0x9')](),controller['addUsers']);router[_0xc723('0x10')](_0xc723('0xa'),auth[_0xc723('0x9')](),controller[_0xc723('0x11')]);router[_0xc723('0x12')]('/:id',auth[_0xc723('0x9')](),controller[_0xc723('0x13')]);router[_0xc723('0x12')](_0xc723('0xc'),auth[_0xc723('0x9')](),controller['removeUsers']);module[_0xc723('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index df6c91e..20c93fc 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 _0x38fc=['TEXT','BLOB','long','getDataValue','toString','production','utf8','DATE','sequelize','exports','STRING','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x38fc,0x8c));var _0xc38f=function(_0x1eb5a4,_0x332379){_0x1eb5a4=_0x1eb5a4-0x0;var _0x2e2fd3=_0x38fc[_0x1eb5a4];return _0x2e2fd3;};'use strict';var Sequelize=require(_0xc38f('0x0'));module[_0xc38f('0x1')]={'name':{'type':Sequelize[_0xc38f('0x2')],'unique':_0xc38f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc38f('0x2')]},'notes':{'type':Sequelize[_0xc38f('0x4')]},'preproduction':{'type':Sequelize[_0xc38f('0x5')](_0xc38f('0x6')),'get':function(){if(this[_0xc38f('0x7')]('preproduction')){return this[_0xc38f('0x7')]('preproduction')[_0xc38f('0x8')]('utf8');}}},'production':{'type':Sequelize[_0xc38f('0x5')](_0xc38f('0x6')),'get':function(){if(this[_0xc38f('0x7')](_0xc38f('0x9'))){return this[_0xc38f('0x7')](_0xc38f('0x9'))[_0xc38f('0x8')](_0xc38f('0xa'));}}},'savedAt':{'type':Sequelize[_0xc38f('0xb')]},'publishedAt':{'type':Sequelize[_0xc38f('0xb')]}}; \ No newline at end of file +var _0x6f44=['name','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','DATE','sequelize','exports'];(function(_0xa0aba2,_0x888489){var _0x217d79=function(_0x4d934b){while(--_0x4d934b){_0xa0aba2['push'](_0xa0aba2['shift']());}};_0x217d79(++_0x888489);}(_0x6f44,0x1ea));var _0x46f4=function(_0x4bd485,_0x241329){_0x4bd485=_0x4bd485-0x0;var _0x3868b7=_0x6f44[_0x4bd485];return _0x3868b7;};'use strict';var Sequelize=require(_0x46f4('0x0'));module[_0x46f4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x46f4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x46f4('0x3')]},'notes':{'type':Sequelize[_0x46f4('0x4')]},'preproduction':{'type':Sequelize[_0x46f4('0x5')](_0x46f4('0x6')),'get':function(){if(this[_0x46f4('0x7')](_0x46f4('0x8'))){return this[_0x46f4('0x7')](_0x46f4('0x8'))['toString'](_0x46f4('0x9'));}}},'production':{'type':Sequelize[_0x46f4('0x5')](_0x46f4('0x6')),'get':function(){if(this['getDataValue']('production')){return this[_0x46f4('0x7')](_0x46f4('0xa'))['toString'](_0x46f4('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x46f4('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ff6a20b..3c60e37 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 _0x68d8=['end','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','get','SquareProjects','UserProfileResource'];(function(_0x10eb7b,_0x66ceaf){var _0x15655c=function(_0x1672d3){while(--_0x1672d3){_0x10eb7b['push'](_0x10eb7b['shift']());}};_0x15655c(++_0x66ceaf);}(_0x68d8,0x165));var _0x868d=function(_0x383024,_0x2a23bd){_0x383024=_0x383024-0x0;var _0x4da816=_0x68d8[_0x383024];return _0x4da816;};'use strict';var emlformat=require(_0x868d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x868d('0x1'));var jsonpatch=require(_0x868d('0x2'));var rp=require(_0x868d('0x3'));var moment=require(_0x868d('0x4'));var BPromise=require(_0x868d('0x5'));var Mustache=require(_0x868d('0x6'));var util=require('util');var path=require(_0x868d('0x7'));var sox=require(_0x868d('0x8'));var csv=require(_0x868d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x868d('0xa'));var _=require(_0x868d('0xb'));var squel=require('squel');var crypto=require(_0x868d('0xc'));var jsforce=require(_0x868d('0xd'));var deskjs=require(_0x868d('0xe'));var toCsv=require(_0x868d('0x9'));var querystring=require(_0x868d('0xf'));var Papa=require('papaparse');var Redis=require(_0x868d('0x10'));var authService=require(_0x868d('0x11'));var qs=require(_0x868d('0x12'));var as=require(_0x868d('0x13'));var hardwareService=require(_0x868d('0x14'));var logger=require(_0x868d('0x15'))('api');var utils=require(_0x868d('0x16'));var config=require(_0x868d('0x17'));var licenseUtil=require(_0x868d('0x18'));var db=require('../../mysqldb')['db'];config[_0x868d('0x19')]=_[_0x868d('0x1a')](config[_0x868d('0x19')],{'host':_0x868d('0x1b'),'port':0x18eb});var socket=require(_0x868d('0x1c'))(new Redis(config[_0x868d('0x19')]));require(_0x868d('0x1d'))[_0x868d('0x1e')](socket);function respondWithStatusCode(_0x9d5763,_0x457878){_0x457878=_0x457878||0xcc;return function(_0x4091e8){if(_0x4091e8){return _0x9d5763[_0x868d('0x1f')](_0x457878);}return _0x9d5763['status'](_0x457878)['end']();};}function respondWithResult(_0x5d142a,_0x4dc489){_0x4dc489=_0x4dc489||0xc8;return function(_0x514eda){if(_0x514eda){return _0x5d142a[_0x868d('0x20')](_0x4dc489)[_0x868d('0x21')](_0x514eda);}};}function respondWithFilteredResult(_0x196368,_0x23ca2b){return function(_0x13cf00){if(_0x13cf00){var _0x3a989b=typeof _0x23ca2b[_0x868d('0x22')]==='undefined'&&typeof _0x23ca2b[_0x868d('0x23')]===_0x868d('0x24');var _0x525808=_0x13cf00[_0x868d('0x25')];var _0x28bc75=_0x3a989b?0x0:_0x23ca2b[_0x868d('0x22')];var _0x564b23=_0x3a989b?_0x13cf00[_0x868d('0x25')]:_0x23ca2b['offset']+_0x23ca2b['limit'];var _0x595c8b;if(_0x564b23>=_0x525808){_0x564b23=_0x525808;_0x595c8b=0xc8;}else{_0x595c8b=0xce;}_0x196368['status'](_0x595c8b);return _0x196368[_0x868d('0x26')](_0x868d('0x27'),_0x28bc75+'-'+_0x564b23+'/'+_0x525808)[_0x868d('0x21')](_0x13cf00);}return null;};}function patchUpdates(_0x331418){return function(_0x49de51){try{jsonpatch['apply'](_0x49de51,_0x331418,!![]);}catch(_0x1025aa){return BPromise['reject'](_0x1025aa);}return _0x49de51[_0x868d('0x28')]();};}function saveUpdates(_0x18cf10,_0x2215f2){return function(_0x2ac46a){if(_0x2ac46a){return _0x2ac46a[_0x868d('0x29')](_0x18cf10)[_0x868d('0x2a')](function(_0x1df419){return _0x1df419;});}return null;};}function removeEntity(_0x2771bc,_0xd82607){return function(_0x1c58ab){if(_0x1c58ab){return _0x1c58ab[_0x868d('0x2b')]()[_0x868d('0x2a')](function(){var _0x128a1e=_0x1c58ab[_0x868d('0x2c')]({'plain':!![]});var _0x1d06d5=_0x868d('0x2d');return db[_0x868d('0x2e')]['destroy']({'where':{'type':_0x1d06d5,'resourceId':_0x128a1e['id']}})[_0x868d('0x2a')](function(){return _0x1c58ab;});})[_0x868d('0x2a')](function(){_0x2771bc[_0x868d('0x20')](0xcc)[_0x868d('0x2f')]();});}};}function handleEntityNotFound(_0x599cdd,_0xce9f45){return function(_0x3830ec){if(!_0x3830ec){_0x599cdd[_0x868d('0x1f')](0x194);}return _0x3830ec;};}function handleError(_0xaa2b58,_0x50d397){_0x50d397=_0x50d397||0x1f4;return function(_0x2666c0){logger[_0x868d('0x30')](_0x2666c0[_0x868d('0x31')]);if(_0x2666c0['name']){delete _0x2666c0[_0x868d('0x32')];}_0xaa2b58[_0x868d('0x20')](_0x50d397)[_0x868d('0x33')](_0x2666c0);};}exports[_0x868d('0x34')]=function(_0x51331a,_0xd93c1){var _0x62618c={},_0x5b47fc={},_0x4a7422={'count':0x0,'rows':[]};var _0x47f04f=_[_0x868d('0x35')](db[_0x868d('0x36')][_0x868d('0x37')],function(_0x2466a9){return{'name':_0x2466a9[_0x868d('0x38')],'type':_0x2466a9['type'][_0x868d('0x39')]};});_0x5b47fc['model']=_[_0x868d('0x35')](_0x47f04f,_0x868d('0x32'));_0x5b47fc[_0x868d('0x3a')]=_[_0x868d('0x3b')](_0x51331a[_0x868d('0x3a')]);_0x5b47fc[_0x868d('0x3c')]=_[_0x868d('0x3d')](_0x5b47fc['model'],_0x5b47fc[_0x868d('0x3a')]);_0x62618c[_0x868d('0x3e')]=_[_0x868d('0x3d')](_0x5b47fc[_0x868d('0x3f')],qs[_0x868d('0x40')](_0x51331a['query'][_0x868d('0x40')]));_0x62618c[_0x868d('0x3e')]=_0x62618c['attributes'][_0x868d('0x41')]?_0x62618c[_0x868d('0x3e')]:_0x5b47fc[_0x868d('0x3f')];if(!_0x51331a[_0x868d('0x3a')][_0x868d('0x42')]('nolimit')){_0x62618c[_0x868d('0x23')]=qs[_0x868d('0x23')](_0x51331a['query'][_0x868d('0x23')]);_0x62618c[_0x868d('0x22')]=qs[_0x868d('0x22')](_0x51331a['query']['offset']);}_0x62618c[_0x868d('0x43')]=qs[_0x868d('0x44')](_0x51331a[_0x868d('0x3a')][_0x868d('0x44')]);_0x62618c[_0x868d('0x45')]=qs[_0x868d('0x3c')](_[_0x868d('0x46')](_0x51331a[_0x868d('0x3a')],_0x5b47fc[_0x868d('0x3c')]),_0x47f04f);if(_0x51331a['query'][_0x868d('0x47')]){_0x62618c['where']=_[_0x868d('0x48')](_0x62618c[_0x868d('0x45')],{'$or':_[_0x868d('0x35')](_0x47f04f,function(_0x4a6acc){if(_0x4a6acc[_0x868d('0x49')]!==_0x868d('0x4a')){var _0x241208={};_0x241208[_0x4a6acc[_0x868d('0x32')]]={'$like':'%'+_0x51331a[_0x868d('0x3a')][_0x868d('0x47')]+'%'};return _0x241208;}})});}_0x62618c=_[_0x868d('0x48')]({},_0x62618c,_0x51331a[_0x868d('0x4b')]);var _0x64eefa={'where':_0x62618c[_0x868d('0x45')]};return db[_0x868d('0x36')][_0x868d('0x25')](_0x64eefa)[_0x868d('0x2a')](function(_0x508217){_0x4a7422[_0x868d('0x25')]=_0x508217;if(_0x51331a['query'][_0x868d('0x4c')]){_0x62618c[_0x868d('0x4d')]=[{'all':!![]}];}return db['SquareProject'][_0x868d('0x4e')](_0x62618c);})[_0x868d('0x2a')](function(_0x5e5970){_0x4a7422[_0x868d('0x4f')]=_0x5e5970;return _0x4a7422;})[_0x868d('0x2a')](respondWithFilteredResult(_0xd93c1,_0x62618c))['catch'](handleError(_0xd93c1,null));};exports['show']=function(_0x4e7736,_0x9ba9f9){var _0x1b92be={'raw':![],'where':{'id':_0x4e7736[_0x868d('0x50')]['id']}},_0x4a8519={};_0x4a8519['model']=_[_0x868d('0x3b')](db['SquareProject'][_0x868d('0x37')]);_0x4a8519[_0x868d('0x3a')]=_['keys'](_0x4e7736[_0x868d('0x3a')]);_0x4a8519[_0x868d('0x3c')]=_[_0x868d('0x3d')](_0x4a8519[_0x868d('0x3f')],_0x4a8519[_0x868d('0x3a')]);_0x1b92be[_0x868d('0x3e')]=_[_0x868d('0x3d')](_0x4a8519[_0x868d('0x3f')],qs[_0x868d('0x40')](_0x4e7736[_0x868d('0x3a')][_0x868d('0x40')]));_0x1b92be['attributes']=_0x1b92be[_0x868d('0x3e')]['length']?_0x1b92be['attributes']:_0x4a8519[_0x868d('0x3f')];if(_0x4e7736[_0x868d('0x3a')][_0x868d('0x4c')]){_0x1b92be['include']=[{'all':!![]}];}_0x1b92be=_[_0x868d('0x48')]({},_0x1b92be,_0x4e7736['options']);return db[_0x868d('0x36')]['find'](_0x1b92be)[_0x868d('0x2a')](handleEntityNotFound(_0x9ba9f9,null))[_0x868d('0x2a')](respondWithResult(_0x9ba9f9,null))[_0x868d('0x51')](handleError(_0x9ba9f9,null));};exports[_0x868d('0x52')]=function(_0x1b4705,_0x5f0380){return db[_0x868d('0x36')][_0x868d('0x52')](_0x1b4705[_0x868d('0x53')],{})[_0x868d('0x2a')](function(_0x40f7f3){var _0x4ca6a7=_0x1b4705['user'][_0x868d('0x2c')]({'plain':!![]});if(!_0x4ca6a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ca6a7[_0x868d('0x54')]===_0x868d('0x55')){var _0x52fa9a=_0x40f7f3[_0x868d('0x2c')]({'plain':!![]});var _0x2e05c7=_0x868d('0x2d');return db[_0x868d('0x56')]['find']({'where':{'name':_0x2e05c7,'userProfileId':_0x4ca6a7[_0x868d('0x57')]},'raw':!![]})[_0x868d('0x2a')](function(_0x1b02a8){if(_0x1b02a8&&_0x1b02a8[_0x868d('0x58')]===0x0){return db[_0x868d('0x2e')][_0x868d('0x52')]({'name':_0x52fa9a[_0x868d('0x32')],'resourceId':_0x52fa9a['id'],'type':_0x1b02a8['name'],'sectionId':_0x1b02a8['id']},{})[_0x868d('0x2a')](function(){return _0x40f7f3;});}else{return _0x40f7f3;}})['catch'](function(_0x1f15c1){logger[_0x868d('0x30')](_0x868d('0x59'),_0x1f15c1);throw _0x1f15c1;});}return _0x40f7f3;})[_0x868d('0x2a')](respondWithResult(_0x5f0380,0xc9))[_0x868d('0x51')](handleError(_0x5f0380,null));};exports[_0x868d('0x29')]=function(_0x56e9bf,_0x17d4a9){if(_0x56e9bf[_0x868d('0x53')]['id']){delete _0x56e9bf['body']['id'];}return db['SquareProject'][_0x868d('0x5a')]({'where':{'id':_0x56e9bf[_0x868d('0x50')]['id']}})['then'](handleEntityNotFound(_0x17d4a9,null))[_0x868d('0x2a')](saveUpdates(_0x56e9bf[_0x868d('0x53')],null))[_0x868d('0x2a')](respondWithResult(_0x17d4a9,null))[_0x868d('0x51')](handleError(_0x17d4a9,null));};exports['destroy']=function(_0x3a34c3,_0x3220ea){return db[_0x868d('0x36')]['find']({'where':{'id':_0x3a34c3['params']['id']}})[_0x868d('0x2a')](handleEntityNotFound(_0x3220ea,null))[_0x868d('0x2a')](removeEntity(_0x3220ea,null))[_0x868d('0x51')](handleError(_0x3220ea,null));};exports['addUsers']=function(_0x3789c8,_0x421ddf,_0xe16492){return db[_0x868d('0x36')][_0x868d('0x5a')]({'where':{'id':_0x3789c8[_0x868d('0x50')]['id']}})[_0x868d('0x2a')](handleEntityNotFound(_0x421ddf,null))['then'](function(_0x12b104){if(_0x12b104){return _0x12b104[_0x868d('0x5b')](_0x3789c8[_0x868d('0x53')][_0x868d('0x5c')],_[_0x868d('0x5d')](_0x3789c8[_0x868d('0x53')],[_0x868d('0x5c'),'id'])||{});}})[_0x868d('0x2a')](respondWithResult(_0x421ddf,null))['catch'](handleError(_0x421ddf,null));};exports['removeUsers']=function(_0x3d3037,_0x3cc803,_0x3c6a9f){return db[_0x868d('0x36')][_0x868d('0x5a')]({'where':{'id':_0x3d3037['params']['id']}})[_0x868d('0x2a')](handleEntityNotFound(_0x3cc803,null))[_0x868d('0x2a')](function(_0x50c3d9){if(_0x50c3d9){return _0x50c3d9[_0x868d('0x5e')](_0x3d3037[_0x868d('0x3a')]['ids'])[_0x868d('0x2a')](function(){if(_[_0x868d('0x5f')](_0x3d3037['query'][_0x868d('0x5c')])){for(var _0x10c4e0=0x0;_0x10c4e0<_0x3d3037[_0x868d('0x3a')]['ids'][_0x868d('0x41')];_0x10c4e0+=0x1){socket['emit'](_0x868d('0x60'),{'UserId':Number(_0x3d3037[_0x868d('0x3a')][_0x868d('0x5c')][_0x10c4e0]),'SquareProjectId':Number(_0x3d3037[_0x868d('0x50')]['id'])});}}else{socket[_0x868d('0x61')](_0x868d('0x60'),{'UserId':Number(_0x3d3037['query'][_0x868d('0x5c')]),'SquareProjectId':Number(_0x3d3037['params']['id'])});}});}})[_0x868d('0x2a')](respondWithStatusCode(_0x3cc803,null))['catch'](handleError(_0x3cc803,null));};exports[_0x868d('0x62')]=function(_0x181a16,_0x596679,_0x356990){var _0x4fb3b4={};var _0x2ec3f0={};var _0x4ad00d;var _0x2e134a;return db['SquareProject'][_0x868d('0x63')]({'where':{'id':_0x181a16[_0x868d('0x50')]['id']}})['then'](handleEntityNotFound(_0x596679,null))['then'](function(_0x47999a){if(_0x47999a){_0x4ad00d=_0x47999a;_0x2ec3f0[_0x868d('0x3f')]=_[_0x868d('0x3b')](db['User']['rawAttributes']);_0x2ec3f0[_0x868d('0x3a')]=_['keys'](_0x181a16[_0x868d('0x3a')]);_0x2ec3f0[_0x868d('0x3c')]=_[_0x868d('0x3d')](_0x2ec3f0[_0x868d('0x3f')],_0x2ec3f0[_0x868d('0x3a')]);_0x4fb3b4['attributes']=_[_0x868d('0x3d')](_0x2ec3f0[_0x868d('0x3f')],qs[_0x868d('0x40')](_0x181a16[_0x868d('0x3a')][_0x868d('0x40')]));_0x4fb3b4[_0x868d('0x3e')]=_0x4fb3b4[_0x868d('0x3e')][_0x868d('0x41')]?_0x4fb3b4[_0x868d('0x3e')]:_0x2ec3f0[_0x868d('0x3f')];_0x4fb3b4[_0x868d('0x43')]=qs[_0x868d('0x44')](_0x181a16[_0x868d('0x3a')]['sort']);_0x4fb3b4['where']=qs[_0x868d('0x3c')](_['pick'](_0x181a16[_0x868d('0x3a')],_0x2ec3f0['filters']));if(_0x181a16[_0x868d('0x3a')]['filter']){_0x4fb3b4['where']=_['merge'](_0x4fb3b4['where'],{'$or':_[_0x868d('0x35')](_0x4fb3b4[_0x868d('0x3e')],function(_0x13e46f){var _0x34b983={};_0x34b983[_0x13e46f]={'$like':'%'+_0x181a16[_0x868d('0x3a')][_0x868d('0x47')]+'%'};return _0x34b983;})});}_0x4fb3b4=_[_0x868d('0x48')]({},_0x4fb3b4,_0x181a16[_0x868d('0x4b')]);return _0x4ad00d[_0x868d('0x62')](_0x4fb3b4);}})['then'](function(_0x557599){if(_0x557599){_0x2e134a=_0x557599[_0x868d('0x41')];if(!_0x181a16[_0x868d('0x3a')][_0x868d('0x42')](_0x868d('0x64'))){_0x4fb3b4[_0x868d('0x23')]=qs[_0x868d('0x23')](_0x181a16[_0x868d('0x3a')][_0x868d('0x23')]);_0x4fb3b4[_0x868d('0x22')]=qs[_0x868d('0x22')](_0x181a16[_0x868d('0x3a')][_0x868d('0x22')]);}return _0x4ad00d[_0x868d('0x62')](_0x4fb3b4);}})[_0x868d('0x2a')](function(_0x470a60){if(_0x470a60){return _0x470a60?{'count':_0x2e134a,'rows':_0x470a60}:null;}})[_0x868d('0x2a')](respondWithResult(_0x596679,null))[_0x868d('0x51')](handleError(_0x596679,null));}; \ No newline at end of file +var _0x7303=['fast-json-patch','request-promise','moment','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','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./squareProject.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','SquareProject','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addUsers','omit','removeUsers','ids','isArray','length','userSquareProject:remove','emit','getUsers','User','order','rimraf','zip-dir'];(function(_0x545755,_0x1e82df){var _0x2c75d8=function(_0x3cae8f){while(--_0x3cae8f){_0x545755['push'](_0x545755['shift']());}};_0x2c75d8(++_0x1e82df);}(_0x7303,0x17a));var _0x3730=function(_0x4ec339,_0x620322){_0x4ec339=_0x4ec339-0x0;var _0x2087cc=_0x7303[_0x4ec339];return _0x2087cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3730('0x0'));var zipdir=require(_0x3730('0x1'));var jsonpatch=require(_0x3730('0x2'));var rp=require(_0x3730('0x3'));var moment=require(_0x3730('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3730('0x5'));var util=require(_0x3730('0x6'));var path=require(_0x3730('0x7'));var sox=require(_0x3730('0x8'));var csv=require(_0x3730('0x9'));var ejs=require(_0x3730('0xa'));var fs=require('fs');var fs_extra=require(_0x3730('0xb'));var _=require(_0x3730('0xc'));var squel=require(_0x3730('0xd'));var crypto=require(_0x3730('0xe'));var jsforce=require(_0x3730('0xf'));var deskjs=require(_0x3730('0x10'));var toCsv=require(_0x3730('0x9'));var querystring=require(_0x3730('0x11'));var Papa=require('papaparse');var Redis=require(_0x3730('0x12'));var authService=require(_0x3730('0x13'));var qs=require(_0x3730('0x14'));var as=require(_0x3730('0x15'));var hardwareService=require(_0x3730('0x16'));var logger=require(_0x3730('0x17'))('api');var utils=require(_0x3730('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3730('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3730('0x1a')](config[_0x3730('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3730('0x1c'))(new Redis(config[_0x3730('0x1b')]));require(_0x3730('0x1d'))[_0x3730('0x1e')](socket);function respondWithStatusCode(_0x416933,_0x3ca7d9){_0x3ca7d9=_0x3ca7d9||0xcc;return function(_0x6e59ee){if(_0x6e59ee){return _0x416933['sendStatus'](_0x3ca7d9);}return _0x416933[_0x3730('0x1f')](_0x3ca7d9)[_0x3730('0x20')]();};}function respondWithResult(_0x4eb632,_0x102276){_0x102276=_0x102276||0xc8;return function(_0x4f3fb5){if(_0x4f3fb5){return _0x4eb632[_0x3730('0x1f')](_0x102276)[_0x3730('0x21')](_0x4f3fb5);}};}function respondWithFilteredResult(_0x2c3c9b,_0x182a3f){return function(_0x209076){if(_0x209076){var _0x44731e=typeof _0x182a3f['offset']===_0x3730('0x22')&&typeof _0x182a3f[_0x3730('0x23')]===_0x3730('0x22');var _0x52eb16=_0x209076[_0x3730('0x24')];var _0x45b016=_0x44731e?0x0:_0x182a3f[_0x3730('0x25')];var _0x6b11b9=_0x44731e?_0x209076[_0x3730('0x24')]:_0x182a3f[_0x3730('0x25')]+_0x182a3f[_0x3730('0x23')];var _0x288ce5;if(_0x6b11b9>=_0x52eb16){_0x6b11b9=_0x52eb16;_0x288ce5=0xc8;}else{_0x288ce5=0xce;}_0x2c3c9b[_0x3730('0x1f')](_0x288ce5);return _0x2c3c9b[_0x3730('0x26')](_0x3730('0x27'),_0x45b016+'-'+_0x6b11b9+'/'+_0x52eb16)[_0x3730('0x21')](_0x209076);}return null;};}function patchUpdates(_0x3f40f8){return function(_0x2a1e9b){try{jsonpatch['apply'](_0x2a1e9b,_0x3f40f8,!![]);}catch(_0x561c3c){return BPromise['reject'](_0x561c3c);}return _0x2a1e9b[_0x3730('0x28')]();};}function saveUpdates(_0x464b68,_0x37a234){return function(_0x2f6f5d){if(_0x2f6f5d){return _0x2f6f5d[_0x3730('0x29')](_0x464b68)[_0x3730('0x2a')](function(_0x35f222){return _0x35f222;});}return null;};}function removeEntity(_0x57f5db,_0x735c3e){return function(_0x3ca54d){if(_0x3ca54d){return _0x3ca54d[_0x3730('0x2b')]()[_0x3730('0x2a')](function(){var _0x2a486f=_0x3ca54d[_0x3730('0x2c')]({'plain':!![]});var _0x55f778='SquareProjects';return db[_0x3730('0x2d')]['destroy']({'where':{'type':_0x55f778,'resourceId':_0x2a486f['id']}})[_0x3730('0x2a')](function(){return _0x3ca54d;});})['then'](function(){_0x57f5db[_0x3730('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47347d,_0x2a1b8a){return function(_0x7194df){if(!_0x7194df){_0x47347d[_0x3730('0x2e')](0x194);}return _0x7194df;};}function handleError(_0x17adc5,_0x2da0bf){_0x2da0bf=_0x2da0bf||0x1f4;return function(_0x3e08f5){logger[_0x3730('0x2f')](_0x3e08f5['stack']);if(_0x3e08f5[_0x3730('0x30')]){delete _0x3e08f5[_0x3730('0x30')];}_0x17adc5[_0x3730('0x1f')](_0x2da0bf)[_0x3730('0x31')](_0x3e08f5);};}exports[_0x3730('0x32')]=function(_0x5d75f7,_0x3cff07){var _0x18fc83={},_0x43b42b={},_0x23c257={'count':0x0,'rows':[]};var _0x53f1fc=_[_0x3730('0x33')](db[_0x3730('0x34')][_0x3730('0x35')],function(_0x2f651a){return{'name':_0x2f651a['fieldName'],'type':_0x2f651a['type'][_0x3730('0x36')]};});_0x43b42b[_0x3730('0x37')]=_[_0x3730('0x33')](_0x53f1fc,_0x3730('0x30'));_0x43b42b[_0x3730('0x38')]=_[_0x3730('0x39')](_0x5d75f7[_0x3730('0x38')]);_0x43b42b[_0x3730('0x3a')]=_[_0x3730('0x3b')](_0x43b42b['model'],_0x43b42b[_0x3730('0x38')]);_0x18fc83[_0x3730('0x3c')]=_[_0x3730('0x3b')](_0x43b42b[_0x3730('0x37')],qs['fields'](_0x5d75f7[_0x3730('0x38')][_0x3730('0x3d')]));_0x18fc83[_0x3730('0x3c')]=_0x18fc83[_0x3730('0x3c')]['length']?_0x18fc83['attributes']:_0x43b42b['model'];if(!_0x5d75f7[_0x3730('0x38')][_0x3730('0x3e')](_0x3730('0x3f'))){_0x18fc83[_0x3730('0x23')]=qs[_0x3730('0x23')](_0x5d75f7[_0x3730('0x38')]['limit']);_0x18fc83[_0x3730('0x25')]=qs[_0x3730('0x25')](_0x5d75f7[_0x3730('0x38')][_0x3730('0x25')]);}_0x18fc83['order']=qs[_0x3730('0x40')](_0x5d75f7['query'][_0x3730('0x40')]);_0x18fc83[_0x3730('0x41')]=qs[_0x3730('0x3a')](_[_0x3730('0x42')](_0x5d75f7[_0x3730('0x38')],_0x43b42b[_0x3730('0x3a')]),_0x53f1fc);if(_0x5d75f7[_0x3730('0x38')][_0x3730('0x43')]){_0x18fc83[_0x3730('0x41')]=_[_0x3730('0x44')](_0x18fc83[_0x3730('0x41')],{'$or':_[_0x3730('0x33')](_0x53f1fc,function(_0x509ab1){if(_0x509ab1['type']!=='VIRTUAL'){var _0x53c944={};_0x53c944[_0x509ab1[_0x3730('0x30')]]={'$like':'%'+_0x5d75f7[_0x3730('0x38')][_0x3730('0x43')]+'%'};return _0x53c944;}})});}_0x18fc83=_[_0x3730('0x44')]({},_0x18fc83,_0x5d75f7[_0x3730('0x45')]);var _0x2750a4={'where':_0x18fc83['where']};return db[_0x3730('0x34')]['count'](_0x2750a4)[_0x3730('0x2a')](function(_0x34419a){_0x23c257['count']=_0x34419a;if(_0x5d75f7[_0x3730('0x38')][_0x3730('0x46')]){_0x18fc83[_0x3730('0x47')]=[{'all':!![]}];}return db[_0x3730('0x34')]['findAll'](_0x18fc83);})['then'](function(_0x121d10){_0x23c257['rows']=_0x121d10;return _0x23c257;})[_0x3730('0x2a')](respondWithFilteredResult(_0x3cff07,_0x18fc83))[_0x3730('0x48')](handleError(_0x3cff07,null));};exports['show']=function(_0x1a24e1,_0x56f58c){var _0x4c4b4c={'raw':![],'where':{'id':_0x1a24e1['params']['id']}},_0x5de246={};_0x5de246[_0x3730('0x37')]=_[_0x3730('0x39')](db[_0x3730('0x34')][_0x3730('0x35')]);_0x5de246[_0x3730('0x38')]=_[_0x3730('0x39')](_0x1a24e1[_0x3730('0x38')]);_0x5de246[_0x3730('0x3a')]=_[_0x3730('0x3b')](_0x5de246[_0x3730('0x37')],_0x5de246[_0x3730('0x38')]);_0x4c4b4c['attributes']=_['intersection'](_0x5de246[_0x3730('0x37')],qs[_0x3730('0x3d')](_0x1a24e1[_0x3730('0x38')][_0x3730('0x3d')]));_0x4c4b4c[_0x3730('0x3c')]=_0x4c4b4c['attributes']['length']?_0x4c4b4c[_0x3730('0x3c')]:_0x5de246[_0x3730('0x37')];if(_0x1a24e1[_0x3730('0x38')][_0x3730('0x46')]){_0x4c4b4c[_0x3730('0x47')]=[{'all':!![]}];}_0x4c4b4c=_['merge']({},_0x4c4b4c,_0x1a24e1[_0x3730('0x45')]);return db[_0x3730('0x34')]['find'](_0x4c4b4c)[_0x3730('0x2a')](handleEntityNotFound(_0x56f58c,null))[_0x3730('0x2a')](respondWithResult(_0x56f58c,null))[_0x3730('0x48')](handleError(_0x56f58c,null));};exports['create']=function(_0x1df0fa,_0x5eccf0){return db['SquareProject']['create'](_0x1df0fa[_0x3730('0x49')],{})[_0x3730('0x2a')](function(_0x3874f6){var _0x2ed03e=_0x1df0fa[_0x3730('0x4a')][_0x3730('0x2c')]({'plain':!![]});if(!_0x2ed03e)throw new Error(_0x3730('0x4b'));if(_0x2ed03e['role']==='user'){var _0x1a3ae3=_0x3874f6['get']({'plain':!![]});var _0xff03c5=_0x3730('0x4c');return db[_0x3730('0x4d')]['find']({'where':{'name':_0xff03c5,'userProfileId':_0x2ed03e[_0x3730('0x4e')]},'raw':!![]})['then'](function(_0x227fe9){if(_0x227fe9&&_0x227fe9[_0x3730('0x4f')]===0x0){return db[_0x3730('0x2d')][_0x3730('0x50')]({'name':_0x1a3ae3[_0x3730('0x30')],'resourceId':_0x1a3ae3['id'],'type':_0x227fe9[_0x3730('0x30')],'sectionId':_0x227fe9['id']},{})[_0x3730('0x2a')](function(){return _0x3874f6;});}else{return _0x3874f6;}})['catch'](function(_0x13e23c){logger[_0x3730('0x2f')](_0x3730('0x51'),_0x13e23c);throw _0x13e23c;});}return _0x3874f6;})['then'](respondWithResult(_0x5eccf0,0xc9))['catch'](handleError(_0x5eccf0,null));};exports[_0x3730('0x29')]=function(_0x4e30e8,_0x7ecf20){if(_0x4e30e8[_0x3730('0x49')]['id']){delete _0x4e30e8[_0x3730('0x49')]['id'];}return db[_0x3730('0x34')][_0x3730('0x52')]({'where':{'id':_0x4e30e8[_0x3730('0x53')]['id']}})['then'](handleEntityNotFound(_0x7ecf20,null))[_0x3730('0x2a')](saveUpdates(_0x4e30e8[_0x3730('0x49')],null))[_0x3730('0x2a')](respondWithResult(_0x7ecf20,null))[_0x3730('0x48')](handleError(_0x7ecf20,null));};exports[_0x3730('0x2b')]=function(_0x4acf34,_0x2e3d23){return db[_0x3730('0x34')][_0x3730('0x52')]({'where':{'id':_0x4acf34[_0x3730('0x53')]['id']}})[_0x3730('0x2a')](handleEntityNotFound(_0x2e3d23,null))[_0x3730('0x2a')](removeEntity(_0x2e3d23,null))[_0x3730('0x48')](handleError(_0x2e3d23,null));};exports['addUsers']=function(_0x1866d6,_0x4c1675,_0x2e0ce3){return db[_0x3730('0x34')][_0x3730('0x52')]({'where':{'id':_0x1866d6[_0x3730('0x53')]['id']}})[_0x3730('0x2a')](handleEntityNotFound(_0x4c1675,null))[_0x3730('0x2a')](function(_0x1c8d14){if(_0x1c8d14){return _0x1c8d14[_0x3730('0x54')](_0x1866d6[_0x3730('0x49')]['ids'],_[_0x3730('0x55')](_0x1866d6[_0x3730('0x49')],['ids','id'])||{});}})[_0x3730('0x2a')](respondWithResult(_0x4c1675,null))[_0x3730('0x48')](handleError(_0x4c1675,null));};exports['removeUsers']=function(_0x146481,_0x58492f,_0x57a156){return db[_0x3730('0x34')][_0x3730('0x52')]({'where':{'id':_0x146481[_0x3730('0x53')]['id']}})[_0x3730('0x2a')](handleEntityNotFound(_0x58492f,null))['then'](function(_0x500f44){if(_0x500f44){return _0x500f44[_0x3730('0x56')](_0x146481[_0x3730('0x38')][_0x3730('0x57')])[_0x3730('0x2a')](function(){if(_[_0x3730('0x58')](_0x146481[_0x3730('0x38')]['ids'])){for(var _0x556a95=0x0;_0x556a95<_0x146481['query'][_0x3730('0x57')][_0x3730('0x59')];_0x556a95+=0x1){socket['emit'](_0x3730('0x5a'),{'UserId':Number(_0x146481[_0x3730('0x38')][_0x3730('0x57')][_0x556a95]),'SquareProjectId':Number(_0x146481[_0x3730('0x53')]['id'])});}}else{socket[_0x3730('0x5b')](_0x3730('0x5a'),{'UserId':Number(_0x146481[_0x3730('0x38')][_0x3730('0x57')]),'SquareProjectId':Number(_0x146481[_0x3730('0x53')]['id'])});}});}})[_0x3730('0x2a')](respondWithStatusCode(_0x58492f,null))['catch'](handleError(_0x58492f,null));};exports[_0x3730('0x5c')]=function(_0x4992f6,_0x4cbcde,_0x92eb73){var _0x14df0b={};var _0x9050={};var _0x85bdf9;var _0x60f3f7;return db[_0x3730('0x34')]['findOne']({'where':{'id':_0x4992f6[_0x3730('0x53')]['id']}})[_0x3730('0x2a')](handleEntityNotFound(_0x4cbcde,null))[_0x3730('0x2a')](function(_0x1a82bc){if(_0x1a82bc){_0x85bdf9=_0x1a82bc;_0x9050[_0x3730('0x37')]=_[_0x3730('0x39')](db[_0x3730('0x5d')]['rawAttributes']);_0x9050[_0x3730('0x38')]=_[_0x3730('0x39')](_0x4992f6[_0x3730('0x38')]);_0x9050['filters']=_['intersection'](_0x9050[_0x3730('0x37')],_0x9050['query']);_0x14df0b[_0x3730('0x3c')]=_[_0x3730('0x3b')](_0x9050[_0x3730('0x37')],qs[_0x3730('0x3d')](_0x4992f6['query'][_0x3730('0x3d')]));_0x14df0b[_0x3730('0x3c')]=_0x14df0b['attributes'][_0x3730('0x59')]?_0x14df0b[_0x3730('0x3c')]:_0x9050['model'];_0x14df0b[_0x3730('0x5e')]=qs['sort'](_0x4992f6[_0x3730('0x38')]['sort']);_0x14df0b['where']=qs[_0x3730('0x3a')](_[_0x3730('0x42')](_0x4992f6[_0x3730('0x38')],_0x9050[_0x3730('0x3a')]));if(_0x4992f6[_0x3730('0x38')]['filter']){_0x14df0b[_0x3730('0x41')]=_[_0x3730('0x44')](_0x14df0b[_0x3730('0x41')],{'$or':_[_0x3730('0x33')](_0x14df0b[_0x3730('0x3c')],function(_0x49561e){var _0x352bae={};_0x352bae[_0x49561e]={'$like':'%'+_0x4992f6[_0x3730('0x38')][_0x3730('0x43')]+'%'};return _0x352bae;})});}_0x14df0b=_[_0x3730('0x44')]({},_0x14df0b,_0x4992f6[_0x3730('0x45')]);return _0x85bdf9[_0x3730('0x5c')](_0x14df0b);}})[_0x3730('0x2a')](function(_0x2ea837){if(_0x2ea837){_0x60f3f7=_0x2ea837[_0x3730('0x59')];if(!_0x4992f6[_0x3730('0x38')][_0x3730('0x3e')]('nolimit')){_0x14df0b[_0x3730('0x23')]=qs[_0x3730('0x23')](_0x4992f6['query']['limit']);_0x14df0b['offset']=qs[_0x3730('0x25')](_0x4992f6[_0x3730('0x38')]['offset']);}return _0x85bdf9['getUsers'](_0x14df0b);}})[_0x3730('0x2a')](function(_0x4720a2){if(_0x4720a2){return _0x4720a2?{'count':_0x60f3f7,'rows':_0x4720a2}:null;}})[_0x3730('0x2a')](respondWithResult(_0x4cbcde,null))[_0x3730('0x48')](handleError(_0x4cbcde,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 342e4ce..efa5f0c 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 _0xcaf8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x29a1bb,_0x52859d){var _0x19f85e=function(_0x1b1000){while(--_0x1b1000){_0x29a1bb['push'](_0x29a1bb['shift']());}};_0x19f85e(++_0x52859d);}(_0xcaf8,0x122));var _0x8caf=function(_0x5055d5,_0x30564c){_0x5055d5=_0x5055d5-0x0;var _0x25230e=_0xcaf8[_0x5055d5];return _0x25230e;};'use strict';var EventEmitter=require(_0x8caf('0x0'));var SquareProject=require(_0x8caf('0x1'))['db'][_0x8caf('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8caf('0x3')](0x0);var events={'afterCreate':_0x8caf('0x4'),'afterUpdate':_0x8caf('0x5'),'afterDestroy':_0x8caf('0x6')};function emitEvent(_0x2bd15e){return function(_0x30cda3,_0x2964f6,_0x526468){SquareProjectEvents[_0x8caf('0x7')](_0x2bd15e+':'+_0x30cda3['id'],_0x30cda3);SquareProjectEvents['emit'](_0x2bd15e,_0x30cda3);_0x526468(null);};}for(var e in events){if(events[_0x8caf('0x8')](e)){var event=events[e];SquareProject[_0x8caf('0x9')](e,emitEvent(event));}}module[_0x8caf('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x67ef=['emit','hasOwnProperty','hook','exports','remove'];(function(_0x59d75d,_0x5a6edc){var _0x34d703=function(_0xe6af8d){while(--_0xe6af8d){_0x59d75d['push'](_0x59d75d['shift']());}};_0x34d703(++_0x5a6edc);}(_0x67ef,0x90));var _0xf67e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x67ef[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf67e('0x0')};function emitEvent(_0x1f38f3){return function(_0x203d18,_0x2c61d2,_0x239bcf){SquareProjectEvents[_0xf67e('0x1')](_0x1f38f3+':'+_0x203d18['id'],_0x203d18);SquareProjectEvents[_0xf67e('0x1')](_0x1f38f3,_0x203d18);_0x239bcf(null);};}for(var e in events){if(events[_0xf67e('0x2')](e)){var event=events[e];SquareProject[_0xf67e('0x3')](e,emitEvent(event));}}module[_0xf67e('0x4')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 5dcffb1..678aea2 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 _0x8005=['production','publishedAt','lodash','api','moment','bluebird','path','rimraf','exports','define','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x1bf52b,_0x11be2b){var _0x2cb2b2=function(_0x489022){while(--_0x489022){_0x1bf52b['push'](_0x1bf52b['shift']());}};_0x2cb2b2(++_0x11be2b);}(_0x8005,0x112));var _0x5800=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0x8005[_0x2bda14];return _0xb5dd49;};'use strict';var _=require(_0x5800('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5800('0x1'));var moment=require(_0x5800('0x2'));var BPromise=require(_0x5800('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5800('0x4'));var rimraf=require(_0x5800('0x5'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x5800('0x6')]=function(_0x562a46,_0x2725b3){return _0x562a46[_0x5800('0x7')](_0x5800('0x8'),attributes,{'tableName':_0x5800('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d6383,_0x1fa5cc,_0x38bcaa){if(_0x3d6383['changed'](_0x5800('0xa'))){_0x3d6383[_0x5800('0xb')]=moment()[_0x5800('0xc')](_0x5800('0xd'));}if(_0x3d6383[_0x5800('0xe')](_0x5800('0xf'))){_0x3d6383[_0x5800('0x10')]=moment()[_0x5800('0xc')](_0x5800('0xd'));}_0x38bcaa(null,_0x3d6383);}}});}; \ No newline at end of file +var _0xa977=['request-promise','path','rimraf','../../config/environment','./squareProject.attributes','SquareProject','square_projects','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa977,0x8c));var _0x7a97=function(_0x252809,_0x433dd8){_0x252809=_0x252809-0x0;var _0x5aaff8=_0xa977[_0x252809];return _0x5aaff8;};'use strict';var _=require('lodash');var util=require(_0x7a97('0x0'));var logger=require(_0x7a97('0x1'))(_0x7a97('0x2'));var moment=require(_0x7a97('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a97('0x4'));var fs=require('fs');var path=require(_0x7a97('0x5'));var rimraf=require(_0x7a97('0x6'));var config=require(_0x7a97('0x7'));var attributes=require(_0x7a97('0x8'));module['exports']=function(_0x453edc,_0x5d37e7){return _0x453edc['define'](_0x7a97('0x9'),attributes,{'tableName':_0x7a97('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e4aa1,_0x3b3c86,_0x57c710){if(_0x5e4aa1[_0x7a97('0xb')](_0x7a97('0xc'))){_0x5e4aa1[_0x7a97('0xd')]=moment()[_0x7a97('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5e4aa1['changed'](_0x7a97('0xf'))){_0x5e4aa1[_0x7a97('0x10')]=moment()[_0x7a97('0xe')](_0x7a97('0x11'));}_0x57c710(null,_0x5e4aa1);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index e0ff3f4..782be8c 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 _0xed9a=['map','include','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./squareProject.socket','request','info','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSquareProject','SquareProject','find','options','attributes'];(function(_0x5e5e0d,_0x20402e){var _0x32485d=function(_0x24eb1e){while(--_0x24eb1e){_0x5e5e0d['push'](_0x5e5e0d['shift']());}};_0x32485d(++_0x20402e);}(_0xed9a,0xb4));var _0xaed9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xed9a[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xaed9('0x0'));var util=require(_0xaed9('0x1'));var moment=require(_0xaed9('0x2'));var BPromise=require(_0xaed9('0x3'));var rs=require(_0xaed9('0x4'));var fs=require('fs');var Redis=require(_0xaed9('0x5'));var db=require(_0xaed9('0x6'))['db'];var utils=require(_0xaed9('0x7'));var logger=require(_0xaed9('0x8'))('rpc');var config=require(_0xaed9('0x9'));var jayson=require(_0xaed9('0xa'));var client=jayson[_0xaed9('0xb')]['http']({'port':0x232a});config[_0xaed9('0xc')]=_[_0xaed9('0xd')](config[_0xaed9('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaed9('0xc')]));require(_0xaed9('0xe'))['register'](socket);function respondWithRpcPromise(_0x946cde,_0x49c577,_0x227569){return new BPromise(function(_0x74ba22,_0x10cdfe){return client[_0xaed9('0xf')](_0x946cde,_0x227569)['then'](function(_0x698e16){logger[_0xaed9('0x10')](_0xaed9('0x11'),_0x49c577,'request\x20sent');logger['debug'](_0xaed9('0x12'),_0x49c577,_0xaed9('0x13'),JSON[_0xaed9('0x14')](_0x698e16));if(_0x698e16['error']){if(_0x698e16[_0xaed9('0x15')]['code']===0x1f4){logger[_0xaed9('0x15')](_0xaed9('0x11'),_0x49c577,_0x698e16['error'][_0xaed9('0x16')]);return _0x10cdfe(_0x698e16[_0xaed9('0x15')]['message']);}logger['error'](_0xaed9('0x11'),_0x49c577,_0x698e16['error']['message']);return _0x74ba22(_0x698e16[_0xaed9('0x15')][_0xaed9('0x16')]);}else{logger[_0xaed9('0x10')]('SquareProject,\x20%s,\x20%s',_0x49c577,_0xaed9('0x13'));_0x74ba22(_0x698e16[_0xaed9('0x17')]['message']);}})[_0xaed9('0x18')](function(_0x13763c){logger['error'](_0xaed9('0x11'),_0x49c577,_0x13763c);_0x10cdfe(_0x13763c);});});}exports[_0xaed9('0x19')]=function(_0x26044d){var _0x39524e=this;return new Promise(function(_0x56e451,_0xa08ea8){return db[_0xaed9('0x1a')][_0xaed9('0x1b')]({'raw':_0x26044d[_0xaed9('0x1c')]?_0x26044d[_0xaed9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x26044d[_0xaed9('0x1c')]?_0x26044d[_0xaed9('0x1c')]['where']||null:null,'attributes':_0x26044d[_0xaed9('0x1c')]?_0x26044d[_0xaed9('0x1c')][_0xaed9('0x1d')]||null:null,'include':_0x26044d[_0xaed9('0x1c')]?_0x26044d['options']['include']?_[_0xaed9('0x1e')](_0x26044d[_0xaed9('0x1c')][_0xaed9('0x1f')],function(_0x29deef){return{'model':db[_0x29deef[_0xaed9('0x20')]],'as':_0x29deef['as'],'attributes':_0x29deef[_0xaed9('0x1d')],'include':_0x29deef['include']?_[_0xaed9('0x1e')](_0x29deef['include'],function(_0x3dab76){return{'model':db[_0x3dab76['model']],'as':_0x3dab76['as'],'attributes':_0x3dab76[_0xaed9('0x1d')],'include':_0x3dab76[_0xaed9('0x1f')]?_[_0xaed9('0x1e')](_0x3dab76['include'],function(_0x562406){return{'model':db[_0x562406[_0xaed9('0x20')]],'as':_0x562406['as'],'attributes':_0x562406['attributes']};}):[]};}):[]};}):[]:[]})[_0xaed9('0x21')](function(_0x5acf8b){logger['info'](_0xaed9('0x19'),_0x26044d);logger[_0xaed9('0x22')](_0xaed9('0x19'),_0x26044d,JSON[_0xaed9('0x14')](_0x5acf8b));_0x56e451(_0x5acf8b);})[_0xaed9('0x18')](function(_0x570396){logger['error'](_0xaed9('0x19'),_0x570396[_0xaed9('0x16')],_0x26044d);_0xa08ea8(_0x39524e['error'](0x1f4,_0x570396[_0xaed9('0x16')]));});});}; \ No newline at end of file +var _0x83d3=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareProject','find','raw','options','where','attributes','include','map','model','ShowSquareProject','lodash','util','moment','randomstring'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x83d3,0xf8));var _0x383d=function(_0x293fa4,_0x3ee6cc){_0x293fa4=_0x293fa4-0x0;var _0x58d190=_0x83d3[_0x293fa4];return _0x58d190;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var moment=require(_0x383d('0x2'));var BPromise=require('bluebird');var rs=require(_0x383d('0x3'));var fs=require('fs');var Redis=require(_0x383d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x383d('0x5'));var logger=require(_0x383d('0x6'))(_0x383d('0x7'));var config=require(_0x383d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x383d('0x9')][_0x383d('0xa')]({'port':0x232a});config[_0x383d('0xb')]=_[_0x383d('0xc')](config[_0x383d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x383d('0xd'))(new Redis(config[_0x383d('0xb')]));require(_0x383d('0xe'))[_0x383d('0xf')](socket);function respondWithRpcPromise(_0x58164b,_0x4f8f3a,_0x842e07){return new BPromise(function(_0x41da5b,_0x40ef35){return client['request'](_0x58164b,_0x842e07)[_0x383d('0x10')](function(_0x3e8461){logger[_0x383d('0x11')](_0x383d('0x12'),_0x4f8f3a,_0x383d('0x13'));logger[_0x383d('0x14')](_0x383d('0x15'),_0x4f8f3a,'request\x20sent',JSON[_0x383d('0x16')](_0x3e8461));if(_0x3e8461['error']){if(_0x3e8461[_0x383d('0x17')][_0x383d('0x18')]===0x1f4){logger[_0x383d('0x17')]('SquareProject,\x20%s,\x20%s',_0x4f8f3a,_0x3e8461[_0x383d('0x17')][_0x383d('0x19')]);return _0x40ef35(_0x3e8461[_0x383d('0x17')][_0x383d('0x19')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x4f8f3a,_0x3e8461['error'][_0x383d('0x19')]);return _0x41da5b(_0x3e8461[_0x383d('0x17')][_0x383d('0x19')]);}else{logger[_0x383d('0x11')]('SquareProject,\x20%s,\x20%s',_0x4f8f3a,'request\x20sent');_0x41da5b(_0x3e8461['result'][_0x383d('0x19')]);}})['catch'](function(_0x1135e9){logger[_0x383d('0x17')](_0x383d('0x12'),_0x4f8f3a,_0x1135e9);_0x40ef35(_0x1135e9);});});}exports['ShowSquareProject']=function(_0x90df12){var _0x3f8575=this;return new Promise(function(_0x368619,_0x1a737b){return db[_0x383d('0x1a')][_0x383d('0x1b')]({'raw':_0x90df12['options']?_0x90df12['options'][_0x383d('0x1c')]===undefined?!![]:![]:!![],'where':_0x90df12[_0x383d('0x1d')]?_0x90df12[_0x383d('0x1d')][_0x383d('0x1e')]||null:null,'attributes':_0x90df12[_0x383d('0x1d')]?_0x90df12[_0x383d('0x1d')][_0x383d('0x1f')]||null:null,'include':_0x90df12[_0x383d('0x1d')]?_0x90df12[_0x383d('0x1d')][_0x383d('0x20')]?_[_0x383d('0x21')](_0x90df12['options'][_0x383d('0x20')],function(_0x1fdad0){return{'model':db[_0x1fdad0[_0x383d('0x22')]],'as':_0x1fdad0['as'],'attributes':_0x1fdad0[_0x383d('0x1f')],'include':_0x1fdad0[_0x383d('0x20')]?_[_0x383d('0x21')](_0x1fdad0[_0x383d('0x20')],function(_0x57c054){return{'model':db[_0x57c054['model']],'as':_0x57c054['as'],'attributes':_0x57c054[_0x383d('0x1f')],'include':_0x57c054[_0x383d('0x20')]?_[_0x383d('0x21')](_0x57c054['include'],function(_0x2ba975){return{'model':db[_0x2ba975[_0x383d('0x22')]],'as':_0x2ba975['as'],'attributes':_0x2ba975[_0x383d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x383d('0x10')](function(_0x2874aa){logger['info'](_0x383d('0x23'),_0x90df12);logger[_0x383d('0x14')]('ShowSquareProject',_0x90df12,JSON['stringify'](_0x2874aa));_0x368619(_0x2874aa);})['catch'](function(_0x26d72e){logger[_0x383d('0x17')](_0x383d('0x23'),_0x26d72e[_0x383d('0x19')],_0x90df12);_0x1a737b(_0x3f8575['error'](0x1f4,_0x26d72e[_0x383d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fe158b9..cce475b 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 _0xf38e=['removeListener','length','save','remove','update'];(function(_0x2234fa,_0xfc8ae8){var _0xeb0629=function(_0x21d728){while(--_0x21d728){_0x2234fa['push'](_0x2234fa['shift']());}};_0xeb0629(++_0xfc8ae8);}(_0xf38e,0xed));var _0xef38=function(_0x114975,_0x2d1b2c){_0x114975=_0x114975-0x0;var _0x4cdaa5=_0xf38e[_0x114975];return _0x4cdaa5;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xef38('0x0'),_0xef38('0x1'),_0xef38('0x2')];function createListener(_0x54b8e9,_0x264e2b){return function(_0x1f92e0){_0x264e2b['emit'](_0x54b8e9,_0x1f92e0);};}function removeListener(_0x3baae8,_0x531bc4){return function(){SquareProjectEvents[_0xef38('0x3')](_0x3baae8,_0x531bc4);};}exports['register']=function(_0x14ecfc){for(var _0x3feb1e=0x0,_0x577e49=events[_0xef38('0x4')];_0x3feb1e<_0x577e49;_0x3feb1e++){var _0x1b5eb4=events[_0x3feb1e];var _0x39b615=createListener('squareProject:'+_0x1b5eb4,_0x14ecfc);SquareProjectEvents['on'](_0x1b5eb4,_0x39b615);}}; \ No newline at end of file +var _0xda62=['removeListener','length','squareProject:','remove'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xda62,0x19f));var _0x2da6=function(_0x40cc58,_0x52674e){_0x40cc58=_0x40cc58-0x0;var _0x1e259e=_0xda62[_0x40cc58];return _0x1e259e;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x2da6('0x0'),'update'];function createListener(_0xa1dcdd,_0x925cd5){return function(_0x117f74){_0x925cd5['emit'](_0xa1dcdd,_0x117f74);};}function removeListener(_0x4c202c,_0x17b51e){return function(){SquareProjectEvents[_0x2da6('0x1')](_0x4c202c,_0x17b51e);};}exports['register']=function(_0x2a422f){for(var _0x58c1e3=0x0,_0x20ee91=events[_0x2da6('0x2')];_0x58c1e3<_0x20ee91;_0x58c1e3++){var _0x3346df=events[_0x58c1e3];var _0x3f8e89=createListener(_0x2da6('0x3')+_0x3346df,_0x2a422f);SquareProjectEvents['on'](_0x3346df,_0x3f8e89);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b8a8a59..cf805b7 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x14b059,_0x122c7a){var _0x2d41bd=function(_0x189e07){while(--_0x189e07){_0x14b059['push'](_0x14b059['shift']());}};_0x2d41bd(++_0x122c7a);}(_0x5fab,0x177));var _0xb5fa=function(_0x136a01,_0x3e0f10){_0x136a01=_0x136a01-0x0;var _0x39ccee=_0x5fab[_0x136a01];return _0x39ccee;};'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['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x498068,_0x5176e4){var _0x341bc2=function(_0x3f9d0c){while(--_0x3f9d0c){_0x498068['push'](_0x498068['shift']());}};_0x341bc2(++_0x5176e4);}(_0xabce,0x103));var _0xeabc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabce[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 74c025a..0daf71f 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 _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x1818f4,_0x4464d2){var _0xb4fa7c=function(_0x5ba35e){while(--_0x5ba35e){_0x1818f4['push'](_0x1818f4['shift']());}};_0xb4fa7c(++_0x4464d2);}(_0x032e,0x124));var _0xe032=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x032e[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file +var _0xd6d6=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x3b2fe5,_0x247f17){var _0x41d30f=function(_0x1c387f){while(--_0x1c387f){_0x3b2fe5['push'](_0x3b2fe5['shift']());}};_0x41d30f(++_0x247f17);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x49f399,_0x3523dd){_0x49f399=_0x49f399-0x0;var _0x56c0e0=_0xd6d6[_0x49f399];return _0x56c0e0;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'callerid':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6d6d('0x2')]},'extension':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'dnid':{'type':Sequelize[_0x6d6d('0x2')]},'projectName':{'type':Sequelize[_0x6d6d('0x2')]},'saveName':{'type':Sequelize[_0x6d6d('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x6d6d('0x2')]},'format':{'type':Sequelize[_0x6d6d('0x3')],'get':function(){var _0x44f83d='';var _0x18f824=this[_0x6d6d('0x4')](_0x6d6d('0x5'));if(_0x18f824){_0x44f83d=_0x18f824[_0x6d6d('0x6')](_0x18f824['lastIndexOf']('.'));}return _0x44f83d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 27f8e4b..0c2242b 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 _0xe9ce=['fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','catch','show','params','keys','length','includeAll','find','create','body','download','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','SquareRecording','rawAttributes','type','model','map','query','intersection','attributes'];(function(_0x3a14e1,_0x423ef6){var _0x85f749=function(_0x11b1fa){while(--_0x11b1fa){_0x3a14e1['push'](_0x3a14e1['shift']());}};_0x85f749(++_0x423ef6);}(_0xe9ce,0x1b9));var _0xee9c=function(_0x1d0fa6,_0x1a81d9){_0x1d0fa6=_0x1d0fa6-0x0;var _0x73b952=_0xe9ce[_0x1d0fa6];return _0x73b952;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee9c('0x0'));var zipdir=require(_0xee9c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee9c('0x2'));var moment=require('moment');var BPromise=require(_0xee9c('0x3'));var Mustache=require('mustache');var util=require(_0xee9c('0x4'));var path=require(_0xee9c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee9c('0x6'));var fs=require('fs');var fs_extra=require(_0xee9c('0x7'));var _=require(_0xee9c('0x8'));var squel=require(_0xee9c('0x9'));var crypto=require(_0xee9c('0xa'));var jsforce=require(_0xee9c('0xb'));var deskjs=require(_0xee9c('0xc'));var toCsv=require(_0xee9c('0xd'));var querystring=require(_0xee9c('0xe'));var Papa=require(_0xee9c('0xf'));var Redis=require(_0xee9c('0x10'));var authService=require(_0xee9c('0x11'));var qs=require(_0xee9c('0x12'));var as=require(_0xee9c('0x13'));var hardwareService=require(_0xee9c('0x14'));var logger=require(_0xee9c('0x15'))(_0xee9c('0x16'));var utils=require(_0xee9c('0x17'));var config=require(_0xee9c('0x18'));var licenseUtil=require(_0xee9c('0x19'));var db=require(_0xee9c('0x1a'))['db'];function respondWithStatusCode(_0x49cd85,_0x48a53e){_0x48a53e=_0x48a53e||0xcc;return function(_0x19252b){if(_0x19252b){return _0x49cd85['sendStatus'](_0x48a53e);}return _0x49cd85[_0xee9c('0x1b')](_0x48a53e)['end']();};}function respondWithResult(_0x4c5278,_0x2f0322){_0x2f0322=_0x2f0322||0xc8;return function(_0x1eb5f2){if(_0x1eb5f2){return _0x4c5278[_0xee9c('0x1b')](_0x2f0322)[_0xee9c('0x1c')](_0x1eb5f2);}};}function respondWithFilteredResult(_0x4d38a3,_0x34a572){return function(_0x21072f){if(_0x21072f){var _0x13658c=typeof _0x34a572[_0xee9c('0x1d')]===_0xee9c('0x1e')&&typeof _0x34a572[_0xee9c('0x1f')]===_0xee9c('0x1e');var _0x1f1566=_0x21072f[_0xee9c('0x20')];var _0xe3a8a3=_0x13658c?0x0:_0x34a572[_0xee9c('0x1d')];var _0x4ac0e3=_0x13658c?_0x21072f['count']:_0x34a572[_0xee9c('0x1d')]+_0x34a572[_0xee9c('0x1f')];var _0x146335;if(_0x4ac0e3>=_0x1f1566){_0x4ac0e3=_0x1f1566;_0x146335=0xc8;}else{_0x146335=0xce;}_0x4d38a3[_0xee9c('0x1b')](_0x146335);return _0x4d38a3['set'](_0xee9c('0x21'),_0xe3a8a3+'-'+_0x4ac0e3+'/'+_0x1f1566)[_0xee9c('0x1c')](_0x21072f);}return null;};}function patchUpdates(_0x2060f5){return function(_0xa34083){try{jsonpatch[_0xee9c('0x22')](_0xa34083,_0x2060f5,!![]);}catch(_0xcbcfa3){return BPromise[_0xee9c('0x23')](_0xcbcfa3);}return _0xa34083[_0xee9c('0x24')]();};}function saveUpdates(_0x509441,_0x1cfdd2){return function(_0x406cff){if(_0x406cff){return _0x406cff[_0xee9c('0x25')](_0x509441)[_0xee9c('0x26')](function(_0x3f64ef){return _0x3f64ef;});}return null;};}function removeEntity(_0x5a0e20,_0x4ad4fd){return function(_0x5e1eeb){if(_0x5e1eeb){return _0x5e1eeb[_0xee9c('0x27')]()[_0xee9c('0x26')](function(){_0x5a0e20[_0xee9c('0x1b')](0xcc)[_0xee9c('0x28')]();});}};}function handleEntityNotFound(_0x49d968,_0x417559){return function(_0x54c632){if(!_0x54c632){_0x49d968[_0xee9c('0x29')](0x194);}return _0x54c632;};}function handleError(_0x38813c,_0x3ed09a){_0x3ed09a=_0x3ed09a||0x1f4;return function(_0x10b097){logger[_0xee9c('0x2a')](_0x10b097['stack']);if(_0x10b097[_0xee9c('0x2b')]){delete _0x10b097[_0xee9c('0x2b')];}_0x38813c['status'](_0x3ed09a)[_0xee9c('0x2c')](_0x10b097);};}exports[_0xee9c('0x2d')]=function(_0x321b4d,_0x4e6579){var _0x2c9df1={},_0x22604b={},_0x5d9148={'count':0x0,'rows':[]};var _0x18ea91=_['map'](db[_0xee9c('0x2e')][_0xee9c('0x2f')],function(_0x42fb58){return{'name':_0x42fb58['fieldName'],'type':_0x42fb58[_0xee9c('0x30')]['key']};});_0x22604b[_0xee9c('0x31')]=_[_0xee9c('0x32')](_0x18ea91,_0xee9c('0x2b'));_0x22604b['query']=_['keys'](_0x321b4d[_0xee9c('0x33')]);_0x22604b['filters']=_[_0xee9c('0x34')](_0x22604b['model'],_0x22604b[_0xee9c('0x33')]);_0x2c9df1[_0xee9c('0x35')]=_[_0xee9c('0x34')](_0x22604b[_0xee9c('0x31')],qs[_0xee9c('0x36')](_0x321b4d[_0xee9c('0x33')][_0xee9c('0x36')]));_0x2c9df1[_0xee9c('0x35')]=_0x2c9df1[_0xee9c('0x35')]['length']?_0x2c9df1[_0xee9c('0x35')]:_0x22604b[_0xee9c('0x31')];if(!_0x321b4d[_0xee9c('0x33')][_0xee9c('0x37')](_0xee9c('0x38'))){_0x2c9df1[_0xee9c('0x1f')]=qs[_0xee9c('0x1f')](_0x321b4d[_0xee9c('0x33')]['limit']);_0x2c9df1[_0xee9c('0x1d')]=qs[_0xee9c('0x1d')](_0x321b4d['query']['offset']);}_0x2c9df1[_0xee9c('0x39')]=qs[_0xee9c('0x3a')](_0x321b4d[_0xee9c('0x33')][_0xee9c('0x3a')]);_0x2c9df1[_0xee9c('0x3b')]=qs[_0xee9c('0x3c')](_[_0xee9c('0x3d')](_0x321b4d[_0xee9c('0x33')],_0x22604b[_0xee9c('0x3c')]),_0x18ea91);if(_0x321b4d[_0xee9c('0x33')][_0xee9c('0x3e')]){_0x2c9df1[_0xee9c('0x3b')]=_[_0xee9c('0x3f')](_0x2c9df1['where'],{'$or':_[_0xee9c('0x32')](_0x18ea91,function(_0x4dc612){if(_0x4dc612[_0xee9c('0x30')]!==_0xee9c('0x40')){var _0x55e043={};_0x55e043[_0x4dc612[_0xee9c('0x2b')]]={'$like':'%'+_0x321b4d[_0xee9c('0x33')][_0xee9c('0x3e')]+'%'};return _0x55e043;}})});}_0x2c9df1=_[_0xee9c('0x3f')]({},_0x2c9df1,_0x321b4d['options']);var _0x49c652={'where':_0x2c9df1[_0xee9c('0x3b')]};return db['SquareRecording']['count'](_0x49c652)[_0xee9c('0x26')](function(_0xffa56b){_0x5d9148['count']=_0xffa56b;if(_0x321b4d[_0xee9c('0x33')]['includeAll']){_0x2c9df1[_0xee9c('0x41')]=[{'all':!![]}];}return db[_0xee9c('0x2e')]['findAll'](_0x2c9df1);})[_0xee9c('0x26')](function(_0x53dac5){_0x5d9148['rows']=_0x53dac5;return _0x5d9148;})[_0xee9c('0x26')](respondWithFilteredResult(_0x4e6579,_0x2c9df1))[_0xee9c('0x42')](handleError(_0x4e6579,null));};exports[_0xee9c('0x43')]=function(_0x5bc926,_0x57e147){var _0x7d01f8={'raw':!![],'where':{'id':_0x5bc926[_0xee9c('0x44')]['id']}},_0x1f28d4={};_0x1f28d4['model']=_[_0xee9c('0x45')](db[_0xee9c('0x2e')][_0xee9c('0x2f')]);_0x1f28d4[_0xee9c('0x33')]=_[_0xee9c('0x45')](_0x5bc926[_0xee9c('0x33')]);_0x1f28d4[_0xee9c('0x3c')]=_[_0xee9c('0x34')](_0x1f28d4[_0xee9c('0x31')],_0x1f28d4[_0xee9c('0x33')]);_0x7d01f8[_0xee9c('0x35')]=_[_0xee9c('0x34')](_0x1f28d4[_0xee9c('0x31')],qs[_0xee9c('0x36')](_0x5bc926[_0xee9c('0x33')][_0xee9c('0x36')]));_0x7d01f8[_0xee9c('0x35')]=_0x7d01f8[_0xee9c('0x35')][_0xee9c('0x46')]?_0x7d01f8[_0xee9c('0x35')]:_0x1f28d4[_0xee9c('0x31')];if(_0x5bc926[_0xee9c('0x33')][_0xee9c('0x47')]){_0x7d01f8[_0xee9c('0x41')]=[{'all':!![]}];}_0x7d01f8=_[_0xee9c('0x3f')]({},_0x7d01f8,_0x5bc926['options']);return db['SquareRecording'][_0xee9c('0x48')](_0x7d01f8)[_0xee9c('0x26')](handleEntityNotFound(_0x57e147,null))[_0xee9c('0x26')](respondWithResult(_0x57e147,null))[_0xee9c('0x42')](handleError(_0x57e147,null));};exports['create']=function(_0x49dc98,_0x1c0aae){return db[_0xee9c('0x2e')][_0xee9c('0x49')](_0x49dc98['body'],{})[_0xee9c('0x26')](respondWithResult(_0x1c0aae,0xc9))[_0xee9c('0x42')](handleError(_0x1c0aae,null));};exports['update']=function(_0x445c92,_0x381adc){if(_0x445c92[_0xee9c('0x4a')]['id']){delete _0x445c92[_0xee9c('0x4a')]['id'];}return db[_0xee9c('0x2e')][_0xee9c('0x48')]({'where':{'id':_0x445c92[_0xee9c('0x44')]['id']}})['then'](handleEntityNotFound(_0x381adc,null))[_0xee9c('0x26')](saveUpdates(_0x445c92[_0xee9c('0x4a')],null))[_0xee9c('0x26')](respondWithResult(_0x381adc,null))[_0xee9c('0x42')](handleError(_0x381adc,null));};exports[_0xee9c('0x4b')]=function(_0x517cef,_0x12925d,_0x190e16){var _0x33ed01=require('../../components/encryptor');var _0x4cdfd1=![];var _0xa3b375={};if(_0x517cef[_0xee9c('0x33')][_0xee9c('0x30')]&&_0x517cef[_0xee9c('0x33')]['type']==='uniqueid'){_0xa3b375['uniqueid']=_0x517cef[_0xee9c('0x44')]['id'];}else{_0xa3b375['id']=_0x517cef['params']['id'];}return db[_0xee9c('0x2e')]['find']({'where':_0xa3b375,'attributes':['id',_0xee9c('0x4c'),_0xee9c('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x12925d,null))[_0xee9c('0x26')](function(_0x30e63c){if(_0x30e63c){var _0x4bdcb2=_0x30e63c[_0xee9c('0x4c')];var _0x463a0d=util[_0xee9c('0x4e')](_0xee9c('0x4f'),_0x4bdcb2);if(fs['existsSync'](_0x463a0d)){_0x4cdfd1=!![];return _0x33ed01[_0xee9c('0x50')](_0x463a0d,_0x4bdcb2,config[_0xee9c('0x51')][_0xee9c('0x52')])[_0xee9c('0x26')](function(){return _0x30e63c;});}return _0x30e63c;}})['then'](function(_0x473d2b){if(_0x473d2b){var _0x54cfeb=_0x473d2b[_0xee9c('0x4c')];if(!fs[_0xee9c('0x53')](_0x54cfeb)){throw new db[(_0xee9c('0x54'))][(_0xee9c('0x55'))]('SquareRecording\x20not\x20found');}if(_0x473d2b['filename']){return _0x12925d['download'](_0x54cfeb,_0x473d2b['filename']+path[_0xee9c('0x56')](_0x54cfeb),function(){if(_0x4cdfd1){fs[_0xee9c('0x57')](_0x54cfeb);}});}else{return _0x12925d[_0xee9c('0x4b')](_0x54cfeb,function(_0x142595){if(_0x4cdfd1){fs[_0xee9c('0x57')](_0x54cfeb);}});}}})[_0xee9c('0x42')](function(_0x3176e6){if(_0x3176e6[_0xee9c('0x58')]===_0xee9c('0x59')){_0x12925d['status'](0x194)[_0xee9c('0x2c')](_0xee9c('0x5a'));}else{return handleError(_0x12925d,null);}});};exports[_0xee9c('0x27')]=function(_0x43d5e4,_0x30f25b){return db[_0xee9c('0x2e')][_0xee9c('0x48')]({'where':{'id':_0x43d5e4[_0xee9c('0x44')]['id']}})[_0xee9c('0x26')](function(_0x4d024d){if(_[_0xee9c('0x5b')](_0x4d024d)){throw new ReferenceError(_0xee9c('0x5c'));}return _0x4d024d;})[_0xee9c('0x26')](function(_0x2d2231){var _0x483bfb=_0x2d2231[_0xee9c('0x4c')];logger[_0xee9c('0x5d')](_0xee9c('0x5e'),_0x483bfb);if(!_[_0xee9c('0x5b')](_0x2d2231[_0xee9c('0x4c')])&&fs[_0xee9c('0x53')](_0x483bfb)){logger[_0xee9c('0x5d')]('File:\x20\x22'+_0x483bfb+_0xee9c('0x5f'));fs[_0xee9c('0x60')](_0x483bfb);}_0x483bfb=_0x483bfb+_0xee9c('0x61');if(!_[_0xee9c('0x5b')](_0x2d2231[_0xee9c('0x4c')])&&fs[_0xee9c('0x53')](_0x483bfb)){logger[_0xee9c('0x5d')](_0xee9c('0x62')+_0x483bfb+_0xee9c('0x5f'));fs[_0xee9c('0x60')](_0x483bfb);}return _0x2d2231;})['then'](function(_0x5a9640){if(!_0x5a9640)throw new InternalError();return _0x5a9640['destroy']();})[_0xee9c('0x26')](function(){_0x30f25b[_0xee9c('0x1b')](0xcc)['end']();})[_0xee9c('0x42')](handleError(_0x30f25b,null));}; \ No newline at end of file +var _0x7924=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','send','map','fieldName','type','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SquareRecording','catch','params','create','update','body','find','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','secrets','existsSync','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7924,0xa5));var _0x4792=function(_0x1282a0,_0x58b2f9){_0x1282a0=_0x1282a0-0x0;var _0x18af0c=_0x7924[_0x1282a0];return _0x18af0c;};'use strict';var emlformat=require(_0x4792('0x0'));var rimraf=require(_0x4792('0x1'));var zipdir=require(_0x4792('0x2'));var jsonpatch=require(_0x4792('0x3'));var rp=require(_0x4792('0x4'));var moment=require(_0x4792('0x5'));var BPromise=require(_0x4792('0x6'));var Mustache=require('mustache');var util=require(_0x4792('0x7'));var path=require(_0x4792('0x8'));var sox=require('sox');var csv=require(_0x4792('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4792('0xa'));var _=require(_0x4792('0xb'));var squel=require(_0x4792('0xc'));var crypto=require(_0x4792('0xd'));var jsforce=require(_0x4792('0xe'));var deskjs=require(_0x4792('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4792('0x10'));var Papa=require(_0x4792('0x11'));var Redis=require(_0x4792('0x12'));var authService=require(_0x4792('0x13'));var qs=require(_0x4792('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4792('0x15'));var logger=require(_0x4792('0x16'))('api');var utils=require(_0x4792('0x17'));var config=require(_0x4792('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4792('0x19'))['db'];function respondWithStatusCode(_0x3a6c3b,_0x5cf385){_0x5cf385=_0x5cf385||0xcc;return function(_0x72b187){if(_0x72b187){return _0x3a6c3b[_0x4792('0x1a')](_0x5cf385);}return _0x3a6c3b[_0x4792('0x1b')](_0x5cf385)[_0x4792('0x1c')]();};}function respondWithResult(_0x39d14b,_0x56770a){_0x56770a=_0x56770a||0xc8;return function(_0x115863){if(_0x115863){return _0x39d14b[_0x4792('0x1b')](_0x56770a)[_0x4792('0x1d')](_0x115863);}};}function respondWithFilteredResult(_0x24445b,_0x929af8){return function(_0x464a3c){if(_0x464a3c){var _0x569d08=typeof _0x929af8[_0x4792('0x1e')]===_0x4792('0x1f')&&typeof _0x929af8['limit']==='undefined';var _0x40d5ab=_0x464a3c[_0x4792('0x20')];var _0x9cebb4=_0x569d08?0x0:_0x929af8[_0x4792('0x1e')];var _0x5a8ef3=_0x569d08?_0x464a3c[_0x4792('0x20')]:_0x929af8[_0x4792('0x1e')]+_0x929af8['limit'];var _0x3f098a;if(_0x5a8ef3>=_0x40d5ab){_0x5a8ef3=_0x40d5ab;_0x3f098a=0xc8;}else{_0x3f098a=0xce;}_0x24445b[_0x4792('0x1b')](_0x3f098a);return _0x24445b[_0x4792('0x21')](_0x4792('0x22'),_0x9cebb4+'-'+_0x5a8ef3+'/'+_0x40d5ab)[_0x4792('0x1d')](_0x464a3c);}return null;};}function patchUpdates(_0x56f268){return function(_0x27b957){try{jsonpatch[_0x4792('0x23')](_0x27b957,_0x56f268,!![]);}catch(_0x3e05b9){return BPromise[_0x4792('0x24')](_0x3e05b9);}return _0x27b957[_0x4792('0x25')]();};}function saveUpdates(_0x138e44,_0x46a438){return function(_0x2c82cf){if(_0x2c82cf){return _0x2c82cf['update'](_0x138e44)[_0x4792('0x26')](function(_0x1c1fa3){return _0x1c1fa3;});}return null;};}function removeEntity(_0x12ee95,_0x4e3b40){return function(_0x308e1c){if(_0x308e1c){return _0x308e1c[_0x4792('0x27')]()[_0x4792('0x26')](function(){_0x12ee95[_0x4792('0x1b')](0xcc)[_0x4792('0x1c')]();});}};}function handleEntityNotFound(_0x5114be,_0x524fd6){return function(_0x4f2675){if(!_0x4f2675){_0x5114be[_0x4792('0x1a')](0x194);}return _0x4f2675;};}function handleError(_0x141ad9,_0x49f404){_0x49f404=_0x49f404||0x1f4;return function(_0x4d984d){logger['error'](_0x4d984d['stack']);if(_0x4d984d['name']){delete _0x4d984d['name'];}_0x141ad9['status'](_0x49f404)[_0x4792('0x28')](_0x4d984d);};}exports['index']=function(_0x32d4a0,_0x41a25c){var _0x30fe86={},_0x221d6a={},_0x86ce32={'count':0x0,'rows':[]};var _0x2a3cc0=_[_0x4792('0x29')](db['SquareRecording']['rawAttributes'],function(_0x304216){return{'name':_0x304216[_0x4792('0x2a')],'type':_0x304216[_0x4792('0x2b')]['key']};});_0x221d6a[_0x4792('0x2c')]=_[_0x4792('0x29')](_0x2a3cc0,'name');_0x221d6a[_0x4792('0x2d')]=_[_0x4792('0x2e')](_0x32d4a0[_0x4792('0x2d')]);_0x221d6a['filters']=_[_0x4792('0x2f')](_0x221d6a['model'],_0x221d6a['query']);_0x30fe86['attributes']=_[_0x4792('0x2f')](_0x221d6a[_0x4792('0x2c')],qs[_0x4792('0x30')](_0x32d4a0[_0x4792('0x2d')][_0x4792('0x30')]));_0x30fe86['attributes']=_0x30fe86['attributes'][_0x4792('0x31')]?_0x30fe86[_0x4792('0x32')]:_0x221d6a[_0x4792('0x2c')];if(!_0x32d4a0['query'][_0x4792('0x33')]('nolimit')){_0x30fe86[_0x4792('0x34')]=qs[_0x4792('0x34')](_0x32d4a0[_0x4792('0x2d')][_0x4792('0x34')]);_0x30fe86[_0x4792('0x1e')]=qs[_0x4792('0x1e')](_0x32d4a0['query'][_0x4792('0x1e')]);}_0x30fe86[_0x4792('0x35')]=qs['sort'](_0x32d4a0[_0x4792('0x2d')][_0x4792('0x36')]);_0x30fe86[_0x4792('0x37')]=qs['filters'](_[_0x4792('0x38')](_0x32d4a0[_0x4792('0x2d')],_0x221d6a['filters']),_0x2a3cc0);if(_0x32d4a0[_0x4792('0x2d')][_0x4792('0x39')]){_0x30fe86[_0x4792('0x37')]=_[_0x4792('0x3a')](_0x30fe86[_0x4792('0x37')],{'$or':_[_0x4792('0x29')](_0x2a3cc0,function(_0x564557){if(_0x564557['type']!==_0x4792('0x3b')){var _0x4e674f={};_0x4e674f[_0x564557['name']]={'$like':'%'+_0x32d4a0['query'][_0x4792('0x39')]+'%'};return _0x4e674f;}})});}_0x30fe86=_[_0x4792('0x3a')]({},_0x30fe86,_0x32d4a0[_0x4792('0x3c')]);var _0x2145c2={'where':_0x30fe86[_0x4792('0x37')]};return db['SquareRecording'][_0x4792('0x20')](_0x2145c2)['then'](function(_0x327283){_0x86ce32[_0x4792('0x20')]=_0x327283;if(_0x32d4a0[_0x4792('0x2d')][_0x4792('0x3d')]){_0x30fe86[_0x4792('0x3e')]=[{'all':!![]}];}return db[_0x4792('0x3f')]['findAll'](_0x30fe86);})[_0x4792('0x26')](function(_0x49cbb7){_0x86ce32['rows']=_0x49cbb7;return _0x86ce32;})['then'](respondWithFilteredResult(_0x41a25c,_0x30fe86))[_0x4792('0x40')](handleError(_0x41a25c,null));};exports['show']=function(_0x1db96c,_0x1252da){var _0x3a7f48={'raw':!![],'where':{'id':_0x1db96c[_0x4792('0x41')]['id']}},_0x3e33de={};_0x3e33de[_0x4792('0x2c')]=_[_0x4792('0x2e')](db[_0x4792('0x3f')]['rawAttributes']);_0x3e33de[_0x4792('0x2d')]=_['keys'](_0x1db96c['query']);_0x3e33de['filters']=_['intersection'](_0x3e33de[_0x4792('0x2c')],_0x3e33de[_0x4792('0x2d')]);_0x3a7f48[_0x4792('0x32')]=_[_0x4792('0x2f')](_0x3e33de[_0x4792('0x2c')],qs[_0x4792('0x30')](_0x1db96c[_0x4792('0x2d')][_0x4792('0x30')]));_0x3a7f48[_0x4792('0x32')]=_0x3a7f48[_0x4792('0x32')]['length']?_0x3a7f48['attributes']:_0x3e33de[_0x4792('0x2c')];if(_0x1db96c[_0x4792('0x2d')]['includeAll']){_0x3a7f48['include']=[{'all':!![]}];}_0x3a7f48=_[_0x4792('0x3a')]({},_0x3a7f48,_0x1db96c[_0x4792('0x3c')]);return db[_0x4792('0x3f')]['find'](_0x3a7f48)[_0x4792('0x26')](handleEntityNotFound(_0x1252da,null))['then'](respondWithResult(_0x1252da,null))[_0x4792('0x40')](handleError(_0x1252da,null));};exports[_0x4792('0x42')]=function(_0x49304e,_0x3d6aa4){return db['SquareRecording'][_0x4792('0x42')](_0x49304e['body'],{})[_0x4792('0x26')](respondWithResult(_0x3d6aa4,0xc9))[_0x4792('0x40')](handleError(_0x3d6aa4,null));};exports[_0x4792('0x43')]=function(_0x7a678,_0x35e2e0){if(_0x7a678[_0x4792('0x44')]['id']){delete _0x7a678[_0x4792('0x44')]['id'];}return db[_0x4792('0x3f')][_0x4792('0x45')]({'where':{'id':_0x7a678['params']['id']}})[_0x4792('0x26')](handleEntityNotFound(_0x35e2e0,null))[_0x4792('0x26')](saveUpdates(_0x7a678[_0x4792('0x44')],null))[_0x4792('0x26')](respondWithResult(_0x35e2e0,null))[_0x4792('0x40')](handleError(_0x35e2e0,null));};exports[_0x4792('0x46')]=function(_0x5029b2,_0x5c0432,_0x31bcab){var _0x2d51b2=require(_0x4792('0x47'));var _0x204f97=![];var _0x501be4={};if(_0x5029b2[_0x4792('0x2d')][_0x4792('0x2b')]&&_0x5029b2[_0x4792('0x2d')][_0x4792('0x2b')]===_0x4792('0x48')){_0x501be4[_0x4792('0x48')]=_0x5029b2[_0x4792('0x41')]['id'];}else{_0x501be4['id']=_0x5029b2[_0x4792('0x41')]['id'];}return db[_0x4792('0x3f')][_0x4792('0x45')]({'where':_0x501be4,'attributes':['id','savePath',_0x4792('0x49')],'raw':!![]})[_0x4792('0x26')](handleEntityNotFound(_0x5c0432,null))[_0x4792('0x26')](function(_0x400a7f){if(_0x400a7f){var _0x31c9b6=_0x400a7f[_0x4792('0x4a')];var _0x44328f=util['format'](_0x4792('0x4b'),_0x31c9b6);if(fs['existsSync'](_0x44328f)){_0x204f97=!![];return _0x2d51b2['decryptFile'](_0x44328f,_0x31c9b6,config[_0x4792('0x4c')]['recording'])[_0x4792('0x26')](function(){return _0x400a7f;});}return _0x400a7f;}})['then'](function(_0x39c5d9){if(_0x39c5d9){var _0x42fa34=_0x39c5d9[_0x4792('0x4a')];if(!fs[_0x4792('0x4d')](_0x42fa34)){throw new db['Sequelize'][(_0x4792('0x4e'))]('SquareRecording\x20not\x20found');}if(_0x39c5d9['filename']){return _0x5c0432[_0x4792('0x46')](_0x42fa34,_0x39c5d9['filename']+path[_0x4792('0x4f')](_0x42fa34),function(){if(_0x204f97){fs[_0x4792('0x50')](_0x42fa34);}});}else{return _0x5c0432['download'](_0x42fa34,function(_0x2970f8){if(_0x204f97){fs[_0x4792('0x50')](_0x42fa34);}});}}})['catch'](function(_0x5a8093){if(_0x5a8093[_0x4792('0x51')]===_0x4792('0x52')){_0x5c0432[_0x4792('0x1b')](0x194)[_0x4792('0x28')](_0x4792('0x53'));}else{return handleError(_0x5c0432,null);}});};exports[_0x4792('0x27')]=function(_0x4730f8,_0x51632d){return db[_0x4792('0x3f')]['find']({'where':{'id':_0x4730f8[_0x4792('0x41')]['id']}})[_0x4792('0x26')](function(_0x3df9dd){if(_[_0x4792('0x54')](_0x3df9dd)){throw new ReferenceError(_0x4792('0x55'));}return _0x3df9dd;})[_0x4792('0x26')](function(_0x263669){var _0x43b53e=_0x263669[_0x4792('0x4a')];logger[_0x4792('0x56')](_0x4792('0x57'),_0x43b53e);if(!_[_0x4792('0x54')](_0x263669[_0x4792('0x4a')])&&fs[_0x4792('0x4d')](_0x43b53e)){logger['info'](_0x4792('0x58')+_0x43b53e+_0x4792('0x59'));fs[_0x4792('0x5a')](_0x43b53e);}_0x43b53e=_0x43b53e+_0x4792('0x5b');if(!_[_0x4792('0x54')](_0x263669['savePath'])&&fs[_0x4792('0x4d')](_0x43b53e)){logger['info'](_0x4792('0x58')+_0x43b53e+_0x4792('0x59'));fs[_0x4792('0x5a')](_0x43b53e);}return _0x263669;})[_0x4792('0x26')](function(_0x2c8b39){if(!_0x2c8b39)throw new InternalError();return _0x2c8b39[_0x4792('0x27')]();})[_0x4792('0x26')](function(){_0x51632d[_0x4792('0x1b')](0xcc)['end']();})['catch'](handleError(_0x51632d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 04faa5f..87f44b5 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 _0x3f35=['SquareRecording','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareRecording.attributes','define'];(function(_0x4df822,_0x24e3de){var _0x213d53=function(_0x464065){while(--_0x464065){_0x4df822['push'](_0x4df822['shift']());}};_0x213d53(++_0x24e3de);}(_0x3f35,0x1ae));var _0x53f3=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x3f35[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var logger=require(_0x53f3('0x2'))(_0x53f3('0x3'));var moment=require(_0x53f3('0x4'));var BPromise=require(_0x53f3('0x5'));var rp=require(_0x53f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53f3('0x7'));var config=require('../../config/environment');var attributes=require(_0x53f3('0x8'));module['exports']=function(_0x1b84bf,_0x325130){return _0x1b84bf[_0x53f3('0x9')](_0x53f3('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1751=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1028d3,_0x9065dd){var _0x30f44a=function(_0x45e302){while(--_0x45e302){_0x1028d3['push'](_0x1028d3['shift']());}};_0x30f44a(++_0x9065dd);}(_0x1751,0x76));var _0x1175=function(_0x8da511,_0x58b70a){_0x8da511=_0x8da511-0x0;var _0x140821=_0x1751[_0x8da511];return _0x140821;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var logger=require(_0x1175('0x2'))(_0x1175('0x3'));var moment=require('moment');var BPromise=require(_0x1175('0x4'));var rp=require(_0x1175('0x5'));var fs=require('fs');var path=require(_0x1175('0x6'));var rimraf=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var attributes=require(_0x1175('0x9'));module[_0x1175('0xa')]=function(_0x171756,_0x3f99ca){return _0x171756[_0x1175('0xb')](_0x1175('0xc'),attributes,{'tableName':_0x1175('0xd'),'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 d6bc7c1..a30fbd3 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 _0x90aa=['raw','stringify','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','error','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','body','options'];(function(_0xe8425b,_0x58ce2c){var _0x1a6c78=function(_0x294a84){while(--_0x294a84){_0xe8425b['push'](_0xe8425b['shift']());}};_0x1a6c78(++_0x58ce2c);}(_0x90aa,0x152));var _0xa90a=function(_0x5c4cf7,_0x1319b4){_0x5c4cf7=_0x5c4cf7-0x0;var _0x3ffedb=_0x90aa[_0x5c4cf7];return _0x3ffedb;};'use strict';var _=require('lodash');var util=require(_0xa90a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa90a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa90a('0x2'))['db'];var utils=require(_0xa90a('0x3'));var logger=require(_0xa90a('0x4'))(_0xa90a('0x5'));var config=require(_0xa90a('0x6'));var jayson=require(_0xa90a('0x7'));var client=jayson['client'][_0xa90a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x140f2a,_0x22513a,_0xf21d13){return new BPromise(function(_0x1bcee8,_0x46e259){return client['request'](_0x140f2a,_0xf21d13)[_0xa90a('0x9')](function(_0x4a1174){logger[_0xa90a('0xa')]('SquareRecording,\x20%s,\x20%s',_0x22513a,_0xa90a('0xb'));logger[_0xa90a('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x22513a,'request\x20sent',JSON['stringify'](_0x4a1174));if(_0x4a1174['error']){if(_0x4a1174[_0xa90a('0xd')]['code']===0x1f4){logger[_0xa90a('0xd')](_0xa90a('0xe'),_0x22513a,_0x4a1174[_0xa90a('0xd')][_0xa90a('0xf')]);return _0x46e259(_0x4a1174[_0xa90a('0xd')]['message']);}logger[_0xa90a('0xd')](_0xa90a('0xe'),_0x22513a,_0x4a1174[_0xa90a('0xd')][_0xa90a('0xf')]);return _0x1bcee8(_0x4a1174[_0xa90a('0xd')][_0xa90a('0xf')]);}else{logger[_0xa90a('0xa')](_0xa90a('0xe'),_0x22513a,'request\x20sent');_0x1bcee8(_0x4a1174[_0xa90a('0x10')][_0xa90a('0xf')]);}})[_0xa90a('0x11')](function(_0x4b0f68){logger[_0xa90a('0xd')](_0xa90a('0xe'),_0x22513a,_0x4b0f68);_0x46e259(_0x4b0f68);});});}exports[_0xa90a('0x12')]=function(_0x1a5665){var _0x4c4c1c=this;return new Promise(function(_0x532985,_0x1df546){return db[_0xa90a('0x13')]['create'](_0x1a5665[_0xa90a('0x14')],{'raw':_0x1a5665[_0xa90a('0x15')]?_0x1a5665[_0xa90a('0x15')][_0xa90a('0x16')]===undefined?!![]:![]:!![]})[_0xa90a('0x9')](function(_0x27c9da){logger[_0xa90a('0xa')](_0xa90a('0x12'),_0x1a5665);logger[_0xa90a('0xc')](_0xa90a('0x12'),_0x1a5665,JSON[_0xa90a('0x17')](_0x27c9da));_0x532985(_0x27c9da);})[_0xa90a('0x11')](function(_0xe4fea5){logger[_0xa90a('0xd')](_0xa90a('0x12'),_0xe4fea5['message'],_0x1a5665);_0x1df546(_0x4c4c1c[_0xa90a('0xd')](0x1f4,_0xe4fea5[_0xa90a('0xf')]));});});}; \ No newline at end of file +var _0xae6a=['body','options','CreateSquareRecording','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','create'];(function(_0xee882e,_0x5c26ee){var _0x457b54=function(_0x2c82cc){while(--_0x2c82cc){_0xee882e['push'](_0xee882e['shift']());}};_0x457b54(++_0x5c26ee);}(_0xae6a,0x153));var _0xaae6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xae6a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xaae6('0x0'));var util=require('util');var moment=require(_0xaae6('0x1'));var BPromise=require(_0xaae6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaae6('0x3'))['db'];var utils=require(_0xaae6('0x4'));var logger=require('../../config/logger')(_0xaae6('0x5'));var config=require(_0xaae6('0x6'));var jayson=require(_0xaae6('0x7'));var client=jayson['client'][_0xaae6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1305bb,_0x144ee2,_0x3bc714){return new BPromise(function(_0x3ed524,_0xda8153){return client[_0xaae6('0x9')](_0x1305bb,_0x3bc714)[_0xaae6('0xa')](function(_0x397a56){logger[_0xaae6('0xb')](_0xaae6('0xc'),_0x144ee2,_0xaae6('0xd'));logger[_0xaae6('0xe')](_0xaae6('0xf'),_0x144ee2,_0xaae6('0xd'),JSON['stringify'](_0x397a56));if(_0x397a56[_0xaae6('0x10')]){if(_0x397a56[_0xaae6('0x10')][_0xaae6('0x11')]===0x1f4){logger[_0xaae6('0x10')](_0xaae6('0xc'),_0x144ee2,_0x397a56[_0xaae6('0x10')][_0xaae6('0x12')]);return _0xda8153(_0x397a56[_0xaae6('0x10')]['message']);}logger[_0xaae6('0x10')](_0xaae6('0xc'),_0x144ee2,_0x397a56[_0xaae6('0x10')]['message']);return _0x3ed524(_0x397a56[_0xaae6('0x10')][_0xaae6('0x12')]);}else{logger[_0xaae6('0xb')]('SquareRecording,\x20%s,\x20%s',_0x144ee2,_0xaae6('0xd'));_0x3ed524(_0x397a56['result'][_0xaae6('0x12')]);}})[_0xaae6('0x13')](function(_0x39ec2a){logger[_0xaae6('0x10')](_0xaae6('0xc'),_0x144ee2,_0x39ec2a);_0xda8153(_0x39ec2a);});});}exports['CreateSquareRecording']=function(_0xe8ef64){var _0x49a141=this;return new Promise(function(_0x5f28e5,_0x24b6fb){return db['SquareRecording'][_0xaae6('0x14')](_0xe8ef64[_0xaae6('0x15')],{'raw':_0xe8ef64[_0xaae6('0x16')]?_0xe8ef64[_0xaae6('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xaae6('0xa')](function(_0x2d7fcd){logger[_0xaae6('0xb')](_0xaae6('0x17'),_0xe8ef64);logger[_0xaae6('0xe')]('CreateSquareRecording',_0xe8ef64,JSON['stringify'](_0x2d7fcd));_0x5f28e5(_0x2d7fcd);})['catch'](function(_0x4c2bad){logger[_0xaae6('0x10')](_0xaae6('0x17'),_0x4c2bad[_0xaae6('0x12')],_0xe8ef64);_0x24b6fb(_0x49a141[_0xaae6('0x10')](0x1f4,_0x4c2bad[_0xaae6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 6b98d28..c0cbf63 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(_0x54e631,_0x3b8396){var _0x3c6b6a=function(_0x48cea6){while(--_0x48cea6){_0x54e631['push'](_0x54e631['shift']());}};_0x3c6b6a(++_0x3b8396);}(_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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x10a551,_0x420f2b){var _0x3d2708=function(_0x10876c){while(--_0x10876c){_0x10a551['push'](_0x10a551['shift']());}};_0x3d2708(++_0x420f2b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index ff03a0a..940b9e8 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 _0xccc3=['sequelize','exports','STRING','DATE'];(function(_0x779cdb,_0x189bd2){var _0x4e31ec=function(_0x515414){while(--_0x515414){_0x779cdb['push'](_0x779cdb['shift']());}};_0x4e31ec(++_0x189bd2);}(_0xccc3,0x128));var _0x3ccc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xccc3[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x3ccc('0x0'));module[_0x3ccc('0x1')]={'network':{'type':Sequelize[_0x3ccc('0x2')]},'network_script':{'type':Sequelize[_0x3ccc('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3ccc('0x2')]},'language':{'type':Sequelize[_0x3ccc('0x2')]},'type':{'type':Sequelize[_0x3ccc('0x2')]},'uniqueid':{'type':Sequelize[_0x3ccc('0x2')]},'version':{'type':Sequelize[_0x3ccc('0x2')]},'callerid':{'type':Sequelize[_0x3ccc('0x2')]},'calleridname':{'type':Sequelize[_0x3ccc('0x2')]},'callingpres':{'type':Sequelize[_0x3ccc('0x2')]},'callingani2':{'type':Sequelize[_0x3ccc('0x2')]},'callington':{'type':Sequelize[_0x3ccc('0x2')]},'callingtns':{'type':Sequelize[_0x3ccc('0x2')]},'dnid':{'type':Sequelize[_0x3ccc('0x2')]},'rdnis':{'type':Sequelize[_0x3ccc('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3ccc('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x3ccc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x3ccc('0x2')]},'project_name':{'type':Sequelize[_0x3ccc('0x2')]},'joinAt':{'type':Sequelize[_0x3ccc('0x3')]},'leaveAt':{'type':Sequelize[_0x3ccc('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8cb5=['exports','STRING','DATE','BOOLEAN'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x8cb5,0x1a0));var _0x58cb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cb5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x58cb('0x0')]={'network':{'type':Sequelize[_0x58cb('0x1')]},'network_script':{'type':Sequelize[_0x58cb('0x1')]},'request':{'type':Sequelize[_0x58cb('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x58cb('0x1')]},'type':{'type':Sequelize[_0x58cb('0x1')]},'uniqueid':{'type':Sequelize[_0x58cb('0x1')]},'version':{'type':Sequelize[_0x58cb('0x1')]},'callerid':{'type':Sequelize[_0x58cb('0x1')]},'calleridname':{'type':Sequelize[_0x58cb('0x1')]},'callingpres':{'type':Sequelize[_0x58cb('0x1')]},'callingani2':{'type':Sequelize[_0x58cb('0x1')]},'callington':{'type':Sequelize[_0x58cb('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x58cb('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x58cb('0x1')]},'extension':{'type':Sequelize[_0x58cb('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x58cb('0x1')]},'accountcode':{'type':Sequelize[_0x58cb('0x1')]},'threadid':{'type':Sequelize[_0x58cb('0x1')]},'project_name':{'type':Sequelize[_0x58cb('0x1')]},'joinAt':{'type':Sequelize[_0x58cb('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x58cb('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 d62abe5..6a257cb 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 _0xdd02=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','SquareReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status'];(function(_0x414cbe,_0x16a463){var _0x2793fe=function(_0x3a75f6){while(--_0x3a75f6){_0x414cbe['push'](_0x414cbe['shift']());}};_0x2793fe(++_0x16a463);}(_0xdd02,0x159));var _0x2dd0=function(_0x27b0ac,_0x2aa438){_0x27b0ac=_0x27b0ac-0x0;var _0xc6f49c=_0xdd02[_0x27b0ac];return _0xc6f49c;};'use strict';var emlformat=require(_0x2dd0('0x0'));var rimraf=require(_0x2dd0('0x1'));var zipdir=require(_0x2dd0('0x2'));var jsonpatch=require(_0x2dd0('0x3'));var rp=require(_0x2dd0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2dd0('0x5'));var util=require(_0x2dd0('0x6'));var path=require(_0x2dd0('0x7'));var sox=require(_0x2dd0('0x8'));var csv=require(_0x2dd0('0x9'));var ejs=require(_0x2dd0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dd0('0xb'));var squel=require('squel');var crypto=require(_0x2dd0('0xc'));var jsforce=require(_0x2dd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2dd0('0x9'));var querystring=require(_0x2dd0('0xe'));var Papa=require(_0x2dd0('0xf'));var Redis=require('ioredis');var authService=require(_0x2dd0('0x10'));var qs=require(_0x2dd0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2dd0('0x12'));var logger=require(_0x2dd0('0x13'))(_0x2dd0('0x14'));var utils=require(_0x2dd0('0x15'));var config=require(_0x2dd0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x110da9,_0x1a5bde){_0x1a5bde=_0x1a5bde||0xcc;return function(_0x4bd995){if(_0x4bd995){return _0x110da9['sendStatus'](_0x1a5bde);}return _0x110da9['status'](_0x1a5bde)[_0x2dd0('0x17')]();};}function respondWithResult(_0x245597,_0x2eb0d4){_0x2eb0d4=_0x2eb0d4||0xc8;return function(_0x278da4){if(_0x278da4){return _0x245597[_0x2dd0('0x18')](_0x2eb0d4)[_0x2dd0('0x19')](_0x278da4);}};}function respondWithFilteredResult(_0x505c95,_0x51e924){return function(_0x55e625){if(_0x55e625){var _0x8e5be1=typeof _0x51e924[_0x2dd0('0x1a')]===_0x2dd0('0x1b')&&typeof _0x51e924['limit']==='undefined';var _0x1d7124=_0x55e625[_0x2dd0('0x1c')];var _0x516468=_0x8e5be1?0x0:_0x51e924[_0x2dd0('0x1a')];var _0x5b5584=_0x8e5be1?_0x55e625[_0x2dd0('0x1c')]:_0x51e924['offset']+_0x51e924[_0x2dd0('0x1d')];var _0x318db4;if(_0x5b5584>=_0x1d7124){_0x5b5584=_0x1d7124;_0x318db4=0xc8;}else{_0x318db4=0xce;}_0x505c95['status'](_0x318db4);return _0x505c95[_0x2dd0('0x1e')](_0x2dd0('0x1f'),_0x516468+'-'+_0x5b5584+'/'+_0x1d7124)[_0x2dd0('0x19')](_0x55e625);}return null;};}function patchUpdates(_0x1f4bfc){return function(_0x10553a){try{jsonpatch[_0x2dd0('0x20')](_0x10553a,_0x1f4bfc,!![]);}catch(_0x34e060){return BPromise[_0x2dd0('0x21')](_0x34e060);}return _0x10553a[_0x2dd0('0x22')]();};}function saveUpdates(_0x164268,_0x587832){return function(_0x25f285){if(_0x25f285){return _0x25f285[_0x2dd0('0x23')](_0x164268)[_0x2dd0('0x24')](function(_0x545be8){return _0x545be8;});}return null;};}function removeEntity(_0x44d0cc,_0x121e3c){return function(_0x5b8936){if(_0x5b8936){return _0x5b8936[_0x2dd0('0x25')]()[_0x2dd0('0x24')](function(){_0x44d0cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x555068,_0x2bc624){return function(_0x43fea2){if(!_0x43fea2){_0x555068[_0x2dd0('0x26')](0x194);}return _0x43fea2;};}function handleError(_0x281251,_0x3f871d){_0x3f871d=_0x3f871d||0x1f4;return function(_0x3117c4){logger[_0x2dd0('0x27')](_0x3117c4[_0x2dd0('0x28')]);if(_0x3117c4[_0x2dd0('0x29')]){delete _0x3117c4[_0x2dd0('0x29')];}_0x281251[_0x2dd0('0x18')](_0x3f871d)[_0x2dd0('0x2a')](_0x3117c4);};}exports[_0x2dd0('0x2b')]=function(_0x59c7d4,_0x535d28){var _0x173d1f={},_0x29fab4={},_0x64378e={'count':0x0,'rows':[]};var _0x49665f=_['map'](db[_0x2dd0('0x2c')][_0x2dd0('0x2d')],function(_0x35a268){return{'name':_0x35a268['fieldName'],'type':_0x35a268[_0x2dd0('0x2e')][_0x2dd0('0x2f')]};});_0x29fab4[_0x2dd0('0x30')]=_[_0x2dd0('0x31')](_0x49665f,_0x2dd0('0x29'));_0x29fab4['query']=_[_0x2dd0('0x32')](_0x59c7d4[_0x2dd0('0x33')]);_0x29fab4[_0x2dd0('0x34')]=_[_0x2dd0('0x35')](_0x29fab4[_0x2dd0('0x30')],_0x29fab4[_0x2dd0('0x33')]);_0x173d1f['attributes']=_[_0x2dd0('0x35')](_0x29fab4[_0x2dd0('0x30')],qs[_0x2dd0('0x36')](_0x59c7d4[_0x2dd0('0x33')][_0x2dd0('0x36')]));_0x173d1f[_0x2dd0('0x37')]=_0x173d1f[_0x2dd0('0x37')][_0x2dd0('0x38')]?_0x173d1f[_0x2dd0('0x37')]:_0x29fab4[_0x2dd0('0x30')];if(!_0x59c7d4['query'][_0x2dd0('0x39')](_0x2dd0('0x3a'))){_0x173d1f[_0x2dd0('0x1d')]=qs['limit'](_0x59c7d4[_0x2dd0('0x33')][_0x2dd0('0x1d')]);_0x173d1f[_0x2dd0('0x1a')]=qs[_0x2dd0('0x1a')](_0x59c7d4['query'][_0x2dd0('0x1a')]);}_0x173d1f[_0x2dd0('0x3b')]=qs['sort'](_0x59c7d4['query'][_0x2dd0('0x3c')]);_0x173d1f[_0x2dd0('0x3d')]=qs[_0x2dd0('0x34')](_['pick'](_0x59c7d4['query'],_0x29fab4['filters']),_0x49665f);if(_0x59c7d4[_0x2dd0('0x33')][_0x2dd0('0x3e')]){_0x173d1f[_0x2dd0('0x3d')]=_[_0x2dd0('0x3f')](_0x173d1f[_0x2dd0('0x3d')],{'$or':_[_0x2dd0('0x31')](_0x49665f,function(_0x1e01eb){if(_0x1e01eb['type']!==_0x2dd0('0x40')){var _0x2a115c={};_0x2a115c[_0x1e01eb[_0x2dd0('0x29')]]={'$like':'%'+_0x59c7d4[_0x2dd0('0x33')][_0x2dd0('0x3e')]+'%'};return _0x2a115c;}})});}_0x173d1f=_[_0x2dd0('0x3f')]({},_0x173d1f,_0x59c7d4[_0x2dd0('0x41')]);var _0x1844c1={'where':_0x173d1f[_0x2dd0('0x3d')]};return db[_0x2dd0('0x2c')][_0x2dd0('0x1c')](_0x1844c1)[_0x2dd0('0x24')](function(_0x2a51b8){_0x64378e['count']=_0x2a51b8;if(_0x59c7d4[_0x2dd0('0x33')]['includeAll']){_0x173d1f[_0x2dd0('0x42')]=[{'all':!![]}];}return db['SquareReport'][_0x2dd0('0x43')](_0x173d1f);})['then'](function(_0xe7c614){_0x64378e['rows']=_0xe7c614;return _0x64378e;})[_0x2dd0('0x24')](respondWithFilteredResult(_0x535d28,_0x173d1f))[_0x2dd0('0x44')](handleError(_0x535d28,null));};exports['show']=function(_0x27b665,_0x26fa62){var _0x263181={'raw':!![],'where':{'id':_0x27b665[_0x2dd0('0x45')]['id']}},_0x5bf437={};_0x5bf437['model']=_[_0x2dd0('0x32')](db[_0x2dd0('0x2c')]['rawAttributes']);_0x5bf437[_0x2dd0('0x33')]=_[_0x2dd0('0x32')](_0x27b665[_0x2dd0('0x33')]);_0x5bf437[_0x2dd0('0x34')]=_[_0x2dd0('0x35')](_0x5bf437[_0x2dd0('0x30')],_0x5bf437[_0x2dd0('0x33')]);_0x263181['attributes']=_[_0x2dd0('0x35')](_0x5bf437[_0x2dd0('0x30')],qs[_0x2dd0('0x36')](_0x27b665[_0x2dd0('0x33')]['fields']));_0x263181['attributes']=_0x263181[_0x2dd0('0x37')][_0x2dd0('0x38')]?_0x263181[_0x2dd0('0x37')]:_0x5bf437['model'];if(_0x27b665[_0x2dd0('0x33')]['includeAll']){_0x263181[_0x2dd0('0x42')]=[{'all':!![]}];}_0x263181=_['merge']({},_0x263181,_0x27b665[_0x2dd0('0x41')]);return db[_0x2dd0('0x2c')][_0x2dd0('0x46')](_0x263181)[_0x2dd0('0x24')](handleEntityNotFound(_0x26fa62,null))[_0x2dd0('0x24')](respondWithResult(_0x26fa62,null))[_0x2dd0('0x44')](handleError(_0x26fa62,null));};exports[_0x2dd0('0x47')]=function(_0x2df648,_0x2ab91f){return db[_0x2dd0('0x2c')][_0x2dd0('0x47')](_0x2df648[_0x2dd0('0x48')],{})[_0x2dd0('0x24')](respondWithResult(_0x2ab91f,0xc9))[_0x2dd0('0x44')](handleError(_0x2ab91f,null));};exports['update']=function(_0x139d53,_0x75d45d){if(_0x139d53['body']['id']){delete _0x139d53[_0x2dd0('0x48')]['id'];}return db['SquareReport'][_0x2dd0('0x46')]({'where':{'id':_0x139d53[_0x2dd0('0x45')]['id']}})[_0x2dd0('0x24')](handleEntityNotFound(_0x75d45d,null))[_0x2dd0('0x24')](saveUpdates(_0x139d53['body'],null))[_0x2dd0('0x24')](respondWithResult(_0x75d45d,null))['catch'](handleError(_0x75d45d,null));};exports[_0x2dd0('0x25')]=function(_0x36c1d0,_0x4a300b){return db[_0x2dd0('0x2c')]['find']({'where':{'id':_0x36c1d0[_0x2dd0('0x45')]['id']}})[_0x2dd0('0x24')](handleEntityNotFound(_0x4a300b,null))[_0x2dd0('0x24')](removeEntity(_0x4a300b,null))[_0x2dd0('0x44')](handleError(_0x4a300b,null));};exports[_0x2dd0('0x49')]=function(_0x35fe33,_0x9fe61){return db[_0x2dd0('0x2c')][_0x2dd0('0x49')]()[_0x2dd0('0x24')](respondWithResult(_0x9fe61,null))['catch'](handleError(_0x9fe61,null));}; \ No newline at end of file +var _0xe566=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','sendStatus','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x119fc3,_0x3f7511){var _0x219bcc=function(_0xc3d437){while(--_0xc3d437){_0x119fc3['push'](_0x119fc3['shift']());}};_0x219bcc(++_0x3f7511);}(_0xe566,0x124));var _0x6e56=function(_0x5c40b0,_0x2f7aed){_0x5c40b0=_0x5c40b0-0x0;var _0x2b71f1=_0xe566[_0x5c40b0];return _0x2b71f1;};'use strict';var emlformat=require(_0x6e56('0x0'));var rimraf=require(_0x6e56('0x1'));var zipdir=require(_0x6e56('0x2'));var jsonpatch=require(_0x6e56('0x3'));var rp=require(_0x6e56('0x4'));var moment=require('moment');var BPromise=require(_0x6e56('0x5'));var Mustache=require(_0x6e56('0x6'));var util=require(_0x6e56('0x7'));var path=require('path');var sox=require(_0x6e56('0x8'));var csv=require(_0x6e56('0x9'));var ejs=require(_0x6e56('0xa'));var fs=require('fs');var fs_extra=require(_0x6e56('0xb'));var _=require('lodash');var squel=require(_0x6e56('0xc'));var crypto=require(_0x6e56('0xd'));var jsforce=require(_0x6e56('0xe'));var deskjs=require(_0x6e56('0xf'));var toCsv=require(_0x6e56('0x9'));var querystring=require('querystring');var Papa=require(_0x6e56('0x10'));var Redis=require(_0x6e56('0x11'));var authService=require(_0x6e56('0x12'));var qs=require(_0x6e56('0x13'));var as=require(_0x6e56('0x14'));var hardwareService=require(_0x6e56('0x15'));var logger=require('../../config/logger')(_0x6e56('0x16'));var utils=require(_0x6e56('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6e56('0x18'))['db'];function respondWithStatusCode(_0x308979,_0x944d79){_0x944d79=_0x944d79||0xcc;return function(_0x5d1491){if(_0x5d1491){return _0x308979['sendStatus'](_0x944d79);}return _0x308979[_0x6e56('0x19')](_0x944d79)['end']();};}function respondWithResult(_0x26018f,_0x2a2012){_0x2a2012=_0x2a2012||0xc8;return function(_0x1fb671){if(_0x1fb671){return _0x26018f[_0x6e56('0x19')](_0x2a2012)[_0x6e56('0x1a')](_0x1fb671);}};}function respondWithFilteredResult(_0x4cf573,_0x49486f){return function(_0x41b6be){if(_0x41b6be){var _0x3dee18=typeof _0x49486f[_0x6e56('0x1b')]===_0x6e56('0x1c')&&typeof _0x49486f[_0x6e56('0x1d')]===_0x6e56('0x1c');var _0x308ea2=_0x41b6be[_0x6e56('0x1e')];var _0x399a7e=_0x3dee18?0x0:_0x49486f['offset'];var _0x236615=_0x3dee18?_0x41b6be[_0x6e56('0x1e')]:_0x49486f[_0x6e56('0x1b')]+_0x49486f['limit'];var _0x3bd8a3;if(_0x236615>=_0x308ea2){_0x236615=_0x308ea2;_0x3bd8a3=0xc8;}else{_0x3bd8a3=0xce;}_0x4cf573[_0x6e56('0x19')](_0x3bd8a3);return _0x4cf573[_0x6e56('0x1f')](_0x6e56('0x20'),_0x399a7e+'-'+_0x236615+'/'+_0x308ea2)[_0x6e56('0x1a')](_0x41b6be);}return null;};}function patchUpdates(_0x4fe72f){return function(_0x2223b8){try{jsonpatch['apply'](_0x2223b8,_0x4fe72f,!![]);}catch(_0x2b81db){return BPromise[_0x6e56('0x21')](_0x2b81db);}return _0x2223b8[_0x6e56('0x22')]();};}function saveUpdates(_0x57d60c,_0x53df3d){return function(_0x490916){if(_0x490916){return _0x490916['update'](_0x57d60c)[_0x6e56('0x23')](function(_0x391226){return _0x391226;});}return null;};}function removeEntity(_0x1872f3,_0x40f714){return function(_0x167689){if(_0x167689){return _0x167689['destroy']()['then'](function(){_0x1872f3['status'](0xcc)[_0x6e56('0x24')]();});}};}function handleEntityNotFound(_0x119089,_0x412fd4){return function(_0x5e4f0a){if(!_0x5e4f0a){_0x119089[_0x6e56('0x25')](0x194);}return _0x5e4f0a;};}function handleError(_0x989416,_0x421847){_0x421847=_0x421847||0x1f4;return function(_0x11ff08){logger['error'](_0x11ff08[_0x6e56('0x26')]);if(_0x11ff08[_0x6e56('0x27')]){delete _0x11ff08['name'];}_0x989416[_0x6e56('0x19')](_0x421847)[_0x6e56('0x28')](_0x11ff08);};}exports[_0x6e56('0x29')]=function(_0x5ef743,_0x2a29d7){var _0x463841={},_0x1bb4bd={},_0x22137a={'count':0x0,'rows':[]};var _0x50b2d1=_[_0x6e56('0x2a')](db[_0x6e56('0x2b')][_0x6e56('0x2c')],function(_0x2395f9){return{'name':_0x2395f9[_0x6e56('0x2d')],'type':_0x2395f9[_0x6e56('0x2e')][_0x6e56('0x2f')]};});_0x1bb4bd['model']=_[_0x6e56('0x2a')](_0x50b2d1,_0x6e56('0x27'));_0x1bb4bd['query']=_[_0x6e56('0x30')](_0x5ef743[_0x6e56('0x31')]);_0x1bb4bd['filters']=_[_0x6e56('0x32')](_0x1bb4bd[_0x6e56('0x33')],_0x1bb4bd[_0x6e56('0x31')]);_0x463841[_0x6e56('0x34')]=_[_0x6e56('0x32')](_0x1bb4bd[_0x6e56('0x33')],qs[_0x6e56('0x35')](_0x5ef743[_0x6e56('0x31')][_0x6e56('0x35')]));_0x463841[_0x6e56('0x34')]=_0x463841[_0x6e56('0x34')][_0x6e56('0x36')]?_0x463841[_0x6e56('0x34')]:_0x1bb4bd['model'];if(!_0x5ef743[_0x6e56('0x31')]['hasOwnProperty'](_0x6e56('0x37'))){_0x463841[_0x6e56('0x1d')]=qs[_0x6e56('0x1d')](_0x5ef743[_0x6e56('0x31')][_0x6e56('0x1d')]);_0x463841[_0x6e56('0x1b')]=qs[_0x6e56('0x1b')](_0x5ef743[_0x6e56('0x31')]['offset']);}_0x463841[_0x6e56('0x38')]=qs[_0x6e56('0x39')](_0x5ef743['query'][_0x6e56('0x39')]);_0x463841[_0x6e56('0x3a')]=qs[_0x6e56('0x3b')](_[_0x6e56('0x3c')](_0x5ef743[_0x6e56('0x31')],_0x1bb4bd[_0x6e56('0x3b')]),_0x50b2d1);if(_0x5ef743['query'][_0x6e56('0x3d')]){_0x463841[_0x6e56('0x3a')]=_[_0x6e56('0x3e')](_0x463841[_0x6e56('0x3a')],{'$or':_[_0x6e56('0x2a')](_0x50b2d1,function(_0x4809bb){if(_0x4809bb[_0x6e56('0x2e')]!==_0x6e56('0x3f')){var _0x216c15={};_0x216c15[_0x4809bb[_0x6e56('0x27')]]={'$like':'%'+_0x5ef743[_0x6e56('0x31')][_0x6e56('0x3d')]+'%'};return _0x216c15;}})});}_0x463841=_[_0x6e56('0x3e')]({},_0x463841,_0x5ef743['options']);var _0xe57312={'where':_0x463841[_0x6e56('0x3a')]};return db[_0x6e56('0x2b')][_0x6e56('0x1e')](_0xe57312)[_0x6e56('0x23')](function(_0x531efb){_0x22137a[_0x6e56('0x1e')]=_0x531efb;if(_0x5ef743[_0x6e56('0x31')][_0x6e56('0x40')]){_0x463841[_0x6e56('0x41')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x463841);})[_0x6e56('0x23')](function(_0x2eabee){_0x22137a[_0x6e56('0x42')]=_0x2eabee;return _0x22137a;})[_0x6e56('0x23')](respondWithFilteredResult(_0x2a29d7,_0x463841))[_0x6e56('0x43')](handleError(_0x2a29d7,null));};exports[_0x6e56('0x44')]=function(_0x1a40ea,_0x507bcb){var _0x214204={'raw':!![],'where':{'id':_0x1a40ea[_0x6e56('0x45')]['id']}},_0x5b884a={};_0x5b884a[_0x6e56('0x33')]=_[_0x6e56('0x30')](db[_0x6e56('0x2b')][_0x6e56('0x2c')]);_0x5b884a[_0x6e56('0x31')]=_['keys'](_0x1a40ea[_0x6e56('0x31')]);_0x5b884a[_0x6e56('0x3b')]=_['intersection'](_0x5b884a[_0x6e56('0x33')],_0x5b884a[_0x6e56('0x31')]);_0x214204[_0x6e56('0x34')]=_[_0x6e56('0x32')](_0x5b884a[_0x6e56('0x33')],qs[_0x6e56('0x35')](_0x1a40ea['query'][_0x6e56('0x35')]));_0x214204['attributes']=_0x214204['attributes'][_0x6e56('0x36')]?_0x214204[_0x6e56('0x34')]:_0x5b884a[_0x6e56('0x33')];if(_0x1a40ea['query'][_0x6e56('0x40')]){_0x214204['include']=[{'all':!![]}];}_0x214204=_[_0x6e56('0x3e')]({},_0x214204,_0x1a40ea[_0x6e56('0x46')]);return db[_0x6e56('0x2b')][_0x6e56('0x47')](_0x214204)['then'](handleEntityNotFound(_0x507bcb,null))[_0x6e56('0x23')](respondWithResult(_0x507bcb,null))[_0x6e56('0x43')](handleError(_0x507bcb,null));};exports[_0x6e56('0x48')]=function(_0x5562b7,_0x2a5e15){return db[_0x6e56('0x2b')][_0x6e56('0x48')](_0x5562b7[_0x6e56('0x49')],{})['then'](respondWithResult(_0x2a5e15,0xc9))[_0x6e56('0x43')](handleError(_0x2a5e15,null));};exports[_0x6e56('0x4a')]=function(_0x18e601,_0x3949e3){if(_0x18e601[_0x6e56('0x49')]['id']){delete _0x18e601[_0x6e56('0x49')]['id'];}return db[_0x6e56('0x2b')][_0x6e56('0x47')]({'where':{'id':_0x18e601['params']['id']}})[_0x6e56('0x23')](handleEntityNotFound(_0x3949e3,null))[_0x6e56('0x23')](saveUpdates(_0x18e601[_0x6e56('0x49')],null))[_0x6e56('0x23')](respondWithResult(_0x3949e3,null))[_0x6e56('0x43')](handleError(_0x3949e3,null));};exports[_0x6e56('0x4b')]=function(_0x172815,_0x59cb8c){return db[_0x6e56('0x2b')][_0x6e56('0x47')]({'where':{'id':_0x172815['params']['id']}})[_0x6e56('0x23')](handleEntityNotFound(_0x59cb8c,null))[_0x6e56('0x23')](removeEntity(_0x59cb8c,null))[_0x6e56('0x43')](handleError(_0x59cb8c,null));};exports[_0x6e56('0x4c')]=function(_0x4641f4,_0x33b24b){return db[_0x6e56('0x2b')][_0x6e56('0x4c')]()[_0x6e56('0x23')](respondWithResult(_0x33b24b,null))[_0x6e56('0x43')](handleError(_0x33b24b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f7c715a..c06ed64 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 _0x319d=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x3dacb4,_0x4bcb89){var _0x2433db=function(_0x2e610e){while(--_0x2e610e){_0x3dacb4['push'](_0x3dacb4['shift']());}};_0x2433db(++_0x4bcb89);}(_0x319d,0x168));var _0xd319=function(_0x56aa6c,_0x360d1c){_0x56aa6c=_0x56aa6c-0x0;var _0x580b72=_0x319d[_0x56aa6c];return _0x580b72;};'use strict';var _=require('lodash');var util=require(_0xd319('0x0'));var logger=require(_0xd319('0x1'))(_0xd319('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd319('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd319('0x4'));var config=require(_0xd319('0x5'));var attributes=require('./squareReport.attributes');module['exports']=function(_0xc68c58,_0x2fdf17){return _0xc68c58['define'](_0xd319('0x6'),attributes,{'tableName':_0xd319('0x7'),'paranoid':![],'indexes':[{'name':_0xd319('0x8'),'fields':[_0xd319('0x9'),_0xd319('0xa')]},{'name':_0xd319('0xb'),'fields':[_0xd319('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae5f=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','moment','bluebird','rimraf','./squareReport.attributes','exports','define','report_square'];(function(_0x3fd072,_0x23eb8e){var _0x13895c=function(_0x33870e){while(--_0x33870e){_0x3fd072['push'](_0x3fd072['shift']());}};_0x13895c(++_0x23eb8e);}(_0xae5f,0x1d8));var _0xfae5=function(_0x254d13,_0x352ae5){_0x254d13=_0x254d13-0x0;var _0x43fd0b=_0xae5f[_0x254d13];return _0x43fd0b;};'use strict';var _=require(_0xfae5('0x0'));var util=require(_0xfae5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfae5('0x2'));var BPromise=require(_0xfae5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfae5('0x4'));var config=require('../../config/environment');var attributes=require(_0xfae5('0x5'));module[_0xfae5('0x6')]=function(_0x3c85a6,_0x225ca8){return _0x3c85a6[_0xfae5('0x7')]('SquareReport',attributes,{'tableName':_0xfae5('0x8'),'paranoid':![],'indexes':[{'name':_0xfae5('0x9'),'fields':[_0xfae5('0xa'),_0xfae5('0xb')]},{'name':_0xfae5('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c4b0611..36679d5 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 _0xd4e4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','body','options','raw','then','debug','catch','UpdateSquareReport','update','where','attributes','limit','lodash','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd4e4,0x173));var _0x4d4e=function(_0x3209c6,_0x3b0519){_0x3209c6=_0x3209c6-0x0;var _0xb39dcc=_0xd4e4[_0x3209c6];return _0xb39dcc;};'use strict';var _=require(_0x4d4e('0x0'));var util=require('util');var moment=require(_0x4d4e('0x1'));var BPromise=require(_0x4d4e('0x2'));var rs=require(_0x4d4e('0x3'));var fs=require('fs');var Redis=require(_0x4d4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d4e('0x5'));var logger=require(_0x4d4e('0x6'))(_0x4d4e('0x7'));var config=require('../../config/environment');var jayson=require(_0x4d4e('0x8'));var client=jayson[_0x4d4e('0x9')][_0x4d4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcb9bb3,_0x32a2f9,_0x3b3109){return new BPromise(function(_0x5340d4,_0x3bc362){return client[_0x4d4e('0xb')](_0xcb9bb3,_0x3b3109)['then'](function(_0x2616d6){logger[_0x4d4e('0xc')](_0x4d4e('0xd'),_0x32a2f9,_0x4d4e('0xe'));logger['debug'](_0x4d4e('0xf'),_0x32a2f9,_0x4d4e('0xe'),JSON[_0x4d4e('0x10')](_0x2616d6));if(_0x2616d6[_0x4d4e('0x11')]){if(_0x2616d6[_0x4d4e('0x11')][_0x4d4e('0x12')]===0x1f4){logger['error'](_0x4d4e('0xd'),_0x32a2f9,_0x2616d6['error'][_0x4d4e('0x13')]);return _0x3bc362(_0x2616d6[_0x4d4e('0x11')][_0x4d4e('0x13')]);}logger[_0x4d4e('0x11')](_0x4d4e('0xd'),_0x32a2f9,_0x2616d6[_0x4d4e('0x11')][_0x4d4e('0x13')]);return _0x5340d4(_0x2616d6[_0x4d4e('0x11')][_0x4d4e('0x13')]);}else{logger[_0x4d4e('0xc')](_0x4d4e('0xd'),_0x32a2f9,_0x4d4e('0xe'));_0x5340d4(_0x2616d6[_0x4d4e('0x14')][_0x4d4e('0x13')]);}})['catch'](function(_0x12e293){logger['error'](_0x4d4e('0xd'),_0x32a2f9,_0x12e293);_0x3bc362(_0x12e293);});});}exports[_0x4d4e('0x15')]=function(_0x56f793){var _0xc2104c=this;return new Promise(function(_0x19316e,_0x3a8e5f){return db[_0x4d4e('0x16')]['create'](_0x56f793[_0x4d4e('0x17')],{'raw':_0x56f793[_0x4d4e('0x18')]?_0x56f793[_0x4d4e('0x18')][_0x4d4e('0x19')]===undefined?!![]:![]:!![]})[_0x4d4e('0x1a')](function(_0x53689a){logger[_0x4d4e('0xc')]('CreateSquareReport',_0x56f793);logger[_0x4d4e('0x1b')](_0x4d4e('0x15'),_0x56f793,JSON[_0x4d4e('0x10')](_0x53689a));_0x19316e(_0x53689a);})[_0x4d4e('0x1c')](function(_0x5500a2){logger[_0x4d4e('0x11')](_0x4d4e('0x15'),_0x5500a2['message'],_0x56f793);_0x3a8e5f(_0xc2104c[_0x4d4e('0x11')](0x1f4,_0x5500a2[_0x4d4e('0x13')]));});});};exports[_0x4d4e('0x1d')]=function(_0x4ed38b){var _0x32d68b=this;return new Promise(function(_0x53ca6a,_0x4a4bd4){return db[_0x4d4e('0x16')][_0x4d4e('0x1e')](_0x4ed38b['body'],{'raw':_0x4ed38b[_0x4d4e('0x18')]?_0x4ed38b[_0x4d4e('0x18')][_0x4d4e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed38b[_0x4d4e('0x18')]?_0x4ed38b[_0x4d4e('0x18')][_0x4d4e('0x1f')]||null:null,'attributes':_0x4ed38b[_0x4d4e('0x18')]?_0x4ed38b[_0x4d4e('0x18')][_0x4d4e('0x20')]||null:null,'limit':_0x4ed38b[_0x4d4e('0x18')]?_0x4ed38b[_0x4d4e('0x18')][_0x4d4e('0x21')]||null:null})['then'](function(_0xe6d399){logger[_0x4d4e('0xc')]('UpdateSquareReport',_0x4ed38b);logger[_0x4d4e('0x1b')]('UpdateSquareReport',_0x4ed38b,JSON['stringify'](_0xe6d399));_0x53ca6a(_0xe6d399);})['catch'](function(_0x372ddf){logger[_0x4d4e('0x11')](_0x4d4e('0x1d'),_0x372ddf[_0x4d4e('0x13')],_0x4ed38b);_0x4a4bd4(_0x32d68b['error'](0x1f4,_0x372ddf[_0x4d4e('0x13')]));});});}; \ No newline at end of file +var _0x61d0=['SquareReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','create','body','options','UpdateSquareReport'];(function(_0x47d913,_0x1db2ee){var _0x59d981=function(_0x148ec1){while(--_0x148ec1){_0x47d913['push'](_0x47d913['shift']());}};_0x59d981(++_0x1db2ee);}(_0x61d0,0xca));var _0x061d=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x61d0[_0x514c15];return _0x16283e;};'use strict';var _=require(_0x061d('0x0'));var util=require(_0x061d('0x1'));var moment=require('moment');var BPromise=require(_0x061d('0x2'));var rs=require(_0x061d('0x3'));var fs=require('fs');var Redis=require(_0x061d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x061d('0x5'));var logger=require(_0x061d('0x6'))(_0x061d('0x7'));var config=require(_0x061d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x061d('0x9')][_0x061d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1caccc,_0xc7d451,_0x3f7de6){return new BPromise(function(_0x26cc21,_0x354a97){return client[_0x061d('0xb')](_0x1caccc,_0x3f7de6)[_0x061d('0xc')](function(_0x1e1e35){logger[_0x061d('0xd')](_0x061d('0xe'),_0xc7d451,_0x061d('0xf'));logger[_0x061d('0x10')](_0x061d('0x11'),_0xc7d451,'request\x20sent',JSON[_0x061d('0x12')](_0x1e1e35));if(_0x1e1e35['error']){if(_0x1e1e35[_0x061d('0x13')][_0x061d('0x14')]===0x1f4){logger['error'](_0x061d('0xe'),_0xc7d451,_0x1e1e35[_0x061d('0x13')][_0x061d('0x15')]);return _0x354a97(_0x1e1e35[_0x061d('0x13')][_0x061d('0x15')]);}logger[_0x061d('0x13')]('SquareReport,\x20%s,\x20%s',_0xc7d451,_0x1e1e35['error'][_0x061d('0x15')]);return _0x26cc21(_0x1e1e35[_0x061d('0x13')][_0x061d('0x15')]);}else{logger[_0x061d('0xd')](_0x061d('0xe'),_0xc7d451,_0x061d('0xf'));_0x26cc21(_0x1e1e35[_0x061d('0x16')][_0x061d('0x15')]);}})[_0x061d('0x17')](function(_0x5345b8){logger[_0x061d('0x13')](_0x061d('0xe'),_0xc7d451,_0x5345b8);_0x354a97(_0x5345b8);});});}exports[_0x061d('0x18')]=function(_0x137034){var _0x10e69c=this;return new Promise(function(_0x22cba8,_0x4c9146){return db['SquareReport'][_0x061d('0x19')](_0x137034[_0x061d('0x1a')],{'raw':_0x137034[_0x061d('0x1b')]?_0x137034['options']['raw']===undefined?!![]:![]:!![]})[_0x061d('0xc')](function(_0x58c6b5){logger['info']('CreateSquareReport',_0x137034);logger[_0x061d('0x10')]('CreateSquareReport',_0x137034,JSON[_0x061d('0x12')](_0x58c6b5));_0x22cba8(_0x58c6b5);})['catch'](function(_0x12b2cd){logger['error'](_0x061d('0x18'),_0x12b2cd[_0x061d('0x15')],_0x137034);_0x4c9146(_0x10e69c[_0x061d('0x13')](0x1f4,_0x12b2cd[_0x061d('0x15')]));});});};exports[_0x061d('0x1c')]=function(_0x379724){var _0x4b2d34=this;return new Promise(function(_0xae13d7,_0x3a9c75){return db[_0x061d('0x1d')][_0x061d('0x1e')](_0x379724[_0x061d('0x1a')],{'raw':_0x379724[_0x061d('0x1b')]?_0x379724[_0x061d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x379724[_0x061d('0x1b')]?_0x379724[_0x061d('0x1b')][_0x061d('0x1f')]||null:null,'attributes':_0x379724[_0x061d('0x1b')]?_0x379724[_0x061d('0x1b')][_0x061d('0x20')]||null:null,'limit':_0x379724[_0x061d('0x1b')]?_0x379724[_0x061d('0x1b')]['limit']||null:null})[_0x061d('0xc')](function(_0x4336cd){logger[_0x061d('0xd')](_0x061d('0x1c'),_0x379724);logger[_0x061d('0x10')](_0x061d('0x1c'),_0x379724,JSON['stringify'](_0x4336cd));_0xae13d7(_0x4336cd);})['catch'](function(_0x1c8b87){logger[_0x061d('0x13')](_0x061d('0x1c'),_0x1c8b87[_0x061d('0x15')],_0x379724);_0x3a9c75(_0x4b2d34['error'](0x1f4,_0x1c8b87['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ccac2fd..734f31a 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 _0x3841=['./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3841,0x82));var _0x1384=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x3841[_0x2125f0];return _0x12d6eb;};'use strict';var multer=require(_0x1384('0x0'));var util=require('util');var path=require(_0x1384('0x1'));var timeout=require(_0x1384('0x2'));var express=require(_0x1384('0x3'));var router=express['Router']();var fs_extra=require(_0x1384('0x4'));var auth=require(_0x1384('0x5'));var interaction=require(_0x1384('0x6'));var config=require(_0x1384('0x7'));var controller=require(_0x1384('0x8'));router[_0x1384('0x9')]('/',auth[_0x1384('0xa')](),controller[_0x1384('0xb')]);router['get'](_0x1384('0xc'),auth['isAuthenticated'](),controller[_0x1384('0xd')]);router[_0x1384('0x9')](_0x1384('0xe'),auth[_0x1384('0xa')](),controller[_0x1384('0xf')]);router[_0x1384('0x10')]('/',auth[_0x1384('0xa')](),controller[_0x1384('0x11')]);router[_0x1384('0x12')](_0x1384('0xe'),auth[_0x1384('0xa')](),controller[_0x1384('0x13')]);router[_0x1384('0x14')](_0x1384('0xe'),auth[_0x1384('0xa')](),controller[_0x1384('0x15')]);module[_0x1384('0x16')]=router; \ No newline at end of file +var _0xf5f9=['fs-extra','../../components/auth/service','./squareReportDetail.controller','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x1ebce0,_0x50e239){var _0x4208a7=function(_0x41976e){while(--_0x41976e){_0x1ebce0['push'](_0x1ebce0['shift']());}};_0x4208a7(++_0x50e239);}(_0xf5f9,0xa3));var _0x9f5f=function(_0x369b51,_0x1c8d97){_0x369b51=_0x369b51-0x0;var _0x247729=_0xf5f9[_0x369b51];return _0x247729;};'use strict';var multer=require(_0x9f5f('0x0'));var util=require(_0x9f5f('0x1'));var path=require(_0x9f5f('0x2'));var timeout=require(_0x9f5f('0x3'));var express=require('express');var router=express[_0x9f5f('0x4')]();var fs_extra=require(_0x9f5f('0x5'));var auth=require(_0x9f5f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f5f('0x7'));router[_0x9f5f('0x8')]('/',auth['isAuthenticated'](),controller[_0x9f5f('0x9')]);router['get'](_0x9f5f('0xa'),auth[_0x9f5f('0xb')](),controller['describe']);router[_0x9f5f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9f5f('0xc')]);router[_0x9f5f('0xd')]('/',auth[_0x9f5f('0xb')](),controller[_0x9f5f('0xe')]);router[_0x9f5f('0xf')](_0x9f5f('0x10'),auth[_0x9f5f('0xb')](),controller[_0x9f5f('0x11')]);router[_0x9f5f('0x12')](_0x9f5f('0x10'),auth[_0x9f5f('0xb')](),controller[_0x9f5f('0x13')]);module[_0x9f5f('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 5a34785..c39a4a8 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 _0x00de=['sequelize','exports','STRING'];(function(_0x1b3f63,_0x5578c9){var _0x39005d=function(_0x3b99ff){while(--_0x3b99ff){_0x1b3f63['push'](_0x1b3f63['shift']());}};_0x39005d(++_0x5578c9);}(_0x00de,0x1c2));var _0xe00d=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x00de[_0x10dfdf];return _0x4d857d;};'use strict';var Sequelize=require(_0xe00d('0x0'));module[_0xe00d('0x1')]={'uniqueid':{'type':Sequelize[_0xe00d('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe00d('0x2')]}}; \ No newline at end of file +var _0x507a=['STRING','sequelize'];(function(_0x135c14,_0x41c790){var _0x19e640=function(_0x75c561){while(--_0x75c561){_0x135c14['push'](_0x135c14['shift']());}};_0x19e640(++_0x41c790);}(_0x507a,0x12f));var _0xa507=function(_0x372182,_0x43b53d){_0x372182=_0x372182-0x0;var _0x502cb8=_0x507a[_0x372182];return _0x502cb8;};'use strict';var Sequelize=require(_0xa507('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xa507('0x1')]},'application':{'type':Sequelize[_0xa507('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa507('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 389f8bb..f213b8f 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 _0x104c=['name','send','index','map','SquareDetailsReport','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','update','body','find','destroy','describe','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error'];(function(_0x2d981b,_0x1e00dc){var _0x9aa4fd=function(_0x7939b){while(--_0x7939b){_0x2d981b['push'](_0x2d981b['shift']());}};_0x9aa4fd(++_0x1e00dc);}(_0x104c,0x14d));var _0xc104=function(_0x274ae7,_0xe88de2){_0x274ae7=_0x274ae7-0x0;var _0x2ead35=_0x104c[_0x274ae7];return _0x2ead35;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc104('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc104('0x1'));var moment=require('moment');var BPromise=require(_0xc104('0x2'));var Mustache=require(_0xc104('0x3'));var util=require(_0xc104('0x4'));var path=require(_0xc104('0x5'));var sox=require(_0xc104('0x6'));var csv=require(_0xc104('0x7'));var ejs=require(_0xc104('0x8'));var fs=require('fs');var fs_extra=require(_0xc104('0x9'));var _=require(_0xc104('0xa'));var squel=require(_0xc104('0xb'));var crypto=require(_0xc104('0xc'));var jsforce=require(_0xc104('0xd'));var deskjs=require(_0xc104('0xe'));var toCsv=require(_0xc104('0x7'));var querystring=require(_0xc104('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc104('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc104('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc104('0x12'))(_0xc104('0x13'));var utils=require(_0xc104('0x14'));var config=require(_0xc104('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x65773b,_0x15ae1a){_0x15ae1a=_0x15ae1a||0xcc;return function(_0xfbd98c){if(_0xfbd98c){return _0x65773b[_0xc104('0x16')](_0x15ae1a);}return _0x65773b['status'](_0x15ae1a)[_0xc104('0x17')]();};}function respondWithResult(_0x339c0c,_0x1cb495){_0x1cb495=_0x1cb495||0xc8;return function(_0x3cf14a){if(_0x3cf14a){return _0x339c0c[_0xc104('0x18')](_0x1cb495)[_0xc104('0x19')](_0x3cf14a);}};}function respondWithFilteredResult(_0x4a6c23,_0x36f559){return function(_0x55d598){if(_0x55d598){var _0x38c055=typeof _0x36f559[_0xc104('0x1a')]===_0xc104('0x1b')&&typeof _0x36f559['limit']===_0xc104('0x1b');var _0x4db1a1=_0x55d598[_0xc104('0x1c')];var _0x425f8f=_0x38c055?0x0:_0x36f559[_0xc104('0x1a')];var _0x51aea5=_0x38c055?_0x55d598[_0xc104('0x1c')]:_0x36f559['offset']+_0x36f559[_0xc104('0x1d')];var _0x1b117d;if(_0x51aea5>=_0x4db1a1){_0x51aea5=_0x4db1a1;_0x1b117d=0xc8;}else{_0x1b117d=0xce;}_0x4a6c23[_0xc104('0x18')](_0x1b117d);return _0x4a6c23[_0xc104('0x1e')](_0xc104('0x1f'),_0x425f8f+'-'+_0x51aea5+'/'+_0x4db1a1)[_0xc104('0x19')](_0x55d598);}return null;};}function patchUpdates(_0x451fd5){return function(_0x6a2a7b){try{jsonpatch[_0xc104('0x20')](_0x6a2a7b,_0x451fd5,!![]);}catch(_0x4b4003){return BPromise[_0xc104('0x21')](_0x4b4003);}return _0x6a2a7b[_0xc104('0x22')]();};}function saveUpdates(_0x39682d,_0x29e264){return function(_0x4fcfb6){if(_0x4fcfb6){return _0x4fcfb6['update'](_0x39682d)[_0xc104('0x23')](function(_0x392633){return _0x392633;});}return null;};}function removeEntity(_0x28c450,_0x48b171){return function(_0x332b86){if(_0x332b86){return _0x332b86['destroy']()[_0xc104('0x23')](function(){_0x28c450[_0xc104('0x18')](0xcc)[_0xc104('0x17')]();});}};}function handleEntityNotFound(_0x428476,_0x426a14){return function(_0x17883b){if(!_0x17883b){_0x428476['sendStatus'](0x194);}return _0x17883b;};}function handleError(_0x41990f,_0x5faa4e){_0x5faa4e=_0x5faa4e||0x1f4;return function(_0x47b426){logger[_0xc104('0x24')](_0x47b426['stack']);if(_0x47b426[_0xc104('0x25')]){delete _0x47b426['name'];}_0x41990f['status'](_0x5faa4e)[_0xc104('0x26')](_0x47b426);};}exports[_0xc104('0x27')]=function(_0x49a627,_0x423054){var _0x414e2a={},_0x371bef={},_0x379ddc={'count':0x0,'rows':[]};var _0x220c2c=_[_0xc104('0x28')](db[_0xc104('0x29')][_0xc104('0x2a')],function(_0x46942b){return{'name':_0x46942b['fieldName'],'type':_0x46942b[_0xc104('0x2b')][_0xc104('0x2c')]};});_0x371bef['model']=_[_0xc104('0x28')](_0x220c2c,'name');_0x371bef[_0xc104('0x2d')]=_[_0xc104('0x2e')](_0x49a627[_0xc104('0x2d')]);_0x371bef['filters']=_[_0xc104('0x2f')](_0x371bef[_0xc104('0x30')],_0x371bef[_0xc104('0x2d')]);_0x414e2a['attributes']=_[_0xc104('0x2f')](_0x371bef['model'],qs[_0xc104('0x31')](_0x49a627[_0xc104('0x2d')][_0xc104('0x31')]));_0x414e2a[_0xc104('0x32')]=_0x414e2a[_0xc104('0x32')][_0xc104('0x33')]?_0x414e2a[_0xc104('0x32')]:_0x371bef[_0xc104('0x30')];if(!_0x49a627[_0xc104('0x2d')]['hasOwnProperty'](_0xc104('0x34'))){_0x414e2a[_0xc104('0x1d')]=qs[_0xc104('0x1d')](_0x49a627[_0xc104('0x2d')][_0xc104('0x1d')]);_0x414e2a[_0xc104('0x1a')]=qs[_0xc104('0x1a')](_0x49a627[_0xc104('0x2d')][_0xc104('0x1a')]);}_0x414e2a[_0xc104('0x35')]=qs[_0xc104('0x36')](_0x49a627[_0xc104('0x2d')]['sort']);_0x414e2a[_0xc104('0x37')]=qs[_0xc104('0x38')](_[_0xc104('0x39')](_0x49a627[_0xc104('0x2d')],_0x371bef[_0xc104('0x38')]),_0x220c2c);if(_0x49a627[_0xc104('0x2d')][_0xc104('0x3a')]){_0x414e2a[_0xc104('0x37')]=_[_0xc104('0x3b')](_0x414e2a[_0xc104('0x37')],{'$or':_[_0xc104('0x28')](_0x220c2c,function(_0x197e25){if(_0x197e25[_0xc104('0x2b')]!==_0xc104('0x3c')){var _0x1e06db={};_0x1e06db[_0x197e25['name']]={'$like':'%'+_0x49a627[_0xc104('0x2d')][_0xc104('0x3a')]+'%'};return _0x1e06db;}})});}_0x414e2a=_[_0xc104('0x3b')]({},_0x414e2a,_0x49a627[_0xc104('0x3d')]);var _0x4074ef={'where':_0x414e2a['where']};return db[_0xc104('0x29')][_0xc104('0x1c')](_0x4074ef)[_0xc104('0x23')](function(_0x5d6bb0){_0x379ddc[_0xc104('0x1c')]=_0x5d6bb0;if(_0x49a627[_0xc104('0x2d')][_0xc104('0x3e')]){_0x414e2a[_0xc104('0x3f')]=[{'all':!![]}];}return db[_0xc104('0x29')][_0xc104('0x40')](_0x414e2a);})[_0xc104('0x23')](function(_0x5893ad){_0x379ddc[_0xc104('0x41')]=_0x5893ad;return _0x379ddc;})[_0xc104('0x23')](respondWithFilteredResult(_0x423054,_0x414e2a))[_0xc104('0x42')](handleError(_0x423054,null));};exports['show']=function(_0x446c73,_0x25d95c){var _0xc9f4c1={'raw':!![],'where':{'id':_0x446c73[_0xc104('0x43')]['id']}},_0x3dd11f={};_0x3dd11f['model']=_['keys'](db[_0xc104('0x29')][_0xc104('0x2a')]);_0x3dd11f[_0xc104('0x2d')]=_[_0xc104('0x2e')](_0x446c73[_0xc104('0x2d')]);_0x3dd11f['filters']=_[_0xc104('0x2f')](_0x3dd11f[_0xc104('0x30')],_0x3dd11f[_0xc104('0x2d')]);_0xc9f4c1['attributes']=_['intersection'](_0x3dd11f[_0xc104('0x30')],qs[_0xc104('0x31')](_0x446c73['query']['fields']));_0xc9f4c1[_0xc104('0x32')]=_0xc9f4c1[_0xc104('0x32')][_0xc104('0x33')]?_0xc9f4c1[_0xc104('0x32')]:_0x3dd11f[_0xc104('0x30')];if(_0x446c73[_0xc104('0x2d')][_0xc104('0x3e')]){_0xc9f4c1[_0xc104('0x3f')]=[{'all':!![]}];}_0xc9f4c1=_['merge']({},_0xc9f4c1,_0x446c73[_0xc104('0x3d')]);return db['SquareDetailsReport']['find'](_0xc9f4c1)[_0xc104('0x23')](handleEntityNotFound(_0x25d95c,null))[_0xc104('0x23')](respondWithResult(_0x25d95c,null))[_0xc104('0x42')](handleError(_0x25d95c,null));};exports[_0xc104('0x44')]=function(_0x49e0f1,_0x321717){return db[_0xc104('0x29')]['create'](_0x49e0f1['body'],{})[_0xc104('0x23')](respondWithResult(_0x321717,0xc9))[_0xc104('0x42')](handleError(_0x321717,null));};exports[_0xc104('0x45')]=function(_0xa13b1,_0x281ed9){if(_0xa13b1[_0xc104('0x46')]['id']){delete _0xa13b1['body']['id'];}return db[_0xc104('0x29')][_0xc104('0x47')]({'where':{'id':_0xa13b1[_0xc104('0x43')]['id']}})[_0xc104('0x23')](handleEntityNotFound(_0x281ed9,null))[_0xc104('0x23')](saveUpdates(_0xa13b1[_0xc104('0x46')],null))['then'](respondWithResult(_0x281ed9,null))[_0xc104('0x42')](handleError(_0x281ed9,null));};exports[_0xc104('0x48')]=function(_0x290805,_0x3ef672){return db[_0xc104('0x29')][_0xc104('0x47')]({'where':{'id':_0x290805[_0xc104('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ef672,null))[_0xc104('0x23')](removeEntity(_0x3ef672,null))[_0xc104('0x42')](handleError(_0x3ef672,null));};exports[_0xc104('0x49')]=function(_0x1a8b34,_0x1ceb89){return db[_0xc104('0x29')][_0xc104('0x49')]()['then'](respondWithResult(_0x1ceb89,null))[_0xc104('0x42')](handleError(_0x1ceb89,null));}; \ No newline at end of file +var _0xc43c=['stack','name','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','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','count','offset','set','Content-Range','save','update','destroy','then','error'];(function(_0x573dbe,_0x5ceb0d){var _0x3e3a26=function(_0x5e9493){while(--_0x5e9493){_0x573dbe['push'](_0x573dbe['shift']());}};_0x3e3a26(++_0x5ceb0d);}(_0xc43c,0x153));var _0xcc43=function(_0x4d1c5f,_0x47d74d){_0x4d1c5f=_0x4d1c5f-0x0;var _0x972234=_0xc43c[_0x4d1c5f];return _0x972234;};'use strict';var emlformat=require(_0xcc43('0x0'));var rimraf=require(_0xcc43('0x1'));var zipdir=require(_0xcc43('0x2'));var jsonpatch=require(_0xcc43('0x3'));var rp=require(_0xcc43('0x4'));var moment=require(_0xcc43('0x5'));var BPromise=require(_0xcc43('0x6'));var Mustache=require(_0xcc43('0x7'));var util=require(_0xcc43('0x8'));var path=require(_0xcc43('0x9'));var sox=require(_0xcc43('0xa'));var csv=require(_0xcc43('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc43('0xc'));var _=require(_0xcc43('0xd'));var squel=require(_0xcc43('0xe'));var crypto=require(_0xcc43('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcc43('0xb'));var querystring=require('querystring');var Papa=require(_0xcc43('0x10'));var Redis=require(_0xcc43('0x11'));var authService=require(_0xcc43('0x12'));var qs=require(_0xcc43('0x13'));var as=require(_0xcc43('0x14'));var hardwareService=require(_0xcc43('0x15'));var logger=require(_0xcc43('0x16'))(_0xcc43('0x17'));var utils=require(_0xcc43('0x18'));var config=require(_0xcc43('0x19'));var licenseUtil=require(_0xcc43('0x1a'));var db=require(_0xcc43('0x1b'))['db'];function respondWithStatusCode(_0x439414,_0x126139){_0x126139=_0x126139||0xcc;return function(_0x5c4023){if(_0x5c4023){return _0x439414[_0xcc43('0x1c')](_0x126139);}return _0x439414[_0xcc43('0x1d')](_0x126139)[_0xcc43('0x1e')]();};}function respondWithResult(_0x4ad3ab,_0x293db5){_0x293db5=_0x293db5||0xc8;return function(_0x1accb6){if(_0x1accb6){return _0x4ad3ab[_0xcc43('0x1d')](_0x293db5)['json'](_0x1accb6);}};}function respondWithFilteredResult(_0x4d6665,_0x4172a1){return function(_0x507f3c){if(_0x507f3c){var _0x4da045=typeof _0x4172a1['offset']===_0xcc43('0x1f')&&typeof _0x4172a1['limit']==='undefined';var _0x311482=_0x507f3c[_0xcc43('0x20')];var _0x481a56=_0x4da045?0x0:_0x4172a1[_0xcc43('0x21')];var _0x287322=_0x4da045?_0x507f3c[_0xcc43('0x20')]:_0x4172a1['offset']+_0x4172a1['limit'];var _0x4fe64c;if(_0x287322>=_0x311482){_0x287322=_0x311482;_0x4fe64c=0xc8;}else{_0x4fe64c=0xce;}_0x4d6665[_0xcc43('0x1d')](_0x4fe64c);return _0x4d6665[_0xcc43('0x22')](_0xcc43('0x23'),_0x481a56+'-'+_0x287322+'/'+_0x311482)['json'](_0x507f3c);}return null;};}function patchUpdates(_0xabc9a1){return function(_0x284e15){try{jsonpatch['apply'](_0x284e15,_0xabc9a1,!![]);}catch(_0x315a48){return BPromise['reject'](_0x315a48);}return _0x284e15[_0xcc43('0x24')]();};}function saveUpdates(_0x6e3a60,_0x5a7bf5){return function(_0x20d544){if(_0x20d544){return _0x20d544[_0xcc43('0x25')](_0x6e3a60)['then'](function(_0x1f23aa){return _0x1f23aa;});}return null;};}function removeEntity(_0x37fa98,_0x45c6fe){return function(_0x240482){if(_0x240482){return _0x240482[_0xcc43('0x26')]()[_0xcc43('0x27')](function(){_0x37fa98['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41dbcd,_0x4787f8){return function(_0x580cfa){if(!_0x580cfa){_0x41dbcd['sendStatus'](0x194);}return _0x580cfa;};}function handleError(_0x50e69b,_0x48ab86){_0x48ab86=_0x48ab86||0x1f4;return function(_0x5c8cad){logger[_0xcc43('0x28')](_0x5c8cad[_0xcc43('0x29')]);if(_0x5c8cad[_0xcc43('0x2a')]){delete _0x5c8cad[_0xcc43('0x2a')];}_0x50e69b['status'](_0x48ab86)['send'](_0x5c8cad);};}exports[_0xcc43('0x2b')]=function(_0x272c4c,_0x1c61ea){var _0x23f78d={},_0x52e1c1={},_0x4ffa41={'count':0x0,'rows':[]};var _0x402409=_[_0xcc43('0x2c')](db[_0xcc43('0x2d')][_0xcc43('0x2e')],function(_0x2eb156){return{'name':_0x2eb156['fieldName'],'type':_0x2eb156[_0xcc43('0x2f')][_0xcc43('0x30')]};});_0x52e1c1[_0xcc43('0x31')]=_[_0xcc43('0x2c')](_0x402409,'name');_0x52e1c1[_0xcc43('0x32')]=_[_0xcc43('0x33')](_0x272c4c[_0xcc43('0x32')]);_0x52e1c1['filters']=_['intersection'](_0x52e1c1[_0xcc43('0x31')],_0x52e1c1[_0xcc43('0x32')]);_0x23f78d['attributes']=_[_0xcc43('0x34')](_0x52e1c1['model'],qs[_0xcc43('0x35')](_0x272c4c[_0xcc43('0x32')][_0xcc43('0x35')]));_0x23f78d[_0xcc43('0x36')]=_0x23f78d['attributes'][_0xcc43('0x37')]?_0x23f78d[_0xcc43('0x36')]:_0x52e1c1[_0xcc43('0x31')];if(!_0x272c4c['query'][_0xcc43('0x38')](_0xcc43('0x39'))){_0x23f78d[_0xcc43('0x3a')]=qs[_0xcc43('0x3a')](_0x272c4c[_0xcc43('0x32')][_0xcc43('0x3a')]);_0x23f78d[_0xcc43('0x21')]=qs['offset'](_0x272c4c['query'][_0xcc43('0x21')]);}_0x23f78d[_0xcc43('0x3b')]=qs[_0xcc43('0x3c')](_0x272c4c[_0xcc43('0x32')][_0xcc43('0x3c')]);_0x23f78d[_0xcc43('0x3d')]=qs[_0xcc43('0x3e')](_[_0xcc43('0x3f')](_0x272c4c[_0xcc43('0x32')],_0x52e1c1['filters']),_0x402409);if(_0x272c4c[_0xcc43('0x32')]['filter']){_0x23f78d['where']=_['merge'](_0x23f78d[_0xcc43('0x3d')],{'$or':_[_0xcc43('0x2c')](_0x402409,function(_0x4ddcd6){if(_0x4ddcd6['type']!=='VIRTUAL'){var _0x480d6c={};_0x480d6c[_0x4ddcd6[_0xcc43('0x2a')]]={'$like':'%'+_0x272c4c[_0xcc43('0x32')]['filter']+'%'};return _0x480d6c;}})});}_0x23f78d=_[_0xcc43('0x40')]({},_0x23f78d,_0x272c4c[_0xcc43('0x41')]);var _0x44fcd1={'where':_0x23f78d[_0xcc43('0x3d')]};return db['SquareDetailsReport']['count'](_0x44fcd1)[_0xcc43('0x27')](function(_0x1413fd){_0x4ffa41[_0xcc43('0x20')]=_0x1413fd;if(_0x272c4c['query'][_0xcc43('0x42')]){_0x23f78d['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xcc43('0x43')](_0x23f78d);})[_0xcc43('0x27')](function(_0x16c65d){_0x4ffa41[_0xcc43('0x44')]=_0x16c65d;return _0x4ffa41;})[_0xcc43('0x27')](respondWithFilteredResult(_0x1c61ea,_0x23f78d))[_0xcc43('0x45')](handleError(_0x1c61ea,null));};exports[_0xcc43('0x46')]=function(_0x729342,_0x52f01f){var _0x2aa12e={'raw':!![],'where':{'id':_0x729342[_0xcc43('0x47')]['id']}},_0x48b94f={};_0x48b94f[_0xcc43('0x31')]=_[_0xcc43('0x33')](db[_0xcc43('0x2d')][_0xcc43('0x2e')]);_0x48b94f[_0xcc43('0x32')]=_['keys'](_0x729342['query']);_0x48b94f['filters']=_[_0xcc43('0x34')](_0x48b94f['model'],_0x48b94f[_0xcc43('0x32')]);_0x2aa12e[_0xcc43('0x36')]=_[_0xcc43('0x34')](_0x48b94f[_0xcc43('0x31')],qs[_0xcc43('0x35')](_0x729342[_0xcc43('0x32')][_0xcc43('0x35')]));_0x2aa12e[_0xcc43('0x36')]=_0x2aa12e[_0xcc43('0x36')][_0xcc43('0x37')]?_0x2aa12e[_0xcc43('0x36')]:_0x48b94f[_0xcc43('0x31')];if(_0x729342['query'][_0xcc43('0x42')]){_0x2aa12e[_0xcc43('0x48')]=[{'all':!![]}];}_0x2aa12e=_['merge']({},_0x2aa12e,_0x729342[_0xcc43('0x41')]);return db[_0xcc43('0x2d')][_0xcc43('0x49')](_0x2aa12e)[_0xcc43('0x27')](handleEntityNotFound(_0x52f01f,null))['then'](respondWithResult(_0x52f01f,null))[_0xcc43('0x45')](handleError(_0x52f01f,null));};exports['create']=function(_0x427785,_0x3beb36){return db[_0xcc43('0x2d')]['create'](_0x427785[_0xcc43('0x4a')],{})['then'](respondWithResult(_0x3beb36,0xc9))[_0xcc43('0x45')](handleError(_0x3beb36,null));};exports['update']=function(_0x340df6,_0x2f5182){if(_0x340df6[_0xcc43('0x4a')]['id']){delete _0x340df6[_0xcc43('0x4a')]['id'];}return db[_0xcc43('0x2d')]['find']({'where':{'id':_0x340df6[_0xcc43('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f5182,null))[_0xcc43('0x27')](saveUpdates(_0x340df6[_0xcc43('0x4a')],null))['then'](respondWithResult(_0x2f5182,null))['catch'](handleError(_0x2f5182,null));};exports[_0xcc43('0x26')]=function(_0x171eed,_0x163ed8){return db[_0xcc43('0x2d')]['find']({'where':{'id':_0x171eed['params']['id']}})[_0xcc43('0x27')](handleEntityNotFound(_0x163ed8,null))[_0xcc43('0x27')](removeEntity(_0x163ed8,null))[_0xcc43('0x45')](handleError(_0x163ed8,null));};exports[_0xcc43('0x4b')]=function(_0x7d6866,_0x73fd1d){return db[_0xcc43('0x2d')][_0xcc43('0x4b')]()[_0xcc43('0x27')](respondWithResult(_0x73fd1d,null))[_0xcc43('0x45')](handleError(_0x73fd1d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 8c7bcdf..b5c6173 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 _0xfb98=['api','request-promise','path','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x819be0,_0x484b20){var _0x3ef50f=function(_0xdd72c9){while(--_0xdd72c9){_0x819be0['push'](_0x819be0['shift']());}};_0x3ef50f(++_0x484b20);}(_0xfb98,0x1cb));var _0x8fb9=function(_0x35020f,_0x537aaf){_0x35020f=_0x35020f-0x0;var _0x38f017=_0xfb98[_0x35020f];return _0x38f017;};'use strict';var _=require(_0x8fb9('0x0'));var util=require(_0x8fb9('0x1'));var logger=require(_0x8fb9('0x2'))(_0x8fb9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8fb9('0x4'));var fs=require('fs');var path=require(_0x8fb9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8fb9('0x6'));module[_0x8fb9('0x7')]=function(_0x14258f,_0x546c6b){return _0x14258f[_0x8fb9('0x8')](_0x8fb9('0x9'),attributes,{'tableName':_0x8fb9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1b7=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb1b7,0x84));var _0x7b1b=function(_0x492991,_0x3a73a1){_0x492991=_0x492991-0x0;var _0x39fb28=_0xb1b7[_0x492991];return _0x39fb28;};'use strict';var _=require(_0x7b1b('0x0'));var util=require('util');var logger=require(_0x7b1b('0x1'))(_0x7b1b('0x2'));var moment=require(_0x7b1b('0x3'));var BPromise=require(_0x7b1b('0x4'));var rp=require(_0x7b1b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b1b('0x6'));var config=require(_0x7b1b('0x7'));var attributes=require(_0x7b1b('0x8'));module[_0x7b1b('0x9')]=function(_0x460083,_0x2faa9e){return _0x460083[_0x7b1b('0xa')](_0x7b1b('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index eb42978..5b2492f 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 _0x94d2=['stringify','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x94d2,0x1cd));var _0x294d=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x94d2[_0x1ebe90];return _0x447c82;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x294d('0x0'));var BPromise=require(_0x294d('0x1'));var rs=require(_0x294d('0x2'));var fs=require('fs');var Redis=require(_0x294d('0x3'));var db=require(_0x294d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x294d('0x5'));var config=require(_0x294d('0x6'));var jayson=require(_0x294d('0x7'));var client=jayson[_0x294d('0x8')][_0x294d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e023f,_0x5c3d7c,_0x2cf111){return new BPromise(function(_0x6653fc,_0x1cd249){return client[_0x294d('0xa')](_0x5e023f,_0x2cf111)[_0x294d('0xb')](function(_0x49923f){logger[_0x294d('0xc')](_0x294d('0xd'),_0x5c3d7c,'request\x20sent');logger[_0x294d('0xe')](_0x294d('0xf'),_0x5c3d7c,'request\x20sent',JSON['stringify'](_0x49923f));if(_0x49923f[_0x294d('0x10')]){if(_0x49923f[_0x294d('0x10')][_0x294d('0x11')]===0x1f4){logger['error'](_0x294d('0xd'),_0x5c3d7c,_0x49923f[_0x294d('0x10')][_0x294d('0x12')]);return _0x1cd249(_0x49923f[_0x294d('0x10')]['message']);}logger[_0x294d('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c3d7c,_0x49923f['error'][_0x294d('0x12')]);return _0x6653fc(_0x49923f[_0x294d('0x10')][_0x294d('0x12')]);}else{logger[_0x294d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c3d7c,_0x294d('0x13'));_0x6653fc(_0x49923f['result']['message']);}})['catch'](function(_0x4f2436){logger[_0x294d('0x10')](_0x294d('0xd'),_0x5c3d7c,_0x4f2436);_0x1cd249(_0x4f2436);});});}exports[_0x294d('0x14')]=function(_0x46d9c5){var _0x17156c=this;return new Promise(function(_0x26563e,_0x199a1a){return db[_0x294d('0x15')]['create'](_0x46d9c5[_0x294d('0x16')],{'raw':_0x46d9c5[_0x294d('0x17')]?_0x46d9c5['options'][_0x294d('0x18')]===undefined?!![]:![]:!![]})[_0x294d('0xb')](function(_0x429da3){logger[_0x294d('0xc')](_0x294d('0x14'),_0x46d9c5);logger[_0x294d('0xe')](_0x294d('0x14'),_0x46d9c5,JSON[_0x294d('0x19')](_0x429da3));_0x26563e(_0x429da3);})[_0x294d('0x1a')](function(_0x11df11){logger[_0x294d('0x10')](_0x294d('0x14'),_0x11df11[_0x294d('0x12')],_0x46d9c5);_0x199a1a(_0x17156c[_0x294d('0x10')](0x1f4,_0x11df11[_0x294d('0x12')]));});});}; \ No newline at end of file +var _0x174b=['info','request\x20sent','debug','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x516510,_0x48f18a){var _0x5c5246=function(_0x3ea365){while(--_0x3ea365){_0x516510['push'](_0x516510['shift']());}};_0x5c5246(++_0x48f18a);}(_0x174b,0x19d));var _0xb174=function(_0x528d99,_0xaced6b){_0x528d99=_0x528d99-0x0;var _0x39c853=_0x174b[_0x528d99];return _0x39c853;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7a36,_0xa073f6,_0x1e3e13){return new BPromise(function(_0x465cd6,_0x149942){return client[_0xb174('0xa')](_0x3e7a36,_0x1e3e13)[_0xb174('0xb')](function(_0x4c3cea){logger[_0xb174('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'));logger[_0xb174('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'),JSON['stringify'](_0x4c3cea));if(_0x4c3cea[_0xb174('0xf')]){if(_0x4c3cea[_0xb174('0xf')]['code']===0x1f4){logger[_0xb174('0xf')](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x149942(_0x4c3cea['error'][_0xb174('0x11')]);}logger['error'](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x465cd6(_0x4c3cea[_0xb174('0xf')]['message']);}else{logger[_0xb174('0xc')](_0xb174('0x10'),_0xa073f6,_0xb174('0xd'));_0x465cd6(_0x4c3cea[_0xb174('0x12')][_0xb174('0x11')]);}})[_0xb174('0x13')](function(_0x5d31ac){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xa073f6,_0x5d31ac);_0x149942(_0x5d31ac);});});}exports['CreateSquareDetailsReport']=function(_0x2ab4dc){var _0x4fb4eb=this;return new Promise(function(_0xaf80a9,_0x1a6f40){return db['SquareDetailsReport'][_0xb174('0x14')](_0x2ab4dc[_0xb174('0x15')],{'raw':_0x2ab4dc[_0xb174('0x16')]?_0x2ab4dc[_0xb174('0x16')][_0xb174('0x17')]===undefined?!![]:![]:!![]})[_0xb174('0xb')](function(_0xcc8d9a){logger['info'](_0xb174('0x18'),_0x2ab4dc);logger[_0xb174('0xe')]('CreateSquareDetailsReport',_0x2ab4dc,JSON['stringify'](_0xcc8d9a));_0xaf80a9(_0xcc8d9a);})['catch'](function(_0x338dc4){logger[_0xb174('0xf')](_0xb174('0x18'),_0x338dc4['message'],_0x2ab4dc);_0x1a6f40(_0x4fb4eb[_0xb174('0xf')](0x1f4,_0x338dc4[_0xb174('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index fb3eb5e..4c7b99d 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 _0xe5a0=['express','Router','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports'];(function(_0x472ee7,_0x302242){var _0x6aa3f3=function(_0x43beda){while(--_0x43beda){_0x472ee7['push'](_0x472ee7['shift']());}};_0x6aa3f3(++_0x302242);}(_0xe5a0,0x1a8));var _0x0e5a=function(_0x1632f5,_0x30b47c){_0x1632f5=_0x1632f5-0x0;var _0x3f6692=_0xe5a0[_0x1632f5];return _0x3f6692;};'use strict';var express=require(_0x0e5a('0x0'));var router=express[_0x0e5a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x0e5a('0x2'));router[_0x0e5a('0x3')]('/',auth[_0x0e5a('0x4')](),controller['index']);router[_0x0e5a('0x3')](_0x0e5a('0x5'),auth[_0x0e5a('0x4')](),controller[_0x0e5a('0x6')]);module[_0x0e5a('0x7')]=router; \ No newline at end of file +var _0x6fb9=['./system.controller','isAuthenticated','index','killProcess','express','Router','../../components/auth/service'];(function(_0xcf9fb8,_0x4c80f3){var _0x545753=function(_0x1602d7){while(--_0x1602d7){_0xcf9fb8['push'](_0xcf9fb8['shift']());}};_0x545753(++_0x4c80f3);}(_0x6fb9,0x1a8));var _0x96fb=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0x6fb9[_0x252328];return _0xaa85b7;};'use strict';var express=require(_0x96fb('0x0'));var router=express[_0x96fb('0x1')]();var auth=require(_0x96fb('0x2'));var controller=require(_0x96fb('0x3'));router['get']('/',auth[_0x96fb('0x4')](),controller[_0x96fb('0x5')]);router['get']('/process/:pid/kill',auth[_0x96fb('0x4')](),controller[_0x96fb('0x6')]);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 c52ac96..33d70a1 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 _0x292c=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','pid','systeminformation','exec','../../config/logger','api','util','bluebird'];(function(_0x3bcc08,_0x16681b){var _0x23fdd5=function(_0x13c27d){while(--_0x13c27d){_0x3bcc08['push'](_0x3bcc08['shift']());}};_0x23fdd5(++_0x16681b);}(_0x292c,0x66));var _0xc292=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x292c[_0x37a7c6];return _0x539905;};'use strict';var info=require(_0xc292('0x0'));var exec=require('child_process')[_0xc292('0x1')];var logger=require(_0xc292('0x2'))(_0xc292('0x3'));var util=require(_0xc292('0x4'));var BPromise=require(_0xc292('0x5'));var _=require('lodash');function handleError(_0x1f14f9,_0x536154,_0x516f54){_0x536154=_0x536154||0x1f4;return function(_0x23c98f){logger[_0xc292('0x6')](_0xc292('0x7'),_0x516f54,_0x536154,util[_0xc292('0x8')](_0x23c98f,{'showHidden':![],'depth':null}));delete _0x23c98f[_0xc292('0x9')];_0x1f14f9[_0xc292('0xa')](_0x536154)[_0xc292('0xb')](_0x23c98f);};}exports[_0xc292('0xc')]=function(_0x162e17,_0x43fd69){return info['getAllData']()[_0xc292('0xd')](function(_0x659c9a){return _0x43fd69[_0xc292('0xa')](0xc8)[_0xc292('0xe')](_0x659c9a);})[_0xc292('0xf')](function(_0x51fff4){return _0x43fd69[_0xc292('0xa')](0x1f4)[_0xc292('0xe')](_0x51fff4);});};exports[_0xc292('0x10')]=function(_0xee5033,_0x1c6488){var _0x3ead77=['components/import/cm'];return new BPromise(function(_0x891862,_0x3e12ad){return exec(util[_0xc292('0x11')](_0xc292('0x12'),_0xee5033[_0xc292('0x13')]['pid']),function(_0x56417e,_0x402c9b,_0x3d03b6){if(_0x56417e){return _0x3e12ad(_0x56417e);}return _0x891862(_0x402c9b);});})['then'](function(_0x290138){var _0x53a23e=![];var _0x5e765a=_0x290138[_0xc292('0x14')](/\n/);for(var _0x5bde28=0x0,_0x156747=_0x3ead77[_0xc292('0x15')];_0x5bde28<_0x156747,_0x53a23e===![];_0x5bde28+=0x1){if(_0x290138[_0xc292('0x16')](_0x3ead77[_0x5bde28])>=0x0){_0x53a23e=!![];}}if(!_0x53a23e){throw new Error(util['format'](_0xc292('0x17'),_0xee5033['params']['pid']));}process[_0xc292('0x18')](_0xee5033[_0xc292('0x13')]['pid'],_0xc292('0x19'));return _0x1c6488[_0xc292('0xa')](0xc8)[_0xc292('0xe')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0xee5033[_0xc292('0x13')][_0xc292('0x1a')])});})[_0xc292('0xf')](handleError(_0x1c6488,null,_0xc292('0x10')));}; \ No newline at end of file +var _0x64d1=['length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','systeminformation','child_process','../../config/logger','api','util','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','getAllData','status','json','catch','killProcess','format','params','pid','split'];(function(_0x3766be,_0x2924c9){var _0xcf86fc=function(_0x4abac8){while(--_0x4abac8){_0x3766be['push'](_0x3766be['shift']());}};_0xcf86fc(++_0x2924c9);}(_0x64d1,0x17a));var _0x164d=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x64d1[_0xda464c];return _0x19e222;};'use strict';var info=require(_0x164d('0x0'));var exec=require(_0x164d('0x1'))['exec'];var logger=require(_0x164d('0x2'))(_0x164d('0x3'));var util=require(_0x164d('0x4'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x171ed9,_0x4bacda,_0x272bf0){_0x4bacda=_0x4bacda||0x1f4;return function(_0x4136dd){logger['error'](_0x164d('0x5'),_0x272bf0,_0x4bacda,util[_0x164d('0x6')](_0x4136dd,{'showHidden':![],'depth':null}));delete _0x4136dd[_0x164d('0x7')];_0x171ed9['status'](_0x4bacda)[_0x164d('0x8')](_0x4136dd);};}exports['index']=function(_0x3fecc7,_0x9926a7){return info[_0x164d('0x9')]()['then'](function(_0x47d0ea){return _0x9926a7[_0x164d('0xa')](0xc8)[_0x164d('0xb')](_0x47d0ea);})[_0x164d('0xc')](function(_0x2bf2d9){return _0x9926a7[_0x164d('0xa')](0x1f4)['json'](_0x2bf2d9);});};exports[_0x164d('0xd')]=function(_0x567c7c,_0x1f72df){var _0x15ef73=['components/import/cm'];return new BPromise(function(_0x47a8e7,_0x3fdfe8){return exec(util[_0x164d('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x567c7c[_0x164d('0xf')][_0x164d('0x10')]),function(_0x1980b8,_0x45738d,_0x15b0e0){if(_0x1980b8){return _0x3fdfe8(_0x1980b8);}return _0x47a8e7(_0x45738d);});})['then'](function(_0x5a9054){var _0x2be93c=![];var _0x1a0ba8=_0x5a9054[_0x164d('0x11')](/\n/);for(var _0x1f36d0=0x0,_0x4398d2=_0x15ef73[_0x164d('0x12')];_0x1f36d0<_0x4398d2,_0x2be93c===![];_0x1f36d0+=0x1){if(_0x5a9054[_0x164d('0x13')](_0x15ef73[_0x1f36d0])>=0x0){_0x2be93c=!![];}}if(!_0x2be93c){throw new Error(util[_0x164d('0xe')](_0x164d('0x14'),_0x567c7c[_0x164d('0xf')][_0x164d('0x10')]));}process[_0x164d('0x15')](_0x567c7c[_0x164d('0xf')][_0x164d('0x10')],'SIGINT');return _0x1f72df[_0x164d('0xa')](0xc8)[_0x164d('0xb')]({'message':util[_0x164d('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x567c7c[_0x164d('0xf')][_0x164d('0x10')])});})[_0x164d('0xc')](handleError(_0x1f72df,null,_0x164d('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b2a5637..f0e6a83 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 _0x06fb=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x59cc48,_0x4df265){var _0x1ebc97=function(_0x473b8a){while(--_0x473b8a){_0x59cc48['push'](_0x59cc48['shift']());}};_0x1ebc97(++_0x4df265);}(_0x06fb,0x1ad));var _0xb06f=function(_0x18f1e6,_0x521510){_0x18f1e6=_0x18f1e6-0x0;var _0x5dcd46=_0x06fb[_0x18f1e6];return _0x5dcd46;};'use strict';var multer=require(_0xb06f('0x0'));var util=require(_0xb06f('0x1'));var path=require(_0xb06f('0x2'));var timeout=require(_0xb06f('0x3'));var express=require(_0xb06f('0x4'));var router=express[_0xb06f('0x5')]();var fs_extra=require(_0xb06f('0x6'));var auth=require(_0xb06f('0x7'));var interaction=require(_0xb06f('0x8'));var config=require(_0xb06f('0x9'));var controller=require('./tag.controller');router[_0xb06f('0xa')]('/',auth[_0xb06f('0xb')](),controller[_0xb06f('0xc')]);router['get'](_0xb06f('0xd'),auth[_0xb06f('0xb')](),controller['show']);router[_0xb06f('0xe')]('/',auth[_0xb06f('0xb')](),controller[_0xb06f('0xf')]);router[_0xb06f('0x10')](_0xb06f('0xd'),auth[_0xb06f('0xb')](),controller[_0xb06f('0x11')]);router['delete'](_0xb06f('0xd'),auth[_0xb06f('0xb')](),controller[_0xb06f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe5a9=['Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x1edf9f,_0x5b2d5d){var _0x42bac6=function(_0x7338b2){while(--_0x7338b2){_0x1edf9f['push'](_0x1edf9f['shift']());}};_0x42bac6(++_0x5b2d5d);}(_0xe5a9,0x9e));var _0x9e5a=function(_0x16c467,_0x53d6fa){_0x16c467=_0x16c467-0x0;var _0x22db4f=_0xe5a9[_0x16c467];return _0x22db4f;};'use strict';var multer=require('multer');var util=require(_0x9e5a('0x0'));var path=require(_0x9e5a('0x1'));var timeout=require(_0x9e5a('0x2'));var express=require(_0x9e5a('0x3'));var router=express[_0x9e5a('0x4')]();var fs_extra=require(_0x9e5a('0x5'));var auth=require(_0x9e5a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e5a('0x7'));var controller=require(_0x9e5a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9e5a('0x9')](_0x9e5a('0xa'),auth[_0x9e5a('0xb')](),controller['show']);router[_0x9e5a('0xc')]('/',auth[_0x9e5a('0xb')](),controller[_0x9e5a('0xd')]);router[_0x9e5a('0xe')]('/:id',auth[_0x9e5a('0xb')](),controller[_0x9e5a('0xf')]);router[_0x9e5a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9e5a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index c70243e..53921fd 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 _0x6629=['STRING','#0091EA','sequelize','name'];(function(_0x25129a,_0x5496fb){var _0x8e07bd=function(_0x111b0b){while(--_0x111b0b){_0x25129a['push'](_0x25129a['shift']());}};_0x8e07bd(++_0x5496fb);}(_0x6629,0x1c2));var _0x9662=function(_0x5672b3,_0x2889bf){_0x5672b3=_0x5672b3-0x0;var _0x169888=_0x6629[_0x5672b3];return _0x169888;};'use strict';var Sequelize=require(_0x9662('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9662('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9662('0x2')],'defaultValue':_0x9662('0x3')},'description':{'type':Sequelize[_0x9662('0x2')]}}; \ No newline at end of file +var _0xb921=['STRING','name','sequelize','exports'];(function(_0x761d8e,_0x43c831){var _0x27dfe3=function(_0xa6ac3f){while(--_0xa6ac3f){_0x761d8e['push'](_0x761d8e['shift']());}};_0x27dfe3(++_0x43c831);}(_0xb921,0x16a));var _0x1b92=function(_0x211f66,_0x6d409f){_0x211f66=_0x211f66-0x0;var _0x324240=_0xb921[_0x211f66];return _0x324240;};'use strict';var Sequelize=require(_0x1b92('0x0'));module[_0x1b92('0x1')]={'name':{'type':Sequelize[_0x1b92('0x2')],'unique':_0x1b92('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x1b92('0x2')],'defaultValue':'#0091EA'},'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 f346136..4dde78f 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 _0xe812=['userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','Tags','UserProfileResource','destroy','name','send','index','Tag','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe812,0x1f2));var _0x2e81=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe812[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e81('0x0'));var zipdir=require(_0x2e81('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e81('0x2'));var BPromise=require(_0x2e81('0x3'));var Mustache=require('mustache');var util=require(_0x2e81('0x4'));var path=require(_0x2e81('0x5'));var sox=require('sox');var csv=require(_0x2e81('0x6'));var ejs=require(_0x2e81('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e81('0x8'));var squel=require(_0x2e81('0x9'));var crypto=require(_0x2e81('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2e81('0xb'));var toCsv=require(_0x2e81('0x6'));var querystring=require(_0x2e81('0xc'));var Papa=require(_0x2e81('0xd'));var Redis=require('ioredis');var authService=require(_0x2e81('0xe'));var qs=require(_0x2e81('0xf'));var as=require(_0x2e81('0x10'));var hardwareService=require(_0x2e81('0x11'));var logger=require(_0x2e81('0x12'))(_0x2e81('0x13'));var utils=require(_0x2e81('0x14'));var config=require(_0x2e81('0x15'));var licenseUtil=require(_0x2e81('0x16'));var db=require(_0x2e81('0x17'))['db'];function respondWithStatusCode(_0x4284f3,_0x5c58a2){_0x5c58a2=_0x5c58a2||0xcc;return function(_0x30a730){if(_0x30a730){return _0x4284f3[_0x2e81('0x18')](_0x5c58a2);}return _0x4284f3['status'](_0x5c58a2)[_0x2e81('0x19')]();};}function respondWithResult(_0x5598a9,_0x2a4411){_0x2a4411=_0x2a4411||0xc8;return function(_0x2b24f0){if(_0x2b24f0){return _0x5598a9[_0x2e81('0x1a')](_0x2a4411)[_0x2e81('0x1b')](_0x2b24f0);}};}function respondWithFilteredResult(_0x1bb937,_0x3a8c05){return function(_0x53da62){if(_0x53da62){var _0xc4d315=typeof _0x3a8c05[_0x2e81('0x1c')]==='undefined'&&typeof _0x3a8c05[_0x2e81('0x1d')]==='undefined';var _0x2cc0c6=_0x53da62[_0x2e81('0x1e')];var _0x4c1b11=_0xc4d315?0x0:_0x3a8c05[_0x2e81('0x1c')];var _0x2bb9b6=_0xc4d315?_0x53da62[_0x2e81('0x1e')]:_0x3a8c05[_0x2e81('0x1c')]+_0x3a8c05[_0x2e81('0x1d')];var _0x1f20bf;if(_0x2bb9b6>=_0x2cc0c6){_0x2bb9b6=_0x2cc0c6;_0x1f20bf=0xc8;}else{_0x1f20bf=0xce;}_0x1bb937[_0x2e81('0x1a')](_0x1f20bf);return _0x1bb937[_0x2e81('0x1f')](_0x2e81('0x20'),_0x4c1b11+'-'+_0x2bb9b6+'/'+_0x2cc0c6)[_0x2e81('0x1b')](_0x53da62);}return null;};}function patchUpdates(_0x524694){return function(_0x10b77e){try{jsonpatch[_0x2e81('0x21')](_0x10b77e,_0x524694,!![]);}catch(_0x9ddf6b){return BPromise[_0x2e81('0x22')](_0x9ddf6b);}return _0x10b77e[_0x2e81('0x23')]();};}function saveUpdates(_0x386721,_0x18b9be){return function(_0x39ffa8){if(_0x39ffa8){return _0x39ffa8['update'](_0x386721)[_0x2e81('0x24')](function(_0x49e9f1){return _0x49e9f1;});}return null;};}function removeEntity(_0x2d50af,_0x4fe130){return function(_0x1d09cb){if(_0x1d09cb){return _0x1d09cb['destroy']()['then'](function(){var _0x123d3d=_0x1d09cb[_0x2e81('0x25')]({'plain':!![]});var _0x4a75ff=_0x2e81('0x26');return db[_0x2e81('0x27')][_0x2e81('0x28')]({'where':{'type':_0x4a75ff,'resourceId':_0x123d3d['id']}})[_0x2e81('0x24')](function(){return _0x1d09cb;});})[_0x2e81('0x24')](function(){_0x2d50af[_0x2e81('0x1a')](0xcc)[_0x2e81('0x19')]();});}};}function handleEntityNotFound(_0x4669aa,_0x1b34db){return function(_0x1bf5a6){if(!_0x1bf5a6){_0x4669aa[_0x2e81('0x18')](0x194);}return _0x1bf5a6;};}function handleError(_0xc0720f,_0x8edf9c){_0x8edf9c=_0x8edf9c||0x1f4;return function(_0x3ec91d){logger['error'](_0x3ec91d['stack']);if(_0x3ec91d[_0x2e81('0x29')]){delete _0x3ec91d[_0x2e81('0x29')];}_0xc0720f[_0x2e81('0x1a')](_0x8edf9c)[_0x2e81('0x2a')](_0x3ec91d);};}exports[_0x2e81('0x2b')]=function(_0x2a78bb,_0x243b20){var _0x13612b={},_0x26ec2a={},_0x1c37d1={'count':0x0,'rows':[]};var _0x392c5b=_['map'](db[_0x2e81('0x2c')][_0x2e81('0x2d')],function(_0x1d0437){return{'name':_0x1d0437[_0x2e81('0x2e')],'type':_0x1d0437[_0x2e81('0x2f')][_0x2e81('0x30')]};});_0x26ec2a[_0x2e81('0x31')]=_[_0x2e81('0x32')](_0x392c5b,_0x2e81('0x29'));_0x26ec2a[_0x2e81('0x33')]=_[_0x2e81('0x34')](_0x2a78bb[_0x2e81('0x33')]);_0x26ec2a[_0x2e81('0x35')]=_[_0x2e81('0x36')](_0x26ec2a[_0x2e81('0x31')],_0x26ec2a[_0x2e81('0x33')]);_0x13612b[_0x2e81('0x37')]=_['intersection'](_0x26ec2a[_0x2e81('0x31')],qs[_0x2e81('0x38')](_0x2a78bb['query'][_0x2e81('0x38')]));_0x13612b[_0x2e81('0x37')]=_0x13612b['attributes'][_0x2e81('0x39')]?_0x13612b[_0x2e81('0x37')]:_0x26ec2a[_0x2e81('0x31')];if(!_0x2a78bb['query'][_0x2e81('0x3a')](_0x2e81('0x3b'))){_0x13612b[_0x2e81('0x1d')]=qs[_0x2e81('0x1d')](_0x2a78bb[_0x2e81('0x33')]['limit']);_0x13612b['offset']=qs['offset'](_0x2a78bb['query'][_0x2e81('0x1c')]);}_0x13612b['order']=qs['sort'](_0x2a78bb[_0x2e81('0x33')][_0x2e81('0x3c')]);_0x13612b[_0x2e81('0x3d')]=qs['filters'](_[_0x2e81('0x3e')](_0x2a78bb[_0x2e81('0x33')],_0x26ec2a[_0x2e81('0x35')]),_0x392c5b);if(_0x2a78bb[_0x2e81('0x33')][_0x2e81('0x3f')]){_0x13612b['where']=_['merge'](_0x13612b[_0x2e81('0x3d')],{'$or':_[_0x2e81('0x32')](_0x392c5b,function(_0x35d1c0){if(_0x35d1c0['type']!==_0x2e81('0x40')){var _0x44d10c={};_0x44d10c[_0x35d1c0[_0x2e81('0x29')]]={'$like':'%'+_0x2a78bb['query'][_0x2e81('0x3f')]+'%'};return _0x44d10c;}})});}_0x13612b=_[_0x2e81('0x41')]({},_0x13612b,_0x2a78bb[_0x2e81('0x42')]);var _0x10e240={'where':_0x13612b[_0x2e81('0x3d')]};return db[_0x2e81('0x2c')][_0x2e81('0x1e')](_0x10e240)[_0x2e81('0x24')](function(_0x5508f0){_0x1c37d1['count']=_0x5508f0;if(_0x2a78bb[_0x2e81('0x33')]['includeAll']){_0x13612b[_0x2e81('0x43')]=[{'all':!![]}];}return db[_0x2e81('0x2c')][_0x2e81('0x44')](_0x13612b);})[_0x2e81('0x24')](function(_0x3c5fbb){_0x1c37d1[_0x2e81('0x45')]=_0x3c5fbb;return _0x1c37d1;})['then'](respondWithFilteredResult(_0x243b20,_0x13612b))['catch'](handleError(_0x243b20,null));};exports[_0x2e81('0x46')]=function(_0x2bc2a7,_0x1a8233){var _0x53bb7c={'raw':!![],'where':{'id':_0x2bc2a7[_0x2e81('0x47')]['id']}},_0x4499b7={};_0x4499b7['model']=_[_0x2e81('0x34')](db['Tag'][_0x2e81('0x2d')]);_0x4499b7[_0x2e81('0x33')]=_[_0x2e81('0x34')](_0x2bc2a7[_0x2e81('0x33')]);_0x4499b7['filters']=_[_0x2e81('0x36')](_0x4499b7['model'],_0x4499b7[_0x2e81('0x33')]);_0x53bb7c[_0x2e81('0x37')]=_['intersection'](_0x4499b7[_0x2e81('0x31')],qs[_0x2e81('0x38')](_0x2bc2a7[_0x2e81('0x33')][_0x2e81('0x38')]));_0x53bb7c[_0x2e81('0x37')]=_0x53bb7c[_0x2e81('0x37')][_0x2e81('0x39')]?_0x53bb7c['attributes']:_0x4499b7[_0x2e81('0x31')];if(_0x2bc2a7['query']['includeAll']){_0x53bb7c[_0x2e81('0x43')]=[{'all':!![]}];}_0x53bb7c=_['merge']({},_0x53bb7c,_0x2bc2a7['options']);return db[_0x2e81('0x2c')][_0x2e81('0x48')](_0x53bb7c)[_0x2e81('0x24')](handleEntityNotFound(_0x1a8233,null))['then'](respondWithResult(_0x1a8233,null))['catch'](handleError(_0x1a8233,null));};exports[_0x2e81('0x49')]=function(_0x1dd4d7,_0x16ed11){return db[_0x2e81('0x2c')]['create'](_0x1dd4d7['body'],{})[_0x2e81('0x24')](function(_0x4056e8){var _0x5631b6=_0x1dd4d7['user'][_0x2e81('0x25')]({'plain':!![]});if(!_0x5631b6)throw new Error(_0x2e81('0x4a'));if(_0x5631b6['role']===_0x2e81('0x4b')){var _0x33a4d7=_0x4056e8[_0x2e81('0x25')]({'plain':!![]});var _0x3402b3=_0x2e81('0x26');return db['UserProfileSection'][_0x2e81('0x48')]({'where':{'name':_0x3402b3,'userProfileId':_0x5631b6[_0x2e81('0x4c')]},'raw':!![]})[_0x2e81('0x24')](function(_0xb4decd){if(_0xb4decd&&_0xb4decd['autoAssociation']===0x0){return db['UserProfileResource'][_0x2e81('0x49')]({'name':_0x33a4d7[_0x2e81('0x29')],'resourceId':_0x33a4d7['id'],'type':_0xb4decd[_0x2e81('0x29')],'sectionId':_0xb4decd['id']},{})[_0x2e81('0x24')](function(){return _0x4056e8;});}else{return _0x4056e8;}})[_0x2e81('0x4d')](function(_0x482888){logger[_0x2e81('0x4e')](_0x2e81('0x4f'),_0x482888);throw _0x482888;});}return _0x4056e8;})[_0x2e81('0x24')](respondWithResult(_0x16ed11,0xc9))[_0x2e81('0x4d')](handleError(_0x16ed11,null));};exports[_0x2e81('0x50')]=function(_0x4aa5e5,_0x44db7f){if(_0x4aa5e5[_0x2e81('0x51')]['id']){delete _0x4aa5e5['body']['id'];}return db['Tag'][_0x2e81('0x48')]({'where':{'id':_0x4aa5e5['params']['id']}})[_0x2e81('0x24')](handleEntityNotFound(_0x44db7f,null))[_0x2e81('0x24')](saveUpdates(_0x4aa5e5[_0x2e81('0x51')],null))[_0x2e81('0x24')](respondWithResult(_0x44db7f,null))[_0x2e81('0x4d')](handleError(_0x44db7f,null));};exports[_0x2e81('0x28')]=function(_0x18beeb,_0x1570c1){return db['Tag'][_0x2e81('0x48')]({'where':{'id':_0x18beeb['params']['id']}})[_0x2e81('0x24')](handleEntityNotFound(_0x1570c1,null))[_0x2e81('0x24')](removeEntity(_0x1570c1,null))['catch'](handleError(_0x1570c1,null));}; \ No newline at end of file +var _0xaf93=['sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','then','get','Tags','UserProfileResource','destroy','end','sendStatus','stack','name','index','Tag','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit'];(function(_0x1fdd49,_0x4b4908){var _0x3e6be0=function(_0xfcbaed){while(--_0xfcbaed){_0x1fdd49['push'](_0x1fdd49['shift']());}};_0x3e6be0(++_0x4b4908);}(_0xaf93,0x151));var _0x3af9=function(_0x49c2da,_0x2bdbe1){_0x49c2da=_0x49c2da-0x0;var _0x42a459=_0xaf93[_0x49c2da];return _0x42a459;};'use strict';var emlformat=require(_0x3af9('0x0'));var rimraf=require(_0x3af9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3af9('0x2'));var moment=require(_0x3af9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3af9('0x4'));var util=require(_0x3af9('0x5'));var path=require(_0x3af9('0x6'));var sox=require(_0x3af9('0x7'));var csv=require(_0x3af9('0x8'));var ejs=require(_0x3af9('0x9'));var fs=require('fs');var fs_extra=require(_0x3af9('0xa'));var _=require('lodash');var squel=require(_0x3af9('0xb'));var crypto=require('crypto');var jsforce=require(_0x3af9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3af9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3af9('0xe'));var qs=require(_0x3af9('0xf'));var as=require(_0x3af9('0x10'));var hardwareService=require(_0x3af9('0x11'));var logger=require('../../config/logger')(_0x3af9('0x12'));var utils=require(_0x3af9('0x13'));var config=require(_0x3af9('0x14'));var licenseUtil=require(_0x3af9('0x15'));var db=require(_0x3af9('0x16'))['db'];function respondWithStatusCode(_0xfa1410,_0x212f63){_0x212f63=_0x212f63||0xcc;return function(_0xa7b81f){if(_0xa7b81f){return _0xfa1410['sendStatus'](_0x212f63);}return _0xfa1410[_0x3af9('0x17')](_0x212f63)['end']();};}function respondWithResult(_0x152254,_0x222b6f){_0x222b6f=_0x222b6f||0xc8;return function(_0x1e4ebb){if(_0x1e4ebb){return _0x152254['status'](_0x222b6f)[_0x3af9('0x18')](_0x1e4ebb);}};}function respondWithFilteredResult(_0x1088fc,_0x37cb8b){return function(_0x4b2845){if(_0x4b2845){var _0x278e80=typeof _0x37cb8b[_0x3af9('0x19')]===_0x3af9('0x1a')&&typeof _0x37cb8b[_0x3af9('0x1b')]==='undefined';var _0x1d3410=_0x4b2845[_0x3af9('0x1c')];var _0x298135=_0x278e80?0x0:_0x37cb8b[_0x3af9('0x19')];var _0x314df2=_0x278e80?_0x4b2845['count']:_0x37cb8b[_0x3af9('0x19')]+_0x37cb8b[_0x3af9('0x1b')];var _0x1f9214;if(_0x314df2>=_0x1d3410){_0x314df2=_0x1d3410;_0x1f9214=0xc8;}else{_0x1f9214=0xce;}_0x1088fc[_0x3af9('0x17')](_0x1f9214);return _0x1088fc[_0x3af9('0x1d')]('Content-Range',_0x298135+'-'+_0x314df2+'/'+_0x1d3410)[_0x3af9('0x18')](_0x4b2845);}return null;};}function patchUpdates(_0x34eb91){return function(_0x449349){try{jsonpatch[_0x3af9('0x1e')](_0x449349,_0x34eb91,!![]);}catch(_0x3c1793){return BPromise[_0x3af9('0x1f')](_0x3c1793);}return _0x449349['save']();};}function saveUpdates(_0x4a88ea,_0x505e25){return function(_0x5e24e3){if(_0x5e24e3){return _0x5e24e3['update'](_0x4a88ea)[_0x3af9('0x20')](function(_0x5c1c8f){return _0x5c1c8f;});}return null;};}function removeEntity(_0x74c872,_0x307f9d){return function(_0x4b5a5c){if(_0x4b5a5c){return _0x4b5a5c['destroy']()['then'](function(){var _0x119e85=_0x4b5a5c[_0x3af9('0x21')]({'plain':!![]});var _0x22965b=_0x3af9('0x22');return db[_0x3af9('0x23')][_0x3af9('0x24')]({'where':{'type':_0x22965b,'resourceId':_0x119e85['id']}})[_0x3af9('0x20')](function(){return _0x4b5a5c;});})[_0x3af9('0x20')](function(){_0x74c872['status'](0xcc)[_0x3af9('0x25')]();});}};}function handleEntityNotFound(_0x574b71,_0x485754){return function(_0x177650){if(!_0x177650){_0x574b71[_0x3af9('0x26')](0x194);}return _0x177650;};}function handleError(_0x19643f,_0xf8840){_0xf8840=_0xf8840||0x1f4;return function(_0x374382){logger['error'](_0x374382[_0x3af9('0x27')]);if(_0x374382[_0x3af9('0x28')]){delete _0x374382[_0x3af9('0x28')];}_0x19643f['status'](_0xf8840)['send'](_0x374382);};}exports[_0x3af9('0x29')]=function(_0x1d022d,_0x8867c6){var _0x540969={},_0x4186d5={},_0x115673={'count':0x0,'rows':[]};var _0x1c923d=_['map'](db[_0x3af9('0x2a')][_0x3af9('0x2b')],function(_0x407572){return{'name':_0x407572['fieldName'],'type':_0x407572[_0x3af9('0x2c')][_0x3af9('0x2d')]};});_0x4186d5[_0x3af9('0x2e')]=_['map'](_0x1c923d,_0x3af9('0x28'));_0x4186d5[_0x3af9('0x2f')]=_['keys'](_0x1d022d[_0x3af9('0x2f')]);_0x4186d5['filters']=_[_0x3af9('0x30')](_0x4186d5['model'],_0x4186d5['query']);_0x540969[_0x3af9('0x31')]=_['intersection'](_0x4186d5[_0x3af9('0x2e')],qs[_0x3af9('0x32')](_0x1d022d[_0x3af9('0x2f')]['fields']));_0x540969['attributes']=_0x540969[_0x3af9('0x31')][_0x3af9('0x33')]?_0x540969['attributes']:_0x4186d5['model'];if(!_0x1d022d[_0x3af9('0x2f')]['hasOwnProperty'](_0x3af9('0x34'))){_0x540969[_0x3af9('0x1b')]=qs['limit'](_0x1d022d['query'][_0x3af9('0x1b')]);_0x540969[_0x3af9('0x19')]=qs[_0x3af9('0x19')](_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x19')]);}_0x540969['order']=qs['sort'](_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x35')]);_0x540969[_0x3af9('0x36')]=qs[_0x3af9('0x37')](_['pick'](_0x1d022d['query'],_0x4186d5[_0x3af9('0x37')]),_0x1c923d);if(_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x38')]){_0x540969['where']=_[_0x3af9('0x39')](_0x540969[_0x3af9('0x36')],{'$or':_[_0x3af9('0x3a')](_0x1c923d,function(_0x576c86){if(_0x576c86[_0x3af9('0x2c')]!=='VIRTUAL'){var _0x1f3ac9={};_0x1f3ac9[_0x576c86[_0x3af9('0x28')]]={'$like':'%'+_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x38')]+'%'};return _0x1f3ac9;}})});}_0x540969=_[_0x3af9('0x39')]({},_0x540969,_0x1d022d[_0x3af9('0x3b')]);var _0x43fd62={'where':_0x540969[_0x3af9('0x36')]};return db[_0x3af9('0x2a')][_0x3af9('0x1c')](_0x43fd62)[_0x3af9('0x20')](function(_0x4d7bd4){_0x115673[_0x3af9('0x1c')]=_0x4d7bd4;if(_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x3c')]){_0x540969[_0x3af9('0x3d')]=[{'all':!![]}];}return db[_0x3af9('0x2a')][_0x3af9('0x3e')](_0x540969);})[_0x3af9('0x20')](function(_0x384a61){_0x115673[_0x3af9('0x3f')]=_0x384a61;return _0x115673;})[_0x3af9('0x20')](respondWithFilteredResult(_0x8867c6,_0x540969))[_0x3af9('0x40')](handleError(_0x8867c6,null));};exports[_0x3af9('0x41')]=function(_0x549274,_0x542580){var _0x461dd6={'raw':!![],'where':{'id':_0x549274[_0x3af9('0x42')]['id']}},_0x1daea4={};_0x1daea4[_0x3af9('0x2e')]=_[_0x3af9('0x43')](db[_0x3af9('0x2a')][_0x3af9('0x2b')]);_0x1daea4[_0x3af9('0x2f')]=_[_0x3af9('0x43')](_0x549274[_0x3af9('0x2f')]);_0x1daea4[_0x3af9('0x37')]=_[_0x3af9('0x30')](_0x1daea4[_0x3af9('0x2e')],_0x1daea4['query']);_0x461dd6[_0x3af9('0x31')]=_[_0x3af9('0x30')](_0x1daea4[_0x3af9('0x2e')],qs[_0x3af9('0x32')](_0x549274['query']['fields']));_0x461dd6[_0x3af9('0x31')]=_0x461dd6['attributes'][_0x3af9('0x33')]?_0x461dd6[_0x3af9('0x31')]:_0x1daea4[_0x3af9('0x2e')];if(_0x549274[_0x3af9('0x2f')]['includeAll']){_0x461dd6[_0x3af9('0x3d')]=[{'all':!![]}];}_0x461dd6=_[_0x3af9('0x39')]({},_0x461dd6,_0x549274[_0x3af9('0x3b')]);return db['Tag']['find'](_0x461dd6)[_0x3af9('0x20')](handleEntityNotFound(_0x542580,null))['then'](respondWithResult(_0x542580,null))['catch'](handleError(_0x542580,null));};exports['create']=function(_0x19bd47,_0x3bc784){return db[_0x3af9('0x2a')][_0x3af9('0x44')](_0x19bd47[_0x3af9('0x45')],{})[_0x3af9('0x20')](function(_0x442681){var _0x48377b=_0x19bd47[_0x3af9('0x46')][_0x3af9('0x21')]({'plain':!![]});if(!_0x48377b)throw new Error(_0x3af9('0x47'));if(_0x48377b[_0x3af9('0x48')]===_0x3af9('0x46')){var _0x1104d4=_0x442681['get']({'plain':!![]});var _0x1b4509=_0x3af9('0x22');return db[_0x3af9('0x49')][_0x3af9('0x4a')]({'where':{'name':_0x1b4509,'userProfileId':_0x48377b['userProfileId']},'raw':!![]})[_0x3af9('0x20')](function(_0x39d954){if(_0x39d954&&_0x39d954[_0x3af9('0x4b')]===0x0){return db[_0x3af9('0x23')]['create']({'name':_0x1104d4[_0x3af9('0x28')],'resourceId':_0x1104d4['id'],'type':_0x39d954[_0x3af9('0x28')],'sectionId':_0x39d954['id']},{})[_0x3af9('0x20')](function(){return _0x442681;});}else{return _0x442681;}})[_0x3af9('0x40')](function(_0x4c75b6){logger['error'](_0x3af9('0x4c'),_0x4c75b6);throw _0x4c75b6;});}return _0x442681;})[_0x3af9('0x20')](respondWithResult(_0x3bc784,0xc9))[_0x3af9('0x40')](handleError(_0x3bc784,null));};exports[_0x3af9('0x4d')]=function(_0x3f087a,_0x268820){if(_0x3f087a[_0x3af9('0x45')]['id']){delete _0x3f087a[_0x3af9('0x45')]['id'];}return db[_0x3af9('0x2a')][_0x3af9('0x4a')]({'where':{'id':_0x3f087a[_0x3af9('0x42')]['id']}})['then'](handleEntityNotFound(_0x268820,null))[_0x3af9('0x20')](saveUpdates(_0x3f087a[_0x3af9('0x45')],null))['then'](respondWithResult(_0x268820,null))['catch'](handleError(_0x268820,null));};exports[_0x3af9('0x24')]=function(_0x4b205f,_0x27f717){return db[_0x3af9('0x2a')]['find']({'where':{'id':_0x4b205f['params']['id']}})[_0x3af9('0x20')](handleEntityNotFound(_0x27f717,null))[_0x3af9('0x20')](removeEntity(_0x27f717,null))[_0x3af9('0x40')](handleError(_0x27f717,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fdf0d26..15437f3 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 _0x63c9=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./tag.attributes','exports','define','tools_tags'];(function(_0x36585c,_0x359307){var _0x43b082=function(_0x256615){while(--_0x256615){_0x36585c['push'](_0x36585c['shift']());}};_0x43b082(++_0x359307);}(_0x63c9,0x140));var _0x963c=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x63c9[_0x46d0c9];return _0x174506;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x963c('0x0'))(_0x963c('0x1'));var moment=require(_0x963c('0x2'));var BPromise=require(_0x963c('0x3'));var rp=require(_0x963c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x963c('0x5'));var config=require('../../config/environment');var attributes=require(_0x963c('0x6'));module[_0x963c('0x7')]=function(_0x2c2ebe,_0x3e5757){return _0x2c2ebe[_0x963c('0x8')]('Tag',attributes,{'tableName':_0x963c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3edc=['Tag','lodash','util','../../config/logger','api','moment','path','../../config/environment','./tag.attributes','exports','define'];(function(_0x3df966,_0x58ce53){var _0x2a4dcf=function(_0x25bd63){while(--_0x25bd63){_0x3df966['push'](_0x3df966['shift']());}};_0x2a4dcf(++_0x58ce53);}(_0x3edc,0x90));var _0xc3ed=function(_0x2e2d7f,_0x5e5178){_0x2e2d7f=_0x2e2d7f-0x0;var _0x1cf5aa=_0x3edc[_0x2e2d7f];return _0x1cf5aa;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3ed('0x5'));var rimraf=require('rimraf');var config=require(_0xc3ed('0x6'));var attributes=require(_0xc3ed('0x7'));module[_0xc3ed('0x8')]=function(_0x3d443d,_0x57a7fc){return _0x3d443d[_0xc3ed('0x9')](_0xc3ed('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index dd05534..7337aed 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 _0x26c2=['message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5bc202,_0x314535){var _0x253744=function(_0x66339c){while(--_0x66339c){_0x5bc202['push'](_0x5bc202['shift']());}};_0x253744(++_0x314535);}(_0x26c2,0x130));var _0x226c=function(_0x635a5b,_0x21c348){_0x635a5b=_0x635a5b-0x0;var _0x4eab61=_0x26c2[_0x635a5b];return _0x4eab61;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x226c('0x0'));var rs=require(_0x226c('0x1'));var fs=require('fs');var Redis=require(_0x226c('0x2'));var db=require(_0x226c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x226c('0x4'))(_0x226c('0x5'));var config=require('../../config/environment');var jayson=require(_0x226c('0x6'));var client=jayson[_0x226c('0x7')][_0x226c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c4e5d,_0x4306c9,_0x59804e){return new BPromise(function(_0x34cbc3,_0x461773){return client[_0x226c('0x9')](_0x3c4e5d,_0x59804e)[_0x226c('0xa')](function(_0x127f10){logger['info'](_0x226c('0xb'),_0x4306c9,_0x226c('0xc'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x4306c9,_0x226c('0xc'),JSON[_0x226c('0xd')](_0x127f10));if(_0x127f10[_0x226c('0xe')]){if(_0x127f10[_0x226c('0xe')][_0x226c('0xf')]===0x1f4){logger[_0x226c('0xe')](_0x226c('0xb'),_0x4306c9,_0x127f10['error']['message']);return _0x461773(_0x127f10[_0x226c('0xe')][_0x226c('0x10')]);}logger[_0x226c('0xe')](_0x226c('0xb'),_0x4306c9,_0x127f10['error']['message']);return _0x34cbc3(_0x127f10[_0x226c('0xe')][_0x226c('0x10')]);}else{logger[_0x226c('0x11')]('Tag,\x20%s,\x20%s',_0x4306c9,'request\x20sent');_0x34cbc3(_0x127f10[_0x226c('0x12')][_0x226c('0x10')]);}})[_0x226c('0x13')](function(_0x45a804){logger[_0x226c('0xe')]('Tag,\x20%s,\x20%s',_0x4306c9,_0x45a804);_0x461773(_0x45a804);});});} \ 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(_0x5a6580,_0x4c8d03){var _0x14c0ad=function(_0x523e46){while(--_0x523e46){_0x5a6580['push'](_0x5a6580['shift']());}};_0x14c0ad(++_0x4c8d03);}(_0x495e,0xfb));var _0xe495=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x495e[_0x5f3905];return _0x2923b1;};'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 bdc7b85..b21c0c7 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 80fcdac..003d0e9 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(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_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 _0xe706=['STRING','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe706,0xa3));var _0x6e70=function(_0xa7662e,_0x22304d){_0xa7662e=_0xa7662e-0x0;var _0x425053=_0xe706[_0xa7662e];return _0x425053;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2c35654..5f539fc 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 _0xdcd8=['limit','count','offset','set','json','apply','reject','save','error','stack','name','send','map','Team','fieldName','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','rawAttributes','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','isValidChannel','channel','Unknown\x20channel','toLowerCase','capitalize','addQueues','ValidationError','add','Queues','removeQueues','findOne','ids','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','Queue:save','User','findAll','interface','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','all','addAgents','removeAgents','Openchannel','emit','Queue:remove','hasOwnProperty','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','fs-extra','lodash','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','defaults','redis','socket.io-emitter','register','sendStatus','end','status','undefined'];(function(_0x27c3b8,_0x49fd2e){var _0x56da31=function(_0x317fbc){while(--_0x317fbc){_0x27c3b8['push'](_0x27c3b8['shift']());}};_0x56da31(++_0x49fd2e);}(_0xdcd8,0x1a8));var _0x8dcd=function(_0x1c1509,_0x2dfa81){_0x1c1509=_0x1c1509-0x0;var _0xf11b7=_0xdcd8[_0x1c1509];return _0xf11b7;};'use strict';var emlformat=require(_0x8dcd('0x0'));var rimraf=require(_0x8dcd('0x1'));var zipdir=require(_0x8dcd('0x2'));var jsonpatch=require(_0x8dcd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8dcd('0x4'));var sox=require(_0x8dcd('0x5'));var csv=require(_0x8dcd('0x6'));var ejs=require(_0x8dcd('0x7'));var fs=require('fs');var fs_extra=require(_0x8dcd('0x8'));var _=require(_0x8dcd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8dcd('0xa'));var deskjs=require(_0x8dcd('0xb'));var toCsv=require(_0x8dcd('0x6'));var querystring=require(_0x8dcd('0xc'));var Papa=require(_0x8dcd('0xd'));var Redis=require(_0x8dcd('0xe'));var authService=require(_0x8dcd('0xf'));var qs=require(_0x8dcd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dcd('0x11'));var logger=require(_0x8dcd('0x12'))(_0x8dcd('0x13'));var utils=require(_0x8dcd('0x14'));var config=require(_0x8dcd('0x15'));var licenseUtil=require(_0x8dcd('0x16'));var db=require(_0x8dcd('0x17'))['db'];config['redis']=_[_0x8dcd('0x18')](config[_0x8dcd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8dcd('0x1a'))(new Redis(config[_0x8dcd('0x19')]));require('./team.socket')[_0x8dcd('0x1b')](socket);function respondWithStatusCode(_0x101eb8,_0x891dcb){_0x891dcb=_0x891dcb||0xcc;return function(_0x460beb){if(_0x460beb){return _0x101eb8[_0x8dcd('0x1c')](_0x891dcb);}return _0x101eb8['status'](_0x891dcb)[_0x8dcd('0x1d')]();};}function respondWithResult(_0x3408a8,_0x88bfdd){_0x88bfdd=_0x88bfdd||0xc8;return function(_0x355aa2){if(_0x355aa2){return _0x3408a8[_0x8dcd('0x1e')](_0x88bfdd)['json'](_0x355aa2);}};}function respondWithFilteredResult(_0x2591c4,_0x4caa93){return function(_0x1ce355){if(_0x1ce355){var _0x445bcb=typeof _0x4caa93['offset']===_0x8dcd('0x1f')&&typeof _0x4caa93[_0x8dcd('0x20')]===_0x8dcd('0x1f');var _0x2002ae=_0x1ce355[_0x8dcd('0x21')];var _0x1340b1=_0x445bcb?0x0:_0x4caa93[_0x8dcd('0x22')];var _0x40467e=_0x445bcb?_0x1ce355[_0x8dcd('0x21')]:_0x4caa93[_0x8dcd('0x22')]+_0x4caa93['limit'];var _0x37f7d9;if(_0x40467e>=_0x2002ae){_0x40467e=_0x2002ae;_0x37f7d9=0xc8;}else{_0x37f7d9=0xce;}_0x2591c4['status'](_0x37f7d9);return _0x2591c4[_0x8dcd('0x23')]('Content-Range',_0x1340b1+'-'+_0x40467e+'/'+_0x2002ae)[_0x8dcd('0x24')](_0x1ce355);}return null;};}function patchUpdates(_0x248411){return function(_0x18dfe4){try{jsonpatch[_0x8dcd('0x25')](_0x18dfe4,_0x248411,!![]);}catch(_0x3a79c8){return BPromise[_0x8dcd('0x26')](_0x3a79c8);}return _0x18dfe4[_0x8dcd('0x27')]();};}function saveUpdates(_0x146862,_0x17bcd8){return function(_0x26e929){if(_0x26e929){return _0x26e929['update'](_0x146862)['then'](function(_0x5bd240){return _0x5bd240;});}return null;};}function handleEntityNotFound(_0x970c76,_0x5a57ba){return function(_0x11cc66){if(!_0x11cc66){_0x970c76[_0x8dcd('0x1c')](0x194);}return _0x11cc66;};}function handleError(_0x3c022e,_0x4d88e2){_0x4d88e2=_0x4d88e2||0x1f4;return function(_0x170619){logger[_0x8dcd('0x28')](_0x170619[_0x8dcd('0x29')]);if(_0x170619[_0x8dcd('0x2a')]){delete _0x170619['name'];}_0x3c022e[_0x8dcd('0x1e')](_0x4d88e2)[_0x8dcd('0x2b')](_0x170619);};}exports['index']=function(_0x2aec55,_0x592dcd){var _0x2db10b={},_0x31bd27={},_0x287ea5={'count':0x0,'rows':[]};var _0x256774=_[_0x8dcd('0x2c')](db[_0x8dcd('0x2d')]['rawAttributes'],function(_0x21c052){return{'name':_0x21c052[_0x8dcd('0x2e')],'type':_0x21c052['type'][_0x8dcd('0x2f')]};});_0x31bd27[_0x8dcd('0x30')]=_['map'](_0x256774,'name');_0x31bd27['query']=_[_0x8dcd('0x31')](_0x2aec55[_0x8dcd('0x32')]);_0x31bd27['filters']=_[_0x8dcd('0x33')](_0x31bd27[_0x8dcd('0x30')],_0x31bd27[_0x8dcd('0x32')]);_0x2db10b[_0x8dcd('0x34')]=_[_0x8dcd('0x33')](_0x31bd27[_0x8dcd('0x30')],qs['fields'](_0x2aec55['query'][_0x8dcd('0x35')]));_0x2db10b[_0x8dcd('0x34')]=_0x2db10b[_0x8dcd('0x34')]['length']?_0x2db10b['attributes']:_0x31bd27[_0x8dcd('0x30')];if(!_0x2aec55['query']['hasOwnProperty'](_0x8dcd('0x36'))){_0x2db10b[_0x8dcd('0x20')]=qs[_0x8dcd('0x20')](_0x2aec55[_0x8dcd('0x32')][_0x8dcd('0x20')]);_0x2db10b[_0x8dcd('0x22')]=qs[_0x8dcd('0x22')](_0x2aec55[_0x8dcd('0x32')]['offset']);}_0x2db10b[_0x8dcd('0x37')]=qs['sort'](_0x2aec55[_0x8dcd('0x32')][_0x8dcd('0x38')]);_0x2db10b[_0x8dcd('0x39')]=qs[_0x8dcd('0x3a')](_[_0x8dcd('0x3b')](_0x2aec55[_0x8dcd('0x32')],_0x31bd27[_0x8dcd('0x3a')]),_0x256774);if(_0x2aec55[_0x8dcd('0x32')][_0x8dcd('0x3c')]){_0x2db10b[_0x8dcd('0x39')]=_[_0x8dcd('0x3d')](_0x2db10b['where'],{'$or':_[_0x8dcd('0x2c')](_0x256774,function(_0x337cf0){if(_0x337cf0['type']!==_0x8dcd('0x3e')){var _0x4c63e4={};_0x4c63e4[_0x337cf0[_0x8dcd('0x2a')]]={'$like':'%'+_0x2aec55[_0x8dcd('0x32')]['filter']+'%'};return _0x4c63e4;}})});}_0x2db10b=_[_0x8dcd('0x3d')]({},_0x2db10b,_0x2aec55[_0x8dcd('0x3f')]);var _0x5efcd0={'where':_0x2db10b['where']};return db[_0x8dcd('0x2d')]['count'](_0x5efcd0)[_0x8dcd('0x40')](function(_0x485777){_0x287ea5[_0x8dcd('0x21')]=_0x485777;if(_0x2aec55[_0x8dcd('0x32')][_0x8dcd('0x41')]){_0x2db10b[_0x8dcd('0x42')]=[{'all':!![]}];}return db[_0x8dcd('0x2d')]['findAll'](_0x2db10b);})['then'](function(_0x2c9b06){_0x287ea5[_0x8dcd('0x43')]=_0x2c9b06;return _0x287ea5;})['then'](respondWithFilteredResult(_0x592dcd,_0x2db10b))[_0x8dcd('0x44')](handleError(_0x592dcd,null));};exports[_0x8dcd('0x45')]=function(_0x3755b4,_0x48fa75){var _0x7b4e04={'raw':![],'where':{'id':_0x3755b4[_0x8dcd('0x46')]['id']}},_0x20b480={};_0x20b480[_0x8dcd('0x30')]=_[_0x8dcd('0x31')](db['Team'][_0x8dcd('0x47')]);_0x20b480[_0x8dcd('0x32')]=_[_0x8dcd('0x31')](_0x3755b4[_0x8dcd('0x32')]);_0x20b480[_0x8dcd('0x3a')]=_['intersection'](_0x20b480[_0x8dcd('0x30')],_0x20b480[_0x8dcd('0x32')]);_0x7b4e04[_0x8dcd('0x34')]=_[_0x8dcd('0x33')](_0x20b480[_0x8dcd('0x30')],qs[_0x8dcd('0x35')](_0x3755b4[_0x8dcd('0x32')][_0x8dcd('0x35')]));_0x7b4e04['attributes']=_0x7b4e04[_0x8dcd('0x34')][_0x8dcd('0x48')]?_0x7b4e04[_0x8dcd('0x34')]:_0x20b480['model'];if(_0x3755b4[_0x8dcd('0x32')]['includeAll']){_0x7b4e04[_0x8dcd('0x42')]=[{'all':!![]}];}_0x7b4e04=_[_0x8dcd('0x3d')]({},_0x7b4e04,_0x3755b4[_0x8dcd('0x3f')]);return db['Team']['find'](_0x7b4e04)[_0x8dcd('0x40')](handleEntityNotFound(_0x48fa75,null))[_0x8dcd('0x40')](respondWithResult(_0x48fa75,null))[_0x8dcd('0x44')](handleError(_0x48fa75,null));};exports[_0x8dcd('0x49')]=function(_0x4e6cd4,_0x525d6f){return db[_0x8dcd('0x2d')][_0x8dcd('0x49')](_0x4e6cd4[_0x8dcd('0x4a')],{})['then'](function(_0x8e7dd7){var _0x34d507=_0x4e6cd4[_0x8dcd('0x4b')][_0x8dcd('0x4c')]({'plain':!![]});if(!_0x34d507)throw new Error(_0x8dcd('0x4d'));if(_0x34d507['role']===_0x8dcd('0x4b')){var _0x1de1b1=_0x8e7dd7[_0x8dcd('0x4c')]({'plain':!![]});var _0x499592=_0x8dcd('0x4e');return db[_0x8dcd('0x4f')][_0x8dcd('0x50')]({'where':{'name':_0x499592,'userProfileId':_0x34d507[_0x8dcd('0x51')]},'raw':!![]})[_0x8dcd('0x40')](function(_0x18ba9b){if(_0x18ba9b&&_0x18ba9b[_0x8dcd('0x52')]===0x0){return db[_0x8dcd('0x53')][_0x8dcd('0x49')]({'name':_0x1de1b1['name'],'resourceId':_0x1de1b1['id'],'type':_0x18ba9b[_0x8dcd('0x2a')],'sectionId':_0x18ba9b['id']},{})['then'](function(){return _0x8e7dd7;});}else{return _0x8e7dd7;}})[_0x8dcd('0x44')](function(_0x373d41){logger[_0x8dcd('0x28')](_0x8dcd('0x54'),_0x373d41);throw _0x373d41;});}return _0x8e7dd7;})['then'](respondWithResult(_0x525d6f,0xc9))['catch'](handleError(_0x525d6f,null));};exports[_0x8dcd('0x55')]=function(_0x53c2f2,_0x33fc3a){if(_0x53c2f2[_0x8dcd('0x4a')]['id']){delete _0x53c2f2['body']['id'];}return db['Team'][_0x8dcd('0x50')]({'where':{'id':_0x53c2f2[_0x8dcd('0x46')]['id']}})['then'](handleEntityNotFound(_0x33fc3a,null))[_0x8dcd('0x40')](saveUpdates(_0x53c2f2[_0x8dcd('0x4a')],null))['then'](respondWithResult(_0x33fc3a,null))[_0x8dcd('0x44')](handleError(_0x33fc3a,null));};exports['destroy']=function(_0x5d4c15,_0x223496){var _0x506226=_0x5d4c15[_0x8dcd('0x46')]['id'];var _0x37c6a6=[];return db['sequelize']['transaction'](function(_0x4d3f1e){var _0x20e48e=_0x8dcd('0x56')+_0x506226;return db[_0x8dcd('0x57')][_0x8dcd('0x32')](_0x20e48e,{'type':db[_0x8dcd('0x58')][_0x8dcd('0x59')]['SELECT'],'raw':!![],'transaction':_0x4d3f1e})[_0x8dcd('0x40')](function(_0x5e88b5){_0x37c6a6=_['map'](_0x5e88b5,function(_0x2bc1c1){return Number(_0x2bc1c1['UserId']);});})[_0x8dcd('0x40')](function(){var _0x5d6349='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x506226;return db[_0x8dcd('0x57')][_0x8dcd('0x32')](_0x5d6349,{'type':db['Sequelize'][_0x8dcd('0x59')][_0x8dcd('0x5a')],'raw':!![],'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(_0x14687d){var _0x44268e=_['map'](_0x14687d,function(_0x1fc574){return Number(_0x1fc574[_0x8dcd('0x5b')]);});return db[_0x8dcd('0x5c')][_0x8dcd('0x5d')]({'where':{'UserId':{'$in':_0x37c6a6},'VoiceQueueId':{'$in':_0x44268e}},'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(){var _0x5ec3d3='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x506226;return db[_0x8dcd('0x57')][_0x8dcd('0x32')](_0x5ec3d3,{'type':db[_0x8dcd('0x58')]['QueryTypes'][_0x8dcd('0x5a')],'raw':!![],'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(_0x721799){var _0x165f1f=_['map'](_0x721799,function(_0x50b730){return Number(_0x50b730[_0x8dcd('0x5e')]);});return db[_0x8dcd('0x5f')][_0x8dcd('0x5d')]({'where':{'UserId':{'$in':_0x37c6a6},'MailQueueId':{'$in':_0x165f1f}},'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(){var _0x4abeec=_0x8dcd('0x60')+_0x506226;return db[_0x8dcd('0x57')][_0x8dcd('0x32')](_0x4abeec,{'type':db['Sequelize'][_0x8dcd('0x59')][_0x8dcd('0x5a')],'raw':!![],'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(_0xbf595){var _0x3924e4=_[_0x8dcd('0x2c')](_0xbf595,function(_0x5cad78){return Number(_0x5cad78[_0x8dcd('0x61')]);});return db[_0x8dcd('0x62')][_0x8dcd('0x5d')]({'where':{'UserId':{'$in':_0x37c6a6},'SmsQueueId':{'$in':_0x3924e4}},'transaction':_0x4d3f1e});})['then'](function(){var _0x5bd12a=_0x8dcd('0x63')+_0x506226;return db[_0x8dcd('0x57')][_0x8dcd('0x32')](_0x5bd12a,{'type':db['Sequelize'][_0x8dcd('0x59')][_0x8dcd('0x5a')],'raw':!![],'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(_0xe06975){var _0x224814=_['map'](_0xe06975,function(_0x35fb76){return Number(_0x35fb76['ChatQueueId']);});return db[_0x8dcd('0x64')][_0x8dcd('0x5d')]({'where':{'UserId':{'$in':_0x37c6a6},'ChatQueueId':{'$in':_0x224814}},'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(){var _0x3565ce=_0x8dcd('0x65')+_0x506226;return db[_0x8dcd('0x57')][_0x8dcd('0x32')](_0x3565ce,{'type':db['Sequelize']['QueryTypes'][_0x8dcd('0x5a')],'raw':!![],'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(_0x28f3ae){var _0x32414d=_[_0x8dcd('0x2c')](_0x28f3ae,function(_0x1bd77f){return Number(_0x1bd77f[_0x8dcd('0x66')]);});return db[_0x8dcd('0x67')][_0x8dcd('0x5d')]({'where':{'UserId':{'$in':_0x37c6a6},'FaxQueueId':{'$in':_0x32414d}},'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(){var _0x38372a=_0x8dcd('0x68')+_0x506226;return db['sequelize']['query'](_0x38372a,{'type':db['Sequelize']['QueryTypes'][_0x8dcd('0x5a')],'raw':!![],'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(_0x4ad6ca){var _0x56ec96=_[_0x8dcd('0x2c')](_0x4ad6ca,function(_0x2a0d34){return Number(_0x2a0d34[_0x8dcd('0x69')]);});return db[_0x8dcd('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x37c6a6},'OpenchannelQueueId':{'$in':_0x56ec96}},'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(){var _0xa3f418=_0x8dcd('0x6b')+_0x506226;return db[_0x8dcd('0x57')][_0x8dcd('0x32')](_0xa3f418,{'type':db['Sequelize'][_0x8dcd('0x59')]['SELECT'],'raw':!![],'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(_0x3131c2){var _0x38cdee=_[_0x8dcd('0x2c')](_0x3131c2,function(_0x596065){return Number(_0x596065['WhatsappQueueId']);});return db[_0x8dcd('0x6c')][_0x8dcd('0x5d')]({'where':{'UserId':{'$in':_0x37c6a6},'WhatsappQueueId':{'$in':_0x38cdee}},'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(){return db[_0x8dcd('0x6d')]['find']({'where':{'TeamId':_0x506226}});})[_0x8dcd('0x40')](function(_0x4a5a14){if(_0x4a5a14===null){return;}return db[_0x8dcd('0x6e')][_0x8dcd('0x5d')]({'where':{'UserId':{'$in':_0x37c6a6},'VoicePrefixId':_0x4a5a14[_0x8dcd('0x6f')]},'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(){return db['Team'][_0x8dcd('0x5d')]({'where':{'id':_0x506226},'cascade':!![],'transaction':_0x4d3f1e});})[_0x8dcd('0x40')](function(_0x1075e1){if(_0x1075e1===0x0){_0x223496[_0x8dcd('0x1c')](0x194);}else{return db[_0x8dcd('0x53')]['destroy']({'where':{'type':'Teams','resourceId':_0x506226},'cascade':!![],'transaction':_0x4d3f1e})[_0x8dcd('0x40')](function(){_0x223496[_0x8dcd('0x1e')](0xcc)['end']();});}})[_0x8dcd('0x44')](function(_0x583460){_0x223496['status'](0x1f4)[_0x8dcd('0x2b')](_0x583460);});});};exports['getQueues']=function(_0x1d3778,_0x5ebd7d,_0x5d65e1){return db[_0x8dcd('0x2d')]['findOne']({'where':{'id':_0x1d3778['params']['id']}})[_0x8dcd('0x40')](handleEntityNotFound(_0x5ebd7d,null))['then'](function(_0xac06d3){if(!_0x1d3778['query']['channel']||!utils[_0x8dcd('0x70')](_0x1d3778[_0x8dcd('0x32')][_0x8dcd('0x71')])){throw new db['Sequelize']['ValidationError'](_0x8dcd('0x72'));}var _0x537651={};var _0x25eb3b={};_0x25eb3b[_0x8dcd('0x30')]=_[_0x8dcd('0x31')](db[_['capitalize'](_0x1d3778[_0x8dcd('0x32')]['channel'][_0x8dcd('0x73')]())+'Queue'][_0x8dcd('0x47')]);_0x25eb3b[_0x8dcd('0x32')]=_['keys'](_0x1d3778[_0x8dcd('0x32')]);_0x25eb3b[_0x8dcd('0x3a')]=_[_0x8dcd('0x33')](_0x25eb3b[_0x8dcd('0x30')],_0x25eb3b[_0x8dcd('0x32')]);_0x537651[_0x8dcd('0x34')]=_[_0x8dcd('0x33')](_0x25eb3b['model'],qs[_0x8dcd('0x35')](_0x1d3778[_0x8dcd('0x32')][_0x8dcd('0x35')]));_0x537651[_0x8dcd('0x34')]=_0x537651['attributes'][_0x8dcd('0x48')]?_0x537651['attributes']:_0x25eb3b[_0x8dcd('0x30')];_0x537651[_0x8dcd('0x20')]=qs[_0x8dcd('0x20')](_0x1d3778[_0x8dcd('0x32')][_0x8dcd('0x20')]);_0x537651[_0x8dcd('0x22')]=qs[_0x8dcd('0x22')](_0x1d3778[_0x8dcd('0x32')][_0x8dcd('0x22')]);_0x537651['order']=qs[_0x8dcd('0x38')](_0x1d3778[_0x8dcd('0x32')][_0x8dcd('0x38')]);_0x537651['where']=qs[_0x8dcd('0x3a')](_[_0x8dcd('0x3b')](_0x1d3778['query'],_0x25eb3b[_0x8dcd('0x3a')]));_0x537651=_[_0x8dcd('0x3d')]({},_0x537651,_0x1d3778[_0x8dcd('0x3f')]);return _0xac06d3[_0x8dcd('0x4c')+_[_0x8dcd('0x74')](_0x1d3778['query'][_0x8dcd('0x71')]['toLowerCase']())+'Queues'](_0x537651);})[_0x8dcd('0x40')](respondWithResult(_0x5ebd7d,null))[_0x8dcd('0x44')](handleError(_0x5ebd7d,null));};exports[_0x8dcd('0x75')]=function(_0x572bf5,_0x57a3db,_0x5438f1){return db[_0x8dcd('0x2d')]['findOne']({'where':{'id':_0x572bf5['params']['id']}})[_0x8dcd('0x40')](function(_0x5459b3){if(_0x5459b3){if(!_0x572bf5['body'][_0x8dcd('0x71')]||!utils['isValidChannel'](_0x572bf5['body']['channel'])){throw new db[(_0x8dcd('0x58'))][(_0x8dcd('0x76'))](_0x8dcd('0x72'));}return _0x5459b3[_0x8dcd('0x77')+_[_0x8dcd('0x74')](_0x572bf5[_0x8dcd('0x4a')][_0x8dcd('0x71')][_0x8dcd('0x73')]())+_0x8dcd('0x78')](_0x572bf5[_0x8dcd('0x4a')]['ids']);}return null;})[_0x8dcd('0x40')](handleEntityNotFound(_0x57a3db,null))['then'](respondWithStatusCode(_0x57a3db,null))[_0x8dcd('0x44')](handleError(_0x57a3db,null));};exports[_0x8dcd('0x79')]=function(_0x40a530,_0x122484,_0x5b295b){return db[_0x8dcd('0x2d')][_0x8dcd('0x7a')]({'where':{'id':_0x40a530[_0x8dcd('0x46')]['id']}})[_0x8dcd('0x40')](function(_0x22145e){if(_0x22145e){if(!_0x40a530[_0x8dcd('0x32')][_0x8dcd('0x71')]||!utils['isValidChannel'](_0x40a530[_0x8dcd('0x32')][_0x8dcd('0x71')])){throw new db[(_0x8dcd('0x58'))][(_0x8dcd('0x76'))](_0x8dcd('0x72'));}return _0x22145e['remove'+_[_0x8dcd('0x74')](_0x40a530['query']['channel']['toLowerCase']())+_0x8dcd('0x78')](_0x40a530['query'][_0x8dcd('0x7b')]);}return null;})[_0x8dcd('0x40')](handleEntityNotFound(_0x122484,null))['then'](respondWithStatusCode(_0x122484,null))['catch'](handleError(_0x122484,null));};exports['addAgents']=function(_0x4c2c7f,_0x2f3bed){var _0x3b6b35=_[_0x8dcd('0x7c')](_0x4c2c7f[_0x8dcd('0x4a')][_0x8dcd('0x7b')])?_0x4c2c7f[_0x8dcd('0x4a')][_0x8dcd('0x7b')]:[_0x4c2c7f[_0x8dcd('0x4a')][_0x8dcd('0x7b')]];var _0x2daf3e=_0x4c2c7f[_0x8dcd('0x46')]['id'];return db[_0x8dcd('0x2d')][_0x8dcd('0x50')]({'where':{'id':_0x2daf3e}})[_0x8dcd('0x40')](handleEntityNotFound(_0x2f3bed,null))['then'](function(_0x4f2d35){if(_0x4f2d35){var _0x578788=[_0x8dcd('0x7d'),_0x8dcd('0x7e'),_0x8dcd('0x7f'),_0x8dcd('0x80'),_0x8dcd('0x81'),'Openchannel',_0x8dcd('0x82')];return db['sequelize'][_0x8dcd('0x83')](function(_0x18fd16){var _0x41b8a3=_[_0x8dcd('0x2c')](_0x578788,function(_0x6b3615){var _0x3c34ef={'attributes':['id',_0x8dcd('0x2a')]};if(_0x6b3615===_0x8dcd('0x7d')){_0x3c34ef['through']={'attributes':[_0x8dcd('0x84')]};}return _0x4f2d35[_0x8dcd('0x4c')+_0x6b3615+'Queues'](_0x3c34ef)[_0x8dcd('0x40')](function(_0xb64f43){var _0x34ec37=_[_0x8dcd('0x2c')](_0xb64f43,function(_0x31226b){var _0x137830=_[_0x8dcd('0x2c')](_0x3b6b35,function(_0x5d4529){var _0xe1d63e={'where':{'UserId':_0x5d4529,[_0x6b3615+_0x8dcd('0x85')]:_0x31226b['id']},'transaction':_0x18fd16};if(_0x6b3615==='Voice'){_0xe1d63e[_0x8dcd('0x18')]={'penalty':_0x31226b[_0x8dcd('0x86')][_0x8dcd('0x84')]};}return db['User'+_0x6b3615+'Queue']['findOrCreate'](_0xe1d63e)[_0x8dcd('0x40')](function(){socket['emit'](_0x8dcd('0x4b')+_0x6b3615+_0x8dcd('0x87'),{'UserId':_0x5d4529,[_0x6b3615+_0x8dcd('0x85')]:_0x31226b['id']});if(_0x6b3615!==_0x8dcd('0x7d')){return;}return db[_0x8dcd('0x88')][_0x8dcd('0x89')]({'where':{'id':_0x3b6b35,'online':0x1},'attributes':['id','name','online','voicePause',_0x8dcd('0x8a')],'raw':!![]})['then'](function(_0x108da6){var _0x1056a1=_['map'](_0x108da6,function(_0x275fd9){return db[_0x8dcd('0x8b')]['upsert']({'membername':_0x275fd9[_0x8dcd('0x2a')],'UserId':_0x275fd9['id'],'queue_name':_0x31226b[_0x8dcd('0x2a')],'VoiceQueueId':_0x31226b['id'],'interface':_[_0x8dcd('0x8c')](_0x275fd9['interface'])?util[_0x8dcd('0x8d')](_0x8dcd('0x8e'),_0x275fd9[_0x8dcd('0x2a')]):_0x275fd9['interface'],'paused':_0x275fd9[_0x8dcd('0x8f')]||![],'penalty':_0x31226b['TeamVoiceQueue'][_0x8dcd('0x84')]},{'transaction':_0x18fd16});});return Promise[_0x8dcd('0x90')](_0x1056a1);});});});return Promise[_0x8dcd('0x90')](_0x137830);});return Promise[_0x8dcd('0x90')](_0x34ec37);})['then'](function(){return db['TeamVoicePrefix'][_0x8dcd('0x7a')]({'where':{'teamId':_0x2daf3e}})['then'](function(_0x4a19fd){if(_0x4a19fd){var _0x16be8e=_[_0x8dcd('0x2c')](_0x3b6b35,function(_0x2e9171){db[_0x8dcd('0x6e')]['upsert']({'UserId':_0x2e9171,'VoicePrefixId':_0x4a19fd[_0x8dcd('0x6f')]});});return Promise[_0x8dcd('0x90')](_0x16be8e);}});});});return Promise[_0x8dcd('0x90')](_0x41b8a3)['then'](function(){return _0x4f2d35[_0x8dcd('0x91')](_0x3b6b35,{'transaction':_0x18fd16})['spread'](function(_0x5539f9){return _0x5539f9;});});});}})['then'](respondWithResult(_0x2f3bed,null))[_0x8dcd('0x44')](handleError(_0x2f3bed,null));};exports[_0x8dcd('0x92')]=function(_0x24b4c1,_0x4fffc9){var _0x5cc0c1=_['isArray'](_0x24b4c1[_0x8dcd('0x32')][_0x8dcd('0x7b')])?_0x24b4c1[_0x8dcd('0x32')][_0x8dcd('0x7b')]:[_0x24b4c1['query'][_0x8dcd('0x7b')]];var _0x2d2fb8=_0x24b4c1[_0x8dcd('0x46')]['id'];return db['Team'][_0x8dcd('0x50')]({'where':{'id':_0x2d2fb8}})[_0x8dcd('0x40')](handleEntityNotFound(_0x4fffc9,null))[_0x8dcd('0x40')](function(_0x1bedfc){if(_0x1bedfc){var _0x52b269=['Voice',_0x8dcd('0x7e'),_0x8dcd('0x7f'),_0x8dcd('0x80'),_0x8dcd('0x81'),_0x8dcd('0x93'),_0x8dcd('0x82')];return db['sequelize']['transaction'](function(_0x373347){var _0x114f08=_['map'](_0x52b269,function(_0xcda6){var _0x4fc416={'attributes':['id','name']};return _0x1bedfc[_0x8dcd('0x4c')+_0xcda6+_0x8dcd('0x78')](_0x4fc416)[_0x8dcd('0x40')](function(_0x4b8c6b){var _0xfbd169=_['map'](_0x4b8c6b,function(_0xc6ae6f){return _0xc6ae6f[_0x8dcd('0x92')](_0x5cc0c1,{'transaction':_0x373347})['then'](function(){var _0x1921c2=_[_0x8dcd('0x2c')](_0x5cc0c1,function(_0x15af44){socket[_0x8dcd('0x94')]('user'+_0xcda6+_0x8dcd('0x95'),{'UserId':Number(_0x15af44),[_0xcda6+'QueueId']:_0xc6ae6f['id']});if(_0xcda6!==_0x8dcd('0x7d')){return;}return db[_0x8dcd('0x8b')]['destroy']({'where':{'VoiceQueueId':_0xc6ae6f['id'],'UserId':_0x15af44},'transaction':_0x373347});});return Promise[_0x8dcd('0x90')](_0x1921c2);});});return Promise[_0x8dcd('0x90')](_0xfbd169);});});return Promise['all'](_0x114f08)['then'](function(){return _0x1bedfc[_0x8dcd('0x92')](_0x5cc0c1,{'transaction':_0x373347});})[_0x8dcd('0x40')](function(){return db[_0x8dcd('0x6d')][_0x8dcd('0x7a')]({'where':{'teamId':_0x2d2fb8}})['then'](function(_0x535760){if(_0x535760){var _0x121a45=_[_0x8dcd('0x2c')](_0x5cc0c1,function(_0x5dff19){db['UserVoicePrefix'][_0x8dcd('0x5d')]({'where':{'UserId':_0x5dff19,'VoicePrefixId':_0x535760['VoicePrefixId']}});});return Promise[_0x8dcd('0x90')](_0x121a45);}});});});}})[_0x8dcd('0x40')](respondWithStatusCode(_0x4fffc9,null))[_0x8dcd('0x44')](handleError(_0x4fffc9,null));};exports['getAgents']=function(_0x1b6d65,_0x46956f,_0x421439){var _0x31c8fe={};var _0x3aa1f5={};var _0x42223d;var _0x40a6bc;return db['Team'][_0x8dcd('0x7a')]({'where':{'id':_0x1b6d65[_0x8dcd('0x46')]['id']}})[_0x8dcd('0x40')](handleEntityNotFound(_0x46956f,null))[_0x8dcd('0x40')](function(_0x1da569){if(_0x1da569){_0x42223d=_0x1da569;_0x3aa1f5[_0x8dcd('0x30')]=_[_0x8dcd('0x31')](db[_0x8dcd('0x88')][_0x8dcd('0x47')]);_0x3aa1f5[_0x8dcd('0x32')]=_[_0x8dcd('0x31')](_0x1b6d65[_0x8dcd('0x32')]);_0x3aa1f5[_0x8dcd('0x3a')]=_[_0x8dcd('0x33')](_0x3aa1f5[_0x8dcd('0x30')],_0x3aa1f5[_0x8dcd('0x32')]);_0x31c8fe[_0x8dcd('0x34')]=_[_0x8dcd('0x33')](_0x3aa1f5[_0x8dcd('0x30')],qs['fields'](_0x1b6d65[_0x8dcd('0x32')][_0x8dcd('0x35')]));_0x31c8fe[_0x8dcd('0x34')]=_0x31c8fe[_0x8dcd('0x34')][_0x8dcd('0x48')]?_0x31c8fe['attributes']:_0x3aa1f5[_0x8dcd('0x30')];_0x31c8fe[_0x8dcd('0x37')]=qs[_0x8dcd('0x38')](_0x1b6d65[_0x8dcd('0x32')]['sort']);_0x31c8fe[_0x8dcd('0x39')]=qs[_0x8dcd('0x3a')](_[_0x8dcd('0x3b')](_0x1b6d65[_0x8dcd('0x32')],_0x3aa1f5[_0x8dcd('0x3a')]));if(_0x1b6d65[_0x8dcd('0x32')][_0x8dcd('0x3c')]){_0x31c8fe[_0x8dcd('0x39')]=_[_0x8dcd('0x3d')](_0x31c8fe['where'],{'$or':_[_0x8dcd('0x2c')](_0x31c8fe[_0x8dcd('0x34')],function(_0x3fd774){var _0xf17390={};_0xf17390[_0x3fd774]={'$like':'%'+_0x1b6d65[_0x8dcd('0x32')][_0x8dcd('0x3c')]+'%'};return _0xf17390;})});}_0x31c8fe=_[_0x8dcd('0x3d')]({},_0x31c8fe,_0x1b6d65[_0x8dcd('0x3f')]);return _0x42223d['getAgents'](_0x31c8fe);}})[_0x8dcd('0x40')](function(_0x2a8c06){if(_0x2a8c06){_0x40a6bc=_0x2a8c06[_0x8dcd('0x48')];if(!_0x1b6d65[_0x8dcd('0x32')][_0x8dcd('0x96')]('nolimit')){_0x31c8fe[_0x8dcd('0x20')]=qs[_0x8dcd('0x20')](_0x1b6d65[_0x8dcd('0x32')][_0x8dcd('0x20')]);_0x31c8fe[_0x8dcd('0x22')]=qs['offset'](_0x1b6d65[_0x8dcd('0x32')][_0x8dcd('0x22')]);}return _0x42223d[_0x8dcd('0x97')](_0x31c8fe);}})[_0x8dcd('0x40')](function(_0x21e830){if(_0x21e830){return _0x21e830?{'count':_0x40a6bc,'rows':_0x21e830}:null;}})[_0x8dcd('0x40')](respondWithResult(_0x46956f,null))['catch'](handleError(_0x46956f,null));}; \ No newline at end of file +var _0x23bc=['SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','removeQueues','remove','ids','isArray','Voice','Mail','Sms','Openchannel','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','online','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','addAgents','Chat','Fax','removeAgents','Queue:remove','getAgents','length','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','update','then','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Team','includeAll','include','catch','show','rawAttributes','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','ChatQueueId'];(function(_0x30ae53,_0x5d4d89){var _0x23b11a=function(_0xc96998){while(--_0xc96998){_0x30ae53['push'](_0x30ae53['shift']());}};_0x23b11a(++_0x5d4d89);}(_0x23bc,0xcc));var _0xc23b=function(_0x2a6195,_0x1da416){_0x2a6195=_0x2a6195-0x0;var _0x976590=_0x23bc[_0x2a6195];return _0x976590;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc23b('0x0'));var jsonpatch=require(_0xc23b('0x1'));var rp=require(_0xc23b('0x2'));var moment=require(_0xc23b('0x3'));var BPromise=require(_0xc23b('0x4'));var Mustache=require('mustache');var util=require(_0xc23b('0x5'));var path=require(_0xc23b('0x6'));var sox=require('sox');var csv=require(_0xc23b('0x7'));var ejs=require(_0xc23b('0x8'));var fs=require('fs');var fs_extra=require(_0xc23b('0x9'));var _=require(_0xc23b('0xa'));var squel=require(_0xc23b('0xb'));var crypto=require(_0xc23b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc23b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc23b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc23b('0xe'));var as=require(_0xc23b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc23b('0x10'))(_0xc23b('0x11'));var utils=require('../../config/utils');var config=require(_0xc23b('0x12'));var licenseUtil=require(_0xc23b('0x13'));var db=require(_0xc23b('0x14'))['db'];config[_0xc23b('0x15')]=_[_0xc23b('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc23b('0x17'))(new Redis(config[_0xc23b('0x15')]));require(_0xc23b('0x18'))[_0xc23b('0x19')](socket);function respondWithStatusCode(_0x542f32,_0x173e85){_0x173e85=_0x173e85||0xcc;return function(_0x2fdf8e){if(_0x2fdf8e){return _0x542f32[_0xc23b('0x1a')](_0x173e85);}return _0x542f32[_0xc23b('0x1b')](_0x173e85)[_0xc23b('0x1c')]();};}function respondWithResult(_0x1d0c4b,_0x538e5b){_0x538e5b=_0x538e5b||0xc8;return function(_0x211fdd){if(_0x211fdd){return _0x1d0c4b[_0xc23b('0x1b')](_0x538e5b)['json'](_0x211fdd);}};}function respondWithFilteredResult(_0x3d6317,_0xf49c6d){return function(_0x140aa7){if(_0x140aa7){var _0x56c3ad=typeof _0xf49c6d[_0xc23b('0x1d')]==='undefined'&&typeof _0xf49c6d[_0xc23b('0x1e')]===_0xc23b('0x1f');var _0x32d66d=_0x140aa7['count'];var _0x55876d=_0x56c3ad?0x0:_0xf49c6d['offset'];var _0x37132d=_0x56c3ad?_0x140aa7[_0xc23b('0x20')]:_0xf49c6d['offset']+_0xf49c6d[_0xc23b('0x1e')];var _0x72a3b4;if(_0x37132d>=_0x32d66d){_0x37132d=_0x32d66d;_0x72a3b4=0xc8;}else{_0x72a3b4=0xce;}_0x3d6317['status'](_0x72a3b4);return _0x3d6317[_0xc23b('0x21')]('Content-Range',_0x55876d+'-'+_0x37132d+'/'+_0x32d66d)[_0xc23b('0x22')](_0x140aa7);}return null;};}function patchUpdates(_0x5a487d){return function(_0x310b38){try{jsonpatch[_0xc23b('0x23')](_0x310b38,_0x5a487d,!![]);}catch(_0x19a7ab){return BPromise[_0xc23b('0x24')](_0x19a7ab);}return _0x310b38['save']();};}function saveUpdates(_0x3cae34,_0x7098ff){return function(_0x300170){if(_0x300170){return _0x300170[_0xc23b('0x25')](_0x3cae34)[_0xc23b('0x26')](function(_0x558fa9){return _0x558fa9;});}return null;};}function handleEntityNotFound(_0x402d70,_0x1dcd18){return function(_0x5939af){if(!_0x5939af){_0x402d70[_0xc23b('0x1a')](0x194);}return _0x5939af;};}function handleError(_0x146c17,_0x5759e2){_0x5759e2=_0x5759e2||0x1f4;return function(_0x3b477b){logger[_0xc23b('0x27')](_0x3b477b[_0xc23b('0x28')]);if(_0x3b477b[_0xc23b('0x29')]){delete _0x3b477b[_0xc23b('0x29')];}_0x146c17['status'](_0x5759e2)[_0xc23b('0x2a')](_0x3b477b);};}exports[_0xc23b('0x2b')]=function(_0x5a5bff,_0x4114b8){var _0x431855={},_0x16a3b9={},_0x3c95b3={'count':0x0,'rows':[]};var _0x36b0c7=_[_0xc23b('0x2c')](db['Team']['rawAttributes'],function(_0x16e9f6){return{'name':_0x16e9f6['fieldName'],'type':_0x16e9f6[_0xc23b('0x2d')][_0xc23b('0x2e')]};});_0x16a3b9[_0xc23b('0x2f')]=_[_0xc23b('0x2c')](_0x36b0c7,_0xc23b('0x29'));_0x16a3b9[_0xc23b('0x30')]=_[_0xc23b('0x31')](_0x5a5bff[_0xc23b('0x30')]);_0x16a3b9[_0xc23b('0x32')]=_[_0xc23b('0x33')](_0x16a3b9['model'],_0x16a3b9['query']);_0x431855[_0xc23b('0x34')]=_[_0xc23b('0x33')](_0x16a3b9[_0xc23b('0x2f')],qs[_0xc23b('0x35')](_0x5a5bff[_0xc23b('0x30')][_0xc23b('0x35')]));_0x431855['attributes']=_0x431855['attributes']['length']?_0x431855[_0xc23b('0x34')]:_0x16a3b9[_0xc23b('0x2f')];if(!_0x5a5bff[_0xc23b('0x30')][_0xc23b('0x36')](_0xc23b('0x37'))){_0x431855[_0xc23b('0x1e')]=qs[_0xc23b('0x1e')](_0x5a5bff[_0xc23b('0x30')][_0xc23b('0x1e')]);_0x431855[_0xc23b('0x1d')]=qs[_0xc23b('0x1d')](_0x5a5bff[_0xc23b('0x30')][_0xc23b('0x1d')]);}_0x431855[_0xc23b('0x38')]=qs['sort'](_0x5a5bff['query'][_0xc23b('0x39')]);_0x431855['where']=qs[_0xc23b('0x32')](_[_0xc23b('0x3a')](_0x5a5bff['query'],_0x16a3b9[_0xc23b('0x32')]),_0x36b0c7);if(_0x5a5bff[_0xc23b('0x30')][_0xc23b('0x3b')]){_0x431855[_0xc23b('0x3c')]=_[_0xc23b('0x3d')](_0x431855['where'],{'$or':_[_0xc23b('0x2c')](_0x36b0c7,function(_0x3a5ed6){if(_0x3a5ed6[_0xc23b('0x2d')]!=='VIRTUAL'){var _0x3d8b65={};_0x3d8b65[_0x3a5ed6[_0xc23b('0x29')]]={'$like':'%'+_0x5a5bff['query'][_0xc23b('0x3b')]+'%'};return _0x3d8b65;}})});}_0x431855=_[_0xc23b('0x3d')]({},_0x431855,_0x5a5bff[_0xc23b('0x3e')]);var _0xea58d4={'where':_0x431855[_0xc23b('0x3c')]};return db[_0xc23b('0x3f')][_0xc23b('0x20')](_0xea58d4)[_0xc23b('0x26')](function(_0x14f2ab){_0x3c95b3[_0xc23b('0x20')]=_0x14f2ab;if(_0x5a5bff[_0xc23b('0x30')][_0xc23b('0x40')]){_0x431855[_0xc23b('0x41')]=[{'all':!![]}];}return db[_0xc23b('0x3f')]['findAll'](_0x431855);})[_0xc23b('0x26')](function(_0x585b3e){_0x3c95b3['rows']=_0x585b3e;return _0x3c95b3;})[_0xc23b('0x26')](respondWithFilteredResult(_0x4114b8,_0x431855))[_0xc23b('0x42')](handleError(_0x4114b8,null));};exports[_0xc23b('0x43')]=function(_0x154074,_0x126ce8){var _0x1dc8f0={'raw':![],'where':{'id':_0x154074['params']['id']}},_0x1475df={};_0x1475df[_0xc23b('0x2f')]=_[_0xc23b('0x31')](db['Team'][_0xc23b('0x44')]);_0x1475df['query']=_[_0xc23b('0x31')](_0x154074[_0xc23b('0x30')]);_0x1475df[_0xc23b('0x32')]=_[_0xc23b('0x33')](_0x1475df['model'],_0x1475df['query']);_0x1dc8f0[_0xc23b('0x34')]=_[_0xc23b('0x33')](_0x1475df['model'],qs['fields'](_0x154074[_0xc23b('0x30')][_0xc23b('0x35')]));_0x1dc8f0[_0xc23b('0x34')]=_0x1dc8f0[_0xc23b('0x34')]['length']?_0x1dc8f0[_0xc23b('0x34')]:_0x1475df[_0xc23b('0x2f')];if(_0x154074[_0xc23b('0x30')][_0xc23b('0x40')]){_0x1dc8f0[_0xc23b('0x41')]=[{'all':!![]}];}_0x1dc8f0=_[_0xc23b('0x3d')]({},_0x1dc8f0,_0x154074[_0xc23b('0x3e')]);return db[_0xc23b('0x3f')]['find'](_0x1dc8f0)[_0xc23b('0x26')](handleEntityNotFound(_0x126ce8,null))[_0xc23b('0x26')](respondWithResult(_0x126ce8,null))[_0xc23b('0x42')](handleError(_0x126ce8,null));};exports[_0xc23b('0x45')]=function(_0x567545,_0x280927){return db[_0xc23b('0x3f')]['create'](_0x567545[_0xc23b('0x46')],{})[_0xc23b('0x26')](function(_0x1742a7){var _0x29d804=_0x567545['user'][_0xc23b('0x47')]({'plain':!![]});if(!_0x29d804)throw new Error(_0xc23b('0x48'));if(_0x29d804[_0xc23b('0x49')]===_0xc23b('0x4a')){var _0x116f58=_0x1742a7[_0xc23b('0x47')]({'plain':!![]});var _0x449622=_0xc23b('0x4b');return db['UserProfileSection'][_0xc23b('0x4c')]({'where':{'name':_0x449622,'userProfileId':_0x29d804[_0xc23b('0x4d')]},'raw':!![]})[_0xc23b('0x26')](function(_0x582fc3){if(_0x582fc3&&_0x582fc3['autoAssociation']===0x0){return db[_0xc23b('0x4e')][_0xc23b('0x45')]({'name':_0x116f58[_0xc23b('0x29')],'resourceId':_0x116f58['id'],'type':_0x582fc3['name'],'sectionId':_0x582fc3['id']},{})['then'](function(){return _0x1742a7;});}else{return _0x1742a7;}})[_0xc23b('0x42')](function(_0x354513){logger[_0xc23b('0x27')](_0xc23b('0x4f'),_0x354513);throw _0x354513;});}return _0x1742a7;})[_0xc23b('0x26')](respondWithResult(_0x280927,0xc9))[_0xc23b('0x42')](handleError(_0x280927,null));};exports['update']=function(_0x4ebbea,_0x20f816){if(_0x4ebbea[_0xc23b('0x46')]['id']){delete _0x4ebbea[_0xc23b('0x46')]['id'];}return db[_0xc23b('0x3f')][_0xc23b('0x4c')]({'where':{'id':_0x4ebbea[_0xc23b('0x50')]['id']}})[_0xc23b('0x26')](handleEntityNotFound(_0x20f816,null))['then'](saveUpdates(_0x4ebbea[_0xc23b('0x46')],null))['then'](respondWithResult(_0x20f816,null))[_0xc23b('0x42')](handleError(_0x20f816,null));};exports[_0xc23b('0x51')]=function(_0x57eaa5,_0x4d8cc4){var _0x109b6c=_0x57eaa5['params']['id'];var _0x57b401=[];return db[_0xc23b('0x52')]['transaction'](function(_0x48da8b){var _0x1671be='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x109b6c;return db[_0xc23b('0x52')][_0xc23b('0x30')](_0x1671be,{'type':db[_0xc23b('0x53')][_0xc23b('0x54')][_0xc23b('0x55')],'raw':!![],'transaction':_0x48da8b})[_0xc23b('0x26')](function(_0x3120fb){_0x57b401=_[_0xc23b('0x2c')](_0x3120fb,function(_0x2a7dee){return Number(_0x2a7dee[_0xc23b('0x56')]);});})[_0xc23b('0x26')](function(){var _0x4ffac9=_0xc23b('0x57')+_0x109b6c;return db[_0xc23b('0x52')][_0xc23b('0x30')](_0x4ffac9,{'type':db[_0xc23b('0x53')][_0xc23b('0x54')][_0xc23b('0x55')],'raw':!![],'transaction':_0x48da8b});})['then'](function(_0x1fa8bf){var _0x54d194=_[_0xc23b('0x2c')](_0x1fa8bf,function(_0x173136){return Number(_0x173136[_0xc23b('0x58')]);});return db['UserVoiceQueue'][_0xc23b('0x51')]({'where':{'UserId':{'$in':_0x57b401},'VoiceQueueId':{'$in':_0x54d194}},'transaction':_0x48da8b});})['then'](function(){var _0x346cd6='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x109b6c;return db[_0xc23b('0x52')][_0xc23b('0x30')](_0x346cd6,{'type':db['Sequelize'][_0xc23b('0x54')][_0xc23b('0x55')],'raw':!![],'transaction':_0x48da8b});})['then'](function(_0x8492e6){var _0x1abc89=_['map'](_0x8492e6,function(_0x335c99){return Number(_0x335c99[_0xc23b('0x59')]);});return db[_0xc23b('0x5a')]['destroy']({'where':{'UserId':{'$in':_0x57b401},'MailQueueId':{'$in':_0x1abc89}},'transaction':_0x48da8b});})[_0xc23b('0x26')](function(){var _0x5d35a8=_0xc23b('0x5b')+_0x109b6c;return db['sequelize'][_0xc23b('0x30')](_0x5d35a8,{'type':db['Sequelize'][_0xc23b('0x54')][_0xc23b('0x55')],'raw':!![],'transaction':_0x48da8b});})[_0xc23b('0x26')](function(_0x45429d){var _0x41f6e5=_[_0xc23b('0x2c')](_0x45429d,function(_0x24a535){return Number(_0x24a535[_0xc23b('0x5c')]);});return db['UserSmsQueue'][_0xc23b('0x51')]({'where':{'UserId':{'$in':_0x57b401},'SmsQueueId':{'$in':_0x41f6e5}},'transaction':_0x48da8b});})['then'](function(){var _0x1f7507='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x109b6c;return db['sequelize'][_0xc23b('0x30')](_0x1f7507,{'type':db[_0xc23b('0x53')][_0xc23b('0x54')][_0xc23b('0x55')],'raw':!![],'transaction':_0x48da8b});})[_0xc23b('0x26')](function(_0x58394f){var _0x68b95e=_['map'](_0x58394f,function(_0x2eba4d){return Number(_0x2eba4d[_0xc23b('0x5d')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x57b401},'ChatQueueId':{'$in':_0x68b95e}},'transaction':_0x48da8b});})['then'](function(){var _0x189d9d=_0xc23b('0x5e')+_0x109b6c;return db['sequelize']['query'](_0x189d9d,{'type':db[_0xc23b('0x53')][_0xc23b('0x54')]['SELECT'],'raw':!![],'transaction':_0x48da8b});})['then'](function(_0x355a2d){var _0x3a7a92=_[_0xc23b('0x2c')](_0x355a2d,function(_0x5040f9){return Number(_0x5040f9[_0xc23b('0x5f')]);});return db[_0xc23b('0x60')][_0xc23b('0x51')]({'where':{'UserId':{'$in':_0x57b401},'FaxQueueId':{'$in':_0x3a7a92}},'transaction':_0x48da8b});})[_0xc23b('0x26')](function(){var _0x289d87=_0xc23b('0x61')+_0x109b6c;return db[_0xc23b('0x52')][_0xc23b('0x30')](_0x289d87,{'type':db['Sequelize'][_0xc23b('0x54')][_0xc23b('0x55')],'raw':!![],'transaction':_0x48da8b});})[_0xc23b('0x26')](function(_0x5b33d3){var _0x27799d=_[_0xc23b('0x2c')](_0x5b33d3,function(_0x379190){return Number(_0x379190[_0xc23b('0x62')]);});return db[_0xc23b('0x63')]['destroy']({'where':{'UserId':{'$in':_0x57b401},'OpenchannelQueueId':{'$in':_0x27799d}},'transaction':_0x48da8b});})[_0xc23b('0x26')](function(){var _0x5b8ced='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x109b6c;return db['sequelize'][_0xc23b('0x30')](_0x5b8ced,{'type':db[_0xc23b('0x53')][_0xc23b('0x54')][_0xc23b('0x55')],'raw':!![],'transaction':_0x48da8b});})[_0xc23b('0x26')](function(_0x293783){var _0x18d26e=_['map'](_0x293783,function(_0x3cca35){return Number(_0x3cca35[_0xc23b('0x64')]);});return db[_0xc23b('0x65')]['destroy']({'where':{'UserId':{'$in':_0x57b401},'WhatsappQueueId':{'$in':_0x18d26e}},'transaction':_0x48da8b});})['then'](function(){return db[_0xc23b('0x66')][_0xc23b('0x4c')]({'where':{'TeamId':_0x109b6c}});})[_0xc23b('0x26')](function(_0x2d8aa4){if(_0x2d8aa4===null){return;}return db[_0xc23b('0x67')][_0xc23b('0x51')]({'where':{'UserId':{'$in':_0x57b401},'VoicePrefixId':_0x2d8aa4[_0xc23b('0x68')]},'transaction':_0x48da8b});})['then'](function(){return db[_0xc23b('0x3f')][_0xc23b('0x51')]({'where':{'id':_0x109b6c},'cascade':!![],'transaction':_0x48da8b});})[_0xc23b('0x26')](function(_0x3439f3){if(_0x3439f3===0x0){_0x4d8cc4[_0xc23b('0x1a')](0x194);}else{return db[_0xc23b('0x4e')]['destroy']({'where':{'type':_0xc23b('0x4b'),'resourceId':_0x109b6c},'cascade':!![],'transaction':_0x48da8b})[_0xc23b('0x26')](function(){_0x4d8cc4['status'](0xcc)[_0xc23b('0x1c')]();});}})[_0xc23b('0x42')](function(_0x5c9239){_0x4d8cc4['status'](0x1f4)[_0xc23b('0x2a')](_0x5c9239);});});};exports[_0xc23b('0x69')]=function(_0x74f865,_0x3bf98b,_0x41d920){return db['Team'][_0xc23b('0x6a')]({'where':{'id':_0x74f865[_0xc23b('0x50')]['id']}})[_0xc23b('0x26')](handleEntityNotFound(_0x3bf98b,null))[_0xc23b('0x26')](function(_0x292bd5){if(!_0x74f865[_0xc23b('0x30')][_0xc23b('0x6b')]||!utils[_0xc23b('0x6c')](_0x74f865[_0xc23b('0x30')]['channel'])){throw new db[(_0xc23b('0x53'))][(_0xc23b('0x6d'))](_0xc23b('0x6e'));}var _0x13ed06={};var _0x313d72={};_0x313d72[_0xc23b('0x2f')]=_[_0xc23b('0x31')](db[_[_0xc23b('0x6f')](_0x74f865[_0xc23b('0x30')][_0xc23b('0x6b')][_0xc23b('0x70')]())+_0xc23b('0x71')][_0xc23b('0x44')]);_0x313d72[_0xc23b('0x30')]=_[_0xc23b('0x31')](_0x74f865['query']);_0x313d72[_0xc23b('0x32')]=_[_0xc23b('0x33')](_0x313d72['model'],_0x313d72[_0xc23b('0x30')]);_0x13ed06['attributes']=_['intersection'](_0x313d72[_0xc23b('0x2f')],qs[_0xc23b('0x35')](_0x74f865[_0xc23b('0x30')][_0xc23b('0x35')]));_0x13ed06[_0xc23b('0x34')]=_0x13ed06[_0xc23b('0x34')]['length']?_0x13ed06[_0xc23b('0x34')]:_0x313d72['model'];_0x13ed06[_0xc23b('0x1e')]=qs['limit'](_0x74f865[_0xc23b('0x30')][_0xc23b('0x1e')]);_0x13ed06[_0xc23b('0x1d')]=qs[_0xc23b('0x1d')](_0x74f865[_0xc23b('0x30')]['offset']);_0x13ed06[_0xc23b('0x38')]=qs['sort'](_0x74f865[_0xc23b('0x30')]['sort']);_0x13ed06[_0xc23b('0x3c')]=qs[_0xc23b('0x32')](_[_0xc23b('0x3a')](_0x74f865['query'],_0x313d72[_0xc23b('0x32')]));_0x13ed06=_[_0xc23b('0x3d')]({},_0x13ed06,_0x74f865[_0xc23b('0x3e')]);return _0x292bd5[_0xc23b('0x47')+_[_0xc23b('0x6f')](_0x74f865['query'][_0xc23b('0x6b')][_0xc23b('0x70')]())+_0xc23b('0x72')](_0x13ed06);})[_0xc23b('0x26')](respondWithResult(_0x3bf98b,null))[_0xc23b('0x42')](handleError(_0x3bf98b,null));};exports[_0xc23b('0x73')]=function(_0x3e09b8,_0x749511,_0x201320){return db[_0xc23b('0x3f')]['findOne']({'where':{'id':_0x3e09b8[_0xc23b('0x50')]['id']}})[_0xc23b('0x26')](function(_0x4636de){if(_0x4636de){if(!_0x3e09b8[_0xc23b('0x46')]['channel']||!utils[_0xc23b('0x6c')](_0x3e09b8['body'][_0xc23b('0x6b')])){throw new db[(_0xc23b('0x53'))]['ValidationError']('Unknown\x20channel');}return _0x4636de['add'+_[_0xc23b('0x6f')](_0x3e09b8[_0xc23b('0x46')][_0xc23b('0x6b')]['toLowerCase']())+_0xc23b('0x72')](_0x3e09b8[_0xc23b('0x46')]['ids']);}return null;})['then'](handleEntityNotFound(_0x749511,null))[_0xc23b('0x26')](respondWithStatusCode(_0x749511,null))['catch'](handleError(_0x749511,null));};exports[_0xc23b('0x74')]=function(_0x4b4733,_0x34322e,_0x59d9ed){return db[_0xc23b('0x3f')][_0xc23b('0x6a')]({'where':{'id':_0x4b4733[_0xc23b('0x50')]['id']}})[_0xc23b('0x26')](function(_0x11cceb){if(_0x11cceb){if(!_0x4b4733[_0xc23b('0x30')][_0xc23b('0x6b')]||!utils[_0xc23b('0x6c')](_0x4b4733[_0xc23b('0x30')][_0xc23b('0x6b')])){throw new db[(_0xc23b('0x53'))][(_0xc23b('0x6d'))](_0xc23b('0x6e'));}return _0x11cceb[_0xc23b('0x75')+_[_0xc23b('0x6f')](_0x4b4733[_0xc23b('0x30')][_0xc23b('0x6b')][_0xc23b('0x70')]())+_0xc23b('0x72')](_0x4b4733[_0xc23b('0x30')][_0xc23b('0x76')]);}return null;})['then'](handleEntityNotFound(_0x34322e,null))[_0xc23b('0x26')](respondWithStatusCode(_0x34322e,null))[_0xc23b('0x42')](handleError(_0x34322e,null));};exports['addAgents']=function(_0x56ec9f,_0x42dc37){var _0x59ab28=_[_0xc23b('0x77')](_0x56ec9f[_0xc23b('0x46')]['ids'])?_0x56ec9f['body'][_0xc23b('0x76')]:[_0x56ec9f[_0xc23b('0x46')][_0xc23b('0x76')]];var _0x4689f3=_0x56ec9f[_0xc23b('0x50')]['id'];return db[_0xc23b('0x3f')]['find']({'where':{'id':_0x4689f3}})[_0xc23b('0x26')](handleEntityNotFound(_0x42dc37,null))[_0xc23b('0x26')](function(_0x2ac993){if(_0x2ac993){var _0x5275ad=[_0xc23b('0x78'),'Chat',_0xc23b('0x79'),_0xc23b('0x7a'),'Fax',_0xc23b('0x7b'),_0xc23b('0x7c')];return db[_0xc23b('0x52')][_0xc23b('0x7d')](function(_0x4360e2){var _0x5ae444=_[_0xc23b('0x2c')](_0x5275ad,function(_0x5608b5){var _0x338acf={'attributes':['id',_0xc23b('0x29')]};if(_0x5608b5===_0xc23b('0x78')){_0x338acf['through']={'attributes':[_0xc23b('0x7e')]};}return _0x2ac993[_0xc23b('0x47')+_0x5608b5+'Queues'](_0x338acf)[_0xc23b('0x26')](function(_0x2f3a03){var _0x59c0ca=_[_0xc23b('0x2c')](_0x2f3a03,function(_0x302a85){var _0x417491=_[_0xc23b('0x2c')](_0x59ab28,function(_0x3e59a0){var _0x3599d2={'where':{'UserId':_0x3e59a0,[_0x5608b5+_0xc23b('0x7f')]:_0x302a85['id']},'transaction':_0x4360e2};if(_0x5608b5===_0xc23b('0x78')){_0x3599d2['defaults']={'penalty':_0x302a85[_0xc23b('0x80')][_0xc23b('0x7e')]};}return db[_0xc23b('0x81')+_0x5608b5+_0xc23b('0x71')][_0xc23b('0x82')](_0x3599d2)['then'](function(){socket[_0xc23b('0x83')]('user'+_0x5608b5+_0xc23b('0x84'),{'UserId':_0x3e59a0,[_0x5608b5+_0xc23b('0x7f')]:_0x302a85['id']});if(_0x5608b5!=='Voice'){return;}return db[_0xc23b('0x81')][_0xc23b('0x85')]({'where':{'id':_0x59ab28,'online':0x1},'attributes':['id','name',_0xc23b('0x86'),'voicePause',_0xc23b('0x87')],'raw':!![]})[_0xc23b('0x26')](function(_0x5bc946){var _0x14d4de=_[_0xc23b('0x2c')](_0x5bc946,function(_0x303419){return db[_0xc23b('0x88')]['upsert']({'membername':_0x303419['name'],'UserId':_0x303419['id'],'queue_name':_0x302a85[_0xc23b('0x29')],'VoiceQueueId':_0x302a85['id'],'interface':_[_0xc23b('0x89')](_0x303419[_0xc23b('0x87')])?util[_0xc23b('0x8a')](_0xc23b('0x8b'),_0x303419[_0xc23b('0x29')]):_0x303419[_0xc23b('0x87')],'paused':_0x303419['voicePause']||![],'penalty':_0x302a85[_0xc23b('0x80')][_0xc23b('0x7e')]},{'transaction':_0x4360e2});});return Promise[_0xc23b('0x8c')](_0x14d4de);});});});return Promise[_0xc23b('0x8c')](_0x417491);});return Promise[_0xc23b('0x8c')](_0x59c0ca);})[_0xc23b('0x26')](function(){return db[_0xc23b('0x66')][_0xc23b('0x6a')]({'where':{'teamId':_0x4689f3}})[_0xc23b('0x26')](function(_0x4ab13b){if(_0x4ab13b){var _0x26864c=_[_0xc23b('0x2c')](_0x59ab28,function(_0x1318f1){db[_0xc23b('0x67')][_0xc23b('0x8d')]({'UserId':_0x1318f1,'VoicePrefixId':_0x4ab13b[_0xc23b('0x68')]});});return Promise[_0xc23b('0x8c')](_0x26864c);}});});});return Promise[_0xc23b('0x8c')](_0x5ae444)[_0xc23b('0x26')](function(){return _0x2ac993[_0xc23b('0x8e')](_0x59ab28,{'transaction':_0x4360e2})['spread'](function(_0x12f374){return _0x12f374;});});});}})[_0xc23b('0x26')](respondWithResult(_0x42dc37,null))['catch'](handleError(_0x42dc37,null));};exports['removeAgents']=function(_0x5353f4,_0xc0ef7e){var _0x49a2d0=_['isArray'](_0x5353f4[_0xc23b('0x30')]['ids'])?_0x5353f4[_0xc23b('0x30')][_0xc23b('0x76')]:[_0x5353f4['query'][_0xc23b('0x76')]];var _0x17a5b6=_0x5353f4[_0xc23b('0x50')]['id'];return db[_0xc23b('0x3f')][_0xc23b('0x4c')]({'where':{'id':_0x17a5b6}})['then'](handleEntityNotFound(_0xc0ef7e,null))['then'](function(_0xed2609){if(_0xed2609){var _0x3387a9=['Voice',_0xc23b('0x8f'),_0xc23b('0x79'),_0xc23b('0x7a'),_0xc23b('0x90'),_0xc23b('0x7b'),_0xc23b('0x7c')];return db[_0xc23b('0x52')][_0xc23b('0x7d')](function(_0x305fde){var _0x20747a=_[_0xc23b('0x2c')](_0x3387a9,function(_0x4d5bfe){var _0x200246={'attributes':['id',_0xc23b('0x29')]};return _0xed2609['get'+_0x4d5bfe+_0xc23b('0x72')](_0x200246)[_0xc23b('0x26')](function(_0xe12258){var _0x54fa0f=_['map'](_0xe12258,function(_0x1f2562){return _0x1f2562[_0xc23b('0x91')](_0x49a2d0,{'transaction':_0x305fde})[_0xc23b('0x26')](function(){var _0x22091e=_[_0xc23b('0x2c')](_0x49a2d0,function(_0x16f338){socket[_0xc23b('0x83')]('user'+_0x4d5bfe+_0xc23b('0x92'),{'UserId':Number(_0x16f338),[_0x4d5bfe+_0xc23b('0x7f')]:_0x1f2562['id']});if(_0x4d5bfe!==_0xc23b('0x78')){return;}return db[_0xc23b('0x88')][_0xc23b('0x51')]({'where':{'VoiceQueueId':_0x1f2562['id'],'UserId':_0x16f338},'transaction':_0x305fde});});return Promise[_0xc23b('0x8c')](_0x22091e);});});return Promise[_0xc23b('0x8c')](_0x54fa0f);});});return Promise[_0xc23b('0x8c')](_0x20747a)[_0xc23b('0x26')](function(){return _0xed2609[_0xc23b('0x91')](_0x49a2d0,{'transaction':_0x305fde});})[_0xc23b('0x26')](function(){return db[_0xc23b('0x66')][_0xc23b('0x6a')]({'where':{'teamId':_0x17a5b6}})[_0xc23b('0x26')](function(_0x285ede){if(_0x285ede){var _0x40882c=_[_0xc23b('0x2c')](_0x49a2d0,function(_0x25d764){db[_0xc23b('0x67')][_0xc23b('0x51')]({'where':{'UserId':_0x25d764,'VoicePrefixId':_0x285ede[_0xc23b('0x68')]}});});return Promise[_0xc23b('0x8c')](_0x40882c);}});});});}})[_0xc23b('0x26')](respondWithStatusCode(_0xc0ef7e,null))[_0xc23b('0x42')](handleError(_0xc0ef7e,null));};exports[_0xc23b('0x93')]=function(_0x188fbf,_0x212d76,_0x4fc143){var _0x44534c={};var _0x47a15e={};var _0x113d6d;var _0x32df84;return db[_0xc23b('0x3f')][_0xc23b('0x6a')]({'where':{'id':_0x188fbf[_0xc23b('0x50')]['id']}})[_0xc23b('0x26')](handleEntityNotFound(_0x212d76,null))[_0xc23b('0x26')](function(_0x3bde78){if(_0x3bde78){_0x113d6d=_0x3bde78;_0x47a15e[_0xc23b('0x2f')]=_[_0xc23b('0x31')](db[_0xc23b('0x81')][_0xc23b('0x44')]);_0x47a15e[_0xc23b('0x30')]=_[_0xc23b('0x31')](_0x188fbf['query']);_0x47a15e[_0xc23b('0x32')]=_['intersection'](_0x47a15e[_0xc23b('0x2f')],_0x47a15e[_0xc23b('0x30')]);_0x44534c[_0xc23b('0x34')]=_[_0xc23b('0x33')](_0x47a15e[_0xc23b('0x2f')],qs[_0xc23b('0x35')](_0x188fbf['query'][_0xc23b('0x35')]));_0x44534c[_0xc23b('0x34')]=_0x44534c[_0xc23b('0x34')][_0xc23b('0x94')]?_0x44534c['attributes']:_0x47a15e[_0xc23b('0x2f')];_0x44534c[_0xc23b('0x38')]=qs[_0xc23b('0x39')](_0x188fbf[_0xc23b('0x30')][_0xc23b('0x39')]);_0x44534c['where']=qs[_0xc23b('0x32')](_[_0xc23b('0x3a')](_0x188fbf[_0xc23b('0x30')],_0x47a15e[_0xc23b('0x32')]));if(_0x188fbf[_0xc23b('0x30')][_0xc23b('0x3b')]){_0x44534c[_0xc23b('0x3c')]=_[_0xc23b('0x3d')](_0x44534c['where'],{'$or':_[_0xc23b('0x2c')](_0x44534c['attributes'],function(_0x3c6514){var _0x1df2e5={};_0x1df2e5[_0x3c6514]={'$like':'%'+_0x188fbf['query'][_0xc23b('0x3b')]+'%'};return _0x1df2e5;})});}_0x44534c=_[_0xc23b('0x3d')]({},_0x44534c,_0x188fbf[_0xc23b('0x3e')]);return _0x113d6d[_0xc23b('0x93')](_0x44534c);}})[_0xc23b('0x26')](function(_0x30f374){if(_0x30f374){_0x32df84=_0x30f374['length'];if(!_0x188fbf['query'][_0xc23b('0x36')]('nolimit')){_0x44534c[_0xc23b('0x1e')]=qs[_0xc23b('0x1e')](_0x188fbf['query'][_0xc23b('0x1e')]);_0x44534c[_0xc23b('0x1d')]=qs[_0xc23b('0x1d')](_0x188fbf['query'][_0xc23b('0x1d')]);}return _0x113d6d['getAgents'](_0x44534c);}})['then'](function(_0x3e78d3){if(_0x3e78d3){return _0x3e78d3?{'count':_0x32df84,'rows':_0x3e78d3}:null;}})['then'](respondWithResult(_0x212d76,null))[_0xc23b('0x42')](handleError(_0x212d76,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ec544b9..bc99293 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 _0xcb61=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','Team','save'];(function(_0xb5e64,_0x2f9dfe){var _0x5c6e07=function(_0x13d88e){while(--_0x13d88e){_0xb5e64['push'](_0xb5e64['shift']());}};_0x5c6e07(++_0x2f9dfe);}(_0xcb61,0x16d));var _0x1cb6=function(_0x3c1aa8,_0x8b693a){_0x3c1aa8=_0x3c1aa8-0x0;var _0x4f76e3=_0xcb61[_0x3c1aa8];return _0x4f76e3;};'use strict';var EventEmitter=require('events');var Team=require(_0x1cb6('0x0'))['db'][_0x1cb6('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cb6('0x2'),'afterUpdate':_0x1cb6('0x3'),'afterDestroy':_0x1cb6('0x4')};function emitEvent(_0x87f6e9){return function(_0x559c36,_0x39ce84,_0x41e703){TeamEvents[_0x1cb6('0x5')](_0x87f6e9+':'+_0x559c36['id'],_0x559c36);TeamEvents['emit'](_0x87f6e9,_0x559c36);_0x41e703(null);};}for(var e in events){if(events[_0x1cb6('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x1cb6('0x7')]=TeamEvents; \ No newline at end of file +var _0x2394=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb','Team'];(function(_0x3bb285,_0x474a01){var _0x443ac5=function(_0x36c20b){while(--_0x36c20b){_0x3bb285['push'](_0x3bb285['shift']());}};_0x443ac5(++_0x474a01);}(_0x2394,0x178));var _0x4239=function(_0x9a49fa,_0x2b509c){_0x9a49fa=_0x9a49fa-0x0;var _0x41e47d=_0x2394[_0x9a49fa];return _0x41e47d;};'use strict';var EventEmitter=require('events');var Team=require(_0x4239('0x0'))['db'][_0x4239('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x4239('0x2')](0x0);var events={'afterCreate':_0x4239('0x3'),'afterUpdate':_0x4239('0x4'),'afterDestroy':_0x4239('0x5')};function emitEvent(_0xf63ab7){return function(_0x41f4bb,_0x92ed75,_0x21a6c7){TeamEvents['emit'](_0xf63ab7+':'+_0x41f4bb['id'],_0x41f4bb);TeamEvents[_0x4239('0x6')](_0xf63ab7,_0x41f4bb);_0x21a6c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x4239('0x7')](e,emitEvent(event));}}module[_0x4239('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 7be703f..20dd706 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 _0xc87f=['moment','bluebird','path','rimraf','../../config/environment','./team.attributes','exports','Team','teams','lodash','util','../../config/logger','api'];(function(_0x3a424f,_0x25026d){var _0x13f4d2=function(_0x54cec7){while(--_0x54cec7){_0x3a424f['push'](_0x3a424f['shift']());}};_0x13f4d2(++_0x25026d);}(_0xc87f,0xf3));var _0xfc87=function(_0x23cc9e,_0x42e7db){_0x23cc9e=_0x23cc9e-0x0;var _0xb93712=_0xc87f[_0x23cc9e];return _0xb93712;};'use strict';var _=require(_0xfc87('0x0'));var util=require(_0xfc87('0x1'));var logger=require(_0xfc87('0x2'))(_0xfc87('0x3'));var moment=require(_0xfc87('0x4'));var BPromise=require(_0xfc87('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc87('0x6'));var rimraf=require(_0xfc87('0x7'));var config=require(_0xfc87('0x8'));var attributes=require(_0xfc87('0x9'));module[_0xfc87('0xa')]=function(_0x3c1481,_0x15cb73){return _0x3c1481['define'](_0xfc87('0xb'),attributes,{'tableName':_0xfc87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e93=['teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e93,0x1a5));var _0x35e9=function(_0x6afeef,_0x16cf77){_0x6afeef=_0x6afeef-0x0;var _0x3f626b=_0x5e93[_0x6afeef];return _0x3f626b;};'use strict';var _=require(_0x35e9('0x0'));var util=require(_0x35e9('0x1'));var logger=require(_0x35e9('0x2'))(_0x35e9('0x3'));var moment=require(_0x35e9('0x4'));var BPromise=require(_0x35e9('0x5'));var rp=require(_0x35e9('0x6'));var fs=require('fs');var path=require(_0x35e9('0x7'));var rimraf=require(_0x35e9('0x8'));var config=require(_0x35e9('0x9'));var attributes=require(_0x35e9('0xa'));module[_0x35e9('0xb')]=function(_0xfca644,_0x357802){return _0xfca644[_0x35e9('0xc')](_0x35e9('0xd'),attributes,{'tableName':_0x35e9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 7144812..67caa28 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 _0xdf82=['./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x2243a1,_0x34b228){var _0x47d17d=function(_0x51d220){while(--_0x51d220){_0x2243a1['push'](_0x2243a1['shift']());}};_0x47d17d(++_0x34b228);}(_0xdf82,0x182));var _0x2df8=function(_0x4ab7f0,_0xf96672){_0x4ab7f0=_0x4ab7f0-0x0;var _0x2cc302=_0xdf82[_0x4ab7f0];return _0x2cc302;};'use strict';var _=require(_0x2df8('0x0'));var util=require(_0x2df8('0x1'));var moment=require('moment');var BPromise=require(_0x2df8('0x2'));var rs=require(_0x2df8('0x3'));var fs=require('fs');var Redis=require(_0x2df8('0x4'));var db=require(_0x2df8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2df8('0x6'));var config=require(_0x2df8('0x7'));var jayson=require(_0x2df8('0x8'));var client=jayson[_0x2df8('0x9')]['http']({'port':0x232a});config[_0x2df8('0xa')]=_[_0x2df8('0xb')](config['redis'],{'host':_0x2df8('0xc'),'port':0x18eb});var socket=require(_0x2df8('0xd'))(new Redis(config[_0x2df8('0xa')]));require(_0x2df8('0xe'))['register'](socket);function respondWithRpcPromise(_0x22db80,_0x440fad,_0x30aa10){return new BPromise(function(_0x49c9fc,_0x43a31a){return client[_0x2df8('0xf')](_0x22db80,_0x30aa10)[_0x2df8('0x10')](function(_0x1e52d6){logger[_0x2df8('0x11')](_0x2df8('0x12'),_0x440fad,_0x2df8('0x13'));logger['debug'](_0x2df8('0x14'),_0x440fad,_0x2df8('0x13'),JSON[_0x2df8('0x15')](_0x1e52d6));if(_0x1e52d6[_0x2df8('0x16')]){if(_0x1e52d6['error'][_0x2df8('0x17')]===0x1f4){logger[_0x2df8('0x16')](_0x2df8('0x12'),_0x440fad,_0x1e52d6['error'][_0x2df8('0x18')]);return _0x43a31a(_0x1e52d6[_0x2df8('0x16')]['message']);}logger['error'](_0x2df8('0x12'),_0x440fad,_0x1e52d6['error'][_0x2df8('0x18')]);return _0x49c9fc(_0x1e52d6[_0x2df8('0x16')][_0x2df8('0x18')]);}else{logger['info'](_0x2df8('0x12'),_0x440fad,_0x2df8('0x13'));_0x49c9fc(_0x1e52d6['result'][_0x2df8('0x18')]);}})['catch'](function(_0x2a49fb){logger[_0x2df8('0x16')](_0x2df8('0x12'),_0x440fad,_0x2a49fb);_0x43a31a(_0x2a49fb);});});} \ No newline at end of file +var _0x9264=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash'];(function(_0x2af744,_0x4c2e34){var _0x2d6e6d=function(_0xb6d270){while(--_0xb6d270){_0x2af744['push'](_0x2af744['shift']());}};_0x2d6e6d(++_0x4c2e34);}(_0x9264,0xae));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var moment=require(_0x4926('0x2'));var BPromise=require(_0x4926('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4926('0x4'));var db=require(_0x4926('0x5'))['db'];var utils=require(_0x4926('0x6'));var logger=require(_0x4926('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4926('0x8'));var client=jayson['client'][_0x4926('0x9')]({'port':0x232a});config['redis']=_[_0x4926('0xa')](config[_0x4926('0xb')],{'host':_0x4926('0xc'),'port':0x18eb});var socket=require(_0x4926('0xd'))(new Redis(config[_0x4926('0xb')]));require('./team.socket')[_0x4926('0xe')](socket);function respondWithRpcPromise(_0x25079f,_0x8e7092,_0x1d46ab){return new BPromise(function(_0xe8e37e,_0x415125){return client[_0x4926('0xf')](_0x25079f,_0x1d46ab)['then'](function(_0x211afa){logger[_0x4926('0x10')](_0x4926('0x11'),_0x8e7092,_0x4926('0x12'));logger['debug'](_0x4926('0x13'),_0x8e7092,_0x4926('0x12'),JSON['stringify'](_0x211afa));if(_0x211afa['error']){if(_0x211afa['error'][_0x4926('0x14')]===0x1f4){logger[_0x4926('0x15')](_0x4926('0x11'),_0x8e7092,_0x211afa[_0x4926('0x15')][_0x4926('0x16')]);return _0x415125(_0x211afa['error']['message']);}logger['error'](_0x4926('0x11'),_0x8e7092,_0x211afa['error'][_0x4926('0x16')]);return _0xe8e37e(_0x211afa[_0x4926('0x15')]['message']);}else{logger[_0x4926('0x10')](_0x4926('0x11'),_0x8e7092,_0x4926('0x12'));_0xe8e37e(_0x211afa[_0x4926('0x17')]['message']);}})[_0x4926('0x18')](function(_0x3fde52){logger[_0x4926('0x15')](_0x4926('0x11'),_0x8e7092,_0x3fde52);_0x415125(_0x3fde52);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d29a41d..396b0d6 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 _0x809a=['./team.events','save','remove','update','removeListener','team:'];(function(_0x37fce7,_0x37086f){var _0x5511b2=function(_0x2dfc56){while(--_0x2dfc56){_0x37fce7['push'](_0x37fce7['shift']());}};_0x5511b2(++_0x37086f);}(_0x809a,0x186));var _0xa809=function(_0x2480f1,_0x17f69d){_0x2480f1=_0x2480f1-0x0;var _0x1e4275=_0x809a[_0x2480f1];return _0x1e4275;};'use strict';var TeamEvents=require(_0xa809('0x0'));var events=[_0xa809('0x1'),_0xa809('0x2'),_0xa809('0x3')];function createListener(_0x162892,_0x4a33df){return function(_0x5ed68f){_0x4a33df['emit'](_0x162892,_0x5ed68f);};}function removeListener(_0x571022,_0x548fb6){return function(){TeamEvents[_0xa809('0x4')](_0x571022,_0x548fb6);};}exports['register']=function(_0x2c6237){for(var _0x4a161d=0x0,_0x1920ea=events['length'];_0x4a161d<_0x1920ea;_0x4a161d++){var _0x1458fe=events[_0x4a161d];var _0x4f1545=createListener(_0xa809('0x5')+_0x1458fe,_0x2c6237);TeamEvents['on'](_0x1458fe,_0x4f1545);}}; \ No newline at end of file +var _0x3bbd=['./team.events','save','remove','update','removeListener','length','team:'];(function(_0x51da7c,_0x38d174){var _0x18ad9a=function(_0x3c4f44){while(--_0x3c4f44){_0x51da7c['push'](_0x51da7c['shift']());}};_0x18ad9a(++_0x38d174);}(_0x3bbd,0x1b2));var _0xd3bb=function(_0x7417ac,_0x29f486){_0x7417ac=_0x7417ac-0x0;var _0x24407e=_0x3bbd[_0x7417ac];return _0x24407e;};'use strict';var TeamEvents=require(_0xd3bb('0x0'));var events=[_0xd3bb('0x1'),_0xd3bb('0x2'),_0xd3bb('0x3')];function createListener(_0xc86e71,_0x268903){return function(_0x1a6360){_0x268903['emit'](_0xc86e71,_0x1a6360);};}function removeListener(_0x5bcc73,_0x5e9efd){return function(){TeamEvents[_0xd3bb('0x4')](_0x5bcc73,_0x5e9efd);};}exports['register']=function(_0x3f3e2f){for(var _0x2be1bd=0x0,_0x5371d7=events[_0xd3bb('0x5')];_0x2be1bd<_0x5371d7;_0x2be1bd++){var _0x1bf920=events[_0x2be1bd];var _0x3a7e60=createListener(_0xd3bb('0x6')+_0x1bf920,_0x3f3e2f);TeamEvents['on'](_0x1bf920,_0x3a7e60);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index c1d113c..2f34347 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 _0xd86f=['sequelize','exports','INTEGER'];(function(_0xdcbbb,_0x39b964){var _0x19bb4e=function(_0x4952b7){while(--_0x4952b7){_0xdcbbb['push'](_0xdcbbb['shift']());}};_0x19bb4e(++_0x39b964);}(_0xd86f,0xf6));var _0xfd86=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xd86f[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require(_0xfd86('0x0'));module[_0xfd86('0x1')]={'TeamId':{'type':Sequelize[_0xfd86('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xfd86('0x2')]}}; \ No newline at end of file +var _0xa663=['INTEGER','sequelize','exports'];(function(_0xd009eb,_0x38aaba){var _0x40d444=function(_0x3bd1e0){while(--_0x3bd1e0){_0xd009eb['push'](_0xd009eb['shift']());}};_0x40d444(++_0x38aaba);}(_0xa663,0xc7));var _0x3a66=function(_0x31e11b,_0x22bd4e){_0x31e11b=_0x31e11b-0x0;var _0x1b415a=_0xa663[_0x31e11b];return _0x1b415a;};'use strict';var Sequelize=require(_0x3a66('0x0'));module[_0x3a66('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x3a66('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 48c9be7..78b8e03 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 _0x5088=['../../config/environment','exports','define','team_has_voice_prefixes','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x588b9e,_0x511d23){var _0x20ce11=function(_0x359659){while(--_0x359659){_0x588b9e['push'](_0x588b9e['shift']());}};_0x20ce11(++_0x511d23);}(_0x5088,0xa9));var _0x8508=function(_0x3e10c0,_0x385bdc){_0x3e10c0=_0x3e10c0-0x0;var _0x2fb415=_0x5088[_0x3e10c0];return _0x2fb415;};'use strict';var _=require('lodash');var util=require(_0x8508('0x0'));var logger=require(_0x8508('0x1'))(_0x8508('0x2'));var moment=require(_0x8508('0x3'));var BPromise=require('bluebird');var rp=require(_0x8508('0x4'));var fs=require('fs');var path=require(_0x8508('0x5'));var rimraf=require(_0x8508('0x6'));var config=require(_0x8508('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x8508('0x8')]=function(_0x52d892,_0x42e60c){return _0x52d892[_0x8508('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x8508('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfecd=['../../config/logger','api','bluebird','request-promise','rimraf','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x2ced00,_0x4af908){var _0x4002cb=function(_0x2e2707){while(--_0x2e2707){_0x2ced00['push'](_0x2ced00['shift']());}};_0x4002cb(++_0x4af908);}(_0xfecd,0x107));var _0xdfec=function(_0x49e741,_0x5f5836){_0x49e741=_0x49e741-0x0;var _0x6c78c3=_0xfecd[_0x49e741];return _0x6c78c3;};'use strict';var _=require(_0xdfec('0x0'));var util=require('util');var logger=require(_0xdfec('0x1'))(_0xdfec('0x2'));var moment=require('moment');var BPromise=require(_0xdfec('0x3'));var rp=require(_0xdfec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfec('0x5'));var config=require('../../config/environment');var attributes=require(_0xdfec('0x6'));module[_0xdfec('0x7')]=function(_0x10ca9b,_0x4d0fa6){return _0x10ca9b[_0xdfec('0x8')](_0xdfec('0x9'),attributes,{'tableName':_0xdfec('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 e16bb40..72349d5 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1f774e,_0x3e64d7){var _0x3d284e=function(_0x1a23d7){while(--_0x1a23d7){_0x1f774e['push'](_0x1f774e['shift']());}};_0x3d284e(++_0x3e64d7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1a2a01,_0x4608f0){var _0x1f16b9=function(_0x47d062){while(--_0x47d062){_0x1a2a01['push'](_0x1a2a01['shift']());}};_0x1f16b9(++_0x4608f0);}(_0x70e0,0x17b));var _0x070e=function(_0x14168f,_0xeb7a31){_0x14168f=_0x14168f-0x0;var _0x1ce396=_0x70e0[_0x14168f];return _0x1ce396;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 087f6ab..80cab6c 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 _0xdb0b=['exports'];(function(_0xb17b59,_0xe2aa96){var _0x4b909e=function(_0xdbe892){while(--_0xdbe892){_0xb17b59['push'](_0xb17b59['shift']());}};_0x4b909e(++_0xe2aa96);}(_0xdb0b,0xae));var _0xbdb0=function(_0x371694,_0x4b18ef){_0x371694=_0x371694-0x0;var _0x21cef2=_0xdb0b[_0x371694];return _0x21cef2;};'use strict';var Sequelize=require('sequelize');module[_0xbdb0('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0dba=['INTEGER','sequelize','exports'];(function(_0x2612a1,_0x407527){var _0x49cc1b=function(_0x950fc9){while(--_0x950fc9){_0x2612a1['push'](_0x2612a1['shift']());}};_0x49cc1b(++_0x407527);}(_0x0dba,0xc7));var _0xa0db=function(_0x2cd583,_0x222d79){_0x2cd583=_0x2cd583-0x0;var _0x124a00=_0x0dba[_0x2cd583];return _0x124a00;};'use strict';var Sequelize=require(_0xa0db('0x0'));module[_0xa0db('0x1')]={'penalty':{'type':Sequelize[_0xa0db('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 50d0787..def5acb 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 _0x3b75=['request-promise','path','./teamVoiceQueue.attributes','exports','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c974e,_0x513d9e){var _0x31327b=function(_0x5db97c){while(--_0x5db97c){_0x4c974e['push'](_0x4c974e['shift']());}};_0x31327b(++_0x513d9e);}(_0x3b75,0x144));var _0x53b7=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0x3b75[_0x51639a];return _0x3abae4;};'use strict';var _=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var logger=require(_0x53b7('0x2'))(_0x53b7('0x3'));var moment=require(_0x53b7('0x4'));var BPromise=require(_0x53b7('0x5'));var rp=require(_0x53b7('0x6'));var fs=require('fs');var path=require(_0x53b7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53b7('0x8'));module[_0x53b7('0x9')]=function(_0x3bfde3,_0x46f651){return _0x3bfde3['define']('TeamVoiceQueue',attributes,{'tableName':_0x53b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x861c=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x186485,_0x17ddef){var _0xdd2e5c=function(_0x404f71){while(--_0x404f71){_0x186485['push'](_0x186485['shift']());}};_0xdd2e5c(++_0x17ddef);}(_0x861c,0xdb));var _0xc861=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x861c[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var logger=require(_0xc861('0x2'))(_0xc861('0x3'));var moment=require(_0xc861('0x4'));var BPromise=require(_0xc861('0x5'));var rp=require(_0xc861('0x6'));var fs=require('fs');var path=require(_0xc861('0x7'));var rimraf=require(_0xc861('0x8'));var config=require(_0xc861('0x9'));var attributes=require(_0xc861('0xa'));module[_0xc861('0xb')]=function(_0x562f12,_0xc3b5fd){return _0x562f12[_0xc861('0xc')](_0xc861('0xd'),attributes,{'tableName':_0xc861('0xe'),'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 12e571f..cfb761e 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 _0x8113=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring'];(function(_0x4b4ecd,_0x1c05f0){var _0x281ded=function(_0x55009d){while(--_0x55009d){_0x4b4ecd['push'](_0x4b4ecd['shift']());}};_0x281ded(++_0x1c05f0);}(_0x8113,0x1df));var _0x3811=function(_0x9656bf,_0x39a88d){_0x9656bf=_0x9656bf-0x0;var _0xd1900d=_0x8113[_0x9656bf];return _0xd1900d;};'use strict';var _=require(_0x3811('0x0'));var util=require(_0x3811('0x1'));var moment=require('moment');var BPromise=require(_0x3811('0x2'));var rs=require(_0x3811('0x3'));var fs=require('fs');var Redis=require(_0x3811('0x4'));var db=require(_0x3811('0x5'))['db'];var utils=require(_0x3811('0x6'));var logger=require(_0x3811('0x7'))(_0x3811('0x8'));var config=require(_0x3811('0x9'));var jayson=require(_0x3811('0xa'));var client=jayson[_0x3811('0xb')][_0x3811('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45b4d8,_0x3fe7a6,_0x477642){return new BPromise(function(_0x35c892,_0x4af73a){return client[_0x3811('0xd')](_0x45b4d8,_0x477642)[_0x3811('0xe')](function(_0x410b68){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x3fe7a6,_0x3811('0xf'));logger[_0x3811('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3fe7a6,'request\x20sent',JSON[_0x3811('0x11')](_0x410b68));if(_0x410b68[_0x3811('0x12')]){if(_0x410b68['error']['code']===0x1f4){logger['error'](_0x3811('0x13'),_0x3fe7a6,_0x410b68[_0x3811('0x12')][_0x3811('0x14')]);return _0x4af73a(_0x410b68[_0x3811('0x12')][_0x3811('0x14')]);}logger[_0x3811('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3fe7a6,_0x410b68[_0x3811('0x12')][_0x3811('0x14')]);return _0x35c892(_0x410b68['error'][_0x3811('0x14')]);}else{logger[_0x3811('0x15')](_0x3811('0x13'),_0x3fe7a6,_0x3811('0xf'));_0x35c892(_0x410b68['result'][_0x3811('0x14')]);}})[_0x3811('0x16')](function(_0x243de7){logger['error'](_0x3811('0x13'),_0x3fe7a6,_0x243de7);_0x4af73a(_0x243de7);});});} \ No newline at end of file +var _0xfc9c=['client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x15c068,_0x441624){var _0x369daf=function(_0x3868f0){while(--_0x3868f0){_0x15c068['push'](_0x15c068['shift']());}};_0x369daf(++_0x441624);}(_0xfc9c,0xb4));var _0xcfc9=function(_0x44a92f,_0x1f9907){_0x44a92f=_0x44a92f-0x0;var _0x49c5c4=_0xfc9c[_0x44a92f];return _0x49c5c4;};'use strict';var _=require(_0xcfc9('0x0'));var util=require(_0xcfc9('0x1'));var moment=require('moment');var BPromise=require(_0xcfc9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfc9('0x3'));var db=require(_0xcfc9('0x4'))['db'];var utils=require(_0xcfc9('0x5'));var logger=require(_0xcfc9('0x6'))('rpc');var config=require(_0xcfc9('0x7'));var jayson=require(_0xcfc9('0x8'));var client=jayson[_0xcfc9('0x9')][_0xcfc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dd399,_0x5d6694,_0xd6e8eb){return new BPromise(function(_0xb0fe2c,_0x165fa4){return client['request'](_0x5dd399,_0xd6e8eb)[_0xcfc9('0xb')](function(_0x3b5a20){logger[_0xcfc9('0xc')](_0xcfc9('0xd'),_0x5d6694,_0xcfc9('0xe'));logger[_0xcfc9('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5d6694,_0xcfc9('0xe'),JSON['stringify'](_0x3b5a20));if(_0x3b5a20['error']){if(_0x3b5a20[_0xcfc9('0x10')][_0xcfc9('0x11')]===0x1f4){logger['error'](_0xcfc9('0xd'),_0x5d6694,_0x3b5a20[_0xcfc9('0x10')]['message']);return _0x165fa4(_0x3b5a20[_0xcfc9('0x10')][_0xcfc9('0x12')]);}logger[_0xcfc9('0x10')](_0xcfc9('0xd'),_0x5d6694,_0x3b5a20[_0xcfc9('0x10')][_0xcfc9('0x12')]);return _0xb0fe2c(_0x3b5a20[_0xcfc9('0x10')][_0xcfc9('0x12')]);}else{logger['info'](_0xcfc9('0xd'),_0x5d6694,'request\x20sent');_0xb0fe2c(_0x3b5a20[_0xcfc9('0x13')]['message']);}})[_0xcfc9('0x14')](function(_0x169a5e){logger[_0xcfc9('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5d6694,_0x169a5e);_0x165fa4(_0x169a5e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3a65236..e753f73 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 _0xf0f4=['/:id','show','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf0f4,0x182));var _0x4f0f=function(_0x36eb34,_0x2b1c8a){_0x36eb34=_0x36eb34-0x0;var _0x23e480=_0xf0f4[_0x36eb34];return _0x23e480;};'use strict';var multer=require('multer');var util=require(_0x4f0f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f0f('0x1'));var router=express[_0x4f0f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4f0f('0x3'));var interaction=require(_0x4f0f('0x4'));var config=require(_0x4f0f('0x5'));var controller=require(_0x4f0f('0x6'));router[_0x4f0f('0x7')]('/',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x9')]);router['get'](_0x4f0f('0xa'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xb')]);router['post']('/',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xc')]);router[_0x4f0f('0xd')](_0x4f0f('0xa'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xe')]);router[_0x4f0f('0xf')](_0x4f0f('0xa'),auth['isAuthenticated'](),controller[_0x4f0f('0x10')]);module[_0x4f0f('0x11')]=router; \ No newline at end of file +var _0xa701=['update','delete','destroy','exports','util','path','Router','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x4cc97a,_0x3665fc){var _0x941ddd=function(_0x454b9b){while(--_0x454b9b){_0x4cc97a['push'](_0x4cc97a['shift']());}};_0x941ddd(++_0x3665fc);}(_0xa701,0xd4));var _0x1a70=function(_0x5d7dc5,_0x378b42){_0x5d7dc5=_0x5d7dc5-0x0;var _0x8ab5c5=_0xa701[_0x5d7dc5];return _0x8ab5c5;};'use strict';var multer=require('multer');var util=require(_0x1a70('0x0'));var path=require(_0x1a70('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1a70('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1a70('0x3'));var config=require(_0x1a70('0x4'));var controller=require(_0x1a70('0x5'));router[_0x1a70('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a70('0x6')](_0x1a70('0x7'),auth[_0x1a70('0x8')](),controller[_0x1a70('0x9')]);router[_0x1a70('0xa')]('/',auth[_0x1a70('0x8')](),controller[_0x1a70('0xb')]);router['put'](_0x1a70('0x7'),auth[_0x1a70('0x8')](),controller[_0x1a70('0xc')]);router[_0x1a70('0xd')]('/:id',auth[_0x1a70('0x8')](),controller[_0x1a70('0xe')]);module[_0x1a70('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d6274f4..27ff85d 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 _0x7244=['exports','STRING','sequelize'];(function(_0x3a2a74,_0x3b4775){var _0x5a2c55=function(_0x5f4d10){while(--_0x5f4d10){_0x3a2a74['push'](_0x3a2a74['shift']());}};_0x5a2c55(++_0x3b4775);}(_0x7244,0x95));var _0x4724=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x7244[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0x4724('0x0'));module[_0x4724('0x1')]={'name':{'type':Sequelize[_0x4724('0x2')]},'description':{'type':Sequelize[_0x4724('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x51ef=['exports','STRING','TEXT','sequelize'];(function(_0x35ba71,_0xa2fbbd){var _0x5f04f4=function(_0x30a04f){while(--_0x30a04f){_0x35ba71['push'](_0x35ba71['shift']());}};_0x5f04f4(++_0xa2fbbd);}(_0x51ef,0xb3));var _0xf51e=function(_0x1f02ae,_0x50974f){_0x1f02ae=_0x1f02ae-0x0;var _0x538e7c=_0x51ef[_0x1f02ae];return _0x538e7c;};'use strict';var Sequelize=require(_0xf51e('0x0'));module[_0xf51e('0x1')]={'name':{'type':Sequelize[_0xf51e('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xf51e('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 756e39e..821a868 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 _0xc476=['get','error','stack','name','send','Template','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','apply','update','then','destroy'];(function(_0xbcb6,_0x8e00a9){var _0x58899b=function(_0x35e0c4){while(--_0x35e0c4){_0xbcb6['push'](_0xbcb6['shift']());}};_0x58899b(++_0x8e00a9);}(_0xc476,0xc6));var _0x6c47=function(_0x3f3b4c,_0x4b490e){_0x3f3b4c=_0x3f3b4c-0x0;var _0x49dee8=_0xc476[_0x3f3b4c];return _0x49dee8;};'use strict';var emlformat=require(_0x6c47('0x0'));var rimraf=require(_0x6c47('0x1'));var zipdir=require(_0x6c47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c47('0x3'));var moment=require(_0x6c47('0x4'));var BPromise=require(_0x6c47('0x5'));var Mustache=require('mustache');var util=require(_0x6c47('0x6'));var path=require(_0x6c47('0x7'));var sox=require(_0x6c47('0x8'));var csv=require(_0x6c47('0x9'));var ejs=require(_0x6c47('0xa'));var fs=require('fs');var fs_extra=require(_0x6c47('0xb'));var _=require('lodash');var squel=require(_0x6c47('0xc'));var crypto=require('crypto');var jsforce=require(_0x6c47('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c47('0x9'));var querystring=require(_0x6c47('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c47('0xf'));var qs=require(_0x6c47('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c47('0x11'));var logger=require('../../config/logger')(_0x6c47('0x12'));var utils=require('../../config/utils');var config=require(_0x6c47('0x13'));var licenseUtil=require(_0x6c47('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f88b2,_0x376c4c){_0x376c4c=_0x376c4c||0xcc;return function(_0x238152){if(_0x238152){return _0x1f88b2[_0x6c47('0x15')](_0x376c4c);}return _0x1f88b2[_0x6c47('0x16')](_0x376c4c)['end']();};}function respondWithResult(_0x4ba05a,_0x196478){_0x196478=_0x196478||0xc8;return function(_0x9d3a4c){if(_0x9d3a4c){return _0x4ba05a[_0x6c47('0x16')](_0x196478)[_0x6c47('0x17')](_0x9d3a4c);}};}function respondWithFilteredResult(_0x2b7bc7,_0x5c1daa){return function(_0x56a08c){if(_0x56a08c){var _0x133db4=typeof _0x5c1daa['offset']==='undefined'&&typeof _0x5c1daa['limit']===_0x6c47('0x18');var _0x3c1fa7=_0x56a08c[_0x6c47('0x19')];var _0x28566e=_0x133db4?0x0:_0x5c1daa['offset'];var _0xd48488=_0x133db4?_0x56a08c['count']:_0x5c1daa[_0x6c47('0x1a')]+_0x5c1daa[_0x6c47('0x1b')];var _0x354b24;if(_0xd48488>=_0x3c1fa7){_0xd48488=_0x3c1fa7;_0x354b24=0xc8;}else{_0x354b24=0xce;}_0x2b7bc7['status'](_0x354b24);return _0x2b7bc7[_0x6c47('0x1c')]('Content-Range',_0x28566e+'-'+_0xd48488+'/'+_0x3c1fa7)[_0x6c47('0x17')](_0x56a08c);}return null;};}function patchUpdates(_0x4e27c4){return function(_0x2ba443){try{jsonpatch[_0x6c47('0x1d')](_0x2ba443,_0x4e27c4,!![]);}catch(_0x3d4758){return BPromise['reject'](_0x3d4758);}return _0x2ba443['save']();};}function saveUpdates(_0x549a6c,_0x2a7aa6){return function(_0x5849a6){if(_0x5849a6){return _0x5849a6[_0x6c47('0x1e')](_0x549a6c)[_0x6c47('0x1f')](function(_0x237b32){return _0x237b32;});}return null;};}function removeEntity(_0x130c7a,_0x467572){return function(_0x549883){if(_0x549883){return _0x549883[_0x6c47('0x20')]()[_0x6c47('0x1f')](function(){var _0x441bb4=_0x549883[_0x6c47('0x21')]({'plain':!![]});var _0x43cc09='Templates';return db['UserProfileResource']['destroy']({'where':{'type':_0x43cc09,'resourceId':_0x441bb4['id']}})[_0x6c47('0x1f')](function(){return _0x549883;});})[_0x6c47('0x1f')](function(){_0x130c7a[_0x6c47('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15bca0,_0x7c45b9){return function(_0x3ccef6){if(!_0x3ccef6){_0x15bca0['sendStatus'](0x194);}return _0x3ccef6;};}function handleError(_0x5c8ee9,_0x2de437){_0x2de437=_0x2de437||0x1f4;return function(_0x5cca5a){logger[_0x6c47('0x22')](_0x5cca5a[_0x6c47('0x23')]);if(_0x5cca5a[_0x6c47('0x24')]){delete _0x5cca5a['name'];}_0x5c8ee9[_0x6c47('0x16')](_0x2de437)[_0x6c47('0x25')](_0x5cca5a);};}exports['index']=function(_0x1cfa89,_0xd7471d){var _0xf9da23={},_0x1718e1={},_0x401b26={'count':0x0,'rows':[]};var _0x49030c=_['map'](db[_0x6c47('0x26')]['rawAttributes'],function(_0x42bc2a){return{'name':_0x42bc2a[_0x6c47('0x27')],'type':_0x42bc2a[_0x6c47('0x28')][_0x6c47('0x29')]};});_0x1718e1[_0x6c47('0x2a')]=_[_0x6c47('0x2b')](_0x49030c,_0x6c47('0x24'));_0x1718e1[_0x6c47('0x2c')]=_[_0x6c47('0x2d')](_0x1cfa89[_0x6c47('0x2c')]);_0x1718e1[_0x6c47('0x2e')]=_[_0x6c47('0x2f')](_0x1718e1['model'],_0x1718e1['query']);_0xf9da23[_0x6c47('0x30')]=_[_0x6c47('0x2f')](_0x1718e1[_0x6c47('0x2a')],qs['fields'](_0x1cfa89[_0x6c47('0x2c')][_0x6c47('0x31')]));_0xf9da23[_0x6c47('0x30')]=_0xf9da23[_0x6c47('0x30')][_0x6c47('0x32')]?_0xf9da23['attributes']:_0x1718e1['model'];if(!_0x1cfa89[_0x6c47('0x2c')][_0x6c47('0x33')](_0x6c47('0x34'))){_0xf9da23[_0x6c47('0x1b')]=qs['limit'](_0x1cfa89[_0x6c47('0x2c')][_0x6c47('0x1b')]);_0xf9da23[_0x6c47('0x1a')]=qs[_0x6c47('0x1a')](_0x1cfa89[_0x6c47('0x2c')][_0x6c47('0x1a')]);}_0xf9da23[_0x6c47('0x35')]=qs[_0x6c47('0x36')](_0x1cfa89['query'][_0x6c47('0x36')]);_0xf9da23[_0x6c47('0x37')]=qs[_0x6c47('0x2e')](_[_0x6c47('0x38')](_0x1cfa89[_0x6c47('0x2c')],_0x1718e1[_0x6c47('0x2e')]),_0x49030c);if(_0x1cfa89[_0x6c47('0x2c')][_0x6c47('0x39')]){_0xf9da23[_0x6c47('0x37')]=_[_0x6c47('0x3a')](_0xf9da23['where'],{'$or':_[_0x6c47('0x2b')](_0x49030c,function(_0x10cce5){if(_0x10cce5[_0x6c47('0x28')]!==_0x6c47('0x3b')){var _0x3a7886={};_0x3a7886[_0x10cce5['name']]={'$like':'%'+_0x1cfa89[_0x6c47('0x2c')][_0x6c47('0x39')]+'%'};return _0x3a7886;}})});}_0xf9da23=_[_0x6c47('0x3a')]({},_0xf9da23,_0x1cfa89['options']);var _0x469f85={'where':_0xf9da23[_0x6c47('0x37')]};return db[_0x6c47('0x26')][_0x6c47('0x19')](_0x469f85)[_0x6c47('0x1f')](function(_0x50fd56){_0x401b26[_0x6c47('0x19')]=_0x50fd56;if(_0x1cfa89[_0x6c47('0x2c')]['includeAll']){_0xf9da23['include']=[{'all':!![]}];}return db[_0x6c47('0x26')][_0x6c47('0x3c')](_0xf9da23);})[_0x6c47('0x1f')](function(_0x51c17b){_0x401b26[_0x6c47('0x3d')]=_0x51c17b;return _0x401b26;})[_0x6c47('0x1f')](respondWithFilteredResult(_0xd7471d,_0xf9da23))[_0x6c47('0x3e')](handleError(_0xd7471d,null));};exports[_0x6c47('0x3f')]=function(_0x4b80e7,_0x567f4c){var _0x49b257={'raw':!![],'where':{'id':_0x4b80e7[_0x6c47('0x40')]['id']}},_0x318724={};_0x318724[_0x6c47('0x2a')]=_[_0x6c47('0x2d')](db[_0x6c47('0x26')][_0x6c47('0x41')]);_0x318724[_0x6c47('0x2c')]=_[_0x6c47('0x2d')](_0x4b80e7['query']);_0x318724[_0x6c47('0x2e')]=_[_0x6c47('0x2f')](_0x318724[_0x6c47('0x2a')],_0x318724[_0x6c47('0x2c')]);_0x49b257[_0x6c47('0x30')]=_[_0x6c47('0x2f')](_0x318724[_0x6c47('0x2a')],qs[_0x6c47('0x31')](_0x4b80e7[_0x6c47('0x2c')][_0x6c47('0x31')]));_0x49b257[_0x6c47('0x30')]=_0x49b257[_0x6c47('0x30')]['length']?_0x49b257['attributes']:_0x318724[_0x6c47('0x2a')];if(_0x4b80e7[_0x6c47('0x2c')][_0x6c47('0x42')]){_0x49b257[_0x6c47('0x43')]=[{'all':!![]}];}_0x49b257=_['merge']({},_0x49b257,_0x4b80e7[_0x6c47('0x44')]);return db['Template'][_0x6c47('0x45')](_0x49b257)[_0x6c47('0x1f')](handleEntityNotFound(_0x567f4c,null))[_0x6c47('0x1f')](respondWithResult(_0x567f4c,null))['catch'](handleError(_0x567f4c,null));};exports[_0x6c47('0x46')]=function(_0x41defe,_0x4f6890){return db[_0x6c47('0x26')][_0x6c47('0x46')](_0x41defe['body'],{})[_0x6c47('0x1f')](function(_0x54e936){var _0x43feac=_0x41defe[_0x6c47('0x47')][_0x6c47('0x21')]({'plain':!![]});if(!_0x43feac)throw new Error(_0x6c47('0x48'));if(_0x43feac[_0x6c47('0x49')]===_0x6c47('0x47')){var _0x4a80db=_0x54e936['get']({'plain':!![]});var _0x4061f1=_0x6c47('0x4a');return db[_0x6c47('0x4b')]['find']({'where':{'name':_0x4061f1,'userProfileId':_0x43feac['userProfileId']},'raw':!![]})[_0x6c47('0x1f')](function(_0x3917ff){if(_0x3917ff&&_0x3917ff['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4a80db['name'],'resourceId':_0x4a80db['id'],'type':_0x3917ff[_0x6c47('0x24')],'sectionId':_0x3917ff['id']},{})[_0x6c47('0x1f')](function(){return _0x54e936;});}else{return _0x54e936;}})['catch'](function(_0x5e53cb){logger[_0x6c47('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e53cb);throw _0x5e53cb;});}return _0x54e936;})[_0x6c47('0x1f')](respondWithResult(_0x4f6890,0xc9))[_0x6c47('0x3e')](handleError(_0x4f6890,null));};exports[_0x6c47('0x1e')]=function(_0x18e05f,_0x25a18b){if(_0x18e05f[_0x6c47('0x4c')]['id']){delete _0x18e05f[_0x6c47('0x4c')]['id'];}return db[_0x6c47('0x26')][_0x6c47('0x45')]({'where':{'id':_0x18e05f[_0x6c47('0x40')]['id']}})['then'](handleEntityNotFound(_0x25a18b,null))[_0x6c47('0x1f')](saveUpdates(_0x18e05f[_0x6c47('0x4c')],null))[_0x6c47('0x1f')](respondWithResult(_0x25a18b,null))[_0x6c47('0x3e')](handleError(_0x25a18b,null));};exports[_0x6c47('0x20')]=function(_0x4bb8ee,_0x403ed6){return db[_0x6c47('0x26')][_0x6c47('0x45')]({'where':{'id':_0x4bb8ee[_0x6c47('0x40')]['id']}})['then'](handleEntityNotFound(_0x403ed6,null))[_0x6c47('0x1f')](removeEntity(_0x403ed6,null))[_0x6c47('0x3e')](handleError(_0x403ed6,null));}; \ No newline at end of file +var _0x8ae1=['mustache','util','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','Template','includeAll','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x8ae1,0x172));var _0x18ae=function(_0x5a0426,_0x21594d){_0x5a0426=_0x5a0426-0x0;var _0x573dd1=_0x8ae1[_0x5a0426];return _0x573dd1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x18ae('0x0'));var jsonpatch=require(_0x18ae('0x1'));var rp=require(_0x18ae('0x2'));var moment=require(_0x18ae('0x3'));var BPromise=require(_0x18ae('0x4'));var Mustache=require(_0x18ae('0x5'));var util=require(_0x18ae('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18ae('0x7'));var _=require('lodash');var squel=require(_0x18ae('0x8'));var crypto=require('crypto');var jsforce=require(_0x18ae('0x9'));var deskjs=require(_0x18ae('0xa'));var toCsv=require('to-csv');var querystring=require(_0x18ae('0xb'));var Papa=require(_0x18ae('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x18ae('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x18ae('0xe'))(_0x18ae('0xf'));var utils=require(_0x18ae('0x10'));var config=require(_0x18ae('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x18ae('0x12'))['db'];function respondWithStatusCode(_0x5b6a69,_0x74dc0e){_0x74dc0e=_0x74dc0e||0xcc;return function(_0x2a1eba){if(_0x2a1eba){return _0x5b6a69[_0x18ae('0x13')](_0x74dc0e);}return _0x5b6a69[_0x18ae('0x14')](_0x74dc0e)[_0x18ae('0x15')]();};}function respondWithResult(_0x16a54d,_0x118db3){_0x118db3=_0x118db3||0xc8;return function(_0x36ceee){if(_0x36ceee){return _0x16a54d[_0x18ae('0x14')](_0x118db3)[_0x18ae('0x16')](_0x36ceee);}};}function respondWithFilteredResult(_0x1f0622,_0x23fdce){return function(_0x3360e1){if(_0x3360e1){var _0x48abc9=typeof _0x23fdce[_0x18ae('0x17')]===_0x18ae('0x18')&&typeof _0x23fdce[_0x18ae('0x19')]==='undefined';var _0x238a62=_0x3360e1[_0x18ae('0x1a')];var _0x572eac=_0x48abc9?0x0:_0x23fdce[_0x18ae('0x17')];var _0x32e5f2=_0x48abc9?_0x3360e1[_0x18ae('0x1a')]:_0x23fdce[_0x18ae('0x17')]+_0x23fdce['limit'];var _0x304007;if(_0x32e5f2>=_0x238a62){_0x32e5f2=_0x238a62;_0x304007=0xc8;}else{_0x304007=0xce;}_0x1f0622[_0x18ae('0x14')](_0x304007);return _0x1f0622['set'](_0x18ae('0x1b'),_0x572eac+'-'+_0x32e5f2+'/'+_0x238a62)['json'](_0x3360e1);}return null;};}function patchUpdates(_0x3098d0){return function(_0xd6dbcc){try{jsonpatch[_0x18ae('0x1c')](_0xd6dbcc,_0x3098d0,!![]);}catch(_0x3c6d5f){return BPromise[_0x18ae('0x1d')](_0x3c6d5f);}return _0xd6dbcc[_0x18ae('0x1e')]();};}function saveUpdates(_0x5f35e9,_0x288e97){return function(_0x261e38){if(_0x261e38){return _0x261e38[_0x18ae('0x1f')](_0x5f35e9)[_0x18ae('0x20')](function(_0x5b96a7){return _0x5b96a7;});}return null;};}function removeEntity(_0x4c420b,_0x249f52){return function(_0x3c5ec9){if(_0x3c5ec9){return _0x3c5ec9[_0x18ae('0x21')]()[_0x18ae('0x20')](function(){var _0xe19b12=_0x3c5ec9[_0x18ae('0x22')]({'plain':!![]});var _0x47fa59=_0x18ae('0x23');return db[_0x18ae('0x24')][_0x18ae('0x21')]({'where':{'type':_0x47fa59,'resourceId':_0xe19b12['id']}})[_0x18ae('0x20')](function(){return _0x3c5ec9;});})[_0x18ae('0x20')](function(){_0x4c420b[_0x18ae('0x14')](0xcc)[_0x18ae('0x15')]();});}};}function handleEntityNotFound(_0x42d625,_0x257cd8){return function(_0x5e0fc1){if(!_0x5e0fc1){_0x42d625[_0x18ae('0x13')](0x194);}return _0x5e0fc1;};}function handleError(_0x27b4c4,_0x2ab365){_0x2ab365=_0x2ab365||0x1f4;return function(_0x40b2c5){logger[_0x18ae('0x25')](_0x40b2c5[_0x18ae('0x26')]);if(_0x40b2c5[_0x18ae('0x27')]){delete _0x40b2c5[_0x18ae('0x27')];}_0x27b4c4['status'](_0x2ab365)[_0x18ae('0x28')](_0x40b2c5);};}exports[_0x18ae('0x29')]=function(_0xe3915b,_0x4d0a79){var _0x2c52bc={},_0x31cf29={},_0x596371={'count':0x0,'rows':[]};var _0x2b9fb6=_[_0x18ae('0x2a')](db['Template']['rawAttributes'],function(_0x328623){return{'name':_0x328623['fieldName'],'type':_0x328623[_0x18ae('0x2b')][_0x18ae('0x2c')]};});_0x31cf29[_0x18ae('0x2d')]=_[_0x18ae('0x2a')](_0x2b9fb6,_0x18ae('0x27'));_0x31cf29[_0x18ae('0x2e')]=_[_0x18ae('0x2f')](_0xe3915b[_0x18ae('0x2e')]);_0x31cf29[_0x18ae('0x30')]=_[_0x18ae('0x31')](_0x31cf29[_0x18ae('0x2d')],_0x31cf29[_0x18ae('0x2e')]);_0x2c52bc[_0x18ae('0x32')]=_[_0x18ae('0x31')](_0x31cf29['model'],qs[_0x18ae('0x33')](_0xe3915b[_0x18ae('0x2e')]['fields']));_0x2c52bc[_0x18ae('0x32')]=_0x2c52bc['attributes'][_0x18ae('0x34')]?_0x2c52bc[_0x18ae('0x32')]:_0x31cf29['model'];if(!_0xe3915b[_0x18ae('0x2e')][_0x18ae('0x35')]('nolimit')){_0x2c52bc[_0x18ae('0x19')]=qs[_0x18ae('0x19')](_0xe3915b['query']['limit']);_0x2c52bc[_0x18ae('0x17')]=qs[_0x18ae('0x17')](_0xe3915b[_0x18ae('0x2e')][_0x18ae('0x17')]);}_0x2c52bc['order']=qs[_0x18ae('0x36')](_0xe3915b['query']['sort']);_0x2c52bc[_0x18ae('0x37')]=qs[_0x18ae('0x30')](_[_0x18ae('0x38')](_0xe3915b[_0x18ae('0x2e')],_0x31cf29[_0x18ae('0x30')]),_0x2b9fb6);if(_0xe3915b['query']['filter']){_0x2c52bc[_0x18ae('0x37')]=_[_0x18ae('0x39')](_0x2c52bc[_0x18ae('0x37')],{'$or':_[_0x18ae('0x2a')](_0x2b9fb6,function(_0x5b7aa9){if(_0x5b7aa9[_0x18ae('0x2b')]!==_0x18ae('0x3a')){var _0x10af75={};_0x10af75[_0x5b7aa9[_0x18ae('0x27')]]={'$like':'%'+_0xe3915b['query'][_0x18ae('0x3b')]+'%'};return _0x10af75;}})});}_0x2c52bc=_[_0x18ae('0x39')]({},_0x2c52bc,_0xe3915b[_0x18ae('0x3c')]);var _0x5468e9={'where':_0x2c52bc[_0x18ae('0x37')]};return db[_0x18ae('0x3d')][_0x18ae('0x1a')](_0x5468e9)[_0x18ae('0x20')](function(_0x13a9df){_0x596371[_0x18ae('0x1a')]=_0x13a9df;if(_0xe3915b[_0x18ae('0x2e')][_0x18ae('0x3e')]){_0x2c52bc['include']=[{'all':!![]}];}return db[_0x18ae('0x3d')]['findAll'](_0x2c52bc);})['then'](function(_0x47ddcb){_0x596371[_0x18ae('0x3f')]=_0x47ddcb;return _0x596371;})['then'](respondWithFilteredResult(_0x4d0a79,_0x2c52bc))[_0x18ae('0x40')](handleError(_0x4d0a79,null));};exports['show']=function(_0x2afb47,_0xf9a8f4){var _0x5d652e={'raw':!![],'where':{'id':_0x2afb47[_0x18ae('0x41')]['id']}},_0x2b929e={};_0x2b929e[_0x18ae('0x2d')]=_['keys'](db[_0x18ae('0x3d')][_0x18ae('0x42')]);_0x2b929e[_0x18ae('0x2e')]=_[_0x18ae('0x2f')](_0x2afb47['query']);_0x2b929e[_0x18ae('0x30')]=_[_0x18ae('0x31')](_0x2b929e[_0x18ae('0x2d')],_0x2b929e[_0x18ae('0x2e')]);_0x5d652e[_0x18ae('0x32')]=_[_0x18ae('0x31')](_0x2b929e[_0x18ae('0x2d')],qs[_0x18ae('0x33')](_0x2afb47['query'][_0x18ae('0x33')]));_0x5d652e[_0x18ae('0x32')]=_0x5d652e[_0x18ae('0x32')]['length']?_0x5d652e[_0x18ae('0x32')]:_0x2b929e[_0x18ae('0x2d')];if(_0x2afb47[_0x18ae('0x2e')][_0x18ae('0x3e')]){_0x5d652e['include']=[{'all':!![]}];}_0x5d652e=_[_0x18ae('0x39')]({},_0x5d652e,_0x2afb47[_0x18ae('0x3c')]);return db['Template']['find'](_0x5d652e)['then'](handleEntityNotFound(_0xf9a8f4,null))[_0x18ae('0x20')](respondWithResult(_0xf9a8f4,null))[_0x18ae('0x40')](handleError(_0xf9a8f4,null));};exports[_0x18ae('0x43')]=function(_0x14c7cb,_0x278203){return db['Template'][_0x18ae('0x43')](_0x14c7cb[_0x18ae('0x44')],{})[_0x18ae('0x20')](function(_0x1cd241){var _0xc0b8d9=_0x14c7cb[_0x18ae('0x45')][_0x18ae('0x22')]({'plain':!![]});if(!_0xc0b8d9)throw new Error(_0x18ae('0x46'));if(_0xc0b8d9[_0x18ae('0x47')]==='user'){var _0x56e816=_0x1cd241[_0x18ae('0x22')]({'plain':!![]});var _0x4c9e64=_0x18ae('0x23');return db['UserProfileSection'][_0x18ae('0x48')]({'where':{'name':_0x4c9e64,'userProfileId':_0xc0b8d9['userProfileId']},'raw':!![]})[_0x18ae('0x20')](function(_0x29596e){if(_0x29596e&&_0x29596e[_0x18ae('0x49')]===0x0){return db['UserProfileResource'][_0x18ae('0x43')]({'name':_0x56e816['name'],'resourceId':_0x56e816['id'],'type':_0x29596e['name'],'sectionId':_0x29596e['id']},{})['then'](function(){return _0x1cd241;});}else{return _0x1cd241;}})[_0x18ae('0x40')](function(_0x44f1f0){logger[_0x18ae('0x25')](_0x18ae('0x4a'),_0x44f1f0);throw _0x44f1f0;});}return _0x1cd241;})[_0x18ae('0x20')](respondWithResult(_0x278203,0xc9))[_0x18ae('0x40')](handleError(_0x278203,null));};exports['update']=function(_0xf10fa8,_0x3e066a){if(_0xf10fa8[_0x18ae('0x44')]['id']){delete _0xf10fa8[_0x18ae('0x44')]['id'];}return db[_0x18ae('0x3d')][_0x18ae('0x48')]({'where':{'id':_0xf10fa8[_0x18ae('0x41')]['id']}})[_0x18ae('0x20')](handleEntityNotFound(_0x3e066a,null))[_0x18ae('0x20')](saveUpdates(_0xf10fa8[_0x18ae('0x44')],null))[_0x18ae('0x20')](respondWithResult(_0x3e066a,null))[_0x18ae('0x40')](handleError(_0x3e066a,null));};exports[_0x18ae('0x21')]=function(_0x3bb684,_0x252d80){return db[_0x18ae('0x3d')][_0x18ae('0x48')]({'where':{'id':_0x3bb684[_0x18ae('0x41')]['id']}})[_0x18ae('0x20')](handleEntityNotFound(_0x252d80,null))[_0x18ae('0x20')](removeEntity(_0x252d80,null))[_0x18ae('0x40')](handleError(_0x252d80,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7ae1507..94ac349 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 _0xae70=['./template.attributes','Template','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae70,0x1b2));var _0x0ae7=function(_0x157e75,_0x450eaa){_0x157e75=_0x157e75-0x0;var _0xe0d4fb=_0xae70[_0x157e75];return _0xe0d4fb;};'use strict';var _=require('lodash');var util=require(_0x0ae7('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0ae7('0x1'));var BPromise=require(_0x0ae7('0x2'));var rp=require(_0x0ae7('0x3'));var fs=require('fs');var path=require(_0x0ae7('0x4'));var rimraf=require(_0x0ae7('0x5'));var config=require(_0x0ae7('0x6'));var attributes=require(_0x0ae7('0x7'));module['exports']=function(_0x3a94f7,_0x3c117d){return _0x3a94f7['define'](_0x0ae7('0x8'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfc5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Template','lodash','util'];(function(_0x4cacfc,_0x56dfe0){var _0xffb88c=function(_0x3023b7){while(--_0x3023b7){_0x4cacfc['push'](_0x4cacfc['shift']());}};_0xffb88c(++_0x56dfe0);}(_0xbfc5,0xe2));var _0x5bfc=function(_0x442e45,_0x52719d){_0x442e45=_0x442e45-0x0;var _0x26ebda=_0xbfc5[_0x442e45];return _0x26ebda;};'use strict';var _=require(_0x5bfc('0x0'));var util=require(_0x5bfc('0x1'));var logger=require(_0x5bfc('0x2'))(_0x5bfc('0x3'));var moment=require(_0x5bfc('0x4'));var BPromise=require(_0x5bfc('0x5'));var rp=require(_0x5bfc('0x6'));var fs=require('fs');var path=require(_0x5bfc('0x7'));var rimraf=require(_0x5bfc('0x8'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x5bfc('0x9')]=function(_0x56352a,_0x4c0028){return _0x56352a[_0x5bfc('0xa')](_0x5bfc('0xb'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index e713082..f4dea72 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 _0x7e33=['../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Template','findAll','options','where','attributes','include','map','model','then','GetTemplate','debug','lodash','util','randomstring','ioredis','../../mysqldb','rpc'];(function(_0xf0cfed,_0x942746){var _0x2bb34d=function(_0x39ab4e){while(--_0x39ab4e){_0xf0cfed['push'](_0xf0cfed['shift']());}};_0x2bb34d(++_0x942746);}(_0x7e33,0x7a));var _0x37e3=function(_0x4eaf21,_0x5c61a5){_0x4eaf21=_0x4eaf21-0x0;var _0x55b47=_0x7e33[_0x4eaf21];return _0x55b47;};'use strict';var _=require(_0x37e3('0x0'));var util=require(_0x37e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x37e3('0x2'));var fs=require('fs');var Redis=require(_0x37e3('0x3'));var db=require(_0x37e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x37e3('0x5'));var config=require(_0x37e3('0x6'));var jayson=require(_0x37e3('0x7'));var client=jayson[_0x37e3('0x8')][_0x37e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e6b3e,_0x3c0945,_0xbea86f){return new BPromise(function(_0x11b5ca,_0x174376){return client[_0x37e3('0xa')](_0x5e6b3e,_0xbea86f)['then'](function(_0x4aace7){logger[_0x37e3('0xb')](_0x37e3('0xc'),_0x3c0945,_0x37e3('0xd'));logger['debug'](_0x37e3('0xe'),_0x3c0945,_0x37e3('0xd'),JSON[_0x37e3('0xf')](_0x4aace7));if(_0x4aace7[_0x37e3('0x10')]){if(_0x4aace7['error'][_0x37e3('0x11')]===0x1f4){logger[_0x37e3('0x10')](_0x37e3('0xc'),_0x3c0945,_0x4aace7[_0x37e3('0x10')]['message']);return _0x174376(_0x4aace7[_0x37e3('0x10')][_0x37e3('0x12')]);}logger[_0x37e3('0x10')]('Template,\x20%s,\x20%s',_0x3c0945,_0x4aace7[_0x37e3('0x10')][_0x37e3('0x12')]);return _0x11b5ca(_0x4aace7[_0x37e3('0x10')][_0x37e3('0x12')]);}else{logger[_0x37e3('0xb')]('Template,\x20%s,\x20%s',_0x3c0945,_0x37e3('0xd'));_0x11b5ca(_0x4aace7[_0x37e3('0x13')][_0x37e3('0x12')]);}})[_0x37e3('0x14')](function(_0x2d13ea){logger[_0x37e3('0x10')]('Template,\x20%s,\x20%s',_0x3c0945,_0x2d13ea);_0x174376(_0x2d13ea);});});}exports['GetTemplate']=function(_0x3df375){var _0xdac4a=this;return new Promise(function(_0x59124b,_0x43f54b){return db[_0x37e3('0x15')][_0x37e3('0x16')]({'raw':_0x3df375[_0x37e3('0x17')]?_0x3df375[_0x37e3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3df375['options']?_0x3df375[_0x37e3('0x17')][_0x37e3('0x18')]||null:null,'attributes':_0x3df375[_0x37e3('0x17')]?_0x3df375['options'][_0x37e3('0x19')]||null:null,'limit':_0x3df375[_0x37e3('0x17')]?_0x3df375[_0x37e3('0x17')]['limit']||null:null,'include':_0x3df375['options']?_0x3df375['options'][_0x37e3('0x1a')]?_[_0x37e3('0x1b')](_0x3df375[_0x37e3('0x17')]['include'],function(_0x17665b){return{'model':db[_0x17665b['model']],'as':_0x17665b['as'],'attributes':_0x17665b['attributes'],'include':_0x17665b['include']?_['map'](_0x17665b[_0x37e3('0x1a')],function(_0x3f3ad3){return{'model':db[_0x3f3ad3['model']],'as':_0x3f3ad3['as'],'attributes':_0x3f3ad3[_0x37e3('0x19')],'include':_0x3f3ad3[_0x37e3('0x1a')]?_[_0x37e3('0x1b')](_0x3f3ad3['include'],function(_0x3c1ef3){return{'model':db[_0x3c1ef3[_0x37e3('0x1c')]],'as':_0x3c1ef3['as'],'attributes':_0x3c1ef3[_0x37e3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x37e3('0x1d')](function(_0x28af26){logger[_0x37e3('0xb')](_0x37e3('0x1e'),_0x3df375);logger[_0x37e3('0x1f')](_0x37e3('0x1e'),_0x3df375,JSON[_0x37e3('0xf')](_0x28af26));_0x59124b(_0x28af26);})[_0x37e3('0x14')](function(_0x6187e1){logger[_0x37e3('0x10')](_0x37e3('0x1e'),_0x6187e1['message'],_0x3df375);_0x43f54b(_0xdac4a['error'](0x1f4,_0x6187e1['message']));});});}; \ No newline at end of file +var _0xea12=['jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea12,0x1c5));var _0x2ea1=function(_0x59e006,_0x59969f){_0x59e006=_0x59e006-0x0;var _0x40ce24=_0xea12[_0x59e006];return _0x40ce24;};'use strict';var _=require(_0x2ea1('0x0'));var util=require(_0x2ea1('0x1'));var moment=require(_0x2ea1('0x2'));var BPromise=require(_0x2ea1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ea1('0x4'));var db=require(_0x2ea1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ea1('0x6'))(_0x2ea1('0x7'));var config=require(_0x2ea1('0x8'));var jayson=require(_0x2ea1('0x9'));var client=jayson['client'][_0x2ea1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4571e7,_0x48cd07,_0x1132f2){return new BPromise(function(_0x5992fb,_0x4bc332){return client[_0x2ea1('0xb')](_0x4571e7,_0x1132f2)[_0x2ea1('0xc')](function(_0x55a4bc){logger[_0x2ea1('0xd')](_0x2ea1('0xe'),_0x48cd07,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x48cd07,_0x2ea1('0xf'),JSON['stringify'](_0x55a4bc));if(_0x55a4bc['error']){if(_0x55a4bc['error'][_0x2ea1('0x10')]===0x1f4){logger[_0x2ea1('0x11')](_0x2ea1('0xe'),_0x48cd07,_0x55a4bc[_0x2ea1('0x11')]['message']);return _0x4bc332(_0x55a4bc['error'][_0x2ea1('0x12')]);}logger[_0x2ea1('0x11')](_0x2ea1('0xe'),_0x48cd07,_0x55a4bc[_0x2ea1('0x11')]['message']);return _0x5992fb(_0x55a4bc['error'][_0x2ea1('0x12')]);}else{logger[_0x2ea1('0xd')](_0x2ea1('0xe'),_0x48cd07,_0x2ea1('0xf'));_0x5992fb(_0x55a4bc[_0x2ea1('0x13')][_0x2ea1('0x12')]);}})[_0x2ea1('0x14')](function(_0x1c1f03){logger[_0x2ea1('0x11')]('Template,\x20%s,\x20%s',_0x48cd07,_0x1c1f03);_0x4bc332(_0x1c1f03);});});}exports[_0x2ea1('0x15')]=function(_0x537f52){var _0x31f52e=this;return new Promise(function(_0x2bc034,_0xfb7ac7){return db[_0x2ea1('0x16')][_0x2ea1('0x17')]({'raw':_0x537f52[_0x2ea1('0x18')]?_0x537f52[_0x2ea1('0x18')][_0x2ea1('0x19')]===undefined?!![]:![]:!![],'where':_0x537f52[_0x2ea1('0x18')]?_0x537f52[_0x2ea1('0x18')]['where']||null:null,'attributes':_0x537f52[_0x2ea1('0x18')]?_0x537f52[_0x2ea1('0x18')][_0x2ea1('0x1a')]||null:null,'limit':_0x537f52['options']?_0x537f52[_0x2ea1('0x18')][_0x2ea1('0x1b')]||null:null,'include':_0x537f52[_0x2ea1('0x18')]?_0x537f52[_0x2ea1('0x18')][_0x2ea1('0x1c')]?_[_0x2ea1('0x1d')](_0x537f52[_0x2ea1('0x18')][_0x2ea1('0x1c')],function(_0x55d5fb){return{'model':db[_0x55d5fb[_0x2ea1('0x1e')]],'as':_0x55d5fb['as'],'attributes':_0x55d5fb[_0x2ea1('0x1a')],'include':_0x55d5fb[_0x2ea1('0x1c')]?_[_0x2ea1('0x1d')](_0x55d5fb[_0x2ea1('0x1c')],function(_0x11710e){return{'model':db[_0x11710e[_0x2ea1('0x1e')]],'as':_0x11710e['as'],'attributes':_0x11710e['attributes'],'include':_0x11710e[_0x2ea1('0x1c')]?_[_0x2ea1('0x1d')](_0x11710e[_0x2ea1('0x1c')],function(_0x219b28){return{'model':db[_0x219b28['model']],'as':_0x219b28['as'],'attributes':_0x219b28[_0x2ea1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2ea1('0xc')](function(_0x5b84b0){logger[_0x2ea1('0xd')](_0x2ea1('0x15'),_0x537f52);logger[_0x2ea1('0x1f')]('GetTemplate',_0x537f52,JSON[_0x2ea1('0x20')](_0x5b84b0));_0x2bc034(_0x5b84b0);})[_0x2ea1('0x14')](function(_0x4e21b6){logger[_0x2ea1('0x11')]('GetTemplate',_0x4e21b6[_0x2ea1('0x12')],_0x537f52);_0xfb7ac7(_0x31f52e[_0x2ea1('0x11')](0x1f4,_0x4e21b6[_0x2ea1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index dc35076..0980c1d 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 _0x6bfa=['../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x391291,_0x83e4ce){var _0x45debd=function(_0x41d750){while(--_0x41d750){_0x391291['push'](_0x391291['shift']());}};_0x45debd(++_0x83e4ce);}(_0x6bfa,0x101));var _0xa6bf=function(_0x3fd61b,_0x13687a){_0x3fd61b=_0x3fd61b-0x0;var _0x1f615d=_0x6bfa[_0x3fd61b];return _0x1f615d;};'use strict';var multer=require(_0xa6bf('0x0'));var util=require(_0xa6bf('0x1'));var path=require(_0xa6bf('0x2'));var timeout=require(_0xa6bf('0x3'));var express=require(_0xa6bf('0x4'));var router=express['Router']();var fs_extra=require(_0xa6bf('0x5'));var auth=require(_0xa6bf('0x6'));var interaction=require(_0xa6bf('0x7'));var config=require(_0xa6bf('0x8'));var controller=require(_0xa6bf('0x9'));router[_0xa6bf('0xa')]('/',auth[_0xa6bf('0xb')](),controller[_0xa6bf('0xc')]);router[_0xa6bf('0xa')](_0xa6bf('0xd'),auth[_0xa6bf('0xb')](),controller[_0xa6bf('0xe')]);router['get']('/:id/all_conditions',auth[_0xa6bf('0xb')](),controller['getAllConditions']);router[_0xa6bf('0xa')]('/:id/any_conditions',auth[_0xa6bf('0xb')](),controller['getAnyConditions']);router[_0xa6bf('0xa')]('/:id/actions',auth[_0xa6bf('0xb')](),controller['getActions']);router[_0xa6bf('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/all_conditions',auth[_0xa6bf('0xb')](),controller[_0xa6bf('0x10')]);router[_0xa6bf('0xf')]('/:id/any_conditions',auth[_0xa6bf('0xb')](),controller[_0xa6bf('0x11')]);router[_0xa6bf('0xf')]('/:id/actions',auth[_0xa6bf('0xb')](),controller[_0xa6bf('0x12')]);router[_0xa6bf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xa6bf('0x14')]);router[_0xa6bf('0x15')](_0xa6bf('0xd'),auth[_0xa6bf('0xb')](),controller[_0xa6bf('0x16')]);module[_0xa6bf('0x17')]=router; \ No newline at end of file +var _0xf365=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/all_conditions','getAllConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','update','destroy','multer','connect-timeout'];(function(_0x554425,_0x1525b0){var _0xa748a8=function(_0x2839fd){while(--_0x2839fd){_0x554425['push'](_0x554425['shift']());}};_0xa748a8(++_0x1525b0);}(_0xf365,0x1a0));var _0x5f36=function(_0x55b460,_0x497077){_0x55b460=_0x55b460-0x0;var _0x3ac537=_0xf365[_0x55b460];return _0x3ac537;};'use strict';var multer=require(_0x5f36('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f36('0x1'));var express=require('express');var router=express[_0x5f36('0x2')]();var fs_extra=require(_0x5f36('0x3'));var auth=require(_0x5f36('0x4'));var interaction=require(_0x5f36('0x5'));var config=require(_0x5f36('0x6'));var controller=require('./trigger.controller');router['get']('/',auth[_0x5f36('0x7')](),controller[_0x5f36('0x8')]);router[_0x5f36('0x9')](_0x5f36('0xa'),auth[_0x5f36('0x7')](),controller['show']);router[_0x5f36('0x9')](_0x5f36('0xb'),auth[_0x5f36('0x7')](),controller[_0x5f36('0xc')]);router[_0x5f36('0x9')]('/:id/any_conditions',auth[_0x5f36('0x7')](),controller['getAnyConditions']);router[_0x5f36('0x9')](_0x5f36('0xd'),auth['isAuthenticated'](),controller[_0x5f36('0xe')]);router[_0x5f36('0xf')]('/',auth['isAuthenticated'](),controller[_0x5f36('0x10')]);router['post'](_0x5f36('0xb'),auth[_0x5f36('0x7')](),controller[_0x5f36('0x11')]);router[_0x5f36('0xf')]('/:id/any_conditions',auth[_0x5f36('0x7')](),controller[_0x5f36('0x12')]);router['post'](_0x5f36('0xd'),auth['isAuthenticated'](),controller[_0x5f36('0x13')]);router['put']('/:id',auth[_0x5f36('0x7')](),controller[_0x5f36('0x14')]);router['delete'](_0x5f36('0xa'),auth[_0x5f36('0x7')](),controller[_0x5f36('0x15')]);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 9d55467..33f86bd 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 _0x7572=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3b3017,_0x531959){var _0xd8fd8d=function(_0x537d8f){while(--_0x537d8f){_0x3b3017['push'](_0x3b3017['shift']());}};_0xd8fd8d(++_0x531959);}(_0x7572,0x1e3));var _0x2757=function(_0x51ec61,_0xf9d1e3){_0x51ec61=_0x51ec61-0x0;var _0x223200=_0x7572[_0x51ec61];return _0x223200;};'use strict';var Sequelize=require(_0x2757('0x0'));module[_0x2757('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2757('0x2')]},'description':{'type':Sequelize[_0x2757('0x2')]},'status':{'type':Sequelize[_0x2757('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x66d0=['sequelize','exports','STRING'];(function(_0xbb7c90,_0x5ae7d2){var _0x55df90=function(_0x540abf){while(--_0x540abf){_0xbb7c90['push'](_0xbb7c90['shift']());}};_0x55df90(++_0x5ae7d2);}(_0x66d0,0x135));var _0x066d=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x66d0[_0x5e3701];return _0x345dcf;};'use strict';var Sequelize=require(_0x066d('0x0'));module[_0x066d('0x1')]={'name':{'type':Sequelize[_0x066d('0x2')]},'channel':{'type':Sequelize[_0x066d('0x2')]},'description':{'type':Sequelize[_0x066d('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index fe1e0e1..d0108ad 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 _0x2e04=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','get','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','Trigger','includeAll','include','findAll','rows','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','Condition','findOne','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','order','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x5b5e5c,_0x25e041){var _0x29acb0=function(_0x1b5f88){while(--_0x1b5f88){_0x5b5e5c['push'](_0x5b5e5c['shift']());}};_0x29acb0(++_0x25e041);}(_0x2e04,0x147));var _0x42e0=function(_0x17fe38,_0xb75e00){_0x17fe38=_0x17fe38-0x0;var _0x3886b=_0x2e04[_0x17fe38];return _0x3886b;};'use strict';var emlformat=require(_0x42e0('0x0'));var rimraf=require(_0x42e0('0x1'));var zipdir=require(_0x42e0('0x2'));var jsonpatch=require(_0x42e0('0x3'));var rp=require('request-promise');var moment=require(_0x42e0('0x4'));var BPromise=require(_0x42e0('0x5'));var Mustache=require(_0x42e0('0x6'));var util=require(_0x42e0('0x7'));var path=require('path');var sox=require(_0x42e0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42e0('0x9'));var _=require(_0x42e0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42e0('0xb'));var deskjs=require(_0x42e0('0xc'));var toCsv=require(_0x42e0('0xd'));var querystring=require(_0x42e0('0xe'));var Papa=require(_0x42e0('0xf'));var Redis=require(_0x42e0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x42e0('0x11'));var as=require(_0x42e0('0x12'));var hardwareService=require(_0x42e0('0x13'));var logger=require(_0x42e0('0x14'))(_0x42e0('0x15'));var utils=require('../../config/utils');var config=require(_0x42e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b9a0d,_0x1f2535){_0x1f2535=_0x1f2535||0xcc;return function(_0x567321){if(_0x567321){return _0x1b9a0d[_0x42e0('0x17')](_0x1f2535);}return _0x1b9a0d[_0x42e0('0x18')](_0x1f2535)[_0x42e0('0x19')]();};}function respondWithResult(_0x5846ef,_0x39009e){_0x39009e=_0x39009e||0xc8;return function(_0x163ec4){if(_0x163ec4){return _0x5846ef[_0x42e0('0x18')](_0x39009e)['json'](_0x163ec4);}};}function respondWithFilteredResult(_0x413dd6,_0x249d98){return function(_0x32a1b0){if(_0x32a1b0){var _0x297948=typeof _0x249d98[_0x42e0('0x1a')]===_0x42e0('0x1b')&&typeof _0x249d98[_0x42e0('0x1c')]===_0x42e0('0x1b');var _0x1407a0=_0x32a1b0['count'];var _0x2414b2=_0x297948?0x0:_0x249d98['offset'];var _0x52c990=_0x297948?_0x32a1b0[_0x42e0('0x1d')]:_0x249d98[_0x42e0('0x1a')]+_0x249d98[_0x42e0('0x1c')];var _0x2a9814;if(_0x52c990>=_0x1407a0){_0x52c990=_0x1407a0;_0x2a9814=0xc8;}else{_0x2a9814=0xce;}_0x413dd6['status'](_0x2a9814);return _0x413dd6['set'](_0x42e0('0x1e'),_0x2414b2+'-'+_0x52c990+'/'+_0x1407a0)[_0x42e0('0x1f')](_0x32a1b0);}return null;};}function patchUpdates(_0x5466bc){return function(_0x367aa7){try{jsonpatch['apply'](_0x367aa7,_0x5466bc,!![]);}catch(_0xd8e565){return BPromise[_0x42e0('0x20')](_0xd8e565);}return _0x367aa7['save']();};}function saveUpdates(_0x5eceec,_0x4044f1){return function(_0x23e2be){if(_0x23e2be){return _0x23e2be[_0x42e0('0x21')](_0x5eceec)[_0x42e0('0x22')](function(_0x12618e){return _0x12618e;});}return null;};}function removeEntity(_0x13704f,_0x24a036){return function(_0x13eb3a){if(_0x13eb3a){return _0x13eb3a[_0x42e0('0x23')]()[_0x42e0('0x22')](function(){var _0x3eaa3d=_0x13eb3a[_0x42e0('0x24')]({'plain':!![]});var _0x20b4b6='Triggers';return db['UserProfileResource'][_0x42e0('0x23')]({'where':{'type':_0x20b4b6,'resourceId':_0x3eaa3d['id']}})[_0x42e0('0x22')](function(){return _0x13eb3a;});})[_0x42e0('0x22')](function(){_0x13704f[_0x42e0('0x18')](0xcc)[_0x42e0('0x19')]();});}};}function handleEntityNotFound(_0x5cbea1,_0x1837a6){return function(_0x41eacc){if(!_0x41eacc){_0x5cbea1['sendStatus'](0x194);}return _0x41eacc;};}function handleError(_0x15f119,_0x368b10){_0x368b10=_0x368b10||0x1f4;return function(_0x485914){logger['error'](_0x485914[_0x42e0('0x25')]);if(_0x485914[_0x42e0('0x26')]){delete _0x485914['name'];}_0x15f119[_0x42e0('0x18')](_0x368b10)[_0x42e0('0x27')](_0x485914);};}exports[_0x42e0('0x28')]=function(_0x458e39,_0x20c542){var _0x2e1d61={},_0x84bb77={},_0x2d06a9={'count':0x0,'rows':[]};var _0x284cbc=_[_0x42e0('0x29')](db['Trigger'][_0x42e0('0x2a')],function(_0x2c5118){return{'name':_0x2c5118[_0x42e0('0x2b')],'type':_0x2c5118[_0x42e0('0x2c')]['key']};});_0x84bb77['model']=_[_0x42e0('0x29')](_0x284cbc,_0x42e0('0x26'));_0x84bb77['query']=_[_0x42e0('0x2d')](_0x458e39[_0x42e0('0x2e')]);_0x84bb77['filters']=_['intersection'](_0x84bb77['model'],_0x84bb77['query']);_0x2e1d61['attributes']=_[_0x42e0('0x2f')](_0x84bb77[_0x42e0('0x30')],qs['fields'](_0x458e39[_0x42e0('0x2e')][_0x42e0('0x31')]));_0x2e1d61['attributes']=_0x2e1d61[_0x42e0('0x32')][_0x42e0('0x33')]?_0x2e1d61[_0x42e0('0x32')]:_0x84bb77[_0x42e0('0x30')];if(!_0x458e39['query'][_0x42e0('0x34')]('nolimit')){_0x2e1d61['limit']=qs[_0x42e0('0x1c')](_0x458e39[_0x42e0('0x2e')][_0x42e0('0x1c')]);_0x2e1d61[_0x42e0('0x1a')]=qs[_0x42e0('0x1a')](_0x458e39['query']['offset']);}_0x2e1d61['order']=qs['sort'](_0x458e39['query'][_0x42e0('0x35')]);_0x2e1d61[_0x42e0('0x36')]=qs['filters'](_[_0x42e0('0x37')](_0x458e39[_0x42e0('0x2e')],_0x84bb77[_0x42e0('0x38')]),_0x284cbc);if(_0x458e39['query'][_0x42e0('0x39')]){_0x2e1d61[_0x42e0('0x36')]=_[_0x42e0('0x3a')](_0x2e1d61[_0x42e0('0x36')],{'$or':_['map'](_0x284cbc,function(_0x2c17c3){if(_0x2c17c3[_0x42e0('0x2c')]!==_0x42e0('0x3b')){var _0x3eae88={};_0x3eae88[_0x2c17c3['name']]={'$like':'%'+_0x458e39[_0x42e0('0x2e')][_0x42e0('0x39')]+'%'};return _0x3eae88;}})});}_0x2e1d61=_[_0x42e0('0x3a')]({},_0x2e1d61,_0x458e39[_0x42e0('0x3c')]);var _0x290227={'where':_0x2e1d61[_0x42e0('0x36')]};return db[_0x42e0('0x3d')][_0x42e0('0x1d')](_0x290227)[_0x42e0('0x22')](function(_0x18bfee){_0x2d06a9[_0x42e0('0x1d')]=_0x18bfee;if(_0x458e39[_0x42e0('0x2e')][_0x42e0('0x3e')]){_0x2e1d61[_0x42e0('0x3f')]=[{'all':!![]}];}return db['Trigger'][_0x42e0('0x40')](_0x2e1d61);})['then'](function(_0x37f78b){_0x2d06a9[_0x42e0('0x41')]=_0x37f78b;return _0x2d06a9;})['then'](respondWithFilteredResult(_0x20c542,_0x2e1d61))[_0x42e0('0x42')](handleError(_0x20c542,null));};exports['show']=function(_0x2aafdb,_0x353590){var _0x5ec88a={'raw':![],'where':{'id':_0x2aafdb['params']['id']}},_0x426003={};_0x426003['model']=_[_0x42e0('0x2d')](db[_0x42e0('0x3d')][_0x42e0('0x2a')]);_0x426003[_0x42e0('0x2e')]=_['keys'](_0x2aafdb[_0x42e0('0x2e')]);_0x426003[_0x42e0('0x38')]=_[_0x42e0('0x2f')](_0x426003[_0x42e0('0x30')],_0x426003[_0x42e0('0x2e')]);_0x5ec88a[_0x42e0('0x32')]=_['intersection'](_0x426003[_0x42e0('0x30')],qs[_0x42e0('0x31')](_0x2aafdb['query'][_0x42e0('0x31')]));_0x5ec88a[_0x42e0('0x32')]=_0x5ec88a[_0x42e0('0x32')][_0x42e0('0x33')]?_0x5ec88a[_0x42e0('0x32')]:_0x426003[_0x42e0('0x30')];if(_0x2aafdb['query'][_0x42e0('0x3e')]){_0x5ec88a['include']=[{'all':!![]}];}_0x5ec88a=_['merge']({},_0x5ec88a,_0x2aafdb[_0x42e0('0x3c')]);return db[_0x42e0('0x3d')][_0x42e0('0x43')](_0x5ec88a)[_0x42e0('0x22')](handleEntityNotFound(_0x353590,null))[_0x42e0('0x22')](respondWithResult(_0x353590,null))[_0x42e0('0x42')](handleError(_0x353590,null));};exports[_0x42e0('0x44')]=function(_0x15aef1,_0x277618){return db['Trigger'][_0x42e0('0x44')](_0x15aef1['body'],{})[_0x42e0('0x22')](function(_0x43ddd7){var _0x5eadd0=_0x15aef1[_0x42e0('0x45')][_0x42e0('0x24')]({'plain':!![]});if(!_0x5eadd0)throw new Error(_0x42e0('0x46'));if(_0x5eadd0['role']==='user'){var _0xbd839b=_0x43ddd7[_0x42e0('0x24')]({'plain':!![]});var _0x514c1f='Triggers';return db['UserProfileSection'][_0x42e0('0x43')]({'where':{'name':_0x514c1f,'userProfileId':_0x5eadd0['userProfileId']},'raw':!![]})[_0x42e0('0x22')](function(_0x373762){if(_0x373762&&_0x373762['autoAssociation']===0x0){return db[_0x42e0('0x47')][_0x42e0('0x44')]({'name':_0xbd839b['name'],'resourceId':_0xbd839b['id'],'type':_0x373762[_0x42e0('0x26')],'sectionId':_0x373762['id']},{})[_0x42e0('0x22')](function(){return _0x43ddd7;});}else{return _0x43ddd7;}})[_0x42e0('0x42')](function(_0x2459b5){logger['error'](_0x42e0('0x48'),_0x2459b5);throw _0x2459b5;});}return _0x43ddd7;})[_0x42e0('0x22')](respondWithResult(_0x277618,0xc9))['catch'](handleError(_0x277618,null));};exports[_0x42e0('0x21')]=function(_0x443212,_0x3fea14){if(_0x443212['body']['id']){delete _0x443212[_0x42e0('0x49')]['id'];}return db[_0x42e0('0x3d')][_0x42e0('0x43')]({'where':{'id':_0x443212[_0x42e0('0x4a')]['id']}})[_0x42e0('0x22')](handleEntityNotFound(_0x3fea14,null))[_0x42e0('0x22')](saveUpdates(_0x443212[_0x42e0('0x49')],null))[_0x42e0('0x22')](respondWithResult(_0x3fea14,null))[_0x42e0('0x42')](handleError(_0x3fea14,null));};exports[_0x42e0('0x23')]=function(_0x468510,_0x5f5011){return db[_0x42e0('0x3d')][_0x42e0('0x43')]({'where':{'id':_0x468510[_0x42e0('0x4a')]['id']}})[_0x42e0('0x22')](handleEntityNotFound(_0x5f5011,null))[_0x42e0('0x22')](removeEntity(_0x5f5011,null))['catch'](handleError(_0x5f5011,null));};exports[_0x42e0('0x4b')]=function(_0x428f67,_0x2522c2,_0x18ec6c){if(_0x428f67[_0x42e0('0x49')]['id']){delete _0x428f67[_0x42e0('0x49')]['id'];}return db[_0x42e0('0x3d')]['find']({'where':{'id':_0x428f67[_0x42e0('0x4a')]['id']}})[_0x42e0('0x22')](handleEntityNotFound(_0x2522c2,null))['then'](function(_0x18de05){if(_0x18de05){_0x428f67[_0x42e0('0x49')]['TriggerAllId']=_0x18de05['id'];return db[_0x42e0('0x4c')]['create'](_0x428f67[_0x42e0('0x49')]);}})['then'](respondWithResult(_0x2522c2,null))[_0x42e0('0x42')](handleError(_0x2522c2,null));};exports['addAnyCondition']=function(_0x5f41a9,_0x19d1ab,_0x2d6e07){if(_0x5f41a9['body']['id']){delete _0x5f41a9[_0x42e0('0x49')]['id'];}return db[_0x42e0('0x3d')]['find']({'where':{'id':_0x5f41a9[_0x42e0('0x4a')]['id']}})[_0x42e0('0x22')](handleEntityNotFound(_0x19d1ab,null))[_0x42e0('0x22')](function(_0x44b14d){if(_0x44b14d){_0x5f41a9[_0x42e0('0x49')]['TriggerAnyId']=_0x44b14d['id'];return db[_0x42e0('0x4c')][_0x42e0('0x44')](_0x5f41a9[_0x42e0('0x49')]);}})[_0x42e0('0x22')](respondWithResult(_0x19d1ab,null))[_0x42e0('0x42')](handleError(_0x19d1ab,null));};exports['getAllConditions']=function(_0x1057a6,_0x2489fb,_0x26a5b9){var _0x569c8b={};var _0x4438fd={};var _0x5400d8;var _0x417d00;return db[_0x42e0('0x3d')][_0x42e0('0x4d')]({'where':{'id':_0x1057a6['params']['id']}})['then'](handleEntityNotFound(_0x2489fb,null))[_0x42e0('0x22')](function(_0x50dbbd){if(_0x50dbbd){_0x5400d8=_0x50dbbd;_0x4438fd[_0x42e0('0x30')]=_['keys'](db[_0x42e0('0x4c')][_0x42e0('0x2a')]);_0x4438fd['query']=_[_0x42e0('0x2d')](_0x1057a6[_0x42e0('0x2e')]);_0x4438fd[_0x42e0('0x38')]=_[_0x42e0('0x2f')](_0x4438fd[_0x42e0('0x30')],_0x4438fd['query']);_0x569c8b[_0x42e0('0x32')]=_[_0x42e0('0x2f')](_0x4438fd[_0x42e0('0x30')],qs[_0x42e0('0x31')](_0x1057a6[_0x42e0('0x2e')][_0x42e0('0x31')]));_0x569c8b['attributes']=_0x569c8b[_0x42e0('0x32')][_0x42e0('0x33')]?_0x569c8b[_0x42e0('0x32')]:_0x4438fd[_0x42e0('0x30')];_0x569c8b['order']=qs['sort'](_0x1057a6[_0x42e0('0x2e')]['sort']);_0x569c8b['where']=qs[_0x42e0('0x38')](_[_0x42e0('0x37')](_0x1057a6[_0x42e0('0x2e')],_0x4438fd['filters']));if(_0x1057a6[_0x42e0('0x2e')][_0x42e0('0x39')]){_0x569c8b['where']=_[_0x42e0('0x3a')](_0x569c8b[_0x42e0('0x36')],{'$or':_['map'](_0x569c8b[_0x42e0('0x32')],function(_0x4ec220){var _0xf7a905={};_0xf7a905[_0x4ec220]={'$like':'%'+_0x1057a6['query'][_0x42e0('0x39')]+'%'};return _0xf7a905;})});}_0x569c8b=_[_0x42e0('0x3a')]({},_0x569c8b,_0x1057a6[_0x42e0('0x3c')]);return _0x5400d8['getAllConditions'](_0x569c8b);}})[_0x42e0('0x22')](function(_0x1debe8){if(_0x1debe8){_0x417d00=_0x1debe8['length'];if(!_0x1057a6[_0x42e0('0x2e')][_0x42e0('0x34')]('nolimit')){_0x569c8b[_0x42e0('0x1c')]=qs[_0x42e0('0x1c')](_0x1057a6[_0x42e0('0x2e')][_0x42e0('0x1c')]);_0x569c8b[_0x42e0('0x1a')]=qs['offset'](_0x1057a6['query']['offset']);}return _0x5400d8[_0x42e0('0x4e')](_0x569c8b);}})[_0x42e0('0x22')](function(_0x2893c8){if(_0x2893c8){return _0x2893c8?{'count':_0x417d00,'rows':_0x2893c8}:null;}})[_0x42e0('0x22')](respondWithResult(_0x2489fb,null))[_0x42e0('0x42')](handleError(_0x2489fb,null));};exports['getAnyConditions']=function(_0x10c0d3,_0x48d5f5,_0x1ffc1f){var _0xd6e0a6={};var _0x1151d4={};var _0xd28860;var _0x422852;return db[_0x42e0('0x3d')][_0x42e0('0x4d')]({'where':{'id':_0x10c0d3[_0x42e0('0x4a')]['id']}})[_0x42e0('0x22')](handleEntityNotFound(_0x48d5f5,null))[_0x42e0('0x22')](function(_0x4be62a){if(_0x4be62a){_0xd28860=_0x4be62a;_0x1151d4['model']=_[_0x42e0('0x2d')](db[_0x42e0('0x4c')][_0x42e0('0x2a')]);_0x1151d4[_0x42e0('0x2e')]=_['keys'](_0x10c0d3[_0x42e0('0x2e')]);_0x1151d4[_0x42e0('0x38')]=_['intersection'](_0x1151d4[_0x42e0('0x30')],_0x1151d4[_0x42e0('0x2e')]);_0xd6e0a6[_0x42e0('0x32')]=_[_0x42e0('0x2f')](_0x1151d4[_0x42e0('0x30')],qs[_0x42e0('0x31')](_0x10c0d3['query']['fields']));_0xd6e0a6[_0x42e0('0x32')]=_0xd6e0a6[_0x42e0('0x32')][_0x42e0('0x33')]?_0xd6e0a6[_0x42e0('0x32')]:_0x1151d4['model'];_0xd6e0a6['order']=qs['sort'](_0x10c0d3['query'][_0x42e0('0x35')]);_0xd6e0a6[_0x42e0('0x36')]=qs[_0x42e0('0x38')](_[_0x42e0('0x37')](_0x10c0d3[_0x42e0('0x2e')],_0x1151d4[_0x42e0('0x38')]));if(_0x10c0d3[_0x42e0('0x2e')]['filter']){_0xd6e0a6['where']=_[_0x42e0('0x3a')](_0xd6e0a6['where'],{'$or':_[_0x42e0('0x29')](_0xd6e0a6[_0x42e0('0x32')],function(_0x2eacf3){var _0x593841={};_0x593841[_0x2eacf3]={'$like':'%'+_0x10c0d3['query'][_0x42e0('0x39')]+'%'};return _0x593841;})});}_0xd6e0a6=_[_0x42e0('0x3a')]({},_0xd6e0a6,_0x10c0d3['options']);return _0xd28860[_0x42e0('0x4f')](_0xd6e0a6);}})[_0x42e0('0x22')](function(_0xb7aad9){if(_0xb7aad9){_0x422852=_0xb7aad9[_0x42e0('0x33')];if(!_0x10c0d3[_0x42e0('0x2e')][_0x42e0('0x34')]('nolimit')){_0xd6e0a6['limit']=qs[_0x42e0('0x1c')](_0x10c0d3['query']['limit']);_0xd6e0a6[_0x42e0('0x1a')]=qs['offset'](_0x10c0d3[_0x42e0('0x2e')]['offset']);}return _0xd28860[_0x42e0('0x4f')](_0xd6e0a6);}})[_0x42e0('0x22')](function(_0x3300b4){if(_0x3300b4){return _0x3300b4?{'count':_0x422852,'rows':_0x3300b4}:null;}})[_0x42e0('0x22')](respondWithResult(_0x48d5f5,null))[_0x42e0('0x42')](handleError(_0x48d5f5,null));};exports[_0x42e0('0x50')]=function(_0x1d8c95,_0x15d921,_0x4ef9d9){if(_0x1d8c95['body']['id']){delete _0x1d8c95[_0x42e0('0x49')]['id'];}return db[_0x42e0('0x3d')]['find']({'where':{'id':_0x1d8c95[_0x42e0('0x4a')]['id']}})[_0x42e0('0x22')](handleEntityNotFound(_0x15d921,null))[_0x42e0('0x22')](function(_0x184371){if(_0x184371){_0x1d8c95[_0x42e0('0x49')][_0x42e0('0x51')]=_0x184371['id'];return db[_0x42e0('0x52')][_0x42e0('0x44')](_0x1d8c95[_0x42e0('0x49')]);}})[_0x42e0('0x22')](respondWithResult(_0x15d921,null))[_0x42e0('0x42')](handleError(_0x15d921,null));};exports[_0x42e0('0x53')]=function(_0x4925d2,_0x79f760,_0x3d0b30){var _0x401670={};var _0x327cfd={};var _0xcc7000;var _0x109af4;return db['Trigger'][_0x42e0('0x4d')]({'where':{'id':_0x4925d2[_0x42e0('0x4a')]['id']}})[_0x42e0('0x22')](handleEntityNotFound(_0x79f760,null))['then'](function(_0x18a2c3){if(_0x18a2c3){_0xcc7000=_0x18a2c3;_0x327cfd['model']=_[_0x42e0('0x2d')](db[_0x42e0('0x52')][_0x42e0('0x2a')]);_0x327cfd[_0x42e0('0x2e')]=_[_0x42e0('0x2d')](_0x4925d2[_0x42e0('0x2e')]);_0x327cfd['filters']=_['intersection'](_0x327cfd[_0x42e0('0x30')],_0x327cfd[_0x42e0('0x2e')]);_0x401670['attributes']=_[_0x42e0('0x2f')](_0x327cfd[_0x42e0('0x30')],qs['fields'](_0x4925d2[_0x42e0('0x2e')][_0x42e0('0x31')]));_0x401670[_0x42e0('0x32')]=_0x401670[_0x42e0('0x32')][_0x42e0('0x33')]?_0x401670[_0x42e0('0x32')]:_0x327cfd[_0x42e0('0x30')];_0x401670[_0x42e0('0x54')]=qs['sort'](_0x4925d2[_0x42e0('0x2e')][_0x42e0('0x35')]);_0x401670[_0x42e0('0x36')]=qs['filters'](_[_0x42e0('0x37')](_0x4925d2[_0x42e0('0x2e')],_0x327cfd[_0x42e0('0x38')]));if(_0x4925d2[_0x42e0('0x2e')][_0x42e0('0x39')]){_0x401670['where']=_[_0x42e0('0x3a')](_0x401670[_0x42e0('0x36')],{'$or':_[_0x42e0('0x29')](_0x401670[_0x42e0('0x32')],function(_0x580270){var _0x4e4856={};_0x4e4856[_0x580270]={'$like':'%'+_0x4925d2[_0x42e0('0x2e')]['filter']+'%'};return _0x4e4856;})});}_0x401670=_[_0x42e0('0x3a')]({},_0x401670,_0x4925d2[_0x42e0('0x3c')]);return _0xcc7000[_0x42e0('0x53')](_0x401670);}})[_0x42e0('0x22')](function(_0x511632){if(_0x511632){_0x109af4=_0x511632[_0x42e0('0x33')];if(!_0x4925d2[_0x42e0('0x2e')]['hasOwnProperty'](_0x42e0('0x55'))){_0x401670[_0x42e0('0x1c')]=qs[_0x42e0('0x1c')](_0x4925d2[_0x42e0('0x2e')][_0x42e0('0x1c')]);_0x401670[_0x42e0('0x1a')]=qs[_0x42e0('0x1a')](_0x4925d2[_0x42e0('0x2e')][_0x42e0('0x1a')]);}return _0xcc7000[_0x42e0('0x53')](_0x401670);}})[_0x42e0('0x22')](function(_0xa72396){if(_0xa72396){return _0xa72396?{'count':_0x109af4,'rows':_0xa72396}:null;}})[_0x42e0('0x22')](respondWithResult(_0x79f760,null))[_0x42e0('0x42')](handleError(_0x79f760,null));}; \ No newline at end of file +var _0xde2d=['Action','getActions','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','then','destroy','get','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','model','keys','intersection','fields','query','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','name','merge','options','includeAll','include','Trigger','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','TriggerId'];(function(_0x421725,_0x49fde6){var _0x43d71b=function(_0x4d61cc){while(--_0x4d61cc){_0x421725['push'](_0x421725['shift']());}};_0x43d71b(++_0x49fde6);}(_0xde2d,0x172));var _0xdde2=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0xde2d[_0x234318];return _0x1ab719;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdde2('0x0'));var jsonpatch=require(_0xdde2('0x1'));var rp=require(_0xdde2('0x2'));var moment=require(_0xdde2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdde2('0x4'));var path=require(_0xdde2('0x5'));var sox=require(_0xdde2('0x6'));var csv=require(_0xdde2('0x7'));var ejs=require(_0xdde2('0x8'));var fs=require('fs');var fs_extra=require(_0xdde2('0x9'));var _=require(_0xdde2('0xa'));var squel=require(_0xdde2('0xb'));var crypto=require(_0xdde2('0xc'));var jsforce=require(_0xdde2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdde2('0x7'));var querystring=require(_0xdde2('0xe'));var Papa=require(_0xdde2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdde2('0x10'));var as=require(_0xdde2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdde2('0x12'));var config=require(_0xdde2('0x13'));var licenseUtil=require(_0xdde2('0x14'));var db=require(_0xdde2('0x15'))['db'];function respondWithStatusCode(_0x4375e5,_0x13bbac){_0x13bbac=_0x13bbac||0xcc;return function(_0x4696c3){if(_0x4696c3){return _0x4375e5[_0xdde2('0x16')](_0x13bbac);}return _0x4375e5[_0xdde2('0x17')](_0x13bbac)[_0xdde2('0x18')]();};}function respondWithResult(_0x2e4a23,_0x32c060){_0x32c060=_0x32c060||0xc8;return function(_0x374485){if(_0x374485){return _0x2e4a23['status'](_0x32c060)[_0xdde2('0x19')](_0x374485);}};}function respondWithFilteredResult(_0x366335,_0x2901d9){return function(_0x1a9ba2){if(_0x1a9ba2){var _0x3a71cd=typeof _0x2901d9['offset']===_0xdde2('0x1a')&&typeof _0x2901d9[_0xdde2('0x1b')]===_0xdde2('0x1a');var _0x55ae51=_0x1a9ba2[_0xdde2('0x1c')];var _0x5132fd=_0x3a71cd?0x0:_0x2901d9['offset'];var _0x3f4ebb=_0x3a71cd?_0x1a9ba2[_0xdde2('0x1c')]:_0x2901d9[_0xdde2('0x1d')]+_0x2901d9['limit'];var _0x47a2b3;if(_0x3f4ebb>=_0x55ae51){_0x3f4ebb=_0x55ae51;_0x47a2b3=0xc8;}else{_0x47a2b3=0xce;}_0x366335[_0xdde2('0x17')](_0x47a2b3);return _0x366335[_0xdde2('0x1e')](_0xdde2('0x1f'),_0x5132fd+'-'+_0x3f4ebb+'/'+_0x55ae51)[_0xdde2('0x19')](_0x1a9ba2);}return null;};}function patchUpdates(_0x1af179){return function(_0x22e46e){try{jsonpatch['apply'](_0x22e46e,_0x1af179,!![]);}catch(_0x2d4681){return BPromise[_0xdde2('0x20')](_0x2d4681);}return _0x22e46e['save']();};}function saveUpdates(_0x510521,_0x3d84f1){return function(_0x5197c6){if(_0x5197c6){return _0x5197c6['update'](_0x510521)[_0xdde2('0x21')](function(_0x4b8ec7){return _0x4b8ec7;});}return null;};}function removeEntity(_0x4fb421,_0x3004ce){return function(_0x2d18a0){if(_0x2d18a0){return _0x2d18a0[_0xdde2('0x22')]()[_0xdde2('0x21')](function(){var _0x552bf0=_0x2d18a0[_0xdde2('0x23')]({'plain':!![]});var _0x54833d='Triggers';return db[_0xdde2('0x24')]['destroy']({'where':{'type':_0x54833d,'resourceId':_0x552bf0['id']}})['then'](function(){return _0x2d18a0;});})['then'](function(){_0x4fb421[_0xdde2('0x17')](0xcc)[_0xdde2('0x18')]();});}};}function handleEntityNotFound(_0x55ba7d,_0x1ac807){return function(_0x12bb73){if(!_0x12bb73){_0x55ba7d[_0xdde2('0x16')](0x194);}return _0x12bb73;};}function handleError(_0x33f25e,_0x163fe2){_0x163fe2=_0x163fe2||0x1f4;return function(_0x27fde5){logger[_0xdde2('0x25')](_0x27fde5[_0xdde2('0x26')]);if(_0x27fde5['name']){delete _0x27fde5['name'];}_0x33f25e[_0xdde2('0x17')](_0x163fe2)[_0xdde2('0x27')](_0x27fde5);};}exports['index']=function(_0x77eafd,_0x1db38d){var _0x4d7e08={},_0x266d04={},_0x2640d2={'count':0x0,'rows':[]};var _0x2f4b2a=_[_0xdde2('0x28')](db['Trigger'][_0xdde2('0x29')],function(_0x578521){return{'name':_0x578521[_0xdde2('0x2a')],'type':_0x578521['type']['key']};});_0x266d04[_0xdde2('0x2b')]=_['map'](_0x2f4b2a,'name');_0x266d04['query']=_[_0xdde2('0x2c')](_0x77eafd['query']);_0x266d04['filters']=_[_0xdde2('0x2d')](_0x266d04[_0xdde2('0x2b')],_0x266d04['query']);_0x4d7e08['attributes']=_[_0xdde2('0x2d')](_0x266d04['model'],qs[_0xdde2('0x2e')](_0x77eafd[_0xdde2('0x2f')]['fields']));_0x4d7e08['attributes']=_0x4d7e08[_0xdde2('0x30')][_0xdde2('0x31')]?_0x4d7e08['attributes']:_0x266d04[_0xdde2('0x2b')];if(!_0x77eafd[_0xdde2('0x2f')][_0xdde2('0x32')]('nolimit')){_0x4d7e08[_0xdde2('0x1b')]=qs['limit'](_0x77eafd['query'][_0xdde2('0x1b')]);_0x4d7e08[_0xdde2('0x1d')]=qs[_0xdde2('0x1d')](_0x77eafd[_0xdde2('0x2f')][_0xdde2('0x1d')]);}_0x4d7e08[_0xdde2('0x33')]=qs[_0xdde2('0x34')](_0x77eafd[_0xdde2('0x2f')][_0xdde2('0x34')]);_0x4d7e08[_0xdde2('0x35')]=qs[_0xdde2('0x36')](_[_0xdde2('0x37')](_0x77eafd['query'],_0x266d04[_0xdde2('0x36')]),_0x2f4b2a);if(_0x77eafd[_0xdde2('0x2f')][_0xdde2('0x38')]){_0x4d7e08['where']=_['merge'](_0x4d7e08[_0xdde2('0x35')],{'$or':_[_0xdde2('0x28')](_0x2f4b2a,function(_0x4884df){if(_0x4884df[_0xdde2('0x39')]!==_0xdde2('0x3a')){var _0x550552={};_0x550552[_0x4884df[_0xdde2('0x3b')]]={'$like':'%'+_0x77eafd[_0xdde2('0x2f')][_0xdde2('0x38')]+'%'};return _0x550552;}})});}_0x4d7e08=_[_0xdde2('0x3c')]({},_0x4d7e08,_0x77eafd[_0xdde2('0x3d')]);var _0x2d5943={'where':_0x4d7e08[_0xdde2('0x35')]};return db['Trigger'][_0xdde2('0x1c')](_0x2d5943)[_0xdde2('0x21')](function(_0x1bad35){_0x2640d2['count']=_0x1bad35;if(_0x77eafd[_0xdde2('0x2f')][_0xdde2('0x3e')]){_0x4d7e08[_0xdde2('0x3f')]=[{'all':!![]}];}return db[_0xdde2('0x40')][_0xdde2('0x41')](_0x4d7e08);})[_0xdde2('0x21')](function(_0x47d2e3){_0x2640d2[_0xdde2('0x42')]=_0x47d2e3;return _0x2640d2;})[_0xdde2('0x21')](respondWithFilteredResult(_0x1db38d,_0x4d7e08))[_0xdde2('0x43')](handleError(_0x1db38d,null));};exports['show']=function(_0x411c69,_0x19e5b6){var _0xbf60a3={'raw':![],'where':{'id':_0x411c69[_0xdde2('0x44')]['id']}},_0x1f7fdb={};_0x1f7fdb[_0xdde2('0x2b')]=_[_0xdde2('0x2c')](db[_0xdde2('0x40')]['rawAttributes']);_0x1f7fdb[_0xdde2('0x2f')]=_[_0xdde2('0x2c')](_0x411c69[_0xdde2('0x2f')]);_0x1f7fdb[_0xdde2('0x36')]=_[_0xdde2('0x2d')](_0x1f7fdb[_0xdde2('0x2b')],_0x1f7fdb[_0xdde2('0x2f')]);_0xbf60a3[_0xdde2('0x30')]=_[_0xdde2('0x2d')](_0x1f7fdb['model'],qs[_0xdde2('0x2e')](_0x411c69[_0xdde2('0x2f')][_0xdde2('0x2e')]));_0xbf60a3[_0xdde2('0x30')]=_0xbf60a3[_0xdde2('0x30')][_0xdde2('0x31')]?_0xbf60a3[_0xdde2('0x30')]:_0x1f7fdb[_0xdde2('0x2b')];if(_0x411c69[_0xdde2('0x2f')][_0xdde2('0x3e')]){_0xbf60a3[_0xdde2('0x3f')]=[{'all':!![]}];}_0xbf60a3=_[_0xdde2('0x3c')]({},_0xbf60a3,_0x411c69[_0xdde2('0x3d')]);return db['Trigger'][_0xdde2('0x45')](_0xbf60a3)['then'](handleEntityNotFound(_0x19e5b6,null))[_0xdde2('0x21')](respondWithResult(_0x19e5b6,null))[_0xdde2('0x43')](handleError(_0x19e5b6,null));};exports['create']=function(_0x6c83de,_0x27bfff){return db['Trigger'][_0xdde2('0x46')](_0x6c83de[_0xdde2('0x47')],{})[_0xdde2('0x21')](function(_0x9d330b){var _0x1f2c25=_0x6c83de[_0xdde2('0x48')][_0xdde2('0x23')]({'plain':!![]});if(!_0x1f2c25)throw new Error(_0xdde2('0x49'));if(_0x1f2c25[_0xdde2('0x4a')]==='user'){var _0x21326c=_0x9d330b['get']({'plain':!![]});var _0x117c51=_0xdde2('0x4b');return db[_0xdde2('0x4c')][_0xdde2('0x45')]({'where':{'name':_0x117c51,'userProfileId':_0x1f2c25[_0xdde2('0x4d')]},'raw':!![]})[_0xdde2('0x21')](function(_0x1b2272){if(_0x1b2272&&_0x1b2272['autoAssociation']===0x0){return db['UserProfileResource'][_0xdde2('0x46')]({'name':_0x21326c['name'],'resourceId':_0x21326c['id'],'type':_0x1b2272[_0xdde2('0x3b')],'sectionId':_0x1b2272['id']},{})['then'](function(){return _0x9d330b;});}else{return _0x9d330b;}})[_0xdde2('0x43')](function(_0x20e8c2){logger[_0xdde2('0x25')](_0xdde2('0x4e'),_0x20e8c2);throw _0x20e8c2;});}return _0x9d330b;})[_0xdde2('0x21')](respondWithResult(_0x27bfff,0xc9))[_0xdde2('0x43')](handleError(_0x27bfff,null));};exports[_0xdde2('0x4f')]=function(_0xab6757,_0x594cc7){if(_0xab6757[_0xdde2('0x47')]['id']){delete _0xab6757[_0xdde2('0x47')]['id'];}return db[_0xdde2('0x40')][_0xdde2('0x45')]({'where':{'id':_0xab6757[_0xdde2('0x44')]['id']}})[_0xdde2('0x21')](handleEntityNotFound(_0x594cc7,null))['then'](saveUpdates(_0xab6757['body'],null))[_0xdde2('0x21')](respondWithResult(_0x594cc7,null))['catch'](handleError(_0x594cc7,null));};exports[_0xdde2('0x22')]=function(_0x2f6975,_0x14c285){return db['Trigger'][_0xdde2('0x45')]({'where':{'id':_0x2f6975[_0xdde2('0x44')]['id']}})[_0xdde2('0x21')](handleEntityNotFound(_0x14c285,null))['then'](removeEntity(_0x14c285,null))['catch'](handleError(_0x14c285,null));};exports[_0xdde2('0x50')]=function(_0x557453,_0x36189a,_0x264b2f){if(_0x557453[_0xdde2('0x47')]['id']){delete _0x557453[_0xdde2('0x47')]['id'];}return db['Trigger'][_0xdde2('0x45')]({'where':{'id':_0x557453[_0xdde2('0x44')]['id']}})[_0xdde2('0x21')](handleEntityNotFound(_0x36189a,null))[_0xdde2('0x21')](function(_0x89b4aa){if(_0x89b4aa){_0x557453['body'][_0xdde2('0x51')]=_0x89b4aa['id'];return db[_0xdde2('0x52')]['create'](_0x557453['body']);}})[_0xdde2('0x21')](respondWithResult(_0x36189a,null))['catch'](handleError(_0x36189a,null));};exports[_0xdde2('0x53')]=function(_0x35ad6f,_0x410e46,_0x53103d){if(_0x35ad6f['body']['id']){delete _0x35ad6f['body']['id'];}return db[_0xdde2('0x40')][_0xdde2('0x45')]({'where':{'id':_0x35ad6f[_0xdde2('0x44')]['id']}})['then'](handleEntityNotFound(_0x410e46,null))[_0xdde2('0x21')](function(_0xefb902){if(_0xefb902){_0x35ad6f[_0xdde2('0x47')][_0xdde2('0x54')]=_0xefb902['id'];return db[_0xdde2('0x52')][_0xdde2('0x46')](_0x35ad6f['body']);}})[_0xdde2('0x21')](respondWithResult(_0x410e46,null))[_0xdde2('0x43')](handleError(_0x410e46,null));};exports[_0xdde2('0x55')]=function(_0x142e6b,_0x32b24f,_0x4649e8){var _0xb29d47={};var _0x419cac={};var _0x27d68c;var _0x203611;return db['Trigger'][_0xdde2('0x56')]({'where':{'id':_0x142e6b['params']['id']}})[_0xdde2('0x21')](handleEntityNotFound(_0x32b24f,null))['then'](function(_0x1fdef7){if(_0x1fdef7){_0x27d68c=_0x1fdef7;_0x419cac[_0xdde2('0x2b')]=_[_0xdde2('0x2c')](db[_0xdde2('0x52')][_0xdde2('0x29')]);_0x419cac['query']=_[_0xdde2('0x2c')](_0x142e6b['query']);_0x419cac[_0xdde2('0x36')]=_[_0xdde2('0x2d')](_0x419cac[_0xdde2('0x2b')],_0x419cac[_0xdde2('0x2f')]);_0xb29d47['attributes']=_[_0xdde2('0x2d')](_0x419cac[_0xdde2('0x2b')],qs[_0xdde2('0x2e')](_0x142e6b[_0xdde2('0x2f')]['fields']));_0xb29d47[_0xdde2('0x30')]=_0xb29d47[_0xdde2('0x30')][_0xdde2('0x31')]?_0xb29d47['attributes']:_0x419cac[_0xdde2('0x2b')];_0xb29d47['order']=qs['sort'](_0x142e6b[_0xdde2('0x2f')]['sort']);_0xb29d47[_0xdde2('0x35')]=qs[_0xdde2('0x36')](_['pick'](_0x142e6b[_0xdde2('0x2f')],_0x419cac[_0xdde2('0x36')]));if(_0x142e6b[_0xdde2('0x2f')]['filter']){_0xb29d47[_0xdde2('0x35')]=_[_0xdde2('0x3c')](_0xb29d47[_0xdde2('0x35')],{'$or':_['map'](_0xb29d47[_0xdde2('0x30')],function(_0x550af4){var _0x5b4b37={};_0x5b4b37[_0x550af4]={'$like':'%'+_0x142e6b['query']['filter']+'%'};return _0x5b4b37;})});}_0xb29d47=_[_0xdde2('0x3c')]({},_0xb29d47,_0x142e6b['options']);return _0x27d68c[_0xdde2('0x55')](_0xb29d47);}})[_0xdde2('0x21')](function(_0x15f017){if(_0x15f017){_0x203611=_0x15f017[_0xdde2('0x31')];if(!_0x142e6b[_0xdde2('0x2f')]['hasOwnProperty'](_0xdde2('0x57'))){_0xb29d47[_0xdde2('0x1b')]=qs[_0xdde2('0x1b')](_0x142e6b['query'][_0xdde2('0x1b')]);_0xb29d47[_0xdde2('0x1d')]=qs[_0xdde2('0x1d')](_0x142e6b['query'][_0xdde2('0x1d')]);}return _0x27d68c[_0xdde2('0x55')](_0xb29d47);}})[_0xdde2('0x21')](function(_0x45abab){if(_0x45abab){return _0x45abab?{'count':_0x203611,'rows':_0x45abab}:null;}})['then'](respondWithResult(_0x32b24f,null))[_0xdde2('0x43')](handleError(_0x32b24f,null));};exports[_0xdde2('0x58')]=function(_0x8108dc,_0xa76bd3,_0x1e43d0){var _0xd519b2={};var _0x5970e7={};var _0x452339;var _0x42c854;return db[_0xdde2('0x40')]['findOne']({'where':{'id':_0x8108dc[_0xdde2('0x44')]['id']}})[_0xdde2('0x21')](handleEntityNotFound(_0xa76bd3,null))['then'](function(_0x35b371){if(_0x35b371){_0x452339=_0x35b371;_0x5970e7[_0xdde2('0x2b')]=_['keys'](db[_0xdde2('0x52')][_0xdde2('0x29')]);_0x5970e7['query']=_['keys'](_0x8108dc[_0xdde2('0x2f')]);_0x5970e7[_0xdde2('0x36')]=_[_0xdde2('0x2d')](_0x5970e7[_0xdde2('0x2b')],_0x5970e7[_0xdde2('0x2f')]);_0xd519b2[_0xdde2('0x30')]=_['intersection'](_0x5970e7[_0xdde2('0x2b')],qs[_0xdde2('0x2e')](_0x8108dc[_0xdde2('0x2f')]['fields']));_0xd519b2[_0xdde2('0x30')]=_0xd519b2['attributes'][_0xdde2('0x31')]?_0xd519b2[_0xdde2('0x30')]:_0x5970e7[_0xdde2('0x2b')];_0xd519b2[_0xdde2('0x33')]=qs[_0xdde2('0x34')](_0x8108dc[_0xdde2('0x2f')][_0xdde2('0x34')]);_0xd519b2[_0xdde2('0x35')]=qs[_0xdde2('0x36')](_[_0xdde2('0x37')](_0x8108dc[_0xdde2('0x2f')],_0x5970e7[_0xdde2('0x36')]));if(_0x8108dc['query']['filter']){_0xd519b2[_0xdde2('0x35')]=_[_0xdde2('0x3c')](_0xd519b2[_0xdde2('0x35')],{'$or':_['map'](_0xd519b2[_0xdde2('0x30')],function(_0x1375cc){var _0x533a65={};_0x533a65[_0x1375cc]={'$like':'%'+_0x8108dc[_0xdde2('0x2f')]['filter']+'%'};return _0x533a65;})});}_0xd519b2=_[_0xdde2('0x3c')]({},_0xd519b2,_0x8108dc[_0xdde2('0x3d')]);return _0x452339[_0xdde2('0x58')](_0xd519b2);}})[_0xdde2('0x21')](function(_0x5bb04b){if(_0x5bb04b){_0x42c854=_0x5bb04b[_0xdde2('0x31')];if(!_0x8108dc[_0xdde2('0x2f')]['hasOwnProperty'](_0xdde2('0x57'))){_0xd519b2[_0xdde2('0x1b')]=qs[_0xdde2('0x1b')](_0x8108dc[_0xdde2('0x2f')][_0xdde2('0x1b')]);_0xd519b2[_0xdde2('0x1d')]=qs[_0xdde2('0x1d')](_0x8108dc[_0xdde2('0x2f')][_0xdde2('0x1d')]);}return _0x452339['getAnyConditions'](_0xd519b2);}})[_0xdde2('0x21')](function(_0x49699a){if(_0x49699a){return _0x49699a?{'count':_0x42c854,'rows':_0x49699a}:null;}})['then'](respondWithResult(_0xa76bd3,null))[_0xdde2('0x43')](handleError(_0xa76bd3,null));};exports['addAction']=function(_0x132417,_0x3a7cf5,_0x29ee15){if(_0x132417[_0xdde2('0x47')]['id']){delete _0x132417['body']['id'];}return db[_0xdde2('0x40')][_0xdde2('0x45')]({'where':{'id':_0x132417[_0xdde2('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a7cf5,null))[_0xdde2('0x21')](function(_0x250313){if(_0x250313){_0x132417[_0xdde2('0x47')][_0xdde2('0x59')]=_0x250313['id'];return db[_0xdde2('0x5a')][_0xdde2('0x46')](_0x132417[_0xdde2('0x47')]);}})['then'](respondWithResult(_0x3a7cf5,null))[_0xdde2('0x43')](handleError(_0x3a7cf5,null));};exports[_0xdde2('0x5b')]=function(_0x407224,_0x11afc9,_0x56b588){var _0x5bdfce={};var _0x467a10={};var _0x463edb;var _0x458481;return db[_0xdde2('0x40')][_0xdde2('0x56')]({'where':{'id':_0x407224[_0xdde2('0x44')]['id']}})['then'](handleEntityNotFound(_0x11afc9,null))[_0xdde2('0x21')](function(_0x2ff637){if(_0x2ff637){_0x463edb=_0x2ff637;_0x467a10['model']=_[_0xdde2('0x2c')](db['Action']['rawAttributes']);_0x467a10[_0xdde2('0x2f')]=_['keys'](_0x407224[_0xdde2('0x2f')]);_0x467a10['filters']=_[_0xdde2('0x2d')](_0x467a10[_0xdde2('0x2b')],_0x467a10[_0xdde2('0x2f')]);_0x5bdfce[_0xdde2('0x30')]=_[_0xdde2('0x2d')](_0x467a10[_0xdde2('0x2b')],qs[_0xdde2('0x2e')](_0x407224[_0xdde2('0x2f')][_0xdde2('0x2e')]));_0x5bdfce['attributes']=_0x5bdfce[_0xdde2('0x30')][_0xdde2('0x31')]?_0x5bdfce[_0xdde2('0x30')]:_0x467a10[_0xdde2('0x2b')];_0x5bdfce['order']=qs[_0xdde2('0x34')](_0x407224[_0xdde2('0x2f')][_0xdde2('0x34')]);_0x5bdfce[_0xdde2('0x35')]=qs['filters'](_[_0xdde2('0x37')](_0x407224[_0xdde2('0x2f')],_0x467a10['filters']));if(_0x407224['query'][_0xdde2('0x38')]){_0x5bdfce[_0xdde2('0x35')]=_['merge'](_0x5bdfce[_0xdde2('0x35')],{'$or':_[_0xdde2('0x28')](_0x5bdfce[_0xdde2('0x30')],function(_0x164e36){var _0x54f3bc={};_0x54f3bc[_0x164e36]={'$like':'%'+_0x407224['query'][_0xdde2('0x38')]+'%'};return _0x54f3bc;})});}_0x5bdfce=_['merge']({},_0x5bdfce,_0x407224[_0xdde2('0x3d')]);return _0x463edb[_0xdde2('0x5b')](_0x5bdfce);}})[_0xdde2('0x21')](function(_0x2f829d){if(_0x2f829d){_0x458481=_0x2f829d[_0xdde2('0x31')];if(!_0x407224['query'][_0xdde2('0x32')](_0xdde2('0x57'))){_0x5bdfce[_0xdde2('0x1b')]=qs[_0xdde2('0x1b')](_0x407224[_0xdde2('0x2f')][_0xdde2('0x1b')]);_0x5bdfce[_0xdde2('0x1d')]=qs[_0xdde2('0x1d')](_0x407224[_0xdde2('0x2f')][_0xdde2('0x1d')]);}return _0x463edb['getActions'](_0x5bdfce);}})['then'](function(_0x116439){if(_0x116439){return _0x116439?{'count':_0x458481,'rows':_0x116439}:null;}})[_0xdde2('0x21')](respondWithResult(_0x11afc9,null))[_0xdde2('0x43')](handleError(_0x11afc9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index dc87c07..d2d9f64 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 _0x9b67=['path','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5bad8d,_0x2ff6aa){var _0x321911=function(_0x231063){while(--_0x231063){_0x5bad8d['push'](_0x5bad8d['shift']());}};_0x321911(++_0x2ff6aa);}(_0x9b67,0xf6));var _0x79b6=function(_0x1b2a29,_0xd683b3){_0x1b2a29=_0x1b2a29-0x0;var _0xa06492=_0x9b67[_0x1b2a29];return _0xa06492;};'use strict';var _=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var logger=require(_0x79b6('0x2'))(_0x79b6('0x3'));var moment=require(_0x79b6('0x4'));var BPromise=require('bluebird');var rp=require(_0x79b6('0x5'));var fs=require('fs');var path=require(_0x79b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79b6('0x7'));module[_0x79b6('0x8')]=function(_0x258103,_0xec367e){return _0x258103[_0x79b6('0x9')](_0x79b6('0xa'),attributes,{'tableName':_0x79b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x956a=['request-promise','path','rimraf','exports','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird'];(function(_0x472563,_0x380997){var _0x2efe16=function(_0x49b023){while(--_0x49b023){_0x472563['push'](_0x472563['shift']());}};_0x2efe16(++_0x380997);}(_0x956a,0xb6));var _0xa956=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x956a[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xa956('0x0'));var logger=require(_0xa956('0x1'))(_0xa956('0x2'));var moment=require(_0xa956('0x3'));var BPromise=require(_0xa956('0x4'));var rp=require(_0xa956('0x5'));var fs=require('fs');var path=require(_0xa956('0x6'));var rimraf=require(_0xa956('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xa956('0x8')]=function(_0x2b9675,_0x2ce2c8){return _0x2b9675['define'](_0xa956('0x9'),attributes,{'tableName':_0xa956('0xa'),'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 8c5f44e..4cb4550 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 _0x00c1=['where','attributes','limit','map','include','model','ShowTrigger','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw'];(function(_0x59012e,_0x54c78f){var _0x4f6ab5=function(_0x3958bd){while(--_0x3958bd){_0x59012e['push'](_0x59012e['shift']());}};_0x4f6ab5(++_0x54c78f);}(_0x00c1,0x128));var _0x100c=function(_0x570de5,_0x41a2d5){_0x570de5=_0x570de5-0x0;var _0x3dce05=_0x00c1[_0x570de5];return _0x3dce05;};'use strict';var _=require(_0x100c('0x0'));var util=require('util');var moment=require(_0x100c('0x1'));var BPromise=require(_0x100c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x100c('0x3'));var db=require(_0x100c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x100c('0x5'))(_0x100c('0x6'));var config=require(_0x100c('0x7'));var jayson=require(_0x100c('0x8'));var client=jayson[_0x100c('0x9')][_0x100c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16a00a,_0x43f8e4,_0x64e985){return new BPromise(function(_0x1f72d0,_0x1e4842){return client[_0x100c('0xb')](_0x16a00a,_0x64e985)[_0x100c('0xc')](function(_0x4516f0){logger[_0x100c('0xd')](_0x100c('0xe'),_0x43f8e4,_0x100c('0xf'));logger[_0x100c('0x10')](_0x100c('0x11'),_0x43f8e4,_0x100c('0xf'),JSON[_0x100c('0x12')](_0x4516f0));if(_0x4516f0[_0x100c('0x13')]){if(_0x4516f0['error'][_0x100c('0x14')]===0x1f4){logger['error'](_0x100c('0xe'),_0x43f8e4,_0x4516f0[_0x100c('0x13')]['message']);return _0x1e4842(_0x4516f0['error']['message']);}logger[_0x100c('0x13')](_0x100c('0xe'),_0x43f8e4,_0x4516f0[_0x100c('0x13')][_0x100c('0x15')]);return _0x1f72d0(_0x4516f0[_0x100c('0x13')][_0x100c('0x15')]);}else{logger[_0x100c('0xd')](_0x100c('0xe'),_0x43f8e4,_0x100c('0xf'));_0x1f72d0(_0x4516f0[_0x100c('0x16')][_0x100c('0x15')]);}})[_0x100c('0x17')](function(_0x4955e1){logger[_0x100c('0x13')](_0x100c('0xe'),_0x43f8e4,_0x4955e1);_0x1e4842(_0x4955e1);});});}exports[_0x100c('0x18')]=function(_0x4aac03){var _0xb0015a=this;return new Promise(function(_0x2bfc9b,_0x44b01e){return db[_0x100c('0x19')]['findAll']({'raw':_0x4aac03[_0x100c('0x1a')]?_0x4aac03['options'][_0x100c('0x1b')]===undefined?!![]:![]:!![],'where':_0x4aac03[_0x100c('0x1a')]?_0x4aac03[_0x100c('0x1a')][_0x100c('0x1c')]||null:null,'attributes':_0x4aac03[_0x100c('0x1a')]?_0x4aac03[_0x100c('0x1a')][_0x100c('0x1d')]||null:null,'limit':_0x4aac03[_0x100c('0x1a')]?_0x4aac03[_0x100c('0x1a')][_0x100c('0x1e')]||null:null,'include':_0x4aac03[_0x100c('0x1a')]?_0x4aac03['options']['include']?_[_0x100c('0x1f')](_0x4aac03['options'][_0x100c('0x20')],function(_0x479ea9){return{'model':db[_0x479ea9[_0x100c('0x21')]],'as':_0x479ea9['as'],'attributes':_0x479ea9[_0x100c('0x1d')],'include':_0x479ea9['include']?_[_0x100c('0x1f')](_0x479ea9[_0x100c('0x20')],function(_0x541e59){return{'model':db[_0x541e59[_0x100c('0x21')]],'as':_0x541e59['as'],'attributes':_0x541e59[_0x100c('0x1d')],'include':_0x541e59[_0x100c('0x20')]?_[_0x100c('0x1f')](_0x541e59[_0x100c('0x20')],function(_0x5dee07){return{'model':db[_0x5dee07[_0x100c('0x21')]],'as':_0x5dee07['as'],'attributes':_0x5dee07[_0x100c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x100c('0xc')](function(_0x557a15){logger[_0x100c('0xd')](_0x100c('0x18'),_0x4aac03);logger[_0x100c('0x10')]('GetTrigger',_0x4aac03,JSON['stringify'](_0x557a15));_0x2bfc9b(_0x557a15);})[_0x100c('0x17')](function(_0x39eb95){logger[_0x100c('0x13')](_0x100c('0x18'),_0x39eb95[_0x100c('0x15')],_0x4aac03);_0x44b01e(_0xb0015a[_0x100c('0x13')](0x1f4,_0x39eb95[_0x100c('0x15')]));});});};exports[_0x100c('0x22')]=function(_0x513f87){var _0x3d19b5=this;return new Promise(function(_0x20da09,_0x1ddd10){return db['Trigger'][_0x100c('0x23')]({'raw':_0x513f87[_0x100c('0x1a')]?_0x513f87[_0x100c('0x1a')][_0x100c('0x1b')]===undefined?!![]:![]:!![],'where':_0x513f87['options']?_0x513f87['options']['where']||null:null,'attributes':_0x513f87[_0x100c('0x1a')]?_0x513f87[_0x100c('0x1a')][_0x100c('0x1d')]||null:null,'include':_0x513f87[_0x100c('0x1a')]?_0x513f87['options'][_0x100c('0x20')]?_['map'](_0x513f87[_0x100c('0x1a')][_0x100c('0x20')],function(_0x17a714){return{'model':db[_0x17a714[_0x100c('0x21')]],'as':_0x17a714['as'],'attributes':_0x17a714[_0x100c('0x1d')],'include':_0x17a714[_0x100c('0x20')]?_[_0x100c('0x1f')](_0x17a714[_0x100c('0x20')],function(_0x4f1a01){return{'model':db[_0x4f1a01[_0x100c('0x21')]],'as':_0x4f1a01['as'],'attributes':_0x4f1a01['attributes'],'include':_0x4f1a01['include']?_[_0x100c('0x1f')](_0x4f1a01['include'],function(_0x4daeed){return{'model':db[_0x4daeed[_0x100c('0x21')]],'as':_0x4daeed['as'],'attributes':_0x4daeed['attributes']};}):[]};}):[]};}):[]:[]})[_0x100c('0xc')](function(_0x1cc2b3){logger[_0x100c('0xd')]('ShowTrigger',_0x513f87);logger[_0x100c('0x10')](_0x100c('0x22'),_0x513f87,JSON[_0x100c('0x12')](_0x1cc2b3));_0x20da09(_0x1cc2b3);})[_0x100c('0x17')](function(_0x268d51){logger[_0x100c('0x13')](_0x100c('0x22'),_0x268d51['message'],_0x513f87);_0x1ddd10(_0x3d19b5[_0x100c('0x13')](0x1f4,_0x268d51[_0x100c('0x15')]));});});}; \ No newline at end of file +var _0x08af=['Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','options','raw','where','limit','include','map','attributes','debug','catch','ShowTrigger','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','request\x20sent','stringify','error','code'];(function(_0x4d118c,_0x565ebd){var _0x4e4f28=function(_0xd067b7){while(--_0xd067b7){_0x4d118c['push'](_0x4d118c['shift']());}};_0x4e4f28(++_0x565ebd);}(_0x08af,0x1c2));var _0xf08a=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x08af[_0x550e29];return _0x3515b6;};'use strict';var _=require(_0xf08a('0x0'));var util=require(_0xf08a('0x1'));var moment=require('moment');var BPromise=require(_0xf08a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf08a('0x3'));var db=require(_0xf08a('0x4'))['db'];var utils=require(_0xf08a('0x5'));var logger=require(_0xf08a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf08a('0x7')][_0xf08a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25582c,_0x2eda90,_0x11cf8f){return new BPromise(function(_0x21fe4b,_0x282c6c){return client['request'](_0x25582c,_0x11cf8f)[_0xf08a('0x9')](function(_0xeb1e64){logger[_0xf08a('0xa')]('Trigger,\x20%s,\x20%s',_0x2eda90,_0xf08a('0xb'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x2eda90,'request\x20sent',JSON[_0xf08a('0xc')](_0xeb1e64));if(_0xeb1e64[_0xf08a('0xd')]){if(_0xeb1e64[_0xf08a('0xd')][_0xf08a('0xe')]===0x1f4){logger[_0xf08a('0xd')](_0xf08a('0xf'),_0x2eda90,_0xeb1e64['error']['message']);return _0x282c6c(_0xeb1e64[_0xf08a('0xd')][_0xf08a('0x10')]);}logger[_0xf08a('0xd')](_0xf08a('0xf'),_0x2eda90,_0xeb1e64['error'][_0xf08a('0x10')]);return _0x21fe4b(_0xeb1e64[_0xf08a('0xd')][_0xf08a('0x10')]);}else{logger[_0xf08a('0xa')]('Trigger,\x20%s,\x20%s',_0x2eda90,'request\x20sent');_0x21fe4b(_0xeb1e64[_0xf08a('0x11')][_0xf08a('0x10')]);}})['catch'](function(_0x2d4eb9){logger[_0xf08a('0xd')](_0xf08a('0xf'),_0x2eda90,_0x2d4eb9);_0x282c6c(_0x2d4eb9);});});}exports[_0xf08a('0x12')]=function(_0x2dce66){var _0x7fe64=this;return new Promise(function(_0x486271,_0x3fffc0){return db[_0xf08a('0x13')]['findAll']({'raw':_0x2dce66[_0xf08a('0x14')]?_0x2dce66[_0xf08a('0x14')][_0xf08a('0x15')]===undefined?!![]:![]:!![],'where':_0x2dce66['options']?_0x2dce66[_0xf08a('0x14')][_0xf08a('0x16')]||null:null,'attributes':_0x2dce66[_0xf08a('0x14')]?_0x2dce66[_0xf08a('0x14')]['attributes']||null:null,'limit':_0x2dce66['options']?_0x2dce66[_0xf08a('0x14')][_0xf08a('0x17')]||null:null,'include':_0x2dce66[_0xf08a('0x14')]?_0x2dce66[_0xf08a('0x14')][_0xf08a('0x18')]?_[_0xf08a('0x19')](_0x2dce66[_0xf08a('0x14')][_0xf08a('0x18')],function(_0x1eeb39){return{'model':db[_0x1eeb39['model']],'as':_0x1eeb39['as'],'attributes':_0x1eeb39[_0xf08a('0x1a')],'include':_0x1eeb39[_0xf08a('0x18')]?_[_0xf08a('0x19')](_0x1eeb39['include'],function(_0x145b95){return{'model':db[_0x145b95['model']],'as':_0x145b95['as'],'attributes':_0x145b95[_0xf08a('0x1a')],'include':_0x145b95['include']?_[_0xf08a('0x19')](_0x145b95[_0xf08a('0x18')],function(_0x1fb88a){return{'model':db[_0x1fb88a['model']],'as':_0x1fb88a['as'],'attributes':_0x1fb88a['attributes']};}):[]};}):[]};}):[]:[]})[_0xf08a('0x9')](function(_0x4aad14){logger[_0xf08a('0xa')]('GetTrigger',_0x2dce66);logger[_0xf08a('0x1b')](_0xf08a('0x12'),_0x2dce66,JSON[_0xf08a('0xc')](_0x4aad14));_0x486271(_0x4aad14);})[_0xf08a('0x1c')](function(_0x5d0217){logger[_0xf08a('0xd')](_0xf08a('0x12'),_0x5d0217['message'],_0x2dce66);_0x3fffc0(_0x7fe64[_0xf08a('0xd')](0x1f4,_0x5d0217[_0xf08a('0x10')]));});});};exports[_0xf08a('0x1d')]=function(_0x4eb7a3){var _0x200fb1=this;return new Promise(function(_0x6a1910,_0x218224){return db['Trigger']['find']({'raw':_0x4eb7a3['options']?_0x4eb7a3[_0xf08a('0x14')][_0xf08a('0x15')]===undefined?!![]:![]:!![],'where':_0x4eb7a3[_0xf08a('0x14')]?_0x4eb7a3[_0xf08a('0x14')][_0xf08a('0x16')]||null:null,'attributes':_0x4eb7a3[_0xf08a('0x14')]?_0x4eb7a3[_0xf08a('0x14')]['attributes']||null:null,'include':_0x4eb7a3[_0xf08a('0x14')]?_0x4eb7a3[_0xf08a('0x14')][_0xf08a('0x18')]?_[_0xf08a('0x19')](_0x4eb7a3[_0xf08a('0x14')][_0xf08a('0x18')],function(_0x324c08){return{'model':db[_0x324c08['model']],'as':_0x324c08['as'],'attributes':_0x324c08[_0xf08a('0x1a')],'include':_0x324c08[_0xf08a('0x18')]?_['map'](_0x324c08[_0xf08a('0x18')],function(_0x46f29e){return{'model':db[_0x46f29e[_0xf08a('0x1e')]],'as':_0x46f29e['as'],'attributes':_0x46f29e[_0xf08a('0x1a')],'include':_0x46f29e[_0xf08a('0x18')]?_[_0xf08a('0x19')](_0x46f29e['include'],function(_0xd6edb4){return{'model':db[_0xd6edb4[_0xf08a('0x1e')]],'as':_0xd6edb4['as'],'attributes':_0xd6edb4[_0xf08a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf08a('0x9')](function(_0x2842ec){logger[_0xf08a('0xa')](_0xf08a('0x1d'),_0x4eb7a3);logger[_0xf08a('0x1b')](_0xf08a('0x1d'),_0x4eb7a3,JSON[_0xf08a('0xc')](_0x2842ec));_0x6a1910(_0x2842ec);})[_0xf08a('0x1c')](function(_0x519649){logger[_0xf08a('0xd')](_0xf08a('0x1d'),_0x519649['message'],_0x4eb7a3);_0x218224(_0x200fb1[_0xf08a('0xd')](0x1f4,_0x519649[_0xf08a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index aac97ee..8ce304e 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 _0xcce7=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','index','get','/:id','show','post','isAuthenticated','clone','create','put','delete','destroy','exports'];(function(_0x4d8f83,_0x129522){var _0x132f03=function(_0x230c7c){while(--_0x230c7c){_0x4d8f83['push'](_0x4d8f83['shift']());}};_0x132f03(++_0x129522);}(_0xcce7,0x18f));var _0x7cce=function(_0x321e88,_0xfc4b5){_0x321e88=_0x321e88-0x0;var _0x4194c9=_0xcce7[_0x321e88];return _0x4194c9;};'use strict';var multer=require(_0x7cce('0x0'));var util=require(_0x7cce('0x1'));var path=require(_0x7cce('0x2'));var timeout=require(_0x7cce('0x3'));var express=require('express');var router=express[_0x7cce('0x4')]();var fs_extra=require(_0x7cce('0x5'));var auth=require(_0x7cce('0x6'));var interaction=require(_0x7cce('0x7'));var config=require('../../config/environment');var controller=require(_0x7cce('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7cce('0x9')]);router[_0x7cce('0xa')](_0x7cce('0xb'),auth['isAuthenticated'](),controller[_0x7cce('0xc')]);router[_0x7cce('0xd')]('/:id/clone',auth[_0x7cce('0xe')](),controller[_0x7cce('0xf')]);router['post']('/',auth[_0x7cce('0xe')](),controller[_0x7cce('0x10')]);router[_0x7cce('0x11')](_0x7cce('0xb'),auth[_0x7cce('0xe')](),controller['update']);router[_0x7cce('0x12')](_0x7cce('0xb'),auth[_0x7cce('0xe')](),controller[_0x7cce('0x13')]);module[_0x7cce('0x14')]=router; \ No newline at end of file +var _0xc6af=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','isAuthenticated','post','clone','put','/:id','update','delete','destroy','exports','multer'];(function(_0xd2a00,_0x466b24){var _0xaea2e6=function(_0x55f1bd){while(--_0x55f1bd){_0xd2a00['push'](_0xd2a00['shift']());}};_0xaea2e6(++_0x466b24);}(_0xc6af,0xc7));var _0xfc6a=function(_0x126953,_0xe4d9a5){_0x126953=_0x126953-0x0;var _0x54b870=_0xc6af[_0x126953];return _0x54b870;};'use strict';var multer=require(_0xfc6a('0x0'));var util=require(_0xfc6a('0x1'));var path=require(_0xfc6a('0x2'));var timeout=require(_0xfc6a('0x3'));var express=require(_0xfc6a('0x4'));var router=express[_0xfc6a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc6a('0x6'));var config=require(_0xfc6a('0x7'));var controller=require(_0xfc6a('0x8'));router[_0xfc6a('0x9')]('/',auth['isAuthenticated'](),controller[_0xfc6a('0xa')]);router[_0xfc6a('0x9')]('/:id',auth[_0xfc6a('0xb')](),controller['show']);router[_0xfc6a('0xc')]('/:id/clone',auth[_0xfc6a('0xb')](),controller[_0xfc6a('0xd')]);router[_0xfc6a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfc6a('0xe')](_0xfc6a('0xf'),auth['isAuthenticated'](),controller[_0xfc6a('0x10')]);router[_0xfc6a('0x11')](_0xfc6a('0xf'),auth['isAuthenticated'](),controller[_0xfc6a('0x12')]);module[_0xfc6a('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b11c307..d9b60df 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 _0xd46f=['PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','actpass','dynamic','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xd46f,0x136));var _0xfd46=function(_0x40c5fb,_0x3af269){_0x40c5fb=_0x40c5fb-0x0;var _0x341acb=_0xd46f[_0x40c5fb];return _0x341acb;};'use strict';var Sequelize=require(_0xfd46('0x0'));module[_0xfd46('0x1')]={'name':{'type':Sequelize[_0xfd46('0x2')],'allowNull':![],'unique':_0xfd46('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x5'),_0xfd46('0x6'),_0xfd46('0x7')),'allowNull':![],'defaultValue':_0xfd46('0x5')},'context':{'type':Sequelize[_0xfd46('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x8'),_0xfd46('0x9'),_0xfd46('0xa'),_0xfd46('0xb'),_0xfd46('0xc'),_0xfd46('0xd'),_0xfd46('0xe'),_0xfd46('0xf'))},'deny':{'type':Sequelize[_0xfd46('0x2')]},'permit':{'type':Sequelize[_0xfd46('0x2')]},'secret':{'type':Sequelize[_0xfd46('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xfd46('0x2')]},'transport':{'type':Sequelize[_0xfd46('0x2')],'defaultValue':'udp','set':function(_0x1fb315){this[_0xfd46('0x10')](_0xfd46('0x11'),_0x1fb315?_0x1fb315[_0xfd46('0x12')](','):null);},'get':function(){return this[_0xfd46('0x13')]('transport')?this['getDataValue']('transport')[_0xfd46('0x14')](','):null;},'comment':_0xfd46('0x15')},'dtmfmode':{'type':Sequelize['ENUM'](_0xfd46('0x16'),_0xfd46('0x17'),_0xfd46('0x18'),_0xfd46('0x19'),'auto'),'defaultValue':_0xfd46('0x16')},'directmedia':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no',_0xfd46('0x1b'),_0xfd46('0x1c'),_0xfd46('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xfd46('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xfd46('0x2')],'defaultValue':_0xfd46('0x1e'),'set':function(_0x194ff1){this[_0xfd46('0x10')](_0xfd46('0x1f'),_0x194ff1?_0x194ff1[_0xfd46('0x12')](','):null);},'get':function(){return this[_0xfd46('0x13')]('nat')?this[_0xfd46('0x13')](_0xfd46('0x1f'))[_0xfd46('0x14')](','):null;},'comment':_0xfd46('0x20')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xfd46('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xfd46('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfd46('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xfd46('0x2')],'defaultValue':_0xfd46('0x21')},'allow':{'type':Sequelize[_0xfd46('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x8ad3e4){this[_0xfd46('0x10')](_0xfd46('0x22'),_0x8ad3e4?_0x8ad3e4[_0xfd46('0x12')](';'):_0xfd46('0x23'));},'get':function(){return this[_0xfd46('0x13')](_0xfd46('0x22'))?this[_0xfd46('0x13')](_0xfd46('0x22'))[_0xfd46('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no')},'insecure':{'type':Sequelize[_0xfd46('0x2')],'defaultValue':_0xfd46('0x24'),'set':function(_0xbd240){this[_0xfd46('0x10')](_0xfd46('0x25'),_0xbd240?_0xbd240[_0xfd46('0x12')](','):null);},'get':function(){return this[_0xfd46('0x13')](_0xfd46('0x25'))?this[_0xfd46('0x13')](_0xfd46('0x25'))[_0xfd46('0x14')](','):null;},'comment':_0xfd46('0x26')},'trustrpid':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xfd46('0x1a'),'no',_0xfd46('0x27'))},'promiscredir':{'type':Sequelize['ENUM'](_0xfd46('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xfd46('0x28')](0xb)},'setvar':{'type':Sequelize[_0xfd46('0x2')]},'callerid':{'type':Sequelize[_0xfd46('0x2')],'defaultValue':_0xfd46('0x29')},'amaflags':{'type':Sequelize[_0xfd46('0x2')]},'callcounter':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no'),'defaultValue':_0xfd46('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xfd46('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xfd46('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xfd46('0x2')]},'template':{'type':Sequelize[_0xfd46('0x2')]},'videosupport':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no',_0xfd46('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfd46('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xfd46('0x4')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xfd46('0x2b'),_0xfd46('0x2c'),_0xfd46('0x2d'))},'session_expires':{'type':Sequelize[_0xfd46('0x28')](0xb)},'session_minse':{'type':Sequelize[_0xfd46('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x2e'),_0xfd46('0x2f')),'defaultValue':_0xfd46('0x2f')},'t38pt_usertpsource':{'type':Sequelize[_0xfd46('0x2')]},'regexten':{'type':Sequelize[_0xfd46('0x2')]},'fromdomain':{'type':Sequelize[_0xfd46('0x2')]},'fromuser':{'type':Sequelize[_0xfd46('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xfd46('0x1a'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xfd46('0x28')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xfd46('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xfd46('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no',_0xfd46('0x30')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xfd46('0x2')]},'timert1':{'type':Sequelize[_0xfd46('0x28')](0xb)},'timerb':{'type':Sequelize[_0xfd46('0x28')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xfd46('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xfd46('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xfd46('0x2')]},'use_q850_reason':{'type':Sequelize[_0xfd46('0x2')]},'maxforwards':{'type':Sequelize[_0xfd46('0x28')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xfd46('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xfd46('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xfd46('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xfd46('0x1a'),'no',_0xfd46('0x31'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xfd46('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xfd46('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xfd46('0x2')]},'dtlscapath':{'type':Sequelize[_0xfd46('0x2')]},'dtlssetup':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x32'),'passive',_0xfd46('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfd46('0x2')]},'usereqphone':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfd46('0x2')]},'recordofffeature':{'type':Sequelize[_0xfd46('0x2')]},'call_limit':{'type':Sequelize[_0xfd46('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xfd46('0x2')]},'mohinterpret':{'type':Sequelize[_0xfd46('0x2')]},'mohsuggest':{'type':Sequelize[_0xfd46('0x2')]},'parkinglot':{'type':Sequelize[_0xfd46('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfd46('0x2')],'defaultValue':_0xfd46('0x34')},'canreinvite':{'type':Sequelize[_0xfd46('0x4')](_0xfd46('0x1a'),'no','nonat',_0xfd46('0x1c'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xfd46('0x2')]},'otherFields':{'type':Sequelize[_0xfd46('0x2')]},'active':{'type':Sequelize[_0xfd46('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xfd46('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xb5b7=['name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING'];(function(_0x39c548,_0x2f529e){var _0x16ae79=function(_0x150aee){while(--_0x150aee){_0x39c548['push'](_0x39c548['shift']());}};_0x16ae79(++_0x2f529e);}(_0xb5b7,0x1da));var _0x7b5b=function(_0x395bd1,_0x6dd068){_0x395bd1=_0x395bd1-0x0;var _0x118a34=_0xb5b7[_0x395bd1];return _0x118a34;};'use strict';var Sequelize=require(_0x7b5b('0x0'));module[_0x7b5b('0x1')]={'name':{'type':Sequelize[_0x7b5b('0x2')],'allowNull':![],'unique':_0x7b5b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x5'),_0x7b5b('0x6'),_0x7b5b('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7b5b('0x8')},'callingpres':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x9'),_0x7b5b('0xa'),_0x7b5b('0xb'),_0x7b5b('0xc'),_0x7b5b('0xd'),_0x7b5b('0xe'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x7b5b('0x2')]},'permit':{'type':Sequelize[_0x7b5b('0x2')]},'secret':{'type':Sequelize[_0x7b5b('0x2')]},'md5secret':{'type':Sequelize[_0x7b5b('0x2')]},'remotesecret':{'type':Sequelize[_0x7b5b('0x2')]},'transport':{'type':Sequelize[_0x7b5b('0x2')],'defaultValue':_0x7b5b('0xf'),'set':function(_0x43e865){this[_0x7b5b('0x10')](_0x7b5b('0x11'),_0x43e865?_0x43e865[_0x7b5b('0x12')](','):null);},'get':function(){return this[_0x7b5b('0x13')](_0x7b5b('0x11'))?this[_0x7b5b('0x13')](_0x7b5b('0x11'))[_0x7b5b('0x14')](','):null;},'comment':_0x7b5b('0x15')},'dtmfmode':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x16'),_0x7b5b('0x17'),_0x7b5b('0x18'),'inband',_0x7b5b('0x19')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no','nonat',_0x7b5b('0x1b'),_0x7b5b('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x7b5b('0x2')],'defaultValue':_0x7b5b('0x1d'),'set':function(_0x5b2c58){this[_0x7b5b('0x10')](_0x7b5b('0x1e'),_0x5b2c58?_0x5b2c58[_0x7b5b('0x12')](','):null);},'get':function(){return this[_0x7b5b('0x13')](_0x7b5b('0x1e'))?this[_0x7b5b('0x13')](_0x7b5b('0x1e'))[_0x7b5b('0x14')](','):null;},'comment':_0x7b5b('0x1f')},'callgroup':{'type':Sequelize[_0x7b5b('0x2')]},'namedcallgroup':{'type':Sequelize[_0x7b5b('0x2')]},'pickupgroup':{'type':Sequelize[_0x7b5b('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7b5b('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7b5b('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7b5b('0x2')],'defaultValue':_0x7b5b('0x20')},'allow':{'type':Sequelize[_0x7b5b('0x2')],'allowNull':![],'defaultValue':_0x7b5b('0x21'),'set':function(_0x1ae56e){this[_0x7b5b('0x10')](_0x7b5b('0x22'),_0x1ae56e?_0x1ae56e[_0x7b5b('0x12')](';'):_0x7b5b('0x21'));},'get':function(){return this[_0x7b5b('0x13')](_0x7b5b('0x22'))?this[_0x7b5b('0x13')](_0x7b5b('0x22'))[_0x7b5b('0x14')](';'):null;},'comment':_0x7b5b('0x23')},'autoframing':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no')},'insecure':{'type':Sequelize[_0x7b5b('0x2')],'defaultValue':'port,invite','set':function(_0x2de24f){this[_0x7b5b('0x10')]('insecure',_0x2de24f?_0x2de24f['join'](','):null);},'get':function(){return this[_0x7b5b('0x13')](_0x7b5b('0x24'))?this[_0x7b5b('0x13')](_0x7b5b('0x24'))[_0x7b5b('0x14')](','):null;},'comment':_0x7b5b('0x25')},'trustrpid':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x7b5b('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'setvar':{'type':Sequelize[_0x7b5b('0x2')]},'callerid':{'type':Sequelize[_0x7b5b('0x2')],'defaultValue':_0x7b5b('0x27')},'amaflags':{'type':Sequelize[_0x7b5b('0x2')]},'callcounter':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x7b5b('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x7b5b('0x2')]},'template':{'type':Sequelize[_0x7b5b('0x2')]},'videosupport':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no',_0x7b5b('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7b5b('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x7b5b('0x2')]},'session_timers':{'type':Sequelize[_0x7b5b('0x4')]('accept',_0x7b5b('0x29'),_0x7b5b('0x2a'))},'session_expires':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x2b'),_0x7b5b('0x2c')),'defaultValue':_0x7b5b('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x7b5b('0x2')]},'regexten':{'type':Sequelize[_0x7b5b('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x7b5b('0x2')]},'port':{'type':Sequelize[_0x7b5b('0x26')](0x5)},'qualify':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x7b5b('0x2')]},'rtptimeout':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x7b5b('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7b5b('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x7b5b('0x2')]},'contactdeny':{'type':Sequelize[_0x7b5b('0x2')]},'contactacl':{'type':Sequelize[_0x7b5b('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x7b5b('0x2')]},'use_q850_reason':{'type':Sequelize[_0x7b5b('0x2')]},'maxforwards':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'encryption':{'type':Sequelize[_0x7b5b('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x7b5b('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no',_0x7b5b('0x2d'),_0x7b5b('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x7b5b('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x7b5b('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7b5b('0x2')]},'dtlscapath':{'type':Sequelize[_0x7b5b('0x2')]},'dtlssetup':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x2f'),'passive',_0x7b5b('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7b5b('0x2')]},'usereqphone':{'type':Sequelize[_0x7b5b('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7b5b('0x2')]},'recordofffeature':{'type':Sequelize[_0x7b5b('0x2')]},'call_limit':{'type':Sequelize[_0x7b5b('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x7b5b('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x7b5b('0x2')]},'mohinterpret':{'type':Sequelize[_0x7b5b('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x7b5b('0x2')]},'description':{'type':Sequelize[_0x7b5b('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x7b5b('0x31')},'canreinvite':{'type':Sequelize[_0x7b5b('0x4')](_0x7b5b('0x1a'),'no',_0x7b5b('0x32'),'update',_0x7b5b('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7b5b('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7b5b('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 981f613..ab7b724 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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x469bff,_0x2aad22){_0x469bff=_0x469bff-0x0;var _0x47bff2=_0xe5b3[_0x469bff];return _0x47bff2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file +var _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x81bd,0x7c));var _0xd81b=function(_0x12a57d,_0x738bd1){_0x12a57d=_0x12a57d-0x0;var _0x4b26f6=_0x81bd[_0x12a57d];return _0x4b26f6;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7d72f69..3bd95e4 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 _0x4f4a=['../../config/logger','moment','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x4f4a,0x1ac));var _0xa4f4=function(_0x319df2,_0x4085fb){_0x319df2=_0x319df2-0x0;var _0x41f9df=_0x4f4a[_0x319df2];return _0x41f9df;};'use strict';var _=require(_0xa4f4('0x0'));var util=require('util');var logger=require(_0xa4f4('0x1'))('api');var moment=require(_0xa4f4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4f4('0x3'));var rimraf=require(_0xa4f4('0x4'));var config=require(_0xa4f4('0x5'));var attributes=require(_0xa4f4('0x6'));module[_0xa4f4('0x7')]=function(_0x271911,_0x3e4cae){return _0x271911[_0xa4f4('0x8')](_0xa4f4('0x9'),attributes,{'tableName':_0xa4f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68af=['../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x68af,0x10d));var _0xf68a=function(_0x42d07b,_0x25c091){_0x42d07b=_0x42d07b-0x0;var _0x515bc7=_0x68af[_0x42d07b];return _0x515bc7;};'use strict';var _=require(_0xf68a('0x0'));var util=require(_0xf68a('0x1'));var logger=require(_0xf68a('0x2'))('api');var moment=require(_0xf68a('0x3'));var BPromise=require('bluebird');var rp=require(_0xf68a('0x4'));var fs=require('fs');var path=require(_0xf68a('0x5'));var rimraf=require(_0xf68a('0x6'));var config=require(_0xf68a('0x7'));var attributes=require(_0xf68a('0x8'));module[_0xf68a('0x9')]=function(_0x11e10d,_0x5cf242){return _0x11e10d[_0xf68a('0xa')]('Trunk',attributes,{'tableName':_0xf68a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 83feb94..7a4b60c 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 _0x8a63=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Trunk','findAll','raw','options','where','attributes','include','map','model','GetTrunk','find','ShowTrunk','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5ccfa9,_0x415e4d){var _0x228ced=function(_0x57750a){while(--_0x57750a){_0x5ccfa9['push'](_0x5ccfa9['shift']());}};_0x228ced(++_0x415e4d);}(_0x8a63,0x1dd));var _0x38a6=function(_0x52d18d,_0x2bdf0d){_0x52d18d=_0x52d18d-0x0;var _0x3fada0=_0x8a63[_0x52d18d];return _0x3fada0;};'use strict';var _=require(_0x38a6('0x0'));var util=require('util');var moment=require(_0x38a6('0x1'));var BPromise=require(_0x38a6('0x2'));var rs=require(_0x38a6('0x3'));var fs=require('fs');var Redis=require(_0x38a6('0x4'));var db=require(_0x38a6('0x5'))['db'];var utils=require(_0x38a6('0x6'));var logger=require('../../config/logger')(_0x38a6('0x7'));var config=require(_0x38a6('0x8'));var jayson=require(_0x38a6('0x9'));var client=jayson[_0x38a6('0xa')][_0x38a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x226537,_0x2d4664,_0x55152d){return new BPromise(function(_0x2e8d68,_0x487237){return client['request'](_0x226537,_0x55152d)[_0x38a6('0xc')](function(_0x3f9083){logger[_0x38a6('0xd')](_0x38a6('0xe'),_0x2d4664,_0x38a6('0xf'));logger[_0x38a6('0x10')](_0x38a6('0x11'),_0x2d4664,_0x38a6('0xf'),JSON[_0x38a6('0x12')](_0x3f9083));if(_0x3f9083[_0x38a6('0x13')]){if(_0x3f9083[_0x38a6('0x13')][_0x38a6('0x14')]===0x1f4){logger[_0x38a6('0x13')](_0x38a6('0xe'),_0x2d4664,_0x3f9083[_0x38a6('0x13')][_0x38a6('0x15')]);return _0x487237(_0x3f9083['error'][_0x38a6('0x15')]);}logger[_0x38a6('0x13')](_0x38a6('0xe'),_0x2d4664,_0x3f9083['error'][_0x38a6('0x15')]);return _0x2e8d68(_0x3f9083['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x2d4664,_0x38a6('0xf'));_0x2e8d68(_0x3f9083['result'][_0x38a6('0x15')]);}})[_0x38a6('0x16')](function(_0x22b8c9){logger[_0x38a6('0x13')](_0x38a6('0xe'),_0x2d4664,_0x22b8c9);_0x487237(_0x22b8c9);});});}exports['GetTrunk']=function(_0x4f130d){var _0x17aba6=this;return new Promise(function(_0x33e7d0,_0x458ae7){return db[_0x38a6('0x17')][_0x38a6('0x18')]({'raw':_0x4f130d['options']?_0x4f130d['options'][_0x38a6('0x19')]===undefined?!![]:![]:!![],'where':_0x4f130d['options']?_0x4f130d[_0x38a6('0x1a')][_0x38a6('0x1b')]||null:null,'attributes':_0x4f130d['options']?_0x4f130d[_0x38a6('0x1a')][_0x38a6('0x1c')]||null:null,'limit':_0x4f130d['options']?_0x4f130d[_0x38a6('0x1a')]['limit']||null:null,'include':_0x4f130d[_0x38a6('0x1a')]?_0x4f130d[_0x38a6('0x1a')][_0x38a6('0x1d')]?_['map'](_0x4f130d[_0x38a6('0x1a')][_0x38a6('0x1d')],function(_0x37a320){return{'model':db[_0x37a320['model']],'as':_0x37a320['as'],'attributes':_0x37a320['attributes'],'include':_0x37a320['include']?_[_0x38a6('0x1e')](_0x37a320['include'],function(_0x299769){return{'model':db[_0x299769[_0x38a6('0x1f')]],'as':_0x299769['as'],'attributes':_0x299769[_0x38a6('0x1c')],'include':_0x299769[_0x38a6('0x1d')]?_[_0x38a6('0x1e')](_0x299769[_0x38a6('0x1d')],function(_0x534ce3){return{'model':db[_0x534ce3[_0x38a6('0x1f')]],'as':_0x534ce3['as'],'attributes':_0x534ce3[_0x38a6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38a6('0xc')](function(_0x205bed){logger['info']('GetTrunk',_0x4f130d);logger[_0x38a6('0x10')]('GetTrunk',_0x4f130d,JSON[_0x38a6('0x12')](_0x205bed));_0x33e7d0(_0x205bed);})[_0x38a6('0x16')](function(_0x2cb6d1){logger[_0x38a6('0x13')](_0x38a6('0x20'),_0x2cb6d1[_0x38a6('0x15')],_0x4f130d);_0x458ae7(_0x17aba6[_0x38a6('0x13')](0x1f4,_0x2cb6d1[_0x38a6('0x15')]));});});};exports['ShowTrunk']=function(_0x217384){var _0xa91210=this;return new Promise(function(_0x1c4535,_0x34cd72){return db[_0x38a6('0x17')][_0x38a6('0x21')]({'raw':_0x217384['options']?_0x217384[_0x38a6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x217384[_0x38a6('0x1a')]?_0x217384[_0x38a6('0x1a')][_0x38a6('0x1b')]||null:null,'attributes':_0x217384[_0x38a6('0x1a')]?_0x217384[_0x38a6('0x1a')][_0x38a6('0x1c')]||null:null,'include':_0x217384[_0x38a6('0x1a')]?_0x217384[_0x38a6('0x1a')]['include']?_[_0x38a6('0x1e')](_0x217384[_0x38a6('0x1a')][_0x38a6('0x1d')],function(_0x54dc9a){return{'model':db[_0x54dc9a[_0x38a6('0x1f')]],'as':_0x54dc9a['as'],'attributes':_0x54dc9a['attributes'],'include':_0x54dc9a[_0x38a6('0x1d')]?_[_0x38a6('0x1e')](_0x54dc9a[_0x38a6('0x1d')],function(_0x25c8de){return{'model':db[_0x25c8de[_0x38a6('0x1f')]],'as':_0x25c8de['as'],'attributes':_0x25c8de['attributes'],'include':_0x25c8de[_0x38a6('0x1d')]?_[_0x38a6('0x1e')](_0x25c8de[_0x38a6('0x1d')],function(_0x14f3df){return{'model':db[_0x14f3df['model']],'as':_0x14f3df['as'],'attributes':_0x14f3df[_0x38a6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38a6('0xc')](function(_0x24f414){logger[_0x38a6('0xd')]('ShowTrunk',_0x217384);logger[_0x38a6('0x10')](_0x38a6('0x22'),_0x217384,JSON[_0x38a6('0x12')](_0x24f414));_0x1c4535(_0x24f414);})[_0x38a6('0x16')](function(_0x4d9c60){logger['error']('ShowTrunk',_0x4d9c60[_0x38a6('0x15')],_0x217384);_0x34cd72(_0xa91210[_0x38a6('0x13')](0x1f4,_0x4d9c60[_0x38a6('0x15')]));});});}; \ No newline at end of file +var _0x25cf=['http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','attributes','map','debug','find','ShowTrunk','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2a8a0d,_0x7632dc){var _0x131741=function(_0x1a66d8){while(--_0x1a66d8){_0x2a8a0d['push'](_0x2a8a0d['shift']());}};_0x131741(++_0x7632dc);}(_0x25cf,0xa2));var _0xf25c=function(_0x464ea4,_0x239588){_0x464ea4=_0x464ea4-0x0;var _0x567d6e=_0x25cf[_0x464ea4];return _0x567d6e;};'use strict';var _=require(_0xf25c('0x0'));var util=require('util');var moment=require(_0xf25c('0x1'));var BPromise=require(_0xf25c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf25c('0x3'))['db'];var utils=require(_0xf25c('0x4'));var logger=require(_0xf25c('0x5'))('rpc');var config=require(_0xf25c('0x6'));var jayson=require(_0xf25c('0x7'));var client=jayson['client'][_0xf25c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f3f36,_0x418c9c,_0x1650bd){return new BPromise(function(_0x2df4e7,_0x3868e9){return client[_0xf25c('0x9')](_0x5f3f36,_0x1650bd)[_0xf25c('0xa')](function(_0x48ebb8){logger[_0xf25c('0xb')](_0xf25c('0xc'),_0x418c9c,_0xf25c('0xd'));logger['debug'](_0xf25c('0xe'),_0x418c9c,_0xf25c('0xd'),JSON['stringify'](_0x48ebb8));if(_0x48ebb8[_0xf25c('0xf')]){if(_0x48ebb8[_0xf25c('0xf')][_0xf25c('0x10')]===0x1f4){logger[_0xf25c('0xf')](_0xf25c('0xc'),_0x418c9c,_0x48ebb8['error'][_0xf25c('0x11')]);return _0x3868e9(_0x48ebb8[_0xf25c('0xf')][_0xf25c('0x11')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x418c9c,_0x48ebb8['error'][_0xf25c('0x11')]);return _0x2df4e7(_0x48ebb8[_0xf25c('0xf')]['message']);}else{logger[_0xf25c('0xb')](_0xf25c('0xc'),_0x418c9c,_0xf25c('0xd'));_0x2df4e7(_0x48ebb8[_0xf25c('0x12')]['message']);}})[_0xf25c('0x13')](function(_0x1904d9){logger[_0xf25c('0xf')](_0xf25c('0xc'),_0x418c9c,_0x1904d9);_0x3868e9(_0x1904d9);});});}exports[_0xf25c('0x14')]=function(_0x3efc3b){var _0x2a44de=this;return new Promise(function(_0x4ec6d8,_0x219e4a){return db[_0xf25c('0x15')]['findAll']({'raw':_0x3efc3b[_0xf25c('0x16')]?_0x3efc3b['options'][_0xf25c('0x17')]===undefined?!![]:![]:!![],'where':_0x3efc3b[_0xf25c('0x16')]?_0x3efc3b[_0xf25c('0x16')][_0xf25c('0x18')]||null:null,'attributes':_0x3efc3b[_0xf25c('0x16')]?_0x3efc3b[_0xf25c('0x16')]['attributes']||null:null,'limit':_0x3efc3b['options']?_0x3efc3b['options'][_0xf25c('0x19')]||null:null,'include':_0x3efc3b[_0xf25c('0x16')]?_0x3efc3b['options'][_0xf25c('0x1a')]?_['map'](_0x3efc3b[_0xf25c('0x16')]['include'],function(_0x4a297c){return{'model':db[_0x4a297c[_0xf25c('0x1b')]],'as':_0x4a297c['as'],'attributes':_0x4a297c[_0xf25c('0x1c')],'include':_0x4a297c[_0xf25c('0x1a')]?_[_0xf25c('0x1d')](_0x4a297c[_0xf25c('0x1a')],function(_0x14b2d6){return{'model':db[_0x14b2d6[_0xf25c('0x1b')]],'as':_0x14b2d6['as'],'attributes':_0x14b2d6[_0xf25c('0x1c')],'include':_0x14b2d6['include']?_[_0xf25c('0x1d')](_0x14b2d6[_0xf25c('0x1a')],function(_0x268029){return{'model':db[_0x268029[_0xf25c('0x1b')]],'as':_0x268029['as'],'attributes':_0x268029[_0xf25c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf25c('0xa')](function(_0x3cd344){logger[_0xf25c('0xb')](_0xf25c('0x14'),_0x3efc3b);logger[_0xf25c('0x1e')](_0xf25c('0x14'),_0x3efc3b,JSON['stringify'](_0x3cd344));_0x4ec6d8(_0x3cd344);})[_0xf25c('0x13')](function(_0x4af4e4){logger[_0xf25c('0xf')](_0xf25c('0x14'),_0x4af4e4[_0xf25c('0x11')],_0x3efc3b);_0x219e4a(_0x2a44de['error'](0x1f4,_0x4af4e4[_0xf25c('0x11')]));});});};exports['ShowTrunk']=function(_0x389539){var _0x48a6fe=this;return new Promise(function(_0x5dc49f,_0x95df5e){return db['Trunk'][_0xf25c('0x1f')]({'raw':_0x389539[_0xf25c('0x16')]?_0x389539[_0xf25c('0x16')][_0xf25c('0x17')]===undefined?!![]:![]:!![],'where':_0x389539['options']?_0x389539[_0xf25c('0x16')][_0xf25c('0x18')]||null:null,'attributes':_0x389539['options']?_0x389539[_0xf25c('0x16')]['attributes']||null:null,'include':_0x389539[_0xf25c('0x16')]?_0x389539[_0xf25c('0x16')][_0xf25c('0x1a')]?_[_0xf25c('0x1d')](_0x389539[_0xf25c('0x16')][_0xf25c('0x1a')],function(_0x39494f){return{'model':db[_0x39494f['model']],'as':_0x39494f['as'],'attributes':_0x39494f[_0xf25c('0x1c')],'include':_0x39494f[_0xf25c('0x1a')]?_[_0xf25c('0x1d')](_0x39494f[_0xf25c('0x1a')],function(_0x5733de){return{'model':db[_0x5733de[_0xf25c('0x1b')]],'as':_0x5733de['as'],'attributes':_0x5733de[_0xf25c('0x1c')],'include':_0x5733de[_0xf25c('0x1a')]?_['map'](_0x5733de[_0xf25c('0x1a')],function(_0x33f6a2){return{'model':db[_0x33f6a2[_0xf25c('0x1b')]],'as':_0x33f6a2['as'],'attributes':_0x33f6a2[_0xf25c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf25c('0xa')](function(_0x5c8e85){logger[_0xf25c('0xb')](_0xf25c('0x20'),_0x389539);logger[_0xf25c('0x1e')](_0xf25c('0x20'),_0x389539,JSON[_0xf25c('0x21')](_0x5c8e85));_0x5dc49f(_0x5c8e85);})[_0xf25c('0x13')](function(_0x4ad362){logger[_0xf25c('0xf')](_0xf25c('0x20'),_0x4ad362[_0xf25c('0x11')],_0x389539);_0x95df5e(_0x48a6fe[_0xf25c('0xf')](0x1f4,_0x4ad362[_0xf25c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 2d57cd5..ce94ad1 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 _0x7d65=['/:id','isAuthenticated','update','express','Router','./user-setting.controller','put'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0x7d65,0x11b));var _0x57d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d65[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x57d6('0x0'));var router=express[_0x57d6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x57d6('0x2'));router[_0x57d6('0x3')](_0x57d6('0x4'),auth[_0x57d6('0x5')](),controller[_0x57d6('0x6')]);module['exports']=router; \ No newline at end of file +var _0x607b=['./user-setting.controller','put','isAuthenticated','update','exports','express','Router','../../components/auth/service'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x607b,0x1a5));var _0xb607=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x607b[_0x13e741];return _0x3f8bb3;};'use strict';var express=require(_0xb607('0x0'));var router=express[_0xb607('0x1')]();var auth=require(_0xb607('0x2'));var controller=require(_0xb607('0x3'));router[_0xb607('0x4')]('/:id',auth[_0xb607('0x5')](),controller[_0xb607('0x6')]);module[_0xb607('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 9cd5c33..7377357 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 _0x2843=['ENUM','BOOLEAN','TEXT','DATE','UserId','error','info','debug'];(function(_0x379b2d,_0x2d74ee){var _0x2e4b3d=function(_0x2023b2){while(--_0x2023b2){_0x379b2d['push'](_0x379b2d['shift']());}};_0x2e4b3d(++_0x2d74ee);}(_0x2843,0x195));var _0x3284=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x2843[_0x408e38];return _0x426b0e;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x3284('0x0'),'warning',_0x3284('0x1'),_0x3284('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x3284('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3284('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3284('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x3284('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3284('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x3284('0x7')}}; \ No newline at end of file +var _0x71ce=['DATE','INTEGER','UserId','sequelize','error','exports','ENUM','BOOLEAN','TEXT'];(function(_0x245c79,_0x50406b){var _0x3aab1d=function(_0xeca544){while(--_0xeca544){_0x245c79['push'](_0x245c79['shift']());}};_0x3aab1d(++_0x50406b);}(_0x71ce,0x111));var _0xe71c=function(_0x2d9538,_0x4dedad){_0x2d9538=_0x2d9538-0x0;var _0x204933=_0x71ce[_0x2d9538];return _0x204933;};'use strict';var Sequelize=require(_0xe71c('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xe71c('0x1'),'warning','info','debug'];module[_0xe71c('0x2')]={'clientSideLoggingLevel':{'type':Sequelize[_0xe71c('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xe71c('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xe71c('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xe71c('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xe71c('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xe71c('0x7')],'unique':_0xe71c('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index bb7936d..2127534 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 _0xd58c=['json','update','then','sendStatus','error','name','send','user','role','admin','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','../../config/environment','socket.io-emitter','./user-setting.socket','register','redis','defaults','status'];(function(_0x3deb7b,_0x5c4502){var _0x474d5a=function(_0x59cb1d){while(--_0x59cb1d){_0x3deb7b['push'](_0x3deb7b['shift']());}};_0x474d5a(++_0x5c4502);}(_0xd58c,0xb6));var _0xcd58=function(_0x1a194a,_0x3233dc){_0x1a194a=_0x1a194a-0x0;var _0x1da730=_0xd58c[_0x1a194a];return _0x1da730;};'use strict';var _=require(_0xcd58('0x0'));var Redis=require(_0xcd58('0x1'));var logger=require(_0xcd58('0x2'))('api');var config=require(_0xcd58('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xcd58('0x4'))(new Redis(config['redis']));require(_0xcd58('0x5'))[_0xcd58('0x6')](socket);config[_0xcd58('0x7')]=_[_0xcd58('0x8')](config[_0xcd58('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x546187,_0x3f2c97){_0x3f2c97=_0x3f2c97||0xc8;return function(_0x31bf4e){if(_0x31bf4e){return _0x546187[_0xcd58('0x9')](_0x3f2c97)[_0xcd58('0xa')](_0x31bf4e);}};}function saveUpdates(_0x37a864){return function(_0x491d5b){if(_0x491d5b){return _0x491d5b[_0xcd58('0xb')](_0x37a864)[_0xcd58('0xc')](function(_0x5694e1){return _0x5694e1;});}return null;};}function handleEntityNotFound(_0x1e6f95){return function(_0x573b78){if(!_0x573b78){_0x1e6f95[_0xcd58('0xd')](0x194);}return _0x573b78;};}function handleError(_0x440776,_0x440cf1){_0x440cf1=_0x440cf1||0x1f4;return function(_0x4f95e9){logger[_0xcd58('0xe')](_0x4f95e9['stack']);if(_0x4f95e9[_0xcd58('0xf')]){delete _0x4f95e9['name'];}_0x440776[_0xcd58('0x9')](_0x440cf1)[_0xcd58('0x10')](_0x4f95e9);};}exports[_0xcd58('0xb')]=function(_0x17b93f,_0x37561b){if(_0x17b93f[_0xcd58('0x11')][_0xcd58('0x12')]!==_0xcd58('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0x17b93f['params']['id'])))throw new Error(_0xcd58('0x14'));return db[_0xcd58('0x15')][_0xcd58('0x16')]({'where':{'id':_0x17b93f['params']['id']}})['then'](handleEntityNotFound(_0x37561b,null))[_0xcd58('0xc')](saveUpdates(_0x17b93f[_0xcd58('0x17')],null))[_0xcd58('0xc')](respondWithResult(_0x37561b,null))['catch'](handleError(_0x37561b,null));}; \ No newline at end of file +var _0x8f1f=['user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','json','update','then','sendStatus','error','stack','name','status','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x2fa411,_0x1f755a){_0x2fa411=_0x2fa411-0x0;var _0x465756=_0x8f1f[_0x2fa411];return _0x465756;};'use strict';var _=require(_0xf8f1('0x0'));var Redis=require('ioredis');var logger=require('../../config/logger')(_0xf8f1('0x1'));var config=require(_0xf8f1('0x2'));var db=require(_0xf8f1('0x3'))['db'];var socket=require(_0xf8f1('0x4'))(new Redis(config[_0xf8f1('0x5')]));require(_0xf8f1('0x6'))[_0xf8f1('0x7')](socket);config[_0xf8f1('0x5')]=_['defaults'](config[_0xf8f1('0x5')],{'host':_0xf8f1('0x8'),'port':0x18eb});function respondWithResult(_0x122134,_0x19ccf6){_0x19ccf6=_0x19ccf6||0xc8;return function(_0x9609e9){if(_0x9609e9){return _0x122134['status'](_0x19ccf6)[_0xf8f1('0x9')](_0x9609e9);}};}function saveUpdates(_0x235624){return function(_0x2252f4){if(_0x2252f4){return _0x2252f4[_0xf8f1('0xa')](_0x235624)[_0xf8f1('0xb')](function(_0x28811d){return _0x28811d;});}return null;};}function handleEntityNotFound(_0x22c3bc){return function(_0x4a4483){if(!_0x4a4483){_0x22c3bc[_0xf8f1('0xc')](0x194);}return _0x4a4483;};}function handleError(_0x3c8c77,_0x5a72e5){_0x5a72e5=_0x5a72e5||0x1f4;return function(_0x2acb97){logger[_0xf8f1('0xd')](_0x2acb97[_0xf8f1('0xe')]);if(_0x2acb97['name']){delete _0x2acb97[_0xf8f1('0xf')];}_0x3c8c77[_0xf8f1('0x10')](_0x5a72e5)[_0xf8f1('0x11')](_0x2acb97);};}exports[_0xf8f1('0xa')]=function(_0x1d3a73,_0x5018da){if(_0x1d3a73[_0xf8f1('0x12')][_0xf8f1('0x13')]!==_0xf8f1('0x14'))throw new Error(_0xf8f1('0x15'));if(isNaN(Number(_0x1d3a73[_0xf8f1('0x16')]['id'])))throw new Error(_0xf8f1('0x17'));return db[_0xf8f1('0x18')]['find']({'where':{'id':_0x1d3a73[_0xf8f1('0x16')]['id']}})[_0xf8f1('0xb')](handleEntityNotFound(_0x5018da,null))['then'](saveUpdates(_0x1d3a73[_0xf8f1('0x19')],null))[_0xf8f1('0xb')](respondWithResult(_0x5018da,null))[_0xf8f1('0x1a')](handleError(_0x5018da,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 7cb4632..1adcd0f 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 _0xfa97=['emit','hasOwnProperty','hook','events','UserSetting','setMaxListeners','save','update','remove'];(function(_0x687ddc,_0x2092fa){var _0x441991=function(_0x49c6a6){while(--_0x49c6a6){_0x687ddc['push'](_0x687ddc['shift']());}};_0x441991(++_0x2092fa);}(_0xfa97,0x150));var _0x7fa9=function(_0x403ccb,_0xb0e0e4){_0x403ccb=_0x403ccb-0x0;var _0x90bbbc=_0xfa97[_0x403ccb];return _0x90bbbc;};'use strict';var EventEmitter=require(_0x7fa9('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x7fa9('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7fa9('0x2')](0x0);var events={'afterCreate':_0x7fa9('0x3'),'afterUpdate':_0x7fa9('0x4'),'afterDestroy':_0x7fa9('0x5')};function emitEvent(_0x1ce017){return function(_0x5f2b37,_0x4e34ce,_0x18e394){UserSettingEvents[_0x7fa9('0x6')](_0x1ce017+':'+_0x5f2b37['id'],_0x5f2b37);UserSettingEvents[_0x7fa9('0x6')](_0x1ce017,_0x5f2b37);_0x18e394(null);};}for(var e in events){if(events[_0x7fa9('0x7')](e)){var event=events[e];UserSetting[_0x7fa9('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x5179=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x58f77e,_0x15c937){var _0x2d5d9c=function(_0x505b5e){while(--_0x505b5e){_0x58f77e['push'](_0x58f77e['shift']());}};_0x2d5d9c(++_0x15c937);}(_0x5179,0x1d5));var _0x9517=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x5179[_0x5180c3];return _0x55c975;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x9517('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9517('0x1')](0x0);var events={'afterCreate':_0x9517('0x2'),'afterUpdate':_0x9517('0x3'),'afterDestroy':_0x9517('0x4')};function emitEvent(_0x20b70e){return function(_0x55dc84,_0x503d1c,_0x441af6){UserSettingEvents[_0x9517('0x5')](_0x20b70e+':'+_0x55dc84['id'],_0x55dc84);UserSettingEvents[_0x9517('0x5')](_0x20b70e,_0x55dc84);_0x441af6(null);};}for(var e in events){if(events[_0x9517('0x6')](e)){var event=events[e];UserSetting[_0x9517('0x7')](e,emitEvent(event));}}module[_0x9517('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index a6b5b6f..79a5117 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 _0x5eb8=['clientSideLoggingEnabledSince','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x470d05,_0x1a2a2d){var _0x58b293=function(_0x18042f){while(--_0x18042f){_0x470d05['push'](_0x470d05['shift']());}};_0x58b293(++_0x1a2a2d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x237bf7,_0xb851fc){_0x237bf7=_0x237bf7-0x0;var _0x5928ba=_0x5eb8[_0x237bf7];return _0x5928ba;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x16de3e){return _0x16de3e[_0x85eb('0x0')](_0x85eb('0x1'),attributes,{'tableName':_0x85eb('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7e3c0){if(!_0x7e3c0[_0x85eb('0x3')])_0x7e3c0[_0x85eb('0x4')]=null;else if(_0x7e3c0[_0x85eb('0x4')]===null)_0x7e3c0[_0x85eb('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x9434=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x16d151,_0x53cbc8){var _0x48f8b8=function(_0x1b5d98){while(--_0x1b5d98){_0x16d151['push'](_0x16d151['shift']());}};_0x48f8b8(++_0x53cbc8);}(_0x9434,0x168));var _0x4943=function(_0x2bab37,_0x56a35b){_0x2bab37=_0x2bab37-0x0;var _0x50bf37=_0x9434[_0x2bab37];return _0x50bf37;};'use strict';var attributes=require(_0x4943('0x0'));module[_0x4943('0x1')]=function(_0x354681){return _0x354681[_0x4943('0x2')](_0x4943('0x3'),attributes,{'tableName':_0x4943('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x599fb3){if(!_0x599fb3[_0x4943('0x5')])_0x599fb3[_0x4943('0x6')]=null;else if(_0x599fb3['clientSideLoggingEnabledSince']===null)_0x599fb3[_0x4943('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 c86003a..f5ae3fe 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 _0x02bc=['emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove'];(function(_0xb94781,_0xa2314b){var _0x3e1881=function(_0x57c689){while(--_0x57c689){_0xb94781['push'](_0xb94781['shift']());}};_0x3e1881(++_0xa2314b);}(_0x02bc,0x1d3));var _0xc02b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x02bc[_0x19e35c];return _0x3e1fe8;};'use strict';var UserSettingEvents=require(_0xc02b('0x0'));var events=[_0xc02b('0x1'),_0xc02b('0x2'),'update'];function createListener(_0x2f4410,_0xd21453){return function(_0x85d43){_0xd21453[_0xc02b('0x3')](_0x2f4410,_0x85d43);if(_0x2f4410===_0xc02b('0x4')){_0xd21453[_0xc02b('0x3')](_0xc02b('0x5')+_0x85d43[_0xc02b('0x6')],_0x85d43);}};}exports[_0xc02b('0x7')]=function(_0xd93798){for(var _0x2c096c=0x0,_0x1acfce=events[_0xc02b('0x8')];_0x2c096c<_0x1acfce;_0x2c096c++){var _0x400076=events[_0x2c096c];var _0x18f0cd=createListener(_0xc02b('0x9')+_0x400076,_0xd93798);UserSettingEvents['on'](_0x400076,_0x18f0cd);}}; \ No newline at end of file +var _0xae59=['./user-setting.events','save','remove','update','user-setting:update','emit'];(function(_0x56d550,_0x4b8e95){var _0x580576=function(_0x4fa406){while(--_0x4fa406){_0x56d550['push'](_0x56d550['shift']());}};_0x580576(++_0x4b8e95);}(_0xae59,0x8a));var _0x9ae5=function(_0x4a8dfc,_0x33213a){_0x4a8dfc=_0x4a8dfc-0x0;var _0x12002f=_0xae59[_0x4a8dfc];return _0x12002f;};'use strict';var UserSettingEvents=require(_0x9ae5('0x0'));var events=[_0x9ae5('0x1'),_0x9ae5('0x2'),_0x9ae5('0x3')];function createListener(_0x1cb043,_0xd97613){return function(_0x50f2cc){_0xd97613['emit'](_0x1cb043,_0x50f2cc);if(_0x1cb043===_0x9ae5('0x4')){_0xd97613[_0x9ae5('0x5')]('user-setting:update:user-'+_0x50f2cc['UserId'],_0x50f2cc);}};}exports['register']=function(_0x2c9d9c){for(var _0x1f2fee=0x0,_0x310aba=events['length'];_0x1f2fee<_0x310aba;_0x1f2fee++){var _0x4879d5=events[_0x1f2fee];var _0x2ac3ab=createListener('user-setting:'+_0x4879d5,_0x2c9d9c);UserSettingEvents['on'](_0x4879d5,_0x2ac3ab);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2695710..c4dc796 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 _0x22d1=['getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','addContacts','create','post','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','createApiKey','put','update','/:id/password','changePassword','delete','destroy','removeChatInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','whoami','/presence'];(function(_0x5a4670,_0x26110d){var _0x332b26=function(_0xaf9f30){while(--_0xaf9f30){_0x5a4670['push'](_0x5a4670['shift']());}};_0x332b26(++_0x26110d);}(_0x22d1,0x65));var _0x122d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x22d1[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x122d('0x0'));var util=require(_0x122d('0x1'));var path=require(_0x122d('0x2'));var timeout=require('connect-timeout');var express=require(_0x122d('0x3'));var router=express[_0x122d('0x4')]();var fs_extra=require(_0x122d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x122d('0x6'));var config=require(_0x122d('0x7'));var controller=require(_0x122d('0x8'));router[_0x122d('0x9')]('/',auth['isAuthenticated'](),controller[_0x122d('0xa')]);router[_0x122d('0x9')](_0x122d('0xb'),auth[_0x122d('0xc')](),controller[_0x122d('0xd')]);router[_0x122d('0x9')]('/whoami',auth[_0x122d('0xc')](),controller[_0x122d('0xe')]);router[_0x122d('0x9')](_0x122d('0xf'),auth[_0x122d('0xc')](),controller[_0x122d('0x10')]);router[_0x122d('0x9')](_0x122d('0x11'),auth[_0x122d('0xc')](),controller[_0x122d('0x12')]);router['get'](_0x122d('0x13'),controller[_0x122d('0x14')]);router[_0x122d('0x9')](_0x122d('0x15'),auth[_0x122d('0xc')](),controller['getOpenTabs']);router[_0x122d('0x9')](_0x122d('0x16'),auth[_0x122d('0xc')](),controller[_0x122d('0x17')]);router[_0x122d('0x9')](_0x122d('0x18'),auth[_0x122d('0xc')](),controller[_0x122d('0x19')]);router['get'](_0x122d('0x1a'),auth[_0x122d('0xc')](),controller[_0x122d('0x1b')]);router[_0x122d('0x9')](_0x122d('0x1c'),auth['isAuthenticated'](),controller[_0x122d('0x1d')]);router[_0x122d('0x9')]('/:id/recordings',auth[_0x122d('0xc')](),controller[_0x122d('0x1e')]);router['get'](_0x122d('0x1f'),auth[_0x122d('0xc')](),controller['getScreenRecordings']);router[_0x122d('0x9')](_0x122d('0x20'),auth['isAuthenticated'](),controller[_0x122d('0x21')]);router['get'](_0x122d('0x22'),auth[_0x122d('0xc')](),controller[_0x122d('0x23')]);router['get']('/:id/mail/interactions',auth[_0x122d('0xc')](),controller[_0x122d('0x24')]);router['get'](_0x122d('0x25'),auth[_0x122d('0xc')](),controller['getSmsInteractions']);router[_0x122d('0x9')](_0x122d('0x26'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x122d('0x9')](_0x122d('0x27'),auth[_0x122d('0xc')](),controller[_0x122d('0x28')]);router[_0x122d('0x9')](_0x122d('0x29'),auth[_0x122d('0xc')](),controller[_0x122d('0x2a')]);router[_0x122d('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0x122d('0x2b')]);router[_0x122d('0x9')](_0x122d('0x2c'),auth[_0x122d('0xc')](),controller[_0x122d('0x2d')]);router[_0x122d('0x9')](_0x122d('0x2e'),auth[_0x122d('0xc')](),controller[_0x122d('0x2f')]);router['get']('/:id/fax_accounts',auth[_0x122d('0xc')](),controller[_0x122d('0x30')]);router[_0x122d('0x9')](_0x122d('0x31'),auth['isAuthenticated'](),controller['getMailAccounts']);router['get'](_0x122d('0x32'),auth[_0x122d('0xc')](),controller[_0x122d('0x33')]);router[_0x122d('0x9')](_0x122d('0x34'),auth[_0x122d('0xc')](),controller['getSmsAccounts']);router[_0x122d('0x9')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x122d('0x35')]);router[_0x122d('0x9')]('/:id/whatsapp_accounts',auth[_0x122d('0xc')](),controller[_0x122d('0x36')]);router[_0x122d('0x9')](_0x122d('0x37'),auth[_0x122d('0xc')](),controller['getSquareProjects']);router[_0x122d('0x9')](_0x122d('0x38'),auth[_0x122d('0xc')](),controller['getScheduledCalls']);router['get'](_0x122d('0x39'),auth[_0x122d('0xc')](),controller['getApiKey']);router['post'](_0x122d('0x16'),auth[_0x122d('0xc')](),controller[_0x122d('0x3a')]);router['post']('/',auth['isAuthenticated'](),controller[_0x122d('0x3b')]);router[_0x122d('0x3c')]('/create_many',auth[_0x122d('0xc')](),controller[_0x122d('0x3d')]);router[_0x122d('0x3c')]('/:id/queues',auth[_0x122d('0xc')](),controller[_0x122d('0x3e')]);var upload=multer({'storage':multer[_0x122d('0x3f')]({'destination':function(_0xfb0981,_0x5a73d9,_0x29db49){_0x29db49(null,path[_0x122d('0x40')](config[_0x122d('0x41')],_0x122d('0x42')));},'filename':function(_0x11e51c,_0x4a73e0,_0x450d18){_0x450d18(null,util['format'](_0x122d('0x43'),Date[_0x122d('0x44')](),_0x4a73e0[_0x122d('0x45')]));}})});router['post'](_0x122d('0x13'),upload[_0x122d('0x46')](_0x122d('0x47')),controller[_0x122d('0x48')]);router[_0x122d('0x3c')](_0x122d('0x49'),auth[_0x122d('0xc')](),controller['login']);router[_0x122d('0x3c')](_0x122d('0x4a'),auth[_0x122d('0xc')](),controller[_0x122d('0x4b')]);router[_0x122d('0x3c')](_0x122d('0x4c'),auth['isAuthenticated'](),controller[_0x122d('0x4d')]);router['post'](_0x122d('0x4e'),auth['isAuthenticated'](),controller[_0x122d('0x4f')]);router['post'](_0x122d('0x29'),auth[_0x122d('0xc')](),controller['addTeams']);router[_0x122d('0x3c')](_0x122d('0x50'),auth[_0x122d('0xc')](),controller[_0x122d('0x51')]);router['post'](_0x122d('0x52'),auth[_0x122d('0xc')](),controller[_0x122d('0x53')]);router[_0x122d('0x3c')](_0x122d('0x54'),auth['isAuthenticated'](),controller[_0x122d('0x55')]);router['post'](_0x122d('0x56'),auth[_0x122d('0xc')](),controller[_0x122d('0x57')]);router[_0x122d('0x3c')](_0x122d('0x58'),auth[_0x122d('0xc')](),controller[_0x122d('0x59')]);router['post'](_0x122d('0x5a'),auth[_0x122d('0xc')](),controller[_0x122d('0x5b')]);router[_0x122d('0x3c')](_0x122d('0x5c'),auth[_0x122d('0xc')](),controller[_0x122d('0x5d')]);router[_0x122d('0x3c')](_0x122d('0x31'),auth[_0x122d('0xc')](),controller[_0x122d('0x5e')]);router[_0x122d('0x3c')](_0x122d('0x32'),auth[_0x122d('0xc')](),controller[_0x122d('0x5f')]);router['post'](_0x122d('0x34'),auth[_0x122d('0xc')](),controller[_0x122d('0x60')]);router['post'](_0x122d('0x61'),auth[_0x122d('0xc')](),controller[_0x122d('0x62')]);router['post'](_0x122d('0x63'),auth[_0x122d('0xc')](),controller['addWhatsappAccounts']);router[_0x122d('0x3c')]('/:id/square_projects',auth[_0x122d('0xc')](),controller['addSquareProjects']);router[_0x122d('0x3c')](_0x122d('0x39'),auth[_0x122d('0xc')](),controller[_0x122d('0x64')]);router[_0x122d('0x65')](_0x122d('0x11'),auth['isAuthenticated'](),controller[_0x122d('0x66')]);router[_0x122d('0x65')](_0x122d('0x67'),auth[_0x122d('0xc')](),controller[_0x122d('0x68')]);router[_0x122d('0x69')](_0x122d('0x18'),auth[_0x122d('0xc')](),controller['removeQueues']);router[_0x122d('0x69')](_0x122d('0x29'),auth[_0x122d('0xc')](),controller['removeTeams']);router[_0x122d('0x69')]('/:id',auth[_0x122d('0xc')](),controller[_0x122d('0x6a')]);router[_0x122d('0x69')](_0x122d('0x50'),auth[_0x122d('0xc')](),controller[_0x122d('0x6b')]);router[_0x122d('0x69')](_0x122d('0x52'),auth[_0x122d('0xc')](),controller['removeMailInteractions']);router[_0x122d('0x69')](_0x122d('0x54'),auth[_0x122d('0xc')](),controller['removeFaxInteractions']);router[_0x122d('0x69')](_0x122d('0x56'),auth[_0x122d('0xc')](),controller[_0x122d('0x6c')]);router[_0x122d('0x69')](_0x122d('0x58'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x122d('0x69')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x122d('0x69')]('/:id/fax_accounts',auth[_0x122d('0xc')](),controller[_0x122d('0x6d')]);router['delete'](_0x122d('0x31'),auth[_0x122d('0xc')](),controller[_0x122d('0x6e')]);router['delete'](_0x122d('0x32'),auth[_0x122d('0xc')](),controller[_0x122d('0x6f')]);router[_0x122d('0x69')](_0x122d('0x34'),auth[_0x122d('0xc')](),controller[_0x122d('0x70')]);router['delete']('/:id/chat_websites',auth[_0x122d('0xc')](),controller[_0x122d('0x71')]);router['delete'](_0x122d('0x63'),auth['isAuthenticated'](),controller[_0x122d('0x72')]);router[_0x122d('0x69')](_0x122d('0x37'),auth[_0x122d('0xc')](),controller['removeSquareProjects']);router[_0x122d('0x69')](_0x122d('0x39'),auth[_0x122d('0xc')](),controller[_0x122d('0x73')]);module[_0x122d('0x74')]=router; \ No newline at end of file +var _0x861e=['/:id/lists','getLists','/:id/agents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','create','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','addAvatar','/:id/login','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','update','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams'];(function(_0x3c53c7,_0x32a47e){var _0x51b671=function(_0x48069d){while(--_0x48069d){_0x3c53c7['push'](_0x3c53c7['shift']());}};_0x51b671(++_0x32a47e);}(_0x861e,0x1aa));var _0xe861=function(_0x4f4554,_0x83e8f6){_0x4f4554=_0x4f4554-0x0;var _0x4bfeb1=_0x861e[_0x4f4554];return _0x4bfeb1;};'use strict';var multer=require(_0xe861('0x0'));var util=require('util');var path=require(_0xe861('0x1'));var timeout=require('connect-timeout');var express=require(_0xe861('0x2'));var router=express[_0xe861('0x3')]();var fs_extra=require(_0xe861('0x4'));var auth=require(_0xe861('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router[_0xe861('0x6')]('/',auth['isAuthenticated'](),controller[_0xe861('0x7')]);router[_0xe861('0x6')](_0xe861('0x8'),auth[_0xe861('0x9')](),controller[_0xe861('0xa')]);router[_0xe861('0x6')](_0xe861('0xb'),auth['isAuthenticated'](),controller[_0xe861('0xc')]);router[_0xe861('0x6')]('/presence',auth[_0xe861('0x9')](),controller['getPresence']);router[_0xe861('0x6')](_0xe861('0xd'),auth[_0xe861('0x9')](),controller[_0xe861('0xe')]);router[_0xe861('0x6')](_0xe861('0xf'),controller[_0xe861('0x10')]);router[_0xe861('0x6')](_0xe861('0x11'),auth['isAuthenticated'](),controller[_0xe861('0x12')]);router[_0xe861('0x6')](_0xe861('0x13'),auth[_0xe861('0x9')](),controller[_0xe861('0x14')]);router[_0xe861('0x6')](_0xe861('0x15'),auth[_0xe861('0x9')](),controller[_0xe861('0x16')]);router[_0xe861('0x6')](_0xe861('0x17'),auth[_0xe861('0x9')](),controller[_0xe861('0x18')]);router[_0xe861('0x6')](_0xe861('0x19'),auth[_0xe861('0x9')](),controller[_0xe861('0x1a')]);router['get'](_0xe861('0x1b'),auth[_0xe861('0x9')](),controller[_0xe861('0x1c')]);router[_0xe861('0x6')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xe861('0x1d')]);router['get'](_0xe861('0x1e'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0xe861('0x6')]('/:id/openchannel/interactions',auth[_0xe861('0x9')](),controller[_0xe861('0x1f')]);router[_0xe861('0x6')]('/:id/mail/interactions',auth[_0xe861('0x9')](),controller['getMailInteractions']);router[_0xe861('0x6')](_0xe861('0x20'),auth[_0xe861('0x9')](),controller[_0xe861('0x21')]);router['get'](_0xe861('0x22'),auth[_0xe861('0x9')](),controller[_0xe861('0x23')]);router['get']('/:id/whatsapp/interactions',auth[_0xe861('0x9')](),controller[_0xe861('0x24')]);router[_0xe861('0x6')]('/:id/teams',auth[_0xe861('0x9')](),controller[_0xe861('0x25')]);router[_0xe861('0x6')](_0xe861('0x26'),auth[_0xe861('0x9')](),controller[_0xe861('0x27')]);router[_0xe861('0x6')](_0xe861('0x28'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe861('0x6')](_0xe861('0x29'),auth[_0xe861('0x9')](),controller['getVoicePrefixes']);router[_0xe861('0x6')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe861('0x2a')]);router[_0xe861('0x6')](_0xe861('0x2b'),auth[_0xe861('0x9')](),controller[_0xe861('0x2c')]);router[_0xe861('0x6')](_0xe861('0x2d'),auth[_0xe861('0x9')](),controller[_0xe861('0x2e')]);router['get'](_0xe861('0x2f'),auth[_0xe861('0x9')](),controller['getSmsAccounts']);router[_0xe861('0x6')](_0xe861('0x30'),auth[_0xe861('0x9')](),controller[_0xe861('0x31')]);router['get']('/:id/whatsapp_accounts',auth[_0xe861('0x9')](),controller['getWhatsappAccounts']);router[_0xe861('0x6')](_0xe861('0x32'),auth['isAuthenticated'](),controller[_0xe861('0x33')]);router['get'](_0xe861('0x34'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xe861('0x6')](_0xe861('0x35'),auth[_0xe861('0x9')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0xe861('0x9')](),controller['addContacts']);router[_0xe861('0x36')]('/',auth[_0xe861('0x9')](),controller[_0xe861('0x37')]);router[_0xe861('0x36')](_0xe861('0x38'),auth[_0xe861('0x9')](),controller[_0xe861('0x39')]);router[_0xe861('0x36')](_0xe861('0x15'),auth[_0xe861('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0xe861('0x3a')]({'destination':function(_0x4aa72d,_0x880d51,_0xc47160){_0xc47160(null,path[_0xe861('0x3b')](config[_0xe861('0x3c')],_0xe861('0x3d')));},'filename':function(_0x344adb,_0x1f82ff,_0x3a579f){_0x3a579f(null,util[_0xe861('0x3e')](_0xe861('0x3f'),Date[_0xe861('0x40')](),_0x1f82ff[_0xe861('0x41')]));}})});router[_0xe861('0x36')](_0xe861('0xf'),upload['single']('file'),controller[_0xe861('0x42')]);router['post'](_0xe861('0x43'),auth[_0xe861('0x9')](),controller['login']);router[_0xe861('0x36')]('/:id/logout',auth['isAuthenticated'](),controller['logout']);router['post'](_0xe861('0x44'),auth['isAuthenticated'](),controller[_0xe861('0x45')]);router[_0xe861('0x36')](_0xe861('0x46'),auth['isAuthenticated'](),controller[_0xe861('0x47')]);router[_0xe861('0x36')](_0xe861('0x48'),auth['isAuthenticated'](),controller[_0xe861('0x49')]);router[_0xe861('0x36')]('/:id/chat_interactions',auth[_0xe861('0x9')](),controller[_0xe861('0x4a')]);router['post'](_0xe861('0x4b'),auth[_0xe861('0x9')](),controller[_0xe861('0x4c')]);router[_0xe861('0x36')](_0xe861('0x4d'),auth[_0xe861('0x9')](),controller[_0xe861('0x4e')]);router['post']('/:id/sms_interactions',auth[_0xe861('0x9')](),controller[_0xe861('0x4f')]);router[_0xe861('0x36')](_0xe861('0x50'),auth['isAuthenticated'](),controller[_0xe861('0x51')]);router['post']('/:id/whatsapp_interactions',auth[_0xe861('0x9')](),controller[_0xe861('0x52')]);router[_0xe861('0x36')](_0xe861('0x53'),auth[_0xe861('0x9')](),controller[_0xe861('0x54')]);router[_0xe861('0x36')](_0xe861('0x2b'),auth[_0xe861('0x9')](),controller[_0xe861('0x55')]);router[_0xe861('0x36')](_0xe861('0x2d'),auth[_0xe861('0x9')](),controller[_0xe861('0x56')]);router[_0xe861('0x36')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xe861('0x57')]);router[_0xe861('0x36')](_0xe861('0x30'),auth['isAuthenticated'](),controller[_0xe861('0x58')]);router[_0xe861('0x36')](_0xe861('0x59'),auth[_0xe861('0x9')](),controller[_0xe861('0x5a')]);router[_0xe861('0x36')](_0xe861('0x32'),auth[_0xe861('0x9')](),controller[_0xe861('0x5b')]);router['post']('/:id/api_key',auth[_0xe861('0x9')](),controller[_0xe861('0x5c')]);router['put'](_0xe861('0xd'),auth[_0xe861('0x9')](),controller[_0xe861('0x5d')]);router[_0xe861('0x5e')](_0xe861('0x5f'),auth['isAuthenticated'](),controller[_0xe861('0x60')]);router['delete']('/:id/queues',auth[_0xe861('0x9')](),controller[_0xe861('0x61')]);router[_0xe861('0x62')]('/:id/teams',auth[_0xe861('0x9')](),controller[_0xe861('0x63')]);router[_0xe861('0x62')](_0xe861('0xd'),auth['isAuthenticated'](),controller[_0xe861('0x64')]);router[_0xe861('0x62')](_0xe861('0x65'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0xe861('0x62')](_0xe861('0x4b'),auth[_0xe861('0x9')](),controller[_0xe861('0x66')]);router['delete'](_0xe861('0x4d'),auth['isAuthenticated'](),controller[_0xe861('0x67')]);router['delete'](_0xe861('0x68'),auth[_0xe861('0x9')](),controller[_0xe861('0x69')]);router[_0xe861('0x62')](_0xe861('0x50'),auth['isAuthenticated'](),controller[_0xe861('0x6a')]);router[_0xe861('0x62')]('/:id/whatsapp_interactions',auth[_0xe861('0x9')](),controller[_0xe861('0x6b')]);router[_0xe861('0x62')](_0xe861('0x53'),auth[_0xe861('0x9')](),controller[_0xe861('0x6c')]);router[_0xe861('0x62')](_0xe861('0x2b'),auth[_0xe861('0x9')](),controller[_0xe861('0x6d')]);router[_0xe861('0x62')](_0xe861('0x2d'),auth[_0xe861('0x9')](),controller['removeOpenchannelAccounts']);router[_0xe861('0x62')](_0xe861('0x2f'),auth[_0xe861('0x9')](),controller[_0xe861('0x6e')]);router[_0xe861('0x62')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe861('0x6f')]);router[_0xe861('0x62')](_0xe861('0x59'),auth[_0xe861('0x9')](),controller[_0xe861('0x70')]);router[_0xe861('0x62')]('/:id/square_projects',auth[_0xe861('0x9')](),controller[_0xe861('0x71')]);router['delete'](_0xe861('0x35'),auth[_0xe861('0x9')](),controller[_0xe861('0x72')]);module[_0xe861('0x73')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 88a8743..c6534cf 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 _0x278a=['ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','get','isArray','encryption','avpf','force_avp','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','dtlsenable','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','map','permissions','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','toLowerCase','user','agent','telephone','local','INTEGER','BOOLEAN','DATE','dynamic'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x278a,0xfd));var _0xa278=function(_0x593145,_0x3e1a04){_0x593145=_0x593145-0x0;var _0x43d926=_0x278a[_0x593145];return _0x43d926;};'use strict';var Sequelize=require(_0xa278('0x0'));var moment=require(_0xa278('0x1'));var util=require(_0xa278('0x2'));var _=require(_0xa278('0x3'));module[_0xa278('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa278('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5e238a){this['setDataValue'](_0xa278('0x5'),_0x5e238a);this[_0xa278('0x6')](_0xa278('0x7'),_0x5e238a);},'comment':_0xa278('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3fb6dd){this[_0xa278('0x6')](_0xa278('0x9'),_0x3fb6dd);this[_0xa278('0x6')](_0xa278('0xa'),util[_0xa278('0xb')](_0xa278('0xc'),_0x3fb6dd,this[_0xa278('0xd')](_0xa278('0xe'))));}},'alias':{'type':Sequelize[_0xa278('0xf')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa278('0x10'),'validate':{'isEmail':!![]},'set':function(_0x1fad3d){if(_0x1fad3d){this['setDataValue'](_0xa278('0x10'),_0x1fad3d[_0xa278('0x11')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0xa278('0x12'),_0xa278('0x13'),_0xa278('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xa278('0xf')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa278('0xf')],'defaultValue':_0xa278('0x15')},'internal':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':![],'unique':_0xa278('0xe'),'set':function(_0x12e182){this['setDataValue'](_0xa278('0xe'),_0x12e182);this[_0xa278('0x6')]('accountcode',_0x12e182);this[_0xa278('0x6')](_0xa278('0xa'),util[_0xa278('0xb')](_0xa278('0xc'),this[_0xa278('0xd')](_0xa278('0x9')),_0x12e182));}},'salt':{'type':Sequelize[_0xa278('0xf')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xa278('0xf')]},'zipcode':{'type':Sequelize[_0xa278('0xf')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa278('0xf')]},'online':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa278('0x18')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa278('0xf')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xa278('0x18')]},'chatCapacity':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa278('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa278('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa278('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x1b'),'user',_0xa278('0x1c')),'allowNull':!![],'defaultValue':_0xa278('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa278('0x1d')},'callingpres':{'type':Sequelize[_0xa278('0x1a')]('ALLOWED_NOT_SCREENED',_0xa278('0x1e'),_0xa278('0x1f'),_0xa278('0x20'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xa278('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'permit':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![],'defaultValue':_0xa278('0x22'),'set':function(_0xfed800){this[_0xa278('0x6')](_0xa278('0x23'),_0xfed800?_0xfed800[_0xa278('0x24')](','):null);},'get':function(){return this[_0xa278('0xd')](_0xa278('0x23'))?this['getDataValue'](_0xa278('0x23'))[_0xa278('0x25')](','):null;},'comment':_0xa278('0x26')},'dtmfmode':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x27'),_0xa278('0x28'),'shortinfo',_0xa278('0x29'),_0xa278('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xa278('0x2b'),'no',_0xa278('0x2c'),_0xa278('0x2d'),_0xa278('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xa278('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa278('0x2f'),'set':function(_0x41fefc){this[_0xa278('0x6')](_0xa278('0x30'),_0x41fefc?_0x41fefc[_0xa278('0x24')](','):null);},'get':function(){return this['getDataValue'](_0xa278('0x30'))?this[_0xa278('0xd')](_0xa278('0x30'))[_0xa278('0x25')](','):null;},'comment':_0xa278('0x31')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa278('0xf')]},'pickupgroup':{'type':Sequelize[_0xa278('0xf')]},'namedpickupgroup':{'type':Sequelize[_0xa278('0xf')]},'language':{'type':Sequelize[_0xa278('0xf')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa278('0xf')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa278('0xf')],'allowNull':![],'defaultValue':_0xa278('0x32'),'set':function(_0xef83ae){this[_0xa278('0x6')](_0xa278('0x33'),_0xef83ae?_0xef83ae[_0xa278('0x24')](';'):_0xa278('0x32'));},'get':function(){return this[_0xa278('0xd')]('allow')?this[_0xa278('0xd')](_0xa278('0x33'))['split'](';'):null;},'comment':_0xa278('0x34')},'autoframing':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x45fc05){this[_0xa278('0x6')](_0xa278('0x35'),_0x45fc05?_0x45fc05['join'](','):null);},'get':function(){return this[_0xa278('0xd')](_0xa278('0x35'))?this['getDataValue'](_0xa278('0x35'))[_0xa278('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa278('0x2b'),'no',_0xa278('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![],'defaultValue':_0xa278('0x37')},'amaflags':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa278('0x1a')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no',_0xa278('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xa278('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x39'),_0xa278('0x3a'),_0xa278('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa278('0x1a')]('uac',_0xa278('0x3c')),'allowNull':!![],'defaultValue':_0xa278('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xa278('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa278('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no',_0xa278('0x3d'),_0xa278('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x3f'),_0xa278('0x40'),_0xa278('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xa278('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no',_0xa278('0x2c'),_0xa278('0x2d'),_0xa278('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa278('0xf')]},'resetPasswordExpires':{'type':Sequelize[_0xa278('0x18')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa278('0x43')]},'showWebBar':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x0,'set':function(_0xa3f48e){this[_0xa278('0x6')]('showWebBar',_0xa3f48e);var _0x22f124=this[_0xa278('0x44')]({'plain':!![]});switch(_0xa3f48e){case 0x0:case 0x1:var _0x116b45=_0x22f124['transport']?_[_0xa278('0x45')](_0x22f124[_0xa278('0x23')])?_0x22f124['transport'][_0xa278('0x24')]():_0x22f124[_0xa278('0x23')]:_0xa278('0x22');if(_0x116b45==='wss'){_0x116b45=_0xa278('0x22');}this['setDataValue'](_0xa278('0x23'),_0x116b45);this[_0xa278('0x6')](_0xa278('0x46'),'no');this[_0xa278('0x6')](_0xa278('0x47'),null);this[_0xa278('0x6')](_0xa278('0x48'),null);this[_0xa278('0x6')](_0xa278('0x49'),null);this[_0xa278('0x6')]('dtlsenable',null);this[_0xa278('0x6')](_0xa278('0x4a'),null);this[_0xa278('0x6')]('dtlssetup',null);this[_0xa278('0x6')](_0xa278('0x4b'),null);this[_0xa278('0x6')](_0xa278('0x4c'),null);this['setDataValue'](_0xa278('0x4d'),'no');break;case 0x2:this['setDataValue'](_0xa278('0x23'),_0xa278('0x4e'));this[_0xa278('0x6')]('encryption',_0xa278('0x2b'));this[_0xa278('0x6')]('avpf',_0xa278('0x2b'));this['setDataValue'](_0xa278('0x48'),'yes');this[_0xa278('0x6')](_0xa278('0x49'),'yes');this[_0xa278('0x6')](_0xa278('0x4f'),'yes');this['setDataValue']('dtlsverify','no');this[_0xa278('0x6')](_0xa278('0x50'),_0xa278('0x41'));this[_0xa278('0x6')](_0xa278('0x4b'),_0x22f124['dtlscertfile']||_0xa278('0x51'));this[_0xa278('0x6')](_0xa278('0x4c'),_0x22f124['dtlsprivatekey']||_0xa278('0x52'));this[_0xa278('0x6')](_0xa278('0x4d'),_0xa278('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xa278('0x43')],'set':function(_0x4af163){this['setDataValue']('permissions',_0x4af163?_0x4af163[_0xa278('0x24')](','):[]);},'get':function(){return this[_0xa278('0xd')]('permissions')?_[_0xa278('0x53')](this['getDataValue'](_0xa278('0x54'))[_0xa278('0x25')](','),function(_0x230f14){return parseInt(_0x230f14,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa278('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa278('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa278('0xf')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa278('0x1a')](_0xa278('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa278('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa278('0xf')]},'phoneBarEnableJaws':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa278('0xd')](_0xa278('0x55'))?this[_0xa278('0xd')](_0xa278('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa278('0xf')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa278('0xf')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![],'set':function(_0x358ade){if(typeof _0x358ade==='string'){var _0x174954=_0x358ade==='1'?!![]:_0x358ade==='0'?![]:_0x358ade===_0xa278('0x56')?!![]:_0x358ade===_0xa278('0x57')?![]:![];this[_0xa278('0x6')](_0xa278('0x58'),_0x174954);}else{this[_0xa278('0x6')](_0xa278('0x58'),_0x358ade);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x408b4d){this[_0xa278('0x6')](_0xa278('0x59'),_0x408b4d);if(_0x408b4d===!![]){this['setDataValue'](_0xa278('0x5a'),moment());this[_0xa278('0x6')](_0xa278('0x5b'),0x0);}else{this[_0xa278('0x6')](_0xa278('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0xa278('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa278('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa278('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa278('0x16')](0x5)[_0xa278('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa278('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa278('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xa278('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc434=['telephone','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','user','peer','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','nonat','update','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','UNSIGNED','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM'];(function(_0x2aaa5a,_0x251b79){var _0x59c118=function(_0x50a289){while(--_0x50a289){_0x2aaa5a['push'](_0x2aaa5a['shift']());}};_0x59c118(++_0x251b79);}(_0xc434,0x9e));var _0x4c43=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xc434[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4c43('0x0'));var util=require('util');var _=require(_0x4c43('0x1'));module[_0x4c43('0x2')]={'name':{'type':Sequelize[_0x4c43('0x3')],'allowNull':![],'unique':_0x4c43('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x22a31e){this['setDataValue'](_0x4c43('0x4'),_0x22a31e);this[_0x4c43('0x5')](_0x4c43('0x6'),_0x22a31e);},'comment':_0x4c43('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x239dda){this[_0x4c43('0x5')](_0x4c43('0x8'),_0x239dda);this[_0x4c43('0x5')]('callerid',util[_0x4c43('0x9')](_0x4c43('0xa'),_0x239dda,this[_0x4c43('0xb')](_0x4c43('0xc'))));}},'alias':{'type':Sequelize[_0x4c43('0x3')]},'email':{'type':Sequelize[_0x4c43('0x3')],'allowNull':![],'unique':_0x4c43('0xd'),'validate':{'isEmail':!![]},'set':function(_0x46e2c8){if(_0x46e2c8){this['setDataValue'](_0x4c43('0xd'),_0x46e2c8[_0x4c43('0xe')]());}}},'role':{'type':Sequelize[_0x4c43('0xf')]('admin','user','agent',_0x4c43('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x4c43('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':![],'unique':_0x4c43('0xc'),'set':function(_0x41ffe5){this[_0x4c43('0x5')](_0x4c43('0xc'),_0x41ffe5);this['setDataValue'](_0x4c43('0x12'),_0x41ffe5);this['setDataValue']('callerid',util[_0x4c43('0x9')](_0x4c43('0xa'),this[_0x4c43('0xb')](_0x4c43('0x8')),_0x41ffe5));}},'salt':{'type':Sequelize[_0x4c43('0x3')]},'phone':{'type':Sequelize[_0x4c43('0x3')]},'mobile':{'type':Sequelize[_0x4c43('0x3')]},'address':{'type':Sequelize[_0x4c43('0x3')]},'zipcode':{'type':Sequelize[_0x4c43('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x4c43('0x3')]},'country':{'type':Sequelize[_0x4c43('0x3')]},'online':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4c43('0x14')]},'voicePause':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x4c43('0x15')},'lastPauseAt':{'type':Sequelize[_0x4c43('0x14')]},'chatCapacity':{'type':Sequelize[_0x4c43('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4c43('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x4c43('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4c43('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x4c43('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x4c43('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4c43('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![],'defaultValue':_0x4c43('0x16')},'ipaddr':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x4c43('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x4c43('0x17'),_0x4c43('0x18'),_0x4c43('0x19')),'allowNull':!![],'defaultValue':_0x4c43('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x4c43('0xf')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x4c43('0x1a'),'ALLOWED',_0x4c43('0x1b'),'PROHIB_PASSED_SCREEN',_0x4c43('0x1c'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![],'defaultValue':_0x4c43('0x1d'),'set':function(_0x446fff){this['setDataValue']('transport',_0x446fff?_0x446fff[_0x4c43('0x1e')](','):null);},'get':function(){return this[_0x4c43('0xb')](_0x4c43('0x1f'))?this['getDataValue'](_0x4c43('0x1f'))[_0x4c43('0x20')](','):null;},'comment':_0x4c43('0x21')},'dtmfmode':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x22'),'info',_0x4c43('0x23'),_0x4c43('0x24'),_0x4c43('0x25')),'allowNull':!![],'defaultValue':_0x4c43('0x22')},'directmedia':{'type':Sequelize['ENUM'](_0x4c43('0x26'),'no','nonat','update',_0x4c43('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![],'defaultValue':_0x4c43('0x28'),'set':function(_0x16ab63){this['setDataValue']('nat',_0x16ab63?_0x16ab63[_0x4c43('0x1e')](','):null);},'get':function(){return this[_0x4c43('0xb')](_0x4c43('0x29'))?this[_0x4c43('0xb')](_0x4c43('0x29'))[_0x4c43('0x20')](','):null;},'comment':_0x4c43('0x2a')},'callgroup':{'type':Sequelize[_0x4c43('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x4c43('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4c43('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4c43('0x3')]},'disallow':{'type':Sequelize[_0x4c43('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x4c43('0x3')],'allowNull':![],'defaultValue':_0x4c43('0x2b'),'set':function(_0x2daf41){this['setDataValue'](_0x4c43('0x2c'),_0x2daf41?_0x2daf41[_0x4c43('0x1e')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4c43('0xb')]('allow')?this[_0x4c43('0xb')](_0x4c43('0x2c'))[_0x4c43('0x20')](';'):null;},'comment':_0x4c43('0x2d')},'autoframing':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![],'set':function(_0x6e103f){this[_0x4c43('0x5')](_0x4c43('0x2e'),_0x6e103f?_0x6e103f['join'](','):null);},'get':function(){return this[_0x4c43('0xb')](_0x4c43('0x2e'))?this[_0x4c43('0xb')](_0x4c43('0x2e'))[_0x4c43('0x20')](','):null;},'comment':_0x4c43('0x2f')},'trustrpid':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no',_0x4c43('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4c43('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x4c43('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![],'defaultValue':_0x4c43('0x31')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![],'defaultValue':_0x4c43('0x26')},'busylevel':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x4c43('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x4c43('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x33'),_0x4c43('0x34'),_0x4c43('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x36'),_0x4c43('0x37')),'allowNull':!![],'defaultValue':_0x4c43('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x4c43('0x26'),'no'),'allowNull':!![],'defaultValue':_0x4c43('0x26')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x4c43('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4c43('0xf')]('yes','no','fingerprint',_0x4c43('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4c43('0xf')]('active',_0x4c43('0x39'),_0x4c43('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4c43('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4c43('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no',_0x4c43('0x3b'),_0x4c43('0x3c'),_0x4c43('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4c43('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x4c43('0x14')]},'passwordResetAt':{'type':Sequelize[_0x4c43('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x4c43('0x3e')]},'showWebBar':{'type':Sequelize[_0x4c43('0x11')],'defaultValue':0x0,'set':function(_0x502836){this[_0x4c43('0x5')](_0x4c43('0x3f'),_0x502836);var _0x511f28=this[_0x4c43('0x40')]({'plain':!![]});switch(_0x502836){case 0x0:case 0x1:var _0x21c815=_0x511f28[_0x4c43('0x1f')]?_[_0x4c43('0x41')](_0x511f28[_0x4c43('0x1f')])?_0x511f28[_0x4c43('0x1f')]['join']():_0x511f28[_0x4c43('0x1f')]:_0x4c43('0x1d');if(_0x21c815===_0x4c43('0x42')){_0x21c815='udp';}this[_0x4c43('0x5')]('transport',_0x21c815);this[_0x4c43('0x5')]('encryption','no');this['setDataValue'](_0x4c43('0x43'),null);this[_0x4c43('0x5')]('force_avp',null);this[_0x4c43('0x5')](_0x4c43('0x44'),null);this[_0x4c43('0x5')](_0x4c43('0x45'),null);this[_0x4c43('0x5')](_0x4c43('0x46'),null);this[_0x4c43('0x5')]('dtlssetup',null);this[_0x4c43('0x5')](_0x4c43('0x47'),null);this[_0x4c43('0x5')](_0x4c43('0x48'),null);this[_0x4c43('0x5')](_0x4c43('0x49'),'no');break;case 0x2:this[_0x4c43('0x5')](_0x4c43('0x1f'),_0x4c43('0x42'));this[_0x4c43('0x5')]('encryption',_0x4c43('0x26'));this[_0x4c43('0x5')](_0x4c43('0x43'),'yes');this[_0x4c43('0x5')](_0x4c43('0x4a'),_0x4c43('0x26'));this[_0x4c43('0x5')](_0x4c43('0x44'),_0x4c43('0x26'));this[_0x4c43('0x5')](_0x4c43('0x45'),_0x4c43('0x26'));this['setDataValue'](_0x4c43('0x46'),'no');this[_0x4c43('0x5')](_0x4c43('0x4b'),_0x4c43('0x3a'));this[_0x4c43('0x5')](_0x4c43('0x47'),_0x511f28[_0x4c43('0x47')]||_0x4c43('0x4c'));this[_0x4c43('0x5')](_0x4c43('0x48'),_0x511f28[_0x4c43('0x48')]||_0x4c43('0x4d'));this['setDataValue'](_0x4c43('0x49'),_0x4c43('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0x4c43('0x3e')],'set':function(_0x4d4f0d){this[_0x4c43('0x5')]('permissions',_0x4d4f0d?_0x4d4f0d[_0x4c43('0x1e')](','):[]);},'get':function(){return this[_0x4c43('0xb')](_0x4c43('0x4e'))?_[_0x4c43('0x4f')](this[_0x4c43('0xb')](_0x4c43('0x4e'))[_0x4c43('0x20')](','),function(_0x41b647){return parseInt(_0x41b647,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4c43('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4c43('0xf')](_0x4c43('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4c43('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x4c43('0x50')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x4c43('0xb')](_0x4c43('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x4c43('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4c43('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![],'set':function(_0x45fd08){if(typeof _0x45fd08===_0x4c43('0x52')){var _0x5dbf20=_0x45fd08==='1'?!![]:_0x45fd08==='0'?![]:_0x45fd08==='true'?!![]:_0x45fd08==='false'?![]:![];this[_0x4c43('0x5')](_0x4c43('0x53'),_0x5dbf20);}else{this[_0x4c43('0x5')]('screenrecording',_0x45fd08);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x265d7c){this['setDataValue'](_0x4c43('0x54'),_0x265d7c);if(_0x265d7c===!![]){this[_0x4c43('0x5')](_0x4c43('0x55'),moment());this[_0x4c43('0x5')]('loginAttempts',0x0);}else{this[_0x4c43('0x5')](_0x4c43('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x4c43('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x4c43('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x4c43('0x11')](0x5)[_0x4c43('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4c43('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 35c8c66..e5a87d3 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 _0x31e2=['110','104','105','107','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','Agents','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','QueueId','emit','Queue:save','VoiceQueue','get','voice','format','SIP/%s','upsert','removeQueues','remove','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','filename','join','root','server/files/images/logos/default_profile.png','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OPENCHANNEL','MailOpenTabs','MAIL','WHATSAPP','concat','getContacts','CmContact','order','sort','merge','hasOwnProperty','List','Tag','color','tag','pick','Queue','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','LOGININPAUSE','pause','updateAttributes','PAUSE','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','QueuePause','unpause','set','%s%s','Pause','Team','getTeams','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','removeTeams','Whatsapp','Openchannel','removeAgent','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$like','$notLike','$iLike','$overlap','$contained','$any','firstName','phone','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','getUserSetting','getPresence','teams','isEmpty','queues','inbound','lower','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','charAt','toUpperCase','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','moment','bluebird','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','../../config/environment','socket.io-emitter','redis','./user.socket','register','defaults','client','http','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','admin','Users','user','agent','telephone','ignore','map','value','role','name','UserProfileResource','stack','send','index','User','rawAttributes','fieldName','type','key','filter','includes','password','where','query','includeAll','include','userSetting','true','attributes','push','findAll','rows','dataValues','sms','fax','mail','whatsapp','show','params','model','differenceBy','keys','salt','filters','intersection','fields','length','UserSetting','options','find','openTabs','chat','openchannel','all','update','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','101','102','103','113'];(function(_0x2a9c27,_0x43433e){var _0x3f6be1=function(_0x368262){while(--_0x368262){_0x2a9c27['push'](_0x2a9c27['shift']());}};_0x3f6be1(++_0x43433e);}(_0x31e2,0x12b));var _0x231e=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x31e2[_0x16a637];return _0x25126d;};'use strict';var moment=require(_0x231e('0x0'));var BPromise=require(_0x231e('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x231e('0x2'));var squel=require(_0x231e('0x3'));var jayson=require(_0x231e('0x4'));var Redis=require(_0x231e('0x5'));var authService=require(_0x231e('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x231e('0x7'))('api');var utils=require('../../config/utils');var config=require(_0x231e('0x8'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var socket=require(_0x231e('0x9'))(new Redis(config[_0x231e('0xa')]));require(_0x231e('0xb'))[_0x231e('0xc')](socket);config[_0x231e('0xa')]=_[_0x231e('0xd')](config[_0x231e('0xa')],{'host':'localhost','port':0x18eb});var client=jayson[_0x231e('0xe')][_0x231e('0xf')]({'port':0x232a});var values;function respondWithRpcPromise(_0x13e5a4,_0x46e120,_0x166d0c,_0x16362b){return new BPromise(function(_0x290c1b,_0x2712db){var _0x12bc60=_0x16362b||client;return _0x12bc60['request'](_0x13e5a4,_0x166d0c)[_0x231e('0x10')](function(_0x4735c1){logger[_0x231e('0x11')](_0x231e('0x12'),_0x46e120,_0x231e('0x13'));logger[_0x231e('0x14')](_0x231e('0x15'),_0x46e120,_0x231e('0x13'),JSON[_0x231e('0x16')](_0x4735c1));if(_0x4735c1[_0x231e('0x17')]){if(_0x4735c1[_0x231e('0x17')]['code']===0x1f4){logger[_0x231e('0x17')](_0x231e('0x12'),_0x46e120,_0x4735c1[_0x231e('0x17')][_0x231e('0x18')]);return _0x2712db(_0x4735c1[_0x231e('0x17')][_0x231e('0x18')]);}logger[_0x231e('0x17')](_0x231e('0x12'),_0x46e120,_0x4735c1[_0x231e('0x17')][_0x231e('0x18')]);return _0x290c1b(_0x4735c1['error']['message']);}else{logger[_0x231e('0x11')]('User,\x20%s,\x20%s',_0x46e120,_0x231e('0x13'));_0x290c1b(_0x4735c1[_0x231e('0x19')][_0x231e('0x18')]);}})[_0x231e('0x1a')](function(_0x50ce6c){logger['error'](_0x231e('0x12'),_0x46e120,_0x50ce6c);_0x2712db(_0x50ce6c);});});}function respondWithStatusCode(_0x4218d6,_0x40b178){_0x40b178=_0x40b178||0xcc;return function(_0x168fca){if(_0x168fca){return _0x4218d6[_0x231e('0x1b')](_0x40b178);}return _0x4218d6[_0x231e('0x1c')](_0x40b178)[_0x231e('0x1d')]();};}function respondWithResult(_0xd070b0,_0x41bb8d){_0x41bb8d=_0x41bb8d||0xc8;return function(_0x10dd82){if(_0x10dd82){return _0xd070b0['status'](_0x41bb8d)[_0x231e('0x1e')](_0x10dd82);}};}function respondWithFilteredResult(_0x4d3d54,_0x58d6cd){return function(_0x37c0de){if(_0x37c0de){var _0x491514=typeof _0x58d6cd[_0x231e('0x1f')]===_0x231e('0x20')&&typeof _0x58d6cd[_0x231e('0x21')]===_0x231e('0x20');var _0xd5dc65=_0x37c0de[_0x231e('0x22')];var _0x3a7a6e=_0x491514?0x0:_0x58d6cd[_0x231e('0x1f')];var _0x22d969=_0x491514?_0x37c0de[_0x231e('0x22')]:_0x58d6cd[_0x231e('0x1f')]+_0x58d6cd[_0x231e('0x21')];var _0x61b7c1;if(_0x22d969>=_0xd5dc65){_0x22d969=_0xd5dc65;_0x61b7c1=0xc8;}else{_0x61b7c1=0xce;}_0x4d3d54[_0x231e('0x1c')](_0x61b7c1);return _0x4d3d54['set'](_0x231e('0x23'),_0x3a7a6e+'-'+_0x22d969+'/'+_0xd5dc65)['json'](_0x37c0de);}return null;};}function saveUpdates(_0x256722){return function(_0x1e1054){if(_0x1e1054){return _0x1e1054['update'](_0x256722)[_0x231e('0x10')](function(_0x1908d1){return _0x1908d1;});}return null;};}function removeEntity(_0x2bb1bb){return function(_0x5b8dbb){if(_0x5b8dbb){return _0x5b8dbb[_0x231e('0x24')]()[_0x231e('0x10')](function(){var _0x97895=_0x5b8dbb['get']({'plain':!![]});if(_0x97895['role']===_0x231e('0x25'))return;var _0x5145b2=[{'name':_0x231e('0x26'),'value':_0x231e('0x27'),'ignore':!![]},{'name':'Agents','value':_0x231e('0x28'),'ignore':![]},{'name':'Telephones','value':_0x231e('0x29'),'ignore':![]}];var _0x3538f7=_(_0x5145b2)['filter'](_0x231e('0x2a'))[_0x231e('0x2b')](_0x231e('0x2c'))[_0x231e('0x2c')]();if(_['includes'](_0x3538f7,_0x97895[_0x231e('0x2d')])){return;}var _0x813e3e=_['find'](_0x5145b2,[_0x231e('0x2c'),_0x97895[_0x231e('0x2d')]])[_0x231e('0x2e')];return db[_0x231e('0x2f')][_0x231e('0x24')]({'where':{'type':_0x813e3e,'resourceId':_0x97895['id']}})[_0x231e('0x10')](function(){return _0x5b8dbb;});})['then'](function(){_0x2bb1bb[_0x231e('0x1c')](0xcc)[_0x231e('0x1d')]();});}};}function handleEntityNotFound(_0xc11eac){return function(_0x237349){if(!_0x237349){_0xc11eac[_0x231e('0x1b')](0x194);}return _0x237349;};}function handleError(_0x213db1,_0x2b944e){_0x2b944e=_0x2b944e||0x1f4;return function(_0x3d4947){logger[_0x231e('0x17')](_0x3d4947[_0x231e('0x30')]);if(_0x3d4947[_0x231e('0x2e')]){delete _0x3d4947[_0x231e('0x2e')];}_0x213db1[_0x231e('0x1c')](_0x2b944e)[_0x231e('0x31')](_0x3d4947);};}exports[_0x231e('0x32')]=function(_0x47c972,_0x1ef8ee){var _0x3f1ffc={},_0x2719c1={'count':0x0,'rows':[]};var _0x2778cf=_(db[_0x231e('0x33')][_0x231e('0x34')])['map'](function(_0xd27ceb){return{'name':_0xd27ceb[_0x231e('0x35')],'type':_0xd27ceb[_0x231e('0x36')][_0x231e('0x37')]};})[_0x231e('0x38')](function(_0x34b535){return!_[_0x231e('0x39')]([_0x231e('0x3a'),'salt'],_0x34b535['name']);})[_0x231e('0x2c')]();_0x3f1ffc=qs['getOptions'](_0x2778cf,_0x47c972);var _0x51b27f={'where':_0x3f1ffc[_0x231e('0x3b')]};return db[_0x231e('0x33')]['count'](_0x51b27f)[_0x231e('0x10')](function(_0x45d8f0){_0x2719c1[_0x231e('0x22')]=_0x45d8f0;if(_0x47c972[_0x231e('0x3c')][_0x231e('0x3d')]){_0x3f1ffc[_0x231e('0x3e')]=[{'all':!![]}];}if(_0x47c972[_0x231e('0x3c')][_0x231e('0x3f')]===_0x231e('0x40')){_0x3f1ffc['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x231e('0x39')](_0x3f1ffc[_0x231e('0x41')],'id')){_0x3f1ffc[_0x231e('0x41')][_0x231e('0x42')]('id');}return db[_0x231e('0x33')][_0x231e('0x43')](_0x3f1ffc);})[_0x231e('0x10')](function(_0x227f47){_0x2719c1[_0x231e('0x44')]=_0x227f47;if(_0x47c972[_0x231e('0x3c')]['openTabs']===_0x231e('0x40')){var _0x433c96=[];for(var _0x2cd2e4=0x0;_0x2cd2e4<_0x2719c1[_0x231e('0x44')]['length'];_0x2cd2e4++){_0x433c96[_0x231e('0x42')](get_open_tabs('chat',_0x2719c1['rows'][_0x2cd2e4][_0x231e('0x45')]));_0x433c96[_0x231e('0x42')](get_open_tabs(_0x231e('0x46'),_0x2719c1[_0x231e('0x44')][_0x2cd2e4][_0x231e('0x45')]));_0x433c96['push'](get_open_tabs(_0x231e('0x47'),_0x2719c1[_0x231e('0x44')][_0x2cd2e4]['dataValues']));_0x433c96[_0x231e('0x42')](get_open_tabs(_0x231e('0x48'),_0x2719c1[_0x231e('0x44')][_0x2cd2e4][_0x231e('0x45')]));_0x433c96[_0x231e('0x42')](get_open_tabs('openchannel',_0x2719c1[_0x231e('0x44')][_0x2cd2e4][_0x231e('0x45')]));_0x433c96[_0x231e('0x42')](get_open_tabs(_0x231e('0x49'),_0x2719c1['rows'][_0x2cd2e4]['dataValues']));}return BPromise['all'](_0x433c96)['then'](function(){return _0x2719c1;});}else{return _0x2719c1;}})[_0x231e('0x10')](respondWithFilteredResult(_0x1ef8ee,_0x3f1ffc))[_0x231e('0x1a')](handleError(_0x1ef8ee,null));};exports[_0x231e('0x4a')]=function(_0x348c54,_0x1e1537){var _0x433ab2={'raw':![],'where':{'id':_0x348c54[_0x231e('0x4b')]['id']}},_0x88cc21={};_0x88cc21[_0x231e('0x4c')]=_[_0x231e('0x4d')](_[_0x231e('0x4e')](db['User'][_0x231e('0x34')]),['password',_0x231e('0x4f')]);_0x88cc21[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0x348c54['query']);_0x88cc21[_0x231e('0x50')]=_['intersection'](_0x88cc21[_0x231e('0x4c')],_0x88cc21[_0x231e('0x3c')]);_0x433ab2[_0x231e('0x41')]=_[_0x231e('0x51')](_0x88cc21['model'],qs[_0x231e('0x52')](_0x348c54[_0x231e('0x3c')][_0x231e('0x52')]));_0x433ab2[_0x231e('0x41')]=_0x433ab2['attributes'][_0x231e('0x53')]?_0x433ab2[_0x231e('0x41')]:_0x88cc21[_0x231e('0x4c')];if(_0x348c54[_0x231e('0x3c')][_0x231e('0x3d')]){_0x433ab2[_0x231e('0x3e')]=[{'all':!![]}];}if(_0x348c54[_0x231e('0x3c')][_0x231e('0x3f')]==='true'){_0x433ab2[_0x231e('0x3e')]=[{'model':db[_0x231e('0x54')],'as':_0x231e('0x3f')}];}_0x433ab2=_['merge']({},_0x433ab2,_0x348c54[_0x231e('0x55')]);if(!_[_0x231e('0x39')](_0x433ab2[_0x231e('0x41')],'id')){_0x433ab2[_0x231e('0x41')][_0x231e('0x42')]('id');}return db[_0x231e('0x33')][_0x231e('0x56')](_0x433ab2)['then'](handleEntityNotFound(_0x1e1537,null))['then'](function(_0xd96afd){var _0x10557f=[];values=_0xd96afd;if(_0x348c54[_0x231e('0x3c')][_0x231e('0x57')]==='true'){_0x10557f[_0x231e('0x42')](get_open_tabs(_0x231e('0x58'),_0xd96afd[_0x231e('0x45')]));_0x10557f['push'](get_open_tabs('sms',_0xd96afd[_0x231e('0x45')]));_0x10557f[_0x231e('0x42')](get_open_tabs(_0x231e('0x59'),_0xd96afd[_0x231e('0x45')]));_0x10557f[_0x231e('0x42')](get_open_tabs(_0x231e('0x49'),_0xd96afd[_0x231e('0x45')]));_0x10557f[_0x231e('0x42')](get_open_tabs(_0x231e('0x47'),_0xd96afd[_0x231e('0x45')]));_0x10557f[_0x231e('0x42')](get_open_tabs(_0x231e('0x48'),_0xd96afd[_0x231e('0x45')]));return BPromise[_0x231e('0x5a')](_0x10557f);}else{return values;}})['then'](function(){return values;})[_0x231e('0x10')](respondWithResult(_0x1e1537,null))[_0x231e('0x1a')](handleError(_0x1e1537,null));};exports[_0x231e('0x5b')]=function(_0x104ec8,_0x43459c){if(_0x104ec8[_0x231e('0x5c')]['id']){delete _0x104ec8[_0x231e('0x5c')]['id'];}delete _0x104ec8[_0x231e('0x5c')][_0x231e('0x2d')];return db['User']['find']({'where':{'id':_0x104ec8[_0x231e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x43459c,null))[_0x231e('0x10')](saveUpdates(_0x104ec8[_0x231e('0x5c')],null))['then'](respondWithResult(_0x43459c,null))[_0x231e('0x1a')](handleError(_0x43459c,null));};exports[_0x231e('0x5d')]=function(_0x21c905,_0xfe14d9){return db[_0x231e('0x33')][_0x231e('0x5d')]()[_0x231e('0x10')](respondWithResult(_0xfe14d9,null))['catch'](handleError(_0xfe14d9,null));};exports[_0x231e('0x5e')]=function(_0x848d0b,_0x59c29c){return db[_0x231e('0x33')][_0x231e('0x56')]({'where':{'id':_0x848d0b[_0x231e('0x4b')]['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x59c29c,null))[_0x231e('0x10')](function(_0x58019d){if(_0x58019d){return _0x58019d[_0x231e('0x5e')](_0x848d0b['body'][_0x231e('0x5f')],_[_0x231e('0x60')](_0x848d0b[_0x231e('0x5c')],[_0x231e('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x59c29c,null))['catch'](handleError(_0x59c29c,null));};function validateUser(_0x3111bf){return new BPromise(function(_0xa6fff,_0xd85db2){if(_0x3111bf[_0x231e('0x61')])return _0xa6fff(_0x3111bf);return db['Setting'][_0x231e('0x62')](0x1)[_0x231e('0x10')](function(_0x24a127){if(_0x24a127[_0x231e('0x63')])authService[_0x231e('0x64')](_0x3111bf[_0x231e('0x3a')]);db[_0x231e('0x33')][_0x231e('0x65')](_0x231e('0x61'))[_0x231e('0x10')](function(_0xb29247){if(_['isNil'](_0xb29247)){_0x3111bf[_0x231e('0x61')]=_0x24a127[_0x231e('0x66')]||0x1;return;}if(_[_0x231e('0x67')](_0x24a127[_0x231e('0x66')])||_0x24a127[_0x231e('0x66')]===_0xb29247){_0x3111bf['internal']=_0xb29247+0x1;return;}if(_0x24a127[_0x231e('0x66')]>_0xb29247){_0x3111bf[_0x231e('0x61')]=_0x24a127[_0x231e('0x66')];return;}return db[_0x231e('0x68')][_0x231e('0x3c')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x231e('0x68')][_0x231e('0x69')][_0x231e('0x6a')]})[_0x231e('0x10')](function(_0x102b84){if(_0x102b84&&_0x102b84[_0x231e('0x53')]){for(var _0x4562d2=0x0,_0x99db40=_0x102b84['length'];_0x4562d2<_0x99db40&&_[_0x231e('0x67')](_0x3111bf['internal']);_0x4562d2++){if(_0x24a127['min_internal']<=_0x102b84[_0x4562d2]['from']){_0x3111bf[_0x231e('0x61')]=_0x102b84[_0x4562d2]['from'];}else if(_0x24a127[_0x231e('0x66')]>_0x102b84[_0x4562d2][_0x231e('0x6b')]&&_0x24a127['min_internal']<=_0x102b84[_0x4562d2]['to']){_0x3111bf[_0x231e('0x61')]=_0x24a127[_0x231e('0x66')];}}}if(_['isNil'](_0x3111bf[_0x231e('0x61')])){_0x3111bf[_0x231e('0x61')]=_0xb29247+0x1;}return _0xa6fff(_0x3111bf);});});})[_0x231e('0x1a')](function(_0x3f53e1){_0xd85db2(_0x3f53e1);});});}function updateUser(_0x57d934){return new BPromise(function(_0x410e2f,_0x4aa484){try{if(_0x57d934[_0x231e('0x6c')]){_0x57d934[_0x231e('0x6d')]=_0x57d934['internal'];_0x57d934['VoiceMail']={'mailbox':_0x57d934[_0x231e('0x61')],'password':_0x57d934['password'],'fullname':_0x57d934[_0x231e('0x6e')],'email':_0x57d934[_0x231e('0x6f')]};}if(_0x57d934[_0x231e('0x2d')]===_0x231e('0x28')){if(!_0x57d934['permissions'])_0x57d934['permissions']=[_0x231e('0x70'),_0x231e('0x71'),_0x231e('0x72'),_0x231e('0x73'),_0x231e('0x74'),_0x231e('0x75'),_0x231e('0x76'),'106',_0x231e('0x77'),_0x231e('0x78'),_0x231e('0x79'),_0x231e('0x7a'),_0x231e('0x7b'),_0x231e('0x7c'),_0x231e('0x7d')];}_0x410e2f(_0x57d934);}catch(_0x4555a1){_0x4aa484(_0x4555a1);}});}exports[_0x231e('0x7e')]=function(_0x51ad05,_0x2638e1){if(_0x51ad05[_0x231e('0x27')][_0x231e('0x2d')]==='agent')throw new Error(_0x231e('0x7f'));if(_0x51ad05[_0x231e('0x5c')][_0x231e('0x2d')]===_0x231e('0x27')&&_0x51ad05[_0x231e('0x27')]['role']!=='admin'){throw new Error(_0x231e('0x80'));}if(_0x51ad05['body'][_0x231e('0x2d')]===_0x231e('0x25')&&_0x51ad05[_0x231e('0x27')][_0x231e('0x2d')]!=='admin'){throw new Error(_0x231e('0x81'));}return licenseUtil[_0x231e('0x82')]([_0x51ad05[_0x231e('0x5c')]])[_0x231e('0x10')](function(){return validateUser(_0x51ad05[_0x231e('0x5c')]);})['then'](function(_0xf9dc08){return updateUser(_0xf9dc08)['then'](function(_0xb822e2){if(_0xb822e2[_0x231e('0x2d')]===_0x231e('0x25')){_0xb822e2[_0x231e('0x83')]=_0x51ad05[_0x231e('0x27')]['settingsEnabled'];delete _0xb822e2[_0x231e('0x84')];}return _0xb822e2;});})[_0x231e('0x10')](function(_0x279320){return db['User'][_0x231e('0x7e')](_0x279320,{'include':[{'model':db[_0x231e('0x85')],'as':_0x231e('0x85')}]});})[_0x231e('0x10')](function(_0xa52e34){if(_0x51ad05[_0x231e('0x5c')][_0x231e('0x2d')]===_0x231e('0x27'))return _0xa52e34;if(_0x51ad05['user']['role']!==_0x231e('0x27'))return _0xa52e34;return db['UserProfileSection'][_0x231e('0x56')]({'where':{'name':_0xa52e34['role']===_0x231e('0x28')?_0x231e('0x86'):_0x231e('0x87'),'userProfileId':_0x51ad05[_0x231e('0x27')][_0x231e('0x84')]},'raw':!![]})[_0x231e('0x10')](function(_0x4f213c){if(!_0x4f213c||_0x4f213c[_0x231e('0x88')]!=0x0)return _0xa52e34;return db[_0x231e('0x2f')][_0x231e('0x7e')]({'name':_0xa52e34[_0x231e('0x2e')],'resourceId':_0xa52e34['id'],'type':_0x4f213c[_0x231e('0x2e')],'sectionId':_0x4f213c['id']},{})['then'](function(){return _0xa52e34;});})[_0x231e('0x1a')](function(_0x2dd59b){logger['error'](_0x231e('0x89'),_0x2dd59b);throw _0x2dd59b;});})[_0x231e('0x10')](respondWithResult(_0x2638e1,0xc9))['catch'](handleError(_0x2638e1,null));};exports[_0x231e('0x8a')]=function(_0x467631,_0x342a8a){var _0x29a63f=_0x467631['body'];var _0x2b685e=[];if(_0x467631[_0x231e('0x27')][_0x231e('0x2d')]==='agent')throw new Error(_0x231e('0x7f'));if(_[_0x231e('0x8b')](_0x29a63f,['role',_0x231e('0x27')])&&_0x467631[_0x231e('0x27')]['role']!==_0x231e('0x25')){throw new Error(_0x231e('0x80'));}if(_[_0x231e('0x8b')](_0x29a63f,[_0x231e('0x2d'),'admin'])&&_0x467631[_0x231e('0x27')]['role']!==_0x231e('0x25')){throw new Error(_0x231e('0x8c'));}return licenseUtil[_0x231e('0x82')](_0x29a63f)[_0x231e('0x10')](function(){return validateUser(_0x29a63f[0x0]);})[_0x231e('0x10')](function(){for(var _0x576d89=0x1;_0x576d89<_0x29a63f[_0x231e('0x53')];_0x576d89++){var _0x495038=_0x29a63f[_0x576d89-0x1][_0x231e('0x61')];if(!_0x29a63f[_0x576d89][_0x231e('0x61')])_0x29a63f[_0x576d89][_0x231e('0x61')]=_0x495038+0x1;_0x2b685e[_0x231e('0x42')](validateUser(_0x29a63f[_0x576d89]));}return BPromise[_0x231e('0x5a')](_0x2b685e);})[_0x231e('0x10')](function(){_0x2b685e=[];for(var _0x5512ad=0x0;_0x5512ad<_0x29a63f[_0x231e('0x53')];_0x5512ad++){_0x2b685e[_0x231e('0x42')](updateUser(_0x29a63f[_0x5512ad]));}return BPromise[_0x231e('0x5a')](_0x2b685e);})[_0x231e('0x10')](function(){return BPromise[_0x231e('0x8d')](_0x29a63f,function(_0x15420d){return db[_0x231e('0x33')][_0x231e('0x7e')](_0x15420d,{'include':[{'model':db['VoiceMail'],'as':_0x231e('0x85')}]})[_0x231e('0x10')](function(_0x17349f){_0x15420d['id']=_0x17349f['id'];return _0x15420d;});});})[_0x231e('0x10')](function(_0x46ea19){if(_0x467631['body'][_0x231e('0x2d')]===_0x231e('0x27'))return _0x46ea19;if(_0x467631[_0x231e('0x27')][_0x231e('0x2d')]!==_0x231e('0x27'))return _0x46ea19;var _0x392b5c=_[_0x231e('0x8b')](_0x46ea19,function(_0x3766a8){return _0x3766a8[_0x231e('0x2d')]===_0x231e('0x28')||_0x3766a8[_0x231e('0x2d')]===_0x231e('0x29');});if(!_0x392b5c)return _0x46ea19;return db['UserProfileSection'][_0x231e('0x43')]({'where':{'name':{'$or':[_0x231e('0x86'),_0x231e('0x87')]},'userProfileId':_0x467631[_0x231e('0x27')]['userProfileId']},'raw':!![]})[_0x231e('0x10')](function(_0x5be092){if(_['isEmpty'](_0x5be092)||!_['some'](_0x5be092,['autoAssociation',0x0]))return _0x46ea19;_0x2b685e=[];var _0x347963=_(_0x5be092)['map'](function(_0x24802){if(_0x24802['autoAssociation']===0x1)return;return _0x24802[_0x231e('0x2e')]===_0x231e('0x86')?_0x231e('0x28'):_0x231e('0x29');})[_0x231e('0x8e')]()[_0x231e('0x2c')]();for(var _0x41e495=0x0;_0x41e495<_0x46ea19['length'];_0x41e495++){if(!_['includes'](_0x347963,_0x46ea19[_0x41e495][_0x231e('0x2d')]))return;var _0x2aad38=_0x46ea19[_0x41e495][_0x231e('0x2d')]===_0x231e('0x28')?_0x231e('0x86'):_0x231e('0x87');_0x2b685e[_0x231e('0x42')](db['UserProfileResource'][_0x231e('0x7e')]({'name':_0x46ea19[_0x41e495][_0x231e('0x2e')],'resourceId':_0x46ea19[_0x41e495]['id'],'type':_0x2aad38,'sectionId':_[_0x231e('0x56')](_0x5be092,[_0x231e('0x2e'),_0x2aad38])['id']},{}));}return BPromise[_0x231e('0x5a')](_0x2b685e);});})[_0x231e('0x10')](respondWithResult(_0x342a8a,0xc9))[_0x231e('0x1a')](handleError(_0x342a8a,null));};exports[_0x231e('0x8f')]=function(_0xbc2f8c,_0x35961f){if(_0xbc2f8c[_0x231e('0x5c')]['id']){delete _0xbc2f8c['body']['id'];}return db['User']['find']({'where':{'id':_0xbc2f8c[_0x231e('0x4b')]['id']}})[_0x231e('0x10')](function(_0x548212){if(!_0x548212)return null;if(_0x548212['id']===_0xbc2f8c[_0x231e('0x27')]['id']){if(!_0xbc2f8c['body'][_0x231e('0x90')]||!_0xbc2f8c[_0x231e('0x5c')][_0x231e('0x91')]){throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))](_0x231e('0x94'));}if(!_0x548212[_0x231e('0x95')](_0xbc2f8c['body']['oldPassword'])){throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))](_0x231e('0x96'));}if(_0xbc2f8c[_0x231e('0x5c')][_0x231e('0x90')]===_0xbc2f8c[_0x231e('0x5c')][_0x231e('0x91')]){throw new db[(_0x231e('0x92'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xbc2f8c[_0x231e('0x27')][_0x231e('0x2d')]===_0x231e('0x25')){if(!_0xbc2f8c['body'][_0x231e('0x91')]){throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))](_0x231e('0x97'));}}else if(_0xbc2f8c[_0x231e('0x27')][_0x231e('0x2d')]==='user'){if(!_0xbc2f8c[_0x231e('0x5c')][_0x231e('0x91')]){throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))](_0x231e('0x97'));}if(_0x548212[_0x231e('0x2d')]!=='agent'){throw new db[(_0x231e('0x92'))]['ValidationError'](_0x231e('0x7f'));}}else{throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))](_0x231e('0x7f'));}return _0x548212;})[_0x231e('0x10')](handleEntityNotFound(_0x35961f,null))[_0x231e('0x10')](function(_0x128aaf){return db[_0x231e('0x98')][_0x231e('0x99')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x231e('0x9a')]})[_0x231e('0x10')](function(_0x473419){if(_0x473419[_0x231e('0x63')])authService[_0x231e('0x64')](_0xbc2f8c[_0x231e('0x5c')]['newPassword']);if(!_0x473419[_0x231e('0x9b')]||!_0x128aaf[_0x231e('0x9c')])return _0x128aaf;authService[_0x231e('0x9d')](_0xbc2f8c[_0x231e('0x5c')]['newPassword'],_0x128aaf[_0x231e('0x9c')],_0x473419['passwordHistoryLimit']);return _0x128aaf;})[_0x231e('0x10')](saveUpdates({'password':_0xbc2f8c[_0x231e('0x5c')][_0x231e('0x91')],'passwordResetAt':_0xbc2f8c['user']['id']==_0xbc2f8c[_0x231e('0x4b')]['id']?moment():null,'previousPasswords':authService[_0x231e('0x9e')](_0xbc2f8c[_0x231e('0x5c')][_0x231e('0x91')],_0x128aaf[_0x231e('0x9c')])},null));})[_0x231e('0x10')](respondWithResult(_0x35961f,null))['catch'](handleError(_0x35961f,null));};exports[_0x231e('0x9f')]=function(_0x548a0c,_0x186e26){var _0xec3ebf=_0x548a0c[_0x231e('0x5c')][_0x231e('0xa0')];return db['User']['find']({'where':{'id':_0x548a0c[_0x231e('0x4b')]['id']},'attributes':['id',_0x231e('0x2e'),'role',_0x231e('0xa1'),'loginInPause',_0x231e('0xa2'),_0x231e('0xa3')]})[_0x231e('0x10')](handleEntityNotFound(_0x186e26,null))[_0x231e('0x10')](function(_0x4ec9f6){if(_0x4ec9f6){if(!utils[_0x231e('0xa4')](_0xec3ebf)){throw new db['Sequelize'][(_0x231e('0x93'))](_0x231e('0xa5'));}return _0x4ec9f6[_0x231e('0xa6')+_['capitalize'](_0xec3ebf[_0x231e('0xa7')]())+_0x231e('0xa8')](_0x548a0c[_0x231e('0x5c')][_0x231e('0x5f')],{'penalty':_0x548a0c['body'][_0x231e('0xa9')]||0x0})[_0x231e('0xaa')](function(_0x228cbb){for(var _0x363ae9=0x0;_0x363ae9<_0x548a0c['body'][_0x231e('0x5f')][_0x231e('0x53')];_0x363ae9+=0x1){var _0x9c74b8={'UserId':Number(_0x548a0c[_0x231e('0x4b')]['id'])};_0x9c74b8[_[_0x231e('0xab')](_0xec3ebf['toLowerCase']())+_0x231e('0xac')]=Number(_0x548a0c[_0x231e('0x5c')][_0x231e('0x5f')][_0x363ae9]);socket[_0x231e('0xad')](_0x231e('0x27')+_[_0x231e('0xab')](_0xec3ebf[_0x231e('0xa7')]())+_0x231e('0xae'),_0x9c74b8);}return _0x228cbb;})['then'](function(){if(_0xec3ebf==='voice'){return db[_0x231e('0xaf')]['findAll']({'where':{'id':_0x548a0c['body'][_0x231e('0x5f')]||[]},'raw':!![],'attributes':['id',_0x231e('0x2e')]});}})[_0x231e('0x10')](function(_0x4f54c2){var _0x431ac3=_0x4ec9f6[_0x231e('0xb0')]({'plain':!![]});var _0x245265=[];if(_0xec3ebf===_0x231e('0xb1')&&_0x431ac3[_0x231e('0x2d')]===_0x231e('0x28')&&_0x431ac3[_0x231e('0xa1')]){for(var _0x237b4e=0x0;_0x237b4e<_0x4f54c2['length'];_0x237b4e+=0x1){_0x245265[_0x231e('0x42')]({'membername':_0x431ac3[_0x231e('0x2e')],'UserId':_0x431ac3['id'],'queue_name':_0x4f54c2[_0x237b4e]['name'],'VoiceQueueId':_0x4f54c2[_0x237b4e]['id'],'interface':_[_0x231e('0x67')](_0x431ac3['interface'])?util[_0x231e('0xb2')](_0x231e('0xb3'),_0x431ac3['name']):_0x431ac3[_0x231e('0xa3')],'paused':_0x431ac3['voicePause']||![],'penalty':_0x548a0c[_0x231e('0x5c')][_0x231e('0xa9')]||0x0});}return BPromise[_0x231e('0x8d')](_0x245265,function(_0x334a4d){return db['UserVoiceQueueRt'][_0x231e('0xb4')](_0x334a4d);});}return _0x4ec9f6;});}})[_0x231e('0x10')](respondWithStatusCode(_0x186e26,null))[_0x231e('0x1a')](handleError(_0x186e26,null));};exports[_0x231e('0xb5')]=function(_0x671e97,_0x512125){var _0x117748,_0x5f9220;return db[_0x231e('0x33')]['find']({'where':{'id':_0x671e97[_0x231e('0x4b')]['id']},'attributes':['id','name',_0x231e('0x2d')]})[_0x231e('0x10')](handleEntityNotFound(_0x512125,null))[_0x231e('0x10')](function(_0x42eebe){if(_0x42eebe){_0x117748=_0x42eebe;if(!_0x671e97[_0x231e('0x3c')][_0x231e('0xa0')]||!utils[_0x231e('0xa4')](_0x671e97[_0x231e('0x3c')][_0x231e('0xa0')])){throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))](_0x231e('0xa5'));}return _0x42eebe[_0x231e('0xb6')+_[_0x231e('0xab')](_0x671e97[_0x231e('0x3c')][_0x231e('0xa0')][_0x231e('0xa7')]())+_0x231e('0xa8')](_0x671e97[_0x231e('0x3c')][_0x231e('0x5f')]);}})[_0x231e('0x10')](function(_0x18df67){if(_['isArray'](_0x671e97[_0x231e('0x3c')][_0x231e('0x5f')])){for(var _0x4652a5=0x0;_0x4652a5<_0x671e97['query']['ids'][_0x231e('0x53')];_0x4652a5+=0x1){_0x5f9220={'UserId':Number(_0x671e97[_0x231e('0x4b')]['id'])};_0x5f9220[_['capitalize'](_0x671e97[_0x231e('0x3c')][_0x231e('0xa0')]['toLowerCase']())+_0x231e('0xac')]=Number(_0x671e97[_0x231e('0x3c')]['ids'][_0x4652a5]);socket[_0x231e('0xad')](_0x231e('0x27')+_[_0x231e('0xab')](_0x671e97[_0x231e('0x3c')]['channel'][_0x231e('0xa7')]())+_0x231e('0xb7'),_0x5f9220);}}else{_0x5f9220={'UserId':Number(_0x671e97[_0x231e('0x4b')]['id'])};_0x5f9220[_[_0x231e('0xab')](_0x671e97[_0x231e('0x3c')]['channel']['toLowerCase']())+_0x231e('0xac')]=Number(_0x671e97['query'][_0x231e('0x5f')]);socket[_0x231e('0xad')](_0x231e('0x27')+_[_0x231e('0xab')](_0x671e97[_0x231e('0x3c')][_0x231e('0xa0')][_0x231e('0xa7')]())+'Queue:remove',_0x5f9220);}return _0x18df67;})[_0x231e('0x10')](function(){if(_0x671e97[_0x231e('0x3c')]['channel']===_0x231e('0xb1')){return db[_0x231e('0xb8')][_0x231e('0x24')]({'where':{'UserId':_0x671e97['params']['id'],'VoiceQueueId':_0x671e97[_0x231e('0x3c')][_0x231e('0x5f')]},'individualHooks':!![]})[_0x231e('0x10')](function(){return _0x117748;});}return _0x117748;})[_0x231e('0x10')](respondWithStatusCode(_0x512125,null))[_0x231e('0x1a')](handleError(_0x512125,null));};exports[_0x231e('0xb9')]=function(_0xa7afc3,_0x427d24){_0xa7afc3[_0x231e('0x5c')][_0x231e('0xba')]=_0xa7afc3['file'][_0x231e('0xbb')];return db[_0x231e('0x33')][_0x231e('0x56')]({'where':{'id':_0xa7afc3[_0x231e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x427d24,null))[_0x231e('0x10')](saveUpdates(_0xa7afc3[_0x231e('0x5c')],null))[_0x231e('0x10')](respondWithResult(_0x427d24,null))[_0x231e('0x1a')](handleError(_0x427d24,null));};exports['getAvatar']=function(_0x34acaf,_0x527946){var _0x111425=path[_0x231e('0xbc')](config[_0x231e('0xbd')],_0x231e('0xbe'));return db[_0x231e('0x33')]['find']({'where':{'id':_0x34acaf[_0x231e('0x4b')]['id']},'attributes':['id',_0x231e('0xba')],'raw':!![]})[_0x231e('0x10')](handleEntityNotFound(_0x527946,null))[_0x231e('0x10')](function(_0x2b88eb){if(_0x2b88eb){if(_[_0x231e('0x67')](_0x2b88eb[_0x231e('0xba')])){return _0x527946['download'](_0x111425);}else{if(!fs['existsSync'](path[_0x231e('0xbc')](config[_0x231e('0xbd')],_0x231e('0xbf'),_0x2b88eb['userpic']))){return _0x527946[_0x231e('0xc0')](_0x111425);}return _0x527946['download'](path['join'](config[_0x231e('0xbd')],_0x231e('0xbf'),_0x2b88eb[_0x231e('0xba')]));}}})['catch'](handleError(_0x527946,null));};exports[_0x231e('0xc1')]=function(_0x1e8db9,_0x3984b4){return db[_0x231e('0x33')][_0x231e('0x56')]({'where':{'id':_0x1e8db9[_0x231e('0x4b')]['id']},'attributes':['id']})[_0x231e('0x10')](handleEntityNotFound(_0x3984b4,null))[_0x231e('0x10')](function(_0x4150cd){var _0x5f2964=[];values=_0x4150cd[_0x231e('0x45')];_0x5f2964[_0x231e('0x42')](get_open_tabs(_0x231e('0x58'),_0x4150cd['dataValues']));_0x5f2964[_0x231e('0x42')](get_open_tabs(_0x231e('0x46'),_0x4150cd['dataValues']));_0x5f2964[_0x231e('0x42')](get_open_tabs(_0x231e('0x59'),_0x4150cd[_0x231e('0x45')]));_0x5f2964[_0x231e('0x42')](get_open_tabs(_0x231e('0x49'),_0x4150cd['dataValues']));_0x5f2964[_0x231e('0x42')](get_open_tabs('fax',_0x4150cd[_0x231e('0x45')]));_0x5f2964[_0x231e('0x42')](get_open_tabs(_0x231e('0x48'),_0x4150cd['dataValues']));return BPromise[_0x231e('0x5a')](_0x5f2964);})[_0x231e('0x10')](function(_0xe45431){if(_0xe45431){var _0x4c8472=_[_0x231e('0x2b')](values[_0x231e('0xc2')],function(_0xe9a614){return{'channel':_0x231e('0xc3'),'id':_0xe9a614['id'],'createdAt':_0xe9a614['createdAt']};});var _0x393014=_['map'](values[_0x231e('0xc4')],function(_0x1b4d7c){return{'channel':_0x231e('0xc5'),'id':_0x1b4d7c['id'],'createdAt':_0x1b4d7c[_0x231e('0xc6')]};});var _0x1a9175=_[_0x231e('0x2b')](values['OpenchannelOpenTabs'],function(_0x3cc91c){return{'channel':_0x231e('0xc7'),'id':_0x3cc91c['id'],'createdAt':_0x3cc91c[_0x231e('0xc6')]};});var _0xa5f97f=_[_0x231e('0x2b')](values[_0x231e('0xc8')],function(_0x3fdba5){return{'channel':_0x231e('0xc9'),'id':_0x3fdba5['id'],'createdAt':_0x3fdba5[_0x231e('0xc6')]};});var _0xa04743=_[_0x231e('0x2b')](values['SmsOpenTabs'],function(_0xa4c70a){return{'channel':'SMS','id':_0xa4c70a['id'],'createdAt':_0xa4c70a[_0x231e('0xc6')]};});var _0x5b4d3b=_[_0x231e('0x2b')](values['WhatsappOpenTabs'],function(_0x1e3e3a){return{'channel':_0x231e('0xca'),'id':_0x1e3e3a['id'],'createdAt':_0x1e3e3a[_0x231e('0xc6')]};});var _0x16e34a=_[_0x231e('0xcb')](_0x4c8472,_0x393014,_0x1a9175,_0xa5f97f,_0xa04743,_0x5b4d3b);var _0x4093d3={'count':_0x16e34a['length'],'rows':_0x16e34a};return _0x4093d3;}else return null;})[_0x231e('0x10')](respondWithResult(_0x3984b4,null))[_0x231e('0x1a')](handleError(_0x3984b4,null));};exports[_0x231e('0xcc')]=function(_0x2c9641,_0xe6fd27){var _0x38597c={};var _0x39cf3c={};var _0x38dcf7;var _0x5004d6;return db[_0x231e('0x33')][_0x231e('0x99')]({'where':{'id':_0x2c9641[_0x231e('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe6fd27,null))['then'](function(_0x1f0321){if(_0x1f0321){_0x38dcf7=_0x1f0321;_0x39cf3c['model']=_[_0x231e('0x4e')](db[_0x231e('0xcd')][_0x231e('0x34')]);_0x39cf3c['query']=_[_0x231e('0x4e')](_0x2c9641[_0x231e('0x3c')]);_0x39cf3c['filters']=_[_0x231e('0x51')](_0x39cf3c[_0x231e('0x4c')],_0x39cf3c[_0x231e('0x3c')]);_0x38597c['attributes']=_['intersection'](_0x39cf3c[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x2c9641['query'][_0x231e('0x52')]));_0x38597c['attributes']=_0x38597c['attributes']['length']?_0x38597c[_0x231e('0x41')]:_0x39cf3c[_0x231e('0x4c')];_0x38597c[_0x231e('0xce')]=qs[_0x231e('0xcf')](_0x2c9641[_0x231e('0x3c')][_0x231e('0xcf')]);_0x38597c[_0x231e('0x3b')]=qs[_0x231e('0x50')](_['pick'](_0x2c9641[_0x231e('0x3c')],_0x39cf3c['filters']));if(_0x2c9641[_0x231e('0x3c')][_0x231e('0x38')]){_0x38597c[_0x231e('0x3b')]=_[_0x231e('0xd0')](_0x38597c['where'],{'$or':_[_0x231e('0x2b')](_0x38597c[_0x231e('0x41')],function(_0x4317d3){var _0x31b376={};_0x31b376[_0x4317d3]={'$like':'%'+_0x2c9641[_0x231e('0x3c')][_0x231e('0x38')]+'%'};return _0x31b376;})});}_0x38597c=_[_0x231e('0xd0')]({},_0x38597c,_0x2c9641['options']);return _0x38dcf7['getContacts'](_0x38597c);}})[_0x231e('0x10')](function(_0x2467c1){if(_0x2467c1){_0x5004d6=_0x2467c1[_0x231e('0x53')];if(_0x2c9641[_0x231e('0x3c')][_0x231e('0xd1')]('includeAll')){_0x38597c['include']=[{'model':db['CmList'],'as':_0x231e('0xd2'),'required':![]},{'model':db[_0x231e('0xd3')],'as':'Tags','attributes':['id',_0x231e('0x2e'),_0x231e('0xd4')],'where':_0x2c9641[_0x231e('0x3c')][_0x231e('0xd5')]?{'id':_0x2c9641['query'][_0x231e('0xd5')]}:undefined,'required':_0x2c9641[_0x231e('0x3c')][_0x231e('0xd5')]?!![]:![]}];}if(!_0x2c9641[_0x231e('0x3c')][_0x231e('0xd1')]('nolimit')){_0x38597c[_0x231e('0x21')]=qs[_0x231e('0x21')](_0x2c9641[_0x231e('0x3c')][_0x231e('0x21')]);_0x38597c[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0x2c9641[_0x231e('0x3c')][_0x231e('0x1f')]);}return _0x38dcf7[_0x231e('0xcc')](_0x38597c);}})[_0x231e('0x10')](function(_0x274884){if(_0x274884){return _0x274884?{'count':_0x5004d6,'rows':_0x274884}:null;}})['then'](respondWithResult(_0xe6fd27,null))[_0x231e('0x1a')](handleError(_0xe6fd27,null));};exports['getQueues']=function(_0x1c8fd9,_0x574dab){var _0x4e7b63;var _0x27980d={};var _0x1ffa4f;return db[_0x231e('0x33')]['findOne']({'where':{'id':_0x1c8fd9[_0x231e('0x4b')]['id']},'attributes':['id',_0x231e('0x2e'),_0x231e('0x2d')]})[_0x231e('0x10')](handleEntityNotFound(_0x574dab,null))[_0x231e('0x10')](function(_0x1f66de){if(!utils[_0x231e('0xa4')](_0x1c8fd9[_0x231e('0x3c')][_0x231e('0xa0')])){throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))](_0x231e('0xa5'));}_0x4e7b63=_0x1f66de;var _0x79873c={};_0x79873c[_0x231e('0x4c')]=_[_0x231e('0x4e')](db[_[_0x231e('0xab')](_0x1c8fd9[_0x231e('0x3c')][_0x231e('0xa0')])+'Queue'][_0x231e('0x34')]);_0x79873c[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0x1c8fd9[_0x231e('0x3c')]);_0x79873c[_0x231e('0x50')]=_[_0x231e('0x51')](_0x79873c['model'],_0x79873c[_0x231e('0x3c')]);_0x27980d[_0x231e('0x41')]=_['intersection'](_0x79873c[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x1c8fd9['query']['fields']));_0x27980d[_0x231e('0x41')]=_0x27980d[_0x231e('0x41')][_0x231e('0x53')]?_0x27980d[_0x231e('0x41')]:_0x79873c[_0x231e('0x4c')];_0x27980d['order']=qs[_0x231e('0xcf')](_0x1c8fd9[_0x231e('0x3c')][_0x231e('0xcf')]);_0x27980d[_0x231e('0x3b')]=qs[_0x231e('0x50')](_[_0x231e('0xd6')](_0x1c8fd9[_0x231e('0x3c')],_0x79873c[_0x231e('0x50')]));if(_0x1c8fd9[_0x231e('0x3c')][_0x231e('0x38')]){_0x27980d['where']=_['merge'](_0x27980d['where'],{'$or':_[_0x231e('0x2b')](_0x27980d[_0x231e('0x41')],function(_0x45117e){var _0x4fd931={};_0x4fd931[_0x45117e]={'$like':'%'+_0x1c8fd9[_0x231e('0x3c')]['filter']+'%'};return _0x4fd931;})});}_0x27980d=_[_0x231e('0xd0')]({},_0x27980d,_0x1c8fd9[_0x231e('0x55')]);switch(_0x4e7b63[_0x231e('0x2d')]){case'admin':return db[_[_0x231e('0xab')](_0x1c8fd9[_0x231e('0x3c')]['channel'])+'Queue'][_0x231e('0x43')](_0x27980d);case _0x231e('0x27'):case _0x231e('0x28'):return _0x4e7b63[_0x231e('0xb0')+_['capitalize'](_0x1c8fd9[_0x231e('0x3c')][_0x231e('0xa0')])+_0x231e('0xa8')](_0x27980d);default:throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))]('Unknown\x20role');}})[_0x231e('0x10')](function(_0x2de23c){_0x1ffa4f=_0x2de23c['length'];if(!_0x1c8fd9[_0x231e('0x3c')][_0x231e('0xd1')]('nolimit')){_0x27980d['limit']=qs['limit'](_0x1c8fd9[_0x231e('0x3c')]['limit']);_0x27980d[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0x1c8fd9[_0x231e('0x3c')][_0x231e('0x1f')]);}switch(_0x4e7b63[_0x231e('0x2d')]){case _0x231e('0x25'):return db[_[_0x231e('0xab')](_0x1c8fd9[_0x231e('0x3c')][_0x231e('0xa0')])+_0x231e('0xd7')][_0x231e('0x43')](_0x27980d);case _0x231e('0x27'):case _0x231e('0x28'):return _0x4e7b63['get'+_[_0x231e('0xab')](_0x1c8fd9[_0x231e('0x3c')][_0x231e('0xa0')])+'Queues'](_0x27980d);}})['then'](function(_0x2497df){return{'count':_0x1ffa4f,'rows':_0x2497df};})[_0x231e('0x10')](respondWithResult(_0x574dab,null))[_0x231e('0x1a')](handleError(_0x574dab,null));};exports[_0x231e('0xd8')]=function(_0x147350,_0x293a21){var _0x895a8e={};var _0x2b4b85={};var _0x3bfafb;var _0x1cd89c;return db[_0x231e('0x33')][_0x231e('0x99')]({'where':{'id':_0x147350['params']['id']}})['then'](handleEntityNotFound(_0x293a21,null))['then'](function(_0x16d9e0){if(_0x16d9e0){_0x3bfafb=_0x16d9e0;_0x2b4b85[_0x231e('0x4c')]=_[_0x231e('0x4e')](db[_0x231e('0xb8')][_0x231e('0x34')]);_0x2b4b85['query']=_[_0x231e('0x4e')](_0x147350[_0x231e('0x3c')]);_0x2b4b85[_0x231e('0x50')]=_[_0x231e('0x51')](_0x2b4b85[_0x231e('0x4c')],_0x2b4b85[_0x231e('0x3c')]);_0x895a8e['attributes']=_[_0x231e('0x51')](_0x2b4b85[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x147350['query'][_0x231e('0x52')]));_0x895a8e[_0x231e('0x41')]=_0x895a8e[_0x231e('0x41')]['length']?_0x895a8e[_0x231e('0x41')]:_0x2b4b85[_0x231e('0x4c')];_0x895a8e[_0x231e('0xce')]=qs[_0x231e('0xcf')](_0x147350['query'][_0x231e('0xcf')]);_0x895a8e['where']=qs[_0x231e('0x50')](_[_0x231e('0xd6')](_0x147350[_0x231e('0x3c')],_0x2b4b85[_0x231e('0x50')]));if(_0x147350['query']['filter']){_0x895a8e[_0x231e('0x3b')]=_['merge'](_0x895a8e['where'],{'$or':_[_0x231e('0x2b')](_0x895a8e['attributes'],function(_0x7ddc61){var _0x71e39e={};_0x71e39e[_0x7ddc61]={'$like':'%'+_0x147350[_0x231e('0x3c')][_0x231e('0x38')]+'%'};return _0x71e39e;})});}_0x895a8e=_[_0x231e('0xd0')]({},_0x895a8e,_0x147350[_0x231e('0x55')]);return _0x3bfafb[_0x231e('0xd8')](_0x895a8e);}})[_0x231e('0x10')](function(_0x29a837){if(_0x29a837){_0x1cd89c=_0x29a837['length'];if(!_0x147350['query'][_0x231e('0xd1')](_0x231e('0xd9'))){_0x895a8e[_0x231e('0x21')]=qs['limit'](_0x147350['query'][_0x231e('0x21')]);_0x895a8e[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0x147350[_0x231e('0x3c')][_0x231e('0x1f')]);}return _0x3bfafb['getVoiceQueuesRt'](_0x895a8e);}})[_0x231e('0x10')](function(_0x1410ff){if(_0x1410ff){return _0x1410ff?{'count':_0x1cd89c,'rows':_0x1410ff}:null;}})[_0x231e('0x10')](respondWithResult(_0x293a21,null))[_0x231e('0x1a')](handleError(_0x293a21,null));};exports[_0x231e('0xda')]=function(_0x28c4fa,_0xcdca8d){var _0x4b20b2={};var _0xb338b3={};var _0x59552a;var _0x480f61;return db[_0x231e('0x33')][_0x231e('0x99')]({'where':{'id':_0x28c4fa['params']['id']}})[_0x231e('0x10')](handleEntityNotFound(_0xcdca8d,null))[_0x231e('0x10')](function(_0x22f999){if(_0x22f999){_0x59552a=_0x22f999;_0xb338b3[_0x231e('0x4c')]=_['keys'](db[_0x231e('0xdb')][_0x231e('0x34')]);_0xb338b3[_0x231e('0x3c')]=_['keys'](_0x28c4fa[_0x231e('0x3c')]);_0xb338b3[_0x231e('0x50')]=_['intersection'](_0xb338b3['model'],_0xb338b3[_0x231e('0x3c')]);_0x4b20b2[_0x231e('0x41')]=_['intersection'](_0xb338b3[_0x231e('0x4c')],qs['fields'](_0x28c4fa[_0x231e('0x3c')][_0x231e('0x52')]));_0x4b20b2[_0x231e('0x41')]=_0x4b20b2[_0x231e('0x41')]['length']?_0x4b20b2[_0x231e('0x41')]:_0xb338b3['model'];_0x4b20b2[_0x231e('0xce')]=qs['sort'](_0x28c4fa[_0x231e('0x3c')][_0x231e('0xcf')]);_0x4b20b2['where']=qs[_0x231e('0x50')](_[_0x231e('0xd6')](_0x28c4fa[_0x231e('0x3c')],_0xb338b3[_0x231e('0x50')]));if(_0x28c4fa['query'][_0x231e('0x38')]){_0x4b20b2[_0x231e('0x3b')]=_[_0x231e('0xd0')](_0x4b20b2[_0x231e('0x3b')],{'$or':_['map'](_0x4b20b2['attributes'],function(_0x3cf5a5){var _0x993a43={};_0x993a43[_0x3cf5a5]={'$like':'%'+_0x28c4fa['query'][_0x231e('0x38')]+'%'};return _0x993a43;})});}_0x4b20b2=_[_0x231e('0xd0')]({},_0x4b20b2,_0x28c4fa[_0x231e('0x55')]);return _0x59552a['getGroups'](_0x4b20b2);}})[_0x231e('0x10')](function(_0x48bcde){if(_0x48bcde){_0x480f61=_0x48bcde[_0x231e('0x53')];if(!_0x28c4fa[_0x231e('0x3c')][_0x231e('0xd1')](_0x231e('0xd9'))){_0x4b20b2['limit']=qs[_0x231e('0x21')](_0x28c4fa[_0x231e('0x3c')][_0x231e('0x21')]);_0x4b20b2[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0x28c4fa['query'][_0x231e('0x1f')]);}return _0x59552a[_0x231e('0xda')](_0x4b20b2);}})[_0x231e('0x10')](function(_0x5136b7){if(_0x5136b7){return _0x5136b7?{'count':_0x480f61,'rows':_0x5136b7}:null;}})[_0x231e('0x10')](respondWithResult(_0xcdca8d,null))[_0x231e('0x1a')](handleError(_0xcdca8d,null));};exports[_0x231e('0xdc')]=function(_0x41d5ca,_0x464e2e){var _0x4e55f8={'raw':!![],'where':{}};var _0x55eae2={};var _0x221914={'count':0x0,'rows':[]};return db['User'][_0x231e('0x99')]({'where':{'id':_0x41d5ca[_0x231e('0x4b')]['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x464e2e,null))[_0x231e('0x10')](function(_0x53ae15){if(_0x53ae15){_0x55eae2[_0x231e('0x4c')]=_['keys'](db[_0x231e('0xdd')][_0x231e('0x34')]);_0x55eae2[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0x41d5ca['query']);_0x55eae2['filters']=_[_0x231e('0x51')](_0x55eae2[_0x231e('0x4c')],_0x55eae2[_0x231e('0x3c')]);_0x4e55f8['attributes']=_[_0x231e('0x51')](_0x55eae2[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x41d5ca['query'][_0x231e('0x52')]));_0x4e55f8[_0x231e('0x41')]=_0x4e55f8['attributes']['length']?_0x4e55f8[_0x231e('0x41')]:_0x55eae2['model'];if(!_0x41d5ca[_0x231e('0x3c')][_0x231e('0xd1')](_0x231e('0xd9'))){_0x4e55f8['limit']=qs[_0x231e('0x21')](_0x41d5ca['query'][_0x231e('0x21')]);_0x4e55f8[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0x41d5ca[_0x231e('0x3c')][_0x231e('0x1f')]);}_0x4e55f8['order']=qs[_0x231e('0xcf')](_0x41d5ca[_0x231e('0x3c')][_0x231e('0xcf')]);_0x4e55f8[_0x231e('0x3b')]=qs[_0x231e('0x50')](_[_0x231e('0xd6')](_0x41d5ca[_0x231e('0x3c')],_0x55eae2[_0x231e('0x50')]));_0x4e55f8[_0x231e('0x3b')][_0x231e('0xde')]=_0x53ae15['id'];if(_0x41d5ca['query']['filter']){_0x4e55f8[_0x231e('0x3b')]=_[_0x231e('0xd0')](_0x4e55f8[_0x231e('0x3b')],{'$or':_['map'](_0x4e55f8['attributes'],function(_0x3837a2){var _0x503a1b={};_0x503a1b[_0x3837a2]={'$like':'%'+_0x41d5ca['query']['filter']+'%'};return _0x503a1b;})});}_0x4e55f8=_[_0x231e('0xd0')]({},_0x4e55f8,_0x41d5ca[_0x231e('0x55')]);return db[_0x231e('0xdd')][_0x231e('0x22')]({'where':_0x4e55f8[_0x231e('0x3b')]})[_0x231e('0x10')](function(_0x2803f4){_0x221914['count']=_0x2803f4;if(_0x41d5ca[_0x231e('0x3c')][_0x231e('0x3d')]){_0x4e55f8[_0x231e('0x3e')]=[{'all':!![]}];}return db['VoiceRecording'][_0x231e('0x43')](_0x4e55f8);})[_0x231e('0x10')](function(_0x11a801){_0x221914['rows']=_0x11a801;return _0x221914;});}})[_0x231e('0x10')](respondWithFilteredResult(_0x464e2e,_0x4e55f8))[_0x231e('0x1a')](handleError(_0x464e2e,null));};exports[_0x231e('0xdf')]=function(_0x23caf9,_0x4e96c2){var _0x53a07d={'raw':!![],'where':{}};var _0x288cf5={};var _0x3ad022={'count':0x0,'rows':[]};return db['User'][_0x231e('0x99')]({'where':{'id':_0x23caf9[_0x231e('0x4b')]['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x4e96c2,null))[_0x231e('0x10')](function(_0x495294){if(_0x495294){_0x288cf5['model']=_[_0x231e('0x4e')](db[_0x231e('0xe0')][_0x231e('0x34')]);_0x288cf5[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0x23caf9[_0x231e('0x3c')]);_0x288cf5[_0x231e('0x50')]=_['intersection'](_0x288cf5[_0x231e('0x4c')],_0x288cf5[_0x231e('0x3c')]);_0x53a07d[_0x231e('0x41')]=_[_0x231e('0x51')](_0x288cf5[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x23caf9['query'][_0x231e('0x52')]));_0x53a07d[_0x231e('0x41')]=_0x53a07d[_0x231e('0x41')][_0x231e('0x53')]?_0x53a07d[_0x231e('0x41')]:_0x288cf5['model'];if(!_0x23caf9[_0x231e('0x3c')][_0x231e('0xd1')]('nolimit')){_0x53a07d['limit']=qs[_0x231e('0x21')](_0x23caf9[_0x231e('0x3c')][_0x231e('0x21')]);_0x53a07d[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0x23caf9[_0x231e('0x3c')][_0x231e('0x1f')]);}_0x53a07d[_0x231e('0xce')]=qs[_0x231e('0xcf')](_0x23caf9[_0x231e('0x3c')][_0x231e('0xcf')]);_0x53a07d['where']=qs[_0x231e('0x50')](_['pick'](_0x23caf9[_0x231e('0x3c')],_0x288cf5[_0x231e('0x50')]));_0x53a07d['where'][_0x231e('0xde')]=_0x495294['id'];if(_0x23caf9[_0x231e('0x3c')][_0x231e('0x38')]){_0x53a07d[_0x231e('0x3b')]=_[_0x231e('0xd0')](_0x53a07d[_0x231e('0x3b')],{'$or':_['map'](_0x53a07d[_0x231e('0x41')],function(_0x2549c5){var _0x551da1={};_0x551da1[_0x2549c5]={'$like':'%'+_0x23caf9['query'][_0x231e('0x38')]+'%'};return _0x551da1;})});}_0x53a07d=_['merge']({},_0x53a07d,_0x23caf9['options']);return db[_0x231e('0xe0')][_0x231e('0x22')]({'where':_0x53a07d[_0x231e('0x3b')]})['then'](function(_0x5229c5){_0x3ad022[_0x231e('0x22')]=_0x5229c5;if(_0x23caf9[_0x231e('0x3c')][_0x231e('0x3d')]){_0x53a07d[_0x231e('0x3e')]=[{'all':!![]}];}return db['ScreenRecording'][_0x231e('0x43')](_0x53a07d);})['then'](function(_0x596499){_0x3ad022['rows']=_0x596499;return _0x3ad022;});}})[_0x231e('0x10')](respondWithFilteredResult(_0x4e96c2,_0x53a07d))[_0x231e('0x1a')](handleError(_0x4e96c2,null));};exports[_0x231e('0xe1')]=function(_0x5e178d,_0x45f573){var _0x13913a={};var _0x49fb0d={};var _0x31ea11;var _0x28569c;return db['User'][_0x231e('0x99')]({'where':{'id':_0x5e178d[_0x231e('0x4b')]['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x45f573,null))['then'](function(_0x5d0617){if(_0x5d0617){_0x31ea11=_0x5d0617;_0x49fb0d[_0x231e('0x4c')]=_['keys'](db[_0x231e('0xe2')][_0x231e('0x34')]);_0x49fb0d[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0x5e178d[_0x231e('0x3c')]);_0x49fb0d[_0x231e('0x50')]=_['intersection'](_0x49fb0d[_0x231e('0x4c')],_0x49fb0d[_0x231e('0x3c')]);_0x13913a['attributes']=_[_0x231e('0x51')](_0x49fb0d['model'],qs['fields'](_0x5e178d[_0x231e('0x3c')][_0x231e('0x52')]));_0x13913a[_0x231e('0x41')]=_0x13913a[_0x231e('0x41')][_0x231e('0x53')]?_0x13913a[_0x231e('0x41')]:_0x49fb0d['model'];_0x13913a['order']=qs[_0x231e('0xcf')](_0x5e178d[_0x231e('0x3c')][_0x231e('0xcf')]);_0x13913a[_0x231e('0x3b')]=qs['filters'](_['pick'](_0x5e178d[_0x231e('0x3c')],_0x49fb0d['filters']));if(_0x5e178d['query'][_0x231e('0x38')]){_0x13913a[_0x231e('0x3b')]=_[_0x231e('0xd0')](_0x13913a[_0x231e('0x3b')],{'$or':_['map'](_0x13913a[_0x231e('0x41')],function(_0x4c4dcf){var _0x12aa05={};_0x12aa05[_0x4c4dcf]={'$like':'%'+_0x5e178d[_0x231e('0x3c')]['filter']+'%'};return _0x12aa05;})});}_0x13913a=_['merge']({},_0x13913a,_0x5e178d[_0x231e('0x55')]);return _0x31ea11[_0x231e('0xe1')](_0x13913a);}})['then'](function(_0x40d8a6){if(_0x40d8a6){_0x28569c=_0x40d8a6[_0x231e('0x53')];if(!_0x5e178d[_0x231e('0x3c')][_0x231e('0xd1')](_0x231e('0xd9'))){_0x13913a[_0x231e('0x21')]=qs[_0x231e('0x21')](_0x5e178d[_0x231e('0x3c')]['limit']);_0x13913a['offset']=qs[_0x231e('0x1f')](_0x5e178d[_0x231e('0x3c')][_0x231e('0x1f')]);}return _0x31ea11[_0x231e('0xe1')](_0x13913a);}})[_0x231e('0x10')](function(_0x3663f6){if(_0x3663f6){return _0x3663f6?{'count':_0x28569c,'rows':_0x3663f6}:null;}})[_0x231e('0x10')](respondWithResult(_0x45f573,null))[_0x231e('0x1a')](handleError(_0x45f573,null));};exports['getOpenchannelInteractions']=function(_0xc5aa43,_0x3a5e7a){var _0x219d1e={};var _0x89c04={};var _0x2a63ac;var _0x365593;return db[_0x231e('0x33')][_0x231e('0x99')]({'where':{'id':_0xc5aa43['params']['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x3a5e7a,null))[_0x231e('0x10')](function(_0x11f8b2){if(_0x11f8b2){_0x2a63ac=_0x11f8b2;_0x89c04[_0x231e('0x4c')]=_[_0x231e('0x4e')](db[_0x231e('0xe3')]['rawAttributes']);_0x89c04[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0xc5aa43[_0x231e('0x3c')]);_0x89c04[_0x231e('0x50')]=_[_0x231e('0x51')](_0x89c04[_0x231e('0x4c')],_0x89c04[_0x231e('0x3c')]);_0x219d1e[_0x231e('0x41')]=_[_0x231e('0x51')](_0x89c04[_0x231e('0x4c')],qs[_0x231e('0x52')](_0xc5aa43['query']['fields']));_0x219d1e[_0x231e('0x41')]=_0x219d1e[_0x231e('0x41')][_0x231e('0x53')]?_0x219d1e[_0x231e('0x41')]:_0x89c04[_0x231e('0x4c')];_0x219d1e['order']=qs[_0x231e('0xcf')](_0xc5aa43[_0x231e('0x3c')][_0x231e('0xcf')]);_0x219d1e[_0x231e('0x3b')]=qs['filters'](_['pick'](_0xc5aa43[_0x231e('0x3c')],_0x89c04[_0x231e('0x50')]));if(_0xc5aa43[_0x231e('0x3c')][_0x231e('0x38')]){_0x219d1e[_0x231e('0x3b')]=_['merge'](_0x219d1e[_0x231e('0x3b')],{'$or':_[_0x231e('0x2b')](_0x219d1e[_0x231e('0x41')],function(_0x418037){var _0x299a72={};_0x299a72[_0x418037]={'$like':'%'+_0xc5aa43[_0x231e('0x3c')]['filter']+'%'};return _0x299a72;})});}_0x219d1e=_[_0x231e('0xd0')]({},_0x219d1e,_0xc5aa43[_0x231e('0x55')]);return _0x2a63ac['getOpenchannelInteractions'](_0x219d1e);}})[_0x231e('0x10')](function(_0xb13a8b){if(_0xb13a8b){_0x365593=_0xb13a8b[_0x231e('0x53')];if(!_0xc5aa43[_0x231e('0x3c')][_0x231e('0xd1')]('nolimit')){_0x219d1e[_0x231e('0x21')]=qs[_0x231e('0x21')](_0xc5aa43[_0x231e('0x3c')]['limit']);_0x219d1e[_0x231e('0x1f')]=qs['offset'](_0xc5aa43[_0x231e('0x3c')][_0x231e('0x1f')]);}return _0x2a63ac['getOpenchannelInteractions'](_0x219d1e);}})[_0x231e('0x10')](function(_0x55b679){if(_0x55b679){return _0x55b679?{'count':_0x365593,'rows':_0x55b679}:null;}})[_0x231e('0x10')](respondWithResult(_0x3a5e7a,null))[_0x231e('0x1a')](handleError(_0x3a5e7a,null));};exports['getMailInteractions']=function(_0x3625a7,_0x4fd150){var _0x37c7f6={'raw':!![],'where':{}};var _0x3119ad={};var _0x36fd62={'count':0x0,'rows':[]};return db[_0x231e('0x33')][_0x231e('0x99')]({'where':{'id':_0x3625a7[_0x231e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4fd150,null))[_0x231e('0x10')](function(_0x3363d7){if(_0x3363d7){_0x3119ad['model']=_[_0x231e('0x4e')](db[_0x231e('0xe4')]['rawAttributes']);_0x3119ad[_0x231e('0x3c')]=_['keys'](_0x3625a7[_0x231e('0x3c')]);_0x3119ad['filters']=_[_0x231e('0x51')](_0x3119ad['model'],_0x3119ad['query']);_0x37c7f6[_0x231e('0x41')]=_[_0x231e('0x51')](_0x3119ad[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x3625a7[_0x231e('0x3c')]['fields']));_0x37c7f6[_0x231e('0x41')]=_0x37c7f6[_0x231e('0x41')][_0x231e('0x53')]?_0x37c7f6['attributes']:_0x3119ad[_0x231e('0x4c')];if(!_0x3625a7[_0x231e('0x3c')][_0x231e('0xd1')](_0x231e('0xd9'))){_0x37c7f6['limit']=qs[_0x231e('0x21')](_0x3625a7['query'][_0x231e('0x21')]);_0x37c7f6['offset']=qs[_0x231e('0x1f')](_0x3625a7[_0x231e('0x3c')][_0x231e('0x1f')]);}_0x37c7f6[_0x231e('0xce')]=qs[_0x231e('0xcf')](_0x3625a7[_0x231e('0x3c')][_0x231e('0xcf')]);_0x37c7f6[_0x231e('0x3b')]=qs[_0x231e('0x50')](_[_0x231e('0xd6')](_0x3625a7['query'],_0x3119ad['filters']));_0x37c7f6[_0x231e('0x3b')]['UserId']=_0x3363d7['id'];if(_0x3625a7[_0x231e('0x3c')]['filter']){_0x37c7f6[_0x231e('0x3b')]=_[_0x231e('0xd0')](_0x37c7f6[_0x231e('0x3b')],{'$or':_['map'](_0x37c7f6['attributes'],function(_0x4f8f8d){var _0x1900af={};_0x1900af[_0x4f8f8d]={'$like':'%'+_0x3625a7[_0x231e('0x3c')][_0x231e('0x38')]+'%'};return _0x1900af;})});}_0x37c7f6=_['merge']({},_0x37c7f6,_0x3625a7[_0x231e('0x55')]);return db[_0x231e('0xe4')]['count']({'where':_0x37c7f6[_0x231e('0x3b')]})['then'](function(_0x4b3a34){_0x36fd62['count']=_0x4b3a34;if(_0x3625a7['query'][_0x231e('0x3d')]){_0x37c7f6[_0x231e('0x3e')]=[{'all':!![]}];}return db[_0x231e('0xe4')][_0x231e('0x43')](_0x37c7f6);})[_0x231e('0x10')](function(_0x49078b){_0x36fd62['rows']=_0x49078b;return _0x36fd62;});}})['then'](respondWithFilteredResult(_0x4fd150,_0x37c7f6))[_0x231e('0x1a')](handleError(_0x4fd150,null));};exports['getSmsInteractions']=function(_0xca040b,_0x3d6b93){var _0x33ce95={};var _0x4d4a6d={};var _0x27fcd7;var _0x372bce;return db[_0x231e('0x33')]['findOne']({'where':{'id':_0xca040b['params']['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x3d6b93,null))[_0x231e('0x10')](function(_0x3637d5){if(_0x3637d5){_0x27fcd7=_0x3637d5;_0x4d4a6d[_0x231e('0x4c')]=_[_0x231e('0x4e')](db[_0x231e('0xe5')][_0x231e('0x34')]);_0x4d4a6d[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0xca040b[_0x231e('0x3c')]);_0x4d4a6d[_0x231e('0x50')]=_[_0x231e('0x51')](_0x4d4a6d[_0x231e('0x4c')],_0x4d4a6d[_0x231e('0x3c')]);_0x33ce95[_0x231e('0x41')]=_[_0x231e('0x51')](_0x4d4a6d[_0x231e('0x4c')],qs['fields'](_0xca040b[_0x231e('0x3c')][_0x231e('0x52')]));_0x33ce95[_0x231e('0x41')]=_0x33ce95['attributes']['length']?_0x33ce95[_0x231e('0x41')]:_0x4d4a6d[_0x231e('0x4c')];_0x33ce95['order']=qs[_0x231e('0xcf')](_0xca040b[_0x231e('0x3c')][_0x231e('0xcf')]);_0x33ce95[_0x231e('0x3b')]=qs[_0x231e('0x50')](_['pick'](_0xca040b['query'],_0x4d4a6d[_0x231e('0x50')]));if(_0xca040b['query']['filter']){_0x33ce95['where']=_[_0x231e('0xd0')](_0x33ce95[_0x231e('0x3b')],{'$or':_['map'](_0x33ce95[_0x231e('0x41')],function(_0x1f4290){var _0x2402ab={};_0x2402ab[_0x1f4290]={'$like':'%'+_0xca040b['query'][_0x231e('0x38')]+'%'};return _0x2402ab;})});}_0x33ce95=_[_0x231e('0xd0')]({},_0x33ce95,_0xca040b['options']);return _0x27fcd7[_0x231e('0xe6')](_0x33ce95);}})[_0x231e('0x10')](function(_0x267ea9){if(_0x267ea9){_0x372bce=_0x267ea9[_0x231e('0x53')];if(!_0xca040b[_0x231e('0x3c')][_0x231e('0xd1')](_0x231e('0xd9'))){_0x33ce95[_0x231e('0x21')]=qs['limit'](_0xca040b[_0x231e('0x3c')]['limit']);_0x33ce95[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0xca040b[_0x231e('0x3c')][_0x231e('0x1f')]);}return _0x27fcd7['getSmsInteractions'](_0x33ce95);}})['then'](function(_0xa81d1b){if(_0xa81d1b){return _0xa81d1b?{'count':_0x372bce,'rows':_0xa81d1b}:null;}})[_0x231e('0x10')](respondWithResult(_0x3d6b93,null))['catch'](handleError(_0x3d6b93,null));};exports[_0x231e('0xe7')]=function(_0x1c2366,_0x470a71){var _0x439761={};var _0x45907a={};var _0x1de6a0;var _0x29d17b;return db[_0x231e('0x33')][_0x231e('0x99')]({'where':{'id':_0x1c2366[_0x231e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x470a71,null))[_0x231e('0x10')](function(_0x154f33){if(_0x154f33){_0x1de6a0=_0x154f33;_0x45907a[_0x231e('0x4c')]=_[_0x231e('0x4e')](db[_0x231e('0xe8')]['rawAttributes']);_0x45907a['query']=_[_0x231e('0x4e')](_0x1c2366[_0x231e('0x3c')]);_0x45907a['filters']=_['intersection'](_0x45907a[_0x231e('0x4c')],_0x45907a[_0x231e('0x3c')]);_0x439761[_0x231e('0x41')]=_[_0x231e('0x51')](_0x45907a['model'],qs[_0x231e('0x52')](_0x1c2366[_0x231e('0x3c')][_0x231e('0x52')]));_0x439761[_0x231e('0x41')]=_0x439761['attributes'][_0x231e('0x53')]?_0x439761[_0x231e('0x41')]:_0x45907a[_0x231e('0x4c')];_0x439761['order']=qs['sort'](_0x1c2366[_0x231e('0x3c')][_0x231e('0xcf')]);_0x439761[_0x231e('0x3b')]=qs['filters'](_['pick'](_0x1c2366['query'],_0x45907a[_0x231e('0x50')]));if(_0x1c2366[_0x231e('0x3c')][_0x231e('0x38')]){_0x439761[_0x231e('0x3b')]=_[_0x231e('0xd0')](_0x439761[_0x231e('0x3b')],{'$or':_['map'](_0x439761[_0x231e('0x41')],function(_0x14b41f){var _0x2c9f8a={};_0x2c9f8a[_0x14b41f]={'$like':'%'+_0x1c2366[_0x231e('0x3c')][_0x231e('0x38')]+'%'};return _0x2c9f8a;})});}_0x439761=_[_0x231e('0xd0')]({},_0x439761,_0x1c2366[_0x231e('0x55')]);return _0x1de6a0['getFaxInteractions'](_0x439761);}})[_0x231e('0x10')](function(_0x4598c8){if(_0x4598c8){_0x29d17b=_0x4598c8[_0x231e('0x53')];if(!_0x1c2366[_0x231e('0x3c')][_0x231e('0xd1')](_0x231e('0xd9'))){_0x439761['limit']=qs['limit'](_0x1c2366[_0x231e('0x3c')][_0x231e('0x21')]);_0x439761[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0x1c2366[_0x231e('0x3c')][_0x231e('0x1f')]);}return _0x1de6a0[_0x231e('0xe7')](_0x439761);}})[_0x231e('0x10')](function(_0x53c9e5){if(_0x53c9e5){return _0x53c9e5?{'count':_0x29d17b,'rows':_0x53c9e5}:null;}})['then'](respondWithResult(_0x470a71,null))[_0x231e('0x1a')](handleError(_0x470a71,null));};exports[_0x231e('0xe9')]=function(_0x4e2ea2,_0xbd5f5c){var _0xc79145={};var _0x352f5f={};var _0x50ad60;var _0x3b6766;return db['User'][_0x231e('0x99')]({'where':{'id':_0x4e2ea2['params']['id']}})['then'](handleEntityNotFound(_0xbd5f5c,null))[_0x231e('0x10')](function(_0x305dfc){if(_0x305dfc){_0x50ad60=_0x305dfc;_0x352f5f[_0x231e('0x4c')]=_['keys'](db['WhatsappInteraction'][_0x231e('0x34')]);_0x352f5f[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0x4e2ea2[_0x231e('0x3c')]);_0x352f5f[_0x231e('0x50')]=_['intersection'](_0x352f5f[_0x231e('0x4c')],_0x352f5f[_0x231e('0x3c')]);_0xc79145['attributes']=_[_0x231e('0x51')](_0x352f5f[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x4e2ea2[_0x231e('0x3c')][_0x231e('0x52')]));_0xc79145[_0x231e('0x41')]=_0xc79145[_0x231e('0x41')][_0x231e('0x53')]?_0xc79145['attributes']:_0x352f5f[_0x231e('0x4c')];_0xc79145[_0x231e('0xce')]=qs['sort'](_0x4e2ea2['query']['sort']);_0xc79145['where']=qs[_0x231e('0x50')](_[_0x231e('0xd6')](_0x4e2ea2[_0x231e('0x3c')],_0x352f5f[_0x231e('0x50')]));if(_0x4e2ea2[_0x231e('0x3c')][_0x231e('0x38')]){_0xc79145['where']=_[_0x231e('0xd0')](_0xc79145['where'],{'$or':_[_0x231e('0x2b')](_0xc79145[_0x231e('0x41')],function(_0x4f6373){var _0x1ba5e7={};_0x1ba5e7[_0x4f6373]={'$like':'%'+_0x4e2ea2[_0x231e('0x3c')][_0x231e('0x38')]+'%'};return _0x1ba5e7;})});}_0xc79145=_[_0x231e('0xd0')]({},_0xc79145,_0x4e2ea2[_0x231e('0x55')]);return _0x50ad60[_0x231e('0xe9')](_0xc79145);}})[_0x231e('0x10')](function(_0x5b99a6){if(_0x5b99a6){_0x3b6766=_0x5b99a6['length'];if(!_0x4e2ea2['query'][_0x231e('0xd1')](_0x231e('0xd9'))){_0xc79145[_0x231e('0x21')]=qs[_0x231e('0x21')](_0x4e2ea2[_0x231e('0x3c')][_0x231e('0x21')]);_0xc79145[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0x4e2ea2[_0x231e('0x3c')][_0x231e('0x1f')]);}return _0x50ad60[_0x231e('0xe9')](_0xc79145);}})[_0x231e('0x10')](function(_0x5e1573){if(_0x5e1573){return _0x5e1573?{'count':_0x3b6766,'rows':_0x5e1573}:null;}})[_0x231e('0x10')](respondWithResult(_0xbd5f5c,null))[_0x231e('0x1a')](handleError(_0xbd5f5c,null));};exports[_0x231e('0xea')]=function(_0x42b9ea,_0x3311f1,_0x3be262){var _0x29dd60;var _0x55c015;var _0x32504a;var _0x5f93f1=!_[_0x231e('0x67')](_0x42b9ea[_0x231e('0x4b')]['id'])?_0x42b9ea[_0x231e('0x4b')]['id']:!_[_0x231e('0x67')](_0x42b9ea['user']['id'])?_0x42b9ea[_0x231e('0x27')]['id']:null;return db['User']['find']({'where':{'id':_0x5f93f1,'role':{'$or':[_0x231e('0x25'),_0x231e('0x27'),_0x231e('0x28')]}},'attributes':['id','name','phone','mobile',_0x231e('0x2d'),_0x231e('0x61'),_0x231e('0xeb')]})['then'](function(_0x3c2960){if(_0x3c2960){if(_0x3c2960['role']==='agent'){_0x29dd60=_0x3c2960;if(_0x42b9ea[_0x231e('0x5c')][_0x231e('0xa3')]){_0x32504a=util[_0x231e('0xb2')](_0x231e('0xec'),_0x29dd60[_0x42b9ea[_0x231e('0x5c')][_0x231e('0xa3')]]);}else if(_0x42b9ea[_0x231e('0x5c')][_0x231e('0xed')]){_0x32504a=util[_0x231e('0xb2')](_0x231e('0xb3'),_0x42b9ea[_0x231e('0x5c')][_0x231e('0xed')]);}else{_0x32504a=util['format']('SIP/%s',_0x29dd60['name']);}socket['to'](util[_0x231e('0xb2')](_0x231e('0xee'),_0x29dd60[_0x231e('0x2e')]))['emit'](_0x231e('0xef'),{'user':{'id':_0x29dd60['id'],'name':_0x29dd60[_0x231e('0x2e')]},'ip':_0x42b9ea[_0x231e('0xf0')]['x-forwarded-for']||_0x42b9ea[_0x231e('0xf1')][_0x231e('0xf2')]||_0x42b9ea['socket'][_0x231e('0xf2')]||_0x42b9ea[_0x231e('0xf1')][_0x231e('0xf3')]['remoteAddress']});return db[_0x231e('0xb8')][_0x231e('0x24')]({'where':{'membername':_0x29dd60[_0x231e('0x2e')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x231e('0x93'))](_0x231e('0xf4'));}})[_0x231e('0x10')](function(){if(_0x29dd60){return _0x29dd60[_0x231e('0xf5')]({'raw':!![]});}})[_0x231e('0x10')](function(_0x340319){if(_0x29dd60){var _0x2e512a=[];if(_0x340319){_0x55c015=_0x340319;if(_0x55c015[_0x231e('0x53')]){for(var _0x47e750=0x0;_0x47e750<_0x55c015[_0x231e('0x53')];_0x47e750++){_0x2e512a[_0x231e('0x42')]({'membername':_0x29dd60[_0x231e('0x2e')],'UserId':_0x29dd60['id'],'queue_name':_0x55c015[_0x47e750]['name'],'VoiceQueueId':_0x55c015[_0x47e750]['id'],'interface':_0x32504a,'paused':_0x29dd60[_0x231e('0xeb')]||![],'penalty':_0x55c015[_0x47e750][_0x231e('0xf6')]||0x0});}return BPromise[_0x231e('0x8d')](_0x2e512a,function(_0xaee0f2){return db[_0x231e('0xb8')][_0x231e('0xb4')](_0xaee0f2);});}}}})[_0x231e('0x10')](function(){if(_0x29dd60){return db[_0x231e('0xf7')][_0x231e('0x43')]({'where':{'membername':_0x29dd60[_0x231e('0x2e')],'exitAt':null}});}})['then'](function(_0x18fb3e){if(_0x29dd60){var _0x463f9e=[];_0x18fb3e[_0x231e('0xf8')](function(_0x3ce4d1){_0x463f9e[_0x231e('0x42')](_0x3ce4d1[_0x231e('0x5b')]({'exitAt':moment()[_0x231e('0xb2')](_0x231e('0xf9'))}));});return BPromise[_0x231e('0x5a')](_0x463f9e);}})['then'](function(){if(_0x29dd60){var _0x4876a6=[];var _0x1aac93=[];var _0x4bfd4b=utils[_0x231e('0xfa')]();var _0x3c1e8a={'membername':_0x29dd60[_0x231e('0x2e')],'interface':_0x32504a,'enterAt':moment()[_0x231e('0xb2')](_0x231e('0xf9')),'role':_0x29dd60[_0x231e('0x2d')],'internal':_0x29dd60['internal']};_0x4bfd4b['forEach'](function(_0x303f57){_0x4876a6['push'](_['merge']({'channel':_0x303f57,'type':'LOGIN','data1':_0x42b9ea['body'][_0x231e('0xfb')],'data2':_0x32504a},_0x3c1e8a));if(_0x29dd60[_0x231e('0xeb')]){_0x1aac93['push'](_[_0x231e('0xd0')]({'channel':_0x303f57,'type':'PAUSE','data1':_0x231e('0xfc')},_0x3c1e8a));}});return db[_0x231e('0xf7')][_0x231e('0x8a')](_0x4876a6[_0x231e('0xcb')](_0x1aac93),{'individualHooks':!![]});}})['then'](function(){if(_0x29dd60){return _0x29dd60[_0x231e('0x5b')]({'online':!![],'lastLoginAt':moment()[_0x231e('0xb2')](_0x231e('0xf9')),'voicePause':_0x29dd60[_0x231e('0xeb')]||![],'mailPause':_0x29dd60[_0x231e('0xeb')]||![],'chatPause':_0x29dd60[_0x231e('0xeb')]||![],'faxPause':_0x29dd60[_0x231e('0xeb')]||![],'smsPause':_0x29dd60[_0x231e('0xeb')]||![],'openchannelPause':_0x29dd60[_0x231e('0xeb')]||![],'whatsappPause':_0x29dd60[_0x231e('0xeb')]||![],'pauseType':_0x29dd60[_0x231e('0xeb')]?_0x231e('0xfc'):null,'interface':_0x32504a,'lastPauseAt':moment()[_0x231e('0xb2')](_0x231e('0xf9'))});}})[_0x231e('0x10')](function(_0x2dd356){if(_0x42b9ea['isMiddleware']){return _0x3be262();}else{return BPromise['resolve'](_0x2dd356)[_0x231e('0x10')](respondWithResult(_0x3311f1,null));}})[_0x231e('0x1a')](handleError(_0x3311f1,null));};exports['logout']=function(_0x5668f7,_0x5524d0){var _0x5a8dce;return db['User'][_0x231e('0x56')]({'where':{'id':_0x5668f7[_0x231e('0x4b')]['id'],'role':_0x231e('0x28')},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x5524d0,null))[_0x231e('0x10')](function(_0x3a1480){if(_0x3a1480){_0x5a8dce=_0x3a1480;return db[_0x231e('0xb8')][_0x231e('0x24')]({'where':{'membername':_0x5a8dce[_0x231e('0x2e')]},'individualHooks':!![]});}})[_0x231e('0x10')](function(){return db[_0x231e('0xf7')][_0x231e('0x43')]({'where':{'membername':_0x5a8dce[_0x231e('0x2e')],'exitAt':null}});})[_0x231e('0x10')](function(_0x5bea64){var _0x4af905=[];_0x5bea64['forEach'](function(_0x30277c){_0x4af905[_0x231e('0x42')](_0x30277c[_0x231e('0x5b')]({'exitAt':moment()[_0x231e('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4af905);})['then'](function(){return _0x5a8dce[_0x231e('0x5b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x231e('0x10')](respondWithResult(_0x5524d0,null))['catch'](handleError(_0x5524d0,null));};exports['pause']=function(_0x15097c,_0xe34afb){var _0x5bcfff;return db[_0x231e('0xb8')][_0x231e('0x5b')]({'paused':0x1},{'where':{'UserId':_0x15097c[_0x231e('0x4b')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x231e('0x33')][_0x231e('0x56')]({'where':{'id':_0x15097c[_0x231e('0x4b')]['id'],'role':_0x231e('0x28')},'attributes':['id',_0x231e('0x2e'),'role',_0x231e('0x61'),_0x231e('0xa3')]});})['then'](handleEntityNotFound(_0xe34afb,null))[_0x231e('0x10')](function(_0x4263ad){if(_0x4263ad){_0x5bcfff=_0x4263ad;return respondWithRpcPromise('QueuePause',_0x231e('0xfd'),{'id':_0x5bcfff['id'],'name':_0x5bcfff[_0x231e('0x2e')],'pause':!![]});}})[_0x231e('0x10')](function(){if(_0x5bcfff){return db['MemberReport']['findAll']({'where':{'membername':_0x5bcfff[_0x231e('0x2e')],'type':'PAUSE','exitAt':null}});}})[_0x231e('0x10')](function(_0x78b874){if(_0x78b874[_0x231e('0x53')]){var _0x27304b=moment()['format'](_0x231e('0xf9'));for(var _0x583e64=0x0,_0x2c910f=_0x78b874[_0x231e('0x53')];_0x583e64<_0x2c910f;_0x583e64++){_0x78b874[_0x583e64][_0x231e('0xfe')]({'exitAt':_0x27304b});}}})[_0x231e('0x10')](function(){var _0x383a16=[];var _0x2d33d9=utils['getChannels']();_0x2d33d9[_0x231e('0xf8')](function(_0x3d5448){_0x383a16[_0x231e('0x42')]({'channel':_0x3d5448,'membername':_0x5bcfff[_0x231e('0x2e')],'interface':_[_0x231e('0x67')](_0x5bcfff[_0x231e('0xa3')])?util[_0x231e('0xb2')](_0x231e('0xb3'),_0x5bcfff[_0x231e('0x2e')]):_0x5bcfff[_0x231e('0xa3')],'type':_0x231e('0xff'),'enterAt':moment()['format'](_0x231e('0xf9')),'data1':_0x15097c[_0x231e('0x5c')][_0x231e('0x36')]||'DEFAULT\x20PAUSE','role':_0x5bcfff[_0x231e('0x2d')],'internal':_0x5bcfff[_0x231e('0x61')]});});return db[_0x231e('0xf7')]['bulkCreate'](_0x383a16,{'individualHooks':!![]});})['then'](function(){return _0x5bcfff[_0x231e('0x5b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x15097c[_0x231e('0x5c')][_0x231e('0x36')]||_0x231e('0x100'),'lastPauseAt':moment()['format'](_0x231e('0xf9'))});})[_0x231e('0x10')](respondWithResult(_0xe34afb,null))[_0x231e('0x1a')](handleError(_0xe34afb,null));};exports['unpause']=function(_0x32d314,_0x123530){var _0x1f94a9;return db[_0x231e('0x33')]['find']({'where':{'id':_0x32d314[_0x231e('0x4b')]['id']},'attributes':['id','name',_0x231e('0x2d'),_0x231e('0xa2'),_0x231e('0x101'),_0x231e('0x102'),_0x231e('0x103'),_0x231e('0x104'),_0x231e('0x105'),_0x231e('0x106'),_0x231e('0x107'),'lastPauseAt']})[_0x231e('0x10')](handleEntityNotFound(_0x123530,null))['then'](function(_0x311cc6){if(_0x311cc6){_0x1f94a9=_0x311cc6;if(_0x32d314['body']['channel']&&!utils['isValidChannel'](_0x32d314[_0x231e('0x5c')][_0x231e('0xa0')])){throw new db[(_0x231e('0x92'))][(_0x231e('0x93'))](_0x231e('0xa5'));}switch(_0x32d314[_0x231e('0x5c')]['channel']){case'voice':return respondWithRpcPromise(_0x231e('0x108'),_0x231e('0x109'),{'id':_0x1f94a9['id'],'name':_0x1f94a9[_0x231e('0x2e')],'pause':![]})[_0x231e('0x10')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x1f94a9['id']},'individualHooks':!![]});})[_0x231e('0x10')](function(){return db[_0x231e('0xf7')][_0x231e('0x56')]({'where':{'channel':_0x32d314[_0x231e('0x5c')]['channel'],'membername':_0x1f94a9[_0x231e('0x2e')],'type':'PAUSE','exitAt':null}});})[_0x231e('0x10')](function(_0x4a18e7){if(_0x4a18e7){return _0x4a18e7[_0x231e('0x5b')]({'exitAt':moment()[_0x231e('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x1f94a9[_0x231e('0x5b')]({'voicePause':![]});});case _0x231e('0x48'):case _0x231e('0x58'):case _0x231e('0x47'):case _0x231e('0x46'):case _0x231e('0x49'):case _0x231e('0x59'):return db[_0x231e('0xf7')][_0x231e('0x56')]({'where':{'channel':_0x32d314[_0x231e('0x5c')][_0x231e('0xa0')],'membername':_0x1f94a9[_0x231e('0x2e')],'type':_0x231e('0xff'),'exitAt':null}})[_0x231e('0x10')](function(_0x119022){if(_0x119022){return _0x119022[_0x231e('0x5b')]({'exitAt':moment()['format'](_0x231e('0xf9')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x231e('0x10')](function(){var _0x13697d={};_[_0x231e('0x10a')](_0x13697d,util[_0x231e('0xb2')](_0x231e('0x10b'),_0x32d314[_0x231e('0x5c')][_0x231e('0xa0')],_0x231e('0x10c')),![]);return _0x1f94a9[_0x231e('0x5b')](_0x13697d);});default:return respondWithRpcPromise('QueuePause',_0x231e('0x109'),{'id':_0x1f94a9['id'],'name':_0x1f94a9[_0x231e('0x2e')],'pause':![]})[_0x231e('0x10')](function(){return db[_0x231e('0xb8')][_0x231e('0x5b')]({'paused':0x0},{'where':{'UserId':_0x1f94a9['id']}});})[_0x231e('0x10')](function(){return db[_0x231e('0xf7')][_0x231e('0x43')]({'where':{'membername':_0x1f94a9[_0x231e('0x2e')],'type':_0x231e('0xff'),'exitAt':null}});})['then'](function(_0x5d211a){var _0x546937=[];_0x5d211a[_0x231e('0xf8')](function(_0x29e4d6){_0x546937[_0x231e('0x42')](_0x29e4d6['update']({'exitAt':moment()['format'](_0x231e('0xf9')),'data2':'manual'}));});return BPromise[_0x231e('0x5a')](_0x546937);})[_0x231e('0x10')](function(){return _0x1f94a9['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x123530,null))[_0x231e('0x1a')](handleError(_0x123530,null));};exports['getTeams']=function(_0x57f709,_0x4b201b){var _0x503ce0={};var _0x81ec19={};var _0x139dce;var _0x51b665;return db[_0x231e('0x33')][_0x231e('0x99')]({'where':{'id':_0x57f709['params']['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x4b201b,null))[_0x231e('0x10')](function(_0x5c0a33){if(_0x5c0a33){_0x139dce=_0x5c0a33;_0x81ec19[_0x231e('0x4c')]=_[_0x231e('0x4e')](db[_0x231e('0x10d')][_0x231e('0x34')]);_0x81ec19['query']=_['keys'](_0x57f709[_0x231e('0x3c')]);_0x81ec19[_0x231e('0x50')]=_[_0x231e('0x51')](_0x81ec19[_0x231e('0x4c')],_0x81ec19[_0x231e('0x3c')]);_0x503ce0['attributes']=_[_0x231e('0x51')](_0x81ec19[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x57f709[_0x231e('0x3c')][_0x231e('0x52')]));_0x503ce0[_0x231e('0x41')]=_0x503ce0['attributes'][_0x231e('0x53')]?_0x503ce0[_0x231e('0x41')]:_0x81ec19['model'];_0x503ce0[_0x231e('0xce')]=qs[_0x231e('0xcf')](_0x57f709['query']['sort']);_0x503ce0[_0x231e('0x3b')]=qs[_0x231e('0x50')](_[_0x231e('0xd6')](_0x57f709[_0x231e('0x3c')],_0x81ec19[_0x231e('0x50')]));if(_0x57f709[_0x231e('0x3c')][_0x231e('0x38')]){_0x503ce0[_0x231e('0x3b')]=_['merge'](_0x503ce0[_0x231e('0x3b')],{'$or':_[_0x231e('0x2b')](_0x503ce0[_0x231e('0x41')],function(_0x59eac9){var _0x46d64b={};_0x46d64b[_0x59eac9]={'$like':'%'+_0x57f709[_0x231e('0x3c')][_0x231e('0x38')]+'%'};return _0x46d64b;})});}_0x503ce0=_['merge']({},_0x503ce0,_0x57f709[_0x231e('0x55')]);return _0x139dce[_0x231e('0x10e')](_0x503ce0);}})[_0x231e('0x10')](function(_0x122b02){if(_0x122b02){_0x51b665=_0x122b02[_0x231e('0x53')];if(!_0x57f709['query'][_0x231e('0xd1')](_0x231e('0xd9'))){_0x503ce0['limit']=qs[_0x231e('0x21')](_0x57f709[_0x231e('0x3c')][_0x231e('0x21')]);_0x503ce0[_0x231e('0x1f')]=qs['offset'](_0x57f709[_0x231e('0x3c')][_0x231e('0x1f')]);}return _0x139dce['getTeams'](_0x503ce0);}})['then'](function(_0x2f87dd){if(_0x2f87dd){return _0x2f87dd?{'count':_0x51b665,'rows':_0x2f87dd}:null;}})[_0x231e('0x10')](respondWithResult(_0x4b201b,null))[_0x231e('0x1a')](handleError(_0x4b201b,null));};exports['addTeams']=function(_0x16b3cb,_0x7181aa){return db['User'][_0x231e('0x56')]({'where':{'id':_0x16b3cb[_0x231e('0x4b')]['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x7181aa,null))[_0x231e('0x10')](function(_0xd5300b){if(_0xd5300b){var _0x5b9e0a=_0xd5300b[_0x231e('0xb0')]({'plain':!![]});return _0xd5300b[_0x231e('0x10f')](_0x16b3cb[_0x231e('0x5c')]['ids'],_[_0x231e('0x60')](_0x16b3cb[_0x231e('0x5c')],[_0x231e('0x5f'),'id'])||{})['then'](function(){for(var _0x5a1ed0=0x0;_0x5a1ed0<_0x16b3cb[_0x231e('0x5c')][_0x231e('0x5f')][_0x231e('0x53')];_0x5a1ed0++){var _0x32bf1e=[];var _0x1e6af6={};db[_0x231e('0x10d')][_0x231e('0x99')]({'where':{'id':_0x16b3cb['body']['ids'][_0x5a1ed0]}})['then'](function(_0x39a780){_0x1e6af6=_0x39a780['dataValues'];_0x32bf1e[_0x231e('0x42')](_0x39a780[_0x231e('0xf5')]()[_0x231e('0x10')](function(_0x2efecf){for(var _0x31261b=0x0;_0x31261b<_0x2efecf[_0x231e('0x53')];_0x31261b++){_0x2efecf[_0x31261b][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x111'));}return _0x2efecf;}));_0x32bf1e[_0x231e('0x42')](_0x39a780[_0x231e('0x112')]()['then'](function(_0xafa40a){for(var _0x4a1f9c=0x0;_0x4a1f9c<_0xafa40a[_0x231e('0x53')];_0x4a1f9c++){_0xafa40a[_0x4a1f9c][_0x231e('0x110')]('channel',_0x231e('0x113'));}return _0xafa40a;}));_0x32bf1e['push'](_0x39a780[_0x231e('0x114')]()[_0x231e('0x10')](function(_0x39539d){for(var _0x4493d4=0x0;_0x4493d4<_0x39539d[_0x231e('0x53')];_0x4493d4++){_0x39539d[_0x4493d4][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x115'));}return _0x39539d;}));_0x32bf1e[_0x231e('0x42')](_0x39a780[_0x231e('0x116')]()[_0x231e('0x10')](function(_0x3c5c1e){for(var _0x2f7858=0x0;_0x2f7858<_0x3c5c1e[_0x231e('0x53')];_0x2f7858++){_0x3c5c1e[_0x2f7858][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x117'));}return _0x3c5c1e;}));_0x32bf1e[_0x231e('0x42')](_0x39a780[_0x231e('0x118')]()[_0x231e('0x10')](function(_0x181969){for(var _0x17ee1b=0x0;_0x17ee1b<_0x181969[_0x231e('0x53')];_0x17ee1b++){_0x181969[_0x17ee1b][_0x231e('0x110')](_0x231e('0xa0'),'Whatsapp');}return _0x181969;}));_0x32bf1e[_0x231e('0x42')](_0x39a780[_0x231e('0x119')]()[_0x231e('0x10')](function(_0x3b599f){for(var _0x528f19=0x0;_0x528f19<_0x3b599f[_0x231e('0x53')];_0x528f19++){_0x3b599f[_0x528f19][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x11a'));}return _0x3b599f;}));_0x32bf1e['push'](_0x39a780[_0x231e('0x11b')]()[_0x231e('0x10')](function(_0x21b447){for(var _0x1e8a03=0x0;_0x1e8a03<_0x21b447[_0x231e('0x53')];_0x1e8a03++){_0x21b447[_0x1e8a03][_0x231e('0x110')](_0x231e('0xa0'),'Openchannel');}return _0x21b447;}));return BPromise[_0x231e('0x5a')](_0x32bf1e);})['then'](function(_0x3ae27e){var _0x13b14c=_[_0x231e('0x11c')](_0x3ae27e);_0x32bf1e=[];return db[_0x231e('0x68')][_0x231e('0x11d')](function(_0x3fedbe){for(var _0x58ca00=0x0;_0x58ca00<_0x13b14c['length'];_0x58ca00++){_0x32bf1e[_0x231e('0x42')](_0x13b14c[_0x58ca00][_0x231e('0x11e')](_0x5b9e0a['id']),{'transaction':_0x3fedbe});}return BPromise[_0x231e('0x5a')](_0x32bf1e)[_0x231e('0x10')](function(){if(_0x5b9e0a[_0x231e('0xa1')]){return BPromise[_0x231e('0x8d')](_[_0x231e('0x38')](_0x13b14c,function(_0x11a231){return _0x11a231[_0x231e('0x11f')](_0x231e('0xa0'))==='Voice';}),function(_0x2b058e){return db[_0x231e('0xb8')][_0x231e('0xb4')]({'membername':_0x5b9e0a[_0x231e('0x2e')],'UserId':_0x5b9e0a['id'],'queue_name':_0x2b058e[_0x231e('0x2e')],'VoiceQueueId':_0x2b058e['id'],'interface':_[_0x231e('0x67')](_0x5b9e0a['interface'])?util['format'](_0x231e('0xb3'),_0x5b9e0a[_0x231e('0x2e')]):_0x5b9e0a[_0x231e('0xa3')],'paused':_0x5b9e0a[_0x231e('0xa2')]||![],'penalty':_0x5b9e0a['penalty']},{'transaction':_0x3fedbe});});}else{return;}})[_0x231e('0x10')](function(){for(var _0x16d8e2=0x0;_0x16d8e2<_0x13b14c[_0x231e('0x53')];_0x16d8e2++){var _0x85a612=_0x13b14c[_0x16d8e2][_0x231e('0x11f')](_0x231e('0xa0'));var _0x3fa7bd=_0x85a612+'QueueId';socket[_0x231e('0xad')](_0x231e('0x27')+_0x85a612+_0x231e('0xae'),{'UserId':_0x5b9e0a['id'],['queueField']:_0x13b14c[_0x16d8e2]['id']});}});});})[_0x231e('0x10')](function(){db[_0x231e('0x120')][_0x231e('0x99')]({'where':{'teamId':_0x1e6af6['id']}})[_0x231e('0x10')](function(_0x42aa46){if(_0x42aa46){db[_0x231e('0x121')][_0x231e('0x7e')]({'UserId':_0x16b3cb[_0x231e('0x4b')]['id'],'VoicePrefixId':_0x42aa46['VoicePrefixId']});}});});}});}})['then'](respondWithStatusCode(_0x7181aa,null))['catch'](handleError(_0x7181aa,null));};exports[_0x231e('0x122')]=function(_0x5cf58c,_0x59c8ef){return db['User']['findOne']({'where':{'id':_0x5cf58c[_0x231e('0x4b')]['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x59c8ef,null))[_0x231e('0x10')](function(_0x534e2d){if(_0x534e2d){var _0x534a5f=_0x534e2d[_0x231e('0xb0')]({'plain':!![]});var _0x162b63=_0x5cf58c['query'][_0x231e('0x5f')];return _0x534e2d[_0x231e('0x122')](_0x162b63)[_0x231e('0x10')](function(){for(var _0x4f797f=0x0;_0x4f797f<_0x162b63[_0x231e('0x53')];_0x4f797f++){var _0x117f03=[];var _0x1b45c5={};db['Team'][_0x231e('0x99')]({'where':{'id':_0x162b63[_0x4f797f]}})[_0x231e('0x10')](function(_0x12eb52){_0x1b45c5=_0x12eb52['dataValues'];_0x117f03[_0x231e('0x42')](_0x12eb52['getVoiceQueues']()['then'](function(_0x5364d4){for(var _0x2350e4=0x0;_0x2350e4<_0x5364d4[_0x231e('0x53')];_0x2350e4++){_0x5364d4[_0x2350e4][_0x231e('0x110')]('channel','Voice');}return _0x5364d4;}));_0x117f03[_0x231e('0x42')](_0x12eb52[_0x231e('0x112')]()[_0x231e('0x10')](function(_0x5762ca){for(var _0x4c2f26=0x0;_0x4c2f26<_0x5762ca[_0x231e('0x53')];_0x4c2f26++){_0x5762ca[_0x4c2f26][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x113'));}return _0x5762ca;}));_0x117f03[_0x231e('0x42')](_0x12eb52['getMailQueues']()[_0x231e('0x10')](function(_0x1fdf3c){for(var _0x381cdf=0x0;_0x381cdf<_0x1fdf3c[_0x231e('0x53')];_0x381cdf++){_0x1fdf3c[_0x381cdf]['setDataValue'](_0x231e('0xa0'),_0x231e('0x115'));}return _0x1fdf3c;}));_0x117f03[_0x231e('0x42')](_0x12eb52[_0x231e('0x116')]()[_0x231e('0x10')](function(_0x4c18f6){for(var _0x397b66=0x0;_0x397b66<_0x4c18f6['length'];_0x397b66++){_0x4c18f6[_0x397b66][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x117'));}return _0x4c18f6;}));_0x117f03[_0x231e('0x42')](_0x12eb52[_0x231e('0x118')]()[_0x231e('0x10')](function(_0x2c26bf){for(var _0x2cd5b9=0x0;_0x2cd5b9<_0x2c26bf[_0x231e('0x53')];_0x2cd5b9++){_0x2c26bf[_0x2cd5b9][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x123'));}return _0x2c26bf;}));_0x117f03[_0x231e('0x42')](_0x12eb52[_0x231e('0x119')]()[_0x231e('0x10')](function(_0x91a2c5){for(var _0x23cf77=0x0;_0x23cf77<_0x91a2c5[_0x231e('0x53')];_0x23cf77++){_0x91a2c5[_0x23cf77][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x11a'));}return _0x91a2c5;}));_0x117f03['push'](_0x12eb52[_0x231e('0x11b')]()[_0x231e('0x10')](function(_0x123e72){for(var _0x4c0f06=0x0;_0x4c0f06<_0x123e72[_0x231e('0x53')];_0x4c0f06++){_0x123e72[_0x4c0f06][_0x231e('0x110')](_0x231e('0xa0'),_0x231e('0x124'));}return _0x123e72;}));return BPromise[_0x231e('0x5a')](_0x117f03);})['then'](function(_0x549d8c){var _0x3c4f16=_['flatten'](_0x549d8c);_0x117f03=[];return db[_0x231e('0x68')][_0x231e('0x11d')](function(_0x5de2ac){for(var _0x572f9e=0x0;_0x572f9e<_0x3c4f16[_0x231e('0x53')];_0x572f9e++){_0x117f03[_0x231e('0x42')](_0x3c4f16[_0x572f9e][_0x231e('0x125')](_0x534a5f['id']),{'transaction':_0x5de2ac});}return BPromise[_0x231e('0x5a')](_0x117f03)['then'](function(){if(_0x534a5f['online']){return BPromise['each'](_['filter'](_0x3c4f16,function(_0x3e664e){return _0x3e664e[_0x231e('0x11f')](_0x231e('0xa0'))===_0x231e('0x111');}),function(_0x45f292){return db[_0x231e('0xb8')][_0x231e('0x24')]({'where':{'VoiceQueueId':_0x45f292['id'],'UserId':_0x534a5f['id']},'transaction':_0x5de2ac});});}else{return;}})['then'](function(){db[_0x231e('0x120')][_0x231e('0x99')]({'where':{'teamId':_0x1b45c5['id']}})['then'](function(_0x438448){if(_0x438448){return db[_0x231e('0x121')][_0x231e('0x24')]({'where':{'UserId':_0x534a5f['id'],'VoicePrefixId':_0x438448[_0x231e('0x45')]['VoicePrefixId']}});}});})[_0x231e('0x10')](function(){for(var _0x227115=0x0;_0x227115<_0x3c4f16['length'];_0x227115++){var _0x2262ee=_0x3c4f16[_0x227115][_0x231e('0x11f')](_0x231e('0xa0'));var _0x532f4d=_0x2262ee+_0x231e('0xac');socket[_0x231e('0xad')](_0x231e('0x27')+_0x2262ee+_0x231e('0xb7'),{'UserId':_0x534a5f['id'],['queueField']:_0x3c4f16[_0x227115]['id']});}});});});}});}})[_0x231e('0x10')](respondWithStatusCode(_0x59c8ef,null))[_0x231e('0x1a')](handleError(_0x59c8ef,null));};exports[_0x231e('0x126')]=function(_0xa147bc,_0x1ef62f){var _0x402acc={};var _0x53025f={};var _0xf9db34;var _0x1b75ac;return db[_0x231e('0x33')][_0x231e('0x99')]({'where':{'id':_0xa147bc[_0x231e('0x4b')]['id']}})[_0x231e('0x10')](handleEntityNotFound(_0x1ef62f,null))[_0x231e('0x10')](function(_0x4aac69){if(_0x4aac69){_0xf9db34=_0x4aac69;_0x53025f[_0x231e('0x4c')]=_[_0x231e('0x4e')](db[_0x231e('0x127')]['rawAttributes']);_0x53025f[_0x231e('0x3c')]=_[_0x231e('0x4e')](_0xa147bc[_0x231e('0x3c')]);_0x53025f[_0x231e('0x50')]=_[_0x231e('0x51')](_0x53025f['model'],_0x53025f[_0x231e('0x3c')]);_0x402acc['attributes']=_[_0x231e('0x51')](_0x53025f[_0x231e('0x4c')],qs[_0x231e('0x52')](_0xa147bc[_0x231e('0x3c')]['fields']));_0x402acc[_0x231e('0x41')]=_0x402acc['attributes'][_0x231e('0x53')]?_0x402acc[_0x231e('0x41')]:_0x53025f[_0x231e('0x4c')];_0x402acc[_0x231e('0xce')]=qs['sort'](_0xa147bc[_0x231e('0x3c')][_0x231e('0xcf')]);_0x402acc[_0x231e('0x3b')]=qs[_0x231e('0x50')](_[_0x231e('0xd6')](_0xa147bc[_0x231e('0x3c')],_0x53025f[_0x231e('0x50')]));if(_0xa147bc['query'][_0x231e('0x38')]){_0x402acc[_0x231e('0x3b')]=_['merge'](_0x402acc[_0x231e('0x3b')],{'$or':_[_0x231e('0x2b')](_0x402acc['attributes'],function(_0xed0de8){var _0x207594={};_0x207594[_0xed0de8]={'$like':'%'+_0xa147bc['query']['filter']+'%'};return _0x207594;})});}_0x402acc=_[_0x231e('0xd0')]({},_0x402acc,_0xa147bc[_0x231e('0x55')]);return _0xf9db34[_0x231e('0x126')](_0x402acc);}})[_0x231e('0x10')](function(_0x475c4a){if(_0x475c4a){_0x1b75ac=_0x475c4a['length'];if(!_0xa147bc['query'][_0x231e('0xd1')](_0x231e('0xd9'))){_0x402acc[_0x231e('0x21')]=qs['limit'](_0xa147bc[_0x231e('0x3c')][_0x231e('0x21')]);_0x402acc[_0x231e('0x1f')]=qs[_0x231e('0x1f')](_0xa147bc[_0x231e('0x3c')]['offset']);}return _0xf9db34['getLists'](_0x402acc);}})[_0x231e('0x10')](function(_0x117263){if(_0x117263){return _0x117263?{'count':_0x1b75ac,'rows':_0x117263}:null;}})[_0x231e('0x10')](respondWithResult(_0x1ef62f,null))['catch'](handleError(_0x1ef62f,null));};exports[_0x231e('0x128')]=function(_0x3757f0,_0x37ff8a){var _0x319718={};var _0x14adf6={};var _0x166619;return db[_0x231e('0x33')]['findOne']({'where':{'id':_0x3757f0[_0x231e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37ff8a,null))['then'](function(_0x2510b2){if(_0x2510b2){_0x166619=_0x2510b2;_0x14adf6['model']=_[_0x231e('0x4e')](db['User'][_0x231e('0x34')]);_0x14adf6['query']=_[_0x231e('0x4e')](_0x3757f0[_0x231e('0x3c')]);_0x14adf6[_0x231e('0x50')]=_[_0x231e('0x51')](_0x14adf6[_0x231e('0x4c')],_0x14adf6[_0x231e('0x3c')]);_0x319718['attributes']=_[_0x231e('0x51')](_0x14adf6[_0x231e('0x4c')],qs[_0x231e('0x52')](_0x3757f0[_0x231e('0x3c')][_0x231e('0x52')]));_0x319718[_0x231e('0x41')]=_0x319718[_0x231e('0x41')][_0x231e('0x53')]?_0x319718[_0x231e('0x41')]:_0x14adf6[_0x231e('0x4c')];_0x319718['order']=qs[_0x231e('0xcf')](_0x3757f0[_0x231e('0x3c')]['sort']);_0x319718['where']=qs['filters'](_[_0x231e('0xd6')](_0x3757f0[_0x231e('0x3c')],_0x14adf6[_0x231e('0x50')]));if(_0x3757f0['query'][_0x231e('0x38')]){_0x319718[_0x231e('0x3b')]=_[_0x231e('0xd0')](_0x319718[_0x231e('0x3b')],{'$or':_[_0x231e('0x2b')](_0x319718['attributes'],function(_0x3f153f){var _0x205ab6={};_0x205ab6[_0x3f153f]={'$like':'%'+_0x3757f0[_0x231e('0x3c')][_0x231e('0x38')]+'%'};return _0x205ab6;})});}_0x319718[_0x231e('0x4c')]=db[_0x231e('0x33')];_0x319718['as']='Agents';_0x319718=_['merge']({},_0x319718,_0x3757f0[_0x231e('0x55')]);return _0x166619['getVoiceQueues']({'include':[_0x319718]});}})['then'](function(_0x3d3a2e){if(_0x3d3a2e){var _0xbff556={},_0x273446=[];for(var _0x1b2dde=0x0;_0x1b2dde<_0x3d3a2e[_0x231e('0x53')];_0x1b2dde+=0x1){for(var _0x489a37=0x0,_0x1ccce5;_0x489a37<_0x3d3a2e[_0x1b2dde][_0x231e('0x86')]['length'];_0x489a37+=0x1){_0x1ccce5=_0x3d3a2e[_0x1b2dde][_0x231e('0x86')][_0x489a37][_0x231e('0xb0')]({'plain':!![]});_0xbff556[_0x1ccce5['id']]=_0x1ccce5;}}_0xbff556=_[_0x231e('0x129')](_0xbff556);for(var _0x39990c=qs[_0x231e('0x1f')](_0x3757f0[_0x231e('0x3c')][_0x231e('0x1f')]);_0x39990c<_0xbff556[_0x231e('0x53')]&&_0x273446[_0x231e('0x53')]=_0x5a7b3e){_0x2220d9=_0x5a7b3e;_0x2a55e0=0xc8;}else{_0x2a55e0=0xce;}_0x4e360f[_0xae63('0x1f')](_0x2a55e0);return _0x4e360f[_0xae63('0x25')](_0xae63('0x26'),_0x39173b+'-'+_0x2220d9+'/'+_0x5a7b3e)['json'](_0x23deeb);}return null;};}function saveUpdates(_0x7c85a5){return function(_0x4cc9ce){if(_0x4cc9ce){return _0x4cc9ce['update'](_0x7c85a5)['then'](function(_0x23c496){return _0x23c496;});}return null;};}function removeEntity(_0x1a06e6){return function(_0x41e7a7){if(_0x41e7a7){return _0x41e7a7[_0xae63('0x27')]()[_0xae63('0x28')](function(){var _0x2d2173=_0x41e7a7[_0xae63('0x29')]({'plain':!![]});if(_0x2d2173[_0xae63('0x2a')]===_0xae63('0x2b'))return;var _0x34c86b=[{'name':_0xae63('0x2c'),'value':_0xae63('0x2d'),'ignore':!![]},{'name':_0xae63('0x2e'),'value':_0xae63('0x2f'),'ignore':![]},{'name':'Telephones','value':_0xae63('0x30'),'ignore':![]}];var _0x23ffd2=_(_0x34c86b)[_0xae63('0x31')](_0xae63('0x32'))[_0xae63('0x33')](_0xae63('0x34'))[_0xae63('0x34')]();if(_[_0xae63('0x35')](_0x23ffd2,_0x2d2173[_0xae63('0x2a')])){return;}var _0x235f75=_[_0xae63('0x36')](_0x34c86b,['value',_0x2d2173[_0xae63('0x2a')]])[_0xae63('0x37')];return db[_0xae63('0x38')]['destroy']({'where':{'type':_0x235f75,'resourceId':_0x2d2173['id']}})[_0xae63('0x28')](function(){return _0x41e7a7;});})[_0xae63('0x28')](function(){_0x1a06e6[_0xae63('0x1f')](0xcc)[_0xae63('0x20')]();});}};}function handleEntityNotFound(_0x5c8ea7){return function(_0x37955e){if(!_0x37955e){_0x5c8ea7[_0xae63('0x1e')](0x194);}return _0x37955e;};}function handleError(_0x1640f9,_0x51a15b){_0x51a15b=_0x51a15b||0x1f4;return function(_0x18b533){logger[_0xae63('0x19')](_0x18b533[_0xae63('0x39')]);if(_0x18b533['name']){delete _0x18b533[_0xae63('0x37')];}_0x1640f9[_0xae63('0x1f')](_0x51a15b)['send'](_0x18b533);};}exports[_0xae63('0x3a')]=function(_0x1a3dfa,_0x34d961){var _0x2807ac={},_0x1a6a21={'count':0x0,'rows':[]};var _0x2325c4=_(db['User'][_0xae63('0x3b')])['map'](function(_0x291a76){return{'name':_0x291a76['fieldName'],'type':_0x291a76[_0xae63('0x3c')]['key']};})['filter'](function(_0x54827b){return!_['includes']([_0xae63('0x3d'),_0xae63('0x3e')],_0x54827b['name']);})[_0xae63('0x34')]();_0x2807ac=qs['getOptions'](_0x2325c4,_0x1a3dfa);var _0x4774ee={'where':_0x2807ac[_0xae63('0x3f')]};return db[_0xae63('0x40')]['count'](_0x4774ee)['then'](function(_0x25386b){_0x1a6a21[_0xae63('0x24')]=_0x25386b;if(_0x1a3dfa[_0xae63('0x41')][_0xae63('0x42')]){_0x2807ac['include']=[{'all':!![]}];}if(_0x1a3dfa[_0xae63('0x41')]['userSetting']===_0xae63('0x43')){_0x2807ac[_0xae63('0x44')]=[{'model':db[_0xae63('0x45')],'as':'userSetting'}];}if(!_[_0xae63('0x35')](_0x2807ac[_0xae63('0x46')],'id')){_0x2807ac[_0xae63('0x46')]['push']('id');}return db[_0xae63('0x40')][_0xae63('0x47')](_0x2807ac);})[_0xae63('0x28')](function(_0x426635){_0x1a6a21['rows']=_0x426635;if(_0x1a3dfa[_0xae63('0x41')][_0xae63('0x48')]===_0xae63('0x43')){var _0x490cf6=[];for(var _0x1f3705=0x0;_0x1f3705<_0x1a6a21[_0xae63('0x49')][_0xae63('0x4a')];_0x1f3705++){_0x490cf6['push'](get_open_tabs('chat',_0x1a6a21['rows'][_0x1f3705]['dataValues']));_0x490cf6[_0xae63('0x4b')](get_open_tabs('sms',_0x1a6a21[_0xae63('0x49')][_0x1f3705][_0xae63('0x4c')]));_0x490cf6[_0xae63('0x4b')](get_open_tabs(_0xae63('0x4d'),_0x1a6a21[_0xae63('0x49')][_0x1f3705]['dataValues']));_0x490cf6['push'](get_open_tabs(_0xae63('0x4e'),_0x1a6a21['rows'][_0x1f3705][_0xae63('0x4c')]));_0x490cf6[_0xae63('0x4b')](get_open_tabs(_0xae63('0x4f'),_0x1a6a21['rows'][_0x1f3705][_0xae63('0x4c')]));_0x490cf6['push'](get_open_tabs(_0xae63('0x50'),_0x1a6a21['rows'][_0x1f3705]['dataValues']));}return BPromise[_0xae63('0x51')](_0x490cf6)['then'](function(){return _0x1a6a21;});}else{return _0x1a6a21;}})['then'](respondWithFilteredResult(_0x34d961,_0x2807ac))[_0xae63('0x1d')](handleError(_0x34d961,null));};exports[_0xae63('0x52')]=function(_0x59d2e4,_0x4c7eab){var _0x53e219={'raw':![],'where':{'id':_0x59d2e4[_0xae63('0x53')]['id']}},_0x2739b6={};_0x2739b6[_0xae63('0x54')]=_[_0xae63('0x55')](_[_0xae63('0x56')](db[_0xae63('0x40')]['rawAttributes']),[_0xae63('0x3d'),'salt']);_0x2739b6[_0xae63('0x41')]=_[_0xae63('0x56')](_0x59d2e4['query']);_0x2739b6[_0xae63('0x57')]=_['intersection'](_0x2739b6[_0xae63('0x54')],_0x2739b6[_0xae63('0x41')]);_0x53e219[_0xae63('0x46')]=_['intersection'](_0x2739b6[_0xae63('0x54')],qs[_0xae63('0x58')](_0x59d2e4[_0xae63('0x41')][_0xae63('0x58')]));_0x53e219[_0xae63('0x46')]=_0x53e219[_0xae63('0x46')][_0xae63('0x4a')]?_0x53e219['attributes']:_0x2739b6[_0xae63('0x54')];if(_0x59d2e4[_0xae63('0x41')][_0xae63('0x42')]){_0x53e219[_0xae63('0x44')]=[{'all':!![]}];}if(_0x59d2e4[_0xae63('0x41')][_0xae63('0x59')]===_0xae63('0x43')){_0x53e219['include']=[{'model':db[_0xae63('0x45')],'as':_0xae63('0x59')}];}_0x53e219=_[_0xae63('0x5a')]({},_0x53e219,_0x59d2e4[_0xae63('0x5b')]);if(!_[_0xae63('0x35')](_0x53e219[_0xae63('0x46')],'id')){_0x53e219[_0xae63('0x46')][_0xae63('0x4b')]('id');}return db[_0xae63('0x40')][_0xae63('0x36')](_0x53e219)[_0xae63('0x28')](handleEntityNotFound(_0x4c7eab,null))[_0xae63('0x28')](function(_0x200223){var _0x1de562=[];values=_0x200223;if(_0x59d2e4[_0xae63('0x41')][_0xae63('0x48')]===_0xae63('0x43')){_0x1de562[_0xae63('0x4b')](get_open_tabs(_0xae63('0x5c'),_0x200223['dataValues']));_0x1de562[_0xae63('0x4b')](get_open_tabs(_0xae63('0x5d'),_0x200223[_0xae63('0x4c')]));_0x1de562[_0xae63('0x4b')](get_open_tabs(_0xae63('0x4f'),_0x200223[_0xae63('0x4c')]));_0x1de562['push'](get_open_tabs('whatsapp',_0x200223[_0xae63('0x4c')]));_0x1de562['push'](get_open_tabs('fax',_0x200223['dataValues']));_0x1de562[_0xae63('0x4b')](get_open_tabs('mail',_0x200223[_0xae63('0x4c')]));return BPromise['all'](_0x1de562);}else{return values;}})['then'](function(){return values;})[_0xae63('0x28')](respondWithResult(_0x4c7eab,null))[_0xae63('0x1d')](handleError(_0x4c7eab,null));};exports[_0xae63('0x5e')]=function(_0x103276,_0x4a9b98){if(_0x103276[_0xae63('0x5f')]['id']){delete _0x103276[_0xae63('0x5f')]['id'];}delete _0x103276[_0xae63('0x5f')]['role'];return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x103276['params']['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x4a9b98,null))['then'](saveUpdates(_0x103276[_0xae63('0x5f')],null))[_0xae63('0x28')](respondWithResult(_0x4a9b98,null))['catch'](handleError(_0x4a9b98,null));};exports[_0xae63('0x60')]=function(_0x5606d3,_0x12ac55){return db[_0xae63('0x40')]['describe']()[_0xae63('0x28')](respondWithResult(_0x12ac55,null))[_0xae63('0x1d')](handleError(_0x12ac55,null));};exports[_0xae63('0x61')]=function(_0x220ef2,_0x2a899c){return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x220ef2[_0xae63('0x53')]['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x2a899c,null))[_0xae63('0x28')](function(_0x30192c){if(_0x30192c){return _0x30192c[_0xae63('0x61')](_0x220ef2['body']['ids'],_[_0xae63('0x62')](_0x220ef2[_0xae63('0x5f')],[_0xae63('0x63'),'id'])||{});}})[_0xae63('0x28')](respondWithResult(_0x2a899c,null))[_0xae63('0x1d')](handleError(_0x2a899c,null));};function validateUser(_0xd264f5){return new BPromise(function(_0x517448,_0x3ff9b5){if(_0xd264f5['internal'])return _0x517448(_0xd264f5);return db[_0xae63('0x64')][_0xae63('0x65')](0x1)[_0xae63('0x28')](function(_0x1ad19d){if(_0x1ad19d['securePassword'])authService[_0xae63('0x66')](_0xd264f5['password']);db[_0xae63('0x40')][_0xae63('0x67')](_0xae63('0x68'))['then'](function(_0x23ccfd){if(_[_0xae63('0x69')](_0x23ccfd)){_0xd264f5[_0xae63('0x68')]=_0x1ad19d[_0xae63('0x6a')]||0x1;return;}if(_['isNil'](_0x1ad19d[_0xae63('0x6a')])||_0x1ad19d['min_internal']===_0x23ccfd){_0xd264f5[_0xae63('0x68')]=_0x23ccfd+0x1;return;}if(_0x1ad19d[_0xae63('0x6a')]>_0x23ccfd){_0xd264f5[_0xae63('0x68')]=_0x1ad19d[_0xae63('0x6a')];return;}return db['sequelize'][_0xae63('0x41')](_0xae63('0x6b'),{'type':db[_0xae63('0x6c')]['QueryTypes']['SELECT']})[_0xae63('0x28')](function(_0x24228f){if(_0x24228f&&_0x24228f[_0xae63('0x4a')]){for(var _0x38ad95=0x0,_0x19b5a7=_0x24228f[_0xae63('0x4a')];_0x38ad95<_0x19b5a7&&_[_0xae63('0x69')](_0xd264f5['internal']);_0x38ad95++){if(_0x1ad19d['min_internal']<=_0x24228f[_0x38ad95][_0xae63('0x6d')]){_0xd264f5['internal']=_0x24228f[_0x38ad95][_0xae63('0x6d')];}else if(_0x1ad19d[_0xae63('0x6a')]>_0x24228f[_0x38ad95]['from']&&_0x1ad19d['min_internal']<=_0x24228f[_0x38ad95]['to']){_0xd264f5[_0xae63('0x68')]=_0x1ad19d[_0xae63('0x6a')];}}}if(_['isNil'](_0xd264f5['internal'])){_0xd264f5[_0xae63('0x68')]=_0x23ccfd+0x1;}return _0x517448(_0xd264f5);});});})[_0xae63('0x1d')](function(_0x52765a){_0x3ff9b5(_0x52765a);});});}function updateUser(_0x2eb9f6){return new BPromise(function(_0x3aa280,_0x461078){try{if(_0x2eb9f6[_0xae63('0x6e')]){_0x2eb9f6['mailbox']=_0x2eb9f6[_0xae63('0x68')];_0x2eb9f6['VoiceMail']={'mailbox':_0x2eb9f6[_0xae63('0x68')],'password':_0x2eb9f6['password'],'fullname':_0x2eb9f6[_0xae63('0x6f')],'email':_0x2eb9f6['email']};}if(_0x2eb9f6[_0xae63('0x2a')]===_0xae63('0x2f')){if(!_0x2eb9f6['permissions'])_0x2eb9f6[_0xae63('0x70')]=[_0xae63('0x71'),_0xae63('0x72'),_0xae63('0x73'),_0xae63('0x74'),'110',_0xae63('0x75'),_0xae63('0x76'),_0xae63('0x77'),_0xae63('0x78'),_0xae63('0x79'),_0xae63('0x7a'),_0xae63('0x7b'),'111','114',_0xae63('0x7c')];}_0x3aa280(_0x2eb9f6);}catch(_0x5daed8){_0x461078(_0x5daed8);}});}exports[_0xae63('0x7d')]=function(_0xe1c27,_0x453e79){if(_0xe1c27[_0xae63('0x2d')][_0xae63('0x2a')]===_0xae63('0x2f'))throw new Error(_0xae63('0x7e'));if(_0xe1c27[_0xae63('0x5f')][_0xae63('0x2a')]==='user'&&_0xe1c27[_0xae63('0x2d')][_0xae63('0x2a')]!==_0xae63('0x2b')){throw new Error(_0xae63('0x7f'));}if(_0xe1c27['body'][_0xae63('0x2a')]===_0xae63('0x2b')&&_0xe1c27[_0xae63('0x2d')][_0xae63('0x2a')]!==_0xae63('0x2b')){throw new Error(_0xae63('0x80'));}return licenseUtil[_0xae63('0x81')]([_0xe1c27['body']])[_0xae63('0x28')](function(){return validateUser(_0xe1c27[_0xae63('0x5f')]);})[_0xae63('0x28')](function(_0x20b203){return updateUser(_0x20b203)[_0xae63('0x28')](function(_0x1694e0){if(_0x1694e0[_0xae63('0x2a')]===_0xae63('0x2b')){_0x1694e0['settingsEnabled']=_0xe1c27['user']['settingsEnabled'];delete _0x1694e0[_0xae63('0x82')];}return _0x1694e0;});})['then'](function(_0x920f80){return db[_0xae63('0x40')][_0xae63('0x7d')](_0x920f80,{'include':[{'model':db[_0xae63('0x83')],'as':_0xae63('0x83')}]});})[_0xae63('0x28')](function(_0xf94f7a){if(_0xe1c27[_0xae63('0x5f')][_0xae63('0x2a')]===_0xae63('0x2d'))return _0xf94f7a;if(_0xe1c27['user'][_0xae63('0x2a')]!==_0xae63('0x2d'))return _0xf94f7a;return db[_0xae63('0x84')][_0xae63('0x36')]({'where':{'name':_0xf94f7a[_0xae63('0x2a')]===_0xae63('0x2f')?'Agents':_0xae63('0x85'),'userProfileId':_0xe1c27[_0xae63('0x2d')][_0xae63('0x82')]},'raw':!![]})[_0xae63('0x28')](function(_0x2bb355){if(!_0x2bb355||_0x2bb355[_0xae63('0x86')]!=0x0)return _0xf94f7a;return db['UserProfileResource']['create']({'name':_0xf94f7a['name'],'resourceId':_0xf94f7a['id'],'type':_0x2bb355['name'],'sectionId':_0x2bb355['id']},{})[_0xae63('0x28')](function(){return _0xf94f7a;});})[_0xae63('0x1d')](function(_0x20ac66){logger['error'](_0xae63('0x87'),_0x20ac66);throw _0x20ac66;});})[_0xae63('0x28')](respondWithResult(_0x453e79,0xc9))[_0xae63('0x1d')](handleError(_0x453e79,null));};exports['bulkCreate']=function(_0x1fc598,_0x40935c){var _0x37d019=_0x1fc598[_0xae63('0x5f')];var _0x41ba85=[];if(_0x1fc598[_0xae63('0x2d')]['role']===_0xae63('0x2f'))throw new Error(_0xae63('0x7e'));if(_[_0xae63('0x88')](_0x37d019,[_0xae63('0x2a'),_0xae63('0x2d')])&&_0x1fc598[_0xae63('0x2d')][_0xae63('0x2a')]!==_0xae63('0x2b')){throw new Error(_0xae63('0x7f'));}if(_[_0xae63('0x88')](_0x37d019,['role',_0xae63('0x2b')])&&_0x1fc598['user'][_0xae63('0x2a')]!==_0xae63('0x2b')){throw new Error(_0xae63('0x89'));}return licenseUtil[_0xae63('0x81')](_0x37d019)[_0xae63('0x28')](function(){return validateUser(_0x37d019[0x0]);})[_0xae63('0x28')](function(){for(var _0xb988b3=0x1;_0xb988b3<_0x37d019[_0xae63('0x4a')];_0xb988b3++){var _0x5dbce4=_0x37d019[_0xb988b3-0x1][_0xae63('0x68')];if(!_0x37d019[_0xb988b3][_0xae63('0x68')])_0x37d019[_0xb988b3]['internal']=_0x5dbce4+0x1;_0x41ba85[_0xae63('0x4b')](validateUser(_0x37d019[_0xb988b3]));}return BPromise[_0xae63('0x51')](_0x41ba85);})['then'](function(){_0x41ba85=[];for(var _0x49873c=0x0;_0x49873c<_0x37d019[_0xae63('0x4a')];_0x49873c++){_0x41ba85[_0xae63('0x4b')](updateUser(_0x37d019[_0x49873c]));}return BPromise['all'](_0x41ba85);})['then'](function(){return BPromise[_0xae63('0x8a')](_0x37d019,function(_0x3b72f3){return db[_0xae63('0x40')]['create'](_0x3b72f3,{'include':[{'model':db[_0xae63('0x83')],'as':_0xae63('0x83')}]})[_0xae63('0x28')](function(_0x1b8abc){_0x3b72f3['id']=_0x1b8abc['id'];return _0x3b72f3;});});})[_0xae63('0x28')](function(_0x2a1e36){if(_0x1fc598['body'][_0xae63('0x2a')]==='user')return _0x2a1e36;if(_0x1fc598['user'][_0xae63('0x2a')]!=='user')return _0x2a1e36;var _0x5b598b=_[_0xae63('0x88')](_0x2a1e36,function(_0x2a2eba){return _0x2a2eba[_0xae63('0x2a')]==='agent'||_0x2a2eba['role']===_0xae63('0x30');});if(!_0x5b598b)return _0x2a1e36;return db[_0xae63('0x84')][_0xae63('0x47')]({'where':{'name':{'$or':['Agents',_0xae63('0x85')]},'userProfileId':_0x1fc598[_0xae63('0x2d')][_0xae63('0x82')]},'raw':!![]})[_0xae63('0x28')](function(_0x433ccc){if(_['isEmpty'](_0x433ccc)||!_[_0xae63('0x88')](_0x433ccc,['autoAssociation',0x0]))return _0x2a1e36;_0x41ba85=[];var _0x572a36=_(_0x433ccc)[_0xae63('0x33')](function(_0x342d11){if(_0x342d11[_0xae63('0x86')]===0x1)return;return _0x342d11[_0xae63('0x37')]===_0xae63('0x2e')?'agent':_0xae63('0x30');})[_0xae63('0x8b')]()[_0xae63('0x34')]();for(var _0x512332=0x0;_0x512332<_0x2a1e36[_0xae63('0x4a')];_0x512332++){if(!_[_0xae63('0x35')](_0x572a36,_0x2a1e36[_0x512332]['role']))return;var _0x5b3b6=_0x2a1e36[_0x512332][_0xae63('0x2a')]===_0xae63('0x2f')?_0xae63('0x2e'):_0xae63('0x85');_0x41ba85[_0xae63('0x4b')](db[_0xae63('0x38')][_0xae63('0x7d')]({'name':_0x2a1e36[_0x512332][_0xae63('0x37')],'resourceId':_0x2a1e36[_0x512332]['id'],'type':_0x5b3b6,'sectionId':_['find'](_0x433ccc,[_0xae63('0x37'),_0x5b3b6])['id']},{}));}return BPromise['all'](_0x41ba85);});})[_0xae63('0x28')](respondWithResult(_0x40935c,0xc9))[_0xae63('0x1d')](handleError(_0x40935c,null));};exports[_0xae63('0x8c')]=function(_0x449619,_0xb37309){if(_0x449619[_0xae63('0x5f')]['id']){delete _0x449619[_0xae63('0x5f')]['id'];}return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x449619['params']['id']}})['then'](function(_0x4775dc){if(!_0x4775dc)return null;if(_0x4775dc['id']===_0x449619['user']['id']){if(!_0x449619[_0xae63('0x5f')][_0xae63('0x8d')]||!_0x449619['body'][_0xae63('0x8e')]){throw new db[(_0xae63('0x8f'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4775dc[_0xae63('0x90')](_0x449619[_0xae63('0x5f')][_0xae63('0x8d')])){throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))](_0xae63('0x92'));}if(_0x449619[_0xae63('0x5f')]['oldPassword']===_0x449619[_0xae63('0x5f')][_0xae63('0x8e')]){throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))](_0xae63('0x93'));}}else if(_0x449619[_0xae63('0x2d')][_0xae63('0x2a')]===_0xae63('0x2b')){if(!_0x449619[_0xae63('0x5f')]['newPassword']){throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x449619[_0xae63('0x2d')][_0xae63('0x2a')]===_0xae63('0x2d')){if(!_0x449619['body'][_0xae63('0x8e')]){throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))](_0xae63('0x94'));}if(_0x4775dc['role']!==_0xae63('0x2f')){throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))](_0xae63('0x7e'));}}else{throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))](_0xae63('0x7e'));}return _0x4775dc;})['then'](handleEntityNotFound(_0xb37309,null))[_0xae63('0x28')](function(_0x44be14){return db[_0xae63('0x64')][_0xae63('0x95')]({'attributes':['id','securePassword',_0xae63('0x96'),'passwordHistoryLimit']})['then'](function(_0x1e1feb){if(_0x1e1feb[_0xae63('0x97')])authService['validatePasswordPattern'](_0x449619['body'][_0xae63('0x8e')]);if(!_0x1e1feb['enforcePasswordHistory']||!_0x44be14[_0xae63('0x98')])return _0x44be14;authService[_0xae63('0x99')](_0x449619['body']['newPassword'],_0x44be14['previousPasswords'],_0x1e1feb['passwordHistoryLimit']);return _0x44be14;})[_0xae63('0x28')](saveUpdates({'password':_0x449619['body'][_0xae63('0x8e')],'passwordResetAt':_0x449619[_0xae63('0x2d')]['id']==_0x449619[_0xae63('0x53')]['id']?moment():null,'previousPasswords':authService[_0xae63('0x9a')](_0x449619[_0xae63('0x5f')][_0xae63('0x8e')],_0x44be14['previousPasswords'])},null));})['then'](respondWithResult(_0xb37309,null))[_0xae63('0x1d')](handleError(_0xb37309,null));};exports[_0xae63('0x9b')]=function(_0x1ded57,_0x1ffff5){var _0xa21c1f=_0x1ded57[_0xae63('0x5f')][_0xae63('0x9c')];return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x1ded57[_0xae63('0x53')]['id']},'attributes':['id',_0xae63('0x37'),_0xae63('0x2a'),'online',_0xae63('0x9d'),_0xae63('0x9e'),'interface']})['then'](handleEntityNotFound(_0x1ffff5,null))[_0xae63('0x28')](function(_0x21f89){if(_0x21f89){if(!utils['isValidChannel'](_0xa21c1f)){throw new db['Sequelize'][(_0xae63('0x91'))](_0xae63('0x9f'));}return _0x21f89[_0xae63('0xa0')+_['capitalize'](_0xa21c1f[_0xae63('0xa1')]())+_0xae63('0xa2')](_0x1ded57[_0xae63('0x5f')][_0xae63('0x63')],{'penalty':_0x1ded57[_0xae63('0x5f')]['penalty']||0x0})['spread'](function(_0xa6bd38){for(var _0x4f9509=0x0;_0x4f9509<_0x1ded57[_0xae63('0x5f')][_0xae63('0x63')]['length'];_0x4f9509+=0x1){var _0x1863b0={'UserId':Number(_0x1ded57[_0xae63('0x53')]['id'])};_0x1863b0[_['capitalize'](_0xa21c1f['toLowerCase']())+'QueueId']=Number(_0x1ded57['body'][_0xae63('0x63')][_0x4f9509]);socket[_0xae63('0xa3')](_0xae63('0x2d')+_[_0xae63('0xa4')](_0xa21c1f[_0xae63('0xa1')]())+_0xae63('0xa5'),_0x1863b0);}return _0xa6bd38;})[_0xae63('0x28')](function(){if(_0xa21c1f===_0xae63('0xa6')){return db[_0xae63('0xa7')][_0xae63('0x47')]({'where':{'id':_0x1ded57[_0xae63('0x5f')]['ids']||[]},'raw':!![],'attributes':['id',_0xae63('0x37')]});}})['then'](function(_0x35d6be){var _0xa87e3=_0x21f89[_0xae63('0x29')]({'plain':!![]});var _0x414b44=[];if(_0xa21c1f===_0xae63('0xa6')&&_0xa87e3['role']==='agent'&&_0xa87e3[_0xae63('0xa8')]){for(var _0x16f473=0x0;_0x16f473<_0x35d6be[_0xae63('0x4a')];_0x16f473+=0x1){_0x414b44[_0xae63('0x4b')]({'membername':_0xa87e3[_0xae63('0x37')],'UserId':_0xa87e3['id'],'queue_name':_0x35d6be[_0x16f473]['name'],'VoiceQueueId':_0x35d6be[_0x16f473]['id'],'interface':_[_0xae63('0x69')](_0xa87e3[_0xae63('0xa9')])?util['format'](_0xae63('0xaa'),_0xa87e3[_0xae63('0x37')]):_0xa87e3[_0xae63('0xa9')],'paused':_0xa87e3[_0xae63('0x9e')]||![],'penalty':_0x1ded57[_0xae63('0x5f')][_0xae63('0xab')]||0x0});}return BPromise['each'](_0x414b44,function(_0xe59e49){return db['UserVoiceQueueRt'][_0xae63('0xac')](_0xe59e49);});}return _0x21f89;});}})[_0xae63('0x28')](respondWithStatusCode(_0x1ffff5,null))[_0xae63('0x1d')](handleError(_0x1ffff5,null));};exports['removeQueues']=function(_0x2edf81,_0x416191){var _0x3d1282,_0x44c2fa;return db[_0xae63('0x40')]['find']({'where':{'id':_0x2edf81[_0xae63('0x53')]['id']},'attributes':['id',_0xae63('0x37'),_0xae63('0x2a')]})['then'](handleEntityNotFound(_0x416191,null))[_0xae63('0x28')](function(_0x1f7aed){if(_0x1f7aed){_0x3d1282=_0x1f7aed;if(!_0x2edf81[_0xae63('0x41')][_0xae63('0x9c')]||!utils[_0xae63('0xad')](_0x2edf81[_0xae63('0x41')][_0xae63('0x9c')])){throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))]('Unknown\x20channel');}return _0x1f7aed[_0xae63('0xae')+_['capitalize'](_0x2edf81[_0xae63('0x41')][_0xae63('0x9c')][_0xae63('0xa1')]())+_0xae63('0xa2')](_0x2edf81[_0xae63('0x41')][_0xae63('0x63')]);}})[_0xae63('0x28')](function(_0x550e21){if(_[_0xae63('0xaf')](_0x2edf81[_0xae63('0x41')][_0xae63('0x63')])){for(var _0x102126=0x0;_0x102126<_0x2edf81[_0xae63('0x41')][_0xae63('0x63')][_0xae63('0x4a')];_0x102126+=0x1){_0x44c2fa={'UserId':Number(_0x2edf81[_0xae63('0x53')]['id'])};_0x44c2fa[_[_0xae63('0xa4')](_0x2edf81[_0xae63('0x41')][_0xae63('0x9c')][_0xae63('0xa1')]())+_0xae63('0xb0')]=Number(_0x2edf81[_0xae63('0x41')]['ids'][_0x102126]);socket[_0xae63('0xa3')](_0xae63('0x2d')+_[_0xae63('0xa4')](_0x2edf81[_0xae63('0x41')][_0xae63('0x9c')]['toLowerCase']())+_0xae63('0xb1'),_0x44c2fa);}}else{_0x44c2fa={'UserId':Number(_0x2edf81['params']['id'])};_0x44c2fa[_[_0xae63('0xa4')](_0x2edf81[_0xae63('0x41')][_0xae63('0x9c')]['toLowerCase']())+'QueueId']=Number(_0x2edf81[_0xae63('0x41')][_0xae63('0x63')]);socket[_0xae63('0xa3')](_0xae63('0x2d')+_[_0xae63('0xa4')](_0x2edf81[_0xae63('0x41')][_0xae63('0x9c')][_0xae63('0xa1')]())+_0xae63('0xb1'),_0x44c2fa);}return _0x550e21;})[_0xae63('0x28')](function(){if(_0x2edf81[_0xae63('0x41')][_0xae63('0x9c')]===_0xae63('0xa6')){return db['UserVoiceQueueRt'][_0xae63('0x27')]({'where':{'UserId':_0x2edf81[_0xae63('0x53')]['id'],'VoiceQueueId':_0x2edf81[_0xae63('0x41')][_0xae63('0x63')]},'individualHooks':!![]})[_0xae63('0x28')](function(){return _0x3d1282;});}return _0x3d1282;})[_0xae63('0x28')](respondWithStatusCode(_0x416191,null))[_0xae63('0x1d')](handleError(_0x416191,null));};exports[_0xae63('0xb2')]=function(_0x420558,_0x577eee){_0x420558[_0xae63('0x5f')]['userpic']=_0x420558['file'][_0xae63('0xb3')];return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x420558[_0xae63('0x53')]['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x577eee,null))[_0xae63('0x28')](saveUpdates(_0x420558[_0xae63('0x5f')],null))['then'](respondWithResult(_0x577eee,null))[_0xae63('0x1d')](handleError(_0x577eee,null));};exports[_0xae63('0xb4')]=function(_0x787a77,_0x50bc14){var _0x2e2e0b=path['join'](config[_0xae63('0xb5')],_0xae63('0xb6'));return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x787a77[_0xae63('0x53')]['id']},'attributes':['id',_0xae63('0xb7')],'raw':!![]})['then'](handleEntityNotFound(_0x50bc14,null))['then'](function(_0x3fe946){if(_0x3fe946){if(_[_0xae63('0x69')](_0x3fe946[_0xae63('0xb7')])){return _0x50bc14[_0xae63('0xb8')](_0x2e2e0b);}else{if(!fs[_0xae63('0xb9')](path[_0xae63('0xba')](config['root'],_0xae63('0xbb'),_0x3fe946[_0xae63('0xb7')]))){return _0x50bc14['download'](_0x2e2e0b);}return _0x50bc14[_0xae63('0xb8')](path[_0xae63('0xba')](config[_0xae63('0xb5')],'server/files/images/',_0x3fe946[_0xae63('0xb7')]));}}})[_0xae63('0x1d')](handleError(_0x50bc14,null));};exports[_0xae63('0xbc')]=function(_0x4957db,_0x5aa7bb){return db['User'][_0xae63('0x36')]({'where':{'id':_0x4957db['params']['id']},'attributes':['id']})[_0xae63('0x28')](handleEntityNotFound(_0x5aa7bb,null))[_0xae63('0x28')](function(_0x489509){var _0x5ca04a=[];values=_0x489509[_0xae63('0x4c')];_0x5ca04a['push'](get_open_tabs(_0xae63('0x5c'),_0x489509['dataValues']));_0x5ca04a['push'](get_open_tabs('sms',_0x489509[_0xae63('0x4c')]));_0x5ca04a['push'](get_open_tabs(_0xae63('0x4f'),_0x489509['dataValues']));_0x5ca04a['push'](get_open_tabs(_0xae63('0x50'),_0x489509[_0xae63('0x4c')]));_0x5ca04a[_0xae63('0x4b')](get_open_tabs('fax',_0x489509[_0xae63('0x4c')]));_0x5ca04a[_0xae63('0x4b')](get_open_tabs(_0xae63('0x4e'),_0x489509[_0xae63('0x4c')]));return BPromise[_0xae63('0x51')](_0x5ca04a);})[_0xae63('0x28')](function(_0x595258){if(_0x595258){var _0x21d175=_[_0xae63('0x33')](values[_0xae63('0xbd')],function(_0x49efc9){return{'channel':_0xae63('0xbe'),'id':_0x49efc9['id'],'createdAt':_0x49efc9['createdAt']};});var _0xc1663a=_['map'](values[_0xae63('0xbf')],function(_0x2261bf){return{'channel':'FAX','id':_0x2261bf['id'],'createdAt':_0x2261bf['createdAt']};});var _0x308113=_[_0xae63('0x33')](values['OpenchannelOpenTabs'],function(_0x3c509f){return{'channel':'OPENCHANNEL','id':_0x3c509f['id'],'createdAt':_0x3c509f[_0xae63('0xc0')]};});var _0x283846=_[_0xae63('0x33')](values[_0xae63('0xc1')],function(_0x4f71a3){return{'channel':_0xae63('0xc2'),'id':_0x4f71a3['id'],'createdAt':_0x4f71a3[_0xae63('0xc0')]};});var _0x3aff4c=_[_0xae63('0x33')](values[_0xae63('0xc3')],function(_0x5a3142){return{'channel':'SMS','id':_0x5a3142['id'],'createdAt':_0x5a3142[_0xae63('0xc0')]};});var _0x524fc2=_[_0xae63('0x33')](values['WhatsappOpenTabs'],function(_0x252c2e){return{'channel':_0xae63('0xc4'),'id':_0x252c2e['id'],'createdAt':_0x252c2e[_0xae63('0xc0')]};});var _0x7c8e5d=_['concat'](_0x21d175,_0xc1663a,_0x308113,_0x283846,_0x3aff4c,_0x524fc2);var _0x2bc916={'count':_0x7c8e5d['length'],'rows':_0x7c8e5d};return _0x2bc916;}else return null;})[_0xae63('0x28')](respondWithResult(_0x5aa7bb,null))[_0xae63('0x1d')](handleError(_0x5aa7bb,null));};exports['getContacts']=function(_0x342d07,_0x2433ec){var _0x5ef7d2={};var _0x112f7f={};var _0x19e791;var _0x10ba4d;return db[_0xae63('0x40')]['findOne']({'where':{'id':_0x342d07['params']['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x2433ec,null))['then'](function(_0x5dde93){if(_0x5dde93){_0x19e791=_0x5dde93;_0x112f7f['model']=_[_0xae63('0x56')](db[_0xae63('0xc5')][_0xae63('0x3b')]);_0x112f7f[_0xae63('0x41')]=_[_0xae63('0x56')](_0x342d07['query']);_0x112f7f[_0xae63('0x57')]=_[_0xae63('0xc6')](_0x112f7f[_0xae63('0x54')],_0x112f7f[_0xae63('0x41')]);_0x5ef7d2[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x112f7f[_0xae63('0x54')],qs['fields'](_0x342d07[_0xae63('0x41')]['fields']));_0x5ef7d2['attributes']=_0x5ef7d2['attributes']['length']?_0x5ef7d2[_0xae63('0x46')]:_0x112f7f[_0xae63('0x54')];_0x5ef7d2[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x342d07[_0xae63('0x41')]['sort']);_0x5ef7d2[_0xae63('0x3f')]=qs['filters'](_[_0xae63('0xc9')](_0x342d07[_0xae63('0x41')],_0x112f7f[_0xae63('0x57')]));if(_0x342d07['query']['filter']){_0x5ef7d2['where']=_[_0xae63('0x5a')](_0x5ef7d2['where'],{'$or':_[_0xae63('0x33')](_0x5ef7d2[_0xae63('0x46')],function(_0x2d799b){var _0x1892b6={};_0x1892b6[_0x2d799b]={'$like':'%'+_0x342d07[_0xae63('0x41')][_0xae63('0x31')]+'%'};return _0x1892b6;})});}_0x5ef7d2=_[_0xae63('0x5a')]({},_0x5ef7d2,_0x342d07[_0xae63('0x5b')]);return _0x19e791[_0xae63('0xca')](_0x5ef7d2);}})[_0xae63('0x28')](function(_0x5500e6){if(_0x5500e6){_0x10ba4d=_0x5500e6[_0xae63('0x4a')];if(_0x342d07['query'][_0xae63('0xcb')](_0xae63('0x42'))){_0x5ef7d2[_0xae63('0x44')]=[{'model':db[_0xae63('0xcc')],'as':_0xae63('0xcd'),'required':![]},{'model':db[_0xae63('0xce')],'as':_0xae63('0xcf'),'attributes':['id','name','color'],'where':_0x342d07[_0xae63('0x41')][_0xae63('0xd0')]?{'id':_0x342d07['query'][_0xae63('0xd0')]}:undefined,'required':_0x342d07['query']['tag']?!![]:![]}];}if(!_0x342d07[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x5ef7d2[_0xae63('0x23')]=qs['limit'](_0x342d07[_0xae63('0x41')][_0xae63('0x23')]);_0x5ef7d2[_0xae63('0x22')]=qs['offset'](_0x342d07['query'][_0xae63('0x22')]);}return _0x19e791[_0xae63('0xca')](_0x5ef7d2);}})[_0xae63('0x28')](function(_0x5c3609){if(_0x5c3609){return _0x5c3609?{'count':_0x10ba4d,'rows':_0x5c3609}:null;}})['then'](respondWithResult(_0x2433ec,null))['catch'](handleError(_0x2433ec,null));};exports['getQueues']=function(_0x355086,_0x552455){var _0x1cd1f1;var _0x8172ef={};var _0x3a8d08;return db[_0xae63('0x40')][_0xae63('0x95')]({'where':{'id':_0x355086['params']['id']},'attributes':['id',_0xae63('0x37'),_0xae63('0x2a')]})[_0xae63('0x28')](handleEntityNotFound(_0x552455,null))['then'](function(_0x5d161c){if(!utils['isValidChannel'](_0x355086[_0xae63('0x41')][_0xae63('0x9c')])){throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))](_0xae63('0x9f'));}_0x1cd1f1=_0x5d161c;var _0x40af6c={};_0x40af6c[_0xae63('0x54')]=_[_0xae63('0x56')](db[_[_0xae63('0xa4')](_0x355086[_0xae63('0x41')][_0xae63('0x9c')])+_0xae63('0xd2')]['rawAttributes']);_0x40af6c[_0xae63('0x41')]=_[_0xae63('0x56')](_0x355086[_0xae63('0x41')]);_0x40af6c[_0xae63('0x57')]=_[_0xae63('0xc6')](_0x40af6c[_0xae63('0x54')],_0x40af6c[_0xae63('0x41')]);_0x8172ef[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x40af6c[_0xae63('0x54')],qs['fields'](_0x355086[_0xae63('0x41')]['fields']));_0x8172ef[_0xae63('0x46')]=_0x8172ef[_0xae63('0x46')]['length']?_0x8172ef[_0xae63('0x46')]:_0x40af6c['model'];_0x8172ef[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x355086['query']['sort']);_0x8172ef[_0xae63('0x3f')]=qs[_0xae63('0x57')](_['pick'](_0x355086[_0xae63('0x41')],_0x40af6c[_0xae63('0x57')]));if(_0x355086[_0xae63('0x41')][_0xae63('0x31')]){_0x8172ef[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x8172ef[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x8172ef[_0xae63('0x46')],function(_0xfecbed){var _0x1d6bcc={};_0x1d6bcc[_0xfecbed]={'$like':'%'+_0x355086[_0xae63('0x41')][_0xae63('0x31')]+'%'};return _0x1d6bcc;})});}_0x8172ef=_[_0xae63('0x5a')]({},_0x8172ef,_0x355086[_0xae63('0x5b')]);switch(_0x1cd1f1['role']){case'admin':return db[_['capitalize'](_0x355086[_0xae63('0x41')][_0xae63('0x9c')])+_0xae63('0xd2')]['findAll'](_0x8172ef);case _0xae63('0x2d'):case _0xae63('0x2f'):return _0x1cd1f1['get'+_[_0xae63('0xa4')](_0x355086[_0xae63('0x41')][_0xae63('0x9c')])+'Queues'](_0x8172ef);default:throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))](_0xae63('0xd3'));}})[_0xae63('0x28')](function(_0x4bfd5c){_0x3a8d08=_0x4bfd5c[_0xae63('0x4a')];if(!_0x355086['query'][_0xae63('0xcb')](_0xae63('0xd1'))){_0x8172ef[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x355086[_0xae63('0x41')][_0xae63('0x23')]);_0x8172ef[_0xae63('0x22')]=qs[_0xae63('0x22')](_0x355086['query'][_0xae63('0x22')]);}switch(_0x1cd1f1[_0xae63('0x2a')]){case'admin':return db[_[_0xae63('0xa4')](_0x355086['query']['channel'])+_0xae63('0xd2')]['findAll'](_0x8172ef);case'user':case'agent':return _0x1cd1f1[_0xae63('0x29')+_[_0xae63('0xa4')](_0x355086[_0xae63('0x41')]['channel'])+_0xae63('0xa2')](_0x8172ef);}})[_0xae63('0x28')](function(_0x358fe3){return{'count':_0x3a8d08,'rows':_0x358fe3};})['then'](respondWithResult(_0x552455,null))[_0xae63('0x1d')](handleError(_0x552455,null));};exports['getVoiceQueuesRt']=function(_0x86339b,_0xa14047){var _0x167977={};var _0x23fe4a={};var _0xc3d8fe;var _0x47e616;return db[_0xae63('0x40')]['findOne']({'where':{'id':_0x86339b[_0xae63('0x53')]['id']}})['then'](handleEntityNotFound(_0xa14047,null))['then'](function(_0x48041b){if(_0x48041b){_0xc3d8fe=_0x48041b;_0x23fe4a[_0xae63('0x54')]=_[_0xae63('0x56')](db[_0xae63('0xd4')]['rawAttributes']);_0x23fe4a['query']=_[_0xae63('0x56')](_0x86339b['query']);_0x23fe4a[_0xae63('0x57')]=_[_0xae63('0xc6')](_0x23fe4a[_0xae63('0x54')],_0x23fe4a[_0xae63('0x41')]);_0x167977[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x23fe4a[_0xae63('0x54')],qs[_0xae63('0x58')](_0x86339b[_0xae63('0x41')]['fields']));_0x167977[_0xae63('0x46')]=_0x167977[_0xae63('0x46')][_0xae63('0x4a')]?_0x167977['attributes']:_0x23fe4a['model'];_0x167977['order']=qs['sort'](_0x86339b['query'][_0xae63('0xc8')]);_0x167977[_0xae63('0x3f')]=qs['filters'](_[_0xae63('0xc9')](_0x86339b[_0xae63('0x41')],_0x23fe4a['filters']));if(_0x86339b[_0xae63('0x41')]['filter']){_0x167977[_0xae63('0x3f')]=_['merge'](_0x167977[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x167977[_0xae63('0x46')],function(_0x202ddb){var _0xe20604={};_0xe20604[_0x202ddb]={'$like':'%'+_0x86339b[_0xae63('0x41')][_0xae63('0x31')]+'%'};return _0xe20604;})});}_0x167977=_[_0xae63('0x5a')]({},_0x167977,_0x86339b[_0xae63('0x5b')]);return _0xc3d8fe[_0xae63('0xd5')](_0x167977);}})[_0xae63('0x28')](function(_0xb435c4){if(_0xb435c4){_0x47e616=_0xb435c4[_0xae63('0x4a')];if(!_0x86339b[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x167977[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x86339b[_0xae63('0x41')][_0xae63('0x23')]);_0x167977[_0xae63('0x22')]=qs['offset'](_0x86339b[_0xae63('0x41')][_0xae63('0x22')]);}return _0xc3d8fe[_0xae63('0xd5')](_0x167977);}})[_0xae63('0x28')](function(_0x466203){if(_0x466203){return _0x466203?{'count':_0x47e616,'rows':_0x466203}:null;}})[_0xae63('0x28')](respondWithResult(_0xa14047,null))[_0xae63('0x1d')](handleError(_0xa14047,null));};exports[_0xae63('0xd6')]=function(_0x4e420f,_0x2edd1e){var _0x3ae4b3={};var _0x45a6fb={};var _0x35a4a8;var _0xb1749c;return db[_0xae63('0x40')]['findOne']({'where':{'id':_0x4e420f[_0xae63('0x53')]['id']}})['then'](handleEntityNotFound(_0x2edd1e,null))[_0xae63('0x28')](function(_0x3ae5c6){if(_0x3ae5c6){_0x35a4a8=_0x3ae5c6;_0x45a6fb[_0xae63('0x54')]=_['keys'](db[_0xae63('0xd7')]['rawAttributes']);_0x45a6fb[_0xae63('0x41')]=_['keys'](_0x4e420f['query']);_0x45a6fb['filters']=_[_0xae63('0xc6')](_0x45a6fb[_0xae63('0x54')],_0x45a6fb[_0xae63('0x41')]);_0x3ae4b3[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x45a6fb[_0xae63('0x54')],qs['fields'](_0x4e420f[_0xae63('0x41')][_0xae63('0x58')]));_0x3ae4b3[_0xae63('0x46')]=_0x3ae4b3[_0xae63('0x46')][_0xae63('0x4a')]?_0x3ae4b3['attributes']:_0x45a6fb[_0xae63('0x54')];_0x3ae4b3[_0xae63('0xc7')]=qs['sort'](_0x4e420f[_0xae63('0x41')][_0xae63('0xc8')]);_0x3ae4b3[_0xae63('0x3f')]=qs[_0xae63('0x57')](_['pick'](_0x4e420f['query'],_0x45a6fb[_0xae63('0x57')]));if(_0x4e420f[_0xae63('0x41')][_0xae63('0x31')]){_0x3ae4b3[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x3ae4b3[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x3ae4b3['attributes'],function(_0x546459){var _0x31327e={};_0x31327e[_0x546459]={'$like':'%'+_0x4e420f[_0xae63('0x41')][_0xae63('0x31')]+'%'};return _0x31327e;})});}_0x3ae4b3=_[_0xae63('0x5a')]({},_0x3ae4b3,_0x4e420f['options']);return _0x35a4a8[_0xae63('0xd6')](_0x3ae4b3);}})['then'](function(_0x703807){if(_0x703807){_0xb1749c=_0x703807[_0xae63('0x4a')];if(!_0x4e420f[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x3ae4b3[_0xae63('0x23')]=qs['limit'](_0x4e420f[_0xae63('0x41')][_0xae63('0x23')]);_0x3ae4b3[_0xae63('0x22')]=qs[_0xae63('0x22')](_0x4e420f['query']['offset']);}return _0x35a4a8[_0xae63('0xd6')](_0x3ae4b3);}})[_0xae63('0x28')](function(_0x51d13c){if(_0x51d13c){return _0x51d13c?{'count':_0xb1749c,'rows':_0x51d13c}:null;}})[_0xae63('0x28')](respondWithResult(_0x2edd1e,null))['catch'](handleError(_0x2edd1e,null));};exports[_0xae63('0xd8')]=function(_0x1d773f,_0x54f488){var _0x3daf0c={'raw':!![],'where':{}};var _0x4112d7={};var _0x4785e0={'count':0x0,'rows':[]};return db[_0xae63('0x40')][_0xae63('0x95')]({'where':{'id':_0x1d773f[_0xae63('0x53')]['id']}})['then'](handleEntityNotFound(_0x54f488,null))[_0xae63('0x28')](function(_0x3cf5a6){if(_0x3cf5a6){_0x4112d7[_0xae63('0x54')]=_['keys'](db[_0xae63('0xd9')][_0xae63('0x3b')]);_0x4112d7[_0xae63('0x41')]=_[_0xae63('0x56')](_0x1d773f[_0xae63('0x41')]);_0x4112d7['filters']=_[_0xae63('0xc6')](_0x4112d7['model'],_0x4112d7[_0xae63('0x41')]);_0x3daf0c[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x4112d7[_0xae63('0x54')],qs[_0xae63('0x58')](_0x1d773f[_0xae63('0x41')][_0xae63('0x58')]));_0x3daf0c['attributes']=_0x3daf0c[_0xae63('0x46')][_0xae63('0x4a')]?_0x3daf0c['attributes']:_0x4112d7[_0xae63('0x54')];if(!_0x1d773f[_0xae63('0x41')]['hasOwnProperty']('nolimit')){_0x3daf0c[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x1d773f[_0xae63('0x41')][_0xae63('0x23')]);_0x3daf0c[_0xae63('0x22')]=qs[_0xae63('0x22')](_0x1d773f[_0xae63('0x41')]['offset']);}_0x3daf0c['order']=qs[_0xae63('0xc8')](_0x1d773f[_0xae63('0x41')][_0xae63('0xc8')]);_0x3daf0c[_0xae63('0x3f')]=qs[_0xae63('0x57')](_['pick'](_0x1d773f[_0xae63('0x41')],_0x4112d7[_0xae63('0x57')]));_0x3daf0c[_0xae63('0x3f')][_0xae63('0xda')]=_0x3cf5a6['id'];if(_0x1d773f[_0xae63('0x41')]['filter']){_0x3daf0c[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x3daf0c[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x3daf0c[_0xae63('0x46')],function(_0x51a8a0){var _0x435b82={};_0x435b82[_0x51a8a0]={'$like':'%'+_0x1d773f[_0xae63('0x41')][_0xae63('0x31')]+'%'};return _0x435b82;})});}_0x3daf0c=_[_0xae63('0x5a')]({},_0x3daf0c,_0x1d773f[_0xae63('0x5b')]);return db[_0xae63('0xd9')][_0xae63('0x24')]({'where':_0x3daf0c['where']})[_0xae63('0x28')](function(_0x2c6d0e){_0x4785e0['count']=_0x2c6d0e;if(_0x1d773f[_0xae63('0x41')][_0xae63('0x42')]){_0x3daf0c[_0xae63('0x44')]=[{'all':!![]}];}return db[_0xae63('0xd9')][_0xae63('0x47')](_0x3daf0c);})[_0xae63('0x28')](function(_0x2ec61c){_0x4785e0[_0xae63('0x49')]=_0x2ec61c;return _0x4785e0;});}})['then'](respondWithFilteredResult(_0x54f488,_0x3daf0c))[_0xae63('0x1d')](handleError(_0x54f488,null));};exports[_0xae63('0xdb')]=function(_0xb4efc9,_0x33ac25){var _0x3cc946={'raw':!![],'where':{}};var _0x22eee3={};var _0x11cb5b={'count':0x0,'rows':[]};return db[_0xae63('0x40')][_0xae63('0x95')]({'where':{'id':_0xb4efc9[_0xae63('0x53')]['id']}})['then'](handleEntityNotFound(_0x33ac25,null))[_0xae63('0x28')](function(_0x221ab5){if(_0x221ab5){_0x22eee3[_0xae63('0x54')]=_[_0xae63('0x56')](db['ScreenRecording'][_0xae63('0x3b')]);_0x22eee3['query']=_['keys'](_0xb4efc9[_0xae63('0x41')]);_0x22eee3['filters']=_[_0xae63('0xc6')](_0x22eee3[_0xae63('0x54')],_0x22eee3[_0xae63('0x41')]);_0x3cc946[_0xae63('0x46')]=_['intersection'](_0x22eee3['model'],qs[_0xae63('0x58')](_0xb4efc9[_0xae63('0x41')][_0xae63('0x58')]));_0x3cc946[_0xae63('0x46')]=_0x3cc946['attributes']['length']?_0x3cc946[_0xae63('0x46')]:_0x22eee3['model'];if(!_0xb4efc9[_0xae63('0x41')][_0xae63('0xcb')]('nolimit')){_0x3cc946['limit']=qs[_0xae63('0x23')](_0xb4efc9['query'][_0xae63('0x23')]);_0x3cc946['offset']=qs['offset'](_0xb4efc9['query'][_0xae63('0x22')]);}_0x3cc946['order']=qs[_0xae63('0xc8')](_0xb4efc9[_0xae63('0x41')][_0xae63('0xc8')]);_0x3cc946[_0xae63('0x3f')]=qs[_0xae63('0x57')](_[_0xae63('0xc9')](_0xb4efc9['query'],_0x22eee3[_0xae63('0x57')]));_0x3cc946['where'][_0xae63('0xda')]=_0x221ab5['id'];if(_0xb4efc9[_0xae63('0x41')][_0xae63('0x31')]){_0x3cc946[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x3cc946[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x3cc946[_0xae63('0x46')],function(_0x173e81){var _0x2bc51c={};_0x2bc51c[_0x173e81]={'$like':'%'+_0xb4efc9['query'][_0xae63('0x31')]+'%'};return _0x2bc51c;})});}_0x3cc946=_[_0xae63('0x5a')]({},_0x3cc946,_0xb4efc9[_0xae63('0x5b')]);return db['ScreenRecording'][_0xae63('0x24')]({'where':_0x3cc946[_0xae63('0x3f')]})['then'](function(_0xb0fd3b){_0x11cb5b['count']=_0xb0fd3b;if(_0xb4efc9['query'][_0xae63('0x42')]){_0x3cc946[_0xae63('0x44')]=[{'all':!![]}];}return db[_0xae63('0xdc')]['findAll'](_0x3cc946);})[_0xae63('0x28')](function(_0x43885b){_0x11cb5b[_0xae63('0x49')]=_0x43885b;return _0x11cb5b;});}})[_0xae63('0x28')](respondWithFilteredResult(_0x33ac25,_0x3cc946))['catch'](handleError(_0x33ac25,null));};exports[_0xae63('0xdd')]=function(_0x46d6a2,_0x1dc034){var _0x3f8132={};var _0x103615={};var _0x4d5a55;var _0x49feb7;return db['User']['findOne']({'where':{'id':_0x46d6a2['params']['id']}})['then'](handleEntityNotFound(_0x1dc034,null))[_0xae63('0x28')](function(_0x4d8f20){if(_0x4d8f20){_0x4d5a55=_0x4d8f20;_0x103615[_0xae63('0x54')]=_[_0xae63('0x56')](db['ChatInteraction']['rawAttributes']);_0x103615[_0xae63('0x41')]=_[_0xae63('0x56')](_0x46d6a2[_0xae63('0x41')]);_0x103615[_0xae63('0x57')]=_[_0xae63('0xc6')](_0x103615[_0xae63('0x54')],_0x103615[_0xae63('0x41')]);_0x3f8132['attributes']=_[_0xae63('0xc6')](_0x103615[_0xae63('0x54')],qs[_0xae63('0x58')](_0x46d6a2[_0xae63('0x41')][_0xae63('0x58')]));_0x3f8132[_0xae63('0x46')]=_0x3f8132['attributes']['length']?_0x3f8132[_0xae63('0x46')]:_0x103615['model'];_0x3f8132[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x46d6a2['query']['sort']);_0x3f8132[_0xae63('0x3f')]=qs[_0xae63('0x57')](_[_0xae63('0xc9')](_0x46d6a2[_0xae63('0x41')],_0x103615['filters']));if(_0x46d6a2['query'][_0xae63('0x31')]){_0x3f8132[_0xae63('0x3f')]=_['merge'](_0x3f8132['where'],{'$or':_[_0xae63('0x33')](_0x3f8132[_0xae63('0x46')],function(_0x20772c){var _0x57248c={};_0x57248c[_0x20772c]={'$like':'%'+_0x46d6a2['query'][_0xae63('0x31')]+'%'};return _0x57248c;})});}_0x3f8132=_[_0xae63('0x5a')]({},_0x3f8132,_0x46d6a2[_0xae63('0x5b')]);return _0x4d5a55[_0xae63('0xdd')](_0x3f8132);}})['then'](function(_0x378693){if(_0x378693){_0x49feb7=_0x378693['length'];if(!_0x46d6a2[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x3f8132['limit']=qs['limit'](_0x46d6a2['query'][_0xae63('0x23')]);_0x3f8132[_0xae63('0x22')]=qs[_0xae63('0x22')](_0x46d6a2[_0xae63('0x41')][_0xae63('0x22')]);}return _0x4d5a55[_0xae63('0xdd')](_0x3f8132);}})[_0xae63('0x28')](function(_0x3d7f88){if(_0x3d7f88){return _0x3d7f88?{'count':_0x49feb7,'rows':_0x3d7f88}:null;}})[_0xae63('0x28')](respondWithResult(_0x1dc034,null))[_0xae63('0x1d')](handleError(_0x1dc034,null));};exports[_0xae63('0xde')]=function(_0x3750d6,_0x3fd97c){var _0x4e22d8={};var _0x27f1fa={};var _0x4cdc65;var _0x24c0fb;return db['User'][_0xae63('0x95')]({'where':{'id':_0x3750d6[_0xae63('0x53')]['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x3fd97c,null))[_0xae63('0x28')](function(_0x154a9f){if(_0x154a9f){_0x4cdc65=_0x154a9f;_0x27f1fa[_0xae63('0x54')]=_['keys'](db['OpenchannelInteraction'][_0xae63('0x3b')]);_0x27f1fa['query']=_[_0xae63('0x56')](_0x3750d6['query']);_0x27f1fa[_0xae63('0x57')]=_[_0xae63('0xc6')](_0x27f1fa[_0xae63('0x54')],_0x27f1fa['query']);_0x4e22d8['attributes']=_[_0xae63('0xc6')](_0x27f1fa[_0xae63('0x54')],qs['fields'](_0x3750d6[_0xae63('0x41')][_0xae63('0x58')]));_0x4e22d8[_0xae63('0x46')]=_0x4e22d8[_0xae63('0x46')][_0xae63('0x4a')]?_0x4e22d8[_0xae63('0x46')]:_0x27f1fa['model'];_0x4e22d8[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x3750d6['query'][_0xae63('0xc8')]);_0x4e22d8['where']=qs[_0xae63('0x57')](_['pick'](_0x3750d6['query'],_0x27f1fa[_0xae63('0x57')]));if(_0x3750d6['query'][_0xae63('0x31')]){_0x4e22d8[_0xae63('0x3f')]=_['merge'](_0x4e22d8[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x4e22d8[_0xae63('0x46')],function(_0x1e76f8){var _0x461837={};_0x461837[_0x1e76f8]={'$like':'%'+_0x3750d6[_0xae63('0x41')]['filter']+'%'};return _0x461837;})});}_0x4e22d8=_[_0xae63('0x5a')]({},_0x4e22d8,_0x3750d6[_0xae63('0x5b')]);return _0x4cdc65['getOpenchannelInteractions'](_0x4e22d8);}})[_0xae63('0x28')](function(_0x1a29a4){if(_0x1a29a4){_0x24c0fb=_0x1a29a4[_0xae63('0x4a')];if(!_0x3750d6[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x4e22d8[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x3750d6['query'][_0xae63('0x23')]);_0x4e22d8[_0xae63('0x22')]=qs[_0xae63('0x22')](_0x3750d6[_0xae63('0x41')][_0xae63('0x22')]);}return _0x4cdc65[_0xae63('0xde')](_0x4e22d8);}})[_0xae63('0x28')](function(_0x4cddb2){if(_0x4cddb2){return _0x4cddb2?{'count':_0x24c0fb,'rows':_0x4cddb2}:null;}})[_0xae63('0x28')](respondWithResult(_0x3fd97c,null))[_0xae63('0x1d')](handleError(_0x3fd97c,null));};exports[_0xae63('0xdf')]=function(_0x21a087,_0x56fb50){var _0x1a1aad={'raw':!![],'where':{}};var _0x25e021={};var _0x503c04={'count':0x0,'rows':[]};return db[_0xae63('0x40')][_0xae63('0x95')]({'where':{'id':_0x21a087[_0xae63('0x53')]['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x56fb50,null))[_0xae63('0x28')](function(_0x792c10){if(_0x792c10){_0x25e021['model']=_[_0xae63('0x56')](db[_0xae63('0xe0')][_0xae63('0x3b')]);_0x25e021[_0xae63('0x41')]=_['keys'](_0x21a087[_0xae63('0x41')]);_0x25e021['filters']=_[_0xae63('0xc6')](_0x25e021[_0xae63('0x54')],_0x25e021[_0xae63('0x41')]);_0x1a1aad[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x25e021[_0xae63('0x54')],qs[_0xae63('0x58')](_0x21a087['query'][_0xae63('0x58')]));_0x1a1aad[_0xae63('0x46')]=_0x1a1aad[_0xae63('0x46')]['length']?_0x1a1aad['attributes']:_0x25e021[_0xae63('0x54')];if(!_0x21a087[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x1a1aad[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x21a087[_0xae63('0x41')][_0xae63('0x23')]);_0x1a1aad[_0xae63('0x22')]=qs['offset'](_0x21a087[_0xae63('0x41')]['offset']);}_0x1a1aad[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x21a087['query']['sort']);_0x1a1aad[_0xae63('0x3f')]=qs[_0xae63('0x57')](_[_0xae63('0xc9')](_0x21a087[_0xae63('0x41')],_0x25e021[_0xae63('0x57')]));_0x1a1aad[_0xae63('0x3f')][_0xae63('0xda')]=_0x792c10['id'];if(_0x21a087[_0xae63('0x41')][_0xae63('0x31')]){_0x1a1aad[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x1a1aad[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x1a1aad[_0xae63('0x46')],function(_0x25059f){var _0x407dce={};_0x407dce[_0x25059f]={'$like':'%'+_0x21a087[_0xae63('0x41')][_0xae63('0x31')]+'%'};return _0x407dce;})});}_0x1a1aad=_[_0xae63('0x5a')]({},_0x1a1aad,_0x21a087[_0xae63('0x5b')]);return db[_0xae63('0xe0')]['count']({'where':_0x1a1aad[_0xae63('0x3f')]})[_0xae63('0x28')](function(_0x536a65){_0x503c04[_0xae63('0x24')]=_0x536a65;if(_0x21a087[_0xae63('0x41')][_0xae63('0x42')]){_0x1a1aad[_0xae63('0x44')]=[{'all':!![]}];}return db['MailInteraction'][_0xae63('0x47')](_0x1a1aad);})[_0xae63('0x28')](function(_0x396fdd){_0x503c04[_0xae63('0x49')]=_0x396fdd;return _0x503c04;});}})[_0xae63('0x28')](respondWithFilteredResult(_0x56fb50,_0x1a1aad))[_0xae63('0x1d')](handleError(_0x56fb50,null));};exports['getSmsInteractions']=function(_0x36266e,_0x5410b4){var _0x58d293={};var _0x9bbb61={};var _0xd442ff;var _0x787a3;return db[_0xae63('0x40')]['findOne']({'where':{'id':_0x36266e[_0xae63('0x53')]['id']}})['then'](handleEntityNotFound(_0x5410b4,null))[_0xae63('0x28')](function(_0x4b1dff){if(_0x4b1dff){_0xd442ff=_0x4b1dff;_0x9bbb61['model']=_[_0xae63('0x56')](db['SmsInteraction']['rawAttributes']);_0x9bbb61[_0xae63('0x41')]=_[_0xae63('0x56')](_0x36266e[_0xae63('0x41')]);_0x9bbb61['filters']=_[_0xae63('0xc6')](_0x9bbb61[_0xae63('0x54')],_0x9bbb61[_0xae63('0x41')]);_0x58d293[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x9bbb61[_0xae63('0x54')],qs[_0xae63('0x58')](_0x36266e[_0xae63('0x41')]['fields']));_0x58d293[_0xae63('0x46')]=_0x58d293['attributes']['length']?_0x58d293['attributes']:_0x9bbb61['model'];_0x58d293[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x36266e[_0xae63('0x41')][_0xae63('0xc8')]);_0x58d293[_0xae63('0x3f')]=qs[_0xae63('0x57')](_[_0xae63('0xc9')](_0x36266e[_0xae63('0x41')],_0x9bbb61[_0xae63('0x57')]));if(_0x36266e[_0xae63('0x41')][_0xae63('0x31')]){_0x58d293[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x58d293[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x58d293[_0xae63('0x46')],function(_0x125525){var _0x226dcc={};_0x226dcc[_0x125525]={'$like':'%'+_0x36266e[_0xae63('0x41')][_0xae63('0x31')]+'%'};return _0x226dcc;})});}_0x58d293=_[_0xae63('0x5a')]({},_0x58d293,_0x36266e['options']);return _0xd442ff['getSmsInteractions'](_0x58d293);}})[_0xae63('0x28')](function(_0xc01d54){if(_0xc01d54){_0x787a3=_0xc01d54[_0xae63('0x4a')];if(!_0x36266e[_0xae63('0x41')][_0xae63('0xcb')]('nolimit')){_0x58d293[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x36266e[_0xae63('0x41')][_0xae63('0x23')]);_0x58d293[_0xae63('0x22')]=qs[_0xae63('0x22')](_0x36266e[_0xae63('0x41')][_0xae63('0x22')]);}return _0xd442ff[_0xae63('0xe1')](_0x58d293);}})['then'](function(_0x38a6d9){if(_0x38a6d9){return _0x38a6d9?{'count':_0x787a3,'rows':_0x38a6d9}:null;}})[_0xae63('0x28')](respondWithResult(_0x5410b4,null))[_0xae63('0x1d')](handleError(_0x5410b4,null));};exports['getFaxInteractions']=function(_0x30b086,_0x151d84){var _0x51f022={};var _0x28faac={};var _0x382f59;var _0x41d6fe;return db['User'][_0xae63('0x95')]({'where':{'id':_0x30b086[_0xae63('0x53')]['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x151d84,null))[_0xae63('0x28')](function(_0xc5f811){if(_0xc5f811){_0x382f59=_0xc5f811;_0x28faac[_0xae63('0x54')]=_['keys'](db['FaxInteraction'][_0xae63('0x3b')]);_0x28faac[_0xae63('0x41')]=_[_0xae63('0x56')](_0x30b086[_0xae63('0x41')]);_0x28faac[_0xae63('0x57')]=_['intersection'](_0x28faac[_0xae63('0x54')],_0x28faac[_0xae63('0x41')]);_0x51f022[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x28faac[_0xae63('0x54')],qs[_0xae63('0x58')](_0x30b086[_0xae63('0x41')][_0xae63('0x58')]));_0x51f022[_0xae63('0x46')]=_0x51f022[_0xae63('0x46')]['length']?_0x51f022[_0xae63('0x46')]:_0x28faac[_0xae63('0x54')];_0x51f022[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x30b086[_0xae63('0x41')][_0xae63('0xc8')]);_0x51f022['where']=qs[_0xae63('0x57')](_[_0xae63('0xc9')](_0x30b086['query'],_0x28faac[_0xae63('0x57')]));if(_0x30b086['query']['filter']){_0x51f022[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x51f022[_0xae63('0x3f')],{'$or':_['map'](_0x51f022['attributes'],function(_0x2a8f06){var _0x38eae9={};_0x38eae9[_0x2a8f06]={'$like':'%'+_0x30b086['query'][_0xae63('0x31')]+'%'};return _0x38eae9;})});}_0x51f022=_[_0xae63('0x5a')]({},_0x51f022,_0x30b086[_0xae63('0x5b')]);return _0x382f59['getFaxInteractions'](_0x51f022);}})[_0xae63('0x28')](function(_0x42298c){if(_0x42298c){_0x41d6fe=_0x42298c[_0xae63('0x4a')];if(!_0x30b086[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x51f022['limit']=qs[_0xae63('0x23')](_0x30b086['query'][_0xae63('0x23')]);_0x51f022[_0xae63('0x22')]=qs['offset'](_0x30b086[_0xae63('0x41')][_0xae63('0x22')]);}return _0x382f59[_0xae63('0xe2')](_0x51f022);}})[_0xae63('0x28')](function(_0x219ad8){if(_0x219ad8){return _0x219ad8?{'count':_0x41d6fe,'rows':_0x219ad8}:null;}})[_0xae63('0x28')](respondWithResult(_0x151d84,null))[_0xae63('0x1d')](handleError(_0x151d84,null));};exports[_0xae63('0xe3')]=function(_0x126905,_0xebd73c){var _0x5715c7={};var _0x345d5e={};var _0x15f153;var _0x1294e5;return db[_0xae63('0x40')][_0xae63('0x95')]({'where':{'id':_0x126905[_0xae63('0x53')]['id']}})[_0xae63('0x28')](handleEntityNotFound(_0xebd73c,null))[_0xae63('0x28')](function(_0x1074b6){if(_0x1074b6){_0x15f153=_0x1074b6;_0x345d5e[_0xae63('0x54')]=_[_0xae63('0x56')](db[_0xae63('0xe4')][_0xae63('0x3b')]);_0x345d5e[_0xae63('0x41')]=_['keys'](_0x126905['query']);_0x345d5e[_0xae63('0x57')]=_['intersection'](_0x345d5e[_0xae63('0x54')],_0x345d5e[_0xae63('0x41')]);_0x5715c7[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x345d5e[_0xae63('0x54')],qs[_0xae63('0x58')](_0x126905[_0xae63('0x41')][_0xae63('0x58')]));_0x5715c7[_0xae63('0x46')]=_0x5715c7[_0xae63('0x46')][_0xae63('0x4a')]?_0x5715c7[_0xae63('0x46')]:_0x345d5e[_0xae63('0x54')];_0x5715c7['order']=qs[_0xae63('0xc8')](_0x126905[_0xae63('0x41')][_0xae63('0xc8')]);_0x5715c7[_0xae63('0x3f')]=qs[_0xae63('0x57')](_['pick'](_0x126905[_0xae63('0x41')],_0x345d5e[_0xae63('0x57')]));if(_0x126905['query'][_0xae63('0x31')]){_0x5715c7[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x5715c7[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x5715c7[_0xae63('0x46')],function(_0x415855){var _0x6b8dab={};_0x6b8dab[_0x415855]={'$like':'%'+_0x126905['query'][_0xae63('0x31')]+'%'};return _0x6b8dab;})});}_0x5715c7=_[_0xae63('0x5a')]({},_0x5715c7,_0x126905[_0xae63('0x5b')]);return _0x15f153[_0xae63('0xe3')](_0x5715c7);}})[_0xae63('0x28')](function(_0x57b74b){if(_0x57b74b){_0x1294e5=_0x57b74b[_0xae63('0x4a')];if(!_0x126905[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x5715c7[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x126905['query'][_0xae63('0x23')]);_0x5715c7[_0xae63('0x22')]=qs[_0xae63('0x22')](_0x126905['query'][_0xae63('0x22')]);}return _0x15f153['getWhatsappInteractions'](_0x5715c7);}})[_0xae63('0x28')](function(_0x10d61c){if(_0x10d61c){return _0x10d61c?{'count':_0x1294e5,'rows':_0x10d61c}:null;}})[_0xae63('0x28')](respondWithResult(_0xebd73c,null))[_0xae63('0x1d')](handleError(_0xebd73c,null));};exports[_0xae63('0xe5')]=function(_0x5ecca4,_0x47a0fc,_0x2174e4){var _0x452f83;var _0x2daaee;var _0x1fd2c0;var _0x31f9b0=!_[_0xae63('0x69')](_0x5ecca4['params']['id'])?_0x5ecca4['params']['id']:!_['isNil'](_0x5ecca4[_0xae63('0x2d')]['id'])?_0x5ecca4[_0xae63('0x2d')]['id']:null;return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x31f9b0,'role':{'$or':[_0xae63('0x2b'),'user',_0xae63('0x2f')]}},'attributes':['id','name',_0xae63('0xe6'),'mobile',_0xae63('0x2a'),'internal',_0xae63('0x9d')]})[_0xae63('0x28')](function(_0x35c2e2){if(_0x35c2e2){if(_0x35c2e2[_0xae63('0x2a')]===_0xae63('0x2f')){_0x452f83=_0x35c2e2;if(_0x5ecca4['body']['interface']){_0x1fd2c0=util[_0xae63('0xe7')]('LOCAL/%s@from-sip/n',_0x452f83[_0x5ecca4[_0xae63('0x5f')][_0xae63('0xa9')]]);}else if(_0x5ecca4[_0xae63('0x5f')][_0xae63('0xe8')]){_0x1fd2c0=util[_0xae63('0xe7')]('SIP/%s',_0x5ecca4[_0xae63('0x5f')][_0xae63('0xe8')]);}else{_0x1fd2c0=util[_0xae63('0xe7')](_0xae63('0xaa'),_0x452f83['name']);}socket['to'](util[_0xae63('0xe7')]('user:%s',_0x452f83[_0xae63('0x37')]))[_0xae63('0xa3')]('user:forcelogout',{'user':{'id':_0x452f83['id'],'name':_0x452f83[_0xae63('0x37')]},'ip':_0x5ecca4[_0xae63('0xe9')][_0xae63('0xea')]||_0x5ecca4[_0xae63('0xeb')][_0xae63('0xec')]||_0x5ecca4[_0xae63('0xed')][_0xae63('0xec')]||_0x5ecca4[_0xae63('0xeb')][_0xae63('0xed')][_0xae63('0xec')]});return db[_0xae63('0xd4')][_0xae63('0x27')]({'where':{'membername':_0x452f83[_0xae63('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0xae63('0x8f'))]['ValidationError'](_0xae63('0xee'));}})[_0xae63('0x28')](function(){if(_0x452f83){return _0x452f83['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x398ae1){if(_0x452f83){var _0x3aa2b4=[];if(_0x398ae1){_0x2daaee=_0x398ae1;if(_0x2daaee[_0xae63('0x4a')]){for(var _0x521618=0x0;_0x521618<_0x2daaee[_0xae63('0x4a')];_0x521618++){_0x3aa2b4[_0xae63('0x4b')]({'membername':_0x452f83['name'],'UserId':_0x452f83['id'],'queue_name':_0x2daaee[_0x521618][_0xae63('0x37')],'VoiceQueueId':_0x2daaee[_0x521618]['id'],'interface':_0x1fd2c0,'paused':_0x452f83['loginInPause']||![],'penalty':_0x2daaee[_0x521618]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x3aa2b4,function(_0x532433){return db[_0xae63('0xd4')][_0xae63('0xac')](_0x532433);});}}}})['then'](function(){if(_0x452f83){return db[_0xae63('0xef')]['findAll']({'where':{'membername':_0x452f83[_0xae63('0x37')],'exitAt':null}});}})[_0xae63('0x28')](function(_0x487344){if(_0x452f83){var _0x359881=[];_0x487344['forEach'](function(_0x279762){_0x359881[_0xae63('0x4b')](_0x279762[_0xae63('0x5e')]({'exitAt':moment()['format'](_0xae63('0xf0'))}));});return BPromise[_0xae63('0x51')](_0x359881);}})[_0xae63('0x28')](function(){if(_0x452f83){var _0x17c854=[];var _0x251404=[];var _0x5c4a23=utils[_0xae63('0xf1')]();var _0x9873ce={'membername':_0x452f83[_0xae63('0x37')],'interface':_0x1fd2c0,'enterAt':moment()[_0xae63('0xe7')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x452f83[_0xae63('0x2a')],'internal':_0x452f83[_0xae63('0x68')]};_0x5c4a23[_0xae63('0xf2')](function(_0xea55a1){_0x17c854[_0xae63('0x4b')](_['merge']({'channel':_0xea55a1,'type':'LOGIN','data1':_0x5ecca4[_0xae63('0x5f')]['device'],'data2':_0x1fd2c0},_0x9873ce));if(_0x452f83[_0xae63('0x9d')]){_0x251404[_0xae63('0x4b')](_[_0xae63('0x5a')]({'channel':_0xea55a1,'type':_0xae63('0xf3'),'data1':_0xae63('0xf4')},_0x9873ce));}});return db[_0xae63('0xef')][_0xae63('0xf5')](_0x17c854[_0xae63('0xf6')](_0x251404),{'individualHooks':!![]});}})[_0xae63('0x28')](function(){if(_0x452f83){return _0x452f83[_0xae63('0x5e')]({'online':!![],'lastLoginAt':moment()[_0xae63('0xe7')](_0xae63('0xf0')),'voicePause':_0x452f83[_0xae63('0x9d')]||![],'mailPause':_0x452f83[_0xae63('0x9d')]||![],'chatPause':_0x452f83[_0xae63('0x9d')]||![],'faxPause':_0x452f83[_0xae63('0x9d')]||![],'smsPause':_0x452f83[_0xae63('0x9d')]||![],'openchannelPause':_0x452f83[_0xae63('0x9d')]||![],'whatsappPause':_0x452f83[_0xae63('0x9d')]||![],'pauseType':_0x452f83[_0xae63('0x9d')]?_0xae63('0xf4'):null,'interface':_0x1fd2c0,'lastPauseAt':moment()['format'](_0xae63('0xf0'))});}})[_0xae63('0x28')](function(_0x316e37){if(_0x5ecca4[_0xae63('0xf7')]){return _0x2174e4();}else{return BPromise[_0xae63('0xf8')](_0x316e37)[_0xae63('0x28')](respondWithResult(_0x47a0fc,null));}})[_0xae63('0x1d')](handleError(_0x47a0fc,null));};exports['logout']=function(_0xaf9f86,_0x58e6b4){var _0x452fdb;return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0xaf9f86[_0xae63('0x53')]['id'],'role':_0xae63('0x2f')},'attributes':['id',_0xae63('0x37'),_0xae63('0x2a')]})['then'](handleEntityNotFound(_0x58e6b4,null))[_0xae63('0x28')](function(_0x1b31cc){if(_0x1b31cc){_0x452fdb=_0x1b31cc;return db[_0xae63('0xd4')]['destroy']({'where':{'membername':_0x452fdb[_0xae63('0x37')]},'individualHooks':!![]});}})[_0xae63('0x28')](function(){return db[_0xae63('0xef')]['findAll']({'where':{'membername':_0x452fdb[_0xae63('0x37')],'exitAt':null}});})[_0xae63('0x28')](function(_0x53e5b0){var _0x229268=[];_0x53e5b0['forEach'](function(_0x12dd46){_0x229268['push'](_0x12dd46['update']({'exitAt':moment()['format'](_0xae63('0xf0'))}));});return BPromise[_0xae63('0x51')](_0x229268);})[_0xae63('0x28')](function(){return _0x452fdb[_0xae63('0x5e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x58e6b4,null))['catch'](handleError(_0x58e6b4,null));};exports[_0xae63('0xf9')]=function(_0x5334d9,_0x48a8bc){var _0x33a329;return db[_0xae63('0xd4')][_0xae63('0x5e')]({'paused':0x1},{'where':{'UserId':_0x5334d9[_0xae63('0x53')]['id']},'individualHooks':!![]})[_0xae63('0x28')](function(){return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x5334d9[_0xae63('0x53')]['id'],'role':_0xae63('0x2f')},'attributes':['id',_0xae63('0x37'),'role',_0xae63('0x68'),'interface']});})['then'](handleEntityNotFound(_0x48a8bc,null))[_0xae63('0x28')](function(_0x42b6d1){if(_0x42b6d1){_0x33a329=_0x42b6d1;return respondWithRpcPromise('QueuePause','pause',{'id':_0x33a329['id'],'name':_0x33a329[_0xae63('0x37')],'pause':!![]});}})[_0xae63('0x28')](function(){if(_0x33a329){return db['MemberReport'][_0xae63('0x47')]({'where':{'membername':_0x33a329[_0xae63('0x37')],'type':_0xae63('0xf3'),'exitAt':null}});}})['then'](function(_0x50d50c){if(_0x50d50c[_0xae63('0x4a')]){var _0x5da5b2=moment()[_0xae63('0xe7')](_0xae63('0xf0'));for(var _0x3f7f51=0x0,_0x5e1d84=_0x50d50c[_0xae63('0x4a')];_0x3f7f51<_0x5e1d84;_0x3f7f51++){_0x50d50c[_0x3f7f51]['updateAttributes']({'exitAt':_0x5da5b2});}}})['then'](function(){var _0x535361=[];var _0x4dc537=utils[_0xae63('0xf1')]();_0x4dc537[_0xae63('0xf2')](function(_0x56e399){_0x535361[_0xae63('0x4b')]({'channel':_0x56e399,'membername':_0x33a329[_0xae63('0x37')],'interface':_['isNil'](_0x33a329[_0xae63('0xa9')])?util['format']('SIP/%s',_0x33a329[_0xae63('0x37')]):_0x33a329[_0xae63('0xa9')],'type':_0xae63('0xf3'),'enterAt':moment()[_0xae63('0xe7')](_0xae63('0xf0')),'data1':_0x5334d9['body'][_0xae63('0x3c')]||'DEFAULT\x20PAUSE','role':_0x33a329[_0xae63('0x2a')],'internal':_0x33a329['internal']});});return db[_0xae63('0xef')][_0xae63('0xf5')](_0x535361,{'individualHooks':!![]});})[_0xae63('0x28')](function(){return _0x33a329[_0xae63('0x5e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5334d9[_0xae63('0x5f')]['type']||_0xae63('0xfa'),'lastPauseAt':moment()[_0xae63('0xe7')](_0xae63('0xf0'))});})['then'](respondWithResult(_0x48a8bc,null))[_0xae63('0x1d')](handleError(_0x48a8bc,null));};exports[_0xae63('0xfb')]=function(_0x3acaaa,_0x3a8a26){var _0x5a88d0;return db['User']['find']({'where':{'id':_0x3acaaa[_0xae63('0x53')]['id']},'attributes':['id',_0xae63('0x37'),_0xae63('0x2a'),_0xae63('0x9e'),'mailPause',_0xae63('0xfc'),_0xae63('0xfd'),_0xae63('0xfe'),_0xae63('0xff'),_0xae63('0x100'),_0xae63('0x101'),_0xae63('0x102')]})[_0xae63('0x28')](handleEntityNotFound(_0x3a8a26,null))[_0xae63('0x28')](function(_0x190033){if(_0x190033){_0x5a88d0=_0x190033;if(_0x3acaaa[_0xae63('0x5f')][_0xae63('0x9c')]&&!utils['isValidChannel'](_0x3acaaa[_0xae63('0x5f')][_0xae63('0x9c')])){throw new db[(_0xae63('0x8f'))][(_0xae63('0x91'))](_0xae63('0x9f'));}switch(_0x3acaaa[_0xae63('0x5f')][_0xae63('0x9c')]){case _0xae63('0xa6'):return respondWithRpcPromise(_0xae63('0x103'),_0xae63('0xfb'),{'id':_0x5a88d0['id'],'name':_0x5a88d0[_0xae63('0x37')],'pause':![]})['then'](function(){return db[_0xae63('0xd4')]['update']({'paused':0x0},{'where':{'UserId':_0x5a88d0['id']},'individualHooks':!![]});})[_0xae63('0x28')](function(){return db[_0xae63('0xef')][_0xae63('0x36')]({'where':{'channel':_0x3acaaa['body'][_0xae63('0x9c')],'membername':_0x5a88d0[_0xae63('0x37')],'type':_0xae63('0xf3'),'exitAt':null}});})[_0xae63('0x28')](function(_0x5e5cc4){if(_0x5e5cc4){return _0x5e5cc4[_0xae63('0x5e')]({'exitAt':moment()[_0xae63('0xe7')](_0xae63('0xf0')),'data2':_0xae63('0x104')},{'individualHooks':!![]});}return null;})[_0xae63('0x28')](function(){return _0x5a88d0[_0xae63('0x5e')]({'voicePause':![]});});case _0xae63('0x4e'):case _0xae63('0x5c'):case _0xae63('0x4d'):case _0xae63('0x5d'):case _0xae63('0x50'):case _0xae63('0x4f'):return db[_0xae63('0xef')]['find']({'where':{'channel':_0x3acaaa[_0xae63('0x5f')][_0xae63('0x9c')],'membername':_0x5a88d0['name'],'type':_0xae63('0xf3'),'exitAt':null}})[_0xae63('0x28')](function(_0x54adef){if(_0x54adef){return _0x54adef[_0xae63('0x5e')]({'exitAt':moment()[_0xae63('0xe7')](_0xae63('0xf0')),'data2':_0xae63('0x104')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x48b519={};_[_0xae63('0x25')](_0x48b519,util[_0xae63('0xe7')](_0xae63('0x105'),_0x3acaaa[_0xae63('0x5f')][_0xae63('0x9c')],_0xae63('0x106')),![]);return _0x5a88d0[_0xae63('0x5e')](_0x48b519);});default:return respondWithRpcPromise(_0xae63('0x103'),_0xae63('0xfb'),{'id':_0x5a88d0['id'],'name':_0x5a88d0[_0xae63('0x37')],'pause':![]})[_0xae63('0x28')](function(){return db['UserVoiceQueueRt'][_0xae63('0x5e')]({'paused':0x0},{'where':{'UserId':_0x5a88d0['id']}});})[_0xae63('0x28')](function(){return db['MemberReport'][_0xae63('0x47')]({'where':{'membername':_0x5a88d0[_0xae63('0x37')],'type':_0xae63('0xf3'),'exitAt':null}});})[_0xae63('0x28')](function(_0x449fd3){var _0x5ab2ff=[];_0x449fd3[_0xae63('0xf2')](function(_0xe298e4){_0x5ab2ff['push'](_0xe298e4[_0xae63('0x5e')]({'exitAt':moment()[_0xae63('0xe7')](_0xae63('0xf0')),'data2':_0xae63('0x104')}));});return BPromise['all'](_0x5ab2ff);})[_0xae63('0x28')](function(){return _0x5a88d0[_0xae63('0x5e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xae63('0x28')](respondWithResult(_0x3a8a26,null))[_0xae63('0x1d')](handleError(_0x3a8a26,null));};exports['getTeams']=function(_0x58e541,_0x3365bc){var _0x1c13a2={};var _0xb37dff={};var _0x22f9bc;var _0x4e8104;return db[_0xae63('0x40')][_0xae63('0x95')]({'where':{'id':_0x58e541[_0xae63('0x53')]['id']}})['then'](handleEntityNotFound(_0x3365bc,null))[_0xae63('0x28')](function(_0xe11347){if(_0xe11347){_0x22f9bc=_0xe11347;_0xb37dff[_0xae63('0x54')]=_['keys'](db[_0xae63('0x107')][_0xae63('0x3b')]);_0xb37dff[_0xae63('0x41')]=_['keys'](_0x58e541[_0xae63('0x41')]);_0xb37dff['filters']=_[_0xae63('0xc6')](_0xb37dff['model'],_0xb37dff[_0xae63('0x41')]);_0x1c13a2['attributes']=_['intersection'](_0xb37dff['model'],qs['fields'](_0x58e541['query'][_0xae63('0x58')]));_0x1c13a2['attributes']=_0x1c13a2['attributes'][_0xae63('0x4a')]?_0x1c13a2[_0xae63('0x46')]:_0xb37dff[_0xae63('0x54')];_0x1c13a2[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x58e541['query'][_0xae63('0xc8')]);_0x1c13a2['where']=qs[_0xae63('0x57')](_['pick'](_0x58e541[_0xae63('0x41')],_0xb37dff['filters']));if(_0x58e541[_0xae63('0x41')][_0xae63('0x31')]){_0x1c13a2[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x1c13a2[_0xae63('0x3f')],{'$or':_[_0xae63('0x33')](_0x1c13a2[_0xae63('0x46')],function(_0x1f828b){var _0x8a5560={};_0x8a5560[_0x1f828b]={'$like':'%'+_0x58e541[_0xae63('0x41')][_0xae63('0x31')]+'%'};return _0x8a5560;})});}_0x1c13a2=_['merge']({},_0x1c13a2,_0x58e541[_0xae63('0x5b')]);return _0x22f9bc[_0xae63('0x108')](_0x1c13a2);}})[_0xae63('0x28')](function(_0x41d3f4){if(_0x41d3f4){_0x4e8104=_0x41d3f4[_0xae63('0x4a')];if(!_0x58e541[_0xae63('0x41')][_0xae63('0xcb')](_0xae63('0xd1'))){_0x1c13a2[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x58e541[_0xae63('0x41')][_0xae63('0x23')]);_0x1c13a2[_0xae63('0x22')]=qs[_0xae63('0x22')](_0x58e541[_0xae63('0x41')][_0xae63('0x22')]);}return _0x22f9bc[_0xae63('0x108')](_0x1c13a2);}})[_0xae63('0x28')](function(_0x30618c){if(_0x30618c){return _0x30618c?{'count':_0x4e8104,'rows':_0x30618c}:null;}})[_0xae63('0x28')](respondWithResult(_0x3365bc,null))[_0xae63('0x1d')](handleError(_0x3365bc,null));};exports[_0xae63('0x109')]=function(_0x365c69,_0x494bed){return db[_0xae63('0x40')][_0xae63('0x36')]({'where':{'id':_0x365c69[_0xae63('0x53')]['id']}})['then'](handleEntityNotFound(_0x494bed,null))[_0xae63('0x28')](function(_0x1b4142){if(_0x1b4142){var _0x49ff83=_0x1b4142[_0xae63('0x29')]({'plain':!![]});return _0x1b4142[_0xae63('0x109')](_0x365c69[_0xae63('0x5f')][_0xae63('0x63')],_[_0xae63('0x62')](_0x365c69[_0xae63('0x5f')],['ids','id'])||{})[_0xae63('0x28')](function(){for(var _0x3ca139=0x0;_0x3ca139<_0x365c69[_0xae63('0x5f')][_0xae63('0x63')][_0xae63('0x4a')];_0x3ca139++){var _0x4c7d4e=[];var _0x471575={};db[_0xae63('0x107')][_0xae63('0x95')]({'where':{'id':_0x365c69['body'][_0xae63('0x63')][_0x3ca139]}})['then'](function(_0x343f71){_0x471575=_0x343f71[_0xae63('0x4c')];_0x4c7d4e[_0xae63('0x4b')](_0x343f71[_0xae63('0x10a')]()[_0xae63('0x28')](function(_0x53d6e6){for(var _0x4df41f=0x0;_0x4df41f<_0x53d6e6[_0xae63('0x4a')];_0x4df41f++){_0x53d6e6[_0x4df41f][_0xae63('0x10b')](_0xae63('0x9c'),_0xae63('0x10c'));}return _0x53d6e6;}));_0x4c7d4e[_0xae63('0x4b')](_0x343f71[_0xae63('0x10d')]()[_0xae63('0x28')](function(_0x151155){for(var _0x4851bf=0x0;_0x4851bf<_0x151155[_0xae63('0x4a')];_0x4851bf++){_0x151155[_0x4851bf][_0xae63('0x10b')](_0xae63('0x9c'),_0xae63('0x10e'));}return _0x151155;}));_0x4c7d4e[_0xae63('0x4b')](_0x343f71[_0xae63('0x10f')]()['then'](function(_0x18cbb3){for(var _0x548d5f=0x0;_0x548d5f<_0x18cbb3[_0xae63('0x4a')];_0x548d5f++){_0x18cbb3[_0x548d5f][_0xae63('0x10b')](_0xae63('0x9c'),'Mail');}return _0x18cbb3;}));_0x4c7d4e[_0xae63('0x4b')](_0x343f71[_0xae63('0x110')]()[_0xae63('0x28')](function(_0x87fbf7){for(var _0xf6ce24=0x0;_0xf6ce24<_0x87fbf7[_0xae63('0x4a')];_0xf6ce24++){_0x87fbf7[_0xf6ce24][_0xae63('0x10b')]('channel',_0xae63('0x111'));}return _0x87fbf7;}));_0x4c7d4e[_0xae63('0x4b')](_0x343f71[_0xae63('0x112')]()[_0xae63('0x28')](function(_0x52fdfd){for(var _0xcd1765=0x0;_0xcd1765<_0x52fdfd[_0xae63('0x4a')];_0xcd1765++){_0x52fdfd[_0xcd1765][_0xae63('0x10b')](_0xae63('0x9c'),_0xae63('0x113'));}return _0x52fdfd;}));_0x4c7d4e[_0xae63('0x4b')](_0x343f71[_0xae63('0x114')]()[_0xae63('0x28')](function(_0x12da70){for(var _0x351d2c=0x0;_0x351d2c<_0x12da70[_0xae63('0x4a')];_0x351d2c++){_0x12da70[_0x351d2c][_0xae63('0x10b')](_0xae63('0x9c'),_0xae63('0x115'));}return _0x12da70;}));_0x4c7d4e['push'](_0x343f71[_0xae63('0x116')]()['then'](function(_0x20482b){for(var _0x42c7ac=0x0;_0x42c7ac<_0x20482b[_0xae63('0x4a')];_0x42c7ac++){_0x20482b[_0x42c7ac][_0xae63('0x10b')]('channel',_0xae63('0x117'));}return _0x20482b;}));return BPromise['all'](_0x4c7d4e);})[_0xae63('0x28')](function(_0x17ddf8){var _0x14c197=_[_0xae63('0x118')](_0x17ddf8);_0x4c7d4e=[];return db[_0xae63('0x6c')][_0xae63('0x119')](function(_0x12a4df){for(var _0x3624c2=0x0;_0x3624c2<_0x14c197[_0xae63('0x4a')];_0x3624c2++){_0x4c7d4e[_0xae63('0x4b')](_0x14c197[_0x3624c2][_0xae63('0x11a')](_0x49ff83['id']),{'transaction':_0x12a4df});}return BPromise[_0xae63('0x51')](_0x4c7d4e)[_0xae63('0x28')](function(){if(_0x49ff83[_0xae63('0xa8')]){return BPromise[_0xae63('0x8a')](_[_0xae63('0x31')](_0x14c197,function(_0xf857de){return _0xf857de['getDataValue'](_0xae63('0x9c'))==='Voice';}),function(_0x514c01){return db[_0xae63('0xd4')]['upsert']({'membername':_0x49ff83[_0xae63('0x37')],'UserId':_0x49ff83['id'],'queue_name':_0x514c01[_0xae63('0x37')],'VoiceQueueId':_0x514c01['id'],'interface':_['isNil'](_0x49ff83['interface'])?util[_0xae63('0xe7')](_0xae63('0xaa'),_0x49ff83[_0xae63('0x37')]):_0x49ff83[_0xae63('0xa9')],'paused':_0x49ff83['voicePause']||![],'penalty':_0x49ff83[_0xae63('0xab')]},{'transaction':_0x12a4df});});}else{return;}})[_0xae63('0x28')](function(){for(var _0x183fd1=0x0;_0x183fd1<_0x14c197[_0xae63('0x4a')];_0x183fd1++){var _0x25573c=_0x14c197[_0x183fd1][_0xae63('0x11b')](_0xae63('0x9c'));var _0x31e0c0=_0x25573c+_0xae63('0xb0');socket['emit'](_0xae63('0x2d')+_0x25573c+_0xae63('0xa5'),{'UserId':_0x49ff83['id'],['queueField']:_0x14c197[_0x183fd1]['id']});}});});})[_0xae63('0x28')](function(){db[_0xae63('0x11c')]['findOne']({'where':{'teamId':_0x471575['id']}})[_0xae63('0x28')](function(_0x4f353a){if(_0x4f353a){db[_0xae63('0x11d')][_0xae63('0x7d')]({'UserId':_0x365c69[_0xae63('0x53')]['id'],'VoicePrefixId':_0x4f353a['VoicePrefixId']});}});});}});}})['then'](respondWithStatusCode(_0x494bed,null))[_0xae63('0x1d')](handleError(_0x494bed,null));};exports[_0xae63('0x11e')]=function(_0x5ef8ce,_0x1e2b53){return db[_0xae63('0x40')][_0xae63('0x95')]({'where':{'id':_0x5ef8ce['params']['id']}})['then'](handleEntityNotFound(_0x1e2b53,null))[_0xae63('0x28')](function(_0x28dfc5){if(_0x28dfc5){var _0x2b5662=_0x28dfc5['get']({'plain':!![]});var _0xbe1625=_0x5ef8ce[_0xae63('0x41')][_0xae63('0x63')];return _0x28dfc5[_0xae63('0x11e')](_0xbe1625)[_0xae63('0x28')](function(){for(var _0x9fa639=0x0;_0x9fa639<_0xbe1625[_0xae63('0x4a')];_0x9fa639++){var _0x499f65=[];var _0x39b180={};db[_0xae63('0x107')][_0xae63('0x95')]({'where':{'id':_0xbe1625[_0x9fa639]}})[_0xae63('0x28')](function(_0x5b578b){_0x39b180=_0x5b578b[_0xae63('0x4c')];_0x499f65[_0xae63('0x4b')](_0x5b578b['getVoiceQueues']()[_0xae63('0x28')](function(_0x452fbe){for(var _0x234ea6=0x0;_0x234ea6<_0x452fbe['length'];_0x234ea6++){_0x452fbe[_0x234ea6]['setDataValue'](_0xae63('0x9c'),_0xae63('0x10c'));}return _0x452fbe;}));_0x499f65[_0xae63('0x4b')](_0x5b578b[_0xae63('0x10d')]()['then'](function(_0x138714){for(var _0x491c47=0x0;_0x491c47<_0x138714['length'];_0x491c47++){_0x138714[_0x491c47]['setDataValue'](_0xae63('0x9c'),_0xae63('0x10e'));}return _0x138714;}));_0x499f65[_0xae63('0x4b')](_0x5b578b[_0xae63('0x10f')]()[_0xae63('0x28')](function(_0x2a6b60){for(var _0x1bbe39=0x0;_0x1bbe39<_0x2a6b60[_0xae63('0x4a')];_0x1bbe39++){_0x2a6b60[_0x1bbe39][_0xae63('0x10b')]('channel',_0xae63('0x11f'));}return _0x2a6b60;}));_0x499f65['push'](_0x5b578b[_0xae63('0x110')]()[_0xae63('0x28')](function(_0x32ce47){for(var _0x55775a=0x0;_0x55775a<_0x32ce47[_0xae63('0x4a')];_0x55775a++){_0x32ce47[_0x55775a]['setDataValue'](_0xae63('0x9c'),'Sms');}return _0x32ce47;}));_0x499f65['push'](_0x5b578b[_0xae63('0x112')]()[_0xae63('0x28')](function(_0x1fb140){for(var _0x269651=0x0;_0x269651<_0x1fb140[_0xae63('0x4a')];_0x269651++){_0x1fb140[_0x269651][_0xae63('0x10b')](_0xae63('0x9c'),'Whatsapp');}return _0x1fb140;}));_0x499f65[_0xae63('0x4b')](_0x5b578b[_0xae63('0x114')]()['then'](function(_0x21edb3){for(var _0x40f9aa=0x0;_0x40f9aa<_0x21edb3['length'];_0x40f9aa++){_0x21edb3[_0x40f9aa][_0xae63('0x10b')](_0xae63('0x9c'),_0xae63('0x115'));}return _0x21edb3;}));_0x499f65[_0xae63('0x4b')](_0x5b578b[_0xae63('0x116')]()['then'](function(_0x43fc52){for(var _0x39b0ae=0x0;_0x39b0ae<_0x43fc52[_0xae63('0x4a')];_0x39b0ae++){_0x43fc52[_0x39b0ae]['setDataValue'](_0xae63('0x9c'),_0xae63('0x117'));}return _0x43fc52;}));return BPromise[_0xae63('0x51')](_0x499f65);})[_0xae63('0x28')](function(_0x375374){var _0x1e9726=_['flatten'](_0x375374);_0x499f65=[];return db[_0xae63('0x6c')][_0xae63('0x119')](function(_0x5c5071){for(var _0x4d8e44=0x0;_0x4d8e44<_0x1e9726[_0xae63('0x4a')];_0x4d8e44++){_0x499f65[_0xae63('0x4b')](_0x1e9726[_0x4d8e44][_0xae63('0x120')](_0x2b5662['id']),{'transaction':_0x5c5071});}return BPromise['all'](_0x499f65)['then'](function(){if(_0x2b5662[_0xae63('0xa8')]){return BPromise['each'](_[_0xae63('0x31')](_0x1e9726,function(_0x65700c){return _0x65700c[_0xae63('0x11b')]('channel')===_0xae63('0x10c');}),function(_0x34d28a){return db[_0xae63('0xd4')]['destroy']({'where':{'VoiceQueueId':_0x34d28a['id'],'UserId':_0x2b5662['id']},'transaction':_0x5c5071});});}else{return;}})['then'](function(){db[_0xae63('0x11c')][_0xae63('0x95')]({'where':{'teamId':_0x39b180['id']}})[_0xae63('0x28')](function(_0x1b9d5b){if(_0x1b9d5b){return db[_0xae63('0x11d')][_0xae63('0x27')]({'where':{'UserId':_0x2b5662['id'],'VoicePrefixId':_0x1b9d5b[_0xae63('0x4c')][_0xae63('0x121')]}});}});})[_0xae63('0x28')](function(){for(var _0x477cdc=0x0;_0x477cdc<_0x1e9726[_0xae63('0x4a')];_0x477cdc++){var _0x5b24f0=_0x1e9726[_0x477cdc][_0xae63('0x11b')](_0xae63('0x9c'));var _0x5b9991=_0x5b24f0+'QueueId';socket[_0xae63('0xa3')](_0xae63('0x2d')+_0x5b24f0+_0xae63('0xb1'),{'UserId':_0x2b5662['id'],['queueField']:_0x1e9726[_0x477cdc]['id']});}});});});}});}})[_0xae63('0x28')](respondWithStatusCode(_0x1e2b53,null))[_0xae63('0x1d')](handleError(_0x1e2b53,null));};exports[_0xae63('0x122')]=function(_0x391494,_0x40a216){var _0x17459c={};var _0x3120b0={};var _0x4f29ba;var _0xc095a1;return db[_0xae63('0x40')]['findOne']({'where':{'id':_0x391494[_0xae63('0x53')]['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x40a216,null))[_0xae63('0x28')](function(_0x4f3f4f){if(_0x4f3f4f){_0x4f29ba=_0x4f3f4f;_0x3120b0[_0xae63('0x54')]=_['keys'](db[_0xae63('0xcc')][_0xae63('0x3b')]);_0x3120b0[_0xae63('0x41')]=_[_0xae63('0x56')](_0x391494[_0xae63('0x41')]);_0x3120b0[_0xae63('0x57')]=_[_0xae63('0xc6')](_0x3120b0['model'],_0x3120b0[_0xae63('0x41')]);_0x17459c[_0xae63('0x46')]=_['intersection'](_0x3120b0[_0xae63('0x54')],qs[_0xae63('0x58')](_0x391494[_0xae63('0x41')][_0xae63('0x58')]));_0x17459c['attributes']=_0x17459c[_0xae63('0x46')][_0xae63('0x4a')]?_0x17459c[_0xae63('0x46')]:_0x3120b0[_0xae63('0x54')];_0x17459c['order']=qs[_0xae63('0xc8')](_0x391494[_0xae63('0x41')][_0xae63('0xc8')]);_0x17459c[_0xae63('0x3f')]=qs['filters'](_[_0xae63('0xc9')](_0x391494[_0xae63('0x41')],_0x3120b0[_0xae63('0x57')]));if(_0x391494[_0xae63('0x41')][_0xae63('0x31')]){_0x17459c[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x17459c['where'],{'$or':_[_0xae63('0x33')](_0x17459c[_0xae63('0x46')],function(_0x8cea86){var _0xd69502={};_0xd69502[_0x8cea86]={'$like':'%'+_0x391494['query'][_0xae63('0x31')]+'%'};return _0xd69502;})});}_0x17459c=_[_0xae63('0x5a')]({},_0x17459c,_0x391494[_0xae63('0x5b')]);return _0x4f29ba['getLists'](_0x17459c);}})[_0xae63('0x28')](function(_0x5db998){if(_0x5db998){_0xc095a1=_0x5db998[_0xae63('0x4a')];if(!_0x391494[_0xae63('0x41')]['hasOwnProperty'](_0xae63('0xd1'))){_0x17459c[_0xae63('0x23')]=qs[_0xae63('0x23')](_0x391494['query'][_0xae63('0x23')]);_0x17459c['offset']=qs['offset'](_0x391494[_0xae63('0x41')]['offset']);}return _0x4f29ba[_0xae63('0x122')](_0x17459c);}})[_0xae63('0x28')](function(_0x447fb0){if(_0x447fb0){return _0x447fb0?{'count':_0xc095a1,'rows':_0x447fb0}:null;}})['then'](respondWithResult(_0x40a216,null))['catch'](handleError(_0x40a216,null));};exports['getAgents']=function(_0x44c4ed,_0x4827ba){var _0x1daf43={};var _0x5872af={};var _0x3e69a1;return db[_0xae63('0x40')]['findOne']({'where':{'id':_0x44c4ed[_0xae63('0x53')]['id']}})[_0xae63('0x28')](handleEntityNotFound(_0x4827ba,null))[_0xae63('0x28')](function(_0x803cb8){if(_0x803cb8){_0x3e69a1=_0x803cb8;_0x5872af['model']=_[_0xae63('0x56')](db['User'][_0xae63('0x3b')]);_0x5872af['query']=_[_0xae63('0x56')](_0x44c4ed[_0xae63('0x41')]);_0x5872af[_0xae63('0x57')]=_[_0xae63('0xc6')](_0x5872af[_0xae63('0x54')],_0x5872af[_0xae63('0x41')]);_0x1daf43[_0xae63('0x46')]=_[_0xae63('0xc6')](_0x5872af[_0xae63('0x54')],qs[_0xae63('0x58')](_0x44c4ed[_0xae63('0x41')][_0xae63('0x58')]));_0x1daf43['attributes']=_0x1daf43[_0xae63('0x46')][_0xae63('0x4a')]?_0x1daf43[_0xae63('0x46')]:_0x5872af[_0xae63('0x54')];_0x1daf43[_0xae63('0xc7')]=qs[_0xae63('0xc8')](_0x44c4ed[_0xae63('0x41')][_0xae63('0xc8')]);_0x1daf43[_0xae63('0x3f')]=qs[_0xae63('0x57')](_[_0xae63('0xc9')](_0x44c4ed[_0xae63('0x41')],_0x5872af[_0xae63('0x57')]));if(_0x44c4ed[_0xae63('0x41')][_0xae63('0x31')]){_0x1daf43[_0xae63('0x3f')]=_[_0xae63('0x5a')](_0x1daf43[_0xae63('0x3f')],{'$or':_['map'](_0x1daf43['attributes'],function(_0x417fc5){var _0x30bc69={};_0x30bc69[_0x417fc5]={'$like':'%'+_0x44c4ed[_0xae63('0x41')]['filter']+'%'};return _0x30bc69;})});}_0x1daf43[_0xae63('0x54')]=db[_0xae63('0x40')];_0x1daf43['as']=_0xae63('0x2e');_0x1daf43=_['merge']({},_0x1daf43,_0x44c4ed[_0xae63('0x5b')]);return _0x3e69a1[_0xae63('0x10a')]({'include':[_0x1daf43]});}})['then'](function(_0x1d6f55){if(_0x1d6f55){var _0x9ab6c1={},_0xfde77b=[];for(var _0x364ed9=0x0;_0x364ed9<_0x1d6f55[_0xae63('0x4a')];_0x364ed9+=0x1){for(var _0x5294df=0x0,_0x299b15;_0x5294df<_0x1d6f55[_0x364ed9][_0xae63('0x2e')]['length'];_0x5294df+=0x1){_0x299b15=_0x1d6f55[_0x364ed9]['Agents'][_0x5294df][_0xae63('0x29')]({'plain':!![]});_0x9ab6c1[_0x299b15['id']]=_0x299b15;}}_0x9ab6c1=_[_0xae63('0x123')](_0x9ab6c1);for(var _0x79e0bd=qs[_0xae63('0x22')](_0x44c4ed[_0xae63('0x41')][_0xae63('0x22')]);_0x79e0bd<_0x9ab6c1[_0xae63('0x4a')]&&_0xfde77b[_0xae63('0x4a')]=_0x11de1a['agents']){throw new Error(_0x355b('0x50'));}})[_0x355b('0xf')](function(){if(_0x423900){return db[_0x355b('0x3a')][_0x355b('0x46')]({'where':{'membername':_0x423900[_0x355b('0x26')]},'individualHooks':!![]});}})[_0x355b('0xf')](function(){if(_0x423900){return _0x423900['getVoiceQueues']({'raw':!![]});}})[_0x355b('0xf')](function(_0x31c386){if(_0x423900){if(_0x31c386){var _0x566640=[];_0x168ee3=_0x31c386;if(_0x168ee3[_0x355b('0x47')]){for(var _0x1aae62=0x0;_0x1aae62<_0x168ee3[_0x355b('0x47')];_0x1aae62++){_0x566640[_0x355b('0x2d')](db['UserVoiceQueueRt'][_0x355b('0x51')]({'membername':_0x423900[_0x355b('0x26')],'UserId':_0x423900['id'],'queue_name':_0x168ee3[_0x1aae62]['name'],'VoiceQueueId':_0x168ee3[_0x1aae62]['id'],'interface':_0x44cee0,'paused':_0x423900['loginInPause']||![],'penalty':_0x168ee3[_0x1aae62][_0x355b('0x52')]||0x0}));}return BPromise[_0x355b('0x43')](_0x566640);}}}})[_0x355b('0xf')](function(){if(_0x423900){return db['MemberReport']['findAll']({'where':{'membername':_0x423900[_0x355b('0x26')],'exitAt':null}});}})[_0x355b('0xf')](function(_0x362f4c){if(_0x423900){if(_0x362f4c&&_0x362f4c[_0x355b('0x47')]){var _0x3c7c5c=[];_0x362f4c['forEach'](function(_0x426ec4){_0x3c7c5c['push'](_0x426ec4[_0x355b('0x35')]({'exitAt':moment()[_0x355b('0x2a')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x355b('0x43')](_0x3c7c5c);}}})[_0x355b('0xf')](function(_0x4b5e30){if(_0x423900){var _0x2be801=[];var _0x536e31=[];var _0x4c7a79=utils[_0x355b('0x53')]();var _0x4af451={'membername':_0x423900['name'],'interface':_0x44cee0,'enterAt':moment()[_0x355b('0x2a')](_0x355b('0x2b')),'role':_0x423900['role'],'internal':_0x423900[_0x355b('0x27')]};_0x4c7a79['forEach'](function(_0x228ce1){_0x2be801[_0x355b('0x2d')](_[_0x355b('0x54')]({'channel':_0x228ce1,'type':_0x355b('0x55'),'data1':'callysquare','data2':_0x44cee0},_0x4af451));if(_0x423900[_0x355b('0x4b')]){_0x536e31['push'](_['merge']({'channel':_0x228ce1,'type':_0x355b('0x29'),'data1':'LOGININPAUSE'},_0x4af451));}});return db['MemberReport'][_0x355b('0x34')](_0x2be801[_0x355b('0x56')](_0x536e31),{'individualHooks':!![]});}})['then'](function(){if(_0x423900){return _0x423900[_0x355b('0x35')]({'online':!![],'lastLoginAt':moment()[_0x355b('0x2a')](_0x355b('0x2b')),'voicePause':_0x423900[_0x355b('0x4b')]||![],'mailPause':_0x423900[_0x355b('0x4b')]||![],'chatPause':_0x423900[_0x355b('0x4b')]||![],'faxPause':_0x423900[_0x355b('0x4b')]||![],'smsPause':_0x423900[_0x355b('0x4b')]||![],'openchannelPause':_0x423900[_0x355b('0x4b')]||![],'pauseType':_0x423900[_0x355b('0x4b')]?_0x355b('0x57'):null,'lastPauseAt':moment()['format'](_0x355b('0x2b')),'interface':_0x44cee0});}})[_0x355b('0xf')](function(_0x4e8f9e){_0x556fe1(_0x4e8f9e);})[_0x355b('0x19')](function(_0x183809){_0x453a47(_0x1f531f[_0x355b('0x12')](0x1f4,_0x183809['message']));});});}; \ No newline at end of file +var _0x4f5d=['interface','SIP/%s','name','body','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','findOne','isValidChannel','channel','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s','Pause','forEach','all','LogoutUser','destroy','LoginUser','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','getChannels','LOGIN','concat','loginInPause','LOGININPAUSE','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','options','raw','attributes','limit','map','include','model','ShowUser','find','where','debug','internal','UserVoiceQueueRt','update','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push'];(function(_0x3987ac,_0xb8feaa){var _0x2bcf07=function(_0x4b5fac){while(--_0x4b5fac){_0x3987ac['push'](_0x3987ac['shift']());}};_0x2bcf07(++_0xb8feaa);}(_0x4f5d,0x19d));var _0xd4f5=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x4f5d[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xd4f5('0x0'));var util=require('util');var moment=require(_0xd4f5('0x1'));var BPromise=require('bluebird');var rs=require(_0xd4f5('0x2'));var fs=require('fs');var Redis=require(_0xd4f5('0x3'));var db=require(_0xd4f5('0x4'))['db'];var utils=require(_0xd4f5('0x5'));var logger=require(_0xd4f5('0x6'))(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var jayson=require(_0xd4f5('0x9'));var client=jayson[_0xd4f5('0xa')][_0xd4f5('0xb')]({'port':0x232a});config[_0xd4f5('0xc')]=_[_0xd4f5('0xd')](config[_0xd4f5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4f5('0xe'))(new Redis(config['redis']));require(_0xd4f5('0xf'))[_0xd4f5('0x10')](socket);function respondWithRpcPromise(_0x3628d3,_0x4b31a2,_0x5ae493){return new BPromise(function(_0x1fd813,_0x4b7660){return client['request'](_0x3628d3,_0x5ae493)[_0xd4f5('0x11')](function(_0xe70299){logger[_0xd4f5('0x12')](_0xd4f5('0x13'),_0x4b31a2,_0xd4f5('0x14'));logger['debug'](_0xd4f5('0x15'),_0x4b31a2,_0xd4f5('0x14'),JSON[_0xd4f5('0x16')](_0xe70299));if(_0xe70299['error']){if(_0xe70299[_0xd4f5('0x17')][_0xd4f5('0x18')]===0x1f4){logger[_0xd4f5('0x17')](_0xd4f5('0x13'),_0x4b31a2,_0xe70299['error'][_0xd4f5('0x19')]);return _0x4b7660(_0xe70299[_0xd4f5('0x17')]['message']);}logger[_0xd4f5('0x17')]('User,\x20%s,\x20%s',_0x4b31a2,_0xe70299[_0xd4f5('0x17')][_0xd4f5('0x19')]);return _0x1fd813(_0xe70299[_0xd4f5('0x17')][_0xd4f5('0x19')]);}else{logger[_0xd4f5('0x12')](_0xd4f5('0x13'),_0x4b31a2,'request\x20sent');_0x1fd813(_0xe70299[_0xd4f5('0x1a')][_0xd4f5('0x19')]);}})[_0xd4f5('0x1b')](function(_0xa3a39a){logger[_0xd4f5('0x17')]('User,\x20%s,\x20%s',_0x4b31a2,_0xa3a39a);_0x4b7660(_0xa3a39a);});});}exports[_0xd4f5('0x1c')]=function(_0x1519c3){var _0xed93c3=this;return new Promise(function(_0x16a496,_0x5b7ae7){return db[_0xd4f5('0x1d')]['findAll']({'raw':_0x1519c3[_0xd4f5('0x1e')]?_0x1519c3['options'][_0xd4f5('0x1f')]===undefined?!![]:![]:!![],'where':_0x1519c3[_0xd4f5('0x1e')]?_0x1519c3[_0xd4f5('0x1e')]['where']||null:null,'attributes':_0x1519c3[_0xd4f5('0x1e')]?_0x1519c3[_0xd4f5('0x1e')][_0xd4f5('0x20')]||null:null,'limit':_0x1519c3[_0xd4f5('0x1e')]?_0x1519c3[_0xd4f5('0x1e')][_0xd4f5('0x21')]||null:null,'include':_0x1519c3['options']?_0x1519c3[_0xd4f5('0x1e')]['include']?_[_0xd4f5('0x22')](_0x1519c3[_0xd4f5('0x1e')][_0xd4f5('0x23')],function(_0x1e2aa3){return{'model':db[_0x1e2aa3[_0xd4f5('0x24')]],'as':_0x1e2aa3['as'],'attributes':_0x1e2aa3[_0xd4f5('0x20')],'include':_0x1e2aa3[_0xd4f5('0x23')]?_['map'](_0x1e2aa3[_0xd4f5('0x23')],function(_0x562c4c){return{'model':db[_0x562c4c[_0xd4f5('0x24')]],'as':_0x562c4c['as'],'attributes':_0x562c4c[_0xd4f5('0x20')],'include':_0x562c4c[_0xd4f5('0x23')]?_[_0xd4f5('0x22')](_0x562c4c[_0xd4f5('0x23')],function(_0x3795d7){return{'model':db[_0x3795d7['model']],'as':_0x3795d7['as'],'attributes':_0x3795d7[_0xd4f5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd4f5('0x11')](function(_0x427b6e){logger[_0xd4f5('0x12')]('GetUser',_0x1519c3);logger['debug']('GetUser',_0x1519c3,JSON['stringify'](_0x427b6e));_0x16a496(_0x427b6e);})[_0xd4f5('0x1b')](function(_0xb6421){logger[_0xd4f5('0x17')](_0xd4f5('0x1c'),_0xb6421['message'],_0x1519c3);_0x5b7ae7(_0xed93c3[_0xd4f5('0x17')](0x1f4,_0xb6421[_0xd4f5('0x19')]));});});};exports[_0xd4f5('0x25')]=function(_0x417479){var _0x3f6463=this;return new Promise(function(_0x80530e,_0x213a5c){return db[_0xd4f5('0x1d')][_0xd4f5('0x26')]({'raw':_0x417479[_0xd4f5('0x1e')]?_0x417479[_0xd4f5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x417479[_0xd4f5('0x1e')]?_0x417479[_0xd4f5('0x1e')][_0xd4f5('0x27')]||null:null,'attributes':_0x417479['options']?_0x417479['options'][_0xd4f5('0x20')]||null:null,'include':_0x417479[_0xd4f5('0x1e')]?_0x417479[_0xd4f5('0x1e')][_0xd4f5('0x23')]?_[_0xd4f5('0x22')](_0x417479[_0xd4f5('0x1e')][_0xd4f5('0x23')],function(_0x12b1fd){return{'model':db[_0x12b1fd[_0xd4f5('0x24')]],'as':_0x12b1fd['as'],'attributes':_0x12b1fd[_0xd4f5('0x20')],'include':_0x12b1fd['include']?_['map'](_0x12b1fd[_0xd4f5('0x23')],function(_0x19b7a7){return{'model':db[_0x19b7a7[_0xd4f5('0x24')]],'as':_0x19b7a7['as'],'attributes':_0x19b7a7['attributes'],'include':_0x19b7a7[_0xd4f5('0x23')]?_[_0xd4f5('0x22')](_0x19b7a7[_0xd4f5('0x23')],function(_0x2a1a78){return{'model':db[_0x2a1a78[_0xd4f5('0x24')]],'as':_0x2a1a78['as'],'attributes':_0x2a1a78[_0xd4f5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dec76){logger[_0xd4f5('0x12')]('ShowUser',_0x417479);logger[_0xd4f5('0x28')]('ShowUser',_0x417479,JSON['stringify'](_0x4dec76));_0x80530e(_0x4dec76);})[_0xd4f5('0x1b')](function(_0x2159c5){logger[_0xd4f5('0x17')](_0xd4f5('0x25'),_0x2159c5[_0xd4f5('0x19')],_0x417479);_0x213a5c(_0x3f6463['error'](0x1f4,_0x2159c5[_0xd4f5('0x19')]));});});};exports['PauseUser']=function(_0x246542){var _0x47e0ad=this;return new Promise(function(_0x2673f5,_0x4eb2e2){var _0xe04d9;return db['User'][_0xd4f5('0x26')]({'where':_0x246542[_0xd4f5('0x1e')][_0xd4f5('0x27')]||{},'attributes':['id','name','role',_0xd4f5('0x29'),'interface']})[_0xd4f5('0x11')](function(_0x292de0){if(_0x292de0){_0xe04d9=_0x292de0;return db[_0xd4f5('0x2a')][_0xd4f5('0x2b')]({'paused':0x1},{'where':{'UserId':_0xe04d9['id']},'individualHooks':!![]});}})[_0xd4f5('0x11')](function(){if(_0xe04d9){return db[_0xd4f5('0x2c')][_0xd4f5('0x2d')]({'where':{'membername':_0xe04d9['name'],'type':_0xd4f5('0x2e'),'exitAt':null}});}})[_0xd4f5('0x11')](function(_0x339d8a){if(_0xe04d9){if(_0x339d8a&&_0x339d8a[_0xd4f5('0x2f')]){var _0x4b092a=moment()[_0xd4f5('0x30')](_0xd4f5('0x31'));for(var _0x24870f=0x0,_0xd9408c=_0x339d8a[_0xd4f5('0x2f')];_0x24870f<_0xd9408c;_0x24870f++){_0x339d8a[_0x24870f][_0xd4f5('0x32')]({'exitAt':_0x4b092a});}}}})[_0xd4f5('0x11')](function(){if(_0xe04d9){var _0x77f5d8=[];var _0x15024e=utils['getChannels']();_0x15024e['forEach'](function(_0x336149){_0x77f5d8[_0xd4f5('0x33')]({'channel':_0x336149,'membername':_0xe04d9['name'],'interface':_['isNil'](_0xe04d9[_0xd4f5('0x34')])?util[_0xd4f5('0x30')](_0xd4f5('0x35'),_0xe04d9[_0xd4f5('0x36')]):_0xe04d9[_0xd4f5('0x34')],'type':_0xd4f5('0x2e'),'enterAt':moment()[_0xd4f5('0x30')](_0xd4f5('0x31')),'data1':_0x246542[_0xd4f5('0x37')]['type']||_0xd4f5('0x38'),'role':_0xe04d9[_0xd4f5('0x39')],'internal':_0xe04d9['internal'],'uniqueid':_0x246542[_0xd4f5('0x37')][_0xd4f5('0x3a')]||null});});return db[_0xd4f5('0x2c')][_0xd4f5('0x3b')](_0x77f5d8,{'individualHooks':!![]});}})[_0xd4f5('0x11')](function(){if(_0xe04d9){return _0xe04d9[_0xd4f5('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x246542[_0xd4f5('0x37')]['type']||_0xd4f5('0x38'),'lastPauseAt':moment()[_0xd4f5('0x30')](_0xd4f5('0x31'))});}})['then'](function(_0xd1806e){_0x2673f5(_0xd1806e);})['catch'](function(_0x6440e1){_0x4eb2e2(_0x47e0ad[_0xd4f5('0x17')](0x1f4,_0x6440e1[_0xd4f5('0x19')]));});});};exports['UnpauseUser']=function(_0x339378){var _0x2fc56f=this;return new Promise(function(_0x5024b6,_0x48a7b){var _0x2c936f;return db[_0xd4f5('0x1d')][_0xd4f5('0x3c')]({'where':_0x339378[_0xd4f5('0x1e')]['where']||{},'attributes':['id',_0xd4f5('0x36')]})[_0xd4f5('0x11')](function(_0x9e503f){if(_0x9e503f){_0x2c936f=_0x9e503f;if(_0x339378['body']['channel']&&!utils[_0xd4f5('0x3d')](_0x339378['body'][_0xd4f5('0x3e')])){throw new Error('Unknown\x20channel');}switch(_0x339378[_0xd4f5('0x37')][_0xd4f5('0x3e')]){case'voice':return db['UserVoiceQueueRt'][_0xd4f5('0x2b')]({'paused':0x0},{'where':{'UserId':_0x2c936f['id']}})[_0xd4f5('0x11')](function(){return db[_0xd4f5('0x2c')]['find']({'where':{'channel':_0x339378[_0xd4f5('0x37')][_0xd4f5('0x3e')],'membername':_0x2c936f['name'],'type':_0xd4f5('0x2e'),'exitAt':null}});})['then'](function(_0xd6b8ad){if(_0xd6b8ad){return _0xd6b8ad[_0xd4f5('0x2b')]({'exitAt':moment()[_0xd4f5('0x30')](_0xd4f5('0x31')),'data2':_0xd4f5('0x3f')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2c936f[_0xd4f5('0x2b')]({'voicePause':![]});});case _0xd4f5('0x40'):case _0xd4f5('0x41'):case _0xd4f5('0x42'):case _0xd4f5('0x43'):case _0xd4f5('0x44'):case _0xd4f5('0x45'):return db[_0xd4f5('0x2c')][_0xd4f5('0x26')]({'where':{'channel':_0x339378[_0xd4f5('0x37')]['channel'],'membername':_0x2c936f['name'],'type':_0xd4f5('0x2e'),'exitAt':null}})[_0xd4f5('0x11')](function(_0x330201){return _0x330201['update']({'exitAt':moment()[_0xd4f5('0x30')](_0xd4f5('0x31')),'data2':_0xd4f5('0x3f')},{'individualHooks':!![]});})[_0xd4f5('0x11')](function(){var _0x1a197e={};_[_0xd4f5('0x46')](_0x1a197e,util[_0xd4f5('0x30')](_0xd4f5('0x47'),_0x339378[_0xd4f5('0x37')]['channel'],_0xd4f5('0x48')),![]);return _0x2c936f[_0xd4f5('0x2b')](_0x1a197e);});default:return db[_0xd4f5('0x2a')][_0xd4f5('0x2b')]({'paused':0x0},{'where':{'UserId':_0x2c936f['id']}})[_0xd4f5('0x11')](function(){return db[_0xd4f5('0x2c')][_0xd4f5('0x2d')]({'where':{'membername':_0x2c936f['name'],'type':_0xd4f5('0x2e'),'exitAt':null}});})[_0xd4f5('0x11')](function(_0x4ce31d){var _0x1de7f1=[];_0x4ce31d[_0xd4f5('0x49')](function(_0x2c6f65){_0x1de7f1[_0xd4f5('0x33')](_0x2c6f65['update']({'exitAt':moment()[_0xd4f5('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd4f5('0x3f')}));});return BPromise[_0xd4f5('0x4a')](_0x1de7f1);})[_0xd4f5('0x11')](function(){return _0x2c936f[_0xd4f5('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xd4f5('0x11')](function(_0x107399){_0x5024b6(_0x107399);})[_0xd4f5('0x1b')](function(_0x55af6c){_0x48a7b(_0x2fc56f['error'](0x1f4,_0x55af6c[_0xd4f5('0x19')]));});});};exports[_0xd4f5('0x4b')]=function(_0x5f50f2){var _0x1ee242=this;return new Promise(function(_0x18382e,_0x4c6a5d){var _0x13f93d;return db['User'][_0xd4f5('0x3c')]({'where':_0x5f50f2['options'][_0xd4f5('0x27')]||{},'attributes':['id','name']})[_0xd4f5('0x11')](function(_0x306189){if(_0x306189){_0x13f93d=_0x306189;return db[_0xd4f5('0x2a')][_0xd4f5('0x4c')]({'where':{'membername':_0x13f93d[_0xd4f5('0x36')]},'individualHooks':!![]});}})[_0xd4f5('0x11')](function(){if(_0x13f93d){return db[_0xd4f5('0x2c')][_0xd4f5('0x2d')]({'where':{'membername':_0x13f93d[_0xd4f5('0x36')],'exitAt':null}});}})[_0xd4f5('0x11')](function(_0x40bfb6){if(_0x13f93d){if(_0x40bfb6&&_0x40bfb6['length']){var _0x2af9a6=[];_0x40bfb6[_0xd4f5('0x49')](function(_0x5de99a){_0x2af9a6[_0xd4f5('0x33')](_0x5de99a[_0xd4f5('0x2b')]({'exitAt':moment()[_0xd4f5('0x30')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd4f5('0x4a')](_0x2af9a6);}}})[_0xd4f5('0x11')](function(){if(_0x13f93d){return _0x13f93d[_0xd4f5('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd4f5('0x11')](function(_0x49ebbc){_0x18382e(_0x49ebbc);})[_0xd4f5('0x1b')](function(_0x3c3df1){_0x4c6a5d(_0x1ee242['error'](0x1f4,_0x3c3df1[_0xd4f5('0x19')]));});});};exports[_0xd4f5('0x4d')]=function(_0xe2b5f8){var _0x3fc475=this;return new Promise(function(_0x4c8659,_0x1d26bd){var _0x98a565;var _0x42e068;var _0x299c1c;var _0x46dd83;return db[_0xd4f5('0x1d')][_0xd4f5('0x3c')]({'where':_0xe2b5f8[_0xd4f5('0x1e')][_0xd4f5('0x27')]||{},'attributes':['id',_0xd4f5('0x36'),_0xd4f5('0x39'),_0xd4f5('0x4e'),_0xd4f5('0x4f'),'internal','loginInPause',_0xd4f5('0x34')]})['then'](function(_0x2ad929){if(_0x2ad929){_0x98a565=_0x2ad929;_0x46dd83=_0xe2b5f8[_0xd4f5('0x37')][_0xd4f5('0x34')]?_0xe2b5f8[_0xd4f5('0x37')][_0xd4f5('0x34')]:util[_0xd4f5('0x30')]('SIP/%s',_0x98a565['name']);return db[_0xd4f5('0x1d')][_0xd4f5('0x50')]({'where':{'role':_0xd4f5('0x51'),'online':!![],'id':{'$ne':_0x98a565['id']}}});}})[_0xd4f5('0x11')](function(_0x3a641b){if(_0x3a641b){_0x299c1c=_0x3a641b;return require(_0xd4f5('0x52'))[_0xd4f5('0x53')]();}})[_0xd4f5('0x11')](function(_0x32a497){if(_0x32a497&&_0x32a497[_0xd4f5('0x54')]&&_0x299c1c>=_0x32a497[_0xd4f5('0x54')]){throw new Error(_0xd4f5('0x55'));}})['then'](function(){if(_0x98a565){return db[_0xd4f5('0x2a')][_0xd4f5('0x4c')]({'where':{'membername':_0x98a565[_0xd4f5('0x36')]},'individualHooks':!![]});}})[_0xd4f5('0x11')](function(){if(_0x98a565){return _0x98a565['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1f75a){if(_0x98a565){if(_0x1f75a){var _0x3bdccb=[];_0x42e068=_0x1f75a;if(_0x42e068[_0xd4f5('0x2f')]){for(var _0x50435f=0x0;_0x50435f<_0x42e068[_0xd4f5('0x2f')];_0x50435f++){_0x3bdccb[_0xd4f5('0x33')](db['UserVoiceQueueRt'][_0xd4f5('0x56')]({'membername':_0x98a565[_0xd4f5('0x36')],'UserId':_0x98a565['id'],'queue_name':_0x42e068[_0x50435f]['name'],'VoiceQueueId':_0x42e068[_0x50435f]['id'],'interface':_0x46dd83,'paused':_0x98a565['loginInPause']||![],'penalty':_0x42e068[_0x50435f][_0xd4f5('0x57')]||0x0}));}return BPromise[_0xd4f5('0x4a')](_0x3bdccb);}}}})[_0xd4f5('0x11')](function(){if(_0x98a565){return db[_0xd4f5('0x2c')]['findAll']({'where':{'membername':_0x98a565[_0xd4f5('0x36')],'exitAt':null}});}})[_0xd4f5('0x11')](function(_0x3f42ae){if(_0x98a565){if(_0x3f42ae&&_0x3f42ae[_0xd4f5('0x2f')]){var _0x49a12f=[];_0x3f42ae[_0xd4f5('0x49')](function(_0x36351e){_0x49a12f['push'](_0x36351e[_0xd4f5('0x2b')]({'exitAt':moment()[_0xd4f5('0x30')](_0xd4f5('0x31'))}));});return BPromise[_0xd4f5('0x4a')](_0x49a12f);}}})['then'](function(_0x9102b3){if(_0x98a565){var _0x3550f3=[];var _0x3127ed=[];var _0x2452c6=utils[_0xd4f5('0x58')]();var _0x6b0bd0={'membername':_0x98a565[_0xd4f5('0x36')],'interface':_0x46dd83,'enterAt':moment()[_0xd4f5('0x30')](_0xd4f5('0x31')),'role':_0x98a565['role'],'internal':_0x98a565[_0xd4f5('0x29')]};_0x2452c6[_0xd4f5('0x49')](function(_0x3b8b96){_0x3550f3[_0xd4f5('0x33')](_['merge']({'channel':_0x3b8b96,'type':_0xd4f5('0x59'),'data1':'callysquare','data2':_0x46dd83},_0x6b0bd0));if(_0x98a565['loginInPause']){_0x3127ed['push'](_['merge']({'channel':_0x3b8b96,'type':_0xd4f5('0x2e'),'data1':'LOGININPAUSE'},_0x6b0bd0));}});return db['MemberReport'][_0xd4f5('0x3b')](_0x3550f3[_0xd4f5('0x5a')](_0x3127ed),{'individualHooks':!![]});}})[_0xd4f5('0x11')](function(){if(_0x98a565){return _0x98a565[_0xd4f5('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xd4f5('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x98a565['loginInPause']||![],'mailPause':_0x98a565[_0xd4f5('0x5b')]||![],'chatPause':_0x98a565[_0xd4f5('0x5b')]||![],'faxPause':_0x98a565[_0xd4f5('0x5b')]||![],'smsPause':_0x98a565[_0xd4f5('0x5b')]||![],'openchannelPause':_0x98a565['loginInPause']||![],'pauseType':_0x98a565['loginInPause']?_0xd4f5('0x5c'):null,'lastPauseAt':moment()[_0xd4f5('0x30')](_0xd4f5('0x31')),'interface':_0x46dd83});}})[_0xd4f5('0x11')](function(_0x3a3a55){_0x4c8659(_0x3a3a55);})[_0xd4f5('0x1b')](function(_0x186918){_0x1d26bd(_0x3fc475[_0xd4f5('0x17')](0x1f4,_0x186918[_0xd4f5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f500c99..fb9a3a6 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 _0x9afe=['length','user:','./user.events','save','removeListener'];(function(_0x1b3521,_0x1b4d61){var _0x2f2e97=function(_0x47fc9b){while(--_0x47fc9b){_0x1b3521['push'](_0x1b3521['shift']());}};_0x2f2e97(++_0x1b4d61);}(_0x9afe,0x1ab));var _0xe9af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9afe[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0xe9af('0x0'));var events=[_0xe9af('0x1'),'remove','update'];function createListener(_0x4b592d,_0x8d2dc0){return function(_0x5382c3){_0x8d2dc0['emit'](_0x4b592d,_0x5382c3);};}function removeListener(_0x506344,_0x426e9f){return function(){UserEvents[_0xe9af('0x2')](_0x506344,_0x426e9f);};}exports['register']=function(_0x74e37f){for(var _0x4c1cec=0x0,_0x22b848=events[_0xe9af('0x3')];_0x4c1cec<_0x22b848;_0x4c1cec++){var _0x18b814=events[_0x4c1cec];var _0x461766=createListener(_0xe9af('0x4')+_0x18b814,_0x74e37f);UserEvents['on'](_0x18b814,_0x461766);}}; \ No newline at end of file +var _0x0cd5=['update','emit','removeListener','register','length','user:','save','remove'];(function(_0x5cf43b,_0x32089c){var _0x2c24c1=function(_0x54ee9f){while(--_0x54ee9f){_0x5cf43b['push'](_0x5cf43b['shift']());}};_0x2c24c1(++_0x32089c);}(_0x0cd5,0x96));var _0x50cd=function(_0xf1402a,_0x187f5c){_0xf1402a=_0xf1402a-0x0;var _0x4f7ead=_0x0cd5[_0xf1402a];return _0x4f7ead;};'use strict';var UserEvents=require('./user.events');var events=[_0x50cd('0x0'),_0x50cd('0x1'),_0x50cd('0x2')];function createListener(_0x552ddd,_0x59181c){return function(_0x39bb05){_0x59181c[_0x50cd('0x3')](_0x552ddd,_0x39bb05);};}function removeListener(_0x3cffa3,_0x2342be){return function(){UserEvents[_0x50cd('0x4')](_0x3cffa3,_0x2342be);};}exports[_0x50cd('0x5')]=function(_0x16cd01){for(var _0x46decd=0x0,_0x14598f=events[_0x50cd('0x6')];_0x46decd<_0x14598f;_0x46decd++){var _0x39733b=events[_0x46decd];var _0x1d8f4c=createListener(_0x50cd('0x7')+_0x39733b,_0x16cd01);UserEvents['on'](_0x39733b,_0x1d8f4c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 90109cf..75f47ba 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1535e7,_0xa643a3){var _0x1fe0cf=function(_0x5cf6d6){while(--_0x5cf6d6){_0x1535e7['push'](_0x1535e7['shift']());}};_0x1fe0cf(++_0xa643a3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xcb91[_0x16539a];return _0x200796;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5697ae,_0x114064){var _0x73f04b=function(_0x2ec28d){while(--_0x2ec28d){_0x5697ae['push'](_0x5697ae['shift']());}};_0x73f04b(++_0x114064);}(_0xe706,0xa3));var _0x6e70=function(_0x901852,_0x1d74f6){_0x901852=_0x901852-0x0;var _0x18da1d=_0xe706[_0x901852];return _0x18da1d;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 8d437d1..0ff3edf 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 _0x3677=['sequelize','exports','INTEGER'];(function(_0x5dd72c,_0x50557f){var _0x5bffce=function(_0x5b3e78){while(--_0x5b3e78){_0x5dd72c['push'](_0x5dd72c['shift']());}};_0x5bffce(++_0x50557f);}(_0x3677,0x1e9));var _0x7367=function(_0x1c6551,_0x3fbc2e){_0x1c6551=_0x1c6551-0x0;var _0x3f7434=_0x3677[_0x1c6551];return _0x3f7434;};'use strict';var Sequelize=require(_0x7367('0x0'));module[_0x7367('0x1')]={'penalty':{'type':Sequelize[_0x7367('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xde92=['sequelize','INTEGER'];(function(_0x220988,_0x50abcc){var _0x57c6d1=function(_0x4984bc){while(--_0x4984bc){_0x220988['push'](_0x220988['shift']());}};_0x57c6d1(++_0x50abcc);}(_0xde92,0x19e));var _0x2de9=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xde92[_0x4d45c1];return _0x244478;};'use strict';var Sequelize=require(_0x2de9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2de9('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 498b63b..6b21681 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 _0x30d6=['moment','bluebird','request-promise','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x30d6,0x15d));var _0x630d=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0x30d6[_0x4b2cc6];return _0x3e0b08;};'use strict';var _=require(_0x630d('0x0'));var util=require('util');var logger=require(_0x630d('0x1'))(_0x630d('0x2'));var moment=require(_0x630d('0x3'));var BPromise=require(_0x630d('0x4'));var rp=require(_0x630d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x630d('0x6'));module[_0x630d('0x7')]=function(_0x45d3a5,_0x1164f6){return _0x45d3a5[_0x630d('0x8')](_0x630d('0x9'),attributes,{'tableName':_0x630d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93d0=['request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','api','moment','bluebird'];(function(_0x238f60,_0x52fccd){var _0x5c91ff=function(_0x44ea6b){while(--_0x44ea6b){_0x238f60['push'](_0x238f60['shift']());}};_0x5c91ff(++_0x52fccd);}(_0x93d0,0x18d));var _0x093d=function(_0x4ec74e,_0x14d343){_0x4ec74e=_0x4ec74e-0x0;var _0xf1ddd1=_0x93d0[_0x4ec74e];return _0xf1ddd1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x093d('0x0'));var moment=require(_0x093d('0x1'));var BPromise=require(_0x093d('0x2'));var rp=require(_0x093d('0x3'));var fs=require('fs');var path=require(_0x093d('0x4'));var rimraf=require(_0x093d('0x5'));var config=require(_0x093d('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x093d('0x7')]=function(_0x401c86,_0x656c34){return _0x401c86[_0x093d('0x8')](_0x093d('0x9'),attributes,{'tableName':'user_has_chat_queues','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 0dd897b..94dfacd 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 _0xe03d=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s'];(function(_0x4cf0cb,_0x5db361){var _0x3bc850=function(_0x214abf){while(--_0x214abf){_0x4cf0cb['push'](_0x4cf0cb['shift']());}};_0x3bc850(++_0x5db361);}(_0xe03d,0x1e3));var _0xde03=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xe03d[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xde03('0x0'));var util=require(_0xde03('0x1'));var moment=require(_0xde03('0x2'));var BPromise=require(_0xde03('0x3'));var rs=require(_0xde03('0x4'));var fs=require('fs');var Redis=require(_0xde03('0x5'));var db=require(_0xde03('0x6'))['db'];var utils=require(_0xde03('0x7'));var logger=require('../../config/logger')(_0xde03('0x8'));var config=require(_0xde03('0x9'));var jayson=require(_0xde03('0xa'));var client=jayson['client'][_0xde03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x593f4f,_0xe47e82,_0x1e45cd){return new BPromise(function(_0x1bebb5,_0x2646ac){return client[_0xde03('0xc')](_0x593f4f,_0x1e45cd)[_0xde03('0xd')](function(_0x4b028e){logger['info']('UserChatQueue,\x20%s,\x20%s',_0xe47e82,_0xde03('0xe'));logger[_0xde03('0xf')](_0xde03('0x10'),_0xe47e82,_0xde03('0xe'),JSON[_0xde03('0x11')](_0x4b028e));if(_0x4b028e[_0xde03('0x12')]){if(_0x4b028e['error'][_0xde03('0x13')]===0x1f4){logger['error'](_0xde03('0x14'),_0xe47e82,_0x4b028e[_0xde03('0x12')]['message']);return _0x2646ac(_0x4b028e[_0xde03('0x12')]['message']);}logger[_0xde03('0x12')](_0xde03('0x14'),_0xe47e82,_0x4b028e[_0xde03('0x12')][_0xde03('0x15')]);return _0x1bebb5(_0x4b028e[_0xde03('0x12')][_0xde03('0x15')]);}else{logger[_0xde03('0x16')]('UserChatQueue,\x20%s,\x20%s',_0xe47e82,_0xde03('0xe'));_0x1bebb5(_0x4b028e[_0xde03('0x17')][_0xde03('0x15')]);}})['catch'](function(_0x8cf7c2){logger[_0xde03('0x12')]('UserChatQueue,\x20%s,\x20%s',_0xe47e82,_0x8cf7c2);_0x2646ac(_0x8cf7c2);});});} \ No newline at end of file +var _0x1f36=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1fa164,_0x40a894){var _0x59bafb=function(_0x259f10){while(--_0x259f10){_0x1fa164['push'](_0x1fa164['shift']());}};_0x59bafb(++_0x40a894);}(_0x1f36,0xf8));var _0x61f3=function(_0x7f1086,_0x434356){_0x7f1086=_0x7f1086-0x0;var _0x358a47=_0x1f36[_0x7f1086];return _0x358a47;};'use strict';var _=require(_0x61f3('0x0'));var util=require(_0x61f3('0x1'));var moment=require(_0x61f3('0x2'));var BPromise=require(_0x61f3('0x3'));var rs=require(_0x61f3('0x4'));var fs=require('fs');var Redis=require(_0x61f3('0x5'));var db=require(_0x61f3('0x6'))['db'];var utils=require(_0x61f3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x61f3('0x8'));var jayson=require(_0x61f3('0x9'));var client=jayson['client'][_0x61f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5812ca,_0x4ba123,_0x4a5e15){return new BPromise(function(_0x28bf7a,_0x1dc9a6){return client[_0x61f3('0xb')](_0x5812ca,_0x4a5e15)['then'](function(_0xf7fc0e){logger[_0x61f3('0xc')](_0x61f3('0xd'),_0x4ba123,_0x61f3('0xe'));logger[_0x61f3('0xf')](_0x61f3('0x10'),_0x4ba123,'request\x20sent',JSON[_0x61f3('0x11')](_0xf7fc0e));if(_0xf7fc0e[_0x61f3('0x12')]){if(_0xf7fc0e['error'][_0x61f3('0x13')]===0x1f4){logger['error'](_0x61f3('0xd'),_0x4ba123,_0xf7fc0e[_0x61f3('0x12')]['message']);return _0x1dc9a6(_0xf7fc0e[_0x61f3('0x12')]['message']);}logger[_0x61f3('0x12')](_0x61f3('0xd'),_0x4ba123,_0xf7fc0e[_0x61f3('0x12')]['message']);return _0x28bf7a(_0xf7fc0e[_0x61f3('0x12')][_0x61f3('0x14')]);}else{logger['info'](_0x61f3('0xd'),_0x4ba123,'request\x20sent');_0x28bf7a(_0xf7fc0e[_0x61f3('0x15')][_0x61f3('0x14')]);}})[_0x61f3('0x16')](function(_0x1c2cc4){logger[_0x61f3('0x12')](_0x61f3('0xd'),_0x4ba123,_0x1c2cc4);_0x1dc9a6(_0x1c2cc4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2db98b4..4cbfc32 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2fc8b9,_0x2843cb){var _0x599fbe=function(_0x45ba2a){while(--_0x45ba2a){_0x2fc8b9['push'](_0x2fc8b9['shift']());}};_0x599fbe(++_0x2843cb);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x400a4f,_0x302b31){var _0x2d0335=function(_0x3d0955){while(--_0x3d0955){_0x400a4f['push'](_0x400a4f['shift']());}};_0x2d0335(++_0x302b31);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 1b10691..333b92c 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 _0x2349=['exports','INTEGER','STRING','sequelize'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2349,0x12b));var _0x9234=function(_0x2c25c7,_0x57f2d7){_0x2c25c7=_0x2c25c7-0x0;var _0x1e51bd=_0x2349[_0x2c25c7];return _0x1e51bd;};'use strict';var Sequelize=require(_0x9234('0x0'));module[_0x9234('0x1')]={'penalty':{'type':Sequelize[_0x9234('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9234('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9234('0x3')]}}; \ No newline at end of file +var _0xcc41=['STRING','sequelize','exports','INTEGER'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0xcc41,0x1a1));var _0x1cc4=function(_0x3cb076,_0x2e0365){_0x3cb076=_0x3cb076-0x0;var _0x1c66d7=_0xcc41[_0x3cb076];return _0x1c66d7;};'use strict';var Sequelize=require(_0x1cc4('0x0'));module[_0x1cc4('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cc4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1cc4('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 85ea68a..d183b1b 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 _0x24a4=['api','moment','path','rimraf','../../config/environment','exports','define','UserFaxQueue','../../config/logger'];(function(_0x5d4db2,_0x39b9f9){var _0x20a09a=function(_0x339a66){while(--_0x339a66){_0x5d4db2['push'](_0x5d4db2['shift']());}};_0x20a09a(++_0x39b9f9);}(_0x24a4,0x116));var _0x424a=function(_0x20c3d9,_0x4fa7ad){_0x20c3d9=_0x20c3d9-0x0;var _0x58b6bb=_0x24a4[_0x20c3d9];return _0x58b6bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x424a('0x0'))(_0x424a('0x1'));var moment=require(_0x424a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x424a('0x3'));var rimraf=require(_0x424a('0x4'));var config=require(_0x424a('0x5'));var attributes=require('./userFaxQueue.attributes');module[_0x424a('0x6')]=function(_0xdfe098,_0x1a86fa){return _0xdfe098[_0x424a('0x7')](_0x424a('0x8'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd123=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x4bba41,_0x46f062){var _0x37c718=function(_0x345fd4){while(--_0x345fd4){_0x4bba41['push'](_0x4bba41['shift']());}};_0x37c718(++_0x46f062);}(_0xd123,0x82));var _0x3d12=function(_0x409d51,_0x1f0de6){_0x409d51=_0x409d51-0x0;var _0x13eb4b=_0xd123[_0x409d51];return _0x13eb4b;};'use strict';var _=require(_0x3d12('0x0'));var util=require(_0x3d12('0x1'));var logger=require(_0x3d12('0x2'))(_0x3d12('0x3'));var moment=require(_0x3d12('0x4'));var BPromise=require('bluebird');var rp=require(_0x3d12('0x5'));var fs=require('fs');var path=require(_0x3d12('0x6'));var rimraf=require(_0x3d12('0x7'));var config=require(_0x3d12('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0xbfa3ff,_0x5b5bb9){return _0xbfa3ff[_0x3d12('0x9')](_0x3d12('0xa'),attributes,{'tableName':_0x3d12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 5a9aa3f..3450477 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 _0xbef4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x7a92ce,_0x2fca06){var _0x1cec26=function(_0x4f27e9){while(--_0x4f27e9){_0x7a92ce['push'](_0x7a92ce['shift']());}};_0x1cec26(++_0x2fca06);}(_0xbef4,0x119));var _0x4bef=function(_0x3d0366,_0x50211a){_0x3d0366=_0x3d0366-0x0;var _0x5ce75e=_0xbef4[_0x3d0366];return _0x5ce75e;};'use strict';var _=require('lodash');var util=require(_0x4bef('0x0'));var moment=require(_0x4bef('0x1'));var BPromise=require(_0x4bef('0x2'));var rs=require(_0x4bef('0x3'));var fs=require('fs');var Redis=require(_0x4bef('0x4'));var db=require(_0x4bef('0x5'))['db'];var utils=require(_0x4bef('0x6'));var logger=require(_0x4bef('0x7'))(_0x4bef('0x8'));var config=require(_0x4bef('0x9'));var jayson=require(_0x4bef('0xa'));var client=jayson[_0x4bef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335d9c,_0x37a9d6,_0x126557){return new BPromise(function(_0x4178c9,_0x4d8ba5){return client[_0x4bef('0xc')](_0x335d9c,_0x126557)[_0x4bef('0xd')](function(_0x2e2f28){logger[_0x4bef('0xe')](_0x4bef('0xf'),_0x37a9d6,'request\x20sent');logger['debug'](_0x4bef('0x10'),_0x37a9d6,_0x4bef('0x11'),JSON['stringify'](_0x2e2f28));if(_0x2e2f28[_0x4bef('0x12')]){if(_0x2e2f28['error'][_0x4bef('0x13')]===0x1f4){logger[_0x4bef('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x37a9d6,_0x2e2f28[_0x4bef('0x12')][_0x4bef('0x14')]);return _0x4d8ba5(_0x2e2f28[_0x4bef('0x12')][_0x4bef('0x14')]);}logger[_0x4bef('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x37a9d6,_0x2e2f28['error'][_0x4bef('0x14')]);return _0x4178c9(_0x2e2f28['error'][_0x4bef('0x14')]);}else{logger[_0x4bef('0xe')](_0x4bef('0xf'),_0x37a9d6,_0x4bef('0x11'));_0x4178c9(_0x2e2f28['result'][_0x4bef('0x14')]);}})[_0x4bef('0x15')](function(_0x54ae4b){logger[_0x4bef('0x12')](_0x4bef('0xf'),_0x37a9d6,_0x54ae4b);_0x4d8ba5(_0x54ae4b);});});} \ No newline at end of file +var _0x9b0c=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','UserFaxQueue,\x20%s,\x20%s','message'];(function(_0x3ba00e,_0xbd1c3d){var _0x33cb79=function(_0xdcb570){while(--_0xdcb570){_0x3ba00e['push'](_0x3ba00e['shift']());}};_0x33cb79(++_0xbd1c3d);}(_0x9b0c,0xb2));var _0xc9b0=function(_0x47076e,_0x4a89ce){_0x47076e=_0x47076e-0x0;var _0x39c35e=_0x9b0c[_0x47076e];return _0x39c35e;};'use strict';var _=require(_0xc9b0('0x0'));var util=require(_0xc9b0('0x1'));var moment=require('moment');var BPromise=require(_0xc9b0('0x2'));var rs=require(_0xc9b0('0x3'));var fs=require('fs');var Redis=require(_0xc9b0('0x4'));var db=require(_0xc9b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9b0('0x6'))(_0xc9b0('0x7'));var config=require(_0xc9b0('0x8'));var jayson=require(_0xc9b0('0x9'));var client=jayson[_0xc9b0('0xa')][_0xc9b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x443c45,_0xd3af16,_0x12c436){return new BPromise(function(_0x5baf54,_0x25c713){return client[_0xc9b0('0xc')](_0x443c45,_0x12c436)['then'](function(_0x5a97a3){logger[_0xc9b0('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0xd3af16,_0xc9b0('0xe'));logger[_0xc9b0('0xf')](_0xc9b0('0x10'),_0xd3af16,_0xc9b0('0xe'),JSON['stringify'](_0x5a97a3));if(_0x5a97a3[_0xc9b0('0x11')]){if(_0x5a97a3['error']['code']===0x1f4){logger[_0xc9b0('0x11')](_0xc9b0('0x12'),_0xd3af16,_0x5a97a3[_0xc9b0('0x11')][_0xc9b0('0x13')]);return _0x25c713(_0x5a97a3[_0xc9b0('0x11')][_0xc9b0('0x13')]);}logger[_0xc9b0('0x11')](_0xc9b0('0x12'),_0xd3af16,_0x5a97a3[_0xc9b0('0x11')]['message']);return _0x5baf54(_0x5a97a3['error'][_0xc9b0('0x13')]);}else{logger[_0xc9b0('0xd')](_0xc9b0('0x12'),_0xd3af16,_0xc9b0('0xe'));_0x5baf54(_0x5a97a3[_0xc9b0('0x14')]['message']);}})[_0xc9b0('0x15')](function(_0x52a244){logger[_0xc9b0('0x11')](_0xc9b0('0x12'),_0xd3af16,_0x52a244);_0x25c713(_0x52a244);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 980984d..80b8d96 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(_0x12012d,_0x46e1f6){var _0x2ccaf1=function(_0x3a9488){while(--_0x3a9488){_0x12012d['push'](_0x12012d['shift']());}};_0x2ccaf1(++_0x46e1f6);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'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(_0x1ded72,_0x2e4a3d){var _0x295708=function(_0x6626b7){while(--_0x6626b7){_0x1ded72['push'](_0x1ded72['shift']());}};_0x295708(++_0x2e4a3d);}(_0xedd9,0xfc));var _0x9edd=function(_0x347352,_0x33de9a){_0x347352=_0x347352-0x0;var _0x514c65=_0xedd9[_0x347352];return _0x514c65;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 026ba84..2efde1d 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 _0x58dc=['INTEGER','exports'];(function(_0x241e94,_0x1d4f63){var _0x1f0263=function(_0x4f97ba){while(--_0x4f97ba){_0x241e94['push'](_0x241e94['shift']());}};_0x1f0263(++_0x1d4f63);}(_0x58dc,0xf1));var _0xc58d=function(_0xe8a3b0,_0x54208f){_0xe8a3b0=_0xe8a3b0-0x0;var _0x21694c=_0x58dc[_0xe8a3b0];return _0x21694c;};'use strict';var Sequelize=require('sequelize');module[_0xc58d('0x0')]={'penalty':{'type':Sequelize[_0xc58d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd60b=['exports'];(function(_0x1b24bc,_0xf90414){var _0x4d522d=function(_0x5867d9){while(--_0x5867d9){_0x1b24bc['push'](_0x1b24bc['shift']());}};_0x4d522d(++_0xf90414);}(_0xd60b,0x198));var _0xbd60=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0xd60b[_0x3d00db];return _0x41f115;};'use strict';var Sequelize=require('sequelize');module[_0xbd60('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 8591132..90d9b66 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 _0x8a11=['./userMailQueue.attributes','exports','UserMailQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x22ee06,_0x39981f){var _0x1d455c=function(_0x2e25e7){while(--_0x2e25e7){_0x22ee06['push'](_0x22ee06['shift']());}};_0x1d455c(++_0x39981f);}(_0x8a11,0x1a5));var _0x18a1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8a11[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x18a1('0x0'));var util=require(_0x18a1('0x1'));var logger=require('../../config/logger')(_0x18a1('0x2'));var moment=require(_0x18a1('0x3'));var BPromise=require(_0x18a1('0x4'));var rp=require(_0x18a1('0x5'));var fs=require('fs');var path=require(_0x18a1('0x6'));var rimraf=require(_0x18a1('0x7'));var config=require('../../config/environment');var attributes=require(_0x18a1('0x8'));module[_0x18a1('0x9')]=function(_0x5bae49,_0xe903f1){return _0x5bae49['define'](_0x18a1('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d4a=['./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2fd2b6,_0x4e6cdf){var _0x4cacb5=function(_0x29d64f){while(--_0x29d64f){_0x2fd2b6['push'](_0x2fd2b6['shift']());}};_0x4cacb5(++_0x4e6cdf);}(_0x9d4a,0x18a));var _0xa9d4=function(_0x186aa6,_0xdac381){_0x186aa6=_0x186aa6-0x0;var _0x5262a8=_0x9d4a[_0x186aa6];return _0x5262a8;};'use strict';var _=require(_0xa9d4('0x0'));var util=require(_0xa9d4('0x1'));var logger=require(_0xa9d4('0x2'))(_0xa9d4('0x3'));var moment=require(_0xa9d4('0x4'));var BPromise=require(_0xa9d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9d4('0x6'));var rimraf=require(_0xa9d4('0x7'));var config=require(_0xa9d4('0x8'));var attributes=require(_0xa9d4('0x9'));module['exports']=function(_0x228319,_0x404ffc){return _0x228319[_0xa9d4('0xa')](_0xa9d4('0xb'),attributes,{'tableName':_0xa9d4('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 7251740..c5ee499 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x1f98e4,_0x48bb7d){var _0x2838e1=function(_0x63b00f){while(--_0x63b00f){_0x1f98e4['push'](_0x1f98e4['shift']());}};_0x2838e1(++_0x48bb7d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0xf3cd[_0x3fcc20];return _0x15d3ce;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x13646f,_0x421050){var _0x38dc7f=function(_0x392d61){while(--_0x392d61){_0x13646f['push'](_0x13646f['shift']());}};_0x38dc7f(++_0x421050);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0x7fbe[_0x3a60b8];return _0x4eb583;};'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);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 18df7c3..67ecc81 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 _0x1279=['exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification'];(function(_0x31e735,_0xe94abb){var _0x1cd969=function(_0x27ba9c){while(--_0x27ba9c){_0x31e735['push'](_0x31e735['shift']());}};_0x1cd969(++_0xe94abb);}(_0x1279,0x169));var _0x9127=function(_0x1c7959,_0x36ea79){_0x1c7959=_0x1c7959-0x0;var _0x4a1edd=_0x1279[_0x1c7959];return _0x4a1edd;};'use strict';var multer=require(_0x9127('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9127('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9127('0x2'));var interaction=require(_0x9127('0x3'));var config=require(_0x9127('0x4'));var controller=require('./userNotification.controller');router[_0x9127('0x5')]('/',auth[_0x9127('0x6')](),controller[_0x9127('0x7')]);module[_0x9127('0x8')]=router; \ No newline at end of file +var _0x37f2=['../../config/environment','./userNotification.controller','isAuthenticated','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x36bef9,_0x50d13c){var _0x216d50=function(_0x3f9ccb){while(--_0x3f9ccb){_0x36bef9['push'](_0x36bef9['shift']());}};_0x216d50(++_0x50d13c);}(_0x37f2,0x72));var _0x237f=function(_0x10a6da,_0x49a8e6){_0x10a6da=_0x10a6da-0x0;var _0x147493=_0x37f2[_0x10a6da];return _0x147493;};'use strict';var multer=require(_0x237f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x237f('0x1'));var express=require(_0x237f('0x2'));var router=express['Router']();var fs_extra=require(_0x237f('0x3'));var auth=require(_0x237f('0x4'));var interaction=require(_0x237f('0x5'));var config=require(_0x237f('0x6'));var controller=require(_0x237f('0x7'));router['post']('/',auth[_0x237f('0x8')](),controller['sendUserNotification']);module[_0x237f('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 ff18083..c5615b0 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 _0x40d8=['TEXT','sequelize'];(function(_0x5c60fa,_0x1d369d){var _0x3c70a5=function(_0x1dbd67){while(--_0x1dbd67){_0x5c60fa['push'](_0x5c60fa['shift']());}};_0x3c70a5(++_0x1d369d);}(_0x40d8,0x1a5));var _0x840d=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x40d8[_0x154192];return _0x3c2792;};'use strict';var Sequelize=require(_0x840d('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x840d('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x2dac=['exports','STRING','BOOLEAN'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x2dac,0xf0));var _0xc2da=function(_0x331a42,_0x5e712f){_0x331a42=_0x331a42-0x0;var _0x4f65e7=_0x2dac[_0x331a42];return _0x4f65e7;};'use strict';var Sequelize=require('sequelize');module[_0xc2da('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xc2da('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xc2da('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 0aeb06d..1f64a37 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 _0x86f0=['recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','UserNotification','create','forEach','recipient','userNotification:send','catch','Template','findOne','render','html','startCase','User','union','ids','queue','replace','Queue','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','isEmpty'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x86f0,0x1a3));var _0x086f=function(_0x664895,_0xa51de0){_0x664895=_0x664895-0x0;var _0x44381f=_0x86f0[_0x664895];return _0x44381f;};'use strict';var emlformat=require(_0x086f('0x0'));var rimraf=require(_0x086f('0x1'));var zipdir=require(_0x086f('0x2'));var jsonpatch=require(_0x086f('0x3'));var rp=require(_0x086f('0x4'));var moment=require(_0x086f('0x5'));var BPromise=require(_0x086f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x086f('0x7'));var sox=require(_0x086f('0x8'));var csv=require(_0x086f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x086f('0xa'));var _=require(_0x086f('0xb'));var squel=require('squel');var crypto=require(_0x086f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x086f('0xd'));var toCsv=require(_0x086f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x086f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x086f('0xf'));var as=require(_0x086f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x086f('0x11'))(_0x086f('0x12'));var utils=require(_0x086f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x086f('0x14'));var db=require(_0x086f('0x15'))['db'];config[_0x086f('0x16')]=_[_0x086f('0x17')](config['redis'],{'host':_0x086f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x086f('0x16')]));require(_0x086f('0x19'))['register'](socket);function respondWithStatusCode(_0x409c52,_0x4b4ebd){_0x4b4ebd=_0x4b4ebd||0xcc;return function(_0x262ee5){if(_0x262ee5){return _0x409c52['sendStatus'](_0x4b4ebd);}return _0x409c52['status'](_0x4b4ebd)[_0x086f('0x1a')]();};}function respondWithResult(_0x523b81,_0x5ac1e6){_0x5ac1e6=_0x5ac1e6||0xc8;return function(_0x2c80a6){if(_0x2c80a6){return _0x523b81[_0x086f('0x1b')](_0x5ac1e6)[_0x086f('0x1c')](_0x2c80a6);}};}function respondWithFilteredResult(_0x94d89,_0x2992fd){return function(_0x33cca9){if(_0x33cca9){var _0xb8fb29=typeof _0x2992fd[_0x086f('0x1d')]===_0x086f('0x1e')&&typeof _0x2992fd[_0x086f('0x1f')]===_0x086f('0x1e');var _0x10fbfc=_0x33cca9['count'];var _0x46180d=_0xb8fb29?0x0:_0x2992fd['offset'];var _0x34c9d1=_0xb8fb29?_0x33cca9[_0x086f('0x20')]:_0x2992fd[_0x086f('0x1d')]+_0x2992fd[_0x086f('0x1f')];var _0x5f33bc;if(_0x34c9d1>=_0x10fbfc){_0x34c9d1=_0x10fbfc;_0x5f33bc=0xc8;}else{_0x5f33bc=0xce;}_0x94d89[_0x086f('0x1b')](_0x5f33bc);return _0x94d89[_0x086f('0x21')](_0x086f('0x22'),_0x46180d+'-'+_0x34c9d1+'/'+_0x10fbfc)['json'](_0x33cca9);}return null;};}function patchUpdates(_0x3f858b){return function(_0x4dfdf3){try{jsonpatch[_0x086f('0x23')](_0x4dfdf3,_0x3f858b,!![]);}catch(_0x64c77c){return BPromise['reject'](_0x64c77c);}return _0x4dfdf3[_0x086f('0x24')]();};}function saveUpdates(_0x57694a,_0x1bc83f){return function(_0x36c812){if(_0x36c812){return _0x36c812[_0x086f('0x25')](_0x57694a)['then'](function(_0x1f9aef){return _0x1f9aef;});}return null;};}function removeEntity(_0x462017,_0xd9f0c9){return function(_0x5b486c){if(_0x5b486c){return _0x5b486c[_0x086f('0x26')]()[_0x086f('0x27')](function(){_0x462017[_0x086f('0x1b')](0xcc)[_0x086f('0x1a')]();});}};}function handleEntityNotFound(_0x2255ee,_0x357911){return function(_0x3196e8){if(!_0x3196e8){_0x2255ee[_0x086f('0x28')](0x194);}return _0x3196e8;};}function handleError(_0x41e585,_0x559ee9){_0x559ee9=_0x559ee9||0x1f4;return function(_0x48feb7){logger['error'](_0x48feb7[_0x086f('0x29')]);if(_0x48feb7[_0x086f('0x2a')]){delete _0x48feb7[_0x086f('0x2a')];}_0x41e585[_0x086f('0x1b')](_0x559ee9)[_0x086f('0x2b')](_0x48feb7);};}exports['sendUserNotification']=function(_0x32b6c7,_0x130860,_0x15da30){if(!_0x32b6c7[_0x086f('0x2c')][_0x086f('0x2d')](_0x086f('0x2e'))&&!_0x32b6c7[_0x086f('0x2c')]['hasOwnProperty'](_0x086f('0x2f'))){throw new db[(_0x086f('0x30'))][(_0x086f('0x31'))](_0x086f('0x32'));}else{if(_0x32b6c7[_0x086f('0x2c')]['hasOwnProperty'](_0x086f('0x2f'))&&!_0x32b6c7[_0x086f('0x2c')][_0x086f('0x2d')](_0x086f('0x33'))){throw new db[(_0x086f('0x30'))][(_0x086f('0x31'))](_0x086f('0x34'));}if(!_0x32b6c7['body'][_0x086f('0x2d')]('recipients')){throw new db['Sequelize'][(_0x086f('0x31'))](_0x086f('0x35'));}else{try{var _0x48b7f2=JSON[_0x086f('0x36')](_0x32b6c7[_0x086f('0x2c')][_0x086f('0x37')]);}catch(_0x254b9a){logger[_0x086f('0x38')](_0x254b9a);throw new db[(_0x086f('0x30'))][(_0x086f('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x482890=[_0x086f('0x39'),_0x086f('0x3a'),'mailqueue',_0x086f('0x3b'),_0x086f('0x3c'),_0x086f('0x3d'),_0x086f('0x3e'),_0x086f('0x3f'),_0x086f('0x40')];if(_[_0x086f('0x41')](_0x48b7f2,function(_0xf21661){return!_[_0x086f('0x42')](_0x482890,_0xf21661[_0x086f('0x43')][_0x086f('0x44')]());})){throw new db['Sequelize']['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4e1298={};_0x4e1298['senderName']=_0x32b6c7[_0x086f('0x2c')][_0x086f('0x2d')](_0x086f('0x45'))?_0x32b6c7[_0x086f('0x2c')][_0x086f('0x45')]:_0x32b6c7[_0x086f('0x40')]['fullname'];_0x4e1298['recipientsDescription']=_[_0x086f('0x46')](_0x32b6c7[_0x086f('0x2c')][_0x086f('0x47')])?null:_0x32b6c7['body'][_0x086f('0x47')];_0x4e1298[_0x086f('0x48')]=_0x32b6c7[_0x086f('0x2c')][_0x086f('0x48')]||![];_0x4e1298[_0x086f('0x49')]=_0x32b6c7['user']['id'];return getContent(_0x32b6c7['body'])[_0x086f('0x27')](function(_0x2829e3){_0x4e1298[_0x086f('0x2c')]=_0x2829e3;return getRecipients(_0x48b7f2);})[_0x086f('0x27')](function(_0x1211d2){_0x4e1298[_0x086f('0x4a')]=_[_0x086f('0x4b')](_0x1211d2)['join'](',');return db[_0x086f('0x4c')]['transaction'](function(_0x304e92){return db[_0x086f('0x4d')][_0x086f('0x4e')](_0x4e1298,{'raw':!![],'transaction':_0x304e92})['then'](function(_0x2d6039){var _0x16564b={'sender':_0x4e1298['senderName'],'description':_0x4e1298['recipientsDescription'],'content':_0x4e1298[_0x086f('0x2c')],'beep':_0x4e1298['beep']};_0x1211d2[_0x086f('0x4f')](function(_0xc46c62){_0x16564b[_0x086f('0x50')]=_0xc46c62;socket['emit'](_0x086f('0x51'),_0x16564b);});return _0x2d6039;});});})[_0x086f('0x27')](respondWithResult(_0x130860,0xc9))[_0x086f('0x52')](handleError(_0x130860,null));};function getContent(_0x4eb64a){return new BPromise(function(_0x4575bb,_0x18d15){if(_0x4eb64a[_0x086f('0x2e')]){_0x4575bb(_0x4eb64a[_0x086f('0x2e')]);return;}return db[_0x086f('0x53')][_0x086f('0x54')]({'attributes':['html'],'where':{'id':_0x4eb64a[_0x086f('0x2f')]},'raw':!![]})[_0x086f('0x27')](function(_0x192ff7){if(!_0x192ff7)throw new db['Sequelize'][(_0x086f('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x90334=Mustache[_0x086f('0x55')](_0x192ff7[_0x086f('0x56')],_0x4eb64a[_0x086f('0x33')]);_0x4575bb(_0x90334);})['catch'](function(_0x448b86){_0x18d15(_0x448b86);});});}function getRecipients(_0x49ceb2){return new BPromise(function(_0x3cb8d7,_0x19b162){var _0x45560c=[];var _0x36001c=[];_0x49ceb2['forEach'](function(_0x25f4b0){var _0x389d5b=_[_0x086f('0x57')](_0x25f4b0[_0x086f('0x43')][_0x086f('0x44')]());if(_0x389d5b===_0x086f('0x58')){_0x45560c=_[_0x086f('0x59')](_0x45560c,_0x25f4b0[_0x086f('0x5a')]);}else{if(_[_0x086f('0x42')](_0x389d5b,_0x086f('0x5b')))_0x389d5b=_0x389d5b[_0x086f('0x5c')](_0x086f('0x5b'),_0x086f('0x5d'));_0x25f4b0['ids']['forEach'](function(_0x38c381){_0x36001c[_0x086f('0x5e')](getAgents(_0x389d5b,_0x38c381));});}});return BPromise[_0x086f('0x5f')](_0x36001c)['then'](function(_0x56c58b){_0x45560c=_[_0x086f('0x59')](_0x45560c,_['flatten'](_0x56c58b));_0x3cb8d7(_0x45560c);})[_0x086f('0x52')](function(_0x592e62){_0x19b162(_0x592e62);});});}function getAgents(_0x1b4272,_0x3161d9){return new BPromise(function(_0x5bc65c,_0x3de7dc){return db[_0x1b4272][_0x086f('0x54')]({'where':{'id':_0x3161d9}})['then'](function(_0x301726){return _0x301726[_0x086f('0x60')]({'attributes':['id'],'raw':!![]})[_0x086f('0x27')](function(_0x107715){var _0x1a6eb7=_[_0x086f('0x61')](_0x107715,'id');_0x5bc65c(_0x1a6eb7);});})[_0x086f('0x52')](function(_0x57efe9){_0x3de7dc(_0x57efe9);});});} \ No newline at end of file +var _0x3573=['defaults','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','replace','Queue','push','flatten','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis'];(function(_0x34476c,_0x4da35e){var _0x12b784=function(_0x8ee3e1){while(--_0x8ee3e1){_0x34476c['push'](_0x34476c['shift']());}};_0x12b784(++_0x4da35e);}(_0x3573,0x119));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3357('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3357('0x1'));var jsonpatch=require(_0x3357('0x2'));var rp=require('request-promise');var moment=require(_0x3357('0x3'));var BPromise=require(_0x3357('0x4'));var Mustache=require(_0x3357('0x5'));var util=require(_0x3357('0x6'));var path=require(_0x3357('0x7'));var sox=require('sox');var csv=require(_0x3357('0x8'));var ejs=require(_0x3357('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3357('0xa'));var crypto=require(_0x3357('0xb'));var jsforce=require(_0x3357('0xc'));var deskjs=require(_0x3357('0xd'));var toCsv=require(_0x3357('0x8'));var querystring=require(_0x3357('0xe'));var Papa=require('papaparse');var Redis=require(_0x3357('0xf'));var authService=require(_0x3357('0x10'));var qs=require(_0x3357('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3357('0x12'));var logger=require(_0x3357('0x13'))(_0x3357('0x14'));var utils=require(_0x3357('0x15'));var config=require(_0x3357('0x16'));var licenseUtil=require(_0x3357('0x17'));var db=require('../../mysqldb')['db'];config[_0x3357('0x18')]=_[_0x3357('0x19')](config[_0x3357('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3357('0x18')]));require('./userNotification.socket')[_0x3357('0x1a')](socket);function respondWithStatusCode(_0x1aff4a,_0x3fc800){_0x3fc800=_0x3fc800||0xcc;return function(_0x15495f){if(_0x15495f){return _0x1aff4a[_0x3357('0x1b')](_0x3fc800);}return _0x1aff4a[_0x3357('0x1c')](_0x3fc800)[_0x3357('0x1d')]();};}function respondWithResult(_0x5afda6,_0x5cc51a){_0x5cc51a=_0x5cc51a||0xc8;return function(_0x244818){if(_0x244818){return _0x5afda6[_0x3357('0x1c')](_0x5cc51a)[_0x3357('0x1e')](_0x244818);}};}function respondWithFilteredResult(_0x58f47d,_0x2a3d4f){return function(_0x11c38d){if(_0x11c38d){var _0x4277fb=typeof _0x2a3d4f[_0x3357('0x1f')]===_0x3357('0x20')&&typeof _0x2a3d4f[_0x3357('0x21')]===_0x3357('0x20');var _0x3c9c48=_0x11c38d[_0x3357('0x22')];var _0x3e4353=_0x4277fb?0x0:_0x2a3d4f[_0x3357('0x1f')];var _0x176d16=_0x4277fb?_0x11c38d[_0x3357('0x22')]:_0x2a3d4f[_0x3357('0x1f')]+_0x2a3d4f[_0x3357('0x21')];var _0x4610d3;if(_0x176d16>=_0x3c9c48){_0x176d16=_0x3c9c48;_0x4610d3=0xc8;}else{_0x4610d3=0xce;}_0x58f47d['status'](_0x4610d3);return _0x58f47d[_0x3357('0x23')]('Content-Range',_0x3e4353+'-'+_0x176d16+'/'+_0x3c9c48)['json'](_0x11c38d);}return null;};}function patchUpdates(_0x8c1af8){return function(_0x438d70){try{jsonpatch[_0x3357('0x24')](_0x438d70,_0x8c1af8,!![]);}catch(_0x64782e){return BPromise[_0x3357('0x25')](_0x64782e);}return _0x438d70[_0x3357('0x26')]();};}function saveUpdates(_0x1eb23d,_0x5765cb){return function(_0x359f42){if(_0x359f42){return _0x359f42['update'](_0x1eb23d)[_0x3357('0x27')](function(_0x3eb6db){return _0x3eb6db;});}return null;};}function removeEntity(_0x113674,_0x2959f5){return function(_0x1168d2){if(_0x1168d2){return _0x1168d2[_0x3357('0x28')]()['then'](function(){_0x113674[_0x3357('0x1c')](0xcc)[_0x3357('0x1d')]();});}};}function handleEntityNotFound(_0xa455a7,_0xf0f3c9){return function(_0x2a3712){if(!_0x2a3712){_0xa455a7[_0x3357('0x1b')](0x194);}return _0x2a3712;};}function handleError(_0x4a89db,_0x52bf92){_0x52bf92=_0x52bf92||0x1f4;return function(_0x56dc6c){logger['error'](_0x56dc6c[_0x3357('0x29')]);if(_0x56dc6c[_0x3357('0x2a')]){delete _0x56dc6c[_0x3357('0x2a')];}_0x4a89db[_0x3357('0x1c')](_0x52bf92)[_0x3357('0x2b')](_0x56dc6c);};}exports[_0x3357('0x2c')]=function(_0x3afb38,_0x52cf72,_0x208a72){if(!_0x3afb38[_0x3357('0x2d')][_0x3357('0x2e')](_0x3357('0x2f'))&&!_0x3afb38[_0x3357('0x2d')]['hasOwnProperty'](_0x3357('0x30'))){throw new db[(_0x3357('0x31'))][(_0x3357('0x32'))](_0x3357('0x33'));}else{if(_0x3afb38['body'][_0x3357('0x2e')](_0x3357('0x30'))&&!_0x3afb38[_0x3357('0x2d')]['hasOwnProperty'](_0x3357('0x34'))){throw new db[(_0x3357('0x31'))]['ValidationError'](_0x3357('0x35'));}if(!_0x3afb38['body'][_0x3357('0x2e')](_0x3357('0x36'))){throw new db[(_0x3357('0x31'))][(_0x3357('0x32'))](_0x3357('0x37'));}else{try{var _0x318bd9=JSON['parse'](_0x3afb38['body'][_0x3357('0x36')]);}catch(_0x5f03c6){logger['error'](_0x5f03c6);throw new db[(_0x3357('0x31'))]['ValidationError'](_0x3357('0x38'));}var _0x30e7e6=[_0x3357('0x39'),_0x3357('0x3a'),_0x3357('0x3b'),_0x3357('0x3c'),_0x3357('0x3d'),_0x3357('0x3e'),_0x3357('0x3f'),_0x3357('0x40'),_0x3357('0x41')];if(_[_0x3357('0x42')](_0x318bd9,function(_0x4d4ed5){return!_[_0x3357('0x43')](_0x30e7e6,_0x4d4ed5[_0x3357('0x44')][_0x3357('0x45')]());})){throw new db[(_0x3357('0x31'))][(_0x3357('0x32'))](_0x3357('0x46'));}}}var _0x1aa1cb={};_0x1aa1cb['senderName']=_0x3afb38['body'][_0x3357('0x2e')](_0x3357('0x47'))?_0x3afb38[_0x3357('0x2d')][_0x3357('0x47')]:_0x3afb38['user']['fullname'];_0x1aa1cb[_0x3357('0x48')]=_[_0x3357('0x49')](_0x3afb38[_0x3357('0x2d')][_0x3357('0x48')])?null:_0x3afb38[_0x3357('0x2d')][_0x3357('0x48')];_0x1aa1cb['beep']=_0x3afb38[_0x3357('0x2d')][_0x3357('0x4a')]||![];_0x1aa1cb[_0x3357('0x4b')]=_0x3afb38[_0x3357('0x41')]['id'];return getContent(_0x3afb38[_0x3357('0x2d')])['then'](function(_0x27bb21){_0x1aa1cb[_0x3357('0x2d')]=_0x27bb21;return getRecipients(_0x318bd9);})[_0x3357('0x27')](function(_0x19d6a2){_0x1aa1cb[_0x3357('0x4c')]=_[_0x3357('0x4d')](_0x19d6a2)[_0x3357('0x4e')](',');return db[_0x3357('0x4f')][_0x3357('0x50')](function(_0x96ddec){return db[_0x3357('0x51')][_0x3357('0x52')](_0x1aa1cb,{'raw':!![],'transaction':_0x96ddec})[_0x3357('0x27')](function(_0x595562){var _0x12d63e={'sender':_0x1aa1cb[_0x3357('0x47')],'description':_0x1aa1cb[_0x3357('0x48')],'content':_0x1aa1cb['body'],'beep':_0x1aa1cb[_0x3357('0x4a')]};_0x19d6a2[_0x3357('0x53')](function(_0xba4660){_0x12d63e[_0x3357('0x54')]=_0xba4660;socket[_0x3357('0x55')](_0x3357('0x56'),_0x12d63e);});return _0x595562;});});})[_0x3357('0x27')](respondWithResult(_0x52cf72,0xc9))[_0x3357('0x57')](handleError(_0x52cf72,null));};function getContent(_0x1388c0){return new BPromise(function(_0x38c8a4,_0x92eb72){if(_0x1388c0[_0x3357('0x2f')]){_0x38c8a4(_0x1388c0[_0x3357('0x2f')]);return;}return db[_0x3357('0x58')]['findOne']({'attributes':[_0x3357('0x59')],'where':{'id':_0x1388c0['TemplateId']},'raw':!![]})[_0x3357('0x27')](function(_0x2fe75e){if(!_0x2fe75e)throw new db[(_0x3357('0x31'))][(_0x3357('0x32'))](_0x3357('0x5a'));var _0x4beecc=Mustache[_0x3357('0x5b')](_0x2fe75e[_0x3357('0x59')],_0x1388c0[_0x3357('0x34')]);_0x38c8a4(_0x4beecc);})[_0x3357('0x57')](function(_0x3eaa49){_0x92eb72(_0x3eaa49);});});}function getRecipients(_0x10eb4f){return new BPromise(function(_0x595c69,_0x415557){var _0x17df1c=[];var _0x2cdfbc=[];_0x10eb4f[_0x3357('0x53')](function(_0x3567af){var _0x2e29d2=_[_0x3357('0x5c')](_0x3567af[_0x3357('0x44')][_0x3357('0x45')]());if(_0x2e29d2===_0x3357('0x5d')){_0x17df1c=_[_0x3357('0x5e')](_0x17df1c,_0x3567af[_0x3357('0x5f')]);}else{if(_[_0x3357('0x43')](_0x2e29d2,_0x3357('0x60')))_0x2e29d2=_0x2e29d2[_0x3357('0x61')](_0x3357('0x60'),_0x3357('0x62'));_0x3567af['ids'][_0x3357('0x53')](function(_0x2724e4){_0x2cdfbc[_0x3357('0x63')](getAgents(_0x2e29d2,_0x2724e4));});}});return BPromise['all'](_0x2cdfbc)[_0x3357('0x27')](function(_0x125899){_0x17df1c=_[_0x3357('0x5e')](_0x17df1c,_[_0x3357('0x64')](_0x125899));_0x595c69(_0x17df1c);})[_0x3357('0x57')](function(_0x3970cb){_0x415557(_0x3970cb);});});}function getAgents(_0x41751b,_0x2cbb88){return new BPromise(function(_0x51700e,_0x21723a){return db[_0x41751b]['findOne']({'where':{'id':_0x2cbb88}})[_0x3357('0x27')](function(_0x57831b){return _0x57831b['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x4e7668){var _0x2f491f=_[_0x3357('0x65')](_0x4e7668,'id');_0x51700e(_0x2f491f);});})['catch'](function(_0x108cca){_0x21723a(_0x108cca);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 4c3bca0..5d986fa 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 _0xfef7=['emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','save','update'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0xfef7,0x1cc));var _0x7fef=function(_0x2b010c,_0x2a7bc5){_0x2b010c=_0x2b010c-0x0;var _0x36470e=_0xfef7[_0x2b010c];return _0x36470e;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x7fef('0x0'))['db'][_0x7fef('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7fef('0x2'),'afterUpdate':_0x7fef('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1c6360){return function(_0x3484c7,_0x2c7dab,_0x5dc6e2){UserNotificationEvents['emit'](_0x1c6360+':'+_0x3484c7['id'],_0x3484c7);UserNotificationEvents[_0x7fef('0x4')](_0x1c6360,_0x3484c7);_0x5dc6e2(null);};}for(var e in events){if(events[_0x7fef('0x5')](e)){var event=events[e];UserNotification[_0x7fef('0x6')](e,emitEvent(event));}}module[_0x7fef('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x40c5=['UserNotification','setMaxListeners','save','emit','hook','../../mysqldb'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x40c5,0xdd));var _0x540c=function(_0x3f73ba,_0x43f4b6){_0x3f73ba=_0x3f73ba-0x0;var _0x5ec10d=_0x40c5[_0x3f73ba];return _0x5ec10d;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x540c('0x0'))['db'][_0x540c('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x540c('0x2')](0x0);var events={'afterCreate':_0x540c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3f47dc){return function(_0x47aa47,_0x574dfe,_0x464171){UserNotificationEvents[_0x540c('0x4')](_0x3f47dc+':'+_0x47aa47['id'],_0x47aa47);UserNotificationEvents[_0x540c('0x4')](_0x3f47dc,_0x47aa47);_0x464171(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x540c('0x5')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 660bb5e..817b032 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 _0x4784=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./userNotification.attributes','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x28e188,_0x2630f3){var _0x463ecc=function(_0x2f0e79){while(--_0x2f0e79){_0x28e188['push'](_0x28e188['shift']());}};_0x463ecc(++_0x2630f3);}(_0x4784,0x14f));var _0x4478=function(_0x431110,_0x520a59){_0x431110=_0x431110-0x0;var _0x4b4ccf=_0x4784[_0x431110];return _0x4b4ccf;};'use strict';var _=require(_0x4478('0x0'));var util=require(_0x4478('0x1'));var logger=require(_0x4478('0x2'))('api');var moment=require(_0x4478('0x3'));var BPromise=require(_0x4478('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4478('0x5'));var config=require(_0x4478('0x6'));var attributes=require(_0x4478('0x7'));module['exports']=function(_0x5757a8,_0x59e92e){return _0x5757a8[_0x4478('0x8')]('UserNotification',attributes,{'tableName':_0x4478('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4478('0xa'),'collate':_0x4478('0xb')});}; \ No newline at end of file +var _0x2ec4=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','lodash'];(function(_0x3ad2dc,_0x4c4dd9){var _0x7c9ee7=function(_0x4ce34f){while(--_0x4ce34f){_0x3ad2dc['push'](_0x3ad2dc['shift']());}};_0x7c9ee7(++_0x4c4dd9);}(_0x2ec4,0x103));var _0x42ec=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x2ec4[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x42ec('0x0'));var util=require(_0x42ec('0x1'));var logger=require(_0x42ec('0x2'))(_0x42ec('0x3'));var moment=require(_0x42ec('0x4'));var BPromise=require('bluebird');var rp=require(_0x42ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42ec('0x6'));var config=require(_0x42ec('0x7'));var attributes=require('./userNotification.attributes');module[_0x42ec('0x8')]=function(_0x5785b3,_0x1df03b){return _0x5785b3[_0x42ec('0x9')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e6c7266..a2b3d2b 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 _0xd706=['message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x569ce3,_0x2324ff){var _0x3c01f5=function(_0xf58546){while(--_0xf58546){_0x569ce3['push'](_0x569ce3['shift']());}};_0x3c01f5(++_0x2324ff);}(_0xd706,0x16d));var _0x6d70=function(_0x334dc8,_0x434cd9){_0x334dc8=_0x334dc8-0x0;var _0x3d5a15=_0xd706[_0x334dc8];return _0x3d5a15;};'use strict';var _=require('lodash');var util=require(_0x6d70('0x0'));var moment=require(_0x6d70('0x1'));var BPromise=require(_0x6d70('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d70('0x3'));var db=require(_0x6d70('0x4'))['db'];var utils=require(_0x6d70('0x5'));var logger=require(_0x6d70('0x6'))(_0x6d70('0x7'));var config=require(_0x6d70('0x8'));var jayson=require(_0x6d70('0x9'));var client=jayson[_0x6d70('0xa')][_0x6d70('0xb')]({'port':0x232a});config[_0x6d70('0xc')]=_['defaults'](config[_0x6d70('0xc')],{'host':_0x6d70('0xd'),'port':0x18eb});var socket=require(_0x6d70('0xe'))(new Redis(config[_0x6d70('0xc')]));require(_0x6d70('0xf'))[_0x6d70('0x10')](socket);function respondWithRpcPromise(_0x21c888,_0x423d57,_0x31e86f){return new BPromise(function(_0x393a70,_0x3afb35){return client[_0x6d70('0x11')](_0x21c888,_0x31e86f)[_0x6d70('0x12')](function(_0x5261f3){logger[_0x6d70('0x13')](_0x6d70('0x14'),_0x423d57,_0x6d70('0x15'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x423d57,_0x6d70('0x15'),JSON[_0x6d70('0x16')](_0x5261f3));if(_0x5261f3[_0x6d70('0x17')]){if(_0x5261f3[_0x6d70('0x17')][_0x6d70('0x18')]===0x1f4){logger[_0x6d70('0x17')]('UserNotification,\x20%s,\x20%s',_0x423d57,_0x5261f3['error']['message']);return _0x3afb35(_0x5261f3[_0x6d70('0x17')][_0x6d70('0x19')]);}logger[_0x6d70('0x17')](_0x6d70('0x14'),_0x423d57,_0x5261f3[_0x6d70('0x17')][_0x6d70('0x19')]);return _0x393a70(_0x5261f3[_0x6d70('0x17')][_0x6d70('0x19')]);}else{logger[_0x6d70('0x13')]('UserNotification,\x20%s,\x20%s',_0x423d57,_0x6d70('0x15'));_0x393a70(_0x5261f3['result'][_0x6d70('0x19')]);}})['catch'](function(_0x430d35){logger['error']('UserNotification,\x20%s,\x20%s',_0x423d57,_0x430d35);_0x3afb35(_0x430d35);});});} \ No newline at end of file +var _0x3294=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x3294,0xc1));var _0x4329=function(_0x24546e,_0x45ec45){_0x24546e=_0x24546e-0x0;var _0x6be0ac=_0x3294[_0x24546e];return _0x6be0ac;};'use strict';var _=require(_0x4329('0x0'));var util=require('util');var moment=require(_0x4329('0x1'));var BPromise=require(_0x4329('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4329('0x3'));var logger=require(_0x4329('0x4'))(_0x4329('0x5'));var config=require(_0x4329('0x6'));var jayson=require(_0x4329('0x7'));var client=jayson[_0x4329('0x8')][_0x4329('0x9')]({'port':0x232a});config[_0x4329('0xa')]=_['defaults'](config['redis'],{'host':_0x4329('0xb'),'port':0x18eb});var socket=require(_0x4329('0xc'))(new Redis(config[_0x4329('0xa')]));require(_0x4329('0xd'))['register'](socket);function respondWithRpcPromise(_0x9fae5c,_0x47a1d7,_0x1a10ae){return new BPromise(function(_0x285a36,_0x79976e){return client['request'](_0x9fae5c,_0x1a10ae)[_0x4329('0xe')](function(_0x32b199){logger[_0x4329('0xf')](_0x4329('0x10'),_0x47a1d7,_0x4329('0x11'));logger[_0x4329('0x12')](_0x4329('0x13'),_0x47a1d7,'request\x20sent',JSON[_0x4329('0x14')](_0x32b199));if(_0x32b199[_0x4329('0x15')]){if(_0x32b199[_0x4329('0x15')][_0x4329('0x16')]===0x1f4){logger[_0x4329('0x15')]('UserNotification,\x20%s,\x20%s',_0x47a1d7,_0x32b199[_0x4329('0x15')][_0x4329('0x17')]);return _0x79976e(_0x32b199[_0x4329('0x15')][_0x4329('0x17')]);}logger[_0x4329('0x15')](_0x4329('0x10'),_0x47a1d7,_0x32b199['error'][_0x4329('0x17')]);return _0x285a36(_0x32b199[_0x4329('0x15')][_0x4329('0x17')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x47a1d7,_0x4329('0x11'));_0x285a36(_0x32b199[_0x4329('0x18')][_0x4329('0x17')]);}})['catch'](function(_0x3fd78e){logger['error'](_0x4329('0x10'),_0x47a1d7,_0x3fd78e);_0x79976e(_0x3fd78e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 27d6ae4..849ba46 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 _0x0ca0=['length','./userNotification.events','save','remove','emit'];(function(_0xcd45fe,_0x2f8c3a){var _0x55ff31=function(_0x3c6dc2){while(--_0x3c6dc2){_0xcd45fe['push'](_0xcd45fe['shift']());}};_0x55ff31(++_0x2f8c3a);}(_0x0ca0,0xf1));var _0x00ca=function(_0x344c31,_0x60d141){_0x344c31=_0x344c31-0x0;var _0x3da7b5=_0x0ca0[_0x344c31];return _0x3da7b5;};'use strict';var UserNotificationEvents=require(_0x00ca('0x0'));var events=[_0x00ca('0x1'),_0x00ca('0x2'),'update'];function createListener(_0x58dae9,_0xfa3e43){return function(_0x450721){_0xfa3e43[_0x00ca('0x3')](_0x58dae9,_0x450721);};}function removeListener(_0x2d0bfa,_0x4a1d0a){return function(){UserNotificationEvents['removeListener'](_0x2d0bfa,_0x4a1d0a);};}exports['register']=function(_0x4b0145){for(var _0x1599d7=0x0,_0x2d7f0c=events[_0x00ca('0x4')];_0x1599d7<_0x2d7f0c;_0x1599d7++){var _0x4ae78e=events[_0x1599d7];var _0x3f0199=createListener('userNotification:'+_0x4ae78e,_0x4b0145);UserNotificationEvents['on'](_0x4ae78e,_0x3f0199);}}; \ No newline at end of file +var _0xe7b9=['remove','update','register','length','./userNotification.events','save'];(function(_0x3c1410,_0x3bae93){var _0x3465f1=function(_0x172cf4){while(--_0x172cf4){_0x3c1410['push'](_0x3c1410['shift']());}};_0x3465f1(++_0x3bae93);}(_0xe7b9,0xa0));var _0x9e7b=function(_0x1ef7b8,_0x16cc8c){_0x1ef7b8=_0x1ef7b8-0x0;var _0x2393b9=_0xe7b9[_0x1ef7b8];return _0x2393b9;};'use strict';var UserNotificationEvents=require(_0x9e7b('0x0'));var events=[_0x9e7b('0x1'),_0x9e7b('0x2'),_0x9e7b('0x3')];function createListener(_0x1ed796,_0x569068){return function(_0x2a7aae){_0x569068['emit'](_0x1ed796,_0x2a7aae);};}function removeListener(_0x38a037,_0x573d64){return function(){UserNotificationEvents['removeListener'](_0x38a037,_0x573d64);};}exports[_0x9e7b('0x4')]=function(_0x16f7e2){for(var _0x30ecd7=0x0,_0x56827f=events[_0x9e7b('0x5')];_0x30ecd7<_0x56827f;_0x30ecd7++){var _0xeafdc5=events[_0x30ecd7];var _0x5ef454=createListener('userNotification:'+_0xeafdc5,_0x16f7e2);UserNotificationEvents['on'](_0xeafdc5,_0x5ef454);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index afdcf3c..22b6cea 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2a1c1c,_0x2c664e){var _0xbf4766=function(_0x1b951e){while(--_0x1b951e){_0x2a1c1c['push'](_0x2a1c1c['shift']());}};_0xbf4766(++_0x2c664e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3e3018,_0x3aaec3){var _0x4b0632=function(_0x24468f){while(--_0x24468f){_0x3e3018['push'](_0x3e3018['shift']());}};_0x4b0632(++_0x3aaec3);}(_0x70e0,0x17b));var _0x070e=function(_0x4c2326,_0x368ddf){_0x4c2326=_0x4c2326-0x0;var _0x1acc94=_0x70e0[_0x4c2326];return _0x1acc94;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 5a08a8d..ce90d41 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 _0x805b=['exports','INTEGER','sequelize'];(function(_0x2b77ec,_0x1e9650){var _0x56bbb4=function(_0x216134){while(--_0x216134){_0x2b77ec['push'](_0x2b77ec['shift']());}};_0x56bbb4(++_0x1e9650);}(_0x805b,0xad));var _0xb805=function(_0x31fc0c,_0x3705f7){_0x31fc0c=_0x31fc0c-0x0;var _0x6b0214=_0x805b[_0x31fc0c];return _0x6b0214;};'use strict';var Sequelize=require(_0xb805('0x0'));module[_0xb805('0x1')]={'penalty':{'type':Sequelize[_0xb805('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6e47=['sequelize','INTEGER'];(function(_0x6c873d,_0x3bf0ca){var _0x3428d9=function(_0x314d32){while(--_0x314d32){_0x6c873d['push'](_0x6c873d['shift']());}};_0x3428d9(++_0x3bf0ca);}(_0x6e47,0xe4));var _0x76e4=function(_0x60e690,_0x2de086){_0x60e690=_0x60e690-0x0;var _0x316cf4=_0x6e47[_0x60e690];return _0x316cf4;};'use strict';var Sequelize=require(_0x76e4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x76e4('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 3ce34f9..b4e312f 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 _0x60ce=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x26eb7f,_0x15f735){var _0x5a166b=function(_0x242da0){while(--_0x242da0){_0x26eb7f['push'](_0x26eb7f['shift']());}};_0x5a166b(++_0x15f735);}(_0x60ce,0x17c));var _0xe60c=function(_0x2c3aab,_0x1dd5fe){_0x2c3aab=_0x2c3aab-0x0;var _0x591a13=_0x60ce[_0x2c3aab];return _0x591a13;};'use strict';var _=require(_0xe60c('0x0'));var util=require(_0xe60c('0x1'));var logger=require(_0xe60c('0x2'))(_0xe60c('0x3'));var moment=require(_0xe60c('0x4'));var BPromise=require(_0xe60c('0x5'));var rp=require(_0xe60c('0x6'));var fs=require('fs');var path=require(_0xe60c('0x7'));var rimraf=require('rimraf');var config=require(_0xe60c('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xe60c('0x9')]=function(_0x1bc93e,_0x7d3336){return _0x1bc93e[_0xe60c('0xa')](_0xe60c('0xb'),attributes,{'tableName':_0xe60c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1693=['moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','../../config/logger','api'];(function(_0xdc71c8,_0x35086e){var _0x4c94db=function(_0x849bfd){while(--_0x849bfd){_0xdc71c8['push'](_0xdc71c8['shift']());}};_0x4c94db(++_0x35086e);}(_0x1693,0x15c));var _0x3169=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x1693[_0x54a2e4];return _0x4742d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3169('0x0'))(_0x3169('0x1'));var moment=require(_0x3169('0x2'));var BPromise=require('bluebird');var rp=require(_0x3169('0x3'));var fs=require('fs');var path=require(_0x3169('0x4'));var rimraf=require(_0x3169('0x5'));var config=require(_0x3169('0x6'));var attributes=require(_0x3169('0x7'));module[_0x3169('0x8')]=function(_0x348977,_0x5bbeda){return _0x348977['define']('UserOpenchannelQueue',attributes,{'tableName':_0x3169('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index d321931..af04458 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 _0xd6b6=['message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd6b6,0x143));var _0x6d6b=function(_0x3d25e3,_0x44b0b7){_0x3d25e3=_0x3d25e3-0x0;var _0x1d1669=_0xd6b6[_0x3d25e3];return _0x1d1669;};'use strict';var _=require('lodash');var util=require(_0x6d6b('0x0'));var moment=require('moment');var BPromise=require(_0x6d6b('0x1'));var rs=require(_0x6d6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d6b('0x3'))['db'];var utils=require(_0x6d6b('0x4'));var logger=require(_0x6d6b('0x5'))('rpc');var config=require(_0x6d6b('0x6'));var jayson=require(_0x6d6b('0x7'));var client=jayson[_0x6d6b('0x8')][_0x6d6b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b8ae3,_0x631c91,_0x19ad76){return new BPromise(function(_0x552715,_0x1a287d){return client[_0x6d6b('0xa')](_0x1b8ae3,_0x19ad76)[_0x6d6b('0xb')](function(_0x1daff6){logger['info'](_0x6d6b('0xc'),_0x631c91,'request\x20sent');logger['debug'](_0x6d6b('0xd'),_0x631c91,_0x6d6b('0xe'),JSON['stringify'](_0x1daff6));if(_0x1daff6[_0x6d6b('0xf')]){if(_0x1daff6[_0x6d6b('0xf')][_0x6d6b('0x10')]===0x1f4){logger[_0x6d6b('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x631c91,_0x1daff6[_0x6d6b('0xf')][_0x6d6b('0x11')]);return _0x1a287d(_0x1daff6[_0x6d6b('0xf')][_0x6d6b('0x11')]);}logger[_0x6d6b('0xf')](_0x6d6b('0xc'),_0x631c91,_0x1daff6[_0x6d6b('0xf')]['message']);return _0x552715(_0x1daff6[_0x6d6b('0xf')][_0x6d6b('0x11')]);}else{logger['info'](_0x6d6b('0xc'),_0x631c91,'request\x20sent');_0x552715(_0x1daff6[_0x6d6b('0x12')][_0x6d6b('0x11')]);}})[_0x6d6b('0x13')](function(_0x54a745){logger['error'](_0x6d6b('0xc'),_0x631c91,_0x54a745);_0x1a287d(_0x54a745);});});} \ No newline at end of file +var _0x67e8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x268106,_0x15267b){var _0x2eacb7=function(_0x1d3f57){while(--_0x1d3f57){_0x268106['push'](_0x268106['shift']());}};_0x2eacb7(++_0x15267b);}(_0x67e8,0xcf));var _0x867e=function(_0x5e7be3,_0x2c3406){_0x5e7be3=_0x5e7be3-0x0;var _0x241742=_0x67e8[_0x5e7be3];return _0x241742;};'use strict';var _=require(_0x867e('0x0'));var util=require(_0x867e('0x1'));var moment=require(_0x867e('0x2'));var BPromise=require(_0x867e('0x3'));var rs=require(_0x867e('0x4'));var fs=require('fs');var Redis=require(_0x867e('0x5'));var db=require(_0x867e('0x6'))['db'];var utils=require(_0x867e('0x7'));var logger=require(_0x867e('0x8'))(_0x867e('0x9'));var config=require(_0x867e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x867e('0xb')][_0x867e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40347a,_0x145eb4,_0x1716c3){return new BPromise(function(_0x2856ad,_0x302300){return client[_0x867e('0xd')](_0x40347a,_0x1716c3)[_0x867e('0xe')](function(_0x4715a1){logger[_0x867e('0xf')](_0x867e('0x10'),_0x145eb4,_0x867e('0x11'));logger[_0x867e('0x12')](_0x867e('0x13'),_0x145eb4,'request\x20sent',JSON[_0x867e('0x14')](_0x4715a1));if(_0x4715a1[_0x867e('0x15')]){if(_0x4715a1[_0x867e('0x15')][_0x867e('0x16')]===0x1f4){logger[_0x867e('0x15')](_0x867e('0x10'),_0x145eb4,_0x4715a1['error']['message']);return _0x302300(_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);}logger['error'](_0x867e('0x10'),_0x145eb4,_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);return _0x2856ad(_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);}else{logger[_0x867e('0xf')](_0x867e('0x10'),_0x145eb4,_0x867e('0x11'));_0x2856ad(_0x4715a1[_0x867e('0x18')]['message']);}})[_0x867e('0x19')](function(_0x24d2f9){logger[_0x867e('0x15')](_0x867e('0x10'),_0x145eb4,_0x24d2f9);_0x302300(_0x24d2f9);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index cb59928..1a844d7 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 _0x0fe1=['/:id/resources','getResources','post','create','clone','addSections','update','destroy','delete','removeResources','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/sections','getSections'];(function(_0x19ba83,_0xcfe491){var _0x5e1ec3=function(_0x6506b1){while(--_0x6506b1){_0x19ba83['push'](_0x19ba83['shift']());}};_0x5e1ec3(++_0xcfe491);}(_0x0fe1,0x19f));var _0x10fe=function(_0x3bda64,_0xbcdc32){_0x3bda64=_0x3bda64-0x0;var _0x184d63=_0x0fe1[_0x3bda64];return _0x184d63;};'use strict';var multer=require(_0x10fe('0x0'));var util=require(_0x10fe('0x1'));var path=require(_0x10fe('0x2'));var timeout=require(_0x10fe('0x3'));var express=require(_0x10fe('0x4'));var router=express[_0x10fe('0x5')]();var fs_extra=require(_0x10fe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x10fe('0x7'));var config=require(_0x10fe('0x8'));var controller=require('./userProfile.controller');router[_0x10fe('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x10fe('0x9')](_0x10fe('0xa'),auth[_0x10fe('0xb')](),controller[_0x10fe('0xc')]);router[_0x10fe('0x9')](_0x10fe('0xd'),auth[_0x10fe('0xb')](),controller[_0x10fe('0xe')]);router['get'](_0x10fe('0xf'),auth['isAuthenticated'](),controller[_0x10fe('0x10')]);router['get'](_0x10fe('0x11'),auth['isAuthenticated'](),controller[_0x10fe('0x12')]);router[_0x10fe('0x13')]('/',auth[_0x10fe('0xb')](),controller[_0x10fe('0x14')]);router['post']('/:id/clone',auth[_0x10fe('0xb')](),controller[_0x10fe('0x15')]);router['post'](_0x10fe('0xf'),auth['isAuthenticated'](),controller[_0x10fe('0x16')]);router[_0x10fe('0x13')](_0x10fe('0x11'),auth[_0x10fe('0xb')](),controller['addResources']);router['put'](_0x10fe('0xd'),auth['isAuthenticated'](),controller[_0x10fe('0x17')]);router['delete'](_0x10fe('0xd'),auth[_0x10fe('0xb')](),controller[_0x10fe('0x18')]);router[_0x10fe('0x19')](_0x10fe('0xf'),auth[_0x10fe('0xb')](),controller['removeSections']);router['delete'](_0x10fe('0x11'),auth[_0x10fe('0xb')](),controller[_0x10fe('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb740=['/:id','show','getSections','post','create','/:id/clone','/:id/sections','addSections','/:id/resources','addResources','put','update','delete','removeSections','removeResources','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe'];(function(_0x589d6e,_0x19bb47){var _0x2a4087=function(_0x4d2ac6){while(--_0x4d2ac6){_0x589d6e['push'](_0x589d6e['shift']());}};_0x2a4087(++_0x19bb47);}(_0xb740,0x9c));var _0x0b74=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb740[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0b74('0x0'));var util=require(_0x0b74('0x1'));var path=require(_0x0b74('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b74('0x3'));var router=express['Router']();var fs_extra=require(_0x0b74('0x4'));var auth=require(_0x0b74('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b74('0x6'));var controller=require(_0x0b74('0x7'));router[_0x0b74('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b74('0x9')]);router[_0x0b74('0x8')]('/describe',auth[_0x0b74('0xa')](),controller[_0x0b74('0xb')]);router[_0x0b74('0x8')](_0x0b74('0xc'),auth[_0x0b74('0xa')](),controller[_0x0b74('0xd')]);router[_0x0b74('0x8')]('/:id/sections',auth[_0x0b74('0xa')](),controller[_0x0b74('0xe')]);router[_0x0b74('0x8')]('/:id/resources',auth[_0x0b74('0xa')](),controller['getResources']);router[_0x0b74('0xf')]('/',auth['isAuthenticated'](),controller[_0x0b74('0x10')]);router['post'](_0x0b74('0x11'),auth['isAuthenticated'](),controller['clone']);router[_0x0b74('0xf')](_0x0b74('0x12'),auth[_0x0b74('0xa')](),controller[_0x0b74('0x13')]);router[_0x0b74('0xf')](_0x0b74('0x14'),auth['isAuthenticated'](),controller[_0x0b74('0x15')]);router[_0x0b74('0x16')](_0x0b74('0xc'),auth[_0x0b74('0xa')](),controller[_0x0b74('0x17')]);router[_0x0b74('0x18')](_0x0b74('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x0b74('0x18')]('/:id/sections',auth[_0x0b74('0xa')](),controller[_0x0b74('0x19')]);router[_0x0b74('0x18')](_0x0b74('0x14'),auth[_0x0b74('0xa')](),controller[_0x0b74('0x1a')]);module[_0x0b74('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2438581..ad4ade7 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 _0x2522=['sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x114928,_0x28316a){var _0x5b87a5=function(_0x4a2e17){while(--_0x4a2e17){_0x114928['push'](_0x114928['shift']());}};_0x5b87a5(++_0x28316a);}(_0x2522,0x1b0));var _0x2252=function(_0x296287,_0x329a90){_0x296287=_0x296287-0x0;var _0x5c8515=_0x2522[_0x296287];return _0x5c8515;};'use strict';var Sequelize=require(_0x2252('0x0'));module[_0x2252('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x2252('0x2')],'set':function(_0x46a876){this[_0x2252('0x3')](_0x2252('0x4'),_0x46a876?_0x46a876[_0x2252('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x2252('0x4'))?this[_0x2252('0x6')](_0x2252('0x4'))[_0x2252('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2252('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2252('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2252('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2252('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2252('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2252('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2252('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xec93=['crudPermissions','split','BOOLEAN','name','STRING','setDataValue','join'];(function(_0xbb448f,_0x57f0a5){var _0x599c18=function(_0x5034f7){while(--_0x5034f7){_0xbb448f['push'](_0xbb448f['shift']());}};_0x599c18(++_0x57f0a5);}(_0xec93,0x114));var _0x3ec9=function(_0x331725,_0x198fcb){_0x331725=_0x331725-0x0;var _0x22aadd=_0xec93[_0x331725];return _0x22aadd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ec9('0x0')},'crudPermissions':{'type':Sequelize[_0x3ec9('0x1')],'set':function(_0x43c70d){this[_0x3ec9('0x2')]('crudPermissions',_0x43c70d?_0x43c70d[_0x3ec9('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0x3ec9('0x4'))?this['getDataValue'](_0x3ec9('0x4'))[_0x3ec9('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3ec9('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x3ec9('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x3ec9('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x3ec9('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3ec9('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3ec9('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 28afdd9..347ad37 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 _0xa329=['UserProfileResource','describe','addSections','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','length','find','create','body','clone','options','get','omit','updatedAt','createdAt','sequelize','transaction','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection'];(function(_0x2b6482,_0x95e8a8){var _0x53e68f=function(_0x544be1){while(--_0x544be1){_0x2b6482['push'](_0x2b6482['shift']());}};_0x53e68f(++_0x95e8a8);}(_0xa329,0x162));var _0x9a32=function(_0x4b3b5c,_0x3d17cb){_0x4b3b5c=_0x4b3b5c-0x0;var _0x4c0c65=_0xa329[_0x4b3b5c];return _0x4c0c65;};'use strict';var emlformat=require(_0x9a32('0x0'));var rimraf=require(_0x9a32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a32('0x2'));var rp=require('request-promise');var moment=require(_0x9a32('0x3'));var BPromise=require(_0x9a32('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9a32('0x5'));var sox=require(_0x9a32('0x6'));var csv=require(_0x9a32('0x7'));var ejs=require(_0x9a32('0x8'));var fs=require('fs');var fs_extra=require(_0x9a32('0x9'));var _=require(_0x9a32('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a32('0xb'));var toCsv=require(_0x9a32('0x7'));var querystring=require('querystring');var Papa=require(_0x9a32('0xc'));var Redis=require(_0x9a32('0xd'));var authService=require(_0x9a32('0xe'));var qs=require(_0x9a32('0xf'));var as=require(_0x9a32('0x10'));var hardwareService=require(_0x9a32('0x11'));var logger=require('../../config/logger')(_0x9a32('0x12'));var utils=require(_0x9a32('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9a32('0x14'))['db'];config[_0x9a32('0x15')]=_['defaults'](config['redis'],{'host':_0x9a32('0x16'),'port':0x18eb});var socket=require(_0x9a32('0x17'))(new Redis(config[_0x9a32('0x15')]));require(_0x9a32('0x18'))['register'](socket);function respondWithStatusCode(_0x224747,_0x37ab43){_0x37ab43=_0x37ab43||0xcc;return function(_0x5d35ed){if(_0x5d35ed){return _0x224747[_0x9a32('0x19')](_0x37ab43);}return _0x224747[_0x9a32('0x1a')](_0x37ab43)[_0x9a32('0x1b')]();};}function respondWithResult(_0x448fd6,_0x20ae14){_0x20ae14=_0x20ae14||0xc8;return function(_0x1dbf9d){if(_0x1dbf9d){return _0x448fd6['status'](_0x20ae14)[_0x9a32('0x1c')](_0x1dbf9d);}};}function respondWithFilteredResult(_0x31bd3e,_0x815a68){return function(_0x4cfd70){if(_0x4cfd70){var _0x3606ab=typeof _0x815a68[_0x9a32('0x1d')]==='undefined'&&typeof _0x815a68['limit']===_0x9a32('0x1e');var _0x56df79=_0x4cfd70[_0x9a32('0x1f')];var _0x42bf59=_0x3606ab?0x0:_0x815a68[_0x9a32('0x1d')];var _0x526e92=_0x3606ab?_0x4cfd70[_0x9a32('0x1f')]:_0x815a68[_0x9a32('0x1d')]+_0x815a68[_0x9a32('0x20')];var _0x4ca971;if(_0x526e92>=_0x56df79){_0x526e92=_0x56df79;_0x4ca971=0xc8;}else{_0x4ca971=0xce;}_0x31bd3e[_0x9a32('0x1a')](_0x4ca971);return _0x31bd3e[_0x9a32('0x21')](_0x9a32('0x22'),_0x42bf59+'-'+_0x526e92+'/'+_0x56df79)[_0x9a32('0x1c')](_0x4cfd70);}return null;};}function patchUpdates(_0x3b3e66){return function(_0x210a32){try{jsonpatch['apply'](_0x210a32,_0x3b3e66,!![]);}catch(_0x4e6e68){return BPromise[_0x9a32('0x23')](_0x4e6e68);}return _0x210a32[_0x9a32('0x24')]();};}function saveUpdates(_0x109144,_0x4d8771){return function(_0x494aca){if(_0x494aca){return _0x494aca[_0x9a32('0x25')](_0x109144)[_0x9a32('0x26')](function(_0x301dac){return _0x301dac;});}return null;};}function removeEntity(_0x51889a,_0x49531d){return function(_0x4b7f6b){if(_0x4b7f6b){return _0x4b7f6b[_0x9a32('0x27')]()['then'](function(){_0x51889a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f5a84,_0x13a5d5){return function(_0x10edcf){if(!_0x10edcf){_0x1f5a84[_0x9a32('0x19')](0x194);}return _0x10edcf;};}function handleError(_0x4168e3,_0x3209a8){_0x3209a8=_0x3209a8||0x1f4;return function(_0x13787b){logger[_0x9a32('0x28')](_0x13787b[_0x9a32('0x29')]);if(_0x13787b[_0x9a32('0x2a')]){delete _0x13787b[_0x9a32('0x2a')];}_0x4168e3['status'](_0x3209a8)[_0x9a32('0x2b')](_0x13787b);};}exports[_0x9a32('0x2c')]=function(_0x5b7a1d,_0x3e9e85){var _0x48674a={},_0x18a7b3={},_0x227dbc={'count':0x0,'rows':[]};var _0x416ba3=_[_0x9a32('0x2d')](db[_0x9a32('0x2e')]['rawAttributes'],function(_0xcabf0f){return{'name':_0xcabf0f[_0x9a32('0x2f')],'type':_0xcabf0f[_0x9a32('0x30')][_0x9a32('0x31')]};});_0x18a7b3[_0x9a32('0x32')]=_[_0x9a32('0x2d')](_0x416ba3,'name');_0x18a7b3[_0x9a32('0x33')]=_[_0x9a32('0x34')](_0x5b7a1d[_0x9a32('0x33')]);_0x18a7b3[_0x9a32('0x35')]=_[_0x9a32('0x36')](_0x18a7b3['model'],_0x18a7b3[_0x9a32('0x33')]);_0x48674a['attributes']=_[_0x9a32('0x36')](_0x18a7b3['model'],qs['fields'](_0x5b7a1d['query']['fields']));_0x48674a[_0x9a32('0x37')]=_0x48674a[_0x9a32('0x37')]['length']?_0x48674a[_0x9a32('0x37')]:_0x18a7b3[_0x9a32('0x32')];if(!_0x5b7a1d[_0x9a32('0x33')][_0x9a32('0x38')](_0x9a32('0x39'))){_0x48674a['limit']=qs[_0x9a32('0x20')](_0x5b7a1d[_0x9a32('0x33')][_0x9a32('0x20')]);_0x48674a[_0x9a32('0x1d')]=qs[_0x9a32('0x1d')](_0x5b7a1d[_0x9a32('0x33')][_0x9a32('0x1d')]);}_0x48674a[_0x9a32('0x3a')]=qs[_0x9a32('0x3b')](_0x5b7a1d['query'][_0x9a32('0x3b')]);_0x48674a['where']=qs[_0x9a32('0x35')](_[_0x9a32('0x3c')](_0x5b7a1d[_0x9a32('0x33')],_0x18a7b3[_0x9a32('0x35')]),_0x416ba3);if(_0x5b7a1d[_0x9a32('0x33')][_0x9a32('0x3d')]){_0x48674a[_0x9a32('0x3e')]=_[_0x9a32('0x3f')](_0x48674a[_0x9a32('0x3e')],{'$or':_[_0x9a32('0x2d')](_0x416ba3,function(_0x1b464b){if(_0x1b464b[_0x9a32('0x30')]!=='VIRTUAL'){var _0xdba972={};_0xdba972[_0x1b464b['name']]={'$like':'%'+_0x5b7a1d[_0x9a32('0x33')][_0x9a32('0x3d')]+'%'};return _0xdba972;}})});}_0x48674a=_['merge']({},_0x48674a,_0x5b7a1d['options']);var _0x58bb76={'where':_0x48674a[_0x9a32('0x3e')]};return db[_0x9a32('0x2e')]['count'](_0x58bb76)[_0x9a32('0x26')](function(_0x551215){_0x227dbc[_0x9a32('0x1f')]=_0x551215;if(_0x5b7a1d[_0x9a32('0x33')][_0x9a32('0x40')]){_0x48674a[_0x9a32('0x41')]=[{'all':!![]}];}return db[_0x9a32('0x2e')][_0x9a32('0x42')](_0x48674a);})[_0x9a32('0x26')](function(_0x50a03d){_0x227dbc[_0x9a32('0x43')]=_0x50a03d;return _0x227dbc;})[_0x9a32('0x26')](respondWithFilteredResult(_0x3e9e85,_0x48674a))[_0x9a32('0x44')](handleError(_0x3e9e85,null));};exports['show']=function(_0x28d7ee,_0x535ac7){var _0x43e16a={'raw':![],'where':{'id':_0x28d7ee[_0x9a32('0x45')]['id']}},_0x3eee4e={};_0x3eee4e['model']=_[_0x9a32('0x34')](db[_0x9a32('0x2e')][_0x9a32('0x46')]);_0x3eee4e[_0x9a32('0x33')]=_[_0x9a32('0x34')](_0x28d7ee[_0x9a32('0x33')]);_0x3eee4e[_0x9a32('0x35')]=_[_0x9a32('0x36')](_0x3eee4e['model'],_0x3eee4e[_0x9a32('0x33')]);_0x43e16a['attributes']=_[_0x9a32('0x36')](_0x3eee4e[_0x9a32('0x32')],qs[_0x9a32('0x47')](_0x28d7ee[_0x9a32('0x33')][_0x9a32('0x47')]));_0x43e16a[_0x9a32('0x37')]=_0x43e16a[_0x9a32('0x37')][_0x9a32('0x48')]?_0x43e16a[_0x9a32('0x37')]:_0x3eee4e[_0x9a32('0x32')];if(_0x28d7ee[_0x9a32('0x33')]['includeAll']){_0x43e16a['include']=[{'all':!![]}];}_0x43e16a=_[_0x9a32('0x3f')]({},_0x43e16a,_0x28d7ee['options']);return db[_0x9a32('0x2e')][_0x9a32('0x49')](_0x43e16a)[_0x9a32('0x26')](handleEntityNotFound(_0x535ac7,null))[_0x9a32('0x26')](respondWithResult(_0x535ac7,null))['catch'](handleError(_0x535ac7,null));};exports[_0x9a32('0x4a')]=function(_0x253ebc,_0x195de1){return db[_0x9a32('0x2e')][_0x9a32('0x4a')](_0x253ebc[_0x9a32('0x4b')],{})[_0x9a32('0x26')](respondWithResult(_0x195de1,0xc9))[_0x9a32('0x44')](handleError(_0x195de1,null));};exports[_0x9a32('0x4c')]=function(_0x5108d6,_0x39808e){var _0x439270={'where':{'id':_0x5108d6[_0x9a32('0x45')]['id']}},_0x44b0e8={};_0x44b0e8[_0x9a32('0x32')]=_[_0x9a32('0x34')](db['UserProfile'][_0x9a32('0x46')]);_0x439270['attributes']=_[_0x9a32('0x36')](_0x44b0e8[_0x9a32('0x32')],qs[_0x9a32('0x47')](_0x5108d6[_0x9a32('0x33')][_0x9a32('0x47')]));_0x439270[_0x9a32('0x37')]=_0x439270[_0x9a32('0x37')][_0x9a32('0x48')]?_0x439270['attributes']:_0x44b0e8[_0x9a32('0x32')];if(_0x5108d6[_0x9a32('0x33')]['includeAll']){_0x439270['include']=[{'all':!![]}];}_0x439270=_[_0x9a32('0x3f')]({},_0x439270,_0x5108d6[_0x9a32('0x4d')]);return db['UserProfile'][_0x9a32('0x49')](_0x439270)[_0x9a32('0x26')](handleEntityNotFound(_0x39808e,null))[_0x9a32('0x26')](function(_0x519398){if(_0x519398){var _0x452290=_0x519398[_0x9a32('0x4e')]({'plain':!![]});_0x452290=qs[_0x9a32('0x4f')](_0x452290,['id','createdAt',_0x9a32('0x50'),'crudPermissions']);_0x5108d6['body']=_[_0x9a32('0x4f')](_0x5108d6[_0x9a32('0x4b')],['id',_0x9a32('0x51'),'updatedAt']);return db[_0x9a32('0x52')][_0x9a32('0x53')](function(_0x16c9c2){return db[_0x9a32('0x2e')][_0x9a32('0x4a')](_[_0x9a32('0x3f')](_0x452290,_0x5108d6[_0x9a32('0x4b')]),{'include':_0x5108d6[_0x9a32('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x16c9c2})['then'](function(_0x5c67c8){var _0x237a22=_0x5c67c8[_0x9a32('0x4e')]({'plain':!![]});return db['UserProfileSection'][_0x9a32('0x42')]({'where':{'userProfileId':_0x5108d6[_0x9a32('0x45')]['id']},'raw':!![]})[_0x9a32('0x26')](function(_0x291ea6){if(_0x291ea6){return BPromise[_0x9a32('0x54')](_0x291ea6,function(_0x6e5b4){return new BPromise(function(_0x31f8b3,_0x3aa8cb){if(_0x6e5b4[_0x9a32('0x55')]===null||_0x6e5b4['autoAssociation']===0x1)_0x31f8b3(null);return db['UserProfileResource'][_0x9a32('0x42')]({'where':{'sectionId':_0x6e5b4['id']},'raw':!![]})[_0x9a32('0x26')](function(_0x5a7dbd){var _0x4ddb3f=_[_0x9a32('0x2d')](_0x5a7dbd,function(_0xc777cc){return qs[_0x9a32('0x4f')](_0xc777cc,['id',_0x9a32('0x51'),_0x9a32('0x50'),_0x9a32('0x56')]);});_0x31f8b3(_0x4ddb3f);})[_0x9a32('0x44')](function(_0x5c37c9){_0x3aa8cb(_0x5c37c9);});})[_0x9a32('0x26')](function(_0xe2ba2e){var _0x3447d9=qs[_0x9a32('0x4f')](_0x6e5b4,['id',_0x9a32('0x51'),_0x9a32('0x50')]);_0x3447d9[_0x9a32('0x57')]=_0x237a22['id'];if(_0xe2ba2e)_0x3447d9[_0x9a32('0x58')]=_0xe2ba2e;return _0x3447d9;})[_0x9a32('0x26')](function(_0x537e8f){return db[_0x9a32('0x59')][_0x9a32('0x4a')](_0x537e8f,{'include':[{'model':db[_0x9a32('0x5a')],'as':_0x9a32('0x58')}],'raw':!![],'transaction':_0x16c9c2});});})[_0x9a32('0x26')](function(){return _0x237a22;});}});});});}})[_0x9a32('0x26')](respondWithResult(_0x39808e,0xc9))[_0x9a32('0x44')](handleError(_0x39808e,null));};exports[_0x9a32('0x25')]=function(_0x5389bf,_0x1d95ab){if(_0x5389bf[_0x9a32('0x4b')]['id']){delete _0x5389bf[_0x9a32('0x4b')]['id'];}return db[_0x9a32('0x2e')]['find']({'where':{'id':_0x5389bf[_0x9a32('0x45')]['id']}})[_0x9a32('0x26')](handleEntityNotFound(_0x1d95ab,null))[_0x9a32('0x26')](saveUpdates(_0x5389bf[_0x9a32('0x4b')],null))[_0x9a32('0x26')](respondWithResult(_0x1d95ab,null))[_0x9a32('0x44')](handleError(_0x1d95ab,null));};exports[_0x9a32('0x27')]=function(_0x5ab47b,_0x18abe9){return db['UserProfile'][_0x9a32('0x49')]({'where':{'id':_0x5ab47b['params']['id']}})[_0x9a32('0x26')](handleEntityNotFound(_0x18abe9,null))[_0x9a32('0x26')](removeEntity(_0x18abe9,null))[_0x9a32('0x44')](handleError(_0x18abe9,null));};exports[_0x9a32('0x5b')]=function(_0x182402,_0x49a671){return db[_0x9a32('0x2e')][_0x9a32('0x5b')]()['then'](respondWithResult(_0x49a671,null))[_0x9a32('0x44')](handleError(_0x49a671,null));};exports[_0x9a32('0x5c')]=function(_0x2c3704,_0x1a9889){var _0x31d81c=_0x2c3704[_0x9a32('0x4b')];return db['UserProfile'][_0x9a32('0x49')]({'where':{'id':_0x2c3704[_0x9a32('0x45')]['id']}})[_0x9a32('0x26')](handleEntityNotFound(_0x1a9889,null))[_0x9a32('0x26')](function(_0x6ad0eb){if(_0x6ad0eb){return db[_0x9a32('0x52')][_0x9a32('0x53')](function(_0x3ed9b4){return db[_0x9a32('0x59')]['destroy']({'where':{'userProfileId':_0x2c3704[_0x9a32('0x45')]['id'],'sectionId':_[_0x9a32('0x2d')](_0x31d81c,function(_0x309a9c){return _0x309a9c[_0x9a32('0x56')];})},'transaction':_0x3ed9b4})[_0x9a32('0x26')](function(){var _0x36d866=_['map'](_0x31d81c,function(_0x4c4a85){_0x4c4a85['userProfileId']=_0x2c3704['params']['id'];return _0x4c4a85;});var _0x35a973=[];return BPromise[_0x9a32('0x54')](_0x36d866,function(_0x1015b5){return db['UserProfileSection'][_0x9a32('0x4a')](_0x1015b5,{'include':[{'model':db[_0x9a32('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x3ed9b4})['then'](function(_0x11da52){_0x35a973[_0x9a32('0x5d')](_0x11da52[_0x9a32('0x4e')]({'plain':!![]}));});})[_0x9a32('0x26')](function(){return _0x35a973;});});});}})[_0x9a32('0x26')](function(_0x5c7454){return _0x5c7454;})[_0x9a32('0x26')](respondWithResult(_0x1a9889,null))[_0x9a32('0x44')](handleError(_0x1a9889,null));};exports[_0x9a32('0x5e')]=function(_0xe30624,_0x465c2c){var _0x5cabc9;return db[_0x9a32('0x2e')][_0x9a32('0x49')]({'where':{'id':_0xe30624[_0x9a32('0x45')]['id']},'attributes':['id',_0x9a32('0x2a')]})[_0x9a32('0x26')](handleEntityNotFound(_0x465c2c,null))['then'](function(_0x4af5f2){if(_0x4af5f2){_0x5cabc9=_0x4af5f2;return db[_0x9a32('0x59')]['destroy']({'where':{'userProfileId':_0xe30624[_0x9a32('0x45')]['id'],'sectionId':_0xe30624[_0x9a32('0x33')][_0x9a32('0x5f')]}});}})[_0x9a32('0x26')](function(){return _0x5cabc9;})[_0x9a32('0x26')](respondWithStatusCode(_0x465c2c,null))[_0x9a32('0x44')](handleError(_0x465c2c,null));};exports[_0x9a32('0x60')]=function(_0x1a1a7d,_0x68b2a7){var _0x254c77=[];var _0x3d76f2=[];return db[_0x9a32('0x59')][_0x9a32('0x42')]({'where':{'userProfileId':_0x1a1a7d['params']['id']},'raw':!![]})[_0x9a32('0x26')](function(_0x338a2b){_0x254c77=_[_0x9a32('0x3d')](_0x338a2b,function(_0x3b8947){return _0x3b8947['enabled']===0x1||_[_0x9a32('0x61')]([0x3eb,0x709],_0x3b8947[_0x9a32('0x56')]);});if(!_[_0x9a32('0x62')](_0x254c77)){return _[_0x9a32('0x2d')](_0x254c77,function(_0x9a57c7){return _0x9a57c7[_0x9a32('0x56')];});}else{return;}})[_0x9a32('0x26')](function(_0x3e490c){if(_0x3e490c)_0x3d76f2=_0x3e490c;if(_[_0x9a32('0x61')](_0x3d76f2,0x64)){var _0x3d5e7d=_[_0x9a32('0x49')](_0x254c77,{'sectionId':0x64});return hasDefaultDashboard(_0x3d5e7d)[_0x9a32('0x26')](function(_0x4889b2){return _[_0x9a32('0x2d')](_0x254c77,function(_0x14968c){if(_0x14968c[_0x9a32('0x56')]===0x64){_0x14968c[_0x9a32('0x63')]=_0x4889b2;}return _0x14968c;});});}else{return;}})['then'](function(_0x220a45){if(_0x220a45)_0x254c77=_0x220a45;if(_[_0x9a32('0x61')](_0x3d76f2,0x3eb)){var _0x33a4f6=_[_0x9a32('0x49')](_0x254c77,{'sectionId':0x3eb});return getCustomDashboards(_0x33a4f6)['then'](function(_0x3487d5){return _['map'](_0x254c77,function(_0x3e2675){if(_0x33a4f6[_0x9a32('0x64')]){if(_0x3e2675[_0x9a32('0x56')]===0x3eb){_0x3e2675[_0x9a32('0x63')]=_0x3487d5;}}else{if(_0x3e2675[_0x9a32('0x56')]===0x64){_0x3e2675['subsections']=_0x3487d5;}}return _0x3e2675;});});}else{return;}})[_0x9a32('0x26')](function(_0x1262de){if(_0x1262de)_0x254c77=_0x1262de;if(_[_0x9a32('0x61')](_0x3d76f2,0x709)){var _0x1e5900=_[_0x9a32('0x49')](_0x254c77,{'sectionId':0x709});return getPlugins(_0x1e5900)['then'](function(_0x34730b){if(_0x1e5900[_0x9a32('0x64')]){return _[_0x9a32('0x2d')](_0x254c77,function(_0x1b6dd6){if(_0x1b6dd6['sectionId']===0x709){_0x1b6dd6[_0x9a32('0x63')]=_0x34730b;}return _0x1b6dd6;});}else{var _0x347e99={'sectionId':0x76c,'enabled':0x1,'subsections':_0x34730b};var _0x52c92a=_[_0x9a32('0x2d')](_0x254c77);_0x52c92a[_0x9a32('0x5d')](_0x347e99);return _0x52c92a;}});}else{return;}})[_0x9a32('0x26')](function(_0x286495){if(_0x286495)_0x254c77=_0x286495;return _['filter'](_0x254c77,[_0x9a32('0x64'),0x1]);})[_0x9a32('0x26')](respondWithResult(_0x68b2a7,null))['catch'](handleError(_0x68b2a7,null));};function hasDefaultDashboard(_0x3a5773){var _0x53fb25=[0x65];return new BPromise(function(_0x532329,_0x5a13af){try{if(_0x3a5773['autoAssociation']){_0x532329(_0x53fb25);}else{return db[_0x9a32('0x5a')]['findOne']({'where':{'sectionId':_0x3a5773['id']},'raw':!![]})[_0x9a32('0x26')](function(_0x425e71){_0x425e71?_0x532329(_0x53fb25):_0x532329();});}}catch(_0x429f91){_0x5a13af(_0x429f91);}});}function getCustomDashboards(_0x25a5e8){var _0x14c11d=[];return new BPromise(function(_0x2f2761,_0x2a3450){try{if(_0x25a5e8[_0x9a32('0x55')]){return db[_0x9a32('0x65')][_0x9a32('0x42')]({'raw':!![]})[_0x9a32('0x26')](function(_0x14697b){_0x14697b[_0x9a32('0x66')](function(_0x41d357){_0x14c11d[_0x9a32('0x5d')](_0x41d357['id']+0x1869f);});_0x2f2761(_0x14c11d);});}else{return db[_0x9a32('0x5a')][_0x9a32('0x42')]({'where':{'sectionId':_0x25a5e8['id']},'raw':!![]})[_0x9a32('0x26')](function(_0x39fbf4){_0x39fbf4[_0x9a32('0x66')](function(_0x2ecb0a){_0x14c11d['push'](_0x2ecb0a['resourceId']+0x1869f);});_0x2f2761(_0x14c11d);});}}catch(_0x3387e3){_0x2a3450(_0x3387e3);}});}function getPlugins(_0x2ff970){var _0x203573=[];return new BPromise(function(_0x37d9d5,_0x4fe33d){try{if(_0x2ff970[_0x9a32('0x55')]){return db[_0x9a32('0x67')][_0x9a32('0x42')]({'raw':!![]})['then'](function(_0x565fbb){_0x565fbb[_0x9a32('0x66')](function(_0x3911c6){_0x203573[_0x9a32('0x5d')](_0x3911c6['id']+0x15b38);});_0x37d9d5(_0x203573);});}else{return db[_0x9a32('0x5a')][_0x9a32('0x42')]({'where':{'sectionId':_0x2ff970['id']},'raw':!![]})[_0x9a32('0x26')](function(_0x5a874e){_0x5a874e[_0x9a32('0x66')](function(_0x531f44){_0x203573[_0x9a32('0x5d')](_0x531f44[_0x9a32('0x68')]+0x15b38);});_0x37d9d5(_0x203573);});}}catch(_0x189a83){_0x4fe33d(_0x189a83);}});}exports[_0x9a32('0x69')]=function(_0x2e19df,_0xef60f8){return db[_0x9a32('0x2e')][_0x9a32('0x49')]({'where':{'id':_0x2e19df[_0x9a32('0x45')]['id']}})[_0x9a32('0x26')](handleEntityNotFound(_0xef60f8,null))[_0x9a32('0x26')](function(_0x301df0){if(_0x301df0){return db['sequelize'][_0x9a32('0x53')](function(_0x376f93){return db[_0x9a32('0x59')][_0x9a32('0x42')]({'where':{'userProfileId':_0x2e19df[_0x9a32('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0x9a32('0x26')](function(_0x331444){if(_0x331444){return db[_0x9a32('0x59')][_0x9a32('0x27')]({'where':{'userProfileId':_0x2e19df[_0x9a32('0x45')]['id'],'id':_[_0x9a32('0x2d')](_0x331444,function(_0x177a3a){return _0x177a3a['id'];})},'transaction':_0x376f93});}})[_0x9a32('0x26')](function(_0x327c2a){var _0x4908ef=_['map'](_0x2e19df[_0x9a32('0x4b')],function(_0x56a8e4){_0x56a8e4[_0x9a32('0x57')]=_0x2e19df[_0x9a32('0x45')]['id'];return _0x56a8e4;});return db[_0x9a32('0x59')][_0x9a32('0x6a')](_0x4908ef,{'raw':!![],'transaction':_0x376f93});})[_0x9a32('0x26')](function(_0x48901a){var _0x591d8=_['filter'](_[_0x9a32('0x2d')](_0x48901a,function(_0x35ef0a){return _0x35ef0a['get']({'plain':!![]});}),{'includeAll':![]});if(_0x591d8){return db[_0x9a32('0x59')][_0x9a32('0x42')]({'where':{'userProfileId':_0x2e19df[_0x9a32('0x45')]['id'],'sectionId':_[_0x9a32('0x2d')](_0x591d8,function(_0x523ac7){return _0x523ac7[_0x9a32('0x56')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x9a32('0x26')](function(_0x3e4382){var _0x4a2335=_[_0x9a32('0x2d')](_0x2e19df['body'],function(_0x5e6d6d){_0x5e6d6d['userProfileId']=_0x2e19df[_0x9a32('0x45')]['id'];return _0x5e6d6d;});return db[_0x9a32('0x5a')]['bulkCreate'](_0x4a2335,{'raw':!![],'transaction':_0x376f93});});}})['catch'](handleError(_0xef60f8,null));});}})[_0x9a32('0x26')](function(_0x244d54){var _0x4606e0=_['map'](_0x244d54,function(_0x579d65){return _0x579d65[_0x9a32('0x4e')]({'plain':!![]});});})[_0x9a32('0x26')](respondWithResult(_0xef60f8,null))[_0x9a32('0x44')](handleError(_0xef60f8,null));};exports['removeResources']=function(_0xe68b91,_0xa873bd,_0x13bea0){return db[_0x9a32('0x2e')]['find']({'where':{'id':_0xe68b91[_0x9a32('0x45')]['id']}})['then'](handleEntityNotFound(_0xa873bd,null))['then'](function(_0x19c888){if(_0x19c888){return _0x19c888[_0x9a32('0x6b')](_0xe68b91[_0x9a32('0x33')]['ids']);}})[_0x9a32('0x26')](respondWithStatusCode(_0xa873bd,null))[_0x9a32('0x44')](handleError(_0xa873bd,null));};exports[_0x9a32('0x6c')]=function(_0x67d518,_0x46a76f){var _0x3937ce={};if(!_0x67d518[_0x9a32('0x33')]['section'])throw new Error(_0x9a32('0x6d'));if(!_0x67d518[_0x9a32('0x33')][_0x9a32('0x38')]('nolimit')){_0x3937ce[_0x9a32('0x20')]=qs[_0x9a32('0x20')](_0x67d518[_0x9a32('0x33')][_0x9a32('0x20')]);_0x3937ce[_0x9a32('0x1d')]=qs[_0x9a32('0x1d')](_0x67d518['query']['offset']);}return db[_0x9a32('0x2e')][_0x9a32('0x49')]({'where':{'id':_0x67d518['params']['id']}})[_0x9a32('0x26')](function(_0x21f2eb){if(!_0x21f2eb)throw new Error(_0x9a32('0x6e')+_0x67d518[_0x9a32('0x45')]['id']);return db['UserProfile']['getResources'](_0x67d518);})[_0x9a32('0x26')](respondWithFilteredResult(_0x46a76f,_0x3937ce))[_0x9a32('0x44')](handleError(_0x46a76f,null));}; \ No newline at end of file +var _0xfb0b=['options','find','create','body','clone','get','createdAt','updatedAt','crudPermissions','UserProfileSection','autoAssociation','UserProfileResource','omit','sectionId','Resources','destroy','describe','transaction','userProfileId','each','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','push','resourceId','Plugin','addResources','sequelize','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xfb0b,0x94));var _0xbfb0=function(_0x357d29,_0x3f4925){_0x357d29=_0x357d29-0x0;var _0x142cfa=_0xfb0b[_0x357d29];return _0x142cfa;};'use strict';var emlformat=require(_0xbfb0('0x0'));var rimraf=require(_0xbfb0('0x1'));var zipdir=require(_0xbfb0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbfb0('0x3'));var moment=require(_0xbfb0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbfb0('0x5'));var path=require('path');var sox=require(_0xbfb0('0x6'));var csv=require(_0xbfb0('0x7'));var ejs=require(_0xbfb0('0x8'));var fs=require('fs');var fs_extra=require(_0xbfb0('0x9'));var _=require(_0xbfb0('0xa'));var squel=require(_0xbfb0('0xb'));var crypto=require('crypto');var jsforce=require(_0xbfb0('0xc'));var deskjs=require(_0xbfb0('0xd'));var toCsv=require(_0xbfb0('0x7'));var querystring=require(_0xbfb0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbfb0('0xf'));var hardwareService=require(_0xbfb0('0x10'));var logger=require(_0xbfb0('0x11'))('api');var utils=require(_0xbfb0('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbfb0('0x13'));var db=require(_0xbfb0('0x14'))['db'];config[_0xbfb0('0x15')]=_[_0xbfb0('0x16')](config[_0xbfb0('0x15')],{'host':_0xbfb0('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfb0('0x15')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x47e716,_0x141e62){_0x141e62=_0x141e62||0xcc;return function(_0x2c9768){if(_0x2c9768){return _0x47e716[_0xbfb0('0x18')](_0x141e62);}return _0x47e716[_0xbfb0('0x19')](_0x141e62)[_0xbfb0('0x1a')]();};}function respondWithResult(_0x213994,_0x2470cf){_0x2470cf=_0x2470cf||0xc8;return function(_0x2d8773){if(_0x2d8773){return _0x213994[_0xbfb0('0x19')](_0x2470cf)[_0xbfb0('0x1b')](_0x2d8773);}};}function respondWithFilteredResult(_0x2496b8,_0x4e48b1){return function(_0x5c8a1e){if(_0x5c8a1e){var _0x3319a1=typeof _0x4e48b1[_0xbfb0('0x1c')]==='undefined'&&typeof _0x4e48b1[_0xbfb0('0x1d')]===_0xbfb0('0x1e');var _0x4a6a88=_0x5c8a1e[_0xbfb0('0x1f')];var _0x4b4878=_0x3319a1?0x0:_0x4e48b1[_0xbfb0('0x1c')];var _0x4350fe=_0x3319a1?_0x5c8a1e[_0xbfb0('0x1f')]:_0x4e48b1[_0xbfb0('0x1c')]+_0x4e48b1['limit'];var _0x31c2eb;if(_0x4350fe>=_0x4a6a88){_0x4350fe=_0x4a6a88;_0x31c2eb=0xc8;}else{_0x31c2eb=0xce;}_0x2496b8['status'](_0x31c2eb);return _0x2496b8[_0xbfb0('0x20')]('Content-Range',_0x4b4878+'-'+_0x4350fe+'/'+_0x4a6a88)[_0xbfb0('0x1b')](_0x5c8a1e);}return null;};}function patchUpdates(_0x4cae5a){return function(_0x2fe191){try{jsonpatch['apply'](_0x2fe191,_0x4cae5a,!![]);}catch(_0x278b3d){return BPromise[_0xbfb0('0x21')](_0x278b3d);}return _0x2fe191[_0xbfb0('0x22')]();};}function saveUpdates(_0x3ab347,_0x515d0f){return function(_0x2efb2a){if(_0x2efb2a){return _0x2efb2a[_0xbfb0('0x23')](_0x3ab347)['then'](function(_0x4e86c8){return _0x4e86c8;});}return null;};}function removeEntity(_0x1625e3,_0x1e4a2e){return function(_0x39c5f8){if(_0x39c5f8){return _0x39c5f8['destroy']()[_0xbfb0('0x24')](function(){_0x1625e3['status'](0xcc)[_0xbfb0('0x1a')]();});}};}function handleEntityNotFound(_0x46dac3,_0x250ce8){return function(_0x402db3){if(!_0x402db3){_0x46dac3[_0xbfb0('0x18')](0x194);}return _0x402db3;};}function handleError(_0x1d0e8d,_0xb41263){_0xb41263=_0xb41263||0x1f4;return function(_0x57ab45){logger[_0xbfb0('0x25')](_0x57ab45[_0xbfb0('0x26')]);if(_0x57ab45[_0xbfb0('0x27')]){delete _0x57ab45[_0xbfb0('0x27')];}_0x1d0e8d['status'](_0xb41263)[_0xbfb0('0x28')](_0x57ab45);};}exports[_0xbfb0('0x29')]=function(_0x4e511c,_0x188c90){var _0x6ba12c={},_0x41ad24={},_0x1a5623={'count':0x0,'rows':[]};var _0x4a720c=_[_0xbfb0('0x2a')](db[_0xbfb0('0x2b')][_0xbfb0('0x2c')],function(_0x3f7353){return{'name':_0x3f7353[_0xbfb0('0x2d')],'type':_0x3f7353[_0xbfb0('0x2e')][_0xbfb0('0x2f')]};});_0x41ad24['model']=_['map'](_0x4a720c,'name');_0x41ad24[_0xbfb0('0x30')]=_[_0xbfb0('0x31')](_0x4e511c[_0xbfb0('0x30')]);_0x41ad24[_0xbfb0('0x32')]=_[_0xbfb0('0x33')](_0x41ad24[_0xbfb0('0x34')],_0x41ad24[_0xbfb0('0x30')]);_0x6ba12c[_0xbfb0('0x35')]=_['intersection'](_0x41ad24['model'],qs['fields'](_0x4e511c[_0xbfb0('0x30')][_0xbfb0('0x36')]));_0x6ba12c[_0xbfb0('0x35')]=_0x6ba12c[_0xbfb0('0x35')][_0xbfb0('0x37')]?_0x6ba12c['attributes']:_0x41ad24['model'];if(!_0x4e511c[_0xbfb0('0x30')][_0xbfb0('0x38')](_0xbfb0('0x39'))){_0x6ba12c[_0xbfb0('0x1d')]=qs[_0xbfb0('0x1d')](_0x4e511c[_0xbfb0('0x30')][_0xbfb0('0x1d')]);_0x6ba12c[_0xbfb0('0x1c')]=qs[_0xbfb0('0x1c')](_0x4e511c[_0xbfb0('0x30')]['offset']);}_0x6ba12c['order']=qs[_0xbfb0('0x3a')](_0x4e511c[_0xbfb0('0x30')]['sort']);_0x6ba12c[_0xbfb0('0x3b')]=qs['filters'](_[_0xbfb0('0x3c')](_0x4e511c[_0xbfb0('0x30')],_0x41ad24['filters']),_0x4a720c);if(_0x4e511c['query'][_0xbfb0('0x3d')]){_0x6ba12c[_0xbfb0('0x3b')]=_['merge'](_0x6ba12c[_0xbfb0('0x3b')],{'$or':_['map'](_0x4a720c,function(_0x21da9c){if(_0x21da9c['type']!=='VIRTUAL'){var _0x1af0a0={};_0x1af0a0[_0x21da9c[_0xbfb0('0x27')]]={'$like':'%'+_0x4e511c[_0xbfb0('0x30')][_0xbfb0('0x3d')]+'%'};return _0x1af0a0;}})});}_0x6ba12c=_[_0xbfb0('0x3e')]({},_0x6ba12c,_0x4e511c['options']);var _0x4240a={'where':_0x6ba12c[_0xbfb0('0x3b')]};return db[_0xbfb0('0x2b')][_0xbfb0('0x1f')](_0x4240a)[_0xbfb0('0x24')](function(_0x90da0c){_0x1a5623[_0xbfb0('0x1f')]=_0x90da0c;if(_0x4e511c[_0xbfb0('0x30')][_0xbfb0('0x3f')]){_0x6ba12c[_0xbfb0('0x40')]=[{'all':!![]}];}return db[_0xbfb0('0x2b')][_0xbfb0('0x41')](_0x6ba12c);})[_0xbfb0('0x24')](function(_0x3caaf3){_0x1a5623[_0xbfb0('0x42')]=_0x3caaf3;return _0x1a5623;})[_0xbfb0('0x24')](respondWithFilteredResult(_0x188c90,_0x6ba12c))[_0xbfb0('0x43')](handleError(_0x188c90,null));};exports[_0xbfb0('0x44')]=function(_0x5af02d,_0xa7f6c3){var _0x1401bb={'raw':![],'where':{'id':_0x5af02d[_0xbfb0('0x45')]['id']}},_0x2769d3={};_0x2769d3[_0xbfb0('0x34')]=_[_0xbfb0('0x31')](db[_0xbfb0('0x2b')][_0xbfb0('0x2c')]);_0x2769d3[_0xbfb0('0x30')]=_[_0xbfb0('0x31')](_0x5af02d['query']);_0x2769d3['filters']=_[_0xbfb0('0x33')](_0x2769d3[_0xbfb0('0x34')],_0x2769d3['query']);_0x1401bb['attributes']=_[_0xbfb0('0x33')](_0x2769d3[_0xbfb0('0x34')],qs[_0xbfb0('0x36')](_0x5af02d[_0xbfb0('0x30')][_0xbfb0('0x36')]));_0x1401bb[_0xbfb0('0x35')]=_0x1401bb['attributes'][_0xbfb0('0x37')]?_0x1401bb[_0xbfb0('0x35')]:_0x2769d3[_0xbfb0('0x34')];if(_0x5af02d[_0xbfb0('0x30')][_0xbfb0('0x3f')]){_0x1401bb[_0xbfb0('0x40')]=[{'all':!![]}];}_0x1401bb=_[_0xbfb0('0x3e')]({},_0x1401bb,_0x5af02d[_0xbfb0('0x46')]);return db[_0xbfb0('0x2b')][_0xbfb0('0x47')](_0x1401bb)[_0xbfb0('0x24')](handleEntityNotFound(_0xa7f6c3,null))[_0xbfb0('0x24')](respondWithResult(_0xa7f6c3,null))[_0xbfb0('0x43')](handleError(_0xa7f6c3,null));};exports[_0xbfb0('0x48')]=function(_0x2845da,_0xf085ab){return db[_0xbfb0('0x2b')][_0xbfb0('0x48')](_0x2845da[_0xbfb0('0x49')],{})[_0xbfb0('0x24')](respondWithResult(_0xf085ab,0xc9))[_0xbfb0('0x43')](handleError(_0xf085ab,null));};exports[_0xbfb0('0x4a')]=function(_0x3f1972,_0x35b22e){var _0x59dd29={'where':{'id':_0x3f1972[_0xbfb0('0x45')]['id']}},_0x41c1d4={};_0x41c1d4[_0xbfb0('0x34')]=_[_0xbfb0('0x31')](db[_0xbfb0('0x2b')][_0xbfb0('0x2c')]);_0x59dd29[_0xbfb0('0x35')]=_['intersection'](_0x41c1d4[_0xbfb0('0x34')],qs[_0xbfb0('0x36')](_0x3f1972[_0xbfb0('0x30')]['fields']));_0x59dd29[_0xbfb0('0x35')]=_0x59dd29['attributes'][_0xbfb0('0x37')]?_0x59dd29[_0xbfb0('0x35')]:_0x41c1d4[_0xbfb0('0x34')];if(_0x3f1972[_0xbfb0('0x30')]['includeAll']){_0x59dd29[_0xbfb0('0x40')]=[{'all':!![]}];}_0x59dd29=_[_0xbfb0('0x3e')]({},_0x59dd29,_0x3f1972['options']);return db[_0xbfb0('0x2b')][_0xbfb0('0x47')](_0x59dd29)['then'](handleEntityNotFound(_0x35b22e,null))['then'](function(_0x531726){if(_0x531726){var _0x14bb38=_0x531726[_0xbfb0('0x4b')]({'plain':!![]});_0x14bb38=qs['omit'](_0x14bb38,['id',_0xbfb0('0x4c'),_0xbfb0('0x4d'),_0xbfb0('0x4e')]);_0x3f1972[_0xbfb0('0x49')]=_['omit'](_0x3f1972[_0xbfb0('0x49')],['id',_0xbfb0('0x4c'),_0xbfb0('0x4d')]);return db['sequelize']['transaction'](function(_0x5d3fac){return db['UserProfile'][_0xbfb0('0x48')](_[_0xbfb0('0x3e')](_0x14bb38,_0x3f1972[_0xbfb0('0x49')]),{'include':_0x3f1972[_0xbfb0('0x30')][_0xbfb0('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x5d3fac})[_0xbfb0('0x24')](function(_0x228e38){var _0x4f1b7d=_0x228e38[_0xbfb0('0x4b')]({'plain':!![]});return db[_0xbfb0('0x4f')][_0xbfb0('0x41')]({'where':{'userProfileId':_0x3f1972[_0xbfb0('0x45')]['id']},'raw':!![]})[_0xbfb0('0x24')](function(_0xbf35e0){if(_0xbf35e0){return BPromise['each'](_0xbf35e0,function(_0x22eb16){return new BPromise(function(_0x459f45,_0x5dbdb0){if(_0x22eb16[_0xbfb0('0x50')]===null||_0x22eb16[_0xbfb0('0x50')]===0x1)_0x459f45(null);return db[_0xbfb0('0x51')][_0xbfb0('0x41')]({'where':{'sectionId':_0x22eb16['id']},'raw':!![]})['then'](function(_0x15815d){var _0x1dda6d=_[_0xbfb0('0x2a')](_0x15815d,function(_0x16c8aa){return qs[_0xbfb0('0x52')](_0x16c8aa,['id',_0xbfb0('0x4c'),'updatedAt',_0xbfb0('0x53')]);});_0x459f45(_0x1dda6d);})[_0xbfb0('0x43')](function(_0x2d1084){_0x5dbdb0(_0x2d1084);});})[_0xbfb0('0x24')](function(_0xd15af3){var _0x51a1dc=qs[_0xbfb0('0x52')](_0x22eb16,['id',_0xbfb0('0x4c'),_0xbfb0('0x4d')]);_0x51a1dc['userProfileId']=_0x4f1b7d['id'];if(_0xd15af3)_0x51a1dc[_0xbfb0('0x54')]=_0xd15af3;return _0x51a1dc;})['then'](function(_0x215558){return db[_0xbfb0('0x4f')]['create'](_0x215558,{'include':[{'model':db[_0xbfb0('0x51')],'as':_0xbfb0('0x54')}],'raw':!![],'transaction':_0x5d3fac});});})['then'](function(){return _0x4f1b7d;});}});});});}})['then'](respondWithResult(_0x35b22e,0xc9))[_0xbfb0('0x43')](handleError(_0x35b22e,null));};exports['update']=function(_0x50b071,_0x21ebc0){if(_0x50b071[_0xbfb0('0x49')]['id']){delete _0x50b071[_0xbfb0('0x49')]['id'];}return db[_0xbfb0('0x2b')]['find']({'where':{'id':_0x50b071['params']['id']}})[_0xbfb0('0x24')](handleEntityNotFound(_0x21ebc0,null))['then'](saveUpdates(_0x50b071['body'],null))[_0xbfb0('0x24')](respondWithResult(_0x21ebc0,null))[_0xbfb0('0x43')](handleError(_0x21ebc0,null));};exports[_0xbfb0('0x55')]=function(_0x13ded2,_0x43febb){return db[_0xbfb0('0x2b')]['find']({'where':{'id':_0x13ded2[_0xbfb0('0x45')]['id']}})[_0xbfb0('0x24')](handleEntityNotFound(_0x43febb,null))[_0xbfb0('0x24')](removeEntity(_0x43febb,null))[_0xbfb0('0x43')](handleError(_0x43febb,null));};exports[_0xbfb0('0x56')]=function(_0x462929,_0x29e1d6){return db['UserProfile'][_0xbfb0('0x56')]()[_0xbfb0('0x24')](respondWithResult(_0x29e1d6,null))[_0xbfb0('0x43')](handleError(_0x29e1d6,null));};exports['addSections']=function(_0x477a2e,_0x32c4e1){var _0x39405f=_0x477a2e[_0xbfb0('0x49')];return db[_0xbfb0('0x2b')]['find']({'where':{'id':_0x477a2e[_0xbfb0('0x45')]['id']}})[_0xbfb0('0x24')](handleEntityNotFound(_0x32c4e1,null))['then'](function(_0x4998c5){if(_0x4998c5){return db['sequelize'][_0xbfb0('0x57')](function(_0x196d99){return db[_0xbfb0('0x4f')][_0xbfb0('0x55')]({'where':{'userProfileId':_0x477a2e['params']['id'],'sectionId':_[_0xbfb0('0x2a')](_0x39405f,function(_0x184c36){return _0x184c36[_0xbfb0('0x53')];})},'transaction':_0x196d99})[_0xbfb0('0x24')](function(){var _0x324584=_[_0xbfb0('0x2a')](_0x39405f,function(_0x398e76){_0x398e76[_0xbfb0('0x58')]=_0x477a2e[_0xbfb0('0x45')]['id'];return _0x398e76;});var _0x233106=[];return BPromise[_0xbfb0('0x59')](_0x324584,function(_0x2e8566){return db[_0xbfb0('0x4f')]['create'](_0x2e8566,{'include':[{'model':db[_0xbfb0('0x51')],'as':_0xbfb0('0x54')}],'raw':!![],'transaction':_0x196d99})[_0xbfb0('0x24')](function(_0xd15cc1){_0x233106['push'](_0xd15cc1[_0xbfb0('0x4b')]({'plain':!![]}));});})['then'](function(){return _0x233106;});});});}})[_0xbfb0('0x24')](function(_0x281b9a){return _0x281b9a;})[_0xbfb0('0x24')](respondWithResult(_0x32c4e1,null))['catch'](handleError(_0x32c4e1,null));};exports[_0xbfb0('0x5a')]=function(_0x39b74d,_0x14aef5){var _0x1e21ce;return db['UserProfile'][_0xbfb0('0x47')]({'where':{'id':_0x39b74d[_0xbfb0('0x45')]['id']},'attributes':['id','name']})[_0xbfb0('0x24')](handleEntityNotFound(_0x14aef5,null))[_0xbfb0('0x24')](function(_0x1fb32c){if(_0x1fb32c){_0x1e21ce=_0x1fb32c;return db[_0xbfb0('0x4f')]['destroy']({'where':{'userProfileId':_0x39b74d['params']['id'],'sectionId':_0x39b74d[_0xbfb0('0x30')][_0xbfb0('0x5b')]}});}})[_0xbfb0('0x24')](function(){return _0x1e21ce;})['then'](respondWithStatusCode(_0x14aef5,null))[_0xbfb0('0x43')](handleError(_0x14aef5,null));};exports[_0xbfb0('0x5c')]=function(_0x5356c2,_0x349ec0){var _0x457823=[];var _0x26082d=[];return db[_0xbfb0('0x4f')][_0xbfb0('0x41')]({'where':{'userProfileId':_0x5356c2[_0xbfb0('0x45')]['id']},'raw':!![]})[_0xbfb0('0x24')](function(_0x298306){_0x457823=_['filter'](_0x298306,function(_0x3ad529){return _0x3ad529[_0xbfb0('0x5d')]===0x1||_[_0xbfb0('0x5e')]([0x3eb,0x709],_0x3ad529[_0xbfb0('0x53')]);});if(!_[_0xbfb0('0x5f')](_0x457823)){return _['map'](_0x457823,function(_0x35f9ac){return _0x35f9ac[_0xbfb0('0x53')];});}else{return;}})[_0xbfb0('0x24')](function(_0x1124ce){if(_0x1124ce)_0x26082d=_0x1124ce;if(_[_0xbfb0('0x5e')](_0x26082d,0x64)){var _0xf9fed8=_[_0xbfb0('0x47')](_0x457823,{'sectionId':0x64});return hasDefaultDashboard(_0xf9fed8)['then'](function(_0x8db0a8){return _[_0xbfb0('0x2a')](_0x457823,function(_0x34ffa3){if(_0x34ffa3[_0xbfb0('0x53')]===0x64){_0x34ffa3['subsections']=_0x8db0a8;}return _0x34ffa3;});});}else{return;}})[_0xbfb0('0x24')](function(_0x7ca2e6){if(_0x7ca2e6)_0x457823=_0x7ca2e6;if(_['includes'](_0x26082d,0x3eb)){var _0x5bf319=_['find'](_0x457823,{'sectionId':0x3eb});return getCustomDashboards(_0x5bf319)['then'](function(_0x1e2e67){return _['map'](_0x457823,function(_0x5ee0cd){if(_0x5bf319[_0xbfb0('0x5d')]){if(_0x5ee0cd['sectionId']===0x3eb){_0x5ee0cd['subsections']=_0x1e2e67;}}else{if(_0x5ee0cd[_0xbfb0('0x53')]===0x64){_0x5ee0cd[_0xbfb0('0x60')]=_0x1e2e67;}}return _0x5ee0cd;});});}else{return;}})['then'](function(_0x1f892f){if(_0x1f892f)_0x457823=_0x1f892f;if(_[_0xbfb0('0x5e')](_0x26082d,0x709)){var _0x5c0ada=_[_0xbfb0('0x47')](_0x457823,{'sectionId':0x709});return getPlugins(_0x5c0ada)[_0xbfb0('0x24')](function(_0x59f1f2){if(_0x5c0ada[_0xbfb0('0x5d')]){return _[_0xbfb0('0x2a')](_0x457823,function(_0x2efed0){if(_0x2efed0[_0xbfb0('0x53')]===0x709){_0x2efed0[_0xbfb0('0x60')]=_0x59f1f2;}return _0x2efed0;});}else{var _0x55d480={'sectionId':0x76c,'enabled':0x1,'subsections':_0x59f1f2};var _0x4188b5=_[_0xbfb0('0x2a')](_0x457823);_0x4188b5['push'](_0x55d480);return _0x4188b5;}});}else{return;}})[_0xbfb0('0x24')](function(_0x308f7b){if(_0x308f7b)_0x457823=_0x308f7b;return _[_0xbfb0('0x3d')](_0x457823,[_0xbfb0('0x5d'),0x1]);})[_0xbfb0('0x24')](respondWithResult(_0x349ec0,null))[_0xbfb0('0x43')](handleError(_0x349ec0,null));};function hasDefaultDashboard(_0x123f24){var _0x53c883=[0x65];return new BPromise(function(_0x5b0df5,_0x3444c1){try{if(_0x123f24[_0xbfb0('0x50')]){_0x5b0df5(_0x53c883);}else{return db['UserProfileResource'][_0xbfb0('0x61')]({'where':{'sectionId':_0x123f24['id']},'raw':!![]})['then'](function(_0x589e74){_0x589e74?_0x5b0df5(_0x53c883):_0x5b0df5();});}}catch(_0xce6ca8){_0x3444c1(_0xce6ca8);}});}function getCustomDashboards(_0x3a3d6c){var _0x201d4a=[];return new BPromise(function(_0x219768,_0x1f4572){try{if(_0x3a3d6c[_0xbfb0('0x50')]){return db[_0xbfb0('0x62')][_0xbfb0('0x41')]({'raw':!![]})[_0xbfb0('0x24')](function(_0xeaa6ff){_0xeaa6ff[_0xbfb0('0x63')](function(_0x2dfa11){_0x201d4a[_0xbfb0('0x64')](_0x2dfa11['id']+0x1869f);});_0x219768(_0x201d4a);});}else{return db['UserProfileResource'][_0xbfb0('0x41')]({'where':{'sectionId':_0x3a3d6c['id']},'raw':!![]})[_0xbfb0('0x24')](function(_0x5f2ad7){_0x5f2ad7[_0xbfb0('0x63')](function(_0x1cc637){_0x201d4a[_0xbfb0('0x64')](_0x1cc637[_0xbfb0('0x65')]+0x1869f);});_0x219768(_0x201d4a);});}}catch(_0x440324){_0x1f4572(_0x440324);}});}function getPlugins(_0x4bcd2f){var _0x3e711c=[];return new BPromise(function(_0x51115b,_0x396d19){try{if(_0x4bcd2f[_0xbfb0('0x50')]){return db[_0xbfb0('0x66')][_0xbfb0('0x41')]({'raw':!![]})[_0xbfb0('0x24')](function(_0xf1773a){_0xf1773a[_0xbfb0('0x63')](function(_0x2095b3){_0x3e711c[_0xbfb0('0x64')](_0x2095b3['id']+0x15b38);});_0x51115b(_0x3e711c);});}else{return db['UserProfileResource'][_0xbfb0('0x41')]({'where':{'sectionId':_0x4bcd2f['id']},'raw':!![]})['then'](function(_0x278410){_0x278410[_0xbfb0('0x63')](function(_0x450656){_0x3e711c['push'](_0x450656['resourceId']+0x15b38);});_0x51115b(_0x3e711c);});}}catch(_0x37d1b4){_0x396d19(_0x37d1b4);}});}exports[_0xbfb0('0x67')]=function(_0x29efef,_0x5ed8bc){return db[_0xbfb0('0x2b')][_0xbfb0('0x47')]({'where':{'id':_0x29efef['params']['id']}})[_0xbfb0('0x24')](handleEntityNotFound(_0x5ed8bc,null))['then'](function(_0x5d4dd3){if(_0x5d4dd3){return db[_0xbfb0('0x68')]['transaction'](function(_0x1cb991){return db[_0xbfb0('0x4f')][_0xbfb0('0x41')]({'where':{'userProfileId':_0x29efef[_0xbfb0('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xbfb0('0x24')](function(_0x22d09f){if(_0x22d09f){return db['UserProfileSection'][_0xbfb0('0x55')]({'where':{'userProfileId':_0x29efef[_0xbfb0('0x45')]['id'],'id':_['map'](_0x22d09f,function(_0x1817b0){return _0x1817b0['id'];})},'transaction':_0x1cb991});}})['then'](function(_0x17e22a){var _0x144bc9=_[_0xbfb0('0x2a')](_0x29efef[_0xbfb0('0x49')],function(_0x1b1252){_0x1b1252[_0xbfb0('0x58')]=_0x29efef[_0xbfb0('0x45')]['id'];return _0x1b1252;});return db[_0xbfb0('0x4f')]['bulkCreate'](_0x144bc9,{'raw':!![],'transaction':_0x1cb991});})['then'](function(_0x5cf9d4){var _0x4c02d9=_[_0xbfb0('0x3d')](_['map'](_0x5cf9d4,function(_0x355aba){return _0x355aba[_0xbfb0('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x4c02d9){return db[_0xbfb0('0x4f')][_0xbfb0('0x41')]({'where':{'userProfileId':_0x29efef['params']['id'],'sectionId':_[_0xbfb0('0x2a')](_0x4c02d9,function(_0x124b22){return _0x124b22[_0xbfb0('0x53')];})},'attributes':['id',_0xbfb0('0x53')],'raw':!![]})['then'](function(_0x324443){var _0x4cd4d6=_[_0xbfb0('0x2a')](_0x29efef[_0xbfb0('0x49')],function(_0x21f491){_0x21f491['userProfileId']=_0x29efef[_0xbfb0('0x45')]['id'];return _0x21f491;});return db[_0xbfb0('0x51')]['bulkCreate'](_0x4cd4d6,{'raw':!![],'transaction':_0x1cb991});});}})[_0xbfb0('0x43')](handleError(_0x5ed8bc,null));});}})['then'](function(_0x7cc924){var _0x2e38fc=_[_0xbfb0('0x2a')](_0x7cc924,function(_0x388742){return _0x388742['get']({'plain':!![]});});})[_0xbfb0('0x24')](respondWithResult(_0x5ed8bc,null))[_0xbfb0('0x43')](handleError(_0x5ed8bc,null));};exports[_0xbfb0('0x69')]=function(_0x52d7f6,_0x56a2f1,_0x465dc7){return db[_0xbfb0('0x2b')][_0xbfb0('0x47')]({'where':{'id':_0x52d7f6[_0xbfb0('0x45')]['id']}})['then'](handleEntityNotFound(_0x56a2f1,null))[_0xbfb0('0x24')](function(_0x2a4145){if(_0x2a4145){return _0x2a4145[_0xbfb0('0x69')](_0x52d7f6[_0xbfb0('0x30')][_0xbfb0('0x5b')]);}})[_0xbfb0('0x24')](respondWithStatusCode(_0x56a2f1,null))[_0xbfb0('0x43')](handleError(_0x56a2f1,null));};exports[_0xbfb0('0x6a')]=function(_0x5fc2de,_0x5e35b7){var _0x37bf3e={};if(!_0x5fc2de[_0xbfb0('0x30')]['section'])throw new Error(_0xbfb0('0x6b'));if(!_0x5fc2de[_0xbfb0('0x30')][_0xbfb0('0x38')](_0xbfb0('0x39'))){_0x37bf3e[_0xbfb0('0x1d')]=qs[_0xbfb0('0x1d')](_0x5fc2de[_0xbfb0('0x30')][_0xbfb0('0x1d')]);_0x37bf3e['offset']=qs['offset'](_0x5fc2de[_0xbfb0('0x30')]['offset']);}return db[_0xbfb0('0x2b')]['find']({'where':{'id':_0x5fc2de['params']['id']}})[_0xbfb0('0x24')](function(_0x24ae1c){if(!_0x24ae1c)throw new Error(_0xbfb0('0x6c')+_0x5fc2de[_0xbfb0('0x45')]['id']);return db['UserProfile'][_0xbfb0('0x6a')](_0x5fc2de);})['then'](respondWithFilteredResult(_0x5e35b7,_0x37bf3e))['catch'](handleError(_0x5e35b7,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 40da222..3e3212e 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 _0xc4aa=['../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var UserProfile=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xac4a('0x3')](0x0);var events={'afterCreate':_0xac4a('0x4'),'afterUpdate':_0xac4a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5cda73){return function(_0x47d4f6,_0x2f48ed,_0x15b967){UserProfileEvents[_0xac4a('0x6')](_0x5cda73+':'+_0x47d4f6['id'],_0x47d4f6);UserProfileEvents[_0xac4a('0x6')](_0x5cda73,_0x47d4f6);_0x15b967(null);};}for(var e in events){if(events[_0xac4a('0x7')](e)){var event=events[e];UserProfile[_0xac4a('0x8')](e,emitEvent(event));}}module[_0xac4a('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x11c8=['hook','exports','../../mysqldb','UserProfile','save','update','remove','emit'];(function(_0x83d1ba,_0x2fdb2f){var _0x1a0d1c=function(_0x253d44){while(--_0x253d44){_0x83d1ba['push'](_0x83d1ba['shift']());}};_0x1a0d1c(++_0x2fdb2f);}(_0x11c8,0x19a));var _0x811c=function(_0xc2c353,_0x41a5a3){_0xc2c353=_0xc2c353-0x0;var _0x806605=_0x11c8[_0xc2c353];return _0x806605;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x811c('0x0'))['db'][_0x811c('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x811c('0x2'),'afterUpdate':_0x811c('0x3'),'afterDestroy':_0x811c('0x4')};function emitEvent(_0x85a54c){return function(_0x16f1d6,_0x432f5b,_0x49a07c){UserProfileEvents[_0x811c('0x5')](_0x85a54c+':'+_0x16f1d6['id'],_0x16f1d6);UserProfileEvents[_0x811c('0x5')](_0x85a54c,_0x16f1d6);_0x49a07c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x811c('0x6')](e,emitEvent(event));}}module[_0x811c('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index cac4425..ab1feec 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 _0x5f31=['projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','outbound','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','charAt','QueryTypes','SELECT','select','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','UserProfile','user_profiles','raw','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','params','all','ignore','union','find','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','default','DefaultReports','custom','CustomReports','count','rows','include','Tags','color','tag','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','squel','exports','models','filter','findAll','then','associatedResources','map','catch','field','value','model','resolve','UserProfileResource','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x5f31,0x159));var _0x15f3=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0x5f31[_0x292423];return _0x2801cb;};'use strict';var _=require(_0x15f3('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x15f3('0x1'));var squel=require(_0x15f3('0x2'));module[_0x15f3('0x3')]=function(_0x8dc835){var _0x138d17=_0x8dc835[_0x15f3('0x4')];function _0x3172d8(_0xce8917,_0x1e15ee){return new Promise(function(_0x23d69b,_0x4bb579){if(!_0x1e15ee)return _0x23d69b(null);var _0x5ae720=_0x1e15ee[_0x15f3('0x5')]?{[_0x1e15ee['filter']['field']]:_0x1e15ee['filter']['value']}:undefined;return _0x138d17[_0xce8917][_0x15f3('0x6')]({'where':_0x5ae720,'raw':!![]})[_0x15f3('0x7')](function(_0x4b5cd9){_0x1e15ee[_0x15f3('0x8')]=_[_0x15f3('0x9')](_0x4b5cd9,'id');_0x23d69b(_0x1e15ee);})[_0x15f3('0xa')](function(_0x280556){_0x4bb579(_0x280556);});});}function _0x2b9370(_0x22ac02,_0x4c2f0f){return new Promise(function(_0x25b9f8,_0x30f46b){var _0x3c4cdd=_0x22ac02[_0x15f3('0x5')]?{[_0x22ac02[_0x15f3('0x5')][_0x15f3('0xb')]]:_0x22ac02[_0x15f3('0x5')][_0x15f3('0xc')]}:undefined;return _0x138d17[_0x22ac02[_0x15f3('0xd')]][_0x15f3('0x6')]({'where':_0x3c4cdd,'raw':!![]})['then'](function(_0x5c668a){_0x4c2f0f[_0x15f3('0x8')]=_[_0x15f3('0x9')](_0x5c668a,function(_0x497b6f){return _0x497b6f['name'];});_0x25b9f8(_0x4c2f0f);})[_0x15f3('0xa')](function(_0x53c5b5){_0x30f46b(_0x53c5b5);});});}function _0x5b56a8(_0x51a379,_0x8dedb6,_0x381ae0){if(!_0x8dedb6)return Promise[_0x15f3('0xe')](null);return new Promise(function(_0x22bec8,_0x1da475){return _0x138d17[_0x15f3('0xf')][_0x15f3('0x6')]({'where':{'sectionId':_0x8dedb6['id']},'raw':!![]})[_0x15f3('0x7')](function(_0x498718){if(_0x51a379[_0x15f3('0xb')]&&_0x51a379[_0x15f3('0xb')]!=='id'){_0x8dedb6[_0x15f3('0x8')]=_[_0x15f3('0x9')](_0x498718,function(_0x46e56e){return _0x46e56e[_0x51a379['field']];});}else{if(_0x381ae0==='AnalyticExtractedReport'){_0x8dedb6[_0x15f3('0x8')]=_[_0x15f3('0x9')](_0x498718,function(_0x1d15c0){return{'id':_0x1d15c0['resourceId'],'type':_0x1d15c0[_0x15f3('0x10')]};});}else{_0x8dedb6['associatedResources']=_['map'](_0x498718,function(_0x19f1a6){return _0x19f1a6[_0x15f3('0x11')];});}}_0x22bec8(_0x8dedb6);})['catch'](function(_0x1cd3a0){_0x1da475(_0x1cd3a0);});});}function _0x2504d4(_0x23ea09,_0x3f37b0){var _0x123b38={'parentSections':[]};switch(_0x23ea09[_0x15f3('0x12')]()){case _0x15f3('0x13'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x15');break;case'odbc':_0x123b38[_0x15f3('0x14')]=_0x15f3('0x16');break;case _0x15f3('0x17'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x18');_0x123b38[_0x15f3('0x19')]=[{'name':_0x15f3('0x1a'),'field':_0x15f3('0x1b'),'foreignKey':_0x15f3('0x1c')}];break;case _0x15f3('0x1d'):_0x123b38['childModel']=_0x15f3('0x1e');break;case _0x15f3('0x1f'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x20');_0x123b38[_0x15f3('0x19')]=[{'name':_0x15f3('0x21'),'field':'id','foreignKey':_0x15f3('0x22')}];break;case _0x15f3('0x23'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x24');break;case _0x15f3('0x25'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x26');break;case _0x15f3('0x27'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x28');break;case _0x15f3('0x29'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x2a');break;case'chatwebsites':_0x123b38['childModel']='ChatWebsite';break;case _0x15f3('0x2b'):_0x123b38[_0x15f3('0x14')]='FaxQueue';break;case'faxaccounts':_0x123b38[_0x15f3('0x14')]='FaxAccount';break;case _0x15f3('0x2c'):case _0x15f3('0x2d'):case _0x15f3('0x2e'):_0x123b38['childModel']='VoiceExtension';break;case _0x15f3('0x2f'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x30');break;case _0x15f3('0x31'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x32');break;case _0x15f3('0x33'):_0x123b38[_0x15f3('0x14')]='VoiceRecording';_0x123b38[_0x15f3('0x19')]=[{'name':_0x15f3('0x34'),'field':'name','foreignKey':_0x15f3('0x35'),'model':_0x15f3('0x36'),'filter':{'field':'role','value':[_0x15f3('0x37')]}},{'name':_0x15f3('0x38'),'field':_0x15f3('0x1b'),'foreignKey':_0x15f3('0x35'),'model':'User','filter':{'field':'role','value':[_0x15f3('0x39')]}},{'name':_0x15f3('0x3a'),'field':_0x15f3('0x1b'),'foreignKey':'queue','model':_0x15f3('0x3b'),'filter':{'field':_0x15f3('0x10'),'value':['inbound']}},{'name':_0x15f3('0x3c'),'field':_0x15f3('0x1b'),'foreignKey':'queue','model':_0x15f3('0x3b'),'filter':{'field':_0x15f3('0x10'),'value':[_0x15f3('0x3d')]}}];break;case'musiconholds':_0x123b38[_0x15f3('0x14')]='VoiceMusicOnHold';break;case _0x15f3('0x3e'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x3f');break;case _0x15f3('0x40'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x41');break;case _0x15f3('0x42'):_0x123b38['childModel']='Campaign';break;case _0x15f3('0x43'):_0x123b38[_0x15f3('0x14')]='MailQueue';break;case _0x15f3('0x44'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x45');break;case _0x15f3('0x46'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x47');break;case _0x15f3('0x48'):_0x123b38[_0x15f3('0x14')]='OpenchannelQueue';break;case _0x15f3('0x49'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x4a');break;case _0x15f3('0x4b'):_0x123b38[_0x15f3('0x14')]='SmsQueue';break;case _0x15f3('0x4c'):_0x123b38[_0x15f3('0x14')]='SmsAccount';break;case _0x15f3('0x4d'):_0x123b38['childModel']=_0x15f3('0x4e');break;case _0x15f3('0x4f'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x50');break;case _0x15f3('0x51'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x52');break;case _0x15f3('0x53'):case _0x15f3('0x54'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x3b');if(_0x3f37b0){_0x123b38[_0x15f3('0x19')]=[{'name':'VoiceQueues'},{'name':_0x15f3('0x3c')}];}break;case'users':case _0x15f3('0x55'):case _0x15f3('0x56'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x36');if(_0x3f37b0){_0x123b38[_0x15f3('0x19')]=[{'name':_0x15f3('0x57'),'filter':{'field':'role','value':[_0x15f3('0x58'),_0x15f3('0x59')]},'ignore':!![]},{'name':_0x15f3('0x34')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x123b38[_0x15f3('0x14')]=_0x15f3('0x5a');break;case _0x15f3('0x5b'):_0x123b38[_0x15f3('0x14')]='SalesforceAccount';break;case'freshdeskaccounts':_0x123b38[_0x15f3('0x14')]=_0x15f3('0x5c');break;case _0x15f3('0x5d'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x5e');break;case'deskaccounts':_0x123b38[_0x15f3('0x14')]=_0x15f3('0x5f');break;case _0x15f3('0x60'):_0x123b38[_0x15f3('0x14')]='ZohoAccount';break;case _0x15f3('0x61'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x36');break;case _0x15f3('0x62'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x63');break;case'dispositions':_0x123b38[_0x15f3('0x14')]=_0x15f3('0x64');break;case _0x15f3('0x65'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x66');break;case _0x15f3('0x67'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x68');break;case _0x15f3('0x69'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x6a');break;case _0x15f3('0x6b'):_0x123b38[_0x15f3('0x14')]='Schedule';break;case'sounds':_0x123b38['childModel']=_0x15f3('0x6c');break;case _0x15f3('0x6d'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x6e');break;case _0x15f3('0x6f'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x70');break;case _0x15f3('0x71'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x72');break;case'trunks':_0x123b38[_0x15f3('0x14')]=_0x15f3('0x73');break;case _0x15f3('0x74'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x75');break;case _0x15f3('0x76'):_0x123b38[_0x15f3('0x14')]='Plugin';break;case _0x15f3('0x77'):_0x123b38[_0x15f3('0x14')]=_0x15f3('0x78');_0x123b38['parentSections']=[{'name':_0x15f3('0x79'),'field':'id','foreignKey':_0x15f3('0x7a')}];break;case'metrics':_0x123b38[_0x15f3('0x14')]=_0x15f3('0x7b');break;}return _0x123b38;}function _0xf8e3af(_0x29c576,_0x63ba6f){var _0x37f0e4=_0x29c576[_0x15f3('0x7c')](0x0)['toUpperCase']()+_0x29c576['slice'](0x1);var _0x23074e={'type':_0x138d17['Sequelize'][_0x15f3('0x7d')][_0x15f3('0x7e')],'raw':!![]};return new Promise(function(_0x3712bc,_0x5243e7){var _0x5319a1=squel[_0x15f3('0x7f')]()[_0x15f3('0xb')]('ui.'+_0x37f0e4+'InteractionId','id')[_0x15f3('0xb')](_0x15f3('0x80'))[_0x15f3('0x81')](_0x15f3('0x82')+_0x29c576+'_interactions','ui')[_0x15f3('0x83')](_0x15f3('0x84'),_0x63ba6f['id']);return _0x138d17['sequelize']['query'](_0x5319a1['toString'](),_0x23074e)[_0x15f3('0x7')](function(_0x5b7a65){_0x63ba6f[_0x37f0e4+'OpenTabs']=_0x5b7a65;_0x3712bc(_0x5b7a65);})[_0x15f3('0xa')](function(_0x33c589){_0x5243e7(_0x33c589);});});}return _0x8dc835['define'](_0x15f3('0x85'),attributes,{'tableName':_0x15f3('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5080fa){var _0x193a26={'raw':_0x5080fa['query'][_0x15f3('0x87')],'where':{}};var _0x268217={};var _0x599388={'count':0x0,'rows':[]};var _0x4881f4=_0x5080fa[_0x15f3('0x88')][_0x15f3('0x89')];var _0x56d1a1=_0x5080fa[_0x15f3('0x88')][_0x15f3('0x8a')]||![];var _0x1728e7=_0x2504d4(_0x4881f4,_0x56d1a1);if(!_0x1728e7[_0x15f3('0x14')])throw new Error(_0x15f3('0x8b')+_0x4881f4+'\x27');var _0x255a22=[{'name':_0x4881f4}];if(!_[_0x15f3('0x8c')](_0x1728e7[_0x15f3('0x19')]))_0x255a22=_0x1728e7['parentSections'];var _0x50cb91=[];for(var _0x344d72=0x0;_0x344d72<_0x255a22[_0x15f3('0x8d')];_0x344d72++){_0x50cb91[_0x15f3('0x8e')](_0x138d17['UserProfileSection']['find']({'where':{'userProfileId':_0x5080fa[_0x15f3('0x8f')]['id'],'name':_0x255a22[_0x344d72][_0x15f3('0x1b')]},'raw':!![]}));}return Promise[_0x15f3('0x90')](_0x50cb91)['then'](function(_0x4b2330){var _0x40e673=_[_0x15f3('0x5')](_0x4b2330,function(_0x38a967){return _0x38a967?_0x38a967:undefined;});var _0x18d7ed=_['filter'](_0x255a22,[_0x15f3('0x91'),!![]]);var _0x558cdf=_[_0x15f3('0x8c')](_0x40e673)&&_[_0x15f3('0x8c')](_0x18d7ed)?null:_[_0x15f3('0x92')](_0x18d7ed,_0x40e673);if(!_0x558cdf)return null;var _0x19484c=[];for(var _0x5c4891=0x0;_0x5c4891<_0x558cdf[_0x15f3('0x8d')];_0x5c4891++){var _0x1ba989=_[_0x15f3('0x93')](_0x255a22,function(_0x26238e){return _0x558cdf[_0x5c4891]?_0x26238e['name']===_0x558cdf[_0x5c4891][_0x15f3('0x1b')]:null;});if(_0x1ba989){if(_0x558cdf[_0x5c4891][_0x15f3('0x91')]){_0x19484c[_0x15f3('0x8e')](_0x3172d8(_0x1728e7['childModel'],_0x558cdf[_0x5c4891]));}else{if(!_0x558cdf[_0x5c4891][_0x15f3('0x94')]){_0x19484c[_0x15f3('0x8e')](_0x5b56a8(_0x1ba989,_0x558cdf[_0x5c4891],_0x1728e7['childModel']));}else{if(_0x1ba989['model']){_0x19484c[_0x15f3('0x8e')](_0x2b9370(_0x1ba989,_0x558cdf[_0x5c4891]));}}}}}return Promise['all'](_0x19484c);})[_0x15f3('0x7')](function(_0x4f043e){var _0x172c05=_0x4f043e;var _0x42fd58=null;if(_0x172c05){_0x42fd58=_0x172c05['length']===0x1?_0x172c05[0x0]:null;}if(!_0x42fd58&&!_0x172c05)return _0x599388;var _0xa219e5=_0x138d17[_0x1728e7[_0x15f3('0x14')]][_0x15f3('0x95')];_0x268217[_0x15f3('0xd')]=_[_0x15f3('0x96')](_0xa219e5);_0x268217[_0x15f3('0x88')]=_[_0x15f3('0x96')](_0x5080fa[_0x15f3('0x88')]);_0x268217[_0x15f3('0x97')]=_[_0x15f3('0x98')](_0x268217['model'],_0x268217['query']);_0x193a26[_0x15f3('0x99')]=_['intersection'](_0x268217[_0x15f3('0xd')],qs[_0x15f3('0x9a')](_0x5080fa[_0x15f3('0x88')]['fields']));_0x193a26['attributes']=_0x193a26[_0x15f3('0x99')][_0x15f3('0x8d')]?_0x193a26[_0x15f3('0x99')]:_0x268217[_0x15f3('0xd')];if(!_0x5080fa[_0x15f3('0x88')]['hasOwnProperty'](_0x15f3('0x9b'))){_0x193a26[_0x15f3('0x9c')]=qs['limit'](_0x5080fa[_0x15f3('0x88')][_0x15f3('0x9c')]);_0x193a26[_0x15f3('0x9d')]=qs[_0x15f3('0x9d')](_0x5080fa['query'][_0x15f3('0x9d')]);}_0x193a26[_0x15f3('0x9e')]=qs[_0x15f3('0x9f')](_0x5080fa[_0x15f3('0x88')][_0x15f3('0x9f')]);_0x193a26[_0x15f3('0x83')]=qs[_0x15f3('0x97')](_[_0x15f3('0xa0')](_0x5080fa[_0x15f3('0x88')],_0x268217[_0x15f3('0x97')]));if(_0x5080fa[_0x15f3('0x88')][_0x15f3('0x5')]){_0x193a26[_0x15f3('0x83')]=_[_0x15f3('0xa1')](_0x193a26[_0x15f3('0x83')],{'$or':_['map'](_0xa219e5,function(_0x391636){if(_0x391636[_0x15f3('0x10')][_0x15f3('0xa2')]!==_0x15f3('0xa3')){var _0x5e4106={};_0x5e4106[_0x391636['field']]={'$like':'%'+_0x5080fa['query'][_0x15f3('0x5')]+'%'};return _0x5e4106;}})});}var _0x2e59c9=[];var _0x3aebbf=null;var _0x412cd4={};if(_0x42fd58){_0x3aebbf=_[_0x15f3('0x93')](_0x255a22,[_0x15f3('0x1b'),_0x42fd58['name']]);if(_0x3aebbf[_0x15f3('0xb')]){_0x412cd4={};if(_0x1728e7[_0x15f3('0x14')]===_0x15f3('0x78')){_0x412cd4[_0x3aebbf[_0x15f3('0xa4')]]=_['map'](_0x42fd58[_0x15f3('0x8')],'id');}else{_0x412cd4[_0x3aebbf[_0x15f3('0xa4')]]=_0x42fd58[_0x15f3('0x8')];}_0x2e59c9[_0x15f3('0x8e')](_0x412cd4);}else{_0x193a26['where']['id']=_0x42fd58[_0x15f3('0x8')];}}else{for(var _0x1aac70=0x0;_0x1aac70<_0x172c05[_0x15f3('0x8d')];_0x1aac70++){_0x3aebbf=_[_0x15f3('0x93')](_0x255a22,['name',_0x172c05[_0x1aac70][_0x15f3('0x1b')]]);if(_0x3aebbf[_0x15f3('0xb')]){_0x412cd4={};_0x412cd4[_0x3aebbf[_0x15f3('0xa4')]]=_0x172c05[_0x1aac70][_0x15f3('0x8')];_0x2e59c9[_0x15f3('0x8e')](_0x412cd4);}else{if(!_0x193a26[_0x15f3('0x83')]['id'])_0x193a26[_0x15f3('0x83')]['id']=[];_0x172c05[_0x1aac70][_0x15f3('0x8')][_0x15f3('0xa5')](function(_0x310ca6){_0x193a26['where']['id'][_0x15f3('0x8e')](_0x310ca6);});}}}if(!_[_0x15f3('0x8c')](_0x2e59c9)){_0x193a26[_0x15f3('0x83')]=_['merge'](_0x193a26[_0x15f3('0x83')],{'$and':{'$or':_0x2e59c9}});}_0x193a26=_['merge']({},_0x193a26,_0x5080fa[_0x15f3('0xa6')]);if(_0x42fd58&&!_0x42fd58['autoAssociation']&&_0x1728e7[_0x15f3('0x14')]===_0x15f3('0x78')){if(_0x5080fa['query'][_0x15f3('0xa7')]){_0x193a26['include']=[{'all':!![]}];}return _0x138d17[_0x1728e7['childModel']][_0x15f3('0x6')](_0x193a26)[_0x15f3('0x7')](function(_0x1fb449){var _0x7cd73c=[];_0x1fb449[_0x15f3('0xa5')](function(_0x265dc7){var _0x419c71;switch(_0x265dc7[_0x15f3('0xa8')]){case _0x15f3('0xa9'):_0x419c71=_['find'](_0x42fd58[_0x15f3('0x8')],function(_0x91a464){return _0x91a464['id']===_0x265dc7[_0x15f3('0x7a')]&&_0x91a464[_0x15f3('0x10')]===_0x15f3('0xaa');});break;case _0x15f3('0xab'):_0x419c71=_[_0x15f3('0x93')](_0x42fd58['associatedResources'],function(_0x4d4de7){return _0x4d4de7['id']===_0x265dc7[_0x15f3('0x7a')]&&_0x4d4de7['type']===_0x15f3('0xac');});break;}if(_0x419c71)_0x7cd73c[_0x15f3('0x8e')](_0x265dc7);});_0x599388[_0x15f3('0xad')]=_0x7cd73c[_0x15f3('0x8d')];_0x599388[_0x15f3('0xae')]=_0x7cd73c;return _0x599388;});}else{return _0x138d17[_0x1728e7['childModel']][_0x15f3('0xad')]({'where':_0x193a26['where']})[_0x15f3('0x7')](function(_0x361a6d){_0x599388[_0x15f3('0xad')]=_0x361a6d;if(_0x5080fa[_0x15f3('0x88')][_0x15f3('0xa7')]){if(_0x1728e7[_0x15f3('0x14')]===_0x15f3('0x20')){_0x193a26[_0x15f3('0xaf')]=[{'model':_0x138d17[_0x15f3('0x6e')],'as':_0x15f3('0xb0'),'attributes':['id',_0x15f3('0x1b'),_0x15f3('0xb1')],'required':_0x5080fa[_0x15f3('0x88')][_0x15f3('0xb2')]?!![]:![]},{'model':_0x138d17[_0x15f3('0x6e')],'as':'ThroughTags','attributes':['id',_0x15f3('0x1b'),_0x15f3('0xb1')],'through':_0x5080fa[_0x15f3('0x88')][_0x15f3('0xb2')]?{'attributes':[],'where':{'TagId':_0x5080fa['query'][_0x15f3('0xb2')]||undefined}}:{},'required':_0x5080fa[_0x15f3('0x88')][_0x15f3('0xb2')]?!![]:![]}];}else{_0x193a26[_0x15f3('0xaf')]=[{'all':!![]}];}}return _0x138d17[_0x1728e7[_0x15f3('0x14')]][_0x15f3('0x6')](_0x193a26);})['then'](function(_0x16b82b){_0x599388[_0x15f3('0xae')]=_0x16b82b;if(_0x4881f4==='Agents'&&_0x5080fa[_0x15f3('0x88')][_0x15f3('0xb3')]===_0x15f3('0xb4')){var _0x3f3edc=[];for(var _0xf6404f=0x0;_0xf6404f<_0x599388[_0x15f3('0xae')][_0x15f3('0x8d')];_0xf6404f++){_0x3f3edc[_0x15f3('0x8e')](_0xf8e3af('chat',_0x599388[_0x15f3('0xae')][_0xf6404f][_0x15f3('0xb5')]));_0x3f3edc[_0x15f3('0x8e')](_0xf8e3af(_0x15f3('0xb6'),_0x599388['rows'][_0xf6404f][_0x15f3('0xb5')]));_0x3f3edc[_0x15f3('0x8e')](_0xf8e3af(_0x15f3('0xb7'),_0x599388[_0x15f3('0xae')][_0xf6404f][_0x15f3('0xb5')]));_0x3f3edc[_0x15f3('0x8e')](_0xf8e3af(_0x15f3('0xb8'),_0x599388[_0x15f3('0xae')][_0xf6404f][_0x15f3('0xb5')]));_0x3f3edc[_0x15f3('0x8e')](_0xf8e3af(_0x15f3('0xb9'),_0x599388[_0x15f3('0xae')][_0xf6404f]['dataValues']));_0x3f3edc['push'](_0xf8e3af(_0x15f3('0xba'),_0x599388[_0x15f3('0xae')][_0xf6404f]['dataValues']));}return Promise[_0x15f3('0x90')](_0x3f3edc)['then'](function(){return _0x599388;});}return _0x599388;});}});}}});}; \ No newline at end of file +var _0xcf1a=['vtigeraccounts','CannedAnswer','Disposition','Dashboard','Interval','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Variable','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','merge','where','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','type','DefaultReports','custom','CustomReports','rows','color','tag','ThroughTags','openTabs','dataValues','sms','fax','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','value','findAll','then','associatedResources','map','catch','field','model','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','CmContact','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','name','membername','User','role','agent','Telephones','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','voicequeues','VoiceQueues','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts'];(function(_0x2948ce,_0x2d29e4){var _0x5d8992=function(_0x4c6f18){while(--_0x4c6f18){_0x2948ce['push'](_0x2948ce['shift']());}};_0x5d8992(++_0x2d29e4);}(_0xcf1a,0x10f));var _0xacf1=function(_0x465137,_0x3ec0b0){_0x465137=_0x465137-0x0;var _0xd61384=_0xcf1a[_0x465137];return _0xd61384;};'use strict';var _=require(_0xacf1('0x0'));var attributes=require(_0xacf1('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0xacf1('0x2'));module[_0xacf1('0x3')]=function(_0x50c185){var _0x174c5c=_0x50c185['models'];function _0x2eeee5(_0x2c1972,_0x4129bf){return new Promise(function(_0x423dd0,_0x3fb2bd){if(!_0x4129bf)return _0x423dd0(null);var _0x236808=_0x4129bf[_0xacf1('0x4')]?{[_0x4129bf[_0xacf1('0x4')]['field']]:_0x4129bf[_0xacf1('0x4')][_0xacf1('0x5')]}:undefined;return _0x174c5c[_0x2c1972][_0xacf1('0x6')]({'where':_0x236808,'raw':!![]})[_0xacf1('0x7')](function(_0x47b077){_0x4129bf[_0xacf1('0x8')]=_[_0xacf1('0x9')](_0x47b077,'id');_0x423dd0(_0x4129bf);})[_0xacf1('0xa')](function(_0x58890f){_0x3fb2bd(_0x58890f);});});}function _0x452d5c(_0x36dfc8,_0x147081){return new Promise(function(_0xfaff55,_0x5bbe89){var _0x27874a=_0x36dfc8['filter']?{[_0x36dfc8[_0xacf1('0x4')][_0xacf1('0xb')]]:_0x36dfc8['filter'][_0xacf1('0x5')]}:undefined;return _0x174c5c[_0x36dfc8[_0xacf1('0xc')]][_0xacf1('0x6')]({'where':_0x27874a,'raw':!![]})[_0xacf1('0x7')](function(_0x7038a9){_0x147081[_0xacf1('0x8')]=_[_0xacf1('0x9')](_0x7038a9,function(_0x40410d){return _0x40410d['name'];});_0xfaff55(_0x147081);})[_0xacf1('0xa')](function(_0x549b6e){_0x5bbe89(_0x549b6e);});});}function _0x439bca(_0x341e6a,_0x3f7890,_0x455e99){if(!_0x3f7890)return Promise[_0xacf1('0xd')](null);return new Promise(function(_0x3ca4bc,_0x3349c5){return _0x174c5c[_0xacf1('0xe')][_0xacf1('0x6')]({'where':{'sectionId':_0x3f7890['id']},'raw':!![]})[_0xacf1('0x7')](function(_0x1b2a7b){if(_0x341e6a['field']&&_0x341e6a[_0xacf1('0xb')]!=='id'){_0x3f7890[_0xacf1('0x8')]=_[_0xacf1('0x9')](_0x1b2a7b,function(_0x2754c9){return _0x2754c9[_0x341e6a['field']];});}else{if(_0x455e99===_0xacf1('0xf')){_0x3f7890[_0xacf1('0x8')]=_[_0xacf1('0x9')](_0x1b2a7b,function(_0x52b8a2){return{'id':_0x52b8a2[_0xacf1('0x10')],'type':_0x52b8a2['type']};});}else{_0x3f7890[_0xacf1('0x8')]=_[_0xacf1('0x9')](_0x1b2a7b,function(_0xfb0c8f){return _0xfb0c8f['resourceId'];});}}_0x3ca4bc(_0x3f7890);})[_0xacf1('0xa')](function(_0x4058f7){_0x3349c5(_0x4058f7);});});}function _0x57683c(_0x350ff6,_0x443f29){var _0x44a18e={'parentSections':[]};switch(_0x350ff6['toLowerCase']()){case'squareprojects':_0x44a18e[_0xacf1('0x11')]='SquareProject';break;case _0xacf1('0x12'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x13');break;case _0xacf1('0x14'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x15');_0x44a18e[_0xacf1('0x16')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xacf1('0x17')}];break;case _0xacf1('0x18'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x19');break;case'contacts':_0x44a18e['childModel']=_0xacf1('0x1a');_0x44a18e[_0xacf1('0x16')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0xacf1('0x1b'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x1c');break;case _0xacf1('0x1d'):_0x44a18e['childModel']=_0xacf1('0x1e');break;case _0xacf1('0x1f'):_0x44a18e[_0xacf1('0x11')]='CmCustomField';break;case _0xacf1('0x20'):_0x44a18e[_0xacf1('0x11')]='ChatQueue';break;case'chatwebsites':_0x44a18e['childModel']=_0xacf1('0x21');break;case _0xacf1('0x22'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x23');break;case _0xacf1('0x24'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x25');break;case _0xacf1('0x26'):case'internalroutes':case _0xacf1('0x27'):_0x44a18e['childModel']=_0xacf1('0x28');break;case'contexts':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x29');break;case _0xacf1('0x2a'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x2b');break;case _0xacf1('0x2c'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x2d');_0x44a18e[_0xacf1('0x16')]=[{'name':_0xacf1('0x2e'),'field':_0xacf1('0x2f'),'foreignKey':_0xacf1('0x30'),'model':_0xacf1('0x31'),'filter':{'field':_0xacf1('0x32'),'value':[_0xacf1('0x33')]}},{'name':_0xacf1('0x34'),'field':_0xacf1('0x2f'),'foreignKey':_0xacf1('0x30'),'model':_0xacf1('0x31'),'filter':{'field':_0xacf1('0x32'),'value':['telephone']}},{'name':'VoiceQueues','field':_0xacf1('0x2f'),'foreignKey':_0xacf1('0x35'),'model':_0xacf1('0x36'),'filter':{'field':'type','value':[_0xacf1('0x37')]}},{'name':_0xacf1('0x38'),'field':'name','foreignKey':_0xacf1('0x35'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xacf1('0x39')]}}];break;case _0xacf1('0x3a'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x3b');break;case'chanspies':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x3c');break;case'voiceprefixes':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x3d');break;case _0xacf1('0x3e'):_0x44a18e['childModel']=_0xacf1('0x3f');break;case _0xacf1('0x40'):_0x44a18e['childModel']=_0xacf1('0x41');break;case _0xacf1('0x42'):_0x44a18e['childModel']=_0xacf1('0x43');break;case'mailsubstatuses':_0x44a18e['childModel']=_0xacf1('0x44');break;case'openchannelqueues':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x45');break;case _0xacf1('0x46'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x47');break;case'smsqueues':_0x44a18e['childModel']='SmsQueue';break;case _0xacf1('0x48'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x49');break;case _0xacf1('0x4a'):_0x44a18e['childModel']=_0xacf1('0x4b');break;case'whatsappaccounts':_0x44a18e['childModel']=_0xacf1('0x4c');break;case _0xacf1('0x4d'):_0x44a18e[_0xacf1('0x11')]='Team';break;case _0xacf1('0x4e'):case'queuecampaigns':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x36');if(_0x443f29){_0x44a18e[_0xacf1('0x16')]=[{'name':_0xacf1('0x4f')},{'name':_0xacf1('0x38')}];}break;case _0xacf1('0x50'):case _0xacf1('0x51'):case _0xacf1('0x52'):_0x44a18e['childModel']=_0xacf1('0x31');if(_0x443f29){_0x44a18e[_0xacf1('0x16')]=[{'name':_0xacf1('0x53'),'filter':{'field':_0xacf1('0x32'),'value':[_0xacf1('0x54'),_0xacf1('0x55')]},'ignore':!![]},{'name':'Agents'},{'name':_0xacf1('0x34')}];}break;case'zendeskaccounts':_0x44a18e['childModel']=_0xacf1('0x56');break;case _0xacf1('0x57'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x58');break;case _0xacf1('0x59'):_0x44a18e[_0xacf1('0x11')]='FreshdeskAccount';break;case _0xacf1('0x5a'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x5b');break;case _0xacf1('0x5c'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x5d');break;case _0xacf1('0x5e'):_0x44a18e[_0xacf1('0x11')]='ZohoAccount';break;case _0xacf1('0x5f'):_0x44a18e['childModel']=_0xacf1('0x31');break;case'cannedanswers':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x60');break;case'dispositions':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x61');break;case'customdashboards':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x62');break;case'intervals':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x63');break;case'pauses':_0x44a18e['childModel']=_0xacf1('0x64');break;case _0xacf1('0x65'):_0x44a18e[_0xacf1('0x11')]='Schedule';break;case _0xacf1('0x66'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x67');break;case _0xacf1('0x68'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x69');break;case _0xacf1('0x6a'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x6b');break;case _0xacf1('0x6c'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x6d');break;case _0xacf1('0x6e'):_0x44a18e[_0xacf1('0x11')]='Trunk';break;case'variables':_0x44a18e['childModel']=_0xacf1('0x6f');break;case'plugins':_0x44a18e[_0xacf1('0x11')]=_0xacf1('0x70');break;case _0xacf1('0x71'):_0x44a18e[_0xacf1('0x11')]=_0xacf1('0xf');_0x44a18e[_0xacf1('0x16')]=[{'name':_0xacf1('0x72'),'field':'id','foreignKey':_0xacf1('0x73')}];break;case'metrics':_0x44a18e['childModel']=_0xacf1('0x74');break;}return _0x44a18e;}function _0x318bde(_0x26b83c,_0x4d0d2b){var _0x58fc97=_0x26b83c[_0xacf1('0x75')](0x0)[_0xacf1('0x76')]()+_0x26b83c[_0xacf1('0x77')](0x1);var _0x47f164={'type':_0x174c5c[_0xacf1('0x78')]['QueryTypes'][_0xacf1('0x79')],'raw':!![]};return new Promise(function(_0x2bafd0,_0x4dc8e6){var _0x246b0b=squel[_0xacf1('0x7a')]()[_0xacf1('0xb')](_0xacf1('0x7b')+_0x58fc97+'InteractionId','id')[_0xacf1('0xb')](_0xacf1('0x7c'))['from'](_0xacf1('0x7d')+_0x26b83c+_0xacf1('0x7e'),'ui')['where'](_0xacf1('0x7f'),_0x4d0d2b['id']);return _0x174c5c[_0xacf1('0x80')][_0xacf1('0x81')](_0x246b0b[_0xacf1('0x82')](),_0x47f164)[_0xacf1('0x7')](function(_0x461f96){_0x4d0d2b[_0x58fc97+_0xacf1('0x83')]=_0x461f96;_0x2bafd0(_0x461f96);})[_0xacf1('0xa')](function(_0x439c29){_0x4dc8e6(_0x439c29);});});}return _0x50c185[_0xacf1('0x84')](_0xacf1('0x85'),attributes,{'tableName':_0xacf1('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x7a9be0){var _0x54812d={'raw':_0x7a9be0['query'][_0xacf1('0x87')],'where':{}};var _0x1886bd={};var _0x1b6b7c={'count':0x0,'rows':[]};var _0x47d2b5=_0x7a9be0[_0xacf1('0x81')][_0xacf1('0x88')];var _0x17f2e1=_0x7a9be0[_0xacf1('0x81')][_0xacf1('0x89')]||![];var _0x5ed560=_0x57683c(_0x47d2b5,_0x17f2e1);if(!_0x5ed560['childModel'])throw new Error(_0xacf1('0x8a')+_0x47d2b5+'\x27');var _0x28af6e=[{'name':_0x47d2b5}];if(!_[_0xacf1('0x8b')](_0x5ed560[_0xacf1('0x16')]))_0x28af6e=_0x5ed560[_0xacf1('0x16')];var _0x3a0688=[];for(var _0x2071a3=0x0;_0x2071a3<_0x28af6e[_0xacf1('0x8c')];_0x2071a3++){_0x3a0688[_0xacf1('0x8d')](_0x174c5c['UserProfileSection'][_0xacf1('0x8e')]({'where':{'userProfileId':_0x7a9be0[_0xacf1('0x8f')]['id'],'name':_0x28af6e[_0x2071a3][_0xacf1('0x2f')]},'raw':!![]}));}return Promise[_0xacf1('0x90')](_0x3a0688)[_0xacf1('0x7')](function(_0xb29885){var _0x450ff1=_[_0xacf1('0x4')](_0xb29885,function(_0x170a1e){return _0x170a1e?_0x170a1e:undefined;});var _0x1c5327=_[_0xacf1('0x4')](_0x28af6e,[_0xacf1('0x91'),!![]]);var _0x37270a=_[_0xacf1('0x8b')](_0x450ff1)&&_[_0xacf1('0x8b')](_0x1c5327)?null:_[_0xacf1('0x92')](_0x1c5327,_0x450ff1);if(!_0x37270a)return null;var _0x2a7e1b=[];for(var _0x161a88=0x0;_0x161a88<_0x37270a['length'];_0x161a88++){var _0xaf950a=_['find'](_0x28af6e,function(_0x496a73){return _0x37270a[_0x161a88]?_0x496a73[_0xacf1('0x2f')]===_0x37270a[_0x161a88][_0xacf1('0x2f')]:null;});if(_0xaf950a){if(_0x37270a[_0x161a88][_0xacf1('0x91')]){_0x2a7e1b[_0xacf1('0x8d')](_0x2eeee5(_0x5ed560['childModel'],_0x37270a[_0x161a88]));}else{if(!_0x37270a[_0x161a88][_0xacf1('0x93')]){_0x2a7e1b[_0xacf1('0x8d')](_0x439bca(_0xaf950a,_0x37270a[_0x161a88],_0x5ed560[_0xacf1('0x11')]));}else{if(_0xaf950a[_0xacf1('0xc')]){_0x2a7e1b['push'](_0x452d5c(_0xaf950a,_0x37270a[_0x161a88]));}}}}}return Promise[_0xacf1('0x90')](_0x2a7e1b);})[_0xacf1('0x7')](function(_0x3c19bb){var _0xe51b99=_0x3c19bb;var _0x5c7727=null;if(_0xe51b99){_0x5c7727=_0xe51b99['length']===0x1?_0xe51b99[0x0]:null;}if(!_0x5c7727&&!_0xe51b99)return _0x1b6b7c;var _0x3ad84b=_0x174c5c[_0x5ed560[_0xacf1('0x11')]]['rawAttributes'];_0x1886bd['model']=_[_0xacf1('0x94')](_0x3ad84b);_0x1886bd['query']=_[_0xacf1('0x94')](_0x7a9be0[_0xacf1('0x81')]);_0x1886bd[_0xacf1('0x95')]=_[_0xacf1('0x96')](_0x1886bd[_0xacf1('0xc')],_0x1886bd['query']);_0x54812d[_0xacf1('0x97')]=_[_0xacf1('0x96')](_0x1886bd[_0xacf1('0xc')],qs[_0xacf1('0x98')](_0x7a9be0[_0xacf1('0x81')][_0xacf1('0x98')]));_0x54812d[_0xacf1('0x97')]=_0x54812d[_0xacf1('0x97')]['length']?_0x54812d[_0xacf1('0x97')]:_0x1886bd[_0xacf1('0xc')];if(!_0x7a9be0['query'][_0xacf1('0x99')](_0xacf1('0x9a'))){_0x54812d['limit']=qs[_0xacf1('0x9b')](_0x7a9be0[_0xacf1('0x81')][_0xacf1('0x9b')]);_0x54812d[_0xacf1('0x9c')]=qs[_0xacf1('0x9c')](_0x7a9be0[_0xacf1('0x81')][_0xacf1('0x9c')]);}_0x54812d['order']=qs[_0xacf1('0x9d')](_0x7a9be0['query'][_0xacf1('0x9d')]);_0x54812d['where']=qs['filters'](_[_0xacf1('0x9e')](_0x7a9be0[_0xacf1('0x81')],_0x1886bd['filters']));if(_0x7a9be0['query'][_0xacf1('0x4')]){_0x54812d['where']=_[_0xacf1('0x9f')](_0x54812d[_0xacf1('0xa0')],{'$or':_[_0xacf1('0x9')](_0x3ad84b,function(_0x1d0222){if(_0x1d0222['type'][_0xacf1('0xa1')]!==_0xacf1('0xa2')){var _0x20e312={};_0x20e312[_0x1d0222[_0xacf1('0xb')]]={'$like':'%'+_0x7a9be0[_0xacf1('0x81')]['filter']+'%'};return _0x20e312;}})});}var _0x40e794=[];var _0x3e0a80=null;var _0x3fe4b1={};if(_0x5c7727){_0x3e0a80=_[_0xacf1('0x8e')](_0x28af6e,['name',_0x5c7727[_0xacf1('0x2f')]]);if(_0x3e0a80[_0xacf1('0xb')]){_0x3fe4b1={};if(_0x5ed560[_0xacf1('0x11')]===_0xacf1('0xf')){_0x3fe4b1[_0x3e0a80[_0xacf1('0xa3')]]=_[_0xacf1('0x9')](_0x5c7727[_0xacf1('0x8')],'id');}else{_0x3fe4b1[_0x3e0a80[_0xacf1('0xa3')]]=_0x5c7727[_0xacf1('0x8')];}_0x40e794[_0xacf1('0x8d')](_0x3fe4b1);}else{_0x54812d['where']['id']=_0x5c7727[_0xacf1('0x8')];}}else{for(var _0x5bced4=0x0;_0x5bced4<_0xe51b99[_0xacf1('0x8c')];_0x5bced4++){_0x3e0a80=_[_0xacf1('0x8e')](_0x28af6e,[_0xacf1('0x2f'),_0xe51b99[_0x5bced4][_0xacf1('0x2f')]]);if(_0x3e0a80[_0xacf1('0xb')]){_0x3fe4b1={};_0x3fe4b1[_0x3e0a80[_0xacf1('0xa3')]]=_0xe51b99[_0x5bced4][_0xacf1('0x8')];_0x40e794[_0xacf1('0x8d')](_0x3fe4b1);}else{if(!_0x54812d[_0xacf1('0xa0')]['id'])_0x54812d[_0xacf1('0xa0')]['id']=[];_0xe51b99[_0x5bced4][_0xacf1('0x8')][_0xacf1('0xa4')](function(_0x5b4733){_0x54812d[_0xacf1('0xa0')]['id'][_0xacf1('0x8d')](_0x5b4733);});}}}if(!_[_0xacf1('0x8b')](_0x40e794)){_0x54812d[_0xacf1('0xa0')]=_[_0xacf1('0x9f')](_0x54812d[_0xacf1('0xa0')],{'$and':{'$or':_0x40e794}});}_0x54812d=_['merge']({},_0x54812d,_0x7a9be0['options']);if(_0x5c7727&&!_0x5c7727[_0xacf1('0x93')]&&_0x5ed560['childModel']==='AnalyticExtractedReport'){if(_0x7a9be0[_0xacf1('0x81')][_0xacf1('0xa5')]){_0x54812d[_0xacf1('0xa6')]=[{'all':!![]}];}return _0x174c5c[_0x5ed560['childModel']]['findAll'](_0x54812d)['then'](function(_0x374753){var _0x42c671=[];_0x374753[_0xacf1('0xa4')](function(_0x17c562){var _0x5dc7b6;switch(_0x17c562[_0xacf1('0xa7')]){case _0xacf1('0xa8'):_0x5dc7b6=_[_0xacf1('0x8e')](_0x5c7727[_0xacf1('0x8')],function(_0x3d7988){return _0x3d7988['id']===_0x17c562[_0xacf1('0x73')]&&_0x3d7988[_0xacf1('0xa9')]===_0xacf1('0xaa');});break;case _0xacf1('0xab'):_0x5dc7b6=_[_0xacf1('0x8e')](_0x5c7727[_0xacf1('0x8')],function(_0x57dc66){return _0x57dc66['id']===_0x17c562[_0xacf1('0x73')]&&_0x57dc66[_0xacf1('0xa9')]===_0xacf1('0xac');});break;}if(_0x5dc7b6)_0x42c671[_0xacf1('0x8d')](_0x17c562);});_0x1b6b7c['count']=_0x42c671['length'];_0x1b6b7c[_0xacf1('0xad')]=_0x42c671;return _0x1b6b7c;});}else{return _0x174c5c[_0x5ed560[_0xacf1('0x11')]]['count']({'where':_0x54812d[_0xacf1('0xa0')]})[_0xacf1('0x7')](function(_0x4291e0){_0x1b6b7c['count']=_0x4291e0;if(_0x7a9be0['query'][_0xacf1('0xa5')]){if(_0x5ed560[_0xacf1('0x11')]===_0xacf1('0x1a')){_0x54812d[_0xacf1('0xa6')]=[{'model':_0x174c5c[_0xacf1('0x69')],'as':'Tags','attributes':['id',_0xacf1('0x2f'),_0xacf1('0xae')],'required':_0x7a9be0[_0xacf1('0x81')][_0xacf1('0xaf')]?!![]:![]},{'model':_0x174c5c['Tag'],'as':_0xacf1('0xb0'),'attributes':['id',_0xacf1('0x2f'),_0xacf1('0xae')],'through':_0x7a9be0['query'][_0xacf1('0xaf')]?{'attributes':[],'where':{'TagId':_0x7a9be0[_0xacf1('0x81')][_0xacf1('0xaf')]||undefined}}:{},'required':_0x7a9be0[_0xacf1('0x81')][_0xacf1('0xaf')]?!![]:![]}];}else{_0x54812d[_0xacf1('0xa6')]=[{'all':!![]}];}}return _0x174c5c[_0x5ed560['childModel']]['findAll'](_0x54812d);})['then'](function(_0x9a84d0){_0x1b6b7c[_0xacf1('0xad')]=_0x9a84d0;if(_0x47d2b5===_0xacf1('0x2e')&&_0x7a9be0['query'][_0xacf1('0xb1')]==='true'){var _0x4428ab=[];for(var _0x48af36=0x0;_0x48af36<_0x1b6b7c['rows'][_0xacf1('0x8c')];_0x48af36++){_0x4428ab[_0xacf1('0x8d')](_0x318bde('chat',_0x1b6b7c[_0xacf1('0xad')][_0x48af36][_0xacf1('0xb2')]));_0x4428ab[_0xacf1('0x8d')](_0x318bde(_0xacf1('0xb3'),_0x1b6b7c[_0xacf1('0xad')][_0x48af36][_0xacf1('0xb2')]));_0x4428ab[_0xacf1('0x8d')](_0x318bde(_0xacf1('0xb4'),_0x1b6b7c['rows'][_0x48af36][_0xacf1('0xb2')]));_0x4428ab[_0xacf1('0x8d')](_0x318bde('mail',_0x1b6b7c[_0xacf1('0xad')][_0x48af36][_0xacf1('0xb2')]));_0x4428ab[_0xacf1('0x8d')](_0x318bde(_0xacf1('0xb5'),_0x1b6b7c[_0xacf1('0xad')][_0x48af36][_0xacf1('0xb2')]));_0x4428ab[_0xacf1('0x8d')](_0x318bde(_0xacf1('0xb6'),_0x1b6b7c['rows'][_0x48af36][_0xacf1('0xb2')]));}return Promise[_0xacf1('0x90')](_0x4428ab)[_0xacf1('0x7')](function(){return _0x1b6b7c;});}return _0x1b6b7c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2fc79c3..5da4595 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 _0x187d=['stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x22b853,_0x4ab6b8){var _0x4697fb=function(_0x51cf72){while(--_0x51cf72){_0x22b853['push'](_0x22b853['shift']());}};_0x4697fb(++_0x4ab6b8);}(_0x187d,0x93));var _0xd187=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x187d[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});config[_0xd187('0xb')]=_[_0xd187('0xc')](config[_0xd187('0xb')],{'host':_0xd187('0xd'),'port':0x18eb});var socket=require(_0xd187('0xe'))(new Redis(config[_0xd187('0xb')]));require('./userProfile.socket')[_0xd187('0xf')](socket);function respondWithRpcPromise(_0x42848b,_0x4039f6,_0x473866){return new BPromise(function(_0x33ca45,_0x2a61a4){return client['request'](_0x42848b,_0x473866)[_0xd187('0x10')](function(_0x412ccf){logger[_0xd187('0x11')]('UserProfile,\x20%s,\x20%s',_0x4039f6,_0xd187('0x12'));logger[_0xd187('0x13')](_0xd187('0x14'),_0x4039f6,'request\x20sent',JSON[_0xd187('0x15')](_0x412ccf));if(_0x412ccf[_0xd187('0x16')]){if(_0x412ccf[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger['error'](_0xd187('0x18'),_0x4039f6,_0x412ccf[_0xd187('0x16')][_0xd187('0x19')]);return _0x2a61a4(_0x412ccf[_0xd187('0x16')]['message']);}logger[_0xd187('0x16')]('UserProfile,\x20%s,\x20%s',_0x4039f6,_0x412ccf['error'][_0xd187('0x19')]);return _0x33ca45(_0x412ccf['error']['message']);}else{logger[_0xd187('0x11')](_0xd187('0x18'),_0x4039f6,_0xd187('0x12'));_0x33ca45(_0x412ccf[_0xd187('0x1a')][_0xd187('0x19')]);}})[_0xd187('0x1b')](function(_0x12b388){logger[_0xd187('0x16')](_0xd187('0x18'),_0x4039f6,_0x12b388);_0x2a61a4(_0x12b388);});});} \ No newline at end of file +var _0x8f25=['ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x424df0,_0x3d656a){var _0xccc723=function(_0x513fe3){while(--_0x513fe3){_0x424df0['push'](_0x424df0['shift']());}};_0xccc723(++_0x3d656a);}(_0x8f25,0x14b));var _0x58f2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x8f25[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var moment=require(_0x58f2('0x2'));var BPromise=require(_0x58f2('0x3'));var rs=require(_0x58f2('0x4'));var fs=require('fs');var Redis=require(_0x58f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x58f2('0x6'));var config=require(_0x58f2('0x7'));var jayson=require(_0x58f2('0x8'));var client=jayson['client'][_0x58f2('0x9')]({'port':0x232a});config[_0x58f2('0xa')]=_[_0x58f2('0xb')](config[_0x58f2('0xa')],{'host':_0x58f2('0xc'),'port':0x18eb});var socket=require(_0x58f2('0xd'))(new Redis(config[_0x58f2('0xa')]));require(_0x58f2('0xe'))['register'](socket);function respondWithRpcPromise(_0xd13f10,_0x1880f8,_0x3a1d5f){return new BPromise(function(_0x4242a6,_0x24e105){return client['request'](_0xd13f10,_0x3a1d5f)[_0x58f2('0xf')](function(_0x17c411){logger[_0x58f2('0x10')]('UserProfile,\x20%s,\x20%s',_0x1880f8,_0x58f2('0x11'));logger[_0x58f2('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1880f8,_0x58f2('0x11'),JSON[_0x58f2('0x13')](_0x17c411));if(_0x17c411['error']){if(_0x17c411[_0x58f2('0x14')][_0x58f2('0x15')]===0x1f4){logger[_0x58f2('0x14')](_0x58f2('0x16'),_0x1880f8,_0x17c411[_0x58f2('0x14')][_0x58f2('0x17')]);return _0x24e105(_0x17c411[_0x58f2('0x14')][_0x58f2('0x17')]);}logger[_0x58f2('0x14')](_0x58f2('0x16'),_0x1880f8,_0x17c411[_0x58f2('0x14')][_0x58f2('0x17')]);return _0x4242a6(_0x17c411['error'][_0x58f2('0x17')]);}else{logger['info'](_0x58f2('0x16'),_0x1880f8,_0x58f2('0x11'));_0x4242a6(_0x17c411['result']['message']);}})['catch'](function(_0x5b2462){logger[_0x58f2('0x14')](_0x58f2('0x16'),_0x1880f8,_0x5b2462);_0x24e105(_0x5b2462);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 0cb6e9c..10db144 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 _0x8740=['length','./userProfile.events','remove','update','emit','removeListener','register'];(function(_0x565a45,_0x3db7ab){var _0x186e3b=function(_0x12697d){while(--_0x12697d){_0x565a45['push'](_0x565a45['shift']());}};_0x186e3b(++_0x3db7ab);}(_0x8740,0xa2));var _0x0874=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x8740[_0x42bdad];return _0x122626;};'use strict';var UserProfileEvents=require(_0x0874('0x0'));var events=['save',_0x0874('0x1'),_0x0874('0x2')];function createListener(_0x124241,_0x31322f){return function(_0x17acbb){_0x31322f[_0x0874('0x3')](_0x124241,_0x17acbb);};}function removeListener(_0x2c50c1,_0x19165d){return function(){UserProfileEvents[_0x0874('0x4')](_0x2c50c1,_0x19165d);};}exports[_0x0874('0x5')]=function(_0x431dd8){for(var _0x29b260=0x0,_0x50c2e2=events[_0x0874('0x6')];_0x29b260<_0x50c2e2;_0x29b260++){var _0x40d809=events[_0x29b260];var _0x50176f=createListener('userProfile:'+_0x40d809,_0x431dd8);UserProfileEvents['on'](_0x40d809,_0x50176f);}}; \ No newline at end of file +var _0xa2c3=['userProfile:','update','length'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa2c3,0xac));var _0x3a2c=function(_0x48c19b,_0x3a1721){_0x48c19b=_0x48c19b-0x0;var _0x7b88f=_0xa2c3[_0x48c19b];return _0x7b88f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0x3a2c('0x0')];function createListener(_0x2df67e,_0x26ea7b){return function(_0x2ff7b1){_0x26ea7b['emit'](_0x2df67e,_0x2ff7b1);};}function removeListener(_0x16ce9e,_0xa1937d){return function(){UserProfileEvents['removeListener'](_0x16ce9e,_0xa1937d);};}exports['register']=function(_0x5bbf52){for(var _0x47a763=0x0,_0x1585ba=events[_0x3a2c('0x1')];_0x47a763<_0x1585ba;_0x47a763++){var _0x228e76=events[_0x47a763];var _0x46fac0=createListener(_0x3a2c('0x2')+_0x228e76,_0x5bbf52);UserProfileEvents['on'](_0x228e76,_0x46fac0);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 879f3e7..58b9830 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 _0x5040=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','describe','show','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x4e5500,_0x45c9ab){var _0x35bf47=function(_0x2adc76){while(--_0x2adc76){_0x4e5500['push'](_0x4e5500['shift']());}};_0x35bf47(++_0x45c9ab);}(_0x5040,0x8a));var _0x0504=function(_0x13afe7,_0x30b1cb){_0x13afe7=_0x13afe7-0x0;var _0x11233a=_0x5040[_0x13afe7];return _0x11233a;};'use strict';var multer=require(_0x0504('0x0'));var util=require('util');var path=require(_0x0504('0x1'));var timeout=require(_0x0504('0x2'));var express=require(_0x0504('0x3'));var router=express[_0x0504('0x4')]();var fs_extra=require(_0x0504('0x5'));var auth=require(_0x0504('0x6'));var interaction=require(_0x0504('0x7'));var config=require(_0x0504('0x8'));var controller=require(_0x0504('0x9'));router[_0x0504('0xa')]('/',auth[_0x0504('0xb')](),controller['index']);router['get']('/describe',auth[_0x0504('0xb')](),controller[_0x0504('0xc')]);router[_0x0504('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0504('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0504('0xe')](_0x0504('0xf'),auth['isAuthenticated'](),controller[_0x0504('0x10')]);router[_0x0504('0x11')](_0x0504('0xf'),auth['isAuthenticated'](),controller[_0x0504('0x12')]);module[_0x0504('0x13')]=router; \ No newline at end of file +var _0x0a58=['post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3c53ce,_0x2521d7){var _0x57a938=function(_0x34da71){while(--_0x34da71){_0x3c53ce['push'](_0x3c53ce['shift']());}};_0x57a938(++_0x2521d7);}(_0x0a58,0x10f));var _0x80a5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0a58[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x80a5('0x0'));var util=require(_0x80a5('0x1'));var path=require(_0x80a5('0x2'));var timeout=require(_0x80a5('0x3'));var express=require(_0x80a5('0x4'));var router=express[_0x80a5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x80a5('0x6'));var config=require(_0x80a5('0x7'));var controller=require(_0x80a5('0x8'));router[_0x80a5('0x9')]('/',auth[_0x80a5('0xa')](),controller[_0x80a5('0xb')]);router['get'](_0x80a5('0xc'),auth[_0x80a5('0xa')](),controller[_0x80a5('0xd')]);router[_0x80a5('0x9')]('/:id',auth[_0x80a5('0xa')](),controller[_0x80a5('0xe')]);router[_0x80a5('0xf')]('/',auth[_0x80a5('0xa')](),controller[_0x80a5('0x10')]);router[_0x80a5('0x11')](_0x80a5('0x12'),auth[_0x80a5('0xa')](),controller[_0x80a5('0x13')]);router[_0x80a5('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x80a5('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 81c0b2c..d775360 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 _0x1146=['sequelize','exports','STRING'];(function(_0x26c85e,_0x519f63){var _0x359bcd=function(_0xb36d8e){while(--_0xb36d8e){_0x26c85e['push'](_0x26c85e['shift']());}};_0x359bcd(++_0x519f63);}(_0x1146,0x1cb));var _0x6114=function(_0x3a048b,_0x22062b){_0x3a048b=_0x3a048b-0x0;var _0x1b7322=_0x1146[_0x3a048b];return _0x1b7322;};'use strict';var Sequelize=require(_0x6114('0x0'));module[_0x6114('0x1')]={'name':{'type':Sequelize[_0x6114('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe470=['exports','STRING','INTEGER'];(function(_0x3ea0ee,_0x2195b7){var _0xcbd668=function(_0x484ed7){while(--_0x484ed7){_0x3ea0ee['push'](_0x3ea0ee['shift']());}};_0xcbd668(++_0x2195b7);}(_0xe470,0x78));var _0x0e47=function(_0xfb2c4d,_0x1ac033){_0xfb2c4d=_0xfb2c4d-0x0;var _0x263eec=_0xe470[_0xfb2c4d];return _0x263eec;};'use strict';var Sequelize=require('sequelize');module[_0x0e47('0x0')]={'name':{'type':Sequelize[_0x0e47('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0e47('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 521e32f..42b915c 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 _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','UserProfileResource','rawAttributes','type'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['UserProfileResource'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['UserProfileResource']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['UserProfileResource'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file +var _0x66fa=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','UserProfileResource','findAll','rows','catch','merge','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x66fa,0x117));var _0xa66f=function(_0x1ae5f1,_0x3092c2){_0x1ae5f1=_0x1ae5f1-0x0;var _0x4f2db9=_0x66fa[_0x1ae5f1];return _0x4f2db9;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['UserProfileResource'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['UserProfileResource'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['UserProfileResource'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['UserProfileResource'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));};exports[_0xa66f('0x4a')]=function(_0x5d77d1,_0x389b9a){return db['UserProfileResource'][_0xa66f('0x4a')]()['then'](respondWithResult(_0x389b9a,null))['catch'](handleError(_0x389b9a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index cf7734b..e880e8c 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 _0x2e19=['compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources'];(function(_0x39ea3a,_0x392dd9){var _0x527b95=function(_0x41415b){while(--_0x41415b){_0x39ea3a['push'](_0x39ea3a['shift']());}};_0x527b95(++_0x392dd9);}(_0x2e19,0xcf));var _0x92e1=function(_0x38e6c7,_0x549455){_0x38e6c7=_0x38e6c7-0x0;var _0x8dd3c4=_0x2e19[_0x38e6c7];return _0x8dd3c4;};'use strict';var _=require(_0x92e1('0x0'));var util=require(_0x92e1('0x1'));var logger=require(_0x92e1('0x2'))(_0x92e1('0x3'));var moment=require(_0x92e1('0x4'));var BPromise=require(_0x92e1('0x5'));var rp=require(_0x92e1('0x6'));var fs=require('fs');var path=require(_0x92e1('0x7'));var rimraf=require(_0x92e1('0x8'));var config=require(_0x92e1('0x9'));var attributes=require(_0x92e1('0xa'));module[_0x92e1('0xb')]=function(_0x52b47a,_0x5ad4b1){return _0x52b47a[_0x92e1('0xc')]('UserProfileResource',attributes,{'tableName':_0x92e1('0xd'),'paranoid':![],'indexes':[{'name':_0x92e1('0xe'),'fields':[_0x92e1('0xf'),_0x92e1('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd021=['resourceId','sectionId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xd021,0x1a6));var _0x1d02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd021[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d02('0x0'));var util=require(_0x1d02('0x1'));var logger=require(_0x1d02('0x2'))(_0x1d02('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1d02('0x4'));var fs=require('fs');var path=require(_0x1d02('0x5'));var rimraf=require(_0x1d02('0x6'));var config=require(_0x1d02('0x7'));var attributes=require(_0x1d02('0x8'));module[_0x1d02('0x9')]=function(_0x2a8265,_0x447796){return _0x2a8265[_0x1d02('0xa')]('UserProfileResource',attributes,{'tableName':_0x1d02('0xb'),'paranoid':![],'indexes':[{'name':_0x1d02('0xc'),'fields':[_0x1d02('0xd'),_0x1d02('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4ef14cf..c97eaf4 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 _0x29c7=['then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xf61d62,_0x5e1ce1){var _0x1b8b00=function(_0x21dbba){while(--_0x21dbba){_0xf61d62['push'](_0xf61d62['shift']());}};_0x1b8b00(++_0x5e1ce1);}(_0x29c7,0x13f));var _0x729c=function(_0x19b10d,_0x4da28b){_0x19b10d=_0x19b10d-0x0;var _0x4fd0d5=_0x29c7[_0x19b10d];return _0x4fd0d5;};'use strict';var _=require(_0x729c('0x0'));var util=require(_0x729c('0x1'));var moment=require(_0x729c('0x2'));var BPromise=require(_0x729c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x729c('0x4'));var logger=require(_0x729c('0x5'))('rpc');var config=require(_0x729c('0x6'));var jayson=require(_0x729c('0x7'));var client=jayson[_0x729c('0x8')][_0x729c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c743f,_0x3cb9bc,_0xf31baf){return new BPromise(function(_0x234923,_0x54aeee){return client[_0x729c('0xa')](_0x3c743f,_0xf31baf)[_0x729c('0xb')](function(_0x3cef9e){logger[_0x729c('0xc')](_0x729c('0xd'),_0x3cb9bc,_0x729c('0xe'));logger[_0x729c('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3cb9bc,'request\x20sent',JSON[_0x729c('0x10')](_0x3cef9e));if(_0x3cef9e[_0x729c('0x11')]){if(_0x3cef9e[_0x729c('0x11')][_0x729c('0x12')]===0x1f4){logger[_0x729c('0x11')](_0x729c('0xd'),_0x3cb9bc,_0x3cef9e[_0x729c('0x11')][_0x729c('0x13')]);return _0x54aeee(_0x3cef9e[_0x729c('0x11')][_0x729c('0x13')]);}logger[_0x729c('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x3cb9bc,_0x3cef9e[_0x729c('0x11')][_0x729c('0x13')]);return _0x234923(_0x3cef9e[_0x729c('0x11')][_0x729c('0x13')]);}else{logger[_0x729c('0xc')](_0x729c('0xd'),_0x3cb9bc,'request\x20sent');_0x234923(_0x3cef9e[_0x729c('0x14')][_0x729c('0x13')]);}})[_0x729c('0x15')](function(_0x27fce3){logger[_0x729c('0x11')](_0x729c('0xd'),_0x3cb9bc,_0x27fce3);_0x54aeee(_0x27fce3);});});} \ No newline at end of file +var _0x721c=['request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x101d5b,_0x40cfd){var _0x382a50=function(_0x2fd131){while(--_0x2fd131){_0x101d5b['push'](_0x101d5b['shift']());}};_0x382a50(++_0x40cfd);}(_0x721c,0x89));var _0xc721=function(_0x35accd,_0x14baa3){_0x35accd=_0x35accd-0x0;var _0x473ed1=_0x721c[_0x35accd];return _0x473ed1;};'use strict';var _=require(_0xc721('0x0'));var util=require(_0xc721('0x1'));var moment=require(_0xc721('0x2'));var BPromise=require(_0xc721('0x3'));var rs=require(_0xc721('0x4'));var fs=require('fs');var Redis=require(_0xc721('0x5'));var db=require(_0xc721('0x6'))['db'];var utils=require(_0xc721('0x7'));var logger=require(_0xc721('0x8'))(_0xc721('0x9'));var config=require(_0xc721('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc721('0xb')][_0xc721('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2870cf,_0x14d761,_0x9b0f27){return new BPromise(function(_0xadb8b4,_0x335f92){return client[_0xc721('0xd')](_0x2870cf,_0x9b0f27)[_0xc721('0xe')](function(_0x488231){logger[_0xc721('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x14d761,_0xc721('0x10'));logger[_0xc721('0x11')](_0xc721('0x12'),_0x14d761,_0xc721('0x10'),JSON[_0xc721('0x13')](_0x488231));if(_0x488231['error']){if(_0x488231[_0xc721('0x14')][_0xc721('0x15')]===0x1f4){logger[_0xc721('0x14')](_0xc721('0x16'),_0x14d761,_0x488231['error'][_0xc721('0x17')]);return _0x335f92(_0x488231[_0xc721('0x14')][_0xc721('0x17')]);}logger[_0xc721('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x14d761,_0x488231[_0xc721('0x14')][_0xc721('0x17')]);return _0xadb8b4(_0x488231[_0xc721('0x14')][_0xc721('0x17')]);}else{logger[_0xc721('0xf')](_0xc721('0x16'),_0x14d761,'request\x20sent');_0xadb8b4(_0x488231[_0xc721('0x18')][_0xc721('0x17')]);}})['catch'](function(_0x32b88c){logger[_0xc721('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x14d761,_0x32b88c);_0x335f92(_0x32b88c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 69a087a..d996b51 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 _0x2cf9=['../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2cf9,0x160));var _0x92cf=function(_0x3752f8,_0xe21391){_0x3752f8=_0x3752f8-0x0;var _0x33dbb0=_0x2cf9[_0x3752f8];return _0x33dbb0;};'use strict';var multer=require(_0x92cf('0x0'));var util=require(_0x92cf('0x1'));var path=require(_0x92cf('0x2'));var timeout=require(_0x92cf('0x3'));var express=require(_0x92cf('0x4'));var router=express['Router']();var fs_extra=require(_0x92cf('0x5'));var auth=require(_0x92cf('0x6'));var interaction=require(_0x92cf('0x7'));var config=require(_0x92cf('0x8'));var controller=require(_0x92cf('0x9'));router['get']('/',auth[_0x92cf('0xa')](),controller[_0x92cf('0xb')]);router[_0x92cf('0xc')](_0x92cf('0xd'),auth[_0x92cf('0xa')](),controller[_0x92cf('0xe')]);router[_0x92cf('0xc')](_0x92cf('0xf'),auth[_0x92cf('0xa')](),controller[_0x92cf('0x10')]);router[_0x92cf('0x11')]('/',auth[_0x92cf('0xa')](),controller[_0x92cf('0x12')]);router[_0x92cf('0x13')](_0x92cf('0xf'),auth[_0x92cf('0xa')](),controller[_0x92cf('0x14')]);router[_0x92cf('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x92cf('0x16')]);module[_0x92cf('0x17')]=router; \ No newline at end of file +var _0x983f=['/describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1a0d0b,_0x26615e){var _0x2cbb52=function(_0x1aa6d6){while(--_0x1aa6d6){_0x1a0d0b['push'](_0x1a0d0b['shift']());}};_0x2cbb52(++_0x26615e);}(_0x983f,0xed));var _0xf983=function(_0x33b4cb,_0x1cc454){_0x33b4cb=_0x33b4cb-0x0;var _0x3301de=_0x983f[_0x33b4cb];return _0x3301de;};'use strict';var multer=require('multer');var util=require(_0xf983('0x0'));var path=require(_0xf983('0x1'));var timeout=require(_0xf983('0x2'));var express=require(_0xf983('0x3'));var router=express['Router']();var fs_extra=require(_0xf983('0x4'));var auth=require(_0xf983('0x5'));var interaction=require(_0xf983('0x6'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xf983('0x7')]('/',auth[_0xf983('0x8')](),controller[_0xf983('0x9')]);router[_0xf983('0x7')](_0xf983('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf983('0xb'),auth[_0xf983('0x8')](),controller[_0xf983('0xc')]);router[_0xf983('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf983('0xe')]('/:id',auth[_0xf983('0x8')](),controller[_0xf983('0xf')]);router[_0xf983('0x10')](_0xf983('0xb'),auth[_0xf983('0x8')](),controller[_0xf983('0x11')]);module[_0xf983('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 336e4d2..780865b 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 _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0xa6e4c8,_0x52e242){var _0x29e0c8=function(_0x2caaf2){while(--_0x2caaf2){_0xa6e4c8['push'](_0xa6e4c8['shift']());}};_0x29e0c8(++_0x52e242);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2051d3,_0x4768e2){_0x2051d3=_0x2051d3-0x0;var _0x475857=_0x9ffd[_0x2051d3];return _0x475857;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file +var _0xb9be=['exports','STRING','INTEGER','BOOLEAN','join','getDataValue','crudPermissions','split','sequelize'];(function(_0x116379,_0x5262f7){var _0x285630=function(_0x31928c){while(--_0x31928c){_0x116379['push'](_0x116379['shift']());}};_0x285630(++_0x5262f7);}(_0xb9be,0xc5));var _0xeb9b=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xb9be[_0xc8a931];return _0x28bd27;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'name':{'type':Sequelize[_0xeb9b('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb9b('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb9b('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb9b('0x2')],'set':function(_0x288aaa){this['setDataValue']('crudPermissions',_0x288aaa?_0x288aaa[_0xeb9b('0x5')](''):[]);},'get':function(){return this[_0xeb9b('0x6')](_0xeb9b('0x7'))?this['getDataValue'](_0xeb9b('0x7'))[_0xeb9b('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d386acc..9350787 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 _0xe1b7=['Content-Range','apply','reject','save','update','then','destroy','error','stack','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','name','filter','merge','includeAll','include','UserProfileSection','findAll','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','count','offset','set'];(function(_0x257043,_0x994811){var _0x4dcd3e=function(_0x49a341){while(--_0x49a341){_0x257043['push'](_0x257043['shift']());}};_0x4dcd3e(++_0x994811);}(_0xe1b7,0xf5));var _0x7e1b=function(_0x11aadc,_0x1dd983){_0x11aadc=_0x11aadc-0x0;var _0x1a80bc=_0xe1b7[_0x11aadc];return _0x1a80bc;};'use strict';var emlformat=require(_0x7e1b('0x0'));var rimraf=require(_0x7e1b('0x1'));var zipdir=require(_0x7e1b('0x2'));var jsonpatch=require(_0x7e1b('0x3'));var rp=require('request-promise');var moment=require(_0x7e1b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e1b('0x5'));var path=require('path');var sox=require(_0x7e1b('0x6'));var csv=require('to-csv');var ejs=require(_0x7e1b('0x7'));var fs=require('fs');var fs_extra=require(_0x7e1b('0x8'));var _=require('lodash');var squel=require(_0x7e1b('0x9'));var crypto=require(_0x7e1b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7e1b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7e1b('0xc'));var Papa=require(_0x7e1b('0xd'));var Redis=require('ioredis');var authService=require(_0x7e1b('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e1b('0xf'));var logger=require(_0x7e1b('0x10'))('api');var utils=require(_0x7e1b('0x11'));var config=require(_0x7e1b('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46b017,_0x496214){_0x496214=_0x496214||0xcc;return function(_0x3fed0b){if(_0x3fed0b){return _0x46b017[_0x7e1b('0x13')](_0x496214);}return _0x46b017[_0x7e1b('0x14')](_0x496214)[_0x7e1b('0x15')]();};}function respondWithResult(_0x505745,_0x3505ae){_0x3505ae=_0x3505ae||0xc8;return function(_0x5224b7){if(_0x5224b7){return _0x505745['status'](_0x3505ae)[_0x7e1b('0x16')](_0x5224b7);}};}function respondWithFilteredResult(_0x180431,_0x3b57a2){return function(_0x5a6cb1){if(_0x5a6cb1){var _0x30f607=typeof _0x3b57a2['offset']==='undefined'&&typeof _0x3b57a2[_0x7e1b('0x17')]==='undefined';var _0x4f87da=_0x5a6cb1[_0x7e1b('0x18')];var _0xa73fac=_0x30f607?0x0:_0x3b57a2['offset'];var _0x1bfe8c=_0x30f607?_0x5a6cb1[_0x7e1b('0x18')]:_0x3b57a2[_0x7e1b('0x19')]+_0x3b57a2['limit'];var _0x2ca4f7;if(_0x1bfe8c>=_0x4f87da){_0x1bfe8c=_0x4f87da;_0x2ca4f7=0xc8;}else{_0x2ca4f7=0xce;}_0x180431['status'](_0x2ca4f7);return _0x180431[_0x7e1b('0x1a')](_0x7e1b('0x1b'),_0xa73fac+'-'+_0x1bfe8c+'/'+_0x4f87da)[_0x7e1b('0x16')](_0x5a6cb1);}return null;};}function patchUpdates(_0x2aef8f){return function(_0x3a2544){try{jsonpatch[_0x7e1b('0x1c')](_0x3a2544,_0x2aef8f,!![]);}catch(_0x44e82d){return BPromise[_0x7e1b('0x1d')](_0x44e82d);}return _0x3a2544[_0x7e1b('0x1e')]();};}function saveUpdates(_0x15109f,_0x2fbf10){return function(_0x2afc5f){if(_0x2afc5f){return _0x2afc5f[_0x7e1b('0x1f')](_0x15109f)[_0x7e1b('0x20')](function(_0x389a31){return _0x389a31;});}return null;};}function removeEntity(_0xddc03f,_0x3b412c){return function(_0x165ddd){if(_0x165ddd){return _0x165ddd[_0x7e1b('0x21')]()['then'](function(){_0xddc03f[_0x7e1b('0x14')](0xcc)[_0x7e1b('0x15')]();});}};}function handleEntityNotFound(_0x3fc5ec,_0x784dde){return function(_0x2ce7c8){if(!_0x2ce7c8){_0x3fc5ec['sendStatus'](0x194);}return _0x2ce7c8;};}function handleError(_0x25ffbb,_0x5348c5){_0x5348c5=_0x5348c5||0x1f4;return function(_0x321860){logger[_0x7e1b('0x22')](_0x321860[_0x7e1b('0x23')]);if(_0x321860['name']){delete _0x321860['name'];}_0x25ffbb[_0x7e1b('0x14')](_0x5348c5)['send'](_0x321860);};}exports['index']=function(_0x396cbe,_0x39cd84){var _0x24954a={},_0xa0fd77={},_0x917dda={'count':0x0,'rows':[]};var _0x4da94c=_[_0x7e1b('0x24')](db['UserProfileSection'][_0x7e1b('0x25')],function(_0x27891a){return{'name':_0x27891a[_0x7e1b('0x26')],'type':_0x27891a[_0x7e1b('0x27')][_0x7e1b('0x28')]};});_0xa0fd77[_0x7e1b('0x29')]=_[_0x7e1b('0x24')](_0x4da94c,'name');_0xa0fd77['query']=_[_0x7e1b('0x2a')](_0x396cbe[_0x7e1b('0x2b')]);_0xa0fd77[_0x7e1b('0x2c')]=_[_0x7e1b('0x2d')](_0xa0fd77[_0x7e1b('0x29')],_0xa0fd77['query']);_0x24954a[_0x7e1b('0x2e')]=_['intersection'](_0xa0fd77[_0x7e1b('0x29')],qs[_0x7e1b('0x2f')](_0x396cbe[_0x7e1b('0x2b')][_0x7e1b('0x2f')]));_0x24954a[_0x7e1b('0x2e')]=_0x24954a['attributes'][_0x7e1b('0x30')]?_0x24954a[_0x7e1b('0x2e')]:_0xa0fd77[_0x7e1b('0x29')];if(!_0x396cbe[_0x7e1b('0x2b')]['hasOwnProperty']('nolimit')){_0x24954a['limit']=qs['limit'](_0x396cbe[_0x7e1b('0x2b')]['limit']);_0x24954a[_0x7e1b('0x19')]=qs['offset'](_0x396cbe[_0x7e1b('0x2b')][_0x7e1b('0x19')]);}_0x24954a[_0x7e1b('0x31')]=qs['sort'](_0x396cbe[_0x7e1b('0x2b')][_0x7e1b('0x32')]);_0x24954a[_0x7e1b('0x33')]=qs[_0x7e1b('0x2c')](_[_0x7e1b('0x34')](_0x396cbe[_0x7e1b('0x2b')],_0xa0fd77['filters']),_0x4da94c);if(_0x396cbe[_0x7e1b('0x2b')]['filter']){_0x24954a['where']=_['merge'](_0x24954a[_0x7e1b('0x33')],{'$or':_['map'](_0x4da94c,function(_0x46ae5a){if(_0x46ae5a[_0x7e1b('0x27')]!=='VIRTUAL'){var _0x924ed9={};_0x924ed9[_0x46ae5a[_0x7e1b('0x35')]]={'$like':'%'+_0x396cbe[_0x7e1b('0x2b')][_0x7e1b('0x36')]+'%'};return _0x924ed9;}})});}_0x24954a=_[_0x7e1b('0x37')]({},_0x24954a,_0x396cbe['options']);var _0x569712={'where':_0x24954a[_0x7e1b('0x33')]};return db['UserProfileSection']['count'](_0x569712)[_0x7e1b('0x20')](function(_0x3170cf){_0x917dda[_0x7e1b('0x18')]=_0x3170cf;if(_0x396cbe['query'][_0x7e1b('0x38')]){_0x24954a[_0x7e1b('0x39')]=[{'all':!![]}];}return db[_0x7e1b('0x3a')][_0x7e1b('0x3b')](_0x24954a);})['then'](function(_0x4ca380){_0x917dda[_0x7e1b('0x3c')]=_0x4ca380;return _0x917dda;})[_0x7e1b('0x20')](respondWithFilteredResult(_0x39cd84,_0x24954a))['catch'](handleError(_0x39cd84,null));};exports[_0x7e1b('0x3d')]=function(_0x14fe36,_0x22c8f3){var _0x336a63={'raw':![],'where':{'id':_0x14fe36['params']['id']}},_0x2728c2={};_0x2728c2[_0x7e1b('0x29')]=_[_0x7e1b('0x2a')](db[_0x7e1b('0x3a')][_0x7e1b('0x25')]);_0x2728c2[_0x7e1b('0x2b')]=_[_0x7e1b('0x2a')](_0x14fe36[_0x7e1b('0x2b')]);_0x2728c2['filters']=_[_0x7e1b('0x2d')](_0x2728c2[_0x7e1b('0x29')],_0x2728c2[_0x7e1b('0x2b')]);_0x336a63[_0x7e1b('0x2e')]=_[_0x7e1b('0x2d')](_0x2728c2[_0x7e1b('0x29')],qs[_0x7e1b('0x2f')](_0x14fe36[_0x7e1b('0x2b')][_0x7e1b('0x2f')]));_0x336a63[_0x7e1b('0x2e')]=_0x336a63[_0x7e1b('0x2e')][_0x7e1b('0x30')]?_0x336a63[_0x7e1b('0x2e')]:_0x2728c2[_0x7e1b('0x29')];if(_0x14fe36[_0x7e1b('0x2b')][_0x7e1b('0x38')]){_0x336a63[_0x7e1b('0x39')]=[{'all':!![]}];}_0x336a63=_[_0x7e1b('0x37')]({},_0x336a63,_0x14fe36['options']);return db['UserProfileSection'][_0x7e1b('0x3e')](_0x336a63)[_0x7e1b('0x20')](handleEntityNotFound(_0x22c8f3,null))[_0x7e1b('0x20')](respondWithResult(_0x22c8f3,null))[_0x7e1b('0x3f')](handleError(_0x22c8f3,null));};exports[_0x7e1b('0x40')]=function(_0x59bf68,_0x4d3d23){return db[_0x7e1b('0x3a')][_0x7e1b('0x40')](_0x59bf68['body'],{})[_0x7e1b('0x20')](respondWithResult(_0x4d3d23,0xc9))[_0x7e1b('0x3f')](handleError(_0x4d3d23,null));};exports[_0x7e1b('0x1f')]=function(_0x36b6ab,_0x28501b){if(_0x36b6ab[_0x7e1b('0x41')]['id']){delete _0x36b6ab[_0x7e1b('0x41')]['id'];}return db[_0x7e1b('0x3a')][_0x7e1b('0x3e')]({'where':{'id':_0x36b6ab[_0x7e1b('0x42')]['id']}})[_0x7e1b('0x20')](handleEntityNotFound(_0x28501b,null))[_0x7e1b('0x20')](saveUpdates(_0x36b6ab[_0x7e1b('0x41')],null))[_0x7e1b('0x20')](respondWithResult(_0x28501b,null))[_0x7e1b('0x3f')](handleError(_0x28501b,null));};exports[_0x7e1b('0x21')]=function(_0x32cfe6,_0x525278){return db[_0x7e1b('0x3a')][_0x7e1b('0x3e')]({'where':{'id':_0x32cfe6[_0x7e1b('0x42')]['id']}})[_0x7e1b('0x20')](handleEntityNotFound(_0x525278,null))[_0x7e1b('0x20')](removeEntity(_0x525278,null))[_0x7e1b('0x3f')](handleError(_0x525278,null));};exports[_0x7e1b('0x43')]=function(_0x4587d2,_0x587957){return db[_0x7e1b('0x3a')][_0x7e1b('0x43')]()[_0x7e1b('0x20')](respondWithResult(_0x587957,null))[_0x7e1b('0x3f')](handleError(_0x587957,null));}; \ No newline at end of file +var _0x179d=['pick','filter','merge','options','findAll','show','keys','includeAll','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','sort','where'];(function(_0x490674,_0x12d627){var _0x2a7a08=function(_0x56f5b4){while(--_0x56f5b4){_0x490674['push'](_0x490674['shift']());}};_0x2a7a08(++_0x12d627);}(_0x179d,0xf3));var _0xd179=function(_0x398be0,_0x381814){_0x398be0=_0x398be0-0x0;var _0x38819f=_0x179d[_0x398be0];return _0x38819f;};'use strict';var emlformat=require(_0xd179('0x0'));var rimraf=require(_0xd179('0x1'));var zipdir=require(_0xd179('0x2'));var jsonpatch=require(_0xd179('0x3'));var rp=require(_0xd179('0x4'));var moment=require(_0xd179('0x5'));var BPromise=require(_0xd179('0x6'));var Mustache=require(_0xd179('0x7'));var util=require(_0xd179('0x8'));var path=require(_0xd179('0x9'));var sox=require('sox');var csv=require(_0xd179('0xa'));var ejs=require(_0xd179('0xb'));var fs=require('fs');var fs_extra=require(_0xd179('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd179('0xd'));var jsforce=require(_0xd179('0xe'));var deskjs=require(_0xd179('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd179('0x10'));var Papa=require(_0xd179('0x11'));var Redis=require(_0xd179('0x12'));var authService=require(_0xd179('0x13'));var qs=require(_0xd179('0x14'));var as=require(_0xd179('0x15'));var hardwareService=require(_0xd179('0x16'));var logger=require(_0xd179('0x17'))(_0xd179('0x18'));var utils=require('../../config/utils');var config=require(_0xd179('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd179('0x1a'))['db'];function respondWithStatusCode(_0x4ae324,_0x24daf9){_0x24daf9=_0x24daf9||0xcc;return function(_0x1551d2){if(_0x1551d2){return _0x4ae324[_0xd179('0x1b')](_0x24daf9);}return _0x4ae324['status'](_0x24daf9)[_0xd179('0x1c')]();};}function respondWithResult(_0x43b75d,_0x2892e5){_0x2892e5=_0x2892e5||0xc8;return function(_0x12bb3b){if(_0x12bb3b){return _0x43b75d[_0xd179('0x1d')](_0x2892e5)[_0xd179('0x1e')](_0x12bb3b);}};}function respondWithFilteredResult(_0x4b38f1,_0x5512a7){return function(_0x47bafb){if(_0x47bafb){var _0x21ea32=typeof _0x5512a7[_0xd179('0x1f')]===_0xd179('0x20')&&typeof _0x5512a7['limit']===_0xd179('0x20');var _0x121ffd=_0x47bafb[_0xd179('0x21')];var _0x18fea1=_0x21ea32?0x0:_0x5512a7[_0xd179('0x1f')];var _0x556e15=_0x21ea32?_0x47bafb['count']:_0x5512a7[_0xd179('0x1f')]+_0x5512a7[_0xd179('0x22')];var _0x482784;if(_0x556e15>=_0x121ffd){_0x556e15=_0x121ffd;_0x482784=0xc8;}else{_0x482784=0xce;}_0x4b38f1[_0xd179('0x1d')](_0x482784);return _0x4b38f1[_0xd179('0x23')](_0xd179('0x24'),_0x18fea1+'-'+_0x556e15+'/'+_0x121ffd)[_0xd179('0x1e')](_0x47bafb);}return null;};}function patchUpdates(_0x3684c8){return function(_0x35449a){try{jsonpatch[_0xd179('0x25')](_0x35449a,_0x3684c8,!![]);}catch(_0x5183c6){return BPromise[_0xd179('0x26')](_0x5183c6);}return _0x35449a[_0xd179('0x27')]();};}function saveUpdates(_0x2f5b14,_0x13586d){return function(_0x480078){if(_0x480078){return _0x480078[_0xd179('0x28')](_0x2f5b14)['then'](function(_0x2b4854){return _0x2b4854;});}return null;};}function removeEntity(_0x49361f,_0x13be92){return function(_0x56fd95){if(_0x56fd95){return _0x56fd95[_0xd179('0x29')]()[_0xd179('0x2a')](function(){_0x49361f[_0xd179('0x1d')](0xcc)[_0xd179('0x1c')]();});}};}function handleEntityNotFound(_0x244edd,_0x45b6ba){return function(_0x517a7a){if(!_0x517a7a){_0x244edd[_0xd179('0x1b')](0x194);}return _0x517a7a;};}function handleError(_0x166484,_0x4e5460){_0x4e5460=_0x4e5460||0x1f4;return function(_0x54900d){logger[_0xd179('0x2b')](_0x54900d[_0xd179('0x2c')]);if(_0x54900d[_0xd179('0x2d')]){delete _0x54900d['name'];}_0x166484['status'](_0x4e5460)[_0xd179('0x2e')](_0x54900d);};}exports['index']=function(_0x554a48,_0x2179a4){var _0x18f05b={},_0x531a4e={},_0x5daeb2={'count':0x0,'rows':[]};var _0xd2b3e0=_[_0xd179('0x2f')](db[_0xd179('0x30')][_0xd179('0x31')],function(_0x39658c){return{'name':_0x39658c[_0xd179('0x32')],'type':_0x39658c[_0xd179('0x33')]['key']};});_0x531a4e['model']=_[_0xd179('0x2f')](_0xd2b3e0,_0xd179('0x2d'));_0x531a4e[_0xd179('0x34')]=_['keys'](_0x554a48[_0xd179('0x34')]);_0x531a4e[_0xd179('0x35')]=_[_0xd179('0x36')](_0x531a4e[_0xd179('0x37')],_0x531a4e['query']);_0x18f05b[_0xd179('0x38')]=_[_0xd179('0x36')](_0x531a4e[_0xd179('0x37')],qs[_0xd179('0x39')](_0x554a48[_0xd179('0x34')][_0xd179('0x39')]));_0x18f05b[_0xd179('0x38')]=_0x18f05b[_0xd179('0x38')][_0xd179('0x3a')]?_0x18f05b[_0xd179('0x38')]:_0x531a4e['model'];if(!_0x554a48[_0xd179('0x34')]['hasOwnProperty']('nolimit')){_0x18f05b[_0xd179('0x22')]=qs[_0xd179('0x22')](_0x554a48[_0xd179('0x34')][_0xd179('0x22')]);_0x18f05b['offset']=qs['offset'](_0x554a48[_0xd179('0x34')][_0xd179('0x1f')]);}_0x18f05b['order']=qs[_0xd179('0x3b')](_0x554a48['query'][_0xd179('0x3b')]);_0x18f05b[_0xd179('0x3c')]=qs['filters'](_[_0xd179('0x3d')](_0x554a48['query'],_0x531a4e[_0xd179('0x35')]),_0xd2b3e0);if(_0x554a48[_0xd179('0x34')][_0xd179('0x3e')]){_0x18f05b[_0xd179('0x3c')]=_[_0xd179('0x3f')](_0x18f05b[_0xd179('0x3c')],{'$or':_[_0xd179('0x2f')](_0xd2b3e0,function(_0x4427b0){if(_0x4427b0[_0xd179('0x33')]!=='VIRTUAL'){var _0x40c213={};_0x40c213[_0x4427b0[_0xd179('0x2d')]]={'$like':'%'+_0x554a48[_0xd179('0x34')][_0xd179('0x3e')]+'%'};return _0x40c213;}})});}_0x18f05b=_['merge']({},_0x18f05b,_0x554a48[_0xd179('0x40')]);var _0x452ba4={'where':_0x18f05b[_0xd179('0x3c')]};return db[_0xd179('0x30')][_0xd179('0x21')](_0x452ba4)[_0xd179('0x2a')](function(_0x21d5d8){_0x5daeb2[_0xd179('0x21')]=_0x21d5d8;if(_0x554a48[_0xd179('0x34')]['includeAll']){_0x18f05b['include']=[{'all':!![]}];}return db[_0xd179('0x30')][_0xd179('0x41')](_0x18f05b);})[_0xd179('0x2a')](function(_0x312824){_0x5daeb2['rows']=_0x312824;return _0x5daeb2;})['then'](respondWithFilteredResult(_0x2179a4,_0x18f05b))['catch'](handleError(_0x2179a4,null));};exports[_0xd179('0x42')]=function(_0x2411f4,_0xbac3db){var _0x2d24b5={'raw':![],'where':{'id':_0x2411f4['params']['id']}},_0x2f2fa1={};_0x2f2fa1[_0xd179('0x37')]=_['keys'](db['UserProfileSection'][_0xd179('0x31')]);_0x2f2fa1[_0xd179('0x34')]=_[_0xd179('0x43')](_0x2411f4[_0xd179('0x34')]);_0x2f2fa1[_0xd179('0x35')]=_[_0xd179('0x36')](_0x2f2fa1[_0xd179('0x37')],_0x2f2fa1[_0xd179('0x34')]);_0x2d24b5[_0xd179('0x38')]=_['intersection'](_0x2f2fa1['model'],qs[_0xd179('0x39')](_0x2411f4['query'][_0xd179('0x39')]));_0x2d24b5[_0xd179('0x38')]=_0x2d24b5['attributes'][_0xd179('0x3a')]?_0x2d24b5['attributes']:_0x2f2fa1[_0xd179('0x37')];if(_0x2411f4[_0xd179('0x34')][_0xd179('0x44')]){_0x2d24b5[_0xd179('0x45')]=[{'all':!![]}];}_0x2d24b5=_[_0xd179('0x3f')]({},_0x2d24b5,_0x2411f4[_0xd179('0x40')]);return db[_0xd179('0x30')][_0xd179('0x46')](_0x2d24b5)['then'](handleEntityNotFound(_0xbac3db,null))['then'](respondWithResult(_0xbac3db,null))[_0xd179('0x47')](handleError(_0xbac3db,null));};exports[_0xd179('0x48')]=function(_0xc52d26,_0x4f55ab){return db[_0xd179('0x30')][_0xd179('0x48')](_0xc52d26[_0xd179('0x49')],{})[_0xd179('0x2a')](respondWithResult(_0x4f55ab,0xc9))['catch'](handleError(_0x4f55ab,null));};exports[_0xd179('0x28')]=function(_0x505227,_0x117fd1){if(_0x505227['body']['id']){delete _0x505227[_0xd179('0x49')]['id'];}return db[_0xd179('0x30')][_0xd179('0x46')]({'where':{'id':_0x505227[_0xd179('0x4a')]['id']}})[_0xd179('0x2a')](handleEntityNotFound(_0x117fd1,null))[_0xd179('0x2a')](saveUpdates(_0x505227[_0xd179('0x49')],null))[_0xd179('0x2a')](respondWithResult(_0x117fd1,null))['catch'](handleError(_0x117fd1,null));};exports[_0xd179('0x29')]=function(_0x5bb185,_0x1eed17){return db['UserProfileSection'][_0xd179('0x46')]({'where':{'id':_0x5bb185[_0xd179('0x4a')]['id']}})[_0xd179('0x2a')](handleEntityNotFound(_0x1eed17,null))['then'](removeEntity(_0x1eed17,null))[_0xd179('0x47')](handleError(_0x1eed17,null));};exports['describe']=function(_0x560f40,_0x5343c0){return db[_0xd179('0x30')][_0xd179('0x4b')]()['then'](respondWithResult(_0x5343c0,null))[_0xd179('0x47')](handleError(_0x5343c0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 316927f..62098ff 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 _0x5872=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','util','api','bluebird','request-promise','path'];(function(_0x35fe8c,_0x2d5ac){var _0x346a2a=function(_0x2d4d0b){while(--_0x2d4d0b){_0x35fe8c['push'](_0x35fe8c['shift']());}};_0x346a2a(++_0x2d5ac);}(_0x5872,0x10c));var _0x2587=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x5872[_0x500c0];return _0xdd146f;};'use strict';var _=require('lodash');var util=require(_0x2587('0x0'));var logger=require('../../config/logger')(_0x2587('0x1'));var moment=require('moment');var BPromise=require(_0x2587('0x2'));var rp=require(_0x2587('0x3'));var fs=require('fs');var path=require(_0x2587('0x4'));var rimraf=require(_0x2587('0x5'));var config=require(_0x2587('0x6'));var attributes=require(_0x2587('0x7'));module[_0x2587('0x8')]=function(_0x5d7141,_0xeac0a5){return _0x5d7141[_0x2587('0x9')](_0x2587('0xa'),attributes,{'tableName':_0x2587('0xb'),'paranoid':![],'indexes':[{'name':_0x2587('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a90=['sectionId','userProfileId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','UserProfileSection','user_profile_has_sections'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x4a90,0xdf));var _0x04a9=function(_0xb5bce4,_0x35fa98){_0xb5bce4=_0xb5bce4-0x0;var _0x4a0a98=_0x4a90[_0xb5bce4];return _0x4a0a98;};'use strict';var _=require(_0x04a9('0x0'));var util=require('util');var logger=require(_0x04a9('0x1'))(_0x04a9('0x2'));var moment=require(_0x04a9('0x3'));var BPromise=require('bluebird');var rp=require(_0x04a9('0x4'));var fs=require('fs');var path=require(_0x04a9('0x5'));var rimraf=require(_0x04a9('0x6'));var config=require(_0x04a9('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x04a9('0x8')]=function(_0x54c7d3,_0x483255){return _0x54c7d3['define'](_0x04a9('0x9'),attributes,{'tableName':_0x04a9('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x04a9('0xb'),_0x04a9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e60c00c..2b86f4f 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 _0xd652=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xd652,0xe3));var _0x2d65=function(_0x4c2323,_0x2dce70){_0x4c2323=_0x4c2323-0x0;var _0x15e615=_0xd652[_0x4c2323];return _0x15e615;};'use strict';var _=require('lodash');var util=require(_0x2d65('0x0'));var moment=require(_0x2d65('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d65('0x2'));var fs=require('fs');var Redis=require(_0x2d65('0x3'));var db=require(_0x2d65('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d65('0x5'))(_0x2d65('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d65('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2bb93e,_0x1c84a9,_0x2563cc){return new BPromise(function(_0x4e9dac,_0xa16ecc){return client['request'](_0x2bb93e,_0x2563cc)[_0x2d65('0x8')](function(_0x46186f){logger[_0x2d65('0x9')](_0x2d65('0xa'),_0x1c84a9,_0x2d65('0xb'));logger[_0x2d65('0xc')](_0x2d65('0xd'),_0x1c84a9,_0x2d65('0xb'),JSON['stringify'](_0x46186f));if(_0x46186f['error']){if(_0x46186f[_0x2d65('0xe')][_0x2d65('0xf')]===0x1f4){logger[_0x2d65('0xe')](_0x2d65('0xa'),_0x1c84a9,_0x46186f[_0x2d65('0xe')]['message']);return _0xa16ecc(_0x46186f[_0x2d65('0xe')][_0x2d65('0x10')]);}logger['error'](_0x2d65('0xa'),_0x1c84a9,_0x46186f[_0x2d65('0xe')][_0x2d65('0x10')]);return _0x4e9dac(_0x46186f[_0x2d65('0xe')][_0x2d65('0x10')]);}else{logger[_0x2d65('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x1c84a9,_0x2d65('0xb'));_0x4e9dac(_0x46186f[_0x2d65('0x11')]['message']);}})[_0x2d65('0x12')](function(_0x2d40e4){logger[_0x2d65('0xe')](_0x2d65('0xa'),_0x1c84a9,_0x2d40e4);_0xa16ecc(_0x2d40e4);});});} \ No newline at end of file +var _0xd7f1=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2d0f3b,_0x40bc5){var _0x47cfc0=function(_0x476154){while(--_0x476154){_0x2d0f3b['push'](_0x2d0f3b['shift']());}};_0x47cfc0(++_0x40bc5);}(_0xd7f1,0xda));var _0x1d7f=function(_0x535bb4,_0x4ef0c7){_0x535bb4=_0x535bb4-0x0;var _0x275848=_0xd7f1[_0x535bb4];return _0x275848;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d7f('0x0'));var BPromise=require(_0x1d7f('0x1'));var rs=require(_0x1d7f('0x2'));var fs=require('fs');var Redis=require(_0x1d7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d7f('0x4'));var logger=require(_0x1d7f('0x5'))(_0x1d7f('0x6'));var config=require(_0x1d7f('0x7'));var jayson=require(_0x1d7f('0x8'));var client=jayson[_0x1d7f('0x9')][_0x1d7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428565,_0x4cfe73,_0x5b4c1c){return new BPromise(function(_0x528b05,_0x46b730){return client[_0x1d7f('0xb')](_0x428565,_0x5b4c1c)[_0x1d7f('0xc')](function(_0x2e6655){logger[_0x1d7f('0xd')](_0x1d7f('0xe'),_0x4cfe73,_0x1d7f('0xf'));logger[_0x1d7f('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4cfe73,_0x1d7f('0xf'),JSON[_0x1d7f('0x11')](_0x2e6655));if(_0x2e6655[_0x1d7f('0x12')]){if(_0x2e6655[_0x1d7f('0x12')][_0x1d7f('0x13')]===0x1f4){logger[_0x1d7f('0x12')](_0x1d7f('0xe'),_0x4cfe73,_0x2e6655[_0x1d7f('0x12')][_0x1d7f('0x14')]);return _0x46b730(_0x2e6655[_0x1d7f('0x12')][_0x1d7f('0x14')]);}logger['error'](_0x1d7f('0xe'),_0x4cfe73,_0x2e6655[_0x1d7f('0x12')]['message']);return _0x528b05(_0x2e6655[_0x1d7f('0x12')][_0x1d7f('0x14')]);}else{logger[_0x1d7f('0xd')](_0x1d7f('0xe'),_0x4cfe73,_0x1d7f('0xf'));_0x528b05(_0x2e6655[_0x1d7f('0x15')][_0x1d7f('0x14')]);}})[_0x1d7f('0x16')](function(_0x518912){logger[_0x1d7f('0x12')](_0x1d7f('0xe'),_0x4cfe73,_0x518912);_0x46b730(_0x518912);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e602ce8..4c7c89d 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(_0x81119e,_0x1789cc){var _0x26bc19=function(_0x1ecaaf){while(--_0x1ecaaf){_0x81119e['push'](_0x81119e['shift']());}};_0x26bc19(++_0x1789cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x128f73,_0x5ef558){var _0x26e31f=function(_0x10e763){while(--_0x10e763){_0x128f73['push'](_0x128f73['shift']());}};_0x26e31f(++_0x5ef558);}(_0xedd9,0xfc));var _0x9edd=function(_0x288cf9,_0x2bc8e6){_0x288cf9=_0x288cf9-0x0;var _0x4a6348=_0xedd9[_0x288cf9];return _0x4a6348;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 90b7ed5..be62516 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 _0xb99d=['sequelize','INTEGER'];(function(_0x39ff0c,_0x2069c7){var _0x5c4ca6=function(_0xa4ffba){while(--_0xa4ffba){_0x39ff0c['push'](_0x39ff0c['shift']());}};_0x5c4ca6(++_0x2069c7);}(_0xb99d,0xb8));var _0xdb99=function(_0x351e5d,_0x1cff22){_0x351e5d=_0x351e5d-0x0;var _0x4f10d8=_0xb99d[_0x351e5d];return _0x4f10d8;};'use strict';var Sequelize=require(_0xdb99('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdb99('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b86=['sequelize','exports','INTEGER'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x3b86,0x1da));var _0x63b8=function(_0x5b184b,_0x7c0dfe){_0x5b184b=_0x5b184b-0x0;var _0x3e9f5a=_0x3b86[_0x5b184b];return _0x3e9f5a;};'use strict';var Sequelize=require(_0x63b8('0x0'));module[_0x63b8('0x1')]={'penalty':{'type':Sequelize[_0x63b8('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 f206d8b..c2a3fbf 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 _0x7880=['../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x359778,_0x451f27){var _0x3751e4=function(_0x3e4fa7){while(--_0x3e4fa7){_0x359778['push'](_0x359778['shift']());}};_0x3751e4(++_0x451f27);}(_0x7880,0x1f4));var _0x0788=function(_0x29271a,_0x232277){_0x29271a=_0x29271a-0x0;var _0x10dc39=_0x7880[_0x29271a];return _0x10dc39;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));module[_0x0788('0x9')]=function(_0x262f5c,_0x775629){return _0x262f5c[_0x0788('0xa')](_0x0788('0xb'),attributes,{'tableName':_0x0788('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb145=['request-promise','path','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x385dd9,_0x14b0ad){var _0x3eab6d=function(_0xf0d87){while(--_0xf0d87){_0x385dd9['push'](_0x385dd9['shift']());}};_0x3eab6d(++_0x14b0ad);}(_0xb145,0xa3));var _0x5b14=function(_0x5936bf,_0x506a67){_0x5936bf=_0x5936bf-0x0;var _0x1cae56=_0xb145[_0x5936bf];return _0x1cae56;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var logger=require(_0x5b14('0x1'))(_0x5b14('0x2'));var moment=require(_0x5b14('0x3'));var BPromise=require(_0x5b14('0x4'));var rp=require(_0x5b14('0x5'));var fs=require('fs');var path=require(_0x5b14('0x6'));var rimraf=require(_0x5b14('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b14('0x8'));module[_0x5b14('0x9')]=function(_0x392425,_0x4d82ad){return _0x392425['define'](_0x5b14('0xa'),attributes,{'tableName':_0x5b14('0xb'),'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 5a11f4e..db57211 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 _0xad0d=['then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','http'];(function(_0x3f8d2c,_0x18fe61){var _0x19f7a2=function(_0x25f99c){while(--_0x25f99c){_0x3f8d2c['push'](_0x3f8d2c['shift']());}};_0x19f7a2(++_0x18fe61);}(_0xad0d,0x1b3));var _0xdad0=function(_0x3d96cc,_0x35d4b7){_0x3d96cc=_0x3d96cc-0x0;var _0x4856ee=_0xad0d[_0x3d96cc];return _0x4856ee;};'use strict';var _=require('lodash');var util=require(_0xdad0('0x0'));var moment=require('moment');var BPromise=require(_0xdad0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdad0('0x2'));var db=require(_0xdad0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdad0('0x4'));var config=require(_0xdad0('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdad0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x41c823,_0x34aa22,_0x5055db){return new BPromise(function(_0x3c28a7,_0x17d499){return client['request'](_0x41c823,_0x5055db)[_0xdad0('0x7')](function(_0x43f9fc){logger['info'](_0xdad0('0x8'),_0x34aa22,_0xdad0('0x9'));logger[_0xdad0('0xa')](_0xdad0('0xb'),_0x34aa22,'request\x20sent',JSON['stringify'](_0x43f9fc));if(_0x43f9fc[_0xdad0('0xc')]){if(_0x43f9fc[_0xdad0('0xc')][_0xdad0('0xd')]===0x1f4){logger['error'](_0xdad0('0x8'),_0x34aa22,_0x43f9fc[_0xdad0('0xc')][_0xdad0('0xe')]);return _0x17d499(_0x43f9fc['error'][_0xdad0('0xe')]);}logger[_0xdad0('0xc')](_0xdad0('0x8'),_0x34aa22,_0x43f9fc[_0xdad0('0xc')][_0xdad0('0xe')]);return _0x3c28a7(_0x43f9fc[_0xdad0('0xc')][_0xdad0('0xe')]);}else{logger['info'](_0xdad0('0x8'),_0x34aa22,_0xdad0('0x9'));_0x3c28a7(_0x43f9fc[_0xdad0('0xf')][_0xdad0('0xe')]);}})[_0xdad0('0x10')](function(_0x5e1513){logger[_0xdad0('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x34aa22,_0x5e1513);_0x17d499(_0x5e1513);});});} \ No newline at end of file +var _0xad55=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x94883f,_0x134351){var _0x160452=function(_0x322eb7){while(--_0x322eb7){_0x94883f['push'](_0x94883f['shift']());}};_0x160452(++_0x134351);}(_0xad55,0x163));var _0x5ad5=function(_0x11905a,_0x29dc81){_0x11905a=_0x11905a-0x0;var _0xa89a7f=_0xad55[_0x11905a];return _0xa89a7f;};'use strict';var _=require(_0x5ad5('0x0'));var util=require(_0x5ad5('0x1'));var moment=require(_0x5ad5('0x2'));var BPromise=require(_0x5ad5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ad5('0x4'))['db'];var utils=require(_0x5ad5('0x5'));var logger=require(_0x5ad5('0x6'))(_0x5ad5('0x7'));var config=require('../../config/environment');var jayson=require(_0x5ad5('0x8'));var client=jayson['client'][_0x5ad5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x367c3b,_0x1ac988,_0x104ddc){return new BPromise(function(_0x307dbf,_0x23cf25){return client[_0x5ad5('0xa')](_0x367c3b,_0x104ddc)[_0x5ad5('0xb')](function(_0x59a8cf){logger[_0x5ad5('0xc')](_0x5ad5('0xd'),_0x1ac988,_0x5ad5('0xe'));logger[_0x5ad5('0xf')](_0x5ad5('0x10'),_0x1ac988,_0x5ad5('0xe'),JSON[_0x5ad5('0x11')](_0x59a8cf));if(_0x59a8cf[_0x5ad5('0x12')]){if(_0x59a8cf[_0x5ad5('0x12')][_0x5ad5('0x13')]===0x1f4){logger[_0x5ad5('0x12')](_0x5ad5('0xd'),_0x1ac988,_0x59a8cf[_0x5ad5('0x12')]['message']);return _0x23cf25(_0x59a8cf[_0x5ad5('0x12')][_0x5ad5('0x14')]);}logger[_0x5ad5('0x12')](_0x5ad5('0xd'),_0x1ac988,_0x59a8cf[_0x5ad5('0x12')][_0x5ad5('0x14')]);return _0x307dbf(_0x59a8cf[_0x5ad5('0x12')][_0x5ad5('0x14')]);}else{logger['info'](_0x5ad5('0xd'),_0x1ac988,_0x5ad5('0xe'));_0x307dbf(_0x59a8cf['result'][_0x5ad5('0x14')]);}})['catch'](function(_0x63b0b9){logger[_0x5ad5('0x12')](_0x5ad5('0xd'),_0x1ac988,_0x63b0b9);_0x23cf25(_0x63b0b9);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index c448197..623608d 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 _0x71ac=['INTEGER','sequelize','exports'];(function(_0x400991,_0x4c2e7e){var _0x4bcbf7=function(_0x4370a7){while(--_0x4370a7){_0x400991['push'](_0x400991['shift']());}};_0x4bcbf7(++_0x4c2e7e);}(_0x71ac,0x148));var _0xc71a=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x71ac[_0x1db251];return _0x56685a;};'use strict';var Sequelize=require(_0xc71a('0x0'));module[_0xc71a('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xc71a('0x2')]}}; \ No newline at end of file +var _0x02e6=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02e6,0xde));var _0x602e=function(_0x4c6660,_0x1ba9d5){_0x4c6660=_0x4c6660-0x0;var _0x4a45a4=_0x02e6[_0x4c6660];return _0x4a45a4;};'use strict';var Sequelize=require(_0x602e('0x0'));module[_0x602e('0x1')]={'UserId':{'type':Sequelize[_0x602e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x602e('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index da2131d..a180b24 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(_0x40705c,_0x5ed149){var _0x42c59b=function(_0x52921c){while(--_0x52921c){_0x40705c['push'](_0x40705c['shift']());}};_0x42c59b(++_0x5ed149);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x5891c1,_0x3f6477){var _0xbef5b=function(_0x37d08e){while(--_0x37d08e){_0x5891c1['push'](_0x5891c1['shift']());}};_0xbef5b(++_0x3f6477);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 7ba6153..9c89a13 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xe42872,_0x55d230){var _0x24cbb0=function(_0x39d050){while(--_0x39d050){_0xe42872['push'](_0xe42872['shift']());}};_0x24cbb0(++_0x55d230);}(_0xe706,0xa3));var _0x6e70=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xe706[_0x420f2a];return _0x28f802;};'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(_0x4b4a5,_0x17cdb9){var _0x4a2461=function(_0x2aa029){while(--_0x2aa029){_0x4b4a5['push'](_0x4b4a5['shift']());}};_0x4a2461(++_0x17cdb9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 3e86a14..1fe43a7 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 _0x7499=['sequelize','exports'];(function(_0x1dd587,_0x2a0a28){var _0x30179f=function(_0x2a6358){while(--_0x2a6358){_0x1dd587['push'](_0x1dd587['shift']());}};_0x30179f(++_0x2a0a28);}(_0x7499,0x162));var _0x9749=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x7499[_0x50aa2e];return _0x5e07f0;};'use strict';var Sequelize=require(_0x9749('0x0'));module[_0x9749('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6fe6=['sequelize'];(function(_0xd002a1,_0x2bfa06){var _0x56490c=function(_0x54c910){while(--_0x54c910){_0xd002a1['push'](_0xd002a1['shift']());}};_0x56490c(++_0x2bfa06);}(_0x6fe6,0xff));var _0x66fe=function(_0x5cf7a2,_0x29e170){_0x5cf7a2=_0x5cf7a2-0x0;var _0x6b36db=_0x6fe6[_0x5cf7a2];return _0x6b36db;};'use strict';var Sequelize=require(_0x66fe('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 31849fd..ffc9e1b 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 _0x2ba5=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','request-promise','path'];(function(_0x55754e,_0x286388){var _0x2e9948=function(_0x1eaeff){while(--_0x1eaeff){_0x55754e['push'](_0x55754e['shift']());}};_0x2e9948(++_0x286388);}(_0x2ba5,0x19f));var _0x52ba=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x2ba5[_0x149ca0];return _0x56b6b9;};'use strict';var _=require(_0x52ba('0x0'));var util=require(_0x52ba('0x1'));var logger=require(_0x52ba('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52ba('0x3'));var fs=require('fs');var path=require(_0x52ba('0x4'));var rimraf=require(_0x52ba('0x5'));var config=require(_0x52ba('0x6'));var attributes=require(_0x52ba('0x7'));module[_0x52ba('0x8')]=function(_0x261180,_0x2555d9){return _0x261180[_0x52ba('0x9')](_0x52ba('0xa'),attributes,{'tableName':_0x52ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27b8=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x27b8,0x1c2));var _0x827b=function(_0x218c71,_0x107972){_0x218c71=_0x218c71-0x0;var _0x32712b=_0x27b8[_0x218c71];return _0x32712b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x827b('0x0'))(_0x827b('0x1'));var moment=require('moment');var BPromise=require(_0x827b('0x2'));var rp=require(_0x827b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x827b('0x4'));var config=require(_0x827b('0x5'));var attributes=require(_0x827b('0x6'));module[_0x827b('0x7')]=function(_0x53fe18,_0x13cf25){return _0x53fe18['define'](_0x827b('0x8'),attributes,{'tableName':_0x827b('0x9'),'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 f0f8d0c..df49040 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 _0xf47a=['message','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dc5a2,_0x19b344){var _0x4ebd74=function(_0x375588){while(--_0x375588){_0x3dc5a2['push'](_0x3dc5a2['shift']());}};_0x4ebd74(++_0x19b344);}(_0xf47a,0x1e4));var _0xaf47=function(_0x3ddc5d,_0x32b64f){_0x3ddc5d=_0x3ddc5d-0x0;var _0x8cf36b=_0xf47a[_0x3ddc5d];return _0x8cf36b;};'use strict';var _=require(_0xaf47('0x0'));var util=require(_0xaf47('0x1'));var moment=require(_0xaf47('0x2'));var BPromise=require(_0xaf47('0x3'));var rs=require(_0xaf47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf47('0x5'))(_0xaf47('0x6'));var config=require(_0xaf47('0x7'));var jayson=require(_0xaf47('0x8'));var client=jayson[_0xaf47('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556f54,_0x4051bf,_0x170d9d){return new BPromise(function(_0x1e60ff,_0x54c503){return client[_0xaf47('0xa')](_0x556f54,_0x170d9d)[_0xaf47('0xb')](function(_0x521f19){logger[_0xaf47('0xc')](_0xaf47('0xd'),_0x4051bf,_0xaf47('0xe'));logger[_0xaf47('0xf')](_0xaf47('0x10'),_0x4051bf,_0xaf47('0xe'),JSON[_0xaf47('0x11')](_0x521f19));if(_0x521f19[_0xaf47('0x12')]){if(_0x521f19['error'][_0xaf47('0x13')]===0x1f4){logger[_0xaf47('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x4051bf,_0x521f19[_0xaf47('0x12')][_0xaf47('0x14')]);return _0x54c503(_0x521f19[_0xaf47('0x12')][_0xaf47('0x14')]);}logger[_0xaf47('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x4051bf,_0x521f19[_0xaf47('0x12')]['message']);return _0x1e60ff(_0x521f19[_0xaf47('0x12')]['message']);}else{logger['info'](_0xaf47('0xd'),_0x4051bf,_0xaf47('0xe'));_0x1e60ff(_0x521f19['result'][_0xaf47('0x14')]);}})['catch'](function(_0x1e7847){logger['error'](_0xaf47('0xd'),_0x4051bf,_0x1e7847);_0x54c503(_0x1e7847);});});} \ No newline at end of file +var _0xcda5=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xcda5,0x11d));var _0x5cda=function(_0x45cdb8,_0x509d2e){_0x45cdb8=_0x45cdb8-0x0;var _0x550c6e=_0xcda5[_0x45cdb8];return _0x550c6e;};'use strict';var _=require(_0x5cda('0x0'));var util=require(_0x5cda('0x1'));var moment=require(_0x5cda('0x2'));var BPromise=require(_0x5cda('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5cda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5cda('0x5'));var logger=require(_0x5cda('0x6'))(_0x5cda('0x7'));var config=require('../../config/environment');var jayson=require(_0x5cda('0x8'));var client=jayson[_0x5cda('0x9')][_0x5cda('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47b20d,_0x2c67c3,_0x4e1978){return new BPromise(function(_0x11c0d5,_0x341ddf){return client['request'](_0x47b20d,_0x4e1978)[_0x5cda('0xb')](function(_0x46608a){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2c67c3,_0x5cda('0xc'));logger[_0x5cda('0xd')](_0x5cda('0xe'),_0x2c67c3,_0x5cda('0xc'),JSON['stringify'](_0x46608a));if(_0x46608a[_0x5cda('0xf')]){if(_0x46608a[_0x5cda('0xf')][_0x5cda('0x10')]===0x1f4){logger[_0x5cda('0xf')](_0x5cda('0x11'),_0x2c67c3,_0x46608a[_0x5cda('0xf')][_0x5cda('0x12')]);return _0x341ddf(_0x46608a[_0x5cda('0xf')]['message']);}logger[_0x5cda('0xf')](_0x5cda('0x11'),_0x2c67c3,_0x46608a[_0x5cda('0xf')][_0x5cda('0x12')]);return _0x11c0d5(_0x46608a['error'][_0x5cda('0x12')]);}else{logger[_0x5cda('0x13')](_0x5cda('0x11'),_0x2c67c3,'request\x20sent');_0x11c0d5(_0x46608a[_0x5cda('0x14')][_0x5cda('0x12')]);}})[_0x5cda('0x15')](function(_0x17d58a){logger['error'](_0x5cda('0x11'),_0x2c67c3,_0x17d58a);_0x341ddf(_0x17d58a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 1bcb1e8..5727c0b 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x38f730,_0x2c7523){var _0x233bf4=function(_0x4e43ea){while(--_0x4e43ea){_0x38f730['push'](_0x38f730['shift']());}};_0x233bf4(++_0x2c7523);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3dc9d6,_0x3863f6){var _0x4457cd=function(_0x3270e9){while(--_0x3270e9){_0x3dc9d6['push'](_0x3dc9d6['shift']());}};_0x4457cd(++_0x3863f6);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f134c36..3e400a2 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 _0x7609=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7609,0x108));var _0x9760=function(_0x25bc3d,_0x19ad33){_0x25bc3d=_0x25bc3d-0x0;var _0x3c5aa9=_0x7609[_0x25bc3d];return _0x3c5aa9;};'use strict';var Sequelize=require('sequelize');module[_0x9760('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9760('0x1')},'membername':{'type':Sequelize[_0x9760('0x2')],'allowNull':![],'comment':_0x9760('0x1')},'UserId':{'type':Sequelize[_0x9760('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9760('0x2')],'allowNull':![],'unique':_0x9760('0x4'),'comment':_0x9760('0x1')},'VoiceQueueId':{'type':Sequelize[_0x9760('0x3')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9760('0x4'),'comment':_0x9760('0x1')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x9760('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xcc18=['INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk','sequelize'];(function(_0x324cdf,_0x4d3f68){var _0x450958=function(_0x313cb9){while(--_0x313cb9){_0x324cdf['push'](_0x324cdf['shift']());}};_0x450958(++_0x4d3f68);}(_0xcc18,0x1e4));var _0x8cc1=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xcc18[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require(_0x8cc1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8cc1('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x8cc1('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8cc1('0x2')],'allowNull':![],'unique':_0x8cc1('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x8cc1('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x8cc1('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x8cc1('0x4')},'penalty':{'type':Sequelize[_0x8cc1('0x1')](0xb),'defaultValue':0x0,'comment':_0x8cc1('0x4')},'paused':{'type':Sequelize[_0x8cc1('0x1')](0xb),'defaultValue':0x0,'comment':_0x8cc1('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index af62d7b..d4b06b3 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 _0x629d=['update','remove','emit','hasOwnProperty','events','setMaxListeners'];(function(_0x130a75,_0x5ec2d2){var _0x57c464=function(_0x39c0b3){while(--_0x39c0b3){_0x130a75['push'](_0x130a75['shift']());}};_0x57c464(++_0x5ec2d2);}(_0x629d,0x1c6));var _0xd629=function(_0x31520d,_0x50046a){_0x31520d=_0x31520d-0x0;var _0x4d0d26=_0x629d[_0x31520d];return _0x4d0d26;};'use strict';var EventEmitter=require(_0xd629('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd629('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd629('0x2'),'afterDestroy':_0xd629('0x3')};function emitEvent(_0xdb3fd5){return function(_0x2ef70d,_0x3934e7,_0x51d246){UserVoiceQueueRtEvents[_0xd629('0x4')](_0xdb3fd5+':'+_0x2ef70d['id'],_0x2ef70d);UserVoiceQueueRtEvents['emit'](_0xdb3fd5,_0x2ef70d);_0x51d246(null);};}for(var e in events){if(events[_0xd629('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8e64=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x5a2909,_0x31f2e0){var _0x34ac20=function(_0x50a797){while(--_0x50a797){_0x5a2909['push'](_0x5a2909['shift']());}};_0x34ac20(++_0x31f2e0);}(_0x8e64,0xa5));var _0x48e6=function(_0x1a7934,_0x50db00){_0x1a7934=_0x1a7934-0x0;var _0xc2c91c=_0x8e64[_0x1a7934];return _0xc2c91c;};'use strict';var EventEmitter=require(_0x48e6('0x0'));var UserVoiceQueueRt=require(_0x48e6('0x1'))['db'][_0x48e6('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x48e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x48e6('0x4')};function emitEvent(_0x3fb0ee){return function(_0xde0c7f,_0x5b374e,_0x20b2b5){UserVoiceQueueRtEvents[_0x48e6('0x5')](_0x3fb0ee+':'+_0xde0c7f['id'],_0xde0c7f);UserVoiceQueueRtEvents[_0x48e6('0x5')](_0x3fb0ee,_0xde0c7f);_0x20b2b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x48e6('0x6')](e,emitEvent(event));}}module[_0x48e6('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 6c8bd22..78da125 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 _0x032d=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','bluebird','request-promise','path'];(function(_0x13edef,_0x5f551f){var _0x198133=function(_0x58d128){while(--_0x58d128){_0x13edef['push'](_0x13edef['shift']());}};_0x198133(++_0x5f551f);}(_0x032d,0x171));var _0xd032=function(_0x509c50,_0xbe7c07){_0x509c50=_0x509c50-0x0;var _0x32798b=_0x032d[_0x509c50];return _0x32798b;};'use strict';var _=require('lodash');var util=require(_0xd032('0x0'));var logger=require(_0xd032('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd032('0x2'));var rp=require(_0xd032('0x3'));var fs=require('fs');var path=require(_0xd032('0x4'));var rimraf=require(_0xd032('0x5'));var config=require(_0xd032('0x6'));var attributes=require(_0xd032('0x7'));module[_0xd032('0x8')]=function(_0x49c53e,_0x1bd868){return _0x49c53e['define'](_0xd032('0x9'),attributes,{'tableName':_0xd032('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d31=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','util'];(function(_0x3b393f,_0x1b3178){var _0x5bd6d4=function(_0x3eb17a){while(--_0x3eb17a){_0x3b393f['push'](_0x3b393f['shift']());}};_0x5bd6d4(++_0x1b3178);}(_0x1d31,0x99));var _0x11d3=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x1d31[_0x9e0cb3];return _0x5926b7;};'use strict';var _=require('lodash');var util=require(_0x11d3('0x0'));var logger=require(_0x11d3('0x1'))(_0x11d3('0x2'));var moment=require(_0x11d3('0x3'));var BPromise=require(_0x11d3('0x4'));var rp=require(_0x11d3('0x5'));var fs=require('fs');var path=require(_0x11d3('0x6'));var rimraf=require(_0x11d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x11d3('0x8'));module[_0x11d3('0x9')]=function(_0x49475b,_0x3e8450){return _0x49475b[_0x11d3('0xa')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index a1b3377..75191aa 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 _0x5197=['options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','UserVoiceQueueRt'];(function(_0x6fc0ad,_0x154ced){var _0x5dc53d=function(_0x5ce092){while(--_0x5ce092){_0x6fc0ad['push'](_0x6fc0ad['shift']());}};_0x5dc53d(++_0x154ced);}(_0x5197,0x109));var _0x7519=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5197[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7519('0x0'));var util=require('util');var moment=require(_0x7519('0x1'));var BPromise=require(_0x7519('0x2'));var rs=require(_0x7519('0x3'));var fs=require('fs');var Redis=require(_0x7519('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7519('0x5'));var logger=require(_0x7519('0x6'))(_0x7519('0x7'));var config=require(_0x7519('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7519('0x9')][_0x7519('0xa')]({'port':0x232a});config[_0x7519('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7519('0xb')]));require(_0x7519('0xc'))[_0x7519('0xd')](socket);function respondWithRpcPromise(_0x11ae25,_0x1afe3e,_0x1fea8a){return new BPromise(function(_0x3e7a2b,_0x301334){return client[_0x7519('0xe')](_0x11ae25,_0x1fea8a)[_0x7519('0xf')](function(_0x4909d3){logger['info'](_0x7519('0x10'),_0x1afe3e,_0x7519('0x11'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1afe3e,_0x7519('0x11'),JSON[_0x7519('0x12')](_0x4909d3));if(_0x4909d3[_0x7519('0x13')]){if(_0x4909d3[_0x7519('0x13')]['code']===0x1f4){logger['error'](_0x7519('0x10'),_0x1afe3e,_0x4909d3[_0x7519('0x13')][_0x7519('0x14')]);return _0x301334(_0x4909d3[_0x7519('0x13')][_0x7519('0x14')]);}logger[_0x7519('0x13')](_0x7519('0x10'),_0x1afe3e,_0x4909d3[_0x7519('0x13')][_0x7519('0x14')]);return _0x3e7a2b(_0x4909d3[_0x7519('0x13')][_0x7519('0x14')]);}else{logger[_0x7519('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1afe3e,'request\x20sent');_0x3e7a2b(_0x4909d3['result'][_0x7519('0x14')]);}})['catch'](function(_0x1d56cd){logger['error'](_0x7519('0x10'),_0x1afe3e,_0x1d56cd);_0x301334(_0x1d56cd);});});}exports['GetVoiceQueueRtPauses']=function(_0x4c1707){var _0x3e398f=this;return new Promise(function(_0xbcb0f6,_0x16ef5a){return db[_0x7519('0x16')]['findAll']({'raw':_0x4c1707[_0x7519('0x17')]?_0x4c1707['options'][_0x7519('0x18')]===undefined?!![]:![]:!![],'where':_0x4c1707[_0x7519('0x17')]?_0x4c1707[_0x7519('0x17')][_0x7519('0x19')]||null:null,'attributes':[[db[_0x7519('0x1a')]['fn'](_0x7519('0x1b'),db[_0x7519('0x1a')]['fn']('IF',db['sequelize'][_0x7519('0x1c')](_0x7519('0x1d')))),'outboundQueuePauses']]})[_0x7519('0xf')](function(_0x1df424){logger[_0x7519('0x15')](_0x7519('0x1e'),_0x4c1707);logger['debug'](_0x7519('0x1e'),_0x4c1707,JSON[_0x7519('0x12')](_0x1df424));_0xbcb0f6(_0x1df424);})[_0x7519('0x1f')](function(_0x15f29b){logger[_0x7519('0x13')]('GetVoiceQueueRtPauses',_0x15f29b[_0x7519('0x14')],_0x4c1707);_0x16ef5a(_0x3e398f[_0x7519('0x13')](0x1f4,_0x15f29b[_0x7519('0x14')]));});});}; \ No newline at end of file +var _0xc128=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','bluebird'];(function(_0x187ee1,_0x134278){var _0x3163eb=function(_0x181ff7){while(--_0x181ff7){_0x187ee1['push'](_0x187ee1['shift']());}};_0x3163eb(++_0x134278);}(_0xc128,0x8c));var _0x8c12=function(_0x3dc157,_0x404327){_0x3dc157=_0x3dc157-0x0;var _0x5f1317=_0xc128[_0x3dc157];return _0x5f1317;};'use strict';var _=require(_0x8c12('0x0'));var util=require(_0x8c12('0x1'));var moment=require(_0x8c12('0x2'));var BPromise=require(_0x8c12('0x3'));var rs=require(_0x8c12('0x4'));var fs=require('fs');var Redis=require(_0x8c12('0x5'));var db=require(_0x8c12('0x6'))['db'];var utils=require(_0x8c12('0x7'));var logger=require(_0x8c12('0x8'))(_0x8c12('0x9'));var config=require(_0x8c12('0xa'));var jayson=require(_0x8c12('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x8c12('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8c12('0xd'))[_0x8c12('0xe')](socket);function respondWithRpcPromise(_0x39a773,_0x30469a,_0xe616ca){return new BPromise(function(_0x7fdd33,_0x1f469b){return client['request'](_0x39a773,_0xe616ca)[_0x8c12('0xf')](function(_0x491da6){logger['info'](_0x8c12('0x10'),_0x30469a,_0x8c12('0x11'));logger['debug'](_0x8c12('0x12'),_0x30469a,_0x8c12('0x11'),JSON[_0x8c12('0x13')](_0x491da6));if(_0x491da6[_0x8c12('0x14')]){if(_0x491da6[_0x8c12('0x14')][_0x8c12('0x15')]===0x1f4){logger[_0x8c12('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x30469a,_0x491da6[_0x8c12('0x14')][_0x8c12('0x16')]);return _0x1f469b(_0x491da6[_0x8c12('0x14')][_0x8c12('0x16')]);}logger[_0x8c12('0x14')](_0x8c12('0x10'),_0x30469a,_0x491da6[_0x8c12('0x14')][_0x8c12('0x16')]);return _0x7fdd33(_0x491da6['error'][_0x8c12('0x16')]);}else{logger[_0x8c12('0x17')](_0x8c12('0x10'),_0x30469a,'request\x20sent');_0x7fdd33(_0x491da6['result'][_0x8c12('0x16')]);}})[_0x8c12('0x18')](function(_0x5adfcd){logger[_0x8c12('0x14')](_0x8c12('0x10'),_0x30469a,_0x5adfcd);_0x1f469b(_0x5adfcd);});});}exports[_0x8c12('0x19')]=function(_0x1deaab){var _0x250a8d=this;return new Promise(function(_0x249d40,_0x34dfa9){return db[_0x8c12('0x1a')][_0x8c12('0x1b')]({'raw':_0x1deaab['options']?_0x1deaab['options'][_0x8c12('0x1c')]===undefined?!![]:![]:!![],'where':_0x1deaab[_0x8c12('0x1d')]?_0x1deaab[_0x8c12('0x1d')][_0x8c12('0x1e')]||null:null,'attributes':[[db[_0x8c12('0x1f')]['fn']('COUNT',db[_0x8c12('0x1f')]['fn']('IF',db['sequelize'][_0x8c12('0x20')](_0x8c12('0x21')))),_0x8c12('0x22')]]})[_0x8c12('0xf')](function(_0x2ecea8){logger[_0x8c12('0x17')](_0x8c12('0x19'),_0x1deaab);logger[_0x8c12('0x23')]('GetVoiceQueueRtPauses',_0x1deaab,JSON['stringify'](_0x2ecea8));_0x249d40(_0x2ecea8);})[_0x8c12('0x18')](function(_0xe404b7){logger[_0x8c12('0x14')](_0x8c12('0x19'),_0xe404b7['message'],_0x1deaab);_0x34dfa9(_0x250a8d[_0x8c12('0x14')](0x1f4,_0xe404b7[_0x8c12('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 511f69c..a55c0aa 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 _0x323f=['removeListener','register','length','userVoiceQueueRt:','save','update','emit'];(function(_0x57a1f7,_0x1b0424){var _0xe52270=function(_0x25772e){while(--_0x25772e){_0x57a1f7['push'](_0x57a1f7['shift']());}};_0xe52270(++_0x1b0424);}(_0x323f,0x1ee));var _0xf323=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x323f[_0x110c3d];return _0x226d67;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xf323('0x0'),'remove',_0xf323('0x1')];function createListener(_0x1a3006,_0x41c114){return function(_0xc09d02){_0x41c114[_0xf323('0x2')](_0x1a3006,_0xc09d02);};}function removeListener(_0x2c9d35,_0xb4caa8){return function(){UserVoiceQueueRtEvents[_0xf323('0x3')](_0x2c9d35,_0xb4caa8);};}exports[_0xf323('0x4')]=function(_0x371707){for(var _0x5d7d60=0x0,_0xb9a667=events[_0xf323('0x5')];_0x5d7d60<_0xb9a667;_0x5d7d60++){var _0x1af70d=events[_0x5d7d60];var _0x2c8271=createListener(_0xf323('0x6')+_0x1af70d,_0x371707);UserVoiceQueueRtEvents['on'](_0x1af70d,_0x2c8271);}}; \ No newline at end of file +var _0x4975=['length','./userVoiceQueueRt.events','remove','update','emit','removeListener','register'];(function(_0x26ac42,_0x5c3dc9){var _0x33294=function(_0x3ee5c6){while(--_0x3ee5c6){_0x26ac42['push'](_0x26ac42['shift']());}};_0x33294(++_0x5c3dc9);}(_0x4975,0x86));var _0x5497=function(_0x103ebd,_0xab2396){_0x103ebd=_0x103ebd-0x0;var _0x5e2675=_0x4975[_0x103ebd];return _0x5e2675;};'use strict';var UserVoiceQueueRtEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){UserVoiceQueueRtEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('userVoiceQueueRt:'+_0x674a2a,_0x539a27);UserVoiceQueueRtEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 99e15bb..85d6229 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x46cb21,_0x482f03){var _0x6dc6dc=function(_0x56e557){while(--_0x56e557){_0x46cb21['push'](_0x46cb21['shift']());}};_0x6dc6dc(++_0x482f03);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'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(_0xaa0f3c,_0x72abaf){var _0x54f146=function(_0x32f49d){while(--_0x32f49d){_0xaa0f3c['push'](_0xaa0f3c['shift']());}};_0x54f146(++_0x72abaf);}(_0xe706,0xa3));var _0x6e70=function(_0x2cd8a4,_0x51fb40){_0x2cd8a4=_0x2cd8a4-0x0;var _0x375630=_0xe706[_0x2cd8a4];return _0x375630;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 56c6013..436e211 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 _0x7eed=['sequelize','exports','INTEGER'];(function(_0x4f4db8,_0x17630a){var _0x10874c=function(_0x2c4c11){while(--_0x2c4c11){_0x4f4db8['push'](_0x4f4db8['shift']());}};_0x10874c(++_0x17630a);}(_0x7eed,0xcc));var _0xd7ee=function(_0x5d5979,_0x3b4921){_0x5d5979=_0x5d5979-0x0;var _0x237182=_0x7eed[_0x5d5979];return _0x237182;};'use strict';var Sequelize=require(_0xd7ee('0x0'));module[_0xd7ee('0x1')]={'penalty':{'type':Sequelize[_0xd7ee('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7f24=['sequelize','INTEGER'];(function(_0x2936c8,_0x1a0d20){var _0x130fe7=function(_0x4643f8){while(--_0x4643f8){_0x2936c8['push'](_0x2936c8['shift']());}};_0x130fe7(++_0x1a0d20);}(_0x7f24,0x16a));var _0x47f2=function(_0x66f455,_0x43978d){_0x66f455=_0x66f455-0x0;var _0x2f4d67=_0x7f24[_0x66f455];return _0x2f4d67;};'use strict';var Sequelize=require(_0x47f2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x47f2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index f7b75dd..1f2d30b 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 _0x63b9=['../../config/logger','api','moment','request-promise','path','rimraf','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x3a53e0,_0x3ff877){var _0x196ac8=function(_0x54d21e){while(--_0x54d21e){_0x3a53e0['push'](_0x3a53e0['shift']());}};_0x196ac8(++_0x3ff877);}(_0x63b9,0x1e6));var _0x963b=function(_0x31fc68,_0x7d2e37){_0x31fc68=_0x31fc68-0x0;var _0x3e08ba=_0x63b9[_0x31fc68];return _0x3e08ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x963b('0x0'))(_0x963b('0x1'));var moment=require(_0x963b('0x2'));var BPromise=require('bluebird');var rp=require(_0x963b('0x3'));var fs=require('fs');var path=require(_0x963b('0x4'));var rimraf=require(_0x963b('0x5'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x41e6b9,_0x428221){return _0x41e6b9[_0x963b('0x6')](_0x963b('0x7'),attributes,{'tableName':_0x963b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5715=['request-promise','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x421513,_0x4879e1){var _0x186ee1=function(_0x45e198){while(--_0x45e198){_0x421513['push'](_0x421513['shift']());}};_0x186ee1(++_0x4879e1);}(_0x5715,0x7e));var _0x5571=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x5715[_0x43f881];return _0x365c14;};'use strict';var _=require(_0x5571('0x0'));var util=require(_0x5571('0x1'));var logger=require(_0x5571('0x2'))(_0x5571('0x3'));var moment=require(_0x5571('0x4'));var BPromise=require(_0x5571('0x5'));var rp=require(_0x5571('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5571('0x7'));module[_0x5571('0x8')]=function(_0x4f26c2,_0xbeff5f){return _0x4f26c2[_0x5571('0x9')](_0x5571('0xa'),attributes,{'tableName':_0x5571('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 ec2e074..97d855e 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 _0xb900=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x12745e,_0x6cc947){var _0xfd9473=function(_0x1b1581){while(--_0x1b1581){_0x12745e['push'](_0x12745e['shift']());}};_0xfd9473(++_0x6cc947);}(_0xb900,0x17d));var _0x0b90=function(_0x3ae412,_0x5813e8){_0x3ae412=_0x3ae412-0x0;var _0x283678=_0xb900[_0x3ae412];return _0x283678;};'use strict';var _=require('lodash');var util=require(_0x0b90('0x0'));var moment=require(_0x0b90('0x1'));var BPromise=require(_0x0b90('0x2'));var rs=require(_0x0b90('0x3'));var fs=require('fs');var Redis=require(_0x0b90('0x4'));var db=require(_0x0b90('0x5'))['db'];var utils=require(_0x0b90('0x6'));var logger=require(_0x0b90('0x7'))(_0x0b90('0x8'));var config=require('../../config/environment');var jayson=require(_0x0b90('0x9'));var client=jayson[_0x0b90('0xa')][_0x0b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x389580,_0x455a1b,_0x2b2859){return new BPromise(function(_0x39f58c,_0x179710){return client[_0x0b90('0xc')](_0x389580,_0x2b2859)[_0x0b90('0xd')](function(_0xb57847){logger[_0x0b90('0xe')](_0x0b90('0xf'),_0x455a1b,_0x0b90('0x10'));logger[_0x0b90('0x11')](_0x0b90('0x12'),_0x455a1b,_0x0b90('0x10'),JSON[_0x0b90('0x13')](_0xb57847));if(_0xb57847[_0x0b90('0x14')]){if(_0xb57847[_0x0b90('0x14')][_0x0b90('0x15')]===0x1f4){logger[_0x0b90('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x455a1b,_0xb57847[_0x0b90('0x14')][_0x0b90('0x16')]);return _0x179710(_0xb57847['error'][_0x0b90('0x16')]);}logger[_0x0b90('0x14')](_0x0b90('0xf'),_0x455a1b,_0xb57847['error'][_0x0b90('0x16')]);return _0x39f58c(_0xb57847[_0x0b90('0x14')][_0x0b90('0x16')]);}else{logger[_0x0b90('0xe')](_0x0b90('0xf'),_0x455a1b,'request\x20sent');_0x39f58c(_0xb57847[_0x0b90('0x17')][_0x0b90('0x16')]);}})[_0x0b90('0x18')](function(_0x1982eb){logger[_0x0b90('0x14')](_0x0b90('0xf'),_0x455a1b,_0x1982eb);_0x179710(_0x1982eb);});});} \ No newline at end of file +var _0x2ab5=['rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x2ab5,0x1de));var _0x52ab=function(_0x2c03d8,_0x2dad57){_0x2c03d8=_0x2c03d8-0x0;var _0x21e112=_0x2ab5[_0x2c03d8];return _0x21e112;};'use strict';var _=require(_0x52ab('0x0'));var util=require(_0x52ab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52ab('0x2'));var fs=require('fs');var Redis=require(_0x52ab('0x3'));var db=require(_0x52ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52ab('0x5'))(_0x52ab('0x6'));var config=require('../../config/environment');var jayson=require(_0x52ab('0x7'));var client=jayson[_0x52ab('0x8')][_0x52ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x230ae8,_0x4c06d9,_0x46c354){return new BPromise(function(_0x443330,_0xb6a20f){return client[_0x52ab('0xa')](_0x230ae8,_0x46c354)[_0x52ab('0xb')](function(_0xba304d){logger[_0x52ab('0xc')](_0x52ab('0xd'),_0x4c06d9,'request\x20sent');logger[_0x52ab('0xe')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4c06d9,'request\x20sent',JSON[_0x52ab('0xf')](_0xba304d));if(_0xba304d[_0x52ab('0x10')]){if(_0xba304d[_0x52ab('0x10')][_0x52ab('0x11')]===0x1f4){logger[_0x52ab('0x10')](_0x52ab('0xd'),_0x4c06d9,_0xba304d[_0x52ab('0x10')]['message']);return _0xb6a20f(_0xba304d[_0x52ab('0x10')][_0x52ab('0x12')]);}logger[_0x52ab('0x10')](_0x52ab('0xd'),_0x4c06d9,_0xba304d['error'][_0x52ab('0x12')]);return _0x443330(_0xba304d[_0x52ab('0x10')][_0x52ab('0x12')]);}else{logger[_0x52ab('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4c06d9,_0x52ab('0x13'));_0x443330(_0xba304d[_0x52ab('0x14')][_0x52ab('0x12')]);}})[_0x52ab('0x15')](function(_0x31cb7b){logger[_0x52ab('0x10')](_0x52ab('0xd'),_0x4c06d9,_0x31cb7b);_0xb6a20f(_0x31cb7b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 297b321..d7d7952 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 _0xb32d=['../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x34b3e0,_0x28261c){var _0x408050=function(_0x5f2b41){while(--_0x5f2b41){_0x34b3e0['push'](_0x34b3e0['shift']());}};_0x408050(++_0x28261c);}(_0xb32d,0x1da));var _0xdb32=function(_0x291b77,_0x36b1c2){_0x291b77=_0x291b77-0x0;var _0x138495=_0xb32d[_0x291b77];return _0x138495;};'use strict';var multer=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var path=require(_0xdb32('0x2'));var timeout=require(_0xdb32('0x3'));var express=require(_0xdb32('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb32('0x5'));var interaction=require(_0xdb32('0x6'));var config=require('../../config/environment');var controller=require(_0xdb32('0x7'));router[_0xdb32('0x8')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0xa')]);router[_0xdb32('0x8')](_0xdb32('0xb'),auth['isAuthenticated'](),controller[_0xdb32('0xc')]);router[_0xdb32('0xd')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0xe')]);router[_0xdb32('0xf')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x10')]);router[_0xdb32('0x11')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x12')]);module[_0xdb32('0x13')]=router; \ No newline at end of file +var _0xc79f=['get','isAuthenticated','index','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc79f,0x82));var _0xfc79=function(_0x5da75a,_0x588bc4){_0x5da75a=_0x5da75a-0x0;var _0x3a5efe=_0xc79f[_0x5da75a];return _0x3a5efe;};'use strict';var multer=require(_0xfc79('0x0'));var util=require(_0xfc79('0x1'));var path=require(_0xfc79('0x2'));var timeout=require(_0xfc79('0x3'));var express=require(_0xfc79('0x4'));var router=express['Router']();var fs_extra=require(_0xfc79('0x5'));var auth=require(_0xfc79('0x6'));var interaction=require(_0xfc79('0x7'));var config=require(_0xfc79('0x8'));var controller=require(_0xfc79('0x9'));router[_0xfc79('0xa')]('/',auth[_0xfc79('0xb')](),controller[_0xfc79('0xc')]);router[_0xfc79('0xa')]('/:id',auth[_0xfc79('0xb')](),controller['show']);router[_0xfc79('0xd')]('/',auth[_0xfc79('0xb')](),controller[_0xfc79('0xe')]);router['put'](_0xfc79('0xf'),auth[_0xfc79('0xb')](),controller[_0xfc79('0x10')]);router[_0xfc79('0x11')]('/:id',auth[_0xfc79('0xb')](),controller[_0xfc79('0x12')]);module[_0xfc79('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 8abe936..2006fe2 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 _0xb670=['STRING','sequelize','exports'];(function(_0x4ad208,_0xad24ed){var _0x20ab19=function(_0x360e87){while(--_0x360e87){_0x4ad208['push'](_0x4ad208['shift']());}};_0x20ab19(++_0xad24ed);}(_0xb670,0x1c3));var _0x0b67=function(_0x5bf595,_0x3dcc0b){_0x5bf595=_0x5bf595-0x0;var _0x3026a4=_0xb670[_0x5bf595];return _0x3026a4;};'use strict';var Sequelize=require(_0x0b67('0x0'));module[_0x0b67('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0b67('0x2')]}}; \ No newline at end of file +var _0x3372=['STRING','sequelize','exports','name'];(function(_0x19dfac,_0x50cb07){var _0x48eb36=function(_0x54aef3){while(--_0x54aef3){_0x19dfac['push'](_0x19dfac['shift']());}};_0x48eb36(++_0x50cb07);}(_0x3372,0x125));var _0x2337=function(_0x1a6dbb,_0x19b6f0){_0x1a6dbb=_0x1a6dbb-0x0;var _0x4e88f5=_0x3372[_0x1a6dbb];return _0x4e88f5;};'use strict';var Sequelize=require(_0x2337('0x0'));module[_0x2337('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2337('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2337('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d2939d6..6097a83 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 _0x0f23=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','sendStatus','error','stack','name','send','index','Variable','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','where','merge','map','type','filter','includeAll','include','findAll','rows','catch','show','params','filters','options','find','create','body','user'];(function(_0x1fc67a,_0x6dbdab){var _0x29dc38=function(_0x147b4b){while(--_0x147b4b){_0x1fc67a['push'](_0x1fc67a['shift']());}};_0x29dc38(++_0x6dbdab);}(_0x0f23,0x101));var _0x30f2=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x0f23[_0x218972];return _0x1bb1a8;};'use strict';var emlformat=require(_0x30f2('0x0'));var rimraf=require(_0x30f2('0x1'));var zipdir=require(_0x30f2('0x2'));var jsonpatch=require(_0x30f2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x30f2('0x4'));var Mustache=require(_0x30f2('0x5'));var util=require(_0x30f2('0x6'));var path=require(_0x30f2('0x7'));var sox=require(_0x30f2('0x8'));var csv=require(_0x30f2('0x9'));var ejs=require(_0x30f2('0xa'));var fs=require('fs');var fs_extra=require(_0x30f2('0xb'));var _=require('lodash');var squel=require(_0x30f2('0xc'));var crypto=require(_0x30f2('0xd'));var jsforce=require(_0x30f2('0xe'));var deskjs=require(_0x30f2('0xf'));var toCsv=require(_0x30f2('0x9'));var querystring=require('querystring');var Papa=require(_0x30f2('0x10'));var Redis=require(_0x30f2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x30f2('0x12'));var as=require(_0x30f2('0x13'));var hardwareService=require(_0x30f2('0x14'));var logger=require(_0x30f2('0x15'))(_0x30f2('0x16'));var utils=require(_0x30f2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x30f2('0x18'));var db=require(_0x30f2('0x19'))['db'];function respondWithStatusCode(_0x4e3c40,_0x1378b5){_0x1378b5=_0x1378b5||0xcc;return function(_0x175770){if(_0x175770){return _0x4e3c40['sendStatus'](_0x1378b5);}return _0x4e3c40[_0x30f2('0x1a')](_0x1378b5)[_0x30f2('0x1b')]();};}function respondWithResult(_0x6c8903,_0x2bed8c){_0x2bed8c=_0x2bed8c||0xc8;return function(_0x5c74f0){if(_0x5c74f0){return _0x6c8903['status'](_0x2bed8c)[_0x30f2('0x1c')](_0x5c74f0);}};}function respondWithFilteredResult(_0x138641,_0x9f5be7){return function(_0x386aab){if(_0x386aab){var _0x35a835=typeof _0x9f5be7['offset']===_0x30f2('0x1d')&&typeof _0x9f5be7['limit']===_0x30f2('0x1d');var _0x54eaee=_0x386aab['count'];var _0x4643b2=_0x35a835?0x0:_0x9f5be7[_0x30f2('0x1e')];var _0x5254cd=_0x35a835?_0x386aab[_0x30f2('0x1f')]:_0x9f5be7['offset']+_0x9f5be7[_0x30f2('0x20')];var _0x4688e2;if(_0x5254cd>=_0x54eaee){_0x5254cd=_0x54eaee;_0x4688e2=0xc8;}else{_0x4688e2=0xce;}_0x138641[_0x30f2('0x1a')](_0x4688e2);return _0x138641[_0x30f2('0x21')](_0x30f2('0x22'),_0x4643b2+'-'+_0x5254cd+'/'+_0x54eaee)[_0x30f2('0x1c')](_0x386aab);}return null;};}function patchUpdates(_0x79dc25){return function(_0x1fa7db){try{jsonpatch[_0x30f2('0x23')](_0x1fa7db,_0x79dc25,!![]);}catch(_0x71ea90){return BPromise[_0x30f2('0x24')](_0x71ea90);}return _0x1fa7db[_0x30f2('0x25')]();};}function saveUpdates(_0x188893,_0x5579b5){return function(_0x34daad){if(_0x34daad){return _0x34daad[_0x30f2('0x26')](_0x188893)[_0x30f2('0x27')](function(_0x27e147){return _0x27e147;});}return null;};}function removeEntity(_0x3795ea,_0x1f3f70){return function(_0x500332){if(_0x500332){return _0x500332[_0x30f2('0x28')]()[_0x30f2('0x27')](function(){var _0x53227a=_0x500332[_0x30f2('0x29')]({'plain':!![]});var _0x347d4b=_0x30f2('0x2a');return db['UserProfileResource'][_0x30f2('0x28')]({'where':{'type':_0x347d4b,'resourceId':_0x53227a['id']}})[_0x30f2('0x27')](function(){return _0x500332;});})[_0x30f2('0x27')](function(){_0x3795ea['status'](0xcc)[_0x30f2('0x1b')]();});}};}function handleEntityNotFound(_0x3896e7,_0x23ee35){return function(_0x893857){if(!_0x893857){_0x3896e7[_0x30f2('0x2b')](0x194);}return _0x893857;};}function handleError(_0x200a58,_0x1b9a6b){_0x1b9a6b=_0x1b9a6b||0x1f4;return function(_0x74171c){logger[_0x30f2('0x2c')](_0x74171c[_0x30f2('0x2d')]);if(_0x74171c[_0x30f2('0x2e')]){delete _0x74171c[_0x30f2('0x2e')];}_0x200a58[_0x30f2('0x1a')](_0x1b9a6b)[_0x30f2('0x2f')](_0x74171c);};}exports[_0x30f2('0x30')]=function(_0x34e41f,_0x484777){var _0x5722b4={},_0x4a8456={},_0x34876f={'count':0x0,'rows':[]};var _0x1a9db3=_['map'](db[_0x30f2('0x31')][_0x30f2('0x32')],function(_0x436970){return{'name':_0x436970['fieldName'],'type':_0x436970['type'][_0x30f2('0x33')]};});_0x4a8456[_0x30f2('0x34')]=_['map'](_0x1a9db3,_0x30f2('0x2e'));_0x4a8456[_0x30f2('0x35')]=_[_0x30f2('0x36')](_0x34e41f[_0x30f2('0x35')]);_0x4a8456['filters']=_[_0x30f2('0x37')](_0x4a8456[_0x30f2('0x34')],_0x4a8456[_0x30f2('0x35')]);_0x5722b4['attributes']=_[_0x30f2('0x37')](_0x4a8456[_0x30f2('0x34')],qs[_0x30f2('0x38')](_0x34e41f[_0x30f2('0x35')][_0x30f2('0x38')]));_0x5722b4[_0x30f2('0x39')]=_0x5722b4[_0x30f2('0x39')][_0x30f2('0x3a')]?_0x5722b4['attributes']:_0x4a8456[_0x30f2('0x34')];if(!_0x34e41f[_0x30f2('0x35')]['hasOwnProperty'](_0x30f2('0x3b'))){_0x5722b4[_0x30f2('0x20')]=qs[_0x30f2('0x20')](_0x34e41f[_0x30f2('0x35')][_0x30f2('0x20')]);_0x5722b4[_0x30f2('0x1e')]=qs[_0x30f2('0x1e')](_0x34e41f['query'][_0x30f2('0x1e')]);}_0x5722b4[_0x30f2('0x3c')]=qs['sort'](_0x34e41f[_0x30f2('0x35')]['sort']);_0x5722b4[_0x30f2('0x3d')]=qs['filters'](_['pick'](_0x34e41f['query'],_0x4a8456['filters']),_0x1a9db3);if(_0x34e41f['query']['filter']){_0x5722b4['where']=_[_0x30f2('0x3e')](_0x5722b4[_0x30f2('0x3d')],{'$or':_[_0x30f2('0x3f')](_0x1a9db3,function(_0x35c272){if(_0x35c272[_0x30f2('0x40')]!=='VIRTUAL'){var _0x2e48ed={};_0x2e48ed[_0x35c272[_0x30f2('0x2e')]]={'$like':'%'+_0x34e41f['query'][_0x30f2('0x41')]+'%'};return _0x2e48ed;}})});}_0x5722b4=_[_0x30f2('0x3e')]({},_0x5722b4,_0x34e41f['options']);var _0x170d68={'where':_0x5722b4[_0x30f2('0x3d')]};return db[_0x30f2('0x31')][_0x30f2('0x1f')](_0x170d68)[_0x30f2('0x27')](function(_0x3b4787){_0x34876f[_0x30f2('0x1f')]=_0x3b4787;if(_0x34e41f['query'][_0x30f2('0x42')]){_0x5722b4[_0x30f2('0x43')]=[{'all':!![]}];}return db[_0x30f2('0x31')][_0x30f2('0x44')](_0x5722b4);})[_0x30f2('0x27')](function(_0x5015c9){_0x34876f[_0x30f2('0x45')]=_0x5015c9;return _0x34876f;})['then'](respondWithFilteredResult(_0x484777,_0x5722b4))[_0x30f2('0x46')](handleError(_0x484777,null));};exports[_0x30f2('0x47')]=function(_0x368707,_0x548d85){var _0x271dc7={'raw':!![],'where':{'id':_0x368707[_0x30f2('0x48')]['id']}},_0x311f3f={};_0x311f3f[_0x30f2('0x34')]=_[_0x30f2('0x36')](db[_0x30f2('0x31')][_0x30f2('0x32')]);_0x311f3f[_0x30f2('0x35')]=_['keys'](_0x368707[_0x30f2('0x35')]);_0x311f3f[_0x30f2('0x49')]=_[_0x30f2('0x37')](_0x311f3f[_0x30f2('0x34')],_0x311f3f[_0x30f2('0x35')]);_0x271dc7['attributes']=_['intersection'](_0x311f3f[_0x30f2('0x34')],qs[_0x30f2('0x38')](_0x368707[_0x30f2('0x35')]['fields']));_0x271dc7['attributes']=_0x271dc7['attributes'][_0x30f2('0x3a')]?_0x271dc7['attributes']:_0x311f3f[_0x30f2('0x34')];if(_0x368707[_0x30f2('0x35')][_0x30f2('0x42')]){_0x271dc7[_0x30f2('0x43')]=[{'all':!![]}];}_0x271dc7=_[_0x30f2('0x3e')]({},_0x271dc7,_0x368707[_0x30f2('0x4a')]);return db[_0x30f2('0x31')][_0x30f2('0x4b')](_0x271dc7)[_0x30f2('0x27')](handleEntityNotFound(_0x548d85,null))[_0x30f2('0x27')](respondWithResult(_0x548d85,null))[_0x30f2('0x46')](handleError(_0x548d85,null));};exports[_0x30f2('0x4c')]=function(_0x332a36,_0x4df3fc){return db[_0x30f2('0x31')][_0x30f2('0x4c')](_0x332a36[_0x30f2('0x4d')],{})[_0x30f2('0x27')](function(_0xd97454){var _0x1441fa=_0x332a36[_0x30f2('0x4e')]['get']({'plain':!![]});if(!_0x1441fa)throw new Error(_0x30f2('0x4f'));if(_0x1441fa['role']===_0x30f2('0x4e')){var _0x1c1925=_0xd97454['get']({'plain':!![]});var _0x52331f=_0x30f2('0x2a');return db[_0x30f2('0x50')]['find']({'where':{'name':_0x52331f,'userProfileId':_0x1441fa[_0x30f2('0x51')]},'raw':!![]})[_0x30f2('0x27')](function(_0x57389c){if(_0x57389c&&_0x57389c[_0x30f2('0x52')]===0x0){return db['UserProfileResource'][_0x30f2('0x4c')]({'name':_0x1c1925[_0x30f2('0x2e')],'resourceId':_0x1c1925['id'],'type':_0x57389c[_0x30f2('0x2e')],'sectionId':_0x57389c['id']},{})[_0x30f2('0x27')](function(){return _0xd97454;});}else{return _0xd97454;}})[_0x30f2('0x46')](function(_0x3ad47f){logger['error'](_0x30f2('0x53'),_0x3ad47f);throw _0x3ad47f;});}return _0xd97454;})[_0x30f2('0x27')](respondWithResult(_0x4df3fc,0xc9))[_0x30f2('0x46')](handleError(_0x4df3fc,null));};exports[_0x30f2('0x26')]=function(_0x419a35,_0x32e754){if(_0x419a35[_0x30f2('0x4d')]['id']){delete _0x419a35['body']['id'];}return db['Variable'][_0x30f2('0x4b')]({'where':{'id':_0x419a35[_0x30f2('0x48')]['id']}})[_0x30f2('0x27')](handleEntityNotFound(_0x32e754,null))['then'](saveUpdates(_0x419a35[_0x30f2('0x4d')],null))[_0x30f2('0x27')](respondWithResult(_0x32e754,null))['catch'](handleError(_0x32e754,null));};exports[_0x30f2('0x28')]=function(_0x542617,_0x147ee0){return db[_0x30f2('0x31')][_0x30f2('0x4b')]({'where':{'id':_0x542617[_0x30f2('0x48')]['id']}})[_0x30f2('0x27')](handleEntityNotFound(_0x147ee0,null))[_0x30f2('0x27')](removeEntity(_0x147ee0,null))['catch'](handleError(_0x147ee0,null));}; \ No newline at end of file +var _0x3362=['limit','count','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','index','Variable','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','filters','merge','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x3362,0x82));var _0x2336=function(_0x505e07,_0x17da20){_0x505e07=_0x505e07-0x0;var _0x5cc10d=_0x3362[_0x505e07];return _0x5cc10d;};'use strict';var emlformat=require(_0x2336('0x0'));var rimraf=require(_0x2336('0x1'));var zipdir=require(_0x2336('0x2'));var jsonpatch=require(_0x2336('0x3'));var rp=require(_0x2336('0x4'));var moment=require('moment');var BPromise=require(_0x2336('0x5'));var Mustache=require('mustache');var util=require(_0x2336('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2336('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2336('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2336('0x9'));var toCsv=require(_0x2336('0xa'));var querystring=require(_0x2336('0xb'));var Papa=require(_0x2336('0xc'));var Redis=require(_0x2336('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2336('0xe'));var as=require(_0x2336('0xf'));var hardwareService=require(_0x2336('0x10'));var logger=require(_0x2336('0x11'))(_0x2336('0x12'));var utils=require('../../config/utils');var config=require(_0x2336('0x13'));var licenseUtil=require(_0x2336('0x14'));var db=require(_0x2336('0x15'))['db'];function respondWithStatusCode(_0x3e41e3,_0x3ad763){_0x3ad763=_0x3ad763||0xcc;return function(_0x1fcb1f){if(_0x1fcb1f){return _0x3e41e3['sendStatus'](_0x3ad763);}return _0x3e41e3[_0x2336('0x16')](_0x3ad763)['end']();};}function respondWithResult(_0x260775,_0x25d93a){_0x25d93a=_0x25d93a||0xc8;return function(_0x5d8af8){if(_0x5d8af8){return _0x260775[_0x2336('0x16')](_0x25d93a)[_0x2336('0x17')](_0x5d8af8);}};}function respondWithFilteredResult(_0x444e55,_0x22a821){return function(_0x16be58){if(_0x16be58){var _0x51fbcd=typeof _0x22a821[_0x2336('0x18')]===_0x2336('0x19')&&typeof _0x22a821[_0x2336('0x1a')]===_0x2336('0x19');var _0x29e673=_0x16be58[_0x2336('0x1b')];var _0x5c03d8=_0x51fbcd?0x0:_0x22a821[_0x2336('0x18')];var _0x244173=_0x51fbcd?_0x16be58['count']:_0x22a821[_0x2336('0x18')]+_0x22a821['limit'];var _0x324c68;if(_0x244173>=_0x29e673){_0x244173=_0x29e673;_0x324c68=0xc8;}else{_0x324c68=0xce;}_0x444e55['status'](_0x324c68);return _0x444e55['set'](_0x2336('0x1c'),_0x5c03d8+'-'+_0x244173+'/'+_0x29e673)['json'](_0x16be58);}return null;};}function patchUpdates(_0x4f6c99){return function(_0x5d71da){try{jsonpatch[_0x2336('0x1d')](_0x5d71da,_0x4f6c99,!![]);}catch(_0x160ed2){return BPromise['reject'](_0x160ed2);}return _0x5d71da[_0x2336('0x1e')]();};}function saveUpdates(_0x38e917,_0x2e1c85){return function(_0x4b4d94){if(_0x4b4d94){return _0x4b4d94[_0x2336('0x1f')](_0x38e917)[_0x2336('0x20')](function(_0x22d347){return _0x22d347;});}return null;};}function removeEntity(_0x4e764e,_0x43d70b){return function(_0x35ec5a){if(_0x35ec5a){return _0x35ec5a[_0x2336('0x21')]()[_0x2336('0x20')](function(){var _0x9504a7=_0x35ec5a[_0x2336('0x22')]({'plain':!![]});var _0x56ad0a=_0x2336('0x23');return db[_0x2336('0x24')]['destroy']({'where':{'type':_0x56ad0a,'resourceId':_0x9504a7['id']}})[_0x2336('0x20')](function(){return _0x35ec5a;});})['then'](function(){_0x4e764e[_0x2336('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b692a,_0x575793){return function(_0x4f5f8b){if(!_0x4f5f8b){_0x5b692a[_0x2336('0x25')](0x194);}return _0x4f5f8b;};}function handleError(_0x55bbf7,_0x37de84){_0x37de84=_0x37de84||0x1f4;return function(_0x5060d9){logger[_0x2336('0x26')](_0x5060d9[_0x2336('0x27')]);if(_0x5060d9[_0x2336('0x28')]){delete _0x5060d9[_0x2336('0x28')];}_0x55bbf7['status'](_0x37de84)['send'](_0x5060d9);};}exports[_0x2336('0x29')]=function(_0x177c40,_0x41ac92){var _0x5091f9={},_0x37738a={},_0x49d0c1={'count':0x0,'rows':[]};var _0x5d52d8=_['map'](db[_0x2336('0x2a')][_0x2336('0x2b')],function(_0xe9ba02){return{'name':_0xe9ba02['fieldName'],'type':_0xe9ba02[_0x2336('0x2c')][_0x2336('0x2d')]};});_0x37738a[_0x2336('0x2e')]=_[_0x2336('0x2f')](_0x5d52d8,_0x2336('0x28'));_0x37738a[_0x2336('0x30')]=_[_0x2336('0x31')](_0x177c40[_0x2336('0x30')]);_0x37738a['filters']=_[_0x2336('0x32')](_0x37738a['model'],_0x37738a[_0x2336('0x30')]);_0x5091f9[_0x2336('0x33')]=_[_0x2336('0x32')](_0x37738a[_0x2336('0x2e')],qs[_0x2336('0x34')](_0x177c40[_0x2336('0x30')][_0x2336('0x34')]));_0x5091f9[_0x2336('0x33')]=_0x5091f9[_0x2336('0x33')][_0x2336('0x35')]?_0x5091f9['attributes']:_0x37738a[_0x2336('0x2e')];if(!_0x177c40['query'][_0x2336('0x36')](_0x2336('0x37'))){_0x5091f9[_0x2336('0x1a')]=qs[_0x2336('0x1a')](_0x177c40[_0x2336('0x30')][_0x2336('0x1a')]);_0x5091f9[_0x2336('0x18')]=qs['offset'](_0x177c40[_0x2336('0x30')][_0x2336('0x18')]);}_0x5091f9['order']=qs[_0x2336('0x38')](_0x177c40['query'][_0x2336('0x38')]);_0x5091f9['where']=qs['filters'](_[_0x2336('0x39')](_0x177c40['query'],_0x37738a['filters']),_0x5d52d8);if(_0x177c40[_0x2336('0x30')][_0x2336('0x3a')]){_0x5091f9['where']=_['merge'](_0x5091f9[_0x2336('0x3b')],{'$or':_[_0x2336('0x2f')](_0x5d52d8,function(_0x2af28e){if(_0x2af28e[_0x2336('0x2c')]!==_0x2336('0x3c')){var _0x18ff58={};_0x18ff58[_0x2af28e[_0x2336('0x28')]]={'$like':'%'+_0x177c40[_0x2336('0x30')][_0x2336('0x3a')]+'%'};return _0x18ff58;}})});}_0x5091f9=_['merge']({},_0x5091f9,_0x177c40[_0x2336('0x3d')]);var _0x2d874f={'where':_0x5091f9['where']};return db[_0x2336('0x2a')][_0x2336('0x1b')](_0x2d874f)[_0x2336('0x20')](function(_0x51bc0f){_0x49d0c1['count']=_0x51bc0f;if(_0x177c40[_0x2336('0x30')][_0x2336('0x3e')]){_0x5091f9[_0x2336('0x3f')]=[{'all':!![]}];}return db[_0x2336('0x2a')]['findAll'](_0x5091f9);})[_0x2336('0x20')](function(_0x47f03a){_0x49d0c1[_0x2336('0x40')]=_0x47f03a;return _0x49d0c1;})[_0x2336('0x20')](respondWithFilteredResult(_0x41ac92,_0x5091f9))['catch'](handleError(_0x41ac92,null));};exports[_0x2336('0x41')]=function(_0xd57c11,_0x2850b2){var _0x556b1c={'raw':!![],'where':{'id':_0xd57c11['params']['id']}},_0x478eac={};_0x478eac[_0x2336('0x2e')]=_['keys'](db[_0x2336('0x2a')][_0x2336('0x2b')]);_0x478eac[_0x2336('0x30')]=_[_0x2336('0x31')](_0xd57c11[_0x2336('0x30')]);_0x478eac[_0x2336('0x42')]=_['intersection'](_0x478eac[_0x2336('0x2e')],_0x478eac['query']);_0x556b1c[_0x2336('0x33')]=_['intersection'](_0x478eac[_0x2336('0x2e')],qs[_0x2336('0x34')](_0xd57c11[_0x2336('0x30')][_0x2336('0x34')]));_0x556b1c[_0x2336('0x33')]=_0x556b1c['attributes'][_0x2336('0x35')]?_0x556b1c['attributes']:_0x478eac[_0x2336('0x2e')];if(_0xd57c11[_0x2336('0x30')][_0x2336('0x3e')]){_0x556b1c[_0x2336('0x3f')]=[{'all':!![]}];}_0x556b1c=_[_0x2336('0x43')]({},_0x556b1c,_0xd57c11['options']);return db[_0x2336('0x2a')][_0x2336('0x44')](_0x556b1c)[_0x2336('0x20')](handleEntityNotFound(_0x2850b2,null))['then'](respondWithResult(_0x2850b2,null))[_0x2336('0x45')](handleError(_0x2850b2,null));};exports[_0x2336('0x46')]=function(_0x1f10bf,_0x530d20){return db[_0x2336('0x2a')][_0x2336('0x46')](_0x1f10bf['body'],{})['then'](function(_0x1ec42c){var _0x45bded=_0x1f10bf[_0x2336('0x47')][_0x2336('0x22')]({'plain':!![]});if(!_0x45bded)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45bded['role']===_0x2336('0x47')){var _0x2773fb=_0x1ec42c['get']({'plain':!![]});var _0x1b0163='Variables';return db[_0x2336('0x48')]['find']({'where':{'name':_0x1b0163,'userProfileId':_0x45bded[_0x2336('0x49')]},'raw':!![]})[_0x2336('0x20')](function(_0x5e0d02){if(_0x5e0d02&&_0x5e0d02[_0x2336('0x4a')]===0x0){return db[_0x2336('0x24')][_0x2336('0x46')]({'name':_0x2773fb['name'],'resourceId':_0x2773fb['id'],'type':_0x5e0d02['name'],'sectionId':_0x5e0d02['id']},{})[_0x2336('0x20')](function(){return _0x1ec42c;});}else{return _0x1ec42c;}})[_0x2336('0x45')](function(_0x175699){logger[_0x2336('0x26')](_0x2336('0x4b'),_0x175699);throw _0x175699;});}return _0x1ec42c;})[_0x2336('0x20')](respondWithResult(_0x530d20,0xc9))[_0x2336('0x45')](handleError(_0x530d20,null));};exports['update']=function(_0x18b5ae,_0x45180a){if(_0x18b5ae[_0x2336('0x4c')]['id']){delete _0x18b5ae[_0x2336('0x4c')]['id'];}return db[_0x2336('0x2a')][_0x2336('0x44')]({'where':{'id':_0x18b5ae[_0x2336('0x4d')]['id']}})[_0x2336('0x20')](handleEntityNotFound(_0x45180a,null))[_0x2336('0x20')](saveUpdates(_0x18b5ae[_0x2336('0x4c')],null))[_0x2336('0x20')](respondWithResult(_0x45180a,null))[_0x2336('0x45')](handleError(_0x45180a,null));};exports['destroy']=function(_0x3d60ea,_0x271c98){return db['Variable'][_0x2336('0x44')]({'where':{'id':_0x3d60ea['params']['id']}})[_0x2336('0x20')](handleEntityNotFound(_0x271c98,null))[_0x2336('0x20')](removeEntity(_0x271c98,null))[_0x2336('0x45')](handleError(_0x271c98,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ff25733..a7d3e32 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 _0xf45e=['request-promise','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf45e,0x1a8));var _0xef45=function(_0x48cc91,_0x1b6962){_0x48cc91=_0x48cc91-0x0;var _0x3b9307=_0xf45e[_0x48cc91];return _0x3b9307;};'use strict';var _=require(_0xef45('0x0'));var util=require(_0xef45('0x1'));var logger=require(_0xef45('0x2'))(_0xef45('0x3'));var moment=require(_0xef45('0x4'));var BPromise=require('bluebird');var rp=require(_0xef45('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef45('0x6'));var attributes=require(_0xef45('0x7'));module[_0xef45('0x8')]=function(_0x1f96e9,_0xd5118b){return _0x1f96e9[_0xef45('0x9')]('Variable',attributes,{'tableName':_0xef45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dfc=['tools_variables','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define','Variable'];(function(_0x5cabd8,_0xf25ca0){var _0x23cadb=function(_0x37b5c1){while(--_0x37b5c1){_0x5cabd8['push'](_0x5cabd8['shift']());}};_0x23cadb(++_0xf25ca0);}(_0x2dfc,0x156));var _0xc2df=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dfc[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc2df('0x0'));var util=require(_0xc2df('0x1'));var logger=require(_0xc2df('0x2'))(_0xc2df('0x3'));var moment=require('moment');var BPromise=require(_0xc2df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2df('0x5'));var rimraf=require(_0xc2df('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xc2df('0x7')]=function(_0x279c1a,_0x323976){return _0x279c1a[_0xc2df('0x8')](_0xc2df('0x9'),attributes,{'tableName':_0xc2df('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 286d450..279af74 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x323455,_0xbd3d87){var _0x56e62d=function(_0x1707ce){while(--_0x1707ce){_0x323455['push'](_0x323455['shift']());}};_0x56e62d(++_0xbd3d87);}(_0xf494,0x1c6));var _0x4f49=function(_0x4268eb,_0x79c33b){_0x4268eb=_0x4268eb-0x0;var _0x98b2e2=_0xf494[_0x4268eb];return _0x98b2e2;};'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);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x13bb56,_0x556d2d){var _0x3e7022=function(_0x8a249){while(--_0x8a249){_0x13bb56['push'](_0x13bb56['shift']());}};_0x3e7022(++_0x556d2d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('Variable,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 26bd2ed..74e8964 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 _0x226f=['./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','../../components/auth/service'];(function(_0x13e0fc,_0x34132a){var _0x51309e=function(_0x2f46d9){while(--_0x2f46d9){_0x13e0fc['push'](_0x13e0fc['shift']());}};_0x51309e(++_0x34132a);}(_0x226f,0xff));var _0xf226=function(_0x4d5bc9,_0x3347d2){_0x4d5bc9=_0x4d5bc9-0x0;var _0x41083d=_0x226f[_0x4d5bc9];return _0x41083d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf226('0x0'));var controller=require(_0xf226('0x1'));router[_0xf226('0x2')]('/',controller[_0xf226('0x3')]);router[_0xf226('0x2')](_0xf226('0x4'),auth[_0xf226('0x5')](),auth[_0xf226('0x6')](),controller[_0xf226('0x7')]);router[_0xf226('0x2')]('/reset',auth['isAuthenticated'](),auth[_0xf226('0x6')](),controller[_0xf226('0x8')]);router[_0xf226('0x2')](_0xf226('0x9'),auth[_0xf226('0x5')](),auth[_0xf226('0x6')](),controller[_0xf226('0xa')]);router[_0xf226('0x2')](_0xf226('0xb'),auth['isAuthenticated'](),controller[_0xf226('0xc')]);router[_0xf226('0x2')](_0xf226('0xd'),controller[_0xf226('0xe')]);module[_0xf226('0xf')]=router; \ No newline at end of file +var _0x7bd2=['Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/migrations','exports','express'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7bd2,0xed));var _0x27bd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7bd2[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x27bd('0x0'));var router=express[_0x27bd('0x1')]();var auth=require(_0x27bd('0x2'));var controller=require(_0x27bd('0x3'));router[_0x27bd('0x4')]('/',controller[_0x27bd('0x5')]);router[_0x27bd('0x4')]('/fetch',auth[_0x27bd('0x6')](),auth[_0x27bd('0x7')](),controller['fetch']);router['get'](_0x27bd('0x8'),auth[_0x27bd('0x6')](),auth['canUpdate'](),controller[_0x27bd('0x9')]);router[_0x27bd('0x4')](_0x27bd('0xa'),auth[_0x27bd('0x6')](),auth[_0x27bd('0x7')](),controller[_0x27bd('0xb')]);router[_0x27bd('0x4')]('/restart',auth[_0x27bd('0x6')](),controller['restart']);router[_0x27bd('0x4')](_0x27bd('0xc'),controller['migrations']);module[_0x27bd('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 18cd164..5137f06 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 _0x79b7=['status','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','length','.js','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','json'];(function(_0x1afb1a,_0x256b1c){var _0x5205a1=function(_0x3634a4){while(--_0x3634a4){_0x1afb1a['push'](_0x1afb1a['shift']());}};_0x5205a1(++_0x256b1c);}(_0x79b7,0x1bf));var _0x779b=function(_0x2687d1,_0xf04d43){_0x2687d1=_0x2687d1-0x0;var _0x45591d=_0x79b7[_0x2687d1];return _0x45591d;};'use strict';var Umzug=require('umzug');var path=require(_0x779b('0x0'));var fs=require('fs');var _=require(_0x779b('0x1'));var pkginfo=require(_0x779b('0x2'))(module,'version');var compareVersions=require(_0x779b('0x3'));var exec=require(_0x779b('0x4'))[_0x779b('0x5')];var db=require(_0x779b('0x6'))['db'];var config=require(_0x779b('0x7'));var pm2=require(_0x779b('0x8'));var logger=require(_0x779b('0x9'))(_0x779b('0xa'));var git=require(_0x779b('0xb'))(config[_0x779b('0xc')]);exports[_0x779b('0xd')]=function(_0x38f01b,_0x1b8be1){var _0x22c93b={'current':module[_0x779b('0xe')][_0x779b('0xf')],'phonebar':0x2};if(_0x38f01b[_0x779b('0x10')]&&_0x38f01b[_0x779b('0x10')][_0x779b('0x11')]){return git[_0x779b('0x12')]()[_0x779b('0x13')](function(_0x4aa4cd,_0xa292ff){_0x22c93b[_0x779b('0x11')]=(_0x4aa4cd?module[_0x779b('0xe')]['version']:_0xa292ff[_0x779b('0x11')])||'2.0.0';return _0x1b8be1['status'](0xc8)[_0x779b('0x14')](_0x22c93b);});}else{return _0x1b8be1[_0x779b('0x15')](0xc8)['json'](_0x22c93b);}};exports[_0x779b('0x12')]=function(_0x3561b0,_0x43d261){return git['fetch']([_0x779b('0x16'),_0x779b('0x17')],function(_0x15a7ff){if(_0x15a7ff){logger[_0x779b('0x18')](_0x15a7ff);return _0x43d261[_0x779b('0x15')](0x1f4)[_0x779b('0x14')](_0x15a7ff);}logger[_0x779b('0x19')](_0x779b('0x1a'));return _0x43d261['status'](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x779b('0x1b')]=function(_0x5b7e2e,_0x2d2ff7){return git[_0x779b('0x1b')]([_0x779b('0x1c'),_0x779b('0x1d')],function(_0x583b19){if(_0x583b19){logger[_0x779b('0x18')](_0x583b19);return _0x2d2ff7[_0x779b('0x15')](0x1f4)[_0x779b('0x14')](_0x583b19);}logger[_0x779b('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x2d2ff7['status'](0xc8)[_0x779b('0x14')]({'output':_0x779b('0x1e')});});};exports[_0x779b('0x1f')]=function(_0x12ba23,_0x5994e9){exec('npm\x20install\x20--production',function(_0x5441aa,_0xe3c7da,_0x5c2bf7){logger[_0x779b('0x19')](_0xe3c7da);logger[_0x779b('0x19')](_0x5c2bf7);if(_0x5441aa){logger[_0x779b('0x18')](_0x5441aa);return _0x5994e9['status'](0x1f4)[_0x779b('0x14')](_0x5441aa);}return _0x5994e9['status'](0xc8)[_0x779b('0x14')]({'output':_0xe3c7da});});};exports['restart']=function(_0x2f1424,_0x566d31){return pm2[_0x779b('0x20')](_0x779b('0x21'))[_0x779b('0x22')](function(_0x423036){logger[_0x779b('0x19')]('pm2\x20restart\x20motion\x20%s',_0x423036);return _0x566d31[_0x779b('0x15')](0xc8)['json']({'output':_0x779b('0x23')});})[_0x779b('0x24')](function(_0x39ba5f){logger[_0x779b('0x18')](_0x39ba5f);return _0x566d31[_0x779b('0x15')](0x1f4)[_0x779b('0x14')](_0x39ba5f);});};exports['migrations']=function(_0x5dbd52,_0x1e760a){var _0x44111f=fs[_0x779b('0x25')](path[_0x779b('0x26')](config[_0x779b('0xc')],_0x779b('0x27'),'migrations'));var _0x268031=[];for(var _0x31375e=0x0;_0x31375e<_0x44111f[_0x779b('0x28')];_0x31375e++){var _0x18bb80=_0x44111f[_0x31375e]['replace'](_0x779b('0x29'),'');if(compareVersions(module[_0x779b('0xe')]['version'],_0x18bb80)===-0x1){_0x268031['push'](_0x18bb80);}}if(_0x268031[_0x779b('0x28')]){var _0x3f7ba9=_0x268031[_0x779b('0x2a')](compareVersions);var _0x234e30=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x779b('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0x779b('0x2c')][_0x779b('0x2d')](),db[_0x779b('0x2c')]['constructor'],function(){throw new Error(_0x779b('0x2e'));}],'path':path[_0x779b('0x26')](config[_0x779b('0xc')],_0x779b('0x27'),_0x779b('0x2f')),'pattern':/\.js$/}});_0x234e30['up']({'migrations':_['map'](_0x3f7ba9,function(_0x299d14){return _0x299d14+_0x779b('0x29');})})[_0x779b('0x22')](function(){return _0x1e760a['status'](0xc8)[_0x779b('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x779b('0xe')]['version']+_0x779b('0x30')+_[_0x779b('0x31')](_0x3f7ba9),'migrations':_[_0x779b('0x26')](_0x3f7ba9)});})[_0x779b('0x24')](function(_0x12af62){if(_0x12af62 instanceof db[_0x779b('0x2c')][_0x779b('0x32')]){return _0x1e760a[_0x779b('0x15')](0xc8)[_0x779b('0x14')]({'output':_0x779b('0x33')});}else{return _0x1e760a[_0x779b('0x15')](0x1f4)[_0x779b('0x14')](_0x12af62);}});}else{return _0x1e760a[_0x779b('0x15')](0xc8)[_0x779b('0x14')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x6947=['lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','simple-git','index','exports','query','latest','fetch','2.0.0','json','status','origin','master','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','root','server','length','.js','push','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path'];(function(_0x509355,_0x5d1a94){var _0x3635f3=function(_0x4ebffc){while(--_0x4ebffc){_0x509355['push'](_0x509355['shift']());}};_0x3635f3(++_0x5d1a94);}(_0x6947,0x1db));var _0x7694=function(_0x3712c0,_0x875fd4){_0x3712c0=_0x3712c0-0x0;var _0x394a3a=_0x6947[_0x3712c0];return _0x394a3a;};'use strict';var Umzug=require(_0x7694('0x0'));var path=require(_0x7694('0x1'));var fs=require('fs');var _=require(_0x7694('0x2'));var pkginfo=require(_0x7694('0x3'))(module,_0x7694('0x4'));var compareVersions=require(_0x7694('0x5'));var exec=require(_0x7694('0x6'))['exec'];var db=require(_0x7694('0x7'))['db'];var config=require(_0x7694('0x8'));var pm2=require(_0x7694('0x9'));var logger=require('../../config/logger')('update');var git=require(_0x7694('0xa'))(config['root']);exports[_0x7694('0xb')]=function(_0x19cf1a,_0x8f15ff){var _0x27b255={'current':module[_0x7694('0xc')][_0x7694('0x4')],'phonebar':0x2};if(_0x19cf1a[_0x7694('0xd')]&&_0x19cf1a[_0x7694('0xd')][_0x7694('0xe')]){return git[_0x7694('0xf')]()['tags'](function(_0x2691df,_0x5a57b9){_0x27b255[_0x7694('0xe')]=(_0x2691df?module[_0x7694('0xc')]['version']:_0x5a57b9[_0x7694('0xe')])||_0x7694('0x10');return _0x8f15ff['status'](0xc8)[_0x7694('0x11')](_0x27b255);});}else{return _0x8f15ff[_0x7694('0x12')](0xc8)[_0x7694('0x11')](_0x27b255);}};exports[_0x7694('0xf')]=function(_0x614322,_0xa198e3){return git['fetch']([_0x7694('0x13'),_0x7694('0x14')],function(_0x7524be){if(_0x7524be){logger[_0x7694('0x15')](_0x7524be);return _0xa198e3[_0x7694('0x12')](0x1f4)[_0x7694('0x11')](_0x7524be);}logger[_0x7694('0x16')](_0x7694('0x17'));return _0xa198e3[_0x7694('0x12')](0xc8)[_0x7694('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x7694('0x18')]=function(_0x11eaa8,_0x1d699a){return git[_0x7694('0x18')](['--hard',_0x7694('0x19')],function(_0x5dcb96){if(_0x5dcb96){logger['error'](_0x5dcb96);return _0x1d699a['status'](0x1f4)[_0x7694('0x11')](_0x5dcb96);}logger[_0x7694('0x16')](_0x7694('0x1a'));return _0x1d699a[_0x7694('0x12')](0xc8)[_0x7694('0x11')]({'output':_0x7694('0x1b')});});};exports[_0x7694('0x1c')]=function(_0x18781e,_0x2de949){exec(_0x7694('0x1d'),function(_0x3e0d73,_0x2e6249,_0xe94b2f){logger[_0x7694('0x16')](_0x2e6249);logger[_0x7694('0x16')](_0xe94b2f);if(_0x3e0d73){logger['error'](_0x3e0d73);return _0x2de949[_0x7694('0x12')](0x1f4)[_0x7694('0x11')](_0x3e0d73);}return _0x2de949['status'](0xc8)[_0x7694('0x11')]({'output':_0x2e6249});});};exports[_0x7694('0x1e')]=function(_0x416eda,_0x65ed49){return pm2['restart'](_0x7694('0x1f'))[_0x7694('0x20')](function(_0x280ee2){logger['info'](_0x7694('0x21'),_0x280ee2);return _0x65ed49[_0x7694('0x12')](0xc8)['json']({'output':_0x7694('0x22')});})[_0x7694('0x23')](function(_0x5035e3){logger['error'](_0x5035e3);return _0x65ed49[_0x7694('0x12')](0x1f4)[_0x7694('0x11')](_0x5035e3);});};exports['migrations']=function(_0x336015,_0x3f92d1){var _0x41b01f=fs[_0x7694('0x24')](path[_0x7694('0x25')](config[_0x7694('0x26')],_0x7694('0x27'),'migrations'));var _0x1201be=[];for(var _0x4141a1=0x0;_0x4141a1<_0x41b01f[_0x7694('0x28')];_0x4141a1++){var _0x3fa0d6=_0x41b01f[_0x4141a1]['replace'](_0x7694('0x29'),'');if(compareVersions(module['exports'][_0x7694('0x4')],_0x3fa0d6)===-0x1){_0x1201be[_0x7694('0x2a')](_0x3fa0d6);}}if(_0x1201be[_0x7694('0x28')]){var _0x31f5d3=_0x1201be[_0x7694('0x2b')](compareVersions);var _0x81750=new Umzug({'storage':_0x7694('0x2c'),'storageOptions':{'model':db[_0x7694('0x2d')],'modelName':_0x7694('0x2d'),'columnName':_0x7694('0x4')},'migrations':{'params':[db[_0x7694('0x2c')]['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error(_0x7694('0x2e'));}],'path':path[_0x7694('0x25')](config[_0x7694('0x26')],_0x7694('0x27'),_0x7694('0x2f')),'pattern':/\.js$/}});_0x81750['up']({'migrations':_[_0x7694('0x30')](_0x31f5d3,function(_0x175656){return _0x175656+_0x7694('0x29');})})[_0x7694('0x20')](function(){return _0x3f92d1[_0x7694('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x7694('0xc')]['version']+_0x7694('0x31')+_[_0x7694('0x32')](_0x31f5d3),'migrations':_['join'](_0x31f5d3)});})[_0x7694('0x23')](function(_0x2f0b5c){if(_0x2f0b5c instanceof db[_0x7694('0x2c')][_0x7694('0x33')]){return _0x3f92d1[_0x7694('0x12')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x3f92d1['status'](0x1f4)['json'](_0x2f0b5c);}});}else{return _0x3f92d1[_0x7694('0x12')](0xc8)['json']({'output':_0x7694('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9666ded..66029b1 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 _0xfe68=['describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe'];(function(_0x31b833,_0x2da1b4){var _0x52a7b3=function(_0x490716){while(--_0x490716){_0x31b833['push'](_0x31b833['shift']());}};_0x52a7b3(++_0x2da1b4);}(_0xfe68,0x1d7));var _0x8fe6=function(_0x2c6120,_0x1f3e60){_0x2c6120=_0x2c6120-0x0;var _0x5fb114=_0xfe68[_0x2c6120];return _0x5fb114;};'use strict';var multer=require('multer');var util=require(_0x8fe6('0x0'));var path=require(_0x8fe6('0x1'));var timeout=require(_0x8fe6('0x2'));var express=require(_0x8fe6('0x3'));var router=express['Router']();var fs_extra=require(_0x8fe6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8fe6('0x5'));var config=require(_0x8fe6('0x6'));var controller=require(_0x8fe6('0x7'));router['get']('/',auth[_0x8fe6('0x8')](),controller[_0x8fe6('0x9')]);router[_0x8fe6('0xa')](_0x8fe6('0xb'),auth[_0x8fe6('0x8')](),controller[_0x8fe6('0xc')]);router['get'](_0x8fe6('0xd'),auth[_0x8fe6('0x8')](),controller[_0x8fe6('0xe')]);router['post']('/',auth[_0x8fe6('0x8')](),controller[_0x8fe6('0xf')]);router[_0x8fe6('0x10')](_0x8fe6('0xd'),auth['isAuthenticated'](),controller[_0x8fe6('0x11')]);router[_0x8fe6('0x12')](_0x8fe6('0xd'),auth[_0x8fe6('0x8')](),controller[_0x8fe6('0x13')]);module[_0x8fe6('0x14')]=router; \ No newline at end of file +var _0x1550=['get','/describe','describe','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x1550,0xfb));var _0x0155=function(_0x448ecd,_0x1953b3){_0x448ecd=_0x448ecd-0x0;var _0x1561ed=_0x1550[_0x448ecd];return _0x1561ed;};'use strict';var multer=require(_0x0155('0x0'));var util=require(_0x0155('0x1'));var path=require('path');var timeout=require(_0x0155('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0155('0x3'));var auth=require(_0x0155('0x4'));var interaction=require(_0x0155('0x5'));var config=require(_0x0155('0x6'));var controller=require(_0x0155('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0155('0x8')]);router[_0x0155('0x9')](_0x0155('0xa'),auth['isAuthenticated'](),controller[_0x0155('0xb')]);router[_0x0155('0x9')](_0x0155('0xc'),auth[_0x0155('0xd')](),controller[_0x0155('0xe')]);router[_0x0155('0xf')]('/',auth[_0x0155('0xd')](),controller[_0x0155('0x10')]);router[_0x0155('0x11')](_0x0155('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0155('0xc'),auth[_0x0155('0xd')](),controller[_0x0155('0x12')]);module[_0x0155('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b9d3bd9..8ecbcd5 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 _0xbb35=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0xbb35,0x1d3));var _0x5bb3=function(_0xcb277c,_0x19d846){_0xcb277c=_0xcb277c-0x0;var _0x51d263=_0xbb35[_0xcb277c];return _0x51d263;};'use strict';var Sequelize=require('sequelize');module[_0x5bb3('0x0')]={'type':{'type':Sequelize[_0x5bb3('0x1')]},'uniqueid':{'type':Sequelize[_0x5bb3('0x1')]},'calleridnum':{'type':Sequelize[_0x5bb3('0x1')]},'calleridname':{'type':Sequelize[_0x5bb3('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5bb3('0x1')]},'membername':{'type':Sequelize[_0x5bb3('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5bb3('0x2')]},'agentconnectAt':{'type':Sequelize[_0x5bb3('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x5bb3('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x5bb3('0x2')]},'agentdumpAt':{'type':Sequelize[_0x5bb3('0x2')]},'holdtime':{'type':Sequelize[_0x5bb3('0x3')]},'agentcomplete':{'type':Sequelize[_0x5bb3('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5bb3('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5bb3('0x3')]},'agentacw':{'type':Sequelize[_0x5bb3('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5bb3('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x5bb3('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x5bb3('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5bb3('0x1')]},'connectedlinename':{'type':Sequelize[_0x5bb3('0x1')]},'language':{'type':Sequelize[_0x5bb3('0x1')]},'accountcode':{'type':Sequelize[_0x5bb3('0x1')]},'context':{'type':Sequelize[_0x5bb3('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5bb3('0x1')]},'destchannel':{'type':Sequelize[_0x5bb3('0x1')]},'destchannelstate':{'type':Sequelize[_0x5bb3('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x5bb3('0x1')]},'destcalleridname':{'type':Sequelize[_0x5bb3('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x5bb3('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x5bb3('0x1')]},'destlanguage':{'type':Sequelize[_0x5bb3('0x1')]},'destaccountcode':{'type':Sequelize[_0x5bb3('0x1')]},'destcontext':{'type':Sequelize[_0x5bb3('0x1')]},'destexten':{'type':Sequelize[_0x5bb3('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x5bb3('0x1')]},'transfer':{'type':Sequelize[_0x5bb3('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5bb3('0x1')],'comment':_0x5bb3('0x5')},'transferexten':{'type':Sequelize[_0x5bb3('0x1')]},'transferuniqueid':{'type':Sequelize[_0x5bb3('0x1')]},'agententerreason':{'type':Sequelize[_0x5bb3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf894=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x1bef07,_0x2a4e64){var _0x29edf6=function(_0x3e0230){while(--_0x3e0230){_0x1bef07['push'](_0x1bef07['shift']());}};_0x29edf6(++_0x2a4e64);}(_0xf894,0xfd));var _0x4f89=function(_0x49a50e,_0x1f4cc5){_0x49a50e=_0x49a50e-0x0;var _0x1c1df6=_0xf894[_0x49a50e];return _0x1c1df6;};'use strict';var Sequelize=require(_0x4f89('0x0'));module[_0x4f89('0x1')]={'type':{'type':Sequelize[_0x4f89('0x2')]},'uniqueid':{'type':Sequelize[_0x4f89('0x2')]},'calleridnum':{'type':Sequelize[_0x4f89('0x2')]},'calleridname':{'type':Sequelize[_0x4f89('0x2')]},'queue':{'type':Sequelize[_0x4f89('0x2')]},'interface':{'type':Sequelize[_0x4f89('0x2')]},'membername':{'type':Sequelize[_0x4f89('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4f89('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4f89('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4f89('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4f89('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4f89('0x3')]},'holdtime':{'type':Sequelize[_0x4f89('0x4')]},'agentcomplete':{'type':Sequelize[_0x4f89('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4f89('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4f89('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x4f89('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4f89('0x4')]},'reason':{'type':Sequelize[_0x4f89('0x2')]},'lastevent':{'type':Sequelize[_0x4f89('0x2')]},'channel':{'type':Sequelize[_0x4f89('0x2')]},'channelstate':{'type':Sequelize[_0x4f89('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4f89('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4f89('0x2')]},'context':{'type':Sequelize[_0x4f89('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4f89('0x2')]},'destchannel':{'type':Sequelize[_0x4f89('0x2')]},'destchannelstate':{'type':Sequelize[_0x4f89('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4f89('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4f89('0x2')]},'destcalleridname':{'type':Sequelize[_0x4f89('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4f89('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4f89('0x2')]},'destlanguage':{'type':Sequelize[_0x4f89('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4f89('0x2')]},'destexten':{'type':Sequelize[_0x4f89('0x2')]},'destpriority':{'type':Sequelize[_0x4f89('0x2')]},'destuniqueid':{'type':Sequelize[_0x4f89('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4f89('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4f89('0x2')]},'transfer':{'type':Sequelize[_0x4f89('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x4f89('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x4f89('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index e3c8f3d..849e7e8 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 00d6549..46a3ffe 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 _0x5075=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','define'];(function(_0x332d5c,_0x4a2336){var _0x47448d=function(_0x4a00f6){while(--_0x4a00f6){_0x332d5c['push'](_0x332d5c['shift']());}};_0x47448d(++_0x4a2336);}(_0x5075,0x73));var _0x5507=function(_0x49e77b,_0x59ced7){_0x49e77b=_0x49e77b-0x0;var _0x58b978=_0x5075[_0x49e77b];return _0x58b978;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require(_0x5507('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var attributes=require(_0x5507('0x9'));module['exports']=function(_0x5b6d7f,_0x2cd9ee){return _0x5b6d7f[_0x5507('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x5507('0xb'),'paranoid':![],'indexes':[{'fields':[_0x5507('0xc'),_0x5507('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdad2=['uniqueid','destuniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xdad2,0x14c));var _0x2dad=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdad2[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x2dad('0x0'));var logger=require(_0x2dad('0x1'))('api');var moment=require(_0x2dad('0x2'));var BPromise=require(_0x2dad('0x3'));var rp=require(_0x2dad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x2dad('0x7')]=function(_0x36a054,_0x27ca04){return _0x36a054[_0x2dad('0x8')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2dad('0x9'),_0x2dad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f686dc9..ce56e8b 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 _0xdaf9=['UpdateVoiceAgentReport','VoiceAgentReport','update','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','then'];(function(_0x4d1965,_0x43152e){var _0xdcfade=function(_0x3d3b8a){while(--_0x3d3b8a){_0x4d1965['push'](_0x4d1965['shift']());}};_0xdcfade(++_0x43152e);}(_0xdaf9,0xeb));var _0x9daf=function(_0x432e0b,_0x24fa14){_0x432e0b=_0x432e0b-0x0;var _0x7541bd=_0xdaf9[_0x432e0b];return _0x7541bd;};'use strict';var _=require('lodash');var util=require(_0x9daf('0x0'));var moment=require(_0x9daf('0x1'));var BPromise=require(_0x9daf('0x2'));var rs=require(_0x9daf('0x3'));var fs=require('fs');var Redis=require(_0x9daf('0x4'));var db=require(_0x9daf('0x5'))['db'];var utils=require(_0x9daf('0x6'));var logger=require(_0x9daf('0x7'))(_0x9daf('0x8'));var config=require(_0x9daf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9daf('0xa')][_0x9daf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e4c82,_0x55f956,_0x430887){return new BPromise(function(_0xaf4b17,_0x16cc6f){return client[_0x9daf('0xc')](_0x3e4c82,_0x430887)['then'](function(_0x374029){logger[_0x9daf('0xd')](_0x9daf('0xe'),_0x55f956,_0x9daf('0xf'));logger[_0x9daf('0x10')](_0x9daf('0x11'),_0x55f956,_0x9daf('0xf'),JSON[_0x9daf('0x12')](_0x374029));if(_0x374029[_0x9daf('0x13')]){if(_0x374029[_0x9daf('0x13')]['code']===0x1f4){logger[_0x9daf('0x13')](_0x9daf('0xe'),_0x55f956,_0x374029['error'][_0x9daf('0x14')]);return _0x16cc6f(_0x374029[_0x9daf('0x13')][_0x9daf('0x14')]);}logger[_0x9daf('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x55f956,_0x374029[_0x9daf('0x13')]['message']);return _0xaf4b17(_0x374029[_0x9daf('0x13')][_0x9daf('0x14')]);}else{logger[_0x9daf('0xd')](_0x9daf('0xe'),_0x55f956,'request\x20sent');_0xaf4b17(_0x374029[_0x9daf('0x15')][_0x9daf('0x14')]);}})[_0x9daf('0x16')](function(_0xd1016a){logger['error'](_0x9daf('0xe'),_0x55f956,_0xd1016a);_0x16cc6f(_0xd1016a);});});}exports[_0x9daf('0x17')]=function(_0xb8d61d){var _0x300b7b=this;return new Promise(function(_0x19f832,_0x568147){return db['VoiceAgentReport'][_0x9daf('0x18')](_0xb8d61d[_0x9daf('0x19')],{'raw':_0xb8d61d[_0x9daf('0x1a')]?_0xb8d61d[_0x9daf('0x1a')][_0x9daf('0x1b')]===undefined?!![]:![]:!![]})[_0x9daf('0x1c')](function(_0xa7fdc0){logger[_0x9daf('0xd')](_0x9daf('0x17'),_0xb8d61d);logger[_0x9daf('0x10')]('CreateVoiceAgentReport',_0xb8d61d,JSON[_0x9daf('0x12')](_0xa7fdc0));_0x19f832(_0xa7fdc0);})[_0x9daf('0x16')](function(_0x5981cf){logger[_0x9daf('0x13')]('CreateVoiceAgentReport',_0x5981cf[_0x9daf('0x14')],_0xb8d61d);_0x568147(_0x300b7b[_0x9daf('0x13')](0x1f4,_0x5981cf[_0x9daf('0x14')]));});});};exports[_0x9daf('0x1d')]=function(_0x4210bf){var _0x3f4e26=this;return new Promise(function(_0x5ab4f9,_0x5b0480){return db[_0x9daf('0x1e')][_0x9daf('0x1f')](_0x4210bf[_0x9daf('0x19')],{'raw':_0x4210bf[_0x9daf('0x1a')]?_0x4210bf[_0x9daf('0x1a')][_0x9daf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4210bf[_0x9daf('0x1a')]?_0x4210bf[_0x9daf('0x1a')][_0x9daf('0x20')]||null:null,'attributes':_0x4210bf[_0x9daf('0x1a')]?_0x4210bf[_0x9daf('0x1a')]['attributes']||null:null,'limit':_0x4210bf[_0x9daf('0x1a')]?_0x4210bf[_0x9daf('0x1a')]['limit']||null:null})[_0x9daf('0x1c')](function(_0x25ba83){logger[_0x9daf('0xd')]('UpdateVoiceAgentReport',_0x4210bf);logger['debug'](_0x9daf('0x1d'),_0x4210bf,JSON[_0x9daf('0x12')](_0x25ba83));_0x5ab4f9(_0x25ba83);})[_0x9daf('0x16')](function(_0x4c3ce3){logger[_0x9daf('0x13')]('UpdateVoiceAgentReport',_0x4c3ce3['message'],_0x4210bf);_0x5b0480(_0x3f4e26[_0x9daf('0x13')](0x1f4,_0x4c3ce3[_0x9daf('0x14')]));});});}; \ No newline at end of file +var _0x8022=['rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','debug','VoiceAgentReport','raw','where','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x26a532,_0x1f5fa4){var _0x279cc7=function(_0x220873){while(--_0x220873){_0x26a532['push'](_0x26a532['shift']());}};_0x279cc7(++_0x1f5fa4);}(_0x8022,0x1b2));var _0x2802=function(_0x53681d,_0x12099c){_0x53681d=_0x53681d-0x0;var _0x1961e1=_0x8022[_0x53681d];return _0x1961e1;};'use strict';var _=require(_0x2802('0x0'));var util=require(_0x2802('0x1'));var moment=require(_0x2802('0x2'));var BPromise=require('bluebird');var rs=require(_0x2802('0x3'));var fs=require('fs');var Redis=require(_0x2802('0x4'));var db=require(_0x2802('0x5'))['db'];var utils=require(_0x2802('0x6'));var logger=require(_0x2802('0x7'))(_0x2802('0x8'));var config=require(_0x2802('0x9'));var jayson=require(_0x2802('0xa'));var client=jayson[_0x2802('0xb')][_0x2802('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1470ff,_0x4aab94,_0x150477){return new BPromise(function(_0x106f50,_0x4e890d){return client['request'](_0x1470ff,_0x150477)[_0x2802('0xd')](function(_0x5d19ac){logger[_0x2802('0xe')](_0x2802('0xf'),_0x4aab94,'request\x20sent');logger['debug'](_0x2802('0x10'),_0x4aab94,_0x2802('0x11'),JSON[_0x2802('0x12')](_0x5d19ac));if(_0x5d19ac['error']){if(_0x5d19ac[_0x2802('0x13')][_0x2802('0x14')]===0x1f4){logger[_0x2802('0x13')](_0x2802('0xf'),_0x4aab94,_0x5d19ac['error'][_0x2802('0x15')]);return _0x4e890d(_0x5d19ac['error']['message']);}logger[_0x2802('0x13')](_0x2802('0xf'),_0x4aab94,_0x5d19ac[_0x2802('0x13')][_0x2802('0x15')]);return _0x106f50(_0x5d19ac[_0x2802('0x13')][_0x2802('0x15')]);}else{logger[_0x2802('0xe')](_0x2802('0xf'),_0x4aab94,'request\x20sent');_0x106f50(_0x5d19ac[_0x2802('0x16')]['message']);}})[_0x2802('0x17')](function(_0xfbccb7){logger[_0x2802('0x13')](_0x2802('0xf'),_0x4aab94,_0xfbccb7);_0x4e890d(_0xfbccb7);});});}exports[_0x2802('0x18')]=function(_0x4cff4c){var _0x1409a2=this;return new Promise(function(_0x436cb5,_0x1ef8e3){return db['VoiceAgentReport'][_0x2802('0x19')](_0x4cff4c[_0x2802('0x1a')],{'raw':_0x4cff4c[_0x2802('0x1b')]?_0x4cff4c['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a50c5){logger[_0x2802('0xe')](_0x2802('0x18'),_0x4cff4c);logger[_0x2802('0x1c')](_0x2802('0x18'),_0x4cff4c,JSON[_0x2802('0x12')](_0x1a50c5));_0x436cb5(_0x1a50c5);})[_0x2802('0x17')](function(_0x2edfb0){logger[_0x2802('0x13')](_0x2802('0x18'),_0x2edfb0['message'],_0x4cff4c);_0x1ef8e3(_0x1409a2['error'](0x1f4,_0x2edfb0[_0x2802('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x1911b1){var _0x47ae46=this;return new Promise(function(_0x324492,_0x1bbf35){return db[_0x2802('0x1d')]['update'](_0x1911b1[_0x2802('0x1a')],{'raw':_0x1911b1[_0x2802('0x1b')]?_0x1911b1[_0x2802('0x1b')][_0x2802('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1911b1[_0x2802('0x1b')]?_0x1911b1[_0x2802('0x1b')][_0x2802('0x1f')]||null:null,'attributes':_0x1911b1['options']?_0x1911b1[_0x2802('0x1b')]['attributes']||null:null,'limit':_0x1911b1[_0x2802('0x1b')]?_0x1911b1[_0x2802('0x1b')][_0x2802('0x20')]||null:null})[_0x2802('0xd')](function(_0x3eb34f){logger['info'](_0x2802('0x21'),_0x1911b1);logger['debug'](_0x2802('0x21'),_0x1911b1,JSON[_0x2802('0x12')](_0x3eb34f));_0x324492(_0x3eb34f);})[_0x2802('0x17')](function(_0x5e6161){logger[_0x2802('0x13')](_0x2802('0x21'),_0x5e6161['message'],_0x1911b1);_0x1bbf35(_0x47ae46[_0x2802('0x13')](0x1f4,_0x5e6161['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8d412ae..2230d98 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 _0xdc97=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0x16f2df,_0x23470a){var _0x5975f1=function(_0x741aff){while(--_0x741aff){_0x16f2df['push'](_0x16f2df['shift']());}};_0x5975f1(++_0x23470a);}(_0xdc97,0x13b));var _0x7dc9=function(_0x9f8db1,_0x386fb2){_0x9f8db1=_0x9f8db1-0x0;var _0x4694c1=_0xdc97[_0x9f8db1];return _0x4694c1;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0xe')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc949=['show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2a9df5,_0x39186e){var _0x34cf3d=function(_0x2b6732){while(--_0x2b6732){_0x2a9df5['push'](_0x2a9df5['shift']());}};_0x34cf3d(++_0x39186e);}(_0xc949,0x181));var _0x9c94=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xc949[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0x9c94('0x0'));var util=require('util');var path=require(_0x9c94('0x1'));var timeout=require(_0x9c94('0x2'));var express=require(_0x9c94('0x3'));var router=express[_0x9c94('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c94('0x5'));var interaction=require(_0x9c94('0x6'));var config=require('../../config/environment');var controller=require(_0x9c94('0x7'));router[_0x9c94('0x8')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xa')]);router['get'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xc')]);router[_0x9c94('0x8')](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xe')]);router[_0x9c94('0xf')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0x10')]);router['put'](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x11')]);router[_0x9c94('0x12')](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x13')]);module[_0x9c94('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 2d63fe6..8844e41 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 _0xeddd=['STRING','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x1b7953,_0x33b8d0){var _0xe7d0f1=function(_0x2355fe){while(--_0x2355fe){_0x1b7953['push'](_0x1b7953['shift']());}};_0xe7d0f1(++_0x33b8d0);}(_0xeddd,0x153));var _0xdedd=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xeddd[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xdedd('0x0'));module[_0xdedd('0x1')]={'uniqueid':{'type':Sequelize[_0xdedd('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0xdedd('0x3'),_0xdedd('0x4'),_0xdedd('0x5'),_0xdedd('0x6'),_0xdedd('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xdedd('0x2')]},'destination':{'type':Sequelize[_0xdedd('0x2')]},'destinationcontext':{'type':Sequelize[_0xdedd('0x2')]},'callerid':{'type':Sequelize[_0xdedd('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xdedd('0x2')]},'lastapplication':{'type':Sequelize[_0xdedd('0x2')]},'lastdata':{'type':Sequelize[_0xdedd('0x8')]},'starttime':{'type':Sequelize[_0xdedd('0x9')]},'systemanswertime':{'type':Sequelize[_0xdedd('0x9')]},'answertime':{'type':Sequelize[_0xdedd('0x9')]},'endtime':{'type':Sequelize[_0xdedd('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xdedd('0xa')]},'mohtime':{'type':Sequelize[_0xdedd('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdedd('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xdedd('0x2')]},'userDisposition':{'type':Sequelize[_0xdedd('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xdedd('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xdedd('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xdedd('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0cfa=['inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal'];(function(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0x0cfa,0x73));var _0xa0cf=function(_0x47c5d4,_0x43dbd8){_0x47c5d4=_0x47c5d4-0x0;var _0x1fd31f=_0x0cfa[_0x47c5d4];return _0x1fd31f;};'use strict';var Sequelize=require(_0xa0cf('0x0'));module[_0xa0cf('0x1')]={'uniqueid':{'type':Sequelize[_0xa0cf('0x2')]},'type':{'type':Sequelize[_0xa0cf('0x3')](_0xa0cf('0x4'),_0xa0cf('0x5'),'outbound',_0xa0cf('0x6'),'outbound-fax',_0xa0cf('0x7'))},'tag':{'type':Sequelize[_0xa0cf('0x2')]},'accountcode':{'type':Sequelize[_0xa0cf('0x2')]},'source':{'type':Sequelize[_0xa0cf('0x2')]},'destination':{'type':Sequelize[_0xa0cf('0x2')]},'destinationcontext':{'type':Sequelize[_0xa0cf('0x2')]},'callerid':{'type':Sequelize[_0xa0cf('0x2')]},'channel':{'type':Sequelize[_0xa0cf('0x2')]},'destinationchannel':{'type':Sequelize[_0xa0cf('0x2')]},'lastapplication':{'type':Sequelize[_0xa0cf('0x2')]},'lastdata':{'type':Sequelize[_0xa0cf('0x8')]},'starttime':{'type':Sequelize[_0xa0cf('0x9')]},'systemanswertime':{'type':Sequelize[_0xa0cf('0x9')]},'answertime':{'type':Sequelize[_0xa0cf('0x9')]},'endtime':{'type':Sequelize[_0xa0cf('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xa0cf('0xa')]},'mohtime':{'type':Sequelize[_0xa0cf('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xa0cf('0x2')]},'userfield':{'type':Sequelize[_0xa0cf('0x2')]},'userDisposition':{'type':Sequelize[_0xa0cf('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xa0cf('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xa0cf('0x2')]},'note':{'type':Sequelize[_0xa0cf('0x2')]},'prefix':{'type':Sequelize[_0xa0cf('0x2')]},'routeid':{'type':Sequelize[_0xa0cf('0xa')]},'sipcallid':{'type':Sequelize[_0xa0cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 54dc021..81fddcf 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x33a1e9,_0x5091f8){_0x33a1e9=_0x33a1e9-0x0;var _0x48b20a=_0x2032[_0x33a1e9];return _0x48b20a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0xadb5,0xad));var _0x5adb=function(_0x1eb49b,_0x3ad6db){_0x1eb49b=_0x1eb49b-0x0;var _0x1498de=_0xadb5[_0x1eb49b];return _0x1498de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3e5447a..2c4a774 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 _0x6192=['VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x56c570,_0x2d9da5){var _0x46c5a0=function(_0x520587){while(--_0x520587){_0x56c570['push'](_0x56c570['shift']());}};_0x46c5a0(++_0x2d9da5);}(_0x6192,0x1a2));var _0x2619=function(_0x49a5b9,_0x381eef){_0x49a5b9=_0x49a5b9-0x0;var _0x50b870=_0x6192[_0x49a5b9];return _0x50b870;};'use strict';var _=require(_0x2619('0x0'));var util=require(_0x2619('0x1'));var logger=require(_0x2619('0x2'))(_0x2619('0x3'));var moment=require('moment');var BPromise=require(_0x2619('0x4'));var rp=require(_0x2619('0x5'));var fs=require('fs');var path=require(_0x2619('0x6'));var rimraf=require(_0x2619('0x7'));var config=require(_0x2619('0x8'));var attributes=require(_0x2619('0x9'));module[_0x2619('0xa')]=function(_0x36afc5,_0x5e4c09){return _0x36afc5['define'](_0x2619('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x2619('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8339=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3e1829,_0xc8ccda){var _0x129345=function(_0x2357c0){while(--_0x2357c0){_0x3e1829['push'](_0x3e1829['shift']());}};_0x129345(++_0xc8ccda);}(_0x8339,0x180));var _0x9833=function(_0x383339,_0x3d185b){_0x383339=_0x383339-0x0;var _0x1f5132=_0x8339[_0x383339];return _0x1f5132;};'use strict';var _=require(_0x9833('0x0'));var util=require(_0x9833('0x1'));var logger=require(_0x9833('0x2'))(_0x9833('0x3'));var moment=require(_0x9833('0x4'));var BPromise=require(_0x9833('0x5'));var rp=require(_0x9833('0x6'));var fs=require('fs');var path=require(_0x9833('0x7'));var rimraf=require(_0x9833('0x8'));var config=require(_0x9833('0x9'));var attributes=require(_0x9833('0xa'));module[_0x9833('0xb')]=function(_0x14876f,_0x56bae4){return _0x14876f[_0x9833('0xc')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x9833('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index e08b660..c111020 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 _0x33c8=['stringify','error','code','message','info','VoiceCallReport,\x20%s,\x20%s','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','model','attributes','include','map','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0x258dd3,_0x303aa2){var _0x2f1f49=function(_0x5c70f6){while(--_0x5c70f6){_0x258dd3['push'](_0x258dd3['shift']());}};_0x2f1f49(++_0x303aa2);}(_0x33c8,0xb7));var _0x833c=function(_0x3ff222,_0x224155){_0x3ff222=_0x3ff222-0x0;var _0x5d1cb0=_0x33c8[_0x3ff222];return _0x5d1cb0;};'use strict';var _=require(_0x833c('0x0'));var util=require(_0x833c('0x1'));var moment=require(_0x833c('0x2'));var BPromise=require('bluebird');var rs=require(_0x833c('0x3'));var fs=require('fs');var Redis=require(_0x833c('0x4'));var db=require(_0x833c('0x5'))['db'];var utils=require(_0x833c('0x6'));var logger=require(_0x833c('0x7'))(_0x833c('0x8'));var config=require('../../config/environment');var jayson=require(_0x833c('0x9'));var client=jayson[_0x833c('0xa')][_0x833c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2662d6,_0x5bbfbb,_0x1f46eb){return new BPromise(function(_0x2f7745,_0x4358ec){return client[_0x833c('0xc')](_0x2662d6,_0x1f46eb)[_0x833c('0xd')](function(_0x466809){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5bbfbb,_0x833c('0xe'));logger[_0x833c('0xf')](_0x833c('0x10'),_0x5bbfbb,_0x833c('0xe'),JSON[_0x833c('0x11')](_0x466809));if(_0x466809[_0x833c('0x12')]){if(_0x466809[_0x833c('0x12')][_0x833c('0x13')]===0x1f4){logger[_0x833c('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x5bbfbb,_0x466809[_0x833c('0x12')][_0x833c('0x14')]);return _0x4358ec(_0x466809['error'][_0x833c('0x14')]);}logger[_0x833c('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x5bbfbb,_0x466809['error'][_0x833c('0x14')]);return _0x2f7745(_0x466809[_0x833c('0x12')][_0x833c('0x14')]);}else{logger[_0x833c('0x15')](_0x833c('0x16'),_0x5bbfbb,_0x833c('0xe'));_0x2f7745(_0x466809['result']['message']);}})[_0x833c('0x17')](function(_0x56e45f){logger[_0x833c('0x12')](_0x833c('0x16'),_0x5bbfbb,_0x56e45f);_0x4358ec(_0x56e45f);});});}exports[_0x833c('0x18')]=function(_0x361c61){var _0x301ceb=this;return new Promise(function(_0x203019,_0x229f75){return db[_0x833c('0x19')][_0x833c('0x1a')]({'raw':_0x361c61[_0x833c('0x1b')]?_0x361c61[_0x833c('0x1b')][_0x833c('0x1c')]===undefined?!![]:![]:!![],'where':_0x361c61[_0x833c('0x1b')]?_0x361c61[_0x833c('0x1b')][_0x833c('0x1d')]||null:null,'attributes':_0x361c61[_0x833c('0x1b')]?_0x361c61['options']['attributes']||null:null,'limit':_0x361c61[_0x833c('0x1b')]?_0x361c61[_0x833c('0x1b')][_0x833c('0x1e')]||null:null,'include':_0x361c61[_0x833c('0x1b')]?_0x361c61[_0x833c('0x1b')]['include']?_['map'](_0x361c61['options']['include'],function(_0x125b97){return{'model':db[_0x125b97[_0x833c('0x1f')]],'as':_0x125b97['as'],'attributes':_0x125b97[_0x833c('0x20')],'include':_0x125b97[_0x833c('0x21')]?_[_0x833c('0x22')](_0x125b97[_0x833c('0x21')],function(_0x45920f){return{'model':db[_0x45920f[_0x833c('0x1f')]],'as':_0x45920f['as'],'attributes':_0x45920f[_0x833c('0x20')],'include':_0x45920f[_0x833c('0x21')]?_['map'](_0x45920f[_0x833c('0x21')],function(_0x2e2715){return{'model':db[_0x2e2715['model']],'as':_0x2e2715['as'],'attributes':_0x2e2715['attributes']};}):[]};}):[]};}):[]:[]})[_0x833c('0xd')](function(_0x121576){logger['info']('GetVoiceCallReport',_0x361c61);logger[_0x833c('0xf')](_0x833c('0x18'),_0x361c61,JSON[_0x833c('0x11')](_0x121576));_0x203019(_0x121576);})[_0x833c('0x17')](function(_0x349c87){logger['error'](_0x833c('0x18'),_0x349c87[_0x833c('0x14')],_0x361c61);_0x229f75(_0x301ceb[_0x833c('0x12')](0x1f4,_0x349c87[_0x833c('0x14')]));});});};exports[_0x833c('0x23')]=function(_0x272b17){var _0x3258be=this;return new Promise(function(_0xea05c8,_0x1a576a){return db[_0x833c('0x19')][_0x833c('0x24')](_0x272b17[_0x833c('0x25')],{'raw':_0x272b17[_0x833c('0x1b')]?_0x272b17[_0x833c('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x36684a){logger['info'](_0x833c('0x23'),_0x272b17);logger[_0x833c('0xf')]('CreateVoiceCallReport',_0x272b17,JSON[_0x833c('0x11')](_0x36684a));_0xea05c8(_0x36684a);})['catch'](function(_0x4a19b2){logger['error']('CreateVoiceCallReport',_0x4a19b2[_0x833c('0x14')],_0x272b17);_0x1a576a(_0x3258be[_0x833c('0x12')](0x1f4,_0x4a19b2[_0x833c('0x14')]));});});};exports[_0x833c('0x26')]=function(_0x2e701a){var _0x573867=this;return new Promise(function(_0xc3192,_0x20eecc){return db['VoiceCallReport'][_0x833c('0x27')](_0x2e701a['body'],{'raw':_0x2e701a[_0x833c('0x1b')]?_0x2e701a[_0x833c('0x1b')][_0x833c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e701a[_0x833c('0x1b')]?_0x2e701a['options'][_0x833c('0x1d')]||null:null,'attributes':_0x2e701a[_0x833c('0x1b')]?_0x2e701a[_0x833c('0x1b')]['attributes']||null:null,'limit':_0x2e701a[_0x833c('0x1b')]?_0x2e701a['options']['limit']||null:null})[_0x833c('0xd')](function(_0x138988){logger[_0x833c('0x15')](_0x833c('0x26'),_0x2e701a);logger[_0x833c('0xf')]('UpdateVoiceCallReport',_0x2e701a,JSON[_0x833c('0x11')](_0x138988));_0xc3192(_0x138988);})[_0x833c('0x17')](function(_0x4c78cd){logger[_0x833c('0x12')](_0x833c('0x26'),_0x4c78cd[_0x833c('0x14')],_0x2e701a);_0x20eecc(_0x573867[_0x833c('0x12')](0x1f4,_0x4c78cd[_0x833c('0x14')]));});});}; \ No newline at end of file +var _0x07ff=['body','stringify','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateVoiceCallReport','create'];(function(_0x422d26,_0x733a0b){var _0x5b3cce=function(_0x154761){while(--_0x154761){_0x422d26['push'](_0x422d26['shift']());}};_0x5b3cce(++_0x733a0b);}(_0x07ff,0xe7));var _0xf07f=function(_0x313be9,_0x1de21d){_0x313be9=_0x313be9-0x0;var _0x2ebcd2=_0x07ff[_0x313be9];return _0x2ebcd2;};'use strict';var _=require(_0xf07f('0x0'));var util=require(_0xf07f('0x1'));var moment=require(_0xf07f('0x2'));var BPromise=require(_0xf07f('0x3'));var rs=require(_0xf07f('0x4'));var fs=require('fs');var Redis=require(_0xf07f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf07f('0x6'));var logger=require('../../config/logger')(_0xf07f('0x7'));var config=require(_0xf07f('0x8'));var jayson=require(_0xf07f('0x9'));var client=jayson['client'][_0xf07f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dbfbc,_0x4e8e51,_0x5111ac){return new BPromise(function(_0x314608,_0x4b0e6d){return client[_0xf07f('0xb')](_0x5dbfbc,_0x5111ac)[_0xf07f('0xc')](function(_0x535141){logger[_0xf07f('0xd')](_0xf07f('0xe'),_0x4e8e51,'request\x20sent');logger[_0xf07f('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x4e8e51,_0xf07f('0x10'),JSON['stringify'](_0x535141));if(_0x535141[_0xf07f('0x11')]){if(_0x535141['error'][_0xf07f('0x12')]===0x1f4){logger['error'](_0xf07f('0xe'),_0x4e8e51,_0x535141['error'][_0xf07f('0x13')]);return _0x4b0e6d(_0x535141[_0xf07f('0x11')][_0xf07f('0x13')]);}logger[_0xf07f('0x11')](_0xf07f('0xe'),_0x4e8e51,_0x535141[_0xf07f('0x11')]['message']);return _0x314608(_0x535141[_0xf07f('0x11')][_0xf07f('0x13')]);}else{logger[_0xf07f('0xd')](_0xf07f('0xe'),_0x4e8e51,'request\x20sent');_0x314608(_0x535141[_0xf07f('0x14')][_0xf07f('0x13')]);}})['catch'](function(_0x4028c2){logger[_0xf07f('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x4e8e51,_0x4028c2);_0x4b0e6d(_0x4028c2);});});}exports[_0xf07f('0x15')]=function(_0x1a2e88){var _0x57c47f=this;return new Promise(function(_0x3548a1,_0x33cf23){return db[_0xf07f('0x16')][_0xf07f('0x17')]({'raw':_0x1a2e88[_0xf07f('0x18')]?_0x1a2e88[_0xf07f('0x18')][_0xf07f('0x19')]===undefined?!![]:![]:!![],'where':_0x1a2e88[_0xf07f('0x18')]?_0x1a2e88['options'][_0xf07f('0x1a')]||null:null,'attributes':_0x1a2e88[_0xf07f('0x18')]?_0x1a2e88[_0xf07f('0x18')][_0xf07f('0x1b')]||null:null,'limit':_0x1a2e88['options']?_0x1a2e88[_0xf07f('0x18')][_0xf07f('0x1c')]||null:null,'include':_0x1a2e88[_0xf07f('0x18')]?_0x1a2e88[_0xf07f('0x18')][_0xf07f('0x1d')]?_[_0xf07f('0x1e')](_0x1a2e88[_0xf07f('0x18')]['include'],function(_0x3c23f8){return{'model':db[_0x3c23f8[_0xf07f('0x1f')]],'as':_0x3c23f8['as'],'attributes':_0x3c23f8['attributes'],'include':_0x3c23f8[_0xf07f('0x1d')]?_[_0xf07f('0x1e')](_0x3c23f8[_0xf07f('0x1d')],function(_0x26b2ec){return{'model':db[_0x26b2ec['model']],'as':_0x26b2ec['as'],'attributes':_0x26b2ec['attributes'],'include':_0x26b2ec[_0xf07f('0x1d')]?_[_0xf07f('0x1e')](_0x26b2ec['include'],function(_0x21e88f){return{'model':db[_0x21e88f['model']],'as':_0x21e88f['as'],'attributes':_0x21e88f[_0xf07f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf07f('0xc')](function(_0x3b588d){logger[_0xf07f('0xd')](_0xf07f('0x15'),_0x1a2e88);logger[_0xf07f('0xf')](_0xf07f('0x15'),_0x1a2e88,JSON['stringify'](_0x3b588d));_0x3548a1(_0x3b588d);})[_0xf07f('0x20')](function(_0x45f17b){logger[_0xf07f('0x11')]('GetVoiceCallReport',_0x45f17b[_0xf07f('0x13')],_0x1a2e88);_0x33cf23(_0x57c47f[_0xf07f('0x11')](0x1f4,_0x45f17b[_0xf07f('0x13')]));});});};exports[_0xf07f('0x21')]=function(_0x5823f7){var _0x504ea9=this;return new Promise(function(_0x73c0ff,_0x1bbaa7){return db[_0xf07f('0x16')][_0xf07f('0x22')](_0x5823f7[_0xf07f('0x23')],{'raw':_0x5823f7[_0xf07f('0x18')]?_0x5823f7[_0xf07f('0x18')][_0xf07f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3c98d1){logger[_0xf07f('0xd')]('CreateVoiceCallReport',_0x5823f7);logger[_0xf07f('0xf')](_0xf07f('0x21'),_0x5823f7,JSON[_0xf07f('0x24')](_0x3c98d1));_0x73c0ff(_0x3c98d1);})[_0xf07f('0x20')](function(_0x249e57){logger[_0xf07f('0x11')](_0xf07f('0x21'),_0x249e57['message'],_0x5823f7);_0x1bbaa7(_0x504ea9[_0xf07f('0x11')](0x1f4,_0x249e57['message']));});});};exports[_0xf07f('0x25')]=function(_0x197e69){var _0x14e048=this;return new Promise(function(_0x3b7491,_0x296a1f){return db['VoiceCallReport']['update'](_0x197e69[_0xf07f('0x23')],{'raw':_0x197e69[_0xf07f('0x18')]?_0x197e69[_0xf07f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x197e69['options']?_0x197e69[_0xf07f('0x18')][_0xf07f('0x1a')]||null:null,'attributes':_0x197e69[_0xf07f('0x18')]?_0x197e69[_0xf07f('0x18')]['attributes']||null:null,'limit':_0x197e69[_0xf07f('0x18')]?_0x197e69['options'][_0xf07f('0x1c')]||null:null})[_0xf07f('0xc')](function(_0x2a489c){logger['info'](_0xf07f('0x25'),_0x197e69);logger['debug'](_0xf07f('0x25'),_0x197e69,JSON[_0xf07f('0x24')](_0x2a489c));_0x3b7491(_0x2a489c);})[_0xf07f('0x20')](function(_0x1a4558){logger[_0xf07f('0x11')]('UpdateVoiceCallReport',_0x1a4558[_0xf07f('0x13')],_0x197e69);_0x296a1f(_0x14e048[_0xf07f('0x11')](0x1f4,_0x1a4558[_0xf07f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index f6eac14..dd0d448 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 _0x4321=['util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','put','update','destroy'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x4321,0x18c));var _0x1432=function(_0x47a7a8,_0x36d5b9){_0x47a7a8=_0x47a7a8-0x0;var _0x22a0bf=_0x4321[_0x47a7a8];return _0x22a0bf;};'use strict';var multer=require('multer');var util=require(_0x1432('0x0'));var path=require('path');var timeout=require(_0x1432('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1432('0x2'));var auth=require(_0x1432('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1432('0x4'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x1432('0x5')](),controller[_0x1432('0x6')]);router['get'](_0x1432('0x7'),auth[_0x1432('0x5')](),controller['show']);router['post']('/',auth[_0x1432('0x5')](),controller['create']);router[_0x1432('0x8')](_0x1432('0x7'),auth[_0x1432('0x5')](),controller[_0x1432('0x9')]);router['delete'](_0x1432('0x7'),auth[_0x1432('0x5')](),controller[_0x1432('0xa')]);module['exports']=router; \ No newline at end of file +var _0xd008=['post','create','/:id','update','delete','destroy','exports','multer','util','express','fs-extra','get','isAuthenticated','index','show'];(function(_0x3da241,_0xeba26a){var _0x43e156=function(_0x41ced1){while(--_0x41ced1){_0x3da241['push'](_0x3da241['shift']());}};_0x43e156(++_0xeba26a);}(_0xd008,0xe8));var _0x8d00=function(_0x61ec78,_0x319add){_0x61ec78=_0x61ec78-0x0;var _0x546732=_0xd008[_0x61ec78];return _0x546732;};'use strict';var multer=require(_0x8d00('0x0'));var util=require(_0x8d00('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8d00('0x2'));var router=express['Router']();var fs_extra=require(_0x8d00('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x8d00('0x4')]('/',auth[_0x8d00('0x5')](),controller[_0x8d00('0x6')]);router['get']('/:id',auth[_0x8d00('0x5')](),controller[_0x8d00('0x7')]);router[_0x8d00('0x8')]('/',auth[_0x8d00('0x5')](),controller[_0x8d00('0x9')]);router['put'](_0x8d00('0xa'),auth[_0x8d00('0x5')](),controller[_0x8d00('0xb')]);router[_0x8d00('0xc')](_0x8d00('0xa'),auth[_0x8d00('0x5')](),controller[_0x8d00('0xd')]);module[_0x8d00('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a50cce4..d112082 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 _0x8f25=['STRING','name','setDataValue','options','getDataValue','split','BOOLEAN','exports'];(function(_0x1cdb4e,_0x383e0d){var _0x40521f=function(_0x262dcd){while(--_0x262dcd){_0x1cdb4e['push'](_0x1cdb4e['shift']());}};_0x40521f(++_0x383e0d);}(_0x8f25,0x187));var _0x58f2=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8f25[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0x58f2('0x0')]={'name':{'type':Sequelize[_0x58f2('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x58f2('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x58f2('0x1')],'set':function(_0x3eb985){this[_0x58f2('0x3')](_0x58f2('0x4'),_0x3eb985?_0x3eb985['join'](''):[]);},'get':function(){return this[_0x58f2('0x5')]('options')?this[_0x58f2('0x5')](_0x58f2('0x4'))[_0x58f2('0x6')](''):[];}},'auth':{'type':Sequelize[_0x58f2('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x58f2('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x58f2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55c9=['sequelize','exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x55c9,0xab));var _0x955c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x55c9[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x955c('0x0'));module[_0x955c('0x1')]={'name':{'type':Sequelize[_0x955c('0x2')]},'prefix':{'type':Sequelize[_0x955c('0x2')],'unique':_0x955c('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x955c('0x2')],'set':function(_0x16af37){this['setDataValue'](_0x955c('0x4'),_0x16af37?_0x16af37[_0x955c('0x5')](''):[]);},'get':function(){return this[_0x955c('0x6')]('options')?this['getDataValue']('options')[_0x955c('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x955c('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x955c('0x2')]},'description':{'type':Sequelize[_0x955c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8c83ffa..f40ccc6 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 _0x8b2b=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','sendStatus','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x4df4f8,_0x176d52){var _0x2c7180=function(_0x3ea3cd){while(--_0x3ea3cd){_0x4df4f8['push'](_0x4df4f8['shift']());}};_0x2c7180(++_0x176d52);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x32f570,_0x4dcf72){_0x32f570=_0x32f570-0x0;var _0x25f0bc=_0x8b2b[_0x32f570];return _0x25f0bc;};'use strict';var emlformat=require(_0xb8b2('0x0'));var rimraf=require(_0xb8b2('0x1'));var zipdir=require(_0xb8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b2('0x3'));var moment=require(_0xb8b2('0x4'));var BPromise=require(_0xb8b2('0x5'));var Mustache=require(_0xb8b2('0x6'));var util=require(_0xb8b2('0x7'));var path=require(_0xb8b2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb8b2('0x9'));var fs=require('fs');var fs_extra=require(_0xb8b2('0xa'));var _=require(_0xb8b2('0xb'));var squel=require(_0xb8b2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8b2('0xd'));var toCsv=require(_0xb8b2('0xe'));var querystring=require(_0xb8b2('0xf'));var Papa=require(_0xb8b2('0x10'));var Redis=require(_0xb8b2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb8b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b2('0x13'))(_0xb8b2('0x14'));var utils=require(_0xb8b2('0x15'));var config=require(_0xb8b2('0x16'));var licenseUtil=require(_0xb8b2('0x17'));var db=require(_0xb8b2('0x18'))['db'];function respondWithStatusCode(_0x584d41,_0x3440bf){_0x3440bf=_0x3440bf||0xcc;return function(_0x5bd724){if(_0x5bd724){return _0x584d41['sendStatus'](_0x3440bf);}return _0x584d41['status'](_0x3440bf)[_0xb8b2('0x19')]();};}function respondWithResult(_0xdc1d1d,_0x48b9df){_0x48b9df=_0x48b9df||0xc8;return function(_0x175885){if(_0x175885){return _0xdc1d1d[_0xb8b2('0x1a')](_0x48b9df)[_0xb8b2('0x1b')](_0x175885);}};}function respondWithFilteredResult(_0x142fb0,_0x46a592){return function(_0x5b614d){if(_0x5b614d){var _0x4b5a28=typeof _0x46a592[_0xb8b2('0x1c')]===_0xb8b2('0x1d')&&typeof _0x46a592[_0xb8b2('0x1e')]===_0xb8b2('0x1d');var _0xf04672=_0x5b614d['count'];var _0x47b94f=_0x4b5a28?0x0:_0x46a592[_0xb8b2('0x1c')];var _0x153b69=_0x4b5a28?_0x5b614d[_0xb8b2('0x1f')]:_0x46a592[_0xb8b2('0x1c')]+_0x46a592['limit'];var _0x23af66;if(_0x153b69>=_0xf04672){_0x153b69=_0xf04672;_0x23af66=0xc8;}else{_0x23af66=0xce;}_0x142fb0[_0xb8b2('0x1a')](_0x23af66);return _0x142fb0[_0xb8b2('0x20')](_0xb8b2('0x21'),_0x47b94f+'-'+_0x153b69+'/'+_0xf04672)[_0xb8b2('0x1b')](_0x5b614d);}return null;};}function patchUpdates(_0x1cbc65){return function(_0x34ca46){try{jsonpatch['apply'](_0x34ca46,_0x1cbc65,!![]);}catch(_0x382bbf){return BPromise[_0xb8b2('0x22')](_0x382bbf);}return _0x34ca46[_0xb8b2('0x23')]();};}function saveUpdates(_0x162d41,_0x316d3c){return function(_0x5a0a43){if(_0x5a0a43){return _0x5a0a43[_0xb8b2('0x24')](_0x162d41)['then'](function(_0xe3b28){return _0xe3b28;});}return null;};}function removeEntity(_0x8239a7,_0x2b40f8){return function(_0x20082f){if(_0x20082f){return _0x20082f['destroy']()[_0xb8b2('0x25')](function(){var _0x2502ae=_0x20082f[_0xb8b2('0x26')]({'plain':!![]});var _0x5a2afe='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x5a2afe,'resourceId':_0x2502ae['id']}})[_0xb8b2('0x25')](function(){return _0x20082f;});})[_0xb8b2('0x25')](function(){_0x8239a7[_0xb8b2('0x1a')](0xcc)[_0xb8b2('0x19')]();});}};}function handleEntityNotFound(_0x14ba5c,_0x2026db){return function(_0x3f3424){if(!_0x3f3424){_0x14ba5c[_0xb8b2('0x27')](0x194);}return _0x3f3424;};}function handleError(_0xf5f561,_0x2bf940){_0x2bf940=_0x2bf940||0x1f4;return function(_0x2a236d){logger[_0xb8b2('0x28')](_0x2a236d[_0xb8b2('0x29')]);if(_0x2a236d[_0xb8b2('0x2a')]){delete _0x2a236d[_0xb8b2('0x2a')];}_0xf5f561[_0xb8b2('0x1a')](_0x2bf940)[_0xb8b2('0x2b')](_0x2a236d);};}exports['index']=function(_0x37ea31,_0x1899d9){var _0x42b97f={},_0x394359={},_0x21b008={'count':0x0,'rows':[]};var _0x493c16=_[_0xb8b2('0x2c')](db[_0xb8b2('0x2d')][_0xb8b2('0x2e')],function(_0x52d2e9){return{'name':_0x52d2e9[_0xb8b2('0x2f')],'type':_0x52d2e9[_0xb8b2('0x30')]['key']};});_0x394359[_0xb8b2('0x31')]=_[_0xb8b2('0x2c')](_0x493c16,_0xb8b2('0x2a'));_0x394359[_0xb8b2('0x32')]=_[_0xb8b2('0x33')](_0x37ea31[_0xb8b2('0x32')]);_0x394359[_0xb8b2('0x34')]=_[_0xb8b2('0x35')](_0x394359[_0xb8b2('0x31')],_0x394359[_0xb8b2('0x32')]);_0x42b97f['attributes']=_[_0xb8b2('0x35')](_0x394359[_0xb8b2('0x31')],qs['fields'](_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x36')]));_0x42b97f[_0xb8b2('0x37')]=_0x42b97f[_0xb8b2('0x37')][_0xb8b2('0x38')]?_0x42b97f[_0xb8b2('0x37')]:_0x394359[_0xb8b2('0x31')];if(!_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x39')](_0xb8b2('0x3a'))){_0x42b97f[_0xb8b2('0x1e')]=qs[_0xb8b2('0x1e')](_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x1e')]);_0x42b97f[_0xb8b2('0x1c')]=qs[_0xb8b2('0x1c')](_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x1c')]);}_0x42b97f[_0xb8b2('0x3b')]=qs[_0xb8b2('0x3c')](_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x3c')]);_0x42b97f[_0xb8b2('0x3d')]=qs[_0xb8b2('0x34')](_[_0xb8b2('0x3e')](_0x37ea31[_0xb8b2('0x32')],_0x394359[_0xb8b2('0x34')]),_0x493c16);if(_0x37ea31['query']['filter']){_0x42b97f[_0xb8b2('0x3d')]=_['merge'](_0x42b97f[_0xb8b2('0x3d')],{'$or':_[_0xb8b2('0x2c')](_0x493c16,function(_0x30c686){if(_0x30c686[_0xb8b2('0x30')]!=='VIRTUAL'){var _0x517473={};_0x517473[_0x30c686[_0xb8b2('0x2a')]]={'$like':'%'+_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x3f')]+'%'};return _0x517473;}})});}_0x42b97f=_[_0xb8b2('0x40')]({},_0x42b97f,_0x37ea31[_0xb8b2('0x41')]);var _0x4fa963={'where':_0x42b97f[_0xb8b2('0x3d')]};return db[_0xb8b2('0x2d')][_0xb8b2('0x1f')](_0x4fa963)[_0xb8b2('0x25')](function(_0x283eb5){_0x21b008['count']=_0x283eb5;if(_0x37ea31[_0xb8b2('0x32')][_0xb8b2('0x42')]){_0x42b97f[_0xb8b2('0x43')]=[{'all':!![]}];}return db[_0xb8b2('0x2d')][_0xb8b2('0x44')](_0x42b97f);})[_0xb8b2('0x25')](function(_0x37370a){_0x21b008[_0xb8b2('0x45')]=_0x37370a;return _0x21b008;})[_0xb8b2('0x25')](respondWithFilteredResult(_0x1899d9,_0x42b97f))[_0xb8b2('0x46')](handleError(_0x1899d9,null));};exports['show']=function(_0x486d4b,_0x419e3e){var _0x51756b={'raw':![],'where':{'id':_0x486d4b[_0xb8b2('0x47')]['id']}},_0x4651e2={};_0x4651e2[_0xb8b2('0x31')]=_[_0xb8b2('0x33')](db[_0xb8b2('0x2d')]['rawAttributes']);_0x4651e2[_0xb8b2('0x32')]=_[_0xb8b2('0x33')](_0x486d4b[_0xb8b2('0x32')]);_0x4651e2[_0xb8b2('0x34')]=_[_0xb8b2('0x35')](_0x4651e2[_0xb8b2('0x31')],_0x4651e2[_0xb8b2('0x32')]);_0x51756b[_0xb8b2('0x37')]=_[_0xb8b2('0x35')](_0x4651e2[_0xb8b2('0x31')],qs[_0xb8b2('0x36')](_0x486d4b['query'][_0xb8b2('0x36')]));_0x51756b[_0xb8b2('0x37')]=_0x51756b[_0xb8b2('0x37')][_0xb8b2('0x38')]?_0x51756b[_0xb8b2('0x37')]:_0x4651e2[_0xb8b2('0x31')];if(_0x486d4b[_0xb8b2('0x32')][_0xb8b2('0x42')]){_0x51756b[_0xb8b2('0x43')]=[{'all':!![]}];}_0x51756b=_[_0xb8b2('0x40')]({},_0x51756b,_0x486d4b[_0xb8b2('0x41')]);return db[_0xb8b2('0x2d')][_0xb8b2('0x48')](_0x51756b)['then'](handleEntityNotFound(_0x419e3e,null))[_0xb8b2('0x25')](respondWithResult(_0x419e3e,null))[_0xb8b2('0x46')](handleError(_0x419e3e,null));};exports['create']=function(_0x35b691,_0x2b9c9a){return db[_0xb8b2('0x2d')]['create'](_0x35b691[_0xb8b2('0x49')],{})[_0xb8b2('0x25')](function(_0x1f106a){var _0x2d0ed5=_0x35b691[_0xb8b2('0x4a')][_0xb8b2('0x26')]({'plain':!![]});if(!_0x2d0ed5)throw new Error(_0xb8b2('0x4b'));if(_0x2d0ed5[_0xb8b2('0x4c')]===_0xb8b2('0x4a')){var _0x3397b0=_0x1f106a[_0xb8b2('0x26')]({'plain':!![]});var _0x4434b3=_0xb8b2('0x4d');return db[_0xb8b2('0x4e')][_0xb8b2('0x48')]({'where':{'name':_0x4434b3,'userProfileId':_0x2d0ed5['userProfileId']},'raw':!![]})['then'](function(_0x46ab13){if(_0x46ab13&&_0x46ab13[_0xb8b2('0x4f')]===0x0){return db[_0xb8b2('0x50')][_0xb8b2('0x51')]({'name':_0x3397b0[_0xb8b2('0x2a')],'resourceId':_0x3397b0['id'],'type':_0x46ab13[_0xb8b2('0x2a')],'sectionId':_0x46ab13['id']},{})['then'](function(){return _0x1f106a;});}else{return _0x1f106a;}})[_0xb8b2('0x46')](function(_0x3a07b5){logger[_0xb8b2('0x28')](_0xb8b2('0x52'),_0x3a07b5);throw _0x3a07b5;});}return _0x1f106a;})[_0xb8b2('0x25')](respondWithResult(_0x2b9c9a,0xc9))[_0xb8b2('0x46')](handleError(_0x2b9c9a,null));};exports[_0xb8b2('0x24')]=function(_0x25ad26,_0x567892){if(_0x25ad26[_0xb8b2('0x49')]['id']){delete _0x25ad26['body']['id'];}return db[_0xb8b2('0x2d')][_0xb8b2('0x48')]({'where':{'id':_0x25ad26[_0xb8b2('0x47')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x567892,null))[_0xb8b2('0x25')](saveUpdates(_0x25ad26[_0xb8b2('0x49')],null))[_0xb8b2('0x25')](respondWithResult(_0x567892,null))['catch'](handleError(_0x567892,null));};exports[_0xb8b2('0x53')]=function(_0xf450d7,_0x1ad5d4){return db[_0xb8b2('0x2d')][_0xb8b2('0x48')]({'where':{'id':_0xf450d7['params']['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x1ad5d4,null))['then'](removeEntity(_0x1ad5d4,null))['catch'](handleError(_0x1ad5d4,null));}; \ No newline at end of file +var _0x292e=['VoiceChanSpy','rawAttributes','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','error','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index'];(function(_0x5d6f0f,_0x479b5e){var _0x253190=function(_0x56cbac){while(--_0x56cbac){_0x5d6f0f['push'](_0x5d6f0f['shift']());}};_0x253190(++_0x479b5e);}(_0x292e,0xcb));var _0xe292=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x292e[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xe292('0x0'));var rimraf=require(_0xe292('0x1'));var zipdir=require(_0xe292('0x2'));var jsonpatch=require(_0xe292('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe292('0x4'));var Mustache=require(_0xe292('0x5'));var util=require(_0xe292('0x6'));var path=require(_0xe292('0x7'));var sox=require('sox');var csv=require(_0xe292('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe292('0x9'));var _=require(_0xe292('0xa'));var squel=require(_0xe292('0xb'));var crypto=require(_0xe292('0xc'));var jsforce=require(_0xe292('0xd'));var deskjs=require(_0xe292('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe292('0xf'));var Redis=require(_0xe292('0x10'));var authService=require(_0xe292('0x11'));var qs=require(_0xe292('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe292('0x13'));var logger=require(_0xe292('0x14'))('api');var utils=require(_0xe292('0x15'));var config=require(_0xe292('0x16'));var licenseUtil=require(_0xe292('0x17'));var db=require(_0xe292('0x18'))['db'];function respondWithStatusCode(_0x221fcc,_0x3c73ea){_0x3c73ea=_0x3c73ea||0xcc;return function(_0x52ae8b){if(_0x52ae8b){return _0x221fcc[_0xe292('0x19')](_0x3c73ea);}return _0x221fcc[_0xe292('0x1a')](_0x3c73ea)[_0xe292('0x1b')]();};}function respondWithResult(_0x42265d,_0x1df3da){_0x1df3da=_0x1df3da||0xc8;return function(_0x2512fd){if(_0x2512fd){return _0x42265d[_0xe292('0x1a')](_0x1df3da)['json'](_0x2512fd);}};}function respondWithFilteredResult(_0xd12cdd,_0x1de9ec){return function(_0x51fa78){if(_0x51fa78){var _0x582549=typeof _0x1de9ec[_0xe292('0x1c')]===_0xe292('0x1d')&&typeof _0x1de9ec[_0xe292('0x1e')]===_0xe292('0x1d');var _0x48a1fa=_0x51fa78[_0xe292('0x1f')];var _0x52279d=_0x582549?0x0:_0x1de9ec[_0xe292('0x1c')];var _0x248e66=_0x582549?_0x51fa78['count']:_0x1de9ec[_0xe292('0x1c')]+_0x1de9ec[_0xe292('0x1e')];var _0x16bc68;if(_0x248e66>=_0x48a1fa){_0x248e66=_0x48a1fa;_0x16bc68=0xc8;}else{_0x16bc68=0xce;}_0xd12cdd['status'](_0x16bc68);return _0xd12cdd[_0xe292('0x20')](_0xe292('0x21'),_0x52279d+'-'+_0x248e66+'/'+_0x48a1fa)['json'](_0x51fa78);}return null;};}function patchUpdates(_0x2e310a){return function(_0x6298f5){try{jsonpatch[_0xe292('0x22')](_0x6298f5,_0x2e310a,!![]);}catch(_0x466bf2){return BPromise[_0xe292('0x23')](_0x466bf2);}return _0x6298f5[_0xe292('0x24')]();};}function saveUpdates(_0x4f133f,_0x1589eb){return function(_0x47813d){if(_0x47813d){return _0x47813d[_0xe292('0x25')](_0x4f133f)[_0xe292('0x26')](function(_0x21adb5){return _0x21adb5;});}return null;};}function removeEntity(_0x3677c4,_0x83d82e){return function(_0x13ae73){if(_0x13ae73){return _0x13ae73[_0xe292('0x27')]()['then'](function(){var _0x6a1a3a=_0x13ae73[_0xe292('0x28')]({'plain':!![]});var _0x4c4510='ChanSpies';return db[_0xe292('0x29')][_0xe292('0x27')]({'where':{'type':_0x4c4510,'resourceId':_0x6a1a3a['id']}})[_0xe292('0x26')](function(){return _0x13ae73;});})[_0xe292('0x26')](function(){_0x3677c4[_0xe292('0x1a')](0xcc)[_0xe292('0x1b')]();});}};}function handleEntityNotFound(_0x5b4304,_0xe54325){return function(_0xdbbf1a){if(!_0xdbbf1a){_0x5b4304[_0xe292('0x19')](0x194);}return _0xdbbf1a;};}function handleError(_0x469d37,_0x5dabfc){_0x5dabfc=_0x5dabfc||0x1f4;return function(_0x215705){logger['error'](_0x215705[_0xe292('0x2a')]);if(_0x215705[_0xe292('0x2b')]){delete _0x215705[_0xe292('0x2b')];}_0x469d37[_0xe292('0x1a')](_0x5dabfc)[_0xe292('0x2c')](_0x215705);};}exports[_0xe292('0x2d')]=function(_0x9dd4b7,_0x50ba74){var _0x42d441={},_0x147821={},_0x2137da={'count':0x0,'rows':[]};var _0x1b4648=_['map'](db[_0xe292('0x2e')][_0xe292('0x2f')],function(_0xdadd79){return{'name':_0xdadd79['fieldName'],'type':_0xdadd79[_0xe292('0x30')][_0xe292('0x31')]};});_0x147821['model']=_[_0xe292('0x32')](_0x1b4648,_0xe292('0x2b'));_0x147821['query']=_['keys'](_0x9dd4b7[_0xe292('0x33')]);_0x147821[_0xe292('0x34')]=_['intersection'](_0x147821['model'],_0x147821[_0xe292('0x33')]);_0x42d441[_0xe292('0x35')]=_[_0xe292('0x36')](_0x147821[_0xe292('0x37')],qs[_0xe292('0x38')](_0x9dd4b7['query'][_0xe292('0x38')]));_0x42d441[_0xe292('0x35')]=_0x42d441['attributes'][_0xe292('0x39')]?_0x42d441['attributes']:_0x147821[_0xe292('0x37')];if(!_0x9dd4b7[_0xe292('0x33')][_0xe292('0x3a')]('nolimit')){_0x42d441[_0xe292('0x1e')]=qs['limit'](_0x9dd4b7[_0xe292('0x33')][_0xe292('0x1e')]);_0x42d441[_0xe292('0x1c')]=qs[_0xe292('0x1c')](_0x9dd4b7[_0xe292('0x33')][_0xe292('0x1c')]);}_0x42d441[_0xe292('0x3b')]=qs[_0xe292('0x3c')](_0x9dd4b7[_0xe292('0x33')][_0xe292('0x3c')]);_0x42d441[_0xe292('0x3d')]=qs[_0xe292('0x34')](_[_0xe292('0x3e')](_0x9dd4b7[_0xe292('0x33')],_0x147821[_0xe292('0x34')]),_0x1b4648);if(_0x9dd4b7[_0xe292('0x33')][_0xe292('0x3f')]){_0x42d441['where']=_[_0xe292('0x40')](_0x42d441[_0xe292('0x3d')],{'$or':_[_0xe292('0x32')](_0x1b4648,function(_0x4e8092){if(_0x4e8092['type']!==_0xe292('0x41')){var _0x39f392={};_0x39f392[_0x4e8092[_0xe292('0x2b')]]={'$like':'%'+_0x9dd4b7['query']['filter']+'%'};return _0x39f392;}})});}_0x42d441=_[_0xe292('0x40')]({},_0x42d441,_0x9dd4b7[_0xe292('0x42')]);var _0x21c8c7={'where':_0x42d441[_0xe292('0x3d')]};return db[_0xe292('0x2e')][_0xe292('0x1f')](_0x21c8c7)['then'](function(_0x274802){_0x2137da['count']=_0x274802;if(_0x9dd4b7[_0xe292('0x33')][_0xe292('0x43')]){_0x42d441['include']=[{'all':!![]}];}return db[_0xe292('0x2e')]['findAll'](_0x42d441);})['then'](function(_0xe39fb4){_0x2137da[_0xe292('0x44')]=_0xe39fb4;return _0x2137da;})[_0xe292('0x26')](respondWithFilteredResult(_0x50ba74,_0x42d441))[_0xe292('0x45')](handleError(_0x50ba74,null));};exports[_0xe292('0x46')]=function(_0x3adcba,_0x29c065){var _0x2895d4={'raw':![],'where':{'id':_0x3adcba['params']['id']}},_0x5ce419={};_0x5ce419[_0xe292('0x37')]=_[_0xe292('0x47')](db[_0xe292('0x2e')][_0xe292('0x2f')]);_0x5ce419[_0xe292('0x33')]=_[_0xe292('0x47')](_0x3adcba[_0xe292('0x33')]);_0x5ce419['filters']=_[_0xe292('0x36')](_0x5ce419[_0xe292('0x37')],_0x5ce419['query']);_0x2895d4['attributes']=_[_0xe292('0x36')](_0x5ce419[_0xe292('0x37')],qs[_0xe292('0x38')](_0x3adcba['query'][_0xe292('0x38')]));_0x2895d4[_0xe292('0x35')]=_0x2895d4[_0xe292('0x35')][_0xe292('0x39')]?_0x2895d4[_0xe292('0x35')]:_0x5ce419[_0xe292('0x37')];if(_0x3adcba[_0xe292('0x33')][_0xe292('0x43')]){_0x2895d4['include']=[{'all':!![]}];}_0x2895d4=_[_0xe292('0x40')]({},_0x2895d4,_0x3adcba[_0xe292('0x42')]);return db[_0xe292('0x2e')][_0xe292('0x48')](_0x2895d4)[_0xe292('0x26')](handleEntityNotFound(_0x29c065,null))[_0xe292('0x26')](respondWithResult(_0x29c065,null))[_0xe292('0x45')](handleError(_0x29c065,null));};exports['create']=function(_0x42b065,_0x59ee5e){return db['VoiceChanSpy'][_0xe292('0x49')](_0x42b065[_0xe292('0x4a')],{})['then'](function(_0x110de2){var _0xec6352=_0x42b065[_0xe292('0x4b')][_0xe292('0x28')]({'plain':!![]});if(!_0xec6352)throw new Error(_0xe292('0x4c'));if(_0xec6352['role']===_0xe292('0x4b')){var _0x3dd1c9=_0x110de2['get']({'plain':!![]});var _0x5cee6c=_0xe292('0x4d');return db[_0xe292('0x4e')]['find']({'where':{'name':_0x5cee6c,'userProfileId':_0xec6352[_0xe292('0x4f')]},'raw':!![]})[_0xe292('0x26')](function(_0x5e7d04){if(_0x5e7d04&&_0x5e7d04[_0xe292('0x50')]===0x0){return db[_0xe292('0x29')][_0xe292('0x49')]({'name':_0x3dd1c9[_0xe292('0x2b')],'resourceId':_0x3dd1c9['id'],'type':_0x5e7d04[_0xe292('0x2b')],'sectionId':_0x5e7d04['id']},{})[_0xe292('0x26')](function(){return _0x110de2;});}else{return _0x110de2;}})[_0xe292('0x45')](function(_0x3e236f){logger[_0xe292('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e236f);throw _0x3e236f;});}return _0x110de2;})[_0xe292('0x26')](respondWithResult(_0x59ee5e,0xc9))[_0xe292('0x45')](handleError(_0x59ee5e,null));};exports['update']=function(_0x460b83,_0x121948){if(_0x460b83[_0xe292('0x4a')]['id']){delete _0x460b83[_0xe292('0x4a')]['id'];}return db['VoiceChanSpy'][_0xe292('0x48')]({'where':{'id':_0x460b83[_0xe292('0x52')]['id']}})[_0xe292('0x26')](handleEntityNotFound(_0x121948,null))[_0xe292('0x26')](saveUpdates(_0x460b83[_0xe292('0x4a')],null))[_0xe292('0x26')](respondWithResult(_0x121948,null))['catch'](handleError(_0x121948,null));};exports[_0xe292('0x27')]=function(_0x26c491,_0x5a0545){return db[_0xe292('0x2e')][_0xe292('0x48')]({'where':{'id':_0x26c491['params']['id']}})[_0xe292('0x26')](handleEntityNotFound(_0x5a0545,null))[_0xe292('0x26')](removeEntity(_0x5a0545,null))['catch'](handleError(_0x5a0545,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index cc1d833..d57ea9e 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 _0x06fb=['record','merge','MixMonitor','recordingFormat','auth','Authenticate','ChanSpy','name','options','join','push','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','bluebird','context','format','%s%s','prefix','system','Set','chanspy'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x06fb,0x18e));var _0xb06f=function(_0x57869b,_0x54672d){_0x57869b=_0x57869b-0x0;var _0x582bbb=_0x06fb[_0x57869b];return _0x582bbb;};'use strict';var _=require(_0xb06f('0x0'));var util=require('util');var BPromise=require(_0xb06f('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4aacb6,_0x519811,_0x2e91db){var _0x17f889=0x1;var _0x1148e9=[];var _0x5215bc={'context':_0x519811[_0xb06f('0x2')]||'from-sip','exten':util[_0xb06f('0x3')](_0xb06f('0x4'),_0x4aacb6[_0xb06f('0x5')],_0x2e91db),'type':_0xb06f('0x6'),'isApp':![],'ChanSpyId':_0x4aacb6['id'],'UserId':_0x519811['id']};_0x1148e9['push'](_['merge']({'app':_0xb06f('0x7'),'appdata':util[_0xb06f('0x3')]('CDR(type)=%s',_0xb06f('0x8')),'priority':_0x17f889++},_0x5215bc));if(_0x4aacb6[_0xb06f('0x9')]){_0x1148e9['push'](_[_0xb06f('0xa')]({'app':_0xb06f('0xb'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x4aacb6[_0xb06f('0xc')]),'priority':_0x17f889++},_0x5215bc));}if(_0x4aacb6[_0xb06f('0xd')]){_0x1148e9['push'](_[_0xb06f('0xa')]({'app':_0xb06f('0xe'),'appdata':_0x4aacb6['password'],'priority':_0x17f889++},_0x5215bc));}_0x1148e9['push'](_[_0xb06f('0xa')]({'app':_0xb06f('0xf'),'appdata':util['format']('SIP/%s,%s',_0x519811[_0xb06f('0x10')],_0x4aacb6[_0xb06f('0x11')]?_0x4aacb6[_0xb06f('0x11')][_0xb06f('0x12')](''):''),'priority':_0x17f889++},_0x5215bc));if(_0x4aacb6['record']){_0x1148e9[_0xb06f('0x13')](_[_0xb06f('0xa')]({'app':_0xb06f('0x14'),'priority':_0x17f889++},_0x5215bc));}return _0x1148e9;};var getChanSpyApplications=function(_0xd695aa,_0x184556){var _0x4f38a3=[];for(var _0x46c365=0x0,_0x166247=0x1;_0x46c365<_0x184556[_0xb06f('0x15')];_0x46c365++,_0x166247=0x1){_0x4f38a3=_0x4f38a3[_0xb06f('0x16')](getUserApplications(_0xd695aa,_0x184556[_0x46c365],_0x184556[_0x46c365][_0xb06f('0x17')]));if(_0x184556[_0x46c365][_0xb06f('0x17')]!=_0x184556[_0x46c365]['name']){_0x4f38a3=_0x4f38a3['concat'](getUserApplications(_0xd695aa,_0x184556[_0x46c365],_0x184556[_0x46c365][_0xb06f('0x10')]));}}return _0x4f38a3;};var getChanSpyPromise=function(_0x185a03,_0x158cbf){return new BPromise(function(_0x14a297,_0x3ea4a0){return _0x185a03[_0xb06f('0x18')][_0xb06f('0x19')]({'attributes':['id',_0xb06f('0x10'),_0xb06f('0x17')],'where':{'role':_0xb06f('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x19eee0){if(_0x19eee0){return _0x14a297(getChanSpyApplications(_0x158cbf,_0x19eee0));}return _0x14a297([]);})[_0xb06f('0x1b')](function(_0x54d6e2){_0x3ea4a0(_0x54d6e2);});});};module[_0xb06f('0x1c')]=function(_0x30ca81,_0x1f5501){var _0x113f04=_0x30ca81[_0xb06f('0x1d')];return _0x30ca81[_0xb06f('0x1e')](_0xb06f('0x1f'),attributes,{'tableName':_0xb06f('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7da1b6,_0x4df354,_0x1d054c){return getChanSpyPromise(_0x113f04,_0x7da1b6)[_0xb06f('0x21')](function(_0x3cb478){if(_0x3cb478&&_0x3cb478['length']){return _0x113f04[_0xb06f('0x22')][_0xb06f('0x23')](_0x3cb478);}})[_0xb06f('0x21')](function(){_0x1d054c();})[_0xb06f('0x1b')](function(_0x4e5664){_0x1d054c(_0x4e5664);});},'afterUpdate':function(_0x36fc0d,_0x462ea7,_0x4603de){return _0x113f04[_0xb06f('0x22')][_0xb06f('0x24')]({'where':{'ChanSpyId':_0x36fc0d['id']}})['then'](function(){return getChanSpyPromise(_0x113f04,_0x36fc0d);})[_0xb06f('0x21')](function(_0x589044){if(_0x589044&&_0x589044[_0xb06f('0x15')]){return _0x113f04['VoiceExtension'][_0xb06f('0x23')](_0x589044);}})[_0xb06f('0x21')](function(){_0x4603de();})[_0xb06f('0x1b')](function(_0x14d34d){_0x4603de(_0x14d34d);});},'afterDestroy':function(_0x53ce72,_0x38adc0,_0x2d5418){return _0x113f04[_0xb06f('0x22')][_0xb06f('0x24')]({'where':{'ChanSpyId':_0x53ce72['id']}})[_0xb06f('0x21')](function(){_0x2d5418();})[_0xb06f('0x1b')](function(_0x57aeef){_0x2d5418(_0x57aeef);});}}});}; \ No newline at end of file +var _0xa37b=['merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','options','join','length','concat','internal','name','findAll','agent','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','catch','lodash','util','bluebird','./voiceChanSpy.attributes','format','prefix','system','push','Set','CDR(type)=%s','chanspy','record'];(function(_0x1de1b3,_0x277a72){var _0x2af7ef=function(_0x497ffb){while(--_0x497ffb){_0x1de1b3['push'](_0x1de1b3['shift']());}};_0x2af7ef(++_0x277a72);}(_0xa37b,0x15c));var _0xba37=function(_0x53b37c,_0x1e3dae){_0x53b37c=_0x53b37c-0x0;var _0x912a5=_0xa37b[_0x53b37c];return _0x912a5;};'use strict';var _=require(_0xba37('0x0'));var util=require(_0xba37('0x1'));var BPromise=require(_0xba37('0x2'));var attributes=require(_0xba37('0x3'));var getUserApplications=function(_0x4cf11c,_0x2603c4,_0x331e00){var _0x3d2baa=0x1;var _0xa50a0e=[];var _0x2702b3={'context':_0x2603c4['context']||'from-sip','exten':util[_0xba37('0x4')]('%s%s',_0x4cf11c[_0xba37('0x5')],_0x331e00),'type':_0xba37('0x6'),'isApp':![],'ChanSpyId':_0x4cf11c['id'],'UserId':_0x2603c4['id']};_0xa50a0e[_0xba37('0x7')](_['merge']({'app':_0xba37('0x8'),'appdata':util[_0xba37('0x4')](_0xba37('0x9'),_0xba37('0xa')),'priority':_0x3d2baa++},_0x2702b3));if(_0x4cf11c[_0xba37('0xb')]){_0xa50a0e[_0xba37('0x7')](_[_0xba37('0xc')]({'app':_0xba37('0xd'),'appdata':util[_0xba37('0x4')](_0xba37('0xe'),_0x4cf11c[_0xba37('0xf')]),'priority':_0x3d2baa++},_0x2702b3));}if(_0x4cf11c['auth']){_0xa50a0e[_0xba37('0x7')](_['merge']({'app':'Authenticate','appdata':_0x4cf11c[_0xba37('0x10')],'priority':_0x3d2baa++},_0x2702b3));}_0xa50a0e[_0xba37('0x7')](_[_0xba37('0xc')]({'app':_0xba37('0x11'),'appdata':util[_0xba37('0x4')]('SIP/%s,%s',_0x2603c4['name'],_0x4cf11c[_0xba37('0x12')]?_0x4cf11c['options'][_0xba37('0x13')](''):''),'priority':_0x3d2baa++},_0x2702b3));if(_0x4cf11c[_0xba37('0xb')]){_0xa50a0e[_0xba37('0x7')](_[_0xba37('0xc')]({'app':'StopMixMonitor','priority':_0x3d2baa++},_0x2702b3));}return _0xa50a0e;};var getChanSpyApplications=function(_0x277f9a,_0x312d89){var _0x540cc6=[];for(var _0xa1cbda=0x0,_0x33a64c=0x1;_0xa1cbda<_0x312d89[_0xba37('0x14')];_0xa1cbda++,_0x33a64c=0x1){_0x540cc6=_0x540cc6[_0xba37('0x15')](getUserApplications(_0x277f9a,_0x312d89[_0xa1cbda],_0x312d89[_0xa1cbda]['internal']));if(_0x312d89[_0xa1cbda][_0xba37('0x16')]!=_0x312d89[_0xa1cbda][_0xba37('0x17')]){_0x540cc6=_0x540cc6[_0xba37('0x15')](getUserApplications(_0x277f9a,_0x312d89[_0xa1cbda],_0x312d89[_0xa1cbda]['name']));}}return _0x540cc6;};var getChanSpyPromise=function(_0x3dab15,_0x124be4){return new BPromise(function(_0x5a200f,_0x137ef7){return _0x3dab15['User'][_0xba37('0x18')]({'attributes':['id','name','internal'],'where':{'role':_0xba37('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4aebeb){if(_0x4aebeb){return _0x5a200f(getChanSpyApplications(_0x124be4,_0x4aebeb));}return _0x5a200f([]);})['catch'](function(_0x5eb7b0){_0x137ef7(_0x5eb7b0);});});};module[_0xba37('0x1a')]=function(_0x2e82ed,_0x44924b){var _0x406053=_0x2e82ed[_0xba37('0x1b')];return _0x2e82ed[_0xba37('0x1c')](_0xba37('0x1d'),attributes,{'tableName':_0xba37('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x566aa6,_0x217294,_0x398ed3){return getChanSpyPromise(_0x406053,_0x566aa6)[_0xba37('0x1f')](function(_0x419b78){if(_0x419b78&&_0x419b78[_0xba37('0x14')]){return _0x406053[_0xba37('0x20')][_0xba37('0x21')](_0x419b78);}})[_0xba37('0x1f')](function(){_0x398ed3();})['catch'](function(_0xbeca73){_0x398ed3(_0xbeca73);});},'afterUpdate':function(_0x2869ab,_0x473825,_0xd4b253){return _0x406053[_0xba37('0x20')][_0xba37('0x22')]({'where':{'ChanSpyId':_0x2869ab['id']}})[_0xba37('0x1f')](function(){return getChanSpyPromise(_0x406053,_0x2869ab);})[_0xba37('0x1f')](function(_0x399917){if(_0x399917&&_0x399917[_0xba37('0x14')]){return _0x406053[_0xba37('0x20')]['bulkCreate'](_0x399917);}})[_0xba37('0x1f')](function(){_0xd4b253();})[_0xba37('0x23')](function(_0x438ab7){_0xd4b253(_0x438ab7);});},'afterDestroy':function(_0x376476,_0x9d1036,_0x434e46){return _0x406053['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x376476['id']}})[_0xba37('0x1f')](function(){_0x434e46();})[_0xba37('0x23')](function(_0x40cf61){_0x434e46(_0x40cf61);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f51ea24..50255ce 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 _0xd757=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xd757,0x1e5));var _0x7d75=function(_0x188ab0,_0x17e9c9){_0x188ab0=_0x188ab0-0x0;var _0x5e94f7=_0xd757[_0x188ab0];return _0x5e94f7;};'use strict';var _=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var moment=require(_0x7d75('0x2'));var BPromise=require(_0x7d75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d75('0x4'))['db'];var utils=require(_0x7d75('0x5'));var logger=require('../../config/logger')(_0x7d75('0x6'));var config=require(_0x7d75('0x7'));var jayson=require(_0x7d75('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x108c0d,_0x3fde33,_0x1cf272){return new BPromise(function(_0x276fb0,_0x4030ee){return client[_0x7d75('0x9')](_0x108c0d,_0x1cf272)[_0x7d75('0xa')](function(_0x3720c7){logger[_0x7d75('0xb')](_0x7d75('0xc'),_0x3fde33,_0x7d75('0xd'));logger[_0x7d75('0xe')](_0x7d75('0xf'),_0x3fde33,'request\x20sent',JSON['stringify'](_0x3720c7));if(_0x3720c7[_0x7d75('0x10')]){if(_0x3720c7[_0x7d75('0x10')][_0x7d75('0x11')]===0x1f4){logger['error'](_0x7d75('0xc'),_0x3fde33,_0x3720c7[_0x7d75('0x10')]['message']);return _0x4030ee(_0x3720c7[_0x7d75('0x10')][_0x7d75('0x12')]);}logger[_0x7d75('0x10')](_0x7d75('0xc'),_0x3fde33,_0x3720c7[_0x7d75('0x10')][_0x7d75('0x12')]);return _0x276fb0(_0x3720c7['error'][_0x7d75('0x12')]);}else{logger[_0x7d75('0xb')](_0x7d75('0xc'),_0x3fde33,_0x7d75('0xd'));_0x276fb0(_0x3720c7[_0x7d75('0x13')][_0x7d75('0x12')]);}})['catch'](function(_0x15ba5f){logger['error'](_0x7d75('0xc'),_0x3fde33,_0x15ba5f);_0x4030ee(_0x15ba5f);});});} \ No newline at end of file +var _0x3eec=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','VoiceChanSpy,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x4704da,_0x4ff11b){_0x4704da=_0x4704da-0x0;var _0x46eef6=_0x3eec[_0x4704da];return _0x46eef6;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ee('0x4'));var db=require(_0xc3ee('0x5'))['db'];var utils=require(_0xc3ee('0x6'));var logger=require(_0xc3ee('0x7'))(_0xc3ee('0x8'));var config=require(_0xc3ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3ee('0xa')][_0xc3ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea4318,_0x2cc750,_0x356374){return new BPromise(function(_0x3d74c0,_0xd88f6){return client[_0xc3ee('0xc')](_0xea4318,_0x356374)[_0xc3ee('0xd')](function(_0x23e9c0){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x2cc750,_0xc3ee('0xe'));logger[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x2cc750,_0xc3ee('0xe'),JSON['stringify'](_0x23e9c0));if(_0x23e9c0[_0xc3ee('0x11')]){if(_0x23e9c0['error'][_0xc3ee('0x12')]===0x1f4){logger[_0xc3ee('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0xd88f6(_0x23e9c0['error'][_0xc3ee('0x13')]);}logger['error'](_0xc3ee('0x14'),_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0x3d74c0(_0x23e9c0[_0xc3ee('0x11')][_0xc3ee('0x13')]);}else{logger[_0xc3ee('0x15')](_0xc3ee('0x14'),_0x2cc750,_0xc3ee('0xe'));_0x3d74c0(_0x23e9c0[_0xc3ee('0x16')]['message']);}})[_0xc3ee('0x17')](function(_0x4eea89){logger[_0xc3ee('0x11')](_0xc3ee('0x14'),_0x2cc750,_0x4eea89);_0xd88f6(_0x4eea89);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3f8ed0f..1d695fe 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 _0xab05=['fs-extra','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1f53fc,_0x2af3f7){var _0x3544ac=function(_0x11b113){while(--_0x11b113){_0x1f53fc['push'](_0x1f53fc['shift']());}};_0x3544ac(++_0x2af3f7);}(_0xab05,0x11b));var _0x5ab0=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xab05[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x5ab0('0x0'));var util=require(_0x5ab0('0x1'));var path=require(_0x5ab0('0x2'));var timeout=require(_0x5ab0('0x3'));var express=require(_0x5ab0('0x4'));var router=express['Router']();var fs_extra=require(_0x5ab0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5ab0('0x6'));var config=require('../../config/environment');var controller=require(_0x5ab0('0x7'));router[_0x5ab0('0x8')]('/',auth[_0x5ab0('0x9')](),controller[_0x5ab0('0xa')]);router[_0x5ab0('0x8')]('/:id',auth[_0x5ab0('0x9')](),controller[_0x5ab0('0xb')]);router[_0x5ab0('0xc')]('/',auth[_0x5ab0('0x9')](),controller['create']);router['put'](_0x5ab0('0xd'),auth[_0x5ab0('0x9')](),controller[_0x5ab0('0xe')]);router[_0x5ab0('0xf')](_0x5ab0('0xd'),auth[_0x5ab0('0x9')](),controller[_0x5ab0('0x10')]);module[_0x5ab0('0x11')]=router; \ No newline at end of file +var _0x8e76=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4d9070,_0x2f1ab0){var _0x50d058=function(_0x3707fa){while(--_0x3707fa){_0x4d9070['push'](_0x4d9070['shift']());}};_0x50d058(++_0x2f1ab0);}(_0x8e76,0x9b));var _0x68e7=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x8e76[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0x68e7('0x0'));var util=require(_0x68e7('0x1'));var path=require(_0x68e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x68e7('0x3'));var router=express[_0x68e7('0x4')]();var fs_extra=require(_0x68e7('0x5'));var auth=require(_0x68e7('0x6'));var interaction=require(_0x68e7('0x7'));var config=require(_0x68e7('0x8'));var controller=require(_0x68e7('0x9'));router[_0x68e7('0xa')]('/',auth[_0x68e7('0xb')](),controller[_0x68e7('0xc')]);router['get']('/:id',auth[_0x68e7('0xb')](),controller[_0x68e7('0xd')]);router[_0x68e7('0xe')]('/',auth[_0x68e7('0xb')](),controller['create']);router['put'](_0x68e7('0xf'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x10')]);router[_0x68e7('0x11')]('/:id',auth[_0x68e7('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index e11f5b6..a3ddaeb 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 _0x14b1=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x2dfe22,_0xfeecdb){var _0x2202f=function(_0x2bc9fa){while(--_0x2bc9fa){_0x2dfe22['push'](_0x2dfe22['shift']());}};_0x2202f(++_0xfeecdb);}(_0x14b1,0x1e3));var _0x114b=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x14b1[_0x53c4f8];return _0x416458;};'use strict';var Sequelize=require(_0x114b('0x0'));module[_0x114b('0x1')]={'name':{'type':Sequelize[_0x114b('0x2')],'unique':_0x114b('0x3')},'description':{'type':Sequelize[_0x114b('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x114b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c8a=['STRING','BOOLEAN','sequelize'];(function(_0xefb553,_0x8e4285){var _0x5183e8=function(_0x551ffc){while(--_0x551ffc){_0xefb553['push'](_0xefb553['shift']());}};_0x5183e8(++_0x8e4285);}(_0x5c8a,0x17f));var _0xa5c8=function(_0x2ab8f2,_0x30f6e2){_0x2ab8f2=_0x2ab8f2-0x0;var _0x21f04d=_0x5c8a[_0x2ab8f2];return _0x21f04d;};'use strict';var Sequelize=require(_0xa5c8('0x0'));module['exports']={'name':{'type':Sequelize[_0xa5c8('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa5c8('0x2')],'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 81ce337..f7a51c7 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 _0x095e=['request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','request\x20sent','debug','code','error','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','Contexts','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','rows','catch','show','params','fields','merge','find','create','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findAll','join','utf8','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4cff29,_0x4b3cef){var _0x371627=function(_0x57eeed){while(--_0x57eeed){_0x4cff29['push'](_0x4cff29['shift']());}};_0x371627(++_0x4b3cef);}(_0x095e,0x1eb));var _0xe095=function(_0x3a9139,_0x3cdb8c){_0x3a9139=_0x3a9139-0x0;var _0x43eb4a=_0x095e[_0x3a9139];return _0x43eb4a;};'use strict';var emlformat=require(_0xe095('0x0'));var rimraf=require(_0xe095('0x1'));var zipdir=require(_0xe095('0x2'));var jsonpatch=require(_0xe095('0x3'));var rp=require(_0xe095('0x4'));var moment=require(_0xe095('0x5'));var BPromise=require(_0xe095('0x6'));var Mustache=require(_0xe095('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe095('0x8'));var csv=require(_0xe095('0x9'));var ejs=require(_0xe095('0xa'));var fs=require('fs');var fs_extra=require(_0xe095('0xb'));var _=require(_0xe095('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe095('0x9'));var querystring=require(_0xe095('0xd'));var Papa=require(_0xe095('0xe'));var Redis=require('ioredis');var authService=require(_0xe095('0xf'));var qs=require(_0xe095('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe095('0x11'))(_0xe095('0x12'));var utils=require(_0xe095('0x13'));var config=require(_0xe095('0x14'));var licenseUtil=require(_0xe095('0x15'));var db=require(_0xe095('0x16'))['db'];var jayson=require(_0xe095('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1064ae,_0x50aba3,_0xe3e25e,_0x32504a){return new BPromise(function(_0x4bd56f,_0x386482){var _0x567afb=_0x32504a||client;return _0x567afb[_0xe095('0x18')](_0x1064ae,_0xe3e25e)['then'](function(_0x4e336c){logger['info']('VoiceContext,\x20%s,\x20%s',_0x50aba3,_0xe095('0x19'));logger[_0xe095('0x1a')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x50aba3,_0xe095('0x19'),JSON['stringify'](_0x4e336c));if(_0x4e336c['error']){if(_0x4e336c['error'][_0xe095('0x1b')]===0x1f4){logger[_0xe095('0x1c')](_0xe095('0x1d'),_0x50aba3,_0x4e336c[_0xe095('0x1c')][_0xe095('0x1e')]);return _0x386482(_0x4e336c[_0xe095('0x1c')]['message']);}logger['error'](_0xe095('0x1d'),_0x50aba3,_0x4e336c[_0xe095('0x1c')][_0xe095('0x1e')]);return _0x4bd56f(_0x4e336c[_0xe095('0x1c')]['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x50aba3,'request\x20sent');_0x4bd56f(_0x4e336c[_0xe095('0x1f')][_0xe095('0x1e')]);}})['catch'](function(_0x495a30){logger[_0xe095('0x1c')](_0xe095('0x1d'),_0x50aba3,_0x495a30);_0x386482(_0x495a30);});});}function respondWithStatusCode(_0x31518e,_0x3d458e){_0x3d458e=_0x3d458e||0xcc;return function(_0x14f9db){if(_0x14f9db){return _0x31518e[_0xe095('0x20')](_0x3d458e);}return _0x31518e[_0xe095('0x21')](_0x3d458e)[_0xe095('0x22')]();};}function respondWithResult(_0x26f938,_0x55cc7a){_0x55cc7a=_0x55cc7a||0xc8;return function(_0x258f6e){if(_0x258f6e){return _0x26f938[_0xe095('0x21')](_0x55cc7a)[_0xe095('0x23')](_0x258f6e);}};}function respondWithFilteredResult(_0x45f46b,_0x446937){return function(_0xd0384b){if(_0xd0384b){var _0x2be05c=typeof _0x446937[_0xe095('0x24')]===_0xe095('0x25')&&typeof _0x446937['limit']===_0xe095('0x25');var _0x2d3509=_0xd0384b[_0xe095('0x26')];var _0x404b59=_0x2be05c?0x0:_0x446937['offset'];var _0xbee26e=_0x2be05c?_0xd0384b[_0xe095('0x26')]:_0x446937['offset']+_0x446937[_0xe095('0x27')];var _0x1064d2;if(_0xbee26e>=_0x2d3509){_0xbee26e=_0x2d3509;_0x1064d2=0xc8;}else{_0x1064d2=0xce;}_0x45f46b[_0xe095('0x21')](_0x1064d2);return _0x45f46b['set']('Content-Range',_0x404b59+'-'+_0xbee26e+'/'+_0x2d3509)[_0xe095('0x23')](_0xd0384b);}return null;};}function patchUpdates(_0x9978a3){return function(_0x134e1d){try{jsonpatch[_0xe095('0x28')](_0x134e1d,_0x9978a3,!![]);}catch(_0x1a6e6c){return BPromise[_0xe095('0x29')](_0x1a6e6c);}return _0x134e1d[_0xe095('0x2a')]();};}function saveUpdates(_0x240e57,_0x43e23c){return function(_0x2550c7){if(_0x2550c7){return _0x2550c7[_0xe095('0x2b')](_0x240e57)[_0xe095('0x2c')](function(_0x354c08){return _0x354c08;});}return null;};}function removeEntity(_0x3234b2,_0x572869){return function(_0x26dc29){if(_0x26dc29){return _0x26dc29[_0xe095('0x2d')]()[_0xe095('0x2c')](function(){var _0x39e954=_0x26dc29['get']({'plain':!![]});var _0xfb2477=_0xe095('0x2e');return db['UserProfileResource'][_0xe095('0x2d')]({'where':{'type':_0xfb2477,'resourceId':_0x39e954['id']}})[_0xe095('0x2c')](function(){return _0x26dc29;});})[_0xe095('0x2c')](function(){_0x3234b2[_0xe095('0x21')](0xcc)[_0xe095('0x22')]();});}};}function handleEntityNotFound(_0x12e6bb,_0x57d5fd){return function(_0x16a9e6){if(!_0x16a9e6){_0x12e6bb[_0xe095('0x20')](0x194);}return _0x16a9e6;};}function handleError(_0xcc8029,_0x94c488){_0x94c488=_0x94c488||0x1f4;return function(_0x4668f8){logger[_0xe095('0x1c')](_0x4668f8[_0xe095('0x2f')]);if(_0x4668f8[_0xe095('0x30')]){delete _0x4668f8['name'];}_0xcc8029[_0xe095('0x21')](_0x94c488)['send'](_0x4668f8);};}exports[_0xe095('0x31')]=function(_0x238ba5,_0xee1229){var _0x5af4a6={},_0x1a5cf2={},_0x1de742={'count':0x0,'rows':[]};var _0x221a33=_[_0xe095('0x32')](db[_0xe095('0x33')][_0xe095('0x34')],function(_0x159566){return{'name':_0x159566[_0xe095('0x35')],'type':_0x159566[_0xe095('0x36')][_0xe095('0x37')]};});_0x1a5cf2[_0xe095('0x38')]=_['map'](_0x221a33,_0xe095('0x30'));_0x1a5cf2[_0xe095('0x39')]=_[_0xe095('0x3a')](_0x238ba5[_0xe095('0x39')]);_0x1a5cf2[_0xe095('0x3b')]=_['intersection'](_0x1a5cf2[_0xe095('0x38')],_0x1a5cf2[_0xe095('0x39')]);_0x5af4a6[_0xe095('0x3c')]=_[_0xe095('0x3d')](_0x1a5cf2[_0xe095('0x38')],qs['fields'](_0x238ba5['query']['fields']));_0x5af4a6[_0xe095('0x3c')]=_0x5af4a6[_0xe095('0x3c')][_0xe095('0x3e')]?_0x5af4a6[_0xe095('0x3c')]:_0x1a5cf2['model'];if(!_0x238ba5[_0xe095('0x39')][_0xe095('0x3f')](_0xe095('0x40'))){_0x5af4a6[_0xe095('0x27')]=qs[_0xe095('0x27')](_0x238ba5[_0xe095('0x39')][_0xe095('0x27')]);_0x5af4a6[_0xe095('0x24')]=qs[_0xe095('0x24')](_0x238ba5['query'][_0xe095('0x24')]);}_0x5af4a6[_0xe095('0x41')]=qs[_0xe095('0x42')](_0x238ba5[_0xe095('0x39')]['sort']);_0x5af4a6[_0xe095('0x43')]=qs['filters'](_['pick'](_0x238ba5[_0xe095('0x39')],_0x1a5cf2[_0xe095('0x3b')]),_0x221a33);if(_0x238ba5[_0xe095('0x39')]['filter']){_0x5af4a6['where']=_['merge'](_0x5af4a6['where'],{'$or':_[_0xe095('0x32')](_0x221a33,function(_0x271519){if(_0x271519[_0xe095('0x36')]!=='VIRTUAL'){var _0x4f2c19={};_0x4f2c19[_0x271519[_0xe095('0x30')]]={'$like':'%'+_0x238ba5[_0xe095('0x39')][_0xe095('0x44')]+'%'};return _0x4f2c19;}})});}_0x5af4a6=_['merge']({},_0x5af4a6,_0x238ba5[_0xe095('0x45')]);var _0x1b236a={'where':_0x5af4a6[_0xe095('0x43')]};return db[_0xe095('0x33')][_0xe095('0x26')](_0x1b236a)['then'](function(_0x5ac1a6){_0x1de742[_0xe095('0x26')]=_0x5ac1a6;if(_0x238ba5[_0xe095('0x39')][_0xe095('0x46')]){_0x5af4a6[_0xe095('0x47')]=[{'all':!![]}];}return db[_0xe095('0x33')]['findAll'](_0x5af4a6);})['then'](function(_0x2f64ab){_0x1de742[_0xe095('0x48')]=_0x2f64ab;return _0x1de742;})[_0xe095('0x2c')](respondWithFilteredResult(_0xee1229,_0x5af4a6))[_0xe095('0x49')](handleError(_0xee1229,null));};exports[_0xe095('0x4a')]=function(_0x122ff3,_0x1864cd){var _0x3a8780={'raw':![],'where':{'id':_0x122ff3[_0xe095('0x4b')]['id']}},_0x3fdaa4={};_0x3fdaa4[_0xe095('0x38')]=_[_0xe095('0x3a')](db['VoiceContext'][_0xe095('0x34')]);_0x3fdaa4[_0xe095('0x39')]=_['keys'](_0x122ff3[_0xe095('0x39')]);_0x3fdaa4['filters']=_[_0xe095('0x3d')](_0x3fdaa4['model'],_0x3fdaa4[_0xe095('0x39')]);_0x3a8780['attributes']=_[_0xe095('0x3d')](_0x3fdaa4['model'],qs[_0xe095('0x4c')](_0x122ff3[_0xe095('0x39')][_0xe095('0x4c')]));_0x3a8780['attributes']=_0x3a8780[_0xe095('0x3c')]['length']?_0x3a8780[_0xe095('0x3c')]:_0x3fdaa4[_0xe095('0x38')];if(_0x122ff3[_0xe095('0x39')]['includeAll']){_0x3a8780['include']=[{'all':!![]}];}_0x3a8780=_[_0xe095('0x4d')]({},_0x3a8780,_0x122ff3[_0xe095('0x45')]);return db[_0xe095('0x33')][_0xe095('0x4e')](_0x3a8780)[_0xe095('0x2c')](handleEntityNotFound(_0x1864cd,null))[_0xe095('0x2c')](respondWithResult(_0x1864cd,null))[_0xe095('0x49')](handleError(_0x1864cd,null));};exports[_0xe095('0x4f')]=function(_0x66e31c,_0x4a150a,_0x3a0fd3){var _0x811321;return db[_0xe095('0x33')]['create'](_0x66e31c['body'],{'raw':!![]})[_0xe095('0x2c')](function(_0xbaa868){_0x811321=_0xbaa868;return db[_0xe095('0x33')]['findAll']({'raw':!![]});})[_0xe095('0x2c')](function(_0x24b2a1){var _0x5f3f57=fs[_0xe095('0x50')](path['join'](config[_0xe095('0x51')],_0xe095('0x52')),'utf8');var _0x5a34e7=ejs[_0xe095('0x53')](_0x5f3f57,{'contexts':_0x24b2a1||[]});fs[_0xe095('0x54')](_0xe095('0x55'),_0x5a34e7);})[_0xe095('0x2c')](function(){return respondWithRpcPromise(_0xe095('0x56'),_0xe095('0x4f'),{'module':_0xe095('0x57')});})[_0xe095('0x2c')](function(){var _0x5c2528=_0x66e31c[_0xe095('0x58')][_0xe095('0x59')]({'plain':!![]});if(!_0x5c2528)throw new Error(_0xe095('0x5a'));if(_0x5c2528['role']===_0xe095('0x58')){var _0xe32bed=_0x811321[_0xe095('0x59')]({'plain':!![]});return db[_0xe095('0x5b')][_0xe095('0x4e')]({'where':{'name':_0xe095('0x2e'),'userProfileId':_0x5c2528[_0xe095('0x5c')]},'raw':!![]})[_0xe095('0x2c')](function(_0x3b5200){if(_0x3b5200&&_0x3b5200[_0xe095('0x5d')]===0x0){return db['UserProfileResource'][_0xe095('0x4f')]({'name':_0xe32bed[_0xe095('0x30')],'resourceId':_0xe32bed['id'],'type':_0x3b5200['name'],'sectionId':_0x3b5200['id']},{})[_0xe095('0x2c')](function(){return _0x811321;});}else{return _0x811321;}})[_0xe095('0x49')](function(_0x52f6f7){logger[_0xe095('0x1c')](_0xe095('0x5e'),_0x52f6f7);throw _0x52f6f7;});}return _0x811321;})[_0xe095('0x2c')](respondWithResult(_0x4a150a,0xc9))['catch'](handleError(_0x4a150a,null));};exports[_0xe095('0x2b')]=function(_0x201064,_0x3c46ee,_0x4afaae){var _0x20712c;return db[_0xe095('0x33')][_0xe095('0x4e')]({'where':{'id':_0x201064[_0xe095('0x4b')]['id']}})[_0xe095('0x2c')](handleEntityNotFound(_0x3c46ee,null))[_0xe095('0x2c')](saveUpdates(_0x201064[_0xe095('0x5f')],null))['then'](function(_0x4a0e3a){if(_0x4a0e3a){_0x20712c=_0x4a0e3a;return db[_0xe095('0x33')][_0xe095('0x60')]({'raw':!![]});}})[_0xe095('0x2c')](function(_0x14941a){var _0x4232d4=fs['readFileSync'](path[_0xe095('0x61')](config[_0xe095('0x51')],'server/files/templates/context.ejs'),_0xe095('0x62'));var _0x55f126=ejs[_0xe095('0x53')](_0x4232d4,{'contexts':_0x14941a||[]});fs[_0xe095('0x54')](_0xe095('0x55'),_0x55f126);})['then'](function(){return respondWithRpcPromise('Reload',_0xe095('0x2b'),{'module':_0xe095('0x57')});})[_0xe095('0x2c')](function(){return _0x20712c;})['then'](respondWithResult(_0x3c46ee,null))[_0xe095('0x49')](handleError(_0x3c46ee,null));};exports[_0xe095('0x2d')]=function(_0x3fe123,_0x1b21a7,_0x1444aa){var _0x3034ad;return db[_0xe095('0x33')][_0xe095('0x4e')]({'where':{'id':_0x3fe123[_0xe095('0x4b')]['id']}})[_0xe095('0x2c')](handleEntityNotFound(_0x1b21a7,null))[_0xe095('0x2c')](removeEntity(_0x1b21a7,null))['then'](function(){return db['VoiceContext'][_0xe095('0x60')]({'raw':!![]});})['then'](function(_0x39a2e5){var _0x4c0282=fs[_0xe095('0x50')](path[_0xe095('0x61')](config[_0xe095('0x51')],_0xe095('0x52')),_0xe095('0x62'));var _0x2d2c61=ejs['render'](_0x4c0282,{'contexts':_0x39a2e5});fs[_0xe095('0x54')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2d2c61);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});})[_0xe095('0x49')](handleError(_0x1b21a7,null));}; \ No newline at end of file +var _0x8109=['include','findAll','rows','show','find','create','body','join','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','readFileSync','utf8','render','update','params','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','destroy','get','Contexts','name','send','index','map','VoiceContext','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll'];(function(_0x12af74,_0x4fb5c2){var _0x41277b=function(_0x43d427){while(--_0x43d427){_0x12af74['push'](_0x12af74['shift']());}};_0x41277b(++_0x4fb5c2);}(_0x8109,0x144));var _0x9810=function(_0x27fd0e,_0x3adf08){_0x27fd0e=_0x27fd0e-0x0;var _0x40b024=_0x8109[_0x27fd0e];return _0x40b024;};'use strict';var emlformat=require(_0x9810('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9810('0x1'));var jsonpatch=require(_0x9810('0x2'));var rp=require(_0x9810('0x3'));var moment=require(_0x9810('0x4'));var BPromise=require(_0x9810('0x5'));var Mustache=require(_0x9810('0x6'));var util=require(_0x9810('0x7'));var path=require(_0x9810('0x8'));var sox=require(_0x9810('0x9'));var csv=require('to-csv');var ejs=require(_0x9810('0xa'));var fs=require('fs');var fs_extra=require(_0x9810('0xb'));var _=require('lodash');var squel=require(_0x9810('0xc'));var crypto=require('crypto');var jsforce=require(_0x9810('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9810('0xe'));var querystring=require(_0x9810('0xf'));var Papa=require(_0x9810('0x10'));var Redis=require('ioredis');var authService=require(_0x9810('0x11'));var qs=require(_0x9810('0x12'));var as=require(_0x9810('0x13'));var hardwareService=require(_0x9810('0x14'));var logger=require('../../config/logger')(_0x9810('0x15'));var utils=require(_0x9810('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9810('0x17'))['db'];var jayson=require(_0x9810('0x18'));var client=jayson['client'][_0x9810('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4f25d6,_0x4578fb,_0x5626ec,_0x52ab81){return new BPromise(function(_0x783231,_0x2a34b4){var _0x19355a=_0x52ab81||client;return _0x19355a[_0x9810('0x1a')](_0x4f25d6,_0x5626ec)[_0x9810('0x1b')](function(_0x473f47){logger[_0x9810('0x1c')](_0x9810('0x1d'),_0x4578fb,_0x9810('0x1e'));logger[_0x9810('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4578fb,'request\x20sent',JSON[_0x9810('0x20')](_0x473f47));if(_0x473f47[_0x9810('0x21')]){if(_0x473f47[_0x9810('0x21')]['code']===0x1f4){logger[_0x9810('0x21')](_0x9810('0x1d'),_0x4578fb,_0x473f47[_0x9810('0x21')]['message']);return _0x2a34b4(_0x473f47[_0x9810('0x21')][_0x9810('0x22')]);}logger['error'](_0x9810('0x1d'),_0x4578fb,_0x473f47['error'][_0x9810('0x22')]);return _0x783231(_0x473f47[_0x9810('0x21')][_0x9810('0x22')]);}else{logger['info'](_0x9810('0x1d'),_0x4578fb,_0x9810('0x1e'));_0x783231(_0x473f47[_0x9810('0x23')][_0x9810('0x22')]);}})[_0x9810('0x24')](function(_0x21703a){logger[_0x9810('0x21')](_0x9810('0x1d'),_0x4578fb,_0x21703a);_0x2a34b4(_0x21703a);});});}function respondWithStatusCode(_0x3027e5,_0x26dd10){_0x26dd10=_0x26dd10||0xcc;return function(_0x2d9dab){if(_0x2d9dab){return _0x3027e5[_0x9810('0x25')](_0x26dd10);}return _0x3027e5[_0x9810('0x26')](_0x26dd10)[_0x9810('0x27')]();};}function respondWithResult(_0x372e34,_0x1b188b){_0x1b188b=_0x1b188b||0xc8;return function(_0x5384c5){if(_0x5384c5){return _0x372e34[_0x9810('0x26')](_0x1b188b)['json'](_0x5384c5);}};}function respondWithFilteredResult(_0x12d120,_0x1bb233){return function(_0x6aba83){if(_0x6aba83){var _0x5df817=typeof _0x1bb233[_0x9810('0x28')]===_0x9810('0x29')&&typeof _0x1bb233[_0x9810('0x2a')]===_0x9810('0x29');var _0x1f4390=_0x6aba83[_0x9810('0x2b')];var _0x54a613=_0x5df817?0x0:_0x1bb233[_0x9810('0x28')];var _0x1bedc7=_0x5df817?_0x6aba83[_0x9810('0x2b')]:_0x1bb233['offset']+_0x1bb233[_0x9810('0x2a')];var _0x5718cf;if(_0x1bedc7>=_0x1f4390){_0x1bedc7=_0x1f4390;_0x5718cf=0xc8;}else{_0x5718cf=0xce;}_0x12d120[_0x9810('0x26')](_0x5718cf);return _0x12d120['set']('Content-Range',_0x54a613+'-'+_0x1bedc7+'/'+_0x1f4390)[_0x9810('0x2c')](_0x6aba83);}return null;};}function patchUpdates(_0x36701d){return function(_0x4a601e){try{jsonpatch[_0x9810('0x2d')](_0x4a601e,_0x36701d,!![]);}catch(_0x1f4d55){return BPromise[_0x9810('0x2e')](_0x1f4d55);}return _0x4a601e[_0x9810('0x2f')]();};}function saveUpdates(_0x36c6b0,_0x4b4b17){return function(_0x42b2bb){if(_0x42b2bb){return _0x42b2bb['update'](_0x36c6b0)[_0x9810('0x1b')](function(_0x18ac7a){return _0x18ac7a;});}return null;};}function removeEntity(_0x559d21,_0xbfcc66){return function(_0x6e10c1){if(_0x6e10c1){return _0x6e10c1[_0x9810('0x30')]()[_0x9810('0x1b')](function(){var _0x4d334f=_0x6e10c1[_0x9810('0x31')]({'plain':!![]});var _0x472bbd=_0x9810('0x32');return db['UserProfileResource'][_0x9810('0x30')]({'where':{'type':_0x472bbd,'resourceId':_0x4d334f['id']}})[_0x9810('0x1b')](function(){return _0x6e10c1;});})[_0x9810('0x1b')](function(){_0x559d21[_0x9810('0x26')](0xcc)[_0x9810('0x27')]();});}};}function handleEntityNotFound(_0xd68be7,_0x53d604){return function(_0xf9f1ba){if(!_0xf9f1ba){_0xd68be7[_0x9810('0x25')](0x194);}return _0xf9f1ba;};}function handleError(_0xc734d9,_0x1d561e){_0x1d561e=_0x1d561e||0x1f4;return function(_0xf771c3){logger['error'](_0xf771c3['stack']);if(_0xf771c3['name']){delete _0xf771c3[_0x9810('0x33')];}_0xc734d9[_0x9810('0x26')](_0x1d561e)[_0x9810('0x34')](_0xf771c3);};}exports[_0x9810('0x35')]=function(_0x1ca90e,_0x32144b){var _0x1c49f8={},_0x2562fd={},_0x514c25={'count':0x0,'rows':[]};var _0x5c9d46=_[_0x9810('0x36')](db[_0x9810('0x37')][_0x9810('0x38')],function(_0x570c27){return{'name':_0x570c27['fieldName'],'type':_0x570c27['type'][_0x9810('0x39')]};});_0x2562fd['model']=_[_0x9810('0x36')](_0x5c9d46,_0x9810('0x33'));_0x2562fd['query']=_[_0x9810('0x3a')](_0x1ca90e[_0x9810('0x3b')]);_0x2562fd[_0x9810('0x3c')]=_[_0x9810('0x3d')](_0x2562fd['model'],_0x2562fd[_0x9810('0x3b')]);_0x1c49f8[_0x9810('0x3e')]=_[_0x9810('0x3d')](_0x2562fd[_0x9810('0x3f')],qs[_0x9810('0x40')](_0x1ca90e[_0x9810('0x3b')]['fields']));_0x1c49f8[_0x9810('0x3e')]=_0x1c49f8[_0x9810('0x3e')][_0x9810('0x41')]?_0x1c49f8['attributes']:_0x2562fd[_0x9810('0x3f')];if(!_0x1ca90e[_0x9810('0x3b')][_0x9810('0x42')]('nolimit')){_0x1c49f8[_0x9810('0x2a')]=qs[_0x9810('0x2a')](_0x1ca90e['query']['limit']);_0x1c49f8['offset']=qs[_0x9810('0x28')](_0x1ca90e[_0x9810('0x3b')][_0x9810('0x28')]);}_0x1c49f8[_0x9810('0x43')]=qs[_0x9810('0x44')](_0x1ca90e[_0x9810('0x3b')][_0x9810('0x44')]);_0x1c49f8[_0x9810('0x45')]=qs[_0x9810('0x3c')](_['pick'](_0x1ca90e[_0x9810('0x3b')],_0x2562fd[_0x9810('0x3c')]),_0x5c9d46);if(_0x1ca90e[_0x9810('0x3b')][_0x9810('0x46')]){_0x1c49f8[_0x9810('0x45')]=_['merge'](_0x1c49f8[_0x9810('0x45')],{'$or':_[_0x9810('0x36')](_0x5c9d46,function(_0x2f7010){if(_0x2f7010[_0x9810('0x47')]!==_0x9810('0x48')){var _0x28425c={};_0x28425c[_0x2f7010[_0x9810('0x33')]]={'$like':'%'+_0x1ca90e['query'][_0x9810('0x46')]+'%'};return _0x28425c;}})});}_0x1c49f8=_[_0x9810('0x49')]({},_0x1c49f8,_0x1ca90e[_0x9810('0x4a')]);var _0x5c1bc7={'where':_0x1c49f8[_0x9810('0x45')]};return db[_0x9810('0x37')][_0x9810('0x2b')](_0x5c1bc7)[_0x9810('0x1b')](function(_0x29bb40){_0x514c25[_0x9810('0x2b')]=_0x29bb40;if(_0x1ca90e[_0x9810('0x3b')][_0x9810('0x4b')]){_0x1c49f8[_0x9810('0x4c')]=[{'all':!![]}];}return db[_0x9810('0x37')][_0x9810('0x4d')](_0x1c49f8);})[_0x9810('0x1b')](function(_0x334272){_0x514c25[_0x9810('0x4e')]=_0x334272;return _0x514c25;})[_0x9810('0x1b')](respondWithFilteredResult(_0x32144b,_0x1c49f8))[_0x9810('0x24')](handleError(_0x32144b,null));};exports[_0x9810('0x4f')]=function(_0x210336,_0x1a1646){var _0x1e39c3={'raw':![],'where':{'id':_0x210336['params']['id']}},_0x2de58b={};_0x2de58b[_0x9810('0x3f')]=_[_0x9810('0x3a')](db[_0x9810('0x37')]['rawAttributes']);_0x2de58b['query']=_['keys'](_0x210336[_0x9810('0x3b')]);_0x2de58b['filters']=_[_0x9810('0x3d')](_0x2de58b[_0x9810('0x3f')],_0x2de58b[_0x9810('0x3b')]);_0x1e39c3[_0x9810('0x3e')]=_[_0x9810('0x3d')](_0x2de58b[_0x9810('0x3f')],qs[_0x9810('0x40')](_0x210336[_0x9810('0x3b')]['fields']));_0x1e39c3[_0x9810('0x3e')]=_0x1e39c3['attributes'][_0x9810('0x41')]?_0x1e39c3['attributes']:_0x2de58b['model'];if(_0x210336[_0x9810('0x3b')][_0x9810('0x4b')]){_0x1e39c3[_0x9810('0x4c')]=[{'all':!![]}];}_0x1e39c3=_[_0x9810('0x49')]({},_0x1e39c3,_0x210336[_0x9810('0x4a')]);return db[_0x9810('0x37')][_0x9810('0x50')](_0x1e39c3)['then'](handleEntityNotFound(_0x1a1646,null))[_0x9810('0x1b')](respondWithResult(_0x1a1646,null))['catch'](handleError(_0x1a1646,null));};exports[_0x9810('0x51')]=function(_0x31889a,_0x296cb1,_0x36a6d5){var _0x4cc28a;return db['VoiceContext']['create'](_0x31889a[_0x9810('0x52')],{'raw':!![]})['then'](function(_0x45b1ca){_0x4cc28a=_0x45b1ca;return db[_0x9810('0x37')][_0x9810('0x4d')]({'raw':!![]});})[_0x9810('0x1b')](function(_0x1e3dc0){var _0x191db1=fs['readFileSync'](path[_0x9810('0x53')](config[_0x9810('0x54')],_0x9810('0x55')),'utf8');var _0x2221ba=ejs['render'](_0x191db1,{'contexts':_0x1e3dc0||[]});fs[_0x9810('0x56')](_0x9810('0x57'),_0x2221ba);})['then'](function(){return respondWithRpcPromise(_0x9810('0x58'),_0x9810('0x51'),{'module':'chan_sip.so'});})[_0x9810('0x1b')](function(){var _0x13a3e2=_0x31889a[_0x9810('0x59')]['get']({'plain':!![]});if(!_0x13a3e2)throw new Error(_0x9810('0x5a'));if(_0x13a3e2['role']===_0x9810('0x59')){var _0x1b9fd2=_0x4cc28a[_0x9810('0x31')]({'plain':!![]});return db[_0x9810('0x5b')][_0x9810('0x50')]({'where':{'name':_0x9810('0x32'),'userProfileId':_0x13a3e2[_0x9810('0x5c')]},'raw':!![]})[_0x9810('0x1b')](function(_0x1c28f5){if(_0x1c28f5&&_0x1c28f5[_0x9810('0x5d')]===0x0){return db['UserProfileResource'][_0x9810('0x51')]({'name':_0x1b9fd2[_0x9810('0x33')],'resourceId':_0x1b9fd2['id'],'type':_0x1c28f5[_0x9810('0x33')],'sectionId':_0x1c28f5['id']},{})[_0x9810('0x1b')](function(){return _0x4cc28a;});}else{return _0x4cc28a;}})[_0x9810('0x24')](function(_0x5b5dc0){logger[_0x9810('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b5dc0);throw _0x5b5dc0;});}return _0x4cc28a;})[_0x9810('0x1b')](respondWithResult(_0x296cb1,0xc9))[_0x9810('0x24')](handleError(_0x296cb1,null));};exports['update']=function(_0x50a654,_0x57b5b9,_0x3f9018){var _0xa64645;return db[_0x9810('0x37')][_0x9810('0x50')]({'where':{'id':_0x50a654['params']['id']}})['then'](handleEntityNotFound(_0x57b5b9,null))['then'](saveUpdates(_0x50a654[_0x9810('0x52')],null))['then'](function(_0x2d85b6){if(_0x2d85b6){_0xa64645=_0x2d85b6;return db[_0x9810('0x37')][_0x9810('0x4d')]({'raw':!![]});}})[_0x9810('0x1b')](function(_0x3c2cbd){var _0x1b1ae9=fs[_0x9810('0x5e')](path[_0x9810('0x53')](config['root'],_0x9810('0x55')),_0x9810('0x5f'));var _0x4c23f6=ejs[_0x9810('0x60')](_0x1b1ae9,{'contexts':_0x3c2cbd||[]});fs[_0x9810('0x56')](_0x9810('0x57'),_0x4c23f6);})['then'](function(){return respondWithRpcPromise('Reload',_0x9810('0x61'),{'module':'chan_sip.so'});})[_0x9810('0x1b')](function(){return _0xa64645;})[_0x9810('0x1b')](respondWithResult(_0x57b5b9,null))[_0x9810('0x24')](handleError(_0x57b5b9,null));};exports['destroy']=function(_0x668b7,_0x418751,_0x3e0e78){var _0x56b346;return db[_0x9810('0x37')]['find']({'where':{'id':_0x668b7[_0x9810('0x62')]['id']}})[_0x9810('0x1b')](handleEntityNotFound(_0x418751,null))[_0x9810('0x1b')](removeEntity(_0x418751,null))[_0x9810('0x1b')](function(){return db[_0x9810('0x37')][_0x9810('0x4d')]({'raw':!![]});})['then'](function(_0x2161b1){var _0x86b804=fs['readFileSync'](path[_0x9810('0x53')](config[_0x9810('0x54')],_0x9810('0x55')),_0x9810('0x5f'));var _0x486801=ejs[_0x9810('0x60')](_0x86b804,{'contexts':_0x2161b1});fs[_0x9810('0x56')](_0x9810('0x57'),_0x486801);return respondWithRpcPromise(_0x9810('0x58'),_0x9810('0x30'),{'module':_0x9810('0x63')});})[_0x9810('0x24')](handleError(_0x418751,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 969a927..e395434 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 _0xcdc0=['VoiceContext','voice_contexts','util','../../config/logger','moment','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x489ddb,_0x366e91){var _0x2e99a8=function(_0x1220ea){while(--_0x1220ea){_0x489ddb['push'](_0x489ddb['shift']());}};_0x2e99a8(++_0x366e91);}(_0xcdc0,0x84));var _0x0cdc=function(_0x4a4d0b,_0x229b67){_0x4a4d0b=_0x4a4d0b-0x0;var _0x27a139=_0xcdc0[_0x4a4d0b];return _0x27a139;};'use strict';var _=require('lodash');var util=require(_0x0cdc('0x0'));var logger=require(_0x0cdc('0x1'))('api');var moment=require(_0x0cdc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cdc('0x3'));var rimraf=require(_0x0cdc('0x4'));var config=require(_0x0cdc('0x5'));var attributes=require(_0x0cdc('0x6'));module[_0x0cdc('0x7')]=function(_0x1dbfeb,_0x9b5ed4){return _0x1dbfeb['define'](_0x0cdc('0x8'),attributes,{'tableName':_0x0cdc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe785=['util','api','moment','bluebird','request-promise','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash'];(function(_0x2292fe,_0xd86b32){var _0xd6671e=function(_0x28bc94){while(--_0x28bc94){_0x2292fe['push'](_0x2292fe['shift']());}};_0xd6671e(++_0xd86b32);}(_0xe785,0x128));var _0x5e78=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xe785[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var logger=require('../../config/logger')(_0x5e78('0x2'));var moment=require(_0x5e78('0x3'));var BPromise=require(_0x5e78('0x4'));var rp=require(_0x5e78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e78('0x6'));var attributes=require(_0x5e78('0x7'));module[_0x5e78('0x8')]=function(_0x135552,_0x502114){return _0x135552['define'](_0x5e78('0x9'),attributes,{'tableName':_0x5e78('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 ea8f12b..4e6b1de 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 _0x205d=['VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5881be,_0x5edf5d){var _0x8e63bf=function(_0x4dd2b2){while(--_0x4dd2b2){_0x5881be['push'](_0x5881be['shift']());}};_0x8e63bf(++_0x5edf5d);}(_0x205d,0xf6));var _0xd205=function(_0x64b31d,_0x393b36){_0x64b31d=_0x64b31d-0x0;var _0x42c45b=_0x205d[_0x64b31d];return _0x42c45b;};'use strict';var _=require(_0xd205('0x0'));var util=require(_0xd205('0x1'));var moment=require(_0xd205('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd205('0x3'));var db=require(_0xd205('0x4'))['db'];var utils=require(_0xd205('0x5'));var logger=require('../../config/logger')(_0xd205('0x6'));var config=require(_0xd205('0x7'));var jayson=require(_0xd205('0x8'));var client=jayson[_0xd205('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2614e7,_0x2b6078,_0xdb99a8){return new BPromise(function(_0x372211,_0x3ce946){return client[_0xd205('0xa')](_0x2614e7,_0xdb99a8)[_0xd205('0xb')](function(_0x1cd484){logger[_0xd205('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2b6078,_0xd205('0xd'));logger[_0xd205('0xe')](_0xd205('0xf'),_0x2b6078,_0xd205('0xd'),JSON['stringify'](_0x1cd484));if(_0x1cd484[_0xd205('0x10')]){if(_0x1cd484[_0xd205('0x10')][_0xd205('0x11')]===0x1f4){logger[_0xd205('0x10')](_0xd205('0x12'),_0x2b6078,_0x1cd484[_0xd205('0x10')][_0xd205('0x13')]);return _0x3ce946(_0x1cd484['error'][_0xd205('0x13')]);}logger[_0xd205('0x10')](_0xd205('0x12'),_0x2b6078,_0x1cd484['error']['message']);return _0x372211(_0x1cd484[_0xd205('0x10')]['message']);}else{logger[_0xd205('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2b6078,_0xd205('0xd'));_0x372211(_0x1cd484[_0xd205('0x14')][_0xd205('0x13')]);}})[_0xd205('0x15')](function(_0x57201a){logger[_0xd205('0x10')](_0xd205('0x12'),_0x2b6078,_0x57201a);_0x3ce946(_0x57201a);});});} \ No newline at end of file +var _0xb16f=['http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x564eab,_0x55b478){var _0x4a3fae=function(_0x358222){while(--_0x358222){_0x564eab['push'](_0x564eab['shift']());}};_0x4a3fae(++_0x55b478);}(_0xb16f,0x1c4));var _0xfb16=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb16f[_0x164eca];return _0x2ce562;};'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});function respondWithRpcPromise(_0x423ffd,_0x30ac0e,_0x496033){return new BPromise(function(_0x362b89,_0x375f48){return client[_0xfb16('0x9')](_0x423ffd,_0x496033)['then'](function(_0x1d7dcc){logger[_0xfb16('0xa')](_0xfb16('0xb'),_0x30ac0e,_0xfb16('0xc'));logger[_0xfb16('0xd')](_0xfb16('0xe'),_0x30ac0e,_0xfb16('0xc'),JSON[_0xfb16('0xf')](_0x1d7dcc));if(_0x1d7dcc[_0xfb16('0x10')]){if(_0x1d7dcc[_0xfb16('0x10')][_0xfb16('0x11')]===0x1f4){logger[_0xfb16('0x10')](_0xfb16('0xb'),_0x30ac0e,_0x1d7dcc[_0xfb16('0x10')][_0xfb16('0x12')]);return _0x375f48(_0x1d7dcc[_0xfb16('0x10')]['message']);}logger[_0xfb16('0x10')]('VoiceContext,\x20%s,\x20%s',_0x30ac0e,_0x1d7dcc[_0xfb16('0x10')]['message']);return _0x362b89(_0x1d7dcc[_0xfb16('0x10')][_0xfb16('0x12')]);}else{logger[_0xfb16('0xa')](_0xfb16('0xb'),_0x30ac0e,_0xfb16('0xc'));_0x362b89(_0x1d7dcc[_0xfb16('0x13')][_0xfb16('0x12')]);}})['catch'](function(_0x4e2371){logger['error']('VoiceContext,\x20%s,\x20%s',_0x30ac0e,_0x4e2371);_0x375f48(_0x4e2371);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3626dae..97e0c9e 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 _0x8a9a=['./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0x8a9a,0x193));var _0xa8a9=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x8a9a[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa8a9('0x0'));var timeout=require(_0xa8a9('0x1'));var express=require(_0xa8a9('0x2'));var router=express['Router']();var fs_extra=require(_0xa8a9('0x3'));var auth=require(_0xa8a9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8a9('0x5'));router[_0xa8a9('0x6')]('/',auth[_0xa8a9('0x7')](),controller[_0xa8a9('0x8')]);router[_0xa8a9('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xa8a9('0x9')]);router[_0xa8a9('0x6')](_0xa8a9('0xa'),auth[_0xa8a9('0x7')](),controller[_0xa8a9('0xb')]);router[_0xa8a9('0xc')]('/',auth[_0xa8a9('0x7')](),controller['create']);router[_0xa8a9('0xd')]('/:id',auth[_0xa8a9('0x7')](),controller['update']);router[_0xa8a9('0xe')](_0xa8a9('0xa'),auth[_0xa8a9('0x7')](),controller[_0xa8a9('0xf')]);module[_0xa8a9('0x10')]=router; \ No newline at end of file +var _0xf36d=['isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./voiceDialReport.controller','get'];(function(_0x21e877,_0x1d66b4){var _0x453649=function(_0x1b3118){while(--_0x1b3118){_0x21e877['push'](_0x21e877['shift']());}};_0x453649(++_0x1d66b4);}(_0xf36d,0x160));var _0xdf36=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xf36d[_0x18a436];return _0x5c2cf8;};'use strict';var multer=require(_0xdf36('0x0'));var util=require(_0xdf36('0x1'));var path=require('path');var timeout=require(_0xdf36('0x2'));var express=require(_0xdf36('0x3'));var router=express['Router']();var fs_extra=require(_0xdf36('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdf36('0x5'));var controller=require(_0xdf36('0x6'));router[_0xdf36('0x7')]('/',auth[_0xdf36('0x8')](),controller[_0xdf36('0x9')]);router['get'](_0xdf36('0xa'),auth[_0xdf36('0x8')](),controller['describe']);router['get']('/:id',auth[_0xdf36('0x8')](),controller[_0xdf36('0xb')]);router[_0xdf36('0xc')]('/',auth['isAuthenticated'](),controller[_0xdf36('0xd')]);router[_0xdf36('0xe')](_0xdf36('0xf'),auth[_0xdf36('0x8')](),controller[_0xdf36('0x10')]);router[_0xdf36('0x11')]('/:id',auth[_0xdf36('0x8')](),controller[_0xdf36('0x12')]);module[_0xdf36('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7d1ac9c..1059818 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0xa087f5,_0x34fd10){var _0x4c8806=function(_0x4b1cfe){while(--_0x4b1cfe){_0xa087f5['push'](_0xa087f5['shift']());}};_0x4c8806(++_0x34fd10);}(_0x84ab,0x12f));var _0xb84a=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x84ab[_0x12b8ec];return _0x21af77;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x15ba2e,_0x2504e4){var _0x35fe44=function(_0x24f5c0){while(--_0x24f5c0){_0x15ba2e['push'](_0x15ba2e['shift']());}};_0x35fe44(++_0x2504e4);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xe33eca,_0x332ee5){_0xe33eca=_0xe33eca-0x0;var _0x2184d6=_0x6f0d[_0xe33eca];return _0x2184d6;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a3f151e..d1ecb36 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 _0x1a93=['filter','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','error','stack','name','send','index','VoiceDialReport','rawAttributes','type','key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3f1688,_0x34b8ad){var _0x5390e8=function(_0x2a5a3b){while(--_0x2a5a3b){_0x3f1688['push'](_0x3f1688['shift']());}};_0x5390e8(++_0x34b8ad);}(_0x1a93,0x19b));var _0x31a9=function(_0x38112a,_0xff3a91){_0x38112a=_0x38112a-0x0;var _0x300f48=_0x1a93[_0x38112a];return _0x300f48;};'use strict';var emlformat=require(_0x31a9('0x0'));var rimraf=require(_0x31a9('0x1'));var zipdir=require(_0x31a9('0x2'));var jsonpatch=require(_0x31a9('0x3'));var rp=require(_0x31a9('0x4'));var moment=require(_0x31a9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31a9('0x6'));var util=require(_0x31a9('0x7'));var path=require(_0x31a9('0x8'));var sox=require(_0x31a9('0x9'));var csv=require(_0x31a9('0xa'));var ejs=require(_0x31a9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31a9('0xc'));var squel=require(_0x31a9('0xd'));var crypto=require(_0x31a9('0xe'));var jsforce=require(_0x31a9('0xf'));var deskjs=require(_0x31a9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x31a9('0x11'));var Papa=require(_0x31a9('0x12'));var Redis=require(_0x31a9('0x13'));var authService=require(_0x31a9('0x14'));var qs=require(_0x31a9('0x15'));var as=require(_0x31a9('0x16'));var hardwareService=require(_0x31a9('0x17'));var logger=require(_0x31a9('0x18'))(_0x31a9('0x19'));var utils=require(_0x31a9('0x1a'));var config=require(_0x31a9('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x31a9('0x1c'))['db'];function respondWithStatusCode(_0x63f9f4,_0x14686d){_0x14686d=_0x14686d||0xcc;return function(_0x12daca){if(_0x12daca){return _0x63f9f4[_0x31a9('0x1d')](_0x14686d);}return _0x63f9f4[_0x31a9('0x1e')](_0x14686d)['end']();};}function respondWithResult(_0x29f072,_0x33ef2d){_0x33ef2d=_0x33ef2d||0xc8;return function(_0x38e297){if(_0x38e297){return _0x29f072[_0x31a9('0x1e')](_0x33ef2d)[_0x31a9('0x1f')](_0x38e297);}};}function respondWithFilteredResult(_0x327700,_0xac3268){return function(_0x7ec206){if(_0x7ec206){var _0x2aafc0=typeof _0xac3268[_0x31a9('0x20')]==='undefined'&&typeof _0xac3268[_0x31a9('0x21')]===_0x31a9('0x22');var _0x1eaad2=_0x7ec206[_0x31a9('0x23')];var _0x1934c7=_0x2aafc0?0x0:_0xac3268['offset'];var _0x56763b=_0x2aafc0?_0x7ec206['count']:_0xac3268[_0x31a9('0x20')]+_0xac3268[_0x31a9('0x21')];var _0x3fb560;if(_0x56763b>=_0x1eaad2){_0x56763b=_0x1eaad2;_0x3fb560=0xc8;}else{_0x3fb560=0xce;}_0x327700[_0x31a9('0x1e')](_0x3fb560);return _0x327700[_0x31a9('0x24')](_0x31a9('0x25'),_0x1934c7+'-'+_0x56763b+'/'+_0x1eaad2)[_0x31a9('0x1f')](_0x7ec206);}return null;};}function patchUpdates(_0x54d0df){return function(_0x1f4267){try{jsonpatch[_0x31a9('0x26')](_0x1f4267,_0x54d0df,!![]);}catch(_0xfca14b){return BPromise[_0x31a9('0x27')](_0xfca14b);}return _0x1f4267['save']();};}function saveUpdates(_0x5c7aa4,_0x3df890){return function(_0x8ae881){if(_0x8ae881){return _0x8ae881['update'](_0x5c7aa4)['then'](function(_0x205bb5){return _0x205bb5;});}return null;};}function removeEntity(_0x3522f9,_0x28308c){return function(_0x52d210){if(_0x52d210){return _0x52d210['destroy']()[_0x31a9('0x28')](function(){_0x3522f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13059c,_0x262beb){return function(_0x3a0c04){if(!_0x3a0c04){_0x13059c[_0x31a9('0x1d')](0x194);}return _0x3a0c04;};}function handleError(_0x52be62,_0x1147eb){_0x1147eb=_0x1147eb||0x1f4;return function(_0x280f2d){logger[_0x31a9('0x29')](_0x280f2d[_0x31a9('0x2a')]);if(_0x280f2d[_0x31a9('0x2b')]){delete _0x280f2d[_0x31a9('0x2b')];}_0x52be62['status'](_0x1147eb)[_0x31a9('0x2c')](_0x280f2d);};}exports[_0x31a9('0x2d')]=function(_0x468ac0,_0x1a70e7){var _0xd45627={},_0x333e36={},_0x57a565={'count':0x0,'rows':[]};var _0x1bb6fa=_['map'](db[_0x31a9('0x2e')][_0x31a9('0x2f')],function(_0x457e06){return{'name':_0x457e06['fieldName'],'type':_0x457e06[_0x31a9('0x30')][_0x31a9('0x31')]};});_0x333e36['model']=_[_0x31a9('0x32')](_0x1bb6fa,_0x31a9('0x2b'));_0x333e36[_0x31a9('0x33')]=_['keys'](_0x468ac0[_0x31a9('0x33')]);_0x333e36[_0x31a9('0x34')]=_[_0x31a9('0x35')](_0x333e36['model'],_0x333e36[_0x31a9('0x33')]);_0xd45627[_0x31a9('0x36')]=_[_0x31a9('0x35')](_0x333e36['model'],qs[_0x31a9('0x37')](_0x468ac0[_0x31a9('0x33')]['fields']));_0xd45627[_0x31a9('0x36')]=_0xd45627[_0x31a9('0x36')][_0x31a9('0x38')]?_0xd45627[_0x31a9('0x36')]:_0x333e36[_0x31a9('0x39')];if(!_0x468ac0['query'][_0x31a9('0x3a')](_0x31a9('0x3b'))){_0xd45627[_0x31a9('0x21')]=qs[_0x31a9('0x21')](_0x468ac0[_0x31a9('0x33')]['limit']);_0xd45627['offset']=qs[_0x31a9('0x20')](_0x468ac0[_0x31a9('0x33')][_0x31a9('0x20')]);}_0xd45627[_0x31a9('0x3c')]=qs[_0x31a9('0x3d')](_0x468ac0[_0x31a9('0x33')][_0x31a9('0x3d')]);_0xd45627[_0x31a9('0x3e')]=qs[_0x31a9('0x34')](_['pick'](_0x468ac0[_0x31a9('0x33')],_0x333e36[_0x31a9('0x34')]),_0x1bb6fa);if(_0x468ac0[_0x31a9('0x33')][_0x31a9('0x3f')]){_0xd45627['where']=_[_0x31a9('0x40')](_0xd45627[_0x31a9('0x3e')],{'$or':_['map'](_0x1bb6fa,function(_0x34f1bb){if(_0x34f1bb[_0x31a9('0x30')]!=='VIRTUAL'){var _0x5960b4={};_0x5960b4[_0x34f1bb['name']]={'$like':'%'+_0x468ac0[_0x31a9('0x33')][_0x31a9('0x3f')]+'%'};return _0x5960b4;}})});}_0xd45627=_[_0x31a9('0x40')]({},_0xd45627,_0x468ac0['options']);var _0x876c3b={'where':_0xd45627[_0x31a9('0x3e')]};return db[_0x31a9('0x2e')][_0x31a9('0x23')](_0x876c3b)[_0x31a9('0x28')](function(_0x32262a){_0x57a565[_0x31a9('0x23')]=_0x32262a;if(_0x468ac0[_0x31a9('0x33')]['includeAll']){_0xd45627[_0x31a9('0x41')]=[{'all':!![]}];}return db[_0x31a9('0x2e')][_0x31a9('0x42')](_0xd45627);})['then'](function(_0x4d9e09){_0x57a565[_0x31a9('0x43')]=_0x4d9e09;return _0x57a565;})[_0x31a9('0x28')](respondWithFilteredResult(_0x1a70e7,_0xd45627))[_0x31a9('0x44')](handleError(_0x1a70e7,null));};exports[_0x31a9('0x45')]=function(_0x2986de,_0x1f2c04){var _0xa36c25={'raw':!![],'where':{'id':_0x2986de[_0x31a9('0x46')]['id']}},_0x5ec11e={};_0x5ec11e['model']=_['keys'](db[_0x31a9('0x2e')][_0x31a9('0x2f')]);_0x5ec11e[_0x31a9('0x33')]=_[_0x31a9('0x47')](_0x2986de[_0x31a9('0x33')]);_0x5ec11e['filters']=_[_0x31a9('0x35')](_0x5ec11e[_0x31a9('0x39')],_0x5ec11e[_0x31a9('0x33')]);_0xa36c25[_0x31a9('0x36')]=_[_0x31a9('0x35')](_0x5ec11e[_0x31a9('0x39')],qs[_0x31a9('0x37')](_0x2986de['query'][_0x31a9('0x37')]));_0xa36c25[_0x31a9('0x36')]=_0xa36c25[_0x31a9('0x36')][_0x31a9('0x38')]?_0xa36c25[_0x31a9('0x36')]:_0x5ec11e['model'];if(_0x2986de[_0x31a9('0x33')][_0x31a9('0x48')]){_0xa36c25[_0x31a9('0x41')]=[{'all':!![]}];}_0xa36c25=_[_0x31a9('0x40')]({},_0xa36c25,_0x2986de[_0x31a9('0x49')]);return db[_0x31a9('0x2e')][_0x31a9('0x4a')](_0xa36c25)[_0x31a9('0x28')](handleEntityNotFound(_0x1f2c04,null))[_0x31a9('0x28')](respondWithResult(_0x1f2c04,null))[_0x31a9('0x44')](handleError(_0x1f2c04,null));};exports[_0x31a9('0x4b')]=function(_0x39991f,_0x137285){return db['VoiceDialReport'][_0x31a9('0x4b')](_0x39991f[_0x31a9('0x4c')],{})[_0x31a9('0x28')](respondWithResult(_0x137285,0xc9))[_0x31a9('0x44')](handleError(_0x137285,null));};exports['update']=function(_0x252a6e,_0x1c5f55){if(_0x252a6e[_0x31a9('0x4c')]['id']){delete _0x252a6e[_0x31a9('0x4c')]['id'];}return db[_0x31a9('0x2e')][_0x31a9('0x4a')]({'where':{'id':_0x252a6e[_0x31a9('0x46')]['id']}})[_0x31a9('0x28')](handleEntityNotFound(_0x1c5f55,null))[_0x31a9('0x28')](saveUpdates(_0x252a6e['body'],null))[_0x31a9('0x28')](respondWithResult(_0x1c5f55,null))[_0x31a9('0x44')](handleError(_0x1c5f55,null));};exports[_0x31a9('0x4d')]=function(_0x1354fa,_0x1fc09a){return db[_0x31a9('0x2e')][_0x31a9('0x4a')]({'where':{'id':_0x1354fa['params']['id']}})[_0x31a9('0x28')](handleEntityNotFound(_0x1fc09a,null))['then'](removeEntity(_0x1fc09a,null))[_0x31a9('0x44')](handleError(_0x1fc09a,null));};exports[_0x31a9('0x4e')]=function(_0x3f6c42,_0x38fbd3){return db[_0x31a9('0x2e')][_0x31a9('0x4e')]()['then'](respondWithResult(_0x38fbd3,null))[_0x31a9('0x44')](handleError(_0x38fbd3,null));}; \ No newline at end of file +var _0x8af3=['undefined','count','limit','set','Content-Range','reject','save','destroy','then','error','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x57175d,_0x3f4fc7){var _0x5ae1c3=function(_0x29deb7){while(--_0x29deb7){_0x57175d['push'](_0x57175d['shift']());}};_0x5ae1c3(++_0x3f4fc7);}(_0x8af3,0x6d));var _0x38af=function(_0x24c7bd,_0x209902){_0x24c7bd=_0x24c7bd-0x0;var _0x3d8157=_0x8af3[_0x24c7bd];return _0x3d8157;};'use strict';var emlformat=require(_0x38af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38af('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x38af('0x2'));var BPromise=require(_0x38af('0x3'));var Mustache=require('mustache');var util=require(_0x38af('0x4'));var path=require('path');var sox=require(_0x38af('0x5'));var csv=require(_0x38af('0x6'));var ejs=require(_0x38af('0x7'));var fs=require('fs');var fs_extra=require(_0x38af('0x8'));var _=require(_0x38af('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x38af('0xa'));var toCsv=require(_0x38af('0x6'));var querystring=require(_0x38af('0xb'));var Papa=require(_0x38af('0xc'));var Redis=require(_0x38af('0xd'));var authService=require(_0x38af('0xe'));var qs=require(_0x38af('0xf'));var as=require(_0x38af('0x10'));var hardwareService=require(_0x38af('0x11'));var logger=require(_0x38af('0x12'))(_0x38af('0x13'));var utils=require(_0x38af('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x38af('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21fed3,_0x283f30){_0x283f30=_0x283f30||0xcc;return function(_0x4e365b){if(_0x4e365b){return _0x21fed3[_0x38af('0x16')](_0x283f30);}return _0x21fed3[_0x38af('0x17')](_0x283f30)[_0x38af('0x18')]();};}function respondWithResult(_0x5bfcc6,_0x424c0c){_0x424c0c=_0x424c0c||0xc8;return function(_0x275c99){if(_0x275c99){return _0x5bfcc6[_0x38af('0x17')](_0x424c0c)[_0x38af('0x19')](_0x275c99);}};}function respondWithFilteredResult(_0x43dbe1,_0x4cfd1b){return function(_0x24d584){if(_0x24d584){var _0x538e23=typeof _0x4cfd1b[_0x38af('0x1a')]===_0x38af('0x1b')&&typeof _0x4cfd1b['limit']===_0x38af('0x1b');var _0x4c26ba=_0x24d584[_0x38af('0x1c')];var _0x2644e4=_0x538e23?0x0:_0x4cfd1b[_0x38af('0x1a')];var _0x156fa3=_0x538e23?_0x24d584[_0x38af('0x1c')]:_0x4cfd1b[_0x38af('0x1a')]+_0x4cfd1b[_0x38af('0x1d')];var _0x20f7eb;if(_0x156fa3>=_0x4c26ba){_0x156fa3=_0x4c26ba;_0x20f7eb=0xc8;}else{_0x20f7eb=0xce;}_0x43dbe1['status'](_0x20f7eb);return _0x43dbe1[_0x38af('0x1e')](_0x38af('0x1f'),_0x2644e4+'-'+_0x156fa3+'/'+_0x4c26ba)[_0x38af('0x19')](_0x24d584);}return null;};}function patchUpdates(_0x3b10af){return function(_0xd680be){try{jsonpatch['apply'](_0xd680be,_0x3b10af,!![]);}catch(_0x47ccc2){return BPromise[_0x38af('0x20')](_0x47ccc2);}return _0xd680be[_0x38af('0x21')]();};}function saveUpdates(_0x23698c,_0x10c4c9){return function(_0x41f7b9){if(_0x41f7b9){return _0x41f7b9['update'](_0x23698c)['then'](function(_0x5d362a){return _0x5d362a;});}return null;};}function removeEntity(_0x440dcd,_0x4c70f8){return function(_0x43e2e0){if(_0x43e2e0){return _0x43e2e0[_0x38af('0x22')]()[_0x38af('0x23')](function(){_0x440dcd[_0x38af('0x17')](0xcc)[_0x38af('0x18')]();});}};}function handleEntityNotFound(_0x4e13c8,_0x4f518d){return function(_0x2cebd3){if(!_0x2cebd3){_0x4e13c8[_0x38af('0x16')](0x194);}return _0x2cebd3;};}function handleError(_0x5dbb97,_0x1b0ecc){_0x1b0ecc=_0x1b0ecc||0x1f4;return function(_0x5af364){logger[_0x38af('0x24')](_0x5af364['stack']);if(_0x5af364['name']){delete _0x5af364[_0x38af('0x25')];}_0x5dbb97[_0x38af('0x17')](_0x1b0ecc)['send'](_0x5af364);};}exports[_0x38af('0x26')]=function(_0x8a40fd,_0x35fa72){var _0x1badc0={},_0x1f4a76={},_0x5e3a33={'count':0x0,'rows':[]};var _0x55bae6=_[_0x38af('0x27')](db[_0x38af('0x28')][_0x38af('0x29')],function(_0x71d10b){return{'name':_0x71d10b[_0x38af('0x2a')],'type':_0x71d10b[_0x38af('0x2b')]['key']};});_0x1f4a76[_0x38af('0x2c')]=_[_0x38af('0x27')](_0x55bae6,'name');_0x1f4a76[_0x38af('0x2d')]=_['keys'](_0x8a40fd[_0x38af('0x2d')]);_0x1f4a76[_0x38af('0x2e')]=_[_0x38af('0x2f')](_0x1f4a76[_0x38af('0x2c')],_0x1f4a76['query']);_0x1badc0[_0x38af('0x30')]=_[_0x38af('0x2f')](_0x1f4a76['model'],qs[_0x38af('0x31')](_0x8a40fd['query']['fields']));_0x1badc0[_0x38af('0x30')]=_0x1badc0[_0x38af('0x30')]['length']?_0x1badc0[_0x38af('0x30')]:_0x1f4a76[_0x38af('0x2c')];if(!_0x8a40fd[_0x38af('0x2d')]['hasOwnProperty'](_0x38af('0x32'))){_0x1badc0[_0x38af('0x1d')]=qs[_0x38af('0x1d')](_0x8a40fd['query'][_0x38af('0x1d')]);_0x1badc0[_0x38af('0x1a')]=qs[_0x38af('0x1a')](_0x8a40fd['query'][_0x38af('0x1a')]);}_0x1badc0['order']=qs[_0x38af('0x33')](_0x8a40fd[_0x38af('0x2d')]['sort']);_0x1badc0[_0x38af('0x34')]=qs[_0x38af('0x2e')](_[_0x38af('0x35')](_0x8a40fd[_0x38af('0x2d')],_0x1f4a76[_0x38af('0x2e')]),_0x55bae6);if(_0x8a40fd[_0x38af('0x2d')][_0x38af('0x36')]){_0x1badc0['where']=_[_0x38af('0x37')](_0x1badc0[_0x38af('0x34')],{'$or':_[_0x38af('0x27')](_0x55bae6,function(_0x5d1bf6){if(_0x5d1bf6[_0x38af('0x2b')]!=='VIRTUAL'){var _0x30510d={};_0x30510d[_0x5d1bf6['name']]={'$like':'%'+_0x8a40fd[_0x38af('0x2d')][_0x38af('0x36')]+'%'};return _0x30510d;}})});}_0x1badc0=_['merge']({},_0x1badc0,_0x8a40fd[_0x38af('0x38')]);var _0x477f2d={'where':_0x1badc0[_0x38af('0x34')]};return db[_0x38af('0x28')][_0x38af('0x1c')](_0x477f2d)[_0x38af('0x23')](function(_0x35ffec){_0x5e3a33['count']=_0x35ffec;if(_0x8a40fd[_0x38af('0x2d')]['includeAll']){_0x1badc0[_0x38af('0x39')]=[{'all':!![]}];}return db[_0x38af('0x28')][_0x38af('0x3a')](_0x1badc0);})[_0x38af('0x23')](function(_0x2759f9){_0x5e3a33['rows']=_0x2759f9;return _0x5e3a33;})[_0x38af('0x23')](respondWithFilteredResult(_0x35fa72,_0x1badc0))[_0x38af('0x3b')](handleError(_0x35fa72,null));};exports[_0x38af('0x3c')]=function(_0x2e7137,_0x128749){var _0x7f9727={'raw':!![],'where':{'id':_0x2e7137[_0x38af('0x3d')]['id']}},_0x58effc={};_0x58effc[_0x38af('0x2c')]=_[_0x38af('0x3e')](db[_0x38af('0x28')][_0x38af('0x29')]);_0x58effc['query']=_['keys'](_0x2e7137['query']);_0x58effc['filters']=_[_0x38af('0x2f')](_0x58effc['model'],_0x58effc[_0x38af('0x2d')]);_0x7f9727[_0x38af('0x30')]=_[_0x38af('0x2f')](_0x58effc[_0x38af('0x2c')],qs[_0x38af('0x31')](_0x2e7137[_0x38af('0x2d')][_0x38af('0x31')]));_0x7f9727[_0x38af('0x30')]=_0x7f9727[_0x38af('0x30')]['length']?_0x7f9727['attributes']:_0x58effc[_0x38af('0x2c')];if(_0x2e7137['query'][_0x38af('0x3f')]){_0x7f9727[_0x38af('0x39')]=[{'all':!![]}];}_0x7f9727=_['merge']({},_0x7f9727,_0x2e7137[_0x38af('0x38')]);return db[_0x38af('0x28')][_0x38af('0x40')](_0x7f9727)[_0x38af('0x23')](handleEntityNotFound(_0x128749,null))[_0x38af('0x23')](respondWithResult(_0x128749,null))[_0x38af('0x3b')](handleError(_0x128749,null));};exports[_0x38af('0x41')]=function(_0x444fa9,_0x24ceed){return db[_0x38af('0x28')][_0x38af('0x41')](_0x444fa9['body'],{})['then'](respondWithResult(_0x24ceed,0xc9))['catch'](handleError(_0x24ceed,null));};exports['update']=function(_0x3ac089,_0x245374){if(_0x3ac089[_0x38af('0x42')]['id']){delete _0x3ac089[_0x38af('0x42')]['id'];}return db[_0x38af('0x28')][_0x38af('0x40')]({'where':{'id':_0x3ac089['params']['id']}})['then'](handleEntityNotFound(_0x245374,null))[_0x38af('0x23')](saveUpdates(_0x3ac089['body'],null))[_0x38af('0x23')](respondWithResult(_0x245374,null))[_0x38af('0x3b')](handleError(_0x245374,null));};exports[_0x38af('0x22')]=function(_0x2e91f1,_0x35e745){return db[_0x38af('0x28')]['find']({'where':{'id':_0x2e91f1[_0x38af('0x3d')]['id']}})['then'](handleEntityNotFound(_0x35e745,null))['then'](removeEntity(_0x35e745,null))['catch'](handleError(_0x35e745,null));};exports[_0x38af('0x43')]=function(_0x35091b,_0x4ea997){return db['VoiceDialReport'][_0x38af('0x43')]()[_0x38af('0x23')](respondWithResult(_0x4ea997,null))[_0x38af('0x3b')](handleError(_0x4ea997,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1ca874f..17337e4 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 _0x894c=['../../config/environment','define','util','moment','request-promise','path'];(function(_0x563188,_0x157c4d){var _0x211dde=function(_0x175b4b){while(--_0x175b4b){_0x563188['push'](_0x563188['shift']());}};_0x211dde(++_0x157c4d);}(_0x894c,0x98));var _0xc894=function(_0x343268,_0x137176){_0x343268=_0x343268-0x0;var _0x2b08f0=_0x894c[_0x343268];return _0x2b08f0;};'use strict';var _=require('lodash');var util=require(_0xc894('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc894('0x1'));var BPromise=require('bluebird');var rp=require(_0xc894('0x2'));var fs=require('fs');var path=require(_0xc894('0x3'));var rimraf=require('rimraf');var config=require(_0xc894('0x4'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0xbca199,_0x6f3adc){return _0xbca199[_0xc894('0x5')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b26=['moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','api'];(function(_0x2e111a,_0x2371a6){var _0x501903=function(_0x3d78a5){while(--_0x3d78a5){_0x2e111a['push'](_0x2e111a['shift']());}};_0x501903(++_0x2371a6);}(_0x4b26,0xa6));var _0x64b2=function(_0xc1e322,_0x4e6358){_0xc1e322=_0xc1e322-0x0;var _0x1ff756=_0x4b26[_0xc1e322];return _0x1ff756;};'use strict';var _=require(_0x64b2('0x0'));var util=require(_0x64b2('0x1'));var logger=require('../../config/logger')(_0x64b2('0x2'));var moment=require(_0x64b2('0x3'));var BPromise=require(_0x64b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64b2('0x5'));var rimraf=require(_0x64b2('0x6'));var config=require(_0x64b2('0x7'));var attributes=require(_0x64b2('0x8'));module[_0x64b2('0x9')]=function(_0x2583bb,_0x43182e){return _0x2583bb[_0x64b2('0xa')](_0x64b2('0xb'),attributes,{'tableName':_0x64b2('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6a092fd..c9e31ff 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 _0xcc6a=['where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','options','raw','VoiceDialReport','update','body'];(function(_0x35343b,_0x3a53a5){var _0x1b725d=function(_0x1d9f6b){while(--_0x1d9f6b){_0x35343b['push'](_0x35343b['shift']());}};_0x1b725d(++_0x3a53a5);}(_0xcc6a,0x1be));var _0xacc6=function(_0x22d606,_0x274cdd){_0x22d606=_0x22d606-0x0;var _0x2b03d0=_0xcc6a[_0x22d606];return _0x2b03d0;};'use strict';var _=require(_0xacc6('0x0'));var util=require(_0xacc6('0x1'));var moment=require(_0xacc6('0x2'));var BPromise=require(_0xacc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacc6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xacc6('0x5'));var logger=require(_0xacc6('0x6'))('rpc');var config=require(_0xacc6('0x7'));var jayson=require(_0xacc6('0x8'));var client=jayson[_0xacc6('0x9')][_0xacc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b702b,_0x93dbe4,_0x14d3ff){return new BPromise(function(_0x170854,_0x4e94dc){return client[_0xacc6('0xb')](_0x5b702b,_0x14d3ff)[_0xacc6('0xc')](function(_0x2f541a){logger[_0xacc6('0xd')](_0xacc6('0xe'),_0x93dbe4,'request\x20sent');logger[_0xacc6('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x93dbe4,_0xacc6('0x10'),JSON[_0xacc6('0x11')](_0x2f541a));if(_0x2f541a[_0xacc6('0x12')]){if(_0x2f541a['error'][_0xacc6('0x13')]===0x1f4){logger['error'](_0xacc6('0xe'),_0x93dbe4,_0x2f541a[_0xacc6('0x12')][_0xacc6('0x14')]);return _0x4e94dc(_0x2f541a['error'][_0xacc6('0x14')]);}logger[_0xacc6('0x12')](_0xacc6('0xe'),_0x93dbe4,_0x2f541a['error']['message']);return _0x170854(_0x2f541a[_0xacc6('0x12')][_0xacc6('0x14')]);}else{logger['info'](_0xacc6('0xe'),_0x93dbe4,_0xacc6('0x10'));_0x170854(_0x2f541a[_0xacc6('0x15')][_0xacc6('0x14')]);}})[_0xacc6('0x16')](function(_0x5dc3e0){logger['error'](_0xacc6('0xe'),_0x93dbe4,_0x5dc3e0);_0x4e94dc(_0x5dc3e0);});});}exports[_0xacc6('0x17')]=function(_0x3c79c2){var _0xb24aa0=this;return new Promise(function(_0x3ce3c6,_0xcaed1b){return db['VoiceDialReport'][_0xacc6('0x18')](_0x3c79c2['body'],{'raw':_0x3c79c2[_0xacc6('0x19')]?_0x3c79c2[_0xacc6('0x19')][_0xacc6('0x1a')]===undefined?!![]:![]:!![]})[_0xacc6('0xc')](function(_0x12ee7b){logger['info'](_0xacc6('0x17'),_0x3c79c2);logger[_0xacc6('0xf')](_0xacc6('0x17'),_0x3c79c2,JSON[_0xacc6('0x11')](_0x12ee7b));_0x3ce3c6(_0x12ee7b);})[_0xacc6('0x16')](function(_0x15f0b9){logger[_0xacc6('0x12')](_0xacc6('0x17'),_0x15f0b9[_0xacc6('0x14')],_0x3c79c2);_0xcaed1b(_0xb24aa0[_0xacc6('0x12')](0x1f4,_0x15f0b9['message']));});});};exports['UpdateVoiceDialReport']=function(_0x3d6f86){var _0x1aa53a=this;return new Promise(function(_0x29495,_0x1fcca5){return db[_0xacc6('0x1b')][_0xacc6('0x1c')](_0x3d6f86[_0xacc6('0x1d')],{'raw':_0x3d6f86['options']?_0x3d6f86['options'][_0xacc6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6f86[_0xacc6('0x19')]?_0x3d6f86[_0xacc6('0x19')][_0xacc6('0x1e')]||null:null,'attributes':_0x3d6f86[_0xacc6('0x19')]?_0x3d6f86['options'][_0xacc6('0x1f')]||null:null,'limit':_0x3d6f86[_0xacc6('0x19')]?_0x3d6f86[_0xacc6('0x19')][_0xacc6('0x20')]||null:null})[_0xacc6('0xc')](function(_0x3c1a0c){logger[_0xacc6('0xd')](_0xacc6('0x21'),_0x3d6f86);logger['debug']('UpdateVoiceDialReport',_0x3d6f86,JSON['stringify'](_0x3c1a0c));_0x29495(_0x3c1a0c);})[_0xacc6('0x16')](function(_0x451b21){logger[_0xacc6('0x12')](_0xacc6('0x21'),_0x451b21[_0xacc6('0x14')],_0x3d6f86);_0x1fcca5(_0x1aa53a[_0xacc6('0x12')](0x1f4,_0x451b21[_0xacc6('0x14')]));});});}; \ No newline at end of file +var _0x0464=['../../config/environment','jayson/promise','client','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x0464,0x141));var _0x4046=function(_0x5f43f2,_0x57535e){_0x5f43f2=_0x5f43f2-0x0;var _0x7066cc=_0x0464[_0x5f43f2];return _0x7066cc;};'use strict';var _=require(_0x4046('0x0'));var util=require(_0x4046('0x1'));var moment=require(_0x4046('0x2'));var BPromise=require(_0x4046('0x3'));var rs=require(_0x4046('0x4'));var fs=require('fs');var Redis=require(_0x4046('0x5'));var db=require(_0x4046('0x6'))['db'];var utils=require(_0x4046('0x7'));var logger=require(_0x4046('0x8'))('rpc');var config=require(_0x4046('0x9'));var jayson=require(_0x4046('0xa'));var client=jayson[_0x4046('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16159a,_0x37e143,_0x5f43d9){return new BPromise(function(_0x1a7ff1,_0x9c1a67){return client[_0x4046('0xc')](_0x16159a,_0x5f43d9)[_0x4046('0xd')](function(_0x25f1d4){logger[_0x4046('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x37e143,'request\x20sent');logger[_0x4046('0xf')](_0x4046('0x10'),_0x37e143,_0x4046('0x11'),JSON[_0x4046('0x12')](_0x25f1d4));if(_0x25f1d4[_0x4046('0x13')]){if(_0x25f1d4['error'][_0x4046('0x14')]===0x1f4){logger[_0x4046('0x13')](_0x4046('0x15'),_0x37e143,_0x25f1d4['error']['message']);return _0x9c1a67(_0x25f1d4[_0x4046('0x13')][_0x4046('0x16')]);}logger[_0x4046('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x37e143,_0x25f1d4['error']['message']);return _0x1a7ff1(_0x25f1d4['error']['message']);}else{logger[_0x4046('0xe')](_0x4046('0x15'),_0x37e143,_0x4046('0x11'));_0x1a7ff1(_0x25f1d4[_0x4046('0x17')][_0x4046('0x16')]);}})[_0x4046('0x18')](function(_0x4aac56){logger[_0x4046('0x13')](_0x4046('0x15'),_0x37e143,_0x4aac56);_0x9c1a67(_0x4aac56);});});}exports[_0x4046('0x19')]=function(_0x4e8e09){var _0x108c66=this;return new Promise(function(_0x5d5a76,_0x5753e0){return db[_0x4046('0x1a')][_0x4046('0x1b')](_0x4e8e09['body'],{'raw':_0x4e8e09[_0x4046('0x1c')]?_0x4e8e09['options'][_0x4046('0x1d')]===undefined?!![]:![]:!![]})[_0x4046('0xd')](function(_0x3f5c13){logger['info'](_0x4046('0x19'),_0x4e8e09);logger[_0x4046('0xf')](_0x4046('0x19'),_0x4e8e09,JSON[_0x4046('0x12')](_0x3f5c13));_0x5d5a76(_0x3f5c13);})[_0x4046('0x18')](function(_0x524e84){logger[_0x4046('0x13')](_0x4046('0x19'),_0x524e84[_0x4046('0x16')],_0x4e8e09);_0x5753e0(_0x108c66['error'](0x1f4,_0x524e84[_0x4046('0x16')]));});});};exports[_0x4046('0x1e')]=function(_0x270912){var _0x579b25=this;return new Promise(function(_0x59e703,_0x16ce20){return db[_0x4046('0x1a')][_0x4046('0x1f')](_0x270912['body'],{'raw':_0x270912['options']?_0x270912[_0x4046('0x1c')][_0x4046('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x270912[_0x4046('0x1c')]?_0x270912[_0x4046('0x1c')]['where']||null:null,'attributes':_0x270912['options']?_0x270912[_0x4046('0x1c')]['attributes']||null:null,'limit':_0x270912[_0x4046('0x1c')]?_0x270912['options'][_0x4046('0x20')]||null:null})[_0x4046('0xd')](function(_0x1d208d){logger['info'](_0x4046('0x1e'),_0x270912);logger[_0x4046('0xf')]('UpdateVoiceDialReport',_0x270912,JSON[_0x4046('0x12')](_0x1d208d));_0x59e703(_0x1d208d);})[_0x4046('0x18')](function(_0xb1d39e){logger['error']('UpdateVoiceDialReport',_0xb1d39e[_0x4046('0x16')],_0x270912);_0x16ce20(_0x579b25[_0x4046('0x13')](0x1f4,_0xb1d39e[_0x4046('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8f034fa..6a03310 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 _0xab2e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','/:id','post','create','addApplications','put','delete','destroy','exports','multer'];(function(_0x1404d3,_0x1baf27){var _0x5d360d=function(_0x4f0d60){while(--_0x4f0d60){_0x1404d3['push'](_0x1404d3['shift']());}};_0x5d360d(++_0x1baf27);}(_0xab2e,0x167));var _0xeab2=function(_0x342231,_0x1618f3){_0x342231=_0x342231-0x0;var _0x32e1cd=_0xab2e[_0x342231];return _0x32e1cd;};'use strict';var multer=require(_0xeab2('0x0'));var util=require('util');var path=require(_0xeab2('0x1'));var timeout=require(_0xeab2('0x2'));var express=require('express');var router=express[_0xeab2('0x3')]();var fs_extra=require(_0xeab2('0x4'));var auth=require(_0xeab2('0x5'));var interaction=require(_0xeab2('0x6'));var config=require('../../config/environment');var controller=require(_0xeab2('0x7'));router[_0xeab2('0x8')]('/',auth[_0xeab2('0x9')](),controller['index']);router[_0xeab2('0x8')](_0xeab2('0xa'),auth[_0xeab2('0x9')](),controller['show']);router[_0xeab2('0xb')]('/',auth[_0xeab2('0x9')](),controller[_0xeab2('0xc')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xeab2('0xd')]);router[_0xeab2('0xe')]('/:id',auth[_0xeab2('0x9')](),controller['update']);router[_0xeab2('0xf')](_0xeab2('0xa'),auth[_0xeab2('0x9')](),controller[_0xeab2('0x10')]);module[_0xeab2('0x11')]=router; \ No newline at end of file +var _0x0983=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ae96b,_0x394c2f){var _0x1689c1=function(_0x25897d){while(--_0x25897d){_0x4ae96b['push'](_0x4ae96b['shift']());}};_0x1689c1(++_0x394c2f);}(_0x0983,0x1db));var _0x3098=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0983[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x3098('0x0'));var util=require(_0x3098('0x1'));var path=require('path');var timeout=require(_0x3098('0x2'));var express=require(_0x3098('0x3'));var router=express[_0x3098('0x4')]();var fs_extra=require(_0x3098('0x5'));var auth=require(_0x3098('0x6'));var interaction=require(_0x3098('0x7'));var config=require(_0x3098('0x8'));var controller=require(_0x3098('0x9'));router[_0x3098('0xa')]('/',auth[_0x3098('0xb')](),controller[_0x3098('0xc')]);router[_0x3098('0xa')](_0x3098('0xd'),auth[_0x3098('0xb')](),controller[_0x3098('0xe')]);router[_0x3098('0xf')]('/',auth[_0x3098('0xb')](),controller[_0x3098('0x10')]);router[_0x3098('0xf')]('/:id/applications',auth[_0x3098('0xb')](),controller['addApplications']);router[_0x3098('0x11')](_0x3098('0xd'),auth[_0x3098('0xb')](),controller[_0x3098('0x12')]);router[_0x3098('0x13')](_0x3098('0xd'),auth[_0x3098('0xb')](),controller['destroy']);module[_0x3098('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index defcd57..76f034b 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 _0x7437=['outbound-fax','any','INTEGER','wav','BOOLEAN','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','ENUM','outbound','internal','inbound-fax'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7437,0x142));var _0x7743=function(_0x455913,_0x2b7a92){_0x455913=_0x455913-0x0;var _0x3025b8=_0x7437[_0x455913];return _0x3025b8;};'use strict';var Sequelize=require(_0x7743('0x0'));module[_0x7743('0x1')]={'context':{'type':Sequelize[_0x7743('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7743('0x3')},'priority':{'type':Sequelize[_0x7743('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7743('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7743('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x7743('0x4')]('inbound',_0x7743('0x5'),_0x7743('0x6'),_0x7743('0x7'),_0x7743('0x8'),'system',_0x7743('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x7743('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x7743('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x7743('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7743('0xa')]},'recordingFormat':{'type':Sequelize[_0x7743('0x2')],'defaultValue':_0x7743('0xb')},'answer':{'type':Sequelize[_0x7743('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7743('0xd')],'get':function(_0x3bcc48){return this[_0x7743('0xe')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xef4b=['system','INTEGER','BOOLEAN','wav','getDataValue','STRING','compositeIndex','outbound','internal','inbound-fax','outbound-fax'];(function(_0x378f14,_0x59afde){var _0x24ebd3=function(_0x5bce24){while(--_0x5bce24){_0x378f14['push'](_0x378f14['shift']());}};_0x24ebd3(++_0x59afde);}(_0xef4b,0x170));var _0xbef4=function(_0x24783a,_0x75041){_0x24783a=_0x24783a-0x0;var _0x227a77=_0xef4b[_0x24783a];return _0x227a77;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xbef4('0x0')],'allowNull':![],'unique':_0xbef4('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbef4('0x0')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xbef4('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0xbef4('0x2'),_0xbef4('0x3'),_0xbef4('0x4'),_0xbef4('0x5'),_0xbef4('0x6'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xbef4('0x0')]},'interval':{'type':Sequelize[_0xbef4('0x0')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xbef4('0x7')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbef4('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbef4('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xbef4('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbef4('0x7')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xbef4('0x9')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2a8826){return this[_0xbef4('0xa')]('exten');}},'alias':{'type':Sequelize[_0xbef4('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 33b10e0..2e5cede 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 _0x3e6f=['rawAttributes','fieldName','model','keys','query','intersection','attributes','length','hasOwnProperty','sort','filters','pick','merge','where','VoiceExtension','includeAll','include','rows','catch','params','fields','options','create','startsWith','body','exten','user','role','get','InboundRoutes','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','undefined','limit','count','offset','set','json','destroy','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','find','name','UserProfileResource','then','error','map'];(function(_0x43ed36,_0x1b31f0){var _0x6cf89d=function(_0x1d0c88){while(--_0x1d0c88){_0x43ed36['push'](_0x43ed36['shift']());}};_0x6cf89d(++_0x1b31f0);}(_0x3e6f,0x177));var _0xf3e6=function(_0x359172,_0x12ac30){_0x359172=_0x359172-0x0;var _0x26ef94=_0x3e6f[_0x359172];return _0x26ef94;};'use strict';var _=require(_0xf3e6('0x0'));var Redis=require(_0xf3e6('0x1'));var qs=require(_0xf3e6('0x2'));var logger=require('../../config/logger')('api');var config=require(_0xf3e6('0x3'));var db=require(_0xf3e6('0x4'))['db'];config[_0xf3e6('0x5')]=_[_0xf3e6('0x6')](config['redis'],{'host':_0xf3e6('0x7'),'port':0x18eb});var socket=require(_0xf3e6('0x8'))(new Redis(config[_0xf3e6('0x5')]));require(_0xf3e6('0x9'))[_0xf3e6('0xa')](socket);function respondWithStatusCode(_0x117959,_0x35768){_0x35768=_0x35768||0xcc;return function(_0x448139){if(_0x448139){return _0x117959[_0xf3e6('0xb')](_0x35768);}return _0x117959[_0xf3e6('0xc')](_0x35768)['end']();};}function respondWithResult(_0x5a9dbc,_0x1fb428){_0x1fb428=_0x1fb428||0xc8;return function(_0x520db5){if(_0x520db5){return _0x5a9dbc[_0xf3e6('0xc')](_0x1fb428)['json'](_0x520db5);}};}function respondWithFilteredResult(_0x5a0796,_0x41b120){return function(_0x38b1ca){if(_0x38b1ca){var _0x71e3b0=typeof _0x41b120['offset']===_0xf3e6('0xd')&&typeof _0x41b120[_0xf3e6('0xe')]===_0xf3e6('0xd');var _0x1efae5=_0x38b1ca[_0xf3e6('0xf')];var _0x584409=_0x71e3b0?0x0:_0x41b120[_0xf3e6('0x10')];var _0x525c9d=_0x71e3b0?_0x38b1ca[_0xf3e6('0xf')]:_0x41b120[_0xf3e6('0x10')]+_0x41b120[_0xf3e6('0xe')];var _0x2e7e69;if(_0x525c9d>=_0x1efae5){_0x525c9d=_0x1efae5;_0x2e7e69=0xc8;}else{_0x2e7e69=0xce;}_0x5a0796['status'](_0x2e7e69);return _0x5a0796[_0xf3e6('0x11')]('Content-Range',_0x584409+'-'+_0x525c9d+'/'+_0x1efae5)[_0xf3e6('0x12')](_0x38b1ca);}return null;};}function removeEntity(_0x137f49){return function(_0x219e0a){if(_0x219e0a){return _0x219e0a[_0xf3e6('0x13')]()['then'](function(){var _0x563a27=_0x219e0a['get']({'plain':!![]});var _0x401290=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xf3e6('0x14'),'value':_0xf3e6('0x15'),'ignore':![]},{'name':_0xf3e6('0x16'),'value':_0xf3e6('0x17'),'ignore':![]}];var _0x5dbe04=_(_0x401290)[_0xf3e6('0x18')](_0xf3e6('0x19'))['map']('value')[_0xf3e6('0x1a')]();if(_[_0xf3e6('0x1b')](_0x5dbe04,_0x563a27[_0xf3e6('0x1c')])){return;}var _0x134b9d=_[_0xf3e6('0x1d')](_0x401290,[_0xf3e6('0x1a'),_0x563a27['type']])[_0xf3e6('0x1e')];return db[_0xf3e6('0x1f')][_0xf3e6('0x13')]({'where':{'type':_0x134b9d,'resourceId':_0x563a27['id']}})[_0xf3e6('0x20')](function(){return _0x219e0a;});})[_0xf3e6('0x20')](function(){_0x137f49[_0xf3e6('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f9996){return function(_0x10c937){if(!_0x10c937){_0x3f9996[_0xf3e6('0xb')](0x194);}return _0x10c937;};}function handleError(_0x5511dc,_0x1cea71){_0x1cea71=_0x1cea71||0x1f4;return function(_0x44b55f){logger[_0xf3e6('0x21')](_0x44b55f['stack']);if(_0x44b55f[_0xf3e6('0x1e')]){delete _0x44b55f[_0xf3e6('0x1e')];}_0x5511dc[_0xf3e6('0xc')](_0x1cea71)['send'](_0x44b55f);};}exports['index']=function(_0x17a128,_0x5b1432){var _0x2b991f={},_0x1a7c9e={},_0x270d54={'count':0x0,'rows':[]};var _0x14975d=_[_0xf3e6('0x22')](db['VoiceExtension'][_0xf3e6('0x23')],function(_0x3448e8){return{'name':_0x3448e8[_0xf3e6('0x24')],'type':_0x3448e8[_0xf3e6('0x1c')]['key']};});_0x1a7c9e[_0xf3e6('0x25')]=_[_0xf3e6('0x22')](_0x14975d,_0xf3e6('0x1e'));_0x1a7c9e['query']=_[_0xf3e6('0x26')](_0x17a128[_0xf3e6('0x27')]);_0x1a7c9e['filters']=_[_0xf3e6('0x28')](_0x1a7c9e[_0xf3e6('0x25')],_0x1a7c9e[_0xf3e6('0x27')]);_0x2b991f[_0xf3e6('0x29')]=_[_0xf3e6('0x28')](_0x1a7c9e[_0xf3e6('0x25')],qs['fields'](_0x17a128[_0xf3e6('0x27')]['fields']));_0x2b991f[_0xf3e6('0x29')]=_0x2b991f[_0xf3e6('0x29')][_0xf3e6('0x2a')]?_0x2b991f[_0xf3e6('0x29')]:_0x1a7c9e[_0xf3e6('0x25')];if(!_0x17a128[_0xf3e6('0x27')][_0xf3e6('0x2b')]('nolimit')){_0x2b991f['limit']=qs[_0xf3e6('0xe')](_0x17a128['query']['limit']);_0x2b991f[_0xf3e6('0x10')]=qs['offset'](_0x17a128[_0xf3e6('0x27')][_0xf3e6('0x10')]);}_0x2b991f['order']=qs[_0xf3e6('0x2c')](_0x17a128[_0xf3e6('0x27')]['sort']);_0x2b991f['where']=qs[_0xf3e6('0x2d')](_[_0xf3e6('0x2e')](_0x17a128[_0xf3e6('0x27')],_0x1a7c9e[_0xf3e6('0x2d')]),_0x14975d);if(_0x17a128[_0xf3e6('0x27')]['filter']){_0x2b991f['where']=_[_0xf3e6('0x2f')](_0x2b991f[_0xf3e6('0x30')],{'$or':_[_0xf3e6('0x22')](_0x14975d,function(_0x327254){if(_0x327254['type']!=='VIRTUAL'){var _0x3b2555={};_0x3b2555[_0x327254[_0xf3e6('0x1e')]]={'$like':'%'+_0x17a128[_0xf3e6('0x27')][_0xf3e6('0x18')]+'%'};return _0x3b2555;}})});}_0x2b991f=_[_0xf3e6('0x2f')]({},_0x2b991f,_0x17a128['options']);var _0x33addf={'where':_0x2b991f[_0xf3e6('0x30')]};return db[_0xf3e6('0x31')][_0xf3e6('0xf')](_0x33addf)[_0xf3e6('0x20')](function(_0x5b13f6){_0x270d54[_0xf3e6('0xf')]=_0x5b13f6;if(_0x17a128[_0xf3e6('0x27')][_0xf3e6('0x32')]){_0x2b991f[_0xf3e6('0x33')]=[{'all':!![]}];}return db[_0xf3e6('0x31')]['findAll'](_0x2b991f);})[_0xf3e6('0x20')](function(_0x190608){_0x270d54[_0xf3e6('0x34')]=_0x190608;return _0x270d54;})[_0xf3e6('0x20')](respondWithFilteredResult(_0x5b1432,_0x2b991f))[_0xf3e6('0x35')](handleError(_0x5b1432,null));};exports['show']=function(_0xc91247,_0x2b335c){var _0x31561d={'raw':![],'where':{'id':_0xc91247[_0xf3e6('0x36')]['id']}},_0x542beb={};_0x542beb['model']=_['keys'](db[_0xf3e6('0x31')]['rawAttributes']);_0x542beb[_0xf3e6('0x27')]=_[_0xf3e6('0x26')](_0xc91247[_0xf3e6('0x27')]);_0x542beb[_0xf3e6('0x2d')]=_[_0xf3e6('0x28')](_0x542beb[_0xf3e6('0x25')],_0x542beb['query']);_0x31561d[_0xf3e6('0x29')]=_[_0xf3e6('0x28')](_0x542beb[_0xf3e6('0x25')],qs[_0xf3e6('0x37')](_0xc91247[_0xf3e6('0x27')][_0xf3e6('0x37')]));_0x31561d['attributes']=_0x31561d[_0xf3e6('0x29')]['length']?_0x31561d[_0xf3e6('0x29')]:_0x542beb[_0xf3e6('0x25')];if(_0xc91247[_0xf3e6('0x27')]['includeAll']){_0x31561d[_0xf3e6('0x33')]=[{'all':!![]}];}_0x31561d=_[_0xf3e6('0x2f')]({},_0x31561d,_0xc91247[_0xf3e6('0x38')]);return db[_0xf3e6('0x31')]['find'](_0x31561d)[_0xf3e6('0x20')](handleEntityNotFound(_0x2b335c,null))[_0xf3e6('0x20')](respondWithResult(_0x2b335c,null))[_0xf3e6('0x35')](handleError(_0x2b335c,null));};exports[_0xf3e6('0x13')]=function(_0x30f587,_0x40bc70){return db[_0xf3e6('0x31')][_0xf3e6('0x1d')]({'where':{'id':_0x30f587[_0xf3e6('0x36')]['id']}})[_0xf3e6('0x20')](handleEntityNotFound(_0x40bc70,null))[_0xf3e6('0x20')](removeEntity(_0x40bc70,null))[_0xf3e6('0x35')](handleError(_0x40bc70,null));};exports[_0xf3e6('0x39')]=function(_0x1edeb4,_0x560f85){if(_0x1edeb4['body']['type']==='outbound'&&!_[_0xf3e6('0x3a')](_0x1edeb4[_0xf3e6('0x3b')][_0xf3e6('0x3c')],'_')){_0x1edeb4[_0xf3e6('0x3b')]['exten']='_'['concat'](_0x1edeb4[_0xf3e6('0x3b')][_0xf3e6('0x3c')]);}return db[_0xf3e6('0x31')][_0xf3e6('0x39')](_0x1edeb4['body'],{'raw':![]})[_0xf3e6('0x20')](function(_0x4bc642){var _0x40fd07=_0x1edeb4[_0xf3e6('0x3d')]['get']({'plain':!![]});if(!_0x40fd07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40fd07[_0xf3e6('0x3e')]===_0xf3e6('0x3d')){var _0x3b8c90=_0x4bc642[_0xf3e6('0x3f')]({'plain':!![]});var _0x2871f0=[{'name':_0xf3e6('0x40'),'value':_0xf3e6('0x41')},{'name':_0xf3e6('0x14'),'value':_0xf3e6('0x15')},{'name':_0xf3e6('0x16'),'value':_0xf3e6('0x17')}];var _0x3c9d74=_[_0xf3e6('0x1d')](_0x2871f0,['value',_0x3b8c90[_0xf3e6('0x1c')]])['name'];return db[_0xf3e6('0x42')]['find']({'where':{'name':_0x3c9d74,'userProfileId':_0x40fd07[_0xf3e6('0x43')]},'raw':!![]})[_0xf3e6('0x20')](function(_0x4d329f){if(_0x4d329f&&_0x4d329f[_0xf3e6('0x44')]===0x0){return db['UserProfileResource'][_0xf3e6('0x39')]({'name':_0x3b8c90[_0xf3e6('0x1e')],'resourceId':_0x3b8c90['id'],'type':_0x4d329f[_0xf3e6('0x1e')],'sectionId':_0x4d329f['id']},{})['then'](function(){return _0x4bc642;});}else{return _0x4bc642;}})[_0xf3e6('0x35')](function(_0x5baa18){logger['error'](_0xf3e6('0x45'),_0x5baa18);throw _0x5baa18;});}return _0x4bc642;})[_0xf3e6('0x20')](respondWithResult(_0x560f85,0xc9))['catch'](handleError(_0x560f85,null));};exports[_0xf3e6('0x46')]=function(_0x804be7,_0x423036){if(_0x804be7['body']['id']){delete _0x804be7[_0xf3e6('0x3b')]['id'];}return db['VoiceExtension'][_0xf3e6('0x1d')]({'where':{'id':_0x804be7['params']['id']}})['then'](handleEntityNotFound(_0x423036,null))['then'](function(_0x295f3d){if(_0x295f3d){return db[_0xf3e6('0x31')][_0xf3e6('0x46')](_[_0xf3e6('0x2e')](_0x804be7[_0xf3e6('0x3b')],[_0xf3e6('0x3c'),_0xf3e6('0x47'),'description',_0xf3e6('0x48'),'cutdigits','mandatoryDisposition',_0xf3e6('0x49')]),{'where':{'context':_0x295f3d['context'],'exten':_0x295f3d[_0xf3e6('0x3c')]},'individualHooks':!![]})[_0xf3e6('0x20')](function(_0x4ccfac){return _0x4ccfac;});}return null;})[_0xf3e6('0x20')](respondWithStatusCode(_0x423036,null))[_0xf3e6('0x35')](handleError(_0x423036,null));};exports[_0xf3e6('0x4a')]=function(_0x391d58,_0x107ba0){var _0x1195e1=_0x391d58['params']['id'];var _0x20cadd=_0x391d58[_0xf3e6('0x3b')];var _0x35e41d=0xc8;var _0x586386=null;return db[_0xf3e6('0x4b')][_0xf3e6('0x4c')]({'isolationLevel':db[_0xf3e6('0x4b')][_0xf3e6('0x4d')][_0xf3e6('0x4e')][_0xf3e6('0x4f')]},function(_0x395505){return db[_0xf3e6('0x31')][_0xf3e6('0x50')]({'where':{'id':_0x1195e1},'transaction':_0x395505})['then'](function(_0x1af624){if(_0x1af624){return db[_0xf3e6('0x31')]['destroy']({'where':{'VoiceExtensionId':_0x1195e1},'transaction':_0x395505})[_0xf3e6('0x20')](function(){var _0x345025=_['map'](_0x20cadd,function(_0x3fa8f0){_0x3fa8f0[_0xf3e6('0x51')]=_0x1195e1;_0x3fa8f0['isApp']=!![];return _0x3fa8f0;});return _0x1af624['createRouting'](_0x345025);})[_0xf3e6('0x20')](function(_0x5edcc0){return db['VoiceExtension']['bulkCreate'](_0x5edcc0,{'transaction':_0x395505});});}else{_0x35e41d=0x194;_0x586386=[];}});})[_0xf3e6('0x20')](function(){if(_0x35e41d!==0x194){return db[_0xf3e6('0x31')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1195e1},'order':'cast(priority\x20as\x20unsigned)'})[_0xf3e6('0x20')](function(_0x224dc2){_0x586386=_0x224dc2;});}})['catch'](function(_0x41917c){_0x35e41d=0x1f4;logger[_0xf3e6('0x21')](_0x41917c['stack']);if(_0x41917c[_0xf3e6('0x1e')]){delete _0x41917c[_0xf3e6('0x1e')];}_0x586386=_0x41917c;})['finally'](function(){if(_0x586386===null){_0x107ba0[_0xf3e6('0xb')](_0x35e41d);}else{if(_0x35e41d===0x1f4){_0x107ba0[_0xf3e6('0xc')](_0x35e41d)['send'](_0x586386);}else{_0x107ba0[_0xf3e6('0xc')](_0x35e41d)[_0xf3e6('0x12')](_0x586386);}}});}; \ No newline at end of file +var _0x7c13=['InternalRoutes','internal','filter','ignore','map','includes','type','find','name','UserProfileResource','sendStatus','error','stack','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','merge','options','findAll','rows','catch','show','params','keys','length','includeAll','create','body','startsWith','exten','concat','user','outbound','value','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','json','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','offset','undefined','count','destroy','then','get','InboundRoutes','inbound','OutboundRoutes'];(function(_0x3a483c,_0x182dde){var _0x5ce622=function(_0x4b6240){while(--_0x4b6240){_0x3a483c['push'](_0x3a483c['shift']());}};_0x5ce622(++_0x182dde);}(_0x7c13,0x162));var _0x37c1=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x7c13[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var Redis=require(_0x37c1('0x0'));var qs=require(_0x37c1('0x1'));var logger=require(_0x37c1('0x2'))(_0x37c1('0x3'));var config=require(_0x37c1('0x4'));var db=require('../../mysqldb')['db'];config[_0x37c1('0x5')]=_[_0x37c1('0x6')](config[_0x37c1('0x5')],{'host':_0x37c1('0x7'),'port':0x18eb});var socket=require(_0x37c1('0x8'))(new Redis(config[_0x37c1('0x5')]));require(_0x37c1('0x9'))[_0x37c1('0xa')](socket);function respondWithStatusCode(_0x2ca2b7,_0x4dab8d){_0x4dab8d=_0x4dab8d||0xcc;return function(_0x594788){if(_0x594788){return _0x2ca2b7['sendStatus'](_0x4dab8d);}return _0x2ca2b7[_0x37c1('0xb')](_0x4dab8d)[_0x37c1('0xc')]();};}function respondWithResult(_0x139f98,_0x5e576b){_0x5e576b=_0x5e576b||0xc8;return function(_0x22507f){if(_0x22507f){return _0x139f98[_0x37c1('0xb')](_0x5e576b)['json'](_0x22507f);}};}function respondWithFilteredResult(_0x498c33,_0x432d46){return function(_0x58ea29){if(_0x58ea29){var _0x43139c=typeof _0x432d46[_0x37c1('0xd')]===_0x37c1('0xe')&&typeof _0x432d46['limit']===_0x37c1('0xe');var _0x10690b=_0x58ea29[_0x37c1('0xf')];var _0x10d136=_0x43139c?0x0:_0x432d46[_0x37c1('0xd')];var _0x1498c3=_0x43139c?_0x58ea29[_0x37c1('0xf')]:_0x432d46[_0x37c1('0xd')]+_0x432d46['limit'];var _0xabcaf7;if(_0x1498c3>=_0x10690b){_0x1498c3=_0x10690b;_0xabcaf7=0xc8;}else{_0xabcaf7=0xce;}_0x498c33[_0x37c1('0xb')](_0xabcaf7);return _0x498c33['set']('Content-Range',_0x10d136+'-'+_0x1498c3+'/'+_0x10690b)['json'](_0x58ea29);}return null;};}function removeEntity(_0x5af064){return function(_0x21bc4b){if(_0x21bc4b){return _0x21bc4b[_0x37c1('0x10')]()[_0x37c1('0x11')](function(){var _0x1c9f1e=_0x21bc4b[_0x37c1('0x12')]({'plain':!![]});var _0x31ea21=[{'name':_0x37c1('0x13'),'value':_0x37c1('0x14'),'ignore':![]},{'name':_0x37c1('0x15'),'value':'outbound','ignore':![]},{'name':_0x37c1('0x16'),'value':_0x37c1('0x17'),'ignore':![]}];var _0x296924=_(_0x31ea21)[_0x37c1('0x18')](_0x37c1('0x19'))[_0x37c1('0x1a')]('value')['value']();if(_[_0x37c1('0x1b')](_0x296924,_0x1c9f1e[_0x37c1('0x1c')])){return;}var _0x3ca5e9=_[_0x37c1('0x1d')](_0x31ea21,['value',_0x1c9f1e[_0x37c1('0x1c')]])[_0x37c1('0x1e')];return db[_0x37c1('0x1f')][_0x37c1('0x10')]({'where':{'type':_0x3ca5e9,'resourceId':_0x1c9f1e['id']}})['then'](function(){return _0x21bc4b;});})[_0x37c1('0x11')](function(){_0x5af064[_0x37c1('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32f466){return function(_0x1b1436){if(!_0x1b1436){_0x32f466[_0x37c1('0x20')](0x194);}return _0x1b1436;};}function handleError(_0x4f1139,_0x1148d2){_0x1148d2=_0x1148d2||0x1f4;return function(_0x44d9c7){logger[_0x37c1('0x21')](_0x44d9c7[_0x37c1('0x22')]);if(_0x44d9c7[_0x37c1('0x1e')]){delete _0x44d9c7[_0x37c1('0x1e')];}_0x4f1139[_0x37c1('0xb')](_0x1148d2)['send'](_0x44d9c7);};}exports[_0x37c1('0x23')]=function(_0x40931d,_0xbaa5b0){var _0x25119a={},_0x33dbb7={},_0x2879d2={'count':0x0,'rows':[]};var _0x4dd68d=_['map'](db[_0x37c1('0x24')][_0x37c1('0x25')],function(_0x5d304a){return{'name':_0x5d304a[_0x37c1('0x26')],'type':_0x5d304a['type'][_0x37c1('0x27')]};});_0x33dbb7[_0x37c1('0x28')]=_[_0x37c1('0x1a')](_0x4dd68d,'name');_0x33dbb7[_0x37c1('0x29')]=_['keys'](_0x40931d[_0x37c1('0x29')]);_0x33dbb7[_0x37c1('0x2a')]=_[_0x37c1('0x2b')](_0x33dbb7[_0x37c1('0x28')],_0x33dbb7['query']);_0x25119a[_0x37c1('0x2c')]=_[_0x37c1('0x2b')](_0x33dbb7[_0x37c1('0x28')],qs[_0x37c1('0x2d')](_0x40931d[_0x37c1('0x29')][_0x37c1('0x2d')]));_0x25119a[_0x37c1('0x2c')]=_0x25119a['attributes']['length']?_0x25119a[_0x37c1('0x2c')]:_0x33dbb7['model'];if(!_0x40931d[_0x37c1('0x29')]['hasOwnProperty'](_0x37c1('0x2e'))){_0x25119a['limit']=qs['limit'](_0x40931d['query'][_0x37c1('0x2f')]);_0x25119a[_0x37c1('0xd')]=qs[_0x37c1('0xd')](_0x40931d[_0x37c1('0x29')][_0x37c1('0xd')]);}_0x25119a[_0x37c1('0x30')]=qs[_0x37c1('0x31')](_0x40931d['query'][_0x37c1('0x31')]);_0x25119a['where']=qs[_0x37c1('0x2a')](_['pick'](_0x40931d['query'],_0x33dbb7[_0x37c1('0x2a')]),_0x4dd68d);if(_0x40931d[_0x37c1('0x29')][_0x37c1('0x18')]){_0x25119a[_0x37c1('0x32')]=_[_0x37c1('0x33')](_0x25119a[_0x37c1('0x32')],{'$or':_['map'](_0x4dd68d,function(_0x1b6582){if(_0x1b6582[_0x37c1('0x1c')]!=='VIRTUAL'){var _0x23de01={};_0x23de01[_0x1b6582[_0x37c1('0x1e')]]={'$like':'%'+_0x40931d[_0x37c1('0x29')][_0x37c1('0x18')]+'%'};return _0x23de01;}})});}_0x25119a=_[_0x37c1('0x33')]({},_0x25119a,_0x40931d[_0x37c1('0x34')]);var _0x9fd743={'where':_0x25119a[_0x37c1('0x32')]};return db[_0x37c1('0x24')]['count'](_0x9fd743)[_0x37c1('0x11')](function(_0x36d93f){_0x2879d2[_0x37c1('0xf')]=_0x36d93f;if(_0x40931d[_0x37c1('0x29')]['includeAll']){_0x25119a['include']=[{'all':!![]}];}return db[_0x37c1('0x24')][_0x37c1('0x35')](_0x25119a);})[_0x37c1('0x11')](function(_0x1be8eb){_0x2879d2[_0x37c1('0x36')]=_0x1be8eb;return _0x2879d2;})['then'](respondWithFilteredResult(_0xbaa5b0,_0x25119a))[_0x37c1('0x37')](handleError(_0xbaa5b0,null));};exports[_0x37c1('0x38')]=function(_0x1035b3,_0x159b53){var _0x54d8bb={'raw':![],'where':{'id':_0x1035b3[_0x37c1('0x39')]['id']}},_0x50a916={};_0x50a916[_0x37c1('0x28')]=_[_0x37c1('0x3a')](db[_0x37c1('0x24')][_0x37c1('0x25')]);_0x50a916['query']=_[_0x37c1('0x3a')](_0x1035b3[_0x37c1('0x29')]);_0x50a916[_0x37c1('0x2a')]=_[_0x37c1('0x2b')](_0x50a916[_0x37c1('0x28')],_0x50a916[_0x37c1('0x29')]);_0x54d8bb[_0x37c1('0x2c')]=_[_0x37c1('0x2b')](_0x50a916[_0x37c1('0x28')],qs[_0x37c1('0x2d')](_0x1035b3['query'][_0x37c1('0x2d')]));_0x54d8bb['attributes']=_0x54d8bb[_0x37c1('0x2c')][_0x37c1('0x3b')]?_0x54d8bb[_0x37c1('0x2c')]:_0x50a916[_0x37c1('0x28')];if(_0x1035b3[_0x37c1('0x29')][_0x37c1('0x3c')]){_0x54d8bb['include']=[{'all':!![]}];}_0x54d8bb=_[_0x37c1('0x33')]({},_0x54d8bb,_0x1035b3[_0x37c1('0x34')]);return db['VoiceExtension']['find'](_0x54d8bb)[_0x37c1('0x11')](handleEntityNotFound(_0x159b53,null))['then'](respondWithResult(_0x159b53,null))[_0x37c1('0x37')](handleError(_0x159b53,null));};exports['destroy']=function(_0x4470c0,_0x28b335){return db[_0x37c1('0x24')][_0x37c1('0x1d')]({'where':{'id':_0x4470c0[_0x37c1('0x39')]['id']}})['then'](handleEntityNotFound(_0x28b335,null))[_0x37c1('0x11')](removeEntity(_0x28b335,null))['catch'](handleError(_0x28b335,null));};exports[_0x37c1('0x3d')]=function(_0x23a3f7,_0x1b3d01){if(_0x23a3f7[_0x37c1('0x3e')][_0x37c1('0x1c')]==='outbound'&&!_[_0x37c1('0x3f')](_0x23a3f7['body'][_0x37c1('0x40')],'_')){_0x23a3f7[_0x37c1('0x3e')][_0x37c1('0x40')]='_'[_0x37c1('0x41')](_0x23a3f7[_0x37c1('0x3e')][_0x37c1('0x40')]);}return db[_0x37c1('0x24')][_0x37c1('0x3d')](_0x23a3f7[_0x37c1('0x3e')],{'raw':![]})[_0x37c1('0x11')](function(_0xe3cfd8){var _0x4301bc=_0x23a3f7[_0x37c1('0x42')][_0x37c1('0x12')]({'plain':!![]});if(!_0x4301bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4301bc['role']===_0x37c1('0x42')){var _0x25e384=_0xe3cfd8[_0x37c1('0x12')]({'plain':!![]});var _0xaab06=[{'name':_0x37c1('0x13'),'value':_0x37c1('0x14')},{'name':_0x37c1('0x15'),'value':_0x37c1('0x43')},{'name':_0x37c1('0x16'),'value':_0x37c1('0x17')}];var _0x146780=_[_0x37c1('0x1d')](_0xaab06,[_0x37c1('0x44'),_0x25e384[_0x37c1('0x1c')]])[_0x37c1('0x1e')];return db['UserProfileSection']['find']({'where':{'name':_0x146780,'userProfileId':_0x4301bc[_0x37c1('0x45')]},'raw':!![]})[_0x37c1('0x11')](function(_0x53dd49){if(_0x53dd49&&_0x53dd49[_0x37c1('0x46')]===0x0){return db[_0x37c1('0x1f')][_0x37c1('0x3d')]({'name':_0x25e384[_0x37c1('0x1e')],'resourceId':_0x25e384['id'],'type':_0x53dd49[_0x37c1('0x1e')],'sectionId':_0x53dd49['id']},{})['then'](function(){return _0xe3cfd8;});}else{return _0xe3cfd8;}})[_0x37c1('0x37')](function(_0x25dd12){logger['error'](_0x37c1('0x47'),_0x25dd12);throw _0x25dd12;});}return _0xe3cfd8;})[_0x37c1('0x11')](respondWithResult(_0x1b3d01,0xc9))[_0x37c1('0x37')](handleError(_0x1b3d01,null));};exports[_0x37c1('0x48')]=function(_0x1e54a9,_0x107eed){if(_0x1e54a9['body']['id']){delete _0x1e54a9[_0x37c1('0x3e')]['id'];}return db[_0x37c1('0x24')]['find']({'where':{'id':_0x1e54a9[_0x37c1('0x39')]['id']}})[_0x37c1('0x11')](handleEntityNotFound(_0x107eed,null))[_0x37c1('0x11')](function(_0x41ce33){if(_0x41ce33){return db[_0x37c1('0x24')]['update'](_[_0x37c1('0x49')](_0x1e54a9[_0x37c1('0x3e')],['exten',_0x37c1('0x4a'),_0x37c1('0x4b'),_0x37c1('0x4c'),_0x37c1('0x4d'),_0x37c1('0x4e'),_0x37c1('0x4f')]),{'where':{'context':_0x41ce33[_0x37c1('0x4a')],'exten':_0x41ce33[_0x37c1('0x40')]},'individualHooks':!![]})['then'](function(_0x491897){return _0x491897;});}return null;})['then'](respondWithStatusCode(_0x107eed,null))[_0x37c1('0x37')](handleError(_0x107eed,null));};exports[_0x37c1('0x50')]=function(_0x3711a0,_0x569e1f){var _0x1b9a8=_0x3711a0[_0x37c1('0x39')]['id'];var _0x53f278=_0x3711a0['body'];var _0xc510bb=0xc8;var _0x15977d=null;return db[_0x37c1('0x51')][_0x37c1('0x52')]({'isolationLevel':db[_0x37c1('0x51')][_0x37c1('0x53')][_0x37c1('0x54')]['READ_COMMITTED']},function(_0x270226){return db[_0x37c1('0x24')][_0x37c1('0x55')]({'where':{'id':_0x1b9a8},'transaction':_0x270226})[_0x37c1('0x11')](function(_0x5e17c7){if(_0x5e17c7){return db['VoiceExtension'][_0x37c1('0x10')]({'where':{'VoiceExtensionId':_0x1b9a8},'transaction':_0x270226})[_0x37c1('0x11')](function(){var _0x5bac9e=_[_0x37c1('0x1a')](_0x53f278,function(_0xa8c1b6){_0xa8c1b6[_0x37c1('0x56')]=_0x1b9a8;_0xa8c1b6['isApp']=!![];return _0xa8c1b6;});return _0x5e17c7[_0x37c1('0x57')](_0x5bac9e);})['then'](function(_0x484c87){return db[_0x37c1('0x24')][_0x37c1('0x58')](_0x484c87,{'transaction':_0x270226});});}else{_0xc510bb=0x194;_0x15977d=[];}});})[_0x37c1('0x11')](function(){if(_0xc510bb!==0x194){return db[_0x37c1('0x24')][_0x37c1('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1b9a8},'order':_0x37c1('0x5a')})[_0x37c1('0x11')](function(_0x5a4766){_0x15977d=_0x5a4766;});}})[_0x37c1('0x37')](function(_0x180732){_0xc510bb=0x1f4;logger['error'](_0x180732['stack']);if(_0x180732[_0x37c1('0x1e')]){delete _0x180732['name'];}_0x15977d=_0x180732;})[_0x37c1('0x5b')](function(){if(_0x15977d===null){_0x569e1f['sendStatus'](_0xc510bb);}else{if(_0xc510bb===0x1f4){_0x569e1f[_0x37c1('0xb')](_0xc510bb)[_0x37c1('0x5c')](_0x15977d);}else{_0x569e1f[_0x37c1('0xb')](_0xc510bb)[_0x37c1('0x5d')](_0x15977d);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5b9e9e7..f6ec711 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 _0x74fa=['VoiceExtension','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x490d5e,_0xea1cc6){var _0x49e574=function(_0x5164a4){while(--_0x5164a4){_0x490d5e['push'](_0x490d5e['shift']());}};_0x49e574(++_0xea1cc6);}(_0x74fa,0x1c0));var _0xa74f=function(_0x287742,_0x12479e){_0x287742=_0x287742-0x0;var _0x43b7fc=_0x74fa[_0x287742];return _0x43b7fc;};'use strict';var EventEmitter=require(_0xa74f('0x0'));var VoiceExtension=require(_0xa74f('0x1'))['db'][_0xa74f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa74f('0x3'),'afterUpdate':_0xa74f('0x4'),'afterDestroy':_0xa74f('0x5')};function emitEvent(_0x59b7d9){return function(_0x3c2af5,_0x21f663,_0x1cbac3){VoiceExtensionEvents[_0xa74f('0x6')](_0x59b7d9+':'+_0x3c2af5['id'],_0x3c2af5);VoiceExtensionEvents[_0xa74f('0x6')](_0x59b7d9,_0x3c2af5);_0x1cbac3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xa74f('0x7')](e,emitEvent(event));}}module[_0xa74f('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xa1a1=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0xa1a1,0x6c));var _0x1a1a=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xa1a1[_0x37a7c6];return _0x539905;};'use strict';var EventEmitter=require(_0x1a1a('0x0'));var VoiceExtension=require(_0x1a1a('0x1'))['db'][_0x1a1a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1a1a('0x3')](0x0);var events={'afterCreate':_0x1a1a('0x4'),'afterUpdate':_0x1a1a('0x5'),'afterDestroy':_0x1a1a('0x6')};function emitEvent(_0x24d909){return function(_0x47969d,_0x4e4ba5,_0x5a1f82){VoiceExtensionEvents['emit'](_0x24d909+':'+_0x47969d['id'],_0x47969d);VoiceExtensionEvents[_0x1a1a('0x7')](_0x24d909,_0x47969d);_0x5a1f82(null);};}for(var e in events){if(events[_0x1a1a('0x8')](e)){var event=events[e];VoiceExtension[_0x1a1a('0x9')](e,emitEvent(event));}}module[_0x1a1a('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index d9e2e05..bfc4989 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 _0x67e8=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','name','trunk','param','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','findAll','length','interval','intervals','IntervalId','filter','hasOwnProperty','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','define','VoiceExtension','voice_extensions','get','then','Hangup','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','context','exten','type','alias','NoOp','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat'];(function(_0x154f66,_0x116f85){var _0x3f947a=function(_0x1f671e){while(--_0x1f671e){_0x154f66['push'](_0x154f66['shift']());}};_0x3f947a(++_0x116f85);}(_0x67e8,0x86));var _0x867e=function(_0x5b7f06,_0x3a8dd9){_0x5b7f06=_0x5b7f06-0x0;var _0x47db9e=_0x67e8[_0x5b7f06];return _0x47db9e;};'use strict';var _=require(_0x867e('0x0'));var attributes=require(_0x867e('0x1'));module[_0x867e('0x2')]=function(_0x5103f0){var _0x50f67e=_0x5103f0[_0x867e('0x3')];function _0x1c5070(_0x5f1a0d){var _0x5e90ca=0x2;var _0x1df4ee=[{'type':_0x5f1a0d['type'],'app':_0x867e('0x4'),'appdata':_0x867e('0x5')+_0x5f1a0d['type'],'context':_0x5f1a0d[_0x867e('0x6')],'exten':_0x5f1a0d[_0x867e('0x7')],'priority':_0x5e90ca++,'VoiceExtensionId':_0x5f1a0d['id']},{'type':_0x5f1a0d[_0x867e('0x8')],'app':_0x5f1a0d[_0x867e('0x9')]?'Set':_0x867e('0xa'),'appdata':_0x5f1a0d[_0x867e('0x9')]?'CDR(routeAlias)='+_0x5f1a0d[_0x867e('0x9')]:'No\x20alias\x20set','context':_0x5f1a0d[_0x867e('0x6')],'exten':_0x5f1a0d[_0x867e('0x7')],'priority':_0x5e90ca++,'VoiceExtensionId':_0x5f1a0d['id']}];if(_0x5f1a0d[_0x867e('0x8')]===_0x867e('0xb')){_0x1df4ee[_0x867e('0xc')]({'type':_0x867e('0xb'),'app':_0x867e('0x4'),'appdata':'CDR(routeid)='+_0x5f1a0d['id'],'context':_0x5f1a0d['context'],'exten':_0x5f1a0d['exten'],'priority':_0x5e90ca++,'VoiceExtensionId':_0x5f1a0d['id']});}_0x1df4ee[_0x867e('0xc')]({'type':_0x5f1a0d[_0x867e('0x8')],'app':_0x867e('0x4'),'appdata':_0x867e('0xd'),'context':_0x5f1a0d['context'],'exten':_0x5f1a0d[_0x867e('0x7')],'priority':_0x5e90ca++,'VoiceExtensionId':_0x5f1a0d['id']},{'type':_0x5f1a0d[_0x867e('0x8')],'app':'Set','appdata':_0x867e('0xe'),'context':_0x5f1a0d['context'],'exten':_0x5f1a0d[_0x867e('0x7')],'priority':_0x5e90ca++,'VoiceExtensionId':_0x5f1a0d['id']},{'type':_0x5f1a0d[_0x867e('0x8')],'app':_0x867e('0x4'),'appdata':_0x867e('0xf'),'context':_0x5f1a0d[_0x867e('0x6')],'exten':_0x5f1a0d[_0x867e('0x7')],'priority':_0x5e90ca++,'VoiceExtensionId':_0x5f1a0d['id']});return _0x1df4ee;}function _0x5854cd(_0x53e0e0){var _0x3bbbf0=0x2;var _0x4e23af=[{'type':_0x867e('0x10'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0['exten'],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':_0x53e0e0[_0x867e('0x9')]?_0x867e('0x4'):'NoOp','appdata':_0x53e0e0[_0x867e('0x9')]?_0x867e('0x11')+_0x53e0e0[_0x867e('0x9')]:'No\x20alias\x20set','context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':_0x867e('0x4'),'appdata':_0x867e('0x12')+(_0x53e0e0[_0x867e('0x13')]?_0x867e('0x14')+_0x53e0e0['cutdigits']+'}':_0x867e('0x15')),'context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':_0x867e('0x4'),'appdata':_0x867e('0x16')+_0x53e0e0['id'],'context':_0x53e0e0['context'],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':_0x867e('0x17'),'appdata':_0x867e('0x18')+(_0x3bbbf0+0x2)+_0x867e('0x19')+(_0x3bbbf0+0x1)+')','context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':_0x867e('0x4'),'appdata':_0x53e0e0[_0x867e('0x13')]?_0x867e('0x1a')+_0x53e0e0[_0x867e('0x13')]+'}':_0x867e('0x1b'),'context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':_0x867e('0x4'),'appdata':_0x867e('0xd'),'context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':_0x867e('0x4'),'appdata':_0x867e('0xe'),'context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':'Set','appdata':_0x867e('0xf'),'context':_0x53e0e0['context'],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':'Set','appdata':_0x867e('0x1c')+_0x53e0e0['id'],'context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']}];if(_0x53e0e0['hasOwnProperty'](_0x867e('0x1d'))&&_0x53e0e0['recordingFormat']!=='none'){_0x4e23af[_0x867e('0xc')]({'type':_0x867e('0x10'),'app':'Set','appdata':_0x867e('0x1e'),'context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0[_0x867e('0x7')],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']},{'type':_0x867e('0x10'),'app':_0x867e('0x4'),'appdata':_0x867e('0x1f')+_0x53e0e0[_0x867e('0x1d')]||_0x867e('0x20'),'context':_0x53e0e0[_0x867e('0x6')],'exten':_0x53e0e0['exten'],'priority':_0x3bbbf0++,'VoiceExtensionId':_0x53e0e0['id']});}return _0x4e23af;}function _0x16f8ae(_0x4342bd,_0x5afe80){var _0x30e93c=[{'name':'trunk','param':0x0},{'name':_0x867e('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':_0x867e('0x22'),'param':0x3}];var _0x5208cd={};var _0x173640=_0x5afe80[_0x867e('0x23')](',');var _0x4cf6f5=[];for(var _0x3212fe=0x0;_0x3212fe<_0x30e93c['length'];_0x3212fe++){switch(_0x30e93c[_0x3212fe][_0x867e('0x24')]){case _0x867e('0x25'):_0x5208cd[_0x867e('0x25')]=_0x173640[_0x30e93c[_0x3212fe][_0x867e('0x26')]][_0x867e('0x23')]('/')[0x1];_0x5208cd[_0x867e('0x27')]=_0x173640[_0x30e93c[_0x3212fe][_0x867e('0x26')]][_0x867e('0x23')]('/')[0x2];_0x5208cd[_0x867e('0x28')]=_0x5208cd[_0x867e('0x27')]?_0x5208cd[_0x867e('0x27')][_0x867e('0x23')]('$')[0x0]:undefined;_0x5208cd[_0x867e('0x27')]=_0x4342bd[_0x867e('0x13')]?(_0x5208cd[_0x867e('0x28')]||'')+_0x867e('0x14')+_0x4342bd[_0x867e('0x13')]+'}':(_0x5208cd['prefix']||'')+'${EXTEN}';_0x4cf6f5[_0x30e93c[_0x3212fe][_0x867e('0x26')]]=[_0x867e('0x29'),_0x5208cd[_0x867e('0x25')],_0x5208cd[_0x867e('0x27')]][_0x867e('0x2a')]('/');break;case _0x867e('0x2b'):_0x5208cd[_0x867e('0x2b')]=_0x173640[_0x30e93c[_0x3212fe][_0x867e('0x26')]];if(_0x4342bd[_0x867e('0x1d')]!=='none'){if(_0x5208cd[_0x867e('0x2b')][_0x867e('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x5208cd[_0x867e('0x2b')]+=_0x867e('0x2d');}}else{_0x5208cd['options']=_0x5208cd[_0x867e('0x2b')]['replace'](_0x867e('0x2d'),'');}_0x4cf6f5[_0x30e93c[_0x3212fe][_0x867e('0x26')]]=_0x5208cd[_0x867e('0x2b')];break;default:_0x4cf6f5[_0x30e93c[_0x3212fe][_0x867e('0x26')]]=_0x173640[_0x30e93c[_0x3212fe][_0x867e('0x26')]];}}return _0x4cf6f5[_0x867e('0x2a')](',');}function _0x37172c(_0x1db66d,_0x5a4c02,_0x4e808e){return new Promise(function(_0x3db321,_0x261606){var _0x5bff11=[];if(_['isEmpty'](_0x5a4c02))return _0x3db321(_0x5bff11);_0x50f67e['Interval'][_0x867e('0x2e')]({'attributes':['id','interval','IntervalId'],'raw':!![]})['then'](function(_0x38c6c6){for(var _0x1f9061=0x0,_0x384a06=0x0;_0x1f9061<_0x5a4c02[_0x867e('0x2f')];_0x1f9061++,_0x384a06=0x0){var _0x3833ba=_0x5a4c02[_0x1f9061];var _0xc95688=[];var _0x2736e8=[];delete _0x3833ba['id'];if(_0x3833ba[_0x867e('0x30')]!=='*,*,*,*'){_0x3833ba[_0x867e('0x31')]=[_0x3833ba['interval']];}else{_0x3833ba[_0x867e('0x31')]=_0x3833ba[_0x867e('0x32')]?_['map'](_[_0x867e('0x33')](_0x38c6c6,{'IntervalId':_0x3833ba[_0x867e('0x32')]}),_0x867e('0x30')):[];}_0x3833ba[_0x867e('0x6')]=_0x1db66d[_0x867e('0x6')];_0x3833ba[_0x867e('0x7')]=_0x1db66d[_0x867e('0x7')];if(_0x3833ba[_0x867e('0x8')])_0x3833ba[_0x867e('0x8')]=_0x3833ba[_0x867e('0x8')]['toLowerCase']();if(_0x1db66d[_0x867e('0x8')]==='outbound'){if(_0x3833ba[_0x867e('0x34')](_0x867e('0x35'))&&_0x3833ba[_0x867e('0x35')]&&_0x3833ba[_0x867e('0x35')]!=='--'){_0xc95688[_0x867e('0xc')]({'type':_0x3833ba['type']['toLowerCase'](),'app':'Set','appdata':_0x867e('0x36')+_0x3833ba[_0x867e('0x35')],'context':_0x1db66d[_0x867e('0x6')],'exten':_0x1db66d[_0x867e('0x7')],'priority':_0x3833ba[_0x867e('0x31')][_0x867e('0x2f')]+_0x4e808e+_0x384a06++,'VoiceExtensionId':_0x1db66d['id']});}_0xc95688['push']({'type':_0x3833ba[_0x867e('0x8')][_0x867e('0x37')](),'app':_0x867e('0x17'),'appdata':_0x867e('0x38')+(_0x3833ba[_0x867e('0x39')]?_0x867e('0x3a')+_0x3833ba['callerID']+')':_0x867e('0x3b')),'context':_0x1db66d[_0x867e('0x6')],'exten':_0x1db66d['exten'],'priority':_0x3833ba[_0x867e('0x31')]['length']+_0x4e808e+_0x384a06++,'VoiceExtensionId':_0x1db66d['id']});}else{if(_0x3833ba[_0x867e('0x34')](_0x867e('0x3c'))){if([_0x867e('0x3d'),'playback'][_0x867e('0x3e')](_0x3833ba[_0x867e('0x3f')][_0x867e('0x37')]())&&_0x3833ba[_0x867e('0x40')]!==_0x867e('0x41')){if(_0x3833ba[_0x867e('0x3c')]){_0xc95688['push']({'type':_0x3833ba[_0x867e('0x8')][_0x867e('0x37')](),'app':_0x867e('0x17'),'appdata':_0x867e('0x42'),'context':_0x1db66d['context'],'exten':_0x1db66d[_0x867e('0x7')],'priority':_0x3833ba[_0x867e('0x31')][_0x867e('0x2f')]+_0x4e808e+_0x384a06++,'VoiceExtensionId':_0x1db66d['id']});_0xc95688[_0x867e('0xc')]({'type':_0x3833ba['type'][_0x867e('0x37')](),'app':_0x867e('0x4'),'appdata':_0x867e('0x43'),'context':_0x1db66d[_0x867e('0x6')],'exten':_0x1db66d[_0x867e('0x7')],'priority':_0x3833ba['intervals'][_0x867e('0x2f')]+_0x4e808e+_0x384a06++,'VoiceExtensionId':_0x1db66d['id']});}else{_0xc95688[_0x867e('0xc')]({'type':_0x3833ba[_0x867e('0x8')][_0x867e('0x37')](),'app':_0x867e('0x17'),'appdata':_0x867e('0x44'),'context':_0x1db66d[_0x867e('0x6')],'exten':_0x1db66d['exten'],'priority':_0x3833ba[_0x867e('0x31')]['length']+_0x4e808e+_0x384a06++,'VoiceExtensionId':_0x1db66d['id']});_0xc95688['push']({'type':_0x3833ba[_0x867e('0x8')][_0x867e('0x37')](),'app':_0x867e('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1db66d[_0x867e('0x6')],'exten':_0x1db66d[_0x867e('0x7')],'priority':_0x3833ba[_0x867e('0x31')][_0x867e('0x2f')]+_0x4e808e+_0x384a06++,'VoiceExtensionId':_0x1db66d['id']});}}}}for(var _0x300e34=0x0;_0x300e34<_0x3833ba['intervals'][_0x867e('0x2f')];_0x300e34++){var _0x55223e=_0x4e808e+_0x3833ba[_0x867e('0x31')][_0x867e('0x2f')];var _0x2302d3=_0x300e34===_0x3833ba[_0x867e('0x31')][_0x867e('0x2f')]-0x1?_0x4e808e+_0xc95688[_0x867e('0x2f')]+_0x2736e8[_0x867e('0x2f')]+0x2:_0x4e808e+_0x300e34+0x1;_0xc95688[_0x867e('0x45')](_0x300e34,0x0,{'type':_0x1db66d['type'],'app':_0x867e('0x46'),'appdata':_0x3833ba[_0x867e('0x31')][_0x300e34]+'?'+_0x1db66d[_0x867e('0x6')]+_0x867e('0x47')+_0x55223e+':'+_0x1db66d['context']+_0x867e('0x47')+_0x2302d3,'exten':_0x1db66d[_0x867e('0x7')],'context':_0x1db66d[_0x867e('0x6')],'priority':_0x4e808e+_0x300e34,'VoiceExtensionId':_0x1db66d['id']});}if(_0x3833ba[_0x867e('0x40')]===_0x867e('0x48'))_0x3833ba[_0x867e('0x49')]=_0x16f8ae(_0x1db66d,_0x3833ba[_0x867e('0x49')]);_0x3833ba[_0x867e('0x4a')]=_0xc95688['length']?_[_0x867e('0x4b')](_0xc95688)['priority']+0x1:_0x4e808e;_0x5bff11=_['concat'](_0x5bff11,_0xc95688,[_0x3833ba],_0x2736e8);_0x4e808e=_[_0x867e('0x4b')](_0x5bff11)[_0x867e('0x4a')]+0x1;}return _0x3db321(_0x5bff11);})['catch'](function(_0x300d7b){_0x261606(_0x300d7b);});});}return _0x5103f0[_0x867e('0x4c')](_0x867e('0x4d'),attributes,{'tableName':_0x867e('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3b9f4f){var _0x98c408=this[_0x867e('0x4f')]({'plain':!![]});var _0x3f6702=_0x98c408[_0x867e('0x8')]===_0x867e('0x10')?_0x5854cd(_0x98c408):_0x1c5070(_0x98c408);return _0x37172c(_0x98c408,_0x3b9f4f,_[_0x867e('0x4b')](_0x3f6702)[_0x867e('0x4a')]+0x1)[_0x867e('0x50')](function(_0x2b8081){var _0x57cec8=_['concat'](_0x3f6702,_0x2b8081);_0x57cec8['push']({'type':_0x98c408[_0x867e('0x8')],'app':_0x867e('0x51'),'exten':_0x98c408[_0x867e('0x7')],'context':_0x98c408[_0x867e('0x6')],'priority':_[_0x867e('0x4b')](_0x57cec8)[_0x867e('0x4a')]+0x1,'VoiceExtensionId':_0x98c408['id']});return _0x57cec8;});}}});}; \ No newline at end of file +var _0xba64=['Set','CDR(type)=','exten','alias','NoOp','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','name','phone','prefix','${EXTEN}','param','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','playback','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','define','VoiceExtension','get','Hangup','./voiceExtension.attributes','exports','type'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xba64,0x1ef));var _0x4ba6=function(_0x5429a0,_0x4a1484){_0x5429a0=_0x5429a0-0x0;var _0x42e713=_0xba64[_0x5429a0];return _0x42e713;};'use strict';var _=require('lodash');var attributes=require(_0x4ba6('0x0'));module[_0x4ba6('0x1')]=function(_0x1210f5){var _0x1ea0ff=_0x1210f5['models'];function _0xe17688(_0x34e2d4){var _0x490873=0x2;var _0x6151d5=[{'type':_0x34e2d4[_0x4ba6('0x2')],'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0x4')+_0x34e2d4['type'],'context':_0x34e2d4['context'],'exten':_0x34e2d4[_0x4ba6('0x5')],'priority':_0x490873++,'VoiceExtensionId':_0x34e2d4['id']},{'type':_0x34e2d4[_0x4ba6('0x2')],'app':_0x34e2d4[_0x4ba6('0x6')]?_0x4ba6('0x3'):_0x4ba6('0x7'),'appdata':_0x34e2d4[_0x4ba6('0x6')]?'CDR(routeAlias)='+_0x34e2d4['alias']:_0x4ba6('0x8'),'context':_0x34e2d4[_0x4ba6('0x9')],'exten':_0x34e2d4[_0x4ba6('0x5')],'priority':_0x490873++,'VoiceExtensionId':_0x34e2d4['id']}];if(_0x34e2d4[_0x4ba6('0x2')]===_0x4ba6('0xa')){_0x6151d5[_0x4ba6('0xb')]({'type':_0x4ba6('0xa'),'app':'Set','appdata':_0x4ba6('0xc')+_0x34e2d4['id'],'context':_0x34e2d4[_0x4ba6('0x9')],'exten':_0x34e2d4[_0x4ba6('0x5')],'priority':_0x490873++,'VoiceExtensionId':_0x34e2d4['id']});}_0x6151d5[_0x4ba6('0xb')]({'type':_0x34e2d4[_0x4ba6('0x2')],'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0xd'),'context':_0x34e2d4['context'],'exten':_0x34e2d4[_0x4ba6('0x5')],'priority':_0x490873++,'VoiceExtensionId':_0x34e2d4['id']},{'type':_0x34e2d4[_0x4ba6('0x2')],'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0xe'),'context':_0x34e2d4['context'],'exten':_0x34e2d4[_0x4ba6('0x5')],'priority':_0x490873++,'VoiceExtensionId':_0x34e2d4['id']},{'type':_0x34e2d4[_0x4ba6('0x2')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x34e2d4[_0x4ba6('0x9')],'exten':_0x34e2d4[_0x4ba6('0x5')],'priority':_0x490873++,'VoiceExtensionId':_0x34e2d4['id']});return _0x6151d5;}function _0x1460fd(_0x2dd9e0){var _0x446028=0x2;var _0x52ca9c=[{'type':_0x4ba6('0xf'),'app':'Set','appdata':_0x4ba6('0x10'),'context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':_0x4ba6('0xf'),'app':_0x2dd9e0[_0x4ba6('0x6')]?'Set':_0x4ba6('0x7'),'appdata':_0x2dd9e0[_0x4ba6('0x6')]?_0x4ba6('0x11')+_0x2dd9e0[_0x4ba6('0x6')]:_0x4ba6('0x8'),'context':_0x2dd9e0['context'],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':_0x4ba6('0xf'),'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0x12')+(_0x2dd9e0[_0x4ba6('0x13')]?_0x4ba6('0x14')+_0x2dd9e0[_0x4ba6('0x13')]+'}':'${EXTEN}'),'context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':_0x4ba6('0xf'),'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0xc')+_0x2dd9e0['id'],'context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':_0x4ba6('0xf'),'app':_0x4ba6('0x15'),'appdata':_0x4ba6('0x16')+(_0x446028+0x2)+'):Goto('+(_0x446028+0x1)+')','context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':'outbound','app':_0x4ba6('0x3'),'appdata':_0x2dd9e0['cutdigits']?_0x4ba6('0x17')+_0x2dd9e0[_0x4ba6('0x13')]+'}':_0x4ba6('0x18'),'context':_0x2dd9e0['context'],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':'outbound','app':'Set','appdata':_0x4ba6('0xd'),'context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0['exten'],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':'outbound','app':'Set','appdata':_0x4ba6('0xe'),'context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':_0x4ba6('0xf'),'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0x19'),'context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':_0x4ba6('0xf'),'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0x1a')+_0x2dd9e0['id'],'context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']}];if(_0x2dd9e0['hasOwnProperty'](_0x4ba6('0x1b'))&&_0x2dd9e0['recordingFormat']!==_0x4ba6('0x1c')){_0x52ca9c[_0x4ba6('0xb')]({'type':'outbound','app':_0x4ba6('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']},{'type':_0x4ba6('0xf'),'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0x1d')+_0x2dd9e0['recordingFormat']||_0x4ba6('0x1e'),'context':_0x2dd9e0[_0x4ba6('0x9')],'exten':_0x2dd9e0[_0x4ba6('0x5')],'priority':_0x446028++,'VoiceExtensionId':_0x2dd9e0['id']});}return _0x52ca9c;}function _0xcb4768(_0x1c2b2c,_0x142166){var _0x25d161=[{'name':_0x4ba6('0x1f'),'param':0x0},{'name':_0x4ba6('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0x4ba6('0x21'),'param':0x3}];var _0x25f7b1={};var _0x327bc5=_0x142166[_0x4ba6('0x22')](',');var _0x55f2fa=[];for(var _0x4b510f=0x0;_0x4b510f<_0x25d161[_0x4ba6('0x23')];_0x4b510f++){switch(_0x25d161[_0x4b510f][_0x4ba6('0x24')]){case'trunk':_0x25f7b1['trunk']=_0x327bc5[_0x25d161[_0x4b510f]['param']][_0x4ba6('0x22')]('/')[0x1];_0x25f7b1[_0x4ba6('0x25')]=_0x327bc5[_0x25d161[_0x4b510f]['param']]['split']('/')[0x2];_0x25f7b1[_0x4ba6('0x26')]=_0x25f7b1[_0x4ba6('0x25')]?_0x25f7b1[_0x4ba6('0x25')][_0x4ba6('0x22')]('$')[0x0]:undefined;_0x25f7b1[_0x4ba6('0x25')]=_0x1c2b2c['cutdigits']?(_0x25f7b1[_0x4ba6('0x26')]||'')+_0x4ba6('0x14')+_0x1c2b2c[_0x4ba6('0x13')]+'}':(_0x25f7b1[_0x4ba6('0x26')]||'')+_0x4ba6('0x27');_0x55f2fa[_0x25d161[_0x4b510f][_0x4ba6('0x28')]]=['SIP',_0x25f7b1[_0x4ba6('0x1f')],_0x25f7b1['phone']][_0x4ba6('0x29')]('/');break;case _0x4ba6('0x2a'):_0x25f7b1[_0x4ba6('0x2a')]=_0x327bc5[_0x25d161[_0x4b510f][_0x4ba6('0x28')]];if(_0x1c2b2c[_0x4ba6('0x1b')]!==_0x4ba6('0x1c')){if(_0x25f7b1[_0x4ba6('0x2a')][_0x4ba6('0x2b')](_0x4ba6('0x2c'))<0x0){_0x25f7b1[_0x4ba6('0x2a')]+=_0x4ba6('0x2c');}}else{_0x25f7b1[_0x4ba6('0x2a')]=_0x25f7b1[_0x4ba6('0x2a')][_0x4ba6('0x2d')](_0x4ba6('0x2c'),'');}_0x55f2fa[_0x25d161[_0x4b510f]['param']]=_0x25f7b1[_0x4ba6('0x2a')];break;default:_0x55f2fa[_0x25d161[_0x4b510f]['param']]=_0x327bc5[_0x25d161[_0x4b510f][_0x4ba6('0x28')]];}}return _0x55f2fa['join'](',');}function _0x261b99(_0x288431,_0x552fbd,_0x102e10){return new Promise(function(_0x171d1c,_0x8e0b8f){var _0xed91c1=[];if(_[_0x4ba6('0x2e')](_0x552fbd))return _0x171d1c(_0xed91c1);_0x1ea0ff[_0x4ba6('0x2f')]['findAll']({'attributes':['id',_0x4ba6('0x30'),_0x4ba6('0x31')],'raw':!![]})[_0x4ba6('0x32')](function(_0x3e7edb){for(var _0x45f7a3=0x0,_0x1b992a=0x0;_0x45f7a3<_0x552fbd['length'];_0x45f7a3++,_0x1b992a=0x0){var _0x46ce23=_0x552fbd[_0x45f7a3];var _0x3b9a97=[];var _0x36361f=[];delete _0x46ce23['id'];if(_0x46ce23['interval']!==_0x4ba6('0x33')){_0x46ce23[_0x4ba6('0x34')]=[_0x46ce23[_0x4ba6('0x30')]];}else{_0x46ce23[_0x4ba6('0x34')]=_0x46ce23[_0x4ba6('0x31')]?_[_0x4ba6('0x35')](_[_0x4ba6('0x36')](_0x3e7edb,{'IntervalId':_0x46ce23['IntervalId']}),'interval'):[];}_0x46ce23[_0x4ba6('0x9')]=_0x288431[_0x4ba6('0x9')];_0x46ce23[_0x4ba6('0x5')]=_0x288431['exten'];if(_0x46ce23[_0x4ba6('0x2')])_0x46ce23[_0x4ba6('0x2')]=_0x46ce23[_0x4ba6('0x2')]['toLowerCase']();if(_0x288431['type']==='outbound'){if(_0x46ce23[_0x4ba6('0x37')](_0x4ba6('0x38'))&&_0x46ce23['tag']&&_0x46ce23[_0x4ba6('0x38')]!=='--'){_0x3b9a97['push']({'type':_0x46ce23[_0x4ba6('0x2')][_0x4ba6('0x39')](),'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0x3a')+_0x46ce23[_0x4ba6('0x38')],'context':_0x288431[_0x4ba6('0x9')],'exten':_0x288431[_0x4ba6('0x5')],'priority':_0x46ce23[_0x4ba6('0x34')]['length']+_0x102e10+_0x1b992a++,'VoiceExtensionId':_0x288431['id']});}_0x3b9a97['push']({'type':_0x46ce23['type'][_0x4ba6('0x39')](),'app':_0x4ba6('0x15'),'appdata':_0x4ba6('0x3b')+(_0x46ce23['callerID']?_0x4ba6('0x3c')+_0x46ce23[_0x4ba6('0x3d')]+')':_0x4ba6('0x3e')),'context':_0x288431[_0x4ba6('0x9')],'exten':_0x288431[_0x4ba6('0x5')],'priority':_0x46ce23[_0x4ba6('0x34')][_0x4ba6('0x23')]+_0x102e10+_0x1b992a++,'VoiceExtensionId':_0x288431['id']});}else{if(_0x46ce23['hasOwnProperty']('answer')){if(['queue',_0x4ba6('0x3f')]['includes'](_0x46ce23[_0x4ba6('0x40')][_0x4ba6('0x39')]())&&_0x46ce23[_0x4ba6('0x41')]!=='custom'){if(_0x46ce23[_0x4ba6('0x42')]){_0x3b9a97['push']({'type':_0x46ce23[_0x4ba6('0x2')][_0x4ba6('0x39')](),'app':_0x4ba6('0x15'),'appdata':_0x4ba6('0x43'),'context':_0x288431[_0x4ba6('0x9')],'exten':_0x288431['exten'],'priority':_0x46ce23[_0x4ba6('0x34')][_0x4ba6('0x23')]+_0x102e10+_0x1b992a++,'VoiceExtensionId':_0x288431['id']});_0x3b9a97[_0x4ba6('0xb')]({'type':_0x46ce23[_0x4ba6('0x2')][_0x4ba6('0x39')](),'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0x44'),'context':_0x288431['context'],'exten':_0x288431[_0x4ba6('0x5')],'priority':_0x46ce23['intervals'][_0x4ba6('0x23')]+_0x102e10+_0x1b992a++,'VoiceExtensionId':_0x288431['id']});}else{_0x3b9a97['push']({'type':_0x46ce23['type'][_0x4ba6('0x39')](),'app':'ExecIf','appdata':_0x4ba6('0x45'),'context':_0x288431[_0x4ba6('0x9')],'exten':_0x288431[_0x4ba6('0x5')],'priority':_0x46ce23[_0x4ba6('0x34')][_0x4ba6('0x23')]+_0x102e10+_0x1b992a++,'VoiceExtensionId':_0x288431['id']});_0x3b9a97['push']({'type':_0x46ce23[_0x4ba6('0x2')][_0x4ba6('0x39')](),'app':_0x4ba6('0x3'),'appdata':_0x4ba6('0x46'),'context':_0x288431[_0x4ba6('0x9')],'exten':_0x288431[_0x4ba6('0x5')],'priority':_0x46ce23[_0x4ba6('0x34')][_0x4ba6('0x23')]+_0x102e10+_0x1b992a++,'VoiceExtensionId':_0x288431['id']});}}}}for(var _0x110b47=0x0;_0x110b47<_0x46ce23[_0x4ba6('0x34')]['length'];_0x110b47++){var _0x15c1d0=_0x102e10+_0x46ce23['intervals'][_0x4ba6('0x23')];var _0xb0ba74=_0x110b47===_0x46ce23[_0x4ba6('0x34')][_0x4ba6('0x23')]-0x1?_0x102e10+_0x3b9a97[_0x4ba6('0x23')]+_0x36361f[_0x4ba6('0x23')]+0x2:_0x102e10+_0x110b47+0x1;_0x3b9a97[_0x4ba6('0x47')](_0x110b47,0x0,{'type':_0x288431['type'],'app':_0x4ba6('0x48'),'appdata':_0x46ce23['intervals'][_0x110b47]+'?'+_0x288431[_0x4ba6('0x9')]+',${EXTEN},'+_0x15c1d0+':'+_0x288431[_0x4ba6('0x9')]+_0x4ba6('0x49')+_0xb0ba74,'exten':_0x288431[_0x4ba6('0x5')],'context':_0x288431['context'],'priority':_0x102e10+_0x110b47,'VoiceExtensionId':_0x288431['id']});}if(_0x46ce23[_0x4ba6('0x41')]===_0x4ba6('0x4a'))_0x46ce23[_0x4ba6('0x4b')]=_0xcb4768(_0x288431,_0x46ce23['appdata']);_0x46ce23[_0x4ba6('0x4c')]=_0x3b9a97[_0x4ba6('0x23')]?_[_0x4ba6('0x4d')](_0x3b9a97)[_0x4ba6('0x4c')]+0x1:_0x102e10;_0xed91c1=_[_0x4ba6('0x4e')](_0xed91c1,_0x3b9a97,[_0x46ce23],_0x36361f);_0x102e10=_[_0x4ba6('0x4d')](_0xed91c1)[_0x4ba6('0x4c')]+0x1;}return _0x171d1c(_0xed91c1);})['catch'](function(_0x78587e){_0x8e0b8f(_0x78587e);});});}return _0x1210f5[_0x4ba6('0x4f')](_0x4ba6('0x50'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x54ffdf){var _0x13a409=this[_0x4ba6('0x51')]({'plain':!![]});var _0x405540=_0x13a409[_0x4ba6('0x2')]===_0x4ba6('0xf')?_0x1460fd(_0x13a409):_0xe17688(_0x13a409);return _0x261b99(_0x13a409,_0x54ffdf,_[_0x4ba6('0x4d')](_0x405540)[_0x4ba6('0x4c')]+0x1)[_0x4ba6('0x32')](function(_0x3f4546){var _0x2427bd=_[_0x4ba6('0x4e')](_0x405540,_0x3f4546);_0x2427bd[_0x4ba6('0xb')]({'type':_0x13a409[_0x4ba6('0x2')],'app':_0x4ba6('0x52'),'exten':_0x13a409[_0x4ba6('0x5')],'context':_0x13a409[_0x4ba6('0x9')],'priority':_[_0x4ba6('0x4d')](_0x2427bd)['priority']+0x1,'VoiceExtensionId':_0x13a409['id']});return _0x2427bd;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8290cf1..87db19e 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 _0x565f=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','model','map','info','catch','util','moment','bluebird','ioredis'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x565f,0x68));var _0xf565=function(_0x6e2bdc,_0x8de06e){_0x6e2bdc=_0x6e2bdc-0x0;var _0x2a4178=_0x565f[_0x6e2bdc];return _0x2a4178;};'use strict';var _=require('lodash');var util=require(_0xf565('0x0'));var moment=require(_0xf565('0x1'));var BPromise=require(_0xf565('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf565('0x3'));var db=require(_0xf565('0x4'))['db'];var utils=require(_0xf565('0x5'));var logger=require(_0xf565('0x6'))(_0xf565('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf565('0x8')]({'port':0x232a});config['redis']=_[_0xf565('0x9')](config[_0xf565('0xa')],{'host':_0xf565('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf565('0xa')]));require('./voiceExtension.socket')[_0xf565('0xc')](socket);function respondWithRpcPromise(_0x5aaa3f,_0x2d7f4e,_0x1a362d){return new BPromise(function(_0x80b001,_0x1bc33c){return client[_0xf565('0xd')](_0x5aaa3f,_0x1a362d)[_0xf565('0xe')](function(_0x4c13ed){logger['info'](_0xf565('0xf'),_0x2d7f4e,_0xf565('0x10'));logger[_0xf565('0x11')](_0xf565('0x12'),_0x2d7f4e,_0xf565('0x10'),JSON[_0xf565('0x13')](_0x4c13ed));if(_0x4c13ed[_0xf565('0x14')]){if(_0x4c13ed[_0xf565('0x14')][_0xf565('0x15')]===0x1f4){logger[_0xf565('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x2d7f4e,_0x4c13ed[_0xf565('0x14')][_0xf565('0x16')]);return _0x1bc33c(_0x4c13ed['error'][_0xf565('0x16')]);}logger[_0xf565('0x14')](_0xf565('0xf'),_0x2d7f4e,_0x4c13ed[_0xf565('0x14')][_0xf565('0x16')]);return _0x80b001(_0x4c13ed['error'][_0xf565('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x2d7f4e,_0xf565('0x10'));_0x80b001(_0x4c13ed[_0xf565('0x17')]['message']);}})['catch'](function(_0x2d2197){logger['error'](_0xf565('0xf'),_0x2d7f4e,_0x2d2197);_0x1bc33c(_0x2d2197);});});}exports[_0xf565('0x18')]=function(_0x1f364e){var _0x51215d=this;return new Promise(function(_0x55032c,_0xb7b197){return db[_0xf565('0x19')][_0xf565('0x1a')]({'raw':_0x1f364e[_0xf565('0x1b')]?_0x1f364e[_0xf565('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1f364e[_0xf565('0x1b')]?_0x1f364e[_0xf565('0x1b')][_0xf565('0x1c')]||null:null,'attributes':_0x1f364e[_0xf565('0x1b')]?_0x1f364e[_0xf565('0x1b')][_0xf565('0x1d')]||null:null,'limit':_0x1f364e[_0xf565('0x1b')]?_0x1f364e[_0xf565('0x1b')][_0xf565('0x1e')]||null:null,'include':_0x1f364e[_0xf565('0x1b')]?_0x1f364e['options'][_0xf565('0x1f')]?_['map'](_0x1f364e[_0xf565('0x1b')][_0xf565('0x1f')],function(_0x50da32){return{'model':db[_0x50da32[_0xf565('0x20')]],'as':_0x50da32['as'],'attributes':_0x50da32[_0xf565('0x1d')],'include':_0x50da32[_0xf565('0x1f')]?_[_0xf565('0x21')](_0x50da32[_0xf565('0x1f')],function(_0x1239a7){return{'model':db[_0x1239a7[_0xf565('0x20')]],'as':_0x1239a7['as'],'attributes':_0x1239a7[_0xf565('0x1d')],'include':_0x1239a7['include']?_[_0xf565('0x21')](_0x1239a7[_0xf565('0x1f')],function(_0x18082a){return{'model':db[_0x18082a[_0xf565('0x20')]],'as':_0x18082a['as'],'attributes':_0x18082a[_0xf565('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2288db){logger[_0xf565('0x22')](_0xf565('0x18'),_0x1f364e);logger[_0xf565('0x11')](_0xf565('0x18'),_0x1f364e,JSON['stringify'](_0x2288db));_0x55032c(_0x2288db);})[_0xf565('0x23')](function(_0x41d6bf){logger[_0xf565('0x14')](_0xf565('0x18'),_0x41d6bf[_0xf565('0x16')],_0x1f364e);_0xb7b197(_0x51215d[_0xf565('0x14')](0x1f4,_0x41d6bf['message']));});});}; \ No newline at end of file +var _0x07d7=['result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceExtension,\x20%s,\x20%s','message'];(function(_0x11cc54,_0x1b3e76){var _0x2b04c0=function(_0x400e76){while(--_0x400e76){_0x11cc54['push'](_0x11cc54['shift']());}};_0x2b04c0(++_0x1b3e76);}(_0x07d7,0x85));var _0x707d=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x07d7[_0x28d225];return _0x1f79e1;};'use strict';var _=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var moment=require(_0x707d('0x2'));var BPromise=require(_0x707d('0x3'));var rs=require(_0x707d('0x4'));var fs=require('fs');var Redis=require(_0x707d('0x5'));var db=require(_0x707d('0x6'))['db'];var utils=require(_0x707d('0x7'));var logger=require(_0x707d('0x8'))(_0x707d('0x9'));var config=require(_0x707d('0xa'));var jayson=require(_0x707d('0xb'));var client=jayson[_0x707d('0xc')][_0x707d('0xd')]({'port':0x232a});config[_0x707d('0xe')]=_[_0x707d('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x707d('0x10'))(new Redis(config[_0x707d('0xe')]));require(_0x707d('0x11'))[_0x707d('0x12')](socket);function respondWithRpcPromise(_0x51750,_0x5af425,_0x3f45f5){return new BPromise(function(_0x107bc3,_0xd87d5d){return client['request'](_0x51750,_0x3f45f5)[_0x707d('0x13')](function(_0x355ce4){logger[_0x707d('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x5af425,'request\x20sent');logger['debug'](_0x707d('0x15'),_0x5af425,_0x707d('0x16'),JSON[_0x707d('0x17')](_0x355ce4));if(_0x355ce4['error']){if(_0x355ce4[_0x707d('0x18')]['code']===0x1f4){logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x355ce4['error']['message']);return _0xd87d5d(_0x355ce4[_0x707d('0x18')]['message']);}logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x355ce4[_0x707d('0x18')][_0x707d('0x1a')]);return _0x107bc3(_0x355ce4[_0x707d('0x18')][_0x707d('0x1a')]);}else{logger[_0x707d('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x5af425,_0x707d('0x16'));_0x107bc3(_0x355ce4[_0x707d('0x1b')][_0x707d('0x1a')]);}})['catch'](function(_0x291864){logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x291864);_0xd87d5d(_0x291864);});});}exports[_0x707d('0x1c')]=function(_0x81f93f){var _0x178be9=this;return new Promise(function(_0xb7171a,_0x446629){return db[_0x707d('0x1d')][_0x707d('0x1e')]({'raw':_0x81f93f[_0x707d('0x1f')]?_0x81f93f[_0x707d('0x1f')][_0x707d('0x20')]===undefined?!![]:![]:!![],'where':_0x81f93f[_0x707d('0x1f')]?_0x81f93f[_0x707d('0x1f')][_0x707d('0x21')]||null:null,'attributes':_0x81f93f[_0x707d('0x1f')]?_0x81f93f['options'][_0x707d('0x22')]||null:null,'limit':_0x81f93f['options']?_0x81f93f[_0x707d('0x1f')][_0x707d('0x23')]||null:null,'include':_0x81f93f[_0x707d('0x1f')]?_0x81f93f[_0x707d('0x1f')][_0x707d('0x24')]?_['map'](_0x81f93f[_0x707d('0x1f')][_0x707d('0x24')],function(_0x3760bb){return{'model':db[_0x3760bb[_0x707d('0x25')]],'as':_0x3760bb['as'],'attributes':_0x3760bb[_0x707d('0x22')],'include':_0x3760bb[_0x707d('0x24')]?_[_0x707d('0x26')](_0x3760bb[_0x707d('0x24')],function(_0x38b4fe){return{'model':db[_0x38b4fe[_0x707d('0x25')]],'as':_0x38b4fe['as'],'attributes':_0x38b4fe[_0x707d('0x22')],'include':_0x38b4fe[_0x707d('0x24')]?_[_0x707d('0x26')](_0x38b4fe[_0x707d('0x24')],function(_0x38b44b){return{'model':db[_0x38b44b[_0x707d('0x25')]],'as':_0x38b44b['as'],'attributes':_0x38b44b[_0x707d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x707d('0x13')](function(_0x599ba6){logger[_0x707d('0x14')](_0x707d('0x1c'),_0x81f93f);logger[_0x707d('0x27')]('GetVoiceExtension',_0x81f93f,JSON['stringify'](_0x599ba6));_0xb7171a(_0x599ba6);})['catch'](function(_0x18c7e4){logger[_0x707d('0x18')](_0x707d('0x1c'),_0x18c7e4[_0x707d('0x1a')],_0x81f93f);_0x446629(_0x178be9[_0x707d('0x18')](0x1f4,_0x18c7e4[_0x707d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 733629e..ddd1e3a 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 _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x814b,0x1a2));var _0xb814=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x814b[_0x489b87];return _0x1823b6;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x5aaaa2,_0x405ba9){var _0x4d63a9=function(_0x25b28c){while(--_0x25b28c){_0x5aaaa2['push'](_0x5aaaa2['shift']());}};_0x4d63a9(++_0x405ba9);}(_0x1261,0x144));var _0x1126=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0x1261[_0x5162ed];return _0x4c579b;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a634898..22c3d75 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 _0x6a55=['isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get'];(function(_0x13a621,_0x29b45c){var _0x19c55d=function(_0x5b2876){while(--_0x5b2876){_0x13a621['push'](_0x13a621['shift']());}};_0x19c55d(++_0x29b45c);}(_0x6a55,0xdb));var _0x56a5=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0x6a55[_0x2dd6b1];return _0x494306;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./voiceMail.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id/messages',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0xa')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xd')]);router['delete']('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);module[_0x56a5('0xf')]=router; \ No newline at end of file +var _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x410ecb,_0x3041c7){var _0x1186f5=function(_0x1e31ab){while(--_0x1e31ab){_0x410ecb['push'](_0x410ecb['shift']());}};_0x1186f5(++_0x3041c7);}(_0x32f4,0x154));var _0x432f=function(_0x29f3dd,_0x564f97){_0x29f3dd=_0x29f3dd-0x0;var _0x24b45a=_0x32f4[_0x29f3dd];return _0x24b45a;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 7f8ebb0..59c169a 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 _0xe700=['\x20-\x20','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','INTEGER','VIRTUAL','getDataValue'];(function(_0x20e1de,_0x51f3a5){var _0x423b33=function(_0x15afef){while(--_0x15afef){_0x20e1de['push'](_0x20e1de['shift']());}};_0x423b33(++_0x51f3a5);}(_0xe700,0x197));var _0x0e70=function(_0x1d9cd2,_0x4d9e52){_0x1d9cd2=_0x1d9cd2-0x0;var _0x476452=_0xe700[_0x1d9cd2];return _0x476452;};'use strict';var Sequelize=require('sequelize');module[_0x0e70('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0e70('0x1')],'defaultValue':_0x0e70('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x0e70('0x1')],'defaultValue':'','allowNull':![],'unique':_0x0e70('0x3')},'password':{'type':Sequelize[_0x0e70('0x1')]},'fullname':{'type':Sequelize[_0x0e70('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xefbde8){this[_0x0e70('0x4')]('email',typeof _0xefbde8===_0x0e70('0x5')&&_0xefbde8[_0x0e70('0x6')]()?_0xefbde8[_0x0e70('0x6')]():null);}},'pager':{'type':Sequelize[_0x0e70('0x1')]},'tz':{'type':Sequelize[_0x0e70('0x1')],'defaultValue':_0x0e70('0x7')},'attach':{'type':Sequelize[_0x0e70('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':_0x0e70('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0e70('0x1')]},'callback':{'type':Sequelize[_0x0e70('0x1')]},'review':{'type':Sequelize[_0x0e70('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0e70('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':_0x0e70('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0e70('0x8')](_0x0e70('0x9'),'no'),'defaultValue':_0x0e70('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x0e70('0x1')]},'maxsecs':{'type':Sequelize[_0x0e70('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0e70('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0e70('0xb')],'get':function(){return this[_0x0e70('0xc')]('fullname')+_0x0e70('0xd')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x58fb=['setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x2a1f01,_0x5dad17){var _0x2108b4=function(_0x194c93){while(--_0x194c93){_0x2a1f01['push'](_0x2a1f01['shift']());}};_0x2108b4(++_0x5dad17);}(_0x58fb,0x160));var _0xb58f=function(_0x28eab6,_0x559416){_0x28eab6=_0x28eab6-0x0;var _0x19e4eb=_0x58fb[_0x28eab6];return _0x19e4eb;};'use strict';var Sequelize=require(_0xb58f('0x0'));module[_0xb58f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb58f('0x2')],'defaultValue':_0xb58f('0x3'),'unique':_0xb58f('0x4')},'mailbox':{'type':Sequelize[_0xb58f('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xb58f('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4736b6){this[_0xb58f('0x5')](_0xb58f('0x6'),typeof _0x4736b6===_0xb58f('0x7')&&_0x4736b6[_0xb58f('0x8')]()?_0x4736b6[_0xb58f('0x8')]():null);}},'pager':{'type':Sequelize[_0xb58f('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb58f('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xb58f('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb58f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb58f('0x9')](_0xb58f('0xa'),'no'),'defaultValue':_0xb58f('0xa'),'allowNull':![]},'stamp':{'type':_0xb58f('0xc')},'emailsubject':{'type':Sequelize[_0xb58f('0x2')]},'emailbody':{'type':Sequelize[_0xb58f('0x2')]},'maxsecs':{'type':Sequelize[_0xb58f('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb58f('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb58f('0xe')],'get':function(){return this[_0xb58f('0xf')]('fullname')+_0xb58f('0x10')+this[_0xb58f('0xf')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b76dde2..2b41a37 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 _0x373d=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','filter','VoiceMail','include','findAll','catch','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','nolimit','pick','mailbox','options','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x551e38,_0x5011f6){var _0x1813fc=function(_0x190796){while(--_0x190796){_0x551e38['push'](_0x551e38['shift']());}};_0x1813fc(++_0x5011f6);}(_0x373d,0x1e2));var _0xd373=function(_0x18c8b5,_0x2a15d3){_0x18c8b5=_0x18c8b5-0x0;var _0x358984=_0x373d[_0x18c8b5];return _0x358984;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){var _0x1ab540=_0x238ffd[_0xd373('0x25')]({'plain':!![]});var _0x437110=_0xd373('0x26');return db[_0xd373('0x27')][_0xd373('0x24')]({'where':{'type':_0x437110,'resourceId':_0x1ab540['id']}})[_0xd373('0x23')](function(){return _0x238ffd;});})[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x3e657b,_0x470612){return function(_0x45ee58){if(!_0x45ee58){_0x3e657b[_0xd373('0x15')](0x194);}return _0x45ee58;};}function handleError(_0x71c5c,_0x3384a5){_0x3384a5=_0x3384a5||0x1f4;return function(_0xf85ca8){logger[_0xd373('0x28')](_0xf85ca8[_0xd373('0x29')]);if(_0xf85ca8[_0xd373('0x2a')]){delete _0xf85ca8[_0xd373('0x2a')];}_0x71c5c[_0xd373('0x17')](_0x3384a5)['send'](_0xf85ca8);};}exports[_0xd373('0x2b')]=function(_0x490842,_0x498aaa){var _0xedc8f3={},_0x15da6c={},_0x25e016={'count':0x0,'rows':[]};var _0x23024c=_[_0xd373('0x2c')](db['VoiceMail'][_0xd373('0x2d')],function(_0x104156){return{'name':_0x104156['fieldName'],'type':_0x104156[_0xd373('0x2e')][_0xd373('0x2f')]};});_0x15da6c[_0xd373('0x30')]=_[_0xd373('0x2c')](_0x23024c,_0xd373('0x2a'));_0x15da6c[_0xd373('0x31')]=_[_0xd373('0x32')](_0x490842[_0xd373('0x31')]);_0x15da6c[_0xd373('0x33')]=_['intersection'](_0x15da6c[_0xd373('0x30')],_0x15da6c[_0xd373('0x31')]);_0xedc8f3[_0xd373('0x34')]=_[_0xd373('0x35')](_0x15da6c[_0xd373('0x30')],qs[_0xd373('0x36')](_0x490842[_0xd373('0x31')][_0xd373('0x36')]));_0xedc8f3[_0xd373('0x34')]=_0xedc8f3[_0xd373('0x34')][_0xd373('0x37')]?_0xedc8f3[_0xd373('0x34')]:_0x15da6c[_0xd373('0x30')];if(!_0x490842[_0xd373('0x31')][_0xd373('0x38')]('nolimit')){_0xedc8f3[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x490842[_0xd373('0x31')][_0xd373('0x1b')]);_0xedc8f3['offset']=qs[_0xd373('0x19')](_0x490842[_0xd373('0x31')][_0xd373('0x19')]);}_0xedc8f3[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0x490842[_0xd373('0x31')]['sort']);_0xedc8f3['where']=qs[_0xd373('0x33')](_['pick'](_0x490842[_0xd373('0x31')],_0x15da6c[_0xd373('0x33')]),_0x23024c);if(_0x490842[_0xd373('0x31')]['filter']){_0xedc8f3[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0xedc8f3[_0xd373('0x3b')],{'$or':_[_0xd373('0x2c')](_0x23024c,function(_0x504450){if(_0x504450['type']!=='VIRTUAL'){var _0x11ec1b={};_0x11ec1b[_0x504450['name']]={'$like':'%'+_0x490842[_0xd373('0x31')][_0xd373('0x3d')]+'%'};return _0x11ec1b;}})});}_0xedc8f3=_['merge']({},_0xedc8f3,_0x490842['options']);var _0x5f3dd5={'where':_0xedc8f3[_0xd373('0x3b')]};return db[_0xd373('0x3e')][_0xd373('0x1c')](_0x5f3dd5)['then'](function(_0x5c3b22){_0x25e016[_0xd373('0x1c')]=_0x5c3b22;if(_0x490842[_0xd373('0x31')]['includeAll']){_0xedc8f3[_0xd373('0x3f')]=[{'all':!![]}];}return db[_0xd373('0x3e')][_0xd373('0x40')](_0xedc8f3);})[_0xd373('0x23')](function(_0x2d8c7d){_0x25e016['rows']=_0x2d8c7d;return _0x25e016;})['then'](respondWithFilteredResult(_0x498aaa,_0xedc8f3))[_0xd373('0x41')](handleError(_0x498aaa,null));};exports[_0xd373('0x42')]=function(_0x30b423,_0x302f65){var _0x5d4dd2={'raw':!![],'where':{'id':_0x30b423['params']['id']}},_0x29725c={};_0x29725c[_0xd373('0x30')]=_[_0xd373('0x32')](db[_0xd373('0x3e')][_0xd373('0x2d')]);_0x29725c[_0xd373('0x31')]=_['keys'](_0x30b423[_0xd373('0x31')]);_0x29725c[_0xd373('0x33')]=_['intersection'](_0x29725c[_0xd373('0x30')],_0x29725c[_0xd373('0x31')]);_0x5d4dd2[_0xd373('0x34')]=_[_0xd373('0x35')](_0x29725c[_0xd373('0x30')],qs[_0xd373('0x36')](_0x30b423[_0xd373('0x31')][_0xd373('0x36')]));_0x5d4dd2[_0xd373('0x34')]=_0x5d4dd2[_0xd373('0x34')]['length']?_0x5d4dd2['attributes']:_0x29725c[_0xd373('0x30')];if(_0x30b423['query'][_0xd373('0x43')]){_0x5d4dd2['include']=[{'all':!![]}];}_0x5d4dd2=_['merge']({},_0x5d4dd2,_0x30b423['options']);return db[_0xd373('0x3e')][_0xd373('0x44')](_0x5d4dd2)[_0xd373('0x23')](handleEntityNotFound(_0x302f65,null))[_0xd373('0x23')](respondWithResult(_0x302f65,null))[_0xd373('0x41')](handleError(_0x302f65,null));};exports[_0xd373('0x45')]=function(_0x1855aa,_0x4d1088){return db[_0xd373('0x3e')]['create'](_0x1855aa[_0xd373('0x46')],{})[_0xd373('0x23')](function(_0x5502e5){var _0x4517ab=_0x1855aa['user'][_0xd373('0x25')]({'plain':!![]});if(!_0x4517ab)throw new Error(_0xd373('0x47'));if(_0x4517ab[_0xd373('0x48')]===_0xd373('0x49')){var _0xe22cbd=_0x5502e5['get']({'plain':!![]});var _0x4971a0='Voicemails';return db[_0xd373('0x4a')][_0xd373('0x44')]({'where':{'name':_0x4971a0,'userProfileId':_0x4517ab['userProfileId']},'raw':!![]})[_0xd373('0x23')](function(_0x3e6766){if(_0x3e6766&&_0x3e6766['autoAssociation']===0x0){return db[_0xd373('0x27')][_0xd373('0x45')]({'name':_0xe22cbd[_0xd373('0x2a')],'resourceId':_0xe22cbd['id'],'type':_0x3e6766[_0xd373('0x2a')],'sectionId':_0x3e6766['id']},{})[_0xd373('0x23')](function(){return _0x5502e5;});}else{return _0x5502e5;}})[_0xd373('0x41')](function(_0xc255ec){logger[_0xd373('0x28')](_0xd373('0x4b'),_0xc255ec);throw _0xc255ec;});}return _0x5502e5;})[_0xd373('0x23')](respondWithResult(_0x4d1088,0xc9))[_0xd373('0x41')](handleError(_0x4d1088,null));};exports['update']=function(_0x4b2645,_0x51ca73){if(_0x4b2645['body']['id']){delete _0x4b2645['body']['id'];}return db['VoiceMail'][_0xd373('0x44')]({'where':{'id':_0x4b2645[_0xd373('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51ca73,null))['then'](saveUpdates(_0x4b2645['body'],null))[_0xd373('0x23')](respondWithResult(_0x51ca73,null))[_0xd373('0x41')](handleError(_0x51ca73,null));};exports['destroy']=function(_0x52fa5b,_0x2230d6){return db[_0xd373('0x3e')][_0xd373('0x44')]({'where':{'id':_0x52fa5b[_0xd373('0x4c')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x2230d6,null))['then'](removeEntity(_0x2230d6,null))[_0xd373('0x41')](handleError(_0x2230d6,null));};exports[_0xd373('0x4d')]=function(_0x386e4c,_0x213da6,_0xc607fb){return db[_0xd373('0x3e')][_0xd373('0x4e')]({'where':{'id':_0x386e4c[_0xd373('0x4c')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x213da6,null))[_0xd373('0x23')](function(_0x1c21d2){var _0x3ad1ec;var _0x213b3c={},_0x42e45d={};_0x42e45d[_0xd373('0x30')]=_['keys'](db[_0xd373('0x4f')][_0xd373('0x2d')]);_0x42e45d[_0xd373('0x31')]=_['keys'](_0x386e4c[_0xd373('0x31')]);_0x42e45d['filters']=_[_0xd373('0x35')](_0x42e45d['model'],_0x42e45d[_0xd373('0x31')]);_0x213b3c[_0xd373('0x34')]=_[_0xd373('0x35')](_0x42e45d[_0xd373('0x30')],qs[_0xd373('0x36')](_0x386e4c[_0xd373('0x31')][_0xd373('0x36')]));_0x213b3c[_0xd373('0x34')]=_0x213b3c[_0xd373('0x34')][_0xd373('0x37')]?_0x213b3c[_0xd373('0x34')]:_0x42e45d[_0xd373('0x30')];if(!_0x386e4c[_0xd373('0x31')][_0xd373('0x38')](_0xd373('0x50'))){_0x213b3c[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x386e4c[_0xd373('0x31')][_0xd373('0x1b')]);_0x213b3c[_0xd373('0x19')]=qs[_0xd373('0x19')](_0x386e4c[_0xd373('0x31')][_0xd373('0x19')]);}_0x213b3c[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0x386e4c[_0xd373('0x31')]['sort']);_0x213b3c[_0xd373('0x3b')]=qs[_0xd373('0x33')](_[_0xd373('0x51')](_0x386e4c['query'],_0x42e45d[_0xd373('0x33')]));if(_0x386e4c[_0xd373('0x31')][_0xd373('0x3d')]){_0x213b3c[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0x213b3c[_0xd373('0x3b')],{'$or':_[_0xd373('0x2c')](_0x213b3c['attributes'],function(_0x1afe12){var _0x356820={};_0x356820[_0x1afe12]={'$like':'%'+_0x386e4c[_0xd373('0x31')][_0xd373('0x3d')]+'%'};return _0x356820;})});}_0x213b3c[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0x213b3c[_0xd373('0x3b')],{'mailboxuser':_0x1c21d2[_0xd373('0x52')]});_0x213b3c=_['merge']({},_0x213b3c,_0x386e4c[_0xd373('0x53')]);return db['VoiceMailMessage'][_0xd373('0x54')](_0x213b3c)[_0xd373('0x23')](respondWithFilteredResult(_0x213da6,_0x213b3c));})[_0xd373('0x41')](handleError(_0x213da6,null));}; \ No newline at end of file +var _0x9ffd=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','body','destroy','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise'];(function(_0xf4cfeb,_0x49d761){var _0x2caac2=function(_0x1aafec){while(--_0x1aafec){_0xf4cfeb['push'](_0xf4cfeb['shift']());}};_0x2caac2(++_0x49d761);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x59e324,_0x243294){_0x59e324=_0x59e324-0x0;var _0x87f0f6=_0x9ffd[_0x59e324];return _0x87f0f6;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){var _0x1136e9=_0x42a828['get']({'plain':!![]});var _0x3ca906='Voicemails';return db[_0xd9ff('0x26')]['destroy']({'where':{'type':_0x3ca906,'resourceId':_0x1136e9['id']}})[_0xd9ff('0x25')](function(){return _0x42a828;});})[_0xd9ff('0x25')](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x5d685e,_0x11a17b){return function(_0xe11f88){if(!_0xe11f88){_0x5d685e[_0xd9ff('0x1a')](0x194);}return _0xe11f88;};}function handleError(_0x4390f7,_0x5c1c1f){_0x5c1c1f=_0x5c1c1f||0x1f4;return function(_0x1d3684){logger[_0xd9ff('0x27')](_0x1d3684[_0xd9ff('0x28')]);if(_0x1d3684[_0xd9ff('0x29')]){delete _0x1d3684[_0xd9ff('0x29')];}_0x4390f7[_0xd9ff('0x1b')](_0x5c1c1f)[_0xd9ff('0x2a')](_0x1d3684);};}exports[_0xd9ff('0x2b')]=function(_0x3dc443,_0x5706cf){var _0xcea5db={},_0x4ba2be={},_0x1d55fd={'count':0x0,'rows':[]};var _0x29c532=_[_0xd9ff('0x2c')](db['VoiceMail'][_0xd9ff('0x2d')],function(_0x3b26da){return{'name':_0x3b26da[_0xd9ff('0x2e')],'type':_0x3b26da[_0xd9ff('0x2f')]['key']};});_0x4ba2be[_0xd9ff('0x30')]=_['map'](_0x29c532,_0xd9ff('0x29'));_0x4ba2be[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x3dc443[_0xd9ff('0x31')]);_0x4ba2be[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],_0x4ba2be[_0xd9ff('0x31')]);_0xcea5db[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x36')]));_0xcea5db['attributes']=_0xcea5db[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0xcea5db[_0xd9ff('0x35')]:_0x4ba2be['model'];if(!_0x3dc443[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0xcea5db['limit']=qs[_0xd9ff('0x20')](_0x3dc443['query'][_0xd9ff('0x20')]);_0xcea5db[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3dc443['query']['offset']);}_0xcea5db['order']=qs[_0xd9ff('0x39')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0xcea5db[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x3dc443['query'],_0x4ba2be['filters']),_0x29c532);if(_0x3dc443['query'][_0xd9ff('0x3c')]){_0xcea5db[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0xcea5db[_0xd9ff('0x3a')],{'$or':_['map'](_0x29c532,function(_0x2692c0){if(_0x2692c0['type']!==_0xd9ff('0x3e')){var _0x3e2beb={};_0x3e2beb[_0x2692c0[_0xd9ff('0x29')]]={'$like':'%'+_0x3dc443[_0xd9ff('0x31')]['filter']+'%'};return _0x3e2beb;}})});}_0xcea5db=_[_0xd9ff('0x3d')]({},_0xcea5db,_0x3dc443[_0xd9ff('0x3f')]);var _0x4961a7={'where':_0xcea5db[_0xd9ff('0x3a')]};return db[_0xd9ff('0x40')][_0xd9ff('0x1e')](_0x4961a7)[_0xd9ff('0x25')](function(_0x1fe44d){_0x1d55fd[_0xd9ff('0x1e')]=_0x1fe44d;if(_0x3dc443['query'][_0xd9ff('0x41')]){_0xcea5db[_0xd9ff('0x42')]=[{'all':!![]}];}return db[_0xd9ff('0x40')][_0xd9ff('0x43')](_0xcea5db);})[_0xd9ff('0x25')](function(_0x52aab8){_0x1d55fd[_0xd9ff('0x44')]=_0x52aab8;return _0x1d55fd;})[_0xd9ff('0x25')](respondWithFilteredResult(_0x5706cf,_0xcea5db))[_0xd9ff('0x45')](handleError(_0x5706cf,null));};exports['show']=function(_0x5d06dd,_0x36843b){var _0x7eb1a={'raw':!![],'where':{'id':_0x5d06dd[_0xd9ff('0x46')]['id']}},_0x18d1c4={};_0x18d1c4[_0xd9ff('0x30')]=_[_0xd9ff('0x32')](db['VoiceMail'][_0xd9ff('0x2d')]);_0x18d1c4[_0xd9ff('0x31')]=_['keys'](_0x5d06dd[_0xd9ff('0x31')]);_0x18d1c4[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x18d1c4[_0xd9ff('0x30')],_0x18d1c4[_0xd9ff('0x31')]);_0x7eb1a['attributes']=_['intersection'](_0x18d1c4['model'],qs[_0xd9ff('0x36')](_0x5d06dd['query'][_0xd9ff('0x36')]));_0x7eb1a[_0xd9ff('0x35')]=_0x7eb1a[_0xd9ff('0x35')]['length']?_0x7eb1a[_0xd9ff('0x35')]:_0x18d1c4[_0xd9ff('0x30')];if(_0x5d06dd['query'][_0xd9ff('0x41')]){_0x7eb1a[_0xd9ff('0x42')]=[{'all':!![]}];}_0x7eb1a=_[_0xd9ff('0x3d')]({},_0x7eb1a,_0x5d06dd[_0xd9ff('0x3f')]);return db['VoiceMail'][_0xd9ff('0x47')](_0x7eb1a)['then'](handleEntityNotFound(_0x36843b,null))[_0xd9ff('0x25')](respondWithResult(_0x36843b,null))['catch'](handleError(_0x36843b,null));};exports[_0xd9ff('0x48')]=function(_0x3d91e6,_0x2bf37a){return db[_0xd9ff('0x40')][_0xd9ff('0x48')](_0x3d91e6['body'],{})[_0xd9ff('0x25')](function(_0x3d6f11){var _0x2fbe53=_0x3d91e6[_0xd9ff('0x49')]['get']({'plain':!![]});if(!_0x2fbe53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbe53['role']===_0xd9ff('0x49')){var _0x40be56=_0x3d6f11[_0xd9ff('0x4a')]({'plain':!![]});var _0x572618=_0xd9ff('0x4b');return db[_0xd9ff('0x4c')][_0xd9ff('0x47')]({'where':{'name':_0x572618,'userProfileId':_0x2fbe53[_0xd9ff('0x4d')]},'raw':!![]})[_0xd9ff('0x25')](function(_0x40d391){if(_0x40d391&&_0x40d391[_0xd9ff('0x4e')]===0x0){return db[_0xd9ff('0x26')][_0xd9ff('0x48')]({'name':_0x40be56[_0xd9ff('0x29')],'resourceId':_0x40be56['id'],'type':_0x40d391[_0xd9ff('0x29')],'sectionId':_0x40d391['id']},{})[_0xd9ff('0x25')](function(){return _0x3d6f11;});}else{return _0x3d6f11;}})[_0xd9ff('0x45')](function(_0x487b07){logger[_0xd9ff('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b07);throw _0x487b07;});}return _0x3d6f11;})[_0xd9ff('0x25')](respondWithResult(_0x2bf37a,0xc9))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x24')]=function(_0x49623d,_0xc82610){if(_0x49623d['body']['id']){delete _0x49623d[_0xd9ff('0x4f')]['id'];}return db['VoiceMail'][_0xd9ff('0x47')]({'where':{'id':_0x49623d['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0xc82610,null))['then'](saveUpdates(_0x49623d[_0xd9ff('0x4f')],null))[_0xd9ff('0x25')](respondWithResult(_0xc82610,null))[_0xd9ff('0x45')](handleError(_0xc82610,null));};exports[_0xd9ff('0x50')]=function(_0x4df17b,_0x8c136b){return db[_0xd9ff('0x40')][_0xd9ff('0x47')]({'where':{'id':_0x4df17b['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x8c136b,null))[_0xd9ff('0x25')](removeEntity(_0x8c136b,null))[_0xd9ff('0x45')](handleError(_0x8c136b,null));};exports[_0xd9ff('0x51')]=function(_0x11dd0c,_0x56e8e8,_0x27cc9e){return db[_0xd9ff('0x40')][_0xd9ff('0x52')]({'where':{'id':_0x11dd0c[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x56e8e8,null))[_0xd9ff('0x25')](function(_0x458fd4){var _0x5bac6f;var _0x3be850={},_0x11251f={};_0x11251f['model']=_[_0xd9ff('0x32')](db[_0xd9ff('0x53')]['rawAttributes']);_0x11251f[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x11dd0c[_0xd9ff('0x31')]);_0x11251f['filters']=_['intersection'](_0x11251f[_0xd9ff('0x30')],_0x11251f['query']);_0x3be850[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x11251f[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x11dd0c['query']['fields']));_0x3be850['attributes']=_0x3be850[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0x3be850[_0xd9ff('0x35')]:_0x11251f[_0xd9ff('0x30')];if(!_0x11dd0c[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0x3be850['limit']=qs[_0xd9ff('0x20')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x20')]);_0x3be850[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x1f')]);}_0x3be850[_0xd9ff('0x54')]=qs['sort'](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0x3be850['where']=qs['filters'](_[_0xd9ff('0x3b')](_0x11dd0c['query'],_0x11251f[_0xd9ff('0x33')]));if(_0x11dd0c[_0xd9ff('0x31')]['filter']){_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'$or':_[_0xd9ff('0x2c')](_0x3be850[_0xd9ff('0x35')],function(_0x49c5fa){var _0x12a8d7={};_0x12a8d7[_0x49c5fa]={'$like':'%'+_0x11dd0c['query']['filter']+'%'};return _0x12a8d7;})});}_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'mailboxuser':_0x458fd4[_0xd9ff('0x55')]});_0x3be850=_['merge']({},_0x3be850,_0x11dd0c[_0xd9ff('0x3f')]);return db[_0xd9ff('0x53')][_0xd9ff('0x56')](_0x3be850)[_0xd9ff('0x25')](respondWithFilteredResult(_0x56e8e8,_0x3be850));})[_0xd9ff('0x45')](handleError(_0x56e8e8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 400cc9f..d31afaa 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 _0x9169=['define','mailbox_context','mailbox','lodash','util','api','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9169,0x1cb));var _0x9916=function(_0x1ab8c7,_0x28db6d){_0x1ab8c7=_0x1ab8c7-0x0;var _0x1b951f=_0x9169[_0x1ab8c7];return _0x1b951f;};'use strict';var _=require(_0x9916('0x0'));var util=require(_0x9916('0x1'));var logger=require('../../config/logger')(_0x9916('0x2'));var moment=require('moment');var BPromise=require(_0x9916('0x3'));var rp=require(_0x9916('0x4'));var fs=require('fs');var path=require(_0x9916('0x5'));var rimraf=require(_0x9916('0x6'));var config=require('../../config/environment');var attributes=require(_0x9916('0x7'));module[_0x9916('0x8')]=function(_0x197b17,_0xc728dc){return _0x197b17[_0x9916('0x9')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9916('0xa'),'fields':[_0x9916('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9e0=['exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xd9e0,0x102));var _0x0d9e=function(_0x411a70,_0x1dcb7f){_0x411a70=_0x411a70-0x0;var _0x2c0bc0=_0xd9e0[_0x411a70];return _0x2c0bc0;};'use strict';var _=require(_0x0d9e('0x0'));var util=require(_0x0d9e('0x1'));var logger=require('../../config/logger')(_0x0d9e('0x2'));var moment=require(_0x0d9e('0x3'));var BPromise=require(_0x0d9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d9e('0x5'));var rimraf=require(_0x0d9e('0x6'));var config=require(_0x0d9e('0x7'));var attributes=require('./voiceMail.attributes');module[_0x0d9e('0x8')]=function(_0x1b916a,_0x543a54){return _0x1b916a['define'](_0x0d9e('0x9'),attributes,{'tableName':_0x0d9e('0xa'),'paranoid':![],'indexes':[{'name':_0x0d9e('0xb'),'fields':[_0x0d9e('0xc'),_0x0d9e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8767d18..b6246e7 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 _0x15c8=['VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4e91de,_0x9f64b){var _0x25a433=function(_0x5d15bf){while(--_0x5d15bf){_0x4e91de['push'](_0x4e91de['shift']());}};_0x25a433(++_0x9f64b);}(_0x15c8,0x81));var _0x815c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x15c8[_0x432682];return _0x463d05;};'use strict';var _=require(_0x815c('0x0'));var util=require(_0x815c('0x1'));var moment=require('moment');var BPromise=require(_0x815c('0x2'));var rs=require(_0x815c('0x3'));var fs=require('fs');var Redis=require(_0x815c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x815c('0x5'))(_0x815c('0x6'));var config=require(_0x815c('0x7'));var jayson=require(_0x815c('0x8'));var client=jayson['client'][_0x815c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47587c,_0x3620a6,_0x558a16){return new BPromise(function(_0x438ca9,_0x257416){return client['request'](_0x47587c,_0x558a16)[_0x815c('0xa')](function(_0x45f1bc){logger[_0x815c('0xb')]('VoiceMail,\x20%s,\x20%s',_0x3620a6,_0x815c('0xc'));logger['debug'](_0x815c('0xd'),_0x3620a6,'request\x20sent',JSON[_0x815c('0xe')](_0x45f1bc));if(_0x45f1bc[_0x815c('0xf')]){if(_0x45f1bc[_0x815c('0xf')][_0x815c('0x10')]===0x1f4){logger[_0x815c('0xf')]('VoiceMail,\x20%s,\x20%s',_0x3620a6,_0x45f1bc[_0x815c('0xf')][_0x815c('0x11')]);return _0x257416(_0x45f1bc[_0x815c('0xf')][_0x815c('0x11')]);}logger[_0x815c('0xf')](_0x815c('0x12'),_0x3620a6,_0x45f1bc[_0x815c('0xf')]['message']);return _0x438ca9(_0x45f1bc[_0x815c('0xf')][_0x815c('0x11')]);}else{logger[_0x815c('0xb')]('VoiceMail,\x20%s,\x20%s',_0x3620a6,_0x815c('0xc'));_0x438ca9(_0x45f1bc[_0x815c('0x13')][_0x815c('0x11')]);}})[_0x815c('0x14')](function(_0x5f475e){logger['error'](_0x815c('0x12'),_0x3620a6,_0x5f475e);_0x257416(_0x5f475e);});});} \ No newline at end of file +var _0xea97=['../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1d362e,_0x3ed19c){var _0x5cfca7=function(_0x144137){while(--_0x144137){_0x1d362e['push'](_0x1d362e['shift']());}};_0x5cfca7(++_0x3ed19c);}(_0xea97,0x101));var _0x7ea9=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xea97[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0x7ea9('0x0'));var util=require(_0x7ea9('0x1'));var moment=require(_0x7ea9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ea9('0x3'));var db=require(_0x7ea9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7ea9('0x5'))(_0x7ea9('0x6'));var config=require(_0x7ea9('0x7'));var jayson=require(_0x7ea9('0x8'));var client=jayson[_0x7ea9('0x9')][_0x7ea9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16b87d,_0x3e5232,_0x24247a){return new BPromise(function(_0x35dfa5,_0x2dfccd){return client[_0x7ea9('0xb')](_0x16b87d,_0x24247a)['then'](function(_0x5c88de){logger[_0x7ea9('0xc')](_0x7ea9('0xd'),_0x3e5232,_0x7ea9('0xe'));logger['debug'](_0x7ea9('0xf'),_0x3e5232,_0x7ea9('0xe'),JSON[_0x7ea9('0x10')](_0x5c88de));if(_0x5c88de[_0x7ea9('0x11')]){if(_0x5c88de[_0x7ea9('0x11')][_0x7ea9('0x12')]===0x1f4){logger[_0x7ea9('0x11')](_0x7ea9('0xd'),_0x3e5232,_0x5c88de[_0x7ea9('0x11')][_0x7ea9('0x13')]);return _0x2dfccd(_0x5c88de['error'][_0x7ea9('0x13')]);}logger[_0x7ea9('0x11')](_0x7ea9('0xd'),_0x3e5232,_0x5c88de[_0x7ea9('0x11')]['message']);return _0x35dfa5(_0x5c88de[_0x7ea9('0x11')][_0x7ea9('0x13')]);}else{logger['info'](_0x7ea9('0xd'),_0x3e5232,_0x7ea9('0xe'));_0x35dfa5(_0x5c88de[_0x7ea9('0x14')][_0x7ea9('0x13')]);}})[_0x7ea9('0x15')](function(_0x538fda){logger[_0x7ea9('0x11')]('VoiceMail,\x20%s,\x20%s',_0x3e5232,_0x538fda);_0x2dfccd(_0x538fda);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 7f2bd50..df6668c 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 _0x4423=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','delete','destroy','exports','util','path'];(function(_0x28f5e6,_0x4cef0b){var _0x391d87=function(_0x429fba){while(--_0x429fba){_0x28f5e6['push'](_0x28f5e6['shift']());}};_0x391d87(++_0x4cef0b);}(_0x4423,0x185));var _0x3442=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x4423[_0x1d87fc];return _0x492b56;};'use strict';var multer=require('multer');var util=require(_0x3442('0x0'));var path=require(_0x3442('0x1'));var timeout=require('connect-timeout');var express=require(_0x3442('0x2'));var router=express[_0x3442('0x3')]();var fs_extra=require(_0x3442('0x4'));var auth=require(_0x3442('0x5'));var interaction=require(_0x3442('0x6'));var config=require(_0x3442('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x3442('0x8')]('/',auth[_0x3442('0x9')](),controller[_0x3442('0xa')]);router[_0x3442('0x8')]('/:id',auth[_0x3442('0x9')](),controller[_0x3442('0xb')]);router[_0x3442('0x8')](_0x3442('0xc'),auth['isAuthenticated'](),controller[_0x3442('0xd')]);router['post']('/',auth[_0x3442('0x9')](),controller['create']);router['put']('/:id',auth[_0x3442('0x9')](),controller['update']);router[_0x3442('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3442('0xf')]);module[_0x3442('0x10')]=router; \ No newline at end of file +var _0x8a27=['post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated','show','/:id/download','download'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x8a27,0x1ec));var _0x78a2=function(_0x191901,_0xb19965){_0x191901=_0x191901-0x0;var _0x4b9ab4=_0x8a27[_0x191901];return _0x4b9ab4;};'use strict';var multer=require(_0x78a2('0x0'));var util=require('util');var path=require(_0x78a2('0x1'));var timeout=require(_0x78a2('0x2'));var express=require(_0x78a2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x78a2('0x4'));var controller=require(_0x78a2('0x5'));router[_0x78a2('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x78a2('0x7'),auth[_0x78a2('0x8')](),controller[_0x78a2('0x9')]);router[_0x78a2('0x6')](_0x78a2('0xa'),auth[_0x78a2('0x8')](),controller[_0x78a2('0xb')]);router[_0x78a2('0xc')]('/',auth[_0x78a2('0x8')](),controller[_0x78a2('0xd')]);router['put'](_0x78a2('0x7'),auth['isAuthenticated'](),controller[_0x78a2('0xe')]);router[_0x78a2('0xf')]('/:id',auth[_0x78a2('0x8')](),controller[_0x78a2('0x10')]);module[_0x78a2('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index e4b0c45..5979237 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 _0x24d2=['INTEGER','STRING','BLOB','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x495c99,_0x38e03c){var _0xc3e091=function(_0x389122){while(--_0x389122){_0x495c99['push'](_0x495c99['shift']());}};_0xc3e091(++_0x38e03c);}(_0x24d2,0x1cc));var _0x224d=function(_0x1db09b,_0x2d9dbc){_0x1db09b=_0x1db09b-0x0;var _0x2d3691=_0x24d2[_0x1db09b];return _0x2d3691;};'use strict';var Sequelize=require(_0x224d('0x0'));module[_0x224d('0x1')]={'name':{'type':Sequelize[_0x224d('0x2')],'get':function(_0x27dbaa){return this[_0x224d('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x224d('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x224d('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x224d('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x224d('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x224d('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x224d('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x224d('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x224d('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x224d('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x224d('0x7'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x40ec=['INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x425ec8,_0x293ff){var _0x1cbf90=function(_0x1a1974){while(--_0x1a1974){_0x425ec8['push'](_0x425ec8['shift']());}};_0x1cbf90(++_0x293ff);}(_0x40ec,0xec));var _0xc40e=function(_0x36a0b0,_0x4baf09){_0x36a0b0=_0x36a0b0-0x0;var _0x59ded7=_0x40ec[_0x36a0b0];return _0x59ded7;};'use strict';var Sequelize=require(_0xc40e('0x0'));module[_0xc40e('0x1')]={'name':{'type':Sequelize[_0xc40e('0x2')],'get':function(_0xba3832){return this[_0xc40e('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xc40e('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc40e('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xc40e('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc40e('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xc40e('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc40e('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xc40e('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc40e('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xc40e('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xc40e('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xc40e('0x7'),'defaultValue':Sequelize[_0xc40e('0x8')](_0xc40e('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5c0f7c0..78a4e79 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 _0x38ea=['filter','merge','VIRTUAL','VoiceMailMessage','includeAll','include','rows','catch','show','find','create','body','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick'];(function(_0x5d9b8c,_0x5c818d){var _0x24a331=function(_0x64ff4e){while(--_0x64ff4e){_0x5d9b8c['push'](_0x5d9b8c['shift']());}};_0x24a331(++_0x5c818d);}(_0x38ea,0x120));var _0xa38e=function(_0x50a531,_0x4b72c2){_0x50a531=_0x50a531-0x0;var _0x4744b8=_0x38ea[_0x50a531];return _0x4744b8;};'use strict';var emlformat=require(_0xa38e('0x0'));var rimraf=require(_0xa38e('0x1'));var zipdir=require(_0xa38e('0x2'));var jsonpatch=require(_0xa38e('0x3'));var rp=require(_0xa38e('0x4'));var moment=require('moment');var BPromise=require(_0xa38e('0x5'));var Mustache=require(_0xa38e('0x6'));var util=require('util');var path=require(_0xa38e('0x7'));var sox=require(_0xa38e('0x8'));var csv=require(_0xa38e('0x9'));var ejs=require(_0xa38e('0xa'));var fs=require('fs');var fs_extra=require(_0xa38e('0xb'));var _=require('lodash');var squel=require(_0xa38e('0xc'));var crypto=require(_0xa38e('0xd'));var jsforce=require(_0xa38e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa38e('0x9'));var querystring=require('querystring');var Papa=require(_0xa38e('0xf'));var Redis=require(_0xa38e('0x10'));var authService=require(_0xa38e('0x11'));var qs=require(_0xa38e('0x12'));var as=require(_0xa38e('0x13'));var hardwareService=require(_0xa38e('0x14'));var logger=require(_0xa38e('0x15'))(_0xa38e('0x16'));var utils=require(_0xa38e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa38e('0x18'));var db=require(_0xa38e('0x19'))['db'];function respondWithStatusCode(_0x381191,_0x1d19ae){_0x1d19ae=_0x1d19ae||0xcc;return function(_0x5ca4d7){if(_0x5ca4d7){return _0x381191[_0xa38e('0x1a')](_0x1d19ae);}return _0x381191[_0xa38e('0x1b')](_0x1d19ae)[_0xa38e('0x1c')]();};}function respondWithResult(_0x3b05da,_0x5a599a){_0x5a599a=_0x5a599a||0xc8;return function(_0x4f971c){if(_0x4f971c){return _0x3b05da['status'](_0x5a599a)[_0xa38e('0x1d')](_0x4f971c);}};}function respondWithFilteredResult(_0x20485f,_0x3a7a08){return function(_0x53f6e5){if(_0x53f6e5){var _0x15a542=typeof _0x3a7a08[_0xa38e('0x1e')]==='undefined'&&typeof _0x3a7a08['limit']===_0xa38e('0x1f');var _0x32e3f4=_0x53f6e5['count'];var _0x3855ca=_0x15a542?0x0:_0x3a7a08[_0xa38e('0x1e')];var _0x5d2591=_0x15a542?_0x53f6e5[_0xa38e('0x20')]:_0x3a7a08[_0xa38e('0x1e')]+_0x3a7a08['limit'];var _0x39b646;if(_0x5d2591>=_0x32e3f4){_0x5d2591=_0x32e3f4;_0x39b646=0xc8;}else{_0x39b646=0xce;}_0x20485f[_0xa38e('0x1b')](_0x39b646);return _0x20485f[_0xa38e('0x21')](_0xa38e('0x22'),_0x3855ca+'-'+_0x5d2591+'/'+_0x32e3f4)['json'](_0x53f6e5);}return null;};}function patchUpdates(_0x53b4c5){return function(_0x208348){try{jsonpatch[_0xa38e('0x23')](_0x208348,_0x53b4c5,!![]);}catch(_0x3b2817){return BPromise['reject'](_0x3b2817);}return _0x208348[_0xa38e('0x24')]();};}function saveUpdates(_0x59b140,_0x3955ed){return function(_0x278ac9){if(_0x278ac9){return _0x278ac9[_0xa38e('0x25')](_0x59b140)[_0xa38e('0x26')](function(_0xa15f17){return _0xa15f17;});}return null;};}function removeEntity(_0xf1aa2f,_0x5557ba){return function(_0x4cb8b7){if(_0x4cb8b7){return _0x4cb8b7[_0xa38e('0x27')]()['then'](function(){_0xf1aa2f[_0xa38e('0x1b')](0xcc)[_0xa38e('0x1c')]();});}};}function handleEntityNotFound(_0x124cf9,_0x2e7283){return function(_0x263b92){if(!_0x263b92){_0x124cf9[_0xa38e('0x1a')](0x194);}return _0x263b92;};}function handleError(_0x2e7264,_0x1787b8){_0x1787b8=_0x1787b8||0x1f4;return function(_0x346b3a){logger[_0xa38e('0x28')](_0x346b3a[_0xa38e('0x29')]);if(_0x346b3a['name']){delete _0x346b3a[_0xa38e('0x2a')];}_0x2e7264[_0xa38e('0x1b')](_0x1787b8)['send'](_0x346b3a);};}exports[_0xa38e('0x2b')]=function(_0x1034e1,_0x4b9ac9){var _0x1bd6a9={},_0x45605e={},_0x4f5ba0={'count':0x0,'rows':[]};var _0xabcfeb=_['map'](db['VoiceMailMessage'][_0xa38e('0x2c')],function(_0x1f6c0a){return{'name':_0x1f6c0a[_0xa38e('0x2d')],'type':_0x1f6c0a[_0xa38e('0x2e')][_0xa38e('0x2f')]};});_0x45605e[_0xa38e('0x30')]=_[_0xa38e('0x31')](_[_0xa38e('0x32')](_0xabcfeb,'name'),[_0xa38e('0x2a')]);_0x45605e['query']=_[_0xa38e('0x33')](_0x1034e1[_0xa38e('0x34')]);_0x45605e[_0xa38e('0x35')]=_[_0xa38e('0x36')](_0x45605e['model'],_0x45605e[_0xa38e('0x34')]);_0x1bd6a9['attributes']=_[_0xa38e('0x36')](_0x45605e[_0xa38e('0x30')],qs[_0xa38e('0x37')](_0x1034e1[_0xa38e('0x34')]['fields']));_0x1bd6a9[_0xa38e('0x38')]=_0x1bd6a9[_0xa38e('0x38')][_0xa38e('0x39')]?_0x1bd6a9['attributes']:_0x45605e[_0xa38e('0x30')];if(!_0x1034e1[_0xa38e('0x34')]['hasOwnProperty'](_0xa38e('0x3a'))){_0x1bd6a9[_0xa38e('0x3b')]=qs['limit'](_0x1034e1[_0xa38e('0x34')]['limit']);_0x1bd6a9[_0xa38e('0x1e')]=qs[_0xa38e('0x1e')](_0x1034e1[_0xa38e('0x34')][_0xa38e('0x1e')]);}_0x1bd6a9[_0xa38e('0x3c')]=qs[_0xa38e('0x3d')](_0x1034e1[_0xa38e('0x34')][_0xa38e('0x3d')]);_0x1bd6a9[_0xa38e('0x3e')]=qs[_0xa38e('0x35')](_[_0xa38e('0x3f')](_0x1034e1['query'],_0x45605e['filters']),_0xabcfeb);if(_0x1034e1[_0xa38e('0x34')][_0xa38e('0x40')]){_0x1bd6a9[_0xa38e('0x3e')]=_[_0xa38e('0x41')](_0x1bd6a9[_0xa38e('0x3e')],{'$or':_[_0xa38e('0x32')](_0xabcfeb,function(_0x2ca9a){if(_0x2ca9a[_0xa38e('0x2e')]!==_0xa38e('0x42')){var _0x10418b={};_0x10418b[_0x2ca9a['name']]={'$like':'%'+_0x1034e1[_0xa38e('0x34')]['filter']+'%'};return _0x10418b;}})});}_0x1bd6a9=_[_0xa38e('0x41')]({},_0x1bd6a9,_0x1034e1['options']);var _0x5874e3={'where':_0x1bd6a9[_0xa38e('0x3e')]};return db[_0xa38e('0x43')][_0xa38e('0x20')](_0x5874e3)['then'](function(_0x36831e){_0x4f5ba0[_0xa38e('0x20')]=_0x36831e;if(_0x1034e1[_0xa38e('0x34')][_0xa38e('0x44')]){_0x1bd6a9[_0xa38e('0x45')]=[{'all':!![]}];}return db[_0xa38e('0x43')]['findAll'](_0x1bd6a9);})[_0xa38e('0x26')](function(_0x46db6d){_0x4f5ba0[_0xa38e('0x46')]=_0x46db6d;return _0x4f5ba0;})[_0xa38e('0x26')](respondWithFilteredResult(_0x4b9ac9,_0x1bd6a9))[_0xa38e('0x47')](handleError(_0x4b9ac9,null));};exports[_0xa38e('0x48')]=function(_0x308154,_0x56d064){var _0x22b2bb={'raw':!![],'where':{'id':_0x308154['params']['id']}},_0xec4bd3={};_0xec4bd3[_0xa38e('0x30')]=_[_0xa38e('0x33')](db['VoiceMailMessage']['rawAttributes']);_0xec4bd3[_0xa38e('0x34')]=_[_0xa38e('0x33')](_0x308154[_0xa38e('0x34')]);_0xec4bd3[_0xa38e('0x35')]=_[_0xa38e('0x36')](_0xec4bd3[_0xa38e('0x30')],_0xec4bd3['query']);_0x22b2bb['attributes']=_['intersection'](_0xec4bd3['model'],qs[_0xa38e('0x37')](_0x308154[_0xa38e('0x34')][_0xa38e('0x37')]));_0x22b2bb[_0xa38e('0x38')]=_0x22b2bb[_0xa38e('0x38')][_0xa38e('0x39')]?_0x22b2bb[_0xa38e('0x38')]:_0xec4bd3[_0xa38e('0x30')];if(_0x308154[_0xa38e('0x34')][_0xa38e('0x44')]){_0x22b2bb['include']=[{'all':!![]}];}_0x22b2bb=_[_0xa38e('0x41')]({},_0x22b2bb,_0x308154['options']);return db['VoiceMailMessage'][_0xa38e('0x49')](_0x22b2bb)['then'](handleEntityNotFound(_0x56d064,null))[_0xa38e('0x26')](respondWithResult(_0x56d064,null))[_0xa38e('0x47')](handleError(_0x56d064,null));};exports[_0xa38e('0x4a')]=function(_0x1c8d8c,_0x37dceb){return db[_0xa38e('0x43')]['create'](_0x1c8d8c['body'],{})[_0xa38e('0x26')](respondWithResult(_0x37dceb,0xc9))[_0xa38e('0x47')](handleError(_0x37dceb,null));};exports[_0xa38e('0x25')]=function(_0xc71e0c,_0x127fd0){if(_0xc71e0c['body']['id']){delete _0xc71e0c[_0xa38e('0x4b')]['id'];}return db[_0xa38e('0x43')]['find']({'where':{'id':_0xc71e0c[_0xa38e('0x4c')]['id']}})[_0xa38e('0x26')](handleEntityNotFound(_0x127fd0,null))['then'](saveUpdates(_0xc71e0c[_0xa38e('0x4b')],null))[_0xa38e('0x26')](respondWithResult(_0x127fd0,null))[_0xa38e('0x47')](handleError(_0x127fd0,null));};exports[_0xa38e('0x27')]=function(_0x4a20c8,_0x37e983){return db[_0xa38e('0x43')][_0xa38e('0x49')]({'where':{'id':_0x4a20c8[_0xa38e('0x4c')]['id']}})[_0xa38e('0x26')](handleEntityNotFound(_0x37e983,null))[_0xa38e('0x26')](removeEntity(_0x37e983,null))[_0xa38e('0x47')](handleError(_0x37e983,null));};exports[_0xa38e('0x4d')]=function(_0xa075c3,_0x2db7e1,_0x47cd06){return db[_0xa38e('0x43')][_0xa38e('0x49')]({'where':{'id':_0xa075c3[_0xa38e('0x4c')]['id']},'attributes':['id',_0xa38e('0x4e'),_0xa38e('0x4f')]})[_0xa38e('0x26')](handleEntityNotFound(_0x2db7e1,null))[_0xa38e('0x26')](function(_0x453536){if(_0x453536){if(!_0x453536[_0xa38e('0x4e')]){throw new db[(_0xa38e('0x50'))][(_0xa38e('0x51'))](_0xa38e('0x52'));}var _0x50a87d={'Content-Type':_0xa38e('0x53'),'Content-Disposition':_0xa38e('0x54')};if(_0x453536['msg_id']){_0x50a87d['Content-Disposition']=_0xa38e('0x55')+_0x453536[_0xa38e('0x4f')]+_0xa38e('0x56');}_0x2db7e1[_0xa38e('0x21')](_0x50a87d);return _0x2db7e1[_0xa38e('0x57')](new Buffer(_0x453536[_0xa38e('0x4e')]));}})[_0xa38e('0x47')](handleError(_0x2db7e1,null));}; \ No newline at end of file +var _0x49cc=['params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','key','differenceBy','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','intersection','find','create','body'];(function(_0x103277,_0x15a2a2){var _0x45c58f=function(_0xd91f6c){while(--_0xd91f6c){_0x103277['push'](_0x103277['shift']());}};_0x45c58f(++_0x15a2a2);}(_0x49cc,0x1aa));var _0xc49c=function(_0x34c6a3,_0x3e1a91){_0x34c6a3=_0x34c6a3-0x0;var _0x58fcda=_0x49cc[_0x34c6a3];return _0x58fcda;};'use strict';var emlformat=require(_0xc49c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc49c('0x1'));var jsonpatch=require(_0xc49c('0x2'));var rp=require('request-promise');var moment=require(_0xc49c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc49c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc49c('0x5'));var csv=require(_0xc49c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc49c('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc49c('0x8'));var jsforce=require(_0xc49c('0x9'));var deskjs=require(_0xc49c('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc49c('0xb'));var Papa=require(_0xc49c('0xc'));var Redis=require(_0xc49c('0xd'));var authService=require(_0xc49c('0xe'));var qs=require(_0xc49c('0xf'));var as=require(_0xc49c('0x10'));var hardwareService=require(_0xc49c('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc49c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc49c('0x13'));var db=require(_0xc49c('0x14'))['db'];function respondWithStatusCode(_0xc7b83c,_0x4479f4){_0x4479f4=_0x4479f4||0xcc;return function(_0x1a278e){if(_0x1a278e){return _0xc7b83c[_0xc49c('0x15')](_0x4479f4);}return _0xc7b83c[_0xc49c('0x16')](_0x4479f4)[_0xc49c('0x17')]();};}function respondWithResult(_0x179e9d,_0x41cf45){_0x41cf45=_0x41cf45||0xc8;return function(_0x2ec5ec){if(_0x2ec5ec){return _0x179e9d[_0xc49c('0x16')](_0x41cf45)[_0xc49c('0x18')](_0x2ec5ec);}};}function respondWithFilteredResult(_0x180e7b,_0x2e0d82){return function(_0x4d3019){if(_0x4d3019){var _0x55ab7c=typeof _0x2e0d82[_0xc49c('0x19')]===_0xc49c('0x1a')&&typeof _0x2e0d82['limit']===_0xc49c('0x1a');var _0x2dea00=_0x4d3019['count'];var _0x61c87a=_0x55ab7c?0x0:_0x2e0d82[_0xc49c('0x19')];var _0x19c127=_0x55ab7c?_0x4d3019['count']:_0x2e0d82[_0xc49c('0x19')]+_0x2e0d82[_0xc49c('0x1b')];var _0xf63196;if(_0x19c127>=_0x2dea00){_0x19c127=_0x2dea00;_0xf63196=0xc8;}else{_0xf63196=0xce;}_0x180e7b[_0xc49c('0x16')](_0xf63196);return _0x180e7b[_0xc49c('0x1c')](_0xc49c('0x1d'),_0x61c87a+'-'+_0x19c127+'/'+_0x2dea00)[_0xc49c('0x18')](_0x4d3019);}return null;};}function patchUpdates(_0x6f9881){return function(_0x3e6546){try{jsonpatch[_0xc49c('0x1e')](_0x3e6546,_0x6f9881,!![]);}catch(_0x1992bc){return BPromise[_0xc49c('0x1f')](_0x1992bc);}return _0x3e6546['save']();};}function saveUpdates(_0x1f2f1e,_0x11767b){return function(_0x37878f){if(_0x37878f){return _0x37878f[_0xc49c('0x20')](_0x1f2f1e)[_0xc49c('0x21')](function(_0x45659b){return _0x45659b;});}return null;};}function removeEntity(_0xe1ac10,_0x42ba36){return function(_0x526722){if(_0x526722){return _0x526722[_0xc49c('0x22')]()[_0xc49c('0x21')](function(){_0xe1ac10[_0xc49c('0x16')](0xcc)[_0xc49c('0x17')]();});}};}function handleEntityNotFound(_0x48eaf8,_0x23610c){return function(_0x17297d){if(!_0x17297d){_0x48eaf8[_0xc49c('0x15')](0x194);}return _0x17297d;};}function handleError(_0x5bea1d,_0x2ead8d){_0x2ead8d=_0x2ead8d||0x1f4;return function(_0x83fe21){logger[_0xc49c('0x23')](_0x83fe21[_0xc49c('0x24')]);if(_0x83fe21[_0xc49c('0x25')]){delete _0x83fe21[_0xc49c('0x25')];}_0x5bea1d[_0xc49c('0x16')](_0x2ead8d)[_0xc49c('0x26')](_0x83fe21);};}exports[_0xc49c('0x27')]=function(_0x41a3d4,_0x3e7803){var _0x17f1c4={},_0x35737d={},_0xbd5151={'count':0x0,'rows':[]};var _0x22359a=_[_0xc49c('0x28')](db[_0xc49c('0x29')][_0xc49c('0x2a')],function(_0x167bac){return{'name':_0x167bac['fieldName'],'type':_0x167bac['type'][_0xc49c('0x2b')]};});_0x35737d['model']=_[_0xc49c('0x2c')](_['map'](_0x22359a,_0xc49c('0x25')),[_0xc49c('0x25')]);_0x35737d[_0xc49c('0x2d')]=_[_0xc49c('0x2e')](_0x41a3d4['query']);_0x35737d[_0xc49c('0x2f')]=_['intersection'](_0x35737d[_0xc49c('0x30')],_0x35737d[_0xc49c('0x2d')]);_0x17f1c4[_0xc49c('0x31')]=_['intersection'](_0x35737d[_0xc49c('0x30')],qs[_0xc49c('0x32')](_0x41a3d4[_0xc49c('0x2d')][_0xc49c('0x32')]));_0x17f1c4[_0xc49c('0x31')]=_0x17f1c4[_0xc49c('0x31')][_0xc49c('0x33')]?_0x17f1c4[_0xc49c('0x31')]:_0x35737d[_0xc49c('0x30')];if(!_0x41a3d4['query'][_0xc49c('0x34')](_0xc49c('0x35'))){_0x17f1c4[_0xc49c('0x1b')]=qs['limit'](_0x41a3d4[_0xc49c('0x2d')][_0xc49c('0x1b')]);_0x17f1c4[_0xc49c('0x19')]=qs[_0xc49c('0x19')](_0x41a3d4[_0xc49c('0x2d')][_0xc49c('0x19')]);}_0x17f1c4[_0xc49c('0x36')]=qs[_0xc49c('0x37')](_0x41a3d4[_0xc49c('0x2d')][_0xc49c('0x37')]);_0x17f1c4[_0xc49c('0x38')]=qs['filters'](_['pick'](_0x41a3d4[_0xc49c('0x2d')],_0x35737d[_0xc49c('0x2f')]),_0x22359a);if(_0x41a3d4['query']['filter']){_0x17f1c4[_0xc49c('0x38')]=_[_0xc49c('0x39')](_0x17f1c4[_0xc49c('0x38')],{'$or':_[_0xc49c('0x28')](_0x22359a,function(_0x41987c){if(_0x41987c[_0xc49c('0x3a')]!==_0xc49c('0x3b')){var _0x10b453={};_0x10b453[_0x41987c[_0xc49c('0x25')]]={'$like':'%'+_0x41a3d4['query'][_0xc49c('0x3c')]+'%'};return _0x10b453;}})});}_0x17f1c4=_[_0xc49c('0x39')]({},_0x17f1c4,_0x41a3d4[_0xc49c('0x3d')]);var _0x799e15={'where':_0x17f1c4['where']};return db[_0xc49c('0x29')][_0xc49c('0x3e')](_0x799e15)['then'](function(_0x2a06b4){_0xbd5151[_0xc49c('0x3e')]=_0x2a06b4;if(_0x41a3d4[_0xc49c('0x2d')][_0xc49c('0x3f')]){_0x17f1c4[_0xc49c('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xc49c('0x41')](_0x17f1c4);})[_0xc49c('0x21')](function(_0x7275ea){_0xbd5151['rows']=_0x7275ea;return _0xbd5151;})[_0xc49c('0x21')](respondWithFilteredResult(_0x3e7803,_0x17f1c4))[_0xc49c('0x42')](handleError(_0x3e7803,null));};exports[_0xc49c('0x43')]=function(_0x1b42aa,_0x26a9d3){var _0x9c8fc0={'raw':!![],'where':{'id':_0x1b42aa['params']['id']}},_0xce0101={};_0xce0101['model']=_[_0xc49c('0x2e')](db[_0xc49c('0x29')][_0xc49c('0x2a')]);_0xce0101[_0xc49c('0x2d')]=_[_0xc49c('0x2e')](_0x1b42aa[_0xc49c('0x2d')]);_0xce0101[_0xc49c('0x2f')]=_[_0xc49c('0x44')](_0xce0101[_0xc49c('0x30')],_0xce0101['query']);_0x9c8fc0[_0xc49c('0x31')]=_[_0xc49c('0x44')](_0xce0101['model'],qs['fields'](_0x1b42aa[_0xc49c('0x2d')][_0xc49c('0x32')]));_0x9c8fc0[_0xc49c('0x31')]=_0x9c8fc0['attributes'][_0xc49c('0x33')]?_0x9c8fc0[_0xc49c('0x31')]:_0xce0101['model'];if(_0x1b42aa[_0xc49c('0x2d')]['includeAll']){_0x9c8fc0[_0xc49c('0x40')]=[{'all':!![]}];}_0x9c8fc0=_[_0xc49c('0x39')]({},_0x9c8fc0,_0x1b42aa[_0xc49c('0x3d')]);return db[_0xc49c('0x29')][_0xc49c('0x45')](_0x9c8fc0)[_0xc49c('0x21')](handleEntityNotFound(_0x26a9d3,null))[_0xc49c('0x21')](respondWithResult(_0x26a9d3,null))[_0xc49c('0x42')](handleError(_0x26a9d3,null));};exports['create']=function(_0x23327c,_0x3911bb){return db[_0xc49c('0x29')][_0xc49c('0x46')](_0x23327c[_0xc49c('0x47')],{})[_0xc49c('0x21')](respondWithResult(_0x3911bb,0xc9))['catch'](handleError(_0x3911bb,null));};exports[_0xc49c('0x20')]=function(_0x2e71db,_0x152190){if(_0x2e71db[_0xc49c('0x47')]['id']){delete _0x2e71db[_0xc49c('0x47')]['id'];}return db['VoiceMailMessage'][_0xc49c('0x45')]({'where':{'id':_0x2e71db[_0xc49c('0x48')]['id']}})['then'](handleEntityNotFound(_0x152190,null))[_0xc49c('0x21')](saveUpdates(_0x2e71db['body'],null))[_0xc49c('0x21')](respondWithResult(_0x152190,null))[_0xc49c('0x42')](handleError(_0x152190,null));};exports['destroy']=function(_0x34816c,_0x5c184f){return db[_0xc49c('0x29')][_0xc49c('0x45')]({'where':{'id':_0x34816c[_0xc49c('0x48')]['id']}})[_0xc49c('0x21')](handleEntityNotFound(_0x5c184f,null))['then'](removeEntity(_0x5c184f,null))[_0xc49c('0x42')](handleError(_0x5c184f,null));};exports[_0xc49c('0x49')]=function(_0x3c8383,_0x4fdffe,_0x456df7){return db['VoiceMailMessage'][_0xc49c('0x45')]({'where':{'id':_0x3c8383[_0xc49c('0x48')]['id']},'attributes':['id',_0xc49c('0x4a'),_0xc49c('0x4b')]})[_0xc49c('0x21')](handleEntityNotFound(_0x4fdffe,null))[_0xc49c('0x21')](function(_0x38c888){if(_0x38c888){if(!_0x38c888[_0xc49c('0x4a')]){throw new db[(_0xc49c('0x4c'))][(_0xc49c('0x4d'))](_0xc49c('0x4e'));}var _0x2d7bd9={'Content-Type':'audio/wav','Content-Disposition':_0xc49c('0x4f')};if(_0x38c888[_0xc49c('0x4b')]){_0x2d7bd9[_0xc49c('0x50')]=_0xc49c('0x51')+_0x38c888[_0xc49c('0x4b')]+_0xc49c('0x52');}_0x4fdffe[_0xc49c('0x1c')](_0x2d7bd9);return _0x4fdffe[_0xc49c('0x26')](new Buffer(_0x38c888['recording']));}})['catch'](handleError(_0x4fdffe,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8f03b00..0e19e3d 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 _0x6994=['voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','VoiceMailMessage'];(function(_0x321638,_0x1ad605){var _0x3cf874=function(_0x2af223){while(--_0x2af223){_0x321638['push'](_0x321638['shift']());}};_0x3cf874(++_0x1ad605);}(_0x6994,0x9e));var _0x4699=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x6994[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0x4699('0x0'));var logger=require(_0x4699('0x1'))(_0x4699('0x2'));var moment=require(_0x4699('0x3'));var BPromise=require(_0x4699('0x4'));var rp=require(_0x4699('0x5'));var fs=require('fs');var path=require(_0x4699('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x4699('0x7')]=function(_0x40dbd6,_0x41dc69){return _0x40dbd6[_0x4699('0x8')](_0x4699('0x9'),attributes,{'tableName':_0x4699('0xa'),'paranoid':![],'indexes':[{'name':_0x4699('0xb'),'fields':[_0x4699('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x150a=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports'];(function(_0x34c2b3,_0x46b3fc){var _0x36a73f=function(_0x2424a4){while(--_0x2424a4){_0x34c2b3['push'](_0x34c2b3['shift']());}};_0x36a73f(++_0x46b3fc);}(_0x150a,0x178));var _0xa150=function(_0x19aba3,_0x310711){_0x19aba3=_0x19aba3-0x0;var _0x219f6b=_0x150a[_0x19aba3];return _0x219f6b;};'use strict';var _=require(_0xa150('0x0'));var util=require(_0xa150('0x1'));var logger=require(_0xa150('0x2'))(_0xa150('0x3'));var moment=require('moment');var BPromise=require(_0xa150('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa150('0x5'));var rimraf=require(_0xa150('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xa150('0x7')]=function(_0x401e97,_0x35a0f2){return _0x401e97[_0xa150('0x8')](_0xa150('0x9'),attributes,{'tableName':_0xa150('0xa'),'paranoid':![],'indexes':[{'name':_0xa150('0xb'),'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 0de729e..72772fa 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 _0xe63b=['VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x13687d,_0x379c1f){var _0x5044f4=function(_0x4a4bd3){while(--_0x4a4bd3){_0x13687d['push'](_0x13687d['shift']());}};_0x5044f4(++_0x379c1f);}(_0xe63b,0x126));var _0xbe63=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xe63b[_0x476bf4];return _0x788ffe;};'use strict';var _=require('lodash');var util=require(_0xbe63('0x0'));var moment=require(_0xbe63('0x1'));var BPromise=require(_0xbe63('0x2'));var rs=require(_0xbe63('0x3'));var fs=require('fs');var Redis=require(_0xbe63('0x4'));var db=require(_0xbe63('0x5'))['db'];var utils=require(_0xbe63('0x6'));var logger=require(_0xbe63('0x7'))('rpc');var config=require(_0xbe63('0x8'));var jayson=require(_0xbe63('0x9'));var client=jayson[_0xbe63('0xa')][_0xbe63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50ff2d,_0x2d0d22,_0x511f0e){return new BPromise(function(_0x2ba6e3,_0x48cf5e){return client['request'](_0x50ff2d,_0x511f0e)[_0xbe63('0xc')](function(_0xd1e860){logger[_0xbe63('0xd')](_0xbe63('0xe'),_0x2d0d22,_0xbe63('0xf'));logger['debug'](_0xbe63('0x10'),_0x2d0d22,_0xbe63('0xf'),JSON[_0xbe63('0x11')](_0xd1e860));if(_0xd1e860[_0xbe63('0x12')]){if(_0xd1e860[_0xbe63('0x12')]['code']===0x1f4){logger['error'](_0xbe63('0xe'),_0x2d0d22,_0xd1e860[_0xbe63('0x12')]['message']);return _0x48cf5e(_0xd1e860[_0xbe63('0x12')]['message']);}logger[_0xbe63('0x12')](_0xbe63('0xe'),_0x2d0d22,_0xd1e860[_0xbe63('0x12')]['message']);return _0x2ba6e3(_0xd1e860[_0xbe63('0x12')]['message']);}else{logger[_0xbe63('0xd')](_0xbe63('0xe'),_0x2d0d22,_0xbe63('0xf'));_0x2ba6e3(_0xd1e860[_0xbe63('0x13')][_0xbe63('0x14')]);}})[_0xbe63('0x15')](function(_0xb2b1a0){logger[_0xbe63('0x12')](_0xbe63('0xe'),_0x2d0d22,_0xb2b1a0);_0x48cf5e(_0xb2b1a0);});});} \ No newline at end of file +var _0xf518=['http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xcd5fd0,_0x49a6b6){var _0x4aa1eb=function(_0x42adec){while(--_0x42adec){_0xcd5fd0['push'](_0xcd5fd0['shift']());}};_0x4aa1eb(++_0x49a6b6);}(_0xf518,0x14f));var _0x8f51=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0xf518[_0x568cf0];return _0x360f81;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8f51('0x0'));var BPromise=require(_0x8f51('0x1'));var rs=require(_0x8f51('0x2'));var fs=require('fs');var Redis=require(_0x8f51('0x3'));var db=require(_0x8f51('0x4'))['db'];var utils=require(_0x8f51('0x5'));var logger=require(_0x8f51('0x6'))(_0x8f51('0x7'));var config=require(_0x8f51('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8f51('0x9')][_0x8f51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34a6de,_0x4f3f6d,_0x172c05){return new BPromise(function(_0x205929,_0x4e13cb){return client[_0x8f51('0xb')](_0x34a6de,_0x172c05)[_0x8f51('0xc')](function(_0x517894){logger['info'](_0x8f51('0xd'),_0x4f3f6d,_0x8f51('0xe'));logger[_0x8f51('0xf')](_0x8f51('0x10'),_0x4f3f6d,'request\x20sent',JSON[_0x8f51('0x11')](_0x517894));if(_0x517894[_0x8f51('0x12')]){if(_0x517894[_0x8f51('0x12')][_0x8f51('0x13')]===0x1f4){logger[_0x8f51('0x12')](_0x8f51('0xd'),_0x4f3f6d,_0x517894['error'][_0x8f51('0x14')]);return _0x4e13cb(_0x517894[_0x8f51('0x12')][_0x8f51('0x14')]);}logger[_0x8f51('0x12')](_0x8f51('0xd'),_0x4f3f6d,_0x517894[_0x8f51('0x12')]['message']);return _0x205929(_0x517894[_0x8f51('0x12')][_0x8f51('0x14')]);}else{logger['info'](_0x8f51('0xd'),_0x4f3f6d,_0x8f51('0xe'));_0x205929(_0x517894[_0x8f51('0x15')]['message']);}})[_0x8f51('0x16')](function(_0x2bd8d3){logger['error'](_0x8f51('0xd'),_0x4f3f6d,_0x2bd8d3);_0x4e13cb(_0x2bd8d3);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 12c1173..d1e036d 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 _0x1bab=['index','/:id','show','/:id/sounds','getSounds','post','addSound','delete','destroy','removeSound','multer','util','path','Router','fs-extra','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated'];(function(_0x4ba8c3,_0x33c457){var _0xf65364=function(_0x1c5369){while(--_0x1c5369){_0x4ba8c3['push'](_0x4ba8c3['shift']());}};_0xf65364(++_0x33c457);}(_0x1bab,0xdb));var _0xb1ba=function(_0x3f3259,_0x519089){_0x3f3259=_0x3f3259-0x0;var _0x7c838a=_0x1bab[_0x3f3259];return _0x7c838a;};'use strict';var multer=require(_0xb1ba('0x0'));var util=require(_0xb1ba('0x1'));var path=require(_0xb1ba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb1ba('0x3')]();var fs_extra=require(_0xb1ba('0x4'));var auth=require(_0xb1ba('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb1ba('0x6'));router[_0xb1ba('0x7')]('/',auth[_0xb1ba('0x8')](),controller[_0xb1ba('0x9')]);router[_0xb1ba('0x7')](_0xb1ba('0xa'),auth[_0xb1ba('0x8')](),controller[_0xb1ba('0xb')]);router[_0xb1ba('0x7')](_0xb1ba('0xc'),auth['isAuthenticated'](),controller[_0xb1ba('0xd')]);router[_0xb1ba('0xe')]('/',auth[_0xb1ba('0x8')](),controller['create']);router[_0xb1ba('0xe')](_0xb1ba('0xc'),auth[_0xb1ba('0x8')](),controller[_0xb1ba('0xf')]);router['put'](_0xb1ba('0xa'),auth[_0xb1ba('0x8')](),controller['update']);router[_0xb1ba('0x10')](_0xb1ba('0xa'),auth[_0xb1ba('0x8')](),controller[_0xb1ba('0x11')]);router['delete']('/:id/sounds/:id2',auth[_0xb1ba('0x8')](),controller[_0xb1ba('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd44f=['index','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get'];(function(_0x34c1ea,_0x5e3a54){var _0x3dcca5=function(_0x375eb3){while(--_0x375eb3){_0x34c1ea['push'](_0x34c1ea['shift']());}};_0x3dcca5(++_0x5e3a54);}(_0xd44f,0x123));var _0xfd44=function(_0x2f4e7a,_0x4c3f4e){_0x2f4e7a=_0x2f4e7a-0x0;var _0x3299a0=_0xd44f[_0x2f4e7a];return _0x3299a0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd44('0x0'));var timeout=require(_0xfd44('0x1'));var express=require(_0xfd44('0x2'));var router=express[_0xfd44('0x3')]();var fs_extra=require(_0xfd44('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfd44('0x5'));var config=require('../../config/environment');var controller=require(_0xfd44('0x6'));router[_0xfd44('0x7')]('/',auth['isAuthenticated'](),controller[_0xfd44('0x8')]);router['get']('/:id',auth[_0xfd44('0x9')](),controller[_0xfd44('0xa')]);router['get'](_0xfd44('0xb'),auth['isAuthenticated'](),controller[_0xfd44('0xc')]);router[_0xfd44('0xd')]('/',auth[_0xfd44('0x9')](),controller[_0xfd44('0xe')]);router['post'](_0xfd44('0xb'),auth[_0xfd44('0x9')](),controller[_0xfd44('0xf')]);router[_0xfd44('0x10')](_0xfd44('0x11'),auth[_0xfd44('0x9')](),controller[_0xfd44('0x12')]);router[_0xfd44('0x13')](_0xfd44('0x11'),auth[_0xfd44('0x9')](),controller[_0xfd44('0x14')]);router['delete'](_0xfd44('0x15'),auth[_0xfd44('0x9')](),controller[_0xfd44('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index e4fc7bd..ec84ff8 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 _0x20bf=['STRING','name','ENUM','custom','mp3nb','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x20bf,0x1c6));var _0xf20b=function(_0x1080d3,_0x284317){_0x1080d3=_0x1080d3-0x0;var _0x101d6d=_0x20bf[_0x1080d3];return _0x101d6d;};'use strict';var Sequelize=require(_0xf20b('0x0'));module[_0xf20b('0x1')]={'name':{'type':Sequelize[_0xf20b('0x2')],'allowNull':![],'unique':_0xf20b('0x3')},'mode':{'type':Sequelize[_0xf20b('0x4')](_0xf20b('0x5'),'files',_0xf20b('0x6'),'quietmp3nb','quietmp3',_0xf20b('0x7')),'allowNull':!![],'defaultValue':_0xf20b('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xf20b('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf20b('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf20b('0x2')],'allowNull':!![],'defaultValue':_0xf20b('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xf20b('0xa')},'defaultEntry':{'type':Sequelize[_0xf20b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5356=['alpha','BOOLEAN','sequelize','name','ENUM','custom','files','mp3nb','quietmp3','mp3','STRING'];(function(_0x553a72,_0x120470){var _0x410e05=function(_0x40fed8){while(--_0x40fed8){_0x553a72['push'](_0x553a72['shift']());}};_0x410e05(++_0x120470);}(_0x5356,0xff));var _0x6535=function(_0x1ecbd5,_0xf05f7c){_0x1ecbd5=_0x1ecbd5-0x0;var _0x1be527=_0x5356[_0x1ecbd5];return _0x1be527;};'use strict';var Sequelize=require(_0x6535('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6535('0x1')},'mode':{'type':Sequelize[_0x6535('0x2')](_0x6535('0x3'),_0x6535('0x4'),_0x6535('0x5'),'quietmp3nb',_0x6535('0x6'),_0x6535('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x6535('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x6535('0x8')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x6535('0x8')],'allowNull':!![],'defaultValue':_0x6535('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x6535('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index be81d0f..913cdb5 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 _0xcfca=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','body','params','sequelize','transaction','mode','root','create','files','directory','0777','user','role','UserProfileSection','MusicOnHolds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','format','%s.%s','basename','extname','server/files/moh','removeSound','id2','createdAt','order','getSounds','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','send','VoiceMusicOnHold','rawAttributes','key','map','name','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x566f13,_0x2fcf14){var _0x1cc7c4=function(_0x4580c3){while(--_0x4580c3){_0x566f13['push'](_0x566f13['shift']());}};_0x1cc7c4(++_0x2fcf14);}(_0xcfca,0xa3));var _0xacfc=function(_0x2a88ff,_0x656b08){_0x2a88ff=_0x2a88ff-0x0;var _0x4a8b10=_0xcfca[_0x2a88ff];return _0x4a8b10;};'use strict';var emlformat=require(_0xacfc('0x0'));var rimraf=require(_0xacfc('0x1'));var zipdir=require(_0xacfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xacfc('0x3'));var moment=require(_0xacfc('0x4'));var BPromise=require(_0xacfc('0x5'));var Mustache=require(_0xacfc('0x6'));var util=require(_0xacfc('0x7'));var path=require(_0xacfc('0x8'));var sox=require('sox');var csv=require(_0xacfc('0x9'));var ejs=require(_0xacfc('0xa'));var fs=require('fs');var fs_extra=require(_0xacfc('0xb'));var _=require(_0xacfc('0xc'));var squel=require('squel');var crypto=require(_0xacfc('0xd'));var jsforce=require(_0xacfc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xacfc('0x9'));var querystring=require(_0xacfc('0xf'));var Papa=require('papaparse');var Redis=require(_0xacfc('0x10'));var authService=require(_0xacfc('0x11'));var qs=require(_0xacfc('0x12'));var as=require(_0xacfc('0x13'));var hardwareService=require(_0xacfc('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xacfc('0x15'));var config=require(_0xacfc('0x16'));var licenseUtil=require(_0xacfc('0x17'));var db=require(_0xacfc('0x18'))['db'];function respondWithStatusCode(_0x4e46ce,_0x237b8a){_0x237b8a=_0x237b8a||0xcc;return function(_0x5d6888){if(_0x5d6888){return _0x4e46ce[_0xacfc('0x19')](_0x237b8a);}return _0x4e46ce['status'](_0x237b8a)[_0xacfc('0x1a')]();};}function respondWithResult(_0x11aa97,_0x50231a){_0x50231a=_0x50231a||0xc8;return function(_0x54f770){if(_0x54f770){return _0x11aa97[_0xacfc('0x1b')](_0x50231a)[_0xacfc('0x1c')](_0x54f770);}};}function respondWithFilteredResult(_0x27ed11,_0x1a9510){return function(_0x17038e){if(_0x17038e){var _0xbc76c5=typeof _0x1a9510['offset']===_0xacfc('0x1d')&&typeof _0x1a9510[_0xacfc('0x1e')]===_0xacfc('0x1d');var _0x4138cc=_0x17038e[_0xacfc('0x1f')];var _0x41fd02=_0xbc76c5?0x0:_0x1a9510['offset'];var _0x308d47=_0xbc76c5?_0x17038e[_0xacfc('0x1f')]:_0x1a9510[_0xacfc('0x20')]+_0x1a9510['limit'];var _0x4ab49b;if(_0x308d47>=_0x4138cc){_0x308d47=_0x4138cc;_0x4ab49b=0xc8;}else{_0x4ab49b=0xce;}_0x27ed11[_0xacfc('0x1b')](_0x4ab49b);return _0x27ed11[_0xacfc('0x21')](_0xacfc('0x22'),_0x41fd02+'-'+_0x308d47+'/'+_0x4138cc)[_0xacfc('0x1c')](_0x17038e);}return null;};}function patchUpdates(_0x5c683f){return function(_0xb27d9b){try{jsonpatch[_0xacfc('0x23')](_0xb27d9b,_0x5c683f,!![]);}catch(_0x2d5a22){return BPromise[_0xacfc('0x24')](_0x2d5a22);}return _0xb27d9b[_0xacfc('0x25')]();};}function saveUpdates(_0x2362ce,_0x24b5d5){return function(_0x507bf6){if(_0x507bf6){return _0x507bf6[_0xacfc('0x26')](_0x2362ce)[_0xacfc('0x27')](function(_0x23bb10){return _0x23bb10;});}return null;};}function removeEntity(_0x4a5946,_0x5aa2a9){return function(_0x24fdbc){if(_0x24fdbc){return _0x24fdbc[_0xacfc('0x28')]()[_0xacfc('0x27')](function(){var _0x448150=_0x24fdbc[_0xacfc('0x29')]({'plain':!![]});var _0x4d8971='MusicOnHolds';return db[_0xacfc('0x2a')][_0xacfc('0x28')]({'where':{'type':_0x4d8971,'resourceId':_0x448150['id']}})[_0xacfc('0x27')](function(){return _0x24fdbc;});})[_0xacfc('0x27')](function(){_0x4a5946[_0xacfc('0x1b')](0xcc)[_0xacfc('0x1a')]();});}};}function handleEntityNotFound(_0x225731,_0x57479c){return function(_0x5ef1b1){if(!_0x5ef1b1){_0x225731[_0xacfc('0x19')](0x194);}return _0x5ef1b1;};}function handleError(_0x3c7d8a,_0x3bc25c){_0x3bc25c=_0x3bc25c||0x1f4;return function(_0x16de88){logger['error'](_0x16de88['stack']);if(_0x16de88['name']){delete _0x16de88['name'];}_0x3c7d8a[_0xacfc('0x1b')](_0x3bc25c)[_0xacfc('0x2b')](_0x16de88);};}exports['index']=function(_0xd75114,_0x30c2b5){var _0x2c0dfe={},_0x3d53f0={},_0x734667={'count':0x0,'rows':[]};var _0x53ada5=_['map'](db[_0xacfc('0x2c')][_0xacfc('0x2d')],function(_0x2e850d){return{'name':_0x2e850d['fieldName'],'type':_0x2e850d['type'][_0xacfc('0x2e')]};});_0x3d53f0['model']=_[_0xacfc('0x2f')](_0x53ada5,_0xacfc('0x30'));_0x3d53f0[_0xacfc('0x31')]=_['keys'](_0xd75114[_0xacfc('0x31')]);_0x3d53f0[_0xacfc('0x32')]=_[_0xacfc('0x33')](_0x3d53f0['model'],_0x3d53f0[_0xacfc('0x31')]);_0x2c0dfe[_0xacfc('0x34')]=_[_0xacfc('0x33')](_0x3d53f0['model'],qs[_0xacfc('0x35')](_0xd75114[_0xacfc('0x31')][_0xacfc('0x35')]));_0x2c0dfe[_0xacfc('0x34')]=_0x2c0dfe[_0xacfc('0x34')][_0xacfc('0x36')]?_0x2c0dfe[_0xacfc('0x34')]:_0x3d53f0[_0xacfc('0x37')];if(!_0xd75114['query'][_0xacfc('0x38')](_0xacfc('0x39'))){_0x2c0dfe['limit']=qs[_0xacfc('0x1e')](_0xd75114['query'][_0xacfc('0x1e')]);_0x2c0dfe['offset']=qs[_0xacfc('0x20')](_0xd75114[_0xacfc('0x31')][_0xacfc('0x20')]);}_0x2c0dfe['order']=qs[_0xacfc('0x3a')](_0xd75114['query'][_0xacfc('0x3a')]);delete _0xd75114[_0xacfc('0x31')][_0xacfc('0x3a')];_0x2c0dfe[_0xacfc('0x3b')]=qs[_0xacfc('0x32')](_[_0xacfc('0x3c')](_0xd75114[_0xacfc('0x31')],_0x3d53f0[_0xacfc('0x32')]),_0x53ada5);if(_0xd75114[_0xacfc('0x31')][_0xacfc('0x3d')]){_0x2c0dfe[_0xacfc('0x3b')]=_[_0xacfc('0x3e')](_0x2c0dfe[_0xacfc('0x3b')],{'$or':_[_0xacfc('0x2f')](_0x53ada5,function(_0x68368c){if(_0x68368c[_0xacfc('0x3f')]!==_0xacfc('0x40')){var _0x4a190d={};_0x4a190d[_0x68368c[_0xacfc('0x30')]]={'$like':'%'+_0xd75114['query']['filter']+'%'};return _0x4a190d;}})});}_0x2c0dfe=_[_0xacfc('0x3e')]({},_0x2c0dfe,_0xd75114[_0xacfc('0x41')]);var _0x1aaffb={'where':_0x2c0dfe['where']};return db[_0xacfc('0x2c')][_0xacfc('0x1f')](_0x1aaffb)['then'](function(_0x54cce8){_0x734667[_0xacfc('0x1f')]=_0x54cce8;if(_0xd75114[_0xacfc('0x31')][_0xacfc('0x42')]){_0x2c0dfe[_0xacfc('0x43')]=[{'all':!![]}];}return db[_0xacfc('0x2c')][_0xacfc('0x44')](_0x2c0dfe);})[_0xacfc('0x27')](function(_0x498c87){_0x734667[_0xacfc('0x45')]=_0x498c87;return _0x734667;})[_0xacfc('0x27')](respondWithFilteredResult(_0x30c2b5,_0x2c0dfe))['catch'](handleError(_0x30c2b5,null));};exports[_0xacfc('0x46')]=function(_0xa9905b,_0x479c83){var _0x195b6={'raw':![],'where':{'id':_0xa9905b['params']['id']}},_0x463d37={};_0x463d37['model']=_[_0xacfc('0x47')](db[_0xacfc('0x2c')][_0xacfc('0x2d')]);_0x463d37[_0xacfc('0x31')]=_[_0xacfc('0x47')](_0xa9905b[_0xacfc('0x31')]);_0x463d37[_0xacfc('0x32')]=_[_0xacfc('0x33')](_0x463d37[_0xacfc('0x37')],_0x463d37[_0xacfc('0x31')]);_0x195b6[_0xacfc('0x34')]=_[_0xacfc('0x33')](_0x463d37[_0xacfc('0x37')],qs['fields'](_0xa9905b[_0xacfc('0x31')][_0xacfc('0x35')]));_0x195b6[_0xacfc('0x34')]=_0x195b6[_0xacfc('0x34')][_0xacfc('0x36')]?_0x195b6[_0xacfc('0x34')]:_0x463d37['model'];if(_0xa9905b[_0xacfc('0x31')][_0xacfc('0x42')]){_0x195b6[_0xacfc('0x43')]=[{'all':!![]}];}_0x195b6=_[_0xacfc('0x3e')]({},_0x195b6,_0xa9905b[_0xacfc('0x41')]);return db['VoiceMusicOnHold'][_0xacfc('0x48')](_0x195b6)[_0xacfc('0x27')](handleEntityNotFound(_0x479c83,null))[_0xacfc('0x27')](respondWithResult(_0x479c83,null))[_0xacfc('0x49')](handleError(_0x479c83,null));};exports[_0xacfc('0x26')]=function(_0x17939c,_0x5f38a9){if(_0x17939c[_0xacfc('0x4a')]['id']){delete _0x17939c[_0xacfc('0x4a')]['id'];}return db[_0xacfc('0x2c')][_0xacfc('0x48')]({'where':{'id':_0x17939c[_0xacfc('0x4b')]['id']}})[_0xacfc('0x27')](handleEntityNotFound(_0x5f38a9,null))[_0xacfc('0x27')](saveUpdates(_0x17939c[_0xacfc('0x4a')],null))[_0xacfc('0x27')](respondWithResult(_0x5f38a9,null))['catch'](handleError(_0x5f38a9,null));};exports['create']=function(_0x40ad55,_0x315136,_0x2a6581){return db[_0xacfc('0x4c')][_0xacfc('0x4d')](function(_0x50bc58){if(_0x40ad55[_0xacfc('0x4a')][_0xacfc('0x4e')]==='files'){_0x40ad55[_0xacfc('0x4a')]['directory']=path['join'](config[_0xacfc('0x4f')],'server/files/moh',_0x40ad55['body'][_0xacfc('0x30')]);}return db[_0xacfc('0x2c')][_0xacfc('0x50')](_0x40ad55[_0xacfc('0x4a')],{'transaction':_0x50bc58})[_0xacfc('0x27')](function(_0x4954e6){if(_0x40ad55[_0xacfc('0x4a')][_0xacfc('0x4e')]===_0xacfc('0x51')){fs['mkdirSync'](_0x4954e6[_0xacfc('0x52')],parseInt(_0xacfc('0x53'),0x8));}var _0x14cecb=_0x40ad55[_0xacfc('0x54')]['get']({'plain':!![]});if(!_0x14cecb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14cecb[_0xacfc('0x55')]===_0xacfc('0x54')){var _0x256a81=_0x4954e6[_0xacfc('0x29')]({'plain':!![]});return db[_0xacfc('0x56')]['find']({'where':{'name':_0xacfc('0x57'),'userProfileId':_0x14cecb['userProfileId']},'raw':!![]})['then'](function(_0x1157ad){if(_0x1157ad&&_0x1157ad[_0xacfc('0x58')]===0x0){return db[_0xacfc('0x2a')][_0xacfc('0x50')]({'name':_0x256a81[_0xacfc('0x30')],'resourceId':_0x256a81['id'],'type':_0x1157ad['name'],'sectionId':_0x1157ad['id']},{})[_0xacfc('0x27')](function(){return _0x4954e6;});}else{return _0x4954e6;}})[_0xacfc('0x49')](function(_0x2b4463){logger['error'](_0xacfc('0x59'),_0x2b4463);});}return _0x4954e6;});})[_0xacfc('0x27')](respondWithResult(_0x315136,0xc9))[_0xacfc('0x49')](handleError(_0x315136,null));};exports[_0xacfc('0x28')]=function(_0x40cd95,_0x33b900,_0x4a8679){var _0x3ef47d;return db[_0xacfc('0x2c')][_0xacfc('0x48')]({'where':{'id':_0x40cd95[_0xacfc('0x4b')]['id']}})[_0xacfc('0x27')](function(_0x5e94a1){if(_0x5e94a1){return db[_0xacfc('0x4c')][_0xacfc('0x4d')](function(_0x551aa2){return _0x5e94a1[_0xacfc('0x28')]({'transaction':_0x551aa2,'raw':!![]})[_0xacfc('0x27')](function(_0x24db18){if(_0x24db18[_0xacfc('0x52')]){fs[_0xacfc('0x5a')](_0x24db18[_0xacfc('0x52')])[_0xacfc('0x5b')](function(_0x5db3ee){fs['unlinkSync'](path[_0xacfc('0x5c')](_0x24db18[_0xacfc('0x52')],_0x5db3ee));});fs[_0xacfc('0x5d')](_0x24db18[_0xacfc('0x52')]);}return _0x24db18;});})['catch'](function(_0x168ff2){throw new db[(_0xacfc('0x5e'))][(_0xacfc('0x5f'))](_0x168ff2[_0xacfc('0x60')]);});}})[_0xacfc('0x27')](handleEntityNotFound(_0x33b900,null))['then'](removeEntity(_0x33b900,null))[_0xacfc('0x49')](handleError(_0x33b900,null));};exports[_0xacfc('0x61')]=function(_0x361431,_0x3f8248,_0x333643){return db['sequelize']['transaction'](function(_0x36fab0){var _0x195411;return db[_0xacfc('0x2c')][_0xacfc('0x48')]({'where':{'id':_0x361431[_0xacfc('0x4b')]['id']}})[_0xacfc('0x27')](function(_0x242e6b){if(_0x242e6b){_0x195411=_0x242e6b;return _0x242e6b[_0xacfc('0x61')](_0x361431[_0xacfc('0x4a')]['id'],{'transaction':_0x36fab0});}})[_0xacfc('0x27')](function(_0x77fc74){if(_0x77fc74){return db[_0xacfc('0x62')][_0xacfc('0x63')]({'where':{'id':_0x361431[_0xacfc('0x4a')]['id']},'attributes':['id',_0xacfc('0x30'),_0xacfc('0x64'),_0xacfc('0x65'),'createdAt'],'raw':!![]});}})[_0xacfc('0x27')](function(_0x4a11cc){if(_0x4a11cc){var _0xaaa2b9=path[_0xacfc('0x5c')](config['root'],'server/files/sounds/converted',util[_0xacfc('0x66')](_0xacfc('0x67'),path[_0xacfc('0x68')](_0x4a11cc['save_name'],path[_0xacfc('0x69')](_0x4a11cc[_0xacfc('0x64')])),_0x4a11cc[_0xacfc('0x65')]));var _0x312144=path['join'](config[_0xacfc('0x4f')],_0xacfc('0x6a'),_0x195411['name'],util['format'](_0xacfc('0x67'),_0x4a11cc[_0xacfc('0x30')],_0x4a11cc[_0xacfc('0x65')]));fs['symlinkSync'](_0xaaa2b9,_0x312144);return _0x4a11cc;}})[_0xacfc('0x49')](function(_0x474d42){throw new db[(_0xacfc('0x5e'))][(_0xacfc('0x5f'))](_0x474d42[_0xacfc('0x60')]);});})[_0xacfc('0x27')](handleEntityNotFound(_0x3f8248,null))[_0xacfc('0x27')](respondWithResult(_0x3f8248,0xc9))[_0xacfc('0x49')](handleError(_0x3f8248,null));};exports['removeSound']=function(_0x5a2042,_0x6cebfe,_0xcf6577){return db[_0xacfc('0x4c')][_0xacfc('0x4d')](function(_0x5351c4){var _0x25312e;return db[_0xacfc('0x2c')][_0xacfc('0x63')]({'where':{'id':_0x5a2042[_0xacfc('0x4b')]['id']}})[_0xacfc('0x27')](handleEntityNotFound(_0x6cebfe,null))[_0xacfc('0x27')](function(_0x578325){if(_0x578325){_0x25312e=_0x578325;return _0x578325[_0xacfc('0x6b')](_0x5a2042['params'][_0xacfc('0x6c')]);}})['then'](function(_0x1d610d){if(_0x1d610d){return db[_0xacfc('0x62')][_0xacfc('0x63')]({'where':{'id':_0x5a2042[_0xacfc('0x4b')][_0xacfc('0x6c')]},'attributes':['id',_0xacfc('0x30'),_0xacfc('0x64'),_0xacfc('0x65'),_0xacfc('0x6d')],'raw':!![]});}})[_0xacfc('0x27')](function(_0x22b742){if(_0x22b742){fs['unlinkSync'](path['join'](_0x25312e['directory'],util[_0xacfc('0x66')](_0xacfc('0x67'),_0x22b742[_0xacfc('0x30')],_0x22b742[_0xacfc('0x65')])));return _0x22b742;}})['catch'](function(_0x2b9275){throw new db[(_0xacfc('0x5e'))][(_0xacfc('0x5f'))](_0x2b9275['message']);});})['then'](handleEntityNotFound(_0x6cebfe,null))['then'](respondWithStatusCode(_0x6cebfe,0xcc))[_0xacfc('0x49')](handleError(_0x6cebfe,null));};exports['getSounds']=function(_0x547956,_0x29781a,_0x5e45d2){var _0x3a62fc={};var _0x536f34={};var _0x14af2b;var _0x4fe4c3;return db[_0xacfc('0x2c')]['findOne']({'where':{'id':_0x547956[_0xacfc('0x4b')]['id']}})[_0xacfc('0x27')](handleEntityNotFound(_0x29781a,null))[_0xacfc('0x27')](function(_0x36c78b){if(_0x36c78b){_0x14af2b=_0x36c78b;_0x536f34[_0xacfc('0x37')]=_['keys'](db['Sound'][_0xacfc('0x2d')]);_0x536f34[_0xacfc('0x31')]=_[_0xacfc('0x47')](_0x547956[_0xacfc('0x31')]);_0x536f34['filters']=_['intersection'](_0x536f34['model'],_0x536f34[_0xacfc('0x31')]);_0x3a62fc[_0xacfc('0x34')]=_[_0xacfc('0x33')](_0x536f34[_0xacfc('0x37')],qs['fields'](_0x547956[_0xacfc('0x31')]['fields']));_0x3a62fc[_0xacfc('0x34')]=_0x3a62fc[_0xacfc('0x34')]['length']?_0x3a62fc[_0xacfc('0x34')]:_0x536f34['model'];_0x3a62fc[_0xacfc('0x6e')]=qs['sort'](_0x547956[_0xacfc('0x31')][_0xacfc('0x3a')]);_0x3a62fc[_0xacfc('0x3b')]=qs['filters'](_['pick'](_0x547956[_0xacfc('0x31')],_0x536f34['filters']));if(_0x547956[_0xacfc('0x31')]['filter']){_0x3a62fc[_0xacfc('0x3b')]=_[_0xacfc('0x3e')](_0x3a62fc[_0xacfc('0x3b')],{'$or':_[_0xacfc('0x2f')](_0x3a62fc[_0xacfc('0x34')],function(_0x5c19e4){var _0x1cfc82={};_0x1cfc82[_0x5c19e4]={'$like':'%'+_0x547956['query'][_0xacfc('0x3d')]+'%'};return _0x1cfc82;})});}_0x3a62fc=_[_0xacfc('0x3e')]({},_0x3a62fc,_0x547956['options']);return _0x14af2b[_0xacfc('0x6f')](_0x3a62fc);}})[_0xacfc('0x27')](function(_0x4c163c){if(_0x4c163c){_0x4fe4c3=_0x4c163c[_0xacfc('0x36')];if(!_0x547956[_0xacfc('0x31')]['hasOwnProperty'](_0xacfc('0x39'))){_0x3a62fc[_0xacfc('0x1e')]=qs[_0xacfc('0x1e')](_0x547956['query'][_0xacfc('0x1e')]);_0x3a62fc[_0xacfc('0x20')]=qs[_0xacfc('0x20')](_0x547956[_0xacfc('0x31')]['offset']);}return _0x14af2b[_0xacfc('0x6f')](_0x3a62fc);}})[_0xacfc('0x27')](function(_0x4d5602){if(_0x4d5602){return _0x4d5602?{'count':_0x4fe4c3,'rows':_0x4d5602}:null;}})['then'](respondWithResult(_0x29781a,null))[_0xacfc('0x49')](handleError(_0x29781a,null));}; \ No newline at end of file +var _0x8211=['create','sequelize','transaction','files','directory','join','root','mode','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','unlinkSync','rmdirSync','Sequelize','addSound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','ValidationError','message','findOne','id2','Sound','getSounds','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','catch','params','include','body','find'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x8211,0x8a));var _0x1821=function(_0x3095b6,_0x156a0e){_0x3095b6=_0x3095b6-0x0;var _0x5400d0=_0x8211[_0x3095b6];return _0x5400d0;};'use strict';var emlformat=require(_0x1821('0x0'));var rimraf=require(_0x1821('0x1'));var zipdir=require(_0x1821('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1821('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1821('0x4'));var util=require(_0x1821('0x5'));var path=require('path');var sox=require(_0x1821('0x6'));var csv=require(_0x1821('0x7'));var ejs=require(_0x1821('0x8'));var fs=require('fs');var fs_extra=require(_0x1821('0x9'));var _=require(_0x1821('0xa'));var squel=require(_0x1821('0xb'));var crypto=require(_0x1821('0xc'));var jsforce=require(_0x1821('0xd'));var deskjs=require(_0x1821('0xe'));var toCsv=require(_0x1821('0x7'));var querystring=require(_0x1821('0xf'));var Papa=require(_0x1821('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1821('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1821('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1821('0x13'));var db=require(_0x1821('0x14'))['db'];function respondWithStatusCode(_0x7c08d3,_0x3775c5){_0x3775c5=_0x3775c5||0xcc;return function(_0x1f06d9){if(_0x1f06d9){return _0x7c08d3['sendStatus'](_0x3775c5);}return _0x7c08d3[_0x1821('0x15')](_0x3775c5)[_0x1821('0x16')]();};}function respondWithResult(_0x22122e,_0x479153){_0x479153=_0x479153||0xc8;return function(_0x3a83c9){if(_0x3a83c9){return _0x22122e['status'](_0x479153)[_0x1821('0x17')](_0x3a83c9);}};}function respondWithFilteredResult(_0x53fadd,_0x255a13){return function(_0x3420a6){if(_0x3420a6){var _0x2eb33e=typeof _0x255a13[_0x1821('0x18')]==='undefined'&&typeof _0x255a13[_0x1821('0x19')]===_0x1821('0x1a');var _0x44acb9=_0x3420a6[_0x1821('0x1b')];var _0x3b271a=_0x2eb33e?0x0:_0x255a13[_0x1821('0x18')];var _0x2df967=_0x2eb33e?_0x3420a6[_0x1821('0x1b')]:_0x255a13[_0x1821('0x18')]+_0x255a13[_0x1821('0x19')];var _0x3301bd;if(_0x2df967>=_0x44acb9){_0x2df967=_0x44acb9;_0x3301bd=0xc8;}else{_0x3301bd=0xce;}_0x53fadd['status'](_0x3301bd);return _0x53fadd['set'](_0x1821('0x1c'),_0x3b271a+'-'+_0x2df967+'/'+_0x44acb9)[_0x1821('0x17')](_0x3420a6);}return null;};}function patchUpdates(_0x9774b2){return function(_0x2b2089){try{jsonpatch[_0x1821('0x1d')](_0x2b2089,_0x9774b2,!![]);}catch(_0x2658d7){return BPromise[_0x1821('0x1e')](_0x2658d7);}return _0x2b2089[_0x1821('0x1f')]();};}function saveUpdates(_0x33f3a7,_0x585569){return function(_0x1b82a8){if(_0x1b82a8){return _0x1b82a8[_0x1821('0x20')](_0x33f3a7)[_0x1821('0x21')](function(_0x26a8f5){return _0x26a8f5;});}return null;};}function removeEntity(_0x47511a,_0x5a4e6c){return function(_0x51e9e8){if(_0x51e9e8){return _0x51e9e8['destroy']()[_0x1821('0x21')](function(){var _0x9541e1=_0x51e9e8[_0x1821('0x22')]({'plain':!![]});var _0x117d4e=_0x1821('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x117d4e,'resourceId':_0x9541e1['id']}})[_0x1821('0x21')](function(){return _0x51e9e8;});})[_0x1821('0x21')](function(){_0x47511a['status'](0xcc)[_0x1821('0x16')]();});}};}function handleEntityNotFound(_0x381690,_0x133eb0){return function(_0x69aba6){if(!_0x69aba6){_0x381690['sendStatus'](0x194);}return _0x69aba6;};}function handleError(_0xcce7a8,_0x1cab5f){_0x1cab5f=_0x1cab5f||0x1f4;return function(_0x437c5e){logger[_0x1821('0x24')](_0x437c5e[_0x1821('0x25')]);if(_0x437c5e[_0x1821('0x26')]){delete _0x437c5e[_0x1821('0x26')];}_0xcce7a8[_0x1821('0x15')](_0x1cab5f)[_0x1821('0x27')](_0x437c5e);};}exports[_0x1821('0x28')]=function(_0x39533c,_0x3c0ad9){var _0x2e4336={},_0x125b4d={},_0x498166={'count':0x0,'rows':[]};var _0x1042f8=_['map'](db[_0x1821('0x29')][_0x1821('0x2a')],function(_0x37b2d8){return{'name':_0x37b2d8[_0x1821('0x2b')],'type':_0x37b2d8[_0x1821('0x2c')][_0x1821('0x2d')]};});_0x125b4d['model']=_['map'](_0x1042f8,'name');_0x125b4d[_0x1821('0x2e')]=_[_0x1821('0x2f')](_0x39533c['query']);_0x125b4d[_0x1821('0x30')]=_['intersection'](_0x125b4d['model'],_0x125b4d['query']);_0x2e4336[_0x1821('0x31')]=_[_0x1821('0x32')](_0x125b4d[_0x1821('0x33')],qs[_0x1821('0x34')](_0x39533c[_0x1821('0x2e')]['fields']));_0x2e4336['attributes']=_0x2e4336[_0x1821('0x31')][_0x1821('0x35')]?_0x2e4336[_0x1821('0x31')]:_0x125b4d[_0x1821('0x33')];if(!_0x39533c[_0x1821('0x2e')][_0x1821('0x36')](_0x1821('0x37'))){_0x2e4336['limit']=qs['limit'](_0x39533c[_0x1821('0x2e')][_0x1821('0x19')]);_0x2e4336['offset']=qs[_0x1821('0x18')](_0x39533c[_0x1821('0x2e')][_0x1821('0x18')]);}_0x2e4336[_0x1821('0x38')]=qs[_0x1821('0x39')](_0x39533c[_0x1821('0x2e')]['sort']);delete _0x39533c[_0x1821('0x2e')][_0x1821('0x39')];_0x2e4336[_0x1821('0x3a')]=qs[_0x1821('0x30')](_[_0x1821('0x3b')](_0x39533c['query'],_0x125b4d[_0x1821('0x30')]),_0x1042f8);if(_0x39533c[_0x1821('0x2e')][_0x1821('0x3c')]){_0x2e4336[_0x1821('0x3a')]=_[_0x1821('0x3d')](_0x2e4336[_0x1821('0x3a')],{'$or':_[_0x1821('0x3e')](_0x1042f8,function(_0x261880){if(_0x261880[_0x1821('0x2c')]!=='VIRTUAL'){var _0x49e96c={};_0x49e96c[_0x261880[_0x1821('0x26')]]={'$like':'%'+_0x39533c['query'][_0x1821('0x3c')]+'%'};return _0x49e96c;}})});}_0x2e4336=_[_0x1821('0x3d')]({},_0x2e4336,_0x39533c[_0x1821('0x3f')]);var _0x3a1333={'where':_0x2e4336['where']};return db['VoiceMusicOnHold'][_0x1821('0x1b')](_0x3a1333)['then'](function(_0x5d1916){_0x498166[_0x1821('0x1b')]=_0x5d1916;if(_0x39533c[_0x1821('0x2e')][_0x1821('0x40')]){_0x2e4336['include']=[{'all':!![]}];}return db[_0x1821('0x29')]['findAll'](_0x2e4336);})['then'](function(_0x11f83a){_0x498166['rows']=_0x11f83a;return _0x498166;})['then'](respondWithFilteredResult(_0x3c0ad9,_0x2e4336))[_0x1821('0x41')](handleError(_0x3c0ad9,null));};exports['show']=function(_0x229fa5,_0x4ef628){var _0x428759={'raw':![],'where':{'id':_0x229fa5[_0x1821('0x42')]['id']}},_0x4c38d7={};_0x4c38d7[_0x1821('0x33')]=_['keys'](db['VoiceMusicOnHold'][_0x1821('0x2a')]);_0x4c38d7[_0x1821('0x2e')]=_[_0x1821('0x2f')](_0x229fa5[_0x1821('0x2e')]);_0x4c38d7[_0x1821('0x30')]=_[_0x1821('0x32')](_0x4c38d7['model'],_0x4c38d7[_0x1821('0x2e')]);_0x428759['attributes']=_[_0x1821('0x32')](_0x4c38d7['model'],qs[_0x1821('0x34')](_0x229fa5[_0x1821('0x2e')][_0x1821('0x34')]));_0x428759[_0x1821('0x31')]=_0x428759[_0x1821('0x31')]['length']?_0x428759[_0x1821('0x31')]:_0x4c38d7[_0x1821('0x33')];if(_0x229fa5['query']['includeAll']){_0x428759[_0x1821('0x43')]=[{'all':!![]}];}_0x428759=_[_0x1821('0x3d')]({},_0x428759,_0x229fa5[_0x1821('0x3f')]);return db[_0x1821('0x29')]['find'](_0x428759)[_0x1821('0x21')](handleEntityNotFound(_0x4ef628,null))['then'](respondWithResult(_0x4ef628,null))[_0x1821('0x41')](handleError(_0x4ef628,null));};exports[_0x1821('0x20')]=function(_0x5c29a4,_0x5400cd){if(_0x5c29a4[_0x1821('0x44')]['id']){delete _0x5c29a4[_0x1821('0x44')]['id'];}return db['VoiceMusicOnHold'][_0x1821('0x45')]({'where':{'id':_0x5c29a4[_0x1821('0x42')]['id']}})[_0x1821('0x21')](handleEntityNotFound(_0x5400cd,null))[_0x1821('0x21')](saveUpdates(_0x5c29a4[_0x1821('0x44')],null))[_0x1821('0x21')](respondWithResult(_0x5400cd,null))[_0x1821('0x41')](handleError(_0x5400cd,null));};exports[_0x1821('0x46')]=function(_0x3966e7,_0x3fc5ad,_0x417747){return db[_0x1821('0x47')][_0x1821('0x48')](function(_0x3ddfa7){if(_0x3966e7[_0x1821('0x44')]['mode']===_0x1821('0x49')){_0x3966e7['body'][_0x1821('0x4a')]=path[_0x1821('0x4b')](config[_0x1821('0x4c')],'server/files/moh',_0x3966e7['body'][_0x1821('0x26')]);}return db[_0x1821('0x29')][_0x1821('0x46')](_0x3966e7['body'],{'transaction':_0x3ddfa7})[_0x1821('0x21')](function(_0x59e3d4){if(_0x3966e7[_0x1821('0x44')][_0x1821('0x4d')]===_0x1821('0x49')){fs['mkdirSync'](_0x59e3d4[_0x1821('0x4a')],parseInt(_0x1821('0x4e'),0x8));}var _0x386ac2=_0x3966e7[_0x1821('0x4f')][_0x1821('0x22')]({'plain':!![]});if(!_0x386ac2)throw new Error(_0x1821('0x50'));if(_0x386ac2['role']==='user'){var _0x19904d=_0x59e3d4[_0x1821('0x22')]({'plain':!![]});return db[_0x1821('0x51')][_0x1821('0x45')]({'where':{'name':_0x1821('0x23'),'userProfileId':_0x386ac2[_0x1821('0x52')]},'raw':!![]})['then'](function(_0x43c452){if(_0x43c452&&_0x43c452['autoAssociation']===0x0){return db[_0x1821('0x53')][_0x1821('0x46')]({'name':_0x19904d[_0x1821('0x26')],'resourceId':_0x19904d['id'],'type':_0x43c452['name'],'sectionId':_0x43c452['id']},{})[_0x1821('0x21')](function(){return _0x59e3d4;});}else{return _0x59e3d4;}})[_0x1821('0x41')](function(_0x28843e){logger[_0x1821('0x24')](_0x1821('0x54'),_0x28843e);});}return _0x59e3d4;});})[_0x1821('0x21')](respondWithResult(_0x3fc5ad,0xc9))[_0x1821('0x41')](handleError(_0x3fc5ad,null));};exports[_0x1821('0x55')]=function(_0x4eae12,_0x395ee2,_0x236927){var _0x3b98df;return db[_0x1821('0x29')]['find']({'where':{'id':_0x4eae12[_0x1821('0x42')]['id']}})[_0x1821('0x21')](function(_0x1d9cf2){if(_0x1d9cf2){return db[_0x1821('0x47')][_0x1821('0x48')](function(_0x3df7c8){return _0x1d9cf2[_0x1821('0x55')]({'transaction':_0x3df7c8,'raw':!![]})['then'](function(_0x336d3d){if(_0x336d3d['directory']){fs['readdirSync'](_0x336d3d[_0x1821('0x4a')])['forEach'](function(_0x3eb9b5){fs[_0x1821('0x56')](path['join'](_0x336d3d[_0x1821('0x4a')],_0x3eb9b5));});fs[_0x1821('0x57')](_0x336d3d[_0x1821('0x4a')]);}return _0x336d3d;});})[_0x1821('0x41')](function(_0x2ee456){throw new db[(_0x1821('0x58'))]['ValidationError'](_0x2ee456['message']);});}})[_0x1821('0x21')](handleEntityNotFound(_0x395ee2,null))['then'](removeEntity(_0x395ee2,null))[_0x1821('0x41')](handleError(_0x395ee2,null));};exports[_0x1821('0x59')]=function(_0x5e306d,_0x3fe17e,_0x14923d){return db[_0x1821('0x47')][_0x1821('0x48')](function(_0x3cfbb7){var _0x3717c8;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5e306d[_0x1821('0x42')]['id']}})[_0x1821('0x21')](function(_0x1a4009){if(_0x1a4009){_0x3717c8=_0x1a4009;return _0x1a4009['addSound'](_0x5e306d[_0x1821('0x44')]['id'],{'transaction':_0x3cfbb7});}})[_0x1821('0x21')](function(_0x143ed5){if(_0x143ed5){return db['Sound']['findOne']({'where':{'id':_0x5e306d['body']['id']},'attributes':['id',_0x1821('0x26'),_0x1821('0x5a'),_0x1821('0x5b'),_0x1821('0x5c')],'raw':!![]});}})[_0x1821('0x21')](function(_0x2a2a37){if(_0x2a2a37){var _0x558626=path[_0x1821('0x4b')](config[_0x1821('0x4c')],_0x1821('0x5d'),util[_0x1821('0x5e')](_0x1821('0x5f'),path['basename'](_0x2a2a37[_0x1821('0x5a')],path[_0x1821('0x60')](_0x2a2a37['save_name'])),_0x2a2a37[_0x1821('0x5b')]));var _0x377645=path[_0x1821('0x4b')](config[_0x1821('0x4c')],'server/files/moh',_0x3717c8[_0x1821('0x26')],util[_0x1821('0x5e')]('%s.%s',_0x2a2a37[_0x1821('0x26')],_0x2a2a37[_0x1821('0x5b')]));fs[_0x1821('0x61')](_0x558626,_0x377645);return _0x2a2a37;}})[_0x1821('0x41')](function(_0x3396fe){throw new db['Sequelize'][(_0x1821('0x62'))](_0x3396fe[_0x1821('0x63')]);});})[_0x1821('0x21')](handleEntityNotFound(_0x3fe17e,null))[_0x1821('0x21')](respondWithResult(_0x3fe17e,0xc9))[_0x1821('0x41')](handleError(_0x3fe17e,null));};exports['removeSound']=function(_0x111a52,_0x5b2adc,_0x59c53d){return db['sequelize']['transaction'](function(_0x1b91ce){var _0x2bce3b;return db[_0x1821('0x29')][_0x1821('0x64')]({'where':{'id':_0x111a52[_0x1821('0x42')]['id']}})[_0x1821('0x21')](handleEntityNotFound(_0x5b2adc,null))['then'](function(_0x26872e){if(_0x26872e){_0x2bce3b=_0x26872e;return _0x26872e['removeSound'](_0x111a52[_0x1821('0x42')]['id2']);}})['then'](function(_0x497c96){if(_0x497c96){return db['Sound'][_0x1821('0x64')]({'where':{'id':_0x111a52['params'][_0x1821('0x65')]},'attributes':['id','name',_0x1821('0x5a'),'converted_format','createdAt'],'raw':!![]});}})[_0x1821('0x21')](function(_0x13288a){if(_0x13288a){fs[_0x1821('0x56')](path['join'](_0x2bce3b[_0x1821('0x4a')],util['format']('%s.%s',_0x13288a[_0x1821('0x26')],_0x13288a[_0x1821('0x5b')])));return _0x13288a;}})[_0x1821('0x41')](function(_0x22f033){throw new db[(_0x1821('0x58'))][(_0x1821('0x62'))](_0x22f033[_0x1821('0x63')]);});})['then'](handleEntityNotFound(_0x5b2adc,null))[_0x1821('0x21')](respondWithStatusCode(_0x5b2adc,0xcc))[_0x1821('0x41')](handleError(_0x5b2adc,null));};exports['getSounds']=function(_0x5676fd,_0x1f41b6,_0x19d5bb){var _0x60c7ab={};var _0x5093f1={};var _0x4449a9;var _0x299ec4;return db[_0x1821('0x29')][_0x1821('0x64')]({'where':{'id':_0x5676fd[_0x1821('0x42')]['id']}})[_0x1821('0x21')](handleEntityNotFound(_0x1f41b6,null))[_0x1821('0x21')](function(_0x22b477){if(_0x22b477){_0x4449a9=_0x22b477;_0x5093f1['model']=_[_0x1821('0x2f')](db[_0x1821('0x66')][_0x1821('0x2a')]);_0x5093f1[_0x1821('0x2e')]=_[_0x1821('0x2f')](_0x5676fd[_0x1821('0x2e')]);_0x5093f1[_0x1821('0x30')]=_[_0x1821('0x32')](_0x5093f1[_0x1821('0x33')],_0x5093f1[_0x1821('0x2e')]);_0x60c7ab[_0x1821('0x31')]=_[_0x1821('0x32')](_0x5093f1[_0x1821('0x33')],qs[_0x1821('0x34')](_0x5676fd[_0x1821('0x2e')][_0x1821('0x34')]));_0x60c7ab[_0x1821('0x31')]=_0x60c7ab[_0x1821('0x31')]['length']?_0x60c7ab[_0x1821('0x31')]:_0x5093f1[_0x1821('0x33')];_0x60c7ab[_0x1821('0x38')]=qs['sort'](_0x5676fd['query'][_0x1821('0x39')]);_0x60c7ab['where']=qs[_0x1821('0x30')](_[_0x1821('0x3b')](_0x5676fd[_0x1821('0x2e')],_0x5093f1['filters']));if(_0x5676fd[_0x1821('0x2e')][_0x1821('0x3c')]){_0x60c7ab[_0x1821('0x3a')]=_['merge'](_0x60c7ab[_0x1821('0x3a')],{'$or':_[_0x1821('0x3e')](_0x60c7ab['attributes'],function(_0x3df853){var _0x173095={};_0x173095[_0x3df853]={'$like':'%'+_0x5676fd[_0x1821('0x2e')][_0x1821('0x3c')]+'%'};return _0x173095;})});}_0x60c7ab=_[_0x1821('0x3d')]({},_0x60c7ab,_0x5676fd[_0x1821('0x3f')]);return _0x4449a9['getSounds'](_0x60c7ab);}})[_0x1821('0x21')](function(_0x277dae){if(_0x277dae){_0x299ec4=_0x277dae[_0x1821('0x35')];if(!_0x5676fd[_0x1821('0x2e')]['hasOwnProperty'](_0x1821('0x37'))){_0x60c7ab[_0x1821('0x19')]=qs[_0x1821('0x19')](_0x5676fd[_0x1821('0x2e')][_0x1821('0x19')]);_0x60c7ab[_0x1821('0x18')]=qs['offset'](_0x5676fd[_0x1821('0x2e')][_0x1821('0x18')]);}return _0x4449a9[_0x1821('0x67')](_0x60c7ab);}})[_0x1821('0x21')](function(_0x1c3c32){if(_0x1c3c32){return _0x1c3c32?{'count':_0x299ec4,'rows':_0x1c3c32}:null;}})[_0x1821('0x21')](respondWithResult(_0x1f41b6,null))[_0x1821('0x41')](handleError(_0x1f41b6,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0696d9f..437d088 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 _0x302c=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x11e6c0,_0x429739){var _0xc74341=function(_0x4c1c68){while(--_0x4c1c68){_0x11e6c0['push'](_0x11e6c0['shift']());}};_0xc74341(++_0x429739);}(_0x302c,0x1d9));var _0xc302=function(_0x2923f3,_0x300907){_0x2923f3=_0x2923f3-0x0;var _0x7edb9e=_0x302c[_0x2923f3];return _0x7edb9e;};'use strict';var _=require('lodash');var util=require(_0xc302('0x0'));var logger=require(_0xc302('0x1'))(_0xc302('0x2'));var moment=require(_0xc302('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc302('0x4'));var rimraf=require(_0xc302('0x5'));var config=require(_0xc302('0x6'));var attributes=require(_0xc302('0x7'));module[_0xc302('0x8')]=function(_0x3d5619,_0x45f815){return _0x3d5619[_0xc302('0x9')](_0xc302('0xa'),attributes,{'tableName':_0xc302('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc3e=['moment','request-promise','path','exports','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0x1e840c,_0x4f45e2){var _0x24ed9a=function(_0xd1fc30){while(--_0xd1fc30){_0x1e840c['push'](_0x1e840c['shift']());}};_0x24ed9a(++_0x4f45e2);}(_0xfc3e,0x1eb));var _0xefc3=function(_0x4ac5d3,_0x2e5f68){_0x4ac5d3=_0x4ac5d3-0x0;var _0x1ab556=_0xfc3e[_0x4ac5d3];return _0x1ab556;};'use strict';var _=require(_0xefc3('0x0'));var util=require(_0xefc3('0x1'));var logger=require(_0xefc3('0x2'))(_0xefc3('0x3'));var moment=require(_0xefc3('0x4'));var BPromise=require('bluebird');var rp=require(_0xefc3('0x5'));var fs=require('fs');var path=require(_0xefc3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xefc3('0x7')]=function(_0xb02116,_0x7392ec){return _0xb02116['define']('VoiceMusicOnHold',attributes,{'tableName':_0xefc3('0x8'),'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 1aae6b6..daf4fa2 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x227148,_0x2af92d){var _0x3be280=function(_0x5af64){while(--_0x5af64){_0x227148['push'](_0x227148['shift']());}};_0x3be280(++_0x2af92d);}(_0xe706,0xa3));var _0x6e70=function(_0x4b48af,_0x4ad5b9){_0x4b48af=_0x4b48af-0x0;var _0x64ac44=_0xe706[_0x4b48af];return _0x64ac44;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x3390df,_0x1a7605){var _0x1e7b87=function(_0x26032b){while(--_0x26032b){_0x3390df['push'](_0x3390df['shift']());}};_0x1e7b87(++_0x1a7605);}(_0xedd9,0xfc));var _0x9edd=function(_0xc7d998,_0x48f45b){_0xc7d998=_0xc7d998-0x0;var _0x17fda9=_0xedd9[_0xc7d998];return _0x17fda9;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 10926bc..6f159dd 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 _0x590c=['/:id/teams','post','addAgents','addTeams','put','/:id','update','delete','destroy','removeAgents','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents'];(function(_0x52a07c,_0x8285b){var _0x3256b8=function(_0x3b0e22){while(--_0x3b0e22){_0x52a07c['push'](_0x52a07c['shift']());}};_0x3256b8(++_0x8285b);}(_0x590c,0x80));var _0xc590=function(_0x35d1f9,_0xee484c){_0x35d1f9=_0x35d1f9-0x0;var _0x2d7877=_0x590c[_0x35d1f9];return _0x2d7877;};'use strict';var multer=require(_0xc590('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc590('0x1'));var express=require(_0xc590('0x2'));var router=express[_0xc590('0x3')]();var fs_extra=require(_0xc590('0x4'));var auth=require(_0xc590('0x5'));var interaction=require(_0xc590('0x6'));var config=require(_0xc590('0x7'));var controller=require(_0xc590('0x8'));router[_0xc590('0x9')]('/',auth[_0xc590('0xa')](),controller[_0xc590('0xb')]);router[_0xc590('0x9')](_0xc590('0xc'),auth[_0xc590('0xa')](),controller[_0xc590('0xd')]);router['get']('/:id',auth[_0xc590('0xa')](),controller[_0xc590('0xe')]);router['get'](_0xc590('0xf'),auth[_0xc590('0xa')](),controller[_0xc590('0x10')]);router[_0xc590('0x9')](_0xc590('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xc590('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc590('0xf'),auth[_0xc590('0xa')](),controller[_0xc590('0x13')]);router[_0xc590('0x12')](_0xc590('0x11'),auth[_0xc590('0xa')](),controller[_0xc590('0x14')]);router[_0xc590('0x15')](_0xc590('0x16'),auth[_0xc590('0xa')](),controller[_0xc590('0x17')]);router[_0xc590('0x18')](_0xc590('0x16'),auth[_0xc590('0xa')](),controller[_0xc590('0x19')]);router[_0xc590('0x18')](_0xc590('0xf'),auth[_0xc590('0xa')](),controller[_0xc590('0x1a')]);router[_0xc590('0x18')](_0xc590('0x11'),auth[_0xc590('0xa')](),controller[_0xc590('0x1b')]);module[_0xc590('0x1c')]=router; \ No newline at end of file +var _0x5075=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','index','get','isAuthenticated','describe','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put','/:id','update','delete','destroy','removeAgents','removeTeams','multer'];(function(_0x54ebd7,_0xafc898){var _0x43f26d=function(_0x28bcce){while(--_0x28bcce){_0x54ebd7['push'](_0x54ebd7['shift']());}};_0x43f26d(++_0xafc898);}(_0x5075,0x73));var _0x5507=function(_0x176e9e,_0x3dfe11){_0x176e9e=_0x176e9e-0x0;var _0x1b675f=_0x5075[_0x176e9e];return _0x1b675f;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5507('0xa')]);router[_0x5507('0xb')]('/describe',auth[_0x5507('0xc')](),controller[_0x5507('0xd')]);router[_0x5507('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xb')](_0x5507('0xf'),auth[_0x5507('0xc')](),controller['getAgents']);router[_0x5507('0xb')](_0x5507('0x10'),auth['isAuthenticated'](),controller[_0x5507('0x11')]);router[_0x5507('0x12')]('/',auth['isAuthenticated'](),controller[_0x5507('0x13')]);router[_0x5507('0x12')](_0x5507('0xf'),auth[_0x5507('0xc')](),controller[_0x5507('0x14')]);router[_0x5507('0x12')]('/:id/teams',auth[_0x5507('0xc')](),controller[_0x5507('0x15')]);router[_0x5507('0x16')](_0x5507('0x17'),auth['isAuthenticated'](),controller[_0x5507('0x18')]);router[_0x5507('0x19')](_0x5507('0x17'),auth[_0x5507('0xc')](),controller[_0x5507('0x1a')]);router[_0x5507('0x19')](_0x5507('0xf'),auth[_0x5507('0xc')](),controller[_0x5507('0x1b')]);router[_0x5507('0x19')](_0x5507('0x10'),auth[_0x5507('0xc')](),controller[_0x5507('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index e1faa91..e239d9e 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 _0x8fd5=['name','STRING','VIRTUAL','system-','getDataValue'];(function(_0x213ba1,_0x54d148){var _0x5a6ff5=function(_0x2ec3de){while(--_0x2ec3de){_0x213ba1['push'](_0x213ba1['shift']());}};_0x5a6ff5(++_0x54d148);}(_0x8fd5,0x1af));var _0x58fd=function(_0x22fee5,_0x3b0609){_0x22fee5=_0x22fee5-0x0;var _0x3b96f3=_0x8fd5[_0x22fee5];return _0x3b96f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x58fd('0x0')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x58fd('0x1')],'get':function(_0x4357bb){return _0x58fd('0x2')+this[_0x58fd('0x3')](_0x58fd('0x4'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x58fd('0x0')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfb99=['exports','STRING','name','VIRTUAL','system-','getDataValue','sequelize'];(function(_0x583bcf,_0x3d6ed3){var _0x33c0c4=function(_0x19455d){while(--_0x19455d){_0x583bcf['push'](_0x583bcf['shift']());}};_0x33c0c4(++_0x3d6ed3);}(_0xfb99,0xd1));var _0x9fb9=function(_0x294b68,_0x3f0093){_0x294b68=_0x294b68-0x0;var _0x4b104b=_0xfb99[_0x294b68];return _0x4b104b;};'use strict';var Sequelize=require(_0x9fb9('0x0'));module[_0x9fb9('0x1')]={'name':{'type':Sequelize[_0x9fb9('0x2')],'allowNull':![],'unique':_0x9fb9('0x3')},'prefix':{'type':Sequelize[_0x9fb9('0x4')],'get':function(_0x1797a3){return _0x9fb9('0x5')+this[_0x9fb9('0x6')](_0x9fb9('0x3'))+'-';}},'description':{'type':Sequelize[_0x9fb9('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ac72337..ae49ae7 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 _0x77e6=['send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','catch','describe','create','sequelize','transaction','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','description','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','findById','addAgents','body','ids','omit','spread','emit','userVoicePrefix:save','userVoicePrefix:remove','findOne','User','getAgents','hasOwnProperty','getTeams','Team','addTeams','Agents','online','flatMap','TeamVoicePrefix','upsert','each','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','VoicePrefixes','UserProfileResource','destroy','error','name'];(function(_0x5d853b,_0x54e61e){var _0x549ce8=function(_0x24d474){while(--_0x24d474){_0x5d853b['push'](_0x5d853b['shift']());}};_0x549ce8(++_0x54e61e);}(_0x77e6,0x1a6));var _0x677e=function(_0x38f418,_0x7fa32d){_0x38f418=_0x38f418-0x0;var _0x57ad33=_0x77e6[_0x38f418];return _0x57ad33;};'use strict';var emlformat=require(_0x677e('0x0'));var rimraf=require(_0x677e('0x1'));var zipdir=require(_0x677e('0x2'));var jsonpatch=require(_0x677e('0x3'));var rp=require(_0x677e('0x4'));var moment=require(_0x677e('0x5'));var BPromise=require(_0x677e('0x6'));var Mustache=require(_0x677e('0x7'));var util=require('util');var path=require(_0x677e('0x8'));var sox=require(_0x677e('0x9'));var csv=require('to-csv');var ejs=require(_0x677e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x677e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x677e('0xc'));var deskjs=require(_0x677e('0xd'));var toCsv=require(_0x677e('0xe'));var querystring=require(_0x677e('0xf'));var Papa=require('papaparse');var Redis=require(_0x677e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x677e('0x11'));var as=require(_0x677e('0x12'));var hardwareService=require(_0x677e('0x13'));var logger=require(_0x677e('0x14'))(_0x677e('0x15'));var utils=require(_0x677e('0x16'));var config=require(_0x677e('0x17'));var licenseUtil=require(_0x677e('0x18'));var db=require(_0x677e('0x19'))['db'];config[_0x677e('0x1a')]=_[_0x677e('0x1b')](config[_0x677e('0x1a')],{'host':_0x677e('0x1c'),'port':0x18eb});var socket=require(_0x677e('0x1d'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x213a50,_0x1dbe16){_0x1dbe16=_0x1dbe16||0xcc;return function(_0x105c88){if(_0x105c88){return _0x213a50[_0x677e('0x1e')](_0x1dbe16);}return _0x213a50[_0x677e('0x1f')](_0x1dbe16)[_0x677e('0x20')]();};}function respondWithResult(_0x24c9eb,_0xe88242){_0xe88242=_0xe88242||0xc8;return function(_0x251069){if(_0x251069){return _0x24c9eb[_0x677e('0x1f')](_0xe88242)[_0x677e('0x21')](_0x251069);}};}function respondWithFilteredResult(_0xe4d960,_0x49d428){return function(_0x1c5124){if(_0x1c5124){var _0x2ef2bf=typeof _0x49d428[_0x677e('0x22')]===_0x677e('0x23')&&typeof _0x49d428[_0x677e('0x24')]===_0x677e('0x23');var _0x52f65d=_0x1c5124[_0x677e('0x25')];var _0x4bfbb6=_0x2ef2bf?0x0:_0x49d428[_0x677e('0x22')];var _0x267aac=_0x2ef2bf?_0x1c5124[_0x677e('0x25')]:_0x49d428['offset']+_0x49d428[_0x677e('0x24')];var _0x1a6122;if(_0x267aac>=_0x52f65d){_0x267aac=_0x52f65d;_0x1a6122=0xc8;}else{_0x1a6122=0xce;}_0xe4d960[_0x677e('0x1f')](_0x1a6122);return _0xe4d960[_0x677e('0x26')](_0x677e('0x27'),_0x4bfbb6+'-'+_0x267aac+'/'+_0x52f65d)[_0x677e('0x21')](_0x1c5124);}return null;};}function patchUpdates(_0x3a7895){return function(_0x52ee8b){try{jsonpatch['apply'](_0x52ee8b,_0x3a7895,!![]);}catch(_0x52d915){return BPromise[_0x677e('0x28')](_0x52d915);}return _0x52ee8b[_0x677e('0x29')]();};}function saveUpdates(_0x31a1e4,_0x540d0e){return function(_0x424e5d){if(_0x424e5d){return _0x424e5d[_0x677e('0x2a')](_0x31a1e4)[_0x677e('0x2b')](function(_0x42f2b8){return _0x42f2b8;});}return null;};}function removeEntity(_0x2c51d3,_0x3f0646){return function(_0x5e5397){if(_0x5e5397){return _0x5e5397['destroy']()[_0x677e('0x2b')](function(){var _0x184f68=_0x5e5397['get']({'plain':!![]});var _0x51e39d=_0x677e('0x2c');return db[_0x677e('0x2d')][_0x677e('0x2e')]({'where':{'type':_0x51e39d,'resourceId':_0x184f68['id']}})[_0x677e('0x2b')](function(){return _0x5e5397;});})[_0x677e('0x2b')](function(){_0x2c51d3['status'](0xcc)[_0x677e('0x20')]();});}};}function handleEntityNotFound(_0x2a6033,_0xeca8e2){return function(_0x1e2694){if(!_0x1e2694){_0x2a6033[_0x677e('0x1e')](0x194);}return _0x1e2694;};}function handleError(_0x2bd6fb,_0x9179a0){_0x9179a0=_0x9179a0||0x1f4;return function(_0x10eb66){logger[_0x677e('0x2f')](_0x10eb66['stack']);if(_0x10eb66[_0x677e('0x30')]){delete _0x10eb66[_0x677e('0x30')];}_0x2bd6fb[_0x677e('0x1f')](_0x9179a0)[_0x677e('0x31')](_0x10eb66);};}exports[_0x677e('0x32')]=function(_0x16f516,_0x34bb3d){var _0x65331={},_0x3b875f={},_0x1d9756={'count':0x0,'rows':[]};var _0x4d0c01=_[_0x677e('0x33')](db[_0x677e('0x34')][_0x677e('0x35')],function(_0x2570b9){return{'name':_0x2570b9[_0x677e('0x36')],'type':_0x2570b9[_0x677e('0x37')]['key']};});_0x3b875f[_0x677e('0x38')]=_[_0x677e('0x33')](_0x4d0c01,_0x677e('0x30'));_0x3b875f['query']=_[_0x677e('0x39')](_0x16f516[_0x677e('0x3a')]);_0x3b875f[_0x677e('0x3b')]=_[_0x677e('0x3c')](_0x3b875f[_0x677e('0x38')],_0x3b875f['query']);_0x65331[_0x677e('0x3d')]=_[_0x677e('0x3c')](_0x3b875f[_0x677e('0x38')],qs[_0x677e('0x3e')](_0x16f516['query'][_0x677e('0x3e')]));_0x65331[_0x677e('0x3d')]=_0x65331[_0x677e('0x3d')]['length']?_0x65331['attributes']:_0x3b875f[_0x677e('0x38')];if(!_0x16f516[_0x677e('0x3a')]['hasOwnProperty'](_0x677e('0x3f'))){_0x65331[_0x677e('0x24')]=qs['limit'](_0x16f516['query'][_0x677e('0x24')]);_0x65331[_0x677e('0x22')]=qs['offset'](_0x16f516['query'][_0x677e('0x22')]);}_0x65331[_0x677e('0x40')]=qs[_0x677e('0x41')](_0x16f516['query'][_0x677e('0x41')]);_0x65331[_0x677e('0x42')]=qs[_0x677e('0x3b')](_[_0x677e('0x43')](_0x16f516[_0x677e('0x3a')],_0x3b875f['filters']),_0x4d0c01);if(_0x16f516['query'][_0x677e('0x44')]){_0x65331[_0x677e('0x42')]=_[_0x677e('0x45')](_0x65331[_0x677e('0x42')],{'$or':_[_0x677e('0x33')](_0x4d0c01,function(_0x2f8ebb){if(_0x2f8ebb[_0x677e('0x37')]!==_0x677e('0x46')){var _0x78202e={};_0x78202e[_0x2f8ebb[_0x677e('0x30')]]={'$like':'%'+_0x16f516['query']['filter']+'%'};return _0x78202e;}})});}_0x65331=_[_0x677e('0x45')]({},_0x65331,_0x16f516[_0x677e('0x47')]);var _0x5abab2={'where':_0x65331[_0x677e('0x42')]};return db['VoicePrefix'][_0x677e('0x25')](_0x5abab2)[_0x677e('0x2b')](function(_0x283aaa){_0x1d9756[_0x677e('0x25')]=_0x283aaa;if(_0x16f516[_0x677e('0x3a')][_0x677e('0x48')]){_0x65331['include']=[{'all':!![]}];}return db[_0x677e('0x34')][_0x677e('0x49')](_0x65331);})[_0x677e('0x2b')](function(_0x33fce2){_0x1d9756[_0x677e('0x4a')]=_0x33fce2;return _0x1d9756;})[_0x677e('0x2b')](respondWithFilteredResult(_0x34bb3d,_0x65331))['catch'](handleError(_0x34bb3d,null));};exports[_0x677e('0x4b')]=function(_0x5ca3db,_0x3211a9){var _0x2470d0={'raw':![],'where':{'id':_0x5ca3db[_0x677e('0x4c')]['id']}},_0x3609da={};_0x3609da[_0x677e('0x38')]=_[_0x677e('0x39')](db[_0x677e('0x34')][_0x677e('0x35')]);_0x3609da[_0x677e('0x3a')]=_[_0x677e('0x39')](_0x5ca3db['query']);_0x3609da[_0x677e('0x3b')]=_['intersection'](_0x3609da['model'],_0x3609da[_0x677e('0x3a')]);_0x2470d0[_0x677e('0x3d')]=_[_0x677e('0x3c')](_0x3609da[_0x677e('0x38')],qs[_0x677e('0x3e')](_0x5ca3db['query'][_0x677e('0x3e')]));_0x2470d0[_0x677e('0x3d')]=_0x2470d0[_0x677e('0x3d')][_0x677e('0x4d')]?_0x2470d0[_0x677e('0x3d')]:_0x3609da['model'];if(_0x5ca3db[_0x677e('0x3a')][_0x677e('0x48')]){_0x2470d0[_0x677e('0x4e')]=[{'all':!![]}];}_0x2470d0=_['merge']({},_0x2470d0,_0x5ca3db[_0x677e('0x47')]);return db['VoicePrefix'][_0x677e('0x4f')](_0x2470d0)['then'](handleEntityNotFound(_0x3211a9,null))['then'](respondWithResult(_0x3211a9,null))[_0x677e('0x50')](handleError(_0x3211a9,null));};exports[_0x677e('0x2e')]=function(_0x1f767f,_0x3ff832){return db['VoicePrefix'][_0x677e('0x4f')]({'where':{'id':_0x1f767f[_0x677e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ff832,null))[_0x677e('0x2b')](removeEntity(_0x3ff832,null))[_0x677e('0x50')](handleError(_0x3ff832,null));};exports[_0x677e('0x51')]=function(_0x23d4fd,_0x2a362e){return db['VoicePrefix'][_0x677e('0x51')]()['then'](respondWithResult(_0x2a362e,null))['catch'](handleError(_0x2a362e,null));};exports[_0x677e('0x52')]=function(_0x4d826f,_0x1af05b){var _0x2f06e0;return db[_0x677e('0x53')][_0x677e('0x54')](function(_0x410012){return db[_0x677e('0x34')][_0x677e('0x52')](_0x4d826f['body'],{'transaction':_0x410012})['then'](function(_0x56a626){_0x2f06e0=_0x56a626[_0x677e('0x55')]({'plain':!![]});return db[_0x677e('0x56')][_0x677e('0x4f')]({'where':{'id':_0x2f06e0[_0x677e('0x57')]},'raw':!![]})[_0x677e('0x2b')](function(_0x1e59a7){return createVoicePrefixExtensions(_0x2f06e0,_0x1e59a7,_0x410012);});});})['then'](function(){var _0x118fb3=_0x4d826f[_0x677e('0x58')]['get']({'plain':!![]});if(!_0x118fb3)throw new Error(_0x677e('0x59'));if(_0x118fb3['role']===_0x677e('0x58')){var _0x20ae18=_0x2f06e0;return db[_0x677e('0x5a')][_0x677e('0x4f')]({'where':{'name':'VoicePrefixes','userProfileId':_0x118fb3[_0x677e('0x5b')]},'raw':!![]})['then'](function(_0x2cb161){if(_0x2cb161&&_0x2cb161[_0x677e('0x5c')]===0x0){return db[_0x677e('0x2d')][_0x677e('0x52')]({'name':_0x20ae18[_0x677e('0x30')],'resourceId':_0x20ae18['id'],'type':_0x2cb161['name'],'sectionId':_0x2cb161['id']},{})[_0x677e('0x2b')](function(){return _0x2f06e0;});}else{return _0x2f06e0;}})[_0x677e('0x50')](function(_0x3c1e10){logger['error'](_0x677e('0x5d'),_0x3c1e10);throw _0x3c1e10;});}return _0x2f06e0;})[_0x677e('0x2b')](respondWithResult(_0x1af05b,null))[_0x677e('0x50')](handleError(_0x1af05b,null));};function Extension(_0x15fd83,_0x35c3b7,_0x44988b,_0x52cd04){this[_0x677e('0x5e')]='from-sip';this['exten']=_0x15fd83;this[_0x677e('0x5f')]=_0x44988b;this['type']='system';this[_0x677e('0x60')]='Voice\x20Prefix\x20Extension';this[_0x677e('0x61')]=_0x35c3b7;this[_0x677e('0x62')]=_0x52cd04;}function createVoicePrefixExtensions(_0x585c4d,_0x3a1555,_0x100be4){return new BPromise(function(_0x379b92,_0x1f11c1){var _0x26479f=new Extension(formatPrefixName(_0x585c4d[_0x677e('0x63')]),0x1,'NoOp',_0x677e('0x64'));_0x26479f[_0x677e('0x65')]=_0x585c4d['id'];return db[_0x677e('0x56')]['create'](_0x26479f,{'transaction':_0x100be4})[_0x677e('0x2b')](function(_0x1da51f){var _0x32cc95=_0x1da51f[_0x677e('0x55')]({'plain':!![]});var _0x2298c8=_[_0x677e('0x33')](addVoicePrefixExtensions(_0x585c4d,_0x3a1555),function(_0x1bc37f){_0x1bc37f[_0x677e('0x57')]=_0x32cc95['id'];_0x1bc37f['VoicePrefixId']=_0x585c4d['id'];return _0x1bc37f;});return db[_0x677e('0x56')][_0x677e('0x66')](_0x2298c8,{'transaction':_0x100be4})[_0x677e('0x2b')](function(_0x2fa495){if(!_0x2fa495){return _0x1f11c1(_0x677e('0x67'));}else{return _0x379b92(_0x2fa495);}})['catch'](function(_0x6ee13d){return _0x1f11c1(_0x6ee13d);});});;});};function addVoicePrefixExtensions(_0x20e595,_0x3e84ba){var _0x16b622=[];var _0x5b5d34=formatPrefixName(_0x20e595[_0x677e('0x63')]);_0x16b622[_0x677e('0x68')](new Extension(_0x5b5d34,0x2,_0x677e('0x69'),_0x677e('0x6a')+_0x20e595[_0x677e('0x30')]));if(_0x20e595[_0x677e('0x6b')]){_0x16b622[_0x677e('0x68')](new Extension(_0x5b5d34,0x3,_0x677e('0x69'),_0x677e('0x6c')+_0x20e595[_0x677e('0x6b')]));}else{_0x16b622[_0x677e('0x68')](new Extension(_0x5b5d34,0x3,'NoOp','No\x20callerid\x20available'));}_0x16b622[_0x677e('0x68')](new Extension(_0x5b5d34,0x4,_0x677e('0x6d'),_0x3e84ba[_0x677e('0x5e')]+','+_0x677e('0x6e')+(0x8+_0x20e595[_0x677e('0x30')][_0x677e('0x4d')])+'}'+','+0x1));return _0x16b622;}function formatPrefixName(_0x522f82){var _0x10cdb6='_';for(var _0x1a3b1c=0x0;_0x1a3b1c<_0x522f82[_0x677e('0x4d')];_0x1a3b1c++){if(_0x522f82[_0x677e('0x6f')](_0x1a3b1c)=='-'){_0x10cdb6+=_0x522f82[_0x677e('0x6f')](_0x1a3b1c);}else{_0x10cdb6+='['+_0x522f82[_0x677e('0x6f')](_0x1a3b1c)+']';}}_0x10cdb6+='.';return _0x10cdb6;}exports['update']=function(_0x2230b0,_0x5390ee,_0x4b7dca){var _0x36aa6b=_0x2230b0['body'];_0x36aa6b[_0x677e('0x63')]='system-'+_0x36aa6b['name']+'-';return db[_0x677e('0x53')]['transaction'](function(_0x8f3069){return db[_0x677e('0x34')]['update'](_0x36aa6b,{'where':{'id':_0x36aa6b['id']},'transaction':_0x8f3069})[_0x677e('0x2b')](function(){return db[_0x677e('0x56')][_0x677e('0x2e')]({'where':{'VoicePrefixId':_0x36aa6b['id']},'transaction':_0x8f3069})[_0x677e('0x2b')](function(){return db[_0x677e('0x56')][_0x677e('0x4f')]({'where':{'id':_0x36aa6b['VoiceExtensionId']},'raw':!![]})[_0x677e('0x2b')](function(_0x56f918){return createVoicePrefixExtensions(_0x36aa6b,_0x56f918,_0x8f3069);});});});})[_0x677e('0x2b')](function(){return db['VoicePrefix'][_0x677e('0x70')](_0x36aa6b['id']);})[_0x677e('0x2b')](respondWithResult(_0x5390ee,null))[_0x677e('0x50')](handleError(_0x5390ee,null));};exports['addAgents']=function(_0x496dcc,_0x5f2a2a,_0x570fc9){return db[_0x677e('0x34')][_0x677e('0x4f')]({'where':{'id':_0x496dcc[_0x677e('0x4c')]['id']}})[_0x677e('0x2b')](handleEntityNotFound(_0x5f2a2a,null))[_0x677e('0x2b')](function(_0x2f9c58){if(_0x2f9c58){return _0x2f9c58[_0x677e('0x71')](_0x496dcc[_0x677e('0x72')][_0x677e('0x73')],_[_0x677e('0x74')](_0x496dcc[_0x677e('0x72')],['ids','id'])||{})[_0x677e('0x75')](function(_0x358ba9){for(var _0x5b07c5=0x0;_0x5b07c5<_0x496dcc[_0x677e('0x72')][_0x677e('0x73')][_0x677e('0x4d')];_0x5b07c5+=0x1){socket[_0x677e('0x76')](_0x677e('0x77'),{'UserId':Number(_0x496dcc[_0x677e('0x72')][_0x677e('0x73')][_0x5b07c5]),'VoicePrefixId':Number(_0x496dcc[_0x677e('0x4c')]['id'])});}return _0x358ba9;});}})[_0x677e('0x2b')](respondWithResult(_0x5f2a2a,null))['catch'](handleError(_0x5f2a2a,null));};exports['removeAgents']=function(_0x3bc3e3,_0xe2d3e6,_0x353656){return db[_0x677e('0x34')]['find']({'where':{'id':_0x3bc3e3[_0x677e('0x4c')]['id']}})[_0x677e('0x2b')](handleEntityNotFound(_0xe2d3e6,null))[_0x677e('0x2b')](function(_0x5db841){if(_0x5db841){return _0x5db841['removeAgents'](_0x3bc3e3['query'][_0x677e('0x73')])[_0x677e('0x2b')](function(){if(_['isArray'](_0x3bc3e3[_0x677e('0x3a')][_0x677e('0x73')])){for(var _0x164211=0x0;_0x164211<_0x3bc3e3[_0x677e('0x3a')]['ids']['length'];_0x164211+=0x1){socket[_0x677e('0x76')](_0x677e('0x78'),{'UserId':Number(_0x3bc3e3[_0x677e('0x3a')][_0x677e('0x73')][_0x164211]),'VoicePrefixId':Number(_0x3bc3e3['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x3bc3e3[_0x677e('0x3a')][_0x677e('0x73')]),'VoicePrefixId':Number(_0x3bc3e3['params']['id'])});}});}})['then'](respondWithStatusCode(_0xe2d3e6,null))[_0x677e('0x50')](handleError(_0xe2d3e6,null));};exports['getAgents']=function(_0x598aac,_0x3e4d40,_0x42746){var _0x30e13e={};var _0x37617d={};var _0x497df7;var _0x5bc26a;return db['VoicePrefix'][_0x677e('0x79')]({'where':{'id':_0x598aac[_0x677e('0x4c')]['id']}})[_0x677e('0x2b')](handleEntityNotFound(_0x3e4d40,null))[_0x677e('0x2b')](function(_0x1bfd9e){if(_0x1bfd9e){_0x497df7=_0x1bfd9e;_0x37617d[_0x677e('0x38')]=_['keys'](db[_0x677e('0x7a')]['rawAttributes']);_0x37617d['query']=_[_0x677e('0x39')](_0x598aac[_0x677e('0x3a')]);_0x37617d['filters']=_[_0x677e('0x3c')](_0x37617d[_0x677e('0x38')],_0x37617d[_0x677e('0x3a')]);_0x30e13e['attributes']=_['intersection'](_0x37617d[_0x677e('0x38')],qs['fields'](_0x598aac['query'][_0x677e('0x3e')]));_0x30e13e[_0x677e('0x3d')]=_0x30e13e[_0x677e('0x3d')]['length']?_0x30e13e['attributes']:_0x37617d[_0x677e('0x38')];_0x30e13e[_0x677e('0x40')]=qs[_0x677e('0x41')](_0x598aac['query'][_0x677e('0x41')]);_0x30e13e[_0x677e('0x42')]=qs['filters'](_[_0x677e('0x43')](_0x598aac['query'],_0x37617d[_0x677e('0x3b')]));if(_0x598aac[_0x677e('0x3a')]['filter']){_0x30e13e[_0x677e('0x42')]=_[_0x677e('0x45')](_0x30e13e[_0x677e('0x42')],{'$or':_['map'](_0x30e13e['attributes'],function(_0x519da2){var _0x38acdd={};_0x38acdd[_0x519da2]={'$like':'%'+_0x598aac[_0x677e('0x3a')][_0x677e('0x44')]+'%'};return _0x38acdd;})});}_0x30e13e=_[_0x677e('0x45')]({},_0x30e13e,_0x598aac[_0x677e('0x47')]);return _0x497df7[_0x677e('0x7b')](_0x30e13e);}})[_0x677e('0x2b')](function(_0x24a584){if(_0x24a584){_0x5bc26a=_0x24a584[_0x677e('0x4d')];if(!_0x598aac[_0x677e('0x3a')][_0x677e('0x7c')](_0x677e('0x3f'))){_0x30e13e['limit']=qs[_0x677e('0x24')](_0x598aac['query']['limit']);_0x30e13e['offset']=qs[_0x677e('0x22')](_0x598aac[_0x677e('0x3a')][_0x677e('0x22')]);}return _0x497df7['getAgents'](_0x30e13e);}})[_0x677e('0x2b')](function(_0x410a04){if(_0x410a04){return _0x410a04?{'count':_0x5bc26a,'rows':_0x410a04}:null;}})['then'](respondWithResult(_0x3e4d40,null))['catch'](handleError(_0x3e4d40,null));};exports[_0x677e('0x7d')]=function(_0x59cf17,_0x31701e,_0x4b6280){var _0x1cf5a8={};var _0x2171ec={};var _0x4d24ca;var _0x205591;return db[_0x677e('0x34')][_0x677e('0x79')]({'where':{'id':_0x59cf17[_0x677e('0x4c')]['id']}})[_0x677e('0x2b')](handleEntityNotFound(_0x31701e,null))[_0x677e('0x2b')](function(_0x5a4f85){if(_0x5a4f85){_0x4d24ca=_0x5a4f85;_0x2171ec[_0x677e('0x38')]=_[_0x677e('0x39')](db[_0x677e('0x7e')]['rawAttributes']);_0x2171ec['query']=_[_0x677e('0x39')](_0x59cf17[_0x677e('0x3a')]);_0x2171ec[_0x677e('0x3b')]=_['intersection'](_0x2171ec[_0x677e('0x38')],_0x2171ec[_0x677e('0x3a')]);_0x1cf5a8[_0x677e('0x3d')]=_[_0x677e('0x3c')](_0x2171ec['model'],qs[_0x677e('0x3e')](_0x59cf17[_0x677e('0x3a')][_0x677e('0x3e')]));_0x1cf5a8[_0x677e('0x3d')]=_0x1cf5a8['attributes']['length']?_0x1cf5a8[_0x677e('0x3d')]:_0x2171ec[_0x677e('0x38')];_0x1cf5a8['order']=qs[_0x677e('0x41')](_0x59cf17[_0x677e('0x3a')][_0x677e('0x41')]);_0x1cf5a8[_0x677e('0x42')]=qs[_0x677e('0x3b')](_[_0x677e('0x43')](_0x59cf17[_0x677e('0x3a')],_0x2171ec[_0x677e('0x3b')]));if(_0x59cf17[_0x677e('0x3a')][_0x677e('0x44')]){_0x1cf5a8['where']=_[_0x677e('0x45')](_0x1cf5a8[_0x677e('0x42')],{'$or':_[_0x677e('0x33')](_0x1cf5a8[_0x677e('0x3d')],function(_0x39ab73){var _0x54ae47={};_0x54ae47[_0x39ab73]={'$like':'%'+_0x59cf17[_0x677e('0x3a')][_0x677e('0x44')]+'%'};return _0x54ae47;})});}_0x1cf5a8=_['merge']({},_0x1cf5a8,_0x59cf17[_0x677e('0x47')]);return _0x4d24ca[_0x677e('0x7d')](_0x1cf5a8);}})[_0x677e('0x2b')](function(_0x3bfa41){if(_0x3bfa41){_0x205591=_0x3bfa41['length'];if(!_0x59cf17[_0x677e('0x3a')][_0x677e('0x7c')]('nolimit')){_0x1cf5a8[_0x677e('0x24')]=qs[_0x677e('0x24')](_0x59cf17[_0x677e('0x3a')][_0x677e('0x24')]);_0x1cf5a8[_0x677e('0x22')]=qs['offset'](_0x59cf17[_0x677e('0x3a')][_0x677e('0x22')]);}return _0x4d24ca[_0x677e('0x7d')](_0x1cf5a8);}})['then'](function(_0x218773){if(_0x218773){return _0x218773?{'count':_0x205591,'rows':_0x218773}:null;}})[_0x677e('0x2b')](respondWithResult(_0x31701e,null))['catch'](handleError(_0x31701e,null));};exports[_0x677e('0x7f')]=function(_0x169ad3,_0x589b95,_0xfc07b9){var _0x244d15=_0x169ad3[_0x677e('0x72')][_0x677e('0x73')];var _0x3ceb0d;return db[_0x677e('0x7e')]['findAll']({'where':{'id':_0x244d15},'attributes':['id'],'include':[{'model':db[_0x677e('0x7a')],'as':_0x677e('0x80'),'attributes':['id','name',_0x677e('0x81'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1438f2){if(_0x1438f2){_0x3ceb0d=_0x1438f2;var _0x2b7e56=_[_0x677e('0x82')](_0x1438f2,function(_0x281857){var _0x524317=_0x281857['get']({'plain':!![]});return _0x524317[_0x677e('0x80')];});return db[_0x677e('0x34')]['find']({'where':{'id':_0x169ad3[_0x677e('0x4c')]['id']}})[_0x677e('0x2b')](function(_0x7c18c1){return db[_0x677e('0x53')]['transaction'](function(_0x286217){return _0x7c18c1['addTeams'](_0x244d15,{'transaction':_0x286217})[_0x677e('0x2b')](function(){return BPromise['each'](_0x3ceb0d,function(_0x5309c1){return db[_0x677e('0x83')][_0x677e('0x84')]({'TeamId':_0x5309c1['id'],'VoicePrefixId':_0x169ad3[_0x677e('0x4c')]['id']},{'transaction':_0x286217});});})[_0x677e('0x2b')](function(){return BPromise[_0x677e('0x85')](_0x2b7e56,function(_0x15b416){return db[_0x677e('0x86')][_0x677e('0x87')]({'where':{'UserId':_0x15b416['id'],'VoicePrefixId':_0x169ad3[_0x677e('0x4c')]['id']},'transaction':_0x286217});});})['then'](function(){_0x2b7e56[_0x677e('0x88')](function(_0x36680e){socket['emit'](_0x677e('0x77'),{'UserId':_0x36680e['id'],'VoicePrefixId':_0x7c18c1['id']});});});});});}})['then'](respondWithStatusCode(_0x589b95,null))[_0x677e('0x50')](handleError(_0x589b95,null));};exports[_0x677e('0x89')]=function(_0x3ac7bb,_0x4f149a,_0x9d34f1){return db[_0x677e('0x7e')][_0x677e('0x49')]({'where':{'id':_0x3ac7bb[_0x677e('0x3a')][_0x677e('0x73')]},'attributes':['id'],'include':[{'model':db[_0x677e('0x7a')],'as':_0x677e('0x80'),'attributes':['id'],'raw':!![]}]})[_0x677e('0x2b')](handleEntityNotFound(_0x4f149a,null))[_0x677e('0x2b')](function(_0x12c7f7){var _0x249f0c=_[_0x677e('0x33')](_0x12c7f7,'id');var _0x3d55e7=[];var _0x2b451e=[];var _0x477428=squel[_0x677e('0x8a')]();_0x477428[_0x677e('0x8b')](_0x677e('0x8c'))['from'](_0x677e('0x8d'),'tq')[_0x677e('0x8e')](_0x677e('0x8f'),'ut',_0x677e('0x90'))['where']('VoicePrefixId\x20=\x20?',_0x3ac7bb[_0x677e('0x4c')]['id']);for(var _0x3f54fc=0x0;_0x3f54fc<_0x12c7f7[_0x677e('0x4d')];_0x3f54fc+=0x1){let _0x23a71a=_0x12c7f7[_0x3f54fc];for(var _0x46997f=0x0;_0x46997f<_0x23a71a[_0x677e('0x80')][_0x677e('0x4d')];_0x46997f+=0x1){let _0x2519e9=_0x23a71a['Agents'][_0x46997f];var _0x57b67f=_0x477428[_0x677e('0x91')]();_0x57b67f[_0x677e('0x42')](_0x677e('0x92'),_0x2519e9['id']);_0x2b451e[_0x677e('0x68')](db[_0x677e('0x53')][_0x677e('0x3a')](_0x57b67f['toString'](),{'type':db[_0x677e('0x53')][_0x677e('0x93')][_0x677e('0x94')]})[_0x677e('0x2b')](function(_0x8a8748){if(_0x8a8748[_0x677e('0x4d')]===0x1){return _0x2519e9['id'];}else{var _0x248ddd=_['every'](_['map'](_0x8a8748,_0x677e('0x95')),function(_0x405048){return _[_0x677e('0x96')](_0x249f0c,_0x405048);});if(_0x248ddd){return _0x2519e9['id'];}}}));}}return BPromise[_0x677e('0x97')](_0x2b451e)[_0x677e('0x2b')](function(_0x4284d3){_0x3d55e7=_(_0x3d55e7)[_0x677e('0x98')](_0x4284d3)[_0x677e('0x99')]()[_0x677e('0x9a')]();return db[_0x677e('0x34')][_0x677e('0x4f')]({'where':{'id':_0x3ac7bb['params']['id']}})[_0x677e('0x2b')](function(_0x700834){return db['sequelize'][_0x677e('0x54')](function(_0x8e0c11){return _0x700834[_0x677e('0x89')](_0x3ac7bb['query'][_0x677e('0x73')],{'transaction':_0x8e0c11})[_0x677e('0x2b')](function(){if(!_[_0x677e('0x9b')](_0x3d55e7)){return _0x700834[_0x677e('0x9c')](_0x3d55e7,{'transaction':_0x8e0c11});}})['then'](function(){_0x3d55e7[_0x677e('0x88')](function(_0x50acd9){socket['emit'](_0x677e('0x78'),{'UserId':_0x50acd9,'VoicePrefixId':_0x700834['id']});});});});});});})[_0x677e('0x2b')](respondWithStatusCode(_0x4f149a,null))[_0x677e('0x50')](handleError(_0x4f149a,null));}; \ No newline at end of file +var _0xbaf0=['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','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','describe','create','sequelize','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoiceExtension','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','body','prefix','system-','ids','omit','spread','userVoicePrefix:save','params','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x5c726c,_0x577f49){var _0x3bd1ff=function(_0x5846bd){while(--_0x5846bd){_0x5c726c['push'](_0x5c726c['shift']());}};_0x3bd1ff(++_0x577f49);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0baf('0x1b')]=_[_0x0baf('0x1c')](config[_0x0baf('0x1b')],{'host':_0x0baf('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0baf('0x1b')]));require('./voicePrefix.socket')[_0x0baf('0x1e')](socket);function respondWithStatusCode(_0x1f50c3,_0x7fbf67){_0x7fbf67=_0x7fbf67||0xcc;return function(_0x2bc381){if(_0x2bc381){return _0x1f50c3[_0x0baf('0x1f')](_0x7fbf67);}return _0x1f50c3[_0x0baf('0x20')](_0x7fbf67)['end']();};}function respondWithResult(_0x4cd79d,_0x2312c7){_0x2312c7=_0x2312c7||0xc8;return function(_0x38395b){if(_0x38395b){return _0x4cd79d[_0x0baf('0x20')](_0x2312c7)[_0x0baf('0x21')](_0x38395b);}};}function respondWithFilteredResult(_0x2cf7da,_0x288a98){return function(_0x53c338){if(_0x53c338){var _0x63c820=typeof _0x288a98[_0x0baf('0x22')]===_0x0baf('0x23')&&typeof _0x288a98[_0x0baf('0x24')]===_0x0baf('0x23');var _0x42b7f2=_0x53c338['count'];var _0x5cff5d=_0x63c820?0x0:_0x288a98[_0x0baf('0x22')];var _0x154f48=_0x63c820?_0x53c338[_0x0baf('0x25')]:_0x288a98[_0x0baf('0x22')]+_0x288a98[_0x0baf('0x24')];var _0x3e3e20;if(_0x154f48>=_0x42b7f2){_0x154f48=_0x42b7f2;_0x3e3e20=0xc8;}else{_0x3e3e20=0xce;}_0x2cf7da[_0x0baf('0x20')](_0x3e3e20);return _0x2cf7da[_0x0baf('0x26')](_0x0baf('0x27'),_0x5cff5d+'-'+_0x154f48+'/'+_0x42b7f2)[_0x0baf('0x21')](_0x53c338);}return null;};}function patchUpdates(_0x54f2fa){return function(_0x334bd6){try{jsonpatch['apply'](_0x334bd6,_0x54f2fa,!![]);}catch(_0xf6c158){return BPromise['reject'](_0xf6c158);}return _0x334bd6['save']();};}function saveUpdates(_0x2ef0aa,_0x48a0e9){return function(_0x4be1b9){if(_0x4be1b9){return _0x4be1b9[_0x0baf('0x28')](_0x2ef0aa)[_0x0baf('0x29')](function(_0x34e264){return _0x34e264;});}return null;};}function removeEntity(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(_0x56b299){return _0x56b299[_0x0baf('0x2a')]()[_0x0baf('0x29')](function(){var _0x1ca35a=_0x56b299[_0x0baf('0x2b')]({'plain':!![]});var _0x3843b8=_0x0baf('0x2c');return db[_0x0baf('0x2d')]['destroy']({'where':{'type':_0x3843b8,'resourceId':_0x1ca35a['id']}})[_0x0baf('0x29')](function(){return _0x56b299;});})[_0x0baf('0x29')](function(){_0x19d9fd[_0x0baf('0x20')](0xcc)[_0x0baf('0x2e')]();});}};}function handleEntityNotFound(_0x55c715,_0x29dbdf){return function(_0x34a58a){if(!_0x34a58a){_0x55c715['sendStatus'](0x194);}return _0x34a58a;};}function handleError(_0x44ec31,_0x32e4fb){_0x32e4fb=_0x32e4fb||0x1f4;return function(_0x478ce8){logger[_0x0baf('0x2f')](_0x478ce8[_0x0baf('0x30')]);if(_0x478ce8[_0x0baf('0x31')]){delete _0x478ce8[_0x0baf('0x31')];}_0x44ec31['status'](_0x32e4fb)[_0x0baf('0x32')](_0x478ce8);};}exports[_0x0baf('0x33')]=function(_0x37be4e,_0x3ed995){var _0x24ecee={},_0x275ea1={},_0x2fc983={'count':0x0,'rows':[]};var _0x2f0a45=_[_0x0baf('0x34')](db[_0x0baf('0x35')][_0x0baf('0x36')],function(_0x165d14){return{'name':_0x165d14[_0x0baf('0x37')],'type':_0x165d14[_0x0baf('0x38')]['key']};});_0x275ea1[_0x0baf('0x39')]=_['map'](_0x2f0a45,_0x0baf('0x31'));_0x275ea1[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x37be4e[_0x0baf('0x3a')]);_0x275ea1['filters']=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],_0x275ea1['query']);_0x24ecee[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],qs[_0x0baf('0x3e')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x24ecee[_0x0baf('0x3d')]=_0x24ecee[_0x0baf('0x3d')]['length']?_0x24ecee[_0x0baf('0x3d')]:_0x275ea1[_0x0baf('0x39')];if(!_0x37be4e['query'][_0x0baf('0x3f')]('nolimit')){_0x24ecee['limit']=qs[_0x0baf('0x24')](_0x37be4e[_0x0baf('0x3a')]['limit']);_0x24ecee['offset']=qs[_0x0baf('0x22')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x22')]);}_0x24ecee[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x24ecee[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x37be4e[_0x0baf('0x3a')],_0x275ea1[_0x0baf('0x43')]),_0x2f0a45);if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x24ecee['where']=_[_0x0baf('0x46')](_0x24ecee[_0x0baf('0x42')],{'$or':_['map'](_0x2f0a45,function(_0x38006a){if(_0x38006a[_0x0baf('0x38')]!==_0x0baf('0x47')){var _0x299f93={};_0x299f93[_0x38006a[_0x0baf('0x31')]]={'$like':'%'+_0x37be4e[_0x0baf('0x3a')]['filter']+'%'};return _0x299f93;}})});}_0x24ecee=_[_0x0baf('0x46')]({},_0x24ecee,_0x37be4e[_0x0baf('0x48')]);var _0x540c41={'where':_0x24ecee[_0x0baf('0x42')]};return db[_0x0baf('0x35')][_0x0baf('0x25')](_0x540c41)[_0x0baf('0x29')](function(_0x504031){_0x2fc983[_0x0baf('0x25')]=_0x504031;if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x24ecee[_0x0baf('0x4a')]=[{'all':!![]}];}return db[_0x0baf('0x35')][_0x0baf('0x4b')](_0x24ecee);})[_0x0baf('0x29')](function(_0x1fa237){_0x2fc983[_0x0baf('0x4c')]=_0x1fa237;return _0x2fc983;})[_0x0baf('0x29')](respondWithFilteredResult(_0x3ed995,_0x24ecee))['catch'](handleError(_0x3ed995,null));};exports[_0x0baf('0x4d')]=function(_0x2bc755,_0x1daf1d){var _0x339aff={'raw':![],'where':{'id':_0x2bc755['params']['id']}},_0x22207a={};_0x22207a[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x35')][_0x0baf('0x36')]);_0x22207a[_0x0baf('0x3a')]=_['keys'](_0x2bc755[_0x0baf('0x3a')]);_0x22207a[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x22207a[_0x0baf('0x39')],_0x22207a[_0x0baf('0x3a')]);_0x339aff[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x22207a['model'],qs[_0x0baf('0x3e')](_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x339aff['attributes']=_0x339aff[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x339aff[_0x0baf('0x3d')]:_0x22207a[_0x0baf('0x39')];if(_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x339aff[_0x0baf('0x4a')]=[{'all':!![]}];}_0x339aff=_['merge']({},_0x339aff,_0x2bc755[_0x0baf('0x48')]);return db[_0x0baf('0x35')][_0x0baf('0x4f')](_0x339aff)[_0x0baf('0x29')](handleEntityNotFound(_0x1daf1d,null))[_0x0baf('0x29')](respondWithResult(_0x1daf1d,null))[_0x0baf('0x50')](handleError(_0x1daf1d,null));};exports[_0x0baf('0x2a')]=function(_0x1af4aa,_0x2be7fe){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x1af4aa['params']['id']}})['then'](handleEntityNotFound(_0x2be7fe,null))[_0x0baf('0x29')](removeEntity(_0x2be7fe,null))[_0x0baf('0x50')](handleError(_0x2be7fe,null));};exports[_0x0baf('0x51')]=function(_0xb8fa28,_0x21b108){return db[_0x0baf('0x35')][_0x0baf('0x51')]()['then'](respondWithResult(_0x21b108,null))[_0x0baf('0x50')](handleError(_0x21b108,null));};exports[_0x0baf('0x52')]=function(_0xf2424,_0x16d9fb){var _0x3fdb41;return db[_0x0baf('0x53')]['transaction'](function(_0x3eebe5){return db['VoicePrefix'][_0x0baf('0x52')](_0xf2424['body'],{'transaction':_0x3eebe5})[_0x0baf('0x29')](function(_0x5eaeb2){_0x3fdb41=_0x5eaeb2[_0x0baf('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x0baf('0x4f')]({'where':{'id':_0x3fdb41[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x4520d1){return createVoicePrefixExtensions(_0x3fdb41,_0x4520d1,_0x3eebe5);});});})[_0x0baf('0x29')](function(){var _0x576475=_0xf2424[_0x0baf('0x55')][_0x0baf('0x2b')]({'plain':!![]});if(!_0x576475)throw new Error(_0x0baf('0x56'));if(_0x576475[_0x0baf('0x57')]===_0x0baf('0x55')){var _0xa19b21=_0x3fdb41;return db['UserProfileSection'][_0x0baf('0x4f')]({'where':{'name':_0x0baf('0x2c'),'userProfileId':_0x576475[_0x0baf('0x58')]},'raw':!![]})[_0x0baf('0x29')](function(_0xbc7cc2){if(_0xbc7cc2&&_0xbc7cc2[_0x0baf('0x59')]===0x0){return db[_0x0baf('0x2d')]['create']({'name':_0xa19b21['name'],'resourceId':_0xa19b21['id'],'type':_0xbc7cc2[_0x0baf('0x31')],'sectionId':_0xbc7cc2['id']},{})[_0x0baf('0x29')](function(){return _0x3fdb41;});}else{return _0x3fdb41;}})[_0x0baf('0x50')](function(_0x337d94){logger[_0x0baf('0x2f')](_0x0baf('0x5a'),_0x337d94);throw _0x337d94;});}return _0x3fdb41;})[_0x0baf('0x29')](respondWithResult(_0x16d9fb,null))[_0x0baf('0x50')](handleError(_0x16d9fb,null));};function Extension(_0x3d9a32,_0x585969,_0x3238f9,_0x268be8){this[_0x0baf('0x5b')]=_0x0baf('0x5c');this[_0x0baf('0x5d')]=_0x3d9a32;this[_0x0baf('0x5e')]=_0x3238f9;this[_0x0baf('0x38')]='system';this[_0x0baf('0x5f')]=_0x0baf('0x60');this[_0x0baf('0x61')]=_0x585969;this[_0x0baf('0x62')]=_0x268be8;}function createVoicePrefixExtensions(_0x1c7d88,_0x1a6d22,_0x14e6d0){return new BPromise(function(_0x12543e,_0x498405){var _0x178495=new Extension(formatPrefixName(_0x1c7d88['prefix']),0x1,_0x0baf('0x63'),'Voice\x20Prefix');_0x178495['VoicePrefixId']=_0x1c7d88['id'];return db[_0x0baf('0x64')]['create'](_0x178495,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x2b17f8){var _0x49d713=_0x2b17f8[_0x0baf('0x2b')]({'plain':!![]});var _0xfb6708=_[_0x0baf('0x34')](addVoicePrefixExtensions(_0x1c7d88,_0x1a6d22),function(_0x5b3c1d){_0x5b3c1d['VoiceExtensionId']=_0x49d713['id'];_0x5b3c1d[_0x0baf('0x65')]=_0x1c7d88['id'];return _0x5b3c1d;});return db[_0x0baf('0x64')][_0x0baf('0x66')](_0xfb6708,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x784e1a){if(!_0x784e1a){return _0x498405('Extensions\x20creation\x20failed');}else{return _0x12543e(_0x784e1a);}})[_0x0baf('0x50')](function(_0x4c02ca){return _0x498405(_0x4c02ca);});});;});};function addVoicePrefixExtensions(_0x5d5751,_0x59a0b2){var _0x427ed1=[];var _0x58a366=formatPrefixName(_0x5d5751['prefix']);_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x2,_0x0baf('0x68'),_0x0baf('0x69')+_0x5d5751[_0x0baf('0x31')]));if(_0x5d5751[_0x0baf('0x6a')]){_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,'Set',_0x0baf('0x6b')+_0x5d5751[_0x0baf('0x6a')]));}else{_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,_0x0baf('0x63'),_0x0baf('0x6c')));}_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x4,'goto',_0x59a0b2[_0x0baf('0x5b')]+','+_0x0baf('0x6d')+(0x8+_0x5d5751[_0x0baf('0x31')]['length'])+'}'+','+0x1));return _0x427ed1;}function formatPrefixName(_0x89484d){var _0x1e474f='_';for(var _0x3d333d=0x0;_0x3d333d<_0x89484d[_0x0baf('0x4e')];_0x3d333d++){if(_0x89484d[_0x0baf('0x6e')](_0x3d333d)=='-'){_0x1e474f+=_0x89484d[_0x0baf('0x6e')](_0x3d333d);}else{_0x1e474f+='['+_0x89484d[_0x0baf('0x6e')](_0x3d333d)+']';}}_0x1e474f+='.';return _0x1e474f;}exports['update']=function(_0x54353a,_0x4b7caa,_0x6ce83c){var _0x89bec7=_0x54353a[_0x0baf('0x6f')];_0x89bec7[_0x0baf('0x70')]=_0x0baf('0x71')+_0x89bec7[_0x0baf('0x31')]+'-';return db['sequelize']['transaction'](function(_0x34c1f4){return db['VoicePrefix'][_0x0baf('0x28')](_0x89bec7,{'where':{'id':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db['VoiceExtension'][_0x0baf('0x2a')]({'where':{'VoicePrefixId':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db[_0x0baf('0x64')][_0x0baf('0x4f')]({'where':{'id':_0x89bec7[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x1b6b73){return createVoicePrefixExtensions(_0x89bec7,_0x1b6b73,_0x34c1f4);});});});})[_0x0baf('0x29')](function(){return db[_0x0baf('0x35')]['findById'](_0x89bec7['id']);})['then'](respondWithResult(_0x4b7caa,null))['catch'](handleError(_0x4b7caa,null));};exports['addAgents']=function(_0x5361a5,_0x418c45,_0x18963f){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x5361a5['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x418c45,null))[_0x0baf('0x29')](function(_0x58caee){if(_0x58caee){return _0x58caee['addAgents'](_0x5361a5[_0x0baf('0x6f')][_0x0baf('0x72')],_[_0x0baf('0x73')](_0x5361a5[_0x0baf('0x6f')],[_0x0baf('0x72'),'id'])||{})[_0x0baf('0x74')](function(_0x3ce111){for(var _0x399f40=0x0;_0x399f40<_0x5361a5['body'][_0x0baf('0x72')][_0x0baf('0x4e')];_0x399f40+=0x1){socket['emit'](_0x0baf('0x75'),{'UserId':Number(_0x5361a5[_0x0baf('0x6f')]['ids'][_0x399f40]),'VoicePrefixId':Number(_0x5361a5[_0x0baf('0x76')]['id'])});}return _0x3ce111;});}})[_0x0baf('0x29')](respondWithResult(_0x418c45,null))[_0x0baf('0x50')](handleError(_0x418c45,null));};exports[_0x0baf('0x77')]=function(_0x167977,_0x4fc5af,_0x4807fc){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x167977['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x4fc5af,null))[_0x0baf('0x29')](function(_0x21ad25){if(_0x21ad25){return _0x21ad25['removeAgents'](_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')])[_0x0baf('0x29')](function(){if(_['isArray'](_0x167977[_0x0baf('0x3a')]['ids'])){for(var _0x316397=0x0;_0x316397<_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x0baf('0x4e')];_0x316397+=0x1){socket[_0x0baf('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x316397]),'VoicePrefixId':Number(_0x167977['params']['id'])});}}else{socket[_0x0baf('0x78')](_0x0baf('0x79'),{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')]),'VoicePrefixId':Number(_0x167977[_0x0baf('0x76')]['id'])});}});}})[_0x0baf('0x29')](respondWithStatusCode(_0x4fc5af,null))[_0x0baf('0x50')](handleError(_0x4fc5af,null));};exports[_0x0baf('0x7a')]=function(_0x44ef57,_0x1ca3a6,_0x3b7abf){var _0x2c2f09={};var _0x5985f9={};var _0x599ac0;var _0x29a036;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x44ef57['params']['id']}})['then'](handleEntityNotFound(_0x1ca3a6,null))[_0x0baf('0x29')](function(_0x368e23){if(_0x368e23){_0x599ac0=_0x368e23;_0x5985f9[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x7c')][_0x0baf('0x36')]);_0x5985f9[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x44ef57[_0x0baf('0x3a')]);_0x5985f9['filters']=_[_0x0baf('0x3c')](_0x5985f9[_0x0baf('0x39')],_0x5985f9[_0x0baf('0x3a')]);_0x2c2f09[_0x0baf('0x3d')]=_['intersection'](_0x5985f9['model'],qs['fields'](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x2c2f09['attributes']=_0x2c2f09['attributes'][_0x0baf('0x4e')]?_0x2c2f09[_0x0baf('0x3d')]:_0x5985f9['model'];_0x2c2f09[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x2c2f09[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x44ef57[_0x0baf('0x3a')],_0x5985f9[_0x0baf('0x43')]));if(_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x2c2f09[_0x0baf('0x42')]=_['merge'](_0x2c2f09[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x2c2f09[_0x0baf('0x3d')],function(_0x3bd15b){var _0x3c37b4={};_0x3c37b4[_0x3bd15b]={'$like':'%'+_0x44ef57[_0x0baf('0x3a')]['filter']+'%'};return _0x3c37b4;})});}_0x2c2f09=_[_0x0baf('0x46')]({},_0x2c2f09,_0x44ef57[_0x0baf('0x48')]);return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x4376a1){if(_0x4376a1){_0x29a036=_0x4376a1['length'];if(!_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3f')](_0x0baf('0x7d'))){_0x2c2f09[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x44ef57['query']['limit']);_0x2c2f09[_0x0baf('0x22')]=qs['offset'](_0x44ef57[_0x0baf('0x3a')]['offset']);}return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x1ce7bb){if(_0x1ce7bb){return _0x1ce7bb?{'count':_0x29a036,'rows':_0x1ce7bb}:null;}})[_0x0baf('0x29')](respondWithResult(_0x1ca3a6,null))['catch'](handleError(_0x1ca3a6,null));};exports[_0x0baf('0x7e')]=function(_0x106ffa,_0xf7a9d0,_0x551df3){var _0x487aec={};var _0x591cc2={};var _0x4d4884;var _0x427638;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x106ffa[_0x0baf('0x76')]['id']}})['then'](handleEntityNotFound(_0xf7a9d0,null))[_0x0baf('0x29')](function(_0x37594e){if(_0x37594e){_0x4d4884=_0x37594e;_0x591cc2[_0x0baf('0x39')]=_['keys'](db[_0x0baf('0x7f')][_0x0baf('0x36')]);_0x591cc2['query']=_[_0x0baf('0x3b')](_0x106ffa['query']);_0x591cc2[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x591cc2[_0x0baf('0x39')],_0x591cc2[_0x0baf('0x3a')]);_0x487aec['attributes']=_['intersection'](_0x591cc2[_0x0baf('0x39')],qs['fields'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x487aec[_0x0baf('0x3d')]=_0x487aec[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x487aec['attributes']:_0x591cc2[_0x0baf('0x39')];_0x487aec['order']=qs[_0x0baf('0x41')](_0x106ffa['query'][_0x0baf('0x41')]);_0x487aec['where']=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x106ffa[_0x0baf('0x3a')],_0x591cc2['filters']));if(_0x106ffa['query'][_0x0baf('0x45')]){_0x487aec[_0x0baf('0x42')]=_[_0x0baf('0x46')](_0x487aec[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x487aec[_0x0baf('0x3d')],function(_0x4e6059){var _0xd4170d={};_0xd4170d[_0x4e6059]={'$like':'%'+_0x106ffa['query'][_0x0baf('0x45')]+'%'};return _0xd4170d;})});}_0x487aec=_['merge']({},_0x487aec,_0x106ffa[_0x0baf('0x48')]);return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0x557a38){if(_0x557a38){_0x427638=_0x557a38[_0x0baf('0x4e')];if(!_0x106ffa[_0x0baf('0x3a')]['hasOwnProperty']('nolimit')){_0x487aec[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x24')]);_0x487aec['offset']=qs['offset'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x22')]);}return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0xfc91ce){if(_0xfc91ce){return _0xfc91ce?{'count':_0x427638,'rows':_0xfc91ce}:null;}})[_0x0baf('0x29')](respondWithResult(_0xf7a9d0,null))[_0x0baf('0x50')](handleError(_0xf7a9d0,null));};exports[_0x0baf('0x80')]=function(_0x205de6,_0x2369f0,_0x58f95c){var _0xdb96c0=_0x205de6['body'][_0x0baf('0x72')];var _0x42abcf;return db[_0x0baf('0x7f')][_0x0baf('0x4b')]({'where':{'id':_0xdb96c0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0baf('0x81'),'attributes':['id',_0x0baf('0x31'),_0x0baf('0x82'),_0x0baf('0x83'),_0x0baf('0x84')],'raw':!![]}]})[_0x0baf('0x29')](function(_0x3b9101){if(_0x3b9101){_0x42abcf=_0x3b9101;var _0x205075=_[_0x0baf('0x85')](_0x3b9101,function(_0x4b6cd5){var _0x8d1bae=_0x4b6cd5[_0x0baf('0x2b')]({'plain':!![]});return _0x8d1bae['Agents'];});return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x205de6[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x97f5d6){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x8c1dc2){return _0x97f5d6[_0x0baf('0x80')](_0xdb96c0,{'transaction':_0x8c1dc2})['then'](function(){return BPromise[_0x0baf('0x87')](_0x42abcf,function(_0x218fc5){return db[_0x0baf('0x88')][_0x0baf('0x89')]({'TeamId':_0x218fc5['id'],'VoicePrefixId':_0x205de6[_0x0baf('0x76')]['id']},{'transaction':_0x8c1dc2});});})[_0x0baf('0x29')](function(){return BPromise['each'](_0x205075,function(_0x121718){return db[_0x0baf('0x8a')][_0x0baf('0x8b')]({'where':{'UserId':_0x121718['id'],'VoicePrefixId':_0x205de6['params']['id']},'transaction':_0x8c1dc2});});})['then'](function(){_0x205075[_0x0baf('0x8c')](function(_0x1adb84){socket[_0x0baf('0x78')]('userVoicePrefix:save',{'UserId':_0x1adb84['id'],'VoicePrefixId':_0x97f5d6['id']});});});});});}})[_0x0baf('0x29')](respondWithStatusCode(_0x2369f0,null))['catch'](handleError(_0x2369f0,null));};exports[_0x0baf('0x8d')]=function(_0x5f09be,_0x41b216,_0x3f2838){return db['Team'][_0x0baf('0x4b')]({'where':{'id':_0x5f09be[_0x0baf('0x3a')][_0x0baf('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0baf('0x7c')],'as':_0x0baf('0x81'),'attributes':['id'],'raw':!![]}]})[_0x0baf('0x29')](handleEntityNotFound(_0x41b216,null))[_0x0baf('0x29')](function(_0x5508db){var _0x727cad=_[_0x0baf('0x34')](_0x5508db,'id');var _0x2766fb=[];var _0x2e1629=[];var _0x275cc4=squel[_0x0baf('0x8e')]();_0x275cc4[_0x0baf('0x8f')](_0x0baf('0x90'))[_0x0baf('0x91')](_0x0baf('0x92'),'tq')[_0x0baf('0x93')](_0x0baf('0x94'),'ut',_0x0baf('0x95'))[_0x0baf('0x42')]('VoicePrefixId\x20=\x20?',_0x5f09be['params']['id']);for(var _0x1cd215=0x0;_0x1cd215<_0x5508db[_0x0baf('0x4e')];_0x1cd215+=0x1){let _0x3b9429=_0x5508db[_0x1cd215];for(var _0x41d397=0x0;_0x41d397<_0x3b9429['Agents'][_0x0baf('0x4e')];_0x41d397+=0x1){let _0xc6c049=_0x3b9429[_0x0baf('0x81')][_0x41d397];var _0x2fb267=_0x275cc4[_0x0baf('0x96')]();_0x2fb267[_0x0baf('0x42')]('ut.UserId\x20=\x20?',_0xc6c049['id']);_0x2e1629[_0x0baf('0x67')](db[_0x0baf('0x53')][_0x0baf('0x3a')](_0x2fb267['toString'](),{'type':db[_0x0baf('0x53')][_0x0baf('0x97')][_0x0baf('0x98')]})['then'](function(_0x4f7145){if(_0x4f7145['length']===0x1){return _0xc6c049['id'];}else{var _0x11a85a=_['every'](_[_0x0baf('0x34')](_0x4f7145,_0x0baf('0x99')),function(_0x55124b){return _[_0x0baf('0x9a')](_0x727cad,_0x55124b);});if(_0x11a85a){return _0xc6c049['id'];}}}));}}return BPromise['all'](_0x2e1629)['then'](function(_0x21516f){_0x2766fb=_(_0x2766fb)['union'](_0x21516f)[_0x0baf('0x9b')]()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x5f09be[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x3d1f80){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x4f9904){return _0x3d1f80[_0x0baf('0x8d')](_0x5f09be['query'][_0x0baf('0x72')],{'transaction':_0x4f9904})[_0x0baf('0x29')](function(){if(!_[_0x0baf('0x9c')](_0x2766fb)){return _0x3d1f80['removeAgents'](_0x2766fb,{'transaction':_0x4f9904});}})[_0x0baf('0x29')](function(){_0x2766fb[_0x0baf('0x8c')](function(_0x12311d){socket['emit'](_0x0baf('0x79'),{'UserId':_0x12311d,'VoicePrefixId':_0x3d1f80['id']});});});});});});})['then'](respondWithStatusCode(_0x41b216,null))[_0x0baf('0x50')](handleError(_0x41b216,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 570ca79..ef2bacb 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 _0x7f04=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','save','remove','emit'];(function(_0x46f8a6,_0x1dd5d6){var _0x57f58a=function(_0x21124e){while(--_0x21124e){_0x46f8a6['push'](_0x46f8a6['shift']());}};_0x57f58a(++_0x1dd5d6);}(_0x7f04,0xe4));var _0x47f0=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x7f04[_0x435044];return _0x33d4c6;};'use strict';var EventEmitter=require(_0x47f0('0x0'));var VoicePrefix=require(_0x47f0('0x1'))['db'][_0x47f0('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47f0('0x3'),'afterUpdate':'update','afterDestroy':_0x47f0('0x4')};function emitEvent(_0x3e927d){return function(_0x570481,_0x5dc75a,_0x170b81){VoicePrefixEvents[_0x47f0('0x5')](_0x3e927d+':'+_0x570481['id'],_0x570481);VoicePrefixEvents[_0x47f0('0x5')](_0x3e927d,_0x570481);_0x170b81(null);};}for(var e in events){if(events[_0x47f0('0x6')](e)){var event=events[e];VoicePrefix[_0x47f0('0x7')](e,emitEvent(event));}}module[_0x47f0('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x176f=['exports','events','VoicePrefix','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1c839c,_0x3f80e4){var _0x2a912c=function(_0x256c47){while(--_0x256c47){_0x1c839c['push'](_0x1c839c['shift']());}};_0x2a912c(++_0x3f80e4);}(_0x176f,0x157));var _0xf176=function(_0x596576,_0x92d198){_0x596576=_0x596576-0x0;var _0x3ce3d5=_0x176f[_0x596576];return _0x3ce3d5;};'use strict';var EventEmitter=require(_0xf176('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xf176('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf176('0x2'),'afterUpdate':_0xf176('0x3'),'afterDestroy':_0xf176('0x4')};function emitEvent(_0x3f6659){return function(_0x339d55,_0x2f650c,_0x527287){VoicePrefixEvents['emit'](_0x3f6659+':'+_0x339d55['id'],_0x339d55);VoicePrefixEvents[_0xf176('0x5')](_0x3f6659,_0x339d55);_0x527287(null);};}for(var e in events){if(events[_0xf176('0x6')](e)){var event=events[e];VoicePrefix[_0xf176('0x7')](e,emitEvent(event));}}module[_0xf176('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 167662e..58d7d33 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 _0x4ad9=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','util'];(function(_0x511514,_0x5a3755){var _0x373775=function(_0x2284df){while(--_0x2284df){_0x511514['push'](_0x511514['shift']());}};_0x373775(++_0x5a3755);}(_0x4ad9,0x131));var _0x94ad=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4ad9[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x94ad('0x0'));var logger=require('../../config/logger')(_0x94ad('0x1'));var moment=require(_0x94ad('0x2'));var BPromise=require(_0x94ad('0x3'));var rp=require(_0x94ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94ad('0x5'));var config=require(_0x94ad('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x94ad('0x7')]=function(_0xd3851b,_0x17519f){return _0xd3851b[_0x94ad('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c90=['voice_prefixes','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','VoicePrefix'];(function(_0x58d23d,_0x16beeb){var _0x429b5f=function(_0x1399b5){while(--_0x1399b5){_0x58d23d['push'](_0x58d23d['shift']());}};_0x429b5f(++_0x16beeb);}(_0x6c90,0x1c4));var _0x06c9=function(_0x43d76d,_0x1f39a7){_0x43d76d=_0x43d76d-0x0;var _0x3b06e8=_0x6c90[_0x43d76d];return _0x3b06e8;};'use strict';var _=require(_0x06c9('0x0'));var util=require(_0x06c9('0x1'));var logger=require('../../config/logger')(_0x06c9('0x2'));var moment=require(_0x06c9('0x3'));var BPromise=require(_0x06c9('0x4'));var rp=require(_0x06c9('0x5'));var fs=require('fs');var path=require(_0x06c9('0x6'));var rimraf=require(_0x06c9('0x7'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x06c9('0x8')]=function(_0xb8a580,_0xbc8527){return _0xb8a580['define'](_0x06c9('0x9'),attributes,{'tableName':_0x06c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 9899a17..dccfeba 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 _0x3ef7=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x35f18a,_0x4e66d3){var _0x52d4e0=function(_0x267f42){while(--_0x267f42){_0x35f18a['push'](_0x35f18a['shift']());}};_0x52d4e0(++_0x4e66d3);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var moment=require(_0x73ef('0x1'));var BPromise=require(_0x73ef('0x2'));var rs=require(_0x73ef('0x3'));var fs=require('fs');var Redis=require(_0x73ef('0x4'));var db=require(_0x73ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73ef('0x6'))(_0x73ef('0x7'));var config=require(_0x73ef('0x8'));var jayson=require(_0x73ef('0x9'));var client=jayson['client'][_0x73ef('0xa')]({'port':0x232a});config[_0x73ef('0xb')]=_[_0x73ef('0xc')](config[_0x73ef('0xb')],{'host':_0x73ef('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73ef('0xb')]));require(_0x73ef('0xe'))['register'](socket);function respondWithRpcPromise(_0x1055e1,_0x21bfed,_0x364470){return new BPromise(function(_0x3bd4c9,_0x33aa09){return client['request'](_0x1055e1,_0x364470)[_0x73ef('0xf')](function(_0x111ce3){logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x21bfed,_0x73ef('0x12'));logger[_0x73ef('0x13')](_0x73ef('0x14'),_0x21bfed,_0x73ef('0x12'),JSON[_0x73ef('0x15')](_0x111ce3));if(_0x111ce3[_0x73ef('0x16')]){if(_0x111ce3[_0x73ef('0x16')][_0x73ef('0x17')]===0x1f4){logger[_0x73ef('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x21bfed,_0x111ce3[_0x73ef('0x16')]['message']);return _0x33aa09(_0x111ce3[_0x73ef('0x16')][_0x73ef('0x18')]);}logger[_0x73ef('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x21bfed,_0x111ce3[_0x73ef('0x16')][_0x73ef('0x18')]);return _0x3bd4c9(_0x111ce3['error'][_0x73ef('0x18')]);}else{logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x21bfed,_0x73ef('0x12'));_0x3bd4c9(_0x111ce3[_0x73ef('0x19')]['message']);}})[_0x73ef('0x1a')](function(_0x4dc000){logger[_0x73ef('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x21bfed,_0x4dc000);_0x33aa09(_0x4dc000);});});} \ No newline at end of file +var _0xdcfa=['jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcfa,0xad));var _0xadcf=function(_0x50d84b,_0x1d7ea7){_0x50d84b=_0x50d84b-0x0;var _0x6d4270=_0xdcfa[_0x50d84b];return _0x6d4270;};'use strict';var _=require(_0xadcf('0x0'));var util=require('util');var moment=require(_0xadcf('0x1'));var BPromise=require('bluebird');var rs=require(_0xadcf('0x2'));var fs=require('fs');var Redis=require(_0xadcf('0x3'));var db=require(_0xadcf('0x4'))['db'];var utils=require(_0xadcf('0x5'));var logger=require(_0xadcf('0x6'))(_0xadcf('0x7'));var config=require(_0xadcf('0x8'));var jayson=require(_0xadcf('0x9'));var client=jayson[_0xadcf('0xa')][_0xadcf('0xb')]({'port':0x232a});config[_0xadcf('0xc')]=_[_0xadcf('0xd')](config['redis'],{'host':_0xadcf('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadcf('0xc')]));require(_0xadcf('0xf'))['register'](socket);function respondWithRpcPromise(_0x75bc59,_0x5d2cbf,_0x390d09){return new BPromise(function(_0x5c6a93,_0x1e217b){return client[_0xadcf('0x10')](_0x75bc59,_0x390d09)['then'](function(_0x23aa9b){logger[_0xadcf('0x11')](_0xadcf('0x12'),_0x5d2cbf,_0xadcf('0x13'));logger[_0xadcf('0x14')](_0xadcf('0x15'),_0x5d2cbf,'request\x20sent',JSON[_0xadcf('0x16')](_0x23aa9b));if(_0x23aa9b[_0xadcf('0x17')]){if(_0x23aa9b[_0xadcf('0x17')][_0xadcf('0x18')]===0x1f4){logger[_0xadcf('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x5d2cbf,_0x23aa9b[_0xadcf('0x17')][_0xadcf('0x19')]);return _0x1e217b(_0x23aa9b['error'][_0xadcf('0x19')]);}logger[_0xadcf('0x17')](_0xadcf('0x12'),_0x5d2cbf,_0x23aa9b[_0xadcf('0x17')][_0xadcf('0x19')]);return _0x5c6a93(_0x23aa9b['error'][_0xadcf('0x19')]);}else{logger['info'](_0xadcf('0x12'),_0x5d2cbf,_0xadcf('0x13'));_0x5c6a93(_0x23aa9b['result'][_0xadcf('0x19')]);}})['catch'](function(_0x1baa24){logger[_0xadcf('0x17')](_0xadcf('0x12'),_0x5d2cbf,_0x1baa24);_0x1e217b(_0x1baa24);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4a496c3..9dd9176 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 _0xb75c=['./voicePrefix.events','save','remove','emit','removeListener','length'];(function(_0x1fda49,_0x638325){var _0x336c0a=function(_0x1122fa){while(--_0x1122fa){_0x1fda49['push'](_0x1fda49['shift']());}};_0x336c0a(++_0x638325);}(_0xb75c,0x1ce));var _0xcb75=function(_0x4635c0,_0x16e523){_0x4635c0=_0x4635c0-0x0;var _0x1f052b=_0xb75c[_0x4635c0];return _0x1f052b;};'use strict';var VoicePrefixEvents=require(_0xcb75('0x0'));var events=[_0xcb75('0x1'),_0xcb75('0x2'),'update'];function createListener(_0x348403,_0x4da54f){return function(_0x21a350){_0x4da54f[_0xcb75('0x3')](_0x348403,_0x21a350);};}function removeListener(_0x390961,_0x4a39a6){return function(){VoicePrefixEvents[_0xcb75('0x4')](_0x390961,_0x4a39a6);};}exports['register']=function(_0x5f488c){for(var _0xb12187=0x0,_0x284ea6=events[_0xcb75('0x5')];_0xb12187<_0x284ea6;_0xb12187++){var _0x498656=events[_0xb12187];var _0x57ef56=createListener('voicePrefix:'+_0x498656,_0x5f488c);VoicePrefixEvents['on'](_0x498656,_0x57ef56);}}; \ No newline at end of file +var _0x1bca=['length','voicePrefix:','save','emit','removeListener','register'];(function(_0xc49513,_0x18ed11){var _0x1194bc=function(_0x59b707){while(--_0x59b707){_0xc49513['push'](_0xc49513['shift']());}};_0x1194bc(++_0x18ed11);}(_0x1bca,0xb6));var _0xa1bc=function(_0x1c7e01,_0x5729b3){_0x1c7e01=_0x1c7e01-0x0;var _0x17a02e=_0x1bca[_0x1c7e01];return _0x17a02e;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xa1bc('0x0'),'remove','update'];function createListener(_0x84fe95,_0x4feb3b){return function(_0x1865b2){_0x4feb3b[_0xa1bc('0x1')](_0x84fe95,_0x1865b2);};}function removeListener(_0x3469ad,_0x543df3){return function(){VoicePrefixEvents[_0xa1bc('0x2')](_0x3469ad,_0x543df3);};}exports[_0xa1bc('0x3')]=function(_0x168b44){for(var _0x268ced=0x0,_0x54bffb=events[_0xa1bc('0x4')];_0x268ced<_0x54bffb;_0x268ced++){var _0x432b65=events[_0x268ced];var _0xea5ec8=createListener(_0xa1bc('0x5')+_0x432b65,_0x168b44);VoicePrefixEvents['on'](_0x432b65,_0xea5ec8);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index deef680..958cf03 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(_0x264ef2,_0x32fb8d){var _0xc8e0bf=function(_0x5092f9){while(--_0x5092f9){_0x264ef2['push'](_0x264ef2['shift']());}};_0xc8e0bf(++_0x32fb8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0xb10b,0x12a));var _0xbb10=function(_0x5721c4,_0x2ffbd4){_0x5721c4=_0x5721c4-0x0;var _0x597a5f=_0xb10b[_0x5721c4];return _0x597a5f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0156fcb..a1a1dbd 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 _0xb15a=['NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','ENUM','outbound','default','leastrecent','fewestcalls','random','linear','wrandom','rrordered','ringall','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','inbound','booked','predictive','power','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xb15a,0x197));var _0xab15=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xb15a[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0xab15('0x0'));module[_0xab15('0x1')]={'name':{'type':Sequelize[_0xab15('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xab15('0x3')]('inbound',_0xab15('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xab15('0x2')],'defaultValue':_0xab15('0x5')},'announce':{'type':Sequelize[_0xab15('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xab15('0x3')]('rr','ringall',_0xab15('0x6'),_0xab15('0x7'),_0xab15('0x8'),'rrmemory',_0xab15('0x9'),_0xab15('0xa'),_0xab15('0xb')),'allowNull':![],'defaultValue':_0xab15('0xc'),'set':function(_0x4ca2cb){this[_0xab15('0xd')](_0xab15('0xe'),_0x4ca2cb?_0x4ca2cb:_0xab15('0xf'));},'get':function(){var _0xb3ed5d=this[_0xab15('0x10')](_0xab15('0x11'));var _0x108d23=this[_0xab15('0x10')](_0xab15('0x12'));var _0x142956=this['getDataValue']('strategy');if(_0xb3ed5d===_0xab15('0x13')){return _0x142956;}if(_0x108d23===_0xab15('0x14')&&_0x142956===_0xab15('0xf')||_0x108d23===_0xab15('0x14')&&_0x142956==='roundrobin'){return _0x142956;}if(_0x108d23==='progressive'||_0x108d23===_0xab15('0x15')||_0x108d23===_0xab15('0x16')){return _0x142956;}return null;}},'servicelevel':{'type':Sequelize[_0xab15('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xab15('0x17')](0xb)},'timeout':{'type':Sequelize[_0xab15('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xab15('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xab15('0x2')]},'weight':{'type':Sequelize[_0xab15('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xab15('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x18'),'no'),'defaultValue':_0xab15('0x18')},'autopause':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x18'),'no',_0xab15('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xab15('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xab15('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xab15('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xab15('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xab15('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xab15('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xab15('0x17')](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[_0xab15('0x3')](_0xab15('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x18'),'no'),'defaultValue':_0xab15('0x18')},'announce_holdtime':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x18'),'no',_0xab15('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xab15('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xab15('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xab15('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xab15('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xab15('0x2')]},'queue_quantity1':{'type':Sequelize[_0xab15('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xab15('0x2')]},'queue_less_than':{'type':Sequelize[_0xab15('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x14e695){this[_0xab15('0xd')](_0xab15('0x1b'),_0x14e695?_0x14e695[_0xab15('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0xab15('0x1b'))?this[_0xab15('0x10')]('periodic_announce')[_0xab15('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xab15('0x18'),'set':function(_0x11797c){this[_0xab15('0xd')](_0xab15('0x1e'),_0x11797c?_0x11797c['join'](','):undefined);},'get':function(){return this[_0xab15('0x10')](_0xab15('0x1e'))?this[_0xab15('0x10')](_0xab15('0x1e'))[_0xab15('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xab15('0x2')],'defaultValue':'no','set':function(_0x1dfa40){this[_0xab15('0xd')](_0xab15('0x1f'),_0x1dfa40?_0x1dfa40[_0xab15('0x1c')](','):undefined);},'get':function(){return this[_0xab15('0x10')](_0xab15('0x1f'))?this['getDataValue']('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xab15('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xab15('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xab15('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xab15('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xab15('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x36b9fd){this[_0xab15('0xd')](_0xab15('0x20'),_0x36b9fd);if(_0x36b9fd){if(this[_0xab15('0x10')](_0xab15('0x21'))<0x2){this[_0xab15('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xab15('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x23'),_0xab15('0x24'),'power','predictive',_0xab15('0x14')),'defaultValue':'progressive','comment':_0xab15('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xab15('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xab15('0x17')](0x4)[_0xab15('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xab15('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xab15('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xab15('0x3')]('agentBusyFactor','dropRate'),'defaultValue':_0xab15('0x28'),'comment':_0xab15('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xab15('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xab15('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xab15('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xab15('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab15('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xab15('0x2')],'defaultValue':_0xab15('0x2d'),'comment':_0xab15('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xab15('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab15('0x2f')},'dialQueueProject':{'type':Sequelize[_0xab15('0x2')],'comment':_0xab15('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xab15('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab15('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab15('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab15('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xab15('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'defaultValue':0x3,'comment':_0xab15('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab15('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xab15('0x35')},'dialPrefix':{'type':Sequelize[_0xab15('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xab15('0x3')]('always','never',_0xab15('0x36')),'defaultValue':_0xab15('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xab15('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xab15('0x17')](0x9)[_0xab15('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xab15('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xab15('0x17')](0x9)[_0xab15('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xab15('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xab15('0x17')](0x9)[_0xab15('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xab15('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xab15('0x17')](0x9)[_0xab15('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab15('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xab15('0x17')](0x9)[_0xab15('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xab15('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xab15('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xab15('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xab15('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xab15('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xab15('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xab15('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xab15('0x17')](0x9)[_0xab15('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab15('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xab15('0x17')](0x5)[_0xab15('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xab15('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xab15('0x22')],'defaultValue':0x0,'comment':_0xab15('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xab15('0x3')](_0xab15('0x44'),_0xab15('0x45')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xab15('0x2')],'comment':_0xab15('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xab15('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xab15('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xab15('0x46')},'dialCutDigit':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xab15('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab15('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xab15('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab15('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xab15('0x17')](0x5)[_0xab15('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab15('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xab15('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xab15('0x17')](0x5)[_0xab15('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab15('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xab15('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab15('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab15('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab15('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xab15('0x17')](0x5)[_0xab15('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab15('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xab15('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xab15('0x22')],'defaultValue':![],'comment':_0xab15('0x4f'),'set':function(_0x343c25){if(!_0x343c25)this[_0xab15('0xd')]('mandatoryDispositionPauseId',null);this[_0xab15('0xd')]('mandatoryDisposition',_0x343c25);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xab15('0x17')](0x3)[_0xab15('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xab15('0x22')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x577a=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20After\x20Greeting\x20Silence','#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\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','ENUM','inbound','outbound','STRING','ringall','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','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.','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x577a,0x104));var _0xa577=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x577a[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xa577('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa577('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x3'),_0xa577('0x4')),'allowNull':![],'defaultValue':_0xa577('0x3')},'musiconhold':{'type':Sequelize[_0xa577('0x5')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xa577('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa577('0x2')]('rr',_0xa577('0x6'),'leastrecent',_0xa577('0x7'),'random',_0xa577('0x8'),_0xa577('0x9'),_0xa577('0xa'),_0xa577('0xb')),'allowNull':![],'defaultValue':_0xa577('0x6'),'set':function(_0x22fd43){this[_0xa577('0xc')]('strategy',_0x22fd43?_0x22fd43:_0xa577('0x8'));},'get':function(){var _0x2bbad3=this[_0xa577('0xd')](_0xa577('0xe'));var _0xf46986=this[_0xa577('0xd')](_0xa577('0xf'));var _0x9931bf=this[_0xa577('0xd')](_0xa577('0x10'));if(_0x2bbad3===_0xa577('0x3')){return _0x9931bf;}if(_0xf46986===_0xa577('0x11')&&_0x9931bf===_0xa577('0x8')||_0xf46986==='booked'&&_0x9931bf===_0xa577('0x12')){return _0x9931bf;}if(_0xf46986===_0xa577('0x13')||_0xf46986===_0xa577('0x14')||_0xf46986===_0xa577('0x15')){return _0x9931bf;}return null;}},'servicelevel':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa577('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa577('0x16')](0xb)},'timeout':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no',_0xa577('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xa577('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xa577('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xa577('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa577('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':_0xa577('0x17')},'announce_holdtime':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa577('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa577('0x5')]},'queue_youarenext':{'type':Sequelize[_0xa577('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xa577('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa577('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa577('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa577('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xa577('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xa577('0x5')]},'queue_less_than':{'type':Sequelize[_0xa577('0x5')]},'periodic_announce':{'type':Sequelize[_0xa577('0x19')],'set':function(_0x406ed7){this[_0xa577('0xc')]('periodic_announce',_0x406ed7?_0x406ed7[_0xa577('0x1a')](','):[]);},'get':function(){return this[_0xa577('0xd')](_0xa577('0x1b'))?this[_0xa577('0xd')]('periodic_announce')[_0xa577('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xa577('0x5')],'defaultValue':_0xa577('0x17'),'set':function(_0x4865a7){this[_0xa577('0xc')](_0xa577('0x1d'),_0x4865a7?_0x4865a7['join'](','):undefined);},'get':function(){return this['getDataValue'](_0xa577('0x1d'))?this[_0xa577('0xd')](_0xa577('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xa577('0x5')],'defaultValue':'no','set':function(_0x235e09){this['setDataValue'](_0xa577('0x1e'),_0x235e09?_0x235e09[_0xa577('0x1a')](','):undefined);},'get':function(){return this[_0xa577('0xd')](_0xa577('0x1e'))?this[_0xa577('0xd')]('leavewhenempty')[_0xa577('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa577('0x5')]},'description':{'type':Sequelize[_0xa577('0x5')]},'acw':{'type':Sequelize[_0xa577('0x1f')],'defaultValue':0x0,'set':function(_0x4f311c){this[_0xa577('0xc')]('acw',_0x4f311c);if(_0x4f311c){if(this[_0xa577('0xd')](_0xa577('0x20'))<0x2){this['setDataValue'](_0xa577('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xa577('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa577('0x21')},'dialMethod':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x22'),_0xa577('0x13'),_0xa577('0x15'),_0xa577('0x14'),_0xa577('0x11')),'defaultValue':_0xa577('0x13'),'comment':_0xa577('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa577('0x24')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xa577('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa577('0x26')},'dialPowerLevel':{'type':Sequelize[_0xa577('0x27')](0x2)[_0xa577('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa577('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xa577('0x2')](_0xa577('0x29'),_0xa577('0x2a')),'defaultValue':_0xa577('0x2a'),'comment':_0xa577('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xa577('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa577('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xa577('0x5')],'defaultValue':_0xa577('0x2c'),'comment':_0xa577('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa577('0x2e')},'dialQueueProject':{'type':Sequelize[_0xa577('0x5')],'comment':_0xa577('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa577('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa577('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa577('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa577('0x16')](0x5)[_0xa577('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa577('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa577('0x16')](0x5)[_0xa577('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa577('0x33')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa577('0x34')},'dialTimezone':{'type':Sequelize[_0xa577('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa577('0x5')],'defaultValue':_0xa577('0x35')},'dialPrefix':{'type':Sequelize[_0xa577('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xa577('0x36'),_0xa577('0x37'),_0xa577('0x38')),'defaultValue':_0xa577('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xa577('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa577('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa577('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa577('0x16')](0x9)[_0xa577('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xa577('0x16')](0x9)[_0xa577('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa577('0x16')](0x9)[_0xa577('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa577('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa577('0x16')](0x9)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa577('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa577('0x16')](0x5)[_0xa577('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa577('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa577('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xa577('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa577('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xa577('0x1f')],'defaultValue':0x0,'comment':_0xa577('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa577('0x2')]('DESC',_0xa577('0x3f')),'defaultValue':_0xa577('0x40')},'dialQueueProject2':{'type':Sequelize[_0xa577('0x5')],'comment':_0xa577('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa577('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa577('0x41')},'dialCutDigit':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa577('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa577('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa577('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa577('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa577('0x45')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa577('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa577('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa577('0x16')](0x5)[_0xa577('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa577('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa577('0x16')](0x5)[_0xa577('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa577('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa577('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa577('0x16')](0x5)[_0xa577('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa577('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa577('0x16')],'allowNull':!![],'comment':_0xa577('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5c50e5){if(!_0x5c50e5)this[_0xa577('0xc')](_0xa577('0x4c'),null);this[_0xa577('0xc')](_0xa577('0x4d'),_0x5c50e5);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa577('0x16')](0x3)[_0xa577('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xa577('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa577('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f936866..6576f8f 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 _0x6340=['offset','undefined','limit','count','set','apply','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','error','stack','send','VoiceQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','includeAll','role','autoAssociation','UserProfileResource','getHoppers','findOne','CmHopper','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','User','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','addAgents','spread','push','format','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json'];(function(_0xa16a25,_0x19a552){var _0x2e6653=function(_0x20f3c1){while(--_0x20f3c1){_0xa16a25['push'](_0xa16a25['shift']());}};_0x2e6653(++_0x19a552);}(_0x6340,0x97));var _0x0634=function(_0x262c39,_0x14b574){_0x262c39=_0x262c39-0x0;var _0x371d00=_0x6340[_0x262c39];return _0x371d00;};'use strict';var emlformat=require(_0x0634('0x0'));var rimraf=require(_0x0634('0x1'));var zipdir=require(_0x0634('0x2'));var jsonpatch=require(_0x0634('0x3'));var rp=require(_0x0634('0x4'));var moment=require(_0x0634('0x5'));var BPromise=require(_0x0634('0x6'));var Mustache=require(_0x0634('0x7'));var util=require('util');var path=require(_0x0634('0x8'));var sox=require(_0x0634('0x9'));var csv=require(_0x0634('0xa'));var ejs=require(_0x0634('0xb'));var fs=require('fs');var fs_extra=require(_0x0634('0xc'));var _=require('lodash');var squel=require(_0x0634('0xd'));var crypto=require('crypto');var jsforce=require(_0x0634('0xe'));var deskjs=require(_0x0634('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0634('0x10'));var Papa=require('papaparse');var Redis=require(_0x0634('0x11'));var authService=require(_0x0634('0x12'));var qs=require(_0x0634('0x13'));var as=require(_0x0634('0x14'));var hardwareService=require(_0x0634('0x15'));var logger=require(_0x0634('0x16'))(_0x0634('0x17'));var utils=require('../../config/utils');var config=require(_0x0634('0x18'));var licenseUtil=require(_0x0634('0x19'));var db=require('../../mysqldb')['db'];config[_0x0634('0x1a')]=_['defaults'](config[_0x0634('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0634('0x1b'))(new Redis(config['redis']));require(_0x0634('0x1c'))[_0x0634('0x1d')](socket);function respondWithStatusCode(_0x9c403b,_0x129955){_0x129955=_0x129955||0xcc;return function(_0x45a80b){if(_0x45a80b){return _0x9c403b[_0x0634('0x1e')](_0x129955);}return _0x9c403b[_0x0634('0x1f')](_0x129955)[_0x0634('0x20')]();};}function respondWithResult(_0x3c2af7,_0x33c2bc){_0x33c2bc=_0x33c2bc||0xc8;return function(_0x4da436){if(_0x4da436){return _0x3c2af7[_0x0634('0x1f')](_0x33c2bc)[_0x0634('0x21')](_0x4da436);}};}function respondWithFilteredResult(_0x178848,_0x5e4f51){return function(_0x482e0a){if(_0x482e0a){var _0x39afbc=typeof _0x5e4f51[_0x0634('0x22')]===_0x0634('0x23')&&typeof _0x5e4f51[_0x0634('0x24')]===_0x0634('0x23');var _0x21a33c=_0x482e0a[_0x0634('0x25')];var _0x33b9fe=_0x39afbc?0x0:_0x5e4f51['offset'];var _0x58437b=_0x39afbc?_0x482e0a[_0x0634('0x25')]:_0x5e4f51[_0x0634('0x22')]+_0x5e4f51[_0x0634('0x24')];var _0x1d35ae;if(_0x58437b>=_0x21a33c){_0x58437b=_0x21a33c;_0x1d35ae=0xc8;}else{_0x1d35ae=0xce;}_0x178848[_0x0634('0x1f')](_0x1d35ae);return _0x178848[_0x0634('0x26')]('Content-Range',_0x33b9fe+'-'+_0x58437b+'/'+_0x21a33c)[_0x0634('0x21')](_0x482e0a);}return null;};}function patchUpdates(_0x6f621f){return function(_0x874705){try{jsonpatch[_0x0634('0x27')](_0x874705,_0x6f621f,!![]);}catch(_0x306408){return BPromise['reject'](_0x306408);}return _0x874705[_0x0634('0x28')]();};}function saveUpdates(_0x18bbd1,_0x4eefae){return function(_0x3c87ee){if(_0x3c87ee){return _0x3c87ee['update'](_0x18bbd1)[_0x0634('0x29')](function(_0x3f569e){return _0x3f569e;});}return null;};}function removeEntity(_0x4e35af,_0x5272f8){return function(_0x4ee26c){if(_0x4ee26c){return _0x4ee26c[_0x0634('0x2a')]()[_0x0634('0x29')](function(){var _0xf0b59f=_0x4ee26c[_0x0634('0x2b')]({'plain':!![]});var _0x4a95a0=[{'name':_0x0634('0x2c'),'value':_0x0634('0x2d'),'ignore':![]},{'name':_0x0634('0x2e'),'value':_0x0634('0x2f'),'ignore':![]}];var _0x2fa79a=_(_0x4a95a0)[_0x0634('0x30')](_0x0634('0x31'))[_0x0634('0x32')](_0x0634('0x33'))[_0x0634('0x33')]();if(_[_0x0634('0x34')](_0x2fa79a,_0xf0b59f[_0x0634('0x35')])){return;}var _0x26bc54=_[_0x0634('0x36')](_0x4a95a0,[_0x0634('0x33'),_0xf0b59f[_0x0634('0x35')]])[_0x0634('0x37')];return db['UserProfileResource'][_0x0634('0x2a')]({'where':{'type':_0x26bc54,'resourceId':_0xf0b59f['id']}})[_0x0634('0x29')](function(){return _0x4ee26c;});})[_0x0634('0x29')](function(){_0x4e35af[_0x0634('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x569cd5,_0x104931){return function(_0x24f35e){if(!_0x24f35e){_0x569cd5['sendStatus'](0x194);}return _0x24f35e;};}function handleError(_0x2f2f02,_0x5d638c){_0x5d638c=_0x5d638c||0x1f4;return function(_0x1cc2f3){logger[_0x0634('0x38')](_0x1cc2f3[_0x0634('0x39')]);if(_0x1cc2f3['name']){delete _0x1cc2f3[_0x0634('0x37')];}_0x2f2f02['status'](_0x5d638c)[_0x0634('0x3a')](_0x1cc2f3);};}exports['index']=function(_0x3e671a,_0x222651){var _0x5924d3={},_0x129a6f={},_0x151875={'count':0x0,'rows':[]};var _0x3e12f7=_[_0x0634('0x32')](db[_0x0634('0x3b')][_0x0634('0x3c')],function(_0x599a3b){return{'name':_0x599a3b[_0x0634('0x3d')],'type':_0x599a3b[_0x0634('0x35')]['key']};});_0x129a6f[_0x0634('0x3e')]=_[_0x0634('0x32')](_0x3e12f7,_0x0634('0x37'));_0x129a6f['query']=_[_0x0634('0x3f')](_0x3e671a[_0x0634('0x40')]);_0x129a6f[_0x0634('0x41')]=_[_0x0634('0x42')](_0x129a6f[_0x0634('0x3e')],_0x129a6f[_0x0634('0x40')]);_0x5924d3[_0x0634('0x43')]=_[_0x0634('0x42')](_0x129a6f[_0x0634('0x3e')],qs[_0x0634('0x44')](_0x3e671a['query'][_0x0634('0x44')]));_0x5924d3[_0x0634('0x43')]=_0x5924d3[_0x0634('0x43')][_0x0634('0x45')]?_0x5924d3[_0x0634('0x43')]:_0x129a6f['model'];if(!_0x3e671a['query'][_0x0634('0x46')](_0x0634('0x47'))){_0x5924d3[_0x0634('0x24')]=qs[_0x0634('0x24')](_0x3e671a['query'][_0x0634('0x24')]);_0x5924d3[_0x0634('0x22')]=qs[_0x0634('0x22')](_0x3e671a['query']['offset']);}_0x5924d3[_0x0634('0x48')]=qs['sort'](_0x3e671a[_0x0634('0x40')][_0x0634('0x49')]);_0x5924d3['where']=qs['filters'](_['pick'](_0x3e671a['query'],_0x129a6f[_0x0634('0x41')]),_0x3e12f7);if(_0x3e671a[_0x0634('0x40')][_0x0634('0x30')]){_0x5924d3[_0x0634('0x4a')]=_[_0x0634('0x4b')](_0x5924d3[_0x0634('0x4a')],{'$or':_[_0x0634('0x32')](_0x3e12f7,function(_0x18df66){if(_0x18df66[_0x0634('0x35')]!=='VIRTUAL'){var _0x50536b={};_0x50536b[_0x18df66[_0x0634('0x37')]]={'$like':'%'+_0x3e671a[_0x0634('0x40')][_0x0634('0x30')]+'%'};return _0x50536b;}})});}_0x5924d3=_['merge']({},_0x5924d3,_0x3e671a[_0x0634('0x4c')]);var _0x4424a1={'where':_0x5924d3[_0x0634('0x4a')]};return db['VoiceQueue'][_0x0634('0x25')](_0x4424a1)[_0x0634('0x29')](function(_0x3ef2a7){_0x151875[_0x0634('0x25')]=_0x3ef2a7;if(_0x3e671a['query']['includeAll']){_0x5924d3[_0x0634('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x0634('0x4e')](_0x5924d3);})['then'](function(_0x9b6dcd){_0x151875[_0x0634('0x4f')]=_0x9b6dcd;return _0x151875;})['then'](respondWithFilteredResult(_0x222651,_0x5924d3))[_0x0634('0x50')](handleError(_0x222651,null));};exports[_0x0634('0x51')]=function(_0x28a69a,_0x444ea2){var _0x1daf33={'raw':![],'where':{'id':_0x28a69a[_0x0634('0x52')]['id']}},_0x22c5d3={};_0x22c5d3['model']=_[_0x0634('0x3f')](db[_0x0634('0x3b')][_0x0634('0x3c')]);_0x22c5d3[_0x0634('0x40')]=_['keys'](_0x28a69a[_0x0634('0x40')]);_0x22c5d3['filters']=_[_0x0634('0x42')](_0x22c5d3[_0x0634('0x3e')],_0x22c5d3[_0x0634('0x40')]);_0x1daf33['attributes']=_[_0x0634('0x42')](_0x22c5d3[_0x0634('0x3e')],qs['fields'](_0x28a69a[_0x0634('0x40')][_0x0634('0x44')]));_0x1daf33['attributes']=_0x1daf33[_0x0634('0x43')][_0x0634('0x45')]?_0x1daf33[_0x0634('0x43')]:_0x22c5d3[_0x0634('0x3e')];if(_0x28a69a[_0x0634('0x40')]['includeAll']){_0x1daf33[_0x0634('0x4d')]=[{'all':!![]}];}_0x1daf33=_[_0x0634('0x4b')]({},_0x1daf33,_0x28a69a[_0x0634('0x4c')]);return db[_0x0634('0x3b')][_0x0634('0x36')](_0x1daf33)['then'](handleEntityNotFound(_0x444ea2,null))[_0x0634('0x29')](respondWithResult(_0x444ea2,null))[_0x0634('0x50')](handleError(_0x444ea2,null));};exports[_0x0634('0x53')]=function(_0x10bd25,_0x38782c){return db[_0x0634('0x3b')][_0x0634('0x53')](_0x10bd25[_0x0634('0x54')],{})['then'](function(_0x249df8){var _0x14c82b=_0x10bd25[_0x0634('0x55')]['get']({'plain':!![]});if(!_0x14c82b)throw new Error(_0x0634('0x56'));if(_0x14c82b['role']===_0x0634('0x55')){var _0x2fb4f3=_0x249df8[_0x0634('0x2b')]({'plain':!![]});var _0x577ece=[{'name':'VoiceQueues','value':_0x0634('0x2d')},{'name':'QueueCampaigns','value':_0x0634('0x2f')}];var _0x555ebf=_[_0x0634('0x36')](_0x577ece,[_0x0634('0x33'),_0x2fb4f3[_0x0634('0x35')]])[_0x0634('0x37')];return db[_0x0634('0x57')][_0x0634('0x36')]({'where':{'name':_0x555ebf,'userProfileId':_0x14c82b[_0x0634('0x58')]},'raw':!![]})[_0x0634('0x29')](function(_0x4ee3d7){if(_0x4ee3d7&&_0x4ee3d7['autoAssociation']===0x0){return db['UserProfileResource'][_0x0634('0x53')]({'name':_0x2fb4f3['name'],'resourceId':_0x2fb4f3['id'],'type':_0x4ee3d7['name'],'sectionId':_0x4ee3d7['id']},{})[_0x0634('0x29')](function(){return _0x249df8;});}else{return _0x249df8;}})['catch'](function(_0x512e25){logger[_0x0634('0x38')](_0x0634('0x59'),_0x512e25);throw _0x512e25;});}return _0x249df8;})[_0x0634('0x29')](respondWithResult(_0x38782c,0xc9))[_0x0634('0x50')](handleError(_0x38782c,null));};exports[_0x0634('0x5a')]=function(_0x27c433,_0x2d1900){var _0x579a6f={'where':{'id':_0x27c433['params']['id']}},_0x270544={};_0x270544['model']=_['keys'](db[_0x0634('0x3b')][_0x0634('0x3c')]);_0x579a6f[_0x0634('0x43')]=_[_0x0634('0x42')](_0x270544['model'],qs[_0x0634('0x44')](_0x27c433[_0x0634('0x40')][_0x0634('0x44')]));_0x579a6f['attributes']=_0x579a6f[_0x0634('0x43')][_0x0634('0x45')]?_0x579a6f[_0x0634('0x43')]:_0x270544[_0x0634('0x3e')];if(_0x27c433[_0x0634('0x40')]['includeAll']){_0x579a6f[_0x0634('0x4d')]=[{'all':!![]}];}_0x579a6f=_[_0x0634('0x4b')]({},_0x579a6f,_0x27c433['options']);return db['VoiceQueue'][_0x0634('0x36')](_0x579a6f)[_0x0634('0x29')](handleEntityNotFound(_0x2d1900,null))[_0x0634('0x29')](function(_0x2f313f){if(_0x2f313f){var _0x317206=_0x2f313f['get']({'plain':!![]});_0x317206=qs[_0x0634('0x5b')](_0x317206,['id',_0x0634('0x5c'),_0x0634('0x5d')]);_0x27c433[_0x0634('0x54')]=_[_0x0634('0x5b')](_0x27c433[_0x0634('0x54')],['id',_0x0634('0x5c'),'updatedAt']);return db[_0x0634('0x3b')][_0x0634('0x53')](_['merge'](_0x317206,_0x27c433[_0x0634('0x54')]),{'include':_0x27c433[_0x0634('0x40')][_0x0634('0x5e')]?[{'all':!![]}]:undefined})[_0x0634('0x29')](function(_0x59f91e){var _0x2184cd=_0x27c433['user'][_0x0634('0x2b')]({'plain':!![]});if(!_0x2184cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2184cd[_0x0634('0x5f')]===_0x0634('0x55')){var _0x1d149e=_0x59f91e[_0x0634('0x2b')]({'plain':!![]});var _0x28e6d7=[{'name':'VoiceQueues','value':_0x0634('0x2d')},{'name':_0x0634('0x2e'),'value':_0x0634('0x2f')}];var _0x3859cb=_[_0x0634('0x36')](_0x28e6d7,[_0x0634('0x33'),_0x1d149e[_0x0634('0x35')]])[_0x0634('0x37')];return db['UserProfileSection'][_0x0634('0x36')]({'where':{'name':_0x3859cb,'userProfileId':_0x2184cd[_0x0634('0x58')]},'raw':!![]})['then'](function(_0x4a3923){if(_0x4a3923&&_0x4a3923[_0x0634('0x60')]===0x0){return db[_0x0634('0x61')]['create']({'name':_0x1d149e[_0x0634('0x37')],'resourceId':_0x1d149e['id'],'type':_0x4a3923[_0x0634('0x37')],'sectionId':_0x4a3923['id']},{})[_0x0634('0x29')](function(){return _0x59f91e;});}else{return _0x59f91e;}})[_0x0634('0x50')](function(_0x253d6d){logger['error'](_0x0634('0x59'),_0x253d6d);throw _0x253d6d;});}return _0x59f91e;});}})['then'](respondWithResult(_0x2d1900,0xc9))['catch'](handleError(_0x2d1900,null));};exports['update']=function(_0x435333,_0x4ed68e){if(_0x435333[_0x0634('0x54')]['id']){delete _0x435333[_0x0634('0x54')]['id'];}return db[_0x0634('0x3b')][_0x0634('0x36')]({'where':{'id':_0x435333['params']['id']}})['then'](handleEntityNotFound(_0x4ed68e,null))[_0x0634('0x29')](saveUpdates(_0x435333[_0x0634('0x54')],null))[_0x0634('0x29')](respondWithResult(_0x4ed68e,null))[_0x0634('0x50')](handleError(_0x4ed68e,null));};exports['destroy']=function(_0x1a8a89,_0x56fe58){return db['VoiceQueue'][_0x0634('0x36')]({'where':{'id':_0x1a8a89[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x56fe58,null))[_0x0634('0x29')](removeEntity(_0x56fe58,null))[_0x0634('0x50')](handleError(_0x56fe58,null));};exports[_0x0634('0x62')]=function(_0x18b2d2,_0x11d28e,_0xd6cf31){var _0x2c1825={'raw':![],'where':{}};var _0x3522ab={};var _0x138c9e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0634('0x63')]({'where':{'id':_0x18b2d2['params']['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x11d28e,null))[_0x0634('0x29')](function(_0x9ea9e9){if(_0x9ea9e9){_0x3522ab[_0x0634('0x3e')]=_[_0x0634('0x3f')](db[_0x0634('0x64')][_0x0634('0x3c')]);_0x3522ab[_0x0634('0x40')]=_[_0x0634('0x3f')](_0x18b2d2[_0x0634('0x40')]);_0x3522ab['filters']=_[_0x0634('0x42')](_0x3522ab[_0x0634('0x3e')],_0x3522ab[_0x0634('0x40')]);_0x2c1825[_0x0634('0x43')]=_[_0x0634('0x42')](_0x3522ab[_0x0634('0x3e')],qs[_0x0634('0x44')](_0x18b2d2[_0x0634('0x40')][_0x0634('0x44')]));_0x2c1825['attributes']=_0x2c1825['attributes'][_0x0634('0x45')]?_0x2c1825[_0x0634('0x43')]:_0x3522ab[_0x0634('0x3e')];if(!_0x18b2d2[_0x0634('0x40')]['hasOwnProperty']('nolimit')){_0x2c1825['limit']=qs[_0x0634('0x24')](_0x18b2d2[_0x0634('0x40')][_0x0634('0x24')]);_0x2c1825['offset']=qs['offset'](_0x18b2d2[_0x0634('0x40')]['offset']);}_0x2c1825[_0x0634('0x48')]=qs[_0x0634('0x49')](_0x18b2d2['query'][_0x0634('0x49')]);_0x2c1825['where']=qs['filters'](_[_0x0634('0x65')](_0x18b2d2[_0x0634('0x40')],_0x3522ab['filters']));_0x2c1825[_0x0634('0x4a')][_0x0634('0x66')]=_0x9ea9e9['id'];if(_0x18b2d2[_0x0634('0x40')][_0x0634('0x30')]){_0x2c1825[_0x0634('0x4a')]=_['merge'](_0x2c1825[_0x0634('0x4a')],{'$or':_[_0x0634('0x32')](_0x2c1825[_0x0634('0x43')],function(_0x59a917){var _0x1328f5={};_0x1328f5[_0x59a917]={'$like':'%'+_0x18b2d2[_0x0634('0x40')][_0x0634('0x30')]+'%'};return _0x1328f5;})});}_0x2c1825=_['merge']({},_0x2c1825,_0x18b2d2[_0x0634('0x4c')]);return db['CmHopper'][_0x0634('0x25')]({'where':_0x2c1825[_0x0634('0x4a')]})[_0x0634('0x29')](function(_0xeb6c66){_0x138c9e[_0x0634('0x25')]=_0xeb6c66;if(_0x18b2d2[_0x0634('0x40')]['includeAll']){_0x2c1825[_0x0634('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0x0634('0x4e')](_0x2c1825);})['then'](function(_0x405185){_0x138c9e['rows']=_0x405185;return _0x138c9e;});}})[_0x0634('0x29')](respondWithFilteredResult(_0x11d28e,_0x2c1825))[_0x0634('0x50')](handleError(_0x11d28e,null));};exports[_0x0634('0x67')]=function(_0x1f4c51,_0x2548e3,_0xdb40a0){var _0x10ebc9={'raw':!![],'where':{}};var _0x386734={};var _0x5b789b={'count':0x0,'rows':[]};return db[_0x0634('0x3b')][_0x0634('0x63')]({'where':{'id':_0x1f4c51['params']['id']}})['then'](handleEntityNotFound(_0x2548e3,null))[_0x0634('0x29')](function(_0x120485){if(_0x120485){_0x386734[_0x0634('0x3e')]=_[_0x0634('0x3f')](db[_0x0634('0x68')][_0x0634('0x3c')]);_0x386734['query']=_[_0x0634('0x3f')](_0x1f4c51[_0x0634('0x40')]);_0x386734[_0x0634('0x41')]=_['intersection'](_0x386734[_0x0634('0x3e')],_0x386734['query']);_0x10ebc9['attributes']=_['intersection'](_0x386734[_0x0634('0x3e')],qs[_0x0634('0x44')](_0x1f4c51['query'][_0x0634('0x44')]));_0x10ebc9['attributes']=_0x10ebc9[_0x0634('0x43')][_0x0634('0x45')]?_0x10ebc9[_0x0634('0x43')]:_0x386734[_0x0634('0x3e')];if(!_0x1f4c51[_0x0634('0x40')][_0x0634('0x46')](_0x0634('0x47'))){_0x10ebc9['limit']=qs['limit'](_0x1f4c51[_0x0634('0x40')]['limit']);_0x10ebc9[_0x0634('0x22')]=qs[_0x0634('0x22')](_0x1f4c51[_0x0634('0x40')][_0x0634('0x22')]);}_0x10ebc9[_0x0634('0x48')]=qs[_0x0634('0x49')](_0x1f4c51[_0x0634('0x40')]['sort']);_0x10ebc9[_0x0634('0x4a')]=qs['filters'](_['pick'](_0x1f4c51[_0x0634('0x40')],_0x386734[_0x0634('0x41')]));_0x10ebc9['where'][_0x0634('0x66')]=_0x120485['id'];if(_0x1f4c51[_0x0634('0x40')][_0x0634('0x30')]){_0x10ebc9[_0x0634('0x4a')]=_['merge'](_0x10ebc9[_0x0634('0x4a')],{'$or':_[_0x0634('0x32')](_0x10ebc9[_0x0634('0x43')],function(_0x10a5fa){var _0x17a0c1={};_0x17a0c1[_0x10a5fa]={'$like':'%'+_0x1f4c51[_0x0634('0x40')][_0x0634('0x30')]+'%'};return _0x17a0c1;})});}_0x10ebc9=_[_0x0634('0x4b')]({},_0x10ebc9,_0x1f4c51['options']);return db[_0x0634('0x68')][_0x0634('0x25')]({'where':_0x10ebc9['where']})[_0x0634('0x29')](function(_0x4d95e1){_0x5b789b[_0x0634('0x25')]=_0x4d95e1;if(_0x1f4c51[_0x0634('0x40')]['includeAll']){_0x10ebc9[_0x0634('0x4d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0634('0x4e')](_0x10ebc9);})[_0x0634('0x29')](function(_0x5359e5){_0x5b789b['rows']=_0x5359e5;return _0x5b789b;});}})[_0x0634('0x29')](respondWithFilteredResult(_0x2548e3,_0x10ebc9))[_0x0634('0x50')](handleError(_0x2548e3,null));};exports[_0x0634('0x69')]=function(_0x37377c,_0x571623,_0x41a5d2){var _0x1f09a8={'raw':!![],'where':{}};var _0x92289d={};var _0x252002={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0634('0x63')]({'where':{'id':_0x37377c[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x571623,null))[_0x0634('0x29')](function(_0x27ba36){if(_0x27ba36){_0x92289d[_0x0634('0x3e')]=_['keys'](db[_0x0634('0x6a')][_0x0634('0x3c')]);_0x92289d[_0x0634('0x40')]=_['keys'](_0x37377c['query']);_0x92289d[_0x0634('0x41')]=_[_0x0634('0x42')](_0x92289d[_0x0634('0x3e')],_0x92289d[_0x0634('0x40')]);_0x1f09a8[_0x0634('0x43')]=_[_0x0634('0x42')](_0x92289d[_0x0634('0x3e')],qs[_0x0634('0x44')](_0x37377c[_0x0634('0x40')][_0x0634('0x44')]));_0x1f09a8[_0x0634('0x43')]=_0x1f09a8[_0x0634('0x43')][_0x0634('0x45')]?_0x1f09a8[_0x0634('0x43')]:_0x92289d[_0x0634('0x3e')];if(!_0x37377c['query'][_0x0634('0x46')]('nolimit')){_0x1f09a8[_0x0634('0x24')]=qs[_0x0634('0x24')](_0x37377c[_0x0634('0x40')]['limit']);_0x1f09a8[_0x0634('0x22')]=qs[_0x0634('0x22')](_0x37377c[_0x0634('0x40')][_0x0634('0x22')]);}_0x1f09a8[_0x0634('0x48')]=qs[_0x0634('0x49')](_0x37377c[_0x0634('0x40')][_0x0634('0x49')]);_0x1f09a8[_0x0634('0x4a')]=qs[_0x0634('0x41')](_[_0x0634('0x65')](_0x37377c[_0x0634('0x40')],_0x92289d['filters']));_0x1f09a8['where'][_0x0634('0x66')]=_0x27ba36['id'];if(_0x37377c[_0x0634('0x40')][_0x0634('0x30')]){_0x1f09a8[_0x0634('0x4a')]=_[_0x0634('0x4b')](_0x1f09a8['where'],{'$or':_['map'](_0x1f09a8[_0x0634('0x43')],function(_0x467c18){var _0x58c28d={};_0x58c28d[_0x467c18]={'$like':'%'+_0x37377c[_0x0634('0x40')][_0x0634('0x30')]+'%'};return _0x58c28d;})});}_0x1f09a8=_[_0x0634('0x4b')]({},_0x1f09a8,_0x37377c[_0x0634('0x4c')]);return db[_0x0634('0x6a')][_0x0634('0x25')]({'where':_0x1f09a8[_0x0634('0x4a')]})[_0x0634('0x29')](function(_0x42be04){_0x252002[_0x0634('0x25')]=_0x42be04;if(_0x37377c['query'][_0x0634('0x5e')]){_0x1f09a8[_0x0634('0x4d')]=[{'all':!![]}];}return db[_0x0634('0x6a')][_0x0634('0x4e')](_0x1f09a8);})[_0x0634('0x29')](function(_0x54784a){_0x252002[_0x0634('0x4f')]=_0x54784a;return _0x252002;});}})[_0x0634('0x29')](respondWithFilteredResult(_0x571623,_0x1f09a8))[_0x0634('0x50')](handleError(_0x571623,null));};exports['getHopperBlacks']=function(_0x1b74ef,_0x219b75,_0x2e6eeb){var _0x40940f={'raw':!![],'where':{}};var _0x3e28f2={};var _0x2ba711={'count':0x0,'rows':[]};return db[_0x0634('0x3b')][_0x0634('0x63')]({'where':{'id':_0x1b74ef[_0x0634('0x52')]['id']}})['then'](handleEntityNotFound(_0x219b75,null))[_0x0634('0x29')](function(_0x1e58a8){if(_0x1e58a8){_0x3e28f2['model']=_['keys'](db[_0x0634('0x6b')][_0x0634('0x3c')]);_0x3e28f2[_0x0634('0x40')]=_[_0x0634('0x3f')](_0x1b74ef[_0x0634('0x40')]);_0x3e28f2['filters']=_[_0x0634('0x42')](_0x3e28f2[_0x0634('0x3e')],_0x3e28f2[_0x0634('0x40')]);_0x40940f[_0x0634('0x43')]=_[_0x0634('0x42')](_0x3e28f2[_0x0634('0x3e')],qs[_0x0634('0x44')](_0x1b74ef[_0x0634('0x40')][_0x0634('0x44')]));_0x40940f['attributes']=_0x40940f[_0x0634('0x43')][_0x0634('0x45')]?_0x40940f[_0x0634('0x43')]:_0x3e28f2[_0x0634('0x3e')];if(!_0x1b74ef[_0x0634('0x40')][_0x0634('0x46')](_0x0634('0x47'))){_0x40940f['limit']=qs[_0x0634('0x24')](_0x1b74ef[_0x0634('0x40')][_0x0634('0x24')]);_0x40940f[_0x0634('0x22')]=qs['offset'](_0x1b74ef[_0x0634('0x40')]['offset']);}_0x40940f[_0x0634('0x48')]=qs['sort'](_0x1b74ef[_0x0634('0x40')][_0x0634('0x49')]);_0x40940f[_0x0634('0x4a')]=qs['filters'](_[_0x0634('0x65')](_0x1b74ef[_0x0634('0x40')],_0x3e28f2[_0x0634('0x41')]));_0x40940f[_0x0634('0x4a')]['VoiceQueueId']=_0x1e58a8['id'];if(_0x1b74ef[_0x0634('0x40')][_0x0634('0x30')]){_0x40940f[_0x0634('0x4a')]=_['merge'](_0x40940f[_0x0634('0x4a')],{'$or':_[_0x0634('0x32')](_0x40940f[_0x0634('0x43')],function(_0x958f8f){var _0x2b3c35={};_0x2b3c35[_0x958f8f]={'$like':'%'+_0x1b74ef['query'][_0x0634('0x30')]+'%'};return _0x2b3c35;})});}_0x40940f=_[_0x0634('0x4b')]({},_0x40940f,_0x1b74ef[_0x0634('0x4c')]);return db['CmHopperBlack'][_0x0634('0x25')]({'where':_0x40940f['where']})[_0x0634('0x29')](function(_0x2c21d5){_0x2ba711[_0x0634('0x25')]=_0x2c21d5;if(_0x1b74ef[_0x0634('0x40')][_0x0634('0x5e')]){_0x40940f[_0x0634('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0634('0x4e')](_0x40940f);})['then'](function(_0x3dfa0e){_0x2ba711[_0x0634('0x4f')]=_0x3dfa0e;return _0x2ba711;});}})[_0x0634('0x29')](respondWithFilteredResult(_0x219b75,_0x40940f))[_0x0634('0x50')](handleError(_0x219b75,null));};exports[_0x0634('0x6c')]=function(_0x2a8290,_0x1fb008,_0x4436a8){var _0xb7e21c={};var _0x397edf={};var _0x1eb456;var _0x500f0b;return db['VoiceQueue']['findOne']({'where':{'id':_0x2a8290[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x1fb008,null))['then'](function(_0x24cabe){if(_0x24cabe){_0x1eb456=_0x24cabe;_0x397edf[_0x0634('0x3e')]=_[_0x0634('0x3f')](db['Team'][_0x0634('0x3c')]);_0x397edf[_0x0634('0x40')]=_[_0x0634('0x3f')](_0x2a8290['query']);_0x397edf[_0x0634('0x41')]=_[_0x0634('0x42')](_0x397edf[_0x0634('0x3e')],_0x397edf[_0x0634('0x40')]);_0xb7e21c[_0x0634('0x43')]=_[_0x0634('0x42')](_0x397edf['model'],qs['fields'](_0x2a8290[_0x0634('0x40')][_0x0634('0x44')]));_0xb7e21c[_0x0634('0x43')]=_0xb7e21c[_0x0634('0x43')][_0x0634('0x45')]?_0xb7e21c['attributes']:_0x397edf[_0x0634('0x3e')];_0xb7e21c[_0x0634('0x48')]=qs['sort'](_0x2a8290[_0x0634('0x40')][_0x0634('0x49')]);_0xb7e21c[_0x0634('0x4a')]=qs[_0x0634('0x41')](_[_0x0634('0x65')](_0x2a8290['query'],_0x397edf['filters']));if(_0x2a8290[_0x0634('0x40')][_0x0634('0x30')]){_0xb7e21c['where']=_[_0x0634('0x4b')](_0xb7e21c[_0x0634('0x4a')],{'$or':_['map'](_0xb7e21c[_0x0634('0x43')],function(_0x36fd42){var _0x3ec90b={};_0x3ec90b[_0x36fd42]={'$like':'%'+_0x2a8290[_0x0634('0x40')][_0x0634('0x30')]+'%'};return _0x3ec90b;})});}_0xb7e21c=_[_0x0634('0x4b')]({},_0xb7e21c,_0x2a8290['options']);return _0x1eb456[_0x0634('0x6c')](_0xb7e21c);}})[_0x0634('0x29')](function(_0x53fabd){if(_0x53fabd){_0x500f0b=_0x53fabd[_0x0634('0x45')];if(!_0x2a8290['query'][_0x0634('0x46')](_0x0634('0x47'))){_0xb7e21c['limit']=qs[_0x0634('0x24')](_0x2a8290[_0x0634('0x40')][_0x0634('0x24')]);_0xb7e21c['offset']=qs[_0x0634('0x22')](_0x2a8290[_0x0634('0x40')]['offset']);}return _0x1eb456['getTeams'](_0xb7e21c);}})[_0x0634('0x29')](function(_0x2d3139){if(_0x2d3139){return _0x2d3139?{'count':_0x500f0b,'rows':_0x2d3139}:null;}})[_0x0634('0x29')](respondWithResult(_0x1fb008,null))[_0x0634('0x50')](handleError(_0x1fb008,null));};exports[_0x0634('0x6d')]=function(_0x5a1376,_0x301bcc,_0x56350d){var _0x1cfd00=_0x5a1376[_0x0634('0x54')][_0x0634('0x6e')];var _0x5de748=_['map'](_0x1cfd00,'id');return db[_0x0634('0x6f')][_0x0634('0x4e')]({'where':{'id':_0x5de748},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0634('0x70'),'attributes':['id',_0x0634('0x37'),_0x0634('0x71'),'voicePause',_0x0634('0x72')],'raw':!![]}]})[_0x0634('0x29')](function(_0x59225a){if(_0x59225a){var _0x1fd2a6=_[_0x0634('0x73')](_0x59225a,function(_0xa46390){var _0xa030c4=_0xa46390[_0x0634('0x2b')]({'plain':!![]});_0xa030c4['Agents'][_0x0634('0x74')](function(_0x4c31f1){_0x4c31f1[_0x0634('0x75')]=_[_0x0634('0x36')](_0x1cfd00,{'id':_0xa030c4['id']})[_0x0634('0x75')];});return _0xa030c4['Agents'];});return db[_0x0634('0x3b')][_0x0634('0x36')]({'where':{'id':_0x5a1376[_0x0634('0x52')]['id']}})[_0x0634('0x29')](function(_0x35d2c1){return db[_0x0634('0x76')][_0x0634('0x77')](function(_0x8f046e){return _0x35d2c1['addTeams'](_0x5de748,{'transaction':_0x8f046e})[_0x0634('0x29')](function(){return BPromise['each'](_0x1cfd00,function(_0x155c50){return db['TeamVoiceQueue'][_0x0634('0x78')]({'TeamId':_0x155c50['id'],'VoiceQueueId':_0x5a1376['params']['id'],'penalty':_0x155c50[_0x0634('0x75')]},{'transaction':_0x8f046e});});})[_0x0634('0x29')](function(){return BPromise[_0x0634('0x79')](_0x1fd2a6,function(_0x1eac5){return db[_0x0634('0x7a')][_0x0634('0x7b')]({'where':{'UserId':_0x1eac5['id'],'VoiceQueueId':_0x5a1376['params']['id']},'defaults':{'penalty':_0x1eac5['penalty']},'transaction':_0x8f046e});});})['then'](function(){return BPromise['each'](_[_0x0634('0x30')](_0x1fd2a6,{'online':!![]}),function(_0x36c4d5){return db[_0x0634('0x7c')]['upsert']({'membername':_0x36c4d5[_0x0634('0x37')],'UserId':_0x36c4d5['id'],'queue_name':_0x35d2c1[_0x0634('0x37')],'VoiceQueueId':_0x35d2c1['id'],'interface':_[_0x0634('0x7d')](_0x36c4d5[_0x0634('0x72')])?util['format'](_0x0634('0x7e'),_0x36c4d5[_0x0634('0x37')]):_0x36c4d5[_0x0634('0x72')],'paused':_0x36c4d5[_0x0634('0x7f')]||![],'penalty':_0x36c4d5['penalty']},{'transaction':_0x8f046e});});})[_0x0634('0x29')](function(){_0x1fd2a6['forEach'](function(_0x4f3049){socket[_0x0634('0x80')](_0x0634('0x81'),{'UserId':_0x4f3049['id'],'VoiceQueueId':_0x35d2c1['id']});});});});});}})[_0x0634('0x29')](respondWithStatusCode(_0x301bcc,null))[_0x0634('0x50')](handleError(_0x301bcc,null));};exports[_0x0634('0x82')]=function(_0xb7320a,_0x4bd77b,_0x323122){return db['Team'][_0x0634('0x4e')]({'where':{'id':_0xb7320a[_0x0634('0x40')][_0x0634('0x83')]},'attributes':['id'],'include':[{'model':db[_0x0634('0x84')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4bd77b,null))[_0x0634('0x29')](function(_0x41538a){var _0x26c825=_[_0x0634('0x32')](_0x41538a,'id');var _0x57bd1f=[];var _0xa0c792=[];var _0xbce37d=squel['select']();_0xbce37d[_0x0634('0x85')](_0x0634('0x86'))[_0x0634('0x87')](_0x0634('0x88'),'tq')['join']('user_has_teams','ut',_0x0634('0x89'))[_0x0634('0x4a')](_0x0634('0x8a'),_0xb7320a['params']['id']);for(var _0x216997=0x0;_0x216997<_0x41538a['length'];_0x216997+=0x1){let _0x54e1b1=_0x41538a[_0x216997];for(var _0x51c131=0x0;_0x51c131<_0x54e1b1[_0x0634('0x70')]['length'];_0x51c131+=0x1){let _0x4ef6b5=_0x54e1b1[_0x0634('0x70')][_0x51c131];var _0x4f9268=_0xbce37d[_0x0634('0x5a')]();_0x4f9268['where'](_0x0634('0x8b'),_0x4ef6b5['id']);_0xa0c792['push'](db[_0x0634('0x76')][_0x0634('0x40')](_0x4f9268['toString'](),{'type':db[_0x0634('0x76')][_0x0634('0x8c')][_0x0634('0x8d')]})[_0x0634('0x29')](function(_0x1898e6){if(_0x1898e6['length']===0x1){return _0x4ef6b5['id'];}else{var _0x19a49e=_[_0x0634('0x8e')](_[_0x0634('0x32')](_0x1898e6,_0x0634('0x8f')),function(_0x3bb134){return _['includes'](_0x26c825,_0x3bb134);});if(_0x19a49e){return _0x4ef6b5['id'];}}}));}}return BPromise[_0x0634('0x90')](_0xa0c792)['then'](function(_0x5ce0f0){_0x57bd1f=_(_0x57bd1f)[_0x0634('0x91')](_0x5ce0f0)['compact']()[_0x0634('0x33')]();return db['VoiceQueue'][_0x0634('0x36')]({'where':{'id':_0xb7320a['params']['id']}})[_0x0634('0x29')](function(_0x323f7c){return db['sequelize'][_0x0634('0x77')](function(_0x2855a5){return _0x323f7c[_0x0634('0x82')](_0xb7320a[_0x0634('0x40')][_0x0634('0x83')],{'transaction':_0x2855a5})['then'](function(){if(!_[_0x0634('0x92')](_0x57bd1f)){return _0x323f7c[_0x0634('0x93')](_0x57bd1f,{'transaction':_0x2855a5})[_0x0634('0x29')](function(){return db[_0x0634('0x7c')][_0x0634('0x2a')]({'where':{'VoiceQueueId':_0xb7320a[_0x0634('0x52')]['id'],'UserId':_0x57bd1f},'transaction':_0x2855a5});});}})[_0x0634('0x29')](function(){_0x57bd1f['forEach'](function(_0x18c1f3){socket[_0x0634('0x80')]('userVoiceQueue:remove',{'UserId':_0x18c1f3,'VoiceQueueId':_0x323f7c['id']});});});});});});})[_0x0634('0x29')](respondWithStatusCode(_0x4bd77b,null))[_0x0634('0x50')](handleError(_0x4bd77b,null));};exports[_0x0634('0x94')]=function(_0x1f9ec1,_0x15a093,_0x302932){var _0x36d05c,_0x511c99;return db[_0x0634('0x3b')][_0x0634('0x36')]({'where':{'id':_0x1f9ec1[_0x0634('0x52')]['id']}})['then'](handleEntityNotFound(_0x15a093,null))['then'](function(_0x776969){if(_0x776969){_0x511c99=_0x776969;return _0x776969['addAgents'](_0x1f9ec1[_0x0634('0x54')][_0x0634('0x83')],_[_0x0634('0x5b')](_0x1f9ec1[_0x0634('0x54')],[_0x0634('0x83'),'id'])||{})[_0x0634('0x95')](function(_0x3c7bf4){for(var _0x11b1ed=0x0;_0x11b1ed<_0x1f9ec1[_0x0634('0x54')][_0x0634('0x83')][_0x0634('0x45')];_0x11b1ed+=0x1){socket[_0x0634('0x80')](_0x0634('0x81'),{'UserId':Number(_0x1f9ec1[_0x0634('0x54')][_0x0634('0x83')][_0x11b1ed]),'VoiceQueueId':Number(_0x1f9ec1[_0x0634('0x52')]['id'])});}return _0x3c7bf4;});}})[_0x0634('0x29')](function(_0xa9b938){_0x36d05c=_0xa9b938||[];if(_0x511c99){return db['User'][_0x0634('0x4e')]({'where':{'id':_0x1f9ec1[_0x0634('0x54')]['ids']},'attributes':['id',_0x0634('0x37'),_0x0634('0x71'),'voicePause',_0x0634('0x72')],'raw':!![]});}})['then'](function(_0xaf54f4){if(!_[_0x0634('0x92')](_0xaf54f4)){var _0x4e7b17=[];for(var _0xff260c=0x0;_0xff260c<_0xaf54f4['length'];_0xff260c++){if(_0xaf54f4[_0xff260c]['online']){_0x4e7b17[_0x0634('0x96')](db[_0x0634('0x7c')]['upsert']({'membername':_0xaf54f4[_0xff260c][_0x0634('0x37')],'UserId':_0xaf54f4[_0xff260c]['id'],'queue_name':_0x511c99[_0x0634('0x37')],'VoiceQueueId':_0x511c99['id'],'interface':_[_0x0634('0x7d')](_0xaf54f4[_0xff260c][_0x0634('0x72')])?util[_0x0634('0x97')](_0x0634('0x7e'),_0xaf54f4[_0xff260c][_0x0634('0x37')]):_0xaf54f4[_0xff260c][_0x0634('0x72')],'paused':_0xaf54f4[_0xff260c][_0x0634('0x7f')]||![],'penalty':_0x1f9ec1[_0x0634('0x54')][_0x0634('0x75')]||0x0}));}}return BPromise[_0x0634('0x90')](_0x4e7b17);}})[_0x0634('0x29')](function(){return _0x36d05c;})[_0x0634('0x29')](respondWithResult(_0x15a093,null))[_0x0634('0x50')](handleError(_0x15a093,null));};exports[_0x0634('0x93')]=function(_0x286202,_0x27a389,_0x4925bb){return db[_0x0634('0x3b')][_0x0634('0x36')]({'where':{'id':_0x286202[_0x0634('0x52')]['id']}})['then'](handleEntityNotFound(_0x27a389,null))[_0x0634('0x29')](function(_0x3bbc14){if(_0x3bbc14){return _0x3bbc14[_0x0634('0x93')](_0x286202[_0x0634('0x40')]['ids'])['then'](function(){if(_[_0x0634('0x98')](_0x286202['query'][_0x0634('0x83')])){for(var _0x2da224=0x0;_0x2da224<_0x286202[_0x0634('0x40')][_0x0634('0x83')][_0x0634('0x45')];_0x2da224+=0x1){socket[_0x0634('0x80')](_0x0634('0x99'),{'UserId':Number(_0x286202[_0x0634('0x40')][_0x0634('0x83')][_0x2da224]),'VoiceQueueId':Number(_0x286202[_0x0634('0x52')]['id'])});}}else{socket['emit'](_0x0634('0x99'),{'UserId':Number(_0x286202[_0x0634('0x40')]['ids']),'VoiceQueueId':Number(_0x286202[_0x0634('0x52')]['id'])});}});}})[_0x0634('0x29')](function(_0x4d371a){return db['UserVoiceQueueRt'][_0x0634('0x2a')]({'where':{'VoiceQueueId':_0x286202[_0x0634('0x52')]['id'],'UserId':_0x286202['query']['ids']}})['then'](function(){return _0x4d371a;});})[_0x0634('0x29')](respondWithStatusCode(_0x27a389,null))[_0x0634('0x50')](handleError(_0x27a389,null));};exports[_0x0634('0x9a')]=function(_0xef8018,_0x3a5acd,_0x4a35e7){var _0x5d1526={};var _0x29ece9={};var _0x642e78;var _0x586429;return db['VoiceQueue'][_0x0634('0x63')]({'where':{'id':_0xef8018[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x3a5acd,null))['then'](function(_0x4b4fc0){if(_0x4b4fc0){_0x642e78=_0x4b4fc0;_0x29ece9[_0x0634('0x3e')]=_[_0x0634('0x3f')](db['User'][_0x0634('0x3c')]);_0x29ece9[_0x0634('0x40')]=_['keys'](_0xef8018[_0x0634('0x40')]);_0x29ece9['filters']=_['intersection'](_0x29ece9[_0x0634('0x3e')],_0x29ece9[_0x0634('0x40')]);_0x5d1526[_0x0634('0x43')]=_['intersection'](_0x29ece9['model'],qs[_0x0634('0x44')](_0xef8018[_0x0634('0x40')][_0x0634('0x44')]));_0x5d1526[_0x0634('0x43')]=_0x5d1526[_0x0634('0x43')][_0x0634('0x45')]?_0x5d1526['attributes']:_0x29ece9[_0x0634('0x3e')];_0x5d1526['order']=qs[_0x0634('0x49')](_0xef8018['query'][_0x0634('0x49')]);_0x5d1526[_0x0634('0x4a')]=qs[_0x0634('0x41')](_['pick'](_0xef8018['query'],_0x29ece9[_0x0634('0x41')]));if(_0xef8018[_0x0634('0x40')][_0x0634('0x30')]){_0x5d1526[_0x0634('0x4a')]=_['merge'](_0x5d1526[_0x0634('0x4a')],{'$or':_[_0x0634('0x32')](_0x5d1526[_0x0634('0x43')],function(_0xb8d6db){var _0x3e3442={};_0x3e3442[_0xb8d6db]={'$like':'%'+_0xef8018[_0x0634('0x40')][_0x0634('0x30')]+'%'};return _0x3e3442;})});}_0x5d1526=_[_0x0634('0x4b')]({},_0x5d1526,_0xef8018['options']);return _0x642e78[_0x0634('0x9a')](_0x5d1526);}})[_0x0634('0x29')](function(_0x19fd29){if(_0x19fd29){_0x586429=_0x19fd29[_0x0634('0x45')];if(!_0xef8018['query'][_0x0634('0x46')](_0x0634('0x47'))){_0x5d1526['limit']=qs['limit'](_0xef8018['query']['limit']);_0x5d1526[_0x0634('0x22')]=qs['offset'](_0xef8018[_0x0634('0x40')][_0x0634('0x22')]);}return _0x642e78[_0x0634('0x9a')](_0x5d1526);}})[_0x0634('0x29')](function(_0x32de78){if(_0x32de78){return _0x32de78?{'count':_0x586429,'rows':_0x32de78}:null;}})['then'](respondWithResult(_0x3a5acd,null))[_0x0634('0x50')](handleError(_0x3a5acd,null));};exports[_0x0634('0x9b')]=function(_0x1f13e9,_0x3f49de,_0x5f550a){var _0x3d7fd7={};var _0x54dc56={};var _0x1277f0;var _0x2a2afe;return db['VoiceQueue']['findOne']({'where':{'id':_0x1f13e9[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x3f49de,null))[_0x0634('0x29')](function(_0x42121e){if(_0x42121e){_0x1277f0=_0x42121e;_0x54dc56[_0x0634('0x3e')]=_[_0x0634('0x3f')](db[_0x0634('0x7c')]['rawAttributes']);_0x54dc56[_0x0634('0x40')]=_[_0x0634('0x3f')](_0x1f13e9[_0x0634('0x40')]);_0x54dc56[_0x0634('0x41')]=_['intersection'](_0x54dc56[_0x0634('0x3e')],_0x54dc56['query']);_0x3d7fd7['attributes']=_['intersection'](_0x54dc56['model'],qs[_0x0634('0x44')](_0x1f13e9[_0x0634('0x40')][_0x0634('0x44')]));_0x3d7fd7[_0x0634('0x43')]=_0x3d7fd7[_0x0634('0x43')][_0x0634('0x45')]?_0x3d7fd7[_0x0634('0x43')]:_0x54dc56['model'];_0x3d7fd7[_0x0634('0x48')]=qs[_0x0634('0x49')](_0x1f13e9['query']['sort']);_0x3d7fd7[_0x0634('0x4a')]=qs[_0x0634('0x41')](_['pick'](_0x1f13e9[_0x0634('0x40')],_0x54dc56[_0x0634('0x41')]));if(_0x1f13e9[_0x0634('0x40')]['filter']){_0x3d7fd7['where']=_['merge'](_0x3d7fd7[_0x0634('0x4a')],{'$or':_[_0x0634('0x32')](_0x3d7fd7[_0x0634('0x43')],function(_0x63a2c3){var _0x5d5ea0={};_0x5d5ea0[_0x63a2c3]={'$like':'%'+_0x1f13e9[_0x0634('0x40')][_0x0634('0x30')]+'%'};return _0x5d5ea0;})});}_0x3d7fd7=_[_0x0634('0x4b')]({},_0x3d7fd7,_0x1f13e9[_0x0634('0x4c')]);return _0x1277f0[_0x0634('0x9b')](_0x3d7fd7);}})[_0x0634('0x29')](function(_0x45ccf7){if(_0x45ccf7){_0x2a2afe=_0x45ccf7[_0x0634('0x45')];if(!_0x1f13e9[_0x0634('0x40')][_0x0634('0x46')](_0x0634('0x47'))){_0x3d7fd7['limit']=qs[_0x0634('0x24')](_0x1f13e9['query']['limit']);_0x3d7fd7['offset']=qs[_0x0634('0x22')](_0x1f13e9[_0x0634('0x40')][_0x0634('0x22')]);}return _0x1277f0[_0x0634('0x9b')](_0x3d7fd7);}})[_0x0634('0x29')](function(_0x21a86c){return _0x21a86c?{'count':_0x2a2afe,'rows':_0x21a86c}:null;})[_0x0634('0x29')](respondWithResult(_0x3f49de,null))['catch'](handleError(_0x3f49de,null));};exports[_0x0634('0x9c')]=function(_0x3a8d0d,_0x1bc748,_0x308e82){var _0x3de25b={};var _0x24dec5={};var _0x4a37b3;var _0x319ab3;return db[_0x0634('0x3b')][_0x0634('0x63')]({'where':{'id':_0x3a8d0d[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x1bc748,null))[_0x0634('0x29')](function(_0x365ffa){if(_0x365ffa){_0x4a37b3=_0x365ffa;_0x24dec5['model']=_['keys'](db[_0x0634('0x9d')][_0x0634('0x3c')]);_0x24dec5[_0x0634('0x40')]=_['keys'](_0x3a8d0d[_0x0634('0x40')]);_0x24dec5['filters']=_[_0x0634('0x42')](_0x24dec5['model'],_0x24dec5[_0x0634('0x40')]);_0x3de25b[_0x0634('0x43')]=_['intersection'](_0x24dec5[_0x0634('0x3e')],qs[_0x0634('0x44')](_0x3a8d0d[_0x0634('0x40')][_0x0634('0x44')]));_0x3de25b[_0x0634('0x43')]=_0x3de25b[_0x0634('0x43')][_0x0634('0x45')]?_0x3de25b[_0x0634('0x43')]:_0x24dec5[_0x0634('0x3e')];_0x3de25b[_0x0634('0x48')]=qs[_0x0634('0x49')](_0x3a8d0d['query'][_0x0634('0x49')]);_0x3de25b[_0x0634('0x4a')]=qs[_0x0634('0x41')](_[_0x0634('0x65')](_0x3a8d0d[_0x0634('0x40')],_0x24dec5[_0x0634('0x41')]));if(_0x3a8d0d[_0x0634('0x40')][_0x0634('0x30')]){_0x3de25b[_0x0634('0x4a')]=_[_0x0634('0x4b')](_0x3de25b[_0x0634('0x4a')],{'$or':_['map'](_0x3de25b['attributes'],function(_0x1834f1){var _0x54fefc={};_0x54fefc[_0x1834f1]={'$like':'%'+_0x3a8d0d[_0x0634('0x40')][_0x0634('0x30')]+'%'};return _0x54fefc;})});}_0x3de25b=_[_0x0634('0x4b')]({},_0x3de25b,_0x3a8d0d['options']);return _0x4a37b3[_0x0634('0x9c')](_0x3de25b);}})[_0x0634('0x29')](function(_0x245af8){if(_0x245af8){_0x319ab3=_0x245af8['length'];if(!_0x3a8d0d['query'][_0x0634('0x46')](_0x0634('0x47'))){_0x3de25b['limit']=qs['limit'](_0x3a8d0d[_0x0634('0x40')]['limit']);_0x3de25b[_0x0634('0x22')]=qs['offset'](_0x3a8d0d[_0x0634('0x40')]['offset']);}return _0x4a37b3['getLists'](_0x3de25b);}})['then'](function(_0x275f74){if(_0x275f74){return _0x275f74?{'count':_0x319ab3,'rows':_0x275f74}:null;}})[_0x0634('0x29')](respondWithResult(_0x1bc748,null))[_0x0634('0x50')](handleError(_0x1bc748,null));};exports['addLists']=function(_0x52980c,_0x5ad7a3,_0x18bed6){var _0x13d448,_0x547b2d;return db[_0x0634('0x3b')][_0x0634('0x36')]({'where':{'id':_0x52980c[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x5ad7a3,null))['then'](function(_0x439f0f){if(_0x439f0f){_0x547b2d=_0x439f0f;return _0x439f0f[_0x0634('0x9e')](_0x52980c['body'][_0x0634('0x83')],_['omit'](_0x52980c['body'],[_0x0634('0x83'),'id'])||{});}return null;})[_0x0634('0x95')](function(_0x26dd25){var _0x133783;_0x13d448=_0x26dd25||[];var _0x176c19=[];if(_0x26dd25){for(var _0x3b7746=0x0;_0x3b7746<_0x26dd25['length'];_0x3b7746+=0x1){var _0x42a3e8=_0x26dd25[_0x3b7746]['get']({'plain':!![]});_0x547b2d[_0x0634('0x9f')]=_0x52980c[_0x0634('0x54')][_0x0634('0x9f')]?_0x52980c[_0x0634('0x54')][_0x0634('0x9f')]:_0x547b2d[_0x0634('0x9f')];switch(_0x547b2d[_0x0634('0x9f')]){case _0x0634('0xa0'):_0x133783=squel[_0x0634('0xa1')]()[_0x0634('0xa2')](_0x0634('0xa3'))[_0x0634('0xa4')]([_0x0634('0xa5'),_0x0634('0xa6'),_0x0634('0xa7'),_0x0634('0xa8'),_0x0634('0x66'),_0x0634('0x5c'),'updatedAt'],squel[_0x0634('0xa9')]()[_0x0634('0x85')](_0x0634('0xa5'),_0x0634('0xa5'))[_0x0634('0x85')]('NOW()',_0x0634('0xa6'))[_0x0634('0x85')]('id',_0x0634('0xa7'))['field'](_0x42a3e8[_0x0634('0xaa')][_0x0634('0xab')](),'ListId')['field'](_0x52980c[_0x0634('0x52')]['id'][_0x0634('0xab')](),'VoiceQueueId')[_0x0634('0x85')](_0x0634('0xac'),_0x0634('0x5c'))[_0x0634('0x85')]('NOW()',_0x0634('0x5d'))[_0x0634('0x87')](_0x0634('0xad'))[_0x0634('0x4a')](_0x0634('0xae'))[_0x0634('0x4a')](_0x0634('0xaf'),_0x42a3e8[_0x0634('0xaa')][_0x0634('0xab')]())['where'](_0x0634('0xb0'))[_0x0634('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0634('0xa9')]()['field'](_0x0634('0xb1'))['from']('cm_hopper_final')[_0x0634('0x4a')](_0x0634('0x8a'),_0x52980c[_0x0634('0x52')]['id'][_0x0634('0xab')]()))['where'](_0x0634('0xb2'),squel[_0x0634('0xa9')]()['field']('COALESCE(phone,\x27\x27)')[_0x0634('0x87')](_0x0634('0xa3'))[_0x0634('0x4a')](_0x0634('0x8a'),_0x52980c[_0x0634('0x52')]['id'][_0x0634('0xab')]())))[_0x0634('0xab')]();break;case'onlyIfOpen':_0x133783=squel[_0x0634('0xa1')]()[_0x0634('0xa2')](_0x0634('0xa3'))[_0x0634('0xa4')]([_0x0634('0xa5'),_0x0634('0xa6'),'ContactId',_0x0634('0xa8'),_0x0634('0x66'),_0x0634('0x5c'),'updatedAt'],squel['select']()['field'](_0x0634('0xa5'),_0x0634('0xa5'))[_0x0634('0x85')](_0x0634('0xac'),_0x0634('0xa6'))[_0x0634('0x85')]('id',_0x0634('0xa7'))[_0x0634('0x85')](_0x42a3e8[_0x0634('0xaa')][_0x0634('0xab')](),_0x0634('0xa8'))[_0x0634('0x85')](_0x52980c['params']['id'][_0x0634('0xab')](),_0x0634('0x66'))[_0x0634('0x85')](_0x0634('0xac'),_0x0634('0x5c'))[_0x0634('0x85')](_0x0634('0xac'),_0x0634('0x5d'))[_0x0634('0x87')](_0x0634('0xad'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x0634('0xaf'),_0x42a3e8[_0x0634('0xaa')][_0x0634('0xab')]())[_0x0634('0x4a')](_0x0634('0xb0'))[_0x0634('0x4a')](_0x0634('0xb2'),squel[_0x0634('0xa9')]()['field'](_0x0634('0xb3'))[_0x0634('0x87')](_0x0634('0xa3'))['where'](_0x0634('0x8a'),_0x52980c[_0x0634('0x52')]['id'][_0x0634('0xab')]())))['toString']();break;default:_0x133783=squel[_0x0634('0xa1')]()[_0x0634('0xa2')]('cm_hopper')['fromQuery']([_0x0634('0xa5'),_0x0634('0xa6'),'ContactId','ListId','VoiceQueueId','createdAt',_0x0634('0x5d')],squel[_0x0634('0xa9')]()['field'](_0x0634('0xa5'),_0x0634('0xa5'))[_0x0634('0x85')]('NOW()','scheduledAt')[_0x0634('0x85')]('id',_0x0634('0xa7'))[_0x0634('0x85')](_0x42a3e8[_0x0634('0xaa')][_0x0634('0xab')](),_0x0634('0xa8'))[_0x0634('0x85')](_0x52980c[_0x0634('0x52')]['id'][_0x0634('0xab')](),'VoiceQueueId')[_0x0634('0x85')](_0x0634('0xac'),_0x0634('0x5c'))[_0x0634('0x85')]('NOW()',_0x0634('0x5d'))[_0x0634('0x87')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x0634('0x4a')](_0x0634('0xaf'),_0x42a3e8[_0x0634('0xaa')][_0x0634('0xab')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0634('0xab')]();}_0x176c19[_0x0634('0x96')](db[_0x0634('0x76')][_0x0634('0x40')](_0x133783));}return BPromise['all'](_0x176c19);}})[_0x0634('0x29')](function(){return _0x13d448;})[_0x0634('0x29')](respondWithResult(_0x5ad7a3,null))['catch'](handleError(_0x5ad7a3,null));};exports[_0x0634('0xb4')]=function(_0x38f7b6,_0x5bb422,_0xa08d69){return db[_0x0634('0x3b')]['find']({'where':{'id':_0x38f7b6[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x5bb422,null))['then'](function(_0x5567ad){if(_0x5567ad){return _0x5567ad[_0x0634('0xb4')](_0x38f7b6['query'][_0x0634('0x83')]);}})[_0x0634('0x29')](function(_0x590d02){if(_0x590d02){return db[_0x0634('0x64')][_0x0634('0x2a')]({'where':{'ListId':_0x38f7b6[_0x0634('0x40')][_0x0634('0x83')],'VoiceQueueId':_0x38f7b6['params']['id']}})[_0x0634('0x29')](function(){return _0x590d02;});}})[_0x0634('0x29')](respondWithStatusCode(_0x5bb422,null))['catch'](handleError(_0x5bb422,null));};exports['getBlackLists']=function(_0x29f65e,_0x2fae28,_0x1d2818){var _0x10c39c={};var _0x2f740f={};var _0x3367e4;var _0x5caeca;return db[_0x0634('0x3b')][_0x0634('0x63')]({'where':{'id':_0x29f65e[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x2fae28,null))[_0x0634('0x29')](function(_0x3663ea){if(_0x3663ea){_0x3367e4=_0x3663ea;_0x2f740f[_0x0634('0x3e')]=_[_0x0634('0x3f')](db[_0x0634('0x9d')][_0x0634('0x3c')]);_0x2f740f[_0x0634('0x40')]=_[_0x0634('0x3f')](_0x29f65e['query']);_0x2f740f[_0x0634('0x41')]=_[_0x0634('0x42')](_0x2f740f[_0x0634('0x3e')],_0x2f740f[_0x0634('0x40')]);_0x10c39c[_0x0634('0x43')]=_['intersection'](_0x2f740f[_0x0634('0x3e')],qs['fields'](_0x29f65e[_0x0634('0x40')]['fields']));_0x10c39c[_0x0634('0x43')]=_0x10c39c['attributes'][_0x0634('0x45')]?_0x10c39c['attributes']:_0x2f740f['model'];_0x10c39c[_0x0634('0x48')]=qs[_0x0634('0x49')](_0x29f65e[_0x0634('0x40')]['sort']);_0x10c39c['where']=qs[_0x0634('0x41')](_[_0x0634('0x65')](_0x29f65e[_0x0634('0x40')],_0x2f740f['filters']));if(_0x29f65e['query']['filter']){_0x10c39c[_0x0634('0x4a')]=_[_0x0634('0x4b')](_0x10c39c[_0x0634('0x4a')],{'$or':_[_0x0634('0x32')](_0x10c39c['attributes'],function(_0x13da61){var _0x3ecacd={};_0x3ecacd[_0x13da61]={'$like':'%'+_0x29f65e['query'][_0x0634('0x30')]+'%'};return _0x3ecacd;})});}_0x10c39c=_[_0x0634('0x4b')]({},_0x10c39c,_0x29f65e[_0x0634('0x4c')]);return _0x3367e4[_0x0634('0xb5')](_0x10c39c);}})[_0x0634('0x29')](function(_0x3ff0b2){if(_0x3ff0b2){_0x5caeca=_0x3ff0b2[_0x0634('0x45')];if(!_0x29f65e[_0x0634('0x40')][_0x0634('0x46')](_0x0634('0x47'))){_0x10c39c[_0x0634('0x24')]=qs['limit'](_0x29f65e['query'][_0x0634('0x24')]);_0x10c39c[_0x0634('0x22')]=qs['offset'](_0x29f65e[_0x0634('0x40')][_0x0634('0x22')]);}return _0x3367e4[_0x0634('0xb5')](_0x10c39c);}})[_0x0634('0x29')](function(_0x500da4){if(_0x500da4){return _0x500da4?{'count':_0x5caeca,'rows':_0x500da4}:null;}})[_0x0634('0x29')](respondWithResult(_0x2fae28,null))['catch'](handleError(_0x2fae28,null));};exports[_0x0634('0xb6')]=function(_0x3ee87f,_0x4b8b02,_0x5a5360){var _0x1b8637,_0x477021;return db[_0x0634('0x3b')][_0x0634('0x36')]({'where':{'id':_0x3ee87f[_0x0634('0x52')]['id']}})[_0x0634('0x29')](handleEntityNotFound(_0x4b8b02,null))['then'](function(_0x3da254){if(_0x3da254){_0x477021=_0x3da254;return _0x3da254['addBlackLists'](_0x3ee87f[_0x0634('0x54')][_0x0634('0x83')],_['omit'](_0x3ee87f['body'],[_0x0634('0x83'),'id'])||{});}return null;})[_0x0634('0x95')](function(_0x59ed97){var _0x5df1a6;_0x1b8637=_0x59ed97||[];var _0xe46360=[];if(_0x59ed97){for(var _0x4202f4=0x0;_0x4202f4<_0x59ed97['length'];_0x4202f4+=0x1){var _0x3f868a=_0x59ed97[_0x4202f4]['get']({'plain':!![]});_0x5df1a6=squel[_0x0634('0xa1')]()['into'](_0x0634('0xb7'))[_0x0634('0xa4')](['phone',_0x0634('0xa7'),_0x0634('0xa8'),'VoiceQueueId',_0x0634('0x5c'),_0x0634('0x5d')],squel[_0x0634('0xa9')]()['field']('phone',_0x0634('0xa5'))[_0x0634('0x85')]('id',_0x0634('0xa7'))['field'](_0x3f868a[_0x0634('0xaa')][_0x0634('0xab')](),'ListId')[_0x0634('0x85')](_0x3ee87f['params']['id'][_0x0634('0xab')](),_0x0634('0x66'))[_0x0634('0x85')]('NOW()',_0x0634('0x5c'))[_0x0634('0x85')]('NOW()',_0x0634('0x5d'))[_0x0634('0x87')](_0x0634('0xad'))[_0x0634('0x4a')](_0x0634('0xae'))[_0x0634('0x4a')](_0x0634('0xaf'),_0x3f868a[_0x0634('0xaa')][_0x0634('0xab')]())[_0x0634('0x4a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0xe46360[_0x0634('0x96')](db[_0x0634('0x76')][_0x0634('0x40')](_0x5df1a6));}return BPromise[_0x0634('0x90')](_0xe46360);}})[_0x0634('0x29')](function(){return _0x1b8637;})[_0x0634('0x29')](respondWithResult(_0x4b8b02,null))[_0x0634('0x50')](handleError(_0x4b8b02,null));};exports[_0x0634('0xb8')]=function(_0x5f275a,_0x593b3b,_0x25316d){return db['VoiceQueue']['find']({'where':{'id':_0x5f275a[_0x0634('0x52')]['id']}})['then'](handleEntityNotFound(_0x593b3b,null))[_0x0634('0x29')](function(_0x34efda){if(_0x34efda){return _0x34efda[_0x0634('0xb8')](_0x5f275a['query'][_0x0634('0x83')]);}})[_0x0634('0x29')](function(_0x3caa67){if(_0x3caa67){return db[_0x0634('0x6b')]['destroy']({'where':{'ListId':_0x5f275a['query'][_0x0634('0x83')],'VoiceQueueId':_0x5f275a[_0x0634('0x52')]['id']}})[_0x0634('0x29')](function(){return _0x3caa67;});}})[_0x0634('0x29')](respondWithStatusCode(_0x593b3b,null))[_0x0634('0x50')](handleError(_0x593b3b,null));}; \ No newline at end of file +var _0x31ea=['defaults','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','VoiceQueues','filter','map','value','includes','name','UserProfileResource','send','index','VoiceQueue','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','user','role','inbound','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','get','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','outbound','update','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','voicePause','interface','flatMap','Agents','penalty','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','from','join','user_has_teams','QueryTypes','every','TeamId','all','union','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','push','format','isArray','getAgents','getMembers','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','field','phone','scheduledAt','CmListId','ListId','NOW()','cm_contacts','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x31ea,0x9e));var _0xa31e=function(_0x1dd9e8,_0x23e8ce){_0x1dd9e8=_0x1dd9e8-0x0;var _0x362100=_0x31ea[_0x1dd9e8];return _0x362100;};'use strict';var emlformat=require(_0xa31e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa31e('0x1'));var jsonpatch=require(_0xa31e('0x2'));var rp=require('request-promise');var moment=require(_0xa31e('0x3'));var BPromise=require(_0xa31e('0x4'));var Mustache=require(_0xa31e('0x5'));var util=require('util');var path=require(_0xa31e('0x6'));var sox=require(_0xa31e('0x7'));var csv=require(_0xa31e('0x8'));var ejs=require(_0xa31e('0x9'));var fs=require('fs');var fs_extra=require(_0xa31e('0xa'));var _=require(_0xa31e('0xb'));var squel=require('squel');var crypto=require(_0xa31e('0xc'));var jsforce=require(_0xa31e('0xd'));var deskjs=require(_0xa31e('0xe'));var toCsv=require(_0xa31e('0x8'));var querystring=require(_0xa31e('0xf'));var Papa=require(_0xa31e('0x10'));var Redis=require('ioredis');var authService=require(_0xa31e('0x11'));var qs=require(_0xa31e('0x12'));var as=require(_0xa31e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa31e('0x14'))(_0xa31e('0x15'));var utils=require(_0xa31e('0x16'));var config=require(_0xa31e('0x17'));var licenseUtil=require(_0xa31e('0x18'));var db=require(_0xa31e('0x19'))['db'];config[_0xa31e('0x1a')]=_[_0xa31e('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa31e('0x1c'))(new Redis(config[_0xa31e('0x1a')]));require('./voiceQueue.socket')[_0xa31e('0x1d')](socket);function respondWithStatusCode(_0x5c3fbf,_0x2f5585){_0x2f5585=_0x2f5585||0xcc;return function(_0x297498){if(_0x297498){return _0x5c3fbf[_0xa31e('0x1e')](_0x2f5585);}return _0x5c3fbf['status'](_0x2f5585)[_0xa31e('0x1f')]();};}function respondWithResult(_0x18c16c,_0x238699){_0x238699=_0x238699||0xc8;return function(_0x4643c5){if(_0x4643c5){return _0x18c16c[_0xa31e('0x20')](_0x238699)['json'](_0x4643c5);}};}function respondWithFilteredResult(_0x3bc167,_0x1be217){return function(_0x341ccd){if(_0x341ccd){var _0x40a46b=typeof _0x1be217[_0xa31e('0x21')]===_0xa31e('0x22')&&typeof _0x1be217[_0xa31e('0x23')]===_0xa31e('0x22');var _0x22782c=_0x341ccd['count'];var _0x126646=_0x40a46b?0x0:_0x1be217[_0xa31e('0x21')];var _0x50cda6=_0x40a46b?_0x341ccd[_0xa31e('0x24')]:_0x1be217['offset']+_0x1be217['limit'];var _0x3886f8;if(_0x50cda6>=_0x22782c){_0x50cda6=_0x22782c;_0x3886f8=0xc8;}else{_0x3886f8=0xce;}_0x3bc167[_0xa31e('0x20')](_0x3886f8);return _0x3bc167[_0xa31e('0x25')](_0xa31e('0x26'),_0x126646+'-'+_0x50cda6+'/'+_0x22782c)[_0xa31e('0x27')](_0x341ccd);}return null;};}function patchUpdates(_0xa01c10){return function(_0x7e2957){try{jsonpatch[_0xa31e('0x28')](_0x7e2957,_0xa01c10,!![]);}catch(_0x502ae6){return BPromise[_0xa31e('0x29')](_0x502ae6);}return _0x7e2957[_0xa31e('0x2a')]();};}function saveUpdates(_0x440a28,_0x3925d8){return function(_0x3587a2){if(_0x3587a2){return _0x3587a2['update'](_0x440a28)[_0xa31e('0x2b')](function(_0x39eba4){return _0x39eba4;});}return null;};}function removeEntity(_0x1826c3,_0x3c313f){return function(_0x53a6fc){if(_0x53a6fc){return _0x53a6fc[_0xa31e('0x2c')]()[_0xa31e('0x2b')](function(){var _0x28bc1a=_0x53a6fc['get']({'plain':!![]});var _0x305c85=[{'name':_0xa31e('0x2d'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x1220e5=_(_0x305c85)[_0xa31e('0x2e')]('ignore')[_0xa31e('0x2f')](_0xa31e('0x30'))[_0xa31e('0x30')]();if(_[_0xa31e('0x31')](_0x1220e5,_0x28bc1a['type'])){return;}var _0x4c0b5c=_['find'](_0x305c85,['value',_0x28bc1a['type']])[_0xa31e('0x32')];return db[_0xa31e('0x33')]['destroy']({'where':{'type':_0x4c0b5c,'resourceId':_0x28bc1a['id']}})['then'](function(){return _0x53a6fc;});})[_0xa31e('0x2b')](function(){_0x1826c3[_0xa31e('0x20')](0xcc)[_0xa31e('0x1f')]();});}};}function handleEntityNotFound(_0x15738f,_0x2938f8){return function(_0x58e1e8){if(!_0x58e1e8){_0x15738f[_0xa31e('0x1e')](0x194);}return _0x58e1e8;};}function handleError(_0x1d41d8,_0x5c0a75){_0x5c0a75=_0x5c0a75||0x1f4;return function(_0x2d1bf1){logger['error'](_0x2d1bf1['stack']);if(_0x2d1bf1[_0xa31e('0x32')]){delete _0x2d1bf1[_0xa31e('0x32')];}_0x1d41d8[_0xa31e('0x20')](_0x5c0a75)[_0xa31e('0x34')](_0x2d1bf1);};}exports[_0xa31e('0x35')]=function(_0x59e3a0,_0x339fa1){var _0x296f22={},_0xc6fa79={},_0x265610={'count':0x0,'rows':[]};var _0x20fe57=_[_0xa31e('0x2f')](db[_0xa31e('0x36')]['rawAttributes'],function(_0x359f6f){return{'name':_0x359f6f[_0xa31e('0x37')],'type':_0x359f6f[_0xa31e('0x38')]['key']};});_0xc6fa79[_0xa31e('0x39')]=_[_0xa31e('0x2f')](_0x20fe57,_0xa31e('0x32'));_0xc6fa79['query']=_[_0xa31e('0x3a')](_0x59e3a0[_0xa31e('0x3b')]);_0xc6fa79[_0xa31e('0x3c')]=_[_0xa31e('0x3d')](_0xc6fa79['model'],_0xc6fa79['query']);_0x296f22[_0xa31e('0x3e')]=_[_0xa31e('0x3d')](_0xc6fa79[_0xa31e('0x39')],qs['fields'](_0x59e3a0[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x296f22['attributes']=_0x296f22['attributes'][_0xa31e('0x40')]?_0x296f22[_0xa31e('0x3e')]:_0xc6fa79[_0xa31e('0x39')];if(!_0x59e3a0[_0xa31e('0x3b')][_0xa31e('0x41')](_0xa31e('0x42'))){_0x296f22[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x59e3a0[_0xa31e('0x3b')][_0xa31e('0x23')]);_0x296f22['offset']=qs[_0xa31e('0x21')](_0x59e3a0[_0xa31e('0x3b')][_0xa31e('0x21')]);}_0x296f22[_0xa31e('0x43')]=qs[_0xa31e('0x44')](_0x59e3a0[_0xa31e('0x3b')][_0xa31e('0x44')]);_0x296f22[_0xa31e('0x45')]=qs[_0xa31e('0x3c')](_[_0xa31e('0x46')](_0x59e3a0[_0xa31e('0x3b')],_0xc6fa79[_0xa31e('0x3c')]),_0x20fe57);if(_0x59e3a0[_0xa31e('0x3b')][_0xa31e('0x2e')]){_0x296f22[_0xa31e('0x45')]=_[_0xa31e('0x47')](_0x296f22['where'],{'$or':_[_0xa31e('0x2f')](_0x20fe57,function(_0x1cd755){if(_0x1cd755[_0xa31e('0x38')]!==_0xa31e('0x48')){var _0x2a948a={};_0x2a948a[_0x1cd755[_0xa31e('0x32')]]={'$like':'%'+_0x59e3a0['query'][_0xa31e('0x2e')]+'%'};return _0x2a948a;}})});}_0x296f22=_['merge']({},_0x296f22,_0x59e3a0[_0xa31e('0x49')]);var _0x37240c={'where':_0x296f22[_0xa31e('0x45')]};return db[_0xa31e('0x36')][_0xa31e('0x24')](_0x37240c)[_0xa31e('0x2b')](function(_0x3068cc){_0x265610[_0xa31e('0x24')]=_0x3068cc;if(_0x59e3a0[_0xa31e('0x3b')][_0xa31e('0x4a')]){_0x296f22['include']=[{'all':!![]}];}return db[_0xa31e('0x36')][_0xa31e('0x4b')](_0x296f22);})['then'](function(_0x2d35ac){_0x265610[_0xa31e('0x4c')]=_0x2d35ac;return _0x265610;})[_0xa31e('0x2b')](respondWithFilteredResult(_0x339fa1,_0x296f22))[_0xa31e('0x4d')](handleError(_0x339fa1,null));};exports[_0xa31e('0x4e')]=function(_0x3d8352,_0x4823ad){var _0x4bbf9e={'raw':![],'where':{'id':_0x3d8352[_0xa31e('0x4f')]['id']}},_0x151457={};_0x151457['model']=_[_0xa31e('0x3a')](db[_0xa31e('0x36')][_0xa31e('0x50')]);_0x151457[_0xa31e('0x3b')]=_[_0xa31e('0x3a')](_0x3d8352[_0xa31e('0x3b')]);_0x151457[_0xa31e('0x3c')]=_['intersection'](_0x151457['model'],_0x151457[_0xa31e('0x3b')]);_0x4bbf9e[_0xa31e('0x3e')]=_['intersection'](_0x151457[_0xa31e('0x39')],qs['fields'](_0x3d8352[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x4bbf9e[_0xa31e('0x3e')]=_0x4bbf9e[_0xa31e('0x3e')][_0xa31e('0x40')]?_0x4bbf9e[_0xa31e('0x3e')]:_0x151457['model'];if(_0x3d8352[_0xa31e('0x3b')][_0xa31e('0x4a')]){_0x4bbf9e[_0xa31e('0x51')]=[{'all':!![]}];}_0x4bbf9e=_['merge']({},_0x4bbf9e,_0x3d8352['options']);return db[_0xa31e('0x36')][_0xa31e('0x52')](_0x4bbf9e)[_0xa31e('0x2b')](handleEntityNotFound(_0x4823ad,null))[_0xa31e('0x2b')](respondWithResult(_0x4823ad,null))[_0xa31e('0x4d')](handleError(_0x4823ad,null));};exports['create']=function(_0x320094,_0x24c227){return db['VoiceQueue']['create'](_0x320094['body'],{})['then'](function(_0x431dcd){var _0x3b8007=_0x320094[_0xa31e('0x53')]['get']({'plain':!![]});if(!_0x3b8007)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b8007[_0xa31e('0x54')]===_0xa31e('0x53')){var _0x1094bd=_0x431dcd['get']({'plain':!![]});var _0xd5b392=[{'name':'VoiceQueues','value':_0xa31e('0x55')},{'name':_0xa31e('0x56'),'value':'outbound'}];var _0x39521e=_[_0xa31e('0x52')](_0xd5b392,[_0xa31e('0x30'),_0x1094bd[_0xa31e('0x38')]])[_0xa31e('0x32')];return db[_0xa31e('0x57')][_0xa31e('0x52')]({'where':{'name':_0x39521e,'userProfileId':_0x3b8007[_0xa31e('0x58')]},'raw':!![]})[_0xa31e('0x2b')](function(_0x4ab969){if(_0x4ab969&&_0x4ab969[_0xa31e('0x59')]===0x0){return db[_0xa31e('0x33')][_0xa31e('0x5a')]({'name':_0x1094bd[_0xa31e('0x32')],'resourceId':_0x1094bd['id'],'type':_0x4ab969['name'],'sectionId':_0x4ab969['id']},{})[_0xa31e('0x2b')](function(){return _0x431dcd;});}else{return _0x431dcd;}})['catch'](function(_0x515878){logger[_0xa31e('0x5b')](_0xa31e('0x5c'),_0x515878);throw _0x515878;});}return _0x431dcd;})[_0xa31e('0x2b')](respondWithResult(_0x24c227,0xc9))[_0xa31e('0x4d')](handleError(_0x24c227,null));};exports[_0xa31e('0x5d')]=function(_0x42be1e,_0x31747a){var _0x48ebc0={'where':{'id':_0x42be1e[_0xa31e('0x4f')]['id']}},_0x3a5aae={};_0x3a5aae['model']=_[_0xa31e('0x3a')](db[_0xa31e('0x36')][_0xa31e('0x50')]);_0x48ebc0[_0xa31e('0x3e')]=_[_0xa31e('0x3d')](_0x3a5aae[_0xa31e('0x39')],qs['fields'](_0x42be1e[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x48ebc0['attributes']=_0x48ebc0[_0xa31e('0x3e')][_0xa31e('0x40')]?_0x48ebc0[_0xa31e('0x3e')]:_0x3a5aae[_0xa31e('0x39')];if(_0x42be1e[_0xa31e('0x3b')][_0xa31e('0x4a')]){_0x48ebc0[_0xa31e('0x51')]=[{'all':!![]}];}_0x48ebc0=_[_0xa31e('0x47')]({},_0x48ebc0,_0x42be1e[_0xa31e('0x49')]);return db[_0xa31e('0x36')]['find'](_0x48ebc0)[_0xa31e('0x2b')](handleEntityNotFound(_0x31747a,null))[_0xa31e('0x2b')](function(_0x2d3f95){if(_0x2d3f95){var _0x5bc1b7=_0x2d3f95[_0xa31e('0x5e')]({'plain':!![]});_0x5bc1b7=qs[_0xa31e('0x5f')](_0x5bc1b7,['id',_0xa31e('0x60'),_0xa31e('0x61')]);_0x42be1e['body']=_[_0xa31e('0x5f')](_0x42be1e[_0xa31e('0x62')],['id','createdAt',_0xa31e('0x61')]);return db[_0xa31e('0x36')]['create'](_['merge'](_0x5bc1b7,_0x42be1e['body']),{'include':_0x42be1e[_0xa31e('0x3b')][_0xa31e('0x4a')]?[{'all':!![]}]:undefined})[_0xa31e('0x2b')](function(_0xa02796){var _0x3f7bfc=_0x42be1e[_0xa31e('0x53')][_0xa31e('0x5e')]({'plain':!![]});if(!_0x3f7bfc)throw new Error(_0xa31e('0x63'));if(_0x3f7bfc['role']===_0xa31e('0x53')){var _0x50641b=_0xa02796['get']({'plain':!![]});var _0x11424d=[{'name':'VoiceQueues','value':_0xa31e('0x55')},{'name':_0xa31e('0x56'),'value':_0xa31e('0x64')}];var _0x55ba17=_[_0xa31e('0x52')](_0x11424d,[_0xa31e('0x30'),_0x50641b['type']])[_0xa31e('0x32')];return db[_0xa31e('0x57')][_0xa31e('0x52')]({'where':{'name':_0x55ba17,'userProfileId':_0x3f7bfc[_0xa31e('0x58')]},'raw':!![]})[_0xa31e('0x2b')](function(_0x5d3698){if(_0x5d3698&&_0x5d3698[_0xa31e('0x59')]===0x0){return db[_0xa31e('0x33')][_0xa31e('0x5a')]({'name':_0x50641b[_0xa31e('0x32')],'resourceId':_0x50641b['id'],'type':_0x5d3698[_0xa31e('0x32')],'sectionId':_0x5d3698['id']},{})[_0xa31e('0x2b')](function(){return _0xa02796;});}else{return _0xa02796;}})[_0xa31e('0x4d')](function(_0x1e50d2){logger[_0xa31e('0x5b')](_0xa31e('0x5c'),_0x1e50d2);throw _0x1e50d2;});}return _0xa02796;});}})[_0xa31e('0x2b')](respondWithResult(_0x31747a,0xc9))[_0xa31e('0x4d')](handleError(_0x31747a,null));};exports[_0xa31e('0x65')]=function(_0x4a6831,_0x21bd03){if(_0x4a6831[_0xa31e('0x62')]['id']){delete _0x4a6831[_0xa31e('0x62')]['id'];}return db[_0xa31e('0x36')][_0xa31e('0x52')]({'where':{'id':_0x4a6831[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x21bd03,null))[_0xa31e('0x2b')](saveUpdates(_0x4a6831[_0xa31e('0x62')],null))[_0xa31e('0x2b')](respondWithResult(_0x21bd03,null))[_0xa31e('0x4d')](handleError(_0x21bd03,null));};exports[_0xa31e('0x2c')]=function(_0x252e42,_0x28d0df){return db['VoiceQueue'][_0xa31e('0x52')]({'where':{'id':_0x252e42[_0xa31e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x28d0df,null))['then'](removeEntity(_0x28d0df,null))[_0xa31e('0x4d')](handleError(_0x28d0df,null));};exports['getHoppers']=function(_0x4c1203,_0x1c5d2b,_0xd9a6f6){var _0x3c7112={'raw':![],'where':{}};var _0x50e49b={};var _0x38de53={'count':0x0,'rows':[]};return db[_0xa31e('0x36')][_0xa31e('0x66')]({'where':{'id':_0x4c1203[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x1c5d2b,null))['then'](function(_0x41c025){if(_0x41c025){_0x50e49b['model']=_[_0xa31e('0x3a')](db['CmHopper']['rawAttributes']);_0x50e49b['query']=_['keys'](_0x4c1203['query']);_0x50e49b[_0xa31e('0x3c')]=_[_0xa31e('0x3d')](_0x50e49b[_0xa31e('0x39')],_0x50e49b[_0xa31e('0x3b')]);_0x3c7112['attributes']=_[_0xa31e('0x3d')](_0x50e49b[_0xa31e('0x39')],qs[_0xa31e('0x3f')](_0x4c1203[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x3c7112[_0xa31e('0x3e')]=_0x3c7112[_0xa31e('0x3e')]['length']?_0x3c7112[_0xa31e('0x3e')]:_0x50e49b[_0xa31e('0x39')];if(!_0x4c1203['query'][_0xa31e('0x41')](_0xa31e('0x42'))){_0x3c7112[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x4c1203[_0xa31e('0x3b')][_0xa31e('0x23')]);_0x3c7112[_0xa31e('0x21')]=qs['offset'](_0x4c1203[_0xa31e('0x3b')][_0xa31e('0x21')]);}_0x3c7112[_0xa31e('0x43')]=qs['sort'](_0x4c1203[_0xa31e('0x3b')][_0xa31e('0x44')]);_0x3c7112[_0xa31e('0x45')]=qs[_0xa31e('0x3c')](_[_0xa31e('0x46')](_0x4c1203[_0xa31e('0x3b')],_0x50e49b[_0xa31e('0x3c')]));_0x3c7112[_0xa31e('0x45')][_0xa31e('0x67')]=_0x41c025['id'];if(_0x4c1203[_0xa31e('0x3b')][_0xa31e('0x2e')]){_0x3c7112[_0xa31e('0x45')]=_[_0xa31e('0x47')](_0x3c7112[_0xa31e('0x45')],{'$or':_[_0xa31e('0x2f')](_0x3c7112[_0xa31e('0x3e')],function(_0x5b9002){var _0xe7f84e={};_0xe7f84e[_0x5b9002]={'$like':'%'+_0x4c1203[_0xa31e('0x3b')][_0xa31e('0x2e')]+'%'};return _0xe7f84e;})});}_0x3c7112=_[_0xa31e('0x47')]({},_0x3c7112,_0x4c1203[_0xa31e('0x49')]);return db['CmHopper'][_0xa31e('0x24')]({'where':_0x3c7112['where']})[_0xa31e('0x2b')](function(_0x2e7dea){_0x38de53[_0xa31e('0x24')]=_0x2e7dea;if(_0x4c1203[_0xa31e('0x3b')][_0xa31e('0x4a')]){_0x3c7112[_0xa31e('0x51')]=[{'all':!![]}];}return db[_0xa31e('0x68')][_0xa31e('0x4b')](_0x3c7112);})[_0xa31e('0x2b')](function(_0x3dadd1){_0x38de53[_0xa31e('0x4c')]=_0x3dadd1;return _0x38de53;});}})[_0xa31e('0x2b')](respondWithFilteredResult(_0x1c5d2b,_0x3c7112))[_0xa31e('0x4d')](handleError(_0x1c5d2b,null));};exports[_0xa31e('0x69')]=function(_0x180f9d,_0x47f749,_0x4800bd){var _0x4e959b={'raw':!![],'where':{}};var _0x212f41={};var _0x213c13={'count':0x0,'rows':[]};return db[_0xa31e('0x36')]['findOne']({'where':{'id':_0x180f9d[_0xa31e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x47f749,null))[_0xa31e('0x2b')](function(_0x51e914){if(_0x51e914){_0x212f41[_0xa31e('0x39')]=_[_0xa31e('0x3a')](db[_0xa31e('0x6a')]['rawAttributes']);_0x212f41[_0xa31e('0x3b')]=_['keys'](_0x180f9d['query']);_0x212f41[_0xa31e('0x3c')]=_[_0xa31e('0x3d')](_0x212f41[_0xa31e('0x39')],_0x212f41[_0xa31e('0x3b')]);_0x4e959b[_0xa31e('0x3e')]=_[_0xa31e('0x3d')](_0x212f41[_0xa31e('0x39')],qs[_0xa31e('0x3f')](_0x180f9d[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x4e959b[_0xa31e('0x3e')]=_0x4e959b[_0xa31e('0x3e')]['length']?_0x4e959b[_0xa31e('0x3e')]:_0x212f41[_0xa31e('0x39')];if(!_0x180f9d['query'][_0xa31e('0x41')](_0xa31e('0x42'))){_0x4e959b['limit']=qs['limit'](_0x180f9d[_0xa31e('0x3b')][_0xa31e('0x23')]);_0x4e959b['offset']=qs[_0xa31e('0x21')](_0x180f9d[_0xa31e('0x3b')][_0xa31e('0x21')]);}_0x4e959b[_0xa31e('0x43')]=qs[_0xa31e('0x44')](_0x180f9d[_0xa31e('0x3b')][_0xa31e('0x44')]);_0x4e959b[_0xa31e('0x45')]=qs[_0xa31e('0x3c')](_[_0xa31e('0x46')](_0x180f9d[_0xa31e('0x3b')],_0x212f41[_0xa31e('0x3c')]));_0x4e959b[_0xa31e('0x45')][_0xa31e('0x67')]=_0x51e914['id'];if(_0x180f9d[_0xa31e('0x3b')][_0xa31e('0x2e')]){_0x4e959b[_0xa31e('0x45')]=_[_0xa31e('0x47')](_0x4e959b['where'],{'$or':_[_0xa31e('0x2f')](_0x4e959b[_0xa31e('0x3e')],function(_0x383ee3){var _0x555f95={};_0x555f95[_0x383ee3]={'$like':'%'+_0x180f9d[_0xa31e('0x3b')][_0xa31e('0x2e')]+'%'};return _0x555f95;})});}_0x4e959b=_[_0xa31e('0x47')]({},_0x4e959b,_0x180f9d[_0xa31e('0x49')]);return db[_0xa31e('0x6a')]['count']({'where':_0x4e959b[_0xa31e('0x45')]})[_0xa31e('0x2b')](function(_0x1c724b){_0x213c13['count']=_0x1c724b;if(_0x180f9d[_0xa31e('0x3b')][_0xa31e('0x4a')]){_0x4e959b[_0xa31e('0x51')]=[{'all':!![]}];}return db[_0xa31e('0x6a')][_0xa31e('0x4b')](_0x4e959b);})[_0xa31e('0x2b')](function(_0x31ed54){_0x213c13[_0xa31e('0x4c')]=_0x31ed54;return _0x213c13;});}})[_0xa31e('0x2b')](respondWithFilteredResult(_0x47f749,_0x4e959b))[_0xa31e('0x4d')](handleError(_0x47f749,null));};exports[_0xa31e('0x6b')]=function(_0x40a9ea,_0x46bf4e,_0x419c29){var _0x3fc430={'raw':!![],'where':{}};var _0x2fbec8={};var _0x4c1f54={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa31e('0x66')]({'where':{'id':_0x40a9ea[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x46bf4e,null))[_0xa31e('0x2b')](function(_0x3ef626){if(_0x3ef626){_0x2fbec8[_0xa31e('0x39')]=_[_0xa31e('0x3a')](db[_0xa31e('0x6c')]['rawAttributes']);_0x2fbec8[_0xa31e('0x3b')]=_[_0xa31e('0x3a')](_0x40a9ea['query']);_0x2fbec8[_0xa31e('0x3c')]=_['intersection'](_0x2fbec8[_0xa31e('0x39')],_0x2fbec8['query']);_0x3fc430[_0xa31e('0x3e')]=_[_0xa31e('0x3d')](_0x2fbec8['model'],qs[_0xa31e('0x3f')](_0x40a9ea[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x3fc430[_0xa31e('0x3e')]=_0x3fc430[_0xa31e('0x3e')][_0xa31e('0x40')]?_0x3fc430[_0xa31e('0x3e')]:_0x2fbec8['model'];if(!_0x40a9ea['query'][_0xa31e('0x41')](_0xa31e('0x42'))){_0x3fc430[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x40a9ea[_0xa31e('0x3b')]['limit']);_0x3fc430['offset']=qs[_0xa31e('0x21')](_0x40a9ea[_0xa31e('0x3b')][_0xa31e('0x21')]);}_0x3fc430[_0xa31e('0x43')]=qs['sort'](_0x40a9ea['query'][_0xa31e('0x44')]);_0x3fc430[_0xa31e('0x45')]=qs[_0xa31e('0x3c')](_['pick'](_0x40a9ea[_0xa31e('0x3b')],_0x2fbec8[_0xa31e('0x3c')]));_0x3fc430[_0xa31e('0x45')]['VoiceQueueId']=_0x3ef626['id'];if(_0x40a9ea[_0xa31e('0x3b')][_0xa31e('0x2e')]){_0x3fc430[_0xa31e('0x45')]=_['merge'](_0x3fc430[_0xa31e('0x45')],{'$or':_[_0xa31e('0x2f')](_0x3fc430['attributes'],function(_0x201d5b){var _0x55d50a={};_0x55d50a[_0x201d5b]={'$like':'%'+_0x40a9ea['query']['filter']+'%'};return _0x55d50a;})});}_0x3fc430=_[_0xa31e('0x47')]({},_0x3fc430,_0x40a9ea[_0xa31e('0x49')]);return db[_0xa31e('0x6c')][_0xa31e('0x24')]({'where':_0x3fc430['where']})['then'](function(_0xb434d2){_0x4c1f54['count']=_0xb434d2;if(_0x40a9ea[_0xa31e('0x3b')][_0xa31e('0x4a')]){_0x3fc430[_0xa31e('0x51')]=[{'all':!![]}];}return db[_0xa31e('0x6c')][_0xa31e('0x4b')](_0x3fc430);})[_0xa31e('0x2b')](function(_0x5a2483){_0x4c1f54[_0xa31e('0x4c')]=_0x5a2483;return _0x4c1f54;});}})[_0xa31e('0x2b')](respondWithFilteredResult(_0x46bf4e,_0x3fc430))[_0xa31e('0x4d')](handleError(_0x46bf4e,null));};exports[_0xa31e('0x6d')]=function(_0x31f647,_0x1b026b,_0x59d94f){var _0xd1111a={'raw':!![],'where':{}};var _0x45aacb={};var _0x2cbd13={'count':0x0,'rows':[]};return db[_0xa31e('0x36')][_0xa31e('0x66')]({'where':{'id':_0x31f647[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x1b026b,null))[_0xa31e('0x2b')](function(_0x4e90a0){if(_0x4e90a0){_0x45aacb[_0xa31e('0x39')]=_[_0xa31e('0x3a')](db[_0xa31e('0x6e')]['rawAttributes']);_0x45aacb[_0xa31e('0x3b')]=_[_0xa31e('0x3a')](_0x31f647[_0xa31e('0x3b')]);_0x45aacb[_0xa31e('0x3c')]=_[_0xa31e('0x3d')](_0x45aacb[_0xa31e('0x39')],_0x45aacb['query']);_0xd1111a['attributes']=_['intersection'](_0x45aacb[_0xa31e('0x39')],qs[_0xa31e('0x3f')](_0x31f647['query']['fields']));_0xd1111a[_0xa31e('0x3e')]=_0xd1111a['attributes']['length']?_0xd1111a[_0xa31e('0x3e')]:_0x45aacb[_0xa31e('0x39')];if(!_0x31f647[_0xa31e('0x3b')][_0xa31e('0x41')](_0xa31e('0x42'))){_0xd1111a[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x31f647['query'][_0xa31e('0x23')]);_0xd1111a[_0xa31e('0x21')]=qs['offset'](_0x31f647[_0xa31e('0x3b')][_0xa31e('0x21')]);}_0xd1111a[_0xa31e('0x43')]=qs['sort'](_0x31f647[_0xa31e('0x3b')][_0xa31e('0x44')]);_0xd1111a[_0xa31e('0x45')]=qs['filters'](_[_0xa31e('0x46')](_0x31f647[_0xa31e('0x3b')],_0x45aacb[_0xa31e('0x3c')]));_0xd1111a[_0xa31e('0x45')][_0xa31e('0x67')]=_0x4e90a0['id'];if(_0x31f647[_0xa31e('0x3b')][_0xa31e('0x2e')]){_0xd1111a['where']=_[_0xa31e('0x47')](_0xd1111a['where'],{'$or':_[_0xa31e('0x2f')](_0xd1111a[_0xa31e('0x3e')],function(_0x3e3e0e){var _0x291694={};_0x291694[_0x3e3e0e]={'$like':'%'+_0x31f647[_0xa31e('0x3b')]['filter']+'%'};return _0x291694;})});}_0xd1111a=_[_0xa31e('0x47')]({},_0xd1111a,_0x31f647[_0xa31e('0x49')]);return db[_0xa31e('0x6e')][_0xa31e('0x24')]({'where':_0xd1111a[_0xa31e('0x45')]})['then'](function(_0x1f1a69){_0x2cbd13[_0xa31e('0x24')]=_0x1f1a69;if(_0x31f647[_0xa31e('0x3b')][_0xa31e('0x4a')]){_0xd1111a['include']=[{'all':!![]}];}return db[_0xa31e('0x6e')]['findAll'](_0xd1111a);})[_0xa31e('0x2b')](function(_0x5e2b85){_0x2cbd13[_0xa31e('0x4c')]=_0x5e2b85;return _0x2cbd13;});}})['then'](respondWithFilteredResult(_0x1b026b,_0xd1111a))['catch'](handleError(_0x1b026b,null));};exports[_0xa31e('0x6f')]=function(_0x5d8f36,_0x4ac0ae,_0x60a66c){var _0x5f07c2={};var _0x3a49af={};var _0x420830;var _0x208a20;return db[_0xa31e('0x36')][_0xa31e('0x66')]({'where':{'id':_0x5d8f36[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x4ac0ae,null))[_0xa31e('0x2b')](function(_0x4758bd){if(_0x4758bd){_0x420830=_0x4758bd;_0x3a49af[_0xa31e('0x39')]=_['keys'](db['Team']['rawAttributes']);_0x3a49af['query']=_[_0xa31e('0x3a')](_0x5d8f36['query']);_0x3a49af[_0xa31e('0x3c')]=_[_0xa31e('0x3d')](_0x3a49af[_0xa31e('0x39')],_0x3a49af['query']);_0x5f07c2['attributes']=_[_0xa31e('0x3d')](_0x3a49af[_0xa31e('0x39')],qs['fields'](_0x5d8f36[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x5f07c2[_0xa31e('0x3e')]=_0x5f07c2['attributes']['length']?_0x5f07c2[_0xa31e('0x3e')]:_0x3a49af[_0xa31e('0x39')];_0x5f07c2[_0xa31e('0x43')]=qs[_0xa31e('0x44')](_0x5d8f36[_0xa31e('0x3b')][_0xa31e('0x44')]);_0x5f07c2[_0xa31e('0x45')]=qs[_0xa31e('0x3c')](_[_0xa31e('0x46')](_0x5d8f36[_0xa31e('0x3b')],_0x3a49af['filters']));if(_0x5d8f36[_0xa31e('0x3b')]['filter']){_0x5f07c2[_0xa31e('0x45')]=_[_0xa31e('0x47')](_0x5f07c2[_0xa31e('0x45')],{'$or':_[_0xa31e('0x2f')](_0x5f07c2[_0xa31e('0x3e')],function(_0x3146c1){var _0x1646f2={};_0x1646f2[_0x3146c1]={'$like':'%'+_0x5d8f36[_0xa31e('0x3b')]['filter']+'%'};return _0x1646f2;})});}_0x5f07c2=_[_0xa31e('0x47')]({},_0x5f07c2,_0x5d8f36[_0xa31e('0x49')]);return _0x420830[_0xa31e('0x6f')](_0x5f07c2);}})[_0xa31e('0x2b')](function(_0x5403d6){if(_0x5403d6){_0x208a20=_0x5403d6['length'];if(!_0x5d8f36[_0xa31e('0x3b')][_0xa31e('0x41')](_0xa31e('0x42'))){_0x5f07c2[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x5d8f36[_0xa31e('0x3b')][_0xa31e('0x23')]);_0x5f07c2[_0xa31e('0x21')]=qs['offset'](_0x5d8f36[_0xa31e('0x3b')][_0xa31e('0x21')]);}return _0x420830[_0xa31e('0x6f')](_0x5f07c2);}})[_0xa31e('0x2b')](function(_0x20bbf1){if(_0x20bbf1){return _0x20bbf1?{'count':_0x208a20,'rows':_0x20bbf1}:null;}})[_0xa31e('0x2b')](respondWithResult(_0x4ac0ae,null))[_0xa31e('0x4d')](handleError(_0x4ac0ae,null));};exports[_0xa31e('0x70')]=function(_0x26180f,_0x3820f1,_0x1ef996){var _0x44622f=_0x26180f[_0xa31e('0x62')]['teams'];var _0x3fcf27=_[_0xa31e('0x2f')](_0x44622f,'id');return db[_0xa31e('0x71')][_0xa31e('0x4b')]({'where':{'id':_0x3fcf27},'attributes':['id'],'include':[{'model':db[_0xa31e('0x72')],'as':'Agents','attributes':['id',_0xa31e('0x32'),'online',_0xa31e('0x73'),_0xa31e('0x74')],'raw':!![]}]})[_0xa31e('0x2b')](function(_0x263e53){if(_0x263e53){var _0x51666f=_[_0xa31e('0x75')](_0x263e53,function(_0x28964f){var _0x3ce30a=_0x28964f[_0xa31e('0x5e')]({'plain':!![]});_0x3ce30a[_0xa31e('0x76')]['forEach'](function(_0x4025b5){_0x4025b5['penalty']=_['find'](_0x44622f,{'id':_0x3ce30a['id']})[_0xa31e('0x77')];});return _0x3ce30a[_0xa31e('0x76')];});return db[_0xa31e('0x36')][_0xa31e('0x52')]({'where':{'id':_0x26180f['params']['id']}})['then'](function(_0x217b6e){return db['sequelize'][_0xa31e('0x78')](function(_0xe3477a){return _0x217b6e[_0xa31e('0x70')](_0x3fcf27,{'transaction':_0xe3477a})[_0xa31e('0x2b')](function(){return BPromise[_0xa31e('0x79')](_0x44622f,function(_0x2dab46){return db[_0xa31e('0x7a')][_0xa31e('0x7b')]({'TeamId':_0x2dab46['id'],'VoiceQueueId':_0x26180f[_0xa31e('0x4f')]['id'],'penalty':_0x2dab46[_0xa31e('0x77')]},{'transaction':_0xe3477a});});})[_0xa31e('0x2b')](function(){return BPromise[_0xa31e('0x79')](_0x51666f,function(_0x1e256f){return db['UserVoiceQueue'][_0xa31e('0x7c')]({'where':{'UserId':_0x1e256f['id'],'VoiceQueueId':_0x26180f[_0xa31e('0x4f')]['id']},'defaults':{'penalty':_0x1e256f['penalty']},'transaction':_0xe3477a});});})[_0xa31e('0x2b')](function(){return BPromise[_0xa31e('0x79')](_[_0xa31e('0x2e')](_0x51666f,{'online':!![]}),function(_0x17378f){return db[_0xa31e('0x7d')][_0xa31e('0x7b')]({'membername':_0x17378f['name'],'UserId':_0x17378f['id'],'queue_name':_0x217b6e[_0xa31e('0x32')],'VoiceQueueId':_0x217b6e['id'],'interface':_[_0xa31e('0x7e')](_0x17378f[_0xa31e('0x74')])?util['format'](_0xa31e('0x7f'),_0x17378f[_0xa31e('0x32')]):_0x17378f['interface'],'paused':_0x17378f[_0xa31e('0x73')]||![],'penalty':_0x17378f['penalty']},{'transaction':_0xe3477a});});})['then'](function(){_0x51666f[_0xa31e('0x80')](function(_0x10cdc6){socket[_0xa31e('0x81')](_0xa31e('0x82'),{'UserId':_0x10cdc6['id'],'VoiceQueueId':_0x217b6e['id']});});});});});}})[_0xa31e('0x2b')](respondWithStatusCode(_0x3820f1,null))[_0xa31e('0x4d')](handleError(_0x3820f1,null));};exports[_0xa31e('0x83')]=function(_0x1bd3d3,_0x5779c8,_0xc8aa05){return db[_0xa31e('0x71')][_0xa31e('0x4b')]({'where':{'id':_0x1bd3d3[_0xa31e('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa31e('0x72')],'as':_0xa31e('0x76'),'attributes':['id'],'raw':!![]}]})[_0xa31e('0x2b')](handleEntityNotFound(_0x5779c8,null))[_0xa31e('0x2b')](function(_0x117ac2){var _0x457fd0=_[_0xa31e('0x2f')](_0x117ac2,'id');var _0x278f4e=[];var _0x38b66d=[];var _0x43528f=squel[_0xa31e('0x84')]();_0x43528f['field']('tq.TeamId')[_0xa31e('0x85')]('team_has_voice_queues','tq')[_0xa31e('0x86')](_0xa31e('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa31e('0x45')]('VoiceQueueId\x20=\x20?',_0x1bd3d3[_0xa31e('0x4f')]['id']);for(var _0x341f6d=0x0;_0x341f6d<_0x117ac2[_0xa31e('0x40')];_0x341f6d+=0x1){let _0x5d5621=_0x117ac2[_0x341f6d];for(var _0x5799c2=0x0;_0x5799c2<_0x5d5621[_0xa31e('0x76')]['length'];_0x5799c2+=0x1){let _0x579268=_0x5d5621['Agents'][_0x5799c2];var _0x83439b=_0x43528f[_0xa31e('0x5d')]();_0x83439b['where']('ut.UserId\x20=\x20?',_0x579268['id']);_0x38b66d['push'](db['sequelize'][_0xa31e('0x3b')](_0x83439b['toString'](),{'type':db['sequelize'][_0xa31e('0x88')]['SELECT']})[_0xa31e('0x2b')](function(_0x3f8554){if(_0x3f8554[_0xa31e('0x40')]===0x1){return _0x579268['id'];}else{var _0x4b385c=_[_0xa31e('0x89')](_[_0xa31e('0x2f')](_0x3f8554,_0xa31e('0x8a')),function(_0x57734d){return _[_0xa31e('0x31')](_0x457fd0,_0x57734d);});if(_0x4b385c){return _0x579268['id'];}}}));}}return BPromise[_0xa31e('0x8b')](_0x38b66d)[_0xa31e('0x2b')](function(_0x1f8e9d){_0x278f4e=_(_0x278f4e)[_0xa31e('0x8c')](_0x1f8e9d)['compact']()[_0xa31e('0x30')]();return db['VoiceQueue'][_0xa31e('0x52')]({'where':{'id':_0x1bd3d3[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](function(_0x1873a6){return db['sequelize'][_0xa31e('0x78')](function(_0x53afbd){return _0x1873a6[_0xa31e('0x83')](_0x1bd3d3[_0xa31e('0x3b')][_0xa31e('0x8d')],{'transaction':_0x53afbd})[_0xa31e('0x2b')](function(){if(!_[_0xa31e('0x8e')](_0x278f4e)){return _0x1873a6[_0xa31e('0x8f')](_0x278f4e,{'transaction':_0x53afbd})[_0xa31e('0x2b')](function(){return db[_0xa31e('0x7d')][_0xa31e('0x2c')]({'where':{'VoiceQueueId':_0x1bd3d3[_0xa31e('0x4f')]['id'],'UserId':_0x278f4e},'transaction':_0x53afbd});});}})['then'](function(){_0x278f4e[_0xa31e('0x80')](function(_0x116e85){socket[_0xa31e('0x81')](_0xa31e('0x90'),{'UserId':_0x116e85,'VoiceQueueId':_0x1873a6['id']});});});});});});})[_0xa31e('0x2b')](respondWithStatusCode(_0x5779c8,null))[_0xa31e('0x4d')](handleError(_0x5779c8,null));};exports[_0xa31e('0x91')]=function(_0x50b816,_0x5e565d,_0x1bda49){var _0x3e7f16,_0x1cf964;return db[_0xa31e('0x36')][_0xa31e('0x52')]({'where':{'id':_0x50b816[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x5e565d,null))[_0xa31e('0x2b')](function(_0x1ca441){if(_0x1ca441){_0x1cf964=_0x1ca441;return _0x1ca441[_0xa31e('0x91')](_0x50b816[_0xa31e('0x62')][_0xa31e('0x8d')],_[_0xa31e('0x5f')](_0x50b816[_0xa31e('0x62')],['ids','id'])||{})[_0xa31e('0x92')](function(_0x4acf3e){for(var _0x14de58=0x0;_0x14de58<_0x50b816[_0xa31e('0x62')]['ids'][_0xa31e('0x40')];_0x14de58+=0x1){socket[_0xa31e('0x81')](_0xa31e('0x82'),{'UserId':Number(_0x50b816[_0xa31e('0x62')]['ids'][_0x14de58]),'VoiceQueueId':Number(_0x50b816['params']['id'])});}return _0x4acf3e;});}})[_0xa31e('0x2b')](function(_0x7205b5){_0x3e7f16=_0x7205b5||[];if(_0x1cf964){return db['User'][_0xa31e('0x4b')]({'where':{'id':_0x50b816[_0xa31e('0x62')][_0xa31e('0x8d')]},'attributes':['id',_0xa31e('0x32'),_0xa31e('0x93'),_0xa31e('0x73'),_0xa31e('0x74')],'raw':!![]});}})[_0xa31e('0x2b')](function(_0x44f7dc){if(!_[_0xa31e('0x8e')](_0x44f7dc)){var _0x322f34=[];for(var _0x591d11=0x0;_0x591d11<_0x44f7dc['length'];_0x591d11++){if(_0x44f7dc[_0x591d11][_0xa31e('0x93')]){_0x322f34[_0xa31e('0x94')](db['UserVoiceQueueRt']['upsert']({'membername':_0x44f7dc[_0x591d11][_0xa31e('0x32')],'UserId':_0x44f7dc[_0x591d11]['id'],'queue_name':_0x1cf964[_0xa31e('0x32')],'VoiceQueueId':_0x1cf964['id'],'interface':_['isNil'](_0x44f7dc[_0x591d11]['interface'])?util[_0xa31e('0x95')](_0xa31e('0x7f'),_0x44f7dc[_0x591d11]['name']):_0x44f7dc[_0x591d11][_0xa31e('0x74')],'paused':_0x44f7dc[_0x591d11][_0xa31e('0x73')]||![],'penalty':_0x50b816['body']['penalty']||0x0}));}}return BPromise['all'](_0x322f34);}})['then'](function(){return _0x3e7f16;})[_0xa31e('0x2b')](respondWithResult(_0x5e565d,null))[_0xa31e('0x4d')](handleError(_0x5e565d,null));};exports[_0xa31e('0x8f')]=function(_0x2ff06d,_0x12a7da,_0x37cff0){return db['VoiceQueue']['find']({'where':{'id':_0x2ff06d[_0xa31e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x12a7da,null))[_0xa31e('0x2b')](function(_0x37f11d){if(_0x37f11d){return _0x37f11d[_0xa31e('0x8f')](_0x2ff06d['query'][_0xa31e('0x8d')])['then'](function(){if(_[_0xa31e('0x96')](_0x2ff06d[_0xa31e('0x3b')][_0xa31e('0x8d')])){for(var _0x22cc6a=0x0;_0x22cc6a<_0x2ff06d[_0xa31e('0x3b')]['ids'][_0xa31e('0x40')];_0x22cc6a+=0x1){socket[_0xa31e('0x81')](_0xa31e('0x90'),{'UserId':Number(_0x2ff06d[_0xa31e('0x3b')][_0xa31e('0x8d')][_0x22cc6a]),'VoiceQueueId':Number(_0x2ff06d['params']['id'])});}}else{socket['emit'](_0xa31e('0x90'),{'UserId':Number(_0x2ff06d['query'][_0xa31e('0x8d')]),'VoiceQueueId':Number(_0x2ff06d['params']['id'])});}});}})['then'](function(_0x3634df){return db[_0xa31e('0x7d')][_0xa31e('0x2c')]({'where':{'VoiceQueueId':_0x2ff06d[_0xa31e('0x4f')]['id'],'UserId':_0x2ff06d['query']['ids']}})['then'](function(){return _0x3634df;});})[_0xa31e('0x2b')](respondWithStatusCode(_0x12a7da,null))[_0xa31e('0x4d')](handleError(_0x12a7da,null));};exports[_0xa31e('0x97')]=function(_0x1bdcdc,_0x1a8672,_0x39a44c){var _0x2d46d7={};var _0x4504f3={};var _0x59a765;var _0xb6365;return db['VoiceQueue'][_0xa31e('0x66')]({'where':{'id':_0x1bdcdc['params']['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x1a8672,null))['then'](function(_0x4f8539){if(_0x4f8539){_0x59a765=_0x4f8539;_0x4504f3[_0xa31e('0x39')]=_['keys'](db[_0xa31e('0x72')][_0xa31e('0x50')]);_0x4504f3[_0xa31e('0x3b')]=_[_0xa31e('0x3a')](_0x1bdcdc[_0xa31e('0x3b')]);_0x4504f3['filters']=_['intersection'](_0x4504f3['model'],_0x4504f3[_0xa31e('0x3b')]);_0x2d46d7[_0xa31e('0x3e')]=_['intersection'](_0x4504f3[_0xa31e('0x39')],qs['fields'](_0x1bdcdc[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x2d46d7['attributes']=_0x2d46d7[_0xa31e('0x3e')][_0xa31e('0x40')]?_0x2d46d7[_0xa31e('0x3e')]:_0x4504f3[_0xa31e('0x39')];_0x2d46d7[_0xa31e('0x43')]=qs[_0xa31e('0x44')](_0x1bdcdc[_0xa31e('0x3b')][_0xa31e('0x44')]);_0x2d46d7[_0xa31e('0x45')]=qs['filters'](_[_0xa31e('0x46')](_0x1bdcdc[_0xa31e('0x3b')],_0x4504f3[_0xa31e('0x3c')]));if(_0x1bdcdc[_0xa31e('0x3b')][_0xa31e('0x2e')]){_0x2d46d7[_0xa31e('0x45')]=_[_0xa31e('0x47')](_0x2d46d7[_0xa31e('0x45')],{'$or':_[_0xa31e('0x2f')](_0x2d46d7[_0xa31e('0x3e')],function(_0x73eec1){var _0x5c9b69={};_0x5c9b69[_0x73eec1]={'$like':'%'+_0x1bdcdc[_0xa31e('0x3b')][_0xa31e('0x2e')]+'%'};return _0x5c9b69;})});}_0x2d46d7=_['merge']({},_0x2d46d7,_0x1bdcdc[_0xa31e('0x49')]);return _0x59a765[_0xa31e('0x97')](_0x2d46d7);}})[_0xa31e('0x2b')](function(_0x58cd62){if(_0x58cd62){_0xb6365=_0x58cd62[_0xa31e('0x40')];if(!_0x1bdcdc[_0xa31e('0x3b')][_0xa31e('0x41')](_0xa31e('0x42'))){_0x2d46d7[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x1bdcdc[_0xa31e('0x3b')][_0xa31e('0x23')]);_0x2d46d7[_0xa31e('0x21')]=qs[_0xa31e('0x21')](_0x1bdcdc[_0xa31e('0x3b')]['offset']);}return _0x59a765[_0xa31e('0x97')](_0x2d46d7);}})[_0xa31e('0x2b')](function(_0x45002c){if(_0x45002c){return _0x45002c?{'count':_0xb6365,'rows':_0x45002c}:null;}})['then'](respondWithResult(_0x1a8672,null))[_0xa31e('0x4d')](handleError(_0x1a8672,null));};exports[_0xa31e('0x98')]=function(_0x3591d0,_0x4a4101,_0x2b3188){var _0x5742a4={};var _0x388b0a={};var _0xb2bf5c;var _0xd4b0a3;return db[_0xa31e('0x36')][_0xa31e('0x66')]({'where':{'id':_0x3591d0[_0xa31e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4a4101,null))[_0xa31e('0x2b')](function(_0x51595d){if(_0x51595d){_0xb2bf5c=_0x51595d;_0x388b0a[_0xa31e('0x39')]=_['keys'](db['UserVoiceQueueRt'][_0xa31e('0x50')]);_0x388b0a['query']=_[_0xa31e('0x3a')](_0x3591d0[_0xa31e('0x3b')]);_0x388b0a[_0xa31e('0x3c')]=_[_0xa31e('0x3d')](_0x388b0a[_0xa31e('0x39')],_0x388b0a[_0xa31e('0x3b')]);_0x5742a4[_0xa31e('0x3e')]=_[_0xa31e('0x3d')](_0x388b0a[_0xa31e('0x39')],qs[_0xa31e('0x3f')](_0x3591d0[_0xa31e('0x3b')]['fields']));_0x5742a4[_0xa31e('0x3e')]=_0x5742a4[_0xa31e('0x3e')][_0xa31e('0x40')]?_0x5742a4[_0xa31e('0x3e')]:_0x388b0a['model'];_0x5742a4[_0xa31e('0x43')]=qs[_0xa31e('0x44')](_0x3591d0['query']['sort']);_0x5742a4[_0xa31e('0x45')]=qs[_0xa31e('0x3c')](_[_0xa31e('0x46')](_0x3591d0[_0xa31e('0x3b')],_0x388b0a['filters']));if(_0x3591d0['query'][_0xa31e('0x2e')]){_0x5742a4['where']=_['merge'](_0x5742a4[_0xa31e('0x45')],{'$or':_[_0xa31e('0x2f')](_0x5742a4[_0xa31e('0x3e')],function(_0x2c5d28){var _0x46a89d={};_0x46a89d[_0x2c5d28]={'$like':'%'+_0x3591d0[_0xa31e('0x3b')][_0xa31e('0x2e')]+'%'};return _0x46a89d;})});}_0x5742a4=_[_0xa31e('0x47')]({},_0x5742a4,_0x3591d0[_0xa31e('0x49')]);return _0xb2bf5c[_0xa31e('0x98')](_0x5742a4);}})[_0xa31e('0x2b')](function(_0x112c54){if(_0x112c54){_0xd4b0a3=_0x112c54[_0xa31e('0x40')];if(!_0x3591d0[_0xa31e('0x3b')][_0xa31e('0x41')]('nolimit')){_0x5742a4[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x3591d0[_0xa31e('0x3b')][_0xa31e('0x23')]);_0x5742a4[_0xa31e('0x21')]=qs[_0xa31e('0x21')](_0x3591d0['query'][_0xa31e('0x21')]);}return _0xb2bf5c[_0xa31e('0x98')](_0x5742a4);}})[_0xa31e('0x2b')](function(_0x8d2878){return _0x8d2878?{'count':_0xd4b0a3,'rows':_0x8d2878}:null;})[_0xa31e('0x2b')](respondWithResult(_0x4a4101,null))[_0xa31e('0x4d')](handleError(_0x4a4101,null));};exports['getLists']=function(_0x315061,_0x22947a,_0x858bf5){var _0x5356e5={};var _0x1af936={};var _0x571c6e;var _0x2bc77e;return db[_0xa31e('0x36')]['findOne']({'where':{'id':_0x315061[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x22947a,null))[_0xa31e('0x2b')](function(_0x2c8a29){if(_0x2c8a29){_0x571c6e=_0x2c8a29;_0x1af936[_0xa31e('0x39')]=_['keys'](db[_0xa31e('0x99')][_0xa31e('0x50')]);_0x1af936[_0xa31e('0x3b')]=_[_0xa31e('0x3a')](_0x315061[_0xa31e('0x3b')]);_0x1af936['filters']=_['intersection'](_0x1af936[_0xa31e('0x39')],_0x1af936[_0xa31e('0x3b')]);_0x5356e5['attributes']=_[_0xa31e('0x3d')](_0x1af936['model'],qs['fields'](_0x315061[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x5356e5[_0xa31e('0x3e')]=_0x5356e5[_0xa31e('0x3e')][_0xa31e('0x40')]?_0x5356e5[_0xa31e('0x3e')]:_0x1af936[_0xa31e('0x39')];_0x5356e5['order']=qs[_0xa31e('0x44')](_0x315061[_0xa31e('0x3b')]['sort']);_0x5356e5[_0xa31e('0x45')]=qs[_0xa31e('0x3c')](_[_0xa31e('0x46')](_0x315061[_0xa31e('0x3b')],_0x1af936['filters']));if(_0x315061[_0xa31e('0x3b')][_0xa31e('0x2e')]){_0x5356e5['where']=_[_0xa31e('0x47')](_0x5356e5['where'],{'$or':_['map'](_0x5356e5[_0xa31e('0x3e')],function(_0x3ba4f4){var _0x1f9347={};_0x1f9347[_0x3ba4f4]={'$like':'%'+_0x315061['query'][_0xa31e('0x2e')]+'%'};return _0x1f9347;})});}_0x5356e5=_[_0xa31e('0x47')]({},_0x5356e5,_0x315061[_0xa31e('0x49')]);return _0x571c6e['getLists'](_0x5356e5);}})['then'](function(_0x530309){if(_0x530309){_0x2bc77e=_0x530309['length'];if(!_0x315061[_0xa31e('0x3b')][_0xa31e('0x41')](_0xa31e('0x42'))){_0x5356e5[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x315061['query'][_0xa31e('0x23')]);_0x5356e5['offset']=qs[_0xa31e('0x21')](_0x315061[_0xa31e('0x3b')]['offset']);}return _0x571c6e['getLists'](_0x5356e5);}})[_0xa31e('0x2b')](function(_0x556d2f){if(_0x556d2f){return _0x556d2f?{'count':_0x2bc77e,'rows':_0x556d2f}:null;}})[_0xa31e('0x2b')](respondWithResult(_0x22947a,null))[_0xa31e('0x4d')](handleError(_0x22947a,null));};exports[_0xa31e('0x9a')]=function(_0x51fdcd,_0x190cc9,_0x1f894a){var _0x5bed81,_0x121143;return db[_0xa31e('0x36')][_0xa31e('0x52')]({'where':{'id':_0x51fdcd[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x190cc9,null))[_0xa31e('0x2b')](function(_0x5b9283){if(_0x5b9283){_0x121143=_0x5b9283;return _0x5b9283[_0xa31e('0x9a')](_0x51fdcd['body'][_0xa31e('0x8d')],_[_0xa31e('0x5f')](_0x51fdcd['body'],[_0xa31e('0x8d'),'id'])||{});}return null;})[_0xa31e('0x92')](function(_0x1c6bce){var _0x34f6b3;_0x5bed81=_0x1c6bce||[];var _0x300c17=[];if(_0x1c6bce){for(var _0x580900=0x0;_0x580900<_0x1c6bce['length'];_0x580900+=0x1){var _0x2e49f2=_0x1c6bce[_0x580900][_0xa31e('0x5e')]({'plain':!![]});_0x121143[_0xa31e('0x9b')]=_0x51fdcd[_0xa31e('0x62')][_0xa31e('0x9b')]?_0x51fdcd[_0xa31e('0x62')][_0xa31e('0x9b')]:_0x121143['dialCheckDuplicateType'];switch(_0x121143[_0xa31e('0x9b')]){case _0xa31e('0x9c'):_0x34f6b3=squel[_0xa31e('0x9d')]()[_0xa31e('0x9e')](_0xa31e('0x9f'))[_0xa31e('0xa0')](['phone','scheduledAt',_0xa31e('0xa1'),'ListId',_0xa31e('0x67'),'createdAt',_0xa31e('0x61')],squel['select']()[_0xa31e('0xa2')](_0xa31e('0xa3'),_0xa31e('0xa3'))[_0xa31e('0xa2')]('NOW()',_0xa31e('0xa4'))[_0xa31e('0xa2')]('id',_0xa31e('0xa1'))[_0xa31e('0xa2')](_0x2e49f2[_0xa31e('0xa5')]['toString'](),_0xa31e('0xa6'))[_0xa31e('0xa2')](_0x51fdcd[_0xa31e('0x4f')]['id']['toString'](),'VoiceQueueId')[_0xa31e('0xa2')](_0xa31e('0xa7'),_0xa31e('0x60'))[_0xa31e('0xa2')](_0xa31e('0xa7'),_0xa31e('0x61'))[_0xa31e('0x85')](_0xa31e('0xa8'))[_0xa31e('0x45')]('deletedAt\x20IS\x20NULL')[_0xa31e('0x45')](_0xa31e('0xa9'),_0x2e49f2['CmListId'][_0xa31e('0xaa')]())['where'](_0xa31e('0xab'))[_0xa31e('0x45')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa31e('0xa2')](_0xa31e('0xac'))[_0xa31e('0x85')](_0xa31e('0xad'))['where'](_0xa31e('0xae'),_0x51fdcd[_0xa31e('0x4f')]['id']['toString']()))[_0xa31e('0x45')](_0xa31e('0xaf'),squel[_0xa31e('0x84')]()[_0xa31e('0xa2')]('COALESCE(phone,\x27\x27)')[_0xa31e('0x85')]('cm_hopper')['where'](_0xa31e('0xae'),_0x51fdcd['params']['id'][_0xa31e('0xaa')]())))[_0xa31e('0xaa')]();break;case _0xa31e('0xb0'):_0x34f6b3=squel[_0xa31e('0x9d')]()[_0xa31e('0x9e')]('cm_hopper')[_0xa31e('0xa0')]([_0xa31e('0xa3'),_0xa31e('0xa4'),'ContactId',_0xa31e('0xa6'),'VoiceQueueId',_0xa31e('0x60'),'updatedAt'],squel[_0xa31e('0x84')]()[_0xa31e('0xa2')](_0xa31e('0xa3'),_0xa31e('0xa3'))['field'](_0xa31e('0xa7'),_0xa31e('0xa4'))[_0xa31e('0xa2')]('id',_0xa31e('0xa1'))[_0xa31e('0xa2')](_0x2e49f2[_0xa31e('0xa5')][_0xa31e('0xaa')](),_0xa31e('0xa6'))[_0xa31e('0xa2')](_0x51fdcd[_0xa31e('0x4f')]['id'][_0xa31e('0xaa')](),_0xa31e('0x67'))[_0xa31e('0xa2')](_0xa31e('0xa7'),_0xa31e('0x60'))[_0xa31e('0xa2')](_0xa31e('0xa7'),'updatedAt')['from'](_0xa31e('0xa8'))[_0xa31e('0x45')](_0xa31e('0xb1'))[_0xa31e('0x45')](_0xa31e('0xa9'),_0x2e49f2[_0xa31e('0xa5')][_0xa31e('0xaa')]())[_0xa31e('0x45')](_0xa31e('0xab'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa31e('0xb2'))[_0xa31e('0x85')](_0xa31e('0x9f'))[_0xa31e('0x45')](_0xa31e('0xae'),_0x51fdcd[_0xa31e('0x4f')]['id'][_0xa31e('0xaa')]())))[_0xa31e('0xaa')]();break;default:_0x34f6b3=squel['insert']()[_0xa31e('0x9e')](_0xa31e('0x9f'))[_0xa31e('0xa0')](['phone',_0xa31e('0xa4'),_0xa31e('0xa1'),_0xa31e('0xa6'),_0xa31e('0x67'),_0xa31e('0x60'),_0xa31e('0x61')],squel[_0xa31e('0x84')]()[_0xa31e('0xa2')](_0xa31e('0xa3'),'phone')['field'](_0xa31e('0xa7'),_0xa31e('0xa4'))[_0xa31e('0xa2')]('id','ContactId')['field'](_0x2e49f2[_0xa31e('0xa5')][_0xa31e('0xaa')](),_0xa31e('0xa6'))[_0xa31e('0xa2')](_0x51fdcd[_0xa31e('0x4f')]['id'][_0xa31e('0xaa')](),_0xa31e('0x67'))['field']('NOW()',_0xa31e('0x60'))[_0xa31e('0xa2')](_0xa31e('0xa7'),_0xa31e('0x61'))['from'](_0xa31e('0xa8'))[_0xa31e('0x45')](_0xa31e('0xb1'))['where']('ListId\x20=\x20?',_0x2e49f2[_0xa31e('0xa5')][_0xa31e('0xaa')]())[_0xa31e('0x45')](_0xa31e('0xab')))['toString']();}_0x300c17[_0xa31e('0x94')](db[_0xa31e('0xb3')][_0xa31e('0x3b')](_0x34f6b3));}return BPromise['all'](_0x300c17);}})[_0xa31e('0x2b')](function(){return _0x5bed81;})[_0xa31e('0x2b')](respondWithResult(_0x190cc9,null))[_0xa31e('0x4d')](handleError(_0x190cc9,null));};exports[_0xa31e('0xb4')]=function(_0x2e049f,_0x47e757,_0x4a1e9e){return db[_0xa31e('0x36')][_0xa31e('0x52')]({'where':{'id':_0x2e049f[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x47e757,null))[_0xa31e('0x2b')](function(_0x579fd4){if(_0x579fd4){return _0x579fd4[_0xa31e('0xb4')](_0x2e049f[_0xa31e('0x3b')][_0xa31e('0x8d')]);}})['then'](function(_0x5033e5){if(_0x5033e5){return db['CmHopper'][_0xa31e('0x2c')]({'where':{'ListId':_0x2e049f['query'][_0xa31e('0x8d')],'VoiceQueueId':_0x2e049f[_0xa31e('0x4f')]['id']}})['then'](function(){return _0x5033e5;});}})[_0xa31e('0x2b')](respondWithStatusCode(_0x47e757,null))['catch'](handleError(_0x47e757,null));};exports[_0xa31e('0xb5')]=function(_0x511d9b,_0x16f49d,_0x33d8ac){var _0x2e6091={};var _0x2f6d60={};var _0x36d31d;var _0x24f8c8;return db[_0xa31e('0x36')][_0xa31e('0x66')]({'where':{'id':_0x511d9b[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x16f49d,null))[_0xa31e('0x2b')](function(_0x575b3a){if(_0x575b3a){_0x36d31d=_0x575b3a;_0x2f6d60[_0xa31e('0x39')]=_['keys'](db[_0xa31e('0x99')][_0xa31e('0x50')]);_0x2f6d60['query']=_[_0xa31e('0x3a')](_0x511d9b[_0xa31e('0x3b')]);_0x2f6d60[_0xa31e('0x3c')]=_[_0xa31e('0x3d')](_0x2f6d60[_0xa31e('0x39')],_0x2f6d60[_0xa31e('0x3b')]);_0x2e6091[_0xa31e('0x3e')]=_['intersection'](_0x2f6d60[_0xa31e('0x39')],qs[_0xa31e('0x3f')](_0x511d9b[_0xa31e('0x3b')][_0xa31e('0x3f')]));_0x2e6091[_0xa31e('0x3e')]=_0x2e6091[_0xa31e('0x3e')][_0xa31e('0x40')]?_0x2e6091[_0xa31e('0x3e')]:_0x2f6d60[_0xa31e('0x39')];_0x2e6091['order']=qs[_0xa31e('0x44')](_0x511d9b[_0xa31e('0x3b')][_0xa31e('0x44')]);_0x2e6091[_0xa31e('0x45')]=qs['filters'](_[_0xa31e('0x46')](_0x511d9b[_0xa31e('0x3b')],_0x2f6d60[_0xa31e('0x3c')]));if(_0x511d9b['query'][_0xa31e('0x2e')]){_0x2e6091[_0xa31e('0x45')]=_[_0xa31e('0x47')](_0x2e6091[_0xa31e('0x45')],{'$or':_['map'](_0x2e6091[_0xa31e('0x3e')],function(_0x32a9bc){var _0x42ab1c={};_0x42ab1c[_0x32a9bc]={'$like':'%'+_0x511d9b[_0xa31e('0x3b')][_0xa31e('0x2e')]+'%'};return _0x42ab1c;})});}_0x2e6091=_[_0xa31e('0x47')]({},_0x2e6091,_0x511d9b[_0xa31e('0x49')]);return _0x36d31d[_0xa31e('0xb5')](_0x2e6091);}})[_0xa31e('0x2b')](function(_0x113784){if(_0x113784){_0x24f8c8=_0x113784[_0xa31e('0x40')];if(!_0x511d9b['query'][_0xa31e('0x41')](_0xa31e('0x42'))){_0x2e6091[_0xa31e('0x23')]=qs[_0xa31e('0x23')](_0x511d9b['query'][_0xa31e('0x23')]);_0x2e6091[_0xa31e('0x21')]=qs['offset'](_0x511d9b[_0xa31e('0x3b')][_0xa31e('0x21')]);}return _0x36d31d[_0xa31e('0xb5')](_0x2e6091);}})['then'](function(_0x29438d){if(_0x29438d){return _0x29438d?{'count':_0x24f8c8,'rows':_0x29438d}:null;}})['then'](respondWithResult(_0x16f49d,null))['catch'](handleError(_0x16f49d,null));};exports['addBlackLists']=function(_0x2a3648,_0x10c442,_0xf899a1){var _0x1228bc,_0xfa4a4f;return db['VoiceQueue'][_0xa31e('0x52')]({'where':{'id':_0x2a3648[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](handleEntityNotFound(_0x10c442,null))['then'](function(_0xf670ce){if(_0xf670ce){_0xfa4a4f=_0xf670ce;return _0xf670ce[_0xa31e('0xb6')](_0x2a3648[_0xa31e('0x62')][_0xa31e('0x8d')],_['omit'](_0x2a3648['body'],[_0xa31e('0x8d'),'id'])||{});}return null;})[_0xa31e('0x92')](function(_0x534665){var _0x5bbeb2;_0x1228bc=_0x534665||[];var _0x113776=[];if(_0x534665){for(var _0x3e0ddf=0x0;_0x3e0ddf<_0x534665[_0xa31e('0x40')];_0x3e0ddf+=0x1){var _0x33bc3c=_0x534665[_0x3e0ddf][_0xa31e('0x5e')]({'plain':!![]});_0x5bbeb2=squel[_0xa31e('0x9d')]()[_0xa31e('0x9e')](_0xa31e('0xb7'))[_0xa31e('0xa0')](['phone','ContactId',_0xa31e('0xa6'),'VoiceQueueId',_0xa31e('0x60'),_0xa31e('0x61')],squel[_0xa31e('0x84')]()[_0xa31e('0xa2')]('phone',_0xa31e('0xa3'))[_0xa31e('0xa2')]('id',_0xa31e('0xa1'))[_0xa31e('0xa2')](_0x33bc3c[_0xa31e('0xa5')][_0xa31e('0xaa')](),_0xa31e('0xa6'))[_0xa31e('0xa2')](_0x2a3648['params']['id'][_0xa31e('0xaa')](),_0xa31e('0x67'))['field']('NOW()',_0xa31e('0x60'))[_0xa31e('0xa2')](_0xa31e('0xa7'),_0xa31e('0x61'))[_0xa31e('0x85')](_0xa31e('0xa8'))['where'](_0xa31e('0xb1'))[_0xa31e('0x45')]('ListId\x20=\x20?',_0x33bc3c[_0xa31e('0xa5')][_0xa31e('0xaa')]())['where'](_0xa31e('0xab')))['toString']();_0x113776['push'](db[_0xa31e('0xb3')][_0xa31e('0x3b')](_0x5bbeb2));}return BPromise[_0xa31e('0x8b')](_0x113776);}})[_0xa31e('0x2b')](function(){return _0x1228bc;})[_0xa31e('0x2b')](respondWithResult(_0x10c442,null))[_0xa31e('0x4d')](handleError(_0x10c442,null));};exports['removeBlackLists']=function(_0x1674ef,_0xbab742,_0xf490ec){return db[_0xa31e('0x36')][_0xa31e('0x52')]({'where':{'id':_0x1674ef['params']['id']}})['then'](handleEntityNotFound(_0xbab742,null))['then'](function(_0xe9bd13){if(_0xe9bd13){return _0xe9bd13[_0xa31e('0xb8')](_0x1674ef['query'][_0xa31e('0x8d')]);}})[_0xa31e('0x2b')](function(_0x427e5){if(_0x427e5){return db[_0xa31e('0x6e')]['destroy']({'where':{'ListId':_0x1674ef['query'][_0xa31e('0x8d')],'VoiceQueueId':_0x1674ef[_0xa31e('0x4f')]['id']}})[_0xa31e('0x2b')](function(){return _0x427e5;});}})['then'](respondWithStatusCode(_0xbab742,null))[_0xa31e('0x4d')](handleError(_0xbab742,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 767cef4..1ace210 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 _0xa35f=['remove','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x42d529,_0x2ff3ea){var _0x37167a=function(_0x85d39b){while(--_0x85d39b){_0x42d529['push'](_0x42d529['shift']());}};_0x37167a(++_0x2ff3ea);}(_0xa35f,0xe9));var _0xfa35=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0xa35f[_0x580b15];return _0x1adb1b;};'use strict';var EventEmitter=require(_0xfa35('0x0'));var VoiceQueue=require(_0xfa35('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xfa35('0x2')](0x0);var events={'afterCreate':_0xfa35('0x3'),'afterUpdate':_0xfa35('0x4'),'afterDestroy':_0xfa35('0x5')};function emitEvent(_0x1d6b72){return function(_0x2fcd7d,_0x9aa08a,_0x1fd8c6){VoiceQueueEvents['emit'](_0x1d6b72+':'+_0x2fcd7d['id'],_0x2fcd7d);VoiceQueueEvents['emit'](_0x1d6b72,_0x2fcd7d);_0x1fd8c6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xfa35('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xf38a=['remove','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','save','update'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0xf38a,0x154));var _0xaf38=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0xf38a[_0x5e2152];return _0x5ddcf6;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xaf38('0x0'))['db'][_0xaf38('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf38('0x2'),'afterUpdate':_0xaf38('0x3'),'afterDestroy':_0xaf38('0x4')};function emitEvent(_0x5ab9e2){return function(_0x2c114f,_0x480bed,_0x27cd58){VoiceQueueEvents['emit'](_0x5ab9e2+':'+_0x2c114f['id'],_0x2c114f);VoiceQueueEvents['emit'](_0x5ab9e2,_0x2c114f);_0x27cd58(null);};}for(var e in events){if(events[_0xaf38('0x5')](e)){var event=events[e];VoiceQueue[_0xaf38('0x6')](e,emitEvent(event));}}module[_0xaf38('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index df648bd..8e42ee1 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x257544,_0x534546){var _0x3a90f5=function(_0x27c01c){while(--_0x27c01c){_0x257544['push'](_0x257544['shift']());}};_0x3a90f5(++_0x534546);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x3c8bab,_0x416c52){var _0x56c8b9=function(_0x50debd){while(--_0x50debd){_0x3c8bab['push'](_0x3c8bab['shift']());}};_0x56c8b9(++_0x416c52);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index f97ac33..b09bd78 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 _0x194e=['ShowVoiceQueue','VoiceQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch'];(function(_0x323e3d,_0x27c504){var _0x941c8c=function(_0x32cf38){while(--_0x32cf38){_0x323e3d['push'](_0x323e3d['shift']());}};_0x941c8c(++_0x27c504);}(_0x194e,0x1a4));var _0xe194=function(_0x5dfe43,_0x296b36){_0x5dfe43=_0x5dfe43-0x0;var _0x3ce55b=_0x194e[_0x5dfe43];return _0x3ce55b;};'use strict';var _=require(_0xe194('0x0'));var util=require(_0xe194('0x1'));var moment=require(_0xe194('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe194('0x3'));var db=require(_0xe194('0x4'))['db'];var utils=require(_0xe194('0x5'));var logger=require(_0xe194('0x6'))('rpc');var config=require(_0xe194('0x7'));var jayson=require(_0xe194('0x8'));var client=jayson[_0xe194('0x9')]['http']({'port':0x232a});config[_0xe194('0xa')]=_['defaults'](config[_0xe194('0xa')],{'host':_0xe194('0xb'),'port':0x18eb});var socket=require(_0xe194('0xc'))(new Redis(config[_0xe194('0xa')]));require(_0xe194('0xd'))[_0xe194('0xe')](socket);function respondWithRpcPromise(_0x19a70e,_0x495f37,_0x2c159a){return new BPromise(function(_0x48aefb,_0x5a3c5e){return client['request'](_0x19a70e,_0x2c159a)[_0xe194('0xf')](function(_0x2ed12f){logger[_0xe194('0x10')](_0xe194('0x11'),_0x495f37,'request\x20sent');logger[_0xe194('0x12')](_0xe194('0x13'),_0x495f37,_0xe194('0x14'),JSON[_0xe194('0x15')](_0x2ed12f));if(_0x2ed12f['error']){if(_0x2ed12f['error']['code']===0x1f4){logger[_0xe194('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x495f37,_0x2ed12f['error'][_0xe194('0x17')]);return _0x5a3c5e(_0x2ed12f['error'][_0xe194('0x17')]);}logger[_0xe194('0x16')](_0xe194('0x11'),_0x495f37,_0x2ed12f['error'][_0xe194('0x17')]);return _0x48aefb(_0x2ed12f[_0xe194('0x16')]['message']);}else{logger[_0xe194('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x495f37,_0xe194('0x14'));_0x48aefb(_0x2ed12f[_0xe194('0x18')][_0xe194('0x17')]);}})['catch'](function(_0x1df5f4){logger[_0xe194('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x495f37,_0x1df5f4);_0x5a3c5e(_0x1df5f4);});});}exports[_0xe194('0x19')]=function(_0x5cd921){var _0x195ea5=this;return new Promise(function(_0x28186d,_0x3aa386){return db['VoiceQueue'][_0xe194('0x1a')]({'raw':_0x5cd921[_0xe194('0x1b')]?_0x5cd921['options'][_0xe194('0x1c')]===undefined?!![]:![]:!![],'where':_0x5cd921[_0xe194('0x1b')]?_0x5cd921['options'][_0xe194('0x1d')]||null:null,'attributes':_0x5cd921['options']?_0x5cd921[_0xe194('0x1b')][_0xe194('0x1e')]||null:null,'limit':_0x5cd921[_0xe194('0x1b')]?_0x5cd921[_0xe194('0x1b')][_0xe194('0x1f')]||null:null,'include':_0x5cd921[_0xe194('0x1b')]?_0x5cd921['options'][_0xe194('0x20')]?_[_0xe194('0x21')](_0x5cd921[_0xe194('0x1b')][_0xe194('0x20')],function(_0x598ab2){return{'model':db[_0x598ab2[_0xe194('0x22')]],'as':_0x598ab2['as'],'attributes':_0x598ab2[_0xe194('0x1e')],'include':_0x598ab2[_0xe194('0x20')]?_[_0xe194('0x21')](_0x598ab2[_0xe194('0x20')],function(_0x1dc2e2){return{'model':db[_0x1dc2e2[_0xe194('0x22')]],'as':_0x1dc2e2['as'],'attributes':_0x1dc2e2[_0xe194('0x1e')],'include':_0x1dc2e2[_0xe194('0x20')]?_['map'](_0x1dc2e2[_0xe194('0x20')],function(_0x25c869){return{'model':db[_0x25c869['model']],'as':_0x25c869['as'],'attributes':_0x25c869['attributes']};}):[]};}):[]};}):[]:[]})[_0xe194('0xf')](function(_0x1438dd){logger[_0xe194('0x10')](_0xe194('0x19'),_0x5cd921);logger[_0xe194('0x12')]('GetVoiceQueue',_0x5cd921,JSON[_0xe194('0x15')](_0x1438dd));_0x28186d(_0x1438dd);})[_0xe194('0x23')](function(_0x411be4){logger['error']('GetVoiceQueue',_0x411be4[_0xe194('0x17')],_0x5cd921);_0x3aa386(_0x195ea5['error'](0x1f4,_0x411be4[_0xe194('0x17')]));});});};exports[_0xe194('0x24')]=function(_0x326a5c){var _0x588fc1=this;return new Promise(function(_0x315db5,_0xf1b228){return db[_0xe194('0x25')]['find']({'raw':_0x326a5c[_0xe194('0x1b')]?_0x326a5c[_0xe194('0x1b')][_0xe194('0x1c')]===undefined?!![]:![]:!![],'where':_0x326a5c[_0xe194('0x1b')]?_0x326a5c[_0xe194('0x1b')]['where']||null:null,'attributes':_0x326a5c[_0xe194('0x1b')]?_0x326a5c[_0xe194('0x1b')][_0xe194('0x1e')]||null:null,'include':_0x326a5c['options']?_0x326a5c['options'][_0xe194('0x20')]?_[_0xe194('0x21')](_0x326a5c[_0xe194('0x1b')][_0xe194('0x20')],function(_0x19f7d8){return{'model':db[_0x19f7d8['model']],'as':_0x19f7d8['as'],'attributes':_0x19f7d8['attributes'],'include':_0x19f7d8['include']?_[_0xe194('0x21')](_0x19f7d8[_0xe194('0x20')],function(_0x2ef92e){return{'model':db[_0x2ef92e[_0xe194('0x22')]],'as':_0x2ef92e['as'],'attributes':_0x2ef92e[_0xe194('0x1e')],'include':_0x2ef92e[_0xe194('0x20')]?_[_0xe194('0x21')](_0x2ef92e[_0xe194('0x20')],function(_0x11b291){return{'model':db[_0x11b291[_0xe194('0x22')]],'as':_0x11b291['as'],'attributes':_0x11b291[_0xe194('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59f19d){logger[_0xe194('0x10')](_0xe194('0x24'),_0x326a5c);logger[_0xe194('0x12')]('ShowVoiceQueue',_0x326a5c,JSON['stringify'](_0x59f19d));_0x315db5(_0x59f19d);})[_0xe194('0x23')](function(_0x3426e2){logger[_0xe194('0x16')]('ShowVoiceQueue',_0x3426e2['message'],_0x326a5c);_0xf1b228(_0x588fc1[_0xe194('0x16')](0x1f4,_0x3426e2[_0xe194('0x17')]));});});}; \ No newline at end of file +var _0xa711=['message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','include','map','model','info','debug','ShowVoiceQueue','find','where','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s'];(function(_0x388914,_0x3c63f9){var _0x1f9111=function(_0x23dd69){while(--_0x23dd69){_0x388914['push'](_0x388914['shift']());}};_0x1f9111(++_0x3c63f9);}(_0xa711,0x1a7));var _0x1a71=function(_0x35bbf5,_0x9a2c26){_0x35bbf5=_0x35bbf5-0x0;var _0x4c0fb7=_0xa711[_0x35bbf5];return _0x4c0fb7;};'use strict';var _=require(_0x1a71('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1a71('0x1'));var rs=require(_0x1a71('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a71('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a71('0x4'))(_0x1a71('0x5'));var config=require(_0x1a71('0x6'));var jayson=require(_0x1a71('0x7'));var client=jayson[_0x1a71('0x8')][_0x1a71('0x9')]({'port':0x232a});config[_0x1a71('0xa')]=_[_0x1a71('0xb')](config[_0x1a71('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0x1a71('0xc')](socket);function respondWithRpcPromise(_0x4683a6,_0x13972c,_0x42e66b){return new BPromise(function(_0xd4a984,_0x51c926){return client[_0x1a71('0xd')](_0x4683a6,_0x42e66b)[_0x1a71('0xe')](function(_0x4fc316){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x13972c,_0x1a71('0xf'));logger['debug'](_0x1a71('0x10'),_0x13972c,_0x1a71('0xf'),JSON[_0x1a71('0x11')](_0x4fc316));if(_0x4fc316[_0x1a71('0x12')]){if(_0x4fc316[_0x1a71('0x12')][_0x1a71('0x13')]===0x1f4){logger[_0x1a71('0x12')](_0x1a71('0x14'),_0x13972c,_0x4fc316['error'][_0x1a71('0x15')]);return _0x51c926(_0x4fc316['error'][_0x1a71('0x15')]);}logger[_0x1a71('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x13972c,_0x4fc316[_0x1a71('0x12')]['message']);return _0xd4a984(_0x4fc316[_0x1a71('0x12')][_0x1a71('0x15')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x13972c,_0x1a71('0xf'));_0xd4a984(_0x4fc316['result']['message']);}})[_0x1a71('0x16')](function(_0x10785d){logger[_0x1a71('0x12')](_0x1a71('0x14'),_0x13972c,_0x10785d);_0x51c926(_0x10785d);});});}exports[_0x1a71('0x17')]=function(_0x51b2a7){var _0x2229ed=this;return new Promise(function(_0x491583,_0x5d7289){return db[_0x1a71('0x18')][_0x1a71('0x19')]({'raw':_0x51b2a7[_0x1a71('0x1a')]?_0x51b2a7['options'][_0x1a71('0x1b')]===undefined?!![]:![]:!![],'where':_0x51b2a7[_0x1a71('0x1a')]?_0x51b2a7[_0x1a71('0x1a')]['where']||null:null,'attributes':_0x51b2a7[_0x1a71('0x1a')]?_0x51b2a7[_0x1a71('0x1a')][_0x1a71('0x1c')]||null:null,'limit':_0x51b2a7[_0x1a71('0x1a')]?_0x51b2a7[_0x1a71('0x1a')]['limit']||null:null,'include':_0x51b2a7[_0x1a71('0x1a')]?_0x51b2a7[_0x1a71('0x1a')][_0x1a71('0x1d')]?_[_0x1a71('0x1e')](_0x51b2a7['options'][_0x1a71('0x1d')],function(_0x1c70f2){return{'model':db[_0x1c70f2['model']],'as':_0x1c70f2['as'],'attributes':_0x1c70f2[_0x1a71('0x1c')],'include':_0x1c70f2[_0x1a71('0x1d')]?_['map'](_0x1c70f2[_0x1a71('0x1d')],function(_0x41a405){return{'model':db[_0x41a405[_0x1a71('0x1f')]],'as':_0x41a405['as'],'attributes':_0x41a405[_0x1a71('0x1c')],'include':_0x41a405[_0x1a71('0x1d')]?_['map'](_0x41a405[_0x1a71('0x1d')],function(_0x993669){return{'model':db[_0x993669[_0x1a71('0x1f')]],'as':_0x993669['as'],'attributes':_0x993669[_0x1a71('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1a71('0xe')](function(_0x49d0db){logger[_0x1a71('0x20')](_0x1a71('0x17'),_0x51b2a7);logger[_0x1a71('0x21')]('GetVoiceQueue',_0x51b2a7,JSON[_0x1a71('0x11')](_0x49d0db));_0x491583(_0x49d0db);})['catch'](function(_0x4e110e){logger[_0x1a71('0x12')](_0x1a71('0x17'),_0x4e110e['message'],_0x51b2a7);_0x5d7289(_0x2229ed[_0x1a71('0x12')](0x1f4,_0x4e110e[_0x1a71('0x15')]));});});};exports[_0x1a71('0x22')]=function(_0x34f2f1){var _0x2a88f6=this;return new Promise(function(_0x16a653,_0x4a2956){return db[_0x1a71('0x18')][_0x1a71('0x23')]({'raw':_0x34f2f1[_0x1a71('0x1a')]?_0x34f2f1[_0x1a71('0x1a')][_0x1a71('0x1b')]===undefined?!![]:![]:!![],'where':_0x34f2f1[_0x1a71('0x1a')]?_0x34f2f1[_0x1a71('0x1a')][_0x1a71('0x24')]||null:null,'attributes':_0x34f2f1[_0x1a71('0x1a')]?_0x34f2f1[_0x1a71('0x1a')]['attributes']||null:null,'include':_0x34f2f1['options']?_0x34f2f1['options'][_0x1a71('0x1d')]?_['map'](_0x34f2f1[_0x1a71('0x1a')]['include'],function(_0x51ad45){return{'model':db[_0x51ad45[_0x1a71('0x1f')]],'as':_0x51ad45['as'],'attributes':_0x51ad45[_0x1a71('0x1c')],'include':_0x51ad45[_0x1a71('0x1d')]?_['map'](_0x51ad45['include'],function(_0xf8eb0b){return{'model':db[_0xf8eb0b[_0x1a71('0x1f')]],'as':_0xf8eb0b['as'],'attributes':_0xf8eb0b[_0x1a71('0x1c')],'include':_0xf8eb0b[_0x1a71('0x1d')]?_[_0x1a71('0x1e')](_0xf8eb0b['include'],function(_0xf8bfff){return{'model':db[_0xf8bfff[_0x1a71('0x1f')]],'as':_0xf8bfff['as'],'attributes':_0xf8bfff[_0x1a71('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1a71('0xe')](function(_0x3f5e82){logger[_0x1a71('0x20')](_0x1a71('0x22'),_0x34f2f1);logger[_0x1a71('0x21')](_0x1a71('0x22'),_0x34f2f1,JSON['stringify'](_0x3f5e82));_0x16a653(_0x3f5e82);})[_0x1a71('0x16')](function(_0xc94b19){logger['error'](_0x1a71('0x22'),_0xc94b19['message'],_0x34f2f1);_0x4a2956(_0x2a88f6['error'](0x1f4,_0xc94b19['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7341a58..160ec18 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 _0x6dd6=['save','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x18459b,_0x1f7bf2){var _0x5a9e6a=function(_0x5dc6e6){while(--_0x5dc6e6){_0x18459b['push'](_0x18459b['shift']());}};_0x5a9e6a(++_0x1f7bf2);}(_0x6dd6,0x18f));var _0x66dd=function(_0x4e82bb,_0x4c39d5){_0x4e82bb=_0x4e82bb-0x0;var _0x1b5ac5=_0x6dd6[_0x4e82bb];return _0x1b5ac5;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x66dd('0x0'),'remove',_0x66dd('0x1')];function createListener(_0x2076c9,_0x2f63d1){return function(_0x52e3f7){_0x2f63d1[_0x66dd('0x2')](_0x2076c9,_0x52e3f7);};}function removeListener(_0x44f8ed,_0x41ec6e){return function(){VoiceQueueEvents[_0x66dd('0x3')](_0x44f8ed,_0x41ec6e);};}exports[_0x66dd('0x4')]=function(_0x25cc55){for(var _0x11395b=0x0,_0x4b0a61=events[_0x66dd('0x5')];_0x11395b<_0x4b0a61;_0x11395b++){var _0x29126e=events[_0x11395b];var _0x488c4d=createListener(_0x66dd('0x6')+_0x29126e,_0x25cc55);VoiceQueueEvents['on'](_0x29126e,_0x488c4d);}}; \ No newline at end of file +var _0xe0c1=['./voiceQueue.events','save','remove','update','removeListener','length','voiceQueue:'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe0c1,0xa1));var _0x1e0c=function(_0x53c4d5,_0x2af478){_0x53c4d5=_0x53c4d5-0x0;var _0x2513aa=_0xe0c1[_0x53c4d5];return _0x2513aa;};'use strict';var VoiceQueueEvents=require(_0x1e0c('0x0'));var events=[_0x1e0c('0x1'),_0x1e0c('0x2'),_0x1e0c('0x3')];function createListener(_0x1def32,_0x600b29){return function(_0x2ff958){_0x600b29['emit'](_0x1def32,_0x2ff958);};}function removeListener(_0x42100f,_0x403695){return function(){VoiceQueueEvents[_0x1e0c('0x4')](_0x42100f,_0x403695);};}exports['register']=function(_0x30718c){for(var _0x5bade3=0x0,_0x3b5c83=events[_0x1e0c('0x5')];_0x5bade3<_0x3b5c83;_0x5bade3++){var _0x216b13=events[_0x5bade3];var _0xfeeb8e=createListener(_0x1e0c('0x6')+_0x216b13,_0x30718c);VoiceQueueEvents['on'](_0x216b13,_0xfeeb8e);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7edf5e1..49701ea 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 _0x2b08=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','destroy'];(function(_0x1a8a0d,_0x1f1952){var _0x58f766=function(_0x5f3359){while(--_0x5f3359){_0x1a8a0d['push'](_0x1a8a0d['shift']());}};_0x58f766(++_0x1f1952);}(_0x2b08,0x1cc));var _0x82b0=function(_0x1506a5,_0x52c429){_0x1506a5=_0x1506a5-0x0;var _0x70e4bb=_0x2b08[_0x1506a5];return _0x70e4bb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x82b0('0x0'));var express=require(_0x82b0('0x1'));var router=express[_0x82b0('0x2')]();var fs_extra=require(_0x82b0('0x3'));var auth=require(_0x82b0('0x4'));var interaction=require(_0x82b0('0x5'));var config=require(_0x82b0('0x6'));var controller=require(_0x82b0('0x7'));router['get']('/',auth[_0x82b0('0x8')](),controller[_0x82b0('0x9')]);router[_0x82b0('0xa')](_0x82b0('0xb'),auth[_0x82b0('0x8')](),controller['describe']);router[_0x82b0('0xa')](_0x82b0('0xc'),auth[_0x82b0('0x8')](),controller[_0x82b0('0xd')]);router[_0x82b0('0xa')](_0x82b0('0xe'),auth[_0x82b0('0x8')](),controller['show']);router[_0x82b0('0xf')]('/',auth['isAuthenticated'](),controller[_0x82b0('0x10')]);router[_0x82b0('0x11')](_0x82b0('0xe'),auth[_0x82b0('0x8')](),controller[_0x82b0('0x12')]);router['delete'](_0x82b0('0xe'),auth[_0x82b0('0x8')](),controller[_0x82b0('0x13')]);module['exports']=router; \ No newline at end of file +var _0xaf60=['../../config/environment','get','/describe','isAuthenticated','describe','getVoiceQueuesReport','/:id','post','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaf60,0x108));var _0x0af6=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xaf60[_0x298ed3];return _0x5aad28;};'use strict';var multer=require('multer');var util=require(_0x0af6('0x0'));var path=require(_0x0af6('0x1'));var timeout=require(_0x0af6('0x2'));var express=require(_0x0af6('0x3'));var router=express[_0x0af6('0x4')]();var fs_extra=require(_0x0af6('0x5'));var auth=require(_0x0af6('0x6'));var interaction=require(_0x0af6('0x7'));var config=require(_0x0af6('0x8'));var controller=require('./voiceQueueReport.controller');router[_0x0af6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0af6('0x9')](_0x0af6('0xa'),auth[_0x0af6('0xb')](),controller[_0x0af6('0xc')]);router[_0x0af6('0x9')]('/index',auth[_0x0af6('0xb')](),controller[_0x0af6('0xd')]);router[_0x0af6('0x9')](_0x0af6('0xe'),auth[_0x0af6('0xb')](),controller['show']);router[_0x0af6('0xf')]('/',auth[_0x0af6('0xb')](),controller['create']);router['put'](_0x0af6('0xe'),auth[_0x0af6('0xb')](),controller['update']);router['delete'](_0x0af6('0xe'),auth[_0x0af6('0xb')](),controller['destroy']);module[_0x0af6('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 58590e3..9b6a455 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 _0x17ce=['queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue'];(function(_0x4dc35f,_0x377c51){var _0x1f8820=function(_0x37c340){while(--_0x37c340){_0x4dc35f['push'](_0x4dc35f['shift']());}};_0x1f8820(++_0x377c51);}(_0x17ce,0x1bb));var _0xe17c=function(_0x1003a5,_0x1ecfd7){_0x1003a5=_0x1003a5-0x0;var _0x158863=_0x17ce[_0x1003a5];return _0x158863;};'use strict';var Sequelize=require(_0xe17c('0x0'));var moment=require(_0xe17c('0x1'));module['exports']={'type':{'type':Sequelize[_0xe17c('0x2')]},'uniqueid':{'type':Sequelize[_0xe17c('0x2')]},'calleridnum':{'type':Sequelize[_0xe17c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe17c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xe17c('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xe17c('0x3')],'set':function(_0x542a87){var _0x4a5505=moment(_0x542a87);var _0x443121=moment(this[_0xe17c('0x4')](_0xe17c('0x5')))[_0xe17c('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3d2a76=_0x4a5505[_0xe17c('0x7')](_0x443121,_0xe17c('0x8'));this[_0xe17c('0x9')](_0xe17c('0xa'),_0x542a87);this[_0xe17c('0x9')](_0xe17c('0xb'),_0x3d2a76||null);}},'position':{'type':Sequelize[_0xe17c('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xe17c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe17c('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe17c('0x3')]},'queuecallerexit':{'type':Sequelize[_0xe17c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe17c('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xe17c('0x2')],'comment':_0xe17c('0xe')},'originalposition':{'type':Sequelize[_0xe17c('0xc')]},'channel':{'type':Sequelize[_0xe17c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe17c('0x2')]},'connectedlinename':{'type':Sequelize[_0xe17c('0x2')]},'accountcode':{'type':Sequelize[_0xe17c('0x2')]},'context':{'type':Sequelize[_0xe17c('0x2')]},'exten':{'type':Sequelize[_0xe17c('0x2')]},'priority':{'type':Sequelize[_0xe17c('0x2')]},'holdtime':{'type':Sequelize[_0xe17c('0xc')]},'mohtime':{'type':Sequelize[_0xe17c('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe17c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe17c('0x2')]},'transfer':{'type':Sequelize[_0xe17c('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe17c('0x2')],'comment':_0xe17c('0xf')},'transferexten':{'type':Sequelize[_0xe17c('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe17c('0x2')]},'disposition':{'type':Sequelize[_0xe17c('0x2')]},'secondDisposition':{'type':Sequelize[_0xe17c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe17c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xe17c('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x145e=['setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff'];(function(_0x21eaa7,_0x4a406e){var _0x886c95=function(_0x3fa87d){while(--_0x3fa87d){_0x21eaa7['push'](_0x21eaa7['shift']());}};_0x886c95(++_0x4a406e);}(_0x145e,0x1e6));var _0xe145=function(_0x1d77c8,_0x474bcf){_0x1d77c8=_0x1d77c8-0x0;var _0x3efd70=_0x145e[_0x1d77c8];return _0x3efd70;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe145('0x0'));module[_0xe145('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe145('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe145('0x2')]},'queue':{'type':Sequelize[_0xe145('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xe145('0x3')],'set':function(_0x188607){var _0x4f1aff=moment(_0x188607);var _0x677a13=moment(this[_0xe145('0x4')](_0xe145('0x5')))[_0xe145('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1eaa32=_0x4f1aff[_0xe145('0x7')](_0x677a13,'seconds');this['setDataValue']('queuecallerleaveAt',_0x188607);this[_0xe145('0x8')]('holdtime',_0x1eaa32||null);}},'position':{'type':Sequelize[_0xe145('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xe145('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe145('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xe145('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe145('0x3')]},'queuecallerexit':{'type':Sequelize[_0xe145('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe145('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xe145('0x2')],'comment':_0xe145('0xb')},'originalposition':{'type':Sequelize[_0xe145('0x9')]},'channel':{'type':Sequelize[_0xe145('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe145('0x2')]},'connectedlinename':{'type':Sequelize[_0xe145('0x2')]},'accountcode':{'type':Sequelize[_0xe145('0x2')]},'context':{'type':Sequelize[_0xe145('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xe145('0x9')]},'mohtime':{'type':Sequelize[_0xe145('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xe145('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe145('0x2')],'comment':_0xe145('0xc')},'transferexten':{'type':Sequelize[_0xe145('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe145('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe145('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe145('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xe145('0x9')],'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 2bdd217..e9e497d 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 _0x301a=['to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','status','end','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','error','name','send','index','map','VoiceQueueReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','catch','show','params','include','merge','options','find','create','update','body','getVoiceQueuesReport','order','findAll','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x301a,0x17e));var _0xa301=function(_0x4642d2,_0x4cb1de){_0x4642d2=_0x4642d2-0x0;var _0xa77cf1=_0x301a[_0x4642d2];return _0xa77cf1;};'use strict';var emlformat=require(_0xa301('0x0'));var rimraf=require(_0xa301('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa301('0x2'));var rp=require(_0xa301('0x3'));var moment=require(_0xa301('0x4'));var BPromise=require(_0xa301('0x5'));var Mustache=require(_0xa301('0x6'));var util=require(_0xa301('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa301('0x8'));var ejs=require(_0xa301('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa301('0xa'));var squel=require('squel');var crypto=require(_0xa301('0xb'));var jsforce=require(_0xa301('0xc'));var deskjs=require(_0xa301('0xd'));var toCsv=require(_0xa301('0x8'));var querystring=require(_0xa301('0xe'));var Papa=require(_0xa301('0xf'));var Redis=require(_0xa301('0x10'));var authService=require(_0xa301('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa301('0x12'));var logger=require(_0xa301('0x13'))(_0xa301('0x14'));var utils=require(_0xa301('0x15'));var config=require(_0xa301('0x16'));var licenseUtil=require(_0xa301('0x17'));var db=require(_0xa301('0x18'))['db'];config[_0xa301('0x19')]=_['defaults'](config[_0xa301('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa301('0x19')]));require('./voiceQueueReport.socket')[_0xa301('0x1a')](socket);function respondWithStatusCode(_0x4e25a1,_0x44edb5){_0x44edb5=_0x44edb5||0xcc;return function(_0x593903){if(_0x593903){return _0x4e25a1['sendStatus'](_0x44edb5);}return _0x4e25a1[_0xa301('0x1b')](_0x44edb5)[_0xa301('0x1c')]();};}function respondWithResult(_0x19e772,_0x5b3f35){_0x5b3f35=_0x5b3f35||0xc8;return function(_0x526321){if(_0x526321){return _0x19e772[_0xa301('0x1b')](_0x5b3f35)['json'](_0x526321);}};}function respondWithFilteredResult(_0x12883a,_0x3eb26f){return function(_0x461a3b){if(_0x461a3b){var _0xa1ed62=typeof _0x3eb26f['offset']==='undefined'&&typeof _0x3eb26f[_0xa301('0x1d')]===_0xa301('0x1e');var _0x5ad4f1=_0x461a3b[_0xa301('0x1f')];var _0x115ace=_0xa1ed62?0x0:_0x3eb26f[_0xa301('0x20')];var _0x5094fa=_0xa1ed62?_0x461a3b[_0xa301('0x1f')]:_0x3eb26f[_0xa301('0x20')]+_0x3eb26f[_0xa301('0x1d')];var _0x5e6f03;if(_0x5094fa>=_0x5ad4f1){_0x5094fa=_0x5ad4f1;_0x5e6f03=0xc8;}else{_0x5e6f03=0xce;}_0x12883a[_0xa301('0x1b')](_0x5e6f03);return _0x12883a[_0xa301('0x21')](_0xa301('0x22'),_0x115ace+'-'+_0x5094fa+'/'+_0x5ad4f1)['json'](_0x461a3b);}return null;};}function patchUpdates(_0x5a266d){return function(_0x401967){try{jsonpatch['apply'](_0x401967,_0x5a266d,!![]);}catch(_0x3b2bee){return BPromise[_0xa301('0x23')](_0x3b2bee);}return _0x401967[_0xa301('0x24')]();};}function saveUpdates(_0x43a78b,_0x4e4885){return function(_0x50cfdd){if(_0x50cfdd){return _0x50cfdd['update'](_0x43a78b)[_0xa301('0x25')](function(_0x30b9fd){return _0x30b9fd;});}return null;};}function removeEntity(_0x1f2f95,_0x324db9){return function(_0x5e472d){if(_0x5e472d){return _0x5e472d[_0xa301('0x26')]()[_0xa301('0x25')](function(){_0x1f2f95['status'](0xcc)[_0xa301('0x1c')]();});}};}function handleEntityNotFound(_0x18ea55,_0x52c67b){return function(_0x30f763){if(!_0x30f763){_0x18ea55[_0xa301('0x27')](0x194);}return _0x30f763;};}function handleError(_0x41da73,_0x5f2ccf){_0x5f2ccf=_0x5f2ccf||0x1f4;return function(_0x54cf6b){logger[_0xa301('0x28')](_0x54cf6b['stack']);if(_0x54cf6b[_0xa301('0x29')]){delete _0x54cf6b[_0xa301('0x29')];}_0x41da73[_0xa301('0x1b')](_0x5f2ccf)[_0xa301('0x2a')](_0x54cf6b);};}exports[_0xa301('0x2b')]=function(_0x388a23,_0x1649e9){var _0x2c6253={},_0x313839={},_0x59376c={'count':0x0,'rows':[]};var _0x1da2eb=_[_0xa301('0x2c')](db[_0xa301('0x2d')][_0xa301('0x2e')],function(_0xf57335){return{'name':_0xf57335['fieldName'],'type':_0xf57335[_0xa301('0x2f')]['key']};});_0x313839[_0xa301('0x30')]=_[_0xa301('0x2c')](_0x1da2eb,_0xa301('0x29'));_0x313839[_0xa301('0x31')]=_[_0xa301('0x32')](_0x388a23[_0xa301('0x31')]);_0x313839[_0xa301('0x33')]=_[_0xa301('0x34')](_0x313839[_0xa301('0x30')],_0x313839[_0xa301('0x31')]);_0x2c6253['attributes']=_['intersection'](_0x313839[_0xa301('0x30')],qs[_0xa301('0x35')](_0x388a23['query']['fields']));_0x2c6253['attributes']=_0x2c6253[_0xa301('0x36')][_0xa301('0x37')]?_0x2c6253[_0xa301('0x36')]:_0x313839['model'];if(!_0x388a23[_0xa301('0x31')][_0xa301('0x38')](_0xa301('0x39'))){_0x2c6253['limit']=qs[_0xa301('0x1d')](_0x388a23['query'][_0xa301('0x1d')]);_0x2c6253[_0xa301('0x20')]=qs['offset'](_0x388a23[_0xa301('0x31')][_0xa301('0x20')]);}_0x2c6253['order']=qs[_0xa301('0x3a')](_0x388a23[_0xa301('0x31')]['sort']);_0x2c6253[_0xa301('0x3b')]=qs[_0xa301('0x33')](_[_0xa301('0x3c')](_0x388a23[_0xa301('0x31')],_0x313839[_0xa301('0x33')]),_0x1da2eb);if(_0x388a23[_0xa301('0x31')][_0xa301('0x3d')]){_0x2c6253[_0xa301('0x3b')]=_['merge'](_0x2c6253[_0xa301('0x3b')],{'$or':_[_0xa301('0x2c')](_0x1da2eb,function(_0x5c04a7){if(_0x5c04a7[_0xa301('0x2f')]!==_0xa301('0x3e')){var _0x4615bc={};_0x4615bc[_0x5c04a7[_0xa301('0x29')]]={'$like':'%'+_0x388a23['query'][_0xa301('0x3d')]+'%'};return _0x4615bc;}})});}_0x2c6253=_['merge']({},_0x2c6253,_0x388a23['options']);var _0xafcb7c={'where':_0x2c6253[_0xa301('0x3b')]};return db[_0xa301('0x2d')][_0xa301('0x1f')](_0xafcb7c)[_0xa301('0x25')](function(_0x10a387){_0x59376c[_0xa301('0x1f')]=_0x10a387;if(_0x388a23['query'][_0xa301('0x3f')]){_0x2c6253['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x2c6253);})['then'](function(_0x3b75dc){_0x59376c['rows']=_0x3b75dc;return _0x59376c;})[_0xa301('0x25')](respondWithFilteredResult(_0x1649e9,_0x2c6253))[_0xa301('0x40')](handleError(_0x1649e9,null));};exports[_0xa301('0x41')]=function(_0x2466ec,_0x830df1){var _0x4fdb21={'raw':![],'where':{'id':_0x2466ec[_0xa301('0x42')]['id']}},_0xfcf36={};_0xfcf36[_0xa301('0x30')]=_['keys'](db[_0xa301('0x2d')][_0xa301('0x2e')]);_0xfcf36[_0xa301('0x31')]=_['keys'](_0x2466ec[_0xa301('0x31')]);_0xfcf36[_0xa301('0x33')]=_[_0xa301('0x34')](_0xfcf36[_0xa301('0x30')],_0xfcf36['query']);_0x4fdb21[_0xa301('0x36')]=_[_0xa301('0x34')](_0xfcf36[_0xa301('0x30')],qs[_0xa301('0x35')](_0x2466ec['query'][_0xa301('0x35')]));_0x4fdb21[_0xa301('0x36')]=_0x4fdb21[_0xa301('0x36')]['length']?_0x4fdb21[_0xa301('0x36')]:_0xfcf36['model'];if(_0x2466ec['query'][_0xa301('0x3f')]){_0x4fdb21[_0xa301('0x43')]=[{'all':!![]}];}_0x4fdb21=_[_0xa301('0x44')]({},_0x4fdb21,_0x2466ec[_0xa301('0x45')]);return db[_0xa301('0x2d')][_0xa301('0x46')](_0x4fdb21)[_0xa301('0x25')](handleEntityNotFound(_0x830df1,null))[_0xa301('0x25')](respondWithResult(_0x830df1,null))['catch'](handleError(_0x830df1,null));};exports[_0xa301('0x47')]=function(_0x27fcf9,_0x127468){return db[_0xa301('0x2d')]['create'](_0x27fcf9['body'],{})['then'](respondWithResult(_0x127468,0xc9))['catch'](handleError(_0x127468,null));};exports[_0xa301('0x48')]=function(_0x2ef5e5,_0xa2d27d){if(_0x2ef5e5[_0xa301('0x49')]['id']){delete _0x2ef5e5[_0xa301('0x49')]['id'];}return db['VoiceQueueReport'][_0xa301('0x46')]({'where':{'id':_0x2ef5e5['params']['id']}})[_0xa301('0x25')](handleEntityNotFound(_0xa2d27d,null))[_0xa301('0x25')](saveUpdates(_0x2ef5e5[_0xa301('0x49')],null))[_0xa301('0x25')](respondWithResult(_0xa2d27d,null))['catch'](handleError(_0xa2d27d,null));};exports[_0xa301('0x26')]=function(_0x12cf4c,_0x5d8f1a){return db[_0xa301('0x2d')][_0xa301('0x46')]({'where':{'id':_0x12cf4c['params']['id']}})[_0xa301('0x25')](handleEntityNotFound(_0x5d8f1a,null))[_0xa301('0x25')](removeEntity(_0x5d8f1a,null))[_0xa301('0x40')](handleError(_0x5d8f1a,null));};exports['describe']=function(_0xcb9ac9,_0x316b7f){return db[_0xa301('0x2d')]['describe']()[_0xa301('0x25')](respondWithResult(_0x316b7f,null))[_0xa301('0x40')](handleError(_0x316b7f,null));};exports[_0xa301('0x4a')]=function(_0xc71874,_0x185517){var _0x273ae6={},_0x328216={},_0x41a9d4={'count':0x0,'rows':[]};_0x328216[_0xa301('0x30')]=_[_0xa301('0x32')](db[_0xa301('0x2d')]['rawAttributes']);_0x328216[_0xa301('0x31')]=_[_0xa301('0x32')](_0xc71874[_0xa301('0x31')]);_0x328216[_0xa301('0x33')]=_['intersection'](_0x328216[_0xa301('0x30')],_0x328216[_0xa301('0x31')]);_0x273ae6[_0xa301('0x36')]=_['intersection'](_0x328216['model'],qs[_0xa301('0x35')](_0xc71874['query'][_0xa301('0x35')]));_0x273ae6[_0xa301('0x36')]=_0x273ae6[_0xa301('0x36')][_0xa301('0x37')]?_0x273ae6[_0xa301('0x36')]:_0x328216[_0xa301('0x30')];if(!_0xc71874['query']['hasOwnProperty'](_0xa301('0x39'))){_0x273ae6[_0xa301('0x1d')]=qs['limit'](_0xc71874['query'][_0xa301('0x1d')]);_0x273ae6[_0xa301('0x20')]=qs['offset'](_0xc71874['query'][_0xa301('0x20')]);}_0x273ae6[_0xa301('0x4b')]=qs[_0xa301('0x3a')](_0xc71874['query'][_0xa301('0x3a')]);_0x273ae6['where']=qs['filters'](_[_0xa301('0x3c')](_0xc71874[_0xa301('0x31')],_0x328216[_0xa301('0x33')]));if(_0xc71874['query'][_0xa301('0x3d')]){_0x273ae6[_0xa301('0x3b')]=_[_0xa301('0x44')](_0x273ae6['where'],{'$or':_[_0xa301('0x2c')](_0x273ae6[_0xa301('0x36')],function(_0x4886a8){var _0x437d9d={};_0x437d9d[_0x4886a8]={'$like':'%'+_0xc71874[_0xa301('0x31')][_0xa301('0x3d')]+'%'};return _0x437d9d;})});}_0x273ae6=_[_0xa301('0x44')]({},_0x273ae6,_0xc71874[_0xa301('0x45')]);var _0x500e2b={'where':_0x273ae6[_0xa301('0x3b')]};return db[_0xa301('0x2d')]['count'](_0x500e2b)[_0xa301('0x25')](function(_0x2b1f2c){_0x41a9d4['count']=_0x2b1f2c;if(_0xc71874[_0xa301('0x31')][_0xa301('0x3f')]){_0x273ae6[_0xa301('0x43')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xa301('0x4c')](_0x273ae6);})[_0xa301('0x25')](function(_0x5126d5){_0x41a9d4[_0xa301('0x4d')]=_0x5126d5;return _0x41a9d4;})[_0xa301('0x25')](respondWithFilteredResult(_0x185517,_0x273ae6,'getVoiceQueuesReport'))[_0xa301('0x40')](handleError(_0x185517,null,_0xa301('0x4a')));}; \ No newline at end of file +var _0x38e8=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','sendStatus','error','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','order','sort','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','hasOwnProperty','pick','filter','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x6cfbf7,_0x374cbb){var _0x407dd1=function(_0x283064){while(--_0x283064){_0x6cfbf7['push'](_0x6cfbf7['shift']());}};_0x407dd1(++_0x374cbb);}(_0x38e8,0xef));var _0x838e=function(_0x5bc561,_0x273db4){_0x5bc561=_0x5bc561-0x0;var _0x283983=_0x38e8[_0x5bc561];return _0x283983;};'use strict';var emlformat=require(_0x838e('0x0'));var rimraf=require(_0x838e('0x1'));var zipdir=require(_0x838e('0x2'));var jsonpatch=require(_0x838e('0x3'));var rp=require('request-promise');var moment=require(_0x838e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x838e('0x5'));var util=require(_0x838e('0x6'));var path=require(_0x838e('0x7'));var sox=require(_0x838e('0x8'));var csv=require(_0x838e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x838e('0xa'));var _=require(_0x838e('0xb'));var squel=require(_0x838e('0xc'));var crypto=require(_0x838e('0xd'));var jsforce=require(_0x838e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x838e('0x9'));var querystring=require(_0x838e('0xf'));var Papa=require(_0x838e('0x10'));var Redis=require(_0x838e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x838e('0x12'));var as=require(_0x838e('0x13'));var hardwareService=require(_0x838e('0x14'));var logger=require(_0x838e('0x15'))(_0x838e('0x16'));var utils=require(_0x838e('0x17'));var config=require(_0x838e('0x18'));var licenseUtil=require(_0x838e('0x19'));var db=require(_0x838e('0x1a'))['db'];config[_0x838e('0x1b')]=_[_0x838e('0x1c')](config[_0x838e('0x1b')],{'host':_0x838e('0x1d'),'port':0x18eb});var socket=require(_0x838e('0x1e'))(new Redis(config['redis']));require(_0x838e('0x1f'))[_0x838e('0x20')](socket);function respondWithStatusCode(_0x2524d5,_0x5d007c){_0x5d007c=_0x5d007c||0xcc;return function(_0x4ec486){if(_0x4ec486){return _0x2524d5['sendStatus'](_0x5d007c);}return _0x2524d5[_0x838e('0x21')](_0x5d007c)[_0x838e('0x22')]();};}function respondWithResult(_0x2443b6,_0x467444){_0x467444=_0x467444||0xc8;return function(_0x3f7d9c){if(_0x3f7d9c){return _0x2443b6['status'](_0x467444)['json'](_0x3f7d9c);}};}function respondWithFilteredResult(_0x5f2ed2,_0x195166){return function(_0x26e3c5){if(_0x26e3c5){var _0xf59969=typeof _0x195166['offset']===_0x838e('0x23')&&typeof _0x195166[_0x838e('0x24')]===_0x838e('0x23');var _0x5397fe=_0x26e3c5[_0x838e('0x25')];var _0x5ae5fe=_0xf59969?0x0:_0x195166['offset'];var _0x4651fe=_0xf59969?_0x26e3c5[_0x838e('0x25')]:_0x195166['offset']+_0x195166[_0x838e('0x24')];var _0x20d1ef;if(_0x4651fe>=_0x5397fe){_0x4651fe=_0x5397fe;_0x20d1ef=0xc8;}else{_0x20d1ef=0xce;}_0x5f2ed2[_0x838e('0x21')](_0x20d1ef);return _0x5f2ed2['set'](_0x838e('0x26'),_0x5ae5fe+'-'+_0x4651fe+'/'+_0x5397fe)[_0x838e('0x27')](_0x26e3c5);}return null;};}function patchUpdates(_0x5588d7){return function(_0x468f28){try{jsonpatch['apply'](_0x468f28,_0x5588d7,!![]);}catch(_0x196b7c){return BPromise[_0x838e('0x28')](_0x196b7c);}return _0x468f28[_0x838e('0x29')]();};}function saveUpdates(_0x22383a,_0x43dad1){return function(_0x4ff96a){if(_0x4ff96a){return _0x4ff96a[_0x838e('0x2a')](_0x22383a)['then'](function(_0x4f713e){return _0x4f713e;});}return null;};}function removeEntity(_0x195923,_0x22b7aa){return function(_0x8d8174){if(_0x8d8174){return _0x8d8174[_0x838e('0x2b')]()[_0x838e('0x2c')](function(){_0x195923[_0x838e('0x21')](0xcc)[_0x838e('0x22')]();});}};}function handleEntityNotFound(_0x167282,_0x4ed404){return function(_0x5ba77b){if(!_0x5ba77b){_0x167282[_0x838e('0x2d')](0x194);}return _0x5ba77b;};}function handleError(_0x565f0b,_0x3ece7e){_0x3ece7e=_0x3ece7e||0x1f4;return function(_0xc5f9fd){logger[_0x838e('0x2e')](_0xc5f9fd['stack']);if(_0xc5f9fd['name']){delete _0xc5f9fd[_0x838e('0x2f')];}_0x565f0b[_0x838e('0x21')](_0x3ece7e)[_0x838e('0x30')](_0xc5f9fd);};}exports[_0x838e('0x31')]=function(_0x3613dc,_0x37777f){var _0x3d0e68={},_0x360838={},_0x3e7c7c={'count':0x0,'rows':[]};var _0x4dcb21=_['map'](db[_0x838e('0x32')][_0x838e('0x33')],function(_0x38df3e){return{'name':_0x38df3e[_0x838e('0x34')],'type':_0x38df3e[_0x838e('0x35')][_0x838e('0x36')]};});_0x360838[_0x838e('0x37')]=_[_0x838e('0x38')](_0x4dcb21,_0x838e('0x2f'));_0x360838[_0x838e('0x39')]=_[_0x838e('0x3a')](_0x3613dc[_0x838e('0x39')]);_0x360838[_0x838e('0x3b')]=_[_0x838e('0x3c')](_0x360838[_0x838e('0x37')],_0x360838[_0x838e('0x39')]);_0x3d0e68[_0x838e('0x3d')]=_[_0x838e('0x3c')](_0x360838[_0x838e('0x37')],qs[_0x838e('0x3e')](_0x3613dc[_0x838e('0x39')]['fields']));_0x3d0e68[_0x838e('0x3d')]=_0x3d0e68[_0x838e('0x3d')]['length']?_0x3d0e68[_0x838e('0x3d')]:_0x360838[_0x838e('0x37')];if(!_0x3613dc[_0x838e('0x39')]['hasOwnProperty'](_0x838e('0x3f'))){_0x3d0e68[_0x838e('0x24')]=qs[_0x838e('0x24')](_0x3613dc[_0x838e('0x39')][_0x838e('0x24')]);_0x3d0e68['offset']=qs[_0x838e('0x40')](_0x3613dc[_0x838e('0x39')][_0x838e('0x40')]);}_0x3d0e68[_0x838e('0x41')]=qs[_0x838e('0x42')](_0x3613dc[_0x838e('0x39')][_0x838e('0x42')]);_0x3d0e68[_0x838e('0x43')]=qs[_0x838e('0x3b')](_['pick'](_0x3613dc[_0x838e('0x39')],_0x360838[_0x838e('0x3b')]),_0x4dcb21);if(_0x3613dc[_0x838e('0x39')]['filter']){_0x3d0e68['where']=_[_0x838e('0x44')](_0x3d0e68[_0x838e('0x43')],{'$or':_['map'](_0x4dcb21,function(_0x105734){if(_0x105734[_0x838e('0x35')]!==_0x838e('0x45')){var _0x364e63={};_0x364e63[_0x105734[_0x838e('0x2f')]]={'$like':'%'+_0x3613dc[_0x838e('0x39')]['filter']+'%'};return _0x364e63;}})});}_0x3d0e68=_[_0x838e('0x44')]({},_0x3d0e68,_0x3613dc[_0x838e('0x46')]);var _0x21e89e={'where':_0x3d0e68[_0x838e('0x43')]};return db[_0x838e('0x32')]['count'](_0x21e89e)['then'](function(_0x261c72){_0x3e7c7c['count']=_0x261c72;if(_0x3613dc[_0x838e('0x39')][_0x838e('0x47')]){_0x3d0e68['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x3d0e68);})['then'](function(_0x793283){_0x3e7c7c[_0x838e('0x48')]=_0x793283;return _0x3e7c7c;})[_0x838e('0x2c')](respondWithFilteredResult(_0x37777f,_0x3d0e68))[_0x838e('0x49')](handleError(_0x37777f,null));};exports[_0x838e('0x4a')]=function(_0x3c542d,_0x8c9476){var _0x27215d={'raw':![],'where':{'id':_0x3c542d[_0x838e('0x4b')]['id']}},_0x37732b={};_0x37732b[_0x838e('0x37')]=_[_0x838e('0x3a')](db[_0x838e('0x32')][_0x838e('0x33')]);_0x37732b[_0x838e('0x39')]=_[_0x838e('0x3a')](_0x3c542d[_0x838e('0x39')]);_0x37732b['filters']=_['intersection'](_0x37732b[_0x838e('0x37')],_0x37732b[_0x838e('0x39')]);_0x27215d[_0x838e('0x3d')]=_[_0x838e('0x3c')](_0x37732b[_0x838e('0x37')],qs['fields'](_0x3c542d['query'][_0x838e('0x3e')]));_0x27215d[_0x838e('0x3d')]=_0x27215d[_0x838e('0x3d')][_0x838e('0x4c')]?_0x27215d[_0x838e('0x3d')]:_0x37732b[_0x838e('0x37')];if(_0x3c542d[_0x838e('0x39')][_0x838e('0x47')]){_0x27215d[_0x838e('0x4d')]=[{'all':!![]}];}_0x27215d=_[_0x838e('0x44')]({},_0x27215d,_0x3c542d[_0x838e('0x46')]);return db[_0x838e('0x32')][_0x838e('0x4e')](_0x27215d)['then'](handleEntityNotFound(_0x8c9476,null))[_0x838e('0x2c')](respondWithResult(_0x8c9476,null))['catch'](handleError(_0x8c9476,null));};exports[_0x838e('0x4f')]=function(_0x4ee807,_0xa68b64){return db[_0x838e('0x32')]['create'](_0x4ee807[_0x838e('0x50')],{})['then'](respondWithResult(_0xa68b64,0xc9))['catch'](handleError(_0xa68b64,null));};exports[_0x838e('0x2a')]=function(_0x31a6d4,_0x53e0cc){if(_0x31a6d4['body']['id']){delete _0x31a6d4[_0x838e('0x50')]['id'];}return db[_0x838e('0x32')][_0x838e('0x4e')]({'where':{'id':_0x31a6d4[_0x838e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53e0cc,null))[_0x838e('0x2c')](saveUpdates(_0x31a6d4[_0x838e('0x50')],null))['then'](respondWithResult(_0x53e0cc,null))[_0x838e('0x49')](handleError(_0x53e0cc,null));};exports[_0x838e('0x2b')]=function(_0x46774b,_0x4d65cc){return db[_0x838e('0x32')][_0x838e('0x4e')]({'where':{'id':_0x46774b[_0x838e('0x4b')]['id']}})[_0x838e('0x2c')](handleEntityNotFound(_0x4d65cc,null))['then'](removeEntity(_0x4d65cc,null))['catch'](handleError(_0x4d65cc,null));};exports['describe']=function(_0xe99228,_0x49c88f){return db[_0x838e('0x32')]['describe']()[_0x838e('0x2c')](respondWithResult(_0x49c88f,null))[_0x838e('0x49')](handleError(_0x49c88f,null));};exports['getVoiceQueuesReport']=function(_0x2c5c5d,_0x5f5654){var _0x3744a2={},_0xda8be={},_0x5a4b5c={'count':0x0,'rows':[]};_0xda8be['model']=_[_0x838e('0x3a')](db[_0x838e('0x32')][_0x838e('0x33')]);_0xda8be[_0x838e('0x39')]=_['keys'](_0x2c5c5d[_0x838e('0x39')]);_0xda8be[_0x838e('0x3b')]=_[_0x838e('0x3c')](_0xda8be[_0x838e('0x37')],_0xda8be[_0x838e('0x39')]);_0x3744a2['attributes']=_[_0x838e('0x3c')](_0xda8be[_0x838e('0x37')],qs['fields'](_0x2c5c5d[_0x838e('0x39')][_0x838e('0x3e')]));_0x3744a2[_0x838e('0x3d')]=_0x3744a2['attributes'][_0x838e('0x4c')]?_0x3744a2[_0x838e('0x3d')]:_0xda8be[_0x838e('0x37')];if(!_0x2c5c5d[_0x838e('0x39')][_0x838e('0x51')](_0x838e('0x3f'))){_0x3744a2['limit']=qs[_0x838e('0x24')](_0x2c5c5d[_0x838e('0x39')][_0x838e('0x24')]);_0x3744a2['offset']=qs[_0x838e('0x40')](_0x2c5c5d['query'][_0x838e('0x40')]);}_0x3744a2['order']=qs[_0x838e('0x42')](_0x2c5c5d[_0x838e('0x39')][_0x838e('0x42')]);_0x3744a2['where']=qs[_0x838e('0x3b')](_[_0x838e('0x52')](_0x2c5c5d[_0x838e('0x39')],_0xda8be[_0x838e('0x3b')]));if(_0x2c5c5d['query'][_0x838e('0x53')]){_0x3744a2[_0x838e('0x43')]=_[_0x838e('0x44')](_0x3744a2[_0x838e('0x43')],{'$or':_[_0x838e('0x38')](_0x3744a2[_0x838e('0x3d')],function(_0x44603b){var _0x2e7817={};_0x2e7817[_0x44603b]={'$like':'%'+_0x2c5c5d['query'][_0x838e('0x53')]+'%'};return _0x2e7817;})});}_0x3744a2=_[_0x838e('0x44')]({},_0x3744a2,_0x2c5c5d[_0x838e('0x46')]);var _0x3f7a8e={'where':_0x3744a2[_0x838e('0x43')]};return db[_0x838e('0x32')]['count'](_0x3f7a8e)['then'](function(_0x4d528f){_0x5a4b5c[_0x838e('0x25')]=_0x4d528f;if(_0x2c5c5d[_0x838e('0x39')][_0x838e('0x47')]){_0x3744a2[_0x838e('0x4d')]=[{'all':!![]}];}return db[_0x838e('0x32')]['findAll'](_0x3744a2);})['then'](function(_0x1a0b13){_0x5a4b5c[_0x838e('0x48')]=_0x1a0b13;return _0x5a4b5c;})[_0x838e('0x2c')](respondWithFilteredResult(_0x5f5654,_0x3744a2,_0x838e('0x54')))[_0x838e('0x49')](handleError(_0x5f5654,null,_0x838e('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8ddaa36..7a3c9d0 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 _0xc567=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x105ce8,_0x4b204c){var _0x4a3b53=function(_0x15e6ac){while(--_0x15e6ac){_0x105ce8['push'](_0x105ce8['shift']());}};_0x4a3b53(++_0x4b204c);}(_0xc567,0xc1));var _0x7c56=function(_0x19ab1c,_0x2c866f){_0x19ab1c=_0x19ab1c-0x0;var _0x35d9c2=_0xc567[_0x19ab1c];return _0x35d9c2;};'use strict';var EventEmitter=require(_0x7c56('0x0'));var VoiceQueueReport=require(_0x7c56('0x1'))['db'][_0x7c56('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7c56('0x3')};function emitEvent(_0x1a6d5c){return function(_0x21b779,_0x189888,_0x414494){VoiceQueueReportEvents['emit'](_0x1a6d5c+':'+_0x21b779['id'],_0x21b779);VoiceQueueReportEvents[_0x7c56('0x4')](_0x1a6d5c,_0x21b779);_0x414494(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x7c56('0x5')](e,emitEvent(event));}}module[_0x7c56('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x1ac1=['hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x1ac1,0x169));var _0x11ac=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x1ac1[_0x4733d3];return _0x1b9a44;};'use strict';var EventEmitter=require(_0x11ac('0x0'));var VoiceQueueReport=require(_0x11ac('0x1'))['db'][_0x11ac('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x11ac('0x3')](0x0);var events={'afterCreate':_0x11ac('0x4'),'afterUpdate':_0x11ac('0x5'),'afterDestroy':_0x11ac('0x6')};function emitEvent(_0x4f98f6){return function(_0x1fd4fd,_0x1a0478,_0x49c183){VoiceQueueReportEvents[_0x11ac('0x7')](_0x4f98f6+':'+_0x1fd4fd['id'],_0x1fd4fd);VoiceQueueReportEvents[_0x11ac('0x7')](_0x4f98f6,_0x1fd4fd);_0x49c183(null);};}for(var e in events){if(events[_0x11ac('0x8')](e)){var event=events[e];VoiceQueueReport[_0x11ac('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 19c5e15..4da1302 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 _0x54b8=['path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15762b,_0x5730f9){var _0x56585c=function(_0xd9b095){while(--_0xd9b095){_0x15762b['push'](_0x15762b['shift']());}};_0x56585c(++_0x5730f9);}(_0x54b8,0x1a8));var _0x854b=function(_0x5037fd,_0x523307){_0x5037fd=_0x5037fd-0x0;var _0x1882c5=_0x54b8[_0x5037fd];return _0x1882c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x854b('0x0'))(_0x854b('0x1'));var moment=require(_0x854b('0x2'));var BPromise=require(_0x854b('0x3'));var rp=require(_0x854b('0x4'));var fs=require('fs');var path=require(_0x854b('0x5'));var rimraf=require('rimraf');var config=require(_0x854b('0x6'));var attributes=require(_0x854b('0x7'));module[_0x854b('0x8')]=function(_0x406c2a,_0xdab899){return _0x406c2a[_0x854b('0x9')](_0x854b('0xa'),attributes,{'tableName':_0x854b('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x854b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4e3=['uniqueid','calleridnum','../../config/logger','api','moment','request-promise','rimraf','./voiceQueueReport.attributes','exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xf4e3,0x1cd));var _0x3f4e=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0xf4e3[_0x15ca1a];return _0x507626;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f4e('0x0'))(_0x3f4e('0x1'));var moment=require(_0x3f4e('0x2'));var BPromise=require('bluebird');var rp=require(_0x3f4e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f4e('0x4'));var config=require('../../config/environment');var attributes=require(_0x3f4e('0x5'));module[_0x3f4e('0x6')]=function(_0x39807c,_0x42ccd3){return _0x39807c['define']('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x3f4e('0x7')]},{'fields':[_0x3f4e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index bdab1ac..44a24de 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 _0x5ce3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','create','debug','UpdateVoiceQueueReport','lodash','util'];(function(_0x185d55,_0x3f69c2){var _0x1cc748=function(_0x227889){while(--_0x227889){_0x185d55['push'](_0x185d55['shift']());}};_0x1cc748(++_0x3f69c2);}(_0x5ce3,0x156));var _0x35ce=function(_0x50d84b,_0x1d7ea7){_0x50d84b=_0x50d84b-0x0;var _0x6d4270=_0x5ce3[_0x50d84b];return _0x6d4270;};'use strict';var _=require(_0x35ce('0x0'));var util=require(_0x35ce('0x1'));var moment=require(_0x35ce('0x2'));var BPromise=require(_0x35ce('0x3'));var rs=require(_0x35ce('0x4'));var fs=require('fs');var Redis=require(_0x35ce('0x5'));var db=require(_0x35ce('0x6'))['db'];var utils=require(_0x35ce('0x7'));var logger=require('../../config/logger')(_0x35ce('0x8'));var config=require(_0x35ce('0x9'));var jayson=require(_0x35ce('0xa'));var client=jayson[_0x35ce('0xb')][_0x35ce('0xc')]({'port':0x232a});config[_0x35ce('0xd')]=_['defaults'](config[_0x35ce('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x35ce('0xe'))(new Redis(config[_0x35ce('0xd')]));require('./voiceQueueReport.socket')[_0x35ce('0xf')](socket);function respondWithRpcPromise(_0x4313d0,_0x1a8bc5,_0x34dc96){return new BPromise(function(_0x492fb1,_0x2e3fdf){return client[_0x35ce('0x10')](_0x4313d0,_0x34dc96)[_0x35ce('0x11')](function(_0x4167d9){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1a8bc5,_0x35ce('0x12'));logger['debug'](_0x35ce('0x13'),_0x1a8bc5,_0x35ce('0x12'),JSON[_0x35ce('0x14')](_0x4167d9));if(_0x4167d9[_0x35ce('0x15')]){if(_0x4167d9[_0x35ce('0x15')][_0x35ce('0x16')]===0x1f4){logger[_0x35ce('0x15')](_0x35ce('0x17'),_0x1a8bc5,_0x4167d9[_0x35ce('0x15')][_0x35ce('0x18')]);return _0x2e3fdf(_0x4167d9['error'][_0x35ce('0x18')]);}logger[_0x35ce('0x15')](_0x35ce('0x17'),_0x1a8bc5,_0x4167d9[_0x35ce('0x15')]['message']);return _0x492fb1(_0x4167d9[_0x35ce('0x15')][_0x35ce('0x18')]);}else{logger[_0x35ce('0x19')](_0x35ce('0x17'),_0x1a8bc5,_0x35ce('0x12'));_0x492fb1(_0x4167d9[_0x35ce('0x1a')][_0x35ce('0x18')]);}})[_0x35ce('0x1b')](function(_0x1aaf23){logger[_0x35ce('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x1a8bc5,_0x1aaf23);_0x2e3fdf(_0x1aaf23);});});}exports[_0x35ce('0x1c')]=function(_0x4d01f7){var _0x49ab74=this;return new Promise(function(_0x569dc6,_0x5d0f4f){return db[_0x35ce('0x1d')][_0x35ce('0x1e')]({'raw':_0x4d01f7[_0x35ce('0x1f')]?_0x4d01f7[_0x35ce('0x1f')][_0x35ce('0x20')]===undefined?!![]:![]:!![],'where':_0x4d01f7[_0x35ce('0x1f')]?_0x4d01f7[_0x35ce('0x1f')][_0x35ce('0x21')]||null:null,'attributes':_0x4d01f7[_0x35ce('0x1f')]?_0x4d01f7[_0x35ce('0x1f')]['attributes']||null:null,'limit':_0x4d01f7[_0x35ce('0x1f')]?_0x4d01f7[_0x35ce('0x1f')][_0x35ce('0x22')]||null:null,'include':_0x4d01f7[_0x35ce('0x1f')]?_0x4d01f7[_0x35ce('0x1f')][_0x35ce('0x23')]?_[_0x35ce('0x24')](_0x4d01f7['options'][_0x35ce('0x23')],function(_0x907c25){return{'model':db[_0x907c25[_0x35ce('0x25')]],'as':_0x907c25['as'],'attributes':_0x907c25[_0x35ce('0x26')],'include':_0x907c25[_0x35ce('0x23')]?_['map'](_0x907c25['include'],function(_0x4530c8){return{'model':db[_0x4530c8['model']],'as':_0x4530c8['as'],'attributes':_0x4530c8[_0x35ce('0x26')],'include':_0x4530c8[_0x35ce('0x23')]?_[_0x35ce('0x24')](_0x4530c8[_0x35ce('0x23')],function(_0x1c39bc){return{'model':db[_0x1c39bc['model']],'as':_0x1c39bc['as'],'attributes':_0x1c39bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x35ce('0x11')](function(_0x56b5b6){logger['info'](_0x35ce('0x1c'),_0x4d01f7);logger['debug'](_0x35ce('0x1c'),_0x4d01f7,JSON[_0x35ce('0x14')](_0x56b5b6));_0x569dc6(_0x56b5b6);})[_0x35ce('0x1b')](function(_0x57c757){logger[_0x35ce('0x15')]('GetVoiceQueueReport',_0x57c757[_0x35ce('0x18')],_0x4d01f7);_0x5d0f4f(_0x49ab74[_0x35ce('0x15')](0x1f4,_0x57c757['message']));});});};exports[_0x35ce('0x27')]=function(_0x36a926){var _0x18caef=this;return new Promise(function(_0x1a084c,_0x207af9){return db[_0x35ce('0x1d')][_0x35ce('0x28')](_0x36a926['body'],{'raw':_0x36a926['options']?_0x36a926['options']['raw']===undefined?!![]:![]:!![]})[_0x35ce('0x11')](function(_0x22dd5e){logger[_0x35ce('0x19')]('CreateVoiceQueueReport',_0x36a926);logger[_0x35ce('0x29')](_0x35ce('0x27'),_0x36a926,JSON[_0x35ce('0x14')](_0x22dd5e));_0x1a084c(_0x22dd5e);})[_0x35ce('0x1b')](function(_0x18a445){logger[_0x35ce('0x15')](_0x35ce('0x27'),_0x18a445[_0x35ce('0x18')],_0x36a926);_0x207af9(_0x18caef[_0x35ce('0x15')](0x1f4,_0x18a445[_0x35ce('0x18')]));});});};exports[_0x35ce('0x2a')]=function(_0x424b07){var _0x50c69f=this;return new Promise(function(_0x445541,_0x123d56){return db[_0x35ce('0x1d')]['update'](_0x424b07['body'],{'raw':_0x424b07[_0x35ce('0x1f')]?_0x424b07[_0x35ce('0x1f')][_0x35ce('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x424b07[_0x35ce('0x1f')]?_0x424b07[_0x35ce('0x1f')][_0x35ce('0x21')]||null:null,'attributes':_0x424b07[_0x35ce('0x1f')]?_0x424b07[_0x35ce('0x1f')][_0x35ce('0x26')]||null:null,'limit':_0x424b07['options']?_0x424b07[_0x35ce('0x1f')]['limit']||null:null})[_0x35ce('0x11')](function(_0x49ddd3){logger[_0x35ce('0x19')](_0x35ce('0x2a'),_0x424b07);logger[_0x35ce('0x29')](_0x35ce('0x2a'),_0x424b07,JSON[_0x35ce('0x14')](_0x49ddd3));_0x445541(_0x49ddd3);})[_0x35ce('0x1b')](function(_0x1a0689){logger['error']('UpdateVoiceQueueReport',_0x1a0689[_0x35ce('0x18')],_0x424b07);_0x123d56(_0x50c69f[_0x35ce('0x15')](0x1f4,_0x1a0689['message']));});});}; \ No newline at end of file +var _0x70a5=['options','raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll'];(function(_0x2ef2e5,_0x5d822b){var _0xc895a1=function(_0x51e45c){while(--_0x51e45c){_0x2ef2e5['push'](_0x2ef2e5['shift']());}};_0xc895a1(++_0x5d822b);}(_0x70a5,0x10f));var _0x570a=function(_0x11cfbe,_0x2a40a5){_0x11cfbe=_0x11cfbe-0x0;var _0x6f663d=_0x70a5[_0x11cfbe];return _0x6f663d;};'use strict';var _=require(_0x570a('0x0'));var util=require(_0x570a('0x1'));var moment=require('moment');var BPromise=require(_0x570a('0x2'));var rs=require(_0x570a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x570a('0x4'))['db'];var utils=require(_0x570a('0x5'));var logger=require(_0x570a('0x6'))('rpc');var config=require(_0x570a('0x7'));var jayson=require(_0x570a('0x8'));var client=jayson[_0x570a('0x9')]['http']({'port':0x232a});config[_0x570a('0xa')]=_[_0x570a('0xb')](config[_0x570a('0xa')],{'host':_0x570a('0xc'),'port':0x18eb});var socket=require(_0x570a('0xd'))(new Redis(config[_0x570a('0xa')]));require(_0x570a('0xe'))[_0x570a('0xf')](socket);function respondWithRpcPromise(_0x3df241,_0x590888,_0x1c431d){return new BPromise(function(_0xada7e0,_0x2ffe4f){return client[_0x570a('0x10')](_0x3df241,_0x1c431d)['then'](function(_0x361873){logger[_0x570a('0x11')](_0x570a('0x12'),_0x590888,_0x570a('0x13'));logger[_0x570a('0x14')](_0x570a('0x15'),_0x590888,_0x570a('0x13'),JSON[_0x570a('0x16')](_0x361873));if(_0x361873[_0x570a('0x17')]){if(_0x361873[_0x570a('0x17')][_0x570a('0x18')]===0x1f4){logger[_0x570a('0x17')](_0x570a('0x12'),_0x590888,_0x361873[_0x570a('0x17')][_0x570a('0x19')]);return _0x2ffe4f(_0x361873['error'][_0x570a('0x19')]);}logger[_0x570a('0x17')](_0x570a('0x12'),_0x590888,_0x361873[_0x570a('0x17')]['message']);return _0xada7e0(_0x361873[_0x570a('0x17')][_0x570a('0x19')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x590888,_0x570a('0x13'));_0xada7e0(_0x361873['result'][_0x570a('0x19')]);}})[_0x570a('0x1a')](function(_0x342e46){logger[_0x570a('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x590888,_0x342e46);_0x2ffe4f(_0x342e46);});});}exports[_0x570a('0x1b')]=function(_0x49a4b9){var _0x1fc75b=this;return new Promise(function(_0x4c367e,_0x4f940d){return db[_0x570a('0x1c')][_0x570a('0x1d')]({'raw':_0x49a4b9[_0x570a('0x1e')]?_0x49a4b9[_0x570a('0x1e')][_0x570a('0x1f')]===undefined?!![]:![]:!![],'where':_0x49a4b9['options']?_0x49a4b9[_0x570a('0x1e')][_0x570a('0x20')]||null:null,'attributes':_0x49a4b9[_0x570a('0x1e')]?_0x49a4b9['options'][_0x570a('0x21')]||null:null,'limit':_0x49a4b9['options']?_0x49a4b9['options'][_0x570a('0x22')]||null:null,'include':_0x49a4b9[_0x570a('0x1e')]?_0x49a4b9[_0x570a('0x1e')][_0x570a('0x23')]?_['map'](_0x49a4b9[_0x570a('0x1e')][_0x570a('0x23')],function(_0x4bacd8){return{'model':db[_0x4bacd8['model']],'as':_0x4bacd8['as'],'attributes':_0x4bacd8[_0x570a('0x21')],'include':_0x4bacd8['include']?_[_0x570a('0x24')](_0x4bacd8[_0x570a('0x23')],function(_0x5d4a0b){return{'model':db[_0x5d4a0b[_0x570a('0x25')]],'as':_0x5d4a0b['as'],'attributes':_0x5d4a0b['attributes'],'include':_0x5d4a0b['include']?_[_0x570a('0x24')](_0x5d4a0b[_0x570a('0x23')],function(_0x4959c3){return{'model':db[_0x4959c3[_0x570a('0x25')]],'as':_0x4959c3['as'],'attributes':_0x4959c3[_0x570a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x570a('0x26')](function(_0x301718){logger['info']('GetVoiceQueueReport',_0x49a4b9);logger[_0x570a('0x14')](_0x570a('0x1b'),_0x49a4b9,JSON['stringify'](_0x301718));_0x4c367e(_0x301718);})[_0x570a('0x1a')](function(_0x1f92fe){logger[_0x570a('0x17')](_0x570a('0x1b'),_0x1f92fe[_0x570a('0x19')],_0x49a4b9);_0x4f940d(_0x1fc75b['error'](0x1f4,_0x1f92fe[_0x570a('0x19')]));});});};exports[_0x570a('0x27')]=function(_0x2470c8){var _0x5ef773=this;return new Promise(function(_0x5d408c,_0x5d6e34){return db[_0x570a('0x1c')][_0x570a('0x28')](_0x2470c8[_0x570a('0x29')],{'raw':_0x2470c8[_0x570a('0x1e')]?_0x2470c8[_0x570a('0x1e')][_0x570a('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xa389e8){logger['info'](_0x570a('0x27'),_0x2470c8);logger[_0x570a('0x14')](_0x570a('0x27'),_0x2470c8,JSON['stringify'](_0xa389e8));_0x5d408c(_0xa389e8);})[_0x570a('0x1a')](function(_0x461fc1){logger[_0x570a('0x17')](_0x570a('0x27'),_0x461fc1[_0x570a('0x19')],_0x2470c8);_0x5d6e34(_0x5ef773[_0x570a('0x17')](0x1f4,_0x461fc1[_0x570a('0x19')]));});});};exports[_0x570a('0x2a')]=function(_0x3d9ad1){var _0x2c56e6=this;return new Promise(function(_0x28df23,_0x53cb02){return db[_0x570a('0x1c')]['update'](_0x3d9ad1[_0x570a('0x29')],{'raw':_0x3d9ad1[_0x570a('0x1e')]?_0x3d9ad1[_0x570a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9ad1[_0x570a('0x1e')]?_0x3d9ad1[_0x570a('0x1e')][_0x570a('0x20')]||null:null,'attributes':_0x3d9ad1['options']?_0x3d9ad1[_0x570a('0x1e')][_0x570a('0x21')]||null:null,'limit':_0x3d9ad1[_0x570a('0x1e')]?_0x3d9ad1['options'][_0x570a('0x22')]||null:null})[_0x570a('0x26')](function(_0x48873c){logger['info'](_0x570a('0x2a'),_0x3d9ad1);logger[_0x570a('0x14')](_0x570a('0x2a'),_0x3d9ad1,JSON[_0x570a('0x16')](_0x48873c));_0x28df23(_0x48873c);})[_0x570a('0x1a')](function(_0x322a68){logger['error']('UpdateVoiceQueueReport',_0x322a68[_0x570a('0x19')],_0x3d9ad1);_0x53cb02(_0x2c56e6[_0x570a('0x17')](0x1f4,_0x322a68[_0x570a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a264e5a..2ddd1c8 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 _0x075e=['length','voiceQueueReport:','save','remove','update','emit','removeListener','register'];(function(_0x47a374,_0x2f612f){var _0x2f60bd=function(_0xa1fdbd){while(--_0xa1fdbd){_0x47a374['push'](_0x47a374['shift']());}};_0x2f60bd(++_0x2f612f);}(_0x075e,0x92));var _0xe075=function(_0x13dd5e,_0x45cdd2){_0x13dd5e=_0x13dd5e-0x0;var _0x3e5f8b=_0x075e[_0x13dd5e];return _0x3e5f8b;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xe075('0x0'),_0xe075('0x1'),_0xe075('0x2')];function createListener(_0x1e62fc,_0x252723){return function(_0x3d85a1){_0x252723[_0xe075('0x3')](_0x1e62fc,_0x3d85a1);};}function removeListener(_0x422c3a,_0x5eddf4){return function(){VoiceQueueReportEvents[_0xe075('0x4')](_0x422c3a,_0x5eddf4);};}exports[_0xe075('0x5')]=function(_0x5120da){for(var _0x18570b=0x0,_0x14d5a0=events[_0xe075('0x6')];_0x18570b<_0x14d5a0;_0x18570b++){var _0x282479=events[_0x18570b];var _0x33740d=createListener(_0xe075('0x7')+_0x282479,_0x5120da);VoiceQueueReportEvents['on'](_0x282479,_0x33740d);}}; \ No newline at end of file +var _0xe5b3=['remove','update','emit','removeListener','register','voiceQueueReport:','save'];(function(_0x561dd9,_0x3ebac8){var _0x480877=function(_0x6eb1ef){while(--_0x6eb1ef){_0x561dd9['push'](_0x561dd9['shift']());}};_0x480877(++_0x3ebac8);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3d20d1,_0x5bdb8a){_0x3d20d1=_0x3d20d1-0x0;var _0x4d28a0=_0xe5b3[_0x3d20d1];return _0x4d28a0;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x3e5b('0x0'),_0x3e5b('0x1'),_0x3e5b('0x2')];function createListener(_0x1c38ed,_0x2a71ef){return function(_0x3171c5){_0x2a71ef[_0x3e5b('0x3')](_0x1c38ed,_0x3171c5);};}function removeListener(_0x1e58ed,_0x320b1e){return function(){VoiceQueueReportEvents[_0x3e5b('0x4')](_0x1e58ed,_0x320b1e);};}exports[_0x3e5b('0x5')]=function(_0x54e1fb){for(var _0x174923=0x0,_0x5dcf55=events['length'];_0x174923<_0x5dcf55;_0x174923++){var _0x41d46f=events[_0x174923];var _0x3901c2=createListener(_0x3e5b('0x6')+_0x41d46f,_0x54e1fb);VoiceQueueReportEvents['on'](_0x41d46f,_0x3901c2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d8dd7cb..958e4ba 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 _0xa39b=['isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x2cf0a7,_0x1dcb6a){var _0x4f01f9=function(_0xc6fd6){while(--_0xc6fd6){_0x2cf0a7['push'](_0x2cf0a7['shift']());}};_0x4f01f9(++_0x1dcb6a);}(_0xa39b,0xee));var _0xba39=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa39b[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xba39('0x0'));var util=require(_0xba39('0x1'));var path=require(_0xba39('0x2'));var timeout=require(_0xba39('0x3'));var express=require(_0xba39('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba39('0x5'));var interaction=require(_0xba39('0x6'));var config=require(_0xba39('0x7'));var controller=require(_0xba39('0x8'));router['get']('/',auth[_0xba39('0x9')](),controller[_0xba39('0xa')]);router[_0xba39('0xb')](_0xba39('0xc'),auth['isAuthenticated'](),controller[_0xba39('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xba39('0xe')]);router[_0xba39('0xf')](_0xba39('0xc'),auth['isAuthenticated'](),controller[_0xba39('0x10')]);router[_0xba39('0x11')](_0xba39('0xc'),auth[_0xba39('0x9')](),controller[_0xba39('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6869=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','express'];(function(_0x5bdde5,_0x52253d){var _0x8f5400=function(_0x5bcd66){while(--_0x5bcd66){_0x5bdde5['push'](_0x5bdde5['shift']());}};_0x8f5400(++_0x52253d);}(_0x6869,0x1c5));var _0x9686=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6869[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x9686('0x0'));var path=require(_0x9686('0x1'));var timeout=require('connect-timeout');var express=require(_0x9686('0x2'));var router=express[_0x9686('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9686('0x4'));var interaction=require(_0x9686('0x5'));var config=require(_0x9686('0x6'));var controller=require(_0x9686('0x7'));router[_0x9686('0x8')]('/',auth[_0x9686('0x9')](),controller[_0x9686('0xa')]);router[_0x9686('0x8')](_0x9686('0xb'),auth['isAuthenticated'](),controller[_0x9686('0xc')]);router[_0x9686('0xd')]('/',auth[_0x9686('0x9')](),controller[_0x9686('0xe')]);router[_0x9686('0xf')](_0x9686('0xb'),auth['isAuthenticated'](),controller[_0x9686('0x10')]);router[_0x9686('0x11')](_0x9686('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9686('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 d15cee2..398219c 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 _0x5fdb=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x9adcd6,_0x36278b){var _0xdf8ff2=function(_0x4f7087){while(--_0x4f7087){_0x9adcd6['push'](_0x9adcd6['shift']());}};_0xdf8ff2(++_0x36278b);}(_0x5fdb,0x1b0));var _0xb5fd=function(_0x34b501,_0x4738f0){_0x34b501=_0x34b501-0x0;var _0x2fe122=_0x5fdb[_0x34b501];return _0x2fe122;};'use strict';var Sequelize=require(_0xb5fd('0x0'));var moment=require('moment');module[_0xb5fd('0x1')]={'time':{'type':Sequelize[_0xb5fd('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb5fd('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb5fd('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb5fd('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb5fd('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb5fd('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb5fd('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb5fd('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb5fd('0x3')],'allowNull':![],'defaultValue':moment()[_0xb5fd('0x4')](_0xb5fd('0x5'))}}; \ No newline at end of file +var _0x29ea=['DATE','format','sequelize','exports','STRING'];(function(_0x2a067b,_0x39c307){var _0x23021f=function(_0x47d44f){while(--_0x47d44f){_0x2a067b['push'](_0x2a067b['shift']());}};_0x23021f(++_0x39c307);}(_0x29ea,0x197));var _0xa29e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x29ea[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa29e('0x0'));var moment=require('moment');module[_0xa29e('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa29e('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa29e('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa29e('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa29e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa29e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa29e('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa29e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa29e('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa29e('0x3')],'allowNull':![],'defaultValue':moment()[_0xa29e('0x4')]('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 53a61c8..f9dc5f3 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 _0x1034=['show','params','rawAttributes','include','find','catch','create','body','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','reject','save','update','destroy','then','error','stack','name','index','map','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueuesLog','includeAll','findAll','rows'];(function(_0x274797,_0x56be87){var _0x5671b3=function(_0x5638fe){while(--_0x5638fe){_0x274797['push'](_0x274797['shift']());}};_0x5671b3(++_0x56be87);}(_0x1034,0xe3));var _0x4103=function(_0x2c6ec7,_0x481cb8){_0x2c6ec7=_0x2c6ec7-0x0;var _0x9e8944=_0x1034[_0x2c6ec7];return _0x9e8944;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4103('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4103('0x1'));var BPromise=require(_0x4103('0x2'));var Mustache=require(_0x4103('0x3'));var util=require(_0x4103('0x4'));var path=require('path');var sox=require(_0x4103('0x5'));var csv=require(_0x4103('0x6'));var ejs=require(_0x4103('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4103('0x8'));var squel=require(_0x4103('0x9'));var crypto=require(_0x4103('0xa'));var jsforce=require(_0x4103('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4103('0xc'));var Papa=require(_0x4103('0xd'));var Redis=require(_0x4103('0xe'));var authService=require(_0x4103('0xf'));var qs=require(_0x4103('0x10'));var as=require(_0x4103('0x11'));var hardwareService=require(_0x4103('0x12'));var logger=require(_0x4103('0x13'))(_0x4103('0x14'));var utils=require(_0x4103('0x15'));var config=require(_0x4103('0x16'));var licenseUtil=require(_0x4103('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x123f83,_0x661b10){_0x661b10=_0x661b10||0xcc;return function(_0x50753f){if(_0x50753f){return _0x123f83[_0x4103('0x18')](_0x661b10);}return _0x123f83[_0x4103('0x19')](_0x661b10)[_0x4103('0x1a')]();};}function respondWithResult(_0x1ee261,_0x3d5d62){_0x3d5d62=_0x3d5d62||0xc8;return function(_0x91e74e){if(_0x91e74e){return _0x1ee261[_0x4103('0x19')](_0x3d5d62)['json'](_0x91e74e);}};}function respondWithFilteredResult(_0x14fe44,_0x3942d6){return function(_0x1fda23){if(_0x1fda23){var _0x152d0d=typeof _0x3942d6[_0x4103('0x1b')]==='undefined'&&typeof _0x3942d6[_0x4103('0x1c')]==='undefined';var _0xf5d91a=_0x1fda23[_0x4103('0x1d')];var _0xf33311=_0x152d0d?0x0:_0x3942d6[_0x4103('0x1b')];var _0xcd263b=_0x152d0d?_0x1fda23[_0x4103('0x1d')]:_0x3942d6[_0x4103('0x1b')]+_0x3942d6['limit'];var _0x258ccd;if(_0xcd263b>=_0xf5d91a){_0xcd263b=_0xf5d91a;_0x258ccd=0xc8;}else{_0x258ccd=0xce;}_0x14fe44[_0x4103('0x19')](_0x258ccd);return _0x14fe44['set']('Content-Range',_0xf33311+'-'+_0xcd263b+'/'+_0xf5d91a)['json'](_0x1fda23);}return null;};}function patchUpdates(_0x174089){return function(_0xae98ec){try{jsonpatch['apply'](_0xae98ec,_0x174089,!![]);}catch(_0x499287){return BPromise[_0x4103('0x1e')](_0x499287);}return _0xae98ec[_0x4103('0x1f')]();};}function saveUpdates(_0x1c10b2,_0x2e328d){return function(_0x4bb8a1){if(_0x4bb8a1){return _0x4bb8a1[_0x4103('0x20')](_0x1c10b2)['then'](function(_0x44c203){return _0x44c203;});}return null;};}function removeEntity(_0x3e8c03,_0x2554c4){return function(_0xa93d29){if(_0xa93d29){return _0xa93d29[_0x4103('0x21')]()[_0x4103('0x22')](function(){_0x3e8c03[_0x4103('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c1004,_0x39414e){return function(_0x295ffd){if(!_0x295ffd){_0x3c1004[_0x4103('0x18')](0x194);}return _0x295ffd;};}function handleError(_0x117dc1,_0x149b6d){_0x149b6d=_0x149b6d||0x1f4;return function(_0x2e6174){logger[_0x4103('0x23')](_0x2e6174[_0x4103('0x24')]);if(_0x2e6174[_0x4103('0x25')]){delete _0x2e6174[_0x4103('0x25')];}_0x117dc1[_0x4103('0x19')](_0x149b6d)['send'](_0x2e6174);};}exports[_0x4103('0x26')]=function(_0x2fc58c,_0x5dcf25){var _0x110562={},_0x2f98d9={},_0x4093af={'count':0x0,'rows':[]};var _0x465b39=_[_0x4103('0x27')](db['VoiceQueuesLog']['rawAttributes'],function(_0x140dfd){return{'name':_0x140dfd[_0x4103('0x28')],'type':_0x140dfd[_0x4103('0x29')][_0x4103('0x2a')]};});_0x2f98d9[_0x4103('0x2b')]=_['map'](_0x465b39,'name');_0x2f98d9['query']=_[_0x4103('0x2c')](_0x2fc58c['query']);_0x2f98d9[_0x4103('0x2d')]=_[_0x4103('0x2e')](_0x2f98d9[_0x4103('0x2b')],_0x2f98d9[_0x4103('0x2f')]);_0x110562['attributes']=_['intersection'](_0x2f98d9[_0x4103('0x2b')],qs['fields'](_0x2fc58c[_0x4103('0x2f')][_0x4103('0x30')]));_0x110562[_0x4103('0x31')]=_0x110562[_0x4103('0x31')][_0x4103('0x32')]?_0x110562[_0x4103('0x31')]:_0x2f98d9['model'];if(!_0x2fc58c['query'][_0x4103('0x33')](_0x4103('0x34'))){_0x110562[_0x4103('0x1c')]=qs[_0x4103('0x1c')](_0x2fc58c[_0x4103('0x2f')][_0x4103('0x1c')]);_0x110562[_0x4103('0x1b')]=qs[_0x4103('0x1b')](_0x2fc58c[_0x4103('0x2f')][_0x4103('0x1b')]);}_0x110562[_0x4103('0x35')]=qs[_0x4103('0x36')](_0x2fc58c['query'][_0x4103('0x36')]);_0x110562[_0x4103('0x37')]=qs[_0x4103('0x2d')](_[_0x4103('0x38')](_0x2fc58c[_0x4103('0x2f')],_0x2f98d9[_0x4103('0x2d')]),_0x465b39);if(_0x2fc58c['query'][_0x4103('0x39')]){_0x110562['where']=_[_0x4103('0x3a')](_0x110562[_0x4103('0x37')],{'$or':_[_0x4103('0x27')](_0x465b39,function(_0x2fb34a){if(_0x2fb34a['type']!==_0x4103('0x3b')){var _0x342ed6={};_0x342ed6[_0x2fb34a['name']]={'$like':'%'+_0x2fc58c[_0x4103('0x2f')][_0x4103('0x39')]+'%'};return _0x342ed6;}})});}_0x110562=_[_0x4103('0x3a')]({},_0x110562,_0x2fc58c[_0x4103('0x3c')]);var _0x437c79={'where':_0x110562[_0x4103('0x37')]};return db[_0x4103('0x3d')][_0x4103('0x1d')](_0x437c79)[_0x4103('0x22')](function(_0x9a147a){_0x4093af['count']=_0x9a147a;if(_0x2fc58c[_0x4103('0x2f')][_0x4103('0x3e')]){_0x110562['include']=[{'all':!![]}];}return db[_0x4103('0x3d')][_0x4103('0x3f')](_0x110562);})[_0x4103('0x22')](function(_0x50346c){_0x4093af[_0x4103('0x40')]=_0x50346c;return _0x4093af;})[_0x4103('0x22')](respondWithFilteredResult(_0x5dcf25,_0x110562))['catch'](handleError(_0x5dcf25,null));};exports[_0x4103('0x41')]=function(_0x4b07bd,_0xf7c1a2){var _0x33bdc0={'raw':!![],'where':{'id':_0x4b07bd[_0x4103('0x42')]['id']}},_0x2c793c={};_0x2c793c['model']=_[_0x4103('0x2c')](db['VoiceQueuesLog'][_0x4103('0x43')]);_0x2c793c[_0x4103('0x2f')]=_['keys'](_0x4b07bd[_0x4103('0x2f')]);_0x2c793c[_0x4103('0x2d')]=_[_0x4103('0x2e')](_0x2c793c[_0x4103('0x2b')],_0x2c793c['query']);_0x33bdc0[_0x4103('0x31')]=_[_0x4103('0x2e')](_0x2c793c['model'],qs[_0x4103('0x30')](_0x4b07bd[_0x4103('0x2f')][_0x4103('0x30')]));_0x33bdc0[_0x4103('0x31')]=_0x33bdc0[_0x4103('0x31')]['length']?_0x33bdc0['attributes']:_0x2c793c[_0x4103('0x2b')];if(_0x4b07bd[_0x4103('0x2f')][_0x4103('0x3e')]){_0x33bdc0[_0x4103('0x44')]=[{'all':!![]}];}_0x33bdc0=_[_0x4103('0x3a')]({},_0x33bdc0,_0x4b07bd['options']);return db['VoiceQueuesLog'][_0x4103('0x45')](_0x33bdc0)[_0x4103('0x22')](handleEntityNotFound(_0xf7c1a2,null))['then'](respondWithResult(_0xf7c1a2,null))[_0x4103('0x46')](handleError(_0xf7c1a2,null));};exports[_0x4103('0x47')]=function(_0x5b35b2,_0x15db15){return db[_0x4103('0x3d')]['create'](_0x5b35b2[_0x4103('0x48')],{})['then'](respondWithResult(_0x15db15,0xc9))['catch'](handleError(_0x15db15,null));};exports[_0x4103('0x20')]=function(_0x47f5b3,_0x3b3fd2){if(_0x47f5b3['body']['id']){delete _0x47f5b3[_0x4103('0x48')]['id'];}return db['VoiceQueuesLog'][_0x4103('0x45')]({'where':{'id':_0x47f5b3['params']['id']}})['then'](handleEntityNotFound(_0x3b3fd2,null))[_0x4103('0x22')](saveUpdates(_0x47f5b3[_0x4103('0x48')],null))['then'](respondWithResult(_0x3b3fd2,null))['catch'](handleError(_0x3b3fd2,null));};exports[_0x4103('0x21')]=function(_0x2a3567,_0xfd39e8){return db['VoiceQueuesLog'][_0x4103('0x45')]({'where':{'id':_0x2a3567[_0x4103('0x42')]['id']}})[_0x4103('0x22')](handleEntityNotFound(_0xfd39e8,null))[_0x4103('0x22')](removeEntity(_0xfd39e8,null))[_0x4103('0x46')](handleError(_0xfd39e8,null));}; \ No newline at end of file +var _0x8094=['nolimit','order','sort','where','filters','pick','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x121886,_0x8cd8e5){var _0x20ca01=function(_0x15e144){while(--_0x15e144){_0x121886['push'](_0x121886['shift']());}};_0x20ca01(++_0x8cd8e5);}(_0x8094,0xa9));var _0x4809=function(_0xdfc87d,_0x28e1a5){_0xdfc87d=_0xdfc87d-0x0;var _0x4e2a5e=_0x8094[_0xdfc87d];return _0x4e2a5e;};'use strict';var emlformat=require(_0x4809('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4809('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4809('0x2'));var moment=require(_0x4809('0x3'));var BPromise=require(_0x4809('0x4'));var Mustache=require(_0x4809('0x5'));var util=require(_0x4809('0x6'));var path=require(_0x4809('0x7'));var sox=require('sox');var csv=require(_0x4809('0x8'));var ejs=require(_0x4809('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4809('0xa'));var squel=require(_0x4809('0xb'));var crypto=require(_0x4809('0xc'));var jsforce=require(_0x4809('0xd'));var deskjs=require(_0x4809('0xe'));var toCsv=require(_0x4809('0x8'));var querystring=require(_0x4809('0xf'));var Papa=require(_0x4809('0x10'));var Redis=require(_0x4809('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4809('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4809('0x13'));var logger=require('../../config/logger')(_0x4809('0x14'));var utils=require(_0x4809('0x15'));var config=require(_0x4809('0x16'));var licenseUtil=require(_0x4809('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8e56,_0x169a0f){_0x169a0f=_0x169a0f||0xcc;return function(_0x5ba82d){if(_0x5ba82d){return _0x2a8e56[_0x4809('0x18')](_0x169a0f);}return _0x2a8e56[_0x4809('0x19')](_0x169a0f)['end']();};}function respondWithResult(_0xe89236,_0x2eb54a){_0x2eb54a=_0x2eb54a||0xc8;return function(_0x18fce2){if(_0x18fce2){return _0xe89236['status'](_0x2eb54a)[_0x4809('0x1a')](_0x18fce2);}};}function respondWithFilteredResult(_0x46e733,_0x3394c5){return function(_0x15f44e){if(_0x15f44e){var _0xfaedba=typeof _0x3394c5[_0x4809('0x1b')]===_0x4809('0x1c')&&typeof _0x3394c5[_0x4809('0x1d')]===_0x4809('0x1c');var _0x592717=_0x15f44e['count'];var _0x21f095=_0xfaedba?0x0:_0x3394c5[_0x4809('0x1b')];var _0x19354c=_0xfaedba?_0x15f44e[_0x4809('0x1e')]:_0x3394c5[_0x4809('0x1b')]+_0x3394c5[_0x4809('0x1d')];var _0x4b747a;if(_0x19354c>=_0x592717){_0x19354c=_0x592717;_0x4b747a=0xc8;}else{_0x4b747a=0xce;}_0x46e733[_0x4809('0x19')](_0x4b747a);return _0x46e733['set'](_0x4809('0x1f'),_0x21f095+'-'+_0x19354c+'/'+_0x592717)['json'](_0x15f44e);}return null;};}function patchUpdates(_0x3fb554){return function(_0x5233e2){try{jsonpatch[_0x4809('0x20')](_0x5233e2,_0x3fb554,!![]);}catch(_0x59679f){return BPromise[_0x4809('0x21')](_0x59679f);}return _0x5233e2[_0x4809('0x22')]();};}function saveUpdates(_0xbd3fca,_0x284385){return function(_0x404da2){if(_0x404da2){return _0x404da2[_0x4809('0x23')](_0xbd3fca)[_0x4809('0x24')](function(_0x1093eb){return _0x1093eb;});}return null;};}function removeEntity(_0x17f160,_0x4eeef4){return function(_0xc0fa95){if(_0xc0fa95){return _0xc0fa95[_0x4809('0x25')]()[_0x4809('0x24')](function(){_0x17f160[_0x4809('0x19')](0xcc)[_0x4809('0x26')]();});}};}function handleEntityNotFound(_0x31f6c1,_0x7984ca){return function(_0x5c6126){if(!_0x5c6126){_0x31f6c1[_0x4809('0x18')](0x194);}return _0x5c6126;};}function handleError(_0x3fe2a0,_0x54640f){_0x54640f=_0x54640f||0x1f4;return function(_0xb50c80){logger[_0x4809('0x27')](_0xb50c80[_0x4809('0x28')]);if(_0xb50c80[_0x4809('0x29')]){delete _0xb50c80[_0x4809('0x29')];}_0x3fe2a0['status'](_0x54640f)[_0x4809('0x2a')](_0xb50c80);};}exports[_0x4809('0x2b')]=function(_0x243dbe,_0x421342){var _0x398203={},_0x19697c={},_0x161b8f={'count':0x0,'rows':[]};var _0x299cef=_[_0x4809('0x2c')](db[_0x4809('0x2d')][_0x4809('0x2e')],function(_0x31afd3){return{'name':_0x31afd3[_0x4809('0x2f')],'type':_0x31afd3['type'][_0x4809('0x30')]};});_0x19697c[_0x4809('0x31')]=_[_0x4809('0x2c')](_0x299cef,'name');_0x19697c[_0x4809('0x32')]=_['keys'](_0x243dbe['query']);_0x19697c['filters']=_[_0x4809('0x33')](_0x19697c[_0x4809('0x31')],_0x19697c[_0x4809('0x32')]);_0x398203[_0x4809('0x34')]=_[_0x4809('0x33')](_0x19697c['model'],qs[_0x4809('0x35')](_0x243dbe['query']['fields']));_0x398203[_0x4809('0x34')]=_0x398203[_0x4809('0x34')][_0x4809('0x36')]?_0x398203[_0x4809('0x34')]:_0x19697c['model'];if(!_0x243dbe[_0x4809('0x32')][_0x4809('0x37')](_0x4809('0x38'))){_0x398203['limit']=qs[_0x4809('0x1d')](_0x243dbe[_0x4809('0x32')][_0x4809('0x1d')]);_0x398203[_0x4809('0x1b')]=qs['offset'](_0x243dbe[_0x4809('0x32')][_0x4809('0x1b')]);}_0x398203[_0x4809('0x39')]=qs[_0x4809('0x3a')](_0x243dbe[_0x4809('0x32')][_0x4809('0x3a')]);_0x398203[_0x4809('0x3b')]=qs[_0x4809('0x3c')](_[_0x4809('0x3d')](_0x243dbe[_0x4809('0x32')],_0x19697c['filters']),_0x299cef);if(_0x243dbe[_0x4809('0x32')]['filter']){_0x398203[_0x4809('0x3b')]=_['merge'](_0x398203[_0x4809('0x3b')],{'$or':_[_0x4809('0x2c')](_0x299cef,function(_0x2f91d5){if(_0x2f91d5['type']!==_0x4809('0x3e')){var _0x1a9288={};_0x1a9288[_0x2f91d5[_0x4809('0x29')]]={'$like':'%'+_0x243dbe[_0x4809('0x32')][_0x4809('0x3f')]+'%'};return _0x1a9288;}})});}_0x398203=_['merge']({},_0x398203,_0x243dbe['options']);var _0x5a04bb={'where':_0x398203['where']};return db[_0x4809('0x2d')][_0x4809('0x1e')](_0x5a04bb)['then'](function(_0xc0fc10){_0x161b8f['count']=_0xc0fc10;if(_0x243dbe[_0x4809('0x32')][_0x4809('0x40')]){_0x398203['include']=[{'all':!![]}];}return db[_0x4809('0x2d')][_0x4809('0x41')](_0x398203);})[_0x4809('0x24')](function(_0x5290d2){_0x161b8f[_0x4809('0x42')]=_0x5290d2;return _0x161b8f;})[_0x4809('0x24')](respondWithFilteredResult(_0x421342,_0x398203))[_0x4809('0x43')](handleError(_0x421342,null));};exports[_0x4809('0x44')]=function(_0x3fef7f,_0x337353){var _0x2d95e7={'raw':!![],'where':{'id':_0x3fef7f[_0x4809('0x45')]['id']}},_0x2ae645={};_0x2ae645[_0x4809('0x31')]=_[_0x4809('0x46')](db[_0x4809('0x2d')]['rawAttributes']);_0x2ae645['query']=_[_0x4809('0x46')](_0x3fef7f[_0x4809('0x32')]);_0x2ae645[_0x4809('0x3c')]=_['intersection'](_0x2ae645[_0x4809('0x31')],_0x2ae645[_0x4809('0x32')]);_0x2d95e7[_0x4809('0x34')]=_['intersection'](_0x2ae645['model'],qs[_0x4809('0x35')](_0x3fef7f[_0x4809('0x32')][_0x4809('0x35')]));_0x2d95e7[_0x4809('0x34')]=_0x2d95e7['attributes']['length']?_0x2d95e7[_0x4809('0x34')]:_0x2ae645[_0x4809('0x31')];if(_0x3fef7f['query']['includeAll']){_0x2d95e7[_0x4809('0x47')]=[{'all':!![]}];}_0x2d95e7=_['merge']({},_0x2d95e7,_0x3fef7f['options']);return db[_0x4809('0x2d')][_0x4809('0x48')](_0x2d95e7)['then'](handleEntityNotFound(_0x337353,null))[_0x4809('0x24')](respondWithResult(_0x337353,null))[_0x4809('0x43')](handleError(_0x337353,null));};exports[_0x4809('0x49')]=function(_0x27d16b,_0x306d64){return db[_0x4809('0x2d')][_0x4809('0x49')](_0x27d16b[_0x4809('0x4a')],{})['then'](respondWithResult(_0x306d64,0xc9))['catch'](handleError(_0x306d64,null));};exports['update']=function(_0x3fdff0,_0x50b55d){if(_0x3fdff0[_0x4809('0x4a')]['id']){delete _0x3fdff0[_0x4809('0x4a')]['id'];}return db[_0x4809('0x2d')][_0x4809('0x48')]({'where':{'id':_0x3fdff0[_0x4809('0x45')]['id']}})[_0x4809('0x24')](handleEntityNotFound(_0x50b55d,null))['then'](saveUpdates(_0x3fdff0[_0x4809('0x4a')],null))[_0x4809('0x24')](respondWithResult(_0x50b55d,null))[_0x4809('0x43')](handleError(_0x50b55d,null));};exports[_0x4809('0x25')]=function(_0xb0d6b,_0x23f3cd){return db['VoiceQueuesLog'][_0x4809('0x48')]({'where':{'id':_0xb0d6b['params']['id']}})['then'](handleEntityNotFound(_0x23f3cd,null))['then'](removeEntity(_0x23f3cd,null))[_0x4809('0x43')](handleError(_0x23f3cd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e7de4f2..8c8f9e5 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 _0xa678=['dtm','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','voice_queues_log','event_dtm','event'];(function(_0x18c5c0,_0x3c5b77){var _0x3dba4b=function(_0x47ef5b){while(--_0x47ef5b){_0x18c5c0['push'](_0x18c5c0['shift']());}};_0x3dba4b(++_0x3c5b77);}(_0xa678,0xe1));var _0x8a67=function(_0x16786e,_0x268da8){_0x16786e=_0x16786e-0x0;var _0x2af21a=_0xa678[_0x16786e];return _0x2af21a;};'use strict';var _=require(_0x8a67('0x0'));var util=require(_0x8a67('0x1'));var logger=require(_0x8a67('0x2'))(_0x8a67('0x3'));var moment=require(_0x8a67('0x4'));var BPromise=require(_0x8a67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a67('0x6'));var rimraf=require(_0x8a67('0x7'));var config=require(_0x8a67('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x8a67('0x9')]=function(_0x5ba4dd,_0x16c745){return _0x5ba4dd['define']('VoiceQueuesLog',attributes,{'tableName':_0x8a67('0xa'),'paranoid':![],'indexes':[{'name':_0x8a67('0xb'),'fields':[_0x8a67('0xc'),_0x8a67('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x61b2=['dtm','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x193990,_0x59d904){var _0x1943ca=function(_0x3a0edb){while(--_0x3a0edb){_0x193990['push'](_0x193990['shift']());}};_0x1943ca(++_0x59d904);}(_0x61b2,0x1eb));var _0x261b=function(_0x33b608,_0x3b7a42){_0x33b608=_0x33b608-0x0;var _0x3ee2aa=_0x61b2[_0x33b608];return _0x3ee2aa;};'use strict';var _=require('lodash');var util=require(_0x261b('0x0'));var logger=require('../../config/logger')(_0x261b('0x1'));var moment=require(_0x261b('0x2'));var BPromise=require(_0x261b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x261b('0x4'));var rimraf=require(_0x261b('0x5'));var config=require(_0x261b('0x6'));var attributes=require(_0x261b('0x7'));module[_0x261b('0x8')]=function(_0x4cfe1f,_0x5a32c7){return _0x4cfe1f['define'](_0x261b('0x9'),attributes,{'tableName':_0x261b('0xa'),'paranoid':![],'indexes':[{'name':_0x261b('0xb'),'fields':[_0x261b('0xc'),_0x261b('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 163f9c8..038680a 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 _0x36f1=['../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1037f0,_0x4f1dbb){var _0x5f596d=function(_0x1f23b0){while(--_0x1f23b0){_0x1037f0['push'](_0x1037f0['shift']());}};_0x5f596d(++_0x4f1dbb);}(_0x36f1,0xb0));var _0x136f=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x36f1[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x136f('0x0'));var util=require('util');var moment=require(_0x136f('0x1'));var BPromise=require('bluebird');var rs=require(_0x136f('0x2'));var fs=require('fs');var Redis=require(_0x136f('0x3'));var db=require(_0x136f('0x4'))['db'];var utils=require(_0x136f('0x5'));var logger=require(_0x136f('0x6'))(_0x136f('0x7'));var config=require(_0x136f('0x8'));var jayson=require(_0x136f('0x9'));var client=jayson[_0x136f('0xa')][_0x136f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x525663,_0x2e05cf,_0x29e9c5){return new BPromise(function(_0x3c7a1c,_0x48e3d2){return client[_0x136f('0xc')](_0x525663,_0x29e9c5)[_0x136f('0xd')](function(_0x51d57){logger[_0x136f('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2e05cf,'request\x20sent');logger[_0x136f('0xf')](_0x136f('0x10'),_0x2e05cf,_0x136f('0x11'),JSON['stringify'](_0x51d57));if(_0x51d57['error']){if(_0x51d57[_0x136f('0x12')][_0x136f('0x13')]===0x1f4){logger[_0x136f('0x12')](_0x136f('0x14'),_0x2e05cf,_0x51d57[_0x136f('0x12')]['message']);return _0x48e3d2(_0x51d57['error'][_0x136f('0x15')]);}logger[_0x136f('0x12')](_0x136f('0x14'),_0x2e05cf,_0x51d57['error'][_0x136f('0x15')]);return _0x3c7a1c(_0x51d57[_0x136f('0x12')][_0x136f('0x15')]);}else{logger[_0x136f('0xe')](_0x136f('0x14'),_0x2e05cf,_0x136f('0x11'));_0x3c7a1c(_0x51d57[_0x136f('0x16')][_0x136f('0x15')]);}})['catch'](function(_0x16d69a){logger[_0x136f('0x12')](_0x136f('0x14'),_0x2e05cf,_0x16d69a);_0x48e3d2(_0x16d69a);});});} \ No newline at end of file +var _0xe0af=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0xbd8d2f,_0xfd8bb3){var _0xc926bb=function(_0x24d9a7){while(--_0x24d9a7){_0xbd8d2f['push'](_0xbd8d2f['shift']());}};_0xc926bb(++_0xfd8bb3);}(_0xe0af,0x1c9));var _0xfe0a=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0xe0af[_0x3a3c17];return _0xd07f21;};'use strict';var _=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var moment=require(_0xfe0a('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe0a('0x3'));var fs=require('fs');var Redis=require(_0xfe0a('0x4'));var db=require(_0xfe0a('0x5'))['db'];var utils=require(_0xfe0a('0x6'));var logger=require(_0xfe0a('0x7'))(_0xfe0a('0x8'));var config=require(_0xfe0a('0x9'));var jayson=require(_0xfe0a('0xa'));var client=jayson[_0xfe0a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x495f1e,_0x1251cf,_0x413979){return new BPromise(function(_0x5302bd,_0x42841d){return client[_0xfe0a('0xc')](_0x495f1e,_0x413979)['then'](function(_0x39a2ac){logger[_0xfe0a('0xd')](_0xfe0a('0xe'),_0x1251cf,_0xfe0a('0xf'));logger['debug'](_0xfe0a('0x10'),_0x1251cf,_0xfe0a('0xf'),JSON[_0xfe0a('0x11')](_0x39a2ac));if(_0x39a2ac[_0xfe0a('0x12')]){if(_0x39a2ac[_0xfe0a('0x12')][_0xfe0a('0x13')]===0x1f4){logger['error'](_0xfe0a('0xe'),_0x1251cf,_0x39a2ac[_0xfe0a('0x12')]['message']);return _0x42841d(_0x39a2ac[_0xfe0a('0x12')][_0xfe0a('0x14')]);}logger[_0xfe0a('0x12')](_0xfe0a('0xe'),_0x1251cf,_0x39a2ac['error'][_0xfe0a('0x14')]);return _0x5302bd(_0x39a2ac['error'][_0xfe0a('0x14')]);}else{logger[_0xfe0a('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1251cf,'request\x20sent');_0x5302bd(_0x39a2ac[_0xfe0a('0x15')][_0xfe0a('0x14')]);}})['catch'](function(_0x414ef0){logger[_0xfe0a('0x12')](_0xfe0a('0xe'),_0x1251cf,_0x414ef0);_0x42841d(_0x414ef0);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index f62eeba..c0dacc5 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 _0xa1bd=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x54e821,_0x15791d){var _0xa47573=function(_0x1593b7){while(--_0x1593b7){_0x54e821['push'](_0x54e821['shift']());}};_0xa47573(++_0x15791d);}(_0xa1bd,0x14c));var _0xda1b=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0xa1bd[_0x3eff21];return _0x1945bb;};'use strict';var multer=require(_0xda1b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda1b('0x1'));var express=require(_0xda1b('0x2'));var router=express[_0xda1b('0x3')]();var fs_extra=require(_0xda1b('0x4'));var auth=require(_0xda1b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda1b('0x6'));var controller=require('./voiceRecording.controller');router[_0xda1b('0x7')]('/',auth[_0xda1b('0x8')](),controller[_0xda1b('0x9')]);router[_0xda1b('0x7')]('/describe',auth[_0xda1b('0x8')](),controller[_0xda1b('0xa')]);router['get'](_0xda1b('0xb'),auth['isAuthenticated'](),controller[_0xda1b('0xc')]);router['get'](_0xda1b('0xd'),auth[_0xda1b('0x8')](),controller[_0xda1b('0xe')]);router[_0xda1b('0x7')](_0xda1b('0xf'),controller['downloads']);router['get'](_0xda1b('0x10'),auth['isAuthenticated'](),controller[_0xda1b('0x11')]);router[_0xda1b('0x12')]('/',auth['isAuthenticated'](),controller[_0xda1b('0x13')]);router[_0xda1b('0x12')]('/:id/transcribe',auth[_0xda1b('0x8')](),controller[_0xda1b('0x14')]);router['put']('/:id',auth[_0xda1b('0x8')](),controller['update']);router[_0xda1b('0x15')](_0xda1b('0xb'),auth[_0xda1b('0x8')](),controller[_0xda1b('0x16')]);module[_0xda1b('0x17')]=router; \ No newline at end of file +var _0x2f27=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','exports','util','path'];(function(_0x10dd0c,_0x34c2ce){var _0x52dfac=function(_0x727bd0){while(--_0x727bd0){_0x10dd0c['push'](_0x10dd0c['shift']());}};_0x52dfac(++_0x34c2ce);}(_0x2f27,0xc9));var _0x72f2=function(_0x390aad,_0x4117e7){_0x390aad=_0x390aad-0x0;var _0x2cb8e3=_0x2f27[_0x390aad];return _0x2cb8e3;};'use strict';var multer=require('multer');var util=require(_0x72f2('0x0'));var path=require(_0x72f2('0x1'));var timeout=require(_0x72f2('0x2'));var express=require(_0x72f2('0x3'));var router=express[_0x72f2('0x4')]();var fs_extra=require(_0x72f2('0x5'));var auth=require(_0x72f2('0x6'));var interaction=require(_0x72f2('0x7'));var config=require(_0x72f2('0x8'));var controller=require(_0x72f2('0x9'));router[_0x72f2('0xa')]('/',auth['isAuthenticated'](),controller[_0x72f2('0xb')]);router['get'](_0x72f2('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x72f2('0xa')](_0x72f2('0xd'),auth[_0x72f2('0xe')](),controller[_0x72f2('0xf')]);router[_0x72f2('0xa')](_0x72f2('0x10'),auth[_0x72f2('0xe')](),controller[_0x72f2('0x11')]);router['get'](_0x72f2('0x12'),controller[_0x72f2('0x13')]);router[_0x72f2('0xa')](_0x72f2('0x14'),auth[_0x72f2('0xe')](),controller[_0x72f2('0x15')]);router[_0x72f2('0x16')]('/',auth[_0x72f2('0xe')](),controller[_0x72f2('0x17')]);router[_0x72f2('0x16')](_0x72f2('0x14'),auth[_0x72f2('0xe')](),controller[_0x72f2('0x18')]);router[_0x72f2('0x19')](_0x72f2('0xd'),auth[_0x72f2('0xe')](),controller[_0x72f2('0x1a')]);router[_0x72f2('0x1b')](_0x72f2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x72f2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index fa502f0..70b7705 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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 36fb147..f38c44b 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 _0x1c50=['root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','uuid/v4','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','save','update','then','destroy','stack','name','index','map','VoiceRecording','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','token','$and','push','isNil','Entity\x20not\x20found','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1c50,0x124));var _0x01c5=function(_0x4d1819,_0x45f54d){_0x4d1819=_0x4d1819-0x0;var _0xc1e0e6=_0x1c50[_0x4d1819];return _0xc1e0e6;};'use strict';var emlformat=require(_0x01c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x01c5('0x1'));var jsonpatch=require(_0x01c5('0x2'));var rp=require(_0x01c5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x01c5('0x4'));var util=require(_0x01c5('0x5'));var path=require(_0x01c5('0x6'));var sox=require(_0x01c5('0x7'));var csv=require(_0x01c5('0x8'));var ejs=require(_0x01c5('0x9'));var fs=require('fs');var fs_extra=require(_0x01c5('0xa'));var _=require(_0x01c5('0xb'));var squel=require(_0x01c5('0xc'));var crypto=require(_0x01c5('0xd'));var jsforce=require(_0x01c5('0xe'));var deskjs=require(_0x01c5('0xf'));var toCsv=require(_0x01c5('0x8'));var querystring=require(_0x01c5('0x10'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x01c5('0x11'));var Redis=require('ioredis');var authService=require(_0x01c5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01c5('0x13'));var logger=require('../../config/logger')(_0x01c5('0x14'));var utils=require('../../config/utils');var config=require(_0x01c5('0x15'));var licenseUtil=require(_0x01c5('0x16'));var db=require(_0x01c5('0x17'))['db'];function respondWithStatusCode(_0x4079e1,_0x49cf85){_0x49cf85=_0x49cf85||0xcc;return function(_0x122249){if(_0x122249){return _0x4079e1[_0x01c5('0x18')](_0x49cf85);}return _0x4079e1[_0x01c5('0x19')](_0x49cf85)[_0x01c5('0x1a')]();};}function respondWithResult(_0x3eb5ff,_0x198e92){_0x198e92=_0x198e92||0xc8;return function(_0xfb41dc){if(_0xfb41dc){return _0x3eb5ff[_0x01c5('0x19')](_0x198e92)['json'](_0xfb41dc);}};}function respondWithFilteredResult(_0x2efb13,_0x14aa9d){return function(_0x59af42){if(_0x59af42){var _0x458296=typeof _0x14aa9d[_0x01c5('0x1b')]==='undefined'&&typeof _0x14aa9d['limit']===_0x01c5('0x1c');var _0x1ab595=_0x59af42[_0x01c5('0x1d')];var _0x3bf7e9=_0x458296?0x0:_0x14aa9d[_0x01c5('0x1b')];var _0x9e68d8=_0x458296?_0x59af42[_0x01c5('0x1d')]:_0x14aa9d[_0x01c5('0x1b')]+_0x14aa9d['limit'];var _0x525ed7;if(_0x9e68d8>=_0x1ab595){_0x9e68d8=_0x1ab595;_0x525ed7=0xc8;}else{_0x525ed7=0xce;}_0x2efb13[_0x01c5('0x19')](_0x525ed7);return _0x2efb13['set'](_0x01c5('0x1e'),_0x3bf7e9+'-'+_0x9e68d8+'/'+_0x1ab595)['json'](_0x59af42);}return null;};}function patchUpdates(_0x417580){return function(_0x47ab79){try{jsonpatch['apply'](_0x47ab79,_0x417580,!![]);}catch(_0x44a986){return BPromise['reject'](_0x44a986);}return _0x47ab79[_0x01c5('0x1f')]();};}function saveUpdates(_0x46d8ae,_0x16f205){return function(_0x1f0c65){if(_0x1f0c65){return _0x1f0c65[_0x01c5('0x20')](_0x46d8ae)[_0x01c5('0x21')](function(_0x10582c){return _0x10582c;});}return null;};}function removeEntity(_0x529628,_0x53ba51){return function(_0x51f7ef){if(_0x51f7ef){return _0x51f7ef[_0x01c5('0x22')]()[_0x01c5('0x21')](function(){_0x529628[_0x01c5('0x19')](0xcc)[_0x01c5('0x1a')]();});}};}function handleEntityNotFound(_0x20edc4,_0x57b9cc){return function(_0x47abb0){if(!_0x47abb0){_0x20edc4[_0x01c5('0x18')](0x194);}return _0x47abb0;};}function handleError(_0x34c1c1,_0x3985c9){_0x3985c9=_0x3985c9||0x1f4;return function(_0x42eec8){logger['error'](_0x42eec8[_0x01c5('0x23')]);if(_0x42eec8[_0x01c5('0x24')]){delete _0x42eec8['name'];}_0x34c1c1[_0x01c5('0x19')](_0x3985c9)['send'](_0x42eec8);};}exports[_0x01c5('0x25')]=function(_0x466c62,_0x3aa76c){var _0x4f2ec7={},_0x20facc={},_0x5d2719={'count':0x0,'rows':[]};var _0x14dbba=_[_0x01c5('0x26')](db[_0x01c5('0x27')][_0x01c5('0x28')],function(_0x2caa76){return{'name':_0x2caa76['fieldName'],'type':_0x2caa76[_0x01c5('0x29')][_0x01c5('0x2a')]};});_0x20facc[_0x01c5('0x2b')]=_['differenceBy'](_[_0x01c5('0x26')](_0x14dbba,_0x01c5('0x24')),['format']);_0x20facc[_0x01c5('0x2c')]=_[_0x01c5('0x2d')](_0x466c62[_0x01c5('0x2c')]);_0x20facc['filters']=_['intersection'](_0x20facc[_0x01c5('0x2b')],_0x20facc[_0x01c5('0x2c')]);_0x4f2ec7[_0x01c5('0x2e')]=_[_0x01c5('0x2f')](_0x20facc[_0x01c5('0x2b')],qs[_0x01c5('0x30')](_0x466c62[_0x01c5('0x2c')][_0x01c5('0x30')]));_0x4f2ec7[_0x01c5('0x2e')]=_0x4f2ec7[_0x01c5('0x2e')][_0x01c5('0x31')]?_0x4f2ec7[_0x01c5('0x2e')]:_0x20facc[_0x01c5('0x2b')];if(!_0x466c62['query'][_0x01c5('0x32')]('nolimit')){_0x4f2ec7['limit']=qs[_0x01c5('0x33')](_0x466c62[_0x01c5('0x2c')][_0x01c5('0x33')]);_0x4f2ec7[_0x01c5('0x1b')]=qs['offset'](_0x466c62[_0x01c5('0x2c')][_0x01c5('0x1b')]);}_0x4f2ec7[_0x01c5('0x34')]=qs[_0x01c5('0x35')](_0x466c62[_0x01c5('0x2c')]['sort']);_0x4f2ec7[_0x01c5('0x36')]=qs[_0x01c5('0x37')](_[_0x01c5('0x38')](_0x466c62[_0x01c5('0x2c')],_0x20facc[_0x01c5('0x37')]),_0x14dbba);if(_0x466c62['query'][_0x01c5('0x39')]){_0x4f2ec7[_0x01c5('0x36')]=_['merge'](_0x4f2ec7[_0x01c5('0x36')],{'$or':_[_0x01c5('0x26')](_0x14dbba,function(_0x5eeb71){if(_0x5eeb71[_0x01c5('0x29')]!=='VIRTUAL'){var _0x5bac61={};_0x5bac61[_0x5eeb71[_0x01c5('0x24')]]={'$like':'%'+_0x466c62['query'][_0x01c5('0x39')]+'%'};return _0x5bac61;}})});}_0x4f2ec7=_[_0x01c5('0x3a')]({},_0x4f2ec7,_0x466c62['options']);var _0x27ea73={'where':_0x4f2ec7[_0x01c5('0x36')]};return db[_0x01c5('0x27')]['count'](_0x27ea73)[_0x01c5('0x21')](function(_0x1ec24d){_0x5d2719['count']=_0x1ec24d;if(_0x466c62[_0x01c5('0x2c')][_0x01c5('0x3b')]){_0x4f2ec7[_0x01c5('0x3c')]=[{'all':!![]}];}return db[_0x01c5('0x27')][_0x01c5('0x3d')](_0x4f2ec7);})[_0x01c5('0x21')](function(_0x500fff){_0x5d2719[_0x01c5('0x3e')]=_0x500fff;return _0x5d2719;})['then'](respondWithFilteredResult(_0x3aa76c,_0x4f2ec7))['catch'](handleError(_0x3aa76c,null));};exports[_0x01c5('0x3f')]=function(_0x37da24,_0x79c254){var _0x5bf6d0={'raw':![],'where':{'id':_0x37da24[_0x01c5('0x40')]['id']}},_0x2aa4e0={};_0x2aa4e0[_0x01c5('0x2b')]=_['keys'](db['VoiceRecording'][_0x01c5('0x28')]);_0x2aa4e0[_0x01c5('0x2c')]=_['keys'](_0x37da24[_0x01c5('0x2c')]);_0x2aa4e0['filters']=_[_0x01c5('0x2f')](_0x2aa4e0[_0x01c5('0x2b')],_0x2aa4e0['query']);_0x5bf6d0[_0x01c5('0x2e')]=_['intersection'](_0x2aa4e0['model'],qs[_0x01c5('0x30')](_0x37da24[_0x01c5('0x2c')][_0x01c5('0x30')]));_0x5bf6d0[_0x01c5('0x2e')]=_0x5bf6d0[_0x01c5('0x2e')][_0x01c5('0x31')]?_0x5bf6d0[_0x01c5('0x2e')]:_0x2aa4e0[_0x01c5('0x2b')];if(_0x37da24['query'][_0x01c5('0x3b')]){_0x5bf6d0[_0x01c5('0x3c')]=[{'all':!![]}];}_0x5bf6d0=_[_0x01c5('0x3a')]({},_0x5bf6d0,_0x37da24['options']);return db[_0x01c5('0x27')][_0x01c5('0x41')](_0x5bf6d0)['then'](handleEntityNotFound(_0x79c254,null))[_0x01c5('0x21')](respondWithResult(_0x79c254,null))[_0x01c5('0x42')](handleError(_0x79c254,null));};exports[_0x01c5('0x43')]=function(_0xe2c2a4,_0x1127e6){return db['VoiceRecording'][_0x01c5('0x43')](_0xe2c2a4[_0x01c5('0x44')],{})['then'](respondWithResult(_0x1127e6,0xc9))[_0x01c5('0x42')](handleError(_0x1127e6,null));};exports[_0x01c5('0x20')]=function(_0x5d04f4,_0x3033dc){if(_0x5d04f4[_0x01c5('0x44')]['id']){delete _0x5d04f4[_0x01c5('0x44')]['id'];}return db['VoiceRecording'][_0x01c5('0x41')]({'where':{'id':_0x5d04f4[_0x01c5('0x40')]['id']}})[_0x01c5('0x21')](handleEntityNotFound(_0x3033dc,null))['then'](saveUpdates(_0x5d04f4[_0x01c5('0x44')],null))['then'](respondWithResult(_0x3033dc,null))[_0x01c5('0x42')](handleError(_0x3033dc,null));};exports[_0x01c5('0x45')]=function(_0x550ce3,_0x3dce42){return db[_0x01c5('0x27')][_0x01c5('0x45')]()[_0x01c5('0x21')](respondWithResult(_0x3dce42,null))[_0x01c5('0x42')](handleError(_0x3dce42,null));};exports[_0x01c5('0x46')]=function(_0x4314a2,_0x23e09a,_0x2e8b7d){var _0x1f554b=require(_0x01c5('0x47'));var _0x49b1ac=![];var _0x32897c={};if(_0x4314a2['query'][_0x01c5('0x29')]&&_0x4314a2[_0x01c5('0x2c')][_0x01c5('0x29')]===_0x01c5('0x48')){_0x32897c['uniqueid']=_0x4314a2['params']['id'];}else{_0x32897c['id']=_0x4314a2['params']['id'];}return db[_0x01c5('0x27')]['find']({'where':_0x32897c,'attributes':['id',_0x01c5('0x49')],'raw':!![]})[_0x01c5('0x21')](handleEntityNotFound(_0x23e09a,null))[_0x01c5('0x21')](function(_0x10a7bf){if(_0x10a7bf){var _0x382321=_0x10a7bf[_0x01c5('0x49')];var _0x5425cc=util[_0x01c5('0x4a')](_0x01c5('0x4b'),_0x382321);if(fs[_0x01c5('0x4c')](_0x5425cc)){_0x49b1ac=!![];return _0x1f554b[_0x01c5('0x4d')](_0x5425cc,_0x382321,config[_0x01c5('0x4e')][_0x01c5('0x4f')])[_0x01c5('0x21')](function(){return _0x10a7bf;});}return _0x10a7bf;}})[_0x01c5('0x21')](function(_0x2d5185){if(_0x2d5185){var _0x2dd2d2=_0x2d5185[_0x01c5('0x49')];if(!fs[_0x01c5('0x4c')](_0x2dd2d2)){throw new db[(_0x01c5('0x50'))][(_0x01c5('0x51'))](_0x01c5('0x52'));}if(_0x2d5185[_0x01c5('0x53')]){return _0x23e09a[_0x01c5('0x46')](_0x2dd2d2,_0x2d5185[_0x01c5('0x53')]+path[_0x01c5('0x54')](_0x2dd2d2),function(){if(_0x49b1ac){fs[_0x01c5('0x55')](_0x2dd2d2);}});}else{return _0x23e09a[_0x01c5('0x46')](_0x2dd2d2,function(_0x428852){if(_0x49b1ac){fs[_0x01c5('0x55')](_0x2dd2d2);}});}}})[_0x01c5('0x42')](function(_0x1fc770){if(_0x1fc770[_0x01c5('0x56')]===_0x01c5('0x52')){_0x23e09a['status'](0x194)[_0x01c5('0x57')](_0x01c5('0x58'));}else{return handleError(_0x23e09a,null);}});};exports[_0x01c5('0x59')]=function(_0x1eceb1,_0x5a7ade,_0x324a1a){var _0x565b71=require(_0x01c5('0x47'));var _0xb759bb=![];var _0x4808cc={'$and':[db[_0x01c5('0x5a')][_0x01c5('0x36')](db[_0x01c5('0x5a')]['fn'](_0x01c5('0x5b'),db[_0x01c5('0x5a')]['col'](_0x01c5('0x48'))),_0x1eceb1[_0x01c5('0x2c')][_0x01c5('0x5c')])]};if(_0x1eceb1[_0x01c5('0x2c')][_0x01c5('0x29')]&&_0x1eceb1['query'][_0x01c5('0x29')]===_0x01c5('0x48')){_0x4808cc['$and']['push']({'uniqueid':_0x1eceb1[_0x01c5('0x40')]['id']});}else{_0x4808cc[_0x01c5('0x5d')][_0x01c5('0x5e')]({'id':_0x1eceb1[_0x01c5('0x40')]['id']});}return db[_0x01c5('0x27')]['find']({'where':_0x4808cc,'attributes':['id',_0x01c5('0x49')],'raw':!![]})[_0x01c5('0x21')](handleEntityNotFound(_0x5a7ade,null))[_0x01c5('0x21')](function(_0x510790){if(_0x510790){var _0x3e0fdd=util[_0x01c5('0x4a')](_0x01c5('0x4b'),_0x510790['value']);if(fs[_0x01c5('0x4c')](_0x3e0fdd)){_0xb759bb=!![];return _0x565b71[_0x01c5('0x4d')](_0x3e0fdd,_0x510790[_0x01c5('0x49')],config[_0x01c5('0x4e')][_0x01c5('0x4f')])[_0x01c5('0x21')](function(){return _0x510790;});}return _0x510790;}})['then'](function(_0x31e8e2){if(_0x31e8e2){if(!fs[_0x01c5('0x4c')](_0x31e8e2[_0x01c5('0x49')])){throw new db['Sequelize'][(_0x01c5('0x51'))](_0x01c5('0x52'));}if(_0x31e8e2[_0x01c5('0x53')]){return _0x5a7ade[_0x01c5('0x46')](_0x31e8e2[_0x01c5('0x49')],_0x31e8e2[_0x01c5('0x53')]+path[_0x01c5('0x54')](_0x31e8e2[_0x01c5('0x49')]),function(){if(_0xb759bb){fs['unlink'](_0x31e8e2[_0x01c5('0x49')]);}});}else{return _0x5a7ade['download'](_0x31e8e2['value'],function(_0x5d5445){if(_0xb759bb){fs['unlink'](_0x31e8e2['value']);}});}}})[_0x01c5('0x42')](handleError(_0x5a7ade,null));};exports[_0x01c5('0x22')]=function(_0x2d8615,_0x7a3a52){return db[_0x01c5('0x27')][_0x01c5('0x41')]({'where':{'id':_0x2d8615[_0x01c5('0x40')]['id']}})[_0x01c5('0x21')](function(_0x5e6a20){if(_[_0x01c5('0x5f')](_0x5e6a20)){throw new ReferenceError(_0x01c5('0x60'));}return _0x5e6a20;})['then'](function(_0x656b2a){var _0x3d891f=_0x656b2a[_0x01c5('0x49')];logger[_0x01c5('0x61')]('cancellazione\x20fisica\x20documento\x20%s',_0x3d891f);if(!_[_0x01c5('0x5f')](_0x656b2a[_0x01c5('0x49')])&&fs[_0x01c5('0x4c')](_0x3d891f)){logger[_0x01c5('0x61')]('File:\x20\x22'+_0x3d891f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x01c5('0x62')](_0x3d891f);}_0x3d891f=_0x3d891f+_0x01c5('0x63');if(!_['isNil'](_0x656b2a[_0x01c5('0x49')])&&fs['existsSync'](_0x3d891f)){logger['info'](_0x01c5('0x64')+_0x3d891f+_0x01c5('0x65'));fs['unlinkSync'](_0x3d891f);}return _0x656b2a;})['then'](function(_0x33bca4){if(!_0x33bca4)throw new InternalError();return _0x33bca4[_0x01c5('0x22')]();})[_0x01c5('0x21')](function(){_0x7a3a52[_0x01c5('0x19')](0xcc)['end']();})['catch'](handleError(_0x7a3a52,null));};function getBucketslist(_0x4ca7b9,_0x309cab,_0x12cb70){return new Promise(function(_0x3a7a15,_0x4ec178){var _0x1516e1=new AWS['S3']({'accessKeyId':_0x309cab,'secretAccessKey':_0x4ca7b9,'region':_0x12cb70});_0x1516e1[_0x01c5('0x66')]({},function(_0x4e6cf4,_0x5e269c){if(_0x4e6cf4){return _0x4ec178(_0x4e6cf4);}else{return _0x3a7a15(_0x5e269c);}});});}function createBucket(_0x2f5a27,_0x54a647,_0x28068c,_0x47f359){return new Promise(function(_0x1dc97c,_0x364e62){var _0x2b41ca=new AWS['S3']({'accessKeyId':_0x54a647,'secretAccessKey':_0x2f5a27,'region':_0x28068c});_0x2b41ca['createBucket']({'Bucket':_0x47f359},function(_0x1d0ff4,_0x95f6cb){if(_0x1d0ff4){return _0x364e62(_0x1d0ff4);}else{return _0x1dc97c(_0x95f6cb);}});});}function uploadFile(_0x552e2d,_0x10fb40,_0x12f5cb,_0x521a95,_0x502636,_0x5f072f){return new Promise(function(_0x2c5760,_0x3132d9){var _0x2479be=new AWS['S3']({'accessKeyId':_0x10fb40,'secretAccessKey':_0x552e2d,'region':_0x12f5cb});_0x2479be['upload']({'Bucket':_0x521a95,'Key':_0x502636,'Body':_0x5f072f},function(_0x4f578f,_0x3d34ed){if(_0x4f578f){return _0x3132d9(_0x4f578f);}else{return _0x2c5760(_0x3d34ed);}});});}function startTranscribe(_0x4b1dc3,_0x1796b2,_0x1fc959,_0x1d04f1,_0x15e2c5,_0x5b52c8){return new Promise(function(_0x34b279,_0x4dddd3){var _0x1ce209=new AWS[(_0x01c5('0x67'))]({'accessKeyId':_0x1796b2,'secretAccessKey':_0x4b1dc3,'region':_0x1fc959});_0x1ce209[_0x01c5('0x68')]({'TranscriptionJobName':_0x1d04f1,'LanguageCode':_0x15e2c5,'Media':{'MediaFileUri':_0x5b52c8}},function(_0x2bf407,_0x1a4857){if(_0x2bf407){return _0x4dddd3(_0x2bf407);}else{return _0x34b279(_0x1a4857);}});});}function transcribe(_0x4e34ec,_0x18c78d,_0x2a781c,_0x19904c,_0x275c48,_0x56b42a,_0xe42f98){return new Promise(function(_0x55ddc6,_0x333314){var _0x4b5045={};logger[_0x01c5('0x61')](util[_0x01c5('0x4a')](_0x01c5('0x69'),_0x4e34ec,_0x275c48));return uploadFile(_0x18c78d,_0x2a781c,_0x19904c,_0x275c48,path[_0x01c5('0x6a')](_0x56b42a),fs[_0x01c5('0x6b')](_0x56b42a))[_0x01c5('0x21')](function(_0x3f4cc2){logger['info'](util[_0x01c5('0x4a')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4e34ec,_0x275c48,_0x3f4cc2['Location']));_0x4b5045[_0x01c5('0x6c')]=_0x3f4cc2['Bucket'];_0x4b5045[_0x01c5('0x6d')]=_0x3f4cc2['Location'];logger['info'](util[_0x01c5('0x4a')](_0x01c5('0x6e'),_0x4e34ec));return startTranscribe(_0x18c78d,_0x2a781c,_0x19904c,uuidv4(),_0xe42f98,_0x3f4cc2['Location']);})[_0x01c5('0x21')](function(_0x468862){logger[_0x01c5('0x61')](util['format'](_0x01c5('0x6f'),_0x4e34ec,_0x468862[_0x01c5('0x70')][_0x01c5('0x71')]));_0x4b5045['transcribeName']=_0x468862[_0x01c5('0x70')][_0x01c5('0x71')];_0x4b5045['transcribeStatus']=_0x468862[_0x01c5('0x70')]['TranscriptionJobStatus'];return _0x55ddc6(_0x4b5045);})[_0x01c5('0x42')](function(_0x37af2d){return _0x333314(_0x37af2d);});});}exports[_0x01c5('0x72')]=function(_0x1f2bad,_0x301553,_0x3ef7d1){var _0x68ba99;var _0x98198f;var _0x454a83;var _0x3681c8=require(_0x01c5('0x47'));return db[_0x01c5('0x27')]['findOne']({'where':{'id':_0x1f2bad[_0x01c5('0x40')]['id']}})[_0x01c5('0x21')](function(_0x33e0e4){if(_0x33e0e4){var _0x25b4c8=util[_0x01c5('0x4a')](_0x01c5('0x4b'),_0x33e0e4[_0x01c5('0x49')]);if(fs[_0x01c5('0x4c')](_0x25b4c8)){cypher=!![];return _0x3681c8['decryptFile'](_0x25b4c8,_0x33e0e4[_0x01c5('0x49')],config[_0x01c5('0x4e')][_0x01c5('0x4f')])[_0x01c5('0x21')](function(){return _0x33e0e4;});}return _0x33e0e4;}})['then'](function(_0x2d7480){if(!_0x2d7480){throw new db[(_0x01c5('0x50'))][(_0x01c5('0x51'))](_0x01c5('0x73'));}_0x98198f=_0x2d7480;return db['Setting'][_0x01c5('0x74')]({'where':{'id':0x1}});})[_0x01c5('0x21')](handleEntityNotFound(_0x301553,null))[_0x01c5('0x21')](function(_0x313e3a){if(_0x313e3a){_0x68ba99=_0x313e3a;if(!_0x68ba99[_0x01c5('0x75')]||!_0x68ba99['transcribeAccountId']||!_0x68ba99[_0x01c5('0x76')]||!_0x68ba99[_0x01c5('0x77')]||!_0x68ba99[_0x01c5('0x6c')]){throw new db['Sequelize'][(_0x01c5('0x51'))](_0x01c5('0x78'));}if(_0x1f2bad[_0x01c5('0x44')]['runSentiment']&&(!_0x68ba99[_0x01c5('0x79')]||!_0x68ba99[_0x01c5('0x7a')]||!_0x68ba99[_0x01c5('0x7b')]||!_0x68ba99[_0x01c5('0x77')]||!_0x68ba99[_0x01c5('0x6c')])){throw new db[(_0x01c5('0x50'))][(_0x01c5('0x51'))](_0x01c5('0x7c'));}return db[_0x01c5('0x7d')][_0x01c5('0x74')]({'where':{'id':_0x68ba99['transcribeAccountId']}});}})[_0x01c5('0x21')](function(_0x53ae6b){if(!_0x53ae6b){throw new db[(_0x01c5('0x50'))][(_0x01c5('0x51'))](_0x01c5('0x7e'));}if(!_0x53ae6b[_0x01c5('0x7f')]||!_0x53ae6b['data2']){throw new db[(_0x01c5('0x50'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x454a83=_0x53ae6b;return getBucketslist(_0x454a83[_0x01c5('0x7f')],_0x454a83[_0x01c5('0x80')],_0x68ba99[_0x01c5('0x76')]);})['then'](function(_0x1eafca){if(_0x1eafca&&_0x1eafca[_0x01c5('0x81')]){var _0x1b91ad=_['find'](_0x1eafca[_0x01c5('0x81')],function(_0x431af2){return _0x431af2[_0x01c5('0x82')]===_0x68ba99[_0x01c5('0x6c')];});if(!_0x1b91ad){logger[_0x01c5('0x61')](util[_0x01c5('0x4a')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1f2bad[_0x01c5('0x40')]['id'],_0x68ba99[_0x01c5('0x6c')]));return createBucket(_0x454a83[_0x01c5('0x7f')],_0x454a83['data2'],_0x68ba99[_0x01c5('0x76')],_0x68ba99[_0x01c5('0x6c')]);}logger['info'](util[_0x01c5('0x4a')](_0x01c5('0x83'),_0x1f2bad['params']['id'],_0x68ba99[_0x01c5('0x6c')]));return;}})[_0x01c5('0x21')](function(_0x387158){if(_0x98198f[_0x01c5('0x84')]===_0x01c5('0x85')){return transcribe(_0x1f2bad['params']['id'],_0x454a83[_0x01c5('0x7f')],_0x454a83[_0x01c5('0x80')],_0x68ba99[_0x01c5('0x76')],_0x68ba99[_0x01c5('0x6c')],_0x98198f['value'],_0x68ba99[_0x01c5('0x77')]);}else{logger[_0x01c5('0x61')](util[_0x01c5('0x4a')](_0x01c5('0x86'),_0x1f2bad[_0x01c5('0x40')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x01c5('0x21')](function(_0x2d8218){if(_0x2d8218){_0x2d8218[_0x01c5('0x87')]=_0x1f2bad[_0x01c5('0x44')][_0x01c5('0x88')];return _0x98198f['updateAttributes'](_0x2d8218);}})['then'](respondWithResult(_0x301553,null))[_0x01c5('0x42')](handleError(_0x301553,null));};function writeFile(_0x3ba026,_0x2ada49){return new Promise(function(_0x583d9c,_0x26b563){fs[_0x01c5('0x89')](_0x2ada49,_0x3ba026,function(_0x1a919c,_0x27c6d2){if(_0x1a919c){return _0x26b563(_0x1a919c);}else{return _0x583d9c(_0x27c6d2);}});});}exports[_0x01c5('0x8a')]=function(_0xa74a6f,_0x2e7162,_0xde338a){return db[_0x01c5('0x27')]['findOne']({'where':{'id':_0xa74a6f[_0x01c5('0x40')]['id']}})[_0x01c5('0x21')](handleEntityNotFound(_0x2e7162))['then'](function(_0x1f1535){if(_0x1f1535&&_0x1f1535['fileText']){var _0x3baa6a=_0x1f1535[_0x01c5('0x8b')];var _0x39cc89=config[_0x01c5('0x8c')]+_0x01c5('0x8d')+_0x1f1535['id']+_0x01c5('0x8e');if(fs[_0x01c5('0x4c')](_0x39cc89)){return _0x39cc89;}return writeFile(_0x3baa6a,_0x39cc89)['then'](function(){return _0x39cc89;});}else{throw new db[(_0x01c5('0x50'))][(_0x01c5('0x51'))](_0x01c5('0x8f'));}})[_0x01c5('0x21')](function(_0x89629e){return _0x2e7162[_0x01c5('0x46')](_0x89629e);})[_0x01c5('0x42')](handleError(_0x2e7162));}; \ No newline at end of file +var _0x8270=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','include','rows','catch','params','find','create','body','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','secrets','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','MD5','col','token','$and','push','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','transcribeRegion','NEW','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','filters'];(function(_0x3b6112,_0x31a6f3){var _0x263088=function(_0x447239){while(--_0x447239){_0x3b6112['push'](_0x3b6112['shift']());}};_0x263088(++_0x31a6f3);}(_0x8270,0xf6));var _0x0827=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x8270[_0xd67723];return _0x53b62b;};'use strict';var emlformat=require(_0x0827('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0827('0x1'));var jsonpatch=require(_0x0827('0x2'));var rp=require('request-promise');var moment=require(_0x0827('0x3'));var BPromise=require(_0x0827('0x4'));var Mustache=require(_0x0827('0x5'));var util=require(_0x0827('0x6'));var path=require('path');var sox=require(_0x0827('0x7'));var csv=require(_0x0827('0x8'));var ejs=require(_0x0827('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0827('0xa'));var jsforce=require(_0x0827('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0827('0x8'));var querystring=require(_0x0827('0xc'));var Papa=require(_0x0827('0xd'));var AWS=require(_0x0827('0xe'));var uuidv4=require(_0x0827('0xf'));var Redis=require(_0x0827('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0827('0x11'));var hardwareService=require(_0x0827('0x12'));var logger=require(_0x0827('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0827('0x14'));var licenseUtil=require(_0x0827('0x15'));var db=require(_0x0827('0x16'))['db'];function respondWithStatusCode(_0x18fa32,_0x3501c0){_0x3501c0=_0x3501c0||0xcc;return function(_0x2fd45c){if(_0x2fd45c){return _0x18fa32[_0x0827('0x17')](_0x3501c0);}return _0x18fa32[_0x0827('0x18')](_0x3501c0)[_0x0827('0x19')]();};}function respondWithResult(_0x437306,_0x2d2718){_0x2d2718=_0x2d2718||0xc8;return function(_0x2686e7){if(_0x2686e7){return _0x437306[_0x0827('0x18')](_0x2d2718)[_0x0827('0x1a')](_0x2686e7);}};}function respondWithFilteredResult(_0x25756c,_0x49641c){return function(_0x48895d){if(_0x48895d){var _0x4c071b=typeof _0x49641c[_0x0827('0x1b')]==='undefined'&&typeof _0x49641c[_0x0827('0x1c')]===_0x0827('0x1d');var _0x2974e3=_0x48895d[_0x0827('0x1e')];var _0x37d89f=_0x4c071b?0x0:_0x49641c['offset'];var _0x13b435=_0x4c071b?_0x48895d[_0x0827('0x1e')]:_0x49641c[_0x0827('0x1b')]+_0x49641c[_0x0827('0x1c')];var _0x32e17d;if(_0x13b435>=_0x2974e3){_0x13b435=_0x2974e3;_0x32e17d=0xc8;}else{_0x32e17d=0xce;}_0x25756c['status'](_0x32e17d);return _0x25756c[_0x0827('0x1f')](_0x0827('0x20'),_0x37d89f+'-'+_0x13b435+'/'+_0x2974e3)[_0x0827('0x1a')](_0x48895d);}return null;};}function patchUpdates(_0xb5c362){return function(_0x30a036){try{jsonpatch[_0x0827('0x21')](_0x30a036,_0xb5c362,!![]);}catch(_0x154fcd){return BPromise[_0x0827('0x22')](_0x154fcd);}return _0x30a036[_0x0827('0x23')]();};}function saveUpdates(_0x25f5ab,_0xa0955e){return function(_0x484b0c){if(_0x484b0c){return _0x484b0c[_0x0827('0x24')](_0x25f5ab)[_0x0827('0x25')](function(_0x42e3bd){return _0x42e3bd;});}return null;};}function removeEntity(_0x33f00f,_0x4800ec){return function(_0x3e7636){if(_0x3e7636){return _0x3e7636[_0x0827('0x26')]()[_0x0827('0x25')](function(){_0x33f00f[_0x0827('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19145e,_0xf0d6b0){return function(_0x5af0c3){if(!_0x5af0c3){_0x19145e[_0x0827('0x17')](0x194);}return _0x5af0c3;};}function handleError(_0x291620,_0x5cab0f){_0x5cab0f=_0x5cab0f||0x1f4;return function(_0x13e410){logger[_0x0827('0x27')](_0x13e410[_0x0827('0x28')]);if(_0x13e410['name']){delete _0x13e410[_0x0827('0x29')];}_0x291620[_0x0827('0x18')](_0x5cab0f)[_0x0827('0x2a')](_0x13e410);};}exports['index']=function(_0x22c78e,_0x1a8dd7){var _0x46dbd8={},_0x5cd860={},_0xe62976={'count':0x0,'rows':[]};var _0x4408bf=_['map'](db['VoiceRecording'][_0x0827('0x2b')],function(_0x3841d4){return{'name':_0x3841d4[_0x0827('0x2c')],'type':_0x3841d4[_0x0827('0x2d')][_0x0827('0x2e')]};});_0x5cd860[_0x0827('0x2f')]=_[_0x0827('0x30')](_[_0x0827('0x31')](_0x4408bf,'name'),[_0x0827('0x32')]);_0x5cd860[_0x0827('0x33')]=_[_0x0827('0x34')](_0x22c78e[_0x0827('0x33')]);_0x5cd860[_0x0827('0x35')]=_[_0x0827('0x36')](_0x5cd860[_0x0827('0x2f')],_0x5cd860[_0x0827('0x33')]);_0x46dbd8[_0x0827('0x37')]=_[_0x0827('0x36')](_0x5cd860[_0x0827('0x2f')],qs[_0x0827('0x38')](_0x22c78e[_0x0827('0x33')][_0x0827('0x38')]));_0x46dbd8['attributes']=_0x46dbd8[_0x0827('0x37')][_0x0827('0x39')]?_0x46dbd8[_0x0827('0x37')]:_0x5cd860[_0x0827('0x2f')];if(!_0x22c78e[_0x0827('0x33')][_0x0827('0x3a')](_0x0827('0x3b'))){_0x46dbd8['limit']=qs[_0x0827('0x1c')](_0x22c78e[_0x0827('0x33')][_0x0827('0x1c')]);_0x46dbd8['offset']=qs[_0x0827('0x1b')](_0x22c78e[_0x0827('0x33')][_0x0827('0x1b')]);}_0x46dbd8['order']=qs[_0x0827('0x3c')](_0x22c78e[_0x0827('0x33')][_0x0827('0x3c')]);_0x46dbd8[_0x0827('0x3d')]=qs[_0x0827('0x35')](_[_0x0827('0x3e')](_0x22c78e[_0x0827('0x33')],_0x5cd860[_0x0827('0x35')]),_0x4408bf);if(_0x22c78e[_0x0827('0x33')][_0x0827('0x3f')]){_0x46dbd8['where']=_[_0x0827('0x40')](_0x46dbd8[_0x0827('0x3d')],{'$or':_[_0x0827('0x31')](_0x4408bf,function(_0xa01a45){if(_0xa01a45['type']!==_0x0827('0x41')){var _0x5b76e8={};_0x5b76e8[_0xa01a45['name']]={'$like':'%'+_0x22c78e['query'][_0x0827('0x3f')]+'%'};return _0x5b76e8;}})});}_0x46dbd8=_[_0x0827('0x40')]({},_0x46dbd8,_0x22c78e[_0x0827('0x42')]);var _0x2eedae={'where':_0x46dbd8[_0x0827('0x3d')]};return db[_0x0827('0x43')][_0x0827('0x1e')](_0x2eedae)[_0x0827('0x25')](function(_0x4ac59e){_0xe62976['count']=_0x4ac59e;if(_0x22c78e[_0x0827('0x33')][_0x0827('0x44')]){_0x46dbd8[_0x0827('0x45')]=[{'all':!![]}];}return db[_0x0827('0x43')]['findAll'](_0x46dbd8);})[_0x0827('0x25')](function(_0x24207e){_0xe62976[_0x0827('0x46')]=_0x24207e;return _0xe62976;})[_0x0827('0x25')](respondWithFilteredResult(_0x1a8dd7,_0x46dbd8))[_0x0827('0x47')](handleError(_0x1a8dd7,null));};exports['show']=function(_0x2fdd5b,_0x3ce0a5){var _0x58ec15={'raw':![],'where':{'id':_0x2fdd5b[_0x0827('0x48')]['id']}},_0x3df9f0={};_0x3df9f0[_0x0827('0x2f')]=_['keys'](db[_0x0827('0x43')][_0x0827('0x2b')]);_0x3df9f0[_0x0827('0x33')]=_[_0x0827('0x34')](_0x2fdd5b[_0x0827('0x33')]);_0x3df9f0['filters']=_[_0x0827('0x36')](_0x3df9f0['model'],_0x3df9f0[_0x0827('0x33')]);_0x58ec15[_0x0827('0x37')]=_[_0x0827('0x36')](_0x3df9f0[_0x0827('0x2f')],qs[_0x0827('0x38')](_0x2fdd5b[_0x0827('0x33')]['fields']));_0x58ec15['attributes']=_0x58ec15[_0x0827('0x37')][_0x0827('0x39')]?_0x58ec15[_0x0827('0x37')]:_0x3df9f0[_0x0827('0x2f')];if(_0x2fdd5b[_0x0827('0x33')][_0x0827('0x44')]){_0x58ec15['include']=[{'all':!![]}];}_0x58ec15=_[_0x0827('0x40')]({},_0x58ec15,_0x2fdd5b['options']);return db[_0x0827('0x43')][_0x0827('0x49')](_0x58ec15)[_0x0827('0x25')](handleEntityNotFound(_0x3ce0a5,null))[_0x0827('0x25')](respondWithResult(_0x3ce0a5,null))[_0x0827('0x47')](handleError(_0x3ce0a5,null));};exports['create']=function(_0xd23e90,_0x1784f2){return db[_0x0827('0x43')][_0x0827('0x4a')](_0xd23e90[_0x0827('0x4b')],{})[_0x0827('0x25')](respondWithResult(_0x1784f2,0xc9))[_0x0827('0x47')](handleError(_0x1784f2,null));};exports[_0x0827('0x24')]=function(_0x4547a4,_0x55e2b2){if(_0x4547a4[_0x0827('0x4b')]['id']){delete _0x4547a4['body']['id'];}return db[_0x0827('0x43')]['find']({'where':{'id':_0x4547a4[_0x0827('0x48')]['id']}})['then'](handleEntityNotFound(_0x55e2b2,null))[_0x0827('0x25')](saveUpdates(_0x4547a4[_0x0827('0x4b')],null))[_0x0827('0x25')](respondWithResult(_0x55e2b2,null))[_0x0827('0x47')](handleError(_0x55e2b2,null));};exports[_0x0827('0x4c')]=function(_0x29ade2,_0x23ee0e){return db[_0x0827('0x43')][_0x0827('0x4c')]()[_0x0827('0x25')](respondWithResult(_0x23ee0e,null))[_0x0827('0x47')](handleError(_0x23ee0e,null));};exports[_0x0827('0x4d')]=function(_0x45b87b,_0x30cfff,_0x47f0ab){var _0xc0475=require(_0x0827('0x4e'));var _0x457e3d=![];var _0x442260={};if(_0x45b87b[_0x0827('0x33')][_0x0827('0x2d')]&&_0x45b87b[_0x0827('0x33')]['type']===_0x0827('0x4f')){_0x442260[_0x0827('0x4f')]=_0x45b87b[_0x0827('0x48')]['id'];}else{_0x442260['id']=_0x45b87b[_0x0827('0x48')]['id'];}return db[_0x0827('0x43')][_0x0827('0x49')]({'where':_0x442260,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x30cfff,null))[_0x0827('0x25')](function(_0x12def5){if(_0x12def5){var _0x37e933=_0x12def5['value'];var _0x18f3ad=util[_0x0827('0x32')](_0x0827('0x50'),_0x37e933);if(fs[_0x0827('0x51')](_0x18f3ad)){_0x457e3d=!![];return _0xc0475[_0x0827('0x52')](_0x18f3ad,_0x37e933,config[_0x0827('0x53')][_0x0827('0x54')])[_0x0827('0x25')](function(){return _0x12def5;});}return _0x12def5;}})[_0x0827('0x25')](function(_0x23c40f){if(_0x23c40f){var _0x4bf688=_0x23c40f[_0x0827('0x55')];if(!fs[_0x0827('0x51')](_0x4bf688)){throw new db[(_0x0827('0x56'))][(_0x0827('0x57'))](_0x0827('0x58'));}if(_0x23c40f[_0x0827('0x59')]){return _0x30cfff[_0x0827('0x4d')](_0x4bf688,_0x23c40f['filename']+path[_0x0827('0x5a')](_0x4bf688),function(){if(_0x457e3d){fs[_0x0827('0x5b')](_0x4bf688);}});}else{return _0x30cfff['download'](_0x4bf688,function(_0x175259){if(_0x457e3d){fs[_0x0827('0x5b')](_0x4bf688);}});}}})[_0x0827('0x47')](function(_0x1c4bc0){if(_0x1c4bc0['message']==='VoiceRecording\x20not\x20found'){_0x30cfff[_0x0827('0x18')](0x194)[_0x0827('0x2a')]('Not\x20found');}else{return handleError(_0x30cfff,null);}});};exports[_0x0827('0x5c')]=function(_0x2fa575,_0x339f4e,_0x2a1e8f){var _0x55cc4f=require(_0x0827('0x4e'));var _0x26b774=![];var _0x14ddca={'$and':[db[_0x0827('0x5d')]['where'](db[_0x0827('0x5d')]['fn'](_0x0827('0x5e'),db[_0x0827('0x5d')][_0x0827('0x5f')]('uniqueid')),_0x2fa575[_0x0827('0x33')][_0x0827('0x60')])]};if(_0x2fa575[_0x0827('0x33')]['type']&&_0x2fa575[_0x0827('0x33')][_0x0827('0x2d')]===_0x0827('0x4f')){_0x14ddca[_0x0827('0x61')][_0x0827('0x62')]({'uniqueid':_0x2fa575[_0x0827('0x48')]['id']});}else{_0x14ddca['$and'][_0x0827('0x62')]({'id':_0x2fa575['params']['id']});}return db[_0x0827('0x43')]['find']({'where':_0x14ddca,'attributes':['id',_0x0827('0x55')],'raw':!![]})[_0x0827('0x25')](handleEntityNotFound(_0x339f4e,null))[_0x0827('0x25')](function(_0x5441d0){if(_0x5441d0){var _0xeba9cc=util[_0x0827('0x32')]('%s.cypher',_0x5441d0[_0x0827('0x55')]);if(fs[_0x0827('0x51')](_0xeba9cc)){_0x26b774=!![];return _0x55cc4f[_0x0827('0x52')](_0xeba9cc,_0x5441d0['value'],config[_0x0827('0x53')][_0x0827('0x54')])[_0x0827('0x25')](function(){return _0x5441d0;});}return _0x5441d0;}})[_0x0827('0x25')](function(_0x12501a){if(_0x12501a){if(!fs[_0x0827('0x51')](_0x12501a[_0x0827('0x55')])){throw new db[(_0x0827('0x56'))][(_0x0827('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x12501a['filename']){return _0x339f4e[_0x0827('0x4d')](_0x12501a[_0x0827('0x55')],_0x12501a[_0x0827('0x59')]+path[_0x0827('0x5a')](_0x12501a[_0x0827('0x55')]),function(){if(_0x26b774){fs['unlink'](_0x12501a[_0x0827('0x55')]);}});}else{return _0x339f4e['download'](_0x12501a[_0x0827('0x55')],function(_0x4b0c49){if(_0x26b774){fs[_0x0827('0x5b')](_0x12501a['value']);}});}}})[_0x0827('0x47')](handleError(_0x339f4e,null));};exports[_0x0827('0x26')]=function(_0x146afc,_0x13bd13){return db[_0x0827('0x43')][_0x0827('0x49')]({'where':{'id':_0x146afc[_0x0827('0x48')]['id']}})[_0x0827('0x25')](function(_0x477beb){if(_[_0x0827('0x63')](_0x477beb)){throw new ReferenceError(_0x0827('0x64'));}return _0x477beb;})[_0x0827('0x25')](function(_0x12759a){var _0x5493ff=_0x12759a[_0x0827('0x55')];logger['info'](_0x0827('0x65'),_0x5493ff);if(!_[_0x0827('0x63')](_0x12759a[_0x0827('0x55')])&&fs['existsSync'](_0x5493ff)){logger[_0x0827('0x66')](_0x0827('0x67')+_0x5493ff+_0x0827('0x68'));fs['unlinkSync'](_0x5493ff);}_0x5493ff=_0x5493ff+_0x0827('0x69');if(!_[_0x0827('0x63')](_0x12759a[_0x0827('0x55')])&&fs['existsSync'](_0x5493ff)){logger[_0x0827('0x66')]('File:\x20\x22'+_0x5493ff+_0x0827('0x68'));fs[_0x0827('0x6a')](_0x5493ff);}return _0x12759a;})[_0x0827('0x25')](function(_0x50c920){if(!_0x50c920)throw new InternalError();return _0x50c920[_0x0827('0x26')]();})[_0x0827('0x25')](function(){_0x13bd13[_0x0827('0x18')](0xcc)['end']();})[_0x0827('0x47')](handleError(_0x13bd13,null));};function getBucketslist(_0x3a44c0,_0x364aeb,_0x1e9b68){return new Promise(function(_0xe12892,_0x3dc5fd){var _0x3c07c1=new AWS['S3']({'accessKeyId':_0x364aeb,'secretAccessKey':_0x3a44c0,'region':_0x1e9b68});_0x3c07c1[_0x0827('0x6b')]({},function(_0x130f76,_0x4388f8){if(_0x130f76){return _0x3dc5fd(_0x130f76);}else{return _0xe12892(_0x4388f8);}});});}function createBucket(_0x4892a0,_0x109932,_0x7e0164,_0x2db3a8){return new Promise(function(_0x2c29c1,_0x4232a9){var _0x56b194=new AWS['S3']({'accessKeyId':_0x109932,'secretAccessKey':_0x4892a0,'region':_0x7e0164});_0x56b194[_0x0827('0x6c')]({'Bucket':_0x2db3a8},function(_0x43e8d6,_0x566c5b){if(_0x43e8d6){return _0x4232a9(_0x43e8d6);}else{return _0x2c29c1(_0x566c5b);}});});}function uploadFile(_0x2ea4e3,_0x868fbb,_0x4f7e31,_0x546b67,_0x193739,_0x38fea6){return new Promise(function(_0x4165e4,_0x556c71){var _0x1bd94c=new AWS['S3']({'accessKeyId':_0x868fbb,'secretAccessKey':_0x2ea4e3,'region':_0x4f7e31});_0x1bd94c[_0x0827('0x6d')]({'Bucket':_0x546b67,'Key':_0x193739,'Body':_0x38fea6},function(_0x3bc1f5,_0x404b31){if(_0x3bc1f5){return _0x556c71(_0x3bc1f5);}else{return _0x4165e4(_0x404b31);}});});}function startTranscribe(_0x24b1e4,_0x15beea,_0x569e05,_0xaa0b51,_0x4a1532,_0x51423b){return new Promise(function(_0x257486,_0x4c1ebe){var _0x4535e8=new AWS['TranscribeService']({'accessKeyId':_0x15beea,'secretAccessKey':_0x24b1e4,'region':_0x569e05});_0x4535e8[_0x0827('0x6e')]({'TranscriptionJobName':_0xaa0b51,'LanguageCode':_0x4a1532,'Media':{'MediaFileUri':_0x51423b}},function(_0x5bd135,_0x42bd35){if(_0x5bd135){return _0x4c1ebe(_0x5bd135);}else{return _0x257486(_0x42bd35);}});});}function transcribe(_0x69375f,_0x206f88,_0x6e8b58,_0x59fbb7,_0x11e195,_0x9d781b,_0x43ef38){return new Promise(function(_0x4626b3,_0x290a1f){var _0x26a1ea={};logger[_0x0827('0x66')](util[_0x0827('0x32')](_0x0827('0x6f'),_0x69375f,_0x11e195));return uploadFile(_0x206f88,_0x6e8b58,_0x59fbb7,_0x11e195,path[_0x0827('0x70')](_0x9d781b),fs[_0x0827('0x71')](_0x9d781b))['then'](function(_0x5094e5){logger[_0x0827('0x66')](util[_0x0827('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x69375f,_0x11e195,_0x5094e5['Location']));_0x26a1ea[_0x0827('0x72')]=_0x5094e5[_0x0827('0x73')];_0x26a1ea[_0x0827('0x74')]=_0x5094e5[_0x0827('0x75')];logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x69375f));return startTranscribe(_0x206f88,_0x6e8b58,_0x59fbb7,uuidv4(),_0x43ef38,_0x5094e5['Location']);})[_0x0827('0x25')](function(_0x6f6109){logger[_0x0827('0x66')](util[_0x0827('0x32')](_0x0827('0x76'),_0x69375f,_0x6f6109[_0x0827('0x77')][_0x0827('0x78')]));_0x26a1ea['transcribeName']=_0x6f6109[_0x0827('0x77')][_0x0827('0x78')];_0x26a1ea[_0x0827('0x79')]=_0x6f6109['TranscriptionJob'][_0x0827('0x7a')];return _0x4626b3(_0x26a1ea);})[_0x0827('0x47')](function(_0x41ed3f){return _0x290a1f(_0x41ed3f);});});}exports['runTranscribe']=function(_0x1f63b0,_0xae4cef,_0xfbcfe1){var _0x47991f;var _0x360e12;var _0x370c71;var _0x1ff441=require(_0x0827('0x4e'));return db['VoiceRecording'][_0x0827('0x7b')]({'where':{'id':_0x1f63b0[_0x0827('0x48')]['id']}})[_0x0827('0x25')](function(_0x2e1304){if(_0x2e1304){var _0x2356a5=util[_0x0827('0x32')]('%s.cypher',_0x2e1304[_0x0827('0x55')]);if(fs[_0x0827('0x51')](_0x2356a5)){cypher=!![];return _0x1ff441['decryptFile'](_0x2356a5,_0x2e1304[_0x0827('0x55')],config[_0x0827('0x53')][_0x0827('0x54')])[_0x0827('0x25')](function(){return _0x2e1304;});}return _0x2e1304;}})[_0x0827('0x25')](function(_0x4b6ab5){if(!_0x4b6ab5){throw new db[(_0x0827('0x56'))][(_0x0827('0x57'))]('Voice\x20Recording\x20not\x20found');}_0x360e12=_0x4b6ab5;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xae4cef,null))[_0x0827('0x25')](function(_0x57d832){if(_0x57d832){_0x47991f=_0x57d832;if(!_0x47991f[_0x0827('0x7c')]||!_0x47991f[_0x0827('0x7d')]||!_0x47991f['transcribeRegion']||!_0x47991f[_0x0827('0x7e')]||!_0x47991f[_0x0827('0x72')]){throw new db[(_0x0827('0x56'))][(_0x0827('0x57'))](_0x0827('0x7f'));}if(_0x1f63b0[_0x0827('0x4b')]['runSentiment']&&(!_0x47991f[_0x0827('0x80')]||!_0x47991f[_0x0827('0x81')]||!_0x47991f[_0x0827('0x82')]||!_0x47991f[_0x0827('0x7e')]||!_0x47991f[_0x0827('0x72')])){throw new db[(_0x0827('0x56'))][(_0x0827('0x57'))](_0x0827('0x83'));}return db['CloudProvider'][_0x0827('0x7b')]({'where':{'id':_0x47991f[_0x0827('0x7d')]}});}})[_0x0827('0x25')](function(_0x2707d7){if(!_0x2707d7){throw new db[(_0x0827('0x56'))][(_0x0827('0x57'))](_0x0827('0x84'));}if(!_0x2707d7[_0x0827('0x85')]||!_0x2707d7[_0x0827('0x86')]){throw new db[(_0x0827('0x56'))][(_0x0827('0x57'))](_0x0827('0x87'));}_0x370c71=_0x2707d7;return getBucketslist(_0x370c71[_0x0827('0x85')],_0x370c71[_0x0827('0x86')],_0x47991f['transcribeRegion']);})[_0x0827('0x25')](function(_0x55b04e){if(_0x55b04e&&_0x55b04e[_0x0827('0x88')]){var _0x4201ca=_[_0x0827('0x49')](_0x55b04e['Buckets'],function(_0x441dad){return _0x441dad[_0x0827('0x89')]===_0x47991f['bucket'];});if(!_0x4201ca){logger[_0x0827('0x66')](util[_0x0827('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1f63b0[_0x0827('0x48')]['id'],_0x47991f[_0x0827('0x72')]));return createBucket(_0x370c71['data1'],_0x370c71[_0x0827('0x86')],_0x47991f[_0x0827('0x8a')],_0x47991f['bucket']);}logger[_0x0827('0x66')](util[_0x0827('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1f63b0[_0x0827('0x48')]['id'],_0x47991f[_0x0827('0x72')]));return;}})[_0x0827('0x25')](function(_0x544197){if(_0x360e12[_0x0827('0x79')]===_0x0827('0x8b')){return transcribe(_0x1f63b0[_0x0827('0x48')]['id'],_0x370c71['data1'],_0x370c71['data2'],_0x47991f['transcribeRegion'],_0x47991f['bucket'],_0x360e12[_0x0827('0x55')],_0x47991f[_0x0827('0x7e')]);}else{logger[_0x0827('0x66')](util[_0x0827('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1f63b0['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x2ace97){if(_0x2ace97){_0x2ace97[_0x0827('0x8c')]=_0x1f63b0['body'][_0x0827('0x8d')];return _0x360e12[_0x0827('0x8e')](_0x2ace97);}})[_0x0827('0x25')](respondWithResult(_0xae4cef,null))[_0x0827('0x47')](handleError(_0xae4cef,null));};function writeFile(_0x40ee71,_0x2ab804){return new Promise(function(_0x5b98af,_0x183237){fs[_0x0827('0x8f')](_0x2ab804,_0x40ee71,function(_0x4a19bb,_0x2a4272){if(_0x4a19bb){return _0x183237(_0x4a19bb);}else{return _0x5b98af(_0x2a4272);}});});}exports[_0x0827('0x90')]=function(_0x8bb430,_0xf8de62,_0x26e0c0){return db[_0x0827('0x43')][_0x0827('0x7b')]({'where':{'id':_0x8bb430[_0x0827('0x48')]['id']}})[_0x0827('0x25')](handleEntityNotFound(_0xf8de62))[_0x0827('0x25')](function(_0x41f478){if(_0x41f478&&_0x41f478['fileText']){var _0x115e77=_0x41f478[_0x0827('0x91')];var _0x2e2933=config[_0x0827('0x92')]+_0x0827('0x93')+_0x41f478['id']+_0x0827('0x94');if(fs[_0x0827('0x51')](_0x2e2933)){return _0x2e2933;}return writeFile(_0x115e77,_0x2e2933)[_0x0827('0x25')](function(){return _0x2e2933;});}else{throw new db[(_0x0827('0x56'))][(_0x0827('0x57'))](_0x0827('0x95'));}})[_0x0827('0x25')](function(_0x42ffb6){return _0xf8de62['download'](_0x42ffb6);})[_0x0827('0x47')](handleError(_0xf8de62));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b7cc81a..899fc3d 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 _0x855d=['exports','VoiceRecording','voice_recordings','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x3add98,_0xa2b4){var _0x2838fc=function(_0x429220){while(--_0x429220){_0x3add98['push'](_0x3add98['shift']());}};_0x2838fc(++_0xa2b4);}(_0x855d,0x1d2));var _0xd855=function(_0x55b73b,_0x518518){_0x55b73b=_0x55b73b-0x0;var _0x2781e5=_0x855d[_0x55b73b];return _0x2781e5;};'use strict';var _=require(_0xd855('0x0'));var util=require(_0xd855('0x1'));var logger=require('../../config/logger')(_0xd855('0x2'));var moment=require(_0xd855('0x3'));var BPromise=require(_0xd855('0x4'));var rp=require(_0xd855('0x5'));var fs=require('fs');var path=require(_0xd855('0x6'));var rimraf=require(_0xd855('0x7'));var config=require(_0xd855('0x8'));var attributes=require(_0xd855('0x9'));module[_0xd855('0xa')]=function(_0x3c09d7,_0x27628e){return _0x3c09d7['define'](_0xd855('0xb'),attributes,{'tableName':_0xd855('0xc'),'paranoid':![],'indexes':[{'name':_0xd855('0xd'),'fields':[_0xd855('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3c2=['bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','api','moment'];(function(_0x248dc8,_0x10c027){var _0x15aaee=function(_0xa53979){while(--_0xa53979){_0x248dc8['push'](_0x248dc8['shift']());}};_0x15aaee(++_0x10c027);}(_0xc3c2,0x1bc));var _0x2c3c=function(_0x57e49c,_0x26556f){_0x57e49c=_0x57e49c-0x0;var _0x32fcbc=_0xc3c2[_0x57e49c];return _0x32fcbc;};'use strict';var _=require(_0x2c3c('0x0'));var util=require(_0x2c3c('0x1'));var logger=require('../../config/logger')(_0x2c3c('0x2'));var moment=require(_0x2c3c('0x3'));var BPromise=require(_0x2c3c('0x4'));var rp=require(_0x2c3c('0x5'));var fs=require('fs');var path=require(_0x2c3c('0x6'));var rimraf=require(_0x2c3c('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c3c('0x8'));module[_0x2c3c('0x9')]=function(_0x383a5b,_0x4a983c){return _0x383a5b[_0x2c3c('0xa')](_0x2c3c('0xb'),attributes,{'tableName':_0x2c3c('0xc'),'paranoid':![],'indexes':[{'name':_0x2c3c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 47b403e..a9896e9 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 _0x3a6d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','debug','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','body','value','%s.cypher','encryptFile','secrets','recording','unlink','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x6fd338,_0x5b2c72){var _0x6c7c6=function(_0x8d51e5){while(--_0x8d51e5){_0x6fd338['push'](_0x6fd338['shift']());}};_0x6c7c6(++_0x5b2c72);}(_0x3a6d,0x143));var _0xd3a6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x3a6d[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});}exports[_0xd3a6('0x16')]=function(_0x8d1286){var _0x32683f=this;return new Promise(function(_0xbe58b4,_0x22fb05){return db[_0xd3a6('0x17')][_0xd3a6('0x18')](_0x8d1286['body'],{'raw':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286['options'][_0xd3a6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'attributes':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')]['attributes']||null:null,'limit':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')]['limit']||null:null})['then'](function(_0x5846bc){logger['info']('UpdateVoiceRecording',_0x8d1286);logger[_0xd3a6('0x1c')](_0xd3a6('0x16'),_0x8d1286,JSON[_0xd3a6('0x12')](_0x5846bc));_0xbe58b4(_0x5846bc);})['catch'](function(_0x456541){logger['error'](_0xd3a6('0x16'),_0x456541[_0xd3a6('0x14')],_0x8d1286);_0x22fb05(_0x32683f[_0xd3a6('0x13')](0x1f4,_0x456541['message']));});});};exports[_0xd3a6('0x1d')]=function(_0x3bc8d1){var _0x1b09ac=this;return new Promise(function(_0x219e32,_0x169d11){var _0x3106f1=require('../../components/encryptor');var _0x30df90;return db[_0xd3a6('0x1e')][_0xd3a6('0x1f')]({'attributes':['id',_0xd3a6('0x20')],'where':{'id':0x1},'raw':!![]})[_0xd3a6('0xd')](function(_0x45c628){_0x30df90=_0x45c628;return db['VoiceRecording']['create'](_0x3bc8d1[_0xd3a6('0x21')]);})[_0xd3a6('0xd')](function(_0x35981c){if(_0x30df90[_0xd3a6('0x20')]&&fs['existsSync'](_0x35981c[_0xd3a6('0x22')])){var _0xa4efd=util['format'](_0xd3a6('0x23'),_0x35981c['value']);return _0x3106f1[_0xd3a6('0x24')](_0x35981c[_0xd3a6('0x22')],_0xa4efd,config[_0xd3a6('0x25')][_0xd3a6('0x26')])[_0xd3a6('0xd')](function(){fs[_0xd3a6('0x27')](_0x35981c[_0xd3a6('0x22')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x35981c;});}return _0x35981c;})[_0xd3a6('0xd')](function(_0x155640){logger[_0xd3a6('0xe')]('CreateVoiceRecording',_0x3bc8d1);logger[_0xd3a6('0x1c')](_0xd3a6('0x1d'),_0x3bc8d1,JSON[_0xd3a6('0x12')](_0x155640));_0x219e32(_0x155640);})[_0xd3a6('0x28')](function(_0x3ebd0d){logger[_0xd3a6('0x13')](_0xd3a6('0x1d'),_0x3ebd0d[_0xd3a6('0x14')],_0x3bc8d1);_0x169d11(_0x1b09ac['error'](0x1f4,_0x3ebd0d[_0xd3a6('0x14')]));});});}; \ No newline at end of file +var _0x160f=['../../config/environment','client','http','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','create','existsSync','format','%s.cypher','encryptFile','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e561f,_0x1b1660){var _0x4160ea=function(_0x1fa2ca){while(--_0x1fa2ca){_0x2e561f['push'](_0x2e561f['shift']());}};_0x4160ea(++_0x1b1660);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8185['options']?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1c')]||null:null,'attributes':_0x4b8185[_0xf160('0x1a')]?_0x4b8185['options'][_0xf160('0x1d')]||null:null,'limit':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1e')]||null:null})[_0xf160('0xc')](function(_0x1b0081){logger[_0xf160('0xd')]('UpdateVoiceRecording',_0x4b8185);logger[_0xf160('0x1f')](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x1b0081));_0x1cf6ba(_0x1b0081);})[_0xf160('0x15')](function(_0x578f7d){logger[_0xf160('0x12')](_0xf160('0x16'),_0x578f7d['message'],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x578f7d[_0xf160('0x14')]));});});};exports[_0xf160('0x20')]=function(_0x39c0e3){var _0x4c0c51=this;return new Promise(function(_0xcfa9bd,_0x73851f){var _0x2851e8=require(_0xf160('0x21'));var _0x135e0f;return db[_0xf160('0x22')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x26e7b9){_0x135e0f=_0x26e7b9;return db[_0xf160('0x17')][_0xf160('0x23')](_0x39c0e3[_0xf160('0x19')]);})[_0xf160('0xc')](function(_0x563103){if(_0x135e0f['callRecordingEncryption']&&fs[_0xf160('0x24')](_0x563103['value'])){var _0x4ce478=util[_0xf160('0x25')](_0xf160('0x26'),_0x563103['value']);return _0x2851e8[_0xf160('0x27')](_0x563103[_0xf160('0x28')],_0x4ce478,config['secrets']['recording'])['then'](function(){fs['unlink'](_0x563103[_0xf160('0x28')]);logger[_0xf160('0xd')](_0xf160('0x29'));return _0x563103;});}return _0x563103;})[_0xf160('0xc')](function(_0x16c528){logger[_0xf160('0xd')]('CreateVoiceRecording',_0x39c0e3);logger['debug']('CreateVoiceRecording',_0x39c0e3,JSON[_0xf160('0x11')](_0x16c528));_0xcfa9bd(_0x16c528);})['catch'](function(_0x5c65d2){logger[_0xf160('0x12')](_0xf160('0x20'),_0x5c65d2['message'],_0x39c0e3);_0x73851f(_0x4c0c51[_0xf160('0x12')](0x1f4,_0x5c65d2[_0xf160('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 386f668..48823fa 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 _0xae40=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/:id','post','create','update','exports','multer','util','path','connect-timeout','express'];(function(_0x381857,_0x203e5d){var _0x5775f6=function(_0x54dff3){while(--_0x54dff3){_0x381857['push'](_0x381857['shift']());}};_0x5775f6(++_0x203e5d);}(_0xae40,0x199));var _0x0ae4=function(_0x14f986,_0x59b787){_0x14f986=_0x14f986-0x0;var _0x3ea6a9=_0xae40[_0x14f986];return _0x3ea6a9;};'use strict';var multer=require(_0x0ae4('0x0'));var util=require(_0x0ae4('0x1'));var path=require(_0x0ae4('0x2'));var timeout=require(_0x0ae4('0x3'));var express=require(_0x0ae4('0x4'));var router=express[_0x0ae4('0x5')]();var fs_extra=require(_0x0ae4('0x6'));var auth=require(_0x0ae4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0ae4('0x8'));var controller=require(_0x0ae4('0x9'));router['get']('/',auth[_0x0ae4('0xa')](),controller[_0x0ae4('0xb')]);router[_0x0ae4('0xc')]('/describe',auth[_0x0ae4('0xa')](),controller['describe']);router[_0x0ae4('0xc')](_0x0ae4('0xd'),auth[_0x0ae4('0xa')](),controller['show']);router[_0x0ae4('0xe')]('/',auth[_0x0ae4('0xa')](),controller[_0x0ae4('0xf')]);router['put'](_0x0ae4('0xd'),auth[_0x0ae4('0xa')](),controller[_0x0ae4('0x10')]);router['delete'](_0x0ae4('0xd'),auth[_0x0ae4('0xa')](),controller['destroy']);module[_0x0ae4('0x11')]=router; \ No newline at end of file +var _0xa90b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','post','create','put','update','delete','/:id','destroy','exports','path','Router'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa90b,0x152));var _0xba90=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0xa90b[_0x479509];return _0x382da8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xba90('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xba90('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xba90('0x2'));var interaction=require(_0xba90('0x3'));var config=require(_0xba90('0x4'));var controller=require(_0xba90('0x5'));router[_0xba90('0x6')]('/',auth[_0xba90('0x7')](),controller['index']);router[_0xba90('0x6')]('/describe',auth[_0xba90('0x7')](),controller[_0xba90('0x8')]);router[_0xba90('0x6')]('/:id',auth[_0xba90('0x7')](),controller['show']);router[_0xba90('0x9')]('/',auth[_0xba90('0x7')](),controller[_0xba90('0xa')]);router[_0xba90('0xb')]('/:id',auth[_0xba90('0x7')](),controller[_0xba90('0xc')]);router[_0xba90('0xd')](_0xba90('0xe'),auth[_0xba90('0x7')](),controller[_0xba90('0xf')]);module[_0xba90('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 5117a44..0d6c917 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 _0xf72f=['moment','exports','ENUM','attended','STRING','sequelize'];(function(_0x39ded1,_0xaee436){var _0x2e248e=function(_0x193df3){while(--_0x193df3){_0x39ded1['push'](_0x39ded1['shift']());}};_0x2e248e(++_0xaee436);}(_0xf72f,0x1e5));var _0xff72=function(_0x8598ae,_0x1d6aa5){_0x8598ae=_0x8598ae-0x0;var _0x33b5b4=_0xf72f[_0x8598ae];return _0x33b5b4;};'use strict';var Sequelize=require(_0xff72('0x0'));var moment=require(_0xff72('0x1'));module[_0xff72('0x2')]={'type':{'type':Sequelize[_0xff72('0x3')]('blind',_0xff72('0x4'))},'result':{'type':Sequelize[_0xff72('0x5')]},'transfererchannel':{'type':Sequelize[_0xff72('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xff72('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xff72('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xff72('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xff72('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xff72('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xff72('0x5')]},'transfereechannel':{'type':Sequelize[_0xff72('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xff72('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xff72('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xff72('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xff72('0x5')]},'transfereecontext':{'type':Sequelize[_0xff72('0x5')]},'transfereeexten':{'type':Sequelize[_0xff72('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xff72('0x5')]},'extension':{'type':Sequelize[_0xff72('0x5')]}}; \ No newline at end of file +var _0x8248=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x449560,_0x4911ba){var _0x14e944=function(_0x9d9344){while(--_0x9d9344){_0x449560['push'](_0x449560['shift']());}};_0x14e944(++_0x4911ba);}(_0x8248,0x1e1));var _0x8824=function(_0x45d70b,_0x1c74b7){_0x45d70b=_0x45d70b-0x0;var _0x20e2d6=_0x8248[_0x45d70b];return _0x20e2d6;};'use strict';var Sequelize=require(_0x8824('0x0'));var moment=require(_0x8824('0x1'));module[_0x8824('0x2')]={'type':{'type':Sequelize[_0x8824('0x3')](_0x8824('0x4'),_0x8824('0x5'))},'result':{'type':Sequelize[_0x8824('0x6')]},'transfererchannel':{'type':Sequelize[_0x8824('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x8824('0x6')]},'transferercalleridname':{'type':Sequelize[_0x8824('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x8824('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x8824('0x6')]},'transfererexten':{'type':Sequelize[_0x8824('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x8824('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x8824('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x8824('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8824('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8824('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x8824('0x6')]},'transfereecontext':{'type':Sequelize[_0x8824('0x6')]},'transfereeexten':{'type':Sequelize[_0x8824('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x8824('0x6')]},'isexternal':{'type':Sequelize[_0x8824('0x3')](_0x8824('0x7'),'No')},'context':{'type':Sequelize[_0x8824('0x6')]},'extension':{'type':Sequelize[_0x8824('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f62ec56..90eaf6f 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 _0x339c=['error','stack','name','send','index','VoiceTransferReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','rawAttributes','find','catch','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','apply','reject','save','update','then','destroy'];(function(_0x52793e,_0x1e7bb4){var _0x5357bb=function(_0x44e880){while(--_0x44e880){_0x52793e['push'](_0x52793e['shift']());}};_0x5357bb(++_0x1e7bb4);}(_0x339c,0x101));var _0xc339=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x339c[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xc339('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc339('0x1'));var jsonpatch=require(_0xc339('0x2'));var rp=require(_0xc339('0x3'));var moment=require(_0xc339('0x4'));var BPromise=require(_0xc339('0x5'));var Mustache=require('mustache');var util=require(_0xc339('0x6'));var path=require(_0xc339('0x7'));var sox=require(_0xc339('0x8'));var csv=require(_0xc339('0x9'));var ejs=require(_0xc339('0xa'));var fs=require('fs');var fs_extra=require(_0xc339('0xb'));var _=require(_0xc339('0xc'));var squel=require(_0xc339('0xd'));var crypto=require('crypto');var jsforce=require(_0xc339('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc339('0x9'));var querystring=require(_0xc339('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc339('0x10'));var qs=require(_0xc339('0x11'));var as=require(_0xc339('0x12'));var hardwareService=require(_0xc339('0x13'));var logger=require(_0xc339('0x14'))(_0xc339('0x15'));var utils=require(_0xc339('0x16'));var config=require(_0xc339('0x17'));var licenseUtil=require(_0xc339('0x18'));var db=require(_0xc339('0x19'))['db'];function respondWithStatusCode(_0x589501,_0x5373ad){_0x5373ad=_0x5373ad||0xcc;return function(_0x375ed5){if(_0x375ed5){return _0x589501[_0xc339('0x1a')](_0x5373ad);}return _0x589501[_0xc339('0x1b')](_0x5373ad)[_0xc339('0x1c')]();};}function respondWithResult(_0x458343,_0x29f0fa){_0x29f0fa=_0x29f0fa||0xc8;return function(_0x49c6fc){if(_0x49c6fc){return _0x458343[_0xc339('0x1b')](_0x29f0fa)[_0xc339('0x1d')](_0x49c6fc);}};}function respondWithFilteredResult(_0x231960,_0xe1cf1e){return function(_0x496335){if(_0x496335){var _0x2e388c=typeof _0xe1cf1e[_0xc339('0x1e')]==='undefined'&&typeof _0xe1cf1e[_0xc339('0x1f')]==='undefined';var _0xd37877=_0x496335[_0xc339('0x20')];var _0x4c02c5=_0x2e388c?0x0:_0xe1cf1e[_0xc339('0x1e')];var _0x4acbd1=_0x2e388c?_0x496335[_0xc339('0x20')]:_0xe1cf1e[_0xc339('0x1e')]+_0xe1cf1e[_0xc339('0x1f')];var _0x530641;if(_0x4acbd1>=_0xd37877){_0x4acbd1=_0xd37877;_0x530641=0xc8;}else{_0x530641=0xce;}_0x231960[_0xc339('0x1b')](_0x530641);return _0x231960['set']('Content-Range',_0x4c02c5+'-'+_0x4acbd1+'/'+_0xd37877)['json'](_0x496335);}return null;};}function patchUpdates(_0x49adad){return function(_0x58bacf){try{jsonpatch[_0xc339('0x21')](_0x58bacf,_0x49adad,!![]);}catch(_0x171830){return BPromise[_0xc339('0x22')](_0x171830);}return _0x58bacf[_0xc339('0x23')]();};}function saveUpdates(_0x561f4c,_0xd92e6){return function(_0x16c322){if(_0x16c322){return _0x16c322[_0xc339('0x24')](_0x561f4c)[_0xc339('0x25')](function(_0x1ae5ea){return _0x1ae5ea;});}return null;};}function removeEntity(_0x2f4364,_0x212d9c){return function(_0x5b7d59){if(_0x5b7d59){return _0x5b7d59[_0xc339('0x26')]()[_0xc339('0x25')](function(){_0x2f4364['status'](0xcc)[_0xc339('0x1c')]();});}};}function handleEntityNotFound(_0x560016,_0x5887ee){return function(_0x3ac5ee){if(!_0x3ac5ee){_0x560016['sendStatus'](0x194);}return _0x3ac5ee;};}function handleError(_0x4c62c1,_0x33bcc9){_0x33bcc9=_0x33bcc9||0x1f4;return function(_0x2444da){logger[_0xc339('0x27')](_0x2444da[_0xc339('0x28')]);if(_0x2444da[_0xc339('0x29')]){delete _0x2444da[_0xc339('0x29')];}_0x4c62c1[_0xc339('0x1b')](_0x33bcc9)[_0xc339('0x2a')](_0x2444da);};}exports[_0xc339('0x2b')]=function(_0x558d96,_0x324714){var _0x17369f={},_0x21ccb6={},_0x173bde={'count':0x0,'rows':[]};var _0x521c99=_['map'](db[_0xc339('0x2c')]['rawAttributes'],function(_0x17c156){return{'name':_0x17c156[_0xc339('0x2d')],'type':_0x17c156[_0xc339('0x2e')][_0xc339('0x2f')]};});_0x21ccb6[_0xc339('0x30')]=_[_0xc339('0x31')](_0x521c99,_0xc339('0x29'));_0x21ccb6[_0xc339('0x32')]=_[_0xc339('0x33')](_0x558d96[_0xc339('0x32')]);_0x21ccb6[_0xc339('0x34')]=_['intersection'](_0x21ccb6[_0xc339('0x30')],_0x21ccb6[_0xc339('0x32')]);_0x17369f[_0xc339('0x35')]=_[_0xc339('0x36')](_0x21ccb6[_0xc339('0x30')],qs['fields'](_0x558d96['query'][_0xc339('0x37')]));_0x17369f[_0xc339('0x35')]=_0x17369f[_0xc339('0x35')][_0xc339('0x38')]?_0x17369f[_0xc339('0x35')]:_0x21ccb6[_0xc339('0x30')];if(!_0x558d96[_0xc339('0x32')]['hasOwnProperty'](_0xc339('0x39'))){_0x17369f[_0xc339('0x1f')]=qs['limit'](_0x558d96[_0xc339('0x32')][_0xc339('0x1f')]);_0x17369f['offset']=qs['offset'](_0x558d96[_0xc339('0x32')][_0xc339('0x1e')]);}_0x17369f['order']=qs[_0xc339('0x3a')](_0x558d96[_0xc339('0x32')][_0xc339('0x3a')]);_0x17369f[_0xc339('0x3b')]=qs[_0xc339('0x34')](_['pick'](_0x558d96[_0xc339('0x32')],_0x21ccb6[_0xc339('0x34')]),_0x521c99);if(_0x558d96['query']['filter']){_0x17369f[_0xc339('0x3b')]=_[_0xc339('0x3c')](_0x17369f[_0xc339('0x3b')],{'$or':_['map'](_0x521c99,function(_0x5c2ddc){if(_0x5c2ddc[_0xc339('0x2e')]!==_0xc339('0x3d')){var _0x1e6a57={};_0x1e6a57[_0x5c2ddc[_0xc339('0x29')]]={'$like':'%'+_0x558d96['query'][_0xc339('0x3e')]+'%'};return _0x1e6a57;}})});}_0x17369f=_[_0xc339('0x3c')]({},_0x17369f,_0x558d96[_0xc339('0x3f')]);var _0x1b3655={'where':_0x17369f['where']};return db[_0xc339('0x2c')][_0xc339('0x20')](_0x1b3655)['then'](function(_0x1574c4){_0x173bde[_0xc339('0x20')]=_0x1574c4;if(_0x558d96[_0xc339('0x32')][_0xc339('0x40')]){_0x17369f[_0xc339('0x41')]=[{'all':!![]}];}return db[_0xc339('0x2c')][_0xc339('0x42')](_0x17369f);})[_0xc339('0x25')](function(_0x1fb64c){_0x173bde[_0xc339('0x43')]=_0x1fb64c;return _0x173bde;})[_0xc339('0x25')](respondWithFilteredResult(_0x324714,_0x17369f))['catch'](handleError(_0x324714,null));};exports['show']=function(_0x4d5ba3,_0x1a54f5){var _0x408fb8={'raw':!![],'where':{'id':_0x4d5ba3['params']['id']}},_0x23db01={};_0x23db01[_0xc339('0x30')]=_[_0xc339('0x33')](db[_0xc339('0x2c')][_0xc339('0x44')]);_0x23db01[_0xc339('0x32')]=_['keys'](_0x4d5ba3[_0xc339('0x32')]);_0x23db01[_0xc339('0x34')]=_[_0xc339('0x36')](_0x23db01[_0xc339('0x30')],_0x23db01['query']);_0x408fb8['attributes']=_[_0xc339('0x36')](_0x23db01[_0xc339('0x30')],qs[_0xc339('0x37')](_0x4d5ba3['query'][_0xc339('0x37')]));_0x408fb8[_0xc339('0x35')]=_0x408fb8[_0xc339('0x35')]['length']?_0x408fb8['attributes']:_0x23db01[_0xc339('0x30')];if(_0x4d5ba3['query'][_0xc339('0x40')]){_0x408fb8[_0xc339('0x41')]=[{'all':!![]}];}_0x408fb8=_[_0xc339('0x3c')]({},_0x408fb8,_0x4d5ba3[_0xc339('0x3f')]);return db['VoiceTransferReport'][_0xc339('0x45')](_0x408fb8)[_0xc339('0x25')](handleEntityNotFound(_0x1a54f5,null))[_0xc339('0x25')](respondWithResult(_0x1a54f5,null))[_0xc339('0x46')](handleError(_0x1a54f5,null));};exports['create']=function(_0x4743f7,_0x3ef654){return db['VoiceTransferReport']['create'](_0x4743f7[_0xc339('0x47')],{})['then'](respondWithResult(_0x3ef654,0xc9))[_0xc339('0x46')](handleError(_0x3ef654,null));};exports[_0xc339('0x24')]=function(_0x4ee5ef,_0x362141){if(_0x4ee5ef['body']['id']){delete _0x4ee5ef[_0xc339('0x47')]['id'];}return db[_0xc339('0x2c')][_0xc339('0x45')]({'where':{'id':_0x4ee5ef[_0xc339('0x48')]['id']}})[_0xc339('0x25')](handleEntityNotFound(_0x362141,null))[_0xc339('0x25')](saveUpdates(_0x4ee5ef[_0xc339('0x47')],null))[_0xc339('0x25')](respondWithResult(_0x362141,null))['catch'](handleError(_0x362141,null));};exports[_0xc339('0x26')]=function(_0x52f494,_0x485170){return db[_0xc339('0x2c')][_0xc339('0x45')]({'where':{'id':_0x52f494['params']['id']}})[_0xc339('0x25')](handleEntityNotFound(_0x485170,null))[_0xc339('0x25')](removeEntity(_0x485170,null))[_0xc339('0x46')](handleError(_0x485170,null));};exports[_0xc339('0x49')]=function(_0x3eefb8,_0x319bda){return db[_0xc339('0x2c')][_0xc339('0x49')]()[_0xc339('0x25')](respondWithResult(_0x319bda,null))['catch'](handleError(_0x319bda,null));}; \ No newline at end of file +var _0x39e3=['reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceTransferReport','includeAll','include','findAll','rows','catch','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x39e3,0x1bc));var _0x339e=function(_0x14dfb6,_0x1f7351){_0x14dfb6=_0x14dfb6-0x0;var _0xe76a71=_0x39e3[_0x14dfb6];return _0xe76a71;};'use strict';var emlformat=require(_0x339e('0x0'));var rimraf=require(_0x339e('0x1'));var zipdir=require(_0x339e('0x2'));var jsonpatch=require(_0x339e('0x3'));var rp=require(_0x339e('0x4'));var moment=require(_0x339e('0x5'));var BPromise=require(_0x339e('0x6'));var Mustache=require(_0x339e('0x7'));var util=require(_0x339e('0x8'));var path=require(_0x339e('0x9'));var sox=require(_0x339e('0xa'));var csv=require('to-csv');var ejs=require(_0x339e('0xb'));var fs=require('fs');var fs_extra=require(_0x339e('0xc'));var _=require('lodash');var squel=require(_0x339e('0xd'));var crypto=require(_0x339e('0xe'));var jsforce=require(_0x339e('0xf'));var deskjs=require(_0x339e('0x10'));var toCsv=require(_0x339e('0x11'));var querystring=require('querystring');var Papa=require(_0x339e('0x12'));var Redis=require(_0x339e('0x13'));var authService=require(_0x339e('0x14'));var qs=require(_0x339e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x339e('0x16'));var logger=require(_0x339e('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x339e('0x18'));var licenseUtil=require(_0x339e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33aa3c,_0x5d50e4){_0x5d50e4=_0x5d50e4||0xcc;return function(_0x4def15){if(_0x4def15){return _0x33aa3c[_0x339e('0x1a')](_0x5d50e4);}return _0x33aa3c[_0x339e('0x1b')](_0x5d50e4)[_0x339e('0x1c')]();};}function respondWithResult(_0x232e9e,_0xfe4f7){_0xfe4f7=_0xfe4f7||0xc8;return function(_0x5d3f3d){if(_0x5d3f3d){return _0x232e9e[_0x339e('0x1b')](_0xfe4f7)[_0x339e('0x1d')](_0x5d3f3d);}};}function respondWithFilteredResult(_0x2a6506,_0xeaf496){return function(_0x3402be){if(_0x3402be){var _0x5ca498=typeof _0xeaf496[_0x339e('0x1e')]===_0x339e('0x1f')&&typeof _0xeaf496['limit']===_0x339e('0x1f');var _0x5ae7f0=_0x3402be['count'];var _0x5aa75f=_0x5ca498?0x0:_0xeaf496[_0x339e('0x1e')];var _0x831ba9=_0x5ca498?_0x3402be[_0x339e('0x20')]:_0xeaf496[_0x339e('0x1e')]+_0xeaf496['limit'];var _0x3bd80d;if(_0x831ba9>=_0x5ae7f0){_0x831ba9=_0x5ae7f0;_0x3bd80d=0xc8;}else{_0x3bd80d=0xce;}_0x2a6506[_0x339e('0x1b')](_0x3bd80d);return _0x2a6506[_0x339e('0x21')](_0x339e('0x22'),_0x5aa75f+'-'+_0x831ba9+'/'+_0x5ae7f0)[_0x339e('0x1d')](_0x3402be);}return null;};}function patchUpdates(_0x45591d){return function(_0x582ac8){try{jsonpatch[_0x339e('0x23')](_0x582ac8,_0x45591d,!![]);}catch(_0x2fb777){return BPromise[_0x339e('0x24')](_0x2fb777);}return _0x582ac8['save']();};}function saveUpdates(_0x410de9,_0x403480){return function(_0x5a7713){if(_0x5a7713){return _0x5a7713[_0x339e('0x25')](_0x410de9)[_0x339e('0x26')](function(_0x306b2a){return _0x306b2a;});}return null;};}function removeEntity(_0x27c0a1,_0x56325e){return function(_0xca6651){if(_0xca6651){return _0xca6651[_0x339e('0x27')]()[_0x339e('0x26')](function(){_0x27c0a1[_0x339e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x567f66,_0x597ba0){return function(_0x2ebc90){if(!_0x2ebc90){_0x567f66['sendStatus'](0x194);}return _0x2ebc90;};}function handleError(_0x169fe5,_0x24c8d9){_0x24c8d9=_0x24c8d9||0x1f4;return function(_0x16a0d4){logger[_0x339e('0x28')](_0x16a0d4[_0x339e('0x29')]);if(_0x16a0d4['name']){delete _0x16a0d4[_0x339e('0x2a')];}_0x169fe5['status'](_0x24c8d9)[_0x339e('0x2b')](_0x16a0d4);};}exports[_0x339e('0x2c')]=function(_0x1269f3,_0x12bdb4){var _0x2aa5eb={},_0x1be227={},_0x509968={'count':0x0,'rows':[]};var _0x1397b1=_[_0x339e('0x2d')](db['VoiceTransferReport'][_0x339e('0x2e')],function(_0x1bba2c){return{'name':_0x1bba2c[_0x339e('0x2f')],'type':_0x1bba2c['type'][_0x339e('0x30')]};});_0x1be227['model']=_[_0x339e('0x2d')](_0x1397b1,_0x339e('0x2a'));_0x1be227[_0x339e('0x31')]=_[_0x339e('0x32')](_0x1269f3['query']);_0x1be227[_0x339e('0x33')]=_[_0x339e('0x34')](_0x1be227[_0x339e('0x35')],_0x1be227[_0x339e('0x31')]);_0x2aa5eb[_0x339e('0x36')]=_['intersection'](_0x1be227[_0x339e('0x35')],qs['fields'](_0x1269f3[_0x339e('0x31')][_0x339e('0x37')]));_0x2aa5eb[_0x339e('0x36')]=_0x2aa5eb[_0x339e('0x36')]['length']?_0x2aa5eb[_0x339e('0x36')]:_0x1be227['model'];if(!_0x1269f3[_0x339e('0x31')][_0x339e('0x38')](_0x339e('0x39'))){_0x2aa5eb[_0x339e('0x3a')]=qs[_0x339e('0x3a')](_0x1269f3[_0x339e('0x31')][_0x339e('0x3a')]);_0x2aa5eb[_0x339e('0x1e')]=qs['offset'](_0x1269f3[_0x339e('0x31')][_0x339e('0x1e')]);}_0x2aa5eb[_0x339e('0x3b')]=qs[_0x339e('0x3c')](_0x1269f3['query'][_0x339e('0x3c')]);_0x2aa5eb[_0x339e('0x3d')]=qs[_0x339e('0x33')](_[_0x339e('0x3e')](_0x1269f3['query'],_0x1be227[_0x339e('0x33')]),_0x1397b1);if(_0x1269f3[_0x339e('0x31')][_0x339e('0x3f')]){_0x2aa5eb['where']=_[_0x339e('0x40')](_0x2aa5eb[_0x339e('0x3d')],{'$or':_[_0x339e('0x2d')](_0x1397b1,function(_0x32b834){if(_0x32b834[_0x339e('0x41')]!==_0x339e('0x42')){var _0x21d741={};_0x21d741[_0x32b834[_0x339e('0x2a')]]={'$like':'%'+_0x1269f3[_0x339e('0x31')]['filter']+'%'};return _0x21d741;}})});}_0x2aa5eb=_[_0x339e('0x40')]({},_0x2aa5eb,_0x1269f3['options']);var _0x398d70={'where':_0x2aa5eb[_0x339e('0x3d')]};return db[_0x339e('0x43')][_0x339e('0x20')](_0x398d70)[_0x339e('0x26')](function(_0x5321bb){_0x509968['count']=_0x5321bb;if(_0x1269f3[_0x339e('0x31')][_0x339e('0x44')]){_0x2aa5eb[_0x339e('0x45')]=[{'all':!![]}];}return db[_0x339e('0x43')][_0x339e('0x46')](_0x2aa5eb);})['then'](function(_0x4f9735){_0x509968[_0x339e('0x47')]=_0x4f9735;return _0x509968;})[_0x339e('0x26')](respondWithFilteredResult(_0x12bdb4,_0x2aa5eb))[_0x339e('0x48')](handleError(_0x12bdb4,null));};exports['show']=function(_0x1c9df7,_0x5c559d){var _0x15ce97={'raw':!![],'where':{'id':_0x1c9df7['params']['id']}},_0x546507={};_0x546507[_0x339e('0x35')]=_[_0x339e('0x32')](db[_0x339e('0x43')][_0x339e('0x2e')]);_0x546507['query']=_['keys'](_0x1c9df7[_0x339e('0x31')]);_0x546507[_0x339e('0x33')]=_['intersection'](_0x546507[_0x339e('0x35')],_0x546507[_0x339e('0x31')]);_0x15ce97[_0x339e('0x36')]=_['intersection'](_0x546507[_0x339e('0x35')],qs[_0x339e('0x37')](_0x1c9df7[_0x339e('0x31')]['fields']));_0x15ce97[_0x339e('0x36')]=_0x15ce97['attributes'][_0x339e('0x49')]?_0x15ce97[_0x339e('0x36')]:_0x546507[_0x339e('0x35')];if(_0x1c9df7[_0x339e('0x31')][_0x339e('0x44')]){_0x15ce97['include']=[{'all':!![]}];}_0x15ce97=_[_0x339e('0x40')]({},_0x15ce97,_0x1c9df7[_0x339e('0x4a')]);return db[_0x339e('0x43')][_0x339e('0x4b')](_0x15ce97)['then'](handleEntityNotFound(_0x5c559d,null))[_0x339e('0x26')](respondWithResult(_0x5c559d,null))[_0x339e('0x48')](handleError(_0x5c559d,null));};exports[_0x339e('0x4c')]=function(_0x9bd567,_0x1773b7){return db[_0x339e('0x43')][_0x339e('0x4c')](_0x9bd567['body'],{})['then'](respondWithResult(_0x1773b7,0xc9))['catch'](handleError(_0x1773b7,null));};exports[_0x339e('0x25')]=function(_0x573164,_0x1e411d){if(_0x573164[_0x339e('0x4d')]['id']){delete _0x573164[_0x339e('0x4d')]['id'];}return db[_0x339e('0x43')]['find']({'where':{'id':_0x573164[_0x339e('0x4e')]['id']}})[_0x339e('0x26')](handleEntityNotFound(_0x1e411d,null))[_0x339e('0x26')](saveUpdates(_0x573164[_0x339e('0x4d')],null))['then'](respondWithResult(_0x1e411d,null))[_0x339e('0x48')](handleError(_0x1e411d,null));};exports['destroy']=function(_0xe0c497,_0x429997){return db[_0x339e('0x43')]['find']({'where':{'id':_0xe0c497[_0x339e('0x4e')]['id']}})[_0x339e('0x26')](handleEntityNotFound(_0x429997,null))[_0x339e('0x26')](removeEntity(_0x429997,null))[_0x339e('0x48')](handleError(_0x429997,null));};exports['describe']=function(_0x21a047,_0x2fe96b){return db[_0x339e('0x43')][_0x339e('0x4f')]()[_0x339e('0x26')](respondWithResult(_0x2fe96b,null))[_0x339e('0x48')](handleError(_0x2fe96b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index bd8c564..9f25d34 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 _0x7224=['moment','bluebird','request-promise','path','./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','api'];(function(_0xd43f0d,_0x50aba1){var _0x4a472a=function(_0x18e5dd){while(--_0x18e5dd){_0xd43f0d['push'](_0xd43f0d['shift']());}};_0x4a472a(++_0x50aba1);}(_0x7224,0x16f));var _0x4722=function(_0x356861,_0x20e611){_0x356861=_0x356861-0x0;var _0x4db294=_0x7224[_0x356861];return _0x4db294;};'use strict';var _=require(_0x4722('0x0'));var util=require(_0x4722('0x1'));var logger=require('../../config/logger')(_0x4722('0x2'));var moment=require(_0x4722('0x3'));var BPromise=require(_0x4722('0x4'));var rp=require(_0x4722('0x5'));var fs=require('fs');var path=require(_0x4722('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4722('0x7'));module['exports']=function(_0x580372,_0xbc9b6f){return _0x580372[_0x4722('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x4722('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x212f=['exports','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./voiceTransferReport.attributes'];(function(_0x46390e,_0x39d20f){var _0x4db91c=function(_0x2bd91e){while(--_0x2bd91e){_0x46390e['push'](_0x46390e['shift']());}};_0x4db91c(++_0x39d20f);}(_0x212f,0x1c5));var _0xf212=function(_0x22b6c8,_0x59a520){_0x22b6c8=_0x22b6c8-0x0;var _0x59297d=_0x212f[_0x22b6c8];return _0x59297d;};'use strict';var _=require(_0xf212('0x0'));var util=require('util');var logger=require(_0xf212('0x1'))(_0xf212('0x2'));var moment=require(_0xf212('0x3'));var BPromise=require('bluebird');var rp=require(_0xf212('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf212('0x5'));var attributes=require(_0xf212('0x6'));module[_0xf212('0x7')]=function(_0x3d8925,_0x811b02){return _0x3d8925['define'](_0xf212('0x8'),attributes,{'tableName':_0xf212('0x9'),'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 61084ee..a0cecc7 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 _0xb519=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','catch','util','moment','randomstring','ioredis'];(function(_0x4477c8,_0xf32123){var _0x17ee51=function(_0xf091ca){while(--_0xf091ca){_0x4477c8['push'](_0x4477c8['shift']());}};_0x17ee51(++_0xf32123);}(_0xb519,0x168));var _0x9b51=function(_0x533e43,_0x2afe2a){_0x533e43=_0x533e43-0x0;var _0x4d99df=_0xb519[_0x533e43];return _0x4d99df;};'use strict';var _=require('lodash');var util=require(_0x9b51('0x0'));var moment=require(_0x9b51('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b51('0x2'));var fs=require('fs');var Redis=require(_0x9b51('0x3'));var db=require(_0x9b51('0x4'))['db'];var utils=require(_0x9b51('0x5'));var logger=require('../../config/logger')(_0x9b51('0x6'));var config=require(_0x9b51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9b51('0x8')][_0x9b51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57fbce,_0x5317c0,_0x1a5326){return new BPromise(function(_0x1ef907,_0x564cc0){return client[_0x9b51('0xa')](_0x57fbce,_0x1a5326)[_0x9b51('0xb')](function(_0x4e144b){logger[_0x9b51('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5317c0,_0x9b51('0xd'));logger[_0x9b51('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5317c0,_0x9b51('0xd'),JSON[_0x9b51('0xf')](_0x4e144b));if(_0x4e144b[_0x9b51('0x10')]){if(_0x4e144b[_0x9b51('0x10')]['code']===0x1f4){logger[_0x9b51('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5317c0,_0x4e144b[_0x9b51('0x10')]['message']);return _0x564cc0(_0x4e144b[_0x9b51('0x10')][_0x9b51('0x11')]);}logger[_0x9b51('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5317c0,_0x4e144b[_0x9b51('0x10')][_0x9b51('0x11')]);return _0x1ef907(_0x4e144b[_0x9b51('0x10')]['message']);}else{logger['info'](_0x9b51('0x12'),_0x5317c0,'request\x20sent');_0x1ef907(_0x4e144b[_0x9b51('0x13')][_0x9b51('0x11')]);}})['catch'](function(_0x4208a6){logger[_0x9b51('0x10')](_0x9b51('0x12'),_0x5317c0,_0x4208a6);_0x564cc0(_0x4208a6);});});}exports[_0x9b51('0x14')]=function(_0x22c31a){var _0x2b7202=this;return new Promise(function(_0x3fc251,_0x28787c){return db[_0x9b51('0x15')][_0x9b51('0x16')](_0x22c31a[_0x9b51('0x17')],{'raw':_0x22c31a[_0x9b51('0x18')]?_0x22c31a[_0x9b51('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d167f){logger[_0x9b51('0xc')]('CreateVoiceTransferReport',_0x22c31a);logger[_0x9b51('0xe')]('CreateVoiceTransferReport',_0x22c31a,JSON['stringify'](_0x3d167f));_0x3fc251(_0x3d167f);})[_0x9b51('0x19')](function(_0x5b3377){logger[_0x9b51('0x10')]('CreateVoiceTransferReport',_0x5b3377['message'],_0x22c31a);_0x28787c(_0x2b7202[_0x9b51('0x10')](0x1f4,_0x5b3377[_0x9b51('0x11')]));});});}; \ No newline at end of file +var _0xe10a=['raw','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','debug','request\x20sent','error','code','message','VoiceTransferReport,\x20%s,\x20%s','CreateVoiceTransferReport','body','options'];(function(_0x45336c,_0x18649d){var _0x2889db=function(_0x1eaf38){while(--_0x1eaf38){_0x45336c['push'](_0x45336c['shift']());}};_0x2889db(++_0x18649d);}(_0xe10a,0x19b));var _0xae10=function(_0x3a1ea2,_0x24431c){_0x3a1ea2=_0x3a1ea2-0x0;var _0x5eca01=_0xe10a[_0x3a1ea2];return _0x5eca01;};'use strict';var _=require(_0xae10('0x0'));var util=require('util');var moment=require(_0xae10('0x1'));var BPromise=require(_0xae10('0x2'));var rs=require(_0xae10('0x3'));var fs=require('fs');var Redis=require(_0xae10('0x4'));var db=require(_0xae10('0x5'))['db'];var utils=require(_0xae10('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xae10('0x7'));var client=jayson[_0xae10('0x8')][_0xae10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca66f8,_0x448892,_0xde01db){return new BPromise(function(_0x4277c1,_0x57fe0d){return client[_0xae10('0xa')](_0xca66f8,_0xde01db)['then'](function(_0x28db46){logger[_0xae10('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x448892,'request\x20sent');logger[_0xae10('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x448892,_0xae10('0xd'),JSON['stringify'](_0x28db46));if(_0x28db46['error']){if(_0x28db46[_0xae10('0xe')][_0xae10('0xf')]===0x1f4){logger[_0xae10('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x448892,_0x28db46[_0xae10('0xe')]['message']);return _0x57fe0d(_0x28db46[_0xae10('0xe')]['message']);}logger[_0xae10('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x448892,_0x28db46[_0xae10('0xe')][_0xae10('0x10')]);return _0x4277c1(_0x28db46[_0xae10('0xe')][_0xae10('0x10')]);}else{logger[_0xae10('0xb')](_0xae10('0x11'),_0x448892,'request\x20sent');_0x4277c1(_0x28db46['result'][_0xae10('0x10')]);}})['catch'](function(_0x43eaf4){logger['error'](_0xae10('0x11'),_0x448892,_0x43eaf4);_0x57fe0d(_0x43eaf4);});});}exports[_0xae10('0x12')]=function(_0x43306c){var _0x2861da=this;return new Promise(function(_0x5fa412,_0x32df16){return db['VoiceTransferReport']['create'](_0x43306c[_0xae10('0x13')],{'raw':_0x43306c[_0xae10('0x14')]?_0x43306c['options'][_0xae10('0x15')]===undefined?!![]:![]:!![]})[_0xae10('0x16')](function(_0x23d415){logger[_0xae10('0xb')]('CreateVoiceTransferReport',_0x43306c);logger[_0xae10('0xc')]('CreateVoiceTransferReport',_0x43306c,JSON['stringify'](_0x23d415));_0x5fa412(_0x23d415);})[_0xae10('0x17')](function(_0x3199b2){logger[_0xae10('0xe')](_0xae10('0x12'),_0x3199b2[_0xae10('0x10')],_0x43306c);_0x32df16(_0x2861da[_0xae10('0xe')](0x1f4,_0x3199b2[_0xae10('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5eb10c7..8a2ac52 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 _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x104de3,_0x1f9418){var _0x5a5bcd=function(_0x9a6fdc){while(--_0x9a6fdc){_0x104de3['push'](_0x104de3['shift']());}};_0x5a5bcd(++_0x1f9418);}(_0xedd9,0xfc));var _0x9edd=function(_0x3139f9,_0x1f577b){_0x3139f9=_0x3139f9-0x0;var _0x31d0fb=_0xedd9[_0x3139f9];return _0x31d0fb;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router; \ No newline at end of file +var _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xcb91[_0x56825b];return _0x69ce77;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index ed31b5b..c3db988 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 _0x76dc=['agent','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','originate','info','body','length','json','userId','callerId','format','user:%s','webbar:originate','originate\x20executed!','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','filter','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','ioredis','redis','defaults','socket.io-emitter','validate','string','callNumber\x20is\x20required','userId\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne'];(function(_0x35b7c3,_0x243e1b){var _0x3681d9=function(_0xb4cb3a){while(--_0xb4cb3a){_0x35b7c3['push'](_0x35b7c3['shift']());}};_0x3681d9(++_0x243e1b);}(_0x76dc,0x1f2));var _0xc76d=function(_0x37ac91,_0x8f336c){_0x37ac91=_0x37ac91-0x0;var _0x2b2275=_0x76dc[_0x37ac91];return _0x2b2275;};'use strict';var path=require(_0xc76d('0x0'));var fs=require('fs');var _=require(_0xc76d('0x1'));var db=require(_0xc76d('0x2'))['db'];var config=require(_0xc76d('0x3'));var util=require('util');var BPromise=require(_0xc76d('0x4'));var jayson=require(_0xc76d('0x5'));var amiClient=jayson['client'][_0xc76d('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xc76d('0x7'));config[_0xc76d('0x8')]=_[_0xc76d('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc76d('0xa'))(new Redis(config[_0xc76d('0x8')]));var Schema=require(_0xc76d('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xc76d('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0x10')]},'transferNumber':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]}});function emit(_0x6f94e,_0x5c680c,_0x32e0a8){logger['info'](_0x6f94e,_0x5c680c,JSON['stringify'](_0x32e0a8));io['to'](_0x6f94e)[_0xc76d('0x12')](_0x5c680c,_0x32e0a8);}function handleError(_0x31b032){return function(_0x339623){console[_0xc76d('0x13')](_0xc76d('0x14'),_0x339623,_0x339623 instanceof RangeError);logger['error'](_0x339623[_0xc76d('0x15')]);if(_0x339623 instanceof RangeError){if(_0x339623[_0xc76d('0x16')]){delete _0x339623[_0xc76d('0x16')];}_0x31b032[_0xc76d('0x17')](0x194)[_0xc76d('0x18')](_0x339623);}else{if(_0x339623['name']){delete _0x339623[_0xc76d('0x16')];}_0x31b032[_0xc76d('0x17')](0x1f4)['send'](_0x339623);}};}function checkError(){return function(_0x455371){if(!_0x455371){throw new RangeError(_0xc76d('0x19'));}return _0x455371;};}function respondWithRpcPromise(_0x191e97,_0xb89876){return new BPromise(function(_0x18f546,_0x3d357b){var _0x42b89c=amiClient;return _0x42b89c[_0xc76d('0x1a')](_0x191e97,_0xb89876)[_0xc76d('0x1b')](function(_0x20e09c){if(_0x20e09c[_0xc76d('0x1c')]){if(_0x20e09c['error'][_0xc76d('0x1d')]===0x1f4){return _0x3d357b(_0x20e09c[_0xc76d('0x1c')]['message']);}return _0x18f546(_0x20e09c[_0xc76d('0x1c')][_0xc76d('0x1e')]);}else{_0x18f546(_0x20e09c['result']);}})[_0xc76d('0x1f')](function(_0x476aee){_0x3d357b(_0x476aee);});});}function getAgent(_0x2cd06e){return db[_0xc76d('0x20')][_0xc76d('0x21')]({'where':{'id':_0x2cd06e,'role':_0xc76d('0x22')}})[_0xc76d('0x1b')](checkError());}function getAgentCheckSession(_0x59ebd1,_0x59dabf){return new BPromise(function(_0x285430,_0x287ae4){var _0x5069ea=respondWithRpcPromise(_0xc76d('0x23'));var _0x52a79a=getAgent(_0x59ebd1);Promise[_0xc76d('0x24')]([_0x5069ea,_0x52a79a])['then'](function(_0x2039f4){var _0x5cf2e4=_0x2039f4[0x0];var _0x13b468=_0x2039f4[0x1];var _0x18a7fa=_['filter'](_0x5cf2e4[_0xc76d('0x25')],function(_0x1c68f3){return _0x1c68f3[_0xc76d('0x26')]==_0x13b468['id']&&_0x1c68f3[_0xc76d('0x27')]==_0x59dabf;});if(_0x18a7fa['length']==0x1){_0x285430(_0x13b468);}else{_0x287ae4(new RangeError(_0xc76d('0x28')+_0x59dabf+'\x20not\x20found!'));}});});}exports[_0xc76d('0x29')]=function(_0x5e9233,_0x30769f){logger[_0xc76d('0x2a')]('originate\x20fired:',_0x5e9233['body']);var _0x5eca19=originateValidation['validate'](_0x5e9233[_0xc76d('0x2b')]);if(_0x5eca19[_0xc76d('0x2c')]>0x0){return _0x30769f[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x5eca19);}var _0x1b2ed1=_0x5e9233['body'][_0xc76d('0x2e')];var _0x55e825=_0x5e9233[_0xc76d('0x2b')]['callNumber'];var _0x1bef44=_0x5e9233[_0xc76d('0x2b')][_0xc76d('0x2f')];var _0x20fe33=_0x5e9233[_0xc76d('0x2b')]['callbackUrl'];return getAgent(_0x1b2ed1)[_0xc76d('0x1b')](function(_0x371306){logger[_0xc76d('0x2a')]('entityFound:',_0x371306[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x371306['name']),_0xc76d('0x32'),{'callNumber':_0x55e825,'callerId':_0x1bef44,'callbackUrl':_0x20fe33});return _0x30769f[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x33')});})[_0xc76d('0x1f')](handleError(_0x30769f));};exports[_0xc76d('0x34')]=function(_0x579d93,_0x518945){logger[_0xc76d('0x2a')]('hangup\x20fired:',_0x579d93[_0xc76d('0x2b')]);var _0x359f38=hangupValidation[_0xc76d('0xb')](_0x579d93[_0xc76d('0x2b')]);if(_0x359f38['length']>0x0){return _0x518945['status'](0x190)[_0xc76d('0x2d')](_0x359f38);}var _0x20a456=_0x579d93[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x410029=_0x579d93['body'][_0xc76d('0x27')];return getAgent(_0x20a456)[_0xc76d('0x1b')](function(_0x321989){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x321989[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x321989[_0xc76d('0x16')]),_0xc76d('0x36'),{'sessionId':_0x410029});return _0x518945['status'](0xc8)['json']({'error':![],'message':_0xc76d('0x37')});})[_0xc76d('0x1f')](handleError(_0x518945));};exports[_0xc76d('0x38')]=function(_0x27bdff,_0x4ae994){logger['info'](_0xc76d('0x39'),_0x27bdff[_0xc76d('0x2b')]);var _0x3e471e=answerValidation[_0xc76d('0xb')](_0x27bdff[_0xc76d('0x2b')]);if(_0x3e471e[_0xc76d('0x2c')]>0x0){return _0x4ae994[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x3e471e);}var _0x50e922=_0x27bdff[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x1bf8a0=_0x27bdff[_0xc76d('0x2b')]['sessionId'];return getAgent(_0x50e922)['then'](function(_0x4bf591){logger['info']('entityFound:',_0x4bf591['name']);emit(util['format'](_0xc76d('0x31'),_0x4bf591[_0xc76d('0x16')]),_0xc76d('0x3a'),{'sessionId':_0x1bf8a0});return _0x4ae994[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x3b')});})[_0xc76d('0x1f')](handleError(_0x4ae994));};exports[_0xc76d('0x3c')]=function(_0x555f14,_0x462214){logger[_0xc76d('0x2a')](_0xc76d('0x3d'),_0x555f14[_0xc76d('0x2b')]);var _0xb9cca2=holdValidation[_0xc76d('0xb')](_0x555f14[_0xc76d('0x2b')]);if(_0xb9cca2[_0xc76d('0x2c')]>0x0){return _0x462214[_0xc76d('0x17')](0x190)['json'](_0xb9cca2);}var _0x5b41d3=_0x555f14[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x2fa905=_0x555f14[_0xc76d('0x2b')][_0xc76d('0x27')];return getAgent(_0x5b41d3)['then'](function(_0x25fc9d){logger[_0xc76d('0x2a')]('entityFound:',_0x25fc9d['name']);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x25fc9d['name']),_0xc76d('0x3e'),{'sessionId':_0x2fa905});return _0x462214[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x3f')});})[_0xc76d('0x1f')](handleError(_0x462214));};exports[_0xc76d('0x40')]=function(_0x25a549,_0x10b1b0){logger[_0xc76d('0x2a')](_0xc76d('0x41'),_0x25a549['body']);var _0x4efd83=unholdValidation[_0xc76d('0xb')](_0x25a549[_0xc76d('0x2b')]);if(_0x4efd83['length']>0x0){return _0x10b1b0[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x4efd83);}var _0x506b03=_0x25a549[_0xc76d('0x2b')]['userId'];var _0xe90d83=_0x25a549[_0xc76d('0x2b')][_0xc76d('0x27')];return getAgent(_0x506b03)[_0xc76d('0x1b')](function(_0x14ef42){logger['info']('entityFound:',_0x14ef42['name']);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x14ef42[_0xc76d('0x16')]),_0xc76d('0x42'),{'sessionId':_0xe90d83});return _0x10b1b0[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0xc76d('0x1f')](handleError(_0x10b1b0));};exports[_0xc76d('0x43')]=function(_0x5e66d9,_0x1a49d5){logger[_0xc76d('0x2a')]('calls\x20fired:',_0x1a49d5[_0xc76d('0x2b')]);var _0x463cbe=callsValidation[_0xc76d('0xb')](_0x5e66d9[_0xc76d('0x2b')]);if(_0x463cbe[_0xc76d('0x2c')]>0x0){return _0x1a49d5[_0xc76d('0x17')](0x190)['json'](_0x463cbe);}var _0x91b25b=_0x5e66d9[_0xc76d('0x2b')]['userId'];var _0x5f3973=respondWithRpcPromise(_0xc76d('0x23'));var _0x5ddcc6=getAgent(_0x91b25b);return Promise[_0xc76d('0x24')]([_0x5f3973,_0x5ddcc6])[_0xc76d('0x1b')](function(_0x12b287){var _0xfe2be1=_0x12b287[0x0];var _0x254128=_0x12b287[0x1];var _0x4746a5=_[_0xc76d('0x44')](_0xfe2be1[_0xc76d('0x25')],function(_0x3ada89){return _0x3ada89[_0xc76d('0x26')]==_0x254128['id'];});return _0x1a49d5[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'count':_0x4746a5[_0xc76d('0x2c')],'rows':_0x4746a5});})[_0xc76d('0x1f')](handleError(_0x1a49d5));};exports['conference']=function(_0x3054e0,_0xa0aa45){logger[_0xc76d('0x2a')](_0xc76d('0x45'),_0x3054e0[_0xc76d('0x2b')]);var _0x5ce99d=conferenceValidation[_0xc76d('0xb')](_0x3054e0[_0xc76d('0x2b')]);if(_0x5ce99d['length']>0x0){return _0xa0aa45['status'](0x190)['json'](_0x5ce99d);}var _0x382db6=_0x3054e0[_0xc76d('0x2b')][_0xc76d('0x2e')];return getAgent(_0x382db6)[_0xc76d('0x1b')](function(_0x2ba812){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x2ba812[_0xc76d('0x16')]);emit(util['format'](_0xc76d('0x31'),_0x2ba812['name']),'webbar:conference');return _0xa0aa45[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x46')});})['catch'](handleError(_0xa0aa45));};exports[_0xc76d('0x47')]=function(_0x57068d,_0x48ccf7){logger['info'](_0xc76d('0x48'),_0x57068d[_0xc76d('0x2b')]);var _0x513623=transferValidation[_0xc76d('0xb')](_0x57068d[_0xc76d('0x2b')]);if(_0x513623[_0xc76d('0x2c')]>0x0){return _0x48ccf7[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x513623);}var _0xa81af6=_0x57068d[_0xc76d('0x2b')]['userId'];var _0x5035fd=_0x57068d['body'][_0xc76d('0x27')];var _0x2e742f=_0x57068d[_0xc76d('0x2b')][_0xc76d('0x49')];return getAgent(_0xa81af6)[_0xc76d('0x1b')](function(_0x49f876){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x49f876[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x49f876[_0xc76d('0x16')]),_0xc76d('0x4a'),{'sessionId':_0x5035fd,'transferNumber':_0x2e742f});return _0x48ccf7[_0xc76d('0x17')](0xc8)['json']({'error':![],'message':_0xc76d('0x4b')});})['catch'](handleError(_0x48ccf7));}; \ No newline at end of file +var _0x01fe=['webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','VoiceChannels','all','conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','path','../../mysqldb','../../config/environment','jayson/promise','client','http','../../config/logger','ioredis','defaults','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','findOne','agent','filter','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','validate','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','json','sessionId','user:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01fe,0x102));var _0xe01f=function(_0x2f4398,_0x51154f){_0x2f4398=_0x2f4398-0x0;var _0x402043=_0x01fe[_0x2f4398];return _0x402043;};'use strict';var path=require(_0xe01f('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xe01f('0x1'))['db'];var config=require(_0xe01f('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xe01f('0x3'));var amiClient=jayson[_0xe01f('0x4')][_0xe01f('0x5')]({'port':0x232a});var logger=require(_0xe01f('0x6'))('webbarapi');var Redis=require(_0xe01f('0x7'));config['redis']=_[_0xe01f('0x8')](config[_0xe01f('0x9')],{'host':_0xe01f('0xa'),'port':0x18eb});var io=require(_0xe01f('0xb'))(new Redis(config[_0xe01f('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xe01f('0xc'),'required':[!![],_0xe01f('0xd')]},'callNumber':{'type':'string','required':[!![],_0xe01f('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe01f('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xe01f('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe01f('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe01f('0xd')]},'sessionId':{'type':_0xe01f('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe01f('0xc'),'required':[!![],_0xe01f('0xd')]},'sessionId':{'type':_0xe01f('0xf'),'required':[!![],_0xe01f('0x10')]},'transferNumber':{'type':_0xe01f('0xf'),'required':[!![],_0xe01f('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe01f('0xd')]},'sessionId':{'type':_0xe01f('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe01f('0xc'),'required':[!![],_0xe01f('0xd')]},'sessionId':{'type':_0xe01f('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe01f('0xc'),'required':[!![],_0xe01f('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x5e3877,_0x12540b,_0x14b05d){logger[_0xe01f('0x12')](_0x5e3877,_0x12540b,JSON[_0xe01f('0x13')](_0x14b05d));io['to'](_0x5e3877)[_0xe01f('0x14')](_0x12540b,_0x14b05d);}function handleError(_0x3fad9a){return function(_0x144eef){console[_0xe01f('0x15')](_0xe01f('0x16'),_0x144eef,_0x144eef instanceof RangeError);logger[_0xe01f('0x17')](_0x144eef['stack']);if(_0x144eef instanceof RangeError){if(_0x144eef[_0xe01f('0x18')]){delete _0x144eef['name'];}_0x3fad9a[_0xe01f('0x19')](0x194)[_0xe01f('0x1a')](_0x144eef);}else{if(_0x144eef[_0xe01f('0x18')]){delete _0x144eef[_0xe01f('0x18')];}_0x3fad9a['status'](0x1f4)[_0xe01f('0x1a')](_0x144eef);}};}function checkError(){return function(_0xb9343e){if(!_0xb9343e){throw new RangeError(_0xe01f('0x1b'));}return _0xb9343e;};}function respondWithRpcPromise(_0x1f0cfd,_0x369b7e){return new BPromise(function(_0x3c34fa,_0x570d48){var _0x1faeb8=amiClient;return _0x1faeb8[_0xe01f('0x1c')](_0x1f0cfd,_0x369b7e)[_0xe01f('0x1d')](function(_0xa6da95){if(_0xa6da95[_0xe01f('0x17')]){if(_0xa6da95[_0xe01f('0x17')][_0xe01f('0x1e')]===0x1f4){return _0x570d48(_0xa6da95[_0xe01f('0x17')][_0xe01f('0x1f')]);}return _0x3c34fa(_0xa6da95['error']['message']);}else{_0x3c34fa(_0xa6da95[_0xe01f('0x20')]);}})[_0xe01f('0x21')](function(_0x3f92ca){_0x570d48(_0x3f92ca);});});}function getAgent(_0x3ec80a){return db['User'][_0xe01f('0x22')]({'where':{'id':_0x3ec80a,'role':_0xe01f('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x378c93,_0x5b9c5e){return new BPromise(function(_0x1b77c8,_0x387044){var _0x13dcd4=respondWithRpcPromise('VoiceChannels');var _0x940cb6=getAgent(_0x378c93);Promise['all']([_0x13dcd4,_0x940cb6])[_0xe01f('0x1d')](function(_0x232ad1){var _0x2e4568=_0x232ad1[0x0];var _0x2dbc94=_0x232ad1[0x1];var _0x35bd53=_[_0xe01f('0x24')](_0x2e4568[_0xe01f('0x25')],function(_0x41d13d){return _0x41d13d[_0xe01f('0x26')]==_0x2dbc94['id']&&_0x41d13d['sessionId']==_0x5b9c5e;});if(_0x35bd53[_0xe01f('0x27')]==0x1){_0x1b77c8(_0x2dbc94);}else{_0x387044(new RangeError('sessionId\x20'+_0x5b9c5e+_0xe01f('0x28')));}});});}exports[_0xe01f('0x29')]=function(_0x51fe9b,_0x15f98f){logger[_0xe01f('0x12')](_0xe01f('0x2a'),_0x51fe9b['body']);var _0x2e417b=originateValidation[_0xe01f('0x2b')](_0x51fe9b[_0xe01f('0x2c')]);if(_0x2e417b[_0xe01f('0x27')]>0x0){return _0x15f98f[_0xe01f('0x19')](0x190)['json'](_0x2e417b);}var _0x57aed0=_0x51fe9b['body'][_0xe01f('0x2d')];var _0x4c9f2e=_0x51fe9b[_0xe01f('0x2c')][_0xe01f('0x2e')];var _0x463687=_0x51fe9b[_0xe01f('0x2c')][_0xe01f('0x2f')];var _0x83c32=_0x51fe9b[_0xe01f('0x2c')][_0xe01f('0x30')];return getAgent(_0x57aed0)['then'](function(_0x53c309){logger[_0xe01f('0x12')](_0xe01f('0x31'),_0x53c309[_0xe01f('0x18')]);emit(util[_0xe01f('0x32')]('user:%s',_0x53c309[_0xe01f('0x18')]),_0xe01f('0x33'),{'callNumber':_0x4c9f2e,'callerId':_0x463687,'callbackUrl':_0x83c32});return _0x15f98f[_0xe01f('0x19')](0xc8)['json']({'error':![],'message':_0xe01f('0x34')});})[_0xe01f('0x21')](handleError(_0x15f98f));};exports[_0xe01f('0x35')]=function(_0x2fcc0c,_0xddb14b){logger[_0xe01f('0x12')](_0xe01f('0x36'),_0x2fcc0c[_0xe01f('0x2c')]);var _0x29c47f=hangupValidation[_0xe01f('0x2b')](_0x2fcc0c[_0xe01f('0x2c')]);if(_0x29c47f[_0xe01f('0x27')]>0x0){return _0xddb14b[_0xe01f('0x19')](0x190)[_0xe01f('0x37')](_0x29c47f);}var _0x16ab3c=_0x2fcc0c['body'][_0xe01f('0x2d')];var _0x1643a4=_0x2fcc0c[_0xe01f('0x2c')][_0xe01f('0x38')];return getAgent(_0x16ab3c)['then'](function(_0x36783f){logger[_0xe01f('0x12')](_0xe01f('0x31'),_0x36783f[_0xe01f('0x18')]);emit(util[_0xe01f('0x32')](_0xe01f('0x39'),_0x36783f['name']),_0xe01f('0x3a'),{'sessionId':_0x1643a4});return _0xddb14b[_0xe01f('0x19')](0xc8)[_0xe01f('0x37')]({'error':![],'message':_0xe01f('0x3b')});})[_0xe01f('0x21')](handleError(_0xddb14b));};exports[_0xe01f('0x3c')]=function(_0x861971,_0x305659){logger[_0xe01f('0x12')]('answer\x20fired:',_0x861971['body']);var _0x3dd453=answerValidation[_0xe01f('0x2b')](_0x861971['body']);if(_0x3dd453[_0xe01f('0x27')]>0x0){return _0x305659[_0xe01f('0x19')](0x190)[_0xe01f('0x37')](_0x3dd453);}var _0x5625d8=_0x861971[_0xe01f('0x2c')][_0xe01f('0x2d')];var _0x56785b=_0x861971['body']['sessionId'];return getAgent(_0x5625d8)[_0xe01f('0x1d')](function(_0x53c81b){logger[_0xe01f('0x12')]('entityFound:',_0x53c81b[_0xe01f('0x18')]);emit(util[_0xe01f('0x32')](_0xe01f('0x39'),_0x53c81b[_0xe01f('0x18')]),_0xe01f('0x3d'),{'sessionId':_0x56785b});return _0x305659[_0xe01f('0x19')](0xc8)[_0xe01f('0x37')]({'error':![],'message':_0xe01f('0x3e')});})[_0xe01f('0x21')](handleError(_0x305659));};exports[_0xe01f('0x3f')]=function(_0x18bb53,_0x580df5){logger[_0xe01f('0x12')](_0xe01f('0x40'),_0x18bb53[_0xe01f('0x2c')]);var _0x3c3d64=holdValidation[_0xe01f('0x2b')](_0x18bb53['body']);if(_0x3c3d64[_0xe01f('0x27')]>0x0){return _0x580df5['status'](0x190)['json'](_0x3c3d64);}var _0x25437f=_0x18bb53[_0xe01f('0x2c')][_0xe01f('0x2d')];var _0x1d8614=_0x18bb53[_0xe01f('0x2c')]['sessionId'];return getAgent(_0x25437f)[_0xe01f('0x1d')](function(_0x337c5d){logger[_0xe01f('0x12')](_0xe01f('0x31'),_0x337c5d[_0xe01f('0x18')]);emit(util[_0xe01f('0x32')](_0xe01f('0x39'),_0x337c5d['name']),_0xe01f('0x41'),{'sessionId':_0x1d8614});return _0x580df5['status'](0xc8)[_0xe01f('0x37')]({'error':![],'message':_0xe01f('0x42')});})['catch'](handleError(_0x580df5));};exports[_0xe01f('0x43')]=function(_0x100742,_0x457bb0){logger[_0xe01f('0x12')](_0xe01f('0x44'),_0x100742[_0xe01f('0x2c')]);var _0x5b04b5=unholdValidation['validate'](_0x100742[_0xe01f('0x2c')]);if(_0x5b04b5[_0xe01f('0x27')]>0x0){return _0x457bb0['status'](0x190)[_0xe01f('0x37')](_0x5b04b5);}var _0x38c8ef=_0x100742[_0xe01f('0x2c')][_0xe01f('0x2d')];var _0x56d558=_0x100742[_0xe01f('0x2c')]['sessionId'];return getAgent(_0x38c8ef)[_0xe01f('0x1d')](function(_0xfbce52){logger['info'](_0xe01f('0x31'),_0xfbce52[_0xe01f('0x18')]);emit(util[_0xe01f('0x32')](_0xe01f('0x39'),_0xfbce52[_0xe01f('0x18')]),_0xe01f('0x45'),{'sessionId':_0x56d558});return _0x457bb0['status'](0xc8)[_0xe01f('0x37')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x457bb0));};exports[_0xe01f('0x46')]=function(_0x2d53cb,_0x2161b4){logger[_0xe01f('0x12')](_0xe01f('0x47'),_0x2161b4[_0xe01f('0x2c')]);var _0x3949e1=callsValidation[_0xe01f('0x2b')](_0x2d53cb['body']);if(_0x3949e1['length']>0x0){return _0x2161b4[_0xe01f('0x19')](0x190)['json'](_0x3949e1);}var _0x3ee275=_0x2d53cb[_0xe01f('0x2c')][_0xe01f('0x2d')];var _0x33a11b=respondWithRpcPromise(_0xe01f('0x48'));var _0x4dfb61=getAgent(_0x3ee275);return Promise[_0xe01f('0x49')]([_0x33a11b,_0x4dfb61])[_0xe01f('0x1d')](function(_0x4c6d3f){var _0x3bda53=_0x4c6d3f[0x0];var _0x4dd65c=_0x4c6d3f[0x1];var _0xfb20c6=_['filter'](_0x3bda53[_0xe01f('0x25')],function(_0xe1e5df){return _0xe1e5df[_0xe01f('0x26')]==_0x4dd65c['id'];});return _0x2161b4[_0xe01f('0x19')](0xc8)[_0xe01f('0x37')]({'count':_0xfb20c6[_0xe01f('0x27')],'rows':_0xfb20c6});})[_0xe01f('0x21')](handleError(_0x2161b4));};exports[_0xe01f('0x4a')]=function(_0x5d51e5,_0x1be0f4){logger[_0xe01f('0x12')]('conference\x20fired:',_0x5d51e5[_0xe01f('0x2c')]);var _0x5ca10d=conferenceValidation[_0xe01f('0x2b')](_0x5d51e5[_0xe01f('0x2c')]);if(_0x5ca10d['length']>0x0){return _0x1be0f4[_0xe01f('0x19')](0x190)['json'](_0x5ca10d);}var _0x41c750=_0x5d51e5['body'][_0xe01f('0x2d')];return getAgent(_0x41c750)[_0xe01f('0x1d')](function(_0x141140){logger[_0xe01f('0x12')](_0xe01f('0x31'),_0x141140[_0xe01f('0x18')]);emit(util['format']('user:%s',_0x141140[_0xe01f('0x18')]),'webbar:conference');return _0x1be0f4[_0xe01f('0x19')](0xc8)['json']({'error':![],'message':_0xe01f('0x4b')});})[_0xe01f('0x21')](handleError(_0x1be0f4));};exports[_0xe01f('0x4c')]=function(_0x5a28cc,_0x5e26cb){logger[_0xe01f('0x12')]('transfer\x20fired:',_0x5a28cc['body']);var _0x1a03c6=transferValidation[_0xe01f('0x2b')](_0x5a28cc[_0xe01f('0x2c')]);if(_0x1a03c6[_0xe01f('0x27')]>0x0){return _0x5e26cb[_0xe01f('0x19')](0x190)[_0xe01f('0x37')](_0x1a03c6);}var _0x19b448=_0x5a28cc[_0xe01f('0x2c')][_0xe01f('0x2d')];var _0x526d0a=_0x5a28cc['body']['sessionId'];var _0x47c632=_0x5a28cc[_0xe01f('0x2c')][_0xe01f('0x4d')];return getAgent(_0x19b448)[_0xe01f('0x1d')](function(_0x3e5cb2){logger[_0xe01f('0x12')]('entityFound:',_0x3e5cb2[_0xe01f('0x18')]);emit(util['format'](_0xe01f('0x39'),_0x3e5cb2[_0xe01f('0x18')]),_0xe01f('0x4e'),{'sessionId':_0x526d0a,'transferNumber':_0x47c632});return _0x5e26cb[_0xe01f('0x19')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0xe01f('0x21')](handleError(_0x5e26cb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3b15bd2..4f15fc8 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 _0x01d9=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x1c828f,_0x284cc7){var _0x5a672d=function(_0x32aaf7){while(--_0x32aaf7){_0x1c828f['push'](_0x1c828f['shift']());}};_0x5a672d(++_0x284cc7);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['get'](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x18')]);router[_0x901d('0x19')]('/',auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router['post'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x1b')]);router[_0x901d('0x19')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x19')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1d')]);router[_0x901d('0x19')](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x19')](_0x901d('0x1f'),controller[_0x901d('0x20')]);router['post'](_0x901d('0x21'),auth[_0x901d('0xd')](),controller['send']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x901d('0x22')]);router[_0x901d('0x23')]('/:id',auth[_0x901d('0xd')](),controller[_0x901d('0x24')]);router['delete'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x25')]);router[_0x901d('0x23')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x26')]);router[_0x901d('0x23')]('/:id/users',auth[_0x901d('0xd')](),controller[_0x901d('0x27')]);module[_0x901d('0x28')]=router; \ No newline at end of file +var _0x4991=['isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','create','addDisposition','post','addAnswer','/:id/users','addAgents','notify','send','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe'];(function(_0x5759b5,_0x240c2b){var _0x27a4ee=function(_0x3163ca){while(--_0x3163ca){_0x5759b5['push'](_0x5759b5['shift']());}};_0x27a4ee(++_0x240c2b);}(_0x4991,0xf7));var _0x1499=function(_0x3a99a3,_0x22e8db){_0x3a99a3=_0x3a99a3-0x0;var _0x4aa72d=_0x4991[_0x3a99a3];return _0x4aa72d;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['show']);router[_0x1499('0x9')](_0x1499('0xf'),auth['isAuthenticated'](),controller[_0x1499('0x10')]);router[_0x1499('0x9')]('/:id/canned_answers',auth[_0x1499('0xc')](),controller[_0x1499('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x1499('0x12')]);router[_0x1499('0x9')](_0x1499('0x13'),auth[_0x1499('0xc')](),controller[_0x1499('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1499('0x15')]);router['post'](_0x1499('0xf'),auth[_0x1499('0xc')](),controller[_0x1499('0x16')]);router[_0x1499('0x17')]('/:id/canned_answers',auth[_0x1499('0xc')](),controller[_0x1499('0x18')]);router['post'](_0x1499('0x19'),auth[_0x1499('0xc')](),controller[_0x1499('0x1a')]);router[_0x1499('0x17')](_0x1499('0x13'),auth[_0x1499('0xc')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x1499('0x1b')]);router[_0x1499('0x17')]('/:id/send',auth[_0x1499('0xc')](),controller[_0x1499('0x1c')]);router[_0x1499('0x1d')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x1e')]);router[_0x1499('0x1f')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x20')]);router[_0x1499('0x1f')](_0x1499('0xf'),auth[_0x1499('0xc')](),controller[_0x1499('0x21')]);router[_0x1499('0x1f')](_0x1499('0x22'),auth[_0x1499('0xc')](),controller['removeAnswers']);router[_0x1499('0x1f')](_0x1499('0x19'),auth[_0x1499('0xc')](),controller[_0x1499('0x23')]);module[_0x1499('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 7eb2dd0..43dd64d 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 _0x2695=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','sinch','TEXT','BOOLEAN'];(function(_0x52a94f,_0xf29880){var _0x5df946=function(_0x2885bf){while(--_0x2885bf){_0x52a94f['push'](_0x52a94f['shift']());}};_0x5df946(++_0xf29880);}(_0x2695,0x17c));var _0x5269=function(_0x5eff3c,_0x336039){_0x5eff3c=_0x5eff3c-0x0;var _0x1ecbb4=_0x2695[_0x5eff3c];return _0x1ecbb4;};'use strict';var Sequelize=require(_0x5269('0x0'));var rs=require(_0x5269('0x1'));module[_0x5269('0x2')]={'name':{'type':Sequelize[_0x5269('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5269('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x5269('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x5269('0x3')],'defaultValue':function(){return rs[_0x5269('0x4')]();}},'phone':{'type':Sequelize[_0x5269('0x3')]},'type':{'type':Sequelize[_0x5269('0x5')](_0x5269('0x6'),_0x5269('0x7'))},'accountSid':{'type':Sequelize[_0x5269('0x3')]},'baseUrl':{'type':Sequelize[_0x5269('0x3')]},'authToken':{'type':Sequelize[_0x5269('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5269('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5269('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5269('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5269('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5269('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5269('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5269('0x9')],'defaultValue':![],'comment':_0x5269('0xb'),'set':function(_0x1ec6cc){if(!_0x1ec6cc){this[_0x5269('0xc')](_0x5269('0xd'),null);}this[_0x5269('0xc')](_0x5269('0xe'),_0x1ec6cc);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1256=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM','twilio','sinch','TEXT'];(function(_0x30f630,_0x131a1){var _0x41184d=function(_0x906bbf){while(--_0x906bbf){_0x30f630['push'](_0x30f630['shift']());}};_0x41184d(++_0x131a1);}(_0x1256,0x1e6));var _0x6125=function(_0x86ce09,_0x2c3244){_0x86ce09=_0x86ce09-0x0;var _0x5c00ef=_0x1256[_0x86ce09];return _0x5c00ef;};'use strict';var Sequelize=require(_0x6125('0x0'));var rs=require(_0x6125('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6125('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6125('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6125('0x3')],'defaultValue':function(){return rs[_0x6125('0x4')]();}},'phone':{'type':Sequelize[_0x6125('0x3')]},'type':{'type':Sequelize[_0x6125('0x5')](_0x6125('0x6'),_0x6125('0x7'))},'accountSid':{'type':Sequelize[_0x6125('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6125('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6125('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6125('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6125('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6125('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6125('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6125('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6125('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6125('0xa')],'comment':_0x6125('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x6125('0x9')],'defaultValue':![],'comment':_0x6125('0xc'),'set':function(_0xdab4a1){if(!_0xdab4a1){this[_0x6125('0xd')]('mandatoryDispositionPauseId',null);}this[_0x6125('0xd')](_0x6125('0xe'),_0xdab4a1);}},'description':{'type':Sequelize[_0x6125('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d364ca3..13341b7 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 _0x5f82=['socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','fieldName','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','WhatsappAccount','includeAll','include','findAll','rows','show','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','difference','updatedAt','ListId','mobile','twilio','from','replace','whatsapp:','messageId','MessageSid','sinch','notifications','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost'];(function(_0x7e83fd,_0x214bf4){var _0x4d7a57=function(_0xa221ee){while(--_0xa221ee){_0x7e83fd['push'](_0x7e83fd['shift']());}};_0x4d7a57(++_0x214bf4);}(_0x5f82,0x171));var _0x25f8=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x5f82[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25f8('0x0'));var zipdir=require(_0x25f8('0x1'));var jsonpatch=require(_0x25f8('0x2'));var rp=require('request-promise');var moment=require(_0x25f8('0x3'));var BPromise=require(_0x25f8('0x4'));var Mustache=require(_0x25f8('0x5'));var util=require(_0x25f8('0x6'));var path=require(_0x25f8('0x7'));var sox=require(_0x25f8('0x8'));var csv=require(_0x25f8('0x9'));var ejs=require(_0x25f8('0xa'));var fs=require('fs');var fs_extra=require(_0x25f8('0xb'));var _=require(_0x25f8('0xc'));var squel=require(_0x25f8('0xd'));var crypto=require('crypto');var jsforce=require(_0x25f8('0xe'));var deskjs=require(_0x25f8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x25f8('0x10'));var Papa=require('papaparse');var Redis=require(_0x25f8('0x11'));var authService=require(_0x25f8('0x12'));var qs=require(_0x25f8('0x13'));var as=require(_0x25f8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25f8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x25f8('0x16'));var licenseUtil=require(_0x25f8('0x17'));var db=require(_0x25f8('0x18'))['db'];config[_0x25f8('0x19')]=_['defaults'](config['redis'],{'host':_0x25f8('0x1a'),'port':0x18eb});var socket=require(_0x25f8('0x1b'))(new Redis(config['redis']));require(_0x25f8('0x1c'))[_0x25f8('0x1d')](socket);var jayson=require(_0x25f8('0x1e'));var client=jayson['client'][_0x25f8('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5ddee5,_0x115e9a,_0x360f35,_0x325f25){return new BPromise(function(_0x577651,_0xfc27cf){var _0x3f640e=_0x325f25||client;return _0x3f640e[_0x25f8('0x20')](_0x5ddee5,_0x360f35)[_0x25f8('0x21')](function(_0x5300f9){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x115e9a,'request\x20sent');logger[_0x25f8('0x22')](_0x25f8('0x23'),_0x115e9a,_0x25f8('0x24'),JSON['stringify'](_0x5300f9));if(_0x5300f9['error']){if(_0x5300f9[_0x25f8('0x25')]['code']===0x1f4){logger['error'](_0x25f8('0x26'),_0x115e9a,_0x5300f9[_0x25f8('0x25')]['message']);return _0xfc27cf(_0x5300f9[_0x25f8('0x25')][_0x25f8('0x27')]);}logger[_0x25f8('0x25')](_0x25f8('0x26'),_0x115e9a,_0x5300f9[_0x25f8('0x25')][_0x25f8('0x27')]);return _0x577651(_0x5300f9['error'][_0x25f8('0x27')]);}else{logger[_0x25f8('0x28')](_0x25f8('0x26'),_0x115e9a,_0x25f8('0x24'));_0x577651(_0x5300f9['result']['message']);}})[_0x25f8('0x29')](function(_0x5029aa){logger[_0x25f8('0x25')](_0x25f8('0x26'),_0x115e9a,_0x5029aa);_0xfc27cf(_0x5029aa);});});}function respondWithStatusCode(_0x2ad7d2,_0x5b6a76){_0x5b6a76=_0x5b6a76||0xcc;return function(_0x256403){if(_0x256403){return _0x2ad7d2[_0x25f8('0x2a')](_0x5b6a76);}return _0x2ad7d2[_0x25f8('0x2b')](_0x5b6a76)[_0x25f8('0x2c')]();};}function respondWithResult(_0x59311e,_0x2a86d0){_0x2a86d0=_0x2a86d0||0xc8;return function(_0x3442da){if(_0x3442da){return _0x59311e[_0x25f8('0x2b')](_0x2a86d0)['json'](_0x3442da);}};}function respondWithFilteredResult(_0x5c22c9,_0x1164fc){return function(_0x3ee553){if(_0x3ee553){var _0x54746e=typeof _0x1164fc[_0x25f8('0x2d')]===_0x25f8('0x2e')&&typeof _0x1164fc['limit']===_0x25f8('0x2e');var _0x2278e4=_0x3ee553['count'];var _0x281640=_0x54746e?0x0:_0x1164fc[_0x25f8('0x2d')];var _0x3644ef=_0x54746e?_0x3ee553[_0x25f8('0x2f')]:_0x1164fc[_0x25f8('0x2d')]+_0x1164fc['limit'];var _0x34dbeb;if(_0x3644ef>=_0x2278e4){_0x3644ef=_0x2278e4;_0x34dbeb=0xc8;}else{_0x34dbeb=0xce;}_0x5c22c9[_0x25f8('0x2b')](_0x34dbeb);return _0x5c22c9[_0x25f8('0x30')](_0x25f8('0x31'),_0x281640+'-'+_0x3644ef+'/'+_0x2278e4)[_0x25f8('0x32')](_0x3ee553);}return null;};}function patchUpdates(_0x3f9fb5){return function(_0x9a5ba8){try{jsonpatch[_0x25f8('0x33')](_0x9a5ba8,_0x3f9fb5,!![]);}catch(_0x38e1b8){return BPromise[_0x25f8('0x34')](_0x38e1b8);}return _0x9a5ba8[_0x25f8('0x35')]();};}function saveUpdates(_0x3c454c,_0x31ec3a){return function(_0x5da15c){if(_0x5da15c){return _0x5da15c[_0x25f8('0x36')](_0x3c454c)[_0x25f8('0x21')](function(_0x3dbb57){return _0x3dbb57;});}return null;};}function removeEntity(_0x4addf8,_0x4a18a6){return function(_0x4725c5){if(_0x4725c5){return _0x4725c5[_0x25f8('0x37')]()['then'](function(){var _0x4f0f6c=_0x4725c5['get']({'plain':!![]});var _0x13302b=_0x25f8('0x38');return db[_0x25f8('0x39')][_0x25f8('0x37')]({'where':{'type':_0x13302b,'resourceId':_0x4f0f6c['id']}})['then'](function(){return _0x4725c5;});})[_0x25f8('0x21')](function(){_0x4addf8['status'](0xcc)[_0x25f8('0x2c')]();});}};}function handleEntityNotFound(_0x20e72a,_0x159723){return function(_0xb64db){if(!_0xb64db){_0x20e72a['sendStatus'](0x194);}return _0xb64db;};}function handleError(_0x1c36cc,_0x3bbc4d){_0x3bbc4d=_0x3bbc4d||0x1f4;return function(_0x2c1685){logger[_0x25f8('0x25')](_0x2c1685[_0x25f8('0x3a')]);if(_0x2c1685['name']){delete _0x2c1685[_0x25f8('0x3b')];}_0x1c36cc[_0x25f8('0x2b')](_0x3bbc4d)['send'](_0x2c1685);};}exports['index']=function(_0x1a187e,_0x49fc35){var _0xd01400={'include':[{'model':db[_0x25f8('0x3c')],'as':_0x25f8('0x3d')}]},_0x269152={},_0x16e6f6={'count':0x0,'rows':[]};var _0x32832a=_[_0x25f8('0x3e')](db['WhatsappAccount']['rawAttributes'],function(_0x4bf117){return{'name':_0x4bf117[_0x25f8('0x3f')],'type':_0x4bf117['type'][_0x25f8('0x40')]};});_0x269152['model']=_['map'](_0x32832a,_0x25f8('0x3b'));_0x269152['query']=_[_0x25f8('0x41')](_0x1a187e['query']);_0x269152[_0x25f8('0x42')]=_[_0x25f8('0x43')](_0x269152[_0x25f8('0x44')],_0x269152[_0x25f8('0x45')]);_0xd01400[_0x25f8('0x46')]=_[_0x25f8('0x43')](_0x269152['model'],qs[_0x25f8('0x47')](_0x1a187e[_0x25f8('0x45')][_0x25f8('0x47')]));_0xd01400[_0x25f8('0x46')]=_0xd01400[_0x25f8('0x46')][_0x25f8('0x48')]?_0xd01400[_0x25f8('0x46')]:_0x269152['model'];if(!_0x1a187e[_0x25f8('0x45')][_0x25f8('0x49')](_0x25f8('0x4a'))){_0xd01400[_0x25f8('0x4b')]=qs[_0x25f8('0x4b')](_0x1a187e[_0x25f8('0x45')][_0x25f8('0x4b')]);_0xd01400[_0x25f8('0x2d')]=qs[_0x25f8('0x2d')](_0x1a187e[_0x25f8('0x45')][_0x25f8('0x2d')]);}_0xd01400[_0x25f8('0x4c')]=qs[_0x25f8('0x4d')](_0x1a187e[_0x25f8('0x45')][_0x25f8('0x4d')]);_0xd01400[_0x25f8('0x4e')]=qs[_0x25f8('0x42')](_[_0x25f8('0x4f')](_0x1a187e[_0x25f8('0x45')],_0x269152[_0x25f8('0x42')]),_0x32832a);if(_0x1a187e[_0x25f8('0x45')][_0x25f8('0x50')]){_0xd01400[_0x25f8('0x4e')]=_['merge'](_0xd01400['where'],{'$or':_['map'](_0x32832a,function(_0x4079d7){if(_0x4079d7[_0x25f8('0x51')]!==_0x25f8('0x52')){var _0x115780={};_0x115780[_0x4079d7[_0x25f8('0x3b')]]={'$like':'%'+_0x1a187e['query'][_0x25f8('0x50')]+'%'};return _0x115780;}})});}_0xd01400=_[_0x25f8('0x53')]({},_0xd01400,_0x1a187e[_0x25f8('0x54')]);var _0x590d75={'where':_0xd01400[_0x25f8('0x4e')]};return db[_0x25f8('0x55')][_0x25f8('0x2f')](_0x590d75)[_0x25f8('0x21')](function(_0xf4af2f){_0x16e6f6['count']=_0xf4af2f;if(_0x1a187e['query'][_0x25f8('0x56')]){_0xd01400[_0x25f8('0x57')]=[{'all':!![]}];}return db[_0x25f8('0x55')][_0x25f8('0x58')](_0xd01400);})[_0x25f8('0x21')](function(_0x1802f4){_0x16e6f6[_0x25f8('0x59')]=_0x1802f4;return _0x16e6f6;})[_0x25f8('0x21')](respondWithFilteredResult(_0x49fc35,_0xd01400))[_0x25f8('0x29')](handleError(_0x49fc35,null));};exports[_0x25f8('0x5a')]=function(_0x22287d,_0xec91ba){var _0x1f10b0={'raw':![],'where':{'id':_0x22287d['params']['id']},'include':[{'model':db[_0x25f8('0x3c')],'as':_0x25f8('0x3d')}]},_0x33626d={};_0x33626d[_0x25f8('0x44')]=_[_0x25f8('0x41')](db['WhatsappAccount'][_0x25f8('0x5b')]);_0x33626d[_0x25f8('0x45')]=_[_0x25f8('0x41')](_0x22287d['query']);_0x33626d['filters']=_[_0x25f8('0x43')](_0x33626d['model'],_0x33626d['query']);_0x1f10b0[_0x25f8('0x46')]=_[_0x25f8('0x43')](_0x33626d['model'],qs['fields'](_0x22287d[_0x25f8('0x45')][_0x25f8('0x47')]));_0x1f10b0[_0x25f8('0x46')]=_0x1f10b0['attributes'][_0x25f8('0x48')]?_0x1f10b0[_0x25f8('0x46')]:_0x33626d[_0x25f8('0x44')];if(_0x22287d[_0x25f8('0x45')][_0x25f8('0x56')]){_0x1f10b0[_0x25f8('0x57')]=[{'all':!![]}];}_0x1f10b0=_[_0x25f8('0x53')]({},_0x1f10b0,_0x22287d[_0x25f8('0x54')]);return db[_0x25f8('0x55')][_0x25f8('0x5c')](_0x1f10b0)[_0x25f8('0x21')](handleEntityNotFound(_0xec91ba,null))[_0x25f8('0x21')](respondWithResult(_0xec91ba,null))[_0x25f8('0x29')](handleError(_0xec91ba,null));};exports['create']=function(_0x57c729,_0x3e7eaa){return db[_0x25f8('0x55')][_0x25f8('0x5d')](_0x57c729['body'],{})[_0x25f8('0x21')](function(_0x33cef6){var _0x521a7e=_0x57c729[_0x25f8('0x5e')][_0x25f8('0x5f')]({'plain':!![]});if(!_0x521a7e)throw new Error(_0x25f8('0x60'));if(_0x521a7e[_0x25f8('0x61')]===_0x25f8('0x5e')){var _0x452794=_0x33cef6['get']({'plain':!![]});var _0x5a5148=_0x25f8('0x38');return db['UserProfileSection'][_0x25f8('0x5c')]({'where':{'name':_0x5a5148,'userProfileId':_0x521a7e['userProfileId']},'raw':!![]})[_0x25f8('0x21')](function(_0x5ab475){if(_0x5ab475&&_0x5ab475[_0x25f8('0x62')]===0x0){return db['UserProfileResource'][_0x25f8('0x5d')]({'name':_0x452794[_0x25f8('0x3b')],'resourceId':_0x452794['id'],'type':_0x5ab475[_0x25f8('0x3b')],'sectionId':_0x5ab475['id']},{})['then'](function(){return _0x33cef6;});}else{return _0x33cef6;}})[_0x25f8('0x29')](function(_0x139c8e){logger[_0x25f8('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x139c8e);throw _0x139c8e;});}return _0x33cef6;})[_0x25f8('0x21')](respondWithResult(_0x3e7eaa,0xc9))['catch'](handleError(_0x3e7eaa,null));};exports['update']=function(_0x4e110e,_0x190933){if(_0x4e110e[_0x25f8('0x63')]['id']){delete _0x4e110e[_0x25f8('0x63')]['id'];}return db[_0x25f8('0x55')][_0x25f8('0x5c')]({'where':{'id':_0x4e110e[_0x25f8('0x64')]['id']},'include':[{'model':db[_0x25f8('0x3c')],'as':_0x25f8('0x3d')}]})[_0x25f8('0x21')](handleEntityNotFound(_0x190933,null))[_0x25f8('0x21')](saveUpdates(_0x4e110e[_0x25f8('0x63')],null))[_0x25f8('0x21')](respondWithResult(_0x190933,null))['catch'](handleError(_0x190933,null));};exports[_0x25f8('0x37')]=function(_0x2b2c79,_0x1bce6a){return db[_0x25f8('0x55')][_0x25f8('0x5c')]({'where':{'id':_0x2b2c79[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x1bce6a,null))['then'](removeEntity(_0x1bce6a,null))[_0x25f8('0x29')](handleError(_0x1bce6a,null));};exports[_0x25f8('0x65')]=function(_0x103f9a,_0x57226c){return db[_0x25f8('0x55')][_0x25f8('0x65')]()[_0x25f8('0x21')](respondWithResult(_0x57226c,null))[_0x25f8('0x29')](handleError(_0x57226c,null));};exports[_0x25f8('0x66')]=function(_0x285178,_0x2d3ffc,_0x105f53){if(_0x285178[_0x25f8('0x63')]['id']){delete _0x285178[_0x25f8('0x63')]['id'];}return db[_0x25f8('0x55')]['find']({'where':{'id':_0x285178[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x2d3ffc,null))[_0x25f8('0x21')](function(_0x48ce54){if(_0x48ce54){_0x285178[_0x25f8('0x63')][_0x25f8('0x67')]=_0x48ce54['id'];return db[_0x25f8('0x68')][_0x25f8('0x5d')](_0x285178['body']);}})[_0x25f8('0x21')](respondWithResult(_0x2d3ffc,null))['catch'](handleError(_0x2d3ffc,null));};exports[_0x25f8('0x69')]=function(_0x2240ea,_0x472c29,_0x12e35a){var _0x561b6e={'raw':![],'where':{}};var _0xea948={};var _0x313345={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x2240ea[_0x25f8('0x64')]['id']}})['then'](handleEntityNotFound(_0x472c29,null))['then'](function(_0x224d1d){if(_0x224d1d){_0xea948['model']=_['keys'](db[_0x25f8('0x68')][_0x25f8('0x5b')]);_0xea948['query']=_['keys'](_0x2240ea['query']);_0xea948[_0x25f8('0x42')]=_['intersection'](_0xea948[_0x25f8('0x44')],_0xea948[_0x25f8('0x45')]);_0x561b6e[_0x25f8('0x46')]=_[_0x25f8('0x43')](_0xea948['model'],qs['fields'](_0x2240ea[_0x25f8('0x45')][_0x25f8('0x47')]));_0x561b6e[_0x25f8('0x46')]=_0x561b6e[_0x25f8('0x46')][_0x25f8('0x48')]?_0x561b6e['attributes']:_0xea948[_0x25f8('0x44')];if(!_0x2240ea[_0x25f8('0x45')][_0x25f8('0x49')](_0x25f8('0x4a'))){_0x561b6e[_0x25f8('0x4b')]=qs['limit'](_0x2240ea[_0x25f8('0x45')][_0x25f8('0x4b')]);_0x561b6e['offset']=qs[_0x25f8('0x2d')](_0x2240ea[_0x25f8('0x45')][_0x25f8('0x2d')]);}_0x561b6e[_0x25f8('0x4c')]=qs[_0x25f8('0x4d')](_0x2240ea['query'][_0x25f8('0x4d')]);_0x561b6e[_0x25f8('0x4e')]=qs[_0x25f8('0x42')](_[_0x25f8('0x4f')](_0x2240ea[_0x25f8('0x45')],_0xea948[_0x25f8('0x42')]));_0x561b6e['where'][_0x25f8('0x67')]=_0x224d1d['id'];if(_0x2240ea[_0x25f8('0x45')][_0x25f8('0x50')]){_0x561b6e['where']=_[_0x25f8('0x53')](_0x561b6e[_0x25f8('0x4e')],{'$or':_[_0x25f8('0x3e')](_0x561b6e[_0x25f8('0x46')],function(_0x19d04f){var _0x40259e={};_0x40259e[_0x19d04f]={'$like':'%'+_0x2240ea[_0x25f8('0x45')][_0x25f8('0x50')]+'%'};return _0x40259e;})});}_0x561b6e=_[_0x25f8('0x53')]({},_0x561b6e,_0x2240ea['options']);return db[_0x25f8('0x68')][_0x25f8('0x2f')]({'where':_0x561b6e['where']})[_0x25f8('0x21')](function(_0x99ce04){_0x313345[_0x25f8('0x2f')]=_0x99ce04;if(_0x2240ea[_0x25f8('0x45')]['includeAll']){_0x561b6e[_0x25f8('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x25f8('0x58')](_0x561b6e);})[_0x25f8('0x21')](function(_0x2e3425){_0x313345[_0x25f8('0x59')]=_0x2e3425;return _0x313345;});}})[_0x25f8('0x21')](respondWithFilteredResult(_0x472c29,_0x561b6e))[_0x25f8('0x29')](handleError(_0x472c29,null));};exports[_0x25f8('0x6a')]=function(_0x324347,_0xee4479,_0x599ac3){return db[_0x25f8('0x55')][_0x25f8('0x5c')]({'where':{'id':_0x324347[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0xee4479,null))[_0x25f8('0x21')](function(_0x517caa){if(_0x517caa){return _0x517caa[_0x25f8('0x6a')](_0x324347[_0x25f8('0x45')][_0x25f8('0x6b')]);}})[_0x25f8('0x21')](respondWithStatusCode(_0xee4479,null))[_0x25f8('0x29')](handleError(_0xee4479,null));};exports[_0x25f8('0x6c')]=function(_0x40a97f,_0x2c774f,_0x19c73c){if(_0x40a97f['body']['id']){delete _0x40a97f[_0x25f8('0x63')]['id'];}return db[_0x25f8('0x55')]['find']({'where':{'id':_0x40a97f[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x2c774f,null))[_0x25f8('0x21')](function(_0x315c29){if(_0x315c29){_0x40a97f[_0x25f8('0x63')]['WhatsappAccountId']=_0x315c29['id'];return db[_0x25f8('0x6d')][_0x25f8('0x5d')](_0x40a97f[_0x25f8('0x63')]);}})[_0x25f8('0x21')](respondWithResult(_0x2c774f,null))['catch'](handleError(_0x2c774f,null));};exports[_0x25f8('0x6e')]=function(_0x4306fe,_0x5740db,_0x1cc545){var _0x2a860e={'raw':![],'where':{}};var _0xa4d2de={};var _0x23caa3={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x25f8('0x6f')]({'where':{'id':_0x4306fe[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x5740db,null))[_0x25f8('0x21')](function(_0x56c1e2){if(_0x56c1e2){_0xa4d2de['model']=_[_0x25f8('0x41')](db['CannedAnswer'][_0x25f8('0x5b')]);_0xa4d2de[_0x25f8('0x45')]=_[_0x25f8('0x41')](_0x4306fe[_0x25f8('0x45')]);_0xa4d2de[_0x25f8('0x42')]=_['intersection'](_0xa4d2de[_0x25f8('0x44')],_0xa4d2de[_0x25f8('0x45')]);_0x2a860e[_0x25f8('0x46')]=_[_0x25f8('0x43')](_0xa4d2de[_0x25f8('0x44')],qs['fields'](_0x4306fe[_0x25f8('0x45')]['fields']));_0x2a860e[_0x25f8('0x46')]=_0x2a860e['attributes'][_0x25f8('0x48')]?_0x2a860e[_0x25f8('0x46')]:_0xa4d2de[_0x25f8('0x44')];if(!_0x4306fe[_0x25f8('0x45')][_0x25f8('0x49')](_0x25f8('0x4a'))){_0x2a860e[_0x25f8('0x4b')]=qs[_0x25f8('0x4b')](_0x4306fe[_0x25f8('0x45')]['limit']);_0x2a860e[_0x25f8('0x2d')]=qs[_0x25f8('0x2d')](_0x4306fe['query'][_0x25f8('0x2d')]);}_0x2a860e[_0x25f8('0x4c')]=qs['sort'](_0x4306fe[_0x25f8('0x45')][_0x25f8('0x4d')]);_0x2a860e[_0x25f8('0x4e')]=qs['filters'](_[_0x25f8('0x4f')](_0x4306fe['query'],_0xa4d2de[_0x25f8('0x42')]));_0x2a860e[_0x25f8('0x4e')]['WhatsappAccountId']=_0x56c1e2['id'];if(_0x4306fe[_0x25f8('0x45')][_0x25f8('0x50')]){_0x2a860e[_0x25f8('0x4e')]=_[_0x25f8('0x53')](_0x2a860e['where'],{'$or':_[_0x25f8('0x3e')](_0x2a860e['attributes'],function(_0x5c4e1f){var _0x346e59={};_0x346e59[_0x5c4e1f]={'$like':'%'+_0x4306fe['query'][_0x25f8('0x50')]+'%'};return _0x346e59;})});}_0x2a860e=_[_0x25f8('0x53')]({},_0x2a860e,_0x4306fe['options']);return db[_0x25f8('0x6d')][_0x25f8('0x2f')]({'where':_0x2a860e[_0x25f8('0x4e')]})[_0x25f8('0x21')](function(_0x46741b){_0x23caa3[_0x25f8('0x2f')]=_0x46741b;if(_0x4306fe[_0x25f8('0x45')][_0x25f8('0x56')]){_0x2a860e[_0x25f8('0x57')]=[{'all':!![]}];}return db[_0x25f8('0x6d')][_0x25f8('0x58')](_0x2a860e);})[_0x25f8('0x21')](function(_0x55d5df){_0x23caa3[_0x25f8('0x59')]=_0x55d5df;return _0x23caa3;});}})[_0x25f8('0x21')](respondWithFilteredResult(_0x5740db,_0x2a860e))['catch'](handleError(_0x5740db,null));};exports[_0x25f8('0x70')]=function(_0x364ffa,_0x2b84bb,_0x3e9e4a){return db[_0x25f8('0x55')][_0x25f8('0x5c')]({'where':{'id':_0x364ffa[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x2b84bb,null))[_0x25f8('0x21')](function(_0x36b93f){if(_0x36b93f){return _0x36b93f[_0x25f8('0x70')](_0x364ffa['query'][_0x25f8('0x6b')]);}})[_0x25f8('0x21')](respondWithStatusCode(_0x2b84bb,null))[_0x25f8('0x29')](handleError(_0x2b84bb,null));};exports[_0x25f8('0x71')]=function(_0xc53f4,_0x18908b,_0x359be6){return db[_0x25f8('0x55')][_0x25f8('0x5c')]({'where':{'id':_0xc53f4[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x18908b,null))[_0x25f8('0x21')](function(_0x54c52f){if(_0x54c52f){return _0x54c52f[_0x25f8('0x71')](_0xc53f4[_0x25f8('0x63')][_0x25f8('0x6b')],_[_0x25f8('0x72')](_0xc53f4[_0x25f8('0x63')],[_0x25f8('0x6b'),'id'])||{})[_0x25f8('0x73')](function(_0x4d3193){for(var _0x34dedd=0x0;_0x34dedd<_0xc53f4[_0x25f8('0x63')][_0x25f8('0x6b')]['length'];_0x34dedd+=0x1){socket['emit'](_0x25f8('0x74'),{'UserId':Number(_0xc53f4['body'][_0x25f8('0x6b')][_0x34dedd]),'WhatsappAccountId':Number(_0xc53f4['params']['id'])});}return _0x4d3193;});}})[_0x25f8('0x21')](respondWithResult(_0x18908b,null))[_0x25f8('0x29')](handleError(_0x18908b,null));};exports['removeAgents']=function(_0x5777d0,_0x3d9073,_0x1e261b){return db['WhatsappAccount'][_0x25f8('0x5c')]({'where':{'id':_0x5777d0[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x3d9073,null))['then'](function(_0xfcb2e0){if(_0xfcb2e0){return _0xfcb2e0['removeAgents'](_0x5777d0[_0x25f8('0x45')][_0x25f8('0x6b')])[_0x25f8('0x21')](function(){if(_[_0x25f8('0x75')](_0x5777d0[_0x25f8('0x45')][_0x25f8('0x6b')])){for(var _0x2328c7=0x0;_0x2328c7<_0x5777d0[_0x25f8('0x45')][_0x25f8('0x6b')][_0x25f8('0x48')];_0x2328c7+=0x1){socket[_0x25f8('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x5777d0[_0x25f8('0x45')][_0x25f8('0x6b')][_0x2328c7]),'WhatsappAccountId':Number(_0x5777d0[_0x25f8('0x64')]['id'])});}}else{socket[_0x25f8('0x76')](_0x25f8('0x77'),{'UserId':Number(_0x5777d0[_0x25f8('0x45')][_0x25f8('0x6b')]),'WhatsappAccountId':Number(_0x5777d0['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3d9073,null))[_0x25f8('0x29')](handleError(_0x3d9073,null));};exports[_0x25f8('0x78')]=function(_0x781048,_0x33ee3d,_0x213023){var _0x18d39c={};var _0x5784fb={};var _0x2f900b;var _0x238607;return db[_0x25f8('0x55')][_0x25f8('0x6f')]({'where':{'id':_0x781048[_0x25f8('0x64')]['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x33ee3d,null))[_0x25f8('0x21')](function(_0x5dad41){if(_0x5dad41){_0x2f900b=_0x5dad41;_0x5784fb[_0x25f8('0x44')]=_['keys'](db[_0x25f8('0x79')][_0x25f8('0x5b')]);_0x5784fb[_0x25f8('0x45')]=_[_0x25f8('0x41')](_0x781048[_0x25f8('0x45')]);_0x5784fb[_0x25f8('0x42')]=_['intersection'](_0x5784fb[_0x25f8('0x44')],_0x5784fb[_0x25f8('0x45')]);_0x18d39c['attributes']=_[_0x25f8('0x43')](_0x5784fb[_0x25f8('0x44')],qs[_0x25f8('0x47')](_0x781048[_0x25f8('0x45')][_0x25f8('0x47')]));_0x18d39c[_0x25f8('0x46')]=_0x18d39c[_0x25f8('0x46')][_0x25f8('0x48')]?_0x18d39c[_0x25f8('0x46')]:_0x5784fb[_0x25f8('0x44')];_0x18d39c[_0x25f8('0x4c')]=qs['sort'](_0x781048[_0x25f8('0x45')][_0x25f8('0x4d')]);_0x18d39c[_0x25f8('0x4e')]=qs[_0x25f8('0x42')](_[_0x25f8('0x4f')](_0x781048[_0x25f8('0x45')],_0x5784fb[_0x25f8('0x42')]));if(_0x781048[_0x25f8('0x45')]['filter']){_0x18d39c[_0x25f8('0x4e')]=_['merge'](_0x18d39c[_0x25f8('0x4e')],{'$or':_[_0x25f8('0x3e')](_0x18d39c[_0x25f8('0x46')],function(_0x16c483){var _0x13dd97={};_0x13dd97[_0x16c483]={'$like':'%'+_0x781048['query'][_0x25f8('0x50')]+'%'};return _0x13dd97;})});}_0x18d39c=_['merge']({},_0x18d39c,_0x781048['options']);return _0x2f900b[_0x25f8('0x78')](_0x18d39c);}})[_0x25f8('0x21')](function(_0x5162c0){if(_0x5162c0){_0x238607=_0x5162c0[_0x25f8('0x48')];if(!_0x781048[_0x25f8('0x45')][_0x25f8('0x49')](_0x25f8('0x4a'))){_0x18d39c[_0x25f8('0x4b')]=qs[_0x25f8('0x4b')](_0x781048[_0x25f8('0x45')]['limit']);_0x18d39c['offset']=qs[_0x25f8('0x2d')](_0x781048['query'][_0x25f8('0x2d')]);}return _0x2f900b['getAgents'](_0x18d39c);}})[_0x25f8('0x21')](function(_0x5ad48f){if(_0x5ad48f){return _0x5ad48f?{'count':_0x238607,'rows':_0x5ad48f}:null;}})[_0x25f8('0x21')](respondWithResult(_0x33ee3d,null))[_0x25f8('0x29')](handleError(_0x33ee3d,null));};exports[_0x25f8('0x7a')]=function(_0x472abb,_0x4b44b5){var _0x1d2ebb=_0x472abb['params']['id'];var _0x5c0f7a=_0x472abb[_0x25f8('0x63')];var _0x100b7d=0xc8;var _0x1cd2f1=null;return db[_0x25f8('0x7b')][_0x25f8('0x7c')]({'isolationLevel':db[_0x25f8('0x7b')][_0x25f8('0x7d')][_0x25f8('0x7e')][_0x25f8('0x7f')]},function(_0x1e718b){return db[_0x25f8('0x55')][_0x25f8('0x6f')]({'where':{'id':_0x1d2ebb},'transaction':_0x1e718b})['then'](function(_0x180a09){if(_0x180a09){return db[_0x25f8('0x80')][_0x25f8('0x37')]({'where':{'WhatsappAccountId':_0x1d2ebb},'transaction':_0x1e718b})['then'](function(){var _0x3e5a92=_[_0x25f8('0x3e')](_0x5c0f7a,function(_0x40abc9){_0x40abc9[_0x25f8('0x67')]=_0x1d2ebb;return _0x40abc9;});return db['WhatsappApplication'][_0x25f8('0x81')](_0x3e5a92,{'transaction':_0x1e718b});});}else{_0x100b7d=0x194;_0x1cd2f1=[];}});})[_0x25f8('0x21')](function(){if(_0x100b7d!==0x194){return db[_0x25f8('0x80')][_0x25f8('0x82')]({'where':{'WhatsappAccountId':_0x1d2ebb},'order':_0x25f8('0x83')})[_0x25f8('0x21')](function(_0xc31dfa){_0x1cd2f1=_0xc31dfa;});}})[_0x25f8('0x29')](function(_0x577928){_0x100b7d=0x1f4;logger[_0x25f8('0x25')](_0x577928['stack']);if(_0x577928[_0x25f8('0x3b')]){delete _0x577928[_0x25f8('0x3b')];}_0x1cd2f1=_0x577928;})[_0x25f8('0x84')](function(){if(_0x1cd2f1===null){_0x4b44b5[_0x25f8('0x2a')](_0x100b7d);}else{if(_0x100b7d===0x1f4){_0x4b44b5['status'](_0x100b7d)[_0x25f8('0x85')](_0x1cd2f1);}else{_0x4b44b5[_0x25f8('0x2b')](_0x100b7d)[_0x25f8('0x32')](_0x1cd2f1);}}});};exports[_0x25f8('0x86')]=function(_0x29e2f1,_0x1c88c8,_0x2979a9){var _0x27031d={};var _0x2f2531={};var _0x3adee7;var _0x265eb3;return db[_0x25f8('0x55')][_0x25f8('0x6f')]({'where':{'id':_0x29e2f1['params']['id']}})[_0x25f8('0x21')](handleEntityNotFound(_0x1c88c8,null))[_0x25f8('0x21')](function(_0x416ad3){if(_0x416ad3){_0x3adee7=_0x416ad3;_0x2f2531['model']=_[_0x25f8('0x41')](db[_0x25f8('0x80')][_0x25f8('0x5b')]);_0x2f2531[_0x25f8('0x45')]=_[_0x25f8('0x41')](_0x29e2f1[_0x25f8('0x45')]);_0x2f2531[_0x25f8('0x42')]=_[_0x25f8('0x43')](_0x2f2531[_0x25f8('0x44')],_0x2f2531['query']);_0x27031d['attributes']=_[_0x25f8('0x43')](_0x2f2531[_0x25f8('0x44')],qs['fields'](_0x29e2f1[_0x25f8('0x45')]['fields']));_0x27031d[_0x25f8('0x46')]=_0x27031d[_0x25f8('0x46')][_0x25f8('0x48')]?_0x27031d[_0x25f8('0x46')]:_0x2f2531['model'];_0x27031d[_0x25f8('0x4c')]=qs[_0x25f8('0x4d')](_0x29e2f1['query'][_0x25f8('0x4d')]);_0x27031d['where']=qs[_0x25f8('0x42')](_['pick'](_0x29e2f1[_0x25f8('0x45')],_0x2f2531[_0x25f8('0x42')]));if(_0x29e2f1[_0x25f8('0x45')]['filter']){_0x27031d['where']=_[_0x25f8('0x53')](_0x27031d[_0x25f8('0x4e')],{'$or':_['map'](_0x27031d[_0x25f8('0x46')],function(_0x240a68){var _0x5adca0={};_0x5adca0[_0x240a68]={'$like':'%'+_0x29e2f1[_0x25f8('0x45')]['filter']+'%'};return _0x5adca0;})});}_0x27031d=_[_0x25f8('0x53')]({},_0x27031d,_0x29e2f1[_0x25f8('0x54')]);return _0x3adee7[_0x25f8('0x86')](_0x27031d);}})[_0x25f8('0x21')](function(_0x1227ce){if(_0x1227ce){_0x265eb3=_0x1227ce['length'];if(!_0x29e2f1[_0x25f8('0x45')]['hasOwnProperty'](_0x25f8('0x4a'))){_0x27031d[_0x25f8('0x4b')]=qs[_0x25f8('0x4b')](_0x29e2f1[_0x25f8('0x45')]['limit']);_0x27031d[_0x25f8('0x2d')]=qs[_0x25f8('0x2d')](_0x29e2f1[_0x25f8('0x45')]['offset']);}return _0x3adee7[_0x25f8('0x86')](_0x27031d);}})[_0x25f8('0x21')](function(_0x586651){if(_0x586651){return _0x586651?{'count':_0x265eb3,'rows':_0x586651}:null;}})[_0x25f8('0x21')](respondWithResult(_0x1c88c8,null))[_0x25f8('0x29')](handleError(_0x1c88c8,null));};exports['notify']=function(_0x4f78fc,_0x537c09,_0x1a9601){var _0x3d217a={'channel':_0x25f8('0x87')};var _0x123a57=[];var _0x2af0b8=[];var _0x5214da={};return db['WhatsappAccount'][_0x25f8('0x5c')]({'where':{'id':_0x4f78fc[_0x25f8('0x64')]['id']},'include':[{'model':db[_0x25f8('0x80')],'as':_0x25f8('0x88')}]})[_0x25f8('0x21')](handleEntityNotFound(_0x537c09,null))[_0x25f8('0x21')](function(_0x5cda63){_0x3d217a[_0x25f8('0x89')]=_0x5cda63;if(_0x3d217a[_0x25f8('0x89')]&&_0x3d217a['account']['type']==='sinch'&&_0x4f78fc[_0x25f8('0x63')][_0x25f8('0x8a')]){if(_0x4f78fc['body'][_0x25f8('0x8a')][_0x25f8('0x48')]===0x0)return;if(_0x4f78fc[_0x25f8('0x63')][_0x25f8('0x8a')][0x0][_0x25f8('0x8b')]!==_0x25f8('0x8c'))return;return db[_0x25f8('0x8d')][_0x25f8('0x36')]({'read':!![],'readAt':_0x4f78fc[_0x25f8('0x63')][_0x25f8('0x8a')][0x0][_0x25f8('0x8e')]},{'where':{'messageId':_0x4f78fc[_0x25f8('0x63')][_0x25f8('0x8a')][0x0][_0x25f8('0x8f')]},'individualHooks':!![]})['then'](function(_0x4f30ce){return _0x537c09[_0x25f8('0x2b')](0xc8)[_0x25f8('0x32')](_0x4f30ce);});}_0x3d217a[_0x25f8('0x90')]=_['orderBy'](_0x5cda63[_0x25f8('0x88')],[_0x25f8('0x83')],[_0x25f8('0x91')]);if(_0x3d217a[_0x25f8('0x89')][_0x25f8('0x88')]){delete _0x3d217a[_0x25f8('0x89')]['Applications'];}return db[_0x25f8('0x92')]['describe']()[_0x25f8('0x21')](function(_0x207cf3){if(!_0x207cf3){throw new db[(_0x25f8('0x93'))]['ValidationError']('no\x20available\x20attributes');}_0x123a57=_[_0x25f8('0x94')](_[_0x25f8('0x41')](_0x207cf3),['createdAt','updatedAt']);_0x2af0b8=_[_0x25f8('0x94')](_[_0x25f8('0x41')](_0x207cf3),['createdAt',_0x25f8('0x95'),'CompanyId',_0x25f8('0x96')]);_0x3d217a['body']={'mapKey':_0x25f8('0x97')};if(_0x3d217a['account']&&_0x3d217a['account'][_0x25f8('0x51')]===_0x25f8('0x98')){_0x3d217a['body'][_0x25f8('0x99')]=_0x4f78fc['body']['From'][_0x25f8('0x9a')](_0x25f8('0x9b'),'');_0x3d217a[_0x25f8('0x63')][_0x25f8('0x63')]=_0x4f78fc[_0x25f8('0x63')]['Body'];_0x3d217a[_0x25f8('0x63')][_0x25f8('0x9c')]=_0x4f78fc[_0x25f8('0x63')][_0x25f8('0x9d')];}if(_0x3d217a[_0x25f8('0x89')]&&_0x3d217a['account'][_0x25f8('0x51')]===_0x25f8('0x9e')){_0x3d217a[_0x25f8('0x63')][_0x25f8('0x99')]=_0x4f78fc[_0x25f8('0x63')][_0x25f8('0x9f')][0x0][_0x25f8('0x99')];_0x3d217a['body'][_0x25f8('0x63')]=_0x4f78fc[_0x25f8('0x63')][_0x25f8('0x9f')][0x0][_0x25f8('0x27')][_0x25f8('0x63')];_0x3d217a['body'][_0x25f8('0x9c')]=_0x4f78fc['body'][_0x25f8('0x9f')][0x0][_0x25f8('0x8f')];}if(_0x3d217a[_0x25f8('0x63')]['id']){delete _0x3d217a[_0x25f8('0x63')]['id'];}if(_['isNil'](_0x3d217a[_0x25f8('0x63')][_0x25f8('0x99')])){throw new db[(_0x25f8('0x93'))][(_0x25f8('0xa0'))](_0x25f8('0xa1'));}if(_['isNil'](_0x3d217a[_0x25f8('0x63')][_0x25f8('0x63')])||_0x3d217a[_0x25f8('0x63')][_0x25f8('0x63')]===''){throw new db[(_0x25f8('0x93'))][(_0x25f8('0xa0'))](_0x25f8('0xa2'));}if(_[_0x25f8('0xa3')](_0x3d217a[_0x25f8('0x63')][_0x25f8('0xa4')])){throw new db[(_0x25f8('0x93'))][(_0x25f8('0xa0'))](_0x25f8('0xa5')+_0x2af0b8);}if(!_[_0x25f8('0xa6')](_0x2af0b8,_0x3d217a['body']['mapKey'])){throw new db[(_0x25f8('0x93'))][(_0x25f8('0xa0'))](_0x25f8('0xa7')+_0x2af0b8);}_0x5214da[_0x3d217a[_0x25f8('0x63')]['mapKey']]=_0x3d217a[_0x25f8('0x63')]['from'];return db[_0x25f8('0xa8')][_0x25f8('0x5c')]({'where':{'id':_0x3d217a[_0x25f8('0x89')][_0x25f8('0x96')]},'include':[{'model':db[_0x25f8('0x92')],'as':_0x25f8('0xa9'),'where':_0x5214da,'limit':0x1,'order':[[_0x25f8('0x95'),_0x25f8('0xaa')]]}]});})[_0x25f8('0x21')](handleEntityNotFound(_0x537c09,null))['then'](function(_0x4a0be3){if(_0x4a0be3){_0x3d217a[_0x25f8('0xab')]=_[_0x25f8('0x72')](_0x4a0be3,[_0x25f8('0xa9')]);if(_0x4a0be3['Contacts'][_0x25f8('0x48')]){return _0x4a0be3[_0x25f8('0xa9')][0x0];}var _0x5a3d21=_[_0x25f8('0xac')](_0x3d217a[_0x25f8('0x63')],{'firstName':_0x3d217a[_0x25f8('0x63')][_0x25f8('0x99')],'ListId':_0x4a0be3['id']});_0x5a3d21[_0x3d217a['body'][_0x25f8('0xa4')]]=_0x3d217a['body'][_0x25f8('0x99')];return db[_0x25f8('0x92')][_0x25f8('0x5d')](_0x5a3d21,{'fields':_0x123a57,'raw':!![]});}})[_0x25f8('0x21')](handleEntityNotFound(_0x537c09,null))[_0x25f8('0x21')](function(_0x3eadbd){if(_0x3eadbd){_0x3d217a[_0x25f8('0xad')]=_0x3eadbd;var _0x40bf59={'ContactId':_0x3eadbd['id'],'phone':_0x3d217a[_0x25f8('0x63')][_0x25f8('0x99')],'WhatsappAccountId':_0x4f78fc['params']['id']};var _0x5e34ab={'ContactId':_0x3eadbd['id'],'WhatsappAccountId':_0x4f78fc['params']['id'],'closed':![]};return db[_0x25f8('0xae')]['find']({'where':_0x5e34ab})[_0x25f8('0x21')](function(_0x54a43f){if(_0x54a43f){return[_0x54a43f,![]];}return db[_0x25f8('0xae')][_0x25f8('0x5d')](_0x40bf59)['then'](function(_0x28061a){return[_0x28061a,!![]];});});}})[_0x25f8('0x73')](function(_0x396330,_0x441cad){_0x3d217a[_0x25f8('0xaf')]=_0x396330['get']({'plain':!![]});_0x3d217a['interaction'][_0x25f8('0xb0')]=![];if(_0x441cad){if(_0x3d217a[_0x25f8('0x89')][_0x25f8('0xb1')]){_0x3d217a['applications']['push']({'id':0x0,'priority':_0x3d217a[_0x25f8('0x90')]['length']+0x1,'app':_0x25f8('0xb2'),'appdata':_0x25f8('0xb3'),'interval':_0x25f8('0xb4')});}_0x3d217a['interaction']['created']=!![];}return db[_0x25f8('0x8d')]['create']({'phone':_0x3d217a[_0x25f8('0x63')][_0x25f8('0x99')],'messageId':_0x3d217a[_0x25f8('0x63')][_0x25f8('0x9c')],'body':_0x3d217a[_0x25f8('0x63')][_0x25f8('0x63')],'WhatsappAccountId':_0x4f78fc[_0x25f8('0x64')]['id'],'WhatsappInteractionId':_0x396330['id'],'direction':'in','ContactId':_0x396330[_0x25f8('0xb5')],'AttachmentId':_0x3d217a[_0x25f8('0x63')]['AttachmentId']});})[_0x25f8('0x21')](function(_0xa42d85){_0x3d217a['message']=_0xa42d85;if(_0x3d217a[_0x25f8('0xaf')][_0x25f8('0xb6')]){return db[_0x25f8('0x79')]['find']({'attributes':['id',_0x25f8('0x3b')],'where':{'id':_0x3d217a[_0x25f8('0xaf')][_0x25f8('0xb6')]}})[_0x25f8('0x21')](function(_0x3aee02){if(_0x3aee02){_0x3d217a['applications'][_0x25f8('0xb7')]({'id':0x0,'priority':0x0,'app':_0x25f8('0xb8'),'appdata':_0x3aee02['name']+','+(_0x3d217a[_0x25f8('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0x25f8('0xb4')});}return respondWithRpcPromise(_0x25f8('0xb9'),_0x25f8('0xba'),_0x3d217a);});}return respondWithRpcPromise('Start',_0x25f8('0xba'),_0x3d217a);})[_0x25f8('0x21')](function(_0x37d7b8){if(_0x37d7b8){var _0x51e211=0xc8;var _0x409a8e=_0x25f8('0xbb');logger[_0x25f8('0x28')](_0x25f8('0x23'),_0x409a8e,_0x51e211,_0x25f8('0xbc'));logger[_0x25f8('0x22')](_0x25f8('0xbd'),_0x409a8e,_0x51e211,_0x25f8('0xbc'),JSON['stringify'](_0x37d7b8));if(_0x3d217a['account'][_0x25f8('0x51')]==='twilio'){return _0x537c09['status'](_0x51e211)[_0x25f8('0x30')](_0x25f8('0xbe'),'text/xml')[_0x25f8('0x85')](_0x25f8('0xbf'));}else{return _0x537c09[_0x25f8('0x2b')](_0x51e211)[_0x25f8('0x32')](_0x37d7b8);}}});})[_0x25f8('0x29')](handleError(_0x537c09,null));};exports[_0x25f8('0x85')]=function(_0x1d6384,_0x344403,_0x2acb3f){var _0x402b41,_0x159d13,_0x3cd3a1;if(_[_0x25f8('0xa3')](_0x1d6384[_0x25f8('0x63')][_0x25f8('0x63')])||_0x1d6384['body'][_0x25f8('0x63')]===''){throw new db[(_0x25f8('0x93'))][(_0x25f8('0xa0'))](_0x25f8('0xa2'));}if(_[_0x25f8('0xa3')](_0x1d6384[_0x25f8('0x63')]['to'])){throw new db[(_0x25f8('0x93'))]['ValidationError'](_0x25f8('0xc0'));}_0x402b41=_0x1d6384['body']['to'];return db[_0x25f8('0x55')][_0x25f8('0x5c')]({'where':{'id':_0x1d6384[_0x25f8('0x64')]['id']},'include':[{'model':db[_0x25f8('0xa8')],'as':_0x25f8('0xc1'),'include':[{'model':db[_0x25f8('0x92')],'as':_0x25f8('0xa9'),'where':{'mobile':_0x402b41},'limit':0x1,'order':[[_0x25f8('0x95'),_0x25f8('0xaa')]]}]}]})[_0x25f8('0x21')](handleEntityNotFound(_0x344403,null))['then'](function(_0x5df2c1){if(_0x5df2c1&&_0x5df2c1[_0x25f8('0xc1')]){_0x159d13=_0x5df2c1['get']({'plain':!![]});if(_0x159d13['List']&&_0x159d13['List'][_0x25f8('0xa9')][_0x25f8('0x48')]){return _0x159d13['List']['Contacts'][0x0];}return db[_0x25f8('0x92')][_0x25f8('0x5d')](_[_0x25f8('0xac')](_0x1d6384[_0x25f8('0x63')],{'firstName':_0x402b41,'mobile':_0x402b41,'phone':_0x402b41,'ListId':_0x159d13['ListId']}));}})[_0x25f8('0x21')](handleEntityNotFound(_0x344403,null))['then'](function(_0x27e58d){if(_0x27e58d){_0x3cd3a1=_0x27e58d;return db['WhatsappInteraction'][_0x25f8('0x5c')]({'where':{'ContactId':_0x3cd3a1['id'],'closed':![],'WhatsappAccountId':_0x159d13['id']}})['then'](function(_0x4a4895){if(_0x4a4895){return[_0x4a4895,![]];}return db[_0x25f8('0xae')][_0x25f8('0x5d')]({'UserId':_0x1d6384[_0x25f8('0x5e')]['id'],'ContactId':_0x3cd3a1['id'],'WhatsappAccountId':_0x159d13['id'],'phone':_0x402b41,'firstMsgDirection':_0x25f8('0xc2'),'Messages':[_[_0x25f8('0x53')](_0x1d6384['body'],{'read':![],'body':_0x1d6384['body']['body'],'phone':_0x402b41,'WhatsappAccountId':_0x159d13['id'],'UserId':_0x1d6384[_0x25f8('0x5e')]['id'],'ContactId':_0x3cd3a1['id']})]},{'include':[{'model':db[_0x25f8('0x8d')],'as':_0x25f8('0xc3')}]})[_0x25f8('0x21')](function(_0x27d0b7){return[_0x27d0b7,!![]];});});}})[_0x25f8('0x73')](function(_0x325925,_0x47f42e){if(_0x47f42e){return _0x325925;}return db[_0x25f8('0x8d')]['create'](_[_0x25f8('0x53')](_0x1d6384[_0x25f8('0x63')],{'read':![],'body':_0x1d6384[_0x25f8('0x63')][_0x25f8('0x63')],'phone':_0x402b41,'WhatsappAccountId':_0x159d13['id'],'WhatsappInteractionId':_0x325925['id'],'UserId':_0x1d6384['user']['id'],'ContactId':_0x3cd3a1['id']}))[_0x25f8('0x21')](function(_0x46f709){_0x325925['dataValues'][_0x25f8('0xc3')]=[];_0x325925[_0x25f8('0xc4')]['Messages'][_0x25f8('0xc5')](_0x46f709[_0x25f8('0xc4')]);return _0x325925;});})[_0x25f8('0x21')](respondWithResult(_0x344403,null))[_0x25f8('0x29')](handleError(_0x344403,null));}; \ No newline at end of file +var _0xe2c4=['mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','CmList','List','WhatsappInteraction','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','map','WhatsappAccount','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','length','removeDispositions','ids','addAnswer','getAnswers','findOne','options','CannedAnswer','removeAnswers','addAgents','omit','spread','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','User','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','priority','asc','CmContact','difference','updatedAt','ListId','mobile','twilio','from','From','whatsapp:','notifications','messageId','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x157a36,_0x1aa5dc){var _0x2a717f=function(_0x6efff8){while(--_0x6efff8){_0x157a36['push'](_0x157a36['shift']());}};_0x2a717f(++_0x1aa5dc);}(_0xe2c4,0xde));var _0x4e2c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe2c4[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x4e2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e2c('0x1'));var jsonpatch=require(_0x4e2c('0x2'));var rp=require(_0x4e2c('0x3'));var moment=require(_0x4e2c('0x4'));var BPromise=require(_0x4e2c('0x5'));var Mustache=require(_0x4e2c('0x6'));var util=require(_0x4e2c('0x7'));var path=require('path');var sox=require(_0x4e2c('0x8'));var csv=require(_0x4e2c('0x9'));var ejs=require(_0x4e2c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4e2c('0xb'));var crypto=require(_0x4e2c('0xc'));var jsforce=require(_0x4e2c('0xd'));var deskjs=require(_0x4e2c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4e2c('0xf'));var Papa=require(_0x4e2c('0x10'));var Redis=require(_0x4e2c('0x11'));var authService=require(_0x4e2c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4e2c('0x13'));var hardwareService=require(_0x4e2c('0x14'));var logger=require(_0x4e2c('0x15'))(_0x4e2c('0x16'));var utils=require('../../config/utils');var config=require(_0x4e2c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e2c('0x18'))['db'];config[_0x4e2c('0x19')]=_[_0x4e2c('0x1a')](config['redis'],{'host':_0x4e2c('0x1b'),'port':0x18eb});var socket=require(_0x4e2c('0x1c'))(new Redis(config['redis']));require(_0x4e2c('0x1d'))['register'](socket);var jayson=require(_0x4e2c('0x1e'));var client=jayson[_0x4e2c('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5c90bc,_0x303d67,_0x1c5bc7,_0x5cd796){return new BPromise(function(_0x231257,_0x3c0315){var _0x3a2d32=_0x5cd796||client;return _0x3a2d32[_0x4e2c('0x20')](_0x5c90bc,_0x1c5bc7)[_0x4e2c('0x21')](function(_0x407b1e){logger[_0x4e2c('0x22')](_0x4e2c('0x23'),_0x303d67,_0x4e2c('0x24'));logger[_0x4e2c('0x25')](_0x4e2c('0x26'),_0x303d67,'request\x20sent',JSON['stringify'](_0x407b1e));if(_0x407b1e['error']){if(_0x407b1e[_0x4e2c('0x27')][_0x4e2c('0x28')]===0x1f4){logger[_0x4e2c('0x27')](_0x4e2c('0x23'),_0x303d67,_0x407b1e[_0x4e2c('0x27')][_0x4e2c('0x29')]);return _0x3c0315(_0x407b1e[_0x4e2c('0x27')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x303d67,_0x407b1e['error'][_0x4e2c('0x29')]);return _0x231257(_0x407b1e['error'][_0x4e2c('0x29')]);}else{logger[_0x4e2c('0x22')](_0x4e2c('0x23'),_0x303d67,_0x4e2c('0x24'));_0x231257(_0x407b1e[_0x4e2c('0x2a')][_0x4e2c('0x29')]);}})[_0x4e2c('0x2b')](function(_0x5ebf51){logger[_0x4e2c('0x27')](_0x4e2c('0x23'),_0x303d67,_0x5ebf51);_0x3c0315(_0x5ebf51);});});}function respondWithStatusCode(_0xb14b5,_0x30a10f){_0x30a10f=_0x30a10f||0xcc;return function(_0x44adf0){if(_0x44adf0){return _0xb14b5[_0x4e2c('0x2c')](_0x30a10f);}return _0xb14b5[_0x4e2c('0x2d')](_0x30a10f)[_0x4e2c('0x2e')]();};}function respondWithResult(_0x639812,_0x25c2b3){_0x25c2b3=_0x25c2b3||0xc8;return function(_0x4bca73){if(_0x4bca73){return _0x639812[_0x4e2c('0x2d')](_0x25c2b3)[_0x4e2c('0x2f')](_0x4bca73);}};}function respondWithFilteredResult(_0x162c6c,_0x555cef){return function(_0x3be4ca){if(_0x3be4ca){var _0x114cba=typeof _0x555cef[_0x4e2c('0x30')]===_0x4e2c('0x31')&&typeof _0x555cef[_0x4e2c('0x32')]===_0x4e2c('0x31');var _0x545353=_0x3be4ca[_0x4e2c('0x33')];var _0x516bb9=_0x114cba?0x0:_0x555cef[_0x4e2c('0x30')];var _0x4eacfc=_0x114cba?_0x3be4ca[_0x4e2c('0x33')]:_0x555cef['offset']+_0x555cef[_0x4e2c('0x32')];var _0x20dca4;if(_0x4eacfc>=_0x545353){_0x4eacfc=_0x545353;_0x20dca4=0xc8;}else{_0x20dca4=0xce;}_0x162c6c['status'](_0x20dca4);return _0x162c6c[_0x4e2c('0x34')](_0x4e2c('0x35'),_0x516bb9+'-'+_0x4eacfc+'/'+_0x545353)[_0x4e2c('0x2f')](_0x3be4ca);}return null;};}function patchUpdates(_0x5716d4){return function(_0x2badb9){try{jsonpatch[_0x4e2c('0x36')](_0x2badb9,_0x5716d4,!![]);}catch(_0x334c7f){return BPromise['reject'](_0x334c7f);}return _0x2badb9['save']();};}function saveUpdates(_0x16e207,_0x53053f){return function(_0x5d600c){if(_0x5d600c){return _0x5d600c[_0x4e2c('0x37')](_0x16e207)[_0x4e2c('0x21')](function(_0x47a89d){return _0x47a89d;});}return null;};}function removeEntity(_0x59bfb6,_0x2be150){return function(_0x8c072b){if(_0x8c072b){return _0x8c072b[_0x4e2c('0x38')]()[_0x4e2c('0x21')](function(){var _0x16e93a=_0x8c072b[_0x4e2c('0x39')]({'plain':!![]});var _0x17d495='WhatsappAccounts';return db[_0x4e2c('0x3a')]['destroy']({'where':{'type':_0x17d495,'resourceId':_0x16e93a['id']}})['then'](function(){return _0x8c072b;});})[_0x4e2c('0x21')](function(){_0x59bfb6[_0x4e2c('0x2d')](0xcc)[_0x4e2c('0x2e')]();});}};}function handleEntityNotFound(_0x18552f,_0x17b6df){return function(_0x408a79){if(!_0x408a79){_0x18552f['sendStatus'](0x194);}return _0x408a79;};}function handleError(_0x3d83f9,_0x228084){_0x228084=_0x228084||0x1f4;return function(_0x498aef){logger[_0x4e2c('0x27')](_0x498aef[_0x4e2c('0x3b')]);if(_0x498aef[_0x4e2c('0x3c')]){delete _0x498aef[_0x4e2c('0x3c')];}_0x3d83f9['status'](_0x228084)[_0x4e2c('0x3d')](_0x498aef);};}exports[_0x4e2c('0x3e')]=function(_0x4e040d,_0x37a058){var _0x51e7a4={'include':[{'model':db[_0x4e2c('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1f6296={},_0x525ef9={'count':0x0,'rows':[]};var _0xdd3473=_[_0x4e2c('0x40')](db[_0x4e2c('0x41')]['rawAttributes'],function(_0x2f7f4b){return{'name':_0x2f7f4b['fieldName'],'type':_0x2f7f4b['type'][_0x4e2c('0x42')]};});_0x1f6296[_0x4e2c('0x43')]=_[_0x4e2c('0x40')](_0xdd3473,_0x4e2c('0x3c'));_0x1f6296[_0x4e2c('0x44')]=_[_0x4e2c('0x45')](_0x4e040d[_0x4e2c('0x44')]);_0x1f6296[_0x4e2c('0x46')]=_[_0x4e2c('0x47')](_0x1f6296[_0x4e2c('0x43')],_0x1f6296[_0x4e2c('0x44')]);_0x51e7a4['attributes']=_['intersection'](_0x1f6296[_0x4e2c('0x43')],qs[_0x4e2c('0x48')](_0x4e040d['query'][_0x4e2c('0x48')]));_0x51e7a4[_0x4e2c('0x49')]=_0x51e7a4[_0x4e2c('0x49')]['length']?_0x51e7a4[_0x4e2c('0x49')]:_0x1f6296[_0x4e2c('0x43')];if(!_0x4e040d['query'][_0x4e2c('0x4a')](_0x4e2c('0x4b'))){_0x51e7a4[_0x4e2c('0x32')]=qs[_0x4e2c('0x32')](_0x4e040d[_0x4e2c('0x44')][_0x4e2c('0x32')]);_0x51e7a4['offset']=qs[_0x4e2c('0x30')](_0x4e040d['query'][_0x4e2c('0x30')]);}_0x51e7a4[_0x4e2c('0x4c')]=qs[_0x4e2c('0x4d')](_0x4e040d[_0x4e2c('0x44')]['sort']);_0x51e7a4[_0x4e2c('0x4e')]=qs[_0x4e2c('0x46')](_[_0x4e2c('0x4f')](_0x4e040d['query'],_0x1f6296[_0x4e2c('0x46')]),_0xdd3473);if(_0x4e040d['query']['filter']){_0x51e7a4[_0x4e2c('0x4e')]=_[_0x4e2c('0x50')](_0x51e7a4['where'],{'$or':_['map'](_0xdd3473,function(_0x81e80a){if(_0x81e80a[_0x4e2c('0x51')]!==_0x4e2c('0x52')){var _0x9dd709={};_0x9dd709[_0x81e80a[_0x4e2c('0x3c')]]={'$like':'%'+_0x4e040d[_0x4e2c('0x44')][_0x4e2c('0x53')]+'%'};return _0x9dd709;}})});}_0x51e7a4=_['merge']({},_0x51e7a4,_0x4e040d['options']);var _0x31387b={'where':_0x51e7a4[_0x4e2c('0x4e')]};return db[_0x4e2c('0x41')]['count'](_0x31387b)[_0x4e2c('0x21')](function(_0xd944f){_0x525ef9[_0x4e2c('0x33')]=_0xd944f;if(_0x4e040d[_0x4e2c('0x44')][_0x4e2c('0x54')]){_0x51e7a4[_0x4e2c('0x55')]=[{'all':!![]}];}return db[_0x4e2c('0x41')][_0x4e2c('0x56')](_0x51e7a4);})[_0x4e2c('0x21')](function(_0x2d9a0e){_0x525ef9[_0x4e2c('0x57')]=_0x2d9a0e;return _0x525ef9;})[_0x4e2c('0x21')](respondWithFilteredResult(_0x37a058,_0x51e7a4))[_0x4e2c('0x2b')](handleError(_0x37a058,null));};exports[_0x4e2c('0x58')]=function(_0x48d4ed,_0x1062f5){var _0x17281b={'raw':![],'where':{'id':_0x48d4ed[_0x4e2c('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x4e2c('0x5a')}]},_0x3f028a={};_0x3f028a[_0x4e2c('0x43')]=_[_0x4e2c('0x45')](db['WhatsappAccount'][_0x4e2c('0x5b')]);_0x3f028a[_0x4e2c('0x44')]=_[_0x4e2c('0x45')](_0x48d4ed[_0x4e2c('0x44')]);_0x3f028a[_0x4e2c('0x46')]=_[_0x4e2c('0x47')](_0x3f028a[_0x4e2c('0x43')],_0x3f028a[_0x4e2c('0x44')]);_0x17281b['attributes']=_['intersection'](_0x3f028a[_0x4e2c('0x43')],qs['fields'](_0x48d4ed[_0x4e2c('0x44')][_0x4e2c('0x48')]));_0x17281b[_0x4e2c('0x49')]=_0x17281b[_0x4e2c('0x49')]['length']?_0x17281b['attributes']:_0x3f028a['model'];if(_0x48d4ed[_0x4e2c('0x44')][_0x4e2c('0x54')]){_0x17281b[_0x4e2c('0x55')]=[{'all':!![]}];}_0x17281b=_['merge']({},_0x17281b,_0x48d4ed['options']);return db['WhatsappAccount'][_0x4e2c('0x5c')](_0x17281b)[_0x4e2c('0x21')](handleEntityNotFound(_0x1062f5,null))['then'](respondWithResult(_0x1062f5,null))['catch'](handleError(_0x1062f5,null));};exports[_0x4e2c('0x5d')]=function(_0xeca05e,_0x44be76){return db['WhatsappAccount'][_0x4e2c('0x5d')](_0xeca05e['body'],{})['then'](function(_0x549674){var _0x2cc788=_0xeca05e[_0x4e2c('0x5e')]['get']({'plain':!![]});if(!_0x2cc788)throw new Error(_0x4e2c('0x5f'));if(_0x2cc788[_0x4e2c('0x60')]===_0x4e2c('0x5e')){var _0x56b7ef=_0x549674['get']({'plain':!![]});var _0x41c445=_0x4e2c('0x61');return db[_0x4e2c('0x62')][_0x4e2c('0x5c')]({'where':{'name':_0x41c445,'userProfileId':_0x2cc788[_0x4e2c('0x63')]},'raw':!![]})[_0x4e2c('0x21')](function(_0x22306c){if(_0x22306c&&_0x22306c['autoAssociation']===0x0){return db[_0x4e2c('0x3a')]['create']({'name':_0x56b7ef[_0x4e2c('0x3c')],'resourceId':_0x56b7ef['id'],'type':_0x22306c['name'],'sectionId':_0x22306c['id']},{})[_0x4e2c('0x21')](function(){return _0x549674;});}else{return _0x549674;}})['catch'](function(_0x2285e9){logger[_0x4e2c('0x27')](_0x4e2c('0x64'),_0x2285e9);throw _0x2285e9;});}return _0x549674;})['then'](respondWithResult(_0x44be76,0xc9))['catch'](handleError(_0x44be76,null));};exports[_0x4e2c('0x37')]=function(_0x75a4cf,_0x5d0160){if(_0x75a4cf[_0x4e2c('0x65')]['id']){delete _0x75a4cf[_0x4e2c('0x65')]['id'];}return db['WhatsappAccount'][_0x4e2c('0x5c')]({'where':{'id':_0x75a4cf[_0x4e2c('0x59')]['id']},'include':[{'model':db[_0x4e2c('0x3f')],'as':_0x4e2c('0x5a')}]})[_0x4e2c('0x21')](handleEntityNotFound(_0x5d0160,null))[_0x4e2c('0x21')](saveUpdates(_0x75a4cf['body'],null))[_0x4e2c('0x21')](respondWithResult(_0x5d0160,null))['catch'](handleError(_0x5d0160,null));};exports[_0x4e2c('0x38')]=function(_0x4dcab1,_0x34a8f8){return db[_0x4e2c('0x41')][_0x4e2c('0x5c')]({'where':{'id':_0x4dcab1['params']['id']}})[_0x4e2c('0x21')](handleEntityNotFound(_0x34a8f8,null))[_0x4e2c('0x21')](removeEntity(_0x34a8f8,null))[_0x4e2c('0x2b')](handleError(_0x34a8f8,null));};exports[_0x4e2c('0x66')]=function(_0xeb0eee,_0x151ce7){return db['WhatsappAccount'][_0x4e2c('0x66')]()['then'](respondWithResult(_0x151ce7,null))['catch'](handleError(_0x151ce7,null));};exports['addDisposition']=function(_0x4b33c4,_0x159e03,_0x4e983b){if(_0x4b33c4[_0x4e2c('0x65')]['id']){delete _0x4b33c4[_0x4e2c('0x65')]['id'];}return db[_0x4e2c('0x41')]['find']({'where':{'id':_0x4b33c4[_0x4e2c('0x59')]['id']}})['then'](handleEntityNotFound(_0x159e03,null))[_0x4e2c('0x21')](function(_0x31b2f5){if(_0x31b2f5){_0x4b33c4[_0x4e2c('0x65')][_0x4e2c('0x67')]=_0x31b2f5['id'];return db[_0x4e2c('0x68')][_0x4e2c('0x5d')](_0x4b33c4[_0x4e2c('0x65')]);}})[_0x4e2c('0x21')](respondWithResult(_0x159e03,null))['catch'](handleError(_0x159e03,null));};exports[_0x4e2c('0x69')]=function(_0x193923,_0x378a99,_0x6ee28f){var _0x3f5064={'raw':![],'where':{}};var _0xf3aa43={};var _0xe595cc={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x193923[_0x4e2c('0x59')]['id']}})[_0x4e2c('0x21')](handleEntityNotFound(_0x378a99,null))[_0x4e2c('0x21')](function(_0x21cd97){if(_0x21cd97){_0xf3aa43[_0x4e2c('0x43')]=_[_0x4e2c('0x45')](db[_0x4e2c('0x68')][_0x4e2c('0x5b')]);_0xf3aa43[_0x4e2c('0x44')]=_[_0x4e2c('0x45')](_0x193923[_0x4e2c('0x44')]);_0xf3aa43['filters']=_[_0x4e2c('0x47')](_0xf3aa43[_0x4e2c('0x43')],_0xf3aa43[_0x4e2c('0x44')]);_0x3f5064['attributes']=_[_0x4e2c('0x47')](_0xf3aa43[_0x4e2c('0x43')],qs[_0x4e2c('0x48')](_0x193923[_0x4e2c('0x44')][_0x4e2c('0x48')]));_0x3f5064[_0x4e2c('0x49')]=_0x3f5064['attributes'][_0x4e2c('0x6a')]?_0x3f5064[_0x4e2c('0x49')]:_0xf3aa43[_0x4e2c('0x43')];if(!_0x193923[_0x4e2c('0x44')][_0x4e2c('0x4a')](_0x4e2c('0x4b'))){_0x3f5064[_0x4e2c('0x32')]=qs[_0x4e2c('0x32')](_0x193923[_0x4e2c('0x44')][_0x4e2c('0x32')]);_0x3f5064[_0x4e2c('0x30')]=qs[_0x4e2c('0x30')](_0x193923[_0x4e2c('0x44')]['offset']);}_0x3f5064[_0x4e2c('0x4c')]=qs[_0x4e2c('0x4d')](_0x193923['query'][_0x4e2c('0x4d')]);_0x3f5064[_0x4e2c('0x4e')]=qs[_0x4e2c('0x46')](_['pick'](_0x193923[_0x4e2c('0x44')],_0xf3aa43[_0x4e2c('0x46')]));_0x3f5064[_0x4e2c('0x4e')]['WhatsappAccountId']=_0x21cd97['id'];if(_0x193923[_0x4e2c('0x44')]['filter']){_0x3f5064['where']=_['merge'](_0x3f5064[_0x4e2c('0x4e')],{'$or':_['map'](_0x3f5064['attributes'],function(_0xf31fd8){var _0x19fa38={};_0x19fa38[_0xf31fd8]={'$like':'%'+_0x193923['query'][_0x4e2c('0x53')]+'%'};return _0x19fa38;})});}_0x3f5064=_['merge']({},_0x3f5064,_0x193923['options']);return db[_0x4e2c('0x68')][_0x4e2c('0x33')]({'where':_0x3f5064[_0x4e2c('0x4e')]})['then'](function(_0x2027be){_0xe595cc[_0x4e2c('0x33')]=_0x2027be;if(_0x193923[_0x4e2c('0x44')]['includeAll']){_0x3f5064[_0x4e2c('0x55')]=[{'all':!![]}];}return db[_0x4e2c('0x68')]['findAll'](_0x3f5064);})[_0x4e2c('0x21')](function(_0x313329){_0xe595cc[_0x4e2c('0x57')]=_0x313329;return _0xe595cc;});}})[_0x4e2c('0x21')](respondWithFilteredResult(_0x378a99,_0x3f5064))[_0x4e2c('0x2b')](handleError(_0x378a99,null));};exports[_0x4e2c('0x6b')]=function(_0x4ea9c7,_0x4cc30c,_0x3bbd06){return db[_0x4e2c('0x41')][_0x4e2c('0x5c')]({'where':{'id':_0x4ea9c7['params']['id']}})['then'](handleEntityNotFound(_0x4cc30c,null))[_0x4e2c('0x21')](function(_0x570d50){if(_0x570d50){return _0x570d50[_0x4e2c('0x6b')](_0x4ea9c7['query'][_0x4e2c('0x6c')]);}})['then'](respondWithStatusCode(_0x4cc30c,null))[_0x4e2c('0x2b')](handleError(_0x4cc30c,null));};exports[_0x4e2c('0x6d')]=function(_0x41abe5,_0x4a96da,_0x2d725c){if(_0x41abe5[_0x4e2c('0x65')]['id']){delete _0x41abe5[_0x4e2c('0x65')]['id'];}return db[_0x4e2c('0x41')][_0x4e2c('0x5c')]({'where':{'id':_0x41abe5[_0x4e2c('0x59')]['id']}})[_0x4e2c('0x21')](handleEntityNotFound(_0x4a96da,null))[_0x4e2c('0x21')](function(_0x3bb5f6){if(_0x3bb5f6){_0x41abe5[_0x4e2c('0x65')][_0x4e2c('0x67')]=_0x3bb5f6['id'];return db['CannedAnswer'][_0x4e2c('0x5d')](_0x41abe5[_0x4e2c('0x65')]);}})['then'](respondWithResult(_0x4a96da,null))['catch'](handleError(_0x4a96da,null));};exports[_0x4e2c('0x6e')]=function(_0x2311fb,_0x472fce,_0x12f618){var _0x547f78={'raw':![],'where':{}};var _0x5c6ca2={};var _0x23749b={'count':0x0,'rows':[]};return db[_0x4e2c('0x41')][_0x4e2c('0x6f')]({'where':{'id':_0x2311fb[_0x4e2c('0x59')]['id']}})[_0x4e2c('0x21')](handleEntityNotFound(_0x472fce,null))[_0x4e2c('0x21')](function(_0x8b4d54){if(_0x8b4d54){_0x5c6ca2['model']=_[_0x4e2c('0x45')](db['CannedAnswer']['rawAttributes']);_0x5c6ca2[_0x4e2c('0x44')]=_[_0x4e2c('0x45')](_0x2311fb[_0x4e2c('0x44')]);_0x5c6ca2['filters']=_[_0x4e2c('0x47')](_0x5c6ca2[_0x4e2c('0x43')],_0x5c6ca2['query']);_0x547f78['attributes']=_['intersection'](_0x5c6ca2[_0x4e2c('0x43')],qs[_0x4e2c('0x48')](_0x2311fb[_0x4e2c('0x44')][_0x4e2c('0x48')]));_0x547f78[_0x4e2c('0x49')]=_0x547f78[_0x4e2c('0x49')][_0x4e2c('0x6a')]?_0x547f78[_0x4e2c('0x49')]:_0x5c6ca2[_0x4e2c('0x43')];if(!_0x2311fb['query'][_0x4e2c('0x4a')](_0x4e2c('0x4b'))){_0x547f78['limit']=qs[_0x4e2c('0x32')](_0x2311fb['query'][_0x4e2c('0x32')]);_0x547f78[_0x4e2c('0x30')]=qs[_0x4e2c('0x30')](_0x2311fb[_0x4e2c('0x44')][_0x4e2c('0x30')]);}_0x547f78[_0x4e2c('0x4c')]=qs[_0x4e2c('0x4d')](_0x2311fb['query'][_0x4e2c('0x4d')]);_0x547f78[_0x4e2c('0x4e')]=qs[_0x4e2c('0x46')](_[_0x4e2c('0x4f')](_0x2311fb['query'],_0x5c6ca2[_0x4e2c('0x46')]));_0x547f78['where'][_0x4e2c('0x67')]=_0x8b4d54['id'];if(_0x2311fb[_0x4e2c('0x44')][_0x4e2c('0x53')]){_0x547f78[_0x4e2c('0x4e')]=_[_0x4e2c('0x50')](_0x547f78[_0x4e2c('0x4e')],{'$or':_['map'](_0x547f78[_0x4e2c('0x49')],function(_0x3a7ffc){var _0x537b23={};_0x537b23[_0x3a7ffc]={'$like':'%'+_0x2311fb[_0x4e2c('0x44')][_0x4e2c('0x53')]+'%'};return _0x537b23;})});}_0x547f78=_[_0x4e2c('0x50')]({},_0x547f78,_0x2311fb[_0x4e2c('0x70')]);return db[_0x4e2c('0x71')][_0x4e2c('0x33')]({'where':_0x547f78[_0x4e2c('0x4e')]})[_0x4e2c('0x21')](function(_0x342e74){_0x23749b[_0x4e2c('0x33')]=_0x342e74;if(_0x2311fb[_0x4e2c('0x44')][_0x4e2c('0x54')]){_0x547f78['include']=[{'all':!![]}];}return db[_0x4e2c('0x71')][_0x4e2c('0x56')](_0x547f78);})[_0x4e2c('0x21')](function(_0x1321fc){_0x23749b[_0x4e2c('0x57')]=_0x1321fc;return _0x23749b;});}})[_0x4e2c('0x21')](respondWithFilteredResult(_0x472fce,_0x547f78))['catch'](handleError(_0x472fce,null));};exports[_0x4e2c('0x72')]=function(_0x3cec82,_0x20c147,_0x125e0c){return db[_0x4e2c('0x41')][_0x4e2c('0x5c')]({'where':{'id':_0x3cec82[_0x4e2c('0x59')]['id']}})[_0x4e2c('0x21')](handleEntityNotFound(_0x20c147,null))[_0x4e2c('0x21')](function(_0x50c07d){if(_0x50c07d){return _0x50c07d[_0x4e2c('0x72')](_0x3cec82[_0x4e2c('0x44')][_0x4e2c('0x6c')]);}})[_0x4e2c('0x21')](respondWithStatusCode(_0x20c147,null))[_0x4e2c('0x2b')](handleError(_0x20c147,null));};exports[_0x4e2c('0x73')]=function(_0x934e84,_0x25c41,_0x1a4479){return db['WhatsappAccount']['find']({'where':{'id':_0x934e84[_0x4e2c('0x59')]['id']}})[_0x4e2c('0x21')](handleEntityNotFound(_0x25c41,null))[_0x4e2c('0x21')](function(_0x4be0a5){if(_0x4be0a5){return _0x4be0a5[_0x4e2c('0x73')](_0x934e84[_0x4e2c('0x65')][_0x4e2c('0x6c')],_[_0x4e2c('0x74')](_0x934e84[_0x4e2c('0x65')],[_0x4e2c('0x6c'),'id'])||{})[_0x4e2c('0x75')](function(_0x358101){for(var _0x3df744=0x0;_0x3df744<_0x934e84['body']['ids'][_0x4e2c('0x6a')];_0x3df744+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x934e84['body'][_0x4e2c('0x6c')][_0x3df744]),'WhatsappAccountId':Number(_0x934e84[_0x4e2c('0x59')]['id'])});}return _0x358101;});}})['then'](respondWithResult(_0x25c41,null))[_0x4e2c('0x2b')](handleError(_0x25c41,null));};exports[_0x4e2c('0x76')]=function(_0x29b346,_0x891901,_0x341f70){return db[_0x4e2c('0x41')][_0x4e2c('0x5c')]({'where':{'id':_0x29b346[_0x4e2c('0x59')]['id']}})['then'](handleEntityNotFound(_0x891901,null))['then'](function(_0x191af2){if(_0x191af2){return _0x191af2[_0x4e2c('0x76')](_0x29b346[_0x4e2c('0x44')]['ids'])['then'](function(){if(_[_0x4e2c('0x77')](_0x29b346[_0x4e2c('0x44')][_0x4e2c('0x6c')])){for(var _0xfdedf0=0x0;_0xfdedf0<_0x29b346['query']['ids'][_0x4e2c('0x6a')];_0xfdedf0+=0x1){socket['emit'](_0x4e2c('0x78'),{'UserId':Number(_0x29b346['query'][_0x4e2c('0x6c')][_0xfdedf0]),'WhatsappAccountId':Number(_0x29b346['params']['id'])});}}else{socket[_0x4e2c('0x79')](_0x4e2c('0x78'),{'UserId':Number(_0x29b346[_0x4e2c('0x44')][_0x4e2c('0x6c')]),'WhatsappAccountId':Number(_0x29b346['params']['id'])});}});}})[_0x4e2c('0x21')](respondWithStatusCode(_0x891901,null))['catch'](handleError(_0x891901,null));};exports[_0x4e2c('0x7a')]=function(_0x61d258,_0x25ab1e,_0x579139){var _0x12ad9d={};var _0x1dc8ac={};var _0x1bdb80;var _0x346587;return db[_0x4e2c('0x41')][_0x4e2c('0x6f')]({'where':{'id':_0x61d258[_0x4e2c('0x59')]['id']}})[_0x4e2c('0x21')](handleEntityNotFound(_0x25ab1e,null))[_0x4e2c('0x21')](function(_0x5f06b5){if(_0x5f06b5){_0x1bdb80=_0x5f06b5;_0x1dc8ac['model']=_[_0x4e2c('0x45')](db[_0x4e2c('0x7b')]['rawAttributes']);_0x1dc8ac[_0x4e2c('0x44')]=_[_0x4e2c('0x45')](_0x61d258[_0x4e2c('0x44')]);_0x1dc8ac[_0x4e2c('0x46')]=_[_0x4e2c('0x47')](_0x1dc8ac['model'],_0x1dc8ac[_0x4e2c('0x44')]);_0x12ad9d['attributes']=_['intersection'](_0x1dc8ac['model'],qs[_0x4e2c('0x48')](_0x61d258[_0x4e2c('0x44')][_0x4e2c('0x48')]));_0x12ad9d[_0x4e2c('0x49')]=_0x12ad9d[_0x4e2c('0x49')]['length']?_0x12ad9d[_0x4e2c('0x49')]:_0x1dc8ac[_0x4e2c('0x43')];_0x12ad9d[_0x4e2c('0x4c')]=qs['sort'](_0x61d258['query'][_0x4e2c('0x4d')]);_0x12ad9d['where']=qs[_0x4e2c('0x46')](_[_0x4e2c('0x4f')](_0x61d258[_0x4e2c('0x44')],_0x1dc8ac[_0x4e2c('0x46')]));if(_0x61d258[_0x4e2c('0x44')][_0x4e2c('0x53')]){_0x12ad9d[_0x4e2c('0x4e')]=_[_0x4e2c('0x50')](_0x12ad9d['where'],{'$or':_[_0x4e2c('0x40')](_0x12ad9d[_0x4e2c('0x49')],function(_0x3cbba4){var _0x1e65fb={};_0x1e65fb[_0x3cbba4]={'$like':'%'+_0x61d258[_0x4e2c('0x44')][_0x4e2c('0x53')]+'%'};return _0x1e65fb;})});}_0x12ad9d=_[_0x4e2c('0x50')]({},_0x12ad9d,_0x61d258[_0x4e2c('0x70')]);return _0x1bdb80[_0x4e2c('0x7a')](_0x12ad9d);}})['then'](function(_0x33109d){if(_0x33109d){_0x346587=_0x33109d[_0x4e2c('0x6a')];if(!_0x61d258[_0x4e2c('0x44')][_0x4e2c('0x4a')](_0x4e2c('0x4b'))){_0x12ad9d[_0x4e2c('0x32')]=qs[_0x4e2c('0x32')](_0x61d258[_0x4e2c('0x44')][_0x4e2c('0x32')]);_0x12ad9d['offset']=qs['offset'](_0x61d258[_0x4e2c('0x44')][_0x4e2c('0x30')]);}return _0x1bdb80['getAgents'](_0x12ad9d);}})['then'](function(_0x38c4bf){if(_0x38c4bf){return _0x38c4bf?{'count':_0x346587,'rows':_0x38c4bf}:null;}})['then'](respondWithResult(_0x25ab1e,null))[_0x4e2c('0x2b')](handleError(_0x25ab1e,null));};exports[_0x4e2c('0x7c')]=function(_0xcf4b0e,_0xac4af0){var _0x3f2d45=_0xcf4b0e[_0x4e2c('0x59')]['id'];var _0x26d1ed=_0xcf4b0e['body'];var _0x777d6a=0xc8;var _0x4356ef=null;return db[_0x4e2c('0x7d')]['transaction']({'isolationLevel':db[_0x4e2c('0x7d')]['Transaction'][_0x4e2c('0x7e')][_0x4e2c('0x7f')]},function(_0x56148a){return db[_0x4e2c('0x41')]['findOne']({'where':{'id':_0x3f2d45},'transaction':_0x56148a})[_0x4e2c('0x21')](function(_0x17315c){if(_0x17315c){return db[_0x4e2c('0x80')][_0x4e2c('0x38')]({'where':{'WhatsappAccountId':_0x3f2d45},'transaction':_0x56148a})['then'](function(){var _0x2f1ed2=_[_0x4e2c('0x40')](_0x26d1ed,function(_0x32dee6){_0x32dee6[_0x4e2c('0x67')]=_0x3f2d45;return _0x32dee6;});return db[_0x4e2c('0x80')][_0x4e2c('0x81')](_0x2f1ed2,{'transaction':_0x56148a});});}else{_0x777d6a=0x194;_0x4356ef=[];}});})['then'](function(){if(_0x777d6a!==0x194){return db[_0x4e2c('0x80')][_0x4e2c('0x82')]({'where':{'WhatsappAccountId':_0x3f2d45},'order':'priority'})[_0x4e2c('0x21')](function(_0xdb3f6e){_0x4356ef=_0xdb3f6e;});}})[_0x4e2c('0x2b')](function(_0x198129){_0x777d6a=0x1f4;logger[_0x4e2c('0x27')](_0x198129[_0x4e2c('0x3b')]);if(_0x198129[_0x4e2c('0x3c')]){delete _0x198129['name'];}_0x4356ef=_0x198129;})[_0x4e2c('0x83')](function(){if(_0x4356ef===null){_0xac4af0[_0x4e2c('0x2c')](_0x777d6a);}else{if(_0x777d6a===0x1f4){_0xac4af0[_0x4e2c('0x2d')](_0x777d6a)[_0x4e2c('0x3d')](_0x4356ef);}else{_0xac4af0[_0x4e2c('0x2d')](_0x777d6a)[_0x4e2c('0x2f')](_0x4356ef);}}});};exports['getApplications']=function(_0x597c1f,_0x5d0c28,_0xb1a0fc){var _0x56a721={};var _0x2e3401={};var _0x41fd4e;var _0x1c7828;return db['WhatsappAccount'][_0x4e2c('0x6f')]({'where':{'id':_0x597c1f[_0x4e2c('0x59')]['id']}})[_0x4e2c('0x21')](handleEntityNotFound(_0x5d0c28,null))[_0x4e2c('0x21')](function(_0x4abd8d){if(_0x4abd8d){_0x41fd4e=_0x4abd8d;_0x2e3401[_0x4e2c('0x43')]=_[_0x4e2c('0x45')](db['WhatsappApplication']['rawAttributes']);_0x2e3401['query']=_[_0x4e2c('0x45')](_0x597c1f[_0x4e2c('0x44')]);_0x2e3401[_0x4e2c('0x46')]=_[_0x4e2c('0x47')](_0x2e3401['model'],_0x2e3401[_0x4e2c('0x44')]);_0x56a721[_0x4e2c('0x49')]=_[_0x4e2c('0x47')](_0x2e3401['model'],qs[_0x4e2c('0x48')](_0x597c1f[_0x4e2c('0x44')][_0x4e2c('0x48')]));_0x56a721['attributes']=_0x56a721[_0x4e2c('0x49')]['length']?_0x56a721[_0x4e2c('0x49')]:_0x2e3401['model'];_0x56a721[_0x4e2c('0x4c')]=qs[_0x4e2c('0x4d')](_0x597c1f[_0x4e2c('0x44')][_0x4e2c('0x4d')]);_0x56a721[_0x4e2c('0x4e')]=qs[_0x4e2c('0x46')](_[_0x4e2c('0x4f')](_0x597c1f[_0x4e2c('0x44')],_0x2e3401[_0x4e2c('0x46')]));if(_0x597c1f[_0x4e2c('0x44')][_0x4e2c('0x53')]){_0x56a721[_0x4e2c('0x4e')]=_[_0x4e2c('0x50')](_0x56a721[_0x4e2c('0x4e')],{'$or':_[_0x4e2c('0x40')](_0x56a721['attributes'],function(_0x26b6ef){var _0x37c2ec={};_0x37c2ec[_0x26b6ef]={'$like':'%'+_0x597c1f[_0x4e2c('0x44')]['filter']+'%'};return _0x37c2ec;})});}_0x56a721=_[_0x4e2c('0x50')]({},_0x56a721,_0x597c1f[_0x4e2c('0x70')]);return _0x41fd4e[_0x4e2c('0x84')](_0x56a721);}})['then'](function(_0x37407c){if(_0x37407c){_0x1c7828=_0x37407c[_0x4e2c('0x6a')];if(!_0x597c1f[_0x4e2c('0x44')][_0x4e2c('0x4a')](_0x4e2c('0x4b'))){_0x56a721['limit']=qs[_0x4e2c('0x32')](_0x597c1f[_0x4e2c('0x44')]['limit']);_0x56a721[_0x4e2c('0x30')]=qs[_0x4e2c('0x30')](_0x597c1f[_0x4e2c('0x44')]['offset']);}return _0x41fd4e['getApplications'](_0x56a721);}})['then'](function(_0x1d543a){if(_0x1d543a){return _0x1d543a?{'count':_0x1c7828,'rows':_0x1d543a}:null;}})[_0x4e2c('0x21')](respondWithResult(_0x5d0c28,null))['catch'](handleError(_0x5d0c28,null));};exports[_0x4e2c('0x85')]=function(_0xc2b86a,_0x318679,_0x438389){var _0x582a54={'channel':'whatsapp'};var _0x1fd037=[];var _0x3addf3=[];var _0x514cc3={};return db['WhatsappAccount'][_0x4e2c('0x5c')]({'where':{'id':_0xc2b86a[_0x4e2c('0x59')]['id']},'include':[{'model':db[_0x4e2c('0x80')],'as':'Applications'}]})[_0x4e2c('0x21')](handleEntityNotFound(_0x318679,null))[_0x4e2c('0x21')](function(_0x3eddcb){_0x582a54[_0x4e2c('0x86')]=_0x3eddcb;if(_0x582a54[_0x4e2c('0x86')]&&_0x582a54[_0x4e2c('0x86')][_0x4e2c('0x51')]===_0x4e2c('0x87')&&_0xc2b86a['body'][_0x4e2c('0x88')]){if(_0xc2b86a[_0x4e2c('0x65')][_0x4e2c('0x88')][_0x4e2c('0x6a')]===0x0)return;if(_0xc2b86a[_0x4e2c('0x65')][_0x4e2c('0x88')][0x0]['state']!==_0x4e2c('0x89'))return;return db[_0x4e2c('0x8a')][_0x4e2c('0x37')]({'read':!![],'readAt':_0xc2b86a[_0x4e2c('0x65')][_0x4e2c('0x88')][0x0][_0x4e2c('0x8b')]},{'where':{'messageId':_0xc2b86a[_0x4e2c('0x65')][_0x4e2c('0x88')][0x0][_0x4e2c('0x8c')]},'individualHooks':!![]})[_0x4e2c('0x21')](function(_0x39b473){return _0x318679['status'](0xc8)[_0x4e2c('0x2f')](_0x39b473);});}_0x582a54[_0x4e2c('0x8d')]=_[_0x4e2c('0x8e')](_0x3eddcb[_0x4e2c('0x8f')],[_0x4e2c('0x90')],[_0x4e2c('0x91')]);if(_0x582a54[_0x4e2c('0x86')]['Applications']){delete _0x582a54[_0x4e2c('0x86')][_0x4e2c('0x8f')];}return db[_0x4e2c('0x92')][_0x4e2c('0x66')]()[_0x4e2c('0x21')](function(_0x5e905a){if(!_0x5e905a){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x1fd037=_[_0x4e2c('0x93')](_['keys'](_0x5e905a),['createdAt',_0x4e2c('0x94')]);_0x3addf3=_['difference'](_[_0x4e2c('0x45')](_0x5e905a),['createdAt',_0x4e2c('0x94'),'CompanyId',_0x4e2c('0x95')]);_0x582a54[_0x4e2c('0x65')]={'mapKey':_0x4e2c('0x96')};if(_0x582a54['account']&&_0x582a54[_0x4e2c('0x86')]['type']===_0x4e2c('0x97')){_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x98')]=_0xc2b86a[_0x4e2c('0x65')][_0x4e2c('0x99')]['replace'](_0x4e2c('0x9a'),'');_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x65')]=_0xc2b86a[_0x4e2c('0x65')]['Body'];_0x582a54['body']['messageId']=_0xc2b86a['body']['MessageSid'];}if(_0x582a54[_0x4e2c('0x86')]&&_0x582a54[_0x4e2c('0x86')][_0x4e2c('0x51')]===_0x4e2c('0x87')){_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x98')]=_0xc2b86a[_0x4e2c('0x65')]['notifications'][0x0][_0x4e2c('0x98')];_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x65')]=_0xc2b86a[_0x4e2c('0x65')][_0x4e2c('0x9b')][0x0][_0x4e2c('0x29')]['body'];_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x9c')]=_0xc2b86a[_0x4e2c('0x65')][_0x4e2c('0x9b')][0x0][_0x4e2c('0x8c')];}if(_0x582a54['body']['id']){delete _0x582a54[_0x4e2c('0x65')]['id'];}if(_[_0x4e2c('0x9d')](_0x582a54[_0x4e2c('0x65')]['from'])){throw new db[(_0x4e2c('0x9e'))][(_0x4e2c('0x9f'))](_0x4e2c('0xa0'));}if(_['isNil'](_0x582a54['body']['body'])||_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x65')]===''){throw new db[(_0x4e2c('0x9e'))][(_0x4e2c('0x9f'))](_0x4e2c('0xa1'));}if(_[_0x4e2c('0x9d')](_0x582a54[_0x4e2c('0x65')]['mapKey'])){throw new db[(_0x4e2c('0x9e'))][(_0x4e2c('0x9f'))](_0x4e2c('0xa2')+_0x3addf3);}if(!_[_0x4e2c('0xa3')](_0x3addf3,_0x582a54[_0x4e2c('0x65')][_0x4e2c('0xa4')])){throw new db[(_0x4e2c('0x9e'))][(_0x4e2c('0x9f'))](_0x4e2c('0xa5')+_0x3addf3);}_0x514cc3[_0x582a54['body'][_0x4e2c('0xa4')]]=_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x98')];return db['CmList']['find']({'where':{'id':_0x582a54[_0x4e2c('0x86')]['ListId']},'include':[{'model':db[_0x4e2c('0x92')],'as':_0x4e2c('0xa6'),'where':_0x514cc3,'limit':0x1,'order':[[_0x4e2c('0x94'),_0x4e2c('0xa7')]]}]});})[_0x4e2c('0x21')](handleEntityNotFound(_0x318679,null))[_0x4e2c('0x21')](function(_0x28a1d6){if(_0x28a1d6){_0x582a54[_0x4e2c('0xa8')]=_[_0x4e2c('0x74')](_0x28a1d6,['Contacts']);if(_0x28a1d6[_0x4e2c('0xa6')][_0x4e2c('0x6a')]){return _0x28a1d6[_0x4e2c('0xa6')][0x0];}var _0xe4e190=_[_0x4e2c('0x1a')](_0x582a54[_0x4e2c('0x65')],{'firstName':_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x98')],'ListId':_0x28a1d6['id']});_0xe4e190[_0x582a54['body'][_0x4e2c('0xa4')]]=_0x582a54['body'][_0x4e2c('0x98')];return db['CmContact'][_0x4e2c('0x5d')](_0xe4e190,{'fields':_0x1fd037,'raw':!![]});}})[_0x4e2c('0x21')](handleEntityNotFound(_0x318679,null))[_0x4e2c('0x21')](function(_0x40d17c){if(_0x40d17c){_0x582a54[_0x4e2c('0xa9')]=_0x40d17c;var _0x1353f7={'ContactId':_0x40d17c['id'],'phone':_0x582a54[_0x4e2c('0x65')]['from'],'WhatsappAccountId':_0xc2b86a['params']['id']};var _0x58add3={'ContactId':_0x40d17c['id'],'WhatsappAccountId':_0xc2b86a[_0x4e2c('0x59')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x4e2c('0x5c')]({'where':_0x58add3})[_0x4e2c('0x21')](function(_0x551ab0){if(_0x551ab0){return[_0x551ab0,![]];}return db['WhatsappInteraction']['create'](_0x1353f7)[_0x4e2c('0x21')](function(_0x408605){return[_0x408605,!![]];});});}})['spread'](function(_0x39c206,_0x5c724a){_0x582a54[_0x4e2c('0xaa')]=_0x39c206[_0x4e2c('0x39')]({'plain':!![]});_0x582a54[_0x4e2c('0xaa')][_0x4e2c('0xab')]=![];if(_0x5c724a){if(_0x582a54[_0x4e2c('0x86')][_0x4e2c('0xac')]){_0x582a54[_0x4e2c('0x8d')]['push']({'id':0x0,'priority':_0x582a54[_0x4e2c('0x8d')][_0x4e2c('0x6a')]+0x1,'app':_0x4e2c('0xad'),'appdata':_0x4e2c('0xae'),'interval':_0x4e2c('0xaf')});}_0x582a54['interaction'][_0x4e2c('0xab')]=!![];}return db['WhatsappMessage'][_0x4e2c('0x5d')]({'phone':_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x98')],'messageId':_0x582a54['body'][_0x4e2c('0x9c')],'body':_0x582a54[_0x4e2c('0x65')][_0x4e2c('0x65')],'WhatsappAccountId':_0xc2b86a[_0x4e2c('0x59')]['id'],'WhatsappInteractionId':_0x39c206['id'],'direction':'in','ContactId':_0x39c206['ContactId'],'AttachmentId':_0x582a54[_0x4e2c('0x65')][_0x4e2c('0xb0')]});})['then'](function(_0xcd296b){_0x582a54[_0x4e2c('0x29')]=_0xcd296b;if(_0x582a54[_0x4e2c('0xaa')][_0x4e2c('0xb1')]){return db[_0x4e2c('0x7b')][_0x4e2c('0x5c')]({'attributes':['id',_0x4e2c('0x3c')],'where':{'id':_0x582a54[_0x4e2c('0xaa')][_0x4e2c('0xb1')]}})[_0x4e2c('0x21')](function(_0x4aa744){if(_0x4aa744){_0x582a54[_0x4e2c('0x8d')][_0x4e2c('0xb2')]({'id':0x0,'priority':0x0,'app':_0x4e2c('0xb3'),'appdata':_0x4aa744[_0x4e2c('0x3c')]+','+(_0x582a54[_0x4e2c('0x86')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4e2c('0xb4'),_0x4e2c('0xb5'),_0x582a54);});}return respondWithRpcPromise(_0x4e2c('0xb4'),_0x4e2c('0xb5'),_0x582a54);})[_0x4e2c('0x21')](function(_0x884a3){if(_0x884a3){var _0x3df96e=0xc8;var _0x1e69f4=_0x4e2c('0xb6');logger[_0x4e2c('0x22')](_0x4e2c('0x26'),_0x1e69f4,_0x3df96e,_0x4e2c('0xb7'));logger[_0x4e2c('0x25')](_0x4e2c('0xb8'),_0x1e69f4,_0x3df96e,'entity\x20found',JSON['stringify'](_0x884a3));if(_0x582a54[_0x4e2c('0x86')][_0x4e2c('0x51')]===_0x4e2c('0x97')){return _0x318679[_0x4e2c('0x2d')](_0x3df96e)[_0x4e2c('0x34')](_0x4e2c('0xb9'),_0x4e2c('0xba'))[_0x4e2c('0x3d')]('\x0a');}else{return _0x318679[_0x4e2c('0x2d')](_0x3df96e)[_0x4e2c('0x2f')](_0x884a3);}}});})[_0x4e2c('0x2b')](handleError(_0x318679,null));};exports[_0x4e2c('0x3d')]=function(_0x3269d4,_0x2640d,_0x4226aa){var _0x2e5404,_0x56c8fd,_0x2b0236;if(_[_0x4e2c('0x9d')](_0x3269d4[_0x4e2c('0x65')][_0x4e2c('0x65')])||_0x3269d4[_0x4e2c('0x65')][_0x4e2c('0x65')]===''){throw new db['Sequelize'][(_0x4e2c('0x9f'))](_0x4e2c('0xa1'));}if(_[_0x4e2c('0x9d')](_0x3269d4[_0x4e2c('0x65')]['to'])){throw new db[(_0x4e2c('0x9e'))]['ValidationError'](_0x4e2c('0xbb'));}_0x2e5404=_0x3269d4[_0x4e2c('0x65')]['to'];return db[_0x4e2c('0x41')][_0x4e2c('0x5c')]({'where':{'id':_0x3269d4[_0x4e2c('0x59')]['id']},'include':[{'model':db[_0x4e2c('0xbc')],'as':_0x4e2c('0xbd'),'include':[{'model':db[_0x4e2c('0x92')],'as':'Contacts','where':{'mobile':_0x2e5404},'limit':0x1,'order':[[_0x4e2c('0x94'),_0x4e2c('0xa7')]]}]}]})[_0x4e2c('0x21')](handleEntityNotFound(_0x2640d,null))[_0x4e2c('0x21')](function(_0x5e063c){if(_0x5e063c&&_0x5e063c['List']){_0x56c8fd=_0x5e063c[_0x4e2c('0x39')]({'plain':!![]});if(_0x56c8fd[_0x4e2c('0xbd')]&&_0x56c8fd[_0x4e2c('0xbd')]['Contacts']['length']){return _0x56c8fd[_0x4e2c('0xbd')][_0x4e2c('0xa6')][0x0];}return db[_0x4e2c('0x92')][_0x4e2c('0x5d')](_[_0x4e2c('0x1a')](_0x3269d4[_0x4e2c('0x65')],{'firstName':_0x2e5404,'mobile':_0x2e5404,'phone':_0x2e5404,'ListId':_0x56c8fd['ListId']}));}})[_0x4e2c('0x21')](handleEntityNotFound(_0x2640d,null))['then'](function(_0x572bf3){if(_0x572bf3){_0x2b0236=_0x572bf3;return db[_0x4e2c('0xbe')]['find']({'where':{'ContactId':_0x2b0236['id'],'closed':![],'WhatsappAccountId':_0x56c8fd['id']}})['then'](function(_0x55cc0a){if(_0x55cc0a){return[_0x55cc0a,![]];}return db[_0x4e2c('0xbe')][_0x4e2c('0x5d')]({'UserId':_0x3269d4[_0x4e2c('0x5e')]['id'],'ContactId':_0x2b0236['id'],'WhatsappAccountId':_0x56c8fd['id'],'phone':_0x2e5404,'firstMsgDirection':'out','Messages':[_[_0x4e2c('0x50')](_0x3269d4[_0x4e2c('0x65')],{'read':![],'body':_0x3269d4[_0x4e2c('0x65')][_0x4e2c('0x65')],'phone':_0x2e5404,'WhatsappAccountId':_0x56c8fd['id'],'UserId':_0x3269d4[_0x4e2c('0x5e')]['id'],'ContactId':_0x2b0236['id']})]},{'include':[{'model':db[_0x4e2c('0x8a')],'as':_0x4e2c('0xbf')}]})[_0x4e2c('0x21')](function(_0x57230c){return[_0x57230c,!![]];});});}})[_0x4e2c('0x75')](function(_0x56b792,_0x569a19){if(_0x569a19){return _0x56b792;}return db[_0x4e2c('0x8a')][_0x4e2c('0x5d')](_[_0x4e2c('0x50')](_0x3269d4[_0x4e2c('0x65')],{'read':![],'body':_0x3269d4[_0x4e2c('0x65')][_0x4e2c('0x65')],'phone':_0x2e5404,'WhatsappAccountId':_0x56c8fd['id'],'WhatsappInteractionId':_0x56b792['id'],'UserId':_0x3269d4['user']['id'],'ContactId':_0x2b0236['id']}))[_0x4e2c('0x21')](function(_0x4a0af0){_0x56b792['dataValues']['Messages']=[];_0x56b792[_0x4e2c('0xc0')][_0x4e2c('0xbf')]['push'](_0x4a0af0[_0x4e2c('0xc0')]);return _0x56b792;});})[_0x4e2c('0x21')](respondWithResult(_0x2640d,null))[_0x4e2c('0x2b')](handleError(_0x2640d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 857dab2..9841d63 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 _0x329e=['WhatsappAccount','setMaxListeners','save','update','hasOwnProperty','../../mysqldb'];(function(_0x40889c,_0x73e154){var _0x1e69a3=function(_0x365601){while(--_0x365601){_0x40889c['push'](_0x40889c['shift']());}};_0x1e69a3(++_0x73e154);}(_0x329e,0x1e5));var _0xe329=function(_0x29e3e8,_0x387854){_0x29e3e8=_0x29e3e8-0x0;var _0x4007bd=_0x329e[_0x29e3e8];return _0x4007bd;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xe329('0x0'))['db'][_0xe329('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe329('0x2')](0x0);var events={'afterCreate':_0xe329('0x3'),'afterUpdate':_0xe329('0x4'),'afterDestroy':'remove'};function emitEvent(_0x431881){return function(_0x4dae78,_0x3de83d,_0x29ab90){WhatsappAccountEvents['emit'](_0x431881+':'+_0x4dae78['id'],_0x4dae78);WhatsappAccountEvents['emit'](_0x431881,_0x4dae78);_0x29ab90(null);};}for(var e in events){if(events[_0xe329('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xc2d9=['hook','exports','update','remove','emit','hasOwnProperty'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xc2d9,0x1d0));var _0x9c2d=function(_0x4c38f8,_0xfd563c){_0x4c38f8=_0x4c38f8-0x0;var _0x8d82f8=_0xc2d9[_0x4c38f8];return _0x8d82f8;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c2d('0x0'),'afterDestroy':_0x9c2d('0x1')};function emitEvent(_0x1cf039){return function(_0x4ee5ee,_0x1df2e0,_0x404f78){WhatsappAccountEvents[_0x9c2d('0x2')](_0x1cf039+':'+_0x4ee5ee['id'],_0x4ee5ee);WhatsappAccountEvents[_0x9c2d('0x2')](_0x1cf039,_0x4ee5ee);_0x404f78(null);};}for(var e in events){if(events[_0x9c2d('0x3')](e)){var event=events[e];WhatsappAccount[_0x9c2d('0x4')](e,emitEvent(event));}}module[_0x9c2d('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index ea5a25b..659a307 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 _0x18df=['define','WhatsappAccount','whatsapp_accounts','moment','bluebird','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x18df,0x1c5));var _0xf18d=function(_0x37251e,_0x24c2e0){_0x37251e=_0x37251e-0x0;var _0x370e3b=_0x18df[_0x37251e];return _0x370e3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf18d('0x0'));var BPromise=require(_0xf18d('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf18d('0x2'));var rimraf=require(_0xf18d('0x3'));var config=require('../../config/environment');var attributes=require(_0xf18d('0x4'));module[_0xf18d('0x5')]=function(_0x438ab6,_0x4bdfde){return _0x438ab6[_0xf18d('0x6')](_0xf18d('0x7'),attributes,{'tableName':_0xf18d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x510c=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x478de7,_0x3deb50){var _0x290cbd=function(_0x56821b){while(--_0x56821b){_0x478de7['push'](_0x478de7['shift']());}};_0x290cbd(++_0x3deb50);}(_0x510c,0x1e1));var _0xc510=function(_0x4dc140,_0x469dbf){_0x4dc140=_0x4dc140-0x0;var _0xc0ce58=_0x510c[_0x4dc140];return _0xc0ce58;};'use strict';var _=require(_0xc510('0x0'));var util=require(_0xc510('0x1'));var logger=require(_0xc510('0x2'))(_0xc510('0x3'));var moment=require(_0xc510('0x4'));var BPromise=require(_0xc510('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc510('0x6'));var rimraf=require(_0xc510('0x7'));var config=require(_0xc510('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xc510('0x9')]=function(_0x523c7f,_0x590b0e){return _0x523c7f[_0xc510('0xa')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index a0f982c..e64e59f 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 _0xba53=['WhatsappAccount,\x20%s,\x20%s','message','catch','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','code'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xba53,0x1ef));var _0x3ba5=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xba53[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0x3ba5('0x0'));var moment=require('moment');var BPromise=require(_0x3ba5('0x1'));var rs=require(_0x3ba5('0x2'));var fs=require('fs');var Redis=require(_0x3ba5('0x3'));var db=require(_0x3ba5('0x4'))['db'];var utils=require(_0x3ba5('0x5'));var logger=require(_0x3ba5('0x6'))(_0x3ba5('0x7'));var config=require(_0x3ba5('0x8'));var jayson=require(_0x3ba5('0x9'));var client=jayson['client'][_0x3ba5('0xa')]({'port':0x232a});config[_0x3ba5('0xb')]=_[_0x3ba5('0xc')](config[_0x3ba5('0xb')],{'host':_0x3ba5('0xd'),'port':0x18eb});var socket=require(_0x3ba5('0xe'))(new Redis(config[_0x3ba5('0xb')]));require('./whatsappAccount.socket')[_0x3ba5('0xf')](socket);function respondWithRpcPromise(_0x2eee4a,_0x4d529e,_0x4c40a4){return new BPromise(function(_0x29d8f1,_0x398a61){return client[_0x3ba5('0x10')](_0x2eee4a,_0x4c40a4)[_0x3ba5('0x11')](function(_0x1393fe){logger[_0x3ba5('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x4d529e,_0x3ba5('0x13'));logger[_0x3ba5('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4d529e,_0x3ba5('0x13'),JSON['stringify'](_0x1393fe));if(_0x1393fe['error']){if(_0x1393fe[_0x3ba5('0x15')][_0x3ba5('0x16')]===0x1f4){logger[_0x3ba5('0x15')](_0x3ba5('0x17'),_0x4d529e,_0x1393fe[_0x3ba5('0x15')][_0x3ba5('0x18')]);return _0x398a61(_0x1393fe[_0x3ba5('0x15')][_0x3ba5('0x18')]);}logger[_0x3ba5('0x15')](_0x3ba5('0x17'),_0x4d529e,_0x1393fe['error'][_0x3ba5('0x18')]);return _0x29d8f1(_0x1393fe[_0x3ba5('0x15')][_0x3ba5('0x18')]);}else{logger[_0x3ba5('0x12')](_0x3ba5('0x17'),_0x4d529e,_0x3ba5('0x13'));_0x29d8f1(_0x1393fe['result'][_0x3ba5('0x18')]);}})[_0x3ba5('0x19')](function(_0xc046bf){logger[_0x3ba5('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x4d529e,_0xc046bf);_0x398a61(_0xc046bf);});});}exports['ShowWhatsappAccount']=function(_0x4b03af){var _0x5d9453=this;return new Promise(function(_0x5de75b,_0x12ac9f){return db[_0x3ba5('0x1a')][_0x3ba5('0x1b')]({'raw':_0x4b03af[_0x3ba5('0x1c')]?_0x4b03af[_0x3ba5('0x1c')][_0x3ba5('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b03af['options']?_0x4b03af[_0x3ba5('0x1c')][_0x3ba5('0x1e')]||null:null,'attributes':_0x4b03af[_0x3ba5('0x1c')]?_0x4b03af['options'][_0x3ba5('0x1f')]||null:null,'include':_0x4b03af[_0x3ba5('0x1c')]?_0x4b03af[_0x3ba5('0x1c')][_0x3ba5('0x20')]?_[_0x3ba5('0x21')](_0x4b03af[_0x3ba5('0x1c')][_0x3ba5('0x20')],function(_0x538307){return{'model':db[_0x538307[_0x3ba5('0x22')]],'as':_0x538307['as'],'attributes':_0x538307[_0x3ba5('0x1f')],'include':_0x538307[_0x3ba5('0x20')]?_[_0x3ba5('0x21')](_0x538307[_0x3ba5('0x20')],function(_0x466111){return{'model':db[_0x466111[_0x3ba5('0x22')]],'as':_0x466111['as'],'attributes':_0x466111[_0x3ba5('0x1f')],'include':_0x466111[_0x3ba5('0x20')]?_[_0x3ba5('0x21')](_0x466111['include'],function(_0x4f4fd8){return{'model':db[_0x4f4fd8[_0x3ba5('0x22')]],'as':_0x4f4fd8['as'],'attributes':_0x4f4fd8[_0x3ba5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3ba5('0x11')](function(_0x4658e6){logger[_0x3ba5('0x12')](_0x3ba5('0x23'),_0x4b03af);logger[_0x3ba5('0x14')]('ShowWhatsappAccount',_0x4b03af,JSON[_0x3ba5('0x24')](_0x4658e6));_0x5de75b(_0x4658e6);})[_0x3ba5('0x19')](function(_0x179722){logger[_0x3ba5('0x15')]('ShowWhatsappAccount',_0x179722['message'],_0x4b03af);_0x12ac9f(_0x5d9453[_0x3ba5('0x15')](0x1f4,_0x179722[_0x3ba5('0x18')]));});});}; \ No newline at end of file +var _0xb954=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','then','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x2e7e8a,_0xc3b46e){var _0x5cec40=function(_0x482b7a){while(--_0x482b7a){_0x2e7e8a['push'](_0x2e7e8a['shift']());}};_0x5cec40(++_0xc3b46e);}(_0xb954,0x115));var _0x4b95=function(_0x435592,_0x363aed){_0x435592=_0x435592-0x0;var _0x2d544d=_0xb954[_0x435592];return _0x2d544d;};'use strict';var _=require(_0x4b95('0x0'));var util=require(_0x4b95('0x1'));var moment=require(_0x4b95('0x2'));var BPromise=require(_0x4b95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b95('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b95('0x5'))(_0x4b95('0x6'));var config=require(_0x4b95('0x7'));var jayson=require(_0x4b95('0x8'));var client=jayson['client'][_0x4b95('0x9')]({'port':0x232a});config[_0x4b95('0xa')]=_[_0x4b95('0xb')](config[_0x4b95('0xa')],{'host':_0x4b95('0xc'),'port':0x18eb});var socket=require(_0x4b95('0xd'))(new Redis(config[_0x4b95('0xa')]));require(_0x4b95('0xe'))['register'](socket);function respondWithRpcPromise(_0x9f99a9,_0x38e998,_0x293a63){return new BPromise(function(_0x4793fd,_0x2102f1){return client[_0x4b95('0xf')](_0x9f99a9,_0x293a63)['then'](function(_0x1cc66e){logger[_0x4b95('0x10')](_0x4b95('0x11'),_0x38e998,_0x4b95('0x12'));logger['debug'](_0x4b95('0x13'),_0x38e998,_0x4b95('0x12'),JSON[_0x4b95('0x14')](_0x1cc66e));if(_0x1cc66e[_0x4b95('0x15')]){if(_0x1cc66e['error']['code']===0x1f4){logger[_0x4b95('0x15')](_0x4b95('0x11'),_0x38e998,_0x1cc66e[_0x4b95('0x15')][_0x4b95('0x16')]);return _0x2102f1(_0x1cc66e[_0x4b95('0x15')]['message']);}logger[_0x4b95('0x15')](_0x4b95('0x11'),_0x38e998,_0x1cc66e[_0x4b95('0x15')][_0x4b95('0x16')]);return _0x4793fd(_0x1cc66e[_0x4b95('0x15')][_0x4b95('0x16')]);}else{logger[_0x4b95('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x38e998,_0x4b95('0x12'));_0x4793fd(_0x1cc66e[_0x4b95('0x17')][_0x4b95('0x16')]);}})[_0x4b95('0x18')](function(_0x5a4b66){logger['error'](_0x4b95('0x11'),_0x38e998,_0x5a4b66);_0x2102f1(_0x5a4b66);});});}exports[_0x4b95('0x19')]=function(_0x3dd27a){var _0xc7574a=this;return new Promise(function(_0x32d9ab,_0x318658){return db['WhatsappAccount'][_0x4b95('0x1a')]({'raw':_0x3dd27a[_0x4b95('0x1b')]?_0x3dd27a[_0x4b95('0x1b')][_0x4b95('0x1c')]===undefined?!![]:![]:!![],'where':_0x3dd27a[_0x4b95('0x1b')]?_0x3dd27a[_0x4b95('0x1b')][_0x4b95('0x1d')]||null:null,'attributes':_0x3dd27a[_0x4b95('0x1b')]?_0x3dd27a[_0x4b95('0x1b')][_0x4b95('0x1e')]||null:null,'include':_0x3dd27a['options']?_0x3dd27a[_0x4b95('0x1b')][_0x4b95('0x1f')]?_[_0x4b95('0x20')](_0x3dd27a['options'][_0x4b95('0x1f')],function(_0x1a9224){return{'model':db[_0x1a9224[_0x4b95('0x21')]],'as':_0x1a9224['as'],'attributes':_0x1a9224['attributes'],'include':_0x1a9224[_0x4b95('0x1f')]?_[_0x4b95('0x20')](_0x1a9224[_0x4b95('0x1f')],function(_0x53726f){return{'model':db[_0x53726f[_0x4b95('0x21')]],'as':_0x53726f['as'],'attributes':_0x53726f['attributes'],'include':_0x53726f[_0x4b95('0x1f')]?_['map'](_0x53726f[_0x4b95('0x1f')],function(_0x2e5034){return{'model':db[_0x2e5034[_0x4b95('0x21')]],'as':_0x2e5034['as'],'attributes':_0x2e5034[_0x4b95('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4b95('0x22')](function(_0x1d8ad2){logger[_0x4b95('0x10')](_0x4b95('0x19'),_0x3dd27a);logger[_0x4b95('0x23')]('ShowWhatsappAccount',_0x3dd27a,JSON[_0x4b95('0x14')](_0x1d8ad2));_0x32d9ab(_0x1d8ad2);})[_0x4b95('0x18')](function(_0x2675a2){logger[_0x4b95('0x15')](_0x4b95('0x19'),_0x2675a2['message'],_0x3dd27a);_0x318658(_0xc7574a[_0x4b95('0x15')](0x1f4,_0x2675a2[_0x4b95('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f10f6e5..3262fdf 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 _0xdc2b=['save','remove','emit','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xdc2b,0x1d4));var _0xbdc2=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xdc2b[_0x5d4607];return _0x5e4a86;};'use strict';var WhatsappAccountEvents=require(_0xbdc2('0x0'));var events=[_0xbdc2('0x1'),_0xbdc2('0x2'),'update'];function createListener(_0x1a3e47,_0x2c1839){return function(_0x35e919){_0x2c1839[_0xbdc2('0x3')](_0x1a3e47,_0x35e919);};}function removeListener(_0x5bad97,_0x7d1402){return function(){WhatsappAccountEvents['removeListener'](_0x5bad97,_0x7d1402);};}exports[_0xbdc2('0x4')]=function(_0x3a6c55){for(var _0x4f12e9=0x0,_0x400f8c=events[_0xbdc2('0x5')];_0x4f12e9<_0x400f8c;_0x4f12e9++){var _0x5abdae=events[_0x4f12e9];var _0x5064a0=createListener(_0xbdc2('0x6')+_0x5abdae,_0x3a6c55);WhatsappAccountEvents['on'](_0x5abdae,_0x5064a0);}}; \ No newline at end of file +var _0x8ec7=['update','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x8ec7,0x75));var _0x78ec=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x8ec7[_0x581960];return _0x4ee892;};'use strict';var WhatsappAccountEvents=require(_0x78ec('0x0'));var events=[_0x78ec('0x1'),_0x78ec('0x2'),_0x78ec('0x3')];function createListener(_0x235370,_0x1d3e28){return function(_0x395d06){_0x1d3e28[_0x78ec('0x4')](_0x235370,_0x395d06);};}function removeListener(_0x3cedf3,_0x5a3617){return function(){WhatsappAccountEvents[_0x78ec('0x5')](_0x3cedf3,_0x5a3617);};}exports['register']=function(_0x49cbf1){for(var _0x3131b1=0x0,_0x17476f=events[_0x78ec('0x6')];_0x3131b1<_0x17476f;_0x3131b1++){var _0x21f647=events[_0x3131b1];var _0x3d7a7c=createListener(_0x78ec('0x7')+_0x21f647,_0x49cbf1);WhatsappAccountEvents['on'](_0x21f647,_0x3d7a7c);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 10d820a..e701683 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 _0x21bb=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index','get','/:id','isAuthenticated','show','post','put','destroy','multer'];(function(_0x1b669a,_0x354b58){var _0x4ada7f=function(_0x654a6d){while(--_0x654a6d){_0x1b669a['push'](_0x1b669a['shift']());}};_0x4ada7f(++_0x354b58);}(_0x21bb,0x10d));var _0xb21b=function(_0x2cdb35,_0x2375e3){_0x2cdb35=_0x2cdb35-0x0;var _0x531d51=_0x21bb[_0x2cdb35];return _0x531d51;};'use strict';var multer=require(_0xb21b('0x0'));var util=require(_0xb21b('0x1'));var path=require('path');var timeout=require(_0xb21b('0x2'));var express=require(_0xb21b('0x3'));var router=express[_0xb21b('0x4')]();var fs_extra=require(_0xb21b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb21b('0x6'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb21b('0x7')]);router[_0xb21b('0x8')](_0xb21b('0x9'),auth[_0xb21b('0xa')](),controller[_0xb21b('0xb')]);router[_0xb21b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb21b('0xd')]('/:id',auth[_0xb21b('0xa')](),controller['update']);router['delete'](_0xb21b('0x9'),auth[_0xb21b('0xa')](),controller[_0xb21b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6ebd=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x4e0ab8,_0x401afb){var _0x4c1f40=function(_0x7f95ef){while(--_0x7f95ef){_0x4e0ab8['push'](_0x4e0ab8['shift']());}};_0x4c1f40(++_0x401afb);}(_0x6ebd,0xce));var _0xd6eb=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x6ebd[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0xd6eb('0x0'));var util=require(_0xd6eb('0x1'));var path=require(_0xd6eb('0x2'));var timeout=require(_0xd6eb('0x3'));var express=require('express');var router=express[_0xd6eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd6eb('0x5'));var interaction=require(_0xd6eb('0x6'));var config=require(_0xd6eb('0x7'));var controller=require(_0xd6eb('0x8'));router[_0xd6eb('0x9')]('/',auth[_0xd6eb('0xa')](),controller[_0xd6eb('0xb')]);router[_0xd6eb('0x9')](_0xd6eb('0xc'),auth['isAuthenticated'](),controller[_0xd6eb('0xd')]);router[_0xd6eb('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd6eb('0xf')]('/:id',auth[_0xd6eb('0xa')](),controller[_0xd6eb('0x10')]);router[_0xd6eb('0x11')](_0xd6eb('0xc'),auth[_0xd6eb('0xa')](),controller['destroy']);module[_0xd6eb('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 665a383..8a63a03 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 _0x4cf0=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x38ebd9,_0x352d11){var _0x5a7327=function(_0x2ae8c6){while(--_0x2ae8c6){_0x38ebd9['push'](_0x38ebd9['shift']());}};_0x5a7327(++_0x352d11);}(_0x4cf0,0x13a));var _0x04cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4cf0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x04cf('0x0'));module[_0x04cf('0x1')]={'priority':{'type':Sequelize[_0x04cf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x04cf('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x04cf('0x4')]()},'description':{'type':Sequelize[_0x04cf('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x04cf('0x5')}}; \ No newline at end of file +var _0x6331=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x21054f,_0x27a530){var _0x1af557=function(_0x3db5a3){while(--_0x3db5a3){_0x21054f['push'](_0x21054f['shift']());}};_0x1af557(++_0x27a530);}(_0x6331,0x101));var _0x1633=function(_0x4b215a,_0x155412){_0x4b215a=_0x4b215a-0x0;var _0xea18=_0x6331[_0x4b215a];return _0xea18;};'use strict';var Sequelize=require(_0x1633('0x0'));module[_0x1633('0x1')]={'priority':{'type':Sequelize[_0x1633('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1633('0x3')],'allowNull':![],'defaultValue':_0x1633('0x4')},'appdata':{'type':Sequelize[_0x1633('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1633('0x3')],'defaultValue':_0x1633('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a292cb8..2f8b80f 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 _0x15ef=['bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','save','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','WhatsappApplication','include','findAll','catch','show','params','length','includeAll','options','find','create','body','update','rimraf','zip-dir','request-promise','moment'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x15ef,0x80));var _0xf15e=function(_0x39c98f,_0x4014e0){_0x39c98f=_0x39c98f-0x0;var _0x36fd40=_0x15ef[_0x39c98f];return _0x36fd40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf15e('0x0'));var zipdir=require(_0xf15e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var BPromise=require(_0xf15e('0x4'));var Mustache=require(_0xf15e('0x5'));var util=require(_0xf15e('0x6'));var path=require('path');var sox=require(_0xf15e('0x7'));var csv=require(_0xf15e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf15e('0x9'));var squel=require(_0xf15e('0xa'));var crypto=require('crypto');var jsforce=require(_0xf15e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf15e('0x8'));var querystring=require(_0xf15e('0xc'));var Papa=require(_0xf15e('0xd'));var Redis=require(_0xf15e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15e('0xf'));var logger=require(_0xf15e('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf15e('0x11'));var db=require(_0xf15e('0x12'))['db'];function respondWithStatusCode(_0x8551e2,_0x5809f7){_0x5809f7=_0x5809f7||0xcc;return function(_0x442d51){if(_0x442d51){return _0x8551e2[_0xf15e('0x13')](_0x5809f7);}return _0x8551e2[_0xf15e('0x14')](_0x5809f7)['end']();};}function respondWithResult(_0x1ec4ad,_0x1d76e9){_0x1d76e9=_0x1d76e9||0xc8;return function(_0x3e1b34){if(_0x3e1b34){return _0x1ec4ad[_0xf15e('0x14')](_0x1d76e9)[_0xf15e('0x15')](_0x3e1b34);}};}function respondWithFilteredResult(_0x1cbcc3,_0x17c241){return function(_0x2d6bd7){if(_0x2d6bd7){var _0x54b94c=typeof _0x17c241[_0xf15e('0x16')]===_0xf15e('0x17')&&typeof _0x17c241['limit']===_0xf15e('0x17');var _0x4356ca=_0x2d6bd7[_0xf15e('0x18')];var _0x487018=_0x54b94c?0x0:_0x17c241['offset'];var _0x3ad067=_0x54b94c?_0x2d6bd7[_0xf15e('0x18')]:_0x17c241['offset']+_0x17c241[_0xf15e('0x19')];var _0x1f1f33;if(_0x3ad067>=_0x4356ca){_0x3ad067=_0x4356ca;_0x1f1f33=0xc8;}else{_0x1f1f33=0xce;}_0x1cbcc3[_0xf15e('0x14')](_0x1f1f33);return _0x1cbcc3['set']('Content-Range',_0x487018+'-'+_0x3ad067+'/'+_0x4356ca)[_0xf15e('0x15')](_0x2d6bd7);}return null;};}function patchUpdates(_0x3fa737){return function(_0x499658){try{jsonpatch[_0xf15e('0x1a')](_0x499658,_0x3fa737,!![]);}catch(_0x56e8c9){return BPromise['reject'](_0x56e8c9);}return _0x499658[_0xf15e('0x1b')]();};}function saveUpdates(_0x239d41,_0x389489){return function(_0x9ece34){if(_0x9ece34){return _0x9ece34['update'](_0x239d41)[_0xf15e('0x1c')](function(_0xa09c0c){return _0xa09c0c;});}return null;};}function removeEntity(_0x302b70,_0x51c06a){return function(_0x248c4b){if(_0x248c4b){return _0x248c4b[_0xf15e('0x1d')]()['then'](function(){_0x302b70['status'](0xcc)[_0xf15e('0x1e')]();});}};}function handleEntityNotFound(_0xb36af,_0x1fd237){return function(_0x471079){if(!_0x471079){_0xb36af[_0xf15e('0x13')](0x194);}return _0x471079;};}function handleError(_0x58877f,_0x48764e){_0x48764e=_0x48764e||0x1f4;return function(_0x3f9d64){logger[_0xf15e('0x1f')](_0x3f9d64['stack']);if(_0x3f9d64[_0xf15e('0x20')]){delete _0x3f9d64[_0xf15e('0x20')];}_0x58877f[_0xf15e('0x14')](_0x48764e)[_0xf15e('0x21')](_0x3f9d64);};}exports[_0xf15e('0x22')]=function(_0xff4c07,_0x1e6a63){var _0x40321a={},_0x5dd9cf={},_0x3567d5={'count':0x0,'rows':[]};var _0x17f112=_[_0xf15e('0x23')](db['WhatsappApplication'][_0xf15e('0x24')],function(_0x203711){return{'name':_0x203711['fieldName'],'type':_0x203711[_0xf15e('0x25')][_0xf15e('0x26')]};});_0x5dd9cf[_0xf15e('0x27')]=_['map'](_0x17f112,_0xf15e('0x20'));_0x5dd9cf[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0xff4c07[_0xf15e('0x28')]);_0x5dd9cf['filters']=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],_0x5dd9cf['query']);_0x40321a[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],qs['fields'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2c')]));_0x40321a['attributes']=_0x40321a[_0xf15e('0x2b')]['length']?_0x40321a[_0xf15e('0x2b')]:_0x5dd9cf[_0xf15e('0x27')];if(!_0xff4c07['query']['hasOwnProperty'](_0xf15e('0x2d'))){_0x40321a[_0xf15e('0x19')]=qs['limit'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x19')]);_0x40321a[_0xf15e('0x16')]=qs[_0xf15e('0x16')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x16')]);}_0x40321a['order']=qs[_0xf15e('0x2e')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2e')]);_0x40321a[_0xf15e('0x2f')]=qs[_0xf15e('0x30')](_[_0xf15e('0x31')](_0xff4c07[_0xf15e('0x28')],_0x5dd9cf[_0xf15e('0x30')]),_0x17f112);if(_0xff4c07['query'][_0xf15e('0x32')]){_0x40321a['where']=_[_0xf15e('0x33')](_0x40321a[_0xf15e('0x2f')],{'$or':_[_0xf15e('0x23')](_0x17f112,function(_0x40e707){if(_0x40e707[_0xf15e('0x25')]!==_0xf15e('0x34')){var _0x4d411f={};_0x4d411f[_0x40e707[_0xf15e('0x20')]]={'$like':'%'+_0xff4c07[_0xf15e('0x28')][_0xf15e('0x32')]+'%'};return _0x4d411f;}})});}_0x40321a=_[_0xf15e('0x33')]({},_0x40321a,_0xff4c07['options']);var _0x52ebab={'where':_0x40321a[_0xf15e('0x2f')]};return db[_0xf15e('0x35')][_0xf15e('0x18')](_0x52ebab)['then'](function(_0x514c68){_0x3567d5['count']=_0x514c68;if(_0xff4c07['query']['includeAll']){_0x40321a[_0xf15e('0x36')]=[{'all':!![]}];}return db[_0xf15e('0x35')][_0xf15e('0x37')](_0x40321a);})['then'](function(_0x3a56bd){_0x3567d5['rows']=_0x3a56bd;return _0x3567d5;})[_0xf15e('0x1c')](respondWithFilteredResult(_0x1e6a63,_0x40321a))[_0xf15e('0x38')](handleError(_0x1e6a63,null));};exports[_0xf15e('0x39')]=function(_0x180d7a,_0x52bbc4){var _0xf32fc5={'raw':!![],'where':{'id':_0x180d7a[_0xf15e('0x3a')]['id']}},_0x37f0a6={};_0x37f0a6[_0xf15e('0x27')]=_[_0xf15e('0x29')](db['WhatsappApplication'][_0xf15e('0x24')]);_0x37f0a6[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0x180d7a[_0xf15e('0x28')]);_0x37f0a6[_0xf15e('0x30')]=_[_0xf15e('0x2a')](_0x37f0a6[_0xf15e('0x27')],_0x37f0a6['query']);_0xf32fc5[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x37f0a6['model'],qs['fields'](_0x180d7a[_0xf15e('0x28')]['fields']));_0xf32fc5['attributes']=_0xf32fc5[_0xf15e('0x2b')][_0xf15e('0x3b')]?_0xf32fc5['attributes']:_0x37f0a6[_0xf15e('0x27')];if(_0x180d7a[_0xf15e('0x28')][_0xf15e('0x3c')]){_0xf32fc5[_0xf15e('0x36')]=[{'all':!![]}];}_0xf32fc5=_[_0xf15e('0x33')]({},_0xf32fc5,_0x180d7a[_0xf15e('0x3d')]);return db[_0xf15e('0x35')][_0xf15e('0x3e')](_0xf32fc5)[_0xf15e('0x1c')](handleEntityNotFound(_0x52bbc4,null))['then'](respondWithResult(_0x52bbc4,null))[_0xf15e('0x38')](handleError(_0x52bbc4,null));};exports[_0xf15e('0x3f')]=function(_0x3b79a8,_0x5b31c9){return db['WhatsappApplication'][_0xf15e('0x3f')](_0x3b79a8[_0xf15e('0x40')],{})[_0xf15e('0x1c')](respondWithResult(_0x5b31c9,0xc9))[_0xf15e('0x38')](handleError(_0x5b31c9,null));};exports[_0xf15e('0x41')]=function(_0xac7515,_0x3b5c7b){if(_0xac7515[_0xf15e('0x40')]['id']){delete _0xac7515['body']['id'];}return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0xac7515['params']['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3b5c7b,null))['then'](saveUpdates(_0xac7515[_0xf15e('0x40')],null))[_0xf15e('0x1c')](respondWithResult(_0x3b5c7b,null))[_0xf15e('0x38')](handleError(_0x3b5c7b,null));};exports['destroy']=function(_0x46e6e9,_0x3e2fd6){return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0x46e6e9[_0xf15e('0x3a')]['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3e2fd6,null))[_0xf15e('0x1c')](removeEntity(_0x3e2fd6,null))[_0xf15e('0x38')](handleError(_0x3e2fd6,null));}; \ No newline at end of file +var _0x79d7=['rows','show','includeAll','catch','create','body','params','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','include','findAll'];(function(_0x56535d,_0x45c5e8){var _0x4db0ee=function(_0x117fc9){while(--_0x117fc9){_0x56535d['push'](_0x56535d['shift']());}};_0x4db0ee(++_0x45c5e8);}(_0x79d7,0x9c));var _0x779d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x79d7[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x779d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x779d('0x1'));var jsonpatch=require(_0x779d('0x2'));var rp=require(_0x779d('0x3'));var moment=require(_0x779d('0x4'));var BPromise=require(_0x779d('0x5'));var Mustache=require(_0x779d('0x6'));var util=require('util');var path=require(_0x779d('0x7'));var sox=require(_0x779d('0x8'));var csv=require(_0x779d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x779d('0xa'));var squel=require('squel');var crypto=require(_0x779d('0xb'));var jsforce=require(_0x779d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x779d('0xd'));var authService=require(_0x779d('0xe'));var qs=require(_0x779d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x779d('0x10'));var logger=require('../../config/logger')(_0x779d('0x11'));var utils=require('../../config/utils');var config=require(_0x779d('0x12'));var licenseUtil=require(_0x779d('0x13'));var db=require(_0x779d('0x14'))['db'];function respondWithStatusCode(_0x54037e,_0x3a6a2f){_0x3a6a2f=_0x3a6a2f||0xcc;return function(_0x40495a){if(_0x40495a){return _0x54037e[_0x779d('0x15')](_0x3a6a2f);}return _0x54037e[_0x779d('0x16')](_0x3a6a2f)[_0x779d('0x17')]();};}function respondWithResult(_0x258e05,_0x4ae9c7){_0x4ae9c7=_0x4ae9c7||0xc8;return function(_0x3c12cb){if(_0x3c12cb){return _0x258e05[_0x779d('0x16')](_0x4ae9c7)[_0x779d('0x18')](_0x3c12cb);}};}function respondWithFilteredResult(_0x349220,_0x1c7ad7){return function(_0x49dbc6){if(_0x49dbc6){var _0x26dfa2=typeof _0x1c7ad7[_0x779d('0x19')]===_0x779d('0x1a')&&typeof _0x1c7ad7['limit']===_0x779d('0x1a');var _0x219106=_0x49dbc6[_0x779d('0x1b')];var _0x18900e=_0x26dfa2?0x0:_0x1c7ad7[_0x779d('0x19')];var _0x21102d=_0x26dfa2?_0x49dbc6[_0x779d('0x1b')]:_0x1c7ad7[_0x779d('0x19')]+_0x1c7ad7[_0x779d('0x1c')];var _0x4192c;if(_0x21102d>=_0x219106){_0x21102d=_0x219106;_0x4192c=0xc8;}else{_0x4192c=0xce;}_0x349220[_0x779d('0x16')](_0x4192c);return _0x349220[_0x779d('0x1d')](_0x779d('0x1e'),_0x18900e+'-'+_0x21102d+'/'+_0x219106)['json'](_0x49dbc6);}return null;};}function patchUpdates(_0x1ab255){return function(_0x57c5fd){try{jsonpatch[_0x779d('0x1f')](_0x57c5fd,_0x1ab255,!![]);}catch(_0x4d0f40){return BPromise[_0x779d('0x20')](_0x4d0f40);}return _0x57c5fd[_0x779d('0x21')]();};}function saveUpdates(_0xffa3e,_0x2d4e36){return function(_0x599ee3){if(_0x599ee3){return _0x599ee3[_0x779d('0x22')](_0xffa3e)[_0x779d('0x23')](function(_0xbe3028){return _0xbe3028;});}return null;};}function removeEntity(_0x10da0e,_0x101ec1){return function(_0x1ddfa5){if(_0x1ddfa5){return _0x1ddfa5[_0x779d('0x24')]()[_0x779d('0x23')](function(){_0x10da0e[_0x779d('0x16')](0xcc)[_0x779d('0x17')]();});}};}function handleEntityNotFound(_0x4cbd1d,_0x3c990c){return function(_0x58e397){if(!_0x58e397){_0x4cbd1d['sendStatus'](0x194);}return _0x58e397;};}function handleError(_0x3d5b8d,_0x391141){_0x391141=_0x391141||0x1f4;return function(_0x5057c6){logger[_0x779d('0x25')](_0x5057c6[_0x779d('0x26')]);if(_0x5057c6[_0x779d('0x27')]){delete _0x5057c6['name'];}_0x3d5b8d[_0x779d('0x16')](_0x391141)[_0x779d('0x28')](_0x5057c6);};}exports[_0x779d('0x29')]=function(_0x1b7584,_0x23d5ea){var _0x882d18={},_0x5e1611={},_0x12714c={'count':0x0,'rows':[]};var _0x37beab=_[_0x779d('0x2a')](db[_0x779d('0x2b')][_0x779d('0x2c')],function(_0x1ed423){return{'name':_0x1ed423[_0x779d('0x2d')],'type':_0x1ed423[_0x779d('0x2e')][_0x779d('0x2f')]};});_0x5e1611[_0x779d('0x30')]=_['map'](_0x37beab,_0x779d('0x27'));_0x5e1611[_0x779d('0x31')]=_[_0x779d('0x32')](_0x1b7584[_0x779d('0x31')]);_0x5e1611[_0x779d('0x33')]=_[_0x779d('0x34')](_0x5e1611[_0x779d('0x30')],_0x5e1611[_0x779d('0x31')]);_0x882d18[_0x779d('0x35')]=_['intersection'](_0x5e1611[_0x779d('0x30')],qs[_0x779d('0x36')](_0x1b7584[_0x779d('0x31')]['fields']));_0x882d18[_0x779d('0x35')]=_0x882d18[_0x779d('0x35')][_0x779d('0x37')]?_0x882d18[_0x779d('0x35')]:_0x5e1611[_0x779d('0x30')];if(!_0x1b7584[_0x779d('0x31')][_0x779d('0x38')]('nolimit')){_0x882d18[_0x779d('0x1c')]=qs[_0x779d('0x1c')](_0x1b7584[_0x779d('0x31')]['limit']);_0x882d18[_0x779d('0x19')]=qs['offset'](_0x1b7584[_0x779d('0x31')][_0x779d('0x19')]);}_0x882d18[_0x779d('0x39')]=qs[_0x779d('0x3a')](_0x1b7584[_0x779d('0x31')][_0x779d('0x3a')]);_0x882d18[_0x779d('0x3b')]=qs[_0x779d('0x33')](_[_0x779d('0x3c')](_0x1b7584[_0x779d('0x31')],_0x5e1611[_0x779d('0x33')]),_0x37beab);if(_0x1b7584['query']['filter']){_0x882d18['where']=_[_0x779d('0x3d')](_0x882d18[_0x779d('0x3b')],{'$or':_['map'](_0x37beab,function(_0xcba9b3){if(_0xcba9b3[_0x779d('0x2e')]!=='VIRTUAL'){var _0x21ce5f={};_0x21ce5f[_0xcba9b3[_0x779d('0x27')]]={'$like':'%'+_0x1b7584[_0x779d('0x31')][_0x779d('0x3e')]+'%'};return _0x21ce5f;}})});}_0x882d18=_[_0x779d('0x3d')]({},_0x882d18,_0x1b7584[_0x779d('0x3f')]);var _0x52f87d={'where':_0x882d18[_0x779d('0x3b')]};return db['WhatsappApplication'][_0x779d('0x1b')](_0x52f87d)[_0x779d('0x23')](function(_0x5e1d80){_0x12714c[_0x779d('0x1b')]=_0x5e1d80;if(_0x1b7584[_0x779d('0x31')]['includeAll']){_0x882d18[_0x779d('0x40')]=[{'all':!![]}];}return db[_0x779d('0x2b')][_0x779d('0x41')](_0x882d18);})[_0x779d('0x23')](function(_0x44a83){_0x12714c[_0x779d('0x42')]=_0x44a83;return _0x12714c;})[_0x779d('0x23')](respondWithFilteredResult(_0x23d5ea,_0x882d18))['catch'](handleError(_0x23d5ea,null));};exports[_0x779d('0x43')]=function(_0x558550,_0x1657f7){var _0xa9c221={'raw':!![],'where':{'id':_0x558550['params']['id']}},_0x1aea19={};_0x1aea19['model']=_[_0x779d('0x32')](db['WhatsappApplication']['rawAttributes']);_0x1aea19[_0x779d('0x31')]=_['keys'](_0x558550[_0x779d('0x31')]);_0x1aea19['filters']=_[_0x779d('0x34')](_0x1aea19['model'],_0x1aea19[_0x779d('0x31')]);_0xa9c221[_0x779d('0x35')]=_[_0x779d('0x34')](_0x1aea19[_0x779d('0x30')],qs[_0x779d('0x36')](_0x558550[_0x779d('0x31')][_0x779d('0x36')]));_0xa9c221[_0x779d('0x35')]=_0xa9c221[_0x779d('0x35')][_0x779d('0x37')]?_0xa9c221[_0x779d('0x35')]:_0x1aea19['model'];if(_0x558550[_0x779d('0x31')][_0x779d('0x44')]){_0xa9c221['include']=[{'all':!![]}];}_0xa9c221=_['merge']({},_0xa9c221,_0x558550[_0x779d('0x3f')]);return db[_0x779d('0x2b')]['find'](_0xa9c221)[_0x779d('0x23')](handleEntityNotFound(_0x1657f7,null))[_0x779d('0x23')](respondWithResult(_0x1657f7,null))[_0x779d('0x45')](handleError(_0x1657f7,null));};exports['create']=function(_0x424421,_0x22942b){return db[_0x779d('0x2b')][_0x779d('0x46')](_0x424421[_0x779d('0x47')],{})[_0x779d('0x23')](respondWithResult(_0x22942b,0xc9))[_0x779d('0x45')](handleError(_0x22942b,null));};exports[_0x779d('0x22')]=function(_0x4563a5,_0x3152f2){if(_0x4563a5[_0x779d('0x47')]['id']){delete _0x4563a5[_0x779d('0x47')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x4563a5[_0x779d('0x48')]['id']}})[_0x779d('0x23')](handleEntityNotFound(_0x3152f2,null))['then'](saveUpdates(_0x4563a5['body'],null))[_0x779d('0x23')](respondWithResult(_0x3152f2,null))[_0x779d('0x45')](handleError(_0x3152f2,null));};exports[_0x779d('0x24')]=function(_0x1dfa3e,_0x17c180){return db['WhatsappApplication'][_0x779d('0x49')]({'where':{'id':_0x1dfa3e[_0x779d('0x48')]['id']}})[_0x779d('0x23')](handleEntityNotFound(_0x17c180,null))[_0x779d('0x23')](removeEntity(_0x17c180,null))[_0x779d('0x45')](handleError(_0x17c180,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ea972f7..4e3e160 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 _0xeedf=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_applications','utf8mb4_unicode_ci'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0xeedf,0x12c));var _0xfeed=function(_0x55e3f4,_0xd408ac){_0x55e3f4=_0x55e3f4-0x0;var _0xac10cc=_0xeedf[_0x55e3f4];return _0xac10cc;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require(_0xfeed('0x2'))('api');var moment=require(_0xfeed('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeed('0x4'));var fs=require('fs');var path=require(_0xfeed('0x5'));var rimraf=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xfeed('0x8')]=function(_0x2c211d,_0x5df4fe){return _0x2c211d[_0xfeed('0x9')]('WhatsappApplication',attributes,{'tableName':_0xfeed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfeed('0xb')});}; \ No newline at end of file +var _0x689c=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x689c,0x9e));var _0xc689=function(_0x52f77a,_0x33c372){_0x52f77a=_0x52f77a-0x0;var _0x5985a1=_0x689c[_0x52f77a];return _0x5985a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc689('0x0'))(_0xc689('0x1'));var moment=require(_0xc689('0x2'));var BPromise=require(_0xc689('0x3'));var rp=require(_0xc689('0x4'));var fs=require('fs');var path=require(_0xc689('0x5'));var rimraf=require('rimraf');var config=require(_0xc689('0x6'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x3a4916,_0x28ce4c){return _0x3a4916[_0xc689('0x7')](_0xc689('0x8'),attributes,{'tableName':_0xc689('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc689('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 208f5bd..462969c 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x55d1ac,_0x5c91c5){var _0x18459c=function(_0x524b78){while(--_0x524b78){_0x55d1ac['push'](_0x55d1ac['shift']());}};_0x18459c(++_0x5c91c5);}(_0x81bd,0x7c));var _0xd81b=function(_0xad0aaa,_0x4943c8){_0xad0aaa=_0xad0aaa-0x0;var _0x168b18=_0x81bd[_0xad0aaa];return _0x168b18;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0xed1f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2c58f5,_0x2fc4be){var _0x150368=function(_0x4e959d){while(--_0x4e959d){_0x2c58f5['push'](_0x2c58f5['shift']());}};_0x150368(++_0x2fc4be);}(_0xed1f,0x6a));var _0xfed1=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xed1f[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f7beb25..3fa5b65 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 _0x11e5=['/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','whatsappinteraction:addtags','addTags','whatsapp','update','delete','whatsappinteraction:destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe'];(function(_0x2e686b,_0x1cc985){var _0x156e75=function(_0x2c2c6d){while(--_0x2c2c6d){_0x2e686b['push'](_0x2e686b['shift']());}};_0x156e75(++_0x1cc985);}(_0x11e5,0x8b));var _0x511e=function(_0x5ac5e8,_0xc333d2){_0x5ac5e8=_0x5ac5e8-0x0;var _0x5eb1ff=_0x11e5[_0x5ac5e8];return _0x5eb1ff;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0x9')](_0x511e('0xd'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0x9')](_0x511e('0xf'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x511e('0x11')]);router[_0x511e('0x12')](_0x511e('0xd'),auth[_0x511e('0x7')](),controller[_0x511e('0x13')]);router[_0x511e('0x12')]('/:id/tags',auth[_0x511e('0x7')](),interaction[_0x511e('0x14')]('whatsapp',_0x511e('0x15')),controller[_0x511e('0x16')]);router['put'](_0x511e('0xb'),auth[_0x511e('0x7')](),interaction[_0x511e('0x14')](_0x511e('0x17'),'whatsappinteraction:update'),controller[_0x511e('0x18')]);router[_0x511e('0x19')](_0x511e('0xb'),auth['isAuthenticated'](),interaction[_0x511e('0x14')]('whatsapp',_0x511e('0x1a')),controller['destroy']);router['delete'](_0x511e('0x1b'),auth['isAuthenticated'](),controller[_0x511e('0x1c')]);module[_0x511e('0x1d')]=router; \ No newline at end of file +var _0xeff8=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4a2718,_0x2b8edb){var _0x41cddf=function(_0x2924d7){while(--_0x2924d7){_0x4a2718['push'](_0x4a2718['shift']());}};_0x41cddf(++_0x2b8edb);}(_0xeff8,0x186));var _0x8eff=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xeff8[_0x43b08];return _0x5e05f4;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xb')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['show']);router['get'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x10')]);router['get'](_0x8eff('0x11'),auth[_0x8eff('0x9')](),controller['download']);router[_0x8eff('0x12')]('/',auth[_0x8eff('0x9')](),controller['create']);router['post'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x13')]);router[_0x8eff('0x12')](_0x8eff('0x14'),auth['isAuthenticated'](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x17')),controller[_0x8eff('0x18')]);router[_0x8eff('0x19')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1a')),controller[_0x8eff('0x1b')]);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1c')),controller[_0x8eff('0x1d')]);router[_0x8eff('0x1e')](_0x8eff('0x14'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x1f')]);module[_0x8eff('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d7601a9..bbbf4ac 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 _0x9b8e=['DATE','sequelize','exports','BOOLEAN','STRING','ENUM','out'];(function(_0x21e743,_0x5e8d88){var _0x1d6997=function(_0xa94b00){while(--_0xa94b00){_0x21e743['push'](_0x21e743['shift']());}};_0x1d6997(++_0x5e8d88);}(_0x9b8e,0x158));var _0xe9b8=function(_0x5a30e3,_0x54a54e){_0x5a30e3=_0x5a30e3-0x0;var _0x174d47=_0x9b8e[_0x5a30e3];return _0x174d47;};'use strict';var Sequelize=require(_0xe9b8('0x0'));var moment=require('moment');module[_0xe9b8('0x1')]={'closed':{'type':Sequelize[_0xe9b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe9b8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe9b8('0x3')]},'phone':{'type':Sequelize[_0xe9b8('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe9b8('0x4')]('in',_0xe9b8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe9b8('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xe9b8('0x4')]('in',_0xe9b8('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe9b8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9d5c=['BOOLEAN','STRING','DATE','out','ENUM','sequelize','exports'];(function(_0x3d2944,_0x410c3e){var _0x370d7b=function(_0x2c283d){while(--_0x2c283d){_0x3d2944['push'](_0x3d2944['shift']());}};_0x370d7b(++_0x410c3e);}(_0x9d5c,0x98));var _0xc9d5=function(_0x2862b1,_0x51a367){_0x2862b1=_0x2862b1-0x0;var _0x817ee6=_0x9d5c[_0x2862b1];return _0x817ee6;};'use strict';var Sequelize=require(_0xc9d5('0x0'));var moment=require('moment');module[_0xc9d5('0x1')]={'closed':{'type':Sequelize[_0xc9d5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc9d5('0x3')]},'secondDisposition':{'type':Sequelize[_0xc9d5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc9d5('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc9d5('0x3')]},'read1stAt':{'type':Sequelize[_0xc9d5('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc9d5('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc9d5('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc9d5('0x6')]('in',_0xc9d5('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc9d5('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a0e54d0..c4baa95 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 _0xcabe=['createWriteStream','basename','out','lastName','direction','read','renderFile','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','name','send','Users','map','fullname','Tags','push','TagIds','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','WhatsappInteraction','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','end','Tag','forEach','union','User','body','keys','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','toString','all','params','rawAttributes','include','options','create','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','WhatsappInteractionId','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','firstName','Attachment','Messages','secret','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','existsSync','createReadStream'];(function(_0x3dcb32,_0x28c7fd){var _0x2ce602=function(_0x3012e3){while(--_0x3012e3){_0x3dcb32['push'](_0x3dcb32['shift']());}};_0x2ce602(++_0x28c7fd);}(_0xcabe,0x1ef));var _0xecab=function(_0x3b0500,_0x520f96){_0x3b0500=_0x3b0500-0x0;var _0x290354=_0xcabe[_0x3b0500];return _0x290354;};'use strict';var emlformat=require(_0xecab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecab('0x1'));var jsonpatch=require(_0xecab('0x2'));var rp=require('request-promise');var moment=require(_0xecab('0x3'));var BPromise=require(_0xecab('0x4'));var Mustache=require('mustache');var util=require(_0xecab('0x5'));var path=require(_0xecab('0x6'));var sox=require(_0xecab('0x7'));var csv=require('to-csv');var ejs=require(_0xecab('0x8'));var fs=require('fs');var fs_extra=require(_0xecab('0x9'));var _=require(_0xecab('0xa'));var squel=require(_0xecab('0xb'));var crypto=require(_0xecab('0xc'));var jsforce=require(_0xecab('0xd'));var deskjs=require(_0xecab('0xe'));var toCsv=require(_0xecab('0xf'));var querystring=require(_0xecab('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecab('0x11'));var qs=require(_0xecab('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xecab('0x13'));var hardwareService=require(_0xecab('0x14'));var logger=require(_0xecab('0x15'))(_0xecab('0x16'));var utils=require(_0xecab('0x17'));var config=require(_0xecab('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xecab('0x19'))['db'];config[_0xecab('0x1a')]=_[_0xecab('0x1b')](config[_0xecab('0x1a')],{'host':_0xecab('0x1c'),'port':0x18eb});var socket=require(_0xecab('0x1d'))(new Redis(config['redis']));require(_0xecab('0x1e'))['register'](socket);function respondWithStatusCode(_0x4bfc49,_0xfe0f2d){_0xfe0f2d=_0xfe0f2d||0xcc;return function(_0x3af1a6){if(_0x3af1a6){return _0x4bfc49[_0xecab('0x1f')](_0xfe0f2d);}return _0x4bfc49[_0xecab('0x20')](_0xfe0f2d)['end']();};}function respondWithResult(_0x35feb8,_0x1c5871){_0x1c5871=_0x1c5871||0xc8;return function(_0x260a09){if(_0x260a09){return _0x35feb8[_0xecab('0x20')](_0x1c5871)[_0xecab('0x21')](_0x260a09);}};}function respondWithFilteredResult(_0x55280a,_0x267bf6){return function(_0x447f3d){if(_0x447f3d){var _0x5e7e5e=typeof _0x267bf6[_0xecab('0x22')]===_0xecab('0x23')&&typeof _0x267bf6[_0xecab('0x24')]===_0xecab('0x23');var _0x1f71eb=_0x447f3d[_0xecab('0x25')];var _0x4a450c=_0x5e7e5e?0x0:_0x267bf6[_0xecab('0x22')];var _0x2ec6fb=_0x5e7e5e?_0x447f3d[_0xecab('0x25')]:_0x267bf6['offset']+_0x267bf6[_0xecab('0x24')];var _0x54138e;if(_0x2ec6fb>=_0x1f71eb){_0x2ec6fb=_0x1f71eb;_0x54138e=0xc8;}else{_0x54138e=0xce;}_0x55280a[_0xecab('0x20')](_0x54138e);return _0x55280a['set'](_0xecab('0x26'),_0x4a450c+'-'+_0x2ec6fb+'/'+_0x1f71eb)[_0xecab('0x21')](_0x447f3d);}return null;};}function patchUpdates(_0xe61b4f){return function(_0x39605c){try{jsonpatch[_0xecab('0x27')](_0x39605c,_0xe61b4f,!![]);}catch(_0x18405d){return BPromise[_0xecab('0x28')](_0x18405d);}return _0x39605c[_0xecab('0x29')]();};}function saveUpdates(_0x3c701e,_0x365592){return function(_0x30191f){if(_0x30191f){return _0x30191f[_0xecab('0x2a')](_0x3c701e)['then'](function(_0x1fcc46){return _0x1fcc46;});}return null;};}function removeEntity(_0x4a6240,_0x248aba){return function(_0x3b9822){if(_0x3b9822){return _0x3b9822['destroy']()[_0xecab('0x2b')](function(){_0x4a6240['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6a57,_0xe97566){return function(_0x974659){if(!_0x974659){_0x2d6a57[_0xecab('0x1f')](0x194);}return _0x974659;};}function handleError(_0x34ded8,_0x30ca35){_0x30ca35=_0x30ca35||0x1f4;return function(_0x36c1c1){logger['error'](_0x36c1c1['stack']);if(_0x36c1c1[_0xecab('0x2c')]){delete _0x36c1c1[_0xecab('0x2c')];}_0x34ded8[_0xecab('0x20')](_0x30ca35)[_0xecab('0x2d')](_0x36c1c1);};}function getInteractionUsers(_0x1ef5fe,_0x2e47fd){return new BPromise(function(_0x51d4b9,_0x5501e9){try{if(_0x2e47fd[_0x1ef5fe['id']]){_0x1ef5fe[_0xecab('0x2e')]=_[_0xecab('0x2f')](_0x2e47fd[_0x1ef5fe['id']],function(_0x1cdc69){return{'id':_0x1cdc69['id'],'fullname':_0x1cdc69[_0xecab('0x30')]};});}}catch(_0x2e59d1){_0x5501e9(_0x2e59d1);}_0x51d4b9(_0x1ef5fe);});}function getInteractionTags(_0x3197f9,_0x32955f){return new BPromise(function(_0x2a4661,_0x139a64){try{if(_0x3197f9['TagIds']){_0x3197f9['Tags']=[];_0x3197f9['TagIds']['split'](',')['forEach'](function(_0x32d4bb){_0x3197f9[_0xecab('0x31')][_0xecab('0x32')](_0x32955f[_0x32d4bb]);});}delete _0x3197f9[_0xecab('0x33')];}catch(_0x475a3b){_0x139a64(_0x475a3b);}_0x2a4661(_0x3197f9);});}function updateWhatsappInteraction(_0x35b061,_0x29e3c8,_0x3f30b9){return new BPromise(function(_0x469e10,_0xa151df){return getInteractionUsers(_0x35b061,_0x3f30b9)['then'](function(_0x35b944){return getInteractionTags(_0x35b944,_0x29e3c8);})['then'](function(_0x543ea8){return getStateInteraction(_0x543ea8);})[_0xecab('0x2b')](function(_0x5a719d){_0x469e10(_0x5a719d);})[_0xecab('0x34')](function(_0x225151){_0xa151df(_0x225151);});});}function getStateInteraction(_0x5c12b7){return new BPromise(function(_0xafde3f){_0x5c12b7[_0xecab('0x35')]=0x0;_0x5c12b7[_0xecab('0x36')]=0x0;_0x5c12b7[_0xecab('0x37')]=0x0;_0x5c12b7['unmanaged']=0x0;_0x5c12b7[_0xecab('0x38')]=0x0;if(!_0x5c12b7[_0xecab('0x39')]&&!_0x5c12b7[_0xecab('0x3a')]){_0x5c12b7['waiting']+=0x1;}if(!_0x5c12b7[_0xecab('0x39')]&&_0x5c12b7[_0xecab('0x3a')]){_0x5c12b7['talking']+=0x1;if(_0x5c12b7[_0xecab('0x35')]){_0x5c12b7[_0xecab('0x35')]-=0x1;}}if(_0x5c12b7[_0xecab('0x39')]&&_0x5c12b7['UserId']){_0x5c12b7['answered']+=0x1;if(_0x5c12b7['talking']){_0x5c12b7[_0xecab('0x36')]-=0x1;}}if(_0x5c12b7[_0xecab('0x39')]&&!_0x5c12b7[_0xecab('0x3a')]){_0x5c12b7[_0xecab('0x3b')]+=0x1;if(_0x5c12b7[_0xecab('0x35')]){_0x5c12b7[_0xecab('0x35')]-=0x1;}}_0x5c12b7[_0xecab('0x38')]+=0x1;_0xafde3f(_0x5c12b7);});}exports[_0xecab('0x3c')]=function(_0x4a8116,_0x978283){var _0x57e402={},_0x4af5d2={},_0x5e0bcf={'count':0x0,'rows':[]};var _0x566a5f=_[_0xecab('0x2f')](db[_0xecab('0x3d')]['rawAttributes'],function(_0x1b6b98){return{'name':_0x1b6b98[_0xecab('0x3e')],'type':_0x1b6b98[_0xecab('0x3f')][_0xecab('0x40')]};});_0x4af5d2[_0xecab('0x41')]=_[_0xecab('0x2f')](_0x566a5f,_0xecab('0x2c'));_0x4af5d2[_0xecab('0x42')]=_['keys'](_0x4a8116[_0xecab('0x42')]);_0x4af5d2[_0xecab('0x43')]=_[_0xecab('0x44')](_0x4af5d2[_0xecab('0x41')],_0x4af5d2[_0xecab('0x42')]);_0x57e402[_0xecab('0x45')]=_['intersection'](_0x4af5d2['model'],qs[_0xecab('0x46')](_0x4a8116[_0xecab('0x42')]['fields']));_0x57e402['attributes']=_0x57e402[_0xecab('0x45')][_0xecab('0x47')]?_0x57e402[_0xecab('0x45')]:_0x4af5d2['model'];if(!_0x4a8116[_0xecab('0x42')][_0xecab('0x48')](_0xecab('0x49'))){_0x57e402['limit']=qs[_0xecab('0x24')](_0x4a8116[_0xecab('0x42')][_0xecab('0x24')]);_0x57e402['offset']=qs[_0xecab('0x22')](_0x4a8116[_0xecab('0x42')][_0xecab('0x22')]);}_0x57e402[_0xecab('0x4a')]=qs[_0xecab('0x4b')](_0x4a8116[_0xecab('0x42')][_0xecab('0x4b')]);_0x57e402[_0xecab('0x4c')]=qs['filters'](_[_0xecab('0x4d')](_0x4a8116[_0xecab('0x42')],_0x4af5d2[_0xecab('0x43')]),_0x566a5f);var _0x1b8a3e=[];var _0x54053a=squel['select']()['field']('id')[_0xecab('0x4e')](_0xecab('0x2c'))[_0xecab('0x4e')](_0xecab('0x4f'))[_0xecab('0x50')](_0xecab('0x51'));var _0x5823c6=squel[_0xecab('0x52')]()[_0xecab('0x4e')](_0xecab('0x53'))[_0xecab('0x4e')](_0xecab('0x54'))[_0xecab('0x4e')](_0xecab('0x55'))[_0xecab('0x50')]('user_has_whatsapp_interactions','ui')[_0xecab('0x56')](_0xecab('0x57'),'u',_0xecab('0x58'));var _0x212678=squel['select']()[_0xecab('0x50')](_0xecab('0x59'),'i')[_0xecab('0x56')](_0xecab('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xecab('0x56')](_0xecab('0x57'),'o',_0xecab('0x5b'))[_0xecab('0x56')]('whatsapp_accounts','a',_0xecab('0x5c'))[_0xecab('0x56')](_0xecab('0x5d'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xecab('0x5e'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xecab('0x51'),'t',_0xecab('0x5f'));var _0x138eca=squel[_0xecab('0x60')]();var _0x3dce74=[];var _0x2799a0=squel[_0xecab('0x60')]();var _0x59742a;if(_0x4a8116[_0xecab('0x42')][_0xecab('0x61')]){_0x59742a=as[_0xecab('0x62')](_0x4a8116['query'][_0xecab('0x61')]);var _0x1518a0=_0x59742a[_0xecab('0x63')];for(var _0x28d250=0x0;_0x28d250<_0x59742a[_0xecab('0x64')][_0xecab('0x47')];_0x28d250++){var _0x328eec=_0x59742a[_0xecab('0x64')][_0x28d250];var _0x2ae323='i';var _0x28a699=_['find'](_0x566a5f,[_0xecab('0x2c'),_0x328eec[_0xecab('0x4e')]]);if(!_0x28a699){switch(_0x328eec[_0xecab('0x4e')]){case'unreadMessages':if(_0x328eec[_0xecab('0x65')]==0x1){_0x212678[_0xecab('0x66')]('`'+_0x328eec[_0xecab('0x4e')]+_0xecab('0x67'));}else{_0x212678[_0xecab('0x66')]('`'+_0x328eec[_0xecab('0x4e')]+_0xecab('0x68'));}break;case _0xecab('0x69'):if(_0x328eec[_0xecab('0x6a')]===_0xecab('0x6b')){if(_0x328eec[_0xecab('0x65')][_0xecab('0x6c')]('\x20')['length']>0x1){_0x138eca[_0x1518a0](_0xecab('0x6d'),qs[_0xecab('0x6e')](_0x328eec[_0xecab('0x65')]),null);}else{var _0x4e1b32='%'+_0x328eec[_0xecab('0x65')]+'%';_0x138eca[_0x1518a0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4e1b32,_0x4e1b32,_0x4e1b32);}}else{_0x28a699=_[_0xecab('0x6f')](_0x566a5f,[_0xecab('0x2c'),_0xecab('0x70')]);_0x328eec[_0xecab('0x4e')]=_0xecab('0x70');_0x59cd1b=as[_0xecab('0x71')](_0x2ae323,_0x28a699[_0xecab('0x3f')],_0x328eec);_0x138eca[_0x1518a0](_0x59cd1b[_0xecab('0x72')],_0x59cd1b[_0xecab('0x65')][_0xecab('0x73')],_0x59cd1b[_0xecab('0x65')][_0xecab('0x74')]);}break;case _0xecab('0x75'):var _0x118113=_0x328eec[_0xecab('0x65')][_0xecab('0x6c')](',')[_0xecab('0x2f')](function(_0x2b908d){return Number(_0x2b908d);});_0x118113[_0xecab('0x76')](function(_0x5870a1){_0x2799a0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5870a1+',%');});_0x3dce74=_[_0xecab('0x77')](_0x3dce74,_0x118113);break;case _0xecab('0x78'):if(_0x328eec[_0xecab('0x6a')]===_0xecab('0x6b')){_0x138eca[_0x1518a0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x328eec['value']+'%',null);}else{_0x28a699=_[_0xecab('0x6f')](_0x566a5f,[_0xecab('0x2c'),_0xecab('0x3a')]);_0x328eec['field']='UserId';_0x59cd1b=as[_0xecab('0x71')](_0x2ae323,_0x28a699[_0xecab('0x3f')],_0x328eec);_0x138eca[_0x1518a0](_0x59cd1b[_0xecab('0x72')],_0x59cd1b['value'][_0xecab('0x73')],_0x59cd1b[_0xecab('0x65')][_0xecab('0x74')]);}break;case _0xecab('0x79'):_0x59cd1b=as[_0xecab('0x71')]('me',null,_0x328eec);_0x138eca[_0x1518a0](_0x59cd1b['text'],_0x59cd1b[_0xecab('0x65')][_0xecab('0x73')],_0x59cd1b[_0xecab('0x65')]['end']);break;}}else{var _0x59cd1b=as[_0xecab('0x71')](_0x2ae323,_0x28a699['type'],_0x328eec);_0x138eca[_0x1518a0](_0x59cd1b[_0xecab('0x72')],_0x59cd1b[_0xecab('0x65')]['start'],_0x59cd1b[_0xecab('0x65')][_0xecab('0x74')]);}}}else{var _0x47c115=_(_0x4a8116[_0xecab('0x42')])[_0xecab('0x7a')]()[_0xecab('0x2f')](function(_0x3b921a){return _['some'](_0x566a5f,[_0xecab('0x2c'),_0x3b921a])?_0x3b921a:undefined;})[_0xecab('0x7b')]()[_0xecab('0x65')]();if(!_['isEmpty'](_0x47c115)){_0x47c115[_0xecab('0x76')](function(_0x356c35){if(_0x356c35===_0xecab('0x7c')){_0x212678[_0xecab('0x4c')](_0xecab('0x7d'),[][_0xecab('0x7e')](_0x4a8116[_0xecab('0x42')][_0x356c35]));}else if(_0x356c35===_0xecab('0x7f')){var _0x30ccf4=JSON[_0xecab('0x80')](_0x4a8116[_0xecab('0x42')][_0x356c35])[_0xecab('0x81')];var _0x14d2d5=JSON[_0xecab('0x80')](_0x4a8116[_0xecab('0x42')][_0x356c35])[_0xecab('0x82')];_0x212678[_0xecab('0x4c')](_0xecab('0x83'),_0x30ccf4,_0x14d2d5);}else{if(_0x4a8116[_0xecab('0x42')][_0x356c35]===_0xecab('0x84')){_0x212678[_0xecab('0x4c')]('i.'+_0x356c35+_0xecab('0x85'));}else{_0x212678['where']('i.'+_0x356c35+_0xecab('0x86'),_0x4a8116[_0xecab('0x42')][_0x356c35]);}}});}if(_0x4a8116[_0xecab('0x42')]['read']){if(_0x4a8116[_0xecab('0x42')]['read']==0x1){_0x212678[_0xecab('0x66')]('`unreadMessages`\x20=\x200');}else{_0x212678[_0xecab('0x66')](_0xecab('0x87'));}}if(_0x4a8116[_0xecab('0x42')][_0xecab('0x88')]){_0x3dce74=_[_0xecab('0x89')](_0x4a8116[_0xecab('0x42')][_0xecab('0x88')])?_0x4a8116[_0xecab('0x42')][_0xecab('0x88')]:new Array(_0x4a8116[_0xecab('0x42')][_0xecab('0x88')]);_0x3dce74[_0xecab('0x76')](function(_0x5eb35c){_0x2799a0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5eb35c+',%');});}if(_0x4a8116[_0xecab('0x42')][_0xecab('0x8a')]){var _0x177e74=_0x4a8116[_0xecab('0x42')][_0xecab('0x8a')][_0xecab('0x8b')]('\x5c','\x5c\x5c')[_0xecab('0x8b')](/'/g,'\x27\x27');if(qs[_0xecab('0x8c')](_0x177e74)){_0x138eca['or']('i.id\x20LIKE\x20?',_0x177e74+'%')['or'](_0xecab('0x8d'),_0x177e74+'%');}else{_0x138eca['or'](_0xecab('0x8e'),qs[_0xecab('0x6e')](_0x177e74))['or'](_0xecab('0x8f'),_0x177e74+'%');}}}_0x212678[_0xecab('0x4c')](_0x138eca);_0x212678[_0xecab('0x90')]('i.id');var _0x165fd4={'type':db['Sequelize'][_0xecab('0x91')][_0xecab('0x92')],'raw':!![]};var _0x364738=_0x212678[_0xecab('0x93')]();_0x364738[_0xecab('0x4e')](_0xecab('0x94'));_0x364738['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xecab('0x95'));if(_0x57e402[_0xecab('0x4a')]){_0x57e402[_0xecab('0x4a')][_0xecab('0x76')](function(_0x289e14){var _0x1479b5=_0x289e14[0x0]===_0xecab('0x96')?_0x289e14[0x0]:'i.'+_0x289e14[0x0];_0x212678['order'](_0x1479b5,_0x289e14[0x1]===_0xecab('0x97')?![]:!![]);});}if(!_[_0xecab('0x98')](_0x3dce74)){_0x212678[_0xecab('0x66')](_0x2799a0);_0x364738[_0xecab('0x4c')](_0xecab('0x99'),_0x3dce74);}BPromise['resolve']()[_0xecab('0x2b')](function(){if(!_0x59742a){if(_0x4a8116[_0xecab('0x42')][_0xecab('0x7c')])return;_0x364738[_0xecab('0x4c')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x212678[_0xecab('0x4c')](_0xecab('0x9a'));return;}if(_0x4a8116['user'][_0xecab('0x9b')]!==_0xecab('0x9c'))return;return _0x4a8116[_0xecab('0x9d')][_0xecab('0x9e')]({'attributes':['id'],'raw':!![]})[_0xecab('0x2b')](function(_0x245216){if(_['isEmpty'](_0x245216)){_0x364738[_0xecab('0x4c')](_0xecab('0x9f'));_0x212678[_0xecab('0x4c')](_0xecab('0x9f'));}else{_0x364738[_0xecab('0x4c')](_0xecab('0x7d'),_['map'](_0x245216,'id'));_0x212678[_0xecab('0x4c')](_0xecab('0x7d'),_[_0xecab('0x2f')](_0x245216,'id'));}});})[_0xecab('0x2b')](function(){if(_0x4a8116[_0xecab('0x9d')][_0xecab('0x9b')]===_0xecab('0x9c')&&!_0x59742a&&!_0x4a8116[_0xecab('0x42')][_0xecab('0x7c')])return[];return db['sequelize'][_0xecab('0x42')](_0x364738['toString'](),_0x165fd4);})['then'](function(_0x1959ef){_0x5e0bcf[_0xecab('0x25')]=_0x1959ef['length'];if(_0x5e0bcf[_0xecab('0x25')]===0x0)return[];return db['sequelize'][_0xecab('0x42')](_0x54053a['toString'](),_0x165fd4)[_0xecab('0x2b')](function(_0x198281){_0x1b8a3e=_[_0xecab('0xa0')](_0x198281,'id');_0x165fd4=_[_0xecab('0xa1')](_0x165fd4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a8116[_0xecab('0x42')]['fields']){_0x57e402[_0xecab('0x45')][_0xecab('0x76')](function(_0x3534d4){_0x212678[_0xecab('0x4e')]('i.'+_0x3534d4);});}else{_0x212678[_0xecab('0x4e')](_0xecab('0xa2'),_0xecab('0x95'));_0x212678[_0xecab('0x4e')](_0xecab('0xa3'),_0xecab('0xa4'));_0x212678['field']('a.mandatoryDisposition',_0xecab('0xa5'));_0x212678['field'](_0xecab('0xa6'),_0xecab('0x96'));_0x212678['field']('i.*');_0x212678[_0xecab('0x4e')](_0xecab('0xa7'),_0xecab('0xa8'));_0x212678[_0xecab('0x4e')](_0xecab('0xa9'),'Contact.lastName');_0x212678[_0xecab('0x4e')](_0xecab('0xaa'),_0xecab('0xab'));_0x212678[_0xecab('0x4e')]('c.phone',_0xecab('0xac'));_0x212678[_0xecab('0x4e')](_0xecab('0xad'),'Contact.mobile');_0x212678[_0xecab('0x4e')]('c.fax',_0xecab('0xae'));_0x212678['field'](_0xecab('0xaf'),_0xecab('0xb0'));_0x212678[_0xecab('0x4e')](_0xecab('0xb1'),_0xecab('0xb2'));_0x212678['field'](_0xecab('0xb3'),_0xecab('0x33'));}if(_0x57e402['limit'])_0x212678[_0xecab('0x24')](_0x57e402[_0xecab('0x24')]);if(_0x57e402['offset'])_0x212678[_0xecab('0x22')](_0x57e402['offset']);return db[_0xecab('0xb4')][_0xecab('0x42')](_0x212678['toString'](),_0x165fd4);})[_0xecab('0x2b')](function(_0x2cd7a9){if(_0x2cd7a9[_0xecab('0x47')]>0x0)_0x5823c6[_0xecab('0x4c')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x2cd7a9,'id'));return db[_0xecab('0xb4')][_0xecab('0x42')](_0x5823c6[_0xecab('0xb5')](),_0x165fd4)[_0xecab('0x2b')](function(_0x36f417){var _0x56ac94=_['groupBy'](_0x36f417,'WhatsappInteractionId');var _0x56cb0e=[];_0x2cd7a9[_0xecab('0x76')](function(_0x9b94b2){_0x56cb0e[_0xecab('0x32')](updateWhatsappInteraction(_0x9b94b2,_0x1b8a3e,_0x56ac94));});return BPromise[_0xecab('0xb6')](_0x56cb0e);});});})[_0xecab('0x2b')](function(_0x514223){_0x5e0bcf['rows']=_0x514223;return _0x5e0bcf;})[_0xecab('0x2b')](respondWithFilteredResult(_0x978283,_0x57e402))['catch'](handleError(_0x978283,null));};exports['show']=function(_0x2f7d84,_0x51d47f){var _0x27b1a5={'raw':![],'where':{'id':_0x2f7d84[_0xecab('0xb7')]['id']}},_0x5a37cb={};_0x5a37cb['model']=_[_0xecab('0x7a')](db[_0xecab('0x3d')][_0xecab('0xb8')]);_0x5a37cb[_0xecab('0x42')]=_[_0xecab('0x7a')](_0x2f7d84[_0xecab('0x42')]);_0x5a37cb[_0xecab('0x43')]=_['intersection'](_0x5a37cb['model'],_0x5a37cb[_0xecab('0x42')]);_0x27b1a5[_0xecab('0x45')]=_[_0xecab('0x44')](_0x5a37cb['model'],qs[_0xecab('0x46')](_0x2f7d84['query']['fields']));_0x27b1a5[_0xecab('0x45')]=_0x27b1a5['attributes']['length']?_0x27b1a5['attributes']:_0x5a37cb['model'];if(_0x2f7d84[_0xecab('0x42')]['includeAll']){_0x27b1a5[_0xecab('0xb9')]=[{'all':!![]}];}_0x27b1a5=_['merge']({},_0x27b1a5,_0x2f7d84[_0xecab('0xba')]);return db[_0xecab('0x3d')][_0xecab('0x6f')](_0x27b1a5)[_0xecab('0x2b')](handleEntityNotFound(_0x51d47f,null))[_0xecab('0x2b')](respondWithResult(_0x51d47f,null))['catch'](handleError(_0x51d47f,null));};exports[_0xecab('0xbb')]=function(_0x358759,_0x1c7b32){return db[_0xecab('0x3d')][_0xecab('0xbb')](_0x358759['body'],{})[_0xecab('0x2b')](respondWithResult(_0x1c7b32,0xc9))[_0xecab('0x34')](handleError(_0x1c7b32,null));};exports[_0xecab('0x2a')]=function(_0x58d9be,_0x5d9d68){if(_0x58d9be['body']['id']){delete _0x58d9be[_0xecab('0x79')]['id'];}return db[_0xecab('0x3d')]['find']({'where':{'id':_0x58d9be[_0xecab('0xb7')]['id']}})[_0xecab('0x2b')](handleEntityNotFound(_0x5d9d68,null))[_0xecab('0x2b')](saveUpdates(_0x58d9be[_0xecab('0x79')],null))['then'](respondWithResult(_0x5d9d68,null))[_0xecab('0x34')](handleError(_0x5d9d68,null));};exports[_0xecab('0xbc')]=function(_0x802ea3,_0x45be5b){return db['WhatsappInteraction'][_0xecab('0x6f')]({'where':{'id':_0x802ea3[_0xecab('0xb7')]['id']}})['then'](handleEntityNotFound(_0x45be5b,null))[_0xecab('0x2b')](removeEntity(_0x45be5b,null))[_0xecab('0x34')](handleError(_0x45be5b,null));};exports['describe']=function(_0xc12599,_0x3f6a65){return db[_0xecab('0x3d')][_0xecab('0xbd')]()[_0xecab('0x2b')](respondWithResult(_0x3f6a65,null))[_0xecab('0x34')](handleError(_0x3f6a65,null));};exports[_0xecab('0xbe')]=function(_0x8ed3c3,_0x5a8b86,_0x385bcb){return db[_0xecab('0xbf')][_0xecab('0x6f')]({'where':{'id':_0x8ed3c3['params']['id']}})[_0xecab('0x2b')](handleEntityNotFound(_0x5a8b86,null))[_0xecab('0x2b')](function(_0x5cab5d){if(_0x5cab5d){return _0x5cab5d[_0xecab('0xbe')](_0x8ed3c3[_0xecab('0x79')][_0xecab('0xc0')],_[_0xecab('0xc1')](_0x8ed3c3[_0xecab('0x79')],[_0xecab('0xc0'),'id'])||{});}})[_0xecab('0x2b')](respondWithResult(_0x5a8b86,null))[_0xecab('0x34')](handleError(_0x5a8b86,null));};exports[_0xecab('0xc2')]=function(_0x2ce7fe,_0x419824,_0x46409e){var _0xd28349={'raw':![],'where':{}};var _0x5baad1={};var _0x156a60={'count':0x0,'rows':[]};return db[_0xecab('0x3d')]['findOne']({'where':{'id':_0x2ce7fe[_0xecab('0xb7')]['id']}})[_0xecab('0x2b')](handleEntityNotFound(_0x419824,null))[_0xecab('0x2b')](function(_0x54e68d){if(_0x54e68d){_0x5baad1[_0xecab('0x41')]=_[_0xecab('0x7a')](db[_0xecab('0xbf')]['rawAttributes']);_0x5baad1[_0xecab('0x42')]=_[_0xecab('0x7a')](_0x2ce7fe[_0xecab('0x42')]);_0x5baad1[_0xecab('0x43')]=_['intersection'](_0x5baad1[_0xecab('0x41')],_0x5baad1[_0xecab('0x42')]);_0xd28349[_0xecab('0x45')]=_['intersection'](_0x5baad1[_0xecab('0x41')],qs[_0xecab('0x46')](_0x2ce7fe[_0xecab('0x42')]['fields']));_0xd28349[_0xecab('0x45')]=_0xd28349[_0xecab('0x45')]['length']?_0xd28349['attributes']:_0x5baad1[_0xecab('0x41')];if(!_0x2ce7fe[_0xecab('0x42')][_0xecab('0x48')](_0xecab('0x49'))){_0xd28349[_0xecab('0x24')]=qs[_0xecab('0x24')](_0x2ce7fe['query'][_0xecab('0x24')]);_0xd28349['offset']=qs[_0xecab('0x22')](_0x2ce7fe[_0xecab('0x42')][_0xecab('0x22')]);}_0xd28349[_0xecab('0x4a')]=qs[_0xecab('0x4b')](_0x2ce7fe[_0xecab('0x42')][_0xecab('0x4b')]);_0xd28349[_0xecab('0x4c')]=qs[_0xecab('0x43')](_[_0xecab('0x4d')](_0x2ce7fe[_0xecab('0x42')],_0x5baad1[_0xecab('0x43')]));_0xd28349['where'][_0xecab('0xc3')]=_0x54e68d['id'];if(_0x2ce7fe[_0xecab('0x42')][_0xecab('0x8a')]){_0xd28349[_0xecab('0x4c')]=_[_0xecab('0xa1')](_0xd28349[_0xecab('0x4c')],{'$or':_[_0xecab('0x2f')](_0xd28349[_0xecab('0x45')],function(_0x3385f0){var _0x583e28={};_0x583e28[_0x3385f0]={'$like':'%'+_0x2ce7fe['query'][_0xecab('0x8a')]+'%'};return _0x583e28;})});}if(_0x2ce7fe[_0xecab('0x42')][_0xecab('0x81')]){var _0x291d5a=_0x2ce7fe[_0xecab('0x42')]['$gte'][_0xecab('0x6c')](',');var _0x2c3653={};_0x2c3653[_0x291d5a[0x0]]={'$gte':moment(_0x291d5a[0x1])['format'](_0xecab('0xc4'))};_0xd28349[_0xecab('0x4c')]=_['merge'](_0xd28349['where'],_0x2c3653);}_0xd28349=_[_0xecab('0xa1')]({},_0xd28349,_0x2ce7fe[_0xecab('0xba')]);return db[_0xecab('0xbf')]['count']({'where':_0xd28349['where']})['then'](function(_0x1a0cb4){_0x156a60[_0xecab('0x25')]=_0x1a0cb4;if(_0x2ce7fe[_0xecab('0x42')][_0xecab('0xc5')]){_0xd28349[_0xecab('0xb9')]=[{'all':!![]}];}return db[_0xecab('0xbf')][_0xecab('0xc6')](_0xd28349);})[_0xecab('0x2b')](function(_0x3db3f7){_0x156a60['rows']=_0x3db3f7;return _0x156a60;});}})['then'](respondWithFilteredResult(_0x419824,_0xd28349))[_0xecab('0x34')](handleError(_0x419824,null));};exports[_0xecab('0xc7')]=function(_0x5d7010,_0x22294d,_0x3bd58e){return db['WhatsappInteraction']['find']({'where':{'id':_0x5d7010['params']['id']}})['then'](handleEntityNotFound(_0x22294d,null))[_0xecab('0x2b')](function(_0x5c7d4b){if(_0x5c7d4b){return _0x5c7d4b[_0xecab('0xc8')](_0x5d7010[_0xecab('0x79')][_0xecab('0xc0')],_[_0xecab('0xc1')](_0x5d7010[_0xecab('0x79')],[_0xecab('0xc0'),'id'])||{})['spread'](function(){return db[_0xecab('0x75')][_0xecab('0xc6')]({'attributes':['id',_0xecab('0x2c'),_0xecab('0x4f')],'where':{'id':_0x5d7010['body']['ids']}});})[_0xecab('0x2b')](function(_0x1d382f){socket[_0xecab('0xc9')](_0xecab('0xca'),{'id':Number(_0x5d7010[_0xecab('0xb7')]['id']),'tags':_0x1d382f||[]});return{'id':Number(_0x5d7010[_0xecab('0xb7')]['id']),'tags':_0x1d382f||[]};});}})[_0xecab('0x2b')](respondWithResult(_0x22294d,null))[_0xecab('0x34')](handleError(_0x22294d,null));};exports[_0xecab('0xcb')]=function(_0x242e01,_0x2ad529,_0x44f1e2){return db[_0xecab('0x3d')][_0xecab('0x6f')]({'where':{'id':_0x242e01[_0xecab('0xb7')]['id']}})[_0xecab('0x2b')](handleEntityNotFound(_0x2ad529,null))['then'](function(_0x5f422f){if(_0x5f422f){return _0x5f422f['removeTags'](_0x242e01[_0xecab('0x42')][_0xecab('0xc0')]);}})[_0xecab('0x2b')](respondWithStatusCode(_0x2ad529,null))['catch'](handleError(_0x2ad529,null));};exports[_0xecab('0xcc')]=function(_0x1a1b79,_0x163af4){var _0x1c3a13=moment()[_0xecab('0xcd')]()[_0xecab('0xb5')]();var _0x54c848=path[_0xecab('0xce')](config[_0xecab('0xcf')],_0xecab('0xd0'),_0xecab('0xd1'),_0xecab('0xd2'));var _0x370f7e=path[_0xecab('0xce')](config[_0xecab('0xcf')],_0xecab('0xd0'),_0xecab('0xd1'),_0xecab('0xd3'));var _0x238d36=path[_0xecab('0xce')](_0x54c848,_0x1c3a13);var _0x4393ee=util[_0xecab('0xd4')](_0xecab('0xd5'),_0x1a1b79[_0xecab('0xb7')]['id'],_0x1c3a13);var _0x5649fb=path['join'](_0x54c848,_0x4393ee);var _0x251d5c=[];_0x251d5c[_0xecab('0x32')]({'model':db[_0xecab('0x78')],'as':'User','attributes':['id',_0xecab('0x30')],'raw':!![]});_0x251d5c[_0xecab('0x32')]({'model':db['CmContact'],'as':_0xecab('0x69'),'attributes':['id',_0xecab('0xd6'),'lastName'],'raw':!![]});if(_0x1a1b79[_0xecab('0x42')][_0xecab('0xd3')]){_0x251d5c[_0xecab('0x32')]({'model':db[_0xecab('0xd7')],'as':'Attachment','raw':!![]});}var _0x5d6681=[{'model':db[_0xecab('0xbf')],'as':_0xecab('0xd8'),'attributes':['id',_0xecab('0x79'),_0xecab('0x7f'),'direction',_0xecab('0xd9'),'read'],'include':_0x251d5c}];_0x5d6681[_0xecab('0x32')]({'model':db['WhatsappAccount'],'as':_0xecab('0xda'),'attributes':['id',_0xecab('0x2c')]});_0x5d6681['push']({'model':db[_0xecab('0x78')],'as':_0xecab('0xdb'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0xecab('0x6f')]({'where':{'id':_0x1a1b79[_0xecab('0xb7')]['id']},'include':_0x5d6681})[_0xecab('0x2b')](handleEntityNotFound(_0x163af4,null))[_0xecab('0x2b')](function(_0xa191b3){if(_0xa191b3){var _0x5ec4c2=_0xa191b3[_0xecab('0xdc')]({'plain':!![]});fs[_0xecab('0xdd')](_0x238d36);var _0x5d9c31={'channel':_0xecab('0xde'),'account':_0x5ec4c2[_0xecab('0xda')][_0xecab('0x2c')],'agent':_0x5ec4c2['Owner']?_0x5ec4c2['Owner'][_0xecab('0x30')]:_0xecab('0xdf'),'createdAt':moment(_0x5ec4c2[_0xecab('0x7f')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xecab('0xb5')](),'closedAt':_0x5ec4c2['closed']?moment(_0x5ec4c2[_0xecab('0xe0')])[_0xecab('0xd4')](_0xecab('0xc4'))[_0xecab('0xb5')]():'','disposition':_0x5ec4c2[_0xecab('0xe1')],'messages':_(_0x5ec4c2['Messages'])[_0xecab('0x8a')]({'secret':![]})[_0xecab('0x2f')](function(_0x3ef4c6){if(_0x3ef4c6[_0xecab('0xd7')]){var _0x2b3518=path[_0xecab('0xce')](_0x370f7e,_0x3ef4c6[_0xecab('0xd7')]['basename']);if(fs[_0xecab('0xe2')](_0x2b3518)){fs[_0xecab('0xe3')](_0x2b3518)['pipe'](fs[_0xecab('0xe4')](path['join'](_0x238d36,_0x3ef4c6[_0xecab('0xd7')][_0xecab('0xe5')])));}}return{'date':moment(_0x3ef4c6[_0xecab('0x7f')])[_0xecab('0xd4')](_0xecab('0xc4'))[_0xecab('0xb5')](),'sender':_0x3ef4c6['direction']===_0xecab('0xe6')?_0x3ef4c6[_0xecab('0x78')]?_0x3ef4c6['User'][_0xecab('0x30')]:'System':_0x3ef4c6[_0xecab('0x69')][_0xecab('0xd6')]+(_0x3ef4c6[_0xecab('0x69')][_0xecab('0xe7')]?'\x20'+_0x3ef4c6[_0xecab('0x69')][_0xecab('0xe7')]:''),'body':_0x3ef4c6['Attachment']?_0x3ef4c6[_0xecab('0xd7')][_0xecab('0xe5')]:_0x3ef4c6[_0xecab('0x79')],'direction':_0x3ef4c6[_0xecab('0xe8')]===_0xecab('0xe6')?'A':'C','secret':_0x3ef4c6[_0xecab('0xd9')],'read':_0x3ef4c6[_0xecab('0xe9')],'attachment':_0x3ef4c6[_0xecab('0xd7')]};})['value']()};return ejs[_0xecab('0xea')](path[_0xecab('0xce')](config[_0xecab('0xcf')],_0xecab('0xd0'),'views',_0xecab('0xeb')),{'interaction':_0x5d9c31})['then'](function(_0x126774){var _0x4f4261=path[_0xecab('0xce')](_0x238d36,_0xecab('0xec')+_0x5ec4c2['id']+'-'+_0x1c3a13+_0xecab('0xed'));var _0x10ee5f={'path':_0x4f4261,'channel':_0xecab('0xde'),'interactionId':_0x5ec4c2['id']};return pdf['createPdfFromHTML'](_0x126774,_0x10ee5f);})[_0xecab('0x2b')](function(){return new BPromise(function(_0x9814ed,_0x42c9b4){zipdir(_0x238d36,{'saveTo':_0x5649fb},function(_0x29361f,_0x27c7e0){if(_0x29361f)return _0x42c9b4(_0x29361f);return _0x9814ed(_0x27c7e0);});})[_0xecab('0x2b')](function(){return new BPromise(function(_0x364128,_0x352d2c){rimraf(_0x238d36,function(_0x332041){if(_0x332041)_0x352d2c(_0x332041);return _0x364128();});});})[_0xecab('0x2b')](function(){return _0x163af4[_0xecab('0xcc')](_0x5649fb,_0x4393ee,function(_0x1f8803){if(_0x1f8803){console[_0xecab('0xee')](_0xecab('0xef'),_0x1f8803);}else{fs[_0xecab('0xf0')](_0x5649fb);}});});});}else{return _0x163af4[_0xecab('0x1f')](0xc8);}})[_0xecab('0x34')](handleError(_0x163af4,null));}; \ No newline at end of file +var _0x96f2=['type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','field','select','u.fullname','from','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','text','start','Tag','union','User','body','keys','some','compact','isEmpty','forEach','WhatsappAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','catch','show','params','include','options','create','update','addMessage','WhatsappMessage','ids','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','push','CmContact','Contact','lastName','attachments','Attachment','Messages','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','firstName','renderFile','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','answered','unmanaged','total','closed','UserId','waiting','talking','WhatsappInteraction','rawAttributes'];(function(_0x3aaf69,_0x318ff9){var _0x4542c6=function(_0x5d1369){while(--_0x5d1369){_0x3aaf69['push'](_0x3aaf69['shift']());}};_0x4542c6(++_0x318ff9);}(_0x96f2,0xb0));var _0x296f=function(_0x27ff07,_0x284910){_0x27ff07=_0x27ff07-0x0;var _0x2fc01a=_0x96f2[_0x27ff07];return _0x2fc01a;};'use strict';var emlformat=require(_0x296f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x296f('0x1'));var jsonpatch=require(_0x296f('0x2'));var rp=require(_0x296f('0x3'));var moment=require('moment');var BPromise=require(_0x296f('0x4'));var Mustache=require(_0x296f('0x5'));var util=require(_0x296f('0x6'));var path=require('path');var sox=require(_0x296f('0x7'));var csv=require(_0x296f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x296f('0x9'));var squel=require(_0x296f('0xa'));var crypto=require(_0x296f('0xb'));var jsforce=require(_0x296f('0xc'));var deskjs=require(_0x296f('0xd'));var toCsv=require(_0x296f('0x8'));var querystring=require(_0x296f('0xe'));var Papa=require(_0x296f('0xf'));var Redis=require(_0x296f('0x10'));var authService=require(_0x296f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x296f('0x12'));var pdf=require(_0x296f('0x13'));var hardwareService=require(_0x296f('0x14'));var logger=require('../../config/logger')(_0x296f('0x15'));var utils=require(_0x296f('0x16'));var config=require(_0x296f('0x17'));var licenseUtil=require(_0x296f('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x296f('0x19')],{'host':_0x296f('0x1a'),'port':0x18eb});var socket=require(_0x296f('0x1b'))(new Redis(config[_0x296f('0x19')]));require('./whatsappInteraction.socket')[_0x296f('0x1c')](socket);function respondWithStatusCode(_0x496675,_0x4e0b88){_0x4e0b88=_0x4e0b88||0xcc;return function(_0x367e03){if(_0x367e03){return _0x496675[_0x296f('0x1d')](_0x4e0b88);}return _0x496675[_0x296f('0x1e')](_0x4e0b88)[_0x296f('0x1f')]();};}function respondWithResult(_0x4cfa9a,_0x4a2aaa){_0x4a2aaa=_0x4a2aaa||0xc8;return function(_0x3e3860){if(_0x3e3860){return _0x4cfa9a['status'](_0x4a2aaa)[_0x296f('0x20')](_0x3e3860);}};}function respondWithFilteredResult(_0x34a949,_0xfc0b87){return function(_0x48725e){if(_0x48725e){var _0xcc2b48=typeof _0xfc0b87[_0x296f('0x21')]==='undefined'&&typeof _0xfc0b87[_0x296f('0x22')]===_0x296f('0x23');var _0x51498d=_0x48725e[_0x296f('0x24')];var _0x5cedbc=_0xcc2b48?0x0:_0xfc0b87[_0x296f('0x21')];var _0x474721=_0xcc2b48?_0x48725e[_0x296f('0x24')]:_0xfc0b87['offset']+_0xfc0b87[_0x296f('0x22')];var _0x31c544;if(_0x474721>=_0x51498d){_0x474721=_0x51498d;_0x31c544=0xc8;}else{_0x31c544=0xce;}_0x34a949[_0x296f('0x1e')](_0x31c544);return _0x34a949['set'](_0x296f('0x25'),_0x5cedbc+'-'+_0x474721+'/'+_0x51498d)[_0x296f('0x20')](_0x48725e);}return null;};}function patchUpdates(_0x3b3146){return function(_0x52438b){try{jsonpatch['apply'](_0x52438b,_0x3b3146,!![]);}catch(_0x12abfb){return BPromise['reject'](_0x12abfb);}return _0x52438b['save']();};}function saveUpdates(_0xf39fb,_0x513d59){return function(_0x4ab133){if(_0x4ab133){return _0x4ab133['update'](_0xf39fb)[_0x296f('0x26')](function(_0x11e3fe){return _0x11e3fe;});}return null;};}function removeEntity(_0x120482,_0x371db0){return function(_0x2b8078){if(_0x2b8078){return _0x2b8078[_0x296f('0x27')]()['then'](function(){_0x120482['status'](0xcc)[_0x296f('0x1f')]();});}};}function handleEntityNotFound(_0x5d388b,_0xc47d1f){return function(_0x1de36c){if(!_0x1de36c){_0x5d388b[_0x296f('0x1d')](0x194);}return _0x1de36c;};}function handleError(_0x30476e,_0x345485){_0x345485=_0x345485||0x1f4;return function(_0x28d624){logger['error'](_0x28d624[_0x296f('0x28')]);if(_0x28d624['name']){delete _0x28d624[_0x296f('0x29')];}_0x30476e[_0x296f('0x1e')](_0x345485)[_0x296f('0x2a')](_0x28d624);};}function getInteractionUsers(_0x3aa271,_0x3b5091){return new BPromise(function(_0xdf21e8,_0x1d9422){try{if(_0x3b5091[_0x3aa271['id']]){_0x3aa271[_0x296f('0x2b')]=_[_0x296f('0x2c')](_0x3b5091[_0x3aa271['id']],function(_0x99f238){return{'id':_0x99f238['id'],'fullname':_0x99f238[_0x296f('0x2d')]};});}}catch(_0x46be6f){_0x1d9422(_0x46be6f);}_0xdf21e8(_0x3aa271);});}function getInteractionTags(_0x25c85c,_0x54bab2){return new BPromise(function(_0xd5c83a,_0x109ebd){try{if(_0x25c85c[_0x296f('0x2e')]){_0x25c85c[_0x296f('0x2f')]=[];_0x25c85c['TagIds']['split'](',')['forEach'](function(_0x3db139){_0x25c85c[_0x296f('0x2f')]['push'](_0x54bab2[_0x3db139]);});}delete _0x25c85c[_0x296f('0x2e')];}catch(_0x66312d){_0x109ebd(_0x66312d);}_0xd5c83a(_0x25c85c);});}function updateWhatsappInteraction(_0x55a52e,_0x513873,_0xe97345){return new BPromise(function(_0x2b64a8,_0x5231b8){return getInteractionUsers(_0x55a52e,_0xe97345)[_0x296f('0x26')](function(_0x29efe5){return getInteractionTags(_0x29efe5,_0x513873);})[_0x296f('0x26')](function(_0x103abd){return getStateInteraction(_0x103abd);})[_0x296f('0x26')](function(_0x322031){_0x2b64a8(_0x322031);})['catch'](function(_0x52777b){_0x5231b8(_0x52777b);});});}function getStateInteraction(_0x5a51e3){return new BPromise(function(_0x335964){_0x5a51e3['waiting']=0x0;_0x5a51e3['talking']=0x0;_0x5a51e3[_0x296f('0x30')]=0x0;_0x5a51e3[_0x296f('0x31')]=0x0;_0x5a51e3[_0x296f('0x32')]=0x0;if(!_0x5a51e3[_0x296f('0x33')]&&!_0x5a51e3[_0x296f('0x34')]){_0x5a51e3[_0x296f('0x35')]+=0x1;}if(!_0x5a51e3[_0x296f('0x33')]&&_0x5a51e3['UserId']){_0x5a51e3[_0x296f('0x36')]+=0x1;if(_0x5a51e3[_0x296f('0x35')]){_0x5a51e3[_0x296f('0x35')]-=0x1;}}if(_0x5a51e3[_0x296f('0x33')]&&_0x5a51e3[_0x296f('0x34')]){_0x5a51e3[_0x296f('0x30')]+=0x1;if(_0x5a51e3[_0x296f('0x36')]){_0x5a51e3[_0x296f('0x36')]-=0x1;}}if(_0x5a51e3['closed']&&!_0x5a51e3[_0x296f('0x34')]){_0x5a51e3[_0x296f('0x31')]+=0x1;if(_0x5a51e3['waiting']){_0x5a51e3[_0x296f('0x35')]-=0x1;}}_0x5a51e3[_0x296f('0x32')]+=0x1;_0x335964(_0x5a51e3);});}exports['index']=function(_0x597096,_0x1bb16f){var _0x150f29={},_0x440813={},_0x402ab7={'count':0x0,'rows':[]};var _0x28111d=_[_0x296f('0x2c')](db[_0x296f('0x37')][_0x296f('0x38')],function(_0x34ef81){return{'name':_0x34ef81['fieldName'],'type':_0x34ef81[_0x296f('0x39')]['key']};});_0x440813[_0x296f('0x3a')]=_[_0x296f('0x2c')](_0x28111d,_0x296f('0x29'));_0x440813[_0x296f('0x3b')]=_['keys'](_0x597096[_0x296f('0x3b')]);_0x440813['filters']=_[_0x296f('0x3c')](_0x440813['model'],_0x440813['query']);_0x150f29['attributes']=_[_0x296f('0x3c')](_0x440813[_0x296f('0x3a')],qs[_0x296f('0x3d')](_0x597096[_0x296f('0x3b')][_0x296f('0x3d')]));_0x150f29[_0x296f('0x3e')]=_0x150f29[_0x296f('0x3e')]['length']?_0x150f29['attributes']:_0x440813[_0x296f('0x3a')];if(!_0x597096['query'][_0x296f('0x3f')](_0x296f('0x40'))){_0x150f29[_0x296f('0x22')]=qs[_0x296f('0x22')](_0x597096[_0x296f('0x3b')][_0x296f('0x22')]);_0x150f29[_0x296f('0x21')]=qs[_0x296f('0x21')](_0x597096['query']['offset']);}_0x150f29[_0x296f('0x41')]=qs[_0x296f('0x42')](_0x597096[_0x296f('0x3b')][_0x296f('0x42')]);_0x150f29[_0x296f('0x43')]=qs[_0x296f('0x44')](_['pick'](_0x597096['query'],_0x440813[_0x296f('0x44')]),_0x28111d);var _0x3641e0=[];var _0x4cf2b0=squel['select']()[_0x296f('0x45')]('id')[_0x296f('0x45')]('name')[_0x296f('0x45')]('color')['from']('tools_tags');var _0x164a60=squel[_0x296f('0x46')]()[_0x296f('0x45')]('u.id')[_0x296f('0x45')](_0x296f('0x47'))[_0x296f('0x45')]('ui.WhatsappInteractionId')[_0x296f('0x48')](_0x296f('0x49'),'ui')['left_join'](_0x296f('0x4a'),'u',_0x296f('0x4b'));var _0x5c70cc=squel[_0x296f('0x46')]()['from']('whatsapp_interactions','i')['left_join'](_0x296f('0x4c'),'c',_0x296f('0x4d'))['left_join'](_0x296f('0x4a'),'o',_0x296f('0x4e'))[_0x296f('0x4f')](_0x296f('0x50'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0x296f('0x51'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x296f('0x4f')](_0x296f('0x52'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x296f('0x4f')](_0x296f('0x53'),'t',_0x296f('0x54'));var _0x53d408=squel[_0x296f('0x55')]();var _0x238b92=[];var _0xdc64e2=squel[_0x296f('0x55')]();var _0xba8470;if(_0x597096[_0x296f('0x3b')]['search']){_0xba8470=as[_0x296f('0x56')](_0x597096['query'][_0x296f('0x57')]);var _0x364f37=_0xba8470[_0x296f('0x58')];for(var _0x73efa7=0x0;_0x73efa7<_0xba8470[_0x296f('0x59')][_0x296f('0x5a')];_0x73efa7++){var _0x301ba7=_0xba8470['conditions'][_0x73efa7];var _0x34357a='i';var _0x46dab2=_['find'](_0x28111d,[_0x296f('0x29'),_0x301ba7[_0x296f('0x45')]]);if(!_0x46dab2){switch(_0x301ba7['field']){case _0x296f('0x5b'):if(_0x301ba7[_0x296f('0x5c')]==0x1){_0x5c70cc[_0x296f('0x5d')]('`'+_0x301ba7['field']+_0x296f('0x5e'));}else{_0x5c70cc[_0x296f('0x5d')]('`'+_0x301ba7[_0x296f('0x45')]+_0x296f('0x5f'));}break;case'Contact':if(_0x301ba7[_0x296f('0x60')]===_0x296f('0x61')){if(_0x301ba7['value'][_0x296f('0x62')]('\x20')[_0x296f('0x5a')]>0x1){_0x53d408[_0x364f37](_0x296f('0x63'),qs[_0x296f('0x64')](_0x301ba7[_0x296f('0x5c')]),null);}else{var _0x269de9='%'+_0x301ba7[_0x296f('0x5c')]+'%';_0x53d408[_0x364f37](_0x296f('0x65'),_0x269de9,_0x269de9,_0x269de9);}}else{_0x46dab2=_[_0x296f('0x66')](_0x28111d,[_0x296f('0x29'),'ContactId']);_0x301ba7[_0x296f('0x45')]='ContactId';_0x38694a=as[_0x296f('0x67')](_0x34357a,_0x46dab2[_0x296f('0x39')],_0x301ba7);_0x53d408[_0x364f37](_0x38694a[_0x296f('0x68')],_0x38694a[_0x296f('0x5c')][_0x296f('0x69')],_0x38694a['value']['end']);}break;case _0x296f('0x6a'):var _0x344906=_0x301ba7['value'][_0x296f('0x62')](',')[_0x296f('0x2c')](function(_0x46a4c6){return Number(_0x46a4c6);});_0x344906['forEach'](function(_0x1e3fe4){_0xdc64e2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1e3fe4+',%');});_0x238b92=_[_0x296f('0x6b')](_0x238b92,_0x344906);break;case _0x296f('0x6c'):if(_0x301ba7['operator']===_0x296f('0x61')){_0x53d408[_0x364f37]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x301ba7['value']+'%',null);}else{_0x46dab2=_[_0x296f('0x66')](_0x28111d,[_0x296f('0x29'),'UserId']);_0x301ba7[_0x296f('0x45')]=_0x296f('0x34');_0x38694a=as[_0x296f('0x67')](_0x34357a,_0x46dab2[_0x296f('0x39')],_0x301ba7);_0x53d408[_0x364f37](_0x38694a[_0x296f('0x68')],_0x38694a[_0x296f('0x5c')][_0x296f('0x69')],_0x38694a[_0x296f('0x5c')][_0x296f('0x1f')]);}break;case _0x296f('0x6d'):_0x38694a=as[_0x296f('0x67')]('me',null,_0x301ba7);_0x53d408[_0x364f37](_0x38694a[_0x296f('0x68')],_0x38694a['value'][_0x296f('0x69')],_0x38694a[_0x296f('0x5c')][_0x296f('0x1f')]);break;}}else{var _0x38694a=as[_0x296f('0x67')](_0x34357a,_0x46dab2[_0x296f('0x39')],_0x301ba7);_0x53d408[_0x364f37](_0x38694a['text'],_0x38694a['value'][_0x296f('0x69')],_0x38694a[_0x296f('0x5c')]['end']);}}}else{var _0x50d51d=_(_0x597096[_0x296f('0x3b')])[_0x296f('0x6e')]()[_0x296f('0x2c')](function(_0x35b5a5){return _[_0x296f('0x6f')](_0x28111d,[_0x296f('0x29'),_0x35b5a5])?_0x35b5a5:undefined;})[_0x296f('0x70')]()[_0x296f('0x5c')]();if(!_[_0x296f('0x71')](_0x50d51d)){_0x50d51d[_0x296f('0x72')](function(_0x5487be){if(_0x5487be===_0x296f('0x73')){_0x5c70cc[_0x296f('0x43')]('i.WhatsappAccountId\x20IN\x20?',[][_0x296f('0x74')](_0x597096[_0x296f('0x3b')][_0x5487be]));}else if(_0x5487be===_0x296f('0x75')){var _0x642c7=JSON[_0x296f('0x76')](_0x597096[_0x296f('0x3b')][_0x5487be])[_0x296f('0x77')];var _0x137b1d=JSON['parse'](_0x597096[_0x296f('0x3b')][_0x5487be])[_0x296f('0x78')];_0x5c70cc[_0x296f('0x43')](_0x296f('0x79'),_0x642c7,_0x137b1d);}else{if(_0x597096['query'][_0x5487be]===_0x296f('0x7a')){_0x5c70cc[_0x296f('0x43')]('i.'+_0x5487be+_0x296f('0x7b'));}else{_0x5c70cc[_0x296f('0x43')]('i.'+_0x5487be+'\x20=\x20?',_0x597096['query'][_0x5487be]);}}});}if(_0x597096[_0x296f('0x3b')][_0x296f('0x7c')]){if(_0x597096[_0x296f('0x3b')][_0x296f('0x7c')]==0x1){_0x5c70cc[_0x296f('0x5d')](_0x296f('0x7d'));}else{_0x5c70cc[_0x296f('0x5d')](_0x296f('0x7e'));}}if(_0x597096[_0x296f('0x3b')]['tag']){_0x238b92=_[_0x296f('0x7f')](_0x597096[_0x296f('0x3b')]['tag'])?_0x597096[_0x296f('0x3b')][_0x296f('0x80')]:new Array(_0x597096[_0x296f('0x3b')][_0x296f('0x80')]);_0x238b92['forEach'](function(_0x4c7e03){_0xdc64e2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4c7e03+',%');});}if(_0x597096[_0x296f('0x3b')]['filter']){var _0x183e36=_0x597096[_0x296f('0x3b')][_0x296f('0x81')][_0x296f('0x82')]('\x5c','\x5c\x5c')[_0x296f('0x82')](/'/g,'\x27\x27');if(qs[_0x296f('0x83')](_0x183e36)){_0x53d408['or'](_0x296f('0x84'),_0x183e36+'%')['or'](_0x296f('0x85'),_0x183e36+'%');}else{_0x53d408['or'](_0x296f('0x86'),qs[_0x296f('0x64')](_0x183e36))['or'](_0x296f('0x87'),_0x183e36+'%');}}}_0x5c70cc[_0x296f('0x43')](_0x53d408);_0x5c70cc[_0x296f('0x88')](_0x296f('0x89'));var _0x2710d2={'type':db[_0x296f('0x8a')][_0x296f('0x8b')][_0x296f('0x8c')],'raw':!![]};var _0x40d68f=_0x5c70cc[_0x296f('0x8d')]();_0x40d68f[_0x296f('0x45')](_0x296f('0x89'));_0x40d68f['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x150f29[_0x296f('0x41')]){_0x150f29[_0x296f('0x41')][_0x296f('0x72')](function(_0x3a8a49){var _0x3d2d57=_0x3a8a49[0x0]===_0x296f('0x8e')?_0x3a8a49[0x0]:'i.'+_0x3a8a49[0x0];_0x5c70cc['order'](_0x3d2d57,_0x3a8a49[0x1]===_0x296f('0x8f')?![]:!![]);});}if(!_[_0x296f('0x71')](_0x238b92)){_0x5c70cc[_0x296f('0x5d')](_0xdc64e2);_0x40d68f['where']('t.id\x20IN\x20?',_0x238b92);}BPromise[_0x296f('0x90')]()[_0x296f('0x26')](function(){if(!_0xba8470){if(_0x597096[_0x296f('0x3b')][_0x296f('0x73')])return;_0x40d68f['where'](_0x296f('0x91'));_0x5c70cc['where'](_0x296f('0x91'));return;}if(_0x597096['user'][_0x296f('0x92')]!==_0x296f('0x93'))return;return _0x597096[_0x296f('0x94')][_0x296f('0x95')]({'attributes':['id'],'raw':!![]})[_0x296f('0x26')](function(_0x30a457){if(_[_0x296f('0x71')](_0x30a457)){_0x40d68f[_0x296f('0x43')](_0x296f('0x96'));_0x5c70cc[_0x296f('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x40d68f[_0x296f('0x43')]('i.WhatsappAccountId\x20IN\x20?',_[_0x296f('0x2c')](_0x30a457,'id'));_0x5c70cc[_0x296f('0x43')]('i.WhatsappAccountId\x20IN\x20?',_[_0x296f('0x2c')](_0x30a457,'id'));}});})[_0x296f('0x26')](function(){if(_0x597096[_0x296f('0x94')]['role']===_0x296f('0x93')&&!_0xba8470&&!_0x597096[_0x296f('0x3b')][_0x296f('0x73')])return[];return db[_0x296f('0x97')][_0x296f('0x3b')](_0x40d68f[_0x296f('0x98')](),_0x2710d2);})['then'](function(_0x2b1688){_0x402ab7[_0x296f('0x24')]=_0x2b1688[_0x296f('0x5a')];if(_0x402ab7[_0x296f('0x24')]===0x0)return[];return db['sequelize'][_0x296f('0x3b')](_0x4cf2b0[_0x296f('0x98')](),_0x2710d2)[_0x296f('0x26')](function(_0x86d032){_0x3641e0=_[_0x296f('0x99')](_0x86d032,'id');_0x2710d2=_[_0x296f('0x9a')](_0x2710d2,{'model':db[_0x296f('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x597096['query']['fields']){_0x150f29[_0x296f('0x3e')][_0x296f('0x72')](function(_0x116d5b){_0x5c70cc[_0x296f('0x45')]('i.'+_0x116d5b);});}else{_0x5c70cc['field'](_0x296f('0x9b'),_0x296f('0x5b'));_0x5c70cc['field'](_0x296f('0x9c'),'Account.key');_0x5c70cc[_0x296f('0x45')](_0x296f('0x9d'),_0x296f('0x9e'));_0x5c70cc['field'](_0x296f('0x9f'),_0x296f('0x8e'));_0x5c70cc[_0x296f('0x45')]('i.*');_0x5c70cc[_0x296f('0x45')]('c.firstName',_0x296f('0xa0'));_0x5c70cc['field'](_0x296f('0xa1'),'Contact.lastName');_0x5c70cc['field'](_0x296f('0xa2'),'Contact.email');_0x5c70cc[_0x296f('0x45')](_0x296f('0xa3'),_0x296f('0xa4'));_0x5c70cc[_0x296f('0x45')](_0x296f('0xa5'),'Contact.mobile');_0x5c70cc[_0x296f('0x45')](_0x296f('0xa6'),'Contact.fax');_0x5c70cc[_0x296f('0x45')]('o.fullname',_0x296f('0xa7'));_0x5c70cc[_0x296f('0x45')](_0x296f('0xa8'),_0x296f('0xa9'));_0x5c70cc[_0x296f('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x296f('0x2e'));}if(_0x150f29[_0x296f('0x22')])_0x5c70cc[_0x296f('0x22')](_0x150f29['limit']);if(_0x150f29['offset'])_0x5c70cc[_0x296f('0x21')](_0x150f29[_0x296f('0x21')]);return db[_0x296f('0x97')]['query'](_0x5c70cc[_0x296f('0x98')](),_0x2710d2);})[_0x296f('0x26')](function(_0x18c7cd){if(_0x18c7cd[_0x296f('0x5a')]>0x0)_0x164a60[_0x296f('0x43')](_0x296f('0xaa'),_[_0x296f('0x2c')](_0x18c7cd,'id'));return db[_0x296f('0x97')][_0x296f('0x3b')](_0x164a60[_0x296f('0x98')](),_0x2710d2)[_0x296f('0x26')](function(_0x5f2483){var _0x5b056a=_['groupBy'](_0x5f2483,_0x296f('0xab'));var _0x129e13=[];_0x18c7cd['forEach'](function(_0x4e43ed){_0x129e13['push'](updateWhatsappInteraction(_0x4e43ed,_0x3641e0,_0x5b056a));});return BPromise['all'](_0x129e13);});});})[_0x296f('0x26')](function(_0x4418a4){_0x402ab7[_0x296f('0xac')]=_0x4418a4;return _0x402ab7;})['then'](respondWithFilteredResult(_0x1bb16f,_0x150f29))[_0x296f('0xad')](handleError(_0x1bb16f,null));};exports[_0x296f('0xae')]=function(_0x421f89,_0xdf72){var _0x2ec0e9={'raw':![],'where':{'id':_0x421f89[_0x296f('0xaf')]['id']}},_0x369126={};_0x369126['model']=_[_0x296f('0x6e')](db[_0x296f('0x37')][_0x296f('0x38')]);_0x369126[_0x296f('0x3b')]=_[_0x296f('0x6e')](_0x421f89[_0x296f('0x3b')]);_0x369126[_0x296f('0x44')]=_[_0x296f('0x3c')](_0x369126[_0x296f('0x3a')],_0x369126['query']);_0x2ec0e9[_0x296f('0x3e')]=_[_0x296f('0x3c')](_0x369126[_0x296f('0x3a')],qs[_0x296f('0x3d')](_0x421f89[_0x296f('0x3b')][_0x296f('0x3d')]));_0x2ec0e9[_0x296f('0x3e')]=_0x2ec0e9[_0x296f('0x3e')]['length']?_0x2ec0e9[_0x296f('0x3e')]:_0x369126['model'];if(_0x421f89[_0x296f('0x3b')]['includeAll']){_0x2ec0e9[_0x296f('0xb0')]=[{'all':!![]}];}_0x2ec0e9=_[_0x296f('0x9a')]({},_0x2ec0e9,_0x421f89[_0x296f('0xb1')]);return db[_0x296f('0x37')]['find'](_0x2ec0e9)[_0x296f('0x26')](handleEntityNotFound(_0xdf72,null))[_0x296f('0x26')](respondWithResult(_0xdf72,null))[_0x296f('0xad')](handleError(_0xdf72,null));};exports[_0x296f('0xb2')]=function(_0x3c8bfa,_0xb1886a){return db[_0x296f('0x37')]['create'](_0x3c8bfa['body'],{})[_0x296f('0x26')](respondWithResult(_0xb1886a,0xc9))[_0x296f('0xad')](handleError(_0xb1886a,null));};exports[_0x296f('0xb3')]=function(_0x414181,_0x4c26f2){if(_0x414181[_0x296f('0x6d')]['id']){delete _0x414181['body']['id'];}return db['WhatsappInteraction'][_0x296f('0x66')]({'where':{'id':_0x414181[_0x296f('0xaf')]['id']}})[_0x296f('0x26')](handleEntityNotFound(_0x4c26f2,null))[_0x296f('0x26')](saveUpdates(_0x414181['body'],null))[_0x296f('0x26')](respondWithResult(_0x4c26f2,null))['catch'](handleError(_0x4c26f2,null));};exports[_0x296f('0x27')]=function(_0x335cee,_0x50ddf4){return db[_0x296f('0x37')]['find']({'where':{'id':_0x335cee[_0x296f('0xaf')]['id']}})[_0x296f('0x26')](handleEntityNotFound(_0x50ddf4,null))['then'](removeEntity(_0x50ddf4,null))['catch'](handleError(_0x50ddf4,null));};exports['describe']=function(_0x120348,_0x2c6775){return db[_0x296f('0x37')]['describe']()[_0x296f('0x26')](respondWithResult(_0x2c6775,null))[_0x296f('0xad')](handleError(_0x2c6775,null));};exports[_0x296f('0xb4')]=function(_0x3854ad,_0x20323a,_0x46042f){return db[_0x296f('0xb5')][_0x296f('0x66')]({'where':{'id':_0x3854ad[_0x296f('0xaf')]['id']}})[_0x296f('0x26')](handleEntityNotFound(_0x20323a,null))[_0x296f('0x26')](function(_0x382c96){if(_0x382c96){return _0x382c96[_0x296f('0xb4')](_0x3854ad[_0x296f('0x6d')][_0x296f('0xb6')],_['omit'](_0x3854ad[_0x296f('0x6d')],['ids','id'])||{});}})[_0x296f('0x26')](respondWithResult(_0x20323a,null))['catch'](handleError(_0x20323a,null));};exports['getMessages']=function(_0x27a61c,_0xb41ba,_0x2c1fcb){var _0x2e6db2={'raw':![],'where':{}};var _0x5e0623={};var _0x1b6389={'count':0x0,'rows':[]};return db[_0x296f('0x37')][_0x296f('0xb7')]({'where':{'id':_0x27a61c[_0x296f('0xaf')]['id']}})[_0x296f('0x26')](handleEntityNotFound(_0xb41ba,null))[_0x296f('0x26')](function(_0xd04549){if(_0xd04549){_0x5e0623[_0x296f('0x3a')]=_[_0x296f('0x6e')](db[_0x296f('0xb5')][_0x296f('0x38')]);_0x5e0623[_0x296f('0x3b')]=_[_0x296f('0x6e')](_0x27a61c[_0x296f('0x3b')]);_0x5e0623['filters']=_[_0x296f('0x3c')](_0x5e0623[_0x296f('0x3a')],_0x5e0623[_0x296f('0x3b')]);_0x2e6db2['attributes']=_[_0x296f('0x3c')](_0x5e0623[_0x296f('0x3a')],qs[_0x296f('0x3d')](_0x27a61c[_0x296f('0x3b')][_0x296f('0x3d')]));_0x2e6db2[_0x296f('0x3e')]=_0x2e6db2[_0x296f('0x3e')]['length']?_0x2e6db2['attributes']:_0x5e0623['model'];if(!_0x27a61c[_0x296f('0x3b')][_0x296f('0x3f')](_0x296f('0x40'))){_0x2e6db2['limit']=qs[_0x296f('0x22')](_0x27a61c[_0x296f('0x3b')][_0x296f('0x22')]);_0x2e6db2[_0x296f('0x21')]=qs[_0x296f('0x21')](_0x27a61c[_0x296f('0x3b')][_0x296f('0x21')]);}_0x2e6db2['order']=qs[_0x296f('0x42')](_0x27a61c['query'][_0x296f('0x42')]);_0x2e6db2['where']=qs[_0x296f('0x44')](_[_0x296f('0xb8')](_0x27a61c[_0x296f('0x3b')],_0x5e0623['filters']));_0x2e6db2['where'][_0x296f('0xab')]=_0xd04549['id'];if(_0x27a61c['query'][_0x296f('0x81')]){_0x2e6db2[_0x296f('0x43')]=_[_0x296f('0x9a')](_0x2e6db2['where'],{'$or':_[_0x296f('0x2c')](_0x2e6db2['attributes'],function(_0x4f66e1){var _0x317643={};_0x317643[_0x4f66e1]={'$like':'%'+_0x27a61c[_0x296f('0x3b')][_0x296f('0x81')]+'%'};return _0x317643;})});}if(_0x27a61c[_0x296f('0x3b')][_0x296f('0x77')]){var _0xe6ac27=_0x27a61c[_0x296f('0x3b')][_0x296f('0x77')][_0x296f('0x62')](',');var _0x4851e8={};_0x4851e8[_0xe6ac27[0x0]]={'$gte':moment(_0xe6ac27[0x1])[_0x296f('0xb9')](_0x296f('0xba'))};_0x2e6db2['where']=_[_0x296f('0x9a')](_0x2e6db2[_0x296f('0x43')],_0x4851e8);}_0x2e6db2=_['merge']({},_0x2e6db2,_0x27a61c[_0x296f('0xb1')]);return db['WhatsappMessage'][_0x296f('0x24')]({'where':_0x2e6db2[_0x296f('0x43')]})[_0x296f('0x26')](function(_0x4f79ed){_0x1b6389[_0x296f('0x24')]=_0x4f79ed;if(_0x27a61c['query']['includeAll']){_0x2e6db2[_0x296f('0xb0')]=[{'all':!![]}];}return db[_0x296f('0xb5')][_0x296f('0xbb')](_0x2e6db2);})[_0x296f('0x26')](function(_0x7bd223){_0x1b6389[_0x296f('0xac')]=_0x7bd223;return _0x1b6389;});}})[_0x296f('0x26')](respondWithFilteredResult(_0xb41ba,_0x2e6db2))[_0x296f('0xad')](handleError(_0xb41ba,null));};exports[_0x296f('0xbc')]=function(_0x164f9c,_0x572d37,_0x3b7e9e){return db[_0x296f('0x37')][_0x296f('0x66')]({'where':{'id':_0x164f9c['params']['id']}})[_0x296f('0x26')](handleEntityNotFound(_0x572d37,null))[_0x296f('0x26')](function(_0x481d98){if(_0x481d98){return _0x481d98[_0x296f('0xbd')](_0x164f9c[_0x296f('0x6d')][_0x296f('0xb6')],_[_0x296f('0xbe')](_0x164f9c[_0x296f('0x6d')],['ids','id'])||{})[_0x296f('0xbf')](function(){return db[_0x296f('0x6a')][_0x296f('0xbb')]({'attributes':['id',_0x296f('0x29'),'color'],'where':{'id':_0x164f9c[_0x296f('0x6d')]['ids']}});})[_0x296f('0x26')](function(_0xccc2b2){socket[_0x296f('0xc0')](_0x296f('0xc1'),{'id':Number(_0x164f9c[_0x296f('0xaf')]['id']),'tags':_0xccc2b2||[]});return{'id':Number(_0x164f9c['params']['id']),'tags':_0xccc2b2||[]};});}})[_0x296f('0x26')](respondWithResult(_0x572d37,null))[_0x296f('0xad')](handleError(_0x572d37,null));};exports[_0x296f('0xc2')]=function(_0xe9bce8,_0x2b04d0,_0x481372){return db[_0x296f('0x37')][_0x296f('0x66')]({'where':{'id':_0xe9bce8[_0x296f('0xaf')]['id']}})[_0x296f('0x26')](handleEntityNotFound(_0x2b04d0,null))[_0x296f('0x26')](function(_0x3042ab){if(_0x3042ab){return _0x3042ab[_0x296f('0xc2')](_0xe9bce8[_0x296f('0x3b')][_0x296f('0xb6')]);}})[_0x296f('0x26')](respondWithStatusCode(_0x2b04d0,null))['catch'](handleError(_0x2b04d0,null));};exports[_0x296f('0xc3')]=function(_0x49017e,_0x154fa0){var _0x520050=moment()[_0x296f('0xc4')]()['toString']();var _0x23248e=path[_0x296f('0xc5')](config['root'],_0x296f('0xc6'),'files',_0x296f('0xc7'));var _0x13add9=path[_0x296f('0xc5')](config[_0x296f('0xc8')],_0x296f('0xc6'),_0x296f('0xc9'),'attachments');var _0x51771a=path[_0x296f('0xc5')](_0x23248e,_0x520050);var _0x4ddf32=util[_0x296f('0xb9')]('transcript-%d-%s.zip',_0x49017e[_0x296f('0xaf')]['id'],_0x520050);var _0xb5bf7c=path['join'](_0x23248e,_0x4ddf32);var _0x590237=[];_0x590237[_0x296f('0xca')]({'model':db[_0x296f('0x6c')],'as':'User','attributes':['id',_0x296f('0x2d')],'raw':!![]});_0x590237[_0x296f('0xca')]({'model':db[_0x296f('0xcb')],'as':_0x296f('0xcc'),'attributes':['id','firstName',_0x296f('0xcd')],'raw':!![]});if(_0x49017e['query'][_0x296f('0xce')]){_0x590237['push']({'model':db['Attachment'],'as':_0x296f('0xcf'),'raw':!![]});}var _0x289125=[{'model':db['WhatsappMessage'],'as':_0x296f('0xd0'),'attributes':['id',_0x296f('0x6d'),_0x296f('0x75'),'direction',_0x296f('0xd1'),_0x296f('0x7c')],'include':_0x590237}];_0x289125[_0x296f('0xca')]({'model':db[_0x296f('0xd2')],'as':_0x296f('0xd3'),'attributes':['id','name']});_0x289125['push']({'model':db[_0x296f('0x6c')],'as':'Owner','attributes':['id',_0x296f('0x2d')]});return db[_0x296f('0x37')][_0x296f('0x66')]({'where':{'id':_0x49017e[_0x296f('0xaf')]['id']},'include':_0x289125})[_0x296f('0x26')](handleEntityNotFound(_0x154fa0,null))[_0x296f('0x26')](function(_0x4298d7){if(_0x4298d7){var _0x218994=_0x4298d7[_0x296f('0xd4')]({'plain':!![]});fs[_0x296f('0xd5')](_0x51771a);var _0x5a0dda={'channel':_0x296f('0xd6'),'account':_0x218994[_0x296f('0xd3')]['name'],'agent':_0x218994[_0x296f('0xd7')]?_0x218994[_0x296f('0xd7')][_0x296f('0x2d')]:_0x296f('0xd8'),'createdAt':moment(_0x218994['createdAt'])[_0x296f('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x296f('0x98')](),'closedAt':_0x218994['closed']?moment(_0x218994[_0x296f('0xd9')])['format'](_0x296f('0xba'))[_0x296f('0x98')]():'','disposition':_0x218994[_0x296f('0xda')],'messages':_(_0x218994[_0x296f('0xd0')])[_0x296f('0x81')]({'secret':![]})[_0x296f('0x2c')](function(_0x332308){if(_0x332308[_0x296f('0xcf')]){var _0x1b92eb=path[_0x296f('0xc5')](_0x13add9,_0x332308['Attachment'][_0x296f('0xdb')]);if(fs[_0x296f('0xdc')](_0x1b92eb)){fs[_0x296f('0xdd')](_0x1b92eb)[_0x296f('0xde')](fs[_0x296f('0xdf')](path[_0x296f('0xc5')](_0x51771a,_0x332308[_0x296f('0xcf')]['basename'])));}}return{'date':moment(_0x332308[_0x296f('0x75')])[_0x296f('0xb9')](_0x296f('0xba'))['toString'](),'sender':_0x332308[_0x296f('0xe0')]===_0x296f('0xe1')?_0x332308[_0x296f('0x6c')]?_0x332308[_0x296f('0x6c')][_0x296f('0x2d')]:'System':_0x332308[_0x296f('0xcc')][_0x296f('0xe2')]+(_0x332308[_0x296f('0xcc')][_0x296f('0xcd')]?'\x20'+_0x332308[_0x296f('0xcc')]['lastName']:''),'body':_0x332308[_0x296f('0xcf')]?_0x332308[_0x296f('0xcf')][_0x296f('0xdb')]:_0x332308[_0x296f('0x6d')],'direction':_0x332308[_0x296f('0xe0')]===_0x296f('0xe1')?'A':'C','secret':_0x332308['secret'],'read':_0x332308[_0x296f('0x7c')],'attachment':_0x332308[_0x296f('0xcf')]};})['value']()};return ejs[_0x296f('0xe3')](path[_0x296f('0xc5')](config['root'],'server','views','downloadInteraction.ejs'),{'interaction':_0x5a0dda})['then'](function(_0x1f7083){var _0x43a978=path[_0x296f('0xc5')](_0x51771a,'transcript-'+_0x218994['id']+'-'+_0x520050+_0x296f('0xe4'));var _0xf06bba={'path':_0x43a978,'channel':_0x296f('0xd6'),'interactionId':_0x218994['id']};return pdf[_0x296f('0xe5')](_0x1f7083,_0xf06bba);})[_0x296f('0x26')](function(){return new BPromise(function(_0x4650d2,_0x59b6ec){zipdir(_0x51771a,{'saveTo':_0xb5bf7c},function(_0x3d16a6,_0xceb02f){if(_0x3d16a6)return _0x59b6ec(_0x3d16a6);return _0x4650d2(_0xceb02f);});})[_0x296f('0x26')](function(){return new BPromise(function(_0x282ace,_0x4309eb){rimraf(_0x51771a,function(_0x14be10){if(_0x14be10)_0x4309eb(_0x14be10);return _0x282ace();});});})[_0x296f('0x26')](function(){return _0x154fa0[_0x296f('0xc3')](_0xb5bf7c,_0x4ddf32,function(_0x4c01a8){if(_0x4c01a8){console[_0x296f('0xe6')](_0x296f('0xe7'),_0x4c01a8);}else{fs[_0x296f('0xe8')](_0xb5bf7c);}});});});}else{return _0x154fa0['sendStatus'](0xc8);}})['catch'](handleError(_0x154fa0,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a3493a4..6e5bd9d 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 _0xfc61=['Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','update','remove','getUsers','then','setDataValue'];(function(_0x202d97,_0x3aa561){var _0x555e12=function(_0x4ce740){while(--_0x4ce740){_0x202d97['push'](_0x202d97['shift']());}};_0x555e12(++_0x3aa561);}(_0xfc61,0x78));var _0x1fc6=function(_0x2b520b,_0x76d655){_0x2b520b=_0x2b520b-0x0;var _0x35c536=_0xfc61[_0x2b520b];return _0x35c536;};'use strict';var EventEmitter=require(_0x1fc6('0x0'));var WhatsappInteraction=require(_0x1fc6('0x1'))['db'][_0x1fc6('0x2')];var WhatsappMessage=require(_0x1fc6('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fc6('0x3'),'afterDestroy':_0x1fc6('0x4')};function emitEvent(_0x451c27){return function(_0x3cb94f,_0x48e6f8,_0x5b5f8c){_0x3cb94f[_0x1fc6('0x5')]({'attributes':['id'],'raw':!![]})[_0x1fc6('0x6')](function(_0x3a7dfc){_0x3cb94f[_0x1fc6('0x7')](_0x1fc6('0x8'),_0x3a7dfc['map'](function(_0x8891cc){return{'id':_0x8891cc['id']};}));return WhatsappMessage[_0x1fc6('0x9')]({'where':{'WhatsappInteractionId':_0x3cb94f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1fc6('0x6')](function(_0x132f16){_0x3cb94f['setDataValue'](_0x1fc6('0xa'),_0x132f16[_0x1fc6('0xb')]);WhatsappInteractionEvents['emit'](_0x451c27+':'+_0x3cb94f['id'],_0x3cb94f);WhatsappInteractionEvents[_0x1fc6('0xc')](_0x451c27,_0x3cb94f);_0x5b5f8c(null);})[_0x1fc6('0xd')](_0x5b5f8c(null));};}for(var e in events){if(events[_0x1fc6('0xe')](e)){var event=events[e];WhatsappInteraction[_0x1fc6('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xa739=['length','emit','catch','hasOwnProperty','hook','../../mysqldb','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x156ea9,_0x4fd468){var _0x812f18=function(_0x3dc410){while(--_0x3dc410){_0x156ea9['push'](_0x156ea9['shift']());}};_0x812f18(++_0x4fd468);}(_0xa739,0x1e1));var _0x9a73=function(_0x46193c,_0x41ad09){_0x46193c=_0x46193c-0x0;var _0x3fdc8d=_0xa739[_0x46193c];return _0x3fdc8d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x9a73('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x9a73('0x0'))['db'][_0x9a73('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a73('0x2'),'afterUpdate':_0x9a73('0x3'),'afterDestroy':_0x9a73('0x4')};function emitEvent(_0x4ffb1a){return function(_0x6da224,_0x10252a,_0xcb4e9e){_0x6da224[_0x9a73('0x5')]({'attributes':['id'],'raw':!![]})[_0x9a73('0x6')](function(_0xd14d4d){_0x6da224[_0x9a73('0x7')](_0x9a73('0x8'),_0xd14d4d['map'](function(_0x1cea11){return{'id':_0x1cea11['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x6da224['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a73('0x6')](function(_0x33a367){_0x6da224[_0x9a73('0x7')]('unreadMessages',_0x33a367[_0x9a73('0x9')]);WhatsappInteractionEvents[_0x9a73('0xa')](_0x4ffb1a+':'+_0x6da224['id'],_0x6da224);WhatsappInteractionEvents['emit'](_0x4ffb1a,_0x6da224);_0xcb4e9e(null);})[_0x9a73('0xb')](_0xcb4e9e(null));};}for(var e in events){if(events[_0x9a73('0xc')](e)){var event=events[e];WhatsappInteraction[_0x9a73('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 2cc42e3..348493d 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 _0x3f4b=['whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x3f4b,0x101));var _0xb3f4=function(_0x4447c5,_0x1cc8c4){_0x4447c5=_0x4447c5-0x0;var _0x404c98=_0x3f4b[_0x4447c5];return _0x404c98;};'use strict';var _=require(_0xb3f4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb3f4('0x1'));var moment=require(_0xb3f4('0x2'));var BPromise=require(_0xb3f4('0x3'));var rp=require(_0xb3f4('0x4'));var fs=require('fs');var path=require(_0xb3f4('0x5'));var rimraf=require(_0xb3f4('0x6'));var config=require(_0xb3f4('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0xb3f4('0x8')]=function(_0x5e96ec,_0x203c29){return _0x5e96ec['define']('WhatsappInteraction',attributes,{'tableName':_0xb3f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d266d,_0x4fa33c,_0x6f59b9){if(_0x3d266d['changed'](_0xb3f4('0xa'))){_0x3d266d[_0xb3f4('0xb')]=moment()[_0xb3f4('0xc')](_0xb3f4('0xd'));}_0x6f59b9(null,_0x3d266d);}}});}; \ No newline at end of file +var _0xa036=['changed','closed','closedAt','format','util','../../config/logger','request-promise','path','rimraf','exports','WhatsappInteraction'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0xa036,0x101));var _0x6a03=function(_0x5238a0,_0x1d1abe){_0x5238a0=_0x5238a0-0x0;var _0x35386b=_0xa036[_0x5238a0];return _0x35386b;};'use strict';var _=require('lodash');var util=require(_0x6a03('0x0'));var logger=require(_0x6a03('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a03('0x2'));var fs=require('fs');var path=require(_0x6a03('0x3'));var rimraf=require(_0x6a03('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x6a03('0x5')]=function(_0x554180,_0x5a4bb6){return _0x554180['define'](_0x6a03('0x6'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa607a1,_0x28ca3e,_0x33e547){if(_0xa607a1[_0x6a03('0x7')](_0x6a03('0x8'))){_0xa607a1[_0x6a03('0x9')]=moment()[_0x6a03('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x33e547(null,_0xa607a1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 78259dd..21ab0e7 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 _0x634b=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','stringify','catch','AddTagsToWhatsappInteraction','find','ids','AddTags','lodash'];(function(_0x1fc772,_0x376734){var _0x725ba3=function(_0x58f195){while(--_0x58f195){_0x1fc772['push'](_0x1fc772['shift']());}};_0x725ba3(++_0x376734);}(_0x634b,0x7a));var _0xb634=function(_0x4d9a6e,_0x4707cf){_0x4d9a6e=_0x4d9a6e-0x0;var _0x5a1c98=_0x634b[_0x4d9a6e];return _0x5a1c98;};'use strict';var _=require(_0xb634('0x0'));var util=require(_0xb634('0x1'));var moment=require(_0xb634('0x2'));var BPromise=require('bluebird');var rs=require(_0xb634('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb634('0x4'))['db'];var utils=require(_0xb634('0x5'));var logger=require(_0xb634('0x6'))(_0xb634('0x7'));var config=require(_0xb634('0x8'));var jayson=require(_0xb634('0x9'));var client=jayson['client'][_0xb634('0xa')]({'port':0x232a});config[_0xb634('0xb')]=_['defaults'](config[_0xb634('0xb')],{'host':_0xb634('0xc'),'port':0x18eb});var socket=require(_0xb634('0xd'))(new Redis(config[_0xb634('0xb')]));require(_0xb634('0xe'))[_0xb634('0xf')](socket);function respondWithRpcPromise(_0x2bf841,_0x3663ff,_0x5a18f9){return new BPromise(function(_0x5e48f5,_0x3f54cb){return client[_0xb634('0x10')](_0x2bf841,_0x5a18f9)[_0xb634('0x11')](function(_0x1052e5){logger[_0xb634('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3663ff,_0xb634('0x13'));logger[_0xb634('0x14')](_0xb634('0x15'),_0x3663ff,_0xb634('0x13'),JSON['stringify'](_0x1052e5));if(_0x1052e5[_0xb634('0x16')]){if(_0x1052e5[_0xb634('0x16')][_0xb634('0x17')]===0x1f4){logger[_0xb634('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x3663ff,_0x1052e5[_0xb634('0x16')][_0xb634('0x18')]);return _0x3f54cb(_0x1052e5[_0xb634('0x16')]['message']);}logger[_0xb634('0x16')](_0xb634('0x19'),_0x3663ff,_0x1052e5[_0xb634('0x16')][_0xb634('0x18')]);return _0x5e48f5(_0x1052e5[_0xb634('0x16')]['message']);}else{logger[_0xb634('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3663ff,'request\x20sent');_0x5e48f5(_0x1052e5[_0xb634('0x1a')][_0xb634('0x18')]);}})['catch'](function(_0x2b2c51){logger['error'](_0xb634('0x19'),_0x3663ff,_0x2b2c51);_0x3f54cb(_0x2b2c51);});});}exports[_0xb634('0x1b')]=function(_0x4f065f){var _0x22c4c3=this;return new Promise(function(_0x2ac823,_0x33f79c){return db[_0xb634('0x1c')][_0xb634('0x1d')](_0x4f065f[_0xb634('0x1e')],{'raw':_0x4f065f[_0xb634('0x1f')]?_0x4f065f['options'][_0xb634('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f065f['options']?_0x4f065f[_0xb634('0x1f')][_0xb634('0x21')]||null:null,'attributes':_0x4f065f[_0xb634('0x1f')]?_0x4f065f[_0xb634('0x1f')]['attributes']||null:null,'limit':_0x4f065f[_0xb634('0x1f')]?_0x4f065f[_0xb634('0x1f')][_0xb634('0x22')]||null:null})['then'](function(_0x1e0825){logger[_0xb634('0x12')]('UpdateWhatsappInteraction',_0x4f065f);logger[_0xb634('0x14')](_0xb634('0x1b'),_0x4f065f,JSON[_0xb634('0x23')](_0x1e0825));_0x2ac823(_0x1e0825);})[_0xb634('0x24')](function(_0x1486cd){logger[_0xb634('0x16')](_0xb634('0x1b'),_0x1486cd[_0xb634('0x18')],_0x4f065f);_0x33f79c(_0x22c4c3[_0xb634('0x16')](0x1f4,_0x1486cd[_0xb634('0x18')]));});});};exports[_0xb634('0x25')]=function(_0x37042f){return new Promise(function(_0x2f070d,_0x1ec8a5){return db['WhatsappInteraction'][_0xb634('0x26')]({'where':_0x37042f[_0xb634('0x1f')]?_0x37042f[_0xb634('0x1f')][_0xb634('0x21')]||null:null})[_0xb634('0x11')](function(_0x18e491){if(_0x18e491){return _0x18e491['addTags'](_0x37042f['body']['ids'],_['omit'](_0x37042f[_0xb634('0x1e')],[_0xb634('0x27'),'id'])||{});}})['spread'](function(_0xd9e2c){logger[_0xb634('0x12')](_0xb634('0x28'),_0x37042f);logger['debug'](_0xb634('0x28'),_0x37042f,JSON[_0xb634('0x23')](_0xd9e2c));_0x2f070d(_0xd9e2c);})[_0xb634('0x24')](function(_0x517396){logger[_0xb634('0x16')](_0xb634('0x28'),_0x517396['message'],_0x37042f);_0x1ec8a5(_this[_0xb634('0x16')](0x1f4,_0x517396[_0xb634('0x18')]));});});}; \ No newline at end of file +var _0xd605=['request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','catch','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x5e5393,_0x5e83e6){var _0x56cc23=function(_0x5c18fa){while(--_0x5c18fa){_0x5e5393['push'](_0x5e5393['shift']());}};_0x56cc23(++_0x5e83e6);}(_0xd605,0x76));var _0x5d60=function(_0x399c66,_0x89776c){_0x399c66=_0x399c66-0x0;var _0x37f1f1=_0xd605[_0x399c66];return _0x37f1f1;};'use strict';var _=require(_0x5d60('0x0'));var util=require(_0x5d60('0x1'));var moment=require('moment');var BPromise=require(_0x5d60('0x2'));var rs=require(_0x5d60('0x3'));var fs=require('fs');var Redis=require(_0x5d60('0x4'));var db=require(_0x5d60('0x5'))['db'];var utils=require(_0x5d60('0x6'));var logger=require('../../config/logger')(_0x5d60('0x7'));var config=require(_0x5d60('0x8'));var jayson=require(_0x5d60('0x9'));var client=jayson[_0x5d60('0xa')][_0x5d60('0xb')]({'port':0x232a});config[_0x5d60('0xc')]=_[_0x5d60('0xd')](config[_0x5d60('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5d60('0xe'))(new Redis(config[_0x5d60('0xc')]));require(_0x5d60('0xf'))[_0x5d60('0x10')](socket);function respondWithRpcPromise(_0x106233,_0xd1d18f,_0xda2e55){return new BPromise(function(_0x59f2c0,_0x5abb4b){return client[_0x5d60('0x11')](_0x106233,_0xda2e55)[_0x5d60('0x12')](function(_0x91f2fd){logger[_0x5d60('0x13')](_0x5d60('0x14'),_0xd1d18f,_0x5d60('0x15'));logger['debug'](_0x5d60('0x16'),_0xd1d18f,_0x5d60('0x15'),JSON['stringify'](_0x91f2fd));if(_0x91f2fd[_0x5d60('0x17')]){if(_0x91f2fd[_0x5d60('0x17')][_0x5d60('0x18')]===0x1f4){logger[_0x5d60('0x17')](_0x5d60('0x14'),_0xd1d18f,_0x91f2fd[_0x5d60('0x17')][_0x5d60('0x19')]);return _0x5abb4b(_0x91f2fd[_0x5d60('0x17')][_0x5d60('0x19')]);}logger[_0x5d60('0x17')](_0x5d60('0x14'),_0xd1d18f,_0x91f2fd['error'][_0x5d60('0x19')]);return _0x59f2c0(_0x91f2fd[_0x5d60('0x17')][_0x5d60('0x19')]);}else{logger[_0x5d60('0x13')](_0x5d60('0x14'),_0xd1d18f,_0x5d60('0x15'));_0x59f2c0(_0x91f2fd[_0x5d60('0x1a')]['message']);}})['catch'](function(_0xca440d){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xd1d18f,_0xca440d);_0x5abb4b(_0xca440d);});});}exports[_0x5d60('0x1b')]=function(_0x1cb46a){var _0x8b4158=this;return new Promise(function(_0x3b5ca9,_0x429288){return db[_0x5d60('0x1c')][_0x5d60('0x1d')](_0x1cb46a[_0x5d60('0x1e')],{'raw':_0x1cb46a[_0x5d60('0x1f')]?_0x1cb46a[_0x5d60('0x1f')][_0x5d60('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cb46a[_0x5d60('0x1f')]?_0x1cb46a[_0x5d60('0x1f')][_0x5d60('0x21')]||null:null,'attributes':_0x1cb46a[_0x5d60('0x1f')]?_0x1cb46a['options'][_0x5d60('0x22')]||null:null,'limit':_0x1cb46a[_0x5d60('0x1f')]?_0x1cb46a[_0x5d60('0x1f')][_0x5d60('0x23')]||null:null})[_0x5d60('0x12')](function(_0x10918b){logger[_0x5d60('0x13')](_0x5d60('0x1b'),_0x1cb46a);logger[_0x5d60('0x24')](_0x5d60('0x1b'),_0x1cb46a,JSON[_0x5d60('0x25')](_0x10918b));_0x3b5ca9(_0x10918b);})[_0x5d60('0x26')](function(_0x3be949){logger[_0x5d60('0x17')](_0x5d60('0x1b'),_0x3be949[_0x5d60('0x19')],_0x1cb46a);_0x429288(_0x8b4158[_0x5d60('0x17')](0x1f4,_0x3be949[_0x5d60('0x19')]));});});};exports[_0x5d60('0x27')]=function(_0x325703){return new Promise(function(_0x4053d1,_0x47edd7){return db[_0x5d60('0x1c')]['find']({'where':_0x325703[_0x5d60('0x1f')]?_0x325703['options'][_0x5d60('0x21')]||null:null})[_0x5d60('0x12')](function(_0x3ab1e2){if(_0x3ab1e2){return _0x3ab1e2[_0x5d60('0x28')](_0x325703[_0x5d60('0x1e')][_0x5d60('0x29')],_[_0x5d60('0x2a')](_0x325703['body'],[_0x5d60('0x29'),'id'])||{});}})[_0x5d60('0x2b')](function(_0x8dfe43){logger['info'](_0x5d60('0x2c'),_0x325703);logger['debug'](_0x5d60('0x2c'),_0x325703,JSON['stringify'](_0x8dfe43));_0x4053d1(_0x8dfe43);})[_0x5d60('0x26')](function(_0x5c5357){logger['error'](_0x5d60('0x2c'),_0x5c5357[_0x5d60('0x19')],_0x325703);_0x47edd7(_this[_0x5d60('0x17')](0x1f4,_0x5c5357[_0x5d60('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index be30e74..60418c8 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 _0x6655=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x4b0db4,_0x546f97){var _0x2d8287=function(_0x47a068){while(--_0x47a068){_0x4b0db4['push'](_0x4b0db4['shift']());}};_0x2d8287(++_0x546f97);}(_0x6655,0xdb));var _0x5665=function(_0x3d67d0,_0x59d1f9){_0x3d67d0=_0x3d67d0-0x0;var _0x34a470=_0x6655[_0x3d67d0];return _0x34a470;};'use strict';var WhatsappInteractionEvents=require(_0x5665('0x0'));var events=[_0x5665('0x1'),_0x5665('0x2'),_0x5665('0x3')];function createListener(_0x97547d,_0x3f5698){return function(_0x3d6ac9){_0x3f5698[_0x5665('0x4')](_0x97547d,_0x3d6ac9);};}function removeListener(_0x2973e6,_0x903844){return function(){WhatsappInteractionEvents['removeListener'](_0x2973e6,_0x903844);};}exports[_0x5665('0x5')]=function(_0x480820){for(var _0x24dfdb=0x0,_0x42cc29=events[_0x5665('0x6')];_0x24dfdb<_0x42cc29;_0x24dfdb++){var _0x298d16=events[_0x24dfdb];var _0x1ec632=createListener(_0x5665('0x7')+_0x298d16,_0x480820);WhatsappInteractionEvents['on'](_0x298d16,_0x1ec632);}}; \ No newline at end of file +var _0x6198=['register','length','whatsappInteraction:','save','remove','update','emit','removeListener'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x6198,0x183));var _0x8619=function(_0x2274c2,_0x169b62){_0x2274c2=_0x2274c2-0x0;var _0x13eb4d=_0x6198[_0x2274c2];return _0x13eb4d;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x8619('0x0'),_0x8619('0x1'),_0x8619('0x2')];function createListener(_0x146a35,_0x1923cf){return function(_0x4790b2){_0x1923cf[_0x8619('0x3')](_0x146a35,_0x4790b2);};}function removeListener(_0x3afd9,_0x36962a){return function(){WhatsappInteractionEvents[_0x8619('0x4')](_0x3afd9,_0x36962a);};}exports[_0x8619('0x5')]=function(_0x13a951){for(var _0x244fe0=0x0,_0xd10905=events[_0x8619('0x6')];_0x244fe0<_0xd10905;_0x244fe0++){var _0x2fbb8b=events[_0x244fe0];var _0x45a23c=createListener(_0x8619('0x7')+_0x2fbb8b,_0x13a951);WhatsappInteractionEvents['on'](_0x2fbb8b,_0x45a23c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2de1408..ec8b5f5 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 _0x0517=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','put','/:id/accept','/:id/reject'];(function(_0x13945b,_0x289c94){var _0x1b1643=function(_0x18f4c3){while(--_0x18f4c3){_0x13945b['push'](_0x13945b['shift']());}};_0x1b1643(++_0x289c94);}(_0x0517,0x13b));var _0x7051=function(_0x587735,_0x11da34){_0x587735=_0x587735-0x0;var _0xd54007=_0x0517[_0x587735];return _0xd54007;};'use strict';var multer=require(_0x7051('0x0'));var util=require(_0x7051('0x1'));var path=require(_0x7051('0x2'));var timeout=require(_0x7051('0x3'));var express=require('express');var router=express[_0x7051('0x4')]();var fs_extra=require(_0x7051('0x5'));var auth=require(_0x7051('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7051('0x7'));router[_0x7051('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7051('0x8')](_0x7051('0x9'),auth[_0x7051('0xa')](),controller[_0x7051('0xb')]);router[_0x7051('0x8')](_0x7051('0xc'),auth[_0x7051('0xa')](),controller[_0x7051('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x7051('0xe')](_0x7051('0xf'),_0x7051('0x10')),controller[_0x7051('0x11')]);router[_0x7051('0x12')](_0x7051('0x13'),controller['status']);router['put'](_0x7051('0xc'),auth[_0x7051('0xa')](),controller['update']);router[_0x7051('0x14')](_0x7051('0x15'),auth[_0x7051('0xa')](),controller['accept']);router['put'](_0x7051('0x16'),auth[_0x7051('0xa')](),controller['reject']);router[_0x7051('0x17')](_0x7051('0xc'),auth[_0x7051('0xa')](),controller[_0x7051('0x18')]);module[_0x7051('0x19')]=router; \ No newline at end of file +var _0x12a1=['./whatsappMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x12a1,0x9b));var _0x112a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12a1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x112a('0x0'));var util=require(_0x112a('0x1'));var path=require(_0x112a('0x2'));var timeout=require('connect-timeout');var express=require(_0x112a('0x3'));var router=express['Router']();var fs_extra=require(_0x112a('0x4'));var auth=require(_0x112a('0x5'));var interaction=require(_0x112a('0x6'));var config=require('../../config/environment');var controller=require(_0x112a('0x7'));router['get']('/',auth[_0x112a('0x8')](),controller['index']);router[_0x112a('0x9')](_0x112a('0xa'),auth['isAuthenticated'](),controller[_0x112a('0xb')]);router[_0x112a('0x9')](_0x112a('0xc'),auth[_0x112a('0x8')](),controller[_0x112a('0xd')]);router[_0x112a('0xe')]('/',auth['isAuthenticated'](),interaction[_0x112a('0xf')]('whatsapp',_0x112a('0x10')),controller[_0x112a('0x11')]);router[_0x112a('0xe')](_0x112a('0x12'),controller[_0x112a('0x13')]);router['put'](_0x112a('0xc'),auth[_0x112a('0x8')](),controller[_0x112a('0x14')]);router[_0x112a('0x15')](_0x112a('0x16'),auth[_0x112a('0x8')](),controller[_0x112a('0x17')]);router[_0x112a('0x15')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x112a('0x18')](_0x112a('0xc'),auth[_0x112a('0x8')](),controller[_0x112a('0x19')]);module[_0x112a('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 a1b185d..2ef5c5b 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 _0x1d80=['sequelize','exports','ENUM','out','STRING','BOOLEAN','TEXT'];(function(_0x14804a,_0x41f7c7){var _0x553197=function(_0x2354bc){while(--_0x2354bc){_0x14804a['push'](_0x14804a['shift']());}};_0x553197(++_0x41f7c7);}(_0x1d80,0xaf));var _0x01d8=function(_0x2bfeca,_0x39828b){_0x2bfeca=_0x2bfeca-0x0;var _0x426874=_0x1d80[_0x2bfeca];return _0x426874;};'use strict';var Sequelize=require(_0x01d8('0x0'));module[_0x01d8('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x01d8('0x2')]('in','out'),'defaultValue':_0x01d8('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x01d8('0x4')](0xbe)},'phone':{'type':Sequelize[_0x01d8('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x01d8('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x01d8('0x4')]},'providerResponse':{'type':Sequelize[_0x01d8('0x6')]}}; \ No newline at end of file +var _0x0ef0=['sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_0x50facb,_0x5a6aeb){var _0x389cee=function(_0x4923c0){while(--_0x4923c0){_0x50facb['push'](_0x50facb['shift']());}};_0x389cee(++_0x5a6aeb);}(_0x0ef0,0x80));var _0x00ef=function(_0x134058,_0x423995){_0x134058=_0x134058-0x0;var _0x14a1a9=_0x0ef0[_0x134058];return _0x14a1a9;};'use strict';var Sequelize=require(_0x00ef('0x0'));module[_0x00ef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x00ef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x00ef('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x00ef('0x4')]('in',_0x00ef('0x5')),'defaultValue':_0x00ef('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x00ef('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x00ef('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x00ef('0x6')]},'providerResponse':{'type':Sequelize[_0x00ef('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 08026ae..51b3fd9 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 _0x154b=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','show','params','intersection','find','create','body','catch','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','sequelize','Sequelize','QueryTypes','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x21c48,_0x49ac0a){var _0x1f2cea=function(_0x51a5eb){while(--_0x51a5eb){_0x21c48['push'](_0x21c48['shift']());}};_0x1f2cea(++_0x49ac0a);}(_0x154b,0x10c));var _0xb154=function(_0x5923d9,_0x4325b2){_0x5923d9=_0x5923d9-0x0;var _0x121fed=_0x154b[_0x5923d9];return _0x121fed;};'use strict';var emlformat=require(_0xb154('0x0'));var rimraf=require(_0xb154('0x1'));var zipdir=require(_0xb154('0x2'));var jsonpatch=require(_0xb154('0x3'));var rp=require(_0xb154('0x4'));var moment=require(_0xb154('0x5'));var BPromise=require(_0xb154('0x6'));var Mustache=require(_0xb154('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb154('0x8'));var csv=require(_0xb154('0x9'));var ejs=require(_0xb154('0xa'));var fs=require('fs');var fs_extra=require(_0xb154('0xb'));var _=require(_0xb154('0xc'));var squel=require(_0xb154('0xd'));var crypto=require(_0xb154('0xe'));var jsforce=require(_0xb154('0xf'));var deskjs=require(_0xb154('0x10'));var toCsv=require(_0xb154('0x9'));var querystring=require(_0xb154('0x11'));var Papa=require(_0xb154('0x12'));var Redis=require(_0xb154('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb154('0x14'));var hardwareService=require(_0xb154('0x15'));var logger=require(_0xb154('0x16'))('api');var utils=require(_0xb154('0x17'));var config=require(_0xb154('0x18'));var licenseUtil=require(_0xb154('0x19'));var db=require('../../mysqldb')['db'];config[_0xb154('0x1a')]=_['defaults'](config[_0xb154('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb154('0x1b'))(new Redis(config[_0xb154('0x1a')]));require(_0xb154('0x1c'))[_0xb154('0x1d')](socket);var jayson=require(_0xb154('0x1e'));var client=jayson[_0xb154('0x1f')][_0xb154('0x20')]({'port':0x232c});var client9002=jayson[_0xb154('0x1f')][_0xb154('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x564f8a,_0x5ef0a5,_0x2d11a9,_0x2cebef){return new BPromise(function(_0x23125f,_0x1979c4){var _0xb7f547=_0x2cebef||client;return _0xb7f547['request'](_0x564f8a,_0x2d11a9)[_0xb154('0x21')](function(_0x33aa1c){logger[_0xb154('0x22')](_0xb154('0x23'),_0x5ef0a5,_0xb154('0x24'));logger['debug'](_0xb154('0x25'),_0x5ef0a5,_0xb154('0x24'),JSON[_0xb154('0x26')](_0x33aa1c));if(_0x33aa1c[_0xb154('0x27')]){if(_0x33aa1c['error'][_0xb154('0x28')]===0x1f4){logger[_0xb154('0x27')](_0xb154('0x23'),_0x5ef0a5,_0x33aa1c['error'][_0xb154('0x29')]);return _0x1979c4(_0x33aa1c[_0xb154('0x27')][_0xb154('0x29')]);}logger[_0xb154('0x27')](_0xb154('0x23'),_0x5ef0a5,_0x33aa1c[_0xb154('0x27')][_0xb154('0x29')]);return _0x23125f(_0x33aa1c[_0xb154('0x27')][_0xb154('0x29')]);}else{logger[_0xb154('0x22')](_0xb154('0x23'),_0x5ef0a5,_0xb154('0x24'));_0x23125f(_0x33aa1c[_0xb154('0x2a')][_0xb154('0x29')]);}})['catch'](function(_0x10a30a){logger['error'](_0xb154('0x23'),_0x5ef0a5,_0x10a30a);_0x1979c4(_0x10a30a);});});}function respondWithStatusCode(_0xe51572,_0x2abb5f){_0x2abb5f=_0x2abb5f||0xcc;return function(_0x5d5b79){if(_0x5d5b79){return _0xe51572[_0xb154('0x2b')](_0x2abb5f);}return _0xe51572[_0xb154('0x2c')](_0x2abb5f)[_0xb154('0x2d')]();};}function respondWithResult(_0x65fd90,_0xeceac6){_0xeceac6=_0xeceac6||0xc8;return function(_0x4be511){if(_0x4be511){return _0x65fd90['status'](_0xeceac6)['json'](_0x4be511);}};}function respondWithFilteredResult(_0x2a7e3b,_0x1eb9b5){return function(_0x45e946){if(_0x45e946){var _0x374681=typeof _0x1eb9b5[_0xb154('0x2e')]===_0xb154('0x2f')&&typeof _0x1eb9b5[_0xb154('0x30')]===_0xb154('0x2f');var _0x5b18be=_0x45e946[_0xb154('0x31')];var _0x13d893=_0x374681?0x0:_0x1eb9b5['offset'];var _0x22768c=_0x374681?_0x45e946[_0xb154('0x31')]:_0x1eb9b5['offset']+_0x1eb9b5['limit'];var _0x3bf4a4;if(_0x22768c>=_0x5b18be){_0x22768c=_0x5b18be;_0x3bf4a4=0xc8;}else{_0x3bf4a4=0xce;}_0x2a7e3b['status'](_0x3bf4a4);return _0x2a7e3b[_0xb154('0x32')]('Content-Range',_0x13d893+'-'+_0x22768c+'/'+_0x5b18be)[_0xb154('0x33')](_0x45e946);}return null;};}function patchUpdates(_0x59f0b1){return function(_0x33343f){try{jsonpatch[_0xb154('0x34')](_0x33343f,_0x59f0b1,!![]);}catch(_0x22a0d1){return BPromise['reject'](_0x22a0d1);}return _0x33343f[_0xb154('0x35')]();};}function saveUpdates(_0x171148,_0x53a831){return function(_0x510d58){if(_0x510d58){return _0x510d58[_0xb154('0x36')](_0x171148)[_0xb154('0x21')](function(_0x213f2e){return _0x213f2e;});}return null;};}function removeEntity(_0x1c118e,_0x176279){return function(_0x70532a){if(_0x70532a){return _0x70532a[_0xb154('0x37')]()[_0xb154('0x21')](function(){_0x1c118e[_0xb154('0x2c')](0xcc)[_0xb154('0x2d')]();});}};}function handleEntityNotFound(_0x16f4e6,_0x1f458a){return function(_0x53d43a){if(!_0x53d43a){_0x16f4e6['sendStatus'](0x194);}return _0x53d43a;};}function handleError(_0x579878,_0x23197f){_0x23197f=_0x23197f||0x1f4;return function(_0x152e1f){logger['error'](_0x152e1f[_0xb154('0x38')]);if(_0x152e1f['name']){delete _0x152e1f[_0xb154('0x39')];}_0x579878[_0xb154('0x2c')](_0x23197f)[_0xb154('0x3a')](_0x152e1f);};}exports['index']=function(_0x5c4150,_0x1242b0){var _0x19c069={},_0x53e28b={},_0x3d69c6={'count':0x0,'rows':[]};var _0xe4d8e0=_[_0xb154('0x3b')](db[_0xb154('0x3c')][_0xb154('0x3d')],function(_0x544631){return{'name':_0x544631[_0xb154('0x3e')],'type':_0x544631['type'][_0xb154('0x3f')]};});_0x53e28b[_0xb154('0x40')]=_['map'](_0xe4d8e0,_0xb154('0x39'));_0x53e28b[_0xb154('0x41')]=_[_0xb154('0x42')](_0x5c4150[_0xb154('0x41')]);_0x53e28b[_0xb154('0x43')]=_['intersection'](_0x53e28b[_0xb154('0x40')],_0x53e28b[_0xb154('0x41')]);_0x19c069['attributes']=_['intersection'](_0x53e28b[_0xb154('0x40')],qs[_0xb154('0x44')](_0x5c4150[_0xb154('0x41')][_0xb154('0x44')]));_0x19c069[_0xb154('0x45')]=_0x19c069['attributes'][_0xb154('0x46')]?_0x19c069[_0xb154('0x45')]:_0x53e28b[_0xb154('0x40')];if(!_0x5c4150[_0xb154('0x41')]['hasOwnProperty'](_0xb154('0x47'))){_0x19c069[_0xb154('0x30')]=qs['limit'](_0x5c4150[_0xb154('0x41')][_0xb154('0x30')]);_0x19c069[_0xb154('0x2e')]=qs['offset'](_0x5c4150[_0xb154('0x41')][_0xb154('0x2e')]);}_0x19c069['order']=qs[_0xb154('0x48')](_0x5c4150[_0xb154('0x41')][_0xb154('0x48')]);_0x19c069[_0xb154('0x49')]=qs[_0xb154('0x43')](_['pick'](_0x5c4150['query'],_0x53e28b[_0xb154('0x43')]),_0xe4d8e0);if(_0x5c4150['query'][_0xb154('0x4a')]){_0x19c069[_0xb154('0x49')]=_[_0xb154('0x4b')](_0x19c069[_0xb154('0x49')],{'$or':_[_0xb154('0x3b')](_0xe4d8e0,function(_0x43aeed){if(_0x43aeed['type']!==_0xb154('0x4c')){var _0x2102b5={};_0x2102b5[_0x43aeed['name']]={'$like':'%'+_0x5c4150[_0xb154('0x41')][_0xb154('0x4a')]+'%'};return _0x2102b5;}})});}_0x19c069=_[_0xb154('0x4b')]({},_0x19c069,_0x5c4150[_0xb154('0x4d')]);var _0x2ac017={'where':_0x19c069[_0xb154('0x49')]};return db[_0xb154('0x3c')][_0xb154('0x31')](_0x2ac017)[_0xb154('0x21')](function(_0x4756c6){_0x3d69c6[_0xb154('0x31')]=_0x4756c6;if(_0x5c4150['query'][_0xb154('0x4e')]){_0x19c069['include']=[{'all':!![]}];}return db[_0xb154('0x3c')]['findAll'](_0x19c069);})[_0xb154('0x21')](function(_0x152c6e){_0x3d69c6['rows']=_0x152c6e;return _0x3d69c6;})[_0xb154('0x21')](respondWithFilteredResult(_0x1242b0,_0x19c069))['catch'](handleError(_0x1242b0,null));};exports[_0xb154('0x4f')]=function(_0x300cd2,_0x12eece){var _0x44ab56={'raw':!![],'where':{'id':_0x300cd2[_0xb154('0x50')]['id']}},_0x3819d6={};_0x3819d6['model']=_[_0xb154('0x42')](db[_0xb154('0x3c')][_0xb154('0x3d')]);_0x3819d6[_0xb154('0x41')]=_[_0xb154('0x42')](_0x300cd2['query']);_0x3819d6[_0xb154('0x43')]=_[_0xb154('0x51')](_0x3819d6[_0xb154('0x40')],_0x3819d6[_0xb154('0x41')]);_0x44ab56[_0xb154('0x45')]=_[_0xb154('0x51')](_0x3819d6[_0xb154('0x40')],qs['fields'](_0x300cd2[_0xb154('0x41')]['fields']));_0x44ab56['attributes']=_0x44ab56[_0xb154('0x45')][_0xb154('0x46')]?_0x44ab56[_0xb154('0x45')]:_0x3819d6['model'];if(_0x300cd2[_0xb154('0x41')][_0xb154('0x4e')]){_0x44ab56['include']=[{'all':!![]}];}_0x44ab56=_[_0xb154('0x4b')]({},_0x44ab56,_0x300cd2['options']);return db['WhatsappMessage'][_0xb154('0x52')](_0x44ab56)[_0xb154('0x21')](handleEntityNotFound(_0x12eece,null))[_0xb154('0x21')](respondWithResult(_0x12eece,null))['catch'](handleError(_0x12eece,null));};exports[_0xb154('0x53')]=function(_0x2fb347,_0x4609d0){return db[_0xb154('0x3c')][_0xb154('0x53')](_0x2fb347[_0xb154('0x54')],{})[_0xb154('0x21')](respondWithResult(_0x4609d0,0xc9))['catch'](handleError(_0x4609d0,null));};exports[_0xb154('0x36')]=function(_0x5e874c,_0x5997ac){if(_0x5e874c[_0xb154('0x54')]['id']){delete _0x5e874c[_0xb154('0x54')]['id'];}return db['WhatsappMessage'][_0xb154('0x52')]({'where':{'id':_0x5e874c[_0xb154('0x50')]['id']}})[_0xb154('0x21')](handleEntityNotFound(_0x5997ac,null))[_0xb154('0x21')](saveUpdates(_0x5e874c[_0xb154('0x54')],null))[_0xb154('0x21')](respondWithResult(_0x5997ac,null))[_0xb154('0x55')](handleError(_0x5997ac,null));};exports[_0xb154('0x37')]=function(_0x3acd93,_0xfc1754){return db[_0xb154('0x3c')]['find']({'where':{'id':_0x3acd93['params']['id']}})['then'](handleEntityNotFound(_0xfc1754,null))[_0xb154('0x21')](removeEntity(_0xfc1754,null))[_0xb154('0x55')](handleError(_0xfc1754,null));};exports[_0xb154('0x56')]=function(_0x115f78,_0x433718){return db[_0xb154('0x3c')]['describe']()[_0xb154('0x21')](respondWithResult(_0x433718,null))[_0xb154('0x55')](handleError(_0x433718,null));};var interaction_log=require('../../config/logger')(_0xb154('0x57'));exports[_0xb154('0x58')]=function(_0x413c2d,_0x5274b0,_0x3653ed){var _0x36897b={'agent':{},'channel':_0xb154('0x59')};if(_0x413c2d[_0xb154('0x54')]['id']){delete _0x413c2d[_0xb154('0x54')]['id'];}_0x413c2d[_0xb154('0x54')][_0xb154('0x5a')]=!![];_0x413c2d[_0xb154('0x54')][_0xb154('0x5b')]=moment()[_0xb154('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x413c2d[_0xb154('0x54')][_0xb154('0x5d')]=_0x413c2d[_0xb154('0x54')][_0xb154('0x5d')]||_0x413c2d[_0xb154('0x5e')]['id'];_0x36897b[_0xb154('0x5f')]['id']=_0x413c2d[_0xb154('0x54')][_0xb154('0x5d')];return db[_0xb154('0x3c')][_0xb154('0x52')]({'where':{'id':_0x413c2d[_0xb154('0x50')]['id'],'UserId':null}})[_0xb154('0x21')](handleEntityNotFound(_0x5274b0,null))['then'](saveUpdates(_0x413c2d[_0xb154('0x54')],null))[_0xb154('0x21')](function(_0x3f6cdd){if(_0x3f6cdd){_0x36897b[_0xb154('0x29')]=_0x3f6cdd[_0xb154('0x60')]({'plain':!![]});return db[_0xb154('0x61')][_0xb154('0x52')]({'where':{'id':_0x3f6cdd[_0xb154('0x62')]}});}return null;})[_0xb154('0x21')](handleEntityNotFound(_0x5274b0,null))['then'](function(_0x11ee2e){if(_0x11ee2e){return _0x11ee2e[_0xb154('0x36')]({'UserId':_0x413c2d['body'][_0xb154('0x5d')],'read1stAt':_[_0xb154('0x63')](_0x11ee2e['read1stAt'])?moment()['format'](_0xb154('0x64')):undefined});}return null;})[_0xb154('0x21')](function(_0x2b1dc6){if(_0x2b1dc6){_0x36897b[_0xb154('0x65')]=_0x2b1dc6['get']({'plain':!![]});interaction_log[_0xb154('0x22')](_0xb154('0x66'),_0x413c2d['user']['id'],_0x413c2d[_0xb154('0x5e')][_0xb154('0x39')],_0x413c2d[_0xb154('0x5e')][_0xb154('0x67')],_0x36897b[_0xb154('0x65')]['id'],_0x413c2d['body']?JSON[_0xb154('0x26')](_0x413c2d[_0xb154('0x54')]):'null');return respondWithRpcPromise(_0xb154('0x68'),_0xb154('0x69'),_0x36897b);}return null;})[_0xb154('0x21')](function(_0x42d479){var _0x38d4e1=_0xb154('0x6a')+_0x42d479[_0xb154('0x29')][_0xb154('0x6b')];return db['sequelize'][_0xb154('0x41')](_0x38d4e1,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xb154('0x21')](function(_0x525b1c){return _0x525b1c;});})['then'](function(_0x23595c){if(_0x23595c){_0x36897b[_0xb154('0x29')][_0xb154('0x6c')]=_0x23595c[0x0];if(!_0x413c2d[_0xb154('0x54')]['UserId'])return;return db[_0xb154('0x6d')]['find']({'where':{'id':_0x413c2d[_0xb154('0x54')][_0xb154('0x5d')],'role':'agent'},'attributes':['id',_0xb154('0x39'),_0xb154('0x6e'),_0xb154('0x6f'),_0xb154('0x70')],'raw':!![]});}return null;})[_0xb154('0x21')](function(_0x5a94ce){if(!_0x5a94ce)return null;_0x36897b[_0xb154('0x29')][_0xb154('0x5f')]=_0x5a94ce;return _0x36897b;})['then'](function(_0x2db7ab){if(_0x2db7ab){if(_0x413c2d[_0xb154('0x54')][_0xb154('0x71')]){_0x36897b[_0xb154('0x29')][_0xb154('0x72')]=util[_0xb154('0x5c')](_0xb154('0x73'),_0x413c2d['user']['name']);_0x36897b['message'][_0xb154('0x74')]=_0x36897b['channel'];_0x36897b[_0xb154('0x29')][_0xb154('0x75')]=_0x36897b[_0xb154('0x74')];_0x36897b[_0xb154('0x29')][_0xb154('0x76')]=_0xb154('0x58');return respondWithRpcPromise(_0xb154('0x77'),'EventManager',{'event':'acceptmessage','message':_0x36897b[_0xb154('0x29')]},client9002)[_0xb154('0x21')](function(){return _0x36897b;});}return _0x36897b;}return null;})[_0xb154('0x21')](respondWithResult(_0x5274b0,null))['catch'](handleError(_0x5274b0,null));};var interaction_log=require('../../config/logger')(_0xb154('0x57'));exports[_0xb154('0x78')]=function(_0x5ab2b0,_0x22d5a3,_0x3fdd7c){var _0x505a38={'agent':{},'channel':_0xb154('0x59')};if(_0x5ab2b0[_0xb154('0x54')]['id']){delete _0x5ab2b0[_0xb154('0x54')]['id'];}_0x5ab2b0[_0xb154('0x54')][_0xb154('0x5d')]=_0x5ab2b0[_0xb154('0x54')][_0xb154('0x5d')]||_0x5ab2b0['user']['id'];_0x505a38[_0xb154('0x5f')]['id']=_0x5ab2b0[_0xb154('0x54')][_0xb154('0x5d')];return db['WhatsappMessage'][_0xb154('0x52')]({'where':{'id':_0x5ab2b0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22d5a3,null))[_0xb154('0x21')](function(_0x1cd110){if(_0x1cd110){_0x505a38[_0xb154('0x29')]=_0x1cd110['get']({'plain':!![]});return db[_0xb154('0x61')]['find']({'where':{'id':_0x1cd110['WhatsappInteractionId']}});}return null;})[_0xb154('0x21')](handleEntityNotFound(_0x22d5a3,null))[_0xb154('0x21')](function(_0x353e0e){if(_0x353e0e){_0x505a38[_0xb154('0x65')]=_0x353e0e[_0xb154('0x60')]({'plain':!![]});interaction_log[_0xb154('0x22')](_0xb154('0x79'),_0x5ab2b0['user']['id'],_0x5ab2b0[_0xb154('0x5e')][_0xb154('0x39')],_0x5ab2b0['user'][_0xb154('0x67')],_0x505a38[_0xb154('0x65')]['id'],_0x5ab2b0['body']?JSON['stringify'](_0x5ab2b0[_0xb154('0x54')]):_0xb154('0x7a'));return respondWithRpcPromise('RejectMessage',_0xb154('0x7b'),_0x505a38);}return null;})[_0xb154('0x21')](function(_0xc5456c){var _0x6de7d9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xc5456c[_0xb154('0x29')][_0xb154('0x6b')];return db[_0xb154('0x7c')][_0xb154('0x41')](_0x6de7d9,{'type':db[_0xb154('0x7d')][_0xb154('0x7e')]['SELECT'],'raw':!![]})['then'](function(_0xe644bc){return _0xe644bc;});})[_0xb154('0x21')](function(_0x339975){if(_0x339975){_0x505a38['message'][_0xb154('0x6c')]=_0x339975[0x0];if(!_0x5ab2b0[_0xb154('0x54')][_0xb154('0x5d')])return;return db[_0xb154('0x6d')]['find']({'where':{'id':_0x5ab2b0['body']['UserId'],'role':_0xb154('0x5f')},'attributes':['id',_0xb154('0x39'),_0xb154('0x6e'),_0xb154('0x6f'),'internal'],'raw':!![]});}return null;})[_0xb154('0x21')](function(_0x1b6cec){if(!_0x1b6cec)return null;_0x505a38[_0xb154('0x29')][_0xb154('0x5f')]=_0x1b6cec;return _0x505a38;})[_0xb154('0x21')](function(_0x2dda93){if(_0x2dda93){_0x2dda93[_0xb154('0x29')]['interface']=util[_0xb154('0x5c')](_0xb154('0x73'),_0x5ab2b0[_0xb154('0x5e')][_0xb154('0x39')]);_0x2dda93[_0xb154('0x29')]['channel']=_0x505a38[_0xb154('0x74')];_0x2dda93[_0xb154('0x29')][_0xb154('0x75')]=_0x505a38['channel'];_0x2dda93[_0xb154('0x29')][_0xb154('0x76')]=_0xb154('0x78');respondWithRpcPromise(_0xb154('0x77'),_0xb154('0x77'),{'event':_0xb154('0x7f'),'message':_0x2dda93['message']},client9002);return _0x505a38;}return null;})['then'](respondWithResult(_0x22d5a3,null))[_0xb154('0x55')](handleError(_0x22d5a3,null));};exports[_0xb154('0x2c')]=function(_0x9ca4fd,_0x3b25ef,_0x24c9dc){if(_0x9ca4fd[_0xb154('0x54')]['id']){delete _0x9ca4fd[_0xb154('0x54')]['id'];}var _0x2b41ac;return db[_0xb154('0x3c')][_0xb154('0x52')]({'where':{'id':_0x9ca4fd[_0xb154('0x50')]['id']}})[_0xb154('0x21')](handleEntityNotFound(_0x3b25ef,null))[_0xb154('0x21')](function(_0x4a2a8d){if(_0x4a2a8d){_0x2b41ac=_0x4a2a8d;return db[_0xb154('0x80')][_0xb154('0x52')]({'where':{'id':_0x4a2a8d['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x3b25ef,null))['then'](function(_0x4891e3){if(_0x4891e3){logger['debug'](_0xb154('0x81'),_0xb154('0x2c'),_0xb154('0x82'),_0x4891e3['type'],util['inspect'](_0x9ca4fd[_0xb154('0x54')],{'showHidden':![],'depth':null}));switch(_0x4891e3[_0xb154('0x83')]){case'twilio':if(_0x9ca4fd[_0xb154('0x54')][_0xb154('0x84')]&&_0x9ca4fd[_0xb154('0x54')]['MessageSid']===_0x2b41ac['messageId']&&_0x9ca4fd['body'][_0xb154('0x85')]&&_0x9ca4fd['body'][_0xb154('0x85')]===_0xb154('0x5a')){return _0x2b41ac[_0xb154('0x36')]({'read':!![]});}else{logger[_0xb154('0x27')](_0xb154('0x86'),_0xb154('0x2c'),_0xb154('0x87'),util[_0xb154('0x88')](_0x9ca4fd['body'],{'showHidden':![],'depth':null}));}break;}return _0x2b41ac;}})['then'](respondWithResult(_0x3b25ef,null))[_0xb154('0x55')](handleError(_0x3b25ef,null));}; \ No newline at end of file +var _0x56ce=['MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','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','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','options','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','internal','SIP/%s','channel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','motionChannel','WhatsappAccount','WhatsappAccountId','twilio'];(function(_0x1389c9,_0x2d59d2){var _0x4e08f5=function(_0x982a26){while(--_0x982a26){_0x1389c9['push'](_0x1389c9['shift']());}};_0x4e08f5(++_0x2d59d2);}(_0x56ce,0x96));var _0xe56c=function(_0x699003,_0x44ba25){_0x699003=_0x699003-0x0;var _0x50603f=_0x56ce[_0x699003];return _0x50603f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe56c('0x0'));var zipdir=require(_0xe56c('0x1'));var jsonpatch=require(_0xe56c('0x2'));var rp=require(_0xe56c('0x3'));var moment=require(_0xe56c('0x4'));var BPromise=require(_0xe56c('0x5'));var Mustache=require(_0xe56c('0x6'));var util=require('util');var path=require(_0xe56c('0x7'));var sox=require(_0xe56c('0x8'));var csv=require(_0xe56c('0x9'));var ejs=require(_0xe56c('0xa'));var fs=require('fs');var fs_extra=require(_0xe56c('0xb'));var _=require(_0xe56c('0xc'));var squel=require(_0xe56c('0xd'));var crypto=require(_0xe56c('0xe'));var jsforce=require(_0xe56c('0xf'));var deskjs=require(_0xe56c('0x10'));var toCsv=require(_0xe56c('0x9'));var querystring=require(_0xe56c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe56c('0x12'));var qs=require(_0xe56c('0x13'));var as=require(_0xe56c('0x14'));var hardwareService=require(_0xe56c('0x15'));var logger=require('../../config/logger')(_0xe56c('0x16'));var utils=require(_0xe56c('0x17'));var config=require(_0xe56c('0x18'));var licenseUtil=require(_0xe56c('0x19'));var db=require(_0xe56c('0x1a'))['db'];config[_0xe56c('0x1b')]=_[_0xe56c('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe56c('0x1b')]));require('./whatsappMessage.socket')[_0xe56c('0x1d')](socket);var jayson=require(_0xe56c('0x1e'));var client=jayson['client'][_0xe56c('0x1f')]({'port':0x232c});var client9002=jayson[_0xe56c('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x107d96,_0x2a1606,_0xe9c04b,_0x14a4a1){return new BPromise(function(_0x57cbfb,_0x3effe6){var _0x14b20b=_0x14a4a1||client;return _0x14b20b[_0xe56c('0x21')](_0x107d96,_0xe9c04b)[_0xe56c('0x22')](function(_0x458418){logger[_0xe56c('0x23')](_0xe56c('0x24'),_0x2a1606,_0xe56c('0x25'));logger[_0xe56c('0x26')](_0xe56c('0x27'),_0x2a1606,_0xe56c('0x25'),JSON[_0xe56c('0x28')](_0x458418));if(_0x458418['error']){if(_0x458418[_0xe56c('0x29')][_0xe56c('0x2a')]===0x1f4){logger[_0xe56c('0x29')](_0xe56c('0x24'),_0x2a1606,_0x458418[_0xe56c('0x29')]['message']);return _0x3effe6(_0x458418[_0xe56c('0x29')][_0xe56c('0x2b')]);}logger[_0xe56c('0x29')](_0xe56c('0x24'),_0x2a1606,_0x458418[_0xe56c('0x29')][_0xe56c('0x2b')]);return _0x57cbfb(_0x458418[_0xe56c('0x29')][_0xe56c('0x2b')]);}else{logger[_0xe56c('0x23')](_0xe56c('0x24'),_0x2a1606,_0xe56c('0x25'));_0x57cbfb(_0x458418[_0xe56c('0x2c')][_0xe56c('0x2b')]);}})[_0xe56c('0x2d')](function(_0x277e65){logger[_0xe56c('0x29')](_0xe56c('0x24'),_0x2a1606,_0x277e65);_0x3effe6(_0x277e65);});});}function respondWithStatusCode(_0x3114e4,_0x5918c3){_0x5918c3=_0x5918c3||0xcc;return function(_0x39f024){if(_0x39f024){return _0x3114e4['sendStatus'](_0x5918c3);}return _0x3114e4[_0xe56c('0x2e')](_0x5918c3)[_0xe56c('0x2f')]();};}function respondWithResult(_0x53cff1,_0x4ddb04){_0x4ddb04=_0x4ddb04||0xc8;return function(_0x30c37f){if(_0x30c37f){return _0x53cff1[_0xe56c('0x2e')](_0x4ddb04)[_0xe56c('0x30')](_0x30c37f);}};}function respondWithFilteredResult(_0x367d1f,_0x23ff38){return function(_0x55bfbc){if(_0x55bfbc){var _0x16d00d=typeof _0x23ff38['offset']===_0xe56c('0x31')&&typeof _0x23ff38[_0xe56c('0x32')]===_0xe56c('0x31');var _0x38a2b7=_0x55bfbc[_0xe56c('0x33')];var _0x48bbb1=_0x16d00d?0x0:_0x23ff38[_0xe56c('0x34')];var _0x2ef2c4=_0x16d00d?_0x55bfbc[_0xe56c('0x33')]:_0x23ff38['offset']+_0x23ff38[_0xe56c('0x32')];var _0x30eb3b;if(_0x2ef2c4>=_0x38a2b7){_0x2ef2c4=_0x38a2b7;_0x30eb3b=0xc8;}else{_0x30eb3b=0xce;}_0x367d1f['status'](_0x30eb3b);return _0x367d1f[_0xe56c('0x35')](_0xe56c('0x36'),_0x48bbb1+'-'+_0x2ef2c4+'/'+_0x38a2b7)[_0xe56c('0x30')](_0x55bfbc);}return null;};}function patchUpdates(_0x43ace4){return function(_0x2004db){try{jsonpatch[_0xe56c('0x37')](_0x2004db,_0x43ace4,!![]);}catch(_0x5980a3){return BPromise['reject'](_0x5980a3);}return _0x2004db[_0xe56c('0x38')]();};}function saveUpdates(_0x2cf60c,_0x1de33c){return function(_0x5a1ae4){if(_0x5a1ae4){return _0x5a1ae4[_0xe56c('0x39')](_0x2cf60c)[_0xe56c('0x22')](function(_0x4881a4){return _0x4881a4;});}return null;};}function removeEntity(_0x1a16ae,_0x2ee223){return function(_0x1bddef){if(_0x1bddef){return _0x1bddef[_0xe56c('0x3a')]()[_0xe56c('0x22')](function(){_0x1a16ae[_0xe56c('0x2e')](0xcc)[_0xe56c('0x2f')]();});}};}function handleEntityNotFound(_0x45e569,_0x1f7685){return function(_0x33f242){if(!_0x33f242){_0x45e569['sendStatus'](0x194);}return _0x33f242;};}function handleError(_0x17b7b6,_0x37b279){_0x37b279=_0x37b279||0x1f4;return function(_0x4a02cf){logger[_0xe56c('0x29')](_0x4a02cf[_0xe56c('0x3b')]);if(_0x4a02cf[_0xe56c('0x3c')]){delete _0x4a02cf[_0xe56c('0x3c')];}_0x17b7b6['status'](_0x37b279)[_0xe56c('0x3d')](_0x4a02cf);};}exports[_0xe56c('0x3e')]=function(_0x3d2003,_0x476b48){var _0x3242ea={},_0x4e30a4={},_0x762225={'count':0x0,'rows':[]};var _0x59d17d=_[_0xe56c('0x3f')](db[_0xe56c('0x40')]['rawAttributes'],function(_0x1816c2){return{'name':_0x1816c2[_0xe56c('0x41')],'type':_0x1816c2[_0xe56c('0x42')][_0xe56c('0x43')]};});_0x4e30a4[_0xe56c('0x44')]=_['map'](_0x59d17d,_0xe56c('0x3c'));_0x4e30a4['query']=_[_0xe56c('0x45')](_0x3d2003[_0xe56c('0x46')]);_0x4e30a4[_0xe56c('0x47')]=_[_0xe56c('0x48')](_0x4e30a4[_0xe56c('0x44')],_0x4e30a4[_0xe56c('0x46')]);_0x3242ea[_0xe56c('0x49')]=_[_0xe56c('0x48')](_0x4e30a4[_0xe56c('0x44')],qs[_0xe56c('0x4a')](_0x3d2003[_0xe56c('0x46')][_0xe56c('0x4a')]));_0x3242ea[_0xe56c('0x49')]=_0x3242ea[_0xe56c('0x49')]['length']?_0x3242ea[_0xe56c('0x49')]:_0x4e30a4['model'];if(!_0x3d2003[_0xe56c('0x46')][_0xe56c('0x4b')](_0xe56c('0x4c'))){_0x3242ea['limit']=qs[_0xe56c('0x32')](_0x3d2003[_0xe56c('0x46')][_0xe56c('0x32')]);_0x3242ea['offset']=qs[_0xe56c('0x34')](_0x3d2003[_0xe56c('0x46')]['offset']);}_0x3242ea[_0xe56c('0x4d')]=qs['sort'](_0x3d2003[_0xe56c('0x46')][_0xe56c('0x4e')]);_0x3242ea[_0xe56c('0x4f')]=qs[_0xe56c('0x47')](_[_0xe56c('0x50')](_0x3d2003[_0xe56c('0x46')],_0x4e30a4[_0xe56c('0x47')]),_0x59d17d);if(_0x3d2003[_0xe56c('0x46')][_0xe56c('0x51')]){_0x3242ea[_0xe56c('0x4f')]=_[_0xe56c('0x52')](_0x3242ea[_0xe56c('0x4f')],{'$or':_[_0xe56c('0x3f')](_0x59d17d,function(_0x45b29b){if(_0x45b29b['type']!==_0xe56c('0x53')){var _0x23fc47={};_0x23fc47[_0x45b29b[_0xe56c('0x3c')]]={'$like':'%'+_0x3d2003[_0xe56c('0x46')][_0xe56c('0x51')]+'%'};return _0x23fc47;}})});}_0x3242ea=_[_0xe56c('0x52')]({},_0x3242ea,_0x3d2003['options']);var _0x1d9d72={'where':_0x3242ea[_0xe56c('0x4f')]};return db[_0xe56c('0x40')]['count'](_0x1d9d72)[_0xe56c('0x22')](function(_0x53ea31){_0x762225['count']=_0x53ea31;if(_0x3d2003[_0xe56c('0x46')]['includeAll']){_0x3242ea['include']=[{'all':!![]}];}return db[_0xe56c('0x40')][_0xe56c('0x54')](_0x3242ea);})[_0xe56c('0x22')](function(_0x44884f){_0x762225[_0xe56c('0x55')]=_0x44884f;return _0x762225;})[_0xe56c('0x22')](respondWithFilteredResult(_0x476b48,_0x3242ea))[_0xe56c('0x2d')](handleError(_0x476b48,null));};exports[_0xe56c('0x56')]=function(_0x27303a,_0x36508d){var _0x3cd3b1={'raw':!![],'where':{'id':_0x27303a[_0xe56c('0x57')]['id']}},_0x195d8d={};_0x195d8d[_0xe56c('0x44')]=_[_0xe56c('0x45')](db[_0xe56c('0x40')][_0xe56c('0x58')]);_0x195d8d[_0xe56c('0x46')]=_[_0xe56c('0x45')](_0x27303a[_0xe56c('0x46')]);_0x195d8d[_0xe56c('0x47')]=_[_0xe56c('0x48')](_0x195d8d['model'],_0x195d8d[_0xe56c('0x46')]);_0x3cd3b1[_0xe56c('0x49')]=_[_0xe56c('0x48')](_0x195d8d[_0xe56c('0x44')],qs['fields'](_0x27303a['query']['fields']));_0x3cd3b1['attributes']=_0x3cd3b1[_0xe56c('0x49')][_0xe56c('0x59')]?_0x3cd3b1[_0xe56c('0x49')]:_0x195d8d[_0xe56c('0x44')];if(_0x27303a[_0xe56c('0x46')][_0xe56c('0x5a')]){_0x3cd3b1['include']=[{'all':!![]}];}_0x3cd3b1=_[_0xe56c('0x52')]({},_0x3cd3b1,_0x27303a[_0xe56c('0x5b')]);return db[_0xe56c('0x40')][_0xe56c('0x5c')](_0x3cd3b1)[_0xe56c('0x22')](handleEntityNotFound(_0x36508d,null))['then'](respondWithResult(_0x36508d,null))['catch'](handleError(_0x36508d,null));};exports[_0xe56c('0x5d')]=function(_0x1bb22d,_0x6e9b80){return db[_0xe56c('0x40')][_0xe56c('0x5d')](_0x1bb22d[_0xe56c('0x5e')],{})[_0xe56c('0x22')](respondWithResult(_0x6e9b80,0xc9))[_0xe56c('0x2d')](handleError(_0x6e9b80,null));};exports['update']=function(_0x493055,_0x455f36){if(_0x493055[_0xe56c('0x5e')]['id']){delete _0x493055[_0xe56c('0x5e')]['id'];}return db[_0xe56c('0x40')][_0xe56c('0x5c')]({'where':{'id':_0x493055['params']['id']}})[_0xe56c('0x22')](handleEntityNotFound(_0x455f36,null))[_0xe56c('0x22')](saveUpdates(_0x493055[_0xe56c('0x5e')],null))[_0xe56c('0x22')](respondWithResult(_0x455f36,null))[_0xe56c('0x2d')](handleError(_0x455f36,null));};exports[_0xe56c('0x3a')]=function(_0x57e988,_0x5de1ab){return db[_0xe56c('0x40')][_0xe56c('0x5c')]({'where':{'id':_0x57e988[_0xe56c('0x57')]['id']}})[_0xe56c('0x22')](handleEntityNotFound(_0x5de1ab,null))[_0xe56c('0x22')](removeEntity(_0x5de1ab,null))[_0xe56c('0x2d')](handleError(_0x5de1ab,null));};exports['describe']=function(_0x4d142c,_0x19a5aa){return db[_0xe56c('0x40')][_0xe56c('0x5f')]()[_0xe56c('0x22')](respondWithResult(_0x19a5aa,null))[_0xe56c('0x2d')](handleError(_0x19a5aa,null));};var interaction_log=require(_0xe56c('0x60'))(_0xe56c('0x61'));exports[_0xe56c('0x62')]=function(_0x40e69d,_0x4ee3d8,_0x557c8b){var _0x530887={'agent':{},'channel':_0xe56c('0x63')};if(_0x40e69d[_0xe56c('0x5e')]['id']){delete _0x40e69d['body']['id'];}_0x40e69d[_0xe56c('0x5e')][_0xe56c('0x64')]=!![];_0x40e69d['body'][_0xe56c('0x65')]=moment()[_0xe56c('0x66')](_0xe56c('0x67'));_0x40e69d['body'][_0xe56c('0x68')]=_0x40e69d[_0xe56c('0x5e')][_0xe56c('0x68')]||_0x40e69d[_0xe56c('0x69')]['id'];_0x530887[_0xe56c('0x6a')]['id']=_0x40e69d[_0xe56c('0x5e')][_0xe56c('0x68')];return db[_0xe56c('0x40')][_0xe56c('0x5c')]({'where':{'id':_0x40e69d[_0xe56c('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4ee3d8,null))[_0xe56c('0x22')](saveUpdates(_0x40e69d[_0xe56c('0x5e')],null))['then'](function(_0x4baebe){if(_0x4baebe){_0x530887[_0xe56c('0x2b')]=_0x4baebe[_0xe56c('0x6b')]({'plain':!![]});return db[_0xe56c('0x6c')][_0xe56c('0x5c')]({'where':{'id':_0x4baebe[_0xe56c('0x6d')]}});}return null;})[_0xe56c('0x22')](handleEntityNotFound(_0x4ee3d8,null))['then'](function(_0x164817){if(_0x164817){return _0x164817[_0xe56c('0x39')]({'UserId':_0x40e69d[_0xe56c('0x5e')][_0xe56c('0x68')],'read1stAt':_[_0xe56c('0x6e')](_0x164817[_0xe56c('0x6f')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe56c('0x22')](function(_0x3a7e5c){if(_0x3a7e5c){_0x530887['interaction']=_0x3a7e5c[_0xe56c('0x6b')]({'plain':!![]});interaction_log['info'](_0xe56c('0x70'),_0x40e69d[_0xe56c('0x69')]['id'],_0x40e69d['user'][_0xe56c('0x3c')],_0x40e69d['user'][_0xe56c('0x71')],_0x530887[_0xe56c('0x72')]['id'],_0x40e69d[_0xe56c('0x5e')]?JSON['stringify'](_0x40e69d[_0xe56c('0x5e')]):_0xe56c('0x73'));return respondWithRpcPromise(_0xe56c('0x74'),'acceptMessage',_0x530887);}return null;})[_0xe56c('0x22')](function(_0x5cbba5){var _0x4df13d=_0xe56c('0x75')+_0x5cbba5[_0xe56c('0x2b')][_0xe56c('0x76')];return db['sequelize'][_0xe56c('0x46')](_0x4df13d,{'type':db[_0xe56c('0x77')][_0xe56c('0x78')]['SELECT'],'raw':!![]})[_0xe56c('0x22')](function(_0x4a7578){return _0x4a7578;});})[_0xe56c('0x22')](function(_0xf9c996){if(_0xf9c996){_0x530887['message'][_0xe56c('0x79')]=_0xf9c996[0x0];if(!_0x40e69d[_0xe56c('0x5e')][_0xe56c('0x68')])return;return db[_0xe56c('0x7a')][_0xe56c('0x5c')]({'where':{'id':_0x40e69d['body'][_0xe56c('0x68')],'role':_0xe56c('0x6a')},'attributes':['id','name',_0xe56c('0x7b'),'email',_0xe56c('0x7c')],'raw':!![]});}return null;})[_0xe56c('0x22')](function(_0x5d62b3){if(!_0x5d62b3)return null;_0x530887['message'][_0xe56c('0x6a')]=_0x5d62b3;return _0x530887;})[_0xe56c('0x22')](function(_0x85d7f8){if(_0x85d7f8){if(_0x40e69d[_0xe56c('0x5e')]['manual']){_0x530887[_0xe56c('0x2b')]['interface']=util['format'](_0xe56c('0x7d'),_0x40e69d[_0xe56c('0x69')][_0xe56c('0x3c')]);_0x530887[_0xe56c('0x2b')][_0xe56c('0x7e')]=_0x530887[_0xe56c('0x7e')];_0x530887[_0xe56c('0x2b')]['motionChannel']=_0x530887[_0xe56c('0x7e')];_0x530887[_0xe56c('0x2b')][_0xe56c('0x7f')]=_0xe56c('0x62');return respondWithRpcPromise('EventManager',_0xe56c('0x80'),{'event':_0xe56c('0x81'),'message':_0x530887['message']},client9002)['then'](function(){return _0x530887;});}return _0x530887;}return null;})[_0xe56c('0x22')](respondWithResult(_0x4ee3d8,null))['catch'](handleError(_0x4ee3d8,null));};var interaction_log=require(_0xe56c('0x60'))(_0xe56c('0x61'));exports[_0xe56c('0x82')]=function(_0x138e8c,_0x5c5156,_0x275f43){var _0x4218a3={'agent':{},'channel':_0xe56c('0x63')};if(_0x138e8c['body']['id']){delete _0x138e8c[_0xe56c('0x5e')]['id'];}_0x138e8c['body'][_0xe56c('0x68')]=_0x138e8c[_0xe56c('0x5e')][_0xe56c('0x68')]||_0x138e8c[_0xe56c('0x69')]['id'];_0x4218a3[_0xe56c('0x6a')]['id']=_0x138e8c[_0xe56c('0x5e')][_0xe56c('0x68')];return db['WhatsappMessage'][_0xe56c('0x5c')]({'where':{'id':_0x138e8c[_0xe56c('0x57')]['id'],'UserId':null}})[_0xe56c('0x22')](handleEntityNotFound(_0x5c5156,null))['then'](function(_0x253290){if(_0x253290){_0x4218a3[_0xe56c('0x2b')]=_0x253290[_0xe56c('0x6b')]({'plain':!![]});return db['WhatsappInteraction'][_0xe56c('0x5c')]({'where':{'id':_0x253290[_0xe56c('0x6d')]}});}return null;})[_0xe56c('0x22')](handleEntityNotFound(_0x5c5156,null))[_0xe56c('0x22')](function(_0x2d4a47){if(_0x2d4a47){_0x4218a3['interaction']=_0x2d4a47[_0xe56c('0x6b')]({'plain':!![]});interaction_log[_0xe56c('0x23')](_0xe56c('0x83'),_0x138e8c['user']['id'],_0x138e8c[_0xe56c('0x69')][_0xe56c('0x3c')],_0x138e8c[_0xe56c('0x69')][_0xe56c('0x71')],_0x4218a3[_0xe56c('0x72')]['id'],_0x138e8c[_0xe56c('0x5e')]?JSON[_0xe56c('0x28')](_0x138e8c[_0xe56c('0x5e')]):_0xe56c('0x73'));return respondWithRpcPromise(_0xe56c('0x84'),_0xe56c('0x85'),_0x4218a3);}return null;})[_0xe56c('0x22')](function(_0x5ae5cf){var _0x5e3e5e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ae5cf[_0xe56c('0x2b')]['ContactId'];return db[_0xe56c('0x86')][_0xe56c('0x46')](_0x5e3e5e,{'type':db[_0xe56c('0x77')][_0xe56c('0x78')][_0xe56c('0x87')],'raw':!![]})[_0xe56c('0x22')](function(_0xd52589){return _0xd52589;});})[_0xe56c('0x22')](function(_0x27ab3f){if(_0x27ab3f){_0x4218a3[_0xe56c('0x2b')][_0xe56c('0x79')]=_0x27ab3f[0x0];if(!_0x138e8c[_0xe56c('0x5e')][_0xe56c('0x68')])return;return db[_0xe56c('0x7a')][_0xe56c('0x5c')]({'where':{'id':_0x138e8c[_0xe56c('0x5e')][_0xe56c('0x68')],'role':_0xe56c('0x6a')},'attributes':['id',_0xe56c('0x3c'),_0xe56c('0x7b'),'email',_0xe56c('0x7c')],'raw':!![]});}return null;})[_0xe56c('0x22')](function(_0x555b5c){if(!_0x555b5c)return null;_0x4218a3[_0xe56c('0x2b')]['agent']=_0x555b5c;return _0x4218a3;})['then'](function(_0x557105){if(_0x557105){_0x557105[_0xe56c('0x2b')]['interface']=util['format'](_0xe56c('0x7d'),_0x138e8c['user'][_0xe56c('0x3c')]);_0x557105[_0xe56c('0x2b')]['channel']=_0x4218a3[_0xe56c('0x7e')];_0x557105[_0xe56c('0x2b')][_0xe56c('0x88')]=_0x4218a3[_0xe56c('0x7e')];_0x557105[_0xe56c('0x2b')][_0xe56c('0x7f')]='reject';respondWithRpcPromise(_0xe56c('0x80'),_0xe56c('0x80'),{'event':'rejectmessage','message':_0x557105['message']},client9002);return _0x4218a3;}return null;})[_0xe56c('0x22')](respondWithResult(_0x5c5156,null))[_0xe56c('0x2d')](handleError(_0x5c5156,null));};exports['status']=function(_0x5420de,_0x1f5ae7,_0x1a7207){if(_0x5420de[_0xe56c('0x5e')]['id']){delete _0x5420de['body']['id'];}var _0x4df2b6;return db[_0xe56c('0x40')][_0xe56c('0x5c')]({'where':{'id':_0x5420de[_0xe56c('0x57')]['id']}})[_0xe56c('0x22')](handleEntityNotFound(_0x1f5ae7,null))[_0xe56c('0x22')](function(_0x3511a2){if(_0x3511a2){_0x4df2b6=_0x3511a2;return db[_0xe56c('0x89')]['find']({'where':{'id':_0x3511a2[_0xe56c('0x8a')]}});}})[_0xe56c('0x22')](handleEntityNotFound(_0x1f5ae7,null))[_0xe56c('0x22')](function(_0x5c37d0){if(_0x5c37d0){logger[_0xe56c('0x26')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xe56c('0x2e'),'received\x20delivery\x20report\x20from',_0x5c37d0[_0xe56c('0x42')],util['inspect'](_0x5420de[_0xe56c('0x5e')],{'showHidden':![],'depth':null}));switch(_0x5c37d0[_0xe56c('0x42')]){case _0xe56c('0x8b'):if(_0x5420de['body'][_0xe56c('0x8c')]&&_0x5420de[_0xe56c('0x5e')][_0xe56c('0x8c')]===_0x4df2b6[_0xe56c('0x8d')]&&_0x5420de[_0xe56c('0x5e')][_0xe56c('0x8e')]&&_0x5420de['body'][_0xe56c('0x8e')]===_0xe56c('0x64')){return _0x4df2b6[_0xe56c('0x39')]({'read':!![]});}else{logger[_0xe56c('0x29')](_0xe56c('0x8f'),_0xe56c('0x2e'),_0xe56c('0x8b'),util[_0xe56c('0x90')](_0x5420de['body'],{'showHidden':![],'depth':null}));}break;}return _0x4df2b6;}})[_0xe56c('0x22')](respondWithResult(_0x1f5ae7,null))[_0xe56c('0x2d')](handleError(_0x1f5ae7,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9b95681..ba26945 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 _0x2f3a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x2efcec,_0x5576ea){var _0x58d887=function(_0x3f591e){while(--_0x3f591e){_0x2efcec['push'](_0x2efcec['shift']());}};_0x58d887(++_0x5576ea);}(_0x2f3a,0xfb));var _0xa2f3=function(_0xf3d909,_0xb9e263){_0xf3d909=_0xf3d909-0x0;var _0x24bab6=_0x2f3a[_0xf3d909];return _0x24bab6;};'use strict';var EventEmitter=require(_0xa2f3('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xa2f3('0x1')](0x0);var events={'afterCreate':_0xa2f3('0x2'),'afterUpdate':_0xa2f3('0x3'),'afterDestroy':_0xa2f3('0x4')};function emitEvent(_0x17ec7a){return function(_0xdf4c17,_0x50ef95,_0x78edcd){WhatsappMessageEvents['emit'](_0x17ec7a+':'+_0xdf4c17['id'],_0xdf4c17);WhatsappMessageEvents[_0xa2f3('0x5')](_0x17ec7a,_0xdf4c17);_0x78edcd(null);};}for(var e in events){if(events[_0xa2f3('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x23a3=['update','remove','emit','hasOwnProperty','exports','setMaxListeners'];(function(_0x397bf7,_0x4b2dde){var _0x7c35c0=function(_0x27e271){while(--_0x27e271){_0x397bf7['push'](_0x397bf7['shift']());}};_0x7c35c0(++_0x4b2dde);}(_0x23a3,0x131));var _0x323a=function(_0x1c3d32,_0x5a22b6){_0x1c3d32=_0x1c3d32-0x0;var _0x16aa78=_0x23a3[_0x1c3d32];return _0x16aa78;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x323a('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x323a('0x1'),'afterDestroy':_0x323a('0x2')};function emitEvent(_0x122b97){return function(_0x250485,_0x46030e,_0x180066){WhatsappMessageEvents[_0x323a('0x3')](_0x122b97+':'+_0x250485['id'],_0x250485);WhatsappMessageEvents[_0x323a('0x3')](_0x122b97,_0x250485);_0x180066(null);};}for(var e in events){if(events[_0x323a('0x4')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x323a('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 272c129..ba8733d 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 _0xdc50=['type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId'];(function(_0x18415f,_0x5ed38b){var _0x46c4a9=function(_0x59a436){while(--_0x59a436){_0x18415f['push'](_0x18415f['shift']());}};_0x46c4a9(++_0x5ed38b);}(_0xdc50,0x147));var _0x0dc5=function(_0x219e0c,_0x3db172){_0x219e0c=_0x219e0c-0x0;var _0x539ae3=_0xdc50[_0x219e0c];return _0x539ae3;};'use strict';var _=require(_0x0dc5('0x0'));var util=require('util');var logger=require(_0x0dc5('0x1'))(_0x0dc5('0x2'));var moment=require(_0x0dc5('0x3'));var BPromise=require(_0x0dc5('0x4'));var rp=require(_0x0dc5('0x5'));var fetch=require(_0x0dc5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dc5('0x7'));var config=require('../../config/environment');var attributes=require(_0x0dc5('0x8'));module[_0x0dc5('0x9')]=function(_0xa625b8,_0x4e0afc){return _0xa625b8[_0x0dc5('0xa')](_0x0dc5('0xb'),attributes,{'tableName':_0x0dc5('0xc'),'paranoid':![],'indexes':[{'name':_0x0dc5('0xd'),'fields':['messageId']},{'name':_0x0dc5('0xe'),'fields':[_0x0dc5('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fc0a2,_0x1f7a59,_0x15bbaf){var _0x522517=_0xa625b8[_0x0dc5('0x10')];var _0x476cef=_0x3fc0a2[_0x0dc5('0x11')]({'plain':!![]});if(_0x476cef[_0x0dc5('0x12')][_0x0dc5('0x13')]()==='in'||_0x476cef[_0x0dc5('0x12')][_0x0dc5('0x13')]()===_0x0dc5('0x14')&&!_0x476cef[_0x0dc5('0x15')]&&!_[_0x0dc5('0x16')](_0x476cef['UserId'])){_0x522517['WhatsappInteraction'][_0x0dc5('0x17')]({'where':{'id':_0x476cef[_0x0dc5('0x18')]}})[_0x0dc5('0x19')](function(_0x375053){if(_0x375053){_0x375053[_0x0dc5('0x1a')]({'lastMsgAt':_0x476cef[_0x0dc5('0x1b')],'lastMsgDirection':_0x476cef[_0x0dc5('0x12')][_0x0dc5('0x13')]()});}})[_0x0dc5('0x1c')](function(_0x51e886){console[_0x0dc5('0x1d')](_0x51e886);});}if(_0x476cef[_0x0dc5('0x12')]===_0x0dc5('0x14')&&!_0x476cef[_0x0dc5('0x15')]){var _0x33fc17;_0x522517[_0x0dc5('0x1e')][_0x0dc5('0x1f')]({'where':{'id':_0x476cef[_0x0dc5('0x20')]},'raw':!![]})[_0x0dc5('0x19')](function(_0x35b6d8){_0x33fc17=_0x35b6d8;if(_0x33fc17&&_0x33fc17['type']){switch(_0x33fc17[_0x0dc5('0x21')]){case _0x0dc5('0x22'):var _0xe861ff=require('twilio');if(_0x33fc17[_0x0dc5('0x23')]&&_0x33fc17[_0x0dc5('0x24')]&&_0x33fc17['phone']){var _0x52a3=new _0xe861ff(_0x33fc17['accountSid'],_0x33fc17['authToken']);_0x52a3[_0x0dc5('0x25')][_0x0dc5('0x26')]({'body':_0x476cef[_0x0dc5('0xf')],'to':_0x0dc5('0x27')+_0x476cef[_0x0dc5('0x28')],'from':_0x0dc5('0x27')+_0x33fc17['phone'],'statusCallback':_0x33fc17[_0x0dc5('0x29')]+_0x0dc5('0x2a')+_0x476cef['id']+_0x0dc5('0x2b')+_0x33fc17['token']})[_0x0dc5('0x19')](function(_0x180bd7){if(_0x180bd7[_0x0dc5('0x2c')]){return _0x3fc0a2[_0x0dc5('0x1a')]({'messageId':_0x180bd7[_0x0dc5('0x2c')]});}})[_0x0dc5('0x1c')](function(_0x3db8e2){logger[_0x0dc5('0x1d')](_0x0dc5('0x2d'),_0x0dc5('0x2e'),_0x0dc5('0x22'),util['inspect'](_0x3db8e2,{'showHidden':![],'depth':null}));});}else{logger[_0x0dc5('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0dc5('0x2e'),_0x0dc5('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x0dc5('0x2f'):var _0x55f72d=_0x33fc17[_0x0dc5('0x23')];var _0x2be089=_0x33fc17[_0x0dc5('0x24')];var _0x4552dd=_0x33fc17[_0x0dc5('0x30')]+_0x0dc5('0x31')+_0x55f72d+_0x0dc5('0x32');var _0x2643b9={'to':[_0x476cef[_0x0dc5('0x28')]],'message':{'type':_0x0dc5('0x33'),'text':_0x476cef[_0x0dc5('0xf')]}};var _0xe74865={'method':_0x0dc5('0x34'),'uri':_0x4552dd,'headers':{'Authorization':_0x0dc5('0x35')+_0x2be089,'Content-Type':_0x0dc5('0x36')},'body':_0x2643b9,'json':!![]};rp(_0xe74865)[_0x0dc5('0x19')](function(_0x18d40a){if(_0x18d40a['statuses'][0x0][_0x0dc5('0x37')]){return _0x3fc0a2[_0x0dc5('0x1a')]({'messageId':_0x18d40a[_0x0dc5('0x38')][0x0][_0x0dc5('0x37')]});}})[_0x0dc5('0x1c')](function(_0x546047){logger['err'](_0x0dc5('0x39'),_0x546047);});break;}}})['finally'](function(){_0x15bbaf();});}else{_0x15bbaf();}}},'charset':_0x0dc5('0x3a'),'collate':_0x0dc5('0x3b')});}; \ No newline at end of file +var _0x5e47=['/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','phone','accountSid','authToken','messages','create','body','whatsapp:','remote'];(function(_0x509a20,_0x20b47c){var _0x140dcb=function(_0x4d9ddc){while(--_0x4d9ddc){_0x509a20['push'](_0x509a20['shift']());}};_0x140dcb(++_0x20b47c);}(_0x5e47,0x184));var _0x75e4=function(_0x2cde51,_0x41b85c){_0x2cde51=_0x2cde51-0x0;var _0x37177e=_0x5e47[_0x2cde51];return _0x37177e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x75e4('0x0'))('api');var moment=require(_0x75e4('0x1'));var BPromise=require(_0x75e4('0x2'));var rp=require(_0x75e4('0x3'));var fetch=require(_0x75e4('0x4'));var fs=require('fs');var path=require(_0x75e4('0x5'));var rimraf=require(_0x75e4('0x6'));var config=require(_0x75e4('0x7'));var attributes=require(_0x75e4('0x8'));module[_0x75e4('0x9')]=function(_0x98015f,_0x235054){return _0x98015f[_0x75e4('0xa')](_0x75e4('0xb'),attributes,{'tableName':_0x75e4('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_whatsapp_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10b1b0,_0x1503ed,_0x5b770a){var _0x426a73=_0x98015f[_0x75e4('0xd')];var _0x184dd6=_0x10b1b0['get']({'plain':!![]});if(_0x184dd6[_0x75e4('0xe')][_0x75e4('0xf')]()==='in'||_0x184dd6['direction'][_0x75e4('0xf')]()===_0x75e4('0x10')&&!_0x184dd6[_0x75e4('0x11')]&&!_[_0x75e4('0x12')](_0x184dd6[_0x75e4('0x13')])){_0x426a73['WhatsappInteraction'][_0x75e4('0x14')]({'where':{'id':_0x184dd6[_0x75e4('0x15')]}})[_0x75e4('0x16')](function(_0xe06148){if(_0xe06148){_0xe06148['update']({'lastMsgAt':_0x184dd6[_0x75e4('0x17')],'lastMsgDirection':_0x184dd6[_0x75e4('0xe')][_0x75e4('0xf')]()});}})[_0x75e4('0x18')](function(_0x1a781e){console[_0x75e4('0x19')](_0x1a781e);});}if(_0x184dd6[_0x75e4('0xe')]==='out'&&!_0x184dd6[_0x75e4('0x11')]){var _0x483c0e;_0x426a73[_0x75e4('0x1a')][_0x75e4('0x1b')]({'where':{'id':_0x184dd6[_0x75e4('0x1c')]},'raw':!![]})['then'](function(_0x57c9a8){_0x483c0e=_0x57c9a8;if(_0x483c0e&&_0x483c0e[_0x75e4('0x1d')]){switch(_0x483c0e[_0x75e4('0x1d')]){case _0x75e4('0x1e'):var _0x3cd5f1=require(_0x75e4('0x1e'));if(_0x483c0e['accountSid']&&_0x483c0e['authToken']&&_0x483c0e[_0x75e4('0x1f')]){var _0x342a2c=new _0x3cd5f1(_0x483c0e[_0x75e4('0x20')],_0x483c0e[_0x75e4('0x21')]);_0x342a2c[_0x75e4('0x22')][_0x75e4('0x23')]({'body':_0x184dd6[_0x75e4('0x24')],'to':_0x75e4('0x25')+_0x184dd6[_0x75e4('0x1f')],'from':_0x75e4('0x25')+_0x483c0e['phone'],'statusCallback':_0x483c0e[_0x75e4('0x26')]+_0x75e4('0x27')+_0x184dd6['id']+_0x75e4('0x28')+_0x483c0e[_0x75e4('0x29')]})[_0x75e4('0x16')](function(_0x17548b){if(_0x17548b[_0x75e4('0x2a')]){return _0x10b1b0[_0x75e4('0x2b')]({'messageId':_0x17548b[_0x75e4('0x2a')]});}})['catch'](function(_0x19fe41){logger[_0x75e4('0x19')](_0x75e4('0x2c'),'afterCreate',_0x75e4('0x1e'),util[_0x75e4('0x2d')](_0x19fe41,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x75e4('0x2c'),_0x75e4('0x2e'),_0x75e4('0x1e'),_0x75e4('0x2f'));}break;case _0x75e4('0x30'):var _0x5ddd14=_0x483c0e[_0x75e4('0x20')];var _0x2b512e=_0x483c0e['authToken'];var _0x104dbb=_0x483c0e[_0x75e4('0x31')]+_0x75e4('0x32')+_0x5ddd14+_0x75e4('0x33');var _0x143645={'to':[_0x184dd6[_0x75e4('0x1f')]],'message':{'type':_0x75e4('0x34'),'text':_0x184dd6[_0x75e4('0x24')]}};var _0x248151={'method':_0x75e4('0x35'),'uri':_0x104dbb,'headers':{'Authorization':'Bearer\x20'+_0x2b512e,'Content-Type':_0x75e4('0x36')},'body':_0x143645,'json':!![]};rp(_0x248151)[_0x75e4('0x16')](function(_0x18a733){if(_0x18a733[_0x75e4('0x37')][0x0][_0x75e4('0x38')]){return _0x10b1b0[_0x75e4('0x2b')]({'messageId':_0x18a733[_0x75e4('0x37')][0x0][_0x75e4('0x38')]});}})[_0x75e4('0x18')](function(_0x377213){logger[_0x75e4('0x39')](_0x75e4('0x3a'),_0x377213);});break;}}})['finally'](function(){_0x5b770a();});}else{_0x5b770a();}}},'charset':_0x75e4('0x3b'),'collate':_0x75e4('0x3c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 8fa5070..d63aa31 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 _0x2044=['socket.io-emitter','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost'];(function(_0x372784,_0x56f443){var _0x2f6c06=function(_0x2e94ab){while(--_0x2e94ab){_0x372784['push'](_0x372784['shift']());}};_0x2f6c06(++_0x56f443);}(_0x2044,0x1a2));var _0x4204=function(_0x3fbebf,_0x496648){_0x3fbebf=_0x3fbebf-0x0;var _0x105cf7=_0x2044[_0x3fbebf];return _0x105cf7;};'use strict';var _=require(_0x4204('0x0'));var util=require(_0x4204('0x1'));var moment=require('moment');var BPromise=require(_0x4204('0x2'));var rs=require(_0x4204('0x3'));var fs=require('fs');var Redis=require(_0x4204('0x4'));var db=require(_0x4204('0x5'))['db'];var utils=require(_0x4204('0x6'));var logger=require(_0x4204('0x7'))(_0x4204('0x8'));var config=require(_0x4204('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4204('0xa')][_0x4204('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4204('0xc')],{'host':_0x4204('0xd'),'port':0x18eb});var socket=require(_0x4204('0xe'))(new Redis(config[_0x4204('0xc')]));require(_0x4204('0xf'))[_0x4204('0x10')](socket);function respondWithRpcPromise(_0x27542f,_0x9472c3,_0x5b25dd){return new BPromise(function(_0x2ce38e,_0x1628b4){return client[_0x4204('0x11')](_0x27542f,_0x5b25dd)['then'](function(_0x5ea0e9){logger['info'](_0x4204('0x12'),_0x9472c3,'request\x20sent');logger[_0x4204('0x13')](_0x4204('0x14'),_0x9472c3,_0x4204('0x15'),JSON[_0x4204('0x16')](_0x5ea0e9));if(_0x5ea0e9[_0x4204('0x17')]){if(_0x5ea0e9[_0x4204('0x17')][_0x4204('0x18')]===0x1f4){logger['error'](_0x4204('0x12'),_0x9472c3,_0x5ea0e9['error'][_0x4204('0x19')]);return _0x1628b4(_0x5ea0e9['error'][_0x4204('0x19')]);}logger[_0x4204('0x17')](_0x4204('0x12'),_0x9472c3,_0x5ea0e9['error'][_0x4204('0x19')]);return _0x2ce38e(_0x5ea0e9[_0x4204('0x17')][_0x4204('0x19')]);}else{logger[_0x4204('0x1a')](_0x4204('0x12'),_0x9472c3,_0x4204('0x15'));_0x2ce38e(_0x5ea0e9[_0x4204('0x1b')][_0x4204('0x19')]);}})[_0x4204('0x1c')](function(_0xc7f446){logger[_0x4204('0x17')](_0x4204('0x12'),_0x9472c3,_0xc7f446);_0x1628b4(_0xc7f446);});});}exports[_0x4204('0x1d')]=function(_0x5e211d){var _0x10e0d3=this;return new Promise(function(_0x3a35a5,_0x141e6a){return db[_0x4204('0x1e')][_0x4204('0x1f')](_0x5e211d[_0x4204('0x20')],{'raw':_0x5e211d[_0x4204('0x21')]?_0x5e211d[_0x4204('0x21')][_0x4204('0x22')]===undefined?!![]:![]:!![]})[_0x4204('0x23')](function(_0x45ebee){logger[_0x4204('0x1a')]('CreateWhatsappMessage',_0x5e211d);logger[_0x4204('0x13')]('CreateWhatsappMessage',_0x5e211d,JSON[_0x4204('0x16')](_0x45ebee));_0x3a35a5(_0x45ebee);})['catch'](function(_0x4b1318){logger['error'](_0x4204('0x1d'),_0x4b1318['message'],_0x5e211d);_0x141e6a(_0x10e0d3[_0x4204('0x17')](0x1f4,_0x4b1318[_0x4204('0x19')]));});});}; \ No newline at end of file +var _0xae1d=['catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x22fe70,_0x6e1a47){var _0x93d0b4=function(_0x413e0f){while(--_0x413e0f){_0x22fe70['push'](_0x22fe70['shift']());}};_0x93d0b4(++_0x6e1a47);}(_0xae1d,0x9b));var _0xdae1=function(_0x32355d,_0xa6b12e){_0x32355d=_0x32355d-0x0;var _0x995a4f=_0xae1d[_0x32355d];return _0x995a4f;};'use strict';var _=require(_0xdae1('0x0'));var util=require(_0xdae1('0x1'));var moment=require(_0xdae1('0x2'));var BPromise=require(_0xdae1('0x3'));var rs=require(_0xdae1('0x4'));var fs=require('fs');var Redis=require(_0xdae1('0x5'));var db=require(_0xdae1('0x6'))['db'];var utils=require(_0xdae1('0x7'));var logger=require(_0xdae1('0x8'))(_0xdae1('0x9'));var config=require(_0xdae1('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdae1('0xb')]({'port':0x232a});config[_0xdae1('0xc')]=_['defaults'](config[_0xdae1('0xc')],{'host':_0xdae1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdae1('0xc')]));require(_0xdae1('0xe'))[_0xdae1('0xf')](socket);function respondWithRpcPromise(_0x120ea2,_0xf91d6a,_0xa7f38c){return new BPromise(function(_0x12a5e0,_0x6b2775){return client[_0xdae1('0x10')](_0x120ea2,_0xa7f38c)[_0xdae1('0x11')](function(_0x4d1edd){logger['info'](_0xdae1('0x12'),_0xf91d6a,_0xdae1('0x13'));logger[_0xdae1('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xf91d6a,_0xdae1('0x13'),JSON[_0xdae1('0x15')](_0x4d1edd));if(_0x4d1edd[_0xdae1('0x16')]){if(_0x4d1edd['error']['code']===0x1f4){logger[_0xdae1('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0xf91d6a,_0x4d1edd[_0xdae1('0x16')][_0xdae1('0x17')]);return _0x6b2775(_0x4d1edd[_0xdae1('0x16')][_0xdae1('0x17')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xf91d6a,_0x4d1edd['error']['message']);return _0x12a5e0(_0x4d1edd[_0xdae1('0x16')][_0xdae1('0x17')]);}else{logger[_0xdae1('0x18')](_0xdae1('0x12'),_0xf91d6a,_0xdae1('0x13'));_0x12a5e0(_0x4d1edd['result'][_0xdae1('0x17')]);}})[_0xdae1('0x19')](function(_0x54ff79){logger[_0xdae1('0x16')](_0xdae1('0x12'),_0xf91d6a,_0x54ff79);_0x6b2775(_0x54ff79);});});}exports[_0xdae1('0x1a')]=function(_0x194a7e){var _0x2cf334=this;return new Promise(function(_0x26f64c,_0x4e7f67){return db[_0xdae1('0x1b')][_0xdae1('0x1c')](_0x194a7e['body'],{'raw':_0x194a7e['options']?_0x194a7e[_0xdae1('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xdae1('0x11')](function(_0x86c908){logger['info'](_0xdae1('0x1a'),_0x194a7e);logger[_0xdae1('0x14')](_0xdae1('0x1a'),_0x194a7e,JSON['stringify'](_0x86c908));_0x26f64c(_0x86c908);})[_0xdae1('0x19')](function(_0x5e78d6){logger[_0xdae1('0x16')](_0xdae1('0x1a'),_0x5e78d6[_0xdae1('0x17')],_0x194a7e);_0x4e7f67(_0x2cf334[_0xdae1('0x16')](0x1f4,_0x5e78d6[_0xdae1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 2a2d779..c79635a 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 _0x4bd9=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x392cdf,_0x4adb91){var _0x5430f7=function(_0x53a517){while(--_0x53a517){_0x392cdf['push'](_0x392cdf['shift']());}};_0x5430f7(++_0x4adb91);}(_0x4bd9,0x1bb));var _0x94bd=function(_0x334280,_0x3cd906){_0x334280=_0x334280-0x0;var _0x23d539=_0x4bd9[_0x334280];return _0x23d539;};'use strict';var WhatsappMessageEvents=require(_0x94bd('0x0'));var events=[_0x94bd('0x1'),_0x94bd('0x2'),_0x94bd('0x3')];function createListener(_0x4ac2f0,_0x1ae383){return function(_0x1be82e){_0x1ae383[_0x94bd('0x4')](_0x4ac2f0,_0x1be82e);};}function removeListener(_0x3b7364,_0x439c14){return function(){WhatsappMessageEvents['removeListener'](_0x3b7364,_0x439c14);};}exports['register']=function(_0x2dafdf){for(var _0x522403=0x0,_0x14bd90=events[_0x94bd('0x5')];_0x522403<_0x14bd90;_0x522403++){var _0x361e02=events[_0x522403];var _0x239c5c=createListener(_0x94bd('0x6')+_0x361e02,_0x2dafdf);WhatsappMessageEvents['on'](_0x361e02,_0x239c5c);}}; \ No newline at end of file +var _0xc1fc=['length','./whatsappMessage.events','remove','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc1fc,0xaf));var _0xcc1f=function(_0x174091,_0x194dcb){_0x174091=_0x174091-0x0;var _0x1df461=_0xc1fc[_0x174091];return _0x1df461;};'use strict';var WhatsappMessageEvents=require(_0xcc1f('0x0'));var events=['save',_0xcc1f('0x1'),'update'];function createListener(_0x47fe3c,_0x51cfa2){return function(_0x3f20fe){_0x51cfa2[_0xcc1f('0x2')](_0x47fe3c,_0x3f20fe);};}function removeListener(_0x5780c8,_0x439f34){return function(){WhatsappMessageEvents[_0xcc1f('0x3')](_0x5780c8,_0x439f34);};}exports[_0xcc1f('0x4')]=function(_0x44f425){for(var _0x3acac4=0x0,_0x24f947=events[_0xcc1f('0x5')];_0x3acac4<_0x24f947;_0x3acac4++){var _0x14a3de=events[_0x3acac4];var _0x54c85b=createListener('whatsappMessage:'+_0x14a3de,_0x44f425);WhatsappMessageEvents['on'](_0x14a3de,_0x54c85b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 15199cc..791d9b2 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 _0x6616=['delete','destroy','removeTeams','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users','post','create','addTeams','addAgents','put'];(function(_0x1fc36f,_0x464552){var _0x2856b4=function(_0x2487f3){while(--_0x2487f3){_0x1fc36f['push'](_0x1fc36f['shift']());}};_0x2856b4(++_0x464552);}(_0x6616,0x12c));var _0x6661=function(_0x109625,_0x55ace8){_0x109625=_0x109625-0x0;var _0x259988=_0x6616[_0x109625];return _0x259988;};'use strict';var multer=require(_0x6661('0x0'));var util=require('util');var path=require(_0x6661('0x1'));var timeout=require(_0x6661('0x2'));var express=require('express');var router=express[_0x6661('0x3')]();var fs_extra=require(_0x6661('0x4'));var auth=require(_0x6661('0x5'));var interaction=require(_0x6661('0x6'));var config=require(_0x6661('0x7'));var controller=require(_0x6661('0x8'));router[_0x6661('0x9')]('/',auth[_0x6661('0xa')](),controller[_0x6661('0xb')]);router[_0x6661('0x9')](_0x6661('0xc'),auth[_0x6661('0xa')](),controller[_0x6661('0xd')]);router['get'](_0x6661('0xe'),auth[_0x6661('0xa')](),controller[_0x6661('0xf')]);router[_0x6661('0x9')](_0x6661('0x10'),auth[_0x6661('0xa')](),controller['getMembers']);router[_0x6661('0x9')](_0x6661('0x11'),auth[_0x6661('0xa')](),controller['getTeams']);router['get'](_0x6661('0x12'),auth[_0x6661('0xa')](),controller['getAgents']);router[_0x6661('0x13')]('/',auth['isAuthenticated'](),controller[_0x6661('0x14')]);router[_0x6661('0x13')]('/:id/teams',auth[_0x6661('0xa')](),controller[_0x6661('0x15')]);router[_0x6661('0x13')](_0x6661('0x12'),auth['isAuthenticated'](),controller[_0x6661('0x16')]);router[_0x6661('0x17')](_0x6661('0xe'),auth[_0x6661('0xa')](),controller['update']);router[_0x6661('0x18')](_0x6661('0xe'),auth[_0x6661('0xa')](),controller[_0x6661('0x19')]);router['delete'](_0x6661('0x11'),auth[_0x6661('0xa')](),controller[_0x6661('0x1a')]);router[_0x6661('0x18')]('/:id/users',auth[_0x6661('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x6f92=['put','update','delete','destroy','removeAgents','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','/describe','isAuthenticated','describe','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addAgents'];(function(_0x33f665,_0x5a7540){var _0x3488fa=function(_0x2bdefa){while(--_0x2bdefa){_0x33f665['push'](_0x33f665['shift']());}};_0x3488fa(++_0x5a7540);}(_0x6f92,0xca));var _0x26f9=function(_0x562256,_0x1f02ce){_0x562256=_0x562256-0x0;var _0x4144e5=_0x6f92[_0x562256];return _0x4144e5;};'use strict';var multer=require('multer');var util=require(_0x26f9('0x0'));var path=require(_0x26f9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x26f9('0x2')]();var fs_extra=require(_0x26f9('0x3'));var auth=require(_0x26f9('0x4'));var interaction=require(_0x26f9('0x5'));var config=require(_0x26f9('0x6'));var controller=require(_0x26f9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x26f9('0x8'),auth[_0x26f9('0x9')](),controller[_0x26f9('0xa')]);router['get'](_0x26f9('0xb'),auth[_0x26f9('0x9')](),controller[_0x26f9('0xc')]);router[_0x26f9('0xd')](_0x26f9('0xe'),auth['isAuthenticated'](),controller[_0x26f9('0xf')]);router['get'](_0x26f9('0x10'),auth['isAuthenticated'](),controller[_0x26f9('0x11')]);router['get'](_0x26f9('0x12'),auth[_0x26f9('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x26f9('0x13')]);router['post'](_0x26f9('0x10'),auth[_0x26f9('0x9')](),controller['addTeams']);router[_0x26f9('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x26f9('0x15')]);router[_0x26f9('0x16')](_0x26f9('0xb'),auth[_0x26f9('0x9')](),controller[_0x26f9('0x17')]);router[_0x26f9('0x18')](_0x26f9('0xb'),auth[_0x26f9('0x9')](),controller[_0x26f9('0x19')]);router['delete'](_0x26f9('0x10'),auth[_0x26f9('0x9')](),controller['removeTeams']);router['delete'](_0x26f9('0x12'),auth['isAuthenticated'](),controller[_0x26f9('0x1a')]);module[_0x26f9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2e9cbe3..1f7a8a4 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 _0x4058=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xcd4f92,_0xc9b291){var _0x497778=function(_0x16fba0){while(--_0x16fba0){_0xcd4f92['push'](_0xcd4f92['shift']());}};_0x497778(++_0xc9b291);}(_0x4058,0x129));var _0x8405=function(_0x1fcb67,_0x4f187b){_0x1fcb67=_0x1fcb67-0x0;var _0xa1bca7=_0x4058[_0x1fcb67];return _0xa1bca7;};'use strict';var Sequelize=require(_0x8405('0x0'));module[_0x8405('0x1')]={'name':{'type':Sequelize[_0x8405('0x2')],'unique':_0x8405('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8405('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8405('0x5')](_0x8405('0x6'),_0x8405('0x7'),_0x8405('0x8'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ffd=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x401b1b,_0x16b4f8){_0x401b1b=_0x401b1b-0x0;var _0x34f5a2=_0x9ffd[_0x401b1b];return _0x34f5a2;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'unique':_0xd9ff('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd9ff('0x4')](_0xd9ff('0x5'),_0xd9ff('0x6'),_0xd9ff('0x7'))},'description':{'type':Sequelize[_0xd9ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 439052c..7fb6627 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 _0x43f7=['filter','where','merge','options','includeAll','include','rows','catch','show','params','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','WhatsappQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','SIP','findOne','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','sequelize','each','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','select','field','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','removeTeams','isEmpty','addAgents','omit','spread','removeAgents','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x394581,_0xfb87b){var _0x4d3757=function(_0x5d562f){while(--_0x5d562f){_0x394581['push'](_0x394581['shift']());}};_0x4d3757(++_0xfb87b);}(_0x43f7,0xd1));var _0x743f=function(_0x4b2cae,_0x587c96){_0x4b2cae=_0x4b2cae-0x0;var _0x2bb54e=_0x43f7[_0x4b2cae];return _0x2bb54e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x743f('0x0'));var zipdir=require(_0x743f('0x1'));var jsonpatch=require(_0x743f('0x2'));var rp=require('request-promise');var moment=require(_0x743f('0x3'));var BPromise=require(_0x743f('0x4'));var Mustache=require(_0x743f('0x5'));var util=require('util');var path=require(_0x743f('0x6'));var sox=require(_0x743f('0x7'));var csv=require('to-csv');var ejs=require(_0x743f('0x8'));var fs=require('fs');var fs_extra=require(_0x743f('0x9'));var _=require(_0x743f('0xa'));var squel=require(_0x743f('0xb'));var crypto=require(_0x743f('0xc'));var jsforce=require(_0x743f('0xd'));var deskjs=require(_0x743f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x743f('0xf'));var qs=require(_0x743f('0x10'));var as=require(_0x743f('0x11'));var hardwareService=require(_0x743f('0x12'));var logger=require(_0x743f('0x13'))(_0x743f('0x14'));var utils=require(_0x743f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x743f('0x16'));var db=require(_0x743f('0x17'))['db'];config[_0x743f('0x18')]=_[_0x743f('0x19')](config[_0x743f('0x18')],{'host':_0x743f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x743f('0x1b'))[_0x743f('0x1c')](socket);function respondWithStatusCode(_0x5e471e,_0x182cab){_0x182cab=_0x182cab||0xcc;return function(_0x545b65){if(_0x545b65){return _0x5e471e[_0x743f('0x1d')](_0x182cab);}return _0x5e471e[_0x743f('0x1e')](_0x182cab)[_0x743f('0x1f')]();};}function respondWithResult(_0x44e14e,_0x23a475){_0x23a475=_0x23a475||0xc8;return function(_0x16b692){if(_0x16b692){return _0x44e14e[_0x743f('0x1e')](_0x23a475)[_0x743f('0x20')](_0x16b692);}};}function respondWithFilteredResult(_0x37e70c,_0x45aa1b){return function(_0x1ed918){if(_0x1ed918){var _0x5f0b53=typeof _0x45aa1b['offset']===_0x743f('0x21')&&typeof _0x45aa1b['limit']===_0x743f('0x21');var _0x135bd3=_0x1ed918['count'];var _0x2538de=_0x5f0b53?0x0:_0x45aa1b['offset'];var _0x1d8b4d=_0x5f0b53?_0x1ed918[_0x743f('0x22')]:_0x45aa1b[_0x743f('0x23')]+_0x45aa1b[_0x743f('0x24')];var _0x4b9a69;if(_0x1d8b4d>=_0x135bd3){_0x1d8b4d=_0x135bd3;_0x4b9a69=0xc8;}else{_0x4b9a69=0xce;}_0x37e70c[_0x743f('0x1e')](_0x4b9a69);return _0x37e70c[_0x743f('0x25')]('Content-Range',_0x2538de+'-'+_0x1d8b4d+'/'+_0x135bd3)[_0x743f('0x20')](_0x1ed918);}return null;};}function patchUpdates(_0x246b0d){return function(_0x5d89d1){try{jsonpatch['apply'](_0x5d89d1,_0x246b0d,!![]);}catch(_0x43eede){return BPromise['reject'](_0x43eede);}return _0x5d89d1[_0x743f('0x26')]();};}function saveUpdates(_0x302107,_0x3be21c){return function(_0x3c7801){if(_0x3c7801){return _0x3c7801[_0x743f('0x27')](_0x302107)[_0x743f('0x28')](function(_0x40b379){return _0x40b379;});}return null;};}function removeEntity(_0x39ddcb,_0x1aed80){return function(_0x4793b7){if(_0x4793b7){return _0x4793b7[_0x743f('0x29')]()[_0x743f('0x28')](function(){var _0x48542a=_0x4793b7[_0x743f('0x2a')]({'plain':!![]});var _0x56a878=_0x743f('0x2b');return db[_0x743f('0x2c')][_0x743f('0x29')]({'where':{'type':_0x56a878,'resourceId':_0x48542a['id']}})[_0x743f('0x28')](function(){return _0x4793b7;});})[_0x743f('0x28')](function(){_0x39ddcb['status'](0xcc)[_0x743f('0x1f')]();});}};}function handleEntityNotFound(_0x77d7c2,_0x3ee053){return function(_0x5dc517){if(!_0x5dc517){_0x77d7c2[_0x743f('0x1d')](0x194);}return _0x5dc517;};}function handleError(_0x3670b2,_0xcc541e){_0xcc541e=_0xcc541e||0x1f4;return function(_0x325cd3){logger[_0x743f('0x2d')](_0x325cd3[_0x743f('0x2e')]);if(_0x325cd3[_0x743f('0x2f')]){delete _0x325cd3[_0x743f('0x2f')];}_0x3670b2[_0x743f('0x1e')](_0xcc541e)[_0x743f('0x30')](_0x325cd3);};}exports[_0x743f('0x31')]=function(_0x3d6f64,_0x38289b){var _0x2d0065={},_0x32b332={},_0x65abcf={'count':0x0,'rows':[]};var _0x38d784=_['map'](db[_0x743f('0x32')][_0x743f('0x33')],function(_0x1f383f){return{'name':_0x1f383f[_0x743f('0x34')],'type':_0x1f383f[_0x743f('0x35')][_0x743f('0x36')]};});_0x32b332[_0x743f('0x37')]=_[_0x743f('0x38')](_0x38d784,_0x743f('0x2f'));_0x32b332[_0x743f('0x39')]=_[_0x743f('0x3a')](_0x3d6f64[_0x743f('0x39')]);_0x32b332[_0x743f('0x3b')]=_['intersection'](_0x32b332[_0x743f('0x37')],_0x32b332[_0x743f('0x39')]);_0x2d0065[_0x743f('0x3c')]=_['intersection'](_0x32b332['model'],qs['fields'](_0x3d6f64[_0x743f('0x39')][_0x743f('0x3d')]));_0x2d0065[_0x743f('0x3c')]=_0x2d0065['attributes']['length']?_0x2d0065[_0x743f('0x3c')]:_0x32b332['model'];if(!_0x3d6f64[_0x743f('0x39')][_0x743f('0x3e')](_0x743f('0x3f'))){_0x2d0065['limit']=qs[_0x743f('0x24')](_0x3d6f64[_0x743f('0x39')][_0x743f('0x24')]);_0x2d0065[_0x743f('0x23')]=qs['offset'](_0x3d6f64['query'][_0x743f('0x23')]);}_0x2d0065[_0x743f('0x40')]=qs[_0x743f('0x41')](_0x3d6f64['query']['sort']);_0x2d0065['where']=qs[_0x743f('0x3b')](_[_0x743f('0x42')](_0x3d6f64[_0x743f('0x39')],_0x32b332[_0x743f('0x3b')]),_0x38d784);if(_0x3d6f64[_0x743f('0x39')][_0x743f('0x43')]){_0x2d0065[_0x743f('0x44')]=_[_0x743f('0x45')](_0x2d0065['where'],{'$or':_[_0x743f('0x38')](_0x38d784,function(_0x401039){if(_0x401039[_0x743f('0x35')]!=='VIRTUAL'){var _0x6b5804={};_0x6b5804[_0x401039['name']]={'$like':'%'+_0x3d6f64[_0x743f('0x39')][_0x743f('0x43')]+'%'};return _0x6b5804;}})});}_0x2d0065=_[_0x743f('0x45')]({},_0x2d0065,_0x3d6f64[_0x743f('0x46')]);var _0x239b2d={'where':_0x2d0065[_0x743f('0x44')]};return db[_0x743f('0x32')][_0x743f('0x22')](_0x239b2d)['then'](function(_0xdb8c72){_0x65abcf[_0x743f('0x22')]=_0xdb8c72;if(_0x3d6f64[_0x743f('0x39')][_0x743f('0x47')]){_0x2d0065[_0x743f('0x48')]=[{'all':!![]}];}return db[_0x743f('0x32')]['findAll'](_0x2d0065);})[_0x743f('0x28')](function(_0x345fd3){_0x65abcf[_0x743f('0x49')]=_0x345fd3;return _0x65abcf;})[_0x743f('0x28')](respondWithFilteredResult(_0x38289b,_0x2d0065))[_0x743f('0x4a')](handleError(_0x38289b,null));};exports[_0x743f('0x4b')]=function(_0x385f99,_0x26a310){var _0x35c146={'raw':!![],'where':{'id':_0x385f99[_0x743f('0x4c')]['id']}},_0x2570b9={};_0x2570b9['model']=_[_0x743f('0x3a')](db[_0x743f('0x32')][_0x743f('0x33')]);_0x2570b9[_0x743f('0x39')]=_['keys'](_0x385f99['query']);_0x2570b9[_0x743f('0x3b')]=_[_0x743f('0x4d')](_0x2570b9[_0x743f('0x37')],_0x2570b9['query']);_0x35c146[_0x743f('0x3c')]=_[_0x743f('0x4d')](_0x2570b9[_0x743f('0x37')],qs[_0x743f('0x3d')](_0x385f99[_0x743f('0x39')][_0x743f('0x3d')]));_0x35c146[_0x743f('0x3c')]=_0x35c146['attributes'][_0x743f('0x4e')]?_0x35c146[_0x743f('0x3c')]:_0x2570b9[_0x743f('0x37')];if(_0x385f99[_0x743f('0x39')]['includeAll']){_0x35c146[_0x743f('0x48')]=[{'all':!![]}];}_0x35c146=_[_0x743f('0x45')]({},_0x35c146,_0x385f99[_0x743f('0x46')]);return db[_0x743f('0x32')][_0x743f('0x4f')](_0x35c146)[_0x743f('0x28')](handleEntityNotFound(_0x26a310,null))[_0x743f('0x28')](respondWithResult(_0x26a310,null))[_0x743f('0x4a')](handleError(_0x26a310,null));};exports['create']=function(_0x4ac4e9,_0x183e9c){return db[_0x743f('0x32')][_0x743f('0x50')](_0x4ac4e9[_0x743f('0x51')],{})[_0x743f('0x28')](function(_0x4839db){var _0x5565ab=_0x4ac4e9[_0x743f('0x52')][_0x743f('0x2a')]({'plain':!![]});if(!_0x5565ab)throw new Error(_0x743f('0x53'));if(_0x5565ab[_0x743f('0x54')]===_0x743f('0x52')){var _0x2720b3=_0x4839db[_0x743f('0x2a')]({'plain':!![]});var _0x451db6=_0x743f('0x2b');return db[_0x743f('0x55')][_0x743f('0x4f')]({'where':{'name':_0x451db6,'userProfileId':_0x5565ab[_0x743f('0x56')]},'raw':!![]})[_0x743f('0x28')](function(_0x5dc69b){if(_0x5dc69b&&_0x5dc69b['autoAssociation']===0x0){return db[_0x743f('0x2c')]['create']({'name':_0x2720b3[_0x743f('0x2f')],'resourceId':_0x2720b3['id'],'type':_0x5dc69b[_0x743f('0x2f')],'sectionId':_0x5dc69b['id']},{})[_0x743f('0x28')](function(){return _0x4839db;});}else{return _0x4839db;}})[_0x743f('0x4a')](function(_0x1eae76){logger[_0x743f('0x2d')](_0x743f('0x57'),_0x1eae76);throw _0x1eae76;});}return _0x4839db;})['then'](respondWithResult(_0x183e9c,0xc9))['catch'](handleError(_0x183e9c,null));};exports[_0x743f('0x27')]=function(_0x5995ce,_0x489f7a){if(_0x5995ce[_0x743f('0x51')]['id']){delete _0x5995ce[_0x743f('0x51')]['id'];}return db[_0x743f('0x32')]['find']({'where':{'id':_0x5995ce[_0x743f('0x4c')]['id']}})[_0x743f('0x28')](handleEntityNotFound(_0x489f7a,null))[_0x743f('0x28')](saveUpdates(_0x5995ce[_0x743f('0x51')],null))[_0x743f('0x28')](respondWithResult(_0x489f7a,null))['catch'](handleError(_0x489f7a,null));};exports['destroy']=function(_0x3ee4ad,_0x3d0fba){return db[_0x743f('0x32')][_0x743f('0x4f')]({'where':{'id':_0x3ee4ad['params']['id']}})['then'](handleEntityNotFound(_0x3d0fba,null))[_0x743f('0x28')](removeEntity(_0x3d0fba,null))[_0x743f('0x4a')](handleError(_0x3d0fba,null));};exports[_0x743f('0x58')]=function(_0x33f7fc,_0x1b4439){return db['WhatsappQueue']['describe']()[_0x743f('0x28')](respondWithResult(_0x1b4439,null))[_0x743f('0x4a')](handleError(_0x1b4439,null));};exports[_0x743f('0x59')]=function(_0x2aa3a3,_0x14652f,_0x3c8832){var _0xfa3450={'raw':!![],'where':{}},_0x400307={},_0x3aad4b;return db[_0x743f('0x32')]['findOne']({'where':{'id':_0x2aa3a3[_0x743f('0x4c')]['id']}})[_0x743f('0x28')](handleEntityNotFound(_0x14652f,null))[_0x743f('0x28')](function(_0x446349){if(_0x446349){_0x3aad4b=_0x446349[_0x743f('0x2a')]({'plain':!![]});_0x400307[_0x743f('0x37')]=_['keys'](db['UserWhatsappQueue']['rawAttributes']);_0x400307[_0x743f('0x39')]=_['keys'](_0x2aa3a3[_0x743f('0x39')]);_0x400307['filters']=_[_0x743f('0x4d')](_0x400307[_0x743f('0x37')],_0x400307['query']);_0xfa3450[_0x743f('0x3c')]=_[_0x743f('0x4d')](_0x400307[_0x743f('0x37')],qs[_0x743f('0x3d')](_0x2aa3a3['query'][_0x743f('0x3d')]));_0xfa3450[_0x743f('0x3c')]=_0xfa3450[_0x743f('0x3c')][_0x743f('0x4e')]?_0xfa3450['attributes']:_0x400307['model'];if(!_0x2aa3a3[_0x743f('0x39')][_0x743f('0x3e')](_0x743f('0x3f'))){_0xfa3450['limit']=qs[_0x743f('0x24')](_0x2aa3a3['query'][_0x743f('0x24')]);_0xfa3450[_0x743f('0x23')]=qs[_0x743f('0x23')](_0x2aa3a3['query'][_0x743f('0x23')]);}_0xfa3450['order']=qs[_0x743f('0x41')](_0x2aa3a3[_0x743f('0x39')][_0x743f('0x41')]);_0xfa3450[_0x743f('0x44')]=qs[_0x743f('0x3b')](_[_0x743f('0x42')](_0x2aa3a3['query'],_0x400307[_0x743f('0x3b')]));_0xfa3450[_0x743f('0x44')][_0x743f('0x5a')]=_0x446349['id'];if(_0x2aa3a3[_0x743f('0x39')][_0x743f('0x43')]){_0xfa3450['where']=_['merge'](_0xfa3450['where'],{'$or':_[_0x743f('0x38')](_0xfa3450[_0x743f('0x3c')],function(_0x296866){var _0x5a8e11={};_0x5a8e11[_0x296866]={'$like':'%'+_0x2aa3a3['query'][_0x743f('0x43')]+'%'};return _0x5a8e11;})});}_0xfa3450=_[_0x743f('0x45')]({},_0xfa3450,_0x2aa3a3[_0x743f('0x46')]);return db['UserWhatsappQueue']['findAll'](_0xfa3450);}})[_0x743f('0x28')](function(_0x327ced){if(_0x327ced){return db[_0x743f('0x5b')][_0x743f('0x5c')]({'where':{'id':_['map'](_0x327ced,_0x743f('0x5d')),'role':'agent'},'attributes':['id',_0x743f('0x2f'),'whatsappPause',_0x743f('0x5e'),_0x743f('0x5f')]});}})[_0x743f('0x28')](function(_0x4fdd16){if(_0x4fdd16){return{'count':_0x4fdd16['count'],'rows':_['map'](_0x4fdd16['rows'],function(_0x2b9c43){return{'membername':_0x2b9c43[_0x743f('0x2f')],'UserId':_0x2b9c43['id'],'queue_name':_0x3aad4b[_0x743f('0x2f')],'WhatsappQueueId':_0x3aad4b['id'],'interface':util['format']('%s/%s',_0x743f('0x60'),_0x2b9c43[_0x743f('0x2f')]),'penalty':0x0,'paused':_0x2b9c43['whatsappPause'],'createdAt':_0x2b9c43[_0x743f('0x5f')],'updatedAt':_0x2b9c43[_0x743f('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x743f('0x28')](respondWithFilteredResult(_0x14652f,_0xfa3450))['catch'](handleError(_0x14652f,null));};exports['getTeams']=function(_0x537c5f,_0x2ba76e,_0x425eb8){var _0x3c2530={};var _0x5c8554={};var _0x28a3c5;var _0x2df0aa;return db[_0x743f('0x32')][_0x743f('0x61')]({'where':{'id':_0x537c5f[_0x743f('0x4c')]['id']}})[_0x743f('0x28')](handleEntityNotFound(_0x2ba76e,null))[_0x743f('0x28')](function(_0x49875c){if(_0x49875c){_0x28a3c5=_0x49875c;_0x5c8554[_0x743f('0x37')]=_[_0x743f('0x3a')](db[_0x743f('0x62')][_0x743f('0x33')]);_0x5c8554[_0x743f('0x39')]=_[_0x743f('0x3a')](_0x537c5f[_0x743f('0x39')]);_0x5c8554[_0x743f('0x3b')]=_[_0x743f('0x4d')](_0x5c8554[_0x743f('0x37')],_0x5c8554['query']);_0x3c2530[_0x743f('0x3c')]=_[_0x743f('0x4d')](_0x5c8554[_0x743f('0x37')],qs[_0x743f('0x3d')](_0x537c5f[_0x743f('0x39')]['fields']));_0x3c2530[_0x743f('0x3c')]=_0x3c2530[_0x743f('0x3c')][_0x743f('0x4e')]?_0x3c2530['attributes']:_0x5c8554[_0x743f('0x37')];_0x3c2530[_0x743f('0x40')]=qs[_0x743f('0x41')](_0x537c5f[_0x743f('0x39')][_0x743f('0x41')]);_0x3c2530[_0x743f('0x44')]=qs[_0x743f('0x3b')](_['pick'](_0x537c5f[_0x743f('0x39')],_0x5c8554[_0x743f('0x3b')]));if(_0x537c5f[_0x743f('0x39')][_0x743f('0x43')]){_0x3c2530[_0x743f('0x44')]=_[_0x743f('0x45')](_0x3c2530[_0x743f('0x44')],{'$or':_['map'](_0x3c2530[_0x743f('0x3c')],function(_0x129c7f){var _0x50de33={};_0x50de33[_0x129c7f]={'$like':'%'+_0x537c5f[_0x743f('0x39')][_0x743f('0x43')]+'%'};return _0x50de33;})});}_0x3c2530=_[_0x743f('0x45')]({},_0x3c2530,_0x537c5f[_0x743f('0x46')]);return _0x28a3c5[_0x743f('0x63')](_0x3c2530);}})['then'](function(_0x49af7d){if(_0x49af7d){_0x2df0aa=_0x49af7d['length'];if(!_0x537c5f[_0x743f('0x39')][_0x743f('0x3e')](_0x743f('0x3f'))){_0x3c2530[_0x743f('0x24')]=qs['limit'](_0x537c5f['query'][_0x743f('0x24')]);_0x3c2530[_0x743f('0x23')]=qs[_0x743f('0x23')](_0x537c5f[_0x743f('0x39')][_0x743f('0x23')]);}return _0x28a3c5['getTeams'](_0x3c2530);}})['then'](function(_0x55e515){if(_0x55e515){return _0x55e515?{'count':_0x2df0aa,'rows':_0x55e515}:null;}})[_0x743f('0x28')](respondWithResult(_0x2ba76e,null))[_0x743f('0x4a')](handleError(_0x2ba76e,null));};exports[_0x743f('0x64')]=function(_0x30135a,_0x3bb4bf,_0xddfcc6){var _0x1ba06c=_0x30135a[_0x743f('0x51')]['ids'];return db[_0x743f('0x62')]['findAll']({'where':{'id':_0x1ba06c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x743f('0x65'),'attributes':['id',_0x743f('0x2f'),_0x743f('0x66'),_0x743f('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x8b16e5){if(_0x8b16e5){var _0x398f58=_[_0x743f('0x68')](_0x8b16e5,function(_0x5eeafe){var _0x568990=_0x5eeafe[_0x743f('0x2a')]({'plain':!![]});return _0x568990[_0x743f('0x65')];});return db[_0x743f('0x32')][_0x743f('0x4f')]({'where':{'id':_0x30135a[_0x743f('0x4c')]['id']}})[_0x743f('0x28')](function(_0x180a01){return db[_0x743f('0x69')]['transaction'](function(_0x38939e){return _0x180a01[_0x743f('0x64')](_0x1ba06c,{'transaction':_0x38939e})[_0x743f('0x28')](function(){return BPromise[_0x743f('0x6a')](_0x398f58,function(_0x306594){return db[_0x743f('0x6b')][_0x743f('0x6c')]({'where':{'UserId':_0x306594['id'],'WhatsappQueueId':_0x30135a[_0x743f('0x4c')]['id']},'transaction':_0x38939e});});})['then'](function(){_0x398f58[_0x743f('0x6d')](function(_0xfff4a6){socket[_0x743f('0x6e')](_0x743f('0x6f'),{'UserId':_0xfff4a6['id'],'WhatsappQueueId':_0x180a01['id']});});});});});}})[_0x743f('0x28')](respondWithStatusCode(_0x3bb4bf,null))['catch'](handleError(_0x3bb4bf,null));};exports['removeTeams']=function(_0xa7c9c2,_0x18338d,_0x3eedb4){return db[_0x743f('0x62')]['findAll']({'where':{'id':_0xa7c9c2[_0x743f('0x39')][_0x743f('0x70')]},'attributes':['id'],'include':[{'model':db[_0x743f('0x5b')],'as':_0x743f('0x65'),'attributes':['id'],'raw':!![]}]})[_0x743f('0x28')](handleEntityNotFound(_0x18338d,null))[_0x743f('0x28')](function(_0x2a5cd5){var _0x4de17f=_[_0x743f('0x38')](_0x2a5cd5,'id');var _0x592420=[];var _0x4f3022=[];var _0x47fefa=squel[_0x743f('0x71')]();_0x47fefa[_0x743f('0x72')]('tq.TeamId')[_0x743f('0x73')](_0x743f('0x74'),'tq')['join'](_0x743f('0x75'),'ut',_0x743f('0x76'))[_0x743f('0x44')]('WhatsappQueueId\x20=\x20?',_0xa7c9c2['params']['id']);for(var _0x45cf5e=0x0;_0x45cf5e<_0x2a5cd5['length'];_0x45cf5e+=0x1){let _0x606e9a=_0x2a5cd5[_0x45cf5e];for(var _0x2e3985=0x0;_0x2e3985<_0x606e9a['Agents'][_0x743f('0x4e')];_0x2e3985+=0x1){let _0x268583=_0x606e9a[_0x743f('0x65')][_0x2e3985];var _0x45dcb1=_0x47fefa['clone']();_0x45dcb1['where']('ut.UserId\x20=\x20?',_0x268583['id']);_0x4f3022[_0x743f('0x77')](db['sequelize']['query'](_0x45dcb1[_0x743f('0x78')](),{'type':db[_0x743f('0x69')][_0x743f('0x79')][_0x743f('0x7a')]})[_0x743f('0x28')](function(_0x114248){if(_0x114248[_0x743f('0x4e')]===0x1){return _0x268583['id'];}else{var _0x15c6a4=_[_0x743f('0x7b')](_[_0x743f('0x38')](_0x114248,_0x743f('0x7c')),function(_0x326320){return _[_0x743f('0x7d')](_0x4de17f,_0x326320);});if(_0x15c6a4){return _0x268583['id'];}}}));}}return BPromise[_0x743f('0x7e')](_0x4f3022)[_0x743f('0x28')](function(_0x52ebe8){_0x592420=_(_0x592420)[_0x743f('0x7f')](_0x52ebe8)[_0x743f('0x80')]()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0xa7c9c2[_0x743f('0x4c')]['id']}})[_0x743f('0x28')](function(_0x5a3014){return db[_0x743f('0x69')][_0x743f('0x81')](function(_0x49f5db){return _0x5a3014[_0x743f('0x82')](_0xa7c9c2[_0x743f('0x39')][_0x743f('0x70')],{'transaction':_0x49f5db})[_0x743f('0x28')](function(){if(!_[_0x743f('0x83')](_0x592420)){return _0x5a3014['removeAgents'](_0x592420,{'transaction':_0x49f5db});}})[_0x743f('0x28')](function(){_0x592420[_0x743f('0x6d')](function(_0x55c2c0){socket[_0x743f('0x6e')]('userWhatsappQueue:remove',{'UserId':_0x55c2c0,'WhatsappQueueId':_0x5a3014['id']});});});});});});})[_0x743f('0x28')](respondWithStatusCode(_0x18338d,null))[_0x743f('0x4a')](handleError(_0x18338d,null));};exports[_0x743f('0x84')]=function(_0x5eb697,_0x5283a3,_0x550cd4){return db['WhatsappQueue']['find']({'where':{'id':_0x5eb697[_0x743f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5283a3,null))[_0x743f('0x28')](function(_0x2ba132){if(_0x2ba132){return _0x2ba132[_0x743f('0x84')](_0x5eb697[_0x743f('0x51')]['ids'],_[_0x743f('0x85')](_0x5eb697[_0x743f('0x51')],[_0x743f('0x70'),'id'])||{})[_0x743f('0x86')](function(_0x29c3f9){for(var _0x527571=0x0;_0x527571<_0x5eb697['body'][_0x743f('0x70')]['length'];_0x527571+=0x1){socket[_0x743f('0x6e')](_0x743f('0x6f'),{'UserId':Number(_0x5eb697['body']['ids'][_0x527571]),'WhatsappQueueId':Number(_0x5eb697[_0x743f('0x4c')]['id'])});}return _0x29c3f9;});}})['then'](respondWithResult(_0x5283a3,null))[_0x743f('0x4a')](handleError(_0x5283a3,null));};exports[_0x743f('0x87')]=function(_0x20207d,_0x17fa0f,_0x39bb53){return db[_0x743f('0x32')][_0x743f('0x4f')]({'where':{'id':_0x20207d[_0x743f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x17fa0f,null))['then'](function(_0x2977e6){if(_0x2977e6){return _0x2977e6[_0x743f('0x87')](_0x20207d[_0x743f('0x39')][_0x743f('0x70')])['then'](function(){if(_['isArray'](_0x20207d[_0x743f('0x39')]['ids'])){for(var _0x4b2a02=0x0;_0x4b2a02<_0x20207d[_0x743f('0x39')]['ids'][_0x743f('0x4e')];_0x4b2a02+=0x1){socket['emit'](_0x743f('0x88'),{'UserId':Number(_0x20207d[_0x743f('0x39')][_0x743f('0x70')][_0x4b2a02]),'WhatsappQueueId':Number(_0x20207d[_0x743f('0x4c')]['id'])});}}else{socket[_0x743f('0x6e')](_0x743f('0x88'),{'UserId':Number(_0x20207d[_0x743f('0x39')][_0x743f('0x70')]),'WhatsappQueueId':Number(_0x20207d[_0x743f('0x4c')]['id'])});}});}})[_0x743f('0x28')](respondWithStatusCode(_0x17fa0f,null))[_0x743f('0x4a')](handleError(_0x17fa0f,null));};exports[_0x743f('0x89')]=function(_0x2055e0,_0x4b5f2d,_0x20eaee){var _0x3bd068={};var _0x115c48={};var _0x373407;var _0xbf12d2;return db[_0x743f('0x32')][_0x743f('0x61')]({'where':{'id':_0x2055e0[_0x743f('0x4c')]['id']}})[_0x743f('0x28')](handleEntityNotFound(_0x4b5f2d,null))[_0x743f('0x28')](function(_0x3225cd){if(_0x3225cd){_0x373407=_0x3225cd;_0x115c48['model']=_[_0x743f('0x3a')](db[_0x743f('0x5b')][_0x743f('0x33')]);_0x115c48['query']=_['keys'](_0x2055e0[_0x743f('0x39')]);_0x115c48['filters']=_[_0x743f('0x4d')](_0x115c48[_0x743f('0x37')],_0x115c48[_0x743f('0x39')]);_0x3bd068['attributes']=_[_0x743f('0x4d')](_0x115c48[_0x743f('0x37')],qs['fields'](_0x2055e0[_0x743f('0x39')][_0x743f('0x3d')]));_0x3bd068[_0x743f('0x3c')]=_0x3bd068[_0x743f('0x3c')][_0x743f('0x4e')]?_0x3bd068[_0x743f('0x3c')]:_0x115c48['model'];_0x3bd068[_0x743f('0x40')]=qs[_0x743f('0x41')](_0x2055e0[_0x743f('0x39')][_0x743f('0x41')]);_0x3bd068[_0x743f('0x44')]=qs[_0x743f('0x3b')](_[_0x743f('0x42')](_0x2055e0[_0x743f('0x39')],_0x115c48[_0x743f('0x3b')]));if(_0x2055e0[_0x743f('0x39')][_0x743f('0x43')]){_0x3bd068[_0x743f('0x44')]=_['merge'](_0x3bd068[_0x743f('0x44')],{'$or':_[_0x743f('0x38')](_0x3bd068[_0x743f('0x3c')],function(_0x2db290){var _0xe50bf2={};_0xe50bf2[_0x2db290]={'$like':'%'+_0x2055e0[_0x743f('0x39')][_0x743f('0x43')]+'%'};return _0xe50bf2;})});}_0x3bd068=_[_0x743f('0x45')]({},_0x3bd068,_0x2055e0[_0x743f('0x46')]);return _0x373407[_0x743f('0x89')](_0x3bd068);}})[_0x743f('0x28')](function(_0x3c7af5){if(_0x3c7af5){_0xbf12d2=_0x3c7af5[_0x743f('0x4e')];if(!_0x2055e0[_0x743f('0x39')]['hasOwnProperty'](_0x743f('0x3f'))){_0x3bd068[_0x743f('0x24')]=qs[_0x743f('0x24')](_0x2055e0['query'][_0x743f('0x24')]);_0x3bd068[_0x743f('0x23')]=qs[_0x743f('0x23')](_0x2055e0['query']['offset']);}return _0x373407[_0x743f('0x89')](_0x3bd068);}})['then'](function(_0x54c520){if(_0x54c520){return _0x54c520?{'count':_0xbf12d2,'rows':_0x54c520}:null;}})[_0x743f('0x28')](respondWithResult(_0x4b5f2d,null))[_0x743f('0x4a')](handleError(_0x4b5f2d,null));}; \ No newline at end of file +var _0x0ec3=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','describe','findOne','UserWhatsappQueue','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','format','SIP','createdAt','getTeams','addTeams','ids','Team','online','voicePause','Agents','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','key','model'];(function(_0x1e63a6,_0x1150c4){var _0x4edac5=function(_0x48142f){while(--_0x48142f){_0x1e63a6['push'](_0x1e63a6['shift']());}};_0x4edac5(++_0x1150c4);}(_0x0ec3,0xe8));var _0x30ec=function(_0x337274,_0x1eba88){_0x337274=_0x337274-0x0;var _0x2f200e=_0x0ec3[_0x337274];return _0x2f200e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30ec('0x0'));var zipdir=require(_0x30ec('0x1'));var jsonpatch=require(_0x30ec('0x2'));var rp=require(_0x30ec('0x3'));var moment=require('moment');var BPromise=require(_0x30ec('0x4'));var Mustache=require(_0x30ec('0x5'));var util=require(_0x30ec('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x30ec('0x7'));var ejs=require(_0x30ec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30ec('0x9'));var squel=require(_0x30ec('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x30ec('0xb'));var toCsv=require(_0x30ec('0x7'));var querystring=require(_0x30ec('0xc'));var Papa=require(_0x30ec('0xd'));var Redis=require(_0x30ec('0xe'));var authService=require(_0x30ec('0xf'));var qs=require(_0x30ec('0x10'));var as=require(_0x30ec('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30ec('0x12'))(_0x30ec('0x13'));var utils=require(_0x30ec('0x14'));var config=require(_0x30ec('0x15'));var licenseUtil=require(_0x30ec('0x16'));var db=require('../../mysqldb')['db'];config[_0x30ec('0x17')]=_[_0x30ec('0x18')](config[_0x30ec('0x17')],{'host':_0x30ec('0x19'),'port':0x18eb});var socket=require(_0x30ec('0x1a'))(new Redis(config[_0x30ec('0x17')]));require(_0x30ec('0x1b'))['register'](socket);function respondWithStatusCode(_0x5bb97d,_0x420d54){_0x420d54=_0x420d54||0xcc;return function(_0x476399){if(_0x476399){return _0x5bb97d[_0x30ec('0x1c')](_0x420d54);}return _0x5bb97d[_0x30ec('0x1d')](_0x420d54)[_0x30ec('0x1e')]();};}function respondWithResult(_0x446695,_0x306dbc){_0x306dbc=_0x306dbc||0xc8;return function(_0x45667a){if(_0x45667a){return _0x446695[_0x30ec('0x1d')](_0x306dbc)[_0x30ec('0x1f')](_0x45667a);}};}function respondWithFilteredResult(_0x5f5025,_0x3d07f3){return function(_0x3fa8ba){if(_0x3fa8ba){var _0x30b6ae=typeof _0x3d07f3[_0x30ec('0x20')]===_0x30ec('0x21')&&typeof _0x3d07f3['limit']===_0x30ec('0x21');var _0x52b230=_0x3fa8ba['count'];var _0x878cbf=_0x30b6ae?0x0:_0x3d07f3['offset'];var _0x1909c3=_0x30b6ae?_0x3fa8ba[_0x30ec('0x22')]:_0x3d07f3['offset']+_0x3d07f3[_0x30ec('0x23')];var _0x2de8bc;if(_0x1909c3>=_0x52b230){_0x1909c3=_0x52b230;_0x2de8bc=0xc8;}else{_0x2de8bc=0xce;}_0x5f5025[_0x30ec('0x1d')](_0x2de8bc);return _0x5f5025[_0x30ec('0x24')](_0x30ec('0x25'),_0x878cbf+'-'+_0x1909c3+'/'+_0x52b230)['json'](_0x3fa8ba);}return null;};}function patchUpdates(_0x3c7551){return function(_0x44a622){try{jsonpatch[_0x30ec('0x26')](_0x44a622,_0x3c7551,!![]);}catch(_0x4885ea){return BPromise[_0x30ec('0x27')](_0x4885ea);}return _0x44a622[_0x30ec('0x28')]();};}function saveUpdates(_0x4252be,_0xc3510a){return function(_0x70e6a7){if(_0x70e6a7){return _0x70e6a7[_0x30ec('0x29')](_0x4252be)[_0x30ec('0x2a')](function(_0x26e8e6){return _0x26e8e6;});}return null;};}function removeEntity(_0x3746e9,_0x446bbd){return function(_0x539a37){if(_0x539a37){return _0x539a37[_0x30ec('0x2b')]()[_0x30ec('0x2a')](function(){var _0x25385d=_0x539a37[_0x30ec('0x2c')]({'plain':!![]});var _0x3bad31=_0x30ec('0x2d');return db[_0x30ec('0x2e')][_0x30ec('0x2b')]({'where':{'type':_0x3bad31,'resourceId':_0x25385d['id']}})[_0x30ec('0x2a')](function(){return _0x539a37;});})[_0x30ec('0x2a')](function(){_0x3746e9[_0x30ec('0x1d')](0xcc)[_0x30ec('0x1e')]();});}};}function handleEntityNotFound(_0x3ea597,_0x3e58ef){return function(_0x2a86cb){if(!_0x2a86cb){_0x3ea597[_0x30ec('0x1c')](0x194);}return _0x2a86cb;};}function handleError(_0x230dae,_0x8747d0){_0x8747d0=_0x8747d0||0x1f4;return function(_0x4c53af){logger['error'](_0x4c53af[_0x30ec('0x2f')]);if(_0x4c53af[_0x30ec('0x30')]){delete _0x4c53af[_0x30ec('0x30')];}_0x230dae[_0x30ec('0x1d')](_0x8747d0)[_0x30ec('0x31')](_0x4c53af);};}exports[_0x30ec('0x32')]=function(_0x556fa3,_0x224161){var _0x4eed83={},_0x4c0ac5={},_0x32671f={'count':0x0,'rows':[]};var _0x430ff6=_[_0x30ec('0x33')](db[_0x30ec('0x34')][_0x30ec('0x35')],function(_0x287eff){return{'name':_0x287eff['fieldName'],'type':_0x287eff['type'][_0x30ec('0x36')]};});_0x4c0ac5[_0x30ec('0x37')]=_[_0x30ec('0x33')](_0x430ff6,_0x30ec('0x30'));_0x4c0ac5['query']=_[_0x30ec('0x38')](_0x556fa3[_0x30ec('0x39')]);_0x4c0ac5[_0x30ec('0x3a')]=_[_0x30ec('0x3b')](_0x4c0ac5[_0x30ec('0x37')],_0x4c0ac5[_0x30ec('0x39')]);_0x4eed83[_0x30ec('0x3c')]=_['intersection'](_0x4c0ac5[_0x30ec('0x37')],qs[_0x30ec('0x3d')](_0x556fa3['query'][_0x30ec('0x3d')]));_0x4eed83[_0x30ec('0x3c')]=_0x4eed83['attributes'][_0x30ec('0x3e')]?_0x4eed83[_0x30ec('0x3c')]:_0x4c0ac5[_0x30ec('0x37')];if(!_0x556fa3[_0x30ec('0x39')][_0x30ec('0x3f')](_0x30ec('0x40'))){_0x4eed83[_0x30ec('0x23')]=qs[_0x30ec('0x23')](_0x556fa3[_0x30ec('0x39')][_0x30ec('0x23')]);_0x4eed83[_0x30ec('0x20')]=qs[_0x30ec('0x20')](_0x556fa3[_0x30ec('0x39')][_0x30ec('0x20')]);}_0x4eed83[_0x30ec('0x41')]=qs[_0x30ec('0x42')](_0x556fa3[_0x30ec('0x39')]['sort']);_0x4eed83[_0x30ec('0x43')]=qs['filters'](_[_0x30ec('0x44')](_0x556fa3[_0x30ec('0x39')],_0x4c0ac5[_0x30ec('0x3a')]),_0x430ff6);if(_0x556fa3[_0x30ec('0x39')][_0x30ec('0x45')]){_0x4eed83[_0x30ec('0x43')]=_[_0x30ec('0x46')](_0x4eed83[_0x30ec('0x43')],{'$or':_['map'](_0x430ff6,function(_0x2be6d3){if(_0x2be6d3[_0x30ec('0x47')]!==_0x30ec('0x48')){var _0x18cfbf={};_0x18cfbf[_0x2be6d3[_0x30ec('0x30')]]={'$like':'%'+_0x556fa3[_0x30ec('0x39')][_0x30ec('0x45')]+'%'};return _0x18cfbf;}})});}_0x4eed83=_['merge']({},_0x4eed83,_0x556fa3[_0x30ec('0x49')]);var _0x2109ca={'where':_0x4eed83[_0x30ec('0x43')]};return db[_0x30ec('0x34')][_0x30ec('0x22')](_0x2109ca)['then'](function(_0x37455f){_0x32671f[_0x30ec('0x22')]=_0x37455f;if(_0x556fa3[_0x30ec('0x39')][_0x30ec('0x4a')]){_0x4eed83[_0x30ec('0x4b')]=[{'all':!![]}];}return db[_0x30ec('0x34')][_0x30ec('0x4c')](_0x4eed83);})[_0x30ec('0x2a')](function(_0x128827){_0x32671f[_0x30ec('0x4d')]=_0x128827;return _0x32671f;})[_0x30ec('0x2a')](respondWithFilteredResult(_0x224161,_0x4eed83))[_0x30ec('0x4e')](handleError(_0x224161,null));};exports[_0x30ec('0x4f')]=function(_0x209798,_0x34e273){var _0x5f071a={'raw':!![],'where':{'id':_0x209798[_0x30ec('0x50')]['id']}},_0x44ffb8={};_0x44ffb8['model']=_[_0x30ec('0x38')](db['WhatsappQueue'][_0x30ec('0x35')]);_0x44ffb8['query']=_[_0x30ec('0x38')](_0x209798[_0x30ec('0x39')]);_0x44ffb8[_0x30ec('0x3a')]=_['intersection'](_0x44ffb8[_0x30ec('0x37')],_0x44ffb8['query']);_0x5f071a['attributes']=_['intersection'](_0x44ffb8[_0x30ec('0x37')],qs['fields'](_0x209798[_0x30ec('0x39')][_0x30ec('0x3d')]));_0x5f071a[_0x30ec('0x3c')]=_0x5f071a[_0x30ec('0x3c')]['length']?_0x5f071a['attributes']:_0x44ffb8['model'];if(_0x209798[_0x30ec('0x39')][_0x30ec('0x4a')]){_0x5f071a[_0x30ec('0x4b')]=[{'all':!![]}];}_0x5f071a=_['merge']({},_0x5f071a,_0x209798['options']);return db[_0x30ec('0x34')][_0x30ec('0x51')](_0x5f071a)[_0x30ec('0x2a')](handleEntityNotFound(_0x34e273,null))['then'](respondWithResult(_0x34e273,null))['catch'](handleError(_0x34e273,null));};exports[_0x30ec('0x52')]=function(_0x40d712,_0x329d62){return db['WhatsappQueue'][_0x30ec('0x52')](_0x40d712[_0x30ec('0x53')],{})[_0x30ec('0x2a')](function(_0x2eface){var _0x4773aa=_0x40d712[_0x30ec('0x54')][_0x30ec('0x2c')]({'plain':!![]});if(!_0x4773aa)throw new Error(_0x30ec('0x55'));if(_0x4773aa[_0x30ec('0x56')]===_0x30ec('0x54')){var _0xd85024=_0x2eface[_0x30ec('0x2c')]({'plain':!![]});var _0xee00c6=_0x30ec('0x2d');return db[_0x30ec('0x57')][_0x30ec('0x51')]({'where':{'name':_0xee00c6,'userProfileId':_0x4773aa[_0x30ec('0x58')]},'raw':!![]})[_0x30ec('0x2a')](function(_0x3bf224){if(_0x3bf224&&_0x3bf224[_0x30ec('0x59')]===0x0){return db[_0x30ec('0x2e')][_0x30ec('0x52')]({'name':_0xd85024['name'],'resourceId':_0xd85024['id'],'type':_0x3bf224[_0x30ec('0x30')],'sectionId':_0x3bf224['id']},{})['then'](function(){return _0x2eface;});}else{return _0x2eface;}})['catch'](function(_0x54e482){logger[_0x30ec('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54e482);throw _0x54e482;});}return _0x2eface;})[_0x30ec('0x2a')](respondWithResult(_0x329d62,0xc9))['catch'](handleError(_0x329d62,null));};exports[_0x30ec('0x29')]=function(_0x4064a5,_0x477471){if(_0x4064a5[_0x30ec('0x53')]['id']){delete _0x4064a5[_0x30ec('0x53')]['id'];}return db[_0x30ec('0x34')]['find']({'where':{'id':_0x4064a5[_0x30ec('0x50')]['id']}})['then'](handleEntityNotFound(_0x477471,null))['then'](saveUpdates(_0x4064a5[_0x30ec('0x53')],null))[_0x30ec('0x2a')](respondWithResult(_0x477471,null))[_0x30ec('0x4e')](handleError(_0x477471,null));};exports[_0x30ec('0x2b')]=function(_0x236f98,_0x275285){return db[_0x30ec('0x34')][_0x30ec('0x51')]({'where':{'id':_0x236f98[_0x30ec('0x50')]['id']}})[_0x30ec('0x2a')](handleEntityNotFound(_0x275285,null))['then'](removeEntity(_0x275285,null))['catch'](handleError(_0x275285,null));};exports['describe']=function(_0x470ebc,_0x31a938){return db[_0x30ec('0x34')][_0x30ec('0x5b')]()[_0x30ec('0x2a')](respondWithResult(_0x31a938,null))[_0x30ec('0x4e')](handleError(_0x31a938,null));};exports['getMembers']=function(_0xfb0986,_0x24b02b,_0x15faa0){var _0x33e6ff={'raw':!![],'where':{}},_0x519824={},_0x480d8a;return db[_0x30ec('0x34')][_0x30ec('0x5c')]({'where':{'id':_0xfb0986['params']['id']}})[_0x30ec('0x2a')](handleEntityNotFound(_0x24b02b,null))['then'](function(_0x53c769){if(_0x53c769){_0x480d8a=_0x53c769['get']({'plain':!![]});_0x519824[_0x30ec('0x37')]=_[_0x30ec('0x38')](db[_0x30ec('0x5d')]['rawAttributes']);_0x519824[_0x30ec('0x39')]=_['keys'](_0xfb0986['query']);_0x519824[_0x30ec('0x3a')]=_[_0x30ec('0x3b')](_0x519824[_0x30ec('0x37')],_0x519824[_0x30ec('0x39')]);_0x33e6ff[_0x30ec('0x3c')]=_[_0x30ec('0x3b')](_0x519824[_0x30ec('0x37')],qs[_0x30ec('0x3d')](_0xfb0986[_0x30ec('0x39')][_0x30ec('0x3d')]));_0x33e6ff[_0x30ec('0x3c')]=_0x33e6ff[_0x30ec('0x3c')][_0x30ec('0x3e')]?_0x33e6ff[_0x30ec('0x3c')]:_0x519824['model'];if(!_0xfb0986[_0x30ec('0x39')][_0x30ec('0x3f')](_0x30ec('0x40'))){_0x33e6ff[_0x30ec('0x23')]=qs[_0x30ec('0x23')](_0xfb0986['query'][_0x30ec('0x23')]);_0x33e6ff[_0x30ec('0x20')]=qs['offset'](_0xfb0986[_0x30ec('0x39')][_0x30ec('0x20')]);}_0x33e6ff['order']=qs[_0x30ec('0x42')](_0xfb0986[_0x30ec('0x39')][_0x30ec('0x42')]);_0x33e6ff[_0x30ec('0x43')]=qs[_0x30ec('0x3a')](_[_0x30ec('0x44')](_0xfb0986[_0x30ec('0x39')],_0x519824[_0x30ec('0x3a')]));_0x33e6ff[_0x30ec('0x43')][_0x30ec('0x5e')]=_0x53c769['id'];if(_0xfb0986['query'][_0x30ec('0x45')]){_0x33e6ff[_0x30ec('0x43')]=_[_0x30ec('0x46')](_0x33e6ff[_0x30ec('0x43')],{'$or':_['map'](_0x33e6ff[_0x30ec('0x3c')],function(_0x116e73){var _0x13e595={};_0x13e595[_0x116e73]={'$like':'%'+_0xfb0986[_0x30ec('0x39')][_0x30ec('0x45')]+'%'};return _0x13e595;})});}_0x33e6ff=_[_0x30ec('0x46')]({},_0x33e6ff,_0xfb0986[_0x30ec('0x49')]);return db[_0x30ec('0x5d')][_0x30ec('0x4c')](_0x33e6ff);}})[_0x30ec('0x2a')](function(_0x59ffb3){if(_0x59ffb3){return db[_0x30ec('0x5f')]['findAndCountAll']({'where':{'id':_[_0x30ec('0x33')](_0x59ffb3,_0x30ec('0x60')),'role':_0x30ec('0x61')},'attributes':['id',_0x30ec('0x30'),_0x30ec('0x62'),_0x30ec('0x63'),'createdAt']});}})[_0x30ec('0x2a')](function(_0x29e431){if(_0x29e431){return{'count':_0x29e431['count'],'rows':_['map'](_0x29e431['rows'],function(_0x10d1d7){return{'membername':_0x10d1d7[_0x30ec('0x30')],'UserId':_0x10d1d7['id'],'queue_name':_0x480d8a['name'],'WhatsappQueueId':_0x480d8a['id'],'interface':util[_0x30ec('0x64')]('%s/%s',_0x30ec('0x65'),_0x10d1d7[_0x30ec('0x30')]),'penalty':0x0,'paused':_0x10d1d7[_0x30ec('0x62')],'createdAt':_0x10d1d7[_0x30ec('0x66')],'updatedAt':_0x10d1d7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x24b02b,_0x33e6ff))[_0x30ec('0x4e')](handleError(_0x24b02b,null));};exports[_0x30ec('0x67')]=function(_0x28331d,_0x2c76e9,_0x2aba8e){var _0x2d311c={};var _0x4d2ab1={};var _0x2967fc;var _0x317383;return db['WhatsappQueue'][_0x30ec('0x5c')]({'where':{'id':_0x28331d[_0x30ec('0x50')]['id']}})[_0x30ec('0x2a')](handleEntityNotFound(_0x2c76e9,null))[_0x30ec('0x2a')](function(_0x3cac26){if(_0x3cac26){_0x2967fc=_0x3cac26;_0x4d2ab1['model']=_[_0x30ec('0x38')](db['Team'][_0x30ec('0x35')]);_0x4d2ab1[_0x30ec('0x39')]=_[_0x30ec('0x38')](_0x28331d[_0x30ec('0x39')]);_0x4d2ab1[_0x30ec('0x3a')]=_[_0x30ec('0x3b')](_0x4d2ab1['model'],_0x4d2ab1[_0x30ec('0x39')]);_0x2d311c[_0x30ec('0x3c')]=_['intersection'](_0x4d2ab1[_0x30ec('0x37')],qs['fields'](_0x28331d['query'][_0x30ec('0x3d')]));_0x2d311c[_0x30ec('0x3c')]=_0x2d311c[_0x30ec('0x3c')][_0x30ec('0x3e')]?_0x2d311c[_0x30ec('0x3c')]:_0x4d2ab1[_0x30ec('0x37')];_0x2d311c['order']=qs['sort'](_0x28331d[_0x30ec('0x39')][_0x30ec('0x42')]);_0x2d311c[_0x30ec('0x43')]=qs[_0x30ec('0x3a')](_['pick'](_0x28331d[_0x30ec('0x39')],_0x4d2ab1[_0x30ec('0x3a')]));if(_0x28331d['query'][_0x30ec('0x45')]){_0x2d311c['where']=_[_0x30ec('0x46')](_0x2d311c['where'],{'$or':_[_0x30ec('0x33')](_0x2d311c['attributes'],function(_0x52cd0f){var _0x298dde={};_0x298dde[_0x52cd0f]={'$like':'%'+_0x28331d[_0x30ec('0x39')]['filter']+'%'};return _0x298dde;})});}_0x2d311c=_[_0x30ec('0x46')]({},_0x2d311c,_0x28331d[_0x30ec('0x49')]);return _0x2967fc[_0x30ec('0x67')](_0x2d311c);}})['then'](function(_0x51e549){if(_0x51e549){_0x317383=_0x51e549[_0x30ec('0x3e')];if(!_0x28331d[_0x30ec('0x39')][_0x30ec('0x3f')]('nolimit')){_0x2d311c[_0x30ec('0x23')]=qs[_0x30ec('0x23')](_0x28331d[_0x30ec('0x39')][_0x30ec('0x23')]);_0x2d311c[_0x30ec('0x20')]=qs[_0x30ec('0x20')](_0x28331d[_0x30ec('0x39')]['offset']);}return _0x2967fc[_0x30ec('0x67')](_0x2d311c);}})[_0x30ec('0x2a')](function(_0x503c1d){if(_0x503c1d){return _0x503c1d?{'count':_0x317383,'rows':_0x503c1d}:null;}})[_0x30ec('0x2a')](respondWithResult(_0x2c76e9,null))[_0x30ec('0x4e')](handleError(_0x2c76e9,null));};exports[_0x30ec('0x68')]=function(_0xe084f2,_0x158d2b,_0x54bd70){var _0x24387e=_0xe084f2['body'][_0x30ec('0x69')];return db[_0x30ec('0x6a')][_0x30ec('0x4c')]({'where':{'id':_0x24387e},'attributes':['id'],'include':[{'model':db[_0x30ec('0x5f')],'as':'Agents','attributes':['id',_0x30ec('0x30'),_0x30ec('0x6b'),_0x30ec('0x6c'),'interface'],'raw':!![]}]})[_0x30ec('0x2a')](function(_0x22832d){if(_0x22832d){var _0x34f40e=_['flatMap'](_0x22832d,function(_0x1dc09f){var _0x4bcfbf=_0x1dc09f['get']({'plain':!![]});return _0x4bcfbf[_0x30ec('0x6d')];});return db[_0x30ec('0x34')][_0x30ec('0x51')]({'where':{'id':_0xe084f2[_0x30ec('0x50')]['id']}})['then'](function(_0x25769f){return db['sequelize'][_0x30ec('0x6e')](function(_0x2f7606){return _0x25769f[_0x30ec('0x68')](_0x24387e,{'transaction':_0x2f7606})[_0x30ec('0x2a')](function(){return BPromise[_0x30ec('0x6f')](_0x34f40e,function(_0x425234){return db[_0x30ec('0x5d')][_0x30ec('0x70')]({'where':{'UserId':_0x425234['id'],'WhatsappQueueId':_0xe084f2[_0x30ec('0x50')]['id']},'transaction':_0x2f7606});});})['then'](function(){_0x34f40e['forEach'](function(_0xe5e62f){socket[_0x30ec('0x71')](_0x30ec('0x72'),{'UserId':_0xe5e62f['id'],'WhatsappQueueId':_0x25769f['id']});});});});});}})[_0x30ec('0x2a')](respondWithStatusCode(_0x158d2b,null))[_0x30ec('0x4e')](handleError(_0x158d2b,null));};exports[_0x30ec('0x73')]=function(_0x582bb3,_0x56d6b9,_0x1deb8c){return db[_0x30ec('0x6a')][_0x30ec('0x4c')]({'where':{'id':_0x582bb3[_0x30ec('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x30ec('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x30ec('0x2a')](handleEntityNotFound(_0x56d6b9,null))[_0x30ec('0x2a')](function(_0x5a5a93){var _0x40b6a8=_[_0x30ec('0x33')](_0x5a5a93,'id');var _0x4bf106=[];var _0x352d1f=[];var _0x45ed90=squel[_0x30ec('0x74')]();_0x45ed90[_0x30ec('0x75')]('tq.TeamId')[_0x30ec('0x76')]('team_has_whatsapp_queues','tq')[_0x30ec('0x77')](_0x30ec('0x78'),'ut',_0x30ec('0x79'))[_0x30ec('0x43')](_0x30ec('0x7a'),_0x582bb3['params']['id']);for(var _0x155881=0x0;_0x155881<_0x5a5a93['length'];_0x155881+=0x1){let _0x505709=_0x5a5a93[_0x155881];for(var _0x5f0c49=0x0;_0x5f0c49<_0x505709[_0x30ec('0x6d')][_0x30ec('0x3e')];_0x5f0c49+=0x1){let _0x154315=_0x505709[_0x30ec('0x6d')][_0x5f0c49];var _0x63605a=_0x45ed90[_0x30ec('0x7b')]();_0x63605a[_0x30ec('0x43')](_0x30ec('0x7c'),_0x154315['id']);_0x352d1f[_0x30ec('0x7d')](db['sequelize'][_0x30ec('0x39')](_0x63605a[_0x30ec('0x7e')](),{'type':db[_0x30ec('0x7f')][_0x30ec('0x80')][_0x30ec('0x81')]})[_0x30ec('0x2a')](function(_0x3f675f){if(_0x3f675f[_0x30ec('0x3e')]===0x1){return _0x154315['id'];}else{var _0x2d5a60=_[_0x30ec('0x82')](_['map'](_0x3f675f,_0x30ec('0x83')),function(_0x5c140f){return _[_0x30ec('0x84')](_0x40b6a8,_0x5c140f);});if(_0x2d5a60){return _0x154315['id'];}}}));}}return BPromise[_0x30ec('0x85')](_0x352d1f)[_0x30ec('0x2a')](function(_0x2aa48d){_0x4bf106=_(_0x4bf106)['union'](_0x2aa48d)[_0x30ec('0x86')]()['value']();return db['WhatsappQueue'][_0x30ec('0x51')]({'where':{'id':_0x582bb3[_0x30ec('0x50')]['id']}})[_0x30ec('0x2a')](function(_0x325d95){return db['sequelize'][_0x30ec('0x6e')](function(_0x31b902){return _0x325d95[_0x30ec('0x73')](_0x582bb3[_0x30ec('0x39')]['ids'],{'transaction':_0x31b902})[_0x30ec('0x2a')](function(){if(!_[_0x30ec('0x87')](_0x4bf106)){return _0x325d95[_0x30ec('0x88')](_0x4bf106,{'transaction':_0x31b902});}})[_0x30ec('0x2a')](function(){_0x4bf106[_0x30ec('0x89')](function(_0x27a365){socket[_0x30ec('0x71')](_0x30ec('0x8a'),{'UserId':_0x27a365,'WhatsappQueueId':_0x325d95['id']});});});});});});})[_0x30ec('0x2a')](respondWithStatusCode(_0x56d6b9,null))[_0x30ec('0x4e')](handleError(_0x56d6b9,null));};exports[_0x30ec('0x8b')]=function(_0x2140b2,_0x115c55,_0x3153a9){return db['WhatsappQueue'][_0x30ec('0x51')]({'where':{'id':_0x2140b2['params']['id']}})[_0x30ec('0x2a')](handleEntityNotFound(_0x115c55,null))[_0x30ec('0x2a')](function(_0x4ead9a){if(_0x4ead9a){return _0x4ead9a[_0x30ec('0x8b')](_0x2140b2['body'][_0x30ec('0x69')],_[_0x30ec('0x8c')](_0x2140b2[_0x30ec('0x53')],[_0x30ec('0x69'),'id'])||{})[_0x30ec('0x8d')](function(_0x3989de){for(var _0x99699f=0x0;_0x99699f<_0x2140b2[_0x30ec('0x53')]['ids'][_0x30ec('0x3e')];_0x99699f+=0x1){socket[_0x30ec('0x71')](_0x30ec('0x72'),{'UserId':Number(_0x2140b2[_0x30ec('0x53')]['ids'][_0x99699f]),'WhatsappQueueId':Number(_0x2140b2[_0x30ec('0x50')]['id'])});}return _0x3989de;});}})[_0x30ec('0x2a')](respondWithResult(_0x115c55,null))['catch'](handleError(_0x115c55,null));};exports['removeAgents']=function(_0x40191e,_0xebc08c,_0x51a0d6){return db[_0x30ec('0x34')][_0x30ec('0x51')]({'where':{'id':_0x40191e[_0x30ec('0x50')]['id']}})[_0x30ec('0x2a')](handleEntityNotFound(_0xebc08c,null))[_0x30ec('0x2a')](function(_0x2ccb1d){if(_0x2ccb1d){return _0x2ccb1d[_0x30ec('0x88')](_0x40191e[_0x30ec('0x39')][_0x30ec('0x69')])[_0x30ec('0x2a')](function(){if(_[_0x30ec('0x8e')](_0x40191e[_0x30ec('0x39')][_0x30ec('0x69')])){for(var _0x34b18e=0x0;_0x34b18e<_0x40191e['query'][_0x30ec('0x69')]['length'];_0x34b18e+=0x1){socket[_0x30ec('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x40191e[_0x30ec('0x39')][_0x30ec('0x69')][_0x34b18e]),'WhatsappQueueId':Number(_0x40191e[_0x30ec('0x50')]['id'])});}}else{socket[_0x30ec('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x40191e['query']['ids']),'WhatsappQueueId':Number(_0x40191e['params']['id'])});}});}})[_0x30ec('0x2a')](respondWithStatusCode(_0xebc08c,null))[_0x30ec('0x4e')](handleError(_0xebc08c,null));};exports['getAgents']=function(_0x54a6a2,_0x33803e,_0x3a728f){var _0x2cabc2={};var _0x4aef79={};var _0x229afe;var _0x356e58;return db[_0x30ec('0x34')][_0x30ec('0x5c')]({'where':{'id':_0x54a6a2[_0x30ec('0x50')]['id']}})[_0x30ec('0x2a')](handleEntityNotFound(_0x33803e,null))[_0x30ec('0x2a')](function(_0x407333){if(_0x407333){_0x229afe=_0x407333;_0x4aef79[_0x30ec('0x37')]=_[_0x30ec('0x38')](db['User'][_0x30ec('0x35')]);_0x4aef79[_0x30ec('0x39')]=_[_0x30ec('0x38')](_0x54a6a2[_0x30ec('0x39')]);_0x4aef79[_0x30ec('0x3a')]=_[_0x30ec('0x3b')](_0x4aef79[_0x30ec('0x37')],_0x4aef79[_0x30ec('0x39')]);_0x2cabc2[_0x30ec('0x3c')]=_['intersection'](_0x4aef79['model'],qs[_0x30ec('0x3d')](_0x54a6a2['query'][_0x30ec('0x3d')]));_0x2cabc2[_0x30ec('0x3c')]=_0x2cabc2[_0x30ec('0x3c')][_0x30ec('0x3e')]?_0x2cabc2[_0x30ec('0x3c')]:_0x4aef79[_0x30ec('0x37')];_0x2cabc2[_0x30ec('0x41')]=qs[_0x30ec('0x42')](_0x54a6a2[_0x30ec('0x39')][_0x30ec('0x42')]);_0x2cabc2[_0x30ec('0x43')]=qs[_0x30ec('0x3a')](_[_0x30ec('0x44')](_0x54a6a2[_0x30ec('0x39')],_0x4aef79[_0x30ec('0x3a')]));if(_0x54a6a2[_0x30ec('0x39')][_0x30ec('0x45')]){_0x2cabc2[_0x30ec('0x43')]=_[_0x30ec('0x46')](_0x2cabc2[_0x30ec('0x43')],{'$or':_['map'](_0x2cabc2['attributes'],function(_0x575239){var _0x5684b0={};_0x5684b0[_0x575239]={'$like':'%'+_0x54a6a2[_0x30ec('0x39')][_0x30ec('0x45')]+'%'};return _0x5684b0;})});}_0x2cabc2=_[_0x30ec('0x46')]({},_0x2cabc2,_0x54a6a2[_0x30ec('0x49')]);return _0x229afe[_0x30ec('0x8f')](_0x2cabc2);}})[_0x30ec('0x2a')](function(_0x3750c7){if(_0x3750c7){_0x356e58=_0x3750c7[_0x30ec('0x3e')];if(!_0x54a6a2[_0x30ec('0x39')][_0x30ec('0x3f')](_0x30ec('0x40'))){_0x2cabc2[_0x30ec('0x23')]=qs['limit'](_0x54a6a2['query']['limit']);_0x2cabc2[_0x30ec('0x20')]=qs[_0x30ec('0x20')](_0x54a6a2[_0x30ec('0x39')]['offset']);}return _0x229afe[_0x30ec('0x8f')](_0x2cabc2);}})['then'](function(_0x10e407){if(_0x10e407){return _0x10e407?{'count':_0x356e58,'rows':_0x10e407}:null;}})['then'](respondWithResult(_0x33803e,null))[_0x30ec('0x4e')](handleError(_0x33803e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 50f3e6a..e8b119f 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 _0x0892=['../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x0892,0x128));var _0x2089=function(_0x4006d7,_0x561860){_0x4006d7=_0x4006d7-0x0;var _0x569522=_0x0892[_0x4006d7];return _0x569522;};'use strict';var EventEmitter=require(_0x2089('0x0'));var WhatsappQueue=require(_0x2089('0x1'))['db'][_0x2089('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2089('0x3')](0x0);var events={'afterCreate':_0x2089('0x4'),'afterUpdate':_0x2089('0x5'),'afterDestroy':'remove'};function emitEvent(_0xb83cac){return function(_0xfbbbdd,_0x5be6e9,_0x81f104){WhatsappQueueEvents[_0x2089('0x6')](_0xb83cac+':'+_0xfbbbdd['id'],_0xfbbbdd);WhatsappQueueEvents['emit'](_0xb83cac,_0xfbbbdd);_0x81f104(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x2089('0x7')](e,emitEvent(event));}}module[_0x2089('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x5b48=['events','WhatsappQueue','update','remove','emit','hook','exports'];(function(_0x392d53,_0x2ceef6){var _0xef3f70=function(_0x377dcc){while(--_0x377dcc){_0x392d53['push'](_0x392d53['shift']());}};_0xef3f70(++_0x2ceef6);}(_0x5b48,0x10a));var _0x85b4=function(_0x300b26,_0x3a9b67){_0x300b26=_0x300b26-0x0;var _0x5cb1ae=_0x5b48[_0x300b26];return _0x5cb1ae;};'use strict';var EventEmitter=require(_0x85b4('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x85b4('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x85b4('0x2'),'afterDestroy':_0x85b4('0x3')};function emitEvent(_0x53bd26){return function(_0x3509c3,_0x1f61bc,_0x3fdcc5){WhatsappQueueEvents['emit'](_0x53bd26+':'+_0x3509c3['id'],_0x3509c3);WhatsappQueueEvents[_0x85b4('0x4')](_0x53bd26,_0x3509c3);_0x3fdcc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x85b4('0x5')](e,emitEvent(event));}}module[_0x85b4('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8b5e3e9..153dfa0 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 _0xa399=['bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','../../config/logger'];(function(_0x43f77e,_0x28d344){var _0xd6eb0d=function(_0x2d8cd8){while(--_0x2d8cd8){_0x43f77e['push'](_0x43f77e['shift']());}};_0xd6eb0d(++_0x28d344);}(_0xa399,0x8a));var _0x9a39=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xa399[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x9a39('0x0'));var util=require('util');var logger=require(_0x9a39('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9a39('0x2'));var rp=require(_0x9a39('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a39('0x4'));var config=require(_0x9a39('0x5'));var attributes=require(_0x9a39('0x6'));module[_0x9a39('0x7')]=function(_0x39e907,_0x3bc0e5){return _0x39e907[_0x9a39('0x8')]('WhatsappQueue',attributes,{'tableName':_0x9a39('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3868=['bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x9e6237,_0x21fefa){var _0x5e1124=function(_0x3b5437){while(--_0x3b5437){_0x9e6237['push'](_0x9e6237['shift']());}};_0x5e1124(++_0x21fefa);}(_0x3868,0xe0));var _0x8386=function(_0x420050,_0x3903e9){_0x420050=_0x420050-0x0;var _0x3e2a3c=_0x3868[_0x420050];return _0x3e2a3c;};'use strict';var _=require(_0x8386('0x0'));var util=require(_0x8386('0x1'));var logger=require(_0x8386('0x2'))(_0x8386('0x3'));var moment=require('moment');var BPromise=require(_0x8386('0x4'));var rp=require(_0x8386('0x5'));var fs=require('fs');var path=require(_0x8386('0x6'));var rimraf=require(_0x8386('0x7'));var config=require('../../config/environment');var attributes=require(_0x8386('0x8'));module[_0x8386('0x9')]=function(_0x3dc9b6,_0x2a6c34){return _0x3dc9b6['define'](_0x8386('0xa'),attributes,{'tableName':_0x8386('0xb'),'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 1b0875c..0ab404c 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 _0x4142=['moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','include','model','map','catch','find','raw','ShowWhatsappQueue'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4142,0x1a4));var _0x2414=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4142[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2414('0x0'));var BPromise=require(_0x2414('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2414('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2414('0x3'))('rpc');var config=require(_0x2414('0x4'));var jayson=require(_0x2414('0x5'));var client=jayson[_0x2414('0x6')][_0x2414('0x7')]({'port':0x232a});config[_0x2414('0x8')]=_[_0x2414('0x9')](config[_0x2414('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2414('0xa'))(new Redis(config[_0x2414('0x8')]));require(_0x2414('0xb'))[_0x2414('0xc')](socket);function respondWithRpcPromise(_0x5cd5fb,_0x17d376,_0x14c5ec){return new BPromise(function(_0x2b55d5,_0x54149f){return client['request'](_0x5cd5fb,_0x14c5ec)[_0x2414('0xd')](function(_0x7d1f36){logger[_0x2414('0xe')](_0x2414('0xf'),_0x17d376,'request\x20sent');logger[_0x2414('0x10')](_0x2414('0x11'),_0x17d376,_0x2414('0x12'),JSON[_0x2414('0x13')](_0x7d1f36));if(_0x7d1f36[_0x2414('0x14')]){if(_0x7d1f36[_0x2414('0x14')]['code']===0x1f4){logger['error'](_0x2414('0xf'),_0x17d376,_0x7d1f36[_0x2414('0x14')]['message']);return _0x54149f(_0x7d1f36[_0x2414('0x14')][_0x2414('0x15')]);}logger[_0x2414('0x14')](_0x2414('0xf'),_0x17d376,_0x7d1f36['error'][_0x2414('0x15')]);return _0x2b55d5(_0x7d1f36[_0x2414('0x14')][_0x2414('0x15')]);}else{logger[_0x2414('0xe')](_0x2414('0xf'),_0x17d376,'request\x20sent');_0x2b55d5(_0x7d1f36['result'][_0x2414('0x15')]);}})['catch'](function(_0x2cb429){logger[_0x2414('0x14')](_0x2414('0xf'),_0x17d376,_0x2cb429);_0x54149f(_0x2cb429);});});}exports[_0x2414('0x16')]=function(_0x105538){var _0x14932b=this;return new Promise(function(_0x1c05af,_0x46b317){return db[_0x2414('0x17')]['findAll']({'raw':_0x105538[_0x2414('0x18')]?_0x105538[_0x2414('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x105538['options']?_0x105538[_0x2414('0x18')][_0x2414('0x19')]||null:null,'attributes':_0x105538[_0x2414('0x18')]?_0x105538[_0x2414('0x18')][_0x2414('0x1a')]||null:null,'limit':_0x105538[_0x2414('0x18')]?_0x105538[_0x2414('0x18')][_0x2414('0x1b')]||null:null,'include':_0x105538['options']?_0x105538['options'][_0x2414('0x1c')]?_['map'](_0x105538['options'][_0x2414('0x1c')],function(_0x55e4dd){return{'model':db[_0x55e4dd[_0x2414('0x1d')]],'as':_0x55e4dd['as'],'attributes':_0x55e4dd[_0x2414('0x1a')],'include':_0x55e4dd[_0x2414('0x1c')]?_['map'](_0x55e4dd['include'],function(_0x3c3524){return{'model':db[_0x3c3524[_0x2414('0x1d')]],'as':_0x3c3524['as'],'attributes':_0x3c3524['attributes'],'include':_0x3c3524['include']?_[_0x2414('0x1e')](_0x3c3524[_0x2414('0x1c')],function(_0x2281c7){return{'model':db[_0x2281c7['model']],'as':_0x2281c7['as'],'attributes':_0x2281c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x2414('0xd')](function(_0x29ef73){logger[_0x2414('0xe')](_0x2414('0x16'),_0x105538);logger[_0x2414('0x10')](_0x2414('0x16'),_0x105538,JSON['stringify'](_0x29ef73));_0x1c05af(_0x29ef73);})[_0x2414('0x1f')](function(_0x30dad9){logger[_0x2414('0x14')](_0x2414('0x16'),_0x30dad9[_0x2414('0x15')],_0x105538);_0x46b317(_0x14932b[_0x2414('0x14')](0x1f4,_0x30dad9['message']));});});};exports['ShowWhatsappQueue']=function(_0x3d2e9d){var _0x250b59=this;return new Promise(function(_0x5cee31,_0x24ad08){return db[_0x2414('0x17')][_0x2414('0x20')]({'raw':_0x3d2e9d[_0x2414('0x18')]?_0x3d2e9d['options'][_0x2414('0x21')]===undefined?!![]:![]:!![],'where':_0x3d2e9d[_0x2414('0x18')]?_0x3d2e9d[_0x2414('0x18')][_0x2414('0x19')]||null:null,'attributes':_0x3d2e9d['options']?_0x3d2e9d[_0x2414('0x18')][_0x2414('0x1a')]||null:null,'include':_0x3d2e9d['options']?_0x3d2e9d[_0x2414('0x18')][_0x2414('0x1c')]?_[_0x2414('0x1e')](_0x3d2e9d[_0x2414('0x18')][_0x2414('0x1c')],function(_0x351e1f){return{'model':db[_0x351e1f[_0x2414('0x1d')]],'as':_0x351e1f['as'],'attributes':_0x351e1f[_0x2414('0x1a')],'include':_0x351e1f[_0x2414('0x1c')]?_[_0x2414('0x1e')](_0x351e1f[_0x2414('0x1c')],function(_0x52cc3e){return{'model':db[_0x52cc3e[_0x2414('0x1d')]],'as':_0x52cc3e['as'],'attributes':_0x52cc3e['attributes'],'include':_0x52cc3e['include']?_[_0x2414('0x1e')](_0x52cc3e[_0x2414('0x1c')],function(_0x546fa6){return{'model':db[_0x546fa6[_0x2414('0x1d')]],'as':_0x546fa6['as'],'attributes':_0x546fa6['attributes']};}):[]};}):[]};}):[]:[]})[_0x2414('0xd')](function(_0x4309ab){logger[_0x2414('0xe')](_0x2414('0x22'),_0x3d2e9d);logger[_0x2414('0x10')]('ShowWhatsappQueue',_0x3d2e9d,JSON[_0x2414('0x13')](_0x4309ab));_0x5cee31(_0x4309ab);})[_0x2414('0x1f')](function(_0x4ea10a){logger[_0x2414('0x14')](_0x2414('0x22'),_0x4ea10a['message'],_0x3d2e9d);_0x24ad08(_0x250b59[_0x2414('0x14')](0x1f4,_0x4ea10a['message']));});});}; \ No newline at end of file +var _0x0778=['WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x0778,0x1b5));var _0x8077=function(_0x53e37a,_0x1528b9){_0x53e37a=_0x53e37a-0x0;var _0x53e8da=_0x0778[_0x53e37a];return _0x53e8da;};'use strict';var _=require(_0x8077('0x0'));var util=require(_0x8077('0x1'));var moment=require(_0x8077('0x2'));var BPromise=require(_0x8077('0x3'));var rs=require(_0x8077('0x4'));var fs=require('fs');var Redis=require(_0x8077('0x5'));var db=require(_0x8077('0x6'))['db'];var utils=require(_0x8077('0x7'));var logger=require(_0x8077('0x8'))(_0x8077('0x9'));var config=require(_0x8077('0xa'));var jayson=require(_0x8077('0xb'));var client=jayson[_0x8077('0xc')][_0x8077('0xd')]({'port':0x232a});config[_0x8077('0xe')]=_['defaults'](config[_0x8077('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8077('0xf'))[_0x8077('0x10')](socket);function respondWithRpcPromise(_0x47ee09,_0x137692,_0x3385a0){return new BPromise(function(_0x323608,_0x513666){return client[_0x8077('0x11')](_0x47ee09,_0x3385a0)[_0x8077('0x12')](function(_0x577358){logger[_0x8077('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x137692,_0x8077('0x14'));logger[_0x8077('0x15')](_0x8077('0x16'),_0x137692,'request\x20sent',JSON[_0x8077('0x17')](_0x577358));if(_0x577358[_0x8077('0x18')]){if(_0x577358[_0x8077('0x18')]['code']===0x1f4){logger['error'](_0x8077('0x19'),_0x137692,_0x577358['error']['message']);return _0x513666(_0x577358[_0x8077('0x18')][_0x8077('0x1a')]);}logger[_0x8077('0x18')](_0x8077('0x19'),_0x137692,_0x577358['error'][_0x8077('0x1a')]);return _0x323608(_0x577358[_0x8077('0x18')][_0x8077('0x1a')]);}else{logger[_0x8077('0x13')](_0x8077('0x19'),_0x137692,_0x8077('0x14'));_0x323608(_0x577358[_0x8077('0x1b')][_0x8077('0x1a')]);}})[_0x8077('0x1c')](function(_0x3d5a7b){logger['error'](_0x8077('0x19'),_0x137692,_0x3d5a7b);_0x513666(_0x3d5a7b);});});}exports[_0x8077('0x1d')]=function(_0x6205f8){var _0x2a024e=this;return new Promise(function(_0x334e2a,_0x20d25f){return db['WhatsappQueue'][_0x8077('0x1e')]({'raw':_0x6205f8[_0x8077('0x1f')]?_0x6205f8[_0x8077('0x1f')][_0x8077('0x20')]===undefined?!![]:![]:!![],'where':_0x6205f8[_0x8077('0x1f')]?_0x6205f8[_0x8077('0x1f')][_0x8077('0x21')]||null:null,'attributes':_0x6205f8['options']?_0x6205f8[_0x8077('0x1f')][_0x8077('0x22')]||null:null,'limit':_0x6205f8['options']?_0x6205f8['options'][_0x8077('0x23')]||null:null,'include':_0x6205f8[_0x8077('0x1f')]?_0x6205f8[_0x8077('0x1f')][_0x8077('0x24')]?_[_0x8077('0x25')](_0x6205f8[_0x8077('0x1f')][_0x8077('0x24')],function(_0x2c16eb){return{'model':db[_0x2c16eb[_0x8077('0x26')]],'as':_0x2c16eb['as'],'attributes':_0x2c16eb[_0x8077('0x22')],'include':_0x2c16eb[_0x8077('0x24')]?_['map'](_0x2c16eb['include'],function(_0x585eb1){return{'model':db[_0x585eb1[_0x8077('0x26')]],'as':_0x585eb1['as'],'attributes':_0x585eb1['attributes'],'include':_0x585eb1[_0x8077('0x24')]?_[_0x8077('0x25')](_0x585eb1[_0x8077('0x24')],function(_0x58e4a9){return{'model':db[_0x58e4a9[_0x8077('0x26')]],'as':_0x58e4a9['as'],'attributes':_0x58e4a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x8077('0x12')](function(_0x472e7c){logger[_0x8077('0x13')](_0x8077('0x1d'),_0x6205f8);logger[_0x8077('0x15')](_0x8077('0x1d'),_0x6205f8,JSON[_0x8077('0x17')](_0x472e7c));_0x334e2a(_0x472e7c);})[_0x8077('0x1c')](function(_0x3b4a54){logger[_0x8077('0x18')]('GetWhatsappQueue',_0x3b4a54[_0x8077('0x1a')],_0x6205f8);_0x20d25f(_0x2a024e['error'](0x1f4,_0x3b4a54[_0x8077('0x1a')]));});});};exports[_0x8077('0x27')]=function(_0x58230c){var _0x124299=this;return new Promise(function(_0x3d971e,_0x16d93d){return db[_0x8077('0x28')][_0x8077('0x29')]({'raw':_0x58230c[_0x8077('0x1f')]?_0x58230c[_0x8077('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x58230c['options']?_0x58230c[_0x8077('0x1f')][_0x8077('0x21')]||null:null,'attributes':_0x58230c[_0x8077('0x1f')]?_0x58230c[_0x8077('0x1f')]['attributes']||null:null,'include':_0x58230c[_0x8077('0x1f')]?_0x58230c[_0x8077('0x1f')][_0x8077('0x24')]?_[_0x8077('0x25')](_0x58230c[_0x8077('0x1f')][_0x8077('0x24')],function(_0x49f3a){return{'model':db[_0x49f3a[_0x8077('0x26')]],'as':_0x49f3a['as'],'attributes':_0x49f3a['attributes'],'include':_0x49f3a[_0x8077('0x24')]?_[_0x8077('0x25')](_0x49f3a[_0x8077('0x24')],function(_0x3314d0){return{'model':db[_0x3314d0[_0x8077('0x26')]],'as':_0x3314d0['as'],'attributes':_0x3314d0[_0x8077('0x22')],'include':_0x3314d0[_0x8077('0x24')]?_[_0x8077('0x25')](_0x3314d0[_0x8077('0x24')],function(_0x324ee2){return{'model':db[_0x324ee2['model']],'as':_0x324ee2['as'],'attributes':_0x324ee2[_0x8077('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8077('0x12')](function(_0x32bbd8){logger[_0x8077('0x13')](_0x8077('0x27'),_0x58230c);logger['debug'](_0x8077('0x27'),_0x58230c,JSON[_0x8077('0x17')](_0x32bbd8));_0x3d971e(_0x32bbd8);})[_0x8077('0x1c')](function(_0x386ca3){logger[_0x8077('0x18')](_0x8077('0x27'),_0x386ca3[_0x8077('0x1a')],_0x58230c);_0x16d93d(_0x124299[_0x8077('0x18')](0x1f4,_0x386ca3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 6a53327..a818876 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 _0x0da4=['update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0da4,0x16d));var _0x40da=function(_0x4bf923,_0x177293){_0x4bf923=_0x4bf923-0x0;var _0x22c595=_0x0da4[_0x4bf923];return _0x22c595;};'use strict';var WhatsappQueueEvents=require(_0x40da('0x0'));var events=[_0x40da('0x1'),_0x40da('0x2'),_0x40da('0x3')];function createListener(_0x3394f7,_0x44e4ec){return function(_0x20a668){_0x44e4ec['emit'](_0x3394f7,_0x20a668);};}function removeListener(_0x50caca,_0x40d61a){return function(){WhatsappQueueEvents[_0x40da('0x4')](_0x50caca,_0x40d61a);};}exports[_0x40da('0x5')]=function(_0xeeddbd){for(var _0xef296e=0x0,_0x2565ee=events[_0x40da('0x6')];_0xef296e<_0x2565ee;_0xef296e++){var _0x23ae9a=events[_0xef296e];var _0xf74c49=createListener(_0x40da('0x7')+_0x23ae9a,_0xeeddbd);WhatsappQueueEvents['on'](_0x23ae9a,_0xf74c49);}}; \ No newline at end of file +var _0x3158=['removeListener','register','length','whatsappQueue:','save','remove','update'];(function(_0x4642a1,_0x5cae98){var _0x4735ff=function(_0x246f5e){while(--_0x246f5e){_0x4642a1['push'](_0x4642a1['shift']());}};_0x4735ff(++_0x5cae98);}(_0x3158,0xd6));var _0x8315=function(_0x25a024,_0x37572c){_0x25a024=_0x25a024-0x0;var _0xff971b=_0x3158[_0x25a024];return _0xff971b;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x8315('0x0'),_0x8315('0x1'),_0x8315('0x2')];function createListener(_0x4e5658,_0xca3172){return function(_0x439e5d){_0xca3172['emit'](_0x4e5658,_0x439e5d);};}function removeListener(_0x3132b0,_0x20dbaf){return function(){WhatsappQueueEvents[_0x8315('0x3')](_0x3132b0,_0x20dbaf);};}exports[_0x8315('0x4')]=function(_0x26cbde){for(var _0x48a6e0=0x0,_0x3a307a=events[_0x8315('0x5')];_0x48a6e0<_0x3a307a;_0x48a6e0++){var _0x375cf8=events[_0x48a6e0];var _0x5d9bb4=createListener(_0x8315('0x6')+_0x375cf8,_0x26cbde);WhatsappQueueEvents['on'](_0x375cf8,_0x5d9bb4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 067f29c..06c2be7 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 _0xe824=['post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x50efae,_0x4f82a2){var _0x4b6a4d=function(_0x217d94){while(--_0x217d94){_0x50efae['push'](_0x50efae['shift']());}};_0x4b6a4d(++_0x4f82a2);}(_0xe824,0xcc));var _0x4e82=function(_0x32b248,_0x4e4850){_0x32b248=_0x32b248-0x0;var _0x1634c4=_0xe824[_0x32b248];return _0x1634c4;};'use strict';var multer=require(_0x4e82('0x0'));var util=require(_0x4e82('0x1'));var path=require(_0x4e82('0x2'));var timeout=require(_0x4e82('0x3'));var express=require(_0x4e82('0x4'));var router=express[_0x4e82('0x5')]();var fs_extra=require(_0x4e82('0x6'));var auth=require(_0x4e82('0x7'));var interaction=require(_0x4e82('0x8'));var config=require(_0x4e82('0x9'));var controller=require(_0x4e82('0xa'));router[_0x4e82('0xb')]('/',auth[_0x4e82('0xc')](),controller['index']);router['get'](_0x4e82('0xd'),auth[_0x4e82('0xc')](),controller['describe']);router[_0x4e82('0xb')](_0x4e82('0xe'),auth[_0x4e82('0xc')](),controller[_0x4e82('0xf')]);router[_0x4e82('0x10')]('/',auth[_0x4e82('0xc')](),controller['create']);router['put'](_0x4e82('0xe'),auth[_0x4e82('0xc')](),controller[_0x4e82('0x11')]);router[_0x4e82('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4e82('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc922=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x3aacb9,_0x53b782){var _0x5cdfbe=function(_0x599b7f){while(--_0x599b7f){_0x3aacb9['push'](_0x3aacb9['shift']());}};_0x5cdfbe(++_0x53b782);}(_0xc922,0x1a6));var _0x2c92=function(_0xc65683,_0x13befc){_0xc65683=_0xc65683-0x0;var _0x22891b=_0xc922[_0xc65683];return _0x22891b;};'use strict';var multer=require(_0x2c92('0x0'));var util=require(_0x2c92('0x1'));var path=require(_0x2c92('0x2'));var timeout=require(_0x2c92('0x3'));var express=require('express');var router=express[_0x2c92('0x4')]();var fs_extra=require(_0x2c92('0x5'));var auth=require(_0x2c92('0x6'));var interaction=require(_0x2c92('0x7'));var config=require(_0x2c92('0x8'));var controller=require(_0x2c92('0x9'));router[_0x2c92('0xa')]('/',auth[_0x2c92('0xb')](),controller[_0x2c92('0xc')]);router[_0x2c92('0xa')](_0x2c92('0xd'),auth[_0x2c92('0xb')](),controller['describe']);router[_0x2c92('0xa')](_0x2c92('0xe'),auth[_0x2c92('0xb')](),controller[_0x2c92('0xf')]);router[_0x2c92('0x10')]('/',auth[_0x2c92('0xb')](),controller[_0x2c92('0x11')]);router[_0x2c92('0x12')](_0x2c92('0xe'),auth[_0x2c92('0xb')](),controller[_0x2c92('0x13')]);router[_0x2c92('0x14')](_0x2c92('0xe'),auth['isAuthenticated'](),controller[_0x2c92('0x15')]);module[_0x2c92('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 95da8b4..8729d16 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x39cbb1,_0x8a9ac7){var _0xc8149e=function(_0x4c58b9){while(--_0x4c58b9){_0x39cbb1['push'](_0x39cbb1['shift']());}};_0xc8149e(++_0x8a9ac7);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x35a58c,_0x313b09){var _0x3a26cb=function(_0x1d649a){while(--_0x1d649a){_0x35a58c['push'](_0x35a58c['shift']());}};_0x3a26cb(++_0x313b09);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index bb45acb..ac4ab91 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 _0xbfcc=['destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','then'];(function(_0x3ab147,_0x2a30ef){var _0x243fb2=function(_0x465c6c){while(--_0x465c6c){_0x3ab147['push'](_0x3ab147['shift']());}};_0x243fb2(++_0x2a30ef);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0xbfcc[_0x30b0d8];return _0x459c09;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x51284a,_0x280b78){return function(_0x75bca0){if(!_0x75bca0){_0x51284a['sendStatus'](0x194);}return _0x75bca0;};}function handleError(_0x28bdcf,_0x3b73a3){_0x3b73a3=_0x3b73a3||0x1f4;return function(_0x4ab48e){logger[_0xcbfc('0x23')](_0x4ab48e[_0xcbfc('0x24')]);if(_0x4ab48e[_0xcbfc('0x25')]){delete _0x4ab48e[_0xcbfc('0x25')];}_0x28bdcf['status'](_0x3b73a3)[_0xcbfc('0x26')](_0x4ab48e);};}exports[_0xcbfc('0x27')]=function(_0x4f632a,_0x1f6a14){var _0x26463f={},_0x7cbdfa={},_0x388d41={'count':0x0,'rows':[]};var _0x2b4286=_[_0xcbfc('0x28')](db[_0xcbfc('0x29')]['rawAttributes'],function(_0x41b68b){return{'name':_0x41b68b[_0xcbfc('0x2a')],'type':_0x41b68b[_0xcbfc('0x2b')][_0xcbfc('0x2c')]};});_0x7cbdfa['model']=_[_0xcbfc('0x28')](_0x2b4286,_0xcbfc('0x25'));_0x7cbdfa[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x4f632a[_0xcbfc('0x2d')]);_0x7cbdfa[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x7cbdfa['model'],_0x7cbdfa[_0xcbfc('0x2d')]);_0x26463f[_0xcbfc('0x31')]=_['intersection'](_0x7cbdfa[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x4f632a[_0xcbfc('0x2d')]['fields']));_0x26463f['attributes']=_0x26463f['attributes'][_0xcbfc('0x34')]?_0x26463f[_0xcbfc('0x31')]:_0x7cbdfa[_0xcbfc('0x32')];if(!_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x35')](_0xcbfc('0x36'))){_0x26463f[_0xcbfc('0x19')]=qs[_0xcbfc('0x19')](_0x4f632a['query'][_0xcbfc('0x19')]);_0x26463f[_0xcbfc('0x1b')]=qs['offset'](_0x4f632a[_0xcbfc('0x2d')]['offset']);}_0x26463f[_0xcbfc('0x37')]=qs[_0xcbfc('0x38')](_0x4f632a[_0xcbfc('0x2d')]['sort']);_0x26463f[_0xcbfc('0x39')]=qs['filters'](_['pick'](_0x4f632a[_0xcbfc('0x2d')],_0x7cbdfa[_0xcbfc('0x2f')]),_0x2b4286);if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]){_0x26463f[_0xcbfc('0x39')]=_[_0xcbfc('0x3b')](_0x26463f[_0xcbfc('0x39')],{'$or':_[_0xcbfc('0x28')](_0x2b4286,function(_0x5cf4fa){if(_0x5cf4fa[_0xcbfc('0x2b')]!=='VIRTUAL'){var _0x15a5c4={};_0x15a5c4[_0x5cf4fa[_0xcbfc('0x25')]]={'$like':'%'+_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]+'%'};return _0x15a5c4;}})});}_0x26463f=_['merge']({},_0x26463f,_0x4f632a['options']);var _0x236b66={'where':_0x26463f[_0xcbfc('0x39')]};return db[_0xcbfc('0x29')][_0xcbfc('0x1c')](_0x236b66)[_0xcbfc('0x21')](function(_0x4aa189){_0x388d41[_0xcbfc('0x1c')]=_0x4aa189;if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x26463f['include']=[{'all':!![]}];}return db[_0xcbfc('0x29')][_0xcbfc('0x3d')](_0x26463f);})[_0xcbfc('0x21')](function(_0x4ca55c){_0x388d41[_0xcbfc('0x3e')]=_0x4ca55c;return _0x388d41;})[_0xcbfc('0x21')](respondWithFilteredResult(_0x1f6a14,_0x26463f))[_0xcbfc('0x3f')](handleError(_0x1f6a14,null));};exports[_0xcbfc('0x40')]=function(_0x102f4f,_0x28447a){var _0x1e14bb={'raw':!![],'where':{'id':_0x102f4f[_0xcbfc('0x41')]['id']}},_0x561544={};_0x561544[_0xcbfc('0x32')]=_['keys'](db[_0xcbfc('0x29')][_0xcbfc('0x42')]);_0x561544[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x102f4f[_0xcbfc('0x2d')]);_0x561544[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],_0x561544['query']);_0x1e14bb[_0xcbfc('0x31')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x33')]));_0x1e14bb[_0xcbfc('0x31')]=_0x1e14bb['attributes'][_0xcbfc('0x34')]?_0x1e14bb[_0xcbfc('0x31')]:_0x561544['model'];if(_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x1e14bb[_0xcbfc('0x43')]=[{'all':!![]}];}_0x1e14bb=_['merge']({},_0x1e14bb,_0x102f4f[_0xcbfc('0x44')]);return db[_0xcbfc('0x29')][_0xcbfc('0x45')](_0x1e14bb)[_0xcbfc('0x21')](handleEntityNotFound(_0x28447a,null))[_0xcbfc('0x21')](respondWithResult(_0x28447a,null))[_0xcbfc('0x3f')](handleError(_0x28447a,null));};exports[_0xcbfc('0x46')]=function(_0x55fc0b,_0x5a87b6){return db[_0xcbfc('0x29')][_0xcbfc('0x46')](_0x55fc0b[_0xcbfc('0x47')],{})[_0xcbfc('0x21')](respondWithResult(_0x5a87b6,0xc9))['catch'](handleError(_0x5a87b6,null));};exports['update']=function(_0x2e89bf,_0xe5c5ef){if(_0x2e89bf[_0xcbfc('0x47')]['id']){delete _0x2e89bf['body']['id'];}return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0x2e89bf[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0xe5c5ef,null))[_0xcbfc('0x21')](saveUpdates(_0x2e89bf[_0xcbfc('0x47')],null))[_0xcbfc('0x21')](respondWithResult(_0xe5c5ef,null))[_0xcbfc('0x3f')](handleError(_0xe5c5ef,null));};exports[_0xcbfc('0x22')]=function(_0xd9976d,_0x222b58){return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0xd9976d[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0x222b58,null))[_0xcbfc('0x21')](removeEntity(_0x222b58,null))[_0xcbfc('0x3f')](handleError(_0x222b58,null));};exports[_0xcbfc('0x48')]=function(_0x5c2ad9,_0x28ae7f){return db[_0xcbfc('0x29')]['describe']()[_0xcbfc('0x21')](respondWithResult(_0x28ae7f,null))[_0xcbfc('0x3f')](handleError(_0x28ae7f,null));}; \ No newline at end of file +var _0xe2cf=['body','destroy','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','WhatsappQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x2db697,_0x1aa613){var _0x4dd8d=function(_0x55c508){while(--_0x55c508){_0x2db697['push'](_0x2db697['shift']());}};_0x4dd8d(++_0x1aa613);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x8cd627,_0x1bf5ca){_0x8cd627=_0x8cd627-0x0;var _0x7e454=_0xe2cf[_0x8cd627];return _0x7e454;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe2c('0x1'));var rp=require('request-promise');var moment=require(_0xfe2c('0x2'));var BPromise=require(_0xfe2c('0x3'));var Mustache=require(_0xfe2c('0x4'));var util=require(_0xfe2c('0x5'));var path=require('path');var sox=require(_0xfe2c('0x6'));var csv=require(_0xfe2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0x7'));var querystring=require(_0xfe2c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xc'));var qs=require(_0xfe2c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xe'));var logger=require(_0xfe2c('0xf'))(_0xfe2c('0x10'));var utils=require(_0xfe2c('0x11'));var config=require(_0xfe2c('0x12'));var licenseUtil=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];function respondWithStatusCode(_0x4af8b7,_0x5e7389){_0x5e7389=_0x5e7389||0xcc;return function(_0x59ecf8){if(_0x59ecf8){return _0x4af8b7['sendStatus'](_0x5e7389);}return _0x4af8b7[_0xfe2c('0x15')](_0x5e7389)['end']();};}function respondWithResult(_0x5a6ad5,_0x38ba2c){_0x38ba2c=_0x38ba2c||0xc8;return function(_0x4d0a10){if(_0x4d0a10){return _0x5a6ad5[_0xfe2c('0x15')](_0x38ba2c)[_0xfe2c('0x16')](_0x4d0a10);}};}function respondWithFilteredResult(_0x522692,_0x5039cb){return function(_0x1a4684){if(_0x1a4684){var _0x3b3ebd=typeof _0x5039cb[_0xfe2c('0x17')]===_0xfe2c('0x18')&&typeof _0x5039cb['limit']===_0xfe2c('0x18');var _0x96a3a3=_0x1a4684[_0xfe2c('0x19')];var _0x23242b=_0x3b3ebd?0x0:_0x5039cb[_0xfe2c('0x17')];var _0x13f233=_0x3b3ebd?_0x1a4684['count']:_0x5039cb[_0xfe2c('0x17')]+_0x5039cb[_0xfe2c('0x1a')];var _0x1d7852;if(_0x13f233>=_0x96a3a3){_0x13f233=_0x96a3a3;_0x1d7852=0xc8;}else{_0x1d7852=0xce;}_0x522692[_0xfe2c('0x15')](_0x1d7852);return _0x522692['set'](_0xfe2c('0x1b'),_0x23242b+'-'+_0x13f233+'/'+_0x96a3a3)['json'](_0x1a4684);}return null;};}function patchUpdates(_0x4e9137){return function(_0x408f31){try{jsonpatch[_0xfe2c('0x1c')](_0x408f31,_0x4e9137,!![]);}catch(_0x4bf7c0){return BPromise[_0xfe2c('0x1d')](_0x4bf7c0);}return _0x408f31[_0xfe2c('0x1e')]();};}function saveUpdates(_0x5e609f,_0x1bd50e){return function(_0x5dd54b){if(_0x5dd54b){return _0x5dd54b[_0xfe2c('0x1f')](_0x5e609f)[_0xfe2c('0x20')](function(_0x8b5c0d){return _0x8b5c0d;});}return null;};}function removeEntity(_0x298819,_0x360928){return function(_0x2ee3b3){if(_0x2ee3b3){return _0x2ee3b3['destroy']()[_0xfe2c('0x20')](function(){_0x298819[_0xfe2c('0x15')](0xcc)[_0xfe2c('0x21')]();});}};}function handleEntityNotFound(_0x26448c,_0x3486b5){return function(_0x10afde){if(!_0x10afde){_0x26448c['sendStatus'](0x194);}return _0x10afde;};}function handleError(_0x205da8,_0x5e8abf){_0x5e8abf=_0x5e8abf||0x1f4;return function(_0x16daf3){logger[_0xfe2c('0x22')](_0x16daf3[_0xfe2c('0x23')]);if(_0x16daf3['name']){delete _0x16daf3[_0xfe2c('0x24')];}_0x205da8[_0xfe2c('0x15')](_0x5e8abf)['send'](_0x16daf3);};}exports[_0xfe2c('0x25')]=function(_0x1b6eb7,_0x3352e8){var _0x53a8c1={},_0x170026={},_0x1b7c91={'count':0x0,'rows':[]};var _0x55aed7=_['map'](db[_0xfe2c('0x26')][_0xfe2c('0x27')],function(_0x1a5e15){return{'name':_0x1a5e15[_0xfe2c('0x28')],'type':_0x1a5e15[_0xfe2c('0x29')]['key']};});_0x170026[_0xfe2c('0x2a')]=_[_0xfe2c('0x2b')](_0x55aed7,_0xfe2c('0x24'));_0x170026[_0xfe2c('0x2c')]=_[_0xfe2c('0x2d')](_0x1b6eb7[_0xfe2c('0x2c')]);_0x170026[_0xfe2c('0x2e')]=_[_0xfe2c('0x2f')](_0x170026[_0xfe2c('0x2a')],_0x170026[_0xfe2c('0x2c')]);_0x53a8c1[_0xfe2c('0x30')]=_[_0xfe2c('0x2f')](_0x170026['model'],qs[_0xfe2c('0x31')](_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x31')]));_0x53a8c1['attributes']=_0x53a8c1[_0xfe2c('0x30')][_0xfe2c('0x32')]?_0x53a8c1['attributes']:_0x170026[_0xfe2c('0x2a')];if(!_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x33')]('nolimit')){_0x53a8c1[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x1a')]);_0x53a8c1[_0xfe2c('0x17')]=qs[_0xfe2c('0x17')](_0x1b6eb7[_0xfe2c('0x2c')]['offset']);}_0x53a8c1['order']=qs[_0xfe2c('0x34')](_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x34')]);_0x53a8c1[_0xfe2c('0x35')]=qs['filters'](_[_0xfe2c('0x36')](_0x1b6eb7['query'],_0x170026[_0xfe2c('0x2e')]),_0x55aed7);if(_0x1b6eb7[_0xfe2c('0x2c')]['filter']){_0x53a8c1[_0xfe2c('0x35')]=_['merge'](_0x53a8c1['where'],{'$or':_[_0xfe2c('0x2b')](_0x55aed7,function(_0x3d3b5e){if(_0x3d3b5e[_0xfe2c('0x29')]!==_0xfe2c('0x37')){var _0xae2808={};_0xae2808[_0x3d3b5e[_0xfe2c('0x24')]]={'$like':'%'+_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x38')]+'%'};return _0xae2808;}})});}_0x53a8c1=_[_0xfe2c('0x39')]({},_0x53a8c1,_0x1b6eb7[_0xfe2c('0x3a')]);var _0x222335={'where':_0x53a8c1['where']};return db[_0xfe2c('0x26')][_0xfe2c('0x19')](_0x222335)[_0xfe2c('0x20')](function(_0x55ea45){_0x1b7c91['count']=_0x55ea45;if(_0x1b6eb7['query'][_0xfe2c('0x3b')]){_0x53a8c1[_0xfe2c('0x3c')]=[{'all':!![]}];}return db[_0xfe2c('0x26')][_0xfe2c('0x3d')](_0x53a8c1);})['then'](function(_0x1ed30b){_0x1b7c91[_0xfe2c('0x3e')]=_0x1ed30b;return _0x1b7c91;})[_0xfe2c('0x20')](respondWithFilteredResult(_0x3352e8,_0x53a8c1))[_0xfe2c('0x3f')](handleError(_0x3352e8,null));};exports[_0xfe2c('0x40')]=function(_0x48e361,_0x5a8d4e){var _0xeb04b9={'raw':!![],'where':{'id':_0x48e361[_0xfe2c('0x41')]['id']}},_0x6055dd={};_0x6055dd['model']=_['keys'](db[_0xfe2c('0x26')][_0xfe2c('0x27')]);_0x6055dd['query']=_[_0xfe2c('0x2d')](_0x48e361[_0xfe2c('0x2c')]);_0x6055dd[_0xfe2c('0x2e')]=_[_0xfe2c('0x2f')](_0x6055dd['model'],_0x6055dd[_0xfe2c('0x2c')]);_0xeb04b9[_0xfe2c('0x30')]=_[_0xfe2c('0x2f')](_0x6055dd[_0xfe2c('0x2a')],qs[_0xfe2c('0x31')](_0x48e361[_0xfe2c('0x2c')][_0xfe2c('0x31')]));_0xeb04b9[_0xfe2c('0x30')]=_0xeb04b9['attributes'][_0xfe2c('0x32')]?_0xeb04b9['attributes']:_0x6055dd[_0xfe2c('0x2a')];if(_0x48e361[_0xfe2c('0x2c')][_0xfe2c('0x3b')]){_0xeb04b9[_0xfe2c('0x3c')]=[{'all':!![]}];}_0xeb04b9=_['merge']({},_0xeb04b9,_0x48e361['options']);return db['WhatsappQueueReport']['find'](_0xeb04b9)['then'](handleEntityNotFound(_0x5a8d4e,null))[_0xfe2c('0x20')](respondWithResult(_0x5a8d4e,null))['catch'](handleError(_0x5a8d4e,null));};exports['create']=function(_0x22adee,_0x5d76be){return db[_0xfe2c('0x26')]['create'](_0x22adee[_0xfe2c('0x42')],{})[_0xfe2c('0x20')](respondWithResult(_0x5d76be,0xc9))[_0xfe2c('0x3f')](handleError(_0x5d76be,null));};exports[_0xfe2c('0x1f')]=function(_0x3cfda2,_0x57ad76){if(_0x3cfda2[_0xfe2c('0x42')]['id']){delete _0x3cfda2[_0xfe2c('0x42')]['id'];}return db[_0xfe2c('0x26')]['find']({'where':{'id':_0x3cfda2[_0xfe2c('0x41')]['id']}})[_0xfe2c('0x20')](handleEntityNotFound(_0x57ad76,null))['then'](saveUpdates(_0x3cfda2['body'],null))['then'](respondWithResult(_0x57ad76,null))[_0xfe2c('0x3f')](handleError(_0x57ad76,null));};exports[_0xfe2c('0x43')]=function(_0x47023e,_0x2e0012){return db[_0xfe2c('0x26')]['find']({'where':{'id':_0x47023e[_0xfe2c('0x41')]['id']}})[_0xfe2c('0x20')](handleEntityNotFound(_0x2e0012,null))[_0xfe2c('0x20')](removeEntity(_0x2e0012,null))['catch'](handleError(_0x2e0012,null));};exports['describe']=function(_0x3e7c9f,_0xa711b0){return db[_0xfe2c('0x26')][_0xfe2c('0x44')]()[_0xfe2c('0x20')](respondWithResult(_0xa711b0,null))[_0xfe2c('0x3f')](handleError(_0xa711b0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e1932b8..27426f8 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 _0x848d=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_whatsapp_queue','uniqueid','util','../../config/logger','api'];(function(_0x403214,_0x42c760){var _0x2560f3=function(_0x37ff7b){while(--_0x37ff7b){_0x403214['push'](_0x403214['shift']());}};_0x2560f3(++_0x42c760);}(_0x848d,0x1ad));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd848('0x0'));var logger=require(_0xd848('0x1'))(_0xd848('0x2'));var moment=require(_0xd848('0x3'));var BPromise=require(_0xd848('0x4'));var rp=require(_0xd848('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd848('0x6'));var config=require(_0xd848('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0xd848('0x8')]=function(_0x3b085c,_0x377ec9){return _0x3b085c[_0xd848('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0xd848('0xa'),'paranoid':![],'indexes':[{'name':_0xd848('0xb'),'fields':[_0xd848('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9d4=['./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b9332,_0x1fe7ca){var _0xa2614=function(_0x1936ab){while(--_0x1936ab){_0x3b9332['push'](_0x3b9332['shift']());}};_0xa2614(++_0x1fe7ca);}(_0xc9d4,0x171));var _0x4c9d=function(_0x5825f1,_0x5ba0e0){_0x5825f1=_0x5825f1-0x0;var _0xae4ceb=_0xc9d4[_0x5825f1];return _0xae4ceb;};'use strict';var _=require('lodash');var util=require(_0x4c9d('0x0'));var logger=require(_0x4c9d('0x1'))(_0x4c9d('0x2'));var moment=require(_0x4c9d('0x3'));var BPromise=require(_0x4c9d('0x4'));var rp=require(_0x4c9d('0x5'));var fs=require('fs');var path=require(_0x4c9d('0x6'));var rimraf=require(_0x4c9d('0x7'));var config=require(_0x4c9d('0x8'));var attributes=require(_0x4c9d('0x9'));module['exports']=function(_0x5d6954,_0x55b664){return _0x5d6954[_0x4c9d('0xa')](_0x4c9d('0xb'),attributes,{'tableName':_0x4c9d('0xc'),'paranoid':![],'indexes':[{'name':_0x4c9d('0xd'),'fields':[_0x4c9d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f28d214..4e83f55 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 _0x5e5a=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','limit','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug'];(function(_0x4bb623,_0x5e328f){var _0x12e423=function(_0x5e2d41){while(--_0x5e2d41){_0x4bb623['push'](_0x4bb623['shift']());}};_0x12e423(++_0x5e328f);}(_0x5e5a,0x188));var _0xa5e5=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x5e5a[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0xa5e5('0x0'));var moment=require(_0xa5e5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5e5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5e5('0x3'))['db'];var utils=require(_0xa5e5('0x4'));var logger=require('../../config/logger')(_0xa5e5('0x5'));var config=require(_0xa5e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa5e5('0x7')][_0xa5e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d5291,_0x4f1884,_0x296cfe){return new BPromise(function(_0x2a42f5,_0x51e125){return client[_0xa5e5('0x9')](_0x2d5291,_0x296cfe)[_0xa5e5('0xa')](function(_0x3236f2){logger[_0xa5e5('0xb')](_0xa5e5('0xc'),_0x4f1884,'request\x20sent');logger[_0xa5e5('0xd')](_0xa5e5('0xe'),_0x4f1884,_0xa5e5('0xf'),JSON[_0xa5e5('0x10')](_0x3236f2));if(_0x3236f2[_0xa5e5('0x11')]){if(_0x3236f2[_0xa5e5('0x11')]['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x4f1884,_0x3236f2['error'][_0xa5e5('0x12')]);return _0x51e125(_0x3236f2[_0xa5e5('0x11')]['message']);}logger[_0xa5e5('0x11')](_0xa5e5('0xc'),_0x4f1884,_0x3236f2['error'][_0xa5e5('0x12')]);return _0x2a42f5(_0x3236f2[_0xa5e5('0x11')]['message']);}else{logger[_0xa5e5('0xb')](_0xa5e5('0xc'),_0x4f1884,_0xa5e5('0xf'));_0x2a42f5(_0x3236f2['result'][_0xa5e5('0x12')]);}})[_0xa5e5('0x13')](function(_0x4d746d){logger[_0xa5e5('0x11')](_0xa5e5('0xc'),_0x4f1884,_0x4d746d);_0x51e125(_0x4d746d);});});}exports[_0xa5e5('0x14')]=function(_0x33d06d){var _0x45c7bb=this;return new Promise(function(_0xc7a745,_0x4866f5){return db[_0xa5e5('0x15')][_0xa5e5('0x16')](_0x33d06d[_0xa5e5('0x17')],{'raw':_0x33d06d[_0xa5e5('0x18')]?_0x33d06d['options'][_0xa5e5('0x19')]===undefined?!![]:![]:!![]})[_0xa5e5('0xa')](function(_0x172bdc){logger[_0xa5e5('0xb')]('CreateWhatsappQueueReport',_0x33d06d);logger[_0xa5e5('0xd')](_0xa5e5('0x14'),_0x33d06d,JSON[_0xa5e5('0x10')](_0x172bdc));_0xc7a745(_0x172bdc);})['catch'](function(_0x221cdd){logger['error'](_0xa5e5('0x14'),_0x221cdd['message'],_0x33d06d);_0x4866f5(_0x45c7bb[_0xa5e5('0x11')](0x1f4,_0x221cdd['message']));});});};exports[_0xa5e5('0x1a')]=function(_0x188342){var _0x130b26=this;return new Promise(function(_0x422bcf,_0x3339ab){return db[_0xa5e5('0x15')][_0xa5e5('0x1b')](_0x188342['body'],{'raw':_0x188342[_0xa5e5('0x18')]?_0x188342[_0xa5e5('0x18')][_0xa5e5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x188342[_0xa5e5('0x18')]?_0x188342[_0xa5e5('0x18')]['where']||null:null,'attributes':_0x188342['options']?_0x188342[_0xa5e5('0x18')]['attributes']||null:null,'limit':_0x188342[_0xa5e5('0x18')]?_0x188342[_0xa5e5('0x18')][_0xa5e5('0x1c')]||null:null})['then'](function(_0x57ffd8){logger['info'](_0xa5e5('0x1a'),_0x188342);logger[_0xa5e5('0xd')](_0xa5e5('0x1a'),_0x188342,JSON[_0xa5e5('0x10')](_0x57ffd8));_0x422bcf(_0x57ffd8);})[_0xa5e5('0x13')](function(_0x1e9fd7){logger[_0xa5e5('0x11')](_0xa5e5('0x1a'),_0x1e9fd7['message'],_0x188342);_0x3339ab(_0x130b26[_0xa5e5('0x11')](0x1f4,_0x1e9fd7[_0xa5e5('0x12')]));});});}; \ No newline at end of file +var _0x56e0=['update','where','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x56e0,0xb3));var _0x056e=function(_0x3e2369,_0x24d6c3){_0x3e2369=_0x3e2369-0x0;var _0x193d8e=_0x56e0[_0x3e2369];return _0x193d8e;};'use strict';var _=require(_0x056e('0x0'));var util=require(_0x056e('0x1'));var moment=require(_0x056e('0x2'));var BPromise=require(_0x056e('0x3'));var rs=require(_0x056e('0x4'));var fs=require('fs');var Redis=require(_0x056e('0x5'));var db=require(_0x056e('0x6'))['db'];var utils=require(_0x056e('0x7'));var logger=require(_0x056e('0x8'))(_0x056e('0x9'));var config=require(_0x056e('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x056e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fbcd9,_0xecc98e,_0x2c4c53){return new BPromise(function(_0x5d5a2e,_0x12ef64){return client[_0x056e('0xc')](_0x3fbcd9,_0x2c4c53)['then'](function(_0x533770){logger[_0x056e('0xd')](_0x056e('0xe'),_0xecc98e,_0x056e('0xf'));logger[_0x056e('0x10')](_0x056e('0x11'),_0xecc98e,_0x056e('0xf'),JSON[_0x056e('0x12')](_0x533770));if(_0x533770[_0x056e('0x13')]){if(_0x533770[_0x056e('0x13')][_0x056e('0x14')]===0x1f4){logger[_0x056e('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0xecc98e,_0x533770[_0x056e('0x13')][_0x056e('0x15')]);return _0x12ef64(_0x533770[_0x056e('0x13')][_0x056e('0x15')]);}logger[_0x056e('0x13')](_0x056e('0xe'),_0xecc98e,_0x533770[_0x056e('0x13')][_0x056e('0x15')]);return _0x5d5a2e(_0x533770[_0x056e('0x13')][_0x056e('0x15')]);}else{logger[_0x056e('0xd')](_0x056e('0xe'),_0xecc98e,_0x056e('0xf'));_0x5d5a2e(_0x533770[_0x056e('0x16')]['message']);}})['catch'](function(_0x4de89f){logger[_0x056e('0x13')](_0x056e('0xe'),_0xecc98e,_0x4de89f);_0x12ef64(_0x4de89f);});});}exports[_0x056e('0x17')]=function(_0x454408){var _0x198df2=this;return new Promise(function(_0xf1376,_0x394563){return db[_0x056e('0x18')][_0x056e('0x19')](_0x454408[_0x056e('0x1a')],{'raw':_0x454408[_0x056e('0x1b')]?_0x454408[_0x056e('0x1b')][_0x056e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x20d01a){logger['info'](_0x056e('0x17'),_0x454408);logger[_0x056e('0x10')](_0x056e('0x17'),_0x454408,JSON[_0x056e('0x12')](_0x20d01a));_0xf1376(_0x20d01a);})[_0x056e('0x1d')](function(_0x122fef){logger[_0x056e('0x13')](_0x056e('0x17'),_0x122fef[_0x056e('0x15')],_0x454408);_0x394563(_0x198df2[_0x056e('0x13')](0x1f4,_0x122fef[_0x056e('0x15')]));});});};exports[_0x056e('0x1e')]=function(_0x18673e){var _0x9d035c=this;return new Promise(function(_0x2e0479,_0x452d5a){return db['WhatsappQueueReport'][_0x056e('0x1f')](_0x18673e[_0x056e('0x1a')],{'raw':_0x18673e[_0x056e('0x1b')]?_0x18673e[_0x056e('0x1b')][_0x056e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18673e[_0x056e('0x1b')]?_0x18673e[_0x056e('0x1b')][_0x056e('0x20')]||null:null,'attributes':_0x18673e[_0x056e('0x1b')]?_0x18673e[_0x056e('0x1b')]['attributes']||null:null,'limit':_0x18673e['options']?_0x18673e[_0x056e('0x1b')][_0x056e('0x21')]||null:null})[_0x056e('0x22')](function(_0x5ec71b){logger['info'](_0x056e('0x1e'),_0x18673e);logger['debug'](_0x056e('0x1e'),_0x18673e,JSON[_0x056e('0x12')](_0x5ec71b));_0x2e0479(_0x5ec71b);})['catch'](function(_0x5768a6){logger[_0x056e('0x13')](_0x056e('0x1e'),_0x5768a6[_0x056e('0x15')],_0x18673e);_0x452d5a(_0x9d035c[_0x056e('0x13')](0x1f4,_0x5768a6[_0x056e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index fc7e89c..4dcc782 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 _0xa610=['fs-extra','../../components/auth/service','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x111c47,_0x2c867b){var _0x30790f=function(_0x1e5ca3){while(--_0x1e5ca3){_0x111c47['push'](_0x111c47['shift']());}};_0x30790f(++_0x2c867b);}(_0xa610,0x18a));var _0x0a61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa610[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0a61('0x0'));var util=require(_0x0a61('0x1'));var path=require(_0x0a61('0x2'));var timeout=require(_0x0a61('0x3'));var express=require(_0x0a61('0x4'));var router=express[_0x0a61('0x5')]();var fs_extra=require(_0x0a61('0x6'));var auth=require(_0x0a61('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a61('0x8'));router['get']('/',auth[_0x0a61('0x9')](),controller[_0x0a61('0xa')]);router[_0x0a61('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x0a61('0xc')]);router[_0x0a61('0xb')]('/:id',auth[_0x0a61('0x9')](),controller[_0x0a61('0xd')]);router[_0x0a61('0xe')]('/',auth[_0x0a61('0x9')](),controller[_0x0a61('0xf')]);router[_0x0a61('0x10')](_0x0a61('0x11'),auth[_0x0a61('0x9')](),controller['update']);router['delete'](_0x0a61('0x11'),auth[_0x0a61('0x9')](),controller[_0x0a61('0x12')]);module[_0x0a61('0x13')]=router; \ No newline at end of file +var _0x30a3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x30a3,0x162));var _0x330a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x330a('0x0'));var util=require(_0x330a('0x1'));var path=require(_0x330a('0x2'));var timeout=require(_0x330a('0x3'));var express=require(_0x330a('0x4'));var router=express[_0x330a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x330a('0x6'));var interaction=require(_0x330a('0x7'));var config=require('../../config/environment');var controller=require(_0x330a('0x8'));router[_0x330a('0x9')]('/',auth[_0x330a('0xa')](),controller['index']);router[_0x330a('0x9')]('/describe',auth[_0x330a('0xa')](),controller[_0x330a('0xb')]);router[_0x330a('0x9')](_0x330a('0xc'),auth['isAuthenticated'](),controller[_0x330a('0xd')]);router[_0x330a('0xe')]('/',auth[_0x330a('0xa')](),controller[_0x330a('0xf')]);router[_0x330a('0x10')](_0x330a('0xc'),auth[_0x330a('0xa')](),controller[_0x330a('0x11')]);router[_0x330a('0x12')](_0x330a('0xc'),auth['isAuthenticated'](),controller[_0x330a('0x13')]);module[_0x330a('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 6887717..9fe1467 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 _0xb12d=['STRING','account','queue','DATE','sequelize','exports'];(function(_0x4929d0,_0x41f231){var _0x9163b4=function(_0x352ca6){while(--_0x352ca6){_0x4929d0['push'](_0x4929d0['shift']());}};_0x9163b4(++_0x41f231);}(_0xb12d,0x124));var _0xdb12=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0xb12d[_0x38987f];return _0x4cb697;};'use strict';var Sequelize=require(_0xdb12('0x0'));module[_0xdb12('0x1')]={'uniqueid':{'type':Sequelize[_0xdb12('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdb12('0x3'),'agent',_0xdb12('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xdb12('0x5')]}}; \ No newline at end of file +var _0xb515=['STRING','ENUM','account','agent','queue','DATE','sequelize'];(function(_0x2b3ddc,_0x19a52d){var _0x5a71ec=function(_0x50b962){while(--_0x50b962){_0x2b3ddc['push'](_0x2b3ddc['shift']());}};_0x5a71ec(++_0x19a52d);}(_0xb515,0x1b8));var _0x5b51=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xb515[_0x2de0a7];return _0x429437;};'use strict';var Sequelize=require(_0x5b51('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5b51('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5b51('0x2')](_0x5b51('0x3'),_0x5b51('0x4'),_0x5b51('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x5b51('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d88fe72..493b2ab 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 _0x0b63=['query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','options','WhatsappTransferReport','includeAll','include','rows','catch','params','fields','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','type','key','model','map'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x0b63,0xe7));var _0x30b6=function(_0x14e3b3,_0x5c82ee){_0x14e3b3=_0x14e3b3-0x0;var _0x2df313=_0x0b63[_0x14e3b3];return _0x2df313;};'use strict';var emlformat=require(_0x30b6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30b6('0x1'));var rp=require(_0x30b6('0x2'));var moment=require(_0x30b6('0x3'));var BPromise=require(_0x30b6('0x4'));var Mustache=require('mustache');var util=require(_0x30b6('0x5'));var path=require(_0x30b6('0x6'));var sox=require(_0x30b6('0x7'));var csv=require(_0x30b6('0x8'));var ejs=require(_0x30b6('0x9'));var fs=require('fs');var fs_extra=require(_0x30b6('0xa'));var _=require('lodash');var squel=require(_0x30b6('0xb'));var crypto=require('crypto');var jsforce=require(_0x30b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x30b6('0x8'));var querystring=require(_0x30b6('0xd'));var Papa=require('papaparse');var Redis=require(_0x30b6('0xe'));var authService=require(_0x30b6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x30b6('0x10'));var hardwareService=require(_0x30b6('0x11'));var logger=require(_0x30b6('0x12'))(_0x30b6('0x13'));var utils=require(_0x30b6('0x14'));var config=require(_0x30b6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x30b6('0x16'))['db'];function respondWithStatusCode(_0x208a24,_0x21934b){_0x21934b=_0x21934b||0xcc;return function(_0x3b7d76){if(_0x3b7d76){return _0x208a24['sendStatus'](_0x21934b);}return _0x208a24[_0x30b6('0x17')](_0x21934b)['end']();};}function respondWithResult(_0x5f0ad7,_0x32ffcf){_0x32ffcf=_0x32ffcf||0xc8;return function(_0xaa7a89){if(_0xaa7a89){return _0x5f0ad7[_0x30b6('0x17')](_0x32ffcf)['json'](_0xaa7a89);}};}function respondWithFilteredResult(_0x516e57,_0x18dc6e){return function(_0xa2333b){if(_0xa2333b){var _0x5c0d4b=typeof _0x18dc6e[_0x30b6('0x18')]==='undefined'&&typeof _0x18dc6e[_0x30b6('0x19')]===_0x30b6('0x1a');var _0x1d549a=_0xa2333b[_0x30b6('0x1b')];var _0x3a4b41=_0x5c0d4b?0x0:_0x18dc6e['offset'];var _0x2b01d6=_0x5c0d4b?_0xa2333b[_0x30b6('0x1b')]:_0x18dc6e[_0x30b6('0x18')]+_0x18dc6e[_0x30b6('0x19')];var _0xae7d94;if(_0x2b01d6>=_0x1d549a){_0x2b01d6=_0x1d549a;_0xae7d94=0xc8;}else{_0xae7d94=0xce;}_0x516e57[_0x30b6('0x17')](_0xae7d94);return _0x516e57[_0x30b6('0x1c')]('Content-Range',_0x3a4b41+'-'+_0x2b01d6+'/'+_0x1d549a)[_0x30b6('0x1d')](_0xa2333b);}return null;};}function patchUpdates(_0x388e18){return function(_0x4968b7){try{jsonpatch[_0x30b6('0x1e')](_0x4968b7,_0x388e18,!![]);}catch(_0x4e4107){return BPromise[_0x30b6('0x1f')](_0x4e4107);}return _0x4968b7[_0x30b6('0x20')]();};}function saveUpdates(_0x4e9a9d,_0x36094e){return function(_0x80e2ea){if(_0x80e2ea){return _0x80e2ea[_0x30b6('0x21')](_0x4e9a9d)[_0x30b6('0x22')](function(_0x54586b){return _0x54586b;});}return null;};}function removeEntity(_0x16c541,_0x4cb7db){return function(_0x45fe86){if(_0x45fe86){return _0x45fe86[_0x30b6('0x23')]()[_0x30b6('0x22')](function(){_0x16c541[_0x30b6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45fd2d,_0xe2da81){return function(_0x5a7bdd){if(!_0x5a7bdd){_0x45fd2d[_0x30b6('0x24')](0x194);}return _0x5a7bdd;};}function handleError(_0x5881a1,_0x2af091){_0x2af091=_0x2af091||0x1f4;return function(_0xecd258){logger[_0x30b6('0x25')](_0xecd258['stack']);if(_0xecd258[_0x30b6('0x26')]){delete _0xecd258[_0x30b6('0x26')];}_0x5881a1[_0x30b6('0x17')](_0x2af091)[_0x30b6('0x27')](_0xecd258);};}exports[_0x30b6('0x28')]=function(_0x2bf84d,_0x329b17){var _0x21939c={},_0x38f855={},_0x50adb4={'count':0x0,'rows':[]};var _0x381abf=_['map'](db['WhatsappTransferReport']['rawAttributes'],function(_0x13381e){return{'name':_0x13381e['fieldName'],'type':_0x13381e[_0x30b6('0x29')][_0x30b6('0x2a')]};});_0x38f855[_0x30b6('0x2b')]=_[_0x30b6('0x2c')](_0x381abf,_0x30b6('0x26'));_0x38f855[_0x30b6('0x2d')]=_[_0x30b6('0x2e')](_0x2bf84d[_0x30b6('0x2d')]);_0x38f855[_0x30b6('0x2f')]=_[_0x30b6('0x30')](_0x38f855[_0x30b6('0x2b')],_0x38f855['query']);_0x21939c[_0x30b6('0x31')]=_[_0x30b6('0x30')](_0x38f855['model'],qs['fields'](_0x2bf84d['query']['fields']));_0x21939c[_0x30b6('0x31')]=_0x21939c[_0x30b6('0x31')][_0x30b6('0x32')]?_0x21939c['attributes']:_0x38f855[_0x30b6('0x2b')];if(!_0x2bf84d['query']['hasOwnProperty'](_0x30b6('0x33'))){_0x21939c[_0x30b6('0x19')]=qs['limit'](_0x2bf84d['query'][_0x30b6('0x19')]);_0x21939c['offset']=qs['offset'](_0x2bf84d['query'][_0x30b6('0x18')]);}_0x21939c['order']=qs['sort'](_0x2bf84d[_0x30b6('0x2d')][_0x30b6('0x34')]);_0x21939c[_0x30b6('0x35')]=qs[_0x30b6('0x2f')](_[_0x30b6('0x36')](_0x2bf84d['query'],_0x38f855[_0x30b6('0x2f')]),_0x381abf);if(_0x2bf84d[_0x30b6('0x2d')][_0x30b6('0x37')]){_0x21939c[_0x30b6('0x35')]=_[_0x30b6('0x38')](_0x21939c['where'],{'$or':_[_0x30b6('0x2c')](_0x381abf,function(_0x510b39){if(_0x510b39[_0x30b6('0x29')]!=='VIRTUAL'){var _0x355aad={};_0x355aad[_0x510b39[_0x30b6('0x26')]]={'$like':'%'+_0x2bf84d[_0x30b6('0x2d')]['filter']+'%'};return _0x355aad;}})});}_0x21939c=_[_0x30b6('0x38')]({},_0x21939c,_0x2bf84d[_0x30b6('0x39')]);var _0x4281cf={'where':_0x21939c[_0x30b6('0x35')]};return db[_0x30b6('0x3a')][_0x30b6('0x1b')](_0x4281cf)[_0x30b6('0x22')](function(_0x392eff){_0x50adb4[_0x30b6('0x1b')]=_0x392eff;if(_0x2bf84d[_0x30b6('0x2d')][_0x30b6('0x3b')]){_0x21939c[_0x30b6('0x3c')]=[{'all':!![]}];}return db[_0x30b6('0x3a')]['findAll'](_0x21939c);})[_0x30b6('0x22')](function(_0x22fa8d){_0x50adb4[_0x30b6('0x3d')]=_0x22fa8d;return _0x50adb4;})['then'](respondWithFilteredResult(_0x329b17,_0x21939c))[_0x30b6('0x3e')](handleError(_0x329b17,null));};exports['show']=function(_0x279c85,_0x88757f){var _0x37224e={'raw':!![],'where':{'id':_0x279c85[_0x30b6('0x3f')]['id']}},_0x4b641f={};_0x4b641f[_0x30b6('0x2b')]=_[_0x30b6('0x2e')](db['WhatsappTransferReport']['rawAttributes']);_0x4b641f[_0x30b6('0x2d')]=_[_0x30b6('0x2e')](_0x279c85[_0x30b6('0x2d')]);_0x4b641f[_0x30b6('0x2f')]=_['intersection'](_0x4b641f[_0x30b6('0x2b')],_0x4b641f['query']);_0x37224e['attributes']=_['intersection'](_0x4b641f[_0x30b6('0x2b')],qs[_0x30b6('0x40')](_0x279c85[_0x30b6('0x2d')]['fields']));_0x37224e[_0x30b6('0x31')]=_0x37224e[_0x30b6('0x31')][_0x30b6('0x32')]?_0x37224e[_0x30b6('0x31')]:_0x4b641f['model'];if(_0x279c85[_0x30b6('0x2d')][_0x30b6('0x3b')]){_0x37224e[_0x30b6('0x3c')]=[{'all':!![]}];}_0x37224e=_[_0x30b6('0x38')]({},_0x37224e,_0x279c85['options']);return db[_0x30b6('0x3a')][_0x30b6('0x41')](_0x37224e)[_0x30b6('0x22')](handleEntityNotFound(_0x88757f,null))[_0x30b6('0x22')](respondWithResult(_0x88757f,null))[_0x30b6('0x3e')](handleError(_0x88757f,null));};exports['create']=function(_0x43574c,_0x4a9b82){return db['WhatsappTransferReport'][_0x30b6('0x42')](_0x43574c[_0x30b6('0x43')],{})['then'](respondWithResult(_0x4a9b82,0xc9))[_0x30b6('0x3e')](handleError(_0x4a9b82,null));};exports[_0x30b6('0x21')]=function(_0x5c25c4,_0x46c9a1){if(_0x5c25c4[_0x30b6('0x43')]['id']){delete _0x5c25c4[_0x30b6('0x43')]['id'];}return db[_0x30b6('0x3a')][_0x30b6('0x41')]({'where':{'id':_0x5c25c4['params']['id']}})[_0x30b6('0x22')](handleEntityNotFound(_0x46c9a1,null))['then'](saveUpdates(_0x5c25c4[_0x30b6('0x43')],null))[_0x30b6('0x22')](respondWithResult(_0x46c9a1,null))[_0x30b6('0x3e')](handleError(_0x46c9a1,null));};exports['destroy']=function(_0x4eb04b,_0x44aca2){return db[_0x30b6('0x3a')][_0x30b6('0x41')]({'where':{'id':_0x4eb04b['params']['id']}})[_0x30b6('0x22')](handleEntityNotFound(_0x44aca2,null))['then'](removeEntity(_0x44aca2,null))[_0x30b6('0x3e')](handleError(_0x44aca2,null));};exports[_0x30b6('0x44')]=function(_0x17ae99,_0x2e2997){return db[_0x30b6('0x3a')][_0x30b6('0x44')]()[_0x30b6('0x22')](respondWithResult(_0x2e2997,null))[_0x30b6('0x3e')](handleError(_0x2e2997,null));}; \ No newline at end of file +var _0x457b=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappTransferReport','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x38df24,_0x46ff19){var _0x198259=function(_0x13d97f){while(--_0x13d97f){_0x38df24['push'](_0x38df24['shift']());}};_0x198259(++_0x46ff19);}(_0x457b,0xca));var _0xb457=function(_0x1620d2,_0x798f79){_0x1620d2=_0x1620d2-0x0;var _0xb63a8d=_0x457b[_0x1620d2];return _0xb63a8d;};'use strict';var emlformat=require(_0xb457('0x0'));var rimraf=require(_0xb457('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb457('0x2'));var rp=require(_0xb457('0x3'));var moment=require(_0xb457('0x4'));var BPromise=require(_0xb457('0x5'));var Mustache=require(_0xb457('0x6'));var util=require('util');var path=require(_0xb457('0x7'));var sox=require(_0xb457('0x8'));var csv=require(_0xb457('0x9'));var ejs=require(_0xb457('0xa'));var fs=require('fs');var fs_extra=require(_0xb457('0xb'));var _=require('lodash');var squel=require(_0xb457('0xc'));var crypto=require(_0xb457('0xd'));var jsforce=require(_0xb457('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb457('0xf'));var Papa=require(_0xb457('0x10'));var Redis=require(_0xb457('0x11'));var authService=require(_0xb457('0x12'));var qs=require(_0xb457('0x13'));var as=require(_0xb457('0x14'));var hardwareService=require(_0xb457('0x15'));var logger=require(_0xb457('0x16'))(_0xb457('0x17'));var utils=require(_0xb457('0x18'));var config=require(_0xb457('0x19'));var licenseUtil=require(_0xb457('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x595609,_0x1c9f97){_0x1c9f97=_0x1c9f97||0xcc;return function(_0x992b23){if(_0x992b23){return _0x595609[_0xb457('0x1b')](_0x1c9f97);}return _0x595609[_0xb457('0x1c')](_0x1c9f97)[_0xb457('0x1d')]();};}function respondWithResult(_0x5f1ced,_0x559e4b){_0x559e4b=_0x559e4b||0xc8;return function(_0x3b845){if(_0x3b845){return _0x5f1ced[_0xb457('0x1c')](_0x559e4b)[_0xb457('0x1e')](_0x3b845);}};}function respondWithFilteredResult(_0x2333a3,_0x5cd83c){return function(_0x327140){if(_0x327140){var _0xbbfda5=typeof _0x5cd83c[_0xb457('0x1f')]===_0xb457('0x20')&&typeof _0x5cd83c[_0xb457('0x21')]===_0xb457('0x20');var _0x33bfc6=_0x327140[_0xb457('0x22')];var _0x54903c=_0xbbfda5?0x0:_0x5cd83c[_0xb457('0x1f')];var _0x3218f1=_0xbbfda5?_0x327140[_0xb457('0x22')]:_0x5cd83c['offset']+_0x5cd83c['limit'];var _0x4685f7;if(_0x3218f1>=_0x33bfc6){_0x3218f1=_0x33bfc6;_0x4685f7=0xc8;}else{_0x4685f7=0xce;}_0x2333a3[_0xb457('0x1c')](_0x4685f7);return _0x2333a3[_0xb457('0x23')](_0xb457('0x24'),_0x54903c+'-'+_0x3218f1+'/'+_0x33bfc6)[_0xb457('0x1e')](_0x327140);}return null;};}function patchUpdates(_0x383706){return function(_0x1e9e1d){try{jsonpatch['apply'](_0x1e9e1d,_0x383706,!![]);}catch(_0x4aa6b4){return BPromise[_0xb457('0x25')](_0x4aa6b4);}return _0x1e9e1d[_0xb457('0x26')]();};}function saveUpdates(_0x1f85ab,_0x588b53){return function(_0x23f90d){if(_0x23f90d){return _0x23f90d[_0xb457('0x27')](_0x1f85ab)[_0xb457('0x28')](function(_0x48dead){return _0x48dead;});}return null;};}function removeEntity(_0x55aaef,_0x3d8a07){return function(_0x4d055d){if(_0x4d055d){return _0x4d055d[_0xb457('0x29')]()[_0xb457('0x28')](function(){_0x55aaef[_0xb457('0x1c')](0xcc)[_0xb457('0x1d')]();});}};}function handleEntityNotFound(_0x557f03,_0x1ffe7a){return function(_0x1f8ac0){if(!_0x1f8ac0){_0x557f03['sendStatus'](0x194);}return _0x1f8ac0;};}function handleError(_0x367b8a,_0x7ebca){_0x7ebca=_0x7ebca||0x1f4;return function(_0x17014b){logger[_0xb457('0x2a')](_0x17014b[_0xb457('0x2b')]);if(_0x17014b[_0xb457('0x2c')]){delete _0x17014b[_0xb457('0x2c')];}_0x367b8a['status'](_0x7ebca)[_0xb457('0x2d')](_0x17014b);};}exports[_0xb457('0x2e')]=function(_0x5a7592,_0xaaf240){var _0x262474={},_0x48ba9f={},_0x193910={'count':0x0,'rows':[]};var _0x3473dd=_['map'](db[_0xb457('0x2f')]['rawAttributes'],function(_0x34e91c){return{'name':_0x34e91c[_0xb457('0x30')],'type':_0x34e91c['type'][_0xb457('0x31')]};});_0x48ba9f[_0xb457('0x32')]=_['map'](_0x3473dd,_0xb457('0x2c'));_0x48ba9f['query']=_[_0xb457('0x33')](_0x5a7592['query']);_0x48ba9f[_0xb457('0x34')]=_[_0xb457('0x35')](_0x48ba9f['model'],_0x48ba9f[_0xb457('0x36')]);_0x262474[_0xb457('0x37')]=_[_0xb457('0x35')](_0x48ba9f[_0xb457('0x32')],qs['fields'](_0x5a7592[_0xb457('0x36')][_0xb457('0x38')]));_0x262474[_0xb457('0x37')]=_0x262474[_0xb457('0x37')][_0xb457('0x39')]?_0x262474[_0xb457('0x37')]:_0x48ba9f['model'];if(!_0x5a7592[_0xb457('0x36')][_0xb457('0x3a')](_0xb457('0x3b'))){_0x262474[_0xb457('0x21')]=qs[_0xb457('0x21')](_0x5a7592['query']['limit']);_0x262474[_0xb457('0x1f')]=qs['offset'](_0x5a7592[_0xb457('0x36')][_0xb457('0x1f')]);}_0x262474[_0xb457('0x3c')]=qs[_0xb457('0x3d')](_0x5a7592[_0xb457('0x36')][_0xb457('0x3d')]);_0x262474[_0xb457('0x3e')]=qs['filters'](_['pick'](_0x5a7592[_0xb457('0x36')],_0x48ba9f[_0xb457('0x34')]),_0x3473dd);if(_0x5a7592['query'][_0xb457('0x3f')]){_0x262474[_0xb457('0x3e')]=_[_0xb457('0x40')](_0x262474[_0xb457('0x3e')],{'$or':_[_0xb457('0x41')](_0x3473dd,function(_0x245b68){if(_0x245b68[_0xb457('0x42')]!==_0xb457('0x43')){var _0x17f8f5={};_0x17f8f5[_0x245b68['name']]={'$like':'%'+_0x5a7592[_0xb457('0x36')]['filter']+'%'};return _0x17f8f5;}})});}_0x262474=_[_0xb457('0x40')]({},_0x262474,_0x5a7592['options']);var _0xbb092a={'where':_0x262474[_0xb457('0x3e')]};return db[_0xb457('0x2f')][_0xb457('0x22')](_0xbb092a)[_0xb457('0x28')](function(_0x15db2c){_0x193910[_0xb457('0x22')]=_0x15db2c;if(_0x5a7592[_0xb457('0x36')]['includeAll']){_0x262474['include']=[{'all':!![]}];}return db[_0xb457('0x2f')][_0xb457('0x44')](_0x262474);})[_0xb457('0x28')](function(_0xb5c863){_0x193910[_0xb457('0x45')]=_0xb5c863;return _0x193910;})[_0xb457('0x28')](respondWithFilteredResult(_0xaaf240,_0x262474))[_0xb457('0x46')](handleError(_0xaaf240,null));};exports[_0xb457('0x47')]=function(_0x53066e,_0x211363){var _0x5c6a5d={'raw':!![],'where':{'id':_0x53066e[_0xb457('0x48')]['id']}},_0x2583d9={};_0x2583d9[_0xb457('0x32')]=_[_0xb457('0x33')](db['WhatsappTransferReport'][_0xb457('0x49')]);_0x2583d9[_0xb457('0x36')]=_['keys'](_0x53066e['query']);_0x2583d9[_0xb457('0x34')]=_[_0xb457('0x35')](_0x2583d9['model'],_0x2583d9[_0xb457('0x36')]);_0x5c6a5d[_0xb457('0x37')]=_[_0xb457('0x35')](_0x2583d9[_0xb457('0x32')],qs['fields'](_0x53066e[_0xb457('0x36')][_0xb457('0x38')]));_0x5c6a5d[_0xb457('0x37')]=_0x5c6a5d['attributes'][_0xb457('0x39')]?_0x5c6a5d[_0xb457('0x37')]:_0x2583d9[_0xb457('0x32')];if(_0x53066e[_0xb457('0x36')]['includeAll']){_0x5c6a5d[_0xb457('0x4a')]=[{'all':!![]}];}_0x5c6a5d=_[_0xb457('0x40')]({},_0x5c6a5d,_0x53066e[_0xb457('0x4b')]);return db['WhatsappTransferReport'][_0xb457('0x4c')](_0x5c6a5d)[_0xb457('0x28')](handleEntityNotFound(_0x211363,null))[_0xb457('0x28')](respondWithResult(_0x211363,null))[_0xb457('0x46')](handleError(_0x211363,null));};exports[_0xb457('0x4d')]=function(_0x156657,_0x32c61b){return db[_0xb457('0x2f')]['create'](_0x156657['body'],{})[_0xb457('0x28')](respondWithResult(_0x32c61b,0xc9))[_0xb457('0x46')](handleError(_0x32c61b,null));};exports['update']=function(_0xaa7254,_0x216ccb){if(_0xaa7254[_0xb457('0x4e')]['id']){delete _0xaa7254['body']['id'];}return db[_0xb457('0x2f')][_0xb457('0x4c')]({'where':{'id':_0xaa7254['params']['id']}})[_0xb457('0x28')](handleEntityNotFound(_0x216ccb,null))[_0xb457('0x28')](saveUpdates(_0xaa7254[_0xb457('0x4e')],null))[_0xb457('0x28')](respondWithResult(_0x216ccb,null))[_0xb457('0x46')](handleError(_0x216ccb,null));};exports[_0xb457('0x29')]=function(_0x132860,_0x4188f){return db[_0xb457('0x2f')][_0xb457('0x4c')]({'where':{'id':_0x132860['params']['id']}})[_0xb457('0x28')](handleEntityNotFound(_0x4188f,null))['then'](removeEntity(_0x4188f,null))[_0xb457('0x46')](handleError(_0x4188f,null));};exports['describe']=function(_0x59b4e0,_0x10c2f8){return db[_0xb457('0x2f')]['describe']()[_0xb457('0x28')](respondWithResult(_0x10c2f8,null))[_0xb457('0x46')](handleError(_0x10c2f8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 97d6431..3ba4890 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 _0x1c37=['./whatsappTransferReport.attributes','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0x1c37,0x100));var _0x71c3=function(_0x38f38d,_0x1397d0){_0x38f38d=_0x38f38d-0x0;var _0x2c2322=_0x1c37[_0x38f38d];return _0x2c2322;};'use strict';var _=require(_0x71c3('0x0'));var util=require(_0x71c3('0x1'));var logger=require(_0x71c3('0x2'))(_0x71c3('0x3'));var moment=require('moment');var BPromise=require(_0x71c3('0x4'));var rp=require(_0x71c3('0x5'));var fs=require('fs');var path=require(_0x71c3('0x6'));var rimraf=require('rimraf');var config=require(_0x71c3('0x7'));var attributes=require(_0x71c3('0x8'));module['exports']=function(_0x2887d2,_0x1ec3bd){return _0x2887d2[_0x71c3('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x71c3('0xa'),'paranoid':![],'indexes':[{'name':_0x71c3('0xb'),'fields':[_0x71c3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x304f=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','../../config/logger','api','moment','path'];(function(_0x32a362,_0x55caea){var _0x46848d=function(_0x588883){while(--_0x588883){_0x32a362['push'](_0x32a362['shift']());}};_0x46848d(++_0x55caea);}(_0x304f,0x103));var _0xf304=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x304f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xf304('0x0'));var util=require('util');var logger=require(_0xf304('0x1'))(_0xf304('0x2'));var moment=require(_0xf304('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf304('0x4'));var rimraf=require(_0xf304('0x5'));var config=require(_0xf304('0x6'));var attributes=require(_0xf304('0x7'));module[_0xf304('0x8')]=function(_0x479d0e,_0x3b394f){return _0x479d0e[_0xf304('0x9')](_0xf304('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xf304('0xb'),'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 0e78be5..dec87aa 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 _0xc455=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b697a,_0x230a0f){var _0x1d6f85=function(_0x570d2e){while(--_0x570d2e){_0x5b697a['push'](_0x5b697a['shift']());}};_0x1d6f85(++_0x230a0f);}(_0xc455,0xcb));var _0x5c45=function(_0xa75c9b,_0x4cc5e0){_0xa75c9b=_0xa75c9b-0x0;var _0x280ee4=_0xc455[_0xa75c9b];return _0x280ee4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5c45('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c45('0x1'));var db=require(_0x5c45('0x2'))['db'];var utils=require(_0x5c45('0x3'));var logger=require(_0x5c45('0x4'))(_0x5c45('0x5'));var config=require(_0x5c45('0x6'));var jayson=require(_0x5c45('0x7'));var client=jayson[_0x5c45('0x8')][_0x5c45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2588be,_0x5e8003,_0x7bfe9c){return new BPromise(function(_0x4d58b4,_0x26a8af){return client[_0x5c45('0xa')](_0x2588be,_0x7bfe9c)[_0x5c45('0xb')](function(_0x56d4f9){logger[_0x5c45('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5e8003,'request\x20sent');logger[_0x5c45('0xd')](_0x5c45('0xe'),_0x5e8003,'request\x20sent',JSON[_0x5c45('0xf')](_0x56d4f9));if(_0x56d4f9[_0x5c45('0x10')]){if(_0x56d4f9[_0x5c45('0x10')][_0x5c45('0x11')]===0x1f4){logger[_0x5c45('0x10')](_0x5c45('0x12'),_0x5e8003,_0x56d4f9[_0x5c45('0x10')][_0x5c45('0x13')]);return _0x26a8af(_0x56d4f9['error'][_0x5c45('0x13')]);}logger[_0x5c45('0x10')](_0x5c45('0x12'),_0x5e8003,_0x56d4f9[_0x5c45('0x10')][_0x5c45('0x13')]);return _0x4d58b4(_0x56d4f9[_0x5c45('0x10')][_0x5c45('0x13')]);}else{logger[_0x5c45('0xc')](_0x5c45('0x12'),_0x5e8003,_0x5c45('0x14'));_0x4d58b4(_0x56d4f9[_0x5c45('0x15')]['message']);}})[_0x5c45('0x16')](function(_0x928c2e){logger[_0x5c45('0x10')](_0x5c45('0x12'),_0x5e8003,_0x928c2e);_0x26a8af(_0x928c2e);});});} \ No newline at end of file +var _0x0e07=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug'];(function(_0x5d952b,_0x395c8d){var _0xb8517a=function(_0x43aad3){while(--_0x43aad3){_0x5d952b['push'](_0x5d952b['shift']());}};_0xb8517a(++_0x395c8d);}(_0x0e07,0xa7));var _0x70e0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0e07[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x70e0('0x0'));var moment=require(_0x70e0('0x1'));var BPromise=require(_0x70e0('0x2'));var rs=require(_0x70e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70e0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x70e0('0x5'))('rpc');var config=require(_0x70e0('0x6'));var jayson=require(_0x70e0('0x7'));var client=jayson[_0x70e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bc6ff,_0x43c9da,_0x122b41){return new BPromise(function(_0x54c282,_0x1387fc){return client['request'](_0x3bc6ff,_0x122b41)[_0x70e0('0x9')](function(_0x275892){logger[_0x70e0('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0x43c9da,_0x70e0('0xb'));logger[_0x70e0('0xc')](_0x70e0('0xd'),_0x43c9da,_0x70e0('0xb'),JSON[_0x70e0('0xe')](_0x275892));if(_0x275892[_0x70e0('0xf')]){if(_0x275892[_0x70e0('0xf')][_0x70e0('0x10')]===0x1f4){logger['error'](_0x70e0('0x11'),_0x43c9da,_0x275892[_0x70e0('0xf')][_0x70e0('0x12')]);return _0x1387fc(_0x275892['error'][_0x70e0('0x12')]);}logger[_0x70e0('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x43c9da,_0x275892['error']['message']);return _0x54c282(_0x275892[_0x70e0('0xf')]['message']);}else{logger[_0x70e0('0xa')](_0x70e0('0x11'),_0x43c9da,'request\x20sent');_0x54c282(_0x275892[_0x70e0('0x13')][_0x70e0('0x12')]);}})['catch'](function(_0x4bad47){logger[_0x70e0('0xf')](_0x70e0('0x11'),_0x43c9da,_0x4bad47);_0x1387fc(_0x4bad47);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2fc2326..1b996f5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd072=['error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xd072,0x132));var _0x2d07=function(_0x31b362,_0x44ac74){_0x31b362=_0x31b362-0x0;var _0xebc28d=_0xd072[_0x31b362];return _0xebc28d;};'use strict';var _=require(_0x2d07('0x0'));var db=require(_0x2d07('0x1'))['db'];var seedDb=require(_0x2d07('0x2'));var checkLicense=require(_0x2d07('0x3'));var rpc=require(_0x2d07('0x4'));var config=require(_0x2d07('0x5'));var logger=require(_0x2d07('0x6'))('app');var pm2=require(_0x2d07('0x7'));var pm2Config=require(_0x2d07('0x8'));var schedule=require(_0x2d07('0x9'));var chat=require(_0x2d07('0xa'));var whatsapp=require(_0x2d07('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x2d07('0xc'));function main(){return db[_0x2d07('0xd')][_0x2d07('0xe')]()[_0x2d07('0xf')](function(){if(config[_0x2d07('0x10')]){return seedDb[_0x2d07('0x11')]();}})[_0x2d07('0xf')](function(){return checkLicense['default']();})[_0x2d07('0xf')](function(){return rpc[_0x2d07('0x12')]();})[_0x2d07('0xf')](function(_0x46ddb1){logger[_0x2d07('0x13')](_0x46ddb1);return chat[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(){return whatsapp[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(){return schedule[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(){return transcribe[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(){return provider[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(_0x380fd4){logger[_0x2d07('0x13')](_0x380fd4);return pm2[_0x2d07('0x14')](pm2Config);})[_0x2d07('0xf')](function(_0x3fbab2){var _0x28cbb3=_0x3fbab2[_0x2d07('0x15')](function(_0x2daa2b){return typeof _0x2daa2b[_0x2d07('0x16')]===_0x2d07('0x17')&&_0x2daa2b['exitCode']>=0x0;});if(_0x28cbb3[_0x2d07('0x18')]>0x0){throw new Error(_0x28cbb3[_0x2d07('0x18')]+_0x2d07('0x19')+_[_0x2d07('0x1a')](_0x28cbb3,function(_0x2b8884){return'\x22'+_0x2b8884[_0x2d07('0x1b')][_0x2d07('0x1c')]+'\x22';}));}logger[_0x2d07('0x13')]('Online\x20apps:',_[_0x2d07('0x1a')](_[_0x2d07('0x15')](_0x3fbab2,{'status':_0x2d07('0x1d')}),_0x2d07('0x1c'))['join']());logger[_0x2d07('0x13')](_0x2d07('0x1e'),_[_0x2d07('0x1a')](_[_0x2d07('0x15')](_0x3fbab2,function(_0x165d7f){return _0x165d7f[_0x2d07('0x1f')]!==_0x2d07('0x1d');}),_0x2d07('0x1c'))['join']()||_0x2d07('0x20'));console[_0x2d07('0x21')](_0x2d07('0x22'));})['catch'](function(_0x7a489){console['log'](_0x2d07('0x23'),_0x7a489);logger[_0x2d07('0x24')](_0x2d07('0x25'),_0x7a489);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x6347=['error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!'];(function(_0x21443b,_0x30392c){var _0x43b634=function(_0x4d39db){while(--_0x4d39db){_0x21443b['push'](_0x21443b['shift']());}};_0x43b634(++_0x30392c);}(_0x6347,0x1c9));var _0x7634=function(_0x5f00cc,_0x44c461){_0x5f00cc=_0x5f00cc-0x0;var _0x20ca98=_0x6347[_0x5f00cc];return _0x20ca98;};'use strict';var _=require(_0x7634('0x0'));var db=require(_0x7634('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x7634('0x2'));var rpc=require(_0x7634('0x3'));var config=require(_0x7634('0x4'));var logger=require(_0x7634('0x5'))('app');var pm2=require(_0x7634('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x7634('0x7'));var chat=require(_0x7634('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0x7634('0x9'));function main(){return db[_0x7634('0xa')][_0x7634('0xb')]()[_0x7634('0xc')](function(){if(config[_0x7634('0xd')]){return seedDb[_0x7634('0xe')]();}})['then'](function(){return checkLicense[_0x7634('0xe')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x2b1bef){logger[_0x7634('0xf')](_0x2b1bef);return chat[_0x7634('0x10')]();})[_0x7634('0xc')](function(){return whatsapp[_0x7634('0x10')]();})['then'](function(){return schedule['start']();})[_0x7634('0xc')](function(){return transcribe[_0x7634('0x10')]();})[_0x7634('0xc')](function(){return provider[_0x7634('0x10')]();})[_0x7634('0xc')](function(_0x9b7445){logger[_0x7634('0xf')](_0x9b7445);return pm2[_0x7634('0x10')](pm2Config);})['then'](function(_0x3b0fd4){var _0x439d57=_0x3b0fd4[_0x7634('0x11')](function(_0x20dc07){return typeof _0x20dc07['exitCode']===_0x7634('0x12')&&_0x20dc07['exitCode']>=0x0;});if(_0x439d57[_0x7634('0x13')]>0x0){throw new Error(_0x439d57[_0x7634('0x13')]+_0x7634('0x14')+_[_0x7634('0x15')](_0x439d57,function(_0x5cfed7){return'\x22'+_0x5cfed7[_0x7634('0x16')]['name']+'\x22';}));}logger[_0x7634('0xf')](_0x7634('0x17'),_['map'](_[_0x7634('0x11')](_0x3b0fd4,{'status':_0x7634('0x18')}),'name')[_0x7634('0x19')]());logger['info'](_0x7634('0x1a'),_['map'](_[_0x7634('0x11')](_0x3b0fd4,function(_0xbe6288){return _0xbe6288[_0x7634('0x1b')]!==_0x7634('0x18');}),'name')[_0x7634('0x19')]()||_0x7634('0x1c'));console[_0x7634('0x1d')](_0x7634('0x1e'));})[_0x7634('0x1f')](function(_0x49cd89){console[_0x7634('0x1d')](_0x7634('0x20'),_0x49cd89);logger[_0x7634('0x21')](_0x7634('0x22'),_0x49cd89);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 980ec62..311aadf 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 _0x7d31=['promisify','sign','secret','options','verify','hex','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','name','internal','email','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','closed','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','then','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','join'];(function(_0x1c2995,_0x9e2edf){var _0x1acd48=function(_0x42e649){while(--_0x42e649){_0x1c2995['push'](_0x1c2995['shift']());}};_0x1acd48(++_0x9e2edf);}(_0x7d31,0x179));var _0x17d3=function(_0x2cefd6,_0x320d0b){_0x2cefd6=_0x2cefd6-0x0;var _0x56d9ea=_0x7d31[_0x2cefd6];return _0x56d9ea;};'use strict';var db=require(_0x17d3('0x0'))['db'];var config=require(_0x17d3('0x1'));var hardwareConf=require(_0x17d3('0x2'));var licenseUtil=require(_0x17d3('0x3'));var encryptor=require(_0x17d3('0x4'));var _=require(_0x17d3('0x5'));var jwt=require(_0x17d3('0x6'));var expressJwt=require(_0x17d3('0x7'));var compose=require(_0x17d3('0x8'));var basicAuth=require(_0x17d3('0x9'));var crypto=require(_0x17d3('0xa'));var BPromise=require(_0x17d3('0xb'));var util=require('util');var moment=require(_0x17d3('0xc'));var validateJwt=expressJwt({'secret':config[_0x17d3('0xd')][_0x17d3('0xe')]});var userAttributes=['id',_0x17d3('0xf'),'fullname',_0x17d3('0x10'),_0x17d3('0x11'),_0x17d3('0x12'),'userpic','permissions',_0x17d3('0x13'),_0x17d3('0x14'),'chatPause','mailPause',_0x17d3('0x15'),_0x17d3('0x16'),_0x17d3('0x17'),_0x17d3('0x18'),_0x17d3('0x19'),'lastLoginAt',_0x17d3('0x1a'),'crudPermissions',_0x17d3('0x1b'),_0x17d3('0x1c'),_0x17d3('0x1d'),_0x17d3('0x1e'),_0x17d3('0x1f'),'phoneBarDnd','phoneBarEnableRecording',_0x17d3('0x20'),_0x17d3('0x21'),_0x17d3('0x22'),'phoneBarPrefixRequired',_0x17d3('0x23'),_0x17d3('0x24'),'hotdesk',_0x17d3('0x25'),_0x17d3('0x26'),_0x17d3('0x27'),_0x17d3('0x28'),_0x17d3('0x29'),'downloadVoiceRecordings',_0x17d3('0x2a'),_0x17d3('0x2b'),_0x17d3('0x2c'),_0x17d3('0x2d')];exports[_0x17d3('0x2e')]=function(){return this[_0x17d3('0x2f')](!![])[_0x17d3('0x30')](function(_0x2cfe1a,_0x4a973a,_0xfcecfe){if(_0x2cfe1a['user']){_0xfcecfe();}else{return db[_0x17d3('0x31')][_0x17d3('0x32')]({'where':{'id':_0x2cfe1a['params']['id']},'attributes':['id',_0x17d3('0x33'),_0x17d3('0x34')],'raw':!![]})['then'](function(_0x8d245a){if(_0x8d245a&&_0x8d245a[_0x17d3('0x33')]){return _0x4a973a['status'](_0x8d245a[_0x17d3('0x34')]===_0x17d3('0x35')?0x195:0x193)[_0x17d3('0x36')]({'message':_0x8d245a['disposition']===_0x17d3('0x35')?_0x17d3('0x37'):_0x17d3('0x38')});}else{_0xfcecfe();}})[_0x17d3('0x39')](function(_0x3d496d){_0xfcecfe(_0x3d496d);});}});};exports[_0x17d3('0x2f')]=function isAuthenticated(_0x591689){return compose()[_0x17d3('0x30')](function(_0x51fb1b,_0x16b365,_0x4deaca){var _0x4e0d45;if(_0x51fb1b['headers'][_0x17d3('0x3a')]){if(_[_0x17d3('0x3b')](_0x51fb1b[_0x17d3('0x3c')][_0x17d3('0x3a')],_0x17d3('0x3d'))){var _0x2b9a5e=basicAuth(_0x51fb1b);db[_0x17d3('0x3e')][_0x17d3('0x3f')]({'where':{'name':_0x2b9a5e[_0x17d3('0x10')]}})['then'](function(_0x1e999a){if(!_0x1e999a||!_0x1e999a[_0x17d3('0x40')](_0x2b9a5e[_0x17d3('0x41')])){return _0x16b365[_0x17d3('0x42')](0x191)[_0x17d3('0x36')]({'message':_0x17d3('0x43')});}_0x51fb1b[_0x17d3('0x44')]={'id':_0x1e999a['id']};_0x4deaca();})['catch'](function(_0x122fc9){_0x4deaca(_0x122fc9);});}else if(_['startsWith'](_0x51fb1b['headers'][_0x17d3('0x3a')],_0x17d3('0x45'))){validateJwt(_0x51fb1b,_0x16b365,_0x4deaca);}else{if(_0x591689){_0x4deaca();}else{return _0x16b365['status'](0x193)[_0x17d3('0x36')]({'message':_0x17d3('0x46')});}}}else if(_0x51fb1b[_0x17d3('0x47')]['apikey']){try{var _0x552579={'audience':hardwareConf[_0x17d3('0x48')](),'issuer':hardwareConf[_0x17d3('0x48')]()};verifyJwt(_0x51fb1b[_0x17d3('0x47')][_0x17d3('0x49')],_0x552579)[_0x17d3('0x4a')](function(_0x52179c){return db['User'][_0x17d3('0x3f')]({'where':{'id':_0x52179c[_0x17d3('0x4b')]}})[_0x17d3('0x4a')](function(_0x4324fd){_0x4e0d45=_0x4324fd;return db['Setting'][_0x17d3('0x32')]({'where':{'id':0x1},'attributes':[_0x17d3('0x4c'),_0x17d3('0x4d')],'raw':!![]});})['then'](function(_0x34620a){if(!_0x4e0d45||!_['isEqual'](_0x4e0d45[_0x17d3('0x4e')],_0x52179c[_0x17d3('0x4f')])){return _0x16b365['status'](0x191)['json']({'message':_0x17d3('0x50')});}if(_0x4e0d45[_0x17d3('0x51')]){return _0x16b365[_0x17d3('0x42')](0x191)['json']({'message':_0x17d3('0x52')});}if(_0x4e0d45['blocked']){if(_0x34620a['blockDuration']>0x0){if(moment(_0x4e0d45['blockedAt'])['add'](_0x34620a[_0x17d3('0x4d')],'minutes')>moment()){return _0x16b365[_0x17d3('0x42')](0x191)[_0x17d3('0x36')]({'message':_0x17d3('0x52')});}}else{return _0x16b365[_0x17d3('0x42')](0x191)['json']({'message':_0x17d3('0x52')});}}_0x51fb1b[_0x17d3('0x44')]={'id':_0x4e0d45['id']};_0x4deaca();});})[_0x17d3('0x39')](function(){return _0x16b365[_0x17d3('0x42')](0x191)[_0x17d3('0x36')]({'message':_0x17d3('0x52')});});}catch(_0x445f25){_0x4deaca(_0x445f25);}}else if(_0x591689){_0x4deaca();}else{return _0x16b365['status'](0x193)['json']({'message':_0x17d3('0x46')});}})['use'](function(_0xee1d3c,_0x563d10,_0x4dba8c){if(_0xee1d3c[_0x17d3('0x44')]){db[_0x17d3('0x3e')][_0x17d3('0x3f')]({'where':{'id':_0xee1d3c[_0x17d3('0x44')]['id']},'attributes':userAttributes})[_0x17d3('0x4a')](function(_0x21cd7e){if(!_0x21cd7e){return _0x563d10[_0x17d3('0x42')](0x194)['json']({'message':_0x17d3('0x53')});}_0xee1d3c['user']=_0x21cd7e;_0x4dba8c();})[_0x17d3('0x39')](function(_0x472a5f){_0x4dba8c(_0x472a5f);});}else if(_0x591689){_0x4dba8c();}else{return _0x563d10[_0x17d3('0x42')](0x194)[_0x17d3('0x36')]({'message':_0x17d3('0x54')});}});};exports[_0x17d3('0x55')]=function canUpdate(){return compose()[_0x17d3('0x30')](function(_0x4e6d04,_0x370dca,_0x27ac78){return licenseUtil[_0x17d3('0x56')]()[_0x17d3('0x4a')](function(_0x44b09c){if(_0x44b09c['update']){_0x27ac78();}else{return _0x370dca['status'](0x193)[_0x17d3('0x36')]({'message':_0x17d3('0x57')});}})['catch'](function(_0x5c61d0){_0x27ac78(_0x5c61d0);});});};exports[_0x17d3('0x58')]=function isWebrtcLicence(){return compose()[_0x17d3('0x30')](function(_0xdea258,_0x1bd17b,_0x2e42e4){return licenseUtil[_0x17d3('0x56')]()[_0x17d3('0x4a')](function(_0x467ced){if(_0x467ced['webrtc']){_0x2e42e4();}else{return _0x1bd17b[_0x17d3('0x42')](0x193)['json']({'message':_0x17d3('0x57')});}})[_0x17d3('0x39')](function(_0x1cd136){_0x2e42e4(_0x1cd136);});});};exports[_0x17d3('0x59')]=function(_0x29c14b,_0x56f120,_0x3830d3){_0x29c14b[_0x17d3('0x59')]=!![];return _0x3830d3();};exports[_0x17d3('0x5a')]=function signToken(_0x44189e){return signJwt(_0x44189e);};exports[_0x17d3('0x5b')]=function(_0x14f8ea,_0x5dbbea){if(!_0x14f8ea[_0x17d3('0x44')]){return _0x5dbbea[_0x17d3('0x42')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0xe7a3ca={'payload':{'id':_0x14f8ea[_0x17d3('0x44')]['id'],'role':_0x14f8ea[_0x17d3('0x44')][_0x17d3('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0xe7a3ca)['then'](function(_0x5009e6){_0x5dbbea['cookie'](_0x17d3('0x5c'),_0x5009e6);_0x5dbbea[_0x17d3('0x5d')](_0x17d3('0x5e'));})[_0x17d3('0x39')](function(_0x564b94){return _0x5dbbea[_0x17d3('0x42')](0x1f4)['send'](_0x564b94);});};exports[_0x17d3('0x5f')]=function(_0x1b6d29){if(_[_0x17d3('0x60')](_0x1b6d29[_0x17d3('0x4e')])||_[_0x17d3('0x60')](_0x1b6d29[_0x17d3('0x61')])){return null;}else{return createJwt(_0x1b6d29);}};exports[_0x17d3('0x62')]=function(_0x1f91a6){_0x1f91a6[_0x17d3('0x4e')]=generateNonce();_0x1f91a6[_0x17d3('0x61')]=generateIssuedAt();return createJwt(_0x1f91a6);};exports[_0x17d3('0x63')]=function(_0x3360c3,_0x290602){var _0x3f4edb=_0x3360c3[_0x17d3('0x47')][_0x17d3('0x49')];if(_0x3f4edb){var _0x549cfd={'nonce':_0x290602[_0x17d3('0x4e')],'iat':_0x290602['apiKeyIat'],'audience':hardwareConf[_0x17d3('0x48')](),'issuer':hardwareConf[_0x17d3('0x48')]()};return verifyJwt(_0x3f4edb,_0x549cfd)['then'](function(){return generateApiKey(_0x290602);});}else{throw{'message':_0x17d3('0x64')};}};exports['validatePasswordPattern']=function(_0x326fb6){var _0x4b9b97=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4b9b97[_0x17d3('0x65')](_0x326fb6))throw new db[(_0x17d3('0x66'))][(_0x17d3('0x67'))](_0x17d3('0x68'));return;};exports[_0x17d3('0x69')]=function(_0x2c2b79,_0x140fd0,_0xff356f){var _0x4035a8=encryptor[_0x17d3('0x6a')](_0x140fd0)[_0x17d3('0x6b')](',');for(var _0x2ee8c0=0x0;_0x2ee8c0<_0xff356f;_0x2ee8c0++){if(!_0x4035a8[_0x2ee8c0])break;if(_0x2c2b79['toLowerCase']()===_0x4035a8[_0x2ee8c0][_0x17d3('0x6c')]()){var _0xc2ad29=util[_0x17d3('0x6d')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xff356f);if(_0xff356f===0x1){_0xc2ad29=_0x17d3('0x6e');}throw new db[(_0x17d3('0x66'))][(_0x17d3('0x67'))](_0xc2ad29);}}return;};exports[_0x17d3('0x6f')]=function(_0x5926ee,_0x28a656){var _0x3ee3a1=_0x28a656?encryptor[_0x17d3('0x6a')](_0x28a656)[_0x17d3('0x6b')](','):[];if(_0x3ee3a1[_0x17d3('0x70')]===0x5){_0x3ee3a1[_0x17d3('0x71')](-0x1,0x1);}_0x3ee3a1['unshift'](_0x5926ee);return encryptor['encryptString'](_0x3ee3a1[_0x17d3('0x72')](','));};function signJwt(_0x1209d1){var _0x331b4a=BPromise[_0x17d3('0x73')](jwt[_0x17d3('0x74')],{'context':jwt});var _0x4f22bf=_0x1209d1[_0x17d3('0x75')]||config[_0x17d3('0xd')]['session'];return new BPromise(function(_0x3e7600,_0x1bf30f){_0x331b4a(_0x1209d1['payload'],_0x4f22bf,_0x1209d1[_0x17d3('0x76')])['then'](function(_0x9023e4){_0x3e7600(_0x9023e4);})['catch'](function(_0x6078d5){_0x1bf30f(_0x6078d5);});});}function verifyJwt(_0x22445e,_0x3ea66d,_0x24ddee){var _0x16843d=BPromise[_0x17d3('0x73')](jwt[_0x17d3('0x77')],{'context':jwt});var _0x3d2cfd=_0x24ddee||config[_0x17d3('0xd')]['session'];return new BPromise(function(_0x14d9ea,_0x20ca92){_0x16843d(_0x22445e,_0x3d2cfd,_0x3ea66d)[_0x17d3('0x4a')](function(_0x4f2483){_0x14d9ea(_0x4f2483);})[_0x17d3('0x39')](function(_0x334889){_0x20ca92(_0x334889);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x17d3('0x78'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x17d3('0x79')]();}function createJwt(_0x5da1b9){var _0xf969f8={'payload':{'iat':_0x5da1b9['apiKeyIat'],'nonce':_0x5da1b9[_0x17d3('0x4e')]},'options':{'algorithm':_0x17d3('0x7a'),'subject':_0x5da1b9['id']['toString'](),'issuer':hardwareConf[_0x17d3('0x48')](),'audience':hardwareConf[_0x17d3('0x48')]()}};return signJwt(_0xf969f8)[_0x17d3('0x4a')](function(_0x42abd4){return{'iat':_0x5da1b9[_0x17d3('0x61')],'nonce':_0x5da1b9[_0x17d3('0x4e')],'token':_0x42abd4};});} \ No newline at end of file +var _0xc95a=['isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','name','then','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString','promisify','secrets','payload','options','verify','randomBytes','toString','floor','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','composable-middleware','basic-auth','util','session','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','pauseType','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized'];(function(_0x3acb34,_0xd1dd4){var _0x2bc3ce=function(_0x5da743){while(--_0x5da743){_0x3acb34['push'](_0x3acb34['shift']());}};_0x2bc3ce(++_0xd1dd4);}(_0xc95a,0x140));var _0xac95=function(_0x390fd8,_0x4a7cc8){_0x390fd8=_0x390fd8-0x0;var _0x23d93f=_0xc95a[_0x390fd8];return _0x23d93f;};'use strict';var db=require(_0xac95('0x0'))['db'];var config=require(_0xac95('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xac95('0x2'));var encryptor=require(_0xac95('0x3'));var _=require(_0xac95('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xac95('0x5'));var basicAuth=require(_0xac95('0x6'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xac95('0x7'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0xac95('0x8')]});var userAttributes=['id','role','fullname','name','internal','email',_0xac95('0x9'),_0xac95('0xa'),_0xac95('0xb'),'voicePause',_0xac95('0xc'),_0xac95('0xd'),_0xac95('0xe'),_0xac95('0xf'),'openchannelPause',_0xac95('0x10'),'showWebBar',_0xac95('0x11'),'lastPauseAt',_0xac95('0x12'),_0xac95('0x13'),_0xac95('0x14'),'alias',_0xac95('0x15'),_0xac95('0x16'),_0xac95('0x17'),_0xac95('0x18'),'phoneBarEnableDtmfTone','phoneBarEnableSettings',_0xac95('0x19'),_0xac95('0x1a'),_0xac95('0x1b'),_0xac95('0x1c'),_0xac95('0x1d'),_0xac95('0x1e'),'userProfileId',_0xac95('0x1f'),_0xac95('0x20'),_0xac95('0x21'),_0xac95('0x22'),_0xac95('0x23'),_0xac95('0x24'),_0xac95('0x25'),_0xac95('0x26')];exports[_0xac95('0x27')]=function(){return this[_0xac95('0x28')](!![])[_0xac95('0x29')](function(_0x4e3aa5,_0x1bd8b3,_0x7c815a){if(_0x4e3aa5[_0xac95('0x2a')]){_0x7c815a();}else{return db[_0xac95('0x2b')][_0xac95('0x2c')]({'where':{'id':_0x4e3aa5[_0xac95('0x2d')]['id']},'attributes':['id',_0xac95('0x2e'),_0xac95('0x2f')],'raw':!![]})['then'](function(_0x15f28f){if(_0x15f28f&&_0x15f28f[_0xac95('0x2e')]){return _0x1bd8b3[_0xac95('0x30')](_0x15f28f['disposition']==='unmanaged'?0x195:0x193)[_0xac95('0x31')]({'message':_0x15f28f[_0xac95('0x2f')]==='unmanaged'?_0xac95('0x32'):_0xac95('0x33')});}else{_0x7c815a();}})[_0xac95('0x34')](function(_0x1cbdf8){_0x7c815a(_0x1cbdf8);});}});};exports[_0xac95('0x28')]=function isAuthenticated(_0x45636c){return compose()[_0xac95('0x29')](function(_0x2d3868,_0x503e06,_0x4fa244){var _0x15937a;if(_0x2d3868[_0xac95('0x35')][_0xac95('0x36')]){if(_[_0xac95('0x37')](_0x2d3868[_0xac95('0x35')][_0xac95('0x36')],'Basic')){var _0x1e20a5=basicAuth(_0x2d3868);db[_0xac95('0x38')][_0xac95('0x39')]({'where':{'name':_0x1e20a5[_0xac95('0x3a')]}})[_0xac95('0x3b')](function(_0x330939){if(!_0x330939||!_0x330939['authenticate'](_0x1e20a5[_0xac95('0x3c')])){return _0x503e06[_0xac95('0x30')](0x191)['json']({'message':_0xac95('0x3d')});}_0x2d3868[_0xac95('0x2a')]={'id':_0x330939['id']};_0x4fa244();})[_0xac95('0x34')](function(_0x3ec9d1){_0x4fa244(_0x3ec9d1);});}else if(_[_0xac95('0x37')](_0x2d3868[_0xac95('0x35')]['authorization'],'Bearer')){validateJwt(_0x2d3868,_0x503e06,_0x4fa244);}else{if(_0x45636c){_0x4fa244();}else{return _0x503e06[_0xac95('0x30')](0x193)[_0xac95('0x31')]({'message':_0xac95('0x3e')});}}}else if(_0x2d3868[_0xac95('0x3f')][_0xac95('0x40')]){try{var _0x35a6fa={'audience':hardwareConf[_0xac95('0x41')](),'issuer':hardwareConf[_0xac95('0x41')]()};verifyJwt(_0x2d3868[_0xac95('0x3f')][_0xac95('0x40')],_0x35a6fa)['then'](function(_0x20947a){return db[_0xac95('0x38')][_0xac95('0x39')]({'where':{'id':_0x20947a[_0xac95('0x42')]}})[_0xac95('0x3b')](function(_0x1e8c0a){_0x15937a=_0x1e8c0a;return db[_0xac95('0x43')][_0xac95('0x2c')]({'where':{'id':0x1},'attributes':[_0xac95('0x44'),_0xac95('0x45')],'raw':!![]});})[_0xac95('0x3b')](function(_0x30f643){if(!_0x15937a||!_[_0xac95('0x46')](_0x15937a['apiKeyNonce'],_0x20947a[_0xac95('0x47')])){return _0x503e06[_0xac95('0x30')](0x191)[_0xac95('0x31')]({'message':_0xac95('0x48')});}if(_0x15937a[_0xac95('0x49')]){return _0x503e06[_0xac95('0x30')](0x191)[_0xac95('0x31')]({'message':_0xac95('0x4a')});}if(_0x15937a[_0xac95('0x4b')]){if(_0x30f643['blockDuration']>0x0){if(moment(_0x15937a[_0xac95('0x4c')])[_0xac95('0x4d')](_0x30f643[_0xac95('0x45')],_0xac95('0x4e'))>moment()){return _0x503e06[_0xac95('0x30')](0x191)['json']({'message':_0xac95('0x4a')});}}else{return _0x503e06[_0xac95('0x30')](0x191)[_0xac95('0x31')]({'message':_0xac95('0x4a')});}}_0x2d3868[_0xac95('0x2a')]={'id':_0x15937a['id']};_0x4fa244();});})[_0xac95('0x34')](function(){return _0x503e06['status'](0x191)[_0xac95('0x31')]({'message':_0xac95('0x4a')});});}catch(_0x48ec4a){_0x4fa244(_0x48ec4a);}}else if(_0x45636c){_0x4fa244();}else{return _0x503e06['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x2e5fa0,_0xb6be05,_0x1f4817){if(_0x2e5fa0['user']){db[_0xac95('0x38')]['find']({'where':{'id':_0x2e5fa0[_0xac95('0x2a')]['id']},'attributes':userAttributes})['then'](function(_0x1ace2a){if(!_0x1ace2a){return _0xb6be05[_0xac95('0x30')](0x194)[_0xac95('0x31')]({'message':_0xac95('0x4f')});}_0x2e5fa0['user']=_0x1ace2a;_0x1f4817();})[_0xac95('0x34')](function(_0x4569ab){_0x1f4817(_0x4569ab);});}else if(_0x45636c){_0x1f4817();}else{return _0xb6be05[_0xac95('0x30')](0x194)[_0xac95('0x31')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xac95('0x50')]=function canUpdate(){return compose()['use'](function(_0xa56c04,_0x336c6e,_0x5e673d){return licenseUtil[_0xac95('0x51')]()[_0xac95('0x3b')](function(_0x137585){if(_0x137585[_0xac95('0x52')]){_0x5e673d();}else{return _0x336c6e[_0xac95('0x30')](0x193)[_0xac95('0x31')]({'message':'Forbidden'});}})[_0xac95('0x34')](function(_0x753514){_0x5e673d(_0x753514);});});};exports[_0xac95('0x53')]=function isWebrtcLicence(){return compose()['use'](function(_0x4aa6f8,_0x568ea9,_0x4c2eaa){return licenseUtil['getLicense']()[_0xac95('0x3b')](function(_0x2fe027){if(_0x2fe027['webrtc']){_0x4c2eaa();}else{return _0x568ea9[_0xac95('0x30')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x296002){_0x4c2eaa(_0x296002);});});};exports[_0xac95('0x54')]=function(_0x58e2af,_0x15fbb3,_0xd669ed){_0x58e2af[_0xac95('0x54')]=!![];return _0xd669ed();};exports[_0xac95('0x55')]=function signToken(_0x45d5bf){return signJwt(_0x45d5bf);};exports[_0xac95('0x56')]=function(_0x4668fe,_0x2a0300){if(!_0x4668fe[_0xac95('0x2a')]){return _0x2a0300['status'](0x194)[_0xac95('0x31')]({'message':_0xac95('0x57')});}var _0x50c424={'payload':{'id':_0x4668fe[_0xac95('0x2a')]['id'],'role':_0x4668fe[_0xac95('0x2a')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x50c424)[_0xac95('0x3b')](function(_0x40c262){_0x2a0300['cookie'](_0xac95('0x58'),_0x40c262);_0x2a0300[_0xac95('0x59')](_0xac95('0x5a'));})[_0xac95('0x34')](function(_0xcb18d2){return _0x2a0300[_0xac95('0x30')](0x1f4)['send'](_0xcb18d2);});};exports[_0xac95('0x5b')]=function(_0x85820a){if(_[_0xac95('0x5c')](_0x85820a[_0xac95('0x5d')])||_[_0xac95('0x5c')](_0x85820a[_0xac95('0x5e')])){return null;}else{return createJwt(_0x85820a);}};exports[_0xac95('0x5f')]=function(_0x3c0c92){_0x3c0c92['apiKeyNonce']=generateNonce();_0x3c0c92['apiKeyIat']=generateIssuedAt();return createJwt(_0x3c0c92);};exports['regenerateApiKey']=function(_0x16630b,_0x42e17b){var _0x3608c4=_0x16630b['query'][_0xac95('0x40')];if(_0x3608c4){var _0x3b1c18={'nonce':_0x42e17b[_0xac95('0x5d')],'iat':_0x42e17b[_0xac95('0x5e')],'audience':hardwareConf[_0xac95('0x41')](),'issuer':hardwareConf[_0xac95('0x41')]()};return verifyJwt(_0x3608c4,_0x3b1c18)[_0xac95('0x3b')](function(){return generateApiKey(_0x42e17b);});}else{throw{'message':_0xac95('0x60')};}};exports['validatePasswordPattern']=function(_0x2c4e10){var _0x53ec9e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x53ec9e[_0xac95('0x61')](_0x2c4e10))throw new db[(_0xac95('0x62'))][(_0xac95('0x63'))](_0xac95('0x64'));return;};exports[_0xac95('0x65')]=function(_0x6be80d,_0x595488,_0x342575){var _0x27a5a3=encryptor['decryptString'](_0x595488)[_0xac95('0x66')](',');for(var _0x29f169=0x0;_0x29f169<_0x342575;_0x29f169++){if(!_0x27a5a3[_0x29f169])break;if(_0x6be80d[_0xac95('0x67')]()===_0x27a5a3[_0x29f169][_0xac95('0x67')]()){var _0x4bd01f=util[_0xac95('0x68')](_0xac95('0x69'),_0x342575);if(_0x342575===0x1){_0x4bd01f=_0xac95('0x6a');}throw new db[(_0xac95('0x62'))][(_0xac95('0x63'))](_0x4bd01f);}}return;};exports[_0xac95('0x6b')]=function(_0x2e3c63,_0x177848){var _0x37fb89=_0x177848?encryptor['decryptString'](_0x177848)[_0xac95('0x66')](','):[];if(_0x37fb89['length']===0x5){_0x37fb89[_0xac95('0x6c')](-0x1,0x1);}_0x37fb89[_0xac95('0x6d')](_0x2e3c63);return encryptor[_0xac95('0x6e')](_0x37fb89['join'](','));};function signJwt(_0x4f6f73){var _0x9e15a1=BPromise[_0xac95('0x6f')](jwt['sign'],{'context':jwt});var _0xa96533=_0x4f6f73['secret']||config[_0xac95('0x70')][_0xac95('0x8')];return new BPromise(function(_0x5d482a,_0x2f1ffb){_0x9e15a1(_0x4f6f73[_0xac95('0x71')],_0xa96533,_0x4f6f73[_0xac95('0x72')])[_0xac95('0x3b')](function(_0x53d745){_0x5d482a(_0x53d745);})[_0xac95('0x34')](function(_0x597911){_0x2f1ffb(_0x597911);});});}function verifyJwt(_0x335a95,_0x3ae330,_0x505b42){var _0x5e4e1a=BPromise['promisify'](jwt[_0xac95('0x73')],{'context':jwt});var _0x2193d4=_0x505b42||config[_0xac95('0x70')]['session'];return new BPromise(function(_0x5e303e,_0x5819cc){_0x5e4e1a(_0x335a95,_0x2193d4,_0x3ae330)[_0xac95('0x3b')](function(_0x5500ee){_0x5e303e(_0x5500ee);})[_0xac95('0x34')](function(_0x3b4298){_0x5819cc(_0x3b4298);});});}function generateNonce(){return crypto[_0xac95('0x74')](0x10)[_0xac95('0x75')]('hex');}function generateIssuedAt(){return Math[_0xac95('0x76')](Date['now']()/0x3e8)[_0xac95('0x75')]();}function createJwt(_0x32dcf7){var _0x30cffe={'payload':{'iat':_0x32dcf7['apiKeyIat'],'nonce':_0x32dcf7[_0xac95('0x5d')]},'options':{'algorithm':_0xac95('0x77'),'subject':_0x32dcf7['id']['toString'](),'issuer':hardwareConf[_0xac95('0x41')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x30cffe)[_0xac95('0x3b')](function(_0x407ef6){return{'iat':_0x32dcf7['apiKeyIat'],'nonce':_0x32dcf7['apiKeyNonce'],'token':_0x407ef6};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 7095265..ef6d681 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 _0xdc30=['utf8','base64','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','data','update','write','end','final','binary','close','unlink','decryptFile','createWriteStream','createDecipher','secret','createCipher'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xdc30,0x160));var _0x0dc3=function(_0x3c5f8d,_0x39891f){_0x3c5f8d=_0x3c5f8d-0x0;var _0x3b7beb=_0xdc30[_0x3c5f8d];return _0x3b7beb;};'use strict';var crypto=require(_0x0dc3('0x0'));var fs=require('fs');var BPromise=require(_0x0dc3('0x1'));var _=require(_0x0dc3('0x2'));var config=require(_0x0dc3('0x3'));var logger=require(_0x0dc3('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0dc3('0x5')][_0x0dc3('0x6')],'algorithm':_0x0dc3('0x7')};const fileOptions={'algorithm':_0x0dc3('0x8')};if(config[_0x0dc3('0x9')]&&config[_0x0dc3('0x9')][_0x0dc3('0xa')]){var isSupported=isAlgorithmSupported(config[_0x0dc3('0x9')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x0dc3('0x9')][_0x0dc3('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0dc3('0xb')](',\x20');logger[_0x0dc3('0xc')](config[_0x0dc3('0x9')][_0x0dc3('0xa')],_0x0dc3('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x716ff3){return AES_SUPPORTED_RX['test'](_0x716ff3);}function getSupportedCiphers(){return crypto[_0x0dc3('0xe')]()[_0x0dc3('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xff3387){return getSupportedCiphers()[_0x0dc3('0x10')](_0xff3387)>-0x1;}function combineOptions(_0x126d60){var _0x13122d={};for(var _0x5e02a9 in fileOptions){if(fileOptions[_0x0dc3('0x11')](_0x5e02a9)){_0x13122d[_0x5e02a9]=fileOptions[_0x5e02a9];}}if(_0x126d60){for(var _0x2ba74c in _0x126d60){if(_0x126d60[_0x0dc3('0x11')](_0x2ba74c)){_0x13122d[_0x2ba74c]=_0x126d60[_0x2ba74c];}}}return _0x13122d;}exports[_0x0dc3('0x12')]=function(_0x5bfefd,_0x264f93,_0x2972d0,_0x41c1eb){return new BPromise(function(_0x11253d,_0x5edb69){_0x41c1eb=combineOptions(_0x41c1eb);var _0x4585ce=new Buffer(_0x2972d0);var _0x155d6e=fs[_0x0dc3('0x13')](_0x5bfefd);var _0xf33202=fs['createWriteStream'](_0x264f93);var _0x25902d=crypto['createCipher'](_0x41c1eb[_0x0dc3('0xa')],_0x4585ce);_0x155d6e['on'](_0x0dc3('0x14'),function(_0x4b07e4){var _0x3247ec=new Buffer(_0x25902d[_0x0dc3('0x15')](_0x4b07e4),'binary');_0xf33202[_0x0dc3('0x16')](_0x3247ec);});_0x155d6e['on'](_0x0dc3('0x17'),function(){try{var _0x149c21=new Buffer(_0x25902d[_0x0dc3('0x18')](_0x0dc3('0x19')),_0x0dc3('0x19'));_0xf33202[_0x0dc3('0x16')](_0x149c21);_0xf33202[_0x0dc3('0x17')]();_0xf33202['on'](_0x0dc3('0x1a'),function(){return _0x11253d(_0x264f93);});}catch(_0x506c63){fs[_0x0dc3('0x1b')](_0x264f93);return _0x5edb69(_0x506c63);}});});};exports[_0x0dc3('0x1c')]=function(_0x485af0,_0x587183,_0x6bbb91,_0x4635c8){return new BPromise(function(_0x5f4f53,_0x523b60){_0x4635c8=combineOptions(_0x4635c8);var _0x14b390=new Buffer(_0x6bbb91);var _0x3cccaa=fs[_0x0dc3('0x13')](_0x485af0);var _0x104e7b=fs[_0x0dc3('0x1d')](_0x587183);var _0x55cb42=crypto[_0x0dc3('0x1e')](_0x4635c8[_0x0dc3('0xa')],_0x14b390);_0x3cccaa['on'](_0x0dc3('0x14'),function(_0x25e31d){var _0x1afd78=new Buffer(_0x55cb42[_0x0dc3('0x15')](_0x25e31d),_0x0dc3('0x19'));_0x104e7b[_0x0dc3('0x16')](_0x1afd78);});_0x3cccaa['on'](_0x0dc3('0x17'),function(){try{var _0x200384=new Buffer(_0x55cb42[_0x0dc3('0x18')](_0x0dc3('0x19')),'binary');_0x104e7b['write'](_0x200384);_0x104e7b[_0x0dc3('0x17')]();_0x104e7b['on'](_0x0dc3('0x1a'),function(){return _0x5f4f53(_0x587183);});}catch(_0x249b98){fs['unlink'](_0x587183);return _0x523b60(_0x249b98);}});});};exports['encryptString']=function(_0x2ac711,_0x5c0ef2,_0x25fa35){var _0xd5748=_0x25fa35||stringOptions[_0x0dc3('0xa')];var _0x1c0121=_0x5c0ef2||stringOptions[_0x0dc3('0x1f')];var _0x470db5=crypto[_0x0dc3('0x20')](_0xd5748,_0x1c0121);var _0x3c3f96=_0x470db5[_0x0dc3('0x15')](_0x2ac711,_0x0dc3('0x21'),'base64');_0x3c3f96+=_0x470db5[_0x0dc3('0x18')](_0x0dc3('0x22'));return _0x3c3f96;};exports['decryptString']=function(_0x41af4,_0x47d647,_0x2e50cf){var _0xfc825a=_0x2e50cf||stringOptions[_0x0dc3('0xa')];var _0x28539f=_0x47d647||stringOptions['secret'];var _0xd5bae0=crypto['createDecipher'](_0xfc825a,_0x28539f);var _0x37f34c=_0xd5bae0[_0x0dc3('0x15')](_0x41af4,_0x0dc3('0x22'),_0x0dc3('0x21'));_0x37f34c+=_0xd5bae0['final']('utf8');return _0x37f34c;}; \ No newline at end of file +var _0xc6f6=['createCipher','update','write','end','final','binary','unlink','decryptFile','createReadStream','createDecipher','data','close','encryptString','utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createWriteStream'];(function(_0x1e545a,_0x2ea1c6){var _0x2b27a6=function(_0x356cdc){while(--_0x356cdc){_0x1e545a['push'](_0x1e545a['shift']());}};_0x2b27a6(++_0x2ea1c6);}(_0xc6f6,0x1f1));var _0x6c6f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6f6[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x6c6f('0x0'));var fs=require('fs');var BPromise=require(_0x6c6f('0x1'));var _=require(_0x6c6f('0x2'));var config=require(_0x6c6f('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x6c6f('0x4')};const fileOptions={'algorithm':_0x6c6f('0x5')};if(config[_0x6c6f('0x6')]&&config[_0x6c6f('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x6c6f('0x6')]['algorithm']);if(isSupported){fileOptions[_0x6c6f('0x7')]=config[_0x6c6f('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x6c6f('0x6')][_0x6c6f('0x7')],_0x6c6f('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x54dae2){return AES_SUPPORTED_RX[_0x6c6f('0x9')](_0x54dae2);}function getSupportedCiphers(){return crypto[_0x6c6f('0xa')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x19120b){return getSupportedCiphers()[_0x6c6f('0xb')](_0x19120b)>-0x1;}function combineOptions(_0x3106b8){var _0x2ccfee={};for(var _0x50c4a8 in fileOptions){if(fileOptions[_0x6c6f('0xc')](_0x50c4a8)){_0x2ccfee[_0x50c4a8]=fileOptions[_0x50c4a8];}}if(_0x3106b8){for(var _0x2909d1 in _0x3106b8){if(_0x3106b8[_0x6c6f('0xc')](_0x2909d1)){_0x2ccfee[_0x2909d1]=_0x3106b8[_0x2909d1];}}}return _0x2ccfee;}exports[_0x6c6f('0xd')]=function(_0x5068a0,_0x15fe78,_0x323e66,_0x2263e4){return new BPromise(function(_0x44f8e5,_0x2345f2){_0x2263e4=combineOptions(_0x2263e4);var _0x26161c=new Buffer(_0x323e66);var _0x33b14=fs['createReadStream'](_0x5068a0);var _0x410197=fs[_0x6c6f('0xe')](_0x15fe78);var _0x361b80=crypto[_0x6c6f('0xf')](_0x2263e4[_0x6c6f('0x7')],_0x26161c);_0x33b14['on']('data',function(_0x2410df){var _0x3c4c09=new Buffer(_0x361b80[_0x6c6f('0x10')](_0x2410df),'binary');_0x410197[_0x6c6f('0x11')](_0x3c4c09);});_0x33b14['on'](_0x6c6f('0x12'),function(){try{var _0xc16ec7=new Buffer(_0x361b80[_0x6c6f('0x13')](_0x6c6f('0x14')),_0x6c6f('0x14'));_0x410197[_0x6c6f('0x11')](_0xc16ec7);_0x410197['end']();_0x410197['on']('close',function(){return _0x44f8e5(_0x15fe78);});}catch(_0x3aaf21){fs[_0x6c6f('0x15')](_0x15fe78);return _0x2345f2(_0x3aaf21);}});});};exports[_0x6c6f('0x16')]=function(_0x16e523,_0x1754c9,_0x4d509f,_0x1c8065){return new BPromise(function(_0x9fa50c,_0x29661f){_0x1c8065=combineOptions(_0x1c8065);var _0x429fd4=new Buffer(_0x4d509f);var _0xaf4dd4=fs[_0x6c6f('0x17')](_0x16e523);var _0x2c11b0=fs[_0x6c6f('0xe')](_0x1754c9);var _0x44955c=crypto[_0x6c6f('0x18')](_0x1c8065[_0x6c6f('0x7')],_0x429fd4);_0xaf4dd4['on'](_0x6c6f('0x19'),function(_0x3ce931){var _0x4b33e9=new Buffer(_0x44955c['update'](_0x3ce931),_0x6c6f('0x14'));_0x2c11b0[_0x6c6f('0x11')](_0x4b33e9);});_0xaf4dd4['on'](_0x6c6f('0x12'),function(){try{var _0x51aa37=new Buffer(_0x44955c['final'](_0x6c6f('0x14')),_0x6c6f('0x14'));_0x2c11b0[_0x6c6f('0x11')](_0x51aa37);_0x2c11b0[_0x6c6f('0x12')]();_0x2c11b0['on'](_0x6c6f('0x1a'),function(){return _0x9fa50c(_0x1754c9);});}catch(_0x49e018){fs['unlink'](_0x1754c9);return _0x29661f(_0x49e018);}});});};exports[_0x6c6f('0x1b')]=function(_0x4b45d9,_0x10bd66,_0x49dde1){var _0x5433c5=_0x49dde1||stringOptions[_0x6c6f('0x7')];var _0x7df706=_0x10bd66||stringOptions['secret'];var _0x230fb5=crypto[_0x6c6f('0xf')](_0x5433c5,_0x7df706);var _0x3d3f55=_0x230fb5[_0x6c6f('0x10')](_0x4b45d9,_0x6c6f('0x1c'),_0x6c6f('0x1d'));_0x3d3f55+=_0x230fb5[_0x6c6f('0x13')](_0x6c6f('0x1d'));return _0x3d3f55;};exports[_0x6c6f('0x1e')]=function(_0x5591d2,_0x13c75d,_0x5278f5){var _0x13efc8=_0x5278f5||stringOptions['algorithm'];var _0x126c5b=_0x13c75d||stringOptions[_0x6c6f('0x1f')];var _0x2747df=crypto[_0x6c6f('0x18')](_0x13efc8,_0x126c5b);var _0x5752c2=_0x2747df[_0x6c6f('0x10')](_0x5591d2,_0x6c6f('0x1d'),_0x6c6f('0x1c'));_0x5752c2+=_0x2747df[_0x6c6f('0x13')]('utf8');return _0x5752c2;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1a3efea..d6316fe 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 _0xd768=['path','lodash','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit'];(function(_0x169c1b,_0x42d249){var _0x1b916e=function(_0x3866f7){while(--_0x3866f7){_0x169c1b['push'](_0x169c1b['shift']());}};_0x1b916e(++_0x42d249);}(_0xd768,0x90));var _0x8d76=function(_0x2d64fc,_0x42b2a7){_0x2d64fc=_0x2d64fc-0x0;var _0x2c8556=_0xd768[_0x2d64fc];return _0x2c8556;};'use strict';var util=require('util');var path=require(_0x8d76('0x0'));var _=require(_0x8d76('0x1'));var csv=require(_0x8d76('0x2'));var fs=require('fs');var BPromise=require(_0x8d76('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x8d76('0x4'))['db'];var dbH=require('../../mysqldb')[_0x8d76('0x5')];var logger=require(_0x8d76('0x6'))(_0x8d76('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x8d76('0x8')][0x2]);var QUERY=process[_0x8d76('0x8')][0x3];var PATH=process[_0x8d76('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c760d,_0x4e2686){var _0x478fe6={'status':_0x1c760d};var _0x48eb3e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e2686){_0x478fe6[_0x8d76('0x9')]=_0x4e2686;}return db[_0x8d76('0xa')][_0x8d76('0xb')](_0x478fe6,_0x48eb3e);}function main(){var _0x532b3a=0x1388;var _0x39ae82;logger[_0x8d76('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8d76('0xd')));return db[_0x8d76('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8d76('0xf'),_0x8d76('0x10')]})[_0x8d76('0x11')](function(_0x5710ee){if(_0x5710ee){_0x39ae82=_0x5710ee;_0x532b3a=_0x39ae82[_0x8d76('0x10')]||0x1388;}})[_0x8d76('0x11')](function(){return dbH[_0x8d76('0x12')]['query'](util[_0x8d76('0x13')](_0x8d76('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x8d76('0x15')]});})['then'](function(_0x484ccd){if(!_0x484ccd[0x0][_0x8d76('0x16')]){return analyticExtractedReport('Empty');}var _0x30eef7=[];var _0x412c06=0x0;if(_0x39ae82[_0x8d76('0xf')]){if(_0x484ccd&&_0x484ccd[_0x8d76('0x17')]){var _0x23099f=_['range'](_0x484ccd[0x0][_0x8d76('0x16')]/_0x532b3a);var _0x2213ea=Number[_0x8d76('0x18')](_0x484ccd[0x0][_0x8d76('0x16')]/_0x532b3a)?_0x484ccd[0x0]['num']%_0x532b3a:0x0;_0x23099f[_0x8d76('0x19')](function(_0x2f2f1a){if(_0x2f2f1a>0x0){_0x412c06+=_0x532b3a;}_0x30eef7['push'](dbH[_0x8d76('0x12')][_0x8d76('0x1a')](util[_0x8d76('0x13')](_0x8d76('0x1b'),QUERY,_0x532b3a,_0x412c06),{'type':dbH[_0x8d76('0x12')][_0x8d76('0x1c')][_0x8d76('0x15')]}));});if(_0x2213ea>0x0){_0x412c06+=_0x532b3a;_0x30eef7['push'](dbH[_0x8d76('0x12')][_0x8d76('0x1a')](util[_0x8d76('0x13')](_0x8d76('0x1b'),QUERY,_0x2213ea,_0x412c06),{'type':dbH[_0x8d76('0x12')]['QueryTypes'][_0x8d76('0x15')]}));}}}else{_0x30eef7[_0x8d76('0x1d')](dbH[_0x8d76('0x12')][_0x8d76('0x1a')](QUERY,{'type':dbH[_0x8d76('0x12')][_0x8d76('0x1c')][_0x8d76('0x15')]}));}var _0x51a349=path[_0x8d76('0x1e')](PATH);var _0x38d681=path[_0x8d76('0x1f')](PATH,_0x8d76('0x20'));var _0x47600a=_0x39ae82[_0x8d76('0xf')]&&_0x30eef7[_0x8d76('0x17')]>0x1;var _0x281f7f=[];if(!fs[_0x8d76('0x21')](path[_0x8d76('0x22')](_0x51a349,_0x38d681))&&_0x47600a){fs[_0x8d76('0x23')](path['join'](_0x51a349,_0x38d681));}return BPromise[_0x8d76('0x24')](_0x30eef7,function(_0x21c1a2){_0x281f7f['push'](_0x21c1a2);})[_0x8d76('0x11')](function(){for(var _0x498518=0x0;_0x498518<_0x281f7f[_0x8d76('0x17')];_0x498518+=0x1){var _0x924e25;var _0x36288b=_0x281f7f[_0x498518];if(_0x47600a){_0x924e25=path['join'](_0x51a349,_0x38d681,util['format'](_0x8d76('0x25'),_0x38d681,_0x498518,_0x8d76('0x26')));}else{_0x924e25=path['join'](_0x51a349,util[_0x8d76('0x13')](_0x8d76('0x27'),_0x38d681,_0x8d76('0x26')));}fs['writeFileSync'](_0x924e25,csv(_0x36288b));}})[_0x8d76('0x11')](function(){if(_0x47600a){return new Promise(function(_0x2046d7){zipdir(path[_0x8d76('0x22')](_0x51a349,_0x38d681),{'saveTo':path[_0x8d76('0x22')](_0x51a349,util['format']('%s.%s',_0x38d681,_0x8d76('0x28')))},function(_0x5bfec3,_0x17a6b5){rimraf(path[_0x8d76('0x22')](_0x51a349,_0x38d681),function(){});_0x2046d7(_0x8d76('0x29'));});});}})['then'](function(){logger[_0x8d76('0xc')](util[_0x8d76('0x13')](_0x8d76('0x2a'),EXTRACTED_REPORT_ID,_0x8d76('0xd')));return analyticExtractedReport('Completed',_0x47600a?util[_0x8d76('0x13')](_0x8d76('0x27'),_0x38d681,_0x47600a?_0x8d76('0x28'):_0x8d76('0x26')):null);});})[_0x8d76('0x2b')](function(_0x44966c){logger[_0x8d76('0xc')](util[_0x8d76('0x13')](_0x8d76('0x2c'),EXTRACTED_REPORT_ID,_0x8d76('0xd')),util[_0x8d76('0x2d')](_0x44966c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x8d76('0x2e')](function(){process[_0x8d76('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0616=['zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Failed','finally','util','path','lodash','bluebird'];(function(_0x469aeb,_0x3e2187){var _0x29e5e6=function(_0x56a1c6){while(--_0x56a1c6){_0x469aeb['push'](_0x469aeb['shift']());}};_0x29e5e6(++_0x3e2187);}(_0x0616,0xb8));var _0x6061=function(_0x348b29,_0x3be5e9){_0x348b29=_0x348b29-0x0;var _0xc260c5=_0x0616[_0x348b29];return _0xc260c5;};'use strict';var util=require(_0x6061('0x0'));var path=require(_0x6061('0x1'));var _=require(_0x6061('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x6061('0x3'));var zipdir=require(_0x6061('0x4'));var rimraf=require(_0x6061('0x5'));var db=require(_0x6061('0x6'))['db'];var dbH=require(_0x6061('0x6'))['dbH'];var logger=require('../../config/logger')(_0x6061('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6061('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6061('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x537708,_0x464532){var _0x5c97b3={'status':_0x537708};var _0xb77406={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x464532){_0x5c97b3[_0x6061('0x9')]=_0x464532;}return db[_0x6061('0xa')][_0x6061('0xb')](_0x5c97b3,_0xb77406);}function main(){var _0x1190ed=0x1388;var _0x543c20;logger[_0x6061('0xc')](util['format'](_0x6061('0xd'),EXTRACTED_REPORT_ID,_0x6061('0xe')));return db[_0x6061('0xf')][_0x6061('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6061('0x11')]})[_0x6061('0x12')](function(_0x411896){if(_0x411896){_0x543c20=_0x411896;_0x1190ed=_0x543c20[_0x6061('0x11')]||0x1388;}})[_0x6061('0x12')](function(){return dbH[_0x6061('0x13')][_0x6061('0x14')](util[_0x6061('0x15')](_0x6061('0x16'),QUERY),{'type':dbH['sequelize'][_0x6061('0x17')][_0x6061('0x18')]});})[_0x6061('0x12')](function(_0x5625aa){if(!_0x5625aa[0x0][_0x6061('0x19')]){return analyticExtractedReport(_0x6061('0x1a'));}var _0x243114=[];var _0x354527=0x0;if(_0x543c20[_0x6061('0x1b')]){if(_0x5625aa&&_0x5625aa[_0x6061('0x1c')]){var _0x438d9e=_['range'](_0x5625aa[0x0]['num']/_0x1190ed);var _0x33815e=Number[_0x6061('0x1d')](_0x5625aa[0x0][_0x6061('0x19')]/_0x1190ed)?_0x5625aa[0x0][_0x6061('0x19')]%_0x1190ed:0x0;_0x438d9e[_0x6061('0x1e')](function(_0x311775){if(_0x311775>0x0){_0x354527+=_0x1190ed;}_0x243114[_0x6061('0x1f')](dbH[_0x6061('0x13')][_0x6061('0x14')](util[_0x6061('0x15')](_0x6061('0x20'),QUERY,_0x1190ed,_0x354527),{'type':dbH[_0x6061('0x13')][_0x6061('0x17')][_0x6061('0x18')]}));});if(_0x33815e>0x0){_0x354527+=_0x1190ed;_0x243114[_0x6061('0x1f')](dbH[_0x6061('0x13')][_0x6061('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x33815e,_0x354527),{'type':dbH[_0x6061('0x13')][_0x6061('0x17')][_0x6061('0x18')]}));}}}else{_0x243114[_0x6061('0x1f')](dbH[_0x6061('0x13')]['query'](QUERY,{'type':dbH[_0x6061('0x13')][_0x6061('0x17')]['SELECT']}));}var _0xc7fb34=path['dirname'](PATH);var _0xd9ee8=path[_0x6061('0x21')](PATH,_0x6061('0x22'));var _0x23cb90=_0x543c20['split']&&_0x243114[_0x6061('0x1c')]>0x1;var _0x3c3b07=[];if(!fs['existsSync'](path[_0x6061('0x23')](_0xc7fb34,_0xd9ee8))&&_0x23cb90){fs[_0x6061('0x24')](path[_0x6061('0x23')](_0xc7fb34,_0xd9ee8));}return BPromise['each'](_0x243114,function(_0x2e4d58){_0x3c3b07[_0x6061('0x1f')](_0x2e4d58);})[_0x6061('0x12')](function(){for(var _0x130420=0x0;_0x130420<_0x3c3b07['length'];_0x130420+=0x1){var _0xeb685;var _0x473ffc=_0x3c3b07[_0x130420];if(_0x23cb90){_0xeb685=path['join'](_0xc7fb34,_0xd9ee8,util[_0x6061('0x15')](_0x6061('0x25'),_0xd9ee8,_0x130420,_0x6061('0x26')));}else{_0xeb685=path['join'](_0xc7fb34,util[_0x6061('0x15')](_0x6061('0x27'),_0xd9ee8,_0x6061('0x26')));}fs[_0x6061('0x28')](_0xeb685,csv(_0x473ffc));}})[_0x6061('0x12')](function(){if(_0x23cb90){return new Promise(function(_0x1a0e1f){zipdir(path[_0x6061('0x23')](_0xc7fb34,_0xd9ee8),{'saveTo':path[_0x6061('0x23')](_0xc7fb34,util[_0x6061('0x15')](_0x6061('0x27'),_0xd9ee8,_0x6061('0x29')))},function(_0x4a751d,_0x1fb12d){rimraf(path['join'](_0xc7fb34,_0xd9ee8),function(){});_0x1a0e1f(_0x6061('0x2a'));});});}})[_0x6061('0x12')](function(){logger[_0x6061('0xc')](util[_0x6061('0x15')](_0x6061('0x2b'),EXTRACTED_REPORT_ID,_0x6061('0xe')));return analyticExtractedReport('Completed',_0x23cb90?util[_0x6061('0x15')](_0x6061('0x27'),_0xd9ee8,_0x23cb90?_0x6061('0x29'):_0x6061('0x26')):null);});})[_0x6061('0x2c')](function(_0x4e4bee){logger['info'](util[_0x6061('0x15')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x4e4bee,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6061('0x2d'));})[_0x6061('0x2e')](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 956efa5..9d1f342 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 _0x998f=['/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','end','catch','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','tableHeader','map','pick','toString','value','length','auto','body','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','format','endDate','header','pageBreak','before','landscape','\x20/\x20','footer','black','right','num','Setting','find','split','splitSizePdf','isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','mkdirSync','each','then','flatten','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf'];(function(_0x36ab6b,_0x1f2bc2){var _0x4eefdc=function(_0x2a1d93){while(--_0x2a1d93){_0x36ab6b['push'](_0x36ab6b['shift']());}};_0x4eefdc(++_0x1f2bc2);}(_0x998f,0x1d3));var _0xf998=function(_0x301adc,_0x23c0c9){_0x301adc=_0x301adc-0x0;var _0x40408b=_0x998f[_0x301adc];return _0x40408b;};'use strict';var _=require(_0xf998('0x0'));var fs=require('fs');var util=require(_0xf998('0x1'));var path=require(_0xf998('0x2'));var moment=require(_0xf998('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xf998('0x4'));var zipdir=require(_0xf998('0x5'));var rimraf=require(_0xf998('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xf998('0x7')];var BPromise=require(_0xf998('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf998('0x9'))[_0xf998('0xa')];var logger=require(_0xf998('0xb'))(_0xf998('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xf998('0xd')][0x2]);var QUERY=process[_0xf998('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf998('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x517129,_0x58c3ea){var _0x4e4678={'status':_0x517129};var _0x204229={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x58c3ea){_0x4e4678[_0xf998('0xf')]=_0x58c3ea;}return db['AnalyticExtractedReport'][_0xf998('0x10')](_0x4e4678,_0x204229);}function getHeaders(_0x433180){return _['map'](_0x433180,function(_0x431ba4){return{'text':_0x431ba4,'style':_0xf998('0x11')};});}function getRows(_0x591c75,_0x43fceb){return _[_0xf998('0x12')](_0x43fceb,function(_0x252c09){return _(_0x252c09)[_0xf998('0x13')](_0x591c75)[_0xf998('0x12')](function(_0x16b03d){return _0x16b03d?_[_0xf998('0x14')](_0x16b03d):'';})[_0xf998('0x15')]();});}function createTable(_0x4635f7,_0x2a6b60){var _0x4d5449={'widths':_['fill'](Array(_0x4635f7[_0xf998('0x16')]),0x91),'heights':function(_0x20e6c7){return _0x20e6c7===0x0?_0xf998('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x124503=getHeaders(_0x4635f7);_0x4d5449[_0xf998('0x18')]['push'](_0x124503);var _0xa838e1=getRows(_0x4635f7,_0x2a6b60);_0x4d5449[_0xf998('0x18')]=_0x4d5449['body']['concat'](_0xa838e1);return _0x4d5449;}function createTables(_0x54c7ad){var _0x424482=[];var _0x2a5b01=_['chunk'](Object[_0xf998('0x19')](_0x54c7ad[0x0]),0x5);_0x2a5b01[_0xf998('0x1a')](function(_0x17c813){_0x424482[_0xf998('0x1b')](createTable(_0x17c813,_0x54c7ad));});return _0x424482;}function getPDFDocDefinition(_0x3f0bd1){var _0xaddf0=util['format'](_0xf998('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0xf998('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xf998('0x1e')])['format'](FORMAT));var _0x5f0505=[];for(var _0x5ac105=0x0;_0x5ac105<_0x3f0bd1['length'];_0x5ac105++){var _0x517e73=[];if(_0x5ac105===0x0){_0x517e73['push']({'text':_0xaddf0,'style':_0xf998('0x1f')});}var _0x1150c1={'table':_0x3f0bd1[_0x5ac105]};if(_0x5ac105>0x0){_0x1150c1[_0xf998('0x20')]=_0xf998('0x21');_0x1150c1['margin']=[0x0,0x46,0x0,0x0];}_0x517e73[_0xf998('0x1b')](_0x1150c1);_0x5f0505[_0xf998('0x1b')](_0x517e73);}return{'pageSize':'A4','pageOrientation':_0xf998('0x22'),'content':_0x5f0505,'footer':function(_0x34e222,_0x336ddf){return{'text':_0x34e222['toString']()+_0xf998('0x23')+_0x336ddf,'style':_0xf998('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf998('0x25')},'footer':{'alignment':_0xf998('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4725e6){var _0x110ad0=0x1388;var _0x352427;if(!_0x4725e6[0x0][_0xf998('0x27')]){return analyticExtractedReport('Empty');}return db[_0xf998('0x28')][_0xf998('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf998('0x2a'),_0xf998('0x2b')]})['then'](function(_0xa57e90){if(_0xa57e90){_0x352427=_0xa57e90;_0x110ad0=_0x352427['splitSizePdf']||0x3e8;}})['then'](function(){var _0x274dfc=[];var _0x38e475=0x0;if(_0x352427[_0xf998('0x2a')]){if(_0x4725e6&&_0x4725e6[_0xf998('0x16')]){var _0x14e9c1=_['range'](_0x4725e6[0x0][_0xf998('0x27')]/_0x110ad0);var _0x2c4491=Number[_0xf998('0x2c')](_0x4725e6[0x0][_0xf998('0x27')]/_0x110ad0)?_0x4725e6[0x0][_0xf998('0x27')]%_0x110ad0:0x0;_0x14e9c1[_0xf998('0x1a')](function(_0x4d7b4c){if(_0x4d7b4c>0x0){_0x38e475+=_0x110ad0;}_0x274dfc[_0xf998('0x1b')](dbH['sequelize'][_0xf998('0x2d')](util[_0xf998('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x110ad0,_0x38e475),{'type':dbH[_0xf998('0x2e')][_0xf998('0x2f')][_0xf998('0x30')]}));});if(_0x2c4491>0x0){_0x38e475+=_0x110ad0;_0x274dfc[_0xf998('0x1b')](dbH['sequelize'][_0xf998('0x2d')](util[_0xf998('0x1d')](_0xf998('0x31'),QUERY,_0x2c4491,_0x38e475),{'type':dbH['sequelize'][_0xf998('0x2f')][_0xf998('0x30')]}));}}}else{_0x274dfc[_0xf998('0x1b')](dbH[_0xf998('0x2e')][_0xf998('0x2d')](QUERY,{'type':dbH[_0xf998('0x2e')][_0xf998('0x2f')]['SELECT']}));}var _0x4b2bc3=path[_0xf998('0x32')](PATH);var _0x8def=path[_0xf998('0x33')](PATH,_0xf998('0x34'));var _0x27b28b=_0x352427[_0xf998('0x2a')]&&_0x274dfc[_0xf998('0x16')]>0x1;var _0x1e7d59=[];if(!fs[_0xf998('0x35')](path[_0xf998('0x36')](_0x4b2bc3,_0x8def))&&_0x27b28b){fs[_0xf998('0x37')](path[_0xf998('0x36')](_0x4b2bc3,_0x8def));}return BPromise[_0xf998('0x38')](_0x274dfc,function(_0x28719f){_0x1e7d59['push'](_0x28719f);})[_0xf998('0x39')](function(){var _0x5caeef=[];for(var _0x1c32d6=0x0;_0x1c32d6<_0x1e7d59[_0xf998('0x16')];_0x1c32d6+=0x1){var _0x3dd6b1=_0x1e7d59[_0x1c32d6];var _0x66b023=createTables(_[_0xf998('0x3a')](_0x3dd6b1));var _0x13ee5a;var _0x3f6af6=getPDFDocDefinition(_0x66b023);var _0x11e799=getPDFPrinter();var _0x2a0c2=_0x11e799[_0xf998('0x3b')](_0x3f6af6);if(_0x27b28b){_0x13ee5a=path[_0xf998('0x36')](_0x4b2bc3,_0x8def,util['format']('%s%d.%s',_0x8def,_0x1c32d6,_0xf998('0x3c')));}else{_0x13ee5a=path['join'](_0x4b2bc3,util['format']('%s.%s',_0x8def,_0xf998('0x3c')));}_0x5caeef['push'](writePDFDocument(_0x2a0c2,_0x13ee5a));}return Promise['all'](_0x5caeef);})['then'](function(){if(_0x27b28b){return new Promise(function(_0x11c458){zipdir(path['join'](_0x4b2bc3,_0x8def),{'saveTo':path[_0xf998('0x36')](_0x4b2bc3,util[_0xf998('0x1d')](_0xf998('0x3d'),_0x8def,_0xf998('0x3e')))},function(){rimraf(path[_0xf998('0x36')](_0x4b2bc3,_0x8def),function(){});_0x11c458(_0xf998('0x3f'));});});}})[_0xf998('0x39')](function(){if(!_0x27b28b)return;rimraf(path[_0xf998('0x36')](_0x4b2bc3,_0x8def),function(){});})[_0xf998('0x39')](function(){logger[_0xf998('0x40')](util[_0xf998('0x1d')](_0xf998('0x41'),EXTRACTED_REPORT_ID,_0xf998('0x42')));return analyticExtractedReport(_0xf998('0x43'),_0x27b28b?util[_0xf998('0x1d')](_0xf998('0x3d'),_0x8def,_0x27b28b?_0xf998('0x3e'):_0xf998('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf998('0x40')](util[_0xf998('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf998('0x42')));return db[_0xf998('0x44')][_0xf998('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf998('0x39')](function(_0x2d05e1){EXTRACTED_REPORT=_0x2d05e1;return dbH[_0xf998('0x2e')][_0xf998('0x2d')](util[_0xf998('0x1d')](_0xf998('0x46'),QUERY),{'type':dbH[_0xf998('0x2e')][_0xf998('0x2f')][_0xf998('0x30')]});})[_0xf998('0x39')](extractReport)['catch'](function(_0x1bdb9e){logger[_0xf998('0x40')](util[_0xf998('0x1d')](_0xf998('0x47'),EXTRACTED_REPORT_ID,_0xf998('0x42')),util[_0xf998('0x48')](_0x1bdb9e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf998('0x49'));})[_0xf998('0x4a')](function(){process[_0xf998('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5ec2b2=new PdfPrinter({'Arial':{'normal':__dirname+_0xf998('0x4c'),'bold':__dirname+_0xf998('0x4d'),'italics':__dirname+_0xf998('0x4e'),'bolditalics':__dirname+_0xf998('0x4f')}});return _0x5ec2b2;}function getPDFDocDefinitionFromHTML(_0x548a31,_0x23d606){var _0xaa5440=util[_0xf998('0x1d')](_0xf998('0x50'),_0x23d606[_0xf998('0x51')],_0x23d606[_0xf998('0x52')]);var _0x1289f6=moment()[_0xf998('0x1d')](_0xf998('0x53'))['toString']();var _0x538f08=htmlToPdfmake(_0x548a31,{'window':window,'tableAutoSize':!![]});return{'content':[_0x538f08],'defaultStyle':{'font':_0xf998('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf998('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf998('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xf998('0x55')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xf998('0x1f')}];},'footer':function(_0x2d09cc,_0x5240c8){return[{'text':util[_0xf998('0x1d')](_0xf998('0x56'),_0xaa5440,_0x2d09cc,_0x5240c8,_0x1289f6),'style':_0xf998('0x24')}];}};}function writePDFDocument(_0x3cb2b7,_0x334700){return new Promise(function(_0x4a8c57,_0x264c45){var _0x1cb2c6=_0x3cb2b7[_0xf998('0x57')](fs['createWriteStream'](_0x334700));_0x1cb2c6['on']('finish',function(){_0x4a8c57(_0xf998('0x58'));});_0x1cb2c6['on']('error',function(_0x525afe){_0x264c45(_0x525afe);});_0x3cb2b7[_0xf998('0x59')]();});}exports['createPdfFromHTML']=function(_0x3619db,_0x1ba6ae){var _0x2abbbb=getPDFPrinter();var _0xe80f41=getPDFDocDefinitionFromHTML(_0x3619db,_0x1ba6ae);var _0xd7c72a=_0x2abbbb[_0xf998('0x3b')](_0xe80f41);return writePDFDocument(_0xd7c72a,_0x1ba6ae[_0xf998('0x2')])[_0xf998('0x5a')](function(_0x251b8e){throw _0x251b8e;});}; \ No newline at end of file +var _0xb219=['mkdirSync','each','flatten','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','push','body','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','before','landscape','\x20/\x20','footer','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'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb219,0xd6));var _0x9b21=function(_0xd31ba9,_0x49bbda){_0xd31ba9=_0xd31ba9-0x0;var _0x3e6e1f=_0xb219[_0xd31ba9];return _0x3e6e1f;};'use strict';var _=require(_0x9b21('0x0'));var fs=require('fs');var util=require(_0x9b21('0x1'));var path=require(_0x9b21('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x9b21('0x3'));var PdfPrinter=require(_0x9b21('0x4'));var zipdir=require(_0x9b21('0x5'));var rimraf=require(_0x9b21('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x9b21('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9b21('0x8'))[_0x9b21('0x9')];var logger=require(_0x9b21('0xa'))(_0x9b21('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x9b21('0xc')][0x5];var FORMAT=_0x9b21('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xa8e98c,_0x257e69){var _0x4f915a={'status':_0xa8e98c};var _0x5c5028={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x257e69){_0x4f915a['savename']=_0x257e69;}return db[_0x9b21('0xe')]['update'](_0x4f915a,_0x5c5028);}function getHeaders(_0x5771e2){return _[_0x9b21('0xf')](_0x5771e2,function(_0x593a99){return{'text':_0x593a99,'style':_0x9b21('0x10')};});}function getRows(_0x2d520e,_0x3647d5){return _[_0x9b21('0xf')](_0x3647d5,function(_0x492e13){return _(_0x492e13)[_0x9b21('0x11')](_0x2d520e)[_0x9b21('0xf')](function(_0xddba65){return _0xddba65?_[_0x9b21('0x12')](_0xddba65):'';})[_0x9b21('0x13')]();});}function createTable(_0x4c8d48,_0x4b00fa){var _0x4ea9c6={'widths':_[_0x9b21('0x14')](Array(_0x4c8d48[_0x9b21('0x15')]),0x91),'heights':function(_0x2fe56f){return _0x2fe56f===0x0?_0x9b21('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4d9523=getHeaders(_0x4c8d48);_0x4ea9c6['body'][_0x9b21('0x17')](_0x4d9523);var _0x1799d6=getRows(_0x4c8d48,_0x4b00fa);_0x4ea9c6[_0x9b21('0x18')]=_0x4ea9c6[_0x9b21('0x18')][_0x9b21('0x19')](_0x1799d6);return _0x4ea9c6;}function createTables(_0x12585e){var _0x54d5bf=[];var _0x2f5f84=_[_0x9b21('0x1a')](Object['keys'](_0x12585e[0x0]),0x5);_0x2f5f84[_0x9b21('0x1b')](function(_0x11914e){_0x54d5bf['push'](createTable(_0x11914e,_0x12585e));});return _0x54d5bf;}function getPDFDocDefinition(_0x5a70a2){var _0x10e033=util[_0x9b21('0x1c')](_0x9b21('0x1d'),NAME,EXTRACTED_REPORT[_0x9b21('0x1e')],moment(EXTRACTED_REPORT[_0x9b21('0x1f')])[_0x9b21('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x9b21('0x1c')](FORMAT));var _0x4b8b71=[];for(var _0x1c5481=0x0;_0x1c5481<_0x5a70a2[_0x9b21('0x15')];_0x1c5481++){var _0x55fcb6=[];if(_0x1c5481===0x0){_0x55fcb6[_0x9b21('0x17')]({'text':_0x10e033,'style':'header'});}var _0x1a2514={'table':_0x5a70a2[_0x1c5481]};if(_0x1c5481>0x0){_0x1a2514['pageBreak']=_0x9b21('0x20');_0x1a2514['margin']=[0x0,0x46,0x0,0x0];}_0x55fcb6[_0x9b21('0x17')](_0x1a2514);_0x4b8b71['push'](_0x55fcb6);}return{'pageSize':'A4','pageOrientation':_0x9b21('0x21'),'content':_0x4b8b71,'footer':function(_0x8fbd85,_0x31b598){return{'text':_0x8fbd85[_0x9b21('0x12')]()+_0x9b21('0x22')+_0x31b598,'style':_0x9b21('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9b21('0x24')},'footer':{'alignment':_0x9b21('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x50dbd1){var _0x34e97e=0x1388;var _0x4356cc;if(!_0x50dbd1[0x0][_0x9b21('0x26')]){return analyticExtractedReport(_0x9b21('0x27'));}return db[_0x9b21('0x28')][_0x9b21('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9b21('0x2a'),_0x9b21('0x2b')]})[_0x9b21('0x2c')](function(_0x408234){if(_0x408234){_0x4356cc=_0x408234;_0x34e97e=_0x4356cc[_0x9b21('0x2b')]||0x3e8;}})[_0x9b21('0x2c')](function(){var _0x488819=[];var _0x464950=0x0;if(_0x4356cc[_0x9b21('0x2a')]){if(_0x50dbd1&&_0x50dbd1[_0x9b21('0x15')]){var _0x153d6e=_[_0x9b21('0x2d')](_0x50dbd1[0x0]['num']/_0x34e97e);var _0x528789=Number[_0x9b21('0x2e')](_0x50dbd1[0x0][_0x9b21('0x26')]/_0x34e97e)?_0x50dbd1[0x0]['num']%_0x34e97e:0x0;_0x153d6e['forEach'](function(_0x118814){if(_0x118814>0x0){_0x464950+=_0x34e97e;}_0x488819['push'](dbH[_0x9b21('0x2f')][_0x9b21('0x30')](util[_0x9b21('0x1c')](_0x9b21('0x31'),QUERY,_0x34e97e,_0x464950),{'type':dbH[_0x9b21('0x2f')][_0x9b21('0x32')][_0x9b21('0x33')]}));});if(_0x528789>0x0){_0x464950+=_0x34e97e;_0x488819[_0x9b21('0x17')](dbH[_0x9b21('0x2f')][_0x9b21('0x30')](util[_0x9b21('0x1c')](_0x9b21('0x31'),QUERY,_0x528789,_0x464950),{'type':dbH[_0x9b21('0x2f')][_0x9b21('0x32')][_0x9b21('0x33')]}));}}}else{_0x488819['push'](dbH[_0x9b21('0x2f')][_0x9b21('0x30')](QUERY,{'type':dbH[_0x9b21('0x2f')][_0x9b21('0x32')]['SELECT']}));}var _0x305e79=path['dirname'](PATH);var _0x49c12a=path[_0x9b21('0x34')](PATH,_0x9b21('0x35'));var _0x46cafc=_0x4356cc[_0x9b21('0x2a')]&&_0x488819[_0x9b21('0x15')]>0x1;var _0x4d4a01=[];if(!fs[_0x9b21('0x36')](path[_0x9b21('0x37')](_0x305e79,_0x49c12a))&&_0x46cafc){fs[_0x9b21('0x38')](path[_0x9b21('0x37')](_0x305e79,_0x49c12a));}return BPromise[_0x9b21('0x39')](_0x488819,function(_0x43197e){_0x4d4a01['push'](_0x43197e);})[_0x9b21('0x2c')](function(){var _0x1c3516=[];for(var _0x578342=0x0;_0x578342<_0x4d4a01[_0x9b21('0x15')];_0x578342+=0x1){var _0x4f7584=_0x4d4a01[_0x578342];var _0x3c893b=createTables(_[_0x9b21('0x3a')](_0x4f7584));var _0x2ea288;var _0x2fae25=getPDFDocDefinition(_0x3c893b);var _0x4ec36f=getPDFPrinter();var _0x46e023=_0x4ec36f['createPdfKitDocument'](_0x2fae25);if(_0x46cafc){_0x2ea288=path[_0x9b21('0x37')](_0x305e79,_0x49c12a,util['format']('%s%d.%s',_0x49c12a,_0x578342,_0x9b21('0x3b')));}else{_0x2ea288=path[_0x9b21('0x37')](_0x305e79,util[_0x9b21('0x1c')](_0x9b21('0x3c'),_0x49c12a,_0x9b21('0x3b')));}_0x1c3516['push'](writePDFDocument(_0x46e023,_0x2ea288));}return Promise[_0x9b21('0x3d')](_0x1c3516);})[_0x9b21('0x2c')](function(){if(_0x46cafc){return new Promise(function(_0xb993c5){zipdir(path[_0x9b21('0x37')](_0x305e79,_0x49c12a),{'saveTo':path[_0x9b21('0x37')](_0x305e79,util['format'](_0x9b21('0x3c'),_0x49c12a,_0x9b21('0x3e')))},function(){rimraf(path[_0x9b21('0x37')](_0x305e79,_0x49c12a),function(){});_0xb993c5(_0x9b21('0x3f'));});});}})[_0x9b21('0x2c')](function(){if(!_0x46cafc)return;rimraf(path[_0x9b21('0x37')](_0x305e79,_0x49c12a),function(){});})[_0x9b21('0x2c')](function(){logger[_0x9b21('0x40')](util[_0x9b21('0x1c')](_0x9b21('0x41'),EXTRACTED_REPORT_ID,_0x9b21('0x42')));return analyticExtractedReport(_0x9b21('0x43'),_0x46cafc?util[_0x9b21('0x1c')](_0x9b21('0x3c'),_0x49c12a,_0x46cafc?_0x9b21('0x3e'):_0x9b21('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9b21('0x40')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x9b21('0xe')][_0x9b21('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9b21('0x2c')](function(_0x52c4d4){EXTRACTED_REPORT=_0x52c4d4;return dbH['sequelize']['query'](util[_0x9b21('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9b21('0x2f')]['QueryTypes'][_0x9b21('0x33')]});})['then'](extractReport)[_0x9b21('0x45')](function(_0x54b30a){logger[_0x9b21('0x40')](util[_0x9b21('0x1c')](_0x9b21('0x46'),EXTRACTED_REPORT_ID,_0x9b21('0x42')),util['inspect'](_0x54b30a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9b21('0x47'));})[_0x9b21('0x48')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x252345=new PdfPrinter({'Arial':{'normal':__dirname+_0x9b21('0x49'),'bold':__dirname+_0x9b21('0x4a'),'italics':__dirname+_0x9b21('0x4b'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x252345;}function getPDFDocDefinitionFromHTML(_0x16ba94,_0x41bbc9){var _0xa69ea3=util[_0x9b21('0x1c')](_0x9b21('0x4c'),_0x41bbc9[_0x9b21('0x4d')],_0x41bbc9[_0x9b21('0x4e')]);var _0x23eb86=moment()['format'](_0x9b21('0x4f'))[_0x9b21('0x12')]();var _0x21a34b=htmlToPdfmake(_0x16ba94,{'window':window,'tableAutoSize':!![]});return{'content':[_0x21a34b],'defaultStyle':{'font':_0x9b21('0x50')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9b21('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9b21('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9b21('0x51')}},'header':function(){return[{'text':_0x9b21('0x52'),'style':'header'}];},'footer':function(_0x458f81,_0x3c8ab1){return[{'text':util[_0x9b21('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xa69ea3,_0x458f81,_0x3c8ab1,_0x23eb86),'style':_0x9b21('0x23')}];}};}function writePDFDocument(_0x59f16f,_0x50457c){return new Promise(function(_0x4e75c4,_0x5274a7){var _0x3fc5e2=_0x59f16f[_0x9b21('0x53')](fs[_0x9b21('0x54')](_0x50457c));_0x3fc5e2['on'](_0x9b21('0x55'),function(){_0x4e75c4(_0x9b21('0x55'));});_0x3fc5e2['on'](_0x9b21('0x56'),function(_0x542b57){_0x5274a7(_0x542b57);});_0x59f16f[_0x9b21('0x57')]();});}exports[_0x9b21('0x58')]=function(_0x2da953,_0x9acb93){var _0x55bed2=getPDFPrinter();var _0x16fb63=getPDFDocDefinitionFromHTML(_0x2da953,_0x9acb93);var _0x307c53=_0x55bed2[_0x9b21('0x59')](_0x16fb63);return writePDFDocument(_0x307c53,_0x9acb93[_0x9b21('0x2')])['catch'](function(_0x28ee85){throw _0x28ee85;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fcdcc76..ac43090 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 _0x8dd6=['exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','existsSync','join','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally'];(function(_0x27c2b0,_0x38833){var _0x50817c=function(_0x1cd4c0){while(--_0x1cd4c0){_0x27c2b0['push'](_0x27c2b0['shift']());}};_0x50817c(++_0x38833);}(_0x8dd6,0xcd));var _0x68dd=function(_0x15d9aa,_0x2b4405){_0x15d9aa=_0x15d9aa-0x0;var _0x25f3de=_0x8dd6[_0x15d9aa];return _0x25f3de;};'use strict';var util=require(_0x68dd('0x0'));var path=require('path');var _=require(_0x68dd('0x1'));var fs=require('fs');var json2xls=require(_0x68dd('0x2'));var BPromise=require(_0x68dd('0x3'));var zipdir=require(_0x68dd('0x4'));var rimraf=require(_0x68dd('0x5'));var db=require(_0x68dd('0x6'))['db'];var dbH=require(_0x68dd('0x6'))[_0x68dd('0x7')];var logger=require('../../config/logger')(_0x68dd('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x68dd('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3df6cb,_0x2a0ef5){var _0x381b00={'status':_0x3df6cb};var _0x454dd9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2a0ef5){_0x381b00[_0x68dd('0xa')]=_0x2a0ef5;}return db[_0x68dd('0xb')][_0x68dd('0xc')](_0x381b00,_0x454dd9);}function main(){var _0x986a9a=0x1388;var _0x5173df;logger['info'](util[_0x68dd('0xd')](_0x68dd('0xe'),EXTRACTED_REPORT_ID,_0x68dd('0xf')));return db['Setting'][_0x68dd('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x3f687e){if(_0x3f687e){_0x5173df=_0x3f687e;_0x986a9a=_0x5173df[_0x68dd('0x11')]||0x1388;}})[_0x68dd('0x12')](function(){return dbH[_0x68dd('0x13')][_0x68dd('0x14')](util['format'](_0x68dd('0x15'),QUERY),{'type':dbH[_0x68dd('0x13')][_0x68dd('0x16')][_0x68dd('0x17')]});})[_0x68dd('0x12')](function(_0x2250c4){if(!_0x2250c4[0x0][_0x68dd('0x18')]){return analyticExtractedReport(_0x68dd('0x19'));}var _0x5654f3=[];var _0x5d5a97=0x0;if(_0x5173df[_0x68dd('0x1a')]){if(_0x2250c4&&_0x2250c4[_0x68dd('0x1b')]){var _0x522502=_[_0x68dd('0x1c')](_0x2250c4[0x0][_0x68dd('0x18')]/_0x986a9a);var _0xd024e7=Number[_0x68dd('0x1d')](_0x2250c4[0x0][_0x68dd('0x18')]/_0x986a9a)?_0x2250c4[0x0][_0x68dd('0x18')]%_0x986a9a:0x0;_0x522502[_0x68dd('0x1e')](function(_0x21f869){if(_0x21f869>0x0){_0x5d5a97+=_0x986a9a;}_0x5654f3['push'](dbH[_0x68dd('0x13')][_0x68dd('0x14')](util[_0x68dd('0xd')](_0x68dd('0x1f'),QUERY,_0x986a9a,_0x5d5a97),{'type':dbH[_0x68dd('0x13')]['QueryTypes'][_0x68dd('0x17')]}));});if(_0xd024e7>0x0){_0x5d5a97+=_0x986a9a;_0x5654f3[_0x68dd('0x20')](dbH[_0x68dd('0x13')][_0x68dd('0x14')](util[_0x68dd('0xd')](_0x68dd('0x1f'),QUERY,_0xd024e7,_0x5d5a97),{'type':dbH['sequelize'][_0x68dd('0x16')]['SELECT']}));}}}else{_0x5654f3['push'](dbH[_0x68dd('0x13')][_0x68dd('0x14')](QUERY,{'type':dbH[_0x68dd('0x13')][_0x68dd('0x16')]['SELECT']}));}var _0x3196b1=path[_0x68dd('0x21')](PATH);var _0x403216=path['basename'](PATH,_0x68dd('0x22'));var _0x49197e=_0x5173df[_0x68dd('0x1a')]&&_0x5654f3[_0x68dd('0x1b')]>0x1;var _0x3acc19=[];if(!fs[_0x68dd('0x23')](path[_0x68dd('0x24')](_0x3196b1,_0x403216))&&_0x49197e){fs['mkdirSync'](path[_0x68dd('0x24')](_0x3196b1,_0x403216));}return BPromise['each'](_0x5654f3,function(_0x4b9fab){_0x3acc19['push'](_0x4b9fab);})[_0x68dd('0x12')](function(){for(var _0x10d3b0=0x0;_0x10d3b0<_0x3acc19[_0x68dd('0x1b')];_0x10d3b0+=0x1){var _0x3e66d5;var _0x1b1299=_0x3acc19[_0x10d3b0];if(_0x49197e){_0x3e66d5=path['join'](_0x3196b1,_0x403216,util[_0x68dd('0xd')](_0x68dd('0x25'),_0x403216,_0x10d3b0,'xlsx'));}else{_0x3e66d5=path[_0x68dd('0x24')](_0x3196b1,util[_0x68dd('0xd')](_0x68dd('0x26'),_0x403216,_0x68dd('0x27')));}fs[_0x68dd('0x28')](_0x3e66d5,json2xls(_0x1b1299),_0x68dd('0x29'));}})['then'](function(){if(_0x49197e){return new Promise(function(_0x318df3){zipdir(path[_0x68dd('0x24')](_0x3196b1,_0x403216),{'saveTo':path[_0x68dd('0x24')](_0x3196b1,util[_0x68dd('0xd')]('%s.%s',_0x403216,_0x68dd('0x2a')))},function(_0x326f81,_0x3ed9f5){rimraf(path[_0x68dd('0x24')](_0x3196b1,_0x403216),function(){});_0x318df3(_0x68dd('0x2b'));});});}})[_0x68dd('0x12')](function(){logger['info'](util['format'](_0x68dd('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x68dd('0x2d'),_0x49197e?util[_0x68dd('0xd')](_0x68dd('0x26'),_0x403216,_0x49197e?_0x68dd('0x2a'):_0x68dd('0x27')):null);});})['catch'](function(_0x576a07){logger[_0x68dd('0x2e')](util[_0x68dd('0xd')](_0x68dd('0x2f'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x576a07,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x68dd('0x30'));})[_0x68dd('0x31')](function(){process[_0x68dd('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1c9b=['then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','xlsx','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','update','info','format','XLSX','Setting','find'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x1c9b,0x19f));var _0xb1c9=function(_0x4cbb8e,_0x1047c8){_0x4cbb8e=_0x4cbb8e-0x0;var _0x17846f=_0x1c9b[_0x4cbb8e];return _0x17846f;};'use strict';var util=require(_0xb1c9('0x0'));var path=require(_0xb1c9('0x1'));var _=require(_0xb1c9('0x2'));var fs=require('fs');var json2xls=require(_0xb1c9('0x3'));var BPromise=require(_0xb1c9('0x4'));var zipdir=require(_0xb1c9('0x5'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xb1c9('0x6'))[_0xb1c9('0x7')];var logger=require('../../config/logger')(_0xb1c9('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xb1c9('0x9')][0x2]);var QUERY=process[_0xb1c9('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3dcdfb,_0x11894d){var _0x278fb4={'status':_0x3dcdfb};var _0x3a45f6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11894d){_0x278fb4[_0xb1c9('0xa')]=_0x11894d;}return db['AnalyticExtractedReport'][_0xb1c9('0xb')](_0x278fb4,_0x3a45f6);}function main(){var _0x398816=0x1388;var _0x20542c;logger[_0xb1c9('0xc')](util[_0xb1c9('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb1c9('0xe')));return db[_0xb1c9('0xf')][_0xb1c9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xb1c9('0x11')](function(_0x23b8b5){if(_0x23b8b5){_0x20542c=_0x23b8b5;_0x398816=_0x20542c[_0xb1c9('0x12')]||0x1388;}})[_0xb1c9('0x11')](function(){return dbH[_0xb1c9('0x13')][_0xb1c9('0x14')](util[_0xb1c9('0xd')](_0xb1c9('0x15'),QUERY),{'type':dbH['sequelize'][_0xb1c9('0x16')][_0xb1c9('0x17')]});})[_0xb1c9('0x11')](function(_0xec5da6){if(!_0xec5da6[0x0][_0xb1c9('0x18')]){return analyticExtractedReport('Empty');}var _0x25cc83=[];var _0x305a42=0x0;if(_0x20542c[_0xb1c9('0x19')]){if(_0xec5da6&&_0xec5da6[_0xb1c9('0x1a')]){var _0x147207=_[_0xb1c9('0x1b')](_0xec5da6[0x0][_0xb1c9('0x18')]/_0x398816);var _0x592e6d=Number['isInteger'](_0xec5da6[0x0][_0xb1c9('0x18')]/_0x398816)?_0xec5da6[0x0][_0xb1c9('0x18')]%_0x398816:0x0;_0x147207['forEach'](function(_0x18773c){if(_0x18773c>0x0){_0x305a42+=_0x398816;}_0x25cc83[_0xb1c9('0x1c')](dbH[_0xb1c9('0x13')][_0xb1c9('0x14')](util[_0xb1c9('0xd')](_0xb1c9('0x1d'),QUERY,_0x398816,_0x305a42),{'type':dbH[_0xb1c9('0x13')][_0xb1c9('0x16')][_0xb1c9('0x17')]}));});if(_0x592e6d>0x0){_0x305a42+=_0x398816;_0x25cc83[_0xb1c9('0x1c')](dbH[_0xb1c9('0x13')][_0xb1c9('0x14')](util[_0xb1c9('0xd')](_0xb1c9('0x1d'),QUERY,_0x592e6d,_0x305a42),{'type':dbH['sequelize'][_0xb1c9('0x16')][_0xb1c9('0x17')]}));}}}else{_0x25cc83[_0xb1c9('0x1c')](dbH[_0xb1c9('0x13')]['query'](QUERY,{'type':dbH[_0xb1c9('0x13')]['QueryTypes'][_0xb1c9('0x17')]}));}var _0x3e515d=path[_0xb1c9('0x1e')](PATH);var _0x5705cf=path[_0xb1c9('0x1f')](PATH,_0xb1c9('0x20'));var _0x10ea19=_0x20542c['split']&&_0x25cc83[_0xb1c9('0x1a')]>0x1;var _0x9d17f9=[];if(!fs[_0xb1c9('0x21')](path[_0xb1c9('0x22')](_0x3e515d,_0x5705cf))&&_0x10ea19){fs[_0xb1c9('0x23')](path[_0xb1c9('0x22')](_0x3e515d,_0x5705cf));}return BPromise[_0xb1c9('0x24')](_0x25cc83,function(_0x43d75d){_0x9d17f9[_0xb1c9('0x1c')](_0x43d75d);})['then'](function(){for(var _0xc7d70=0x0;_0xc7d70<_0x9d17f9[_0xb1c9('0x1a')];_0xc7d70+=0x1){var _0x3deaf9;var _0x46eab8=_0x9d17f9[_0xc7d70];if(_0x10ea19){_0x3deaf9=path['join'](_0x3e515d,_0x5705cf,util[_0xb1c9('0xd')](_0xb1c9('0x25'),_0x5705cf,_0xc7d70,'xlsx'));}else{_0x3deaf9=path[_0xb1c9('0x22')](_0x3e515d,util[_0xb1c9('0xd')](_0xb1c9('0x26'),_0x5705cf,'xlsx'));}fs[_0xb1c9('0x27')](_0x3deaf9,json2xls(_0x46eab8),'binary');}})['then'](function(){if(_0x10ea19){return new Promise(function(_0x3e7e48){zipdir(path[_0xb1c9('0x22')](_0x3e515d,_0x5705cf),{'saveTo':path[_0xb1c9('0x22')](_0x3e515d,util[_0xb1c9('0xd')](_0xb1c9('0x26'),_0x5705cf,_0xb1c9('0x28')))},function(_0xf7277e,_0x1a5308){rimraf(path[_0xb1c9('0x22')](_0x3e515d,_0x5705cf),function(){});_0x3e7e48('zip\x20finished');});});}})[_0xb1c9('0x11')](function(){logger[_0xb1c9('0xc')](util[_0xb1c9('0xd')](_0xb1c9('0x29'),EXTRACTED_REPORT_ID,_0xb1c9('0xe')));return analyticExtractedReport(_0xb1c9('0x2a'),_0x10ea19?util['format'](_0xb1c9('0x26'),_0x5705cf,_0x10ea19?_0xb1c9('0x28'):_0xb1c9('0x2b')):null);});})['catch'](function(_0x10b32f){logger[_0xb1c9('0xc')](util[_0xb1c9('0xd')](_0xb1c9('0x2c'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xb1c9('0x2d')](_0x10b32f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb1c9('0x2e')](function(){process[_0xb1c9('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 989ea2b..6649cec 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 _0x1f7b=['inbound','push','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','*,*,*,*','map','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','models','Interval','VoiceExtension','IntervalId','then','findAll','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','Set','format','type','VoiceExtensionId'];(function(_0xf884ef,_0x5f3f34){var _0x55fa61=function(_0x200290){while(--_0x200290){_0xf884ef['push'](_0xf884ef['shift']());}};_0x55fa61(++_0x5f3f34);}(_0x1f7b,0x100));var _0xb1f7=function(_0xbd77c1,_0x50b969){_0xbd77c1=_0xbd77c1-0x0;var _0x47fa83=_0x1f7b[_0xbd77c1];return _0x47fa83;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x19cbb2,_0x4cd83b){var _0x300790=this;return _0x19cbb2[_0xb1f7('0x0')][_0xb1f7('0x1')]['findAll']({'raw':!![]})['then'](function(_0x473c1f){_0x300790['intervals']=_0x473c1f;return _0x19cbb2[_0xb1f7('0x0')][_0xb1f7('0x2')]['findAll']({'where':{'IntervalId':_0x4cd83b[_0xb1f7('0x3')]},'raw':!![]});})[_0xb1f7('0x4')](function(_0x3640bb){return _0x19cbb2[_0xb1f7('0x0')][_0xb1f7('0x2')][_0xb1f7('0x5')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x3640bb,_0xb1f7('0x6')))}},'order':[{'raw':_0xb1f7('0x7')}],'raw':!![]});})[_0xb1f7('0x4')](function(_0x5d65f0){var _0x3d296f=_[_0xb1f7('0x8')](_0x5d65f0,{'priority':'1'});var _0x4c9146=_['filter'](_0x5d65f0,{'isApp':0x1});var _0x43b31a=_[_0xb1f7('0x9')](_0x4c9146,_0xb1f7('0x6'));var _0x21bc3f=[_0xb1f7('0xa'),_0xb1f7('0xb')];var _0x3e970c=[];var _0x4e06d3=[];for(var _0x24a0bf in _0x43b31a){if(_0x43b31a['hasOwnProperty'](_0x24a0bf)){_0x300790[_0xb1f7('0xc')]=0x2;_0x300790[_0xb1f7('0xd')]=[];_0x300790[_0xb1f7('0xe')]=_[_0xb1f7('0xf')](_0x3d296f,{'exten':_0x43b31a[_0x24a0bf][0x0]['exten']});_0x300790[_0xb1f7('0xd')]['push']({'type':_0x43b31a[_0x24a0bf][0x0]['type'],'app':_0xb1f7('0x10'),'appdata':util[_0xb1f7('0x11')]('CDR(type)=%s',_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')]),'context':_0x43b31a[_0x24a0bf][0x0]['context'],'exten':_0x43b31a[_0x24a0bf][0x0]['exten'],'priority':_0x300790['priority']++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});if(_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')]===_0xb1f7('0x14')){_0x300790['extensions'][_0xb1f7('0x15')]({'type':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')],'app':_0xb1f7('0x10'),'appdata':_0xb1f7('0x16')+_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')],'context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x300790['priority']++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});}else if(_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')]===_0xb1f7('0x18')){if(_0x300790['extension']){_0x300790['extensions']['push']({'type':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')],'app':_0xb1f7('0x10'),'appdata':_0xb1f7('0x19')+(_0x300790[_0xb1f7('0xe')][_0xb1f7('0x1a')]?_0xb1f7('0x1b')+_0x300790[_0xb1f7('0xe')][_0xb1f7('0x1a')]+'}':_0xb1f7('0x1c')),'context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x300790[_0xb1f7('0xc')]++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});}_0x300790['extensions']['push']({'type':_0x43b31a[_0x24a0bf][0x0]['type'],'app':_0xb1f7('0x10'),'appdata':'CDR(routeid)='+_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')],'context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'exten':_0x43b31a[_0x24a0bf][0x0]['exten'],'priority':_0x300790[_0xb1f7('0xc')]++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});var _0x1fd794=_0x300790[_0xb1f7('0xc')]++;_0x300790[_0xb1f7('0xd')]['push']({'type':_0x43b31a[_0x24a0bf][0x0]['type'],'app':_0xb1f7('0x1d'),'appdata':_0xb1f7('0x1e')+(_0x1fd794+0x2)+_0xb1f7('0x1f')+(_0x1fd794+0x1)+')','context':_0x43b31a[_0x24a0bf][0x0]['context'],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x1fd794,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});if(_0x300790[_0xb1f7('0xe')]){_0x300790[_0xb1f7('0xd')][_0xb1f7('0x15')]({'type':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')],'app':_0xb1f7('0x10'),'appdata':_0x300790[_0xb1f7('0xe')][_0xb1f7('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x300790[_0xb1f7('0xe')][_0xb1f7('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x300790[_0xb1f7('0xc')]++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});}_0x300790['extensions'][_0xb1f7('0x15')]({'type':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')],'app':'Set','appdata':_0xb1f7('0x20')+_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')],'context':_0x43b31a[_0x24a0bf][0x0]['context'],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x300790[_0xb1f7('0xc')]++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});if(_0x300790[_0xb1f7('0xe')]&&_0x300790[_0xb1f7('0xe')][_0xb1f7('0x21')](_0xb1f7('0x22'))&&_0x300790[_0xb1f7('0xe')]['recordingFormat']!=='none'){_0x300790[_0xb1f7('0xd')][_0xb1f7('0x15')]({'type':_0x43b31a[_0x24a0bf][0x0]['type'],'app':_0xb1f7('0x10'),'appdata':_0xb1f7('0x23'),'context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x300790['priority']++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});_0x300790['extensions'][_0xb1f7('0x15')]({'type':_0x43b31a[_0x24a0bf][0x0]['type'],'app':_0xb1f7('0x10'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x300790['extension'][_0xb1f7('0x22')]||'wav','context':_0x43b31a[_0x24a0bf][0x0]['context'],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x300790[_0xb1f7('0xc')]++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});}}_0x300790[_0xb1f7('0xd')][_0xb1f7('0x15')]({'type':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')],'app':_0xb1f7('0x10'),'appdata':_0xb1f7('0x24'),'context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x300790['priority']++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]});_0x300790[_0xb1f7('0xd')][_0xb1f7('0x15')]({'type':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')],'app':_0xb1f7('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'exten':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x6')],'priority':_0x300790[_0xb1f7('0xc')]++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0]['VoiceExtensionId']});_0x300790[_0xb1f7('0xd')]['push']({'type':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')],'app':_0xb1f7('0x10'),'appdata':_0xb1f7('0x25'),'context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'exten':_0x43b31a[_0x24a0bf][0x0]['exten'],'priority':_0x300790[_0xb1f7('0xc')]++,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0]['VoiceExtensionId']});for(var _0x17be6c=0x0,_0xb78cea=0x0;_0x17be6c<_0x43b31a[_0x24a0bf][_0xb1f7('0x26')];_0x17be6c+=0x1,_0xb78cea=0x0){var _0x27d03f=_0x43b31a[_0x24a0bf][_0x17be6c];if(_0x27d03f[_0xb1f7('0x12')]){_0x27d03f[_0xb1f7('0x12')]=_0x27d03f['type']['toLowerCase']();}var _0x168a3c=[];var _0xb82158=[];delete _0x27d03f['id'];delete _0x27d03f[_0xb1f7('0x27')];delete _0x27d03f['updatedAt'];var _0x7e7f6d=_0x27d03f['interval']!==_0xb1f7('0x28')?[_0x27d03f['interval']]:_0x27d03f['IntervalId']?_[_0xb1f7('0x29')](_['filter'](_0x300790['intervals'],{'IntervalId':_0x27d03f[_0xb1f7('0x3')]}),_0xb1f7('0x2a')):[];if(_0x27d03f[_0xb1f7('0x21')](_0xb1f7('0x2b'))){if(_0x27d03f[_0xb1f7('0x2b')]&&_0x27d03f['tag']!=='--'){_0x168a3c[_0xb1f7('0x15')]({'type':_0x27d03f[_0xb1f7('0x12')],'app':'Set','appdata':_0xb1f7('0x2c')+_0x27d03f[_0xb1f7('0x2b')],'context':_0x27d03f[_0xb1f7('0x17')],'exten':_0x27d03f[_0xb1f7('0x6')],'priority':_0x7e7f6d[_0xb1f7('0x26')]+_0x300790[_0xb1f7('0xc')]+_0xb78cea++,'VoiceExtensionId':_0x27d03f[_0xb1f7('0x13')]});}}if(_0x27d03f[_0xb1f7('0x12')]===_0xb1f7('0x18')&&_0x27d03f[_0xb1f7('0x21')](_0xb1f7('0x2d'))){if(_0x27d03f[_0xb1f7('0x2d')]){_0x168a3c['push']({'type':_0x27d03f['type'],'app':'ExecIf','appdata':_0xb1f7('0x2e')+_0x27d03f[_0xb1f7('0x2d')]+')','context':_0x27d03f[_0xb1f7('0x17')],'exten':_0x27d03f[_0xb1f7('0x6')],'priority':_0x7e7f6d[_0xb1f7('0x26')]+_0x300790[_0xb1f7('0xc')]+_0xb78cea++,'VoiceExtensionId':_0x27d03f[_0xb1f7('0x13')]});}else{_0x168a3c[_0xb1f7('0x15')]({'type':_0x27d03f['type'],'app':_0xb1f7('0x1d'),'appdata':_0xb1f7('0x2f'),'context':_0x27d03f[_0xb1f7('0x17')],'exten':_0x27d03f[_0xb1f7('0x6')],'priority':_0x7e7f6d[_0xb1f7('0x26')]+_0x300790[_0xb1f7('0xc')]+_0xb78cea++,'VoiceExtensionId':_0x27d03f[_0xb1f7('0x13')]});}}if(_0x27d03f[_0xb1f7('0x21')](_0xb1f7('0x30'))){if(_0x21bc3f[_0xb1f7('0x31')](_0x27d03f[_0xb1f7('0x32')]['toLowerCase']())>=0x0&&_0x27d03f[_0xb1f7('0x33')]!==_0xb1f7('0x34')){if(_0x27d03f[_0xb1f7('0x30')]){_0x168a3c[_0xb1f7('0x15')]({'type':_0x27d03f[_0xb1f7('0x12')],'app':'ExecIf','appdata':_0xb1f7('0x35'),'context':_0x27d03f[_0xb1f7('0x17')],'exten':_0x27d03f[_0xb1f7('0x6')],'priority':_0x7e7f6d[_0xb1f7('0x26')]+_0x300790[_0xb1f7('0xc')]+_0xb78cea++,'VoiceExtensionId':_0x27d03f['VoiceExtensionId']});_0x168a3c['push']({'type':_0x27d03f['type'],'app':_0xb1f7('0x10'),'appdata':_0xb1f7('0x36'),'context':_0x27d03f[_0xb1f7('0x17')],'exten':_0x27d03f['exten'],'priority':_0x7e7f6d[_0xb1f7('0x26')]+_0x300790[_0xb1f7('0xc')]+_0xb78cea++,'VoiceExtensionId':_0x27d03f['VoiceExtensionId']});}else{_0x168a3c[_0xb1f7('0x15')]({'type':_0x27d03f['type'],'app':_0xb1f7('0x1d'),'appdata':_0xb1f7('0x37'),'context':_0x27d03f[_0xb1f7('0x17')],'exten':_0x27d03f[_0xb1f7('0x6')],'priority':_0x7e7f6d[_0xb1f7('0x26')]+_0x300790[_0xb1f7('0xc')]+_0xb78cea++,'VoiceExtensionId':_0x27d03f['VoiceExtensionId']});_0x168a3c[_0xb1f7('0x15')]({'type':_0x27d03f[_0xb1f7('0x12')],'app':_0xb1f7('0x10'),'appdata':_0xb1f7('0x38'),'context':_0x27d03f[_0xb1f7('0x17')],'exten':_0x27d03f[_0xb1f7('0x6')],'priority':_0x7e7f6d[_0xb1f7('0x26')]+_0x300790[_0xb1f7('0xc')]+_0xb78cea++,'VoiceExtensionId':_0x27d03f[_0xb1f7('0x13')]});}}}for(var _0x9e4dff=0x0;_0x9e4dff<_0x7e7f6d[_0xb1f7('0x26')];_0x9e4dff+=0x1){var _0xfe7066=_0x300790[_0xb1f7('0xc')]+_0x7e7f6d[_0xb1f7('0x26')];var _0xdf77e2=_0x9e4dff===_0x7e7f6d[_0xb1f7('0x26')]-0x1?_0x300790[_0xb1f7('0xc')]+_0x168a3c[_0xb1f7('0x26')]+_0xb82158[_0xb1f7('0x26')]+0x2:_0x300790['priority']+_0x9e4dff+0x1;_0x168a3c[_0xb1f7('0x39')](_0x9e4dff,0x0,{'type':_0x27d03f[_0xb1f7('0x12')],'app':'GotoIfTime','appdata':_0x7e7f6d[_0x9e4dff]+'?'+_0x27d03f['context']+',${EXTEN},'+_0xfe7066+':'+_0x27d03f[_0xb1f7('0x17')]+_0xb1f7('0x3a')+_0xdf77e2,'exten':_0x27d03f[_0xb1f7('0x6')],'context':_0x27d03f[_0xb1f7('0x17')],'priority':_0x300790['priority']+_0x9e4dff,'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0]['VoiceExtensionId']});}_0x27d03f['priority']=_0x168a3c[_0xb1f7('0x26')]?_['last'](_0x168a3c)[_0xb1f7('0xc')]+0x1:_0x300790[_0xb1f7('0xc')];_0x300790[_0xb1f7('0xc')]=(_0xb82158[_0xb1f7('0x26')]?_[_0xb1f7('0x3b')](_0xb82158)[_0xb1f7('0xc')]:_0x27d03f[_0xb1f7('0xc')])+0x1;_0x300790['extensions']=_['concat'](_0x300790[_0xb1f7('0xd')],_0x168a3c,[_0x27d03f],_0xb82158);}_0x300790['extensions'][_0xb1f7('0x15')]({'type':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x12')],'app':_0xb1f7('0x3c'),'exten':_0x43b31a[_0x24a0bf][0x0]['exten'],'context':_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x17')],'priority':_0x300790[_0xb1f7('0xc')],'VoiceExtensionId':_0x43b31a[_0x24a0bf][0x0]['VoiceExtensionId']});_0x3e970c['push'](_0x43b31a[_0x24a0bf][0x0][_0xb1f7('0x13')]);_0x4e06d3=_[_0xb1f7('0x3d')](_0x4e06d3,_0x300790[_0xb1f7('0xd')]);}}return _0x19cbb2[_0xb1f7('0x3e')](function(_0x4d5b00){return _0x19cbb2[_0xb1f7('0x0')][_0xb1f7('0x2')][_0xb1f7('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x3e970c}},'transaction':_0x4d5b00})[_0xb1f7('0x4')](function(_0x5f2ba0){return _0x19cbb2[_0xb1f7('0x0')][_0xb1f7('0x2')][_0xb1f7('0x40')](_[_0xb1f7('0x41')](_0x4e06d3,_0xb1f7('0xc')),{'transaction':_0x4d5b00});});});})[_0xb1f7('0x42')](function(_0x1c824b){console[_0xb1f7('0x43')](_0x1c824b);});}exports[_0xb1f7('0x44')]=rewrite; \ No newline at end of file +var _0x6770=['interval','*,*,*,*','tag','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','length','answer','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','find','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','extension','cutdigits','${EXTEN:','${EXTEN}','push','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt'];(function(_0x3cd746,_0x1390e6){var _0x505968=function(_0x377845){while(--_0x377845){_0x3cd746['push'](_0x3cd746['shift']());}};_0x505968(++_0x1390e6);}(_0x6770,0x13e));var _0x0677=function(_0x585e16,_0x53702a){_0x585e16=_0x585e16-0x0;var _0x56a5f3=_0x6770[_0x585e16];return _0x56a5f3;};'use strict';var _=require(_0x0677('0x0'));var util=require(_0x0677('0x1'));function rewrite(_0x353c06,_0x2906f7){var _0x31f142=this;return _0x353c06[_0x0677('0x2')][_0x0677('0x3')][_0x0677('0x4')]({'raw':!![]})['then'](function(_0x246b62){_0x31f142[_0x0677('0x5')]=_0x246b62;return _0x353c06[_0x0677('0x2')][_0x0677('0x6')]['findAll']({'where':{'IntervalId':_0x2906f7[_0x0677('0x7')]},'raw':!![]});})[_0x0677('0x8')](function(_0x2a7ddb){return _0x353c06[_0x0677('0x2')][_0x0677('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x0677('0x9')](_[_0x0677('0xa')](_0x2a7ddb,_0x0677('0xb')))}},'order':[{'raw':_0x0677('0xc')}],'raw':!![]});})[_0x0677('0x8')](function(_0x1e567d){var _0x3ba473=_[_0x0677('0xd')](_0x1e567d,{'priority':'1'});var _0x424f74=_[_0x0677('0xd')](_0x1e567d,{'isApp':0x1});var _0x1836f9=_[_0x0677('0xe')](_0x424f74,_0x0677('0xb'));var _0x3f1b58=[_0x0677('0xf'),'playback'];var _0x349c9f=[];var _0x358b07=[];for(var _0x461887 in _0x1836f9){if(_0x1836f9[_0x0677('0x10')](_0x461887)){_0x31f142[_0x0677('0x11')]=0x2;_0x31f142[_0x0677('0x12')]=[];_0x31f142['extension']=_[_0x0677('0x13')](_0x3ba473,{'exten':_0x1836f9[_0x461887][0x0][_0x0677('0xb')]});_0x31f142['extensions']['push']({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':_0x0677('0x15'),'appdata':util[_0x0677('0x16')](_0x0677('0x17'),_0x1836f9[_0x461887][0x0][_0x0677('0x14')]),'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0]['exten'],'priority':_0x31f142['priority']++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0][_0x0677('0x19')]});if(_0x1836f9[_0x461887][0x0][_0x0677('0x14')]===_0x0677('0x1a')){_0x31f142['extensions']['push']({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':_0x0677('0x15'),'appdata':_0x0677('0x1b')+_0x1836f9[_0x461887][0x0]['VoiceExtensionId'],'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0]['exten'],'priority':_0x31f142['priority']++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0][_0x0677('0x19')]});}else if(_0x1836f9[_0x461887][0x0]['type']==='outbound'){if(_0x31f142[_0x0677('0x1c')]){_0x31f142[_0x0677('0x12')]['push']({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':'Set','appdata':'CDR(destination)='+(_0x31f142[_0x0677('0x1c')][_0x0677('0x1d')]?_0x0677('0x1e')+_0x31f142[_0x0677('0x1c')][_0x0677('0x1d')]+'}':_0x0677('0x1f')),'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0][_0x0677('0xb')],'priority':_0x31f142[_0x0677('0x11')]++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0]['VoiceExtensionId']});}_0x31f142[_0x0677('0x12')][_0x0677('0x20')]({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':_0x0677('0x15'),'appdata':_0x0677('0x1b')+_0x1836f9[_0x461887][0x0][_0x0677('0x19')],'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0]['exten'],'priority':_0x31f142[_0x0677('0x11')]++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0][_0x0677('0x19')]});var _0x2dc25e=_0x31f142[_0x0677('0x11')]++;_0x31f142[_0x0677('0x12')][_0x0677('0x20')]({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':_0x0677('0x21'),'appdata':_0x0677('0x22')+(_0x2dc25e+0x2)+_0x0677('0x23')+(_0x2dc25e+0x1)+')','context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0][_0x0677('0xb')],'priority':_0x2dc25e,'VoiceExtensionId':_0x1836f9[_0x461887][0x0]['VoiceExtensionId']});if(_0x31f142[_0x0677('0x1c')]){_0x31f142['extensions'][_0x0677('0x20')]({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':_0x0677('0x15'),'appdata':_0x31f142['extension'][_0x0677('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x31f142[_0x0677('0x1c')][_0x0677('0x1d')]+'}':_0x0677('0x24'),'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0]['exten'],'priority':_0x31f142['priority']++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0]['VoiceExtensionId']});}_0x31f142[_0x0677('0x12')][_0x0677('0x20')]({'type':_0x1836f9[_0x461887][0x0]['type'],'app':_0x0677('0x15'),'appdata':'outboundrouteid='+_0x1836f9[_0x461887][0x0][_0x0677('0x19')],'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0]['exten'],'priority':_0x31f142[_0x0677('0x11')]++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0]['VoiceExtensionId']});if(_0x31f142[_0x0677('0x1c')]&&_0x31f142['extension'][_0x0677('0x10')](_0x0677('0x25'))&&_0x31f142[_0x0677('0x1c')][_0x0677('0x25')]!==_0x0677('0x26')){_0x31f142[_0x0677('0x12')][_0x0677('0x20')]({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0][_0x0677('0xb')],'priority':_0x31f142[_0x0677('0x11')]++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0]['VoiceExtensionId']});_0x31f142[_0x0677('0x12')]['push']({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':_0x0677('0x15'),'appdata':_0x0677('0x27')+_0x31f142[_0x0677('0x1c')][_0x0677('0x25')]||_0x0677('0x28'),'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0]['exten'],'priority':_0x31f142[_0x0677('0x11')]++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0][_0x0677('0x19')]});}}_0x31f142[_0x0677('0x12')]['push']({'type':_0x1836f9[_0x461887][0x0]['type'],'app':_0x0677('0x15'),'appdata':_0x0677('0x29'),'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0]['exten'],'priority':_0x31f142[_0x0677('0x11')]++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0]['VoiceExtensionId']});_0x31f142[_0x0677('0x12')][_0x0677('0x20')]({'type':_0x1836f9[_0x461887][0x0]['type'],'app':_0x0677('0x15'),'appdata':_0x0677('0x2a'),'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'exten':_0x1836f9[_0x461887][0x0]['exten'],'priority':_0x31f142[_0x0677('0x11')]++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0][_0x0677('0x19')]});_0x31f142[_0x0677('0x12')][_0x0677('0x20')]({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':'Set','appdata':_0x0677('0x2b'),'context':_0x1836f9[_0x461887][0x0]['context'],'exten':_0x1836f9[_0x461887][0x0][_0x0677('0xb')],'priority':_0x31f142[_0x0677('0x11')]++,'VoiceExtensionId':_0x1836f9[_0x461887][0x0][_0x0677('0x19')]});for(var _0x47e0fe=0x0,_0x55610f=0x0;_0x47e0fe<_0x1836f9[_0x461887]['length'];_0x47e0fe+=0x1,_0x55610f=0x0){var _0x4e0d92=_0x1836f9[_0x461887][_0x47e0fe];if(_0x4e0d92[_0x0677('0x14')]){_0x4e0d92[_0x0677('0x14')]=_0x4e0d92[_0x0677('0x14')][_0x0677('0x2c')]();}var _0x3d2f77=[];var _0x4943af=[];delete _0x4e0d92['id'];delete _0x4e0d92[_0x0677('0x2d')];delete _0x4e0d92[_0x0677('0x2e')];var _0x56f318=_0x4e0d92[_0x0677('0x2f')]!==_0x0677('0x30')?[_0x4e0d92[_0x0677('0x2f')]]:_0x4e0d92['IntervalId']?_[_0x0677('0xa')](_[_0x0677('0xd')](_0x31f142[_0x0677('0x5')],{'IntervalId':_0x4e0d92[_0x0677('0x7')]}),_0x0677('0x2f')):[];if(_0x4e0d92[_0x0677('0x10')](_0x0677('0x31'))){if(_0x4e0d92[_0x0677('0x31')]&&_0x4e0d92[_0x0677('0x31')]!=='--'){_0x3d2f77[_0x0677('0x20')]({'type':_0x4e0d92[_0x0677('0x14')],'app':'Set','appdata':'CDR(tag)='+_0x4e0d92[_0x0677('0x31')],'context':_0x4e0d92[_0x0677('0x18')],'exten':_0x4e0d92[_0x0677('0xb')],'priority':_0x56f318['length']+_0x31f142['priority']+_0x55610f++,'VoiceExtensionId':_0x4e0d92[_0x0677('0x19')]});}}if(_0x4e0d92[_0x0677('0x14')]===_0x0677('0x32')&&_0x4e0d92[_0x0677('0x10')](_0x0677('0x33'))){if(_0x4e0d92[_0x0677('0x33')]){_0x3d2f77[_0x0677('0x20')]({'type':_0x4e0d92[_0x0677('0x14')],'app':_0x0677('0x21'),'appdata':_0x0677('0x34')+_0x4e0d92[_0x0677('0x33')]+')','context':_0x4e0d92['context'],'exten':_0x4e0d92[_0x0677('0xb')],'priority':_0x56f318['length']+_0x31f142[_0x0677('0x11')]+_0x55610f++,'VoiceExtensionId':_0x4e0d92[_0x0677('0x19')]});}else{_0x3d2f77[_0x0677('0x20')]({'type':_0x4e0d92[_0x0677('0x14')],'app':_0x0677('0x21'),'appdata':_0x0677('0x35'),'context':_0x4e0d92[_0x0677('0x18')],'exten':_0x4e0d92[_0x0677('0xb')],'priority':_0x56f318[_0x0677('0x36')]+_0x31f142[_0x0677('0x11')]+_0x55610f++,'VoiceExtensionId':_0x4e0d92[_0x0677('0x19')]});}}if(_0x4e0d92[_0x0677('0x10')](_0x0677('0x37'))){if(_0x3f1b58['indexOf'](_0x4e0d92[_0x0677('0x38')][_0x0677('0x2c')]())>=0x0&&_0x4e0d92[_0x0677('0x39')]!==_0x0677('0x3a')){if(_0x4e0d92[_0x0677('0x37')]){_0x3d2f77[_0x0677('0x20')]({'type':_0x4e0d92[_0x0677('0x14')],'app':_0x0677('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4e0d92[_0x0677('0x18')],'exten':_0x4e0d92[_0x0677('0xb')],'priority':_0x56f318[_0x0677('0x36')]+_0x31f142[_0x0677('0x11')]+_0x55610f++,'VoiceExtensionId':_0x4e0d92[_0x0677('0x19')]});_0x3d2f77[_0x0677('0x20')]({'type':_0x4e0d92[_0x0677('0x14')],'app':_0x0677('0x15'),'appdata':_0x0677('0x3b'),'context':_0x4e0d92[_0x0677('0x18')],'exten':_0x4e0d92['exten'],'priority':_0x56f318['length']+_0x31f142[_0x0677('0x11')]+_0x55610f++,'VoiceExtensionId':_0x4e0d92[_0x0677('0x19')]});}else{_0x3d2f77[_0x0677('0x20')]({'type':_0x4e0d92[_0x0677('0x14')],'app':_0x0677('0x21'),'appdata':_0x0677('0x3c'),'context':_0x4e0d92[_0x0677('0x18')],'exten':_0x4e0d92[_0x0677('0xb')],'priority':_0x56f318[_0x0677('0x36')]+_0x31f142[_0x0677('0x11')]+_0x55610f++,'VoiceExtensionId':_0x4e0d92[_0x0677('0x19')]});_0x3d2f77[_0x0677('0x20')]({'type':_0x4e0d92[_0x0677('0x14')],'app':_0x0677('0x15'),'appdata':_0x0677('0x3d'),'context':_0x4e0d92[_0x0677('0x18')],'exten':_0x4e0d92[_0x0677('0xb')],'priority':_0x56f318[_0x0677('0x36')]+_0x31f142['priority']+_0x55610f++,'VoiceExtensionId':_0x4e0d92[_0x0677('0x19')]});}}}for(var _0x10b666=0x0;_0x10b666<_0x56f318[_0x0677('0x36')];_0x10b666+=0x1){var _0x5b591b=_0x31f142[_0x0677('0x11')]+_0x56f318['length'];var _0x3e3a92=_0x10b666===_0x56f318[_0x0677('0x36')]-0x1?_0x31f142[_0x0677('0x11')]+_0x3d2f77[_0x0677('0x36')]+_0x4943af[_0x0677('0x36')]+0x2:_0x31f142['priority']+_0x10b666+0x1;_0x3d2f77[_0x0677('0x3e')](_0x10b666,0x0,{'type':_0x4e0d92[_0x0677('0x14')],'app':_0x0677('0x3f'),'appdata':_0x56f318[_0x10b666]+'?'+_0x4e0d92[_0x0677('0x18')]+',${EXTEN},'+_0x5b591b+':'+_0x4e0d92['context']+_0x0677('0x40')+_0x3e3a92,'exten':_0x4e0d92[_0x0677('0xb')],'context':_0x4e0d92[_0x0677('0x18')],'priority':_0x31f142[_0x0677('0x11')]+_0x10b666,'VoiceExtensionId':_0x1836f9[_0x461887][0x0][_0x0677('0x19')]});}_0x4e0d92[_0x0677('0x11')]=_0x3d2f77[_0x0677('0x36')]?_[_0x0677('0x41')](_0x3d2f77)[_0x0677('0x11')]+0x1:_0x31f142[_0x0677('0x11')];_0x31f142[_0x0677('0x11')]=(_0x4943af[_0x0677('0x36')]?_[_0x0677('0x41')](_0x4943af)[_0x0677('0x11')]:_0x4e0d92[_0x0677('0x11')])+0x1;_0x31f142['extensions']=_['concat'](_0x31f142[_0x0677('0x12')],_0x3d2f77,[_0x4e0d92],_0x4943af);}_0x31f142[_0x0677('0x12')][_0x0677('0x20')]({'type':_0x1836f9[_0x461887][0x0][_0x0677('0x14')],'app':_0x0677('0x42'),'exten':_0x1836f9[_0x461887][0x0][_0x0677('0xb')],'context':_0x1836f9[_0x461887][0x0][_0x0677('0x18')],'priority':_0x31f142[_0x0677('0x11')],'VoiceExtensionId':_0x1836f9[_0x461887][0x0][_0x0677('0x19')]});_0x349c9f[_0x0677('0x20')](_0x1836f9[_0x461887][0x0][_0x0677('0x19')]);_0x358b07=_[_0x0677('0x43')](_0x358b07,_0x31f142['extensions']);}}return _0x353c06[_0x0677('0x44')](function(_0x383106){return _0x353c06[_0x0677('0x2')][_0x0677('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x349c9f}},'transaction':_0x383106})[_0x0677('0x8')](function(_0x34e379){return _0x353c06[_0x0677('0x2')][_0x0677('0x6')][_0x0677('0x45')](_[_0x0677('0x46')](_0x358b07,_0x0677('0x11')),{'transaction':_0x383106});});});})['catch'](function(_0xc080b4){console[_0x0677('0x47')](_0xc080b4);});}exports[_0x0677('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f539c35..bdd01d2 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 _0x597c=['../../../config/logger','api','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','CmContact','create','keys','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','VoiceQueueId','catch','onlyIfOpen','all','VoiceQueue','findAll','BlackLists','push','query','CampaignId','generalCheckHopper','finally','emit','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit','SIGINT','CSV\x20import\x20process\x20stopped!','parse','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment'];(function(_0x4fce3b,_0x453cd4){var _0x54c51b=function(_0x8350c1){while(--_0x8350c1){_0x4fce3b['push'](_0x4fce3b['shift']());}};_0x54c51b(++_0x453cd4);}(_0x597c,0x66));var _0xc597=function(_0x63567,_0x3135cf){_0x63567=_0x63567-0x0;var _0x2ec3f5=_0x597c[_0x63567];return _0x2ec3f5;};'use strict';var BPromise=require(_0xc597('0x0'));var util=require(_0xc597('0x1'));var _=require(_0xc597('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xc597('0x3'));var Redis=require(_0xc597('0x4'));var db=require(_0xc597('0x5'))['db'];var config=require(_0xc597('0x6'));var logger=require(_0xc597('0x7'))(_0xc597('0x8'));config['redis']=_[_0xc597('0x9')](config[_0xc597('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc597('0xb'))(new Redis(config[_0xc597('0xa')]));require(_0xc597('0xc'))['register'](socket);try{if(!process[_0xc597('0xd')][0x2]||process['argv'][0x2]==='undefined'||process['argv'][0x2]===_0xc597('0xe')){throw new Error(_0xc597('0xf'));}var FILEPATH=process[_0xc597('0xd')][0x2];if(!process[_0xc597('0xd')][0x3]||process[_0xc597('0xd')][0x3]===_0xc597('0x10')||process[_0xc597('0xd')][0x3]===_0xc597('0xe')||!process[_0xc597('0xd')][0x4]||process['argv'][0x4]===_0xc597('0x10')||process['argv'][0x4]===_0xc597('0xe')){throw new Error(_0xc597('0x11'));}var FIELDS=_[_0xc597('0x12')](process[_0xc597('0xd')][0x3]['split'](','),process[_0xc597('0xd')][0x4][_0xc597('0x13')](','));if(!process[_0xc597('0xd')][0x5]||process['argv'][0x5]==='undefined'||process[_0xc597('0xd')][0x5]===_0xc597('0xe')){throw new Error(_0xc597('0x14'));}var LISTID=process[_0xc597('0xd')][0x5];var COMPANYID=process[_0xc597('0xd')][0x6]&&process[_0xc597('0xd')][0x6]!=='undefined'&&process[_0xc597('0xd')][0x6]!=='null'?process[_0xc597('0xd')][0x6]:null;var DUPLICATES=process[_0xc597('0xd')][0x7]&&process[_0xc597('0xd')][0x7]!==_0xc597('0x10')&&process['argv'][0x7]!==_0xc597('0xe')?process[_0xc597('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xc597('0xd')][0x8]==='undefined'||process[_0xc597('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xc597('0xd')][0x8];}catch(_0x16f085){logger['error'](_0x16f085);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(_0x5a21aa,_0x15b91b,_0x60bcaa,_0x4394c3){var _0x347fbd={'message':_0x15b91b};_0x347fbd[_0x5a21aa]=!![];if(_0x60bcaa){_0x347fbd[_0xc597('0x15')]=_0x60bcaa;}if(_0x4394c3){_0x347fbd['index']=_0x4394c3;}return _0x347fbd;}function isEmail(_0x4d9bd7){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))*$/[_0xc597('0x16')](_0x4d9bd7);}function checkRow(_0x48b1ce,_0x2b5c1e,_0x4c89b3){return new BPromise(function(_0x488d46,_0x5da323){if(_[_0xc597('0x17')](_0x48b1ce)){return _0x5da323(handleCheckRowError(_0xc597('0x18'),_0xc597('0x19'),null,_0x4c89b3));}if(_0x48b1ce[_0xc597('0x1a')]&&_0x48b1ce[_0xc597('0x1a')][_0xc597('0x1b')]){var _0x4dd461=_['map'](_0x48b1ce[_0xc597('0x1a')],_0xc597('0x1c'))[_0xc597('0x1d')](';');return _0x5da323(handleCheckRowError(_0xc597('0x18'),_0x4dd461,null,_0x4c89b3));}var _0x22a029={};for(var _0x30a143 in FIELDS){if(FIELDS[_0xc597('0x1e')](_0x30a143)&&FIELDS[_0x30a143]){_0x22a029[_0x30a143]=_0x48b1ce[_0xc597('0x1f')][0x0][FIELDS[_0x30a143]]||_0x48b1ce[_0xc597('0x1f')][0x0]['\ufeff'+FIELDS[_0x30a143]];}}if(!_0x22a029['firstName']){return _0x5da323(handleCheckRowError(_0xc597('0x18'),_0xc597('0x20'),null,_0x4c89b3));}if(!_0x22a029[_0xc597('0x21')]){return _0x5da323(handleCheckRowError(_0xc597('0x18'),'phone\x20not\x20specified!',null,_0x4c89b3));}if(_0x22a029[_0xc597('0x22')]){var _0x527a8f=moment(_0x22a029[_0xc597('0x22')],_0xc597('0x23'));if(!_0x527a8f[_0xc597('0x24')]()){return _0x5da323(handleCheckRowError(_0xc597('0x18'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4c89b3));}}if(_0x22a029[_0xc597('0x25')]){if(!isEmail(_0x22a029[_0xc597('0x25')])){return _0x5da323(handleCheckRowError(_0xc597('0x18'),_0xc597('0x26'),null,_0x4c89b3));}}_0x22a029['ListId']=LISTID;_0x22a029['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2b5c1e){var _0xa7e935={};for(var _0x5b8ed1=0x0,_0x36c49c=DUPLICATES[_0xc597('0x1b')];_0x5b8ed1<_0x36c49c;_0x5b8ed1+=0x1){_0xa7e935[DUPLICATES[_0x5b8ed1]]=_0x22a029[DUPLICATES[_0x5b8ed1]];}var _0x23688a=_[_0xc597('0x27')](_0x2b5c1e,_0xa7e935);if(_0x23688a){return _0x5da323(handleCheckRowError(_0xc597('0x28'),'Duplicate\x20Contact',_0x23688a,_0x4c89b3));}}return db[_0xc597('0x29')][_0xc597('0x2a')](_0x22a029,{'raw':!![],'hooks':![],'fields':_[_0xc597('0x2b')](_0x22a029)})['then'](function(_0x34e1c1){if(DUPLICATES&&DUPLICATES[_0xc597('0x1b')]&&_0x2b5c1e){_0x2b5c1e['push'](_[_0xc597('0x2c')](_0x22a029,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x34e1c1['id'];return _0x488d46();})['catch'](function(_0x5809a2){return _0x5da323(handleCheckRowError(_0xc597('0x18'),_0xc597('0x2d')+(_0x5809a2[_0xc597('0x1c')]||JSON['stringify'](_0x5809a2)),null,_0x4c89b3));});});}function checkHopper(){function _0x495c54(){return function(_0x184fe8){logger[_0xc597('0x18')](_0xc597('0x2e'),_0xc597('0x2f'),util[_0xc597('0x30')](_0x184fe8,{'showHidden':![],'depth':null}));};}var _0x43c950=function(_0x41f8ba,_0x8ae6d4){var _0xed9c61=squel[_0xc597('0x31')]()[_0xc597('0x32')](_0xc597('0x33'))[_0xc597('0x34')](['phone',_0xc597('0x35'),_0xc597('0x36'),_0xc597('0x37'),_0x8ae6d4,_0xc597('0x38'),_0xc597('0x39')],squel[_0xc597('0x3a')]()[_0xc597('0x3b')]('phone','phone')[_0xc597('0x3b')]('NOW()','scheduledAt')['field']('id','ContactId')['field'](LISTID[_0xc597('0x3c')](),'ListId')['field'](_0x41f8ba['id'][_0xc597('0x3c')](),_0x8ae6d4)[_0xc597('0x3b')]('NOW()','createdAt')['field'](_0xc597('0x3d'),_0xc597('0x39'))[_0xc597('0x3e')](_0xc597('0x3f'))[_0xc597('0x40')](_0xc597('0x41'))[_0xc597('0x40')](_0xc597('0x42'),LISTID[_0xc597('0x3c')]())[_0xc597('0x40')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc597('0x43'),squel[_0xc597('0x3a')]()['field'](_0xc597('0x21'))[_0xc597('0x3e')](_0xc597('0x33'))[_0xc597('0x40')](_0x8ae6d4+_0xc597('0x44'),_0x41f8ba['id'][_0xc597('0x3c')]())))[_0xc597('0x3c')]();return _0xed9c61;};var _0x39ec3d=function(_0x3b3a56,_0x38f576){var _0x32c659=squel[_0xc597('0x31')]()[_0xc597('0x32')]('cm_hopper')[_0xc597('0x34')]([_0xc597('0x21'),'scheduledAt',_0xc597('0x36'),_0xc597('0x37'),_0x38f576,'createdAt','updatedAt'],squel[_0xc597('0x3a')]()[_0xc597('0x3b')]('phone',_0xc597('0x21'))[_0xc597('0x3b')](_0xc597('0x3d'),_0xc597('0x35'))[_0xc597('0x3b')]('id',_0xc597('0x36'))[_0xc597('0x3b')](LISTID[_0xc597('0x3c')](),_0xc597('0x37'))[_0xc597('0x3b')](_0x3b3a56['id'][_0xc597('0x3c')](),_0x38f576)[_0xc597('0x3b')](_0xc597('0x3d'),_0xc597('0x38'))[_0xc597('0x3b')](_0xc597('0x3d'),_0xc597('0x39'))[_0xc597('0x3e')](_0xc597('0x3f'))[_0xc597('0x40')](_0xc597('0x41'))[_0xc597('0x40')](_0xc597('0x42'),LISTID[_0xc597('0x3c')]())[_0xc597('0x40')]('id\x20IN\x20?',squel[_0xc597('0x45')](hopperContacts))[_0xc597('0x40')](_0xc597('0x46'))[_0xc597('0x40')](_0xc597('0x43'),squel['select']()[_0xc597('0x3b')](_0xc597('0x47'))[_0xc597('0x3e')](_0xc597('0x48'))[_0xc597('0x40')](_0x38f576+_0xc597('0x44'),_0x3b3a56['id']['toString']()))[_0xc597('0x40')](_0xc597('0x43'),squel[_0xc597('0x3a')]()[_0xc597('0x3b')](_0xc597('0x21'))[_0xc597('0x3e')]('cm_hopper')[_0xc597('0x40')](_0x38f576+_0xc597('0x44'),_0x3b3a56['id'][_0xc597('0x3c')]())))[_0xc597('0x3c')]();return _0x32c659;};function _0x289747(_0x65eeae,_0x14d155){var _0x290564=squel[_0xc597('0x31')]()[_0xc597('0x32')](_0xc597('0x33'))[_0xc597('0x34')](['phone',_0xc597('0x35'),_0xc597('0x36'),'ListId',_0x14d155,_0xc597('0x38'),_0xc597('0x39')],squel[_0xc597('0x3a')]()[_0xc597('0x3b')](_0xc597('0x21'),_0xc597('0x21'))[_0xc597('0x3b')](_0xc597('0x3d'),_0xc597('0x35'))[_0xc597('0x3b')]('id','ContactId')[_0xc597('0x3b')](LISTID[_0xc597('0x3c')](),_0xc597('0x37'))[_0xc597('0x3b')](_0x65eeae['id'][_0xc597('0x3c')](),_0x14d155)[_0xc597('0x3b')](_0xc597('0x3d'),_0xc597('0x38'))[_0xc597('0x3b')](_0xc597('0x3d'),_0xc597('0x39'))[_0xc597('0x3e')](_0xc597('0x3f'))[_0xc597('0x40')](_0xc597('0x41'))[_0xc597('0x40')](_0xc597('0x42'),LISTID[_0xc597('0x3c')]())[_0xc597('0x40')](_0xc597('0x49'),squel[_0xc597('0x45')](hopperContacts))[_0xc597('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0xc597('0x3c')]();return _0x290564;}function _0x119e8d(_0x49ba83,_0x375a6a){var _0xf3b859=squel[_0xc597('0x31')]()[_0xc597('0x32')](_0xc597('0x4a'))[_0xc597('0x34')]([_0xc597('0x21'),'ContactId',_0xc597('0x37'),_0x375a6a,_0xc597('0x38'),_0xc597('0x39')],squel[_0xc597('0x3a')]()[_0xc597('0x3b')](_0xc597('0x21'),_0xc597('0x21'))[_0xc597('0x3b')]('id',_0xc597('0x36'))[_0xc597('0x3b')](LISTID[_0xc597('0x3c')](),'ListId')[_0xc597('0x3b')](_0x49ba83['id'][_0xc597('0x3c')](),_0x375a6a)[_0xc597('0x3b')](_0xc597('0x3d'),'createdAt')[_0xc597('0x3b')](_0xc597('0x3d'),_0xc597('0x39'))[_0xc597('0x3e')](_0xc597('0x3f'))[_0xc597('0x40')]('deletedAt\x20IS\x20NULL')[_0xc597('0x40')](_0xc597('0x42'),LISTID[_0xc597('0x3c')]())[_0xc597('0x40')](_0xc597('0x49'),squel[_0xc597('0x45')](hopperContacts))[_0xc597('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0xc597('0x3c')]();return _0xf3b859;}return db['VoiceQueue']['findAll']({'where':{'type':_0xc597('0x4b')},'attributes':['id',_0xc597('0x4c')],'include':[{'model':db[_0xc597('0x4d')],'as':_0xc597('0x4e'),'where':{'id':LISTID}}]})[_0xc597('0x4f')](function(_0x592ca6){var _0x394bbd=[];if(_0x592ca6){var _0x49f190;for(var _0x3a822f=0x0,_0x28e153;_0x3a822f<_0x592ca6[_0xc597('0x1b')];_0x3a822f+=0x1){_0x28e153=_0x592ca6[_0x3a822f][_0xc597('0x50')]({'plain':!![]});switch(_0x28e153[_0xc597('0x4c')]){case _0xc597('0x51'):_0x394bbd['push'](db[_0xc597('0x52')]['query'](_0x39ec3d(_0x28e153,_0xc597('0x53')))[_0xc597('0x4f')](function(){})[_0xc597('0x54')](_0x495c54()));break;case _0xc597('0x55'):_0x394bbd['push'](db[_0xc597('0x52')]['query'](_0x43c950(_0x28e153,_0xc597('0x53')))['then'](function(){})[_0xc597('0x54')](_0x495c54()));break;default:_0x394bbd['push'](db[_0xc597('0x52')]['query'](_0x289747(_0x28e153,_0xc597('0x53')))['then'](function(){})[_0xc597('0x54')](_0x495c54()));}}}return _0x394bbd;})[_0xc597('0x56')]()[_0xc597('0x4f')](function(){return db[_0xc597('0x57')][_0xc597('0x58')]({'where':{'type':_0xc597('0x4b')},'attributes':['id'],'include':[{'model':db[_0xc597('0x4d')],'as':_0xc597('0x59'),'where':{'id':LISTID}}]})[_0xc597('0x4f')](function(_0x42b5a6){var _0x473414=[];if(_0x42b5a6){var _0x37e558;for(var _0xc7fad0=0x0,_0xc1c7e6;_0xc7fad0<_0x42b5a6['length'];_0xc7fad0+=0x1){_0xc1c7e6=_0x42b5a6[_0xc7fad0][_0xc597('0x50')]({'plain':!![]});_0x473414[_0xc597('0x5a')](db['sequelize']['query'](_0x119e8d(_0xc1c7e6,_0xc597('0x53')))[_0xc597('0x4f')](function(){})[_0xc597('0x54')](_0x495c54()));}}return _0x473414;})[_0xc597('0x56')]();})[_0xc597('0x4f')](function(){return db['Campaign'][_0xc597('0x58')]({'attributes':['id',_0xc597('0x4c')],'include':[{'model':db[_0xc597('0x4d')],'as':_0xc597('0x4e'),'where':{'id':LISTID}}]})[_0xc597('0x4f')](function(_0x32b68d){var _0x13d1b1=[];if(_0x32b68d){for(var _0x52e608=0x0,_0x53ae17;_0x52e608<_0x32b68d[_0xc597('0x1b')];_0x52e608+=0x1){_0x53ae17=_0x32b68d[_0x52e608][_0xc597('0x50')]({'plain':!![]});switch(_0x53ae17[_0xc597('0x4c')]){case _0xc597('0x51'):_0x13d1b1[_0xc597('0x5a')](db[_0xc597('0x52')][_0xc597('0x5b')](_0x39ec3d(_0x53ae17,_0xc597('0x5c')))[_0xc597('0x4f')](function(){})[_0xc597('0x54')](_0x495c54()));break;case _0xc597('0x55'):_0x13d1b1[_0xc597('0x5a')](db['sequelize'][_0xc597('0x5b')](_0x43c950(_0x53ae17,_0xc597('0x5c')))[_0xc597('0x4f')](function(){})[_0xc597('0x54')](_0x495c54()));break;default:_0x13d1b1[_0xc597('0x5a')](db['sequelize'][_0xc597('0x5b')](_0x289747(_0x53ae17,_0xc597('0x5c')))[_0xc597('0x4f')](function(){})['catch'](_0x495c54()));}}}return _0x13d1b1;})['all']();})[_0xc597('0x4f')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0xc597('0x4d')],'as':_0xc597('0x59'),'where':{'id':LISTID}}]})[_0xc597('0x4f')](function(_0x102002){var _0x32ec3c=[];if(_0x102002){for(var _0x4dd5f7=0x0,_0xd04d2f;_0x4dd5f7<_0x102002[_0xc597('0x1b')];_0x4dd5f7+=0x1){_0xd04d2f=_0x102002[_0x4dd5f7]['get']({'plain':!![]});_0x32ec3c[_0xc597('0x5a')](db[_0xc597('0x52')][_0xc597('0x5b')](_0x119e8d(_0xd04d2f,'CampaignId'))['then'](function(){})[_0xc597('0x54')](_0x495c54()));}}return _0x32ec3c;})[_0xc597('0x56')]();})[_0xc597('0x54')](function(_0x44418c){logger[_0xc597('0x18')]('cmContact,\x20%s,\x20%s',_0xc597('0x5d'),_0x44418c['message']);});}var processPromises=function(_0x1c23e9){return BPromise[_0xc597('0x56')](promises)[_0xc597('0x4f')](function(_0x36b680){})[_0xc597('0x54')](function(_0x20b9be){logger[_0xc597('0x18')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x20b9be));})[_0xc597('0x5e')](function(){socket[_0xc597('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1c23e9){return _0x1c23e9[_0xc597('0x60')]();}});};var endCsv=function(){return BPromise[_0xc597('0x61')]()[_0xc597('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0xc597('0x4f')](function(){socket[_0xc597('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc597('0x62')](FILEPATH);}catch(_0x53ba4c){logger[_0xc597('0x18')](_0xc597('0x63'),JSON[_0xc597('0x64')](_0x53ba4c));}finally{process[_0xc597('0x65')](0x0);}});};process['on'](_0xc597('0x66'),function(){logger['info'](_0xc597('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0xc597('0x4f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc597('0x13')](',');return db[_0xc597('0x29')][_0xc597('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x3eef17){var _0x41ee0f=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc597('0x68')](_0x41ee0f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x516ac0,_0x462f64){total+=0x1;var _0x16cfde=total;promises['push'](checkRow(_0x516ac0,_0x3eef17,_0x16cfde)['then'](function(){success+=0x1;})['catch'](function(_0x42e8e9){if(_0x42e8e9[_0xc597('0x18')]){errors+=0x1;delete _0x42e8e9[_0xc597('0x18')];}else if(_0x42e8e9['duplicate']){duplicates+=0x1;delete _0x42e8e9[_0xc597('0x28')];}rows[_0xc597('0x5a')](_0x42e8e9);}));if(total%0xc8===0x0){_0x462f64['pause']();return processPromises(_0x462f64);}},'complete':function(){return processPromises()['then'](function(){logger[_0xc597('0x69')](_0xc597('0x6a'));endCsv();});},'error':function(_0x2820fc,_0x56144c){logger[_0xc597('0x69')](_0xc597('0x6b'),JSON['stringify'](_0x2820fc));endCsv();}});})[_0xc597('0x54')](function(_0x1862a0){logger[_0xc597('0x18')](_0xc597('0x6c'),JSON[_0xc597('0x64')](_0x1862a0));});}main(); \ No newline at end of file +var _0x2a64=['SIGINT','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','contact','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','error','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','from','fromQuery','ListId\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','\x20=\x20?','into','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','then','all','outbound','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x2a64,0xe6));var _0x42a6=function(_0x4b3297,_0x4adec0){_0x4b3297=_0x4b3297-0x0;var _0x25f1ef=_0x2a64[_0x4b3297];return _0x25f1ef;};'use strict';var BPromise=require(_0x42a6('0x0'));var util=require(_0x42a6('0x1'));var _=require(_0x42a6('0x2'));var fs=require('fs');var squel=require(_0x42a6('0x3'));var Papa=require('papaparse');var Redis=require(_0x42a6('0x4'));var db=require(_0x42a6('0x5'))['db'];var config=require(_0x42a6('0x6'));var logger=require(_0x42a6('0x7'))(_0x42a6('0x8'));config[_0x42a6('0x9')]=_[_0x42a6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42a6('0x9')]));require(_0x42a6('0xb'))[_0x42a6('0xc')](socket);try{if(!process[_0x42a6('0xd')][0x2]||process[_0x42a6('0xd')][0x2]===_0x42a6('0xe')||process[_0x42a6('0xd')][0x2]===_0x42a6('0xf')){throw new Error(_0x42a6('0x10'));}var FILEPATH=process[_0x42a6('0xd')][0x2];if(!process[_0x42a6('0xd')][0x3]||process[_0x42a6('0xd')][0x3]===_0x42a6('0xe')||process[_0x42a6('0xd')][0x3]===_0x42a6('0xf')||!process[_0x42a6('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x42a6('0xd')][0x4]==='null'){throw new Error(_0x42a6('0x11'));}var FIELDS=_[_0x42a6('0x12')](process[_0x42a6('0xd')][0x3][_0x42a6('0x13')](','),process[_0x42a6('0xd')][0x4][_0x42a6('0x13')](','));if(!process[_0x42a6('0xd')][0x5]||process[_0x42a6('0xd')][0x5]===_0x42a6('0xe')||process[_0x42a6('0xd')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x42a6('0xd')][0x5];var COMPANYID=process[_0x42a6('0xd')][0x6]&&process[_0x42a6('0xd')][0x6]!==_0x42a6('0xe')&&process[_0x42a6('0xd')][0x6]!==_0x42a6('0xf')?process[_0x42a6('0xd')][0x6]:null;var DUPLICATES=process[_0x42a6('0xd')][0x7]&&process[_0x42a6('0xd')][0x7]!==_0x42a6('0xe')&&process[_0x42a6('0xd')][0x7]!==_0x42a6('0xf')?process[_0x42a6('0xd')][0x7]:null;if(!process[_0x42a6('0xd')][0x8]||process[_0x42a6('0xd')][0x8]==='undefined'||process[_0x42a6('0xd')][0x8]===_0x42a6('0xf')){throw new Error(_0x42a6('0x14'));}var SOCKET_TIMESTAMP=process[_0x42a6('0xd')][0x8];}catch(_0x40c98b){logger['error'](_0x40c98b);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(_0x3e0982,_0x3f1e48,_0x1ce479,_0x203422){var _0x3c1fbe={'message':_0x3f1e48};_0x3c1fbe[_0x3e0982]=!![];if(_0x1ce479){_0x3c1fbe[_0x42a6('0x15')]=_0x1ce479;}if(_0x203422){_0x3c1fbe[_0x42a6('0x16')]=_0x203422;}return _0x3c1fbe;}function isEmail(_0x36f274){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x36f274);}function checkRow(_0x283c17,_0x38b2e3,_0x5035f0){return new BPromise(function(_0x40a1e8,_0x4e3f9f){if(_['isNil'](_0x283c17)){return _0x4e3f9f(handleCheckRowError('error',_0x42a6('0x17'),null,_0x5035f0));}if(_0x283c17[_0x42a6('0x18')]&&_0x283c17['errors'][_0x42a6('0x19')]){var _0x2bda9e=_['map'](_0x283c17[_0x42a6('0x18')],_0x42a6('0x1a'))['join'](';');return _0x4e3f9f(handleCheckRowError(_0x42a6('0x1b'),_0x2bda9e,null,_0x5035f0));}var _0x1b4c53={};for(var _0x298f2e in FIELDS){if(FIELDS[_0x42a6('0x1c')](_0x298f2e)&&FIELDS[_0x298f2e]){_0x1b4c53[_0x298f2e]=_0x283c17['data'][0x0][FIELDS[_0x298f2e]]||_0x283c17[_0x42a6('0x1d')][0x0]['\ufeff'+FIELDS[_0x298f2e]];}}if(!_0x1b4c53[_0x42a6('0x1e')]){return _0x4e3f9f(handleCheckRowError(_0x42a6('0x1b'),'firstName\x20not\x20specified!',null,_0x5035f0));}if(!_0x1b4c53[_0x42a6('0x1f')]){return _0x4e3f9f(handleCheckRowError('error',_0x42a6('0x20'),null,_0x5035f0));}if(_0x1b4c53[_0x42a6('0x21')]){var _0x339a82=moment(_0x1b4c53[_0x42a6('0x21')],_0x42a6('0x22'));if(!_0x339a82[_0x42a6('0x23')]()){return _0x4e3f9f(handleCheckRowError(_0x42a6('0x1b'),_0x42a6('0x24'),null,_0x5035f0));}}if(_0x1b4c53[_0x42a6('0x25')]){if(!isEmail(_0x1b4c53[_0x42a6('0x25')])){return _0x4e3f9f(handleCheckRowError(_0x42a6('0x1b'),_0x42a6('0x26'),null,_0x5035f0));}}_0x1b4c53[_0x42a6('0x27')]=LISTID;_0x1b4c53[_0x42a6('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x42a6('0x19')]&&_0x38b2e3){var _0x831a50={};for(var _0x2e58b7=0x0,_0x3f3af2=DUPLICATES[_0x42a6('0x19')];_0x2e58b7<_0x3f3af2;_0x2e58b7+=0x1){_0x831a50[DUPLICATES[_0x2e58b7]]=_0x1b4c53[DUPLICATES[_0x2e58b7]];}var _0x21598e=_[_0x42a6('0x29')](_0x38b2e3,_0x831a50);if(_0x21598e){return _0x4e3f9f(handleCheckRowError(_0x42a6('0x2a'),_0x42a6('0x2b'),_0x21598e,_0x5035f0));}}return db['CmContact'][_0x42a6('0x2c')](_0x1b4c53,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1b4c53)})['then'](function(_0xb5ec37){if(DUPLICATES&&DUPLICATES[_0x42a6('0x19')]&&_0x38b2e3){_0x38b2e3['push'](_[_0x42a6('0x2d')](_0x1b4c53,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb5ec37['id'];return _0x40a1e8();})[_0x42a6('0x2e')](function(_0x135fa0){return _0x4e3f9f(handleCheckRowError(_0x42a6('0x1b'),_0x42a6('0x2f')+(_0x135fa0[_0x42a6('0x1a')]||JSON[_0x42a6('0x30')](_0x135fa0)),null,_0x5035f0));});});}function checkHopper(){function _0x5dbb2b(){return function(_0x494826){logger[_0x42a6('0x1b')]('cmContact',_0x42a6('0x31'),util['inspect'](_0x494826,{'showHidden':![],'depth':null}));};}var _0x491db1=function(_0x19f064,_0x421c55){var _0x3cb309=squel[_0x42a6('0x32')]()['into'](_0x42a6('0x33'))['fromQuery']([_0x42a6('0x1f'),_0x42a6('0x34'),_0x42a6('0x35'),'ListId',_0x421c55,_0x42a6('0x36'),_0x42a6('0x37')],squel['select']()[_0x42a6('0x38')](_0x42a6('0x1f'),_0x42a6('0x1f'))[_0x42a6('0x38')](_0x42a6('0x39'),_0x42a6('0x34'))[_0x42a6('0x38')]('id','ContactId')['field'](LISTID[_0x42a6('0x3a')](),_0x42a6('0x27'))['field'](_0x19f064['id'][_0x42a6('0x3a')](),_0x421c55)[_0x42a6('0x38')]('NOW()',_0x42a6('0x36'))[_0x42a6('0x38')]('NOW()','updatedAt')['from'](_0x42a6('0x3b'))[_0x42a6('0x3c')](_0x42a6('0x3d'))[_0x42a6('0x3c')]('ListId\x20=\x20?',LISTID[_0x42a6('0x3a')]())['where'](_0x42a6('0x3e'))[_0x42a6('0x3c')](_0x42a6('0x3f'),squel[_0x42a6('0x40')]()['field']('phone')[_0x42a6('0x41')](_0x42a6('0x33'))['where'](_0x421c55+'\x20=\x20?',_0x19f064['id'][_0x42a6('0x3a')]())))[_0x42a6('0x3a')]();return _0x3cb309;};var _0x1942dc=function(_0xb71554,_0x2b7496){var _0x5204c4=squel[_0x42a6('0x32')]()['into']('cm_hopper')[_0x42a6('0x42')]([_0x42a6('0x1f'),_0x42a6('0x34'),_0x42a6('0x35'),_0x42a6('0x27'),_0x2b7496,'createdAt',_0x42a6('0x37')],squel[_0x42a6('0x40')]()[_0x42a6('0x38')](_0x42a6('0x1f'),_0x42a6('0x1f'))[_0x42a6('0x38')](_0x42a6('0x39'),_0x42a6('0x34'))[_0x42a6('0x38')]('id',_0x42a6('0x35'))[_0x42a6('0x38')](LISTID['toString'](),_0x42a6('0x27'))[_0x42a6('0x38')](_0xb71554['id']['toString'](),_0x2b7496)[_0x42a6('0x38')](_0x42a6('0x39'),'createdAt')['field']('NOW()','updatedAt')[_0x42a6('0x41')](_0x42a6('0x3b'))['where'](_0x42a6('0x3d'))['where'](_0x42a6('0x43'),LISTID[_0x42a6('0x3a')]())[_0x42a6('0x3c')](_0x42a6('0x44'),squel[_0x42a6('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x42a6('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x42a6('0x40')]()['field']('calleridnum')[_0x42a6('0x41')](_0x42a6('0x46'))[_0x42a6('0x3c')](_0x2b7496+_0x42a6('0x47'),_0xb71554['id'][_0x42a6('0x3a')]()))[_0x42a6('0x3c')](_0x42a6('0x3f'),squel[_0x42a6('0x40')]()[_0x42a6('0x38')](_0x42a6('0x1f'))[_0x42a6('0x41')](_0x42a6('0x33'))[_0x42a6('0x3c')](_0x2b7496+_0x42a6('0x47'),_0xb71554['id']['toString']())))[_0x42a6('0x3a')]();return _0x5204c4;};function _0x5ebe66(_0x1a33fa,_0x2024eb){var _0x5d954a=squel['insert']()[_0x42a6('0x48')](_0x42a6('0x33'))[_0x42a6('0x42')]([_0x42a6('0x1f'),_0x42a6('0x34'),_0x42a6('0x35'),_0x42a6('0x27'),_0x2024eb,_0x42a6('0x36'),_0x42a6('0x37')],squel[_0x42a6('0x40')]()[_0x42a6('0x38')]('phone',_0x42a6('0x1f'))[_0x42a6('0x38')]('NOW()',_0x42a6('0x34'))['field']('id','ContactId')[_0x42a6('0x38')](LISTID['toString'](),_0x42a6('0x27'))['field'](_0x1a33fa['id']['toString'](),_0x2024eb)[_0x42a6('0x38')](_0x42a6('0x39'),'createdAt')['field'](_0x42a6('0x39'),'updatedAt')['from'](_0x42a6('0x3b'))['where'](_0x42a6('0x3d'))['where'](_0x42a6('0x43'),LISTID[_0x42a6('0x3a')]())[_0x42a6('0x3c')]('id\x20IN\x20?',squel[_0x42a6('0x45')](hopperContacts))['where'](_0x42a6('0x3e')))[_0x42a6('0x3a')]();return _0x5d954a;}function _0x4741fa(_0x473705,_0x246b1b){var _0x55b7ca=squel[_0x42a6('0x32')]()['into'](_0x42a6('0x49'))['fromQuery']([_0x42a6('0x1f'),_0x42a6('0x35'),_0x42a6('0x27'),_0x246b1b,_0x42a6('0x36'),'updatedAt'],squel[_0x42a6('0x40')]()[_0x42a6('0x38')]('phone',_0x42a6('0x1f'))[_0x42a6('0x38')]('id',_0x42a6('0x35'))['field'](LISTID[_0x42a6('0x3a')](),_0x42a6('0x27'))[_0x42a6('0x38')](_0x473705['id'][_0x42a6('0x3a')](),_0x246b1b)[_0x42a6('0x38')](_0x42a6('0x39'),_0x42a6('0x36'))[_0x42a6('0x38')](_0x42a6('0x39'),_0x42a6('0x37'))['from']('cm_contacts')[_0x42a6('0x3c')](_0x42a6('0x3d'))[_0x42a6('0x3c')]('ListId\x20=\x20?',LISTID[_0x42a6('0x3a')]())[_0x42a6('0x3c')](_0x42a6('0x44'),squel['str'](hopperContacts))[_0x42a6('0x3c')](_0x42a6('0x3e')))['toString']();return _0x55b7ca;}return db[_0x42a6('0x4a')][_0x42a6('0x4b')]({'where':{'type':'outbound'},'attributes':['id',_0x42a6('0x4c')],'include':[{'model':db[_0x42a6('0x4d')],'as':_0x42a6('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x4529ef){var _0x292f2f=[];if(_0x4529ef){var _0x25843a;for(var _0x446691=0x0,_0x583c82;_0x446691<_0x4529ef[_0x42a6('0x19')];_0x446691+=0x1){_0x583c82=_0x4529ef[_0x446691][_0x42a6('0x4f')]({'plain':!![]});switch(_0x583c82[_0x42a6('0x4c')]){case _0x42a6('0x50'):_0x292f2f[_0x42a6('0x51')](db[_0x42a6('0x52')][_0x42a6('0x53')](_0x1942dc(_0x583c82,_0x42a6('0x54')))['then'](function(){})[_0x42a6('0x2e')](_0x5dbb2b()));break;case _0x42a6('0x55'):_0x292f2f[_0x42a6('0x51')](db[_0x42a6('0x52')][_0x42a6('0x53')](_0x491db1(_0x583c82,'VoiceQueueId'))[_0x42a6('0x56')](function(){})[_0x42a6('0x2e')](_0x5dbb2b()));break;default:_0x292f2f[_0x42a6('0x51')](db[_0x42a6('0x52')][_0x42a6('0x53')](_0x5ebe66(_0x583c82,'VoiceQueueId'))[_0x42a6('0x56')](function(){})[_0x42a6('0x2e')](_0x5dbb2b()));}}}return _0x292f2f;})[_0x42a6('0x57')]()[_0x42a6('0x56')](function(){return db[_0x42a6('0x4a')][_0x42a6('0x4b')]({'where':{'type':_0x42a6('0x58')},'attributes':['id'],'include':[{'model':db[_0x42a6('0x4d')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x42a6('0x56')](function(_0x53ae09){var _0xeb9989=[];if(_0x53ae09){var _0x8a46f5;for(var _0x393314=0x0,_0x20b67a;_0x393314<_0x53ae09[_0x42a6('0x19')];_0x393314+=0x1){_0x20b67a=_0x53ae09[_0x393314]['get']({'plain':!![]});_0xeb9989[_0x42a6('0x51')](db[_0x42a6('0x52')]['query'](_0x4741fa(_0x20b67a,'VoiceQueueId'))[_0x42a6('0x56')](function(){})['catch'](_0x5dbb2b()));}}return _0xeb9989;})[_0x42a6('0x57')]();})[_0x42a6('0x56')](function(){return db[_0x42a6('0x59')][_0x42a6('0x4b')]({'attributes':['id',_0x42a6('0x4c')],'include':[{'model':db[_0x42a6('0x4d')],'as':'Lists','where':{'id':LISTID}}]})[_0x42a6('0x56')](function(_0x309731){var _0x4010d5=[];if(_0x309731){for(var _0x3fded0=0x0,_0x2b6e76;_0x3fded0<_0x309731['length'];_0x3fded0+=0x1){_0x2b6e76=_0x309731[_0x3fded0][_0x42a6('0x4f')]({'plain':!![]});switch(_0x2b6e76[_0x42a6('0x4c')]){case _0x42a6('0x50'):_0x4010d5[_0x42a6('0x51')](db[_0x42a6('0x52')][_0x42a6('0x53')](_0x1942dc(_0x2b6e76,_0x42a6('0x5a')))[_0x42a6('0x56')](function(){})['catch'](_0x5dbb2b()));break;case _0x42a6('0x55'):_0x4010d5['push'](db[_0x42a6('0x52')]['query'](_0x491db1(_0x2b6e76,_0x42a6('0x5a')))[_0x42a6('0x56')](function(){})[_0x42a6('0x2e')](_0x5dbb2b()));break;default:_0x4010d5[_0x42a6('0x51')](db['sequelize'][_0x42a6('0x53')](_0x5ebe66(_0x2b6e76,'CampaignId'))['then'](function(){})[_0x42a6('0x2e')](_0x5dbb2b()));}}}return _0x4010d5;})['all']();})['then'](function(){return db[_0x42a6('0x59')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x42a6('0x5b'),'where':{'id':LISTID}}]})[_0x42a6('0x56')](function(_0x4570cd){var _0x2d01df=[];if(_0x4570cd){for(var _0x5b22a5=0x0,_0x38f420;_0x5b22a5<_0x4570cd[_0x42a6('0x19')];_0x5b22a5+=0x1){_0x38f420=_0x4570cd[_0x5b22a5][_0x42a6('0x4f')]({'plain':!![]});_0x2d01df['push'](db['sequelize'][_0x42a6('0x53')](_0x4741fa(_0x38f420,_0x42a6('0x5a')))[_0x42a6('0x56')](function(){})[_0x42a6('0x2e')](_0x5dbb2b()));}}return _0x2d01df;})[_0x42a6('0x57')]();})['catch'](function(_0x39a371){logger[_0x42a6('0x1b')](_0x42a6('0x5c'),_0x42a6('0x5d'),_0x39a371[_0x42a6('0x1a')]);});}var processPromises=function(_0x4f9a42){return BPromise[_0x42a6('0x57')](promises)[_0x42a6('0x56')](function(_0x235526){})[_0x42a6('0x2e')](function(_0x4b7f63){logger[_0x42a6('0x1b')](_0x42a6('0x5e'),JSON[_0x42a6('0x30')](_0x4b7f63));})[_0x42a6('0x5f')](function(){socket[_0x42a6('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f9a42){return _0x4f9a42['resume']();}});};var endCsv=function(){return BPromise[_0x42a6('0x61')]()[_0x42a6('0x56')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x42a6('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x42a6('0x62')](FILEPATH);}catch(_0x25235f){logger['error'](_0x42a6('0x63'),JSON['stringify'](_0x25235f));}finally{process['exit'](0x0);}});};process['on'](_0x42a6('0x64'),function(){logger['info'](_0x42a6('0x65'));endCsv();});function main(){return BPromise[_0x42a6('0x61')]()[_0x42a6('0x56')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x42a6('0x13')](',');return db[_0x42a6('0x66')][_0x42a6('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x42a6('0x56')](function(_0x5b407d){var _0x3a5113=fs[_0x42a6('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x42a6('0x68')](_0x3a5113,{'header':!![],'skipEmptyLines':!![],'step':function(_0x580556,_0x512f1d){total+=0x1;var _0x39f53d=total;promises[_0x42a6('0x51')](checkRow(_0x580556,_0x5b407d,_0x39f53d)[_0x42a6('0x56')](function(){success+=0x1;})[_0x42a6('0x2e')](function(_0x3270ac){if(_0x3270ac['error']){errors+=0x1;delete _0x3270ac[_0x42a6('0x1b')];}else if(_0x3270ac[_0x42a6('0x2a')]){duplicates+=0x1;delete _0x3270ac[_0x42a6('0x2a')];}rows[_0x42a6('0x51')](_0x3270ac);}));if(total%0xc8===0x0){_0x512f1d[_0x42a6('0x69')]();return processPromises(_0x512f1d);}},'complete':function(){return processPromises()['then'](function(){logger[_0x42a6('0x6a')](_0x42a6('0x6b'));endCsv();});},'error':function(_0x32d1f9,_0x539ee5){logger[_0x42a6('0x6a')](_0x42a6('0x6c'),JSON['stringify'](_0x32d1f9));endCsv();}});})['catch'](function(_0x59e94d){logger[_0x42a6('0x1b')](_0x42a6('0x6d'),JSON[_0x42a6('0x30')](_0x59e94d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2b758ea..f258484 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 _0xe06e=['recallme','fields','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','fromQuery','ListId','cm_contacts','cm_contacts.ListId\x20=\x20','cm_hopper_black','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.createdAt','field','ListId\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','error','exit','push','message','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','length','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','includes','header',',utcOffset','parse','data','errors','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','abort','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','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','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','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','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId'];(function(_0x4f3b21,_0x2e200a){var _0x208196=function(_0x587750){while(--_0x587750){_0x4f3b21['push'](_0x4f3b21['shift']());}};_0x208196(++_0x2e200a);}(_0xe06e,0x1b4));var _0xee06=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xe06e[_0x5ce8b9];return _0xe34be0;};'use strict';var fs=require('fs');var path=require(_0xee06('0x0'));var _=require(_0xee06('0x1'));var Papa=require(_0xee06('0x2'));var util=require(_0xee06('0x3'));var BPromise=require(_0xee06('0x4'));var moment=require(_0xee06('0x5'));var squel=require('squel');var Redis=require(_0xee06('0x6'));var db=require(_0xee06('0x7'))['db'];var config=require(_0xee06('0x8'));var shared=require(_0xee06('0x9'));var logger=require('../../../config/logger')(_0xee06('0xa'));config[_0xee06('0xb')]=_[_0xee06('0xc')](config['redis'],{'host':_0xee06('0xd'),'port':0x18eb});var socket=require(_0xee06('0xe'))(new Redis(config[_0xee06('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xee06('0xf')](_0xee06('0x10'));function isEmail(_0x2679d9){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))*$/[_0xee06('0x11')](_0x2679d9);}function selectNotIn(_0x338d2f,_0x520778,_0x3d7036,_0x15ff5e,_0x269502){return squel[_0xee06('0x12')]()['field'](_0xee06('0x13'))[_0xee06('0x14')](_0x15ff5e)[_0xee06('0x15')](_0x520778,null,_0x520778+'.id\x20=\x20'+_0x15ff5e+'.'+_0x3d7036)[_0xee06('0x16')](_0x15ff5e+'.'+_0x3d7036+_0xee06('0x17')+_0x338d2f+'.'+_0x3d7036)[_0xee06('0x16')](_0x520778+_0xee06('0x18')+_0x269502[_0xee06('0x15')]()+')');}function insertCmHopper(_0x15d44f,_0x4e86d9,_0x8aab9f,_0x597530,_0x5e2907){var _0x3bd08a=[_0xee06('0x19'),_0xee06('0x1a'),_0xee06('0x1b'),_0xee06('0x1c'),_0x4e86d9+'.'+_0x597530,'cm_contacts.createdAt',_0xee06('0x1d'),_0xee06('0x1e'),_0xee06('0x1f'),'\x22'+_0x5e2907+'\x22'];return squel[_0xee06('0x20')]()[_0xee06('0x21')](_0xee06('0x22'))['fromQuery'](['phone',_0xee06('0x23'),_0xee06('0x24'),'ListId',_0x597530,_0xee06('0x25'),_0xee06('0x26'),_0xee06('0x27'),_0xee06('0x28'),_0xee06('0x29')],squel['select']()[_0xee06('0x2a')](_0x3bd08a)[_0xee06('0x14')](_0x4e86d9)[_0xee06('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4e86d9+_0xee06('0x2b'))[_0xee06('0x15')](_0x8aab9f,null,_0x8aab9f+_0xee06('0x2c')+_0x4e86d9+'.'+_0x597530)['where'](_0x4e86d9+_0xee06('0x2d'),_0x15d44f)['where'](_0xee06('0x2e'),NOW)[_0xee06('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4e86d9,_0x8aab9f,_0x597530,_0xee06('0x22'),['\x22always\x22',_0xee06('0x2f')]))[_0xee06('0x16')](_0xee06('0x30'),selectNotIn(_0x4e86d9,_0x8aab9f,_0x597530,'cm_hopper',[_0xee06('0x31')])))[_0xee06('0x32')]();}function insertCmHopperBlack(_0x54e29a,_0x399ebc,_0x3200c7,_0x493736){var _0x316d96=[_0xee06('0x19'),_0xee06('0x1b'),_0xee06('0x1c'),_0x399ebc+'.'+_0x493736,'cm_contacts.createdAt',_0xee06('0x1d')];return squel[_0xee06('0x20')]()[_0xee06('0x21')]('cm_hopper_black')[_0xee06('0x33')]([_0xee06('0x13'),_0xee06('0x24'),_0xee06('0x34'),_0x493736,_0xee06('0x25'),_0xee06('0x26')],squel['select']()[_0xee06('0x2a')](_0x316d96)[_0xee06('0x14')](_0x399ebc)[_0xee06('0x15')](_0xee06('0x35'),null,_0xee06('0x36')+_0x399ebc+_0xee06('0x2b'))[_0xee06('0x15')](_0x3200c7,null,_0x3200c7+_0xee06('0x2c')+_0x399ebc+'.'+_0x493736)['where'](_0x399ebc+_0xee06('0x2d'),_0x54e29a)[_0xee06('0x16')](_0xee06('0x2e'),NOW)[_0xee06('0x16')](_0xee06('0x30'),squel['select']()['field'](_0xee06('0x13'))['from'](_0xee06('0x37'))[_0xee06('0x16')]('ListId\x20=\x20?',_0x54e29a)[_0xee06('0x16')](_0x493736+_0xee06('0x38'),_0x399ebc+'.'+_0x493736)))[_0xee06('0x32')]();}function insertTzCmHopper(_0x5e7da3,_0x870d38,_0x496e8f,_0x8ca417,_0x1f9dc2,_0x24020c){var _0x4aad0d=['cm_contacts.phone',_0xee06('0x39')+_0x24020c+'.offset-cm_contacts.utcOffset\x20minute)',_0xee06('0x1b'),_0xee06('0x1c'),_0x870d38+'.'+_0x8ca417,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xee06('0x1e'),_0xee06('0x1f'),'\x22'+_0x1f9dc2+'\x22'];var _0x20452d=squel['insert']()[_0xee06('0x21')](_0xee06('0x22'))['fromQuery']([_0xee06('0x13'),'scheduledat',_0xee06('0x24'),_0xee06('0x34'),_0x8ca417,_0xee06('0x25'),_0xee06('0x26'),_0xee06('0x27'),'UserId',_0xee06('0x29')],squel[_0xee06('0x12')]()[_0xee06('0x2a')](_0x4aad0d)[_0xee06('0x14')](_0x870d38)[_0xee06('0x15')](_0xee06('0x35'),null,_0xee06('0x36')+_0x870d38+_0xee06('0x2b'))['join'](_0x496e8f,null,_0x496e8f+_0xee06('0x2c')+_0x870d38+'.'+_0x8ca417)['join'](_0x24020c,null,_0x24020c+_0xee06('0x2c')+_0x870d38+'.'+_0x8ca417)[_0xee06('0x16')](_0x870d38+_0xee06('0x2d'),_0x5e7da3)[_0xee06('0x16')](_0xee06('0x2e'),NOW)[_0xee06('0x16')](_0xee06('0x30'),selectNotIn(_0x870d38,_0x496e8f,_0x8ca417,_0xee06('0x22'),[_0xee06('0x31'),_0xee06('0x2f')]))[_0xee06('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x870d38,_0x496e8f,_0x8ca417,_0xee06('0x22'),[_0xee06('0x31')])))[_0xee06('0x32')]();return _0x20452d;}function insertTzCmHopperBlack(_0x11fea4,_0x4f97cb,_0x3a4fcd,_0x396ba5){var _0x3f03d4=['cm_contacts.phone',_0xee06('0x1b'),_0xee06('0x1c'),_0x4f97cb+'.'+_0x396ba5,_0xee06('0x3a'),_0xee06('0x1d')];return squel['insert']()[_0xee06('0x21')](_0xee06('0x37'))[_0xee06('0x33')](['phone','ContactId',_0xee06('0x34'),_0x396ba5,_0xee06('0x25'),_0xee06('0x26')],squel[_0xee06('0x12')]()['fields'](_0x3f03d4)['from'](_0x4f97cb)[_0xee06('0x15')](_0xee06('0x35'),null,_0xee06('0x36')+_0x4f97cb+_0xee06('0x2b'))[_0xee06('0x15')](_0x3a4fcd,null,_0x3a4fcd+_0xee06('0x2c')+_0x4f97cb+'.'+_0x396ba5)[_0xee06('0x16')](_0x4f97cb+_0xee06('0x2d'),_0x11fea4)[_0xee06('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xee06('0x30'),squel[_0xee06('0x12')]()[_0xee06('0x3b')](_0xee06('0x13'))[_0xee06('0x14')](_0xee06('0x37'))[_0xee06('0x16')](_0xee06('0x3c'),_0x11fea4)[_0xee06('0x16')](_0x396ba5+_0xee06('0x38'),_0x4f97cb+'.'+_0x396ba5)))[_0xee06('0x32')]();}function insertCmContact(_0x4eea53,_0xd50617,_0x55d77e,_0x16b040){var _0x166adb=_[_0xee06('0x3d')](_[_0xee06('0x3e')](_0x16b040),[_0xee06('0x34'),_0xee06('0x3f'),_0xee06('0x25'),'updatedAt']);return squel[_0xee06('0x20')]()['into'](_0xee06('0x35'))[_0xee06('0x33')](_0x166adb,squel[_0xee06('0x12')]()[_0xee06('0x2a')](_0x166adb)[_0xee06('0x14')](_0xd50617)['where']('('+_0x55d77e[_0xee06('0x15')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xee06('0x2a')](_0x55d77e)[_0xee06('0x14')](_0xee06('0x35'))[_0xee06('0x16')](_0xee06('0x3c'),_0x4eea53)[_0xee06('0x16')]('deletedAt\x20IS\x20NULL'))[_0xee06('0x16')](_0xee06('0x40'),squel[_0xee06('0x12')]()['field'](_0xee06('0x41'),_0xee06('0x42'))['from'](_0xd50617)[_0xee06('0x43')](_0x55d77e[_0xee06('0x15')](','))))[_0xee06('0x32')]();}function handleStop(){logger[_0xee06('0x44')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1ed677){logger[_0xee06('0x45')](_0x1ed677['message']);process[_0xee06('0x46')](0x1);}function handleError(_0x191788,_0x591d18){stats['errors'][_0xee06('0x47')]({'name':_0x591d18['code'],'message':_0x591d18[_0xee06('0x48')],'row':_0x191788});}function handleQuery(_0x29a8be){logger[_0xee06('0x44')](_0x29a8be);return db['sequelize'][_0xee06('0x49')](_0x29a8be)[_0xee06('0x4a')](function(_0x2e2c30){results['push'](_0x2e2c30);})[_0xee06('0x4b')](function(_0xcf78c4){logger['error'](_0xcf78c4[_0xee06('0x48')]);});}function updateTzCampaigns(_0x4a1a4b){return new Promise(function(_0x3dd731,_0x4ed4df){var _0xf17d97=squel[_0xee06('0x12')]()[_0xee06('0x2a')]([_0xee06('0x4c'),_0xee06('0x4d')])[_0xee06('0x14')]('campaigns')[_0xee06('0x15')](_0xee06('0x4e'),null,_0xee06('0x4f'))[_0xee06('0x16')](_0xee06('0x50')+_0x4a1a4b);db[_0xee06('0x51')][_0xee06('0x49')](_0xf17d97['toString']())['spread'](function(_0x374c47){var _0x56182b=[];for(var _0x473743=0x0;_0x473743<_0x374c47['length'];_0x473743++){_0x56182b['push'](getTimezoneData(_0x374c47[_0x473743],tmp_campaigns));}BPromise[_0xee06('0x52')](_0x56182b)[_0xee06('0x53')](function(){_0x3dd731({'val':0x1});});})['catch'](function(_0x390c92){logger[_0xee06('0x45')](_0x390c92['message']);_0x3dd731({'val':0x0});});});}function updateTzVoiceQueues(_0x4d3047){return new Promise(function(_0xe28f0f,_0x2e3ae7){var _0x80fba4=squel['select']()[_0xee06('0x2a')]([_0xee06('0x54'),_0xee06('0x55')])['from'](_0xee06('0x56'))[_0xee06('0x15')](_0xee06('0x57'),null,_0xee06('0x58'))['where'](_0xee06('0x59')+_0x4d3047);db[_0xee06('0x51')][_0xee06('0x49')](_0x80fba4[_0xee06('0x32')]())['spread'](function(_0x2840c4){var _0x52f82f=[];for(var _0x180a4b=0x0;_0x180a4b<_0x2840c4[_0xee06('0x5a')];_0x180a4b++){_0x52f82f[_0xee06('0x47')](getTimezoneData(_0x2840c4[_0x180a4b],tmp_voice_queues));}BPromise[_0xee06('0x52')](_0x52f82f)[_0xee06('0x53')](function(){_0xe28f0f({'val':0x1});});})[_0xee06('0x4b')](function(_0x184b9b){logger[_0xee06('0x45')](_0x184b9b[_0xee06('0x48')]);_0xe28f0f({'val':0x0});});});}function getTimezoneData(_0xcbf19e,_0x3db39e){return new Promise(function(_0x5d5d8d,_0x16567e){var _0x237a71=shared[_0xee06('0x5b')];var _0x30a6bd=_0x237a71[_0xcbf19e[_0xee06('0x5c')]];if(_[_0xee06('0x5d')](_0x30a6bd)){_0x5d5d8d({'ret':0x1});}else{var _0x4b929f=_0x30a6bd[_0xee06('0x5e')];var _0x1268e9=squel[_0xee06('0x20')]()['into'](_0x3db39e)[_0xee06('0x5f')]('id',_0xcbf19e['id'])[_0xee06('0x5f')](_0xee06('0x60'),_0x4b929f)[_0xee06('0x5f')]('dialTimezone',_0xcbf19e['dialTimezone'])[_0xee06('0x32')]();return db[_0xee06('0x51')][_0xee06('0x49')](_0x1268e9)[_0xee06('0x4a')](function(_0x46a3bb){_0x5d5d8d({'ret':0x1});})[_0xee06('0x4b')](function(_0x150f44){logger['error'](_0x150f44[_0xee06('0x48')]);_0x16567e({'ret':0x1});});}});}function handleTZQuery(_0xbc48f5){logger[_0xee06('0x44')](_0xbc48f5);return db['sequelize'][_0xee06('0x49')](_0xbc48f5)[_0xee06('0x4a')](function(_0x1586ce){})[_0xee06('0x4b')](function(_0x359b3a){logger[_0xee06('0x45')](_0x359b3a[_0xee06('0x48')]);});}function main(_0x53e7aa,_0x2c25b5,_0x129d48,_0x15c6ea){logger[_0xee06('0x44')](_0xee06('0x61'),_0x53e7aa,JSON[_0xee06('0x62')](_0x2c25b5));process[_0xee06('0x63')](_0xee06('0x64'));var _0x40c6b9=_0x2c25b5[_0xee06('0x65')];var _0x160483=_0x2c25b5[_0xee06('0x66')];var _0x1d80b1=path[_0xee06('0x15')](config[_0xee06('0x67')],'server/files/tmp',_0x160483+'.csv');hasTZ=_['keys'](_0x40c6b9)[_0xee06('0x68')](_0xee06('0x5c'));var _0x46c27f=_['keys'](_0x40c6b9)[_0xee06('0x15')]();logger[_0xee06('0x44')](_0xee06('0x69'),_0x46c27f);if(hasTZ)_0x46c27f+=_0xee06('0x6a');fs['writeFileSync'](_0x1d80b1,_0x46c27f+'\x0a');Papa[_0xee06('0x6b')](fs['createReadStream'](_0x53e7aa),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2ad623,_0x54598c){try{for(var _0x371bf5=0x0,_0x54425d=[];_0x371bf5<_0x2ad623[_0xee06('0x6c')][_0xee06('0x5a')];_0x371bf5++){stats['rows']+=0x1;if(_0x2ad623['errors'][_0x371bf5]){handleError(_0x2ad623['data'][_0x371bf5],_0x2ad623[_0xee06('0x6d')][_0x371bf5]);}else{var _0x129fd3=[];for(var _0x43464b in _0x40c6b9){if(_0x40c6b9[_0xee06('0x6e')](_0x43464b)){if(_0x2ad623['data'][_0x371bf5][_0x40c6b9[_0x43464b]]){var _0x249ecc=_[_0xee06('0x6f')](_0x2ad623['data'][_0x371bf5][_0x40c6b9[_0x43464b]][_0xee06('0x70')](/"/g,'\x27'));switch(_0x43464b){case _0xee06('0x23'):var _0x191a41=moment(_0x249ecc,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x191a41['isValid']()){_0x54425d['push']('\x22'+_0x249ecc+'\x22');}else{_0x129fd3['push'](_0xee06('0x71'));}break;case _0xee06('0x27'):var _0x16f383=parseInt(_0x249ecc);_0x249ecc=_[_0xee06('0x72')](_0x16f383)||_0x16f383<0x0||_0x16f383>0x4?_0x15c6ea?0x3:0x2:_0x16f383;_0x54425d[_0xee06('0x47')]('\x22'+_0x249ecc+'\x22');break;case'UserId':var _0x5c9501=parseInt(_0x249ecc);if(_[_0xee06('0x73')](_0x5c9501)&&_['includes'](_0x129d48,_0x5c9501)){_0x54425d[_0xee06('0x47')]('\x22'+_0x5c9501+'\x22');}else{_0x129fd3[_0xee06('0x47')](_0xee06('0x74'));}break;case _0xee06('0x75'):if(isEmail(_0x249ecc)){_0x54425d[_0xee06('0x47')]('\x22'+_0x249ecc+'\x22');}else{_0x129fd3[_0xee06('0x47')](_0xee06('0x76'));}break;case _0xee06('0x77'):var _0x5bf5f2=moment(_0x249ecc,_0xee06('0x78'),!![]);if(_0x5bf5f2[_0xee06('0x79')]()){_0x54425d[_0xee06('0x47')]('\x22'+_0x249ecc+'\x22');}else{_0x129fd3['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xee06('0x5c'):var _0x5dbf80=shared[_0xee06('0x5b')];var _0x2c04bb=_0x5dbf80[_0x249ecc];if(!_['isNil'](_0x2c04bb)){var _0x3f2856=_0x2c04bb[_0xee06('0x5e')];_0x54425d[_0xee06('0x47')]('\x22'+_0x249ecc+'\x22');_0x54425d[_0xee06('0x47')]('\x22'+_0x3f2856+'\x22');}break;default:_0x54425d[_0xee06('0x47')]('\x22'+_0x249ecc+'\x22');}}else{switch(_0x43464b){case _0xee06('0x7a'):case'phone':_0x129fd3[_0xee06('0x47')](_0x43464b+_0xee06('0x7b'));break;default:_0x54425d['push']('\x22\x22');}}}}if(_0x129fd3['length']){handleError(_0x2ad623['data'][_0x371bf5],{'code':_0xee06('0x7c'),'message':_0x129fd3[_0xee06('0x15')]()});}else{fs[_0xee06('0x7d')](_0x1d80b1,_0x54425d[_0xee06('0x15')]()+'\x0a');}_0x54425d=[];}if(!(stats[_0xee06('0x7e')]%0xc8)){socket['emit']('contact:import:'+_0x160483,stats);stats[_0xee06('0x6d')]=[];}}if(stopped){logger[_0xee06('0x44')]('Abort\x20parser');_0x54598c[_0xee06('0x7f')]();}}catch(_0x5b57d1){handleError(_0x2ad623[_0xee06('0x6c')][_0x371bf5],{'code':'SystemError','message':_0x5b57d1[_0xee06('0x48')]});logger['error']('step',_0x5b57d1[_0xee06('0x48')]);}},'complete':function(){try{var _0x5e9a1a=[];var _0x487169=[];var _0x1a57cc=_0xee06('0x35');if(_0x2c25b5[_0xee06('0x80')]&&_0x2c25b5[_0xee06('0x80')]['length']){_0x1a57cc=_0xee06('0x81')+_0x160483;_0x5e9a1a['push']('CREATE\x20TABLE\x20'+_0x1a57cc+_0xee06('0x82'));}tmp_campaigns=_0xee06('0x83')+_0x160483;tmp_voice_queues=_0xee06('0x84')+_0x160483;_0x487169[_0xee06('0x47')](_0xee06('0x85')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x487169[_0xee06('0x47')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xee06('0x86')](_0x487169,handleTZQuery)[_0xee06('0x53')](function(_0x3fb138){updateTzCampaigns(_0x2c25b5[_0xee06('0x34')])['then'](function(_0x19677e){updateTzVoiceQueues(_0x2c25b5[_0xee06('0x34')])[_0xee06('0x53')](function(_0x3c6cc0){var _0x5079be=util[_0xee06('0xf')](_0xee06('0x87'),_0x1d80b1,_0x1a57cc,_0x46c27f,_0x2c25b5[_0xee06('0x34')],_0x2c25b5['CompanyId']||null,NOW,NOW);if(_[_0xee06('0x5d')](_0x40c6b9[_0xee06('0x23')])){_0x5079be+=',\x20scheduledAt\x20=\x20NOW()';}_0x5e9a1a[_0xee06('0x47')](_0x5079be);if(_0x2c25b5[_0xee06('0x80')]&&_0x2c25b5[_0xee06('0x80')]['length']){_0x5e9a1a[_0xee06('0x47')](insertCmContact(_0x2c25b5[_0xee06('0x34')],_0x1a57cc,_0x2c25b5['duplicates'],_0x40c6b9));_0x5e9a1a['push'](_0xee06('0x88')+_0x1a57cc+';');}if(hasTZ){_0x5e9a1a[_0xee06('0x47')](insertTzCmHopper(_0x2c25b5[_0xee06('0x34')],_0xee06('0x57'),_0xee06('0x56'),_0xee06('0x89'),_0x15c6ea,tmp_voice_queues));_0x5e9a1a['push'](insertTzCmHopperBlack(_0x2c25b5[_0xee06('0x34')],_0xee06('0x8a'),'voice_queues',_0xee06('0x89')));_0x5e9a1a[_0xee06('0x47')](insertTzCmHopper(_0x2c25b5[_0xee06('0x34')],_0xee06('0x4e'),_0xee06('0x8b'),_0xee06('0x8c'),_0x15c6ea,tmp_campaigns));_0x5e9a1a[_0xee06('0x47')](insertTzCmHopperBlack(_0x2c25b5[_0xee06('0x34')],_0xee06('0x8d'),'campaigns','CampaignId'));}else{_0x5e9a1a[_0xee06('0x47')](insertCmHopper(_0x2c25b5[_0xee06('0x34')],'voice_queues_has_cm_lists',_0xee06('0x56'),_0xee06('0x89'),_0x15c6ea));_0x5e9a1a[_0xee06('0x47')](insertCmHopperBlack(_0x2c25b5[_0xee06('0x34')],_0xee06('0x8a'),_0xee06('0x56'),_0xee06('0x89')));_0x5e9a1a[_0xee06('0x47')](insertCmHopper(_0x2c25b5[_0xee06('0x34')],_0xee06('0x4e'),'campaigns',_0xee06('0x8c'),_0x15c6ea));_0x5e9a1a[_0xee06('0x47')](insertCmHopperBlack(_0x2c25b5['ListId'],_0xee06('0x8d'),_0xee06('0x8b'),_0xee06('0x8c')));}_0x5e9a1a[_0xee06('0x47')](_0xee06('0x88')+tmp_campaigns+';');_0x5e9a1a['push'](_0xee06('0x88')+tmp_voice_queues+';');BPromise['each'](_0x5e9a1a,handleQuery)[_0xee06('0x53')](function(_0x2c4f88){stats['finish']=!![];stats[_0xee06('0x8e')]=_0x2c25b5[_0xee06('0x80')]&&_0x2c25b5['duplicates'][_0xee06('0x5a')]?results[0x2][_0xee06('0x8e')]:results[0x0]['affectedRows'];socket['emit']('contact:import:'+_0x160483,stats);fs[_0xee06('0x8f')](_0x53e7aa);fs['unlink'](_0x1d80b1);process[_0xee06('0x46')](0x0);})[_0xee06('0x4b')](function(_0x386b27){logger[_0xee06('0x45')](_0x386b27[_0xee06('0x48')]);process[_0xee06('0x46')](0x1);});});});});}catch(_0x437c50){logger[_0xee06('0x45')](_0xee06('0x90'),_0x437c50[_0xee06('0x48')]);process[_0xee06('0x46')](0x1);}},'error':function(_0x51d387,_0x4047ca,_0x45c371,_0x4b69a7){throw new Error(_0x4b69a7);}});}function validate(){if(process[_0xee06('0x91')]&&process[_0xee06('0x91')][_0xee06('0x5a')]<0x4){throw new Error(_0xee06('0x92'));}var _0x447703=path[_0xee06('0x15')](config[_0xee06('0x67')],_0xee06('0x93'),process['argv'][0x2]);if(!fs[_0xee06('0x94')](_0x447703)){throw new Error(_0xee06('0x95'));}var _0x26196d={};try{_0x26196d=JSON['parse'](process[_0xee06('0x91')][0x3]);if(!_0x26196d[_0xee06('0x65')]){throw new Error(_0xee06('0x96'));}if(!_0x26196d[_0xee06('0x65')]['phone']){throw new Error(_0xee06('0x97'));}if(!_0x26196d[_0xee06('0x65')][_0xee06('0x7a')]){throw new Error(_0xee06('0x98'));}var _0x535f41=0x0;if(_0x26196d[_0xee06('0x65')][_0xee06('0x28')]){_0x535f41=0x1;}if(!_0x26196d[_0xee06('0x34')]){throw new Error(_0xee06('0x99'));}}catch(_0x552b1c){throw new Error(_0xee06('0x9a'));}var _0xe81af7=[];try{_0xe81af7=_[_0xee06('0x9b')](JSON[_0xee06('0x6b')](process[_0xee06('0x91')][0x4]),'id');}catch(_0x1d69a8){logger['info'](_0xee06('0x9c'));}main(_0x447703,_0x26196d,_0xe81af7,_0x535f41);}validate();process['on'](_0xee06('0x9d'),handleStop);process['on'](_0xee06('0x9e'),handleUncaughtException); \ No newline at end of file +var _0x6ff8=['dialTimezone','utcOffset','set','offset','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','includes',',utcOffset','writeFileSync','parse','data','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','isNil',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','format','select','field','phone','join','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.createdAt','cm_hopper_black','fromQuery','createdAt','\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','message','exit','errors','push','code','query','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','spread','length','all','then','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones'];(function(_0x429b49,_0x2bbd10){var _0x6b3195=function(_0x3ca47b){while(--_0x3ca47b){_0x429b49['push'](_0x429b49['shift']());}};_0x6b3195(++_0x2bbd10);}(_0x6ff8,0x17e));var _0x86ff=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x6ff8[_0x5dc03e];return _0x466a07;};'use strict';var fs=require('fs');var path=require(_0x86ff('0x0'));var _=require(_0x86ff('0x1'));var Papa=require(_0x86ff('0x2'));var util=require(_0x86ff('0x3'));var BPromise=require(_0x86ff('0x4'));var moment=require('moment');var squel=require(_0x86ff('0x5'));var Redis=require(_0x86ff('0x6'));var db=require(_0x86ff('0x7'))['db'];var config=require(_0x86ff('0x8'));var shared=require(_0x86ff('0x9'));var logger=require('../../../config/logger')('import');config[_0x86ff('0xa')]=_[_0x86ff('0xb')](config['redis'],{'host':_0x86ff('0xc'),'port':0x18eb});var socket=require(_0x86ff('0xd'))(new Redis(config[_0x86ff('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x86ff('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3f375c){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3f375c);}function selectNotIn(_0x4df834,_0x2382f2,_0x33fc51,_0x471cf1,_0x3f60dd){return squel[_0x86ff('0xf')]()[_0x86ff('0x10')](_0x86ff('0x11'))['from'](_0x471cf1)[_0x86ff('0x12')](_0x2382f2,null,_0x2382f2+'.id\x20=\x20'+_0x471cf1+'.'+_0x33fc51)['where'](_0x471cf1+'.'+_0x33fc51+_0x86ff('0x13')+_0x4df834+'.'+_0x33fc51)['where'](_0x2382f2+'.dialCheckDuplicateType\x20IN\x20('+_0x3f60dd[_0x86ff('0x12')]()+')');}function insertCmHopper(_0x415240,_0x4a18b9,_0x22185a,_0x3c38b8,_0x156be){var _0x297ca8=[_0x86ff('0x14'),_0x86ff('0x15'),_0x86ff('0x16'),_0x86ff('0x17'),_0x4a18b9+'.'+_0x3c38b8,'cm_contacts.createdAt',_0x86ff('0x18'),'cm_contacts.priority',_0x86ff('0x19'),'\x22'+_0x156be+'\x22'];return squel[_0x86ff('0x1a')]()[_0x86ff('0x1b')](_0x86ff('0x1c'))['fromQuery']([_0x86ff('0x11'),_0x86ff('0x1d'),_0x86ff('0x1e'),_0x86ff('0x1f'),_0x3c38b8,'createdAt',_0x86ff('0x20'),_0x86ff('0x21'),_0x86ff('0x22'),_0x86ff('0x23')],squel[_0x86ff('0xf')]()[_0x86ff('0x24')](_0x297ca8)[_0x86ff('0x25')](_0x4a18b9)[_0x86ff('0x12')](_0x86ff('0x26'),null,_0x86ff('0x27')+_0x4a18b9+_0x86ff('0x28'))['join'](_0x22185a,null,_0x22185a+_0x86ff('0x29')+_0x4a18b9+'.'+_0x3c38b8)[_0x86ff('0x2a')](_0x4a18b9+_0x86ff('0x2b'),_0x415240)['where'](_0x86ff('0x2c'),NOW)[_0x86ff('0x2a')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4a18b9,_0x22185a,_0x3c38b8,_0x86ff('0x1c'),[_0x86ff('0x2d'),_0x86ff('0x2e')]))['where'](_0x86ff('0x2f'),selectNotIn(_0x4a18b9,_0x22185a,_0x3c38b8,_0x86ff('0x1c'),[_0x86ff('0x2d')])))['toString']();}function insertCmHopperBlack(_0x7b7ee2,_0xa5ecfe,_0x796b23,_0x29a576){var _0x44d260=[_0x86ff('0x14'),_0x86ff('0x16'),'cm_contacts.ListId',_0xa5ecfe+'.'+_0x29a576,_0x86ff('0x30'),_0x86ff('0x18')];return squel[_0x86ff('0x1a')]()[_0x86ff('0x1b')](_0x86ff('0x31'))[_0x86ff('0x32')]([_0x86ff('0x11'),_0x86ff('0x1e'),_0x86ff('0x1f'),_0x29a576,_0x86ff('0x33'),_0x86ff('0x20')],squel['select']()[_0x86ff('0x24')](_0x44d260)[_0x86ff('0x25')](_0xa5ecfe)[_0x86ff('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xa5ecfe+_0x86ff('0x28'))[_0x86ff('0x12')](_0x796b23,null,_0x796b23+'.id\x20=\x20'+_0xa5ecfe+'.'+_0x29a576)['where'](_0xa5ecfe+_0x86ff('0x2b'),_0x7b7ee2)[_0x86ff('0x2a')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x86ff('0x2a')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x86ff('0xf')]()[_0x86ff('0x10')](_0x86ff('0x11'))[_0x86ff('0x25')](_0x86ff('0x31'))[_0x86ff('0x2a')]('ListId\x20=\x20?',_0x7b7ee2)[_0x86ff('0x2a')](_0x29a576+_0x86ff('0x34'),_0xa5ecfe+'.'+_0x29a576)))[_0x86ff('0x35')]();}function insertTzCmHopper(_0x5f49ca,_0x4d44ab,_0x32de25,_0x264756,_0x7d8de2,_0x3708a4){var _0x47a488=['cm_contacts.phone',_0x86ff('0x36')+_0x3708a4+_0x86ff('0x37'),'cm_contacts.id',_0x86ff('0x17'),_0x4d44ab+'.'+_0x264756,_0x86ff('0x30'),_0x86ff('0x18'),_0x86ff('0x38'),_0x86ff('0x19'),'\x22'+_0x7d8de2+'\x22'];var _0x1bd9aa=squel['insert']()[_0x86ff('0x1b')](_0x86ff('0x1c'))[_0x86ff('0x32')]([_0x86ff('0x11'),_0x86ff('0x1d'),_0x86ff('0x1e'),_0x86ff('0x1f'),_0x264756,_0x86ff('0x33'),_0x86ff('0x20'),_0x86ff('0x21'),'UserId',_0x86ff('0x23')],squel[_0x86ff('0xf')]()[_0x86ff('0x24')](_0x47a488)[_0x86ff('0x25')](_0x4d44ab)[_0x86ff('0x12')](_0x86ff('0x26'),null,_0x86ff('0x27')+_0x4d44ab+'.CmListId')[_0x86ff('0x12')](_0x32de25,null,_0x32de25+'.id\x20=\x20'+_0x4d44ab+'.'+_0x264756)[_0x86ff('0x12')](_0x3708a4,null,_0x3708a4+_0x86ff('0x29')+_0x4d44ab+'.'+_0x264756)[_0x86ff('0x2a')](_0x4d44ab+_0x86ff('0x2b'),_0x5f49ca)[_0x86ff('0x2a')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x86ff('0x2a')](_0x86ff('0x2f'),selectNotIn(_0x4d44ab,_0x32de25,_0x264756,_0x86ff('0x1c'),[_0x86ff('0x2d'),'\x22onlyIfOpen\x22']))[_0x86ff('0x2a')](_0x86ff('0x2f'),selectNotIn(_0x4d44ab,_0x32de25,_0x264756,_0x86ff('0x1c'),[_0x86ff('0x2d')])))[_0x86ff('0x35')]();return _0x1bd9aa;}function insertTzCmHopperBlack(_0x578e57,_0x2e14c6,_0x10df8d,_0x287be3){var _0x463425=[_0x86ff('0x14'),_0x86ff('0x16'),_0x86ff('0x17'),_0x2e14c6+'.'+_0x287be3,_0x86ff('0x30'),_0x86ff('0x18')];return squel[_0x86ff('0x1a')]()['into'](_0x86ff('0x31'))[_0x86ff('0x32')]([_0x86ff('0x11'),_0x86ff('0x1e'),_0x86ff('0x1f'),_0x287be3,'createdAt',_0x86ff('0x20')],squel['select']()[_0x86ff('0x24')](_0x463425)[_0x86ff('0x25')](_0x2e14c6)[_0x86ff('0x12')](_0x86ff('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x2e14c6+_0x86ff('0x28'))['join'](_0x10df8d,null,_0x10df8d+_0x86ff('0x29')+_0x2e14c6+'.'+_0x287be3)[_0x86ff('0x2a')](_0x2e14c6+_0x86ff('0x2b'),_0x578e57)[_0x86ff('0x2a')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x86ff('0x2a')](_0x86ff('0x2f'),squel[_0x86ff('0xf')]()[_0x86ff('0x10')](_0x86ff('0x11'))[_0x86ff('0x25')](_0x86ff('0x31'))[_0x86ff('0x2a')](_0x86ff('0x39'),_0x578e57)[_0x86ff('0x2a')](_0x287be3+_0x86ff('0x34'),_0x2e14c6+'.'+_0x287be3)))['toString']();}function insertCmContact(_0x3a9fdb,_0x57919d,_0x557395,_0x596492){var _0x69dcc5=_[_0x86ff('0x3a')](_[_0x86ff('0x3b')](_0x596492),[_0x86ff('0x1f'),_0x86ff('0x3c'),_0x86ff('0x33'),_0x86ff('0x20')]);return squel[_0x86ff('0x1a')]()[_0x86ff('0x1b')]('cm_contacts')['fromQuery'](_0x69dcc5,squel[_0x86ff('0xf')]()['fields'](_0x69dcc5)['from'](_0x57919d)[_0x86ff('0x2a')]('('+_0x557395['join'](',')+_0x86ff('0x3d'),squel[_0x86ff('0xf')]()[_0x86ff('0x24')](_0x557395)[_0x86ff('0x25')](_0x86ff('0x26'))[_0x86ff('0x2a')]('ListId\x20=\x20?',_0x3a9fdb)[_0x86ff('0x2a')](_0x86ff('0x3e')))[_0x86ff('0x2a')](_0x86ff('0x3f'),squel[_0x86ff('0xf')]()[_0x86ff('0x10')](_0x86ff('0x40'),'min_id')[_0x86ff('0x25')](_0x57919d)[_0x86ff('0x41')](_0x557395[_0x86ff('0x12')](','))))[_0x86ff('0x35')]();}function handleStop(){logger[_0x86ff('0x42')](_0x86ff('0x43'));stopped=!![];}function handleUncaughtException(_0x282481){logger['error'](_0x282481[_0x86ff('0x44')]);process[_0x86ff('0x45')](0x1);}function handleError(_0x5502db,_0x25b3ef){stats[_0x86ff('0x46')][_0x86ff('0x47')]({'name':_0x25b3ef[_0x86ff('0x48')],'message':_0x25b3ef[_0x86ff('0x44')],'row':_0x5502db});}function handleQuery(_0x1770b9){logger['info'](_0x1770b9);return db['sequelize'][_0x86ff('0x49')](_0x1770b9)['spread'](function(_0x556ec8){results['push'](_0x556ec8);})[_0x86ff('0x4a')](function(_0x23d30f){logger[_0x86ff('0x4b')](_0x23d30f['message']);});}function updateTzCampaigns(_0x463d48){return new Promise(function(_0x5b029d,_0x28ad32){var _0x52cec9=squel['select']()['fields']([_0x86ff('0x4c'),_0x86ff('0x4d')])[_0x86ff('0x25')](_0x86ff('0x4e'))[_0x86ff('0x12')](_0x86ff('0x4f'),null,_0x86ff('0x50'))['where']('campaigns_has_cm_lists.CmListId='+_0x463d48);db[_0x86ff('0x51')][_0x86ff('0x49')](_0x52cec9['toString']())[_0x86ff('0x52')](function(_0x5793f3){var _0xde22ae=[];for(var _0x36bbe4=0x0;_0x36bbe4<_0x5793f3[_0x86ff('0x53')];_0x36bbe4++){_0xde22ae['push'](getTimezoneData(_0x5793f3[_0x36bbe4],tmp_campaigns));}BPromise[_0x86ff('0x54')](_0xde22ae)[_0x86ff('0x55')](function(){_0x5b029d({'val':0x1});});})[_0x86ff('0x4a')](function(_0x4ace54){logger['error'](_0x4ace54[_0x86ff('0x44')]);_0x5b029d({'val':0x0});});});}function updateTzVoiceQueues(_0xe9a3cf){return new Promise(function(_0x2aa3d3,_0x363c2a){var _0xcfa5b6=squel[_0x86ff('0xf')]()[_0x86ff('0x24')]([_0x86ff('0x56'),'voice_queues.dialTimezone'])['from'](_0x86ff('0x57'))[_0x86ff('0x12')](_0x86ff('0x58'),null,_0x86ff('0x59'))[_0x86ff('0x2a')](_0x86ff('0x5a')+_0xe9a3cf);db['sequelize'][_0x86ff('0x49')](_0xcfa5b6['toString']())[_0x86ff('0x52')](function(_0x4bae6c){var _0x301f6a=[];for(var _0x2ad488=0x0;_0x2ad488<_0x4bae6c[_0x86ff('0x53')];_0x2ad488++){_0x301f6a['push'](getTimezoneData(_0x4bae6c[_0x2ad488],tmp_voice_queues));}BPromise[_0x86ff('0x54')](_0x301f6a)[_0x86ff('0x55')](function(){_0x2aa3d3({'val':0x1});});})[_0x86ff('0x4a')](function(_0x5f4d1c){logger['error'](_0x5f4d1c[_0x86ff('0x44')]);_0x2aa3d3({'val':0x0});});});}function getTimezoneData(_0x37cd7a,_0x52551f){return new Promise(function(_0x2eb57a,_0x34b4a5){var _0xadd3e6=shared[_0x86ff('0x5b')];var _0x17ee9e=_0xadd3e6[_0x37cd7a[_0x86ff('0x5c')]];if(_['isNil'](_0x17ee9e)){_0x2eb57a({'ret':0x1});}else{var _0x1840e9=_0x17ee9e[_0x86ff('0x5d')];var _0x95235=squel['insert']()['into'](_0x52551f)[_0x86ff('0x5e')]('id',_0x37cd7a['id'])[_0x86ff('0x5e')](_0x86ff('0x5f'),_0x1840e9)[_0x86ff('0x5e')](_0x86ff('0x5c'),_0x37cd7a[_0x86ff('0x5c')])[_0x86ff('0x35')]();return db[_0x86ff('0x51')][_0x86ff('0x49')](_0x95235)[_0x86ff('0x52')](function(_0x21d4ef){_0x2eb57a({'ret':0x1});})[_0x86ff('0x4a')](function(_0x4f29b0){logger[_0x86ff('0x4b')](_0x4f29b0[_0x86ff('0x44')]);_0x34b4a5({'ret':0x1});});}});}function handleTZQuery(_0x3b3f08){logger[_0x86ff('0x42')](_0x3b3f08);return db[_0x86ff('0x51')]['query'](_0x3b3f08)[_0x86ff('0x52')](function(_0x3bd5e8){})[_0x86ff('0x4a')](function(_0x26eb15){logger[_0x86ff('0x4b')](_0x26eb15[_0x86ff('0x44')]);});}function main(_0x552716,_0x11387d,_0x1a99a7,_0x3b8bb3){logger[_0x86ff('0x42')]('main',_0x552716,JSON[_0x86ff('0x60')](_0x11387d));process[_0x86ff('0x61')]('start');var _0x1adfdf=_0x11387d[_0x86ff('0x62')];var _0x39cfcd=_0x11387d[_0x86ff('0x63')];var _0x3f3646=path['join'](config[_0x86ff('0x64')],_0x86ff('0x65'),_0x39cfcd+_0x86ff('0x66'));hasTZ=_[_0x86ff('0x3b')](_0x1adfdf)[_0x86ff('0x67')](_0x86ff('0x5c'));var _0x425c47=_[_0x86ff('0x3b')](_0x1adfdf)[_0x86ff('0x12')]();logger[_0x86ff('0x42')]('header',_0x425c47);if(hasTZ)_0x425c47+=_0x86ff('0x68');fs[_0x86ff('0x69')](_0x3f3646,_0x425c47+'\x0a');Papa[_0x86ff('0x6a')](fs['createReadStream'](_0x552716),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58cea5,_0x14c30b){try{for(var _0x38f070=0x0,_0x1a6907=[];_0x38f070<_0x58cea5[_0x86ff('0x6b')]['length'];_0x38f070++){stats[_0x86ff('0x6c')]+=0x1;if(_0x58cea5[_0x86ff('0x46')][_0x38f070]){handleError(_0x58cea5['data'][_0x38f070],_0x58cea5[_0x86ff('0x46')][_0x38f070]);}else{var _0x3ea1ff=[];for(var _0x9b6c0f in _0x1adfdf){if(_0x1adfdf[_0x86ff('0x6d')](_0x9b6c0f)){if(_0x58cea5[_0x86ff('0x6b')][_0x38f070][_0x1adfdf[_0x9b6c0f]]){var _0x527f5c=_[_0x86ff('0x6e')](_0x58cea5['data'][_0x38f070][_0x1adfdf[_0x9b6c0f]][_0x86ff('0x6f')](/"/g,'\x27'));switch(_0x9b6c0f){case'scheduledat':var _0xaabcc7=moment(_0x527f5c,_0x86ff('0x70'),!![]);if(_0xaabcc7[_0x86ff('0x71')]()){_0x1a6907[_0x86ff('0x47')]('\x22'+_0x527f5c+'\x22');}else{_0x3ea1ff['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x86ff('0x21'):var _0x3d2e32=parseInt(_0x527f5c);_0x527f5c=_[_0x86ff('0x72')](_0x3d2e32)||_0x3d2e32<0x0||_0x3d2e32>0x4?_0x3b8bb3?0x3:0x2:_0x3d2e32;_0x1a6907[_0x86ff('0x47')]('\x22'+_0x527f5c+'\x22');break;case _0x86ff('0x22'):var _0x3809f5=parseInt(_0x527f5c);if(_['isNumber'](_0x3809f5)&&_[_0x86ff('0x67')](_0x1a99a7,_0x3809f5)){_0x1a6907[_0x86ff('0x47')]('\x22'+_0x3809f5+'\x22');}else{_0x3ea1ff[_0x86ff('0x47')](_0x86ff('0x73'));}break;case'email':if(isEmail(_0x527f5c)){_0x1a6907[_0x86ff('0x47')]('\x22'+_0x527f5c+'\x22');}else{_0x3ea1ff[_0x86ff('0x47')](_0x86ff('0x74'));}break;case _0x86ff('0x75'):var _0x4a4532=moment(_0x527f5c,_0x86ff('0x76'),!![]);if(_0x4a4532[_0x86ff('0x71')]()){_0x1a6907[_0x86ff('0x47')]('\x22'+_0x527f5c+'\x22');}else{_0x3ea1ff[_0x86ff('0x47')](_0x86ff('0x77'));}break;case _0x86ff('0x5c'):var _0x22e142=shared[_0x86ff('0x5b')];var _0x262d7a=_0x22e142[_0x527f5c];if(!_['isNil'](_0x262d7a)){var _0x19b45c=_0x262d7a['utcOffset'];_0x1a6907['push']('\x22'+_0x527f5c+'\x22');_0x1a6907['push']('\x22'+_0x19b45c+'\x22');}break;default:_0x1a6907[_0x86ff('0x47')]('\x22'+_0x527f5c+'\x22');}}else{switch(_0x9b6c0f){case _0x86ff('0x78'):case'phone':_0x3ea1ff[_0x86ff('0x47')](_0x9b6c0f+'\x20not\x20specified');break;default:_0x1a6907[_0x86ff('0x47')]('\x22\x22');}}}}if(_0x3ea1ff[_0x86ff('0x53')]){handleError(_0x58cea5[_0x86ff('0x6b')][_0x38f070],{'code':_0x86ff('0x79'),'message':_0x3ea1ff['join']()});}else{fs['appendFileSync'](_0x3f3646,_0x1a6907[_0x86ff('0x12')]()+'\x0a');}_0x1a6907=[];}if(!(stats[_0x86ff('0x6c')]%0xc8)){socket[_0x86ff('0x7a')](_0x86ff('0x7b')+_0x39cfcd,stats);stats[_0x86ff('0x46')]=[];}}if(stopped){logger[_0x86ff('0x42')](_0x86ff('0x7c'));_0x14c30b[_0x86ff('0x7d')]();}}catch(_0x3715e2){handleError(_0x58cea5[_0x86ff('0x6b')][_0x38f070],{'code':_0x86ff('0x7e'),'message':_0x3715e2[_0x86ff('0x44')]});logger[_0x86ff('0x4b')](_0x86ff('0x7f'),_0x3715e2['message']);}},'complete':function(){try{var _0x1fac2e=[];var _0x31ca2f=[];var _0x31582d=_0x86ff('0x26');if(_0x11387d[_0x86ff('0x80')]&&_0x11387d[_0x86ff('0x80')][_0x86ff('0x53')]){_0x31582d=_0x86ff('0x81')+_0x39cfcd;_0x1fac2e[_0x86ff('0x47')]('CREATE\x20TABLE\x20'+_0x31582d+_0x86ff('0x82'));}tmp_campaigns=_0x86ff('0x83')+_0x39cfcd;tmp_voice_queues=_0x86ff('0x84')+_0x39cfcd;_0x31ca2f['push'](_0x86ff('0x85')+tmp_campaigns+_0x86ff('0x86'));_0x31ca2f[_0x86ff('0x47')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x86ff('0x86'));BPromise[_0x86ff('0x87')](_0x31ca2f,handleTZQuery)[_0x86ff('0x55')](function(_0x36019a){updateTzCampaigns(_0x11387d[_0x86ff('0x1f')])[_0x86ff('0x55')](function(_0x390c54){updateTzVoiceQueues(_0x11387d[_0x86ff('0x1f')])['then'](function(_0x1d5c78){var _0x31b7b0=util[_0x86ff('0xe')]('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',_0x3f3646,_0x31582d,_0x425c47,_0x11387d[_0x86ff('0x1f')],_0x11387d[_0x86ff('0x3c')]||null,NOW,NOW);if(_[_0x86ff('0x88')](_0x1adfdf[_0x86ff('0x1d')])){_0x31b7b0+=_0x86ff('0x89');}_0x1fac2e[_0x86ff('0x47')](_0x31b7b0);if(_0x11387d['duplicates']&&_0x11387d['duplicates']['length']){_0x1fac2e[_0x86ff('0x47')](insertCmContact(_0x11387d[_0x86ff('0x1f')],_0x31582d,_0x11387d[_0x86ff('0x80')],_0x1adfdf));_0x1fac2e[_0x86ff('0x47')]('DROP\x20TABLE\x20'+_0x31582d+';');}if(hasTZ){_0x1fac2e[_0x86ff('0x47')](insertTzCmHopper(_0x11387d[_0x86ff('0x1f')],_0x86ff('0x58'),_0x86ff('0x57'),_0x86ff('0x8a'),_0x3b8bb3,tmp_voice_queues));_0x1fac2e[_0x86ff('0x47')](insertTzCmHopperBlack(_0x11387d['ListId'],'voice_queues_has_cm_blacklists','voice_queues','VoiceQueueId'));_0x1fac2e['push'](insertTzCmHopper(_0x11387d[_0x86ff('0x1f')],'campaigns_has_cm_lists',_0x86ff('0x4e'),_0x86ff('0x8b'),_0x3b8bb3,tmp_campaigns));_0x1fac2e[_0x86ff('0x47')](insertTzCmHopperBlack(_0x11387d[_0x86ff('0x1f')],_0x86ff('0x8c'),_0x86ff('0x4e'),_0x86ff('0x8b')));}else{_0x1fac2e[_0x86ff('0x47')](insertCmHopper(_0x11387d[_0x86ff('0x1f')],_0x86ff('0x58'),'voice_queues',_0x86ff('0x8a'),_0x3b8bb3));_0x1fac2e[_0x86ff('0x47')](insertCmHopperBlack(_0x11387d[_0x86ff('0x1f')],_0x86ff('0x8d'),_0x86ff('0x57'),_0x86ff('0x8a')));_0x1fac2e['push'](insertCmHopper(_0x11387d[_0x86ff('0x1f')],_0x86ff('0x4f'),_0x86ff('0x4e'),_0x86ff('0x8b'),_0x3b8bb3));_0x1fac2e[_0x86ff('0x47')](insertCmHopperBlack(_0x11387d[_0x86ff('0x1f')],_0x86ff('0x8c'),_0x86ff('0x4e'),'CampaignId'));}_0x1fac2e[_0x86ff('0x47')](_0x86ff('0x8e')+tmp_campaigns+';');_0x1fac2e[_0x86ff('0x47')](_0x86ff('0x8e')+tmp_voice_queues+';');BPromise[_0x86ff('0x87')](_0x1fac2e,handleQuery)[_0x86ff('0x55')](function(_0x18c8f9){stats[_0x86ff('0x8f')]=!![];stats[_0x86ff('0x90')]=_0x11387d[_0x86ff('0x80')]&&_0x11387d[_0x86ff('0x80')]['length']?results[0x2][_0x86ff('0x90')]:results[0x0][_0x86ff('0x90')];socket[_0x86ff('0x7a')](_0x86ff('0x7b')+_0x39cfcd,stats);fs['unlink'](_0x552716);fs['unlink'](_0x3f3646);process[_0x86ff('0x45')](0x0);})[_0x86ff('0x4a')](function(_0x3d2a2d){logger['error'](_0x3d2a2d[_0x86ff('0x44')]);process[_0x86ff('0x45')](0x1);});});});});}catch(_0x1028fd){logger[_0x86ff('0x4b')](_0x86ff('0x91'),_0x1028fd[_0x86ff('0x44')]);process[_0x86ff('0x45')](0x1);}},'error':function(_0x16030c,_0x1becef,_0x2910fe,_0x3250ee){throw new Error(_0x3250ee);}});}function validate(){if(process[_0x86ff('0x92')]&&process[_0x86ff('0x92')][_0x86ff('0x53')]<0x4){throw new Error(_0x86ff('0x93'));}var _0x31eeef=path[_0x86ff('0x12')](config[_0x86ff('0x64')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x86ff('0x94')](_0x31eeef)){throw new Error(_0x86ff('0x95'));}var _0x5bbbe9={};try{_0x5bbbe9=JSON[_0x86ff('0x6a')](process[_0x86ff('0x92')][0x3]);if(!_0x5bbbe9[_0x86ff('0x62')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x5bbbe9[_0x86ff('0x62')][_0x86ff('0x11')]){throw new Error(_0x86ff('0x96'));}if(!_0x5bbbe9['binding']['firstName']){throw new Error(_0x86ff('0x97'));}var _0x159c70=0x0;if(_0x5bbbe9['binding'][_0x86ff('0x22')]){_0x159c70=0x1;}if(!_0x5bbbe9['ListId']){throw new Error(_0x86ff('0x98'));}}catch(_0x21ccaf){throw new Error(_0x86ff('0x99'));}var _0x3a13ba=[];try{_0x3a13ba=_[_0x86ff('0x9a')](JSON[_0x86ff('0x6a')](process[_0x86ff('0x92')][0x4]),'id');}catch(_0x29351c){logger[_0x86ff('0x42')](_0x86ff('0x9b'));}main(_0x31eeef,_0x5bbbe9,_0x3a13ba,_0x159c70);}validate();process['on'](_0x86ff('0x9c'),handleStop);process['on'](_0x86ff('0x9d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 8518081..c917000 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9a3=['Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','destcalleridnum','membername','starttime','Answer\x20Time','answertime','Duration','duration','Billable\x20Time','getSubjects','string','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','agentcalledAt','Agent\x20Name'];(function(_0xe5f60a,_0x54b744){var _0x10df82=function(_0x885dd3){while(--_0x885dd3){_0xe5f60a['push'](_0xe5f60a['shift']());}};_0x10df82(++_0x54b744);}(_0xc9a3,0xe1));var _0x3c9a=function(_0x4b6c87,_0x2bec19){_0x4b6c87=_0x4b6c87-0x0;var _0x5c10cb=_0xc9a3[_0x4b6c87];return _0x5c10cb;};'use strict';exports[_0x3c9a('0x0')]=function(_0x10adc8,_0x1dd360){var _0x16fca3=[{'type':_0x3c9a('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x10adc8[_0x3c9a('0x2')]()){case _0x3c9a('0x3'):switch(_0x1dd360[_0x3c9a('0x2')]()){case _0x3c9a('0x4'):_0x16fca3[_0x3c9a('0x5')]({'type':_0x3c9a('0x6'),'content':'','variableName':_0x3c9a('0x7')});_0x16fca3[_0x3c9a('0x5')]({'type':'variable','content':'','variableName':_0x3c9a('0x8')});break;case _0x3c9a('0x9'):_0x16fca3[_0x3c9a('0x5')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x16fca3['push']({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x16fca3;};exports['getDescriptions']=function(_0x511b17,_0x350f85){var _0x527ad9=[];switch(_0x511b17[_0x3c9a('0x2')]()){case'voice':switch(_0x350f85[_0x3c9a('0x2')]()){case _0x3c9a('0x4'):_0x527ad9=[{'type':_0x3c9a('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x3c9a('0xa'),'keyType':_0x3c9a('0x6'),'variableName':_0x3c9a('0x8')},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0xc'),'keyType':_0x3c9a('0x6'),'variableName':_0x3c9a('0xd')},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0xe'),'keyType':_0x3c9a('0x6'),'variableName':_0x3c9a('0xf')},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0x10'),'keyType':_0x3c9a('0x6'),'variableName':_0x3c9a('0x7')},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0x11'),'keyType':_0x3c9a('0x6'),'variableName':_0x3c9a('0x12')},{'type':'keyValue','content':'','key':'Date','keyType':_0x3c9a('0x6'),'variableName':_0x3c9a('0x13')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x3c9a('0x14'),'keyType':_0x3c9a('0x6'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0x3c9a('0x15'),'keyType':'variable','variableName':'destcalleridnum'},{'type':'string','content':_0x3c9a('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x3c9a('0x17'),'keyType':_0x3c9a('0x6'),'variableName':_0x3c9a('0x13')},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0x18'),'keyType':'variable','variableName':_0x3c9a('0x19')},{'type':_0x3c9a('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0x3c9a('0x6'),'variableName':_0x3c9a('0x1a')},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0x1b'),'keyType':'variable','variableName':_0x3c9a('0x1c')},{'type':'keyValue','content':'','key':_0x3c9a('0x1d'),'keyType':'variable','variableName':_0x3c9a('0x1e')}];break;case _0x3c9a('0x9'):_0x527ad9=[{'type':_0x3c9a('0x1'),'content':_0x3c9a('0x1f'),'variableName':null},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0x20'),'keyType':_0x3c9a('0x6'),'keyContent':'','variableName':_0x3c9a('0x21')},{'type':_0x3c9a('0xb'),'content':'','key':'Member\x20Name','keyType':_0x3c9a('0x6'),'keyContent':'','variableName':_0x3c9a('0x22')},{'type':_0x3c9a('0xb'),'content':'','key':'UniqueId','keyType':_0x3c9a('0x6'),'keyContent':'','variableName':_0x3c9a('0x12')},{'type':_0x3c9a('0xb'),'content':'','key':'Date','keyType':_0x3c9a('0x6'),'keyContent':'','variableName':_0x3c9a('0x23')},{'type':_0x3c9a('0x1'),'content':_0x3c9a('0x16')},{'type':'keyValue','content':'','key':_0x3c9a('0x24'),'keyType':_0x3c9a('0x6'),'keyContent':'','variableName':_0x3c9a('0x25')},{'type':_0x3c9a('0xb'),'content':'','key':'Complete\x20Time','keyType':_0x3c9a('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0x26'),'keyType':'variable','keyContent':'','variableName':_0x3c9a('0x27')},{'type':_0x3c9a('0xb'),'content':'','key':_0x3c9a('0x28'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x527ad9;}; \ No newline at end of file +var _0x35d3=['Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','Duration','Billable\x20Time','billableseconds','string','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','Queue','uniqueid','Date','agentcalledAt'];(function(_0x3018fb,_0x507e28){var _0x557c8c=function(_0x1ede9f){while(--_0x1ede9f){_0x3018fb['push'](_0x3018fb['shift']());}};_0x557c8c(++_0x507e28);}(_0x35d3,0x16d));var _0x335d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35d3[_0x3dd15e];return _0x231fd0;};'use strict';exports['getSubjects']=function(_0x27eca0,_0x53c4a3){var _0x9f9ae4=[{'type':_0x335d('0x0'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x27eca0[_0x335d('0x1')]()){case'voice':switch(_0x53c4a3[_0x335d('0x1')]()){case _0x335d('0x2'):_0x9f9ae4[_0x335d('0x3')]({'type':_0x335d('0x4'),'content':'','variableName':_0x335d('0x5')});_0x9f9ae4[_0x335d('0x3')]({'type':'variable','content':'','variableName':_0x335d('0x6')});break;case _0x335d('0x7'):_0x9f9ae4['push']({'type':'string','content':_0x335d('0x8'),'variableName':null});_0x9f9ae4[_0x335d('0x3')]({'type':'variable','content':'','variableName':_0x335d('0x9')});break;}}return _0x9f9ae4;};exports[_0x335d('0xa')]=function(_0x2dbd1e,_0x5412ec){var _0x425c0e=[];switch(_0x2dbd1e['toLowerCase']()){case _0x335d('0xb'):switch(_0x5412ec[_0x335d('0x1')]()){case'inbound':_0x425c0e=[{'type':'string','content':_0x335d('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0xe'),'keyType':_0x335d('0x4'),'variableName':'calleridnum'},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0xf'),'keyType':_0x335d('0x4'),'variableName':'calleridname'},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x10'),'keyType':_0x335d('0x4'),'variableName':_0x335d('0x11')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x12'),'keyType':_0x335d('0x4'),'variableName':_0x335d('0x5')},{'type':_0x335d('0xd'),'content':'','key':'UniqueId','keyType':'variable','variableName':_0x335d('0x13')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x14'),'keyType':_0x335d('0x4'),'variableName':_0x335d('0x15')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x16'),'keyType':_0x335d('0x4'),'variableName':_0x335d('0x17')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x18'),'keyType':_0x335d('0x4'),'variableName':_0x335d('0x9')},{'type':'string','content':_0x335d('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x335d('0x4'),'variableName':_0x335d('0x15')},{'type':'keyValue','content':'','key':_0x335d('0x1a'),'keyType':_0x335d('0x4'),'variableName':_0x335d('0x1b')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x1c'),'keyType':_0x335d('0x4'),'variableName':_0x335d('0x1d')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x1e'),'keyType':'variable','variableName':_0x335d('0x1f')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x20'),'keyType':'variable','variableName':_0x335d('0x21')}];break;case _0x335d('0x7'):_0x425c0e=[{'type':_0x335d('0x0'),'content':_0x335d('0xc'),'variableName':null},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x22'),'keyType':_0x335d('0x4'),'keyContent':'','variableName':_0x335d('0x9')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x23'),'keyType':_0x335d('0x4'),'keyContent':'','variableName':_0x335d('0x24')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x25'),'keyType':_0x335d('0x4'),'keyContent':'','variableName':_0x335d('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x335d('0x4'),'keyContent':'','variableName':_0x335d('0x26')},{'type':_0x335d('0x0'),'content':_0x335d('0x19')},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x27'),'keyType':_0x335d('0x4'),'keyContent':'','variableName':'answertime'},{'type':_0x335d('0xd'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x335d('0xd'),'content':'','key':_0x335d('0x28'),'keyType':_0x335d('0x4'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0x335d('0x29'),'keyType':'variable','keyContent':'','variableName':_0x335d('0x2a')}];break;}}return _0x425c0e;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index c3709d8..91b5b08 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x361f=['null','findOne','then','update','error','user','query','clone','body','omit','html','phone','fax','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role'];(function(_0x17c671,_0x516c0f){var _0x4e0973=function(_0xc7faa6){while(--_0xc7faa6){_0x17c671['push'](_0x17c671['shift']());}};_0x4e0973(++_0x516c0f);}(_0x361f,0xed));var _0xf361=function(_0x516205,_0x315bb2){_0x516205=_0x516205-0x0;var _0x489073=_0x361f[_0x516205];return _0x489073;};'use strict';var _=require(_0xf361('0x0'));var db=require(_0xf361('0x1'))['db'];var loggers={'openchannel':require(_0xf361('0x2'))('openchannel-interactions'),'mail':require(_0xf361('0x2'))(_0xf361('0x3')),'fax':require('../../config/logger')(_0xf361('0x4')),'sms':require(_0xf361('0x2'))(_0xf361('0x5')),'chat':require(_0xf361('0x2'))(_0xf361('0x6')),'whatsapp':require(_0xf361('0x2'))('whatsapp-interactions')};function getInteractionId(_0x55012d,_0x576473,_0x39b137){if(_0x55012d&&_0x55012d[_[_0xf361('0x7')](_0x39b137)+_0xf361('0x8')]){return _0x55012d[_[_0xf361('0x7')](_0x39b137)+'InteractionId'];}else if(_0x55012d&&_0x55012d['id']){return _0x55012d['id'];}else if(_0x576473&&_0x576473['id']){return _0x576473['id'];}else{return _0xf361('0x9');}}function log(_0x5aeb84,_0x37da76,_0x3316a2,_0x24ea7d,_0x25a6db,_0x3b0959){loggers[_0x25a6db[_0xf361('0xa')]()][_0x5aeb84](_0xf361('0xb'),_0x3b0959[_0xf361('0xc')](),_0x37da76?_0x37da76['id']:null,_0x37da76?_0x37da76[_0xf361('0xd')]:null,_0x37da76?_0x37da76[_0xf361('0xe')]:null,getInteractionId(_0x3316a2,_0x24ea7d,_0x25a6db),_0x3316a2?JSON['stringify'](_0x3316a2):_0xf361('0xf'));}function updateUser(_0x90ba0,_0x332877,_0x33faf7,_0x20b4bc,_0x15b89a){db[_[_0xf361('0x7')](_0x20b4bc)+'Interaction'][_0xf361('0x10')]({'where':{'id':getInteractionId(_0x332877,_0x33faf7,_0x20b4bc)}})[_0xf361('0x11')](function(_0x3fd83e){if(_0x3fd83e){return _0x3fd83e[_0xf361('0x12')]({'UserId':_0x90ba0?_0x90ba0['id']:null});}})['then'](function(_0x326e21){if(_0x326e21){log('info',_0x90ba0,_0x332877,_0x33faf7,_0x20b4bc,_0x15b89a);}})['catch'](function(){log(_0xf361('0x13'),_0x90ba0,_0x332877,_0x33faf7,_0x20b4bc,_0x15b89a);});}exports['tracked']=function(_0x218f65,_0xce0e1a){return function(_0x2f5522,_0x19efeb,_0x5d38f3){var _0x269763=_0x2f5522[_0xf361('0x14')];var _0x211f76={};var _0x52b661=_0x2f5522[_0xf361('0x15')];if(_0x211f76){_0x211f76=_[_0xf361('0x16')](_0x2f5522[_0xf361('0x17')]);_0x211f76=_[_0xf361('0x18')](_0x211f76,['body',_0xf361('0x19'),_0xf361('0x1a'),_0xf361('0x1b'),'mobile']);}updateUser(_0x269763,_0x211f76,_0x52b661,_0x218f65,_0xce0e1a);_0x5d38f3(null);};}; \ No newline at end of file +var _0x7981=['toUpperCase','name','stringify','Interaction','update','then','catch','error','user','query','clone','omit','body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase'];(function(_0x41f936,_0x217ec3){var _0x11a6fe=function(_0x551da4){while(--_0x551da4){_0x41f936['push'](_0x41f936['shift']());}};_0x11a6fe(++_0x217ec3);}(_0x7981,0x150));var _0x1798=function(_0x17fe9e,_0x301b9a){_0x17fe9e=_0x17fe9e-0x0;var _0x4a15b4=_0x7981[_0x17fe9e];return _0x4a15b4;};'use strict';var _=require(_0x1798('0x0'));var db=require(_0x1798('0x1'))['db'];var loggers={'openchannel':require(_0x1798('0x2'))(_0x1798('0x3')),'mail':require('../../config/logger')(_0x1798('0x4')),'fax':require('../../config/logger')(_0x1798('0x5')),'sms':require(_0x1798('0x2'))(_0x1798('0x6')),'chat':require(_0x1798('0x2'))(_0x1798('0x7')),'whatsapp':require(_0x1798('0x2'))('whatsapp-interactions')};function getInteractionId(_0x27dd47,_0x255d0e,_0x53df0c){if(_0x27dd47&&_0x27dd47[_[_0x1798('0x8')](_0x53df0c)+_0x1798('0x9')]){return _0x27dd47[_['upperFirst'](_0x53df0c)+'InteractionId'];}else if(_0x27dd47&&_0x27dd47['id']){return _0x27dd47['id'];}else if(_0x255d0e&&_0x255d0e['id']){return _0x255d0e['id'];}else{return _0x1798('0xa');}}function log(_0x455287,_0x1c53d8,_0x371ca1,_0x5f2129,_0x20d3b4,_0x500c83){loggers[_0x20d3b4[_0x1798('0xb')]()][_0x455287]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x500c83[_0x1798('0xc')](),_0x1c53d8?_0x1c53d8['id']:null,_0x1c53d8?_0x1c53d8[_0x1798('0xd')]:null,_0x1c53d8?_0x1c53d8['role']:null,getInteractionId(_0x371ca1,_0x5f2129,_0x20d3b4),_0x371ca1?JSON[_0x1798('0xe')](_0x371ca1):'null');}function updateUser(_0x37c4ab,_0x33e666,_0x33df60,_0xed081b,_0x21378a){db[_[_0x1798('0x8')](_0xed081b)+_0x1798('0xf')]['findOne']({'where':{'id':getInteractionId(_0x33e666,_0x33df60,_0xed081b)}})['then'](function(_0x5ac4fd){if(_0x5ac4fd){return _0x5ac4fd[_0x1798('0x10')]({'UserId':_0x37c4ab?_0x37c4ab['id']:null});}})[_0x1798('0x11')](function(_0x4dce1a){if(_0x4dce1a){log('info',_0x37c4ab,_0x33e666,_0x33df60,_0xed081b,_0x21378a);}})[_0x1798('0x12')](function(){log(_0x1798('0x13'),_0x37c4ab,_0x33e666,_0x33df60,_0xed081b,_0x21378a);});}exports['tracked']=function(_0x3ba2ac,_0x35e7a1){return function(_0x2843d4,_0x33b742,_0x1295f0){var _0x935589=_0x2843d4[_0x1798('0x14')];var _0x10ccb3={};var _0xd324b0=_0x2843d4[_0x1798('0x15')];if(_0x10ccb3){_0x10ccb3=_[_0x1798('0x16')](_0x2843d4['body']);_0x10ccb3=_[_0x1798('0x17')](_0x10ccb3,[_0x1798('0x18'),_0x1798('0x19'),_0x1798('0x1a'),_0x1798('0x1b'),_0x1798('0x1c')]);}updateUser(_0x935589,_0x10ccb3,_0xd324b0,_0x3ba2ac,_0x35e7a1);_0x1295f0(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index fd89a9b..a235528 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 _0x3479=['parse','hasOwnProperty','use','License','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','update','utf8'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3479,0x80));var _0x9347=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0x3479[_0x27ddf5];return _0x26e74a;};'use strict';var crypto=require(_0x9347('0x0'));var util=require(_0x9347('0x1'));var compose=require(_0x9347('0x2'));var db=require(_0x9347('0x3'))['db'];var config=require(_0x9347('0x4'));function getValueFromLicense(_0x57dc4a,_0x5e3794){if(_0x57dc4a&&_0x5e3794){if(_0x5e3794[_0x9347('0x5')]&&_0x5e3794[_0x9347('0x6')]){var _0x463470=_0x5e3794[_0x9347('0x5')];var _0x5bc216=_0x5e3794[_0x9347('0x6')];var _0x2333b8=_0x463470['split']('-')[0x4];var _0x1fce47=_0x463470[_0x9347('0x7')]('-')[0x0];var _0x3420d9=crypto['createDecipher']('aes-256-ctr',util['format']('%s:%s:%s',_0x2333b8,_0x463470,_0x1fce47));var _0x4fb303=_0x3420d9[_0x9347('0x8')](_0x5bc216,'base64',_0x9347('0x9'));_0x4fb303+=_0x3420d9['final'](_0x9347('0x9'));var _0xe3044=JSON[_0x9347('0xa')](_0x4fb303);return _0xe3044[_0x9347('0xb')](_0x57dc4a)?_0xe3044[_0x57dc4a]:null;}}return null;}function isLimit(_0x3a916d,_0x36aff5,_0x2a0360,_0x31b5dc){var _0x33d814=_0x36aff5;return compose()[_0x9347('0xc')](function(_0x4e7092,_0xcfbd81,_0x31e414){return db[_0x9347('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x32bdd9){var _0x37934a=getValueFromLicense(_0x3a916d,_0x32bdd9);return _0x37934a?_0x37934a:_0x33d814;})[_0x9347('0xe')](function(_0x806f4f){_0x33d814=_0x806f4f;return _0x2a0360[_0x9347('0xf')](_0x31b5dc);})['then'](function(_0x12355f){if(_0x12355f>=_0x33d814){return _0xcfbd81['status'](0x193)[_0x9347('0x10')]({'message':util[_0x9347('0x11')](_0x9347('0x12'),_0x3a916d)});}_0x31e414();})['catch'](function(_0x4f7c44){_0x31e414(_0x4f7c44);});});}function isUserLimit(){return isLimit(_0x9347('0x13'),0x1,db[_0x9347('0x14')],{'where':{'$or':[{'role':_0x9347('0x15')},{'role':'user'}]}});}exports[_0x9347('0x16')]=isUserLimit; \ No newline at end of file +var _0x09bb=['../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','isUserLimit','util','composable-middleware','../../mysqldb'];(function(_0x38af46,_0x2b3520){var _0xa947db=function(_0x47d55a){while(--_0x47d55a){_0x38af46['push'](_0x38af46['shift']());}};_0xa947db(++_0x2b3520);}(_0x09bb,0x1d1));var _0xb09b=function(_0x44b745,_0x219601){_0x44b745=_0x44b745-0x0;var _0x3cf6fc=_0x09bb[_0x44b745];return _0x3cf6fc;};'use strict';var crypto=require('crypto');var util=require(_0xb09b('0x0'));var compose=require(_0xb09b('0x1'));var db=require(_0xb09b('0x2'))['db'];var config=require(_0xb09b('0x3'));function getValueFromLicense(_0xefbd27,_0x431ce5){if(_0xefbd27&&_0x431ce5){if(_0x431ce5[_0xb09b('0x4')]&&_0x431ce5[_0xb09b('0x5')]){var _0x557e55=_0x431ce5[_0xb09b('0x4')];var _0x141b9d=_0x431ce5['license'];var _0x122723=_0x557e55[_0xb09b('0x6')]('-')[0x4];var _0x2bbec6=_0x557e55['split']('-')[0x0];var _0x12b7a7=crypto['createDecipher'](_0xb09b('0x7'),util[_0xb09b('0x8')](_0xb09b('0x9'),_0x122723,_0x557e55,_0x2bbec6));var _0x5cc011=_0x12b7a7[_0xb09b('0xa')](_0x141b9d,_0xb09b('0xb'),_0xb09b('0xc'));_0x5cc011+=_0x12b7a7[_0xb09b('0xd')](_0xb09b('0xc'));var _0x1681d5=JSON[_0xb09b('0xe')](_0x5cc011);return _0x1681d5[_0xb09b('0xf')](_0xefbd27)?_0x1681d5[_0xefbd27]:null;}}return null;}function isLimit(_0x36d08a,_0x1db105,_0xede369,_0x3f23f7){var _0x430dfb=_0x1db105;return compose()[_0xb09b('0x10')](function(_0x493677,_0x59c6c0,_0x12b4db){return db[_0xb09b('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xb09b('0x12')](function(_0x1f2c52){var _0x3793fd=getValueFromLicense(_0x36d08a,_0x1f2c52);return _0x3793fd?_0x3793fd:_0x430dfb;})[_0xb09b('0x12')](function(_0x59f2c5){_0x430dfb=_0x59f2c5;return _0xede369[_0xb09b('0x13')](_0x3f23f7);})[_0xb09b('0x12')](function(_0x472897){if(_0x472897>=_0x430dfb){return _0x59c6c0['status'](0x193)[_0xb09b('0x14')]({'message':util['format'](_0xb09b('0x15'),_0x36d08a)});}_0x12b4db();})[_0xb09b('0x16')](function(_0x1b46f4){_0x12b4db(_0x1b46f4);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xb09b('0x17')],{'where':{'$or':[{'role':_0xb09b('0x18')},{'role':'user'}]}});}exports[_0xb09b('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 52927f2..94ad379 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 _0x5e41=['$lte','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','DATE','utcOffset','hours','minutes','moment','parseSearch','sqlOperator','[$or]','replace','[$and]','split','slice','forEach','match','filter','indexOf','map','push','buildExpression','operator','$eq','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?'];(function(_0x238c0a,_0x4280f5){var _0x2f4c63=function(_0x7b3f07){while(--_0x7b3f07){_0x238c0a['push'](_0x238c0a['shift']());}};_0x2f4c63(++_0x4280f5);}(_0x5e41,0xd7));var _0x15e4=function(_0x22bc5b,_0x39319d){_0x22bc5b=_0x22bc5b-0x0;var _0x3f5b1f=_0x5e41[_0x22bc5b];return _0x3f5b1f;};'use strict';var _=require('lodash');var moment=require(_0x15e4('0x0'));exports[_0x15e4('0x1')]=function(_0x51de3f){var _0x51026c={'conditions':[]};_0x51026c[_0x15e4('0x2')]=_['startsWith'](_0x51de3f,_0x15e4('0x3'))?'or':'and';var _0x3914fb=_0x51de3f[_0x15e4('0x4')](_0x15e4('0x5'),'')[_0x15e4('0x4')](_0x15e4('0x3'),'')['split']('||');for(var _0x48e963=0x0;_0x48e963<_0x3914fb['length'];_0x48e963++){var _0x42ea79=_0x3914fb[_0x48e963][_0x15e4('0x6')](':=');var _0x12f880=_0x42ea79[0x0];var _0x25e155=_0x42ea79[_0x15e4('0x7')](0x1);_0x25e155[_0x15e4('0x8')](function(_0x24d3ac){var _0x2a4943=_0x24d3ac[_0x15e4('0x6')]('[')['shift']();var _0x366dbf=_0x24d3ac[_0x15e4('0x9')](/\[(.*?)\]/g);_0x366dbf[_0x15e4('0x8')](function(_0x1be99b){var _0x296fe9=_0x1be99b[_0x15e4('0x6')]('[')[_0x15e4('0xa')](function(_0x5a05e0){return _0x5a05e0[_0x15e4('0xb')](']')>-0x1;})[_0x15e4('0xc')](function(_0x47fdd3){return _0x47fdd3[_0x15e4('0x6')](']')[0x0];})[0x0];_0x51026c['conditions'][_0x15e4('0xd')]({'field':_0x12f880,'operator':_0x2a4943,'value':_0x296fe9});});});}return _0x51026c;};exports[_0x15e4('0xe')]=function(_0x1f8627,_0x4f893a,_0x334760){var _0x478c2e={};if(_0x4f893a==='DATE'){if(_0x334760[_0x15e4('0xf')]===_0x15e4('0x10')){_0x334760[_0x15e4('0xf')]='$between';_0x334760['value']+=','+_0x334760[_0x15e4('0x11')];}else if(_[_0x15e4('0x12')]([_0x15e4('0x13'),'$lte'],_0x334760['operator'])){_0x334760[_0x15e4('0x11')]=moment(_0x334760[_0x15e4('0x11')])[_0x15e4('0x14')](0x1,_0x15e4('0x15'))[_0x15e4('0x16')](_0x15e4('0x17'));}}if(_0x334760[_0x15e4('0x18')]){_0x4f893a=_0x334760[_0x15e4('0x18')];_0x478c2e[_0x15e4('0x19')]='CAST('+_0x1f8627+'.'+_0x334760[_0x15e4('0x1a')]+'\x20AS\x20'+_0x334760[_0x15e4('0x18')]+')\x20'+parseOperator(_0x334760[_0x15e4('0xf')]);}else{_0x478c2e[_0x15e4('0x19')]=_0x1f8627+'.'+_0x334760['field']+'\x20'+parseOperator(_0x334760[_0x15e4('0xf')]);}if(_['includes']([_0x15e4('0x1b'),_0x15e4('0x1c')],_0x334760[_0x15e4('0xf')]))_0x478c2e[_0x15e4('0x19')]='('+_0x478c2e['text']+_0x15e4('0x1d')+_0x1f8627+'.'+_0x334760[_0x15e4('0x1a')]+_0x15e4('0x1e');_0x478c2e[_0x15e4('0x11')]=parseValue(_0x4f893a,_0x334760['operator'],_0x334760[_0x15e4('0x11')]);return _0x478c2e;};function parseOperator(_0x10ab49){var _0x1e21a3;switch(_0x10ab49){case _0x15e4('0x1f'):_0x1e21a3=_0x15e4('0x20');break;case _0x15e4('0x1c'):_0x1e21a3=_0x15e4('0x21');break;case _0x15e4('0x10'):_0x1e21a3='=\x20?';break;case _0x15e4('0x1b'):_0x1e21a3='<>\x20?';break;case _0x15e4('0x22'):case _0x15e4('0x23'):case _0x15e4('0x24'):_0x1e21a3='LIKE\x20?';break;case _0x15e4('0x25'):_0x1e21a3=_0x15e4('0x26');break;case _0x15e4('0x13'):_0x1e21a3=_0x15e4('0x27');break;case _0x15e4('0x28'):_0x1e21a3=_0x15e4('0x29');break;case _0x15e4('0x2a'):_0x1e21a3=_0x15e4('0x2b');break;case _0x15e4('0x2c'):_0x1e21a3=_0x15e4('0x2d');break;}return _0x1e21a3;}function parseValue(_0xa2c391,_0x3df102,_0x3bce40){var _0x4ecea0={'start':undefined,'end':undefined};switch(_0x3df102){case'$in':case _0x15e4('0x1c'):_0x4ecea0[_0x15e4('0x2e')]=_0x3bce40[_0x15e4('0x6')](',');break;case _0x15e4('0x22'):_0x4ecea0[_0x15e4('0x2e')]='%'+_0x3bce40+'%';break;case _0x15e4('0x23'):_0x4ecea0[_0x15e4('0x2e')]=_0x3bce40+'%';break;case'$endsWith':_0x4ecea0['start']='%'+_0x3bce40;break;case'$between':var _0x4d8fd6=_0x3bce40['split'](',');var _0x3bce40=_0x4d8fd6['shift']();var _0x4b0321=_0x4d8fd6['pop']();if(_0xa2c391===_0x15e4('0x2f')){_0x3bce40=moment(_0x3bce40)[_0x15e4('0x30')](0x0,!![])['format']();_0x4b0321=moment(_0x4b0321)[_0x15e4('0x30')](0x0,!![])[_0x15e4('0x14')](0x17,_0x15e4('0x31'))[_0x15e4('0x14')](0x3b,_0x15e4('0x32'))['add'](0x3b,'seconds')[_0x15e4('0x16')]();}_0x4ecea0={'start':_0x3bce40,'end':_0x4b0321};break;default:_0x4ecea0['start']=_0x3bce40;break;}return _0x4ecea0;} \ No newline at end of file +var _0xe8af=['<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$or]','split','length','slice','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','NOT\x20IN\x20?','$eq'];(function(_0x2e18da,_0x50abc5){var _0x412191=function(_0x3f6745){while(--_0x3f6745){_0x2e18da['push'](_0x2e18da['shift']());}};_0x412191(++_0x50abc5);}(_0xe8af,0x181));var _0xfe8a=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0xe8af[_0x5027b1];return _0x4a46cf;};'use strict';var _=require(_0xfe8a('0x0'));var moment=require(_0xfe8a('0x1'));exports[_0xfe8a('0x2')]=function(_0x48ae35){var _0x8db3e6={'conditions':[]};_0x8db3e6[_0xfe8a('0x3')]=_[_0xfe8a('0x4')](_0x48ae35,'[$or]')?'or':'and';var _0x207cbf=_0x48ae35[_0xfe8a('0x5')]('[$and]','')['replace'](_0xfe8a('0x6'),'')[_0xfe8a('0x7')]('||');for(var _0x5e6d2f=0x0;_0x5e6d2f<_0x207cbf[_0xfe8a('0x8')];_0x5e6d2f++){var _0xa0c08b=_0x207cbf[_0x5e6d2f]['split'](':=');var _0x1ead10=_0xa0c08b[0x0];var _0x4d8dd8=_0xa0c08b[_0xfe8a('0x9')](0x1);_0x4d8dd8[_0xfe8a('0xa')](function(_0x2d32e5){var _0xee368e=_0x2d32e5[_0xfe8a('0x7')]('[')['shift']();var _0x256baf=_0x2d32e5[_0xfe8a('0xb')](/\[(.*?)\]/g);_0x256baf['forEach'](function(_0x24aac6){var _0x2ed9b4=_0x24aac6[_0xfe8a('0x7')]('[')[_0xfe8a('0xc')](function(_0x823e22){return _0x823e22[_0xfe8a('0xd')](']')>-0x1;})[_0xfe8a('0xe')](function(_0x15e658){return _0x15e658[_0xfe8a('0x7')](']')[0x0];})[0x0];_0x8db3e6[_0xfe8a('0xf')][_0xfe8a('0x10')]({'field':_0x1ead10,'operator':_0xee368e,'value':_0x2ed9b4});});});}return _0x8db3e6;};exports[_0xfe8a('0x11')]=function(_0x2ad210,_0x142b3c,_0x537972){var _0xcb9b3={};if(_0x142b3c===_0xfe8a('0x12')){if(_0x537972[_0xfe8a('0x13')]==='$eq'){_0x537972['operator']=_0xfe8a('0x14');_0x537972[_0xfe8a('0x15')]+=','+_0x537972['value'];}else if(_[_0xfe8a('0x16')]([_0xfe8a('0x17'),_0xfe8a('0x18')],_0x537972['operator'])){_0x537972['value']=moment(_0x537972[_0xfe8a('0x15')])[_0xfe8a('0x19')](0x1,_0xfe8a('0x1a'))[_0xfe8a('0x1b')](_0xfe8a('0x1c'));}}if(_0x537972[_0xfe8a('0x1d')]){_0x142b3c=_0x537972[_0xfe8a('0x1d')];_0xcb9b3[_0xfe8a('0x1e')]=_0xfe8a('0x1f')+_0x2ad210+'.'+_0x537972[_0xfe8a('0x20')]+_0xfe8a('0x21')+_0x537972[_0xfe8a('0x1d')]+')\x20'+parseOperator(_0x537972[_0xfe8a('0x13')]);}else{_0xcb9b3['text']=_0x2ad210+'.'+_0x537972[_0xfe8a('0x20')]+'\x20'+parseOperator(_0x537972[_0xfe8a('0x13')]);}if(_['includes']([_0xfe8a('0x22'),_0xfe8a('0x23')],_0x537972['operator']))_0xcb9b3[_0xfe8a('0x1e')]='('+_0xcb9b3[_0xfe8a('0x1e')]+'\x20OR\x20'+_0x2ad210+'.'+_0x537972[_0xfe8a('0x20')]+_0xfe8a('0x24');_0xcb9b3[_0xfe8a('0x15')]=parseValue(_0x142b3c,_0x537972['operator'],_0x537972['value']);return _0xcb9b3;};function parseOperator(_0x4659b3){var _0x1ef130;switch(_0x4659b3){case'$in':_0x1ef130='IN\x20?';break;case _0xfe8a('0x23'):_0x1ef130=_0xfe8a('0x25');break;case _0xfe8a('0x26'):_0x1ef130='=\x20?';break;case _0xfe8a('0x22'):_0x1ef130=_0xfe8a('0x27');break;case _0xfe8a('0x28'):case'$startsWith':case _0xfe8a('0x29'):_0x1ef130=_0xfe8a('0x2a');break;case _0xfe8a('0x2b'):_0x1ef130='<\x20?';break;case'$gt':_0x1ef130=_0xfe8a('0x2c');break;case _0xfe8a('0x18'):_0x1ef130=_0xfe8a('0x2d');break;case _0xfe8a('0x2e'):_0x1ef130=_0xfe8a('0x2f');break;case _0xfe8a('0x14'):_0x1ef130=_0xfe8a('0x30');break;}return _0x1ef130;}function parseValue(_0x327d6f,_0x4b5051,_0x4ec0a6){var _0x16aa79={'start':undefined,'end':undefined};switch(_0x4b5051){case'$in':case _0xfe8a('0x23'):_0x16aa79['start']=_0x4ec0a6['split'](',');break;case _0xfe8a('0x28'):_0x16aa79[_0xfe8a('0x31')]='%'+_0x4ec0a6+'%';break;case'$startsWith':_0x16aa79[_0xfe8a('0x31')]=_0x4ec0a6+'%';break;case _0xfe8a('0x29'):_0x16aa79[_0xfe8a('0x31')]='%'+_0x4ec0a6;break;case _0xfe8a('0x14'):var _0x42bb3b=_0x4ec0a6[_0xfe8a('0x7')](',');var _0x4ec0a6=_0x42bb3b['shift']();var _0xe4cb5d=_0x42bb3b['pop']();if(_0x327d6f===_0xfe8a('0x12')){_0x4ec0a6=moment(_0x4ec0a6)[_0xfe8a('0x32')](0x0,!![])[_0xfe8a('0x1b')]();_0xe4cb5d=moment(_0xe4cb5d)[_0xfe8a('0x32')](0x0,!![])[_0xfe8a('0x19')](0x17,_0xfe8a('0x33'))[_0xfe8a('0x19')](0x3b,'minutes')['add'](0x3b,_0xfe8a('0x34'))[_0xfe8a('0x1b')]();}_0x16aa79={'start':_0x4ec0a6,'end':_0xe4cb5d};break;default:_0x16aa79['start']=_0x4ec0a6;break;}return _0x16aa79;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index f49a71f..6947feb 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 _0x7217=['options','lodash','moment','parse','includes','keys','fields','split','filters','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','length','omit','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','join','getOptions','query','$id','intersection','model','attributes','order','where','filter','object','merge','VIRTUAL','lower'];(function(_0x571fba,_0x54ff35){var _0x455fa8=function(_0x51c158){while(--_0x51c158){_0x571fba['push'](_0x571fba['shift']());}};_0x455fa8(++_0x54ff35);}(_0x7217,0x19e));var _0x7721=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7217[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x7721('0x0'));var sequelize=require('sequelize');var moment=require(_0x7721('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4170dd){var _0x1de988=['ne'];try{var _0x2a78d8=JSON[_0x7721('0x2')](_0x4170dd);var _0x4d6446=Object['keys'](_0x2a78d8)[0x0];return _0x1de988[_0x7721('0x3')](_0x4d6446);}catch(_0xce17f9){return![];}}function getOperatorValue(_0x46415c){var _0x3fe47c=JSON[_0x7721('0x2')](_0x46415c);var _0xf7ff37=Object[_0x7721('0x4')](_0x3fe47c)[0x0];var _0x21f680=_0x3fe47c[_0xf7ff37];return{['$'+_0xf7ff37]:_0x21f680};}exports[_0x7721('0x5')]=function(_0x2f99ed){var _0x3e6368=null;if(_0x2f99ed){_0x3e6368=_0x2f99ed[_0x7721('0x6')](',');}return _0x3e6368;};exports[_0x7721('0x7')]=function(_0x138740,_0x2c3986){var _0x578d59={};if(!_[_0x7721('0x8')](_0x138740)){_[_0x7721('0x9')](_0x138740,function(_0x8729a6,_0xf78099){try{if(_0x2c3986){var _0xa8977c=_[_0x7721('0xa')](_0x2c3986,{'name':_0xf78099})||{};if(hasSequelizeOperator(_0x8729a6)){_0x578d59[_0xf78099]=getOperatorValue(_0x8729a6);}else if(_0xa8977c[_0x7721('0xb')]===_0x7721('0xc')&&_['isPlainObject'](_0x8729a6)){var _0x2911ec=JSON[_0x7721('0x2')](_0x8729a6);var _0x57ff6d={'$gte':moment(moment(_0x2911ec[_0x7721('0xd')])[_0x7721('0xe')](_0x7721('0xf')))[_0x7721('0x10')]()['format'](),'$lte':moment(moment(_0x2911ec[_0x7721('0x11')])[_0x7721('0xe')]('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0x7721('0xe')]()};_0x578d59[_0xf78099]=_0x57ff6d;}else if(_0xa8977c[_0x7721('0x12')]===_0x7721('0x13')){_0x578d59[_0xf78099]=_0x8729a6;}else{_0x578d59[_0xf78099]=_[_0x7721('0x14')](_0x8729a6)?_0x8729a6:JSON['parse'](_0x8729a6);}}else{_0x578d59[_0xf78099]=_[_0x7721('0x14')](_0x8729a6)?_0x8729a6:JSON['parse'](_0x8729a6);}}catch(_0x3fc09e){_0x578d59[_0xf78099]=_0x8729a6['split'](',');}});}return _0x578d59;};exports[_0x7721('0x15')]=function(_0x4e96fb){_0x4e96fb=parseInt(_0x4e96fb,0xa);if(!_0x4e96fb||_0x4e96fb<0x0){_0x4e96fb=LIMIT_VALUE;}return _0x4e96fb;};exports[_0x7721('0x16')]=function(_0x3e140d){_0x3e140d=parseInt(_0x3e140d,0xa);if(!_0x3e140d||_0x3e140d<0x0){_0x3e140d=0x0;}return _0x3e140d;};exports[_0x7721('0x17')]=function(_0x40af90){var _0x402820,_0x413263=null;if(_0x40af90){_0x402820=_0x40af90[_0x7721('0x6')](',');_0x413263=_[_0x7721('0x18')](_0x402820,function(_0x4ce1db){if(_0x4ce1db[_0x7721('0x19')]('-')===0x0){return[_0x4ce1db===_0x7721('0x1a')?sequelize[_0x7721('0x1b')](sequelize[_0x7721('0x1c')]('priority'),_0x7721('0x1d')):_0x4ce1db['substr'](0x1),_0x7721('0x1e')];}else{return[_0x4ce1db===_0x7721('0x1a')?sequelize[_0x7721('0x1b')](sequelize[_0x7721('0x1c')](_0x7721('0x1a')),_0x7721('0x1d')):_0x4ce1db,_0x7721('0x1f')];}});}return _0x413263;};exports['omit']=function(_0x216f20,_0x1abedb){if(_[_0x7721('0x8')](_0x216f20)){return _0x216f20;}if(_[_0x7721('0x14')](_0x216f20)){for(var _0x40d550=0x0;_0x40d550<_0x216f20[_0x7721('0x20')];_0x40d550+=0x1){_0x216f20[_0x40d550]=this[_0x7721('0x21')](_0x216f20[_0x40d550],_0x1abedb);}return _0x216f20;}if(!_[_0x7721('0x22')](_0x216f20)){return _0x216f20;}if(_[_0x7721('0x23')](_0x1abedb)){_0x1abedb=[_0x1abedb];}if(!_['isArray'](_0x1abedb)){return _0x216f20;}for(var _0x258ddf=0x0;_0x258ddf<_0x1abedb['length'];_0x258ddf+=0x1){_['unset'](_0x216f20,_0x1abedb[_0x258ddf]);}for(var _0x315202 in _0x216f20){if(_0x216f20[_0x7721('0x24')](_0x315202)){_0x216f20[_0x315202]=this[_0x7721('0x21')](_0x216f20[_0x315202],_0x1abedb);}}return _0x216f20;};exports[_0x7721('0x25')]=function(_0x1ea4d){return _0x1ea4d[_0x7721('0x26')](RegExp(_0x7721('0x27')))?!![]:![];};exports[_0x7721('0x28')]=function(_0x5c54f0){return _0x5c54f0[_0x7721('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x7721('0x29')]=function(_0x497f9f){var _0x4a25c9=[];_0x497f9f[_0x7721('0x6')](/[ ,]+/)[_0x7721('0x2a')](function(_0x48f329){_0x48f329=_0x48f329[_0x7721('0x2b')](/([^:]")"+/g,'$1');_0x48f329='+'+_0x48f329+'*';var _0x4651b5=/[ `!@#$%^&*()_\-?~]/;if(_0x48f329[_0x7721('0x26')](_0x4651b5))_0x48f329='\x22'+_0x48f329+'\x22';_0x4a25c9['push'](_0x48f329);});return _0x4a25c9[_0x7721('0x2c')]('\x20');};exports[_0x7721('0x2d')]=function(_0x1492d4,_0x3f15e2,_0xc0f3c4){var _0x508202={},_0x195ffb={};if(_0x3f15e2[_0x7721('0x2e')][_0x7721('0x2f')]){_0x3f15e2['query']['id']=_0x3f15e2[_0x7721('0x2e')][_0x7721('0x2f')];delete _0x3f15e2['query'][_0x7721('0x2f')];}_0x508202['model']=_[_0x7721('0x18')](_0x1492d4,_0x7721('0x12'));_0x508202[_0x7721('0x2e')]=_[_0x7721('0x4')](_0x3f15e2[_0x7721('0x2e')]);_0x508202[_0x7721('0x7')]=_[_0x7721('0x30')](_0x508202[_0x7721('0x31')],_0x508202[_0x7721('0x2e')]);_0x195ffb[_0x7721('0x32')]=_[_0x7721('0x30')](_0x508202['model'],this[_0x7721('0x5')](_0x3f15e2['query'][_0x7721('0x5')]));_0x195ffb[_0x7721('0x32')]=_0x195ffb[_0x7721('0x32')][_0x7721('0x20')]?_0x195ffb[_0x7721('0x32')]:_0x508202[_0x7721('0x31')];if(!_0x3f15e2['query']['hasOwnProperty']('nolimit')){_0x195ffb['limit']=this[_0x7721('0x15')](_0x3f15e2[_0x7721('0x2e')][_0x7721('0x15')]);_0x195ffb[_0x7721('0x16')]=this['offset'](_0x3f15e2[_0x7721('0x2e')]['offset']);}_0x195ffb[_0x7721('0x33')]=this[_0x7721('0x17')](_0x3f15e2['query'][_0x7721('0x17')]);_0x195ffb[_0x7721('0x34')]=this['filters'](_['pick'](_0x3f15e2[_0x7721('0x2e')],_0x508202[_0x7721('0x7')]),_0x1492d4);if(_0x3f15e2[_0x7721('0x2e')][_0x7721('0x35')]){var _0x577af9=_0x1492d4;var _0x2db173=_0x3f15e2[_0x7721('0x2e')][_0x7721('0x35')];if(typeof _0x2db173===_0x7721('0x36')){_0x577af9=_[_0x7721('0x35')](_0x1492d4,function(_0x52ab67){return _[_0x7721('0x3')](_0x2db173['columns'],_0x52ab67[_0x7721('0x12')]);});_0x2db173=_0x2db173['value'];}_0x195ffb[_0x7721('0x34')]=_[_0x7721('0x37')](_0x195ffb[_0x7721('0x34')],{'$or':_['map'](_0x577af9,function(_0x1453d4){if(_0x1453d4[_0x7721('0xb')]!==_0x7721('0x38')){if(_0xc0f3c4){return sequelize['where'](sequelize['fn'](_0x7721('0x39'),sequelize[_0x7721('0x1c')](_0x1453d4[_0x7721('0x12')])),{'$like':sequelize['fn'](_0x7721('0x39'),'%'+_0x3f15e2[_0x7721('0x2e')][_0x7721('0x35')]+'%')});}else{var _0x463ccc={};_0x463ccc[_0x1453d4['name']]={'$like':'%'+_0x3f15e2['query'][_0x7721('0x35')]+'%'};return _0x463ccc;}}})});}_0x195ffb=_[_0x7721('0x37')]({},_0x195ffb,_0x3f15e2[_0x7721('0x3a')]);return _0x195ffb;}; \ No newline at end of file +var _0x5fd1=['$lte','YYYY-MM-DD','subtract','isArray','split','limit','offset','sort','map','indexOf','priority','unsigned','substr','DESC','cast','col','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','push','getOptions','$id','query','model','name','intersection','attributes','nolimit','order','where','filter','object','columns','value','merge','VIRTUAL','lower','lodash','moment','keys','includes','parse','fields','filters','find','type','DATE','isPlainObject','utc','format'];(function(_0x160693,_0xbad5fb){var _0x5be30d=function(_0x2e60bb){while(--_0x2e60bb){_0x160693['push'](_0x160693['shift']());}};_0x5be30d(++_0xbad5fb);}(_0x5fd1,0x155));var _0x15fd=function(_0x3a07b9,_0x465ffe){_0x3a07b9=_0x3a07b9-0x0;var _0xb395e3=_0x5fd1[_0x3a07b9];return _0xb395e3;};'use strict';var _=require(_0x15fd('0x0'));var sequelize=require('sequelize');var moment=require(_0x15fd('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x570048){var _0x45bd54=['ne'];try{var _0x50fc5a=JSON['parse'](_0x570048);var _0x370d34=Object[_0x15fd('0x2')](_0x50fc5a)[0x0];return _0x45bd54[_0x15fd('0x3')](_0x370d34);}catch(_0x5e1d7e){return![];}}function getOperatorValue(_0x1e3b97){var _0x386441=JSON[_0x15fd('0x4')](_0x1e3b97);var _0x2e88bf=Object[_0x15fd('0x2')](_0x386441)[0x0];var _0x534e63=_0x386441[_0x2e88bf];return{['$'+_0x2e88bf]:_0x534e63};}exports[_0x15fd('0x5')]=function(_0x1ee117){var _0x19806f=null;if(_0x1ee117){_0x19806f=_0x1ee117['split'](',');}return _0x19806f;};exports[_0x15fd('0x6')]=function(_0x5c9c63,_0x3dfdbb){var _0x250457={};if(!_['isEmpty'](_0x5c9c63)){_['forOwn'](_0x5c9c63,function(_0x4ebde5,_0x3dd2af){try{if(_0x3dfdbb){var _0x2a4d55=_[_0x15fd('0x7')](_0x3dfdbb,{'name':_0x3dd2af})||{};if(hasSequelizeOperator(_0x4ebde5)){_0x250457[_0x3dd2af]=getOperatorValue(_0x4ebde5);}else if(_0x2a4d55[_0x15fd('0x8')]===_0x15fd('0x9')&&_[_0x15fd('0xa')](_0x4ebde5)){var _0x346ab1=JSON[_0x15fd('0x4')](_0x4ebde5);var _0x459fa4={'$gte':moment(moment(_0x346ab1['$gte'])['format']('YYYY-MM-DD'))[_0x15fd('0xb')]()[_0x15fd('0xc')](),'$lte':moment(moment(_0x346ab1[_0x15fd('0xd')])[_0x15fd('0xc')](_0x15fd('0xe')))[_0x15fd('0xb')]()[_0x15fd('0xf')](0x1,'s')[_0x15fd('0xc')]()};_0x250457[_0x3dd2af]=_0x459fa4;}else if(_0x2a4d55['name']==='uniqueid'){_0x250457[_0x3dd2af]=_0x4ebde5;}else{_0x250457[_0x3dd2af]=_[_0x15fd('0x10')](_0x4ebde5)?_0x4ebde5:JSON['parse'](_0x4ebde5);}}else{_0x250457[_0x3dd2af]=_[_0x15fd('0x10')](_0x4ebde5)?_0x4ebde5:JSON['parse'](_0x4ebde5);}}catch(_0x917fe4){_0x250457[_0x3dd2af]=_0x4ebde5[_0x15fd('0x11')](',');}});}return _0x250457;};exports[_0x15fd('0x12')]=function(_0x49ceac){_0x49ceac=parseInt(_0x49ceac,0xa);if(!_0x49ceac||_0x49ceac<0x0){_0x49ceac=LIMIT_VALUE;}return _0x49ceac;};exports[_0x15fd('0x13')]=function(_0x2ad0de){_0x2ad0de=parseInt(_0x2ad0de,0xa);if(!_0x2ad0de||_0x2ad0de<0x0){_0x2ad0de=0x0;}return _0x2ad0de;};exports[_0x15fd('0x14')]=function(_0x229f8a){var _0x2fb919,_0x36a90e=null;if(_0x229f8a){_0x2fb919=_0x229f8a[_0x15fd('0x11')](',');_0x36a90e=_[_0x15fd('0x15')](_0x2fb919,function(_0x1b8b9f){if(_0x1b8b9f[_0x15fd('0x16')]('-')===0x0){return[_0x1b8b9f===_0x15fd('0x17')?sequelize['cast'](sequelize['col'](_0x15fd('0x17')),_0x15fd('0x18')):_0x1b8b9f[_0x15fd('0x19')](0x1),_0x15fd('0x1a')];}else{return[_0x1b8b9f===_0x15fd('0x17')?sequelize[_0x15fd('0x1b')](sequelize[_0x15fd('0x1c')]('priority'),_0x15fd('0x18')):_0x1b8b9f,_0x15fd('0x1d')];}});}return _0x36a90e;};exports[_0x15fd('0x1e')]=function(_0x5c7aa9,_0x27528f){if(_['isEmpty'](_0x5c7aa9)){return _0x5c7aa9;}if(_[_0x15fd('0x10')](_0x5c7aa9)){for(var _0x1fc24f=0x0;_0x1fc24f<_0x5c7aa9[_0x15fd('0x1f')];_0x1fc24f+=0x1){_0x5c7aa9[_0x1fc24f]=this['omit'](_0x5c7aa9[_0x1fc24f],_0x27528f);}return _0x5c7aa9;}if(!_[_0x15fd('0x20')](_0x5c7aa9)){return _0x5c7aa9;}if(_[_0x15fd('0x21')](_0x27528f)){_0x27528f=[_0x27528f];}if(!_[_0x15fd('0x10')](_0x27528f)){return _0x5c7aa9;}for(var _0x5d4789=0x0;_0x5d4789<_0x27528f[_0x15fd('0x1f')];_0x5d4789+=0x1){_['unset'](_0x5c7aa9,_0x27528f[_0x5d4789]);}for(var _0x3d33cd in _0x5c7aa9){if(_0x5c7aa9[_0x15fd('0x22')](_0x3d33cd)){_0x5c7aa9[_0x3d33cd]=this[_0x15fd('0x1e')](_0x5c7aa9[_0x3d33cd],_0x27528f);}}return _0x5c7aa9;};exports[_0x15fd('0x23')]=function(_0x233ed3){return _0x233ed3[_0x15fd('0x24')](RegExp(_0x15fd('0x25')))?!![]:![];};exports[_0x15fd('0x26')]=function(_0x4590a1){return _0x4590a1[_0x15fd('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x15fd('0x27')]=function(_0x5ca676){var _0x47c22c=[];_0x5ca676[_0x15fd('0x11')](/[ ,]+/)['forEach'](function(_0x39e744){_0x39e744=_0x39e744[_0x15fd('0x28')](/([^:]")"+/g,'$1');_0x39e744='+'+_0x39e744+'*';var _0x5f406a=/[ `!@#$%^&*()_\-?~]/;if(_0x39e744[_0x15fd('0x24')](_0x5f406a))_0x39e744='\x22'+_0x39e744+'\x22';_0x47c22c[_0x15fd('0x29')](_0x39e744);});return _0x47c22c['join']('\x20');};exports[_0x15fd('0x2a')]=function(_0x199647,_0x582af2,_0x476828){var _0x42edc3={},_0x1a36d6={};if(_0x582af2['query'][_0x15fd('0x2b')]){_0x582af2[_0x15fd('0x2c')]['id']=_0x582af2[_0x15fd('0x2c')][_0x15fd('0x2b')];delete _0x582af2['query'][_0x15fd('0x2b')];}_0x42edc3[_0x15fd('0x2d')]=_[_0x15fd('0x15')](_0x199647,_0x15fd('0x2e'));_0x42edc3[_0x15fd('0x2c')]=_[_0x15fd('0x2')](_0x582af2['query']);_0x42edc3[_0x15fd('0x6')]=_[_0x15fd('0x2f')](_0x42edc3['model'],_0x42edc3[_0x15fd('0x2c')]);_0x1a36d6[_0x15fd('0x30')]=_[_0x15fd('0x2f')](_0x42edc3['model'],this[_0x15fd('0x5')](_0x582af2[_0x15fd('0x2c')][_0x15fd('0x5')]));_0x1a36d6[_0x15fd('0x30')]=_0x1a36d6[_0x15fd('0x30')][_0x15fd('0x1f')]?_0x1a36d6['attributes']:_0x42edc3['model'];if(!_0x582af2['query'][_0x15fd('0x22')](_0x15fd('0x31'))){_0x1a36d6[_0x15fd('0x12')]=this['limit'](_0x582af2['query'][_0x15fd('0x12')]);_0x1a36d6['offset']=this['offset'](_0x582af2['query'][_0x15fd('0x13')]);}_0x1a36d6[_0x15fd('0x32')]=this[_0x15fd('0x14')](_0x582af2['query'][_0x15fd('0x14')]);_0x1a36d6[_0x15fd('0x33')]=this[_0x15fd('0x6')](_['pick'](_0x582af2[_0x15fd('0x2c')],_0x42edc3[_0x15fd('0x6')]),_0x199647);if(_0x582af2[_0x15fd('0x2c')][_0x15fd('0x34')]){var _0x2e8b0a=_0x199647;var _0x46b8f4=_0x582af2[_0x15fd('0x2c')][_0x15fd('0x34')];if(typeof _0x46b8f4===_0x15fd('0x35')){_0x2e8b0a=_['filter'](_0x199647,function(_0x41eee0){return _[_0x15fd('0x3')](_0x46b8f4[_0x15fd('0x36')],_0x41eee0[_0x15fd('0x2e')]);});_0x46b8f4=_0x46b8f4[_0x15fd('0x37')];}_0x1a36d6[_0x15fd('0x33')]=_[_0x15fd('0x38')](_0x1a36d6[_0x15fd('0x33')],{'$or':_[_0x15fd('0x15')](_0x2e8b0a,function(_0x104eef){if(_0x104eef[_0x15fd('0x8')]!==_0x15fd('0x39')){if(_0x476828){return sequelize[_0x15fd('0x33')](sequelize['fn'](_0x15fd('0x3a'),sequelize[_0x15fd('0x1c')](_0x104eef['name'])),{'$like':sequelize['fn'](_0x15fd('0x3a'),'%'+_0x582af2[_0x15fd('0x2c')][_0x15fd('0x34')]+'%')});}else{var _0x37c43e={};_0x37c43e[_0x104eef[_0x15fd('0x2e')]]={'$like':'%'+_0x582af2[_0x15fd('0x2c')][_0x15fd('0x34')]+'%'};return _0x37c43e;}}})});}_0x1a36d6=_[_0x15fd('0x38')]({},_0x1a36d6,_0x582af2['options']);return _0x1a36d6;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 75802ed..2ba74c3 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(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x20b1a7,_0x2f2ece){var _0x4d3a1a=function(_0x8c7c46){while(--_0x8c7c46){_0x20b1a7['push'](_0x20b1a7['shift']());}};_0x4d3a1a(++_0x2f2ece);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 3558cc4..7858c2f 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 _0xb0e9=['ipAddress','createHash','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','update','digest','hex','getUuid','platform','licenseToken','test','replace','hostname','macAddress'];(function(_0x26d0cf,_0x58e972){var _0x50da3e=function(_0xda84ea){while(--_0xda84ea){_0x26d0cf['push'](_0x26d0cf['shift']());}};_0x50da3e(++_0x58e972);}(_0xb0e9,0x162));var _0x9b0e=function(_0x48478f,_0x537acd){_0x48478f=_0x48478f-0x0;var _0x10af50=_0xb0e9[_0x48478f];return _0x10af50;};'use strict';var _=require(_0x9b0e('0x0'));var os=require('os');var crypto=require(_0x9b0e('0x1'));var machine=require(_0x9b0e('0x2'));var exec=require(_0x9b0e('0x3'))[_0x9b0e('0x4')];var config=require(_0x9b0e('0x5'));function getInterfaces(){var _0x31c79a=[];var _0x24ce82=os[_0x9b0e('0x6')]();var _0x3c2e46=_['orderBy'](_[_0x9b0e('0x7')](_0x24ce82));for(var _0x38cbce=0x0;_0x38cbce<_0x3c2e46[_0x9b0e('0x8')];_0x38cbce++){var _0x5d0050=_0x24ce82[_0x3c2e46[_0x38cbce]]['filter'](function(_0x34f591){return _0x34f591[_0x9b0e('0x9')]===_0x9b0e('0xa')&&_0x34f591[_0x9b0e('0xb')]===![];});_0x31c79a=_0x31c79a[_0x9b0e('0xc')](_0x5d0050);}return _0x31c79a;}function getFirstInterface(){var _0x467f0a=_[_0x9b0e('0xd')](getInterfaces());return{'macAddress':_0x467f0a&&_0x467f0a[_0x9b0e('0xe')]?_0x467f0a[_0x9b0e('0xe')]:_0x9b0e('0xf'),'ipAddress':_0x467f0a&&_0x467f0a[_0x9b0e('0x10')]?_0x467f0a['address']:'127.0.0.1'};}exports[_0x9b0e('0x11')]=getFirstInterface;function getCPUhash(){var _0x344b3f=_[_0x9b0e('0x12')](os[_0x9b0e('0x13')]()[_0x9b0e('0x14')](function(_0x5a308a){return _0x5a308a['model'];}))['join'](':');return crypto['createHash']('md5')[_0x9b0e('0x15')](_0x344b3f)[_0x9b0e('0x16')](_0x9b0e('0x17'));}exports[_0x9b0e('0x18')]=function(){var _0x129c2c=os[_0x9b0e('0x19')]();var _0xf7d251=/[0-9a-f-]{36}/;if(config[_0x9b0e('0x1a')]&&_0xf7d251[_0x9b0e('0x1b')](config[_0x9b0e('0x1a')])){return config['licenseToken'];}else if(_0x129c2c==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x9b0e('0x1c')]('\x0d\x0a','');}else{var _0x4a3f4e=getFirstInterface();var _0x3d85d4=getCPUhash();var _0x321ead=_0x3d85d4+'|'+os[_0x9b0e('0x1d')]()+'|'+_0x4a3f4e[_0x9b0e('0x1e')]+'|'+_0x4a3f4e[_0x9b0e('0x1f')];var _0x449ea3=crypto[_0x9b0e('0x20')](_0x9b0e('0x21'))[_0x9b0e('0x15')](_0x321ead)[_0x9b0e('0x16')](_0x9b0e('0x17'));return _0x449ea3[_0x9b0e('0x22')](0x0,0x8)+'-'+_0x449ea3[_0x9b0e('0x22')](0x8,0xc)+'-'+_0x449ea3['substring'](0xc,0x10)+'-'+_0x449ea3[_0x9b0e('0x22')](0x10,0x14)+'-'+_0x449ea3[_0x9b0e('0x22')](0x14);}}; \ No newline at end of file +var _0x4d40=['hostname','macAddress','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x344f35,_0xb9b8ce){var _0x241f0e=function(_0xcc379c){while(--_0xcc379c){_0x344f35['push'](_0x344f35['shift']());}};_0x241f0e(++_0xb9b8ce);}(_0x4d40,0xb9));var _0x04d4=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x4d40[_0x1d7300];return _0x46ee98;};'use strict';var _=require(_0x04d4('0x0'));var os=require('os');var crypto=require(_0x04d4('0x1'));var machine=require(_0x04d4('0x2'));var exec=require(_0x04d4('0x3'))[_0x04d4('0x4')];var config=require(_0x04d4('0x5'));function getInterfaces(){var _0x159ca6=[];var _0xf4d422=os[_0x04d4('0x6')]();var _0x5eb299=_[_0x04d4('0x7')](_[_0x04d4('0x8')](_0xf4d422));for(var _0x5242bc=0x0;_0x5242bc<_0x5eb299[_0x04d4('0x9')];_0x5242bc++){var _0xc1b32a=_0xf4d422[_0x5eb299[_0x5242bc]]['filter'](function(_0x455b15){return _0x455b15['family']===_0x04d4('0xa')&&_0x455b15['internal']===![];});_0x159ca6=_0x159ca6[_0x04d4('0xb')](_0xc1b32a);}return _0x159ca6;}function getFirstInterface(){var _0x24b7f1=_[_0x04d4('0xc')](getInterfaces());return{'macAddress':_0x24b7f1&&_0x24b7f1['mac']?_0x24b7f1[_0x04d4('0xd')]:_0x04d4('0xe'),'ipAddress':_0x24b7f1&&_0x24b7f1[_0x04d4('0xf')]?_0x24b7f1[_0x04d4('0xf')]:_0x04d4('0x10')};}exports[_0x04d4('0x11')]=getFirstInterface;function getCPUhash(){var _0x2b57bc=_[_0x04d4('0x7')](os[_0x04d4('0x12')]()[_0x04d4('0x13')](function(_0x3b3c50){return _0x3b3c50[_0x04d4('0x14')];}))['join'](':');return crypto[_0x04d4('0x15')](_0x04d4('0x16'))[_0x04d4('0x17')](_0x2b57bc)['digest'](_0x04d4('0x18'));}exports[_0x04d4('0x19')]=function(){var _0x5affe0=os['platform']();var _0x3226ad=/[0-9a-f-]{36}/;if(config[_0x04d4('0x1a')]&&_0x3226ad[_0x04d4('0x1b')](config[_0x04d4('0x1a')])){return config[_0x04d4('0x1a')];}else if(_0x5affe0===_0x04d4('0x1c')){return exec(_0x04d4('0x1d'),{'encoding':_0x04d4('0x1e')})['replace']('\x0d\x0a','');}else{var _0xa64b4e=getFirstInterface();var _0x35ae3c=getCPUhash();var _0xb7aabe=_0x35ae3c+'|'+os[_0x04d4('0x1f')]()+'|'+_0xa64b4e[_0x04d4('0x20')]+'|'+_0xa64b4e[_0x04d4('0x21')];var _0x4d1658=crypto[_0x04d4('0x15')](_0x04d4('0x16'))['update'](_0xb7aabe)[_0x04d4('0x22')]('hex');return _0x4d1658[_0x04d4('0x23')](0x0,0x8)+'-'+_0x4d1658['substring'](0x8,0xc)+'-'+_0x4d1658[_0x04d4('0x23')](0xc,0x10)+'-'+_0x4d1658['substring'](0x10,0x14)+'-'+_0x4d1658['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 034374d..89895a6 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 _0x0680=['error','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','finally','getUuid','License','spread'];(function(_0x5b8455,_0x29f705){var _0x118787=function(_0x4bdaa0){while(--_0x4bdaa0){_0x5b8455['push'](_0x5b8455['shift']());}};_0x118787(++_0x29f705);}(_0x0680,0x7e));var _0x0068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0680[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0068('0x0'));var moment=require(_0x0068('0x1'));var rp=require(_0x0068('0x2'));var BPromise=require(_0x0068('0x3'));var pkginfo=require(_0x0068('0x4'))(module,_0x0068('0x5'));var db=require(_0x0068('0x6'))['db'];var encryptor=require(_0x0068('0x7'));var hardware=require(_0x0068('0x8'));var logger=require(_0x0068('0x9'))(_0x0068('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x46dcb7){return new BPromise(function(_0x295123,_0xbee57e){var _0x24e0b0=util['format'](_0x0068('0xb'),HOST,_0x46dcb7,module[_0x0068('0xc')][_0x0068('0x5')]);if(oldToken){_0x24e0b0=util[_0x0068('0xd')](_0x0068('0xe'),HOST,_0x46dcb7,module['exports'][_0x0068('0x5')],oldToken);}var _0x44aec1={'uri':_0x24e0b0,'method':_0x0068('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x44aec1)['then'](function(_0x57de77){_0x295123(_0x57de77);})['catch'](function(_0x2e4f79){_0xbee57e(_0x2e4f79);});});}function manageLicense(_0x3d350e,_0x9da587){var _0x4cf02d=_0x9da587[_0x0068('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x4cf02d[_0x0068('0x11')]!==_0x3d350e&&!_0x4cf02d[_0x0068('0x12')]){oldToken=_0x4cf02d['data1'];}httpRequest(_0x3d350e)[_0x0068('0x13')](function(_0x553772){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x553772[_0x0068('0x14')]){isOldTokenSent=![];if(!_0x4cf02d[_0x0068('0xa')]&&_0x4cf02d[_0x0068('0xa')]!=_0x553772['license']||_0x4cf02d['license']&&_0x4cf02d[_0x0068('0x12')]){logger[_0x0068('0x15')](_0x0068('0x16'));}if(_0x4cf02d[_0x0068('0xa')]&&!_0x4cf02d[_0x0068('0x12')]&&_0x4cf02d[_0x0068('0xa')]!=_0x553772['license']){logger[_0x0068('0x15')](_0x0068('0x17'));}if(_0x4cf02d[_0x0068('0xa')]&&!_0x4cf02d[_0x0068('0x12')]&&_0x4cf02d[_0x0068('0xa')]==_0x553772[_0x0068('0xa')]){return _0x9da587;}return _0x9da587[_0x0068('0x18')]({'data1':_0x3d350e,'data2':null,'license':_0x553772[_0x0068('0xa')]});}else{if(_0x553772[_0x0068('0xa')]||_0x4cf02d[_0x0068('0xa')]){if(!_0x4cf02d[_0x0068('0x12')]){if(_0x4cf02d[_0x0068('0x11')]==_0x3d350e){GRAY_PERIOD_REASON=_0x0068('0x19');logger[_0x0068('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x0068('0x1a');logger[_0x0068('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4cf02d['data1'],_0x3d350e);}logger[_0x0068('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x0068('0x1b')](),moment()['format'](_0x0068('0x1c')));return _0x9da587[_0x0068('0x18')]({'data2':encryptor['encryptString'](moment()[_0x0068('0xd')](_0x0068('0x1c')))});}else{if(moment()[_0x0068('0x1d')](encryptor[_0x0068('0x1e')](_0x4cf02d['data2']),_0x0068('0x1f'))>DAYS){logger[_0x0068('0x15')](_0x0068('0x20'),moment()[_0x0068('0xd')](_0x0068('0x1c')));isOldTokenSent=![];return _0x9da587[_0x0068('0x18')]({'data1':_0x3d350e,'data2':null,'license':null});}}}else{if(_0x4cf02d[_0x0068('0x11')]!=_0x3d350e){logger[_0x0068('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4cf02d['data1'],_0x3d350e);return _0x9da587[_0x0068('0x18')]({'data1':_0x3d350e,'data2':null,'license':null});}}}return _0x9da587;})[_0x0068('0x13')](function(_0x3ad880){_0x9da587=_0x3ad880;})[_0x0068('0x21')](function(_0x39d57a){logger['error'](_0x39d57a['message']);})[_0x0068('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x0068('0x23')](),_0x9da587);},TIME);});}function defaultLicense(){var _0x1ba651=hardware[_0x0068('0x23')]();if(_0x1ba651){return db[_0x0068('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x1ba651}})[_0x0068('0x25')](function(_0x1fe149,_0x30c9c6){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1ba651);manageLicense(_0x1ba651,_0x1fe149);})[_0x0068('0x21')](function(_0x512c5a){logger[_0x0068('0x26')](_0x512c5a[_0x0068('0x27')]);});}}exports[_0x0068('0x28')]=defaultLicense; \ No newline at end of file +var _0xbf84=['%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','diff','days','YYYY-MM-DD\x20HH:mm','error','message','finally','getUuid','findOrCreate','spread','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com'];(function(_0x8877af,_0x41c17b){var _0x4b5ece=function(_0x228ba8){while(--_0x228ba8){_0x8877af['push'](_0x8877af['shift']());}};_0x4b5ece(++_0x41c17b);}(_0xbf84,0x13e));var _0x4bf8=function(_0x3cba7d,_0x3862c5){_0x3cba7d=_0x3cba7d-0x0;var _0x373d3e=_0xbf84[_0x3cba7d];return _0x373d3e;};'use strict';var util=require(_0x4bf8('0x0'));var moment=require(_0x4bf8('0x1'));var rp=require('request-promise');var BPromise=require(_0x4bf8('0x2'));var pkginfo=require(_0x4bf8('0x3'))(module,_0x4bf8('0x4'));var db=require(_0x4bf8('0x5'))['db'];var encryptor=require(_0x4bf8('0x6'));var hardware=require('./hardware');var logger=require(_0x4bf8('0x7'))(_0x4bf8('0x8'));var HOST=_0x4bf8('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xd356c4){return new BPromise(function(_0x5eadcb,_0x323865){var _0x4a2e9f=util['format'](_0x4bf8('0xa'),HOST,_0xd356c4,module[_0x4bf8('0xb')]['version']);if(oldToken){_0x4a2e9f=util[_0x4bf8('0xc')](_0x4bf8('0xd'),HOST,_0xd356c4,module[_0x4bf8('0xb')][_0x4bf8('0x4')],oldToken);}var _0x351eae={'uri':_0x4a2e9f,'method':_0x4bf8('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x351eae)[_0x4bf8('0xf')](function(_0x817d13){_0x5eadcb(_0x817d13);})[_0x4bf8('0x10')](function(_0x1ca2a3){_0x323865(_0x1ca2a3);});});}function manageLicense(_0x298408,_0x15e4b0){var _0x408ffa=_0x15e4b0[_0x4bf8('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x408ffa[_0x4bf8('0x12')]!==_0x298408&&!_0x408ffa[_0x4bf8('0x13')]){oldToken=_0x408ffa[_0x4bf8('0x12')];}httpRequest(_0x298408)[_0x4bf8('0xf')](function(_0x255cc9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x255cc9[_0x4bf8('0x14')]){isOldTokenSent=![];if(!_0x408ffa[_0x4bf8('0x8')]&&_0x408ffa[_0x4bf8('0x8')]!=_0x255cc9['license']||_0x408ffa[_0x4bf8('0x8')]&&_0x408ffa['data2']){logger['info'](_0x4bf8('0x15'));}if(_0x408ffa['license']&&!_0x408ffa['data2']&&_0x408ffa['license']!=_0x255cc9[_0x4bf8('0x8')]){logger[_0x4bf8('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x408ffa['license']&&!_0x408ffa[_0x4bf8('0x13')]&&_0x408ffa[_0x4bf8('0x8')]==_0x255cc9[_0x4bf8('0x8')]){return _0x15e4b0;}return _0x15e4b0[_0x4bf8('0x17')]({'data1':_0x298408,'data2':null,'license':_0x255cc9['license']});}else{if(_0x255cc9[_0x4bf8('0x8')]||_0x408ffa[_0x4bf8('0x8')]){if(!_0x408ffa[_0x4bf8('0x13')]){if(_0x408ffa[_0x4bf8('0x12')]==_0x298408){GRAY_PERIOD_REASON=_0x4bf8('0x18');logger['info'](_0x4bf8('0x19'));}else{GRAY_PERIOD_REASON=_0x4bf8('0x1a');logger[_0x4bf8('0x16')](_0x4bf8('0x1b'),_0x408ffa['data1'],_0x298408);}logger[_0x4bf8('0x16')](_0x4bf8('0x1c'),GRAY_PERIOD_REASON[_0x4bf8('0x1d')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x15e4b0['update']({'data2':encryptor[_0x4bf8('0x1e')](moment()[_0x4bf8('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x4bf8('0x1f')](encryptor['decryptString'](_0x408ffa[_0x4bf8('0x13')]),_0x4bf8('0x20'))>DAYS){logger[_0x4bf8('0x16')]('DEMO\x20START\x20AT\x20%s',moment()[_0x4bf8('0xc')](_0x4bf8('0x21')));isOldTokenSent=![];return _0x15e4b0['update']({'data1':_0x298408,'data2':null,'license':null});}}}else{if(_0x408ffa['data1']!=_0x298408){logger[_0x4bf8('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x408ffa[_0x4bf8('0x12')],_0x298408);return _0x15e4b0[_0x4bf8('0x17')]({'data1':_0x298408,'data2':null,'license':null});}}}return _0x15e4b0;})[_0x4bf8('0xf')](function(_0x53d748){_0x15e4b0=_0x53d748;})[_0x4bf8('0x10')](function(_0x20bceb){logger[_0x4bf8('0x22')](_0x20bceb[_0x4bf8('0x23')]);})[_0x4bf8('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x4bf8('0x25')](),_0x15e4b0);},TIME);});}function defaultLicense(){var _0x131103=hardware[_0x4bf8('0x25')]();if(_0x131103){return db['License'][_0x4bf8('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x131103}})[_0x4bf8('0x27')](function(_0x2f3dad,_0x4a4bba){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x131103);manageLicense(_0x131103,_0x2f3dad);})[_0x4bf8('0x10')](function(_0x2968ef){logger['error'](_0x2968ef['message']);});}}exports[_0x4bf8('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6a869ee..159fb3d 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 _0x3813=['grayReason','changed','disabled','message','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','isEmpty','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','days'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x3813,0x9a));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x3381('0x0'));var _=require('lodash');var moment=require(_0x3381('0x1'));var BPromise=require('bluebird');var hardware=require(_0x3381('0x2'));var encryptor=require(_0x3381('0x3'));var db=require(_0x3381('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3381('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3381('0x6'),'machineUuid':hardware[_0x3381('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3381('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3381('0x8'),'machineUuid':hardware[_0x3381('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x14443f){return new BPromise(function(_0x10dcd4,_0x28ba19){return db['License'][_0x3381('0x9')](_[_0x3381('0xa')](_0x14443f,{'raw':!![],'where':{'id':0x1}}))[_0x3381('0xb')](function(_0x416f12){return checkLicense(_0x416f12,null);})[_0x3381('0xb')](function(_0x4e62a9){_0x10dcd4(_0x4e62a9);return;})[_0x3381('0xc')](function(_0x3b9244){_0x28ba19(_0x3b9244);});});}function checkLicense(_0x37dbd9,_0xa2c7cb){if(!_0x37dbd9){demoLicense[_0x3381('0xd')]=_0x37dbd9['data1'];return demoLicense;}try{var _0xb9564e=_0xa2c7cb||_0x37dbd9['license'];if(_[_0x3381('0xe')](_0xb9564e)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x42badb=_0x37dbd9['data1'];var _0x1a7557=_0x37dbd9[_0x3381('0xf')];var _0x37990b=_0x42badb['split']('-')[0x4];var _0x4d5943=_0x42badb[_0x3381('0x10')]('-')[0x0];var _0x3a7cdc=encryptor[_0x3381('0x11')](_0xb9564e,util[_0x3381('0x12')](_0x3381('0x13'),_0x37990b,_0x42badb,_0x4d5943));var _0x12e41e=JSON['parse'](_0x3a7cdc);_0x12e41e[_0x3381('0x14')]=![];_0x12e41e[_0x3381('0xd')]=_0x42badb;_0x12e41e[_0x3381('0x15')]=hardware[_0x3381('0x7')]();if(_0x1a7557){var _0x4e16a5=encryptor[_0x3381('0x11')](_0x1a7557);_0x12e41e[_0x3381('0x16')]=_0x4e16a5;_0x12e41e[_0x3381('0x17')]=moment(_0x4e16a5)[_0x3381('0x18')](0x7,_0x3381('0x19'))[_0x3381('0x12')]();_0x12e41e[_0x3381('0x1a')]=_0x12e41e[_0x3381('0xd')]!=_0x12e41e[_0x3381('0x15')]?_0x3381('0x1b'):_0x3381('0x1c');}return _0x12e41e;}catch(_0x57bd9f){breakingLicense[_0x3381('0xd')]=_0x37dbd9['data1'];breakingLicense[_0x3381('0x1d')]=_0x57bd9f[_0x3381('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x32295c,_0x5a4d95){getLicense()['then'](function(_0x7cfcb8){return db['User'][_0x3381('0x1e')]({'attributes':[_0x3381('0x1f'),[db[_0x3381('0x20')]['fn'](_0x3381('0x21'),db[_0x3381('0x20')][_0x3381('0x22')](_0x3381('0x1f'))),_0x3381('0x23')]],'group':_0x3381('0x1f'),'where':{'role':{'$or':[_0x3381('0x24'),_0x3381('0x25'),_0x3381('0x26')]}},'raw':!![]})[_0x3381('0xb')](function(_0x5a9dc5){var _0x28f0ff={'user':_0x7cfcb8['users']||0x0,'telephone':_0x7cfcb8['telephones']||0x0};_0x5a9dc5[_0x3381('0x27')](function(_0x2b64c4){var _0x1ec4ab=_0x2b64c4[_0x3381('0x1f')]==='admin'?'user':_0x2b64c4[_0x3381('0x1f')];_0x28f0ff[_0x1ec4ab]-=_0x2b64c4[_0x3381('0x23')];if(_0x28f0ff[_0x1ec4ab]<0x0)_0x28f0ff[_0x1ec4ab]=0x0;});_0x32295c(_0x28f0ff);return;});})[_0x3381('0xc')](function(_0x35a77e){_0x5a4d95(_0x35a77e);});});}function checkUserLimits(_0x54f8f4){return new BPromise(function(_0xd0fd4e,_0x1cfb42){getLimits()['then'](function(_0x1ce379){var _0x2e7576=_[_0x3381('0x28')](_[_0x3381('0x29')](_0x54f8f4,_0x3381('0x1f')),[_0x3381('0x24'),'user',_0x3381('0x26')]);var _0x59d199=(_0x2e7576[_0x3381('0x24')]||0x0)+(_0x2e7576[_0x3381('0x25')]||0x0);var _0x3c985c=_0x2e7576[_0x3381('0x26')]||0x0;if(_0x59d199>_0x1ce379[_0x3381('0x25')])return _0x1cfb42(_0x3381('0x2a'));if(_0x3c985c>_0x1ce379['telephone'])return _0x1cfb42(_0x3381('0x2b'));return _0xd0fd4e();})[_0x3381('0xc')](function(_0x592cf8){_0x1cfb42(_0x592cf8);});});}module[_0x3381('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x690c=['data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','uuid','gray','deadline','days','grayReason','changed','disabled','message','User','findAll','role','COUNT','col','count','admin','user','telephone','users','forEach','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','catch'];(function(_0x20d47e,_0x3b17cd){var _0x54e858=function(_0x3798bd){while(--_0x3798bd){_0x20d47e['push'](_0x20d47e['shift']());}};_0x54e858(++_0x3b17cd);}(_0x690c,0xf7));var _0xc690=function(_0xfdb2df,_0x5517ff){_0xfdb2df=_0xfdb2df-0x0;var _0x42dc28=_0x690c[_0xfdb2df];return _0x42dc28;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc690('0x0'));var BPromise=require(_0xc690('0x1'));var hardware=require('./hardware');var encryptor=require(_0xc690('0x2'));var db=require(_0xc690('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc690('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc690('0x5'),'machineUuid':hardware[_0xc690('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xc690('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4ce749){return new BPromise(function(_0xd9ccfa,_0x3afa99){return db[_0xc690('0x7')][_0xc690('0x8')](_['defaults'](_0x4ce749,{'raw':!![],'where':{'id':0x1}}))[_0xc690('0x9')](function(_0x3d26c7){return checkLicense(_0x3d26c7,null);})[_0xc690('0x9')](function(_0x168f29){_0xd9ccfa(_0x168f29);return;})[_0xc690('0xa')](function(_0x2602a6){_0x3afa99(_0x2602a6);});});}function checkLicense(_0x435f74,_0x3e1e55){if(!_0x435f74){demoLicense['uuid']=_0x435f74[_0xc690('0xb')];return demoLicense;}try{var _0x511648=_0x3e1e55||_0x435f74[_0xc690('0xc')];if(_[_0xc690('0xd')](_0x511648)){throw new Error(_0xc690('0xe'));}var _0x80f83d=_0x435f74[_0xc690('0xb')];var _0x4df308=_0x435f74[_0xc690('0xf')];var _0x2d2f13=_0x80f83d[_0xc690('0x10')]('-')[0x4];var _0x20df32=_0x80f83d[_0xc690('0x10')]('-')[0x0];var _0x503a9d=encryptor[_0xc690('0x11')](_0x511648,util[_0xc690('0x12')](_0xc690('0x13'),_0x2d2f13,_0x80f83d,_0x20df32));var _0x403daf=JSON['parse'](_0x503a9d);_0x403daf[_0xc690('0x14')]=![];_0x403daf[_0xc690('0x15')]=_0x80f83d;_0x403daf['machineUuid']=hardware[_0xc690('0x6')]();if(_0x4df308){var _0x5e9268=encryptor[_0xc690('0x11')](_0x4df308);_0x403daf[_0xc690('0x16')]=_0x5e9268;_0x403daf[_0xc690('0x17')]=moment(_0x5e9268)['add'](0x7,_0xc690('0x18'))[_0xc690('0x12')]();_0x403daf[_0xc690('0x19')]=_0x403daf[_0xc690('0x15')]!=_0x403daf['machineUuid']?_0xc690('0x1a'):_0xc690('0x1b');}return _0x403daf;}catch(_0x1e8a96){breakingLicense[_0xc690('0x15')]=_0x435f74[_0xc690('0xb')];breakingLicense[_0xc690('0x1c')]=_0x1e8a96['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3c77a0,_0xee60b4){getLicense()[_0xc690('0x9')](function(_0x48b029){return db[_0xc690('0x1d')][_0xc690('0x1e')]({'attributes':[_0xc690('0x1f'),[db['sequelize']['fn'](_0xc690('0x20'),db['sequelize'][_0xc690('0x21')]('role')),_0xc690('0x22')]],'group':_0xc690('0x1f'),'where':{'role':{'$or':[_0xc690('0x23'),_0xc690('0x24'),_0xc690('0x25')]}},'raw':!![]})[_0xc690('0x9')](function(_0x311976){var _0x54f229={'user':_0x48b029[_0xc690('0x26')]||0x0,'telephone':_0x48b029['telephones']||0x0};_0x311976[_0xc690('0x27')](function(_0x5299ba){var _0x2627ec=_0x5299ba['role']===_0xc690('0x23')?_0xc690('0x24'):_0x5299ba[_0xc690('0x1f')];_0x54f229[_0x2627ec]-=_0x5299ba[_0xc690('0x22')];if(_0x54f229[_0x2627ec]<0x0)_0x54f229[_0x2627ec]=0x0;});_0x3c77a0(_0x54f229);return;});})[_0xc690('0xa')](function(_0x3816ad){_0xee60b4(_0x3816ad);});});}function checkUserLimits(_0x1a39d9){return new BPromise(function(_0x235c5f,_0x100b36){getLimits()[_0xc690('0x9')](function(_0x149950){var _0xcb688c=_['pick'](_[_0xc690('0x28')](_0x1a39d9,'role'),['admin','user',_0xc690('0x25')]);var _0x56a057=(_0xcb688c['admin']||0x0)+(_0xcb688c[_0xc690('0x24')]||0x0);var _0x346b64=_0xcb688c['telephone']||0x0;if(_0x56a057>_0x149950[_0xc690('0x24')])return _0x100b36('License\x20limit\x20reached\x20for\x20users');if(_0x346b64>_0x149950[_0xc690('0x25')])return _0x100b36(_0xc690('0x29'));return _0x235c5f();})['catch'](function(_0x1ea600){_0x100b36(_0x1ea600);});});}module[_0xc690('0x2a')]={'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 796f650..9e70bb6 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 _0x66fa=['http://localhost:9000','app-id','secret','exports'];(function(_0x49f30d,_0x50300a){var _0x2c75fa=function(_0x3a880a){while(--_0x3a880a){_0x49f30d['push'](_0x49f30d['shift']());}};_0x2c75fa(++_0x50300a);}(_0x66fa,0x117));var _0xa66f=function(_0x2cadf9,_0x26b888){_0x2cadf9=_0x2cadf9-0x0;var _0x38c7e6=_0x66fa[_0x2cadf9];return _0x38c7e6;};'use strict';module[_0xa66f('0x0')]={'DOMAIN':_0xa66f('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa66f('0x2'),'GOOGLE_SECRET':_0xa66f('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x3b17c1,_0x4460f7){var _0x1a4326=function(_0x18ddc5){while(--_0x18ddc5){_0x3b17c1['push'](_0x3b17c1['shift']());}};_0x1a4326(++_0x4460f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xb10b[_0x5c3ae9];return _0x3f5950;};'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 diff --git a/server/config/logger.js b/server/config/logger.js index b964e05..99973aa 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee8e=['fileLogger','exports','../utils/loggers'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xee8e,0x1c1));var _0xeee8=function(_0x37ca0f,_0x314ba2){_0x37ca0f=_0x37ca0f-0x0;var _0x5cad55=_0xee8e[_0x37ca0f];return _0x5cad55;};'use strict';var fileLogger=require(_0xeee8('0x0'))[_0xeee8('0x1')];module[_0xeee8('0x2')]=fileLogger; \ No newline at end of file +var _0x2255=['exports','../utils/loggers','fileLogger'];(function(_0x416848,_0x543015){var _0x45e0ca=function(_0x3d8515){while(--_0x3d8515){_0x416848['push'](_0x416848['shift']());}};_0x45e0ca(++_0x543015);}(_0x2255,0xd3));var _0x5225=function(_0x265df3,_0x1d9fd0){_0x265df3=_0x265df3-0x0;var _0x1f3660=_0x2255[_0x265df3];return _0x1f3660;};'use strict';var fileLogger=require(_0x5225('0x0'))[_0x5225('0x1')];module[_0x5225('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 03134a3..8dad25d 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 _0x099b=['ami','../../services/ami/index.js','agi','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x099b,0x15b));var _0xb099=function(_0x28a401,_0x5600e9){_0x28a401=_0x28a401-0x0;var _0x1b6346=_0x099b[_0x28a401];return _0x1b6346;};'use strict';var path=require(_0xb099('0x0'));var os=require('os');var config={'apps':[{'name':_0xb099('0x1'),'script':path[_0xb099('0x2')](__dirname,_0xb099('0x3'))},{'name':_0xb099('0x4'),'script':path['join'](__dirname,_0xb099('0x5'))},{'name':_0xb099('0x6'),'script':path[_0xb099('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0xb099('0x2')](__dirname,_0xb099('0x7'))},{'name':_0xb099('0x8'),'script':path[_0xb099('0x2')](__dirname,_0xb099('0x9'))},{'name':_0xb099('0xa'),'script':path[_0xb099('0x2')](__dirname,_0xb099('0xb'))}]};module[_0xb099('0xc')]=config; \ No newline at end of file +var _0xf51a=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express','join','../../services/express/index.js','ami','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x150854,_0x1e82ea){var _0x3bed25=function(_0x5151ac){while(--_0x5151ac){_0x150854['push'](_0x150854['shift']());}};_0x3bed25(++_0x1e82ea);}(_0xf51a,0x101));var _0xaf51=function(_0x227925,_0x373881){_0x227925=_0x227925-0x0;var _0x301561=_0xf51a[_0x227925];return _0x301561;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xaf51('0x0'),'script':path[_0xaf51('0x1')](__dirname,_0xaf51('0x2'))},{'name':_0xaf51('0x3'),'script':path[_0xaf51('0x1')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path['join'](__dirname,_0xaf51('0x4'))},{'name':_0xaf51('0x5'),'script':path[_0xaf51('0x1')](__dirname,_0xaf51('0x6'))},{'name':'routing','script':path[_0xaf51('0x1')](__dirname,_0xaf51('0x7'))},{'name':_0xaf51('0x8'),'script':path[_0xaf51('0x1')](__dirname,_0xaf51('0x9'))}]};module[_0xaf51('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 583b51c..a15828b 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 _0x19df=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x19df,0x1a1));var _0xf19d=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x19df[_0x240261];return _0x45c332;};'use strict';var pm2=require(_0xf19d('0x0'));var BPromise=require(_0xf19d('0x1'));var config=require(_0xf19d('0x2'));function connect(){return new BPromise(function(_0x5b7d9c,_0x2e65d3){return pm2[_0xf19d('0x3')](function(_0x480b2f){if(_0x480b2f){return _0x2e65d3(_0x480b2f);}return _0x5b7d9c(_0xf19d('0x4'));});});};exports[_0xf19d('0x5')]=function(_0x4db41a){return connect()[_0xf19d('0x6')](function(){return new BPromise(function(_0x196531,_0x59ff85){return pm2[_0xf19d('0x5')](_0x4db41a,function(_0x5bcab4,_0x468956){if(_0x5bcab4){return _0x59ff85(_0x5bcab4);}pm2[_0xf19d('0x7')]();return _0x196531(_0x468956);});});});};exports[_0xf19d('0x8')]=function(_0x1732e7){return connect()['then'](function(){return new BPromise(function(_0x2a8318,_0x4def23){return pm2[_0xf19d('0x8')](_0x1732e7,function(_0xc1e18d,_0x458752){if(_0xc1e18d){return _0x4def23(_0xc1e18d);}pm2[_0xf19d('0x7')]();return _0x2a8318(_0x458752);});});});};exports[_0xf19d('0x9')]=function(_0x1a231b){return connect()[_0xf19d('0x6')](function(){return new BPromise(function(_0x42c82b,_0x5410bb){return pm2[_0xf19d('0x9')](_0x1a231b,function(_0x5c7ac2,_0xbd567a){if(_0x5c7ac2){return _0x5410bb(_0x5c7ac2);}pm2['disconnect']();return _0x42c82b(_0xbd567a);});});});};exports[_0xf19d('0xa')]=function(){return connect()[_0xf19d('0x6')](function(){return new BPromise(function(_0x11b1a2,_0x46c1f4){return pm2[_0xf19d('0xa')](function(_0x2ef40c,_0x1d5693){if(_0x2ef40c){return _0x46c1f4(_0x2ef40c);}pm2[_0xf19d('0x7')]();return _0x11b1a2(_0x1d5693);});});});};exports[_0xf19d('0xb')]=function(_0x5f1469){return connect()[_0xf19d('0x6')](function(){return new BPromise(function(_0x109fdf,_0x9b33a7){return pm2[_0xf19d('0xb')](_0x5f1469,function(_0x3ff67d,_0x3315c5){if(_0x3ff67d){return _0x9b33a7(_0x3ff67d);}pm2[_0xf19d('0x7')]();return _0x109fdf(_0x3315c5);});});});};exports[_0xf19d('0xc')]=function(_0x20785c){return connect()[_0xf19d('0x6')](function(){return new BPromise(function(_0x2ec6b0,_0x4b43bd){return pm2[_0xf19d('0xc')](_0x20785c,function(_0x448d6d,_0xc1a8da){if(_0x448d6d){return _0x4b43bd(_0x448d6d);}pm2[_0xf19d('0x7')]();return _0x2ec6b0(_0xc1a8da);});});});};exports[_0xf19d('0xd')]=function(){return connect()[_0xf19d('0x6')](function(){return new BPromise(function(_0x4edfa9,_0x25a565){return pm2[_0xf19d('0xd')](function(_0x1a7bbb){if(_0x1a7bbb){return _0x25a565(_0x1a7bbb);}return _0x4edfa9(_0xf19d('0xe'));});});});}; \ No newline at end of file +var _0x9eeb=['then','start','disconnect','stop','restart','list','describe','delete','dump','pm2','connect','connected'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9eeb,0xd5));var _0xb9ee=function(_0x487262,_0xd5786f){_0x487262=_0x487262-0x0;var _0x5e17b3=_0x9eeb[_0x487262];return _0x5e17b3;};'use strict';var pm2=require(_0xb9ee('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x406dac,_0x192870){return pm2[_0xb9ee('0x1')](function(_0x19d985){if(_0x19d985){return _0x192870(_0x19d985);}return _0x406dac(_0xb9ee('0x2'));});});};exports['start']=function(_0x29f83a){return connect()[_0xb9ee('0x3')](function(){return new BPromise(function(_0x9118ed,_0xe8b850){return pm2[_0xb9ee('0x4')](_0x29f83a,function(_0x166c9e,_0x5bfd99){if(_0x166c9e){return _0xe8b850(_0x166c9e);}pm2[_0xb9ee('0x5')]();return _0x9118ed(_0x5bfd99);});});});};exports[_0xb9ee('0x6')]=function(_0x1caac2){return connect()[_0xb9ee('0x3')](function(){return new BPromise(function(_0x42de7f,_0x526d44){return pm2[_0xb9ee('0x6')](_0x1caac2,function(_0x412183,_0x47ae06){if(_0x412183){return _0x526d44(_0x412183);}pm2[_0xb9ee('0x5')]();return _0x42de7f(_0x47ae06);});});});};exports[_0xb9ee('0x7')]=function(_0x32c22d){return connect()[_0xb9ee('0x3')](function(){return new BPromise(function(_0x898a63,_0x3912f9){return pm2['restart'](_0x32c22d,function(_0x4ab157,_0x3d1dea){if(_0x4ab157){return _0x3912f9(_0x4ab157);}pm2[_0xb9ee('0x5')]();return _0x898a63(_0x3d1dea);});});});};exports[_0xb9ee('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4a30ab,_0x2e92cf){return pm2['list'](function(_0x49addf,_0x3c803b){if(_0x49addf){return _0x2e92cf(_0x49addf);}pm2[_0xb9ee('0x5')]();return _0x4a30ab(_0x3c803b);});});});};exports[_0xb9ee('0x9')]=function(_0x10eba6){return connect()[_0xb9ee('0x3')](function(){return new BPromise(function(_0x31fc44,_0x13a4e8){return pm2[_0xb9ee('0x9')](_0x10eba6,function(_0x292f14,_0x40de2f){if(_0x292f14){return _0x13a4e8(_0x292f14);}pm2['disconnect']();return _0x31fc44(_0x40de2f);});});});};exports['delete']=function(_0x2641bd){return connect()[_0xb9ee('0x3')](function(){return new BPromise(function(_0x32ff3b,_0x2a7d80){return pm2[_0xb9ee('0xa')](_0x2641bd,function(_0x1a434e,_0x546632){if(_0x1a434e){return _0x2a7d80(_0x1a434e);}pm2[_0xb9ee('0x5')]();return _0x32ff3b(_0x546632);});});});};exports[_0xb9ee('0xb')]=function(){return connect()[_0xb9ee('0x3')](function(){return new BPromise(function(_0x2b1fd7,_0x1f5d91){return pm2[_0xb9ee('0xb')](function(_0x467205){if(_0x467205){return _0x1f5d91(_0x467205);}return _0x2b1fd7('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 51ea2a4..dabee21 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 _0xa6ee=['[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','moment','ioredis','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info'];(function(_0x20210e,_0x1603f6){var _0x439c00=function(_0x5b4cc2){while(--_0x5b4cc2){_0x20210e['push'](_0x20210e['shift']());}};_0x439c00(++_0x1603f6);}(_0xa6ee,0xc6));var _0xea6e=function(_0x241d85,_0x1f5c59){_0x241d85=_0x241d85-0x0;var _0x2f01a5=_0xa6ee[_0x241d85];return _0x2f01a5;};'use strict';var _=require('lodash');var moment=require(_0xea6e('0x0'));var Redis=require(_0xea6e('0x1'));var util=require('util');var config=require(_0xea6e('0x2'));var db=require(_0xea6e('0x3'))['db'];var logger=require('../logger')(_0xea6e('0x4'));config['redis']=_[_0xea6e('0x5')](config[_0xea6e('0x6')],{'host':_0xea6e('0x7'),'port':0x18eb});var io=require(_0xea6e('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x192173=0x0;var _0x500afe=[];return db[_0xea6e('0x9')][_0xea6e('0xa')]({'raw':!![],'attributes':['id',_0xea6e('0xb')],'where':{'id':0x1}})[_0xea6e('0xc')](function(_0x543084){_0x192173=_0x543084[_0xea6e('0xb')];if(_0x192173){return db[_0xea6e('0xd')][_0xea6e('0xe')]({'raw':!![],'attributes':['id',_0xea6e('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xea6e('0x10')](_0x543084[_0xea6e('0xb')],_0xea6e('0x11'))}}});}else{return[];}})[_0xea6e('0xc')](function(_0x30acd1){if(_0x30acd1&&_0x30acd1[_0xea6e('0x12')]){_0x500afe=_[_0xea6e('0x13')](_0x30acd1||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x500afe[_0xea6e('0x14')]());return db[_0xea6e('0xd')]['update']({'closeReason':_0xea6e('0x15'),'disposition':_0xea6e('0x16'),'closed':!![],'closedAt':moment()[_0xea6e('0x17')](_0xea6e('0x18'))},{'where':{'id':_0x500afe}});}})[_0xea6e('0xc')](function(){if(_0x500afe&&_0x500afe['length']){logger[_0xea6e('0x19')](_0xea6e('0x1a'),_0x500afe['join']());for(var _0x3a8b06=0x0;_0x3a8b06<_0x500afe[_0xea6e('0x12')];_0x3a8b06++){io[_0xea6e('0x1b')](_0xea6e('0x1c'),{'id':_0x500afe[_0x3a8b06],'closed':!![]});}}})[_0xea6e('0x1d')](function(_0x4d5a0f){logger[_0xea6e('0x1e')](_0xea6e('0x1f'),_0x4d5a0f?util['inspect'](_0x4d5a0f,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe660=['ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','length','map','info','join','update','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash'];(function(_0x3aef67,_0x4f54d6){var _0x5d61b8=function(_0x228b81){while(--_0x228b81){_0x3aef67['push'](_0x3aef67['shift']());}};_0x5d61b8(++_0x4f54d6);}(_0xe660,0xef));var _0x0e66=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xe660[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x0e66('0x0'));var moment=require('moment');var Redis=require(_0x0e66('0x1'));var util=require(_0x0e66('0x2'));var config=require(_0x0e66('0x3'));var db=require(_0x0e66('0x4'))['db'];var logger=require(_0x0e66('0x5'))(_0x0e66('0x6'));config[_0x0e66('0x7')]=_[_0x0e66('0x8')](config[_0x0e66('0x7')],{'host':_0x0e66('0x9'),'port':0x18eb});var io=require(_0x0e66('0xa'))(new Redis(config[_0x0e66('0x7')]));function closeInteractions(){var _0x5e92a5=0x0;var _0x293c5d=[];return db[_0x0e66('0xb')][_0x0e66('0xc')]({'raw':!![],'attributes':['id',_0x0e66('0xd')],'where':{'id':0x1}})['then'](function(_0x27d711){_0x5e92a5=_0x27d711[_0x0e66('0xd')];if(_0x5e92a5){return db[_0x0e66('0xe')][_0x0e66('0xf')]({'raw':!![],'attributes':['id',_0x0e66('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0e66('0x11')](_0x27d711[_0x0e66('0xd')],'minutes')}}});}else{return[];}})['then'](function(_0x4bf361){if(_0x4bf361&&_0x4bf361[_0x0e66('0x12')]){_0x293c5d=_[_0x0e66('0x13')](_0x4bf361||[],'id');logger[_0x0e66('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x293c5d[_0x0e66('0x15')]());return db[_0x0e66('0xe')][_0x0e66('0x16')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x0e66('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x293c5d}});}})['then'](function(){if(_0x293c5d&&_0x293c5d[_0x0e66('0x12')]){logger[_0x0e66('0x14')](_0x0e66('0x18'),_0x293c5d[_0x0e66('0x15')]());for(var _0x117498=0x0;_0x117498<_0x293c5d[_0x0e66('0x12')];_0x117498++){io[_0x0e66('0x19')](_0x0e66('0x1a'),{'id':_0x293c5d[_0x117498],'closed':!![]});}}})[_0x0e66('0x1b')](function(_0xbe9968){logger[_0x0e66('0x1c')](_0x0e66('0x1d'),_0xbe9968?util['inspect'](_0xbe9968,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 59b16bf..d0aa4f0 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 _0x1eef=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x13d53d,_0x1a3ee1){var _0xfb9f88=function(_0x3c5052){while(--_0x3c5052){_0x13d53d['push'](_0x13d53d['shift']());}};_0xfb9f88(++_0x1a3ee1);}(_0x1eef,0x105));var _0xf1ee=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x1eef[_0x58a4ac];return _0x545810;};'use strict';function start(){var _0x5c7133=require(_0xf1ee('0x0'));return _0x5c7133[_0xf1ee('0x1')]();}module[_0xf1ee('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x3890=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x30563f,_0x56cc53){var _0x51cddb=function(_0x48aaaa){while(--_0x48aaaa){_0x30563f['push'](_0x30563f['shift']());}};_0x51cddb(++_0x56cc53);}(_0x3890,0xca));var _0x0389=function(_0x163e86,_0x485ebf){_0x163e86=_0x163e86-0x0;var _0x3a5671=_0x3890[_0x163e86];return _0x3a5671;};'use strict';function start(){var _0x52f858=require(_0x0389('0x0'));return _0x52f858[_0x0389('0x1')]();}module[_0x0389('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index bbd210b..0836085 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 _0x87bb=['bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','join','Sent','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','existsSync','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','toRun','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','lodash','cron-job-manager','jayson/promise'];(function(_0x2134b2,_0x5a82aa){var _0x4e4bc8=function(_0x5816b6){while(--_0x5816b6){_0x2134b2['push'](_0x2134b2['shift']());}};_0x4e4bc8(++_0x5a82aa);}(_0x87bb,0x148));var _0xb87b=function(_0x15ed42,_0x516968){_0x15ed42=_0x15ed42-0x0;var _0x132c71=_0x87bb[_0x15ed42];return _0x132c71;};'use strict';var fs=require('fs');var util=require(_0xb87b('0x0'));var path=require('path');var _=require(_0xb87b('0x1'));var moment=require('moment');var CronJobManager=require(_0xb87b('0x2'));var jayson=require(_0xb87b('0x3'));var BPromise=require(_0xb87b('0x4'));var logger=require(_0xb87b('0x5'))(_0xb87b('0x6'));var db=require(_0xb87b('0x7'))['db'];var analyticCustomReportController=require(_0xb87b('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xb87b('0x9')][_0xb87b('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x29a6af,_0x382660){return function(){logger[_0xb87b('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x29a6af[_0xb87b('0xc')]);var _0x3e81ae=!![];var _0x119901=_0x29a6af[_0xb87b('0xd')][_0xb87b('0xe')]();var _0x3b31fd={'account':_0x119901,'message':{'from':util[_0xb87b('0xf')](_0xb87b('0x10'),_0x29a6af[_0xb87b('0xd')][_0xb87b('0x11')],_0x29a6af['MailAccount'][_0xb87b('0xc')]||_0x29a6af['MailAccount'][_0xb87b('0x12')]['user']),'to':_0x29a6af['email'],'cc':_0x29a6af['cc'],'bcc':_0x29a6af[_0xb87b('0x13')],'subject':util[_0xb87b('0xf')](_0xb87b('0x14'),_0x382660['name'],_0x29a6af[_0xb87b('0x15')],_0x29a6af[_0xb87b('0x16')])}};var _0xa16540=path['join'](__dirname,_0xb87b('0x17'));var _0x52ac5d=_0x382660[_0xb87b('0x18')];var _0x3f7bff=util[_0xb87b('0xf')](_0xb87b('0x19'),path[_0xb87b('0x1a')](_0x382660[_0xb87b('0x18')],path[_0xb87b('0x1b')](_0x382660[_0xb87b('0x18')])),'zip');var _0x5a43a9=path[_0xb87b('0x1c')](_0xa16540,_0x52ac5d);var _0x497d21=path[_0xb87b('0x1c')](_0xa16540,_0x3f7bff);if(fs['existsSync'](_0x5a43a9)){_0x382660['status']=_0xb87b('0x1d');_0x3b31fd[_0xb87b('0x1e')][_0xb87b('0x1f')]=[{'filename':_0x52ac5d,'path':_0x5a43a9}];_0x3b31fd[_0xb87b('0x1e')]['text']=util[_0xb87b('0xf')](_0xb87b('0x20'),JSON[_0xb87b('0x21')](_0x382660,null,0x2));}else if(fs[_0xb87b('0x22')](_0x497d21)){_0x382660[_0xb87b('0x23')]='Sent';_0x3b31fd['message'][_0xb87b('0x1f')]=[{'filename':_0x3f7bff,'path':_0x497d21}];}else{_0x3b31fd[_0xb87b('0x1e')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x29a6af[_0xb87b('0x24')]){_0x3e81ae=![];logger[_0xb87b('0xb')](_0xb87b('0x25'));}}if(_0x3e81ae){return client[_0xb87b('0x26')](_0xb87b('0x27'),_0x3b31fd)[_0xb87b('0x28')](function(_0xf65924){if(_0xf65924[_0xb87b('0x29')]){return logger[_0xb87b('0x29')](_0xb87b('0x2a'),JSON['stringify'](_0xf65924));}return logger[_0xb87b('0xb')]('email\x20sent');})[_0xb87b('0x2b')](function(_0x562a48){return logger[_0xb87b('0x29')]('error\x20mail',JSON[_0xb87b('0x21')](_0x562a48));});}};}function handleError(){return function(_0x4e43e4){return logger[_0xb87b('0x29')](JSON[_0xb87b('0x21')](_0x4e43e4));};}function handleResult(_0x58d163){return function(_0x1b9268){logger[_0xb87b('0xb')](_0xb87b('0x2c'),JSON['stringify'](_0x1b9268));if(_0x58d163[_0xb87b('0xd')]&&_0x58d163['MailAccount'][_0xb87b('0x12')]&&!_[_0xb87b('0x2d')](_0x58d163[_0xb87b('0xc')])){setTimeout(handleSendEmail(_0x58d163,_0x1b9268),0x3c*0x3e8);}};}function handleJob(_0x38aa41){return function(){try{if(_[_0xb87b('0x2d')](_0x38aa41[_0xb87b('0x15')])){return logger[_0xb87b('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xb87b('0x2d')](_0x38aa41[_0xb87b('0x16')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x30bc2b={'startDate':moment()[_0xb87b('0x2e')](_0x38aa41[_0xb87b('0x15')],_0x38aa41[_0xb87b('0x16')])['format'](_0xb87b('0x2f')),'endDate':moment()[_0xb87b('0xf')](_0xb87b('0x2f')),'type':_0xb87b('0x30'),'output':_0x38aa41[_0xb87b('0x31')],'name':_0x38aa41[_0xb87b('0x11')]};if(!_[_0xb87b('0x2d')](_0x38aa41[_0xb87b('0x32')])){logger[_0xb87b('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x38aa41['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x38aa41[_0xb87b('0x32')]},_0x30bc2b)[_0xb87b('0x28')](handleResult(_0x38aa41))['catch'](handleError());}if(!_[_0xb87b('0x2d')](_0x38aa41[_0xb87b('0x33')])){logger[_0xb87b('0xb')]('exec\x20custom\x20report\x20id:%s',_0x38aa41['CustomReportId']);return analyticCustomReportController[_0xb87b('0x34')]({'id':_0x38aa41['CustomReportId']},_0x30bc2b)[_0xb87b('0x28')](handleResult(_0x38aa41))[_0xb87b('0x2b')](handleError());}}catch(_0x17db68){logger[_0xb87b('0x29')](JSON[_0xb87b('0x21')](_0x17db68));}return logger[_0xb87b('0xb')](_0xb87b('0x35'));};}function getJobs(_0x480304){var _0x4a587f={};if(_0x480304){_0x4a587f['id']=_0x480304;}return db[_0xb87b('0x36')][_0xb87b('0x37')]({'where':_0x4a587f,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0xb87b('0x12'),'include':[{'model':db[_0xb87b('0x38')],'as':'CloudProvider'}]}]}]})[_0xb87b('0x28')](function(_0x5673e3){var _0x3ceb85=_[_0xb87b('0x39')](manager[_0xb87b('0x3a')]);var _0x2f8fa1=_[_0xb87b('0x3b')](_0x5673e3,function(_0x393967){return _0x393967['id']['toString']();});var _0x21ad1d=_[_0xb87b('0x3c')](_0x5673e3,function(_0x421862){return _0x421862['id'][_0xb87b('0x3d')]();});var _0x54f0ea=_0x480304?_0x2f8fa1:_[_0xb87b('0x3e')](_0x2f8fa1,_0x3ceb85);var _0x30a411=_[_0xb87b('0x3f')](_0x2f8fa1,_0x3ceb85);var _0x50ae83=_[_0xb87b('0x3e')](_0x3ceb85,_0x2f8fa1);var _0x4cd746;var _0x1c0bae;for(_0x4cd746=0x0;_0x4cd746<_0x50ae83[_0xb87b('0x40')]&&!_0x480304;_0x4cd746+=0x1){_0x1c0bae=_0x50ae83[_0x4cd746][_0xb87b('0x3d')]();if(manager[_0xb87b('0x41')](_0x1c0bae)){manager[_0xb87b('0x42')](_0x1c0bae);manager[_0xb87b('0x43')](_0x1c0bae);logger[_0xb87b('0xb')]('delete\x20cron',_0x1c0bae);}}logger['info'](_0xb87b('0x44'),JSON[_0xb87b('0x21')](_0x54f0ea));for(_0x4cd746=0x0;_0x4cd746<_0x54f0ea['length'];_0x4cd746+=0x1){_0x1c0bae=_0x54f0ea[_0x4cd746][_0xb87b('0x3d')]();logger[_0xb87b('0xb')]('index',_0x1c0bae);if(_0x480304){logger[_0xb87b('0xb')](_0xb87b('0x45'),_0x480304);logger[_0xb87b('0xb')](JSON['stringify'](_0x21ad1d[_0x1c0bae]));BPromise[_0xb87b('0x46')]()[_0xb87b('0x28')](handleJob(_0x21ad1d[_0x1c0bae]));logger[_0xb87b('0xb')]('run\x20job',_0x21ad1d[_0x1c0bae][_0xb87b('0x11')],_0x21ad1d[_0x1c0bae][_0xb87b('0x47')]);}else if(_0x21ad1d[_0x1c0bae][_0xb87b('0x47')]&&_0x21ad1d[_0x1c0bae][_0xb87b('0x48')]&&moment()[_0xb87b('0x49')](_0x21ad1d[_0x1c0bae][_0xb87b('0x4a')],_0x21ad1d[_0x1c0bae][_0xb87b('0x4b')])){manager[_0xb87b('0x4c')](_0x1c0bae,_0x21ad1d[_0x1c0bae][_0xb87b('0x47')],handleJob(_0x21ad1d[_0x1c0bae]));manager[_0xb87b('0x4d')](_0x1c0bae);logger['info'](_0xb87b('0x4e'),_0x21ad1d[_0x1c0bae][_0xb87b('0x11')],_0x21ad1d[_0x1c0bae][_0xb87b('0x47')]);}else if(manager[_0xb87b('0x41')](_0x1c0bae)){manager[_0xb87b('0x42')](_0x1c0bae);manager['deleteJob'](_0x1c0bae);logger[_0xb87b('0xb')](_0xb87b('0x4f'),_0x21ad1d[_0x1c0bae][_0xb87b('0x11')],_0x21ad1d[_0x1c0bae]['cron']);}}for(_0x4cd746=0x0,_0x1c0bae;_0x4cd746<_0x30a411[_0xb87b('0x40')]&&!_0x480304;_0x4cd746+=0x1){_0x1c0bae=_0x30a411[_0x4cd746][_0xb87b('0x3d')]();if(manager[_0xb87b('0x41')](_0x1c0bae)){if(_0x21ad1d[_0x1c0bae][_0xb87b('0x47')]&&_0x21ad1d[_0x1c0bae]['active']&&moment()['isBetween'](_0x21ad1d[_0x1c0bae][_0xb87b('0x4a')],_0x21ad1d[_0x1c0bae]['endAt'])){manager[_0xb87b('0x50')](_0x1c0bae,_0x21ad1d[_0x1c0bae][_0xb87b('0x47')],handleJob(_0x21ad1d[_0x1c0bae]));logger['info'](_0xb87b('0x51'),_0x21ad1d[_0x1c0bae]['name'],_0x21ad1d[_0x1c0bae]['cron']);}else{manager[_0xb87b('0x42')](_0x1c0bae);manager[_0xb87b('0x43')](_0x1c0bae);logger['info'](_0xb87b('0x4f'),_0x21ad1d[_0x1c0bae]['name'],_0x21ad1d[_0x1c0bae][_0xb87b('0x47')]);}}}})[_0xb87b('0x2b')](function(_0x5489c5){logger[_0xb87b('0x29')](JSON['stringify'](_0x5489c5));});}exports[_0xb87b('0x52')]=function(_0x22f33f){return getJobs(_0x22f33f);};exports[_0xb87b('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8432=['subtractUnit','join','savename','%s.%s','basename','extname','zip','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','resolve','cron','active','startAt','endAt','add','start','add\x20cron','stop\x20cron','isBetween','update','update\x20cron','path','lodash','moment','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s'];(function(_0x4fddc1,_0x1e2746){var _0x2dd6dd=function(_0x2956c2){while(--_0x2956c2){_0x4fddc1['push'](_0x4fddc1['shift']());}};_0x2dd6dd(++_0x1e2746);}(_0x8432,0x1e8));var _0x2843=function(_0x262ff6,_0x158799){_0x262ff6=_0x262ff6-0x0;var _0x4c9b82=_0x8432[_0x262ff6];return _0x4c9b82;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x2843('0x0'));var _=require(_0x2843('0x1'));var moment=require(_0x2843('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x2843('0x3'));var logger=require(_0x2843('0x4'))(_0x2843('0x5'));var db=require(_0x2843('0x6'))['db'];var analyticCustomReportController=require(_0x2843('0x7'));var analyticDefaultReportController=require(_0x2843('0x8'));var client=jayson['client'][_0x2843('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1185db,_0xcdb317){return function(){logger[_0x2843('0xa')](_0x2843('0xb'),_0x1185db[_0x2843('0xc')]);var _0x344750=!![];var _0x43f8de=_0x1185db['MailAccount'][_0x2843('0xd')]();var _0x3b5016={'account':_0x43f8de,'message':{'from':util[_0x2843('0xe')](_0x2843('0xf'),_0x1185db[_0x2843('0x10')][_0x2843('0x11')],_0x1185db['MailAccount'][_0x2843('0xc')]||_0x1185db[_0x2843('0x10')][_0x2843('0x12')][_0x2843('0x13')]),'to':_0x1185db[_0x2843('0xc')],'cc':_0x1185db['cc'],'bcc':_0x1185db[_0x2843('0x14')],'subject':util[_0x2843('0xe')](_0x2843('0x15'),_0xcdb317[_0x2843('0x11')],_0x1185db['subtractNumber'],_0x1185db[_0x2843('0x16')])}};var _0x24e5ea=path[_0x2843('0x17')](__dirname,'../../files/reports');var _0x2e9052=_0xcdb317[_0x2843('0x18')];var _0x1395b8=util[_0x2843('0xe')](_0x2843('0x19'),path[_0x2843('0x1a')](_0xcdb317[_0x2843('0x18')],path[_0x2843('0x1b')](_0xcdb317[_0x2843('0x18')])),_0x2843('0x1c'));var _0xffad8=path[_0x2843('0x17')](_0x24e5ea,_0x2e9052);var _0x1b1c41=path[_0x2843('0x17')](_0x24e5ea,_0x1395b8);if(fs['existsSync'](_0xffad8)){_0xcdb317[_0x2843('0x1d')]=_0x2843('0x1e');_0x3b5016[_0x2843('0x1f')]['attachments']=[{'filename':_0x2e9052,'path':_0xffad8}];_0x3b5016['message'][_0x2843('0x20')]=util['format'](_0x2843('0x21'),JSON[_0x2843('0x22')](_0xcdb317,null,0x2));}else if(fs[_0x2843('0x23')](_0x1b1c41)){_0xcdb317['status']=_0x2843('0x1e');_0x3b5016[_0x2843('0x1f')]['attachments']=[{'filename':_0x1395b8,'path':_0x1b1c41}];}else{_0x3b5016[_0x2843('0x1f')][_0x2843('0x20')]=_0x2843('0x24');if(!_0x1185db[_0x2843('0x25')]){_0x344750=![];logger[_0x2843('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x344750){return client[_0x2843('0x26')]('SendMail',_0x3b5016)[_0x2843('0x27')](function(_0x4b6ade){if(_0x4b6ade[_0x2843('0x28')]){return logger['error'](_0x2843('0x29'),JSON['stringify'](_0x4b6ade));}return logger[_0x2843('0xa')](_0x2843('0x2a'));})['catch'](function(_0x18ecdc){return logger['error']('error\x20mail',JSON['stringify'](_0x18ecdc));});}};}function handleError(){return function(_0x26ccc7){return logger['error'](JSON[_0x2843('0x22')](_0x26ccc7));};}function handleResult(_0x4e4eb4){return function(_0x3b13c7){logger[_0x2843('0xa')](_0x2843('0x2b'),JSON['stringify'](_0x3b13c7));if(_0x4e4eb4[_0x2843('0x10')]&&_0x4e4eb4[_0x2843('0x10')][_0x2843('0x12')]&&!_[_0x2843('0x2c')](_0x4e4eb4[_0x2843('0xc')])){setTimeout(handleSendEmail(_0x4e4eb4,_0x3b13c7),0x3c*0x3e8);}};}function handleJob(_0x4fe6dc){return function(){try{if(_['isNil'](_0x4fe6dc[_0x2843('0x2d')])){return logger[_0x2843('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x4fe6dc[_0x2843('0x16')])){return logger[_0x2843('0xa')](_0x2843('0x2e'));}var _0x33e9d7={'startDate':moment()[_0x2843('0x2f')](_0x4fe6dc['subtractNumber'],_0x4fe6dc['subtractUnit'])[_0x2843('0xe')](_0x2843('0x30')),'endDate':moment()['format'](_0x2843('0x30')),'type':_0x2843('0x31'),'output':_0x4fe6dc[_0x2843('0x32')],'name':_0x4fe6dc[_0x2843('0x11')]};if(!_[_0x2843('0x2c')](_0x4fe6dc[_0x2843('0x33')])){logger['info'](_0x2843('0x34'),_0x4fe6dc[_0x2843('0x33')]);return analyticDefaultReportController[_0x2843('0x35')]({'id':_0x4fe6dc['DefaultReportId']},_0x33e9d7)[_0x2843('0x27')](handleResult(_0x4fe6dc))[_0x2843('0x36')](handleError());}if(!_[_0x2843('0x2c')](_0x4fe6dc[_0x2843('0x37')])){logger['info'](_0x2843('0x38'),_0x4fe6dc['CustomReportId']);return analyticCustomReportController[_0x2843('0x35')]({'id':_0x4fe6dc[_0x2843('0x37')]},_0x33e9d7)[_0x2843('0x27')](handleResult(_0x4fe6dc))[_0x2843('0x36')](handleError());}}catch(_0x1eccc7){logger[_0x2843('0x28')](JSON[_0x2843('0x22')](_0x1eccc7));}return logger[_0x2843('0xa')](_0x2843('0x39'));};}function getJobs(_0x4be175){var _0x1f222c={};if(_0x4be175){_0x1f222c['id']=_0x4be175;}return db[_0x2843('0x3a')][_0x2843('0x3b')]({'where':_0x1f222c,'include':[{'model':db['MailAccount'],'attributes':['id',_0x2843('0x11'),_0x2843('0xc')],'include':[{'model':db[_0x2843('0x3c')],'as':_0x2843('0x12'),'include':[{'model':db[_0x2843('0x3d')],'as':'CloudProvider'}]}]}]})[_0x2843('0x27')](function(_0x241771){var _0x237446=_['keys'](manager[_0x2843('0x3e')]);var _0x34d8cf=_[_0x2843('0x3f')](_0x241771,function(_0x102171){return _0x102171['id'][_0x2843('0x40')]();});var _0x4da165=_[_0x2843('0x41')](_0x241771,function(_0x430f89){return _0x430f89['id']['toString']();});var _0x321c36=_0x4be175?_0x34d8cf:_[_0x2843('0x42')](_0x34d8cf,_0x237446);var _0x4fc5fc=_[_0x2843('0x43')](_0x34d8cf,_0x237446);var _0x395e73=_[_0x2843('0x42')](_0x237446,_0x34d8cf);var _0x5930c2;var _0x3c5b59;for(_0x5930c2=0x0;_0x5930c2<_0x395e73[_0x2843('0x44')]&&!_0x4be175;_0x5930c2+=0x1){_0x3c5b59=_0x395e73[_0x5930c2][_0x2843('0x40')]();if(manager[_0x2843('0x45')](_0x3c5b59)){manager[_0x2843('0x46')](_0x3c5b59);manager[_0x2843('0x47')](_0x3c5b59);logger[_0x2843('0xa')]('delete\x20cron',_0x3c5b59);}}logger['info'](_0x2843('0x48'),JSON[_0x2843('0x22')](_0x321c36));for(_0x5930c2=0x0;_0x5930c2<_0x321c36[_0x2843('0x44')];_0x5930c2+=0x1){_0x3c5b59=_0x321c36[_0x5930c2][_0x2843('0x40')]();logger[_0x2843('0xa')]('index',_0x3c5b59);if(_0x4be175){logger[_0x2843('0xa')]('my\x20id',_0x4be175);logger['info'](JSON['stringify'](_0x4da165[_0x3c5b59]));BPromise[_0x2843('0x49')]()[_0x2843('0x27')](handleJob(_0x4da165[_0x3c5b59]));logger[_0x2843('0xa')]('run\x20job',_0x4da165[_0x3c5b59][_0x2843('0x11')],_0x4da165[_0x3c5b59][_0x2843('0x4a')]);}else if(_0x4da165[_0x3c5b59]['cron']&&_0x4da165[_0x3c5b59][_0x2843('0x4b')]&&moment()['isBetween'](_0x4da165[_0x3c5b59][_0x2843('0x4c')],_0x4da165[_0x3c5b59][_0x2843('0x4d')])){manager[_0x2843('0x4e')](_0x3c5b59,_0x4da165[_0x3c5b59]['cron'],handleJob(_0x4da165[_0x3c5b59]));manager[_0x2843('0x4f')](_0x3c5b59);logger[_0x2843('0xa')](_0x2843('0x50'),_0x4da165[_0x3c5b59]['name'],_0x4da165[_0x3c5b59][_0x2843('0x4a')]);}else if(manager[_0x2843('0x45')](_0x3c5b59)){manager[_0x2843('0x46')](_0x3c5b59);manager[_0x2843('0x47')](_0x3c5b59);logger[_0x2843('0xa')](_0x2843('0x51'),_0x4da165[_0x3c5b59][_0x2843('0x11')],_0x4da165[_0x3c5b59][_0x2843('0x4a')]);}}for(_0x5930c2=0x0,_0x3c5b59;_0x5930c2<_0x4fc5fc[_0x2843('0x44')]&&!_0x4be175;_0x5930c2+=0x1){_0x3c5b59=_0x4fc5fc[_0x5930c2][_0x2843('0x40')]();if(manager['exists'](_0x3c5b59)){if(_0x4da165[_0x3c5b59][_0x2843('0x4a')]&&_0x4da165[_0x3c5b59][_0x2843('0x4b')]&&moment()[_0x2843('0x52')](_0x4da165[_0x3c5b59]['startAt'],_0x4da165[_0x3c5b59][_0x2843('0x4d')])){manager[_0x2843('0x53')](_0x3c5b59,_0x4da165[_0x3c5b59][_0x2843('0x4a')],handleJob(_0x4da165[_0x3c5b59]));logger[_0x2843('0xa')](_0x2843('0x54'),_0x4da165[_0x3c5b59][_0x2843('0x11')],_0x4da165[_0x3c5b59][_0x2843('0x4a')]);}else{manager[_0x2843('0x46')](_0x3c5b59);manager['deleteJob'](_0x3c5b59);logger[_0x2843('0xa')](_0x2843('0x51'),_0x4da165[_0x3c5b59][_0x2843('0x11')],_0x4da165[_0x3c5b59][_0x2843('0x4a')]);}}}})['catch'](function(_0x1fe6a5){logger[_0x2843('0x28')](JSON['stringify'](_0x1fe6a5));});}exports['run']=function(_0x7509c3){return getJobs(_0x7509c3);};exports[_0x2843('0x4f')]=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 972cc6a..7e82232 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 _0x2cb0=['detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','length','fileText','results','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','Comprehend'];(function(_0x296bee,_0x1d96b3){var _0x14e4f6=function(_0x2a76aa){while(--_0x2a76aa){_0x296bee['push'](_0x296bee['shift']());}};_0x14e4f6(++_0x1d96b3);}(_0x2cb0,0x12c));var _0x02cb=function(_0x265969,_0x29868e){_0x265969=_0x265969-0x0;var _0x560d7c=_0x2cb0[_0x265969];return _0x560d7c;};var _=require(_0x02cb('0x0'));var AWS=require(_0x02cb('0x1'));var rp=require('request-promise');var util=require(_0x02cb('0x2'));var BPromise=require(_0x02cb('0x3'));var db=require(_0x02cb('0x4'))['db'];var logger=require(_0x02cb('0x5'))('transcribe');function getTranscriptionJob(_0x29575b,_0x179a8b,_0x3f7743,_0x2fb292){return new Promise(function(_0x32cfdf,_0x452212){var _0x291240=new AWS[(_0x02cb('0x6'))]({'accessKeyId':_0x179a8b,'secretAccessKey':_0x29575b,'region':_0x3f7743});_0x291240['getTranscriptionJob']({'TranscriptionJobName':_0x2fb292},function(_0x175b98,_0x294182){if(_0x175b98){return _0x452212(_0x175b98);}else{return _0x32cfdf(_0x294182);}});});}function sentiment(_0x1fa694,_0x43a8d2,_0xcdfc87,_0x5a1efb,_0x1735c8){return new Promise(function(_0x847342,_0x2787a7){var _0x59511e=new AWS[(_0x02cb('0x7'))]({'accessKeyId':_0x43a8d2,'secretAccessKey':_0x1fa694,'region':_0xcdfc87});_0x59511e[_0x02cb('0x8')]({'Text':_0x5a1efb,'LanguageCode':_0x1735c8[_0x02cb('0x9')](0x0,0x2)},function(_0x8a6345,_0x4813fc){if(_0x8a6345){return _0x2787a7(_0x8a6345);}else{return _0x847342(_0x4813fc);}});});}function checkTranscribeJob(_0x2864c3,_0x19b326,_0x403cc9){var _0x6f43c0;return new BPromise(function(_0x45f349,_0x3d4b9c){logger['info'](util[_0x02cb('0xa')](_0x02cb('0xb'),_0x2864c3['id'],_0x2864c3[_0x02cb('0xc')]));return getTranscriptionJob(_0x403cc9['data1'],_0x403cc9[_0x02cb('0xd')],_0x19b326[_0x02cb('0xe')],_0x2864c3[_0x02cb('0xc')])[_0x02cb('0xf')](function(_0x1c88aa){logger['info'](util['format'](_0x02cb('0x10'),_0x2864c3['id'],_0x2864c3[_0x02cb('0xc')],_0x1c88aa[_0x02cb('0x11')][_0x02cb('0x12')]));if(!_0x2864c3['fileText']){switch(_0x1c88aa[_0x02cb('0x11')]['TranscriptionJobStatus']){case _0x02cb('0x13'):var _0x4cbb03={'transcribeStatus':_0x1c88aa[_0x02cb('0x11')][_0x02cb('0x12')],'fileUri':_0x1c88aa[_0x02cb('0x11')]['Transcript'][_0x02cb('0x14')]};logger['info'](util[_0x02cb('0xa')](_0x02cb('0x15'),_0x2864c3['id']));return rp({'uri':_0x1c88aa[_0x02cb('0x11')][_0x02cb('0x16')][_0x02cb('0x14')],'json':!![]})[_0x02cb('0xf')](function(_0x4c7bfe){logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x18'),_0x2864c3['id']));if(_0x4c7bfe&&_0x4c7bfe['results']&&_0x4c7bfe['results']['transcripts']&&_0x4c7bfe['results'][_0x02cb('0x19')][_0x02cb('0x1a')]){_0x4cbb03[_0x02cb('0x1b')]='';for(var _0x267b0f=0x0;_0x267b0f<_0x4c7bfe[_0x02cb('0x1c')][_0x02cb('0x19')][_0x02cb('0x1a')];_0x267b0f++){_0x4cbb03[_0x02cb('0x1b')]+=_0x4c7bfe[_0x02cb('0x1c')]['transcripts'][_0x267b0f][_0x02cb('0x1d')]+'';}}return _0x2864c3[_0x02cb('0x1e')](_0x4cbb03);})[_0x02cb('0xf')](function(){logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x1f'),_0x2864c3['id']));if(!_0x2864c3[_0x02cb('0x20')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x19b326['sentiment']||!_0x19b326[_0x02cb('0x23')]||!_0x19b326[_0x02cb('0x24')]||!_0x19b326[_0x02cb('0x25')]||!_0x19b326[_0x02cb('0x26')]){throw new db[(_0x02cb('0x21'))]['ValidationError'](_0x02cb('0x27'));}if(!_0x4cbb03['fileText']){throw new Error(_0x02cb('0x28'));}if(_0x19b326['sentimentAccountId']===_0x403cc9['id']){return _0x403cc9;}else{return db[_0x02cb('0x29')][_0x02cb('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3585f3){if(!_0x3585f3){throw new db['Sequelize']['ValidationError'](_0x02cb('0x2b'));}if(!_0x3585f3['data1']||!_0x3585f3[_0x02cb('0xd')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))](_0x02cb('0x2c'));}_0x6f43c0=_0x3585f3;logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x2d'),_0x2864c3['id']));return sentiment(_0x6f43c0[_0x02cb('0x2e')],_0x6f43c0[_0x02cb('0xd')],_0x19b326[_0x02cb('0x24')],_0x4cbb03[_0x02cb('0x1b')],_0x19b326[_0x02cb('0x25')]);})['then'](function(_0x5b35ea){logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x2f'),_0x2864c3['id']));return _0x2864c3[_0x02cb('0x1e')]({'sentiment':_0x5b35ea[_0x02cb('0x30')],'sPositive':_0x5b35ea[_0x02cb('0x31')][_0x02cb('0x32')],'sNegative':_0x5b35ea[_0x02cb('0x31')][_0x02cb('0x33')],'sMixed':_0x5b35ea[_0x02cb('0x31')][_0x02cb('0x34')],'sNeutral':_0x5b35ea[_0x02cb('0x31')][_0x02cb('0x35')]});})[_0x02cb('0xf')](function(){logger[_0x02cb('0x17')](util['format'](_0x02cb('0x1f'),_0x2864c3['id']));_0x45f349();});case _0x02cb('0x36'):return _0x2864c3[_0x02cb('0x1e')]({'transcribeStatus':_0x02cb('0x36'),'failureReason':_0x1c88aa[_0x02cb('0x11')][_0x02cb('0x37')]})['then'](function(){logger['info'](util[_0x02cb('0xa')](_0x02cb('0x1f'),_0x2864c3['id']));_0x45f349();});default:logger[_0x02cb('0x17')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2864c3['id']));break;}}else{return BPromise[_0x02cb('0x38')]()['then'](function(){if(!_0x2864c3[_0x02cb('0x20')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))](_0x02cb('0x39'));}if(!_0x19b326[_0x02cb('0x3a')]||!_0x19b326[_0x02cb('0x23')]||!_0x19b326[_0x02cb('0x24')]||!_0x19b326[_0x02cb('0x25')]||!_0x19b326['bucket']){throw new db['Sequelize'][(_0x02cb('0x22'))](_0x02cb('0x27'));}if(!_0x2864c3['fileText']){throw new Error(_0x02cb('0x28'));}if(_0x19b326[_0x02cb('0x23')]===_0x403cc9['id']){return _0x403cc9;}else{return db[_0x02cb('0x29')]['findOne']({'where':{'id':_settings[_0x02cb('0x23')]}});}})[_0x02cb('0xf')](function(_0x14981f){if(!_0x14981f){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x14981f[_0x02cb('0x2e')]||!_0x14981f[_0x02cb('0xd')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))](_0x02cb('0x2c'));}_0x6f43c0=_0x14981f;logger['info'](util['format'](_0x02cb('0x2d'),_0x2864c3['id']));return sentiment(_0x6f43c0['data1'],_0x6f43c0[_0x02cb('0xd')],_0x19b326['sentimentRegion'],_0x2864c3[_0x02cb('0x1b')],_0x19b326[_0x02cb('0x25')]);})[_0x02cb('0xf')](function(_0x2a9346){logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x2f'),_0x2864c3['id']));return _0x2864c3['update']({'sentiment':_0x2a9346[_0x02cb('0x30')],'sPositive':_0x2a9346[_0x02cb('0x31')][_0x02cb('0x32')],'sNegative':_0x2a9346['SentimentScore'][_0x02cb('0x33')],'sMixed':_0x2a9346[_0x02cb('0x31')][_0x02cb('0x34')],'sNeutral':_0x2a9346[_0x02cb('0x31')][_0x02cb('0x35')],'transcribeStatus':_0x02cb('0x13')});})[_0x02cb('0xf')](function(){logger['info'](util[_0x02cb('0xa')](_0x02cb('0x1f'),_0x2864c3['id']));_0x45f349();});}})[_0x02cb('0x3b')](function(_0xc77a54){if(_0xc77a54){if(!_0xc77a54[_0x02cb('0x3c')]||_0xc77a54[_0x02cb('0x3c')]!==_0x02cb('0x3d')){logger[_0x02cb('0x3e')](util['format'](_0x02cb('0x3f'),_0x2864c3['id']),util[_0x02cb('0x40')](_0xc77a54,{'showHidden':![],'depth':null}));}}_0x45f349();});});}function checkTranscribe(){var _0x3182c5;var _0x58c10c;var _0x41927f;return db[_0x02cb('0x41')][_0x02cb('0x42')]({'where':{'transcribeStatus':_0x02cb('0x43')}})[_0x02cb('0xf')](function(_0xc33f25){if(!_0xc33f25||!_0xc33f25[_0x02cb('0x1a')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))](_0x02cb('0x44'));}_0x3182c5=_0xc33f25;return db['Setting'][_0x02cb('0x2a')]({'where':{'id':0x1}});})[_0x02cb('0xf')](function(_0x163571){if(!_0x163571){throw new db['Sequelize'][(_0x02cb('0x22'))](_0x02cb('0x45'));}_0x58c10c=_0x163571;if(!_0x58c10c[_0x02cb('0x46')]||!_0x58c10c[_0x02cb('0x47')]||!_0x58c10c[_0x02cb('0xe')]||!_0x58c10c[_0x02cb('0x25')]||!_0x58c10c[_0x02cb('0x26')]){throw new db[(_0x02cb('0x21'))]['ValidationError'](_0x02cb('0x48'));}return db['CloudProvider'][_0x02cb('0x2a')]({'where':{'id':_0x58c10c[_0x02cb('0x47')]}});})[_0x02cb('0xf')](function(_0x50dcb3){if(!_0x50dcb3){throw new db['Sequelize'][(_0x02cb('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x50dcb3[_0x02cb('0x2e')]||!_0x50dcb3[_0x02cb('0xd')]){throw new db['Sequelize'][(_0x02cb('0x22'))](_0x02cb('0x2c'));}_0x41927f=_0x50dcb3;var _0x3de4ee=[];_0x3182c5[_0x02cb('0x49')](function(_0x2ca600){_0x3de4ee[_0x02cb('0x4a')](checkTranscribeJob(_0x2ca600,_0x58c10c,_0x41927f));});return BPromise[_0x02cb('0x4b')](_0x3de4ee);})[_0x02cb('0x3b')](function(_0x2f1b44){if(_0x2f1b44){if(!_0x2f1b44[_0x02cb('0x3c')]||_0x2f1b44['name']!==_0x02cb('0x3d')){logger[_0x02cb('0x3e')](util[_0x02cb('0x40')](_0x2f1b44,{'showHidden':![],'depth':null}));}}});}exports[_0x02cb('0x4c')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0c5d=['CloudProvider','findOne','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Cloud\x20Provider\x20not\x20available','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','error','start','lodash','aws-sdk','util','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','info','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available'];(function(_0x4cd629,_0x199bb3){var _0x1da6b2=function(_0x46351f){while(--_0x46351f){_0x4cd629['push'](_0x4cd629['shift']());}};_0x1da6b2(++_0x199bb3);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x4386df,_0x5d9fb5){_0x4386df=_0x4386df-0x0;var _0x4b9faf=_0x0c5d[_0x4386df];return _0x4b9faf;};var _=require(_0xd0c5('0x0'));var AWS=require(_0xd0c5('0x1'));var rp=require('request-promise');var util=require(_0xd0c5('0x2'));var BPromise=require('bluebird');var db=require(_0xd0c5('0x3'))['db'];var logger=require(_0xd0c5('0x4'))(_0xd0c5('0x5'));function getTranscriptionJob(_0x177811,_0x4664bc,_0xc3a9b9,_0x166636){return new Promise(function(_0x121911,_0x569992){var _0x2ef2f6=new AWS['TranscribeService']({'accessKeyId':_0x4664bc,'secretAccessKey':_0x177811,'region':_0xc3a9b9});_0x2ef2f6['getTranscriptionJob']({'TranscriptionJobName':_0x166636},function(_0x365e04,_0x4be307){if(_0x365e04){return _0x569992(_0x365e04);}else{return _0x121911(_0x4be307);}});});}function sentiment(_0x567113,_0x35969c,_0x227cb7,_0x50ed33,_0x33a77b){return new Promise(function(_0x3d53ab,_0x5ae844){var _0x458d02=new AWS[(_0xd0c5('0x6'))]({'accessKeyId':_0x35969c,'secretAccessKey':_0x567113,'region':_0x227cb7});_0x458d02[_0xd0c5('0x7')]({'Text':_0x50ed33,'LanguageCode':_0x33a77b[_0xd0c5('0x8')](0x0,0x2)},function(_0x3e5c01,_0x19ac1f){if(_0x3e5c01){return _0x5ae844(_0x3e5c01);}else{return _0x3d53ab(_0x19ac1f);}});});}function checkTranscribeJob(_0x1310cf,_0x46db00,_0x1e5ac4){var _0x125470;return new BPromise(function(_0x3c615a,_0x33a601){logger['info'](util[_0xd0c5('0x9')](_0xd0c5('0xa'),_0x1310cf['id'],_0x1310cf[_0xd0c5('0xb')]));return getTranscriptionJob(_0x1e5ac4[_0xd0c5('0xc')],_0x1e5ac4['data2'],_0x46db00[_0xd0c5('0xd')],_0x1310cf[_0xd0c5('0xb')])[_0xd0c5('0xe')](function(_0x639e72){logger['info'](util[_0xd0c5('0x9')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x1310cf['id'],_0x1310cf[_0xd0c5('0xb')],_0x639e72['TranscriptionJob'][_0xd0c5('0xf')]));if(!_0x1310cf[_0xd0c5('0x10')]){switch(_0x639e72[_0xd0c5('0x11')][_0xd0c5('0xf')]){case _0xd0c5('0x12'):var _0x410445={'transcribeStatus':_0x639e72[_0xd0c5('0x11')][_0xd0c5('0xf')],'fileUri':_0x639e72['TranscriptionJob'][_0xd0c5('0x13')][_0xd0c5('0x14')]};logger['info'](util[_0xd0c5('0x9')](_0xd0c5('0x15'),_0x1310cf['id']));return rp({'uri':_0x639e72[_0xd0c5('0x11')][_0xd0c5('0x13')][_0xd0c5('0x14')],'json':!![]})[_0xd0c5('0xe')](function(_0x331849){logger['info'](util['format'](_0xd0c5('0x16'),_0x1310cf['id']));if(_0x331849&&_0x331849[_0xd0c5('0x17')]&&_0x331849[_0xd0c5('0x17')][_0xd0c5('0x18')]&&_0x331849['results'][_0xd0c5('0x18')]['length']){_0x410445['fileText']='';for(var _0x3ec4ee=0x0;_0x3ec4ee<_0x331849[_0xd0c5('0x17')][_0xd0c5('0x18')][_0xd0c5('0x19')];_0x3ec4ee++){_0x410445[_0xd0c5('0x10')]+=_0x331849[_0xd0c5('0x17')][_0xd0c5('0x18')][_0x3ec4ee][_0xd0c5('0x1a')]+'';}}return _0x1310cf[_0xd0c5('0x1b')](_0x410445);})[_0xd0c5('0xe')](function(){logger[_0xd0c5('0x1c')](util[_0xd0c5('0x9')](_0xd0c5('0x1d'),_0x1310cf['id']));if(!_0x1310cf[_0xd0c5('0x1e')]){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))](_0xd0c5('0x21'));}if(!_0x46db00['sentiment']||!_0x46db00[_0xd0c5('0x22')]||!_0x46db00[_0xd0c5('0x23')]||!_0x46db00[_0xd0c5('0x24')]||!_0x46db00[_0xd0c5('0x25')]){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))](_0xd0c5('0x26'));}if(!_0x410445['fileText']){throw new Error(_0xd0c5('0x27'));}if(_0x46db00['sentimentAccountId']===_0x1e5ac4['id']){return _0x1e5ac4;}else{return db[_0xd0c5('0x28')][_0xd0c5('0x29')]({'where':{'id':_settings[_0xd0c5('0x22')]}});}})[_0xd0c5('0xe')](function(_0x2ff67a){if(!_0x2ff67a){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2ff67a['data1']||!_0x2ff67a[_0xd0c5('0x2a')]){throw new db['Sequelize'][(_0xd0c5('0x20'))](_0xd0c5('0x2b'));}_0x125470=_0x2ff67a;logger[_0xd0c5('0x1c')](util[_0xd0c5('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1310cf['id']));return sentiment(_0x125470[_0xd0c5('0xc')],_0x125470[_0xd0c5('0x2a')],_0x46db00['sentimentRegion'],_0x410445[_0xd0c5('0x10')],_0x46db00['language']);})[_0xd0c5('0xe')](function(_0x2bddff){logger[_0xd0c5('0x1c')](util['format'](_0xd0c5('0x2c'),_0x1310cf['id']));return _0x1310cf[_0xd0c5('0x1b')]({'sentiment':_0x2bddff[_0xd0c5('0x2d')],'sPositive':_0x2bddff[_0xd0c5('0x2e')][_0xd0c5('0x2f')],'sNegative':_0x2bddff[_0xd0c5('0x2e')][_0xd0c5('0x30')],'sMixed':_0x2bddff[_0xd0c5('0x2e')][_0xd0c5('0x31')],'sNeutral':_0x2bddff[_0xd0c5('0x2e')][_0xd0c5('0x32')]});})[_0xd0c5('0xe')](function(){logger[_0xd0c5('0x1c')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1310cf['id']));_0x3c615a();});case _0xd0c5('0x33'):return _0x1310cf['update']({'transcribeStatus':_0xd0c5('0x33'),'failureReason':_0x639e72[_0xd0c5('0x11')]['FailureReason']})[_0xd0c5('0xe')](function(){logger[_0xd0c5('0x1c')](util['format'](_0xd0c5('0x1d'),_0x1310cf['id']));_0x3c615a();});default:logger[_0xd0c5('0x1c')](util[_0xd0c5('0x9')](_0xd0c5('0x34'),_0x1310cf['id']));break;}}else{return BPromise[_0xd0c5('0x35')]()[_0xd0c5('0xe')](function(){if(!_0x1310cf[_0xd0c5('0x1e')]){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))](_0xd0c5('0x21'));}if(!_0x46db00[_0xd0c5('0x36')]||!_0x46db00[_0xd0c5('0x22')]||!_0x46db00[_0xd0c5('0x23')]||!_0x46db00['language']||!_0x46db00[_0xd0c5('0x25')]){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))](_0xd0c5('0x26'));}if(!_0x1310cf[_0xd0c5('0x10')]){throw new Error('Transcript\x20not\x20available');}if(_0x46db00['sentimentAccountId']===_0x1e5ac4['id']){return _0x1e5ac4;}else{return db[_0xd0c5('0x28')][_0xd0c5('0x29')]({'where':{'id':_settings[_0xd0c5('0x22')]}});}})[_0xd0c5('0xe')](function(_0x56dbb5){if(!_0x56dbb5){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))](_0xd0c5('0x37'));}if(!_0x56dbb5[_0xd0c5('0xc')]||!_0x56dbb5[_0xd0c5('0x2a')]){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x125470=_0x56dbb5;logger[_0xd0c5('0x1c')](util[_0xd0c5('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1310cf['id']));return sentiment(_0x125470[_0xd0c5('0xc')],_0x125470[_0xd0c5('0x2a')],_0x46db00[_0xd0c5('0x23')],_0x1310cf['fileText'],_0x46db00['language']);})['then'](function(_0x4a4b14){logger[_0xd0c5('0x1c')](util['format'](_0xd0c5('0x2c'),_0x1310cf['id']));return _0x1310cf['update']({'sentiment':_0x4a4b14[_0xd0c5('0x2d')],'sPositive':_0x4a4b14['SentimentScore'][_0xd0c5('0x2f')],'sNegative':_0x4a4b14[_0xd0c5('0x2e')][_0xd0c5('0x30')],'sMixed':_0x4a4b14[_0xd0c5('0x2e')][_0xd0c5('0x31')],'sNeutral':_0x4a4b14['SentimentScore'][_0xd0c5('0x32')],'transcribeStatus':_0xd0c5('0x12')});})[_0xd0c5('0xe')](function(){logger[_0xd0c5('0x1c')](util[_0xd0c5('0x9')](_0xd0c5('0x1d'),_0x1310cf['id']));_0x3c615a();});}})['catch'](function(_0x2a346f){if(_0x2a346f){if(!_0x2a346f[_0xd0c5('0x38')]||_0x2a346f[_0xd0c5('0x38')]!==_0xd0c5('0x39')){logger['error'](util[_0xd0c5('0x9')](_0xd0c5('0x3a'),_0x1310cf['id']),util[_0xd0c5('0x3b')](_0x2a346f,{'showHidden':![],'depth':null}));}}_0x3c615a();});});}function checkTranscribe(){var _0x32ddfd;var _0x305c37;var _0x43d0ad;return db[_0xd0c5('0x3c')][_0xd0c5('0x3d')]({'where':{'transcribeStatus':_0xd0c5('0x3e')}})[_0xd0c5('0xe')](function(_0x26fe06){if(!_0x26fe06||!_0x26fe06[_0xd0c5('0x19')]){throw new db['Sequelize']['ValidationError'](_0xd0c5('0x3f'));}_0x32ddfd=_0x26fe06;return db[_0xd0c5('0x40')][_0xd0c5('0x29')]({'where':{'id':0x1}});})[_0xd0c5('0xe')](function(_0x46134){if(!_0x46134){throw new db[(_0xd0c5('0x1f'))]['ValidationError'](_0xd0c5('0x41'));}_0x305c37=_0x46134;if(!_0x305c37[_0xd0c5('0x5')]||!_0x305c37[_0xd0c5('0x42')]||!_0x305c37[_0xd0c5('0xd')]||!_0x305c37[_0xd0c5('0x24')]||!_0x305c37[_0xd0c5('0x25')]){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))](_0xd0c5('0x43'));}return db[_0xd0c5('0x28')][_0xd0c5('0x29')]({'where':{'id':_0x305c37[_0xd0c5('0x42')]}});})[_0xd0c5('0xe')](function(_0x59cecb){if(!_0x59cecb){throw new db[(_0xd0c5('0x1f'))][(_0xd0c5('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x59cecb[_0xd0c5('0xc')]||!_0x59cecb['data2']){throw new db['Sequelize'][(_0xd0c5('0x20'))](_0xd0c5('0x2b'));}_0x43d0ad=_0x59cecb;var _0x3b2ee8=[];_0x32ddfd[_0xd0c5('0x44')](function(_0x4243ad){_0x3b2ee8[_0xd0c5('0x45')](checkTranscribeJob(_0x4243ad,_0x305c37,_0x43d0ad));});return BPromise[_0xd0c5('0x46')](_0x3b2ee8);})[_0xd0c5('0x47')](function(_0xb7a932){if(_0xb7a932){if(!_0xb7a932[_0xd0c5('0x38')]||_0xb7a932[_0xd0c5('0x38')]!==_0xd0c5('0x39')){logger[_0xd0c5('0x48')](util[_0xd0c5('0x3b')](_0xb7a932,{'showHidden':![],'depth':null}));}}});}exports[_0xd0c5('0x49')]=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 3db3707..4e923c0 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 _0xd916=['catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update'];(function(_0x36fa00,_0x221279){var _0x1549c4=function(_0x4effc2){while(--_0x4effc2){_0x36fa00['push'](_0x36fa00['shift']());}};_0x1549c4(++_0x221279);}(_0xd916,0x18a));var _0x6d91=function(_0x586974,_0x428a51){_0x586974=_0x586974-0x0;var _0x427108=_0xd916[_0x586974];return _0x427108;};'use strict';var _=require(_0x6d91('0x0'));var moment=require(_0x6d91('0x1'));var Redis=require(_0x6d91('0x2'));var util=require(_0x6d91('0x3'));var config=require(_0x6d91('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x6d91('0x5'))(_0x6d91('0x6'));config['redis']=_['defaults'](config[_0x6d91('0x7')],{'host':_0x6d91('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d91('0x7')]));function closeInteractions(){var _0x3fcd82=[];return db[_0x6d91('0x9')][_0x6d91('0xa')]({'raw':!![],'attributes':['id',_0x6d91('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6d91('0xc')](0x18,_0x6d91('0xd'))}}})['then'](function(_0x574d9e){if(_0x574d9e&&_0x574d9e['length']){_0x3fcd82=_['map'](_0x574d9e||[],'id');logger[_0x6d91('0xe')](_0x6d91('0xf'),_0x3fcd82[_0x6d91('0x10')]());return db[_0x6d91('0x9')][_0x6d91('0x11')]({'closeReason':'system','disposition':_0x6d91('0x12'),'closed':!![],'closedAt':moment()[_0x6d91('0x13')](_0x6d91('0x14'))},{'where':{'id':_0x3fcd82}});}})[_0x6d91('0x15')](function(){if(_0x3fcd82&&_0x3fcd82[_0x6d91('0x16')]){logger[_0x6d91('0xe')](_0x6d91('0x17'),_0x3fcd82[_0x6d91('0x10')]());for(var _0x12cc2b=0x0;_0x12cc2b<_0x3fcd82[_0x6d91('0x16')];_0x12cc2b++){io[_0x6d91('0x18')](_0x6d91('0x19'),{'id':_0x3fcd82[_0x12cc2b],'closed':!![]});}}})[_0x6d91('0x1a')](function(_0x1cdbeb){logger[_0x6d91('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1cdbeb?util[_0x6d91('0x1c')](_0x1cdbeb,{'showHidden':![],'depth':null}):'');});}exports[_0x6d91('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6d4b=['[WHATSAPP]\x20Interactions\x20to\x20close:','join','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x1e5b93,_0x35fbc2){_0x1e5b93=_0x1e5b93-0x0;var _0x24d87b=_0x6d4b[_0x1e5b93];return _0x24d87b;};'use strict';var _=require(_0xb6d4('0x0'));var moment=require(_0xb6d4('0x1'));var Redis=require(_0xb6d4('0x2'));var util=require('util');var config=require(_0xb6d4('0x3'));var db=require(_0xb6d4('0x4'))['db'];var logger=require('../logger')('schedule');config[_0xb6d4('0x5')]=_[_0xb6d4('0x6')](config[_0xb6d4('0x5')],{'host':_0xb6d4('0x7'),'port':0x18eb});var io=require(_0xb6d4('0x8'))(new Redis(config[_0xb6d4('0x5')]));function closeInteractions(){var _0x11498a=[];return db[_0xb6d4('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xb6d4('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb6d4('0xb')](0x18,_0xb6d4('0xc'))}}})[_0xb6d4('0xd')](function(_0x2effac){if(_0x2effac&&_0x2effac[_0xb6d4('0xe')]){_0x11498a=_[_0xb6d4('0xf')](_0x2effac||[],'id');logger[_0xb6d4('0x10')](_0xb6d4('0x11'),_0x11498a[_0xb6d4('0x12')]());return db['WhatsappInteraction']['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xb6d4('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x11498a}});}})[_0xb6d4('0xd')](function(){if(_0x11498a&&_0x11498a[_0xb6d4('0xe')]){logger[_0xb6d4('0x10')](_0xb6d4('0x14'),_0x11498a['join']());for(var _0xe8d726=0x0;_0xe8d726<_0x11498a[_0xb6d4('0xe')];_0xe8d726++){io['emit'](_0xb6d4('0x15'),{'id':_0x11498a[_0xe8d726],'closed':!![]});}}})['catch'](function(_0x4585ee){logger[_0xb6d4('0x16')](_0xb6d4('0x17'),_0x4585ee?util[_0xb6d4('0x18')](_0x4585ee,{'showHidden':![],'depth':null}):'');});}exports[_0xb6d4('0x19')]=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 f881c0e..5c515f9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe04b=['contacts2','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','contacts1','CmHopper','bulkCreate','log','finished\x20populating'];(function(_0x4b4d99,_0x57d8dd){var _0x9759d1=function(_0x5d1362){while(--_0x5d1362){_0x4b4d99['push'](_0x4b4d99['shift']());}};_0x9759d1(++_0x57d8dd);}(_0xe04b,0x17f));var _0xbe04=function(_0x628890,_0x17a9e1){_0x628890=_0x628890-0x0;var _0x8d58c9=_0xe04b[_0x628890];return _0x8d58c9;};'use strict';var util=require(_0xbe04('0x0'));var db=require(_0xbe04('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbe04('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xbe04('0x3')+i,'phone':0xf879fb460+i,'email':_0xbe04('0x4')+i+_0xbe04('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbe04('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbe04('0x2')]({'id':i,'firstName':_0xbe04('0x7')+i,'lastName':_0xbe04('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xbe04('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbe04('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xbe04('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbe04('0x6')](),'updatedAt':Date[_0xbe04('0x6')]()});}db[_0xbe04('0x8')][_0xbe04('0x9')]({'where':{}})[_0xbe04('0xa')](function(){return db[_0xbe04('0x8')]['bulkCreate'](contacts);})[_0xbe04('0xa')](function(){console['log']('finished\x20populating',_0xbe04('0xb'));return db[_0xbe04('0xc')][_0xbe04('0x9')]({'where':{}});})[_0xbe04('0xa')](function(){return db[_0xbe04('0xc')][_0xbe04('0xd')](hopper);})['then'](function(){console[_0xbe04('0xe')](_0xbe04('0xf'),'hopper1');return db[_0xbe04('0x8')][_0xbe04('0xd')](contacts2);})[_0xbe04('0xa')](function(){console[_0xbe04('0xe')](_0xbe04('0xf'),_0xbe04('0x10'));return db[_0xbe04('0xc')][_0xbe04('0xd')](hopper2);})[_0xbe04('0xa')](function(){console[_0xbe04('0xe')](_0xbe04('0xf'),_0xbe04('0x11'));})[_0xbe04('0x12')](function(_0xc40074){console[_0xbe04('0xe')](_0xc40074);}); \ No newline at end of file +var _0x9488=['contacts1','CmHopper','contacts2','catch','util','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating'];(function(_0x355235,_0x5517f9){var _0x104ea0=function(_0xdcef4){while(--_0xdcef4){_0x355235['push'](_0x355235['shift']());}};_0x104ea0(++_0x5517f9);}(_0x9488,0x1e0));var _0x8948=function(_0x3f389a,_0x1efad3){_0x3f389a=_0x3f389a-0x0;var _0x13c91d=_0x9488[_0x3f389a];return _0x13c91d;};'use strict';var util=require(_0x8948('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8948('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x8948('0x2')+i,'phone':0xf879fb460+i,'email':_0x8948('0x3')+i+_0x8948('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8948('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x8948('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x8948('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8948('0x1')]({'id':i,'firstName':_0x8948('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x8948('0x3')+i+_0x8948('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8948('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8948('0x5')](),'updatedAt':Date[_0x8948('0x5')]()});}db[_0x8948('0x7')][_0x8948('0x8')]({'where':{}})[_0x8948('0x9')](function(){return db[_0x8948('0x7')][_0x8948('0xa')](contacts);})[_0x8948('0x9')](function(){console[_0x8948('0xb')](_0x8948('0xc'),_0x8948('0xd'));return db[_0x8948('0xe')][_0x8948('0x8')]({'where':{}});})[_0x8948('0x9')](function(){return db[_0x8948('0xe')][_0x8948('0xa')](hopper);})[_0x8948('0x9')](function(){console['log']('finished\x20populating','hopper1');return db[_0x8948('0x7')]['bulkCreate'](contacts2);})[_0x8948('0x9')](function(){console[_0x8948('0xb')](_0x8948('0xc'),_0x8948('0xf'));return db[_0x8948('0xe')][_0x8948('0xa')](hopper2);})[_0x8948('0x9')](function(){console[_0x8948('0xb')]('finished\x20populating','hopper2');})[_0x8948('0x10')](function(_0x781a0d){console[_0x8948('0xb')](_0x781a0d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e00672b..6a63584 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e18=['push','%s%s','format','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','then','log','add\x20user','catch','util','../mysqldb'];(function(_0x5cbb32,_0x233ace){var _0x49363c=function(_0x4649d1){while(--_0x4649d1){_0x5cbb32['push'](_0x5cbb32['shift']());}};_0x49363c(++_0x233ace);}(_0x3e18,0x9e));var _0x83e1=function(_0x5d418b,_0x203346){_0x5d418b=_0x5d418b-0x0;var _0x4cd42c=_0x3e18[_0x5d418b];return _0x4cd42c;};'use strict';var util=require(_0x83e1('0x0'));var db=require(_0x83e1('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x83e1('0x2')]({'name':util['format'](_0x83e1('0x3'),'agent',i),'fullname':util[_0x83e1('0x4')](_0x83e1('0x3'),_0x83e1('0x5'),i),'email':util[_0x83e1('0x4')](_0x83e1('0x6'),'agent',i),'role':_0x83e1('0x5'),'password':_0x83e1('0x7'),'internal':0xfa0+i,'type':_0x83e1('0x8'),'transport':[_0x83e1('0x9'),'ws',_0x83e1('0xa')],'disallow':['all'],'allow':[_0x83e1('0xb')],'defaultuser':util[_0x83e1('0x4')](_0x83e1('0x3'),_0x83e1('0x5'),i),'encryption':'yes','avpf':_0x83e1('0xc'),'force_avp':_0x83e1('0xc'),'icesupport':_0x83e1('0xc'),'dtlsenable':_0x83e1('0xc'),'dtlsverify':'no','dtlscertfile':_0x83e1('0xd'),'dtlsprivatekey':_0x83e1('0xe'),'dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x83e1('0x4')]('%s%s',_0x83e1('0x5'),i),0xfa0+i)});}db[_0x83e1('0xf')]['bulkCreate'](users)[_0x83e1('0x10')](function(){console[_0x83e1('0x11')](_0x83e1('0x12'));})[_0x83e1('0x13')](function(_0x310e64){console[_0x83e1('0x11')](_0x310e64);}); \ No newline at end of file +var _0x237c=['%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','push','format'];(function(_0x2c69eb,_0x2ad177){var _0x2f4c35=function(_0x3565f6){while(--_0x3565f6){_0x2c69eb['push'](_0x2c69eb['shift']());}};_0x2f4c35(++_0x2ad177);}(_0x237c,0xba));var _0xc237=function(_0x32680b,_0x29b728){_0x32680b=_0x32680b-0x0;var _0x192ec1=_0x237c[_0x32680b];return _0x192ec1;};'use strict';var util=require(_0xc237('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xc237('0x1')]({'name':util[_0xc237('0x2')](_0xc237('0x3'),_0xc237('0x4'),i),'fullname':util[_0xc237('0x2')]('%s%s',_0xc237('0x4'),i),'email':util['format'](_0xc237('0x5'),_0xc237('0x4'),i),'role':'agent','password':_0xc237('0x6'),'internal':0xfa0+i,'type':_0xc237('0x7'),'transport':[_0xc237('0x8'),'ws','wss'],'disallow':[_0xc237('0x9')],'allow':[_0xc237('0xa')],'defaultuser':util[_0xc237('0x2')](_0xc237('0x3'),_0xc237('0x4'),i),'encryption':_0xc237('0xb'),'avpf':_0xc237('0xb'),'force_avp':_0xc237('0xb'),'icesupport':_0xc237('0xb'),'dtlsenable':_0xc237('0xb'),'dtlsverify':'no','dtlscertfile':_0xc237('0xc'),'dtlsprivatekey':_0xc237('0xd'),'dtlssetup':_0xc237('0xe'),'callerid':util[_0xc237('0x2')](_0xc237('0xf'),util['format'](_0xc237('0x3'),'agent',i),0xfa0+i)});}db['User'][_0xc237('0x10')](users)[_0xc237('0x11')](function(){console[_0xc237('0x12')](_0xc237('0x13'));})[_0xc237('0x14')](function(_0x411f58){console['log'](_0x411f58);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8dec78b..e1c01b5 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb90a=['CONNECTED','lodash','util','../mysqldb','role','agent','name','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','telephone','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','voice:outbound','FaxQueue','MailQueues','getVoiceQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','sms','telephone:%s','trunk:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','remoteAddress','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED'];(function(_0x50f4e1,_0x487c31){var _0x464661=function(_0x1ef8b6){while(--_0x1ef8b6){_0x50f4e1['push'](_0x50f4e1['shift']());}};_0x464661(++_0x487c31);}(_0xb90a,0x12a));var _0xab90=function(_0x483a6f,_0x5c11bd){_0x483a6f=_0x483a6f-0x0;var _0x1fc2df=_0xb90a[_0x483a6f];return _0x1fc2df;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var BPromise=require('bluebird');var db=require(_0xab90('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0xab90('0x3')],'raw':!![],'where':{'role':_0xab90('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xab90('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xab90('0x5')],'where':{'role':_0xab90('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xab90('0x6')],'where':{'type':_0xab90('0x7')}};function getAssociatedResources(_0x3a0f26,_0x1e7b79,_0x93af2f){return db[_0xab90('0x8')][_0xab90('0x9')]({'where':{'name':_0x3a0f26,'userProfileId':_0x1e7b79},'raw':!![]})[_0xab90('0xa')](function(_0x4b90b0){if(_0x4b90b0){if(_0x4b90b0[_0xab90('0xb')]){switch(_0x3a0f26){case _0xab90('0xc'):case _0xab90('0xd'):case _0xab90('0xe'):case _0xab90('0xf'):case'MailQueues':case _0xab90('0x10'):case _0xab90('0x11'):return db[_0x93af2f][_0xab90('0x12')](queryQueues);case _0xab90('0x13'):return db[_0x93af2f][_0xab90('0x12')](queryTelephones);case _0xab90('0x14'):return db[_0x93af2f][_0xab90('0x12')](queryTrunks);case _0xab90('0x15'):return db[_0x93af2f][_0xab90('0x12')](queryCampaigns);}}else{return db[_0xab90('0x16')][_0xab90('0x12')]({'attributes':[_0xab90('0x17')],'where':{'sectionId':_0x4b90b0['id']},'raw':!![]})[_0xab90('0xa')](function(_0x556828){if(_0x556828){var _0x282723={'where':{'id':_['map'](_0x556828,_0xab90('0x17'))},'raw':!![]};switch(_0x93af2f){case _0xab90('0x18'):_0x282723['where'][_0xab90('0x3')]=_0xab90('0x19');break;case _0xab90('0x1a'):_0x282723['where'][_0xab90('0x6')]=_0xab90('0x7');break;}return db[_0x93af2f][_0xab90('0x12')](_0x282723);}else{return[];}});}}else{return[];}})[_0xab90('0xa')](function(_0x4fd042){return _0x4fd042;});}function joinOrLeaveQueues(_0x2f6904,_0x5d7c8e,_0x30d6b3,_0x5d5dda){_0x2f6904[_0x5d7c8e](util[_0xab90('0x1b')](_0xab90('0x1c'),_0x30d6b3,_0x5d5dda[_0xab90('0x5')]));if(_0x5d5dda[_0xab90('0x1d')]){for(var _0x5d5c1c=0x0;_0x5d5c1c<_0x5d5dda[_0xab90('0x1d')][_0xab90('0x1e')];_0x5d5c1c+=0x1){_0x2f6904[_0x5d7c8e](util[_0xab90('0x1b')](_0xab90('0x1f'),_0x5d5dda[_0xab90('0x1d')][_0x5d5c1c][_0xab90('0x5')]));}}}function joinOrLeave(_0x281e45,_0x210b5e,_0x84eb68){var _0x2cdc7f;if(_0x281e45[_0xab90('0x20')][_0xab90('0x21')]['id']){db[_0xab90('0x18')][_0xab90('0x22')]({'attributes':['id','name',_0xab90('0x3'),_0xab90('0x23')],'where':{'id':_0x281e45[_0xab90('0x20')][_0xab90('0x21')]['id']},'include':[{'model':db[_0xab90('0x24')],'as':_0xab90('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xab90('0x26')],'as':_0xab90('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xab90('0x28')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xab90('0x29')],'as':_0xab90('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xab90('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xab90('0x2c')],'as':_0xab90('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xab90('0xa')](function(_0x24e562){if(_0x24e562){_0x2cdc7f=_0x24e562;_0x281e45[_0x210b5e](util[_0xab90('0x1b')](_0xab90('0x1f'),_0x24e562[_0xab90('0x5')]));var _0xe23096=[];switch(_0x24e562[_0xab90('0x3')]){case'admin':_0x281e45[_0x210b5e]('voice:inbound');_0x281e45[_0x210b5e]('voice:outbound');if(queryQueues[_0xab90('0x2e')]('include')){delete queryQueues[_0xab90('0x2f')];}_0xe23096[_0xab90('0x30')](db[_0xab90('0x31')][_0xab90('0x12')](queryQueues));_0xe23096['push'](db[_0xab90('0x32')][_0xab90('0x12')](queryQueues));_0xe23096[_0xab90('0x30')](db['FaxQueue']['findAll'](queryQueues));_0xe23096[_0xab90('0x30')](db[_0xab90('0x33')][_0xab90('0x12')](queryQueues));_0xe23096[_0xab90('0x30')](db[_0xab90('0x34')][_0xab90('0x12')](queryQueues));_0xe23096[_0xab90('0x30')](db[_0xab90('0x35')][_0xab90('0x12')](queryQueues));_0xe23096[_0xab90('0x30')](db[_0xab90('0x36')]['findAll'](queryQueues));_0xe23096[_0xab90('0x30')](db[_0xab90('0x18')][_0xab90('0x12')](queryTelephones));_0xe23096[_0xab90('0x30')](db[_0xab90('0x37')]['findAll'](queryTrunks));_0xe23096[_0xab90('0x30')](db[_0xab90('0x1a')][_0xab90('0x12')](queryCampaigns));_0xe23096['push'](db[_0xab90('0x18')][_0xab90('0x12')](queryAgents));break;case _0xab90('0x38'):_0x281e45[_0x210b5e](_0xab90('0x39'));_0x281e45[_0x210b5e](_0xab90('0x3a'));_0xe23096[_0xab90('0x30')](getAssociatedResources('VoiceQueues',_0x24e562[_0xab90('0x23')],'VoiceQueue'));_0xe23096[_0xab90('0x30')](getAssociatedResources(_0xab90('0xd'),_0x24e562['userProfileId'],_0xab90('0x32')));_0xe23096['push'](getAssociatedResources(_0xab90('0xe'),_0x24e562[_0xab90('0x23')],_0xab90('0x3b')));_0xe23096[_0xab90('0x30')](getAssociatedResources(_0xab90('0xf'),_0x24e562['userProfileId'],_0xab90('0x33')));_0xe23096['push'](getAssociatedResources(_0xab90('0x3c'),_0x24e562[_0xab90('0x23')],'MailQueue'));_0xe23096[_0xab90('0x30')](getAssociatedResources(_0xab90('0x10'),_0x24e562[_0xab90('0x23')],'OpenchannelQueue'));_0xe23096[_0xab90('0x30')](getAssociatedResources(_0xab90('0x11'),_0x24e562['userProfileId'],'WhatsappQueue'));_0xe23096[_0xab90('0x30')](getAssociatedResources(_0xab90('0x13'),_0x24e562[_0xab90('0x23')],_0xab90('0x18')));_0xe23096[_0xab90('0x30')](getAssociatedResources(_0xab90('0x14'),_0x24e562[_0xab90('0x23')],'Trunk'));_0xe23096[_0xab90('0x30')](getAssociatedResources('IvrCampaigns',_0x24e562[_0xab90('0x23')],'Campaign'));_0xe23096[_0xab90('0x30')](db[_0xab90('0x18')][_0xab90('0x12')](queryAgents));break;case _0xab90('0x4'):_0x281e45[_0x210b5e](_0xab90('0x39'));_0x281e45[_0x210b5e](_0xab90('0x3a'));_0xe23096[_0xab90('0x30')](_0x24e562[_0xab90('0x3d')]({'attributes':['id','name']}));_0xe23096['push'](_0x24e562['getChatQueues']({'attributes':['id','name']}));_0xe23096[_0xab90('0x30')](_0x24e562['getFaxQueues']({'attributes':['id',_0xab90('0x5')]}));_0xe23096[_0xab90('0x30')](_0x24e562[_0xab90('0x3e')]({'attributes':['id',_0xab90('0x5')]}));_0xe23096[_0xab90('0x30')](_0x24e562['getMailQueues']({'attributes':['id',_0xab90('0x5')]}));_0xe23096['push'](_0x24e562[_0xab90('0x3f')]({'attributes':['id',_0xab90('0x5')]}));_0xe23096['push'](_0x24e562[_0xab90('0x40')]({'attributes':['id',_0xab90('0x5')]}));break;}return BPromise[_0xab90('0x41')](_0xe23096);}})[_0xab90('0xa')](function(_0x22aa04){if(_0x22aa04&&_0x22aa04[_0xab90('0x1e')]){for(var _0x4d534b=0x0;_0x4d534b<_0x22aa04[_0xab90('0x1e')];_0x4d534b+=0x1){for(var _0x55e1e1=0x0;_0x55e1e1<_0x22aa04[_0x4d534b][_0xab90('0x1e')];_0x55e1e1+=0x1){switch(_0x4d534b){case 0x0:joinOrLeaveQueues(_0x281e45,_0x210b5e,'voice',_0x22aa04[_0x4d534b][_0x55e1e1]);break;case 0x1:joinOrLeaveQueues(_0x281e45,_0x210b5e,_0xab90('0x42'),_0x22aa04[_0x4d534b][_0x55e1e1]);break;case 0x2:joinOrLeaveQueues(_0x281e45,_0x210b5e,'fax',_0x22aa04[_0x4d534b][_0x55e1e1]);break;case 0x3:joinOrLeaveQueues(_0x281e45,_0x210b5e,_0xab90('0x43'),_0x22aa04[_0x4d534b][_0x55e1e1]);break;case 0x4:joinOrLeaveQueues(_0x281e45,_0x210b5e,'mail',_0x22aa04[_0x4d534b][_0x55e1e1]);break;case 0x5:joinOrLeaveQueues(_0x281e45,_0x210b5e,'openchannel',_0x22aa04[_0x4d534b][_0x55e1e1]);break;case 0x6:joinOrLeaveQueues(_0x281e45,_0x210b5e,'whatsapp',_0x22aa04[_0x4d534b][_0x55e1e1]);break;case 0x7:if(_0x2cdc7f[_0xab90('0x3')]!==_0xab90('0x4'))_0x281e45[_0x210b5e](util[_0xab90('0x1b')](_0xab90('0x44'),_0x22aa04[_0x4d534b][_0x55e1e1][_0xab90('0x5')]));break;case 0x8:if(_0x2cdc7f[_0xab90('0x3')]!==_0xab90('0x4'))_0x281e45[_0x210b5e](util[_0xab90('0x1b')](_0xab90('0x45'),_0x22aa04[_0x4d534b][_0x55e1e1]['name']));break;case 0x9:if(_0x2cdc7f[_0xab90('0x3')]!==_0xab90('0x4'))_0x281e45[_0x210b5e](util[_0xab90('0x1b')]('campaign:%s:%s',_0x22aa04[_0x4d534b][_0x55e1e1]['type'],_0x22aa04[_0x4d534b][_0x55e1e1][_0xab90('0x5')]));break;case 0xa:_0x281e45[_0x210b5e](util[_0xab90('0x1b')](_0xab90('0x1f'),_0x22aa04[_0x4d534b][_0x55e1e1]['name']));break;}}}}})[_0xab90('0xa')](function(){if(_0x210b5e===_0xab90('0x46')){var _0x290ea3=_[_0xab90('0x47')](_0x2cdc7f[_0xab90('0x25')],'id');return _0x2cdc7f[_0xab90('0x48')](_0x290ea3)[_0xab90('0xa')](function(){for(var _0x505cb0=0x0;_0x505cb0<_0x290ea3[_0xab90('0x1e')];_0x505cb0+=0x1){_0x84eb68[_0xab90('0x49')](_0xab90('0x4a'),{'ChatInteractionId':Number(_0x290ea3[_0x505cb0]),'UserId':Number(_0x2cdc7f['id'])});}});}})[_0xab90('0xa')](function(){if(_0x210b5e===_0xab90('0x46')){var _0x4d2ced=_[_0xab90('0x47')](_0x2cdc7f[_0xab90('0x27')],'id');return _0x2cdc7f[_0xab90('0x4b')](_0x4d2ced)[_0xab90('0xa')](function(){for(var _0x2cc9c0=0x0;_0x2cc9c0<_0x4d2ced[_0xab90('0x1e')];_0x2cc9c0+=0x1){_0x84eb68[_0xab90('0x49')](_0xab90('0x4c'),{'MailInteractionId':Number(_0x4d2ced[_0x2cc9c0]),'UserId':Number(_0x2cdc7f['id'])});}});}})[_0xab90('0xa')](function(){if(_0x210b5e===_0xab90('0x46')){var _0x489c71=_[_0xab90('0x47')](_0x2cdc7f[_0xab90('0x4d')],'id');return _0x2cdc7f[_0xab90('0x4e')](_0x489c71)['then'](function(){for(var _0x392eca=0x0;_0x392eca<_0x489c71[_0xab90('0x1e')];_0x392eca+=0x1){_0x84eb68[_0xab90('0x49')](_0xab90('0x4f'),{'FaxInteractionId':Number(_0x489c71[_0x392eca]),'UserId':Number(_0x2cdc7f['id'])});}});}})[_0xab90('0xa')](function(){if(_0x210b5e===_0xab90('0x46')){var _0x4e4341=_[_0xab90('0x47')](_0x2cdc7f[_0xab90('0x2a')],'id');return _0x2cdc7f[_0xab90('0x50')](_0x4e4341)[_0xab90('0xa')](function(){for(var _0x3f4b11=0x0;_0x3f4b11<_0x4e4341[_0xab90('0x1e')];_0x3f4b11+=0x1){_0x84eb68[_0xab90('0x49')](_0xab90('0x51'),{'SmsInteractionId':Number(_0x4e4341[_0x3f4b11]),'UserId':Number(_0x2cdc7f['id'])});}});}})[_0xab90('0xa')](function(){if(_0x210b5e===_0xab90('0x46')){var _0x6b6d33=_[_0xab90('0x47')](_0x2cdc7f[_0xab90('0x2b')],'id');return _0x2cdc7f[_0xab90('0x52')](_0x6b6d33)[_0xab90('0xa')](function(){for(var _0x21436e=0x0;_0x21436e<_0x6b6d33[_0xab90('0x1e')];_0x21436e+=0x1){_0x84eb68[_0xab90('0x49')](_0xab90('0x53'),{'OpenchannelInteractionId':Number(_0x6b6d33[_0x21436e]),'UserId':Number(_0x2cdc7f['id'])});}});}})[_0xab90('0xa')](function(){if(_0x210b5e===_0xab90('0x46')){var _0x3e605c=_['map'](_0x2cdc7f[_0xab90('0x2d')],'id');return _0x2cdc7f['removeWhatsappInteractions'](_0x3e605c)[_0xab90('0xa')](function(){for(var _0x1465e8=0x0;_0x1465e8<_0x3e605c['length'];_0x1465e8+=0x1){_0x84eb68[_0xab90('0x49')](_0xab90('0x54'),{'WhatsappInteractionId':Number(_0x3e605c[_0x1465e8]),'UserId':Number(_0x2cdc7f['id'])});}});}})[_0xab90('0x55')](function(_0x44922a){_0x281e45[_0xab90('0x56')](_0x44922a);});}}function onDisconnect(_0x53c7fb,_0x441aab){joinOrLeave(_0x53c7fb,_0xab90('0x46'),_0x441aab);}function onConnect(_0x2314e6){joinOrLeave(_0x2314e6,_0xab90('0x57'));}exports['default']=function(_0xa72420){_0xa72420['on'](_0xab90('0x58'),function(_0x7f275b){_0x7f275b[_0xab90('0x59')](0x0);_0x7f275b[_0xab90('0x5a')]=_0x7f275b['request'][_0xab90('0x58')][_0xab90('0x5b')]+':'+_0x7f275b[_0xab90('0x5c')]['connection'][_0xab90('0x5d')];_0x7f275b['connectedAt']=new Date();_0x7f275b[_0xab90('0x56')]=function(_0x332ea2){console[_0xab90('0x56')](_0xab90('0x5e')+_0x7f275b[_0xab90('0x5f')][_0xab90('0x5')]+'['+_0x7f275b[_0xab90('0x5a')]+']',_0x332ea2);};_0x7f275b['on'](_0xab90('0x60'),function(){onDisconnect(_0x7f275b,_0xa72420);_0x7f275b[_0xab90('0x56')](_0xab90('0x61'));});onConnect(_0x7f275b);_0x7f275b[_0xab90('0x56')](_0xab90('0x62'));});}; \ No newline at end of file +var _0x2d95=['emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','Agents','role','agent','telephone','type','ivr','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','then','map','User','Campaign','where','format','length','handshake','find','userProfileId','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','push','WhatsappQueue','SmsQueues','MailQueue','Telephones','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','voice','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions'];(function(_0x1ebce3,_0x1c0f76){var _0x1ece9e=function(_0x3b0d7e){while(--_0x3b0d7e){_0x1ebce3['push'](_0x1ebce3['shift']());}};_0x1ece9e(++_0x1c0f76);}(_0x2d95,0xca));var _0x52d9=function(_0x2d8c5c,_0x556170){_0x2d8c5c=_0x2d8c5c-0x0;var _0x272878=_0x2d95[_0x2d8c5c];return _0x272878;};'use strict';var _=require(_0x52d9('0x0'));var util=require('util');var BPromise=require(_0x52d9('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x52d9('0x2'));var queryQueues={'attributes':['id',_0x52d9('0x3')],'include':[{'as':_0x52d9('0x4'),'model':db['User'],'attributes':['id',_0x52d9('0x3'),_0x52d9('0x5')],'raw':!![],'where':{'role':_0x52d9('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x52d9('0x3')],'where':{'role':_0x52d9('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x52d9('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x52d9('0x3')],'where':{'role':_0x52d9('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x52d9('0x3'),_0x52d9('0x8')],'where':{'type':_0x52d9('0x9')}};function getAssociatedResources(_0x20991e,_0x1de511,_0x3fdc35){return db['UserProfileSection']['findOne']({'where':{'name':_0x20991e,'userProfileId':_0x1de511},'raw':!![]})['then'](function(_0x28dbf4){if(_0x28dbf4){if(_0x28dbf4[_0x52d9('0xa')]){switch(_0x20991e){case _0x52d9('0xb'):case _0x52d9('0xc'):case _0x52d9('0xd'):case'SmsQueues':case _0x52d9('0xe'):case _0x52d9('0xf'):case _0x52d9('0x10'):return db[_0x3fdc35][_0x52d9('0x11')](queryQueues);case'Telephones':return db[_0x3fdc35]['findAll'](queryTelephones);case _0x52d9('0x12'):return db[_0x3fdc35][_0x52d9('0x11')](queryTrunks);case _0x52d9('0x13'):return db[_0x3fdc35][_0x52d9('0x11')](queryCampaigns);}}else{return db[_0x52d9('0x14')][_0x52d9('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x28dbf4['id']},'raw':!![]})[_0x52d9('0x15')](function(_0x1d5829){if(_0x1d5829){var _0x96753a={'where':{'id':_[_0x52d9('0x16')](_0x1d5829,'resourceId')},'raw':!![]};switch(_0x3fdc35){case _0x52d9('0x17'):_0x96753a['where'][_0x52d9('0x5')]='telephone';break;case _0x52d9('0x18'):_0x96753a[_0x52d9('0x19')][_0x52d9('0x8')]=_0x52d9('0x9');break;}return db[_0x3fdc35][_0x52d9('0x11')](_0x96753a);}else{return[];}});}}else{return[];}})[_0x52d9('0x15')](function(_0x2cbc92){return _0x2cbc92;});}function joinOrLeaveQueues(_0x59c889,_0x1c3c37,_0x1653f3,_0xc12e87){_0x59c889[_0x1c3c37](util[_0x52d9('0x1a')]('%s:queue:%s',_0x1653f3,_0xc12e87[_0x52d9('0x3')]));if(_0xc12e87[_0x52d9('0x4')]){for(var _0x5a8306=0x0;_0x5a8306<_0xc12e87[_0x52d9('0x4')][_0x52d9('0x1b')];_0x5a8306+=0x1){_0x59c889[_0x1c3c37](util[_0x52d9('0x1a')]('user:%s',_0xc12e87['Agents'][_0x5a8306][_0x52d9('0x3')]));}}}function joinOrLeave(_0x29a2f4,_0x1b287b,_0x28d8b5){var _0x40bab5;if(_0x29a2f4[_0x52d9('0x1c')]['query']['id']){db['User'][_0x52d9('0x1d')]({'attributes':['id',_0x52d9('0x3'),_0x52d9('0x5'),_0x52d9('0x1e')],'where':{'id':_0x29a2f4[_0x52d9('0x1c')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x52d9('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x52d9('0x20'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x52d9('0x21'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x52d9('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x52d9('0x23')],'as':_0x52d9('0x24'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x165883){if(_0x165883){_0x40bab5=_0x165883;_0x29a2f4[_0x1b287b](util[_0x52d9('0x1a')](_0x52d9('0x25'),_0x165883[_0x52d9('0x3')]));var _0xfb9a84=[];switch(_0x165883[_0x52d9('0x5')]){case _0x52d9('0x26'):_0x29a2f4[_0x1b287b](_0x52d9('0x27'));_0x29a2f4[_0x1b287b](_0x52d9('0x28'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x52d9('0x29')];}_0xfb9a84['push'](db[_0x52d9('0x2a')][_0x52d9('0x11')](queryQueues));_0xfb9a84['push'](db[_0x52d9('0x2b')][_0x52d9('0x11')](queryQueues));_0xfb9a84['push'](db[_0x52d9('0x2c')][_0x52d9('0x11')](queryQueues));_0xfb9a84['push'](db[_0x52d9('0x2d')][_0x52d9('0x11')](queryQueues));_0xfb9a84[_0x52d9('0x2e')](db['MailQueue'][_0x52d9('0x11')](queryQueues));_0xfb9a84['push'](db['OpenchannelQueue'][_0x52d9('0x11')](queryQueues));_0xfb9a84[_0x52d9('0x2e')](db[_0x52d9('0x2f')]['findAll'](queryQueues));_0xfb9a84[_0x52d9('0x2e')](db[_0x52d9('0x17')][_0x52d9('0x11')](queryTelephones));_0xfb9a84[_0x52d9('0x2e')](db['Trunk'][_0x52d9('0x11')](queryTrunks));_0xfb9a84[_0x52d9('0x2e')](db[_0x52d9('0x18')]['findAll'](queryCampaigns));_0xfb9a84['push'](db['User'][_0x52d9('0x11')](queryAgents));break;case'user':_0x29a2f4[_0x1b287b](_0x52d9('0x27'));_0x29a2f4[_0x1b287b]('voice:outbound');_0xfb9a84[_0x52d9('0x2e')](getAssociatedResources(_0x52d9('0xb'),_0x165883[_0x52d9('0x1e')],_0x52d9('0x2a')));_0xfb9a84['push'](getAssociatedResources(_0x52d9('0xc'),_0x165883[_0x52d9('0x1e')],'ChatQueue'));_0xfb9a84[_0x52d9('0x2e')](getAssociatedResources(_0x52d9('0xd'),_0x165883['userProfileId'],_0x52d9('0x2c')));_0xfb9a84[_0x52d9('0x2e')](getAssociatedResources(_0x52d9('0x30'),_0x165883[_0x52d9('0x1e')],_0x52d9('0x2d')));_0xfb9a84['push'](getAssociatedResources(_0x52d9('0xe'),_0x165883['userProfileId'],_0x52d9('0x31')));_0xfb9a84[_0x52d9('0x2e')](getAssociatedResources(_0x52d9('0xf'),_0x165883[_0x52d9('0x1e')],'OpenchannelQueue'));_0xfb9a84[_0x52d9('0x2e')](getAssociatedResources(_0x52d9('0x10'),_0x165883['userProfileId'],'WhatsappQueue'));_0xfb9a84[_0x52d9('0x2e')](getAssociatedResources(_0x52d9('0x32'),_0x165883[_0x52d9('0x1e')],_0x52d9('0x17')));_0xfb9a84[_0x52d9('0x2e')](getAssociatedResources(_0x52d9('0x12'),_0x165883['userProfileId'],_0x52d9('0x33')));_0xfb9a84['push'](getAssociatedResources(_0x52d9('0x13'),_0x165883['userProfileId'],'Campaign'));_0xfb9a84[_0x52d9('0x2e')](db['User'][_0x52d9('0x11')](queryAgents));break;case _0x52d9('0x6'):_0x29a2f4[_0x1b287b]('voice:inbound');_0x29a2f4[_0x1b287b](_0x52d9('0x28'));_0xfb9a84[_0x52d9('0x2e')](_0x165883[_0x52d9('0x34')]({'attributes':['id',_0x52d9('0x3')]}));_0xfb9a84['push'](_0x165883[_0x52d9('0x35')]({'attributes':['id',_0x52d9('0x3')]}));_0xfb9a84[_0x52d9('0x2e')](_0x165883[_0x52d9('0x36')]({'attributes':['id',_0x52d9('0x3')]}));_0xfb9a84[_0x52d9('0x2e')](_0x165883['getSmsQueues']({'attributes':['id',_0x52d9('0x3')]}));_0xfb9a84['push'](_0x165883['getMailQueues']({'attributes':['id',_0x52d9('0x3')]}));_0xfb9a84[_0x52d9('0x2e')](_0x165883[_0x52d9('0x37')]({'attributes':['id',_0x52d9('0x3')]}));_0xfb9a84[_0x52d9('0x2e')](_0x165883[_0x52d9('0x38')]({'attributes':['id',_0x52d9('0x3')]}));break;}return BPromise['all'](_0xfb9a84);}})[_0x52d9('0x15')](function(_0x146c42){if(_0x146c42&&_0x146c42[_0x52d9('0x1b')]){for(var _0x5b136e=0x0;_0x5b136e<_0x146c42[_0x52d9('0x1b')];_0x5b136e+=0x1){for(var _0x13ca9e=0x0;_0x13ca9e<_0x146c42[_0x5b136e]['length'];_0x13ca9e+=0x1){switch(_0x5b136e){case 0x0:joinOrLeaveQueues(_0x29a2f4,_0x1b287b,_0x52d9('0x39'),_0x146c42[_0x5b136e][_0x13ca9e]);break;case 0x1:joinOrLeaveQueues(_0x29a2f4,_0x1b287b,'chat',_0x146c42[_0x5b136e][_0x13ca9e]);break;case 0x2:joinOrLeaveQueues(_0x29a2f4,_0x1b287b,_0x52d9('0x3a'),_0x146c42[_0x5b136e][_0x13ca9e]);break;case 0x3:joinOrLeaveQueues(_0x29a2f4,_0x1b287b,'sms',_0x146c42[_0x5b136e][_0x13ca9e]);break;case 0x4:joinOrLeaveQueues(_0x29a2f4,_0x1b287b,_0x52d9('0x3b'),_0x146c42[_0x5b136e][_0x13ca9e]);break;case 0x5:joinOrLeaveQueues(_0x29a2f4,_0x1b287b,_0x52d9('0x3c'),_0x146c42[_0x5b136e][_0x13ca9e]);break;case 0x6:joinOrLeaveQueues(_0x29a2f4,_0x1b287b,_0x52d9('0x3d'),_0x146c42[_0x5b136e][_0x13ca9e]);break;case 0x7:if(_0x40bab5[_0x52d9('0x5')]!==_0x52d9('0x6'))_0x29a2f4[_0x1b287b](util[_0x52d9('0x1a')](_0x52d9('0x3e'),_0x146c42[_0x5b136e][_0x13ca9e][_0x52d9('0x3')]));break;case 0x8:if(_0x40bab5[_0x52d9('0x5')]!==_0x52d9('0x6'))_0x29a2f4[_0x1b287b](util[_0x52d9('0x1a')](_0x52d9('0x3f'),_0x146c42[_0x5b136e][_0x13ca9e][_0x52d9('0x3')]));break;case 0x9:if(_0x40bab5[_0x52d9('0x5')]!==_0x52d9('0x6'))_0x29a2f4[_0x1b287b](util['format'](_0x52d9('0x40'),_0x146c42[_0x5b136e][_0x13ca9e]['type'],_0x146c42[_0x5b136e][_0x13ca9e][_0x52d9('0x3')]));break;case 0xa:_0x29a2f4[_0x1b287b](util[_0x52d9('0x1a')]('user:%s',_0x146c42[_0x5b136e][_0x13ca9e]['name']));break;}}}}})[_0x52d9('0x15')](function(){if(_0x1b287b===_0x52d9('0x41')){var _0x213b13=_[_0x52d9('0x16')](_0x40bab5[_0x52d9('0x42')],'id');return _0x40bab5[_0x52d9('0x43')](_0x213b13)[_0x52d9('0x15')](function(){for(var _0x3af419=0x0;_0x3af419<_0x213b13[_0x52d9('0x1b')];_0x3af419+=0x1){_0x28d8b5[_0x52d9('0x44')](_0x52d9('0x45'),{'ChatInteractionId':Number(_0x213b13[_0x3af419]),'UserId':Number(_0x40bab5['id'])});}});}})[_0x52d9('0x15')](function(){if(_0x1b287b===_0x52d9('0x41')){var _0x10a037=_['map'](_0x40bab5['MailInteractions'],'id');return _0x40bab5['removeMailInteractions'](_0x10a037)[_0x52d9('0x15')](function(){for(var _0x5a0090=0x0;_0x5a0090<_0x10a037[_0x52d9('0x1b')];_0x5a0090+=0x1){_0x28d8b5[_0x52d9('0x44')](_0x52d9('0x46'),{'MailInteractionId':Number(_0x10a037[_0x5a0090]),'UserId':Number(_0x40bab5['id'])});}});}})['then'](function(){if(_0x1b287b==='leave'){var _0x292169=_[_0x52d9('0x16')](_0x40bab5[_0x52d9('0x20')],'id');return _0x40bab5['removeFaxInteractions'](_0x292169)[_0x52d9('0x15')](function(){for(var _0x4e1322=0x0;_0x4e1322<_0x292169[_0x52d9('0x1b')];_0x4e1322+=0x1){_0x28d8b5[_0x52d9('0x44')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x292169[_0x4e1322]),'UserId':Number(_0x40bab5['id'])});}});}})['then'](function(){if(_0x1b287b===_0x52d9('0x41')){var _0x514770=_[_0x52d9('0x16')](_0x40bab5[_0x52d9('0x21')],'id');return _0x40bab5[_0x52d9('0x47')](_0x514770)[_0x52d9('0x15')](function(){for(var _0x1d3b92=0x0;_0x1d3b92<_0x514770['length'];_0x1d3b92+=0x1){_0x28d8b5[_0x52d9('0x44')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x514770[_0x1d3b92]),'UserId':Number(_0x40bab5['id'])});}});}})[_0x52d9('0x15')](function(){if(_0x1b287b==='leave'){var _0x5e63a8=_[_0x52d9('0x16')](_0x40bab5[_0x52d9('0x22')],'id');return _0x40bab5[_0x52d9('0x48')](_0x5e63a8)[_0x52d9('0x15')](function(){for(var _0x5ea26d=0x0;_0x5ea26d<_0x5e63a8[_0x52d9('0x1b')];_0x5ea26d+=0x1){_0x28d8b5[_0x52d9('0x44')](_0x52d9('0x49'),{'OpenchannelInteractionId':Number(_0x5e63a8[_0x5ea26d]),'UserId':Number(_0x40bab5['id'])});}});}})[_0x52d9('0x15')](function(){if(_0x1b287b===_0x52d9('0x41')){var _0x4e7eca=_[_0x52d9('0x16')](_0x40bab5[_0x52d9('0x24')],'id');return _0x40bab5[_0x52d9('0x4a')](_0x4e7eca)[_0x52d9('0x15')](function(){for(var _0x3fb66e=0x0;_0x3fb66e<_0x4e7eca['length'];_0x3fb66e+=0x1){_0x28d8b5[_0x52d9('0x44')](_0x52d9('0x4b'),{'WhatsappInteractionId':Number(_0x4e7eca[_0x3fb66e]),'UserId':Number(_0x40bab5['id'])});}});}})['catch'](function(_0x5e63bd){_0x29a2f4['log'](_0x5e63bd);});}}function onDisconnect(_0x45be62,_0x2d34b6){joinOrLeave(_0x45be62,_0x52d9('0x41'),_0x2d34b6);}function onConnect(_0x31ff34){joinOrLeave(_0x31ff34,_0x52d9('0x4c'));}exports[_0x52d9('0x4d')]=function(_0x58e05c){_0x58e05c['on'](_0x52d9('0x4e'),function(_0x511ecf){_0x511ecf[_0x52d9('0x4f')](0x0);_0x511ecf[_0x52d9('0x50')]=_0x511ecf[_0x52d9('0x51')][_0x52d9('0x4e')][_0x52d9('0x52')]+':'+_0x511ecf[_0x52d9('0x51')]['connection'][_0x52d9('0x53')];_0x511ecf[_0x52d9('0x54')]=new Date();_0x511ecf[_0x52d9('0x55')]=function(_0xae5af1){console[_0x52d9('0x55')](_0x52d9('0x56')+_0x511ecf[_0x52d9('0x57')][_0x52d9('0x3')]+'['+_0x511ecf[_0x52d9('0x50')]+']',_0xae5af1);};_0x511ecf['on']('disconnect',function(){onDisconnect(_0x511ecf,_0x58e05c);_0x511ecf['log'](_0x52d9('0x58'));});onConnect(_0x511ecf);_0x511ecf[_0x52d9('0x55')](_0x52d9('0x59'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1230493..f30325d 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 _0xea91=['event','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','then','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','contact','catch','changed','closed','substatus','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','toLowerCase','util','../../mysqldb','jayson/promise','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','info','Trigger,\x20%s','EventManager','error','code','get','channel','motionChannel'];(function(_0x5d99bb,_0x10e04b){var _0xdfe846=function(_0x2e3377){while(--_0x2e3377){_0x5d99bb['push'](_0x5d99bb['shift']());}};_0xdfe846(++_0x10e04b);}(_0xea91,0x1ef));var _0x1ea9=function(_0x4b8980,_0x2559d8){_0x4b8980=_0x4b8980-0x0;var _0x2e93b4=_0xea91[_0x4b8980];return _0x2e93b4;};'use strict';var util=require(_0x1ea9('0x0'));var db=require(_0x1ea9('0x1'))['db'];var jayson=require(_0x1ea9('0x2'));var logger=require('../logger')('triggers');var client=jayson[_0x1ea9('0x3')][_0x1ea9('0x4')]({'port':0x232a});var triggers=[{'channel':_0x1ea9('0x5'),'model':_0x1ea9('0x6'),'event':_0x1ea9('0x7'),'condition':_0x1ea9('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0x1ea9('0x6'),'event':_0x1ea9('0x9'),'condition':_0x1ea9('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0x1ea9('0xb'),'event':_0x1ea9('0x7'),'condition':_0x1ea9('0xc'),'callback':afterCreateMessage},{'channel':_0x1ea9('0x5'),'model':'ChatOfflineMessage','event':_0x1ea9('0x7'),'condition':_0x1ea9('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x1ea9('0xd'),'model':_0x1ea9('0xe'),'event':_0x1ea9('0x7'),'condition':_0x1ea9('0x8'),'callback':afterCreate},{'channel':_0x1ea9('0xd'),'model':_0x1ea9('0xe'),'event':_0x1ea9('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1ea9('0xd'),'model':_0x1ea9('0xf'),'event':'afterCreate','condition':_0x1ea9('0xc'),'callback':afterCreateMessage},{'channel':_0x1ea9('0x10'),'model':'WhatsappInteraction','event':_0x1ea9('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1ea9('0x10'),'model':_0x1ea9('0x11'),'event':_0x1ea9('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1ea9('0x10'),'model':_0x1ea9('0x12'),'event':_0x1ea9('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x1ea9('0x13'),'event':_0x1ea9('0x7'),'condition':_0x1ea9('0x8'),'callback':afterCreate},{'channel':_0x1ea9('0x14'),'model':_0x1ea9('0x13'),'event':_0x1ea9('0x9'),'condition':_0x1ea9('0xa'),'callback':afterUpdate},{'channel':_0x1ea9('0x14'),'model':_0x1ea9('0x15'),'event':_0x1ea9('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1ea9('0x16'),'model':'MailInteraction','event':_0x1ea9('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1ea9('0x16'),'model':_0x1ea9('0x17'),'event':_0x1ea9('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x1ea9('0x18'),'event':_0x1ea9('0x7'),'condition':_0x1ea9('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x1ea9('0x7'),'condition':_0x1ea9('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0x1ea9('0x19'),'event':_0x1ea9('0x9'),'condition':_0x1ea9('0xa'),'callback':afterUpdate},{'channel':_0x1ea9('0x1a'),'model':_0x1ea9('0x1b'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x20efed){return client[_0x1ea9('0x1c')]('EventManager',_0x20efed)['then'](function(_0x24a90b){logger[_0x1ea9('0x1d')](_0x1ea9('0x1e'),_0x1ea9('0x1f'),_0x24a90b);if(_0x24a90b[_0x1ea9('0x20')]){if(_0x24a90b[_0x1ea9('0x20')][_0x1ea9('0x21')]===0x1f4){logger[_0x1ea9('0x20')](_0x1ea9('0x1e'),'EventManager',_0x24a90b['error']);}}})['catch'](function(_0x3b6705){logger[_0x1ea9('0x20')]('Trigger,\x20%s',_0x1ea9('0x1f'),_0x3b6705);});}function afterCreateMessage(_0x11bff0){return function(_0x169cd7){_0x169cd7=_0x169cd7[_0x1ea9('0x22')]({'plain':!![]});_0x169cd7[_0x1ea9('0x23')]=_0x11bff0;_0x169cd7[_0x1ea9('0x24')]=_0x11bff0;_0x169cd7[_0x1ea9('0x25')]=_0x169cd7['direction'];Promise[_0x1ea9('0x26')]()['then'](function(){if(typeof _0x169cd7[_0x1ea9('0x27')]===_0x1ea9('0x28'))return null;var _0x2fb5fe=_0x1ea9('0x29')+_0x169cd7[_0x1ea9('0x27')];return db[_0x1ea9('0x2a')][_0x1ea9('0x2b')](_0x2fb5fe,{'type':db[_0x1ea9('0x2c')][_0x1ea9('0x2d')][_0x1ea9('0x2e')],'raw':!![]});})[_0x1ea9('0x2f')](function(_0x3040f4){if(_0x3040f4){_0x169cd7['contact']=_0x3040f4[0x0];}if(typeof _0x169cd7[_0x1ea9('0x30')]===_0x1ea9('0x28'))return;return getAgent(_0x169cd7['UserId']);})[_0x1ea9('0x2f')](function(_0x3cff35){if(_0x3cff35){_0x169cd7[_0x1ea9('0x31')]=util[_0x1ea9('0x32')](_0x1ea9('0x33'),_0x3cff35[_0x1ea9('0x34')]);_0x169cd7[_0x1ea9('0x35')]=_0x3cff35;_0x169cd7[_0x1ea9('0x23')]=_0x11bff0;return request({'event':_0x1ea9('0x36'),'message':_0x169cd7});}else{return request({'event':_0x1ea9('0x37'),'message':_0x169cd7});}})['catch'](function(_0x2ad5e4){logger[_0x1ea9('0x20')](_0x1ea9('0x1e'),_0x1ea9('0x38'),_0x2ad5e4);});};}function afterCreateOfflineMessage(_0x5da413){return function(_0x397c20){_0x397c20=_0x397c20[_0x1ea9('0x22')]({'plain':!![]});_0x397c20[_0x1ea9('0x23')]=_0x5da413;_0x397c20[_0x1ea9('0x24')]=_0x5da413;_0x397c20[_0x1ea9('0x25')]=_0x1ea9('0x39');return request({'event':_0x397c20['event'],'message':_0x397c20});};}function afterCreate(_0x79644f,_0x2270bb){return function(_0x26ead3){_0x26ead3=_0x26ead3[_0x1ea9('0x22')]({'plain':!![]});_0x26ead3[_0x1ea9('0x23')]=_0x79644f;_0x26ead3[_0x1ea9('0x24')]=_0x79644f;_0x26ead3[_0x1ea9('0x25')]=_0x1ea9('0x3a');Promise[_0x1ea9('0x26')]()['then'](function(){var _0x34efed=_0x1ea9('0x29')+_0x26ead3[_0x1ea9('0x27')];return db[_0x1ea9('0x2a')][_0x1ea9('0x2b')](_0x34efed,{'type':db[_0x1ea9('0x2c')][_0x1ea9('0x2d')][_0x1ea9('0x2e')],'raw':!![]});})[_0x1ea9('0x2f')](function(_0x515c3c){if(_0x515c3c){_0x26ead3[_0x1ea9('0x3b')]=_0x515c3c[0x0];}if(typeof _0x26ead3['UserId']===_0x1ea9('0x28'))return;return getAgent(_0x26ead3['UserId']);})['then'](function(_0x3197cf){if(_0x3197cf){_0x26ead3[_0x1ea9('0x31')]=util['format'](_0x1ea9('0x33'),_0x3197cf['name']);_0x26ead3[_0x1ea9('0x35')]=_0x3197cf;}return request({'event':_0x2270bb,'message':_0x26ead3});})[_0x1ea9('0x3c')](function(_0x56351e){logger[_0x1ea9('0x20')]('Trigger,\x20%s','AfterCreate',_0x56351e);});};}function afterUpdate(_0x3b6adb){return function(_0x3a0382){var _0x1307c3=_0x3a0382[_0x1ea9('0x3d')]('closed')&&_0x3a0382[_0x1ea9('0x3e')];var _0x254d69=_0x3a0382[_0x1ea9('0x3d')](_0x1ea9('0x3f'));if(_0x1307c3||_0x254d69){var _0x24170a=_0x1307c3?'closedinteraction':'substatus';var _0x117f11=_0x3a0382['get']({'plain':!![]});_0x117f11[_0x1ea9('0x23')]=_0x3b6adb;_0x117f11['motionChannel']=_0x3b6adb;_0x117f11[_0x1ea9('0x25')]=_0x1307c3?_0x1ea9('0x3e'):_0x1ea9('0x3f');var _0x34e652='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x117f11[_0x1ea9('0x27')];return db[_0x1ea9('0x2a')]['query'](_0x34e652,{'type':db[_0x1ea9('0x2c')][_0x1ea9('0x2d')][_0x1ea9('0x2e')],'raw':!![]})[_0x1ea9('0x2f')](function(_0x5f07ca){if(_0x5f07ca){_0x117f11['contact']=_0x5f07ca[0x0];}if(typeof _0x117f11[_0x1ea9('0x30')]===_0x1ea9('0x28'))return;return getAgent(_0x117f11['UserId']);})[_0x1ea9('0x2f')](function(_0x4c8bbf){if(_0x4c8bbf){_0x117f11[_0x1ea9('0x31')]=util[_0x1ea9('0x32')]('SIP/%s',_0x4c8bbf[_0x1ea9('0x34')]);_0x117f11[_0x1ea9('0x35')]=_0x4c8bbf;}return request({'event':_0x24170a,'message':_0x117f11});})[_0x1ea9('0x3c')](function(_0x2d9fbf){logger['error']('Trigger,\x20%s',_0x1ea9('0x40'),_0x2d9fbf);});}};}function getAgent(_0x9b1983){return db[_0x1ea9('0x41')][_0x1ea9('0x42')]({'where':{'id':_0x9b1983},'attributes':['id',_0x1ea9('0x34'),_0x1ea9('0x43'),_0x1ea9('0x44'),_0x1ea9('0x45')],'raw':!![]})['then'](function(_0x4d10d0){return _0x4d10d0;});}exports[_0x1ea9('0x46')]=function(){for(var _0xde663a=0x0;_0xde663a=_0x3acc7e[_0x957f('0x10')]){throw Error(_0x957f('0x11'));}_0x5e76d9(_0x127fa3);})['catch'](function(_0x27680f){_0x34ff1b(_0x27680f);});});}; \ No newline at end of file +var _0xfa85=['chat','fax','whatsapp','getChannels','toLowerCase','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','mail'];(function(_0x2b26e4,_0x3b4e0f){var _0x40b51c=function(_0x2be500){while(--_0x2be500){_0x2b26e4['push'](_0x2b26e4['shift']());}};_0x40b51c(++_0x3b4e0f);}(_0xfa85,0xf7));var _0x5fa8=function(_0x5427df,_0x32b8d3){_0x5427df=_0x5427df-0x0;var _0x1498cc=_0xfa85[_0x5427df];return _0x1498cc;};'use strict';var _=require(_0x5fa8('0x0'));var BPromise=require(_0x5fa8('0x1'));var db=require(_0x5fa8('0x2'))['db'];var util=require(_0x5fa8('0x3'));var channels=['voice',_0x5fa8('0x4'),_0x5fa8('0x5'),_0x5fa8('0x6'),'sms',_0x5fa8('0x7'),'openchannel'];exports[_0x5fa8('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0xfd7fa8){_0xfd7fa8=_0xfd7fa8[_0x5fa8('0x9')]();return _['includes'](channels,_0xfd7fa8);};exports[_0x5fa8('0xa')]=function(_0x8beed3,_0x4ecd2a,_0x51ea80,_0x55abfd){var _0x345c0d={'loginAttempts':_0x4ecd2a,'blocked':_0x51ea80};if(!_['isUndefined'](_0x55abfd)){_0x345c0d[_0x5fa8('0xb')]=_0x55abfd;}return _0x8beed3[_0x5fa8('0xc')](_0x345c0d);};exports[_0x5fa8('0xd')]=function(_0x499c63){return new BPromise(function(_0x37d74e,_0x423306){var _0x33c239=0x0;if(_0x499c63[_0x5fa8('0xe')]!==_0x5fa8('0xf')){_0x37d74e(_0x499c63);}db[_0x5fa8('0x10')][_0x5fa8('0x11')]({'where':{'role':_0x5fa8('0xf'),'online':!![],'id':{'$ne':_0x499c63['id']}}})[_0x5fa8('0x12')](function(_0xc588c5){_0x33c239=_0xc588c5;return util[_0x5fa8('0xd')]();})[_0x5fa8('0x12')](function(_0x38fa02){if(_0x38fa02&&_0x38fa02[_0x5fa8('0x13')]&&_0x33c239>=_0x38fa02[_0x5fa8('0x13')]){throw Error(_0x5fa8('0x14'));}_0x37d74e(_0x499c63);})['catch'](function(_0x5d44b4){_0x423306(_0x5d44b4);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index e1201c1..430e07b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bea=['render','json','send','exports','status'];(function(_0x6b7ccd,_0x4ab05d){var _0x5764ca=function(_0x55bbd9){while(--_0x55bbd9){_0x6b7ccd['push'](_0x6b7ccd['shift']());}};_0x5764ca(++_0x4ab05d);}(_0x0bea,0xee));var _0xa0be=function(_0x455ed5,_0xab57cc){_0x455ed5=_0x455ed5-0x0;var _0x481ac4=_0x0bea[_0x455ed5];return _0x481ac4;};'use strict';module[_0xa0be('0x0')][0x194]=function pageNotFound(_0x3e06da,_0xad6a16){var _0x5a9543='404';var _0x3a555f=0x194;var _0x337c30={'status':_0x3a555f};_0xad6a16[_0xa0be('0x1')](_0x337c30['status']);_0xad6a16[_0xa0be('0x2')](_0x5a9543,{},function(_0xfccccc,_0x464493){if(_0xfccccc){return _0xad6a16[_0xa0be('0x1')](_0x337c30['status'])[_0xa0be('0x3')](_0x337c30);}_0xad6a16[_0xa0be('0x4')](_0x464493);});}; \ No newline at end of file +var _0x21f8=['404','status','render','send'];(function(_0x1656fa,_0x53c90b){var _0x35317f=function(_0x35f1c6){while(--_0x35f1c6){_0x1656fa['push'](_0x1656fa['shift']());}};_0x35317f(++_0x53c90b);}(_0x21f8,0x170));var _0x821f=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0x21f8[_0x19aa84];return _0x536146;};'use strict';module['exports'][0x194]=function pageNotFound(_0x230126,_0x5f5352){var _0x1d7a33=_0x821f('0x0');var _0xa7bc69=0x194;var _0x44a696={'status':_0xa7bc69};_0x5f5352[_0x821f('0x1')](_0x44a696[_0x821f('0x1')]);_0x5f5352[_0x821f('0x2')](_0x1d7a33,{},function(_0x2f2080,_0x318f98){if(_0x2f2080){return _0x5f5352[_0x821f('0x1')](_0x44a696[_0x821f('0x1')])['json'](_0x44a696);}_0x5f5352[_0x821f('0x3')](_0x318f98);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index b3de95c..49390f6 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa57a=['../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','belongsTo','UserProfile','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueue','MailQueues','ChatQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','VoiceQueue','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessionReport','TrunkId','TrunkBackup','IntervalId','voice_queues_has_cm_lists','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','MailServerIn','CloudProviderId','restrict','Smtp','Answers','Interactions','Applications','List','ListId','TemplateId','mandatoryDispositionPauseId','Agents','UserMailQueue','team_has_mail_queues','Account','Contact','mail_interaction_has_tags','Tags','Attachments','MailInteractionId','ChatOfflineMessageId','TagId','MailQueueReport','Items','FaxAccount','Dispositions','FaxAccountId','FaxApplication','Exntensions','Owner','fax_interaction_has_tags','ThroughTags','Users','FaxInteractionId','Interaction','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','Company','cm_contact_has_tags','OwnerId','All','OneAll','Any','OneAny','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','VoiceMusicOnHold','whatsapp_interaction_has_tags','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','CustomReportId','AnalyticDefaultReport','MetricId','Configurations','AccountId','Descriptions','DescriptionId','FieldId','SubjectId','Description','Field','Variable','VariableId','Subjects','Subject','FreshdeskAccount','Dynamics365Account','Dynamics365Field','ToId','JscriptyQuestionReport','JscriptyAnswerReport','SessionId','JscriptyProject','ProjectId','user_has_teams','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','VoicePrefixes','CampaignId','TrunkBackupId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromUserId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','UserProfileResource','Resources','sectionId','WhatsappAccountId','mandatoryDispositionPause','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','motion2','xC@LL1234','127.0.0.1','database','username','password','options','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xa57a,0xfc));var _0xaa57=function(_0x50b54b,_0xba911d){_0x50b54b=_0x50b54b-0x0;var _0x1859c1=_0xa57a[_0x50b54b];return _0x1859c1;};'use strict';var config=require(_0xaa57('0x0'));var Sequelize=require(_0xaa57('0x1'));var _=require(_0xaa57('0x2'));var jstz=require(_0xaa57('0x3'));var timezone=jstz[_0xaa57('0x4')]();config['sequelize']=_[_0xaa57('0x5')](config[_0xaa57('0x1')],{'database':'motion2','username':_0xaa57('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xaa57('0x7'),'dialectOptions':{'charset':_0xaa57('0x8')},'logging':![],'timezone':timezone[_0xaa57('0x9')](),'define':{'charset':_0xaa57('0xa'),'collate':_0xaa57('0xb')}}});config['sequelizeHistory']=_[_0xaa57('0x5')](config['sequelizeHistory'],{'database':_0xaa57('0xc'),'username':_0xaa57('0x6'),'password':_0xaa57('0xd'),'options':{'host':_0xaa57('0xe'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xaa57('0x8')},'logging':![],'timezone':timezone[_0xaa57('0x9')](),'define':{'charset':'utf8','collate':_0xaa57('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaa57('0x1')][_0xaa57('0xf')],config[_0xaa57('0x1')][_0xaa57('0x10')],config[_0xaa57('0x1')][_0xaa57('0x11')],config[_0xaa57('0x1')][_0xaa57('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaa57('0x13')][_0xaa57('0xf')],config['sequelizeHistory'][_0xaa57('0x10')],config[_0xaa57('0x13')][_0xaa57('0x11')],config[_0xaa57('0x13')][_0xaa57('0x12')])};db[_0xaa57('0x14')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x16'));db[_0xaa57('0x17')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x18'));db[_0xaa57('0x19')]=db['sequelize'][_0xaa57('0x15')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xaa57('0x1')]['import'](_0xaa57('0x1a'));db['VoiceMusicOnHold']=db[_0xaa57('0x1')]['import'](_0xaa57('0x1b'));db['VoiceQueue']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x1c'));db[_0xaa57('0x1d')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x1e'));db[_0xaa57('0x1f')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x20'));db['VoiceMailMessage']=db['sequelize'][_0xaa57('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xaa57('0x21')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x22'));db[_0xaa57('0x23')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x24'));db[_0xaa57('0x25')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x26'));db[_0xaa57('0x27')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x28'));db[_0xaa57('0x29')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x2a'));db[_0xaa57('0x2b')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x2c'));db[_0xaa57('0x2d')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x2e'));db[_0xaa57('0x2f')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xaa57('0x30')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xaa57('0x31')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x32'));db['UserMailQueue']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x33'));db['UserFaxQueue']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x34'));db['UserSmsQueue']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x35'));db[_0xaa57('0x36')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x37'));db[_0xaa57('0x38')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x39'));db['MailServerIn']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x3a'));db[_0xaa57('0x3b')]=db['sequelize'][_0xaa57('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0xaa57('0x3c')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x3d'));db['MailQueue']=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/mailQueue/mailQueue.model');db[_0xaa57('0x3e')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x3f'));db[_0xaa57('0x40')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x41'));db[_0xaa57('0x42')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x43'));db[_0xaa57('0x44')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x45'));db['MailQueueReport']=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x46'));db['DashboardItem']=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x47'));db['FaxAccount']=db[_0xaa57('0x1')]['import'](_0xaa57('0x48'));db['FaxApplication']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x49'));db[_0xaa57('0x4a')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x4b'));db[_0xaa57('0x4c')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x4d'));db[_0xaa57('0x4e')]=db['sequelize']['import'](_0xaa57('0x4f'));db[_0xaa57('0x50')]=db['sequelize']['import'](_0xaa57('0x51'));db[_0xaa57('0x52')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x53'));db[_0xaa57('0x54')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/smsApplication/smsApplication.model');db[_0xaa57('0x55')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x56'));db[_0xaa57('0x57')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x58'));db[_0xaa57('0x59')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x5a'));db[_0xaa57('0x5b')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x5c'));db[_0xaa57('0x5d')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x5e'));db['OpenchannelInteraction']=db['sequelize']['import'](_0xaa57('0x5f'));db[_0xaa57('0x60')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0xaa57('0x61')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/chatWebsite/chatWebsite.model');db[_0xaa57('0x62')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x63'));db[_0xaa57('0x64')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x65'));db[_0xaa57('0x66')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/chatInteraction/chatInteraction.model');db[_0xaa57('0x67')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x68'));db[_0xaa57('0x69')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x6a'));db[_0xaa57('0x6b')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xaa57('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0xaa57('0x6c')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x6d'));db[_0xaa57('0x6e')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x6f'));db[_0xaa57('0x70')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x71'));db[_0xaa57('0x72')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/cmHopper/cmHopper.model');db[_0xaa57('0x73')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x74'));db[_0xaa57('0x75')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xaa57('0x76')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x77'));db[_0xaa57('0x78')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xaa57('0x79')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x7a'));db['Action']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x7b'));db[_0xaa57('0x7c')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x7d'));db[_0xaa57('0x7e')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0xaa57('0x7f')]=db['sequelize']['import']('../api/disposition/disposition.model');db[_0xaa57('0x80')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x81'));db[_0xaa57('0x82')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x83'));db[_0xaa57('0x84')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x85'));db[_0xaa57('0x86')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x87'));db['VoiceQueuesLog']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x88'));db[_0xaa57('0x89')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/schedule/schedule.model');db[_0xaa57('0x8a')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x8b'));db[_0xaa57('0x8c')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x8d'));db[_0xaa57('0x8e')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x8f'));db[_0xaa57('0x90')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x91'));db['Variable']=db[_0xaa57('0x1')]['import']('../api/variable/variable.model');db[_0xaa57('0x92')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x93'));db[_0xaa57('0x94')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x95'));db[_0xaa57('0x96')]=db[_0xaa57('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xaa57('0x97')]=db['sequelize']['import'](_0xaa57('0x98'));db[_0xaa57('0x99')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x9a'));db[_0xaa57('0x9b')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x9c'));db[_0xaa57('0x9d')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x9e'));db[_0xaa57('0x9f')]=db[_0xaa57('0x1')]['import'](_0xaa57('0xa0'));db[_0xaa57('0xa1')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xa2'));db[_0xaa57('0xa3')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xa4'));db[_0xaa57('0xa5')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xaa57('0xa6')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xa7'));db[_0xaa57('0xa8')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xa9'));db[_0xaa57('0xaa')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xab'));db[_0xaa57('0xac')]=db[_0xaa57('0x1')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xaa57('0xad')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xae'));db[_0xaa57('0xaf')]=db[_0xaa57('0x1')]['import'](_0xaa57('0xb0'));db[_0xaa57('0xb1')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xb2'));db[_0xaa57('0xb3')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xb4'));db[_0xaa57('0xb5')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xaa57('0xb6')]=db[_0xaa57('0x1')]['import'](_0xaa57('0xb7'));db[_0xaa57('0xb8')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xb9'));db['FreshdeskAccount']=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xba'));db[_0xaa57('0xbb')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xbc'));db[_0xaa57('0xbd')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xaa57('0xbe')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xbf'));db[_0xaa57('0xc0')]=db['sequelize']['import'](_0xaa57('0xc1'));db[_0xaa57('0xc2')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xc3'));db[_0xaa57('0xc4')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xc5'));db[_0xaa57('0xc6')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xc7'));db[_0xaa57('0xc8')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xc9'));db[_0xaa57('0xca')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xcb'));db['Dynamics365Field']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xcc'));db[_0xaa57('0xcd')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xce'));db[_0xaa57('0xcf')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xd0'));db[_0xaa57('0xd1')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/integration/integration.model');db[_0xaa57('0xd2')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xd3'));db[_0xaa57('0xd4')]=db['sequelize']['import'](_0xaa57('0xd5'));db[_0xaa57('0xd6')]=db[_0xaa57('0x1')]['import'](_0xaa57('0xd7'));db['JscriptyAnswerReport']=db[_0xaa57('0x1')]['import'](_0xaa57('0xd8'));db['JscriptyQuestionReport']=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xd9'));db['JscriptySessionReport']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xda'));db[_0xaa57('0xdb')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xdc'));db['SquareReport']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xdd'));db[_0xaa57('0xde')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xdf'));db['JscriptyProject']=db[_0xaa57('0x1')]['import'](_0xaa57('0xe0'));db[_0xaa57('0xe1')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/setting/setting.model');db[_0xaa57('0xe2')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xe3'));db[_0xaa57('0xe4')]=db['sequelize'][_0xaa57('0x15')]('../api/squareProject/squareProject.model');db[_0xaa57('0xe5')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xe6'));db[_0xaa57('0xe7')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xe8'));db[_0xaa57('0xe9')]=db[_0xaa57('0x1')]['import'](_0xaa57('0xea'));db['License']=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xeb'));db[_0xaa57('0xec')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xed'));db[_0xaa57('0xee')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xef'));db[_0xaa57('0xf0')]=db['sequelize'][_0xaa57('0x15')]('../api/attachment/attachment.model');db[_0xaa57('0xf1')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xf2'));db['MailTransferReport']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0xf3'));db[_0xaa57('0xf4')]=db[_0xaa57('0x1')][_0xaa57('0x15')]('../api/chatTransferReport/chatTransferReport.model');db[_0xaa57('0xf5')]=db[_0xaa57('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xaa57('0xf6')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xf7'));db[_0xaa57('0xf8')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xf9'));db[_0xaa57('0xfa')]=db[_0xaa57('0x1')]['import'](_0xaa57('0xfb'));db[_0xaa57('0xfc')]=db[_0xaa57('0x1')]['import'](_0xaa57('0xfd'));db['UserProfile']=db['sequelize'][_0xaa57('0x15')](_0xaa57('0xfe'));db[_0xaa57('0xff')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x100'));db['UserProfileResource']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x101'));db['UserNotification']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x102'));db[_0xaa57('0x103')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x104'));db[_0xaa57('0x105')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x106'));db[_0xaa57('0x107')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x108'));db[_0xaa57('0x109')]=db['sequelize'][_0xaa57('0x15')]('../api/whatsappMessage/whatsappMessage.model');db[_0xaa57('0x10a')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x10b'));db['WhatsappTransferReport']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x10c'));db['WhatsappQueue']=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x10d'));db[_0xaa57('0x10e')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x10f'));db['TeamVoiceQueue']=db[_0xaa57('0x1')]['import'](_0xaa57('0x110'));db[_0xaa57('0x111')]=db[_0xaa57('0x1')]['import'](_0xaa57('0x112'));db[_0xaa57('0x113')]=db['sequelize'][_0xaa57('0x15')](_0xaa57('0x114'));db[_0xaa57('0x115')]=db[_0xaa57('0x1')][_0xaa57('0x15')](_0xaa57('0x116'));db['User'][_0xaa57('0x117')](db[_0xaa57('0x118')],{'as':'VoiceMail','onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x14')][_0xaa57('0x117')](db[_0xaa57('0x115')],{'as':'userSetting','onDelete':'cascade','foreignKey':'UserId'});db[_0xaa57('0x14')][_0xaa57('0x11b')](db[_0xaa57('0x1d')],{'as':_0xaa57('0x11c'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x14')][_0xaa57('0x11b')](db[_0xaa57('0x2f')],{'as':_0xaa57('0x11d'),'foreignKey':_0xaa57('0x11a')});db['User'][_0xaa57('0x11b')](db[_0xaa57('0x11e')],{'as':_0xaa57('0x11f'),'onDelete':_0xaa57('0x119'),'hooks':!![]});db[_0xaa57('0x14')][_0xaa57('0x11b')](db[_0xaa57('0x75')],{'as':_0xaa57('0x120'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x14')][_0xaa57('0x11b')](db[_0xaa57('0x76')],{'as':'HopperHistory','foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x14')][_0xaa57('0x11b')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x14')][_0xaa57('0x11b')](db[_0xaa57('0x121')],{'as':_0xaa57('0x122'),'foreignKey':_0xaa57('0x11a')});db['User'][_0xaa57('0x11b')](db['ChatInteraction'],{'as':_0xaa57('0x123'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x14')]['hasMany'](db['SmsInteraction'],{'as':_0xaa57('0x124'),'foreignKey':_0xaa57('0x11a')});db['User'][_0xaa57('0x11b')](db[_0xaa57('0x4a')],{'as':_0xaa57('0x125'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x14')][_0xaa57('0x11b')](db[_0xaa57('0x40')],{'as':_0xaa57('0x126'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x14')][_0xaa57('0x11b')](db[_0xaa57('0x107')],{'as':_0xaa57('0x127'),'foreignKey':'UserId'});db[_0xaa57('0x14')]['hasMany'](db[_0xaa57('0x128')],{'as':_0xaa57('0x129'),'foreignKey':'SenderId'});db[_0xaa57('0x14')][_0xaa57('0x12a')](db[_0xaa57('0x12b')],{'as':_0xaa57('0x12b'),'foreignKey':_0xaa57('0x12c')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x12e')],{'as':_0xaa57('0x12f'),'through':_0xaa57('0x130')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x70')],{'as':_0xaa57('0x131'),'through':_0xaa57('0x132')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0xfa')],{'as':_0xaa57('0x133'),'through':_0xaa57('0x134')});db[_0xaa57('0x14')]['belongsToMany'](db[_0xaa57('0xe9')],{'through':'user_has_teams'});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x40')],{'as':_0xaa57('0x126'),'through':_0xaa57('0x135')});db['User'][_0xaa57('0x12d')](db['ChatInteraction'],{'as':_0xaa57('0x123'),'through':_0xaa57('0x136')});db['User']['belongsToMany'](db[_0xaa57('0x4a')],{'as':_0xaa57('0x125'),'through':_0xaa57('0x137')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x55')],{'as':_0xaa57('0x124'),'through':'user_has_sms_interactions'});db['User']['belongsToMany'](db[_0xaa57('0x121')],{'as':'OpenchannelInteractions','through':_0xaa57('0x138')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x107')],{'as':_0xaa57('0x127'),'through':_0xaa57('0x139')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0xaa57('0x30'),'required':![]});db['User']['belongsToMany'](db[_0xaa57('0xfc')],{'as':'VoicePrefixes','through':_0xaa57('0x113'),'required':![]});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x13a')],{'as':_0xaa57('0x13b'),'through':'UserMailQueue','required':![]});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x6b')],{'as':_0xaa57('0x13c'),'through':_0xaa57('0x31'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0xaa57('0x4e')],{'as':'FaxQueues','through':_0xaa57('0x13d'),'required':![]});db[_0xaa57('0x14')]['belongsToMany'](db[_0xaa57('0x59')],{'as':_0xaa57('0x13e'),'through':_0xaa57('0x13f'),'required':![]});db[_0xaa57('0x14')]['belongsToMany'](db[_0xaa57('0x140')],{'as':_0xaa57('0x141'),'through':_0xaa57('0x36'),'required':![]});db[_0xaa57('0x14')]['belongsToMany'](db[_0xaa57('0x142')],{'as':_0xaa57('0x143'),'through':_0xaa57('0x38'),'required':![]});db[_0xaa57('0x14')][_0xaa57('0x12d')](db['CmList'],{'through':_0xaa57('0x134')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x61')],{'as':_0xaa57('0x144'),'through':_0xaa57('0x145')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db['FaxAccount'],{'as':_0xaa57('0x146'),'through':_0xaa57('0x147')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x3c')],{'as':_0xaa57('0x148'),'through':_0xaa57('0x149')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x5b')],{'as':'OpenchannelAccounts','through':_0xaa57('0x14a')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db['SmsAccount'],{'as':_0xaa57('0x14b'),'through':'user_has_sms_accounts'});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0x103')],{'as':_0xaa57('0x14c'),'through':_0xaa57('0x14d')});db[_0xaa57('0x14')][_0xaa57('0x12d')](db[_0xaa57('0xe4')],{'as':'SquareProjects','through':_0xaa57('0x14e')});db[_0xaa57('0x17')]['hasMany'](db[_0xaa57('0x11e')],{'as':_0xaa57('0x14f'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x150')});db[_0xaa57('0x19')][_0xaa57('0x11b')](db[_0xaa57('0x11e')],{'onDelete':'cascade'});db[_0xaa57('0x11e')][_0xaa57('0x11b')](db['VoiceExtension'],{'as':'Applications','onDelete':'cascade'});db['VoiceMusicOnHold'][_0xaa57('0x12d')](db['Sound'],{'as':_0xaa57('0x151'),'through':_0xaa57('0x152')});db[_0xaa57('0x153')]['hasMany'](db[_0xaa57('0x2f')],{'as':_0xaa57('0x154'),'foreignKey':'VoiceQueueId'});db[_0xaa57('0x153')]['hasMany'](db[_0xaa57('0x72')],{'as':_0xaa57('0x155'),'foreignKey':_0xaa57('0x156')});db[_0xaa57('0x153')][_0xaa57('0x11b')](db[_0xaa57('0x75')],{'as':_0xaa57('0x120'),'foreignKey':_0xaa57('0x156')});db[_0xaa57('0x153')][_0xaa57('0x11b')](db['CmHopperHistory'],{'as':_0xaa57('0x157'),'foreignKey':_0xaa57('0x156')});db['VoiceQueue'][_0xaa57('0x11b')](db[_0xaa57('0x78')],{'as':_0xaa57('0x78'),'foreignKey':_0xaa57('0x156')});db[_0xaa57('0x153')][_0xaa57('0x11b')](db[_0xaa57('0x73')],{'as':_0xaa57('0x158'),'foreignKey':_0xaa57('0x156')});db['VoiceQueue'][_0xaa57('0x11b')](db[_0xaa57('0x159')],{'as':'JscriptySessions','foreignKey':_0xaa57('0x156')});db['VoiceQueue'][_0xaa57('0x12a')](db[_0xaa57('0x2b')],{'as':_0xaa57('0x2b'),'foreignKey':_0xaa57('0x15a')});db[_0xaa57('0x153')][_0xaa57('0x12a')](db['Trunk'],{'as':_0xaa57('0x15b'),'foreignKey':'TrunkBackupId'});db[_0xaa57('0x153')][_0xaa57('0x12a')](db[_0xaa57('0x82')],{'as':_0xaa57('0x82'),'foreignKey':_0xaa57('0x15c')});db[_0xaa57('0x153')][_0xaa57('0x12a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xaa57('0x153')][_0xaa57('0x12d')](db[_0xaa57('0xfa')],{'as':'Lists','through':_0xaa57('0x15d')});db['VoiceQueue'][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':'Agents','through':_0xaa57('0x30')});db['VoiceQueue'][_0xaa57('0x12d')](db[_0xaa57('0xe9')],{'as':_0xaa57('0x15e'),'through':_0xaa57('0x15f')});db[_0xaa57('0x153')][_0xaa57('0x12d')](db[_0xaa57('0xfa')],{'as':'BlackLists','through':_0xaa57('0x160')});db['VoiceRecording'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':_0xaa57('0x14'),'foreignKey':_0xaa57('0x11a')});db['ScreenRecording'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':'User','foreignKey':_0xaa57('0x11a')});db['VoiceMail'][_0xaa57('0x11b')](db['VoiceMailMessage'],{'as':_0xaa57('0x161'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x162'),'sourceKey':_0xaa57('0x163')});db[_0xaa57('0x164')]['belongsTo'](db[_0xaa57('0x118')],{'foreignKey':_0xaa57('0x162'),'targetKey':_0xaa57('0x163')});db[_0xaa57('0x21')][_0xaa57('0x11b')](db['VoiceQueueReport'],{'as':_0xaa57('0x165'),'foreignKey':_0xaa57('0x166'),'constraints':![]});db['VoiceCallReport'][_0xaa57('0x11b')](db[_0xaa57('0x25')],{'as':_0xaa57('0x167'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xaa57('0x14')],{'as':_0xaa57('0x14'),'foreignKey':_0xaa57('0x11a')});db['VoiceCallReport']['belongsTo'](db[_0xaa57('0x70')],{'as':'Contact','foreignKey':_0xaa57('0x168')});db['MailServerIn'][_0xaa57('0x12a')](db[_0xaa57('0x3c')],{'as':_0xaa57('0x3c'),'foreignKey':_0xaa57('0x169')});db[_0xaa57('0x16a')]['belongsTo'](db[_0xaa57('0x10e')],{'as':'CloudProvider','foreignKey':_0xaa57('0x16b'),'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x3b')][_0xaa57('0x12a')](db[_0xaa57('0x3c')],{'as':_0xaa57('0x3c'),'foreignKey':_0xaa57('0x169')});db[_0xaa57('0x3b')][_0xaa57('0x12a')](db[_0xaa57('0x10e')],{'as':_0xaa57('0x10e'),'foreignKey':_0xaa57('0x16b'),'onDelete':_0xaa57('0x16c')});db['MailAccount'][_0xaa57('0x117')](db['MailServerIn'],{'as':'Imap','onDelete':'cascade'});db[_0xaa57('0x3c')][_0xaa57('0x117')](db[_0xaa57('0x3b')],{'as':_0xaa57('0x16d'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x3c')][_0xaa57('0x11b')](db[_0xaa57('0x7f')],{'as':'Dispositions','foreignKey':_0xaa57('0x169'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x3c')][_0xaa57('0x11b')](db[_0xaa57('0x7e')],{'as':_0xaa57('0x16e'),'foreignKey':_0xaa57('0x169')});db[_0xaa57('0x3c')][_0xaa57('0x11b')](db['MailMessage'],{'as':_0xaa57('0x161'),'foreignKey':_0xaa57('0x169')});db[_0xaa57('0x3c')][_0xaa57('0x11b')](db[_0xaa57('0x40')],{'as':_0xaa57('0x16f')});db[_0xaa57('0x3c')]['hasMany'](db[_0xaa57('0x44')],{'as':_0xaa57('0x170')});db[_0xaa57('0x3c')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':_0xaa57('0x171'),'foreignKey':_0xaa57('0x172')});db[_0xaa57('0x3c')]['belongsTo'](db[_0xaa57('0x8e')],{'as':_0xaa57('0x8e'),'foreignKey':_0xaa57('0x173')});db[_0xaa57('0x3c')][_0xaa57('0x12a')](db[_0xaa57('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xaa57('0x174')});db['MailAccount']['belongsToMany'](db['User'],{'as':_0xaa57('0x175'),'through':_0xaa57('0x149')});db['MailQueue'][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':'Agents','through':_0xaa57('0x176')});db[_0xaa57('0x13a')][_0xaa57('0x12d')](db[_0xaa57('0xe9')],{'through':_0xaa57('0x177'),'as':_0xaa57('0x15e')});db['MailInteraction'][_0xaa57('0x11b')](db[_0xaa57('0x42')],{'as':_0xaa57('0x161'),'onDelete':_0xaa57('0x119'),'foreignKey':'MailInteractionId'});db[_0xaa57('0x40')][_0xaa57('0x12a')](db['MailAccount'],{'as':_0xaa57('0x178'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x40')]['belongsTo'](db[_0xaa57('0x14')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0xaa57('0x12d')](db[_0xaa57('0x8c')],{'through':_0xaa57('0x17a'),'as':_0xaa57('0x17b')});db[_0xaa57('0x40')][_0xaa57('0x12d')](db[_0xaa57('0x8c')],{'through':_0xaa57('0x17a'),'as':'ThroughTags'});db[_0xaa57('0x40')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':'Users','through':_0xaa57('0x135'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xaa57('0x11b')](db[_0xaa57('0xf0')],{'as':_0xaa57('0x17c'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x42')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':_0xaa57('0x14')});db[_0xaa57('0x42')]['belongsTo'](db[_0xaa57('0x70')],{'onDelete':'cascade','as':_0xaa57('0x179')});db['MailMessage'][_0xaa57('0x12a')](db[_0xaa57('0x40')],{'as':'Interaction','foreignKey':_0xaa57('0x17d')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0xaa57('0x42')][_0xaa57('0x12a')](db[_0xaa57('0x61')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0xaa57('0x42')][_0xaa57('0x12a')](db[_0xaa57('0x69')],{'as':_0xaa57('0x69'),'foreignKey':_0xaa57('0x17e')});db[_0xaa57('0x44')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'onDelete':'restrict'});db[_0xaa57('0x44')][_0xaa57('0x12a')](db[_0xaa57('0x13a')],{'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x44')][_0xaa57('0x12a')](db[_0xaa57('0x3c')],{'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x44')][_0xaa57('0x12a')](db[_0xaa57('0x82')],{'onDelete':_0xaa57('0x16c'),'foreignKey':'IntervalId'});db[_0xaa57('0x44')][_0xaa57('0x12a')](db['Tag'],{'onDelete':_0xaa57('0x16c'),'foreignKey':_0xaa57('0x17f')});db[_0xaa57('0x180')]['belongsTo'](db[_0xaa57('0x3c')],{});db[_0xaa57('0x180')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':_0xaa57('0x171'),'foreignKey':'ListId'});db[_0xaa57('0x180')][_0xaa57('0x12a')](db['CmContact'],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x180')][_0xaa57('0x12a')](db[_0xaa57('0x40')],{});db[_0xaa57('0x180')][_0xaa57('0x12a')](db['MailMessage'],{});db[_0xaa57('0x180')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{});db[_0xaa57('0x180')][_0xaa57('0x12a')](db[_0xaa57('0x13a')],{});db['Dashboard']['hasMany'](db['DashboardItem'],{'as':_0xaa57('0x181'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x182')][_0xaa57('0x11b')](db[_0xaa57('0x7f')],{'as':_0xaa57('0x183'),'foreignKey':_0xaa57('0x184'),'onDelete':'cascade'});db[_0xaa57('0x182')]['hasMany'](db[_0xaa57('0x7e')],{'as':_0xaa57('0x16e'),'foreignKey':_0xaa57('0x184')});db['FaxAccount']['hasMany'](db['FaxInteraction'],{'as':_0xaa57('0x16f')});db[_0xaa57('0x182')]['hasMany'](db[_0xaa57('0x185')],{'as':_0xaa57('0x170')});db[_0xaa57('0x182')]['hasMany'](db[_0xaa57('0x11e')],{'as':_0xaa57('0x186'),'onDelete':_0xaa57('0x119')});db['FaxAccount']['hasMany'](db[_0xaa57('0x4c')],{'as':_0xaa57('0x161')});db[_0xaa57('0x182')][_0xaa57('0x12a')](db['Trunk'],{'as':'Trunk'});db[_0xaa57('0x182')][_0xaa57('0x12a')](db['CmList'],{'as':_0xaa57('0x171'),'foreignKey':_0xaa57('0x172')});db[_0xaa57('0x182')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xaa57('0x174')});db[_0xaa57('0x182')][_0xaa57('0x12d')](db['User'],{'as':_0xaa57('0x175'),'through':_0xaa57('0x147')});db['FaxApplication']['belongsTo'](db[_0xaa57('0x14')],{'onDelete':'restrict'});db[_0xaa57('0x185')][_0xaa57('0x12a')](db[_0xaa57('0x4e')],{'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x185')][_0xaa57('0x12a')](db[_0xaa57('0x182')],{'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x185')]['belongsTo'](db[_0xaa57('0x8c')],{'onDelete':_0xaa57('0x16c'),'foreignKey':'TagId'});db[_0xaa57('0x4a')][_0xaa57('0x11b')](db[_0xaa57('0x4c')],{'as':_0xaa57('0x161'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0xaa57('0x4a')][_0xaa57('0x12a')](db[_0xaa57('0x182')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x184')});db[_0xaa57('0x4a')]['belongsTo'](db[_0xaa57('0x70')],{'as':'Contact','foreignKey':'ContactId'});db[_0xaa57('0x4a')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':_0xaa57('0x187'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x4a')][_0xaa57('0x12d')](db[_0xaa57('0x8c')],{'through':_0xaa57('0x188'),'as':_0xaa57('0x17b')});db[_0xaa57('0x4a')][_0xaa57('0x12d')](db[_0xaa57('0x8c')],{'through':_0xaa57('0x188'),'as':_0xaa57('0x189')});db[_0xaa57('0x4a')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x18a'),'through':_0xaa57('0x137'),'foreignKey':_0xaa57('0x18b')});db[_0xaa57('0x4c')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'onDelete':_0xaa57('0x119'),'as':'User'});db[_0xaa57('0x4c')][_0xaa57('0x12a')](db['FaxInteraction'],{'as':_0xaa57('0x18c'),'foreignKey':_0xaa57('0x18b')});db['FaxMessage'][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'onDelete':'cascade','as':_0xaa57('0x179')});db[_0xaa57('0x4c')][_0xaa57('0x12a')](db[_0xaa57('0xf0')],{'as':_0xaa57('0xf0'),'foreignKey':'AttachmentId'});db[_0xaa57('0x4c')][_0xaa57('0x12a')](db['FaxAccount'],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x184')});db[_0xaa57('0x4e')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x175'),'through':'UserFaxQueue'});db[_0xaa57('0x4e')][_0xaa57('0x12d')](db[_0xaa57('0xe9')],{'through':_0xaa57('0x18d'),'as':'Teams'});db[_0xaa57('0x50')][_0xaa57('0x12a')](db[_0xaa57('0x182')],{});db[_0xaa57('0x50')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':'List','foreignKey':_0xaa57('0x172')});db[_0xaa57('0x50')][_0xaa57('0x12a')](db['CmContact'],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x50')][_0xaa57('0x12a')](db['FaxInteraction'],{});db[_0xaa57('0x50')][_0xaa57('0x12a')](db[_0xaa57('0x4c')],{});db['FaxQueueReport'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{});db[_0xaa57('0x50')][_0xaa57('0x12a')](db[_0xaa57('0x4e')],{});db[_0xaa57('0x52')]['hasMany'](db[_0xaa57('0x7f')],{'as':_0xaa57('0x183'),'foreignKey':'SmsAccountId','onDelete':_0xaa57('0x119')});db[_0xaa57('0x52')]['hasMany'](db[_0xaa57('0x7e')],{'as':_0xaa57('0x16e'),'foreignKey':_0xaa57('0x18e')});db['SmsAccount']['hasMany'](db['SmsMessage'],{'as':_0xaa57('0x161'),'foreignKey':'SmsAccountId'});db[_0xaa57('0x52')][_0xaa57('0x11b')](db['SmsInteraction'],{'as':'Interactions'});db[_0xaa57('0x52')][_0xaa57('0x11b')](db[_0xaa57('0x54')],{'as':_0xaa57('0x170')});db[_0xaa57('0x52')]['belongsTo'](db[_0xaa57('0xfa')],{'as':'List','foreignKey':_0xaa57('0x172')});db[_0xaa57('0x52')][_0xaa57('0x12a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xaa57('0x174')});db['SmsAccount'][_0xaa57('0x12d')](db['User'],{'as':_0xaa57('0x175'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'onDelete':_0xaa57('0x16c')});db['SmsApplication'][_0xaa57('0x12a')](db[_0xaa57('0x59')],{'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x54')]['belongsTo'](db[_0xaa57('0x52')],{'onDelete':_0xaa57('0x16c')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0xaa57('0x16c'),'foreignKey':'IntervalId'});db[_0xaa57('0x54')]['belongsTo'](db[_0xaa57('0x8c')],{'onDelete':'restrict','foreignKey':_0xaa57('0x17f')});db[_0xaa57('0x55')][_0xaa57('0x11b')](db[_0xaa57('0x57')],{'as':_0xaa57('0x161'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x18f')});db[_0xaa57('0x55')]['belongsTo'](db[_0xaa57('0x52')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x18e')});db['SmsInteraction'][_0xaa57('0x12a')](db['CmContact'],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x55')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':_0xaa57('0x187'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x55')][_0xaa57('0x12d')](db[_0xaa57('0x8c')],{'through':_0xaa57('0x190'),'as':'Tags'});db[_0xaa57('0x55')][_0xaa57('0x12d')](db[_0xaa57('0x8c')],{'through':_0xaa57('0x190'),'as':_0xaa57('0x189')});db[_0xaa57('0x55')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x18a'),'through':_0xaa57('0x191'),'foreignKey':_0xaa57('0x18f')});db[_0xaa57('0x57')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':_0xaa57('0x14')});db['SmsMessage'][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'onDelete':_0xaa57('0x119'),'as':_0xaa57('0x179')});db[_0xaa57('0x57')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0xaa57('0x119'),'as':_0xaa57('0x18c'),'foreignKey':_0xaa57('0x18f')});db['SmsMessage']['belongsTo'](db['SmsAccount'],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x18e')});db[_0xaa57('0x59')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0xaa57('0x192')});db[_0xaa57('0x59')][_0xaa57('0x12d')](db[_0xaa57('0xe9')],{'through':_0xaa57('0x193'),'as':_0xaa57('0x15e')});db['OpenchannelAccount'][_0xaa57('0x11b')](db[_0xaa57('0x7f')],{'as':_0xaa57('0x183'),'foreignKey':_0xaa57('0x194'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x5b')]['hasMany'](db[_0xaa57('0x7e')],{'as':_0xaa57('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0xaa57('0x5b')][_0xaa57('0x11b')](db[_0xaa57('0x121')],{'as':_0xaa57('0x16f'),'foreignKey':'OpenchannelAccountId'});db[_0xaa57('0x5b')]['hasMany'](db['OpenchannelMessage'],{'as':_0xaa57('0x161'),'foreignKey':_0xaa57('0x194')});db[_0xaa57('0x5b')][_0xaa57('0x11b')](db['OpenchannelApplication'],{'as':_0xaa57('0x170'),'foreignKey':_0xaa57('0x194')});db[_0xaa57('0x5b')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':_0xaa57('0x171'),'foreignKey':_0xaa57('0x172')});db[_0xaa57('0x5b')][_0xaa57('0x12a')](db[_0xaa57('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xaa57('0x174')});db[_0xaa57('0x5b')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x175'),'through':_0xaa57('0x14a')});db[_0xaa57('0x5d')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x5d')][_0xaa57('0x12a')](db[_0xaa57('0x140')],{'onDelete':_0xaa57('0x16c'),'foreignKey':_0xaa57('0x195')});db[_0xaa57('0x5d')][_0xaa57('0x12a')](db[_0xaa57('0x5b')],{'onDelete':_0xaa57('0x16c'),'foreignKey':_0xaa57('0x194')});db['OpenchannelApplication'][_0xaa57('0x12a')](db[_0xaa57('0x82')],{'onDelete':_0xaa57('0x16c'),'foreignKey':_0xaa57('0x15c')});db[_0xaa57('0x5d')][_0xaa57('0x12a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xaa57('0x17f')});db[_0xaa57('0x121')]['hasMany'](db['OpenchannelMessage'],{'as':_0xaa57('0x161'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x196')});db[_0xaa57('0x121')][_0xaa57('0x12a')](db[_0xaa57('0x5b')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x194')});db[_0xaa57('0x121')][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x121')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':_0xaa57('0x187'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x121')]['belongsToMany'](db['Tag'],{'through':_0xaa57('0x197'),'as':_0xaa57('0x17b')});db['OpenchannelInteraction']['belongsToMany'](db[_0xaa57('0x8c')],{'through':_0xaa57('0x197'),'as':_0xaa57('0x189')});db[_0xaa57('0x121')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x18a'),'through':'user_has_openchannel_interactions','foreignKey':_0xaa57('0x196')});db['OpenchannelMessage'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'onDelete':_0xaa57('0x119'),'as':'User'});db['OpenchannelMessage'][_0xaa57('0x12a')](db['CmContact'],{'onDelete':_0xaa57('0x119'),'as':_0xaa57('0x179')});db[_0xaa57('0x60')]['belongsTo'](db[_0xaa57('0x121')],{'onDelete':_0xaa57('0x119'),'as':_0xaa57('0x18c'),'foreignKey':_0xaa57('0x196')});db['OpenchannelMessage']['belongsTo'](db[_0xaa57('0xf0')],{'as':'Attachment','foreignKey':_0xaa57('0x198')});db['OpenchannelMessage'][_0xaa57('0x12a')](db[_0xaa57('0x5b')],{'as':_0xaa57('0x178'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x175'),'through':_0xaa57('0x36'),'foreignKey':_0xaa57('0x195')});db[_0xaa57('0x140')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0xaa57('0x15e')});db[_0xaa57('0x61')]['hasMany'](db[_0xaa57('0x7f')],{'as':_0xaa57('0x183'),'foreignKey':_0xaa57('0x199'),'onDelete':'cascade'});db[_0xaa57('0x61')][_0xaa57('0x11b')](db[_0xaa57('0x7e')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0xaa57('0x61')][_0xaa57('0x11b')](db[_0xaa57('0x6c')],{'as':_0xaa57('0x19a')});db[_0xaa57('0x61')][_0xaa57('0x11b')](db[_0xaa57('0x66')],{'as':_0xaa57('0x16f')});db[_0xaa57('0x61')]['hasMany'](db['ChatApplication'],{'as':_0xaa57('0x170')});db[_0xaa57('0x61')][_0xaa57('0x11b')](db[_0xaa57('0x67')],{'as':_0xaa57('0x161')});db[_0xaa57('0x61')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':'List','foreignKey':_0xaa57('0x172')});db[_0xaa57('0x61')]['belongsTo'](db[_0xaa57('0x82')],{'as':_0xaa57('0x82'),'foreignKey':_0xaa57('0x15c')});db[_0xaa57('0x61')]['belongsTo'](db[_0xaa57('0x3c')],{'as':_0xaa57('0x3c'),'foreignKey':_0xaa57('0x169')});db[_0xaa57('0x61')][_0xaa57('0x12a')](db[_0xaa57('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xaa57('0x174')});db[_0xaa57('0x61')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x175'),'through':_0xaa57('0x145')});db[_0xaa57('0x62')][_0xaa57('0x12a')](db[_0xaa57('0x5b')],{});db[_0xaa57('0x62')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':'List','foreignKey':'ListId'});db[_0xaa57('0x62')][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'as':_0xaa57('0x179'),'foreignKey':'ContactId'});db[_0xaa57('0x62')][_0xaa57('0x12a')](db[_0xaa57('0x121')],{});db[_0xaa57('0x62')][_0xaa57('0x12a')](db['OpenchannelMessage'],{});db[_0xaa57('0x62')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{});db[_0xaa57('0x62')][_0xaa57('0x12a')](db[_0xaa57('0x140')],{});db['ChatApplication']['belongsTo'](db['User'],{'as':_0xaa57('0x19b'),'foreignKey':_0xaa57('0x11a'),'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x64')][_0xaa57('0x12a')](db[_0xaa57('0x6b')],{'as':_0xaa57('0x19c'),'foreignKey':_0xaa57('0x19d'),'onDelete':'restrict'});db[_0xaa57('0x64')]['belongsTo'](db[_0xaa57('0x61')],{'as':_0xaa57('0x19e'),'foreignKey':_0xaa57('0x199'),'onDelete':'restrict'});db[_0xaa57('0x64')][_0xaa57('0x12a')](db[_0xaa57('0x8c')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xaa57('0x66')][_0xaa57('0x11b')](db[_0xaa57('0x67')],{'as':'Messages','onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0xaa57('0x66')][_0xaa57('0x12a')](db['ChatWebsite'],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x199')});db[_0xaa57('0x66')]['belongsTo'](db[_0xaa57('0x70')],{'as':'Contact','foreignKey':_0xaa57('0x168')});db[_0xaa57('0x66')]['belongsTo'](db[_0xaa57('0x14')],{'as':_0xaa57('0x187'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x66')]['belongsToMany'](db[_0xaa57('0x8c')],{'through':_0xaa57('0x19f'),'as':_0xaa57('0x17b')});db[_0xaa57('0x66')][_0xaa57('0x12d')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xaa57('0x189')});db[_0xaa57('0x66')]['belongsToMany'](db[_0xaa57('0x14')],{'as':'Users','through':_0xaa57('0x136'),'foreignKey':_0xaa57('0x1a0')});db['ChatMessage'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'onDelete':_0xaa57('0x119'),'as':_0xaa57('0x14')});db['ChatMessage'][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'onDelete':_0xaa57('0x119'),'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x67')][_0xaa57('0x12a')](db[_0xaa57('0x66')],{'onDelete':_0xaa57('0x119'),'as':_0xaa57('0x18c'),'foreignKey':_0xaa57('0x1a0')});db[_0xaa57('0x67')][_0xaa57('0x12a')](db['Attachment'],{'as':_0xaa57('0xf0'),'foreignKey':_0xaa57('0x198')});db['ChatMessage'][_0xaa57('0x12a')](db[_0xaa57('0x61')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x199')});db[_0xaa57('0x69')][_0xaa57('0x11b')](db[_0xaa57('0xf0')],{'as':'Attachments','foreignKey':_0xaa57('0x17e'),'onDelete':_0xaa57('0x119'),'hooks':!![]});db[_0xaa57('0x69')][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'onDelete':_0xaa57('0x119'),'as':'Contact','foreignKey':_0xaa57('0x168')});db[_0xaa57('0x69')][_0xaa57('0x12a')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x175'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xaa57('0x12d')](db[_0xaa57('0xe9')],{'through':_0xaa57('0x1a1'),'as':'Teams'});db['ChatGroup'][_0xaa57('0x11b')](db['ChatInternalMessage'],{'as':_0xaa57('0x161'),'foreignKey':_0xaa57('0x1a2'),'onDelete':'cascade'});db['ChatGroup'][_0xaa57('0x12d')](db['User'],{'as':_0xaa57('0x154'),'through':_0xaa57('0x130')});db['ChatProactiveAction'][_0xaa57('0x12a')](db[_0xaa57('0x61')],{'as':_0xaa57('0x19e'),'foreignKey':_0xaa57('0x199')});db['CmCompany'][_0xaa57('0x11b')](db[_0xaa57('0x70')],{'as':_0xaa57('0x131'),'foreignKey':'CompanyId'});db['CmContact'][_0xaa57('0x11b')](db[_0xaa57('0x72')],{'as':_0xaa57('0x155'),'foreignKey':_0xaa57('0x168')});db['CmContact'][_0xaa57('0x11b')](db[_0xaa57('0x75')],{'as':_0xaa57('0x120'),'foreignKey':'ContactId'});db['CmContact'][_0xaa57('0x11b')](db['CmHopperHistory'],{'as':_0xaa57('0x157'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x70')][_0xaa57('0x11b')](db[_0xaa57('0x78')],{'as':_0xaa57('0x78'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x70')][_0xaa57('0x11b')](db[_0xaa57('0x159')],{'as':'JscriptySessions','foreignKey':_0xaa57('0x168')});db[_0xaa57('0x70')][_0xaa57('0x11b')](db[_0xaa57('0x121')],{'as':_0xaa57('0x122'),'foreignKey':_0xaa57('0x168'),'onDelete':_0xaa57('0x16c')});db['CmContact'][_0xaa57('0x11b')](db[_0xaa57('0x66')],{'as':_0xaa57('0x123'),'foreignKey':_0xaa57('0x168'),'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x70')][_0xaa57('0x11b')](db[_0xaa57('0x55')],{'as':_0xaa57('0x124'),'foreignKey':'ContactId','onDelete':_0xaa57('0x16c')});db[_0xaa57('0x70')][_0xaa57('0x11b')](db[_0xaa57('0x4a')],{'as':'FaxInteractions','foreignKey':_0xaa57('0x168'),'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x70')][_0xaa57('0x11b')](db['MailInteraction'],{'as':_0xaa57('0x126'),'foreignKey':_0xaa57('0x168'),'onDelete':_0xaa57('0x16c')});db['CmContact'][_0xaa57('0x12a')](db[_0xaa57('0x6e')],{'as':_0xaa57('0x1a3'),'foreignKey':'CompanyId'});db[_0xaa57('0x70')][_0xaa57('0x12a')](db['CmList'],{'as':_0xaa57('0x171'),'foreignKey':_0xaa57('0x172'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x70')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':_0xaa57('0x18a'),'through':_0xaa57('0x132')});db[_0xaa57('0x70')]['belongsToMany'](db[_0xaa57('0x8c')],{'as':'Tags','through':_0xaa57('0x1a4')});db[_0xaa57('0x70')]['belongsToMany'](db[_0xaa57('0x8c')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db['CmHopper'][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x72')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':_0xaa57('0x171'),'foreignKey':_0xaa57('0x172'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x72')]['belongsTo'](db[_0xaa57('0x14')],{'as':_0xaa57('0x19b'),'foreignKey':_0xaa57('0x11a')});db[_0xaa57('0x72')][_0xaa57('0x12a')](db[_0xaa57('0x153')],{'as':_0xaa57('0x19c'),'foreignKey':_0xaa57('0x156'),'onDelete':_0xaa57('0x119')});db['CmHopper'][_0xaa57('0x12a')](db[_0xaa57('0xec')],{'as':_0xaa57('0xec'),'foreignKey':'CampaignId','onDelete':_0xaa57('0x119')});db[_0xaa57('0x72')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':'Owner','foreignKey':_0xaa57('0x1a5')});db[_0xaa57('0x73')]['belongsTo'](db[_0xaa57('0x70')],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x73')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':_0xaa57('0x171'),'foreignKey':_0xaa57('0x172'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x73')][_0xaa57('0x12a')](db[_0xaa57('0x153')],{'as':_0xaa57('0x19c'),'foreignKey':_0xaa57('0x156'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x73')]['belongsTo'](db[_0xaa57('0xec')],{'as':_0xaa57('0xec'),'foreignKey':'CampaignId','onDelete':_0xaa57('0x119')});db[_0xaa57('0x7c')][_0xaa57('0x11b')](db[_0xaa57('0x80')],{'as':{'plural':_0xaa57('0x1a6'),'singular':_0xaa57('0x1a7')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0xaa57('0x7c')][_0xaa57('0x11b')](db[_0xaa57('0x80')],{'as':{'plural':_0xaa57('0x1a8'),'singular':_0xaa57('0x1a9')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0xaa57('0x7c')][_0xaa57('0x11b')](db[_0xaa57('0x1aa')],{'as':_0xaa57('0x1ab'),'foreignKey':_0xaa57('0x1ac'),'onDelete':_0xaa57('0x119'),'hooks':!![]});db['Disposition'][_0xaa57('0x11b')](db[_0xaa57('0x7f')],{'as':_0xaa57('0x183'),'foreignKey':_0xaa57('0x1ad'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x82')][_0xaa57('0x11b')](db[_0xaa57('0x82')],{'as':_0xaa57('0x1ae'),'foreignKey':_0xaa57('0x15c'),'onDelete':_0xaa57('0x119'),'hooks':!![],'required':![]});db[_0xaa57('0x82')][_0xaa57('0x11b')](db[_0xaa57('0x11e')],{'as':_0xaa57('0x11f'),'foreignKey':_0xaa57('0x15c'),'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x82')][_0xaa57('0x11b')](db[_0xaa57('0x44')],{'as':_0xaa57('0x1af'),'foreignKey':_0xaa57('0x15c')});db[_0xaa57('0x82')]['hasMany'](db['ChatApplication'],{'as':_0xaa57('0x1b0'),'foreignKey':_0xaa57('0x15c')});db[_0xaa57('0x82')][_0xaa57('0x11b')](db[_0xaa57('0x185')],{'as':_0xaa57('0x1b1'),'foreignKey':_0xaa57('0x15c')});db[_0xaa57('0x82')]['hasMany'](db[_0xaa57('0x54')],{'as':_0xaa57('0x1b2'),'foreignKey':_0xaa57('0x15c')});db[_0xaa57('0x89')][_0xaa57('0x12a')](db['MailAccount'],{});db[_0xaa57('0x89')][_0xaa57('0x12a')](db['AnalyticDefaultReport'],{'foreignKey':_0xaa57('0x1b3')});db[_0xaa57('0x89')][_0xaa57('0x12a')](db[_0xaa57('0x96')],{'foreignKey':'CustomReportId'});db[_0xaa57('0x8a')][_0xaa57('0x12d')](db[_0xaa57('0x1b4')],{'as':'Mohs','through':_0xaa57('0x152'),'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x8c')][_0xaa57('0x12d')](db[_0xaa57('0x70')],{'through':_0xaa57('0x1a4')});db[_0xaa57('0x8c')][_0xaa57('0x12d')](db[_0xaa57('0x66')],{'through':_0xaa57('0x19f')});db[_0xaa57('0x8c')]['belongsToMany'](db[_0xaa57('0x40')],{'through':_0xaa57('0x17a')});db[_0xaa57('0x8c')][_0xaa57('0x12d')](db[_0xaa57('0x55')],{'through':_0xaa57('0x190')});db[_0xaa57('0x8c')]['belongsToMany'](db[_0xaa57('0x4a')],{'through':_0xaa57('0x188')});db[_0xaa57('0x8c')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xaa57('0x8c')][_0xaa57('0x12d')](db['WhatsappInteraction'],{'through':_0xaa57('0x1b5')});db[_0xaa57('0x90')][_0xaa57('0x11b')](db[_0xaa57('0x80')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0xaa57('0x1b6'),'onDelete':_0xaa57('0x119'),'hooks':!![]});db[_0xaa57('0x90')][_0xaa57('0x11b')](db['Condition'],{'as':{'plural':_0xaa57('0x1b7'),'singular':'AnyCondition'},'foreignKey':_0xaa57('0x1b8'),'onDelete':_0xaa57('0x119'),'hooks':!![]});db[_0xaa57('0x90')][_0xaa57('0x11b')](db[_0xaa57('0x1aa')],{'as':_0xaa57('0x1ab'),'foreignKey':_0xaa57('0x1b9'),'onDelete':_0xaa57('0x119'),'hooks':!![]});db[_0xaa57('0x96')][_0xaa57('0x11b')](db[_0xaa57('0x9b')],{'as':_0xaa57('0x1ba'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bb'),'hooks':!![]});db[_0xaa57('0x1bc')][_0xaa57('0x11b')](db[_0xaa57('0x9b')],{'as':_0xaa57('0x1ba'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1b3')});db[_0xaa57('0x99')][_0xaa57('0x11b')](db[_0xaa57('0x9b')],{'as':'Fields','onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bd')});db[_0xaa57('0x9b')][_0xaa57('0x12a')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0xaa57('0x11b')](db['SalesforceConfiguration'],{'as':_0xaa57('0x1be'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xa1')]['hasMany'](db[_0xaa57('0xa3')],{'as':'Subjects','onDelete':_0xaa57('0x119'),'foreignKey':'SubjectId'});db[_0xaa57('0xa1')][_0xaa57('0x11b')](db['SalesforceField'],{'as':_0xaa57('0x1c0'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xa1')][_0xaa57('0x11b')](db[_0xaa57('0xa3')],{'as':_0xaa57('0x1ba'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xa1')][_0xaa57('0x12a')](db[_0xaa57('0x9f')],{'as':_0xaa57('0x178'),'foreignKey':'AccountId'});db[_0xaa57('0xa3')][_0xaa57('0x11b')](db[_0xaa57('0xa3')],{'as':'Subject','foreignKey':_0xaa57('0x1c3')});db['SalesforceField'][_0xaa57('0x11b')](db[_0xaa57('0xa3')],{'as':_0xaa57('0x1c4'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xa3')][_0xaa57('0x11b')](db['SalesforceField'],{'as':_0xaa57('0x1c5'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xa3')][_0xaa57('0x12a')](db[_0xaa57('0x1c6')],{'as':_0xaa57('0x1c6'),'foreignKey':_0xaa57('0x1c7')});db[_0xaa57('0xa5')][_0xaa57('0x11b')](db[_0xaa57('0xa6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xa6')]['hasMany'](db[_0xaa57('0xa8')],{'as':_0xaa57('0x1c8'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xaa57('0xa6')][_0xaa57('0x11b')](db['SugarcrmField'],{'as':_0xaa57('0x1c0'),'onDelete':'cascade','foreignKey':_0xaa57('0x1c1')});db['SugarcrmConfiguration'][_0xaa57('0x11b')](db[_0xaa57('0xa8')],{'as':_0xaa57('0x1ba'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xa6')][_0xaa57('0x12a')](db[_0xaa57('0xa5')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xa8')][_0xaa57('0x11b')](db[_0xaa57('0xa8')],{'as':'Subject','foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xa8')][_0xaa57('0x11b')](db[_0xaa57('0xa8')],{'as':_0xaa57('0x1c4'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xa8')]['hasMany'](db[_0xaa57('0xa8')],{'as':_0xaa57('0x1c5'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xa8')][_0xaa57('0x12a')](db[_0xaa57('0x1c6')],{'as':'Variable','foreignKey':_0xaa57('0x1c7')});db[_0xaa57('0xaa')]['hasMany'](db['DeskConfiguration'],{'as':_0xaa57('0x1be'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xac')]['hasMany'](db[_0xaa57('0xad')],{'as':_0xaa57('0x1c8'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xac')][_0xaa57('0x11b')](db[_0xaa57('0xad')],{'as':'Descriptions','onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xac')]['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xac')][_0xaa57('0x12a')](db[_0xaa57('0xaa')],{'as':'Account','foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xac')][_0xaa57('0x12d')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0xaa57('0xad')]['hasMany'](db['DeskField'],{'as':_0xaa57('0x1c9'),'foreignKey':_0xaa57('0x1c3')});db['DeskField'][_0xaa57('0x11b')](db[_0xaa57('0xad')],{'as':_0xaa57('0x1c4'),'foreignKey':_0xaa57('0x1c1')});db['DeskField'][_0xaa57('0x11b')](db[_0xaa57('0xad')],{'as':'Field','foreignKey':'FieldId'});db[_0xaa57('0xad')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xaa57('0x1c7')});db[_0xaa57('0xaf')][_0xaa57('0x11b')](db[_0xaa57('0xb1')],{'as':_0xaa57('0x1be'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xb1')]['hasMany'](db[_0xaa57('0xb3')],{'as':_0xaa57('0x1c8'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c3')});db['ZohoConfiguration'][_0xaa57('0x11b')](db['ZohoField'],{'as':_0xaa57('0x1c0'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xb1')][_0xaa57('0x11b')](db[_0xaa57('0xb3')],{'as':_0xaa57('0x1ba'),'onDelete':'cascade','foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xb1')][_0xaa57('0x12a')](db[_0xaa57('0xaf')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xb3')]['hasMany'](db[_0xaa57('0xb3')],{'as':_0xaa57('0x1c9'),'foreignKey':_0xaa57('0x1c3')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0xaa57('0x1c4'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xb3')][_0xaa57('0x11b')](db[_0xaa57('0xb3')],{'as':_0xaa57('0x1c5'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xb3')]['belongsTo'](db[_0xaa57('0x1c6')],{'as':_0xaa57('0x1c6'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0xaa57('0x11b')](db[_0xaa57('0xb6')],{'as':_0xaa57('0x1be'),'onDelete':_0xaa57('0x119'),'foreignKey':'AccountId'});db[_0xaa57('0xb6')]['hasMany'](db[_0xaa57('0xb8')],{'as':_0xaa57('0x1c8'),'foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xb6')][_0xaa57('0x11b')](db[_0xaa57('0xb8')],{'as':'Descriptions','foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xb6')][_0xaa57('0x11b')](db[_0xaa57('0xb8')],{'as':'Fields','foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xb6')][_0xaa57('0x12a')](db[_0xaa57('0xb5')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xb6')]['belongsToMany'](db[_0xaa57('0x8c')],{'through':'int_zendesk_configuration_has_tags'});db[_0xaa57('0xb8')][_0xaa57('0x11b')](db['ZendeskField'],{'as':_0xaa57('0x1c9'),'foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xb8')][_0xaa57('0x11b')](db['ZendeskField'],{'as':_0xaa57('0x1c4'),'foreignKey':'DescriptionId'});db[_0xaa57('0xb8')][_0xaa57('0x11b')](db[_0xaa57('0xb8')],{'as':_0xaa57('0x1c5'),'foreignKey':'FieldId'});db[_0xaa57('0xb8')][_0xaa57('0x12a')](db[_0xaa57('0x1c6')],{'as':'Variable','foreignKey':_0xaa57('0x1c7')});db[_0xaa57('0x1ca')][_0xaa57('0x11b')](db[_0xaa57('0xbb')],{'as':'Configurations','onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bf')});db['FreshdeskConfiguration'][_0xaa57('0x11b')](db[_0xaa57('0xbd')],{'as':_0xaa57('0x1c8'),'onDelete':'cascade','foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xbb')]['hasMany'](db[_0xaa57('0xbd')],{'as':'Descriptions','onDelete':_0xaa57('0x119'),'foreignKey':'DescriptionId'});db[_0xaa57('0xbb')][_0xaa57('0x11b')](db[_0xaa57('0xbd')],{'as':_0xaa57('0x1ba'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xbb')][_0xaa57('0x12a')](db['FreshdeskAccount'],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1bf')});db['FreshdeskConfiguration']['belongsToMany'](db[_0xaa57('0x8c')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xaa57('0xbd')][_0xaa57('0x11b')](db[_0xaa57('0xbd')],{'as':_0xaa57('0x1c9'),'foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xbd')]['hasMany'](db[_0xaa57('0xbd')],{'as':_0xaa57('0x1c4'),'foreignKey':_0xaa57('0x1c1')});db['FreshdeskField'][_0xaa57('0x11b')](db[_0xaa57('0xbd')],{'as':_0xaa57('0x1c5'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xbd')][_0xaa57('0x12a')](db[_0xaa57('0x1c6')],{'as':'Variable','foreignKey':_0xaa57('0x1c7')});db[_0xaa57('0xbe')][_0xaa57('0x11b')](db[_0xaa57('0xc0')],{'as':_0xaa57('0x1be'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xc0')]['hasMany'](db[_0xaa57('0xc2')],{'as':'Subjects','foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xc0')][_0xaa57('0x11b')](db[_0xaa57('0xc2')],{'as':_0xaa57('0x1c0'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xc0')][_0xaa57('0x11b')](db[_0xaa57('0xc2')],{'as':_0xaa57('0x1ba'),'foreignKey':_0xaa57('0x1c2')});db['VtigerConfiguration'][_0xaa57('0x12a')](db[_0xaa57('0xbe')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1bf')});db['VtigerField'][_0xaa57('0x11b')](db['VtigerField'],{'as':_0xaa57('0x1c9'),'foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xc2')][_0xaa57('0x11b')](db[_0xaa57('0xc2')],{'as':_0xaa57('0x1c4'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xc2')][_0xaa57('0x11b')](db['VtigerField'],{'as':_0xaa57('0x1c5'),'foreignKey':'FieldId'});db[_0xaa57('0xc2')][_0xaa57('0x12a')](db['Variable'],{'as':_0xaa57('0x1c6'),'foreignKey':_0xaa57('0x1c7')});db['ServicenowAccount']['hasMany'](db['ServicenowConfiguration'],{'as':_0xaa57('0x1be'),'onDelete':_0xaa57('0x119'),'foreignKey':'AccountId'});db[_0xaa57('0xc6')]['hasMany'](db[_0xaa57('0xc8')],{'as':_0xaa57('0x1c8'),'foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xc6')][_0xaa57('0x11b')](db[_0xaa57('0xc8')],{'as':'Descriptions','foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xc6')]['hasMany'](db[_0xaa57('0xc8')],{'as':_0xaa57('0x1ba'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xc6')][_0xaa57('0x12a')](db[_0xaa57('0xc4')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xc8')][_0xaa57('0x11b')](db[_0xaa57('0xc8')],{'as':'Subject','foreignKey':_0xaa57('0x1c3')});db['ServicenowField'][_0xaa57('0x11b')](db[_0xaa57('0xc8')],{'as':'Description','foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xc8')]['hasMany'](db[_0xaa57('0xc8')],{'as':_0xaa57('0x1c5'),'foreignKey':'FieldId'});db[_0xaa57('0xc8')][_0xaa57('0x12a')](db[_0xaa57('0x1c6')],{'as':_0xaa57('0x1c6'),'foreignKey':_0xaa57('0x1c7')});db[_0xaa57('0x1cb')][_0xaa57('0x11b')](db[_0xaa57('0xca')],{'as':_0xaa57('0x1be'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0x1cb')]['belongsTo'](db[_0xaa57('0x10e')],{'as':_0xaa57('0x10e'),'foreignKey':_0xaa57('0x16b')});db[_0xaa57('0xca')][_0xaa57('0x11b')](db['Dynamics365Field'],{'as':_0xaa57('0x1c8'),'onDelete':'cascade','foreignKey':_0xaa57('0x1c3')});db['Dynamics365Configuration']['hasMany'](db[_0xaa57('0x1cc')],{'as':'Descriptions','onDelete':_0xaa57('0x119'),'foreignKey':'DescriptionId'});db[_0xaa57('0xca')]['hasMany'](db[_0xaa57('0x1cc')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xca')][_0xaa57('0x12a')](db[_0xaa57('0x1cb')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0x1cc')][_0xaa57('0x11b')](db[_0xaa57('0x1cc')],{'as':_0xaa57('0x1c9'),'foreignKey':'SubjectId'});db[_0xaa57('0x1cc')][_0xaa57('0x11b')](db[_0xaa57('0x1cc')],{'as':_0xaa57('0x1c4'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0x1cc')][_0xaa57('0x11b')](db[_0xaa57('0x1cc')],{'as':_0xaa57('0x1c5'),'foreignKey':_0xaa57('0x1c2')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0xaa57('0x1c6'),'foreignKey':_0xaa57('0x1c7')});db[_0xaa57('0xcd')]['hasMany'](db[_0xaa57('0xcf')],{'as':_0xaa57('0x1be'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xcf')][_0xaa57('0x11b')](db['FreshsalesField'],{'as':_0xaa57('0x1c8'),'foreignKey':_0xaa57('0x1c3')});db['FreshsalesConfiguration'][_0xaa57('0x11b')](db['FreshsalesField'],{'as':_0xaa57('0x1c0'),'foreignKey':_0xaa57('0x1c1')});db[_0xaa57('0xcf')][_0xaa57('0x11b')](db[_0xaa57('0xd1')],{'as':'Fields','foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xcf')][_0xaa57('0x12a')](db[_0xaa57('0xcd')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1bf')});db[_0xaa57('0xd1')][_0xaa57('0x11b')](db[_0xaa57('0xd1')],{'as':_0xaa57('0x1c9'),'foreignKey':_0xaa57('0x1c3')});db[_0xaa57('0xd1')][_0xaa57('0x11b')](db[_0xaa57('0xd1')],{'as':_0xaa57('0x1c4'),'foreignKey':'DescriptionId'});db[_0xaa57('0xd1')][_0xaa57('0x11b')](db[_0xaa57('0xd1')],{'as':_0xaa57('0x1c5'),'foreignKey':_0xaa57('0x1c2')});db[_0xaa57('0xd1')][_0xaa57('0x12a')](db['Variable'],{'as':_0xaa57('0x1c6'),'foreignKey':_0xaa57('0x1c7')});db[_0xaa57('0xd4')]['belongsTo'](db[_0xaa57('0x61')],{});db[_0xaa57('0xd4')]['belongsTo'](db[_0xaa57('0xfa')],{'as':_0xaa57('0x171'),'foreignKey':'ListId'});db[_0xaa57('0xd4')][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0xd4')][_0xaa57('0x12a')](db[_0xaa57('0x66')],{});db[_0xaa57('0xd4')][_0xaa57('0x12a')](db[_0xaa57('0x67')],{});db['ChatQueueReport']['belongsTo'](db[_0xaa57('0x14')],{});db[_0xaa57('0xd4')]['belongsTo'](db['ChatQueue'],{});db[_0xaa57('0xd6')][_0xaa57('0x12a')](db['User'],{'onDelete':_0xaa57('0x119'),'foreignKey':'FromId'});db[_0xaa57('0xd6')][_0xaa57('0x12a')](db['User'],{'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1cd')});db[_0xaa57('0x159')][_0xaa57('0x11b')](db[_0xaa57('0x1ce')],{'foreignKey':'SessionId','onDelete':_0xaa57('0x119')});db[_0xaa57('0x159')]['hasMany'](db[_0xaa57('0x1cf')],{'foreignKey':_0xaa57('0x1d0'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0xdb')][_0xaa57('0x12a')](db[_0xaa57('0x52')],{});db[_0xaa57('0xdb')]['belongsTo'](db['CmList'],{'as':_0xaa57('0x171'),'foreignKey':'ListId'});db[_0xaa57('0xdb')]['belongsTo'](db[_0xaa57('0x70')],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0xdb')][_0xaa57('0x12a')](db[_0xaa57('0x55')],{});db[_0xaa57('0xdb')][_0xaa57('0x12a')](db[_0xaa57('0x57')],{});db[_0xaa57('0xdb')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{});db[_0xaa57('0xdb')][_0xaa57('0x12a')](db[_0xaa57('0x59')],{});db[_0xaa57('0x1d1')][_0xaa57('0x11b')](db['JscriptySessionReport'],{'foreignKey':_0xaa57('0x1d2')});db['JscriptyProject'][_0xaa57('0x11b')](db[_0xaa57('0x1ce')],{'foreignKey':_0xaa57('0x1d2')});db[_0xaa57('0x1d1')]['hasMany'](db[_0xaa57('0x1cf')],{'foreignKey':_0xaa57('0x1d2')});db[_0xaa57('0xe4')]['belongsToMany'](db[_0xaa57('0x14')],{'as':'Users','through':_0xaa57('0x14e')});db[_0xaa57('0xe9')]['belongsToMany'](db[_0xaa57('0x14')],{'as':_0xaa57('0x175'),'through':_0xaa57('0x1d3')});db[_0xaa57('0xe9')][_0xaa57('0x12d')](db[_0xaa57('0x153')],{'through':_0xaa57('0x15f'),'as':'VoiceQueues'});db[_0xaa57('0xe9')]['belongsToMany'](db[_0xaa57('0x13a')],{'through':'team_has_mail_queues','as':_0xaa57('0x13b')});db[_0xaa57('0xe9')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db['Team'][_0xaa57('0x12d')](db[_0xaa57('0x4e')],{'through':_0xaa57('0x18d'),'as':_0xaa57('0x1d4')});db[_0xaa57('0xe9')][_0xaa57('0x12d')](db[_0xaa57('0x59')],{'through':'team_has_sms_queues','as':_0xaa57('0x13e')});db[_0xaa57('0xe9')][_0xaa57('0x12d')](db[_0xaa57('0x140')],{'through':_0xaa57('0x1d5'),'as':'OpenchannelQueues'});db['Team'][_0xaa57('0x12d')](db[_0xaa57('0x142')],{'through':_0xaa57('0x1d6'),'as':_0xaa57('0x143')});db['Team'][_0xaa57('0x12d')](db[_0xaa57('0xfc')],{'through':_0xaa57('0x111'),'as':_0xaa57('0x1d7')});db[_0xaa57('0xec')][_0xaa57('0x11b')](db[_0xaa57('0x72')],{'as':_0xaa57('0x155'),'foreignKey':_0xaa57('0x1d8')});db[_0xaa57('0xec')][_0xaa57('0x11b')](db[_0xaa57('0x75')],{'as':_0xaa57('0x120'),'foreignKey':'CampaignId'});db[_0xaa57('0xec')][_0xaa57('0x11b')](db[_0xaa57('0x76')],{'as':_0xaa57('0x157'),'foreignKey':'CampaignId'});db[_0xaa57('0xec')][_0xaa57('0x11b')](db[_0xaa57('0x73')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0xaa57('0xec')][_0xaa57('0x12a')](db[_0xaa57('0x2b')],{'as':_0xaa57('0x2b'),'foreignKey':_0xaa57('0x15a')});db[_0xaa57('0xec')]['belongsTo'](db['Trunk'],{'as':_0xaa57('0x15b'),'foreignKey':_0xaa57('0x1d9')});db[_0xaa57('0xec')][_0xaa57('0x12a')](db[_0xaa57('0x82')],{'as':_0xaa57('0x82'),'foreignKey':_0xaa57('0x15c')});db[_0xaa57('0xec')][_0xaa57('0x12a')](db[_0xaa57('0xe4')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xaa57('0xec')][_0xaa57('0x12d')](db['CmList'],{'as':_0xaa57('0x133'),'through':'campaigns_has_cm_lists'});db[_0xaa57('0xec')][_0xaa57('0x12d')](db[_0xaa57('0xfa')],{'as':'BlackLists','through':_0xaa57('0x1da')});db[_0xaa57('0xf0')][_0xaa57('0x12a')](db['ChatOfflineMessage'],{'as':_0xaa57('0x69'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x42')],{});db[_0xaa57('0x1db')][_0xaa57('0x12a')](db[_0xaa57('0x40')],{});db[_0xaa57('0x1db')][_0xaa57('0x12a')](db[_0xaa57('0x3c')],{'foreignKey':_0xaa57('0x1dc'),'as':_0xaa57('0x1dd')});db[_0xaa57('0x1db')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':'FromUserId','as':_0xaa57('0x1de')});db[_0xaa57('0x1db')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':_0xaa57('0x1df'),'as':_0xaa57('0x1e0')});db['MailTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x13a')],{'foreignKey':_0xaa57('0x1e1'),'as':_0xaa57('0x1e2')});db[_0xaa57('0x1db')][_0xaa57('0x12a')](db[_0xaa57('0x3c')],{'foreignKey':_0xaa57('0x1e3'),'as':_0xaa57('0x1e4')});db[_0xaa57('0xf4')][_0xaa57('0x12a')](db['ChatMessage'],{});db[_0xaa57('0xf4')][_0xaa57('0x12a')](db[_0xaa57('0x66')],{});db[_0xaa57('0xf4')][_0xaa57('0x12a')](db[_0xaa57('0x61')],{'foreignKey':_0xaa57('0x1e5'),'as':_0xaa57('0x1dd')});db['ChatTransferReport']['belongsTo'](db[_0xaa57('0x14')],{'foreignKey':'FromUserId','as':_0xaa57('0x1de')});db['ChatTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':_0xaa57('0x1df'),'as':_0xaa57('0x1e0')});db[_0xaa57('0xf4')][_0xaa57('0x12a')](db[_0xaa57('0x6b')],{'foreignKey':'ToChatQueueId','as':_0xaa57('0x1e2')});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xaa57('0x1e6'),'as':'ToAccount'});db['FaxTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x4c')],{});db[_0xaa57('0xf5')][_0xaa57('0x12a')](db['FaxInteraction'],{});db[_0xaa57('0xf5')][_0xaa57('0x12a')](db[_0xaa57('0x182')],{'foreignKey':'FromFaxAccountId','as':_0xaa57('0x1dd')});db['FaxTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':_0xaa57('0x1e7'),'as':'FromAgent'});db[_0xaa57('0xf5')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':_0xaa57('0x1df'),'as':_0xaa57('0x1e0')});db[_0xaa57('0xf5')][_0xaa57('0x12a')](db[_0xaa57('0x4e')],{'foreignKey':'ToFaxQueueId','as':_0xaa57('0x1e2')});db['FaxTransferReport'][_0xaa57('0x12a')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0xaa57('0x1e4')});db[_0xaa57('0xf6')][_0xaa57('0x12a')](db[_0xaa57('0x60')],{});db[_0xaa57('0xf6')][_0xaa57('0x12a')](db['OpenchannelInteraction'],{});db[_0xaa57('0xf6')][_0xaa57('0x12a')](db['OpenchannelAccount'],{'foreignKey':_0xaa57('0x1e8'),'as':_0xaa57('0x1dd')});db[_0xaa57('0xf6')]['belongsTo'](db[_0xaa57('0x14')],{'foreignKey':'FromUserId','as':_0xaa57('0x1de')});db[_0xaa57('0xf6')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':_0xaa57('0x1df'),'as':_0xaa57('0x1e0')});db[_0xaa57('0xf6')][_0xaa57('0x12a')](db[_0xaa57('0x140')],{'foreignKey':_0xaa57('0x1e9'),'as':_0xaa57('0x1e2')});db[_0xaa57('0xf6')][_0xaa57('0x12a')](db['OpenchannelAccount'],{'foreignKey':_0xaa57('0x1ea'),'as':_0xaa57('0x1e4')});db['SmsTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x57')],{});db[_0xaa57('0xf8')][_0xaa57('0x12a')](db[_0xaa57('0x55')],{});db[_0xaa57('0xf8')]['belongsTo'](db[_0xaa57('0x52')],{'foreignKey':_0xaa57('0x1eb'),'as':'FromAccount'});db[_0xaa57('0xf8')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xaa57('0xf8')][_0xaa57('0x12a')](db['User'],{'foreignKey':_0xaa57('0x1df'),'as':_0xaa57('0x1e0')});db[_0xaa57('0xf8')]['belongsTo'](db[_0xaa57('0x59')],{'foreignKey':'ToSmsQueueId','as':_0xaa57('0x1e2')});db[_0xaa57('0xf8')][_0xaa57('0x12a')](db[_0xaa57('0x52')],{'foreignKey':_0xaa57('0x1ec'),'as':_0xaa57('0x1e4')});db[_0xaa57('0xfa')][_0xaa57('0x11b')](db[_0xaa57('0x7f')],{'as':_0xaa57('0x183'),'foreignKey':'ListId','onDelete':_0xaa57('0x119')});db[_0xaa57('0xfa')][_0xaa57('0x11b')](db['CmCustomField'],{'as':_0xaa57('0x1ed'),'foreignKey':_0xaa57('0x172')});db[_0xaa57('0xfa')][_0xaa57('0x11b')](db[_0xaa57('0x70')],{'as':_0xaa57('0x131'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList']['hasMany'](db[_0xaa57('0x75')],{'as':_0xaa57('0x120'),'foreignKey':_0xaa57('0x172')});db[_0xaa57('0xfa')]['hasMany'](db[_0xaa57('0x76')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0xaa57('0xfa')]['hasMany'](db['ReportAgentPreview'],{'as':_0xaa57('0x78'),'foreignKey':_0xaa57('0x172')});db['CmList'][_0xaa57('0x12d')](db[_0xaa57('0x153')],{'as':'Queues','through':_0xaa57('0x15d')});db[_0xaa57('0xfa')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':'Agents','through':_0xaa57('0x134')});db['VoicePrefix']['hasMany'](db['VoiceExtension'],{'as':_0xaa57('0x11f'),'onDelete':_0xaa57('0x119')});db['VoicePrefix']['belongsToMany'](db['User'],{'as':_0xaa57('0x175'),'through':'UserVoicePrefix'});db[_0xaa57('0xfc')][_0xaa57('0x12d')](db[_0xaa57('0xe9')],{'through':_0xaa57('0x111'),'as':'Teams'});db[_0xaa57('0x12b')]['hasMany'](db[_0xaa57('0x14')],{'as':'Users','foreignKey':_0xaa57('0x12c')});db[_0xaa57('0x12b')][_0xaa57('0x11b')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xaa57('0x12c'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0xff')][_0xaa57('0x11b')](db[_0xaa57('0x1ee')],{'as':_0xaa57('0x1ef'),'foreignKey':_0xaa57('0x1f0'),'onDelete':_0xaa57('0x119')});db[_0xaa57('0x103')]['hasMany'](db[_0xaa57('0x7f')],{'as':_0xaa57('0x183'),'foreignKey':_0xaa57('0x1f1'),'onDelete':'cascade'});db[_0xaa57('0x103')][_0xaa57('0x11b')](db[_0xaa57('0x7e')],{'as':_0xaa57('0x16e'),'foreignKey':_0xaa57('0x1f1')});db['WhatsappAccount'][_0xaa57('0x11b')](db['WhatsappMessage'],{'as':_0xaa57('0x161'),'foreignKey':_0xaa57('0x1f1')});db[_0xaa57('0x103')][_0xaa57('0x11b')](db[_0xaa57('0x107')],{'as':'Interactions'});db[_0xaa57('0x103')][_0xaa57('0x11b')](db['WhatsappApplication'],{'as':'Applications'});db[_0xaa57('0x103')][_0xaa57('0x12a')](db[_0xaa57('0xfa')],{'as':_0xaa57('0x171'),'foreignKey':'ListId'});db[_0xaa57('0x103')][_0xaa57('0x12a')](db[_0xaa57('0x84')],{'as':_0xaa57('0x1f2'),'foreignKey':_0xaa57('0x174')});db[_0xaa57('0x103')][_0xaa57('0x12d')](db[_0xaa57('0x14')],{'as':'Agents','through':_0xaa57('0x14d')});db[_0xaa57('0x105')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xaa57('0x12a')](db[_0xaa57('0x142')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0xaa57('0x103')],{'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x105')][_0xaa57('0x12a')](db[_0xaa57('0x82')],{'onDelete':_0xaa57('0x16c'),'foreignKey':'IntervalId'});db[_0xaa57('0x105')][_0xaa57('0x12a')](db[_0xaa57('0x8c')],{'onDelete':_0xaa57('0x16c'),'foreignKey':_0xaa57('0x17f')});db[_0xaa57('0x107')][_0xaa57('0x11b')](db['WhatsappMessage'],{'as':_0xaa57('0x161'),'onDelete':_0xaa57('0x119'),'foreignKey':_0xaa57('0x1f3')});db[_0xaa57('0x107')][_0xaa57('0x12a')](db[_0xaa57('0x103')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1f1')});db['WhatsappInteraction']['belongsTo'](db[_0xaa57('0x70')],{'as':'Contact','foreignKey':_0xaa57('0x168')});db[_0xaa57('0x107')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':'Owner','foreignKey':_0xaa57('0x11a')});db['WhatsappInteraction']['belongsToMany'](db[_0xaa57('0x8c')],{'through':_0xaa57('0x1b5'),'as':_0xaa57('0x17b')});db['WhatsappInteraction'][_0xaa57('0x12d')](db[_0xaa57('0x8c')],{'through':_0xaa57('0x1b5'),'as':_0xaa57('0x189')});db[_0xaa57('0x107')]['belongsToMany'](db[_0xaa57('0x14')],{'as':'Users','through':_0xaa57('0x139'),'foreignKey':_0xaa57('0x1f3')});db[_0xaa57('0x109')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':'User'});db[_0xaa57('0x109')][_0xaa57('0x12a')](db[_0xaa57('0x70')],{'onDelete':_0xaa57('0x119'),'as':_0xaa57('0x179')});db[_0xaa57('0x109')][_0xaa57('0x12a')](db[_0xaa57('0x107')],{'onDelete':_0xaa57('0x119'),'as':'Interaction','foreignKey':_0xaa57('0x1f3')});db[_0xaa57('0x109')][_0xaa57('0x12a')](db[_0xaa57('0x103')],{'as':_0xaa57('0x178'),'foreignKey':_0xaa57('0x1f1')});db['WhatsappQueueReport'][_0xaa57('0x12a')](db['WhatsappAccount'],{});db[_0xaa57('0x10a')][_0xaa57('0x12a')](db['CmList'],{'as':_0xaa57('0x171'),'foreignKey':_0xaa57('0x172')});db['WhatsappQueueReport'][_0xaa57('0x12a')](db['CmContact'],{'as':_0xaa57('0x179'),'foreignKey':_0xaa57('0x168')});db[_0xaa57('0x10a')][_0xaa57('0x12a')](db[_0xaa57('0x107')],{});db[_0xaa57('0x10a')]['belongsTo'](db[_0xaa57('0x142')],{});db[_0xaa57('0x10a')][_0xaa57('0x12a')](db[_0xaa57('0x109')],{});db['WhatsappQueueReport'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{});db[_0xaa57('0x1f4')][_0xaa57('0x12a')](db[_0xaa57('0x109')],{});db[_0xaa57('0x1f4')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0xaa57('0x12a')](db['WhatsappAccount'],{'foreignKey':_0xaa57('0x1f5'),'as':_0xaa57('0x1dd')});db[_0xaa57('0x1f4')][_0xaa57('0x12a')](db['WhatsappAccount'],{'foreignKey':_0xaa57('0x1f6'),'as':_0xaa57('0x1e4')});db['WhatsappTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x142')],{'foreignKey':_0xaa57('0x1f7'),'as':_0xaa57('0x1e2')});db['WhatsappTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':'FromUserId','as':_0xaa57('0x1de')});db['WhatsappTransferReport'][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'foreignKey':_0xaa57('0x1df'),'as':_0xaa57('0x1e0')});db[_0xaa57('0x142')]['belongsToMany'](db['User'],{'as':_0xaa57('0x175'),'through':_0xaa57('0x38'),'foreignKey':_0xaa57('0x1f8')});db[_0xaa57('0x142')]['belongsToMany'](db[_0xaa57('0xe9')],{'through':_0xaa57('0x1d6'),'as':'Teams'});db[_0xaa57('0x115')][_0xaa57('0x12a')](db[_0xaa57('0x14')],{'as':_0xaa57('0x1f9'),'foreignKey':_0xaa57('0x11a'),'onDelete':_0xaa57('0x119'),'hooks':!![]});db[_0xaa57('0x10e')][_0xaa57('0x117')](db[_0xaa57('0x1cb')],{'as':_0xaa57('0x1cb'),'onDelete':_0xaa57('0x16c')});db[_0xaa57('0x10e')][_0xaa57('0x117')](db[_0xaa57('0x16a')],{'as':_0xaa57('0x1fa'),'onDelete':_0xaa57('0x16c')});db['CloudProvider'][_0xaa57('0x117')](db[_0xaa57('0x3b')],{'as':_0xaa57('0x16d'),'onDelete':'restrict'});module[_0xaa57('0x1fb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x27c9=['../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.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','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','VoiceContext','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','ContactId','MailAccountId','CloudProviderId','restrict','hasOne','Imap','Smtp','Dispositions','CannedAnswer','Answers','MailMessage','List','ListId','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','Items','FaxAccountId','Interactions','Applications','FaxInteractionId','fax_interaction_has_tags','Tags','ThroughTags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','Company','CompanyId','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerId','Fields','AnalyticDefaultReport','MetricId','Configurations','AccountId','SubjectId','FieldId','Subject','Description','DescriptionId','Field','VariableId','Subjects','Descriptions','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','JscriptyAnswerReport','team_has_mail_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','WhatsappAccount','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','../config/environment','sequelize','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','mysql','database','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field'];(function(_0x4a15ab,_0x8b5417){var _0x57c928=function(_0x5850c9){while(--_0x5850c9){_0x4a15ab['push'](_0x4a15ab['shift']());}};_0x57c928(++_0x8b5417);}(_0x27c9,0x12e));var _0x927c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x27c9[_0x138adb];return _0x1b27f2;};'use strict';var config=require(_0x927c('0x0'));var Sequelize=require(_0x927c('0x1'));var _=require('lodash');var jstz=require(_0x927c('0x2'));var timezone=jstz[_0x927c('0x3')]();config[_0x927c('0x1')]=_['defaultsDeep'](config[_0x927c('0x1')],{'database':_0x927c('0x4'),'username':_0x927c('0x5'),'password':_0x927c('0x6'),'options':{'host':_0x927c('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x927c('0x8')},'logging':![],'timezone':timezone[_0x927c('0x9')](),'define':{'charset':_0x927c('0xa'),'collate':_0x927c('0xb')}}});config[_0x927c('0xc')]=_[_0x927c('0xd')](config['sequelizeHistory'],{'database':_0x927c('0x4'),'username':_0x927c('0x5'),'password':_0x927c('0x6'),'options':{'host':_0x927c('0x7'),'port':0xcea,'dialect':_0x927c('0xe'),'dialectOptions':{'charset':_0x927c('0x8')},'logging':![],'timezone':timezone[_0x927c('0x9')](),'define':{'charset':'utf8','collate':_0x927c('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x927c('0x1')][_0x927c('0xf')],config[_0x927c('0x1')][_0x927c('0x10')],config[_0x927c('0x1')][_0x927c('0x11')],config[_0x927c('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x927c('0xf')],config['sequelizeHistory'][_0x927c('0x10')],config[_0x927c('0xc')][_0x927c('0x11')],config[_0x927c('0xc')]['options'])};db[_0x927c('0x12')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x14'));db[_0x927c('0x15')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x16'));db['VoiceContext']=db['sequelize'][_0x927c('0x13')]('../api/voiceContext/voiceContext.model');db[_0x927c('0x17')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x18'));db[_0x927c('0x19')]=db['sequelize'][_0x927c('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x1a'));db[_0x927c('0x1b')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x1c'));db[_0x927c('0x1d')]=db['sequelize'][_0x927c('0x13')]('../api/screenRecording/screenRecording.model');db[_0x927c('0x1e')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x1f'));db[_0x927c('0x20')]=db[_0x927c('0x1')]['import'](_0x927c('0x21'));db[_0x927c('0x22')]=db[_0x927c('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x927c('0x23')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x24'));db['VoiceQueueReport']=db[_0x927c('0x1')]['import'](_0x927c('0x25'));db[_0x927c('0x26')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x27'));db[_0x927c('0x28')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x29'));db[_0x927c('0x2a')]=db[_0x927c('0x1')]['import'](_0x927c('0x2b'));db[_0x927c('0x2c')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x2d'));db[_0x927c('0x2e')]=db[_0x927c('0x1')]['import'](_0x927c('0x2f'));db[_0x927c('0x30')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x31'));db['UserMailQueue']=db['sequelize'][_0x927c('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x927c('0x32')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x33'));db[_0x927c('0x34')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x927c('0x35')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x36'));db[_0x927c('0x37')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x38'));db[_0x927c('0x39')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x3a'));db[_0x927c('0x3b')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x3c'));db[_0x927c('0x3d')]=db[_0x927c('0x1')]['import']('../api/mailAccount/mailAccount.model');db[_0x927c('0x3e')]=db['sequelize']['import']('../api/mailQueue/mailQueue.model');db[_0x927c('0x3f')]=db[_0x927c('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x927c('0x40')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x41'));db['MailMessage']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x42'));db[_0x927c('0x43')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x44'));db[_0x927c('0x45')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x46'));db[_0x927c('0x47')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x48'));db[_0x927c('0x49')]=db['sequelize'][_0x927c('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x927c('0x4a')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x4b'));db[_0x927c('0x4c')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x4d'));db[_0x927c('0x4e')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x4f'));db[_0x927c('0x50')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x51'));db[_0x927c('0x52')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x53'));db['FaxQueueReport']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x54'));db[_0x927c('0x55')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x56'));db[_0x927c('0x57')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x58'));db['SmsInteraction']=db[_0x927c('0x1')]['import'](_0x927c('0x59'));db['SmsMessage']=db[_0x927c('0x1')]['import'](_0x927c('0x5a'));db[_0x927c('0x5b')]=db[_0x927c('0x1')]['import'](_0x927c('0x5c'));db[_0x927c('0x5d')]=db[_0x927c('0x1')]['import'](_0x927c('0x5e'));db['OpenchannelApplication']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x5f'));db[_0x927c('0x60')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x61'));db[_0x927c('0x62')]=db[_0x927c('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0x927c('0x63')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x64'));db[_0x927c('0x65')]=db[_0x927c('0x1')]['import']('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize'][_0x927c('0x13')](_0x927c('0x66'));db[_0x927c('0x67')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x68'));db[_0x927c('0x69')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x6a'));db[_0x927c('0x6b')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/chatMessage/chatMessage.model');db[_0x927c('0x6c')]=db['sequelize']['import'](_0x927c('0x6d'));db[_0x927c('0x6e')]=db['sequelize'][_0x927c('0x13')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db['sequelize'][_0x927c('0x13')]('../api/chatGroup/chatGroup.model');db[_0x927c('0x6f')]=db['sequelize'][_0x927c('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x927c('0x70')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x71'));db[_0x927c('0x72')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x73'));db[_0x927c('0x74')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x75'));db['CmHopperBlack']=db[_0x927c('0x1')][_0x927c('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x927c('0x76')]=db[_0x927c('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x927c('0x77')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x78'));db[_0x927c('0x79')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x7a'));db['CmCustomField']=db[_0x927c('0x1')]['import'](_0x927c('0x7b'));db['Action']=db[_0x927c('0x1')]['import']('../api/action/action.model');db[_0x927c('0x7c')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x7d'));db['CannedAnswer']=db[_0x927c('0x1')]['import'](_0x927c('0x7e'));db[_0x927c('0x7f')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x80'));db[_0x927c('0x81')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x82'));db[_0x927c('0x83')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x84'));db['Pause']=db[_0x927c('0x1')]['import'](_0x927c('0x85'));db['Cdr']=db['sequelize'][_0x927c('0x13')](_0x927c('0x86'));db[_0x927c('0x87')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x927c('0x88')]=db[_0x927c('0x1')]['import'](_0x927c('0x89'));db[_0x927c('0x8a')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x8b'));db[_0x927c('0x8c')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x8d'));db[_0x927c('0x8e')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x8f'));db[_0x927c('0x90')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/trigger/trigger.model');db[_0x927c('0x91')]=db[_0x927c('0x1')]['import'](_0x927c('0x92'));db[_0x927c('0x93')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x94'));db['IntegrationReport']=db['sequelize'][_0x927c('0x13')](_0x927c('0x95'));db[_0x927c('0x96')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x97'));db['AnalyticDefaultReport']=db['sequelize'][_0x927c('0x13')](_0x927c('0x98'));db['AnalyticExtractedReport']=db[_0x927c('0x1')]['import'](_0x927c('0x99'));db[_0x927c('0x9a')]=db[_0x927c('0x1')]['import'](_0x927c('0x9b'));db[_0x927c('0x9c')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x9d'));db['AnalyticTreeReport']=db[_0x927c('0x1')][_0x927c('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x927c('0x9e')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x9f'));db[_0x927c('0xa0')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xa1'));db[_0x927c('0xa2')]=db[_0x927c('0x1')]['import'](_0x927c('0xa3'));db[_0x927c('0xa4')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x927c('0xa5')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xa6'));db[_0x927c('0xa7')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xa8'));db[_0x927c('0xa9')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xaa'));db[_0x927c('0xab')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xac'));db[_0x927c('0xad')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/intDeskField/intDeskField.model');db[_0x927c('0xae')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xaf'));db[_0x927c('0xb0')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xb1'));db[_0x927c('0xb2')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xb3'));db['ZendeskAccount']=db['sequelize']['import'](_0x927c('0xb4'));db[_0x927c('0xb5')]=db[_0x927c('0x1')]['import'](_0x927c('0xb6'));db[_0x927c('0xb7')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xb8'));db[_0x927c('0xb9')]=db[_0x927c('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x927c('0x13')](_0x927c('0xba'));db['FreshdeskField']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xbb'));db[_0x927c('0xbc')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xbd'));db[_0x927c('0xbe')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xbf'));db[_0x927c('0xc0')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x927c('0xc1')]=db['sequelize'][_0x927c('0x13')](_0x927c('0xc2'));db[_0x927c('0xc3')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xc4'));db[_0x927c('0xc5')]=db['sequelize']['import'](_0x927c('0xc6'));db[_0x927c('0xc7')]=db[_0x927c('0x1')]['import'](_0x927c('0xc8'));db[_0x927c('0xc9')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xca'));db[_0x927c('0xcb')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xcc'));db[_0x927c('0xcd')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xce'));db[_0x927c('0x93')]=db[_0x927c('0x1')]['import'](_0x927c('0x94'));db[_0x927c('0xcf')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xd0'));db['ChatQueueReport']=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xd1'));db['JscriptyAnswerReport']=db[_0x927c('0x1')]['import'](_0x927c('0xd2'));db[_0x927c('0xd3')]=db['sequelize']['import'](_0x927c('0xd4'));db[_0x927c('0xd5')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xd6'));db[_0x927c('0xd7')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xd8'));db[_0x927c('0xd9')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/squareReport/squareReport.model');db[_0x927c('0xda')]=db['sequelize']['import'](_0x927c('0xdb'));db[_0x927c('0xdc')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xdd'));db[_0x927c('0xde')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x927c('0x1')]['import'](_0x927c('0xdf'));db[_0x927c('0xe0')]=db[_0x927c('0x1')]['import'](_0x927c('0xe1'));db[_0x927c('0xe2')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xe3'));db[_0x927c('0xe4')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xe5'));db[_0x927c('0xe6')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xe7'));db[_0x927c('0xe8')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xe9'));db[_0x927c('0xea')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xeb'));db[_0x927c('0xec')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xed'));db[_0x927c('0xee')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xef'));db[_0x927c('0xf0')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/plugin/plugin.model');db[_0x927c('0xf1')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xf2'));db[_0x927c('0xf3')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xf4'));db['FaxTransferReport']=db['sequelize'][_0x927c('0x13')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x927c('0x1')][_0x927c('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x927c('0xf5')]=db['sequelize'][_0x927c('0x13')](_0x927c('0xf6'));db[_0x927c('0xf7')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xf8'));db[_0x927c('0xf9')]=db[_0x927c('0x1')]['import'](_0x927c('0xfa'));db[_0x927c('0xfb')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/userProfile/userProfile.model');db[_0x927c('0xfc')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xfd'));db['UserProfileResource']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0xfe'));db[_0x927c('0xff')]=db[_0x927c('0x1')]['import']('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x100'));db[_0x927c('0x101')]=db['sequelize'][_0x927c('0x13')](_0x927c('0x102'));db[_0x927c('0x103')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x104'));db['WhatsappMessage']=db[_0x927c('0x1')][_0x927c('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x927c('0x105')]=db[_0x927c('0x1')]['import'](_0x927c('0x106'));db[_0x927c('0x107')]=db['sequelize'][_0x927c('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x927c('0x108')]=db[_0x927c('0x1')]['import'](_0x927c('0x109'));db[_0x927c('0x10a')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x10b'));db[_0x927c('0x10c')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x10d'));db[_0x927c('0x10e')]=db[_0x927c('0x1')]['import'](_0x927c('0x10f'));db[_0x927c('0x110')]=db[_0x927c('0x1')][_0x927c('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x927c('0x111')]=db[_0x927c('0x1')][_0x927c('0x13')](_0x927c('0x112'));db['User']['hasOne'](db[_0x927c('0x1e')],{'as':_0x927c('0x1e'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')]['hasOne'](db[_0x927c('0x111')],{'as':'userSetting','onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')][_0x927c('0x115')](db['VoiceRecording'],{'as':_0x927c('0x116'),'foreignKey':_0x927c('0x114')});db['User']['hasMany'](db['UserVoiceQueueRt'],{'as':_0x927c('0x117'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')][_0x927c('0x115')](db[_0x927c('0x17')],{'as':_0x927c('0x118'),'onDelete':'cascade','hooks':!![]});db[_0x927c('0x12')]['hasMany'](db[_0x927c('0x76')],{'as':_0x927c('0x119'),'foreignKey':_0x927c('0x114')});db['User'][_0x927c('0x115')](db[_0x927c('0x77')],{'as':'HopperHistory','foreignKey':_0x927c('0x114')});db['User'][_0x927c('0x115')](db[_0x927c('0x79')],{'as':_0x927c('0x79'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')][_0x927c('0x115')](db[_0x927c('0x60')],{'as':_0x927c('0x11a'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')]['hasMany'](db[_0x927c('0x69')],{'as':_0x927c('0x11b'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')][_0x927c('0x115')](db[_0x927c('0x11c')],{'as':_0x927c('0x11d'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')][_0x927c('0x115')](db['FaxInteraction'],{'as':_0x927c('0x11e'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')][_0x927c('0x115')](db[_0x927c('0x40')],{'as':_0x927c('0x11f'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')]['hasMany'](db['WhatsappInteraction'],{'as':_0x927c('0x120'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x12')][_0x927c('0x115')](db[_0x927c('0xff')],{'as':_0x927c('0x121'),'foreignKey':_0x927c('0x122')});db[_0x927c('0x12')][_0x927c('0x123')](db[_0x927c('0xfb')],{'as':_0x927c('0xfb'),'foreignKey':'userProfileId'});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x125')],{'as':_0x927c('0x126'),'through':_0x927c('0x127')});db['User']['belongsToMany'](db[_0x927c('0x72')],{'as':_0x927c('0x128'),'through':_0x927c('0x129')});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0xf7')],{'as':_0x927c('0x12a'),'through':_0x927c('0x12b')});db[_0x927c('0x12')]['belongsToMany'](db[_0x927c('0xe6')],{'through':_0x927c('0x12c')});db['User'][_0x927c('0x124')](db[_0x927c('0x40')],{'as':_0x927c('0x11f'),'through':_0x927c('0x12d')});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x69')],{'as':'ChatInteractions','through':_0x927c('0x12e')});db[_0x927c('0x12')]['belongsToMany'](db[_0x927c('0x4e')],{'as':_0x927c('0x11e'),'through':_0x927c('0x12f')});db['User'][_0x927c('0x124')](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x60')],{'as':_0x927c('0x11a'),'through':'user_has_openchannel_interactions'});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x103')],{'as':_0x927c('0x120'),'through':'user_has_whatsapp_interactions'});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x130')],{'as':_0x927c('0x131'),'through':'UserVoiceQueue','required':![]});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0xf9')],{'as':_0x927c('0x132'),'through':_0x927c('0x110'),'required':![]});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x3e')],{'as':_0x927c('0x133'),'through':_0x927c('0x134'),'required':![]});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x6e')],{'as':_0x927c('0x135'),'through':_0x927c('0x30'),'required':![],'hooks':!![]});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x52')],{'as':_0x927c('0x136'),'through':_0x927c('0x32'),'required':![]});db['User'][_0x927c('0x124')](db[_0x927c('0x5b')],{'as':_0x927c('0x137'),'through':_0x927c('0x34'),'required':![]});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0x63')],{'as':'OpenchannelQueues','through':_0x927c('0x35'),'required':![]});db['User']['belongsToMany'](db[_0x927c('0x108')],{'as':_0x927c('0x138'),'through':_0x927c('0x37'),'required':![]});db['User']['belongsToMany'](db[_0x927c('0xf7')],{'through':_0x927c('0x12b')});db[_0x927c('0x12')]['belongsToMany'](db[_0x927c('0x65')],{'as':_0x927c('0x139'),'through':'user_has_chat_websites'});db['User'][_0x927c('0x124')](db['FaxAccount'],{'as':_0x927c('0x13a'),'through':_0x927c('0x13b')});db['User'][_0x927c('0x124')](db[_0x927c('0x3d')],{'as':_0x927c('0x13c'),'through':_0x927c('0x13d')});db[_0x927c('0x12')][_0x927c('0x124')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x927c('0x13e')});db[_0x927c('0x12')][_0x927c('0x124')](db['SmsAccount'],{'as':_0x927c('0x13f'),'through':'user_has_sms_accounts'});db['User'][_0x927c('0x124')](db['WhatsappAccount'],{'as':_0x927c('0x140'),'through':'user_has_whatsapp_accounts'});db[_0x927c('0x12')][_0x927c('0x124')](db[_0x927c('0xe0')],{'as':_0x927c('0x141'),'through':_0x927c('0x142')});db[_0x927c('0x15')]['hasMany'](db[_0x927c('0x17')],{'as':_0x927c('0x143'),'onDelete':_0x927c('0x113'),'foreignKey':'ChanSpyId'});db[_0x927c('0x144')][_0x927c('0x115')](db[_0x927c('0x17')],{'onDelete':'cascade'});db[_0x927c('0x17')][_0x927c('0x115')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x927c('0x113')});db[_0x927c('0x19')]['belongsToMany'](db[_0x927c('0x8a')],{'as':_0x927c('0x145'),'through':_0x927c('0x146')});db[_0x927c('0x130')][_0x927c('0x115')](db[_0x927c('0x2c')],{'as':_0x927c('0x147'),'foreignKey':'VoiceQueueId'});db[_0x927c('0x130')][_0x927c('0x115')](db[_0x927c('0x74')],{'as':_0x927c('0x148'),'foreignKey':'VoiceQueueId'});db[_0x927c('0x130')][_0x927c('0x115')](db[_0x927c('0x76')],{'as':_0x927c('0x119'),'foreignKey':_0x927c('0x149')});db[_0x927c('0x130')][_0x927c('0x115')](db[_0x927c('0x77')],{'as':_0x927c('0x14a'),'foreignKey':_0x927c('0x149')});db[_0x927c('0x130')][_0x927c('0x115')](db[_0x927c('0x79')],{'as':_0x927c('0x79'),'foreignKey':_0x927c('0x149')});db[_0x927c('0x130')]['hasMany'](db[_0x927c('0x14b')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x927c('0x130')][_0x927c('0x115')](db['JscriptySessionReport'],{'as':_0x927c('0x14c'),'foreignKey':_0x927c('0x149')});db[_0x927c('0x130')][_0x927c('0x123')](db[_0x927c('0x28')],{'as':'Trunk','foreignKey':_0x927c('0x14d')});db['VoiceQueue'][_0x927c('0x123')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x927c('0x14e')});db['VoiceQueue'][_0x927c('0x123')](db[_0x927c('0x83')],{'as':_0x927c('0x83'),'foreignKey':_0x927c('0x14f')});db[_0x927c('0x130')][_0x927c('0x123')](db[_0x927c('0x150')],{'as':_0x927c('0x151'),'foreignKey':_0x927c('0x152')});db[_0x927c('0x130')][_0x927c('0x124')](db[_0x927c('0xf7')],{'as':_0x927c('0x12a'),'through':_0x927c('0x153')});db['VoiceQueue'][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':_0x927c('0x2e')});db[_0x927c('0x130')]['belongsToMany'](db[_0x927c('0xe6')],{'as':_0x927c('0x155'),'through':_0x927c('0x10c')});db[_0x927c('0x130')][_0x927c('0x124')](db['CmList'],{'as':_0x927c('0x156'),'through':'voice_queues_has_cm_blacklists'});db[_0x927c('0x1b')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x927c('0x114')});db[_0x927c('0x1d')][_0x927c('0x123')](db['User'],{'as':_0x927c('0x12'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x1e')]['hasMany'](db[_0x927c('0x157')],{'as':_0x927c('0x158'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x159'),'sourceKey':_0x927c('0x15a')});db[_0x927c('0x157')]['belongsTo'](db[_0x927c('0x1e')],{'foreignKey':_0x927c('0x159'),'targetKey':_0x927c('0x15a')});db[_0x927c('0x20')]['hasMany'](db['VoiceQueueReport'],{'as':_0x927c('0x15b'),'foreignKey':'uniqueid','constraints':![]});db[_0x927c('0x20')][_0x927c('0x115')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x927c('0x15c'),'constraints':![]});db[_0x927c('0x20')][_0x927c('0x123')](db['User'],{'as':_0x927c('0x12'),'foreignKey':'UserId'});db[_0x927c('0x20')]['belongsTo'](db[_0x927c('0x72')],{'as':'Contact','foreignKey':_0x927c('0x15d')});db[_0x927c('0x39')][_0x927c('0x123')](db[_0x927c('0x3d')],{'as':'MailAccount','foreignKey':_0x927c('0x15e')});db[_0x927c('0x39')][_0x927c('0x123')](db[_0x927c('0x10a')],{'as':'CloudProvider','foreignKey':_0x927c('0x15f'),'onDelete':'restrict'});db['MailServerOut'][_0x927c('0x123')](db[_0x927c('0x3d')],{'as':_0x927c('0x3d'),'foreignKey':'MailAccountId'});db[_0x927c('0x3b')][_0x927c('0x123')](db[_0x927c('0x10a')],{'as':_0x927c('0x10a'),'foreignKey':'CloudProviderId','onDelete':_0x927c('0x160')});db['MailAccount'][_0x927c('0x161')](db[_0x927c('0x39')],{'as':_0x927c('0x162'),'onDelete':_0x927c('0x113')});db[_0x927c('0x3d')][_0x927c('0x161')](db[_0x927c('0x3b')],{'as':_0x927c('0x163'),'onDelete':_0x927c('0x113')});db[_0x927c('0x3d')][_0x927c('0x115')](db[_0x927c('0x7f')],{'as':_0x927c('0x164'),'foreignKey':_0x927c('0x15e'),'onDelete':_0x927c('0x113')});db[_0x927c('0x3d')][_0x927c('0x115')](db[_0x927c('0x165')],{'as':_0x927c('0x166'),'foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x927c('0x167')],{'as':'Messages','foreignKey':_0x927c('0x15e')});db[_0x927c('0x3d')][_0x927c('0x115')](db[_0x927c('0x40')],{'as':'Interactions'});db['MailAccount']['hasMany'](db[_0x927c('0x43')],{'as':'Applications'});db[_0x927c('0x3d')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':_0x927c('0x169')});db[_0x927c('0x3d')][_0x927c('0x123')](db[_0x927c('0x8e')],{'as':_0x927c('0x8e'),'foreignKey':'TemplateId'});db['MailAccount'][_0x927c('0x123')](db['Pause'],{'as':_0x927c('0x151'),'foreignKey':_0x927c('0x152')});db[_0x927c('0x3d')][_0x927c('0x124')](db['User'],{'as':_0x927c('0x154'),'through':'user_has_mail_accounts'});db[_0x927c('0x3e')]['belongsToMany'](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':_0x927c('0x134')});db['MailQueue'][_0x927c('0x124')](db[_0x927c('0xe6')],{'through':'team_has_mail_queues','as':_0x927c('0x155')});db['MailInteraction'][_0x927c('0x115')](db[_0x927c('0x167')],{'as':'Messages','onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x16a')});db['MailInteraction'][_0x927c('0x123')](db['MailAccount'],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x15e')});db[_0x927c('0x40')]['belongsTo'](db[_0x927c('0x72')],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db['MailInteraction'][_0x927c('0x123')](db[_0x927c('0x12')],{'as':_0x927c('0x16d'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x40')][_0x927c('0x124')](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x927c('0x40')][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':_0x927c('0x16e'),'as':'ThroughTags'});db[_0x927c('0x40')][_0x927c('0x124')](db['User'],{'as':_0x927c('0x16f'),'through':'user_has_mail_interactions','foreignKey':_0x927c('0x16a')});db[_0x927c('0x167')][_0x927c('0x115')](db[_0x927c('0xee')],{'as':_0x927c('0x170'),'onDelete':'cascade'});db[_0x927c('0x167')][_0x927c('0x123')](db[_0x927c('0x12')],{'as':'User'});db['MailMessage'][_0x927c('0x123')](db[_0x927c('0x72')],{'onDelete':'cascade','as':'Contact'});db['MailMessage'][_0x927c('0x123')](db[_0x927c('0x40')],{'as':_0x927c('0x171'),'foreignKey':_0x927c('0x16a')});db['MailMessage'][_0x927c('0x123')](db[_0x927c('0x3d')],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x15e')});db[_0x927c('0x167')][_0x927c('0x123')](db['ChatWebsite'],{'as':_0x927c('0x65'),'foreignKey':_0x927c('0x172')});db['MailMessage'][_0x927c('0x123')](db[_0x927c('0x6c')],{'as':'ChatOfflineMessage','foreignKey':_0x927c('0x173')});db['MailApplication'][_0x927c('0x123')](db[_0x927c('0x12')],{'onDelete':_0x927c('0x160')});db[_0x927c('0x43')][_0x927c('0x123')](db[_0x927c('0x3e')],{'onDelete':_0x927c('0x160')});db['MailApplication'][_0x927c('0x123')](db[_0x927c('0x3d')],{'onDelete':_0x927c('0x160')});db[_0x927c('0x43')]['belongsTo'](db['Interval'],{'onDelete':_0x927c('0x160'),'foreignKey':_0x927c('0x14f')});db[_0x927c('0x43')]['belongsTo'](db[_0x927c('0x8c')],{'onDelete':_0x927c('0x160'),'foreignKey':_0x927c('0x174')});db[_0x927c('0x45')][_0x927c('0x123')](db[_0x927c('0x3d')],{});db[_0x927c('0x45')][_0x927c('0x123')](db['CmList'],{'as':_0x927c('0x168'),'foreignKey':_0x927c('0x169')});db[_0x927c('0x45')][_0x927c('0x123')](db[_0x927c('0x72')],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db[_0x927c('0x45')][_0x927c('0x123')](db[_0x927c('0x40')],{});db[_0x927c('0x45')][_0x927c('0x123')](db['MailMessage'],{});db[_0x927c('0x45')][_0x927c('0x123')](db[_0x927c('0x12')],{});db['MailQueueReport'][_0x927c('0x123')](db[_0x927c('0x3e')],{});db['Dashboard']['hasMany'](db[_0x927c('0x49')],{'as':_0x927c('0x175'),'onDelete':_0x927c('0x113')});db[_0x927c('0x4a')]['hasMany'](db['Disposition'],{'as':_0x927c('0x164'),'foreignKey':_0x927c('0x176'),'onDelete':_0x927c('0x113')});db['FaxAccount'][_0x927c('0x115')](db[_0x927c('0x165')],{'as':'Answers','foreignKey':_0x927c('0x176')});db[_0x927c('0x4a')]['hasMany'](db[_0x927c('0x4e')],{'as':_0x927c('0x177')});db[_0x927c('0x4a')][_0x927c('0x115')](db['FaxApplication'],{'as':_0x927c('0x178')});db['FaxAccount'][_0x927c('0x115')](db[_0x927c('0x17')],{'as':'Exntensions','onDelete':_0x927c('0x113')});db[_0x927c('0x4a')][_0x927c('0x115')](db[_0x927c('0x50')],{'as':_0x927c('0x158')});db[_0x927c('0x4a')][_0x927c('0x123')](db[_0x927c('0x28')],{'as':_0x927c('0x28')});db['FaxAccount'][_0x927c('0x123')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x927c('0x4a')][_0x927c('0x123')](db[_0x927c('0x150')],{'as':_0x927c('0x151'),'foreignKey':_0x927c('0x152')});db['FaxAccount'][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':_0x927c('0x13b')});db[_0x927c('0x4c')][_0x927c('0x123')](db[_0x927c('0x12')],{'onDelete':'restrict'});db[_0x927c('0x4c')][_0x927c('0x123')](db[_0x927c('0x52')],{'onDelete':_0x927c('0x160')});db[_0x927c('0x4c')][_0x927c('0x123')](db[_0x927c('0x4a')],{'onDelete':_0x927c('0x160')});db[_0x927c('0x4c')]['belongsTo'](db[_0x927c('0x8c')],{'onDelete':'restrict','foreignKey':_0x927c('0x174')});db[_0x927c('0x4e')]['hasMany'](db['FaxMessage'],{'as':_0x927c('0x158'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x179')});db[_0x927c('0x4e')][_0x927c('0x123')](db['FaxAccount'],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x176')});db[_0x927c('0x4e')][_0x927c('0x123')](db['CmContact'],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db['FaxInteraction'][_0x927c('0x123')](db[_0x927c('0x12')],{'as':_0x927c('0x16d'),'foreignKey':'UserId'});db[_0x927c('0x4e')][_0x927c('0x124')](db['Tag'],{'through':_0x927c('0x17a'),'as':_0x927c('0x17b')});db[_0x927c('0x4e')]['belongsToMany'](db[_0x927c('0x8c')],{'through':_0x927c('0x17a'),'as':_0x927c('0x17c')});db[_0x927c('0x4e')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x16f'),'through':_0x927c('0x12f'),'foreignKey':_0x927c('0x179')});db[_0x927c('0x50')][_0x927c('0x123')](db[_0x927c('0x12')],{'onDelete':_0x927c('0x113'),'as':_0x927c('0x12')});db[_0x927c('0x50')][_0x927c('0x123')](db[_0x927c('0x4e')],{'as':'Interaction','foreignKey':_0x927c('0x179')});db[_0x927c('0x50')][_0x927c('0x123')](db[_0x927c('0x72')],{'onDelete':'cascade','as':_0x927c('0x16c')});db['FaxMessage'][_0x927c('0x123')](db['Attachment'],{'as':_0x927c('0xee'),'foreignKey':_0x927c('0x17d')});db[_0x927c('0x50')]['belongsTo'](db['FaxAccount'],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x176')});db[_0x927c('0x52')]['belongsToMany'](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':_0x927c('0x32')});db[_0x927c('0x52')][_0x927c('0x124')](db[_0x927c('0xe6')],{'through':_0x927c('0x17e'),'as':_0x927c('0x155')});db[_0x927c('0x17f')]['belongsTo'](db['FaxAccount'],{});db[_0x927c('0x17f')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':_0x927c('0x169')});db[_0x927c('0x17f')][_0x927c('0x123')](db['CmContact'],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db[_0x927c('0x17f')]['belongsTo'](db[_0x927c('0x4e')],{});db[_0x927c('0x17f')]['belongsTo'](db[_0x927c('0x50')],{});db['FaxQueueReport'][_0x927c('0x123')](db[_0x927c('0x12')],{});db[_0x927c('0x17f')][_0x927c('0x123')](db[_0x927c('0x52')],{});db[_0x927c('0x55')][_0x927c('0x115')](db[_0x927c('0x7f')],{'as':'Dispositions','foreignKey':_0x927c('0x180'),'onDelete':_0x927c('0x113')});db['SmsAccount']['hasMany'](db[_0x927c('0x165')],{'as':_0x927c('0x166'),'foreignKey':_0x927c('0x180')});db[_0x927c('0x55')]['hasMany'](db[_0x927c('0x181')],{'as':_0x927c('0x158'),'foreignKey':_0x927c('0x180')});db[_0x927c('0x55')][_0x927c('0x115')](db[_0x927c('0x11c')],{'as':'Interactions'});db[_0x927c('0x55')][_0x927c('0x115')](db[_0x927c('0x57')],{'as':_0x927c('0x178')});db[_0x927c('0x55')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':'List','foreignKey':_0x927c('0x169')});db[_0x927c('0x55')][_0x927c('0x123')](db[_0x927c('0x150')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x927c('0x55')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':'Agents','through':_0x927c('0x182')});db['SmsApplication'][_0x927c('0x123')](db['User'],{'onDelete':'restrict'});db[_0x927c('0x57')][_0x927c('0x123')](db[_0x927c('0x5b')],{'onDelete':_0x927c('0x160')});db['SmsApplication'][_0x927c('0x123')](db[_0x927c('0x55')],{'onDelete':_0x927c('0x160')});db[_0x927c('0x57')][_0x927c('0x123')](db[_0x927c('0x83')],{'onDelete':_0x927c('0x160'),'foreignKey':_0x927c('0x14f')});db[_0x927c('0x57')]['belongsTo'](db[_0x927c('0x8c')],{'onDelete':_0x927c('0x160'),'foreignKey':'TagId'});db[_0x927c('0x11c')][_0x927c('0x115')](db[_0x927c('0x181')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x927c('0x183')});db[_0x927c('0x11c')][_0x927c('0x123')](db[_0x927c('0x55')],{'as':_0x927c('0x16b'),'foreignKey':'SmsAccountId'});db[_0x927c('0x11c')][_0x927c('0x123')](db[_0x927c('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x927c('0x11c')]['belongsTo'](db['User'],{'as':_0x927c('0x16d'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x11c')][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':_0x927c('0x184'),'as':_0x927c('0x17b')});db[_0x927c('0x11c')][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':_0x927c('0x184'),'as':'ThroughTags'});db[_0x927c('0x11c')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0x927c('0x183')});db[_0x927c('0x181')]['belongsTo'](db[_0x927c('0x12')],{'as':_0x927c('0x12')});db[_0x927c('0x181')][_0x927c('0x123')](db[_0x927c('0x72')],{'onDelete':_0x927c('0x113'),'as':'Contact'});db[_0x927c('0x181')][_0x927c('0x123')](db[_0x927c('0x11c')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x927c('0x183')});db[_0x927c('0x181')]['belongsTo'](db[_0x927c('0x55')],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x180')});db['SmsQueue'][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':_0x927c('0x34'),'foreignKey':_0x927c('0x185')});db[_0x927c('0x5b')]['belongsToMany'](db[_0x927c('0xe6')],{'through':_0x927c('0x186'),'as':'Teams'});db['OpenchannelAccount'][_0x927c('0x115')](db[_0x927c('0x7f')],{'as':_0x927c('0x164'),'foreignKey':_0x927c('0x187'),'onDelete':_0x927c('0x113')});db[_0x927c('0x5d')]['hasMany'](db[_0x927c('0x165')],{'as':_0x927c('0x166'),'foreignKey':_0x927c('0x187')});db[_0x927c('0x5d')][_0x927c('0x115')](db[_0x927c('0x60')],{'as':_0x927c('0x177'),'foreignKey':'OpenchannelAccountId'});db[_0x927c('0x5d')]['hasMany'](db[_0x927c('0x62')],{'as':'Messages','foreignKey':_0x927c('0x187')});db[_0x927c('0x5d')][_0x927c('0x115')](db['OpenchannelApplication'],{'as':_0x927c('0x178'),'foreignKey':_0x927c('0x187')});db[_0x927c('0x5d')]['belongsTo'](db[_0x927c('0xf7')],{'as':'List','foreignKey':_0x927c('0x169')});db[_0x927c('0x5d')][_0x927c('0x123')](db[_0x927c('0x150')],{'as':_0x927c('0x151'),'foreignKey':_0x927c('0x152')});db[_0x927c('0x5d')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x927c('0x188')][_0x927c('0x123')](db['User'],{'onDelete':'restrict'});db['OpenchannelApplication'][_0x927c('0x123')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x927c('0x189')});db[_0x927c('0x188')][_0x927c('0x123')](db[_0x927c('0x5d')],{'onDelete':_0x927c('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0x927c('0x188')][_0x927c('0x123')](db[_0x927c('0x83')],{'onDelete':_0x927c('0x160'),'foreignKey':_0x927c('0x14f')});db[_0x927c('0x188')]['belongsTo'](db[_0x927c('0x8c')],{'onDelete':_0x927c('0x160'),'foreignKey':'TagId'});db[_0x927c('0x60')][_0x927c('0x115')](db[_0x927c('0x62')],{'as':_0x927c('0x158'),'onDelete':_0x927c('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0x927c('0x60')][_0x927c('0x123')](db[_0x927c('0x5d')],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x187')});db[_0x927c('0x60')][_0x927c('0x123')](db['CmContact'],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db[_0x927c('0x60')][_0x927c('0x123')](db[_0x927c('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x927c('0x60')][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':_0x927c('0x18a'),'as':_0x927c('0x17b')});db['OpenchannelInteraction'][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0x927c('0x17c')});db[_0x927c('0x60')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x16f'),'through':'user_has_openchannel_interactions','foreignKey':_0x927c('0x18b')});db[_0x927c('0x62')][_0x927c('0x123')](db[_0x927c('0x12')],{'onDelete':_0x927c('0x113'),'as':_0x927c('0x12')});db[_0x927c('0x62')][_0x927c('0x123')](db['CmContact'],{'onDelete':_0x927c('0x113'),'as':_0x927c('0x16c')});db[_0x927c('0x62')]['belongsTo'](db[_0x927c('0x60')],{'onDelete':_0x927c('0x113'),'as':_0x927c('0x171'),'foreignKey':'OpenchannelInteractionId'});db[_0x927c('0x62')]['belongsTo'](db[_0x927c('0xee')],{'as':'Attachment','foreignKey':_0x927c('0x17d')});db[_0x927c('0x62')][_0x927c('0x123')](db['OpenchannelAccount'],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x187')});db[_0x927c('0x63')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':_0x927c('0x35'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db[_0x927c('0xe6')],{'through':_0x927c('0x18c'),'as':_0x927c('0x155')});db[_0x927c('0x65')][_0x927c('0x115')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x927c('0x172'),'onDelete':_0x927c('0x113')});db['ChatWebsite'][_0x927c('0x115')](db[_0x927c('0x165')],{'as':_0x927c('0x166'),'foreignKey':_0x927c('0x172')});db[_0x927c('0x65')][_0x927c('0x115')](db['ChatProactiveAction'],{'as':_0x927c('0x18d')});db[_0x927c('0x65')][_0x927c('0x115')](db[_0x927c('0x69')],{'as':_0x927c('0x177')});db[_0x927c('0x65')][_0x927c('0x115')](db[_0x927c('0x67')],{'as':_0x927c('0x178')});db['ChatWebsite']['hasMany'](db[_0x927c('0x6b')],{'as':_0x927c('0x158')});db[_0x927c('0x65')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':_0x927c('0x169')});db['ChatWebsite']['belongsTo'](db[_0x927c('0x83')],{'as':'Interval','foreignKey':_0x927c('0x14f')});db['ChatWebsite']['belongsTo'](db[_0x927c('0x3d')],{'as':_0x927c('0x3d'),'foreignKey':_0x927c('0x15e')});db[_0x927c('0x65')]['belongsTo'](db['Pause'],{'as':_0x927c('0x151'),'foreignKey':_0x927c('0x152')});db[_0x927c('0x65')][_0x927c('0x124')](db['User'],{'as':_0x927c('0x154'),'through':_0x927c('0x18e')});db[_0x927c('0x18f')][_0x927c('0x123')](db[_0x927c('0x5d')],{});db['OpenchannelQueueReport'][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':_0x927c('0x169')});db[_0x927c('0x18f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x927c('0x15d')});db[_0x927c('0x18f')][_0x927c('0x123')](db[_0x927c('0x60')],{});db[_0x927c('0x18f')]['belongsTo'](db[_0x927c('0x62')],{});db[_0x927c('0x18f')][_0x927c('0x123')](db[_0x927c('0x12')],{});db[_0x927c('0x18f')][_0x927c('0x123')](db[_0x927c('0x63')],{});db[_0x927c('0x67')][_0x927c('0x123')](db[_0x927c('0x12')],{'as':_0x927c('0x190'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x927c('0x67')][_0x927c('0x123')](db[_0x927c('0x6e')],{'as':_0x927c('0x191'),'foreignKey':_0x927c('0x192'),'onDelete':_0x927c('0x160')});db[_0x927c('0x67')][_0x927c('0x123')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x927c('0x172'),'onDelete':_0x927c('0x160')});db[_0x927c('0x67')][_0x927c('0x123')](db[_0x927c('0x8c')],{'onDelete':'restrict','foreignKey':'TagId'});db['ChatInteraction'][_0x927c('0x115')](db[_0x927c('0x6b')],{'as':'Messages','onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x193')});db[_0x927c('0x69')][_0x927c('0x123')](db[_0x927c('0x65')],{'as':'Account','foreignKey':_0x927c('0x172')});db[_0x927c('0x69')][_0x927c('0x123')](db[_0x927c('0x72')],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db['ChatInteraction'][_0x927c('0x123')](db[_0x927c('0x12')],{'as':_0x927c('0x16d'),'foreignKey':_0x927c('0x114')});db[_0x927c('0x69')][_0x927c('0x124')](db['Tag'],{'through':_0x927c('0x194'),'as':_0x927c('0x17b')});db[_0x927c('0x69')][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':'chat_interaction_has_tags','as':_0x927c('0x17c')});db[_0x927c('0x69')][_0x927c('0x124')](db['User'],{'as':_0x927c('0x16f'),'through':'user_has_chat_interactions','foreignKey':_0x927c('0x193')});db[_0x927c('0x6b')][_0x927c('0x123')](db[_0x927c('0x12')],{'onDelete':'cascade','as':'User'});db[_0x927c('0x6b')][_0x927c('0x123')](db[_0x927c('0x72')],{'onDelete':'cascade','as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db[_0x927c('0x6b')][_0x927c('0x123')](db[_0x927c('0x69')],{'onDelete':_0x927c('0x113'),'as':'Interaction','foreignKey':_0x927c('0x193')});db[_0x927c('0x6b')][_0x927c('0x123')](db[_0x927c('0xee')],{'as':_0x927c('0xee'),'foreignKey':_0x927c('0x17d')});db[_0x927c('0x6b')]['belongsTo'](db['ChatWebsite'],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x172')});db[_0x927c('0x6c')][_0x927c('0x115')](db[_0x927c('0xee')],{'as':'Attachments','foreignKey':_0x927c('0x173'),'onDelete':_0x927c('0x113'),'hooks':!![]});db[_0x927c('0x6c')][_0x927c('0x123')](db[_0x927c('0x72')],{'onDelete':_0x927c('0x113'),'as':'Contact','foreignKey':_0x927c('0x15d')});db[_0x927c('0x6c')][_0x927c('0x123')](db[_0x927c('0x65')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db[_0x927c('0x12')],{'as':'Agents','through':_0x927c('0x30'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0x927c('0x195'),'as':_0x927c('0x155')});db[_0x927c('0x125')][_0x927c('0x115')](db[_0x927c('0x196')],{'as':_0x927c('0x158'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x927c('0x125')]['belongsToMany'](db['User'],{'as':_0x927c('0x147'),'through':_0x927c('0x127')});db['ChatProactiveAction'][_0x927c('0x123')](db[_0x927c('0x65')],{'as':'Website','foreignKey':_0x927c('0x172')});db[_0x927c('0x70')][_0x927c('0x115')](db[_0x927c('0x72')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x927c('0x72')][_0x927c('0x115')](db[_0x927c('0x74')],{'as':'Hoppers','foreignKey':_0x927c('0x15d')});db[_0x927c('0x72')][_0x927c('0x115')](db[_0x927c('0x76')],{'as':_0x927c('0x119'),'foreignKey':_0x927c('0x15d')});db[_0x927c('0x72')]['hasMany'](db[_0x927c('0x77')],{'as':_0x927c('0x14a'),'foreignKey':_0x927c('0x15d')});db['CmContact'][_0x927c('0x115')](db['ReportAgentPreview'],{'as':_0x927c('0x79'),'foreignKey':'ContactId'});db[_0x927c('0x72')][_0x927c('0x115')](db[_0x927c('0xd5')],{'as':_0x927c('0x14c'),'foreignKey':_0x927c('0x15d')});db[_0x927c('0x72')][_0x927c('0x115')](db[_0x927c('0x60')],{'as':_0x927c('0x11a'),'foreignKey':_0x927c('0x15d'),'onDelete':_0x927c('0x160')});db[_0x927c('0x72')][_0x927c('0x115')](db[_0x927c('0x69')],{'as':'ChatInteractions','foreignKey':_0x927c('0x15d'),'onDelete':_0x927c('0x160')});db['CmContact'][_0x927c('0x115')](db[_0x927c('0x11c')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x927c('0x72')][_0x927c('0x115')](db['FaxInteraction'],{'as':_0x927c('0x11e'),'foreignKey':'ContactId','onDelete':_0x927c('0x160')});db[_0x927c('0x72')][_0x927c('0x115')](db['MailInteraction'],{'as':_0x927c('0x11f'),'foreignKey':'ContactId','onDelete':_0x927c('0x160')});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0x927c('0x197'),'foreignKey':_0x927c('0x198')});db[_0x927c('0x72')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':'List','foreignKey':_0x927c('0x169'),'onDelete':_0x927c('0x113')});db[_0x927c('0x72')][_0x927c('0x124')](db['User'],{'as':_0x927c('0x16f'),'through':_0x927c('0x129')});db[_0x927c('0x72')][_0x927c('0x124')](db[_0x927c('0x8c')],{'as':'Tags','through':_0x927c('0x199')});db['CmContact'][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':_0x927c('0x199'),'as':_0x927c('0x17c')});db[_0x927c('0x74')]['belongsTo'](db['CmContact'],{'as':_0x927c('0x16c'),'foreignKey':'ContactId','onDelete':_0x927c('0x113')});db[_0x927c('0x74')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':'ListId','onDelete':_0x927c('0x113')});db[_0x927c('0x74')][_0x927c('0x123')](db[_0x927c('0x12')],{'as':_0x927c('0x190'),'foreignKey':_0x927c('0x114')});db['CmHopper'][_0x927c('0x123')](db['VoiceQueue'],{'as':_0x927c('0x191'),'foreignKey':_0x927c('0x149'),'onDelete':'cascade'});db[_0x927c('0x74')]['belongsTo'](db['Campaign'],{'as':_0x927c('0xea'),'foreignKey':'CampaignId','onDelete':'cascade'});db['CmHopper'][_0x927c('0x123')](db[_0x927c('0x12')],{'as':_0x927c('0x16d'),'foreignKey':_0x927c('0x19a')});db[_0x927c('0x14b')][_0x927c('0x123')](db['CmContact'],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d'),'onDelete':_0x927c('0x113')});db[_0x927c('0x14b')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':'ListId','onDelete':_0x927c('0x113')});db[_0x927c('0x14b')][_0x927c('0x123')](db[_0x927c('0x130')],{'as':_0x927c('0x191'),'foreignKey':_0x927c('0x149'),'onDelete':_0x927c('0x113')});db[_0x927c('0x14b')][_0x927c('0x123')](db[_0x927c('0xea')],{'as':_0x927c('0xea'),'foreignKey':_0x927c('0x19b'),'onDelete':_0x927c('0x113')});db[_0x927c('0x7c')][_0x927c('0x115')](db[_0x927c('0x81')],{'as':{'plural':_0x927c('0x19c'),'singular':_0x927c('0x19d')},'foreignKey':_0x927c('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x927c('0x7c')][_0x927c('0x115')](db[_0x927c('0x81')],{'as':{'plural':_0x927c('0x19f'),'singular':'OneAny'},'foreignKey':_0x927c('0x1a0'),'onDelete':'cascade','hooks':!![]});db[_0x927c('0x7c')][_0x927c('0x115')](db[_0x927c('0x1a1')],{'as':_0x927c('0x1a2'),'foreignKey':_0x927c('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0x927c('0x7f')]['hasMany'](db[_0x927c('0x7f')],{'as':_0x927c('0x164'),'foreignKey':_0x927c('0x1a4'),'onDelete':_0x927c('0x113')});db[_0x927c('0x83')]['hasMany'](db['Interval'],{'as':_0x927c('0x1a5'),'foreignKey':_0x927c('0x14f'),'onDelete':_0x927c('0x113'),'hooks':!![],'required':![]});db[_0x927c('0x83')][_0x927c('0x115')](db['VoiceExtension'],{'as':_0x927c('0x118'),'foreignKey':_0x927c('0x14f'),'onDelete':_0x927c('0x160')});db[_0x927c('0x83')][_0x927c('0x115')](db[_0x927c('0x43')],{'as':_0x927c('0x1a6'),'foreignKey':_0x927c('0x14f')});db[_0x927c('0x83')][_0x927c('0x115')](db[_0x927c('0x67')],{'as':_0x927c('0x1a7'),'foreignKey':_0x927c('0x14f')});db[_0x927c('0x83')][_0x927c('0x115')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x927c('0x57')],{'as':_0x927c('0x1a8'),'foreignKey':'IntervalId'});db[_0x927c('0x88')]['belongsTo'](db[_0x927c('0x3d')],{});db['Schedule'][_0x927c('0x123')](db['AnalyticDefaultReport'],{'foreignKey':_0x927c('0x1a9')});db[_0x927c('0x88')]['belongsTo'](db[_0x927c('0x96')],{'foreignKey':_0x927c('0x1aa')});db[_0x927c('0x8a')][_0x927c('0x124')](db[_0x927c('0x19')],{'as':_0x927c('0x1ab'),'through':_0x927c('0x146'),'onDelete':_0x927c('0x160')});db[_0x927c('0x8c')][_0x927c('0x124')](db[_0x927c('0x72')],{'through':_0x927c('0x199')});db['Tag'][_0x927c('0x124')](db['ChatInteraction'],{'through':_0x927c('0x194')});db[_0x927c('0x8c')][_0x927c('0x124')](db['MailInteraction'],{'through':_0x927c('0x16e')});db[_0x927c('0x8c')][_0x927c('0x124')](db[_0x927c('0x11c')],{'through':_0x927c('0x184')});db['Tag'][_0x927c('0x124')](db['FaxInteraction'],{'through':_0x927c('0x17a')});db[_0x927c('0x8c')][_0x927c('0x124')](db['OpenchannelInteraction'],{'through':_0x927c('0x18a')});db[_0x927c('0x8c')][_0x927c('0x124')](db['WhatsappInteraction'],{'through':_0x927c('0x1ac')});db['Trigger']['hasMany'](db[_0x927c('0x81')],{'as':{'plural':_0x927c('0x1ad'),'singular':_0x927c('0x1ae')},'foreignKey':_0x927c('0x1af'),'onDelete':_0x927c('0x113'),'hooks':!![]});db[_0x927c('0x90')]['hasMany'](db[_0x927c('0x81')],{'as':{'plural':'AnyConditions','singular':_0x927c('0x1b0')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x927c('0x90')][_0x927c('0x115')](db[_0x927c('0x1a1')],{'as':_0x927c('0x1a2'),'foreignKey':_0x927c('0x1b1'),'onDelete':_0x927c('0x113'),'hooks':!![]});db[_0x927c('0x96')][_0x927c('0x115')](db[_0x927c('0x9c')],{'as':_0x927c('0x1b2'),'onDelete':'cascade','foreignKey':_0x927c('0x1aa'),'hooks':!![]});db[_0x927c('0x1b3')][_0x927c('0x115')](db[_0x927c('0x9c')],{'as':_0x927c('0x1b2'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1a9')});db['AnalyticMetric'][_0x927c('0x115')](db[_0x927c('0x9c')],{'as':_0x927c('0x1b2'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b4')});db[_0x927c('0x9c')][_0x927c('0x123')](db['AnalyticMetric'],{'foreignKey':_0x927c('0x1b4')});db['SalesforceAccount']['hasMany'](db[_0x927c('0xa0')],{'as':_0x927c('0x1b5'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xa0')]['hasMany'](db[_0x927c('0xa2')],{'as':'Subjects','onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0xa0')][_0x927c('0x115')](db[_0x927c('0xa2')],{'as':'Descriptions','onDelete':_0x927c('0x113'),'foreignKey':'DescriptionId'});db[_0x927c('0xa0')][_0x927c('0x115')](db['SalesforceField'],{'as':_0x927c('0x1b2'),'onDelete':'cascade','foreignKey':_0x927c('0x1b8')});db[_0x927c('0xa0')][_0x927c('0x123')](db[_0x927c('0x9e')],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xa2')]['hasMany'](db[_0x927c('0xa2')],{'as':_0x927c('0x1b9'),'foreignKey':'SubjectId'});db['SalesforceField']['hasMany'](db[_0x927c('0xa2')],{'as':_0x927c('0x1ba'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xa2')]['hasMany'](db[_0x927c('0xa2')],{'as':_0x927c('0x1bc'),'foreignKey':_0x927c('0x1b8')});db['SalesforceField']['belongsTo'](db['Variable'],{'as':_0x927c('0x91'),'foreignKey':_0x927c('0x1bd')});db[_0x927c('0xa4')][_0x927c('0x115')](db[_0x927c('0xa5')],{'as':_0x927c('0x1b5'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xa5')][_0x927c('0x115')](db[_0x927c('0xa7')],{'as':_0x927c('0x1be'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b7')});db['SugarcrmConfiguration'][_0x927c('0x115')](db['SugarcrmField'],{'as':_0x927c('0x1bf'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xa5')][_0x927c('0x115')](db[_0x927c('0xa7')],{'as':'Fields','onDelete':_0x927c('0x113'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x927c('0x123')](db[_0x927c('0xa4')],{'as':_0x927c('0x16b'),'foreignKey':'AccountId'});db[_0x927c('0xa7')]['hasMany'](db['SugarcrmField'],{'as':_0x927c('0x1b9'),'foreignKey':_0x927c('0x1b7')});db['SugarcrmField'][_0x927c('0x115')](db['SugarcrmField'],{'as':_0x927c('0x1ba'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xa7')][_0x927c('0x115')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x927c('0x1b8')});db[_0x927c('0xa7')][_0x927c('0x123')](db[_0x927c('0x91')],{'as':_0x927c('0x91'),'foreignKey':_0x927c('0x1bd')});db[_0x927c('0xa9')][_0x927c('0x115')](db[_0x927c('0xab')],{'as':_0x927c('0x1b5'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xab')][_0x927c('0x115')](db[_0x927c('0xad')],{'as':_0x927c('0x1be'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0xab')][_0x927c('0x115')](db[_0x927c('0xad')],{'as':_0x927c('0x1bf'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xab')][_0x927c('0x115')](db[_0x927c('0xad')],{'as':_0x927c('0x1b2'),'onDelete':'cascade','foreignKey':_0x927c('0x1b8')});db[_0x927c('0xab')][_0x927c('0x123')](db[_0x927c('0xa9')],{'as':_0x927c('0x16b'),'foreignKey':'AccountId'});db[_0x927c('0xab')][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':'int_desk_configuration_has_tags'});db['DeskField']['hasMany'](db[_0x927c('0xad')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x927c('0xad')][_0x927c('0x115')](db[_0x927c('0xad')],{'as':_0x927c('0x1ba'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xad')][_0x927c('0x115')](db['DeskField'],{'as':_0x927c('0x1bc'),'foreignKey':_0x927c('0x1b8')});db[_0x927c('0xad')]['belongsTo'](db[_0x927c('0x91')],{'as':_0x927c('0x91'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x927c('0x115')](db[_0x927c('0xb0')],{'as':_0x927c('0x1b5'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db['ZohoConfiguration'][_0x927c('0x115')](db[_0x927c('0xb2')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x927c('0x115')](db['ZohoField'],{'as':_0x927c('0x1bf'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xb0')][_0x927c('0x115')](db['ZohoField'],{'as':_0x927c('0x1b2'),'onDelete':'cascade','foreignKey':_0x927c('0x1b8')});db['ZohoConfiguration'][_0x927c('0x123')](db[_0x927c('0xae')],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xb2')][_0x927c('0x115')](db['ZohoField'],{'as':_0x927c('0x1b9'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0xb2')][_0x927c('0x115')](db[_0x927c('0xb2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x927c('0xb2')][_0x927c('0x115')](db['ZohoField'],{'as':_0x927c('0x1bc'),'foreignKey':'FieldId'});db['ZohoField']['belongsTo'](db[_0x927c('0x91')],{'as':_0x927c('0x91'),'foreignKey':'VariableId'});db[_0x927c('0x1c0')][_0x927c('0x115')](db['ZendeskConfiguration'],{'as':_0x927c('0x1b5'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xb5')][_0x927c('0x115')](db['ZendeskField'],{'as':_0x927c('0x1be'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0xb5')][_0x927c('0x115')](db[_0x927c('0xb7')],{'as':'Descriptions','foreignKey':_0x927c('0x1bb')});db[_0x927c('0xb5')][_0x927c('0x115')](db[_0x927c('0xb7')],{'as':_0x927c('0x1b2'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x927c('0x123')](db[_0x927c('0x1c0')],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xb5')][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':_0x927c('0x1c1')});db[_0x927c('0xb7')][_0x927c('0x115')](db[_0x927c('0xb7')],{'as':'Subject','foreignKey':_0x927c('0x1b7')});db[_0x927c('0xb7')]['hasMany'](db[_0x927c('0xb7')],{'as':_0x927c('0x1ba'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xb7')][_0x927c('0x115')](db[_0x927c('0xb7')],{'as':_0x927c('0x1bc'),'foreignKey':_0x927c('0x1b8')});db[_0x927c('0xb7')][_0x927c('0x123')](db['Variable'],{'as':'Variable','foreignKey':_0x927c('0x1bd')});db['FreshdeskAccount']['hasMany'](db[_0x927c('0x1c2')],{'as':_0x927c('0x1b5'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0x1c2')][_0x927c('0x115')](db['FreshdeskField'],{'as':_0x927c('0x1be'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b7')});db['FreshdeskConfiguration'][_0x927c('0x115')](db[_0x927c('0x1c3')],{'as':_0x927c('0x1bf'),'onDelete':_0x927c('0x113'),'foreignKey':'DescriptionId'});db[_0x927c('0x1c2')][_0x927c('0x115')](db['FreshdeskField'],{'as':_0x927c('0x1b2'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b8')});db[_0x927c('0x1c2')][_0x927c('0x123')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x927c('0x1b6')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x927c('0x8c')],{'through':_0x927c('0x1c4')});db[_0x927c('0x1c3')]['hasMany'](db[_0x927c('0x1c3')],{'as':_0x927c('0x1b9'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0x1c3')][_0x927c('0x115')](db[_0x927c('0x1c3')],{'as':_0x927c('0x1ba'),'foreignKey':'DescriptionId'});db[_0x927c('0x1c3')][_0x927c('0x115')](db[_0x927c('0x1c3')],{'as':_0x927c('0x1bc'),'foreignKey':_0x927c('0x1b8')});db['FreshdeskField'][_0x927c('0x123')](db[_0x927c('0x91')],{'as':_0x927c('0x91'),'foreignKey':'VariableId'});db[_0x927c('0xbc')][_0x927c('0x115')](db[_0x927c('0x1c5')],{'as':'Configurations','onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db['VtigerConfiguration'][_0x927c('0x115')](db[_0x927c('0xbe')],{'as':_0x927c('0x1be'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0x1c5')]['hasMany'](db[_0x927c('0xbe')],{'as':_0x927c('0x1bf'),'foreignKey':'DescriptionId'});db[_0x927c('0x1c5')][_0x927c('0x115')](db[_0x927c('0xbe')],{'as':_0x927c('0x1b2'),'foreignKey':_0x927c('0x1b8')});db[_0x927c('0x1c5')][_0x927c('0x123')](db['VtigerAccount'],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x1b6')});db['VtigerField']['hasMany'](db[_0x927c('0xbe')],{'as':_0x927c('0x1b9'),'foreignKey':_0x927c('0x1b7')});db['VtigerField'][_0x927c('0x115')](db[_0x927c('0xbe')],{'as':'Description','foreignKey':_0x927c('0x1bb')});db[_0x927c('0xbe')][_0x927c('0x115')](db[_0x927c('0xbe')],{'as':_0x927c('0x1bc'),'foreignKey':_0x927c('0x1b8')});db[_0x927c('0xbe')][_0x927c('0x123')](db[_0x927c('0x91')],{'as':_0x927c('0x91'),'foreignKey':_0x927c('0x1bd')});db[_0x927c('0x1c6')][_0x927c('0x115')](db[_0x927c('0xc0')],{'as':_0x927c('0x1b5'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xc0')][_0x927c('0x115')](db['ServicenowField'],{'as':_0x927c('0x1be'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0xc0')][_0x927c('0x115')](db['ServicenowField'],{'as':_0x927c('0x1bf'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xc0')]['hasMany'](db[_0x927c('0xc1')],{'as':_0x927c('0x1b2'),'foreignKey':'FieldId'});db[_0x927c('0xc0')][_0x927c('0x123')](db[_0x927c('0x1c6')],{'as':_0x927c('0x16b'),'foreignKey':'AccountId'});db[_0x927c('0xc1')]['hasMany'](db[_0x927c('0xc1')],{'as':_0x927c('0x1b9'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0xc1')][_0x927c('0x115')](db[_0x927c('0xc1')],{'as':_0x927c('0x1ba'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xc1')][_0x927c('0x115')](db[_0x927c('0xc1')],{'as':_0x927c('0x1bc'),'foreignKey':_0x927c('0x1b8')});db[_0x927c('0xc1')][_0x927c('0x123')](db[_0x927c('0x91')],{'as':_0x927c('0x91'),'foreignKey':_0x927c('0x1bd')});db[_0x927c('0xc3')][_0x927c('0x115')](db[_0x927c('0xc5')],{'as':_0x927c('0x1b5'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xc3')][_0x927c('0x123')](db['CloudProvider'],{'as':_0x927c('0x10a'),'foreignKey':_0x927c('0x15f')});db[_0x927c('0xc5')]['hasMany'](db[_0x927c('0xc7')],{'as':_0x927c('0x1be'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x927c('0xc5')]['hasMany'](db[_0x927c('0xc7')],{'as':_0x927c('0x1bf'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xc5')]['hasMany'](db[_0x927c('0xc7')],{'as':_0x927c('0x1b2'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1b8')});db[_0x927c('0xc5')]['belongsTo'](db[_0x927c('0xc3')],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x1b6')});db[_0x927c('0xc7')]['hasMany'](db[_0x927c('0xc7')],{'as':_0x927c('0x1b9'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0xc7')]['hasMany'](db['Dynamics365Field'],{'as':_0x927c('0x1ba'),'foreignKey':_0x927c('0x1bb')});db[_0x927c('0xc7')][_0x927c('0x115')](db[_0x927c('0xc7')],{'as':'Field','foreignKey':_0x927c('0x1b8')});db[_0x927c('0xc7')]['belongsTo'](db[_0x927c('0x91')],{'as':'Variable','foreignKey':_0x927c('0x1bd')});db[_0x927c('0xc9')]['hasMany'](db[_0x927c('0xcb')],{'as':_0x927c('0x1b5'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x927c('0x115')](db[_0x927c('0xcd')],{'as':'Subjects','foreignKey':_0x927c('0x1b7')});db[_0x927c('0xcb')][_0x927c('0x115')](db[_0x927c('0xcd')],{'as':_0x927c('0x1bf'),'foreignKey':_0x927c('0x1bb')});db['FreshsalesConfiguration'][_0x927c('0x115')](db[_0x927c('0xcd')],{'as':'Fields','foreignKey':_0x927c('0x1b8')});db[_0x927c('0xcb')][_0x927c('0x123')](db[_0x927c('0xc9')],{'as':'Account','foreignKey':_0x927c('0x1b6')});db[_0x927c('0xcd')]['hasMany'](db[_0x927c('0xcd')],{'as':_0x927c('0x1b9'),'foreignKey':_0x927c('0x1b7')});db[_0x927c('0xcd')][_0x927c('0x115')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x927c('0x1bb')});db[_0x927c('0xcd')][_0x927c('0x115')](db[_0x927c('0xcd')],{'as':'Field','foreignKey':_0x927c('0x1b8')});db[_0x927c('0xcd')][_0x927c('0x123')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x927c('0x1c7')]['belongsTo'](db[_0x927c('0x65')],{});db['ChatQueueReport'][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':'ListId'});db[_0x927c('0x1c7')][_0x927c('0x123')](db['CmContact'],{'as':_0x927c('0x16c'),'foreignKey':'ContactId'});db[_0x927c('0x1c7')][_0x927c('0x123')](db[_0x927c('0x69')],{});db[_0x927c('0x1c7')][_0x927c('0x123')](db[_0x927c('0x6b')],{});db['ChatQueueReport']['belongsTo'](db[_0x927c('0x12')],{});db[_0x927c('0x1c7')][_0x927c('0x123')](db[_0x927c('0x6e')],{});db[_0x927c('0x196')][_0x927c('0x123')](db['User'],{'onDelete':'cascade','foreignKey':_0x927c('0x1c8')});db[_0x927c('0x196')][_0x927c('0x123')](db[_0x927c('0x12')],{'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1c9')});db[_0x927c('0xd5')][_0x927c('0x115')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x927c('0x113')});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x927c('0x1ca'),'onDelete':_0x927c('0x113')});db[_0x927c('0xd7')]['belongsTo'](db[_0x927c('0x55')],{});db[_0x927c('0xd7')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':'ListId'});db['SmsQueueReport'][_0x927c('0x123')](db[_0x927c('0x72')],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db['SmsQueueReport'][_0x927c('0x123')](db['SmsInteraction'],{});db[_0x927c('0xd7')][_0x927c('0x123')](db[_0x927c('0x181')],{});db['SmsQueueReport'][_0x927c('0x123')](db[_0x927c('0x12')],{});db[_0x927c('0xd7')][_0x927c('0x123')](db[_0x927c('0x5b')],{});db[_0x927c('0xdc')][_0x927c('0x115')](db[_0x927c('0xd5')],{'foreignKey':_0x927c('0x1cb')});db[_0x927c('0xdc')]['hasMany'](db[_0x927c('0xd3')],{'foreignKey':'ProjectId'});db[_0x927c('0xdc')][_0x927c('0x115')](db[_0x927c('0x1cc')],{'foreignKey':_0x927c('0x1cb')});db[_0x927c('0xe0')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':'Users','through':_0x927c('0x142')});db[_0x927c('0xe6')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':'Agents','through':_0x927c('0x12c')});db[_0x927c('0xe6')][_0x927c('0x124')](db[_0x927c('0x130')],{'through':'TeamVoiceQueue','as':_0x927c('0x131')});db['Team'][_0x927c('0x124')](db[_0x927c('0x3e')],{'through':_0x927c('0x1cd'),'as':'MailQueues'});db[_0x927c('0xe6')][_0x927c('0x124')](db[_0x927c('0x6e')],{'through':_0x927c('0x195'),'as':_0x927c('0x135')});db[_0x927c('0xe6')]['belongsToMany'](db[_0x927c('0x52')],{'through':'team_has_fax_queues','as':_0x927c('0x136')});db[_0x927c('0xe6')][_0x927c('0x124')](db['SmsQueue'],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x927c('0xe6')][_0x927c('0x124')](db['OpenchannelQueue'],{'through':_0x927c('0x18c'),'as':'OpenchannelQueues'});db['Team'][_0x927c('0x124')](db[_0x927c('0x108')],{'through':'team_has_whatsapp_queues','as':_0x927c('0x138')});db['Team'][_0x927c('0x124')](db[_0x927c('0xf9')],{'through':_0x927c('0x10e'),'as':_0x927c('0x132')});db[_0x927c('0xea')][_0x927c('0x115')](db[_0x927c('0x74')],{'as':_0x927c('0x148'),'foreignKey':'CampaignId'});db['Campaign'][_0x927c('0x115')](db[_0x927c('0x76')],{'as':_0x927c('0x119'),'foreignKey':'CampaignId'});db[_0x927c('0xea')][_0x927c('0x115')](db['CmHopperHistory'],{'as':_0x927c('0x14a'),'foreignKey':_0x927c('0x19b')});db['Campaign'][_0x927c('0x115')](db['CmHopperBlack'],{'as':_0x927c('0x1ce'),'foreignKey':_0x927c('0x19b')});db[_0x927c('0xea')][_0x927c('0x123')](db[_0x927c('0x28')],{'as':_0x927c('0x28'),'foreignKey':_0x927c('0x14d')});db['Campaign'][_0x927c('0x123')](db[_0x927c('0x28')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x927c('0xea')][_0x927c('0x123')](db['Interval'],{'as':_0x927c('0x83'),'foreignKey':_0x927c('0x14f')});db[_0x927c('0xea')]['belongsTo'](db[_0x927c('0xe0')],{'as':_0x927c('0xe0'),'foreignKey':_0x927c('0x1cf')});db[_0x927c('0xea')][_0x927c('0x124')](db['CmList'],{'as':'Lists','through':_0x927c('0x1d0')});db[_0x927c('0xea')][_0x927c('0x124')](db[_0x927c('0xf7')],{'as':_0x927c('0x156'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x927c('0x123')](db[_0x927c('0x6c')],{'as':'ChatOfflineMessage','foreignKey':_0x927c('0x173')});db[_0x927c('0xf1')][_0x927c('0x123')](db[_0x927c('0x167')],{});db[_0x927c('0xf1')][_0x927c('0x123')](db['MailInteraction'],{});db[_0x927c('0xf1')][_0x927c('0x123')](db['MailAccount'],{'foreignKey':_0x927c('0x1d1'),'as':_0x927c('0x1d2')});db['MailTransferReport'][_0x927c('0x123')](db[_0x927c('0x12')],{'foreignKey':_0x927c('0x1d3'),'as':_0x927c('0x1d4')});db[_0x927c('0xf1')]['belongsTo'](db['User'],{'foreignKey':_0x927c('0x1d5'),'as':_0x927c('0x1d6')});db['MailTransferReport']['belongsTo'](db[_0x927c('0x3e')],{'foreignKey':_0x927c('0x1d7'),'as':_0x927c('0x1d8')});db[_0x927c('0xf1')][_0x927c('0x123')](db[_0x927c('0x3d')],{'foreignKey':_0x927c('0x1d9'),'as':_0x927c('0x1da')});db[_0x927c('0xf3')]['belongsTo'](db[_0x927c('0x6b')],{});db[_0x927c('0xf3')][_0x927c('0x123')](db[_0x927c('0x69')],{});db[_0x927c('0xf3')][_0x927c('0x123')](db[_0x927c('0x65')],{'foreignKey':_0x927c('0x1db'),'as':'FromAccount'});db[_0x927c('0xf3')]['belongsTo'](db[_0x927c('0x12')],{'foreignKey':_0x927c('0x1d3'),'as':_0x927c('0x1d4')});db[_0x927c('0xf3')][_0x927c('0x123')](db[_0x927c('0x12')],{'foreignKey':_0x927c('0x1d5'),'as':_0x927c('0x1d6')});db[_0x927c('0xf3')]['belongsTo'](db[_0x927c('0x6e')],{'foreignKey':'ToChatQueueId','as':_0x927c('0x1d8')});db['ChatTransferReport'][_0x927c('0x123')](db[_0x927c('0x65')],{'foreignKey':_0x927c('0x1dc'),'as':_0x927c('0x1da')});db[_0x927c('0x1dd')][_0x927c('0x123')](db[_0x927c('0x50')],{});db[_0x927c('0x1dd')][_0x927c('0x123')](db['FaxInteraction'],{});db['FaxTransferReport'][_0x927c('0x123')](db[_0x927c('0x4a')],{'foreignKey':_0x927c('0x1de'),'as':_0x927c('0x1d2')});db[_0x927c('0x1dd')][_0x927c('0x123')](db['User'],{'foreignKey':'FromUserId','as':_0x927c('0x1d4')});db[_0x927c('0x1dd')][_0x927c('0x123')](db[_0x927c('0x12')],{'foreignKey':_0x927c('0x1d5'),'as':_0x927c('0x1d6')});db[_0x927c('0x1dd')][_0x927c('0x123')](db[_0x927c('0x52')],{'foreignKey':_0x927c('0x1df'),'as':'ToQueue'});db[_0x927c('0x1dd')][_0x927c('0x123')](db[_0x927c('0x4a')],{'foreignKey':_0x927c('0x1e0'),'as':_0x927c('0x1da')});db[_0x927c('0x1e1')][_0x927c('0x123')](db[_0x927c('0x62')],{});db[_0x927c('0x1e1')][_0x927c('0x123')](db[_0x927c('0x60')],{});db[_0x927c('0x1e1')][_0x927c('0x123')](db['OpenchannelAccount'],{'foreignKey':_0x927c('0x1e2'),'as':_0x927c('0x1d2')});db[_0x927c('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x927c('0x1d4')});db[_0x927c('0x1e1')][_0x927c('0x123')](db[_0x927c('0x12')],{'foreignKey':_0x927c('0x1d5'),'as':_0x927c('0x1d6')});db[_0x927c('0x1e1')][_0x927c('0x123')](db[_0x927c('0x63')],{'foreignKey':_0x927c('0x1e3'),'as':_0x927c('0x1d8')});db[_0x927c('0x1e1')][_0x927c('0x123')](db[_0x927c('0x5d')],{'foreignKey':'ToOpenchannelAccountId','as':_0x927c('0x1da')});db['SmsTransferReport'][_0x927c('0x123')](db[_0x927c('0x181')],{});db[_0x927c('0xf5')]['belongsTo'](db[_0x927c('0x11c')],{});db[_0x927c('0xf5')][_0x927c('0x123')](db[_0x927c('0x55')],{'foreignKey':'FromSmsAccountId','as':_0x927c('0x1d2')});db[_0x927c('0xf5')][_0x927c('0x123')](db[_0x927c('0x12')],{'foreignKey':_0x927c('0x1d3'),'as':_0x927c('0x1d4')});db[_0x927c('0xf5')][_0x927c('0x123')](db[_0x927c('0x12')],{'foreignKey':_0x927c('0x1d5'),'as':_0x927c('0x1d6')});db[_0x927c('0xf5')][_0x927c('0x123')](db['SmsQueue'],{'foreignKey':_0x927c('0x1e4'),'as':_0x927c('0x1d8')});db[_0x927c('0xf5')][_0x927c('0x123')](db[_0x927c('0x55')],{'foreignKey':_0x927c('0x1e5'),'as':_0x927c('0x1da')});db[_0x927c('0xf7')][_0x927c('0x115')](db['Disposition'],{'as':_0x927c('0x164'),'foreignKey':_0x927c('0x169'),'onDelete':_0x927c('0x113')});db[_0x927c('0xf7')][_0x927c('0x115')](db[_0x927c('0x1e6')],{'as':_0x927c('0x1e7'),'foreignKey':_0x927c('0x169')});db[_0x927c('0xf7')][_0x927c('0x115')](db[_0x927c('0x72')],{'as':_0x927c('0x128'),'onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x169')});db[_0x927c('0xf7')]['hasMany'](db[_0x927c('0x76')],{'as':_0x927c('0x119'),'foreignKey':_0x927c('0x169')});db[_0x927c('0xf7')][_0x927c('0x115')](db[_0x927c('0x77')],{'as':'HopperHistory','foreignKey':_0x927c('0x169')});db['CmList'][_0x927c('0x115')](db[_0x927c('0x79')],{'as':_0x927c('0x79'),'foreignKey':_0x927c('0x169')});db[_0x927c('0xf7')][_0x927c('0x124')](db[_0x927c('0x130')],{'as':'Queues','through':_0x927c('0x153')});db[_0x927c('0xf7')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':_0x927c('0x12b')});db[_0x927c('0xf9')][_0x927c('0x115')](db[_0x927c('0x17')],{'as':_0x927c('0x118'),'onDelete':_0x927c('0x113')});db[_0x927c('0xf9')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':_0x927c('0x110')});db[_0x927c('0xf9')][_0x927c('0x124')](db[_0x927c('0xe6')],{'through':_0x927c('0x10e'),'as':_0x927c('0x155')});db[_0x927c('0xfb')][_0x927c('0x115')](db['User'],{'as':'Users','foreignKey':_0x927c('0x1e8')});db[_0x927c('0xfb')][_0x927c('0x115')](db[_0x927c('0xfc')],{'as':_0x927c('0x1e9'),'foreignKey':_0x927c('0x1e8'),'onDelete':_0x927c('0x113')});db[_0x927c('0xfc')][_0x927c('0x115')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x927c('0x1ea'),'onDelete':'cascade'});db['WhatsappAccount'][_0x927c('0x115')](db[_0x927c('0x7f')],{'as':_0x927c('0x164'),'foreignKey':_0x927c('0x1eb'),'onDelete':_0x927c('0x113')});db[_0x927c('0x1ec')][_0x927c('0x115')](db['CannedAnswer'],{'as':_0x927c('0x166'),'foreignKey':'WhatsappAccountId'});db[_0x927c('0x1ec')][_0x927c('0x115')](db[_0x927c('0x1ed')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x927c('0x1ec')]['hasMany'](db[_0x927c('0x103')],{'as':'Interactions'});db[_0x927c('0x1ec')][_0x927c('0x115')](db[_0x927c('0x101')],{'as':_0x927c('0x178')});db[_0x927c('0x1ec')][_0x927c('0x123')](db[_0x927c('0xf7')],{'as':'List','foreignKey':_0x927c('0x169')});db[_0x927c('0x1ec')][_0x927c('0x123')](db[_0x927c('0x150')],{'as':_0x927c('0x151'),'foreignKey':_0x927c('0x152')});db['WhatsappAccount'][_0x927c('0x124')](db['User'],{'as':'Agents','through':_0x927c('0x1ee')});db[_0x927c('0x101')]['belongsTo'](db[_0x927c('0x12')],{'onDelete':_0x927c('0x160')});db[_0x927c('0x101')][_0x927c('0x123')](db[_0x927c('0x108')],{'onDelete':_0x927c('0x160')});db[_0x927c('0x101')][_0x927c('0x123')](db[_0x927c('0x1ec')],{'onDelete':_0x927c('0x160')});db[_0x927c('0x101')][_0x927c('0x123')](db['Interval'],{'onDelete':_0x927c('0x160'),'foreignKey':_0x927c('0x14f')});db['WhatsappApplication'][_0x927c('0x123')](db[_0x927c('0x8c')],{'onDelete':_0x927c('0x160'),'foreignKey':_0x927c('0x174')});db[_0x927c('0x103')]['hasMany'](db[_0x927c('0x1ed')],{'as':'Messages','onDelete':_0x927c('0x113'),'foreignKey':_0x927c('0x1ef')});db[_0x927c('0x103')][_0x927c('0x123')](db[_0x927c('0x1ec')],{'as':_0x927c('0x16b'),'foreignKey':_0x927c('0x1eb')});db['WhatsappInteraction'][_0x927c('0x123')](db[_0x927c('0x72')],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db['WhatsappInteraction'][_0x927c('0x123')](db['User'],{'as':_0x927c('0x16d'),'foreignKey':'UserId'});db[_0x927c('0x103')][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':_0x927c('0x1ac'),'as':_0x927c('0x17b')});db['WhatsappInteraction'][_0x927c('0x124')](db[_0x927c('0x8c')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x927c('0x103')][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x16f'),'through':'user_has_whatsapp_interactions','foreignKey':_0x927c('0x1ef')});db[_0x927c('0x1ed')][_0x927c('0x123')](db[_0x927c('0x12')],{'as':_0x927c('0x12')});db[_0x927c('0x1ed')][_0x927c('0x123')](db[_0x927c('0x72')],{'onDelete':_0x927c('0x113'),'as':'Contact'});db[_0x927c('0x1ed')]['belongsTo'](db[_0x927c('0x103')],{'onDelete':_0x927c('0x113'),'as':_0x927c('0x171'),'foreignKey':'WhatsappInteractionId'});db[_0x927c('0x1ed')][_0x927c('0x123')](db[_0x927c('0x1ec')],{'as':'Account','foreignKey':_0x927c('0x1eb')});db[_0x927c('0x105')][_0x927c('0x123')](db[_0x927c('0x1ec')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x927c('0xf7')],{'as':_0x927c('0x168'),'foreignKey':_0x927c('0x169')});db['WhatsappQueueReport'][_0x927c('0x123')](db[_0x927c('0x72')],{'as':_0x927c('0x16c'),'foreignKey':_0x927c('0x15d')});db[_0x927c('0x105')]['belongsTo'](db[_0x927c('0x103')],{});db[_0x927c('0x105')][_0x927c('0x123')](db['WhatsappQueue'],{});db[_0x927c('0x105')][_0x927c('0x123')](db['WhatsappMessage'],{});db[_0x927c('0x105')][_0x927c('0x123')](db[_0x927c('0x12')],{});db[_0x927c('0x107')][_0x927c('0x123')](db[_0x927c('0x1ed')],{});db['WhatsappTransferReport'][_0x927c('0x123')](db[_0x927c('0x103')],{});db[_0x927c('0x107')][_0x927c('0x123')](db['WhatsappAccount'],{'foreignKey':_0x927c('0x1f0'),'as':_0x927c('0x1d2')});db[_0x927c('0x107')][_0x927c('0x123')](db[_0x927c('0x1ec')],{'foreignKey':_0x927c('0x1f1'),'as':_0x927c('0x1da')});db[_0x927c('0x107')][_0x927c('0x123')](db[_0x927c('0x108')],{'foreignKey':_0x927c('0x1f2'),'as':_0x927c('0x1d8')});db[_0x927c('0x107')][_0x927c('0x123')](db['User'],{'foreignKey':_0x927c('0x1d3'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x927c('0x123')](db['User'],{'foreignKey':_0x927c('0x1d5'),'as':_0x927c('0x1d6')});db['WhatsappQueue'][_0x927c('0x124')](db[_0x927c('0x12')],{'as':_0x927c('0x154'),'through':'UserWhatsappQueue','foreignKey':_0x927c('0x1f3')});db[_0x927c('0x108')][_0x927c('0x124')](db[_0x927c('0xe6')],{'through':_0x927c('0x1f4'),'as':_0x927c('0x155')});db[_0x927c('0x111')][_0x927c('0x123')](db[_0x927c('0x12')],{'as':_0x927c('0x1f5'),'foreignKey':_0x927c('0x114'),'onDelete':_0x927c('0x113'),'hooks':!![]});db[_0x927c('0x10a')][_0x927c('0x161')](db[_0x927c('0xc3')],{'as':_0x927c('0xc3'),'onDelete':_0x927c('0x160')});db[_0x927c('0x10a')][_0x927c('0x161')](db[_0x927c('0x39')],{'as':_0x927c('0x162'),'onDelete':_0x927c('0x160')});db['CloudProvider'][_0x927c('0x161')](db[_0x927c('0x3b')],{'as':_0x927c('0x163'),'onDelete':_0x927c('0x160')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 677828f..ecdddab 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ca=['./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/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/mailSubstatus','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x51f4fc,_0x1fe3ef){_0x51f4fc=_0x51f4fc-0x0;var _0x4d96fc=_0xf2ca[_0x51f4fc];return _0x4d96fc;};'use strict';var path=require(_0xaf2c('0x0'));var express=require(_0xaf2c('0x1'));var errors=require(_0xaf2c('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xaf2c('0x3'))[_0xaf2c('0x4')];var clientSideLogs=require(_0xaf2c('0x5'));exports[_0xaf2c('0x6')]=function(_0x3a724c){return setupLoggers(_0x3a724c)[_0xaf2c('0x7')](function(){_0x3a724c['use'](_0xaf2c('0x8'),require(_0xaf2c('0x9')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xb'),require('./api/voiceChanSpy'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xc'),require('./api/voiceContext'));_0x3a724c[_0xaf2c('0xa')]('/api/voice/extensions',require(_0xaf2c('0xd')));_0x3a724c['use'](_0xaf2c('0xe'),require(_0xaf2c('0xf')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x10'),require('./api/voiceQueue'));_0x3a724c['use'](_0xaf2c('0x11'),require(_0xaf2c('0x12')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x13'),require(_0xaf2c('0x14')));_0x3a724c['use']('/api/voice/mails',require(_0xaf2c('0x15')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x16'),require(_0xaf2c('0x17')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x18'),require(_0xaf2c('0x19')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x1a'),require(_0xaf2c('0x1b')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x1c'),require(_0xaf2c('0x1d')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x1e'),require('./api/voiceQueueReport'));_0x3a724c[_0xaf2c('0xa')]('/api/members/reports',require(_0xaf2c('0x1f')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x20'),require('./api/trunk'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x21'),require(_0xaf2c('0x22')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x23'),require(_0xaf2c('0x24')));_0x3a724c['use'](_0xaf2c('0x25'),require(_0xaf2c('0x26')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x27'),require(_0xaf2c('0x28')));_0x3a724c['use'](_0xaf2c('0x29'),require(_0xaf2c('0x2a')));_0x3a724c[_0xaf2c('0xa')]('/api/mail/interactions',require('./api/mailInteraction'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x2b'),require(_0xaf2c('0x2c')));_0x3a724c[_0xaf2c('0xa')]('/api/mail/applications',require(_0xaf2c('0x2d')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x2e'),require(_0xaf2c('0x2f')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x30'),require(_0xaf2c('0x31')));_0x3a724c['use'](_0xaf2c('0x32'),require(_0xaf2c('0x33')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x34'),require('./api/faxAccount'));_0x3a724c[_0xaf2c('0xa')]('/api/fax/applications',require(_0xaf2c('0x35')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x36'),require('./api/faxInteraction'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x37'),require(_0xaf2c('0x38')));_0x3a724c['use'](_0xaf2c('0x39'),require(_0xaf2c('0x3a')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x3b'),require('./api/faxQueueReport'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x3c'),require(_0xaf2c('0x3d')));_0x3a724c['use']('/api/sms/applications',require(_0xaf2c('0x3e')));_0x3a724c['use'](_0xaf2c('0x3f'),require('./api/smsInteraction'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x40'),require('./api/smsMessage'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x41'),require('./api/smsQueue'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x42'),require(_0xaf2c('0x43')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x44'),require(_0xaf2c('0x45')));_0x3a724c['use'](_0xaf2c('0x46'),require('./api/openchannelInteraction'));_0x3a724c[_0xaf2c('0xa')]('/api/openchannel/messages',require(_0xaf2c('0x47')));_0x3a724c['use'](_0xaf2c('0x48'),require('./api/openchannelQueue'));_0x3a724c[_0xaf2c('0xa')]('/api/chat/websites',require(_0xaf2c('0x49')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x4a'),require(_0xaf2c('0x4b')));_0x3a724c[_0xaf2c('0xa')]('/api/chat/applications',require('./api/chatApplication'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x4c'),require(_0xaf2c('0x4d')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x4e'),require(_0xaf2c('0x4f')));_0x3a724c['use'](_0xaf2c('0x50'),require(_0xaf2c('0x51')));_0x3a724c['use'](_0xaf2c('0x52'),require(_0xaf2c('0x53')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x54'),require(_0xaf2c('0x55')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x56'),require(_0xaf2c('0x57')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x58'),require(_0xaf2c('0x59')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x5a'),require('./api/cmContact'));_0x3a724c['use']('/api/cm/hopper',require(_0xaf2c('0x5b')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x5c'),require(_0xaf2c('0x5d')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x5e'),require('./api/cmHopperFinal'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x5f'),require(_0xaf2c('0x60')));_0x3a724c['use']('/api/cm/custom_fields',require(_0xaf2c('0x61')));_0x3a724c['use'](_0xaf2c('0x62'),require(_0xaf2c('0x63')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x64'),require('./api/automation'));_0x3a724c[_0xaf2c('0xa')]('/api/canned_answers',require(_0xaf2c('0x65')));_0x3a724c[_0xaf2c('0xa')]('/api/dispositions',require(_0xaf2c('0x66')));_0x3a724c['use'](_0xaf2c('0x67'),require(_0xaf2c('0x68')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x69'),require(_0xaf2c('0x6a')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x6b'),require(_0xaf2c('0x6c')));_0x3a724c[_0xaf2c('0xa')]('/api/cdr',require('./api/cdr'));_0x3a724c[_0xaf2c('0xa')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x3a724c['use'](_0xaf2c('0x6d'),require(_0xaf2c('0x6e')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x6f'),require('./api/sound'));_0x3a724c[_0xaf2c('0xa')]('/api/tags',require(_0xaf2c('0x70')));_0x3a724c['use'](_0xaf2c('0x71'),require(_0xaf2c('0x72')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x73'),require(_0xaf2c('0x74')));_0x3a724c['use'](_0xaf2c('0x75'),require(_0xaf2c('0x76')));_0x3a724c['use']('/api/integrations',require(_0xaf2c('0x77')));_0x3a724c['use'](_0xaf2c('0x78'),require(_0xaf2c('0x79')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x7a'),require(_0xaf2c('0x7b')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x7c'),require(_0xaf2c('0x7d')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x7e'),require(_0xaf2c('0x7f')));_0x3a724c['use'](_0xaf2c('0x80'),require(_0xaf2c('0x81')));_0x3a724c['use']('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x82'),require('./api/analyticTreeReport'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x83'),require(_0xaf2c('0x84')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x85'),require(_0xaf2c('0x86')));_0x3a724c[_0xaf2c('0xa')]('/api/integrations/salesforce/fields',require(_0xaf2c('0x87')));_0x3a724c[_0xaf2c('0xa')]('/api/integrations/sugarcrm/accounts',require(_0xaf2c('0x88')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x89'),require(_0xaf2c('0x8a')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x8b'),require(_0xaf2c('0x8c')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x8d'),require(_0xaf2c('0x8e')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x8f'),require(_0xaf2c('0x90')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x91'),require(_0xaf2c('0x92')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x93'),require(_0xaf2c('0x94')));_0x3a724c[_0xaf2c('0xa')]('/api/integrations/zoho/configurations',require(_0xaf2c('0x95')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x96'),require('./api/intZohoField'));_0x3a724c[_0xaf2c('0xa')]('/api/integrations/zendesk/accounts',require(_0xaf2c('0x97')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x98'),require(_0xaf2c('0x99')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x9a'),require(_0xaf2c('0x9b')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x9c'),require('./api/intFreshdeskAccount'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x9d'),require(_0xaf2c('0x9e')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0x9f'),require('./api/intFreshdeskField'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xa0'),require('./api/intVtigerAccount'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xa1'),require('./api/intVtigerConfiguration'));_0x3a724c['use'](_0xaf2c('0xa2'),require(_0xaf2c('0xa3')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xa4'),require('./api/intServicenowAccount'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xa5'),require('./api/intServicenowConfiguration'));_0x3a724c[_0xaf2c('0xa')]('/api/integrations/servicenow/fields',require(_0xaf2c('0xa6')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xa7'),require(_0xaf2c('0xa8')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xa9'),require(_0xaf2c('0xaa')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xab'),require(_0xaf2c('0xac')));_0x3a724c['use'](_0xaf2c('0xad'),require(_0xaf2c('0xae')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xaf'),require(_0xaf2c('0xb0')));_0x3a724c['use'](_0xaf2c('0xb1'),require(_0xaf2c('0xb2')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xb3'),require(_0xaf2c('0xb4')));_0x3a724c['use']('/api/chat/reports/queue',require(_0xaf2c('0xb5')));_0x3a724c[_0xaf2c('0xa')]('/api/chat/internal/messages',require(_0xaf2c('0xb6')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xb7'),require('./api/jscriptyAnswerReport'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xb8'),require(_0xaf2c('0xb9')));_0x3a724c[_0xaf2c('0xa')]('/api/jscripty/sessions/reports',require(_0xaf2c('0xba')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xbb'),require(_0xaf2c('0xbc')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xbd'),require(_0xaf2c('0xbe')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xbf'),require(_0xaf2c('0xc0')));_0x3a724c[_0xaf2c('0xa')]('/api/jscripty/projects',require(_0xaf2c('0xc1')));_0x3a724c['use'](_0xaf2c('0xc2'),require(_0xaf2c('0xc3')));_0x3a724c['use'](_0xaf2c('0xc4'),require('./api/squareOdbc'));_0x3a724c['use'](_0xaf2c('0xc5'),require(_0xaf2c('0xc6')));_0x3a724c[_0xaf2c('0xa')]('/api/square/recordings',require('./api/squareRecording'));_0x3a724c['use'](_0xaf2c('0xc7'),require(_0xaf2c('0xc8')));_0x3a724c['use'](_0xaf2c('0xc9'),require(_0xaf2c('0xca')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xcb'),require(_0xaf2c('0xcc')));_0x3a724c[_0xaf2c('0xa')]('/api/campaigns',require(_0xaf2c('0xcd')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xce'),require('./api/migration'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xcf'),require(_0xaf2c('0xd0')));_0x3a724c['use'](_0xaf2c('0xd1'),require(_0xaf2c('0xd2')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xd3'),require('./api/mailTransferReport'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xd4'),require(_0xaf2c('0xd5')));_0x3a724c['use']('/api/fax/reports/transfer',require(_0xaf2c('0xd6')));_0x3a724c[_0xaf2c('0xa')]('/api/openchannel/reports/transfer',require(_0xaf2c('0xd7')));_0x3a724c[_0xaf2c('0xa')]('/api/sms/reports/transfer',require(_0xaf2c('0xd8')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xd9'),require(_0xaf2c('0xda')));_0x3a724c[_0xaf2c('0xa')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xdb'),require(_0xaf2c('0xdc')));_0x3a724c['use'](_0xaf2c('0xdd'),require(_0xaf2c('0xde')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xdf'),require(_0xaf2c('0xe0')));_0x3a724c['use'](_0xaf2c('0xe1'),require(_0xaf2c('0xe2')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xe3'),require(_0xaf2c('0xe4')));_0x3a724c[_0xaf2c('0xa')]('/api/whatsapp/applications',require(_0xaf2c('0xe5')));_0x3a724c[_0xaf2c('0xa')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x3a724c['use'](_0xaf2c('0xe6'),require(_0xaf2c('0xe7')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xe8'),require('./api/whatsappQueueReport'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xe9'),require(_0xaf2c('0xea')));_0x3a724c[_0xaf2c('0xa')]('/api/whatsapp/queues',require(_0xaf2c('0xeb')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xec'),require(_0xaf2c('0xed')));_0x3a724c[_0xaf2c('0xa')]('/api/realtime',require(_0xaf2c('0xee')));_0x3a724c[_0xaf2c('0xa')]('/api/user-settings',require('./api/user-setting'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xef'),require('./api/authLocal'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xf0'),require(_0xaf2c('0xf1')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xf2'),require(_0xaf2c('0xf3')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xf4'),require('./api/jira'));_0x3a724c[_0xaf2c('0xa')]('/api/rpc',require(_0xaf2c('0xf5')));_0x3a724c[_0xaf2c('0xa')]('/api/version',require('./api/version'));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xf6'),require(_0xaf2c('0xf7')));_0x3a724c['use'](_0xaf2c('0xf8'),require(_0xaf2c('0xf9')));_0x3a724c[_0xaf2c('0xa')]('/api/webbar',require('./api/webbar'));_0x3a724c['use']('/api/logs',clientSideLogs);_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xfa'),express[_0xaf2c('0xfb')](path[_0xaf2c('0xfc')](config[_0xaf2c('0xfd')],'/apidoc')));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xfe'),express['static'](path[_0xaf2c('0xfc')](config['root'],_0xaf2c('0xfe'))));_0x3a724c[_0xaf2c('0xa')](_0xaf2c('0xff'),express[_0xaf2c('0xfb')](path[_0xaf2c('0xfc')](config[_0xaf2c('0xfd')],'/demo')));_0x3a724c['use'](_0xaf2c('0x100'),express[_0xaf2c('0xfb')](path[_0xaf2c('0xfc')](config[_0xaf2c('0xfd')],_0xaf2c('0x101'),_0xaf2c('0x102'))));_0x3a724c['use']('/plugins',express[_0xaf2c('0xfb')](path['join'](config[_0xaf2c('0xfd')],'/server/files/plugins')));_0x3a724c[_0xaf2c('0x103')](_0xaf2c('0x104'))['get'](errors[0x194]);_0x3a724c[_0xaf2c('0x103')]('/*')[_0xaf2c('0x105')](function(_0x1e3cf2,_0x52230f){_0x52230f[_0xaf2c('0x106')](path[_0xaf2c('0x107')](_0x3a724c[_0xaf2c('0x105')](_0xaf2c('0x108'))+_0xaf2c('0x109')));});return _0x3a724c;});}; \ No newline at end of file +var _0x032e=['./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','join','/www','static','/demo','/snippet','root','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','./errors','./config/environment','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./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/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/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/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/messages','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/user-setting','/api/auth/local','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system'];(function(_0x531607,_0x73fa88){var _0x1b1fbb=function(_0x4af491){while(--_0x4af491){_0x531607['push'](_0x531607['shift']());}};_0x1b1fbb(++_0x73fa88);}(_0x032e,0x124));var _0xe032=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x032e[_0x2763f2];return _0x3ef471;};'use strict';var path=require(_0xe032('0x0'));var express=require('express');var errors=require(_0xe032('0x1'));var config=require(_0xe032('0x2'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0xe032('0x3'));exports[_0xe032('0x4')]=function(_0x2f44f6){return setupLoggers(_0x2f44f6)[_0xe032('0x5')](function(){_0x2f44f6[_0xe032('0x6')](_0xe032('0x7'),require(_0xe032('0x8')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x9'),require(_0xe032('0xa')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xb'),require(_0xe032('0xc')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xd'),require(_0xe032('0xe')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xf'),require('./api/voiceMusicOnHold'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x10'),require(_0xe032('0x11')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x12'),require(_0xe032('0x13')));_0x2f44f6[_0xe032('0x6')]('/api/screen/recordings',require(_0xe032('0x14')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x15'),require(_0xe032('0x16')));_0x2f44f6['use'](_0xe032('0x17'),require(_0xe032('0x18')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x19'),require(_0xe032('0x1a')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x1b'),require('./api/voiceDialReport'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x1c'),require(_0xe032('0x1d')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x1e'),require(_0xe032('0x1f')));_0x2f44f6['use'](_0xe032('0x20'),require(_0xe032('0x21')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x22'),require(_0xe032('0x23')));_0x2f44f6['use']('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x2f44f6[_0xe032('0x6')]('/api/mail/out_servers',require(_0xe032('0x24')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x25'),require(_0xe032('0x26')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x27'),require(_0xe032('0x28')));_0x2f44f6['use'](_0xe032('0x29'),require(_0xe032('0x2a')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x2b'),require(_0xe032('0x2c')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x2d'),require(_0xe032('0x2e')));_0x2f44f6['use']('/api/mail/applications',require('./api/mailApplication'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x2f'),require(_0xe032('0x30')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x31'),require(_0xe032('0x32')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x33'),require(_0xe032('0x34')));_0x2f44f6[_0xe032('0x6')]('/api/fax/accounts',require(_0xe032('0x35')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x36'),require(_0xe032('0x37')));_0x2f44f6['use']('/api/fax/interactions',require(_0xe032('0x38')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x39'),require(_0xe032('0x3a')));_0x2f44f6['use']('/api/fax/queues',require('./api/faxQueue'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x3b'),require(_0xe032('0x3c')));_0x2f44f6[_0xe032('0x6')]('/api/sms/accounts',require(_0xe032('0x3d')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x3e'),require(_0xe032('0x3f')));_0x2f44f6[_0xe032('0x6')]('/api/sms/interactions',require(_0xe032('0x40')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x41'),require(_0xe032('0x42')));_0x2f44f6['use'](_0xe032('0x43'),require('./api/smsQueue'));_0x2f44f6[_0xe032('0x6')]('/api/openchannel/accounts',require(_0xe032('0x44')));_0x2f44f6['use'](_0xe032('0x45'),require('./api/openchannelApplication'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x46'),require('./api/openchannelInteraction'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x47'),require(_0xe032('0x48')));_0x2f44f6[_0xe032('0x6')]('/api/openchannel/queues',require(_0xe032('0x49')));_0x2f44f6['use'](_0xe032('0x4a'),require(_0xe032('0x4b')));_0x2f44f6['use'](_0xe032('0x4c'),require(_0xe032('0x4d')));_0x2f44f6['use'](_0xe032('0x4e'),require(_0xe032('0x4f')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x50'),require(_0xe032('0x51')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x52'),require(_0xe032('0x53')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x54'),require(_0xe032('0x55')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x56'),require(_0xe032('0x57')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x58'),require(_0xe032('0x59')));_0x2f44f6['use'](_0xe032('0x5a'),require('./api/chatProactiveAction'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x5b'),require(_0xe032('0x5c')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x5d'),require('./api/cmContact'));_0x2f44f6[_0xe032('0x6')]('/api/cm/hopper',require(_0xe032('0x5e')));_0x2f44f6['use'](_0xe032('0x5f'),require(_0xe032('0x60')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x61'),require('./api/cmHopperFinal'));_0x2f44f6[_0xe032('0x6')]('/api/cm/hopper_history',require(_0xe032('0x62')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x63'),require(_0xe032('0x64')));_0x2f44f6['use']('/api/actions',require(_0xe032('0x65')));_0x2f44f6[_0xe032('0x6')]('/api/automations',require(_0xe032('0x66')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x67'),require(_0xe032('0x68')));_0x2f44f6[_0xe032('0x6')]('/api/dispositions',require(_0xe032('0x69')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x6a'),require(_0xe032('0x6b')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x6c'),require(_0xe032('0x6d')));_0x2f44f6[_0xe032('0x6')]('/api/pauses',require('./api/pause'));_0x2f44f6[_0xe032('0x6')]('/api/cdr',require(_0xe032('0x6e')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x6f'),require(_0xe032('0x70')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x71'),require(_0xe032('0x72')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x73'),require('./api/sound'));_0x2f44f6[_0xe032('0x6')]('/api/tags',require('./api/tag'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x74'),require(_0xe032('0x75')));_0x2f44f6[_0xe032('0x6')]('/api/triggers',require(_0xe032('0x76')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x77'),require(_0xe032('0x78')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x79'),require(_0xe032('0x7a')));_0x2f44f6['use'](_0xe032('0x7b'),require(_0xe032('0x7c')));_0x2f44f6['use'](_0xe032('0x7d'),require(_0xe032('0x7e')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x7f'),require(_0xe032('0x80')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x81'),require(_0xe032('0x82')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x83'),require(_0xe032('0x84')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x85'),require(_0xe032('0x86')));_0x2f44f6['use'](_0xe032('0x87'),require('./api/analyticTreeReport'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x88'),require(_0xe032('0x89')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x8a'),require(_0xe032('0x8b')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x8c'),require(_0xe032('0x8d')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x8e'),require('./api/intSugarcrmAccount'));_0x2f44f6[_0xe032('0x6')](_0xe032('0x8f'),require('./api/intSugarcrmConfiguration'));_0x2f44f6[_0xe032('0x6')]('/api/integrations/sugarcrm/fields',require(_0xe032('0x90')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x91'),require(_0xe032('0x92')));_0x2f44f6[_0xe032('0x6')]('/api/integrations/desk/configurations',require(_0xe032('0x93')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x94'),require(_0xe032('0x95')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x96'),require(_0xe032('0x97')));_0x2f44f6['use'](_0xe032('0x98'),require(_0xe032('0x99')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x9a'),require(_0xe032('0x9b')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x9c'),require(_0xe032('0x9d')));_0x2f44f6[_0xe032('0x6')]('/api/integrations/zendesk/configurations',require(_0xe032('0x9e')));_0x2f44f6[_0xe032('0x6')](_0xe032('0x9f'),require('./api/intZendeskField'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xa0'),require('./api/intFreshdeskAccount'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xa1'),require(_0xe032('0xa2')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xa3'),require(_0xe032('0xa4')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xa5'),require(_0xe032('0xa6')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xa7'),require('./api/intVtigerConfiguration'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xa8'),require(_0xe032('0xa9')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xaa'),require('./api/intServicenowAccount'));_0x2f44f6[_0xe032('0x6')]('/api/integrations/servicenow/configurations',require(_0xe032('0xab')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xac'),require(_0xe032('0xad')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xae'),require(_0xe032('0xaf')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xb0'),require('./api/intDynamics365Configuration'));_0x2f44f6['use']('/api/integrations/dynamics365/fields',require(_0xe032('0xb1')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xb2'),require(_0xe032('0xb3')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xb4'),require('./api/intFreshsalesConfiguration'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xb5'),require(_0xe032('0xb6')));_0x2f44f6['use'](_0xe032('0xb7'),require('./api/network'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xb8'),require('./api/chatQueueReport'));_0x2f44f6['use']('/api/chat/internal/messages',require(_0xe032('0xb9')));_0x2f44f6['use']('/api/jscripty/answers/reports',require(_0xe032('0xba')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xbb'),require('./api/jscriptyQuestionReport'));_0x2f44f6[_0xe032('0x6')]('/api/jscripty/sessions/reports',require(_0xe032('0xbc')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xbd'),require(_0xe032('0xbe')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xbf'),require(_0xe032('0xc0')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xc1'),require(_0xe032('0xc2')));_0x2f44f6[_0xe032('0x6')]('/api/jscripty/projects',require(_0xe032('0xc3')));_0x2f44f6[_0xe032('0x6')]('/api/settings',require('./api/setting'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xc4'),require(_0xe032('0xc5')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xc6'),require(_0xe032('0xc7')));_0x2f44f6['use'](_0xe032('0xc8'),require(_0xe032('0xc9')));_0x2f44f6['use'](_0xe032('0xca'),require(_0xe032('0xcb')));_0x2f44f6[_0xe032('0x6')]('/api/teams',require(_0xe032('0xcc')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xcd'),require('./api/license'));_0x2f44f6['use'](_0xe032('0xce'),require('./api/campaign'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xcf'),require(_0xe032('0xd0')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xd1'),require(_0xe032('0xd2')));_0x2f44f6['use'](_0xe032('0xd3'),require(_0xe032('0xd4')));_0x2f44f6[_0xe032('0x6')]('/api/mail/reports/transfer',require(_0xe032('0xd5')));_0x2f44f6['use'](_0xe032('0xd6'),require('./api/chatTransferReport'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xd7'),require(_0xe032('0xd8')));_0x2f44f6['use'](_0xe032('0xd9'),require(_0xe032('0xda')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xdb'),require(_0xe032('0xdc')));_0x2f44f6[_0xe032('0x6')]('/api/cm/lists',require(_0xe032('0xdd')));_0x2f44f6[_0xe032('0x6')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xde'),require(_0xe032('0xdf')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xe0'),require('./api/userProfileSection'));_0x2f44f6[_0xe032('0x6')]('/api/userProfile/resources',require(_0xe032('0xe1')));_0x2f44f6['use'](_0xe032('0xe2'),require(_0xe032('0xe3')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xe4'),require(_0xe032('0xe5')));_0x2f44f6[_0xe032('0x6')]('/api/whatsapp/applications',require(_0xe032('0xe6')));_0x2f44f6['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xe7'),require('./api/whatsappMessage'));_0x2f44f6[_0xe032('0x6')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xe8'),require('./api/whatsappTransferReport'));_0x2f44f6['use'](_0xe032('0xe9'),require(_0xe032('0xea')));_0x2f44f6['use'](_0xe032('0xeb'),require(_0xe032('0xec')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xed'),require('./api/realtime'));_0x2f44f6[_0xe032('0x6')]('/api/user-settings',require(_0xe032('0xee')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xef'),require('./api/authLocal'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xf0'),require('./api/authGoogle'));_0x2f44f6[_0xe032('0x6')](_0xe032('0xf1'),require(_0xe032('0xf2')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xf3'),require(_0xe032('0xf4')));_0x2f44f6['use'](_0xe032('0xf5'),require(_0xe032('0xf6')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xf7'),require(_0xe032('0xf8')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xf9'),require(_0xe032('0xfa')));_0x2f44f6[_0xe032('0x6')](_0xe032('0xfb'),require(_0xe032('0xfc')));_0x2f44f6['use'](_0xe032('0xfd'),require('./api/webbar'));_0x2f44f6[_0xe032('0x6')]('/api/logs',clientSideLogs);_0x2f44f6[_0xe032('0x6')](_0xe032('0xfe'),express['static'](path[_0xe032('0xff')](config['root'],'/apidoc')));_0x2f44f6['use'](_0xe032('0x100'),express[_0xe032('0x101')](path[_0xe032('0xff')](config['root'],_0xe032('0x100'))));_0x2f44f6[_0xe032('0x6')](_0xe032('0x102'),express['static'](path[_0xe032('0xff')](config['root'],_0xe032('0x102'))));_0x2f44f6[_0xe032('0x6')](_0xe032('0x103'),express[_0xe032('0x101')](path[_0xe032('0xff')](config[_0xe032('0x104')],_0xe032('0x105'),_0xe032('0x106'))));_0x2f44f6[_0xe032('0x6')](_0xe032('0x107'),express['static'](path['join'](config[_0xe032('0x104')],_0xe032('0x108'))));_0x2f44f6[_0xe032('0x109')](_0xe032('0x10a'))['get'](errors[0x194]);_0x2f44f6[_0xe032('0x109')]('/*')[_0xe032('0x10b')](function(_0x4502ea,_0xb5e19d){_0xb5e19d['sendFile'](path[_0xe032('0x10c')](_0x2f44f6[_0xe032('0x10b')](_0xe032('0x10d'))+_0xe032('0x10e')));});return _0x2f44f6;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 39784a3..5bbea8e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45e9=['../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','../config/triggers','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x45e9,0x120));var _0x945e=function(_0x3dd974,_0x4ee28b){_0x3dd974=_0x3dd974-0x0;var _0x54cdd5=_0x45e9[_0x3dd974];return _0x54cdd5;};'use strict';var jayson=require(_0x945e('0x0'));var _=require(_0x945e('0x1'));var config=require('../config/environment');exports[_0x945e('0x2')]=function(){return new Promise(function(_0x2d2569,_0xde47cb){var _0x5a2bff={};_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/user/user.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x4')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x5')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/voiceRecording/voiceRecording.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x6')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x7')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x8')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x9')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0xa')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0xb')));_0x5a2bff=_['merge'](_0x5a2bff,require(_0x945e('0xc')));_0x5a2bff=_['merge'](_0x5a2bff,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0xd')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0xe')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/mailQueue/mailQueue.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/mailInteraction/mailInteraction.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0xf')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x10')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x11')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x12')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x13')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x14')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/faxMessage/faxMessage.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x15')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5a2bff=_['merge'](_0x5a2bff,require(_0x945e('0x16')));_0x5a2bff=_['merge'](_0x5a2bff,require(_0x945e('0x17')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x18')));_0x5a2bff=_['merge'](_0x5a2bff,require(_0x945e('0x19')));_0x5a2bff=_['merge'](_0x5a2bff,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x1a')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5a2bff=_['merge'](_0x5a2bff,require(_0x945e('0x1b')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x1c')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x1d')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x1e')));_0x5a2bff=_['merge'](_0x5a2bff,require(_0x945e('0x1f')));_0x5a2bff=_['merge'](_0x5a2bff,require('../api/cmHopper/cmHopper.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x20')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x21')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x22')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x23')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/interval/interval.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x24')));_0x5a2bff=_['merge'](_0x5a2bff,require(_0x945e('0x25')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x26')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x27')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x28')));_0x5a2bff=_['merge'](_0x5a2bff,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x29')));_0x5a2bff=_['merge'](_0x5a2bff,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x2a')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x2b')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x2c')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x2d')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x2e')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x2f')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x30')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x31')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x32')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x33')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x34')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x35')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x36')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/squareRecording/squareRecording.rpc'));_0x5a2bff=_['merge'](_0x5a2bff,require('../api/squareMessage/squareMessage.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/campaign/campaign.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x37')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/plugin/plugin.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x38')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require(_0x945e('0x39')));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5a2bff=_[_0x945e('0x3')](_0x5a2bff,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5a2bff=_['merge'](_0x5a2bff,require(_0x945e('0x3a')));var _0x2ff146=jayson[_0x945e('0x3b')](_0x5a2bff)[_0x945e('0x3c')]();var _0x54cf6a=config[_0x945e('0x3d')]['port']||config['port']+0x1;var _0x36cc40=config[_0x945e('0x3d')]['ip']||_0x945e('0x3e');_0x2ff146['on'](_0x945e('0x3f'),function(_0x4a5008){return _0xde47cb(_0x4a5008);});_0x2ff146['listen'](_0x54cf6a,_0x36cc40,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x36cc40,_0x54cf6a);require(_0x945e('0x40'))['default']();return _0x2d2569('RPC\x20listening\x20on\x20'+_0x36cc40+':'+_0x54cf6a);});});}; \ No newline at end of file +var _0x88d9=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.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','../api/smsQueue/smsQueue.rpc'];(function(_0x454e63,_0x3ee597){var _0x3ce584=function(_0x3353f6){while(--_0x3353f6){_0x454e63['push'](_0x454e63['shift']());}};_0x3ce584(++_0x3ee597);}(_0x88d9,0x1de));var _0x988d=function(_0x23aeae,_0x5e8d6d){_0x23aeae=_0x23aeae-0x0;var _0x324dbd=_0x88d9[_0x23aeae];return _0x324dbd;};'use strict';var jayson=require('jayson/promise');var _=require(_0x988d('0x0'));var config=require(_0x988d('0x1'));exports[_0x988d('0x2')]=function(){return new Promise(function(_0x2bd8b4,_0xa30721){var _0x359a8d={};_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x3')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x5')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x6')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/voiceRecording/voiceRecording.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x7')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x8')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x9')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0xa')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0xb')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0xc')));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0xd')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0xe')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0xf')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x10')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x11')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/mailMessage/mailMessage.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/mailApplication/mailApplication.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x12')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/faxAccount/faxAccount.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x13')));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x14')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/faxMessage/faxMessage.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x15')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x16')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x17')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x18')));_0x359a8d=_['merge'](_0x359a8d,require('../api/smsMessage/smsMessage.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x19')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x1a')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x1b')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x1c')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/chatInteraction/chatInteraction.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x1d')));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x1e')));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x1f')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/cmHopper/cmHopper.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x20')));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x21')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x22')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x23')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/interval/interval.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/pause/pause.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x24')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x25')));_0x359a8d=_['merge'](_0x359a8d,require('../api/trigger/trigger.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x26')));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x27')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x28')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x29')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x2a')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x2b')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x2c')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x2d')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/setting/setting.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x2e')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x2f')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x30')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/squareMessage/squareMessage.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x31')));_0x359a8d=_['merge'](_0x359a8d,require(_0x988d('0x32')));_0x359a8d=_['merge'](_0x359a8d,require('../api/plugin/plugin.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x33')));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x34')));_0x359a8d=_['merge'](_0x359a8d,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x359a8d=_[_0x988d('0x4')](_0x359a8d,require(_0x988d('0x35')));var _0x5b54e6=jayson[_0x988d('0x36')](_0x359a8d)[_0x988d('0x37')]();var _0x5f4e0e=config['rpc'][_0x988d('0x38')]||config[_0x988d('0x38')]+0x1;var _0x1f5aa9=config[_0x988d('0x39')]['ip']||'localhost';_0x5b54e6['on']('error',function(_0x12dadf){return _0xa30721(_0x12dadf);});_0x5b54e6[_0x988d('0x2')](_0x5f4e0e,_0x1f5aa9,function(){console[_0x988d('0x3a')](_0x988d('0x3b'),_0x1f5aa9,_0x5f4e0e);require(_0x988d('0x3c'))[_0x988d('0x3d')]();return _0x2bd8b4(_0x988d('0x3e')+_0x1f5aa9+':'+_0x5f4e0e);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 832a82b..453e048 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 _0x3de9=['SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','exec','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','events','EventEmitter','./error','call','setEncoding','utf8','headers','emit','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','getData','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','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits'];(function(_0xf00a96,_0x429578){var _0x33b9d8=function(_0x4c3a12){while(--_0x4c3a12){_0xf00a96['push'](_0xf00a96['shift']());}};_0x33b9d8(++_0x429578);}(_0x3de9,0x1b9));var _0x93de=function(_0x3a1880,_0x465dc1){_0x3a1880=_0x3a1880-0x0;var _0x448f25=_0x3de9[_0x3a1880];return _0x448f25;};'use strict';var util=require(_0x93de('0x0'));var _=require('lodash');var EventEmitter=require(_0x93de('0x1'))[_0x93de('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x93de('0x3'));function AGIChannel(_0x1d0b0b){var _0x23ace3=this,_0x371fd8=new AGIReply(),_0x2ca00c=![],_0x6fced3={};EventEmitter[_0x93de('0x4')](_0x23ace3);_0x1d0b0b[_0x93de('0x5')](_0x93de('0x6'));_0x1d0b0b['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x371fd8[_0x93de('0x5')](_0x93de('0x6'));_0x371fd8['on'](_0x93de('0x7'),function(_0x273a3d){for(var _0x1aef25 in _0x273a3d){_0x23ace3[_0x1aef25]=_0x273a3d[_0x1aef25];}_0x23ace3[_0x93de('0x8')]('ready');});_0x371fd8['on']('line',function(_0x2b1710){if(_0x2b1710['toLowerCase']()==_0x93de('0x9')){_0x23ace3[_0x93de('0x8')](_0x93de('0x9'));return;}if(_0x2b1710[_0x93de('0xa')](0x0,0xb)==_0x93de('0xb')){_0x2ca00c=!![];}if(_0x2ca00c){_0x6fced3['rx']+=_0x2b1710+'\x0a';if(_0x2b1710[_0x93de('0xc')](_0x93de('0xd'))!=-0x1){_0x2ca00c=![];}}else{_0x6fced3['rx']=_0x2b1710;}if(_0x2ca00c){return;}if(typeof _0x6fced3['cb']==_0x93de('0xe')){var _0x273a50=_0x6fced3['rx'][_0x93de('0xa')](0x0,0x3),_0x1bd74c=null,_0x24a1fe=null;_0x273a50=parseInt(_0x273a50);if(isNaN(_0x273a50)){_0x6fced3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x93de('0xf')});return;}if(_0x273a50!=0xc8){_0x6fced3['cb'](null,{'code':_0x273a50,'result':-0x1,'extra':'KO'});return;}_0x1bd74c=_0x6fced3['rx'][_0x93de('0xa')](0x4)[_0x93de('0x10')](_0x93de('0x11'),'');if(_0x1bd74c[_0x93de('0x12')]('\x20')!=-0x1){_0x1bd74c=_0x1bd74c['substr'](0x0,_0x1bd74c['indexOf']('\x20'));}if(_[_0x93de('0x13')](_0x1bd74c,'-1')){_0x1bd74c=parseInt(_0x1bd74c);}_0x24a1fe=_0x6fced3['rx']['split']('\x20');if(_0x24a1fe[_0x93de('0x14')]==0x3){_0x24a1fe=_0x24a1fe[0x2][_0x93de('0xa')](0x1,_0x24a1fe[0x2][_0x93de('0x14')]-0x1);}else if(_0x24a1fe['length']>0x3){var _0x2ddb7c=/\((.+)\)/;var _0x30b95c=_0x6fced3['rx'][_0x93de('0x15')](_0x2ddb7c);if(_0x30b95c){_0x24a1fe=_0x30b95c[0x1];}else{_0x24a1fe=null;}}else{_0x24a1fe=null;}_0x6fced3['cb'](null,{'code':_0x273a50,'result':_0x1bd74c,'extra':_0x24a1fe});}});_0x1d0b0b['on']('error',function(_0x3c9c19){_0x23ace3[_0x93de('0x8')](_0x93de('0x16'),new AGIError(_0x93de('0x17'),_0x3c9c19['code']));});_0x1d0b0b['on'](_0x93de('0x18'),function(){_0x23ace3[_0x93de('0x8')](_0x93de('0x18'),new AGIError(_0x93de('0x19')));});_0x1d0b0b['on'](_0x93de('0x1a'),function(){_0x23ace3['emit'](_0x93de('0x1a'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1d0b0b[_0x93de('0x1b')]();});_0x1d0b0b[_0x93de('0x1c')](_0x371fd8);this[_0x93de('0x1d')]=function(_0x1ca228,_0x13b5ea){var _0x1ca228=_0x1ca228||'',_0x13b5ea=typeof _0x13b5ea==_0x93de('0xe')?_0x13b5ea:new Function();_0x6fced3={'tx':_0x1ca228,'rx':'','cb':_0x13b5ea};_0x1d0b0b['write'](_0x1ca228+'\x0a');},this['close']=function(){_0x1d0b0b[_0x93de('0x1b')]();};}util[_0x93de('0x1e')](AGIChannel,EventEmitter);AGIChannel[_0x93de('0x1f')][_0x93de('0x20')]=function(_0x5bfa01){return this[_0x93de('0x1d')][_0x93de('0x21')](this,_0x5bfa01);};AGIChannel[_0x93de('0x1f')][_0x93de('0x22')]=function(){return this[_0x93de('0x20')]('ANSWER');};AGIChannel[_0x93de('0x1f')][_0x93de('0x23')]=function(_0x419b73,_0x56a448,_0x1b8ed8){_0x419b73=_0x419b73===undefined?'beep':_0x419b73;_0x56a448=_0x56a448===undefined?'5':_0x56a448;_0x1b8ed8=_0x1b8ed8===undefined?'1':_0x1b8ed8;return this[_0x93de('0x20')](util[_0x93de('0x24')](_0x93de('0x25'),_0x419b73,_0x56a448*0x3e8,_0x1b8ed8));};AGIChannel['prototype'][_0x93de('0x26')]=function(_0x4ad831){_0x4ad831=_0x4ad831||'NO\x20MESSAGE';return this[_0x93de('0x20')](util[_0x93de('0x24')](_0x93de('0x27'),_0x4ad831));};AGIChannel[_0x93de('0x1f')]['exec']=function(_0xd1bfc0,_0x530f69){if(_[_0x93de('0x28')](_0x530f69)){return this[_0x93de('0x20')](util[_0x93de('0x24')](_0x93de('0x29'),_0xd1bfc0,_0x530f69[_0x93de('0x2a')](',')));}return this[_0x93de('0x20')](util[_0x93de('0x24')]('EXEC\x20%s\x20%s',_0xd1bfc0,_0x530f69));};AGIChannel['prototype'][_0x93de('0x2b')]=function(_0x18936b){return this[_0x93de('0x20')](util['format'](_0x93de('0x2c'),_0x18936b));};AGIChannel[_0x93de('0x1f')][_0x93de('0x2d')]=function(_0x5b2ee9){return this[_0x93de('0x20')](util[_0x93de('0x24')](_0x93de('0x2e'),_0x5b2ee9));};AGIChannel['prototype'][_0x93de('0x2f')]=function(_0x1dc5f6){return this[_0x93de('0x20')](util[_0x93de('0x24')](_0x93de('0x30'),_0x1dc5f6));};AGIChannel['prototype']['hangup']=function(){return this[_0x93de('0x20')]('HANGUP');};AGIChannel[_0x93de('0x1f')][_0x93de('0x31')]=function(_0x18e3b2,_0xce8cc5){var _0x2b252f=_[_0x93de('0x32')](_0xce8cc5)||_[_0x93de('0x33')](_0xce8cc5)?_0xce8cc5[_0x93de('0x34')]():_0xce8cc5;return this[_0x93de('0x20')](util['format'](_0x93de('0x35'),_0x18e3b2,_0x2b252f?_0x2b252f['toString']()[_0x93de('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x93de('0x36')]=function(_0x2c7f57,_0x305316){return this['sendRequest'](util[_0x93de('0x24')]('SAY\x20NUMBER\x20%s\x20%s',_0x2c7f57,_0x305316));};AGIChannel[_0x93de('0x1f')][_0x93de('0x37')]=function(_0x26971c,_0x4a38d5){return this[_0x93de('0x20')](util[_0x93de('0x24')](_0x93de('0x38'),_0x26971c,_0x4a38d5));};AGIChannel[_0x93de('0x1f')][_0x93de('0x39')]=function(_0x13e279,_0x304f35){return this[_0x93de('0x20')](util[_0x93de('0x24')](_0x93de('0x3a'),_0x13e279,_0x304f35));};AGIChannel['prototype'][_0x93de('0x3b')]=function(_0x51d8a8,_0x53a62d,_0x1de262){_0x53a62d=_0x53a62d||this[_0x93de('0x3c')];_0x1de262=_0x1de262||0x1;this['setContext'](_0x51d8a8);this[_0x93de('0x2d')](_0x53a62d);this[_0x93de('0x2f')](_0x1de262);return this[_0x93de('0x26')](util[_0x93de('0x24')](_0x93de('0x3d'),_0x51d8a8,_0x53a62d,_0x1de262));};AGIChannel['prototype'][_0x93de('0x3e')]=function(_0x3ffebb){return this[_0x93de('0x20')](util[_0x93de('0x24')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3ffebb));};AGIChannel['prototype'][_0x93de('0x3f')]=function(_0x4d396a,_0x41a781,_0xbc863f,_0x203aa8,_0x3dfbe3,_0x25e80e){_0x41a781=_0x41a781||_0x93de('0x40');_0xbc863f=_0xbc863f||'';_0x203aa8=_0x203aa8===undefined?-0x1:_0x203aa8==='-1'?-0x1:_0x203aa8*0x3e8;_0x3dfbe3=_0x3dfbe3===undefined?'':'s='+_0x3dfbe3;_0x25e80e=_0x25e80e?'BEEP':'';return this[_0x93de('0x20')](util[_0x93de('0x24')](_0x93de('0x41'),_0x4d396a,_0x41a781,_0xbc863f,_0x203aa8,_0x25e80e,_0x3dfbe3));};AGIChannel[_0x93de('0x1f')]['streamFile']=function(_0x157ad5,_0x2f1e21){_0x2f1e21=_0x2f1e21||'';return this[_0x93de('0x20')](util[_0x93de('0x24')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x157ad5,_0x2f1e21));};AGIChannel[_0x93de('0x1f')]['agi']=function(_0x1b9b35){return this[_0x93de('0x42')]('AGI',_0x1b9b35);};AGIChannel[_0x93de('0x1f')][_0x93de('0x43')]=function(_0x19d432){return this['exec'](_0x93de('0x44'),_0x19d432);};AGIChannel[_0x93de('0x1f')][_0x93de('0x16')]=function(_0x5916a6,_0x2424e7){this[_0x93de('0x26')](util[_0x93de('0x24')](_0x93de('0x45'),_0x5916a6['id'],_0x5916a6[_0x93de('0x46')],_0x2424e7));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xf759=['SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','setEncoding','setTimeout','utf8','headers','emit','ready','line','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','sendRequest','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority'];(function(_0x520db4,_0x5ece93){var _0x21cccd=function(_0x53caac){while(--_0x53caac){_0x520db4['push'](_0x520db4['shift']());}};_0x21cccd(++_0x5ece93);}(_0xf759,0x154));var _0x9f75=function(_0x28a425,_0x55bb85){_0x28a425=_0x28a425-0x0;var _0x3261c1=_0xf759[_0x28a425];return _0x3261c1;};'use strict';var util=require(_0x9f75('0x0'));var _=require(_0x9f75('0x1'));var EventEmitter=require(_0x9f75('0x2'))[_0x9f75('0x3')];var AGIReply=require(_0x9f75('0x4'));var AGIError=require(_0x9f75('0x5'));function AGIChannel(_0x11c2c8){var _0xf22315=this,_0x3692df=new AGIReply(),_0x2a5404=![],_0x2fb1b0={};EventEmitter['call'](_0xf22315);_0x11c2c8[_0x9f75('0x6')]('utf8');_0x11c2c8[_0x9f75('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3692df['setEncoding'](_0x9f75('0x8'));_0x3692df['on'](_0x9f75('0x9'),function(_0x23c317){for(var _0x4dad03 in _0x23c317){_0xf22315[_0x4dad03]=_0x23c317[_0x4dad03];}_0xf22315[_0x9f75('0xa')](_0x9f75('0xb'));});_0x3692df['on'](_0x9f75('0xc'),function(_0x5c3ea4){if(_0x5c3ea4['toLowerCase']()=='hangup'){_0xf22315[_0x9f75('0xa')]('hangup');return;}if(_0x5c3ea4[_0x9f75('0xd')](0x0,0xb)==_0x9f75('0xe')){_0x2a5404=!![];}if(_0x2a5404){_0x2fb1b0['rx']+=_0x5c3ea4+'\x0a';if(_0x5c3ea4[_0x9f75('0xf')](_0x9f75('0x10'))!=-0x1){_0x2a5404=![];}}else{_0x2fb1b0['rx']=_0x5c3ea4;}if(_0x2a5404){return;}if(typeof _0x2fb1b0['cb']==_0x9f75('0x11')){var _0x166394=_0x2fb1b0['rx'][_0x9f75('0xd')](0x0,0x3),_0x5a1331=null,_0x4777df=null;_0x166394=parseInt(_0x166394);if(isNaN(_0x166394)){_0x2fb1b0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9f75('0x12')});return;}if(_0x166394!=0xc8){_0x2fb1b0['cb'](null,{'code':_0x166394,'result':-0x1,'extra':'KO'});return;}_0x5a1331=_0x2fb1b0['rx'][_0x9f75('0xd')](0x4)[_0x9f75('0x13')]('result=','');if(_0x5a1331[_0x9f75('0x14')]('\x20')!=-0x1){_0x5a1331=_0x5a1331[_0x9f75('0x15')](0x0,_0x5a1331[_0x9f75('0x14')]('\x20'));}if(_[_0x9f75('0x16')](_0x5a1331,'-1')){_0x5a1331=parseInt(_0x5a1331);}_0x4777df=_0x2fb1b0['rx'][_0x9f75('0x17')]('\x20');if(_0x4777df[_0x9f75('0x18')]==0x3){_0x4777df=_0x4777df[0x2]['substring'](0x1,_0x4777df[0x2][_0x9f75('0x18')]-0x1);}else if(_0x4777df[_0x9f75('0x18')]>0x3){var _0x28c6fc=/\((.+)\)/;var _0x23aeb5=_0x2fb1b0['rx']['match'](_0x28c6fc);if(_0x23aeb5){_0x4777df=_0x23aeb5[0x1];}else{_0x4777df=null;}}else{_0x4777df=null;}_0x2fb1b0['cb'](null,{'code':_0x166394,'result':_0x5a1331,'extra':_0x4777df});}});_0x11c2c8['on']('error',function(_0xefae9c){_0xf22315[_0x9f75('0xa')](_0x9f75('0x19'),new AGIError(_0x9f75('0x1a'),_0xefae9c[_0x9f75('0x1b')]));});_0x11c2c8['on']('close',function(){_0xf22315[_0x9f75('0xa')](_0x9f75('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x11c2c8['on'](_0x9f75('0x1d'),function(){_0xf22315[_0x9f75('0xa')](_0x9f75('0x1d'),new AGIError(_0x9f75('0x1e')));_0x11c2c8[_0x9f75('0x1f')]();});_0x11c2c8[_0x9f75('0x20')](_0x3692df);this[_0x9f75('0x21')]=function(_0x31d5a7,_0x1542fa){var _0x31d5a7=_0x31d5a7||'',_0x1542fa=typeof _0x1542fa=='function'?_0x1542fa:new Function();_0x2fb1b0={'tx':_0x31d5a7,'rx':'','cb':_0x1542fa};_0x11c2c8['write'](_0x31d5a7+'\x0a');},this[_0x9f75('0x1c')]=function(){_0x11c2c8[_0x9f75('0x1f')]();};}util[_0x9f75('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x9f75('0x23')]['sendRequest']=function(_0x312cf4){return this[_0x9f75('0x21')]['sync'](this,_0x312cf4);};AGIChannel[_0x9f75('0x23')]['answer']=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9f75('0x23')][_0x9f75('0x24')]=function(_0x28a4c8,_0x32cd7e,_0x566c0b){_0x28a4c8=_0x28a4c8===undefined?_0x9f75('0x25'):_0x28a4c8;_0x32cd7e=_0x32cd7e===undefined?'5':_0x32cd7e;_0x566c0b=_0x566c0b===undefined?'1':_0x566c0b;return this['sendRequest'](util[_0x9f75('0x26')](_0x9f75('0x27'),_0x28a4c8,_0x32cd7e*0x3e8,_0x566c0b));};AGIChannel[_0x9f75('0x23')][_0x9f75('0x28')]=function(_0x200f57){_0x200f57=_0x200f57||'NO\x20MESSAGE';return this['sendRequest'](util[_0x9f75('0x26')](_0x9f75('0x29'),_0x200f57));};AGIChannel[_0x9f75('0x23')][_0x9f75('0x2a')]=function(_0x36ee1b,_0x2fabdd){if(_[_0x9f75('0x2b')](_0x2fabdd)){return this[_0x9f75('0x2c')](util[_0x9f75('0x26')]('EXEC\x20%s\x20%s',_0x36ee1b,_0x2fabdd['join'](',')));}return this[_0x9f75('0x2c')](util[_0x9f75('0x26')](_0x9f75('0x2d'),_0x36ee1b,_0x2fabdd));};AGIChannel[_0x9f75('0x23')][_0x9f75('0x2e')]=function(_0x53d3b6){return this[_0x9f75('0x2c')](util[_0x9f75('0x26')](_0x9f75('0x2f'),_0x53d3b6));};AGIChannel[_0x9f75('0x23')]['setExtension']=function(_0x26635b){return this[_0x9f75('0x2c')](util['format'](_0x9f75('0x30'),_0x26635b));};AGIChannel['prototype'][_0x9f75('0x31')]=function(_0x10ae2e){return this[_0x9f75('0x2c')](util[_0x9f75('0x26')](_0x9f75('0x32'),_0x10ae2e));};AGIChannel['prototype']['hangup']=function(){return this[_0x9f75('0x2c')](_0x9f75('0x33'));};AGIChannel[_0x9f75('0x23')][_0x9f75('0x34')]=function(_0x434543,_0x6a210c){var _0x2a0643=_[_0x9f75('0x35')](_0x6a210c)||_[_0x9f75('0x36')](_0x6a210c)?_0x6a210c[_0x9f75('0x37')]():_0x6a210c;return this[_0x9f75('0x2c')](util[_0x9f75('0x26')](_0x9f75('0x38'),_0x434543,_0x2a0643?_0x2a0643[_0x9f75('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x9f75('0x39')]=function(_0x166ad8,_0x19ac12){return this[_0x9f75('0x2c')](util[_0x9f75('0x26')](_0x9f75('0x3a'),_0x166ad8,_0x19ac12));};AGIChannel[_0x9f75('0x23')]['sayDigits']=function(_0x16ffa0,_0x2f9936){return this[_0x9f75('0x2c')](util[_0x9f75('0x26')](_0x9f75('0x3b'),_0x16ffa0,_0x2f9936));};AGIChannel[_0x9f75('0x23')]['sayPhonetic']=function(_0x2c92fc,_0x54ed66){return this[_0x9f75('0x2c')](util['format'](_0x9f75('0x3c'),_0x2c92fc,_0x54ed66));};AGIChannel[_0x9f75('0x23')][_0x9f75('0x3d')]=function(_0x5455e9,_0x38ace0,_0x3e1f60){_0x38ace0=_0x38ace0||this[_0x9f75('0x3e')];_0x3e1f60=_0x3e1f60||0x1;this[_0x9f75('0x2e')](_0x5455e9);this[_0x9f75('0x3f')](_0x38ace0);this[_0x9f75('0x31')](_0x3e1f60);return this[_0x9f75('0x28')](util[_0x9f75('0x26')](_0x9f75('0x40'),_0x5455e9,_0x38ace0,_0x3e1f60));};AGIChannel[_0x9f75('0x23')]['getVariable']=function(_0x22c0fc){return this[_0x9f75('0x2c')](util[_0x9f75('0x26')](_0x9f75('0x41'),_0x22c0fc));};AGIChannel[_0x9f75('0x23')][_0x9f75('0x42')]=function(_0x50ac13,_0x966537,_0x221aa7,_0x401b44,_0x186abd,_0x101438){_0x966537=_0x966537||'wav';_0x221aa7=_0x221aa7||'';_0x401b44=_0x401b44===undefined?-0x1:_0x401b44==='-1'?-0x1:_0x401b44*0x3e8;_0x186abd=_0x186abd===undefined?'':'s='+_0x186abd;_0x101438=_0x101438?_0x9f75('0x43'):'';return this[_0x9f75('0x2c')](util[_0x9f75('0x26')](_0x9f75('0x44'),_0x50ac13,_0x966537,_0x221aa7,_0x401b44,_0x101438,_0x186abd));};AGIChannel[_0x9f75('0x23')][_0x9f75('0x45')]=function(_0x748020,_0x38bc85){_0x38bc85=_0x38bc85||'';return this['sendRequest'](util[_0x9f75('0x26')](_0x9f75('0x46'),_0x748020,_0x38bc85));};AGIChannel[_0x9f75('0x23')][_0x9f75('0x47')]=function(_0xc832){return this[_0x9f75('0x2a')](_0x9f75('0x48'),_0xc832);};AGIChannel[_0x9f75('0x23')][_0x9f75('0x49')]=function(_0x54072c){return this[_0x9f75('0x2a')](_0x9f75('0x4a'),_0x54072c);};AGIChannel[_0x9f75('0x23')]['error']=function(_0x5abe38,_0x299289){this[_0x9f75('0x28')](util[_0x9f75('0x26')](_0x9f75('0x4b'),_0x5abe38['id'],_0x5abe38[_0x9f75('0x4c')],_0x299289));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9f75('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 88bb6a8..8ad16a6 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 _0xfcb8=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfcb8,0xd3));var _0x8fcb=function(_0x29d849,_0x209ceb){_0x29d849=_0x29d849-0x0;var _0x30b104=_0xfcb8[_0x29d849];return _0x30b104;};'use strict';var util=require(_0x8fcb('0x0'));var error={'E_AGI_UNDEFINED':_0x8fcb('0x1'),'E_AGI_ARGUMENT_PORT':_0x8fcb('0x2'),'E_AGI_SERVER_ERROR':_0x8fcb('0x3'),'E_AGI_SERVER_CLOSE':_0x8fcb('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x8fcb('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8fcb('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x8fcb('0x7'),'E_AGI_COMMAND_EMPTY':_0x8fcb('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8fcb('0x9'),'E_AGI_IVR_ENTRY':_0x8fcb('0xa')};function AGIError(_0x302aff){var _0x302aff=_0x302aff||null,_0x192c55=_0x192c55||[],_0x3dfe5b=0x1,_0x32c296='';if(!error[_0x302aff]){_0x302aff=_0x8fcb('0xb');}_0x192c55[_0x8fcb('0xc')](error[_0x302aff]);while(arguments[_0x3dfe5b]){_0x192c55[_0x8fcb('0xc')](arguments[_0x3dfe5b]);_0x3dfe5b++;}_0x32c296=util['format']['apply'](util,_0x192c55);this[_0x8fcb('0xd')]=_0x32c296;this['name']=_0x302aff;}module[_0x8fcb('0xe')]=AGIError; \ No newline at end of file +var _0xb4fd=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[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.','E_AGI_UNDEFINED','push','apply','name','exports'];(function(_0x1d898a,_0x52454c){var _0x2c5dc3=function(_0x4c5674){while(--_0x4c5674){_0x1d898a['push'](_0x1d898a['shift']());}};_0x2c5dc3(++_0x52454c);}(_0xb4fd,0x12c));var _0xdb4f=function(_0x8aad93,_0x485b53){_0x8aad93=_0x8aad93-0x0;var _0x10b71a=_0xb4fd[_0x8aad93];return _0x10b71a;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xdb4f('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xdb4f('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xdb4f('0x2'),'E_AGI_SOCKET_ERROR':_0xdb4f('0x3'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xdb4f('0x4'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xdb4f('0x5'),'E_AGI_IVR_ENTRY':_0xdb4f('0x6')};function AGIError(_0xb1cd16){var _0xb1cd16=_0xb1cd16||null,_0x8d1b6d=_0x8d1b6d||[],_0x30e06c=0x1,_0x3441e7='';if(!error[_0xb1cd16]){_0xb1cd16=_0xdb4f('0x7');}_0x8d1b6d[_0xdb4f('0x8')](error[_0xb1cd16]);while(arguments[_0x30e06c]){_0x8d1b6d['push'](arguments[_0x30e06c]);_0x30e06c++;}_0x3441e7=util['format'][_0xdb4f('0x9')](util,_0x8d1b6d);this['message']=_0x3441e7;this[_0xdb4f('0xa')]=_0xb1cd16;}module[_0xdb4f('0xb')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index f176ddf..3203cca 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 _0x803f=['length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info'];(function(_0x415477,_0x46331c){var _0x41ff2b=function(_0xb72b74){while(--_0xb72b74){_0x415477['push'](_0x415477['shift']());}};_0x41ff2b(++_0x46331c);}(_0x803f,0x64));var _0xf803=function(_0x37a989,_0x421ad6){_0x37a989=_0x37a989-0x0;var _0x467760=_0x803f[_0x37a989];return _0x467760;};'use strict';var _=require(_0xf803('0x0'));var logger=require('../../../config/logger')(_0xf803('0x1'));var verticesWithRetry=[_0xf803('0x2'),'getdigits',_0xf803('0x3')];var Graph=function(){this[_0xf803('0x4')]={};this[_0xf803('0x5')]={};this[_0xf803('0x6')]=0x0;};Graph[_0xf803('0x7')]['addVertex']=function(_0x2c209a){this[_0xf803('0x4')][_0x2c209a['id']]=_0x2c209a;this[_0xf803('0x5')][_0x2c209a['id']]=[];};Graph['prototype'][_0xf803('0x8')]=function(_0x47128f,_0x587319,_0x3fc5ce){this[_0xf803('0x5')][_0x47128f][_0xf803('0x9')]({'target':_0x587319,'condition':_0x3fc5ce});this['numberOfEdges']+=0x1;};Graph[_0xf803('0x7')]['size']=function(){return _[_0xf803('0xa')](this[_0xf803('0x4')]);};Graph['prototype'][_0xf803('0xb')]=function(){return this[_0xf803('0x6')];};Graph[_0xf803('0x7')][_0xf803('0xc')]=function(_0x28399a){return this['vertices'][_0x28399a];};Graph['prototype'][_0xf803('0xd')]=function(_0x2a6ed9,_0x508df0){if(!this[_0xf803('0x4')][_0x2a6ed9]){return logger['info'](_0xf803('0xe'));}var _0x29af60=_0x508df0(this[_0xf803('0x4')][_0x2a6ed9]);if(!_0x29af60){return logger[_0xf803('0xf')]('stop\x20traverse');}if(this[_0xf803('0x5')][_0x2a6ed9][_0xf803('0x10')]===0x0){return logger[_0xf803('0xf')](_0xf803('0x11'));}for(var _0x2aaef6=0x0,_0xd170bc=[],_0xbd7728=![];_0x2aaef6\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','indexOf','agi_','substring','inspect','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','context','extension','priority','response','code','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]','./server','port'];(function(_0x11ad74,_0x1edce2){var _0x56b03f=function(_0x474f72){while(--_0x474f72){_0x11ad74['push'](_0x11ad74['shift']());}};_0x56b03f(++_0x1edce2);}(_0xc1f9,0x115));var _0x9c1f=function(_0x35ff42,_0x3aacf4){_0x35ff42=_0x35ff42-0x0;var _0x176c29=_0xc1f9[_0x35ff42];return _0x176c29;};'use strict';var parser=require(_0x9c1f('0x0'));var _=require(_0x9c1f('0x1'));var syncho=require(_0x9c1f('0x2'));var util=require(_0x9c1f('0x3'));var moment=require(_0x9c1f('0x4'));var config=require(_0x9c1f('0x5'));var logger=require(_0x9c1f('0x6'))(_0x9c1f('0x7'));var utilLicense=require('../../config/license/util');var rpc=require(_0x9c1f('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x9c1f('0x9'));var Vertices=require(_0x9c1f('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x9c1f('0x7')]=_[_0x9c1f('0xb')](config[_0x9c1f('0x7')],{'ip':_0x9c1f('0xc'),'port':0x11dd});function connectionHandler(_0x5e1e0e){process[_0x9c1f('0xd')](function(){syncho(function(){try{setChannelVariables(_0x5e1e0e);agiHandler(_0x5e1e0e);}catch(_0x19b86a){logger['error'](_0x19b86a[_0x9c1f('0xe')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9c1f('0x7')]['port']);logger[_0x9c1f('0xf')](util[_0x9c1f('0x10')](_0x9c1f('0x11'),config[_0x9c1f('0x7')]['ip'],config[_0x9c1f('0x7')]['port']));}function errorHandler(_0x14eab6){if(_0x14eab6&&_0x14eab6[_0x9c1f('0x12')]&&_0x14eab6[_0x9c1f('0x13')]){logger[_0x9c1f('0x14')](util[_0x9c1f('0x10')](_0x9c1f('0x15'),_0x14eab6[_0x9c1f('0x12')],_0x14eab6[_0x9c1f('0x13')]));}else{logger[_0x9c1f('0x14')](util[_0x9c1f('0x10')](_0x9c1f('0x16'),_0x14eab6[_0x9c1f('0xe')]));}}function closeHandler(){logger['info'](util[_0x9c1f('0x10')](_0x9c1f('0x17'),this[_0x9c1f('0x18')],this[_0x9c1f('0x19')],this[_0x9c1f('0x1a')],this['dnid'],this[_0x9c1f('0x1b')]));try{createSquareReport(this);}catch(_0x488088){logger['error'](_0x488088['stack']);}}function timeoutHandler(){logger[_0x9c1f('0xf')](util[_0x9c1f('0x10')](_0x9c1f('0x1c'),this['arg_1'],this[_0x9c1f('0x19')],this[_0x9c1f('0x1a')],this[_0x9c1f('0x1d')],this[_0x9c1f('0x1b')]));}function hangupHandler(){logger[_0x9c1f('0xf')](util['format'](_0x9c1f('0x1e'),this[_0x9c1f('0x18')],this[_0x9c1f('0x19')],this[_0x9c1f('0x1a')],this['dnid'],this[_0x9c1f('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x40b2af){return parser['toJson'](_0x40b2af,{'object':!![]})[_0x9c1f('0x1f')][_0x9c1f('0x20')];}function addVertex(_0xb9d73f,_0x57301a,_0x589da1){_0x57301a[_0x9c1f('0x21')]=_0x589da1;if(_0x57301a[_0x9c1f('0x22')](_0x9c1f('0x23'))){_0x57301a[_0x9c1f('0x24')]=parseInt(_0x57301a[_0x9c1f('0x23')],0xa);}_0xb9d73f[_0x9c1f('0x25')](_[_0x9c1f('0x26')](_0x57301a,_0x9c1f('0x27')));}function initGraph(_0x69533c,_0x43dbe1){var _0xe6fd4d=new Graph();for(var _0x9aa87 in _0x69533c){if(_0x69533c[_0x9c1f('0x22')](_0x9aa87)){if(_[_0x9c1f('0x28')](_0x69533c[_0x9aa87])){for(var _0x23a132=0x0;_0x23a132<_0x69533c[_0x9aa87]['length'];_0x23a132+=0x1){addVertex(_0xe6fd4d,_0x69533c[_0x9aa87][_0x23a132],_0x9aa87);}}else{addVertex(_0xe6fd4d,_0x69533c[_0x9aa87],_0x9aa87);}}}for(var _0x2e16ba=0x0;_0x2e16ba<_0x43dbe1[_0x9c1f('0x29')];_0x2e16ba+=0x1){if(_0x43dbe1[_0x2e16ba][_0x9c1f('0x2a')]&&_0x43dbe1[_0x2e16ba][_0x9c1f('0x2b')]){_0xe6fd4d[_0x9c1f('0x2c')](_0x43dbe1[_0x2e16ba][_0x9c1f('0x2a')],_0x43dbe1[_0x2e16ba][_0x9c1f('0x2b')],_0x43dbe1[_0x2e16ba][_0x9c1f('0x2d')]);}}return _0xe6fd4d;}function getSquareProject(_0x1c8641,_0x1c463a){rpc[_0x9c1f('0x2e')](_0x1c8641)['then'](function(_0x33fa72){_0x1c463a(null,_0x33fa72);})[_0x9c1f('0x2f')](function(_0x4697e6){_0x1c463a(null,_0x4697e6);});}function createSquareReport(_0x3a3ff1,_0x3146ab){rpc[_0x9c1f('0x30')](_0x3a3ff1)[_0x9c1f('0x31')](function(_0x216d0c){if(_0x3146ab){_0x3146ab(null,_0x216d0c);}})[_0x9c1f('0x2f')](function(_0x5b2d94){if(_0x3146ab){_0x3146ab(null,_0x5b2d94);}});}function setChannelVariables(_0x314de0){for(var _0x5f5d67 in _0x314de0){if(_0x314de0['hasOwnProperty'](_0x5f5d67)){if(_0x5f5d67[_0x9c1f('0x32')](_0x9c1f('0x33'))===0x0){_0x314de0[_0x5f5d67[_0x9c1f('0x34')](0x4)]=_0x314de0[_0x5f5d67];delete _0x314de0[_0x5f5d67];}}}}function getLogFromObject(_0x436e8e){return util[_0x9c1f('0x35')](_0x436e8e,{'showHidden':![],'depth':null});}function agiHandler(_0x18f7f9){var _0x182349,_0x4cce4c,_0x1f489d,_0x217aef,_0x5f3648;logger['debug'](_0x9c1f('0x36'),JSON['stringify'](_0x18f7f9,null,0x2));logger[_0x9c1f('0xf')](util[_0x9c1f('0x10')](_0x9c1f('0x37'),_0x18f7f9[_0x9c1f('0x18')],_0x18f7f9[_0x9c1f('0x19')],_0x18f7f9[_0x9c1f('0x1a')],_0x18f7f9[_0x9c1f('0x1d')],_0x18f7f9[_0x9c1f('0x1b')]));_0x18f7f9['on'](_0x9c1f('0x14'),errorHandler);_0x18f7f9['on'](_0x9c1f('0x38'),closeHandler);_0x18f7f9['on']('timeout',timeoutHandler);_0x18f7f9[_0x9c1f('0x39')]=![];_0x18f7f9['on']('hangup',hangupHandler);var _0x4c3f69=getSquareProject['sync'](null,_0x18f7f9['arg_1']);if(_0x4c3f69){if(_0x4c3f69[_0x9c1f('0x3a')]){_0x182349=getRoot(_0x4c3f69[_0x9c1f('0x3a')]);if(_0x182349&&_0x182349[_0x9c1f('0x3b')]){logger[_0x9c1f('0x3c')](_0x9c1f('0x20'),JSON[_0x9c1f('0x3d')](_0x182349,null,0x2));_0x18f7f9[_0x9c1f('0x3e')]=moment()['format'](_0x9c1f('0x3f'));_0x4cce4c=initGraph(_[_0x9c1f('0x26')](_0x182349,_0x9c1f('0x27')),_0x182349['mxCell']);_0x1f489d=new Vertices(_0x18f7f9,rpc,mailRpc);logger['info'](util[_0x9c1f('0x10')](_0x9c1f('0x40'),_0x18f7f9[_0x9c1f('0x18')],_0x18f7f9[_0x9c1f('0x19')],_0x18f7f9['callerid'],_0x18f7f9[_0x9c1f('0x1d')],_0x18f7f9[_0x9c1f('0x1b')]));_0x4cce4c[_0x9c1f('0x41')](_0x182349[_0x9c1f('0x3b')]['id'],function(_0x17a10d){try{_0x17a10d=_0x1f489d[_0x9c1f('0x42')](_0x17a10d);logger[_0x9c1f('0x3c')](_0x9c1f('0x43'),JSON[_0x9c1f('0x3d')](_0x17a10d,null,0x2));if(_0x17a10d[_0x9c1f('0x21')]===_0x9c1f('0x44')){logger[_0x9c1f('0xf')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x18f7f9[_0x9c1f('0x45')]=_0x17a10d[_0x9c1f('0x45')]||_0x18f7f9['context'];_0x18f7f9['extension']=_0x17a10d[_0x9c1f('0x46')];_0x18f7f9[_0x9c1f('0x47')]=_0x17a10d[_0x9c1f('0x47')]?_0x17a10d[_0x9c1f('0x47')]-0x1:0x1;return null;}else if(_0x17a10d&&_0x1f489d[_0x17a10d['agicommand']]){_0x5f3648=_0x1f489d[_0x17a10d[_0x9c1f('0x21')]](_0x17a10d);logger[_0x9c1f('0xf')](_0x9c1f('0x48'),JSON[_0x9c1f('0x3d')](_0x5f3648,null,0x2));if(_0x5f3648&&_0x5f3648[_0x9c1f('0x49')]===AGI_CODE_SUCCESS&&_0x5f3648['result']!==AGI_RESULT_ERROR&&!_0x18f7f9[_0x9c1f('0x39')]){logger[_0x9c1f('0x3c')](_0x9c1f('0x48'),getLogFromObject(_0x5f3648));return _[_0x9c1f('0x4a')](_0x5f3648[_0x9c1f('0x4b')])?null:_0x5f3648['result']['toString']();}else{logger['error'](_0x9c1f('0x48'),getLogFromObject(_0x5f3648));return null;}}else{logger[_0x9c1f('0x14')](_0x9c1f('0x4c'));return null;}}catch(_0x3b12e2){logger[_0x9c1f('0x14')](_0x3b12e2[_0x9c1f('0xe')]);return null;}});if(_0x182349[_0x9c1f('0x4d')]){logger[_0x9c1f('0xf')](util['format'](_0x9c1f('0x4e'),_0x18f7f9[_0x9c1f('0x18')],_0x18f7f9[_0x9c1f('0x19')],_0x18f7f9[_0x9c1f('0x1a')],_0x18f7f9['dnid'],_0x18f7f9['uniqueid']));_0x4cce4c[_0x9c1f('0x41')](_0x182349[_0x9c1f('0x4d')]['id'],function(_0x18abe7){try{_0x18abe7=_0x1f489d[_0x9c1f('0x42')](_0x18abe7);logger[_0x9c1f('0x3c')]('vertex',JSON[_0x9c1f('0x3d')](_0x18abe7,null,0x2));if(_0x18abe7&&_0x1f489d[_0x18abe7[_0x9c1f('0x21')]]){_0x5f3648=_0x1f489d[_0x18abe7[_0x9c1f('0x21')]](_0x18abe7);if(_0x5f3648){logger[_0x9c1f('0x3c')](_0x9c1f('0x48'),getLogFromObject(_0x5f3648));return _[_0x9c1f('0x4a')](_0x5f3648[_0x9c1f('0x4b')])?null:_0x5f3648[_0x9c1f('0x4b')][_0x9c1f('0x4f')]();}else{logger[_0x9c1f('0x14')](_0x9c1f('0x48'),getLogFromObject(_0x5f3648));return null;}}else{logger['error'](_0x9c1f('0x4c'));return null;}}catch(_0x1519f1){logger['error'](_0x1519f1[_0x9c1f('0xe')]);return null;}});}logger[_0x9c1f('0xf')](util['format'](_0x9c1f('0x50'),_0x18f7f9[_0x9c1f('0x18')],_0x18f7f9[_0x9c1f('0x19')],_0x18f7f9[_0x9c1f('0x1a')],_0x18f7f9[_0x9c1f('0x1d')],_0x18f7f9['uniqueid']));logger[_0x9c1f('0xf')](util[_0x9c1f('0x10')](_0x9c1f('0x51'),_0x18f7f9[_0x9c1f('0x45')],_0x18f7f9[_0x9c1f('0x46')],parseInt(_0x18f7f9[_0x9c1f('0x47')],0xa)+0x1));_0x18f7f9[_0x9c1f('0x52')](_0x18f7f9[_0x9c1f('0x45')],_0x18f7f9[_0x9c1f('0x46')],parseInt(_0x18f7f9[_0x9c1f('0x47')],0xa)+0x1);_0x18f7f9[_0x9c1f('0x38')]();}}else{logger['error'](util[_0x9c1f('0x10')](_0x9c1f('0x53'),_0x18f7f9[_0x9c1f('0x18')]));_0x18f7f9['continueAt'](_0x18f7f9[_0x9c1f('0x45')],_0x18f7f9[_0x9c1f('0x46')],parseInt(_0x18f7f9[_0x9c1f('0x47')],0xa)+0x1);_0x18f7f9[_0x9c1f('0x38')]();}}else{logger[_0x9c1f('0x14')](util[_0x9c1f('0x10')](_0x9c1f('0x54'),_0x18f7f9[_0x9c1f('0x18')]));_0x18f7f9[_0x9c1f('0x52')](_0x18f7f9[_0x9c1f('0x45')],_0x18f7f9[_0x9c1f('0x46')],parseInt(_0x18f7f9['priority'],0xa)+0x1);_0x18f7f9[_0x9c1f('0x38')]();}}function main(){var _0x1369fa;return utilLicense['getLicense']()[_0x9c1f('0x31')](function(_0x4fddb3){if(_0x4fddb3){if(_0x4fddb3[_0x9c1f('0x55')]){if(_0x4fddb3[_0x9c1f('0x56')]&&_0x4fddb3[_0x9c1f('0x56')]>0x0){logger[_0x9c1f('0xf')](util[_0x9c1f('0x10')](_0x9c1f('0x57'),_0x4fddb3[_0x9c1f('0x56')]));_0x1369fa=_0x4fddb3[_0x9c1f('0x56')];}else{logger[_0x9c1f('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x9c1f('0xf')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1369fa=-0x1;}}})[_0x9c1f('0x2f')](function(_0x3c28da){logger[_0x9c1f('0x14')](_0x9c1f('0x58'),_0x3c28da[_0x9c1f('0xe')]);})[_0x9c1f('0x4d')](function(){var _0x4e9924=require(_0x9c1f('0x59'))(config[_0x9c1f('0x7')][_0x9c1f('0x5a')],config['agi']['ip'],_0x1369fa);_0x4e9924['on'](_0x9c1f('0x14'),errorHandler);_0x4e9924['on']('listening',listeningHandler);_0x4e9924['on'](_0x9c1f('0x5b'),connectionHandler);_0x4e9924['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x1354=['listening','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','sync','production','start','root','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','close','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server'];(function(_0xa016f6,_0x3a8863){var _0x313949=function(_0x570eeb){while(--_0x570eeb){_0xa016f6['push'](_0xa016f6['shift']());}};_0x313949(++_0x3a8863);}(_0x1354,0x1dc));var _0x4135=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0x1354[_0x1bd3ab];return _0x37e394;};'use strict';var parser=require(_0x4135('0x0'));var _=require(_0x4135('0x1'));var syncho=require(_0x4135('0x2'));var util=require('util');var moment=require(_0x4135('0x3'));var config=require(_0x4135('0x4'));var logger=require(_0x4135('0x5'))(_0x4135('0x6'));var utilLicense=require(_0x4135('0x7'));var rpc=require(_0x4135('0x8'));var mailRpc=require(_0x4135('0x9'));var Graph=require(_0x4135('0xa'));var Vertices=require(_0x4135('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x4135('0x6')]=_['defaults'](config[_0x4135('0x6')],{'ip':_0x4135('0xc'),'port':0x11dd});function connectionHandler(_0x544a98){process[_0x4135('0xd')](function(){syncho(function(){try{setChannelVariables(_0x544a98);agiHandler(_0x544a98);}catch(_0x532698){logger[_0x4135('0xe')](_0x532698[_0x4135('0xf')]);}});});}function listeningHandler(){console[_0x4135('0x10')](_0x4135('0x11'),config[_0x4135('0x6')][_0x4135('0x12')]);logger[_0x4135('0x13')](util['format'](_0x4135('0x14'),config['agi']['ip'],config['agi'][_0x4135('0x12')]));}function errorHandler(_0x31ed92){if(_0x31ed92&&_0x31ed92[_0x4135('0x15')]&&_0x31ed92['message']){logger[_0x4135('0xe')](util[_0x4135('0x16')](_0x4135('0x17'),_0x31ed92[_0x4135('0x15')],_0x31ed92[_0x4135('0x18')]));}else{logger[_0x4135('0xe')](util['format'](_0x4135('0x19'),_0x31ed92[_0x4135('0xf')]));}}function closeHandler(){logger[_0x4135('0x13')](util[_0x4135('0x16')](_0x4135('0x1a'),this[_0x4135('0x1b')],this[_0x4135('0x1c')],this[_0x4135('0x1d')],this[_0x4135('0x1e')],this[_0x4135('0x1f')]));try{createSquareReport(this);}catch(_0x1f6f72){logger[_0x4135('0xe')](_0x1f6f72[_0x4135('0xf')]);}}function timeoutHandler(){logger[_0x4135('0x13')](util[_0x4135('0x16')](_0x4135('0x20'),this[_0x4135('0x1b')],this[_0x4135('0x1c')],this[_0x4135('0x1d')],this[_0x4135('0x1e')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x4135('0x16')](_0x4135('0x21'),this['arg_1'],this[_0x4135('0x1c')],this[_0x4135('0x1d')],this[_0x4135('0x1e')],this[_0x4135('0x1f')]));this[_0x4135('0x22')]=!![];}function getRoot(_0x560913){return parser[_0x4135('0x23')](_0x560913,{'object':!![]})[_0x4135('0x24')]['root'];}function addVertex(_0x52cd94,_0x52f3f1,_0x580267){_0x52f3f1['agicommand']=_0x580267;if(_0x52f3f1[_0x4135('0x25')](_0x4135('0x26'))){_0x52f3f1[_0x4135('0x27')]=parseInt(_0x52f3f1[_0x4135('0x26')],0xa);}_0x52cd94[_0x4135('0x28')](_[_0x4135('0x29')](_0x52f3f1,_0x4135('0x2a')));}function initGraph(_0x451695,_0x4accc6){var _0x5764a7=new Graph();for(var _0x9974da in _0x451695){if(_0x451695['hasOwnProperty'](_0x9974da)){if(_[_0x4135('0x2b')](_0x451695[_0x9974da])){for(var _0x28a755=0x0;_0x28a755<_0x451695[_0x9974da][_0x4135('0x2c')];_0x28a755+=0x1){addVertex(_0x5764a7,_0x451695[_0x9974da][_0x28a755],_0x9974da);}}else{addVertex(_0x5764a7,_0x451695[_0x9974da],_0x9974da);}}}for(var _0x41a38c=0x0;_0x41a38c<_0x4accc6[_0x4135('0x2c')];_0x41a38c+=0x1){if(_0x4accc6[_0x41a38c][_0x4135('0x2d')]&&_0x4accc6[_0x41a38c][_0x4135('0x2e')]){_0x5764a7[_0x4135('0x2f')](_0x4accc6[_0x41a38c][_0x4135('0x2d')],_0x4accc6[_0x41a38c][_0x4135('0x2e')],_0x4accc6[_0x41a38c][_0x4135('0x30')]);}}return _0x5764a7;}function getSquareProject(_0x5bc819,_0xcb2228){rpc[_0x4135('0x31')](_0x5bc819)[_0x4135('0x32')](function(_0x4f83c1){_0xcb2228(null,_0x4f83c1);})[_0x4135('0x33')](function(_0x1c4937){_0xcb2228(null,_0x1c4937);});}function createSquareReport(_0x3059e9,_0xc5d4b2){rpc['createSquareReport'](_0x3059e9)[_0x4135('0x32')](function(_0x3f2b3b){if(_0xc5d4b2){_0xc5d4b2(null,_0x3f2b3b);}})[_0x4135('0x33')](function(_0x2f48f8){if(_0xc5d4b2){_0xc5d4b2(null,_0x2f48f8);}});}function setChannelVariables(_0x9dfbd8){for(var _0x4186c2 in _0x9dfbd8){if(_0x9dfbd8['hasOwnProperty'](_0x4186c2)){if(_0x4186c2['indexOf'](_0x4135('0x34'))===0x0){_0x9dfbd8[_0x4186c2[_0x4135('0x35')](0x4)]=_0x9dfbd8[_0x4186c2];delete _0x9dfbd8[_0x4186c2];}}}}function getLogFromObject(_0x18109e){return util[_0x4135('0x36')](_0x18109e,{'showHidden':![],'depth':null});}function agiHandler(_0x11e381){var _0x29ef63,_0x46ac29,_0x32e3ba,_0x4c67e8,_0x1d6528;logger[_0x4135('0x37')](_0x4135('0x38'),JSON[_0x4135('0x39')](_0x11e381,null,0x2));logger[_0x4135('0x13')](util[_0x4135('0x16')](_0x4135('0x3a'),_0x11e381[_0x4135('0x1b')],_0x11e381[_0x4135('0x1c')],_0x11e381['callerid'],_0x11e381[_0x4135('0x1e')],_0x11e381[_0x4135('0x1f')]));_0x11e381['on'](_0x4135('0xe'),errorHandler);_0x11e381['on']('close',closeHandler);_0x11e381['on']('timeout',timeoutHandler);_0x11e381['evtHangup']=![];_0x11e381['on'](_0x4135('0x3b'),hangupHandler);var _0x3e6ed3=getSquareProject[_0x4135('0x3c')](null,_0x11e381[_0x4135('0x1b')]);if(_0x3e6ed3){if(_0x3e6ed3['production']){_0x29ef63=getRoot(_0x3e6ed3[_0x4135('0x3d')]);if(_0x29ef63&&_0x29ef63[_0x4135('0x3e')]){logger[_0x4135('0x37')](_0x4135('0x3f'),JSON[_0x4135('0x39')](_0x29ef63,null,0x2));_0x11e381[_0x4135('0x40')]=moment()[_0x4135('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x46ac29=initGraph(_[_0x4135('0x29')](_0x29ef63,'mxCell'),_0x29ef63[_0x4135('0x2a')]);_0x32e3ba=new Vertices(_0x11e381,rpc,mailRpc);logger['info'](util[_0x4135('0x16')](_0x4135('0x41'),_0x11e381[_0x4135('0x1b')],_0x11e381[_0x4135('0x1c')],_0x11e381['callerid'],_0x11e381['dnid'],_0x11e381[_0x4135('0x1f')]));_0x46ac29[_0x4135('0x42')](_0x29ef63[_0x4135('0x3e')]['id'],function(_0x25d9c1){try{_0x25d9c1=_0x32e3ba['clear'](_0x25d9c1);logger[_0x4135('0x37')](_0x4135('0x43'),JSON[_0x4135('0x39')](_0x25d9c1,null,0x2));if(_0x25d9c1[_0x4135('0x44')]===_0x4135('0x45')){logger[_0x4135('0x13')](_0x4135('0x46'));_0x11e381[_0x4135('0x47')]=_0x25d9c1['context']||_0x11e381[_0x4135('0x47')];_0x11e381[_0x4135('0x48')]=_0x25d9c1['extension'];_0x11e381['priority']=_0x25d9c1[_0x4135('0x49')]?_0x25d9c1[_0x4135('0x49')]-0x1:0x1;return null;}else if(_0x25d9c1&&_0x32e3ba[_0x25d9c1[_0x4135('0x44')]]){_0x1d6528=_0x32e3ba[_0x25d9c1[_0x4135('0x44')]](_0x25d9c1);logger[_0x4135('0x13')](_0x4135('0x4a'),JSON[_0x4135('0x39')](_0x1d6528,null,0x2));if(_0x1d6528&&_0x1d6528['code']===AGI_CODE_SUCCESS&&_0x1d6528[_0x4135('0x4b')]!==AGI_RESULT_ERROR&&!_0x11e381[_0x4135('0x22')]){logger['debug'](_0x4135('0x4a'),getLogFromObject(_0x1d6528));return _[_0x4135('0x4c')](_0x1d6528[_0x4135('0x4b')])?null:_0x1d6528[_0x4135('0x4b')][_0x4135('0x4d')]();}else{logger[_0x4135('0xe')](_0x4135('0x4a'),getLogFromObject(_0x1d6528));return null;}}else{logger[_0x4135('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x1267cc){logger['error'](_0x1267cc[_0x4135('0xf')]);return null;}});if(_0x29ef63[_0x4135('0x4e')]){logger[_0x4135('0x13')](util['format'](_0x4135('0x4f'),_0x11e381['arg_1'],_0x11e381[_0x4135('0x1c')],_0x11e381[_0x4135('0x1d')],_0x11e381['dnid'],_0x11e381[_0x4135('0x1f')]));_0x46ac29[_0x4135('0x42')](_0x29ef63[_0x4135('0x4e')]['id'],function(_0x1a7f7e){try{_0x1a7f7e=_0x32e3ba['clear'](_0x1a7f7e);logger['debug'](_0x4135('0x43'),JSON[_0x4135('0x39')](_0x1a7f7e,null,0x2));if(_0x1a7f7e&&_0x32e3ba[_0x1a7f7e[_0x4135('0x44')]]){_0x1d6528=_0x32e3ba[_0x1a7f7e[_0x4135('0x44')]](_0x1a7f7e);if(_0x1d6528){logger[_0x4135('0x37')](_0x4135('0x4a'),getLogFromObject(_0x1d6528));return _[_0x4135('0x4c')](_0x1d6528[_0x4135('0x4b')])?null:_0x1d6528[_0x4135('0x4b')]['toString']();}else{logger[_0x4135('0xe')](_0x4135('0x4a'),getLogFromObject(_0x1d6528));return null;}}else{logger['error'](_0x4135('0x50'));return null;}}catch(_0x2946b2){logger[_0x4135('0xe')](_0x2946b2[_0x4135('0xf')]);return null;}});}logger['info'](util[_0x4135('0x16')](_0x4135('0x51'),_0x11e381['arg_1'],_0x11e381[_0x4135('0x1c')],_0x11e381[_0x4135('0x1d')],_0x11e381[_0x4135('0x1e')],_0x11e381['uniqueid']));logger[_0x4135('0x13')](util[_0x4135('0x16')](_0x4135('0x52'),_0x11e381[_0x4135('0x47')],_0x11e381[_0x4135('0x48')],parseInt(_0x11e381[_0x4135('0x49')],0xa)+0x1));_0x11e381[_0x4135('0x53')](_0x11e381[_0x4135('0x47')],_0x11e381['extension'],parseInt(_0x11e381['priority'],0xa)+0x1);_0x11e381['close']();}}else{logger['error'](util[_0x4135('0x16')](_0x4135('0x54'),_0x11e381[_0x4135('0x1b')]));_0x11e381[_0x4135('0x53')](_0x11e381[_0x4135('0x47')],_0x11e381['extension'],parseInt(_0x11e381[_0x4135('0x49')],0xa)+0x1);_0x11e381[_0x4135('0x55')]();}}else{logger['error'](util[_0x4135('0x16')](_0x4135('0x56'),_0x11e381['arg_1']));_0x11e381['continueAt'](_0x11e381['context'],_0x11e381[_0x4135('0x48')],parseInt(_0x11e381[_0x4135('0x49')],0xa)+0x1);_0x11e381[_0x4135('0x55')]();}}function main(){var _0x3a9c55;return utilLicense[_0x4135('0x57')]()[_0x4135('0x32')](function(_0x184f2c){if(_0x184f2c){if(_0x184f2c[_0x4135('0x58')]){if(_0x184f2c[_0x4135('0x59')]&&_0x184f2c['callysquare']>0x0){logger['info'](util[_0x4135('0x16')](_0x4135('0x5a'),_0x184f2c[_0x4135('0x59')]));_0x3a9c55=_0x184f2c['callysquare'];}else{logger['info'](_0x4135('0x5b'));}}else{logger[_0x4135('0x13')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3a9c55=-0x1;}}})[_0x4135('0x33')](function(_0x2764e5){logger['error'](_0x4135('0x5c'),_0x2764e5[_0x4135('0xf')]);})[_0x4135('0x4e')](function(){var _0x1cb485=require(_0x4135('0x5d'))(config['agi']['port'],config[_0x4135('0x6')]['ip'],_0x3a9c55);_0x1cb485['on'](_0x4135('0xe'),errorHandler);_0x1cb485['on'](_0x4135('0x5e'),listeningHandler);_0x1cb485['on']('connection',connectionHandler);_0x1cb485['on'](_0x4135('0x55'),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 5b1dec4..ada6294 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 _0x8f34=['bluebird','jayson/promise','http','request','error','message','result','catch','SendMail'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8f34,0xe1));var _0x48f3=function(_0x2db3eb,_0x236da4){_0x2db3eb=_0x2db3eb-0x0;var _0x5208da=_0x8f34[_0x2db3eb];return _0x5208da;};'use strict';var BPromise=require(_0x48f3('0x0'));var jayson=require(_0x48f3('0x1'));var client=jayson['client'][_0x48f3('0x2')]({'port':0x232b});function request(_0x3d3d5a,_0x39dc45){return new BPromise(function(_0x3826e8,_0x26c833){return client[_0x48f3('0x3')](_0x3d3d5a,_0x39dc45)['then'](function(_0x7f6993){if(_0x7f6993['error']){return _0x26c833(_0x7f6993[_0x48f3('0x4')][_0x48f3('0x5')]);}else{return _0x3826e8(_0x7f6993[_0x48f3('0x6')]);}})[_0x48f3('0x7')](function(_0x2a0601){return _0x26c833(_0x2a0601);});});}exports['sendMailMessage']=function(_0x1015c5,_0x35c1fd){return request(_0x48f3('0x8'),{'account':_0x1015c5,'message':_0x35c1fd});}; \ No newline at end of file +var _0x48b8=['message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error'];(function(_0x212b07,_0x9580fc){var _0x5909a7=function(_0x3469e6){while(--_0x3469e6){_0x212b07['push'](_0x212b07['shift']());}};_0x5909a7(++_0x9580fc);}(_0x48b8,0x90));var _0x848b=function(_0x42fdcc,_0x2c632c){_0x42fdcc=_0x42fdcc-0x0;var _0x35bba6=_0x48b8[_0x42fdcc];return _0x35bba6;};'use strict';var BPromise=require(_0x848b('0x0'));var jayson=require(_0x848b('0x1'));var client=jayson[_0x848b('0x2')]['http']({'port':0x232b});function request(_0x4053de,_0x2eec8d){return new BPromise(function(_0x5d0561,_0x5a08a6){return client[_0x848b('0x3')](_0x4053de,_0x2eec8d)[_0x848b('0x4')](function(_0x49f9aa){if(_0x49f9aa[_0x848b('0x5')]){return _0x5a08a6(_0x49f9aa[_0x848b('0x5')][_0x848b('0x6')]);}else{return _0x5d0561(_0x49f9aa['result']);}})[_0x848b('0x7')](function(_0x4b2b68){return _0x5a08a6(_0x4b2b68);});});}exports[_0x848b('0x8')]=function(_0x1d6e7c,_0x584cd2){return request(_0x848b('0x9'),{'account':_0x1d6e7c,'message':_0x584cd2});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index a33c8ed..61b3461 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 _0x8b78=['split','indexOf','trim','emit','line','util','Transform','call','_localBuffer','_inBody','inherits','_transform','toString','substring','length'];(function(_0x73b15,_0xc01cff){var _0x4415c9=function(_0x2e8954){while(--_0x2e8954){_0x73b15['push'](_0x73b15['shift']());}};_0x4415c9(++_0xc01cff);}(_0x8b78,0xaa));var _0x88b7=function(_0x4d1aca,_0x2a4b4c){_0x4d1aca=_0x4d1aca-0x0;var _0x3e6585=_0x8b78[_0x4d1aca];return _0x3e6585;};'use strict';var util=require(_0x88b7('0x0'));var Transform=require('stream')[_0x88b7('0x1')];function AGIReply(_0x5aab27){Transform[_0x88b7('0x2')](this,_0x5aab27);this[_0x88b7('0x3')]='';this[_0x88b7('0x4')]=![];}util[_0x88b7('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x88b7('0x6')]=function(_0x48495d,_0x2e46e7,_0x288734){var _0x23ceac='\x0a',_0x500247=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x117d86=-0x1,_0x26d62b=-0x1,_0x1188b6='',_0x484c44=0x0,_0x3d72d2='',_0xdacdb6='';this[_0x88b7('0x3')]+=_0x48495d[_0x88b7('0x7')]();_0x3d72d2=this[_0x88b7('0x3')];if(!this[_0x88b7('0x4')]){_0x484c44=0x0;while(_0x500247[_0x484c44]){while((_0x26d62b=_0x3d72d2['indexOf'](_0x500247[_0x484c44]))!=-0x1){_0x1188b6=_0x500247[_0x484c44];_0xdacdb6=_0x3d72d2[_0x88b7('0x8')](0x0,_0x26d62b);_0x3d72d2=_0x3d72d2['substring'](_0x26d62b+_0x1188b6[_0x88b7('0x9')]);var _0x506bdc=_0xdacdb6[_0x88b7('0xa')](_0x23ceac),_0x6a37e0=0x0,_0x39fd78={},_0x563444='',_0x4d7650='',_0x4bd2c8=-0x1;while(_0x506bdc[_0x6a37e0]){_0x4bd2c8=_0x506bdc[_0x6a37e0][_0x88b7('0xb')](':');if(_0x4bd2c8!=-0x1){_0x563444=_0x506bdc[_0x6a37e0]['slice'](0x0,_0x4bd2c8)[_0x88b7('0xc')]();_0x4d7650=_0x506bdc[_0x6a37e0]['slice'](_0x4bd2c8+0x1)['trim']();if(_0x563444[_0x88b7('0x9')]>0x0){_0x39fd78[_0x563444]=_0x4d7650;}}else{}_0x6a37e0++;}this[_0x88b7('0xd')]('headers',_0x39fd78);this[_0x88b7('0x4')]=!![];}_0x484c44++;}this[_0x88b7('0x3')]=_0x3d72d2;}else{while((_0x117d86=_0x3d72d2[_0x88b7('0xb')](_0x23ceac))!=-0x1){_0xdacdb6=_0x3d72d2[_0x88b7('0x8')](0x0,_0x117d86);this[_0x88b7('0xd')](_0x88b7('0xe'),_0xdacdb6);_0x3d72d2=_0x3d72d2[_0x88b7('0x8')](_0x117d86+_0x23ceac[_0x88b7('0x9')]);}this['_localBuffer']=_0x3d72d2;}_0x288734();};module['exports']=AGIReply; \ No newline at end of file +var _0x869d=['util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','trim','slice','headers','emit','exports'];(function(_0x549007,_0x1ecf0a){var _0x45fd13=function(_0x51ca00){while(--_0x51ca00){_0x549007['push'](_0x549007['shift']());}};_0x45fd13(++_0x1ecf0a);}(_0x869d,0x11d));var _0xd869=function(_0x4af3eb,_0x48cca9){_0x4af3eb=_0x4af3eb-0x0;var _0x96ebba=_0x869d[_0x4af3eb];return _0x96ebba;};'use strict';var util=require(_0xd869('0x0'));var Transform=require(_0xd869('0x1'))[_0xd869('0x2')];function AGIReply(_0x4d3cd6){Transform[_0xd869('0x3')](this,_0x4d3cd6);this[_0xd869('0x4')]='';this[_0xd869('0x5')]=![];}util[_0xd869('0x6')](AGIReply,Transform);AGIReply[_0xd869('0x7')][_0xd869('0x8')]=function(_0x47a428,_0x102ae9,_0x1685c3){var _0x5ec44f='\x0a',_0x4e23f2=['\x0a\x0a',_0xd869('0x9')],_0x250166=-0x1,_0x395923=-0x1,_0x51b3d='',_0x200fc9=0x0,_0x544fc0='',_0xe285c6='';this[_0xd869('0x4')]+=_0x47a428[_0xd869('0xa')]();_0x544fc0=this['_localBuffer'];if(!this[_0xd869('0x5')]){_0x200fc9=0x0;while(_0x4e23f2[_0x200fc9]){while((_0x395923=_0x544fc0[_0xd869('0xb')](_0x4e23f2[_0x200fc9]))!=-0x1){_0x51b3d=_0x4e23f2[_0x200fc9];_0xe285c6=_0x544fc0[_0xd869('0xc')](0x0,_0x395923);_0x544fc0=_0x544fc0[_0xd869('0xc')](_0x395923+_0x51b3d[_0xd869('0xd')]);var _0x1bbe26=_0xe285c6['split'](_0x5ec44f),_0x6bdd20=0x0,_0xf49f8d={},_0x11ed57='',_0x10792c='',_0x132a70=-0x1;while(_0x1bbe26[_0x6bdd20]){_0x132a70=_0x1bbe26[_0x6bdd20]['indexOf'](':');if(_0x132a70!=-0x1){_0x11ed57=_0x1bbe26[_0x6bdd20]['slice'](0x0,_0x132a70)[_0xd869('0xe')]();_0x10792c=_0x1bbe26[_0x6bdd20][_0xd869('0xf')](_0x132a70+0x1)[_0xd869('0xe')]();if(_0x11ed57[_0xd869('0xd')]>0x0){_0xf49f8d[_0x11ed57]=_0x10792c;}}else{}_0x6bdd20++;}this['emit'](_0xd869('0x10'),_0xf49f8d);this[_0xd869('0x5')]=!![];}_0x200fc9++;}this[_0xd869('0x4')]=_0x544fc0;}else{while((_0x250166=_0x544fc0[_0xd869('0xb')](_0x5ec44f))!=-0x1){_0xe285c6=_0x544fc0[_0xd869('0xc')](0x0,_0x250166);this[_0xd869('0x11')]('line',_0xe285c6);_0x544fc0=_0x544fc0[_0xd869('0xc')](_0x250166+_0x5ec44f[_0xd869('0xd')]);}this[_0xd869('0x4')]=_0x544fc0;}_0x1685c3();};module[_0xd869('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 709e6b0..385a7e8 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 _0x3384=['save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','util','jayson/promise','client','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','phone','getTrunkById','getSoundById','ShowSound'];(function(_0x1655a7,_0x41542a){var _0x2d9599=function(_0x5039e4){while(--_0x5039e4){_0x1655a7['push'](_0x1655a7['shift']());}};_0x2d9599(++_0x41542a);}(_0x3384,0x1a5));var _0x4338=function(_0x11e9a3,_0xabd526){_0x11e9a3=_0x11e9a3-0x0;var _0x573f45=_0x3384[_0x11e9a3];return _0x573f45;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require(_0x4338('0x0'));var jayson=require(_0x4338('0x1'));var client=jayson[_0x4338('0x2')][_0x4338('0x3')]({'port':0x2329});function request(_0x5c0c7a,_0x55e5cd){return new BPromise(function(_0xc5fb81,_0x3338a9){return client[_0x4338('0x4')](_0x5c0c7a,_0x55e5cd)[_0x4338('0x5')](function(_0x4a7cab){if(_0x4a7cab[_0x4338('0x6')]){return _0x3338a9(_0x4a7cab['error'][_0x4338('0x7')]);}else{return _0xc5fb81(_0x4a7cab[_0x4338('0x8')]);}})['catch'](function(_0x1da39a){return _0x3338a9(_0x1da39a);});});}exports[_0x4338('0x9')]=function(){return request(_0x4338('0xa'),{'options':{'raw':![],'attributes':['id',_0x4338('0xb'),_0x4338('0xc')]}});};exports[_0x4338('0xd')]=function(_0x18c1e2){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x18c1e2},'attributes':['production']}});};exports[_0x4338('0xe')]=function(_0x5a3490){return request(_0x4338('0xf'),{'options':{'raw':![],'where':{'id':_0x5a3490},'include':[{'model':_0x4338('0x10'),'as':_0x4338('0x11'),'include':[{'model':_0x4338('0x12'),'as':_0x4338('0x12')}]}],'attributes':['id','name',_0x4338('0x13')],'smtp':!![]}});};exports[_0x4338('0x14')]=function(_0x41e627){return request(_0x4338('0x15'),{'options':{'where':{'id':_0x41e627},'attributes':[_0x4338('0xb')]}});};exports[_0x4338('0x16')]=function(_0x55f262){return request(_0x4338('0x17'),{'options':{'where':{'id':_0x55f262},'attributes':['name']}});};exports[_0x4338('0x18')]=function(_0x4f94b2){return request('ShowVariable',{'options':{'where':{'id':_0x4f94b2},'attributes':[_0x4338('0xb')]}});};exports[_0x4338('0x19')]=function(_0x177c14){return request(_0x4338('0x1a'),{'options':{'where':{'id':_0x177c14},'attributes':[_0x4338('0x1b')]}});};exports[_0x4338('0x1c')]=function(_0x343c43){return request('ShowUser',{'options':{'where':{'id':_0x343c43},'attributes':[_0x4338('0xb')]}});};exports[_0x4338('0x1d')]=function(_0x205aff){return request('GetContactByPhone',{'options':{'where':{'phone':_0x205aff[_0x4338('0x1e')]},'attributes':['id']}});};exports[_0x4338('0x1f')]=function(_0x521a8a){return request('ShowTrunk',{'options':{'where':{'id':_0x521a8a},'attributes':[_0x4338('0xb')]}});};exports[_0x4338('0x20')]=function(_0x8e23d0){return request(_0x4338('0x21'),{'options':{'where':{'id':_0x8e23d0},'attributes':[_0x4338('0x22')]}});};exports[_0x4338('0x23')]=function(_0x379057){return request(_0x4338('0x24'),{'options':{'raw':![],'where':{'id':_0x379057},'include':[{'model':_0x4338('0x25'),'as':_0x4338('0x26')}]}});};exports['getSmsAccountById']=function(_0x4751c3){return request(_0x4338('0x27'),{'options':{'where':{'id':_0x4751c3},'attributes':['id',_0x4338('0xb')]}});};exports[_0x4338('0x28')]=function(_0x338632){return request(_0x4338('0x29'),{'body':_0x338632});};exports[_0x4338('0x2a')]=function(_0x296d00){return request(_0x4338('0x2b'),{'body':_0x296d00});};exports[_0x4338('0x2c')]=function(_0xbe93bb){return request(_0x4338('0x2d'),{'body':_[_0x4338('0x2e')](_0xbe93bb,{'project_name':_0xbe93bb[_0x4338('0x2f')],'prev_project_name':_0xbe93bb[_0x4338('0x30')]||'','is_subproject':_0xbe93bb[_0x4338('0x30')]?!![]:![],'leaveAt':moment()[_0x4338('0x31')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x4338('0x32')]=function(_0x2461ef){return request(_0x4338('0x33'),{'body':_0x2461ef});};exports[_0x4338('0x34')]=function(_0x21979b){return request(_0x4338('0x35'),{'body':_0x21979b});};exports[_0x4338('0x36')]=function(_0x17494a){return request(_0x4338('0x37'),{'options':{'raw':![],'where':{'phone':_0x17494a[_0x4338('0x1e')],'ListId':_0x17494a[_0x4338('0x38')]}}})[_0x4338('0x5')](function(_0x1b802f){if(_0x1b802f){return _0x1b802f;}return request(_0x4338('0x39'),{'body':_0x17494a});});};exports['getPauseById']=function(_0x195984){return request(_0x4338('0x3a'),{'options':{'where':{'id':_0x195984},'attributes':[_0x4338('0xb')]}});};exports[_0x4338('0x3b')]=function(_0x38aeb2,_0x28c55a){return request('LoginUser',{'body':{'interface':_0x28c55a},'options':{'where':_0x38aeb2}});};exports[_0x4338('0x3c')]=function(_0x3a5a6f,_0x196c36,_0x464b82){return request(_0x4338('0x3d'),{'body':{'type':_0x196c36,'uniqueid':_0x464b82},'options':{'where':_0x3a5a6f}});};exports[_0x4338('0x3e')]=function(_0x4d5c8a){return request('UnpauseUser',{'body':{},'options':{'where':_0x4d5c8a}});};exports[_0x4338('0x3f')]=function(_0x1d24d8){return request(_0x4338('0x40'),{'body':{},'options':{'where':_0x1d24d8}});}; \ No newline at end of file +var _0x0281=['getTrunkById','getSoundById','save_name','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','production','ShowSquareProject','MailServerOut','CloudProvider','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','getContactByPhone','GetContactByPhone','phone'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0281,0x139));var _0x1028=function(_0x5efbcb,_0x5319b2){_0x5efbcb=_0x5efbcb-0x0;var _0x4d44af=_0x0281[_0x5efbcb];return _0x4d44af;};'use strict';var BPromise=require(_0x1028('0x0'));var moment=require(_0x1028('0x1'));var _=require(_0x1028('0x2'));var util=require(_0x1028('0x3'));var jayson=require(_0x1028('0x4'));var client=jayson[_0x1028('0x5')][_0x1028('0x6')]({'port':0x2329});function request(_0x2d8cd8,_0x27dab7){return new BPromise(function(_0x4a0f26,_0x3b42f9){return client[_0x1028('0x7')](_0x2d8cd8,_0x27dab7)[_0x1028('0x8')](function(_0x301e6f){if(_0x301e6f[_0x1028('0x9')]){return _0x3b42f9(_0x301e6f[_0x1028('0x9')]['message']);}else{return _0x4a0f26(_0x301e6f[_0x1028('0xa')]);}})[_0x1028('0xb')](function(_0x25493e){return _0x3b42f9(_0x25493e);});});}exports[_0x1028('0xc')]=function(){return request(_0x1028('0xd'),{'options':{'raw':![],'attributes':['id','name',_0x1028('0xe')]}});};exports['getSquareProject']=function(_0x314aa2){return request(_0x1028('0xf'),{'options':{'raw':![],'where':{'name':_0x314aa2},'attributes':[_0x1028('0xe')]}});};exports['getMailAccountById']=function(_0x45e3bc){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x45e3bc},'include':[{'model':_0x1028('0x10'),'as':'Smtp','include':[{'model':_0x1028('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0x1028('0x12'),'email'],'smtp':!![]}});};exports[_0x1028('0x13')]=function(_0x1ce089){return request(_0x1028('0xf'),{'options':{'where':{'id':_0x1ce089},'attributes':['name']}});};exports[_0x1028('0x14')]=function(_0x5ea207){return request(_0x1028('0x15'),{'options':{'where':{'id':_0x5ea207},'attributes':[_0x1028('0x12')]}});};exports['getVariableById']=function(_0x547c53){return request(_0x1028('0x16'),{'options':{'where':{'id':_0x547c53},'attributes':[_0x1028('0x12')]}});};exports[_0x1028('0x17')]=function(_0x353cc2){return request(_0x1028('0x18'),{'options':{'where':{'id':_0x353cc2},'attributes':['dsn']}});};exports['getUserById']=function(_0xc25bc9){return request(_0x1028('0x19'),{'options':{'where':{'id':_0xc25bc9},'attributes':['name']}});};exports[_0x1028('0x1a')]=function(_0x3c7f2a){return request(_0x1028('0x1b'),{'options':{'where':{'phone':_0x3c7f2a[_0x1028('0x1c')]},'attributes':['id']}});};exports[_0x1028('0x1d')]=function(_0x54e3cf){return request('ShowTrunk',{'options':{'where':{'id':_0x54e3cf},'attributes':[_0x1028('0x12')]}});};exports[_0x1028('0x1e')]=function(_0x3a8fae){return request('ShowSound',{'options':{'where':{'id':_0x3a8fae},'attributes':[_0x1028('0x1f')]}});};exports['getIntervalById']=function(_0x2a9a37){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2a9a37},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x1028('0x20')]=function(_0x402225){return request(_0x1028('0x21'),{'options':{'where':{'id':_0x402225},'attributes':['id',_0x1028('0x12')]}});};exports['createSmsMessage']=function(_0x534eeb){return request('CreateSmsMessage',{'body':_0x534eeb});};exports[_0x1028('0x22')]=function(_0x3b9469){return request(_0x1028('0x23'),{'body':_0x3b9469});};exports[_0x1028('0x24')]=function(_0x524a2e){return request(_0x1028('0x25'),{'body':_[_0x1028('0x26')](_0x524a2e,{'project_name':_0x524a2e[_0x1028('0x27')],'prev_project_name':_0x524a2e[_0x1028('0x28')]||'','is_subproject':_0x524a2e['arg_2']?!![]:![],'leaveAt':moment()[_0x1028('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x1028('0x2a')]=function(_0x2d0d8e){return request(_0x1028('0x2b'),{'body':_0x2d0d8e});};exports[_0x1028('0x2c')]=function(_0xd8c2dc){return request(_0x1028('0x2d'),{'body':_0xd8c2dc});};exports[_0x1028('0x2e')]=function(_0x1507fb){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1507fb[_0x1028('0x1c')],'ListId':_0x1507fb[_0x1028('0x2f')]}}})[_0x1028('0x8')](function(_0x56ee99){if(_0x56ee99){return _0x56ee99;}return request(_0x1028('0x30'),{'body':_0x1507fb});});};exports[_0x1028('0x31')]=function(_0x2e8e12){return request(_0x1028('0x32'),{'options':{'where':{'id':_0x2e8e12},'attributes':[_0x1028('0x12')]}});};exports['agentLogin']=function(_0x5ac591,_0x578821){return request(_0x1028('0x33'),{'body':{'interface':_0x578821},'options':{'where':_0x5ac591}});};exports[_0x1028('0x34')]=function(_0x3a517d,_0x31d9b1,_0x48b77f){return request(_0x1028('0x35'),{'body':{'type':_0x31d9b1,'uniqueid':_0x48b77f},'options':{'where':_0x3a517d}});};exports['agentUnpause']=function(_0x1a6176){return request(_0x1028('0x36'),{'body':{},'options':{'where':_0x1a6176}});};exports[_0x1028('0x37')]=function(_0x3a344d){return request(_0x1028('0x38'),{'body':{},'options':{'where':_0x3a344d}});}; \ 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 cdee1a1..63228f2 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 _0x66da=['exports','./polly','./lex'];(function(_0x438ee0,_0x4a563e){var _0x16267f=function(_0x1438ff){while(--_0x1438ff){_0x438ee0['push'](_0x438ee0['shift']());}};_0x16267f(++_0x4a563e);}(_0x66da,0x16f));var _0xa66d=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x66da[_0x37c8ef];return _0x5eaee9;};var polly=require(_0xa66d('0x0'));var lex=require(_0xa66d('0x1'));module[_0xa66d('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5a5a=['exports','./lex'];(function(_0x2e9b00,_0x2a260c){var _0x429398=function(_0x20c1a2){while(--_0x20c1a2){_0x2e9b00['push'](_0x2e9b00['shift']());}};_0x429398(++_0x2a260c);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x29d693,_0x2daadb){_0x29d693=_0x29d693-0x0;var _0x1210c6=_0x5a5a[_0x29d693];return _0x1210c6;};var polly=require('./polly');var lex=require(_0xa5a5('0x0'));module[_0xa5a5('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 22484fb..7e1294e 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 _0xe5b5=['exports','./lib/api'];(function(_0x1c18b8,_0x2c8a71){var _0x19c962=function(_0x3a0338){while(--_0x3a0338){_0x1c18b8['push'](_0x1c18b8['shift']());}};_0x19c962(++_0x2c8a71);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0xe5b5[_0x246148];return _0x453d94;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ No newline at end of file +var _0xe706=['exports','./lib/api'];(function(_0x4bdfc6,_0x158ae0){var _0x3acc89=function(_0x2a5659){while(--_0x2a5659){_0x4bdfc6['push'](_0x4bdfc6['shift']());}};_0x3acc89(++_0x158ae0);}(_0xe706,0xa3));var _0x6e70=function(_0x248d46,_0xba08ec){_0x248d46=_0x248d46-0x0;var _0x354942=_0xe706[_0x248d46];return _0x354942;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ 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 90b5b66..3274cf0 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(_0x57011e,_0xe07608){var _0x73b0cd=function(_0xe26cdf){while(--_0xe26cdf){_0x57011e['push'](_0x57011e['shift']());}};_0x73b0cd(++_0xe07608);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x122e45,_0x10e6d6){var _0x2c5327=function(_0x2c093c){while(--_0x2c093c){_0x122e45['push'](_0x122e45['shift']());}};_0x2c5327(++_0x10e6d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 c249eca..eb2a89d 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 _0x0a71=['./lib/api','exports'];(function(_0x1aa463,_0xdf6e2){var _0x14e720=function(_0x4dcd1b){while(--_0x4dcd1b){_0x1aa463['push'](_0x1aa463['shift']());}};_0x14e720(++_0xdf6e2);}(_0x0a71,0xde));var _0x10a7=function(_0x2885dc,_0x178680){_0x2885dc=_0x2885dc-0x0;var _0x35940b=_0x0a71[_0x2885dc];return _0x35940b;};'use strict';var polly=require(_0x10a7('0x0'));module[_0x10a7('0x1')]=function(_0x5621b0,_0x55b708,_0x4b2178,_0x126073,_0xdfdf6d,_0x5dbf47,_0x3f879e){return polly(_0x5621b0,_0x55b708,_0x4b2178,_0x126073,_0xdfdf6d,_0x5dbf47,_0x3f879e);}; \ No newline at end of file +var _0xdfc6=['./lib/api','exports'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xdfc6,0x1d6));var _0x6dfc=function(_0x1b36df,_0x2b6ea3){_0x1b36df=_0x1b36df-0x0;var _0x36f604=_0xdfc6[_0x1b36df];return _0x36f604;};'use strict';var polly=require(_0x6dfc('0x0'));module[_0x6dfc('0x1')]=function(_0x3604f6,_0xe10655,_0xd999c2,_0x151bc2,_0x18f956,_0x4ee00c,_0x5a57eb){return polly(_0x3604f6,_0xe10655,_0xd999c2,_0x151bc2,_0x18f956,_0x4ee00c,_0x5a57eb);}; \ 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 5bf7f7e..b863bea 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 _0x8663=['mp3','path','bluebird','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','text'];(function(_0xa66190,_0x475e04){var _0x3594d2=function(_0x55bdef){while(--_0x55bdef){_0xa66190['push'](_0xa66190['shift']());}};_0x3594d2(++_0x475e04);}(_0x8663,0x1ac));var _0x3866=function(_0xaff3b5,_0x3c75fa){_0xaff3b5=_0xaff3b5-0x0;var _0xffe5f0=_0x8663[_0xaff3b5];return _0xffe5f0;};'use strict';var fs=require('fs');var path=require(_0x3866('0x0'));var BPromise=require(_0x3866('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x5a4a86,_0x224092,_0x18409e){return new BPromise(function(_0x1f0ed0,_0x314212){_0x5a4a86['synthesizeSpeech'](_0x224092,function(_0x4408c8,_0x29cdce){if(_0x4408c8){_0x314212(_0x4408c8);}else if(_0x29cdce){if(_0x29cdce[_0x3866('0x2')]instanceof Buffer){fs[_0x3866('0x3')](_0x18409e,_0x29cdce['AudioStream'],function(_0x5d1dd6){if(_0x5d1dd6){_0x314212(_0x5d1dd6);}else{_0x1f0ed0();}});}else{_0x314212(new Error(_0x3866('0x4')));}}else{_0x314212(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x5c64e9,_0x69d05c,_0x1aef8a,_0x5eb10c,_0x10fb70,_0x583b4a,_0x1118d8){var _0x6eeabe=new AWS['Polly']({'accessKeyId':_0x5c64e9,'secretAccessKey':_0x69d05c,'region':_0x1aef8a});var _0x131545={'Text':_0x10fb70,'TextType':_0x583b4a||_0x3866('0x5'),'OutputFormat':_0x3866('0x6'),'VoiceId':_0x5eb10c};return pollyResult(_0x6eeabe,_0x131545,_0x1118d8);}; \ No newline at end of file +var _0x10a5=['text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x5c56bb,_0x4316ef){var _0x28873e=function(_0x276af2){while(--_0x276af2){_0x5c56bb['push'](_0x5c56bb['shift']());}};_0x28873e(++_0x4316ef);}(_0x10a5,0xb1));var _0x510a=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0x10a5[_0x431ff8];return _0x84ccd4;};'use strict';var fs=require('fs');var path=require(_0x510a('0x0'));var BPromise=require(_0x510a('0x1'));var rs=require(_0x510a('0x2'));var AWS=require(_0x510a('0x3'));function pollyResult(_0x1eab6d,_0x5b381b,_0x48ebc3){return new BPromise(function(_0x218cef,_0x5c09e6){_0x1eab6d[_0x510a('0x4')](_0x5b381b,function(_0x1f5c50,_0x5dfb13){if(_0x1f5c50){_0x5c09e6(_0x1f5c50);}else if(_0x5dfb13){if(_0x5dfb13[_0x510a('0x5')]instanceof Buffer){fs[_0x510a('0x6')](_0x48ebc3,_0x5dfb13[_0x510a('0x5')],function(_0x58d15c){if(_0x58d15c){_0x5c09e6(_0x58d15c);}else{_0x218cef();}});}else{_0x5c09e6(new Error(_0x510a('0x7')));}}else{_0x5c09e6(new Error(_0x510a('0x8')));}});});}module['exports']=function(_0xec7642,_0x4f8f5b,_0xb0e6e6,_0xf42e5b,_0x362491,_0xa3a2a1,_0x275017){var _0x338221=new AWS[(_0x510a('0x9'))]({'accessKeyId':_0xec7642,'secretAccessKey':_0x4f8f5b,'region':_0xb0e6e6});var _0x5ef100={'Text':_0x362491,'TextType':_0xa3a2a1||_0x510a('0xa'),'OutputFormat':'mp3','VoiceId':_0xf42e5b};return pollyResult(_0x338221,_0x5ef100,_0x275017);}; \ 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 5581054..34e78a5 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 _0x3ed7=['./lib/api','exports'];(function(_0x5d27d5,_0x8fe232){var _0x320109=function(_0x203d78){while(--_0x203d78){_0x5d27d5['push'](_0x5d27d5['shift']());}};_0x320109(++_0x8fe232);}(_0x3ed7,0xc2));var _0x73ed=function(_0x5d22c9,_0x2d364b){_0x5d22c9=_0x5d22c9-0x0;var _0x51f395=_0x3ed7[_0x5d22c9];return _0x51f395;};'use strict';var asr=require(_0x73ed('0x0'));module[_0x73ed('0x1')]=function(_0x3994bc,_0x32f925,_0x599fb1,_0xe49e2f){return asr(_0x3994bc,_0x32f925,_0x599fb1);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x301f8a,_0x34ef42,_0x3e972b,_0x20fd8f){return asr(_0x301f8a,_0x34ef42,_0x3e972b);}; \ 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 e9187fd..5673eae 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 _0x5645=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','LINEAR16','8000','url','bluebird'];(function(_0x567cf4,_0x58483e){var _0x2f632f=function(_0x39f487){while(--_0x39f487){_0x567cf4['push'](_0x567cf4['shift']());}};_0x2f632f(++_0x58483e);}(_0x5645,0x19e));var _0x5564=function(_0x284bde,_0x3a2ab2){_0x284bde=_0x284bde-0x0;var _0x455f4b=_0x5645[_0x284bde];return _0x455f4b;};'use strict';var url=require(_0x5564('0x0'));var BPromise=require(_0x5564('0x1'));var fs=require('fs');var host=_0x5564('0x2');module[_0x5564('0x3')]=function(_0x26c54d,_0x5ecd66,_0x241816){return new BPromise(function(_0x64ae4d,_0x1240cd){var _0x821a1a;if(typeof _0x26c54d!==_0x5564('0x4')||_0x26c54d[_0x5564('0x5')]===0x0){return _0x1240cd(_0x5564('0x6'));}if(typeof _0x5ecd66!==_0x5564('0x4')||_0x5ecd66[_0x5564('0x5')]===0x0){return _0x1240cd('key\x20should\x20be\x20a\x20string');}if(typeof _0x241816!=='undefined'&&(typeof _0x241816!==_0x5564('0x4')||_0x241816[_0x5564('0x5')]===0x0)){return _0x1240cd(_0x5564('0x7'));}try{_0x821a1a=fs[_0x5564('0x8')](_0x26c54d)[_0x5564('0x9')]('base64');}catch(_0x1ba45a){return _0x1240cd(_0x1ba45a);}return _0x64ae4d({'method':_0x5564('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x5ecd66,'body':{'config':{'encoding':_0x5564('0xb'),'sampleRateHertz':_0x5564('0xc'),'languageCode':_0x241816},'audio':{'content':_0x821a1a}},'json':!![]});});}; \ No newline at end of file +var _0x9221=['toString','base64','/v1/speech:recognize?key=','LINEAR16','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x161da0,_0x58f82a){var _0x50080f=function(_0xa21049){while(--_0xa21049){_0x161da0['push'](_0x161da0['shift']());}};_0x50080f(++_0x58f82a);}(_0x9221,0x64));var _0x1922=function(_0x829616,_0x5d9318){_0x829616=_0x829616-0x0;var _0x35857a=_0x9221[_0x829616];return _0x35857a;};'use strict';var url=require('url');var BPromise=require(_0x1922('0x0'));var fs=require('fs');var host=_0x1922('0x1');module['exports']=function(_0x23df25,_0x1099ca,_0x5f14f2){return new BPromise(function(_0x309b6b,_0x43c8a3){var _0x459eee;if(typeof _0x23df25!==_0x1922('0x2')||_0x23df25[_0x1922('0x3')]===0x0){return _0x43c8a3(_0x1922('0x4'));}if(typeof _0x1099ca!==_0x1922('0x2')||_0x1099ca['length']===0x0){return _0x43c8a3(_0x1922('0x5'));}if(typeof _0x5f14f2!==_0x1922('0x6')&&(typeof _0x5f14f2!==_0x1922('0x2')||_0x5f14f2['length']===0x0)){return _0x43c8a3(_0x1922('0x7'));}try{_0x459eee=fs['readFileSync'](_0x23df25)[_0x1922('0x8')](_0x1922('0x9'));}catch(_0x1082d8){return _0x43c8a3(_0x1082d8);}return _0x309b6b({'method':'POST','uri':host+_0x1922('0xa')+_0x1099ca,'body':{'config':{'encoding':_0x1922('0xb'),'sampleRateHertz':'8000','languageCode':_0x5f14f2},'audio':{'content':_0x459eee}},'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 2849583..4ba632c 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 _0x71dc=['./asr','exports'];(function(_0x3c292a,_0x1c72c5){var _0xa11bf=function(_0x389e2f){while(--_0x389e2f){_0x3c292a['push'](_0x3c292a['shift']());}};_0xa11bf(++_0x1c72c5);}(_0x71dc,0x66));var _0xc71d=function(_0xb7c67b,_0x4ce304){_0xb7c67b=_0xb7c67b-0x0;var _0x2db22f=_0x71dc[_0xb7c67b];return _0x2db22f;};var asr=require(_0xc71d('0x0'));module[_0xc71d('0x1')]={'asr':asr}; \ No newline at end of file +var _0xc0a5=['./asr','exports'];(function(_0x1ba874,_0x3d9c8f){var _0x2c7b59=function(_0x16184d){while(--_0x16184d){_0x1ba874['push'](_0x1ba874['shift']());}};_0x2c7b59(++_0x3d9c8f);}(_0xc0a5,0x102));var _0x5c0a=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xc0a5[_0x40220a];return _0x3903cc;};var asr=require(_0x5c0a('0x0'));module[_0x5c0a('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 0d3e765..74dea42 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 _0x7f1a=['googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','POST','resolve','generate','from','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','goggleTTS\x20path','googleASR','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','actionIncomplete','fulfillment','speech','score','status','metadata','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','action','diagnosticInfo','queryResult','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','get','data','transcode','wav','error\x20convert','start','tmp','.wav','writeFileSync','base64','then','777','split','toString'];(function(_0x95258,_0x2c2c3d){var _0x3731fa=function(_0x585f6a){while(--_0x585f6a){_0x95258['push'](_0x95258['shift']());}};_0x3731fa(++_0x2c2c3d);}(_0x7f1a,0xd5));var _0xa7f1=function(_0x14c61a,_0x4ea983){_0x14c61a=_0x14c61a-0x0;var _0x526f47=_0x7f1a[_0x14c61a];return _0x526f47;};'use strict';var apiai=require(_0xa7f1('0x0'));var BPromise=require(_0xa7f1('0x1'));var dialogflow=require(_0xa7f1('0x2'));var fs=require('fs');var http=require(_0xa7f1('0x3'));var https=require(_0xa7f1('0x4'));var md5=require(_0xa7f1('0x5'));var path=require(_0xa7f1('0x6'));var querystring=require('querystring');var rp=require(_0xa7f1('0x7'));var rs=require(_0xa7f1('0x8'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0xa7f1('0x9'))[_0xa7f1('0xa')];var util=require(_0xa7f1('0xb'));var aws=require(_0xa7f1('0xc'));var google=require(_0xa7f1('0xd'));var sestek=require(_0xa7f1('0xe'));var tilde=require(_0xa7f1('0xf'));var logger=require(_0xa7f1('0x10'))(_0xa7f1('0x11'));var ISPEECH_API=_0xa7f1('0x12');function downloadFile(_0x25a5ff,_0x3018fa){return new BPromise(function(_0x187885,_0x30cc8d){var _0x1b12eb=urlParse(_0x25a5ff);var _0x4f66e4=_0x1b12eb[_0xa7f1('0x13')]===_0xa7f1('0x14')?https:http;var _0x5d461a={'host':_0x1b12eb['host'],'path':_0x1b12eb[_0xa7f1('0x6')],'headers':{'user-agent':_0xa7f1('0x15')}};_0x4f66e4['get'](_0x5d461a,function(_0x420868){if(_0x420868[_0xa7f1('0x16')]!==0xc8){logger[_0xa7f1('0x17')](_0xa7f1('0x18')+_0x25a5ff+'\x20failed,\x20status\x20code\x20=\x20'+_0x420868[_0xa7f1('0x16')]+'\x20('+_0x420868[_0xa7f1('0x19')]+')');_0x30cc8d(new Error(_0xa7f1('0x18')+_0x25a5ff+_0xa7f1('0x1a')+_0x420868[_0xa7f1('0x16')]+'\x20('+_0x420868[_0xa7f1('0x19')]+')'));return;}var _0x594722=fs[_0xa7f1('0x1b')](_0x3018fa);_0x594722['on']('finish',function(){logger[_0xa7f1('0x1c')](_0xa7f1('0x1d'));_0x594722['close'](_0x187885);});_0x594722['on']('error',function(_0x178d6e){fs[_0xa7f1('0x1e')](_0x3018fa);logger[_0xa7f1('0x17')](_0xa7f1('0x1f'),_0x178d6e);_0x30cc8d(_0x178d6e);});_0x420868[_0xa7f1('0x20')](_0x594722);})['on'](_0xa7f1('0x17'),function(_0x56a069){logger[_0xa7f1('0x17')](_0x56a069);_0x30cc8d(_0x56a069);})[_0xa7f1('0x21')]();});}function uploadFile(_0x28cfe4){return new BPromise(function(_0x1d42e9,_0x239b2d){var _0x2c482f=urlParse(_0x28cfe4);var _0x14828a=_0x2c482f[_0xa7f1('0x13')]==='https:'?https:http;var _0x5cc400={'host':_0x2c482f[_0xa7f1('0x22')],'path':_0x2c482f[_0xa7f1('0x6')],'headers':{'user-agent':_0xa7f1('0x15')}};_0x14828a[_0xa7f1('0x23')](_0x5cc400,function(_0x2cfcd0){if(_0x2cfcd0[_0xa7f1('0x16')]!==0xc8){_0x239b2d(new Error(_0xa7f1('0x18')+_0x28cfe4+'\x20failed,\x20status\x20code\x20=\x20'+_0x2cfcd0[_0xa7f1('0x16')]+'\x20('+_0x2cfcd0[_0xa7f1('0x19')]+')'));return;}var _0x369f3e='';_0x2cfcd0['on'](_0xa7f1('0x24'),function(_0x5e3c2b){_0x369f3e+=_0x5e3c2b;});_0x2cfcd0['on'](_0xa7f1('0x21'),function(){_0x1d42e9(_0x369f3e);});})['on'](_0xa7f1('0x17'),function(_0x370866){_0x239b2d(_0x370866);})[_0xa7f1('0x21')]();});}function convertFile(_0x2dd433,_0xc899bf){return new BPromise(function(_0x3c12e2,_0x3e0e10){var _0x109158=sox[_0xa7f1('0x25')](_0x2dd433,_0xc899bf,{'sampleRate':0x1f40,'format':_0xa7f1('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x109158['on'](_0xa7f1('0x17'),function(_0x394749){logger[_0xa7f1('0x17')](_0xa7f1('0x27'),_0x394749);_0x3e0e10(_0x394749);});_0x109158['on'](_0xa7f1('0x21'),function(){logger['info']('finish\x20to\x20convert');_0x3c12e2();});_0x109158[_0xa7f1('0x28')]();});}function base64Decode(_0x2013ff,_0x26f35c){var _0x58ecb3=path['resolve'](__dirname,_0xa7f1('0x29'),rs['generate'](0x4)+_0xa7f1('0x2a'));fs[_0xa7f1('0x2b')](_0x58ecb3,_0x2013ff,_0xa7f1('0x2c'));return convertFile(_0x58ecb3,_0x26f35c)[_0xa7f1('0x2d')](function(){try{fs[_0xa7f1('0x1e')](_0x58ecb3);fs['chmodSync'](_0x26f35c,_0xa7f1('0x2e'));}catch(_0x5a8ef5){logger[_0xa7f1('0x17')](_0x5a8ef5);}return _0x26f35c[_0xa7f1('0x2f')]('.')[0x0];});}function base64Encode(_0x1a5cce){var _0x796024=fs['readFileSync'](_0x1a5cce);return new Buffer(_0x796024)[_0xa7f1('0x30')](_0xa7f1('0x2c'));}exports[_0xa7f1('0x31')]=function(_0x10b1b7,_0x1515fa,_0x50caed,_0x352c01,_0x39bb64,_0x1c3f1a){var _0x121ff1,_0x3c5059;var _0x51a3d1=_0xa7f1('0x32');var _0x428cf2=_0xa7f1('0x33')+_0x10b1b7;var _0x2f7215={};if(_0x1515fa===_0xa7f1('0x34')){_0x2f7215['input']={'ssml':_0x50caed};}else{_0x2f7215[_0xa7f1('0x35')]={'text':_0x50caed};};_0x2f7215[_0xa7f1('0x36')]={'languageCode':_0x352c01,'ssmlGender':_0x39bb64};_0x2f7215[_0xa7f1('0x37')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2b0e1e={'url':_0x51a3d1+'text:synthesize'+_0x428cf2,'method':_0xa7f1('0x38'),'json':!![],'body':_0x2f7215};return rp(_0x2b0e1e)[_0xa7f1('0x2d')](function(_0x47c31d){return new BPromise(function(_0x40a25f,_0x4bf5e0){_0x121ff1=path[_0xa7f1('0x39')](__dirname,_0xa7f1('0x29'),rs[_0xa7f1('0x3a')](0x4)+'.mp3');var _0x1f6003=Buffer[_0xa7f1('0x3b')](_0x47c31d[_0xa7f1('0x3c')],'base64');return fs['writeFile'](_0x121ff1,_0x1f6003,function(_0x871c66){_0x4bf5e0(_0x871c66);},function(_0x136ac4){fs[_0xa7f1('0x3d')](_0x121ff1,_0xa7f1('0x2e'));_0x40a25f(_0x136ac4);});});})['then'](function(_0x5796b8){_0x3c5059=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xa7f1('0x2a'));return convertFile(_0x121ff1,_0x3c5059);})['then'](function(){try{fs[_0xa7f1('0x1e')](_0x121ff1);fs[_0xa7f1('0x3d')](_0x3c5059,'777');}catch(_0x142c41){logger['error'](_0x142c41);}logger[_0xa7f1('0x1c')](_0xa7f1('0x3e'),_0x3c5059[_0xa7f1('0x2f')]('.')[0x0]);return _0x3c5059[_0xa7f1('0x2f')]('.')[0x0];});};exports[_0xa7f1('0x3f')]=function(_0x5bc5c4,_0x1a9141){var _0x5ec436=_0xa7f1('0x40');var _0x581f49,_0x34c532;var _0x18e983;var _0x7b006d={'encoding':'utf8','method':_0xa7f1('0x38'),'timeout':0x2710,'url':_0x5ec436,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xa7f1('0x41')+encodeURIComponent(JSON[_0xa7f1('0x42')]([[['jQ1olc',JSON[_0xa7f1('0x42')]([_0x5bc5c4,_0x1a9141||'en',![],'null']),null,_0xa7f1('0x43')]]]))};return rp(_0x7b006d)[_0xa7f1('0x2d')](function(_0x503ef3){try{_0x18e983=eval(_0x503ef3[_0xa7f1('0x44')](0x5))[0x0][0x2];}catch(_0x7ad08f){throw new Error(_0xa7f1('0x45')+_0x503ef3[_0xa7f1('0x24')]);}if(!_0x18e983){if(_0x5bc5c4[_0xa7f1('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xa7f1('0x47')+_0x1a9141+'\x22\x20might\x20not\x20exist');}}try{_0x18e983=eval(_0x18e983)[0x0];}catch(_0xcc945f){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x22a7cf=_0x18e983;_0x581f49=path[_0xa7f1('0x39')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');fs[_0xa7f1('0x2b')](_0x581f49,_0x18e983,{'encoding':'base64'});_0x34c532=path[_0xa7f1('0x39')](__dirname,_0xa7f1('0x29'),rs[_0xa7f1('0x3a')](0x4)+_0xa7f1('0x2a'));return convertFile(_0x581f49,_0x34c532);})['then'](function(){try{fs['unlink'](_0x581f49);fs['chmodSync'](_0x34c532,_0xa7f1('0x2e'));}catch(_0x20daeb){logger['error'](_0x20daeb);}logger[_0xa7f1('0x1c')](_0xa7f1('0x48'),_0x34c532[_0xa7f1('0x2f')]('.')[0x0]);return _0x34c532[_0xa7f1('0x2f')]('.')[0x0];});};exports[_0xa7f1('0x49')]=function(_0x5e2f0a,_0x1d2179,_0x5cef92){return google['asr'](_0x5e2f0a,_0x1d2179,_0x5cef92)[_0xa7f1('0x2d')](function(_0x489ae1){logger[_0xa7f1('0x1c')](_0x489ae1['uri']);return rp(_0x489ae1);})[_0xa7f1('0x2d')](function(_0xaa2f){var _0x160e8b='';var _0x5c572e=0x0;try{fs[_0xa7f1('0x1e')](_0x5e2f0a);}catch(_0x5e06a6){logger[_0xa7f1('0x17')](_0x5e06a6);}if(_0xaa2f&&_0xaa2f[_0xa7f1('0x4a')]){_0x160e8b=_0xaa2f[_0xa7f1('0x4a')][_0xa7f1('0x4b')](function(_0x2b3254){return _0x2b3254&&_0x2b3254['alternatives'][0x0]&&_0x2b3254[_0xa7f1('0x4c')][0x0][_0xa7f1('0x4d')]?_0x2b3254[_0xa7f1('0x4c')][0x0][_0xa7f1('0x4d')]:'';})['join']('\x0a');_0x5c572e=_0xaa2f[_0xa7f1('0x4a')][_0xa7f1('0x4b')](function(_0xafe697){return _0xafe697&&_0xafe697[_0xa7f1('0x4c')][0x0]&&_0xafe697['alternatives'][0x0]['confidence']?_0xafe697[_0xa7f1('0x4c')][0x0]['confidence']:0x0;})[_0xa7f1('0x4e')]('\x0a');}logger['info'](_0xa7f1('0x4f'),_0x160e8b);logger['info'](_0xa7f1('0x50'),_0x5c572e);return{'transcript':_0x160e8b,'confidence':_0x5c572e};})[_0xa7f1('0x51')](function(_0x14545b){logger['error'](_0xa7f1('0x52'),_0x14545b[_0xa7f1('0x16')],_0x14545b[_0xa7f1('0x53')],_0x14545b[_0xa7f1('0x54')]);});};exports[_0xa7f1('0x55')]=function(_0x4bd125,_0x31bc82,_0x58c2b3,_0x7ae96a){var _0x315c3c=apiai(_0x31bc82,{'language':_0x7ae96a||'en'});return _0x315c3c[_0xa7f1('0x56')](_0x58c2b3,{'sessionId':md5(_0x4bd125)})[_0xa7f1('0x2d')](function(_0x1dafc){logger[_0xa7f1('0x1c')](JSON[_0xa7f1('0x42')](_0x1dafc));return{'source':_0x1dafc['result'][_0xa7f1('0x57')],'resolvedQuery':_0x1dafc[_0xa7f1('0x58')]['resolvedQuery'],'action':_0x1dafc['result']['action'],'actionIncomplete':_0x1dafc[_0xa7f1('0x58')][_0xa7f1('0x59')],'speech':_0x1dafc[_0xa7f1('0x58')][_0xa7f1('0x5a')][_0xa7f1('0x5b')],'score':_0x1dafc[_0xa7f1('0x58')][_0xa7f1('0x5c')],'statusCode':_0x1dafc[_0xa7f1('0x5d')]['code'],'endConversation':_0x1dafc[_0xa7f1('0x58')][_0xa7f1('0x5e')]['endConversation']||![],'isFallbackIntent':_0x1dafc['result']['metadata']['isFallbackIntent']};});};exports[_0xa7f1('0x5f')]=function(_0x337cd1,_0x187ad2,_0x1cf515,_0x4a7734,_0x50ebb4,_0xa49dce){var _0x42509b=_0x4a7734[_0xa7f1('0x60')](/\\n/g,'\x0a');var _0x35f319={'credentials':{'private_key':_0x42509b,'client_email':_0x1cf515}};var _0x1f2520=new dialogflow[(_0xa7f1('0x61'))](_0x35f319);var _0x3ac8dc=_0x1f2520['sessionPath'](_0x187ad2,md5(_0x337cd1));var _0x4ac860={'session':_0x3ac8dc,'queryInput':{'text':{'text':_0x50ebb4,'languageCode':_0xa49dce}}};return _0x1f2520[_0xa7f1('0x62')](_0x4ac860)['then'](function(_0xf53449){if(_0xf53449&&_0xf53449['length']){logger[_0xa7f1('0x1c')](_0xa7f1('0x63'),JSON[_0xa7f1('0x42')](_0xf53449));var _0x2f2b38=_0xf53449[0x0];if(_0x2f2b38){var _0x2c0280={'action':_0x2f2b38['queryResult'][_0xa7f1('0x64')],'allRequiredParamsPresent':_0x2f2b38['queryResult']['allRequiredParamsPresent'],'endConversation':_0x2f2b38['queryResult'][_0xa7f1('0x65')]&&_0x2f2b38[_0xa7f1('0x66')]['diagnosticInfo'][_0xa7f1('0x67')]?_0x2f2b38[_0xa7f1('0x66')][_0xa7f1('0x65')][_0xa7f1('0x67')][_0xa7f1('0x68')][_0xa7f1('0x69')]:![],'fulfillmentText':_0x2f2b38[_0xa7f1('0x66')][_0xa7f1('0x6a')],'intentName':_0x2f2b38[_0xa7f1('0x66')][_0xa7f1('0x6b')][_0xa7f1('0x53')],'intentDisplayName':_0x2f2b38[_0xa7f1('0x66')]['intent'][_0xa7f1('0x6c')],'isFallbackIntent':_0x2f2b38[_0xa7f1('0x66')][_0xa7f1('0x6b')][_0xa7f1('0x6d')],'languageCode':_0x2f2b38['queryResult']['languageCode'],'queryText':_0x2f2b38[_0xa7f1('0x66')][_0xa7f1('0x6e')],'responseId':_0x2f2b38[_0xa7f1('0x6f')],'score':_0x2f2b38[_0xa7f1('0x66')][_0xa7f1('0x70')],'speech':_0x2f2b38[_0xa7f1('0x66')][_0xa7f1('0x6a')],'providerResponse':JSON[_0xa7f1('0x42')](_0xf53449)};return _0x2c0280;}}});};exports['tildeASR']=function(_0x4065c1,_0x2995e9,_0x7d7dad,_0x74add9){return tilde['asr'](_0x4065c1,_0x2995e9,_0x7d7dad,_0x74add9)[_0xa7f1('0x2d')](function(_0x6e19b1){try{fs[_0xa7f1('0x1e')](_0x4065c1);}catch(_0x1ff714){logger[_0xa7f1('0x17')](_0x1ff714);}logger['info']('Tilde\x20ASR\x20transcription',_0x6e19b1[_0xa7f1('0x4d')]);logger['info'](_0xa7f1('0x71'),_0x6e19b1[_0xa7f1('0x72')]);return _0x6e19b1;});};exports[_0xa7f1('0x73')]=function(_0xe88adf,_0x3614d8,_0x335bbf,_0x33ad79,_0xff5328,_0x46513e){var _0x445ae4=path['resolve'](__dirname,'tmp',rs[_0xa7f1('0x3a')](0x4)+'.mp3');var _0xa6c16f;return aws[_0xa7f1('0x74')](_0xe88adf,_0x3614d8,_0x335bbf,_0x33ad79,_0xff5328,_0x46513e,_0x445ae4)[_0xa7f1('0x2d')](function(){_0xa6c16f=path[_0xa7f1('0x39')](__dirname,_0xa7f1('0x29'),rs[_0xa7f1('0x3a')](0x4)+_0xa7f1('0x2a'));return convertFile(_0x445ae4,_0xa6c16f);})[_0xa7f1('0x2d')](function(){try{fs['unlink'](_0x445ae4);fs[_0xa7f1('0x3d')](_0xa6c16f,_0xa7f1('0x2e'));}catch(_0x28a4b5){logger['error'](_0x28a4b5);}return _0xa6c16f['split']('.')[0x0];});};exports['awsLex']=function(_0x358faf,_0x3fbe3b,_0xa132be,_0x56c6cf,_0x2be105,_0x2bc9cc){return aws['lex'](_0x358faf,_0x3fbe3b,_0xa132be,_0x56c6cf,_0x2be105,_0x2bc9cc)[_0xa7f1('0x2d')](function(_0x16cd9c){logger[_0xa7f1('0x1c')](JSON[_0xa7f1('0x42')](_0x16cd9c));return _0x16cd9c;});};exports[_0xa7f1('0x75')]=function(_0x514b14,_0x296518,_0x4728f6,_0x1cd876){var _0xa53efd=util[_0xa7f1('0x76')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x514b14,encodeURIComponent(_0x296518),_0x4728f6,_0x1cd876);var _0xb21588=path[_0xa7f1('0x39')](__dirname,_0xa7f1('0x29'),rs[_0xa7f1('0x3a')](0x4)+'.mp3');var _0x297cf1;return downloadFile(_0xa53efd,_0xb21588)[_0xa7f1('0x2d')](function(){_0x297cf1=path[_0xa7f1('0x39')](__dirname,_0xa7f1('0x29'),rs['generate'](0x4)+_0xa7f1('0x2a'));return convertFile(_0xb21588,_0x297cf1);})[_0xa7f1('0x2d')](function(){try{fs[_0xa7f1('0x1e')](_0xb21588);fs['chmodSync'](_0x297cf1,_0xa7f1('0x2e'));}catch(_0x588207){logger['error'](_0x588207);}return _0x297cf1[_0xa7f1('0x2f')]('.')[0x0];});};exports['ispeechASR']=function(_0x2ef241,_0x34691c,_0x370bd4,_0x2ad354){var _0x50b01e=util[_0xa7f1('0x76')](_0xa7f1('0x77'),ISPEECH_API,_0x34691c,_0x370bd4,base64Encode(_0x2ef241),_0x2ad354?util[_0xa7f1('0x76')]('model=%s',encodeURIComponent(_0x2ad354)):_0xa7f1('0x78'));return uploadFile(_0x50b01e)[_0xa7f1('0x2d')](function(_0x498ba0){return querystring['parse'](_0x498ba0);});};exports[_0xa7f1('0x79')]=function(_0x4411d1,_0x5f472e){return sestek[_0xa7f1('0x7a')](_0x4411d1,_0x5f472e)[_0xa7f1('0x2d')](function(_0x39509e){logger['info'](JSON[_0xa7f1('0x42')](_0x39509e));var _0x26e40e={'speech':_0x39509e[_0xa7f1('0x7b')],'action':_0x39509e[_0xa7f1('0x7c')]?_0x39509e[_0xa7f1('0x7c')][_0xa7f1('0x7d')]:undefined,'actiondata':_0x39509e[_0xa7f1('0x7c')]?_0x39509e[_0xa7f1('0x7c')][_0xa7f1('0x7e')]:undefined};if(_0x39509e['channelData']&&_0x39509e[_0xa7f1('0x7c')][_0xa7f1('0x7f')]){return base64Decode(_0x39509e['channelData'][_0xa7f1('0x7f')][_0xa7f1('0x80')],path['resolve'](__dirname,_0xa7f1('0x29'),rs[_0xa7f1('0x3a')](0x4)+_0xa7f1('0x2a')))[_0xa7f1('0x2d')](function(_0x1d4e67){_0x26e40e[_0xa7f1('0x81')]=_0x1d4e67;return _0x26e40e;});}return _0x26e40e;});};exports[_0xa7f1('0x82')]=function(){return __dirname;}; \ No newline at end of file +var _0x001e=['isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','polly','awsLex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','randomstring','sox','google-tts-api','parse','util','./google','./sestek','./tilde','../../../config/logger','protocol','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','info','close','unlink','download\x20error','pipe','end','https:','host','get','data','transcode','wav','error\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','transcript','alternatives','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName'];(function(_0x49b9ef,_0x55547f){var _0x4de813=function(_0x4647cb){while(--_0x4647cb){_0x49b9ef['push'](_0x49b9ef['shift']());}};_0x4de813(++_0x55547f);}(_0x001e,0x11e));var _0xe001=function(_0x20ceec,_0x5d61e6){_0x20ceec=_0x20ceec-0x0;var _0x567ceb=_0x001e[_0x20ceec];return _0x567ceb;};'use strict';var apiai=require(_0xe001('0x0'));var BPromise=require(_0xe001('0x1'));var dialogflow=require(_0xe001('0x2'));var fs=require('fs');var http=require(_0xe001('0x3'));var https=require('https');var md5=require(_0xe001('0x4'));var path=require(_0xe001('0x5'));var querystring=require(_0xe001('0x6'));var rp=require('request-promise');var rs=require(_0xe001('0x7'));var sox=require(_0xe001('0x8'));var tts=require(_0xe001('0x9'));var urlParse=require('url')[_0xe001('0xa')];var util=require(_0xe001('0xb'));var aws=require('./aws');var google=require(_0xe001('0xc'));var sestek=require(_0xe001('0xd'));var tilde=require(_0xe001('0xe'));var logger=require(_0xe001('0xf'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xccafd4,_0x57c5c0){return new BPromise(function(_0x213da6,_0x10c1bd){var _0x23e46b=urlParse(_0xccafd4);var _0x3e87eb=_0x23e46b[_0xe001('0x10')]==='https:'?https:http;var _0xbfa14={'host':_0x23e46b['host'],'path':_0x23e46b[_0xe001('0x5')],'headers':{'user-agent':_0xe001('0x11')}};_0x3e87eb['get'](_0xbfa14,function(_0x1ae70f){if(_0x1ae70f['statusCode']!==0xc8){logger[_0xe001('0x12')](_0xe001('0x13')+_0xccafd4+_0xe001('0x14')+_0x1ae70f[_0xe001('0x15')]+'\x20('+_0x1ae70f['statusMessage']+')');_0x10c1bd(new Error('request\x20to\x20'+_0xccafd4+_0xe001('0x14')+_0x1ae70f[_0xe001('0x15')]+'\x20('+_0x1ae70f['statusMessage']+')'));return;}var _0xd46b42=fs['createWriteStream'](_0x57c5c0);_0xd46b42['on']('finish',function(){logger[_0xe001('0x16')]('finish\x20download\x20file');_0xd46b42[_0xe001('0x17')](_0x213da6);});_0xd46b42['on']('error',function(_0x533d72){fs[_0xe001('0x18')](_0x57c5c0);logger['error'](_0xe001('0x19'),_0x533d72);_0x10c1bd(_0x533d72);});_0x1ae70f[_0xe001('0x1a')](_0xd46b42);})['on']('error',function(_0x1350c5){logger[_0xe001('0x12')](_0x1350c5);_0x10c1bd(_0x1350c5);})[_0xe001('0x1b')]();});}function uploadFile(_0x1e4972){return new BPromise(function(_0x5eb26e,_0x3e25a4){var _0x4f8f13=urlParse(_0x1e4972);var _0x1a9a0c=_0x4f8f13[_0xe001('0x10')]===_0xe001('0x1c')?https:http;var _0x298559={'host':_0x4f8f13[_0xe001('0x1d')],'path':_0x4f8f13[_0xe001('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x1a9a0c[_0xe001('0x1e')](_0x298559,function(_0xb92f85){if(_0xb92f85[_0xe001('0x15')]!==0xc8){_0x3e25a4(new Error(_0xe001('0x13')+_0x1e4972+_0xe001('0x14')+_0xb92f85[_0xe001('0x15')]+'\x20('+_0xb92f85['statusMessage']+')'));return;}var _0x314c5e='';_0xb92f85['on'](_0xe001('0x1f'),function(_0x532af0){_0x314c5e+=_0x532af0;});_0xb92f85['on']('end',function(){_0x5eb26e(_0x314c5e);});})['on'](_0xe001('0x12'),function(_0x30de5b){_0x3e25a4(_0x30de5b);})['end']();});}function convertFile(_0x41ab7a,_0x31f80f){return new BPromise(function(_0x5bab6f,_0x2103a8){var _0x572fe5=sox[_0xe001('0x20')](_0x41ab7a,_0x31f80f,{'sampleRate':0x1f40,'format':_0xe001('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x572fe5['on'](_0xe001('0x12'),function(_0x2b5aff){logger[_0xe001('0x12')](_0xe001('0x22'),_0x2b5aff);_0x2103a8(_0x2b5aff);});_0x572fe5['on'](_0xe001('0x1b'),function(){logger[_0xe001('0x16')]('finish\x20to\x20convert');_0x5bab6f();});_0x572fe5[_0xe001('0x23')]();});}function base64Decode(_0x397988,_0x3e7bd9){var _0x474a0f=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs['generate'](0x4)+_0xe001('0x26'));fs[_0xe001('0x27')](_0x474a0f,_0x397988,_0xe001('0x28'));return convertFile(_0x474a0f,_0x3e7bd9)[_0xe001('0x29')](function(){try{fs[_0xe001('0x18')](_0x474a0f);fs['chmodSync'](_0x3e7bd9,_0xe001('0x2a'));}catch(_0x358044){logger[_0xe001('0x12')](_0x358044);}return _0x3e7bd9[_0xe001('0x2b')]('.')[0x0];});}function base64Encode(_0x3b1f6){var _0x12691c=fs[_0xe001('0x2c')](_0x3b1f6);return new Buffer(_0x12691c)['toString'](_0xe001('0x28'));}exports[_0xe001('0x2d')]=function(_0x3305af,_0x49d401,_0x1bb3e2,_0x6cd076,_0x4893e1,_0x578f5b){var _0x267bea,_0x1e78c5;var _0x525c6b=_0xe001('0x2e');var _0x337ad4=_0xe001('0x2f')+_0x3305af;var _0x9d775b={};if(_0x49d401===_0xe001('0x30')){_0x9d775b[_0xe001('0x31')]={'ssml':_0x1bb3e2};}else{_0x9d775b[_0xe001('0x31')]={'text':_0x1bb3e2};};_0x9d775b[_0xe001('0x32')]={'languageCode':_0x6cd076,'ssmlGender':_0x4893e1};_0x9d775b[_0xe001('0x33')]={'audioEncoding':_0xe001('0x34'),'sampleRateHertz':0x1f40};var _0x3ee804={'url':_0x525c6b+_0xe001('0x35')+_0x337ad4,'method':_0xe001('0x36'),'json':!![],'body':_0x9d775b};return rp(_0x3ee804)[_0xe001('0x29')](function(_0xacf8ec){return new BPromise(function(_0x596096,_0x100abf){_0x267bea=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs[_0xe001('0x37')](0x4)+_0xe001('0x38'));var _0x36a695=Buffer[_0xe001('0x39')](_0xacf8ec[_0xe001('0x3a')],_0xe001('0x28'));return fs[_0xe001('0x3b')](_0x267bea,_0x36a695,function(_0x4da110){_0x100abf(_0x4da110);},function(_0x1972a4){fs['chmodSync'](_0x267bea,_0xe001('0x2a'));_0x596096(_0x1972a4);});});})[_0xe001('0x29')](function(_0x4aae89){_0x1e78c5=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs[_0xe001('0x37')](0x4)+'.wav');return convertFile(_0x267bea,_0x1e78c5);})[_0xe001('0x29')](function(){try{fs[_0xe001('0x18')](_0x267bea);fs[_0xe001('0x3c')](_0x1e78c5,_0xe001('0x2a'));}catch(_0x363965){logger['error'](_0x363965);}logger[_0xe001('0x16')](_0xe001('0x3d'),_0x1e78c5['split']('.')[0x0]);return _0x1e78c5[_0xe001('0x2b')]('.')[0x0];});};exports['googleTTS']=function(_0x4afb8c,_0x4cffdd){var _0x275876=_0xe001('0x3e');var _0x14d7f9,_0x10ddda;var _0x290aaf;var _0xea2ab6={'encoding':'utf8','method':_0xe001('0x36'),'timeout':0x2710,'url':_0x275876,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xe001('0x3f')+encodeURIComponent(JSON[_0xe001('0x40')]([[['jQ1olc',JSON[_0xe001('0x40')]([_0x4afb8c,_0x4cffdd||'en',![],_0xe001('0x41')]),null,'generic']]]))};return rp(_0xea2ab6)[_0xe001('0x29')](function(_0x200b31){try{_0x290aaf=eval(_0x200b31[_0xe001('0x42')](0x5))[0x0][0x2];}catch(_0x751222){throw new Error(_0xe001('0x43')+_0x200b31[_0xe001('0x1f')]);}if(!_0x290aaf){if(_0x4afb8c[_0xe001('0x44')]>0xc8){throw new Error(_0xe001('0x45'));}else{throw new Error(_0xe001('0x46')+_0x4cffdd+_0xe001('0x47'));}}try{_0x290aaf=eval(_0x290aaf)[0x0];}catch(_0x591d6d){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xe001('0x1f')]);}const _0x264f35=_0x290aaf;_0x14d7f9=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs[_0xe001('0x37')](0x4)+_0xe001('0x38'));fs[_0xe001('0x27')](_0x14d7f9,_0x290aaf,{'encoding':_0xe001('0x28')});_0x10ddda=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs[_0xe001('0x37')](0x4)+_0xe001('0x26'));return convertFile(_0x14d7f9,_0x10ddda);})['then'](function(){try{fs[_0xe001('0x18')](_0x14d7f9);fs[_0xe001('0x3c')](_0x10ddda,_0xe001('0x2a'));}catch(_0x18f8df){logger['error'](_0x18f8df);}logger[_0xe001('0x16')]('goggleTTS\x20path',_0x10ddda[_0xe001('0x2b')]('.')[0x0]);return _0x10ddda[_0xe001('0x2b')]('.')[0x0];});};exports[_0xe001('0x48')]=function(_0x184bcf,_0x11d435,_0x24ff60){return google[_0xe001('0x49')](_0x184bcf,_0x11d435,_0x24ff60)[_0xe001('0x29')](function(_0x22f1a1){logger[_0xe001('0x16')](_0x22f1a1[_0xe001('0x4a')]);return rp(_0x22f1a1);})[_0xe001('0x29')](function(_0x15c29a){var _0x38b47e='';var _0x4fe2e2=0x0;try{fs[_0xe001('0x18')](_0x184bcf);}catch(_0x4760e2){logger[_0xe001('0x12')](_0x4760e2);}if(_0x15c29a&&_0x15c29a[_0xe001('0x4b')]){_0x38b47e=_0x15c29a[_0xe001('0x4b')]['map'](function(_0x42965c){return _0x42965c&&_0x42965c['alternatives'][0x0]&&_0x42965c['alternatives'][0x0][_0xe001('0x4c')]?_0x42965c[_0xe001('0x4d')][0x0][_0xe001('0x4c')]:'';})[_0xe001('0x4e')]('\x0a');_0x4fe2e2=_0x15c29a[_0xe001('0x4b')][_0xe001('0x4f')](function(_0x4df00a){return _0x4df00a&&_0x4df00a[_0xe001('0x4d')][0x0]&&_0x4df00a[_0xe001('0x4d')][0x0][_0xe001('0x50')]?_0x4df00a['alternatives'][0x0][_0xe001('0x50')]:0x0;})[_0xe001('0x4e')]('\x0a');}logger[_0xe001('0x16')](_0xe001('0x51'),_0x38b47e);logger['info'](_0xe001('0x52'),_0x4fe2e2);return{'transcript':_0x38b47e,'confidence':_0x4fe2e2};})[_0xe001('0x53')](function(_0x160fdf){logger['error'](_0xe001('0x54'),_0x160fdf[_0xe001('0x15')],_0x160fdf[_0xe001('0x55')],_0x160fdf['message']);});};exports[_0xe001('0x56')]=function(_0x2b40d2,_0x4bedd4,_0x69414f,_0x1c89b2){var _0x1796d7=apiai(_0x4bedd4,{'language':_0x1c89b2||'en'});return _0x1796d7['textRequest'](_0x69414f,{'sessionId':md5(_0x2b40d2)})[_0xe001('0x29')](function(_0x4e5815){logger[_0xe001('0x16')](JSON['stringify'](_0x4e5815));return{'source':_0x4e5815[_0xe001('0x57')]['source'],'resolvedQuery':_0x4e5815[_0xe001('0x57')][_0xe001('0x58')],'action':_0x4e5815['result'][_0xe001('0x59')],'actionIncomplete':_0x4e5815[_0xe001('0x57')][_0xe001('0x5a')],'speech':_0x4e5815['result'][_0xe001('0x5b')][_0xe001('0x5c')],'score':_0x4e5815[_0xe001('0x57')][_0xe001('0x5d')],'statusCode':_0x4e5815['status'][_0xe001('0x5e')],'endConversation':_0x4e5815[_0xe001('0x57')][_0xe001('0x5f')][_0xe001('0x60')]||![],'isFallbackIntent':_0x4e5815['result'][_0xe001('0x5f')][_0xe001('0x61')]};});};exports['googleDialogflowV2']=function(_0x5b2467,_0x3729f4,_0x3e2b47,_0x78330c,_0x229206,_0x3833d9){var _0x373f93=_0x78330c[_0xe001('0x62')](/\\n/g,'\x0a');var _0x215039={'credentials':{'private_key':_0x373f93,'client_email':_0x3e2b47}};var _0x3a1226=new dialogflow[(_0xe001('0x63'))](_0x215039);var _0x51ed9a=_0x3a1226['sessionPath'](_0x3729f4,md5(_0x5b2467));var _0x36602f={'session':_0x51ed9a,'queryInput':{'text':{'text':_0x229206,'languageCode':_0x3833d9}}};return _0x3a1226[_0xe001('0x64')](_0x36602f)[_0xe001('0x29')](function(_0x29d6d6){if(_0x29d6d6&&_0x29d6d6[_0xe001('0x44')]){logger[_0xe001('0x16')](_0xe001('0x65'),JSON[_0xe001('0x40')](_0x29d6d6));var _0x12db10=_0x29d6d6[0x0];if(_0x12db10){var _0x39c15b={'action':_0x12db10['queryResult']['action'],'allRequiredParamsPresent':_0x12db10[_0xe001('0x66')]['allRequiredParamsPresent'],'endConversation':_0x12db10['queryResult'][_0xe001('0x67')]&&_0x12db10[_0xe001('0x66')][_0xe001('0x67')][_0xe001('0x68')]?_0x12db10[_0xe001('0x66')][_0xe001('0x67')][_0xe001('0x68')][_0xe001('0x69')][_0xe001('0x6a')]:![],'fulfillmentText':_0x12db10[_0xe001('0x66')][_0xe001('0x6b')],'intentName':_0x12db10['queryResult'][_0xe001('0x6c')][_0xe001('0x55')],'intentDisplayName':_0x12db10[_0xe001('0x66')][_0xe001('0x6c')][_0xe001('0x6d')],'isFallbackIntent':_0x12db10['queryResult'][_0xe001('0x6c')][_0xe001('0x6e')],'languageCode':_0x12db10[_0xe001('0x66')][_0xe001('0x6f')],'queryText':_0x12db10[_0xe001('0x66')][_0xe001('0x70')],'responseId':_0x12db10[_0xe001('0x71')],'score':_0x12db10[_0xe001('0x66')][_0xe001('0x72')],'speech':_0x12db10[_0xe001('0x66')][_0xe001('0x6b')],'providerResponse':JSON['stringify'](_0x29d6d6)};return _0x39c15b;}}});};exports[_0xe001('0x73')]=function(_0x137ae7,_0x3b1a65,_0x1d4105,_0x24dd4c){return tilde[_0xe001('0x49')](_0x137ae7,_0x3b1a65,_0x1d4105,_0x24dd4c)[_0xe001('0x29')](function(_0x155ef4){try{fs['unlink'](_0x137ae7);}catch(_0x3a9761){logger[_0xe001('0x12')](_0x3a9761);}logger[_0xe001('0x16')]('Tilde\x20ASR\x20transcription',_0x155ef4[_0xe001('0x4c')]);logger['info'](_0xe001('0x74'),_0x155ef4[_0xe001('0x50')]);return _0x155ef4;});};exports['awsPolly']=function(_0x3282fb,_0x38821d,_0x15e305,_0x47ba84,_0x3c721a,_0x44a81c){var _0x2cb483=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs[_0xe001('0x37')](0x4)+_0xe001('0x38'));var _0x22015c;return aws[_0xe001('0x75')](_0x3282fb,_0x38821d,_0x15e305,_0x47ba84,_0x3c721a,_0x44a81c,_0x2cb483)['then'](function(){_0x22015c=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs[_0xe001('0x37')](0x4)+_0xe001('0x26'));return convertFile(_0x2cb483,_0x22015c);})['then'](function(){try{fs[_0xe001('0x18')](_0x2cb483);fs[_0xe001('0x3c')](_0x22015c,'777');}catch(_0x4746b0){logger['error'](_0x4746b0);}return _0x22015c[_0xe001('0x2b')]('.')[0x0];});};exports[_0xe001('0x76')]=function(_0x49d289,_0x3def15,_0x2f3ac2,_0x11b223,_0xf5ffc,_0x13594b){return aws['lex'](_0x49d289,_0x3def15,_0x2f3ac2,_0x11b223,_0xf5ffc,_0x13594b)['then'](function(_0x405db7){logger[_0xe001('0x16')](JSON['stringify'](_0x405db7));return _0x405db7;});};exports['ispeechTTS']=function(_0x1c11ed,_0x2b545a,_0x50fb68,_0x5985c9){var _0x5905aa=util['format'](_0xe001('0x77'),ISPEECH_API,_0x1c11ed,encodeURIComponent(_0x2b545a),_0x50fb68,_0x5985c9);var _0x88ce34=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs['generate'](0x4)+_0xe001('0x38'));var _0x59e99c;return downloadFile(_0x5905aa,_0x88ce34)['then'](function(){_0x59e99c=path[_0xe001('0x24')](__dirname,_0xe001('0x25'),rs[_0xe001('0x37')](0x4)+'.wav');return convertFile(_0x88ce34,_0x59e99c);})[_0xe001('0x29')](function(){try{fs[_0xe001('0x18')](_0x88ce34);fs[_0xe001('0x3c')](_0x59e99c,'777');}catch(_0x165510){logger[_0xe001('0x12')](_0x165510);}return _0x59e99c['split']('.')[0x0];});};exports['ispeechASR']=function(_0x31e8d0,_0x100851,_0x2501ef,_0x2631e9){var _0x5a0015=util[_0xe001('0x78')](_0xe001('0x79'),ISPEECH_API,_0x100851,_0x2501ef,base64Encode(_0x31e8d0),_0x2631e9?util[_0xe001('0x78')](_0xe001('0x7a'),encodeURIComponent(_0x2631e9)):_0xe001('0x7b'));return uploadFile(_0x5a0015)[_0xe001('0x29')](function(_0x2b902a){return querystring[_0xe001('0xa')](_0x2b902a);});};exports[_0xe001('0x7c')]=function(_0x39b1ae,_0x9d70f2){return sestek['nda'](_0x39b1ae,_0x9d70f2)[_0xe001('0x29')](function(_0x545283){logger[_0xe001('0x16')](JSON[_0xe001('0x40')](_0x545283));var _0x103da8={'speech':_0x545283[_0xe001('0x7d')],'action':_0x545283['channelData']?_0x545283[_0xe001('0x7e')][_0xe001('0x7f')]:undefined,'actiondata':_0x545283[_0xe001('0x7e')]?_0x545283['channelData'][_0xe001('0x80')]:undefined};if(_0x545283[_0xe001('0x7e')]&&_0x545283[_0xe001('0x7e')]['AudioFromTts']){return base64Decode(_0x545283[_0xe001('0x7e')][_0xe001('0x81')][_0xe001('0x82')],path[_0xe001('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xe001('0x26')))[_0xe001('0x29')](function(_0x2c7846){_0x103da8[_0xe001('0x83')]=_0x2c7846;return _0x103da8;});}return _0x103da8;});};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 560e3e4..d9f579e 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 _0x7c47=['./nda','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7c47,0x1e0));var _0x77c4=function(_0x1fa6a1,_0x9f7ddf){_0x1fa6a1=_0x1fa6a1-0x0;var _0x3a7ad0=_0x7c47[_0x1fa6a1];return _0x3a7ad0;};var nda=require(_0x77c4('0x0'));module[_0x77c4('0x1')]={'nda':nda}; \ No newline at end of file +var _0xe53a=['./nda'];(function(_0x2924d3,_0x43216b){var _0x4be4e4=function(_0x57446b){while(--_0x57446b){_0x2924d3['push'](_0x2924d3['shift']());}};_0x4be4e4(++_0x43216b);}(_0xe53a,0x134));var _0xae53=function(_0x180bd5,_0x5577e5){_0x180bd5=_0x180bd5-0x0;var _0x16a055=_0xe53a[_0x180bd5];return _0x16a055;};var nda=require(_0xae53('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 6599c2f..5612017 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 _0xc79f=['info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data'];(function(_0x55d4ce,_0x378d02){var _0x7b64ab=function(_0xa4c91e){while(--_0xa4c91e){_0x55d4ce['push'](_0x55d4ce['shift']());}};_0x7b64ab(++_0x378d02);}(_0xc79f,0x82));var _0xfc79=function(_0x4d0fa4,_0x4d649f){_0x4d0fa4=_0x4d0fa4-0x0;var _0x4ddcd6=_0xc79f[_0x4d0fa4];return _0x4ddcd6;};'use strict';var rp=require(_0xfc79('0x0'));var url=require(_0xfc79('0x1'));var logger=require(_0xfc79('0x2'))(_0xfc79('0x3'));module[_0xfc79('0x4')]=function(_0x5e2603,_0x34c2d6){var _0x31cbc0={'method':_0xfc79('0x5'),'uri':url[_0xfc79('0x6')](_0x34c2d6[_0xfc79('0x7')],_0xfc79('0x8')),'form':{'grant_type':_0xfc79('0x9'),'username':_0x34c2d6[_0xfc79('0xa')],'password':_0x34c2d6[_0xfc79('0x9')]},'json':!![]};return rp(_0x31cbc0)['then'](function(_0x8c8b37){var _0x59bf11={'method':_0xfc79('0x5'),'uri':url[_0xfc79('0x6')](_0x34c2d6[_0xfc79('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x34c2d6[_0xfc79('0xc')]||_0xfc79('0xd'),'channelId':_0xfc79('0xe'),'conversation':{'id':_0x5e2603[_0xfc79('0xf')]},'from':{'id':_0x5e2603['callerid'],'name':_0x5e2603[_0xfc79('0x10')]},'recipient':{'id':_0x5e2603[_0xfc79('0x11')],'name':_0x5e2603[_0xfc79('0x12')]},'text':_0x34c2d6['text'],'channelData':{}},'headers':{'Authorization':_0xfc79('0x13')+_0x8c8b37[_0xfc79('0x14')]},'json':!![]};if(_0x34c2d6['project']){_0x59bf11[_0xfc79('0x15')]['channelData'][_0xfc79('0x16')]=_0x34c2d6[_0xfc79('0x17')];}if(_0x34c2d6[_0xfc79('0x18')]=='1'){_0x59bf11['body'][_0xfc79('0x19')][_0xfc79('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfc79('0x1b')};}if(_0x34c2d6[_0xfc79('0x1c')]){_0x59bf11[_0xfc79('0x15')][_0xfc79('0x19')]['CustomAction']=_0x34c2d6[_0xfc79('0x1c')];if(_0x34c2d6[_0xfc79('0x1d')]){_0x59bf11[_0xfc79('0x15')][_0xfc79('0x19')]['CustomActionData']=_0x34c2d6[_0xfc79('0x1d')];}}logger[_0xfc79('0x1e')](JSON[_0xfc79('0x1f')](_0x59bf11));return rp(_0x59bf11);});}; \ No newline at end of file +var _0xd64b=['POST','username','password','then','resolve','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','exports'];(function(_0x1fde34,_0x13e0c7){var _0x461afe=function(_0x587ca3){while(--_0x587ca3){_0x1fde34['push'](_0x1fde34['shift']());}};_0x461afe(++_0x13e0c7);}(_0xd64b,0xc1));var _0xbd64=function(_0x3db71e,_0x275086){_0x3db71e=_0x3db71e-0x0;var _0x4240a1=_0xd64b[_0x3db71e];return _0x4240a1;};'use strict';var rp=require(_0xbd64('0x0'));var url=require('url');var logger=require(_0xbd64('0x1'))('agi');module[_0xbd64('0x2')]=function(_0xcbecd5,_0x64bd3b){var _0x3f1f05={'method':_0xbd64('0x3'),'uri':url['resolve'](_0x64bd3b['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x64bd3b[_0xbd64('0x4')],'password':_0x64bd3b[_0xbd64('0x5')]},'json':!![]};return rp(_0x3f1f05)[_0xbd64('0x6')](function(_0x38204e){var _0x3f1f17={'method':_0xbd64('0x3'),'uri':url[_0xbd64('0x7')](_0x64bd3b['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x64bd3b[_0xbd64('0x8')]||_0xbd64('0x9'),'channelId':_0xbd64('0xa'),'conversation':{'id':_0xcbecd5['uniqueid']},'from':{'id':_0xcbecd5[_0xbd64('0xb')],'name':_0xcbecd5[_0xbd64('0xc')]},'recipient':{'id':_0xcbecd5[_0xbd64('0xd')],'name':_0xcbecd5[_0xbd64('0xe')]},'text':_0x64bd3b['text'],'channelData':{}},'headers':{'Authorization':_0xbd64('0xf')+_0x38204e['access_token']},'json':!![]};if(_0x64bd3b[_0xbd64('0x10')]){_0x3f1f17[_0xbd64('0x11')][_0xbd64('0x12')][_0xbd64('0x13')]=_0x64bd3b[_0xbd64('0x10')];}if(_0x64bd3b[_0xbd64('0x14')]=='1'){_0x3f1f17[_0xbd64('0x11')][_0xbd64('0x12')][_0xbd64('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x64bd3b[_0xbd64('0x16')]){_0x3f1f17[_0xbd64('0x11')][_0xbd64('0x12')][_0xbd64('0x17')]=_0x64bd3b[_0xbd64('0x16')];if(_0x64bd3b['custom_action_data']){_0x3f1f17[_0xbd64('0x11')]['channelData'][_0xbd64('0x18')]=_0x64bd3b[_0xbd64('0x19')];}}logger[_0xbd64('0x1a')](JSON[_0xbd64('0x1b')](_0x3f1f17));return rp(_0x3f1f17);});}; \ 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 922592c..0776a02 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 _0xc793=['exports','./lib/api'];(function(_0x2d41dd,_0x12171f){var _0x1ca3c8=function(_0x4d0846){while(--_0x4d0846){_0x2d41dd['push'](_0x2d41dd['shift']());}};_0x1ca3c8(++_0x12171f);}(_0xc793,0x17f));var _0x3c79=function(_0x5321d4,_0xe55add){_0x5321d4=_0x5321d4-0x0;var _0x9b80ae=_0xc793[_0x5321d4];return _0x9b80ae;};'use strict';var asr=require(_0x3c79('0x0'));module[_0x3c79('0x1')]=function(_0x21f821,_0x4845d8,_0x380877,_0x41b59c){return asr(_0x21f821,_0x4845d8,_0x380877,_0x41b59c);}; \ No newline at end of file +var _0xe52b=['exports'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xe52b,0x19a));var _0xbe52=function(_0x5dceb7,_0x4fed9d){_0x5dceb7=_0x5dceb7-0x0;var _0x3268bc=_0xe52b[_0x5dceb7];return _0x3268bc;};'use strict';var asr=require('./lib/api');module[_0xbe52('0x0')]=function(_0xe73a55,_0xf14955,_0x4b57dd,_0x4cd58c){return asr(_0xe73a55,_0xf14955,_0x4b57dd,_0x4cd58c);}; \ 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 8ebb9d7..feb5974 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 _0xe3e5=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','unix','send','stringify','createReadStream','data','EOS','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x16a7d6,_0x49ad49){var _0x49eaf1=function(_0x11b6ce){while(--_0x11b6ce){_0x16a7d6['push'](_0x16a7d6['shift']());}};_0x49eaf1(++_0x49ad49);}(_0xe3e5,0x1a4));var _0x5e3e=function(_0x9b8ed4,_0x26931a){_0x9b8ed4=_0x9b8ed4-0x0;var _0x4a4f86=_0xe3e5[_0x9b8ed4];return _0x4a4f86;};'use strict';var BPromise=require(_0x5e3e('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5e3e('0x1'));var crypto=require(_0x5e3e('0x2'));var logger=require(_0x5e3e('0x3'))(_0x5e3e('0x4'));module[_0x5e3e('0x5')]=function(_0x4ade50,_0x540ac1,_0x4d4962,_0x143898){return new BPromise(function(_0x33e7a5,_0x487c49){logger[_0x5e3e('0x6')](_0x5e3e('0x7'),_0x143898||_0x5e3e('0x8'));var _0x4c228b=new WebSocket(_0x143898||_0x5e3e('0x8'),{'perMessageDeflate':![]});var _0x201b59='';var _0x3b6b83='0';var _0xe00367='1';var _0x33a5c3=_0x5e3e('0x9');function _0x707cf4(_0x1d4810){var _0x13059f=crypto[_0x5e3e('0xa')](_0x5e3e('0xb'));_0x13059f[_0x5e3e('0xc')](_0x1d4810);return _0x13059f[_0x5e3e('0xd')]('hex');}function _0x3a8d34(){try{logger[_0x5e3e('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x898ab5=moment()[_0x5e3e('0xe')]();var _0x2882c6=_0x707cf4(_0x898ab5+_0x540ac1+_0x4d4962);_0x4c228b[_0x5e3e('0xf')](JSON[_0x5e3e('0x10')]({'appID':_0x540ac1,'timestamp':_0x898ab5,'appKey':_0x2882c6}));var _0x8742e1=fs[_0x5e3e('0x11')](_0x4ade50);_0x8742e1['on'](_0x5e3e('0x12'),function(_0x28d73d){_0x4c228b['send'](_0x28d73d);});_0x8742e1['on']('close',function(){_0x4c228b[_0x5e3e('0xf')](_0x5e3e('0x13'));});}catch(_0x3d7172){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x5e3e('0x10')](_0x3d7172));_0x4c228b[_0x5e3e('0x14')]();}}function _0xa493d4(_0x49c45c){try{if(_0x49c45c){var _0x1226ab=JSON[_0x5e3e('0x15')](_0x49c45c);switch(_0x1226ab[_0x5e3e('0x16')]){case 0x0:if(_0x1226ab['result']){if(_0x1226ab[_0x5e3e('0x17')]['final']){logger['info'](_0x5e3e('0x18'),JSON[_0x5e3e('0x10')](_0x1226ab[_0x5e3e('0x17')][_0x5e3e('0x19')]));_0x201b59=_0x1226ab['result']['hypotheses'][0x0]['transcript'];_0x3b6b83=_0x1226ab[_0x5e3e('0x17')]['hypotheses'][0x0][_0x5e3e('0x1a')];_0xe00367='0';_0x33a5c3=_0x5e3e('0x1b');_0x4c228b['terminate']();}}break;case 0x1:logger[_0x5e3e('0x6')](_0x5e3e('0x9'));_0xe00367='1';_0x33a5c3=_0x5e3e('0x9');break;case 0x2:logger[_0x5e3e('0x6')](_0x5e3e('0x1c'));_0xe00367='2';_0x33a5c3=_0x5e3e('0x1c');break;case 0x9:logger[_0x5e3e('0x6')](_0x5e3e('0x1d'));_0xe00367='9';_0x33a5c3=_0x5e3e('0x1d');break;case 0xa:logger[_0x5e3e('0x6')](_0x5e3e('0x1e'));_0xe00367='10';_0x33a5c3=_0x5e3e('0x1e');break;case 0xb:logger[_0x5e3e('0x6')](_0x5e3e('0x1f'));_0xe00367='11';_0x33a5c3=_0x5e3e('0x1f');}}}catch(_0x1f3113){logger['error'](_0x5e3e('0x20'),JSON[_0x5e3e('0x10')](_0x1f3113));_0x4c228b[_0x5e3e('0x14')]();}}function _0x49deb8(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x33e7a5({'transcript':_0x201b59,'confidence':_0x3b6b83,'status':_0xe00367,'status_message':_0x33a5c3});}function _0x49517d(_0x20362c){logger[_0x5e3e('0x21')](_0x5e3e('0x22'));if(!_[_0x5e3e('0x23')](_0x20362c)){logger[_0x5e3e('0x21')](_[_0x5e3e('0x24')](_0x20362c)?JSON[_0x5e3e('0x10')](_0x20362c):_0x20362c);}}_0x4c228b['on'](_0x5e3e('0x25'),_0x3a8d34);_0x4c228b['on'](_0x5e3e('0x26'),_0xa493d4);_0x4c228b['on']('close',_0x49deb8);_0x4c228b['on'](_0x5e3e('0x21'),_0x49517d);});}; \ No newline at end of file +var _0xc3bf=['status','result','final','hypotheses','transcript','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','digest','hex','unix','send','stringify','close','EOS','error','parse'];(function(_0x40e11d,_0x2068d6){var _0x4a935d=function(_0xaf62c0){while(--_0xaf62c0){_0x40e11d['push'](_0x40e11d['shift']());}};_0x4a935d(++_0x2068d6);}(_0xc3bf,0xb0));var _0xfc3b=function(_0xf5bbc2,_0x49e6c5){_0xf5bbc2=_0xf5bbc2-0x0;var _0x3d9a7b=_0xc3bf[_0xf5bbc2];return _0x3d9a7b;};'use strict';var BPromise=require(_0xfc3b('0x0'));var _=require(_0xfc3b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfc3b('0x2'));var crypto=require(_0xfc3b('0x3'));var logger=require(_0xfc3b('0x4'))('agi');module[_0xfc3b('0x5')]=function(_0x341210,_0x3cbd25,_0xf9144b,_0x217a17){return new BPromise(function(_0x30c8c9,_0xe81b7a){logger[_0xfc3b('0x6')](_0xfc3b('0x7'),_0x217a17||_0xfc3b('0x8'));var _0x12b068=new WebSocket(_0x217a17||_0xfc3b('0x8'),{'perMessageDeflate':![]});var _0x1ed609='';var _0x30be9b='0';var _0xe839c5='1';var _0x4c85c8='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2649b0(_0x5971bc){var _0x30dc54=crypto['createHash']('sha1');_0x30dc54[_0xfc3b('0x9')](_0x5971bc);return _0x30dc54[_0xfc3b('0xa')](_0xfc3b('0xb'));}function _0x21b601(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x329d2b=moment()[_0xfc3b('0xc')]();var _0x3a3f97=_0x2649b0(_0x329d2b+_0x3cbd25+_0xf9144b);_0x12b068[_0xfc3b('0xd')](JSON[_0xfc3b('0xe')]({'appID':_0x3cbd25,'timestamp':_0x329d2b,'appKey':_0x3a3f97}));var _0x5c8164=fs['createReadStream'](_0x341210);_0x5c8164['on']('data',function(_0x131ea6){_0x12b068['send'](_0x131ea6);});_0x5c8164['on'](_0xfc3b('0xf'),function(){_0x12b068[_0xfc3b('0xd')](_0xfc3b('0x10'));});}catch(_0x258d6f){logger[_0xfc3b('0x11')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x258d6f));_0x12b068['terminate']();}}function _0xe43aba(_0xdb9ef){try{if(_0xdb9ef){var _0x417723=JSON[_0xfc3b('0x12')](_0xdb9ef);switch(_0x417723[_0xfc3b('0x13')]){case 0x0:if(_0x417723[_0xfc3b('0x14')]){if(_0x417723[_0xfc3b('0x14')][_0xfc3b('0x15')]){logger[_0xfc3b('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xfc3b('0xe')](_0x417723[_0xfc3b('0x14')][_0xfc3b('0x16')]));_0x1ed609=_0x417723[_0xfc3b('0x14')][_0xfc3b('0x16')][0x0][_0xfc3b('0x17')];_0x30be9b=_0x417723[_0xfc3b('0x14')][_0xfc3b('0x16')][0x0][_0xfc3b('0x18')];_0xe839c5='0';_0x4c85c8=_0xfc3b('0x19');_0x12b068[_0xfc3b('0x1a')]();}}break;case 0x1:logger[_0xfc3b('0x6')](_0xfc3b('0x1b'));_0xe839c5='1';_0x4c85c8=_0xfc3b('0x1b');break;case 0x2:logger['info'](_0xfc3b('0x1c'));_0xe839c5='2';_0x4c85c8=_0xfc3b('0x1c');break;case 0x9:logger[_0xfc3b('0x6')](_0xfc3b('0x1d'));_0xe839c5='9';_0x4c85c8=_0xfc3b('0x1d');break;case 0xa:logger['info'](_0xfc3b('0x1e'));_0xe839c5='10';_0x4c85c8=_0xfc3b('0x1e');break;case 0xb:logger['info'](_0xfc3b('0x1f'));_0xe839c5='11';_0x4c85c8=_0xfc3b('0x1f');}}}catch(_0x41fdd3){logger[_0xfc3b('0x11')](_0xfc3b('0x20'),JSON['stringify'](_0x41fdd3));_0x12b068[_0xfc3b('0x1a')]();}}function _0x51522a(){logger[_0xfc3b('0x6')](_0xfc3b('0x21'));_0x30c8c9({'transcript':_0x1ed609,'confidence':_0x30be9b,'status':_0xe839c5,'status_message':_0x4c85c8});}function _0x4660f6(_0x549ab0){logger[_0xfc3b('0x11')](_0xfc3b('0x22'));if(!_[_0xfc3b('0x23')](_0x549ab0)){logger[_0xfc3b('0x11')](_[_0xfc3b('0x24')](_0x549ab0)?JSON[_0xfc3b('0xe')](_0x549ab0):_0x549ab0);}}_0x12b068['on'](_0xfc3b('0x25'),_0x21b601);_0x12b068['on'](_0xfc3b('0x26'),_0xe43aba);_0x12b068['on'](_0xfc3b('0xf'),_0x51522a);_0x12b068['on']('error',_0x4660f6);});}; \ 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 6fb36a3..1be7e93 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 _0x236b=['exports','./asr'];(function(_0x393c24,_0x29c062){var _0x273e83=function(_0x239f61){while(--_0x239f61){_0x393c24['push'](_0x393c24['shift']());}};_0x273e83(++_0x29c062);}(_0x236b,0x1e5));var _0xb236=function(_0x4e00d0,_0xceae82){_0x4e00d0=_0x4e00d0-0x0;var _0xdfabbc=_0x236b[_0x4e00d0];return _0xdfabbc;};var asr=require(_0xb236('0x0'));module[_0xb236('0x1')]={'asr':asr}; \ No newline at end of file +var _0x636f=['./asr'];(function(_0x2e4846,_0x2d1d79){var _0x2c9c3a=function(_0x245170){while(--_0x245170){_0x2e4846['push'](_0x2e4846['shift']());}};_0x2c9c3a(++_0x2d1d79);}(_0x636f,0xea));var _0xf636=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x636f[_0x397e5f];return _0x5302b8;};var asr=require(_0xf636('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f467ede..8ffd890 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 _0xee09=['./channel','127.0.0.1','emit','error','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','events','./error'];(function(_0x11579f,_0x26ab6b){var _0x56e613=function(_0x21c110){while(--_0x21c110){_0x11579f['push'](_0x11579f['shift']());}};_0x56e613(++_0x26ab6b);}(_0xee09,0x1ca));var _0x9ee0=function(_0x36cc0d,_0x1a1655){_0x36cc0d=_0x36cc0d-0x0;var _0x45c640=_0xee09[_0x36cc0d];return _0x45c640;};'use strict';var util=require(_0x9ee0('0x0'));var net=require(_0x9ee0('0x1'));var EventEmitter=require(_0x9ee0('0x2'))['EventEmitter'];var AGIError=require(_0x9ee0('0x3'));var AGIChannel=require(_0x9ee0('0x4'));var AGIServer=function(_0x3d653e,_0x276d45,_0x4a9153){var _0x10fbc6=this,_0x3d653e=_0x3d653e||0x11dd,_0x276d45=_0x276d45||_0x9ee0('0x5'),_0x5ec4db=null,_0x4c017e=0x0;EventEmitter['call'](_0x10fbc6);function _0x46cdcb(){if(!_0x3d653e){_0x10fbc6[_0x9ee0('0x6')](_0x9ee0('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x5ec4db=net[_0x9ee0('0x8')]();_0x5ec4db[_0x9ee0('0x9')](_0x3d653e,_0x276d45);_0x5ec4db['on'](_0x9ee0('0xa'),function(){_0x10fbc6[_0x9ee0('0x6')](_0x9ee0('0xa'));});_0x5ec4db['on'](_0x9ee0('0xb'),function(_0x3fe7f2){_0x5ec4db[_0x9ee0('0xc')](function(_0x28d321,_0x34c1a2){if(_0x28d321){_0x10fbc6[_0x9ee0('0x6')](_0x9ee0('0x7'),new AGIError(_0x9ee0('0xd'),_0x28d321));}else if(_0x4a9153&&_0x4a9153<0x0){_0x10fbc6['emit'](_0x9ee0('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x3fe7f2[_0x9ee0('0xe')]();}else if(_0x4a9153&&_0x4a9153>0x0&&_0x4a9153<_0x34c1a2){_0x4c017e+=0x1;_0x10fbc6['emit'](_0x9ee0('0x7'),new AGIError(_0x9ee0('0xf'),_0x4c017e));_0x3fe7f2[_0x9ee0('0xe')]();}else{var _0x1c8ee4=new AGIChannel(_0x3fe7f2);_0x1c8ee4['on']('ready',function(){_0x10fbc6[_0x9ee0('0x6')](_0x9ee0('0xb'),_0x1c8ee4);});}});});_0x5ec4db['on'](_0x9ee0('0x7'),function(_0x11ae87){_0x10fbc6[_0x9ee0('0x6')](_0x9ee0('0x7'),new AGIError(_0x9ee0('0xd'),_0x11ae87[_0x9ee0('0x10')]));});_0x5ec4db['on']('close',function(){_0x10fbc6[_0x9ee0('0x6')](_0x9ee0('0x11'),new AGIError(_0x9ee0('0x12')));});}process[_0x9ee0('0x13')](function(){_0x46cdcb();});};util[_0x9ee0('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x3bdcb0,_0x7d0b0d,_0x3e7eb4){return new AGIServer(_0x3bdcb0,_0x7d0b0d,_0x3e7eb4);}; \ No newline at end of file +var _0xbb1c=['E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','connection','getConnections'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xbb1c,0x11f));var _0xcbb1=function(_0x3a938b,_0x361302){_0x3a938b=_0x3a938b-0x0;var _0x4fc174=_0xbb1c[_0x3a938b];return _0x4fc174;};'use strict';var util=require(_0xcbb1('0x0'));var net=require(_0xcbb1('0x1'));var EventEmitter=require('events')[_0xcbb1('0x2')];var AGIError=require('./error');var AGIChannel=require(_0xcbb1('0x3'));var AGIServer=function(_0x2afe55,_0x37b885,_0x4147dd){var _0x2cbf70=this,_0x2afe55=_0x2afe55||0x11dd,_0x37b885=_0x37b885||'127.0.0.1',_0x32c2cd=null,_0x8b2a51=0x0;EventEmitter[_0xcbb1('0x4')](_0x2cbf70);function _0x49e2d7(){if(!_0x2afe55){_0x2cbf70[_0xcbb1('0x5')](_0xcbb1('0x6'),new AGIError(_0xcbb1('0x7')));return![];}_0x32c2cd=net[_0xcbb1('0x8')]();_0x32c2cd[_0xcbb1('0x9')](_0x2afe55,_0x37b885);_0x32c2cd['on']('listening',function(){_0x2cbf70['emit']('listening');});_0x32c2cd['on'](_0xcbb1('0xa'),function(_0x352f8f){_0x32c2cd[_0xcbb1('0xb')](function(_0x2aab70,_0x1278b7){if(_0x2aab70){_0x2cbf70[_0xcbb1('0x5')](_0xcbb1('0x6'),new AGIError(_0xcbb1('0xc'),_0x2aab70));}else if(_0x4147dd&&_0x4147dd<0x0){_0x2cbf70[_0xcbb1('0x5')](_0xcbb1('0x6'),new AGIError(_0xcbb1('0xd')));_0x352f8f['destroy']();}else if(_0x4147dd&&_0x4147dd>0x0&&_0x4147dd<_0x1278b7){_0x8b2a51+=0x1;_0x2cbf70['emit'](_0xcbb1('0x6'),new AGIError(_0xcbb1('0xe'),_0x8b2a51));_0x352f8f[_0xcbb1('0xf')]();}else{var _0x508cf4=new AGIChannel(_0x352f8f);_0x508cf4['on'](_0xcbb1('0x10'),function(){_0x2cbf70[_0xcbb1('0x5')](_0xcbb1('0xa'),_0x508cf4);});}});});_0x32c2cd['on'](_0xcbb1('0x6'),function(_0x15c25d){_0x2cbf70[_0xcbb1('0x5')](_0xcbb1('0x6'),new AGIError(_0xcbb1('0xc'),_0x15c25d[_0xcbb1('0x11')]));});_0x32c2cd['on']('close',function(){_0x2cbf70[_0xcbb1('0x5')](_0xcbb1('0x12'),new AGIError(_0xcbb1('0x13')));});}process[_0xcbb1('0x14')](function(){_0x49e2d7();});};util[_0xcbb1('0x15')](AGIServer,EventEmitter);module[_0xcbb1('0x16')]=function(_0x3e789e,_0x2105e2,_0xb5051e){return new AGIServer(_0x3e789e,_0x2105e2,_0xb5051e);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7207fa1..c3a074c 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 _0x19cb=['model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','setVariable','%s.%s','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','add','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','wav','%s/recordings/%s','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','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','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','lodash','shelljs','randomstring','mustache','../../config/environment','../../config/environment/shared','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','callback','scheduledAt','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured'];(function(_0x1b3f52,_0x4f5b13){var _0x36bf2c=function(_0x2c8426){while(--_0x2c8426){_0x1b3f52['push'](_0x1b3f52['shift']());}};_0x36bf2c(++_0x4f5b13);}(_0x19cb,0x146));var _0xb19c=function(_0x1b966f,_0x26da68){_0x1b966f=_0x1b966f-0x0;var _0x327999=_0x19cb[_0x1b966f];return _0x327999;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xb19c('0x0'));var sh=require(_0xb19c('0x1'));var odbc=require('odbc')();var rs=require(_0xb19c('0x2'));var moment=require('moment');var Mustache=require(_0xb19c('0x3'));var rp=require('request-promise');var logger=require('../../config/logger')('agi');var config=require(_0xb19c('0x4'));var shared=require(_0xb19c('0x5'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xb19c('0x6'),_0xb19c('0x7')];var verticesWithRetry=[_0xb19c('0x8'),_0xb19c('0x9'),'getsecretdigits'];var AGIVertices=function(_0x553479,_0x1ee1da,_0x3ffb45){this[_0xb19c('0xa')]=_0x553479;this[_0xb19c('0xb')]=_0x1ee1da;this[_0xb19c('0xc')]=_0x3ffb45;};AGIVertices['prototype'][_0xb19c('0xd')]=function(_0xcc851f,_0x13e3c2){this[_0xb19c('0xb')][_0xb19c('0xe')](_0xcc851f)[_0xb19c('0xf')](function(_0x516592){_0x13e3c2(null,_0x516592?_0x516592['name']:![]);})['catch'](function(_0x46bfc2){_0x13e3c2(_0x46bfc2);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x11')]=function(_0x52098d,_0x23274c){this[_0xb19c('0xb')][_0xb19c('0x12')](_0x52098d)['then'](function(_0x12f4b1){_0x23274c(null,_0x12f4b1?_0x12f4b1['name']:![]);})[_0xb19c('0x13')](function(_0x261602){_0x23274c(_0x261602);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x14')]=function(_0x11eea0,_0x5bae0a){this[_0xb19c('0xb')][_0xb19c('0x15')](_0x11eea0)[_0xb19c('0xf')](function(_0x2b2815){_0x5bae0a(null,_0x2b2815?_0x2b2815[_0xb19c('0x16')]:![]);})['catch'](function(_0x4d3926){_0x5bae0a(_0x4d3926);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x17')]=function(_0x547809,_0x55cf87){this[_0xb19c('0xb')][_0xb19c('0x18')](_0x547809)[_0xb19c('0xf')](function(_0x413646){_0x55cf87(null,_0x413646?_0x413646['dsn']:![]);})[_0xb19c('0x13')](function(_0x14daf5){_0x55cf87(_0x14daf5);});};AGIVertices[_0xb19c('0x10')]['getUser']=function(_0x250604,_0x383878){this[_0xb19c('0xb')][_0xb19c('0x19')](_0x250604)[_0xb19c('0xf')](function(_0x5aaf38){_0x383878(null,_0x5aaf38?_0x5aaf38['name']:![]);})[_0xb19c('0x13')](function(_0x5c56cc){_0x383878(_0x5c56cc);});};AGIVertices[_0xb19c('0x10')]['getTrunk']=function(_0xdc2623,_0x1fdc4e){this[_0xb19c('0xb')][_0xb19c('0x1a')](_0xdc2623)[_0xb19c('0xf')](function(_0x1774fc){_0x1fdc4e(null,_0x1774fc?_0x1774fc[_0xb19c('0x16')]:![]);})[_0xb19c('0x13')](function(_0x4bbb72){_0x1fdc4e(_0x4bbb72);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x1b')]=function(_0x1c18fe,_0x318c5d){var _0x513339=this;this['rpc']['getSoundById'](_0x1c18fe)[_0xb19c('0xf')](function(_0x1dd187){_0x318c5d(null,_0x1dd187?_0x513339[_0xb19c('0x1c')](_0x1dd187[_0xb19c('0x1d')]):![]);})[_0xb19c('0x13')](function(_0x4acb68){_0x318c5d(_0x4acb68);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x1e')]=function(_0x12fc7c,_0x405088){this[_0xb19c('0xb')][_0xb19c('0x1f')](_0x12fc7c)[_0xb19c('0xf')](function(_0x4bd235){_0x405088(null,_0x4bd235?_0x4bd235:![]);})[_0xb19c('0x13')](function(_0x219c96){_0x405088(_0x219c96);});};AGIVertices['prototype'][_0xb19c('0x20')]=function(_0x1a11a1,_0x31c93f,_0x2296b1){this[_0xb19c('0xc')]['sendMailMessage'](_0x1a11a1,_0x31c93f)['then'](function(){_0x2296b1(null);})[_0xb19c('0x13')](function(_0x31028b){_0x2296b1(_0x31028b);});};AGIVertices[_0xb19c('0x10')]['getIntervals']=function(_0x307a22,_0x1510b4){this[_0xb19c('0xb')][_0xb19c('0x21')](_0x307a22)[_0xb19c('0xf')](function(_0x1e3aa1){if(_0x1e3aa1){if(_0x1e3aa1[_0xb19c('0x22')]){_0x1510b4(null,[_0x1e3aa1[_0xb19c('0x23')]]);}else{_0x1510b4(null,_[_0xb19c('0x24')](_0x1e3aa1['Intervals'],_0xb19c('0x23')));}}else{_0x1510b4(null,![]);}})[_0xb19c('0x13')](function(_0x5a1fb7){_0x1510b4(_0x5a1fb7);});};AGIVertices['prototype'][_0xb19c('0x1c')]=function(_0x1bef38){return util[_0xb19c('0x25')]('%s/sounds/converted/%s',FILES_PATH,_0x1bef38);};AGIVertices[_0xb19c('0x10')]['getQueryOdbc']=function(_0x431c3b,_0x54f1f7,_0x10683f){odbc[_0xb19c('0x26')](_0x431c3b,function(_0x4573be){if(_0x4573be){logger[_0xb19c('0x27')](_0xb19c('0x28'),_0x4573be);_0x10683f(_0x4573be);}else{logger[_0xb19c('0x29')](_0xb19c('0x2a'));odbc[_0xb19c('0x2b')](_0x54f1f7,function(_0x563bdb,_0x2504d9){if(_0x563bdb){logger[_0xb19c('0x29')]('Error\x20executing\x20query\x20%s',_0x54f1f7);_0x10683f(_0x563bdb);}else{logger[_0xb19c('0x29')](_0xb19c('0x2c'),_0x54f1f7);odbc[_0xb19c('0x2d')](function(_0x2826fd){if(_0x2826fd){logger[_0xb19c('0x27')](_0xb19c('0x2e'),_0x2826fd);}_0x10683f(null,_0x2504d9);});}});}});};AGIVertices['prototype'][_0xb19c('0x2f')]=function(_0x12209f,_0x5bde43){this[_0xb19c('0xb')]['getSmsAccountById'](_0x12209f)[_0xb19c('0xf')](function(_0x45bd41){_0x5bde43(null,_0x45bd41?_0x45bd41:![]);})[_0xb19c('0x13')](function(_0x238524){_0x5bde43(_0x238524);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x30')]=function(_0x441e9b,_0x49db9e){this[_0xb19c('0xb')][_0xb19c('0x30')](_0x441e9b)['then'](function(_0x10d406){_0x49db9e(null,_0x10d406);})[_0xb19c('0x13')](function(_0x25acab){_0x49db9e(_0x25acab);});};AGIVertices[_0xb19c('0x10')]['createSquareDetailsReport']=function(_0x48b108,_0x49df44,_0x296e51){this[_0xb19c('0xb')][_0xb19c('0x31')]({'uniqueid':this[_0xb19c('0xa')][_0xb19c('0x32')],'node':_0x48b108[_0xb19c('0x33')],'application':_0x48b108[_0xb19c('0x34')],'data':_0x49df44||null,'project_name':this[_0xb19c('0xa')][_0xb19c('0x35')],'callerid':this['channel'][_0xb19c('0x36')]})[_0xb19c('0xf')](function(_0x3f8f4b){if(_0x296e51){_0x296e51(null,_0x3f8f4b);}})[_0xb19c('0x13')](function(_0xdf1189){if(_0x296e51){_0x296e51(_0xdf1189);}});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x37')]=function(_0x3cba32,_0x170832,_0x37b36d,_0xe40620){this['rpc'][_0xb19c('0x37')]({'uniqueid':this[_0xb19c('0xa')][_0xb19c('0x32')],'callerid':this[_0xb19c('0xa')]['callerid'],'calleridname':this['channel'][_0xb19c('0x38')],'context':this[_0xb19c('0xa')][_0xb19c('0x39')],'extension':this[_0xb19c('0xa')]['extension'],'priority':this[_0xb19c('0xa')][_0xb19c('0x3a')],'accountcode':this['channel']['accountcode'],'dnid':this[_0xb19c('0xa')][_0xb19c('0x3b')],'projectName':this[_0xb19c('0xa')][_0xb19c('0x35')],'saveName':_0x170832,'filename':_0x3cba32[_0xb19c('0x3c')]||_0x170832,'savePath':_0x37b36d})[_0xb19c('0xf')](function(_0x12c624){_0xe40620(null,_0x12c624);})[_0xb19c('0x13')](function(_0x422efc){_0xe40620(_0x422efc);});};AGIVertices['prototype']['createSquareMessage']=function(_0x1cf5b2,_0x1304f2,_0x55968c,_0x37b630,_0x33e7a3){this[_0xb19c('0xb')][_0xb19c('0x3d')]({'uniqueid':this[_0xb19c('0xa')][_0xb19c('0x32')],'body':_0x1cf5b2,'direction':_0x1304f2,'providerName':_0x55968c,'providerResponse':_0x37b630})[_0xb19c('0xf')](function(_0x5313a0){if(_0x33e7a3){_0x33e7a3(null,_0x5313a0);}})[_0xb19c('0x13')](function(_0x464890){if(_0x33e7a3){_0x33e7a3(_0x464890);}});};AGIVertices['prototype'][_0xb19c('0x3e')]=function(_0x4951e6,_0x4cd6cc){this['rpc'][_0xb19c('0x3e')]({'firstName':_[_0xb19c('0x3f')](_0x4951e6[_0xb19c('0x16')])||_[_0xb19c('0x40')](_0x4951e6[_0xb19c('0x16')])?'callback_'+Math[_0xb19c('0x41')]():_0x4951e6[_0xb19c('0x16')],'lastName':_[_0xb19c('0x3f')](_0x4951e6[_0xb19c('0x42')])||_[_0xb19c('0x40')](_0x4951e6['lastName'])?null:_0x4951e6[_0xb19c('0x42')],'phone':_0x4951e6['phone'],'ListId':_0x4951e6[_0xb19c('0x43')],'scheduledat':_0x4951e6['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xb19c('0x44'),'description':'Callback\x20scheduled\x20at\x20'+_0x4951e6[_0xb19c('0x45')][_0xb19c('0x46')](),'priority':_0x4951e6[_0xb19c('0x47')]})[_0xb19c('0xf')](function(_0x2be701){_0x4cd6cc(null,_0x2be701);})['catch'](function(_0x13c621){_0x4cd6cc(_0x13c621);});};AGIVertices[_0xb19c('0x10')]['getPause']=function(_0x3ccb5c,_0x2d62b0){this[_0xb19c('0xb')][_0xb19c('0x48')](_0x3ccb5c)[_0xb19c('0xf')](function(_0x32246b){_0x2d62b0(null,_0x32246b?_0x32246b[_0xb19c('0x16')]:![]);})['catch'](function(_0x36351b){_0x2d62b0(_0x36351b);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x49')]=function(_0x47ad0d,_0x4b3288,_0x485f24){var _0x4c8e9c={'role':_0xb19c('0x4a')};_0x4c8e9c[_0x47ad0d]=this[_0xb19c('0xa')][_0xb19c('0x36')];this[_0xb19c('0xb')][_0xb19c('0x49')](_0x4c8e9c,_0x4b3288,this[_0xb19c('0xa')][_0xb19c('0x32')])[_0xb19c('0xf')](function(_0xa51a15){_0x485f24(null,_['isNil'](_0xa51a15)?![]:!![]);})[_0xb19c('0x13')](function(_0x5d344d){logger['error'](_0x5d344d);_0x485f24(null,![]);});};AGIVertices['prototype'][_0xb19c('0x4b')]=function(_0x40d3dd,_0xfd718b){var _0x3cf5b1={'role':_0xb19c('0x4a')};_0x3cf5b1[_0x40d3dd]=this[_0xb19c('0xa')][_0xb19c('0x36')];this[_0xb19c('0xb')][_0xb19c('0x4b')](_0x3cf5b1)[_0xb19c('0xf')](function(_0x2d08a2){_0xfd718b(null,_[_0xb19c('0x40')](_0x2d08a2)?![]:!![]);})['catch'](function(_0x56bf49){logger[_0xb19c('0x27')](_0x56bf49);_0xfd718b(null,![]);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x4c')]=function(_0x26dc2a,_0x46fc4c){var _0x275ce3={'role':'agent'};_0x275ce3[_0x26dc2a]=this[_0xb19c('0xa')][_0xb19c('0x36')];this[_0xb19c('0xb')][_0xb19c('0x4c')](_0x275ce3)[_0xb19c('0xf')](function(_0x41a051){_0x46fc4c(null,_[_0xb19c('0x40')](_0x41a051)?![]:!![]);})[_0xb19c('0x13')](function(_0x314410){logger[_0xb19c('0x27')](_0x314410);_0x46fc4c(null,![]);});};AGIVertices['prototype'][_0xb19c('0x4d')]=function(_0x49c872,_0xadd092){var _0x444435={'role':_0xb19c('0x4a')};_0x444435[_0x49c872]=this[_0xb19c('0xa')][_0xb19c('0x36')];var _0x3cd024=_0x49c872!='internal'?util['format'](_0xb19c('0x4e'),_0xb19c('0x4f'),this[_0xb19c('0xa')][_0xb19c('0x36')]):undefined;this[_0xb19c('0xb')][_0xb19c('0x4d')](_0x444435,_0x3cd024)[_0xb19c('0xf')](function(_0x4d1446){_0xadd092(null,_[_0xb19c('0x40')](_0x4d1446)?![]:!![]);})['catch'](function(_0x57e3e3){logger[_0xb19c('0x27')](_0x57e3e3);_0xadd092(null,![]);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x50')]=function(_0x235265,_0x265f96){sh[_0xb19c('0x51')](_[_0xb19c('0x52')](_0x235265),function(_0x2c609d,_0x56f4ae){var _0x36c7a8=_0x56f4ae[_0xb19c('0x53')](/(\r\n|\n|\r)/gm,'');_0x265f96(null,_0x36c7a8);});};AGIVertices['prototype'][_0xb19c('0x54')]=function(_0x13593b,_0x4a1f75){scripts[_0xb19c('0x54')](_0x13593b[_0xb19c('0x55')],_0x13593b[_0xb19c('0x56')]||_0xb19c('0x57'),_0x13593b['text'],_0x13593b[_0xb19c('0x58')]||_0xb19c('0x59'),_0x13593b['ssmlGender']||_0xb19c('0x5a'),_0x13593b[_0xb19c('0x5b')]||'MP3')['then'](function(_0x2cf763){_0x4a1f75(null,_0x2cf763);})[_0xb19c('0x13')](function(_0x208cce){_0x4a1f75(_0x208cce);});};AGIVertices['prototype'][_0xb19c('0x5c')]=function(_0x38d2f3,_0x3a01ee){scripts[_0xb19c('0x5c')](_0x38d2f3[_0xb19c('0x57')],_0x38d2f3[_0xb19c('0x5d')]||'en',0x1)[_0xb19c('0xf')](function(_0x23e795){_0x3a01ee(null,_0x23e795);})[_0xb19c('0x13')](function(_0x4767a1){_0x3a01ee(_0x4767a1);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x5e')]=function(_0x265c33,_0x1ff48b){var _0x5d61ab={'uri':_0x265c33[_0xb19c('0x5f')],'method':_0x265c33['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x265c33[_0xb19c('0x60')])===_0xb19c('0x61')&&parseInt(_0x265c33['timeout'])>=0x1?parseInt(_0x265c33[_0xb19c('0x60')])*0x3e8:0x5*0x3e8};if(_[_0xb19c('0x62')]([_0xb19c('0x63'),_0xb19c('0x64')],_0x5d61ab['method'][_0xb19c('0x65')]())){try{_0x5d61ab[_0xb19c('0x66')]=_0x265c33[_0xb19c('0x7')]?JSON[_0xb19c('0x67')](_0x265c33[_0xb19c('0x7')]):{};}catch(_0x2c94e3){logger['error'](_0xb19c('0x68'),_0x2c94e3);}}try{_0x5d61ab[_0xb19c('0x69')]=_0x265c33[_0xb19c('0x6')]?JSON[_0xb19c('0x67')](_0x265c33[_0xb19c('0x6')]):{};}catch(_0x122acc){logger[_0xb19c('0x27')](_0xb19c('0x6a'),_0x122acc);}if(_0x265c33[_0xb19c('0x6b')]){try{var _0x3d139d=require(_0x265c33[_0xb19c('0x6b')])[_0xb19c('0x6c')](this,_0x5d61ab);_0x5d61ab[_0xb19c('0x6d')]=Mustache['render'](_0x265c33[_0xb19c('0x5f')],_0x3d139d,{},['$$','$$']);if(_0x5d61ab[_0xb19c('0x69')]){_0x5d61ab['headers']=JSON[_0xb19c('0x67')](Mustache[_0xb19c('0x6e')](JSON[_0xb19c('0x6f')](_0x5d61ab[_0xb19c('0x69')]),_0x3d139d,{},['$$','$$']));}if(_0x5d61ab[_0xb19c('0x66')]){_0x5d61ab[_0xb19c('0x66')]=JSON[_0xb19c('0x67')](Mustache[_0xb19c('0x6e')](JSON[_0xb19c('0x6f')](_0x5d61ab['body']),_0x3d139d,{},['$$','$$']));}}catch(_0x4d0383){logger[_0xb19c('0x27')](_0xb19c('0x70'),_0x4d0383);}}rp(_0x5d61ab)[_0xb19c('0xf')](function(_0x55ca33){var _0x46959d={'statusCode':_0x55ca33[_0xb19c('0x71')]||0xc8,'statusMessage':_0x55ca33[_0xb19c('0x72')]||'OK','headers':_0x55ca33['headers']||{},'body':_0x55ca33[_0xb19c('0x66')]||{}};_0x1ff48b(null,_0x46959d);})[_0xb19c('0x13')](function(_0x399d14){var _0x4bb988={'statusCode':_0x399d14[_0xb19c('0x71')]||0x1f4,'statusMessage':_0x399d14['message']||_0xb19c('0x73'),'headers':_0x399d14[_0xb19c('0x74')][_0xb19c('0x69')]||{},'body':_0x399d14['options'][_0xb19c('0x66')]||{}};_0x1ff48b(null,_0x4bb988);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x75')]=function(_0x117602,_0x27e4f1){scripts[_0xb19c('0x75')](this[_0xb19c('0xa')][_0xb19c('0x32')],_0x117602[_0xb19c('0x76')],_0x117602[_0xb19c('0x57')],_0x117602[_0xb19c('0x77')]||'en')[_0xb19c('0xf')](function(_0x1d47b1){_0x27e4f1(null,_0x1d47b1);})['catch'](function(_0x8e0d97){_0x27e4f1(_0x8e0d97);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x78')]=function(_0xea6a8f,_0x579335){scripts[_0xb19c('0x78')](this['channel']['uniqueid'],_0xea6a8f['dialogflowV2_project_id'],_0xea6a8f[_0xb19c('0x79')],_0xea6a8f['private_key'],_0xea6a8f[_0xb19c('0x57')],_0xea6a8f['dialogflowV2_language']||'en')[_0xb19c('0xf')](function(_0x193942){_0x579335(null,_0x193942);})[_0xb19c('0x13')](function(_0x3f2c5d){_0x579335(_0x3f2c5d);});};AGIVertices['prototype']['sestekNDA']=function(_0x1829bc,_0x1c6d21){scripts[_0xb19c('0x7a')](this['channel'],_0x1829bc)[_0xb19c('0xf')](function(_0x23b915){_0x1c6d21(null,_0x23b915);})[_0xb19c('0x13')](function(_0x34d521){_0x1c6d21(_0x34d521);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x7b')]=function(_0x149ab9,_0x23c89f){scripts['ispeechTTS'](_0x149ab9[_0xb19c('0x76')],_0x149ab9[_0xb19c('0x57')],_0x149ab9[_0xb19c('0x7c')]||_0xb19c('0x59'),_0x149ab9[_0xb19c('0x7d')])['then'](function(_0x528341){_0x23c89f(null,_0x528341);})[_0xb19c('0x13')](function(_0x4c8f40){_0x23c89f(_0x4c8f40);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x7e')]=function(_0x438da7,_0x4cbf04,_0x4272a4){scripts[_0xb19c('0x7e')](_0x4cbf04,_0x438da7[_0xb19c('0x76')],_0x438da7[_0xb19c('0x7f')]||'en-US',this[_0xb19c('0x80')](_0x438da7['model'])?_0x438da7[_0xb19c('0x81')]:undefined)[_0xb19c('0xf')](function(_0x1e467f){_0x4272a4(null,_0x1e467f);})['catch'](function(_0xdab85d){_0x4272a4(_0xdab85d);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x82')]=function(_0x42f720,_0x2a8503){scripts[_0xb19c('0x82')](_0x42f720[_0xb19c('0x83')],_0x42f720['aws_secret_access_key'],_0x42f720[_0xb19c('0x84')],_0x42f720[_0xb19c('0x85')]||'Amy',_0x42f720[_0xb19c('0x57')],_0x42f720[_0xb19c('0x86')]||_0xb19c('0x57'))[_0xb19c('0xf')](function(_0x3ddad6){_0x2a8503(null,_0x3ddad6);})[_0xb19c('0x13')](function(_0x3a9ac8){_0x2a8503(_0x3a9ac8);});};AGIVertices[_0xb19c('0x10')]['awsLex']=function(_0x37cd70,_0x3a9c15){scripts[_0xb19c('0x87')](this[_0xb19c('0xa')][_0xb19c('0x32')],_0x37cd70[_0xb19c('0x83')],_0x37cd70[_0xb19c('0x88')],_0x37cd70['aws_lex_region'],_0x37cd70[_0xb19c('0x57')],_0x37cd70[_0xb19c('0x89')])[_0xb19c('0xf')](function(_0x1de695){_0x3a9c15(null,_0x1de695);})[_0xb19c('0x13')](function(_0x5698d0){_0x3a9c15(_0x5698d0);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x8a')]=function(_0x24e427,_0x2435ee,_0x27be86){scripts[_0xb19c('0x8a')](_0x2435ee,_0x24e427[_0xb19c('0x76')],_0x24e427[_0xb19c('0x8b')]||_0xb19c('0x59'))['then'](function(_0x1a7216){_0x27be86(null,_0x1a7216);})['catch'](function(_0x3bd073){_0x27be86(_0x3bd073);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x8c')]=function(_0x5a65fd,_0x2354e7,_0x85028e){scripts['tildeASR'](_0x2354e7,_0x5a65fd[_0xb19c('0x8d')],_0x5a65fd[_0xb19c('0x8e')],_0x5a65fd[_0xb19c('0x6d')])[_0xb19c('0xf')](function(_0xc50e9){_0x85028e(null,_0xc50e9);})['catch'](function(_0x403eea){_0x85028e(_0x403eea);});};AGIVertices[_0xb19c('0x10')][_0xb19c('0x8f')]=function(_0x522b50){var _0x33d784=_[_0xb19c('0x62')](verticesWithRetry,_0x522b50[_0xb19c('0x34')])?_0x522b50:_[_0xb19c('0x90')](_0x522b50);for(var _0x40cbe2 in _0x33d784){if(_0x33d784[_0xb19c('0x91')](_0x40cbe2)){if(_0x33d784[_0x40cbe2]&&_[_0xb19c('0x92')](_0x33d784[_0x40cbe2])){if(_[_0xb19c('0x62')](recursiveMapAttributes,_0x40cbe2)){_0x33d784[_0x40cbe2]=this[_0xb19c('0x93')](_0x33d784[_0x40cbe2]);}else{_0x33d784[_0x40cbe2]=this['replaceAllVariables'](_0x33d784[_0x40cbe2]);}}}}return _0x33d784;};AGIVertices[_0xb19c('0x10')][_0xb19c('0x94')]=function(_0x5e1245){for(var _0x57ad8e in _0x5e1245){if(_0x5e1245[_0xb19c('0x91')](_0x57ad8e)){if(_[_0xb19c('0x95')](_0x5e1245[_0x57ad8e])){this[_0xb19c('0x94')](_0x5e1245[_0x57ad8e]);}else if(_[_0xb19c('0x96')](_0x5e1245[_0x57ad8e])){for(var _0x1d3742=0x0;_0x1d3742<_0x5e1245[_0x57ad8e][_0xb19c('0x97')];_0x1d3742++){this[_0xb19c('0x94')](_0x5e1245[_0x57ad8e][_0x1d3742]);}}else if(_[_0xb19c('0x92')](_0x5e1245[_0x57ad8e])){_0x5e1245[_0x57ad8e]=this[_0xb19c('0x98')](_0x5e1245[_0x57ad8e]);}}}};AGIVertices['prototype'][_0xb19c('0x99')]=function(_0x380d1d,_0x90e5fb){for(var _0x2521be in _0x380d1d){if(_0x380d1d[_0xb19c('0x91')](_0x2521be)){if(_[_0xb19c('0x95')](_0x380d1d[_0x2521be])){if(!_[_0xb19c('0x3f')](_0x380d1d[_0x2521be])){this[_0xb19c('0x99')](_0x380d1d[_0x2521be],util[_0xb19c('0x25')]('%s.%s',_0x90e5fb,_0x2521be));}}else if(_[_0xb19c('0x96')](_0x380d1d[_0x2521be])){for(var _0x58f102=0x0;_0x58f102<_0x380d1d[_0x2521be][_0xb19c('0x97')];_0x58f102++){this['saveRestApiResult'](_0x380d1d[_0x2521be][_0x58f102],util['format']('%s.%s',_0x90e5fb,_0x2521be+'['+_0x58f102+']'));}}else{if(!_[_0xb19c('0x40')](_0x380d1d[_0x2521be])){this[_0xb19c('0xa')][_0xb19c('0x9a')](util[_0xb19c('0x25')](_0xb19c('0x9b'),_0x90e5fb,_0x2521be),_0x380d1d[_0x2521be]);}}}}};AGIVertices[_0xb19c('0x10')][_0xb19c('0x93')]=function(_0x4784da){try{var _0x375e35=JSON[_0xb19c('0x67')](_0x4784da);this[_0xb19c('0x94')](_0x375e35);return JSON[_0xb19c('0x6f')](_0x375e35);}catch(_0x4c2947){return this[_0xb19c('0x98')](_0x4784da);}};AGIVertices[_0xb19c('0x10')][_0xb19c('0x98')]=function(_0x74cd8){var _0x353329=_0x74cd8['split']('{');for(var _0x5efb44=0x1;_0x5efb44<_0x353329[_0xb19c('0x97')];_0x5efb44+=0x1){var _0x3735e7=_0x353329[_0x5efb44][_0xb19c('0x9c')]('}');if(_0x3735e7['length']>0x1){_0x74cd8=_0x74cd8['replaceAll']('{'+_0x3735e7[0x0]+'}',this['channel'][_0xb19c('0xd')](_0x3735e7[0x0])[_0xb19c('0x9d')]||_0x3735e7[0x0]);}}if(_0x353329['length']===0x1){return _0x74cd8[_0xb19c('0x46')]();}return this[_0xb19c('0x98')](_0x74cd8);};AGIVertices[_0xb19c('0x10')][_0xb19c('0x9e')]=function(_0x5ee362,_0x46a500){var _0x48a365=this[_0xb19c('0xa')]['getVariable'](_0x5ee362);if(_0x48a365[_0xb19c('0x9f')]===-0x1){return _0x48a365;}logger[_0xb19c('0x29')](util['format'](_0xb19c('0xa0'),_0x46a500,_0x48a365[_0xb19c('0x9d')]));return this[_0xb19c('0xa')][_0xb19c('0x9a')](_0x46a500,_0x48a365[_0xb19c('0x9d')]);};AGIVertices[_0xb19c('0x10')][_0xb19c('0x80')]=function(_0x346d71){return _0x346d71&&_0x346d71!=='0'&&_0x346d71!=='-1'&&_0x346d71!=='';};AGIVertices['prototype'][_0xb19c('0xa1')]=function(_0x5e60cb){this[_0xb19c('0x31')][_0xb19c('0x6c')](this,_0x5e60cb,'-');_0x5e60cb['retry']=_0x5e60cb[_0xb19c('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb19c('0x10')][_0xb19c('0xa2')]=function(_0x38199c){logger[_0xb19c('0x29')](util['format'](_0xb19c('0xa3'),_0x38199c['label']));if(!this[_0xb19c('0x80')](_0x38199c[_0xb19c('0x57')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xa5'));}var _0x575a22='\x22'+_0x38199c[_0xb19c('0x57')]+'\x22';if(this[_0xb19c('0x80')](_0x38199c[_0xb19c('0x74')])){_0x575a22+=','+_0x38199c[_0xb19c('0x74')];}var _0x18c946=this[_0xb19c('0xa')][_0xb19c('0x51')](_0xb19c('0xa6'),_0x575a22);if(_0x18c946[_0xb19c('0x9f')]===-0x1){return _0x18c946;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x575a22));};AGIVertices['prototype'][_0xb19c('0xa7')]=function(_0x8eb52d){logger['info'](util['format'](_0xb19c('0xa8'),_0x8eb52d[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x8eb52d[_0xb19c('0xa9')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xaa'));}var _0x3cf057=_0x8eb52d['grammar'];if(this[_0xb19c('0x80')](_0x8eb52d[_0xb19c('0x74')])){_0x3cf057+=','+_0x8eb52d[_0xb19c('0x74')];}var _0x357d14=this[_0xb19c('0xa')][_0xb19c('0x51')](_0xb19c('0xab'),_0x3cf057);if(_0x357d14[_0xb19c('0x9f')]===-0x1){return _0x357d14;}var _0x4f9ab9=this['getAndSetVariable'](_0xb19c('0xac'),_0xb19c('0xad'));if(_0x4f9ab9[_0xb19c('0x9f')]===-0x1){return _0x4f9ab9;}var _0x44f2e4=this['getAndSetVariable'](_0xb19c('0xae'),_0xb19c('0xaf'));if(_0x44f2e4[_0xb19c('0x9f')]===-0x1){return _0x44f2e4;}var _0xf132d4=this[_0xb19c('0x9e')](_0xb19c('0xb0'),_0xb19c('0xb1'));if(_0xf132d4[_0xb19c('0x9f')]===-0x1){return _0xf132d4;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0xb2'),_0x3cf057));};AGIVertices[_0xb19c('0x10')][_0xb19c('0xb3')]=function(_0x3c1b12){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0xb4'),_0x3c1b12[_0xb19c('0x33')]));return this[_0xb19c('0xa')][_0xb19c('0xb3')]([_0x3c1b12['command'],_0x3c1b12[_0xb19c('0xb5')]]);};AGIVertices['prototype'][_0xb19c('0xb6')]=function(_0x58849d){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0xb7'),_0x58849d[_0xb19c('0x33')]));if(this[_0xb19c('0x80')](_0x58849d[_0xb19c('0x60')])){logger[_0xb19c('0x29')](util['format'](_0xb19c('0xb8'),_0x58849d['timeout']));var _0x46224a=this[_0xb19c('0xa')][_0xb19c('0xb9')](_0x58849d['timeout']);if(_0x46224a[_0xb19c('0x9f')]===-0x1){return _0x46224a;}}return this[_0xb19c('0xa')][_0xb19c('0xb6')]();};AGIVertices[_0xb19c('0x10')][_0xb19c('0x44')]=function(_0x4351d5){logger[_0xb19c('0x29')](util[_0xb19c('0x25')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4351d5[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x4351d5[_0xb19c('0x43')])){return this['channel'][_0xb19c('0x27')](_0x4351d5,_0xb19c('0xba'));}_0x4351d5[_0xb19c('0x45')]=moment();if(this[_0xb19c('0x80')](_0x4351d5['delay'])){_0x4351d5['scheduledAt']=moment()[_0xb19c('0xbb')](_0x4351d5[_0xb19c('0xbc')],'minutes');}if(!this['isConfigured'](_0x4351d5[_0xb19c('0x47')])){_0x4351d5[_0xb19c('0x47')]=0x2;}this[_0xb19c('0x3e')][_0xb19c('0x6c')](this,_0x4351d5);return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0xbd'),_0x4351d5['phone'],_0x4351d5[_0xb19c('0x43')],_0x4351d5[_0xb19c('0x45')]));};AGIVertices['prototype']['custom_app']=function(_0x9a91b5){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0xbe'),_0x9a91b5[_0xb19c('0x33')]));var _0x33223f=this['channel'][_0xb19c('0x51')](_0x9a91b5[_0xb19c('0xbf')],_0x9a91b5[_0xb19c('0x74')]);if(_0x33223f[_0xb19c('0x9f')]===-0x1){return _0x33223f;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0xc0'),_0x9a91b5[_0xb19c('0xbf')],_0x9a91b5[_0xb19c('0x74')]));};AGIVertices['prototype'][_0xb19c('0xc1')]=function(_0x41dfa9){logger[_0xb19c('0x29')](util['format'](_0xb19c('0xc2'),_0x41dfa9[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x41dfa9[_0xb19c('0x57')])){return this[_0xb19c('0xa')]['noop'](_0xb19c('0xa5'));}var _0x4a0312='\x22'+_0x41dfa9['text']+'\x22';if(this[_0xb19c('0x80')](_0x41dfa9[_0xb19c('0x74')])){_0x4a0312+=','+_0x41dfa9['options'];}var _0x4bc11b=this[_0xb19c('0xa')][_0xb19c('0x51')]('MRCPSynth',_0x4a0312);if(_0x4bc11b[_0xb19c('0x9f')]===-0x1){return _0x4bc11b;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0xc3'),_0x4a0312));};AGIVertices[_0xb19c('0x10')]['sestektts']=function(_0x53ad98){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0xc4'),_0x53ad98['label']));if(!this['isConfigured'](_0x53ad98['text'])){return this[_0xb19c('0xa')]['noop'](_0xb19c('0xa5'));}var _0x2a9cd8='\x22'+_0x53ad98[_0xb19c('0x57')]+'\x22';if(this[_0xb19c('0x80')](_0x53ad98[_0xb19c('0x74')])){_0x2a9cd8+=','+_0x53ad98[_0xb19c('0x74')];}var _0x65e569=this[_0xb19c('0xa')][_0xb19c('0x51')](_0xb19c('0xa6'),_0x2a9cd8);if(_0x65e569[_0xb19c('0x9f')]===-0x1){return _0x65e569;}return this['channel']['noop'](util[_0xb19c('0x25')](_0xb19c('0xc3'),_0x2a9cd8));};AGIVertices['prototype'][_0xb19c('0xc5')]=function(_0x489c98){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0xc6'),_0x489c98[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x489c98['grammar'])){return this[_0xb19c('0xa')]['noop'](_0xb19c('0xaa'));}var _0x532951=_0x489c98['grammar'];if(this['isConfigured'](_0x489c98[_0xb19c('0x74')])){_0x532951+=','+_0x489c98['options'];}var _0x49c272=this['channel'][_0xb19c('0x51')](_0xb19c('0xab'),_0x532951);if(_0x49c272[_0xb19c('0x9f')]===-0x1){return _0x49c272;}var _0x1b5d87=this[_0xb19c('0x9e')](_0xb19c('0xac'),_0xb19c('0xc7'));if(_0x1b5d87[_0xb19c('0x9f')]===-0x1){return _0x1b5d87;}var _0x2d12f2=this['getAndSetVariable']('RECOG_INPUT()',_0xb19c('0xc8'));if(_0x2d12f2[_0xb19c('0x9f')]===-0x1){return _0x2d12f2;}var _0x241589=this[_0xb19c('0x9e')](_0xb19c('0xb0'),_0xb19c('0xc9'));if(_0x241589[_0xb19c('0x9f')]===-0x1){return _0x241589;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0xb2'),_0x532951));};AGIVertices['prototype'][_0xb19c('0xca')]=function(_0x33d776){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0xcb'),_0x33d776['label']));if(!this[_0xb19c('0x80')](_0x33d776[_0xb19c('0xa9')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xaa'));}var _0x40edef=_0x33d776[_0xb19c('0xa9')];if(this['isConfigured'](_0x33d776[_0xb19c('0x74')])){_0x40edef+=','+_0x33d776[_0xb19c('0x74')];}var _0x518102=this[_0xb19c('0xa')][_0xb19c('0x51')](_0xb19c('0xab'),_0x40edef);if(_0x518102[_0xb19c('0x9f')]===-0x1){return _0x518102;}var _0x1ad1e3=this[_0xb19c('0x9e')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x1ad1e3[_0xb19c('0x9f')]===-0x1){return _0x1ad1e3;}var _0x3435e9=this['getAndSetVariable'](_0xb19c('0xae'),_0xb19c('0xcc'));if(_0x3435e9[_0xb19c('0x9f')]===-0x1){return _0x3435e9;}var _0x565b70=this[_0xb19c('0x9e')](_0xb19c('0xb0'),_0xb19c('0xcd'));if(_0x565b70[_0xb19c('0x9f')]===-0x1){return _0x565b70;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0xb2'),_0x40edef));};AGIVertices[_0xb19c('0x10')]['database']=function(_0x18f192){logger[_0xb19c('0x29')](util[_0xb19c('0x25')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x18f192[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x18f192[_0xb19c('0xce')])){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x18f192,_0xb19c('0xcf'));}var _0x255533=this[_0xb19c('0x17')][_0xb19c('0x6c')](this,_0x18f192[_0xb19c('0xce')]);if(!_0x255533){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x18f192,_0xb19c('0xd0'));}if(!this[_0xb19c('0x80')](_0x18f192['query'])){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x18f192,_0xb19c('0xd1'));}var _0x5718c5=_0x18f192[_0xb19c('0x2b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format']('query:\x20%s',_0x5718c5));var _0x1b499f=this[_0xb19c('0xd2')][_0xb19c('0x6c')](this,_0x255533,_0x5718c5);this[_0xb19c('0x31')]['sync'](this,_0x18f192,_0x5718c5);if(!this['isConfigured'](_0x18f192[_0xb19c('0xd3')])){return this[_0xb19c('0xa')]['noop'](_0xb19c('0xd4'));}var _0x4ff53c=this[_0xb19c('0xd')][_0xb19c('0x6c')](this,_0x18f192['variable_id']);if(!_0x4ff53c){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x18f192,_0xb19c('0xd5'));}var _0x1c87d5=this;_0x1b499f[_0xb19c('0xd6')](function(_0x35d11a,_0x5b44e1){Object[_0xb19c('0xd7')](_0x35d11a)['forEach'](function(_0x407cbe){_0x1c87d5[_0xb19c('0xa')][_0xb19c('0x9a')](util[_0xb19c('0x25')](_0xb19c('0xd8'),_0x4ff53c,_0x5b44e1,_0x407cbe),_0x35d11a[_0x407cbe]);});});this[_0xb19c('0xa')][_0xb19c('0x9a')](util[_0xb19c('0x25')](_0xb19c('0xd9'),_0x4ff53c),_0x1b499f[_0xb19c('0x97')]);return this[_0xb19c('0xa')]['noop'](util[_0xb19c('0x25')](_0xb19c('0xda'),_0x4ff53c));};AGIVertices[_0xb19c('0x10')][_0xb19c('0xdb')]=function(_0x457e03){logger[_0xb19c('0xdc')](util[_0xb19c('0x25')](_0xb19c('0xdd'),_0x457e03[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x457e03[_0xb19c('0xde')])){return this[_0xb19c('0xa')]['error'](_0x457e03,'no\x20user\x20selected');}var _0x46e7ab=this[_0xb19c('0xdf')][_0xb19c('0x6c')](this,_0x457e03[_0xb19c('0xde')]);if(!_0x46e7ab){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x457e03,_0xb19c('0xe0'));}var _0x22528f=this['channel'][_0xb19c('0x51')](_0xb19c('0xe1'),[util[_0xb19c('0x25')](_0xb19c('0xe2'),_0x46e7ab),_0x457e03[_0xb19c('0x60')],_0x457e03[_0xb19c('0xe3')],_0x457e03[_0xb19c('0x5f')]]);if(_0x22528f[_0xb19c('0x9f')]===-0x1){return _0x22528f;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')]('Executed\x20command\x20%s',_0xb19c('0xe1')));};AGIVertices[_0xb19c('0x10')]['dialogflow']=function(_0x3bc3d2){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0xe4'),_0x3bc3d2['label']));if(!this[_0xb19c('0x80')](_0x3bc3d2[_0xb19c('0x76')])){return this['channel'][_0xb19c('0xa4')](_0xb19c('0xe5'));}if(!this[_0xb19c('0x80')](_0x3bc3d2['text'])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xa5'));}this[_0xb19c('0xa')][_0xb19c('0xe6')]=!![];this[_0xb19c('0x31')](_0x3bc3d2);this[_0xb19c('0x3d')](_0x3bc3d2[_0xb19c('0x57')],'in','','');this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0xe7'),_0x3bc3d2[_0xb19c('0x57')]));var _0x49511c=this[_0xb19c('0x75')]['sync'](this,_0x3bc3d2);if(_0x49511c){for(var _0x3bce61 in _0x49511c){if(_0x49511c[_0xb19c('0x91')](_0x3bce61)){this[_0xb19c('0xa')][_0xb19c('0x9a')](util[_0xb19c('0x25')](_0xb19c('0xe8'),_0x3bce61[_0xb19c('0x65')]()),_0x49511c[_0x3bce61]);}}this[_0xb19c('0x3d')](_0x49511c[_0xb19c('0xe9')],_0xb19c('0xea'),'dialogflow','');return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0xeb'),_0x49511c[_0xb19c('0xe9')]));}return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x3bc3d2,_0xb19c('0xec'));};AGIVertices[_0xb19c('0x10')][_0xb19c('0xed')]=function(_0x5c71a6){logger['info'](util[_0xb19c('0x25')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x5c71a6[_0xb19c('0x33')]));if(!this['isConfigured'](_0x5c71a6[_0xb19c('0xee')])){return this[_0xb19c('0xa')]['noop'](_0xb19c('0xef'));}if(!this['isConfigured'](_0x5c71a6[_0xb19c('0x79')])){return this['channel'][_0xb19c('0xa4')]('no\x20client_email\x20configured');}if(!this[_0xb19c('0x80')](_0x5c71a6[_0xb19c('0xf0')])){return this['channel'][_0xb19c('0xa4')](_0xb19c('0xf1'));}if(!this[_0xb19c('0x80')](_0x5c71a6['dialogflowV2_language'])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xf2'));}if(!this[_0xb19c('0x80')](_0x5c71a6[_0xb19c('0x57')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xa5'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x5c71a6);this['createSquareMessage'](_0x5c71a6[_0xb19c('0x57')],'in','','');this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0xf3'),_0x5c71a6['text']));var _0x5543e0=this[_0xb19c('0x78')][_0xb19c('0x6c')](this,_0x5c71a6);if(_0x5543e0){for(var _0x845d1a in _0x5543e0){if(_0x5543e0[_0xb19c('0x91')](_0x845d1a)){if(_0x845d1a!=='providerResponse'){this['channel'][_0xb19c('0x9a')](util[_0xb19c('0x25')](_0xb19c('0xe8'),_0x845d1a[_0xb19c('0x65')]()),_0x5543e0[_0x845d1a]);}}}this[_0xb19c('0x3d')](_0x5543e0[_0xb19c('0xe9')],'out',_0xb19c('0xed'),_0x5543e0[_0xb19c('0xf4')]);return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0xf5'),_0x5543e0[_0xb19c('0xe9')]));}return this['channel'][_0xb19c('0x27')](_0x5c71a6,_0xb19c('0xf6'));};AGIVertices[_0xb19c('0x10')]['sesteknda']=function(_0x1d6af8){logger['info'](util[_0xb19c('0x25')](_0xb19c('0xf7'),_0x1d6af8[_0xb19c('0x33')]));if(!this['isConfigured'](_0x1d6af8[_0xb19c('0xf8')])){return this['channel']['noop'](_0xb19c('0xf9'));}if(!this[_0xb19c('0x80')](_0x1d6af8['username'])){return this[_0xb19c('0xa')][_0xb19c('0xa4')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x1d6af8[_0xb19c('0xfa')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xfb'));}if(!this['isConfigured'](_0x1d6af8['ndassistant_url'])){return this['channel'][_0xb19c('0xa4')]('no\x20text\x20configured');}this[_0xb19c('0xa')][_0xb19c('0xe6')]=!![];this[_0xb19c('0x31')](_0x1d6af8);this['createSquareMessage'](_0x1d6af8['text'],'in','','');this['channel'][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0xfc'),_0x1d6af8[_0xb19c('0x57')]));var _0xef6a65=this[_0xb19c('0x7a')][_0xb19c('0x6c')](this,_0x1d6af8);if(_0xef6a65){for(var _0x5b7346 in _0xef6a65){if(_0xef6a65[_0xb19c('0x91')](_0x5b7346)){this[_0xb19c('0xa')][_0xb19c('0x9a')](util['format'](_0xb19c('0xfd'),_0x5b7346[_0xb19c('0x65')]()),_0xef6a65[_0x5b7346]);}}this[_0xb19c('0x3d')](_0xef6a65[_0xb19c('0xe9')],_0xb19c('0xea'),_0xb19c('0xfe'),'');if(_0xef6a65[_0xb19c('0xff')]){this[_0xb19c('0xa')]['noop'](util[_0xb19c('0x25')](_0xb19c('0x100'),_0xef6a65[_0xb19c('0xff')]));var _0x23dd42=this[_0xb19c('0xa')][_0xb19c('0x101')](_0xef6a65[_0xb19c('0xff')]);try{fs[_0xb19c('0x102')](_0xef6a65['audiofile']+_0xb19c('0x103'));}catch(_0x3d36a2){logger[_0xb19c('0x27')](_0x3d36a2);}return _0x23dd42;}else{return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x104'),_0xef6a65['speech']));}}return this['channel'][_0xb19c('0x27')](_0x1d6af8,_0xb19c('0x105'));};AGIVertices[_0xb19c('0x10')][_0xb19c('0x106')]=function(_0xfc62){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x107'),_0xfc62['label']));return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x106'));};AGIVertices[_0xb19c('0x10')][_0xb19c('0x108')]=function(_0x29f4d1){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x109'),_0x29f4d1[_0xb19c('0x33')]));var _0x9cb32e='';if(_0x29f4d1[_0xb19c('0x10a')]){if(!this[_0xb19c('0x80')](_0x29f4d1[_0xb19c('0x10a')])){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x29f4d1,_0xb19c('0x10b'));}else{var _0x1248ed=parseInt(_0x29f4d1[_0xb19c('0x10a')],0xa);if(isNaN(_0x1248ed)){_0x9cb32e=_0x29f4d1['trunk_id'];}else{_0x9cb32e=this[_0xb19c('0x10c')]['sync'](this,_0x29f4d1[_0xb19c('0x10a')]);if(!_0x9cb32e){return this['channel'][_0xb19c('0x27')](_0x29f4d1,_0xb19c('0x10d'));}}}}else if(_0x29f4d1[_0xb19c('0x10e')]){_0x9cb32e=_0x29f4d1['trunk_name'];}else{return this['channel'][_0xb19c('0x27')](_0x29f4d1,_0xb19c('0x10b'));}var _0x400645=this[_0xb19c('0xa')][_0xb19c('0x51')]('DIAL',[util[_0xb19c('0x25')](_0xb19c('0x10f'),_0x9cb32e,_0x29f4d1['phone']),_0x29f4d1[_0xb19c('0x60')],_0x29f4d1[_0xb19c('0xe3')],_0x29f4d1['url']]);if(_0x400645[_0xb19c('0x9f')]===-0x1){return _0x400645;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x110'),_0xb19c('0xe1')));};AGIVertices[_0xb19c('0x10')][_0xb19c('0x111')]=function(_0x4b58c7){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x112'),_0x4b58c7[_0xb19c('0x33')]));return this['channel'][_0xb19c('0xa4')]('finally');};AGIVertices[_0xb19c('0x10')][_0xb19c('0x9')]=function(_0x4ab43b){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x113'),_0x4ab43b['label']));if(_0x4ab43b[_0xb19c('0x114')]===0x0){return this[_0xb19c('0xa1')](_0x4ab43b);}_0x4ab43b[_0xb19c('0x114')]-=0x1;if(!this['isConfigured'](_0x4ab43b[_0xb19c('0x115')])){return this[_0xb19c('0xa')]['error'](_0x4ab43b,_0xb19c('0x116'));}var _0x36d076=this['getSound']['sync'](this,_0x4ab43b['file_id']);if(!_0x36d076){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x4ab43b,_0xb19c('0x117'));}if(!this['isConfigured'](_0x4ab43b[_0xb19c('0xd3')])){return this[_0xb19c('0xa')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3eb72e=this['channel']['getData'](_0x36d076,_0x4ab43b[_0xb19c('0x118')],_0x4ab43b[_0xb19c('0x119')]);var _0x18b881=_0x3eb72e[_0xb19c('0x9f')]?_0x3eb72e[_0xb19c('0x9f')][_0xb19c('0x46')]():'';logger[_0xb19c('0x29')](_0xb19c('0x11a'),JSON[_0xb19c('0x6f')](_0x3eb72e));if(_0x3eb72e[_0xb19c('0x9f')]===-0x1){this[_0xb19c('0x31')][_0xb19c('0x6c')](this,_0x4ab43b,_0x18b881);return _0x3eb72e;}else if(_0x3eb72e['extra']===_0xb19c('0x60')){_0x3eb72e[_0xb19c('0x9f')]=_0x18b881[_0xb19c('0x97')]>=parseInt(_0x4ab43b[_0xb19c('0x11b')])?'x':'i';}else{_0x3eb72e[_0xb19c('0x9f')]=_0x18b881[_0xb19c('0x97')]>=parseInt(_0x4ab43b['mindigit'])&&_0x18b881[_0xb19c('0x97')]<=parseInt(_0x4ab43b[_0xb19c('0x119')])?'x':'i';}var _0x1b8f24=this[_0xb19c('0xd')][_0xb19c('0x6c')](this,_0x4ab43b[_0xb19c('0xd3')]);if(!_0x1b8f24){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x4ab43b,'no\x20variable\x20found');}this['channel'][_0xb19c('0x9a')](_0x1b8f24,_0x18b881);if(this[_0xb19c('0x80')](_0x4ab43b[_0xb19c('0x11c')])){var _0x291dc4=parseInt(_0x4ab43b[_0xb19c('0x11c')],0xa);var _0x127053=rs[_0xb19c('0x11d')]({'charset':'*','length':_0x291dc4});var _0x5b559e=_0x18b881['length'];if(_0x5b559e>0x0){if(_0x5b559e>_0x291dc4){this[_0xb19c('0x31')][_0xb19c('0x6c')](this,_0x4ab43b,_0x4ab43b['hiddendigitspos']===_0xb19c('0x11e')?_0x127053+_0x18b881[_0xb19c('0x11f')](_0x291dc4):_0x18b881[_0xb19c('0x11f')](0x0,_0x5b559e-_0x291dc4)+_0x127053);}else{this[_0xb19c('0x31')][_0xb19c('0x6c')](this,_0x4ab43b,rs[_0xb19c('0x11d')]({'charset':'*','length':_0x5b559e}));}}else{this[_0xb19c('0x31')][_0xb19c('0x6c')](this,_0x4ab43b,'');}}else{this[_0xb19c('0x31')]['sync'](this,_0x4ab43b,_0x18b881);}return _0x3eb72e;};AGIVertices[_0xb19c('0x10')]['getsecretdigits']=function(_0x45fab5){logger['info'](util[_0xb19c('0x25')](_0xb19c('0x120'),_0x45fab5[_0xb19c('0x33')]));return this[_0xb19c('0x9')](_0x45fab5);};AGIVertices[_0xb19c('0x10')][_0xb19c('0x121')]=function(_0x104e36){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x122'),_0x104e36[_0xb19c('0x33')]));this[_0xb19c('0x31')]['sync'](this,_0x104e36,_0x104e36[_0xb19c('0x123')]);return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x124'),_0x104e36[_0xb19c('0x123')]));};AGIVertices[_0xb19c('0x10')][_0xb19c('0x125')]=function(_0x127fbf){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x126'),_0x127fbf['label']));if(!this['isConfigured'](_0x127fbf[_0xb19c('0x83')])||!this[_0xb19c('0x80')](_0x127fbf['aws_secret_access_key'])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x127'));}if(!this[_0xb19c('0x80')](_0x127fbf[_0xb19c('0x57')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')]('no\x20text\x20configured');}this[_0xb19c('0xa')]['noop'](util[_0xb19c('0x25')](_0xb19c('0x128'),_0x127fbf[_0xb19c('0x57')]));var _0x48f4bd=this[_0xb19c('0x82')][_0xb19c('0x6c')](this,_0x127fbf);if(_0x48f4bd){this[_0xb19c('0xa')]['noop'](util[_0xb19c('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x48f4bd));var _0x237486=this['channel'][_0xb19c('0x101')](_0x48f4bd);try{fs[_0xb19c('0x102')](_0x48f4bd+_0xb19c('0x103'));}catch(_0x5d8f79){logger['error'](_0x5d8f79);}return _0x237486;}return this[_0xb19c('0xa')]['error'](_0x127fbf,_0xb19c('0x129'));};AGIVertices['prototype'][_0xb19c('0x12a')]=function(_0x2a6fe4){logger[_0xb19c('0x29')](util['format'](_0xb19c('0x12b'),_0x2a6fe4[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x2a6fe4[_0xb19c('0x83')])||!this[_0xb19c('0x80')](_0x2a6fe4[_0xb19c('0x88')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x127'));}if(!this[_0xb19c('0x80')](_0x2a6fe4[_0xb19c('0x89')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x12c'));}if(!this[_0xb19c('0x80')](_0x2a6fe4[_0xb19c('0x57')])){return this['channel'][_0xb19c('0xa4')]('no\x20text\x20configured');}this[_0xb19c('0xa')][_0xb19c('0xe6')]=!![];this[_0xb19c('0x31')](_0x2a6fe4);this['createSquareMessage'](_0x2a6fe4[_0xb19c('0x57')],'in','','');this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x12d'),_0x2a6fe4[_0xb19c('0x57')]));var _0x29ddd5=this[_0xb19c('0x87')][_0xb19c('0x6c')](this,_0x2a6fe4);if(_0x29ddd5){for(var _0x4e56e8 in _0x29ddd5){if(_0x29ddd5[_0xb19c('0x91')](_0x4e56e8)&&_[_0xb19c('0x92')](_0x29ddd5[_0x4e56e8])){this[_0xb19c('0xa')]['setVariable'](util['format'](_0xb19c('0x12e'),_0x4e56e8[_0xb19c('0x65')]()),_0x29ddd5[_0x4e56e8]);}}if(_[_0xb19c('0x40')](_0x29ddd5[_0xb19c('0x12f')])){return this['channel'][_0xb19c('0xa4')](_0xb19c('0x130'));}else{this[_0xb19c('0x3d')](_0x29ddd5[_0xb19c('0x12f')],_0xb19c('0xea'),_0xb19c('0x131'),'');return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x132'),_0x29ddd5[_0xb19c('0x12f')]));}}return this['channel'][_0xb19c('0x27')](_0x2a6fe4,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xb19c('0x10')]['googleasr']=function(_0x1be811){logger[_0xb19c('0x29')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x1be811[_0xb19c('0x33')],_0x1be811[_0xb19c('0x60')]));if(!this['isConfigured'](_0x1be811[_0xb19c('0x76')])){return this[_0xb19c('0xa')]['noop'](_0xb19c('0xe5'));}var _0x1e6ef0=_0xb19c('0x133');var _0x56a604=util[_0xb19c('0x25')](_0xb19c('0x134'),FILES_PATH,rs[_0xb19c('0x11d')](0x4));var _0x4d40b8=util[_0xb19c('0x25')](_0xb19c('0x9b'),_0x56a604,_0x1e6ef0);var _0x1279cf=!![];if(_0x1be811['beep']==='NOBEEP'){_0x1279cf=![];}var _0x2cb681=this['channel'][_0xb19c('0x135')](_0x56a604,_0x1e6ef0,_0x1be811[_0xb19c('0x136')],_0x1be811[_0xb19c('0x60')],undefined,_0x1279cf);if(_0x2cb681[_0xb19c('0x9f')]!==-0x1){this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0x137'),_0x4d40b8));var _0x32b18c=this[_0xb19c('0x8a')][_0xb19c('0x6c')](this,_0x1be811,_0x4d40b8);if(_0x32b18c){for(var _0x59e7d8 in _0x32b18c){if(_0x32b18c[_0xb19c('0x91')](_0x59e7d8)){this[_0xb19c('0xa')]['setVariable'](util[_0xb19c('0x25')](_0xb19c('0x138'),_0x59e7d8[_0xb19c('0x65')]()),_0x32b18c[_0x59e7d8]);}}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x32b18c)));}}return _0x2cb681;};AGIVertices[_0xb19c('0x10')]['tildeasr']=function(_0x4833b6){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x139'),_0x4833b6[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x4833b6['appid'])){return this[_0xb19c('0xa')][_0xb19c('0xa4')]('no\x20appid\x20configured');}if(!this[_0xb19c('0x80')](_0x4833b6[_0xb19c('0x8e')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x13a'));}var _0x114ba8='wav';var _0x628ad4=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xb19c('0x11d')](0x4));var _0x54bc93=util['format'](_0xb19c('0x9b'),_0x628ad4,_0x114ba8);var _0x4131f4=!![];if(_0x4833b6['beep']===_0xb19c('0x13b')){_0x4131f4=![];}var _0x2ea386=this[_0xb19c('0xa')]['recordFile'](_0x628ad4,_0x114ba8,_0x4833b6['intKey'],_0x4833b6[_0xb19c('0x60')],undefined,_0x4131f4);if(_0x2ea386['result']!==-0x1){this['channel'][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x13c'),_0x54bc93));var _0x4d0009=this['tildeASR'][_0xb19c('0x6c')](this,_0x4833b6,_0x54bc93);if(_0x4d0009){for(var _0xb1fe4d in _0x4d0009){if(_0x4d0009[_0xb19c('0x91')](_0xb1fe4d)){this[_0xb19c('0xa')][_0xb19c('0x9a')](util[_0xb19c('0x25')](_0xb19c('0x13d'),_0xb1fe4d['toUpperCase']()),_0x4d0009[_0xb1fe4d]);}}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x13e'),JSON[_0xb19c('0x6f')](_0x4d0009)));}}return _0x2ea386;};AGIVertices['prototype'][_0xb19c('0x13f')]=function(_0x19ab1d){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x140'),_0x19ab1d['label']));return this[_0xb19c('0xa')][_0xb19c('0x141')](_0x19ab1d['context'],_0x19ab1d[_0xb19c('0x142')],_0x19ab1d[_0xb19c('0x3a')]);};AGIVertices[_0xb19c('0x10')][_0xb19c('0x143')]=function(_0x3bb94b){logger['info'](util[_0xb19c('0x25')](_0xb19c('0x144'),_0x3bb94b[_0xb19c('0x33')]));if(!this['isConfigured'](_0x3bb94b['condition'])){return this[_0xb19c('0xa')]['error'](_0x3bb94b,'no\x20condition\x20configured');}try{var _0x4061c9=eval(_0x3bb94b['condition'])?_0xb19c('0x145'):_0xb19c('0x146');this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x147'),_0x3bb94b[_0xb19c('0x148')],_0x4061c9));return{'code':0xc8,'result':_0x4061c9};}catch(_0x2a2e63){return{'code':0xc8,'result':_0xb19c('0x146')};}};AGIVertices[_0xb19c('0x10')][_0xb19c('0x149')]=function(_0x9f4078){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x14a'),_0x9f4078[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x9f4078[_0xb19c('0x14b')])){return this[_0xb19c('0xa')]['error'](_0x9f4078,'no\x20interval\x20configured');}var _0x3bfce3=this[_0xb19c('0x14c')][_0xb19c('0x6c')](this,_0x9f4078[_0xb19c('0x14b')]);if(!_0x3bfce3){return this[_0xb19c('0xa')]['error'](_0x9f4078,_0xb19c('0x14d'));}for(var _0x5903a0=0x0;_0x5903a0<_0x3bfce3[_0xb19c('0x97')];_0x5903a0+=0x1){var _0x3ebd43=this[_0xb19c('0xa')]['getVariable'](util[_0xb19c('0x25')]('IFTIME(%s?true:false)',_0x3bfce3[_0x5903a0]));if(_0x3ebd43[_0xb19c('0x9f')]===-0x1){return _0x3ebd43;}logger[_0xb19c('0x29')](util['format'](_0xb19c('0x14e'),_0x3bfce3[_0x5903a0],_0x3ebd43[_0xb19c('0x9d')]));if(_0x3ebd43[_0xb19c('0x9d')]===_0xb19c('0x145')){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x14e'),_0x3bfce3[_0x5903a0],'true'));this['channel'][_0xb19c('0xa4')](util['format'](_0xb19c('0x14e'),_0x3bfce3[_0x5903a0],_0xb19c('0x145')));return{'code':0xc8,'result':'true'};}else{logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x14e'),_0x3bfce3[_0x5903a0],_0xb19c('0x146')));this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x14e'),_0x3bfce3[_0x5903a0],'false'));}}return{'code':0xc8,'result':_0xb19c('0x146')};};AGIVertices[_0xb19c('0x10')][_0xb19c('0x14f')]=function(_0x3cfec5){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x150'),_0x3cfec5[_0xb19c('0x33')]));return this[_0xb19c('0xa')]['hangup']();};AGIVertices[_0xb19c('0x10')][_0xb19c('0x151')]=function(_0xf779c5){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x152'),_0xf779c5[_0xb19c('0x33')]));if(!this['isConfigured'](_0xf779c5[_0xb19c('0x76')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xe5'));}var _0x3c7875=_0xb19c('0x133');var _0x3ad3ed=util[_0xb19c('0x25')](_0xb19c('0x134'),FILES_PATH,rs[_0xb19c('0x11d')](0x4));var _0x6143cd=util[_0xb19c('0x25')](_0xb19c('0x9b'),_0x3ad3ed,_0x3c7875);var _0x35763f=!![];if(_0xf779c5['beep']===_0xb19c('0x13b')){_0x35763f=![];}var _0x997b83=this['channel']['recordFile'](_0x3ad3ed,_0x3c7875,_0xf779c5[_0xb19c('0x136')],_0xf779c5[_0xb19c('0x60')],undefined,_0x35763f);if(_0x997b83[_0xb19c('0x9f')]!==-0x1){this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x153'),_0x6143cd));var _0x1e0e35=this['ispeechASR'][_0xb19c('0x6c')](this,_0xf779c5,_0x6143cd);if(_0x1e0e35){for(var _0x1ce3b7 in _0x1e0e35){if(_0x1e0e35[_0xb19c('0x91')](_0x1ce3b7)){this[_0xb19c('0xa')][_0xb19c('0x9a')](util[_0xb19c('0x25')](_0xb19c('0x154'),_0x1ce3b7[_0xb19c('0x65')]()),_0x1e0e35[_0x1ce3b7]);}}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x155'),JSON['stringify'](_0x1e0e35)));}}return _0x997b83;};AGIVertices['prototype']['ispeechtts']=function(_0x2d9084){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x156'),_0x2d9084['label']));if(!this[_0xb19c('0x80')](_0x2d9084['key'])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xe5'));}if(!this[_0xb19c('0x80')](_0x2d9084[_0xb19c('0x57')])){return this[_0xb19c('0xa')]['noop']('no\x20text\x20configured');}this[_0xb19c('0xa')]['noop'](util[_0xb19c('0x25')](_0xb19c('0x157'),_0x2d9084[_0xb19c('0x57')]));var _0xbf16ec=this[_0xb19c('0x7b')][_0xb19c('0x6c')](this,_0x2d9084);if(_0xbf16ec){this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0x153'),_0xbf16ec));var _0x9bbbed=this[_0xb19c('0xa')][_0xb19c('0x101')](_0xbf16ec,_0x2d9084[_0xb19c('0x136')]);try{fs[_0xb19c('0x102')](_0xbf16ec+_0xb19c('0x103'));}catch(_0x14b7c9){logger['error'](_0x14b7c9);}return _0x9bbbed;}return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x2d9084,_0xb19c('0x158'));};AGIVertices[_0xb19c('0x10')][_0xb19c('0x159')]=function(_0x469806){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x15a'),_0x469806['label']));if(!this[_0xb19c('0x80')](_0x469806[_0xb19c('0x15b')])){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x469806,_0xb19c('0x15c'));}logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x15d'),this[_0xb19c('0xa')]['callerid'],_0x469806['findBy']));var _0x113458=this['agentLogin']['sync'](this,_0x469806[_0xb19c('0x15b')]);if(_0x113458){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x15e'),this['channel'][_0xb19c('0x36')],_0x469806[_0xb19c('0x15b')]));this[_0xb19c('0xa')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb19c('0x36')],_0x469806[_0xb19c('0x15b')]));return{'code':0xc8,'result':_0xb19c('0x15f')};}else{logger['info'](util[_0xb19c('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb19c('0xa')][_0xb19c('0x36')],_0x469806[_0xb19c('0x15b')]));this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb19c('0xa')]['callerid'],_0x469806[_0xb19c('0x15b')]));return{'code':0xc8,'result':_0xb19c('0x160')};}};AGIVertices[_0xb19c('0x10')]['logout']=function(_0x14832c){logger[_0xb19c('0x29')](util['format'](_0xb19c('0x161'),_0x14832c[_0xb19c('0x33')]));if(!this['isConfigured'](_0x14832c[_0xb19c('0x15b')])){return this['channel'][_0xb19c('0x27')](_0x14832c,_0xb19c('0x15c'));}logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x15d'),this[_0xb19c('0xa')][_0xb19c('0x36')],_0x14832c[_0xb19c('0x15b')]));var _0x180c6f=this['agentLogout']['sync'](this,_0x14832c[_0xb19c('0x15b')]);if(_0x180c6f){logger[_0xb19c('0x29')](util['format'](_0xb19c('0x15e'),this[_0xb19c('0xa')][_0xb19c('0x36')],_0x14832c[_0xb19c('0x15b')]));this['channel'][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x15e'),this['channel'][_0xb19c('0x36')],_0x14832c[_0xb19c('0x15b')]));return{'code':0xc8,'result':_0xb19c('0x15f')};}else{logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x162'),this[_0xb19c('0xa')][_0xb19c('0x36')],_0x14832c[_0xb19c('0x15b')]));this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb19c('0xa')][_0xb19c('0x36')],_0x14832c[_0xb19c('0x15b')]));return{'code':0xc8,'result':_0xb19c('0x160')};}};AGIVertices[_0xb19c('0x10')][_0xb19c('0x163')]=function(_0x5db2be){logger['info'](util[_0xb19c('0x25')](_0xb19c('0x164'),_0x5db2be[_0xb19c('0x33')]));if(!this['isConfigured'](_0x5db2be['operation'])){return this['channel'][_0xb19c('0x27')](_0x5db2be,_0xb19c('0x165'));}this['channel'][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x166'),_0x5db2be[_0xb19c('0x167')]));var _0x3d37e6=eval(_0x5db2be[_0xb19c('0x167')]);if(!this[_0xb19c('0x80')](_0x5db2be[_0xb19c('0xd3')])){return this['channel']['noop'](_0xb19c('0xd4'));}var _0x3e0418=this[_0xb19c('0xd')][_0xb19c('0x6c')](this,_0x5db2be['variable_id']);if(!_0x3e0418){return this[_0xb19c('0xa')]['error'](_0x5db2be,_0xb19c('0xd5'));}if(_[_0xb19c('0x96')](_0x3d37e6)){var _0xa7e00d=this;_0x3d37e6[_0xb19c('0xd6')](function(_0x15827d,_0x54cfc7){_0xa7e00d['channel']['setVariable'](util[_0xb19c('0x25')]('%s[%s]',_0x3e0418,_0x54cfc7),_0x15827d);});return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')]('variable\x20%s[key]\x20set',_0x3e0418));}else{return this[_0xb19c('0xa')]['setVariable'](_0x3e0418,_0x3d37e6);}};AGIVertices[_0xb19c('0x10')][_0xb19c('0x8')]=function(_0x3a262e){logger[_0xb19c('0x29')](util['format'](_0xb19c('0x168'),_0x3a262e[_0xb19c('0x33')]));if(_0x3a262e['retry']===0x0){return this[_0xb19c('0xa1')](_0x3a262e);}_0x3a262e[_0xb19c('0x114')]-=0x1;if(!this[_0xb19c('0x80')](_0x3a262e[_0xb19c('0x115')])){return this[_0xb19c('0xa')]['error'](_0x3a262e,_0xb19c('0x116'));}var _0x4d3653=this['getSound'][_0xb19c('0x6c')](this,_0x3a262e[_0xb19c('0x115')]);if(!_0x4d3653){return this['channel'][_0xb19c('0x27')](_0x3a262e,_0xb19c('0x117'));}var _0x467a8d=this[_0xb19c('0xa')][_0xb19c('0x169')](_0x4d3653,_0x3a262e['response'],_0x3a262e[_0xb19c('0x16a')]);var _0x5b1ba6=_0x467a8d['result'];if(_0x467a8d['result']===-0x1){this['createSquareDetailsReport'][_0xb19c('0x6c')](this,_0x3a262e,'-1');return _0x467a8d;}else if(_0x467a8d[_0xb19c('0x9d')]===_0xb19c('0x60')){_0x467a8d[_0xb19c('0x9f')]=_0x467a8d['result'][_0xb19c('0x97')]>0x0?_0x467a8d['result']:'t';}else if(_['isEmpty'](_0x467a8d['result'])){_0x467a8d[_0xb19c('0x9f')]='#';_0x5b1ba6='#';}if(!this[_0xb19c('0x80')](_0x3a262e[_0xb19c('0xd3')])){this[_0xb19c('0xa')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x323896=this[_0xb19c('0xd')]['sync'](this,_0x3a262e[_0xb19c('0xd3')]);if(!_0x323896){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x3a262e,_0xb19c('0xd5'));}this[_0xb19c('0xa')][_0xb19c('0x9a')](_0x323896,_0x5b1ba6);}this['createSquareDetailsReport']['sync'](this,_0x3a262e,_0x5b1ba6);return _0x467a8d;};AGIVertices[_0xb19c('0x10')][_0xb19c('0xa4')]=function(_0x39335b){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x16b'),_0x39335b[_0xb19c('0x33')]));return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0x39335b[_0xb19c('0x16c')]||_0x39335b[_0xb19c('0x33')]);};AGIVertices[_0xb19c('0x10')][_0xb19c('0x16d')]=function(_0x24f808){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x16e'),_0x24f808[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x24f808['findBy'])){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x24f808,_0xb19c('0x15c'));}logger['info'](util['format'](_0xb19c('0x15d'),this['channel']['callerid'],_0x24f808['findBy']));var _0x219207=this[_0xb19c('0x16f')]['sync'](this,_0x24f808[_0xb19c('0x170')]);var _0x670df0=this[_0xb19c('0x49')]['sync'](this,_0x24f808['findBy'],_0x219207);if(_0x670df0){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x15e'),this[_0xb19c('0xa')]['callerid'],_0x24f808[_0xb19c('0x15b')]));this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0x15e'),this[_0xb19c('0xa')][_0xb19c('0x36')],_0x24f808[_0xb19c('0x15b')]));return{'code':0xc8,'result':_0xb19c('0x15f')};}else{logger['info'](util[_0xb19c('0x25')](_0xb19c('0x162'),this['channel'][_0xb19c('0x36')],_0x24f808[_0xb19c('0x15b')]));this[_0xb19c('0xa')]['noop'](util['format'](_0xb19c('0x15e'),this[_0xb19c('0xa')][_0xb19c('0x36')],_0x24f808[_0xb19c('0x15b')]));return{'code':0xc8,'result':_0xb19c('0x160')};}};AGIVertices[_0xb19c('0x10')]['playback']=function(_0x575a62){logger[_0xb19c('0x29')](util[_0xb19c('0x25')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x575a62[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x575a62[_0xb19c('0x115')])){return this['channel'][_0xb19c('0x27')](_0x575a62,_0xb19c('0x116'));}var _0x553bc0=this[_0xb19c('0x1b')][_0xb19c('0x6c')](this,_0x575a62[_0xb19c('0x115')]);if(!_0x553bc0){return this['channel'][_0xb19c('0x27')](_0x575a62,_0xb19c('0x117'));}var _0x5ab6dd=this['channel']['exec']('PLAYBACK',[_0x553bc0,_0x575a62[_0xb19c('0xe3')]]);if(_0x5ab6dd[_0xb19c('0x9f')]===-0x1){return _0x5ab6dd;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0xc0'),_0xb19c('0x171'),_0x553bc0));};AGIVertices[_0xb19c('0x10')][_0xb19c('0x172')]=function(_0x4b537a){logger[_0xb19c('0x29')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4b537a[_0xb19c('0x33')]));if(!this['isConfigured'](_0x4b537a[_0xb19c('0x173')])){return this['channel'][_0xb19c('0x27')](_0x4b537a,_0xb19c('0x174'));}var _0x982d83='';var _0x164d3e=parseInt(_0x4b537a[_0xb19c('0x173')],0xa);if(isNaN(_0x164d3e)){_0x982d83=_0x4b537a[_0xb19c('0x173')];}else{_0x982d83=this[_0xb19c('0x11')][_0xb19c('0x6c')](this,_0x4b537a[_0xb19c('0x173')]);if(!_0x982d83){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x4b537a,'no\x20queue\x20found');}}var _0x20f673='';if(this[_0xb19c('0x80')](_0x4b537a['file_id'])){var _0x28ab26=this[_0xb19c('0x1b')][_0xb19c('0x6c')](this,_0x4b537a[_0xb19c('0x115')]);if(_0x28ab26){_0x20f673=_0x28ab26;}}this[_0xb19c('0x31')][_0xb19c('0x6c')](this,_0x4b537a,_0x982d83);if(_0x4b537a[_0xb19c('0xe3')][_0xb19c('0x175')]('x')<0x0){_0x4b537a[_0xb19c('0xe3')]+='x';}if(_0x4b537a[_0xb19c('0xe3')][_0xb19c('0x175')]('X')<0x0){_0x4b537a[_0xb19c('0xe3')]+='X';}this[_0xb19c('0xa')][_0xb19c('0x9a')](_0xb19c('0x176'),_0x982d83?_0x982d83[_0xb19c('0x177')]():'');var _0xf7fa40=this[_0xb19c('0xa')][_0xb19c('0x51')](_0xb19c('0x178'),[_0x982d83,_0x4b537a[_0xb19c('0xe3')],_0x4b537a[_0xb19c('0x5f')],_0x20f673,_0x4b537a[_0xb19c('0x60')],_0x4b537a['agi'],_0x4b537a[_0xb19c('0x179')],_0x4b537a[_0xb19c('0x17a')],'',_0x4b537a[_0xb19c('0x17b')]]);if(_0xf7fa40[_0xb19c('0x9f')]===-0x1){return _0xf7fa40;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0xc0'),'QUEUE',_0x982d83));};AGIVertices['prototype'][_0xb19c('0x17c')]=function(_0x983a86){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x17d'),_0x983a86['label']));var _0x26a4eb=_0x983a86['recordingFormat']||'wav';var _0x164751=util[_0xb19c('0x25')](_0xb19c('0x17e'),this['channel'][_0xb19c('0x32')],rs['generate'](0x5));var _0x5a7722=util['format'](_0xb19c('0x17f'),FILES_PATH,_0x164751,_0x26a4eb);var _0x181795=util[_0xb19c('0x25')](_0xb19c('0x134'),FILES_PATH,_0x164751);this[_0xb19c('0x37')][_0xb19c('0x6c')](this,_0x983a86,_0x164751,_0x5a7722);this[_0xb19c('0xa')][_0xb19c('0x9a')]('RECORDING_SAVENAME',_0x164751);logger[_0xb19c('0x29')](_0xb19c('0x180'),_0x181795,_0x26a4eb,_0x983a86[_0xb19c('0x181')],_0x983a86['timeout']);return this[_0xb19c('0xa')][_0xb19c('0x135')](_0x181795,_0x26a4eb,_0x983a86[_0xb19c('0x181')],_0x983a86[_0xb19c('0x60')],undefined,!![]);};AGIVertices[_0xb19c('0x10')][_0xb19c('0x182')]=function(_0x5c409e){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x183'),_0x5c409e[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x5c409e[_0xb19c('0x5f')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')]('no\x20url\x20configured');}var _0x104d33=this[_0xb19c('0x5e')][_0xb19c('0x6c')](this,_0x5c409e);logger[_0xb19c('0x29')](util['format'](_0xb19c('0x184'),util['inspect'](_0x104d33,{'showHidden':![],'depth':null})));if(!this[_0xb19c('0x80')](_0x5c409e[_0xb19c('0xd3')])){return this[_0xb19c('0xa')]['noop'](_0xb19c('0x185'));}var _0x5d36ef=this[_0xb19c('0xd')][_0xb19c('0x6c')](this,_0x5c409e[_0xb19c('0xd3')]);if(!_0x5d36ef){return this[_0xb19c('0xa')]['error'](_0x5c409e,_0xb19c('0xd5'));}this['channel']['setVariable'](util['format']('%s_STATUS_CODE',_0x5d36ef),_0x104d33[_0xb19c('0x71')]?_0x104d33[_0xb19c('0x71')]:_0xb19c('0x186'));this['channel'][_0xb19c('0x9a')](util[_0xb19c('0x25')]('%s_STATUS_MESSAGE',_0x5d36ef),_0x104d33[_0xb19c('0x72')]?_0x104d33[_0xb19c('0x72')]:'OK');if(_0x104d33[_0xb19c('0x66')]){try{this[_0xb19c('0x99')](_0x104d33[_0xb19c('0x66')],_0x5d36ef);}catch(_0x17a89b){logger[_0xb19c('0x27')](util[_0xb19c('0x25')](_0xb19c('0x187'),_0x5d36ef));}}return this['channel']['noop'](util[_0xb19c('0x25')](_0xb19c('0xda'),_0x5d36ef));};AGIVertices['prototype'][_0xb19c('0x188')]=function(_0x3ac5c5){logger['info'](util[_0xb19c('0x25')](_0xb19c('0x189'),_0x3ac5c5[_0xb19c('0x33')]));return this[_0xb19c('0xa')][_0xb19c('0x18a')](_0x3ac5c5['digits'][_0xb19c('0x53')](/\s+/g,''),_0x3ac5c5[_0xb19c('0x181')]);};AGIVertices['prototype'][_0xb19c('0x18b')]=function(_0x28e40c){logger[_0xb19c('0x29')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x28e40c[_0xb19c('0x33')]));return this[_0xb19c('0xa')][_0xb19c('0x18c')](_0x28e40c[_0xb19c('0x61')][_0xb19c('0x53')](/\s+/g,''),_0x28e40c[_0xb19c('0x181')]);};AGIVertices[_0xb19c('0x10')][_0xb19c('0x18d')]=function(_0x305673){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x18e'),_0x305673[_0xb19c('0x33')]));return this[_0xb19c('0xa')][_0xb19c('0x18f')](_0x305673[_0xb19c('0x57')],_0x305673['escape_digits']);};AGIVertices[_0xb19c('0x10')]['sendMail']=function(_0x12b2a7){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x190'),_0x12b2a7['label']));if(!this[_0xb19c('0x80')](_0x12b2a7[_0xb19c('0x191')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')]('no\x20mail\x20account\x20configured');}var _0xb02a7a=this[_0xb19c('0x1e')][_0xb19c('0x6c')](this,_0x12b2a7[_0xb19c('0x191')]);if(!_0xb02a7a||!_0xb02a7a[_0xb19c('0x192')]){return this[_0xb19c('0xa')]['error'](_0x12b2a7,_0xb19c('0x193'));}var _0x30ed8b={'from':util[_0xb19c('0x25')](_0xb19c('0x194'),_0xb02a7a[_0xb19c('0x16')],_0xb02a7a[_0xb19c('0x195')]||_0xb02a7a[_0xb19c('0x192')]['user']),'to':_0x12b2a7['to']||'','cc':_0x12b2a7['cc']||'','bcc':_0x12b2a7[_0xb19c('0x196')]||'','subject':_0x12b2a7[_0xb19c('0x197')],'html':_0x12b2a7[_0xb19c('0x57')],'text':_0x12b2a7[_0xb19c('0x57')]};if(this[_0xb19c('0x80')](_0x12b2a7[_0xb19c('0x198')])){}logger[_0xb19c('0xdc')](_0xb19c('0x199'),JSON[_0xb19c('0x6f')](_0x30ed8b));this[_0xb19c('0x31')][_0xb19c('0x6c')](this,_0x12b2a7,_0x12b2a7[_0xb19c('0x191')]);this[_0xb19c('0xa')][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x19a'),_0xb02a7a[_0xb19c('0x16')]));this[_0xb19c('0x20')][_0xb19c('0x6c')](this,_0xb02a7a[_0xb19c('0x19b')],_0x30ed8b);return this[_0xb19c('0xa')][_0xb19c('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb19c('0x10')][_0xb19c('0x19c')]=function(_0x26ebad){logger['info'](util[_0xb19c('0x25')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x26ebad[_0xb19c('0x33')]));return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x19d'));};AGIVertices[_0xb19c('0x10')]['sendSMS']=function(_0x5db373){logger[_0xb19c('0x29')](util[_0xb19c('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5db373[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x5db373[_0xb19c('0x19e')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x19f'));}var _0x3a299f=this[_0xb19c('0x2f')][_0xb19c('0x6c')](this,_0x5db373['sms_account_id']);if(!_0x3a299f){return this['channel']['error'](_0x5db373,_0xb19c('0x1a0'));}var _0x11ecb8={'body':_0x5db373[_0xb19c('0x1a1')],'phone':_0x5db373['to']||'','SmsAccountId':_0x3a299f['id']};logger[_0xb19c('0xdc')]('sendSMS\x20message',JSON['stringify'](_0x11ecb8));this[_0xb19c('0x31')]['sync'](this,_0x5db373,_0x5db373[_0xb19c('0x19e')]);this['channel'][_0xb19c('0xa4')](util['format'](_0xb19c('0x1a2'),_0x3a299f[_0xb19c('0x16')]));this[_0xb19c('0x30')]['sync'](this,_0x11ecb8);return this[_0xb19c('0xa')][_0xb19c('0xa4')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb19c('0x10')][_0xb19c('0x1a3')]=function(_0x3061af){logger[_0xb19c('0x29')](util['format'](_0xb19c('0x1a4'),_0x3061af[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x3061af['variable_id'])){return this['channel'][_0xb19c('0x27')](_0x3061af,_0xb19c('0x1a5'));}var _0x39b616=this['getVariable'][_0xb19c('0x6c')](this,_0x3061af['variable_id']);if(!_0x39b616){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x3061af,_0xb19c('0xd5'));}return this[_0xb19c('0xa')][_0xb19c('0x9a')](_0x39b616,_0x3061af[_0xb19c('0x1a6')]);};AGIVertices[_0xb19c('0x10')]['start']=function(_0x48ce79){logger['info'](util[_0xb19c('0x25')](_0xb19c('0x1a7'),_0x48ce79[_0xb19c('0x33')]));this['channel'][_0xb19c('0xa4')](_0xb19c('0x1a8'));if(_0x48ce79[_0xb19c('0xb6')]===_0xb19c('0x1a9')){this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x1aa'));return this['channel'][_0xb19c('0xb6')]();}return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0x1ab'));};AGIVertices[_0xb19c('0x10')]['subproject']=function(_0xf28e53){logger['info'](util[_0xb19c('0x25')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xf28e53[_0xb19c('0x33')]));if(!this['isConfigured'](_0xf28e53[_0xb19c('0x1ac')])){return this['channel'][_0xb19c('0x27')](_0xf28e53,_0xb19c('0x1ad'));}var _0x11d9ef=this[_0xb19c('0x14')][_0xb19c('0x6c')](this,_0xf28e53['project_id']);if(!this[_0xb19c('0x80')](_0x11d9ef)){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0xf28e53,util[_0xb19c('0x25')](_0xb19c('0x1ae'),_0xf28e53[_0xb19c('0x1ac')]));}if(_0x11d9ef===this[_0xb19c('0xa')]['arg_1']){return this['channel'][_0xb19c('0x27')](_0xf28e53,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xb19c('0x31')]['sync'](this,_0xf28e53,_0x11d9ef);var _0xac5e4c=this[_0xb19c('0xa')][_0xb19c('0x51')]('AGI',util[_0xb19c('0x25')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xb19c('0xb3')]['host']||_0xb19c('0x1af'),_0x11d9ef,this[_0xb19c('0xa')][_0xb19c('0x35')]));if(_0xac5e4c['result']===-0x1){return _0xac5e4c;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0xc0'),_0xb19c('0x1b0'),_0x11d9ef));};AGIVertices['prototype'][_0xb19c('0x1b1')]=function(_0x4a4b2f){logger[_0xb19c('0x29')](util['format'](_0xb19c('0x1b2'),_0x4a4b2f[_0xb19c('0x33')]));var _0x31d51c=this[_0xb19c('0x50')][_0xb19c('0x6c')](this,_0x4a4b2f[_0xb19c('0x1b3')]);this[_0xb19c('0x31')][_0xb19c('0x6c')](this,_0x4a4b2f,_0x4a4b2f[_0xb19c('0x1b3')]);if(this[_0xb19c('0x80')](_0x4a4b2f[_0xb19c('0xd3')])){var _0x4188e6=this[_0xb19c('0xd')][_0xb19c('0x6c')](this,_0x4a4b2f[_0xb19c('0xd3')]);if(_0x4188e6){this['channel'][_0xb19c('0x9a')](_0x4188e6,_0x31d51c);return this[_0xb19c('0xa')]['noop'](util[_0xb19c('0x25')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4a4b2f['command'],_0x4188e6));}}return this['channel'][_0xb19c('0xa4')](util['format'](_0xb19c('0x1b4'),_0x4a4b2f['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x313bbb){logger['info'](util[_0xb19c('0x25')](_0xb19c('0x1b5'),_0x313bbb['label']));_0x313bbb[_0xb19c('0x57')]=_0x313bbb[_0xb19c('0x57')][_0xb19c('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb19c('0x80')](_0x313bbb['apiKey'])){return this['channel'][_0xb19c('0xa4')](_0xb19c('0x1b6'));}if(!this[_0xb19c('0x80')](_0x313bbb[_0xb19c('0x57')])){return this['channel'][_0xb19c('0xa4')](_0xb19c('0xa5'));}this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0x1b7'),_0x313bbb[_0xb19c('0x57')]));var _0x3c4b37=this[_0xb19c('0x54')][_0xb19c('0x6c')](this,_0x313bbb);if(_0x3c4b37){this['channel'][_0xb19c('0xa4')](util['format'](_0xb19c('0x1b8'),_0x3c4b37));var _0x55bedf=this[_0xb19c('0xa')]['streamFile'](_0x3c4b37);try{fs['unlink'](_0x3c4b37+'.wav');}catch(_0xcb674b){logger[_0xb19c('0x27')](_0xcb674b);}return _0x55bedf;}return this[_0xb19c('0xa')]['error'](_0x313bbb,_0xb19c('0x1b9'));};AGIVertices['prototype'][_0xb19c('0x1ba')]=function(_0x2a1004){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x1bb'),_0x2a1004[_0xb19c('0x33')]));_0x2a1004[_0xb19c('0x57')]=_0x2a1004[_0xb19c('0x57')][_0xb19c('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2a1004[_0xb19c('0x57')])){return this[_0xb19c('0xa')][_0xb19c('0xa4')](_0xb19c('0xa5'));}this['channel'][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x1bc'),_0x2a1004['text']));var _0x43686d=this[_0xb19c('0x5c')][_0xb19c('0x6c')](this,_0x2a1004);if(_0x43686d){this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0x1bd'),_0x43686d));var _0x39d18a=this[_0xb19c('0xa')][_0xb19c('0x101')](_0x43686d);try{fs['unlink'](_0x43686d+_0xb19c('0x103'));}catch(_0x4ae292){logger[_0xb19c('0x27')](_0x4ae292);}return _0x39d18a;}return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x2a1004,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb19c('0x10')][_0xb19c('0x1be')]=function(_0x1da553){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x1bf'),_0x1da553[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x1da553[_0xb19c('0x15b')])){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x1da553,_0xb19c('0x15c'));}logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x15d'),this[_0xb19c('0xa')]['callerid'],_0x1da553['findBy']));var _0x1e8df9=this[_0xb19c('0x4b')][_0xb19c('0x6c')](this,_0x1da553[_0xb19c('0x15b')]);if(_0x1e8df9){logger[_0xb19c('0x29')](util[_0xb19c('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb19c('0xa')][_0xb19c('0x36')],_0x1da553[_0xb19c('0x15b')]));this['channel'][_0xb19c('0xa4')](util[_0xb19c('0x25')](_0xb19c('0x15e'),this[_0xb19c('0xa')][_0xb19c('0x36')],_0x1da553[_0xb19c('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb19c('0x29')](util[_0xb19c('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x1da553[_0xb19c('0x15b')]));this[_0xb19c('0xa')]['noop'](util[_0xb19c('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb19c('0xa')]['callerid'],_0x1da553['findBy']));return{'code':0xc8,'result':_0xb19c('0x160')};}};AGIVertices[_0xb19c('0x10')][_0xb19c('0x1c0')]=function(_0x5e013f){logger[_0xb19c('0x29')](util[_0xb19c('0x25')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5e013f['label']));var _0x385d15=this[_0xb19c('0xa')][_0xb19c('0x51')](_0xb19c('0x1c1'),[_0x5e013f[_0xb19c('0x1c2')],_0x5e013f[_0xb19c('0x74')]]);if(_0x385d15['result']===-0x1){return _0x385d15;}return this[_0xb19c('0xa')][_0xb19c('0xa4')](util['format'](_0xb19c('0xc0'),'VOICEMAIL',_0x5e013f['mailbox']));};AGIVertices[_0xb19c('0x10')][_0xb19c('0x1c3')]=function(_0x32db49){logger[_0xb19c('0x29')](util[_0xb19c('0x25')](_0xb19c('0x1c4'),_0x32db49[_0xb19c('0x33')]));if(!this[_0xb19c('0x80')](_0x32db49[_0xb19c('0xd3')])){return this[_0xb19c('0xa')][_0xb19c('0x27')](_0x32db49,_0xb19c('0x1a5'));}var _0x55fc04=this[_0xb19c('0xd')][_0xb19c('0x6c')](this,_0x32db49['variable_id']);if(!_0x55fc04){return this[_0xb19c('0xa')]['error'](_0x32db49,_0xb19c('0xd5'));}var _0x4aff76=this[_0xb19c('0xa')][_0xb19c('0xd')](_0x55fc04);return{'code':0xc8,'result':_0x4aff76['extra']?_0x4aff76['extra']:'-'};};String[_0xb19c('0x10')][_0xb19c('0x1c5')]=function(_0x19ebc8,_0x393336){return this['split'](_0x19ebc8)[_0xb19c('0x1c6')](_0x393336);};module['exports']=AGIVertices; \ No newline at end of file +var _0x345e=['url','method','timeout','number','includes','PUT','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','clone','hasOwnProperty','isString','recursiveNodeIndex','length','replaceAllVariables','saveRestApiResult','isPlainObject','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','no\x20user\x20selected','getUser','SIP/%s','opts','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','awsLex','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','wav','%s/recordings/%s','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','pause_id','success','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','command','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','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueueById','then','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundById','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','getSoundPath','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','callerid','uniqueid','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','isEmpty','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI'];(function(_0x19f55e,_0xd4ffc3){var _0x44cfee=function(_0x138a86){while(--_0x138a86){_0x19f55e['push'](_0x19f55e['shift']());}};_0x44cfee(++_0xd4ffc3);}(_0x345e,0x168));var _0xe345=function(_0x8dd85f,_0x102a4c){_0x8dd85f=_0x8dd85f-0x0;var _0x5d55ee=_0x345e[_0x8dd85f];return _0x5d55ee;};'use strict';var fs=require('fs');var util=require(_0xe345('0x0'));var _=require(_0xe345('0x1'));var sh=require('shelljs');var odbc=require(_0xe345('0x2'))();var rs=require(_0xe345('0x3'));var moment=require(_0xe345('0x4'));var Mustache=require(_0xe345('0x5'));var rp=require(_0xe345('0x6'));var logger=require(_0xe345('0x7'))(_0xe345('0x8'));var config=require(_0xe345('0x9'));var shared=require(_0xe345('0xa'));var scripts=require('./scripts');var FILES_PATH=_0xe345('0xb');var recursiveMapAttributes=[_0xe345('0xc'),_0xe345('0xd')];var verticesWithRetry=[_0xe345('0xe'),_0xe345('0xf'),_0xe345('0x10')];var AGIVertices=function(_0x517809,_0x5912b2,_0x41bd55){this[_0xe345('0x11')]=_0x517809;this[_0xe345('0x12')]=_0x5912b2;this[_0xe345('0x13')]=_0x41bd55;};AGIVertices[_0xe345('0x14')][_0xe345('0x15')]=function(_0x2c9cf7,_0x45716c){this[_0xe345('0x12')][_0xe345('0x16')](_0x2c9cf7)['then'](function(_0xf95224){_0x45716c(null,_0xf95224?_0xf95224[_0xe345('0x17')]:![]);})['catch'](function(_0x5d9379){_0x45716c(_0x5d9379);});};AGIVertices[_0xe345('0x14')]['getVoiceQueue']=function(_0x2230b7,_0x4ee2e9){this['rpc'][_0xe345('0x18')](_0x2230b7)[_0xe345('0x19')](function(_0x4097d9){_0x4ee2e9(null,_0x4097d9?_0x4097d9[_0xe345('0x17')]:![]);})[_0xe345('0x1a')](function(_0x1ce318){_0x4ee2e9(_0x1ce318);});};AGIVertices[_0xe345('0x14')][_0xe345('0x1b')]=function(_0x3a3f32,_0x1f983c){this['rpc']['getSquareProjectById'](_0x3a3f32)[_0xe345('0x19')](function(_0x21f20a){_0x1f983c(null,_0x21f20a?_0x21f20a[_0xe345('0x17')]:![]);})[_0xe345('0x1a')](function(_0x412bfa){_0x1f983c(_0x412bfa);});};AGIVertices['prototype'][_0xe345('0x1c')]=function(_0x143856,_0x58b9bc){this[_0xe345('0x12')][_0xe345('0x1d')](_0x143856)[_0xe345('0x19')](function(_0x6ea93d){_0x58b9bc(null,_0x6ea93d?_0x6ea93d[_0xe345('0x1e')]:![]);})[_0xe345('0x1a')](function(_0x5a8c9b){_0x58b9bc(_0x5a8c9b);});};AGIVertices[_0xe345('0x14')]['getUser']=function(_0x176e04,_0x5e3308){this[_0xe345('0x12')][_0xe345('0x1f')](_0x176e04)[_0xe345('0x19')](function(_0x442811){_0x5e3308(null,_0x442811?_0x442811['name']:![]);})['catch'](function(_0x46f64d){_0x5e3308(_0x46f64d);});};AGIVertices[_0xe345('0x14')]['getTrunk']=function(_0x575c9a,_0x5cf6aa){this[_0xe345('0x12')][_0xe345('0x20')](_0x575c9a)[_0xe345('0x19')](function(_0x58cddd){_0x5cf6aa(null,_0x58cddd?_0x58cddd['name']:![]);})[_0xe345('0x1a')](function(_0x4e017b){_0x5cf6aa(_0x4e017b);});};AGIVertices[_0xe345('0x14')][_0xe345('0x21')]=function(_0x4cd00e,_0x517ffa){var _0x13ecf1=this;this['rpc'][_0xe345('0x22')](_0x4cd00e)[_0xe345('0x19')](function(_0x148f8f){_0x517ffa(null,_0x148f8f?_0x13ecf1['getSoundPath'](_0x148f8f['save_name']):![]);})[_0xe345('0x1a')](function(_0x222c81){_0x517ffa(_0x222c81);});};AGIVertices[_0xe345('0x14')][_0xe345('0x23')]=function(_0x256585,_0x4c650a){this[_0xe345('0x12')][_0xe345('0x24')](_0x256585)[_0xe345('0x19')](function(_0x1bb9f7){_0x4c650a(null,_0x1bb9f7?_0x1bb9f7:![]);})[_0xe345('0x1a')](function(_0x4a1335){_0x4c650a(_0x4a1335);});};AGIVertices[_0xe345('0x14')][_0xe345('0x25')]=function(_0x5ded18,_0x150df8,_0x43d4af){this[_0xe345('0x13')]['sendMailMessage'](_0x5ded18,_0x150df8)['then'](function(){_0x43d4af(null);})[_0xe345('0x1a')](function(_0x5c94f7){_0x43d4af(_0x5c94f7);});};AGIVertices['prototype'][_0xe345('0x26')]=function(_0x165c9b,_0x41b256){this[_0xe345('0x12')][_0xe345('0x27')](_0x165c9b)[_0xe345('0x19')](function(_0x15d8f2){if(_0x15d8f2){if(_0x15d8f2[_0xe345('0x28')]){_0x41b256(null,[_0x15d8f2[_0xe345('0x29')]]);}else{_0x41b256(null,_['map'](_0x15d8f2[_0xe345('0x2a')],_0xe345('0x29')));}}else{_0x41b256(null,![]);}})[_0xe345('0x1a')](function(_0x3eeed1){_0x41b256(_0x3eeed1);});};AGIVertices[_0xe345('0x14')][_0xe345('0x2b')]=function(_0x50beda){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x50beda);};AGIVertices[_0xe345('0x14')]['getQueryOdbc']=function(_0x46e5b4,_0x38a7d9,_0x39b293){odbc[_0xe345('0x2c')](_0x46e5b4,function(_0x49ed24){if(_0x49ed24){logger[_0xe345('0x2d')](_0xe345('0x2e'),_0x49ed24);_0x39b293(_0x49ed24);}else{logger[_0xe345('0x2f')]('ODBC\x20connection\x20successfully');odbc[_0xe345('0x30')](_0x38a7d9,function(_0xd6a12a,_0x31f6d6){if(_0xd6a12a){logger['info']('Error\x20executing\x20query\x20%s',_0x38a7d9);_0x39b293(_0xd6a12a);}else{logger[_0xe345('0x2f')](_0xe345('0x31'),_0x38a7d9);odbc[_0xe345('0x32')](function(_0x5a9a4e){if(_0x5a9a4e){logger['error'](_0xe345('0x33'),_0x5a9a4e);}_0x39b293(null,_0x31f6d6);});}});}});};AGIVertices[_0xe345('0x14')][_0xe345('0x34')]=function(_0x2948f9,_0x3452f9){this[_0xe345('0x12')][_0xe345('0x35')](_0x2948f9)[_0xe345('0x19')](function(_0x1267da){_0x3452f9(null,_0x1267da?_0x1267da:![]);})[_0xe345('0x1a')](function(_0x4dfb17){_0x3452f9(_0x4dfb17);});};AGIVertices[_0xe345('0x14')][_0xe345('0x36')]=function(_0x48ecdd,_0x3e02f9){this['rpc']['createSmsMessage'](_0x48ecdd)['then'](function(_0x3d019c){_0x3e02f9(null,_0x3d019c);})[_0xe345('0x1a')](function(_0x56d2c8){_0x3e02f9(_0x56d2c8);});};AGIVertices[_0xe345('0x14')][_0xe345('0x37')]=function(_0x7ce549,_0x7a8f88,_0x12ebd1){this['rpc'][_0xe345('0x37')]({'uniqueid':this[_0xe345('0x11')]['uniqueid'],'node':_0x7ce549['label'],'application':_0x7ce549[_0xe345('0x38')],'data':_0x7a8f88||null,'project_name':this[_0xe345('0x11')][_0xe345('0x39')],'callerid':this['channel'][_0xe345('0x3a')]})[_0xe345('0x19')](function(_0x4a6626){if(_0x12ebd1){_0x12ebd1(null,_0x4a6626);}})['catch'](function(_0x24cf42){if(_0x12ebd1){_0x12ebd1(_0x24cf42);}});};AGIVertices[_0xe345('0x14')]['createSquareRecording']=function(_0x4cfb30,_0x383117,_0x5b4980,_0x2e7912){this['rpc']['createSquareRecording']({'uniqueid':this[_0xe345('0x11')][_0xe345('0x3b')],'callerid':this[_0xe345('0x11')][_0xe345('0x3a')],'calleridname':this[_0xe345('0x11')][_0xe345('0x3c')],'context':this[_0xe345('0x11')][_0xe345('0x3d')],'extension':this[_0xe345('0x11')]['extension'],'priority':this['channel'][_0xe345('0x3e')],'accountcode':this[_0xe345('0x11')][_0xe345('0x3f')],'dnid':this['channel'][_0xe345('0x40')],'projectName':this[_0xe345('0x11')][_0xe345('0x39')],'saveName':_0x383117,'filename':_0x4cfb30[_0xe345('0x41')]||_0x383117,'savePath':_0x5b4980})[_0xe345('0x19')](function(_0x4b495b){_0x2e7912(null,_0x4b495b);})['catch'](function(_0x5ba79a){_0x2e7912(_0x5ba79a);});};AGIVertices[_0xe345('0x14')][_0xe345('0x42')]=function(_0x6f3a55,_0xbb859f,_0xa815de,_0x25db16,_0x5c3e34){this[_0xe345('0x12')]['createSquareMessage']({'uniqueid':this[_0xe345('0x11')][_0xe345('0x3b')],'body':_0x6f3a55,'direction':_0xbb859f,'providerName':_0xa815de,'providerResponse':_0x25db16})[_0xe345('0x19')](function(_0x4d9a4e){if(_0x5c3e34){_0x5c3e34(null,_0x4d9a4e);}})[_0xe345('0x1a')](function(_0x107bc3){if(_0x5c3e34){_0x5c3e34(_0x107bc3);}});};AGIVertices['prototype'][_0xe345('0x43')]=function(_0x23973a,_0x26398b){this['rpc'][_0xe345('0x43')]({'firstName':_['isEmpty'](_0x23973a[_0xe345('0x17')])||_[_0xe345('0x44')](_0x23973a['name'])?_0xe345('0x45')+Math['random']():_0x23973a['name'],'lastName':_[_0xe345('0x46')](_0x23973a[_0xe345('0x47')])||_[_0xe345('0x44')](_0x23973a['lastName'])?null:_0x23973a['lastName'],'phone':_0x23973a['phone'],'ListId':_0x23973a[_0xe345('0x48')],'scheduledat':_0x23973a[_0xe345('0x49')],'callbackUniqueid':this['channel'][_0xe345('0x3b')],'tags':_0xe345('0x4a'),'description':_0xe345('0x4b')+_0x23973a[_0xe345('0x49')]['toString'](),'priority':_0x23973a[_0xe345('0x4c')]})[_0xe345('0x19')](function(_0x2333c0){_0x26398b(null,_0x2333c0);})['catch'](function(_0x128b5c){_0x26398b(_0x128b5c);});};AGIVertices[_0xe345('0x14')][_0xe345('0x4d')]=function(_0x19355e,_0x445d44){this[_0xe345('0x12')][_0xe345('0x4e')](_0x19355e)['then'](function(_0x1d7cd3){_0x445d44(null,_0x1d7cd3?_0x1d7cd3['name']:![]);})[_0xe345('0x1a')](function(_0x5b8e44){_0x445d44(_0x5b8e44);});};AGIVertices['prototype']['agentPause']=function(_0x432cfc,_0x1b29e0,_0x8aa2d1){var _0x51d7ca={'role':_0xe345('0x4f')};_0x51d7ca[_0x432cfc]=this[_0xe345('0x11')][_0xe345('0x3a')];this[_0xe345('0x12')][_0xe345('0x50')](_0x51d7ca,_0x1b29e0,this['channel'][_0xe345('0x3b')])[_0xe345('0x19')](function(_0x31b09b){_0x8aa2d1(null,_[_0xe345('0x44')](_0x31b09b)?![]:!![]);})[_0xe345('0x1a')](function(_0x2f974a){logger[_0xe345('0x2d')](_0x2f974a);_0x8aa2d1(null,![]);});};AGIVertices[_0xe345('0x14')][_0xe345('0x51')]=function(_0x14f227,_0x3b8d1e){var _0x657091={'role':'agent'};_0x657091[_0x14f227]=this[_0xe345('0x11')][_0xe345('0x3a')];this[_0xe345('0x12')][_0xe345('0x51')](_0x657091)[_0xe345('0x19')](function(_0x250f0b){_0x3b8d1e(null,_[_0xe345('0x44')](_0x250f0b)?![]:!![]);})[_0xe345('0x1a')](function(_0x12c627){logger[_0xe345('0x2d')](_0x12c627);_0x3b8d1e(null,![]);});};AGIVertices['prototype'][_0xe345('0x52')]=function(_0x15359c,_0xb19e25){var _0x28ff08={'role':'agent'};_0x28ff08[_0x15359c]=this[_0xe345('0x11')][_0xe345('0x3a')];this[_0xe345('0x12')][_0xe345('0x52')](_0x28ff08)['then'](function(_0x180440){_0xb19e25(null,_[_0xe345('0x44')](_0x180440)?![]:!![]);})[_0xe345('0x1a')](function(_0x30aad3){logger['error'](_0x30aad3);_0xb19e25(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x40b19a,_0x3161a5){var _0xbf7b3e={'role':_0xe345('0x4f')};_0xbf7b3e[_0x40b19a]=this[_0xe345('0x11')][_0xe345('0x3a')];var _0x483679=_0x40b19a!=_0xe345('0x53')?util[_0xe345('0x54')](_0xe345('0x55'),_0xe345('0x56'),this['channel'][_0xe345('0x3a')]):undefined;this['rpc'][_0xe345('0x57')](_0xbf7b3e,_0x483679)[_0xe345('0x19')](function(_0x46e364){_0x3161a5(null,_[_0xe345('0x44')](_0x46e364)?![]:!![]);})['catch'](function(_0x85015d){logger[_0xe345('0x2d')](_0x85015d);_0x3161a5(null,![]);});};AGIVertices[_0xe345('0x14')]['shellCommand']=function(_0x546956,_0x5f4152){sh[_0xe345('0x58')](_[_0xe345('0x59')](_0x546956),function(_0x193294,_0x35fd62){var _0x4bd577=_0x35fd62[_0xe345('0x5a')](/(\r\n|\n|\r)/gm,'');_0x5f4152(null,_0x4bd577);});};AGIVertices[_0xe345('0x14')][_0xe345('0x5b')]=function(_0x458f08,_0xac1125){scripts[_0xe345('0x5b')](_0x458f08[_0xe345('0x5c')],_0x458f08['google_cloud_tts_text_type']||_0xe345('0x5d'),_0x458f08[_0xe345('0x5d')],_0x458f08[_0xe345('0x5e')]||'en-US',_0x458f08[_0xe345('0x5f')]||_0xe345('0x60'),_0x458f08['audioEncoding']||_0xe345('0x61'))[_0xe345('0x19')](function(_0x27fe0e){_0xac1125(null,_0x27fe0e);})[_0xe345('0x1a')](function(_0x3f46d0){_0xac1125(_0x3f46d0);});};AGIVertices[_0xe345('0x14')][_0xe345('0x62')]=function(_0x40f9ae,_0x2d065b){scripts[_0xe345('0x62')](_0x40f9ae['text'],_0x40f9ae[_0xe345('0x63')]||'en',0x1)['then'](function(_0x4ef9c7){_0x2d065b(null,_0x4ef9c7);})[_0xe345('0x1a')](function(_0x48db85){_0x2d065b(_0x48db85);});};AGIVertices['prototype'][_0xe345('0x64')]=function(_0x4c09bb,_0x240036){var _0x27f3b8={'uri':_0x4c09bb[_0xe345('0x65')],'method':_0x4c09bb[_0xe345('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4c09bb[_0xe345('0x67')])===_0xe345('0x68')&&parseInt(_0x4c09bb[_0xe345('0x67')])>=0x1?parseInt(_0x4c09bb[_0xe345('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xe345('0x69')](['POST',_0xe345('0x6a')],_0x27f3b8[_0xe345('0x66')][_0xe345('0x6b')]())){try{_0x27f3b8[_0xe345('0x6c')]=_0x4c09bb['rawBody']?JSON[_0xe345('0x6d')](_0x4c09bb[_0xe345('0xd')]):{};}catch(_0x2d2681){logger[_0xe345('0x2d')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2d2681);}}try{_0x27f3b8[_0xe345('0x6e')]=_0x4c09bb[_0xe345('0xc')]?JSON[_0xe345('0x6d')](_0x4c09bb[_0xe345('0xc')]):{};}catch(_0x2700eb){logger[_0xe345('0x2d')](_0xe345('0x6f'),_0x2700eb);}if(_0x4c09bb['computedVariables']){try{var _0x1cb81a=require(_0x4c09bb[_0xe345('0x70')])['sync'](this,_0x27f3b8);_0x27f3b8['uri']=Mustache[_0xe345('0x71')](_0x4c09bb[_0xe345('0x65')],_0x1cb81a,{},['$$','$$']);if(_0x27f3b8['headers']){_0x27f3b8[_0xe345('0x6e')]=JSON[_0xe345('0x6d')](Mustache[_0xe345('0x71')](JSON[_0xe345('0x72')](_0x27f3b8[_0xe345('0x6e')]),_0x1cb81a,{},['$$','$$']));}if(_0x27f3b8['body']){_0x27f3b8[_0xe345('0x6c')]=JSON[_0xe345('0x6d')](Mustache[_0xe345('0x71')](JSON[_0xe345('0x72')](_0x27f3b8[_0xe345('0x6c')]),_0x1cb81a,{},['$$','$$']));}}catch(_0x189615){logger[_0xe345('0x2d')](_0xe345('0x73'),_0x189615);}}rp(_0x27f3b8)[_0xe345('0x19')](function(_0x3e1fe7){var _0x319dd4={'statusCode':_0x3e1fe7['statusCode']||0xc8,'statusMessage':_0x3e1fe7['statusMessage']||'OK','headers':_0x3e1fe7['headers']||{},'body':_0x3e1fe7['body']||{}};_0x240036(null,_0x319dd4);})[_0xe345('0x1a')](function(_0x132562){var _0x3ec6d3={'statusCode':_0x132562[_0xe345('0x74')]||0x1f4,'statusMessage':_0x132562[_0xe345('0x75')]||_0xe345('0x76'),'headers':_0x132562['options'][_0xe345('0x6e')]||{},'body':_0x132562[_0xe345('0x77')][_0xe345('0x6c')]||{}};_0x240036(null,_0x3ec6d3);});};AGIVertices[_0xe345('0x14')][_0xe345('0x78')]=function(_0x998dc,_0x3e45d6){scripts['googleDialogflow'](this[_0xe345('0x11')][_0xe345('0x3b')],_0x998dc[_0xe345('0x79')],_0x998dc[_0xe345('0x5d')],_0x998dc[_0xe345('0x7a')]||'en')['then'](function(_0xc3ef2d){_0x3e45d6(null,_0xc3ef2d);})['catch'](function(_0x45d269){_0x3e45d6(_0x45d269);});};AGIVertices['prototype'][_0xe345('0x7b')]=function(_0x400b30,_0x1d9a10){scripts[_0xe345('0x7b')](this[_0xe345('0x11')][_0xe345('0x3b')],_0x400b30[_0xe345('0x7c')],_0x400b30['client_email'],_0x400b30[_0xe345('0x7d')],_0x400b30['text'],_0x400b30[_0xe345('0x7e')]||'en')['then'](function(_0xdbf52){_0x1d9a10(null,_0xdbf52);})[_0xe345('0x1a')](function(_0x36b0e1){_0x1d9a10(_0x36b0e1);});};AGIVertices[_0xe345('0x14')][_0xe345('0x7f')]=function(_0x107b42,_0x5e5d90){scripts['sestekNDA'](this[_0xe345('0x11')],_0x107b42)[_0xe345('0x19')](function(_0x2e107e){_0x5e5d90(null,_0x2e107e);})[_0xe345('0x1a')](function(_0x1eb3b6){_0x5e5d90(_0x1eb3b6);});};AGIVertices[_0xe345('0x14')][_0xe345('0x80')]=function(_0x1b0f47,_0x9a9d06){scripts[_0xe345('0x80')](_0x1b0f47[_0xe345('0x79')],_0x1b0f47['text'],_0x1b0f47[_0xe345('0x81')]||_0xe345('0x82'),_0x1b0f47[_0xe345('0x83')])[_0xe345('0x19')](function(_0x1b0e52){_0x9a9d06(null,_0x1b0e52);})['catch'](function(_0x347dcb){_0x9a9d06(_0x347dcb);});};AGIVertices[_0xe345('0x14')][_0xe345('0x84')]=function(_0x436b06,_0x1dd12b,_0x9a3ba){scripts[_0xe345('0x84')](_0x1dd12b,_0x436b06[_0xe345('0x79')],_0x436b06[_0xe345('0x85')]||_0xe345('0x82'),this[_0xe345('0x86')](_0x436b06[_0xe345('0x87')])?_0x436b06['model']:undefined)[_0xe345('0x19')](function(_0x5e531b){_0x9a3ba(null,_0x5e531b);})[_0xe345('0x1a')](function(_0x5a8793){_0x9a3ba(_0x5a8793);});};AGIVertices[_0xe345('0x14')][_0xe345('0x88')]=function(_0x43b74f,_0xe437cf){scripts['awsPolly'](_0x43b74f[_0xe345('0x89')],_0x43b74f[_0xe345('0x8a')],_0x43b74f['aws_polly_region'],_0x43b74f[_0xe345('0x8b')]||_0xe345('0x8c'),_0x43b74f[_0xe345('0x5d')],_0x43b74f[_0xe345('0x8d')]||_0xe345('0x5d'))['then'](function(_0x383ad8){_0xe437cf(null,_0x383ad8);})['catch'](function(_0x1e5be0){_0xe437cf(_0x1e5be0);});};AGIVertices[_0xe345('0x14')]['awsLex']=function(_0x438618,_0x18fc01){scripts['awsLex'](this['channel'][_0xe345('0x3b')],_0x438618['aws_access_key_id'],_0x438618[_0xe345('0x8a')],_0x438618[_0xe345('0x8e')],_0x438618['text'],_0x438618[_0xe345('0x8f')])['then'](function(_0x997d74){_0x18fc01(null,_0x997d74);})[_0xe345('0x1a')](function(_0x30a775){_0x18fc01(_0x30a775);});};AGIVertices[_0xe345('0x14')]['googleASR']=function(_0xc90e1f,_0x10ddc7,_0x23543d){scripts[_0xe345('0x90')](_0x10ddc7,_0xc90e1f[_0xe345('0x79')],_0xc90e1f[_0xe345('0x91')]||'en-US')[_0xe345('0x19')](function(_0x275949){_0x23543d(null,_0x275949);})['catch'](function(_0x1f9445){_0x23543d(_0x1f9445);});};AGIVertices[_0xe345('0x14')][_0xe345('0x92')]=function(_0x11dd3d,_0x420db6,_0x170145){scripts['tildeASR'](_0x420db6,_0x11dd3d['appid'],_0x11dd3d[_0xe345('0x93')],_0x11dd3d[_0xe345('0x94')])['then'](function(_0x49ecc4){_0x170145(null,_0x49ecc4);})['catch'](function(_0x39d991){_0x170145(_0x39d991);});};AGIVertices[_0xe345('0x14')][_0xe345('0x95')]=function(_0x7c1b2){var _0x25e8fd=_[_0xe345('0x69')](verticesWithRetry,_0x7c1b2[_0xe345('0x38')])?_0x7c1b2:_[_0xe345('0x96')](_0x7c1b2);for(var _0x3135f1 in _0x25e8fd){if(_0x25e8fd[_0xe345('0x97')](_0x3135f1)){if(_0x25e8fd[_0x3135f1]&&_[_0xe345('0x98')](_0x25e8fd[_0x3135f1])){if(_[_0xe345('0x69')](recursiveMapAttributes,_0x3135f1)){_0x25e8fd[_0x3135f1]=this['replaceObjectAllVariables'](_0x25e8fd[_0x3135f1]);}else{_0x25e8fd[_0x3135f1]=this['replaceAllVariables'](_0x25e8fd[_0x3135f1]);}}}}return _0x25e8fd;};AGIVertices['prototype'][_0xe345('0x99')]=function(_0x4ed21b){for(var _0xccbce0 in _0x4ed21b){if(_0x4ed21b['hasOwnProperty'](_0xccbce0)){if(_['isPlainObject'](_0x4ed21b[_0xccbce0])){this[_0xe345('0x99')](_0x4ed21b[_0xccbce0]);}else if(_['isArray'](_0x4ed21b[_0xccbce0])){for(var _0x5f1c0=0x0;_0x5f1c0<_0x4ed21b[_0xccbce0][_0xe345('0x9a')];_0x5f1c0++){this['recursiveNodeIndex'](_0x4ed21b[_0xccbce0][_0x5f1c0]);}}else if(_['isString'](_0x4ed21b[_0xccbce0])){_0x4ed21b[_0xccbce0]=this[_0xe345('0x9b')](_0x4ed21b[_0xccbce0]);}}}};AGIVertices[_0xe345('0x14')][_0xe345('0x9c')]=function(_0x3475ce,_0x469b63){for(var _0x4332b3 in _0x3475ce){if(_0x3475ce[_0xe345('0x97')](_0x4332b3)){if(_[_0xe345('0x9d')](_0x3475ce[_0x4332b3])){if(!_[_0xe345('0x46')](_0x3475ce[_0x4332b3])){this['saveRestApiResult'](_0x3475ce[_0x4332b3],util[_0xe345('0x54')](_0xe345('0x9e'),_0x469b63,_0x4332b3));}}else if(_['isArray'](_0x3475ce[_0x4332b3])){for(var _0x550043=0x0;_0x550043<_0x3475ce[_0x4332b3][_0xe345('0x9a')];_0x550043++){this['saveRestApiResult'](_0x3475ce[_0x4332b3][_0x550043],util['format'](_0xe345('0x9e'),_0x469b63,_0x4332b3+'['+_0x550043+']'));}}else{if(!_[_0xe345('0x44')](_0x3475ce[_0x4332b3])){this[_0xe345('0x11')][_0xe345('0x9f')](util['format'](_0xe345('0x9e'),_0x469b63,_0x4332b3),_0x3475ce[_0x4332b3]);}}}}};AGIVertices['prototype'][_0xe345('0xa0')]=function(_0x38dda9){try{var _0x4c5cfe=JSON[_0xe345('0x6d')](_0x38dda9);this[_0xe345('0x99')](_0x4c5cfe);return JSON[_0xe345('0x72')](_0x4c5cfe);}catch(_0x172633){return this[_0xe345('0x9b')](_0x38dda9);}};AGIVertices[_0xe345('0x14')][_0xe345('0x9b')]=function(_0x4f6d04){var _0x9d6071=_0x4f6d04[_0xe345('0xa1')]('{');for(var _0x2dc429=0x1;_0x2dc429<_0x9d6071[_0xe345('0x9a')];_0x2dc429+=0x1){var _0x382e54=_0x9d6071[_0x2dc429][_0xe345('0xa1')]('}');if(_0x382e54['length']>0x1){_0x4f6d04=_0x4f6d04[_0xe345('0xa2')]('{'+_0x382e54[0x0]+'}',this[_0xe345('0x11')]['getVariable'](_0x382e54[0x0])[_0xe345('0xa3')]||_0x382e54[0x0]);}}if(_0x9d6071[_0xe345('0x9a')]===0x1){return _0x4f6d04[_0xe345('0xa4')]();}return this[_0xe345('0x9b')](_0x4f6d04);};AGIVertices[_0xe345('0x14')][_0xe345('0xa5')]=function(_0x4852a5,_0x4ceaac){var _0x197b15=this[_0xe345('0x11')][_0xe345('0x15')](_0x4852a5);if(_0x197b15[_0xe345('0xa6')]===-0x1){return _0x197b15;}logger[_0xe345('0x2f')](util['format'](_0xe345('0xa7'),_0x4ceaac,_0x197b15[_0xe345('0xa3')]));return this[_0xe345('0x11')][_0xe345('0x9f')](_0x4ceaac,_0x197b15[_0xe345('0xa3')]);};AGIVertices[_0xe345('0x14')][_0xe345('0x86')]=function(_0x10232a){return _0x10232a&&_0x10232a!=='0'&&_0x10232a!=='-1'&&_0x10232a!=='';};AGIVertices[_0xe345('0x14')][_0xe345('0xa8')]=function(_0x4e319d){this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x4e319d,'-');_0x4e319d[_0xe345('0xaa')]=_0x4e319d['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe345('0x14')][_0xe345('0xab')]=function(_0x5685e2){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0xac'),_0x5685e2[_0xe345('0xad')]));if(!this['isConfigured'](_0x5685e2[_0xe345('0x5d')])){return this['channel']['noop'](_0xe345('0xae'));}var _0x43f11e='\x22'+_0x5685e2['text']+'\x22';if(this[_0xe345('0x86')](_0x5685e2[_0xe345('0x77')])){_0x43f11e+=','+_0x5685e2[_0xe345('0x77')];}var _0x22dccc=this['channel'][_0xe345('0x58')](_0xe345('0xaf'),_0x43f11e);if(_0x22dccc[_0xe345('0xa6')]===-0x1){return _0x22dccc;}return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('Executed\x20command\x20MRCPSynth\x20%s',_0x43f11e));};AGIVertices[_0xe345('0x14')][_0xe345('0xb1')]=function(_0x18fc07){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0xb2'),_0x18fc07[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x18fc07[_0xe345('0xb3')])){return this['channel']['noop'](_0xe345('0xb4'));}var _0x36ee88=_0x18fc07[_0xe345('0xb3')];if(this[_0xe345('0x86')](_0x18fc07['options'])){_0x36ee88+=','+_0x18fc07['options'];}var _0x561c86=this[_0xe345('0x11')][_0xe345('0x58')](_0xe345('0xb5'),_0x36ee88);if(_0x561c86[_0xe345('0xa6')]===-0x1){return _0x561c86;}var _0x3f936f=this['getAndSetVariable'](_0xe345('0xb6'),'MRCP_RECOG_CONFIDENCE');if(_0x3f936f['result']===-0x1){return _0x3f936f;}var _0x18860b=this['getAndSetVariable'](_0xe345('0xb7'),_0xe345('0xb8'));if(_0x18860b[_0xe345('0xa6')]===-0x1){return _0x18860b;}var _0x59527e=this['getAndSetVariable']('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x59527e[_0xe345('0xa6')]===-0x1){return _0x59527e;}return this['channel'][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0xb9'),_0x36ee88));};AGIVertices[_0xe345('0x14')][_0xe345('0x8')]=function(_0x4d4866){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0xba'),_0x4d4866['label']));return this[_0xe345('0x11')]['agi']([_0x4d4866['command'],_0x4d4866[_0xe345('0xbb')]]);};AGIVertices['prototype'][_0xe345('0xbc')]=function(_0x2fed6){logger['info'](util['format'](_0xe345('0xbd'),_0x2fed6[_0xe345('0xad')]));if(this[_0xe345('0x86')](_0x2fed6[_0xe345('0x67')])){logger[_0xe345('0x2f')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x2fed6[_0xe345('0x67')]));var _0x1ef693=this[_0xe345('0x11')][_0xe345('0xbe')](_0x2fed6[_0xe345('0x67')]);if(_0x1ef693[_0xe345('0xa6')]===-0x1){return _0x1ef693;}}return this[_0xe345('0x11')][_0xe345('0xbc')]();};AGIVertices[_0xe345('0x14')][_0xe345('0x4a')]=function(_0x39f4aa){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0xbf'),_0x39f4aa['label']));if(!this['isConfigured'](_0x39f4aa[_0xe345('0x48')])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x39f4aa,_0xe345('0xc0'));}_0x39f4aa['scheduledAt']=moment();if(this[_0xe345('0x86')](_0x39f4aa['delay'])){_0x39f4aa[_0xe345('0x49')]=moment()[_0xe345('0xc1')](_0x39f4aa[_0xe345('0xc2')],_0xe345('0xc3'));}if(!this[_0xe345('0x86')](_0x39f4aa[_0xe345('0x4c')])){_0x39f4aa[_0xe345('0x4c')]=0x2;}this[_0xe345('0x43')]['sync'](this,_0x39f4aa);return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x39f4aa[_0xe345('0xc4')],_0x39f4aa[_0xe345('0x48')],_0x39f4aa[_0xe345('0x49')]));};AGIVertices[_0xe345('0x14')][_0xe345('0xc5')]=function(_0x351a10){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0xc6'),_0x351a10['label']));var _0x49b612=this['channel']['exec'](_0x351a10[_0xe345('0xc7')],_0x351a10[_0xe345('0x77')]);if(_0x49b612[_0xe345('0xa6')]===-0x1){return _0x49b612;}return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('Executed\x20command\x20%s\x20%s',_0x351a10[_0xe345('0xc7')],_0x351a10[_0xe345('0x77')]));};AGIVertices['prototype'][_0xe345('0xc8')]=function(_0xd04a6a){logger[_0xe345('0x2f')](util[_0xe345('0x54')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0xd04a6a[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0xd04a6a['text'])){return this[_0xe345('0x11')]['noop']('no\x20text\x20configured');}var _0x19e0d5='\x22'+_0xd04a6a[_0xe345('0x5d')]+'\x22';if(this['isConfigured'](_0xd04a6a[_0xe345('0x77')])){_0x19e0d5+=','+_0xd04a6a['options'];}var _0x2e8884=this[_0xe345('0x11')][_0xe345('0x58')]('MRCPSynth',_0x19e0d5);if(_0x2e8884[_0xe345('0xa6')]===-0x1){return _0x2e8884;}return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0xc9'),_0x19e0d5));};AGIVertices[_0xe345('0x14')][_0xe345('0xca')]=function(_0xb96e66){logger[_0xe345('0x2f')](util['format'](_0xe345('0xcb'),_0xb96e66[_0xe345('0xad')]));if(!this['isConfigured'](_0xb96e66[_0xe345('0x5d')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xae'));}var _0x36a8f8='\x22'+_0xb96e66[_0xe345('0x5d')]+'\x22';if(this[_0xe345('0x86')](_0xb96e66['options'])){_0x36a8f8+=','+_0xb96e66[_0xe345('0x77')];}var _0x563680=this['channel'][_0xe345('0x58')](_0xe345('0xaf'),_0x36a8f8);if(_0x563680['result']===-0x1){return _0x563680;}return this[_0xe345('0x11')][_0xe345('0xb0')](util['format'](_0xe345('0xc9'),_0x36a8f8));};AGIVertices['prototype'][_0xe345('0xcc')]=function(_0x10494e){logger['info'](util[_0xe345('0x54')](_0xe345('0xcd'),_0x10494e[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x10494e[_0xe345('0xb3')])){return this[_0xe345('0x11')][_0xe345('0xb0')]('no\x20grammar\x20configured');}var _0x1877c3=_0x10494e[_0xe345('0xb3')];if(this[_0xe345('0x86')](_0x10494e[_0xe345('0x77')])){_0x1877c3+=','+_0x10494e[_0xe345('0x77')];}var _0x6aee81=this[_0xe345('0x11')][_0xe345('0x58')](_0xe345('0xb5'),_0x1877c3);if(_0x6aee81[_0xe345('0xa6')]===-0x1){return _0x6aee81;}var _0x106054=this[_0xe345('0xa5')](_0xe345('0xb6'),_0xe345('0xce'));if(_0x106054[_0xe345('0xa6')]===-0x1){return _0x106054;}var _0x5524db=this[_0xe345('0xa5')]('RECOG_INPUT()',_0xe345('0xcf'));if(_0x5524db[_0xe345('0xa6')]===-0x1){return _0x5524db;}var _0x259254=this[_0xe345('0xa5')](_0xe345('0xd0'),_0xe345('0xd1'));if(_0x259254[_0xe345('0xa6')]===-0x1){return _0x259254;}return this[_0xe345('0x11')][_0xe345('0xb0')](util['format'](_0xe345('0xb9'),_0x1877c3));};AGIVertices[_0xe345('0x14')][_0xe345('0xd2')]=function(_0x36dd88){logger['info'](util[_0xe345('0x54')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x36dd88[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x36dd88['grammar'])){return this[_0xe345('0x11')]['noop']('no\x20grammar\x20configured');}var _0x437731=_0x36dd88[_0xe345('0xb3')];if(this[_0xe345('0x86')](_0x36dd88['options'])){_0x437731+=','+_0x36dd88[_0xe345('0x77')];}var _0x30f0f8=this[_0xe345('0x11')][_0xe345('0x58')]('MRCPRecog',_0x437731);if(_0x30f0f8[_0xe345('0xa6')]===-0x1){return _0x30f0f8;}var _0x3c983d=this[_0xe345('0xa5')](_0xe345('0xb6'),'SESTEK_ASR_CONFIDENCE');if(_0x3c983d[_0xe345('0xa6')]===-0x1){return _0x3c983d;}var _0x529ca2=this[_0xe345('0xa5')](_0xe345('0xb7'),_0xe345('0xd3'));if(_0x529ca2[_0xe345('0xa6')]===-0x1){return _0x529ca2;}var _0xa5f1e6=this[_0xe345('0xa5')](_0xe345('0xd0'),_0xe345('0xd4'));if(_0xa5f1e6['result']===-0x1){return _0xa5f1e6;}return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0xb9'),_0x437731));};AGIVertices[_0xe345('0x14')][_0xe345('0xd5')]=function(_0x17eed3){logger[_0xe345('0x2f')](util[_0xe345('0x54')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x17eed3[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x17eed3[_0xe345('0xd6')])){return this['channel']['error'](_0x17eed3,_0xe345('0xd7'));}var _0x382f97=this[_0xe345('0x1c')][_0xe345('0xa9')](this,_0x17eed3['odbc_id']);if(!_0x382f97){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x17eed3,_0xe345('0xd8'));}if(!this[_0xe345('0x86')](_0x17eed3[_0xe345('0x30')])){return this[_0xe345('0x11')]['error'](_0x17eed3,'no\x20query\x20configured');}var _0x502796=_0x17eed3['query'][_0xe345('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe345('0x11')]['noop'](util['format'](_0xe345('0xd9'),_0x502796));var _0x184fdb=this[_0xe345('0xda')][_0xe345('0xa9')](this,_0x382f97,_0x502796);this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x17eed3,_0x502796);if(!this[_0xe345('0x86')](_0x17eed3[_0xe345('0xdb')])){return this['channel'][_0xe345('0xb0')](_0xe345('0xdc'));}var _0x9803d7=this[_0xe345('0x15')][_0xe345('0xa9')](this,_0x17eed3[_0xe345('0xdb')]);if(!_0x9803d7){return this['channel'][_0xe345('0x2d')](_0x17eed3,_0xe345('0xdd'));}var _0x1811a0=this;_0x184fdb[_0xe345('0xde')](function(_0x676ab3,_0x14350e){Object['keys'](_0x676ab3)[_0xe345('0xde')](function(_0x5c3862){_0x1811a0[_0xe345('0x11')][_0xe345('0x9f')](util[_0xe345('0x54')](_0xe345('0xdf'),_0x9803d7,_0x14350e,_0x5c3862),_0x676ab3[_0x5c3862]);});});this['channel'][_0xe345('0x9f')](util[_0xe345('0x54')]('%s_ROWS_COUNT',_0x9803d7),_0x184fdb[_0xe345('0x9a')]);return this[_0xe345('0x11')]['noop'](util[_0xe345('0x54')](_0xe345('0xe0'),_0x9803d7));};AGIVertices[_0xe345('0x14')][_0xe345('0xe1')]=function(_0x7a4183){logger[_0xe345('0xe2')](util[_0xe345('0x54')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x7a4183[_0xe345('0xad')]));if(!this['isConfigured'](_0x7a4183['sip_id'])){return this[_0xe345('0x11')]['error'](_0x7a4183,_0xe345('0xe3'));}var _0x71654f=this[_0xe345('0xe4')][_0xe345('0xa9')](this,_0x7a4183['sip_id']);if(!_0x71654f){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x7a4183,'no\x20user\x20found');}var _0x14ccd3=this[_0xe345('0x11')][_0xe345('0x58')]('DIAL',[util['format'](_0xe345('0xe5'),_0x71654f),_0x7a4183['timeout'],_0x7a4183[_0xe345('0xe6')],_0x7a4183[_0xe345('0x65')]]);if(_0x14ccd3[_0xe345('0xa6')]===-0x1){return _0x14ccd3;}return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('Executed\x20command\x20%s',_0xe345('0xe7')));};AGIVertices['prototype'][_0xe345('0xe8')]=function(_0x24447a){logger[_0xe345('0x2f')](util[_0xe345('0x54')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x24447a['label']));if(!this[_0xe345('0x86')](_0x24447a[_0xe345('0x79')])){return this['channel'][_0xe345('0xb0')](_0xe345('0xe9'));}if(!this[_0xe345('0x86')](_0x24447a[_0xe345('0x5d')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xae'));}this[_0xe345('0x11')][_0xe345('0xea')]=!![];this[_0xe345('0x37')](_0x24447a);this[_0xe345('0x42')](_0x24447a[_0xe345('0x5d')],'in','','');this['channel']['noop'](util[_0xe345('0x54')](_0xe345('0xeb'),_0x24447a[_0xe345('0x5d')]));var _0x31b0da=this[_0xe345('0x78')][_0xe345('0xa9')](this,_0x24447a);if(_0x31b0da){for(var _0x5e6277 in _0x31b0da){if(_0x31b0da[_0xe345('0x97')](_0x5e6277)){this['channel'][_0xe345('0x9f')](util[_0xe345('0x54')](_0xe345('0xec'),_0x5e6277[_0xe345('0x6b')]()),_0x31b0da[_0x5e6277]);}}this[_0xe345('0x42')](_0x31b0da['speech'],_0xe345('0xed'),_0xe345('0xe8'),'');return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0xee'),_0x31b0da['speech']));}return this['channel'][_0xe345('0x2d')](_0x24447a,_0xe345('0xef'));};AGIVertices[_0xe345('0x14')][_0xe345('0xf0')]=function(_0x411407){logger['info'](util[_0xe345('0x54')](_0xe345('0xf1'),_0x411407[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x411407[_0xe345('0x7c')])){return this[_0xe345('0x11')][_0xe345('0xb0')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x411407[_0xe345('0xf2')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xf3'));}if(!this[_0xe345('0x86')](_0x411407[_0xe345('0x7d')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xf4'));}if(!this[_0xe345('0x86')](_0x411407[_0xe345('0x7e')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xf5'));}if(!this[_0xe345('0x86')](_0x411407['text'])){return this['channel'][_0xe345('0xb0')]('no\x20text\x20configured');}this[_0xe345('0x11')][_0xe345('0xea')]=!![];this[_0xe345('0x37')](_0x411407);this[_0xe345('0x42')](_0x411407['text'],'in','','');this[_0xe345('0x11')]['noop'](util['format'](_0xe345('0xf6'),_0x411407[_0xe345('0x5d')]));var _0x553a9c=this[_0xe345('0x7b')][_0xe345('0xa9')](this,_0x411407);if(_0x553a9c){for(var _0x149666 in _0x553a9c){if(_0x553a9c[_0xe345('0x97')](_0x149666)){if(_0x149666!==_0xe345('0xf7')){this['channel']['setVariable'](util['format'](_0xe345('0xec'),_0x149666[_0xe345('0x6b')]()),_0x553a9c[_0x149666]);}}}this[_0xe345('0x42')](_0x553a9c[_0xe345('0xf8')],'out',_0xe345('0xf0'),_0x553a9c[_0xe345('0xf7')]);return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('DialogflowV2\x20Result\x20%s',_0x553a9c[_0xe345('0xf8')]));}return this[_0xe345('0x11')][_0xe345('0x2d')](_0x411407,_0xe345('0xf9'));};AGIVertices['prototype'][_0xe345('0xfa')]=function(_0x2ca00a){logger[_0xe345('0x2f')](util['format'](_0xe345('0xfb'),_0x2ca00a[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x2ca00a[_0xe345('0xfc')])){return this['channel'][_0xe345('0xb0')](_0xe345('0xfd'));}if(!this[_0xe345('0x86')](_0x2ca00a[_0xe345('0xfe')])){return this[_0xe345('0x11')][_0xe345('0xb0')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x2ca00a[_0xe345('0xff')])){return this[_0xe345('0x11')][_0xe345('0xb0')]('no\x20password\x20configured');}if(!this[_0xe345('0x86')](_0x2ca00a[_0xe345('0x100')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xae'));}this[_0xe345('0x11')][_0xe345('0xea')]=!![];this[_0xe345('0x37')](_0x2ca00a);this['createSquareMessage'](_0x2ca00a[_0xe345('0x5d')],'in','','');this[_0xe345('0x11')]['noop'](util[_0xe345('0x54')](_0xe345('0x101'),_0x2ca00a[_0xe345('0x5d')]));var _0x5680c3=this[_0xe345('0x7f')]['sync'](this,_0x2ca00a);if(_0x5680c3){for(var _0x4026e9 in _0x5680c3){if(_0x5680c3['hasOwnProperty'](_0x4026e9)){this[_0xe345('0x11')][_0xe345('0x9f')](util[_0xe345('0x54')](_0xe345('0x102'),_0x4026e9[_0xe345('0x6b')]()),_0x5680c3[_0x4026e9]);}}this[_0xe345('0x42')](_0x5680c3[_0xe345('0xf8')],_0xe345('0xed'),_0xe345('0xfa'),'');if(_0x5680c3[_0xe345('0x103')]){this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5680c3[_0xe345('0x103')]));var _0x334d94=this[_0xe345('0x11')][_0xe345('0x104')](_0x5680c3[_0xe345('0x103')]);try{fs[_0xe345('0x105')](_0x5680c3[_0xe345('0x103')]+_0xe345('0x106'));}catch(_0x4f3d4f){logger[_0xe345('0x2d')](_0x4f3d4f);}return _0x334d94;}else{return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x107'),_0x5680c3[_0xe345('0xf8')]));}}return this[_0xe345('0x11')]['error'](_0x2ca00a,_0xe345('0x108'));};AGIVertices['prototype'][_0xe345('0x109')]=function(_0x4399c9){logger['info'](util[_0xe345('0x54')](_0xe345('0x10a'),_0x4399c9['label']));return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x109'));};AGIVertices['prototype'][_0xe345('0x10b')]=function(_0x3e70db){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x10c'),_0x3e70db[_0xe345('0xad')]));var _0xc042a0='';if(_0x3e70db[_0xe345('0x10d')]){if(!this[_0xe345('0x86')](_0x3e70db[_0xe345('0x10d')])){return this['channel'][_0xe345('0x2d')](_0x3e70db,'no\x20trunk\x20selected');}else{var _0x4668a2=parseInt(_0x3e70db['trunk_id'],0xa);if(isNaN(_0x4668a2)){_0xc042a0=_0x3e70db['trunk_id'];}else{_0xc042a0=this['getTrunk']['sync'](this,_0x3e70db['trunk_id']);if(!_0xc042a0){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x3e70db,_0xe345('0x10e'));}}}}else if(_0x3e70db[_0xe345('0x10f')]){_0xc042a0=_0x3e70db['trunk_name'];}else{return this[_0xe345('0x11')][_0xe345('0x2d')](_0x3e70db,'no\x20trunk\x20selected');}var _0x1cea1e=this['channel'][_0xe345('0x58')](_0xe345('0xe7'),[util[_0xe345('0x54')](_0xe345('0x110'),_0xc042a0,_0x3e70db[_0xe345('0xc4')]),_0x3e70db[_0xe345('0x67')],_0x3e70db[_0xe345('0xe6')],_0x3e70db[_0xe345('0x65')]]);if(_0x1cea1e[_0xe345('0xa6')]===-0x1){return _0x1cea1e;}return this['channel'][_0xe345('0xb0')](util['format'](_0xe345('0x111'),_0xe345('0xe7')));};AGIVertices[_0xe345('0x14')][_0xe345('0x112')]=function(_0x1a26de){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x113'),_0x1a26de[_0xe345('0xad')]));return this[_0xe345('0x11')]['noop'](_0xe345('0x112'));};AGIVertices[_0xe345('0x14')][_0xe345('0xf')]=function(_0x476ff1){logger['info'](util[_0xe345('0x54')](_0xe345('0x114'),_0x476ff1[_0xe345('0xad')]));if(_0x476ff1['retry']===0x0){return this['maxRetry'](_0x476ff1);}_0x476ff1[_0xe345('0xaa')]-=0x1;if(!this[_0xe345('0x86')](_0x476ff1[_0xe345('0x115')])){return this[_0xe345('0x11')]['error'](_0x476ff1,'no\x20file\x20audio\x20selected');}var _0x3806a3=this[_0xe345('0x21')][_0xe345('0xa9')](this,_0x476ff1[_0xe345('0x115')]);if(!_0x3806a3){return this[_0xe345('0x11')]['error'](_0x476ff1,_0xe345('0x116'));}if(!this[_0xe345('0x86')](_0x476ff1[_0xe345('0xdb')])){return this[_0xe345('0x11')]['error'](_0xe345('0xdc'));}var _0x348791=this[_0xe345('0x11')][_0xe345('0x117')](_0x3806a3,_0x476ff1[_0xe345('0x118')],_0x476ff1[_0xe345('0x119')]);var _0x1c0369=_0x348791[_0xe345('0xa6')]?_0x348791[_0xe345('0xa6')]['toString']():'';logger[_0xe345('0x2f')](_0xe345('0x11a'),JSON[_0xe345('0x72')](_0x348791));if(_0x348791['result']===-0x1){this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x476ff1,_0x1c0369);return _0x348791;}else if(_0x348791[_0xe345('0xa3')]===_0xe345('0x67')){_0x348791[_0xe345('0xa6')]=_0x1c0369['length']>=parseInt(_0x476ff1[_0xe345('0x11b')])?'x':'i';}else{_0x348791[_0xe345('0xa6')]=_0x1c0369['length']>=parseInt(_0x476ff1[_0xe345('0x11b')])&&_0x1c0369[_0xe345('0x9a')]<=parseInt(_0x476ff1[_0xe345('0x119')])?'x':'i';}var _0x4ef8a4=this[_0xe345('0x15')][_0xe345('0xa9')](this,_0x476ff1[_0xe345('0xdb')]);if(!_0x4ef8a4){return this['channel'][_0xe345('0x2d')](_0x476ff1,_0xe345('0xdd'));}this[_0xe345('0x11')][_0xe345('0x9f')](_0x4ef8a4,_0x1c0369);if(this[_0xe345('0x86')](_0x476ff1[_0xe345('0x11c')])){var _0x43e913=parseInt(_0x476ff1[_0xe345('0x11c')],0xa);var _0x535c4d=rs[_0xe345('0x11d')]({'charset':'*','length':_0x43e913});var _0x1103ae=_0x1c0369['length'];if(_0x1103ae>0x0){if(_0x1103ae>_0x43e913){this[_0xe345('0x37')]['sync'](this,_0x476ff1,_0x476ff1[_0xe345('0x11e')]==='first'?_0x535c4d+_0x1c0369[_0xe345('0x11f')](_0x43e913):_0x1c0369[_0xe345('0x11f')](0x0,_0x1103ae-_0x43e913)+_0x535c4d);}else{this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x476ff1,rs[_0xe345('0x11d')]({'charset':'*','length':_0x1103ae}));}}else{this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x476ff1,'');}}else{this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x476ff1,_0x1c0369);}return _0x348791;};AGIVertices[_0xe345('0x14')]['getsecretdigits']=function(_0x12a056){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x120'),_0x12a056['label']));return this[_0xe345('0xf')](_0x12a056);};AGIVertices['prototype'][_0xe345('0x121')]=function(_0x4c3c1a){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x122'),_0x4c3c1a[_0xe345('0xad')]));this['createSquareDetailsReport']['sync'](this,_0x4c3c1a,_0x4c3c1a[_0xe345('0x123')]);return this[_0xe345('0x11')]['noop'](util['format'](_0xe345('0x124'),_0x4c3c1a[_0xe345('0x123')]));};AGIVertices[_0xe345('0x14')][_0xe345('0x125')]=function(_0x559b7f){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x126'),_0x559b7f[_0xe345('0xad')]));if(!this['isConfigured'](_0x559b7f['aws_access_key_id'])||!this[_0xe345('0x86')](_0x559b7f[_0xe345('0x8a')])){return this[_0xe345('0x11')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x559b7f['text'])){return this[_0xe345('0x11')][_0xe345('0xb0')]('no\x20text\x20configured');}this['channel'][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x127'),_0x559b7f['text']));var _0x355b43=this['awsPolly'][_0xe345('0xa9')](this,_0x559b7f);if(_0x355b43){this['channel'][_0xe345('0xb0')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x355b43));var _0x26ebf8=this[_0xe345('0x11')]['streamFile'](_0x355b43);try{fs['unlink'](_0x355b43+_0xe345('0x106'));}catch(_0x28949e){logger['error'](_0x28949e);}return _0x26ebf8;}return this[_0xe345('0x11')]['error'](_0x559b7f,_0xe345('0x128'));};AGIVertices[_0xe345('0x14')]['awslex']=function(_0x2edce1){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x129'),_0x2edce1['label']));if(!this['isConfigured'](_0x2edce1[_0xe345('0x89')])||!this[_0xe345('0x86')](_0x2edce1[_0xe345('0x8a')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x12a'));}if(!this[_0xe345('0x86')](_0x2edce1['aws_bot_name'])){return this['channel'][_0xe345('0xb0')]('no\x20bot\x20name\x20configured');}if(!this[_0xe345('0x86')](_0x2edce1[_0xe345('0x5d')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xae'));}this['channel'][_0xe345('0xea')]=!![];this[_0xe345('0x37')](_0x2edce1);this[_0xe345('0x42')](_0x2edce1['text'],'in','','');this['channel'][_0xe345('0xb0')](util[_0xe345('0x54')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2edce1[_0xe345('0x5d')]));var _0xd26211=this[_0xe345('0x12b')][_0xe345('0xa9')](this,_0x2edce1);if(_0xd26211){for(var _0x10e662 in _0xd26211){if(_0xd26211[_0xe345('0x97')](_0x10e662)&&_[_0xe345('0x98')](_0xd26211[_0x10e662])){this['channel'][_0xe345('0x9f')](util[_0xe345('0x54')](_0xe345('0x12c'),_0x10e662[_0xe345('0x6b')]()),_0xd26211[_0x10e662]);}}if(_['isNil'](_0xd26211['message'])){return this[_0xe345('0x11')][_0xe345('0xb0')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xe345('0x42')](_0xd26211[_0xe345('0x75')],_0xe345('0xed'),_0xe345('0x12d'),'');return this['channel']['noop'](util[_0xe345('0x54')](_0xe345('0x12e'),_0xd26211[_0xe345('0x75')]));}}return this[_0xe345('0x11')][_0xe345('0x2d')](_0x2edce1,_0xe345('0x12f'));};AGIVertices[_0xe345('0x14')][_0xe345('0x130')]=function(_0x5a3dc8){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x131'),_0x5a3dc8[_0xe345('0xad')],_0x5a3dc8[_0xe345('0x67')]));if(!this['isConfigured'](_0x5a3dc8[_0xe345('0x79')])){return this['channel']['noop'](_0xe345('0xe9'));}var _0x5d93ce='wav';var _0x17c51a=util[_0xe345('0x54')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1c9d70=util['format']('%s.%s',_0x17c51a,_0x5d93ce);var _0x383f68=!![];if(_0x5a3dc8[_0xe345('0x132')]===_0xe345('0x133')){_0x383f68=![];}var _0xc8550d=this[_0xe345('0x11')]['recordFile'](_0x17c51a,_0x5d93ce,_0x5a3dc8[_0xe345('0x134')],_0x5a3dc8[_0xe345('0x67')],undefined,_0x383f68);if(_0xc8550d[_0xe345('0xa6')]!==-0x1){this[_0xe345('0x11')]['noop'](util['format'](_0xe345('0x135'),_0x1c9d70));var _0x2d9966=this['googleASR'][_0xe345('0xa9')](this,_0x5a3dc8,_0x1c9d70);if(_0x2d9966){for(var _0x1a4289 in _0x2d9966){if(_0x2d9966['hasOwnProperty'](_0x1a4289)){this['channel'][_0xe345('0x9f')](util[_0xe345('0x54')]('GOOGLE_ASR_%s',_0x1a4289[_0xe345('0x6b')]()),_0x2d9966[_0x1a4289]);}}return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x136'),JSON[_0xe345('0x72')](_0x2d9966)));}}return _0xc8550d;};AGIVertices[_0xe345('0x14')]['tildeasr']=function(_0x5142ef){logger['info'](util[_0xe345('0x54')](_0xe345('0x137'),_0x5142ef['label']));if(!this[_0xe345('0x86')](_0x5142ef[_0xe345('0x138')])){return this[_0xe345('0x11')]['noop']('no\x20appid\x20configured');}if(!this[_0xe345('0x86')](_0x5142ef[_0xe345('0x93')])){return this['channel'][_0xe345('0xb0')]('no\x20appsecret\x20configured');}var _0x21e6f7=_0xe345('0x139');var _0x2f2551=util[_0xe345('0x54')](_0xe345('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x24323f=util['format'](_0xe345('0x9e'),_0x2f2551,_0x21e6f7);var _0x4d58f6=!![];if(_0x5142ef[_0xe345('0x132')]===_0xe345('0x133')){_0x4d58f6=![];}var _0x58ffbf=this[_0xe345('0x11')][_0xe345('0x13b')](_0x2f2551,_0x21e6f7,_0x5142ef[_0xe345('0x134')],_0x5142ef['timeout'],undefined,_0x4d58f6);if(_0x58ffbf['result']!==-0x1){this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x13c'),_0x24323f));var _0x1241d5=this['tildeASR']['sync'](this,_0x5142ef,_0x24323f);if(_0x1241d5){for(var _0x22bcae in _0x1241d5){if(_0x1241d5[_0xe345('0x97')](_0x22bcae)){this['channel'][_0xe345('0x9f')](util['format']('TILDE_ASR_%s',_0x22bcae[_0xe345('0x6b')]()),_0x1241d5[_0x22bcae]);}}return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x13d'),JSON[_0xe345('0x72')](_0x1241d5)));}}return _0x58ffbf;};AGIVertices[_0xe345('0x14')]['gotoc']=function(_0x9073da){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x13e'),_0x9073da[_0xe345('0xad')]));return this['channel'][_0xe345('0x13f')](_0x9073da[_0xe345('0x3d')],_0x9073da[_0xe345('0x140')],_0x9073da[_0xe345('0x3e')]);};AGIVertices['prototype'][_0xe345('0x141')]=function(_0x37f4e4){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x142'),_0x37f4e4['label']));if(!this['isConfigured'](_0x37f4e4['condition'])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x37f4e4,'no\x20condition\x20configured');}try{var _0x386463=eval(_0x37f4e4[_0xe345('0x143')])?_0xe345('0x144'):'false';this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x145'),_0x37f4e4['condition'],_0x386463));return{'code':0xc8,'result':_0x386463};}catch(_0x34460a){return{'code':0xc8,'result':_0xe345('0x146')};}};AGIVertices[_0xe345('0x14')][_0xe345('0x147')]=function(_0x2199c2){logger['info'](util[_0xe345('0x54')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x2199c2['label']));if(!this['isConfigured'](_0x2199c2[_0xe345('0x148')])){return this['channel'][_0xe345('0x2d')](_0x2199c2,'no\x20interval\x20configured');}var _0x75f603=this[_0xe345('0x26')]['sync'](this,_0x2199c2['interval_id']);if(!_0x75f603){return this['channel'][_0xe345('0x2d')](_0x2199c2,'no\x20intervals\x20found');}for(var _0x127895=0x0;_0x127895<_0x75f603['length'];_0x127895+=0x1){var _0x20c879=this[_0xe345('0x11')][_0xe345('0x15')](util[_0xe345('0x54')](_0xe345('0x149'),_0x75f603[_0x127895]));if(_0x20c879[_0xe345('0xa6')]===-0x1){return _0x20c879;}logger[_0xe345('0x2f')](util['format']('IFTIME\x20%s\x20%s',_0x75f603[_0x127895],_0x20c879[_0xe345('0xa3')]));if(_0x20c879[_0xe345('0xa3')]===_0xe345('0x144')){logger[_0xe345('0x2f')](util[_0xe345('0x54')]('IFTIME\x20%s\x20%s',_0x75f603[_0x127895],_0xe345('0x144')));this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('IFTIME\x20%s\x20%s',_0x75f603[_0x127895],_0xe345('0x144')));return{'code':0xc8,'result':_0xe345('0x144')};}else{logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x14a'),_0x75f603[_0x127895],_0xe345('0x146')));this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x14a'),_0x75f603[_0x127895],_0xe345('0x146')));}}return{'code':0xc8,'result':_0xe345('0x146')};};AGIVertices[_0xe345('0x14')][_0xe345('0x14b')]=function(_0x1722d2){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x14c'),_0x1722d2[_0xe345('0xad')]));return this[_0xe345('0x11')][_0xe345('0x14b')]();};AGIVertices[_0xe345('0x14')][_0xe345('0x14d')]=function(_0x1ea2c5){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x14e'),_0x1ea2c5['label']));if(!this['isConfigured'](_0x1ea2c5['key'])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xe9'));}var _0xd1a130=_0xe345('0x139');var _0x214e33=util['format'](_0xe345('0x13a'),FILES_PATH,rs[_0xe345('0x11d')](0x4));var _0x30fc94=util[_0xe345('0x54')]('%s.%s',_0x214e33,_0xd1a130);var _0x850e4c=!![];if(_0x1ea2c5[_0xe345('0x132')]===_0xe345('0x133')){_0x850e4c=![];}var _0x5e47b9=this[_0xe345('0x11')][_0xe345('0x13b')](_0x214e33,_0xd1a130,_0x1ea2c5['intKey'],_0x1ea2c5[_0xe345('0x67')],undefined,_0x850e4c);if(_0x5e47b9[_0xe345('0xa6')]!==-0x1){this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x14f'),_0x30fc94));var _0x3fd9d2=this[_0xe345('0x84')]['sync'](this,_0x1ea2c5,_0x30fc94);if(_0x3fd9d2){for(var _0x21b1cf in _0x3fd9d2){if(_0x3fd9d2[_0xe345('0x97')](_0x21b1cf)){this[_0xe345('0x11')]['setVariable'](util[_0xe345('0x54')](_0xe345('0x150'),_0x21b1cf[_0xe345('0x6b')]()),_0x3fd9d2[_0x21b1cf]);}}return this[_0xe345('0x11')]['noop'](util[_0xe345('0x54')](_0xe345('0x151'),JSON[_0xe345('0x72')](_0x3fd9d2)));}}return _0x5e47b9;};AGIVertices[_0xe345('0x14')][_0xe345('0x152')]=function(_0x161d3e){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x153'),_0x161d3e['label']));if(!this[_0xe345('0x86')](_0x161d3e[_0xe345('0x79')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xe9'));}if(!this[_0xe345('0x86')](_0x161d3e[_0xe345('0x5d')])){return this[_0xe345('0x11')]['noop']('no\x20text\x20configured');}this['channel'][_0xe345('0xb0')](util['format'](_0xe345('0x154'),_0x161d3e[_0xe345('0x5d')]));var _0x4a1a17=this['ispeechTTS'][_0xe345('0xa9')](this,_0x161d3e);if(_0x4a1a17){this[_0xe345('0x11')][_0xe345('0xb0')](util['format']('ispeech\x20%s\x20file\x20created',_0x4a1a17));var _0x55cd57=this[_0xe345('0x11')][_0xe345('0x104')](_0x4a1a17,_0x161d3e[_0xe345('0x134')]);try{fs['unlink'](_0x4a1a17+_0xe345('0x106'));}catch(_0x53e0f9){logger[_0xe345('0x2d')](_0x53e0f9);}return _0x55cd57;}return this[_0xe345('0x11')]['error'](_0x161d3e,_0xe345('0x155'));};AGIVertices[_0xe345('0x14')][_0xe345('0x156')]=function(_0x2be40e){logger['info'](util[_0xe345('0x54')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2be40e['label']));if(!this['isConfigured'](_0x2be40e[_0xe345('0x157')])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x2be40e,'no\x20find\x20by\x20configured');}logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x158'),this[_0xe345('0x11')][_0xe345('0x3a')],_0x2be40e[_0xe345('0x157')]));var _0x12d6e0=this[_0xe345('0x57')][_0xe345('0xa9')](this,_0x2be40e[_0xe345('0x157')]);if(_0x12d6e0){logger[_0xe345('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe345('0x11')][_0xe345('0x3a')],_0x2be40e[_0xe345('0x157')]));this['channel'][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x159'),this[_0xe345('0x11')][_0xe345('0x3a')],_0x2be40e[_0xe345('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x15a'),this['channel']['callerid'],_0x2be40e[_0xe345('0x157')]));this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x15a'),this[_0xe345('0x11')]['callerid'],_0x2be40e['findBy']));return{'code':0xc8,'result':_0xe345('0x15b')};}};AGIVertices[_0xe345('0x14')]['logout']=function(_0x2eb2f3){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x15c'),_0x2eb2f3[_0xe345('0xad')]));if(!this['isConfigured'](_0x2eb2f3[_0xe345('0x157')])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x2eb2f3,'no\x20find\x20by\x20configured');}logger[_0xe345('0x2f')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe345('0x11')][_0xe345('0x3a')],_0x2eb2f3['findBy']));var _0x4f18d3=this[_0xe345('0x52')][_0xe345('0xa9')](this,_0x2eb2f3['findBy']);if(_0x4f18d3){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe345('0x11')][_0xe345('0x3a')],_0x2eb2f3[_0xe345('0x157')]));this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x159'),this[_0xe345('0x11')][_0xe345('0x3a')],_0x2eb2f3[_0xe345('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x15a'),this[_0xe345('0x11')]['callerid'],_0x2eb2f3[_0xe345('0x157')]));this['channel']['noop'](util[_0xe345('0x54')](_0xe345('0x15a'),this['channel']['callerid'],_0x2eb2f3['findBy']));return{'code':0xc8,'result':_0xe345('0x15b')};}};AGIVertices[_0xe345('0x14')][_0xe345('0x15d')]=function(_0x5d2dbe){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x15e'),_0x5d2dbe[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x5d2dbe[_0xe345('0x15f')])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x5d2dbe,_0xe345('0x160'));}this[_0xe345('0x11')]['noop'](util[_0xe345('0x54')](_0xe345('0x161'),_0x5d2dbe[_0xe345('0x15f')]));var _0x66c6c5=eval(_0x5d2dbe[_0xe345('0x15f')]);if(!this['isConfigured'](_0x5d2dbe[_0xe345('0xdb')])){return this[_0xe345('0x11')]['noop'](_0xe345('0xdc'));}var _0x23ef9b=this[_0xe345('0x15')][_0xe345('0xa9')](this,_0x5d2dbe['variable_id']);if(!_0x23ef9b){return this['channel'][_0xe345('0x2d')](_0x5d2dbe,'no\x20variable\x20found');}if(_[_0xe345('0x162')](_0x66c6c5)){var _0x29419d=this;_0x66c6c5[_0xe345('0xde')](function(_0x339fa9,_0x4999a7){_0x29419d['channel'][_0xe345('0x9f')](util[_0xe345('0x54')]('%s[%s]',_0x23ef9b,_0x4999a7),_0x339fa9);});return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('variable\x20%s[key]\x20set',_0x23ef9b));}else{return this[_0xe345('0x11')][_0xe345('0x9f')](_0x23ef9b,_0x66c6c5);}};AGIVertices[_0xe345('0x14')][_0xe345('0xe')]=function(_0x6502ed){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x163'),_0x6502ed[_0xe345('0xad')]));if(_0x6502ed['retry']===0x0){return this[_0xe345('0xa8')](_0x6502ed);}_0x6502ed[_0xe345('0xaa')]-=0x1;if(!this['isConfigured'](_0x6502ed[_0xe345('0x115')])){return this[_0xe345('0x11')]['error'](_0x6502ed,_0xe345('0x164'));}var _0x2d4557=this[_0xe345('0x21')][_0xe345('0xa9')](this,_0x6502ed[_0xe345('0x115')]);if(!_0x2d4557){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x6502ed,_0xe345('0x116'));}var _0x4407bc=this['channel'][_0xe345('0x117')](_0x2d4557,_0x6502ed[_0xe345('0x118')],_0x6502ed[_0xe345('0x165')]);var _0x370769=_0x4407bc[_0xe345('0xa6')];if(_0x4407bc[_0xe345('0xa6')]===-0x1){this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x6502ed,'-1');return _0x4407bc;}else if(_0x4407bc[_0xe345('0xa3')]===_0xe345('0x67')){_0x4407bc[_0xe345('0xa6')]=_0x4407bc[_0xe345('0xa6')][_0xe345('0x9a')]>0x0?_0x4407bc[_0xe345('0xa6')]:'t';}else if(_[_0xe345('0x46')](_0x4407bc[_0xe345('0xa6')])){_0x4407bc[_0xe345('0xa6')]='#';_0x370769='#';}if(!this[_0xe345('0x86')](_0x6502ed['variable_id'])){this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xdc'));}else{var _0x44186b=this['getVariable']['sync'](this,_0x6502ed[_0xe345('0xdb')]);if(!_0x44186b){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x6502ed,'no\x20variable\x20found');}this[_0xe345('0x11')][_0xe345('0x9f')](_0x44186b,_0x370769);}this['createSquareDetailsReport']['sync'](this,_0x6502ed,_0x370769);return _0x4407bc;};AGIVertices[_0xe345('0x14')]['noop']=function(_0x5a9133){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x166'),_0x5a9133[_0xe345('0xad')]));return this[_0xe345('0x11')]['noop'](_0x5a9133['output']||_0x5a9133[_0xe345('0xad')]);};AGIVertices[_0xe345('0x14')][_0xe345('0x167')]=function(_0x30e592){logger['info'](util[_0xe345('0x54')](_0xe345('0x168'),_0x30e592[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x30e592[_0xe345('0x157')])){return this[_0xe345('0x11')]['error'](_0x30e592,_0xe345('0x169'));}logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x158'),this[_0xe345('0x11')][_0xe345('0x3a')],_0x30e592['findBy']));var _0x177313=this[_0xe345('0x4d')][_0xe345('0xa9')](this,_0x30e592[_0xe345('0x16a')]);var _0x558acb=this[_0xe345('0x50')]['sync'](this,_0x30e592[_0xe345('0x157')],_0x177313);if(_0x558acb){logger[_0xe345('0x2f')](util[_0xe345('0x54')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe345('0x11')]['callerid'],_0x30e592['findBy']));this[_0xe345('0x11')][_0xe345('0xb0')](util['format'](_0xe345('0x159'),this[_0xe345('0x11')][_0xe345('0x3a')],_0x30e592[_0xe345('0x157')]));return{'code':0xc8,'result':_0xe345('0x16b')};}else{logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x15a'),this[_0xe345('0x11')][_0xe345('0x3a')],_0x30e592[_0xe345('0x157')]));this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x159'),this[_0xe345('0x11')][_0xe345('0x3a')],_0x30e592[_0xe345('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe345('0x14')][_0xe345('0x16c')]=function(_0x1ae64e){logger[_0xe345('0x2f')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x1ae64e[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x1ae64e['file_id'])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x1ae64e,_0xe345('0x164'));}var _0x1063b3=this['getSound'][_0xe345('0xa9')](this,_0x1ae64e[_0xe345('0x115')]);if(!_0x1063b3){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x1ae64e,_0xe345('0x116'));}var _0x390a3a=this[_0xe345('0x11')][_0xe345('0x58')]('PLAYBACK',[_0x1063b3,_0x1ae64e[_0xe345('0xe6')]]);if(_0x390a3a[_0xe345('0xa6')]===-0x1){return _0x390a3a;}return this[_0xe345('0x11')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xe345('0x16d'),_0x1063b3));};AGIVertices[_0xe345('0x14')][_0xe345('0x16e')]=function(_0x39a6f2){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x16f'),_0x39a6f2['label']));if(!this[_0xe345('0x86')](_0x39a6f2['queue_id'])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x39a6f2,_0xe345('0x170'));}var _0x153485='';var _0x405ee1=parseInt(_0x39a6f2['queue_id'],0xa);if(isNaN(_0x405ee1)){_0x153485=_0x39a6f2[_0xe345('0x171')];}else{_0x153485=this['getVoiceQueue'][_0xe345('0xa9')](this,_0x39a6f2['queue_id']);if(!_0x153485){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x39a6f2,'no\x20queue\x20found');}}var _0x4f1519='';if(this[_0xe345('0x86')](_0x39a6f2[_0xe345('0x115')])){var _0x28a190=this[_0xe345('0x21')][_0xe345('0xa9')](this,_0x39a6f2[_0xe345('0x115')]);if(_0x28a190){_0x4f1519=_0x28a190;}}this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x39a6f2,_0x153485);if(_0x39a6f2[_0xe345('0xe6')]['indexOf']('x')<0x0){_0x39a6f2[_0xe345('0xe6')]+='x';}if(_0x39a6f2[_0xe345('0xe6')][_0xe345('0x172')]('X')<0x0){_0x39a6f2[_0xe345('0xe6')]+='X';}this['channel'][_0xe345('0x9f')](_0xe345('0x173'),_0x153485?_0x153485[_0xe345('0x174')]():'');var _0x208d13=this[_0xe345('0x11')]['exec'](_0xe345('0x175'),[_0x153485,_0x39a6f2[_0xe345('0xe6')],_0x39a6f2['url'],_0x4f1519,_0x39a6f2[_0xe345('0x67')],_0x39a6f2[_0xe345('0x8')],_0x39a6f2[_0xe345('0x176')],_0x39a6f2[_0xe345('0x177')],'',_0x39a6f2[_0xe345('0x178')]]);if(_0x208d13['result']===-0x1){return _0x208d13;}return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x179'),_0xe345('0x175'),_0x153485));};AGIVertices['prototype'][_0xe345('0x17a')]=function(_0xb7f4f2){logger['info'](util[_0xe345('0x54')](_0xe345('0x17b'),_0xb7f4f2[_0xe345('0xad')]));var _0x21d14b=_0xb7f4f2[_0xe345('0x17c')]||_0xe345('0x139');var _0x426c1c=util['format'](_0xe345('0x17d'),this[_0xe345('0x11')][_0xe345('0x3b')],rs[_0xe345('0x11d')](0x5));var _0xf6fd3e=util[_0xe345('0x54')](_0xe345('0x17e'),FILES_PATH,_0x426c1c,_0x21d14b);var _0x35236f=util[_0xe345('0x54')]('%s/recordings/%s',FILES_PATH,_0x426c1c);this['createSquareRecording'][_0xe345('0xa9')](this,_0xb7f4f2,_0x426c1c,_0xf6fd3e);this[_0xe345('0x11')]['setVariable'](_0xe345('0x17f'),_0x426c1c);logger[_0xe345('0x2f')](_0xe345('0x180'),_0x35236f,_0x21d14b,_0xb7f4f2[_0xe345('0x181')],_0xb7f4f2['timeout']);return this[_0xe345('0x11')][_0xe345('0x13b')](_0x35236f,_0x21d14b,_0xb7f4f2[_0xe345('0x181')],_0xb7f4f2[_0xe345('0x67')],undefined,!![]);};AGIVertices[_0xe345('0x14')][_0xe345('0x182')]=function(_0x33f295){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x183'),_0x33f295[_0xe345('0xad')]));if(!this['isConfigured'](_0x33f295['url'])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x184'));}var _0xf55713=this[_0xe345('0x64')][_0xe345('0xa9')](this,_0x33f295);logger[_0xe345('0x2f')](util[_0xe345('0x54')]('Response:',util['inspect'](_0xf55713,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x33f295['variable_id'])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x185'));}var _0x3b537b=this[_0xe345('0x15')][_0xe345('0xa9')](this,_0x33f295[_0xe345('0xdb')]);if(!_0x3b537b){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x33f295,_0xe345('0xdd'));}this['channel'][_0xe345('0x9f')](util['format'](_0xe345('0x186'),_0x3b537b),_0xf55713[_0xe345('0x74')]?_0xf55713[_0xe345('0x74')]:_0xe345('0x187'));this[_0xe345('0x11')]['setVariable'](util['format'](_0xe345('0x188'),_0x3b537b),_0xf55713[_0xe345('0x189')]?_0xf55713[_0xe345('0x189')]:'OK');if(_0xf55713[_0xe345('0x6c')]){try{this[_0xe345('0x9c')](_0xf55713[_0xe345('0x6c')],_0x3b537b);}catch(_0x498992){logger[_0xe345('0x2d')](util[_0xe345('0x54')](_0xe345('0x18a'),_0x3b537b));}}return this[_0xe345('0x11')]['noop'](util[_0xe345('0x54')](_0xe345('0xe0'),_0x3b537b));};AGIVertices[_0xe345('0x14')]['saydigits']=function(_0x25bb0e){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x18b'),_0x25bb0e[_0xe345('0xad')]));return this[_0xe345('0x11')][_0xe345('0x18c')](_0x25bb0e['digits']['replace'](/\s+/g,''),_0x25bb0e['escape_digits']);};AGIVertices[_0xe345('0x14')][_0xe345('0x18d')]=function(_0x117592){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x18e'),_0x117592[_0xe345('0xad')]));return this['channel']['sayNumber'](_0x117592[_0xe345('0x68')][_0xe345('0x5a')](/\s+/g,''),_0x117592[_0xe345('0x181')]);};AGIVertices['prototype'][_0xe345('0x18f')]=function(_0x42fcf1){logger['info'](util[_0xe345('0x54')](_0xe345('0x190'),_0x42fcf1['label']));return this[_0xe345('0x11')][_0xe345('0x191')](_0x42fcf1[_0xe345('0x5d')],_0x42fcf1['escape_digits']);};AGIVertices[_0xe345('0x14')][_0xe345('0x192')]=function(_0x10d756){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x193'),_0x10d756[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0x10d756[_0xe345('0x194')])){return this['channel'][_0xe345('0xb0')](_0xe345('0x195'));}var _0x3adbeb=this[_0xe345('0x23')][_0xe345('0xa9')](this,_0x10d756[_0xe345('0x194')]);if(!_0x3adbeb||!_0x3adbeb[_0xe345('0x196')]){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x10d756,_0xe345('0x197'));}var _0x1a08f={'from':util[_0xe345('0x54')](_0xe345('0x198'),_0x3adbeb[_0xe345('0x17')],_0x3adbeb[_0xe345('0x199')]||_0x3adbeb['Smtp'][_0xe345('0x19a')]),'to':_0x10d756['to']||'','cc':_0x10d756['cc']||'','bcc':_0x10d756[_0xe345('0x19b')]||'','subject':_0x10d756[_0xe345('0x19c')],'html':_0x10d756[_0xe345('0x5d')],'text':_0x10d756[_0xe345('0x5d')]};if(this[_0xe345('0x86')](_0x10d756['template_id'])){}logger[_0xe345('0xe2')](_0xe345('0x19d'),JSON['stringify'](_0x1a08f));this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x10d756,_0x10d756[_0xe345('0x194')]);this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x19e'),_0x3adbeb[_0xe345('0x17')]));this[_0xe345('0x25')][_0xe345('0xa9')](this,_0x3adbeb[_0xe345('0x19f')],_0x1a08f);return this[_0xe345('0x11')]['noop'](_0xe345('0x1a0'));};AGIVertices[_0xe345('0x14')][_0xe345('0x1a1')]=function(_0x5e76ae){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x1a2'),_0x5e76ae['label']));return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x1a3'));};AGIVertices['prototype'][_0xe345('0x1a4')]=function(_0x52d3fe){logger[_0xe345('0x2f')](util['format'](_0xe345('0x1a5'),_0x52d3fe[_0xe345('0xad')]));if(!this['isConfigured'](_0x52d3fe['sms_account_id'])){return this[_0xe345('0x11')][_0xe345('0xb0')]('no\x20sms\x20account\x20configured');}var _0x287281=this[_0xe345('0x34')]['sync'](this,_0x52d3fe[_0xe345('0x1a6')]);if(!_0x287281){return this[_0xe345('0x11')]['error'](_0x52d3fe,_0xe345('0x1a7'));}var _0x2c9cec={'body':_0x52d3fe['sms_text'],'phone':_0x52d3fe['to']||'','SmsAccountId':_0x287281['id']};logger['debug'](_0xe345('0x1a8'),JSON[_0xe345('0x72')](_0x2c9cec));this[_0xe345('0x37')]['sync'](this,_0x52d3fe,_0x52d3fe[_0xe345('0x1a6')]);this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x1a9'),_0x287281[_0xe345('0x17')]));this[_0xe345('0x36')][_0xe345('0xa9')](this,_0x2c9cec);return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x1aa'));};AGIVertices['prototype']['set']=function(_0x289d46){logger[_0xe345('0x2f')](util['format'](_0xe345('0x1ab'),_0x289d46['label']));if(!this[_0xe345('0x86')](_0x289d46[_0xe345('0xdb')])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x289d46,_0xe345('0x1ac'));}var _0x7b43a9=this[_0xe345('0x15')]['sync'](this,_0x289d46['variable_id']);if(!_0x7b43a9){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x289d46,_0xe345('0xdd'));}return this[_0xe345('0x11')]['setVariable'](_0x7b43a9,_0x289d46['variable_value']);};AGIVertices['prototype'][_0xe345('0x1ad')]=function(_0xa31934){logger[_0xe345('0x2f')](util[_0xe345('0x54')]('Enter\x20in\x20START\x20(%s)\x20block',_0xa31934[_0xe345('0xad')]));this['channel']['noop'](_0xe345('0x1ae'));if(_0xa31934[_0xe345('0xbc')]==='yes'){this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x1af'));return this['channel'][_0xe345('0xbc')]();}return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x1b0'));};AGIVertices['prototype']['subproject']=function(_0x5ed072){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x1b1'),_0x5ed072['label']));if(!this[_0xe345('0x86')](_0x5ed072['project_id'])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x5ed072,_0xe345('0x1b2'));}var _0x4fe36f=this[_0xe345('0x1b')][_0xe345('0xa9')](this,_0x5ed072[_0xe345('0x1b3')]);if(!this['isConfigured'](_0x4fe36f)){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x5ed072,util[_0xe345('0x54')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5ed072['project_id']));}if(_0x4fe36f===this[_0xe345('0x11')][_0xe345('0x39')]){return this['channel'][_0xe345('0x2d')](_0x5ed072,_0xe345('0x1b4'));}this['createSquareDetailsReport'][_0xe345('0xa9')](this,_0x5ed072,_0x4fe36f);var _0x236953=this[_0xe345('0x11')][_0xe345('0x58')](_0xe345('0x1b5'),util[_0xe345('0x54')](_0xe345('0x1b6'),config[_0xe345('0x8')][_0xe345('0x1b7')]||_0xe345('0x1b8'),_0x4fe36f,this['channel'][_0xe345('0x39')]));if(_0x236953[_0xe345('0xa6')]===-0x1){return _0x236953;}return this[_0xe345('0x11')][_0xe345('0xb0')](util['format'](_0xe345('0x179'),'AGI',_0x4fe36f));};AGIVertices[_0xe345('0x14')][_0xe345('0x1b9')]=function(_0x16fb9f){logger[_0xe345('0x2f')](util[_0xe345('0x54')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x16fb9f[_0xe345('0xad')]));var _0x3efb71=this['shellCommand'][_0xe345('0xa9')](this,_0x16fb9f['command']);this[_0xe345('0x37')][_0xe345('0xa9')](this,_0x16fb9f,_0x16fb9f[_0xe345('0x1ba')]);if(this[_0xe345('0x86')](_0x16fb9f[_0xe345('0xdb')])){var _0x905e0a=this['getVariable']['sync'](this,_0x16fb9f[_0xe345('0xdb')]);if(_0x905e0a){this[_0xe345('0x11')]['setVariable'](_0x905e0a,_0x3efb71);return this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x1bb'),_0x16fb9f[_0xe345('0x1ba')],_0x905e0a));}}return this['channel'][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x1bc'),_0x16fb9f[_0xe345('0x1ba')]));};AGIVertices[_0xe345('0x14')][_0xe345('0x1bd')]=function(_0x1d2b6f){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x1be'),_0x1d2b6f[_0xe345('0xad')]));_0x1d2b6f[_0xe345('0x5d')]=_0x1d2b6f[_0xe345('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe345('0x86')](_0x1d2b6f['apiKey'])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0x1bf'));}if(!this['isConfigured'](_0x1d2b6f[_0xe345('0x5d')])){return this['channel'][_0xe345('0xb0')](_0xe345('0xae'));}this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x1c0'),_0x1d2b6f[_0xe345('0x5d')]));var _0x13863a=this[_0xe345('0x5b')][_0xe345('0xa9')](this,_0x1d2b6f);if(_0x13863a){this[_0xe345('0x11')]['noop'](util[_0xe345('0x54')](_0xe345('0x1c1'),_0x13863a));var _0x502b42=this[_0xe345('0x11')][_0xe345('0x104')](_0x13863a);try{fs['unlink'](_0x13863a+'.wav');}catch(_0x69eee7){logger[_0xe345('0x2d')](_0x69eee7);}return _0x502b42;}return this[_0xe345('0x11')][_0xe345('0x2d')](_0x1d2b6f,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xe345('0x14')][_0xe345('0x1c2')]=function(_0x326f26){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x1c3'),_0x326f26[_0xe345('0xad')]));_0x326f26[_0xe345('0x5d')]=_0x326f26[_0xe345('0x5d')][_0xe345('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe345('0x86')](_0x326f26[_0xe345('0x5d')])){return this[_0xe345('0x11')][_0xe345('0xb0')](_0xe345('0xae'));}this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x1c4'),_0x326f26['text']));var _0x2d9137=this[_0xe345('0x62')][_0xe345('0xa9')](this,_0x326f26);if(_0x2d9137){this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')]('Google\x20TTS\x20%s\x20file\x20created',_0x2d9137));var _0x2bcef5=this[_0xe345('0x11')][_0xe345('0x104')](_0x2d9137);try{fs[_0xe345('0x105')](_0x2d9137+_0xe345('0x106'));}catch(_0xb3bffc){logger[_0xe345('0x2d')](_0xb3bffc);}return _0x2bcef5;}return this[_0xe345('0x11')][_0xe345('0x2d')](_0x326f26,_0xe345('0x1c5'));};AGIVertices[_0xe345('0x14')][_0xe345('0x1c6')]=function(_0xa2b0b4){logger['info'](util[_0xe345('0x54')](_0xe345('0x1c7'),_0xa2b0b4[_0xe345('0xad')]));if(!this[_0xe345('0x86')](_0xa2b0b4[_0xe345('0x157')])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0xa2b0b4,_0xe345('0x169'));}logger[_0xe345('0x2f')](util['format'](_0xe345('0x158'),this[_0xe345('0x11')][_0xe345('0x3a')],_0xa2b0b4[_0xe345('0x157')]));var _0x22c8e7=this['agentUnpause'][_0xe345('0xa9')](this,_0xa2b0b4['findBy']);if(_0x22c8e7){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe345('0x11')][_0xe345('0x3a')],_0xa2b0b4[_0xe345('0x157')]));this[_0xe345('0x11')]['noop'](util[_0xe345('0x54')](_0xe345('0x159'),this[_0xe345('0x11')][_0xe345('0x3a')],_0xa2b0b4['findBy']));return{'code':0xc8,'result':_0xe345('0x16b')};}else{logger[_0xe345('0x2f')](util['format'](_0xe345('0x15a'),this[_0xe345('0x11')]['callerid'],_0xa2b0b4[_0xe345('0x157')]));this[_0xe345('0x11')][_0xe345('0xb0')](util[_0xe345('0x54')](_0xe345('0x15a'),this[_0xe345('0x11')][_0xe345('0x3a')],_0xa2b0b4[_0xe345('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x1b4ca5){logger['info'](util[_0xe345('0x54')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1b4ca5['label']));var _0x5a903e=this[_0xe345('0x11')][_0xe345('0x58')](_0xe345('0x1c8'),[_0x1b4ca5[_0xe345('0x1c9')],_0x1b4ca5[_0xe345('0x77')]]);if(_0x5a903e[_0xe345('0xa6')]===-0x1){return _0x5a903e;}return this['channel'][_0xe345('0xb0')](util[_0xe345('0x54')]('Executed\x20command\x20%s\x20%s',_0xe345('0x1c8'),_0x1b4ca5['mailbox']));};AGIVertices['prototype'][_0xe345('0x1ca')]=function(_0x328809){logger[_0xe345('0x2f')](util[_0xe345('0x54')](_0xe345('0x1cb'),_0x328809[_0xe345('0xad')]));if(!this['isConfigured'](_0x328809['variable_id'])){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x328809,_0xe345('0x1ac'));}var _0x4be2a5=this[_0xe345('0x15')]['sync'](this,_0x328809[_0xe345('0xdb')]);if(!_0x4be2a5){return this[_0xe345('0x11')][_0xe345('0x2d')](_0x328809,_0xe345('0xdd'));}var _0x26f030=this[_0xe345('0x11')][_0xe345('0x15')](_0x4be2a5);return{'code':0xc8,'result':_0x26f030[_0xe345('0xa3')]?_0x26f030['extra']:'-'};};String[_0xe345('0x14')][_0xe345('0xa2')]=function(_0x381b80,_0x4b33b9){return this['split'](_0x381b80)['join'](_0x4b33b9);};module[_0xe345('0x1cc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3643d03..6f4c79d 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 _0xf008=['syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../../../config/logger','acw','../rpc/user','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest'];(function(_0x5c4b6a,_0x3e4163){var _0x2dec05=function(_0x17017e){while(--_0x17017e){_0x5c4b6a['push'](_0x5c4b6a['shift']());}};_0x2dec05(++_0x3e4163);}(_0xf008,0xfc));var _0x8f00=function(_0x2108e1,_0x3e4423){_0x2108e1=_0x2108e1-0x0;var _0x2030d9=_0xf008[_0x2108e1];return _0x2030d9;};'use strict';var util=require(_0x8f00('0x0'));var _=require(_0x8f00('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x8f00('0x2'))(_0x8f00('0x3'));var RpcUser=require(_0x8f00('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x237452){this['voiceQueues']=_0x237452['voiceQueues'];this[_0x8f00('0x5')]=_0x237452['agents'];this[_0x8f00('0x6')]=_0x237452['timers'];this[_0x8f00('0x7')]={};ami['on'](_0x8f00('0x8'),this[_0x8f00('0x9')][_0x8f00('0xa')](this));ami['on'](_0x8f00('0xb'),this[_0x8f00('0xc')][_0x8f00('0xa')](this));ami['on'](_0x8f00('0xd'),this['syncHangup'][_0x8f00('0xa')](this));ami['on'](_0x8f00('0xe'),this[_0x8f00('0xf')][_0x8f00('0xa')](this));ami['on'](_0x8f00('0x10'),this[_0x8f00('0x11')]['bind'](this));ami['on'](_0x8f00('0x12'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x8f00('0x13'),this[_0x8f00('0x14')][_0x8f00('0xa')](this));}function getDiff(_0x3615d0){var _0x79e13=moment()[_0x8f00('0x15')](0x0);var _0x54a63c=moment(_0x3615d0)[_0x8f00('0x15')](0x0);return _0x79e13[_0x8f00('0x16')](_0x54a63c,_0x8f00('0x17'));}Acw[_0x8f00('0x18')][_0x8f00('0x19')]=function(_0x2742b3){try{var _0x27ef6a=this;var _0x40ed5c=this[_0x8f00('0x7')][_0x2742b3]['interface'];var _0x498a25=this[_0x8f00('0x7')][_0x2742b3]['queue'];var _0x47e4af=this[_0x8f00('0x1a')][_0x498a25];var _0x4fd20d=![];var _0x29533f=_0x8f00('0x1b');if(_0x47e4af[_0x8f00('0x1c')]){if(_0x47e4af['mandatoryDispositionPause']['name']){_0x4fd20d=!![];_0x29533f=_0x47e4af[_0x8f00('0x1d')][_0x8f00('0x1e')];}}ami[_0x8f00('0x1f')]({'action':_0x8f00('0x20'),'interface':_0x40ed5c,'paused':!![],'reason':_0x29533f})[_0x8f00('0x21')](function(_0xc95e4d){if(_0x27ef6a[_0x8f00('0x5')][_0x40ed5c]){return RpcUser['getAgent'](_0x27ef6a[_0x8f00('0x5')][_0x40ed5c]['id'])[_0x8f00('0x21')](function(_0x3f7f47){if(_0x3f7f47&&!_0x3f7f47['voicePause']){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x2742b3,_0x40ed5c,_0x498a25);var _0x121c51=_0x27ef6a['channels'][_0x2742b3]['attended']&&_0x27ef6a[_0x8f00('0x7')][_0x2742b3][_0x8f00('0x22')]?_0x27ef6a['channels'][_0x2742b3][_0x8f00('0x22')]:_0x2742b3;return RpcUser['savePause'](_0x27ef6a[_0x8f00('0x5')][_0x40ed5c],_0x29533f,_0x121c51)[_0x8f00('0x21')](function(_0x131809){if(!_0x4fd20d){_0x27ef6a[_0x8f00('0x6')][_0x40ed5c]={};logger[_0x8f00('0x23')](_0x8f00('0x24'),_0x2742b3,_0x27ef6a[_0x8f00('0x1a')][_0x498a25][_0x8f00('0x25')],_0x40ed5c,_0x498a25);_0x27ef6a['timers'][_0x40ed5c]['timer']=setTimeout(_0x27ef6a['stopAcw']['bind'](_0x27ef6a,_0x40ed5c),_0x27ef6a[_0x8f00('0x1a')][_0x498a25]['acwTimeout']*0x3e8);_0x27ef6a['timers'][_0x40ed5c][_0x8f00('0x26')]=moment()[_0x8f00('0x27')](_0x8f00('0x28'));_0x27ef6a[_0x8f00('0x6')][_0x40ed5c][_0x8f00('0x29')]=_0x2742b3;_0x27ef6a[_0x8f00('0x6')][_0x40ed5c][_0x8f00('0x2a')]=_0x498a25;_0x27ef6a[_0x8f00('0x6')][_0x40ed5c][_0x8f00('0x2b')]=function(){var _0x28374a=getDiff(_0x27ef6a[_0x8f00('0x6')][_0x40ed5c][_0x8f00('0x26')]);clearTimeout(_0x27ef6a[_0x8f00('0x6')][_0x40ed5c][_0x8f00('0x2c')]);_0x27ef6a[_0x8f00('0x6')][_0x40ed5c]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x28374a},_0x27ef6a[_0x8f00('0x6')][_0x40ed5c]['uniqueid'],_0x40ed5c)[_0x8f00('0x21')](function(_0x214e1d){logger[_0x8f00('0x23')](_0x8f00('0x2d'),_0x2742b3,_0x28374a,_0x214e1d);})[_0x8f00('0x2e')](function(_0x39f26e){logger[_0x8f00('0x2f')](_0x8f00('0x30'),_0x2742b3,_0x39f26e);});delete _0x27ef6a['timers'][_0x40ed5c];};}});}else{logger[_0x8f00('0x23')](_0x8f00('0x31'),_0x2742b3,_0x40ed5c,_0x498a25);}});}})[_0x8f00('0x2e')](function(_0x36aa45){logger['error'](_0x8f00('0x24'),_0x2742b3,_0x27ef6a[_0x8f00('0x1a')][_0x498a25][_0x8f00('0x25')],_0x40ed5c,_0x498a25);})[_0x8f00('0x32')](function(){delete _0x27ef6a[_0x8f00('0x7')][_0x2742b3];});}catch(_0x32a9ab){logger['error']('[ACW][START]\x20%s',_0x32a9ab['message']);}};Acw[_0x8f00('0x18')][_0x8f00('0x33')]=function(_0x233762){try{var _0x17f9ff=this;if(_0x17f9ff[_0x8f00('0x6')][_0x233762]){_0x17f9ff[_0x8f00('0x6')][_0x233762]['timer']=![];var _0x3a0bee=_0x17f9ff[_0x8f00('0x6')][_0x233762][_0x8f00('0x29')];var _0x574008=_0x17f9ff[_0x8f00('0x6')][_0x233762][_0x8f00('0x2a')];var _0x4905fb=_0x17f9ff[_0x8f00('0x1a')][_0x574008][_0x8f00('0x25')];logger[_0x8f00('0x23')](_0x8f00('0x34'),_0x3a0bee,_0x233762);RpcUser[_0x8f00('0x35')](this[_0x8f00('0x5')][_0x233762]);RpcVoiceAgentReport[_0x8f00('0x36')]({'acwtime':_0x4905fb,'agentacw':!![]},_0x3a0bee,_0x233762)[_0x8f00('0x21')](function(_0xc89637){logger[_0x8f00('0x23')](_0x8f00('0x2d'),_0x3a0bee,_0x4905fb,_0xc89637);})['catch'](function(_0x392e15){logger[_0x8f00('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x3a0bee,_0x392e15);});}else{logger[_0x8f00('0x2f')](_0x8f00('0x37'),_0x233762);if(_0x17f9ff[_0x8f00('0x6')]){logger['info'](_0x8f00('0x38'),JSON[_0x8f00('0x39')](_0x17f9ff[_0x8f00('0x6')]));}}}catch(_0x20d38a){logger['error'](_0x8f00('0x3a'),_0x20d38a[_0x8f00('0x3b')]);}};Acw[_0x8f00('0x18')][_0x8f00('0x9')]=function(_0x1c188b){try{if(this[_0x8f00('0x1a')][_0x1c188b[_0x8f00('0x2a')]]&&(this[_0x8f00('0x1a')][_0x1c188b[_0x8f00('0x2a')]]['acw']||this[_0x8f00('0x1a')][_0x1c188b[_0x8f00('0x2a')]]['mandatoryDisposition'])){if(this[_0x8f00('0x5')][_0x1c188b[_0x8f00('0x3c')]]){this['channels'][_0x1c188b['uniqueid']]={'queue':_0x1c188b[_0x8f00('0x2a')],'interface':_0x1c188b['interface'],'destlinkedid':_0x1c188b[_0x8f00('0x22')]};}}}catch(_0x4ef406){logger[_0x8f00('0x2f')](_0x8f00('0x3d'),_0x4ef406[_0x8f00('0x3b')]);}};Acw[_0x8f00('0x18')][_0x8f00('0x14')]=function(_0x287aea){try{if(this[_0x8f00('0x1a')][_0x287aea[_0x8f00('0x2a')]]&&(this[_0x8f00('0x1a')][_0x287aea[_0x8f00('0x2a')]][_0x8f00('0x3')]||this['voiceQueues'][_0x287aea[_0x8f00('0x2a')]][_0x8f00('0x1c')])){if(this[_0x8f00('0x5')][_0x287aea[_0x8f00('0x3c')]]){this[_0x8f00('0x7')][_0x287aea['uniqueid']]={'queue':_0x287aea[_0x8f00('0x2a')],'interface':_0x287aea[_0x8f00('0x3c')]};}}}catch(_0x45819d){logger[_0x8f00('0x2f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x45819d['message']);}};Acw[_0x8f00('0x18')][_0x8f00('0xc')]=function(_0x5efc71){try{if(this[_0x8f00('0x7')][_0x5efc71['uniqueid']]&&_[_0x8f00('0x3e')](this['channels'][_0x5efc71[_0x8f00('0x29')]][_0x8f00('0x3f')])){logger[_0x8f00('0x23')](_0x8f00('0x40'),_0x5efc71[_0x8f00('0x29')]);this[_0x8f00('0x19')](_0x5efc71[_0x8f00('0x29')]);}else if(this['channels'][_0x5efc71[_0x8f00('0x41')]]&&_[_0x8f00('0x3e')](this['channels'][_0x5efc71['linkedid']]['attended'])){logger[_0x8f00('0x23')](_0x8f00('0x42'),_0x5efc71[_0x8f00('0x41')]);this[_0x8f00('0x19')](_0x5efc71[_0x8f00('0x41')]);}}catch(_0x29c7d8){logger[_0x8f00('0x2f')](_0x8f00('0x43'),_0x29c7d8[_0x8f00('0x3b')]);}};Acw[_0x8f00('0x18')][_0x8f00('0x44')]=function(_0x3cf2e7){try{if(this['channels'][_0x3cf2e7[_0x8f00('0x29')]]&&this[_0x8f00('0x7')][_0x3cf2e7[_0x8f00('0x29')]][_0x8f00('0x3f')]){logger[_0x8f00('0x23')](_0x8f00('0x45'),_0x3cf2e7[_0x8f00('0x29')]);this['startAcw'](_0x3cf2e7[_0x8f00('0x29')]);}else if(this['channels'][_0x3cf2e7[_0x8f00('0x41')]]&&this[_0x8f00('0x7')][_0x3cf2e7[_0x8f00('0x41')]][_0x8f00('0x3f')]){logger[_0x8f00('0x23')](_0x8f00('0x46'),_0x3cf2e7[_0x8f00('0x41')]);this[_0x8f00('0x19')](_0x3cf2e7[_0x8f00('0x41')]);}}catch(_0x408d3a){logger[_0x8f00('0x2f')](_0x8f00('0x47'),_0x408d3a['message']);}};Acw[_0x8f00('0x18')][_0x8f00('0x11')]=function(_0x19b227){try{if(!_[_0x8f00('0x48')](this[_0x8f00('0x7')][_0x19b227['transfereeuniqueid']])){this[_0x8f00('0x19')](_0x19b227[_0x8f00('0x49')]);if(this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x4a')]]){this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x4a')]][_0x8f00('0x3f')]=!![];this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x4b')]]=this['channels'][_0x19b227['secondtransfereruniqueid']];delete this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x4a')]];}}else if(!_[_0x8f00('0x48')](this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x4b')]])){this[_0x8f00('0x19')](_0x19b227['transfertargetuniqueid']);if(this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x4c')]]){this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x4c')]][_0x8f00('0x3f')]=!![];this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x49')]]=this['channels'][_0x19b227[_0x8f00('0x4c')]];delete this[_0x8f00('0x7')][_0x19b227[_0x8f00('0x4c')]];}}}catch(_0x39435c){logger[_0x8f00('0x2f')](_0x8f00('0x4d'),_0x39435c[_0x8f00('0x3b')]);}};Acw[_0x8f00('0x18')][_0x8f00('0x4e')]=function(_0x199a00){try{if(this['channels'][_0x199a00[_0x8f00('0x4f')]]){logger[_0x8f00('0x23')](_0x8f00('0x50'),JSON[_0x8f00('0x39')](_0x199a00[_0x8f00('0x4f')]));this['startAcw'](_0x199a00[_0x8f00('0x4f')]);}else if(this['channels'][_0x199a00['transfererlinkedid']]){logger['info'](_0x8f00('0x51'),JSON[_0x8f00('0x39')](_0x199a00[_0x8f00('0x52')]));this['startAcw'](_0x199a00[_0x8f00('0x52')]);}}catch(_0x29cfba){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x29cfba[_0x8f00('0x3b')]);}};Acw[_0x8f00('0x18')][_0x8f00('0xf')]=function(_0x512d06){try{if(this[_0x8f00('0x1a')][_0x512d06[_0x8f00('0x2a')]]&&this[_0x8f00('0x1a')][_0x512d06[_0x8f00('0x2a')]][_0x8f00('0x53')]===_0x8f00('0x54')){if(this[_0x8f00('0x5')][_0x512d06['interface']]){logger[_0x8f00('0x23')](_0x8f00('0x55'),_0x512d06[_0x8f00('0x29')],_0x512d06['interface'],_0x512d06['queue']);return RpcUser['savePause'](this[_0x8f00('0x5')][_0x512d06['interface']],'Auto-Pause',_0x512d06['uniqueid']);}}}catch(_0x4fb588){logger[_0x8f00('0x2f')](_0x8f00('0x56'),_0x4fb588['message']);}};module[_0x8f00('0x57')]=Acw; \ No newline at end of file +var _0x9169=['[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','agents','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','lastPauseAt','timer','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','queue'];(function(_0x451dc0,_0x507037){var _0x4e0708=function(_0x4077ae){while(--_0x4077ae){_0x451dc0['push'](_0x451dc0['shift']());}};_0x4e0708(++_0x507037);}(_0x9169,0xc3));var _0x9916=function(_0xe81d24,_0x4c235b){_0xe81d24=_0xe81d24-0x0;var _0x1ba400=_0x9169[_0xe81d24];return _0x1ba400;};'use strict';var util=require(_0x9916('0x0'));var _=require(_0x9916('0x1'));var moment=require(_0x9916('0x2'));var ami=require(_0x9916('0x3'));var logger=require(_0x9916('0x4'))('acw');var RpcUser=require(_0x9916('0x5'));var RpcVoiceAgentReport=require(_0x9916('0x6'));function Acw(_0x188540){this['voiceQueues']=_0x188540['voiceQueues'];this['agents']=_0x188540['agents'];this[_0x9916('0x7')]=_0x188540[_0x9916('0x7')];this[_0x9916('0x8')]={};ami['on'](_0x9916('0x9'),this[_0x9916('0xa')][_0x9916('0xb')](this));ami['on'](_0x9916('0xc'),this[_0x9916('0xd')][_0x9916('0xb')](this));ami['on'](_0x9916('0xe'),this[_0x9916('0xf')][_0x9916('0xb')](this));ami['on'](_0x9916('0x10'),this[_0x9916('0x11')][_0x9916('0xb')](this));ami['on']('attendedtransfer',this[_0x9916('0x12')][_0x9916('0xb')](this));ami['on'](_0x9916('0x13'),this[_0x9916('0x14')][_0x9916('0xb')](this));ami['on'](_0x9916('0x15'),this[_0x9916('0x16')][_0x9916('0xb')](this));}function getDiff(_0x3b3bed){var _0x5d4dd9=moment()[_0x9916('0x17')](0x0);var _0x2c0421=moment(_0x3b3bed)[_0x9916('0x17')](0x0);return _0x5d4dd9[_0x9916('0x18')](_0x2c0421,_0x9916('0x19'));}Acw[_0x9916('0x1a')][_0x9916('0x1b')]=function(_0x381825){try{var _0xcb8e42=this;var _0x3d91d0=this['channels'][_0x381825][_0x9916('0x1c')];var _0x1338b9=this[_0x9916('0x8')][_0x381825]['queue'];var _0x25a570=this[_0x9916('0x1d')][_0x1338b9];var _0x4f9902=![];var _0x312277=_0x9916('0x1e');if(_0x25a570[_0x9916('0x1f')]){if(_0x25a570[_0x9916('0x20')][_0x9916('0x21')]){_0x4f9902=!![];_0x312277=_0x25a570[_0x9916('0x20')][_0x9916('0x21')];}}ami[_0x9916('0x22')]({'action':_0x9916('0x23'),'interface':_0x3d91d0,'paused':!![],'reason':_0x312277})[_0x9916('0x24')](function(_0x3f8541){if(_0xcb8e42['agents'][_0x3d91d0]){return RpcUser[_0x9916('0x25')](_0xcb8e42[_0x9916('0x26')][_0x3d91d0]['id'])['then'](function(_0x4bd1b1){if(_0x4bd1b1&&!_0x4bd1b1['voicePause']){logger[_0x9916('0x27')](_0x9916('0x28'),_0x381825,_0x3d91d0,_0x1338b9);var _0x572666=_0xcb8e42[_0x9916('0x8')][_0x381825][_0x9916('0x29')]&&_0xcb8e42['channels'][_0x381825][_0x9916('0x2a')]?_0xcb8e42['channels'][_0x381825][_0x9916('0x2a')]:_0x381825;return RpcUser[_0x9916('0x2b')](_0xcb8e42[_0x9916('0x26')][_0x3d91d0],_0x312277,_0x572666)['then'](function(_0x1304fe){if(!_0x4f9902){_0xcb8e42['timers'][_0x3d91d0]={};logger[_0x9916('0x27')](_0x9916('0x2c'),_0x381825,_0xcb8e42['voiceQueues'][_0x1338b9]['acwTimeout'],_0x3d91d0,_0x1338b9);_0xcb8e42[_0x9916('0x7')][_0x3d91d0]['timer']=setTimeout(_0xcb8e42['stopAcw'][_0x9916('0xb')](_0xcb8e42,_0x3d91d0),_0xcb8e42[_0x9916('0x1d')][_0x1338b9][_0x9916('0x2d')]*0x3e8);_0xcb8e42[_0x9916('0x7')][_0x3d91d0]['lastPauseAt']=moment()[_0x9916('0x2e')](_0x9916('0x2f'));_0xcb8e42['timers'][_0x3d91d0]['uniqueid']=_0x381825;_0xcb8e42[_0x9916('0x7')][_0x3d91d0]['queue']=_0x1338b9;_0xcb8e42[_0x9916('0x7')][_0x3d91d0][_0x9916('0x30')]=function(){var _0x4dbbfe=getDiff(_0xcb8e42[_0x9916('0x7')][_0x3d91d0][_0x9916('0x31')]);clearTimeout(_0xcb8e42['timers'][_0x3d91d0][_0x9916('0x32')]);_0xcb8e42[_0x9916('0x7')][_0x3d91d0][_0x9916('0x32')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x4dbbfe},_0xcb8e42[_0x9916('0x7')][_0x3d91d0][_0x9916('0x33')],_0x3d91d0)['then'](function(_0x1bf1be){logger[_0x9916('0x27')](_0x9916('0x34'),_0x381825,_0x4dbbfe,_0x1bf1be);})[_0x9916('0x35')](function(_0x240194){logger['error'](_0x9916('0x36'),_0x381825,_0x240194);});delete _0xcb8e42[_0x9916('0x7')][_0x3d91d0];};}});}else{logger[_0x9916('0x27')](_0x9916('0x37'),_0x381825,_0x3d91d0,_0x1338b9);}});}})[_0x9916('0x35')](function(_0x52b102){logger['error'](_0x9916('0x2c'),_0x381825,_0xcb8e42[_0x9916('0x1d')][_0x1338b9][_0x9916('0x2d')],_0x3d91d0,_0x1338b9);})[_0x9916('0x38')](function(){delete _0xcb8e42[_0x9916('0x8')][_0x381825];});}catch(_0x1ec433){logger[_0x9916('0x39')](_0x9916('0x3a'),_0x1ec433[_0x9916('0x3b')]);}};Acw[_0x9916('0x1a')]['stopAcw']=function(_0xed91e5){try{var _0x5e608d=this;if(_0x5e608d[_0x9916('0x7')][_0xed91e5]){_0x5e608d['timers'][_0xed91e5]['timer']=![];var _0x1ade9c=_0x5e608d[_0x9916('0x7')][_0xed91e5][_0x9916('0x33')];var _0x25052a=_0x5e608d[_0x9916('0x7')][_0xed91e5]['queue'];var _0x34b876=_0x5e608d['voiceQueues'][_0x25052a][_0x9916('0x2d')];logger['info'](_0x9916('0x3c'),_0x1ade9c,_0xed91e5);RpcUser[_0x9916('0x3d')](this[_0x9916('0x26')][_0xed91e5]);RpcVoiceAgentReport['update']({'acwtime':_0x34b876,'agentacw':!![]},_0x1ade9c,_0xed91e5)[_0x9916('0x24')](function(_0x10089c){logger[_0x9916('0x27')](_0x9916('0x34'),_0x1ade9c,_0x34b876,_0x10089c);})['catch'](function(_0x5acd7e){logger[_0x9916('0x39')](_0x9916('0x36'),_0x1ade9c,_0x5acd7e);});}else{logger[_0x9916('0x39')](_0x9916('0x3e'),_0xed91e5);if(_0x5e608d[_0x9916('0x7')]){logger[_0x9916('0x27')](_0x9916('0x3f'),JSON['stringify'](_0x5e608d[_0x9916('0x7')]));}}}catch(_0x1065ac){logger[_0x9916('0x39')](_0x9916('0x40'),_0x1065ac[_0x9916('0x3b')]);}};Acw[_0x9916('0x1a')][_0x9916('0xa')]=function(_0x28953c){try{if(this[_0x9916('0x1d')][_0x28953c[_0x9916('0x41')]]&&(this[_0x9916('0x1d')][_0x28953c[_0x9916('0x41')]]['acw']||this[_0x9916('0x1d')][_0x28953c[_0x9916('0x41')]][_0x9916('0x1f')])){if(this[_0x9916('0x26')][_0x28953c[_0x9916('0x1c')]]){this[_0x9916('0x8')][_0x28953c['uniqueid']]={'queue':_0x28953c[_0x9916('0x41')],'interface':_0x28953c[_0x9916('0x1c')],'destlinkedid':_0x28953c['destlinkedid']};}}}catch(_0x2187f2){logger[_0x9916('0x39')]('[ACW][syncAgentConnect]\x20%s',_0x2187f2[_0x9916('0x3b')]);}};Acw[_0x9916('0x1a')][_0x9916('0x16')]=function(_0x222253){try{if(this[_0x9916('0x1d')][_0x222253['queue']]&&(this[_0x9916('0x1d')][_0x222253['queue']]['acw']||this[_0x9916('0x1d')][_0x222253['queue']][_0x9916('0x1f')])){if(this['agents'][_0x222253[_0x9916('0x1c')]]){this[_0x9916('0x8')][_0x222253['uniqueid']]={'queue':_0x222253[_0x9916('0x41')],'interface':_0x222253[_0x9916('0x1c')]};}}}catch(_0x778ae5){logger['error'](_0x9916('0x42'),_0x778ae5[_0x9916('0x3b')]);}};Acw['prototype'][_0x9916('0xd')]=function(_0x291e7b){try{if(this[_0x9916('0x8')][_0x291e7b['uniqueid']]&&_[_0x9916('0x43')](this[_0x9916('0x8')][_0x291e7b[_0x9916('0x33')]][_0x9916('0x29')])){logger[_0x9916('0x27')]('[%s][HANGUP:UNIQUEID]',_0x291e7b[_0x9916('0x33')]);this[_0x9916('0x1b')](_0x291e7b['uniqueid']);}else if(this['channels'][_0x291e7b[_0x9916('0x44')]]&&_[_0x9916('0x43')](this['channels'][_0x291e7b[_0x9916('0x44')]][_0x9916('0x29')])){logger[_0x9916('0x27')](_0x9916('0x45'),_0x291e7b[_0x9916('0x44')]);this['startAcw'](_0x291e7b[_0x9916('0x44')]);}}catch(_0x1bd698){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x1bd698[_0x9916('0x3b')]);}};Acw[_0x9916('0x1a')][_0x9916('0xf')]=function(_0x547022){try{if(this[_0x9916('0x8')][_0x547022[_0x9916('0x33')]]&&this[_0x9916('0x8')][_0x547022[_0x9916('0x33')]][_0x9916('0x29')]){logger[_0x9916('0x27')](_0x9916('0x46'),_0x547022[_0x9916('0x33')]);this['startAcw'](_0x547022['uniqueid']);}else if(this['channels'][_0x547022[_0x9916('0x44')]]&&this[_0x9916('0x8')][_0x547022[_0x9916('0x44')]][_0x9916('0x29')]){logger[_0x9916('0x27')](_0x9916('0x47'),_0x547022[_0x9916('0x44')]);this[_0x9916('0x1b')](_0x547022['linkedid']);}}catch(_0x3be141){logger[_0x9916('0x39')]('[ACW][syncHangup]\x20%s',_0x3be141['message']);}};Acw[_0x9916('0x1a')]['syncAttendedTransfer']=function(_0x8b686c){try{if(!_[_0x9916('0x48')](this[_0x9916('0x8')][_0x8b686c[_0x9916('0x49')]])){this[_0x9916('0x1b')](_0x8b686c[_0x9916('0x49')]);if(this[_0x9916('0x8')][_0x8b686c[_0x9916('0x4a')]]){this['channels'][_0x8b686c[_0x9916('0x4a')]][_0x9916('0x29')]=!![];this[_0x9916('0x8')][_0x8b686c[_0x9916('0x4b')]]=this[_0x9916('0x8')][_0x8b686c[_0x9916('0x4a')]];delete this[_0x9916('0x8')][_0x8b686c['secondtransfereruniqueid']];}}else if(!_[_0x9916('0x48')](this[_0x9916('0x8')][_0x8b686c['transfertargetuniqueid']])){this[_0x9916('0x1b')](_0x8b686c['transfertargetuniqueid']);if(this[_0x9916('0x8')][_0x8b686c['origtransfereruniqueid']]){this[_0x9916('0x8')][_0x8b686c[_0x9916('0x4c')]][_0x9916('0x29')]=!![];this[_0x9916('0x8')][_0x8b686c[_0x9916('0x49')]]=this['channels'][_0x8b686c[_0x9916('0x4c')]];delete this[_0x9916('0x8')][_0x8b686c[_0x9916('0x4c')]];}}}catch(_0x482312){logger[_0x9916('0x39')]('[ACW][syncAttendedTransfer]\x20%s',_0x482312[_0x9916('0x3b')]);}};Acw[_0x9916('0x1a')][_0x9916('0x14')]=function(_0xecaff1){try{if(this[_0x9916('0x8')][_0xecaff1['transfereruniqueid']]){logger[_0x9916('0x27')](_0x9916('0x4d'),JSON[_0x9916('0x4e')](_0xecaff1[_0x9916('0x4f')]));this[_0x9916('0x1b')](_0xecaff1[_0x9916('0x4f')]);}else if(this[_0x9916('0x8')][_0xecaff1[_0x9916('0x50')]]){logger['info'](_0x9916('0x51'),JSON[_0x9916('0x4e')](_0xecaff1['transfererlinkedid']));this[_0x9916('0x1b')](_0xecaff1['transfererlinkedid']);}}catch(_0x384983){logger['error'](_0x9916('0x52'),_0x384983[_0x9916('0x3b')]);}};Acw[_0x9916('0x1a')][_0x9916('0x11')]=function(_0x5dc63e){try{if(this['voiceQueues'][_0x5dc63e['queue']]&&this['voiceQueues'][_0x5dc63e[_0x9916('0x41')]]['autopause']===_0x9916('0x53')){if(this[_0x9916('0x26')][_0x5dc63e['interface']]){logger[_0x9916('0x27')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5dc63e[_0x9916('0x33')],_0x5dc63e[_0x9916('0x1c')],_0x5dc63e[_0x9916('0x41')]);return RpcUser['savePause'](this['agents'][_0x5dc63e['interface']],_0x9916('0x54'),_0x5dc63e['uniqueid']);}}}catch(_0x9baa0b){logger['error'](_0x9916('0x55'),_0x9baa0b['message']);}};module[_0x9916('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index bab329b..5a34a17 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 _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x9e7c9a,_0x4caa88){var _0x155ae5=function(_0x5c42ef){while(--_0x5c42ef){_0x9e7c9a['push'](_0x9e7c9a['shift']());}};_0x155ae5(++_0x4caa88);}(_0x757a,0xde));var _0xa757=function(_0x56164e,_0x341dc0){_0x56164e=_0x56164e-0x0;var _0x2d6c7a=_0x757a[_0x56164e];return _0x2d6c7a;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x58c9ec,_0x207835){var _0x4c5cb8=function(_0x29e29b){while(--_0x29e29b){_0x58c9ec['push'](_0x58c9ec['shift']());}};_0x4c5cb8(++_0x207835);}(_0xb7e7,0x121));var _0x7b7e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xb7e7[_0x43d11d];return _0x38cd08;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d5eb984..3209877 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x70e0,0x17b));var _0x070e=function(_0x599426,_0x13ca9f){_0x599426=_0x599426-0x0;var _0x467e81=_0x70e0[_0x599426];return _0x467e81;};'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 +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x452c6e,_0x5d35ee){var _0x25302e=function(_0xa23bbe){while(--_0xa23bbe){_0x452c6e['push'](_0x452c6e['shift']());}};_0x25302e(++_0x5d35ee);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('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 79cbc04..5a28246 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 _0x1513=['dialCutDigit','substring','voiceQueue','getQueue','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>'];(function(_0x4dbd69,_0x48f9bb){var _0x336a56=function(_0x5b2463){while(--_0x5b2463){_0x4dbd69['push'](_0x4dbd69['shift']());}};_0x336a56(++_0x48f9bb);}(_0x1513,0x190));var _0x3151=function(_0x327de5,_0x249d2b){_0x327de5=_0x327de5-0x0;var _0x36f008=_0x1513[_0x327de5];return _0x36f008;};'use strict';var util=require(_0x3151('0x0'));var _=require(_0x3151('0x1'));var moment=require(_0x3151('0x2'));function checkNameSurname(_0x521b7c,_0x1df81e,_0x2c9599){var _0x4dab82='';if(!_[_0x3151('0x3')](_0x1df81e)&&_0x3151('0x4')===typeof _0x1df81e){_0x4dab82+=_0x1df81e;}if(!_[_0x3151('0x3')](_0x2c9599)&&_0x3151('0x4')===typeof _0x2c9599){_0x4dab82+='\x20'+_0x2c9599;}if(_0x4dab82!==''){return _0x4dab82;}return _0x521b7c;}function Action(_0x2abe3b,_0x42f51d,_0x992eda){this['voiceQueue']=_0x2abe3b;this[_0x3151('0x5')]=_0x992eda||undefined;this[_0x3151('0x6')]=checkNameSurname(_0x42f51d[_0x3151('0x7')][_0x3151('0x8')],_0x42f51d[_0x3151('0x7')]['firstName'],_0x42f51d[_0x3151('0x7')]['lastName']);this[_0x3151('0x9')]=_0x42f51d[_0x3151('0x7')][_0x3151('0x8')];this[_0x3151('0xa')]=_0x2abe3b['name'];this[_0x3151('0xb')]=_0x42f51d[_0x3151('0xb')]||![];this[_0x3151('0xc')]=_0x2abe3b[_0x3151('0xc')];this['dialQueueTimeout']=_0x2abe3b[_0x3151('0xd')]||0x3;this[_0x3151('0xe')]=_0x42f51d['scheduledat'];this[_0x3151('0xf')]=_0x42f51d[_0x3151('0xf')];this[_0x3151('0x10')]=_0x42f51d[_0x3151('0x10')];this[_0x3151('0x11')]=_0x42f51d['countnoanswerretry'];this[_0x3151('0x12')]=_0x42f51d[_0x3151('0x12')];this[_0x3151('0x13')]=_0x42f51d[_0x3151('0x13')];this['countabandonedretry']=_0x42f51d['countabandonedretry'];this[_0x3151('0x14')]=_0x42f51d['countmachineretry'];this[_0x3151('0x15')]=_0x42f51d[_0x3151('0x15')];this[_0x3151('0x16')]=_0x42f51d[_0x3151('0x16')];this[_0x3151('0x17')]=_0x42f51d['ListId'];this[_0x3151('0x18')]=_0x42f51d[_0x3151('0x18')];this[_0x3151('0x19')]=_0x42f51d['VoiceQueueId'];this[_0x3151('0x1a')]=_0x42f51d[_0x3151('0x1a')];this[_0x3151('0x1b')]=_0x42f51d['id'];this['ContactFirstName']=_0x42f51d[_0x3151('0x7')][_0x3151('0x1c')]||'';this[_0x3151('0x1d')]=moment()[_0x3151('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3151('0x1f')]=_0x42f51d[_0x3151('0x1f')];this['callbackuniqueid']=_0x42f51d[_0x3151('0x20')];this['callbackat']=_0x42f51d[_0x3151('0x21')];this[_0x3151('0x22')]=_0x42f51d['recallme'];this[_0x3151('0x23')]='';this[_0x3151('0x24')]='';}Action[_0x3151('0x25')][_0x3151('0x26')]=function(){return util[_0x3151('0x1e')](_0x3151('0x27'),this[_0x3151('0x6')],this['voiceQueue'][_0x3151('0x28')]>0x0?this[_0x3151('0x9')][_0x3151('0x29')](this[_0x3151('0x2a')]['dialCutDigit']):this[_0x3151('0x9')]);};Action[_0x3151('0x25')][_0x3151('0x2b')]=function(){return this[_0x3151('0xa')];};module['exports']=Action; \ No newline at end of file +var _0x31bf=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','name','Contact','firstName','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4323a6,_0x20a43a){var _0x36af82=function(_0x18961f){while(--_0x18961f){_0x4323a6['push'](_0x4323a6['shift']());}};_0x36af82(++_0x20a43a);}(_0x31bf,0x173));var _0xf31b=function(_0x108c11,_0x203b22){_0x108c11=_0x108c11-0x0;var _0x13c39d=_0x31bf[_0x108c11];return _0x13c39d;};'use strict';var util=require(_0xf31b('0x0'));var _=require(_0xf31b('0x1'));var moment=require(_0xf31b('0x2'));function checkNameSurname(_0x196a36,_0xcbcb71,_0x1a29ef){var _0x1f6aa6='';if(!_[_0xf31b('0x3')](_0xcbcb71)&&_0xf31b('0x4')===typeof _0xcbcb71){_0x1f6aa6+=_0xcbcb71;}if(!_[_0xf31b('0x3')](_0x1a29ef)&&_0xf31b('0x4')===typeof _0x1a29ef){_0x1f6aa6+='\x20'+_0x1a29ef;}if(_0x1f6aa6!==''){return _0x1f6aa6;}return _0x196a36;}function Action(_0x3c843f,_0x5176b2,_0x30f621){this[_0xf31b('0x5')]=_0x3c843f;this['uniqueid']=_0x30f621||undefined;this[_0xf31b('0x6')]=checkNameSurname(_0x5176b2[_0xf31b('0x7')]['phone'],_0x5176b2[_0xf31b('0x7')][_0xf31b('0x8')],_0x5176b2['Contact'][_0xf31b('0x9')]);this[_0xf31b('0xa')]=_0x5176b2[_0xf31b('0x7')][_0xf31b('0xb')];this['queue']=_0x3c843f[_0xf31b('0x6')];this[_0xf31b('0xc')]=_0x5176b2[_0xf31b('0xc')]||![];this[_0xf31b('0xd')]=_0x3c843f[_0xf31b('0xd')];this['dialQueueTimeout']=_0x3c843f[_0xf31b('0xe')]||0x3;this[_0xf31b('0xf')]=_0x5176b2[_0xf31b('0xf')];this[_0xf31b('0x10')]=_0x5176b2[_0xf31b('0x10')];this['countcongestionretry']=_0x5176b2[_0xf31b('0x11')];this[_0xf31b('0x12')]=_0x5176b2[_0xf31b('0x12')];this[_0xf31b('0x13')]=_0x5176b2[_0xf31b('0x13')];this[_0xf31b('0x14')]=_0x5176b2[_0xf31b('0x14')];this[_0xf31b('0x15')]=_0x5176b2[_0xf31b('0x15')];this[_0xf31b('0x16')]=_0x5176b2[_0xf31b('0x16')];this[_0xf31b('0x17')]=_0x5176b2[_0xf31b('0x17')];this[_0xf31b('0x18')]=_0x5176b2[_0xf31b('0x18')];this[_0xf31b('0x19')]=_0x5176b2[_0xf31b('0x19')];this['UserId']=_0x5176b2[_0xf31b('0x1a')];this[_0xf31b('0x1b')]=_0x5176b2['VoiceQueueId'];this[_0xf31b('0x1c')]=_0x5176b2[_0xf31b('0x1c')];this[_0xf31b('0x1d')]=_0x5176b2['id'];this[_0xf31b('0x1e')]=_0x5176b2['Contact']['firstName']||'';this[_0xf31b('0x1f')]=moment()[_0xf31b('0x20')](_0xf31b('0x21'));this[_0xf31b('0x22')]=_0x5176b2['callback'];this[_0xf31b('0x23')]=_0x5176b2[_0xf31b('0x23')];this[_0xf31b('0x24')]=_0x5176b2['callbackat'];this[_0xf31b('0x25')]=_0x5176b2[_0xf31b('0x25')];this[_0xf31b('0x26')]='';this['originatecalleridname']='';}Action[_0xf31b('0x27')][_0xf31b('0x28')]=function(){return util[_0xf31b('0x20')](_0xf31b('0x29'),this[_0xf31b('0x6')],this[_0xf31b('0x5')][_0xf31b('0x2a')]>0x0?this[_0xf31b('0xa')][_0xf31b('0x2b')](this['voiceQueue'][_0xf31b('0x2a')]):this['number']);};Action[_0xf31b('0x27')][_0xf31b('0x2c')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 8db11b5..e0e02b5 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 _0xc3a9=['originatecalleridname','util','lodash','moment','milliseconds','diff','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0xc3a9,0xf7));var _0x9c3a=function(_0x1b6e91,_0x2e2367){_0x1b6e91=_0x1b6e91-0x0;var _0x2e395c=_0xc3a9[_0x1b6e91];return _0x2e395c;};'use strict';var util=require(_0x9c3a('0x0'));var _=require(_0x9c3a('0x1'));var moment=require(_0x9c3a('0x2'));function getSeconds(_0x277ca5,_0x3cd535){var _0x41efd6=moment(_0x277ca5)[_0x9c3a('0x3')](0x0);var _0x15be2a=moment(_0x3cd535)[_0x9c3a('0x3')](0x0);return _0x41efd6[_0x9c3a('0x4')](_0x15be2a,'seconds');}function AgentComplete(_0x392297,_0x44a28e){this['state']=0x4;this[_0x9c3a('0x5')]='Answer';this[_0x9c3a('0x6')]=_0x392297[_0x9c3a('0x6')];this[_0x9c3a('0x7')]=_0x392297[_0x9c3a('0x7')];this[_0x9c3a('0x8')]=_0x392297[_0x9c3a('0x7')]===_0x9c3a('0x9')?_0x9c3a('0xa'):_0x392297[_0x9c3a('0x7')];this[_0x9c3a('0xb')]=_0x392297[_0x9c3a('0xb')];this['countcongestionretry']=_0x392297[_0x9c3a('0xc')];this['countnoanswerretry']=_0x392297['countnoanswerretry'];this['countglobal']=_0x392297['countbusyretry']+_0x392297['countcongestionretry']+_0x392297[_0x9c3a('0xd')]+_0x392297[_0x9c3a('0xe')]+_0x392297['countdropretry']+_0x392297[_0x9c3a('0xf')]+_0x392297[_0x9c3a('0x10')]+_0x392297[_0x9c3a('0x11')];this[_0x9c3a('0xe')]=_0x392297['countnosuchnumberretry'];this[_0x9c3a('0x12')]=_0x392297['countdropretry'];this[_0x9c3a('0xf')]=_0x392297[_0x9c3a('0xf')];this[_0x9c3a('0x10')]=_0x392297[_0x9c3a('0x10')];this['countagentrejectretry']=_0x392297[_0x9c3a('0x11')];this[_0x9c3a('0x13')]=_0x44a28e[_0x9c3a('0x13')];this[_0x9c3a('0x14')]=_0x392297['name'];this[_0x9c3a('0x15')]=_0x392297['number'];this[_0x9c3a('0x16')]=_0x392297[_0x9c3a('0x16')];this['responsetime']=_0x392297[_0x9c3a('0x17')];this[_0x9c3a('0x18')]=_0x392297[_0x9c3a('0x18')];this[_0x9c3a('0x19')]=moment()['format'](_0x9c3a('0x1a'));this[_0x9c3a('0x1b')]=getSeconds(_0x392297[_0x9c3a('0x17')],_0x392297[_0x9c3a('0x16')]);this[_0x9c3a('0x1c')]=getSeconds(_0x392297[_0x9c3a('0x18')],_0x392297[_0x9c3a('0x17')]);this['talktime']=getSeconds(this['endtime'],_0x392297['answertime']);this[_0x9c3a('0xa')]=_0x44a28e['queue'];this[_0x9c3a('0x1d')]=_0x44a28e[_0x9c3a('0x1d')];this[_0x9c3a('0x1e')]=_0x44a28e[_0x9c3a('0x1e')];this[_0x9c3a('0x1f')]=_0x392297[_0x9c3a('0x1f')];this['callbackuniqueid']=_0x392297[_0x9c3a('0x20')];this[_0x9c3a('0x21')]=_0x392297[_0x9c3a('0x21')];this['recallme']=_0x392297['recallme'];this[_0x9c3a('0x22')]=_0x392297[_0x9c3a('0x22')];this[_0x9c3a('0x23')]=_0x392297[_0x9c3a('0x23')];this[_0x9c3a('0x24')]=_0x392297[_0x9c3a('0x24')];this[_0x9c3a('0x25')]=_0x392297[_0x9c3a('0x25')];this[_0x9c3a('0x26')]=_0x392297['CampaignId'];this[_0x9c3a('0x27')]=_0x392297[_0x9c3a('0x27')]||'';this[_0x9c3a('0x28')]=_0x392297[_0x9c3a('0x28')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xf432=['starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number'];(function(_0x187ae4,_0x3e21a1){var _0x8690e0=function(_0x5c25f1){while(--_0x5c25f1){_0x187ae4['push'](_0x187ae4['shift']());}};_0x8690e0(++_0x3e21a1);}(_0xf432,0x97));var _0x2f43=function(_0x49282b,_0x4e2125){_0x49282b=_0x49282b-0x0;var _0xcb542e=_0xf432[_0x49282b];return _0xcb542e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2f43('0x0'));function getSeconds(_0x1d870f,_0x407fa5){var _0x28b424=moment(_0x1d870f)['milliseconds'](0x0);var _0x33c386=moment(_0x407fa5)['milliseconds'](0x0);return _0x28b424[_0x2f43('0x1')](_0x33c386,_0x2f43('0x2'));}function AgentComplete(_0x5d32e6,_0x312853){this[_0x2f43('0x3')]=0x4;this[_0x2f43('0x4')]='Answer';this[_0x2f43('0x5')]=_0x5d32e6['scheduledat'];this['type']=_0x5d32e6[_0x2f43('0x6')];this[_0x2f43('0x7')]=_0x5d32e6[_0x2f43('0x6')]===_0x2f43('0x8')?'queue':_0x5d32e6[_0x2f43('0x6')];this[_0x2f43('0x9')]=_0x5d32e6[_0x2f43('0x9')];this[_0x2f43('0xa')]=_0x5d32e6['countcongestionretry'];this[_0x2f43('0xb')]=_0x5d32e6[_0x2f43('0xb')];this['countglobal']=_0x5d32e6[_0x2f43('0x9')]+_0x5d32e6[_0x2f43('0xa')]+_0x5d32e6[_0x2f43('0xb')]+_0x5d32e6['countnosuchnumberretry']+_0x5d32e6[_0x2f43('0xc')]+_0x5d32e6[_0x2f43('0xd')]+_0x5d32e6['countmachineretry']+_0x5d32e6['countagentrejectretry'];this[_0x2f43('0xe')]=_0x5d32e6[_0x2f43('0xe')];this[_0x2f43('0xc')]=_0x5d32e6['countdropretry'];this[_0x2f43('0xd')]=_0x5d32e6[_0x2f43('0xd')];this[_0x2f43('0xf')]=_0x5d32e6['countmachineretry'];this[_0x2f43('0x10')]=_0x5d32e6['countagentrejectretry'];this[_0x2f43('0x11')]=_0x312853[_0x2f43('0x11')];this[_0x2f43('0x12')]=_0x5d32e6['name'];this[_0x2f43('0x13')]=_0x5d32e6[_0x2f43('0x14')];this['starttime']=_0x5d32e6[_0x2f43('0x15')];this[_0x2f43('0x16')]=_0x5d32e6[_0x2f43('0x16')];this[_0x2f43('0x17')]=_0x5d32e6[_0x2f43('0x17')];this[_0x2f43('0x18')]=moment()['format'](_0x2f43('0x19'));this[_0x2f43('0x1a')]=getSeconds(_0x5d32e6['responsetime'],_0x5d32e6[_0x2f43('0x15')]);this[_0x2f43('0x1b')]=getSeconds(_0x5d32e6[_0x2f43('0x17')],_0x5d32e6[_0x2f43('0x16')]);this[_0x2f43('0x1c')]=getSeconds(this['endtime'],_0x5d32e6['answertime']);this[_0x2f43('0x1d')]=_0x312853[_0x2f43('0x1d')];this['membername']=_0x312853[_0x2f43('0x1e')];this[_0x2f43('0x1f')]=_0x312853[_0x2f43('0x1f')];this[_0x2f43('0x20')]=_0x5d32e6[_0x2f43('0x20')];this[_0x2f43('0x21')]=_0x5d32e6[_0x2f43('0x21')];this[_0x2f43('0x22')]=_0x5d32e6[_0x2f43('0x22')];this[_0x2f43('0x23')]=_0x5d32e6[_0x2f43('0x23')];this[_0x2f43('0x24')]=_0x5d32e6[_0x2f43('0x24')];this['ListId']=_0x5d32e6[_0x2f43('0x25')];this[_0x2f43('0x26')]=_0x5d32e6[_0x2f43('0x26')];this['VoiceQueueId']=_0x5d32e6[_0x2f43('0x27')];this[_0x2f43('0x28')]=_0x5d32e6['CampaignId'];this[_0x2f43('0x29')]=_0x5d32e6['originatecalleridnum']||'';this['originatecalleridname']=_0x5d32e6[_0x2f43('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index c75c276..5cf4294 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 _0xb138=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackat'];(function(_0x4aaaa1,_0x5734d2){var _0x20c50b=function(_0x4568cd){while(--_0x4568cd){_0x4aaaa1['push'](_0x4aaaa1['shift']());}};_0x20c50b(++_0x5734d2);}(_0xb138,0x1dd));var _0x8b13=function(_0x28a338,_0x69a8eb){_0x28a338=_0x28a338-0x0;var _0x17453f=_0xb138[_0x28a338];return _0x17453f;};'use strict';var util=require(_0x8b13('0x0'));var _=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));function getSeconds(_0x33f214,_0xadad70){var _0x185752=moment(_0x33f214)[_0x8b13('0x3')](0x0);var _0x5369d4=moment(_0xadad70)[_0x8b13('0x3')](0x0);return _0x185752[_0x8b13('0x4')](_0x5369d4,_0x8b13('0x5'));}function Final(_0x5ae5b2){this[_0x8b13('0x6')]=_0x5ae5b2[_0x8b13('0x6')];this['scheduledat']=_0x5ae5b2[_0x8b13('0x7')];this[_0x8b13('0x8')]=_0x5ae5b2[_0x8b13('0x8')];this['campaigntype']=_0x5ae5b2[_0x8b13('0x8')]===_0x8b13('0x9')?'queue':_0x5ae5b2['type'];this[_0x8b13('0xa')]=_0x5ae5b2[_0x8b13('0xa')];this[_0x8b13('0xb')]=_0x5ae5b2[_0x8b13('0xb')];this[_0x8b13('0xc')]=_0x5ae5b2['countnoanswerretry'];this[_0x8b13('0xd')]=_0x5ae5b2[_0x8b13('0xa')]+_0x5ae5b2[_0x8b13('0xb')]+_0x5ae5b2[_0x8b13('0xc')]+_0x5ae5b2[_0x8b13('0xe')]+_0x5ae5b2[_0x8b13('0xf')]+_0x5ae5b2['countabandonedretry']+_0x5ae5b2['countmachineretry']+_0x5ae5b2[_0x8b13('0x10')];this[_0x8b13('0xe')]=_0x5ae5b2['countnosuchnumberretry'];this['countdropretry']=_0x5ae5b2['countdropretry'];this[_0x8b13('0x11')]=_0x5ae5b2[_0x8b13('0x11')];this[_0x8b13('0x12')]=_0x5ae5b2[_0x8b13('0x12')];this[_0x8b13('0x10')]=_0x5ae5b2['countagentrejectretry'];this[_0x8b13('0x13')]=_0x5ae5b2[_0x8b13('0x13')];this[_0x8b13('0x14')]=_0x5ae5b2[_0x8b13('0x14')];this[_0x8b13('0x15')]=_0x5ae5b2[_0x8b13('0x15')];this[_0x8b13('0x16')]=_0x5ae5b2[_0x8b13('0x16')];this['responsetime']=_0x5ae5b2['responsetime'];this[_0x8b13('0x17')]=_0x5ae5b2[_0x8b13('0x18')];this[_0x8b13('0x19')]=_0x5ae5b2[_0x8b13('0x19')]||0x0;this[_0x8b13('0x1a')]=_0x5ae5b2[_0x8b13('0x1a')]||0x0;this['talktime']=_0x5ae5b2[_0x8b13('0x1b')]||0x0;this[_0x8b13('0x1c')]=_0x5ae5b2[_0x8b13('0x1c')];this['callbackuniqueid']=_0x5ae5b2['callbackuniqueid'];this[_0x8b13('0x1d')]=_0x5ae5b2[_0x8b13('0x1d')];this['recallme']=_0x5ae5b2[_0x8b13('0x1e')];this[_0x8b13('0x1f')]=_0x5ae5b2[_0x8b13('0x1f')];this[_0x8b13('0x20')]=_0x5ae5b2[_0x8b13('0x20')];this['UserId']=_0x5ae5b2[_0x8b13('0x21')];this[_0x8b13('0x22')]=_0x5ae5b2['VoiceQueueId'];this[_0x8b13('0x23')]=_0x5ae5b2['CampaignId'];this[_0x8b13('0x24')]=_0x5ae5b2[_0x8b13('0x24')]||'';this['originatecalleridname']=_0x5ae5b2[_0x8b13('0x25')]||'';}module[_0x8b13('0x26')]=Final; \ No newline at end of file +var _0xb647=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype'];(function(_0x2dc45a,_0x58f50c){var _0x3eff50=function(_0xb2795c){while(--_0xb2795c){_0x2dc45a['push'](_0x2dc45a['shift']());}};_0x3eff50(++_0x58f50c);}(_0xb647,0xdb));var _0x7b64=function(_0x43bbde,_0x564524){_0x43bbde=_0x43bbde-0x0;var _0x3d0a3a=_0xb647[_0x43bbde];return _0x3d0a3a;};'use strict';var util=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));var moment=require(_0x7b64('0x2'));function getSeconds(_0x248af6,_0x38de52){var _0x3b659e=moment(_0x248af6)[_0x7b64('0x3')](0x0);var _0x2b0ff5=moment(_0x38de52)['milliseconds'](0x0);return _0x3b659e[_0x7b64('0x4')](_0x2b0ff5,'seconds');}function Final(_0x1daa28){this[_0x7b64('0x5')]=_0x1daa28[_0x7b64('0x5')];this[_0x7b64('0x6')]=_0x1daa28[_0x7b64('0x6')];this[_0x7b64('0x7')]=_0x1daa28[_0x7b64('0x7')];this[_0x7b64('0x8')]=_0x1daa28[_0x7b64('0x7')]==='outbound'?_0x7b64('0x9'):_0x1daa28['type'];this[_0x7b64('0xa')]=_0x1daa28['countbusyretry'];this['countcongestionretry']=_0x1daa28[_0x7b64('0xb')];this[_0x7b64('0xc')]=_0x1daa28['countnoanswerretry'];this[_0x7b64('0xd')]=_0x1daa28[_0x7b64('0xa')]+_0x1daa28[_0x7b64('0xb')]+_0x1daa28[_0x7b64('0xc')]+_0x1daa28[_0x7b64('0xe')]+_0x1daa28[_0x7b64('0xf')]+_0x1daa28[_0x7b64('0x10')]+_0x1daa28['countmachineretry']+_0x1daa28[_0x7b64('0x11')];this['countnosuchnumberretry']=_0x1daa28['countnosuchnumberretry'];this[_0x7b64('0xf')]=_0x1daa28[_0x7b64('0xf')];this[_0x7b64('0x10')]=_0x1daa28[_0x7b64('0x10')];this[_0x7b64('0x12')]=_0x1daa28[_0x7b64('0x12')];this[_0x7b64('0x11')]=_0x1daa28['countagentrejectretry'];this[_0x7b64('0x9')]=_0x1daa28[_0x7b64('0x9')];this[_0x7b64('0x13')]=_0x1daa28[_0x7b64('0x13')];this[_0x7b64('0x14')]=_0x1daa28['calleridnum'];this[_0x7b64('0x15')]=_0x1daa28[_0x7b64('0x15')];this['responsetime']=_0x1daa28[_0x7b64('0x16')];this[_0x7b64('0x17')]=_0x1daa28['responsetime'];this[_0x7b64('0x18')]=_0x1daa28[_0x7b64('0x18')]||0x0;this[_0x7b64('0x19')]=_0x1daa28[_0x7b64('0x19')]||0x0;this['talktime']=_0x1daa28[_0x7b64('0x1a')]||0x0;this[_0x7b64('0x1b')]=_0x1daa28['callback'];this[_0x7b64('0x1c')]=_0x1daa28['callbackuniqueid'];this[_0x7b64('0x1d')]=_0x1daa28['callbackat'];this[_0x7b64('0x1e')]=_0x1daa28[_0x7b64('0x1e')];this[_0x7b64('0x1f')]=_0x1daa28[_0x7b64('0x1f')];this[_0x7b64('0x20')]=_0x1daa28[_0x7b64('0x20')];this[_0x7b64('0x21')]=_0x1daa28[_0x7b64('0x21')];this[_0x7b64('0x22')]=_0x1daa28[_0x7b64('0x22')];this[_0x7b64('0x23')]=_0x1daa28[_0x7b64('0x23')];this[_0x7b64('0x24')]=_0x1daa28[_0x7b64('0x24')]||'';this['originatecalleridname']=_0x1daa28[_0x7b64('0x25')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 6e07832..7bd83e9 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 _0xf861=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid'];(function(_0x355110,_0x5aacd0){var _0x319c53=function(_0xa95b6f){while(--_0xa95b6f){_0x355110['push'](_0x355110['shift']());}};_0x319c53(++_0x5aacd0);}(_0xf861,0xb0));var _0x1f86=function(_0x2e7024,_0x5f57c8){_0x2e7024=_0x2e7024-0x0;var _0x4a354f=_0xf861[_0x2e7024];return _0x4a354f;};'use strict';var util=require('util');var _=require(_0x1f86('0x0'));var moment=require(_0x1f86('0x1'));function getSeconds(_0x2717cc,_0x876a0a){var _0x1430ff=moment(_0x2717cc)[_0x1f86('0x2')](0x0);var _0x1044cc=moment(_0x876a0a)[_0x1f86('0x2')](0x0);return _0x1430ff[_0x1f86('0x3')](_0x1044cc,_0x1f86('0x4'));}function Hangup(_0x5338f6,_0x5ecbb4){this[_0x1f86('0x5')]=0x4;this[_0x1f86('0x6')]=_0x1f86('0x7');this[_0x1f86('0x8')]=_0x5338f6[_0x1f86('0x8')];this['type']=_0x5338f6[_0x1f86('0x9')];this[_0x1f86('0xa')]=_0x5338f6[_0x1f86('0x9')]===_0x1f86('0xb')?_0x1f86('0xc'):_0x5338f6[_0x1f86('0x9')];this['countbusyretry']=_0x5338f6['countbusyretry'];this[_0x1f86('0xd')]=_0x5338f6[_0x1f86('0xd')];this['countnoanswerretry']=_0x5338f6['countnoanswerretry'];this['countglobal']=_0x5338f6['countbusyretry']+_0x5338f6[_0x1f86('0xd')]+_0x5338f6['countnoanswerretry']+_0x5338f6[_0x1f86('0xe')]+_0x5338f6['countdropretry']+_0x5338f6[_0x1f86('0xf')]+_0x5338f6[_0x1f86('0x10')]+_0x5338f6[_0x1f86('0x11')];this[_0x1f86('0xe')]=_0x5338f6[_0x1f86('0xe')];this[_0x1f86('0x12')]=_0x5338f6['countdropretry'];this['countabandonedretry']=_0x5338f6[_0x1f86('0xf')];this[_0x1f86('0x10')]=_0x5338f6[_0x1f86('0x10')];this[_0x1f86('0x11')]=_0x5338f6[_0x1f86('0x11')];this[_0x1f86('0x13')]=_0x5ecbb4[_0x1f86('0x13')];this[_0x1f86('0x14')]=_0x5338f6[_0x1f86('0x15')];this[_0x1f86('0x16')]=_0x5338f6['number'];this[_0x1f86('0x17')]=_0x5338f6[_0x1f86('0x17')];this[_0x1f86('0x18')]=_0x5338f6[_0x1f86('0x18')];this[_0x1f86('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1f86('0x1a')]=getSeconds(_0x5338f6['responsetime'],_0x5338f6[_0x1f86('0x17')]);this[_0x1f86('0x1b')]=0x0;this[_0x1f86('0x1c')]=getSeconds(this[_0x1f86('0x19')],_0x5338f6['responsetime']);this['queue']=_0x5338f6[_0x1f86('0xc')];this[_0x1f86('0x1d')]=_0x1f86('0x1e');this['reason']=_0x5ecbb4[_0x1f86('0x1f')];this[_0x1f86('0x20')]=_0x5338f6[_0x1f86('0x20')];this[_0x1f86('0x21')]=_0x5338f6['callbackuniqueid'];this[_0x1f86('0x22')]=_0x5338f6[_0x1f86('0x22')];this[_0x1f86('0x23')]=_0x5338f6[_0x1f86('0x23')];this[_0x1f86('0x24')]=_0x5338f6[_0x1f86('0x24')];this[_0x1f86('0x25')]=_0x5338f6[_0x1f86('0x25')];this[_0x1f86('0x26')]=_0x5338f6[_0x1f86('0x26')];this[_0x1f86('0x27')]=_0x5338f6[_0x1f86('0x27')];this[_0x1f86('0x28')]=_0x5338f6[_0x1f86('0x28')];}module[_0x1f86('0x29')]=Hangup; \ No newline at end of file +var _0x109b=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x563515,_0x1a8b09){var _0x1940bc=function(_0x1e1fa4){while(--_0x1e1fa4){_0x563515['push'](_0x563515['shift']());}};_0x1940bc(++_0x1a8b09);}(_0x109b,0x14a));var _0xb109=function(_0x36b029,_0x31d3fa){_0x36b029=_0x36b029-0x0;var _0x26b1df=_0x109b[_0x36b029];return _0x26b1df;};'use strict';var util=require(_0xb109('0x0'));var _=require(_0xb109('0x1'));var moment=require('moment');function getSeconds(_0x45144d,_0x58d2c1){var _0x4fd31a=moment(_0x45144d)['milliseconds'](0x0);var _0x77752e=moment(_0x58d2c1)['milliseconds'](0x0);return _0x4fd31a[_0xb109('0x2')](_0x77752e,_0xb109('0x3'));}function Hangup(_0x2dc153,_0x183683){this['state']=0x4;this[_0xb109('0x4')]=_0xb109('0x5');this[_0xb109('0x6')]=_0x2dc153[_0xb109('0x6')];this[_0xb109('0x7')]=_0x2dc153['type'];this[_0xb109('0x8')]=_0x2dc153[_0xb109('0x7')]===_0xb109('0x9')?_0xb109('0xa'):_0x2dc153[_0xb109('0x7')];this['countbusyretry']=_0x2dc153[_0xb109('0xb')];this[_0xb109('0xc')]=_0x2dc153[_0xb109('0xc')];this[_0xb109('0xd')]=_0x2dc153[_0xb109('0xd')];this['countglobal']=_0x2dc153[_0xb109('0xb')]+_0x2dc153['countcongestionretry']+_0x2dc153['countnoanswerretry']+_0x2dc153[_0xb109('0xe')]+_0x2dc153[_0xb109('0xf')]+_0x2dc153[_0xb109('0x10')]+_0x2dc153['countmachineretry']+_0x2dc153[_0xb109('0x11')];this[_0xb109('0xe')]=_0x2dc153[_0xb109('0xe')];this[_0xb109('0xf')]=_0x2dc153[_0xb109('0xf')];this[_0xb109('0x10')]=_0x2dc153[_0xb109('0x10')];this[_0xb109('0x12')]=_0x2dc153['countmachineretry'];this[_0xb109('0x11')]=_0x2dc153[_0xb109('0x11')];this[_0xb109('0x13')]=_0x183683['uniqueid'];this[_0xb109('0x14')]=_0x2dc153[_0xb109('0x15')];this[_0xb109('0x16')]=_0x2dc153[_0xb109('0x17')];this['starttime']=_0x2dc153[_0xb109('0x18')];this[_0xb109('0x19')]=_0x2dc153[_0xb109('0x19')];this[_0xb109('0x1a')]=moment()[_0xb109('0x1b')](_0xb109('0x1c'));this[_0xb109('0x1d')]=getSeconds(_0x2dc153[_0xb109('0x19')],_0x2dc153[_0xb109('0x18')]);this[_0xb109('0x1e')]=0x0;this['talktime']=getSeconds(this[_0xb109('0x1a')],_0x2dc153[_0xb109('0x19')]);this['queue']=_0x2dc153[_0xb109('0xa')];this[_0xb109('0x1f')]='IVR';this['reason']=_0x183683[_0xb109('0x20')];this['callback']=_0x2dc153[_0xb109('0x21')];this[_0xb109('0x22')]=_0x2dc153['callbackuniqueid'];this[_0xb109('0x23')]=_0x2dc153['callbackat'];this[_0xb109('0x24')]=_0x2dc153[_0xb109('0x24')];this[_0xb109('0x25')]=_0x2dc153['ContactId'];this[_0xb109('0x26')]=_0x2dc153[_0xb109('0x26')];this[_0xb109('0x27')]=_0x2dc153[_0xb109('0x27')];this['VoiceQueueId']=_0x2dc153[_0xb109('0x28')];this[_0xb109('0x29')]=_0x2dc153[_0xb109('0x29')];}module[_0xb109('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index c35b40e..9d42ddf 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 _0xf9eb=['queue','calleridname','name','number','responsetime','endtime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xf9eb,0x144));var _0xbf9e=function(_0x59b969,_0x59b1a8){_0x59b969=_0x59b969-0x0;var _0x2b2f54=_0xf9eb[_0x59b969];return _0x2b2f54;};'use strict';var util=require(_0xbf9e('0x0'));var _=require(_0xbf9e('0x1'));var moment=require('moment');function getSeconds(_0x4caa3f,_0x528e4b){var _0x14ac63=moment(_0x4caa3f)[_0xbf9e('0x2')](0x0);var _0x105d01=moment(_0x528e4b)[_0xbf9e('0x2')](0x0);return _0x14ac63[_0xbf9e('0x3')](_0x105d01,'seconds');}function History(_0x5d0dc4){this[_0xbf9e('0x4')]=_0x5d0dc4['uniqueid'];this[_0xbf9e('0x5')]=_0x5d0dc4[_0xbf9e('0x5')]||undefined;this[_0xbf9e('0x6')]=_0x5d0dc4[_0xbf9e('0x6')];this[_0xbf9e('0x7')]=_0x5d0dc4[_0xbf9e('0x6')]===_0xbf9e('0x8')?'queue':_0x5d0dc4[_0xbf9e('0x6')];this[_0xbf9e('0x9')]=_0x5d0dc4['countbusyretry'];this[_0xbf9e('0xa')]=_0x5d0dc4[_0xbf9e('0xa')];this['countnoanswerretry']=_0x5d0dc4[_0xbf9e('0xb')];this[_0xbf9e('0xc')]=_0x5d0dc4[_0xbf9e('0x9')]+_0x5d0dc4[_0xbf9e('0xa')]+_0x5d0dc4[_0xbf9e('0xb')]+_0x5d0dc4[_0xbf9e('0xd')]+_0x5d0dc4[_0xbf9e('0xe')]+_0x5d0dc4[_0xbf9e('0xf')]+_0x5d0dc4['countmachineretry']+_0x5d0dc4[_0xbf9e('0x10')];this[_0xbf9e('0xd')]=_0x5d0dc4[_0xbf9e('0xd')];this[_0xbf9e('0xe')]=_0x5d0dc4[_0xbf9e('0xe')];this[_0xbf9e('0xf')]=_0x5d0dc4[_0xbf9e('0xf')];this['countmachineretry']=_0x5d0dc4[_0xbf9e('0x11')];this[_0xbf9e('0x10')]=_0x5d0dc4[_0xbf9e('0x10')];this[_0xbf9e('0x12')]=_0x5d0dc4['queue'];this[_0xbf9e('0x13')]=_0x5d0dc4[_0xbf9e('0x14')];this['calleridnum']=_0x5d0dc4[_0xbf9e('0x15')];this['starttime']=_0x5d0dc4['starttime'];this[_0xbf9e('0x16')]=_0x5d0dc4[_0xbf9e('0x16')];this[_0xbf9e('0x17')]=_0x5d0dc4[_0xbf9e('0x16')];this[_0xbf9e('0x18')]=getSeconds(_0x5d0dc4['responsetime'],_0x5d0dc4[_0xbf9e('0x19')]);this[_0xbf9e('0x1a')]=0x0;this[_0xbf9e('0x1b')]=0x0;this['callback']=_0x5d0dc4[_0xbf9e('0x1c')];this[_0xbf9e('0x1d')]=_0x5d0dc4[_0xbf9e('0x1d')];this[_0xbf9e('0x1e')]=_0x5d0dc4[_0xbf9e('0x1e')];this[_0xbf9e('0x1f')]=_0x5d0dc4[_0xbf9e('0x1f')];this['ContactId']=_0x5d0dc4[_0xbf9e('0x20')];this[_0xbf9e('0x21')]=_0x5d0dc4[_0xbf9e('0x21')];this['UserId']=_0x5d0dc4[_0xbf9e('0x22')];this['VoiceQueueId']=_0x5d0dc4[_0xbf9e('0x23')];this[_0xbf9e('0x24')]=_0x5d0dc4[_0xbf9e('0x24')];this['originatecalleridnum']=_0x5d0dc4['originatecalleridnum']||'';this[_0xbf9e('0x25')]=_0x5d0dc4[_0xbf9e('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0xd575=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds'];(function(_0x582656,_0x41a7d0){var _0x211ffb=function(_0x5667da){while(--_0x5667da){_0x582656['push'](_0x582656['shift']());}};_0x211ffb(++_0x41a7d0);}(_0xd575,0x162));var _0x5d57=function(_0x8ce99,_0xe40fa0){_0x8ce99=_0x8ce99-0x0;var _0x186ca7=_0xd575[_0x8ce99];return _0x186ca7;};'use strict';var util=require(_0x5d57('0x0'));var _=require(_0x5d57('0x1'));var moment=require(_0x5d57('0x2'));function getSeconds(_0x394e7d,_0x524a3c){var _0x3fccbb=moment(_0x394e7d)[_0x5d57('0x3')](0x0);var _0x7b417a=moment(_0x524a3c)[_0x5d57('0x3')](0x0);return _0x3fccbb[_0x5d57('0x4')](_0x7b417a,_0x5d57('0x5'));}function History(_0x17e9b0){this[_0x5d57('0x6')]=_0x17e9b0[_0x5d57('0x6')];this[_0x5d57('0x7')]=_0x17e9b0[_0x5d57('0x7')]||undefined;this[_0x5d57('0x8')]=_0x17e9b0[_0x5d57('0x8')];this[_0x5d57('0x9')]=_0x17e9b0[_0x5d57('0x8')]===_0x5d57('0xa')?_0x5d57('0xb'):_0x17e9b0[_0x5d57('0x8')];this[_0x5d57('0xc')]=_0x17e9b0[_0x5d57('0xc')];this[_0x5d57('0xd')]=_0x17e9b0[_0x5d57('0xd')];this[_0x5d57('0xe')]=_0x17e9b0['countnoanswerretry'];this[_0x5d57('0xf')]=_0x17e9b0[_0x5d57('0xc')]+_0x17e9b0[_0x5d57('0xd')]+_0x17e9b0[_0x5d57('0xe')]+_0x17e9b0[_0x5d57('0x10')]+_0x17e9b0[_0x5d57('0x11')]+_0x17e9b0[_0x5d57('0x12')]+_0x17e9b0[_0x5d57('0x13')]+_0x17e9b0['countagentrejectretry'];this[_0x5d57('0x10')]=_0x17e9b0[_0x5d57('0x10')];this[_0x5d57('0x11')]=_0x17e9b0[_0x5d57('0x11')];this[_0x5d57('0x12')]=_0x17e9b0[_0x5d57('0x12')];this[_0x5d57('0x13')]=_0x17e9b0[_0x5d57('0x13')];this[_0x5d57('0x14')]=_0x17e9b0[_0x5d57('0x14')];this[_0x5d57('0xb')]=_0x17e9b0[_0x5d57('0xb')];this[_0x5d57('0x15')]=_0x17e9b0['name'];this[_0x5d57('0x16')]=_0x17e9b0[_0x5d57('0x17')];this[_0x5d57('0x18')]=_0x17e9b0[_0x5d57('0x18')];this['responsetime']=_0x17e9b0[_0x5d57('0x19')];this[_0x5d57('0x1a')]=_0x17e9b0[_0x5d57('0x19')];this['ringtime']=getSeconds(_0x17e9b0[_0x5d57('0x19')],_0x17e9b0['starttime']);this['holdtime']=0x0;this[_0x5d57('0x1b')]=0x0;this[_0x5d57('0x1c')]=_0x17e9b0[_0x5d57('0x1c')];this[_0x5d57('0x1d')]=_0x17e9b0['callbackuniqueid'];this[_0x5d57('0x1e')]=_0x17e9b0['callbackat'];this[_0x5d57('0x1f')]=_0x17e9b0[_0x5d57('0x1f')];this[_0x5d57('0x20')]=_0x17e9b0[_0x5d57('0x20')];this[_0x5d57('0x21')]=_0x17e9b0[_0x5d57('0x21')];this[_0x5d57('0x22')]=_0x17e9b0[_0x5d57('0x22')];this[_0x5d57('0x23')]=_0x17e9b0[_0x5d57('0x23')];this[_0x5d57('0x24')]=_0x17e9b0[_0x5d57('0x24')];this[_0x5d57('0x25')]=_0x17e9b0[_0x5d57('0x25')]||'';this['originatecalleridname']=_0x17e9b0[_0x5d57('0x26')]||'';}module[_0x5d57('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 664e962..db9563f 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 _0xb700=['dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','finally','originate\x20action\x20Error','getQueue','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[rescheduleContact][Machine]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','averageHandleTime','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','dialPredictiveOptimizationPercentage','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','getVoiceQueueRtPauses','outboundQueuePauses','abandonmentRate','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','Contact.phone','loggerHandler','[getContactDialer2]','[handlePredictive][limitChannel]','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','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----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','moment','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','originateresponse','syncOriginateResponse','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','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\x20Timeout:\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','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','saveInDb','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','status','reachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countglobal','emit','custom:amd','buildObj','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncAgentComplete][createHistory][0]','countcongestionretry','countabandonedretry','dialMachineMaxRetry','add','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','Drop','dropreason','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','CALLEREXIT','dialAbandonedMaxRetry','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','queueBooked','push','pick','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','true','command','content','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','progressive','handlePower','power','predictive','Queue','method\x20not\x20recognized','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','dialPreviewRecallmeReminder','checkPreviewRecallReminder','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','callerid'];(function(_0x2054d3,_0x17ebce){var _0x11f869=function(_0x4d4231){while(--_0x4d4231){_0x2054d3['push'](_0x2054d3['shift']());}};_0x11f869(++_0x17ebce);}(_0xb700,0x97));var _0x0b70=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xb700[_0x5b27da];return _0x3254f4;};'use strict';var util=require(_0x0b70('0x0'));var _=require(_0x0b70('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x0b70('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x0b70('0x3'));var config=require(_0x0b70('0x4'));var logger=require(_0x0b70('0x5'))(_0x0b70('0x6'));var loggerBooked=require(_0x0b70('0x5'))(_0x0b70('0x7'));var loggerPredictive=require(_0x0b70('0x5'))('predictive');var loggerPredictiveCalls=require(_0x0b70('0x5'))(_0x0b70('0x8'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x0b70('0x9'));config[_0x0b70('0xa')]=_['defaults'](config[_0x0b70('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x0b70('0xb'))(new Redis(config[_0x0b70('0xa')]));var cmHopper=require(_0x0b70('0xc'));var cmHopperHistory=require(_0x0b70('0xd'));var cmHopperBlack=require(_0x0b70('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x0b70('0xf'));var Action=require(_0x0b70('0x10'));var History=require(_0x0b70('0x11'));var Final=require(_0x0b70('0x12'));var AgentComplete=require(_0x0b70('0x13'));var QueueCallerAbandon=require(_0x0b70('0x14'));var Hangup=require(_0x0b70('0x15'));var ipAgi=process['env'][_0x0b70('0x16')]||_0x0b70('0x17');var strategy={'rrmemory':_0x0b70('0x18'),'roundrobin':_0x0b70('0x19')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0b70('0x1a')][_0x0b70('0x1b')]=function(_0x4841cb){this['tail']=this[_0x0b70('0x1c')]?this[_0x0b70('0x1c')]['finally'](_0x4841cb):_0x4841cb();};function Dialer(_0x5f28fd,_0x3b3e85){this[_0x0b70('0x1d')]=new Sequence();this[_0x0b70('0x1e')]=_0x3b3e85;this['voiceQueues']=_0x5f28fd[_0x0b70('0x1f')];this[_0x0b70('0x20')]=_0x5f28fd[_0x0b70('0x20')];this[_0x0b70('0x21')]=_0x5f28fd[_0x0b70('0x21')];this[_0x0b70('0x22')]=_0x5f28fd[_0x0b70('0x22')];this[_0x0b70('0x23')]=config[_0x0b70('0x23')]||0x2;this[_0x0b70('0x24')]={};this[_0x0b70('0x25')]={};this[_0x0b70('0x26')]={};this[_0x0b70('0x27')]={};this[_0x0b70('0x28')]={};this[_0x0b70('0x29')]={};this[_0x0b70('0x2a')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x0b70('0x2b')]={};ami['on'](_0x0b70('0x2c'),this[_0x0b70('0x2d')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x0b70('0x2e')](this));ami['on'](_0x0b70('0x2f'),this[_0x0b70('0x30')]['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x0b70('0x31'),this[_0x0b70('0x32')][_0x0b70('0x2e')](this));ami['on'](_0x0b70('0x33'),this[_0x0b70('0x34')]['bind'](this));ami['on'](_0x0b70('0x35'),this[_0x0b70('0x36')][_0x0b70('0x2e')](this));ami['on'](_0x0b70('0x37'),this[_0x0b70('0x38')][_0x0b70('0x2e')](this));ami['on'](_0x0b70('0x39'),this['syncQueueMember'][_0x0b70('0x2e')](this));ami['on'](_0x0b70('0x3a'),this[_0x0b70('0x3b')]['bind'](this));this[_0x0b70('0x3c')]();this[_0x0b70('0x3d')]();RpcSetting[_0x0b70('0x3e')]()[_0x0b70('0x3f')](function(_0xcbbe67){previewRecallmeReminderInterval=_0xcbbe67['previewRecallmeReminderInterval'];});}function isNotNull(_0x3e05d7){return _0x3e05d7!==null&&!_[_0x0b70('0x40')](_0x3e05d7);}function checkIsLoggedIn(_0x484cb1,_0xa772f){return function(){if(_0xa772f<=0x0){_0x484cb1[_0x0b70('0x41')]=_0x0b70('0x42');throw _0x484cb1[_0x0b70('0x43')]+_0x0b70('0x44');}};}function isActive(_0x575aa3){return _0x575aa3;}function checkIsActive(_0x4060d2,_0xbc270c){return function(){if(!isActive(_0xbc270c)){_0x4060d2[_0x0b70('0x41')]=_0x0b70('0x45');throw _0x4060d2[_0x0b70('0x43')]+_0x0b70('0x46');}};}function checkInterval(_0x50d5f9){return function(){if(!isNotNull(_0x50d5f9[_0x0b70('0x47')])){_0x50d5f9[_0x0b70('0x41')]=_0x0b70('0x48');throw _0x50d5f9[_0x0b70('0x43')]+_0x0b70('0x49');}if(!isNotNull(_0x50d5f9[_0x0b70('0x47')][_0x0b70('0x4a')])){_0x50d5f9[_0x0b70('0x41')]=_0x0b70('0x48');throw _0x50d5f9['name']+_0x0b70('0x49');}if(!isNotNull(_[_0x0b70('0x4b')](_0x50d5f9[_0x0b70('0x47')]['Intervals']))){_0x50d5f9[_0x0b70('0x41')]=_0x0b70('0x48');throw _0x50d5f9[_0x0b70('0x43')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x4c1b08,_0x50e117,_0x2033a){return{'action':_0x4c1b08,'response':_0x50e117,'message':_0x2033a,'stack':_0x2033a};}function myreject(_0x5b5a82){return function(_0x36b2f9){return _0x5b5a82(msgResponse(_0x0b70('0x4c'),_0x0b70('0x4d'),JSON[_0x0b70('0x4e')](_0x36b2f9)));};}function getSeconds(_0x24be8f,_0x14f847){var _0xf7bbf4=moment(_0x24be8f)[_0x0b70('0x4f')](0x0);var _0x447255=moment(_0x14f847)[_0x0b70('0x4f')](0x0);return _0xf7bbf4[_0x0b70('0x50')](_0x447255,_0x0b70('0x51'));}function emit(_0x233223,_0x4f5877,_0x297917){io['to'](_0x233223)['emit'](_0x4f5877,_0x297917);}function emitVoiceQueueSummary(_0x215cbc){if(_0x215cbc[_0x0b70('0x52')]===_0x0b70('0x53')){var _0x1cbf83={'id':_0x215cbc['id'],'name':_0x215cbc[_0x0b70('0x43')],'strategy':_0x215cbc[_0x0b70('0x54')],'answered':_0x215cbc[_0x0b70('0x55')],'available':_0x215cbc[_0x0b70('0x56')],'loggedIn':_0x215cbc[_0x0b70('0x57')],'pTalking':_0x215cbc[_0x0b70('0x58')],'sumBillable':_0x215cbc[_0x0b70('0x59')],'sumDuration':_0x215cbc[_0x0b70('0x5a')],'sumHoldTime':_0x215cbc[_0x0b70('0x5b')]||0x0,'talking':_0x215cbc[_0x0b70('0x5c')],'total':_0x215cbc[_0x0b70('0x5d')],'type':_0x215cbc[_0x0b70('0x52')],'unmanaged':_0x215cbc[_0x0b70('0x5e')],'abandoned':_0x215cbc[_0x0b70('0x5f')],'waiting':_0x215cbc['waiting'],'loggedInDb':_0x215cbc[_0x0b70('0x60')],'dialActive':_0x215cbc['dialActive'],'dialMethod':_0x215cbc[_0x0b70('0x61')],'dialOriginateCallerIdName':_0x215cbc['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x215cbc[_0x0b70('0x62')],'dialOriginateTimeout':_0x215cbc[_0x0b70('0x63')],'dialPrefix':_0x215cbc[_0x0b70('0x64')],'outboundAnswerAgiCallsDay':_0x215cbc['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x215cbc[_0x0b70('0x65')],'outboundBlacklistCallsDay':_0x215cbc['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x215cbc['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x215cbc[_0x0b70('0x66')],'outboundDropCallsDayACS':_0x215cbc[_0x0b70('0x67')],'outboundDropCallsDayCallersExit':_0x215cbc[_0x0b70('0x68')],'outboundDropCallsDayTimeout':_0x215cbc[_0x0b70('0x69')],'outboundNoAnswerCallsDay':_0x215cbc[_0x0b70('0x6a')],'outboundNoSuchCallsDay':_0x215cbc[_0x0b70('0x6b')],'outboundOriginateFailureCallsDay':_0x215cbc['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x215cbc['outboundReCallsDay'],'outboundRejectCallsDay':_0x215cbc[_0x0b70('0x6c')],'outboundUnknownCallsDay':_0x215cbc[_0x0b70('0x6d')],'predictiveIntervalAnsweredCalls':_0x215cbc[_0x0b70('0x6e')],'predictiveIntervalAvgHoldtime':_0x215cbc[_0x0b70('0x6f')],'predictiveIntervalAvgTalktime':_0x215cbc[_0x0b70('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x215cbc[_0x0b70('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x215cbc[_0x0b70('0x72')],'predictiveIntervalErlangCalls':_0x215cbc[_0x0b70('0x73')],'predictiveIntervalErlangCallsDroppedCalls':_0x215cbc[_0x0b70('0x74')],'predictiveIntervalHitRate':_0x215cbc['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x215cbc['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x215cbc[_0x0b70('0x75')],'predictiveIntervalAvailable':_0x215cbc['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x215cbc[_0x0b70('0x76')],'message':_0x215cbc[_0x0b70('0x41')],'originated':_0x215cbc['originated'],'erlangCalls':_0x215cbc['erlangCalls'],'erlangCallToSecond':_0x215cbc[_0x0b70('0x77')],'erlangAbandonmentRate':_0x215cbc[_0x0b70('0x78')],'erlangBusyFactor':_0x215cbc[_0x0b70('0x79')],'startPredictive':_0x215cbc[_0x0b70('0x29')],'startProgressive':_0x215cbc[_0x0b70('0x2a')]};if(_0x215cbc[_0x0b70('0x7a')]){_0x1cbf83['Trunk']={'id':_0x215cbc[_0x0b70('0x7a')]['id'],'name':_0x215cbc[_0x0b70('0x7a')][_0x0b70('0x43')],'active':_0x215cbc['Trunk'][_0x0b70('0x7b')],'callerid':_0x215cbc[_0x0b70('0x7a')]['callerid']};}if(_0x215cbc[_0x0b70('0x47')]){_0x1cbf83[_0x0b70('0x47')]={'id':_0x215cbc[_0x0b70('0x47')]['id'],'name':_0x215cbc['Interval'][_0x0b70('0x43')]};}var _0x517870=md5(JSON[_0x0b70('0x4e')](_0x1cbf83));if(_0x215cbc[_0x0b70('0x7c')]!==_0x517870){_0x215cbc[_0x0b70('0x7c')]=_0x517870;emit(util[_0x0b70('0x7d')](_0x0b70('0x7e'),_0x1cbf83[_0x0b70('0x43')]),_0x0b70('0x7f'),_0x1cbf83);}}}function emitCampaignSummary(_0x52ff2c){if(_0x52ff2c[_0x0b70('0x52')]===_0x0b70('0x80')){emit(util[_0x0b70('0x7d')](_0x0b70('0x81'),_0x52ff2c[_0x0b70('0x43')]),'campaign:save',_0x52ff2c);}}function checkGetDataPredictive(_0x426ab7){if(isNotNull(_0x426ab7)&&!_[_0x0b70('0x4b')](_0x426ab7)){loggerPredictive[_0x0b70('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x0b70('0x82')](_0x0b70('0x83'),_0x426ab7[_0x0b70('0x76')]);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x84'),_0x426ab7[_0x0b70('0x6e')]);loggerPredictive['info'](_0x0b70('0x85'),_0x426ab7[_0x0b70('0x72')]);loggerPredictive[_0x0b70('0x82')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x426ab7[_0x0b70('0x71')]);loggerPredictive[_0x0b70('0x82')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x426ab7[_0x0b70('0x6f')]);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x86'),_0x426ab7[_0x0b70('0x70')]);loggerPredictive['info'](_0x0b70('0x87'));if(_0x426ab7[_0x0b70('0x76')]>0x0){if(!_[_0x0b70('0x40')](_0x426ab7[_0x0b70('0x70')])&&_0x426ab7[_0x0b70('0x70')]>0x0){return!![];}loggerPredictive[_0x0b70('0x82')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0b70('0x40')](_0x426ab7[_0x0b70('0x6f')])&&_0x426ab7['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0b70('0x82')](_0x0b70('0x88'));}else{loggerPredictive['info'](_0x0b70('0x89'));}}else{loggerPredictive['info'](_0x0b70('0x8a'));}return![];}function mergeDataErlangB(_0x563f42){return function(_0x1639cb){loggerPredictive[_0x0b70('0x82')](_0x0b70('0x8b'));loggerPredictive[_0x0b70('0x82')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1639cb['erlangCalls']);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x8c'),_0x1639cb[_0x0b70('0x77')]);loggerPredictive['info'](_0x0b70('0x8d'),_0x1639cb[_0x0b70('0x78')]);loggerPredictive['info'](_0x0b70('0x8e'),_0x1639cb[_0x0b70('0x79')]);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x8d'),_0x1639cb['erlangAbandonmentRate']);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x87'));_[_0x0b70('0x8f')](_0x563f42,_0x1639cb);};}function getDiff(_0x54c970){var _0x1a847e=moment()[_0x0b70('0x4f')](0x0);var _0x117ac1=moment(_0x54c970)[_0x0b70('0x4f')](0x0);return _0x1a847e[_0x0b70('0x50')](_0x117ac1,_0x0b70('0x51'));}function ifInterval(_0x3f05f2,_0xc34a30){if(_[_0x0b70('0x40')](_0xc34a30)){return![];}return getDiff(_0xc34a30)<_0x3f05f2*0x3c;}function freeVariablesPredictive(_0x552e49){if(isNotNull(_0x552e49)){if(!_[_0x0b70('0x40')](_0x552e49['startProgressive'])){_0x552e49[_0x0b70('0x2a')]=undefined;loggerPredictive[_0x0b70('0x82')](_0x552e49[_0x0b70('0x43')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x0b70('0x40')](_0x552e49['startPredictive'])){_0x552e49[_0x0b70('0x29')]=undefined;loggerPredictive[_0x0b70('0x82')](_0x552e49[_0x0b70('0x43')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0b70('0x40')](_0x552e49[_0x0b70('0x90')])){clearInterval(_0x552e49[_0x0b70('0x90')]);_0x552e49[_0x0b70('0x90')]=undefined;loggerPredictive[_0x0b70('0x82')](_0x552e49[_0x0b70('0x43')],_0x0b70('0x91'));}}}function erlangb(_0x351397,_0x425689){if(_0x425689===0x0){return 0x0;}var _0x421a02=0x1;for(var _0x3d8dd9=0x1;_0x3d8dd9<=_0x425689;_0x3d8dd9+=0x1){_0x421a02=0x1+_0x421a02*_0x3d8dd9/_0x351397;}return 0x1/_0x421a02;}function isVoiceQueueOutbound(_0x4cfc20){return _0x4cfc20===_0x0b70('0x53');}function isNotPreview(_0xe78c01){return _0xe78c01!==_0x0b70('0x1e');}function isCampaignIvr(_0x3bbf1a){return _0x3bbf1a==='ivr';}function getCallerId(_0x4369ae,_0x4de53e,_0x41be5c){if(!_['isUndefined'](_0x41be5c)&&typeof _0x41be5c===_0x0b70('0x92')&&!_['isEmpty'](_0x41be5c)){if(!_[_0x0b70('0x40')](_0x4de53e)&&typeof _0x4de53e==='string'&&!_['isEmpty'](_0x4de53e)){return util['format'](_0x0b70('0x93'),_0x4de53e,_0x41be5c);}return util[_0x0b70('0x7d')](_0x0b70('0x93'),_0x41be5c,_0x41be5c);}if(!_[_0x0b70('0x40')](_0x4369ae)&&typeof _0x4369ae===_0x0b70('0x92')&&!_[_0x0b70('0x4b')](_0x4369ae)){return _0x4369ae;}return _0x0b70('0x94');}function loggerCatchQueueSummary(_0x3d93e8,_0x3b0079){return function(_0x37a592){freeVariablesPredictive(_0x3b0079);emitVoiceQueueSummary(_0x3b0079);emitCampaignSummary(_0x3b0079);loggerSyncQueueSummary[_0x0b70('0x95')](_0x3d93e8,util[_0x0b70('0x96')](_0x37a592,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5d2f70,_0x2c3719){return function(_0x27737a){loggerPredictive[_0x0b70('0x95')](_0x2c3719[_0x0b70('0x43')],_0x5d2f70);loggerPredictive[_0x0b70('0x95')](_0x27737a['stack']);freeVariablesPredictive(_0x2c3719);};}function loggerCatch(_0x1cc0ad){return function(_0x121835){logger[_0x0b70('0x95')](_0x1cc0ad,util[_0x0b70('0x96')](_0x121835,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4c8727){return _0x4c8727&&!_['isUndefined'](_0x4c8727)&&_0x4c8727[_0x0b70('0x97')]>0x0;}function decremetOriginate(_0x4783df){if(!_[_0x0b70('0x40')](_0x4783df)&&_0x4783df!==null){if(typeof _0x4783df[_0x0b70('0x98')]!=='undefined'){if(_0x4783df[_0x0b70('0x98')]>0x0){_0x4783df[_0x0b70('0x98')]-=0x1;}else{logger[_0x0b70('0x95')](_0x0b70('0x99'));}}}else{logger[_0x0b70('0x95')](_0x0b70('0x9a'));}}function checkContactLowerLimitOriginate(_0x28b368,_0x75713f,_0x2fe730){if(_0x75713f>_0x2fe730){for(var _0x3112eb=0x0;_0x3112eb<_0x75713f-_0x2fe730;_0x3112eb+=0x1){decremetOriginate(_0x28b368);}}}function loggerGetContactDialer(_0x527cb9,_0x4c4d85,_0x25e74d){return function(_0x49d4f2){checkContactLowerLimitOriginate(_0x4c4d85,_0x25e74d,0x0);logger[_0x0b70('0x95')](_0x527cb9,util['inspect'](_0x49d4f2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x217b4d){return function(_0x54ca54){if(isNotNull(_0x54ca54)&&isNotNull(_0x54ca54[0x0])){if(_0x54ca54[0x0][_0x0b70('0x9b')]>0x0){_0x217b4d[_0x0b70('0x41')]=_0x0b70('0x9c');logger[_0x0b70('0x82')](_0x0b70('0x9d')+_0x217b4d[_0x0b70('0x43')],_0x54ca54[0x0][_0x0b70('0x9b')],_0x0b70('0x9e'));}else{_0x217b4d[_0x0b70('0x41')]=_0x0b70('0x9f');logger['info'](_0x0b70('0xa0')+_0x217b4d[_0x0b70('0x43')]);}}};}function notSendMessagesQueue(_0x364a6d){if(_0x364a6d[_0x0b70('0xa1')]){freeVariablesPredictive(_0x364a6d);if(_0x364a6d[_0x0b70('0x98')]===0x0&&_0x364a6d[_0x0b70('0x5c')]===0x0&&_0x364a6d[_0x0b70('0xa2')]===0x0&&(_0x364a6d[_0x0b70('0x58')]||0x0)===0x0){_0x364a6d[_0x0b70('0xa1')]=![];_0x364a6d[_0x0b70('0x56')]=0x0;_0x364a6d[_0x0b70('0x41')]=_0x0b70('0x45');loggerSyncQueueSummary[_0x0b70('0x95')](_0x0b70('0xa3'),_0x364a6d[_0x0b70('0x43')],_0x0b70('0xa4'));}else{_0x364a6d[_0x0b70('0x41')]=_0x0b70('0xa5');loggerSyncQueueSummary[_0x0b70('0x95')](_0x0b70('0xa3'),_0x364a6d[_0x0b70('0x43')],_0x0b70('0xa6'));}emitVoiceQueueSummary(_0x364a6d);}}function notSendMessagesCampaign(_0x484ee0){if(_0x484ee0['sendMessageOneNotActive']){if(_0x484ee0[_0x0b70('0x98')]===0x0){_0x484ee0[_0x0b70('0xa1')]=![];_0x484ee0['message']=_0x0b70('0x45');loggerSyncQueueSummary['error'](_0x0b70('0xa7'),_0x484ee0[_0x0b70('0x43')],_0x0b70('0xa4'));}else{_0x484ee0[_0x0b70('0x41')]=_0x0b70('0xa5');loggerSyncQueueSummary[_0x0b70('0x95')](_0x0b70('0xa7'),_0x484ee0[_0x0b70('0x43')],_0x0b70('0xa6'));}emitCampaignSummary(_0x484ee0);}}function createObjHistory(_0x34eab9,_0x4043a1,_0x51d17d,_0x16c708,_0x46c167){_0x34eab9[_0x0b70('0x41')]=_0x51d17d;var _0x4251b7=new Action(_0x34eab9,_0x4043a1);var _0x5af6c7=new History(_0x4251b7);_0x5af6c7[_0x0b70('0xa8')]=_0x16c708;_0x5af6c7[_0x0b70('0xa9')]=_0x46c167;_0x5af6c7[_0x0b70('0xaa')]=_0x4251b7['starttime'];return _0x5af6c7;}Dialer[_0x0b70('0x1a')][_0x0b70('0x3d')]=function(){var _0x28f0e9=this;setInterval(function(){_0x28f0e9[_0x0b70('0xab')](_0x28f0e9[_0x0b70('0x27')],_0x0b70('0xac'));_0x28f0e9[_0x0b70('0xab')](_0x28f0e9[_0x0b70('0x25')],_0x0b70('0xad'));},0x32c8);};Dialer[_0x0b70('0x1a')][_0x0b70('0xab')]=function(_0x3ed983,_0x12b603){var _0x45a85c=this;for(var _0x27ff1b in _0x3ed983){if(typeof _0x3ed983[_0x27ff1b]!==_0x0b70('0xae')){this[_0x0b70('0x1d')][_0x0b70('0x1b')](function(){if(!_[_0x0b70('0xaf')](_0x3ed983[_0x27ff1b])){return ami[_0x0b70('0xb0')]({'action':'status','channel':_0x3ed983[_0x27ff1b][_0x0b70('0xb1')]})[_0x0b70('0xb2')](function(_0x3d8762){if(_0x3d8762[_0x0b70('0x41')]===_0x0b70('0xb3')){setTimeout(function(){if(_0x3ed983[_0x27ff1b]&&_0x3ed983[_0x27ff1b][_0x0b70('0x52')]!==_0x0b70('0x80')){_0x45a85c[_0x0b70('0xb4')](_0x45a85c[_0x0b70('0x1f')][_0x3ed983[_0x27ff1b]['queue']]);logger['error'](_0x0b70('0xb5'),_0x12b603,_0x27ff1b,_0x3ed983[_0x27ff1b][_0x0b70('0xb6')]);delete _0x3ed983[_0x27ff1b];}if(_0x3ed983[_0x27ff1b]&&_0x3ed983[_0x27ff1b]['type']===_0x0b70('0x80')){_0x45a85c[_0x0b70('0xb4')](_0x45a85c['campaigns'][_0x3ed983[_0x27ff1b]['queue']]);logger[_0x0b70('0x95')]('[Dialer][checkChannel][ivr]',_0x12b603,_0x27ff1b,_0x3ed983[_0x27ff1b][_0x0b70('0xb6')]);delete _0x3ed983[_0x27ff1b];}},0x2328);}});}});}}};Dialer[_0x0b70('0x1a')][_0x0b70('0xb7')]=function(_0x3b4edd){return BPromise[_0x0b70('0xb8')]()[_0x0b70('0x3f')](cmHopper[_0x0b70('0xb7')](_0x3b4edd))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0xb9')));};Dialer[_0x0b70('0x1a')][_0x0b70('0xba')]=function(_0x50864e){return BPromise[_0x0b70('0xb8')]()[_0x0b70('0x3f')](cmHopperBlack['checkIsBlackList'](_0x50864e))[_0x0b70('0xb2')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x0b70('0x1a')][_0x0b70('0xbb')]=function(_0x529736){return BPromise[_0x0b70('0xb8')]()[_0x0b70('0x3f')](cmHopperBlack[_0x0b70('0xbb')](_0x529736))[_0x0b70('0xb2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x0b70('0x1a')]['averageHandleTime']=function(_0x4adf9e){return BPromise['resolve']()[_0x0b70('0x3f')](cmHopperHistory[_0x0b70('0xbc')](_0x4adf9e))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0xbd')));};Dialer['prototype'][_0x0b70('0xbe')]=function(_0x2dc878){return BPromise['resolve']()['then'](cmHopper[_0x0b70('0xbe')](_0x2dc878))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0xbf')));};Dialer[_0x0b70('0x1a')][_0x0b70('0xc0')]=function(_0x54f84d,_0x2d417b,_0x2d4c9b){return BPromise['resolve']()[_0x0b70('0x3f')](cmHopper[_0x0b70('0xc0')](_0x54f84d,_0x2d417b,_0x2d4c9b))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0xc1')));};Dialer['prototype'][_0x0b70('0xc2')]=function(_0x22b175,_0x5607ba,_0x3b6eec,_0x2dca1b,_0x4140a3){return BPromise[_0x0b70('0xb8')]()[_0x0b70('0x3f')](cmHopper[_0x0b70('0xc2')](_0x22b175,_0x5607ba,_0x3b6eec,_0x2dca1b))[_0x0b70('0xb2')](function(_0x574690){_0x4140a3[_0x0b70('0xc3')]-=_0x3b6eec;_0x4140a3['temp']=_0x4140a3[_0x0b70('0xc3')]>0x0?_0x4140a3[_0x0b70('0xc3')]:0x0;loggerCatch(_0x0b70('0xc4'))(_0x574690);});};Dialer[_0x0b70('0x1a')]['getContactDialerIvr']=function(_0xe5707,_0x259ad2,_0x4cf896,_0x3da594){return BPromise[_0x0b70('0xb8')]()['then'](cmHopper[_0x0b70('0xc5')](_0xe5707,_0x259ad2,_0x4cf896))[_0x0b70('0xb2')](function(_0x120b93){_0x3da594['temp']-=_0x259ad2;_0x3da594[_0x0b70('0xc3')]=_0x3da594[_0x0b70('0xc3')]>0x0?_0x3da594[_0x0b70('0xc3')]:0x0;loggerCatch(_0x0b70('0xc6'))(_0x120b93);});};Dialer[_0x0b70('0x1a')]['getVoiceQueueRtPauses']=function(_0x23817e){return BPromise[_0x0b70('0xb8')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x23817e))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0xc7')));};Dialer[_0x0b70('0x1a')][_0x0b70('0xc8')]=function(_0x49b0e5){return BPromise[_0x0b70('0xb8')]()[_0x0b70('0x3f')](cmHopper[_0x0b70('0xc8')](_0x49b0e5))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0xc9')));};Dialer[_0x0b70('0x1a')][_0x0b70('0xca')]=function(_0x545555){return BPromise[_0x0b70('0xb8')]()['then'](cmHopperHistory[_0x0b70('0xca')](_0x545555))['catch'](loggerCatch(_0x0b70('0xcb')));};Dialer[_0x0b70('0x1a')][_0x0b70('0xb4')]=function(_0x5732b0){if(!_['isUndefined'](_0x5732b0)&&_0x5732b0!==null){if(typeof _0x5732b0['originated']!==_0x0b70('0xae')){if(_0x5732b0[_0x0b70('0x98')]>0x0){_0x5732b0[_0x0b70('0x98')]-=0x1;}else{logger[_0x0b70('0x95')](_0x0b70('0xcc'));}}}else{logger['error'](_0x0b70('0xcd'));}};Dialer[_0x0b70('0x1a')]['loggerHandler']=function(_0x2f45f8,_0x5c7ac9){var _0x5a559c=this;return function(_0x3a15af){_0x5a559c[_0x0b70('0xb4')](_0x5c7ac9);logger['error'](_0x2f45f8,util[_0x0b70('0x96')](_0x3a15af,{'showHidden':![],'depth':null}));};};Dialer[_0x0b70('0x1a')]['emptyContact']=function(_0xa0727c,_0x84798d,_0x289c7a){var _0x272678={'state':0x19,'statedesc':_0x0b70('0xce')};this['updateOriginated'](_0x84798d);this[_0x0b70('0xcf')](_[_0x0b70('0x8f')](_0x272678,_['pick'](_0x289c7a,['ContactId',_0x0b70('0xd0'),_0x0b70('0xd1'),'VoiceQueueId',_0x0b70('0xd2')])),_0x0b70('0xd3'),_0x0b70('0xd4'));logger[_0x0b70('0x95')](_0xa0727c);};Dialer[_0x0b70('0x1a')][_0x0b70('0xd5')]=function(_0x40b578){return _0x40b578==='Success';};Dialer['prototype']['isTrunkReachable']=function(_0x443b46){return!_[_0x0b70('0x40')](_0x443b46)&&_0x443b46&&!_[_0x0b70('0x40')](_0x443b46[_0x0b70('0x43')])&&!_[_0x0b70('0x40')](_0x443b46[_0x0b70('0x7b')])&&_0x443b46['active']&&(this[_0x0b70('0x22')][util[_0x0b70('0x7d')]('SIP/%s',_0x443b46[_0x0b70('0x43')])][_0x0b70('0xd6')]===_0x0b70('0xd7')||this[_0x0b70('0x22')][util[_0x0b70('0x7d')](_0x0b70('0xd8'),_0x443b46['name'])][_0x0b70('0xd6')]==='unmonitored');};Dialer[_0x0b70('0x1a')][_0x0b70('0xcf')]=function(_0x3e0bd6,_0x2b8f8a,_0x23c2ef){this[_0x0b70('0xca')](_0x3e0bd6)[_0x0b70('0xb2')](loggerCatch(_0x2b8f8a));this[_0x0b70('0xc8')](_0x3e0bd6)['catch'](loggerCatch(_0x23c2ef));};Dialer[_0x0b70('0x1a')][_0x0b70('0x38')]=function(_0x5169b4){var _0x37f95a=this[_0x0b70('0x27')][_0x5169b4[_0x0b70('0xd9')]];var _0x26eec9;if(!_[_0x0b70('0xaf')](_0x5169b4)&&!_[_0x0b70('0xaf')](_0x5169b4[_0x0b70('0xda')])&&!_[_0x0b70('0xaf')](_0x5169b4[_0x0b70('0xda')][_0x0b70('0xdb')])&&_0x5169b4[_0x0b70('0xdc')]===_0x0b70('0xdd')&&_0x37f95a){if(_0x37f95a[_0x0b70('0x52')]!==_0x0b70('0x80')&&this[_0x0b70('0x1f')][_0x37f95a[_0x0b70('0xb6')]][_0x0b70('0xde')]&&_0x5169b4[_0x0b70('0xdf')]===_0x0b70('0xe0')){delete this[_0x0b70('0x27')][_0x5169b4[_0x0b70('0xd9')]];this[_0x0b70('0xb4')](this['voiceQueues'][_0x37f95a[_0x0b70('0xb6')]]);this[_0x0b70('0x1f')][_0x37f95a['queue']][_0x0b70('0x65')]+=0x1;this[_0x0b70('0x1f')][_0x37f95a[_0x0b70('0xb6')]][_0x0b70('0xe1')]+=0x1;_0x26eec9=new Hangup(_0x37f95a,_0x5169b4);_0x26eec9['state']=0x12;_0x26eec9[_0x0b70('0xa9')]=_0x0b70('0xe2');_0x26eec9['membername']=_0x0b70('0xe3');ami['emit']('custom:amd',ut['buildObj'](_0x26eec9,_0x0b70('0xe4')));this[_0x0b70('0xcf')](_0x26eec9,_0x0b70('0xe5'),_0x0b70('0xe6'));}if(_0x37f95a[_0x0b70('0x52')]!==_0x0b70('0x80')&&this[_0x0b70('0x1f')][_0x37f95a['queue']]['dialAMDActive']&&_0x5169b4[_0x0b70('0xdf')]===_0x0b70('0xe7')){var _0x70741a=this;return new BPromise(function(_0x45c681,_0xb39c45){delete _0x70741a[_0x0b70('0x27')][_0x5169b4[_0x0b70('0xd9')]];_0x70741a['updateOriginated'](_0x70741a[_0x0b70('0x1f')][_0x37f95a[_0x0b70('0xb6')]]);_0x70741a[_0x0b70('0x1f')][_0x37f95a[_0x0b70('0xb6')]][_0x0b70('0x65')]+=0x1;_0x70741a[_0x0b70('0x1f')][_0x37f95a[_0x0b70('0xb6')]][_0x0b70('0xe1')]+=0x1;var _0x494861=_0x70741a['voiceQueues'][_0x37f95a[_0x0b70('0xb6')]];var _0x5232ad=new Hangup(_0x37f95a,_0x5169b4);_0x5232ad[_0x0b70('0xa8')]=0x13;_0x5232ad[_0x0b70('0xa9')]='Machine';_0x5232ad['membername']=_0x0b70('0xe3');_0x5232ad['countmachineretry']+=0x1;_0x5232ad[_0x0b70('0xe8')]+=0x1;_0x5232ad[_0x0b70('0xe4')]=!![];ami[_0x0b70('0xe9')](_0x0b70('0xea'),ut[_0x0b70('0xeb')](_0x5232ad,'amd'));_0x70741a['createHistory'](_0x5232ad)[_0x0b70('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5232ad[_0x0b70('0xec')]+_0x5232ad['countcongestionretry']+_0x5232ad[_0x0b70('0xed')]+_0x5232ad[_0x0b70('0xee')]+_0x5232ad[_0x0b70('0xef')]+_0x5232ad['countabandonedretry']+_0x5232ad[_0x0b70('0xf0')]+_0x5232ad[_0x0b70('0xf1')]>=_0x494861[_0x0b70('0xf2')]){_0x70741a[_0x0b70('0xf3')](_0x5232ad,_0x45c681,_0xb39c45,_0x0b70('0xf4'));}else{if(_0x5232ad['countmachineretry']>=_0x494861['dialMachineMaxRetry']){_0x70741a[_0x0b70('0xf5')](_0x5232ad,_0x45c681,_0xb39c45,_0x0b70('0xf6'));}else{_0x70741a['rescheduleContact']({'active':![],'countmachineretry':_0x5232ad[_0x0b70('0xf0')],'scheduledat':moment()['add'](_0x494861[_0x0b70('0xf7')],_0x0b70('0xf8'))[_0x0b70('0x7d')](_0x0b70('0xf9')),'ContactId':_0x5232ad[_0x0b70('0xfa')],'ListId':_0x5232ad[_0x0b70('0xd0')],'VoiceQueueId':_0x5232ad[_0x0b70('0xfb')]||undefined,'CampaignId':_0x5232ad[_0x0b70('0xd2')]||undefined})[_0x0b70('0xb2')](loggerCatch('[rescheduleContact][Machine]'));_0x45c681({'reschedule':0x1});}}});}if(_0x37f95a[_0x0b70('0x52')]===_0x0b70('0x80')&&this[_0x0b70('0x20')][_0x37f95a[_0x0b70('0xb6')]][_0x0b70('0xde')]&&_0x5169b4[_0x0b70('0xdf')]==='HANGUP'){delete this[_0x0b70('0x27')][_0x5169b4[_0x0b70('0xd9')]];this['updateOriginated'](this[_0x0b70('0x20')][_0x37f95a[_0x0b70('0xb6')]]);_0x26eec9=new Hangup(_0x37f95a,_0x5169b4);_0x26eec9[_0x0b70('0xa8')]=0x12;_0x26eec9[_0x0b70('0xa9')]=_0x0b70('0xe2');_0x26eec9[_0x0b70('0xfc')]=_0x0b70('0xe3');ami['emit'](_0x0b70('0xea'),ut[_0x0b70('0xeb')](_0x26eec9,_0x0b70('0xe4')));this['saveInDb'](_0x26eec9,_0x0b70('0xfd'),_0x0b70('0xfe'));}if(_0x37f95a[_0x0b70('0x52')]===_0x0b70('0x80')&&this[_0x0b70('0x20')][_0x37f95a[_0x0b70('0xb6')]][_0x0b70('0xde')]&&_0x5169b4[_0x0b70('0xdf')]===_0x0b70('0xe7')){var _0x70741a=this;return new BPromise(function(_0x125a3a,_0x4aa861){delete _0x70741a[_0x0b70('0x27')][_0x5169b4[_0x0b70('0xd9')]];_0x70741a[_0x0b70('0xb4')](_0x70741a['campaigns'][_0x37f95a[_0x0b70('0xb6')]]);_0x70741a[_0x0b70('0x20')][_0x37f95a[_0x0b70('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x70741a[_0x0b70('0x20')][_0x37f95a[_0x0b70('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x424195=_0x70741a[_0x0b70('0x20')][_0x37f95a[_0x0b70('0xb6')]];var _0x25175c=new Hangup(_0x37f95a,_0x5169b4);_0x25175c[_0x0b70('0xa8')]=0x13;_0x25175c['statedesc']=_0x0b70('0xff');_0x25175c['membername']=_0x0b70('0xe3');_0x25175c[_0x0b70('0xf0')]+=0x1;_0x25175c[_0x0b70('0xe8')]+=0x1;_0x25175c[_0x0b70('0xe4')]=!![];ami[_0x0b70('0xe9')]('custom:amd',ut[_0x0b70('0xeb')](_0x25175c,_0x0b70('0xe4')));_0x70741a[_0x0b70('0xca')](_0x25175c)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x100')));if(_0x25175c[_0x0b70('0xec')]+_0x25175c[_0x0b70('0x101')]+_0x25175c[_0x0b70('0xed')]+_0x25175c['countnosuchnumberretry']+_0x25175c[_0x0b70('0xef')]+_0x25175c[_0x0b70('0x102')]+_0x25175c['countmachineretry']+_0x25175c[_0x0b70('0xf1')]>=_0x424195[_0x0b70('0xf2')]){_0x70741a[_0x0b70('0xf3')](_0x25175c,_0x125a3a,_0x4aa861,'reason19\x20machine....');}else{if(_0x25175c[_0x0b70('0xf0')]>=_0x424195[_0x0b70('0x103')]){_0x70741a['createStateFinal'](_0x25175c,_0x125a3a,_0x4aa861,_0x0b70('0xf6'));}else{_0x70741a[_0x0b70('0xbe')]({'active':![],'countmachineretry':_0x25175c[_0x0b70('0xf0')],'scheduledat':moment()[_0x0b70('0x104')](_0x424195[_0x0b70('0xf7')],_0x0b70('0xf8'))['format'](_0x0b70('0xf9')),'ContactId':_0x25175c['ContactId'],'ListId':_0x25175c[_0x0b70('0xd0')],'VoiceQueueId':_0x25175c[_0x0b70('0xfb')]||undefined,'CampaignId':_0x25175c[_0x0b70('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x125a3a({'reschedule':0x1});}}});}}};Dialer[_0x0b70('0x1a')]['syncHangup']=function(_0xce69d1){var _0x3713f6=this['uniqueId'][_0xce69d1[_0x0b70('0xd9')]];var _0x415be6=this;var _0x373a1e;if(_0x3713f6&&_0x3713f6[_0x0b70('0x52')]==='ivr'){delete this[_0x0b70('0x27')][_0xce69d1[_0x0b70('0xd9')]];this[_0x0b70('0xb4')](this[_0x0b70('0x20')][_0x3713f6[_0x0b70('0xb6')]]);this['campaigns'][_0x3713f6[_0x0b70('0xb6')]][_0x0b70('0x105')]+=0x1;_0x373a1e=new Hangup(_0x3713f6,_0xce69d1);this[_0x0b70('0xca')](_0x373a1e)[_0x0b70('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0b70('0xc8')](_0x373a1e)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x106')));}if(_0x3713f6&&_0x3713f6[_0x0b70('0x52')]!==_0x0b70('0x80')&&isNotNull(this['voiceQueues'][_0x3713f6[_0x0b70('0xb6')]][_0x0b70('0x107')])){delete this[_0x0b70('0x27')][_0xce69d1[_0x0b70('0xd9')]];this[_0x0b70('0xb4')](this[_0x0b70('0x1f')][_0x3713f6[_0x0b70('0xb6')]]);this[_0x0b70('0x1f')][_0x3713f6['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x0b70('0x1f')][_0x3713f6['queue']][_0x0b70('0xe1')]+=0x1;_0x373a1e=new Hangup(_0x3713f6,_0xce69d1);_0x373a1e[_0x0b70('0xa8')]=0x10;_0x373a1e[_0x0b70('0xa9')]=_0x0b70('0x108');_0x373a1e[_0x0b70('0xfc')]='AGI';this[_0x0b70('0xca')](_0x373a1e)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x109')));this[_0x0b70('0xc8')](_0x373a1e)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x106')));}if(_0x3713f6&&_0x3713f6[_0x0b70('0x52')]!==_0x0b70('0x80')&&!isNotNull(this[_0x0b70('0x1f')][_0x3713f6['queue']][_0x0b70('0x107')])){delete this[_0x0b70('0x27')][_0xce69d1[_0x0b70('0xd9')]];this[_0x0b70('0xb4')](this[_0x0b70('0x1f')][_0x3713f6[_0x0b70('0xb6')]]);this[_0x0b70('0x1f')][_0x3713f6[_0x0b70('0xb6')]][_0x0b70('0x6d')]+=0x1;_0x373a1e=new Hangup(_0x3713f6,_0xce69d1);_0x373a1e[_0x0b70('0xa8')]=0xc;_0x373a1e[_0x0b70('0xa9')]=_0xce69d1[_0x0b70('0x10a')];_0x373a1e[_0x0b70('0xfc')]=_0x0b70('0x10b');this['createHistory'](_0x373a1e)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x109')));this['moveContactManagedDialer'](_0x373a1e)[_0x0b70('0xb2')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0b70('0x1a')][_0x0b70('0x10c')]=function(_0x34ceda){var _0x5a2888=this[_0x0b70('0x27')][_0x34ceda[_0x0b70('0xd9')]];var _0x195a5=this;if(this[_0x0b70('0x1f')][_0x34ceda[_0x0b70('0xb6')]]){if(_0x5a2888&&_0x5a2888[_0x0b70('0x52')]!==_0x0b70('0x80')){delete this[_0x0b70('0x27')][_0x34ceda[_0x0b70('0xd9')]];this['voiceQueues'][_0x34ceda['queue']]['outboundAnswerCallsDay']+=0x1;var _0x52c706=new AgentComplete(_0x5a2888,_0x34ceda);if(_0x34ceda[_0x0b70('0x10d')]===_0x0b70('0x10e')){_0x52c706[_0x0b70('0x10f')]=this[_0x0b70('0x1f')][_0x34ceda[_0x0b70('0xb6')]][_0x0b70('0x110')]&&this[_0x0b70('0x1f')][_0x34ceda['queue']][_0x0b70('0x111')]?moment()[_0x0b70('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x0b70('0xca')](_0x52c706)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x112')));this['moveContactManagedDialer'](_0x52c706)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x113')));}}};Dialer[_0x0b70('0x1a')][_0x0b70('0x2d')]=function(_0x4a896a){if(this[_0x0b70('0x1f')][_0x4a896a['queue']]){if(this[_0x0b70('0x27')][_0x4a896a[_0x0b70('0xd9')]]&&this[_0x0b70('0x27')][_0x4a896a[_0x0b70('0xd9')]][_0x0b70('0x52')]!==_0x0b70('0x80')){this['updateOriginated'](this['voiceQueues'][_0x4a896a[_0x0b70('0xb6')]]);this[_0x0b70('0x27')][_0x4a896a[_0x0b70('0xd9')]][_0x0b70('0x114')]=moment()[_0x0b70('0x7d')](_0x0b70('0xf9'));}}};Dialer[_0x0b70('0x1a')][_0x0b70('0x115')]=function(_0x4bd369){this[_0x0b70('0xca')](_0x4bd369)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x112')));this['moveContactManagedDialer'](_0x4bd369)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x116')));};Dialer['prototype'][_0x0b70('0x117')]=function(_0x3f5b6b){var _0x257688=this[_0x0b70('0x27')][_0x3f5b6b['uniqueid']];var _0x25cc7b=this;if(this[_0x0b70('0x1f')][_0x3f5b6b[_0x0b70('0xb6')]]){if(_0x257688&&_0x257688[_0x0b70('0x52')]!==_0x0b70('0x80')){delete this[_0x0b70('0x27')][_0x3f5b6b[_0x0b70('0xd9')]];this[_0x0b70('0xb4')](this['voiceQueues'][_0x3f5b6b['queue']]);_0x257688[_0x0b70('0x118')]=moment()[_0x0b70('0x7d')](_0x0b70('0xf9'));var _0x52509b=new QueueCallerAbandon(_0x257688,_0x3f5b6b);if(getSeconds(_0x257688[_0x0b70('0x118')],_0x257688[_0x0b70('0x119')])>=_0x257688['dialQueueTimeout']){this[_0x0b70('0x1f')][_0x3f5b6b[_0x0b70('0xb6')]][_0x0b70('0x72')]+=0x1;this[_0x0b70('0x1f')][_0x3f5b6b[_0x0b70('0xb6')]][_0x0b70('0x69')]+=0x1;this[_0x0b70('0x1f')][_0x3f5b6b[_0x0b70('0xb6')]][_0x0b70('0x74')]+=0x1;_0x52509b[_0x0b70('0xa8')]=0xa;_0x52509b[_0x0b70('0xa9')]=_0x0b70('0x11a');_0x52509b[_0x0b70('0x11b')]='TIMEOUT';_0x52509b[_0x0b70('0x10f')]=this[_0x0b70('0x1f')][_0x3f5b6b[_0x0b70('0xb6')]][_0x0b70('0x110')]?moment()[_0x0b70('0x7d')](_0x0b70('0xf9')):undefined;_0x52509b['countdropretry']+=0x1;_0x52509b[_0x0b70('0xe8')]+=0x1;if(_0x52509b[_0x0b70('0xef')]>=this[_0x0b70('0x1f')][_0x3f5b6b['queue']][_0x0b70('0x11c')]){this[_0x0b70('0x115')](_0x52509b);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x52509b[_0x0b70('0xef')],'scheduledat':moment()[_0x0b70('0x104')](this[_0x0b70('0x1f')][_0x3f5b6b['queue']][_0x0b70('0x11d')],'minutes')[_0x0b70('0x7d')](_0x0b70('0xf9')),'ContactId':_0x257688['ContactId'],'ListId':_0x257688[_0x0b70('0xd0')],'VoiceQueueId':_0x257688[_0x0b70('0xfb')]||undefined,'CampaignId':_0x257688[_0x0b70('0xd2')]||undefined})['catch'](loggerCatch(_0x0b70('0x11e')));var _0x299027=new History(_0x52509b);_0x299027[_0x0b70('0xa8')]=0xa;_0x299027[_0x0b70('0xa9')]=_0x0b70('0x11a');_0x299027[_0x0b70('0x11f')]=moment()[_0x0b70('0x7d')](_0x0b70('0xf9'));_0x299027[_0x0b70('0xaa')]=_0x299027[_0x0b70('0x11f')];_0x299027[_0x0b70('0x120')]=_0x52509b['calleridname'];_0x299027[_0x0b70('0x121')]=_0x52509b['calleridnum'];this[_0x0b70('0xca')](_0x299027)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x0b70('0x1f')][_0x3f5b6b[_0x0b70('0xb6')]][_0x0b70('0x71')]+=0x1;this[_0x0b70('0x1f')][_0x3f5b6b[_0x0b70('0xb6')]][_0x0b70('0x68')]+=0x1;_0x52509b[_0x0b70('0xa8')]=0xb;_0x52509b[_0x0b70('0xa9')]='Abandoned';_0x52509b[_0x0b70('0x11b')]=_0x0b70('0x122');_0x52509b[_0x0b70('0x102')]+=0x1;_0x52509b[_0x0b70('0xe8')]+=0x1;if(_0x52509b[_0x0b70('0x102')]>=this[_0x0b70('0x1f')][_0x3f5b6b['queue']][_0x0b70('0x123')]){this[_0x0b70('0x115')](_0x52509b);}else{this[_0x0b70('0xbe')]({'active':![],'countabandonedretry':_0x52509b[_0x0b70('0x102')],'scheduledat':moment()[_0x0b70('0x104')](this[_0x0b70('0x1f')][_0x3f5b6b[_0x0b70('0xb6')]]['dialAbandonedRetryFrequency'],_0x0b70('0xf8'))[_0x0b70('0x7d')](_0x0b70('0xf9')),'ContactId':_0x257688[_0x0b70('0xfa')],'ListId':_0x257688[_0x0b70('0xd0')],'VoiceQueueId':_0x257688[_0x0b70('0xfb')]||undefined,'CampaignId':_0x257688[_0x0b70('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x299027=new History(_0x52509b);_0x299027[_0x0b70('0xa8')]=0xb;_0x299027['statedesc']=_0x0b70('0x124');_0x299027[_0x0b70('0x11f')]=moment()[_0x0b70('0x7d')](_0x0b70('0xf9'));_0x299027['endtime']=_0x299027[_0x0b70('0x11f')];_0x299027[_0x0b70('0x120')]=_0x52509b['calleridname'];_0x299027[_0x0b70('0x121')]=_0x52509b[_0x0b70('0x121')];this[_0x0b70('0xca')](_0x299027)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x125')));}}}}};Dialer[_0x0b70('0x1a')]['syncNewExten']=function(_0x5b1c31){if(this[_0x0b70('0x25')][_0x5b1c31[_0x0b70('0xd9')]]){this[_0x0b70('0x25')][_0x5b1c31[_0x0b70('0xd9')]]['channel']=_0x5b1c31[_0x0b70('0xb1')];}if(this[_0x0b70('0x27')][_0x5b1c31[_0x0b70('0xd9')]]){this['uniqueId'][_0x5b1c31[_0x0b70('0xd9')]][_0x0b70('0xb1')]=_0x5b1c31[_0x0b70('0xb1')];}};Dialer[_0x0b70('0x1a')]['syncQueueMember']=function(_0x220644){if(strategy[this[_0x0b70('0x1f')][this[_0x0b70('0x25')][_0x220644[_0x0b70('0x126')]]['queue']][_0x0b70('0x54')]]===_0x0b70('0x19')){if(this[_0x0b70('0x25')][_0x220644[_0x0b70('0x126')]]&&_['isNil'](this[_0x0b70('0x25')][_0x220644[_0x0b70('0x126')]][_0x0b70('0x127')])&&_0x220644[_0x0b70('0xd6')]==='1'&&_0x220644[_0x0b70('0x128')]==='0'){if(this['agents'][_0x220644[_0x0b70('0x129')]]){if(!this['agents'][_0x220644[_0x0b70('0x129')]]['locked']){this[_0x0b70('0x21')][_0x220644['stateinterface']][_0x0b70('0x127')]=!![];this['actions'][_0x220644['actionid']][_0x0b70('0x127')]=!![];this[_0x0b70('0x25')][_0x220644['actionid']][_0x0b70('0x129')]=_0x220644[_0x0b70('0x129')];}}}}else if((strategy[this[_0x0b70('0x1f')][this[_0x0b70('0x25')][_0x220644[_0x0b70('0x126')]][_0x0b70('0xb6')]][_0x0b70('0x54')]]||_0x0b70('0x18'))==='rrmemory'){if(this[_0x0b70('0x25')][_0x220644[_0x0b70('0x126')]]){if(this['agents'][_0x220644[_0x0b70('0x129')]]){this[_0x0b70('0x25')][_0x220644[_0x0b70('0x126')]][_0x0b70('0x129')]=_0x220644[_0x0b70('0x129')];if(_['isNil'](this[_0x0b70('0x12a')][this[_0x0b70('0x25')][_0x220644[_0x0b70('0x126')]][_0x0b70('0xb6')]])){this['queueBooked'][this[_0x0b70('0x25')][_0x220644['actionid']][_0x0b70('0xb6')]]=[];}this['queueBooked'][this[_0x0b70('0x25')][_0x220644['actionid']][_0x0b70('0xb6')]][_0x0b70('0x12b')](_[_0x0b70('0x8f')](_[_0x0b70('0x12c')](this[_0x0b70('0x25')][_0x220644[_0x0b70('0x126')]],['idHopper','stateinterface']),{'status':_0x220644[_0x0b70('0xd6')],'paused':_0x220644[_0x0b70('0x128')]}));}}}};function unlockQueueStatus(_0x4d96a5,_0x1a5c45){setTimeout(function(){if(_['isUndefined'](_0x4d96a5[_0x0b70('0x12d')])){loggerBooked[_0x0b70('0x95')](_0x0b70('0x12e'),_0x1a5c45);}_0x4d96a5[_0x0b70('0x12d')]=!![];loggerBooked[_0x0b70('0x82')](_0x0b70('0x12f'),_0x1a5c45,JSON[_0x0b70('0x4e')](_[_0x0b70('0x12c')](_0x4d96a5,[_0x0b70('0x43'),_0x0b70('0x12d')])));},0x1f3);}Dialer[_0x0b70('0x1a')]['syncQueueStatusComplete']=function(_0x35beaa){var _0x5e71de=this;var _0xf1d0c9=_0x5e71de[_0x0b70('0x1f')][_0x5e71de['actions'][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xb6')]];if(strategy[this[_0x0b70('0x1f')][this['actions'][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xb6')]]['strategy']]===_0x0b70('0x19')){if(this[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]]&&this[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0x129')]){this['preview'][_0x0b70('0x130')](this['actions'][_0x35beaa[_0x0b70('0x126')]]['idHopper'],this[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0x129')])[_0x0b70('0xb2')](function(_0x33374b){logger[_0x0b70('0x95')](_0x0b70('0x131'),util[_0x0b70('0x96')](_0x33374b,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5e71de[_0x0b70('0xb4')](_0x5e71de[_0x0b70('0x1f')][_0x5e71de[_0x0b70('0x25')][_0x35beaa['actionid']][_0x0b70('0xb6')]]);_0x5e71de[_0x0b70('0x21')][_0x5e71de[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]]['stateinterface']][_0x0b70('0x127')]=![];delete _0x5e71de[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]];unlockQueueStatus(_0xf1d0c9);});}else{this[_0x0b70('0xb4')](this[_0x0b70('0x1f')][this['actions'][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xb6')]]);this[_0x0b70('0xbe')]({'active':![],'ContactId':this[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xfa')],'ListId':this['actions'][_0x35beaa['actionid']][_0x0b70('0xd0')],'VoiceQueueId':this['actions'][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xfb')]||undefined,'CampaignId':this[_0x0b70('0x25')][_0x35beaa['actionid']][_0x0b70('0xd2')]||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x132')));delete this[_0x0b70('0x25')][_0x35beaa['actionid']];unlockQueueStatus(_0xf1d0c9);}}else if((strategy[this[_0x0b70('0x1f')][this[_0x0b70('0x25')][_0x35beaa['actionid']][_0x0b70('0xb6')]][_0x0b70('0x54')]]||_0x0b70('0x18'))===_0x0b70('0x18')){var _0x37ee92;if(this[_0x0b70('0x25')][_0x35beaa['actionid']]&&!_[_0x0b70('0x4b')](this[_0x0b70('0x12a')][this['actions'][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xb6')]])){if(this[_0x0b70('0x2b')][_0x5e71de['actions'][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xb6')]]){this[_0x0b70('0x2b')][_0x5e71de[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xb6')]]=this[_0x0b70('0x2b')][this[_0x0b70('0x25')][_0x35beaa['actionid']][_0x0b70('0xb6')]]?this['queueBookedRR'][this[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]]['queue']]:this[_0x0b70('0x12a')][this[_0x0b70('0x25')][_0x35beaa['actionid']][_0x0b70('0xb6')]]?this[_0x0b70('0x12a')][this[_0x0b70('0x25')][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xb6')]][_0x0b70('0x133')]||0x0:0x0;}this[_0x0b70('0x12a')][this['actions'][_0x35beaa[_0x0b70('0x126')]][_0x0b70('0xb6')]][_0x0b70('0x133')]=this[_0x0b70('0x2b')][this['actions'][_0x35beaa['actionid']][_0x0b70('0xb6')]];for(var _0x45af13=0x0;_0x45af13=0x0;})['catch'](myreject(_0x3a3aca)));}}else{_0x1e31ae[_0x0b70('0x12b')](ami[_0x0b70('0xb0')]({'action':_0x0b70('0x14f'),'command':util[_0x0b70('0x7d')](_0x0b70('0x14c'),_0x59b894,!_[_0x0b70('0x40')](config[_0x0b70('0x148')][_0x1196ec])?_0x1196ec:'')})[_0x0b70('0x3f')](function(_0x39160f){return _0x39160f[_0x0b70('0x150')][_0x0b70('0x151')](_0x0b70('0x14e'))>=0x0;})['catch'](myreject(_0x3a3aca)));}BPromise[_0x0b70('0x152')](_0x1e31ae)[_0x0b70('0x3f')](function(_0x3742a6){var _0xe66743=_[_0x0b70('0x153')](_0x3742a6);if(_0xe66743){return _0x2e8b54(_0xe66743);}else{_0x4fc9ac[_0x0b70('0x41')]=_0x11f14f?_0x0b70('0x154'):_0x0b70('0x155');return _0x3a3aca(msgResponse(_0x0b70('0x156'),_0x0b70('0x144'),_0x0b70('0x157')+_0x11f14f+'\x20'+_0x46e5fc+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x59b894,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1196ec));}})[_0x0b70('0xb2')](function(_0x149d29){return _0x3a3aca(msgResponse(_0x0b70('0x142'),_0x0b70('0x144'),JSON[_0x0b70('0x4e')](_0x149d29)));});});};Dialer[_0x0b70('0x1a')]['checkDialMethod']=function(_0x10f6d3){var _0x4cc679=this;return function(){switch(_0x10f6d3['dialMethod']){case _0x0b70('0x158'):freeVariablesPredictive(_0x10f6d3);_0x4cc679[_0x0b70('0x159')](_0x10f6d3,0x1);break;case _0x0b70('0x15a'):freeVariablesPredictive(_0x10f6d3);_0x4cc679[_0x0b70('0x159')](_0x10f6d3,_0x10f6d3['dialPowerLevel']);break;case _0x0b70('0x15b'):_0x4cc679['predictive'](_0x10f6d3);break;case'booked':freeVariablesPredictive(_0x10f6d3);_0x4cc679[_0x0b70('0x159')](_0x10f6d3,0x1);break;default:freeVariablesPredictive(_0x10f6d3);logger['error'](_0x0b70('0x15c'),_0x10f6d3['name'],_0x0b70('0x15d'));}};};Dialer[_0x0b70('0x1a')]['checkPreviewRecallReminder']=function(_0x10ca42){return BPromise[_0x0b70('0xb8')]()[_0x0b70('0x3f')](cmHopper['handlePreviewRecallNotifications'](_0x10ca42['id'],previewRecallmeReminderInterval))[_0x0b70('0x3f')](function(_0x58cd06){for(var _0x462f49=0x0;_0x462f49<_0x58cd06[_0x0b70('0x97')];_0x462f49++){var _0x2cf548=_0x58cd06[_0x462f49][_0x0b70('0x15e')]['name'];if(_0x2cf548)io['to'](util[_0x0b70('0x7d')](_0x0b70('0x15f'),_0x2cf548))[_0x0b70('0xe9')](_0x0b70('0x160'),{'hopper':_0x58cd06[_0x462f49]});}})[_0x0b70('0xb2')](function(_0x23ab39){});};Dialer[_0x0b70('0x1a')][_0x0b70('0x161')]=function(_0xecbf19){var _0x48d872=this;return function(){_0x48d872[_0x0b70('0x162')](_0xecbf19);};};Dialer['prototype']['syncQueueSummary']=function(_0x4aa1f5){var _0x96a3b0=this;if(isNotPreview(_0x4aa1f5['dialMethod'])){if(isVoiceQueueOutbound(_0x4aa1f5['type'])&&isActive(_0x4aa1f5['dialActive'])){_0x4aa1f5['sendMessageOneNotActive']=!![];BPromise[_0x0b70('0xb8')]()[_0x0b70('0x3f')](checkIsLoggedIn(_0x4aa1f5,_0x4aa1f5['loggedIn']))[_0x0b70('0x3f')](checkIsActive(_0x4aa1f5,_0x4aa1f5[_0x0b70('0x163')]))[_0x0b70('0x3f')](checkInterval(_0x4aa1f5))['then'](_0x96a3b0[_0x0b70('0x13d')](_0x4aa1f5))[_0x0b70('0x3f')](_0x96a3b0[_0x0b70('0x141')](_0x4aa1f5[_0x0b70('0x164')],_0x4aa1f5[_0x0b70('0x165')],_0x4aa1f5['name'],_0x4aa1f5))[_0x0b70('0x3f')](_0x96a3b0[_0x0b70('0x143')](_0x4aa1f5[_0x0b70('0x47')],_0x4aa1f5[_0x0b70('0x165')],_0x4aa1f5[_0x0b70('0x43')],_0x4aa1f5))[_0x0b70('0x3f')](_0x96a3b0[_0x0b70('0x166')](_0x4aa1f5))['catch'](loggerCatchQueueSummary(_0x0b70('0x167'),_0x4aa1f5));}else{notSendMessagesQueue(_0x4aa1f5);}}else{freeVariablesPredictive(_0x4aa1f5);if(_0x4aa1f5[_0x0b70('0x168')]){_0x96a3b0[_0x0b70('0x169')](_0x4aa1f5);}}};Dialer[_0x0b70('0x1a')][_0x0b70('0x16a')]=function(){var _0x1d5f47=this;var _0x272ef6;for(var _0x50e9e1 in this[_0x0b70('0x20')]){if(typeof this[_0x0b70('0x20')][_0x50e9e1]!==_0x0b70('0xae')){_0x272ef6=this[_0x0b70('0x20')][_0x50e9e1];if(isCampaignIvr(_0x272ef6[_0x0b70('0x52')])&&isActive(_0x272ef6[_0x0b70('0x7b')])){_0x272ef6[_0x0b70('0xa1')]=!![];BPromise[_0x0b70('0xb8')]()['then'](checkIsActive(_0x272ef6,_0x272ef6[_0x0b70('0x7b')]))['then'](checkInterval(_0x272ef6))[_0x0b70('0x3f')](_0x1d5f47[_0x0b70('0x13d')](_0x272ef6))[_0x0b70('0x3f')](_0x1d5f47[_0x0b70('0x141')](_0x272ef6['dialGlobalInterval'],_0x272ef6[_0x0b70('0x165')],_0x272ef6[_0x0b70('0x43')],_0x272ef6))[_0x0b70('0x3f')](_0x1d5f47[_0x0b70('0x143')](_0x272ef6[_0x0b70('0x47')],_0x272ef6['dialTimezone'],_0x272ef6[_0x0b70('0x43')],_0x272ef6))[_0x0b70('0x3f')](_0x1d5f47[_0x0b70('0x161')](_0x272ef6))[_0x0b70('0xb2')](loggerCatchQueueSummary(_0x0b70('0x16b'),_0x272ef6));}else{notSendMessagesCampaign(_0x272ef6);}}}};function getCallerIdRandom(_0x5a1016,_0x1a7fa8){var _0x271e98;var _0x15117e;var _0xc30b54;if(_0x1a7fa8<=0x0){_0x1a7fa8=0x1;}_0x271e98=new RegExp(_0x0b70('0x16c')+_0x1a7fa8+'}$');_0x15117e=Math[_0x0b70('0x16d')](0xa,_0x1a7fa8-0x1);_0xc30b54=Math[_0x0b70('0x16d')](0xa,_0x1a7fa8)-0x1;return util[_0x0b70('0x7d')]('%s',_[_0x0b70('0x16e')](_0x5a1016,_0x271e98,_[_0x0b70('0x16f')](_0x15117e,_0xc30b54)));}function extractCalleridName(_0xb3e633){var _0x458b7e=_0xb3e633[_0x0b70('0x170')](/"(.*?)"/);return _0x458b7e?_0x458b7e[0x1]:_0xb3e633;}function extractCalleridNumber(_0x482690){var _0x498a99=_0x482690[_0x0b70('0x170')](/<(.*?)>/);return _0x498a99?_0x498a99[0x1]:_0x482690;}Dialer[_0x0b70('0x1a')][_0x0b70('0x171')]=function(_0x307251,_0x2bfe15){var _0x21f73e=this;var _0x4fe44f=uuid['v4']();this['actions'][_0x4fe44f]=new Action(_0x307251,_0x2bfe15,_0x4fe44f);return new BPromise(function(_0x263238,_0x2965c0){if(_[_0x0b70('0x40')](_0x307251)&&typeof _0x307251!=='object'){return _0x2965c0(msgResponse(_0x0b70('0x172'),'Failure',_0x0b70('0x173')));}if(_[_0x0b70('0x40')](_0x2bfe15[_0x0b70('0x174')][_0x0b70('0x175')])||_0x2bfe15[_0x0b70('0x174')][_0x0b70('0x175')]===null){return _0x2965c0(msgResponse(_0x0b70('0x172'),_0x0b70('0x144'),_0x0b70('0x176')));}var _0x16b558={'XMD-CALLERID':_0x21f73e[_0x0b70('0x25')][_0x4fe44f][_0x0b70('0x177')](),'XMD-AGI':_0x307251[_0x0b70('0x107')]?util[_0x0b70('0x7d')](_0x0b70('0x178'),ipAgi,_0x307251[_0x0b70('0x107')]):_0x0b70('0x179'),'XMD-AGIAFTER':_0x307251[_0x0b70('0x110')]?util[_0x0b70('0x7d')](_0x0b70('0x178'),ipAgi,_0x307251[_0x0b70('0x110')]):_0x0b70('0x179'),'XMD-QUEUE':_0x307251[_0x0b70('0x52')]===_0x0b70('0x53')?util[_0x0b70('0x7d')](_0x0b70('0x17a'),_0x307251[_0x0b70('0x43')],_0x307251['dialQueueOptions']||'',_0x307251[_0x0b70('0x111')]?'c':'',_0x307251[_0x0b70('0x17b')]||0x3):_0x0b70('0x179'),'XMD-CONTACTID':_0x2bfe15[_0x0b70('0xfa')],'XMD-CDRTYPE':_0x0b70('0x6'),'CALLERID(all)':_0x21f73e[_0x0b70('0x25')][_0x4fe44f][_0x0b70('0x177')](),'XMD-AMD':_0x307251[_0x0b70('0xde')]?_0x0b70('0x17c'):_0x0b70('0x179'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x307251[_0x0b70('0xde')]){_0x16b558[_0x0b70('0x17d')]=_0x307251[_0x0b70('0x17e')]||0x9c4;_0x16b558['XMD-AMDGREETING']=_0x307251[_0x0b70('0x17f')]||0x5dc;_0x16b558['XMD-AMDAFTERGREETINGSILENCE']=_0x307251[_0x0b70('0x180')]||0x320;_0x16b558[_0x0b70('0x181')]=_0x307251['dialAMDTotalAnalysisTime']||0x1388;_0x16b558[_0x0b70('0x182')]=_0x307251[_0x0b70('0x183')]||0x64;_0x16b558[_0x0b70('0x184')]=_0x307251[_0x0b70('0x185')]||0x32;_0x16b558[_0x0b70('0x186')]=_0x307251['dialAMDMaximumNumberOfWords']||0x3;_0x16b558[_0x0b70('0x187')]=_0x307251[_0x0b70('0x188')]||0x100;_0x16b558['XMD-AMDMAXIMUMWORDLENGTH']=_0x307251[_0x0b70('0x189')]||0x1388;}if(_0x307251[_0x0b70('0x52')]==='outbound'){_0x16b558[_0x0b70('0x18a')]=_0x2bfe15[_0x0b70('0xfb')];}else{_0x16b558['XMD-CAMPAIGNID']=_0x2bfe15['CampaignId'];}for(var _0x272a3d in _0x2bfe15[_0x0b70('0x174')]){if(typeof _0x2bfe15[_0x0b70('0x174')][_0x272a3d]!==_0x0b70('0xae')){if(isNotNull(_0x2bfe15[_0x0b70('0x174')][_0x272a3d])&&_0x272a3d!=='id'&&_0x272a3d!==_0x0b70('0x18b')&&_0x272a3d!=='createdAt'&&_0x272a3d!==_0x0b70('0x18c')){_0x16b558[util[_0x0b70('0x7d')](_0x0b70('0x18d'),_0x0b70('0x18e'),_[_0x0b70('0x18f')](_0x272a3d))]=_0x2bfe15['Contact'][_0x272a3d];}}}var _0x165869=_0x21f73e[_0x0b70('0x13e')](_0x307251[_0x0b70('0x7a')])?getCallerId(_0x307251['Trunk']['callerid'],_0x307251['dialOriginateCallerIdName'],_0x307251[_0x0b70('0x190')]>0x0?getCallerIdRandom(_0x307251[_0x0b70('0x62')],_0x307251[_0x0b70('0x190')]):_0x307251[_0x0b70('0x62')]):getCallerId(_[_0x0b70('0xaf')](_0x307251['TrunkBackup'])?_0x307251[_0x0b70('0x7a')]['callerid']:_0x307251[_0x0b70('0x191')][_0x0b70('0x192')],_0x307251[_0x0b70('0x193')],_0x307251[_0x0b70('0x190')]>0x0?getCallerIdRandom(_0x307251['dialOriginateCallerIdNumber'],_0x307251[_0x0b70('0x190')]):_0x307251[_0x0b70('0x62')]);if(_0x165869){_0x16b558[_0x0b70('0x194')]=_0x21f73e[_0x0b70('0x25')][_0x4fe44f][_0x0b70('0x195')]=extractCalleridName(_0x165869);_0x16b558['XMD-ORIGINATECALLERIDNUM']=_0x21f73e[_0x0b70('0x25')][_0x4fe44f][_0x0b70('0x196')]=extractCalleridNumber(_0x165869);}return ami[_0x0b70('0xb0')]({'actionid':_0x4fe44f,'action':_0x0b70('0x172'),'channel':_0x21f73e[_0x0b70('0x13e')](_0x307251['Trunk'])?util['format'](_0x0b70('0x197'),_0x307251[_0x0b70('0x7a')][_0x0b70('0x43')],isNotNull(_0x307251[_0x0b70('0x64')])?_0x307251[_0x0b70('0x64')][_0x0b70('0x198')]()||'':'',_0x307251[_0x0b70('0x199')]>0x0?_0x2bfe15[_0x0b70('0x174')][_0x0b70('0x175')]['substring'](_0x307251[_0x0b70('0x199')]):_0x2bfe15[_0x0b70('0x174')][_0x0b70('0x175')]):util[_0x0b70('0x7d')](_0x0b70('0x197'),_['isNil'](_0x307251[_0x0b70('0x191')])?_0x307251[_0x0b70('0x7a')][_0x0b70('0x43')]:_0x307251[_0x0b70('0x191')]['name'],isNotNull(_0x307251[_0x0b70('0x64')])?_0x307251[_0x0b70('0x64')][_0x0b70('0x198')]()||'':'',_0x307251[_0x0b70('0x199')]>0x0?_0x2bfe15['Contact'][_0x0b70('0x175')][_0x0b70('0x19a')](_0x307251[_0x0b70('0x199')]):_0x2bfe15['Contact'][_0x0b70('0x175')]),'callerid':_0x165869,'Exten':_0x0b70('0xdd'),'Context':_0x0b70('0x19b'),'Priority':'1','variable':_0x16b558,'timeout':(_0x307251[_0x0b70('0x63')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4fe44f})['then'](function(_0x140f24){return _0x263238(_0x140f24);})[_0x0b70('0xb2')](function(_0x7b7821){_0x307251[_0x0b70('0x19c')]+=0x1;var _0x13679b=new History(_0x21f73e[_0x0b70('0x25')][_0x4fe44f]);logger[_0x0b70('0x95')](util[_0x0b70('0x7d')](_0x0b70('0x19d'),JSON[_0x0b70('0x4e')](_0x7b7821)));_0x13679b[_0x0b70('0xa8')]=0xe;_0x13679b[_0x0b70('0xa9')]=_0x0b70('0x19e');_0x13679b['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x13679b['endtime']=_0x13679b[_0x0b70('0x11f')];_0x21f73e['createHistory'](_0x13679b)['catch'](loggerCatch(_0x0b70('0x19f')));_0x21f73e[_0x0b70('0xc8')](_0x13679b)['catch'](loggerCatch(_0x0b70('0x19f')))[_0x0b70('0x1a0')](function(){delete _0x21f73e['actions'][_0x4fe44f];return _0x2965c0(msgResponse(_0x0b70('0x172'),_0x0b70('0x4d'),_0x0b70('0x1a1')));});});});};Dialer[_0x0b70('0x1a')][_0x0b70('0x30')]=function(_0x4b9f49){var _0x158392=this[_0x0b70('0x25')][_0x4b9f49[_0x0b70('0x126')]];if(_0x158392){delete this[_0x0b70('0x25')][_0x4b9f49['actionid']];_0x158392[_0x0b70('0x119')]=moment()[_0x0b70('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3c3520=_0x158392[_0x0b70('0x52')]==='ivr'?this[_0x0b70('0x20')][_0x158392[_0x0b70('0xb6')]]:this[_0x0b70('0x1f')][_0x158392[_0x0b70('0x1a2')]()];if(!this[_0x0b70('0xd5')](_0x4b9f49['response'])){this[_0x0b70('0xb4')](_0x3c3520);return this[_0x0b70('0x1a3')](_0x158392,_0x3c3520,_0x4b9f49)[_0x0b70('0xb2')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x0b70('0x27')][_0x4b9f49[_0x0b70('0xd9')]]=_0x158392;}};Dialer['prototype'][_0x0b70('0x1a4')]=function(_0x52fe8c,_0x395b03,_0x16f958){var _0x4b78f9=new History(_0x395b03);if(_0x4b78f9['countbusyretry']+_0x4b78f9[_0x0b70('0x101')]+_0x4b78f9[_0x0b70('0xed')]+_0x4b78f9[_0x0b70('0xee')]+_0x4b78f9[_0x0b70('0xef')]+_0x4b78f9[_0x0b70('0x102')]+_0x4b78f9[_0x0b70('0xf0')]+_0x4b78f9[_0x0b70('0xf1')]>=_0x16f958[_0x0b70('0xf2')]-0x1){return!![];}switch(_0x52fe8c){case 0x3:if(_0x4b78f9[_0x0b70('0xed')]>=_0x16f958[_0x0b70('0x1a5')]-0x1){return!![];}this[_0x0b70('0xbe')]({'active':![],'countnoanswerretry':_0x4b78f9[_0x0b70('0xed')]+=0x1,'scheduledat':moment()[_0x0b70('0x104')](_0x16f958['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x0b70('0xf9')),'ContactId':_0x4b78f9[_0x0b70('0xfa')],'ListId':_0x4b78f9[_0x0b70('0xd0')],'VoiceQueueId':_0x4b78f9[_0x0b70('0xfb')]||undefined,'CampaignId':_0x4b78f9[_0x0b70('0xd2')]||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1a6')));break;case 0x5:if(_0x4b78f9['countbusyretry']>=_0x16f958[_0x0b70('0x1a7')]-0x1){return!![];}this[_0x0b70('0xbe')]({'active':![],'countbusyretry':_0x4b78f9[_0x0b70('0xec')]+=0x1,'scheduledat':moment()['add'](_0x16f958[_0x0b70('0x1a8')],_0x0b70('0xf8'))[_0x0b70('0x7d')](_0x0b70('0xf9')),'ContactId':_0x4b78f9[_0x0b70('0xfa')],'ListId':_0x4b78f9[_0x0b70('0xd0')],'VoiceQueueId':_0x4b78f9[_0x0b70('0xfb')]||undefined,'CampaignId':_0x4b78f9[_0x0b70('0xd2')]||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1a9')));break;case 0x8:if(_0x4b78f9[_0x0b70('0x101')]>=_0x16f958[_0x0b70('0x1aa')]-0x1){return!![];}this[_0x0b70('0xbe')]({'active':![],'countcongestionretry':_0x4b78f9[_0x0b70('0x101')]+=0x1,'scheduledat':moment()[_0x0b70('0x104')](_0x16f958[_0x0b70('0x1ab')],_0x0b70('0xf8'))[_0x0b70('0x7d')](_0x0b70('0xf9')),'ContactId':_0x4b78f9[_0x0b70('0xfa')],'ListId':_0x4b78f9[_0x0b70('0xd0')],'VoiceQueueId':_0x4b78f9[_0x0b70('0xfb')]||undefined,'CampaignId':_0x4b78f9[_0x0b70('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4b78f9[_0x0b70('0xee')]>=_0x16f958[_0x0b70('0x1ac')]-0x1){return!![];}else{this[_0x0b70('0xbe')]({'active':![],'countnosuchnumberretry':_0x4b78f9[_0x0b70('0xee')]+=0x1,'scheduledat':moment()[_0x0b70('0x104')](_0x16f958[_0x0b70('0x1ad')],_0x0b70('0xf8'))[_0x0b70('0x7d')](_0x0b70('0xf9')),'ContactId':_0x4b78f9[_0x0b70('0xfa')],'ListId':_0x4b78f9['ListId'],'VoiceQueueId':_0x4b78f9['VoiceQueueId']||undefined,'CampaignId':_0x4b78f9['CampaignId']||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1ae')));}break;case 0xa:if(_0x4b78f9[_0x0b70('0xef')]>=_0x16f958['dialDropMaxRetry']-0x1){return!![];}this[_0x0b70('0xbe')]({'active':![],'countdropretry':_0x4b78f9[_0x0b70('0xef')]+=0x1,'scheduledat':moment()[_0x0b70('0x104')](_0x16f958['dialDropRetryFrequency'],_0x0b70('0xf8'))[_0x0b70('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b78f9['ContactId'],'ListId':_0x4b78f9[_0x0b70('0xd0')],'VoiceQueueId':_0x4b78f9[_0x0b70('0xfb')]||undefined,'CampaignId':_0x4b78f9[_0x0b70('0xd2')]||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x11e')));break;case 0xb:if(_0x4b78f9[_0x0b70('0x102')]>=_0x16f958[_0x0b70('0x123')]-0x1){return!![];}this[_0x0b70('0xbe')]({'active':![],'countabandonedretry':_0x4b78f9[_0x0b70('0x102')]+=0x1,'scheduledat':moment()[_0x0b70('0x104')](_0x16f958[_0x0b70('0x1af')],_0x0b70('0xf8'))[_0x0b70('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b78f9[_0x0b70('0xfa')],'ListId':_0x4b78f9[_0x0b70('0xd0')],'VoiceQueueId':_0x4b78f9[_0x0b70('0xfb')]||undefined,'CampaignId':_0x4b78f9[_0x0b70('0xd2')]||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1b0')));break;case 0x13:if(_0x4b78f9[_0x0b70('0xf0')]>=_0x16f958[_0x0b70('0x103')]-0x1){return!![];}this[_0x0b70('0xbe')]({'active':![],'countmachineretry':_0x4b78f9[_0x0b70('0xf0')]+=0x1,'scheduledat':moment()[_0x0b70('0x104')](_0x16f958[_0x0b70('0xf7')],_0x0b70('0xf8'))['format'](_0x0b70('0xf9')),'ContactId':_0x4b78f9[_0x0b70('0xfa')],'ListId':_0x4b78f9[_0x0b70('0xd0')],'VoiceQueueId':_0x4b78f9[_0x0b70('0xfb')]||undefined,'CampaignId':_0x4b78f9[_0x0b70('0xd2')]||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1b1')));break;case 0x14:if(_0x4b78f9[_0x0b70('0xf1')]>=_0x16f958['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x0b70('0xbe')]({'active':![],'countagentrejectretry':_0x4b78f9[_0x0b70('0xf1')]+=0x1,'scheduledat':moment()[_0x0b70('0x104')](_0x16f958[_0x0b70('0x1b2')],_0x0b70('0xf8'))[_0x0b70('0x7d')](_0x0b70('0xf9')),'ContactId':_0x4b78f9[_0x0b70('0xfa')],'ListId':_0x4b78f9[_0x0b70('0xd0')],'VoiceQueueId':_0x4b78f9[_0x0b70('0xfb')]||undefined,'CampaignId':_0x4b78f9['CampaignId']||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1b3')));break;default:return!![];}};Dialer[_0x0b70('0x1a')][_0x0b70('0x1a3')]=function(_0x3dfe55,_0x76f2ce,_0x55ce9d){var _0x1b9371=this;var _0x28b986=new History(_0x3dfe55);return new BPromise(function(_0x15d177,_0x1f0379){if(_[_0x0b70('0x40')](_0x76f2ce)&&typeof _0x76f2ce!=='object'){return _0x1f0379(msgResponse(_0x0b70('0x1b4'),_0x0b70('0x144'),_0x0b70('0x1b5')));}if(_['isUndefined'](_0x55ce9d)&&typeof _0x55ce9d!==_0x0b70('0x1b6')){return _0x1f0379(msgResponse(_0x0b70('0x1b4'),'Failure','evt\x20is\x20undefine'));}switch(_0x55ce9d[_0x0b70('0x10d')]){case'0':_0x76f2ce[_0x0b70('0x6b')]+=0x1;_0x28b986[_0x0b70('0xa8')]=0x0;_0x28b986[_0x0b70('0xa9')]='NoSuchNumber';_0x28b986[_0x0b70('0xee')]+=0x1;_0x28b986[_0x0b70('0xe8')]+=0x1;ami[_0x0b70('0xe9')]('custom:agentnosuchnumber',ut[_0x0b70('0xeb')](_0x3dfe55,'nosuchnumber'));_0x1b9371['createHistory'](_0x28b986)[_0x0b70('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1b9371['checkRetriveMax'](0x0,_0x3dfe55,_0x76f2ce)){if(_0x28b986['countnosuchnumberretry']>=_0x76f2ce[_0x0b70('0x1ac')]){_0x1b9371[_0x0b70('0xf5')](_0x28b986,_0x15d177,_0x1f0379,_0x0b70('0x1b7'));}else{_0x1b9371[_0x0b70('0xf3')](_0x28b986,_0x15d177,_0x1f0379,_0x0b70('0x1b7'));}}break;case'3':_0x76f2ce[_0x0b70('0x6a')]+=0x1;_0x28b986[_0x0b70('0xa8')]=0x3;_0x28b986[_0x0b70('0xa9')]='NoAnswer';_0x28b986[_0x0b70('0xed')]+=0x1;_0x28b986[_0x0b70('0xe8')]+=0x1;ami['emit'](_0x0b70('0x1b8'),ut[_0x0b70('0xeb')](_0x3dfe55,_0x0b70('0x1b9')));_0x1b9371['createHistory'](_0x28b986)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1ba')));if(_0x1b9371[_0x0b70('0x1a4')](0x3,_0x3dfe55,_0x76f2ce)){if(_0x28b986['countnoanswerretry']>=_0x76f2ce['dialNoAnswerMaxRetry']){_0x1b9371[_0x0b70('0xf5')](_0x28b986,_0x15d177,_0x1f0379,_0x0b70('0x1bb'));}else{_0x1b9371[_0x0b70('0xf3')](_0x28b986,_0x15d177,_0x1f0379,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x76f2ce[_0x0b70('0x1bc')]+=0x1;_0x28b986[_0x0b70('0xa8')]=0x5;_0x28b986[_0x0b70('0xa9')]=_0x0b70('0x1bd');_0x28b986[_0x0b70('0xec')]+=0x1;_0x28b986['countglobal']+=0x1;ami[_0x0b70('0xe9')]('custom:agentbusy',ut[_0x0b70('0xeb')](_0x3dfe55,'busy'));_0x1b9371[_0x0b70('0xca')](_0x28b986)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1be')));if(_0x1b9371[_0x0b70('0x1a4')](0x5,_0x3dfe55,_0x76f2ce)){if(_0x28b986['countbusyretry']>=_0x76f2ce[_0x0b70('0x1a7')]){_0x1b9371['createStateFinal'](_0x28b986,_0x15d177,_0x1f0379,_0x0b70('0x1bf'));}else{_0x1b9371[_0x0b70('0xf3')](_0x28b986,_0x15d177,_0x1f0379,_0x0b70('0x1bf'));}}break;case'8':_0x76f2ce[_0x0b70('0x66')]+=0x1;_0x28b986[_0x0b70('0xa8')]=0x8;_0x28b986[_0x0b70('0xa9')]=_0x0b70('0x1c0');_0x28b986[_0x0b70('0x101')]+=0x1;_0x28b986['countglobal']+=0x1;ami[_0x0b70('0xe9')](_0x0b70('0x1c1'),ut['buildObj'](_0x3dfe55,_0x0b70('0x1c2')));_0x1b9371[_0x0b70('0xca')](_0x28b986)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1b9371[_0x0b70('0x1a4')](0x8,_0x3dfe55,_0x76f2ce)){if(_0x28b986[_0x0b70('0x101')]>=_0x76f2ce[_0x0b70('0x1aa')]){_0x1b9371[_0x0b70('0xf5')](_0x28b986,_0x15d177,_0x1f0379,'reason\x208\x20congestion');}else{_0x1b9371[_0x0b70('0xf3')](_0x28b986,_0x15d177,_0x1f0379,_0x0b70('0x1c3'));}}break;case'11':_0x76f2ce[_0x0b70('0x1c4')]+=0x1;_0x28b986[_0x0b70('0xa8')]=0xb;_0x28b986[_0x0b70('0xa9')]=_0x0b70('0x124');_0x28b986[_0x0b70('0x102')]+=0x1;_0x28b986[_0x0b70('0xe8')]+=0x1;_0x1b9371[_0x0b70('0xca')](_0x28b986)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x125')));if(_0x1b9371[_0x0b70('0x1a4')](0xb,_0x3dfe55,_0x76f2ce)){if(_0x28b986['countabandonedretry']>=_0x76f2ce[_0x0b70('0x123')]){_0x1b9371[_0x0b70('0xf5')](_0x28b986,_0x15d177,_0x1f0379,_0x0b70('0x1c5'));}else{_0x1b9371[_0x0b70('0xf3')](_0x28b986,_0x15d177,_0x1f0379,'reason\x2011\x20abandoned');}}break;case'20':_0x76f2ce['outboundRejectCallsDay']+=0x1;_0x28b986[_0x0b70('0xa8')]=0x14;_0x28b986['statedesc']=_0x0b70('0x1c6');_0x28b986[_0x0b70('0xf1')]+=0x1;_0x28b986[_0x0b70('0xe8')]+=0x1;ami[_0x0b70('0xe9')](_0x0b70('0x1c7'),ut[_0x0b70('0xeb')](_0x3dfe55,'agentreject'));_0x1b9371[_0x0b70('0xca')](_0x28b986)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1c8')));if(_0x1b9371[_0x0b70('0x1a4')](0x14,_0x3dfe55,_0x76f2ce)){if(_0x28b986[_0x0b70('0xf1')]>=_0x76f2ce[_0x0b70('0x1c9')]){_0x1b9371['createStateFinal'](_0x28b986,_0x15d177,_0x1f0379,'reason\x2020\x20agentreject');}else{_0x1b9371[_0x0b70('0xf3')](_0x28b986,_0x15d177,_0x1f0379,_0x0b70('0x1ca'));}}break;default:_0x76f2ce[_0x0b70('0x6d')]+=0x1;_0x28b986[_0x0b70('0xa8')]=0xc;_0x28b986[_0x0b70('0xa9')]=_0x55ce9d[_0x0b70('0x10d')];_0x1b9371['createHistory'](_0x28b986)[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1cb')));if(_0x1b9371['checkRetriveMax'](_0x55ce9d[_0x0b70('0x10d')],_0x3dfe55,_0x76f2ce)){if(_0x28b986[_0x0b70('0xec')]+_0x28b986[_0x0b70('0x101')]+_0x28b986['countnoanswerretry']+_0x28b986[_0x0b70('0xee')]+_0x28b986['countdropretry']+_0x28b986[_0x0b70('0x102')]+_0x28b986[_0x0b70('0xf0')]+_0x28b986[_0x0b70('0xf1')]>=_0x76f2ce[_0x0b70('0xf2')]){_0x1b9371[_0x0b70('0xf3')](_0x28b986,_0x15d177,_0x1f0379,_0x55ce9d['reason']);}else{_0x1b9371['createStateFinal'](_0x28b986,_0x15d177,_0x1f0379,_0x55ce9d[_0x0b70('0x10d')]);}}}});};Dialer['prototype'][_0x0b70('0xf3')]=function(_0x2dbf5d,_0x4ce417,_0x1059fe,_0xb17cc6){var _0x27d39a=new Final(_0x2dbf5d);_0x27d39a['state']=0xf;_0x27d39a[_0x0b70('0xa9')]='Global';this[_0x0b70('0xf5')](_0x27d39a,_0x4ce417,_0x1059fe,_0xb17cc6);};Dialer[_0x0b70('0x1a')][_0x0b70('0xf5')]=function(_0x9c02f8,_0x2bced6,_0x1e1150,_0x147899){this[_0x0b70('0xc8')](_0x9c02f8)[_0x0b70('0x3f')](function(){return _0x2bced6(msgResponse(_0x0b70('0x1b4'),_0x0b70('0x1cc'),_0x147899));})[_0x0b70('0xb2')](function(){return _0x1e1150(msgResponse('[moveContactManagedDialer][0]','Failure',_0x0b70('0x1cd')));});};Dialer['prototype'][_0x0b70('0x15b')]=function(_0x559537){var _0x56556c=_0x559537['dialPredictiveOptimizationPercentage']/0x64;var _0x109a8e=_0x559537['outboundDropCallsDayTimeout']/(_0x559537['outboundDropCallsDayTimeout']+_0x559537[_0x0b70('0x65')]);var _0x4c4e8c=Math[_0x0b70('0x1ce')](_0x559537[_0x0b70('0x1cf')]*(_0x559537[_0x0b70('0x1d0')]/0x64));var _0x44dbb2=Math['round'](_0x559537['predictiveIntervalAvailable']*(_0x559537[_0x0b70('0x1d1')]/0x64));var _0x201765=_0x559537[_0x0b70('0x56')]+_0x559537['talking'];var _0x3f82fd=Math[_0x0b70('0x1d2')](_0x559537[_0x0b70('0x1d3')]*_0x559537[_0x0b70('0x78')]*_0x559537[_0x0b70('0x1d4')]*_0x559537['predictiveIntervalMultiplicativeFactor']);if(_[_0x0b70('0x40')](_0x559537[_0x0b70('0x2a')])){if(!_['isUndefined'](_0x559537[_0x0b70('0x29')])){_0x559537[_0x0b70('0x29')]=undefined;loggerPredictive[_0x0b70('0x95')](_0x0b70('0x1d5'),_0x0b70('0x1d6'));}if(!_[_0x0b70('0x40')](_0x559537[_0x0b70('0x90')])){loggerPredictive[_0x0b70('0x95')](_0x0b70('0x1d5'),_0x0b70('0x1d7'));clearInterval(_0x559537['handlePredictive']);_0x559537['handlePredictive']=undefined;}_0x559537[_0x0b70('0x2a')]=moment()[_0x0b70('0x7d')](_0x0b70('0xf9'));loggerPredictive[_0x0b70('0x82')](_0x559537['name'],_0x0b70('0x1d8'),_0x559537[_0x0b70('0x2a')]);this[_0x0b70('0x159')](_0x559537,0x1);}else if(ifInterval(_0x559537['dialPredictiveInterval'],_0x559537[_0x0b70('0x2a')])){this['handlePower'](_0x559537,0x1);loggerPredictiveCalls[_0x0b70('0x82')](_0x0b70('0x1d9'),_0x559537[_0x0b70('0x2a')],_0x559537[_0x0b70('0x43')]);_0x559537[_0x0b70('0x1d3')]=0x0;_0x559537['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x56556c<_0x109a8e&&_0x559537[_0x0b70('0x1da')]==='dropRate'){freeVariablesPredictive(_0x559537);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x0b70('0x1db'),_0x109a8e,_0x0b70('0x2a'),_0x559537[_0x0b70('0x43')]);}else if(_0x3f82fd<_0x559537['predictiveIntervalErlangCallsDroppedCalls']&&_0x559537[_0x0b70('0x1da')]===_0x0b70('0x1dc')){freeVariablesPredictive(_0x559537);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x1dd'),'Max\x20Drop\x20',_0x3f82fd,_0x0b70('0x1de'),_0x559537['predictiveIntervalErlangCallsDroppedCalls'],_0x0b70('0x2a'),_0x559537[_0x0b70('0x43')]);}else if(!ifInterval(_0x559537[_0x0b70('0x1df')],_0x559537[_0x0b70('0x2a')])&&_[_0x0b70('0x40')](_0x559537[_0x0b70('0x29')])&&!_[_0x0b70('0x40')](_0x559537[_0x0b70('0x2a')])){_0x559537['startPredictive']=moment()[_0x0b70('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0b70('0x82')](_0x559537[_0x0b70('0x43')],'started\x20in\x20predictive\x20at',_0x559537['startPredictive']);this[_0x0b70('0x1e0')](_0x559537[_0x0b70('0x1df')])[_0x0b70('0x3f')](this['getDataPredictive'](_0x559537))['then'](mergeDataErlangB(_0x559537))[_0x0b70('0x3f')](this[_0x0b70('0x1e1')](_0x559537))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x559537));}else if(!ifInterval(_0x559537['dialPredictiveInterval'],_0x559537['startPredictive'])){_0x559537['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x559537[_0x0b70('0x29')]=moment()[_0x0b70('0x7d')](_0x0b70('0xf9'));loggerPredictive['info'](_0x559537[_0x0b70('0x43')],_0x0b70('0x1e2'),_0x559537[_0x0b70('0x29')]);clearInterval(_0x559537[_0x0b70('0x90')]);_0x559537['handlePredictive']=undefined;this[_0x0b70('0x1e0')](_0x559537[_0x0b70('0x1df')])[_0x0b70('0x3f')](this[_0x0b70('0x1e3')](_0x559537))['then'](mergeDataErlangB(_0x559537))[_0x0b70('0x3f')](this[_0x0b70('0x1e1')](_0x559537))['catch'](loggerCatchPredictive(_0x0b70('0x1e4'),_0x559537));}else if(_0x559537[_0x0b70('0x1cf')]&&_0x201765<_0x559537[_0x0b70('0x1cf')]-_0x44dbb2){freeVariablesPredictive(_0x559537);loggerPredictive[_0x0b70('0x82')](_0x559537[_0x0b70('0x43')],_0x0b70('0x1e5'),_0x201765,')\x20are\x20less\x20than\x20threshold\x20(',_0x559537['predictiveIntervalAvailable'],'-',_0x44dbb2,'=',_0x559537[_0x0b70('0x1cf')]-_0x44dbb2,')');}else if(_0x559537['predictiveIntervalAvailable']&&_0x201765>_0x559537[_0x0b70('0x1cf')]+_0x4c4e8c){freeVariablesPredictive(_0x559537);loggerPredictive[_0x0b70('0x82')](_0x559537[_0x0b70('0x43')],_0x0b70('0x1e5'),_0x201765,')\x20are\x20more\x20than\x20threshold\x20(',_0x559537[_0x0b70('0x1cf')],'+',_0x4c4e8c,'=',_0x559537[_0x0b70('0x1cf')]+_0x4c4e8c,')');}};Dialer[_0x0b70('0x1a')][_0x0b70('0x1e3')]=function(_0x351ff0){var _0x1e9639=this;return function(_0xf10de6){return new BPromise(function(_0x2104ba,_0x45e3f7){_['merge'](_0x351ff0,_0xf10de6[0x0]);if(checkGetDataPredictive(_0xf10de6[0x0])){var _0x584c96=_0x351ff0[_0x0b70('0x1cf')]=_0x351ff0[_0x0b70('0x5c')]+_0x351ff0[_0x0b70('0x56')];var _0x3c40f7=_0x351ff0['dialPredictiveInterval']*0x3c;var _0x508545=_0xf10de6[0x0][_0x0b70('0x70')]+_0xf10de6[0x0][_0x0b70('0x6f')];var _0xf670bb=(_0xf10de6[0x0][_0x0b70('0x6e')]+_0xf10de6[0x0][_0x0b70('0x72')]+_0xf10de6[0x0][_0x0b70('0x71')])/_0xf10de6[0x0][_0x0b70('0x76')];_0x351ff0[_0x0b70('0x1d4')]=_0xf670bb>0x0?_0xf670bb:0x1;switch(_0x351ff0[_0x0b70('0x1da')]){case _0x0b70('0x1dc'):var _0x40db12=_0x351ff0[_0x0b70('0x1e6')]/0x64;return _0x1e9639['abandonmentRate'](_0x584c96,_0x3c40f7,_0x508545,_0xf670bb,_0x40db12)[_0x0b70('0x3f')](function(_0x28ee29){return _0x2104ba(_0x28ee29);});case _0x0b70('0x1e7'):var _0x569b44=_0x351ff0[_0x0b70('0x1e6')]/0x64;return _0x1e9639['busyFactor'](_0x584c96,_0x3c40f7,_0x508545,_0xf670bb,_0x569b44)[_0x0b70('0x3f')](function(_0x500c93){return _0x2104ba(_0x500c93);});default:return _0x45e3f7(msgResponse(_0x0b70('0x1e8'),_0x0b70('0x144'),'Unknown\x20Predictive'));}}else{return _0x45e3f7(msgResponse(_0x0b70('0x1e8'),_0x0b70('0x144'),_0x0b70('0x1e9')));}});};};Dialer[_0x0b70('0x1a')][_0x0b70('0x1ea')]=function(_0x4ed1c1){var _0x24f186=this;return function(_0x2efd8d){return new BPromise(function(_0x58cd18,_0x243af8){_['merge'](_0x4ed1c1,_0x2efd8d[0x0]);if(checkGetDataPredictive(_0x2efd8d[0x0])){loggerPredictive['info'](JSON[_0x0b70('0x4e')](_0x2efd8d[0x0]));if(_0x4ed1c1[_0x0b70('0x1da')]==='dropRate'){return _0x24f186[_0x0b70('0x1eb')](_0x4ed1c1['id'])[_0x0b70('0x3f')](function(_0x2f7778){var _0x2e2252=_0x4ed1c1['loggedIn']-_0x2f7778[0x0]['outboundQueuePauses'];var _0x5462af=_0x4ed1c1[_0x0b70('0x1df')]*0x3c;var _0x2ba0e5=_0x2efd8d[0x0][_0x0b70('0x70')]+_0x2efd8d[0x0][_0x0b70('0x6f')];var _0x527d5f=(_0x2efd8d[0x0][_0x0b70('0x6e')]+_0x2efd8d[0x0][_0x0b70('0x72')]+_0x2efd8d[0x0][_0x0b70('0x71')])/_0x2efd8d[0x0]['predictiveIntervalTotalCalls'];var _0x3fd963=_0x4ed1c1[_0x0b70('0x1e6')]/0x64;_0x4ed1c1[_0x0b70('0x75')]=_0x2f7778[0x0][_0x0b70('0x1ec')]||0x0;_0x4ed1c1['predictiveIntervalHitRate']=_0x527d5f>0x0?_0x527d5f:0x1;return _0x24f186[_0x0b70('0x1ed')](_0x2e2252,_0x5462af,_0x2ba0e5,_0x527d5f,_0x3fd963);})[_0x0b70('0x3f')](function(_0x21177d){return _0x58cd18(_0x21177d);})[_0x0b70('0xb2')](function(_0x8f0a02){return _0x243af8(msgResponse(_0x0b70('0x1ee'),_0x0b70('0x144'),JSON[_0x0b70('0x4e')](_0x8f0a02)));});}if(_0x4ed1c1['dialPredictiveOptimization']===_0x0b70('0x1e7')){return _0x24f186['getVoiceQueueRtPauses'](_0x4ed1c1['id'])['then'](function(_0x3c1992){var _0x21b2ac=_0x4ed1c1[_0x0b70('0x57')]-_0x3c1992[0x0][_0x0b70('0x1ec')];var _0x2830d9=_0x4ed1c1[_0x0b70('0x1df')]*0x3c;var _0x299a82=_0x2efd8d[0x0][_0x0b70('0x70')]+_0x2efd8d[0x0][_0x0b70('0x6f')];var _0x528de9=(_0x2efd8d[0x0][_0x0b70('0x6e')]+_0x2efd8d[0x0][_0x0b70('0x72')]+_0x2efd8d[0x0][_0x0b70('0x71')])/_0x2efd8d[0x0][_0x0b70('0x76')];var _0x2da082=_0x4ed1c1['dialPredictiveOptimizationPercentage']/0x64;_0x4ed1c1[_0x0b70('0x75')]=_0x3c1992[0x0][_0x0b70('0x1ec')]||0x0;_0x4ed1c1['predictiveIntervalHitRate']=_0x528de9>0x0?_0x528de9:0x1;return _0x24f186[_0x0b70('0x1ef')](_0x21b2ac,_0x2830d9,_0x299a82,_0x528de9,_0x2da082);})['then'](function(_0x47e1e2){return _0x58cd18(_0x47e1e2);})['catch'](function(_0x1f5940){return _0x243af8(msgResponse('[CatchErlangB]',_0x0b70('0x144'),JSON[_0x0b70('0x4e')](_0x1f5940)));});}}else{return _0x243af8(msgResponse(_0x0b70('0x1e8'),'Failure',_0x0b70('0x1e9')));}});};};Dialer['prototype'][_0x0b70('0x1e1')]=function(_0x4f8fd3){var _0xb8e859=this;return function(){var _0x539a95=0x0;var _0x1f0e97=Math[_0x0b70('0x1d2')](_0x4f8fd3['erlangCallToSecond']*0x3e8);if(_0x1f0e97>0x0){_0x1f0e97=_0x1f0e97<0x64?0x64:_0x1f0e97;loggerPredictive[_0x0b70('0x82')](_0x4f8fd3['name'],_0x0b70('0x1f0'),_0x1f0e97,_0x0b70('0x4f'));_0x4f8fd3[_0x0b70('0x90')]=setInterval(function(){_0xb8e859['handlePredictive'](_0x4f8fd3);loggerPredictiveCalls[_0x0b70('0x82')](_0x0b70('0x1f1'),_0x539a95+=0x1);},_0x1f0e97);}else{loggerPredictive[_0x0b70('0x82')](_0x4f8fd3[_0x0b70('0x43')],_0x0b70('0x1f2'));}};};Dialer[_0x0b70('0x1a')][_0x0b70('0x1f3')]=function(_0x27f52a,_0x573f40){var _0x55eab4=this;return function(_0x5909dc){if(_[_0x0b70('0x4b')](_0x5909dc)){if(_[_0x0b70('0xaf')](_0x573f40[_0x0b70('0xd1')])||!_0x573f40[_0x0b70('0x1f4')]){if(_0x27f52a[_0x0b70('0x61')]===_0x0b70('0x7')){_0x27f52a['queueStatusComplete']=_[_0x0b70('0x40')](_0x27f52a[_0x0b70('0x12d')])?!![]:_0x27f52a[_0x0b70('0x12d')];var _0x41d811=uuid['v4']();_0x55eab4['actions'][_0x41d811]=new Action(_0x27f52a,_0x573f40,_0x41d811);loggerBooked[_0x0b70('0x82')](_0x0b70('0x1f5'),_0x41d811,_0x0b70('0x1f6'),JSON[_0x0b70('0x4e')](_0x27f52a['queueStatusComplete']),'Queue:\x20',_0x27f52a[_0x0b70('0x43')]);if(_0x27f52a[_0x0b70('0x12d')]){_0x27f52a[_0x0b70('0x12d')]=![];_0x55eab4[_0x0b70('0x12a')][_0x55eab4[_0x0b70('0x25')][_0x41d811][_0x0b70('0xb6')]]=[];ami['Action']({'actionid':_0x41d811,'action':_0x0b70('0x1f7'),'queue':_0x27f52a[_0x0b70('0x43')]})[_0x0b70('0xb2')](function(){_0x55eab4[_0x0b70('0xb4')](_0x27f52a);_0x55eab4[_0x0b70('0xbe')]({'active':![],'ContactId':_0x55eab4[_0x0b70('0x25')][_0x41d811][_0x0b70('0xfa')],'ListId':_0x55eab4[_0x0b70('0x25')][_0x41d811][_0x0b70('0xd0')],'VoiceQueueId':_0x55eab4[_0x0b70('0x25')][_0x41d811][_0x0b70('0xfb')]||undefined,'CampaignId':_0x55eab4['actions'][_0x41d811]['CampaignId']||undefined})[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1f8')));delete _0x55eab4[_0x0b70('0x25')][_0x41d811];});}else{loggerBooked[_0x0b70('0x82')](_0x0b70('0x1f9'),JSON['stringify'](_0x27f52a[_0x0b70('0x12d')]),'Queue:\x20',_0x27f52a[_0x0b70('0x43')]);_0x55eab4[_0x0b70('0xb4')](_0x27f52a);_0x55eab4['rescheduleContact']({'active':![],'ContactId':_0x55eab4[_0x0b70('0x25')][_0x41d811][_0x0b70('0xfa')],'ListId':_0x55eab4[_0x0b70('0x25')][_0x41d811][_0x0b70('0xd0')],'VoiceQueueId':_0x55eab4[_0x0b70('0x25')][_0x41d811][_0x0b70('0xfb')]||undefined,'CampaignId':_0x55eab4[_0x0b70('0x25')][_0x41d811]['CampaignId']||undefined})[_0x0b70('0xb2')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x55eab4[_0x0b70('0x25')][_0x41d811];}}else{return _0x55eab4[_0x0b70('0x171')](_0x27f52a,_0x573f40);}}else{if(getDiff(_0x573f40[_0x0b70('0x1fa')])<_0x27f52a['dialRecallMeTimeout']*0x3c){if(_0x573f40[_0x0b70('0x15e')]&&!_0x573f40[_0x0b70('0x15e')][_0x0b70('0x1fb')]){_0x55eab4[_0x0b70('0x1e')]['run'](_0x573f40['id'])[_0x0b70('0x1a0')](function(){_0x55eab4[_0x0b70('0xb4')](_0x27f52a);});}else{_0x55eab4[_0x0b70('0xc0')]({'active':![]},_0x573f40['id'],0x1)[_0x0b70('0x1a0')](function(){_0x55eab4['updateOriginated'](_0x27f52a);});}}else{_0x27f52a['outboundReCallsDay']+=0x1;_0x55eab4[_0x0b70('0xb4')](_0x27f52a);if(_0x27f52a[_0x0b70('0x1fc')]){_0x55eab4[_0x0b70('0xbe')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x573f40[_0x0b70('0xfa')],'ListId':_0x573f40[_0x0b70('0xd0')],'VoiceQueueId':_0x573f40['VoiceQueueId']||undefined,'CampaignId':_0x573f40[_0x0b70('0xd2')]||undefined})[_0x0b70('0xb2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x55eab4[_0x0b70('0xca')](createObjHistory(_0x27f52a,_0x573f40,_0x0b70('0x1fd'),0x17,_0x0b70('0x1fe')))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0x1ff')));}else{_0x55eab4[_0x0b70('0xcf')](createObjHistory(_0x27f52a,_0x573f40,_0x0b70('0x200'),0x16,_0x0b70('0x201')),_0x0b70('0x202'),_0x0b70('0x203'));}}}}else{_0x27f52a[_0x0b70('0x204')]+=0x1;_0x55eab4['saveInDb'](createObjHistory(_0x27f52a,_0x573f40,_0x0b70('0x205'),0xd,_0x0b70('0x206')),_0x0b70('0x207'),_0x0b70('0x208'));throw _0x0b70('0x209');}};};Dialer['prototype'][_0x0b70('0x162')]=function(_0x3c4a5e){var _0xcff927=this;var _0x93083f=_0x3c4a5e[_0x0b70('0x20a')]-_0x3c4a5e[_0x0b70('0x98')]-_0x3c4a5e[_0x0b70('0xc3')];emitCampaignSummary(_0x3c4a5e);if(_0x93083f>0x0){if(_0x93083f>this['maxNumberOriginate']){_0x93083f=this['maxNumberOriginate'];}_0x3c4a5e['temp']+=_0x93083f;this['getContactDialerIvr'](_0x3c4a5e['id'],_0x93083f,_0x3c4a5e['dialOrderByScheduledAt'],_0x3c4a5e)[_0x0b70('0x3f')](function(_0x2b4cd1){_0x3c4a5e['temp']-=_0x93083f;_0x3c4a5e['temp']=_0x3c4a5e[_0x0b70('0xc3')]>0x0?_0x3c4a5e[_0x0b70('0xc3')]:0x0;if(!checkContactEmpty(_0x2b4cd1)){_0x3c4a5e[_0x0b70('0x41')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x0b70('0x82')]('[getContactCampaign2][Empty]'+_0x3c4a5e[_0x0b70('0x43')]);}else{_0x3c4a5e['originated']+=_0x2b4cd1[_0x0b70('0x97')];_0x3c4a5e[_0x0b70('0x41')]=_0x0b70('0x20b');for(var _0x493f72=0x0;_0x493f72<_0x2b4cd1[_0x0b70('0x97')];_0x493f72+=0x1){_0x3c4a5e[_0x0b70('0x20c')]+=0x1;if(_['isNil'](_0x2b4cd1[_0x493f72])||_['isNil'](_0x2b4cd1[_0x493f72][_0x0b70('0x174')])||_[_0x0b70('0xaf')](_0x2b4cd1[_0x493f72][_0x0b70('0x174')][_0x0b70('0x175')])){_0xcff927[_0x0b70('0x20d')](_0x0b70('0x20e'),_0x3c4a5e,_0x2b4cd1[_0x493f72]);}else{_0xcff927[_0x0b70('0xbb')](_[_0x0b70('0x12c')](_0x2b4cd1[_0x493f72],['CampaignId','Contact.phone']))['then'](_0xcff927[_0x0b70('0x1f3')](_0x3c4a5e,_0x2b4cd1[_0x493f72]))[_0x0b70('0xb2')](_0xcff927['loggerHandler']('[actionOriginateIvr]\x20',_0x3c4a5e));}}}})[_0x0b70('0xb2')](loggerGetContactDialer(_0x0b70('0x20f'),_0x3c4a5e,_0x93083f));}};Dialer['prototype']['handlePower']=function(_0x2ebcdc,_0x4fbdc4){var _0x54b350=this;var _0x4fc756=[];var _0x585051=_0x4fbdc4>=0x1?_0x4fbdc4:0x1;if(_0x2ebcdc[_0x0b70('0x61')]===_0x0b70('0x7')){_0x585051=0x1;}var _0x41bc0f=Math[_0x0b70('0x1d2')](_0x2ebcdc['available']*_0x585051)-_0x2ebcdc[_0x0b70('0x98')]-_0x2ebcdc[_0x0b70('0xc3')];emitVoiceQueueSummary(_0x2ebcdc);if(_0x2ebcdc['dialLimitQueue']>0x0){var _0x2ca284=_0x2ebcdc[_0x0b70('0x210')]-_0x2ebcdc[_0x0b70('0x98')]-_0x2ebcdc[_0x0b70('0x5c')]-_0x2ebcdc[_0x0b70('0xc3')]-_0x2ebcdc[_0x0b70('0x58')];if(_0x41bc0f>_0x2ca284){_0x41bc0f=_0x2ca284;}}if(_0x41bc0f>0x0){if(_0x2ebcdc['dialMethod']===_0x0b70('0x7')){_0x41bc0f=0x1;}if(_0x41bc0f>this[_0x0b70('0x23')]){_0x41bc0f=this[_0x0b70('0x23')];}_0x2ebcdc[_0x0b70('0xc3')]+=_0x41bc0f;for(var _0x52533d in this[_0x0b70('0x21')]){if(typeof this[_0x0b70('0x21')][_0x52533d]!==_0x0b70('0xae')){if(this[_0x0b70('0x21')][_0x52533d][_0x0b70('0xa8')]===_0x0b70('0x211')&&this[_0x0b70('0x21')][_0x52533d][_0x0b70('0xd6')]===_0x0b70('0xd7')){_0x4fc756[_0x0b70('0x12b')](this[_0x0b70('0x21')][_0x52533d]['id']);}}}this[_0x0b70('0xc2')](_0x2ebcdc['id'],_0x4fc756,_0x41bc0f,_0x2ebcdc[_0x0b70('0x212')],_0x2ebcdc)['then'](function(_0x271f7f){_0x2ebcdc['temp']-=_0x41bc0f;_0x2ebcdc[_0x0b70('0xc3')]=_0x2ebcdc[_0x0b70('0xc3')]>0x0?_0x2ebcdc[_0x0b70('0xc3')]:0x0;if(!checkContactEmpty(_0x271f7f)){_0x54b350['countReScheduled'](_0x2ebcdc)['then'](sendMessageReschedule(_0x2ebcdc))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0xb9')));}else{_0x2ebcdc[_0x0b70('0x98')]+=_0x271f7f[_0x0b70('0x97')];_0x2ebcdc['message']=_0x2ebcdc[_0x0b70('0x61')]==='booked'?_0x0b70('0x17c'):_0x0b70('0x20b');for(var _0x1a9775=0x0;_0x1a9775<_0x271f7f[_0x0b70('0x97')];_0x1a9775+=0x1){if(_[_0x0b70('0xaf')](_0x271f7f[_0x1a9775])||_['isNil'](_0x271f7f[_0x1a9775][_0x0b70('0x174')])||_[_0x0b70('0xaf')](_0x271f7f[_0x1a9775][_0x0b70('0x174')]['phone'])){_0x54b350[_0x0b70('0x20d')](_0x0b70('0x20e'),_0x2ebcdc,_0x271f7f[_0x1a9775]);}else{_0x54b350['checkIsBlackList'](_[_0x0b70('0x12c')](_0x271f7f[_0x1a9775],[_0x0b70('0xfb'),_0x0b70('0x213')]))[_0x0b70('0x3f')](_0x54b350[_0x0b70('0x1f3')](_0x2ebcdc,_0x271f7f[_0x1a9775]))['catch'](_0x54b350[_0x0b70('0x214')](_0x0b70('0x20e'),_0x2ebcdc));}}}})['catch'](loggerGetContactDialer(_0x0b70('0x215'),_0x2ebcdc,_0x41bc0f));}};Dialer[_0x0b70('0x1a')][_0x0b70('0x90')]=function(_0x4ffd5e){if(_0x4ffd5e['dialLimitQueue']>0x0){var _0x6db219=_0x4ffd5e[_0x0b70('0x210')]-_0x4ffd5e[_0x0b70('0x98')]-_0x4ffd5e[_0x0b70('0x5c')];if(_0x6db219>0x0){this['tryOriginatePredictive'](_0x4ffd5e);}else{loggerPredictiveCalls[_0x0b70('0x82')](_0x0b70('0x216'));}}else{this[_0x0b70('0x217')](_0x4ffd5e);}};Dialer[_0x0b70('0x1a')][_0x0b70('0x217')]=function(_0x499028){var _0x16bf3f=this;var _0x1dea19=[];_0x499028[_0x0b70('0x98')]+=0x1;for(var _0x3ac1df in this[_0x0b70('0x21')]){if(typeof this[_0x0b70('0x21')][_0x3ac1df]!=='undefined'){if(this[_0x0b70('0x21')][_0x3ac1df][_0x0b70('0xa8')]===_0x0b70('0x211')&&this[_0x0b70('0x21')][_0x3ac1df][_0x0b70('0xd6')]===_0x0b70('0xd7')){_0x1dea19['push'](this[_0x0b70('0x21')][_0x3ac1df]['id']);}}}this[_0x0b70('0xc2')](_0x499028['id'],_0x1dea19,0x1,_0x499028[_0x0b70('0x212')],_0x499028)[_0x0b70('0x3f')](function(_0x4abad5){if(!checkContactEmpty(_0x4abad5)){checkContactLowerLimitOriginate(_0x499028,0x1,0x0);_0x16bf3f[_0x0b70('0xb7')](_0x499028)[_0x0b70('0x3f')](sendMessageReschedule(_0x499028))[_0x0b70('0xb2')](loggerCatch(_0x0b70('0xb9')));}else{_0x499028[_0x0b70('0x41')]=_0x0b70('0x20b');if(_[_0x0b70('0xaf')](_0x4abad5[0x0])||_[_0x0b70('0xaf')](_0x4abad5[0x0]['Contact'])||_[_0x0b70('0xaf')](_0x4abad5[0x0][_0x0b70('0x174')]['phone'])){_0x16bf3f['emptyContact'](_0x0b70('0x20e'),_0x499028,_0x4abad5[0x0]);}else{_0x16bf3f[_0x0b70('0xba')](_[_0x0b70('0x12c')](_0x4abad5[0x0],[_0x0b70('0xfb'),'Contact.phone']))[_0x0b70('0x3f')](_0x16bf3f[_0x0b70('0x1f3')](_0x499028,_0x4abad5[0x0]))[_0x0b70('0xb2')](_0x16bf3f[_0x0b70('0x214')](_0x0b70('0x218'),_0x499028));}}})[_0x0b70('0xb2')](loggerGetContactDialer(_0x0b70('0x219'),_0x499028,0x1));emitVoiceQueueSummary(_0x499028);};Dialer[_0x0b70('0x1a')]['abandonmentRate']=function(_0x28afcc,_0x3b573f,_0x31e059,_0x1ed532,_0x543cce,_0xd81c9c){loggerPredictive[_0x0b70('0x82')](_0x0b70('0x21a'));loggerPredictive[_0x0b70('0x82')]('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',_0x28afcc);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x21b'),_0x3b573f);loggerPredictive[_0x0b70('0x82')]('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',_0x31e059);loggerPredictive['info'](_0x0b70('0x21c'),_0x1ed532);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x21d'),_0x543cce);loggerPredictive['info'](_0x0b70('0x87'));return new BPromise(function(_0x46fbc6,_0x133268){if(_0x28afcc<=0x0||isNaN(_0x28afcc)){return _0x133268(msgResponse(_0x0b70('0x21e'),_0x0b70('0x4d'),_0x0b70('0x21f')+_0x28afcc));}if(_0x31e059<=0x0||isNaN(_0x31e059)){return _0x133268(msgResponse(_0x0b70('0x21e'),_0x0b70('0x4d'),_0x0b70('0x220')+_0x31e059));}if(_0x1ed532<=0x0||isNaN(_0x1ed532)){return _0x133268(msgResponse(_0x0b70('0x21e'),_0x0b70('0x4d'),_0x0b70('0x221')+_0x1ed532));}if(_0x3b573f<=0x0||isNaN(_0x3b573f)){return _0x133268(msgResponse('[abandonmentRate]',_0x0b70('0x4d'),_0x0b70('0x222')+_0x3b573f));}if(_0x543cce<=0x0||isNaN(_0x543cce)){return _0x133268(msgResponse('[abandonmentRate]','Error',_0x0b70('0x223')+_0x543cce));}_0xd81c9c=_0xd81c9c||0x0;var _0x14f0c4=0x1/_0x31e059;var _0x4c5063=0x0;var _0x538bd1=0x0;var _0x280dda=0x0;var _0x125f2c=0x0;for(var _0x36bccb=0x0;_0x280dda<_0x543cce;_0x36bccb+=0x1){_0x538bd1=_0x36bccb/_0x3b573f;_0x4c5063=(_0x1ed532*_0x538bd1+_0xd81c9c)/_0x14f0c4;_0x280dda=erlangb(_0x4c5063,_0x28afcc);_0x125f2c=_0x4c5063/_0x28afcc*(0x1-erlangb(_0x4c5063,_0x28afcc));}return _0x46fbc6({'erlangCalls':_0x36bccb,'erlangCallToSecond':_0x3b573f/_0x36bccb,'erlangAbandonmentRate':_0x280dda,'erlangBusyFactor':_0x125f2c});});};Dialer['prototype'][_0x0b70('0x1ef')]=function(_0x14e5fd,_0x4661ff,_0x59a7c3,_0x15e8b1,_0x22fdd1,_0x320f4a){loggerPredictive[_0x0b70('0x82')](_0x0b70('0x224'));loggerPredictive['info']('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',_0x14e5fd);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x21b'),_0x4661ff);loggerPredictive['info'](_0x0b70('0x225'),_0x59a7c3);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x21c'),_0x15e8b1);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x226'),_0x22fdd1);loggerPredictive[_0x0b70('0x82')](_0x0b70('0x87'));return new BPromise(function(_0x51fcfa,_0x56472f){if(_0x14e5fd<=0x0||isNaN(_0x14e5fd)){return _0x56472f(msgResponse('[busyFactor]',_0x0b70('0x4d'),'m\x20=\x20'+_0x14e5fd));}if(_0x59a7c3<=0x0||isNaN(_0x59a7c3)){return _0x56472f(msgResponse(_0x0b70('0x227'),_0x0b70('0x4d'),'Ts\x20=\x20'+_0x59a7c3));}if(_0x15e8b1<=0x0||isNaN(_0x15e8b1)){return _0x56472f(msgResponse(_0x0b70('0x227'),'Error',_0x0b70('0x221')+_0x15e8b1));}if(_0x4661ff<=0x0||isNaN(_0x4661ff)){return _0x56472f(msgResponse(_0x0b70('0x227'),_0x0b70('0x4d'),'interval\x20=\x20'+_0x4661ff));}if(_0x22fdd1<=0x0||isNaN(_0x22fdd1)){return _0x56472f(msgResponse(_0x0b70('0x227'),_0x0b70('0x4d'),_0x0b70('0x228')+_0x22fdd1));}_0x320f4a=_0x320f4a||0x0;var _0x1cce17=0x1/_0x59a7c3;var _0x47ed41=0x0;var _0x461715=0x0;var _0x47d56=0x0;var _0x21c32c=0x0;for(var _0x39527b=0x0;_0x21c32c<_0x22fdd1;_0x39527b+=0x1){_0x461715=_0x39527b/_0x4661ff;_0x47ed41=(_0x15e8b1*_0x461715+_0x320f4a)/_0x1cce17;_0x47d56=erlangb(_0x47ed41,_0x14e5fd);_0x21c32c=_0x47ed41/_0x14e5fd*(0x1-erlangb(_0x47ed41,_0x14e5fd));}return _0x51fcfa({'erlangCalls':_0x39527b,'erlangCallToSecond':_0x4661ff/_0x39527b,'erlangAbandonmentRate':_0x47d56,'erlangBusyFactor':_0x21c32c});});};module[_0x0b70('0x229')]=Dialer; \ No newline at end of file +var _0xfdfb=['erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','waiting','NOT_ACTIVE','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','sequence','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','catch','prototype','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','Success','isTrunkReachable','SIP/%s','status','reachable','uniqueid','isNil','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr]','MACHINE','custom:amd','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','roundrobin','actionid','locked','stateinterface','queueBooked','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','idHopper','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','isArray','push','Action','command','interval','content','indexOf','true','iftime\x20%s,%s','all','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','predictive','Queue','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','handleIvr','dialActive','dialTimezone','dialPreviewRecallmeReminder','checkPreviewRecallReminder','dialGlobalInterval','\x5cw{0,','pow','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','isSuccess','response','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','voicePause','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','maxNumberOriginate','getContactDialerIvr','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\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','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperBlack','../rpc/setting','./final','./queueCallerAbandon','./hangup','127.0.0.1','rrmemory','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\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','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdfb,0x187));var _0xbfdf=function(_0x1affd0,_0x3e2c5e){_0x1affd0=_0x1affd0-0x0;var _0x30e8d7=_0xfdfb[_0x1affd0];return _0x30e8d7;};'use strict';var util=require(_0xbfdf('0x0'));var _=require(_0xbfdf('0x1'));var BPromise=require(_0xbfdf('0x2'));var uuid=require('uuid');var moment=require(_0xbfdf('0x3'));var rr=require('rr');var md5=require(_0xbfdf('0x4'));var Redis=require(_0xbfdf('0x5'));var ut=require(_0xbfdf('0x6'));var config=require(_0xbfdf('0x7'));var logger=require('../../../config/logger')(_0xbfdf('0x8'));var loggerBooked=require(_0xbfdf('0x9'))(_0xbfdf('0xa'));var loggerPredictive=require(_0xbfdf('0x9'))('predictive');var loggerPredictiveCalls=require(_0xbfdf('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xbfdf('0x9'))(_0xbfdf('0xb'));var ami=require(_0xbfdf('0xc'));config[_0xbfdf('0xd')]=_[_0xbfdf('0xe')](config[_0xbfdf('0xd')],{'host':_0xbfdf('0xf'),'port':0x18eb});var io=require(_0xbfdf('0x10'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xbfdf('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xbfdf('0x12'));var Action=require('./action');var History=require('./history');var Final=require(_0xbfdf('0x13'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xbfdf('0x14'));var Hangup=require(_0xbfdf('0x15'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xbfdf('0x16');var strategy={'rrmemory':_0xbfdf('0x17'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xbfdf('0x18')]=function(_0x5c6c77){this[_0xbfdf('0x19')]=this[_0xbfdf('0x19')]?this[_0xbfdf('0x19')][_0xbfdf('0x1a')](_0x5c6c77):_0x5c6c77();};function Dialer(_0x39a9c2,_0x507e3d){this['sequence']=new Sequence();this[_0xbfdf('0x1b')]=_0x507e3d;this[_0xbfdf('0x1c')]=_0x39a9c2['voiceQueues'];this[_0xbfdf('0x1d')]=_0x39a9c2[_0xbfdf('0x1d')];this['agents']=_0x39a9c2[_0xbfdf('0x1e')];this[_0xbfdf('0x1f')]=_0x39a9c2[_0xbfdf('0x1f')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xbfdf('0x20')]={};this[_0xbfdf('0x21')]={};this[_0xbfdf('0x22')]={};this[_0xbfdf('0x23')]={};this[_0xbfdf('0x24')]={};this['startPredictive']={};this[_0xbfdf('0x25')]={};this[_0xbfdf('0x26')]={};this['queueBooked']={};this[_0xbfdf('0x27')]={};ami['on']('agentconnect',this[_0xbfdf('0x28')][_0xbfdf('0x29')](this));ami['on'](_0xbfdf('0x2a'),this[_0xbfdf('0x2b')][_0xbfdf('0x29')](this));ami['on'](_0xbfdf('0x2c'),this[_0xbfdf('0x2d')][_0xbfdf('0x29')](this));ami['on']('agentcomplete',this[_0xbfdf('0x2e')]['bind'](this));ami['on'](_0xbfdf('0x2f'),this['syncQueueSummary'][_0xbfdf('0x29')](this));ami['on'](_0xbfdf('0x30'),this[_0xbfdf('0x31')]['bind'](this));ami['on'](_0xbfdf('0x32'),this[_0xbfdf('0x33')][_0xbfdf('0x29')](this));ami['on'](_0xbfdf('0x34'),this[_0xbfdf('0x35')][_0xbfdf('0x29')](this));ami['on']('queuemember',this[_0xbfdf('0x36')][_0xbfdf('0x29')](this));ami['on'](_0xbfdf('0x37'),this[_0xbfdf('0x38')][_0xbfdf('0x29')](this));this[_0xbfdf('0x39')]();this[_0xbfdf('0x3a')]();RpcSetting[_0xbfdf('0x3b')]()[_0xbfdf('0x3c')](function(_0xf2b3bf){previewRecallmeReminderInterval=_0xf2b3bf[_0xbfdf('0x3d')];});}function isNotNull(_0x5a33c6){return _0x5a33c6!==null&&!_['isUndefined'](_0x5a33c6);}function checkIsLoggedIn(_0x142d0a,_0x57922f){return function(){if(_0x57922f<=0x0){_0x142d0a[_0xbfdf('0x3e')]=_0xbfdf('0x3f');throw _0x142d0a[_0xbfdf('0x40')]+_0xbfdf('0x41');}};}function isActive(_0x474516){return _0x474516;}function checkIsActive(_0x320526,_0x194329){return function(){if(!isActive(_0x194329)){_0x320526[_0xbfdf('0x3e')]='NOT_ACTIVE';throw _0x320526[_0xbfdf('0x40')]+_0xbfdf('0x42');}};}function checkInterval(_0x4cba38){return function(){if(!isNotNull(_0x4cba38[_0xbfdf('0x43')])){_0x4cba38[_0xbfdf('0x3e')]='INTERVAL_IS_NULL';throw _0x4cba38[_0xbfdf('0x40')]+_0xbfdf('0x44');}if(!isNotNull(_0x4cba38[_0xbfdf('0x43')]['Intervals'])){_0x4cba38[_0xbfdf('0x3e')]=_0xbfdf('0x45');throw _0x4cba38[_0xbfdf('0x40')]+_0xbfdf('0x44');}if(!isNotNull(_[_0xbfdf('0x46')](_0x4cba38[_0xbfdf('0x43')][_0xbfdf('0x47')]))){_0x4cba38[_0xbfdf('0x3e')]=_0xbfdf('0x45');throw _0x4cba38[_0xbfdf('0x40')]+_0xbfdf('0x44');}};}function msgResponse(_0x18f80b,_0x99e0bb,_0x3f1781){return{'action':_0x18f80b,'response':_0x99e0bb,'message':_0x3f1781,'stack':_0x3f1781};}function myreject(_0x3ec48f){return function(_0x445498){return _0x3ec48f(msgResponse(_0xbfdf('0x48'),'Error',JSON[_0xbfdf('0x49')](_0x445498)));};}function getSeconds(_0x1b9ada,_0x5c33a8){var _0x1dbbc5=moment(_0x1b9ada)[_0xbfdf('0x4a')](0x0);var _0x39eb43=moment(_0x5c33a8)[_0xbfdf('0x4a')](0x0);return _0x1dbbc5['diff'](_0x39eb43,_0xbfdf('0x4b'));}function emit(_0x205363,_0x554d77,_0x4db06b){io['to'](_0x205363)[_0xbfdf('0x4c')](_0x554d77,_0x4db06b);}function emitVoiceQueueSummary(_0x1f1e7e){if(_0x1f1e7e['type']===_0xbfdf('0x4d')){var _0x24d241={'id':_0x1f1e7e['id'],'name':_0x1f1e7e[_0xbfdf('0x40')],'strategy':_0x1f1e7e[_0xbfdf('0x4e')],'answered':_0x1f1e7e[_0xbfdf('0x4f')],'available':_0x1f1e7e[_0xbfdf('0x50')],'loggedIn':_0x1f1e7e[_0xbfdf('0x51')],'pTalking':_0x1f1e7e[_0xbfdf('0x52')],'sumBillable':_0x1f1e7e[_0xbfdf('0x53')],'sumDuration':_0x1f1e7e[_0xbfdf('0x54')],'sumHoldTime':_0x1f1e7e[_0xbfdf('0x55')]||0x0,'talking':_0x1f1e7e['talking'],'total':_0x1f1e7e[_0xbfdf('0x56')],'type':_0x1f1e7e[_0xbfdf('0x57')],'unmanaged':_0x1f1e7e[_0xbfdf('0x58')],'abandoned':_0x1f1e7e[_0xbfdf('0x59')],'waiting':_0x1f1e7e['waiting'],'loggedInDb':_0x1f1e7e[_0xbfdf('0x5a')],'dialActive':_0x1f1e7e['dialActive'],'dialMethod':_0x1f1e7e['dialMethod'],'dialOriginateCallerIdName':_0x1f1e7e[_0xbfdf('0x5b')],'dialOriginateCallerIdNumber':_0x1f1e7e[_0xbfdf('0x5c')],'dialOriginateTimeout':_0x1f1e7e[_0xbfdf('0x5d')],'dialPrefix':_0x1f1e7e['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1f1e7e[_0xbfdf('0x5e')],'outboundAnswerCallsDay':_0x1f1e7e[_0xbfdf('0x5f')],'outboundBlacklistCallsDay':_0x1f1e7e[_0xbfdf('0x60')],'outboundBusyCallsDay':_0x1f1e7e['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1f1e7e[_0xbfdf('0x61')],'outboundDropCallsDayACS':_0x1f1e7e[_0xbfdf('0x62')],'outboundDropCallsDayCallersExit':_0x1f1e7e[_0xbfdf('0x63')],'outboundDropCallsDayTimeout':_0x1f1e7e[_0xbfdf('0x64')],'outboundNoAnswerCallsDay':_0x1f1e7e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1f1e7e[_0xbfdf('0x65')],'outboundOriginateFailureCallsDay':_0x1f1e7e[_0xbfdf('0x66')],'outboundReCallsDay':_0x1f1e7e[_0xbfdf('0x67')],'outboundRejectCallsDay':_0x1f1e7e['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1f1e7e['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x1f1e7e[_0xbfdf('0x68')],'predictiveIntervalAvgHoldtime':_0x1f1e7e[_0xbfdf('0x69')],'predictiveIntervalAvgTalktime':_0x1f1e7e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1f1e7e['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1f1e7e[_0xbfdf('0x6a')],'predictiveIntervalErlangCalls':_0x1f1e7e[_0xbfdf('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x1f1e7e[_0xbfdf('0x6c')],'predictiveIntervalHitRate':_0x1f1e7e['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x1f1e7e[_0xbfdf('0x6d')],'predictiveIntervalPauses':_0x1f1e7e[_0xbfdf('0x6e')],'predictiveIntervalAvailable':_0x1f1e7e[_0xbfdf('0x6f')],'predictiveIntervalTotalCalls':_0x1f1e7e[_0xbfdf('0x70')],'message':_0x1f1e7e[_0xbfdf('0x3e')],'originated':_0x1f1e7e[_0xbfdf('0x71')],'erlangCalls':_0x1f1e7e[_0xbfdf('0x72')],'erlangCallToSecond':_0x1f1e7e[_0xbfdf('0x73')],'erlangAbandonmentRate':_0x1f1e7e['erlangAbandonmentRate'],'erlangBusyFactor':_0x1f1e7e[_0xbfdf('0x74')],'startPredictive':_0x1f1e7e[_0xbfdf('0x75')],'startProgressive':_0x1f1e7e['startProgressive']};if(_0x1f1e7e[_0xbfdf('0x76')]){_0x24d241[_0xbfdf('0x76')]={'id':_0x1f1e7e[_0xbfdf('0x76')]['id'],'name':_0x1f1e7e[_0xbfdf('0x76')]['name'],'active':_0x1f1e7e[_0xbfdf('0x76')][_0xbfdf('0x77')],'callerid':_0x1f1e7e['Trunk'][_0xbfdf('0x78')]};}if(_0x1f1e7e[_0xbfdf('0x43')]){_0x24d241[_0xbfdf('0x43')]={'id':_0x1f1e7e[_0xbfdf('0x43')]['id'],'name':_0x1f1e7e[_0xbfdf('0x43')][_0xbfdf('0x40')]};}var _0x41003d=md5(JSON[_0xbfdf('0x49')](_0x24d241));if(_0x1f1e7e[_0xbfdf('0x4')]!==_0x41003d){_0x1f1e7e[_0xbfdf('0x4')]=_0x41003d;emit(util[_0xbfdf('0x79')](_0xbfdf('0x7a'),_0x24d241['name']),'voice_queue:save',_0x24d241);}}}function emitCampaignSummary(_0xeee28e){if(_0xeee28e[_0xbfdf('0x57')]===_0xbfdf('0x7b')){emit(util[_0xbfdf('0x79')](_0xbfdf('0x7c'),_0xeee28e[_0xbfdf('0x40')]),_0xbfdf('0x7d'),_0xeee28e);}}function checkGetDataPredictive(_0x46d1e9){if(isNotNull(_0x46d1e9)&&!_[_0xbfdf('0x46')](_0x46d1e9)){loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x7f'));loggerPredictive[_0xbfdf('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46d1e9[_0xbfdf('0x70')]);loggerPredictive[_0xbfdf('0x7e')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46d1e9[_0xbfdf('0x68')]);loggerPredictive[_0xbfdf('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46d1e9[_0xbfdf('0x6a')]);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x80'),_0x46d1e9[_0xbfdf('0x81')]);loggerPredictive[_0xbfdf('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46d1e9[_0xbfdf('0x69')]);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x82'),_0x46d1e9['predictiveIntervalAvgTalktime']);loggerPredictive[_0xbfdf('0x7e')]('---------------------------');if(_0x46d1e9[_0xbfdf('0x70')]>0x0){if(!_[_0xbfdf('0x83')](_0x46d1e9['predictiveIntervalAvgTalktime'])&&_0x46d1e9[_0xbfdf('0x84')]>0x0){return!![];}loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x85'));if(!_[_0xbfdf('0x83')](_0x46d1e9[_0xbfdf('0x69')])&&_0x46d1e9[_0xbfdf('0x69')]>0x0){return!![];}loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x86'));}else{loggerPredictive[_0xbfdf('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0xbfdf('0x87'));}return![];}function mergeDataErlangB(_0x223aac){return function(_0xfe793){loggerPredictive['info'](_0xbfdf('0x88'));loggerPredictive[_0xbfdf('0x7e')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfe793[_0xbfdf('0x72')]);loggerPredictive['info'](_0xbfdf('0x89'),_0xfe793[_0xbfdf('0x73')]);loggerPredictive['info'](_0xbfdf('0x8a'),_0xfe793[_0xbfdf('0x8b')]);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x8c'),_0xfe793[_0xbfdf('0x74')]);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x8a'),_0xfe793[_0xbfdf('0x8b')]);loggerPredictive['info'](_0xbfdf('0x8d'));_[_0xbfdf('0x8e')](_0x223aac,_0xfe793);};}function getDiff(_0x2c16f0){var _0x519b84=moment()['milliseconds'](0x0);var _0x1c1989=moment(_0x2c16f0)[_0xbfdf('0x4a')](0x0);return _0x519b84[_0xbfdf('0x8f')](_0x1c1989,_0xbfdf('0x4b'));}function ifInterval(_0x5338d2,_0x25bf23){if(_['isUndefined'](_0x25bf23)){return![];}return getDiff(_0x25bf23)<_0x5338d2*0x3c;}function freeVariablesPredictive(_0x4e0925){if(isNotNull(_0x4e0925)){if(!_[_0xbfdf('0x83')](_0x4e0925[_0xbfdf('0x25')])){_0x4e0925[_0xbfdf('0x25')]=undefined;loggerPredictive[_0xbfdf('0x7e')](_0x4e0925[_0xbfdf('0x40')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xbfdf('0x83')](_0x4e0925[_0xbfdf('0x75')])){_0x4e0925[_0xbfdf('0x75')]=undefined;loggerPredictive['info'](_0x4e0925[_0xbfdf('0x40')],_0xbfdf('0x90'));}if(!_['isUndefined'](_0x4e0925[_0xbfdf('0x91')])){clearInterval(_0x4e0925['handlePredictive']);_0x4e0925[_0xbfdf('0x91')]=undefined;loggerPredictive[_0xbfdf('0x7e')](_0x4e0925[_0xbfdf('0x40')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x3af444,_0x2128ce){if(_0x2128ce===0x0){return 0x0;}var _0x35166a=0x1;for(var _0x531948=0x1;_0x531948<=_0x2128ce;_0x531948+=0x1){_0x35166a=0x1+_0x35166a*_0x531948/_0x3af444;}return 0x1/_0x35166a;}function isVoiceQueueOutbound(_0x3cc6a9){return _0x3cc6a9===_0xbfdf('0x4d');}function isNotPreview(_0xe4aa9d){return _0xe4aa9d!==_0xbfdf('0x1b');}function isCampaignIvr(_0x4109ae){return _0x4109ae===_0xbfdf('0x7b');}function getCallerId(_0x5b696c,_0x5de02c,_0x23eb16){if(!_[_0xbfdf('0x83')](_0x23eb16)&&typeof _0x23eb16===_0xbfdf('0x92')&&!_['isEmpty'](_0x23eb16)){if(!_['isUndefined'](_0x5de02c)&&typeof _0x5de02c===_0xbfdf('0x92')&&!_[_0xbfdf('0x46')](_0x5de02c)){return util[_0xbfdf('0x79')](_0xbfdf('0x93'),_0x5de02c,_0x23eb16);}return util[_0xbfdf('0x79')](_0xbfdf('0x93'),_0x23eb16,_0x23eb16);}if(!_['isUndefined'](_0x5b696c)&&typeof _0x5b696c===_0xbfdf('0x92')&&!_[_0xbfdf('0x46')](_0x5b696c)){return _0x5b696c;}return _0xbfdf('0x94');}function loggerCatchQueueSummary(_0x482f79,_0x313c69){return function(_0x2a4f7d){freeVariablesPredictive(_0x313c69);emitVoiceQueueSummary(_0x313c69);emitCampaignSummary(_0x313c69);loggerSyncQueueSummary['error'](_0x482f79,util[_0xbfdf('0x95')](_0x2a4f7d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5a55df,_0x950ffd){return function(_0x12d4de){loggerPredictive['error'](_0x950ffd[_0xbfdf('0x40')],_0x5a55df);loggerPredictive[_0xbfdf('0x96')](_0x12d4de[_0xbfdf('0x97')]);freeVariablesPredictive(_0x950ffd);};}function loggerCatch(_0x57e0f1){return function(_0x1af995){logger[_0xbfdf('0x96')](_0x57e0f1,util[_0xbfdf('0x95')](_0x1af995,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5c44ca){return _0x5c44ca&&!_['isUndefined'](_0x5c44ca)&&_0x5c44ca[_0xbfdf('0x98')]>0x0;}function decremetOriginate(_0x24e8f3){if(!_[_0xbfdf('0x83')](_0x24e8f3)&&_0x24e8f3!==null){if(typeof _0x24e8f3[_0xbfdf('0x71')]!==_0xbfdf('0x99')){if(_0x24e8f3[_0xbfdf('0x71')]>0x0){_0x24e8f3[_0xbfdf('0x71')]-=0x1;}else{logger['error'](_0xbfdf('0x9a'));}}}else{logger[_0xbfdf('0x96')](_0xbfdf('0x9b'));}}function checkContactLowerLimitOriginate(_0x3c2a5f,_0x65ed88,_0x38d084){if(_0x65ed88>_0x38d084){for(var _0x5c449e=0x0;_0x5c449e<_0x65ed88-_0x38d084;_0x5c449e+=0x1){decremetOriginate(_0x3c2a5f);}}}function loggerGetContactDialer(_0x3a9dff,_0x137810,_0x25c9c5){return function(_0x59c79b){checkContactLowerLimitOriginate(_0x137810,_0x25c9c5,0x0);logger[_0xbfdf('0x96')](_0x3a9dff,util[_0xbfdf('0x95')](_0x59c79b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x29891b){return function(_0xa662a6){if(isNotNull(_0xa662a6)&&isNotNull(_0xa662a6[0x0])){if(_0xa662a6[0x0][_0xbfdf('0x9c')]>0x0){_0x29891b['message']=_0xbfdf('0x9d');logger['info'](_0xbfdf('0x9e')+_0x29891b[_0xbfdf('0x40')],_0xa662a6[0x0][_0xbfdf('0x9c')],_0xbfdf('0x9f'));}else{_0x29891b['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xbfdf('0xa0')+_0x29891b[_0xbfdf('0x40')]);}}};}function notSendMessagesQueue(_0x58bbe9){if(_0x58bbe9[_0xbfdf('0xa1')]){freeVariablesPredictive(_0x58bbe9);if(_0x58bbe9['originated']===0x0&&_0x58bbe9[_0xbfdf('0xa2')]===0x0&&_0x58bbe9[_0xbfdf('0xa3')]===0x0&&(_0x58bbe9[_0xbfdf('0x52')]||0x0)===0x0){_0x58bbe9['sendMessageOneNotActive']=![];_0x58bbe9[_0xbfdf('0x50')]=0x0;_0x58bbe9[_0xbfdf('0x3e')]=_0xbfdf('0xa4');loggerSyncQueueSummary[_0xbfdf('0x96')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x58bbe9[_0xbfdf('0x40')],_0xbfdf('0xa5'));}else{_0x58bbe9[_0xbfdf('0x3e')]=_0xbfdf('0xa6');loggerSyncQueueSummary[_0xbfdf('0x96')](_0xbfdf('0xa7'),_0x58bbe9[_0xbfdf('0x40')],_0xbfdf('0xa8'));}emitVoiceQueueSummary(_0x58bbe9);}}function notSendMessagesCampaign(_0x221e10){if(_0x221e10[_0xbfdf('0xa1')]){if(_0x221e10[_0xbfdf('0x71')]===0x0){_0x221e10[_0xbfdf('0xa1')]=![];_0x221e10[_0xbfdf('0x3e')]=_0xbfdf('0xa4');loggerSyncQueueSummary[_0xbfdf('0x96')](_0xbfdf('0xa9'),_0x221e10[_0xbfdf('0x40')],_0xbfdf('0xa5'));}else{_0x221e10[_0xbfdf('0x3e')]=_0xbfdf('0xa6');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x221e10['name'],_0xbfdf('0xa8'));}emitCampaignSummary(_0x221e10);}}function createObjHistory(_0x461e5a,_0x1f5f3f,_0x575bdb,_0x3bd807,_0x5e181a){_0x461e5a[_0xbfdf('0x3e')]=_0x575bdb;var _0x4b4b2e=new Action(_0x461e5a,_0x1f5f3f);var _0x572f64=new History(_0x4b4b2e);_0x572f64[_0xbfdf('0xaa')]=_0x3bd807;_0x572f64[_0xbfdf('0xab')]=_0x5e181a;_0x572f64[_0xbfdf('0xac')]=_0x4b4b2e[_0xbfdf('0xad')];return _0x572f64;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x325aa2=this;setInterval(function(){_0x325aa2[_0xbfdf('0xae')](_0x325aa2[_0xbfdf('0x23')],_0xbfdf('0xaf'));_0x325aa2['clearZombieChannels'](_0x325aa2['actions'],_0xbfdf('0xb0'));},0x32c8);};Dialer['prototype'][_0xbfdf('0xae')]=function(_0x22f3be,_0x63a96){var _0x27b103=this;for(var _0x33012c in _0x22f3be){if(typeof _0x22f3be[_0x33012c]!=='undefined'){this[_0xbfdf('0xb1')][_0xbfdf('0x18')](function(){if(!_['isNil'](_0x22f3be[_0x33012c])){return ami['Action']({'action':'status','channel':_0x22f3be[_0x33012c]['channel']})['catch'](function(_0x15a3d7){if(_0x15a3d7[_0xbfdf('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x22f3be[_0x33012c]&&_0x22f3be[_0x33012c][_0xbfdf('0x57')]!==_0xbfdf('0x7b')){_0x27b103[_0xbfdf('0xb2')](_0x27b103[_0xbfdf('0x1c')][_0x22f3be[_0x33012c][_0xbfdf('0xb3')]]);logger[_0xbfdf('0x96')](_0xbfdf('0xb4'),_0x63a96,_0x33012c,_0x22f3be[_0x33012c][_0xbfdf('0xb3')]);delete _0x22f3be[_0x33012c];}if(_0x22f3be[_0x33012c]&&_0x22f3be[_0x33012c]['type']===_0xbfdf('0x7b')){_0x27b103[_0xbfdf('0xb2')](_0x27b103[_0xbfdf('0x1d')][_0x22f3be[_0x33012c]['queue']]);logger['error'](_0xbfdf('0xb5'),_0x63a96,_0x33012c,_0x22f3be[_0x33012c][_0xbfdf('0xb3')]);delete _0x22f3be[_0x33012c];}},0x2328);}});}});}}};Dialer['prototype'][_0xbfdf('0xb6')]=function(_0x5b2cf6){return BPromise['resolve']()['then'](cmHopper[_0xbfdf('0xb6')](_0x5b2cf6))[_0xbfdf('0xb7')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xb9')]=function(_0x5d1c24){return BPromise['resolve']()[_0xbfdf('0x3c')](cmHopperBlack[_0xbfdf('0xb9')](_0x5d1c24))[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0xba')));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xbb')]=function(_0x1023d4){return BPromise[_0xbfdf('0xbc')]()['then'](cmHopperBlack[_0xbfdf('0xbb')](_0x1023d4))[_0xbfdf('0xb7')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xbd')]=function(_0xf66026){return BPromise[_0xbfdf('0xbc')]()[_0xbfdf('0x3c')](cmHopperHistory[_0xbfdf('0xbe')](_0xf66026))[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0xbf')));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xc0')]=function(_0x5c8a18){return BPromise['resolve']()[_0xbfdf('0x3c')](cmHopper['rescheduleContact'](_0x5c8a18))[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0xc1')));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xc2')]=function(_0x1d2cd2,_0x1aaa65,_0x5eb535){return BPromise[_0xbfdf('0xbc')]()['then'](cmHopper[_0xbfdf('0xc2')](_0x1d2cd2,_0x1aaa65,_0x5eb535))['catch'](loggerCatch(_0xbfdf('0xc3')));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xc4')]=function(_0x3d2652,_0x5f1584,_0x37dbd2,_0x2358c8,_0x466a6d){return BPromise[_0xbfdf('0xbc')]()[_0xbfdf('0x3c')](cmHopper[_0xbfdf('0xc4')](_0x3d2652,_0x5f1584,_0x37dbd2,_0x2358c8))[_0xbfdf('0xb7')](function(_0x37a6fa){_0x466a6d[_0xbfdf('0xc5')]-=_0x37dbd2;_0x466a6d['temp']=_0x466a6d[_0xbfdf('0xc5')]>0x0?_0x466a6d[_0xbfdf('0xc5')]:0x0;loggerCatch(_0xbfdf('0xc6'))(_0x37a6fa);});};Dialer[_0xbfdf('0xb8')]['getContactDialerIvr']=function(_0x1dbab0,_0xcaf594,_0x3ef52c,_0x32eda4){return BPromise[_0xbfdf('0xbc')]()[_0xbfdf('0x3c')](cmHopper['getContactDialerIvr'](_0x1dbab0,_0xcaf594,_0x3ef52c))[_0xbfdf('0xb7')](function(_0x3fafc5){_0x32eda4[_0xbfdf('0xc5')]-=_0xcaf594;_0x32eda4['temp']=_0x32eda4[_0xbfdf('0xc5')]>0x0?_0x32eda4[_0xbfdf('0xc5')]:0x0;loggerCatch(_0xbfdf('0xc7'))(_0x3fafc5);});};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xc8')]=function(_0x207ce8){return BPromise[_0xbfdf('0xbc')]()[_0xbfdf('0x3c')](voiceQueueRt[_0xbfdf('0xc8')](_0x207ce8))[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0xc9')));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xca')]=function(_0x5714ed){return BPromise[_0xbfdf('0xbc')]()['then'](cmHopper['moveContactManagedDialer'](_0x5714ed))[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0xcb')));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xcc')]=function(_0x16e330){return BPromise[_0xbfdf('0xbc')]()[_0xbfdf('0x3c')](cmHopperHistory[_0xbfdf('0xcc')](_0x16e330))[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0xcd')));};Dialer['prototype'][_0xbfdf('0xb2')]=function(_0x1b0b62){if(!_['isUndefined'](_0x1b0b62)&&_0x1b0b62!==null){if(typeof _0x1b0b62[_0xbfdf('0x71')]!=='undefined'){if(_0x1b0b62[_0xbfdf('0x71')]>0x0){_0x1b0b62[_0xbfdf('0x71')]-=0x1;}else{logger[_0xbfdf('0x96')](_0xbfdf('0xce'));}}}else{logger['error'](_0xbfdf('0xcf'));}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xd0')]=function(_0x29dfbb,_0x1b0644){var _0x3afb8d=this;return function(_0x29ca46){_0x3afb8d[_0xbfdf('0xb2')](_0x1b0644);logger[_0xbfdf('0x96')](_0x29dfbb,util['inspect'](_0x29ca46,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xbfdf('0xd1')]=function(_0x21c52b,_0x51b98a,_0x7e6a79){var _0x42d5ff={'state':0x19,'statedesc':_0xbfdf('0xd2')};this['updateOriginated'](_0x51b98a);this[_0xbfdf('0xd3')](_[_0xbfdf('0x8e')](_0x42d5ff,_[_0xbfdf('0xd4')](_0x7e6a79,[_0xbfdf('0xd5'),_0xbfdf('0xd6'),_0xbfdf('0xd7'),_0xbfdf('0xd8'),_0xbfdf('0xd9')])),_0xbfdf('0xda'),'[emptyContact]');logger[_0xbfdf('0x96')](_0x21c52b);};Dialer[_0xbfdf('0xb8')]['isSuccess']=function(_0xc15c6c){return _0xc15c6c===_0xbfdf('0xdb');};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xdc')]=function(_0x8dc892){return!_['isUndefined'](_0x8dc892)&&_0x8dc892&&!_[_0xbfdf('0x83')](_0x8dc892[_0xbfdf('0x40')])&&!_['isUndefined'](_0x8dc892[_0xbfdf('0x77')])&&_0x8dc892[_0xbfdf('0x77')]&&(this[_0xbfdf('0x1f')][util[_0xbfdf('0x79')](_0xbfdf('0xdd'),_0x8dc892[_0xbfdf('0x40')])][_0xbfdf('0xde')]===_0xbfdf('0xdf')||this[_0xbfdf('0x1f')][util[_0xbfdf('0x79')]('SIP/%s',_0x8dc892[_0xbfdf('0x40')])]['status']==='unmonitored');};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xd3')]=function(_0x5500ff,_0x3fd58c,_0x1ddecd){this[_0xbfdf('0xcc')](_0x5500ff)['catch'](loggerCatch(_0x3fd58c));this[_0xbfdf('0xca')](_0x5500ff)[_0xbfdf('0xb7')](loggerCatch(_0x1ddecd));};Dialer['prototype'][_0xbfdf('0x35')]=function(_0x5b69fc){var _0x1f28a8=this[_0xbfdf('0x23')][_0x5b69fc[_0xbfdf('0xe0')]];var _0x196843;if(!_['isNil'](_0x5b69fc)&&!_[_0xbfdf('0xe1')](_0x5b69fc['variable'])&&!_[_0xbfdf('0xe1')](_0x5b69fc['variable'][_0xbfdf('0xe2')])&&_0x5b69fc[_0xbfdf('0xe3')]===_0xbfdf('0xe4')&&_0x1f28a8){if(_0x1f28a8[_0xbfdf('0x57')]!==_0xbfdf('0x7b')&&this['voiceQueues'][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0xe5')]&&_0x5b69fc['value']===_0xbfdf('0xe6')){delete this[_0xbfdf('0x23')][_0x5b69fc[_0xbfdf('0xe0')]];this[_0xbfdf('0xb2')](this[_0xbfdf('0x1c')][_0x1f28a8[_0xbfdf('0xb3')]]);this[_0xbfdf('0x1c')][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0x5f')]+=0x1;this['voiceQueues'][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0x5e')]+=0x1;_0x196843=new Hangup(_0x1f28a8,_0x5b69fc);_0x196843[_0xbfdf('0xaa')]=0x12;_0x196843['statedesc']=_0xbfdf('0xe7');_0x196843['membername']=_0xbfdf('0xe8');ami[_0xbfdf('0x4c')]('custom:amd',ut[_0xbfdf('0xe9')](_0x196843,_0xbfdf('0xea')));this[_0xbfdf('0xd3')](_0x196843,_0xbfdf('0xeb'),_0xbfdf('0xec'));}if(_0x1f28a8[_0xbfdf('0x57')]!==_0xbfdf('0x7b')&&this[_0xbfdf('0x1c')][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0xe5')]&&_0x5b69fc[_0xbfdf('0xed')]==='MACHINE'){var _0x56157c=this;return new BPromise(function(_0x3f6141,_0x2a104d){delete _0x56157c[_0xbfdf('0x23')][_0x5b69fc['uniqueid']];_0x56157c[_0xbfdf('0xb2')](_0x56157c[_0xbfdf('0x1c')][_0x1f28a8[_0xbfdf('0xb3')]]);_0x56157c['voiceQueues'][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0x5f')]+=0x1;_0x56157c[_0xbfdf('0x1c')][_0x1f28a8[_0xbfdf('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x474759=_0x56157c['voiceQueues'][_0x1f28a8['queue']];var _0xf85543=new Hangup(_0x1f28a8,_0x5b69fc);_0xf85543[_0xbfdf('0xaa')]=0x13;_0xf85543[_0xbfdf('0xab')]='Machine';_0xf85543[_0xbfdf('0xee')]='AMD';_0xf85543[_0xbfdf('0xef')]+=0x1;_0xf85543[_0xbfdf('0xf0')]+=0x1;_0xf85543[_0xbfdf('0xea')]=!![];ami['emit']('custom:amd',ut[_0xbfdf('0xe9')](_0xf85543,'amd'));_0x56157c[_0xbfdf('0xcc')](_0xf85543)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0xf1')));if(_0xf85543[_0xbfdf('0xf2')]+_0xf85543[_0xbfdf('0xf3')]+_0xf85543[_0xbfdf('0xf4')]+_0xf85543[_0xbfdf('0xf5')]+_0xf85543[_0xbfdf('0xf6')]+_0xf85543[_0xbfdf('0xf7')]+_0xf85543[_0xbfdf('0xef')]+_0xf85543['countagentrejectretry']>=_0x474759[_0xbfdf('0xf8')]){_0x56157c[_0xbfdf('0xf9')](_0xf85543,_0x3f6141,_0x2a104d,'reason19\x20machine....');}else{if(_0xf85543[_0xbfdf('0xef')]>=_0x474759[_0xbfdf('0xfa')]){_0x56157c['createStateFinal'](_0xf85543,_0x3f6141,_0x2a104d,_0xbfdf('0xfb'));}else{_0x56157c['rescheduleContact']({'active':![],'countmachineretry':_0xf85543[_0xbfdf('0xef')],'scheduledat':moment()[_0xbfdf('0xfc')](_0x474759['dialMachineRetryFrequency'],_0xbfdf('0xfd'))[_0xbfdf('0x79')](_0xbfdf('0xfe')),'ContactId':_0xf85543[_0xbfdf('0xd5')],'ListId':_0xf85543[_0xbfdf('0xd6')],'VoiceQueueId':_0xf85543['VoiceQueueId']||undefined,'CampaignId':_0xf85543[_0xbfdf('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x3f6141({'reschedule':0x1});}}});}if(_0x1f28a8[_0xbfdf('0x57')]===_0xbfdf('0x7b')&&this['campaigns'][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0xe5')]&&_0x5b69fc[_0xbfdf('0xed')]===_0xbfdf('0xe6')){delete this[_0xbfdf('0x23')][_0x5b69fc['uniqueid']];this[_0xbfdf('0xb2')](this[_0xbfdf('0x1d')][_0x1f28a8['queue']]);_0x196843=new Hangup(_0x1f28a8,_0x5b69fc);_0x196843[_0xbfdf('0xaa')]=0x12;_0x196843[_0xbfdf('0xab')]=_0xbfdf('0xe7');_0x196843[_0xbfdf('0xee')]=_0xbfdf('0xe8');ami[_0xbfdf('0x4c')]('custom:amd',ut['buildObj'](_0x196843,_0xbfdf('0xea')));this[_0xbfdf('0xd3')](_0x196843,'[syncHangupInAMDIvr][createHistory]',_0xbfdf('0xff'));}if(_0x1f28a8[_0xbfdf('0x57')]===_0xbfdf('0x7b')&&this[_0xbfdf('0x1d')][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0xe5')]&&_0x5b69fc[_0xbfdf('0xed')]===_0xbfdf('0x100')){var _0x56157c=this;return new BPromise(function(_0x5d0448,_0x254827){delete _0x56157c['uniqueId'][_0x5b69fc['uniqueid']];_0x56157c[_0xbfdf('0xb2')](_0x56157c[_0xbfdf('0x1d')][_0x1f28a8[_0xbfdf('0xb3')]]);_0x56157c[_0xbfdf('0x1d')][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0x5f')]+=0x1;_0x56157c[_0xbfdf('0x1d')][_0x1f28a8[_0xbfdf('0xb3')]][_0xbfdf('0x5e')]+=0x1;var _0x409520=_0x56157c[_0xbfdf('0x1d')][_0x1f28a8[_0xbfdf('0xb3')]];var _0x526e3c=new Hangup(_0x1f28a8,_0x5b69fc);_0x526e3c[_0xbfdf('0xaa')]=0x13;_0x526e3c[_0xbfdf('0xab')]='Machine';_0x526e3c[_0xbfdf('0xee')]=_0xbfdf('0xe8');_0x526e3c[_0xbfdf('0xef')]+=0x1;_0x526e3c[_0xbfdf('0xf0')]+=0x1;_0x526e3c[_0xbfdf('0xea')]=!![];ami['emit'](_0xbfdf('0x101'),ut[_0xbfdf('0xe9')](_0x526e3c,'amd'));_0x56157c[_0xbfdf('0xcc')](_0x526e3c)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0xf1')));if(_0x526e3c[_0xbfdf('0xf2')]+_0x526e3c[_0xbfdf('0xf3')]+_0x526e3c[_0xbfdf('0xf4')]+_0x526e3c['countnosuchnumberretry']+_0x526e3c[_0xbfdf('0xf6')]+_0x526e3c['countabandonedretry']+_0x526e3c[_0xbfdf('0xef')]+_0x526e3c['countagentrejectretry']>=_0x409520[_0xbfdf('0xf8')]){_0x56157c[_0xbfdf('0xf9')](_0x526e3c,_0x5d0448,_0x254827,'reason19\x20machine....');}else{if(_0x526e3c[_0xbfdf('0xef')]>=_0x409520[_0xbfdf('0xfa')]){_0x56157c[_0xbfdf('0x102')](_0x526e3c,_0x5d0448,_0x254827,'reason\x2019\x20machine....');}else{_0x56157c[_0xbfdf('0xc0')]({'active':![],'countmachineretry':_0x526e3c[_0xbfdf('0xef')],'scheduledat':moment()[_0xbfdf('0xfc')](_0x409520[_0xbfdf('0x103')],_0xbfdf('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x526e3c['ContactId'],'ListId':_0x526e3c[_0xbfdf('0xd6')],'VoiceQueueId':_0x526e3c[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x526e3c[_0xbfdf('0xd9')]||undefined})['catch'](loggerCatch(_0xbfdf('0x104')));_0x5d0448({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xbfdf('0x31')]=function(_0x4a082c){var _0x1a35f1=this['uniqueId'][_0x4a082c[_0xbfdf('0xe0')]];var _0x10a3b1=this;var _0x325315;if(_0x1a35f1&&_0x1a35f1[_0xbfdf('0x57')]===_0xbfdf('0x7b')){delete this[_0xbfdf('0x23')][_0x4a082c[_0xbfdf('0xe0')]];this[_0xbfdf('0xb2')](this[_0xbfdf('0x1d')][_0x1a35f1[_0xbfdf('0xb3')]]);this[_0xbfdf('0x1d')][_0x1a35f1[_0xbfdf('0xb3')]]['ivrAnswerCallsDay']+=0x1;_0x325315=new Hangup(_0x1a35f1,_0x4a082c);this['createHistory'](_0x325315)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x105')));this[_0xbfdf('0xca')](_0x325315)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x106')));}if(_0x1a35f1&&_0x1a35f1[_0xbfdf('0x57')]!==_0xbfdf('0x7b')&&isNotNull(this['voiceQueues'][_0x1a35f1[_0xbfdf('0xb3')]][_0xbfdf('0x107')])){delete this['uniqueId'][_0x4a082c[_0xbfdf('0xe0')]];this['updateOriginated'](this[_0xbfdf('0x1c')][_0x1a35f1['queue']]);this[_0xbfdf('0x1c')][_0x1a35f1[_0xbfdf('0xb3')]][_0xbfdf('0x5f')]+=0x1;this[_0xbfdf('0x1c')][_0x1a35f1[_0xbfdf('0xb3')]][_0xbfdf('0x5e')]+=0x1;_0x325315=new Hangup(_0x1a35f1,_0x4a082c);_0x325315[_0xbfdf('0xaa')]=0x10;_0x325315['statedesc']=_0xbfdf('0x108');_0x325315['membername']=_0xbfdf('0x109');this[_0xbfdf('0xcc')](_0x325315)[_0xbfdf('0xb7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xbfdf('0xca')](_0x325315)['catch'](loggerCatch(_0xbfdf('0x106')));}if(_0x1a35f1&&_0x1a35f1[_0xbfdf('0x57')]!==_0xbfdf('0x7b')&&!isNotNull(this[_0xbfdf('0x1c')][_0x1a35f1[_0xbfdf('0xb3')]]['dialQueueProject'])){delete this[_0xbfdf('0x23')][_0x4a082c[_0xbfdf('0xe0')]];this['updateOriginated'](this['voiceQueues'][_0x1a35f1['queue']]);this[_0xbfdf('0x1c')][_0x1a35f1[_0xbfdf('0xb3')]][_0xbfdf('0x10a')]+=0x1;_0x325315=new Hangup(_0x1a35f1,_0x4a082c);_0x325315[_0xbfdf('0xaa')]=0xc;_0x325315['statedesc']=_0x4a082c['cause-txt'];_0x325315[_0xbfdf('0xee')]='Unknow';this[_0xbfdf('0xcc')](_0x325315)[_0xbfdf('0xb7')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x325315)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x106')));}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x2e')]=function(_0x145573){var _0xe9629=this[_0xbfdf('0x23')][_0x145573['uniqueid']];var _0x1db87a=this;if(this['voiceQueues'][_0x145573[_0xbfdf('0xb3')]]){if(_0xe9629&&_0xe9629[_0xbfdf('0x57')]!==_0xbfdf('0x7b')){delete this['uniqueId'][_0x145573[_0xbfdf('0xe0')]];this[_0xbfdf('0x1c')][_0x145573[_0xbfdf('0xb3')]][_0xbfdf('0x5f')]+=0x1;var _0x2104b3=new AgentComplete(_0xe9629,_0x145573);if(_0x145573['reason']===_0xbfdf('0x10b')){_0x2104b3[_0xbfdf('0x10c')]=this['voiceQueues'][_0x145573[_0xbfdf('0xb3')]][_0xbfdf('0x10d')]&&this[_0xbfdf('0x1c')][_0x145573[_0xbfdf('0xb3')]]['dialAgiAfterHangupAgent']?moment()[_0xbfdf('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x2104b3)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x10e')));this[_0xbfdf('0xca')](_0x2104b3)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x10f')));}}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x28')]=function(_0x5e942c){if(this[_0xbfdf('0x1c')][_0x5e942c['queue']]){if(this[_0xbfdf('0x23')][_0x5e942c[_0xbfdf('0xe0')]]&&this[_0xbfdf('0x23')][_0x5e942c['uniqueid']][_0xbfdf('0x57')]!==_0xbfdf('0x7b')){this['updateOriginated'](this['voiceQueues'][_0x5e942c[_0xbfdf('0xb3')]]);this[_0xbfdf('0x23')][_0x5e942c[_0xbfdf('0xe0')]][_0xbfdf('0x110')]=moment()[_0xbfdf('0x79')](_0xbfdf('0xfe'));}}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x111')]=function(_0x23cbe7){this[_0xbfdf('0xcc')](_0x23cbe7)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x10e')));this[_0xbfdf('0xca')](_0x23cbe7)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x2b')]=function(_0x4bdb46){var _0x405a8c=this[_0xbfdf('0x23')][_0x4bdb46[_0xbfdf('0xe0')]];var _0x69ea8=this;if(this[_0xbfdf('0x1c')][_0x4bdb46[_0xbfdf('0xb3')]]){if(_0x405a8c&&_0x405a8c['type']!==_0xbfdf('0x7b')){delete this[_0xbfdf('0x23')][_0x4bdb46[_0xbfdf('0xe0')]];this[_0xbfdf('0xb2')](this['voiceQueues'][_0x4bdb46[_0xbfdf('0xb3')]]);_0x405a8c[_0xbfdf('0x112')]=moment()[_0xbfdf('0x79')](_0xbfdf('0xfe'));var _0x10ebd3=new QueueCallerAbandon(_0x405a8c,_0x4bdb46);if(getSeconds(_0x405a8c[_0xbfdf('0x112')],_0x405a8c[_0xbfdf('0x113')])>=_0x405a8c['dialQueueTimeout']){this['voiceQueues'][_0x4bdb46[_0xbfdf('0xb3')]][_0xbfdf('0x6a')]+=0x1;this[_0xbfdf('0x1c')][_0x4bdb46[_0xbfdf('0xb3')]][_0xbfdf('0x64')]+=0x1;this[_0xbfdf('0x1c')][_0x4bdb46[_0xbfdf('0xb3')]][_0xbfdf('0x6c')]+=0x1;_0x10ebd3[_0xbfdf('0xaa')]=0xa;_0x10ebd3[_0xbfdf('0xab')]=_0xbfdf('0x114');_0x10ebd3['dropreason']=_0xbfdf('0x115');_0x10ebd3[_0xbfdf('0x10c')]=this['voiceQueues'][_0x4bdb46[_0xbfdf('0xb3')]][_0xbfdf('0x10d')]?moment()[_0xbfdf('0x79')](_0xbfdf('0xfe')):undefined;_0x10ebd3[_0xbfdf('0xf6')]+=0x1;_0x10ebd3[_0xbfdf('0xf0')]+=0x1;if(_0x10ebd3[_0xbfdf('0xf6')]>=this['voiceQueues'][_0x4bdb46[_0xbfdf('0xb3')]][_0xbfdf('0x116')]){this['queueCallerAbandonCreateState'](_0x10ebd3);}else{this[_0xbfdf('0xc0')]({'active':![],'countdropretry':_0x10ebd3[_0xbfdf('0xf6')],'scheduledat':moment()[_0xbfdf('0xfc')](this[_0xbfdf('0x1c')][_0x4bdb46['queue']][_0xbfdf('0x117')],_0xbfdf('0xfd'))[_0xbfdf('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x405a8c[_0xbfdf('0xd5')],'ListId':_0x405a8c[_0xbfdf('0xd6')],'VoiceQueueId':_0x405a8c[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x405a8c[_0xbfdf('0xd9')]||undefined})[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x118')));var _0x1272ab=new History(_0x10ebd3);_0x1272ab[_0xbfdf('0xaa')]=0xa;_0x1272ab[_0xbfdf('0xab')]='Drop';_0x1272ab[_0xbfdf('0xad')]=moment()['format'](_0xbfdf('0xfe'));_0x1272ab['endtime']=_0x1272ab[_0xbfdf('0xad')];_0x1272ab[_0xbfdf('0x119')]=_0x10ebd3['calleridname'];_0x1272ab['calleridnum']=_0x10ebd3[_0xbfdf('0x11a')];this[_0xbfdf('0xcc')](_0x1272ab)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x11b')));}}else{this[_0xbfdf('0x1c')][_0x4bdb46['queue']][_0xbfdf('0x81')]+=0x1;this[_0xbfdf('0x1c')][_0x4bdb46[_0xbfdf('0xb3')]][_0xbfdf('0x63')]+=0x1;_0x10ebd3[_0xbfdf('0xaa')]=0xb;_0x10ebd3[_0xbfdf('0xab')]=_0xbfdf('0x11c');_0x10ebd3[_0xbfdf('0x11d')]=_0xbfdf('0x11e');_0x10ebd3['countabandonedretry']+=0x1;_0x10ebd3[_0xbfdf('0xf0')]+=0x1;if(_0x10ebd3[_0xbfdf('0xf7')]>=this[_0xbfdf('0x1c')][_0x4bdb46[_0xbfdf('0xb3')]][_0xbfdf('0x11f')]){this[_0xbfdf('0x111')](_0x10ebd3);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x10ebd3[_0xbfdf('0xf7')],'scheduledat':moment()[_0xbfdf('0xfc')](this[_0xbfdf('0x1c')][_0x4bdb46[_0xbfdf('0xb3')]][_0xbfdf('0x120')],_0xbfdf('0xfd'))[_0xbfdf('0x79')](_0xbfdf('0xfe')),'ContactId':_0x405a8c[_0xbfdf('0xd5')],'ListId':_0x405a8c[_0xbfdf('0xd6')],'VoiceQueueId':_0x405a8c[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x405a8c[_0xbfdf('0xd9')]||undefined})[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x121')));var _0x1272ab=new History(_0x10ebd3);_0x1272ab[_0xbfdf('0xaa')]=0xb;_0x1272ab[_0xbfdf('0xab')]=_0xbfdf('0x11c');_0x1272ab['starttime']=moment()[_0xbfdf('0x79')](_0xbfdf('0xfe'));_0x1272ab[_0xbfdf('0xac')]=_0x1272ab[_0xbfdf('0xad')];_0x1272ab[_0xbfdf('0x119')]=_0x10ebd3[_0xbfdf('0x119')];_0x1272ab[_0xbfdf('0x11a')]=_0x10ebd3[_0xbfdf('0x11a')];this[_0xbfdf('0xcc')](_0x1272ab)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x122')));}}}}};Dialer['prototype'][_0xbfdf('0x33')]=function(_0x5e2880){if(this[_0xbfdf('0x21')][_0x5e2880['uniqueid']]){this[_0xbfdf('0x21')][_0x5e2880['uniqueid']][_0xbfdf('0x123')]=_0x5e2880[_0xbfdf('0x123')];}if(this['uniqueId'][_0x5e2880[_0xbfdf('0xe0')]]){this[_0xbfdf('0x23')][_0x5e2880[_0xbfdf('0xe0')]][_0xbfdf('0x123')]=_0x5e2880[_0xbfdf('0x123')];}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x36')]=function(_0x5c634f){if(strategy[this[_0xbfdf('0x1c')][this[_0xbfdf('0x21')][_0x5c634f['actionid']][_0xbfdf('0xb3')]][_0xbfdf('0x4e')]]===_0xbfdf('0x124')){if(this[_0xbfdf('0x21')][_0x5c634f['actionid']]&&_[_0xbfdf('0xe1')](this[_0xbfdf('0x21')][_0x5c634f[_0xbfdf('0x125')]][_0xbfdf('0x126')])&&_0x5c634f['status']==='1'&&_0x5c634f['paused']==='0'){if(this[_0xbfdf('0x1e')][_0x5c634f['stateinterface']]){if(!this[_0xbfdf('0x1e')][_0x5c634f[_0xbfdf('0x127')]][_0xbfdf('0x126')]){this[_0xbfdf('0x1e')][_0x5c634f[_0xbfdf('0x127')]][_0xbfdf('0x126')]=!![];this['actions'][_0x5c634f['actionid']][_0xbfdf('0x126')]=!![];this[_0xbfdf('0x21')][_0x5c634f[_0xbfdf('0x125')]][_0xbfdf('0x127')]=_0x5c634f['stateinterface'];}}}}else if((strategy[this[_0xbfdf('0x1c')][this[_0xbfdf('0x21')][_0x5c634f[_0xbfdf('0x125')]][_0xbfdf('0xb3')]][_0xbfdf('0x4e')]]||_0xbfdf('0x17'))===_0xbfdf('0x17')){if(this['actions'][_0x5c634f[_0xbfdf('0x125')]]){if(this['agents'][_0x5c634f[_0xbfdf('0x127')]]){this[_0xbfdf('0x21')][_0x5c634f[_0xbfdf('0x125')]][_0xbfdf('0x127')]=_0x5c634f['stateinterface'];if(_['isNil'](this[_0xbfdf('0x128')][this['actions'][_0x5c634f[_0xbfdf('0x125')]]['queue']])){this['queueBooked'][this[_0xbfdf('0x21')][_0x5c634f['actionid']][_0xbfdf('0xb3')]]=[];}this[_0xbfdf('0x128')][this[_0xbfdf('0x21')][_0x5c634f[_0xbfdf('0x125')]][_0xbfdf('0xb3')]]['push'](_[_0xbfdf('0x8e')](_[_0xbfdf('0xd4')](this['actions'][_0x5c634f[_0xbfdf('0x125')]],['idHopper','stateinterface']),{'status':_0x5c634f['status'],'paused':_0x5c634f[_0xbfdf('0x129')]}));}}}};function unlockQueueStatus(_0x58d03a,_0x52b1a5){setTimeout(function(){if(_[_0xbfdf('0x83')](_0x58d03a[_0xbfdf('0x12a')])){loggerBooked[_0xbfdf('0x96')](_0xbfdf('0x12b'),_0x52b1a5);}_0x58d03a[_0xbfdf('0x12a')]=!![];loggerBooked[_0xbfdf('0x7e')](_0xbfdf('0x12c'),_0x52b1a5,JSON['stringify'](_[_0xbfdf('0xd4')](_0x58d03a,[_0xbfdf('0x40'),_0xbfdf('0x12a')])));},0x1f3);}Dialer[_0xbfdf('0xb8')][_0xbfdf('0x38')]=function(_0xa579d0){var _0x5b2f5d=this;var _0x2cf117=_0x5b2f5d[_0xbfdf('0x1c')][_0x5b2f5d[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]]['queue']];if(strategy[this['voiceQueues'][this['actions'][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xb3')]][_0xbfdf('0x4e')]]===_0xbfdf('0x124')){if(this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]]&&this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]]['stateinterface']){this[_0xbfdf('0x1b')][_0xbfdf('0x12d')](this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]]['idHopper'],this['actions'][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0x127')])[_0xbfdf('0xb7')](function(_0x2563b2){logger[_0xbfdf('0x96')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xbfdf('0x95')](_0x2563b2,{'showHidden':![],'depth':null}));})[_0xbfdf('0x1a')](function(){_0x5b2f5d[_0xbfdf('0xb2')](_0x5b2f5d['voiceQueues'][_0x5b2f5d[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xb3')]]);_0x5b2f5d[_0xbfdf('0x1e')][_0x5b2f5d['actions'][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0x127')]]['locked']=![];delete _0x5b2f5d['actions'][_0xa579d0['actionid']];unlockQueueStatus(_0x2cf117);});}else{this[_0xbfdf('0xb2')](this[_0xbfdf('0x1c')][this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xb3')]]);this[_0xbfdf('0xc0')]({'active':![],'ContactId':this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xd5')],'ListId':this['actions'][_0xa579d0[_0xbfdf('0x125')]]['ListId'],'VoiceQueueId':this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xd8')]||undefined,'CampaignId':this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xd9')]||undefined})[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x12e')));delete this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]];unlockQueueStatus(_0x2cf117);}}else if((strategy[this[_0xbfdf('0x1c')][this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xb3')]]['strategy']]||_0xbfdf('0x17'))==='rrmemory'){var _0x55f1f5;if(this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]]&&!_[_0xbfdf('0x46')](this[_0xbfdf('0x128')][this[_0xbfdf('0x21')][_0xa579d0['actionid']][_0xbfdf('0xb3')]])){if(this['queueBookedRR'][_0x5b2f5d[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]]['queue']]){this[_0xbfdf('0x27')][_0x5b2f5d[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]]['queue']]=this[_0xbfdf('0x27')][this[_0xbfdf('0x21')][_0xa579d0['actionid']][_0xbfdf('0xb3')]]?this['queueBookedRR'][this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xb3')]]:this[_0xbfdf('0x128')][this['actions'][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xb3')]]?this['queueBooked'][this[_0xbfdf('0x21')][_0xa579d0['actionid']]['queue']][_0xbfdf('0x12f')]||0x0:0x0;}this[_0xbfdf('0x128')][this[_0xbfdf('0x21')][_0xa579d0[_0xbfdf('0x125')]][_0xbfdf('0xb3')]]['_rr']=this[_0xbfdf('0x27')][this['actions'][_0xa579d0['actionid']][_0xbfdf('0xb3')]];for(var _0x2c4aa3=0x0;_0x2c4aa3=0x0;})[_0xbfdf('0xb7')](myreject(_0x851de4)));}}else{_0x3fdab5[_0xbfdf('0x147')](ami[_0xbfdf('0x148')]({'action':_0xbfdf('0x149'),'command':util[_0xbfdf('0x79')](_0xbfdf('0x14e'),_0x41b375,!_[_0xbfdf('0x83')](config['timezones'][_0x36dc0e])?_0x36dc0e:'')})['then'](function(_0x2d05a6){return _0x2d05a6[_0xbfdf('0x14b')][_0xbfdf('0x14c')]('true')>=0x0;})[_0xbfdf('0xb7')](myreject(_0x851de4)));}BPromise[_0xbfdf('0x14f')](_0x3fdab5)[_0xbfdf('0x3c')](function(_0x11e09b){var _0x552bf5=_['some'](_0x11e09b);if(_0x552bf5){return _0x6feceb(_0x552bf5);}else{_0x121873[_0xbfdf('0x3e')]=_0x4fee74?'GLOBAL_INTERVAL_IS_OVERTIME':_0xbfdf('0x150');return _0x851de4(msgResponse('[ifTime][promiseAll]',_0xbfdf('0x142'),_0xbfdf('0x151')+_0x4fee74+'\x20'+_0x11da3a+_0xbfdf('0x152')+util['inspect'](_0x41b375,{'showHidden':![],'depth':null})+_0xbfdf('0x153')+_0x36dc0e));}})[_0xbfdf('0xb7')](function(_0x2190aa){return _0x851de4(msgResponse(_0xbfdf('0x140'),_0xbfdf('0x142'),JSON[_0xbfdf('0x49')](_0x2190aa)));});});};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x154')]=function(_0x2ed704){var _0x2dd3d7=this;return function(){switch(_0x2ed704[_0xbfdf('0x155')]){case _0xbfdf('0x156'):freeVariablesPredictive(_0x2ed704);_0x2dd3d7[_0xbfdf('0x157')](_0x2ed704,0x1);break;case'power':freeVariablesPredictive(_0x2ed704);_0x2dd3d7['handlePower'](_0x2ed704,_0x2ed704[_0xbfdf('0x158')]);break;case _0xbfdf('0x159'):_0x2dd3d7[_0xbfdf('0x159')](_0x2ed704);break;case'booked':freeVariablesPredictive(_0x2ed704);_0x2dd3d7['handlePower'](_0x2ed704,0x1);break;default:freeVariablesPredictive(_0x2ed704);logger[_0xbfdf('0x96')](_0xbfdf('0x15a'),_0x2ed704['name'],'method\x20not\x20recognized');}};};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x4e1d1b){return BPromise['resolve']()[_0xbfdf('0x3c')](cmHopper[_0xbfdf('0x15b')](_0x4e1d1b['id'],previewRecallmeReminderInterval))[_0xbfdf('0x3c')](function(_0x5578c6){for(var _0x16c956=0x0;_0x16c956<_0x5578c6[_0xbfdf('0x98')];_0x16c956++){var _0xd55b9b=_0x5578c6[_0x16c956][_0xbfdf('0x15c')][_0xbfdf('0x40')];if(_0xd55b9b)io['to'](util[_0xbfdf('0x79')](_0xbfdf('0x15d'),_0xd55b9b))[_0xbfdf('0x4c')]('user:dialPreviewRecallReminder',{'hopper':_0x5578c6[_0x16c956]});}})[_0xbfdf('0xb7')](function(_0x91666e){});};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x15e')]=function(_0x109112){var _0x3f1474=this;return function(){_0x3f1474[_0xbfdf('0x15f')](_0x109112);};};Dialer['prototype']['syncQueueSummary']=function(_0x4e22e5){var _0x3409fb=this;if(isNotPreview(_0x4e22e5[_0xbfdf('0x155')])){if(isVoiceQueueOutbound(_0x4e22e5[_0xbfdf('0x57')])&&isActive(_0x4e22e5['dialActive'])){_0x4e22e5[_0xbfdf('0xa1')]=!![];BPromise[_0xbfdf('0xbc')]()[_0xbfdf('0x3c')](checkIsLoggedIn(_0x4e22e5,_0x4e22e5[_0xbfdf('0x51')]))[_0xbfdf('0x3c')](checkIsActive(_0x4e22e5,_0x4e22e5[_0xbfdf('0x160')]))['then'](checkInterval(_0x4e22e5))['then'](_0x3409fb[_0xbfdf('0x13c')](_0x4e22e5))[_0xbfdf('0x3c')](_0x3409fb['checkIfTime'](_0x4e22e5['dialGlobalInterval'],_0x4e22e5[_0xbfdf('0x161')],_0x4e22e5[_0xbfdf('0x40')],_0x4e22e5))['then'](_0x3409fb[_0xbfdf('0x141')](_0x4e22e5[_0xbfdf('0x43')],_0x4e22e5['dialTimezone'],_0x4e22e5[_0xbfdf('0x40')],_0x4e22e5))[_0xbfdf('0x3c')](_0x3409fb[_0xbfdf('0x154')](_0x4e22e5))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x4e22e5));}else{notSendMessagesQueue(_0x4e22e5);}}else{freeVariablesPredictive(_0x4e22e5);if(_0x4e22e5[_0xbfdf('0x162')]){_0x3409fb[_0xbfdf('0x163')](_0x4e22e5);}}};Dialer['prototype'][_0xbfdf('0x13b')]=function(){var _0x1fb302=this;var _0x5d118f;for(var _0x507e44 in this[_0xbfdf('0x1d')]){if(typeof this[_0xbfdf('0x1d')][_0x507e44]!=='undefined'){_0x5d118f=this[_0xbfdf('0x1d')][_0x507e44];if(isCampaignIvr(_0x5d118f[_0xbfdf('0x57')])&&isActive(_0x5d118f[_0xbfdf('0x77')])){_0x5d118f[_0xbfdf('0xa1')]=!![];BPromise['resolve']()[_0xbfdf('0x3c')](checkIsActive(_0x5d118f,_0x5d118f['active']))[_0xbfdf('0x3c')](checkInterval(_0x5d118f))[_0xbfdf('0x3c')](_0x1fb302[_0xbfdf('0x13c')](_0x5d118f))['then'](_0x1fb302['checkIfTime'](_0x5d118f[_0xbfdf('0x164')],_0x5d118f[_0xbfdf('0x161')],_0x5d118f[_0xbfdf('0x40')],_0x5d118f))[_0xbfdf('0x3c')](_0x1fb302[_0xbfdf('0x141')](_0x5d118f[_0xbfdf('0x43')],_0x5d118f[_0xbfdf('0x161')],_0x5d118f[_0xbfdf('0x40')],_0x5d118f))[_0xbfdf('0x3c')](_0x1fb302[_0xbfdf('0x15e')](_0x5d118f))[_0xbfdf('0xb7')](loggerCatchQueueSummary('[syncCampaigns]',_0x5d118f));}else{notSendMessagesCampaign(_0x5d118f);}}}};function getCallerIdRandom(_0x2d6b4f,_0x530aab){var _0x462be7;var _0x236537;var _0x59038e;if(_0x530aab<=0x0){_0x530aab=0x1;}_0x462be7=new RegExp(_0xbfdf('0x165')+_0x530aab+'}$');_0x236537=Math[_0xbfdf('0x166')](0xa,_0x530aab-0x1);_0x59038e=Math[_0xbfdf('0x166')](0xa,_0x530aab)-0x1;return util[_0xbfdf('0x79')]('%s',_['replace'](_0x2d6b4f,_0x462be7,_['random'](_0x236537,_0x59038e)));}function extractCalleridName(_0x2e8b4c){var _0x449f70=_0x2e8b4c[_0xbfdf('0x167')](/"(.*?)"/);return _0x449f70?_0x449f70[0x1]:_0x2e8b4c;}function extractCalleridNumber(_0x538436){var _0x1ce083=_0x538436[_0xbfdf('0x167')](/<(.*?)>/);return _0x1ce083?_0x1ce083[0x1]:_0x538436;}Dialer['prototype'][_0xbfdf('0x168')]=function(_0xd10738,_0x21e339){var _0x51a835=this;var _0x2a6df4=uuid['v4']();this[_0xbfdf('0x21')][_0x2a6df4]=new Action(_0xd10738,_0x21e339,_0x2a6df4);return new BPromise(function(_0x54252d,_0x5dbdc6){if(_[_0xbfdf('0x83')](_0xd10738)&&typeof _0xd10738!==_0xbfdf('0x169')){return _0x5dbdc6(msgResponse('originate',_0xbfdf('0x142'),_0xbfdf('0x16a')));}if(_['isUndefined'](_0x21e339[_0xbfdf('0x16b')]['phone'])||_0x21e339[_0xbfdf('0x16b')][_0xbfdf('0x16c')]===null){return _0x5dbdc6(msgResponse(_0xbfdf('0x16d'),_0xbfdf('0x142'),_0xbfdf('0x16e')));}var _0xcf313b={'XMD-CALLERID':_0x51a835[_0xbfdf('0x21')][_0x2a6df4][_0xbfdf('0x16f')](),'XMD-AGI':_0xd10738[_0xbfdf('0x107')]?util[_0xbfdf('0x79')](_0xbfdf('0x170'),ipAgi,_0xd10738['dialQueueProject']):'NONE','XMD-AGIAFTER':_0xd10738[_0xbfdf('0x10d')]?util[_0xbfdf('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0xd10738['dialQueueProject2']):_0xbfdf('0x171'),'XMD-QUEUE':_0xd10738[_0xbfdf('0x57')]===_0xbfdf('0x4d')?util[_0xbfdf('0x79')](_0xbfdf('0x172'),_0xd10738[_0xbfdf('0x40')],_0xd10738[_0xbfdf('0x173')]||'',_0xd10738['dialAgiAfterHangupAgent']?'c':'',_0xd10738[_0xbfdf('0x174')]||0x3):_0xbfdf('0x171'),'XMD-CONTACTID':_0x21e339['ContactId'],'XMD-CDRTYPE':_0xbfdf('0x8'),'CALLERID(all)':_0x51a835[_0xbfdf('0x21')][_0x2a6df4][_0xbfdf('0x16f')](),'XMD-AMD':_0xd10738['dialAMDActive']?_0xbfdf('0x175'):_0xbfdf('0x171'),'XMD-DESTINATION':_0xbfdf('0xe4')};if(_0xd10738[_0xbfdf('0xe5')]){_0xcf313b['XMD-AMDINITIALSILENCE']=_0xd10738['dialAMDInitialSilence']||0x9c4;_0xcf313b[_0xbfdf('0x176')]=_0xd10738[_0xbfdf('0x177')]||0x5dc;_0xcf313b[_0xbfdf('0x178')]=_0xd10738[_0xbfdf('0x179')]||0x320;_0xcf313b[_0xbfdf('0x17a')]=_0xd10738['dialAMDTotalAnalysisTime']||0x1388;_0xcf313b['XMD-AMDMINWORDLENGTH']=_0xd10738['dialAMDMinWordLength']||0x64;_0xcf313b[_0xbfdf('0x17b')]=_0xd10738[_0xbfdf('0x17c')]||0x32;_0xcf313b[_0xbfdf('0x17d')]=_0xd10738[_0xbfdf('0x17e')]||0x3;_0xcf313b[_0xbfdf('0x17f')]=_0xd10738['dialAMDSilenceThreshold']||0x100;_0xcf313b[_0xbfdf('0x180')]=_0xd10738['dialAMDMaximumWordLength']||0x1388;}if(_0xd10738[_0xbfdf('0x57')]===_0xbfdf('0x4d')){_0xcf313b['XMD-VOICEQUEUEID']=_0x21e339[_0xbfdf('0xd8')];}else{_0xcf313b[_0xbfdf('0x181')]=_0x21e339[_0xbfdf('0xd9')];}for(var _0x517300 in _0x21e339[_0xbfdf('0x16b')]){if(typeof _0x21e339[_0xbfdf('0x16b')][_0x517300]!=='undefined'){if(isNotNull(_0x21e339[_0xbfdf('0x16b')][_0x517300])&&_0x517300!=='id'&&_0x517300!=='tags'&&_0x517300!=='createdAt'&&_0x517300!==_0xbfdf('0x182')){_0xcf313b[util[_0xbfdf('0x79')](_0xbfdf('0x183'),_0xbfdf('0x184'),_[_0xbfdf('0x185')](_0x517300))]=_0x21e339[_0xbfdf('0x16b')][_0x517300];}}}var _0x144b76=_0x51a835[_0xbfdf('0xdc')](_0xd10738['Trunk'])?getCallerId(_0xd10738['Trunk']['callerid'],_0xd10738['dialOriginateCallerIdName'],_0xd10738[_0xbfdf('0x186')]>0x0?getCallerIdRandom(_0xd10738[_0xbfdf('0x5c')],_0xd10738['dialRandomLastDigitCallerIdNumber']):_0xd10738[_0xbfdf('0x5c')]):getCallerId(_[_0xbfdf('0xe1')](_0xd10738[_0xbfdf('0x13d')])?_0xd10738['Trunk'][_0xbfdf('0x78')]:_0xd10738[_0xbfdf('0x13d')][_0xbfdf('0x78')],_0xd10738['dialOriginateCallerIdName'],_0xd10738['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xd10738['dialOriginateCallerIdNumber'],_0xd10738[_0xbfdf('0x186')]):_0xd10738[_0xbfdf('0x5c')]);if(_0x144b76){_0xcf313b[_0xbfdf('0x187')]=_0x51a835['actions'][_0x2a6df4][_0xbfdf('0x188')]=extractCalleridName(_0x144b76);_0xcf313b[_0xbfdf('0x189')]=_0x51a835[_0xbfdf('0x21')][_0x2a6df4][_0xbfdf('0x18a')]=extractCalleridNumber(_0x144b76);}return ami[_0xbfdf('0x148')]({'actionid':_0x2a6df4,'action':'originate','channel':_0x51a835[_0xbfdf('0xdc')](_0xd10738[_0xbfdf('0x76')])?util['format'](_0xbfdf('0x18b'),_0xd10738[_0xbfdf('0x76')][_0xbfdf('0x40')],isNotNull(_0xd10738[_0xbfdf('0x18c')])?_0xd10738['dialPrefix'][_0xbfdf('0x18d')]()||'':'',_0xd10738['dialCutDigit']>0x0?_0x21e339[_0xbfdf('0x16b')][_0xbfdf('0x16c')][_0xbfdf('0x18e')](_0xd10738[_0xbfdf('0x18f')]):_0x21e339[_0xbfdf('0x16b')]['phone']):util['format'](_0xbfdf('0x18b'),_['isNil'](_0xd10738[_0xbfdf('0x13d')])?_0xd10738[_0xbfdf('0x76')]['name']:_0xd10738['TrunkBackup'][_0xbfdf('0x40')],isNotNull(_0xd10738['dialPrefix'])?_0xd10738['dialPrefix'][_0xbfdf('0x18d')]()||'':'',_0xd10738['dialCutDigit']>0x0?_0x21e339[_0xbfdf('0x16b')][_0xbfdf('0x16c')]['substring'](_0xd10738[_0xbfdf('0x18f')]):_0x21e339[_0xbfdf('0x16b')]['phone']),'callerid':_0x144b76,'Exten':'xcally-motion-dialer','Context':_0xbfdf('0x190'),'Priority':'1','variable':_0xcf313b,'timeout':(_0xd10738[_0xbfdf('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2a6df4})[_0xbfdf('0x3c')](function(_0x56d832){return _0x54252d(_0x56d832);})[_0xbfdf('0xb7')](function(_0x5f1db4){_0xd10738[_0xbfdf('0x66')]+=0x1;var _0x2bf851=new History(_0x51a835[_0xbfdf('0x21')][_0x2a6df4]);logger[_0xbfdf('0x96')](util[_0xbfdf('0x79')](_0xbfdf('0x191'),JSON['stringify'](_0x5f1db4)));_0x2bf851[_0xbfdf('0xaa')]=0xe;_0x2bf851[_0xbfdf('0xab')]=_0xbfdf('0x192');_0x2bf851[_0xbfdf('0xad')]=moment()['format'](_0xbfdf('0xfe'));_0x2bf851[_0xbfdf('0xac')]=_0x2bf851['starttime'];_0x51a835[_0xbfdf('0xcc')](_0x2bf851)[_0xbfdf('0xb7')](loggerCatch('[originate][error]'));_0x51a835[_0xbfdf('0xca')](_0x2bf851)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x193')))[_0xbfdf('0x1a')](function(){delete _0x51a835[_0xbfdf('0x21')][_0x2a6df4];return _0x5dbdc6(msgResponse(_0xbfdf('0x16d'),_0xbfdf('0x194'),_0xbfdf('0x195')));});});});};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x2d')]=function(_0x41f27a){var _0x50cb8d=this[_0xbfdf('0x21')][_0x41f27a['actionid']];if(_0x50cb8d){delete this[_0xbfdf('0x21')][_0x41f27a[_0xbfdf('0x125')]];_0x50cb8d[_0xbfdf('0x113')]=moment()[_0xbfdf('0x79')](_0xbfdf('0xfe'));var _0x46584a=_0x50cb8d[_0xbfdf('0x57')]==='ivr'?this[_0xbfdf('0x1d')][_0x50cb8d[_0xbfdf('0xb3')]]:this[_0xbfdf('0x1c')][_0x50cb8d['getQueue']()];if(!this[_0xbfdf('0x196')](_0x41f27a[_0xbfdf('0x197')])){this[_0xbfdf('0xb2')](_0x46584a);return this['callProgressDetecting'](_0x50cb8d,_0x46584a,_0x41f27a)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0xbfdf('0x23')][_0x41f27a[_0xbfdf('0xe0')]]=_0x50cb8d;}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x198')]=function(_0xe426a6,_0x1aa867,_0x1a5c83){var _0x506376=new History(_0x1aa867);if(_0x506376[_0xbfdf('0xf2')]+_0x506376[_0xbfdf('0xf3')]+_0x506376[_0xbfdf('0xf4')]+_0x506376['countnosuchnumberretry']+_0x506376[_0xbfdf('0xf6')]+_0x506376[_0xbfdf('0xf7')]+_0x506376[_0xbfdf('0xef')]+_0x506376[_0xbfdf('0x199')]>=_0x1a5c83['dialGlobalMaxRetry']-0x1){return!![];}switch(_0xe426a6){case 0x3:if(_0x506376['countnoanswerretry']>=_0x1a5c83[_0xbfdf('0x19a')]-0x1){return!![];}this[_0xbfdf('0xc0')]({'active':![],'countnoanswerretry':_0x506376[_0xbfdf('0xf4')]+=0x1,'scheduledat':moment()[_0xbfdf('0xfc')](_0x1a5c83[_0xbfdf('0x19b')],_0xbfdf('0xfd'))[_0xbfdf('0x79')](_0xbfdf('0xfe')),'ContactId':_0x506376[_0xbfdf('0xd5')],'ListId':_0x506376[_0xbfdf('0xd6')],'VoiceQueueId':_0x506376[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x506376[_0xbfdf('0xd9')]||undefined})['catch'](loggerCatch(_0xbfdf('0x19c')));break;case 0x5:if(_0x506376[_0xbfdf('0xf2')]>=_0x1a5c83[_0xbfdf('0x19d')]-0x1){return!![];}this[_0xbfdf('0xc0')]({'active':![],'countbusyretry':_0x506376[_0xbfdf('0xf2')]+=0x1,'scheduledat':moment()[_0xbfdf('0xfc')](_0x1a5c83['dialBusyRetryFrequency'],_0xbfdf('0xfd'))['format'](_0xbfdf('0xfe')),'ContactId':_0x506376['ContactId'],'ListId':_0x506376['ListId'],'VoiceQueueId':_0x506376[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x506376[_0xbfdf('0xd9')]||undefined})[_0xbfdf('0xb7')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x506376[_0xbfdf('0xf3')]>=_0x1a5c83[_0xbfdf('0x19e')]-0x1){return!![];}this[_0xbfdf('0xc0')]({'active':![],'countcongestionretry':_0x506376[_0xbfdf('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x1a5c83[_0xbfdf('0x19f')],_0xbfdf('0xfd'))[_0xbfdf('0x79')](_0xbfdf('0xfe')),'ContactId':_0x506376[_0xbfdf('0xd5')],'ListId':_0x506376[_0xbfdf('0xd6')],'VoiceQueueId':_0x506376[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x506376[_0xbfdf('0xd9')]||undefined})[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x1a0')));break;case 0x0:if(_0x506376[_0xbfdf('0xf5')]>=_0x1a5c83['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xbfdf('0xc0')]({'active':![],'countnosuchnumberretry':_0x506376[_0xbfdf('0xf5')]+=0x1,'scheduledat':moment()[_0xbfdf('0xfc')](_0x1a5c83[_0xbfdf('0x1a1')],_0xbfdf('0xfd'))[_0xbfdf('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x506376[_0xbfdf('0xd5')],'ListId':_0x506376[_0xbfdf('0xd6')],'VoiceQueueId':_0x506376['VoiceQueueId']||undefined,'CampaignId':_0x506376['CampaignId']||undefined})[_0xbfdf('0xb7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x506376['countdropretry']>=_0x1a5c83['dialDropMaxRetry']-0x1){return!![];}this[_0xbfdf('0xc0')]({'active':![],'countdropretry':_0x506376[_0xbfdf('0xf6')]+=0x1,'scheduledat':moment()[_0xbfdf('0xfc')](_0x1a5c83[_0xbfdf('0x117')],_0xbfdf('0xfd'))[_0xbfdf('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x506376[_0xbfdf('0xd5')],'ListId':_0x506376[_0xbfdf('0xd6')],'VoiceQueueId':_0x506376[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x506376[_0xbfdf('0xd9')]||undefined})['catch'](loggerCatch(_0xbfdf('0x118')));break;case 0xb:if(_0x506376['countabandonedretry']>=_0x1a5c83[_0xbfdf('0x11f')]-0x1){return!![];}this[_0xbfdf('0xc0')]({'active':![],'countabandonedretry':_0x506376['countabandonedretry']+=0x1,'scheduledat':moment()[_0xbfdf('0xfc')](_0x1a5c83[_0xbfdf('0x120')],_0xbfdf('0xfd'))['format'](_0xbfdf('0xfe')),'ContactId':_0x506376[_0xbfdf('0xd5')],'ListId':_0x506376[_0xbfdf('0xd6')],'VoiceQueueId':_0x506376[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x506376[_0xbfdf('0xd9')]||undefined})['catch'](loggerCatch(_0xbfdf('0x121')));break;case 0x13:if(_0x506376['countmachineretry']>=_0x1a5c83[_0xbfdf('0xfa')]-0x1){return!![];}this[_0xbfdf('0xc0')]({'active':![],'countmachineretry':_0x506376[_0xbfdf('0xef')]+=0x1,'scheduledat':moment()[_0xbfdf('0xfc')](_0x1a5c83['dialMachineRetryFrequency'],_0xbfdf('0xfd'))[_0xbfdf('0x79')](_0xbfdf('0xfe')),'ContactId':_0x506376[_0xbfdf('0xd5')],'ListId':_0x506376[_0xbfdf('0xd6')],'VoiceQueueId':_0x506376['VoiceQueueId']||undefined,'CampaignId':_0x506376['CampaignId']||undefined})[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x104')));break;case 0x14:if(_0x506376['countagentrejectretry']>=_0x1a5c83[_0xbfdf('0x1a2')]-0x1){return!![];}this[_0xbfdf('0xc0')]({'active':![],'countagentrejectretry':_0x506376[_0xbfdf('0x199')]+=0x1,'scheduledat':moment()[_0xbfdf('0xfc')](_0x1a5c83['dialAgentRejectRetryFrequency'],_0xbfdf('0xfd'))[_0xbfdf('0x79')](_0xbfdf('0xfe')),'ContactId':_0x506376[_0xbfdf('0xd5')],'ListId':_0x506376[_0xbfdf('0xd6')],'VoiceQueueId':_0x506376[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x506376[_0xbfdf('0xd9')]||undefined})[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x1a3')));break;default:return!![];}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x1a4')]=function(_0x57a3bf,_0x1db3a8,_0x189798){var _0x1087c3=this;var _0x354a84=new History(_0x57a3bf);return new BPromise(function(_0x1e70e7,_0x1bebb0){if(_[_0xbfdf('0x83')](_0x1db3a8)&&typeof _0x1db3a8!=='object'){return _0x1bebb0(msgResponse(_0xbfdf('0x1a5'),_0xbfdf('0x142'),'entity\x20is\x20undefine'));}if(_[_0xbfdf('0x83')](_0x189798)&&typeof _0x189798!==_0xbfdf('0x169')){return _0x1bebb0(msgResponse(_0xbfdf('0x1a5'),_0xbfdf('0x142'),_0xbfdf('0x1a6')));}switch(_0x189798[_0xbfdf('0x1a7')]){case'0':_0x1db3a8[_0xbfdf('0x65')]+=0x1;_0x354a84[_0xbfdf('0xaa')]=0x0;_0x354a84[_0xbfdf('0xab')]=_0xbfdf('0x1a8');_0x354a84[_0xbfdf('0xf5')]+=0x1;_0x354a84[_0xbfdf('0xf0')]+=0x1;ami[_0xbfdf('0x4c')](_0xbfdf('0x1a9'),ut[_0xbfdf('0xe9')](_0x57a3bf,_0xbfdf('0x1aa')));_0x1087c3[_0xbfdf('0xcc')](_0x354a84)['catch'](loggerCatch(_0xbfdf('0xf1')));if(_0x1087c3['checkRetriveMax'](0x0,_0x57a3bf,_0x1db3a8)){if(_0x354a84['countnosuchnumberretry']>=_0x1db3a8[_0xbfdf('0x1ab')]){_0x1087c3[_0xbfdf('0x102')](_0x354a84,_0x1e70e7,_0x1bebb0,'reason\x200\x20no\x20such\x20number....');}else{_0x1087c3[_0xbfdf('0xf9')](_0x354a84,_0x1e70e7,_0x1bebb0,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1db3a8['outboundNoAnswerCallsDay']+=0x1;_0x354a84['state']=0x3;_0x354a84[_0xbfdf('0xab')]='NoAnswer';_0x354a84[_0xbfdf('0xf4')]+=0x1;_0x354a84[_0xbfdf('0xf0')]+=0x1;ami[_0xbfdf('0x4c')](_0xbfdf('0x1ac'),ut[_0xbfdf('0xe9')](_0x57a3bf,_0xbfdf('0x1ad')));_0x1087c3[_0xbfdf('0xcc')](_0x354a84)['catch'](loggerCatch(_0xbfdf('0x1ae')));if(_0x1087c3[_0xbfdf('0x198')](0x3,_0x57a3bf,_0x1db3a8)){if(_0x354a84[_0xbfdf('0xf4')]>=_0x1db3a8[_0xbfdf('0x19a')]){_0x1087c3[_0xbfdf('0x102')](_0x354a84,_0x1e70e7,_0x1bebb0,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1087c3[_0xbfdf('0xf9')](_0x354a84,_0x1e70e7,_0x1bebb0,_0xbfdf('0x1af'));}}break;case'5':_0x1db3a8[_0xbfdf('0x1b0')]+=0x1;_0x354a84['state']=0x5;_0x354a84[_0xbfdf('0xab')]=_0xbfdf('0x1b1');_0x354a84[_0xbfdf('0xf2')]+=0x1;_0x354a84[_0xbfdf('0xf0')]+=0x1;ami[_0xbfdf('0x4c')](_0xbfdf('0x1b2'),ut[_0xbfdf('0xe9')](_0x57a3bf,_0xbfdf('0x1b3')));_0x1087c3[_0xbfdf('0xcc')](_0x354a84)[_0xbfdf('0xb7')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1087c3[_0xbfdf('0x198')](0x5,_0x57a3bf,_0x1db3a8)){if(_0x354a84['countbusyretry']>=_0x1db3a8[_0xbfdf('0x19d')]){_0x1087c3['createStateFinal'](_0x354a84,_0x1e70e7,_0x1bebb0,_0xbfdf('0x1b4'));}else{_0x1087c3[_0xbfdf('0xf9')](_0x354a84,_0x1e70e7,_0x1bebb0,_0xbfdf('0x1b4'));}}break;case'8':_0x1db3a8[_0xbfdf('0x61')]+=0x1;_0x354a84['state']=0x8;_0x354a84['statedesc']='Congestion';_0x354a84[_0xbfdf('0xf3')]+=0x1;_0x354a84['countglobal']+=0x1;ami[_0xbfdf('0x4c')]('custom:agentcongestion',ut[_0xbfdf('0xe9')](_0x57a3bf,'congestion'));_0x1087c3[_0xbfdf('0xcc')](_0x354a84)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x1b5')));if(_0x1087c3[_0xbfdf('0x198')](0x8,_0x57a3bf,_0x1db3a8)){if(_0x354a84[_0xbfdf('0xf3')]>=_0x1db3a8['dialCongestionMaxRetry']){_0x1087c3[_0xbfdf('0x102')](_0x354a84,_0x1e70e7,_0x1bebb0,_0xbfdf('0x1b6'));}else{_0x1087c3[_0xbfdf('0xf9')](_0x354a84,_0x1e70e7,_0x1bebb0,_0xbfdf('0x1b6'));}}break;case'11':_0x1db3a8[_0xbfdf('0x1b7')]+=0x1;_0x354a84[_0xbfdf('0xaa')]=0xb;_0x354a84[_0xbfdf('0xab')]='Abandoned';_0x354a84['countabandonedretry']+=0x1;_0x354a84['countglobal']+=0x1;_0x1087c3[_0xbfdf('0xcc')](_0x354a84)['catch'](loggerCatch(_0xbfdf('0x122')));if(_0x1087c3['checkRetriveMax'](0xb,_0x57a3bf,_0x1db3a8)){if(_0x354a84[_0xbfdf('0xf7')]>=_0x1db3a8[_0xbfdf('0x11f')]){_0x1087c3[_0xbfdf('0x102')](_0x354a84,_0x1e70e7,_0x1bebb0,_0xbfdf('0x1b8'));}else{_0x1087c3['stateGlobal'](_0x354a84,_0x1e70e7,_0x1bebb0,'reason\x2011\x20abandoned');}}break;case'20':_0x1db3a8[_0xbfdf('0x1b9')]+=0x1;_0x354a84[_0xbfdf('0xaa')]=0x14;_0x354a84[_0xbfdf('0xab')]=_0xbfdf('0x1ba');_0x354a84[_0xbfdf('0x199')]+=0x1;_0x354a84[_0xbfdf('0xf0')]+=0x1;ami['emit']('custom:agentreject',ut[_0xbfdf('0xe9')](_0x57a3bf,_0xbfdf('0x1bb')));_0x1087c3[_0xbfdf('0xcc')](_0x354a84)[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x1bc')));if(_0x1087c3[_0xbfdf('0x198')](0x14,_0x57a3bf,_0x1db3a8)){if(_0x354a84[_0xbfdf('0x199')]>=_0x1db3a8[_0xbfdf('0x1a2')]){_0x1087c3[_0xbfdf('0x102')](_0x354a84,_0x1e70e7,_0x1bebb0,_0xbfdf('0x1bd'));}else{_0x1087c3[_0xbfdf('0xf9')](_0x354a84,_0x1e70e7,_0x1bebb0,_0xbfdf('0x1bd'));}}break;default:_0x1db3a8[_0xbfdf('0x10a')]+=0x1;_0x354a84['state']=0xc;_0x354a84[_0xbfdf('0xab')]=_0x189798[_0xbfdf('0x1a7')];_0x1087c3[_0xbfdf('0xcc')](_0x354a84)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1087c3[_0xbfdf('0x198')](_0x189798[_0xbfdf('0x1a7')],_0x57a3bf,_0x1db3a8)){if(_0x354a84['countbusyretry']+_0x354a84[_0xbfdf('0xf3')]+_0x354a84[_0xbfdf('0xf4')]+_0x354a84['countnosuchnumberretry']+_0x354a84[_0xbfdf('0xf6')]+_0x354a84[_0xbfdf('0xf7')]+_0x354a84['countmachineretry']+_0x354a84['countagentrejectretry']>=_0x1db3a8[_0xbfdf('0xf8')]){_0x1087c3[_0xbfdf('0xf9')](_0x354a84,_0x1e70e7,_0x1bebb0,_0x189798[_0xbfdf('0x1a7')]);}else{_0x1087c3[_0xbfdf('0x102')](_0x354a84,_0x1e70e7,_0x1bebb0,_0x189798[_0xbfdf('0x1a7')]);}}}});};Dialer[_0xbfdf('0xb8')][_0xbfdf('0xf9')]=function(_0x49b08c,_0x3f2939,_0x64304,_0x4970c5){var _0x22a8b1=new Final(_0x49b08c);_0x22a8b1[_0xbfdf('0xaa')]=0xf;_0x22a8b1['statedesc']=_0xbfdf('0x1be');this[_0xbfdf('0x102')](_0x22a8b1,_0x3f2939,_0x64304,_0x4970c5);};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x102')]=function(_0x5add8c,_0x12854f,_0xa24e22,_0x1c2c5c){this[_0xbfdf('0xca')](_0x5add8c)[_0xbfdf('0x3c')](function(){return _0x12854f(msgResponse(_0xbfdf('0x1a5'),_0xbfdf('0xdb'),_0x1c2c5c));})[_0xbfdf('0xb7')](function(){return _0xa24e22(msgResponse(_0xbfdf('0x1bf'),'Failure',_0xbfdf('0x1c0')));});};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x159')]=function(_0x79f245){var _0x5d74b8=_0x79f245[_0xbfdf('0x1c1')]/0x64;var _0x465ae6=_0x79f245[_0xbfdf('0x64')]/(_0x79f245[_0xbfdf('0x64')]+_0x79f245['outboundAnswerCallsDay']);var _0x4ea333=Math[_0xbfdf('0x1c2')](_0x79f245['predictiveIntervalAvailable']*(_0x79f245[_0xbfdf('0x1c3')]/0x64));var _0x1a6b2f=Math['round'](_0x79f245['predictiveIntervalAvailable']*(_0x79f245['predictiveIntervalMinThreshold']/0x64));var _0x16860e=_0x79f245['available']+_0x79f245['talking'];var _0x5d9677=Math[_0xbfdf('0x1c4')](_0x79f245[_0xbfdf('0x72')]*_0x79f245[_0xbfdf('0x8b')]*_0x79f245[_0xbfdf('0x1c5')]*_0x79f245[_0xbfdf('0x6d')]);if(_[_0xbfdf('0x83')](_0x79f245['startProgressive'])){if(!_[_0xbfdf('0x83')](_0x79f245[_0xbfdf('0x75')])){_0x79f245[_0xbfdf('0x75')]=undefined;loggerPredictive[_0xbfdf('0x96')]('[startMethodPredictive][StartProgressive]',_0xbfdf('0x1c6'));}if(!_['isUndefined'](_0x79f245['handlePredictive'])){loggerPredictive[_0xbfdf('0x96')](_0xbfdf('0x1c7'),_0xbfdf('0x1c8'));clearInterval(_0x79f245[_0xbfdf('0x91')]);_0x79f245[_0xbfdf('0x91')]=undefined;}_0x79f245[_0xbfdf('0x25')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xbfdf('0x7e')](_0x79f245[_0xbfdf('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x79f245['startProgressive']);this['handlePower'](_0x79f245,0x1);}else if(ifInterval(_0x79f245[_0xbfdf('0x1c9')],_0x79f245[_0xbfdf('0x25')])){this['handlePower'](_0x79f245,0x1);loggerPredictiveCalls[_0xbfdf('0x7e')]('[startMethodPredictive][StartProgressive][Loop]',_0x79f245[_0xbfdf('0x25')],_0x79f245[_0xbfdf('0x40')]);_0x79f245[_0xbfdf('0x72')]=0x0;_0x79f245[_0xbfdf('0x6c')]=0x0;}else if(_0x5d74b8<_0x465ae6&&_0x79f245[_0xbfdf('0x1ca')]===_0xbfdf('0x1cb')){freeVariablesPredictive(_0x79f245);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xbfdf('0x1cc'),_0x465ae6,_0xbfdf('0x25'),_0x79f245[_0xbfdf('0x40')]);}else if(_0x5d9677<_0x79f245[_0xbfdf('0x6c')]&&_0x79f245[_0xbfdf('0x1ca')]==='dropRate'){freeVariablesPredictive(_0x79f245);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x1cd'),'Max\x20Drop\x20',_0x5d9677,_0xbfdf('0x1ce'),_0x79f245[_0xbfdf('0x6c')],_0xbfdf('0x25'),_0x79f245[_0xbfdf('0x40')]);}else if(!ifInterval(_0x79f245[_0xbfdf('0x1c9')],_0x79f245[_0xbfdf('0x25')])&&_[_0xbfdf('0x83')](_0x79f245[_0xbfdf('0x75')])&&!_['isUndefined'](_0x79f245[_0xbfdf('0x25')])){_0x79f245[_0xbfdf('0x75')]=moment()['format'](_0xbfdf('0xfe'));loggerPredictive['info'](_0x79f245[_0xbfdf('0x40')],_0xbfdf('0x1cf'),_0x79f245[_0xbfdf('0x75')]);this[_0xbfdf('0xbd')](_0x79f245[_0xbfdf('0x1c9')])[_0xbfdf('0x3c')](this[_0xbfdf('0x1d0')](_0x79f245))['then'](mergeDataErlangB(_0x79f245))[_0xbfdf('0x3c')](this[_0xbfdf('0x1d1')](_0x79f245))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x79f245));}else if(!ifInterval(_0x79f245[_0xbfdf('0x1c9')],_0x79f245[_0xbfdf('0x75')])){_0x79f245[_0xbfdf('0x6c')]=0x0;_0x79f245[_0xbfdf('0x75')]=moment()[_0xbfdf('0x79')](_0xbfdf('0xfe'));loggerPredictive[_0xbfdf('0x7e')](_0x79f245[_0xbfdf('0x40')],_0xbfdf('0x1d2'),_0x79f245[_0xbfdf('0x75')]);clearInterval(_0x79f245[_0xbfdf('0x91')]);_0x79f245[_0xbfdf('0x91')]=undefined;this[_0xbfdf('0xbd')](_0x79f245[_0xbfdf('0x1c9')])[_0xbfdf('0x3c')](this[_0xbfdf('0x1d0')](_0x79f245))['then'](mergeDataErlangB(_0x79f245))[_0xbfdf('0x3c')](this['startMethodPredictive'](_0x79f245))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x79f245));}else if(_0x79f245[_0xbfdf('0x6f')]&&_0x16860e<_0x79f245['predictiveIntervalAvailable']-_0x1a6b2f){freeVariablesPredictive(_0x79f245);loggerPredictive[_0xbfdf('0x7e')](_0x79f245[_0xbfdf('0x40')],_0xbfdf('0x1d3'),_0x16860e,_0xbfdf('0x1d4'),_0x79f245[_0xbfdf('0x6f')],'-',_0x1a6b2f,'=',_0x79f245[_0xbfdf('0x6f')]-_0x1a6b2f,')');}else if(_0x79f245['predictiveIntervalAvailable']&&_0x16860e>_0x79f245[_0xbfdf('0x6f')]+_0x4ea333){freeVariablesPredictive(_0x79f245);loggerPredictive[_0xbfdf('0x7e')](_0x79f245[_0xbfdf('0x40')],_0xbfdf('0x1d3'),_0x16860e,')\x20are\x20more\x20than\x20threshold\x20(',_0x79f245[_0xbfdf('0x6f')],'+',_0x4ea333,'=',_0x79f245[_0xbfdf('0x6f')]+_0x4ea333,')');}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x1d0')]=function(_0x3c9bf1){var _0x2a0246=this;return function(_0x29016b){return new BPromise(function(_0x20a0ef,_0x40944f){_[_0xbfdf('0x8e')](_0x3c9bf1,_0x29016b[0x0]);if(checkGetDataPredictive(_0x29016b[0x0])){var _0x4f26ce=_0x3c9bf1[_0xbfdf('0x6f')]=_0x3c9bf1['talking']+_0x3c9bf1['available'];var _0x552e87=_0x3c9bf1[_0xbfdf('0x1c9')]*0x3c;var _0x41833d=_0x29016b[0x0][_0xbfdf('0x84')]+_0x29016b[0x0]['predictiveIntervalAvgHoldtime'];var _0x1c3853=(_0x29016b[0x0]['predictiveIntervalAnsweredCalls']+_0x29016b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x29016b[0x0][_0xbfdf('0x81')])/_0x29016b[0x0][_0xbfdf('0x70')];_0x3c9bf1['predictiveIntervalHitRate']=_0x1c3853>0x0?_0x1c3853:0x1;switch(_0x3c9bf1['dialPredictiveOptimization']){case _0xbfdf('0x1cb'):var _0x104b6f=_0x3c9bf1['dialPredictiveOptimizationPercentage']/0x64;return _0x2a0246['abandonmentRate'](_0x4f26ce,_0x552e87,_0x41833d,_0x1c3853,_0x104b6f)[_0xbfdf('0x3c')](function(_0x30b5d3){return _0x20a0ef(_0x30b5d3);});case _0xbfdf('0x1d5'):var _0x57af0=_0x3c9bf1[_0xbfdf('0x1c1')]/0x64;return _0x2a0246[_0xbfdf('0x1d6')](_0x4f26ce,_0x552e87,_0x41833d,_0x1c3853,_0x57af0)[_0xbfdf('0x3c')](function(_0x5c6473){return _0x20a0ef(_0x5c6473);});default:return _0x40944f(msgResponse(_0xbfdf('0x1d7'),_0xbfdf('0x142'),'Unknown\x20Predictive'));}}else{return _0x40944f(msgResponse('[getDataPredictive]','Failure',_0xbfdf('0x1d8')));}});};};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x1d9')]=function(_0x5e7399){var _0x132415=this;return function(_0x4c6c9a){return new BPromise(function(_0x53f529,_0x2a9fab){_[_0xbfdf('0x8e')](_0x5e7399,_0x4c6c9a[0x0]);if(checkGetDataPredictive(_0x4c6c9a[0x0])){loggerPredictive[_0xbfdf('0x7e')](JSON[_0xbfdf('0x49')](_0x4c6c9a[0x0]));if(_0x5e7399['dialPredictiveOptimization']===_0xbfdf('0x1cb')){return _0x132415[_0xbfdf('0xc8')](_0x5e7399['id'])['then'](function(_0x47907d){var _0x6f05a7=_0x5e7399['loggedIn']-_0x47907d[0x0][_0xbfdf('0x1da')];var _0x2c27b3=_0x5e7399[_0xbfdf('0x1c9')]*0x3c;var _0x1243b3=_0x4c6c9a[0x0][_0xbfdf('0x84')]+_0x4c6c9a[0x0][_0xbfdf('0x69')];var _0x2f879d=(_0x4c6c9a[0x0][_0xbfdf('0x68')]+_0x4c6c9a[0x0][_0xbfdf('0x6a')]+_0x4c6c9a[0x0][_0xbfdf('0x81')])/_0x4c6c9a[0x0][_0xbfdf('0x70')];var _0x585f3b=_0x5e7399[_0xbfdf('0x1c1')]/0x64;_0x5e7399[_0xbfdf('0x6e')]=_0x47907d[0x0]['outboundQueuePauses']||0x0;_0x5e7399[_0xbfdf('0x1c5')]=_0x2f879d>0x0?_0x2f879d:0x1;return _0x132415[_0xbfdf('0x1db')](_0x6f05a7,_0x2c27b3,_0x1243b3,_0x2f879d,_0x585f3b);})['then'](function(_0x3229bb){return _0x53f529(_0x3229bb);})[_0xbfdf('0xb7')](function(_0x3f9508){return _0x2a9fab(msgResponse(_0xbfdf('0x1dc'),_0xbfdf('0x142'),JSON[_0xbfdf('0x49')](_0x3f9508)));});}if(_0x5e7399['dialPredictiveOptimization']==='agentBusyFactor'){return _0x132415[_0xbfdf('0xc8')](_0x5e7399['id'])['then'](function(_0x317770){var _0x34f666=_0x5e7399[_0xbfdf('0x51')]-_0x317770[0x0][_0xbfdf('0x1da')];var _0x586d7b=_0x5e7399[_0xbfdf('0x1c9')]*0x3c;var _0x5b3c57=_0x4c6c9a[0x0]['predictiveIntervalAvgTalktime']+_0x4c6c9a[0x0][_0xbfdf('0x69')];var _0x3ff861=(_0x4c6c9a[0x0][_0xbfdf('0x68')]+_0x4c6c9a[0x0][_0xbfdf('0x6a')]+_0x4c6c9a[0x0][_0xbfdf('0x81')])/_0x4c6c9a[0x0]['predictiveIntervalTotalCalls'];var _0x55f33b=_0x5e7399[_0xbfdf('0x1c1')]/0x64;_0x5e7399[_0xbfdf('0x6e')]=_0x317770[0x0][_0xbfdf('0x1da')]||0x0;_0x5e7399['predictiveIntervalHitRate']=_0x3ff861>0x0?_0x3ff861:0x1;return _0x132415[_0xbfdf('0x1d6')](_0x34f666,_0x586d7b,_0x5b3c57,_0x3ff861,_0x55f33b);})[_0xbfdf('0x3c')](function(_0xb0d986){return _0x53f529(_0xb0d986);})['catch'](function(_0x4b0a60){return _0x2a9fab(msgResponse(_0xbfdf('0x1dc'),_0xbfdf('0x142'),JSON[_0xbfdf('0x49')](_0x4b0a60)));});}}else{return _0x2a9fab(msgResponse(_0xbfdf('0x1d7'),_0xbfdf('0x142'),'check\x20failure'));}});};};Dialer['prototype'][_0xbfdf('0x1d1')]=function(_0x285f40){var _0xf242fa=this;return function(){var _0xf3a01a=0x0;var _0x187a78=Math[_0xbfdf('0x1c4')](_0x285f40['erlangCallToSecond']*0x3e8);if(_0x187a78>0x0){_0x187a78=_0x187a78<0x64?0x64:_0x187a78;loggerPredictive[_0xbfdf('0x7e')](_0x285f40[_0xbfdf('0x40')],_0xbfdf('0x1dd'),_0x187a78,_0xbfdf('0x4a'));_0x285f40[_0xbfdf('0x91')]=setInterval(function(){_0xf242fa[_0xbfdf('0x91')](_0x285f40);loggerPredictiveCalls[_0xbfdf('0x7e')]('[handlePredictive]',_0xf3a01a+=0x1);},_0x187a78);}else{loggerPredictive[_0xbfdf('0x7e')](_0x285f40[_0xbfdf('0x40')],_0xbfdf('0x1de'));}};};Dialer['prototype']['checkContactBlack']=function(_0x2acc81,_0x1ccf08){var _0x1caaee=this;return function(_0x4d4552){if(_['isEmpty'](_0x4d4552)){if(_[_0xbfdf('0xe1')](_0x1ccf08[_0xbfdf('0xd7')])||!_0x1ccf08[_0xbfdf('0x1df')]){if(_0x2acc81['dialMethod']===_0xbfdf('0xa')){_0x2acc81[_0xbfdf('0x12a')]=_[_0xbfdf('0x83')](_0x2acc81[_0xbfdf('0x12a')])?!![]:_0x2acc81[_0xbfdf('0x12a')];var _0x5a142d=uuid['v4']();_0x1caaee[_0xbfdf('0x21')][_0x5a142d]=new Action(_0x2acc81,_0x1ccf08,_0x5a142d);loggerBooked[_0xbfdf('0x7e')](_0xbfdf('0x1e0'),_0x5a142d,_0xbfdf('0x1e1'),JSON['stringify'](_0x2acc81[_0xbfdf('0x12a')]),'Queue:\x20',_0x2acc81[_0xbfdf('0x40')]);if(_0x2acc81[_0xbfdf('0x12a')]){_0x2acc81[_0xbfdf('0x12a')]=![];_0x1caaee[_0xbfdf('0x128')][_0x1caaee[_0xbfdf('0x21')][_0x5a142d][_0xbfdf('0xb3')]]=[];ami['Action']({'actionid':_0x5a142d,'action':'queuestatus','queue':_0x2acc81[_0xbfdf('0x40')]})[_0xbfdf('0xb7')](function(){_0x1caaee[_0xbfdf('0xb2')](_0x2acc81);_0x1caaee[_0xbfdf('0xc0')]({'active':![],'ContactId':_0x1caaee[_0xbfdf('0x21')][_0x5a142d][_0xbfdf('0xd5')],'ListId':_0x1caaee['actions'][_0x5a142d][_0xbfdf('0xd6')],'VoiceQueueId':_0x1caaee[_0xbfdf('0x21')][_0x5a142d][_0xbfdf('0xd8')]||undefined,'CampaignId':_0x1caaee['actions'][_0x5a142d][_0xbfdf('0xd9')]||undefined})[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x1e2')));delete _0x1caaee['actions'][_0x5a142d];});}else{loggerBooked[_0xbfdf('0x7e')]('[booked][checkContactBlack][else]',JSON[_0xbfdf('0x49')](_0x2acc81[_0xbfdf('0x12a')]),'Queue:\x20',_0x2acc81[_0xbfdf('0x40')]);_0x1caaee[_0xbfdf('0xb2')](_0x2acc81);_0x1caaee[_0xbfdf('0xc0')]({'active':![],'ContactId':_0x1caaee['actions'][_0x5a142d][_0xbfdf('0xd5')],'ListId':_0x1caaee[_0xbfdf('0x21')][_0x5a142d][_0xbfdf('0xd6')],'VoiceQueueId':_0x1caaee[_0xbfdf('0x21')][_0x5a142d][_0xbfdf('0xd8')]||undefined,'CampaignId':_0x1caaee['actions'][_0x5a142d][_0xbfdf('0xd9')]||undefined})[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x1e2')));delete _0x1caaee[_0xbfdf('0x21')][_0x5a142d];}}else{return _0x1caaee[_0xbfdf('0x168')](_0x2acc81,_0x1ccf08);}}else{if(getDiff(_0x1ccf08['scheduledat'])<_0x2acc81[_0xbfdf('0x1e3')]*0x3c){if(_0x1ccf08['Agent']&&!_0x1ccf08['Agent'][_0xbfdf('0x1e4')]){_0x1caaee[_0xbfdf('0x1b')][_0xbfdf('0x12d')](_0x1ccf08['id'])[_0xbfdf('0x1a')](function(){_0x1caaee[_0xbfdf('0xb2')](_0x2acc81);});}else{_0x1caaee[_0xbfdf('0xc2')]({'active':![]},_0x1ccf08['id'],0x1)[_0xbfdf('0x1a')](function(){_0x1caaee['updateOriginated'](_0x2acc81);});}}else{_0x2acc81['outboundReCallsDay']+=0x1;_0x1caaee[_0xbfdf('0xb2')](_0x2acc81);if(_0x2acc81['dialRecallInQueue']){_0x1caaee['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1ccf08['ContactId'],'ListId':_0x1ccf08[_0xbfdf('0xd6')],'VoiceQueueId':_0x1ccf08[_0xbfdf('0xd8')]||undefined,'CampaignId':_0x1ccf08[_0xbfdf('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x1caaee[_0xbfdf('0xcc')](createObjHistory(_0x2acc81,_0x1ccf08,'RECALLINQUEUE',0x17,_0xbfdf('0x1e5')))['catch'](loggerCatch(_0xbfdf('0x1e6')));}else{_0x1caaee[_0xbfdf('0xd3')](createObjHistory(_0x2acc81,_0x1ccf08,'RECALLFAILEDTIMEOUT',0x16,_0xbfdf('0x1e7')),_0xbfdf('0x1e8'),_0xbfdf('0x1e9'));}}}}else{_0x2acc81[_0xbfdf('0x60')]+=0x1;_0x1caaee[_0xbfdf('0xd3')](createObjHistory(_0x2acc81,_0x1ccf08,_0xbfdf('0x1ea'),0xd,'Blacklist'),_0xbfdf('0x1eb'),_0xbfdf('0x1ec'));throw _0xbfdf('0x1ed');}};};Dialer[_0xbfdf('0xb8')]['handleIvr']=function(_0x510f67){var _0x3993eb=this;var _0x4ae953=_0x510f67[_0xbfdf('0x1ee')]-_0x510f67['originated']-_0x510f67[_0xbfdf('0xc5')];emitCampaignSummary(_0x510f67);if(_0x4ae953>0x0){if(_0x4ae953>this[_0xbfdf('0x1ef')]){_0x4ae953=this[_0xbfdf('0x1ef')];}_0x510f67['temp']+=_0x4ae953;this[_0xbfdf('0x1f0')](_0x510f67['id'],_0x4ae953,_0x510f67[_0xbfdf('0x1f1')],_0x510f67)[_0xbfdf('0x3c')](function(_0x5b2ee2){_0x510f67['temp']-=_0x4ae953;_0x510f67['temp']=_0x510f67[_0xbfdf('0xc5')]>0x0?_0x510f67['temp']:0x0;if(!checkContactEmpty(_0x5b2ee2)){_0x510f67[_0xbfdf('0x3e')]=_0xbfdf('0x1f2');logger['info'](_0xbfdf('0x1f3')+_0x510f67[_0xbfdf('0x40')]);}else{_0x510f67[_0xbfdf('0x71')]+=_0x5b2ee2['length'];_0x510f67['message']=_0xbfdf('0x1f4');for(var _0x4a6684=0x0;_0x4a6684<_0x5b2ee2[_0xbfdf('0x98')];_0x4a6684+=0x1){_0x510f67[_0xbfdf('0x1f5')]+=0x1;if(_['isNil'](_0x5b2ee2[_0x4a6684])||_[_0xbfdf('0xe1')](_0x5b2ee2[_0x4a6684]['Contact'])||_[_0xbfdf('0xe1')](_0x5b2ee2[_0x4a6684][_0xbfdf('0x16b')][_0xbfdf('0x16c')])){_0x3993eb[_0xbfdf('0xd1')](_0xbfdf('0x1f6'),_0x510f67,_0x5b2ee2[_0x4a6684]);}else{_0x3993eb[_0xbfdf('0xbb')](_[_0xbfdf('0xd4')](_0x5b2ee2[_0x4a6684],[_0xbfdf('0xd9'),'Contact.phone']))[_0xbfdf('0x3c')](_0x3993eb[_0xbfdf('0x1f7')](_0x510f67,_0x5b2ee2[_0x4a6684]))[_0xbfdf('0xb7')](_0x3993eb[_0xbfdf('0xd0')](_0xbfdf('0x1f8'),_0x510f67));}}}})[_0xbfdf('0xb7')](loggerGetContactDialer(_0xbfdf('0x1f9'),_0x510f67,_0x4ae953));}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x157')]=function(_0x5a04d9,_0x4a3f64){var _0x4bf1e8=this;var _0x370745=[];var _0x4ece94=_0x4a3f64>=0x1?_0x4a3f64:0x1;if(_0x5a04d9[_0xbfdf('0x155')]==='booked'){_0x4ece94=0x1;}var _0x3007b8=Math[_0xbfdf('0x1c4')](_0x5a04d9['available']*_0x4ece94)-_0x5a04d9[_0xbfdf('0x71')]-_0x5a04d9[_0xbfdf('0xc5')];emitVoiceQueueSummary(_0x5a04d9);if(_0x5a04d9[_0xbfdf('0x1fa')]>0x0){var _0x2156b1=_0x5a04d9[_0xbfdf('0x1fa')]-_0x5a04d9['originated']-_0x5a04d9[_0xbfdf('0xa2')]-_0x5a04d9[_0xbfdf('0xc5')]-_0x5a04d9[_0xbfdf('0x52')];if(_0x3007b8>_0x2156b1){_0x3007b8=_0x2156b1;}}if(_0x3007b8>0x0){if(_0x5a04d9[_0xbfdf('0x155')]===_0xbfdf('0xa')){_0x3007b8=0x1;}if(_0x3007b8>this[_0xbfdf('0x1ef')]){_0x3007b8=this[_0xbfdf('0x1ef')];}_0x5a04d9[_0xbfdf('0xc5')]+=_0x3007b8;for(var _0x32d1d2 in this[_0xbfdf('0x1e')]){if(typeof this[_0xbfdf('0x1e')][_0x32d1d2]!=='undefined'){if(this[_0xbfdf('0x1e')][_0x32d1d2][_0xbfdf('0xaa')]===_0xbfdf('0x1fb')&&this[_0xbfdf('0x1e')][_0x32d1d2]['status']==='reachable'){_0x370745[_0xbfdf('0x147')](this[_0xbfdf('0x1e')][_0x32d1d2]['id']);}}}this['getContactDialer'](_0x5a04d9['id'],_0x370745,_0x3007b8,_0x5a04d9['dialOrderByScheduledAt'],_0x5a04d9)['then'](function(_0x3d87c1){_0x5a04d9[_0xbfdf('0xc5')]-=_0x3007b8;_0x5a04d9[_0xbfdf('0xc5')]=_0x5a04d9[_0xbfdf('0xc5')]>0x0?_0x5a04d9[_0xbfdf('0xc5')]:0x0;if(!checkContactEmpty(_0x3d87c1)){_0x4bf1e8[_0xbfdf('0xb6')](_0x5a04d9)['then'](sendMessageReschedule(_0x5a04d9))[_0xbfdf('0xb7')](loggerCatch(_0xbfdf('0x1fc')));}else{_0x5a04d9[_0xbfdf('0x71')]+=_0x3d87c1[_0xbfdf('0x98')];_0x5a04d9[_0xbfdf('0x3e')]=_0x5a04d9['dialMethod']===_0xbfdf('0xa')?_0xbfdf('0x175'):_0xbfdf('0x1f4');for(var _0x2aecec=0x0;_0x2aecec<_0x3d87c1[_0xbfdf('0x98')];_0x2aecec+=0x1){if(_[_0xbfdf('0xe1')](_0x3d87c1[_0x2aecec])||_[_0xbfdf('0xe1')](_0x3d87c1[_0x2aecec]['Contact'])||_['isNil'](_0x3d87c1[_0x2aecec][_0xbfdf('0x16b')][_0xbfdf('0x16c')])){_0x4bf1e8[_0xbfdf('0xd1')](_0xbfdf('0x1f6'),_0x5a04d9,_0x3d87c1[_0x2aecec]);}else{_0x4bf1e8[_0xbfdf('0xb9')](_[_0xbfdf('0xd4')](_0x3d87c1[_0x2aecec],[_0xbfdf('0xd8'),_0xbfdf('0x1fd')]))['then'](_0x4bf1e8[_0xbfdf('0x1f7')](_0x5a04d9,_0x3d87c1[_0x2aecec]))[_0xbfdf('0xb7')](_0x4bf1e8[_0xbfdf('0xd0')](_0xbfdf('0x1f6'),_0x5a04d9));}}}})[_0xbfdf('0xb7')](loggerGetContactDialer('[getContactDialer2]',_0x5a04d9,_0x3007b8));}};Dialer[_0xbfdf('0xb8')]['handlePredictive']=function(_0x35415a){if(_0x35415a[_0xbfdf('0x1fa')]>0x0){var _0x3213ee=_0x35415a['dialLimitQueue']-_0x35415a[_0xbfdf('0x71')]-_0x35415a[_0xbfdf('0xa2')];if(_0x3213ee>0x0){this[_0xbfdf('0x1fe')](_0x35415a);}else{loggerPredictiveCalls['info'](_0xbfdf('0x1ff'));}}else{this[_0xbfdf('0x1fe')](_0x35415a);}};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x1fe')]=function(_0x35b260){var _0x3d9e1e=this;var _0x5e51f1=[];_0x35b260[_0xbfdf('0x71')]+=0x1;for(var _0x4684d2 in this[_0xbfdf('0x1e')]){if(typeof this[_0xbfdf('0x1e')][_0x4684d2]!==_0xbfdf('0x99')){if(this[_0xbfdf('0x1e')][_0x4684d2]['state']===_0xbfdf('0x1fb')&&this[_0xbfdf('0x1e')][_0x4684d2][_0xbfdf('0xde')]===_0xbfdf('0xdf')){_0x5e51f1['push'](this[_0xbfdf('0x1e')][_0x4684d2]['id']);}}}this[_0xbfdf('0xc4')](_0x35b260['id'],_0x5e51f1,0x1,_0x35b260[_0xbfdf('0x1f1')],_0x35b260)['then'](function(_0x2ffa50){if(!checkContactEmpty(_0x2ffa50)){checkContactLowerLimitOriginate(_0x35b260,0x1,0x0);_0x3d9e1e[_0xbfdf('0xb6')](_0x35b260)[_0xbfdf('0x3c')](sendMessageReschedule(_0x35b260))[_0xbfdf('0xb7')](loggerCatch('[countReScheduled]\x20'));}else{_0x35b260['message']='RUNNING';if(_['isNil'](_0x2ffa50[0x0])||_[_0xbfdf('0xe1')](_0x2ffa50[0x0][_0xbfdf('0x16b')])||_['isNil'](_0x2ffa50[0x0]['Contact'][_0xbfdf('0x16c')])){_0x3d9e1e[_0xbfdf('0xd1')](_0xbfdf('0x1f6'),_0x35b260,_0x2ffa50[0x0]);}else{_0x3d9e1e[_0xbfdf('0xb9')](_['pick'](_0x2ffa50[0x0],[_0xbfdf('0xd8'),_0xbfdf('0x1fd')]))['then'](_0x3d9e1e[_0xbfdf('0x1f7')](_0x35b260,_0x2ffa50[0x0]))[_0xbfdf('0xb7')](_0x3d9e1e[_0xbfdf('0xd0')](_0xbfdf('0x200'),_0x35b260));}}})['catch'](loggerGetContactDialer(_0xbfdf('0x201'),_0x35b260,0x1));emitVoiceQueueSummary(_0x35b260);};Dialer[_0xbfdf('0xb8')]['abandonmentRate']=function(_0x57d145,_0x4e848d,_0x3b1677,_0x1e51c8,_0x5ed136,_0x23f608){loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x202'));loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x203'),_0x57d145);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x204'),_0x4e848d);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x205'),_0x3b1677);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x206'),_0x1e51c8);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x207'),_0x5ed136);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x8d'));return new BPromise(function(_0x32f60c,_0x1c12a5){if(_0x57d145<=0x0||isNaN(_0x57d145)){return _0x1c12a5(msgResponse(_0xbfdf('0x208'),_0xbfdf('0x194'),'m\x20=\x20'+_0x57d145));}if(_0x3b1677<=0x0||isNaN(_0x3b1677)){return _0x1c12a5(msgResponse(_0xbfdf('0x208'),_0xbfdf('0x194'),_0xbfdf('0x209')+_0x3b1677));}if(_0x1e51c8<=0x0||isNaN(_0x1e51c8)){return _0x1c12a5(msgResponse(_0xbfdf('0x208'),_0xbfdf('0x194'),_0xbfdf('0x20a')+_0x1e51c8));}if(_0x4e848d<=0x0||isNaN(_0x4e848d)){return _0x1c12a5(msgResponse(_0xbfdf('0x208'),_0xbfdf('0x194'),_0xbfdf('0x20b')+_0x4e848d));}if(_0x5ed136<=0x0||isNaN(_0x5ed136)){return _0x1c12a5(msgResponse(_0xbfdf('0x208'),_0xbfdf('0x194'),_0xbfdf('0x20c')+_0x5ed136));}_0x23f608=_0x23f608||0x0;var _0x28ec87=0x1/_0x3b1677;var _0x373826=0x0;var _0x133379=0x0;var _0x61fdf3=0x0;var _0x7d8848=0x0;for(var _0x42c631=0x0;_0x61fdf3<_0x5ed136;_0x42c631+=0x1){_0x133379=_0x42c631/_0x4e848d;_0x373826=(_0x1e51c8*_0x133379+_0x23f608)/_0x28ec87;_0x61fdf3=erlangb(_0x373826,_0x57d145);_0x7d8848=_0x373826/_0x57d145*(0x1-erlangb(_0x373826,_0x57d145));}return _0x32f60c({'erlangCalls':_0x42c631,'erlangCallToSecond':_0x4e848d/_0x42c631,'erlangAbandonmentRate':_0x61fdf3,'erlangBusyFactor':_0x7d8848});});};Dialer[_0xbfdf('0xb8')][_0xbfdf('0x1d6')]=function(_0x51ac3d,_0x166dc4,_0x552514,_0xef05b8,_0x5607c9,_0x53c2d1){loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x20d'));loggerPredictive['info'](_0xbfdf('0x203'),_0x51ac3d);loggerPredictive['info'](_0xbfdf('0x204'),_0x166dc4);loggerPredictive['info'](_0xbfdf('0x205'),_0x552514);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x206'),_0xef05b8);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x20e'),_0x5607c9);loggerPredictive[_0xbfdf('0x7e')](_0xbfdf('0x8d'));return new BPromise(function(_0x4662d0,_0x3d6011){if(_0x51ac3d<=0x0||isNaN(_0x51ac3d)){return _0x3d6011(msgResponse(_0xbfdf('0x20f'),_0xbfdf('0x194'),'m\x20=\x20'+_0x51ac3d));}if(_0x552514<=0x0||isNaN(_0x552514)){return _0x3d6011(msgResponse(_0xbfdf('0x20f'),_0xbfdf('0x194'),_0xbfdf('0x209')+_0x552514));}if(_0xef05b8<=0x0||isNaN(_0xef05b8)){return _0x3d6011(msgResponse('[busyFactor]',_0xbfdf('0x194'),'p\x20=\x20'+_0xef05b8));}if(_0x166dc4<=0x0||isNaN(_0x166dc4)){return _0x3d6011(msgResponse('[busyFactor]',_0xbfdf('0x194'),_0xbfdf('0x20b')+_0x166dc4));}if(_0x5607c9<=0x0||isNaN(_0x5607c9)){return _0x3d6011(msgResponse(_0xbfdf('0x20f'),_0xbfdf('0x194'),_0xbfdf('0x210')+_0x5607c9));}_0x53c2d1=_0x53c2d1||0x0;var _0x1693c7=0x1/_0x552514;var _0x14f2ec=0x0;var _0x45ebbc=0x0;var _0x20b4e7=0x0;var _0x2edfd0=0x0;for(var _0x5778c9=0x0;_0x2edfd0<_0x5607c9;_0x5778c9+=0x1){_0x45ebbc=_0x5778c9/_0x166dc4;_0x14f2ec=(_0xef05b8*_0x45ebbc+_0x53c2d1)/_0x1693c7;_0x20b4e7=erlangb(_0x14f2ec,_0x51ac3d);_0x2edfd0=_0x14f2ec/_0x51ac3d*(0x1-erlangb(_0x14f2ec,_0x51ac3d));}return _0x4662d0({'erlangCalls':_0x5778c9,'erlangCallToSecond':_0x166dc4/_0x5778c9,'erlangAbandonmentRate':_0x20b4e7,'erlangBusyFactor':_0x2edfd0});});};module[_0xbfdf('0x211')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 53ad973..9248d4b 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 _0x2279=['queue','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2279,0x90));var _0x9227=function(_0x4c13b8,_0x4bb6cb){_0x4c13b8=_0x4c13b8-0x0;var _0x544dc5=_0x2279[_0x4c13b8];return _0x544dc5;};'use strict';var util=require('util');var _=require(_0x9227('0x0'));var moment=require('moment');function getSeconds(_0x2c6b64,_0x5f2c77){var _0x3a6e40=moment(_0x2c6b64)[_0x9227('0x1')](0x0);var _0x234578=moment(_0x5f2c77)[_0x9227('0x1')](0x0);return _0x3a6e40[_0x9227('0x2')](_0x234578,_0x9227('0x3'));}function QueueCallerAbandon(_0x41fd1c,_0x103bf2){this[_0x9227('0x4')]=_0x41fd1c['scheduledat'];this[_0x9227('0x5')]=_0x41fd1c[_0x9227('0x5')];this[_0x9227('0x6')]=_0x41fd1c['type']===_0x9227('0x7')?_0x9227('0x8'):_0x41fd1c['type'];this['countbusyretry']=_0x41fd1c['countbusyretry'];this[_0x9227('0x9')]=_0x41fd1c[_0x9227('0x9')];this['countnoanswerretry']=_0x41fd1c[_0x9227('0xa')];this['countglobal']=_0x41fd1c['countbusyretry']+_0x41fd1c[_0x9227('0x9')]+_0x41fd1c[_0x9227('0xa')]+_0x41fd1c[_0x9227('0xb')]+_0x41fd1c[_0x9227('0xc')]+_0x41fd1c[_0x9227('0xd')]+_0x41fd1c[_0x9227('0xe')]+_0x41fd1c[_0x9227('0xf')];this[_0x9227('0xb')]=_0x41fd1c['countnosuchnumberretry'];this['countdropretry']=_0x41fd1c[_0x9227('0xc')];this[_0x9227('0xd')]=_0x41fd1c[_0x9227('0xd')];this[_0x9227('0xe')]=_0x41fd1c[_0x9227('0xe')];this[_0x9227('0xf')]=_0x41fd1c[_0x9227('0xf')];this['uniqueid']=_0x103bf2['uniqueid'];this[_0x9227('0x10')]=_0x41fd1c[_0x9227('0x11')];this['calleridnum']=_0x41fd1c[_0x9227('0x12')];this[_0x9227('0x13')]=_0x41fd1c[_0x9227('0x13')];this[_0x9227('0x14')]=_0x41fd1c[_0x9227('0x14')];this['droptime']=_0x41fd1c[_0x9227('0x15')];this[_0x9227('0x16')]=this[_0x9227('0x15')];this[_0x9227('0x17')]=getSeconds(_0x41fd1c[_0x9227('0x14')],_0x41fd1c[_0x9227('0x13')]);this['holdtime']=getSeconds(this[_0x9227('0x15')],_0x41fd1c[_0x9227('0x14')]);this[_0x9227('0x18')]=0x0;this['queue']=_0x103bf2['queue'];this[_0x9227('0x19')]=_0x103bf2['connectedlinename'];this[_0x9227('0x1a')]=_0x103bf2[_0x9227('0x1a')];this[_0x9227('0x1b')]=_0x41fd1c[_0x9227('0x1b')];this[_0x9227('0x1c')]=_0x41fd1c[_0x9227('0x1c')];this[_0x9227('0x1d')]=_0x41fd1c[_0x9227('0x1d')];this[_0x9227('0x1e')]=_0x41fd1c[_0x9227('0x1e')];this[_0x9227('0x1f')]=_0x41fd1c['ContactId'];this['ListId']=_0x41fd1c[_0x9227('0x20')];this[_0x9227('0x21')]=_0x41fd1c['UserId'];this[_0x9227('0x22')]=_0x41fd1c[_0x9227('0x22')];this[_0x9227('0x23')]=_0x41fd1c['CampaignId'];this[_0x9227('0x24')]=_0x41fd1c[_0x9227('0x24')]||'';this[_0x9227('0x25')]=_0x41fd1c[_0x9227('0x25')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xe66a=['outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','holdtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype'];(function(_0x5205dd,_0x1f119d){var _0x2037f5=function(_0x292546){while(--_0x292546){_0x5205dd['push'](_0x5205dd['shift']());}};_0x2037f5(++_0x1f119d);}(_0xe66a,0x11e));var _0xae66=function(_0x183b98,_0x35aa6d){_0x183b98=_0x183b98-0x0;var _0x40751c=_0xe66a[_0x183b98];return _0x40751c;};'use strict';var util=require('util');var _=require(_0xae66('0x0'));var moment=require(_0xae66('0x1'));function getSeconds(_0x2c521f,_0x6b3990){var _0x42831d=moment(_0x2c521f)['milliseconds'](0x0);var _0x507298=moment(_0x6b3990)[_0xae66('0x2')](0x0);return _0x42831d[_0xae66('0x3')](_0x507298,_0xae66('0x4'));}function QueueCallerAbandon(_0x1c9e8c,_0x55bf31){this[_0xae66('0x5')]=_0x1c9e8c[_0xae66('0x5')];this[_0xae66('0x6')]=_0x1c9e8c['type'];this[_0xae66('0x7')]=_0x1c9e8c[_0xae66('0x6')]===_0xae66('0x8')?'queue':_0x1c9e8c[_0xae66('0x6')];this[_0xae66('0x9')]=_0x1c9e8c[_0xae66('0x9')];this[_0xae66('0xa')]=_0x1c9e8c[_0xae66('0xa')];this[_0xae66('0xb')]=_0x1c9e8c['countnoanswerretry'];this[_0xae66('0xc')]=_0x1c9e8c[_0xae66('0x9')]+_0x1c9e8c[_0xae66('0xa')]+_0x1c9e8c[_0xae66('0xb')]+_0x1c9e8c['countnosuchnumberretry']+_0x1c9e8c[_0xae66('0xd')]+_0x1c9e8c['countabandonedretry']+_0x1c9e8c[_0xae66('0xe')]+_0x1c9e8c[_0xae66('0xf')];this[_0xae66('0x10')]=_0x1c9e8c[_0xae66('0x10')];this['countdropretry']=_0x1c9e8c[_0xae66('0xd')];this[_0xae66('0x11')]=_0x1c9e8c[_0xae66('0x11')];this[_0xae66('0xe')]=_0x1c9e8c[_0xae66('0xe')];this[_0xae66('0xf')]=_0x1c9e8c[_0xae66('0xf')];this['uniqueid']=_0x55bf31[_0xae66('0x12')];this[_0xae66('0x13')]=_0x1c9e8c[_0xae66('0x14')];this[_0xae66('0x15')]=_0x1c9e8c[_0xae66('0x16')];this[_0xae66('0x17')]=_0x1c9e8c[_0xae66('0x17')];this[_0xae66('0x18')]=_0x1c9e8c[_0xae66('0x18')];this[_0xae66('0x19')]=_0x1c9e8c['droptime'];this['endtime']=this[_0xae66('0x19')];this['ringtime']=getSeconds(_0x1c9e8c[_0xae66('0x18')],_0x1c9e8c['starttime']);this[_0xae66('0x1a')]=getSeconds(this['droptime'],_0x1c9e8c['responsetime']);this['talktime']=0x0;this[_0xae66('0x1b')]=_0x55bf31[_0xae66('0x1b')];this[_0xae66('0x1c')]=_0x55bf31[_0xae66('0x1d')];this[_0xae66('0x1e')]=_0x55bf31[_0xae66('0x1e')];this[_0xae66('0x1f')]=_0x1c9e8c[_0xae66('0x1f')];this[_0xae66('0x20')]=_0x1c9e8c['callbackuniqueid'];this['callbackat']=_0x1c9e8c[_0xae66('0x21')];this[_0xae66('0x22')]=_0x1c9e8c[_0xae66('0x22')];this[_0xae66('0x23')]=_0x1c9e8c[_0xae66('0x23')];this[_0xae66('0x24')]=_0x1c9e8c[_0xae66('0x24')];this['UserId']=_0x1c9e8c['UserId'];this[_0xae66('0x25')]=_0x1c9e8c[_0xae66('0x25')];this[_0xae66('0x26')]=_0x1c9e8c[_0xae66('0x26')];this[_0xae66('0x27')]=_0x1c9e8c['originatecalleridnum']||'';this[_0xae66('0x28')]=_0x1c9e8c[_0xae66('0x28')]||'';}module[_0xae66('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0571006..737d299 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(_0x440345,_0x314a1e){var _0x4a5aef=function(_0x5f3666){while(--_0x5f3666){_0x440345['push'](_0x440345['shift']());}};_0x4a5aef(++_0x314a1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x3ec4e3,_0x15aab4){var _0x38ee8c=function(_0x439303){while(--_0x439303){_0x3ec4e3['push'](_0x3ec4e3['shift']());}};_0x38ee8c(++_0x15aab4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 b7f68df..e6773b1 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 _0xbee3=['actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','application/pdf','.pdf','error','catch','\x20receiveFax\x20','syncOriginateResponse','merge','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','stringify','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','moment','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks'];(function(_0x34282d,_0x324f57){var _0x3f1448=function(_0x142719){while(--_0x142719){_0x34282d['push'](_0x34282d['shift']());}};_0x3f1448(++_0x324f57);}(_0xbee3,0xd5));var _0x3bee=function(_0x243031,_0x1ba9d0){_0x243031=_0x243031-0x0;var _0x248351=_0xbee3[_0x243031];return _0x248351;};'use strict';var util=require('util');var _=require(_0x3bee('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x3bee('0x1'));var path=require(_0x3bee('0x2'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var ami=require('../ami');var rpcDb=require(_0x3bee('0x6'));var Channel=require(_0x3bee('0x7'));var ut=require('./util/util');var Action=require(_0x3bee('0x8'));var faxAccount=require(_0x3bee('0x9'));var attachment=require(_0x3bee('0xa'));var faxMessage=require(_0x3bee('0xb'));function Fax(_0xbdd5d5){this[_0x3bee('0xc')]={};this[_0x3bee('0xd')]=_0xbdd5d5['faxAccounts'];this[_0x3bee('0xe')]=_0xbdd5d5[_0x3bee('0xe')];this[_0x3bee('0xf')]={};ami['on'](_0x3bee('0x10'),this[_0x3bee('0x11')][_0x3bee('0x12')](this));ami['on']('varset',this[_0x3bee('0x13')]['bind'](this));ami['on'](_0x3bee('0x14'),this[_0x3bee('0x15')][_0x3bee('0x12')](this));ami['on'](_0x3bee('0x16'),this[_0x3bee('0x17')][_0x3bee('0x12')](this));ami['on'](_0x3bee('0x18'),this['syncFaxStatus'][_0x3bee('0x12')](this));ami['on'](_0x3bee('0x19'),this[_0x3bee('0x1a')][_0x3bee('0x12')](this));ami['on'](_0x3bee('0x1b'),this['syncHangup']['bind'](this));ami['on'](_0x3bee('0x1c'),this['syncOriginateResponse'][_0x3bee('0x12')](this));}Fax[_0x3bee('0x1d')]['syncNewchannel']=function(_0x5c87cf){if(_0x5c87cf[_0x3bee('0x1e')]===_0x3bee('0x1f')){for(var _0xfdba3b in this[_0x3bee('0xd')]){if(this['faxAccounts'][_0x3bee('0x20')](_0xfdba3b)){if(_0x5c87cf[_0x3bee('0x21')]===this[_0x3bee('0xd')][_0xfdba3b][_0x3bee('0x22')]){this[_0x3bee('0xc')][_0x5c87cf[_0x3bee('0x23')]]={};this[_0x3bee('0xc')][_0x5c87cf['uniqueid']]['channel']=_0x5c87cf[_0x3bee('0x24')];this[_0x3bee('0xc')][_0x5c87cf['uniqueid']]['id']=this[_0x3bee('0xd')][_0xfdba3b]['id'];this[_0x3bee('0xc')][_0x5c87cf[_0x3bee('0x23')]][_0x3bee('0x25')]=this[_0x3bee('0xd')][_0xfdba3b][_0x3bee('0x25')];logger[_0x3bee('0x26')](_0x5c87cf['uniqueid'],_0x3bee('0x27'));}}}}if(this[_0x3bee('0xf')][_0x5c87cf[_0x3bee('0x23')]]){this[_0x3bee('0xc')][_0x5c87cf['uniqueid']]={};this[_0x3bee('0xc')][_0x5c87cf[_0x3bee('0x23')]][_0x3bee('0x24')]=_0x5c87cf['channel'];logger['info'](_0x5c87cf[_0x3bee('0x23')],_0x3bee('0x27'));}};Fax['prototype'][_0x3bee('0x13')]=function(_0x1b4ce0){if(this[_0x3bee('0xc')][_0x1b4ce0['uniqueid']]){for(var _0x1984c4 in _0x1b4ce0[_0x3bee('0x28')]){if(_0x1b4ce0[_0x3bee('0x28')]['hasOwnProperty'](_0x1984c4)){this[_0x3bee('0xc')][_0x1b4ce0[_0x3bee('0x23')]][_0x1984c4]=_0x1b4ce0[_0x3bee('0x29')];}}}};Fax['prototype'][_0x3bee('0x15')]=function(_0x24d523){if(this[_0x3bee('0xc')][_0x24d523[_0x3bee('0x23')]]){this[_0x3bee('0xc')][_0x24d523['uniqueid']]['channelstate']=_0x24d523[_0x3bee('0x2a')];this[_0x3bee('0xc')][_0x24d523[_0x3bee('0x23')]][_0x3bee('0x2b')]=_0x24d523['channelstatedesc'];}};Fax['prototype'][_0x3bee('0x17')]=function(_0x42cb58){if(this['channels'][_0x42cb58['uniqueid']]){for(var _0xf4701f in _0x42cb58[_0x3bee('0x28')]){if(_0x42cb58[_0x3bee('0x28')][_0x3bee('0x20')](_0xf4701f)){this[_0x3bee('0xc')][_0x42cb58[_0x3bee('0x23')]][_0xf4701f]=_0x42cb58[_0x3bee('0x29')];}}}};Fax[_0x3bee('0x1d')][_0x3bee('0x2c')]=function(_0x42291d){if(this['channels'][_0x42291d['uniqueid']]){this[_0x3bee('0xc')][_0x42291d['uniqueid']]['operation']=_0x42291d[_0x3bee('0x2d')];this[_0x3bee('0xc')][_0x42291d[_0x3bee('0x23')]][_0x3bee('0x2e')]=_0x42291d[_0x3bee('0x2e')];this[_0x3bee('0xc')][_0x42291d[_0x3bee('0x23')]][_0x3bee('0x22')]=_0x42291d['localstationid'];this[_0x3bee('0xc')][_0x42291d[_0x3bee('0x23')]]['filename']=_0x42291d[_0x3bee('0x2f')];logger[_0x3bee('0x26')](_0x42291d[_0x3bee('0x23')],_0x3bee('0x30'));}};Fax[_0x3bee('0x1d')]['syncReceiveFax']=function(_0x57a895){var _0x1a7460=this;if(this[_0x3bee('0xc')][_0x57a895[_0x3bee('0x23')]]){var _0x428953=this[_0x3bee('0xc')][_0x57a895[_0x3bee('0x23')]]['id'];this[_0x3bee('0xc')][_0x57a895[_0x3bee('0x23')]][_0x3bee('0x31')]=_0x57a895[_0x3bee('0x31')];this[_0x3bee('0xc')][_0x57a895[_0x3bee('0x23')]]['pagestransferred']=_0x57a895[_0x3bee('0x32')];this[_0x3bee('0xc')][_0x57a895[_0x3bee('0x23')]][_0x3bee('0x22')]=_0x57a895[_0x3bee('0x22')];this[_0x3bee('0xc')][_0x57a895[_0x3bee('0x23')]][_0x3bee('0x33')]=_0x57a895[_0x3bee('0x33')];this[_0x3bee('0xc')][_0x57a895[_0x3bee('0x23')]][_0x3bee('0x34')]=_0x57a895[_0x3bee('0x34')];this['channels'][_0x57a895[_0x3bee('0x23')]][_0x3bee('0x2f')]=_0x57a895[_0x3bee('0x2f')];this[_0x3bee('0xc')][_0x57a895[_0x3bee('0x23')]][_0x3bee('0x35')]=_0x57a895[_0x3bee('0x35')];if(this[_0x3bee('0xc')][_0x57a895['uniqueid']][_0x3bee('0x32')]>0x0){tiff2pdf(_0x57a895[_0x3bee('0x2f')],_0x3bee('0x36'),function(_0x53e73c){logger[_0x3bee('0x26')](_0x57a895['uniqueid'],_0x3bee('0x37'),_0x53e73c['message']);attachment['create']({'name':path[_0x3bee('0x38')](_0x57a895[_0x3bee('0x2f')])[_0x3bee('0x25')],'basename':path[_0x3bee('0x38')](_0x57a895[_0x3bee('0x2f')])['name']+'.pdf','type':_0x3bee('0x39')})['then'](function(_0x5aa15f){faxAccount['notify'](_0x428953,{'from':_0x57a895[_0x3bee('0x35')],'mapKey':'fax','body':path[_0x3bee('0x38')](_0x57a895[_0x3bee('0x2f')])[_0x3bee('0x25')]+_0x3bee('0x3a'),'AttachmentId':_0x5aa15f['id']})['catch'](function(_0x5deb3e){logger[_0x3bee('0x3b')](_0x57a895['uniqueid'],'\x20notify\x20',JSON['stringify'](_0x5deb3e));});})[_0x3bee('0x3c')](function(_0x4e1c3f){logger[_0x3bee('0x3b')](_0x57a895[_0x3bee('0x23')],_0x3bee('0x3d'),JSON['stringify'](_0x4e1c3f));});});}logger[_0x3bee('0x26')](_0x57a895['uniqueid'],_0x3bee('0x3d'));}};Fax['prototype'][_0x3bee('0x3e')]=function(_0x16b096){if(this[_0x3bee('0xf')][_0x16b096['uniqueid']]){_[_0x3bee('0x3f')](this[_0x3bee('0xc')][_0x16b096[_0x3bee('0x23')]],_['pick'](_0x16b096,['response',_0x3bee('0x40')]));}};function updateStatus(_0x3c1220){if(_0x3c1220[_0x3bee('0x41')]){faxMessage[_0x3bee('0x42')](_0x3c1220[_0x3bee('0x41')],{'failMessage':_0x3bee('0x43')})[_0x3bee('0x44')](function(_0x521ceb){ut[_0x3bee('0x45')](_0x3bee('0x46'),_0x521ceb);})['catch'](function(_0x4dca26){ut[_0x3bee('0x45')]('[Fax][Message][Error][NoUpdate1]',_0x4dca26);});}else{ut[_0x3bee('0x45')](_0x3bee('0x47'));}}Fax[_0x3bee('0x1d')]['updateStatus']=function(_0x1a13fd,_0x3beac9,_0x127cb8){var _0x5f5272=this;var _0x1ee4f0={};if(_0x3beac9){_0x1ee4f0={'read':_0x3beac9};}else{_0x1ee4f0={'failMessage':_0x127cb8};}if(this[_0x3bee('0xf')][_0x1a13fd]['AttachmentId']){faxMessage[_0x3bee('0x42')](this[_0x3bee('0xf')][_0x1a13fd]['AttachmentId'],_0x1ee4f0)[_0x3bee('0x44')](function(_0x29bf8c){ut[_0x3bee('0x45')](_0x3bee('0x48'),_0x29bf8c);})[_0x3bee('0x3c')](function(_0x1d563e){ut[_0x3bee('0x45')](_0x3bee('0x49'),_0x1d563e);})['finally'](function(){delete _0x5f5272['channels'][_0x1a13fd];delete _0x5f5272[_0x3bee('0xf')][_0x1a13fd];});}else{ut['logger'](_0x3bee('0x4a'));delete this[_0x3bee('0xc')][_0x1a13fd];delete this[_0x3bee('0xf')][_0x1a13fd];}};Fax['prototype'][_0x3bee('0x4b')]=function(_0x2949d7){var _0x2ef55b=this;if(this['channels'][_0x2949d7[_0x3bee('0x23')]]){if(this['actions'][_0x2949d7[_0x3bee('0x23')]]){this[_0x3bee('0xc')][_0x2949d7[_0x3bee('0x23')]]['id']=this['actions'][_0x2949d7[_0x3bee('0x23')]]['id'];this[_0x3bee('0xc')][_0x2949d7[_0x3bee('0x23')]]['name']=this['actions'][_0x2949d7[_0x3bee('0x23')]][_0x3bee('0x25')];}logger[_0x3bee('0x26')](_0x2949d7['uniqueid'],this['actions'][_0x2949d7[_0x3bee('0x23')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x3bee('0x4c')](this[_0x3bee('0xc')][_0x2949d7[_0x3bee('0x23')]]));if(this['actions'][_0x2949d7['uniqueid']]){if(this[_0x3bee('0xc')][_0x2949d7[_0x3bee('0x23')]]['faxpages']>0x0&&this[_0x3bee('0xc')][_0x2949d7['uniqueid']][_0x3bee('0x18')]===_0x3bee('0x4d')){this[_0x3bee('0x4e')](_0x2949d7[_0x3bee('0x23')],!![]);}else{this[_0x3bee('0x4e')](_0x2949d7[_0x3bee('0x23')],![],this[_0x3bee('0xc')][_0x2949d7[_0x3bee('0x23')]][_0x3bee('0x4f')]?_0x3bee('0x50')+this[_0x3bee('0xc')][_0x2949d7['uniqueid']]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x3bee('0x1d')][_0x3bee('0x51')]=function(_0x4acba2){var _0x9828ad=this;return new BPromise(function(_0x5d2cad,_0x154a35){_0x9828ad[_0x3bee('0x52')](_0x4acba2,_0x9828ad['faxAccounts'][_0x4acba2['FaxAccountId']])[_0x3bee('0x44')](function(_0xf5a4e3){ut[_0x3bee('0x45')]('[Fax][execOriginate][success]',_0xf5a4e3);_0x5d2cad(ut[_0x3bee('0x53')](_0x3bee('0x54')));})[_0x3bee('0x3c')](function(_0x5926bc){ut[_0x3bee('0x45')](_0x3bee('0x55'),_0x5926bc);updateStatus(_0x4acba2);_0x154a35(ut[_0x3bee('0x53')](_0x3bee('0x56')));});});};Fax['prototype']['checkAfterSend']=function(_0x169f36){var _0x8f2cb=this;return new BPromise(function(_0x16e56c,_0x3f239a){var _0x167552=_0x8f2cb['checkTrunk'](_0x8f2cb[_0x3bee('0xd')][_0x169f36['FaxAccountId']][_0x3bee('0x57')],_0x169f36);if(_0x167552[_0x3bee('0x58')]){_0x16e56c(ut[_0x3bee('0x53')](_0x3bee('0x59')));}else{_0x3f239a(ut[_0x3bee('0x53')](_0x167552[_0x3bee('0x53')]));}});};function originate(_0x3f7dad,_0x4d52f3,_0x25f936){return new BPromise(function(_0x28c16e,_0x42045d){if(_0x25f936){var _0x3a6f56=util['format'](_0x3bee('0x5a'),path[_0x3bee('0x38')](_0x3f7dad[_0x3bee('0x2')])[_0x3bee('0x25')],_0x3f7dad[_0x3bee('0x2')]);gs[_0x3bee('0x5b')](_0x3a6f56)[_0x3bee('0x44')](function(){_0x3f7dad[_0x3bee('0x2')]=util['format'](_0x3bee('0x5c'),path[_0x3bee('0x38')](_0x3f7dad[_0x3bee('0x2')])['dir'],path[_0x3bee('0x38')](_0x3f7dad[_0x3bee('0x2')])[_0x3bee('0x25')]);_0x4d52f3[_0x3bee('0x5d')]=_0x3f7dad[_0x3bee('0x2')];ut[_0x3bee('0x45')](_0x3bee('0x5e'),'');ami[_0x3bee('0x5f')](ut[_0x3bee('0x60')](_0x3f7dad,_0x4d52f3))[_0x3bee('0x44')](function(_0x3f72f7){_0x28c16e(_0x3f72f7);})[_0x3bee('0x3c')](function(_0xda3a9d){_0x42045d(_0xda3a9d);});})[_0x3bee('0x3c')](function(_0x5e054){_0x42045d(_0x5e054);});}else{ami[_0x3bee('0x5f')](ut[_0x3bee('0x60')](_0x3f7dad,_0x4d52f3))[_0x3bee('0x44')](function(_0x38e1be){_0x28c16e(_0x38e1be);})[_0x3bee('0x3c')](function(_0x3c5600){_0x42045d(_0x3c5600);});}});}Fax[_0x3bee('0x1d')][_0x3bee('0x52')]=function(_0x44c0c3,_0x75ba50){var _0x556e60=this;return new BPromise(function(_0x35f0fb,_0xef6d20){var _0x46bf22=uuid['v4']();var _0x6f0320=ut[_0x3bee('0x61')](_0x44c0c3,_0x75ba50);_0x556e60[_0x3bee('0xf')][_0x46bf22]=new Action(_0x46bf22,_0x75ba50,_0x44c0c3);var _0x2d6a3d=_0x556e60[_0x3bee('0xf')][_0x46bf22];if(path[_0x3bee('0x38')](_0x44c0c3['path'])[_0x3bee('0x62')]===_0x3bee('0x3a')){originate(_0x2d6a3d,_0x6f0320,!![])['then'](function(_0xbfb4af){_0x35f0fb(_0xbfb4af);})['catch'](function(_0x1c260a){_0xef6d20(_0x1c260a);});}else{originate(_0x2d6a3d,_0x6f0320,![])[_0x3bee('0x44')](function(_0x3b6709){_0x35f0fb(_0x3b6709);})['catch'](function(_0x541484){_0xef6d20(_0x541484);});}});};Fax[_0x3bee('0x1d')][_0x3bee('0x63')]=function(_0x3c055b){return!_[_0x3bee('0x64')](_0x3c055b)&&!_[_0x3bee('0x64')](_0x3c055b[_0x3bee('0x25')])&&!_[_0x3bee('0x64')](_0x3c055b[_0x3bee('0x65')])&&_0x3c055b['active']&&!_[_0x3bee('0x64')](this[_0x3bee('0xe')][util[_0x3bee('0x66')](_0x3bee('0x67'),_0x3c055b[_0x3bee('0x25')])])&&!_[_0x3bee('0x64')](this[_0x3bee('0xe')][util['format'](_0x3bee('0x67'),_0x3c055b[_0x3bee('0x25')])]['status'])&&(this[_0x3bee('0xe')][util[_0x3bee('0x66')]('SIP/%s',_0x3c055b[_0x3bee('0x25')])]['status']===_0x3bee('0x68')||this[_0x3bee('0xe')][util[_0x3bee('0x66')](_0x3bee('0x67'),_0x3c055b['name'])][_0x3bee('0x2e')]===_0x3bee('0x69'));};Fax[_0x3bee('0x1d')]['checkTrunk']=function(_0x1fb398,_0xe164fc){if(!this['isTrunkReachable'](_0x1fb398)){ut[_0x3bee('0x45')](_0x3bee('0x6a'),_['isNil'](_0x1fb398)?'':_0x1fb398[_0x3bee('0x25')]+_0x3bee('0x6b'));return{'isValid':![],'message':_0x3bee('0x6c')};}if(_[_0x3bee('0x64')](_0xe164fc[_0x3bee('0x5')])){ut['logger'](_0x3bee('0x6d'),JSON[_0x3bee('0x4c')](_0xe164fc));return{'isValid':![],'message':_0x3bee('0x6e')};}if(_['isNil'](_0xe164fc['path'])){ut[_0x3bee('0x45')](_0x3bee('0x6f'),JSON[_0x3bee('0x4c')](_0xe164fc));return{'isValid':![],'message':_0x3bee('0x70')};}return{'isValid':!![],'message':_0x3bee('0x71')};};module['exports']=Fax; \ No newline at end of file +var _0xb58b=['\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','faxstatus','syncFaxStatus','receivefax','hangup','originateresponse','syncOriginateResponse','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','info','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','reason','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','Trunk\x20Reachable','message','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4cf13f,_0x11ead0){_0x4cf13f=_0x4cf13f-0x0;var _0x106d51=_0xb58b[_0x4cf13f];return _0x106d51;};'use strict';var util=require('util');var _=require(_0xbb58('0x0'));var BPromise=require(_0xbb58('0x1'));var uuid=require(_0xbb58('0x2'));var moment=require('moment');var path=require(_0xbb58('0x3'));var tiff2pdf=require(_0xbb58('0x4'));var gs=require('./util/gs');var logger=require(_0xbb58('0x5'))('fax');var ami=require(_0xbb58('0x6'));var rpcDb=require(_0xbb58('0x7'));var Channel=require(_0xbb58('0x8'));var ut=require('./util/util');var Action=require(_0xbb58('0x9'));var faxAccount=require(_0xbb58('0xa'));var attachment=require(_0xbb58('0xb'));var faxMessage=require(_0xbb58('0xc'));function Fax(_0xd94f1){this[_0xbb58('0xd')]={};this[_0xbb58('0xe')]=_0xd94f1[_0xbb58('0xe')];this[_0xbb58('0xf')]=_0xd94f1[_0xbb58('0xf')];this[_0xbb58('0x10')]={};ami['on']('newchannel',this[_0xbb58('0x11')]['bind'](this));ami['on'](_0xbb58('0x12'),this[_0xbb58('0x13')][_0xbb58('0x14')](this));ami['on'](_0xbb58('0x15'),this['syncNewState'][_0xbb58('0x14')](this));ami['on'](_0xbb58('0x16'),this['syncNewExten'][_0xbb58('0x14')](this));ami['on'](_0xbb58('0x17'),this[_0xbb58('0x18')][_0xbb58('0x14')](this));ami['on'](_0xbb58('0x19'),this['syncReceiveFax'][_0xbb58('0x14')](this));ami['on'](_0xbb58('0x1a'),this['syncHangup']['bind'](this));ami['on'](_0xbb58('0x1b'),this[_0xbb58('0x1c')][_0xbb58('0x14')](this));}Fax['prototype']['syncNewchannel']=function(_0x5ac9df){if(_0x5ac9df['context']===_0xbb58('0x1d')){for(var _0x3134ea in this['faxAccounts']){if(this[_0xbb58('0xe')]['hasOwnProperty'](_0x3134ea)){if(_0x5ac9df[_0xbb58('0x1e')]===this[_0xbb58('0xe')][_0x3134ea][_0xbb58('0x1f')]){this[_0xbb58('0xd')][_0x5ac9df[_0xbb58('0x20')]]={};this[_0xbb58('0xd')][_0x5ac9df[_0xbb58('0x20')]]['channel']=_0x5ac9df[_0xbb58('0x21')];this[_0xbb58('0xd')][_0x5ac9df[_0xbb58('0x20')]]['id']=this[_0xbb58('0xe')][_0x3134ea]['id'];this[_0xbb58('0xd')][_0x5ac9df[_0xbb58('0x20')]][_0xbb58('0x22')]=this[_0xbb58('0xe')][_0x3134ea][_0xbb58('0x22')];logger['info'](_0x5ac9df[_0xbb58('0x20')],'\x20syncNewchannel\x20');}}}}if(this[_0xbb58('0x10')][_0x5ac9df[_0xbb58('0x20')]]){this[_0xbb58('0xd')][_0x5ac9df[_0xbb58('0x20')]]={};this[_0xbb58('0xd')][_0x5ac9df[_0xbb58('0x20')]][_0xbb58('0x21')]=_0x5ac9df[_0xbb58('0x21')];logger['info'](_0x5ac9df[_0xbb58('0x20')],_0xbb58('0x23'));}};Fax[_0xbb58('0x24')][_0xbb58('0x13')]=function(_0x8e9ed9){if(this[_0xbb58('0xd')][_0x8e9ed9[_0xbb58('0x20')]]){for(var _0x2ce7c3 in _0x8e9ed9[_0xbb58('0x25')]){if(_0x8e9ed9[_0xbb58('0x25')][_0xbb58('0x26')](_0x2ce7c3)){this[_0xbb58('0xd')][_0x8e9ed9[_0xbb58('0x20')]][_0x2ce7c3]=_0x8e9ed9[_0xbb58('0x27')];}}}};Fax[_0xbb58('0x24')]['syncNewState']=function(_0x2b0f73){if(this[_0xbb58('0xd')][_0x2b0f73[_0xbb58('0x20')]]){this[_0xbb58('0xd')][_0x2b0f73[_0xbb58('0x20')]][_0xbb58('0x28')]=_0x2b0f73[_0xbb58('0x28')];this[_0xbb58('0xd')][_0x2b0f73[_0xbb58('0x20')]]['channelstatedesc']=_0x2b0f73[_0xbb58('0x29')];}};Fax[_0xbb58('0x24')][_0xbb58('0x2a')]=function(_0x3a1e46){if(this[_0xbb58('0xd')][_0x3a1e46[_0xbb58('0x20')]]){for(var _0x409904 in _0x3a1e46[_0xbb58('0x25')]){if(_0x3a1e46[_0xbb58('0x25')][_0xbb58('0x26')](_0x409904)){this[_0xbb58('0xd')][_0x3a1e46[_0xbb58('0x20')]][_0x409904]=_0x3a1e46[_0xbb58('0x27')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x5a4e76){if(this[_0xbb58('0xd')][_0x5a4e76[_0xbb58('0x20')]]){this[_0xbb58('0xd')][_0x5a4e76[_0xbb58('0x20')]][_0xbb58('0x2b')]=_0x5a4e76[_0xbb58('0x2b')];this[_0xbb58('0xd')][_0x5a4e76[_0xbb58('0x20')]]['status']=_0x5a4e76[_0xbb58('0x2c')];this[_0xbb58('0xd')][_0x5a4e76['uniqueid']][_0xbb58('0x1f')]=_0x5a4e76['localstationid'];this[_0xbb58('0xd')][_0x5a4e76['uniqueid']][_0xbb58('0x2d')]=_0x5a4e76[_0xbb58('0x2d')];logger['info'](_0x5a4e76[_0xbb58('0x20')],_0xbb58('0x2e'));}};Fax[_0xbb58('0x24')][_0xbb58('0x2f')]=function(_0x1b86a6){var _0x128af0=this;if(this[_0xbb58('0xd')][_0x1b86a6[_0xbb58('0x20')]]){var _0x4e9c19=this[_0xbb58('0xd')][_0x1b86a6[_0xbb58('0x20')]]['id'];this[_0xbb58('0xd')][_0x1b86a6['uniqueid']]['remotestationid']=_0x1b86a6[_0xbb58('0x30')];this['channels'][_0x1b86a6[_0xbb58('0x20')]][_0xbb58('0x31')]=_0x1b86a6[_0xbb58('0x31')];this['channels'][_0x1b86a6['uniqueid']][_0xbb58('0x1f')]=_0x1b86a6[_0xbb58('0x1f')];this[_0xbb58('0xd')][_0x1b86a6[_0xbb58('0x20')]][_0xbb58('0x32')]=_0x1b86a6[_0xbb58('0x32')];this['channels'][_0x1b86a6[_0xbb58('0x20')]][_0xbb58('0x33')]=_0x1b86a6[_0xbb58('0x33')];this[_0xbb58('0xd')][_0x1b86a6[_0xbb58('0x20')]][_0xbb58('0x2d')]=_0x1b86a6['filename'];this[_0xbb58('0xd')][_0x1b86a6['uniqueid']][_0xbb58('0x34')]=_0x1b86a6[_0xbb58('0x34')];if(this[_0xbb58('0xd')][_0x1b86a6[_0xbb58('0x20')]]['pagestransferred']>0x0){tiff2pdf(_0x1b86a6[_0xbb58('0x2d')],_0xbb58('0x35'),function(_0x10d5ba){logger[_0xbb58('0x36')](_0x1b86a6['uniqueid'],_0xbb58('0x37'),_0x10d5ba['message']);attachment[_0xbb58('0x38')]({'name':path[_0xbb58('0x39')](_0x1b86a6[_0xbb58('0x2d')])[_0xbb58('0x22')],'basename':path[_0xbb58('0x39')](_0x1b86a6[_0xbb58('0x2d')])[_0xbb58('0x22')]+_0xbb58('0x3a'),'type':_0xbb58('0x3b')})[_0xbb58('0x3c')](function(_0x2c4ba6){faxAccount[_0xbb58('0x3d')](_0x4e9c19,{'from':_0x1b86a6[_0xbb58('0x34')],'mapKey':'fax','body':path[_0xbb58('0x39')](_0x1b86a6['filename'])['name']+_0xbb58('0x3a'),'AttachmentId':_0x2c4ba6['id']})[_0xbb58('0x3e')](function(_0x110849){logger[_0xbb58('0x3f')](_0x1b86a6[_0xbb58('0x20')],_0xbb58('0x40'),JSON[_0xbb58('0x41')](_0x110849));});})[_0xbb58('0x3e')](function(_0x1eb087){logger[_0xbb58('0x3f')](_0x1b86a6[_0xbb58('0x20')],'\x20receiveFax\x20',JSON[_0xbb58('0x41')](_0x1eb087));});});}logger[_0xbb58('0x36')](_0x1b86a6['uniqueid'],_0xbb58('0x42'));}};Fax[_0xbb58('0x24')][_0xbb58('0x1c')]=function(_0xdb0ff7){if(this['actions'][_0xdb0ff7[_0xbb58('0x20')]]){_['merge'](this[_0xbb58('0xd')][_0xdb0ff7[_0xbb58('0x20')]],_[_0xbb58('0x43')](_0xdb0ff7,['response',_0xbb58('0x44')]));}};function updateStatus(_0xc30dbd){if(_0xc30dbd['AttachmentId']){faxMessage[_0xbb58('0x45')](_0xc30dbd['AttachmentId'],{'failMessage':_0xbb58('0x46')})[_0xbb58('0x3c')](function(_0xdb9816){ut[_0xbb58('0x47')](_0xbb58('0x48'),_0xdb9816);})[_0xbb58('0x3e')](function(_0x130557){ut['logger'](_0xbb58('0x49'),_0x130557);});}else{ut[_0xbb58('0x47')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xbb58('0x24')][_0xbb58('0x4a')]=function(_0x5c19b7,_0x22802c,_0x44636b){var _0x44d579=this;var _0x4e21e0={};if(_0x22802c){_0x4e21e0={'read':_0x22802c};}else{_0x4e21e0={'failMessage':_0x44636b};}if(this[_0xbb58('0x10')][_0x5c19b7][_0xbb58('0x4b')]){faxMessage[_0xbb58('0x45')](this['actions'][_0x5c19b7][_0xbb58('0x4b')],_0x4e21e0)['then'](function(_0x200e82){ut[_0xbb58('0x47')](_0xbb58('0x4c'),_0x200e82);})['catch'](function(_0x5aaace){ut[_0xbb58('0x47')](_0xbb58('0x4d'),_0x5aaace);})[_0xbb58('0x4e')](function(){delete _0x44d579[_0xbb58('0xd')][_0x5c19b7];delete _0x44d579[_0xbb58('0x10')][_0x5c19b7];});}else{ut['logger'](_0xbb58('0x4f'));delete this[_0xbb58('0xd')][_0x5c19b7];delete this[_0xbb58('0x10')][_0x5c19b7];}};Fax['prototype'][_0xbb58('0x50')]=function(_0x62b12c){var _0x2bc858=this;if(this[_0xbb58('0xd')][_0x62b12c[_0xbb58('0x20')]]){if(this['actions'][_0x62b12c[_0xbb58('0x20')]]){this[_0xbb58('0xd')][_0x62b12c[_0xbb58('0x20')]]['id']=this[_0xbb58('0x10')][_0x62b12c[_0xbb58('0x20')]]['id'];this[_0xbb58('0xd')][_0x62b12c[_0xbb58('0x20')]][_0xbb58('0x22')]=this['actions'][_0x62b12c[_0xbb58('0x20')]]['name'];}logger[_0xbb58('0x36')](_0x62b12c[_0xbb58('0x20')],this[_0xbb58('0x10')][_0x62b12c[_0xbb58('0x20')]]?_0xbb58('0x51'):_0xbb58('0x52'),JSON[_0xbb58('0x41')](this[_0xbb58('0xd')][_0x62b12c[_0xbb58('0x20')]]));if(this[_0xbb58('0x10')][_0x62b12c[_0xbb58('0x20')]]){if(this['channels'][_0x62b12c[_0xbb58('0x20')]][_0xbb58('0x53')]>0x0&&this[_0xbb58('0xd')][_0x62b12c['uniqueid']][_0xbb58('0x17')]==='SUCCESS'){this[_0xbb58('0x4a')](_0x62b12c[_0xbb58('0x20')],!![]);}else{this['updateStatus'](_0x62b12c[_0xbb58('0x20')],![],this[_0xbb58('0xd')][_0x62b12c[_0xbb58('0x20')]][_0xbb58('0x54')]?_0xbb58('0x55')+this['channels'][_0x62b12c['uniqueid']][_0xbb58('0x54')]:_0xbb58('0x56'));}}}};Fax[_0xbb58('0x24')]['send']=function(_0x11d41e){var _0x419215=this;return new BPromise(function(_0x581506,_0xfcad4c){_0x419215[_0xbb58('0x57')](_0x11d41e,_0x419215['faxAccounts'][_0x11d41e[_0xbb58('0x58')]])[_0xbb58('0x3c')](function(_0x3c6f5d){ut[_0xbb58('0x47')](_0xbb58('0x59'),_0x3c6f5d);_0x581506(ut['message'](_0xbb58('0x5a')));})[_0xbb58('0x3e')](function(_0x3526e1){ut[_0xbb58('0x47')](_0xbb58('0x5b'),_0x3526e1);updateStatus(_0x11d41e);_0xfcad4c(ut['message']('Fax\x20failed'));});});};Fax[_0xbb58('0x24')]['checkAfterSend']=function(_0x31a8d1){var _0x14b872=this;return new BPromise(function(_0xcfac9e,_0xe5b33a){var _0x3211a9=_0x14b872[_0xbb58('0x5c')](_0x14b872[_0xbb58('0xe')][_0x31a8d1[_0xbb58('0x58')]][_0xbb58('0x5d')],_0x31a8d1);if(_0x3211a9[_0xbb58('0x5e')]){_0xcfac9e(ut['message'](_0xbb58('0x5f')));}else{_0xe5b33a(ut[_0xbb58('0x60')](_0x3211a9[_0xbb58('0x60')]));}});};function originate(_0x5b6508,_0x50bf24,_0x4bdc30){return new BPromise(function(_0x5e9319,_0x1e315e){if(_0x4bdc30){var _0x291357=util[_0xbb58('0x61')](_0xbb58('0x62'),path['parse'](_0x5b6508['path'])[_0xbb58('0x22')],_0x5b6508[_0xbb58('0x3')]);gs['execute'](_0x291357)[_0xbb58('0x3c')](function(){_0x5b6508[_0xbb58('0x3')]=util[_0xbb58('0x61')](_0xbb58('0x63'),path[_0xbb58('0x39')](_0x5b6508['path'])[_0xbb58('0x64')],path['parse'](_0x5b6508['path'])[_0xbb58('0x22')]);_0x50bf24[_0xbb58('0x65')]=_0x5b6508[_0xbb58('0x3')];ut['logger'](_0xbb58('0x66'),'');ami[_0xbb58('0x67')](ut[_0xbb58('0x68')](_0x5b6508,_0x50bf24))[_0xbb58('0x3c')](function(_0x5bdbf1){_0x5e9319(_0x5bdbf1);})[_0xbb58('0x3e')](function(_0x4f1987){_0x1e315e(_0x4f1987);});})['catch'](function(_0x3addb7){_0x1e315e(_0x3addb7);});}else{ami[_0xbb58('0x67')](ut[_0xbb58('0x68')](_0x5b6508,_0x50bf24))['then'](function(_0x4992f7){_0x5e9319(_0x4992f7);})[_0xbb58('0x3e')](function(_0xb299d7){_0x1e315e(_0xb299d7);});}});}Fax[_0xbb58('0x24')][_0xbb58('0x57')]=function(_0x171269,_0x39b402){var _0x115249=this;return new BPromise(function(_0x37ed76,_0x126716){var _0x163ca4=uuid['v4']();var _0x2d9741=ut['addVariables'](_0x171269,_0x39b402);_0x115249['actions'][_0x163ca4]=new Action(_0x163ca4,_0x39b402,_0x171269);var _0x36e2eb=_0x115249[_0xbb58('0x10')][_0x163ca4];if(path[_0xbb58('0x39')](_0x171269['path'])[_0xbb58('0x69')]===_0xbb58('0x3a')){originate(_0x36e2eb,_0x2d9741,!![])[_0xbb58('0x3c')](function(_0x494c33){_0x37ed76(_0x494c33);})[_0xbb58('0x3e')](function(_0x599926){_0x126716(_0x599926);});}else{originate(_0x36e2eb,_0x2d9741,![])[_0xbb58('0x3c')](function(_0x47fd65){_0x37ed76(_0x47fd65);})[_0xbb58('0x3e')](function(_0x35dc6e){_0x126716(_0x35dc6e);});}});};Fax[_0xbb58('0x24')][_0xbb58('0x6a')]=function(_0x26c15a){return!_[_0xbb58('0x6b')](_0x26c15a)&&!_['isNil'](_0x26c15a['name'])&&!_[_0xbb58('0x6b')](_0x26c15a[_0xbb58('0x6c')])&&_0x26c15a['active']&&!_[_0xbb58('0x6b')](this[_0xbb58('0xf')][util[_0xbb58('0x61')]('SIP/%s',_0x26c15a[_0xbb58('0x22')])])&&!_['isNil'](this[_0xbb58('0xf')][util[_0xbb58('0x61')](_0xbb58('0x6d'),_0x26c15a[_0xbb58('0x22')])][_0xbb58('0x2c')])&&(this[_0xbb58('0xf')][util[_0xbb58('0x61')]('SIP/%s',_0x26c15a[_0xbb58('0x22')])][_0xbb58('0x2c')]===_0xbb58('0x6e')||this['trunks'][util[_0xbb58('0x61')](_0xbb58('0x6d'),_0x26c15a['name'])]['status']===_0xbb58('0x6f'));};Fax[_0xbb58('0x24')][_0xbb58('0x5c')]=function(_0x4d1a0e,_0x4deb01){if(!this[_0xbb58('0x6a')](_0x4d1a0e)){ut[_0xbb58('0x47')](_0xbb58('0x70'),_[_0xbb58('0x6b')](_0x4d1a0e)?'':_0x4d1a0e[_0xbb58('0x22')]+_0xbb58('0x71'));return{'isValid':![],'message':_0xbb58('0x72')};}if(_[_0xbb58('0x6b')](_0x4deb01[_0xbb58('0x73')])){ut[_0xbb58('0x47')](_0xbb58('0x74'),JSON[_0xbb58('0x41')](_0x4deb01));return{'isValid':![],'message':_0xbb58('0x75')};}if(_[_0xbb58('0x6b')](_0x4deb01[_0xbb58('0x3')])){ut['logger'](_0xbb58('0x76'),JSON['stringify'](_0x4deb01));return{'isValid':![],'message':_0xbb58('0x77')};}return{'isValid':!![],'message':_0xbb58('0x78')};};module[_0xbb58('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index aa2a1da..3616ddd 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 _0x8a01=['resolve','then','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x8a01,0x1cf));var _0x18a0=function(_0x5b0865,_0x2949b0){_0x5b0865=_0x5b0865-0x0;var _0x509c4b=_0x8a01[_0x5b0865];return _0x509c4b;};'use strict';var util=require('util');var BPromise=require(_0x18a0('0x0'));var logger=require(_0x18a0('0x1'))(_0x18a0('0x2'));var _=require(_0x18a0('0x3'));var faxAccount=require(_0x18a0('0x4'));function loggerCatch(_0x353cf2){return function(_0x38a6f7){logger[_0x18a0('0x5')](_0x353cf2,util['inspect'](_0x38a6f7,{'showHidden':![],'depth':null}));};}exports[_0x18a0('0x6')]=function(_0xc7be63,_0x48d7a1){return BPromise[_0x18a0('0x7')]()[_0x18a0('0x8')](faxAccount[_0x18a0('0x6')](_0xc7be63,_0x48d7a1))['catch'](loggerCatch(_0x18a0('0x9')));}; \ No newline at end of file +var _0x3265=['../../../config/logger','lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0xacbce7,_0x4e09f4){var _0x922571=function(_0x764f52){while(--_0x764f52){_0xacbce7['push'](_0xacbce7['shift']());}};_0x922571(++_0x4e09f4);}(_0x3265,0x1b7));var _0x5326=function(_0x2cd19,_0x5f4e46){_0x2cd19=_0x2cd19-0x0;var _0x19c8fe=_0x3265[_0x2cd19];return _0x19c8fe;};'use strict';var util=require(_0x5326('0x0'));var BPromise=require('bluebird');var logger=require(_0x5326('0x1'))('preview');var _=require(_0x5326('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x25d95b){return function(_0x25dfcd){logger[_0x5326('0x3')](_0x25d95b,util[_0x5326('0x4')](_0x25dfcd,{'showHidden':![],'depth':null}));};}exports[_0x5326('0x5')]=function(_0xad0cce,_0x2075c4){return BPromise[_0x5326('0x6')]()[_0x5326('0x7')](faxAccount[_0x5326('0x5')](_0xad0cce,_0x2075c4))[_0x5326('0x8')](loggerCatch(_0x5326('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 676f128..06592d8 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 _0xb800=['util','../../../../config/logger','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x4ae273,_0x8e20b4){var _0x4c04c6=function(_0xda7d5f){while(--_0xda7d5f){_0x4ae273['push'](_0x4ae273['shift']());}};_0x4c04c6(++_0x8e20b4);}(_0xb800,0x190));var _0x0b80=function(_0x18c922,_0x4f8cf8){_0x18c922=_0x18c922-0x0;var _0x5bd677=_0xb800[_0x18c922];return _0x5bd677;};'use strict';var util=require(_0x0b80('0x0'));var logger=require(_0x0b80('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x0b80('0x2'))[_0x0b80('0x3')];exports[_0x0b80('0x4')]=function(_0x3d7f10){return new BPromise(function(_0x5f00e3,_0x239b38){exec(_0x3d7f10,function(_0x13f0f6,_0x3ca217,_0x2f5731){logger[_0x0b80('0x5')](_0x0b80('0x6'),_0x3ca217);if(_0x13f0f6){logger[_0x0b80('0x5')]('Exec\x20gs',_0x0b80('0x7'),util['inspect'](_0x13f0f6,{'showHidden':![],'depth':null}),_0x3ca217,_0x2f5731);_0x239b38(_0x13f0f6);}_0x5f00e3(_0x3ca217);});});}; \ No newline at end of file +var _0x82d9=['../../../../config/logger','fax','exec','execute','info','Exec\x20gs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82d9,0x150));var _0x982d=function(_0x53299f,_0x196816){_0x53299f=_0x53299f-0x0;var _0x520989=_0x82d9[_0x53299f];return _0x520989;};'use strict';var util=require('util');var logger=require(_0x982d('0x0'))(_0x982d('0x1'));var BPromise=require('bluebird');var exec=require('child_process')[_0x982d('0x2')];exports[_0x982d('0x3')]=function(_0x341801){return new BPromise(function(_0x4e1197,_0x2939d7){exec(_0x341801,function(_0x38972b,_0x4c3adc,_0x529c2a){logger[_0x982d('0x4')](_0x982d('0x5'),_0x4c3adc);if(_0x38972b){logger[_0x982d('0x4')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x38972b,{'showHidden':![],'depth':null}),_0x4c3adc,_0x529c2a);_0x2939d7(_0x38972b);}_0x4e1197(_0x4c3adc);});});}; \ 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 109849b..a1a01d5 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 _0xa8cf=['modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','xcally-motion-fax','from-sip','util','moment','logger','info','inspect','addVariables','headerinfo','maxrate','\x22%s\x22'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0xa8cf,0x1cb));var _0xfa8c=function(_0x353e55,_0x384e65){_0x353e55=_0x353e55-0x0;var _0xe1646a=_0xa8cf[_0x353e55];return _0xe1646a;};'use strict';var util=require(_0xfa8c('0x0'));var _=require('lodash');var moment=require(_0xfa8c('0x1'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x177718){return{'message':_0x177718};};exports[_0xfa8c('0x2')]=function(_0x4cec2a,_0x14405f){logger[_0xfa8c('0x3')](_0x4cec2a,util[_0xfa8c('0x4')](_0x14405f,{'showHidden':![],'depth':null}));};exports[_0xfa8c('0x5')]=function(_0x579adb,_0x2da87c){var _0x1b40d9={'XMF-ECM':_0x2da87c['ecm'],'XMF-HEADERINFO':_0x2da87c[_0xfa8c('0x6')],'XMF-MINRATE':_0x2da87c['minrate'],'XMF-MAXRATE':_0x2da87c[_0xfa8c('0x7')],'XMF-MODEM':util['format'](_0xfa8c('0x8'),_0x2da87c[_0xfa8c('0x9')]),'XMF-GATEWAY':_0x2da87c[_0xfa8c('0xa')],'XMF-FAXDETECT':_0x2da87c['faxdetect'],'XMF-T38TIMEOUT':_0x2da87c[_0xfa8c('0xb')],'XMF-LOCALSTATIONID':_0x2da87c[_0xfa8c('0xc')],'XMF-PATH':_0x579adb[_0xfa8c('0xd')]};return _0x1b40d9;};exports[_0xfa8c('0xe')]=function(_0x3c9b87,_0x19a22c){return{'actionid':_0x3c9b87[_0xfa8c('0xf')],'action':'originate','channel':_0x3c9b87['channel'],'Exten':_0xfa8c('0x10'),'Context':_0xfa8c('0x11'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x3c9b87['headerinfo']?_0x3c9b87['headerinfo']:'',_0x3c9b87[_0xfa8c('0xc')]),'variable':_0x19a22c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3c9b87[_0xfa8c('0xf')]};}; \ No newline at end of file +var _0x7379=['path','originate','channel','xcally-motion-fax','from-sip','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7379,0xb5));var _0x9737=function(_0xd0449a,_0x3a7186){_0xd0449a=_0xd0449a-0x0;var _0x402977=_0x7379[_0xd0449a];return _0x402977;};'use strict';var util=require(_0x9737('0x0'));var _=require(_0x9737('0x1'));var moment=require(_0x9737('0x2'));var logger=require(_0x9737('0x3'))(_0x9737('0x4'));exports[_0x9737('0x5')]=function(_0x4c894d){return{'message':_0x4c894d};};exports[_0x9737('0x6')]=function(_0x1c961a,_0x143f75){logger[_0x9737('0x7')](_0x1c961a,util[_0x9737('0x8')](_0x143f75,{'showHidden':![],'depth':null}));};exports[_0x9737('0x9')]=function(_0x522eb6,_0x37b4f0){var _0x221082={'XMF-ECM':_0x37b4f0['ecm'],'XMF-HEADERINFO':_0x37b4f0[_0x9737('0xa')],'XMF-MINRATE':_0x37b4f0[_0x9737('0xb')],'XMF-MAXRATE':_0x37b4f0[_0x9737('0xc')],'XMF-MODEM':util[_0x9737('0xd')]('\x22%s\x22',_0x37b4f0[_0x9737('0xe')]),'XMF-GATEWAY':_0x37b4f0[_0x9737('0xf')],'XMF-FAXDETECT':_0x37b4f0[_0x9737('0x10')],'XMF-T38TIMEOUT':_0x37b4f0[_0x9737('0x11')],'XMF-LOCALSTATIONID':_0x37b4f0[_0x9737('0x12')],'XMF-PATH':_0x522eb6[_0x9737('0x13')]};return _0x221082;};exports['variablesAction']=function(_0x1a763a,_0x5c01fe){return{'actionid':_0x1a763a['uniqueid'],'action':_0x9737('0x14'),'channel':_0x1a763a[_0x9737('0x15')],'Exten':_0x9737('0x16'),'Context':_0x9737('0x17'),'Priority':'1','callerid':util[_0x9737('0xd')]('\x22%s\x22\x20<%s>',_0x1a763a[_0x9737('0xa')]?_0x1a763a[_0x9737('0xa')]:'',_0x1a763a[_0x9737('0x12')]),'variable':_0x5c01fe,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a763a[_0x9737('0x18')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b316d09..42dd7f7 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 _0x5a7e=['error','inspect','listen','[index.js][main]','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','initTelephones','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','catch'];(function(_0x5dd85c,_0x509efc){var _0x10e189=function(_0x267ebb){while(--_0x267ebb){_0x5dd85c['push'](_0x5dd85c['shift']());}};_0x10e189(++_0x509efc);}(_0x5a7e,0x18a));var _0xe5a7=function(_0x7dfed6,_0x1e7ee4){_0x7dfed6=_0x7dfed6-0x0;var _0x49b5e2=_0x5a7e[_0x7dfed6];return _0x49b5e2;};'use strict';var BPromise=require(_0xe5a7('0x0'));var util=require('util');var moment=require(_0xe5a7('0x1'));var server=require(_0xe5a7('0x2'));var Realtime=require(_0xe5a7('0x3'));var Report=require(_0xe5a7('0x4'));var Acw=require(_0xe5a7('0x5'));var Trigger=require(_0xe5a7('0x6'));var Dialer=require(_0xe5a7('0x7'));var Preview=require(_0xe5a7('0x8'));var Fax=require('./fax');var user=require(_0xe5a7('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xe5a7('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe5a7('0xb'));var trigger=require('./rpc/trigger');var template=require(_0xe5a7('0xc'));var cmHopperHistory=require(_0xe5a7('0xd'));var campaign=require(_0xe5a7('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe5a7('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe5a7('0x10'));var freshdesk=require(_0xe5a7('0x11'));var desk=require(_0xe5a7('0x12'));var zoho=require(_0xe5a7('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xe5a7('0x14'));var dynamics365=require(_0xe5a7('0x15'));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(_0xe5a7('0x16'))(_0xe5a7('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe5a7('0x18')](_0xe5a7('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe5a7('0x1a')]()[_0xe5a7('0x1b')](user['getAgents']())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x1c')]())[_0xe5a7('0x1b')](user['getTelephones']())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x1d')]())['then'](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0xe5a7('0x1b')](voiceQueue[_0xe5a7('0x1e')]())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x1f')]())[_0xe5a7('0x1b')](trigger[_0xe5a7('0x20')]())[_0xe5a7('0x1b')](realtime['initTriggers']())[_0xe5a7('0x1b')](template[_0xe5a7('0x21')]())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x22')]())[_0xe5a7('0x1b')](zendesk[_0xe5a7('0x23')]())['then'](realtime[_0xe5a7('0x24')]())[_0xe5a7('0x1b')](salesforce[_0xe5a7('0x25')]())['then'](realtime[_0xe5a7('0x26')]())[_0xe5a7('0x1b')](sugarcrm[_0xe5a7('0x27')]())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x28')]())['then'](freshdesk[_0xe5a7('0x29')]())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x2a')]())['then'](desk[_0xe5a7('0x2b')]())['then'](realtime[_0xe5a7('0x2c')]())[_0xe5a7('0x1b')](zoho['getZohoAccounts']())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x2d')]())[_0xe5a7('0x1b')](vtiger['getVtigerAccounts']())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x2e')]())[_0xe5a7('0x1b')](freshsales[_0xe5a7('0x2f')]())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x30')]())['then'](servicenow[_0xe5a7('0x31')]())[_0xe5a7('0x1b')](realtime['initServicenowAccounts']())[_0xe5a7('0x1b')](dynamics365[_0xe5a7('0x32')]())['then'](realtime['initDynamics365Accounts']())[_0xe5a7('0x1b')](campaign[_0xe5a7('0x33')]())['then'](realtime['initCampaigns']())['then'](voiceExtension[_0xe5a7('0x34')]())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x35')]())[_0xe5a7('0x1b')](faxAccount[_0xe5a7('0x36')]())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x37')]())[_0xe5a7('0x1b')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xe5a7('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0xe5a7('0x1b')](realtime[_0xe5a7('0x38')]())[_0xe5a7('0x1b')](cmHopperHistory[_0xe5a7('0x39')]())['then'](realtime[_0xe5a7('0x3a')]())[_0xe5a7('0x1b')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0xe5a7('0x1b')](voiceCallReport[_0xe5a7('0x3b')]())['then'](realtime['initVoiceCallReports']())[_0xe5a7('0x3c')](function(_0x417443){logger[_0xe5a7('0x3d')]('[index.js][initParams]',util[_0xe5a7('0x3e')](_0x417443,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe5a7('0x3f')](realtime,preview,fax)[_0xe5a7('0x1b')](function(_0x586c13){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xe5a7('0x3c')](function(_0x126df8){logger['error'](_0xe5a7('0x40'),util[_0xe5a7('0x3e')](_0x126df8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0480=['then','initAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','bluebird','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','getAgents'];(function(_0x5c423d,_0x163618){var _0x319d80=function(_0x3c75e6){while(--_0x3c75e6){_0x5c423d['push'](_0x5c423d['shift']());}};_0x319d80(++_0x163618);}(_0x0480,0xb4));var _0x0048=function(_0x4828d8,_0x3194b4){_0x4828d8=_0x4828d8-0x0;var _0xa0db80=_0x0480[_0x4828d8];return _0xa0db80;};'use strict';var BPromise=require(_0x0048('0x0'));var util=require(_0x0048('0x1'));var moment=require(_0x0048('0x2'));var server=require(_0x0048('0x3'));var Realtime=require(_0x0048('0x4'));var Report=require('./report');var Acw=require(_0x0048('0x5'));var Trigger=require(_0x0048('0x6'));var Dialer=require(_0x0048('0x7'));var Preview=require(_0x0048('0x8'));var Fax=require(_0x0048('0x9'));var user=require(_0x0048('0xa'));var voiceQueue=require(_0x0048('0xb'));var voiceQueueReport=require(_0x0048('0xc'));var voiceCallReport=require(_0x0048('0xd'));var trunk=require(_0x0048('0xe'));var trigger=require(_0x0048('0xf'));var template=require(_0x0048('0x10'));var cmHopperHistory=require(_0x0048('0x11'));var campaign=require(_0x0048('0x12'));var voiceExtension=require(_0x0048('0x13'));var faxAccount=require(_0x0048('0x14'));var zendesk=require(_0x0048('0x15'));var salesforce=require(_0x0048('0x16'));var sugarcrm=require(_0x0048('0x17'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0048('0x18'));var zoho=require(_0x0048('0x19'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x0048('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0048('0x1b'))(_0x0048('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0048('0x1d')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0048('0x1d')](_0x0048('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0048('0x1f')]()['then'](user[_0x0048('0x20')]())[_0x0048('0x21')](realtime[_0x0048('0x22')]())[_0x0048('0x21')](user['getTelephones']())[_0x0048('0x21')](realtime[_0x0048('0x23')]())[_0x0048('0x21')](trunk[_0x0048('0x24')]())[_0x0048('0x21')](realtime['initTrunks']())[_0x0048('0x21')](voiceQueue[_0x0048('0x25')]())['then'](realtime[_0x0048('0x26')]())[_0x0048('0x21')](trigger[_0x0048('0x27')]())['then'](realtime[_0x0048('0x28')]())[_0x0048('0x21')](template[_0x0048('0x29')]())[_0x0048('0x21')](realtime[_0x0048('0x2a')]())[_0x0048('0x21')](zendesk[_0x0048('0x2b')]())[_0x0048('0x21')](realtime['initZendeskAccounts']())['then'](salesforce[_0x0048('0x2c')]())['then'](realtime[_0x0048('0x2d')]())[_0x0048('0x21')](sugarcrm[_0x0048('0x2e')]())['then'](realtime['initSugarcrmAccounts']())[_0x0048('0x21')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x0048('0x2f')]())['then'](desk[_0x0048('0x30')]())[_0x0048('0x21')](realtime['initDeskAccounts']())[_0x0048('0x21')](zoho[_0x0048('0x31')]())[_0x0048('0x21')](realtime[_0x0048('0x32')]())[_0x0048('0x21')](vtiger[_0x0048('0x33')]())[_0x0048('0x21')](realtime['initVtigerAccounts']())[_0x0048('0x21')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x0048('0x34')]())[_0x0048('0x21')](servicenow[_0x0048('0x35')]())['then'](realtime['initServicenowAccounts']())[_0x0048('0x21')](dynamics365[_0x0048('0x36')]())[_0x0048('0x21')](realtime[_0x0048('0x37')]())[_0x0048('0x21')](campaign[_0x0048('0x38')]())['then'](realtime[_0x0048('0x39')]())[_0x0048('0x21')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x0048('0x3a')]())['then'](faxAccount[_0x0048('0x3b')]())[_0x0048('0x21')](realtime[_0x0048('0x3c')]())[_0x0048('0x21')](function(){return realtime;});}function initParams(){return BPromise[_0x0048('0x1f')]()['then'](voiceQueueReport[_0x0048('0x3d')]())[_0x0048('0x21')](realtime[_0x0048('0x3e')]())[_0x0048('0x21')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x0048('0x21')](realtime[_0x0048('0x3f')]())[_0x0048('0x21')](cmHopperHistory['getCampaignHopperHistory']())[_0x0048('0x21')](realtime[_0x0048('0x40')]())[_0x0048('0x21')](voiceCallReport['getVoiceCallReports']())[_0x0048('0x21')](realtime['initVoiceCallReports']())[_0x0048('0x41')](function(_0x124286){logger[_0x0048('0x42')](_0x0048('0x43'),util[_0x0048('0x44')](_0x124286,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0048('0x45')](realtime,preview,fax)['then'](function(_0x50feff){return initRealtime();})[_0x0048('0x21')](function(){return initParams();})[_0x0048('0x21')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x0048('0x41')](function(_0x4d5cea){logger[_0x0048('0x42')](_0x0048('0x46'),util[_0x0048('0x44')](_0x4d5cea,{'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 d540c10..6e80dbb 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 _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x4b505a,_0x1bffc6){var _0x4a09f7=function(_0x56215a){while(--_0x56215a){_0x4b505a['push'](_0x4b505a['shift']());}};_0x4a09f7(++_0x1bffc6);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x435ac3,_0xa3f8b0){var _0x1574e5=function(_0x47f2df){while(--_0x47f2df){_0x435ac3['push'](_0x435ac3['shift']());}};_0x1574e5(++_0xa3f8b0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 7a164d5..78c1e95 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 _0xcf84=['SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x1e6432,_0x32cfbd){var _0x16bc9c=function(_0x2a732b){while(--_0x2a732b){_0x1e6432['push'](_0x1e6432['shift']());}};_0x16bc9c(++_0x32cfbd);}(_0xcf84,0x1b3));var _0x4cf8=function(_0x37b2db,_0x361844){_0x37b2db=_0x37b2db-0x0;var _0x34e762=_0xcf84[_0x37b2db];return _0x34e762;};'use strict';function Campaign(_0x534b41){this['id']=_0x534b41['id']||0x0;this[_0x4cf8('0x0')]=_0x534b41[_0x4cf8('0x0')]||'';this[_0x4cf8('0x1')]=_0x534b41[_0x4cf8('0x1')]||'campaign';this['originated']=0x0;this[_0x4cf8('0x2')]=0x0;this[_0x4cf8('0x3')]=0x0;this[_0x4cf8('0x4')]=0x0;this[_0x4cf8('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x4cf8('0x6')]=_0x534b41[_0x4cf8('0x6')];this[_0x4cf8('0x7')]=_0x534b41['limitCalls'];this['dialTimezone']=_0x534b41['dialTimezone']||null;this['dialGlobalInterval']=_0x534b41[_0x4cf8('0x8')]?_0x534b41[_0x4cf8('0x8')]:null;this[_0x4cf8('0x9')]=_0x534b41[_0x4cf8('0x9')];this[_0x4cf8('0xa')]=_0x534b41[_0x4cf8('0xa')];this[_0x4cf8('0xb')]=_0x534b41[_0x4cf8('0xb')]||0x1e;this[_0x4cf8('0xc')]=_0x534b41['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x534b41[_0x4cf8('0xd')];this['dialBusyMaxRetry']=_0x534b41['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x534b41['dialBusyRetryFrequency'];this[_0x4cf8('0xe')]=_0x534b41[_0x4cf8('0xe')];this[_0x4cf8('0xf')]=_0x534b41[_0x4cf8('0xf')];this['dialGlobalMaxRetry']=_0x534b41[_0x4cf8('0x10')];this[_0x4cf8('0x11')]=_0x534b41['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x534b41[_0x4cf8('0x12')]||0x96;this[_0x4cf8('0x13')]=_0x534b41['dialDropMaxRetry']||0x3;this[_0x4cf8('0x14')]=_0x534b41[_0x4cf8('0x14')]||0x96;this[_0x4cf8('0x15')]=_0x534b41[_0x4cf8('0x15')]||0x3;this['dialAbandonedRetryFrequency']=_0x534b41[_0x4cf8('0x16')]||0x96;this['dialMachineMaxRetry']=_0x534b41[_0x4cf8('0x17')]||0x3;this[_0x4cf8('0x18')]=_0x534b41[_0x4cf8('0x18')]||0x96;this[_0x4cf8('0x19')]=_0x534b41[_0x4cf8('0x19')]||0x3;this['dialAgentRejectRetryFrequency']=_0x534b41[_0x4cf8('0x1a')]||0x96;this['dialOrderByScheduledAt']=_0x534b41[_0x4cf8('0x1b')]||_0x4cf8('0x1c');this['dialPrefix']=_0x534b41[_0x4cf8('0x1d')]||undefined;this[_0x4cf8('0x1e')]=_0x534b41[_0x4cf8('0x1e')]||undefined;this['dialCutDigit']=_0x534b41[_0x4cf8('0x1f')]||undefined;this[_0x4cf8('0x20')]=_0x534b41[_0x4cf8('0x20')]?_0x534b41['TrunkBackup']:undefined;this[_0x4cf8('0x21')]=_0x534b41[_0x4cf8('0x21')]?_0x534b41[_0x4cf8('0x21')]:undefined;this[_0x4cf8('0x22')]=_0x534b41['Interval']?_0x534b41[_0x4cf8('0x22')]:undefined;this['SquareProject']=_0x534b41[_0x4cf8('0x23')]?_0x534b41['SquareProject']:undefined;this['dialQueueProject']=_0x534b41[_0x4cf8('0x23')]?_0x534b41[_0x4cf8('0x23')][_0x4cf8('0x0')]:undefined;this[_0x4cf8('0x24')]=_0x534b41[_0x4cf8('0x24')]||![];this[_0x4cf8('0x25')]=_0x534b41[_0x4cf8('0x25')];this[_0x4cf8('0x26')]=_0x534b41[_0x4cf8('0x26')];this[_0x4cf8('0x27')]=_0x534b41['dialAMDAfterGreetingSilence'];this[_0x4cf8('0x28')]=_0x534b41['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x534b41[_0x4cf8('0x29')];this[_0x4cf8('0x2a')]=_0x534b41[_0x4cf8('0x2a')];this['dialAMDMaximumNumberOfWords']=_0x534b41[_0x4cf8('0x2b')];this[_0x4cf8('0x2c')]=_0x534b41[_0x4cf8('0x2c')];this['dialAMDMaximumWordLength']=_0x534b41[_0x4cf8('0x2d')];}module[_0x4cf8('0x2e')]=Campaign; \ No newline at end of file +var _0x98ad=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0x98ad,0xd0));var _0xd98a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x98ad[_0x501510];return _0x1e6ee5;};'use strict';function Campaign(_0x243a66){this['id']=_0x243a66['id']||0x0;this['name']=_0x243a66['name']||'';this['type']=_0x243a66[_0xd98a('0x0')]||_0xd98a('0x1');this[_0xd98a('0x2')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xd98a('0x3')]=0x0;this[_0xd98a('0x4')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x243a66[_0xd98a('0x5')];this['limitCalls']=_0x243a66[_0xd98a('0x6')];this[_0xd98a('0x7')]=_0x243a66[_0xd98a('0x7')]||null;this[_0xd98a('0x8')]=_0x243a66[_0xd98a('0x8')]?_0x243a66[_0xd98a('0x8')]:null;this[_0xd98a('0x9')]=_0x243a66[_0xd98a('0x9')];this['dialOriginateCallerIdNumber']=_0x243a66[_0xd98a('0xa')];this[_0xd98a('0xb')]=_0x243a66[_0xd98a('0xb')]||0x1e;this[_0xd98a('0xc')]=_0x243a66['dialCongestionMaxRetry'];this[_0xd98a('0xd')]=_0x243a66[_0xd98a('0xd')];this['dialBusyMaxRetry']=_0x243a66[_0xd98a('0xe')];this['dialBusyRetryFrequency']=_0x243a66[_0xd98a('0xf')];this[_0xd98a('0x10')]=_0x243a66['dialNoAnswerMaxRetry'];this[_0xd98a('0x11')]=_0x243a66['dialNoAnswerRetryFrequency'];this[_0xd98a('0x12')]=_0x243a66[_0xd98a('0x12')];this[_0xd98a('0x13')]=_0x243a66['dialNoSuchNumberMaxRetry']||0x3;this[_0xd98a('0x14')]=_0x243a66[_0xd98a('0x14')]||0x96;this[_0xd98a('0x15')]=_0x243a66[_0xd98a('0x15')]||0x3;this[_0xd98a('0x16')]=_0x243a66['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x243a66[_0xd98a('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x243a66[_0xd98a('0x18')]||0x96;this[_0xd98a('0x19')]=_0x243a66[_0xd98a('0x19')]||0x3;this[_0xd98a('0x1a')]=_0x243a66['dialMachineRetryFrequency']||0x96;this[_0xd98a('0x1b')]=_0x243a66[_0xd98a('0x1b')]||0x3;this[_0xd98a('0x1c')]=_0x243a66[_0xd98a('0x1c')]||0x96;this[_0xd98a('0x1d')]=_0x243a66[_0xd98a('0x1d')]||_0xd98a('0x1e');this[_0xd98a('0x1f')]=_0x243a66[_0xd98a('0x1f')]||undefined;this[_0xd98a('0x20')]=_0x243a66['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x243a66['dialCutDigit']||undefined;this[_0xd98a('0x21')]=_0x243a66[_0xd98a('0x21')]?_0x243a66[_0xd98a('0x21')]:undefined;this[_0xd98a('0x22')]=_0x243a66[_0xd98a('0x22')]?_0x243a66['Trunk']:undefined;this[_0xd98a('0x23')]=_0x243a66[_0xd98a('0x23')]?_0x243a66['Interval']:undefined;this[_0xd98a('0x24')]=_0x243a66['SquareProject']?_0x243a66[_0xd98a('0x24')]:undefined;this[_0xd98a('0x25')]=_0x243a66[_0xd98a('0x24')]?_0x243a66[_0xd98a('0x24')][_0xd98a('0x26')]:undefined;this['dialAMDActive']=_0x243a66[_0xd98a('0x27')]||![];this['dialAMDInitialSilence']=_0x243a66[_0xd98a('0x28')];this['dialAMDGreeting']=_0x243a66[_0xd98a('0x29')];this[_0xd98a('0x2a')]=_0x243a66[_0xd98a('0x2a')];this[_0xd98a('0x2b')]=_0x243a66['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x243a66[_0xd98a('0x2c')];this['dialAMDBetweenWordsSilence']=_0x243a66[_0xd98a('0x2d')];this[_0xd98a('0x2e')]=_0x243a66[_0xd98a('0x2e')];this[_0xd98a('0x2f')]=_0x243a66[_0xd98a('0x2f')];this[_0xd98a('0x30')]=_0x243a66['dialAMDMaximumWordLength'];}module[_0xd98a('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2311882..5e30caa 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 _0x3e2a=['accountcode','context','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','holdtime','type','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x3031b4,_0x181731){var _0x2c8161=function(_0x3eb5e5){while(--_0x3eb5e5){_0x3031b4['push'](_0x3031b4['shift']());}};_0x2c8161(++_0x181731);}(_0x3e2a,0x10c));var _0xa3e2=function(_0x403062,_0x4a6cef){_0x403062=_0x403062-0x0;var _0x4a9249=_0x3e2a[_0x403062];return _0x4a9249;};'use strict';function Channel(){this[_0xa3e2('0x0')]=null;this[_0xa3e2('0x1')]='';this[_0xa3e2('0x2')]='';this[_0xa3e2('0x3')]=0x0;this[_0xa3e2('0x4')]='';this[_0xa3e2('0x5')]=undefined;this[_0xa3e2('0x6')]=undefined;this[_0xa3e2('0x7')]=0x0;this[_0xa3e2('0x8')]='';this['uniqueid']=0x0;this[_0xa3e2('0x9')]=0x0;this['exten']=0x0;this[_0xa3e2('0xa')]=![];this[_0xa3e2('0xb')]=null;this[_0xa3e2('0xc')]=null;this[_0xa3e2('0xd')]=![];this[_0xa3e2('0xe')]=![];this['lastapplication']='';this[_0xa3e2('0xf')]='';this[_0xa3e2('0x10')]=0x0;this['billableseconds']=0x0;this[_0xa3e2('0x11')]=0x0;this[_0xa3e2('0x12')]=null;this['tag']=null;this['disposition']=null;this['monitor']=![];this[_0xa3e2('0x13')]=null;this[_0xa3e2('0x14')]=null;this[_0xa3e2('0x15')]=[];this['transfercalleridnum']=undefined;this[_0xa3e2('0x16')]=undefined;this[_0xa3e2('0x17')]=undefined;this[_0xa3e2('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xf811=['uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','duration','billableseconds','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context'];(function(_0x43bced,_0x430750){var _0x56b561=function(_0x2e2941){while(--_0x2e2941){_0x43bced['push'](_0x43bced['shift']());}};_0x56b561(++_0x430750);}(_0xf811,0x6f));var _0x1f81=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xf811[_0x4fde08];return _0x12e725;};'use strict';function Channel(){this[_0x1f81('0x0')]=null;this[_0x1f81('0x1')]='';this[_0x1f81('0x2')]='';this[_0x1f81('0x3')]=0x0;this[_0x1f81('0x4')]='';this[_0x1f81('0x5')]=undefined;this[_0x1f81('0x6')]=undefined;this[_0x1f81('0x7')]=0x0;this[_0x1f81('0x8')]='';this[_0x1f81('0x9')]=0x0;this[_0x1f81('0xa')]=0x0;this[_0x1f81('0xb')]=0x0;this[_0x1f81('0xc')]=![];this[_0x1f81('0xd')]=null;this['endtime']=null;this[_0x1f81('0xe')]=![];this[_0x1f81('0xf')]=![];this[_0x1f81('0x10')]='';this['lastdata']='';this[_0x1f81('0x11')]=0x0;this[_0x1f81('0x12')]=0x0;this['holdtime']=0x0;this[_0x1f81('0x13')]=null;this['tag']=null;this[_0x1f81('0x14')]=null;this[_0x1f81('0x15')]=![];this[_0x1f81('0x16')]=null;this[_0x1f81('0x17')]=null;this[_0x1f81('0x18')]=[];this[_0x1f81('0x19')]=undefined;this[_0x1f81('0x1a')]=undefined;this[_0x1f81('0x1b')]=undefined;this[_0x1f81('0x1c')]=0x0;}module[_0x1f81('0x1d')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index f2a833c..d970384 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 _0xbabc=['consumerSecret','tokenSecret','serverUrl','name','username','remoteUri','authType','password','consumerKey'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xbabc,0x1ce));var _0xcbab=function(_0x4f2654,_0xddb1ad){_0x4f2654=_0x4f2654-0x0;var _0x3858b6=_0xbabc[_0x4f2654];return _0x3858b6;};'use strict';function DeskAccount(_0x4b79ad){this['id']=_0x4b79ad['id']||0x0;this[_0xcbab('0x0')]=_0x4b79ad[_0xcbab('0x0')]||'';this[_0xcbab('0x1')]=_0x4b79ad[_0xcbab('0x1')]||'';this[_0xcbab('0x2')]=_0x4b79ad[_0xcbab('0x2')]||'';this[_0xcbab('0x3')]=_0x4b79ad['authType']||'';this['password']=_0x4b79ad[_0xcbab('0x4')]||'';this[_0xcbab('0x5')]=_0x4b79ad[_0xcbab('0x5')]||'';this[_0xcbab('0x6')]=_0x4b79ad[_0xcbab('0x6')]||'';this['token']=_0x4b79ad['token']||'';this[_0xcbab('0x7')]=_0x4b79ad['tokenSecret']||'';this['type']=_0x4b79ad['type']||'';this[_0xcbab('0x8')]=_0x4b79ad['serverUrl']||'';this['Configurations']=_0x4b79ad['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x3824=['type','serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x59db86,_0x12249e){var _0x4eccdc=function(_0x3d19a4){while(--_0x3d19a4){_0x59db86['push'](_0x59db86['shift']());}};_0x4eccdc(++_0x12249e);}(_0x3824,0x1b4));var _0x4382=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x3824[_0x28fbe3];return _0x45db6a;};'use strict';function DeskAccount(_0x37bcb1){this['id']=_0x37bcb1['id']||0x0;this['name']=_0x37bcb1['name']||'';this[_0x4382('0x0')]=_0x37bcb1[_0x4382('0x0')]||'';this[_0x4382('0x1')]=_0x37bcb1[_0x4382('0x1')]||'';this[_0x4382('0x2')]=_0x37bcb1[_0x4382('0x2')]||'';this[_0x4382('0x3')]=_0x37bcb1['password']||'';this['consumerKey']=_0x37bcb1[_0x4382('0x4')]||'';this['consumerSecret']=_0x37bcb1[_0x4382('0x5')]||'';this['token']=_0x37bcb1[_0x4382('0x6')]||'';this['tokenSecret']=_0x37bcb1[_0x4382('0x7')]||'';this[_0x4382('0x8')]=_0x37bcb1[_0x4382('0x8')]||'';this[_0x4382('0x9')]=_0x37bcb1[_0x4382('0x9')]||'';this[_0x4382('0xa')]=_0x37bcb1[_0x4382('0xa')]||{};}module[_0x4382('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 45bda23..6d1570e 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 _0x0269=['remoteUri','tenantId','clientId','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x2e1eb2,_0x529965){var _0x2ea9b1=function(_0x1ee5ca){while(--_0x1ee5ca){_0x2e1eb2['push'](_0x2e1eb2['shift']());}};_0x2ea9b1(++_0x529965);}(_0x0269,0x17e));var _0x9026=function(_0x4d98bb,_0x46b661){_0x4d98bb=_0x4d98bb-0x0;var _0xae2480=_0x0269[_0x4d98bb];return _0xae2480;};'use strict';function Dynamics365Account(_0x354f9e){this['id']=_0x354f9e['id']||0x0;this[_0x9026('0x0')]=_0x354f9e[_0x9026('0x0')]||'';this[_0x9026('0x1')]=_0x354f9e['username']||'';this[_0x9026('0x2')]=_0x354f9e[_0x9026('0x2')]||'';this[_0x9026('0x3')]=_0x354f9e[_0x9026('0x3')]||'';this[_0x9026('0x4')]=_0x354f9e[_0x9026('0x4')]||'';this['clientId']=_0x354f9e[_0x9026('0x5')]||'';this['clientSecret']=_0x354f9e['clientSecret']||{};this[_0x9026('0x6')]=_0x354f9e[_0x9026('0x6')]||'';this[_0x9026('0x7')]=_0x354f9e['modernAuthentication']||![];this[_0x9026('0x8')]=_0x354f9e['Configurations']||{};this[_0x9026('0x9')]=_0x354f9e[_0x9026('0x9')]||{};}module[_0x9026('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x6d57=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x222d15,_0x1d2a95){var _0xf31c7d=function(_0x32faba){while(--_0x32faba){_0x222d15['push'](_0x222d15['shift']());}};_0xf31c7d(++_0x1d2a95);}(_0x6d57,0x9d));var _0x76d5=function(_0x54c829,_0x334703){_0x54c829=_0x54c829-0x0;var _0x55b8d6=_0x6d57[_0x54c829];return _0x55b8d6;};'use strict';function Dynamics365Account(_0x3be8d4){this['id']=_0x3be8d4['id']||0x0;this[_0x76d5('0x0')]=_0x3be8d4[_0x76d5('0x0')]||'';this['username']=_0x3be8d4[_0x76d5('0x1')]||'';this[_0x76d5('0x2')]=_0x3be8d4['password']||'';this['remoteUri']=_0x3be8d4[_0x76d5('0x3')]||'';this[_0x76d5('0x4')]=_0x3be8d4[_0x76d5('0x4')]||'';this['clientId']=_0x3be8d4[_0x76d5('0x5')]||'';this['clientSecret']=_0x3be8d4[_0x76d5('0x6')]||{};this[_0x76d5('0x7')]=_0x3be8d4[_0x76d5('0x7')]||'';this[_0x76d5('0x8')]=_0x3be8d4[_0x76d5('0x8')]||![];this[_0x76d5('0x9')]=_0x3be8d4[_0x76d5('0x9')]||{};this[_0x76d5('0xa')]=_0x3be8d4[_0x76d5('0xa')]||{};}module[_0x76d5('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 71e31f6..d307c36 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 _0x1a37=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','faxdetect','t38timeout','tech','SIP','Trunk','key','exports'];(function(_0x384501,_0x3fe787){var _0x2d92c6=function(_0x11f336){while(--_0x11f336){_0x384501['push'](_0x384501['shift']());}};_0x2d92c6(++_0x3fe787);}(_0x1a37,0xb4));var _0x71a3=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x1a37[_0x58afd5];return _0x3e503b;};'use strict';function FaxAccount(_0x30aa15){this['id']=_0x30aa15['id']||0x0;this[_0x71a3('0x0')]=_0x30aa15[_0x71a3('0x0')]||'';this[_0x71a3('0x1')]=_0x30aa15[_0x71a3('0x1')];this[_0x71a3('0x2')]=_0x30aa15[_0x71a3('0x2')];this[_0x71a3('0x3')]=_0x30aa15[_0x71a3('0x3')];this[_0x71a3('0x4')]=_0x30aa15['localstationid'];this[_0x71a3('0x5')]=_0x30aa15['minrate']||0x960;this[_0x71a3('0x6')]=_0x30aa15[_0x71a3('0x6')]||0x3840;this[_0x71a3('0x7')]=_0x30aa15[_0x71a3('0x7')]||'v17,v27,v29';this['gateway']=_0x30aa15['gateway']||'no';this['faxdetect']=_0x30aa15[_0x71a3('0x8')]||'no';this[_0x71a3('0x9')]=_0x30aa15[_0x71a3('0x9')]||0x1388;this[_0x71a3('0xa')]=_0x30aa15[_0x71a3('0xa')]||_0x71a3('0xb');this[_0x71a3('0xc')]=_0x30aa15[_0x71a3('0xc')]?_0x30aa15['Trunk']:undefined;this['ListId']=_0x30aa15['ListId'];this[_0x71a3('0xd')]=_0x30aa15[_0x71a3('0xd')];}module[_0x71a3('0xe')]=FaxAccount; \ No newline at end of file +var _0xd26f=['Trunk','ListId','key','exports','name','ecm','localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP'];(function(_0x1703f9,_0x52b31e){var _0x2cb602=function(_0x2767d8){while(--_0x2767d8){_0x1703f9['push'](_0x1703f9['shift']());}};_0x2cb602(++_0x52b31e);}(_0xd26f,0x82));var _0xfd26=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xd26f[_0x50a0c2];return _0x5ebadd;};'use strict';function FaxAccount(_0x20bf61){this['id']=_0x20bf61['id']||0x0;this['name']=_0x20bf61[_0xfd26('0x0')]||'';this['description']=_0x20bf61['description'];this[_0xfd26('0x1')]=_0x20bf61[_0xfd26('0x1')];this['headerinfo']=_0x20bf61['headerinfo'];this[_0xfd26('0x2')]=_0x20bf61[_0xfd26('0x2')];this[_0xfd26('0x3')]=_0x20bf61[_0xfd26('0x3')]||0x960;this['maxrate']=_0x20bf61['maxrate']||0x3840;this[_0xfd26('0x4')]=_0x20bf61[_0xfd26('0x4')]||_0xfd26('0x5');this[_0xfd26('0x6')]=_0x20bf61[_0xfd26('0x6')]||'no';this['faxdetect']=_0x20bf61[_0xfd26('0x7')]||'no';this['t38timeout']=_0x20bf61['t38timeout']||0x1388;this[_0xfd26('0x8')]=_0x20bf61['tech']||_0xfd26('0x9');this[_0xfd26('0xa')]=_0x20bf61[_0xfd26('0xa')]?_0x20bf61['Trunk']:undefined;this[_0xfd26('0xb')]=_0x20bf61[_0xfd26('0xb')];this['key']=_0x20bf61[_0xfd26('0xc')];}module[_0xfd26('0xd')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d10f148..c10f26c 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 _0x2dca=['serverUrl','exports','name','username','apiKey','token','remoteUri'];(function(_0x32ca69,_0x389a20){var _0x1d9e01=function(_0x1af6a1){while(--_0x1af6a1){_0x32ca69['push'](_0x32ca69['shift']());}};_0x1d9e01(++_0x389a20);}(_0x2dca,0x1c9));var _0xa2dc=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x2dca[_0x163040];return _0x364667;};'use strict';function FreshdeskAccount(_0x4a6fb4){this['id']=_0x4a6fb4['id']||0x0;this['name']=_0x4a6fb4[_0xa2dc('0x0')]||'';this[_0xa2dc('0x1')]=_0x4a6fb4[_0xa2dc('0x1')]||'';this[_0xa2dc('0x2')]=_0x4a6fb4[_0xa2dc('0x3')]||'';this[_0xa2dc('0x4')]=_0x4a6fb4[_0xa2dc('0x4')]||'';this['serverUrl']=_0x4a6fb4[_0xa2dc('0x5')]||'';this['Configurations']=_0x4a6fb4['Configurations']||{};}module[_0xa2dc('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x6557=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x6557,0x15e));var _0x7655=function(_0x3504d9,_0x37edfc){_0x3504d9=_0x3504d9-0x0;var _0x302f1=_0x6557[_0x3504d9];return _0x302f1;};'use strict';function FreshdeskAccount(_0x10229c){this['id']=_0x10229c['id']||0x0;this[_0x7655('0x0')]=_0x10229c[_0x7655('0x0')]||'';this[_0x7655('0x1')]=_0x10229c[_0x7655('0x1')]||'';this[_0x7655('0x2')]=_0x10229c[_0x7655('0x3')]||'';this['remoteUri']=_0x10229c[_0x7655('0x4')]||'';this['serverUrl']=_0x10229c[_0x7655('0x5')]||'';this[_0x7655('0x6')]=_0x10229c[_0x7655('0x6')]||{};}module[_0x7655('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e3a51ed..6df6901 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 _0x425d=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x425d,0x1e0));var _0xd425=function(_0x5568ed,_0x61f3be){_0x5568ed=_0x5568ed-0x0;var _0x406c98=_0x425d[_0x5568ed];return _0x406c98;};'use strict';function FreshsalesAccount(_0x20c3d2){this['id']=_0x20c3d2['id']||0x0;this['name']=_0x20c3d2[_0xd425('0x0')]||'';this[_0xd425('0x1')]=_0x20c3d2[_0xd425('0x1')]||'';this[_0xd425('0x2')]=_0x20c3d2[_0xd425('0x3')]||'';this[_0xd425('0x4')]=_0x20c3d2[_0xd425('0x4')]||'';this['serverUrl']=_0x20c3d2[_0xd425('0x5')]||'';this[_0xd425('0x6')]=_0x20c3d2[_0xd425('0x6')]||{};}module[_0xd425('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xc21c=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2e3100,_0xdcd421){var _0x25eac2=function(_0x554752){while(--_0x554752){_0x2e3100['push'](_0x2e3100['shift']());}};_0x25eac2(++_0xdcd421);}(_0xc21c,0x166));var _0xcc21=function(_0x3189ff,_0x53dba4){_0x3189ff=_0x3189ff-0x0;var _0x22cda1=_0xc21c[_0x3189ff];return _0x22cda1;};'use strict';function FreshsalesAccount(_0xba1573){this['id']=_0xba1573['id']||0x0;this[_0xcc21('0x0')]=_0xba1573['name']||'';this[_0xcc21('0x1')]=_0xba1573[_0xcc21('0x1')]||'';this[_0xcc21('0x2')]=_0xba1573[_0xcc21('0x3')]||'';this['remoteUri']=_0xba1573[_0xcc21('0x4')]||'';this[_0xcc21('0x5')]=_0xba1573[_0xcc21('0x5')]||'';this[_0xcc21('0x6')]=_0xba1573[_0xcc21('0x6')]||{};}module[_0xcc21('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 fc9dfc2..079931c 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 _0x2321=['position','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x557f0a,_0x14250c){var _0x9a5663=function(_0x2657d8){while(--_0x2657d8){_0x557f0a['push'](_0x557f0a['shift']());}};_0x9a5663(++_0x14250c);}(_0x2321,0x90));var _0x1232=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x2321[_0x87b0ff];return _0x3bc0b2;};'use strict';function QueueReport(){this[_0x1232('0x0')]=_0x1232('0x1');this['uniqueid']='';this[_0x1232('0x2')]='';this['calleridname']='';this[_0x1232('0x3')]='';this[_0x1232('0x4')]=null;this[_0x1232('0x5')]=null;this[_0x1232('0x6')]=0x1;this['count']=0x1;this[_0x1232('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x1232('0x8')]=![];this[_0x1232('0x9')]=null;this[_0x1232('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0x1232('0xb')]='';this[_0x1232('0xc')]='';this[_0x1232('0xd')]='';this[_0x1232('0xe')]='';this['context']='';this[_0x1232('0xf')]='';this[_0x1232('0x10')]='';this[_0x1232('0x11')]=0x0;this[_0x1232('0x12')]=![];this[_0x1232('0x13')]='';this[_0x1232('0x14')]=_0x1232('0x15');this[_0x1232('0x16')]=0x0;this[_0x1232('0x17')]={};}module[_0x1232('0x18')]=QueueReport; \ No newline at end of file +var _0x3cc6=['queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority','holdtime','assigned','motionChannel','voice','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt'];(function(_0x289cca,_0x3b4785){var _0x24f442=function(_0x4025a2){while(--_0x4025a2){_0x289cca['push'](_0x289cca['shift']());}};_0x24f442(++_0x3b4785);}(_0x3cc6,0x69));var _0x63cc=function(_0x979296,_0x416487){_0x979296=_0x979296-0x0;var _0x58921e=_0x3cc6[_0x979296];return _0x58921e;};'use strict';function QueueReport(){this[_0x63cc('0x0')]='inbound';this[_0x63cc('0x1')]='';this[_0x63cc('0x2')]='';this[_0x63cc('0x3')]='';this[_0x63cc('0x4')]='';this[_0x63cc('0x5')]=null;this[_0x63cc('0x6')]=null;this[_0x63cc('0x7')]=0x1;this['count']=0x1;this[_0x63cc('0x8')]=![];this[_0x63cc('0x9')]=null;this[_0x63cc('0xa')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x63cc('0xb')]=null;this[_0x63cc('0xc')]=0x1;this[_0x63cc('0xd')]='';this['connectedlinenum']='';this[_0x63cc('0xe')]='';this['accountcode']='';this[_0x63cc('0xf')]='';this[_0x63cc('0x10')]='';this[_0x63cc('0x11')]='';this[_0x63cc('0x12')]=0x0;this[_0x63cc('0x13')]=![];this['lastAssignedTo']='';this[_0x63cc('0x14')]=_0x63cc('0x15');this['mohtime']=0x0;this[_0x63cc('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bb48296..60f05c2 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 _0x553a=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x1481fe,_0x3e3aba){var _0x331c93=function(_0x42ce62){while(--_0x42ce62){_0x1481fe['push'](_0x1481fe['shift']());}};_0x331c93(++_0x3e3aba);}(_0x553a,0x141));var _0xa553=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x553a[_0x5d6270];return _0x168f26;};'use strict';function SalesforceAccount(_0x5c764b){this['id']=_0x5c764b['id']||0x0;this[_0xa553('0x0')]=_0x5c764b[_0xa553('0x0')]||'';this[_0xa553('0x1')]=_0x5c764b[_0xa553('0x1')]||'';this[_0xa553('0x2')]=_0x5c764b[_0xa553('0x2')]||'';this[_0xa553('0x3')]=_0x5c764b[_0xa553('0x3')]||'';this['clientId']=_0x5c764b[_0xa553('0x4')]||'';this['clientSecret']=_0x5c764b[_0xa553('0x5')]||'';this[_0xa553('0x6')]=_0x5c764b['securityToken']||'';this[_0xa553('0x7')]=_0x5c764b['type']||_0xa553('0x8');this[_0xa553('0x9')]=_0x5c764b['serverUrl']||'';this[_0xa553('0xa')]=_0x5c764b[_0xa553('0xa')]||{};}module[_0xa553('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x64df=['integrationTab','serverUrl','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x64df,0x1f2));var _0xf64d=function(_0xfc9121,_0x38e193){_0xfc9121=_0xfc9121-0x0;var _0x4e9f47=_0x64df[_0xfc9121];return _0x4e9f47;};'use strict';function SalesforceAccount(_0x429150){this['id']=_0x429150['id']||0x0;this['name']=_0x429150[_0xf64d('0x0')]||'';this[_0xf64d('0x1')]=_0x429150[_0xf64d('0x1')]||'';this['remoteUri']=_0x429150[_0xf64d('0x2')]||'';this[_0xf64d('0x3')]=_0x429150[_0xf64d('0x3')]||'';this[_0xf64d('0x4')]=_0x429150[_0xf64d('0x4')]||'';this[_0xf64d('0x5')]=_0x429150[_0xf64d('0x5')]||'';this['securityToken']=_0x429150[_0xf64d('0x6')]||'';this[_0xf64d('0x7')]=_0x429150[_0xf64d('0x7')]||_0xf64d('0x8');this['serverUrl']=_0x429150[_0xf64d('0x9')]||'';this['Configurations']=_0x429150['Configurations']||{};}module[_0xf64d('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 88a2eaa..9229d5f 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 _0xc296=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2b7f97,_0x3fe5c6){var _0x3c2339=function(_0x12e36c){while(--_0x12e36c){_0x2b7f97['push'](_0x2b7f97['shift']());}};_0x3c2339(++_0x3fe5c6);}(_0xc296,0x1cc));var _0x6c29=function(_0x5c0578,_0x2525e5){_0x5c0578=_0x5c0578-0x0;var _0x1896e4=_0xc296[_0x5c0578];return _0x1896e4;};'use strict';function ServicenowAccount(_0x4ef5b6){this['id']=_0x4ef5b6['id']||0x0;this[_0x6c29('0x0')]=_0x4ef5b6['name']||'';this[_0x6c29('0x1')]=_0x4ef5b6[_0x6c29('0x1')]||'';this[_0x6c29('0x2')]=_0x4ef5b6['password']||'';this[_0x6c29('0x3')]=_0x4ef5b6[_0x6c29('0x3')]||'';this['serverUrl']=_0x4ef5b6[_0x6c29('0x4')]||'';this[_0x6c29('0x5')]=_0x4ef5b6[_0x6c29('0x5')]||{};}module[_0x6c29('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x486d=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x82a677,_0x113919){var _0x5e8914=function(_0x21522f){while(--_0x21522f){_0x82a677['push'](_0x82a677['shift']());}};_0x5e8914(++_0x113919);}(_0x486d,0x1b7));var _0xd486=function(_0xd0b019,_0x49c55a){_0xd0b019=_0xd0b019-0x0;var _0xf17614=_0x486d[_0xd0b019];return _0xf17614;};'use strict';function ServicenowAccount(_0x434ffc){this['id']=_0x434ffc['id']||0x0;this['name']=_0x434ffc[_0xd486('0x0')]||'';this[_0xd486('0x1')]=_0x434ffc[_0xd486('0x1')]||'';this[_0xd486('0x2')]=_0x434ffc['password']||'';this['remoteUri']=_0x434ffc[_0xd486('0x3')]||'';this[_0xd486('0x4')]=_0x434ffc[_0xd486('0x4')]||'';this['Configurations']=_0x434ffc[_0xd486('0x5')]||{};}module[_0xd486('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 06ffa82..28d9872 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 _0x3e65=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x12f4d3,_0x20d5df){var _0xa61b38=function(_0x2f1956){while(--_0x2f1956){_0x12f4d3['push'](_0x12f4d3['shift']());}};_0xa61b38(++_0x20d5df);}(_0x3e65,0x102));var _0x53e6=function(_0x30d3e7,_0x477d6b){_0x30d3e7=_0x30d3e7-0x0;var _0x282ce0=_0x3e65[_0x30d3e7];return _0x282ce0;};'use strict';function SugarcrmAccount(_0x3afca7){this['id']=_0x3afca7['id']||0x0;this[_0x53e6('0x0')]=_0x3afca7[_0x53e6('0x0')]||'';this[_0x53e6('0x1')]=_0x3afca7['username']||'';this[_0x53e6('0x2')]=_0x3afca7[_0x53e6('0x2')]||'';this[_0x53e6('0x3')]=_0x3afca7[_0x53e6('0x3')]||'';this[_0x53e6('0x4')]=_0x3afca7[_0x53e6('0x4')]||'';this['Configurations']=_0x3afca7[_0x53e6('0x5')]||{};}module[_0x53e6('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe361=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xe361,0x7a));var _0x1e36=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0xe361[_0xea35d1];return _0x1d7a7c;};'use strict';function SugarcrmAccount(_0x1e7a2c){this['id']=_0x1e7a2c['id']||0x0;this[_0x1e36('0x0')]=_0x1e7a2c[_0x1e36('0x0')]||'';this[_0x1e36('0x1')]=_0x1e7a2c[_0x1e36('0x1')]||'';this['password']=_0x1e7a2c['password']||'';this[_0x1e36('0x2')]=_0x1e7a2c[_0x1e36('0x2')]||'';this[_0x1e36('0x3')]=_0x1e7a2c[_0x1e36('0x3')]||'';this[_0x1e36('0x4')]=_0x1e7a2c['Configurations']||{};}module[_0x1e36('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 53068e4..a3ff833 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 _0x907e=['address','exports','accountcode','unknown','stateTime','status'];(function(_0x5e95b9,_0x26e44e){var _0x30d162=function(_0x38627b){while(--_0x38627b){_0x5e95b9['push'](_0x5e95b9['shift']());}};_0x30d162(++_0x26e44e);}(_0x907e,0xc8));var _0xe907=function(_0x30c7c5,_0x168208){_0x30c7c5=_0x30c7c5-0x0;var _0x29e24e=_0x907e[_0x30c7c5];return _0x29e24e;};'use strict';function Telephone(_0x2e36ba){this['id']=_0x2e36ba['id']||0x0;this['name']=_0x2e36ba['name']||'';this[_0xe907('0x0')]=_0x2e36ba[_0xe907('0x0')]||'';this['state']=_0xe907('0x1');this[_0xe907('0x2')]=0x0;this[_0xe907('0x3')]=_0xe907('0x1');this[_0xe907('0x4')]='';}module[_0xe907('0x5')]=Telephone; \ No newline at end of file +var _0xab23=['status','unknown','address','name','accountcode','state','stateTime'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xab23,0x1bc));var _0x3ab2=function(_0x133cf2,_0x5cc078){_0x133cf2=_0x133cf2-0x0;var _0x41a47c=_0xab23[_0x133cf2];return _0x41a47c;};'use strict';function Telephone(_0x1a61b0){this['id']=_0x1a61b0['id']||0x0;this[_0x3ab2('0x0')]=_0x1a61b0[_0x3ab2('0x0')]||'';this[_0x3ab2('0x1')]=_0x1a61b0[_0x3ab2('0x1')]||'';this[_0x3ab2('0x2')]='unknown';this[_0x3ab2('0x3')]=0x0;this[_0x3ab2('0x4')]=_0x3ab2('0x5');this[_0x3ab2('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a9d7eba..0f51a30 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 _0xb10b=['name','html'];(function(_0xebab8b,_0x17f2b3){var _0x40e80f=function(_0x450f0e){while(--_0x450f0e){_0xebab8b['push'](_0xebab8b['shift']());}};_0x40e80f(++_0x17f2b3);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ea183,_0x3cff11){_0x2ea183=_0x2ea183-0x0;var _0x47c16c=_0xb10b[_0x2ea183];return _0x47c16c;};'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 +var _0xb10b=['name','html'];(function(_0x472883,_0x3b394d){var _0x263953=function(_0x2b48fb){while(--_0x2b48fb){_0x472883['push'](_0x472883['shift']());}};_0x263953(++_0x3b394d);}(_0xb10b,0x12a));var _0xbb10=function(_0xf61129,_0x523668){_0xf61129=_0xf61129-0x0;var _0xefa38a=_0xb10b[_0xf61129];return _0xefa38a;};'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 572c8df..6a02f6c 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x50e55a,_0x337b39){var _0x1f9018=function(_0x5e1742){while(--_0x5e1742){_0x50e55a['push'](_0x50e55a['shift']());}};_0x1f9018(++_0x337b39);}(_0x757a,0xde));var _0xa757=function(_0x5bd610,_0x2b11ba){_0x5bd610=_0x5bd610-0x0;var _0x196ae0=_0x757a[_0x5bd610];return _0x196ae0;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x595e30,_0x1f0f9f){var _0x3bcd17=function(_0x4faeb){while(--_0x4faeb){_0x595e30['push'](_0x595e30['shift']());}};_0x3bcd17(++_0x1f0f9f);}(_0xda3f,0xec));var _0xfda3=function(_0x32b166,_0x2f1b6f){_0x32b166=_0x32b166-0x0;var _0x127f84=_0xda3f[_0x32b166];return _0x127f84;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index da7e7a6..370b886 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 _0xc055=['domain','domainport','refresh','stateRegistry','address','defaultuser','active','state','unknown','stateTime','registry','indexOf','port'];(function(_0x116504,_0x30e7c9){var _0x80d529=function(_0x925edf){while(--_0x925edf){_0x116504['push'](_0x116504['shift']());}};_0x80d529(++_0x30e7c9);}(_0xc055,0xe3));var _0x5c05=function(_0x4acb9d,_0x28894b){_0x4acb9d=_0x4acb9d-0x0;var _0x252ccb=_0xc055[_0x4acb9d];return _0x252ccb;};'use strict';function Trunk(_0x563f88){this['id']=_0x563f88['id']||0x0;this[_0x5c05('0x0')]=_0x563f88[_0x5c05('0x0')]||![];this['name']=_0x563f88['name']||'';this[_0x5c05('0x1')]=_0x5c05('0x2');this[_0x5c05('0x3')]=0x0;this['status']=_0x5c05('0x2');this[_0x5c05('0x4')]=_0x563f88[_0x5c05('0x4')]&&_0x563f88[_0x5c05('0x4')][_0x5c05('0x5')](':')?_0x563f88[_0x5c05('0x4')]['split'](':')[0x0]:'';this['host']='';this[_0x5c05('0x6')]='';this[_0x5c05('0x7')]='';this[_0x5c05('0x8')]='';this[_0x5c05('0x9')]='';this[_0x5c05('0xa')]=_0x5c05('0x2');this['registrationtime']='';this[_0x5c05('0xb')]='';this[_0x5c05('0xc')]=_0x563f88[_0x5c05('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xb6e1=['unknown','status','registry','indexOf','split','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','state'];(function(_0x540c49,_0x3e88d9){var _0x390f69=function(_0x4cdf60){while(--_0x4cdf60){_0x540c49['push'](_0x540c49['shift']());}};_0x390f69(++_0x3e88d9);}(_0xb6e1,0xde));var _0x1b6e=function(_0x2d1ff6,_0x182530){_0x2d1ff6=_0x2d1ff6-0x0;var _0x2f1298=_0xb6e1[_0x2d1ff6];return _0x2f1298;};'use strict';function Trunk(_0x1a500a){this['id']=_0x1a500a['id']||0x0;this[_0x1b6e('0x0')]=_0x1a500a[_0x1b6e('0x0')]||![];this['name']=_0x1a500a[_0x1b6e('0x1')]||'';this[_0x1b6e('0x2')]=_0x1b6e('0x3');this['stateTime']=0x0;this[_0x1b6e('0x4')]=_0x1b6e('0x3');this[_0x1b6e('0x5')]=_0x1a500a[_0x1b6e('0x5')]&&_0x1a500a[_0x1b6e('0x5')][_0x1b6e('0x6')](':')?_0x1a500a[_0x1b6e('0x5')][_0x1b6e('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0x1b6e('0x8')]='';this[_0x1b6e('0x9')]='';this[_0x1b6e('0xa')]='';this[_0x1b6e('0xb')]=_0x1b6e('0x3');this[_0x1b6e('0xc')]='';this['address']='';this[_0x1b6e('0xd')]=_0x1a500a['defaultuser']||'';}module[_0x1b6e('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index b2eee83..e9c016e 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 _0x8eb7=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x487ae6,_0x3580e3){var _0x1c72c8=function(_0x408d16){while(--_0x408d16){_0x487ae6['push'](_0x487ae6['shift']());}};_0x1c72c8(++_0x3580e3);}(_0x8eb7,0xfb));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x7de6cb){this['id']=_0x7de6cb['id']||0x0;this['exten']=_0x7de6cb[_0x78eb('0x0')]||'';this[_0x78eb('0x1')]=_0x7de6cb['recordingFormat']||_0x78eb('0x2');this[_0x78eb('0x3')]=_0x7de6cb[_0x78eb('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x4466=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0x4466,0x116));var _0x6446=function(_0x31c796,_0x2e3c7f){_0x31c796=_0x31c796-0x0;var _0x128356=_0x4466[_0x31c796];return _0x128356;};'use strict';function voiceExtension(_0x35680a){this['id']=_0x35680a['id']||0x0;this[_0x6446('0x0')]=_0x35680a[_0x6446('0x0')]||'';this['recordingFormat']=_0x35680a[_0x6446('0x1')]||'none';this[_0x6446('0x2')]=_0x35680a[_0x6446('0x2')]||![];}module[_0x6446('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 01427d9..a39f60d 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 _0xcd8e=['originated','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message'];(function(_0x5345f8,_0x41d942){var _0x237027=function(_0x4c789c){while(--_0x4c789c){_0x5345f8['push'](_0x5345f8['shift']());}};_0x237027(++_0x41d942);}(_0xcd8e,0x155));var _0xecd8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xcd8e[_0x3b380d];return _0x54502b;};'use strict';var statusDesc=[_0xecd8('0x0'),'not_inuse','inuse',_0xecd8('0x1'),_0xecd8('0x2'),_0xecd8('0x3'),_0xecd8('0x4'),_0xecd8('0x5'),'onhold'];var monitorFormat={'wav':_0xecd8('0x6'),'wav49':_0xecd8('0x7'),'gsm':_0xecd8('0x8')};var strategy={'rrmemory':_0xecd8('0x9'),'roundrobin':_0xecd8('0xa')};function VoiceQueue(_0x298195){this['id']=_0x298195['id']||0x0;this[_0xecd8('0xb')]=_0x298195['name']||'';this[_0xecd8('0xc')]=_0x298195['monitor_format']||'';this[_0xecd8('0xd')]=_0x298195[_0xecd8('0xd')]||'inbound';this['waiting']=0x0;this['talking']=0x0;this[_0xecd8('0xe')]=0x0;this[_0xecd8('0xf')]=0x0;this[_0xecd8('0x10')]=0x0;this[_0xecd8('0x11')]=0x0;this[_0xecd8('0x12')]=0x0;this[_0xecd8('0x13')]=0x0;this[_0xecd8('0x14')]=0x0;this[_0xecd8('0x15')]=0x0;this[_0xecd8('0x16')]=0x0;this[_0xecd8('0x17')]=_0x298195[_0xecd8('0x17')]||![];this[_0xecd8('0x18')]=_0x298195[_0xecd8('0x18')]||0xa;this[_0xecd8('0x19')]=_0x298195[_0xecd8('0x19')]||'no';this[_0xecd8('0x1a')]=!![];this[_0xecd8('0x1b')]='';this[_0xecd8('0x1c')]=0x0;this['temp']=0x0;this[_0xecd8('0x1d')]=_0x298195[_0xecd8('0x1d')]||null;this[_0xecd8('0x1e')]=_0x298195[_0xecd8('0x1e')]?_0x298195[_0xecd8('0x1e')]:null;this[_0xecd8('0x1f')]=_0x298195[_0xecd8('0x1f')];this['dialMethod']=_0x298195['dialMethod']||_0xecd8('0x20');this[_0xecd8('0x21')]=_0x298195[_0xecd8('0x21')]||0x0;this[_0xecd8('0x22')]=_0x298195[_0xecd8('0x22')]||0x0;this[_0xecd8('0x23')]=_0x298195[_0xecd8('0x23')]||0x1;this['dialPredictiveOptimization']=_0x298195[_0xecd8('0x24')]||_0xecd8('0x25');this[_0xecd8('0x26')]=_0x298195[_0xecd8('0x26')]||0.03;this['dialPredictiveInterval']=_0x298195[_0xecd8('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x298195['dialOriginateCallerIdName']||_0xecd8('0x28');this[_0xecd8('0x29')]=_0x298195[_0xecd8('0x29')]||_0xecd8('0x28');this[_0xecd8('0x2a')]=_0x298195['dialOriginateTimeout']||0x1e;this[_0xecd8('0x2b')]=_0x298195[_0xecd8('0x2b')]||'tTxX';this[_0xecd8('0x2c')]=_0x298195[_0xecd8('0x2c')]||0x3;this['dialQueueProject']=_0x298195[_0xecd8('0x2d')]||undefined;this[_0xecd8('0x2e')]=_0x298195['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x298195['dialCongestionRetryFrequency']||0x96;this[_0xecd8('0x2f')]=_0x298195[_0xecd8('0x2f')]||0x3;this[_0xecd8('0x30')]=_0x298195[_0xecd8('0x30')]||0x96;this[_0xecd8('0x31')]=_0x298195[_0xecd8('0x31')]||0x3;this[_0xecd8('0x32')]=_0x298195[_0xecd8('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x298195[_0xecd8('0x33')]||0x3;this[_0xecd8('0x34')]=_0x298195[_0xecd8('0x34')]||0x96;this['dialDropMaxRetry']=_0x298195[_0xecd8('0x35')]||0x3;this[_0xecd8('0x36')]=_0x298195['dialDropRetryFrequency']||0x96;this[_0xecd8('0x37')]=_0x298195[_0xecd8('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x298195[_0xecd8('0x38')]||0x96;this['dialMachineMaxRetry']=_0x298195[_0xecd8('0x39')]||0x3;this[_0xecd8('0x3a')]=_0x298195[_0xecd8('0x3a')]||0x96;this[_0xecd8('0x3b')]=_0x298195[_0xecd8('0x3b')]||0x3;this[_0xecd8('0x3c')]=_0x298195[_0xecd8('0x3c')]||0x96;this[_0xecd8('0x3d')]=_0x298195[_0xecd8('0x3d')]||0x4;this['Trunk']=_0x298195[_0xecd8('0x3e')]?_0x298195['Trunk']:undefined;this[_0xecd8('0x3f')]=_0x298195[_0xecd8('0x3f')]?_0x298195[_0xecd8('0x3f')]:undefined;this[_0xecd8('0x40')]=_0x298195[_0xecd8('0x40')]||undefined;this['Interval']=_0x298195[_0xecd8('0x41')]?_0x298195[_0xecd8('0x41')]:undefined;this[_0xecd8('0x42')]=_0x298195[_0xecd8('0x42')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x298195[_0xecd8('0x43')]||undefined;this[_0xecd8('0x44')]=_0x298195[_0xecd8('0x44')]||undefined;this[_0xecd8('0x45')]=strategy[_0x298195['strategy']]||_0xecd8('0x9');this[_0xecd8('0x46')]=!![];this['dialAMDActive']=_0x298195[_0xecd8('0x47')]||![];this[_0xecd8('0x48')]=_0x298195[_0xecd8('0x48')];this[_0xecd8('0x49')]=_0x298195[_0xecd8('0x49')];this[_0xecd8('0x4a')]=_0x298195['dialAMDAfterGreetingSilence'];this[_0xecd8('0x4b')]=_0x298195['dialAMDTotalAnalysisTime'];this[_0xecd8('0x4c')]=_0x298195[_0xecd8('0x4c')];this[_0xecd8('0x4d')]=_0x298195[_0xecd8('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x298195['dialAMDMaximumNumberOfWords'];this[_0xecd8('0x4e')]=_0x298195[_0xecd8('0x4e')];this[_0xecd8('0x4f')]=_0x298195[_0xecd8('0x4f')];this[_0xecd8('0x50')]=0x0;this[_0xecd8('0x51')]=0x0;this[_0xecd8('0x52')]=_0x298195[_0xecd8('0x52')];this[_0xecd8('0x53')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xecd8('0x54')]=0x0;this[_0xecd8('0x55')]=0x0;this[_0xecd8('0x56')]=0x0;this[_0xecd8('0x57')]=0x0;this[_0xecd8('0x58')]=0x0;this[_0xecd8('0x59')]=0x0;this[_0xecd8('0x5a')]=0x0;this[_0xecd8('0x5b')]=0x0;this[_0xecd8('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xecd8('0x5d')]=0x0;this[_0xecd8('0x5e')]=0x0;this[_0xecd8('0x5f')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xecd8('0x60')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xecd8('0x61')]=0x0;this[_0xecd8('0x62')]=0x0;this[_0xecd8('0x63')]=0x0;this[_0xecd8('0x64')]=0x0;this[_0xecd8('0x65')]=0x0;this[_0xecd8('0x66')]=0x0;this[_0xecd8('0x67')]=0x0;this[_0xecd8('0x68')]=_0x298195[_0xecd8('0x69')]||0x14;this[_0xecd8('0x6a')]=_0x298195['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xecd8('0x6b')]=0x0;this[_0xecd8('0x6c')]=0x0;this[_0xecd8('0x6d')]=0x1;this['erlangCalls']=0x0;this[_0xecd8('0x6e')]=0x0;this[_0xecd8('0x6f')]=0x0;this[_0xecd8('0x70')]=0x0;this[_0xecd8('0x71')]=_0x298195[_0xecd8('0x71')]||0x1e;this[_0xecd8('0x72')]=_0x298195[_0xecd8('0x72')]||![];this[_0xecd8('0x73')]=!!_0x298195[_0xecd8('0x73')]||![];this[_0xecd8('0x74')]=!!_0x298195[_0xecd8('0x74')]||![];this[_0xecd8('0x75')]=_0x298195[_0xecd8('0x75')]||undefined;this[_0xecd8('0x76')]=_0x298195[_0xecd8('0x76')]||![];this['dialAgiAfterHangupAgent']=_0x298195[_0xecd8('0x77')]||![];this[_0xecd8('0xc')]=monitorFormat[_0x298195['monitor_format']]?monitorFormat[_0x298195['monitor_format']]:undefined;this[_0xecd8('0x78')]=_0x298195[_0xecd8('0x78')]||![];this['mandatoryDispositionPause']=_0x298195[_0xecd8('0x79')]?_0x298195[_0xecd8('0x79')]:undefined;}module[_0xecd8('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x69d9=['type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format'];(function(_0x1d0d88,_0x1f8f22){var _0x288d48=function(_0x520dd9){while(--_0x520dd9){_0x1d0d88['push'](_0x1d0d88['shift']());}};_0x288d48(++_0x1f8f22);}(_0x69d9,0xf1));var _0x969d=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x69d9[_0x4d45c1];return _0x244478;};'use strict';var statusDesc=['unknown',_0x969d('0x0'),_0x969d('0x1'),_0x969d('0x2'),_0x969d('0x3'),_0x969d('0x4'),_0x969d('0x5'),_0x969d('0x6'),_0x969d('0x7')];var monitorFormat={'wav':_0x969d('0x8'),'wav49':_0x969d('0x9'),'gsm':_0x969d('0xa')};var strategy={'rrmemory':_0x969d('0xb'),'roundrobin':_0x969d('0xc')};function VoiceQueue(_0x487b4b){this['id']=_0x487b4b['id']||0x0;this[_0x969d('0xd')]=_0x487b4b[_0x969d('0xd')]||'';this[_0x969d('0xe')]=_0x487b4b['monitor_format']||'';this['type']=_0x487b4b[_0x969d('0xf')]||_0x969d('0x10');this[_0x969d('0x11')]=0x0;this[_0x969d('0x12')]=0x0;this[_0x969d('0x13')]=0x0;this[_0x969d('0x14')]=0x0;this[_0x969d('0x15')]=0x0;this[_0x969d('0x16')]=0x0;this[_0x969d('0x17')]=0x0;this[_0x969d('0x18')]=0x0;this['abandoned']=0x0;this[_0x969d('0x19')]=0x0;this[_0x969d('0x1a')]=0x0;this[_0x969d('0x1b')]=_0x487b4b[_0x969d('0x1b')]||![];this[_0x969d('0x1c')]=_0x487b4b[_0x969d('0x1c')]||0xa;this['autopause']=_0x487b4b[_0x969d('0x1d')]||'no';this[_0x969d('0x1e')]=!![];this[_0x969d('0x1f')]='';this[_0x969d('0x20')]=0x0;this[_0x969d('0x21')]=0x0;this[_0x969d('0x22')]=_0x487b4b[_0x969d('0x22')]||null;this[_0x969d('0x23')]=_0x487b4b[_0x969d('0x23')]?_0x487b4b[_0x969d('0x23')]:null;this['dialActive']=_0x487b4b[_0x969d('0x24')];this[_0x969d('0x25')]=_0x487b4b[_0x969d('0x25')]||'progressive';this[_0x969d('0x26')]=_0x487b4b['dialLimitChannel']||0x0;this[_0x969d('0x27')]=_0x487b4b[_0x969d('0x27')]||0x0;this['dialPowerLevel']=_0x487b4b['dialPowerLevel']||0x1;this[_0x969d('0x28')]=_0x487b4b[_0x969d('0x28')]||_0x969d('0x29');this['dialPredictiveOptimizationPercentage']=_0x487b4b[_0x969d('0x2a')]||0.03;this[_0x969d('0x2b')]=_0x487b4b['dialPredictiveInterval']||0x258;this[_0x969d('0x2c')]=_0x487b4b[_0x969d('0x2c')]||'anonymous';this[_0x969d('0x2d')]=_0x487b4b['dialOriginateCallerIdNumber']||_0x969d('0x2e');this['dialOriginateTimeout']=_0x487b4b[_0x969d('0x2f')]||0x1e;this['dialQueueOptions']=_0x487b4b[_0x969d('0x30')]||_0x969d('0x31');this[_0x969d('0x32')]=_0x487b4b[_0x969d('0x32')]||0x3;this[_0x969d('0x33')]=_0x487b4b['dialQueueProject']||undefined;this[_0x969d('0x34')]=_0x487b4b['dialCongestionMaxRetry']||0x3;this[_0x969d('0x35')]=_0x487b4b['dialCongestionRetryFrequency']||0x96;this[_0x969d('0x36')]=_0x487b4b[_0x969d('0x36')]||0x3;this[_0x969d('0x37')]=_0x487b4b[_0x969d('0x37')]||0x96;this[_0x969d('0x38')]=_0x487b4b[_0x969d('0x38')]||0x3;this['dialNoAnswerRetryFrequency']=_0x487b4b[_0x969d('0x39')]||0x96;this[_0x969d('0x3a')]=_0x487b4b[_0x969d('0x3a')]||0x3;this[_0x969d('0x3b')]=_0x487b4b[_0x969d('0x3b')]||0x96;this['dialDropMaxRetry']=_0x487b4b[_0x969d('0x3c')]||0x3;this[_0x969d('0x3d')]=_0x487b4b['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x487b4b[_0x969d('0x3e')]||0x3;this['dialAbandonedRetryFrequency']=_0x487b4b[_0x969d('0x3f')]||0x96;this['dialMachineMaxRetry']=_0x487b4b[_0x969d('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x487b4b[_0x969d('0x41')]||0x96;this['dialAgentRejectMaxRetry']=_0x487b4b[_0x969d('0x42')]||0x3;this[_0x969d('0x43')]=_0x487b4b[_0x969d('0x43')]||0x96;this[_0x969d('0x44')]=_0x487b4b[_0x969d('0x44')]||0x4;this['Trunk']=_0x487b4b[_0x969d('0x45')]?_0x487b4b[_0x969d('0x45')]:undefined;this[_0x969d('0x46')]=_0x487b4b['TrunkBackup']?_0x487b4b[_0x969d('0x46')]:undefined;this[_0x969d('0x47')]=_0x487b4b['dialPrefix']||undefined;this[_0x969d('0x48')]=_0x487b4b[_0x969d('0x48')]?_0x487b4b[_0x969d('0x48')]:undefined;this['dialOrderByScheduledAt']=_0x487b4b[_0x969d('0x49')]||_0x969d('0x4a');this[_0x969d('0x4b')]=_0x487b4b[_0x969d('0x4b')]||undefined;this[_0x969d('0x4c')]=_0x487b4b[_0x969d('0x4c')]||undefined;this[_0x969d('0x4d')]=strategy[_0x487b4b[_0x969d('0x4d')]]||_0x969d('0xb');this[_0x969d('0x4e')]=!![];this['dialAMDActive']=_0x487b4b[_0x969d('0x4f')]||![];this[_0x969d('0x50')]=_0x487b4b['dialAMDInitialSilence'];this[_0x969d('0x51')]=_0x487b4b[_0x969d('0x51')];this[_0x969d('0x52')]=_0x487b4b[_0x969d('0x52')];this[_0x969d('0x53')]=_0x487b4b[_0x969d('0x53')];this[_0x969d('0x54')]=_0x487b4b[_0x969d('0x54')];this[_0x969d('0x55')]=_0x487b4b[_0x969d('0x55')];this[_0x969d('0x56')]=_0x487b4b[_0x969d('0x56')];this[_0x969d('0x57')]=_0x487b4b[_0x969d('0x57')];this[_0x969d('0x58')]=_0x487b4b[_0x969d('0x58')];this[_0x969d('0x59')]=0x0;this[_0x969d('0x5a')]=0x0;this['timeout']=_0x487b4b[_0x969d('0x5b')];this['outboundAnswerCallsDay']=0x0;this[_0x969d('0x5c')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x969d('0x5d')]=0x0;this[_0x969d('0x5e')]=0x0;this[_0x969d('0x5f')]=0x0;this[_0x969d('0x60')]=0x0;this[_0x969d('0x61')]=0x0;this[_0x969d('0x62')]=0x0;this[_0x969d('0x63')]=0x0;this[_0x969d('0x64')]=0x0;this[_0x969d('0x65')]=0x0;this[_0x969d('0x66')]=0x0;this[_0x969d('0x67')]=0x0;this[_0x969d('0x68')]=undefined;this[_0x969d('0x69')]=undefined;this[_0x969d('0x6a')]=undefined;this[_0x969d('0x6b')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x969d('0x6c')]=0x0;this[_0x969d('0x6d')]=0x0;this[_0x969d('0x6e')]=0x0;this[_0x969d('0x6f')]=0x0;this[_0x969d('0x70')]=0x0;this[_0x969d('0x71')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x487b4b['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x969d('0x72')]=_0x487b4b[_0x969d('0x73')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x969d('0x74')]=0x0;this[_0x969d('0x75')]=0x1;this[_0x969d('0x76')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x969d('0x77')]=_0x487b4b[_0x969d('0x77')]||0x1e;this[_0x969d('0x78')]=_0x487b4b[_0x969d('0x78')]||![];this[_0x969d('0x79')]=!!_0x487b4b[_0x969d('0x79')]||![];this[_0x969d('0x7a')]=!!_0x487b4b[_0x969d('0x7a')]||![];this['dialQueueProject2']=_0x487b4b[_0x969d('0x7b')]||undefined;this[_0x969d('0x7c')]=_0x487b4b[_0x969d('0x7c')]||![];this[_0x969d('0x7d')]=_0x487b4b[_0x969d('0x7d')]||![];this['monitor_format']=monitorFormat[_0x487b4b['monitor_format']]?monitorFormat[_0x487b4b[_0x969d('0xe')]]:undefined;this[_0x969d('0x7e')]=_0x487b4b[_0x969d('0x7e')]||![];this[_0x969d('0x7f')]=_0x487b4b[_0x969d('0x7f')]?_0x487b4b['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index daa8498..ccd4823 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 _0xd697=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xd697,0xc0));var _0x7d69=function(_0x1f3f4a,_0x3907ec){_0x1f3f4a=_0x1f3f4a-0x0;var _0x258d0d=_0xd697[_0x1f3f4a];return _0x258d0d;};'use strict';function VtigerAccount(_0x3ad603){this['id']=_0x3ad603['id']||0x0;this['name']=_0x3ad603[_0x7d69('0x0')]||'';this[_0x7d69('0x1')]=_0x3ad603[_0x7d69('0x1')]||'';this[_0x7d69('0x2')]=_0x3ad603[_0x7d69('0x2')]||'';this[_0x7d69('0x3')]=_0x3ad603[_0x7d69('0x3')]||'';this[_0x7d69('0x4')]=_0x3ad603[_0x7d69('0x4')]||'';this[_0x7d69('0x5')]=_0x3ad603[_0x7d69('0x5')]||{};}module[_0x7d69('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb87c=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x250ddf,_0xb8c5f){var _0x1a3c87=function(_0x5e578a){while(--_0x5e578a){_0x250ddf['push'](_0x250ddf['shift']());}};_0x1a3c87(++_0xb8c5f);}(_0xb87c,0x16f));var _0xcb87=function(_0x4a2d77,_0x141781){_0x4a2d77=_0x4a2d77-0x0;var _0x331f5e=_0xb87c[_0x4a2d77];return _0x331f5e;};'use strict';function VtigerAccount(_0x4085cd){this['id']=_0x4085cd['id']||0x0;this[_0xcb87('0x0')]=_0x4085cd[_0xcb87('0x0')]||'';this[_0xcb87('0x1')]=_0x4085cd[_0xcb87('0x1')]||'';this['accessKey']=_0x4085cd[_0xcb87('0x2')]||'';this[_0xcb87('0x3')]=_0x4085cd['remoteUri']||'';this['serverUrl']=_0x4085cd[_0xcb87('0x4')]||'';this[_0xcb87('0x5')]=_0x4085cd['Configurations']||{};}module[_0xcb87('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 72e49a5..0465276 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 _0x180f=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x3dad76,_0x257b71){var _0x4f9353=function(_0x346605){while(--_0x346605){_0x3dad76['push'](_0x3dad76['shift']());}};_0x4f9353(++_0x257b71);}(_0x180f,0xf8));var _0xf180=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x180f[_0x49a57c];return _0x4e0316;};'use strict';function ZendeskAccount(_0x31ce5c){this['id']=_0x31ce5c['id']||0x0;this[_0xf180('0x0')]=_0x31ce5c[_0xf180('0x0')]||'';this['username']=_0x31ce5c[_0xf180('0x1')]||'';this[_0xf180('0x2')]=_0x31ce5c[_0xf180('0x2')]||'';this[_0xf180('0x3')]=_0x31ce5c[_0xf180('0x3')]||'';this[_0xf180('0x4')]=_0x31ce5c['remoteUri']||'';this[_0xf180('0x5')]=_0x31ce5c[_0xf180('0x5')]||'';this[_0xf180('0x6')]=_0x31ce5c['type']||_0xf180('0x7');this[_0xf180('0x8')]=_0x31ce5c[_0xf180('0x8')]||'';this[_0xf180('0x9')]=_0x31ce5c[_0xf180('0x9')]||{};}module[_0xf180('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x7787=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x402040,_0x31ef31){var _0x14deb8=function(_0x2fbb4d){while(--_0x2fbb4d){_0x402040['push'](_0x402040['shift']());}};_0x14deb8(++_0x31ef31);}(_0x7787,0x12b));var _0x7778=function(_0x35da2e,_0x4a3f62){_0x35da2e=_0x35da2e-0x0;var _0x4c0807=_0x7787[_0x35da2e];return _0x4c0807;};'use strict';function ZendeskAccount(_0x4623da){this['id']=_0x4623da['id']||0x0;this[_0x7778('0x0')]=_0x4623da['name']||'';this['username']=_0x4623da['username']||'';this[_0x7778('0x1')]=_0x4623da['password']||'';this[_0x7778('0x2')]=_0x4623da[_0x7778('0x2')]||'';this[_0x7778('0x3')]=_0x4623da[_0x7778('0x3')]||'';this[_0x7778('0x4')]=_0x4623da[_0x7778('0x4')]||'';this[_0x7778('0x5')]=_0x4623da[_0x7778('0x5')]||_0x7778('0x6');this['serverUrl']=_0x4623da[_0x7778('0x7')]||'';this[_0x7778('0x8')]=_0x4623da[_0x7778('0x8')]||{};}module[_0x7778('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 fcfc916..2761699 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 _0x2af2=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x6a3424,_0x2a89a9){var _0x5674d6=function(_0xfd5972){while(--_0xfd5972){_0x6a3424['push'](_0x6a3424['shift']());}};_0x5674d6(++_0x2a89a9);}(_0x2af2,0xab));var _0x22af=function(_0x27c535,_0x7eb57){_0x27c535=_0x27c535-0x0;var _0x57f069=_0x2af2[_0x27c535];return _0x57f069;};'use strict';function ZohoAccount(_0x4c0b97){this['id']=_0x4c0b97['id']||0x0;this[_0x22af('0x0')]=_0x4c0b97[_0x22af('0x0')]||'';this[_0x22af('0x1')]=_0x4c0b97[_0x22af('0x1')]||'';this[_0x22af('0x2')]=_0x4c0b97['host']||'';this[_0x22af('0x3')]=_0x4c0b97[_0x22af('0x3')]||'';this['clientId']=_0x4c0b97[_0x22af('0x4')]||'';this[_0x22af('0x5')]=_0x4c0b97['clientSecret']||'';this[_0x22af('0x6')]=_0x4c0b97[_0x22af('0x6')]||'';this[_0x22af('0x7')]=_0x4c0b97[_0x22af('0x7')]||'';this[_0x22af('0x8')]=_0x4c0b97[_0x22af('0x8')]||'';this['Configurations']=_0x4c0b97[_0x22af('0x9')]||{};}module[_0x22af('0xa')]=ZohoAccount; \ No newline at end of file +var _0x294b=['exports','name','description','host','zone','clientId','clientSecret','code','refreshToken','Configurations'];(function(_0xaded42,_0x20f712){var _0x55c415=function(_0x31af83){while(--_0x31af83){_0xaded42['push'](_0xaded42['shift']());}};_0x55c415(++_0x20f712);}(_0x294b,0xa1));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x181ca6){this['id']=_0x181ca6['id']||0x0;this[_0xb294('0x0')]=_0x181ca6['name']||'';this[_0xb294('0x1')]=_0x181ca6[_0xb294('0x1')]||'';this[_0xb294('0x2')]=_0x181ca6['host']||'';this[_0xb294('0x3')]=_0x181ca6[_0xb294('0x3')]||'';this[_0xb294('0x4')]=_0x181ca6[_0xb294('0x4')]||'';this[_0xb294('0x5')]=_0x181ca6[_0xb294('0x5')]||'';this['serverUrl']=_0x181ca6['serverUrl']||'';this[_0xb294('0x6')]=_0x181ca6[_0xb294('0x6')]||'';this[_0xb294('0x7')]=_0x181ca6[_0xb294('0x7')]||'';this[_0xb294('0x8')]=_0x181ca6[_0xb294('0x8')]||{};}module[_0xb294('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 40f01d1..75e6974 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 _0x3b1c=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','Agent','UserId','VoiceQueueId','originatecalleridname','prototype','calleridname','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','channelAgent','format','SIP/%s','Contact','firstName','lastName','active'];(function(_0x1ab611,_0x711bb7){var _0x3a2a7b=function(_0x13da9f){while(--_0x13da9f){_0x1ab611['push'](_0x1ab611['shift']());}};_0x3a2a7b(++_0x711bb7);}(_0x3b1c,0xbf));var _0xc3b1=function(_0x5bf4f5,_0x591dec){_0x5bf4f5=_0x5bf4f5-0x0;var _0x40ef68=_0x3b1c[_0x5bf4f5];return _0x40ef68;};'use strict';var util=require(_0xc3b1('0x0'));var _=require(_0xc3b1('0x1'));var moment=require(_0xc3b1('0x2'));function checkNameSurname(_0x1e855f,_0x659b8f,_0x4823df){var _0x674e2e='';if(!_[_0xc3b1('0x3')](_0x659b8f)&&_0xc3b1('0x4')===typeof _0x659b8f){_0x674e2e+=_0x659b8f;}if(!_['isNil'](_0x4823df)&&_0xc3b1('0x4')===typeof _0x4823df){_0x674e2e+='\x20'+_0x4823df;}if(_0x674e2e!==''){return _0x674e2e;}return _0x1e855f;}function Action(_0x370758,_0x2602e6,_0x570217,_0x3d3fbb,_0x27177e){this['uniqueid']=_0x570217||undefined;this[_0xc3b1('0x5')]=_0x370758['id'];this[_0xc3b1('0x6')]=_0x2602e6[_0xc3b1('0x7')];this['type']=_0x2602e6[_0xc3b1('0x8')];this[_0xc3b1('0x9')]='queue';this[_0xc3b1('0xa')]=![];this[_0xc3b1('0xb')]=_['isNil'](_0x370758['Agent'])?undefined:_0x370758['Agent'][_0xc3b1('0x7')];this[_0xc3b1('0xc')]=this[_0xc3b1('0xb')]?util[_0xc3b1('0xd')](_0xc3b1('0xe'),this[_0xc3b1('0xb')]):_0x3d3fbb||undefined;this['calleridname']=checkNameSurname(_0x370758[_0xc3b1('0xf')]['phone'],_0x370758[_0xc3b1('0xf')][_0xc3b1('0x10')],_0x370758[_0xc3b1('0xf')][_0xc3b1('0x11')]);this[_0xc3b1('0x12')]=_0x370758['active']||![];this[_0xc3b1('0x13')]=_0x370758[_0xc3b1('0xf')]['phone'];this[_0xc3b1('0x14')]=_0x370758[_0xc3b1('0x14')];this[_0xc3b1('0x15')]=_0x370758[_0xc3b1('0x15')]||0x0;this[_0xc3b1('0x16')]=_0x370758[_0xc3b1('0x16')]||0x0;this['countnoanswerretry']=_0x370758[_0xc3b1('0x17')]||0x0;this[_0xc3b1('0x18')]=(_0x370758[_0xc3b1('0x15')]||0x0)+(_0x370758[_0xc3b1('0x16')]||0x0)+(_0x370758[_0xc3b1('0x17')]||0x0)+(_0x370758[_0xc3b1('0x19')]||0x0)+(_0x370758[_0xc3b1('0x1a')]||0x0)+(_0x370758[_0xc3b1('0x1b')]||0x0)+(_0x370758[_0xc3b1('0x1c')]||0x0)+(_0x370758[_0xc3b1('0x1d')]||0x0);this[_0xc3b1('0x19')]=_0x370758[_0xc3b1('0x19')]||0x0;this[_0xc3b1('0x1a')]=_0x370758[_0xc3b1('0x1a')]||0x0;this[_0xc3b1('0x1b')]=_0x370758[_0xc3b1('0x1b')]||0x0;this[_0xc3b1('0x1c')]=_0x370758['countmachineretry']||0x0;this[_0xc3b1('0x1d')]=_0x370758[_0xc3b1('0x1d')]||0x0;this[_0xc3b1('0x1e')]=_0x370758[_0xc3b1('0x1e')];this['callbackuniqueid']=_0x370758['callbackuniqueid'];this[_0xc3b1('0x1f')]=_0x370758['callbackat'];this[_0xc3b1('0x20')]=_0x370758[_0xc3b1('0x20')];this[_0xc3b1('0x21')]=_0x370758['ContactId'];this[_0xc3b1('0x22')]=_0x370758[_0xc3b1('0x22')];this['UserId']=_[_0xc3b1('0x3')](_0x370758[_0xc3b1('0x23')])?_0x370758[_0xc3b1('0x24')]:_0x370758[_0xc3b1('0x23')]['id'];this[_0xc3b1('0x25')]=_0x370758['VoiceQueueId'];this['originatecalleridnum']='';this[_0xc3b1('0x26')]='';}Action[_0xc3b1('0x27')]['getCaller']=function(){return util[_0xc3b1('0xd')]('\x22%s\x22\x20<%s>',this[_0xc3b1('0x28')],this['number']);};module[_0xc3b1('0x29')]=Action; \ No newline at end of file +var _0xa09b=['dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','active','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','queue','name','type','campaigntype'];(function(_0x4a9956,_0x407cd2){var _0x419f79=function(_0x1d0fba){while(--_0x1d0fba){_0x4a9956['push'](_0x4a9956['shift']());}};_0x419f79(++_0x407cd2);}(_0xa09b,0x160));var _0xba09=function(_0x57af6d,_0x19da59){_0x57af6d=_0x57af6d-0x0;var _0x1ae783=_0xa09b[_0x57af6d];return _0x1ae783;};'use strict';var util=require(_0xba09('0x0'));var _=require(_0xba09('0x1'));var moment=require('moment');function checkNameSurname(_0x3c0af6,_0x56253b,_0x6f0422){var _0x2db136='';if(!_[_0xba09('0x2')](_0x56253b)&&'string'===typeof _0x56253b){_0x2db136+=_0x56253b;}if(!_[_0xba09('0x2')](_0x6f0422)&&_0xba09('0x3')===typeof _0x6f0422){_0x2db136+='\x20'+_0x6f0422;}if(_0x2db136!==''){return _0x2db136;}return _0x3c0af6;}function Action(_0x456108,_0x367462,_0xea9a0f,_0x210f1a,_0x36fbc2){this['uniqueid']=_0xea9a0f||undefined;this['idContact']=_0x456108['id'];this[_0xba09('0x4')]=_0x367462[_0xba09('0x5')];this[_0xba09('0x6')]=_0x367462[_0xba09('0x6')];this[_0xba09('0x7')]=_0xba09('0x4');this[_0xba09('0x8')]=![];this[_0xba09('0x9')]=_[_0xba09('0x2')](_0x456108[_0xba09('0xa')])?undefined:_0x456108['Agent']['name'];this['channelAgent']=this[_0xba09('0x9')]?util[_0xba09('0xb')](_0xba09('0xc'),this[_0xba09('0x9')]):_0x210f1a||undefined;this[_0xba09('0xd')]=checkNameSurname(_0x456108[_0xba09('0xe')][_0xba09('0xf')],_0x456108['Contact'][_0xba09('0x10')],_0x456108[_0xba09('0xe')]['lastName']);this[_0xba09('0x11')]=_0x456108[_0xba09('0x11')]||![];this['calleridnum']=_0x456108['Contact'][_0xba09('0xf')];this[_0xba09('0x12')]=_0x456108[_0xba09('0x12')];this['countbusyretry']=_0x456108['countbusyretry']||0x0;this['countcongestionretry']=_0x456108[_0xba09('0x13')]||0x0;this[_0xba09('0x14')]=_0x456108[_0xba09('0x14')]||0x0;this[_0xba09('0x15')]=(_0x456108[_0xba09('0x16')]||0x0)+(_0x456108['countcongestionretry']||0x0)+(_0x456108['countnoanswerretry']||0x0)+(_0x456108['countnosuchnumberretry']||0x0)+(_0x456108[_0xba09('0x17')]||0x0)+(_0x456108[_0xba09('0x18')]||0x0)+(_0x456108[_0xba09('0x19')]||0x0)+(_0x456108['countagentrejectretry']||0x0);this[_0xba09('0x1a')]=_0x456108[_0xba09('0x1a')]||0x0;this[_0xba09('0x17')]=_0x456108[_0xba09('0x17')]||0x0;this[_0xba09('0x18')]=_0x456108[_0xba09('0x18')]||0x0;this['countmachineretry']=_0x456108['countmachineretry']||0x0;this[_0xba09('0x1b')]=_0x456108[_0xba09('0x1b')]||0x0;this[_0xba09('0x1c')]=_0x456108[_0xba09('0x1c')];this[_0xba09('0x1d')]=_0x456108[_0xba09('0x1d')];this['callbackat']=_0x456108[_0xba09('0x1e')];this['recallme']=_0x456108['recallme'];this[_0xba09('0x1f')]=_0x456108[_0xba09('0x1f')];this[_0xba09('0x20')]=_0x456108['ListId'];this['UserId']=_['isNil'](_0x456108[_0xba09('0xa')])?_0x456108[_0xba09('0x21')]:_0x456108[_0xba09('0xa')]['id'];this['VoiceQueueId']=_0x456108['VoiceQueueId'];this['originatecalleridnum']='';this[_0xba09('0x22')]='';}Action[_0xba09('0x23')][_0xba09('0x24')]=function(){return util[_0xba09('0xb')](_0xba09('0x25'),this[_0xba09('0xd')],this[_0xba09('0x26')]);};module[_0xba09('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 962b293..113dea3 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 _0xcd59=['./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','format','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','unlockAgent','activeContact','linkedid','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','pick','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','extractCalleridNumber','merge','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami'];(function(_0x6009c5,_0x5d9b32){var _0x1c2a4b=function(_0x1258c4){while(--_0x1258c4){_0x6009c5['push'](_0x6009c5['shift']());}};_0x1c2a4b(++_0x5d9b32);}(_0xcd59,0x14b));var _0x9cd5=function(_0x3253f3,_0x1c57d8){_0x3253f3=_0x3253f3-0x0;var _0x598c26=_0xcd59[_0x3253f3];return _0x598c26;};'use strict';var util=require(_0x9cd5('0x0'));var _=require(_0x9cd5('0x1'));var BPromise=require(_0x9cd5('0x2'));var uuid=require(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var md5=require(_0x9cd5('0x5'));var Redis=require('ioredis');var config=require(_0x9cd5('0x6'));var logger=require(_0x9cd5('0x7'))(_0x9cd5('0x8'));var loggerAction=require(_0x9cd5('0x7'))(_0x9cd5('0x9'));var ami=require(_0x9cd5('0xa'));var rpcDb=require(_0x9cd5('0xb'));var Action=require(_0x9cd5('0xc'));var ut=require(_0x9cd5('0xd'));config[_0x9cd5('0xe')]=_['defaults'](config[_0x9cd5('0xe')],{'host':_0x9cd5('0xf'),'port':0x18eb});var io=require(_0x9cd5('0x10'))(new Redis(config[_0x9cd5('0xe')]));var Sequence=function(){};Sequence[_0x9cd5('0x11')][_0x9cd5('0x12')]=function(_0x46bbca){this[_0x9cd5('0x13')]=this['tail']?this[_0x9cd5('0x13')][_0x9cd5('0x14')](_0x46bbca):_0x46bbca();};function Preview(_0x3fefe6){this[_0x9cd5('0x15')]=new Sequence();this['campaignsPreview']=_0x3fefe6['voiceQueues'];this[_0x9cd5('0x16')]=_0x3fefe6[_0x9cd5('0x16')];this[_0x9cd5('0x17')]={};this[_0x9cd5('0x18')]=_0x3fefe6[_0x9cd5('0x18')];this[_0x9cd5('0x19')]=0x0;ami['on']('originateresponse',this[_0x9cd5('0x1a')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x1c'),this['syncHangup']['bind'](this));ami['on']('hanguprequest',this[_0x9cd5('0x1d')][_0x9cd5('0x1b')](this));ami['on']('dialend',this[_0x9cd5('0x1e')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x1f'),this['syncNewExten'][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x20'),this[_0x9cd5('0x21')][_0x9cd5('0x1b')](this));ami['on'](_0x9cd5('0x22'),this[_0x9cd5('0x23')]['bind'](this));ami['on'](_0x9cd5('0x24'),this[_0x9cd5('0x25')][_0x9cd5('0x1b')](this));this[_0x9cd5('0x26')](this[_0x9cd5('0x27')]);}function emit(_0x4ed8b9,_0x16c4e9,_0x271444){io['to'](_0x4ed8b9)[_0x9cd5('0x28')](_0x16c4e9,_0x271444);}function emitCampaignPreview(_0x12e402){if(_0x12e402[_0x9cd5('0x29')]===_0x9cd5('0x2a')){var _0x1cf603={'id':_0x12e402['id'],'name':_0x12e402[_0x9cd5('0x2b')],'strategy':_0x12e402[_0x9cd5('0x2c')],'answered':_0x12e402['answered'],'available':_0x12e402[_0x9cd5('0x2d')],'loggedIn':_0x12e402[_0x9cd5('0x2e')],'pTalking':_0x12e402[_0x9cd5('0x2f')],'sumBillable':_0x12e402[_0x9cd5('0x30')],'sumDuration':_0x12e402['sumDuration'],'sumHoldTime':_0x12e402[_0x9cd5('0x31')]||0x0,'talking':_0x12e402[_0x9cd5('0x32')],'total':_0x12e402[_0x9cd5('0x33')],'type':_0x12e402[_0x9cd5('0x29')],'unmanaged':_0x12e402[_0x9cd5('0x34')],'abandoned':_0x12e402[_0x9cd5('0x35')],'waiting':_0x12e402[_0x9cd5('0x36')],'loggedInDb':_0x12e402['loggedInDb'],'dialActive':_0x12e402[_0x9cd5('0x37')],'dialMethod':_0x12e402[_0x9cd5('0x38')],'dialOriginateCallerIdName':_0x12e402[_0x9cd5('0x39')],'dialOriginateCallerIdNumber':_0x12e402['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x12e402['dialOriginateTimeout'],'dialPrefix':_0x12e402[_0x9cd5('0x3a')],'outboundAnswerAgiCallsDay':_0x12e402['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x12e402['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x12e402[_0x9cd5('0x3b')],'outboundBusyCallsDay':_0x12e402[_0x9cd5('0x3c')],'outboundCongestionCallsDay':_0x12e402[_0x9cd5('0x3d')],'outboundDropCallsDayACS':_0x12e402['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x12e402[_0x9cd5('0x3e')],'outboundDropCallsDayTimeout':_0x12e402[_0x9cd5('0x3f')],'outboundNoAnswerCallsDay':_0x12e402[_0x9cd5('0x40')],'outboundNoSuchCallsDay':_0x12e402[_0x9cd5('0x41')],'outboundOriginateFailureCallsDay':_0x12e402[_0x9cd5('0x42')],'outboundReCallsDay':_0x12e402[_0x9cd5('0x43')],'outboundRejectCallsDay':_0x12e402[_0x9cd5('0x44')],'outboundUnknownCallsDay':_0x12e402[_0x9cd5('0x45')],'outboundAbandonedCallsDay':_0x12e402[_0x9cd5('0x46')],'predictiveIntervalAnsweredCalls':_0x12e402[_0x9cd5('0x47')],'predictiveIntervalAvgHoldtime':_0x12e402[_0x9cd5('0x48')],'predictiveIntervalAvgTalktime':_0x12e402[_0x9cd5('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x12e402[_0x9cd5('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x12e402[_0x9cd5('0x4b')],'predictiveIntervalErlangCalls':_0x12e402['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x12e402[_0x9cd5('0x4c')],'predictiveIntervalHitRate':_0x12e402[_0x9cd5('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x12e402['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x12e402['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x12e402[_0x9cd5('0x4e')],'predictiveIntervalTotalCalls':_0x12e402[_0x9cd5('0x4f')],'message':_0x12e402['message'],'originated':_0x12e402[_0x9cd5('0x50')],'erlangCalls':_0x12e402['erlangCalls'],'erlangCallToSecond':_0x12e402['erlangCallToSecond'],'erlangAbandonmentRate':_0x12e402[_0x9cd5('0x51')],'erlangBusyFactor':_0x12e402[_0x9cd5('0x52')],'startPredictive':_0x12e402[_0x9cd5('0x53')],'startProgressive':_0x12e402[_0x9cd5('0x54')]};if(_0x12e402['Trunk']){_0x1cf603[_0x9cd5('0x55')]={'id':_0x12e402[_0x9cd5('0x55')]['id'],'name':_0x12e402[_0x9cd5('0x55')]['name'],'active':_0x12e402[_0x9cd5('0x55')][_0x9cd5('0x56')],'callerid':_0x12e402[_0x9cd5('0x55')][_0x9cd5('0x57')]};}if(_0x12e402[_0x9cd5('0x58')]){_0x1cf603[_0x9cd5('0x58')]={'id':_0x12e402[_0x9cd5('0x58')]['id'],'name':_0x12e402[_0x9cd5('0x58')][_0x9cd5('0x2b')]};}var _0x1ed01d=md5(JSON[_0x9cd5('0x59')](_0x1cf603));if(_0x12e402['md5']!==_0x1ed01d){_0x12e402[_0x9cd5('0x5')]=_0x1ed01d;emit(util['format']('voice:queue:%s',_0x1cf603[_0x9cd5('0x2b')]),_0x9cd5('0x5a'),_0x1cf603);}}}function emitVoiceQueueChannelRemove(_0x46b974){logger[_0x9cd5('0x5b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x9cd5('0x59')](_0x46b974));emit(util[_0x9cd5('0x5c')](_0x9cd5('0x5d'),_0x46b974[_0x9cd5('0x2b')]),'voice_queue_channel:remove',_0x46b974);io[_0x9cd5('0x28')](_0x9cd5('0x5e'),_0x46b974);}function notSendMessagesQueue(_0x1324a2){if(_0x1324a2[_0x9cd5('0x5f')]){if(_0x1324a2[_0x9cd5('0x50')]===0x0&&_0x1324a2[_0x9cd5('0x2f')]===0x0){_0x1324a2['sendMessageOneNotActive']=![];_0x1324a2[_0x9cd5('0x2d')]=0x0;_0x1324a2[_0x9cd5('0x60')]=0x0;_0x1324a2[_0x9cd5('0x61')]=_0x9cd5('0x62');ut[_0x9cd5('0x63')](_0x9cd5('0x64'),_0x1324a2[_0x9cd5('0x2b')]+_0x9cd5('0x65'));}else{_0x1324a2[_0x9cd5('0x61')]=_0x9cd5('0x66');ut[_0x9cd5('0x63')](_0x9cd5('0x64'),_0x1324a2[_0x9cd5('0x2b')]+_0x9cd5('0x67'));}emitCampaignPreview(_0x1324a2);}}Preview[_0x9cd5('0x11')][_0x9cd5('0x26')]=function(){var _0xd94baf=this;setInterval(function(){_0xd94baf[_0x9cd5('0x68')]();},0x7cf);};Preview['prototype'][_0x9cd5('0x68')]=function(){var _0x58ae2e=this[_0x9cd5('0x27')];this[_0x9cd5('0x19')]+=0x1;for(var _0xaa50a in _0x58ae2e){if(_0x58ae2e[_0x9cd5('0x69')](_0xaa50a)&&(_0x58ae2e[_0xaa50a][_0x9cd5('0x38')]==='preview'||_0x58ae2e[_0xaa50a][_0x9cd5('0x38')]===_0x9cd5('0x6a'))&&_0x58ae2e[_0xaa50a][_0x9cd5('0x29')]==='outbound'){if(this[_0x9cd5('0x19')]>0x7){this[_0x9cd5('0x19')]=0x0;this[_0x9cd5('0x6b')]();}}if(_0x58ae2e[_0x9cd5('0x69')](_0xaa50a)&&_0x58ae2e[_0xaa50a]['dialMethod']===_0x9cd5('0x8')&&_0x58ae2e[_0xaa50a][_0x9cd5('0x29')]===_0x9cd5('0x2a')){if(_0x58ae2e[_0xaa50a][_0x9cd5('0x37')]){this[_0x9cd5('0x6c')](_0x58ae2e[_0xaa50a]);if(_0x58ae2e[_0xaa50a][_0x9cd5('0x6d')])this[_0x9cd5('0x6e')](_0x58ae2e[_0xaa50a]);}else{notSendMessagesQueue(_0x58ae2e[_0xaa50a]);}}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x6f')]=function(_0x200d64){var _0x3962c2=this;this[_0x9cd5('0x15')][_0x9cd5('0x12')](function(){if(!_[_0x9cd5('0x70')](_0x3962c2[_0x9cd5('0x17')][_0x200d64])){loggerAction[_0x9cd5('0x5b')](_0x9cd5('0x71'),_0x200d64,_0x9cd5('0x72'),_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')],_0x9cd5('0x74'),JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')]][_0x9cd5('0x50')]),'pTalking:\x20',JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]][_0x9cd5('0x2f')]),JSON[_0x9cd5('0x59')](_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x75')]),JSON['stringify'](_['pick'](_0x3962c2[_0x9cd5('0x17')][_0x200d64],[_0x9cd5('0x76'),_0x9cd5('0x77'),_0x9cd5('0x78'),'ListId'])));return ami[_0x9cd5('0x79')]({'action':'status','channel':_0x3962c2['actions'][_0x200d64][_0x9cd5('0x7a')]})[_0x9cd5('0x7b')](function(_0x34c5eb){if(_0x34c5eb['message']===_0x9cd5('0x7c')){setTimeout(function(){if(_0x3962c2[_0x9cd5('0x17')][_0x200d64]){ut[_0x9cd5('0x7d')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]],'[clearZombieChannel]');if(_0x3962c2['actions'][_0x200d64][_0x9cd5('0x75')]===!![]){ut[_0x9cd5('0x7e')](_0x3962c2[_0x9cd5('0x27')][_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]],'[clearZombieChannel]');ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x200d64,_0x3962c2['actions'][_0x200d64][_0x9cd5('0x73')]);}ut[_0x9cd5('0x7f')](_0x9cd5('0x80')+_0x200d64,_0x3962c2[_0x9cd5('0x17')][_0x200d64][_0x9cd5('0x73')]);delete _0x3962c2[_0x9cd5('0x17')][_0x200d64];}},0x2328);}});}});};Preview[_0x9cd5('0x11')][_0x9cd5('0x6b')]=function(){var _0x1249a7=this;loggerAction[_0x9cd5('0x5b')](_0x9cd5('0x81'),_[_0x9cd5('0x82')](this[_0x9cd5('0x17')]));for(var _0x3a15af in this['actions']){if(_0x1249a7[_0x9cd5('0x17')][_0x9cd5('0x69')](_0x3a15af)){_0x1249a7['clearZombieChannel'](_0x3a15af);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x6e')]=function(_0xf73845){var _0x1c1812=this;rpcDb[_0x9cd5('0x83')](_0xf73845['id'],ut[_0x9cd5('0x84')](this[_0x9cd5('0x18')]))['then'](function(_0x538ffa){if(!_[_0x9cd5('0x70')](_0x538ffa)){for(var _0x472456=0x0;_0x472456<_0x538ffa[_0x9cd5('0x85')];_0x472456+=0x1){if(ut[_0x9cd5('0x86')](_0x538ffa[_0x472456][_0x9cd5('0x87')])<_0xf73845[_0x9cd5('0x88')]*0x3c){if(_0x538ffa[_0x472456][_0x9cd5('0x89')]&&!_0x538ffa[_0x472456][_0x9cd5('0x89')][_0x9cd5('0x8a')]){_0x1c1812[_0x9cd5('0x8b')](_0x538ffa[_0x472456]['id'])[_0x9cd5('0x8c')](ut[_0x9cd5('0x8d')](_0x9cd5('0x8e')))[_0x9cd5('0x7b')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x9cd5('0x8f')](_0x538ffa[_0x472456]['id']);}}else{var _0x94de58=new Action(_0x538ffa[_0x472456],_0xf73845);_0x94de58[_0x9cd5('0x90')]=moment()['format'](_0x9cd5('0x91'));_0xf73845['outboundReCallsDay']+=0x1;ut[_0x9cd5('0x92')](_0x94de58,0x17,_0x9cd5('0x93'));if(_0xf73845[_0x9cd5('0x94')]){rpcDb['rescheduleContactInQueue'](ut[_0x9cd5('0x95')](_0x538ffa[_0x472456]));rpcDb[_0x9cd5('0x96')](_0x94de58,_0x9cd5('0x97'));}else{ut[_0x9cd5('0x92')](_0x94de58,0x16,_0x9cd5('0x98'));rpcDb['createCustomerHistory'](_0x94de58,_0x9cd5('0x99'));rpcDb['createCustomerFinal'](_0x94de58,_0x9cd5('0x99'));}}}}})['catch'](ut[_0x9cd5('0x8d')](_0x9cd5('0x9a')));};Preview[_0x9cd5('0x11')][_0x9cd5('0x6c')]=function(_0x50c6fb){_0x50c6fb[_0x9cd5('0x5f')]=!![];if(ut[_0x9cd5('0x9b')](_0x50c6fb[_0x9cd5('0x2e')])){_0x50c6fb[_0x9cd5('0x61')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x9cd5('0x9c')](_0x50c6fb[_0x9cd5('0x37')])){_0x50c6fb['message']=_0x9cd5('0x62');}else if(!this[_0x9cd5('0x9d')](_0x50c6fb[_0x9cd5('0x55')])){if(!this[_0x9cd5('0x9d')](_0x50c6fb[_0x9cd5('0x9e')])){_0x50c6fb['message']=_0x9cd5('0x9f');}else{_0x50c6fb[_0x9cd5('0x61')]=_0x9cd5('0xa0');}}else{_0x50c6fb[_0x9cd5('0x61')]=_0x9cd5('0xa0');}emitCampaignPreview(_0x50c6fb);};Preview[_0x9cd5('0x11')][_0x9cd5('0xa1')]=function(_0x35120d,_0x1b037f,_0x5d0599){var _0x1b00d4=this;var _0x3b715e=this['actions'][_0x1b037f];var _0x4baea3=this[_0x9cd5('0x27')][_0x3b715e[_0x9cd5('0x73')]];var _0x594544;if(_0x4baea3){switch(_0x5d0599){case'1':_0x4baea3['outboundNoSuchCallsDay']+=0x1;_0x3b715e[_0x9cd5('0xa2')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x0,'NoSuchNumber');ami['emit'](_0x9cd5('0xa5'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xa7')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xa8'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xac'));}else{if(_0x3b715e['countnosuchnumberretry']>=_0x4baea3[_0x9cd5('0xad')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xac'));}else{rpcDb[_0x9cd5('0xaf')](ut['scheduledAt'](_0x3b715e,_0x9cd5('0xa2'),_0x4baea3['dialNoSuchNumberRetryFrequency']),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}delete this[_0x9cd5('0x17')][_0x35120d[_0x9cd5('0xb2')]];break;case'ANSWER':var _0x3c7cc4=moment()[_0x9cd5('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b715e[_0x9cd5('0xb3')]=_0x3c7cc4;_0x3b715e['answertime']=_0x3c7cc4;_0x3b715e[_0x9cd5('0x75')]=!![];_0x4baea3['pTalking']+=0x1;logger['info'](_0x9cd5('0xb4'),_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x4baea3[_0x9cd5('0x2f')]);ami['emit'](_0x9cd5('0xb8'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xb9'),this['campaignsPreview'][_0x3b715e['queue']]));if(_0x4baea3[_0x9cd5('0xba')]){ami[_0x9cd5('0x28')](_0x9cd5('0xbb'),ut[_0x9cd5('0xbc')](_0x3b715e));}break;case'16':ami[_0x9cd5('0x28')](_0x9cd5('0xbd'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xbe'),this[_0x9cd5('0x27')][_0x3b715e[_0x9cd5('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3b715e,_0x9cd5('0xbe')));_0x4baea3['outboundAnswerCallsDay']+=0x1;_0x4baea3[_0x9cd5('0x33')]+=0x1;_0x4baea3[_0x9cd5('0xbf')]+=0x1;ut[_0x9cd5('0x7e')](_0x4baea3,'[16]');_0x3b715e[_0x9cd5('0xa3')]=ut['totalGlobal'](_0x3b715e);ut['logCustomer'](_0x3b715e,0x4,_0x9cd5('0xc0'));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xc1'));rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xc2'));rpcDb[_0x9cd5('0xc3')](_0x3b715e);_0x4baea3['sumDuration']+=_0x3b715e[_0x9cd5('0xc4')];_0x4baea3[_0x9cd5('0x30')]+=_0x3b715e[_0x9cd5('0xc4')];logger[_0x9cd5('0x5b')]('[syncHangup][talking][decrement]',_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x4baea3[_0x9cd5('0x2f')]);delete this['actions'][_0x35120d[_0x9cd5('0xb2')]];break;case _0x9cd5('0xc5'):_0x4baea3[_0x9cd5('0x3c')]+=0x1;_0x3b715e[_0x9cd5('0xc6')]+=0x1;_0x3b715e['countglobal']=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x5,_0x9cd5('0xc7'));ami[_0x9cd5('0x28')](_0x9cd5('0xc8'),ut[_0x9cd5('0xa6')](_0x3b715e,'busy'));rpcDb[_0x9cd5('0x96')](_0x3b715e,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3b715e[_0x9cd5('0xc6')]>=_0x4baea3['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x3b715e,_0x9cd5('0xc9'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,'countbusyretry',_0x4baea3[_0x9cd5('0xcb')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xcc'):_0x4baea3[_0x9cd5('0x40')]+=0x1;_0x3b715e['countnoanswerretry']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x3,_0x9cd5('0xcd'));ami['emit'](_0x9cd5('0xce'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xcf')));rpcDb['createCustomerHistory'](_0x3b715e,_0x9cd5('0xd0'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xd1'));}else{if(_0x3b715e['countnoanswerretry']>=_0x4baea3[_0x9cd5('0xd2')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0x9cd5('0xca')](_0x3b715e,'countnoanswerretry',_0x4baea3[_0x9cd5('0xd3')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xd4'):_0x4baea3['outboundCongestionCallsDay']+=0x1;_0x3b715e['countcongestionretry']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x8,_0x9cd5('0xd5'));ami[_0x9cd5('0x28')]('custom:agentcongestion',ut['buildObj'](_0x3b715e,_0x9cd5('0xd6')));rpcDb['createCustomerHistory'](_0x3b715e,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,'Global');rpcDb[_0x9cd5('0xae')](_0x594544,_0x9cd5('0xd7'));}else{if(_0x3b715e[_0x9cd5('0xd8')]>=_0x4baea3[_0x9cd5('0xd9')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xda'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,_0x9cd5('0xd8'),_0x4baea3[_0x9cd5('0xcb')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xdb'):_0x4baea3[_0x9cd5('0x44')]+=0x1;_0x3b715e[_0x9cd5('0xdc')]+=0x1;_0x3b715e['countglobal']=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x14,'AgentReject');ami[_0x9cd5('0x28')](_0x9cd5('0xdd'),ut[_0x9cd5('0xa6')](_0x3b715e,_0x9cd5('0xde')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xdf'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x594544,_0x9cd5('0xe0'));}else{if(_0x3b715e[_0x9cd5('0xdc')]>=_0x4baea3[_0x9cd5('0xe1')]){rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xe0'));}else{rpcDb[_0x9cd5('0xaf')](ut['scheduledAt'](_0x3b715e,_0x9cd5('0xdc'),_0x4baea3[_0x9cd5('0xe2')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case _0x9cd5('0xe3'):_0x4baea3[_0x9cd5('0x46')]+=0x1;_0x3b715e[_0x9cd5('0xe4')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut['totalGlobal'](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0xb,_0x9cd5('0xe5'));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xe6'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb['createCustomerFinal'](_0x594544,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3b715e[_0x9cd5('0xe7')]>=_0x4baea3[_0x9cd5('0xe8')]){rpcDb['createCustomerFinal'](_0x3b715e,_0x9cd5('0xe6'));}else{rpcDb[_0x9cd5('0xaf')](ut[_0x9cd5('0xca')](_0x3b715e,_0x9cd5('0xe4'),_0x4baea3[_0x9cd5('0xe9')]),_0x3b715e[_0x9cd5('0xb0')],_0x3b715e[_0x9cd5('0xb1')]);}}break;case'18':_0x4baea3[_0x9cd5('0x45')]+=0x1;_0x3b715e[_0x9cd5('0xea')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0x12,_0x35120d['cause-txt']||_0x35120d['dialstatus']);ami[_0x9cd5('0x28')](_0x9cd5('0xeb'),ut['buildObj'](_0x3b715e,_0x9cd5('0xec')));rpcDb['createCustomerHistory'](_0x3b715e,_0x9cd5('0xed'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3['dialGlobalMaxRetry']){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,_0x9cd5('0xed'));}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x9cd5('0x17')][_0x35120d['linkedid']];break;case'19':_0x4baea3[_0x9cd5('0x45')]+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut['logCustomer'](_0x3b715e,0x13,_0x35120d['cause-txt']||_0x35120d[_0x9cd5('0xee')]);ami[_0x9cd5('0x28')](_0x9cd5('0xeb'),ut['buildObj'](_0x3b715e,_0x9cd5('0xec')));rpcDb[_0x9cd5('0x96')](_0x3b715e,_0x9cd5('0xef'));if(ut[_0x9cd5('0xa4')](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut[_0x9cd5('0xaa')](_0x3b715e,0xf,'Global');rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,_0x9cd5('0xef'));}delete this[_0x9cd5('0x17')][_0x35120d['linkedid']];break;default:if(_0x3b715e['dialAnswer']){ut[_0x9cd5('0x7e')](_0x4baea3,_0x9cd5('0xf0'));ut['loggerError'](_0x9cd5('0xf1')+_0x4baea3[_0x9cd5('0x2b')],_0x35120d);}_0x4baea3['outboundUnknownCallsDay']+=0x1;_0x3b715e[_0x9cd5('0xa3')]=ut[_0x9cd5('0xa4')](_0x3b715e);ut[_0x9cd5('0x92')](_0x3b715e,0xc,_0x35120d[_0x9cd5('0xf2')]||_0x35120d['dialstatus']);rpcDb[_0x9cd5('0x96')](_0x3b715e,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x3b715e)>=_0x4baea3[_0x9cd5('0xa9')]){_0x594544=ut['cloneAction'](_0x3b715e,0xf,_0x9cd5('0xab'));rpcDb[_0x9cd5('0xae')](_0x594544,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x9cd5('0xae')](_0x3b715e,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x9cd5('0x17')][_0x35120d[_0x9cd5('0xb2')]];}if(!(_0x3b715e[_0x9cd5('0x75')]&&_0x5d0599==='16')){ut['updateOriginated'](_0x4baea3,_0x9cd5('0xf3'));logger[_0x9cd5('0x5b')]('[originated][decrement][callProgressDetectingCustomer]',_0x3b715e[_0x9cd5('0xb5')],_0x9cd5('0xb6'),_0x4baea3[_0x9cd5('0x2b')],'originated:\x20',_0x4baea3['originated']);}if(_0x5d0599!==_0x9cd5('0xf4')){delete this['actions'][_0x35120d['linkedid']];delete this[_0x9cd5('0x17')][_0x35120d['destlinkedid']];}}};Preview[_0x9cd5('0x11')][_0x9cd5('0xf5')]=function(_0x5e8757,_0x58fc27,_0x4b2713){if(_[_0x9cd5('0xf6')](_0x58fc27)&&_0x9cd5('0xf7')!==typeof _0x58fc27){return;}if(_['isUndefined'](_0x4b2713)&&_0x9cd5('0xf7')!==typeof _0x4b2713){return;}switch(_0x4b2713[_0x9cd5('0xf8')]){case'0':ut[_0x9cd5('0xf9')](_0x5e8757,0x0,_0x9cd5('0xfa'));rpcDb[_0x9cd5('0xfb')](_0x5e8757,_0x9cd5('0xfc'));break;case'3':ut['logAgent'](_0x5e8757,0x3,'NoAnswer');rpcDb[_0x9cd5('0xfb')](_0x5e8757,_0x9cd5('0xfd'));break;case'5':ut['logAgent'](_0x5e8757,0x5,_0x9cd5('0xc7'));rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x9cd5('0xf9')](_0x5e8757,0x8,'Congestion');rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x5e8757,0x16,_0x9cd5('0xfe'));rpcDb['createAgentHistory'](_0x5e8757,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x5e8757,0xc,_0x4b2713['reason']);rpcDb[_0x9cd5('0xfb')](_0x5e8757,'[callProgressDetectingAgent][logCongestion]');}ut[_0x9cd5('0x7d')](_0x58fc27,_0x9cd5('0xff'));logger[_0x9cd5('0x5b')](_0x9cd5('0x100'),_0x5e8757['uniqueid'],_0x9cd5('0xb6'),_0x58fc27['name'],_0x9cd5('0x74'),_0x58fc27[_0x9cd5('0x50')]);delete this[_0x9cd5('0x17')][_0x5e8757[_0x9cd5('0xb5')]];};Preview['prototype'][_0x9cd5('0x101')]=function(_0x12db08,_0x352f5c,_0x1545c3,_0x1f35d5,_0x265077){var _0xd813e=this;return new BPromise(function(_0x4bbae2,_0x504ae9){if(_[_0x9cd5('0x70')](_0x352f5c)||_['isNil'](_0x352f5c[_0x9cd5('0x102')])||_[_0x9cd5('0x70')](_0x352f5c['Contact']['phone'])||_[_0x9cd5('0x70')](_0x352f5c['VoiceQueueId'])){_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x103'),_0x1f35d5,_0x265077));return;}var _0x54566d=uuid['v4']();var _0x373644=_0xd813e[_0x9cd5('0x27')][_0x352f5c[_0x9cd5('0x72')][_0x9cd5('0x2b')]];var _0xaba61a=_0x1545c3?_0xd813e[_0x9cd5('0x18')][_0x1545c3]['id']:undefined;_0xd813e[_0x9cd5('0x17')][_0x54566d]=new Action(_0x352f5c,_0x373644,_0x54566d,_0x1545c3,_0xaba61a);var _0x491ed8=_0xd813e[_0x9cd5('0x17')][_0x54566d];_0x491ed8[_0x9cd5('0xb0')]=_0x1f35d5;_0x491ed8['activeContact']=_0x265077;_0x491ed8[_0x9cd5('0x104')]=_0x1545c3;if(_[_0x9cd5('0x105')](_0x12db08)){_0xd813e[_0x9cd5('0x106')](_0x491ed8,_0x373644,_0x352f5c,_0x1545c3)[_0x9cd5('0x8c')](function(_0x36050e){logger[_0x9cd5('0x5b')](_0x9cd5('0x107'),_0x9cd5('0x108')+_0x491ed8[_0x9cd5('0x73')]+'\x20IdHopper:\x20'+_0x491ed8['idContact'],JSON[_0x9cd5('0x59')](_0x36050e));ami[_0x9cd5('0x28')](_0x9cd5('0x109'),ut[_0x9cd5('0xa6')](_0x491ed8,_0x9cd5('0x10a'),_0xd813e[_0x9cd5('0x27')][_0x491ed8[_0x9cd5('0x73')]]));_0x4bbae2(ut[_0x9cd5('0x61')]('Calling'));})[_0x9cd5('0x7b')](function(_0x23cab8){ut[_0x9cd5('0x63')](_0x9cd5('0x10b'),_0x23cab8);_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x10c'),_0x1f35d5,_0x265077));});}else{_0x373644[_0x9cd5('0x3b')]+=0x1;ut[_0x9cd5('0x10d')](_0x491ed8);rpcDb[_0x9cd5('0x10e')](_0x491ed8,_0x9cd5('0x10f'));delete _0xd813e[_0x9cd5('0x17')][_0x54566d];_0x504ae9(ut[_0x9cd5('0x61')](_0x9cd5('0x110'),_0x1f35d5,_0x265077));}});};Preview[_0x9cd5('0x11')][_0x9cd5('0x9d')]=function(_0x56c8a7){return!_[_0x9cd5('0x70')](_0x56c8a7)&&!_[_0x9cd5('0x70')](_0x56c8a7[_0x9cd5('0x2b')])&&!_[_0x9cd5('0x70')](_0x56c8a7[_0x9cd5('0x56')])&&_0x56c8a7['active']&&!_['isNil'](this[_0x9cd5('0x16')][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7[_0x9cd5('0x2b')])])&&!_[_0x9cd5('0x70')](this[_0x9cd5('0x16')][util['format'](_0x9cd5('0x111'),_0x56c8a7['name'])][_0x9cd5('0x112')])&&(this[_0x9cd5('0x16')][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7['name'])][_0x9cd5('0x112')]===_0x9cd5('0x113')||this['trunks'][util[_0x9cd5('0x5c')](_0x9cd5('0x111'),_0x56c8a7[_0x9cd5('0x2b')])]['status']===_0x9cd5('0x114'));};Preview[_0x9cd5('0x11')][_0x9cd5('0x8b')]=function(_0x502a08,_0x50f4b1){var _0x90a557=this;return new BPromise(function(_0x348da2,_0x4075e4){_0x90a557[_0x9cd5('0x115')](_0x502a08,_0x50f4b1)[_0x9cd5('0x8c')](function(_0x57dd6b){_0x348da2(_[_0x9cd5('0x116')](_0x57dd6b,['message']));})[_0x9cd5('0x7b')](function(_0x10b392){if(_0x10b392[_0x9cd5('0x117')]){rpcDb['unlockContact'](_0x502a08);}if(_0x10b392[_0x9cd5('0x56')]){rpcDb[_0x9cd5('0x8f')](_0x502a08);}_0x4075e4(_[_0x9cd5('0x116')](_0x10b392,[_0x9cd5('0x61')]));});});};Preview[_0x9cd5('0x11')][_0x9cd5('0x115')]=function(_0x15e4a9,_0x5e1dca){var _0x3a23b5=this;return new BPromise(function(_0x4a32c3,_0x19ecae){var _0x177bc7,_0x1f9289;rpcDb[_0x9cd5('0x118')](_0x15e4a9)[_0x9cd5('0x8c')](function(_0x2e0b58){if(!_['isNil'](_0x2e0b58[0x0])){_0x1f9289=_0x2e0b58[0x0][_0x9cd5('0x119')]?![]:!![];_0x177bc7=_0x2e0b58[0x0]['recallme']?!![]:![];_0x177bc7=_0x5e1dca?!![]:_0x177bc7;}var _0x93835a=_0x3a23b5[_0x9cd5('0x11a')](_0x2e0b58);if(_0x93835a[_0x9cd5('0x11b')]){rpcDb[_0x9cd5('0x11c')](_['pick'](_0x2e0b58[0x0],['VoiceQueueId',_0x9cd5('0x11d')]))[_0x9cd5('0x8c')](function(_0x2817a3){_0x3a23b5['checkInBlack'](_0x2817a3,_0x2e0b58[0x0],_0x5e1dca,_0x1f9289,_0x177bc7)[_0x9cd5('0x8c')](function(_0x1dc65b){_0x4a32c3(_0x1dc65b);})[_0x9cd5('0x7b')](function(_0x410378){_0x19ecae(_0x410378);});})[_0x9cd5('0x7b')](function(_0x170915){ut[_0x9cd5('0x63')](_0x9cd5('0x11e'),_0x170915);_0x19ecae(ut[_0x9cd5('0x61')]('Call\x20unsuccessful',_0x1f9289,_0x177bc7));});}else{_0x19ecae(ut[_0x9cd5('0x61')](_0x93835a[_0x9cd5('0x61')],_0x1f9289,_0x177bc7));}})[_0x9cd5('0x7b')](function(_0xa468ec){ut[_0x9cd5('0x63')](_0x9cd5('0x11f'),_0xa468ec);_0x19ecae(ut[_0x9cd5('0x61')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x9cd5('0x11')]['validateContact']=function(_0x4e2d6b){if(_['isNil'](_0x4e2d6b)||_[_0x9cd5('0x105')](_0x4e2d6b)||!_[_0x9cd5('0x70')](_0x4e2d6b[0x0]['Agent'])&&_[_0x9cd5('0x70')](_0x4e2d6b[0x0]['Agent'][_0x9cd5('0x2b')])){ut[_0x9cd5('0x63')](_0x9cd5('0x120'),_0x4e2d6b);return{'isValid':![],'message':_0x9cd5('0x121')};}var _0x389641=this[_0x9cd5('0x27')][_0x4e2d6b[0x0][_0x9cd5('0x72')][_0x9cd5('0x2b')]];_0x389641[_0x9cd5('0x61')]=_0x9cd5('0xa0');if(_['isNil'](_0x389641)){ut[_0x9cd5('0x63')]('[Preview][validateContact][Empty\x20Campaign]',_0x389641);return{'isValid':![],'message':_0x9cd5('0x122')};}if(!this['isTrunkReachable'](_0x389641[_0x9cd5('0x55')])){ut[_0x9cd5('0x63')](_0x9cd5('0x123'),'campaign\x20Name:\x20'+_0x389641[_0x9cd5('0x2b')]+_0x9cd5('0x124'));if(!this[_0x9cd5('0x9d')](_0x389641[_0x9cd5('0x9e')])){ut[_0x9cd5('0x63')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x389641[_0x9cd5('0x2b')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x9cd5('0x125')};}}if(!ut[_0x9cd5('0x9c')](_0x389641['dialActive'])){ut[_0x9cd5('0x63')](_0x9cd5('0x126'),_0x389641['name']+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x389641[_0x9cd5('0x2b')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x9cd5('0x127')};};Preview[_0x9cd5('0x11')][_0x9cd5('0x106')]=function(_0x2a4db3,_0x57884b,_0x5a7668,_0x82bc74){var _0xbc0826=this;return new BPromise(function(_0x3515fc,_0x362e9f){var _0x39fbd1=_0x2a4db3[_0x9cd5('0xb5')];var _0x21fd2c=_0xbc0826['isTrunkReachable'](_0x57884b[_0x9cd5('0x55')])?util[_0x9cd5('0x5c')](_0x9cd5('0x128'),_0x57884b['Trunk']['name'],_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x3a')])?'':_0x57884b['dialPrefix'][_0x9cd5('0x129')]()||'',_0x57884b[_0x9cd5('0x12a')]>0x0?_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')]['substring'](_0x57884b[_0x9cd5('0x12a')]):_0x5a7668['Contact'][_0x9cd5('0x12b')]):util[_0x9cd5('0x5c')]('SIP/%s/%s%s',_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x9e')])?_0x57884b['Trunk'][_0x9cd5('0x2b')]:_0x57884b[_0x9cd5('0x9e')]['name'],_[_0x9cd5('0x70')](_0x57884b[_0x9cd5('0x3a')])?'':_0x57884b[_0x9cd5('0x3a')][_0x9cd5('0x129')]()||'',_0x57884b[_0x9cd5('0x12a')]>0x0?_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')][_0x9cd5('0x12c')](_0x57884b[_0x9cd5('0x12a')]):_0x5a7668[_0x9cd5('0x102')][_0x9cd5('0x12b')]);var _0x4c2f4c=_0xbc0826[_0x9cd5('0x9d')](_0x57884b[_0x9cd5('0x55')])?ut['getCallerId'](_0x57884b[_0x9cd5('0x55')]['callerid'],_0x57884b[_0x9cd5('0x39')],_0x57884b['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x9cd5('0x12d')](_0x57884b[_0x9cd5('0x12e')],_0x57884b[_0x9cd5('0x12f')]):_0x57884b[_0x9cd5('0x12e')]):ut[_0x9cd5('0x130')](_['isNil'](_0x57884b[_0x9cd5('0x9e')])?_0x57884b[_0x9cd5('0x55')][_0x9cd5('0x57')]:_0x57884b[_0x9cd5('0x9e')]['callerid'],_0x57884b[_0x9cd5('0x39')],_0x57884b[_0x9cd5('0x12f')]>0x0?ut[_0x9cd5('0x12d')](_0x57884b[_0x9cd5('0x12e')],_0x57884b[_0x9cd5('0x12f')]):_0x57884b[_0x9cd5('0x12e')]);if(_0x4c2f4c){_0x2a4db3[_0x9cd5('0x131')]=ut[_0x9cd5('0x132')](_0x4c2f4c);_0x2a4db3['originatecalleridnum']=ut[_0x9cd5('0x133')](_0x4c2f4c);}var _0x527732=ut['addVariables'](_0x57884b,_0x5a7668,_0x21fd2c,_0x4c2f4c,_0x39fbd1,_0x2a4db3);_[_0x9cd5('0x134')](_0x2a4db3,ut['toLowerVariables'](_0x527732));_0x2a4db3[_0x9cd5('0x90')]=moment()['format'](_0x9cd5('0x91'));ami[_0x9cd5('0x79')](ut[_0x9cd5('0x135')](_0x2a4db3,_0x57884b,_0x527732,_0x2a4db3[_0x9cd5('0xb1')],_0x82bc74))['then'](function(_0x409c70){_0x57884b['originated']+=0x1;logger[_0x9cd5('0x5b')](_0x9cd5('0x136'),_0x39fbd1,_0x9cd5('0xb6'),_0x57884b[_0x9cd5('0x2b')],_0x9cd5('0x74'),_0x57884b[_0x9cd5('0x50')]);_0x3515fc(_0x409c70);})[_0x9cd5('0x7b')](function(_0x28fb8a){ut[_0x9cd5('0xf9')](_0x2a4db3,0xe,_0x9cd5('0x137'));rpcDb['createAgentHistory'](_0x2a4db3,_0x9cd5('0x138'));_0x362e9f(_0x28fb8a);});});};Preview[_0x9cd5('0x11')][_0x9cd5('0x139')]=function(_0xd9794d){if(this['actions'][_0xd9794d[_0x9cd5('0xb2')]]){this[_0x9cd5('0x17')][_0xd9794d['linkedid']][_0x9cd5('0x7a')]=_0xd9794d[_0x9cd5('0x7a')];}};Preview[_0x9cd5('0x11')]['syncOriginateResponse']=function(_0x4c0a48){var _0x269225=this;var _0x52cf93=this[_0x9cd5('0x17')][_0x4c0a48[_0x9cd5('0x13a')]];if(_0x52cf93){if(_0x52cf93[_0x9cd5('0x104')]&&this[_0x9cd5('0x18')][_0x52cf93[_0x9cd5('0x104')]]){ut[_0x9cd5('0x13b')](_0x52cf93,this[_0x9cd5('0x18')][_0x52cf93['lookAgent']][_0x9cd5('0x2b')],this[_0x9cd5('0x18')][_0x52cf93[_0x9cd5('0x104')]]['id']);}var _0x593a89=_[_0x9cd5('0x13c')](_0x52cf93);_0x593a89['responsetime']=moment()[_0x9cd5('0x5c')](_0x9cd5('0x91'));var _0x8ddd85=_0x269225[_0x9cd5('0x27')][_0x52cf93['queue']];if(ut[_0x9cd5('0x13d')](_0x4c0a48[_0x9cd5('0x13e')])){if(_0x52cf93[_0x9cd5('0xb0')]){rpcDb[_0x9cd5('0x13f')](_0x52cf93[_0x9cd5('0x140')]);}if(_0x52cf93[_0x9cd5('0xb1')]){rpcDb[_0x9cd5('0x8f')](_0x52cf93[_0x9cd5('0x140')]);}ami[_0x9cd5('0x28')](_0x9cd5('0x141'),ut['buildObj'](_0x52cf93,_0x9cd5('0x142'),this[_0x9cd5('0x27')][_0x52cf93[_0x9cd5('0x73')]]));this['callProgressDetectingAgent'](_0x593a89,_0x8ddd85,_0x4c0a48);}else{_0x52cf93[_0x9cd5('0x90')]=moment()[_0x9cd5('0x5c')](_0x9cd5('0x91'));ut['logAgent'](_0x593a89,0x4,_0x9cd5('0xc0'));rpcDb['createAgentHistory'](_0x593a89,_0x9cd5('0x143'));}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x144')]=function(_0x2ce635){var _0x2bac68=this;var _0x1bf315=this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]];var _0x252b20;if(_0x1bf315){_0x252b20=this[_0x9cd5('0x27')][_0x1bf315[_0x9cd5('0x73')]];logger[_0x9cd5('0x5b')]('[syncHangup][talking]',_0x2ce635[_0x9cd5('0xb2')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x252b20['pTalking']);}if(this['actions'][_0x2ce635[_0x9cd5('0xb2')]]&&_0x2ce635[_0x9cd5('0xb2')]!==_0x2ce635[_0x9cd5('0xb5')]){if(_0x2ce635[_0x9cd5('0x145')]==='16'&&this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]][_0x9cd5('0x75')]){this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')]);}else if(this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]][_0x9cd5('0x75')]){logger[_0x9cd5('0x5b')](_0x9cd5('0x146'),_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],'pTalking:\x20',_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635[_0x9cd5('0xb2')],_0x2ce635['cause']);}}else if(_0x1bf315&&_[_0x9cd5('0x70')](_0x1bf315['statedesc'])&&_0x252b20[_0x9cd5('0x147')]&&_0x2ce635['linkedid']===_0x2ce635[_0x9cd5('0xb5')]&&_[_0x9cd5('0x70')](_0x2ce635['reason'])&&_0x2ce635['cause']==='16'&&_0x2ce635['channelstate']==='6'&&_[_0x9cd5('0xf6')](_0x1bf315[_0x9cd5('0x148')])){if(_0x1bf315['unlockAgent']){rpcDb[_0x9cd5('0x13f')](_0x1bf315[_0x9cd5('0x140')]);}if(_0x1bf315[_0x9cd5('0xb1')]){rpcDb[_0x9cd5('0x8f')](_0x1bf315[_0x9cd5('0x140')]);}_0x2ce635[_0x9cd5('0xf8')]='22';this['callProgressDetectingAgent'](_0x1bf315,_0x252b20,_0x2ce635);}else if(_0x1bf315&&_0x1bf315[_0x9cd5('0x148')]){if(_0x2ce635[_0x9cd5('0x145')]==='16'&&this[_0x9cd5('0x17')][_0x2ce635[_0x9cd5('0xb2')]]['dialAnswer']){logger[_0x9cd5('0x5b')](_0x9cd5('0x149'),_0x2ce635[_0x9cd5('0xb2')],_0x2ce635['cause'],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],'pTalking:\x20',_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635['linkedid'],_0x2ce635[_0x9cd5('0x145')]);}else if(this[_0x9cd5('0x17')][_0x2ce635['linkedid']]['dialAnswer']){logger[_0x9cd5('0x5b')]('[syncHangup][talking][cause]',_0x2ce635[_0x9cd5('0xb2')],_0x2ce635[_0x9cd5('0x145')],_0x9cd5('0xb6'),_0x252b20[_0x9cd5('0x2b')],_0x9cd5('0xb7'),_0x252b20[_0x9cd5('0x2f')]);this[_0x9cd5('0xa1')](_0x2ce635,_0x2ce635['linkedid'],_0x2ce635[_0x9cd5('0x145')]);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x1e')]=function(_0x5cc594){if(this[_0x9cd5('0x17')][_0x5cc594['destlinkedid']]&&_0x5cc594[_0x9cd5('0x14a')]!==_0x5cc594[_0x9cd5('0x14b')]){this[_0x9cd5('0xa1')](_0x5cc594,_0x5cc594[_0x9cd5('0x14a')],_0x5cc594[_0x9cd5('0xee')]);}};Preview['prototype'][_0x9cd5('0x1d')]=function(_0x5f2a06){if(this[_0x9cd5('0x17')][_0x5f2a06[_0x9cd5('0xb2')]]&&_0x5f2a06['linkedid']!==_0x5f2a06[_0x9cd5('0xb5')]&&!this['actions'][_0x5f2a06['linkedid']][_0x9cd5('0x75')]){if(_0x5f2a06[_0x9cd5('0x145')]==='1'){this[_0x9cd5('0xa1')](_0x5f2a06,_0x5f2a06[_0x9cd5('0xb2')],_0x5f2a06[_0x9cd5('0x145')]);}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x14c')]=function(_0x53e1ef,_0xfe62d1,_0x2fd2d2){if(this['actions'][_0x53e1ef]){if(_[_0x9cd5('0x70')](this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')])){this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')]={};}this[_0x9cd5('0x17')][_0x53e1ef][_0x9cd5('0x14d')][_0xfe62d1]=_0x2fd2d2;}};Preview[_0x9cd5('0x11')]['syncVarSet']=function(_0x150c19){try{if(!_[_0x9cd5('0x70')](_0x150c19)){if(ut['filterKey'](_[_0x9cd5('0x14e')](_0x150c19[_0x9cd5('0x14f')])[0x0])){this[_0x9cd5('0x14c')](_0x150c19[_0x9cd5('0xb5')],_['keys'](_0x150c19[_0x9cd5('0x14f')])[0x0],_0x150c19[_0x9cd5('0x150')]);}}}catch(_0x127652){logger[_0x9cd5('0x151')](_0x9cd5('0x152'),util['inspect'](_0x127652,{'showHidden':![],'depth':null}));}};Preview[_0x9cd5('0x11')][_0x9cd5('0x23')]=function(_0x36b8b2){if(_0x36b8b2){if(this[_0x9cd5('0x17')][_0x36b8b2[_0x9cd5('0x153')]]){this[_0x9cd5('0x17')][_0x36b8b2[_0x9cd5('0x153')]][_0x9cd5('0x148')]=!![];}}};Preview[_0x9cd5('0x11')][_0x9cd5('0x25')]=function(_0x56d272){if(_0x56d272){if(this[_0x9cd5('0x17')][_0x56d272[_0x9cd5('0x154')]]){this[_0x9cd5('0x17')][_0x56d272[_0x9cd5('0x154')]]['transfer']=!![];}}};module[_0x9cd5('0x155')]=Preview; \ No newline at end of file +var _0x9c5a=['[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','SIP/%s','status','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','idContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','addVariable','variables','keys','variable','error','inspect','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./rpcDb','./action','defaults','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','booked','clearZombieChannels','dialActive','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','then','length','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','buildAcw','custom:agentcomplete','Answer','[callProgressDetectingCustomer][logAnswer]','talktime','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','agentreject','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]'];(function(_0x4b1c92,_0x378e9d){var _0x1d8c08=function(_0x4369e6){while(--_0x4369e6){_0x4b1c92['push'](_0x4b1c92['shift']());}};_0x1d8c08(++_0x378e9d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x233bc8,_0x319fe7){_0x233bc8=_0x233bc8-0x0;var _0x1d43cc=_0x9c5a[_0x233bc8];return _0x1d43cc;};'use strict';var util=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var md5=require(_0xa9c5('0x4'));var Redis=require(_0xa9c5('0x5'));var config=require('../../../config/environment');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var loggerAction=require('../../../config/logger')(_0xa9c5('0x8'));var ami=require('../ami');var rpcDb=require(_0xa9c5('0x9'));var Action=require(_0xa9c5('0xa'));var ut=require('./util/util');config['redis']=_[_0xa9c5('0xb')](config[_0xa9c5('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xa9c5('0xd'))(new Redis(config[_0xa9c5('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xa9c5('0xe')]=function(_0x40a79d){this['tail']=this['tail']?this[_0xa9c5('0xf')][_0xa9c5('0x10')](_0x40a79d):_0x40a79d();};function Preview(_0x45f8d8){this[_0xa9c5('0x11')]=new Sequence();this[_0xa9c5('0x12')]=_0x45f8d8[_0xa9c5('0x13')];this[_0xa9c5('0x14')]=_0x45f8d8[_0xa9c5('0x14')];this[_0xa9c5('0x15')]={};this[_0xa9c5('0x16')]=_0x45f8d8['agents'];this[_0xa9c5('0x17')]=0x0;ami['on'](_0xa9c5('0x18'),this[_0xa9c5('0x19')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x1b'),this[_0xa9c5('0x1c')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x1d'),this[_0xa9c5('0x1e')][_0xa9c5('0x1a')](this));ami['on']('dialend',this[_0xa9c5('0x1f')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x20'),this['syncNewExten'][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x21'),this[_0xa9c5('0x22')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x23'),this[_0xa9c5('0x24')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x25'),this[_0xa9c5('0x26')][_0xa9c5('0x1a')](this));this[_0xa9c5('0x27')](this[_0xa9c5('0x12')]);}function emit(_0x54f8b9,_0x1115ad,_0x21ab50){io['to'](_0x54f8b9)['emit'](_0x1115ad,_0x21ab50);}function emitCampaignPreview(_0x5d2115){if(_0x5d2115[_0xa9c5('0x28')]===_0xa9c5('0x29')){var _0x10b208={'id':_0x5d2115['id'],'name':_0x5d2115[_0xa9c5('0x2a')],'strategy':_0x5d2115[_0xa9c5('0x2b')],'answered':_0x5d2115[_0xa9c5('0x2c')],'available':_0x5d2115['available'],'loggedIn':_0x5d2115['loggedIn'],'pTalking':_0x5d2115[_0xa9c5('0x2d')],'sumBillable':_0x5d2115[_0xa9c5('0x2e')],'sumDuration':_0x5d2115['sumDuration'],'sumHoldTime':_0x5d2115[_0xa9c5('0x2f')]||0x0,'talking':_0x5d2115[_0xa9c5('0x30')],'total':_0x5d2115[_0xa9c5('0x31')],'type':_0x5d2115[_0xa9c5('0x28')],'unmanaged':_0x5d2115[_0xa9c5('0x32')],'abandoned':_0x5d2115[_0xa9c5('0x33')],'waiting':_0x5d2115[_0xa9c5('0x34')],'loggedInDb':_0x5d2115['loggedInDb'],'dialActive':_0x5d2115['dialActive'],'dialMethod':_0x5d2115[_0xa9c5('0x35')],'dialOriginateCallerIdName':_0x5d2115['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5d2115[_0xa9c5('0x36')],'dialOriginateTimeout':_0x5d2115[_0xa9c5('0x37')],'dialPrefix':_0x5d2115['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5d2115[_0xa9c5('0x38')],'outboundAnswerCallsDay':_0x5d2115[_0xa9c5('0x39')],'outboundBlacklistCallsDay':_0x5d2115['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5d2115[_0xa9c5('0x3a')],'outboundCongestionCallsDay':_0x5d2115[_0xa9c5('0x3b')],'outboundDropCallsDayACS':_0x5d2115[_0xa9c5('0x3c')],'outboundDropCallsDayCallersExit':_0x5d2115[_0xa9c5('0x3d')],'outboundDropCallsDayTimeout':_0x5d2115[_0xa9c5('0x3e')],'outboundNoAnswerCallsDay':_0x5d2115['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5d2115[_0xa9c5('0x3f')],'outboundOriginateFailureCallsDay':_0x5d2115['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5d2115[_0xa9c5('0x40')],'outboundRejectCallsDay':_0x5d2115[_0xa9c5('0x41')],'outboundUnknownCallsDay':_0x5d2115[_0xa9c5('0x42')],'outboundAbandonedCallsDay':_0x5d2115['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5d2115[_0xa9c5('0x43')],'predictiveIntervalAvgHoldtime':_0x5d2115[_0xa9c5('0x44')],'predictiveIntervalAvgTalktime':_0x5d2115['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5d2115[_0xa9c5('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x5d2115[_0xa9c5('0x46')],'predictiveIntervalErlangCalls':_0x5d2115[_0xa9c5('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x5d2115[_0xa9c5('0x48')],'predictiveIntervalHitRate':_0x5d2115[_0xa9c5('0x49')],'predictiveIntervalMultiplicativeFactor':_0x5d2115[_0xa9c5('0x4a')],'predictiveIntervalPauses':_0x5d2115[_0xa9c5('0x4b')],'predictiveIntervalAvailable':_0x5d2115['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5d2115[_0xa9c5('0x4c')],'message':_0x5d2115[_0xa9c5('0x4d')],'originated':_0x5d2115[_0xa9c5('0x4e')],'erlangCalls':_0x5d2115[_0xa9c5('0x4f')],'erlangCallToSecond':_0x5d2115[_0xa9c5('0x50')],'erlangAbandonmentRate':_0x5d2115[_0xa9c5('0x51')],'erlangBusyFactor':_0x5d2115[_0xa9c5('0x52')],'startPredictive':_0x5d2115[_0xa9c5('0x53')],'startProgressive':_0x5d2115['startProgressive']};if(_0x5d2115['Trunk']){_0x10b208[_0xa9c5('0x54')]={'id':_0x5d2115[_0xa9c5('0x54')]['id'],'name':_0x5d2115[_0xa9c5('0x54')][_0xa9c5('0x2a')],'active':_0x5d2115[_0xa9c5('0x54')][_0xa9c5('0x55')],'callerid':_0x5d2115['Trunk']['callerid']};}if(_0x5d2115['Interval']){_0x10b208[_0xa9c5('0x56')]={'id':_0x5d2115[_0xa9c5('0x56')]['id'],'name':_0x5d2115['Interval'][_0xa9c5('0x2a')]};}var _0x56eb82=md5(JSON[_0xa9c5('0x57')](_0x10b208));if(_0x5d2115[_0xa9c5('0x4')]!==_0x56eb82){_0x5d2115[_0xa9c5('0x4')]=_0x56eb82;emit(util[_0xa9c5('0x58')]('voice:queue:%s',_0x10b208[_0xa9c5('0x2a')]),_0xa9c5('0x59'),_0x10b208);}}}function emitVoiceQueueChannelRemove(_0x191153){logger[_0xa9c5('0x5a')](_0xa9c5('0x5b'),JSON[_0xa9c5('0x57')](_0x191153));emit(util[_0xa9c5('0x58')](_0xa9c5('0x5c'),_0x191153['name']),_0xa9c5('0x5d'),_0x191153);io[_0xa9c5('0x5e')](_0xa9c5('0x5f'),_0x191153);}function notSendMessagesQueue(_0x2b95fa){if(_0x2b95fa[_0xa9c5('0x60')]){if(_0x2b95fa[_0xa9c5('0x4e')]===0x0&&_0x2b95fa['pTalking']===0x0){_0x2b95fa[_0xa9c5('0x60')]=![];_0x2b95fa['available']=0x0;_0x2b95fa[_0xa9c5('0x61')]=0x0;_0x2b95fa['message']=_0xa9c5('0x62');ut[_0xa9c5('0x63')](_0xa9c5('0x64'),_0x2b95fa['name']+_0xa9c5('0x65'));}else{_0x2b95fa[_0xa9c5('0x4d')]=_0xa9c5('0x66');ut[_0xa9c5('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2b95fa[_0xa9c5('0x2a')]+_0xa9c5('0x67'));}emitCampaignPreview(_0x2b95fa);}}Preview[_0xa9c5('0x68')][_0xa9c5('0x27')]=function(){var _0x2a6b48=this;setInterval(function(){_0x2a6b48['syncCampaigns']();},0x7cf);};Preview[_0xa9c5('0x68')]['syncCampaigns']=function(){var _0x1de605=this[_0xa9c5('0x12')];this[_0xa9c5('0x17')]+=0x1;for(var _0xc8fca4 in _0x1de605){if(_0x1de605[_0xa9c5('0x69')](_0xc8fca4)&&(_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x7')||_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x6a'))&&_0x1de605[_0xc8fca4][_0xa9c5('0x28')]==='outbound'){if(this[_0xa9c5('0x17')]>0x7){this[_0xa9c5('0x17')]=0x0;this[_0xa9c5('0x6b')]();}}if(_0x1de605[_0xa9c5('0x69')](_0xc8fca4)&&_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x7')&&_0x1de605[_0xc8fca4]['type']===_0xa9c5('0x29')){if(_0x1de605[_0xc8fca4][_0xa9c5('0x6c')]){this['setMessage'](_0x1de605[_0xc8fca4]);if(_0x1de605[_0xc8fca4]['dialPreviewAutoRecallMe'])this['recallMe'](_0x1de605[_0xc8fca4]);}else{notSendMessagesQueue(_0x1de605[_0xc8fca4]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x160020){var _0x569185=this;this[_0xa9c5('0x11')][_0xa9c5('0xe')](function(){if(!_[_0xa9c5('0x6d')](_0x569185[_0xa9c5('0x15')][_0x160020])){loggerAction[_0xa9c5('0x5a')](_0xa9c5('0x6e'),_0x160020,_0xa9c5('0x6f'),_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')],_0xa9c5('0x71'),JSON[_0xa9c5('0x57')](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020]['queue']][_0xa9c5('0x4e')]),_0xa9c5('0x72'),JSON['stringify'](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]][_0xa9c5('0x2d')]),JSON['stringify'](_0x569185['actions'][_0x160020][_0xa9c5('0x73')]),JSON[_0xa9c5('0x57')](_['pick'](_0x569185[_0xa9c5('0x15')][_0x160020],[_0xa9c5('0x74'),_0xa9c5('0x75'),_0xa9c5('0x76'),_0xa9c5('0x77')])));return ami[_0xa9c5('0x78')]({'action':'status','channel':_0x569185['actions'][_0x160020]['channel']})[_0xa9c5('0x79')](function(_0x277903){if(_0x277903[_0xa9c5('0x4d')]===_0xa9c5('0x7a')){setTimeout(function(){if(_0x569185[_0xa9c5('0x15')][_0x160020]){ut[_0xa9c5('0x7b')](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]],_0xa9c5('0x7c'));if(_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x73')]===!![]){ut[_0xa9c5('0x7d')](_0x569185['campaignsPreview'][_0x569185['actions'][_0x160020][_0xa9c5('0x70')]],'[clearZombieChannel]');ut[_0xa9c5('0x7e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x160020,_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]);}ut[_0xa9c5('0x7e')]('[Dialer][checkChannel][Preview]'+_0x160020,_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]);delete _0x569185[_0xa9c5('0x15')][_0x160020];}},0x2328);}});}});};Preview[_0xa9c5('0x68')]['clearZombieChannels']=function(){var _0x49422c=this;loggerAction[_0xa9c5('0x5a')](_0xa9c5('0x7f'),_[_0xa9c5('0x80')](this['actions']));for(var _0x31e12e in this[_0xa9c5('0x15')]){if(_0x49422c[_0xa9c5('0x15')][_0xa9c5('0x69')](_0x31e12e)){_0x49422c[_0xa9c5('0x81')](_0x31e12e);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x82')]=function(_0x298b3d){var _0x5a7f0a=this;rpcDb[_0xa9c5('0x83')](_0x298b3d['id'],ut['agentReadyId'](this[_0xa9c5('0x16')]))[_0xa9c5('0x84')](function(_0x26bda1){if(!_['isNil'](_0x26bda1)){for(var _0x4d475a=0x0;_0x4d475a<_0x26bda1[_0xa9c5('0x85')];_0x4d475a+=0x1){if(ut['getDiff'](_0x26bda1[_0x4d475a][_0xa9c5('0x86')])<_0x298b3d[_0xa9c5('0x87')]*0x3c){if(_0x26bda1[_0x4d475a][_0xa9c5('0x88')]&&!_0x26bda1[_0x4d475a][_0xa9c5('0x88')]['voicePause']){_0x5a7f0a[_0xa9c5('0x89')](_0x26bda1[_0x4d475a]['id'])[_0xa9c5('0x84')](ut[_0xa9c5('0x8a')](_0xa9c5('0x8b')))['catch'](ut['logger2'](_0xa9c5('0x8b')));}else{rpcDb[_0xa9c5('0x8c')](_0x26bda1[_0x4d475a]['id']);}}else{var _0x67c1f8=new Action(_0x26bda1[_0x4d475a],_0x298b3d);_0x67c1f8[_0xa9c5('0x8d')]=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));_0x298b3d['outboundReCallsDay']+=0x1;ut[_0xa9c5('0x8f')](_0x67c1f8,0x17,_0xa9c5('0x90'));if(_0x298b3d[_0xa9c5('0x91')]){rpcDb[_0xa9c5('0x92')](ut[_0xa9c5('0x93')](_0x26bda1[_0x4d475a]));rpcDb[_0xa9c5('0x94')](_0x67c1f8,_0xa9c5('0x95'));}else{ut[_0xa9c5('0x8f')](_0x67c1f8,0x16,_0xa9c5('0x96'));rpcDb[_0xa9c5('0x94')](_0x67c1f8,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x67c1f8,_0xa9c5('0x97'));}}}}})[_0xa9c5('0x79')](ut[_0xa9c5('0x8a')](_0xa9c5('0x98')));};Preview['prototype'][_0xa9c5('0x99')]=function(_0x4aa699){_0x4aa699[_0xa9c5('0x60')]=!![];if(ut[_0xa9c5('0x9a')](_0x4aa699[_0xa9c5('0x9b')])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x9c');}else if(!ut[_0xa9c5('0x9d')](_0x4aa699[_0xa9c5('0x6c')])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x62');}else if(!this[_0xa9c5('0x9e')](_0x4aa699[_0xa9c5('0x54')])){if(!this[_0xa9c5('0x9e')](_0x4aa699['TrunkBackup'])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x9f');}else{_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0xa0');}}else{_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0xa0');}emitCampaignPreview(_0x4aa699);};Preview[_0xa9c5('0x68')]['callProgressDetectingCustomer']=function(_0x5b7c33,_0x207bb7,_0x502a00){var _0x2ae087=this;var _0x2510e4=this['actions'][_0x207bb7];var _0x219854=this[_0xa9c5('0x12')][_0x2510e4['queue']];var _0x4f8d9e;if(_0x219854){switch(_0x502a00){case'1':_0x219854[_0xa9c5('0x3f')]+=0x1;_0x2510e4[_0xa9c5('0xa1')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut['totalGlobal'](_0x2510e4);ut['logCustomer'](_0x2510e4,0x0,_0xa9c5('0xa3'));ami[_0xa9c5('0x5e')]('custom:agentnosuchnumber',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xa5')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xa6'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xab'));}else{if(_0x2510e4[_0xa9c5('0xa1')]>=_0x219854['dialNoSuchNumberMaxRetry']){rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xab'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xa1'),_0x219854[_0xa9c5('0xad')]),_0x2510e4['unlockAgent'],_0x2510e4[_0xa9c5('0xae')]);}}delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];break;case _0xa9c5('0xb0'):var _0x2d449a=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));_0x2510e4['responsetime']=_0x2d449a;_0x2510e4[_0xa9c5('0xb1')]=_0x2d449a;_0x2510e4[_0xa9c5('0x73')]=!![];_0x219854[_0xa9c5('0x2d')]+=0x1;logger[_0xa9c5('0x5a')](_0xa9c5('0xb2'),_0x2510e4[_0xa9c5('0xb3')],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x219854[_0xa9c5('0x2d')]);ami[_0xa9c5('0x5e')]('custom:agentconnect',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xb5'),this['campaignsPreview'][_0x2510e4[_0xa9c5('0x70')]]));if(_0x219854[_0xa9c5('0xb6')]){ami[_0xa9c5('0x5e')]('custom:agentConnectPreview',ut[_0xa9c5('0xb7')](_0x2510e4));}break;case'16':ami[_0xa9c5('0x5e')](_0xa9c5('0xb8'),ut[_0xa9c5('0xa4')](_0x2510e4,'complete',this[_0xa9c5('0x12')][_0x2510e4[_0xa9c5('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2510e4,'complete'));_0x219854['outboundAnswerCallsDay']+=0x1;_0x219854['total']+=0x1;_0x219854['answered']+=0x1;ut['decrementTalkink'](_0x219854,'[16]');_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x4,_0xa9c5('0xb9'));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xba'));rpcDb['createCustomerFinal'](_0x2510e4,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x2510e4);_0x219854['sumDuration']+=_0x2510e4[_0xa9c5('0xbb')];_0x219854[_0xa9c5('0x2e')]+=_0x2510e4[_0xa9c5('0xbb')];logger[_0xa9c5('0x5a')]('[syncHangup][talking][decrement]',_0x2510e4['uniqueid'],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x219854[_0xa9c5('0x2d')]);delete this[_0xa9c5('0x15')][_0x5b7c33['linkedid']];break;case _0xa9c5('0xbc'):_0x219854[_0xa9c5('0x3a')]+=0x1;_0x2510e4[_0xa9c5('0xbd')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x5,_0xa9c5('0xbe'));ami[_0xa9c5('0x5e')]('custom:agentbusy',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xbf')));rpcDb['createCustomerHistory'](_0x2510e4,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854['dialGlobalMaxRetry']){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xc0'));}else{if(_0x2510e4[_0xa9c5('0xbd')]>=_0x219854[_0xa9c5('0xc1')]){rpcDb['createCustomerFinal'](_0x2510e4,_0xa9c5('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xbd'),_0x219854[_0xa9c5('0xc3')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4['activeContact']);}}break;case'NOANSWER':_0x219854[_0xa9c5('0xc5')]+=0x1;_0x2510e4['countnoanswerretry']+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x3,'NoAnswer');ami['emit'](_0xa9c5('0xc6'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xc7')));rpcDb[_0xa9c5('0x94')](_0x2510e4,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xc9'));}else{if(_0x2510e4[_0xa9c5('0xca')]>=_0x219854[_0xa9c5('0xcb')]){rpcDb['createCustomerFinal'](_0x2510e4,_0xa9c5('0xcc'));}else{rpcDb[_0xa9c5('0xcd')](ut['scheduledAt'](_0x2510e4,_0xa9c5('0xca'),_0x219854[_0xa9c5('0xce')]),_0x2510e4['unlockAgent'],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xcf'):_0x219854[_0xa9c5('0x3b')]+=0x1;_0x2510e4[_0xa9c5('0xd0')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x8,_0xa9c5('0xd1'));ami[_0xa9c5('0x5e')](_0xa9c5('0xd2'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xd3')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xd4'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,'Global');rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xd5'));}else{if(_0x2510e4[_0xa9c5('0xd0')]>=_0x219854['dialCongestionMaxRetry']){rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xd0'),_0x219854[_0xa9c5('0xc3')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xd6'):_0x219854[_0xa9c5('0x41')]+=0x1;_0x2510e4[_0xa9c5('0xd7')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x14,_0xa9c5('0xd8'));ami[_0xa9c5('0x5e')]('custom:agentreject',ut['buildObj'](_0x2510e4,_0xa9c5('0xd9')));rpcDb[_0xa9c5('0x94')](_0x2510e4,'[syncHangupRequest][logAgentReject]');if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0x14,_0xa9c5('0xd8'));rpcDb['createCustomerFinal'](_0x4f8d9e,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2510e4[_0xa9c5('0xd7')]>=_0x219854[_0xa9c5('0xda')]){rpcDb[_0xa9c5('0xaa')](_0x2510e4,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xa9c5('0xcd')](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xd7'),_0x219854['dialAgentRejectRetryFrequency']),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xdb'):_0x219854[_0xa9c5('0xdc')]+=0x1;_0x2510e4[_0xa9c5('0xdd')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0xb,_0xa9c5('0xde'));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xdf'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb['createCustomerFinal'](_0x4f8d9e,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2510e4['countabandonedetry']>=_0x219854[_0xa9c5('0xe0')]){rpcDb[_0xa9c5('0xaa')](_0x2510e4,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa9c5('0xcd')](ut[_0xa9c5('0xac')](_0x2510e4,'countabandonedretry',_0x219854[_0xa9c5('0xe1')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case'18':_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4[_0xa9c5('0xe2')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x12,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);ami[_0xa9c5('0x5e')](_0xa9c5('0xe5'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xe6')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xe7'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,'Global');rpcDb['createCustomerFinal'](_0x4f8d9e,_0xa9c5('0xe7'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xe7'));}delete this[_0xa9c5('0x15')][_0x5b7c33['linkedid']];break;case'19':_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4['countglobal']=ut['totalGlobal'](_0x2510e4);ut['logCustomer'](_0x2510e4,0x13,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);ami['emit'](_0xa9c5('0xe5'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xe6')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xe8'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb['createCustomerFinal'](_0x4f8d9e,_0xa9c5('0xe8'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xe8'));}delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];break;default:if(_0x2510e4[_0xa9c5('0x73')]){ut[_0xa9c5('0x7d')](_0x219854,_0xa9c5('0xe9'));ut['loggerError'](_0xa9c5('0xea')+_0x219854['name'],_0x5b7c33);}_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0xc,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xeb'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,'Global');rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xec'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xec'));}delete this['actions'][_0x5b7c33['linkedid']];}if(!(_0x2510e4[_0xa9c5('0x73')]&&_0x502a00==='16')){ut[_0xa9c5('0x7b')](_0x219854,_0xa9c5('0xed'));logger[_0xa9c5('0x5a')](_0xa9c5('0xee'),_0x2510e4[_0xa9c5('0xb3')],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x71'),_0x219854['originated']);}if(_0x502a00!==_0xa9c5('0xb0')){delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xef')]];}}};Preview[_0xa9c5('0x68')][_0xa9c5('0xf0')]=function(_0x42e803,_0xf77e11,_0x2204b){if(_[_0xa9c5('0xf1')](_0xf77e11)&&_0xa9c5('0xf2')!==typeof _0xf77e11){return;}if(_[_0xa9c5('0xf1')](_0x2204b)&&_0xa9c5('0xf2')!==typeof _0x2204b){return;}switch(_0x2204b[_0xa9c5('0xf3')]){case'0':ut['logAgent'](_0x42e803,0x0,_0xa9c5('0xa3'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xf5'));break;case'3':ut['logAgent'](_0x42e803,0x3,_0xa9c5('0xf6'));rpcDb['createAgentHistory'](_0x42e803,_0xa9c5('0xf7'));break;case'5':ut[_0xa9c5('0xf8')](_0x42e803,0x5,_0xa9c5('0xbe'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xf9'));break;case'8':ut[_0xa9c5('0xf8')](_0x42e803,0x8,_0xa9c5('0xd1'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xfa'));break;case'22':ut['logAgent'](_0x42e803,0x16,_0xa9c5('0xfb'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xfc'));break;default:ut[_0xa9c5('0xf8')](_0x42e803,0xc,_0x2204b[_0xa9c5('0xf3')]);rpcDb['createAgentHistory'](_0x42e803,_0xa9c5('0xfa'));}ut[_0xa9c5('0x7b')](_0xf77e11,_0xa9c5('0xfd'));logger[_0xa9c5('0x5a')](_0xa9c5('0xfe'),_0x42e803['uniqueid'],_0xa9c5('0xb4'),_0xf77e11['name'],_0xa9c5('0x71'),_0xf77e11[_0xa9c5('0x4e')]);delete this[_0xa9c5('0x15')][_0x42e803[_0xa9c5('0xb3')]];};Preview[_0xa9c5('0x68')][_0xa9c5('0xff')]=function(_0xe3b086,_0x35b8c9,_0x1fdc93,_0x1400b2,_0x3e2a1e){var _0x150d58=this;return new BPromise(function(_0x466ce6,_0x1c8efb){if(_[_0xa9c5('0x6d')](_0x35b8c9)||_[_0xa9c5('0x6d')](_0x35b8c9[_0xa9c5('0x100')])||_['isNil'](_0x35b8c9[_0xa9c5('0x100')][_0xa9c5('0x101')])||_[_0xa9c5('0x6d')](_0x35b8c9[_0xa9c5('0x76')])){_0x1c8efb(ut[_0xa9c5('0x4d')](_0xa9c5('0x102'),_0x1400b2,_0x3e2a1e));return;}var _0x18389c=uuid['v4']();var _0xd2bb86=_0x150d58['campaignsPreview'][_0x35b8c9[_0xa9c5('0x6f')][_0xa9c5('0x2a')]];var _0x5018c4=_0x1fdc93?_0x150d58[_0xa9c5('0x16')][_0x1fdc93]['id']:undefined;_0x150d58[_0xa9c5('0x15')][_0x18389c]=new Action(_0x35b8c9,_0xd2bb86,_0x18389c,_0x1fdc93,_0x5018c4);var _0x5545eb=_0x150d58['actions'][_0x18389c];_0x5545eb[_0xa9c5('0xc4')]=_0x1400b2;_0x5545eb[_0xa9c5('0xae')]=_0x3e2a1e;_0x5545eb['lookAgent']=_0x1fdc93;if(_[_0xa9c5('0x103')](_0xe3b086)){_0x150d58[_0xa9c5('0x104')](_0x5545eb,_0xd2bb86,_0x35b8c9,_0x1fdc93)[_0xa9c5('0x84')](function(_0x2d5a24){logger[_0xa9c5('0x5a')](_0xa9c5('0x105'),_0xa9c5('0x106')+_0x5545eb[_0xa9c5('0x70')]+_0xa9c5('0x107')+_0x5545eb['idContact'],JSON[_0xa9c5('0x57')](_0x2d5a24));ami[_0xa9c5('0x5e')](_0xa9c5('0x108'),ut[_0xa9c5('0xa4')](_0x5545eb,'called',_0x150d58['campaignsPreview'][_0x5545eb[_0xa9c5('0x70')]]));_0x466ce6(ut[_0xa9c5('0x4d')](_0xa9c5('0x109')));})[_0xa9c5('0x79')](function(_0x3269ba){ut[_0xa9c5('0x63')]('[Preview][execCall][failure]',_0x3269ba);_0x1c8efb(ut[_0xa9c5('0x4d')](_0xa9c5('0x10a'),_0x1400b2,_0x3e2a1e));});}else{_0xd2bb86[_0xa9c5('0x10b')]+=0x1;ut['logBlacklist'](_0x5545eb);rpcDb[_0xa9c5('0x10c')](_0x5545eb,_0xa9c5('0x10d'));delete _0x150d58['actions'][_0x18389c];_0x1c8efb(ut[_0xa9c5('0x4d')]('Contact\x20in\x20black\x20List',_0x1400b2,_0x3e2a1e));}});};Preview[_0xa9c5('0x68')]['isTrunkReachable']=function(_0x52d348){return!_[_0xa9c5('0x6d')](_0x52d348)&&!_[_0xa9c5('0x6d')](_0x52d348['name'])&&!_['isNil'](_0x52d348[_0xa9c5('0x55')])&&_0x52d348[_0xa9c5('0x55')]&&!_[_0xa9c5('0x6d')](this[_0xa9c5('0x14')][util['format'](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])])&&!_['isNil'](this['trunks'][util[_0xa9c5('0x58')]('SIP/%s',_0x52d348[_0xa9c5('0x2a')])]['status'])&&(this[_0xa9c5('0x14')][util['format'](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])][_0xa9c5('0x10f')]==='reachable'||this[_0xa9c5('0x14')][util[_0xa9c5('0x58')](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])][_0xa9c5('0x10f')]===_0xa9c5('0x110'));};Preview[_0xa9c5('0x68')][_0xa9c5('0x89')]=function(_0x37bdd7,_0x456833){var _0x1cc858=this;return new BPromise(function(_0x345b1d,_0x4681f9){_0x1cc858[_0xa9c5('0x111')](_0x37bdd7,_0x456833)[_0xa9c5('0x84')](function(_0x2f8ccf){_0x345b1d(_[_0xa9c5('0x112')](_0x2f8ccf,[_0xa9c5('0x4d')]));})[_0xa9c5('0x79')](function(_0x1b54dc){if(_0x1b54dc[_0xa9c5('0x113')]){rpcDb[_0xa9c5('0x114')](_0x37bdd7);}if(_0x1b54dc[_0xa9c5('0x55')]){rpcDb[_0xa9c5('0x8c')](_0x37bdd7);}_0x4681f9(_[_0xa9c5('0x112')](_0x1b54dc,['message']));});});};Preview[_0xa9c5('0x68')][_0xa9c5('0x111')]=function(_0x1d0b63,_0xa8905e){var _0x5e9ce9=this;return new BPromise(function(_0x1ff174,_0x4d7916){var _0x21a87e,_0x5b8f70;rpcDb[_0xa9c5('0x115')](_0x1d0b63)['then'](function(_0x22424e){if(!_[_0xa9c5('0x6d')](_0x22424e[0x0])){_0x5b8f70=_0x22424e[0x0][_0xa9c5('0x116')]?![]:!![];_0x21a87e=_0x22424e[0x0][_0xa9c5('0x116')]?!![]:![];_0x21a87e=_0xa8905e?!![]:_0x21a87e;}var _0x4a6123=_0x5e9ce9[_0xa9c5('0x117')](_0x22424e);if(_0x4a6123[_0xa9c5('0x118')]){rpcDb[_0xa9c5('0x119')](_[_0xa9c5('0x112')](_0x22424e[0x0],[_0xa9c5('0x76'),'Contact.phone']))[_0xa9c5('0x84')](function(_0x272db4){_0x5e9ce9[_0xa9c5('0xff')](_0x272db4,_0x22424e[0x0],_0xa8905e,_0x5b8f70,_0x21a87e)['then'](function(_0x18a668){_0x1ff174(_0x18a668);})[_0xa9c5('0x79')](function(_0x8cccd1){_0x4d7916(_0x8cccd1);});})[_0xa9c5('0x79')](function(_0x4c4b56){ut['logger']('[Preview][checkIsBlackList]',_0x4c4b56);_0x4d7916(ut[_0xa9c5('0x4d')](_0xa9c5('0x11a'),_0x5b8f70,_0x21a87e));});}else{_0x4d7916(ut['message'](_0x4a6123[_0xa9c5('0x4d')],_0x5b8f70,_0x21a87e));}})['catch'](function(_0x592b18){ut['logger'](_0xa9c5('0x11b'),_0x592b18);_0x4d7916(ut[_0xa9c5('0x4d')](_0xa9c5('0x11a'),![],!![]));});});};Preview[_0xa9c5('0x68')][_0xa9c5('0x117')]=function(_0xd06ffc){if(_[_0xa9c5('0x6d')](_0xd06ffc)||_[_0xa9c5('0x103')](_0xd06ffc)||!_[_0xa9c5('0x6d')](_0xd06ffc[0x0][_0xa9c5('0x88')])&&_[_0xa9c5('0x6d')](_0xd06ffc[0x0]['Agent'][_0xa9c5('0x2a')])){ut[_0xa9c5('0x63')](_0xa9c5('0x11c'),_0xd06ffc);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x24b12d=this[_0xa9c5('0x12')][_0xd06ffc[0x0][_0xa9c5('0x6f')]['name']];_0x24b12d[_0xa9c5('0x4d')]=_0xa9c5('0xa0');if(_['isNil'](_0x24b12d)){ut[_0xa9c5('0x63')](_0xa9c5('0x11d'),_0x24b12d);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xa9c5('0x9e')](_0x24b12d[_0xa9c5('0x54')])){ut[_0xa9c5('0x63')](_0xa9c5('0x11e'),'campaign\x20Name:\x20'+_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x11f'));if(!this[_0xa9c5('0x9e')](_0x24b12d[_0xa9c5('0x120')])){ut['logger'](_0xa9c5('0x11e'),_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x121'));return{'isValid':![],'message':_0xa9c5('0x122')};}}if(!ut['isActive'](_0x24b12d['dialActive'])){ut[_0xa9c5('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x123'));return{'isValid':![],'message':_0xa9c5('0x124')+_0x24b12d['name']+_0xa9c5('0x123')};}return{'isValid':!![],'message':_0xa9c5('0x125')};};Preview[_0xa9c5('0x68')][_0xa9c5('0x104')]=function(_0x2c2671,_0x1c8e59,_0x26c209,_0x417181){var _0x58dd4c=this;return new BPromise(function(_0x4382cf,_0xdeb6e5){var _0x11621e=_0x2c2671[_0xa9c5('0xb3')];var _0x54ffc4=_0x58dd4c[_0xa9c5('0x9e')](_0x1c8e59[_0xa9c5('0x54')])?util[_0xa9c5('0x58')]('SIP/%s/%s%s',_0x1c8e59['Trunk'][_0xa9c5('0x2a')],_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x126')])?'':_0x1c8e59['dialPrefix']['trim']()||'',_0x1c8e59[_0xa9c5('0x127')]>0x0?_0x26c209[_0xa9c5('0x100')]['phone'][_0xa9c5('0x128')](_0x1c8e59['dialCutDigit']):_0x26c209[_0xa9c5('0x100')][_0xa9c5('0x101')]):util[_0xa9c5('0x58')](_0xa9c5('0x129'),_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x120')])?_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x2a')]:_0x1c8e59[_0xa9c5('0x120')][_0xa9c5('0x2a')],_[_0xa9c5('0x6d')](_0x1c8e59['dialPrefix'])?'':_0x1c8e59[_0xa9c5('0x126')][_0xa9c5('0x12a')]()||'',_0x1c8e59[_0xa9c5('0x127')]>0x0?_0x26c209[_0xa9c5('0x100')][_0xa9c5('0x101')][_0xa9c5('0x128')](_0x1c8e59[_0xa9c5('0x127')]):_0x26c209['Contact'][_0xa9c5('0x101')]);var _0x3a25fd=_0x58dd4c[_0xa9c5('0x9e')](_0x1c8e59['Trunk'])?ut['getCallerId'](_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x12b')],_0x1c8e59['dialOriginateCallerIdName'],_0x1c8e59[_0xa9c5('0x12c')]>0x0?ut[_0xa9c5('0x12d')](_0x1c8e59['dialOriginateCallerIdNumber'],_0x1c8e59[_0xa9c5('0x12c')]):_0x1c8e59[_0xa9c5('0x36')]):ut[_0xa9c5('0x12e')](_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x120')])?_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x12b')]:_0x1c8e59[_0xa9c5('0x120')][_0xa9c5('0x12b')],_0x1c8e59[_0xa9c5('0x12f')],_0x1c8e59[_0xa9c5('0x12c')]>0x0?ut['getCallerIdRandom'](_0x1c8e59[_0xa9c5('0x36')],_0x1c8e59['dialRandomLastDigitCallerIdNumber']):_0x1c8e59[_0xa9c5('0x36')]);if(_0x3a25fd){_0x2c2671[_0xa9c5('0x130')]=ut[_0xa9c5('0x131')](_0x3a25fd);_0x2c2671[_0xa9c5('0x132')]=ut['extractCalleridNumber'](_0x3a25fd);}var _0x3058a6=ut[_0xa9c5('0x133')](_0x1c8e59,_0x26c209,_0x54ffc4,_0x3a25fd,_0x11621e,_0x2c2671);_[_0xa9c5('0x134')](_0x2c2671,ut[_0xa9c5('0x135')](_0x3058a6));_0x2c2671['starttime']=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));ami[_0xa9c5('0x78')](ut[_0xa9c5('0x136')](_0x2c2671,_0x1c8e59,_0x3058a6,_0x2c2671['activeContact'],_0x417181))[_0xa9c5('0x84')](function(_0x42dbd7){_0x1c8e59[_0xa9c5('0x4e')]+=0x1;logger[_0xa9c5('0x5a')](_0xa9c5('0x137'),_0x11621e,_0xa9c5('0xb4'),_0x1c8e59[_0xa9c5('0x2a')],_0xa9c5('0x71'),_0x1c8e59[_0xa9c5('0x4e')]);_0x4382cf(_0x42dbd7);})[_0xa9c5('0x79')](function(_0x411ee7){ut[_0xa9c5('0xf8')](_0x2c2671,0xe,_0xa9c5('0x138'));rpcDb[_0xa9c5('0xf4')](_0x2c2671,_0xa9c5('0x139'));_0xdeb6e5(_0x411ee7);});});};Preview['prototype'][_0xa9c5('0x13a')]=function(_0x543b32){if(this['actions'][_0x543b32[_0xa9c5('0xaf')]]){this[_0xa9c5('0x15')][_0x543b32[_0xa9c5('0xaf')]][_0xa9c5('0x13b')]=_0x543b32[_0xa9c5('0x13b')];}};Preview['prototype'][_0xa9c5('0x19')]=function(_0x53b2f1){var _0x4dde67=this;var _0x130c9a=this[_0xa9c5('0x15')][_0x53b2f1[_0xa9c5('0x13c')]];if(_0x130c9a){if(_0x130c9a[_0xa9c5('0x13d')]&&this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]]){ut[_0xa9c5('0x13e')](_0x130c9a,this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]][_0xa9c5('0x2a')],this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]]['id']);}var _0x5d93d2=_[_0xa9c5('0x13f')](_0x130c9a);_0x5d93d2[_0xa9c5('0x140')]=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));var _0x20454c=_0x4dde67[_0xa9c5('0x12')][_0x130c9a[_0xa9c5('0x70')]];if(ut[_0xa9c5('0x141')](_0x53b2f1[_0xa9c5('0x142')])){if(_0x130c9a[_0xa9c5('0xc4')]){rpcDb['unlockContact'](_0x130c9a[_0xa9c5('0x143')]);}if(_0x130c9a['activeContact']){rpcDb[_0xa9c5('0x8c')](_0x130c9a[_0xa9c5('0x143')]);}ami[_0xa9c5('0x5e')](_0xa9c5('0x144'),ut[_0xa9c5('0xa4')](_0x130c9a,_0xa9c5('0x145'),this['campaignsPreview'][_0x130c9a[_0xa9c5('0x70')]]));this['callProgressDetectingAgent'](_0x5d93d2,_0x20454c,_0x53b2f1);}else{_0x130c9a[_0xa9c5('0x8d')]=moment()['format'](_0xa9c5('0x8e'));ut[_0xa9c5('0xf8')](_0x5d93d2,0x4,_0xa9c5('0xb9'));rpcDb[_0xa9c5('0xf4')](_0x5d93d2,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x21fa3e){var _0x4d19fe=this;var _0x45fa29=this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]];var _0x40ddd5;if(_0x45fa29){_0x40ddd5=this['campaignsPreview'][_0x45fa29['queue']];logger['info'](_0xa9c5('0x146'),_0x21fa3e['linkedid'],_0xa9c5('0xb4'),_0x40ddd5[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x40ddd5[_0xa9c5('0x2d')]);}if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]&&_0x21fa3e['linkedid']!==_0x21fa3e[_0xa9c5('0xb3')]){if(_0x21fa3e[_0xa9c5('0x147')]==='16'&&this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]['dialAnswer']){this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e['cause']);}else if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]['dialAnswer']){logger[_0xa9c5('0x5a')](_0xa9c5('0x149'),_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')],_0xa9c5('0xb4'),_0x40ddd5[_0xa9c5('0x2a')],'pTalking:\x20',_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')]);}}else if(_0x45fa29&&_[_0xa9c5('0x6d')](_0x45fa29[_0xa9c5('0x14a')])&&_0x40ddd5[_0xa9c5('0x14b')]&&_0x21fa3e[_0xa9c5('0xaf')]===_0x21fa3e[_0xa9c5('0xb3')]&&_[_0xa9c5('0x6d')](_0x21fa3e[_0xa9c5('0xf3')])&&_0x21fa3e['cause']==='16'&&_0x21fa3e['channelstate']==='6'&&_['isUndefined'](_0x45fa29[_0xa9c5('0x14c')])){if(_0x45fa29['unlockAgent']){rpcDb[_0xa9c5('0x114')](_0x45fa29['idContact']);}if(_0x45fa29[_0xa9c5('0xae')]){rpcDb[_0xa9c5('0x8c')](_0x45fa29[_0xa9c5('0x143')]);}_0x21fa3e['reason']='22';this['callProgressDetectingAgent'](_0x45fa29,_0x40ddd5,_0x21fa3e);}else if(_0x45fa29&&_0x45fa29[_0xa9c5('0x14c')]){if(_0x21fa3e[_0xa9c5('0x147')]==='16'&&this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){logger['info'](_0xa9c5('0x14d'),_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')],_0xa9c5('0xb4'),_0x40ddd5['name'],'pTalking:\x20',_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')]);}else if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){logger[_0xa9c5('0x5a')](_0xa9c5('0x149'),_0x21fa3e[_0xa9c5('0xaf')],_0x21fa3e[_0xa9c5('0x147')],'\x20Queue',_0x40ddd5[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e[_0xa9c5('0xaf')],_0x21fa3e['cause']);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x1f')]=function(_0x4db22d){if(this[_0xa9c5('0x15')][_0x4db22d[_0xa9c5('0xef')]]&&_0x4db22d[_0xa9c5('0xef')]!==_0x4db22d['destuniqueid']){this[_0xa9c5('0x148')](_0x4db22d,_0x4db22d['destlinkedid'],_0x4db22d[_0xa9c5('0xe4')]);}};Preview[_0xa9c5('0x68')][_0xa9c5('0x1e')]=function(_0x1def15){if(this[_0xa9c5('0x15')][_0x1def15[_0xa9c5('0xaf')]]&&_0x1def15[_0xa9c5('0xaf')]!==_0x1def15['uniqueid']&&!this['actions'][_0x1def15[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){if(_0x1def15[_0xa9c5('0x147')]==='1'){this[_0xa9c5('0x148')](_0x1def15,_0x1def15['linkedid'],_0x1def15[_0xa9c5('0x147')]);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x14e')]=function(_0x90b498,_0x314f21,_0x4e1931){if(this[_0xa9c5('0x15')][_0x90b498]){if(_[_0xa9c5('0x6d')](this[_0xa9c5('0x15')][_0x90b498][_0xa9c5('0x14f')])){this[_0xa9c5('0x15')][_0x90b498][_0xa9c5('0x14f')]={};}this['actions'][_0x90b498]['variables'][_0x314f21]=_0x4e1931;}};Preview[_0xa9c5('0x68')][_0xa9c5('0x22')]=function(_0x7698d5){try{if(!_['isNil'](_0x7698d5)){if(ut['filterKey'](_[_0xa9c5('0x150')](_0x7698d5[_0xa9c5('0x151')])[0x0])){this[_0xa9c5('0x14e')](_0x7698d5[_0xa9c5('0xb3')],_['keys'](_0x7698d5[_0xa9c5('0x151')])[0x0],_0x7698d5['value']);}}}catch(_0xc1126c){logger[_0xa9c5('0x152')]('[syncVarSet][Preview]',util[_0xa9c5('0x153')](_0xc1126c,{'showHidden':![],'depth':null}));}};Preview[_0xa9c5('0x68')][_0xa9c5('0x24')]=function(_0x440f3d){if(_0x440f3d){if(this[_0xa9c5('0x15')][_0x440f3d['transfertargetlinkedid']]){this[_0xa9c5('0x15')][_0x440f3d['transfertargetlinkedid']]['transfer']=!![];}}};Preview['prototype'][_0xa9c5('0x26')]=function(_0x4be8cd){if(_0x4be8cd){if(this[_0xa9c5('0x15')][_0x4be8cd[_0xa9c5('0x154')]]){this[_0xa9c5('0x15')][_0x4be8cd[_0xa9c5('0x154')]][_0xa9c5('0x14c')]=!![];}}};module[_0xa9c5('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 974533d..05e0201 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 _0x060b=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20'];(function(_0x5a67b5,_0x362f51){var _0x395096=function(_0x1206c3){while(--_0x1206c3){_0x5a67b5['push'](_0x5a67b5['shift']());}};_0x395096(++_0x362f51);}(_0x060b,0x131));var _0xb060=function(_0x358d54,_0xe737c4){_0x358d54=_0x358d54-0x0;var _0x48739f=_0x060b[_0x358d54];return _0x48739f;};'use strict';var util=require(_0xb060('0x0'));var BPromise=require(_0xb060('0x1'));var logger=require(_0xb060('0x2'))('preview');var _=require(_0xb060('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xb060('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xb060('0x5'));var voiceQueueRt=require(_0xb060('0x6'));var agentReportPreview=require(_0xb060('0x7'));var voiceQueueReport=require(_0xb060('0x8'));function loggerCatch(_0x5c2ea5){return function(_0x4fe83e){logger[_0xb060('0x9')](_0x5c2ea5,util['inspect'](_0x4fe83e,{'showHidden':![],'depth':null}));};}function create(_0x17f2b6){return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](cmHopperHistory[_0xb060('0xc')](_0x17f2b6))[_0xb060('0xd')](loggerCatch(_0xb060('0xe')));}function createAgent(_0x3ef273){return BPromise['resolve']()[_0xb060('0xb')](agentReportPreview[_0xb060('0xc')](_0x3ef273))[_0xb060('0xd')](loggerCatch(_0xb060('0xe')));}function moveContact(_0x42ea0f){return BPromise['resolve']()[_0xb060('0xb')](cmHopper[_0xb060('0xf')](_0x42ea0f,!![]))[_0xb060('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xb060('0x10')]=function(_0x36a63e){return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](cmHopperBlack[_0xb060('0x10')](_0x36a63e))[_0xb060('0xd')](loggerCatch(_0xb060('0x11')));};exports[_0xb060('0x12')]=function(_0xeaa19e){return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](cmHopper[_0xb060('0x12')](_0xeaa19e))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xb060('0xc')]=function(_0x3777a0,_0x38f42b){create(_0x3777a0)['catch'](loggerCatch(_0x38f42b));moveContact(_0x3777a0)[_0xb060('0xd')](loggerCatch(_0x38f42b));};exports[_0xb060('0x13')]=function(_0x5a291d,_0x5cfd94){createAgent(_0x5a291d)['catch'](loggerCatch(_0x5cfd94));};exports[_0xb060('0x14')]=function(_0x4a8406,_0x3d345b){create(_0x4a8406)[_0xb060('0xd')](loggerCatch(_0x3d345b));};exports[_0xb060('0x15')]=function(_0x516de7,_0x327843){moveContact(_0x516de7)[_0xb060('0xd')](loggerCatch(_0x327843));};exports[_0xb060('0x16')]=function(_0x1032de,_0x3179ba,_0x3a5990){if(_0x3179ba){_0x1032de['UserId']=null;}if(_0x3a5990){_0x1032de[_0xb060('0x17')]=![];}return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](cmHopper[_0xb060('0x16')](_0x1032de))[_0xb060('0xd')](loggerCatch(_0xb060('0x18')));};exports[_0xb060('0x19')]=function(_0x3efd92){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0x3efd92))[_0xb060('0xd')](loggerCatch(_0xb060('0x1a')));};exports[_0xb060('0x1b')]=function(_0x119036){return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](cmHopper[_0xb060('0x1b')]({'UserId':null},_0x119036,0x1))[_0xb060('0xd')](loggerCatch(_0xb060('0x1c')));};exports['disableContact']=function(_0x4c13d1){return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](cmHopper['unlockContact']({'active':![]},_0x4c13d1,0x1))[_0xb060('0xd')](loggerCatch('[activeContact]\x20'));};exports[_0xb060('0x1d')]=function(_0x460fc9){var _0x2e4f24={};_0x2e4f24[_0xb060('0x1e')]=_0x460fc9['type'];_0x2e4f24[_0xb060('0x1f')]=_0x460fc9[_0xb060('0x1f')];_0x2e4f24[_0xb060('0x20')]=_0x460fc9['calleridnum'];_0x2e4f24['calleridname']=_0x460fc9[_0xb060('0x21')];_0x2e4f24['queue']=_0x460fc9[_0xb060('0x22')];_0x2e4f24['queuecallerjoinAt']=_0x460fc9['answertime'];_0x2e4f24[_0xb060('0x23')]=_0x460fc9[_0xb060('0x24')];_0x2e4f24[_0xb060('0x25')]=0x1;_0x2e4f24['queuecallercompleteAt']=_0x460fc9[_0xb060('0x26')];_0x2e4f24[_0xb060('0x27')]=_0x460fc9['membername'];_0x2e4f24[_0xb060('0x28')]=_0xb060('0x29');_0x2e4f24['exten']=_0xb060('0x2a');_0x2e4f24[_0xb060('0x2b')]=0x0;_0x2e4f24[_0xb060('0x2c')]=0x1;_0x2e4f24[_0xb060('0x2d')]=_0x460fc9[_0xb060('0x2e')];_0x2e4f24[_0xb060('0x2f')]=_0xb060('0x30');return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](voiceQueueReport[_0xb060('0x31')](_0x2e4f24))[_0xb060('0xd')](loggerCatch(_0xb060('0x32')));};exports[_0xb060('0x33')]=function(_0x23d02c,_0x5961e7){return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](cmHopper[_0xb060('0x33')](_0x23d02c,_0x5961e7))[_0xb060('0xd')](loggerCatch(_0xb060('0x34')));};exports[_0xb060('0x35')]=function(_0x3168c0){return BPromise[_0xb060('0xa')]()[_0xb060('0xb')](cmHopper['rescheduleContact'](_0x3168c0,!![],!![]))[_0xb060('0xd')](loggerCatch(_0xb060('0x36')));}; \ No newline at end of file +var _0x31b8=['unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20'];(function(_0x2c366f,_0x1bd4f8){var _0x180634=function(_0x5dcd2c){while(--_0x5dcd2c){_0x2c366f['push'](_0x2c366f['shift']());}};_0x180634(++_0x1bd4f8);}(_0x31b8,0x194));var _0x831b=function(_0x50b44d,_0x744216){_0x50b44d=_0x50b44d-0x0;var _0x267805=_0x31b8[_0x50b44d];return _0x267805;};'use strict';var util=require(_0x831b('0x0'));var BPromise=require(_0x831b('0x1'));var logger=require('../../../config/logger')(_0x831b('0x2'));var _=require(_0x831b('0x3'));var cmHopper=require(_0x831b('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x831b('0x5'));var cmHopperBlack=require(_0x831b('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x831b('0x7'));var voiceQueueReport=require(_0x831b('0x8'));function loggerCatch(_0x56fcb1){return function(_0x434709){logger[_0x831b('0x9')](_0x56fcb1,util['inspect'](_0x434709,{'showHidden':![],'depth':null}));};}function create(_0x4078ce){return BPromise[_0x831b('0xa')]()[_0x831b('0xb')](cmHopperHistory[_0x831b('0xc')](_0x4078ce))[_0x831b('0xd')](loggerCatch(_0x831b('0xe')));}function createAgent(_0x1a3fcf){return BPromise[_0x831b('0xa')]()[_0x831b('0xb')](agentReportPreview[_0x831b('0xc')](_0x1a3fcf))[_0x831b('0xd')](loggerCatch(_0x831b('0xe')));}function moveContact(_0x56e061){return BPromise[_0x831b('0xa')]()[_0x831b('0xb')](cmHopper['moveContactManagedDialer'](_0x56e061,!![]))['catch'](loggerCatch(_0x831b('0xf')));}exports[_0x831b('0x10')]=function(_0xaaedc8){return BPromise[_0x831b('0xa')]()[_0x831b('0xb')](cmHopperBlack[_0x831b('0x10')](_0xaaedc8))[_0x831b('0xd')](loggerCatch(_0x831b('0x11')));};exports['getContactPreview']=function(_0x26514e){return BPromise[_0x831b('0xa')]()[_0x831b('0xb')](cmHopper[_0x831b('0x12')](_0x26514e))[_0x831b('0xd')](loggerCatch(_0x831b('0x13')));};exports[_0x831b('0xc')]=function(_0x1f7368,_0x5b8a0f){create(_0x1f7368)[_0x831b('0xd')](loggerCatch(_0x5b8a0f));moveContact(_0x1f7368)[_0x831b('0xd')](loggerCatch(_0x5b8a0f));};exports[_0x831b('0x14')]=function(_0x137a3a,_0x1f0cd8){createAgent(_0x137a3a)[_0x831b('0xd')](loggerCatch(_0x1f0cd8));};exports[_0x831b('0x15')]=function(_0x1c1baf,_0x14892e){create(_0x1c1baf)[_0x831b('0xd')](loggerCatch(_0x14892e));};exports[_0x831b('0x16')]=function(_0x58a529,_0xf5545){moveContact(_0x58a529)[_0x831b('0xd')](loggerCatch(_0xf5545));};exports[_0x831b('0x17')]=function(_0x3957ed,_0x141b44,_0x2d7e45){if(_0x141b44){_0x3957ed[_0x831b('0x18')]=null;}if(_0x2d7e45){_0x3957ed[_0x831b('0x19')]=![];}return BPromise[_0x831b('0xa')]()[_0x831b('0xb')](cmHopper[_0x831b('0x17')](_0x3957ed))[_0x831b('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x831b('0x1a')]=function(_0x44d0ad){return BPromise['resolve']()[_0x831b('0xb')](cmHopper[_0x831b('0x1a')](_0x44d0ad))['catch'](loggerCatch(_0x831b('0x1b')));};exports[_0x831b('0x1c')]=function(_0x1d7b6a){return BPromise[_0x831b('0xa')]()['then'](cmHopper[_0x831b('0x1c')]({'UserId':null},_0x1d7b6a,0x1))[_0x831b('0xd')](loggerCatch('[unlockContact]\x20'));};exports[_0x831b('0x1d')]=function(_0x95f9a){return BPromise['resolve']()['then'](cmHopper[_0x831b('0x1c')]({'active':![]},_0x95f9a,0x1))['catch'](loggerCatch(_0x831b('0x1e')));};exports[_0x831b('0x1f')]=function(_0x46b2f7){var _0x5ae733={};_0x5ae733[_0x831b('0x20')]=_0x46b2f7[_0x831b('0x20')];_0x5ae733['uniqueid']=_0x46b2f7[_0x831b('0x21')];_0x5ae733[_0x831b('0x22')]=_0x46b2f7[_0x831b('0x22')];_0x5ae733[_0x831b('0x23')]=_0x46b2f7[_0x831b('0x23')];_0x5ae733['queue']=_0x46b2f7['queue'];_0x5ae733['queuecallerjoinAt']=_0x46b2f7[_0x831b('0x24')];_0x5ae733[_0x831b('0x25')]=_0x46b2f7[_0x831b('0x24')];_0x5ae733[_0x831b('0x26')]=0x1;_0x5ae733[_0x831b('0x27')]=_0x46b2f7[_0x831b('0x28')];_0x5ae733[_0x831b('0x29')]=_0x46b2f7['membername'];_0x5ae733[_0x831b('0x2a')]=_0x831b('0x2b');_0x5ae733[_0x831b('0x2c')]=_0x831b('0x2d');_0x5ae733['holdtime']=0x0;_0x5ae733['assigned']=0x1;_0x5ae733['lastAssignedTo']=_0x46b2f7['membername'];_0x5ae733[_0x831b('0x2e')]=_0x831b('0x2f');return BPromise['resolve']()[_0x831b('0xb')](voiceQueueReport[_0x831b('0x30')](_0x5ae733))[_0x831b('0xd')](loggerCatch(_0x831b('0x31')));};exports[_0x831b('0x32')]=function(_0x9fa5f7,_0x32bba3){return BPromise[_0x831b('0xa')]()[_0x831b('0xb')](cmHopper['getContactRecallMe'](_0x9fa5f7,_0x32bba3))[_0x831b('0xd')](loggerCatch(_0x831b('0x33')));};exports[_0x831b('0x34')]=function(_0x5cafe9){return BPromise['resolve']()[_0x831b('0xb')](cmHopper[_0x831b('0x17')](_0x5cafe9,!![],!![]))['catch'](loggerCatch(_0x831b('0x35')));}; \ 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 cd7a26f..514cba4 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 _0x981b=['createBody','CampaignId','idContact','type','dialAnswer','scheduledat','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','match','extractCalleridNumber','util','lodash','env','XCALLY_IP_AGI','milliseconds','diff','seconds','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','state','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','active','add','ListId','VoiceQueueId','pTalking','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff'];(function(_0x6ad2c7,_0xb22a9a){var _0x435d5f=function(_0x38ec10){while(--_0x38ec10){_0x6ad2c7['push'](_0x6ad2c7['shift']());}};_0x435d5f(++_0xb22a9a);}(_0x981b,0xa7));var _0xb981=function(_0x10c7ea,_0x46d624){_0x10c7ea=_0x10c7ea-0x0;var _0x5118a9=_0x981b[_0x10c7ea];return _0x5118a9;};'use strict';var util=require(_0xb981('0x0'));var _=require(_0xb981('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xb981('0x2')][_0xb981('0x3')]||'127.0.0.1';function getSeconds(_0x3bceac,_0x15cd2e){var _0x8889bb=moment(_0x3bceac)[_0xb981('0x4')](0x0);var _0x81d6c6=moment(_0x15cd2e)[_0xb981('0x4')](0x0);return _0x8889bb[_0xb981('0x5')](_0x81d6c6,_0xb981('0x6'));}exports['loggerCatch']=function(_0x40fad3){return function(_0x227538){logger[_0xb981('0x7')](_0x40fad3,util[_0xb981('0x8')](_0x227538,{'showHidden':![],'depth':null}));};};exports[_0xb981('0x9')]=function(_0x496186,_0x227d8d){logger[_0xb981('0xa')](_0x496186,util['inspect'](_0x227d8d,{'showHidden':![],'depth':null}));};exports[_0xb981('0xb')]=function(_0x35e9b6,_0x23f287){logger['error'](_0x35e9b6,util[_0xb981('0x8')](_0x23f287,{'showHidden':![],'depth':null}));};exports[_0xb981('0xc')]=function(_0x442278){return function(_0x1b0bfb){logger[_0xb981('0xa')](_0x442278,util['inspect'](_0x1b0bfb,{'showHidden':![],'depth':null}));};};exports[_0xb981('0xd')]=function(_0x36259a,_0x119150,_0x23db59){return{'message':_0x36259a,'unlock':_0x119150,'active':_0x23db59};};exports[_0xb981('0xe')]=function(_0x1bccf9,_0x4fccf5,_0x459b2b){if(!_[_0xb981('0xf')](_0x459b2b)&&_0xb981('0x10')===typeof _0x459b2b&&!_[_0xb981('0x11')](_0x459b2b)){if(!_['isUndefined'](_0x4fccf5)&&_0xb981('0x10')===typeof _0x4fccf5&&!_[_0xb981('0x11')](_0x4fccf5)){return util[_0xb981('0x12')]('\x22%s\x22\x20<%s>',_0x4fccf5,_0x459b2b);}return util[_0xb981('0x12')](_0xb981('0x13'),_0x459b2b,_0x459b2b);}if(!_[_0xb981('0xf')](_0x1bccf9)&&'string'===typeof _0x1bccf9&&!_[_0xb981('0x11')](_0x1bccf9)){return _0x1bccf9;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x46bc52){if(_[_0xb981('0x14')](_0x46bc52)){return![];}return _0x46bc52;};exports['addVariables']=function(_0x3269bb,_0x16707b,_0x1eb564,_0x1b28d4,_0x1dfc8f,_0x3af5e7){var _0x20582a={'XMD-QUEUE':_0x16707b[_0xb981('0x15')]?_0x16707b[_0xb981('0x15')][_0xb981('0x16')]:'','XMD-CALLERID':_0x1b28d4,'XMD-CALLERID-PREVIEW':_0x3af5e7?util[_0xb981('0x12')]('\x22%s\x22\x20<%s>',_0x3af5e7[_0xb981('0x17')],_0x3af5e7[_0xb981('0x18')]):_0x1b28d4,'XMD-DIALID':_0x1dfc8f,'XMD-CONTACTID':_0x16707b[_0xb981('0x19')],'XMD-CDRTYPE':_0xb981('0x1a'),'CALLERID(all)':_0x1b28d4,'XMD-VOICEQUEUEID':_0x16707b['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1eb564,'XMD-DIALTIMEOUT':_0x3269bb['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb981('0x12')](_0xb981('0x1b'),_0x3269bb[_0xb981('0x1c')]?'g':'',_[_0xb981('0x11')](_0x3269bb[_0xb981('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3269bb[_0xb981('0x1e')]||'','XMD-AGI':_0x3269bb[_0xb981('0x1f')]?util[_0xb981('0x12')](_0xb981('0x20'),ipAgi,_0x3269bb['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3269bb[_0xb981('0x1c')]?util[_0xb981('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3269bb['dialQueueProject2']):_0xb981('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x3af5e7?_0x3af5e7[_0xb981('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x3af5e7?_0x3af5e7[_0xb981('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xb981('0x11')](_0x3269bb[_0xb981('0x1d')])){_0x20582a[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3269bb[_0xb981('0x1d')];_0x20582a[util[_0xb981('0x12')]('%s',_0xb981('0x24'))]=_0x1dfc8f;}if(_0x16707b&&_0x16707b[_0xb981('0x25')]){for(var _0x563e5e in _0x16707b[_0xb981('0x25')]){if(_0x16707b[_0xb981('0x25')][_0xb981('0x26')](_0x563e5e)){if(!_[_0xb981('0x14')](_0x16707b[_0xb981('0x25')][_0x563e5e])&&_0x563e5e!=='id'&&_0x563e5e!==_0xb981('0x27')&&_0x563e5e!=='createdAt'&&_0x563e5e!==_0xb981('0x28')){_0x20582a[util[_0xb981('0x12')](_0xb981('0x29'),_0xb981('0x2a'),_['toUpper'](_0x563e5e))]=_0x16707b[_0xb981('0x25')][_0x563e5e];}}}}return _0x20582a;};exports['toLowerVariables']=function(_0x198018){var _0x3d9d84={};for(var _0x109ece in _0x198018){if(_0x198018[_0xb981('0x26')](_0x109ece)){_0x3d9d84[util[_0xb981('0x12')]('%s',_[_0xb981('0x2b')](_0x109ece))]=_0x198018[_0x109ece];}}return{'variables':_0x3d9d84};};exports[_0xb981('0x2c')]=function(_0x5f4447,_0x5d6255){if(!_[_0xb981('0x14')](_0x5f4447)){if(_0x5f4447[_0xb981('0x26')](_0xb981('0x2d'))){if(_0x5f4447['originated']>0x0){_0x5f4447[_0xb981('0x2d')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5d6255);}}}else{logger[_0xb981('0x7')](_0xb981('0x2e'),_0x5d6255);}};exports['logBlacklist']=function(_0x5dfd5e){var _0x4afc50=moment()[_0xb981('0x12')](_0xb981('0x2f'));_0x5dfd5e['state']=0xd;_0x5dfd5e[_0xb981('0x30')]=_0xb981('0x31');_0x5dfd5e[_0xb981('0x32')]=_0x4afc50;_0x5dfd5e[_0xb981('0x33')]=_0x4afc50;_0x5dfd5e[_0xb981('0x34')]=_0x4afc50;};exports[_0xb981('0x35')]=function(_0xc4e49,_0x452925,_0x36058e){var _0x19236f=moment()[_0xb981('0x12')](_0xb981('0x2f'));_0xc4e49['state']=_0x452925;_0xc4e49[_0xb981('0x30')]=_0x36058e;_0xc4e49[_0xb981('0x33')]=_0x19236f;_0xc4e49[_0xb981('0x36')]=getSeconds(_0xc4e49['responsetime'],_0xc4e49[_0xb981('0x32')]);};exports[_0xb981('0x37')]=function(_0x4ad85e,_0x1f276b,_0x75a083){_0x4ad85e[_0xb981('0x38')]=_0x1f276b;_0x4ad85e[_0xb981('0x39')]=_0x75a083;};exports[_0xb981('0x3a')]=function(_0x2524ff,_0x5bb11c,_0x5b9092){var _0x3a8dc2=moment()['format'](_0xb981('0x2f'));_0x2524ff[_0xb981('0x3b')]=_0x5bb11c;_0x2524ff['statedesc']=_0x5b9092;_0x2524ff[_0xb981('0x33')]=_0x2524ff[_0xb981('0x33')]?_0x2524ff[_0xb981('0x33')]:_0x3a8dc2;_0x2524ff[_0xb981('0x34')]=_0x2524ff[_0xb981('0x34')]?_0x2524ff[_0xb981('0x34')]:_0x3a8dc2;_0x2524ff[_0xb981('0x36')]=getSeconds(_0x2524ff[_0xb981('0x33')]||0x0,_0x2524ff['starttime']||0x0);_0x2524ff[_0xb981('0x3c')]=_0x2524ff[_0xb981('0x3d')]?getSeconds(_0x2524ff[_0xb981('0x34')],_0x2524ff['answertime']):0x0;};exports[_0xb981('0x3e')]=function(_0xf077f0){return _0xf077f0===_0xb981('0x3f');};exports[_0xb981('0x40')]=function(_0x4e3981,_0x2df69f,_0x296ecd,_0x4d6a30,_0x11ab68){var _0xdadef8=_0x4d6a30?_0xb981('0x41'):_0x4e3981[_0xb981('0x17')];_0xdadef8=_0x11ab68?'BOOKED':_0xdadef8;return{'actionid':_0x4e3981[_0xb981('0x42')],'action':'originate','channel':_0x4e3981[_0xb981('0x43')],'callerid':util[_0xb981('0x12')]('\x22%s\x22\x20<%s>',_0xdadef8,_0x4e3981[_0xb981('0x18')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x296ecd,'timeout':(_0x2df69f[_0xb981('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e3981[_0xb981('0x42')]};};exports[_0xb981('0x45')]=function(_0x4cf610){return _0x4cf610[_0xb981('0x46')]+_0x4cf610[_0xb981('0x47')]+_0x4cf610['countnoanswerretry']+_0x4cf610[_0xb981('0x48')]+_0x4cf610[_0xb981('0x49')];};exports[_0xb981('0x4a')]=function(_0x3a9bfa){var _0x2dc24a=_[_0xb981('0x4b')](_0x3a9bfa);_0x2dc24a[_0xb981('0x3b')]=0xf;_0x2dc24a[_0xb981('0x30')]='Global';return _0x2dc24a;};exports['scheduledAt']=function(_0x512726,_0x4b1cd8,_0x47b724){var _0x28ed33={};_0x28ed33[_0x4b1cd8]=_0x512726[_0x4b1cd8];_0x28ed33[_0xb981('0x4c')]=![];_0x28ed33['scheduledat']=moment()[_0xb981('0x4d')](_0x47b724,'minutes')[_0xb981('0x12')](_0xb981('0x2f'));_0x28ed33[_0xb981('0x19')]=_0x512726['ContactId'];_0x28ed33['ListId']=_0x512726[_0xb981('0x4e')];_0x28ed33[_0xb981('0x4f')]=_0x512726[_0xb981('0x4f')]||undefined;return _0x28ed33;};exports['decrementTalkink']=function(_0x5e8030,_0x144ce1){if(!_['isNil'](_0x5e8030)){if(_0x5e8030[_0xb981('0x50')]>0x0){_0x5e8030[_0xb981('0x50')]-=0x1;}else{logger['error'](_0x144ce1,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x144ce1,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xb981('0x51')]=function(_0x46c1da){if(_0x46c1da<=0x0){return!![];}return![];};exports['buildObj']=function(_0xee3ef1,_0x2a84a6,_0x2635af){_0xee3ef1[_0xb981('0x52')]=_0x2a84a6;_0xee3ef1[_0xb981('0x16')]=_0xee3ef1[_0xb981('0x53')];_0xee3ef1[_0xb981('0x54')]=_0xee3ef1['channelAgent'];_0xee3ef1[_0xb981('0x55')]=_0xb981('0x56');if(_0x2635af){_0xee3ef1[_0xb981('0x57')]=_0x2635af['mandatoryDisposition'];}return _0xee3ef1;};exports[_0xb981('0x58')]=function(_0x3e9303){var _0x24ec52={};_0x24ec52[_0xb981('0x53')]=_0x3e9303['queue'];_0x24ec52[_0xb981('0x54')]=_0x3e9303[_0xb981('0x43')];_0x24ec52['uniqueid']=_0x3e9303['uniqueid'];return _0x24ec52;};exports[_0xb981('0x59')]=function(_0xe740b7){var _0x4e343c=[];for(var _0x355ecd in _0xe740b7){if(_0xe740b7[_0xb981('0x26')](_0x355ecd)){if(!_[_0xb981('0x14')](_0xe740b7[_0x355ecd])&&_0xe740b7[_0x355ecd][_0xb981('0x3b')]===_0xb981('0x5a')&&_0xe740b7[_0x355ecd][_0xb981('0x5b')]===_0xb981('0x5c')){_0x4e343c[_0xb981('0x5d')](_0xe740b7[_0x355ecd]['id']);}}}return _0x4e343c;};exports[_0xb981('0x5e')]=function(_0x5df4e9){var _0x3e0f8a=moment()[_0xb981('0x4')](0x0);var _0x1aeb9a=moment(_0x5df4e9)[_0xb981('0x4')](0x0);return _0x3e0f8a[_0xb981('0x5')](_0x1aeb9a,_0xb981('0x6'));};exports[_0xb981('0x5f')]=function(_0x59ccdb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x59ccdb[_0xb981('0x19')],'ListId':_0x59ccdb[_0xb981('0x4e')],'VoiceQueueId':_0x59ccdb[_0xb981('0x4f')]||undefined,'CampaignId':_0x59ccdb[_0xb981('0x60')]||undefined};};exports['filterKey']=function(_0x556a35){if(_0x556a35===_0xb981('0x42')||_0x556a35===_0xb981('0x61')||_0x556a35==='queue'||_0x556a35===_0xb981('0x62')||_0x556a35==='campaigntype'||_0x556a35===_0xb981('0x63')||_0x556a35===_0xb981('0x38')||_0x556a35===_0xb981('0x43')||_0x556a35===_0xb981('0x17')||_0x556a35===_0xb981('0x4c')||_0x556a35===_0xb981('0x18')||_0x556a35===_0xb981('0x64')||_0x556a35===_0xb981('0x46')||_0x556a35===_0xb981('0x47')||_0x556a35==='countnoanswerretry'||_0x556a35==='countglobal'||_0x556a35===_0xb981('0x65')||_0x556a35===_0xb981('0x66')||_0x556a35===_0xb981('0x67')||_0x556a35===_0xb981('0x68')||_0x556a35===_0xb981('0x19')||_0x556a35===_0xb981('0x4e')||_0x556a35===_0xb981('0x39')||_0x556a35===_0xb981('0x4f')||_0x556a35===_0xb981('0x69')||_0x556a35===_0xb981('0x6a')||_0x556a35==='xmd-queue'||_0x556a35===_0xb981('0x6b')||_0x556a35===_0xb981('0x6c')||_0x556a35===_0xb981('0x6d')||_0x556a35==='xmd-dialtimeout'||_0x556a35===_0xb981('0x6e')||_0x556a35===_0xb981('0x6f')||_0x556a35===_0xb981('0x70')||_0x556a35===_0xb981('0x71')||_0x556a35==='xmd-cdrtype'||_0x556a35===_0xb981('0x72')||_0x556a35===_0xb981('0x73')||_0x556a35==='xmd-agi'||_0x556a35===_0xb981('0x74')||_0x556a35===_0xb981('0x75')||_0x556a35===_0xb981('0x76')||_0x556a35==='rtpaudioqosjitterbridged'||_0x556a35===_0xb981('0x77')||_0x556a35==='rtpaudioqoslossbridged'||_0x556a35===_0xb981('0x78')||_0x556a35===_0xb981('0x79')||_0x556a35===_0xb981('0x74')||_0x556a35===_0xb981('0x75')||_0x556a35===_0xb981('0x76')||_0x556a35===_0xb981('0x7a')||_0x556a35==='rtpaudioqosloss'||_0x556a35===_0xb981('0x7b')||_0x556a35===_0xb981('0x78')||_0x556a35==='rtpaudioqosrttbridged'||_0x556a35===_0xb981('0x7c')||_0x556a35===_0xb981('0x7d')||_0x556a35===_0xb981('0x3b')||_0x556a35===_0xb981('0x30')){return![];}return!![];};exports[_0xb981('0x7e')]=function(_0x20d744,_0x38714a){var _0x546493,_0x56b34e,_0x4c9bc3;if(_0x38714a<=0x0){_0x38714a=0x1;}_0x546493=new RegExp('\x5cw{0,'+_0x38714a+'}$');_0x56b34e=Math[_0xb981('0x7f')](0xa,_0x38714a-0x1);_0x4c9bc3=Math[_0xb981('0x7f')](0xa,_0x38714a)-0x1;return util['format']('%s',_['replace'](_0x20d744,_0x546493,_[_0xb981('0x80')](_0x56b34e,_0x4c9bc3)));};exports['extractCalleridName']=function(_0x3fe09){var _0xfdecae=_0x3fe09[_0xb981('0x81')](/"(.*?)"/);return _0xfdecae?_0xfdecae[0x1]:_0x3fe09;};exports[_0xb981('0x82')]=function(_0xac0668){var _0x5d3b43=_0xac0668['match'](/<(.*?)>/);return _0x5d3b43?_0x5d3b43[0x1]:_0xac0668;}; \ No newline at end of file +var _0xdb3a=['mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','format','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','Contact','hasOwnProperty','updatedAt','%s%s','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','logLookAgent','membername','UserId','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','queue','interface','voice'];(function(_0x3a5507,_0x352b53){var _0x2efaeb=function(_0x49ea40){while(--_0x49ea40){_0x3a5507['push'](_0x3a5507['shift']());}};_0x2efaeb(++_0x352b53);}(_0xdb3a,0xc1));var _0xadb3=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xdb3a[_0x1bf809];return _0x1caa4e;};'use strict';var util=require('util');var _=require(_0xadb3('0x0'));var moment=require(_0xadb3('0x1'));var logger=require(_0xadb3('0x2'))('preview');var ipAgi=process['env'][_0xadb3('0x3')]||_0xadb3('0x4');function getSeconds(_0x323caa,_0x48a240){var _0x3d3e28=moment(_0x323caa)[_0xadb3('0x5')](0x0);var _0x2f370d=moment(_0x48a240)[_0xadb3('0x5')](0x0);return _0x3d3e28['diff'](_0x2f370d,'seconds');}exports[_0xadb3('0x6')]=function(_0x13f2a9){return function(_0x13997d){logger[_0xadb3('0x7')](_0x13f2a9,util[_0xadb3('0x8')](_0x13997d,{'showHidden':![],'depth':null}));};};exports[_0xadb3('0x9')]=function(_0x250806,_0x110534){logger['info'](_0x250806,util[_0xadb3('0x8')](_0x110534,{'showHidden':![],'depth':null}));};exports[_0xadb3('0xa')]=function(_0x1209f3,_0x4ac112){logger['error'](_0x1209f3,util[_0xadb3('0x8')](_0x4ac112,{'showHidden':![],'depth':null}));};exports[_0xadb3('0xb')]=function(_0x49cda8){return function(_0x5f79e9){logger[_0xadb3('0xc')](_0x49cda8,util['inspect'](_0x5f79e9,{'showHidden':![],'depth':null}));};};exports[_0xadb3('0xd')]=function(_0xe5ea0d,_0x44bc10,_0x16e914){return{'message':_0xe5ea0d,'unlock':_0x44bc10,'active':_0x16e914};};exports[_0xadb3('0xe')]=function(_0xf56f1f,_0x125aaa,_0x23aca8){if(!_[_0xadb3('0xf')](_0x23aca8)&&_0xadb3('0x10')===typeof _0x23aca8&&!_[_0xadb3('0x11')](_0x23aca8)){if(!_['isUndefined'](_0x125aaa)&&_0xadb3('0x10')===typeof _0x125aaa&&!_['isEmpty'](_0x125aaa)){return util['format'](_0xadb3('0x12'),_0x125aaa,_0x23aca8);}return util['format'](_0xadb3('0x12'),_0x23aca8,_0x23aca8);}if(!_[_0xadb3('0xf')](_0xf56f1f)&&_0xadb3('0x10')===typeof _0xf56f1f&&!_[_0xadb3('0x11')](_0xf56f1f)){return _0xf56f1f;}return _0xadb3('0x13');};exports[_0xadb3('0x14')]=function(_0x2dfd27){if(_[_0xadb3('0x15')](_0x2dfd27)){return![];}return _0x2dfd27;};exports[_0xadb3('0x16')]=function(_0x28de8f,_0x5662de,_0x44417c,_0x36811e,_0xfb32c3,_0x4982b1){var _0x9b4a86={'XMD-QUEUE':_0x5662de[_0xadb3('0x17')]?_0x5662de[_0xadb3('0x17')][_0xadb3('0x18')]:'','XMD-CALLERID':_0x36811e,'XMD-CALLERID-PREVIEW':_0x4982b1?util[_0xadb3('0x19')](_0xadb3('0x12'),_0x4982b1[_0xadb3('0x1a')],_0x4982b1[_0xadb3('0x1b')]):_0x36811e,'XMD-DIALID':_0xfb32c3,'XMD-CONTACTID':_0x5662de[_0xadb3('0x1c')],'XMD-CDRTYPE':_0xadb3('0x1d'),'CALLERID(all)':_0x36811e,'XMD-VOICEQUEUEID':_0x5662de[_0xadb3('0x1e')],'XMD-DIALCHANNEL':_0x44417c,'XMD-DIALTIMEOUT':_0x28de8f[_0xadb3('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xadb3('0x19')](_0xadb3('0x20'),_0x28de8f['dialQueueProject2']?'g':'',_[_0xadb3('0x11')](_0x28de8f['monitor_format'])?'':_0xadb3('0x21')),'XMD-DIALURL':_0x28de8f[_0xadb3('0x22')]||'','XMD-AGI':_0x28de8f[_0xadb3('0x23')]?util['format'](_0xadb3('0x24'),ipAgi,_0x28de8f['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x28de8f[_0xadb3('0x25')]?util[_0xadb3('0x19')]('\x22agi://%s/square,%s\x22',ipAgi,_0x28de8f[_0xadb3('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4982b1?_0x4982b1[_0xadb3('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x4982b1?_0x4982b1[_0xadb3('0x27')]:'','XMD-DESTINATION':_0xadb3('0x28'),'SIPADDHEADER':_0xadb3('0x29')};if(!_[_0xadb3('0x11')](_0x28de8f['monitor_format'])){_0x9b4a86[util[_0xadb3('0x19')]('%s',_0xadb3('0x2a'))]=_0x28de8f[_0xadb3('0x2b')];_0x9b4a86[util[_0xadb3('0x19')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xfb32c3;}if(_0x5662de&&_0x5662de['Contact']){for(var _0x2e0668 in _0x5662de[_0xadb3('0x2c')]){if(_0x5662de[_0xadb3('0x2c')][_0xadb3('0x2d')](_0x2e0668)){if(!_[_0xadb3('0x15')](_0x5662de[_0xadb3('0x2c')][_0x2e0668])&&_0x2e0668!=='id'&&_0x2e0668!=='tags'&&_0x2e0668!=='createdAt'&&_0x2e0668!==_0xadb3('0x2e')){_0x9b4a86[util['format'](_0xadb3('0x2f'),'XMD-',_['toUpper'](_0x2e0668))]=_0x5662de[_0xadb3('0x2c')][_0x2e0668];}}}}return _0x9b4a86;};exports[_0xadb3('0x30')]=function(_0x33b5f5){var _0x439561={};for(var _0x55ff25 in _0x33b5f5){if(_0x33b5f5[_0xadb3('0x2d')](_0x55ff25)){_0x439561[util['format']('%s',_[_0xadb3('0x31')](_0x55ff25))]=_0x33b5f5[_0x55ff25];}}return{'variables':_0x439561};};exports['updateOriginated']=function(_0x18b5ea,_0xa137ab){if(!_['isNil'](_0x18b5ea)){if(_0x18b5ea[_0xadb3('0x2d')](_0xadb3('0x32'))){if(_0x18b5ea[_0xadb3('0x32')]>0x0){_0x18b5ea[_0xadb3('0x32')]-=0x1;}else{logger[_0xadb3('0x7')](_0xadb3('0x33'),_0xa137ab);}}}else{logger['error'](_0xadb3('0x34'),_0xa137ab);}};exports[_0xadb3('0x35')]=function(_0x318f33){var _0xebdeb8=moment()[_0xadb3('0x19')](_0xadb3('0x36'));_0x318f33[_0xadb3('0x37')]=0xd;_0x318f33['statedesc']=_0xadb3('0x38');_0x318f33[_0xadb3('0x39')]=_0xebdeb8;_0x318f33[_0xadb3('0x3a')]=_0xebdeb8;_0x318f33[_0xadb3('0x3b')]=_0xebdeb8;};exports[_0xadb3('0x3c')]=function(_0x412cd3,_0x2a63a7,_0x22e169){var _0x56e273=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x412cd3[_0xadb3('0x37')]=_0x2a63a7;_0x412cd3[_0xadb3('0x3d')]=_0x22e169;_0x412cd3[_0xadb3('0x3a')]=_0x56e273;_0x412cd3['ringtime']=getSeconds(_0x412cd3[_0xadb3('0x3a')],_0x412cd3[_0xadb3('0x39')]);};exports[_0xadb3('0x3e')]=function(_0x511381,_0xae6177,_0x24b646){_0x511381[_0xadb3('0x3f')]=_0xae6177;_0x511381[_0xadb3('0x40')]=_0x24b646;};exports['logCustomer']=function(_0x519fb5,_0x405dc3,_0x3bf52f){var _0x8362aa=moment()[_0xadb3('0x19')](_0xadb3('0x36'));_0x519fb5[_0xadb3('0x37')]=_0x405dc3;_0x519fb5[_0xadb3('0x3d')]=_0x3bf52f;_0x519fb5[_0xadb3('0x3a')]=_0x519fb5[_0xadb3('0x3a')]?_0x519fb5[_0xadb3('0x3a')]:_0x8362aa;_0x519fb5[_0xadb3('0x3b')]=_0x519fb5[_0xadb3('0x3b')]?_0x519fb5[_0xadb3('0x3b')]:_0x8362aa;_0x519fb5[_0xadb3('0x41')]=getSeconds(_0x519fb5[_0xadb3('0x3a')]||0x0,_0x519fb5['starttime']||0x0);_0x519fb5[_0xadb3('0x42')]=_0x519fb5['answertime']?getSeconds(_0x519fb5[_0xadb3('0x3b')],_0x519fb5[_0xadb3('0x43')]):0x0;};exports[_0xadb3('0x44')]=function(_0x4e9b14){return _0x4e9b14===_0xadb3('0x45');};exports[_0xadb3('0x46')]=function(_0x307df8,_0x4c3471,_0x2c9438,_0x1fa3cc,_0x1ef2b9){var _0x48c60d=_0x1fa3cc?_0xadb3('0x47'):_0x307df8['calleridname'];_0x48c60d=_0x1ef2b9?_0xadb3('0x48'):_0x48c60d;return{'actionid':_0x307df8['uniqueid'],'action':'originate','channel':_0x307df8[_0xadb3('0x49')],'callerid':util[_0xadb3('0x19')](_0xadb3('0x12'),_0x48c60d,_0x307df8['calleridnum']),'Exten':_0xadb3('0x28'),'Context':_0xadb3('0x4a'),'Priority':'1','variable':_0x2c9438,'timeout':(_0x4c3471[_0xadb3('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x307df8[_0xadb3('0x4c')]};};exports[_0xadb3('0x4d')]=function(_0x38332d){return _0x38332d[_0xadb3('0x4e')]+_0x38332d['countcongestionretry']+_0x38332d[_0xadb3('0x4f')]+_0x38332d[_0xadb3('0x50')]+_0x38332d[_0xadb3('0x51')];};exports['cloneAction']=function(_0x1b47d2){var _0x4cd629=_[_0xadb3('0x52')](_0x1b47d2);_0x4cd629[_0xadb3('0x37')]=0xf;_0x4cd629['statedesc']=_0xadb3('0x53');return _0x4cd629;};exports[_0xadb3('0x54')]=function(_0x5d8615,_0x3a8b3c,_0x5498fc){var _0x35db3b={};_0x35db3b[_0x3a8b3c]=_0x5d8615[_0x3a8b3c];_0x35db3b[_0xadb3('0x55')]=![];_0x35db3b[_0xadb3('0x56')]=moment()[_0xadb3('0x57')](_0x5498fc,_0xadb3('0x58'))[_0xadb3('0x19')]('YYYY-MM-DD\x20HH:mm:ss');_0x35db3b[_0xadb3('0x1c')]=_0x5d8615[_0xadb3('0x1c')];_0x35db3b[_0xadb3('0x59')]=_0x5d8615[_0xadb3('0x59')];_0x35db3b['VoiceQueueId']=_0x5d8615['VoiceQueueId']||undefined;return _0x35db3b;};exports[_0xadb3('0x5a')]=function(_0x4daa7f,_0x6675a6){if(!_['isNil'](_0x4daa7f)){if(_0x4daa7f['pTalking']>0x0){_0x4daa7f['pTalking']-=0x1;}else{logger['error'](_0x6675a6,_0xadb3('0x5b'));}}else{logger['error'](_0x6675a6,_0xadb3('0x5c'));}};exports['IsNotLoggedIn']=function(_0x91115c){if(_0x91115c<=0x0){return!![];}return![];};exports[_0xadb3('0x5d')]=function(_0x94ad92,_0x46d92e,_0x25f450){_0x94ad92['lastevent']=_0x46d92e;_0x94ad92['name']=_0x94ad92[_0xadb3('0x5e')];_0x94ad92[_0xadb3('0x5f')]=_0x94ad92['channelAgent'];_0x94ad92['motionChannel']=_0xadb3('0x60');if(_0x25f450){_0x94ad92[_0xadb3('0x61')]=_0x25f450[_0xadb3('0x61')];}return _0x94ad92;};exports[_0xadb3('0x62')]=function(_0x354d8a){var _0x4fb244={};_0x4fb244[_0xadb3('0x5e')]=_0x354d8a['queue'];_0x4fb244[_0xadb3('0x5f')]=_0x354d8a[_0xadb3('0x49')];_0x4fb244['uniqueid']=_0x354d8a[_0xadb3('0x4c')];return _0x4fb244;};exports[_0xadb3('0x63')]=function(_0x43ae1c){var _0x275b92=[];for(var _0x7d87c8 in _0x43ae1c){if(_0x43ae1c[_0xadb3('0x2d')](_0x7d87c8)){if(!_[_0xadb3('0x15')](_0x43ae1c[_0x7d87c8])&&_0x43ae1c[_0x7d87c8][_0xadb3('0x37')]===_0xadb3('0x64')&&_0x43ae1c[_0x7d87c8][_0xadb3('0x65')]==='reachable'){_0x275b92['push'](_0x43ae1c[_0x7d87c8]['id']);}}}return _0x275b92;};exports['getDiff']=function(_0x5091e3){var _0x4f0d2f=moment()[_0xadb3('0x5')](0x0);var _0x406388=moment(_0x5091e3)[_0xadb3('0x5')](0x0);return _0x4f0d2f[_0xadb3('0x66')](_0x406388,_0xadb3('0x67'));};exports[_0xadb3('0x68')]=function(_0xa61b5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xa61b5[_0xadb3('0x1c')],'ListId':_0xa61b5['ListId'],'VoiceQueueId':_0xa61b5[_0xadb3('0x1e')]||undefined,'CampaignId':_0xa61b5[_0xadb3('0x69')]||undefined};};exports[_0xadb3('0x6a')]=function(_0x2846ae){if(_0x2846ae==='uniqueid'||_0x2846ae===_0xadb3('0x6b')||_0x2846ae===_0xadb3('0x5e')||_0x2846ae===_0xadb3('0x6c')||_0x2846ae==='campaigntype'||_0x2846ae===_0xadb3('0x6d')||_0x2846ae===_0xadb3('0x3f')||_0x2846ae===_0xadb3('0x49')||_0x2846ae===_0xadb3('0x1a')||_0x2846ae===_0xadb3('0x55')||_0x2846ae===_0xadb3('0x1b')||_0x2846ae===_0xadb3('0x56')||_0x2846ae==='countbusyretry'||_0x2846ae===_0xadb3('0x6e')||_0x2846ae==='countnoanswerretry'||_0x2846ae===_0xadb3('0x6f')||_0x2846ae===_0xadb3('0x70')||_0x2846ae===_0xadb3('0x71')||_0x2846ae===_0xadb3('0x72')||_0x2846ae===_0xadb3('0x73')||_0x2846ae==='ContactId'||_0x2846ae===_0xadb3('0x59')||_0x2846ae===_0xadb3('0x40')||_0x2846ae===_0xadb3('0x1e')||_0x2846ae==='sipcallid'||_0x2846ae===_0xadb3('0x74')||_0x2846ae===_0xadb3('0x75')||_0x2846ae===_0xadb3('0x76')||_0x2846ae===_0xadb3('0x77')||_0x2846ae===_0xadb3('0x78')||_0x2846ae==='xmd-dialtimeout'||_0x2846ae===_0xadb3('0x79')||_0x2846ae===_0xadb3('0x7a')||_0x2846ae===_0xadb3('0x7b')||_0x2846ae===_0xadb3('0x7c')||_0x2846ae==='xmd-cdrtype'||_0x2846ae===_0xadb3('0x7d')||_0x2846ae===_0xadb3('0x7e')||_0x2846ae==='xmd-agi'||_0x2846ae===_0xadb3('0x7f')||_0x2846ae===_0xadb3('0x80')||_0x2846ae===_0xadb3('0x81')||_0x2846ae===_0xadb3('0x82')||_0x2846ae==='rtpaudioqosloss'||_0x2846ae===_0xadb3('0x83')||_0x2846ae==='rtpaudioqosrtt'||_0x2846ae===_0xadb3('0x84')||_0x2846ae===_0xadb3('0x7f')||_0x2846ae===_0xadb3('0x80')||_0x2846ae===_0xadb3('0x81')||_0x2846ae==='rtpaudioqosjitterbridged'||_0x2846ae===_0xadb3('0x85')||_0x2846ae===_0xadb3('0x83')||_0x2846ae===_0xadb3('0x86')||_0x2846ae===_0xadb3('0x84')||_0x2846ae===_0xadb3('0x87')||_0x2846ae===_0xadb3('0x88')||_0x2846ae===_0xadb3('0x37')||_0x2846ae===_0xadb3('0x3d')){return![];}return!![];};exports[_0xadb3('0x89')]=function(_0x3ab0ac,_0x107696){var _0x54dbe1,_0x1579ba,_0x13ddbd;if(_0x107696<=0x0){_0x107696=0x1;}_0x54dbe1=new RegExp(_0xadb3('0x8a')+_0x107696+'}$');_0x1579ba=Math[_0xadb3('0x8b')](0xa,_0x107696-0x1);_0x13ddbd=Math[_0xadb3('0x8b')](0xa,_0x107696)-0x1;return util[_0xadb3('0x19')]('%s',_[_0xadb3('0x8c')](_0x3ab0ac,_0x54dbe1,_[_0xadb3('0x8d')](_0x1579ba,_0x13ddbd)));};exports[_0xadb3('0x8e')]=function(_0x11996a){var _0x5df6bf=_0x11996a[_0xadb3('0x8f')](/"(.*?)"/);return _0x5df6bf?_0x5df6bf[0x1]:_0x11996a;};exports[_0xadb3('0x90')]=function(_0x557359){var _0x3a9ad1=_0x557359[_0xadb3('0x8f')](/<(.*?)>/);return _0x3a9ad1?_0x3a9ad1[0x1]:_0x557359;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f544bc9..3a64db6 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 _0x2764=['boolean','queueremove','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2764,0xa8));var _0x4276=function(_0x476823,_0x46c089){_0x476823=_0x476823-0x0;var _0x3fb2d7=_0x2764[_0x476823];return _0x3fb2d7;};'use strict';exports[_0x4276('0x0')]={'queue':{'type':_0x4276('0x1'),'required':!![]},'interface':{'type':_0x4276('0x1'),'required':!![]},'membername':{'type':_0x4276('0x1'),'required':!![]},'penalty':{'type':_0x4276('0x2'),'required':![]},'paused':{'type':_0x4276('0x3'),'required':![]}};exports[_0x4276('0x4')]={'queue':{'type':_0x4276('0x1'),'required':!![]},'interface':{'type':_0x4276('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x4276('0x1'),'required':!![]},'paused':{'type':_0x4276('0x3')},'reason':{'type':_0x4276('0x1'),'required':![]}};exports[_0x4276('0x5')]={'module':{'type':_0x4276('0x1'),'required':![]}};exports[_0x4276('0x6')]={'uniqueid':{'type':_0x4276('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x4276('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x4276('0x1')}};exports[_0x4276('0x7')]={'uniqueid':{'type':_0x4276('0x1'),'required':!![]}};exports[_0x4276('0x8')]={'uniqueid':{'type':_0x4276('0x1'),'required':!![]},'exten':{'type':_0x4276('0x1'),'required':!![]},'context':{'type':_0x4276('0x1')}}; \ No newline at end of file +var _0x07f9=['voicequeuechannel','voicechannel','voicequeuechannelredirect','string','number','queuepause','boolean','reload'];(function(_0x29cfba,_0x28c40f){var _0x1f694c=function(_0x526ada){while(--_0x526ada){_0x29cfba['push'](_0x29cfba['shift']());}};_0x1f694c(++_0x28c40f);}(_0x07f9,0x12b));var _0x907f=function(_0x5c2b22,_0x4fdeef){_0x5c2b22=_0x5c2b22-0x0;var _0x1b5007=_0x07f9[_0x5c2b22];return _0x1b5007;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x907f('0x0'),'required':!![]},'membername':{'type':_0x907f('0x0'),'required':!![]},'penalty':{'type':_0x907f('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x907f('0x0'),'required':!![]},'interface':{'type':_0x907f('0x0'),'required':!![]}};exports[_0x907f('0x2')]={'interface':{'type':_0x907f('0x0'),'required':!![]},'paused':{'type':_0x907f('0x3')},'reason':{'type':_0x907f('0x0'),'required':![]}};exports[_0x907f('0x4')]={'module':{'type':'string','required':![]}};exports[_0x907f('0x5')]={'uniqueid':{'type':_0x907f('0x0'),'required':!![]}};exports[_0x907f('0x6')]={'uniqueid':{'type':_0x907f('0x0'),'required':!![]},'filename':{'type':_0x907f('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x907f('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x907f('0x7')]={'uniqueid':{'type':_0x907f('0x0'),'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 17564af..57c3377 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 _0xdddd=['queue','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','telephones','initTrunks','triggers','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','uniqueid'];(function(_0x1c7f48,_0x255687){var _0x274c31=function(_0x58e252){while(--_0x58e252){_0x1c7f48['push'](_0x1c7f48['shift']());}};_0x274c31(++_0x255687);}(_0xdddd,0x15e));var _0xdddd=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0xdddd[_0x495e9f];return _0xb249d2;};'use strict';var BPromise=require(_0xdddd('0x0'));var util=require('util');var _=require(_0xdddd('0x1'));var moment=require(_0xdddd('0x2'));var Agent=require(_0xdddd('0x3'));var Telephone=require(_0xdddd('0x4'));var Trunk=require(_0xdddd('0x5'));var VoiceQueue=require(_0xdddd('0x6'));var Trigger=require('../model/trigger');var Template=require(_0xdddd('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xdddd('0x8'));var ZendeskAccount=require(_0xdddd('0x9'));var SalesforceAccount=require(_0xdddd('0xa'));var FreshdeskAccount=require(_0xdddd('0xb'));var SugarcrmAccount=require(_0xdddd('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xdddd('0xd'));var VtigerAccount=require(_0xdddd('0xe'));var ServicenowAccount=require(_0xdddd('0xf'));var Dynamics365Account=require(_0xdddd('0x10'));var FreshsalesAccount=require(_0xdddd('0x11'));var FaxAccount=require(_0xdddd('0x12'));var Realtime=function(){this[_0xdddd('0x13')]={};this['telephones']={};this[_0xdddd('0x14')]={};this[_0xdddd('0x15')]={};this['triggers']={};this[_0xdddd('0x16')]={};this['templates']={};this[_0xdddd('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xdddd('0x18')]={};this[_0xdddd('0x19')]={};this[_0xdddd('0x1a')]={};this[_0xdddd('0x1b')]={};this[_0xdddd('0x1c')]={};this[_0xdddd('0x1d')]={};this[_0xdddd('0x1e')]={};this[_0xdddd('0x1f')]={};this[_0xdddd('0x20')]={};this['zohoAccounts']={};this[_0xdddd('0x21')]={};this[_0xdddd('0x22')]={};this[_0xdddd('0x23')]={};this[_0xdddd('0x24')]={};this[_0xdddd('0x25')]={};this[_0xdddd('0x26')]={};};function freeIsNotKey(_0xd4f451,_0x33b8b4,_0xd7da8d){var _0x273103=_[_0xdddd('0x27')](_0xd4f451,function(_0x308bd3,_0x36a29a){return _0x308bd3[_0xd7da8d];});for(var _0x81724b in _0x33b8b4){if(_0x33b8b4['hasOwnProperty'](_0x81724b)){if(!_0x273103[_0x81724b]){delete _0x33b8b4[_0x81724b];}}}}function freeIsNotKeySip(_0x57c432,_0x2f3b2c){var _0xe83f3b=_[_0xdddd('0x27')](_0x57c432,function(_0x54bf29,_0x80c599){return util['format']('SIP/%s',_0x54bf29[_0xdddd('0x28')]);});for(var _0x4f7c09 in _0x2f3b2c){if(_0x2f3b2c[_0xdddd('0x29')](_0x4f7c09)){if(!_0xe83f3b[_0x4f7c09]){delete _0x2f3b2c[_0x4f7c09];}}}}function freeIsNotKeyAgent(_0x260beb,_0x30c6ed){var _0x1ca22e=_['mapKeys'](_0x260beb,function(_0x6c9a6e,_0xcfc98b){var _0xfdb71a=_[_0xdddd('0x2a')](_0x6c9a6e[_0xdddd('0x2b')])?util[_0xdddd('0x2c')](_0xdddd('0x2d'),_0x6c9a6e[_0xdddd('0x28')]):_0x6c9a6e[_0xdddd('0x2b')];return _0xfdb71a;});for(var _0x5afff1 in _0x30c6ed){if(_0x30c6ed['hasOwnProperty'](_0x5afff1)){if(!_0x1ca22e[_0x5afff1]){delete _0x30c6ed[_0x5afff1];}}}}function clearVoiceCallReports(_0x2c48bc){_0x2c48bc[_0xdddd('0x2e')]=0x0;_0x2c48bc[_0xdddd('0x2f')]=0x0;_0x2c48bc[_0xdddd('0x30')]=0x0;_0x2c48bc[_0xdddd('0x31')]=0x0;_0x2c48bc[_0xdddd('0x32')]=0x0;}function clearCampaigns(_0x4c41d9){if(!_[_0xdddd('0x33')](_0x4c41d9)){for(var _0x14a77f in _0x4c41d9){if(_0x4c41d9[_0xdddd('0x29')](_0x14a77f)){_0x4c41d9[_0x14a77f][_0xdddd('0x34')]=0x0;_0x4c41d9[_0x14a77f][_0xdddd('0x35')]=0x0;}}}}function clearVoiceQueues(_0xd15f78){if(!_['isEmpty'](_0xd15f78)){for(var _0x7c11a3 in _0xd15f78){if(_0xd15f78['hasOwnProperty'](_0x7c11a3)){_0xd15f78[_0x7c11a3][_0xdddd('0x2e')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x2f')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x36')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x37')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x30')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x31')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x32')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x38')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x39')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x3a')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x3b')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x3c')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x3d')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x3e')]=0x0;_0xd15f78[_0x7c11a3]['outboundDropCallsDayCallersExit']=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x3f')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x40')]=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x41')]=0x0;_0xd15f78[_0x7c11a3]['outboundReCallsDay']=0x0;_0xd15f78[_0x7c11a3]['outboundAnswerAgiCallsDay']=0x0;_0xd15f78[_0x7c11a3]['outboundAnswerCallsDay']=0x0;_0xd15f78[_0x7c11a3][_0xdddd('0x42')]=!![];}}}}Realtime[_0xdddd('0x43')][_0xdddd('0x44')]=function(_0x512535,_0x312816){for(var _0x452683 in _0x312816){if(_0x512535[_0xdddd('0x29')](_0x452683)){_0x512535[_0x452683]=_0x312816[_0x452683];}}};Realtime['prototype'][_0xdddd('0x45')]=function(){var _0x5525d1=this;return function(_0x460a6e){if(_0x460a6e){freeIsNotKeyAgent(_0x460a6e,_0x5525d1['agents']);for(var _0xa4bfe3=0x0,_0x307730={},_0x331d80={};_0xa4bfe3<_0x460a6e[_0xdddd('0x46')];_0xa4bfe3+=0x1){_0x307730=_0x460a6e[_0xa4bfe3];var _0x4dd04e=_[_0xdddd('0x2a')](_0x307730['interface'])?util[_0xdddd('0x2c')]('SIP/%s',_0x307730[_0xdddd('0x28')]):_0x307730[_0xdddd('0x2b')];if(_[_0xdddd('0x47')](_0x5525d1[_0xdddd('0x13')][_0x4dd04e])){_0x5525d1[_0xdddd('0x13')][_0x4dd04e]=new Agent(_0x307730);}else{_0x5525d1['mergeFromDatabase'](_0x5525d1[_0xdddd('0x13')][_0x4dd04e],_0x307730);}}}return _0x5525d1[_0xdddd('0x13')];};};Realtime['prototype'][_0xdddd('0x48')]=function(){var _0x1eccda=this;return function(_0x59c9c8){if(_0x59c9c8){freeIsNotKeySip(_0x59c9c8,_0x1eccda[_0xdddd('0x49')]);for(var _0x32511b=0x0,_0xe3b054={},_0x216ab8={};_0x32511b<_0x59c9c8[_0xdddd('0x46')];_0x32511b+=0x1){_0xe3b054=_0x59c9c8[_0x32511b];if(_[_0xdddd('0x47')](_0x1eccda[_0xdddd('0x49')][util[_0xdddd('0x2c')](_0xdddd('0x2d'),_0xe3b054[_0xdddd('0x28')])])){_0x1eccda['telephones'][util[_0xdddd('0x2c')](_0xdddd('0x2d'),_0xe3b054['name'])]=new Telephone(_0xe3b054);}else{_0x1eccda[_0xdddd('0x44')](_0x1eccda['telephones'][util[_0xdddd('0x2c')]('SIP/%s',_0xe3b054[_0xdddd('0x28')])],_0xe3b054);}}}return _0x1eccda['telephones'];};};Realtime['prototype'][_0xdddd('0x4a')]=function(){var _0x12e8e6=this;return function(_0x391d18){if(_0x391d18){freeIsNotKeySip(_0x391d18,_0x12e8e6[_0xdddd('0x14')]);for(var _0x3c07f7=0x0,_0x18068b={},_0x27d1f7={};_0x3c07f7<_0x391d18[_0xdddd('0x46')];_0x3c07f7+=0x1){_0x18068b=_0x391d18[_0x3c07f7];if(_['isUndefined'](_0x12e8e6[_0xdddd('0x14')][util[_0xdddd('0x2c')]('SIP/%s',_0x18068b['name'])])){_0x12e8e6[_0xdddd('0x14')][util[_0xdddd('0x2c')](_0xdddd('0x2d'),_0x18068b['name'])]=new Trunk(_0x18068b);}else{_0x12e8e6[_0xdddd('0x44')](_0x12e8e6[_0xdddd('0x14')][util[_0xdddd('0x2c')]('SIP/%s',_0x18068b[_0xdddd('0x28')])],_0x18068b);}}}return _0x12e8e6['trunks'];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x31fbe1=this;return function(_0x4c2da7){if(_0x4c2da7){freeIsNotKey(_0x4c2da7,_0x31fbe1[_0xdddd('0x15')],'name');for(var _0x34c33a=0x0,_0x16d378={},_0x500135={};_0x34c33a<_0x4c2da7['length'];_0x34c33a+=0x1){_0x16d378=_0x4c2da7[_0x34c33a];if(_[_0xdddd('0x47')](_0x31fbe1[_0xdddd('0x15')][_0x16d378[_0xdddd('0x28')]])){_0x31fbe1[_0xdddd('0x15')][_0x16d378['name']]=new VoiceQueue(_0x16d378);}else{_0x31fbe1[_0xdddd('0x44')](_0x31fbe1[_0xdddd('0x15')][_0x16d378[_0xdddd('0x28')]],_0x16d378);}}}return _0x31fbe1[_0xdddd('0x15')];};};Realtime[_0xdddd('0x43')]['initTriggers']=function(){var _0x3e8d8c=this;return function(_0x142112){if(_0x142112){freeIsNotKey(_0x142112,_0x3e8d8c[_0xdddd('0x4b')],'id');for(var _0xd6234=0x0,_0xaa67ee={},_0x563d1a={};_0xd6234<_0x142112['length'];_0xd6234+=0x1){_0xaa67ee=_0x142112[_0xd6234];if(_[_0xdddd('0x47')](_0x3e8d8c[_0xdddd('0x4b')][_0xaa67ee['id']])){_0x3e8d8c[_0xdddd('0x4b')][_0xaa67ee['id']]=new Trigger(_0xaa67ee);}else{_0x3e8d8c['mergeFromDatabase'](_0x3e8d8c['triggers'][_0xaa67ee['id']],_0xaa67ee);}}}return _0x3e8d8c[_0xdddd('0x4b')];};};Realtime[_0xdddd('0x43')]['initTemplates']=function(){var _0xe7dcb1=this;return function(_0x305858){if(_0x305858){freeIsNotKey(_0x305858,_0xe7dcb1[_0xdddd('0x4c')],'id');for(var _0x48cc67=0x0,_0x456269={},_0x3016c0={};_0x48cc67<_0x305858['length'];_0x48cc67+=0x1){_0x456269=_0x305858[_0x48cc67];if(_[_0xdddd('0x47')](_0xe7dcb1[_0xdddd('0x4c')][_0x456269['id']])){_0xe7dcb1[_0xdddd('0x4c')][_0x456269['id']]=new Template(_0x456269);}else{_0xe7dcb1['mergeFromDatabase'](_0xe7dcb1[_0xdddd('0x4c')][_0x456269['id']],_0x456269);}}}return _0xe7dcb1[_0xdddd('0x4c')];};};Realtime['prototype'][_0xdddd('0x4d')]=function(){var _0x27adc1=this;return function(_0x363429){if(_0x363429){freeIsNotKey(_0x363429,_0x27adc1[_0xdddd('0x1d')],'id');for(var _0x1f7aff=0x0,_0x1d6c26={},_0x508b2e={};_0x1f7aff<_0x363429['length'];_0x1f7aff+=0x1){_0x1d6c26=_0x363429[_0x1f7aff];if(_['isUndefined'](_0x27adc1[_0xdddd('0x1d')][_0x1d6c26['id']])){_0x27adc1[_0xdddd('0x1d')][_0x1d6c26['id']]=new ZendeskAccount(_0x1d6c26);}else{_0x27adc1[_0xdddd('0x44')](_0x27adc1[_0xdddd('0x1d')][_0x1d6c26['id']],_0x1d6c26);}}}return _0x27adc1[_0xdddd('0x1d')];};};Realtime['prototype'][_0xdddd('0x4e')]=function(){var _0x1161a2=this;return function(_0x25849f){if(_0x25849f){freeIsNotKey(_0x25849f,_0x1161a2[_0xdddd('0x1e')],'id');for(var _0x45515e=0x0,_0x2b783f={},_0x48b7ce={};_0x45515e<_0x25849f['length'];_0x45515e+=0x1){_0x2b783f=_0x25849f[_0x45515e];if(_[_0xdddd('0x47')](_0x1161a2[_0xdddd('0x1e')][_0x2b783f['id']])){_0x1161a2[_0xdddd('0x1e')][_0x2b783f['id']]=new SalesforceAccount(_0x2b783f);}else{_0x1161a2[_0xdddd('0x44')](_0x1161a2[_0xdddd('0x1e')][_0x2b783f['id']],_0x2b783f);}}}return _0x1161a2[_0xdddd('0x1e')];};};Realtime['prototype'][_0xdddd('0x4f')]=function(){var _0x2d5bd5=this;return function(_0x41dd56){if(_0x41dd56){freeIsNotKey(_0x41dd56,_0x2d5bd5['freshdeskAccounts'],'id');for(var _0x80a057=0x0,_0x58c311={},_0x3d93a2={};_0x80a057<_0x41dd56[_0xdddd('0x46')];_0x80a057+=0x1){_0x58c311=_0x41dd56[_0x80a057];if(_[_0xdddd('0x47')](_0x2d5bd5['freshdeskAccounts'][_0x58c311['id']])){_0x2d5bd5[_0xdddd('0x20')][_0x58c311['id']]=new FreshdeskAccount(_0x58c311);}else{_0x2d5bd5[_0xdddd('0x44')](_0x2d5bd5[_0xdddd('0x20')][_0x58c311['id']],_0x58c311);}}}return _0x2d5bd5[_0xdddd('0x20')];};};Realtime[_0xdddd('0x43')][_0xdddd('0x50')]=function(){var _0x3f6e01=this;return function(_0x1bdaf4){if(_0x1bdaf4){freeIsNotKey(_0x1bdaf4,_0x3f6e01[_0xdddd('0x51')],'id');for(var _0x17ab29=0x0,_0x280513={},_0x518a55={};_0x17ab29<_0x1bdaf4['length'];_0x17ab29+=0x1){_0x280513=_0x1bdaf4[_0x17ab29];if(_[_0xdddd('0x47')](_0x3f6e01[_0xdddd('0x51')][_0x280513['id']])){_0x3f6e01[_0xdddd('0x51')][_0x280513['id']]=new ZohoAccount(_0x280513);}else{_0x3f6e01['mergeFromDatabase'](_0x3f6e01[_0xdddd('0x51')][_0x280513['id']],_0x280513);}}}return _0x3f6e01[_0xdddd('0x51')];};};Realtime[_0xdddd('0x43')][_0xdddd('0x52')]=function(){var _0x5a0d5c=this;return function(_0x3c6c79){if(_0x3c6c79){freeIsNotKey(_0x3c6c79,_0x5a0d5c['deskAccounts'],'id');for(var _0x276498=0x0,_0x30300c={},_0x117db8={};_0x276498<_0x3c6c79[_0xdddd('0x46')];_0x276498+=0x1){_0x30300c=_0x3c6c79[_0x276498];if(_[_0xdddd('0x47')](_0x5a0d5c['deskAccounts'][_0x30300c['id']])){_0x5a0d5c['deskAccounts'][_0x30300c['id']]=new DeskAccount(_0x30300c);}else{_0x5a0d5c[_0xdddd('0x44')](_0x5a0d5c[_0xdddd('0x21')][_0x30300c['id']],_0x30300c);}}}return _0x5a0d5c[_0xdddd('0x21')];};};Realtime[_0xdddd('0x43')][_0xdddd('0x53')]=function(){var _0x12cf31=this;return function(_0x459eb0){if(_0x459eb0){freeIsNotKey(_0x459eb0,_0x12cf31[_0xdddd('0x1f')],'id');for(var _0x19d3ed=0x0,_0x211c36={},_0xdebaea={};_0x19d3ed<_0x459eb0[_0xdddd('0x46')];_0x19d3ed+=0x1){_0x211c36=_0x459eb0[_0x19d3ed];if(_[_0xdddd('0x47')](_0x12cf31['sugarcrmAccounts'][_0x211c36['id']])){_0x12cf31['sugarcrmAccounts'][_0x211c36['id']]=new SugarcrmAccount(_0x211c36);}else{_0x12cf31['mergeFromDatabase'](_0x12cf31[_0xdddd('0x1f')][_0x211c36['id']],_0x211c36);}}}return _0x12cf31[_0xdddd('0x1f')];};};Realtime[_0xdddd('0x43')]['initVtigerAccounts']=function(){var _0x2ed4e1=this;return function(_0x1e0023){if(_0x1e0023){freeIsNotKey(_0x1e0023,_0x2ed4e1[_0xdddd('0x22')],'id');for(var _0x162910=0x0,_0x193fb3={},_0x22e990={};_0x162910<_0x1e0023[_0xdddd('0x46')];_0x162910+=0x1){_0x193fb3=_0x1e0023[_0x162910];if(_[_0xdddd('0x47')](_0x2ed4e1[_0xdddd('0x22')][_0x193fb3['id']])){_0x2ed4e1[_0xdddd('0x22')][_0x193fb3['id']]=new VtigerAccount(_0x193fb3);}else{_0x2ed4e1['mergeFromDatabase'](_0x2ed4e1[_0xdddd('0x22')][_0x193fb3['id']],_0x193fb3);}}}return _0x2ed4e1['vtigerAccounts'];};};Realtime[_0xdddd('0x43')][_0xdddd('0x54')]=function(){var _0x4ba80e=this;return function(_0x48c978){if(_0x48c978){freeIsNotKey(_0x48c978,_0x4ba80e['servicenowAccounts'],'id');for(var _0x395ca2=0x0,_0x4bd3ee={},_0x17f39f={};_0x395ca2<_0x48c978[_0xdddd('0x46')];_0x395ca2+=0x1){_0x4bd3ee=_0x48c978[_0x395ca2];if(_[_0xdddd('0x47')](_0x4ba80e['servicenowAccounts'][_0x4bd3ee['id']])){_0x4ba80e[_0xdddd('0x23')][_0x4bd3ee['id']]=new ServicenowAccount(_0x4bd3ee);}else{_0x4ba80e[_0xdddd('0x44')](_0x4ba80e[_0xdddd('0x23')][_0x4bd3ee['id']],_0x4bd3ee);}}}return _0x4ba80e[_0xdddd('0x23')];};};Realtime[_0xdddd('0x43')][_0xdddd('0x55')]=function(){var _0x54b766=this;return function(_0x178072){if(_0x178072){freeIsNotKey(_0x178072,_0x54b766[_0xdddd('0x24')],'id');for(var _0x3524cc=0x0,_0x4b30cd={},_0x4a3451={};_0x3524cc<_0x178072[_0xdddd('0x46')];_0x3524cc+=0x1){_0x4b30cd=_0x178072[_0x3524cc];if(_[_0xdddd('0x47')](_0x54b766[_0xdddd('0x24')][_0x4b30cd['id']])){_0x54b766[_0xdddd('0x24')][_0x4b30cd['id']]=new Dynamics365Account(_0x4b30cd);}else{_0x54b766[_0xdddd('0x44')](_0x54b766[_0xdddd('0x24')][_0x4b30cd['id']],_0x4b30cd);}}}return _0x54b766['dynamics365Accounts'];};};Realtime['prototype'][_0xdddd('0x56')]=function(){var _0x64cc3=this;return function(_0x35d992){if(_0x35d992){freeIsNotKey(_0x35d992,_0x64cc3[_0xdddd('0x25')],'id');for(var _0x55541b=0x0,_0x53d630={},_0x25de92={};_0x55541b<_0x35d992[_0xdddd('0x46')];_0x55541b+=0x1){_0x53d630=_0x35d992[_0x55541b];if(_[_0xdddd('0x47')](_0x64cc3[_0xdddd('0x25')][_0x53d630['id']])){_0x64cc3[_0xdddd('0x25')][_0x53d630['id']]=new FreshsalesAccount(_0x53d630);}else{_0x64cc3[_0xdddd('0x44')](_0x64cc3[_0xdddd('0x25')][_0x53d630['id']],_0x53d630);}}}return _0x64cc3[_0xdddd('0x25')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x52e709=this;return function(_0x7d404d){for(var _0x9b2af2=0x0;_0x9b2af2<_0x7d404d[_0xdddd('0x46')];_0x9b2af2+=0x1){_[_0xdddd('0x57')](_0x52e709[_0xdddd('0x15')][_0x7d404d[_0x9b2af2][_0xdddd('0x28')]],_0x7d404d[_0x9b2af2]);}return _0x52e709[_0xdddd('0x15')];};};Realtime['prototype'][_0xdddd('0x58')]=function(){var _0xfada02=this;return function(_0x25715a){clearVoiceQueues(_0xfada02['voiceQueues']);if(_0x25715a){_0x25715a=_['groupBy'](_0x25715a,_0xdddd('0x59'));for(var _0x3a1d86 in _0x25715a){if(_0x25715a[_0xdddd('0x29')](_0x3a1d86)){var _0xf473c6={};for(var _0x4f3fbd=0x0;_0x4f3fbd<_0x25715a[_0x3a1d86][_0xdddd('0x46')];_0x4f3fbd+=0x1){var _0x1d0d84=_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x5a')];if(_0xfada02[_0xdddd('0x15')][_0x1d0d84]){if(_0x25715a[_0x3a1d86][_0x4f3fbd]['queuecallerexit']){_0xfada02[_0xdddd('0x15')][_0x1d0d84][_0xdddd('0x36')]+=0x1;}if(_0x25715a[_0x3a1d86][_0x4f3fbd]['queuecallerabandon']){_0xfada02[_0xdddd('0x15')][_0x1d0d84][_0xdddd('0x37')]+=0x1;}_0xfada02['voiceQueues'][_0x1d0d84][_0xdddd('0x30')]+=moment(_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x5b')])[_0xdddd('0x5c')](moment(_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x5d')]),_0xdddd('0x5e'))||0x0;if(_0x4f3fbd===_0x25715a[_0x3a1d86]['length']-0x1){_0xfada02['voiceQueues'][_0x1d0d84]['sumDuration']+=moment(_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x5f')]||_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x60')]||_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x61')])[_0xdddd('0x5c')](moment(_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x5d')]),_0xdddd('0x5e'))||0x0;_0xfada02[_0xdddd('0x15')][_0x1d0d84][_0xdddd('0x2e')]+=0x1;if(_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x62')]){_0xfada02[_0xdddd('0x15')][_0x1d0d84][_0xdddd('0x2f')]+=0x1;_0xfada02[_0xdddd('0x15')][_0x1d0d84][_0xdddd('0x32')]+=moment(_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x5f')])['diff'](moment(_0x25715a[_0x3a1d86][_0x4f3fbd][_0xdddd('0x5b')]),_0xdddd('0x5e'))||0x0;}}else{_0xfada02[_0xdddd('0x15')][_0x1d0d84]['sumDuration']+=_0xfada02[_0xdddd('0x15')][_0x1d0d84][_0xdddd('0x30')]||0x0;}}}}}}return _0xfada02[_0xdddd('0x15')];};};Realtime['prototype'][_0xdddd('0x63')]=function(){var _0x43ff35=this;return function(_0x2a1152){clearVoiceCallReports(_0x43ff35[_0xdddd('0x17')]);if(_0x2a1152){for(var _0x14fd0a=0x0;_0x14fd0a<_0x2a1152[_0xdddd('0x46')];_0x14fd0a+=0x1){_0x43ff35[_0xdddd('0x17')][_0xdddd('0x2e')]+=0x1;_0x43ff35[_0xdddd('0x17')]['sumDuration']+=_0x2a1152[_0x14fd0a][_0xdddd('0x64')];if(_0x2a1152[_0x14fd0a][_0xdddd('0x65')]===_0xdddd('0x66')){_0x43ff35[_0xdddd('0x17')]['answered']+=0x1;_0x43ff35[_0xdddd('0x17')]['sumHoldTime']+=_0x2a1152[_0x14fd0a][_0xdddd('0x64')]-_0x2a1152[_0x14fd0a][_0xdddd('0x67')]||0x0;_0x43ff35['outbound']['sumBillable']+=_0x2a1152[_0x14fd0a][_0xdddd('0x67')];}}}return _0x43ff35[_0xdddd('0x17')];};};Realtime[_0xdddd('0x43')]['initCampaigns']=function(){var _0x29c498=this;return function(_0x2e354c){if(_0x2e354c){freeIsNotKey(_0x2e354c,_0x29c498[_0xdddd('0x16')],_0xdddd('0x28'));for(var _0x4a99fb=0x0,_0x1c275a={};_0x4a99fb<_0x2e354c[_0xdddd('0x46')];_0x4a99fb+=0x1){_0x1c275a=_0x2e354c[_0x4a99fb];if(_['isUndefined'](_0x29c498[_0xdddd('0x16')][_0x1c275a[_0xdddd('0x28')]])){_0x29c498[_0xdddd('0x16')][_0x1c275a[_0xdddd('0x28')]]=new Campaign(_0x1c275a);}else{_0x29c498[_0xdddd('0x44')](_0x29c498[_0xdddd('0x16')][_0x1c275a[_0xdddd('0x28')]],_0x1c275a);_0x29c498[_0xdddd('0x16')][_0x1c275a[_0xdddd('0x28')]][_0xdddd('0x68')]=_0x1c275a[_0xdddd('0x69')]?_0x1c275a[_0xdddd('0x69')][_0xdddd('0x28')]:undefined;}}}return _0x29c498['campaigns'];};};Realtime[_0xdddd('0x43')][_0xdddd('0x6a')]=function(){var _0x4c4763=this;return function(_0x42eac7){if(_0x42eac7){freeIsNotKey(_0x42eac7,_0x4c4763['voiceExtensions'],'id');for(var _0xd70c14=0x0,_0x9a70ab={};_0xd70c14<_0x42eac7[_0xdddd('0x46')];_0xd70c14+=0x1){_0x9a70ab=_0x42eac7[_0xd70c14];if(_[_0xdddd('0x47')](_0x4c4763[_0xdddd('0x6b')][_0x9a70ab['id']])){_0x4c4763[_0xdddd('0x6b')][_0x9a70ab['id']]=new VoiceExtension(_0x9a70ab);}else{_0x4c4763[_0xdddd('0x44')](_0x4c4763[_0xdddd('0x6b')][_0x9a70ab['id']],_0x9a70ab);}}}return _0x4c4763[_0xdddd('0x6b')];};};Realtime[_0xdddd('0x43')][_0xdddd('0x6c')]=function(){var _0x393493=this;return function(_0x2132e0){clearCampaigns(_0x393493[_0xdddd('0x16')]);for(var _0x2e165b=0x0;_0x2e165b<_0x2132e0[_0xdddd('0x46')];_0x2e165b+=0x1){_[_0xdddd('0x57')](_0x393493[_0xdddd('0x16')][_0x2132e0[_0x2e165b][_0xdddd('0x28')]],_0x2132e0[_0x2e165b]);}return _0x393493[_0xdddd('0x16')];};};Realtime[_0xdddd('0x43')][_0xdddd('0x6d')]=function(){var _0x28aac2=this;return function(_0x1eb48e){if(_0x1eb48e){freeIsNotKey(_0x1eb48e,_0x28aac2[_0xdddd('0x26')],'id');for(var _0x2b01dd=0x0,_0xe16bd={},_0x269a8f={};_0x2b01dd<_0x1eb48e[_0xdddd('0x46')];_0x2b01dd+=0x1){_0xe16bd=_0x1eb48e[_0x2b01dd];if(_[_0xdddd('0x47')](_0x28aac2[_0xdddd('0x26')][_0xe16bd['id']])){_0x28aac2[_0xdddd('0x26')][_0xe16bd['id']]=new FaxAccount(_0xe16bd);}else{_0x28aac2[_0xdddd('0x44')](_0x28aac2[_0xdddd('0x26')][_0xe16bd['id']],_0xe16bd);}}}return _0x28aac2['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xa8f1=['../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','format','SIP/%s','hasOwnProperty','interface','name','answered','sumHoldTime','sumDuration','ivrAnswerCallsDay','isEmpty','total','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','isNil','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','initTriggers','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','seconds','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','faxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension'];(function(_0x3db698,_0x5e3e47){var _0x34618e=function(_0x1d9baf){while(--_0x1d9baf){_0x3db698['push'](_0x3db698['shift']());}};_0x34618e(++_0x5e3e47);}(_0xa8f1,0x13c));var _0x1a8f=function(_0x4f40b2,_0x414ac1){_0x4f40b2=_0x4f40b2-0x0;var _0x3b9301=_0xa8f1[_0x4f40b2];return _0x3b9301;};'use strict';var BPromise=require(_0x1a8f('0x0'));var util=require(_0x1a8f('0x1'));var _=require(_0x1a8f('0x2'));var moment=require(_0x1a8f('0x3'));var Agent=require(_0x1a8f('0x4'));var Telephone=require(_0x1a8f('0x5'));var Trunk=require(_0x1a8f('0x6'));var VoiceQueue=require(_0x1a8f('0x7'));var Trigger=require(_0x1a8f('0x8'));var Template=require('../model/template');var Campaign=require(_0x1a8f('0x9'));var VoiceExtension=require(_0x1a8f('0xa'));var ZendeskAccount=require(_0x1a8f('0xb'));var SalesforceAccount=require(_0x1a8f('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x1a8f('0xd'));var ZohoAccount=require(_0x1a8f('0xe'));var DeskAccount=require(_0x1a8f('0xf'));var VtigerAccount=require(_0x1a8f('0x10'));var ServicenowAccount=require(_0x1a8f('0x11'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x1a8f('0x12'));var FaxAccount=require(_0x1a8f('0x13'));var Realtime=function(){this[_0x1a8f('0x14')]={};this[_0x1a8f('0x15')]={};this[_0x1a8f('0x16')]={};this[_0x1a8f('0x17')]={};this[_0x1a8f('0x18')]={};this[_0x1a8f('0x19')]={};this[_0x1a8f('0x1a')]={};this[_0x1a8f('0x1b')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x1a8f('0x1c')]={};this['queueChannels']={};this[_0x1a8f('0x1d')]={};this['timers']={};this[_0x1a8f('0x1e')]={};this[_0x1a8f('0x1f')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x1a8f('0x20')]={};this['zohoAccounts']={};this[_0x1a8f('0x21')]={};this[_0x1a8f('0x22')]={};this[_0x1a8f('0x23')]={};this['dynamics365Accounts']={};this[_0x1a8f('0x24')]={};this['faxAccounts']={};};function freeIsNotKey(_0x3ed72b,_0x394027,_0x585c67){var _0x291f58=_[_0x1a8f('0x25')](_0x3ed72b,function(_0x2bac2c,_0x16ba58){return _0x2bac2c[_0x585c67];});for(var _0x4c0bda in _0x394027){if(_0x394027['hasOwnProperty'](_0x4c0bda)){if(!_0x291f58[_0x4c0bda]){delete _0x394027[_0x4c0bda];}}}}function freeIsNotKeySip(_0x293106,_0x4c2d3a){var _0x5319e6=_[_0x1a8f('0x25')](_0x293106,function(_0x37f663,_0xb42a64){return util[_0x1a8f('0x26')](_0x1a8f('0x27'),_0x37f663['name']);});for(var _0xfd6528 in _0x4c2d3a){if(_0x4c2d3a[_0x1a8f('0x28')](_0xfd6528)){if(!_0x5319e6[_0xfd6528]){delete _0x4c2d3a[_0xfd6528];}}}}function freeIsNotKeyAgent(_0x332132,_0x26f5a2){var _0x577918=_[_0x1a8f('0x25')](_0x332132,function(_0x29498c,_0x1a7d5a){var _0x207a43=_['isNil'](_0x29498c[_0x1a8f('0x29')])?util['format'](_0x1a8f('0x27'),_0x29498c[_0x1a8f('0x2a')]):_0x29498c[_0x1a8f('0x29')];return _0x207a43;});for(var _0x7b136e in _0x26f5a2){if(_0x26f5a2[_0x1a8f('0x28')](_0x7b136e)){if(!_0x577918[_0x7b136e]){delete _0x26f5a2[_0x7b136e];}}}}function clearVoiceCallReports(_0x285a94){_0x285a94['total']=0x0;_0x285a94[_0x1a8f('0x2b')]=0x0;_0x285a94[_0x1a8f('0x2c')]=0x0;_0x285a94[_0x1a8f('0x2d')]=0x0;_0x285a94['sumBillable']=0x0;}function clearCampaigns(_0x13383f){if(!_['isEmpty'](_0x13383f)){for(var _0x1eb158 in _0x13383f){if(_0x13383f[_0x1a8f('0x28')](_0x1eb158)){_0x13383f[_0x1eb158]['ivrTotalCallsDays']=0x0;_0x13383f[_0x1eb158][_0x1a8f('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x296648){if(!_[_0x1a8f('0x2f')](_0x296648)){for(var _0x572b30 in _0x296648){if(_0x296648[_0x1a8f('0x28')](_0x572b30)){_0x296648[_0x572b30][_0x1a8f('0x30')]=0x0;_0x296648[_0x572b30]['answered']=0x0;_0x296648[_0x572b30][_0x1a8f('0x31')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x32')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x2c')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x2d')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x33')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x34')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x35')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x36')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x37')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x38')]=0x0;_0x296648[_0x572b30]['outboundUnknownCallsDay']=0x0;_0x296648[_0x572b30][_0x1a8f('0x39')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x3a')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x3b')]=0x0;_0x296648[_0x572b30]['outboundOriginateFailureCallsDay']=0x0;_0x296648[_0x572b30][_0x1a8f('0x3c')]=0x0;_0x296648[_0x572b30][_0x1a8f('0x3d')]=0x0;_0x296648[_0x572b30]['outboundAnswerAgiCallsDay']=0x0;_0x296648[_0x572b30][_0x1a8f('0x3e')]=0x0;_0x296648[_0x572b30]['queueStatusComplete']=!![];}}}}Realtime[_0x1a8f('0x3f')][_0x1a8f('0x40')]=function(_0xbb895b,_0x6e4970){for(var _0x5cb35d in _0x6e4970){if(_0xbb895b[_0x1a8f('0x28')](_0x5cb35d)){_0xbb895b[_0x5cb35d]=_0x6e4970[_0x5cb35d];}}};Realtime[_0x1a8f('0x3f')]['initAgents']=function(){var _0x371f31=this;return function(_0x319e0d){if(_0x319e0d){freeIsNotKeyAgent(_0x319e0d,_0x371f31[_0x1a8f('0x14')]);for(var _0x201386=0x0,_0x38e7d1={},_0x537e34={};_0x201386<_0x319e0d['length'];_0x201386+=0x1){_0x38e7d1=_0x319e0d[_0x201386];var _0x4429fc=_[_0x1a8f('0x41')](_0x38e7d1[_0x1a8f('0x29')])?util['format']('SIP/%s',_0x38e7d1[_0x1a8f('0x2a')]):_0x38e7d1[_0x1a8f('0x29')];if(_[_0x1a8f('0x42')](_0x371f31['agents'][_0x4429fc])){_0x371f31[_0x1a8f('0x14')][_0x4429fc]=new Agent(_0x38e7d1);}else{_0x371f31[_0x1a8f('0x40')](_0x371f31[_0x1a8f('0x14')][_0x4429fc],_0x38e7d1);}}}return _0x371f31[_0x1a8f('0x14')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x43')]=function(){var _0x34022b=this;return function(_0x1f5997){if(_0x1f5997){freeIsNotKeySip(_0x1f5997,_0x34022b[_0x1a8f('0x15')]);for(var _0x1f07e4=0x0,_0x59b311={},_0x28295c={};_0x1f07e4<_0x1f5997[_0x1a8f('0x44')];_0x1f07e4+=0x1){_0x59b311=_0x1f5997[_0x1f07e4];if(_[_0x1a8f('0x42')](_0x34022b[_0x1a8f('0x15')][util['format'](_0x1a8f('0x27'),_0x59b311[_0x1a8f('0x2a')])])){_0x34022b[_0x1a8f('0x15')][util[_0x1a8f('0x26')](_0x1a8f('0x27'),_0x59b311[_0x1a8f('0x2a')])]=new Telephone(_0x59b311);}else{_0x34022b['mergeFromDatabase'](_0x34022b[_0x1a8f('0x15')][util['format'](_0x1a8f('0x27'),_0x59b311[_0x1a8f('0x2a')])],_0x59b311);}}}return _0x34022b[_0x1a8f('0x15')];};};Realtime['prototype'][_0x1a8f('0x45')]=function(){var _0x7a699e=this;return function(_0x48e48e){if(_0x48e48e){freeIsNotKeySip(_0x48e48e,_0x7a699e[_0x1a8f('0x16')]);for(var _0x26c39e=0x0,_0x45bb70={},_0x576dea={};_0x26c39e<_0x48e48e[_0x1a8f('0x44')];_0x26c39e+=0x1){_0x45bb70=_0x48e48e[_0x26c39e];if(_[_0x1a8f('0x42')](_0x7a699e[_0x1a8f('0x16')][util[_0x1a8f('0x26')](_0x1a8f('0x27'),_0x45bb70[_0x1a8f('0x2a')])])){_0x7a699e[_0x1a8f('0x16')][util['format']('SIP/%s',_0x45bb70['name'])]=new Trunk(_0x45bb70);}else{_0x7a699e['mergeFromDatabase'](_0x7a699e[_0x1a8f('0x16')][util[_0x1a8f('0x26')](_0x1a8f('0x27'),_0x45bb70[_0x1a8f('0x2a')])],_0x45bb70);}}}return _0x7a699e['trunks'];};};Realtime['prototype'][_0x1a8f('0x46')]=function(){var _0x357d9a=this;return function(_0x262084){if(_0x262084){freeIsNotKey(_0x262084,_0x357d9a[_0x1a8f('0x17')],_0x1a8f('0x2a'));for(var _0x535be4=0x0,_0x4a467f={},_0x2e62a2={};_0x535be4<_0x262084[_0x1a8f('0x44')];_0x535be4+=0x1){_0x4a467f=_0x262084[_0x535be4];if(_[_0x1a8f('0x42')](_0x357d9a[_0x1a8f('0x17')][_0x4a467f[_0x1a8f('0x2a')]])){_0x357d9a[_0x1a8f('0x17')][_0x4a467f[_0x1a8f('0x2a')]]=new VoiceQueue(_0x4a467f);}else{_0x357d9a[_0x1a8f('0x40')](_0x357d9a['voiceQueues'][_0x4a467f[_0x1a8f('0x2a')]],_0x4a467f);}}}return _0x357d9a[_0x1a8f('0x17')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x47')]=function(){var _0x5cbe5b=this;return function(_0x4c9b2a){if(_0x4c9b2a){freeIsNotKey(_0x4c9b2a,_0x5cbe5b[_0x1a8f('0x18')],'id');for(var _0x327004=0x0,_0x42c4a3={},_0x3557fc={};_0x327004<_0x4c9b2a['length'];_0x327004+=0x1){_0x42c4a3=_0x4c9b2a[_0x327004];if(_['isUndefined'](_0x5cbe5b[_0x1a8f('0x18')][_0x42c4a3['id']])){_0x5cbe5b[_0x1a8f('0x18')][_0x42c4a3['id']]=new Trigger(_0x42c4a3);}else{_0x5cbe5b['mergeFromDatabase'](_0x5cbe5b[_0x1a8f('0x18')][_0x42c4a3['id']],_0x42c4a3);}}}return _0x5cbe5b[_0x1a8f('0x18')];};};Realtime[_0x1a8f('0x3f')]['initTemplates']=function(){var _0x42eafc=this;return function(_0xfe3721){if(_0xfe3721){freeIsNotKey(_0xfe3721,_0x42eafc[_0x1a8f('0x1a')],'id');for(var _0xb5daaa=0x0,_0x5122da={},_0x39e38d={};_0xb5daaa<_0xfe3721[_0x1a8f('0x44')];_0xb5daaa+=0x1){_0x5122da=_0xfe3721[_0xb5daaa];if(_['isUndefined'](_0x42eafc[_0x1a8f('0x1a')][_0x5122da['id']])){_0x42eafc[_0x1a8f('0x1a')][_0x5122da['id']]=new Template(_0x5122da);}else{_0x42eafc[_0x1a8f('0x40')](_0x42eafc[_0x1a8f('0x1a')][_0x5122da['id']],_0x5122da);}}}return _0x42eafc[_0x1a8f('0x1a')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x48')]=function(){var _0x1a5527=this;return function(_0x4893f3){if(_0x4893f3){freeIsNotKey(_0x4893f3,_0x1a5527['zendeskAccounts'],'id');for(var _0x3591d6=0x0,_0x44e157={},_0xdb913e={};_0x3591d6<_0x4893f3['length'];_0x3591d6+=0x1){_0x44e157=_0x4893f3[_0x3591d6];if(_['isUndefined'](_0x1a5527[_0x1a8f('0x1f')][_0x44e157['id']])){_0x1a5527[_0x1a8f('0x1f')][_0x44e157['id']]=new ZendeskAccount(_0x44e157);}else{_0x1a5527[_0x1a8f('0x40')](_0x1a5527['zendeskAccounts'][_0x44e157['id']],_0x44e157);}}}return _0x1a5527[_0x1a8f('0x1f')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x49')]=function(){var _0x1c2cab=this;return function(_0x3215a8){if(_0x3215a8){freeIsNotKey(_0x3215a8,_0x1c2cab[_0x1a8f('0x4a')],'id');for(var _0x193028=0x0,_0x4441c3={},_0x2d71ac={};_0x193028<_0x3215a8[_0x1a8f('0x44')];_0x193028+=0x1){_0x4441c3=_0x3215a8[_0x193028];if(_['isUndefined'](_0x1c2cab[_0x1a8f('0x4a')][_0x4441c3['id']])){_0x1c2cab[_0x1a8f('0x4a')][_0x4441c3['id']]=new SalesforceAccount(_0x4441c3);}else{_0x1c2cab[_0x1a8f('0x40')](_0x1c2cab[_0x1a8f('0x4a')][_0x4441c3['id']],_0x4441c3);}}}return _0x1c2cab[_0x1a8f('0x4a')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x4b')]=function(){var _0x184c3b=this;return function(_0x4c7ed8){if(_0x4c7ed8){freeIsNotKey(_0x4c7ed8,_0x184c3b[_0x1a8f('0x20')],'id');for(var _0x40b3d3=0x0,_0x29f614={},_0x365408={};_0x40b3d3<_0x4c7ed8[_0x1a8f('0x44')];_0x40b3d3+=0x1){_0x29f614=_0x4c7ed8[_0x40b3d3];if(_['isUndefined'](_0x184c3b[_0x1a8f('0x20')][_0x29f614['id']])){_0x184c3b[_0x1a8f('0x20')][_0x29f614['id']]=new FreshdeskAccount(_0x29f614);}else{_0x184c3b[_0x1a8f('0x40')](_0x184c3b[_0x1a8f('0x20')][_0x29f614['id']],_0x29f614);}}}return _0x184c3b[_0x1a8f('0x20')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x4c')]=function(){var _0x31776b=this;return function(_0x2cb2bc){if(_0x2cb2bc){freeIsNotKey(_0x2cb2bc,_0x31776b[_0x1a8f('0x4d')],'id');for(var _0x1bce6a=0x0,_0x5884fd={},_0x3112d0={};_0x1bce6a<_0x2cb2bc[_0x1a8f('0x44')];_0x1bce6a+=0x1){_0x5884fd=_0x2cb2bc[_0x1bce6a];if(_['isUndefined'](_0x31776b[_0x1a8f('0x4d')][_0x5884fd['id']])){_0x31776b[_0x1a8f('0x4d')][_0x5884fd['id']]=new ZohoAccount(_0x5884fd);}else{_0x31776b['mergeFromDatabase'](_0x31776b[_0x1a8f('0x4d')][_0x5884fd['id']],_0x5884fd);}}}return _0x31776b['zohoAccounts'];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x4e')]=function(){var _0x5e2b1c=this;return function(_0x466039){if(_0x466039){freeIsNotKey(_0x466039,_0x5e2b1c[_0x1a8f('0x21')],'id');for(var _0x184d71=0x0,_0x4a854a={},_0x3e7e12={};_0x184d71<_0x466039['length'];_0x184d71+=0x1){_0x4a854a=_0x466039[_0x184d71];if(_['isUndefined'](_0x5e2b1c['deskAccounts'][_0x4a854a['id']])){_0x5e2b1c[_0x1a8f('0x21')][_0x4a854a['id']]=new DeskAccount(_0x4a854a);}else{_0x5e2b1c[_0x1a8f('0x40')](_0x5e2b1c[_0x1a8f('0x21')][_0x4a854a['id']],_0x4a854a);}}}return _0x5e2b1c['deskAccounts'];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x4f')]=function(){var _0x436903=this;return function(_0x9405f5){if(_0x9405f5){freeIsNotKey(_0x9405f5,_0x436903[_0x1a8f('0x50')],'id');for(var _0x1a1d08=0x0,_0xb20af4={},_0x155b8e={};_0x1a1d08<_0x9405f5[_0x1a8f('0x44')];_0x1a1d08+=0x1){_0xb20af4=_0x9405f5[_0x1a1d08];if(_[_0x1a8f('0x42')](_0x436903[_0x1a8f('0x50')][_0xb20af4['id']])){_0x436903[_0x1a8f('0x50')][_0xb20af4['id']]=new SugarcrmAccount(_0xb20af4);}else{_0x436903[_0x1a8f('0x40')](_0x436903[_0x1a8f('0x50')][_0xb20af4['id']],_0xb20af4);}}}return _0x436903[_0x1a8f('0x50')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x49c7f9=this;return function(_0x4f315d){if(_0x4f315d){freeIsNotKey(_0x4f315d,_0x49c7f9[_0x1a8f('0x22')],'id');for(var _0x348519=0x0,_0x54cf8e={},_0x74c857={};_0x348519<_0x4f315d['length'];_0x348519+=0x1){_0x54cf8e=_0x4f315d[_0x348519];if(_[_0x1a8f('0x42')](_0x49c7f9[_0x1a8f('0x22')][_0x54cf8e['id']])){_0x49c7f9[_0x1a8f('0x22')][_0x54cf8e['id']]=new VtigerAccount(_0x54cf8e);}else{_0x49c7f9['mergeFromDatabase'](_0x49c7f9['vtigerAccounts'][_0x54cf8e['id']],_0x54cf8e);}}}return _0x49c7f9[_0x1a8f('0x22')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x51')]=function(){var _0x1e1125=this;return function(_0x51f6b5){if(_0x51f6b5){freeIsNotKey(_0x51f6b5,_0x1e1125[_0x1a8f('0x23')],'id');for(var _0x504ac0=0x0,_0x1d227d={},_0x5b4034={};_0x504ac0<_0x51f6b5[_0x1a8f('0x44')];_0x504ac0+=0x1){_0x1d227d=_0x51f6b5[_0x504ac0];if(_[_0x1a8f('0x42')](_0x1e1125[_0x1a8f('0x23')][_0x1d227d['id']])){_0x1e1125['servicenowAccounts'][_0x1d227d['id']]=new ServicenowAccount(_0x1d227d);}else{_0x1e1125['mergeFromDatabase'](_0x1e1125[_0x1a8f('0x23')][_0x1d227d['id']],_0x1d227d);}}}return _0x1e1125[_0x1a8f('0x23')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x52')]=function(){var _0xb2d95d=this;return function(_0x49ac90){if(_0x49ac90){freeIsNotKey(_0x49ac90,_0xb2d95d[_0x1a8f('0x53')],'id');for(var _0x522358=0x0,_0x18a8c9={},_0x2c8260={};_0x522358<_0x49ac90[_0x1a8f('0x44')];_0x522358+=0x1){_0x18a8c9=_0x49ac90[_0x522358];if(_['isUndefined'](_0xb2d95d[_0x1a8f('0x53')][_0x18a8c9['id']])){_0xb2d95d['dynamics365Accounts'][_0x18a8c9['id']]=new Dynamics365Account(_0x18a8c9);}else{_0xb2d95d[_0x1a8f('0x40')](_0xb2d95d[_0x1a8f('0x53')][_0x18a8c9['id']],_0x18a8c9);}}}return _0xb2d95d[_0x1a8f('0x53')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x54')]=function(){var _0x37d27c=this;return function(_0x43cff0){if(_0x43cff0){freeIsNotKey(_0x43cff0,_0x37d27c['freshsalesAccounts'],'id');for(var _0x18e74c=0x0,_0xc99120={},_0x407729={};_0x18e74c<_0x43cff0[_0x1a8f('0x44')];_0x18e74c+=0x1){_0xc99120=_0x43cff0[_0x18e74c];if(_[_0x1a8f('0x42')](_0x37d27c[_0x1a8f('0x24')][_0xc99120['id']])){_0x37d27c['freshsalesAccounts'][_0xc99120['id']]=new FreshsalesAccount(_0xc99120);}else{_0x37d27c[_0x1a8f('0x40')](_0x37d27c[_0x1a8f('0x24')][_0xc99120['id']],_0xc99120);}}}return _0x37d27c[_0x1a8f('0x24')];};};Realtime['prototype'][_0x1a8f('0x55')]=function(){var _0x47fd97=this;return function(_0x123663){for(var _0x11d63f=0x0;_0x11d63f<_0x123663['length'];_0x11d63f+=0x1){_[_0x1a8f('0x56')](_0x47fd97[_0x1a8f('0x17')][_0x123663[_0x11d63f]['name']],_0x123663[_0x11d63f]);}return _0x47fd97[_0x1a8f('0x17')];};};Realtime['prototype'][_0x1a8f('0x57')]=function(){var _0x5ba6d5=this;return function(_0x3c85a2){clearVoiceQueues(_0x5ba6d5[_0x1a8f('0x17')]);if(_0x3c85a2){_0x3c85a2=_[_0x1a8f('0x58')](_0x3c85a2,_0x1a8f('0x59'));for(var _0x190d95 in _0x3c85a2){if(_0x3c85a2[_0x1a8f('0x28')](_0x190d95)){var _0x560a0e={};for(var _0x51a99a=0x0;_0x51a99a<_0x3c85a2[_0x190d95]['length'];_0x51a99a+=0x1){var _0x8251a4=_0x3c85a2[_0x190d95][_0x51a99a][_0x1a8f('0x5a')];if(_0x5ba6d5['voiceQueues'][_0x8251a4]){if(_0x3c85a2[_0x190d95][_0x51a99a][_0x1a8f('0x5b')]){_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4]['unmanaged']+=0x1;}if(_0x3c85a2[_0x190d95][_0x51a99a][_0x1a8f('0x5c')]){_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4][_0x1a8f('0x32')]+=0x1;}_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4][_0x1a8f('0x2c')]+=moment(_0x3c85a2[_0x190d95][_0x51a99a]['queuecallerleaveAt'])[_0x1a8f('0x5d')](moment(_0x3c85a2[_0x190d95][_0x51a99a]['queuecallerjoinAt']),_0x1a8f('0x5e'))||0x0;if(_0x51a99a===_0x3c85a2[_0x190d95][_0x1a8f('0x44')]-0x1){_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4][_0x1a8f('0x2d')]+=moment(_0x3c85a2[_0x190d95][_0x51a99a]['queuecallercompleteAt']||_0x3c85a2[_0x190d95][_0x51a99a]['queuecallerabandonAt']||_0x3c85a2[_0x190d95][_0x51a99a][_0x1a8f('0x5f')])[_0x1a8f('0x5d')](moment(_0x3c85a2[_0x190d95][_0x51a99a][_0x1a8f('0x60')]),_0x1a8f('0x5e'))||0x0;_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4]['total']+=0x1;if(_0x3c85a2[_0x190d95][_0x51a99a][_0x1a8f('0x61')]){_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4][_0x1a8f('0x2b')]+=0x1;_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4][_0x1a8f('0x33')]+=moment(_0x3c85a2[_0x190d95][_0x51a99a]['queuecallercompleteAt'])[_0x1a8f('0x5d')](moment(_0x3c85a2[_0x190d95][_0x51a99a][_0x1a8f('0x62')]),_0x1a8f('0x5e'))||0x0;}}else{_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4]['sumDuration']+=_0x5ba6d5[_0x1a8f('0x17')][_0x8251a4][_0x1a8f('0x2c')]||0x0;}}}}}}return _0x5ba6d5[_0x1a8f('0x17')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x63')]=function(){var _0xba3d30=this;return function(_0x10acbd){clearVoiceCallReports(_0xba3d30['outbound']);if(_0x10acbd){for(var _0x27f1ec=0x0;_0x27f1ec<_0x10acbd[_0x1a8f('0x44')];_0x27f1ec+=0x1){_0xba3d30[_0x1a8f('0x1b')][_0x1a8f('0x30')]+=0x1;_0xba3d30[_0x1a8f('0x1b')][_0x1a8f('0x2d')]+=_0x10acbd[_0x27f1ec][_0x1a8f('0x64')];if(_0x10acbd[_0x27f1ec]['disposition']===_0x1a8f('0x65')){_0xba3d30[_0x1a8f('0x1b')][_0x1a8f('0x2b')]+=0x1;_0xba3d30[_0x1a8f('0x1b')][_0x1a8f('0x2c')]+=_0x10acbd[_0x27f1ec]['duration']-_0x10acbd[_0x27f1ec]['billableseconds']||0x0;_0xba3d30[_0x1a8f('0x1b')]['sumBillable']+=_0x10acbd[_0x27f1ec][_0x1a8f('0x66')];}}}return _0xba3d30[_0x1a8f('0x1b')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x67')]=function(){var _0x5bbbda=this;return function(_0x6d729f){if(_0x6d729f){freeIsNotKey(_0x6d729f,_0x5bbbda[_0x1a8f('0x19')],'name');for(var _0x530c2d=0x0,_0x354420={};_0x530c2d<_0x6d729f[_0x1a8f('0x44')];_0x530c2d+=0x1){_0x354420=_0x6d729f[_0x530c2d];if(_[_0x1a8f('0x42')](_0x5bbbda['campaigns'][_0x354420[_0x1a8f('0x2a')]])){_0x5bbbda[_0x1a8f('0x19')][_0x354420[_0x1a8f('0x2a')]]=new Campaign(_0x354420);}else{_0x5bbbda['mergeFromDatabase'](_0x5bbbda[_0x1a8f('0x19')][_0x354420[_0x1a8f('0x2a')]],_0x354420);_0x5bbbda['campaigns'][_0x354420[_0x1a8f('0x2a')]]['dialQueueProject']=_0x354420[_0x1a8f('0x68')]?_0x354420['SquareProject'][_0x1a8f('0x2a')]:undefined;}}}return _0x5bbbda[_0x1a8f('0x19')];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x69')]=function(){var _0x30d31e=this;return function(_0x182848){if(_0x182848){freeIsNotKey(_0x182848,_0x30d31e[_0x1a8f('0x6a')],'id');for(var _0x17ea9e=0x0,_0xa7d6a5={};_0x17ea9e<_0x182848[_0x1a8f('0x44')];_0x17ea9e+=0x1){_0xa7d6a5=_0x182848[_0x17ea9e];if(_[_0x1a8f('0x42')](_0x30d31e[_0x1a8f('0x6a')][_0xa7d6a5['id']])){_0x30d31e[_0x1a8f('0x6a')][_0xa7d6a5['id']]=new VoiceExtension(_0xa7d6a5);}else{_0x30d31e[_0x1a8f('0x40')](_0x30d31e[_0x1a8f('0x6a')][_0xa7d6a5['id']],_0xa7d6a5);}}}return _0x30d31e['voiceExtensions'];};};Realtime[_0x1a8f('0x3f')][_0x1a8f('0x6b')]=function(){var _0x1d6274=this;return function(_0x898ee1){clearCampaigns(_0x1d6274[_0x1a8f('0x19')]);for(var _0x369921=0x0;_0x369921<_0x898ee1[_0x1a8f('0x44')];_0x369921+=0x1){_[_0x1a8f('0x56')](_0x1d6274['campaigns'][_0x898ee1[_0x369921][_0x1a8f('0x2a')]],_0x898ee1[_0x369921]);}return _0x1d6274['campaigns'];};};Realtime[_0x1a8f('0x3f')]['initFaxAccounts']=function(){var _0x3e9a44=this;return function(_0x4718d6){if(_0x4718d6){freeIsNotKey(_0x4718d6,_0x3e9a44[_0x1a8f('0x6c')],'id');for(var _0xe212cc=0x0,_0x5bbc7d={},_0x2ccc5e={};_0xe212cc<_0x4718d6[_0x1a8f('0x44')];_0xe212cc+=0x1){_0x5bbc7d=_0x4718d6[_0xe212cc];if(_[_0x1a8f('0x42')](_0x3e9a44[_0x1a8f('0x6c')][_0x5bbc7d['id']])){_0x3e9a44['faxAccounts'][_0x5bbc7d['id']]=new FaxAccount(_0x5bbc7d);}else{_0x3e9a44['mergeFromDatabase'](_0x3e9a44[_0x1a8f('0x6c')][_0x5bbc7d['id']],_0x5bbc7d);}}}return _0x3e9a44['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 34e7d1c..2b11fd1 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 _0x3193=['queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel','destination','exten','type','lastapplication','lastdata','queue','context','from-voip-provider','from-sip','originatecalleridnum','destinationchannel','callerid','calleridpreview','calleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','split','UserId','membername','create','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x3193,0xf3));var _0x3319=function(_0x1a457a,_0x193f72){_0x1a457a=_0x1a457a-0x0;var _0x43b698=_0x3193[_0x1a457a];return _0x43b698;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x3319('0x0'));var config=require(_0x3319('0x1'));var ami=require(_0x3319('0x2'));var RpcVoiceAgentReport=require(_0x3319('0x3'));var RpcVoiceCallReport=require(_0x3319('0x4'));var RpcVoiceDialReport=require(_0x3319('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x3319('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x3319('0x7'));var VoiceQueueReport=require(_0x3319('0x8'));var VoiceCallReport=require(_0x3319('0x9'));var VoiceAgentReport=require(_0x3319('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x3319('0xb'));function Report(_0x5f5bc7){this[_0x3319('0xc')]=_0x5f5bc7;this[_0x3319('0xd')]=_0x5f5bc7[_0x3319('0xd')];this[_0x3319('0xe')]=_0x5f5bc7[_0x3319('0xe')];}Report[_0x3319('0xf')][_0x3319('0x10')]=function(_0x79c4c4){var _0x283945=new VoiceQueueReport(this['realtime']);var _0x38593b=new VoiceAgentReport(this[_0x3319('0xc')]);var _0x583a26=new VoiceDialReport(this[_0x3319('0xc')]);var _0x5e7fc5=new VoiceCallReport(this['realtime']);var _0x16c6fc=new UserReport(this[_0x3319('0xc')]);if(config[_0x3319('0x11')]&&config[_0x3319('0x11')][_0x3319('0x12')]){ami['on'](_0x3319('0x13'),this[_0x3319('0x14')][_0x3319('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x3319('0x16')][_0x3319('0x15')](this));ami['on'](_0x3319('0x17'),this['voiceAgentReport']['bind'](this));ami['on'](_0x3319('0x18'),this['voiceDialReport'][_0x3319('0x15')](this));ami['on'](_0x3319('0x19'),this[_0x3319('0x1a')][_0x3319('0x15')](this));ami['on'](_0x3319('0x1b'),this[_0x3319('0x1c')]['bind'](this));}};Report[_0x3319('0xf')][_0x3319('0x1d')]=function(_0x2af746){var _0x10ade1;_0x10ade1=_[_0x3319('0x1e')](this[_0x3319('0xd')],function(_0x3951da){return _0x3951da[_0x3319('0x1f')]==_0x2af746||_0x3951da[_0x3319('0x20')]==_0x2af746;});if(_[_0x3319('0x21')](_0x10ade1)){var _0x2bac04=_[_0x3319('0x1e')](this[_0x3319('0xe')],function(_0xd4c84c){return _0xd4c84c[_0x3319('0x1f')]==_0x2af746||_0xd4c84c['name']==_0x2af746;});if(_0x2bac04){_0x10ade1=_[_0x3319('0x1e')](this[_0x3319('0xd')],function(_0xd2f1b8){return _0xd2f1b8[_0x3319('0x22')]==util['format'](_0x3319('0x23'),_0x2bac04[_0x3319('0x20')]);});}}return _0x10ade1;};Report['prototype'][_0x3319('0x14')]=function(_0xf094b0){for(var _0x595231=0x0;_0x595231<_0xf094b0[_0x3319('0x24')];_0x595231+=0x1){var _0x7234de=this[_0x3319('0x1d')](_0xf094b0[_0x595231][_0x3319('0x25')]);if(_0x7234de){_0xf094b0[_0x595231][_0x3319('0x1f')]=_0x7234de['accountcode'];_0xf094b0[_0x595231][_0x3319('0x26')]=!![];_0xf094b0[_0x595231][_0x3319('0x27')]=_0x7234de[_0x3319('0x20')];_0xf094b0[_0x595231][_0x3319('0x22')]=_['isNil'](_0x7234de[_0x3319('0x22')])?util[_0x3319('0x28')](_0x3319('0x23'),_0x7234de[_0x3319('0x20')]):_0x7234de['interface'];if(_0xf094b0[_0x595231][_0x3319('0x29')]){_0xf094b0[_0x595231][_0x3319('0x2a')]=moment()['format'](_0x3319('0x2b'));}if(_0xf094b0[_0x595231][_0x3319('0x2c')]){_0xf094b0[_0x595231][_0x3319('0x2d')]=moment()[_0x3319('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0xf094b0[_0x595231]);}RpcVoiceQueueReport['create'](_0xf094b0[_0x595231]);}};function extractCalleridNumber(_0xbc5ed4){var _0x3beb61=_0xbc5ed4[_0x3319('0x2e')](/<(.*?)>/);return _0x3beb61?_0x3beb61[0x1]:_0xbc5ed4;}Report[_0x3319('0xf')][_0x3319('0x2f')]=function(_0x427de6){for(var _0x403abc=0x0;_0x403abc/);return _0x40fb92?_0x40fb92[0x1]:_0x29d41a;}Report[_0xae8d('0xc')][_0xae8d('0x28')]=function(_0x14f601){for(var _0x1f667d=0x0;_0x1f667d',_0x16cc82[_0xae8d('0x3d')],_0x16cc82[_0xae8d('0x2c')]);}if(RpcVoiceTransferReport[_0xae8d('0x3e')][_0x16cc82[_0xae8d('0x3f')]]){var _0x2609c8=RpcVoiceTransferReport[_0xae8d('0x3e')][_0x16cc82[_0xae8d('0x3f')]];_0x2609c8[_0xae8d('0x40')]=_0x16cc82[_0xae8d('0x41')];RpcVoiceTransferReport[_0xae8d('0x42')](_0x2609c8);delete RpcVoiceTransferReport[_0xae8d('0x3e')][_0x16cc82[_0xae8d('0x3f')]];}if(_[_0xae8d('0x18')](_0x16cc82[_0xae8d('0x31')])){_0x16cc82[_0xae8d('0x31')]=this[_0xae8d('0x2a')](_0x16cc82);}if(_['isNil'](_0x16cc82['UserId'])){var _0x3431aa=_0x16cc82[_0xae8d('0x2b')][_0xae8d('0x43')]('-')[0x0];var _0x43c9db=this[_0xae8d('0xa')][_0x3431aa];if(!_0x43c9db)_0x43c9db=this['getAgentByInternal'](_0x16cc82[_0xae8d('0x17')]);if(_0x43c9db){_0x16cc82[_0xae8d('0x44')]=_0x43c9db['id'];_0x16cc82[_0xae8d('0x45')]=_0x43c9db[_0xae8d('0x19')];}}RpcVoiceCallReport['create'](_0x16cc82);if(_0x16cc82[_0xae8d('0x46')]){for(var _0x3c7824=0x0;_0x3c7824<_0x16cc82[_0xae8d('0x47')]['length'];_0x3c7824+=0x1){_0x16cc82['monitorFilename']=_0x16cc82[_0xae8d('0x47')][_0x3c7824][_0xae8d('0x48')];_0x16cc82['createdAt']=_0x16cc82[_0xae8d('0x47')][_0x3c7824][_0xae8d('0x49')];if(_0x16cc82[_0xae8d('0x30')]==_0xae8d('0x38')){_0x16cc82['calleridnum']=_0x16cc82[_0xae8d('0x1f')];_0x16cc82[_0xae8d('0x3d')]=_0x16cc82[_0xae8d('0x4a')];_0x16cc82[_0xae8d('0x1f')]=_0x16cc82['accountcode'];_0x16cc82[_0xae8d('0x4a')]=_0x16cc82[_0xae8d('0x45')];_0x16cc82[_0xae8d('0x30')]=_0x16cc82[_0xae8d('0x39')];}else if(_0x16cc82[_0xae8d('0x30')]=='xcally-motion-dialer'){_0x16cc82[_0xae8d('0x2c')]=_0x16cc82[_0xae8d('0x2f')];_0x16cc82[_0xae8d('0x30')]=_0x16cc82[_0xae8d('0x39')];}RpcVoiceRecording[_0xae8d('0x26')](_0x16cc82);}}};Report['prototype'][_0xae8d('0x11')]=function(_0x28d235){if(_[_0xae8d('0x4b')](_0x28d235)){_0x28d235[_0xae8d('0x4c')](function(_0x281d47){RpcVoiceAgentReport[_0xae8d('0x26')](_0x281d47);});}else{RpcVoiceAgentReport[_0xae8d('0x26')](_0x28d235);}};Report['prototype'][_0xae8d('0x4d')]=function(_0x4a281f){RpcVoiceDialReport[_0xae8d('0x26')](_0x4a281f);var _0x25e794;var _0x47b2f2;var _0x35764f=_0x4a281f[_0xae8d('0x2b')];if(_['startsWith'](_0x35764f,'Local')){_0x47b2f2=_0x35764f[_0xae8d('0x4e')](_0x35764f[_0xae8d('0x4f')]('/')+0x1,_0x35764f[_0xae8d('0x4f')]('@'));_0x25e794=_['find'](this[_0xae8d('0xa')],function(_0x5913c1){return _0x5913c1[_0xae8d('0x50')]==_0x47b2f2||_0x5913c1[_0xae8d('0x51')]==_0x47b2f2||_0x5913c1[_0xae8d('0x17')]==_0x47b2f2;});}else{_0x47b2f2=_0x35764f[_0xae8d('0x4e')](_0x35764f['indexOf']('/')+0x1,_0x35764f[_0xae8d('0x52')]('-'));_0x25e794=this[_0xae8d('0x16')](_0x47b2f2);}if(_0x25e794){_0x4a281f['interface']=_[_0xae8d('0x18')](_0x25e794[_0xae8d('0x1a')])?util[_0xae8d('0x1b')](_0xae8d('0x1c'),_0x25e794[_0xae8d('0x19')]):_0x25e794[_0xae8d('0x1a')];_0x4a281f[_0xae8d('0x45')]=_0x25e794['name'];_0x4a281f[_0xae8d('0x17')]=_0x25e794['accountcode'];RpcMemberReport[_0xae8d('0x4d')](_0x4a281f);}};Report[_0xae8d('0xc')][_0xae8d('0x42')]=function(_0x2b351b){RpcVoiceTransferReport[_0xae8d('0x3e')][_0x2b351b[_0xae8d('0x53')]]=_0x2b351b;};Report['prototype']['attendedTransfer']=function(_0x34cad0){RpcVoiceTransferReport[_0xae8d('0x15')](_0x34cad0);};module[_0xae8d('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 8b10516..2e74698 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 _0xbf55=['error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','info','device','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xbf55,0x168));var _0x5bf5=function(_0x590816,_0x57da8b){_0x590816=_0x590816-0x0;var _0x5cd527=_0xbf55[_0x590816];return _0x5cd527;};'use strict';var _=require(_0x5bf5('0x0'));var moment=require(_0x5bf5('0x1'));var util=require(_0x5bf5('0x2'));var Redis=require('ioredis');var BPromise=require(_0x5bf5('0x3'));var config=require(_0x5bf5('0x4'));var logger=require(_0x5bf5('0x5'))(_0x5bf5('0x6'));var ami=require(_0x5bf5('0x7'));config[_0x5bf5('0x8')]=_[_0x5bf5('0x9')](config[_0x5bf5('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5bf5('0xa'))(new Redis(config[_0x5bf5('0x8')]));function UserReport(_0xf8620c){this[_0x5bf5('0xb')]=_0xf8620c[_0x5bf5('0xb')];this[_0x5bf5('0xc')]=_0xf8620c[_0x5bf5('0xc')];this[_0x5bf5('0xd')]=_0xf8620c[_0x5bf5('0xd')];ami['on']('registryentry',this[_0x5bf5('0xe')][_0x5bf5('0xf')](this));ami['on'](_0x5bf5('0x10'),this[_0x5bf5('0xe')]['bind'](this));ami['on'](_0x5bf5('0x11'),this[_0x5bf5('0x12')][_0x5bf5('0xf')](this));ami['on'](_0x5bf5('0x13'),this[_0x5bf5('0x14')]['bind'](this));return this[_0x5bf5('0x15')]();}function showSipRegistrations(){Promise[_0x5bf5('0x16')]()['then'](ami[_0x5bf5('0x17')]())[_0x5bf5('0x18')](function(_0x58a759){logger[_0x5bf5('0x19')](_0x5bf5('0x1a'),util[_0x5bf5('0x1b')](_0x58a759,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5bf5('0x16')]()[_0x5bf5('0x1c')](ami[_0x5bf5('0x1d')]())[_0x5bf5('0x18')](function(_0x38f20f){logger['error'](_0x5bf5('0x1e'),util[_0x5bf5('0x1b')](_0x38f20f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x5bf5('0x16')]()[_0x5bf5('0x1c')](ami[_0x5bf5('0x1f')]())[_0x5bf5('0x18')](function(_0x23aa5d){logger['error']('[userReport][sippeerstatus]',util['inspect'](_0x23aa5d,{'showHidden':![],'depth':null}));});}UserReport[_0x5bf5('0x20')][_0x5bf5('0x15')]=function(){setInterval(function(){BPromise['resolve']()[_0x5bf5('0x1c')](showSipRegistrations())[_0x5bf5('0x1c')](listDeviceStates())[_0x5bf5('0x1c')](showPeersStatus());},0x32c8);};UserReport[_0x5bf5('0x20')][_0x5bf5('0x21')]=function(_0x1bacc5){return _0x1bacc5!==null&&!_[_0x5bf5('0x22')](_0x1bacc5);};UserReport[_0x5bf5('0x20')][_0x5bf5('0x23')]=function(_0x1293d4,_0x5bf3fd,_0x572895){io['to'](_0x1293d4)[_0x5bf5('0x23')](_0x5bf3fd,_0x572895);};UserReport[_0x5bf5('0x20')][_0x5bf5('0xe')]=function(_0xd945ac){try{if(this[_0x5bf5('0x21')](_0xd945ac)){logger['info'](_0x5bf5('0x24'),_0xd945ac[_0x5bf5('0x25')],_0xd945ac[_0x5bf5('0x26')]);logger[_0x5bf5('0x27')](_0x5bf5('0x28'),util['inspect'](_0xd945ac,{'showHidden':![],'depth':null}));var _0x417879=_[_0x5bf5('0x29')](this[_0x5bf5('0xb')],{'defaultuser':_0xd945ac[_0x5bf5('0x25')]});if(_0x417879){_0xd945ac[_0x5bf5('0x2a')]=_0xd945ac[_0x5bf5('0x26')];_['merge'](_0x417879,_[_0x5bf5('0x2b')](_0xd945ac,[_0x5bf5('0x2c'),_0x5bf5('0x2d'),'username','state']));logger[_0x5bf5('0x27')](_0x5bf5('0x2e'),util[_0x5bf5('0x1b')](_0x417879,{'showHidden':![],'depth':null}));this[_0x5bf5('0x23')](util[_0x5bf5('0x2f')](_0x5bf5('0x30'),_0x417879[_0x5bf5('0x31')]),_0x5bf5('0x32'),_0x417879);}}}catch(_0x115c3e){logger[_0x5bf5('0x19')](_0x5bf5('0x28'),util[_0x5bf5('0x1b')](_0x115c3e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5bf5('0x12')]=function(_0xa1a335){try{if(this[_0x5bf5('0x21')](_0xa1a335)){logger[_0x5bf5('0x33')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0xa1a335['device'],_0xa1a335[_0x5bf5('0x26')]);logger['debug']('[userReport][devicestatechange]',util['inspect'](_0xa1a335,{'showHidden':![],'depth':null}));if(this['agents'][_0xa1a335[_0x5bf5('0x34')]]){if(!this['agents'][_0xa1a335[_0x5bf5('0x34')]][_0x5bf5('0x35')]||_0xa1a335['state'][_0x5bf5('0x36')]()==_0x5bf5('0x37')){this[_0x5bf5('0xc')][_0xa1a335[_0x5bf5('0x34')]][_0x5bf5('0x35')]=![];if(this[_0x5bf5('0xc')][_0xa1a335['device']][_0x5bf5('0x26')]!==_0xa1a335['state'][_0x5bf5('0x36')]()){this[_0x5bf5('0xc')][_0xa1a335['device']][_0x5bf5('0x38')]=_['toNumber'](moment()[_0x5bf5('0x2f')]('x'));}this[_0x5bf5('0xc')][_0xa1a335['device']]['state']=_0xa1a335['state']['toLowerCase']();this[_0x5bf5('0xc')][_0xa1a335['device']]['updateStatusRealtime'](_0xa1a335);}}else if(this[_0x5bf5('0xd')][_0xa1a335[_0x5bf5('0x34')]]){if(this[_0x5bf5('0xd')][_0xa1a335[_0x5bf5('0x34')]][_0x5bf5('0x26')]!==_0xa1a335[_0x5bf5('0x26')][_0x5bf5('0x36')]()){this[_0x5bf5('0xd')][_0xa1a335[_0x5bf5('0x34')]]['stateTime']=_[_0x5bf5('0x39')](moment()[_0x5bf5('0x2f')]('x'));}this[_0x5bf5('0xd')][_0xa1a335[_0x5bf5('0x34')]]['state']=_0xa1a335[_0x5bf5('0x26')][_0x5bf5('0x36')]();logger[_0x5bf5('0x27')](_0x5bf5('0x3a'),util['inspect'](this[_0x5bf5('0xd')][_0xa1a335[_0x5bf5('0x34')]],{'showHidden':![],'depth':null}));this[_0x5bf5('0x23')](util[_0x5bf5('0x2f')]('telephone:%s',this[_0x5bf5('0xd')][_0xa1a335[_0x5bf5('0x34')]][_0x5bf5('0x31')]),_0x5bf5('0x3b'),this[_0x5bf5('0xd')][_0xa1a335['device']]);}else if(this['trunks'][_0xa1a335['device']]){if(this[_0x5bf5('0xb')][_0xa1a335[_0x5bf5('0x34')]]['state']!==_0xa1a335[_0x5bf5('0x26')]['toLowerCase']()){this[_0x5bf5('0xb')][_0xa1a335[_0x5bf5('0x34')]][_0x5bf5('0x38')]=_[_0x5bf5('0x39')](moment()[_0x5bf5('0x2f')]('x'));}this[_0x5bf5('0xb')][_0xa1a335['device']]['state']=_0xa1a335[_0x5bf5('0x26')][_0x5bf5('0x36')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x5bf5('0x1b')](this[_0x5bf5('0xb')][_0xa1a335[_0x5bf5('0x34')]],{'showHidden':![],'depth':null}));this[_0x5bf5('0x23')](util[_0x5bf5('0x2f')]('trunk:%s',this[_0x5bf5('0xb')][_0xa1a335['device']][_0x5bf5('0x31')]),'trunk:save',this[_0x5bf5('0xb')][_0xa1a335[_0x5bf5('0x34')]]);}else if(_[_0x5bf5('0x3c')](_0xa1a335[_0x5bf5('0x34')],_0x5bf5('0x3d'))){var _0x12bb63=_0xa1a335[_0x5bf5('0x34')];var _0x545f52=_0x12bb63[_0x5bf5('0x3e')](_0x12bb63['indexOf']('/')+0x1,_0x12bb63[_0x5bf5('0x3f')]('@'));var _0x176dab=_['find'](this[_0x5bf5('0xc')],function(_0x271446){return _0x271446[_0x5bf5('0x40')]==_0x545f52||_0x271446[_0x5bf5('0x41')]==_0x545f52||_0x271446[_0x5bf5('0x42')]==_0x545f52;});if(_0x176dab){if(_0x176dab[_0x5bf5('0x26')]!==_0xa1a335[_0x5bf5('0x26')][_0x5bf5('0x36')]()){_0x176dab[_0x5bf5('0x38')]=_[_0x5bf5('0x39')](moment()[_0x5bf5('0x2f')]('x'));}_0x176dab[_0x5bf5('0x26')]=_0xa1a335[_0x5bf5('0x26')]['toLowerCase']();_0x176dab['local']=!![];_0x176dab[_0x5bf5('0x43')](_0xa1a335);}}}}catch(_0x18eb16){logger['error'](_0x5bf5('0x44'),util[_0x5bf5('0x1b')](_0x18eb16,{'showHidden':![],'depth':null}));}};UserReport[_0x5bf5('0x20')][_0x5bf5('0x14')]=function(_0x10f6c9){try{if(this[_0x5bf5('0x21')](_0x10f6c9)&&this[_0x5bf5('0x21')](_0x10f6c9[_0x5bf5('0x13')])){logger['info'](_0x5bf5('0x45'),_0x10f6c9[_0x5bf5('0x46')],_0x10f6c9[_0x5bf5('0x47')],_0x10f6c9['peerstatus']);logger[_0x5bf5('0x27')](_0x5bf5('0x48'),util[_0x5bf5('0x1b')](_0x10f6c9,{'showHidden':![],'depth':null}));if(this[_0x5bf5('0xc')][_0x10f6c9[_0x5bf5('0x46')]]){if(!this[_0x5bf5('0xc')][_0x10f6c9[_0x5bf5('0x46')]][_0x5bf5('0x35')]||_0x10f6c9[_0x5bf5('0x13')]['toLowerCase']()==_0x5bf5('0x49')){this[_0x5bf5('0xc')][_0x10f6c9['peer']]['local']=![];this['agents'][_0x10f6c9[_0x5bf5('0x46')]]['status']=_0x10f6c9[_0x5bf5('0x13')][_0x5bf5('0x36')]();this[_0x5bf5('0xc')][_0x10f6c9[_0x5bf5('0x46')]][_0x5bf5('0x47')]=_0x10f6c9['address'];this[_0x5bf5('0xc')][_0x10f6c9[_0x5bf5('0x46')]][_0x5bf5('0x43')](_0x10f6c9);}}else if(this[_0x5bf5('0xd')][_0x10f6c9[_0x5bf5('0x46')]]){this['telephones'][_0x10f6c9[_0x5bf5('0x46')]][_0x5bf5('0x4a')]=_0x10f6c9[_0x5bf5('0x13')][_0x5bf5('0x36')]();this['telephones'][_0x10f6c9['peer']][_0x5bf5('0x47')]=_0x10f6c9[_0x5bf5('0x47')];logger['debug'](_0x5bf5('0x4b'),util[_0x5bf5('0x1b')](this[_0x5bf5('0xd')][_0x10f6c9['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format']('telephone:%s',this['telephones'][_0x10f6c9[_0x5bf5('0x46')]][_0x5bf5('0x31')]),_0x5bf5('0x3b'),this[_0x5bf5('0xd')][_0x10f6c9[_0x5bf5('0x46')]]);}else if(this['trunks'][_0x10f6c9[_0x5bf5('0x46')]]){this[_0x5bf5('0xb')][_0x10f6c9['peer']]['status']=_0x10f6c9[_0x5bf5('0x13')][_0x5bf5('0x36')]();this[_0x5bf5('0xb')][_0x10f6c9[_0x5bf5('0x46')]][_0x5bf5('0x47')]=_0x10f6c9[_0x5bf5('0x47')];logger[_0x5bf5('0x27')](_0x5bf5('0x4c'),util[_0x5bf5('0x1b')](this[_0x5bf5('0xb')][_0x10f6c9[_0x5bf5('0x46')]],{'showHidden':![],'depth':null}));this[_0x5bf5('0x23')](util[_0x5bf5('0x2f')](_0x5bf5('0x30'),this[_0x5bf5('0xb')][_0x10f6c9[_0x5bf5('0x46')]][_0x5bf5('0x31')]),_0x5bf5('0x32'),this[_0x5bf5('0xb')][_0x10f6c9[_0x5bf5('0x46')]]);}}}catch(_0x2c6e2a){logger[_0x5bf5('0x19')](_0x5bf5('0x48'),util[_0x5bf5('0x1b')](_0x2c6e2a,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x83bf=['util','ioredis','bluebird','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','lodash'];(function(_0x134676,_0x27f374){var _0x1f0467=function(_0x566a39){while(--_0x566a39){_0x134676['push'](_0x134676['shift']());}};_0x1f0467(++_0x27f374);}(_0x83bf,0x1bb));var _0xf83b=function(_0x3520b8,_0x2d2034){_0x3520b8=_0x3520b8-0x0;var _0x262768=_0x83bf[_0x3520b8];return _0x262768;};'use strict';var _=require(_0xf83b('0x0'));var moment=require('moment');var util=require(_0xf83b('0x1'));var Redis=require(_0xf83b('0x2'));var BPromise=require(_0xf83b('0x3'));var config=require('../../../config/environment');var logger=require(_0xf83b('0x4'))(_0xf83b('0x5'));var ami=require(_0xf83b('0x6'));config[_0xf83b('0x7')]=_['defaults'](config[_0xf83b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xf83b('0x8'))(new Redis(config[_0xf83b('0x7')]));function UserReport(_0x33308a){this[_0xf83b('0x9')]=_0x33308a['trunks'];this[_0xf83b('0xa')]=_0x33308a['agents'];this[_0xf83b('0xb')]=_0x33308a[_0xf83b('0xb')];ami['on']('registryentry',this[_0xf83b('0xc')][_0xf83b('0xd')](this));ami['on'](_0xf83b('0xe'),this[_0xf83b('0xc')][_0xf83b('0xd')](this));ami['on'](_0xf83b('0xf'),this[_0xf83b('0x10')]['bind'](this));ami['on']('peerstatus',this[_0xf83b('0x11')][_0xf83b('0xd')](this));return this[_0xf83b('0x12')]();}function showSipRegistrations(){Promise[_0xf83b('0x13')]()['then'](ami[_0xf83b('0x14')]())[_0xf83b('0x15')](function(_0x4308f3){logger['error'](_0xf83b('0x16'),util[_0xf83b('0x17')](_0x4308f3,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xf83b('0x18')](ami[_0xf83b('0x19')]())[_0xf83b('0x15')](function(_0x29f0f7){logger[_0xf83b('0x1a')](_0xf83b('0x1b'),util['inspect'](_0x29f0f7,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xf83b('0x13')]()[_0xf83b('0x18')](ami[_0xf83b('0x1c')]())['catch'](function(_0x32e64c){logger[_0xf83b('0x1a')]('[userReport][sippeerstatus]',util[_0xf83b('0x17')](_0x32e64c,{'showHidden':![],'depth':null}));});}UserReport[_0xf83b('0x1d')][_0xf83b('0x12')]=function(){setInterval(function(){BPromise[_0xf83b('0x13')]()['then'](showSipRegistrations())[_0xf83b('0x18')](listDeviceStates())[_0xf83b('0x18')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0xf83b('0x1e')]=function(_0x30183c){return _0x30183c!==null&&!_[_0xf83b('0x1f')](_0x30183c);};UserReport['prototype'][_0xf83b('0x20')]=function(_0xc0acfd,_0x516079,_0x9d140e){io['to'](_0xc0acfd)[_0xf83b('0x20')](_0x516079,_0x9d140e);};UserReport['prototype'][_0xf83b('0xc')]=function(_0xfccb8d){try{if(this[_0xf83b('0x1e')](_0xfccb8d)){logger[_0xf83b('0x21')](_0xf83b('0x22'),_0xfccb8d[_0xf83b('0x23')],_0xfccb8d[_0xf83b('0x24')]);logger['debug'](_0xf83b('0x25'),util[_0xf83b('0x17')](_0xfccb8d,{'showHidden':![],'depth':null}));var _0x9f33a5=_[_0xf83b('0x26')](this['trunks'],{'defaultuser':_0xfccb8d[_0xf83b('0x23')]});if(_0x9f33a5){_0xfccb8d[_0xf83b('0x27')]=_0xfccb8d[_0xf83b('0x24')];_['merge'](_0x9f33a5,_[_0xf83b('0x28')](_0xfccb8d,[_0xf83b('0x29'),_0xf83b('0x2a'),_0xf83b('0x23'),_0xf83b('0x24')]));logger[_0xf83b('0x2b')](_0xf83b('0x2c'),util[_0xf83b('0x17')](_0x9f33a5,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xf83b('0x2d'),_0x9f33a5[_0xf83b('0x2e')]),'trunk:save',_0x9f33a5);}}}catch(_0x39f34d){logger['error'](_0xf83b('0x25'),util[_0xf83b('0x17')](_0x39f34d,{'showHidden':![],'depth':null}));}};UserReport[_0xf83b('0x1d')][_0xf83b('0x10')]=function(_0x29cc3c){try{if(this[_0xf83b('0x1e')](_0x29cc3c)){logger['info'](_0xf83b('0x2f'),_0x29cc3c[_0xf83b('0x30')],_0x29cc3c[_0xf83b('0x24')]);logger[_0xf83b('0x2b')]('[userReport][devicestatechange]',util['inspect'](_0x29cc3c,{'showHidden':![],'depth':null}));if(this[_0xf83b('0xa')][_0x29cc3c[_0xf83b('0x30')]]){if(!this[_0xf83b('0xa')][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x31')]||_0x29cc3c['state'][_0xf83b('0x32')]()==_0xf83b('0x33')){this['agents'][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x31')]=![];if(this[_0xf83b('0xa')][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x24')]!==_0x29cc3c[_0xf83b('0x24')][_0xf83b('0x32')]()){this[_0xf83b('0xa')][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x34')]=_[_0xf83b('0x35')](moment()[_0xf83b('0x36')]('x'));}this[_0xf83b('0xa')][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x24')]=_0x29cc3c[_0xf83b('0x24')][_0xf83b('0x32')]();this['agents'][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x37')](_0x29cc3c);}}else if(this[_0xf83b('0xb')][_0x29cc3c[_0xf83b('0x30')]]){if(this[_0xf83b('0xb')][_0x29cc3c['device']][_0xf83b('0x24')]!==_0x29cc3c['state']['toLowerCase']()){this['telephones'][_0x29cc3c[_0xf83b('0x30')]]['stateTime']=_[_0xf83b('0x35')](moment()[_0xf83b('0x36')]('x'));}this[_0xf83b('0xb')][_0x29cc3c[_0xf83b('0x30')]]['state']=_0x29cc3c[_0xf83b('0x24')][_0xf83b('0x32')]();logger[_0xf83b('0x2b')](_0xf83b('0x38'),util[_0xf83b('0x17')](this[_0xf83b('0xb')][_0x29cc3c[_0xf83b('0x30')]],{'showHidden':![],'depth':null}));this[_0xf83b('0x20')](util[_0xf83b('0x36')](_0xf83b('0x39'),this[_0xf83b('0xb')][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x2e')]),_0xf83b('0x3a'),this[_0xf83b('0xb')][_0x29cc3c['device']]);}else if(this[_0xf83b('0x9')][_0x29cc3c[_0xf83b('0x30')]]){if(this[_0xf83b('0x9')][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x24')]!==_0x29cc3c[_0xf83b('0x24')][_0xf83b('0x32')]()){this[_0xf83b('0x9')][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x34')]=_[_0xf83b('0x35')](moment()['format']('x'));}this[_0xf83b('0x9')][_0x29cc3c['device']][_0xf83b('0x24')]=_0x29cc3c[_0xf83b('0x24')]['toLowerCase']();logger[_0xf83b('0x2b')](_0xf83b('0x3b'),util[_0xf83b('0x17')](this[_0xf83b('0x9')][_0x29cc3c[_0xf83b('0x30')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xf83b('0x36')](_0xf83b('0x2d'),this[_0xf83b('0x9')][_0x29cc3c[_0xf83b('0x30')]][_0xf83b('0x2e')]),_0xf83b('0x3c'),this['trunks'][_0x29cc3c['device']]);}else if(_['startsWith'](_0x29cc3c[_0xf83b('0x30')],_0xf83b('0x3d'))){var _0xc5b0a7=_0x29cc3c[_0xf83b('0x30')];var _0x4277a9=_0xc5b0a7['substring'](_0xc5b0a7[_0xf83b('0x3e')]('/')+0x1,_0xc5b0a7['indexOf']('@'));var _0x2ccb6d=_['find'](this['agents'],function(_0x1001d5){return _0x1001d5[_0xf83b('0x3f')]==_0x4277a9||_0x1001d5[_0xf83b('0x40')]==_0x4277a9||_0x1001d5[_0xf83b('0x41')]==_0x4277a9;});if(_0x2ccb6d){if(_0x2ccb6d[_0xf83b('0x24')]!==_0x29cc3c[_0xf83b('0x24')][_0xf83b('0x32')]()){_0x2ccb6d[_0xf83b('0x34')]=_['toNumber'](moment()['format']('x'));}_0x2ccb6d[_0xf83b('0x24')]=_0x29cc3c[_0xf83b('0x24')][_0xf83b('0x32')]();_0x2ccb6d[_0xf83b('0x31')]=!![];_0x2ccb6d['updateStatusRealtime'](_0x29cc3c);}}}}catch(_0x3a957f){logger[_0xf83b('0x1a')](_0xf83b('0x42'),util['inspect'](_0x3a957f,{'showHidden':![],'depth':null}));}};UserReport[_0xf83b('0x1d')][_0xf83b('0x11')]=function(_0x48290b){try{if(this[_0xf83b('0x1e')](_0x48290b)&&this['isNotNull'](_0x48290b[_0xf83b('0x43')])){logger[_0xf83b('0x21')](_0xf83b('0x44'),_0x48290b['peer'],_0x48290b[_0xf83b('0x45')],_0x48290b[_0xf83b('0x43')]);logger[_0xf83b('0x2b')](_0xf83b('0x46'),util['inspect'](_0x48290b,{'showHidden':![],'depth':null}));if(this[_0xf83b('0xa')][_0x48290b['peer']]){if(!this[_0xf83b('0xa')][_0x48290b[_0xf83b('0x47')]]['local']||_0x48290b[_0xf83b('0x43')][_0xf83b('0x32')]()==_0xf83b('0x48')){this[_0xf83b('0xa')][_0x48290b[_0xf83b('0x47')]]['local']=![];this[_0xf83b('0xa')][_0x48290b[_0xf83b('0x47')]][_0xf83b('0x49')]=_0x48290b[_0xf83b('0x43')][_0xf83b('0x32')]();this[_0xf83b('0xa')][_0x48290b[_0xf83b('0x47')]][_0xf83b('0x45')]=_0x48290b[_0xf83b('0x45')];this[_0xf83b('0xa')][_0x48290b[_0xf83b('0x47')]][_0xf83b('0x37')](_0x48290b);}}else if(this[_0xf83b('0xb')][_0x48290b['peer']]){this[_0xf83b('0xb')][_0x48290b[_0xf83b('0x47')]][_0xf83b('0x49')]=_0x48290b['peerstatus'][_0xf83b('0x32')]();this['telephones'][_0x48290b[_0xf83b('0x47')]]['address']=_0x48290b['address'];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xf83b('0x17')](this[_0xf83b('0xb')][_0x48290b[_0xf83b('0x47')]],{'showHidden':![],'depth':null}));this[_0xf83b('0x20')](util[_0xf83b('0x36')]('telephone:%s',this[_0xf83b('0xb')][_0x48290b[_0xf83b('0x47')]]['name']),'telephone:save',this[_0xf83b('0xb')][_0x48290b['peer']]);}else if(this['trunks'][_0x48290b[_0xf83b('0x47')]]){this[_0xf83b('0x9')][_0x48290b[_0xf83b('0x47')]][_0xf83b('0x49')]=_0x48290b['peerstatus'][_0xf83b('0x32')]();this['trunks'][_0x48290b[_0xf83b('0x47')]][_0xf83b('0x45')]=_0x48290b[_0xf83b('0x45')];logger[_0xf83b('0x2b')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xf83b('0x17')](this[_0xf83b('0x9')][_0x48290b[_0xf83b('0x47')]],{'showHidden':![],'depth':null}));this[_0xf83b('0x20')](util[_0xf83b('0x36')](_0xf83b('0x2d'),this['trunks'][_0x48290b[_0xf83b('0x47')]][_0xf83b('0x2e')]),_0xf83b('0x3c'),this[_0xf83b('0x9')][_0x48290b[_0xf83b('0x47')]]);}}}catch(_0x43e63d){logger[_0xf83b('0x1a')](_0xf83b('0x46'),util[_0xf83b('0x17')](_0x43e63d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 63b5503..a4460eb 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 _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x313091,_0x2da2b2){var _0x500c0e=function(_0x1ed9f5){while(--_0x1ed9f5){_0x313091['push'](_0x313091['shift']());}};_0x500c0e(++_0x2da2b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x50d05d,_0x25d8e0){var _0x350c93=function(_0x3c4113){while(--_0x3c4113){_0x50d05d['push'](_0x50d05d['shift']());}};_0x350c93(++_0x25d8e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 5d47086..75a381c 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 _0xf3cb=['[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','channelstate','isUndefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','cdr(','type','isNil','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','holdtime','diff','seconds','connectedlinename','destinationchannel','UserId','answertime','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','blindTransfers','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','then','undefined','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','newchannel','syncNewChannel','newstate','varset','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','user:agentconnect','accountcode'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf3cb,0x89));var _0xbf3c=function(_0x13be20,_0x2d9168){_0x13be20=_0x13be20-0x0;var _0xd2cb79=_0xf3cb[_0x13be20];return _0xd2cb79;};'use strict';var _=require(_0xbf3c('0x0'));var moment=require(_0xbf3c('0x1'));var util=require(_0xbf3c('0x2'));var path=require(_0xbf3c('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xbf3c('0x4'))(_0xbf3c('0x5'));var ami=require(_0xbf3c('0x6'));var Channel=require(_0xbf3c('0x7'));var RpcSetting=require(_0xbf3c('0x8'));var applications=[_0xbf3c('0x9'),_0xbf3c('0xa'),_0xbf3c('0xb'),_0xbf3c('0xc'),'playback',_0xbf3c('0xd')];var dispositions=['NO\x20ANSWER',_0xbf3c('0xe'),_0xbf3c('0xe'),'NO\x20ANSWER',_0xbf3c('0xf'),'NO\x20ANSWER',_0xbf3c('0x10'),_0xbf3c('0x11'),_0xbf3c('0xe'),_0xbf3c('0xe'),_0xbf3c('0xe')];config[_0xbf3c('0x12')]=_['defaults'](config[_0xbf3c('0x12')],{'host':_0xbf3c('0x13'),'port':0x18eb});var io=require(_0xbf3c('0x14'))(new Redis(config[_0xbf3c('0x12')]));function VoiceCallReport(_0xa6e2c8){this[_0xbf3c('0x15')]=_0xa6e2c8['channels'];this[_0xbf3c('0x16')]=_0xa6e2c8[_0xbf3c('0x16')];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0xbf3c('0x17')][_0xbf3c('0x18')](this));ami['on']('newexten',this[_0xbf3c('0x17')][_0xbf3c('0x18')](this));ami['on'](_0xbf3c('0x19'),this[_0xbf3c('0x1a')][_0xbf3c('0x18')](this));ami['on'](_0xbf3c('0x1b'),this['syncNewState'][_0xbf3c('0x18')](this));ami['on'](_0xbf3c('0x1c'),this['syncVarSet'][_0xbf3c('0x18')](this));ami['on']('hangup',this[_0xbf3c('0x1d')][_0xbf3c('0x18')](this));ami['on'](_0xbf3c('0x1e'),this[_0xbf3c('0x1f')][_0xbf3c('0x18')](this));ami['on'](_0xbf3c('0x20'),this[_0xbf3c('0x21')][_0xbf3c('0x18')](this));ami['on'](_0xbf3c('0x22'),this[_0xbf3c('0x23')][_0xbf3c('0x18')](this));ami['on'](_0xbf3c('0x24'),this['syncMusicOnHoldStart'][_0xbf3c('0x18')](this));ami['on'](_0xbf3c('0x25'),this[_0xbf3c('0x26')][_0xbf3c('0x18')](this));try{logger[_0xbf3c('0x27')](_0xbf3c('0x28'));ami[_0xbf3c('0x29')]();}catch(_0x509bf5){logger[_0xbf3c('0x2a')]('[voiceCallReport][coreshowchannels]',util[_0xbf3c('0x2b')](_0x509bf5,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xbf3c('0x2c')][_0xbf3c('0x2d')]=function(_0x12a268){return _0x12a268!==null&&!_['isUndefined'](_0x12a268);};VoiceCallReport[_0xbf3c('0x2c')][_0xbf3c('0x2e')]=function(_0x1b8d4c,_0x459390,_0x414a59){io['to'](_0x1b8d4c)[_0xbf3c('0x2e')](_0x459390,_0x414a59);};VoiceCallReport[_0xbf3c('0x2c')]['syncNewCallerId']=function(_0x344a15){try{if(this[_0xbf3c('0x2d')](_0x344a15)){logger[_0xbf3c('0x27')](_0xbf3c('0x2f'),_0x344a15[_0xbf3c('0x30')],_0x344a15[_0xbf3c('0x31')],_0x344a15[_0xbf3c('0x32')]);logger[_0xbf3c('0x33')](_0xbf3c('0x34'),_0x344a15[_0xbf3c('0x30')],util[_0xbf3c('0x2b')](_0x344a15,{'showHidden':![],'depth':null}));if(_0x344a15[_0xbf3c('0x30')]===_0x344a15[_0xbf3c('0x35')]){if(!_['isUndefined'](this[_0xbf3c('0x15')][_0x344a15['uniqueid']])){_[_0xbf3c('0x36')](this[_0xbf3c('0x15')][_0x344a15[_0xbf3c('0x30')]],_[_0xbf3c('0x37')](_0x344a15,_[_0xbf3c('0x38')](this[_0xbf3c('0x15')][_0x344a15['uniqueid']])));}}if(_0x344a15[_0xbf3c('0x39')]===_0xbf3c('0x3a')){if(this[_0xbf3c('0x16')][_0x344a15[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]){if(_0x344a15[_0xbf3c('0x3d')]==_0xbf3c('0x3e')){this[_0xbf3c('0x16')][_0x344a15[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x3f')]=_0x344a15[_0xbf3c('0x40')];this[_0xbf3c('0x2e')](util[_0xbf3c('0x41')](_0xbf3c('0x42'),this[_0xbf3c('0x16')][_0x344a15['channel']['split']('-')[0x0]]['name']),_0xbf3c('0x43'),{'destaccountcode':this['agents'][_0x344a15[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x44')],'destconnectedlinenum':_0x344a15[_0xbf3c('0x40')]});}}}}}catch(_0x2229dd){logger[_0xbf3c('0x2a')](_0xbf3c('0x45'),_0x344a15[_0xbf3c('0x30')],util[_0xbf3c('0x2b')](_0x2229dd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf3c('0x2c')][_0xbf3c('0x1a')]=function(_0x5eb0a9){try{if(this[_0xbf3c('0x2d')](_0x5eb0a9)){logger['debug'](_0xbf3c('0x46'),_0x5eb0a9[_0xbf3c('0x30')],util[_0xbf3c('0x2b')](_0x5eb0a9,{'showHidden':![],'depth':null}));if(this['channels'][_0x5eb0a9[_0xbf3c('0x30')]])return;if(_0x5eb0a9[_0xbf3c('0x3b')]===_0xbf3c('0x47'))return;if(_0x5eb0a9['uniqueid']!==_0x5eb0a9[_0xbf3c('0x35')]&&!this['blindTransfers'][_0x5eb0a9[_0xbf3c('0x35')]])return;logger[_0xbf3c('0x27')](_0xbf3c('0x48'),_0x5eb0a9[_0xbf3c('0x30')],_0x5eb0a9[_0xbf3c('0x39')],_0x5eb0a9[_0xbf3c('0x3d')]);this['channels'][_0x5eb0a9['uniqueid']]=new Channel();this[_0xbf3c('0x15')][_0x5eb0a9['uniqueid']][_0xbf3c('0x49')]=moment()[_0xbf3c('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbf3c('0x15')][_0x5eb0a9[_0xbf3c('0x30')]][_0xbf3c('0x4a')]=dispositions[_[_0xbf3c('0x4b')](_0x5eb0a9[_0xbf3c('0x4c')])];_[_0xbf3c('0x36')](this[_0xbf3c('0x15')][_0x5eb0a9['uniqueid']],_['pick'](_0x5eb0a9,_[_0xbf3c('0x38')](this['channels'][_0x5eb0a9[_0xbf3c('0x30')]])));if(_0x5eb0a9['context']===_0xbf3c('0x3a')){if(this['agents'][_0x5eb0a9[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]){if(_[_0xbf3c('0x4d')](this[_0xbf3c('0x16')][_0x5eb0a9[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x3f')])){this[_0xbf3c('0x16')][_0x5eb0a9[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x3f')]=_0x5eb0a9[_0xbf3c('0x3d')];logger[_0xbf3c('0x33')](_0xbf3c('0x4e'),_0x5eb0a9[_0xbf3c('0x30')],util[_0xbf3c('0x2b')]({'id':this[_0xbf3c('0x16')][_0x5eb0a9[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xbf3c('0x16')][_0x5eb0a9['channel'][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x44')],'destconnectedlinenum':_0x5eb0a9[_0xbf3c('0x3d')]},{'showHidden':![],'depth':null}));this[_0xbf3c('0x2e')](util[_0xbf3c('0x41')]('user:%s',this[_0xbf3c('0x16')][_0x5eb0a9[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x4f')]),_0xbf3c('0x43'),{'id':this[_0xbf3c('0x16')][_0x5eb0a9['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0xbf3c('0x16')][_0x5eb0a9[_0xbf3c('0x3b')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5eb0a9['exten']});}}}}}catch(_0x1c5afb){logger[_0xbf3c('0x2a')](_0xbf3c('0x50'),_0x5eb0a9[_0xbf3c('0x30')],util[_0xbf3c('0x2b')](_0x1c5afb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf3c('0x2c')]['syncNewExten']=function(_0x55eb04){try{if(this[_0xbf3c('0x2d')](_0x55eb04)){logger[_0xbf3c('0x33')]('[%s][voiceCallReport][newexten]\x20event:',_0x55eb04[_0xbf3c('0x30')],util[_0xbf3c('0x2b')](_0x55eb04,{'showHidden':![],'depth':null}));if(_0x55eb04['channel']===_0xbf3c('0x47')||_0x55eb04['exten']==='h')return;if(_0x55eb04[_0xbf3c('0x30')]===_0x55eb04[_0xbf3c('0x35')]||this['blindTransfers'][_0x55eb04['linkedid']]){_0x55eb04[_0xbf3c('0x51')]=_0x55eb04[_0xbf3c('0x51')][_0xbf3c('0x52')]();_0x55eb04[_0xbf3c('0x53')]=_0x55eb04[_0xbf3c('0x54')]&&_0x55eb04['appdata'][_0xbf3c('0x55')](_0xbf3c('0x56'))?_0x55eb04[_0xbf3c('0x54')]:(_0x55eb04[_0xbf3c('0x54')]||_0x55eb04[_0xbf3c('0x53')])['toLowerCase']();logger[_0xbf3c('0x27')](_0xbf3c('0x57'),_0x55eb04[_0xbf3c('0x30')],_0x55eb04[_0xbf3c('0x51')],_0x55eb04[_0xbf3c('0x53')]);if(_[_0xbf3c('0x4d')](this[_0xbf3c('0x15')][_0x55eb04[_0xbf3c('0x30')]])){this['channels'][_0x55eb04[_0xbf3c('0x30')]]=new Channel();this[_0xbf3c('0x15')][_0x55eb04['uniqueid']][_0xbf3c('0x49')]=_0x55eb04[_0xbf3c('0x58')]?moment()[_0xbf3c('0x59')](moment[_0xbf3c('0x58')](_0x55eb04[_0xbf3c('0x58')])['seconds'](),'seconds')[_0xbf3c('0x41')](_0xbf3c('0x5a')):moment()[_0xbf3c('0x41')](_0xbf3c('0x5a'));this[_0xbf3c('0x15')][_0x55eb04['uniqueid']][_0xbf3c('0x4a')]=_0xbf3c('0xf');}_[_0xbf3c('0x36')](this[_0xbf3c('0x15')][_0x55eb04[_0xbf3c('0x30')]],_[_0xbf3c('0x37')](_0x55eb04,_['keys'](this[_0xbf3c('0x15')][_0x55eb04[_0xbf3c('0x30')]])));if(_[_0xbf3c('0x5b')](applications,_0x55eb04[_0xbf3c('0x51')])){this[_0xbf3c('0x15')][_0x55eb04[_0xbf3c('0x30')]][_0xbf3c('0x5c')]=_0x55eb04['application'];this[_0xbf3c('0x15')][_0x55eb04['uniqueid']][_0xbf3c('0x5d')]=_0x55eb04[_0xbf3c('0x53')];if(_0x55eb04[_0xbf3c('0x51')]===_0xbf3c('0x9')&&_[_0xbf3c('0x55')](_0x55eb04['applicationdata'][_0xbf3c('0x52')](),_0xbf3c('0x5e'))){var _0x5a5900=_0x55eb04[_0xbf3c('0x53')][_0xbf3c('0x3c')]('=');var _0xc3a6ee=_0x5a5900[0x0][_0xbf3c('0x52')]()['match'](/cdr\((.*)\)/);if(_0xc3a6ee){if(_0xc3a6ee[0x1]===_0xbf3c('0x5f')&&!_[_0xbf3c('0x60')](this['channels'][_0x55eb04[_0xbf3c('0x30')]][_0xc3a6ee[0x1]]))return;this[_0xbf3c('0x15')][_0x55eb04[_0xbf3c('0x30')]][_0xc3a6ee[0x1]]=_0x5a5900[0x1];}}else if(_0x55eb04['application']===_0xbf3c('0xa')){this[_0xbf3c('0x15')][_0x55eb04['uniqueid']][_0xbf3c('0xa')]=_0x55eb04['applicationdata']['split'](',')[0x0];}}}}}catch(_0x3d22ae){logger[_0xbf3c('0x2a')](_0xbf3c('0x61'),_0x55eb04[_0xbf3c('0x30')],util['inspect'](_0x3d22ae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf3c('0x2c')][_0xbf3c('0x62')]=function(_0x53c40d){try{if(this[_0xbf3c('0x2d')](_0x53c40d)){logger[_0xbf3c('0x27')](_0xbf3c('0x63'),_0x53c40d[_0xbf3c('0x30')],_0x53c40d[_0xbf3c('0x35')],_0x53c40d['calleridname'],_0x53c40d[_0xbf3c('0x32')]);logger[_0xbf3c('0x33')]('[%s][voiceCallReport][newstate]\x20event:',_0x53c40d['uniqueid'],util[_0xbf3c('0x2b')](_0x53c40d,{'showHidden':![],'depth':null}));if(_0x53c40d[_0xbf3c('0x4c')]!=='6')return;if(_0x53c40d['uniqueid']!==_0x53c40d[_0xbf3c('0x35')]){var _0x53826f=moment();if(this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]]){if(!this['channels'][_0x53c40d['linkedid']][_0xbf3c('0x64')]){this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]][_0xbf3c('0x64')]=!![];this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]]['answertime']=_0x53826f[_0xbf3c('0x41')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x53c40d[_0xbf3c('0x35')]][_0xbf3c('0x49')]){this['channels'][_0x53c40d['linkedid']][_0xbf3c('0x65')]=_0x53826f[_0xbf3c('0x66')](this[_0xbf3c('0x15')][_0x53c40d['linkedid']][_0xbf3c('0x49')],_0xbf3c('0x67'));}}this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]][_0xbf3c('0x35')]=_0x53c40d[_0xbf3c('0x30')];if(_0x53c40d[_0xbf3c('0x32')]!=='xcally-motion-preview'){this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]][_0xbf3c('0x40')]=_0x53c40d[_0xbf3c('0x32')];}this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]][_0xbf3c('0x68')]=_0x53c40d['calleridname'];this['channels'][_0x53c40d[_0xbf3c('0x35')]][_0xbf3c('0x69')]=_0x53c40d[_0xbf3c('0x3b')];this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]][_0xbf3c('0x4a')]=dispositions[_[_0xbf3c('0x4b')](_0x53c40d[_0xbf3c('0x4c')])];if(this['agents'][_0x53c40d['channel'][_0xbf3c('0x3c')]('-')[0x0]]){this['channels'][_0x53c40d[_0xbf3c('0x35')]][_0xbf3c('0x6a')]=this[_0xbf3c('0x16')][_0x53c40d[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]['id'];this['channels'][_0x53c40d[_0xbf3c('0x35')]]['membername']=this['agents'][_0x53c40d[_0xbf3c('0x3b')]['split']('-')[0x0]][_0xbf3c('0x4f')];}}if(this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x30')]]){if(!this['channels'][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0x64')]){this[_0xbf3c('0x15')][_0x53c40d['uniqueid']]['answered']=!![];this['channels'][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0x6b')]=_0x53826f['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xbf3c('0x15')][_0x53c40d['uniqueid']][_0xbf3c('0x49')]){this['channels'][_0x53c40d['uniqueid']][_0xbf3c('0x65')]=_0x53826f['diff'](this['channels'][_0x53c40d[_0xbf3c('0x30')]]['starttime'],_0xbf3c('0x67'));}}if(_0x53c40d[_0xbf3c('0x32')]!==_0xbf3c('0x3e')){this['channels'][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0x40')]=_0x53c40d['calleridnum'];}this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0x68')]=_0x53c40d[_0xbf3c('0x31')];this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0x69')]=_0x53c40d[_0xbf3c('0x3b')];this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0x4a')]=dispositions[_[_0xbf3c('0x4b')](_0x53c40d[_0xbf3c('0x4c')])];}}else{if(this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x30')]]){if(this[_0xbf3c('0x16')][_0x53c40d['channel'][_0xbf3c('0x3c')]('-')[0x0]]){this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0x6a')]=this[_0xbf3c('0x16')][_0x53c40d[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]['id'];this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0x6c')]=this[_0xbf3c('0x16')][_0x53c40d['channel'][_0xbf3c('0x3c')]('-')[0x0]]['name'];}}}if(_0x53c40d[_0xbf3c('0x39')]===_0xbf3c('0x3a')){if(this[_0xbf3c('0x16')][_0x53c40d[_0xbf3c('0x3b')]['split']('-')[0x0]]){this['agents'][_0x53c40d['channel'][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x3f')]=_0x53c40d[_0xbf3c('0x3d')];var _0x15101b,_0x41cd52;if(this['channels'][_0x53c40d[_0xbf3c('0x30')]]){_0x15101b=this[_0xbf3c('0x15')][_0x53c40d['uniqueid']][_0xbf3c('0x6d')];_0x41cd52=this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x30')]][_0xbf3c('0xa')];}else if(this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]]){_0x15101b=this[_0xbf3c('0x15')][_0x53c40d[_0xbf3c('0x35')]]['routealias'];_0x41cd52=this[_0xbf3c('0x15')][_0x53c40d['linkedid']]['queue'];}logger[_0xbf3c('0x33')](_0xbf3c('0x6e'),_0x53c40d[_0xbf3c('0x30')],util[_0xbf3c('0x2b')]({'id':this[_0xbf3c('0x16')][_0x53c40d[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xbf3c('0x16')][_0x53c40d[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x44')],'destconnectedlinenum':_0x53c40d['exten'],'routealias':_0x15101b,'queue':_0x41cd52||undefined},{'showHidden':![],'depth':null}));this['emit'](util[_0xbf3c('0x41')](_0xbf3c('0x42'),this[_0xbf3c('0x16')][_0x53c40d[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x4f')]),_0xbf3c('0x43'),{'id':this[_0xbf3c('0x16')][_0x53c40d[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0xbf3c('0x16')][_0x53c40d[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x44')],'destconnectedlinenum':_0x53c40d[_0xbf3c('0x3d')],'routealias':_0x15101b,'queue':_0x41cd52||undefined});}}}}catch(_0x56cd76){logger[_0xbf3c('0x2a')](_0xbf3c('0x6f'),_0x53c40d[_0xbf3c('0x30')],util[_0xbf3c('0x2b')](_0x56cd76,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf3c('0x2c')][_0xbf3c('0x70')]=function(_0x230fbe,_0x5a9c96){try{if(this[_0xbf3c('0x15')][_0x230fbe]){logger[_0xbf3c('0x27')](_0xbf3c('0x71'),_0x230fbe,_0x5a9c96);this[_0xbf3c('0x15')][_0x230fbe][_0xbf3c('0x72')]=!![];if(_[_0xbf3c('0x73')](_0x5a9c96,_0xbf3c('0x74'))){_0x5a9c96=_0x5a9c96[_0xbf3c('0x75')]('.wav49',_0xbf3c('0x76'));}this[_0xbf3c('0x15')][_0x230fbe]['monitorFilename']=_0x5a9c96;var _0x4a83e9=_[_0xbf3c('0x77')](this['channels'][_0x230fbe]['monitors'],{'filename':_0x5a9c96});if(_[_0xbf3c('0x60')](_0x4a83e9)){this[_0xbf3c('0x15')][_0x230fbe][_0xbf3c('0x78')][_0xbf3c('0x79')]({'filename':_0x5a9c96,'createdAt':moment()[_0xbf3c('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xbf3c('0x7a')});}}}catch(_0x49defa){logger[_0xbf3c('0x2a')](_0xbf3c('0x7b'),_0x230fbe,util[_0xbf3c('0x2b')](_0x49defa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf3c('0x2c')][_0xbf3c('0x7c')]=function(_0x5e7744){try{if(this[_0xbf3c('0x2d')](_0x5e7744)){logger[_0xbf3c('0x33')](_0xbf3c('0x7d'),_0x5e7744[_0xbf3c('0x30')],util['inspect'](_0x5e7744,{'showHidden':![],'depth':null}));if(this['channels'][_0x5e7744[_0xbf3c('0x30')]]&&_0x5e7744['channel']!=_0xbf3c('0x47')){if(this[_0xbf3c('0x2d')](_0x5e7744[_0xbf3c('0x7e')])){if(this[_0xbf3c('0x2d')](_0x5e7744[_0xbf3c('0x7e')][_0xbf3c('0x7f')])){logger['info'](_0xbf3c('0x80'),_0x5e7744[_0xbf3c('0x30')],_0x5e7744['value']);this[_0xbf3c('0x70')](_0x5e7744['uniqueid'],_0x5e7744[_0xbf3c('0x81')]);}else if(this[_0xbf3c('0x2d')](_0x5e7744[_0xbf3c('0x7e')][_0xbf3c('0x82')])){logger[_0xbf3c('0x27')](_0xbf3c('0x83'),_0x5e7744['uniqueid'],_0x5e7744[_0xbf3c('0x81')]);this[_0xbf3c('0x15')][_0x5e7744['uniqueid']][_0xbf3c('0x32')]=_0x5e7744[_0xbf3c('0x81')];}else if(this[_0xbf3c('0x2d')](_0x5e7744['variable'][_0xbf3c('0x84')])){logger[_0xbf3c('0x27')](_0xbf3c('0x85'),_0x5e7744[_0xbf3c('0x30')],_0x5e7744[_0xbf3c('0x81')]);this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x30')]][_0xbf3c('0x86')]=_0x5e7744['value'];}else if(this['isNotNull'](_0x5e7744[_0xbf3c('0x7e')]['xmd-cdrtype'])){logger[_0xbf3c('0x27')](_0xbf3c('0x87'),_0x5e7744[_0xbf3c('0x30')],_0x5e7744[_0xbf3c('0x81')]);this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x30')]][_0xbf3c('0x5f')]=_0x5e7744[_0xbf3c('0x81')];}else if(this[_0xbf3c('0x2d')](_0x5e7744['variable']['xmd-queue'])){logger['info'](_0xbf3c('0x88'),_0x5e7744[_0xbf3c('0x30')],_0x5e7744[_0xbf3c('0x81')][_0xbf3c('0x3c')](',')[0x0]);this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x30')]]['queue']=_0x5e7744[_0xbf3c('0x81')]['split'](',')[0x0];}else if(this[_0xbf3c('0x2d')](_0x5e7744['variable'][_0xbf3c('0x89')])){logger[_0xbf3c('0x27')](_0xbf3c('0x8a'),_0x5e7744[_0xbf3c('0x30')],_0x5e7744[_0xbf3c('0x81')]);this[_0xbf3c('0x15')][_0x5e7744['uniqueid']][_0xbf3c('0x8b')]=_0x5e7744[_0xbf3c('0x81')];}else if(this[_0xbf3c('0x2d')](_0x5e7744['variable'][_0xbf3c('0x8c')])){logger[_0xbf3c('0x27')](_0xbf3c('0x8d'),_0x5e7744['uniqueid'],_0x5e7744[_0xbf3c('0x81')]);this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x30')]][_0xbf3c('0x8e')]=_0x5e7744['value'];}else if(this[_0xbf3c('0x2d')](_0x5e7744[_0xbf3c('0x7e')][_0xbf3c('0x8f')])){logger[_0xbf3c('0x27')](_0xbf3c('0x90'),_0x5e7744[_0xbf3c('0x30')],_0x5e7744['value']);this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x30')]][_0xbf3c('0x91')]=_0x5e7744[_0xbf3c('0x81')];}else if(this[_0xbf3c('0x2d')](_0x5e7744[_0xbf3c('0x7e')][_0xbf3c('0x92')])){logger[_0xbf3c('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x5e7744[_0xbf3c('0x30')],_0x5e7744[_0xbf3c('0x81')]);this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x30')]][_0xbf3c('0xa')]=_0x5e7744[_0xbf3c('0x81')];}else if(this['isNotNull'](_0x5e7744['variable'][_0xbf3c('0x93')])){logger[_0xbf3c('0x27')](_0xbf3c('0x94'),_0x5e7744[_0xbf3c('0x30')],_0x5e7744[_0xbf3c('0x81')]);this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x30')]][_0xbf3c('0x95')]=_0x5e7744[_0xbf3c('0x81')];}}}else if(this['isNotNull'](_0x5e7744[_0xbf3c('0x7e')][_0xbf3c('0x7f')])){if(_0x5e7744[_0xbf3c('0x81')]){var _0x2bfc67=path[_0xbf3c('0x96')](_0x5e7744[_0xbf3c('0x81')])[_0xbf3c('0x4f')];logger[_0xbf3c('0x27')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x2bfc67,_0x5e7744['value']);this[_0xbf3c('0x70')](_0x2bfc67,_0x5e7744[_0xbf3c('0x81')]);}}else if(this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x35')]]){if(this[_0xbf3c('0x2d')](_0x5e7744[_0xbf3c('0x7e')])){if(this[_0xbf3c('0x2d')](_0x5e7744[_0xbf3c('0x7e')][_0xbf3c('0x93')])){logger[_0xbf3c('0x27')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5e7744[_0xbf3c('0x35')],_0x5e7744[_0xbf3c('0x81')]);this[_0xbf3c('0x15')][_0x5e7744[_0xbf3c('0x35')]]['sipcalllinkedid']=_0x5e7744[_0xbf3c('0x81')];}}}}}catch(_0x27ba17){logger[_0xbf3c('0x2a')](_0xbf3c('0x97'),_0x5e7744[_0xbf3c('0x30')],util[_0xbf3c('0x2b')](_0x27ba17,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbf3c('0x2c')][_0xbf3c('0x1d')]=function(_0x243a54){try{if(this[_0xbf3c('0x2d')](_0x243a54)){logger[_0xbf3c('0x33')](_0xbf3c('0x98'),_0x243a54['uniqueid'],util['inspect'](_0x243a54,{'showHidden':![],'depth':null}));if(this[_0xbf3c('0x99')][_0x243a54['linkedid']]){if(this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]]['linkedid']]){this[_0xbf3c('0x15')][this['blindTransfers'][_0x243a54['linkedid']][_0xbf3c('0x35')]]['uniqueid']=_0x243a54[_0xbf3c('0x30')];this[_0xbf3c('0x15')][this['blindTransfers'][_0x243a54[_0xbf3c('0x35')]]['linkedid']]['answered']=this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]][_0xbf3c('0x64')];this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x35')]][_0xbf3c('0x6b')]=this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]]['answertime'];this[_0xbf3c('0x15')][this['blindTransfers'][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x35')]]['destinationchannel']=this['channels'][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x35')]]['channel'];this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]]['linkedid']][_0xbf3c('0x4a')]=this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]]['disposition'];this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]]=this[_0xbf3c('0x15')][this['blindTransfers'][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x35')]];delete this['channels'][this['blindTransfers'][_0x243a54[_0xbf3c('0x35')]]['linkedid']];}else if(this['channels'][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]]){this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]][_0xbf3c('0x30')]=[this['channels'][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]][_0xbf3c('0x35')],this['channels'][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]]['uniqueid']]['linkedid']=this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]][_0xbf3c('0x30')]][0x0];this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]][_0xbf3c('0x64')]=this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]][_0xbf3c('0x64')];this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]][_0xbf3c('0x6b')]=this['channels'][_0x243a54['uniqueid']][_0xbf3c('0x6b')];this['channels'][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]][_0xbf3c('0x69')]=this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]]['channel'];this[_0xbf3c('0x15')][this['blindTransfers'][_0x243a54['linkedid']][_0xbf3c('0x30')]][_0xbf3c('0x4a')]=this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]][_0xbf3c('0x4a')];this['channels'][_0x243a54[_0xbf3c('0x30')]]=this[_0xbf3c('0x15')][this['blindTransfers'][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]];delete this[_0xbf3c('0x15')][this[_0xbf3c('0x99')][_0x243a54[_0xbf3c('0x35')]][_0xbf3c('0x30')]];}}if(this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]]){logger[_0xbf3c('0x27')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x243a54['uniqueid'],_0x243a54[_0xbf3c('0x9a')]);var _0x1f6694=moment();this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]]['endtime']=_0x1f6694[_0xbf3c('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]]['duration']=_0x1f6694[_0xbf3c('0x66')](this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]]['starttime'],_0xbf3c('0x67'));if(this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]][_0xbf3c('0x64')]){this['channels'][_0x243a54[_0xbf3c('0x30')]][_0xbf3c('0x9b')]=_0x1f6694['diff'](this[_0xbf3c('0x15')][_0x243a54['uniqueid']]['answertime'],_0xbf3c('0x67'));this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]][_0xbf3c('0x65')]=this[_0xbf3c('0x15')][_0x243a54[_0xbf3c('0x30')]][_0xbf3c('0x58')]-this[_0xbf3c('0x15')][_0x243a54['uniqueid']][_0xbf3c('0x9b')];}if(_0x243a54[_0xbf3c('0x39')]===_0xbf3c('0x3a')){if(this[_0xbf3c('0x16')][_0x243a54[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]){this[_0xbf3c('0x16')][_0x243a54['channel']['split']('-')[0x0]]=_[_0xbf3c('0x9c')](this[_0xbf3c('0x16')][_0x243a54[_0xbf3c('0x3b')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0xbf3c('0x33')](_0xbf3c('0x9d'),_0x243a54[_0xbf3c('0x30')],util[_0xbf3c('0x2b')]({'id':this[_0xbf3c('0x16')][_0x243a54[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x243a54[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]][_0xbf3c('0x44')]},{'showHidden':![],'depth':null}));this[_0xbf3c('0x2e')](util[_0xbf3c('0x41')](_0xbf3c('0x42'),this['agents'][_0x243a54[_0xbf3c('0x3b')]['split']('-')[0x0]][_0xbf3c('0x4f')]),_0xbf3c('0x9e'),{'id':this[_0xbf3c('0x16')][_0x243a54[_0xbf3c('0x3b')][_0xbf3c('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xbf3c('0x16')][_0x243a54[_0xbf3c('0x3b')]['split']('-')[0x0]][_0xbf3c('0x44')]});for(var _0x3d4ba2=0x0;_0x3d4ba20x0?_0x494065:0x0;this['voiceQueues'][_0x469cf2[_0x42b7('0x67')]]['talking']=this[_0x42b7('0xe')][_0x469cf2[_0x42b7('0x67')]][_0x42b7('0x28')]>_[_0x42b7('0x6c')](_0x469cf2['loggedin'])?_[_0x42b7('0x6c')](_0x469cf2[_0x42b7('0x6d')]):this[_0x42b7('0xe')][_0x469cf2[_0x42b7('0x67')]][_0x42b7('0x28')];this['emitVoiceQueueSummary'](this[_0x42b7('0xe')][_0x469cf2[_0x42b7('0x67')]],_0x42b7('0x6e'));}logger[_0x42b7('0x44')](_0x42b7('0x6f'),util[_0x42b7('0x38')](this['voiceQueues'][_0x469cf2[_0x42b7('0x67')]],{'showHidden':![],'depth':null}));ami[_0x42b7('0x3f')]('custom:queuesummary',this[_0x42b7('0xe')][_0x469cf2[_0x42b7('0x67')]]);}}}catch(_0x1e1633){logger[_0x42b7('0x35')](_0x42b7('0x66'),util[_0x42b7('0x38')](_0x1e1633,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b7('0x9')][_0x42b7('0x14')]=function(_0x15cf85){logger[_0x42b7('0x44')](_0x42b7('0x70'),util['inspect'](_0x15cf85,{'showHidden':![],'depth':null}));this[_0x42b7('0xf')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x26b821){try{if(this['isNotNull'](_0x26b821)){logger[_0x42b7('0x44')](_0x42b7('0x71'),_0x26b821[_0x42b7('0x46')],util[_0x42b7('0x38')](_0x26b821,{'showHidden':![],'depth':null}));if(_[_0x42b7('0x60')](this[_0x42b7('0xc')][_0x26b821[_0x42b7('0x46')]]))this['queueReports'][_0x26b821[_0x42b7('0x46')]]=[];if(_[_0x42b7('0x60')](this[_0x42b7('0x2e')][_0x26b821[_0x42b7('0x46')]]))this[_0x42b7('0x2e')][_0x26b821[_0x42b7('0x46')]]={};var _0x37dfcb=new QueueReport();_0x37dfcb['name']=_0x26b821[_0x42b7('0x67')];_0x37dfcb[_0x42b7('0x54')]=this[_0x42b7('0xe')][_0x37dfcb['name']]&&this[_0x42b7('0xe')][_0x37dfcb[_0x42b7('0x49')]][_0x42b7('0x54')]?this['voiceQueues'][_0x37dfcb['name']][_0x42b7('0x54')]||_0x42b7('0x4c'):'inbound';_0x37dfcb[_0x42b7('0x67')]=_0x26b821[_0x42b7('0x67')];_0x37dfcb[_0x42b7('0x72')]=moment()[_0x42b7('0x42')](_0x42b7('0x73'));_0x37dfcb[_0x42b7('0x74')]=_0x26b821[_0x42b7('0x74')];_0x37dfcb[_0x42b7('0x75')]=_0x26b821[_0x42b7('0x75')];_0x37dfcb[_0x42b7('0x46')]=_0x26b821['uniqueid'];_0x37dfcb[_0x42b7('0x76')]=this[_0x42b7('0x2e')][_0x26b821['uniqueid']][_0x42b7('0x76')];logger[_0x42b7('0x69')](_0x42b7('0x77'),_0x37dfcb['name'],_0x37dfcb[_0x42b7('0x54')]);_['merge'](_0x37dfcb,_[_0x42b7('0x78')](_0x26b821,_[_0x42b7('0x79')](_0x37dfcb)));this[_0x42b7('0xc')][_0x26b821[_0x42b7('0x46')]]['push'](_0x37dfcb);this['channels'][_0x26b821['uniqueid']]=_0x37dfcb;this['emitVoiceQueueChannelSave'](_0x37dfcb,_0x42b7('0x15'));}}catch(_0x491ce8){logger[_0x42b7('0x35')]('[%s][voiceQueueReport][queuecallerjoin]',_0x26b821[_0x42b7('0x46')],util[_0x42b7('0x38')](_0x491ce8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b7('0x9')][_0x42b7('0x7a')]=function(_0x1cab7f){try{if(this[_0x42b7('0x5f')](_0x1cab7f)){logger['debug'](_0x42b7('0x7b'),_0x1cab7f['uniqueid'],util[_0x42b7('0x38')](_0x1cab7f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1cab7f['uniqueid']]){var _0x4ed911=_['last'](this[_0x42b7('0xc')][_0x1cab7f[_0x42b7('0x46')]]);_0x4ed911[_0x42b7('0x7c')]=![];_0x4ed911[_0x42b7('0x7d')]=null;_0x4ed911[_0x42b7('0x7e')]=_0x1cab7f[_0x42b7('0x7e')];_0x4ed911[_0x42b7('0x7f')]=_0x1cab7f[_0x42b7('0x7f')];_0x4ed911[_0x42b7('0x16')]=!![];_0x4ed911[_0x42b7('0x80')]=moment()[_0x42b7('0x42')](_0x42b7('0x73'));_0x4ed911[_0x42b7('0x47')]=_0x42b7('0x81');_0x4ed911[_0x42b7('0x82')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4ed911[_0x42b7('0x49')],_0x4ed911['type']);this[_0x42b7('0x2e')][_0x1cab7f[_0x42b7('0x46')]]=_0x4ed911;this[_0x42b7('0x3d')](_0x4ed911,'queuecallerabandon');}}}catch(_0x25d934){logger[_0x42b7('0x35')](_0x42b7('0x7b'),_0x1cab7f['uniqueid'],util[_0x42b7('0x38')](_0x25d934,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x42b7('0x18')]=function(_0x343577){try{if(this[_0x42b7('0x5f')](_0x343577)){logger[_0x42b7('0x44')](_0x42b7('0x83'),_0x343577[_0x42b7('0x46')],util['inspect'](_0x343577,{'showHidden':![],'depth':null}));if(this[_0x42b7('0xc')][_0x343577[_0x42b7('0x46')]]){var _0x5d5324=_[_0x42b7('0x84')](this[_0x42b7('0xc')][_0x343577[_0x42b7('0x46')]]);_0x5d5324[_0x42b7('0x85')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d5324[_0x42b7('0x86')]=_0x343577['connectedlinenum'];_0x5d5324[_0x42b7('0x87')]=_0x343577[_0x42b7('0x87')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5d5324['name'],_0x5d5324[_0x42b7('0x54')],_0x343577[_0x42b7('0x86')],_0x343577[_0x42b7('0x87')]);this[_0x42b7('0x2e')][_0x343577[_0x42b7('0x46')]]=_0x5d5324;this[_0x42b7('0x88')](_0x5d5324,'queuecallerleave');}}}catch(_0x825653){logger['error'](_0x42b7('0x83'),_0x343577[_0x42b7('0x46')],util[_0x42b7('0x38')](_0x825653,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x42b7('0x1a')]=function(_0x2ffd30){try{if(this[_0x42b7('0x5f')](_0x2ffd30)){logger[_0x42b7('0x44')](_0x42b7('0x89'),_0x2ffd30[_0x42b7('0x46')],util[_0x42b7('0x38')](_0x2ffd30,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2ffd30[_0x42b7('0x46')]]){var _0x22c1c2=_[_0x42b7('0x84')](this[_0x42b7('0xc')][_0x2ffd30[_0x42b7('0x46')]]);_0x22c1c2[_0x42b7('0x7c')]=!![];_0x22c1c2['queuecallerexitreason']=_0x42b7('0x8a');logger[_0x42b7('0x69')](_0x42b7('0x8b'),_0x22c1c2[_0x42b7('0x49')],_0x22c1c2[_0x42b7('0x54')]);}}}catch(_0x52fe96){logger['error'](_0x42b7('0x89'),_0x2ffd30[_0x42b7('0x46')],util['inspect'](_0x52fe96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b7('0x9')][_0x42b7('0x8c')]=function(_0x58eb8a){try{if(this['isNotNull'](_0x58eb8a)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x58eb8a[_0x42b7('0x46')],util[_0x42b7('0x38')](_0x58eb8a,{'showHidden':![],'depth':null}));if(this[_0x42b7('0xc')][_0x58eb8a[_0x42b7('0x46')]]){var _0x132e04=_[_0x42b7('0x84')](this[_0x42b7('0xc')][_0x58eb8a[_0x42b7('0x46')]]);_0x132e04['queuecallerabandon']=![];_0x132e04[_0x42b7('0x80')]=null;_0x132e04['assigned']=!![];_0x132e04[_0x42b7('0x82')]=_0x58eb8a[_0x42b7('0x8d')];_0x132e04[_0x42b7('0x7e')]=_0x58eb8a[_0x42b7('0x7e')];_0x132e04[_0x42b7('0x7c')]=!![];_0x132e04[_0x42b7('0x8e')]=![];_0x132e04['queuecallerexitAt']=null;if(!_0x132e04['transfer']){if(_0x58eb8a['reason']==_0x42b7('0x8f')){_0x132e04['queuecallerexitreason']=_0x42b7('0x90');logger[_0x42b7('0x69')](_0x42b7('0x91'),_0x132e04[_0x42b7('0x49')],_0x132e04[_0x42b7('0x54')]);}else{if(_[_0x42b7('0x92')](_0x58eb8a[_0x42b7('0x31')][_0x42b7('0x93')](),_0x42b7('0x94'))){if(this[_0x42b7('0xc')][_0x58eb8a[_0x42b7('0x95')]]){var _0x471175=_['last'](this['queueReports'][_0x58eb8a[_0x42b7('0x95')]]);_0x471175[_0x42b7('0x7c')]=![];_0x471175['queuecallerexit']=!![];_0x471175[_0x42b7('0x96')]=moment(_0x132e04[_0x42b7('0x72')])[_0x42b7('0x97')](_0x58eb8a[_0x42b7('0x7e')],_0x42b7('0x98'))[_0x42b7('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x471175[_0x42b7('0x47')]=_0x42b7('0x99');_0x471175['transfer']=!![];_0x471175[_0x42b7('0x9a')]=_0x42b7('0x9b');_0x471175[_0x42b7('0x9c')]=_0x58eb8a[_0x42b7('0x9d')];_0x471175[_0x42b7('0x9e')]=_0x58eb8a[_0x42b7('0x46')];logger[_0x42b7('0x69')](_0x42b7('0x9f'),_0x471175['name'],_0x471175[_0x42b7('0x54')]);var _0x21c972=this[_0x42b7('0xc')][_0x58eb8a[_0x42b7('0x95')]];this['queueReports'][_0x58eb8a['linkedid']]=this[_0x42b7('0xc')][_0x58eb8a['uniqueid']];this[_0x42b7('0xc')][_0x58eb8a[_0x42b7('0x46')]]=_0x21c972;}}else{_0x132e04['queuecallerexitreason']=_0x42b7('0xa0')+_0x58eb8a[_0x42b7('0xa1')]['toUpperCase']();logger['info'](_0x42b7('0xa2'),_0x132e04[_0x42b7('0x49')],_0x132e04['type'],_0x132e04[_0x42b7('0x47')]);}}}this['channels'][_0x58eb8a[_0x42b7('0x46')]]=_0x132e04;this[_0x42b7('0x3d')](_0x132e04,_0x42b7('0x19'));}}}catch(_0x110e52){logger[_0x42b7('0x35')]('[%s][voiceQueueReport][agentcomplete]',_0x58eb8a['uniqueid'],util[_0x42b7('0x38')](_0x110e52,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b7('0x9')][_0x42b7('0x1c')]=function(_0x48588b){try{if(this[_0x42b7('0x5f')](_0x48588b)){logger[_0x42b7('0x44')](_0x42b7('0xa3'),_0x48588b['uniqueid'],util[_0x42b7('0x38')](_0x48588b,{'showHidden':![],'depth':null}));this[_0x42b7('0xa4')](_0x48588b[_0x42b7('0x46')],_['keys'](_0x48588b[_0x42b7('0xa5')])[0x0],_0x48588b[_0x42b7('0xa6')]);if(this[_0x42b7('0xc')][_0x48588b[_0x42b7('0x46')]]){var _0x49eee5=_[_0x42b7('0x84')](this[_0x42b7('0xc')][_0x48588b[_0x42b7('0x46')]]);if(_0x49eee5){if(this[_0x42b7('0x5f')](_0x48588b[_0x42b7('0xa5')])&&this[_0x42b7('0x5f')](_0x48588b[_0x42b7('0xa5')][_0x42b7('0xa7')])){switch(_0x48588b[_0x42b7('0xa6')]){case'CONTINUE':_0x49eee5[_0x42b7('0x8e')]=![];_0x49eee5['queuecallerexitAt']=null;break;case _0x42b7('0xa8'):_0x49eee5[_0x42b7('0xa9')]=_0x42b7('0xaa');_0x49eee5['queuecallerexit']=!![];_0x49eee5['queuecallerexitAt']=moment()[_0x42b7('0x42')](_0x42b7('0x73'));_0x49eee5['queuecallerleaveAt']=moment()['format'](_0x42b7('0x73'));logger[_0x42b7('0x44')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x48588b[_0x42b7('0x46')],util[_0x42b7('0x38')](_0x49eee5,{'showHidden':![],'depth':null}));ami[_0x42b7('0x3f')](_0x42b7('0xab'),_0x49eee5);break;default:_0x49eee5['queuecallerexit']=!![];_0x49eee5[_0x42b7('0x96')]=moment()[_0x42b7('0x42')](_0x42b7('0x73'));_0x49eee5[_0x42b7('0x85')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x49eee5[_0x42b7('0x16')]=![];_0x49eee5[_0x42b7('0x80')]=null;_0x49eee5[_0x42b7('0x47')]=_0x48588b[_0x42b7('0xa6')];this[_0x42b7('0x2e')][_0x48588b['uniqueid']]=_0x49eee5;this[_0x42b7('0x3d')](_0x49eee5,'varset');}else if(this[_0x42b7('0x5f')](_0x48588b[_0x42b7('0xa5')])&&this[_0x42b7('0x5f')](_0x48588b[_0x42b7('0xa5')][_0x42b7('0xac')])){if(!_0x49eee5[_0x42b7('0x16')]){_0x49eee5[_0x42b7('0x8e')]=!![];_0x49eee5[_0x42b7('0x96')]=moment()['format'](_0x42b7('0x73'));_0x49eee5[_0x42b7('0x47')]=_0x42b7('0xad');_0x49eee5[_0x42b7('0x85')]=moment()['format'](_0x42b7('0x73'));this['channels'][_0x48588b[_0x42b7('0x46')]]=_0x49eee5;}}logger[_0x42b7('0x69')](_0x42b7('0xae'),_0x48588b[_0x42b7('0x46')],_0x49eee5['name'],_0x49eee5[_0x42b7('0x54')],_[_0x42b7('0x79')](_0x48588b[_0x42b7('0xa5')])[0x0],_0x48588b[_0x42b7('0xa6')]);_0x49eee5['variables']=this[_0x42b7('0x11')][_0x48588b[_0x42b7('0x46')]];}}}}catch(_0x497e81){logger[_0x42b7('0x35')]('[%s][voiceQueueReport][varset]',_0x48588b[_0x42b7('0x46')],util[_0x42b7('0x38')](_0x497e81,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x18ca31,_0xe789d2,_0x321f8d){var _0x10ee39=[_0x42b7('0xaf'),_0x42b7('0xb0'),_0x42b7('0xb1'),_0x42b7('0xb2'),_0x42b7('0xb3'),_0x42b7('0xb4'),_0x42b7('0xb5'),_0x42b7('0xb6'),'sipcallid','sipuri','bridgepeer',_0x42b7('0xb7'),_0x42b7('0xb8'),'memberdynamic',_0x42b7('0xb9'),_0x42b7('0xba'),_0x42b7('0x8d'),_0x42b7('0xbb'),'memberrealtime'];if(!_['isNil'](_0xe789d2)&&!_[_0x42b7('0xbc')](_0x10ee39,_0xe789d2)){if(_[_0x42b7('0x60')](this[_0x42b7('0x11')][_0x18ca31])){this['variables'][_0x18ca31]={};}this[_0x42b7('0x11')][_0x18ca31][_0xe789d2]=_0x321f8d;}};VoiceQueueReport['prototype'][_0x42b7('0x1d')]=function(_0x3156b6){try{if(this[_0x42b7('0x5f')](_0x3156b6)){logger[_0x42b7('0x44')](_0x42b7('0xbd'),_0x3156b6[_0x42b7('0x46')],util[_0x42b7('0x38')](_0x3156b6,{'showHidden':![],'depth':null}));if(this[_0x42b7('0xc')][_0x3156b6[_0x42b7('0x46')]]){for(var _0x1538ed=0x0,_0x2e13cb={};_0x1538ed0x0?_0x1808f8:0x0;this['voiceQueues'][_0x30318a[_0x199e('0x6a')]]['talking']=this['voiceQueues'][_0x30318a[_0x199e('0x6a')]][_0x199e('0x30')]>_[_0x199e('0x6f')](_0x30318a['loggedin'])?_[_0x199e('0x6f')](_0x30318a[_0x199e('0x70')]):this[_0x199e('0x14')][_0x30318a[_0x199e('0x6a')]][_0x199e('0x30')];this[_0x199e('0x51')](this[_0x199e('0x14')][_0x30318a[_0x199e('0x6a')]],_0x199e('0x17'));}logger[_0x199e('0x44')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x199e('0x3b')](this[_0x199e('0x14')][_0x30318a[_0x199e('0x6a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x199e('0x71'),this[_0x199e('0x14')][_0x30318a[_0x199e('0x6a')]]);}}}catch(_0x488a59){logger[_0x199e('0x39')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x488a59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x199e('0xc')][_0x199e('0x1a')]=function(_0x568e12){logger['debug'](_0x199e('0x72'),util[_0x199e('0x3b')](_0x568e12,{'showHidden':![],'depth':null}));this[_0x199e('0x15')]=!![];};VoiceQueueReport[_0x199e('0xc')][_0x199e('0x1d')]=function(_0x4f2f4f){try{if(this['isNotNull'](_0x4f2f4f)){logger['debug'](_0x199e('0x73'),_0x4f2f4f[_0x199e('0x47')],util[_0x199e('0x3b')](_0x4f2f4f,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x199e('0x10')][_0x4f2f4f[_0x199e('0x47')]]))this[_0x199e('0x10')][_0x4f2f4f[_0x199e('0x47')]]=[];if(_['isUndefined'](this[_0x199e('0x12')][_0x4f2f4f[_0x199e('0x47')]]))this[_0x199e('0x12')][_0x4f2f4f[_0x199e('0x47')]]={};var _0x23d10c=new QueueReport();_0x23d10c[_0x199e('0x4e')]=_0x4f2f4f[_0x199e('0x6a')];_0x23d10c['type']=this[_0x199e('0x14')][_0x23d10c[_0x199e('0x4e')]]&&this[_0x199e('0x14')][_0x23d10c['name']][_0x199e('0x52')]?this[_0x199e('0x14')][_0x23d10c[_0x199e('0x4e')]][_0x199e('0x52')]||_0x199e('0x53'):_0x199e('0x53');_0x23d10c[_0x199e('0x6a')]=_0x4f2f4f[_0x199e('0x6a')];_0x23d10c[_0x199e('0x74')]=moment()[_0x199e('0x48')](_0x199e('0x75'));_0x23d10c[_0x199e('0x76')]=_0x4f2f4f[_0x199e('0x76')];_0x23d10c['count']=_0x4f2f4f[_0x199e('0x77')];_0x23d10c[_0x199e('0x47')]=_0x4f2f4f[_0x199e('0x47')];_0x23d10c[_0x199e('0x78')]=this[_0x199e('0x12')][_0x4f2f4f['uniqueid']]['routealias'];logger[_0x199e('0x79')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x23d10c['name'],_0x23d10c[_0x199e('0x52')]);_['merge'](_0x23d10c,_['pick'](_0x4f2f4f,_['keys'](_0x23d10c)));this[_0x199e('0x10')][_0x4f2f4f['uniqueid']][_0x199e('0x7a')](_0x23d10c);this[_0x199e('0x12')][_0x4f2f4f[_0x199e('0x47')]]=_0x23d10c;this[_0x199e('0x7b')](_0x23d10c,'queuecallerjoin');}}catch(_0x10ac81){logger[_0x199e('0x39')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4f2f4f['uniqueid'],util['inspect'](_0x10ac81,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x199e('0xc')][_0x199e('0x1f')]=function(_0x521c60){try{if(this['isNotNull'](_0x521c60)){logger[_0x199e('0x44')](_0x199e('0x7c'),_0x521c60[_0x199e('0x47')],util[_0x199e('0x3b')](_0x521c60,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x521c60[_0x199e('0x47')]]){var _0x1ec361=_[_0x199e('0x7d')](this[_0x199e('0x10')][_0x521c60['uniqueid']]);_0x1ec361[_0x199e('0x7e')]=![];_0x1ec361[_0x199e('0x7f')]=null;_0x1ec361['holdtime']=_0x521c60['holdtime'];_0x1ec361[_0x199e('0x80')]=_0x521c60[_0x199e('0x80')];_0x1ec361[_0x199e('0x1e')]=!![];_0x1ec361[_0x199e('0x81')]=moment()[_0x199e('0x48')](_0x199e('0x75'));_0x1ec361[_0x199e('0x4b')]=_0x199e('0x82');_0x1ec361['lastAssignedTo']=null;logger[_0x199e('0x79')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1ec361['name'],_0x1ec361['type']);this['channels'][_0x521c60[_0x199e('0x47')]]=_0x1ec361;this['emitVoiceQueueChannelRemove'](_0x1ec361,_0x199e('0x1e'));}}}catch(_0x14c701){logger[_0x199e('0x39')]('[%s][voiceQueueReport][queuecallerabandon]',_0x521c60['uniqueid'],util[_0x199e('0x3b')](_0x14c701,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x4ae9b8){try{if(this['isNotNull'](_0x4ae9b8)){logger[_0x199e('0x44')](_0x199e('0x83'),_0x4ae9b8['uniqueid'],util[_0x199e('0x3b')](_0x4ae9b8,{'showHidden':![],'depth':null}));if(this[_0x199e('0x10')][_0x4ae9b8[_0x199e('0x47')]]){var _0x446e25=_[_0x199e('0x7d')](this[_0x199e('0x10')][_0x4ae9b8[_0x199e('0x47')]]);_0x446e25[_0x199e('0x84')]=moment()['format'](_0x199e('0x75'));_0x446e25[_0x199e('0x85')]=_0x4ae9b8[_0x199e('0x85')];_0x446e25[_0x199e('0x86')]=_0x4ae9b8[_0x199e('0x86')];logger[_0x199e('0x79')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x446e25[_0x199e('0x4e')],_0x446e25[_0x199e('0x52')],_0x4ae9b8[_0x199e('0x85')],_0x4ae9b8[_0x199e('0x86')]);this[_0x199e('0x12')][_0x4ae9b8[_0x199e('0x47')]]=_0x446e25;this[_0x199e('0x7b')](_0x446e25,_0x199e('0x20'));}}}catch(_0x2e6883){logger['error'](_0x199e('0x83'),_0x4ae9b8[_0x199e('0x47')],util[_0x199e('0x3b')](_0x2e6883,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x199e('0xc')]['syncAgentConnect']=function(_0xcf317f){try{if(this['isNotNull'](_0xcf317f)){logger[_0x199e('0x44')](_0x199e('0x87'),_0xcf317f['uniqueid'],util[_0x199e('0x3b')](_0xcf317f,{'showHidden':![],'depth':null}));if(this[_0x199e('0x10')][_0xcf317f[_0x199e('0x47')]]){var _0x54df94=_['last'](this[_0x199e('0x10')][_0xcf317f[_0x199e('0x47')]]);_0x54df94[_0x199e('0x7e')]=!![];_0x54df94['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x199e('0x79')](_0x199e('0x88'),_0x54df94[_0x199e('0x4e')],_0x54df94[_0x199e('0x52')]);}}}catch(_0x18c175){logger['error'](_0x199e('0x87'),_0xcf317f[_0x199e('0x47')],util[_0x199e('0x3b')](_0x18c175,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x199e('0xc')]['syncAgentComplete']=function(_0x151083){try{if(this[_0x199e('0x69')](_0x151083)){logger[_0x199e('0x44')](_0x199e('0x89'),_0x151083[_0x199e('0x47')],util['inspect'](_0x151083,{'showHidden':![],'depth':null}));if(this[_0x199e('0x10')][_0x151083['uniqueid']]){var _0x173d73=_[_0x199e('0x7d')](this[_0x199e('0x10')][_0x151083[_0x199e('0x47')]]);_0x173d73[_0x199e('0x1e')]=![];_0x173d73['queuecallerabandonAt']=null;_0x173d73[_0x199e('0x8a')]=!![];_0x173d73['lastAssignedTo']=_0x151083[_0x199e('0x8b')];_0x173d73[_0x199e('0x8c')]=_0x151083[_0x199e('0x8c')];_0x173d73['queuecallercomplete']=!![];_0x173d73[_0x199e('0x8d')]=![];_0x173d73[_0x199e('0x8e')]=null;if(!_0x173d73[_0x199e('0x8f')]){if(_0x151083[_0x199e('0x90')]=='transfer'){_0x173d73[_0x199e('0x4b')]='COMPLETED';logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x173d73[_0x199e('0x4e')],_0x173d73[_0x199e('0x52')]);}else{if(_[_0x199e('0x91')](_0x151083[_0x199e('0x92')][_0x199e('0x93')](),_0x199e('0x94'))){if(this[_0x199e('0x10')][_0x151083[_0x199e('0x95')]]){var _0x31ac92=_['last'](this['queueReports'][_0x151083[_0x199e('0x95')]]);_0x31ac92['queuecallercomplete']=![];_0x31ac92[_0x199e('0x8d')]=!![];_0x31ac92['queuecallerexitAt']=moment(_0x173d73[_0x199e('0x74')])[_0x199e('0x96')](_0x151083[_0x199e('0x8c')],_0x199e('0x97'))[_0x199e('0x48')](_0x199e('0x75'));_0x31ac92[_0x199e('0x4b')]=_0x199e('0x98');_0x31ac92[_0x199e('0x8f')]=!![];_0x31ac92[_0x199e('0x99')]=_0x199e('0x9a');_0x31ac92['transferexten']=_0x151083['destexten'];_0x31ac92[_0x199e('0x9b')]=_0x151083[_0x199e('0x47')];logger[_0x199e('0x79')](_0x199e('0x9c'),_0x31ac92[_0x199e('0x4e')],_0x31ac92[_0x199e('0x52')]);var _0x58114e=this[_0x199e('0x10')][_0x151083['linkedid']];this['queueReports'][_0x151083['linkedid']]=this['queueReports'][_0x151083[_0x199e('0x47')]];this['queueReports'][_0x151083[_0x199e('0x47')]]=_0x58114e;}}else{_0x173d73[_0x199e('0x4b')]=_0x199e('0x9d')+_0x151083[_0x199e('0x90')][_0x199e('0x9e')]();logger[_0x199e('0x79')](_0x199e('0x9f'),_0x173d73['name'],_0x173d73[_0x199e('0x52')],_0x173d73[_0x199e('0x4b')]);}}}this['channels'][_0x151083[_0x199e('0x47')]]=_0x173d73;this[_0x199e('0x41')](_0x173d73,_0x199e('0xa0'));}}}catch(_0x51cc7b){logger[_0x199e('0x39')](_0x199e('0x89'),_0x151083['uniqueid'],util['inspect'](_0x51cc7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x199e('0xc')][_0x199e('0x25')]=function(_0x182b7e){try{if(this[_0x199e('0x69')](_0x182b7e)){logger['debug'](_0x199e('0xa1'),_0x182b7e[_0x199e('0x47')],util[_0x199e('0x3b')](_0x182b7e,{'showHidden':![],'depth':null}));this['addVariable'](_0x182b7e[_0x199e('0x47')],_['keys'](_0x182b7e[_0x199e('0xa2')])[0x0],_0x182b7e[_0x199e('0xa3')]);if(this[_0x199e('0x10')][_0x182b7e[_0x199e('0x47')]]){var _0x585bcf=_[_0x199e('0x7d')](this[_0x199e('0x10')][_0x182b7e[_0x199e('0x47')]]);if(_0x585bcf){if(this['isNotNull'](_0x182b7e[_0x199e('0xa2')])&&this[_0x199e('0x69')](_0x182b7e[_0x199e('0xa2')][_0x199e('0xa4')])){switch(_0x182b7e[_0x199e('0xa3')]){case _0x199e('0xa5'):_0x585bcf[_0x199e('0x8d')]=![];_0x585bcf[_0x199e('0x8e')]=null;break;case _0x199e('0xa6'):_0x585bcf[_0x199e('0xa7')]=_0x199e('0xa8');_0x585bcf[_0x199e('0x8d')]=!![];_0x585bcf[_0x199e('0x8e')]=moment()[_0x199e('0x48')](_0x199e('0x75'));_0x585bcf['queuecallerleaveAt']=moment()['format'](_0x199e('0x75'));logger[_0x199e('0x44')](_0x199e('0xa9'),_0x182b7e[_0x199e('0x47')],util[_0x199e('0x3b')](_0x585bcf,{'showHidden':![],'depth':null}));ami['emit'](_0x199e('0xaa'),_0x585bcf);break;default:_0x585bcf[_0x199e('0x8d')]=!![];_0x585bcf['queuecallerexitAt']=moment()[_0x199e('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x585bcf['queuecallerleaveAt']=moment()[_0x199e('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}_0x585bcf[_0x199e('0x1e')]=![];_0x585bcf['queuecallerabandonAt']=null;_0x585bcf[_0x199e('0x4b')]=_0x182b7e[_0x199e('0xa3')];this[_0x199e('0x12')][_0x182b7e[_0x199e('0x47')]]=_0x585bcf;this[_0x199e('0x41')](_0x585bcf,_0x199e('0xab'));}else if(this['isNotNull'](_0x182b7e['variable'])&&this[_0x199e('0x69')](_0x182b7e['variable']['queueposition'])){if(!_0x585bcf[_0x199e('0x1e')]){_0x585bcf[_0x199e('0x8d')]=!![];_0x585bcf[_0x199e('0x8e')]=moment()['format'](_0x199e('0x75'));_0x585bcf[_0x199e('0x4b')]='EXITWITHKEY';_0x585bcf[_0x199e('0x84')]=moment()[_0x199e('0x48')](_0x199e('0x75'));this['channels'][_0x182b7e[_0x199e('0x47')]]=_0x585bcf;}}logger[_0x199e('0x79')](_0x199e('0xac'),_0x182b7e[_0x199e('0x47')],_0x585bcf['name'],_0x585bcf[_0x199e('0x52')],_[_0x199e('0xad')](_0x182b7e[_0x199e('0xa2')])[0x0],_0x182b7e[_0x199e('0xa3')]);_0x585bcf[_0x199e('0x3c')]=this[_0x199e('0x3c')][_0x182b7e[_0x199e('0x47')]];}}}}catch(_0x4fbd45){logger[_0x199e('0x39')](_0x199e('0xa1'),_0x182b7e['uniqueid'],util[_0x199e('0x3b')](_0x4fbd45,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x199e('0xc')][_0x199e('0xae')]=function(_0x5cec25,_0x374b51,_0x555f9a){var _0x50048a=['rtpaudioqos','rtpaudioqosbridged',_0x199e('0xaf'),_0x199e('0xb0'),_0x199e('0xb1'),'rtpaudioqoslossbridged',_0x199e('0xb2'),_0x199e('0xb3'),'sipcallid',_0x199e('0xb4'),_0x199e('0xb5'),'bridgepvtcallid',_0x199e('0xb6'),'memberdynamic',_0x199e('0xb7'),_0x199e('0xb8'),'membername',_0x199e('0xb9'),_0x199e('0xba')];if(!_[_0x199e('0xbb')](_0x374b51)&&!_['includes'](_0x50048a,_0x374b51)){if(_['isUndefined'](this[_0x199e('0x3c')][_0x5cec25])){this[_0x199e('0x3c')][_0x5cec25]={};}this[_0x199e('0x3c')][_0x5cec25][_0x374b51]=_0x555f9a;}};VoiceQueueReport[_0x199e('0xc')]['syncHangup']=function(_0x43778e){try{if(this[_0x199e('0x69')](_0x43778e)){logger[_0x199e('0x44')]('[%s][voiceQueueReport][hangup]',_0x43778e['uniqueid'],util['inspect'](_0x43778e,{'showHidden':![],'depth':null}));if(this[_0x199e('0x10')][_0x43778e[_0x199e('0x47')]]){for(var _0x53991e=0x0,_0x261932={};_0x53991e=0x0?moment(_0x33d3dc[_0xa249('0x1a')])[_0xa249('0xd')](_0x33d3dc[_0xa249('0x19')],'seconds'):null,'data1':'outbound','data2':_0x33d3dc[_0xa249('0x13')],'data3':_0x33d3dc['exten'],'data4':_0x33d3dc[_0xa249('0x1b')]||null,'role':'agent','internal':_0x33d3dc['accountcode']?_['toNumber'](_0x33d3dc['accountcode']):undefined,'uniqueid':_0x33d3dc['uniqueid']},'log':_0xa249('0x16')});}; \ No newline at end of file +var _0xa693=['queuecallerleaveAt','seconds','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','voice','membername','starttime','endtime','outbound','exten','dialstring','moment','../client','voiceQueueReport','CreateMemberReport','lastAssignedTo','isNil','interface','SIP/%s','TALKING','diff'];(function(_0x4db58c,_0x47b30c){var _0x5a6443=function(_0x599c3b){while(--_0x599c3b){_0x4db58c['push'](_0x4db58c['shift']());}};_0x5a6443(++_0x47b30c);}(_0xa693,0x17c));var _0x3a69=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0xa693[_0x2a238a];return _0xeef802;};'use strict';var moment=require(_0x3a69('0x0'));var _=require('lodash');var util=require('util');var client=require(_0x3a69('0x1'));exports[_0x3a69('0x2')]=function(_0x1c7c6b){var _0x3c0c73=_0x1c7c6b['queuecallercompleteAt']||_0x1c7c6b['queuecallerexitAt'];return client['Request'](_0x3a69('0x3'),{'body':{'channel':'voice','membername':_0x1c7c6b[_0x3a69('0x4')],'interface':_[_0x3a69('0x5')](_0x1c7c6b[_0x3a69('0x6')])?util['format'](_0x3a69('0x7'),_0x1c7c6b['lastAssignedTo']):_0x1c7c6b[_0x3a69('0x6')],'type':_0x3a69('0x8'),'enterAt':_0x1c7c6b['queuecallerleaveAt'],'exitAt':_0x3c0c73,'duration':moment(_0x3c0c73)[_0x3a69('0x9')](_0x1c7c6b[_0x3a69('0xa')],_0x3a69('0xb')),'data1':'inbound','data2':_0x1c7c6b['calleridnum'],'data3':_0x1c7c6b['exten'],'data4':null,'data5':_0x1c7c6b[_0x3a69('0xc')],'role':_0x3a69('0xd'),'internal':_0x1c7c6b[_0x3a69('0xe')]?_[_0x3a69('0xf')](_0x1c7c6b[_0x3a69('0xe')]):undefined,'uniqueid':_0x1c7c6b[_0x3a69('0x10')]},'log':_0x3a69('0x3')});};exports[_0x3a69('0x11')]=function(_0x219212){return client[_0x3a69('0x12')]('CreateMemberReport',{'body':{'channel':_0x3a69('0x13'),'membername':_0x219212[_0x3a69('0x14')],'interface':_0x219212['interface'],'type':_0x3a69('0x8'),'enterAt':_0x219212[_0x3a69('0x15')],'exitAt':_0x219212[_0x3a69('0x16')],'duration':moment(_0x219212[_0x3a69('0x16')])[_0x3a69('0x9')](_0x219212[_0x3a69('0x15')],_0x3a69('0xb'))>=0x0?moment(_0x219212[_0x3a69('0x16')])['diff'](_0x219212['starttime'],_0x3a69('0xb')):null,'data1':_0x3a69('0x17'),'data2':_0x219212[_0x3a69('0xe')],'data3':_0x219212[_0x3a69('0x18')],'data4':_0x219212[_0x3a69('0x19')]||null,'role':_0x3a69('0xd'),'internal':_0x219212[_0x3a69('0xe')]?_[_0x3a69('0xf')](_0x219212[_0x3a69('0xe')]):undefined,'uniqueid':_0x219212['uniqueid']},'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 c6e2c0d..2372dd3 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 _0x34bd=['GetSettings','../client','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x4fbea,_0x27914c){var _0x237ea6=function(_0x2acd4a){while(--_0x2acd4a){_0x4fbea['push'](_0x4fbea['shift']());}};_0x237ea6(++_0x27914c);}(_0x34bd,0x1d2));var _0xd34b=function(_0x2b2ac8,_0x22f79a){_0x2b2ac8=_0x2b2ac8-0x0;var _0x5cd081=_0x34bd[_0x2b2ac8];return _0x5cd081;};'use strict';var client=require(_0xd34b('0x0'));exports['getSettings']=function(){return client['Request'](_0xd34b('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd34b('0x2'),_0xd34b('0x3')]},'log':_0xd34b('0x4')});}; \ No newline at end of file +var _0x0854=['previewRecallmeReminderInterval','GetSettings','../client','Request','ShowSetting'];(function(_0x1d6fb3,_0x30760c){var _0x34995c=function(_0x27d445){while(--_0x27d445){_0x1d6fb3['push'](_0x1d6fb3['shift']());}};_0x34995c(++_0x30760c);}(_0x0854,0xd9));var _0x4085=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0854[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x4085('0x0'));exports['getSettings']=function(){return client[_0x4085('0x1')](_0x4085('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x4085('0x3')]},'log':_0x4085('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index bc82d44..8b5d816 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 _0xbc61=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0xbc61,0x16e));var _0x1bc6=function(_0x41cd24,_0x2d3b94){_0x41cd24=_0x41cd24-0x0;var _0x14c3f0=_0xbc61[_0x41cd24];return _0x14c3f0;};'use strict';var client=require(_0x1bc6('0x0'));exports[_0x1bc6('0x1')]=function(_0x567183){return function(_0xb961a){return client[_0x1bc6('0x2')](_0x1bc6('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1bc6('0x4'),_0x1bc6('0x5')]},'log':_0x1bc6('0x3')});};}; \ No newline at end of file +var _0xb51d=['getTemplates','Request','GetTemplate','name','html'];(function(_0x138ccf,_0x55feb0){var _0x107e13=function(_0x25033d){while(--_0x25033d){_0x138ccf['push'](_0x138ccf['shift']());}};_0x107e13(++_0x55feb0);}(_0xb51d,0x159));var _0xdb51=function(_0x30439a,_0x24b995){_0x30439a=_0x30439a-0x0;var _0x18e30f=_0xb51d[_0x30439a];return _0x18e30f;};'use strict';var client=require('../client');exports[_0xdb51('0x0')]=function(_0x5434e2){return function(_0xf07f25){return client[_0xdb51('0x1')](_0xdb51('0x2'),{'options':{'raw':!![],'attributes':['id',_0xdb51('0x3'),_0xdb51('0x4')]},'log':_0xdb51('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 538e3d7..7207c7f 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 _0x4f88=['Request','GetTrigger','channel','Condition','AllConditions','operator','value','Action','data2','data3','data4','data6','data7','../client','getTriggers'];(function(_0x4c124b,_0x2b9d33){var _0x57b692=function(_0x543c11){while(--_0x543c11){_0x4c124b['push'](_0x4c124b['shift']());}};_0x57b692(++_0x2b9d33);}(_0x4f88,0x12a));var _0x84f8=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x4f88[_0x22dac7];return _0x3e6cfa;};'use strict';var client=require(_0x84f8('0x0'));exports[_0x84f8('0x1')]=function(_0x2d3a78){return function(_0x303f45){return client[_0x84f8('0x2')](_0x84f8('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x84f8('0x4'),'status'],'include':[{'model':_0x84f8('0x5'),'as':_0x84f8('0x6'),'attributes':['id','field',_0x84f8('0x7'),_0x84f8('0x8')]},{'model':'Condition','as':'AnyConditions','attributes':['id','field',_0x84f8('0x7'),_0x84f8('0x8')]},{'model':_0x84f8('0x9'),'as':'Actions','attributes':['id','action','data1',_0x84f8('0xa'),_0x84f8('0xb'),_0x84f8('0xc'),'data5',_0x84f8('0xd'),_0x84f8('0xe')]}]},'log':_0x84f8('0x3')});};}; \ No newline at end of file +var _0x0cb6=['data1','data4','data5','data6','data7','Request','GetTrigger','name','channel','status','Condition','operator','value','Action','Actions','action'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x0cb6,0x1a5));var _0x60cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cb6[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getTriggers']=function(_0xcce39b){return function(_0x4a256a){return client[_0x60cb('0x0')](_0x60cb('0x1'),{'options':{'raw':![],'attributes':['id',_0x60cb('0x2'),_0x60cb('0x3'),_0x60cb('0x4')],'include':[{'model':_0x60cb('0x5'),'as':'AllConditions','attributes':['id','field',_0x60cb('0x6'),'value']},{'model':'Condition','as':'AnyConditions','attributes':['id','field',_0x60cb('0x6'),_0x60cb('0x7')]},{'model':_0x60cb('0x8'),'as':_0x60cb('0x9'),'attributes':['id',_0x60cb('0xa'),_0x60cb('0xb'),'data2','data3',_0x60cb('0xc'),_0x60cb('0xd'),_0x60cb('0xe'),_0x60cb('0xf')]}]},'log':_0x60cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index df75254..91948b5 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 _0xe559=['Request','GetTrunk','name','defaultuser','getTrunks'];(function(_0x5bf82d,_0x290676){var _0x35122d=function(_0x1d5569){while(--_0x1d5569){_0x5bf82d['push'](_0x5bf82d['shift']());}};_0x35122d(++_0x290676);}(_0xe559,0x176));var _0x9e55=function(_0x2ee8df,_0x2a2791){_0x2ee8df=_0x2ee8df-0x0;var _0x2d4665=_0xe559[_0x2ee8df];return _0x2d4665;};'use strict';var client=require('../client');exports[_0x9e55('0x0')]=function(_0xa5120a){return function(_0x17871e){return client[_0x9e55('0x1')](_0x9e55('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9e55('0x3'),'registry',_0x9e55('0x4')]},'log':_0x9e55('0x2')});};}; \ No newline at end of file +var _0x5225=['GetTrunk','../client','Request','registry','defaultuser'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5225,0x19b));var _0x5522=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x5225[_0x53afe9];return _0x396396;};'use strict';var client=require(_0x5522('0x0'));exports['getTrunks']=function(_0x2ccb85){return function(_0x478a14){return client[_0x5522('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x5522('0x2'),_0x5522('0x3')]},'log':_0x5522('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 12d6ef0..f254893 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x2729d3,_0x5920f9){var _0x21fa09=function(_0x3064c5){while(--_0x3064c5){_0x2729d3['push'](_0x2729d3['shift']());}};_0x21fa09(++_0x5920f9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x41b629,_0x5709fe){var _0x174106=function(_0x16becf){while(--_0x16becf){_0x41b629['push'](_0x41b629['shift']());}};_0x174106(++_0x5709fe);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index cd8ce02..b02afa9 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 _0xb0a5=['Request','UpdateVoiceAgentReport','create','CreateVoiceAgentReport','update'];(function(_0x1b5f46,_0x548aaa){var _0x1da7da=function(_0x785d3){while(--_0x785d3){_0x1b5f46['push'](_0x1b5f46['shift']());}};_0x1da7da(++_0x548aaa);}(_0xb0a5,0xf2));var _0x5b0a=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xb0a5[_0x5627e1];return _0x2f013f;};'use strict';var client=require('../client');exports[_0x5b0a('0x0')]=function(_0x292c8b){return client['Request'](_0x5b0a('0x1'),{'body':_0x292c8b,'log':_0x5b0a('0x1')});};exports[_0x5b0a('0x2')]=function(_0x222e9f,_0x3fcc0e,_0x9af230){return client[_0x5b0a('0x3')](_0x5b0a('0x4'),{'body':_0x222e9f,'options':{'where':{'uniqueid':_0x3fcc0e,'interface':_0x9af230,'agentcomplete':!![]}},'log':_0x5b0a('0x4')});}; \ No newline at end of file +var _0x1fe7=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x177350,_0x219bdb){var _0x32bc81=function(_0x532cb4){while(--_0x532cb4){_0x177350['push'](_0x177350['shift']());}};_0x32bc81(++_0x219bdb);}(_0x1fe7,0x13f));var _0x71fe=function(_0x20c1c6,_0x30aa6d){_0x20c1c6=_0x20c1c6-0x0;var _0x3227dd=_0x1fe7[_0x20c1c6];return _0x3227dd;};'use strict';var client=require(_0x71fe('0x0'));exports[_0x71fe('0x1')]=function(_0x457d95){return client[_0x71fe('0x2')](_0x71fe('0x3'),{'body':_0x457d95,'log':_0x71fe('0x3')});};exports['update']=function(_0x175773,_0x66c9c6,_0x2abae8){return client[_0x71fe('0x2')](_0x71fe('0x4'),{'body':_0x175773,'options':{'where':{'uniqueid':_0x66c9c6,'interface':_0x2abae8,'agentcomplete':!![]}},'log':_0x71fe('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 1be51cf..b09b1a0 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 _0x786c=['type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','merge','calleridnum','context','callerid','DOCUMENTATION','Request','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x786c,0x113));var _0xc786=function(_0xe4b9b1,_0xb19398){_0xe4b9b1=_0xe4b9b1-0x0;var _0x50e288=_0x786c[_0xe4b9b1];return _0x50e288;};'use strict';var moment=require(_0xc786('0x0'));var util=require('util');var _=require(_0xc786('0x1'));var client=require(_0xc786('0x2'));exports['create']=function(_0x3a628f){return client['Request']('CreateVoiceCallReport',{'body':_[_0xc786('0x3')](_0x3a628f,{'source':_0x3a628f[_0xc786('0x4')],'destinationcontext':_0x3a628f[_0xc786('0x5')],'callerid':_0x3a628f[_0xc786('0x6')],'amaflags':_0xc786('0x7')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0xc786('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xc786('0x9')](_0xc786('0xa'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xc786('0xa'))[_0xc786('0xb')](_0xc786('0xc'))]}},'attributes':[_0xc786('0xd'),_0xc786('0xe'),_0xc786('0xf'),_0xc786('0x10')]},'log':_0xc786('0x11')});};}; \ No newline at end of file +var _0xcc12=['format','disposition','billableseconds','moment','merge','calleridnum','context','callerid','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','day','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x84cad2,_0x42c615){var _0x3a0248=function(_0x3266ad){while(--_0x3266ad){_0x84cad2['push'](_0x84cad2['shift']());}};_0x3a0248(++_0x42c615);}(_0xcc12,0x1a7));var _0x2cc1=function(_0x9c9053,_0x4cfcb9){_0x9c9053=_0x9c9053-0x0;var _0x123e95=_0xcc12[_0x9c9053];return _0x123e95;};'use strict';var moment=require(_0x2cc1('0x0'));var util=require('util');var _=require('lodash');var client=require('../client');exports['create']=function(_0x5ebeb3){return client['Request']('CreateVoiceCallReport',{'body':_[_0x2cc1('0x1')](_0x5ebeb3,{'source':_0x5ebeb3[_0x2cc1('0x2')],'destinationcontext':_0x5ebeb3[_0x2cc1('0x3')],'callerid':_0x5ebeb3[_0x2cc1('0x4')],'amaflags':'DOCUMENTATION'}),'log':_0x2cc1('0x5')});};exports[_0x2cc1('0x6')]=function(){return function(){return client[_0x2cc1('0x7')](_0x2cc1('0x8'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x2cc1('0x9'))['format'](_0x2cc1('0xa')),moment()[_0x2cc1('0xb')](_0x2cc1('0x9'))[_0x2cc1('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x2cc1('0xd'),'duration',_0x2cc1('0xe')]},'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 e5cf932..17bdde9 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 _0x7bc2=['create','CreateVoiceDialReport'];(function(_0x2342d2,_0x439876){var _0x96bdf=function(_0x54c1d7){while(--_0x54c1d7){_0x2342d2['push'](_0x2342d2['shift']());}};_0x96bdf(++_0x439876);}(_0x7bc2,0xe4));var _0x27bc=function(_0x3018ff,_0x34af18){_0x3018ff=_0x3018ff-0x0;var _0x3c193a=_0x7bc2[_0x3018ff];return _0x3c193a;};'use strict';var client=require('../client');exports[_0x27bc('0x0')]=function(_0x4a62bf){return client['Request'](_0x27bc('0x1'),{'body':_0x4a62bf,'log':_0x27bc('0x1')});}; \ No newline at end of file +var _0x1ae8=['create','Request','CreateVoiceDialReport','../client'];(function(_0x4397c6,_0x1aff07){var _0x47041c=function(_0x57c199){while(--_0x57c199){_0x4397c6['push'](_0x4397c6['shift']());}};_0x47041c(++_0x1aff07);}(_0x1ae8,0x1d7));var _0x81ae=function(_0x33cb5f,_0x333504){_0x33cb5f=_0x33cb5f-0x0;var _0x39502a=_0x1ae8[_0x33cb5f];return _0x39502a;};'use strict';var client=require(_0x81ae('0x0'));exports[_0x81ae('0x1')]=function(_0x254f1c){return client[_0x81ae('0x2')](_0x81ae('0x3'),{'body':_0x254f1c,'log':_0x81ae('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 9efc39a..4bf437f 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 _0xb469=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x1fa90a,_0x2eeee2){var _0x50bbaa=function(_0x1de509){while(--_0x1de509){_0x1fa90a['push'](_0x1fa90a['shift']());}};_0x50bbaa(++_0x2eeee2);}(_0xb469,0x13b));var _0x9b46=function(_0x32ab1c,_0x2762fa){_0x32ab1c=_0x32ab1c-0x0;var _0x1a0abf=_0xb469[_0x32ab1c];return _0x1a0abf;};'use strict';var client=require(_0x9b46('0x0'));exports[_0x9b46('0x1')]=function(){return function(){return client[_0x9b46('0x2')](_0x9b46('0x3'),{'options':{'raw':!![],'attributes':['id',_0x9b46('0x4'),_0x9b46('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x9b46('0x1')});};}; \ No newline at end of file +var _0x0bb5=['../client','getVoiceExtensions','exten','recordingFormat'];(function(_0x34b40,_0x209f76){var _0xaf16ac=function(_0x33671b){while(--_0x33671b){_0x34b40['push'](_0x34b40['shift']());}};_0xaf16ac(++_0x209f76);}(_0x0bb5,0x148));var _0x50bb=function(_0x93a1fb,_0x19831d){_0x93a1fb=_0x93a1fb-0x0;var _0x2e1a52=_0x0bb5[_0x93a1fb];return _0x2e1a52;};'use strict';var client=require(_0x50bb('0x0'));exports[_0x50bb('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x50bb('0x2'),_0x50bb('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x50bb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c78e06b..030522d 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 _0x3e44=['dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x34b868,_0x22d97d){var _0x4dc000=function(_0x488f04){while(--_0x488f04){_0x34b868['push'](_0x34b868['shift']());}};_0x4dc000(++_0x22d97d);}(_0x3e44,0x94));var _0x43e4=function(_0x218eba,_0x3f0c68){_0x218eba=_0x218eba-0x0;var _0x229cd9=_0x3e44[_0x218eba];return _0x229cd9;};'use strict';var client=require('../client');exports[_0x43e4('0x0')]=function(){return function(){return client['Request'](_0x43e4('0x1'),{'options':{'raw':![],'attributes':['id',_0x43e4('0x2'),_0x43e4('0x3'),_0x43e4('0x4'),_0x43e4('0x5'),_0x43e4('0x6'),_0x43e4('0x7'),_0x43e4('0x8'),'dialMethod',_0x43e4('0x9'),_0x43e4('0xa'),'dialPowerLevel',_0x43e4('0xb'),'dialPredictiveOptimizationPercentage',_0x43e4('0xc'),_0x43e4('0xd'),_0x43e4('0xe'),_0x43e4('0xf'),_0x43e4('0x10'),_0x43e4('0x11'),_0x43e4('0x12'),_0x43e4('0x13'),_0x43e4('0x14'),_0x43e4('0x15'),_0x43e4('0x16'),_0x43e4('0x17'),_0x43e4('0x18'),_0x43e4('0x19'),'dialTimezone',_0x43e4('0x1a'),_0x43e4('0x1b'),'dialCheckDuplicateType','dialAMDActive',_0x43e4('0x1c'),_0x43e4('0x1d'),_0x43e4('0x1e'),_0x43e4('0x1f'),_0x43e4('0x20'),_0x43e4('0x21'),_0x43e4('0x22'),_0x43e4('0x23'),'dialAMDMaximumWordLength',_0x43e4('0x24'),_0x43e4('0x25'),'dialRecallInQueue',_0x43e4('0x26'),'dialAgiAfterHangupAgent',_0x43e4('0x27'),_0x43e4('0x28'),'monitor_format',_0x43e4('0x29'),_0x43e4('0x2a'),'dialCutDigit',_0x43e4('0x2b'),'dialNoSuchNumberRetryFrequency',_0x43e4('0x2c'),_0x43e4('0x2d'),_0x43e4('0x2e'),'dialAbandonedRetryFrequency',_0x43e4('0x2f'),_0x43e4('0x30'),_0x43e4('0x31'),_0x43e4('0x32'),_0x43e4('0x33'),_0x43e4('0x34'),'dialPredictiveIntervalMinThreshold',_0x43e4('0x35'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x43e4('0x36'),'as':'Trunk','attributes':['id',_0x43e4('0x2'),_0x43e4('0x37'),'active']},{'model':_0x43e4('0x38'),'as':_0x43e4('0x39'),'attributes':['id',_0x43e4('0x2')]},{'model':_0x43e4('0x36'),'as':_0x43e4('0x3a'),'attributes':['id',_0x43e4('0x2'),_0x43e4('0x37'),'active']},{'model':_0x43e4('0x3b'),'as':_0x43e4('0x3b'),'attributes':['id',_0x43e4('0x2')],'include':[{'model':_0x43e4('0x3b'),'as':_0x43e4('0x3c'),'attributes':['id',_0x43e4('0x2'),'interval']}]}]},'log':_0x43e4('0x0')});};}; \ No newline at end of file +var _0x11ee=['dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','Request','name','acw','autopause','monitor_format','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x11ee,0x17f));var _0xe11e=function(_0x448a56,_0x3cd4d1){_0x448a56=_0x448a56-0x0;var _0x1ba466=_0x11ee[_0x448a56];return _0x1ba466;};'use strict';var client=require(_0xe11e('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xe11e('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xe11e('0x2'),_0xe11e('0x3'),'acwTimeout',_0xe11e('0x4'),_0xe11e('0x5'),'type','dialActive',_0xe11e('0x6'),_0xe11e('0x7'),'dialLimitQueue',_0xe11e('0x8'),_0xe11e('0x9'),_0xe11e('0xa'),_0xe11e('0xb'),_0xe11e('0xc'),'dialOriginateCallerIdNumber',_0xe11e('0xd'),_0xe11e('0xe'),_0xe11e('0xf'),'dialQueueProject',_0xe11e('0x10'),_0xe11e('0x11'),_0xe11e('0x12'),_0xe11e('0x13'),_0xe11e('0x14'),_0xe11e('0x15'),_0xe11e('0x16'),_0xe11e('0x17'),'dialGlobalInterval',_0xe11e('0x18'),_0xe11e('0x19'),_0xe11e('0x1a'),_0xe11e('0x1b'),_0xe11e('0x1c'),_0xe11e('0x1d'),_0xe11e('0x1e'),_0xe11e('0x1f'),_0xe11e('0x20'),'dialAMDMaximumNumberOfWords',_0xe11e('0x21'),_0xe11e('0x22'),_0xe11e('0x23'),_0xe11e('0x24'),_0xe11e('0x25'),_0xe11e('0x26'),_0xe11e('0x27'),'dialAgiAfterHangupClient','dialQueueProject2',_0xe11e('0x5'),'strategy',_0xe11e('0x28'),_0xe11e('0x29'),_0xe11e('0x2a'),_0xe11e('0x2b'),'dialDropMaxRetry',_0xe11e('0x2c'),_0xe11e('0x2d'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xe11e('0x2e'),_0xe11e('0x2f'),_0xe11e('0x30'),'mandatoryDisposition',_0xe11e('0x31'),_0xe11e('0x32'),_0xe11e('0x33'),_0xe11e('0x34')],'include':[{'model':_0xe11e('0x35'),'as':_0xe11e('0x35'),'attributes':['id',_0xe11e('0x2'),_0xe11e('0x36'),_0xe11e('0x37')]},{'model':'Pause','as':_0xe11e('0x38'),'attributes':['id',_0xe11e('0x2')]},{'model':_0xe11e('0x35'),'as':_0xe11e('0x39'),'attributes':['id',_0xe11e('0x2'),_0xe11e('0x36'),_0xe11e('0x37')]},{'model':_0xe11e('0x3a'),'as':'Interval','attributes':['id',_0xe11e('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xe11e('0x2'),_0xe11e('0x3b')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4134ae2..74e28ad 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(_0xf9eaef,_0x162735){var _0x2a3705=function(_0x3adba1){while(--_0x3adba1){_0xf9eaef['push'](_0xf9eaef['shift']());}};_0x2a3705(++_0x162735);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x3b9c9a,_0x22a377){var _0x176f8b=function(_0x3d1ff2){while(--_0x3d1ff2){_0x3b9c9a['push'](_0x3b9c9a['shift']());}};_0x176f8b(++_0x22a377);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 630f4f7..a3ca549 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 _0x62aa=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x4d9471,_0x56b167){var _0x582bb5=function(_0x19e505){while(--_0x19e505){_0x4d9471['push'](_0x4d9471['shift']());}};_0x582bb5(++_0x56b167);}(_0x62aa,0x84));var _0xa62a=function(_0x2ef31f,_0x4e197c){_0x2ef31f=_0x2ef31f-0x0;var _0xdbbcc3=_0x62aa[_0x2ef31f];return _0xdbbcc3;};'use strict';var client=require('../client');exports[_0xa62a('0x0')]=function(_0x27b02d){return function(){return client[_0xa62a('0x1')](_0xa62a('0x2'),{'options':{'where':{'VoiceQueueId':_0x27b02d,'paused':!![]},'raw':!![]},'log':_0xa62a('0x0')});};}; \ No newline at end of file +var _0x423e=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x27a67e,_0x189206){var _0x5356ea=function(_0x627d1b){while(--_0x627d1b){_0x27a67e['push'](_0x27a67e['shift']());}};_0x5356ea(++_0x189206);}(_0x423e,0x1c6));var _0xe423=function(_0x37b0da,_0x42982f){_0x37b0da=_0x37b0da-0x0;var _0x18c5b6=_0x423e[_0x37b0da];return _0x18c5b6;};'use strict';var client=require(_0xe423('0x0'));exports[_0xe423('0x1')]=function(_0x5bdad1){return function(){return client[_0xe423('0x2')](_0xe423('0x3'),{'options':{'where':{'VoiceQueueId':_0x5bdad1,'paused':!![]},'raw':!![]},'log':_0xe423('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c28434d..6eedac9 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(_0x12a6d3,_0x12d081){var _0x5c997c=function(_0x472f91){while(--_0x472f91){_0x12a6d3['push'](_0x12a6d3['shift']());}};_0x5c997c(++_0x12d081);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x232c1f,_0x36465e){var _0x1439f5=function(_0x10f5d6){while(--_0x10f5d6){_0x232c1f['push'](_0x232c1f['shift']());}};_0x1439f5(++_0x36465e);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 1cf6e34..d031c5c 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 _0x53e3=['context','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetcontext','transfertargetlinkedid','isexternal','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten'];(function(_0x5d37d1,_0x2a8a4d){var _0x37683b=function(_0x38a04b){while(--_0x38a04b){_0x5d37d1['push'](_0x5d37d1['shift']());}};_0x37683b(++_0x2a8a4d);}(_0x53e3,0x9c));var _0x353e=function(_0x567f2c,_0x21bd9b){_0x567f2c=_0x567f2c-0x0;var _0x50b2f6=_0x53e3[_0x567f2c];return _0x50b2f6;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x353e('0x0')]=function(_0x46b2f2){return client[_0x353e('0x1')](_0x353e('0x2'),{'body':{'result':_0x46b2f2[_0x353e('0x3')],'transfererchannel':_0x46b2f2[_0x353e('0x4')],'transferercalleridnum':_0x46b2f2[_0x353e('0x5')],'transferercalleridname':_0x46b2f2[_0x353e('0x6')],'transfererconnectedlinenum':_0x46b2f2['transfererconnectedlinenum'],'transfererconnectedlinename':_0x46b2f2[_0x353e('0x7')],'transfereraccountcode':_0x46b2f2[_0x353e('0x8')],'transferercontext':_0x46b2f2[_0x353e('0x9')],'transfererexten':_0x46b2f2[_0x353e('0xa')],'transfererlinkedid':_0x46b2f2[_0x353e('0xb')],'transfereechannel':_0x46b2f2[_0x353e('0xc')],'transfereecalleridnum':_0x46b2f2[_0x353e('0xd')],'transfereecalleridname':_0x46b2f2[_0x353e('0xe')],'transfereeconnectedlinenum':_0x46b2f2[_0x353e('0xf')],'transfereeconnectedlinename':_0x46b2f2[_0x353e('0x10')],'transfereeaccountcode':_0x46b2f2['transfereeaccountcode'],'transfereecontext':_0x46b2f2[_0x353e('0x11')],'transfereeexten':_0x46b2f2[_0x353e('0x12')],'transfereelinkedid':_0x46b2f2['transfereelinkedid'],'isexternal':_0x46b2f2['isexternal'],'context':_0x46b2f2[_0x353e('0x13')],'extension':_0x46b2f2['extension'],'type':_0x353e('0x14')},'log':_0x353e('0x2')});};exports['attendedTransfer']=function(_0x4f4c02){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4f4c02[_0x353e('0x3')],'transfererchannel':_0x4f4c02[_0x353e('0x15')],'transferercalleridnum':_0x4f4c02[_0x353e('0x16')],'transferercalleridname':_0x4f4c02[_0x353e('0x17')],'transfererconnectedlinenum':_0x4f4c02[_0x353e('0x18')],'transfererconnectedlinename':_0x4f4c02['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4f4c02[_0x353e('0x19')],'transferercontext':_0x4f4c02[_0x353e('0x1a')],'transfererexten':_0x4f4c02[_0x353e('0x1b')],'transfererlinkedid':_0x4f4c02[_0x353e('0x1c')],'transfereechannel':_0x4f4c02[_0x353e('0x1d')],'transfereecalleridnum':_0x4f4c02[_0x353e('0x1e')],'transfereecalleridname':_0x4f4c02[_0x353e('0x1f')],'transfereeconnectedlinenum':_0x4f4c02['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4f4c02['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4f4c02['transfertargetaccountcode'],'transfereecontext':_0x4f4c02[_0x353e('0x20')],'transfereeexten':_0x4f4c02['transfertargetexten'],'transfereelinkedid':_0x4f4c02[_0x353e('0x21')],'isexternal':_0x4f4c02[_0x353e('0x22')],'context':_0x4f4c02['origtransferercontext'],'extension':_0x4f4c02['origtransfererexten'],'type':'attended'},'log':_0x353e('0x2')});}; \ No newline at end of file +var _0xacfd=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','transfers','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinename','transferercontext','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','Request','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x13776f,_0x57b1c5){var _0x2b0f3b=function(_0xd33b0a){while(--_0xd33b0a){_0x13776f['push'](_0x13776f['shift']());}};_0x2b0f3b(++_0x57b1c5);}(_0xacfd,0x99));var _0xdacf=function(_0x287a91,_0x4b8ebf){_0x287a91=_0x287a91-0x0;var _0x51f9b2=_0xacfd[_0x287a91];return _0x51f9b2;};'use strict';var client=require('../client');exports[_0xdacf('0x0')]={};exports['blindTransfer']=function(_0x195551){return client['Request'](_0xdacf('0x1'),{'body':{'result':_0x195551[_0xdacf('0x2')],'transfererchannel':_0x195551[_0xdacf('0x3')],'transferercalleridnum':_0x195551['transferercalleridnum'],'transferercalleridname':_0x195551[_0xdacf('0x4')],'transfererconnectedlinenum':_0x195551['transfererconnectedlinenum'],'transfererconnectedlinename':_0x195551[_0xdacf('0x5')],'transfereraccountcode':_0x195551['transfereraccountcode'],'transferercontext':_0x195551[_0xdacf('0x6')],'transfererexten':_0x195551['transfererexten'],'transfererlinkedid':_0x195551['transfererlinkedid'],'transfereechannel':_0x195551[_0xdacf('0x7')],'transfereecalleridnum':_0x195551[_0xdacf('0x8')],'transfereecalleridname':_0x195551[_0xdacf('0x9')],'transfereeconnectedlinenum':_0x195551[_0xdacf('0xa')],'transfereeconnectedlinename':_0x195551[_0xdacf('0xb')],'transfereeaccountcode':_0x195551[_0xdacf('0xc')],'transfereecontext':_0x195551[_0xdacf('0xd')],'transfereeexten':_0x195551[_0xdacf('0xe')],'transfereelinkedid':_0x195551['transfereelinkedid'],'isexternal':_0x195551[_0xdacf('0xf')],'context':_0x195551[_0xdacf('0x10')],'extension':_0x195551[_0xdacf('0x11')],'type':_0xdacf('0x12')},'log':_0xdacf('0x1')});};exports[_0xdacf('0x13')]=function(_0x2dcce0){return client[_0xdacf('0x14')](_0xdacf('0x1'),{'body':{'result':_0x2dcce0[_0xdacf('0x2')],'transfererchannel':_0x2dcce0['origtransfererchannel'],'transferercalleridnum':_0x2dcce0['origtransferercalleridnum'],'transferercalleridname':_0x2dcce0[_0xdacf('0x15')],'transfererconnectedlinenum':_0x2dcce0[_0xdacf('0x16')],'transfererconnectedlinename':_0x2dcce0['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2dcce0[_0xdacf('0x17')],'transferercontext':_0x2dcce0[_0xdacf('0x18')],'transfererexten':_0x2dcce0[_0xdacf('0x19')],'transfererlinkedid':_0x2dcce0[_0xdacf('0x1a')],'transfereechannel':_0x2dcce0[_0xdacf('0x1b')],'transfereecalleridnum':_0x2dcce0[_0xdacf('0x1c')],'transfereecalleridname':_0x2dcce0[_0xdacf('0x1d')],'transfereeconnectedlinenum':_0x2dcce0[_0xdacf('0x1e')],'transfereeconnectedlinename':_0x2dcce0[_0xdacf('0x1f')],'transfereeaccountcode':_0x2dcce0['transfertargetaccountcode'],'transfereecontext':_0x2dcce0[_0xdacf('0x20')],'transfereeexten':_0x2dcce0[_0xdacf('0x21')],'transfereelinkedid':_0x2dcce0[_0xdacf('0x22')],'isexternal':_0x2dcce0['isexternal'],'context':_0x2dcce0['origtransferercontext'],'extension':_0x2dcce0[_0xdacf('0x23')],'type':_0xdacf('0x24')},'log':_0xdacf('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 8bd17e2..c7252a8 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 _0xd046=['queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','server','http','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','moment','../ami','%s/%s','name','timer','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','content','voiceQueues','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','undefined','values','voicechannel','channels','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xd046,0x129));var _0x6d04=function(_0x5c1833,_0x331b4c){_0x5c1833=_0x5c1833-0x0;var _0x57d38e=_0xd046[_0x5c1833];return _0x57d38e;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var jayson=require(_0x6d04('0x1'));var schema=require(_0x6d04('0x2'));var BPromise=require('bluebird');var moment=require(_0x6d04('0x3'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x6d04('0x4'));exports['listen']=function(_0x174d65,_0x4a1d47,_0x4bacb1){return new BPromise(function(_0xf3b4e7,_0x1968c4){var _0x4f83bc={'QueuePause':function(_0x569c7b){return new Promise(function(_0x2e2c01,_0x42aa22){var _0x52fc0c=util['format'](_0x6d04('0x5'),'SIP',_0x569c7b[_0x6d04('0x6')]);if(_0x174d65['timers']&&_0x174d65['timers'][_0x52fc0c]&&_0x174d65['timers'][_0x52fc0c][_0x6d04('0x7')]){_0x174d65[_0x6d04('0x8')][_0x52fc0c][_0x6d04('0x9')]();}if(_0x174d65[_0x6d04('0xa')][_0x52fc0c]){_0x174d65['agents'][_0x52fc0c][_0x6d04('0xb')]({'statePause':_0x569c7b[_0x6d04('0xc')]?!![]:![]});}_0x2e2c01({'code':0xc8,'message':_0x6d04('0xd')});});},'Reload':function(_0x16526b){var _0x22888e=this;return new Promise(function(_0x3e1da1,_0x2cadb8){if(ami[_0x6d04('0xe')]()==![]){return _0x2cadb8(_0x22888e[_0x6d04('0xf')](0x1f4,[config[_0x6d04('0x10')]['ip'],config[_0x6d04('0x10')][_0x6d04('0x11')],_0x6d04('0x12')][_0x6d04('0x13')]('\x20')));}_0x16526b=_[_0x6d04('0x14')](_0x16526b,_[_0x6d04('0x15')](properties[_0x6d04('0x16')]));_0x16526b[_0x6d04('0x17')]=_0x6d04('0x18');return ami[_0x6d04('0x19')](_0x16526b)[_0x6d04('0x1a')](function(_0x41dc21){_0x3e1da1({'code':0xc8,'message':_0x41dc21[_0x6d04('0x1b')]});})[_0x6d04('0x1c')](function(_0x4e93b5){_0x2cadb8(_0x22888e[_0x6d04('0xf')](0x1f5,_0x4e93b5[_0x6d04('0x1b')]));});});},'Command':function(_0x158383){var _0x7edbfc=this;return new Promise(function(_0x1d3dac,_0x2c6bb4){if(ami[_0x6d04('0xe')]()==![]){return _0x2c6bb4(_0x7edbfc[_0x6d04('0xf')](0x1f4,[config[_0x6d04('0x10')]['ip'],config[_0x6d04('0x10')][_0x6d04('0x11')],_0x6d04('0x12')][_0x6d04('0x13')]('\x20')));}_0x158383=_['pick'](_0x158383,_0x6d04('0x1d'));_0x158383[_0x6d04('0x17')]='Command';return ami['Action'](_0x158383)[_0x6d04('0x1a')](function(_0x326276){_0x1d3dac({'code':0xc8,'message':_0x326276[_0x6d04('0x1e')]});})[_0x6d04('0x1c')](function(_0x36113c){_0x2c6bb4(_0x7edbfc[_0x6d04('0xf')](0x1f5,_0x36113c[_0x6d04('0x1b')]));});});},'VoiceQueues':function(_0xb2bd60){return new Promise(function(_0x16a5b8,_0x38e90f){var _0x2c4d5b=[];for(var _0x23d78a in _0x174d65[_0x6d04('0x1f')]){if(_0x174d65[_0x6d04('0x1f')]['hasOwnProperty'](_0x23d78a)){var _0x1dc29b=_0x174d65[_0x6d04('0x1f')][_0x23d78a];var _0x6104a2={'id':_0x1dc29b['id'],'name':_0x1dc29b[_0x6d04('0x6')],'strategy':_0x1dc29b[_0x6d04('0x20')],'answered':_0x1dc29b[_0x6d04('0x21')],'available':_0x1dc29b['available'],'loggedIn':_0x1dc29b[_0x6d04('0x22')],'pTalking':_0x1dc29b[_0x6d04('0x23')],'sumBillable':_0x1dc29b[_0x6d04('0x24')],'sumDuration':_0x1dc29b[_0x6d04('0x25')],'sumHoldTime':_0x1dc29b[_0x6d04('0x26')]||0x0,'talking':_0x1dc29b['talking'],'total':_0x1dc29b['total'],'type':_0x1dc29b['type'],'unmanaged':_0x1dc29b['unmanaged'],'abandoned':_0x1dc29b[_0x6d04('0x27')],'waiting':_0x1dc29b['waiting'],'loggedInDb':_0x1dc29b[_0x6d04('0x28')]};if(_0x1dc29b['type']===_0x6d04('0x29')){_0x6104a2[_0x6d04('0x2a')]=_0x1dc29b[_0x6d04('0x2a')];_0x6104a2[_0x6d04('0x2b')]=_0x1dc29b[_0x6d04('0x2b')];_0x6104a2[_0x6d04('0x2c')]=_0x1dc29b[_0x6d04('0x2c')];_0x6104a2[_0x6d04('0x2d')]=_0x1dc29b[_0x6d04('0x2d')];_0x6104a2[_0x6d04('0x2e')]=_0x1dc29b['dialOriginateTimeout'];_0x6104a2['dialPrefix']=_0x1dc29b[_0x6d04('0x2f')];_0x6104a2[_0x6d04('0x30')]=_0x1dc29b[_0x6d04('0x30')];_0x6104a2[_0x6d04('0x31')]=_0x1dc29b['outboundAnswerAgiCallsDay'];_0x6104a2[_0x6d04('0x32')]=_0x1dc29b[_0x6d04('0x32')];_0x6104a2[_0x6d04('0x33')]=_0x1dc29b[_0x6d04('0x33')];_0x6104a2['outboundBusyCallsDay']=_0x1dc29b[_0x6d04('0x34')];_0x6104a2[_0x6d04('0x35')]=_0x1dc29b[_0x6d04('0x35')];_0x6104a2[_0x6d04('0x36')]=_0x1dc29b[_0x6d04('0x36')];_0x6104a2[_0x6d04('0x37')]=_0x1dc29b[_0x6d04('0x37')];_0x6104a2[_0x6d04('0x38')]=_0x1dc29b[_0x6d04('0x38')];_0x6104a2[_0x6d04('0x39')]=_0x1dc29b[_0x6d04('0x39')];_0x6104a2[_0x6d04('0x3a')]=_0x1dc29b[_0x6d04('0x3a')];_0x6104a2[_0x6d04('0x3b')]=_0x1dc29b[_0x6d04('0x3b')];_0x6104a2['outboundReCallsDay']=_0x1dc29b[_0x6d04('0x3c')];_0x6104a2['outboundRejectCallsDay']=_0x1dc29b[_0x6d04('0x3d')];_0x6104a2[_0x6d04('0x3e')]=_0x1dc29b['outboundUnknownCallsDay'];_0x6104a2[_0x6d04('0x3f')]=_0x1dc29b[_0x6d04('0x3f')];_0x6104a2[_0x6d04('0x40')]=_0x1dc29b[_0x6d04('0x40')];_0x6104a2[_0x6d04('0x41')]=_0x1dc29b[_0x6d04('0x41')];_0x6104a2[_0x6d04('0x42')]=_0x1dc29b[_0x6d04('0x42')];_0x6104a2['predictiveIntervalDroppedCallsTimeout']=_0x1dc29b[_0x6d04('0x43')];_0x6104a2[_0x6d04('0x44')]=_0x1dc29b[_0x6d04('0x44')];_0x6104a2[_0x6d04('0x45')]=_0x1dc29b[_0x6d04('0x45')];_0x6104a2['predictiveIntervalHitRate']=_0x1dc29b[_0x6d04('0x46')];_0x6104a2['predictiveIntervalMultiplicativeFactor']=_0x1dc29b['predictiveIntervalMultiplicativeFactor'];_0x6104a2['predictiveIntervalPauses']=_0x1dc29b['predictiveIntervalPauses'];_0x6104a2['predictiveIntervalAvailable']=_0x1dc29b[_0x6d04('0x47')];_0x6104a2['predictiveIntervalTotalCalls']=_0x1dc29b[_0x6d04('0x48')];_0x6104a2[_0x6d04('0x1b')]=_0x1dc29b[_0x6d04('0x1b')];_0x6104a2[_0x6d04('0x49')]=_0x1dc29b['originated'];_0x6104a2[_0x6d04('0x4a')]=_0x1dc29b[_0x6d04('0x4a')];_0x6104a2['erlangCallToSecond']=_0x1dc29b[_0x6d04('0x4b')];_0x6104a2[_0x6d04('0x4c')]=_0x1dc29b[_0x6d04('0x4c')];_0x6104a2[_0x6d04('0x4d')]=_0x1dc29b[_0x6d04('0x4d')];_0x6104a2[_0x6d04('0x4e')]=_0x1dc29b[_0x6d04('0x4e')];_0x6104a2['startProgressive']=_0x1dc29b[_0x6d04('0x4f')];}if(_0x1dc29b['Trunk']){_0x6104a2['Trunk']={'id':_0x1dc29b[_0x6d04('0x50')]['id'],'name':_0x1dc29b['Trunk'][_0x6d04('0x6')],'active':_0x1dc29b[_0x6d04('0x50')]['active'],'callerid':_0x1dc29b[_0x6d04('0x50')][_0x6d04('0x51')]};}if(_0x1dc29b[_0x6d04('0x52')]){_0x6104a2['Interval']={'id':_0x1dc29b['Interval']['id'],'name':_0x1dc29b[_0x6d04('0x52')][_0x6d04('0x6')]};}_0x2c4d5b[_0x6d04('0x53')](_0x6104a2);}}_0x16a5b8({'count':_0x2c4d5b[_0x6d04('0x54')],'rows':_0x2c4d5b});});},'UpdateVoiceQueue':function(_0x36db7a){return new Promise(function(_0x550455,_0x204933){var _0x3f053c=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x1f')],{'id':parseInt(_0x36db7a['id'])});var _0x413c3f=_[_0x6d04('0x56')](_0x36db7a,['id']);if(_0x3f053c){for(var _0x491de4 in _0x413c3f){if(typeof _0x413c3f[_0x491de4]!==_0x6d04('0x57')&&typeof _0x3f053c[_0x491de4]!==_0x6d04('0x57')){_0x3f053c[_0x491de4]=_0x413c3f[_0x491de4];}}_0x550455(_0x3f053c);}else{_0x204933();}});},'VoiceChannels':function(_0xace1a6){return new Promise(function(_0x4b5ed6,_0x52f411){var _0x146e51=_[_0x6d04('0x58')](_0x174d65['channels']);_0x4b5ed6({'count':_0x146e51['length'],'rows':_0x146e51});});},'VoiceChannelMixMonitor':function(_0x55e80a){var _0x4f4524=this;return new Promise(function(_0x56c653,_0x4b0349){if(ami[_0x6d04('0xe')]()==![]){return _0x4b0349(_0x4f4524[_0x6d04('0xf')](0x1f4,[config[_0x6d04('0x10')]['ip'],config[_0x6d04('0x10')]['username'],_0x6d04('0x12')][_0x6d04('0x13')]('\x20')));}var _0x48f04c=schema(properties[_0x6d04('0x59')])['validate'](_0x55e80a);if(_0x48f04c[_0x6d04('0x54')]>0x0){return _0x4b0349(_0x4f4524['error'](0x1f4,_['map'](_0x48f04c,_0x6d04('0x1b'))[_0x6d04('0x13')](',\x20')));}var _0xe4a07a=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x5a')],{'uniqueid':_0x55e80a[_0x6d04('0x5b')]});if(_0xe4a07a&&_0xe4a07a[_0x6d04('0x5c')]){var _0x16fe48=util[_0x6d04('0x5d')](_0x6d04('0x5e'),_0x55e80a[_0x6d04('0x5f')]||_0x55e80a[_0x6d04('0x5b')],_0x55e80a[_0x6d04('0x5d')]||_0x6d04('0x60'));return ami[_0x6d04('0x19')]({'action':_0x6d04('0x61'),'channel':_0xe4a07a['channel'],'file':_0x16fe48,'options':_0x6d04('0x62')})[_0x6d04('0x1a')](function(_0x1785e3){var _0x124401=_[_0x6d04('0x55')](_0xe4a07a[_0x6d04('0x63')],{'filename':_0x6d04('0x64')+_0x16fe48[_0x6d04('0x65')]()});if(_['isNil'](_0x124401)){_0xe4a07a[_0x6d04('0x63')][_0x6d04('0x53')]({'filename':'/var/spool/asterisk/monitor/'+_0x16fe48[_0x6d04('0x65')](),'createdAt':moment()[_0x6d04('0x5d')](_0x6d04('0x66')),'mixmonitorid':_0x1785e3[_0x6d04('0x67')],'status':_0x6d04('0x68')});}else{_0x124401[_0x6d04('0x67')]=_0x1785e3['mixmonitorid'];_0x124401['status']=_0x6d04('0x68');}_0x56c653({'code':0xc8,'message':[_0x55e80a['uniqueid'],_0x6d04('0x69'),_0x1785e3[_0x6d04('0x67')]][_0x6d04('0x13')]('\x20'),'mixmonitorid':_0x1785e3[_0x6d04('0x67')]});})['catch'](function(_0x24744c){_0x4b0349(_0x4f4524[_0x6d04('0xf')](0x1f5,[_0x55e80a[_0x6d04('0x5b')],_0x24744c[_0x6d04('0x1b')][_0x6d04('0x65')]()][_0x6d04('0x13')]('\x20')));});}else{return _0x4b0349(_0x4f4524[_0x6d04('0xf')](0x1f5,_0x6d04('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x5d729f){var _0x8a9a2c=this;return new Promise(function(_0x3f9214,_0x1af6b8){if(ami['isConnected']()==![]){return _0x1af6b8(_0x8a9a2c[_0x6d04('0xf')](0x1f4,[config[_0x6d04('0x10')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x6d04('0x13')]('\x20')));}var _0x2da73e=schema(properties[_0x6d04('0x59')])[_0x6d04('0x2')](_0x5d729f);if(_0x2da73e[_0x6d04('0x54')]>0x0){return _0x1af6b8(_0x8a9a2c[_0x6d04('0xf')](0x1f4,_[_0x6d04('0x6b')](_0x2da73e,_0x6d04('0x1b'))[_0x6d04('0x13')](',\x20')));}var _0xb2edae=_['find'](_0x174d65['channels'],{'uniqueid':_0x5d729f['uniqueid']});if(_0xb2edae){return BPromise[_0x6d04('0x6c')]()[_0x6d04('0x1a')](function(){if(_0xb2edae[_0x6d04('0x5c')]){return ami[_0x6d04('0x19')]({'action':_0x6d04('0x6d'),'channel':_0xb2edae['channel'],'mixmonitorid':_0x5d729f[_0x6d04('0x67')]})['catch'](function(_0x10e0b9){});}})[_0x6d04('0x1a')](function(){if(_0xb2edae[_0x6d04('0x6e')]){return ami[_0x6d04('0x19')]({'action':_0x6d04('0x6d'),'channel':_0xb2edae[_0x6d04('0x6e')],'mixmonitorid':_0x5d729f[_0x6d04('0x67')]})[_0x6d04('0x1c')](function(_0x5504dc){});}})[_0x6d04('0x1a')](function(_0x37f223){var _0x2079a2=_[_0x6d04('0x55')](_0xb2edae[_0x6d04('0x63')],{'mixmonitorid':_0x5d729f[_0x6d04('0x67')]});if(_0x2079a2){_0x2079a2[_0x6d04('0x6f')]=_0x6d04('0x70');}})['then'](function(){var _0x45b641=util[_0x6d04('0x5d')](_0x6d04('0x5e'),_0x5d729f[_0x6d04('0x5f')]||_0x5d729f['uniqueid'],_0x5d729f[_0x6d04('0x5d')]||'wav');var _0x494ae0=_[_0x6d04('0x55')](_0xb2edae[_0x6d04('0x63')],{'filename':_0x6d04('0x64')+_0x45b641[_0x6d04('0x65')]()});if(_0x494ae0){_0x494ae0['status']=_0x6d04('0x70');}})[_0x6d04('0x1a')](function(){_0x3f9214({'code':0xc8,'message':[_0x5d729f[_0x6d04('0x5b')],_0x6d04('0x71')][_0x6d04('0x13')]('\x20')});})[_0x6d04('0x1c')](function(_0x24df5f){_0x1af6b8(_0x8a9a2c[_0x6d04('0xf')](0x1f5,[_0x5d729f[_0x6d04('0x5b')],_0x24df5f[_0x6d04('0x1b')][_0x6d04('0x65')]()][_0x6d04('0x13')]('\x20')));});}else{return _0x1af6b8(_0x8a9a2c['error'](0x1f5,_0x6d04('0x6a')));}});},'VoiceQueuesChannels':function(_0x4115c6){return new Promise(function(_0x2e4e80,_0x208860){var _0x2f0ea6=_['values'](_0x174d65[_0x6d04('0x72')]);_0x2e4e80({'count':_0x2f0ea6['length'],'rows':_0x2f0ea6});});},'VoiceQueuesChannel':function(_0x4886d5){var _0x29f3c8=this;return new Promise(function(_0x436df8,_0x3547b7){var _0x2864f2=schema(properties[_0x6d04('0x73')])['validate'](_0x4886d5);if(_0x2864f2[_0x6d04('0x54')]>0x0){return _0x3547b7(_0x29f3c8[_0x6d04('0xf')](0x1f4,_['map'](_0x2864f2,'message')[_0x6d04('0x13')](',\x20')));}var _0x45ff0e=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x72')],{'uniqueid':_0x4886d5[_0x6d04('0x5b')]});if(_0x45ff0e){_0x436df8(_0x45ff0e);}else{return _0x3547b7(_0x29f3c8[_0x6d04('0xf')](0x1f5,_0x6d04('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0xd63098){var _0x1b58e8=this;return new Promise(function(_0x1d3c7e,_0x13ecc2){if(ami[_0x6d04('0xe')]()==![]){return _0x13ecc2(_0x1b58e8['error'](0x1f4,[config['asterisk']['ip'],config[_0x6d04('0x10')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x4fdf69=schema(properties[_0x6d04('0x74')])[_0x6d04('0x2')](_0xd63098);if(_0x4fdf69[_0x6d04('0x54')]>0x0){return _0x13ecc2(_0x1b58e8[_0x6d04('0xf')](0x1f4,_[_0x6d04('0x6b')](_0x4fdf69,_0x6d04('0x1b'))[_0x6d04('0x13')](',\x20')));}var _0x55ac73=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x72')],{'uniqueid':_0xd63098[_0x6d04('0x5b')]});if(_0x55ac73&&_0x55ac73[_0x6d04('0x5c')]){return ami[_0x6d04('0x19')]({'action':'Hangup','channel':_0x55ac73[_0x6d04('0x5c')]})['then'](function(_0x35f0fc){_0x1d3c7e({'code':0xc8,'message':[_0xd63098[_0x6d04('0x5b')],_0x35f0fc[_0x6d04('0x1b')][_0x6d04('0x65')]()][_0x6d04('0x13')]('\x20')});})[_0x6d04('0x1c')](function(_0x299eb2){_0x13ecc2(_0x1b58e8[_0x6d04('0xf')](0x1f5,[_0xd63098['uniqueid'],_0x299eb2[_0x6d04('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x13ecc2(_0x1b58e8[_0x6d04('0xf')](0x1f5,_0x6d04('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x4cb247){var _0x54d9ce=this;return new Promise(function(_0x5ce833,_0x28c6bc){if(ami[_0x6d04('0xe')]()==![]){return _0x28c6bc(_0x54d9ce[_0x6d04('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x6d04('0x11')],_0x6d04('0x12')][_0x6d04('0x13')]('\x20')));}var _0xb09641=schema(properties[_0x6d04('0x75')])['validate'](_0x4cb247);if(_0xb09641['length']>0x0){return _0x28c6bc(_0x54d9ce['error'](0x1f4,_['map'](_0xb09641,_0x6d04('0x1b'))[_0x6d04('0x13')](',\x20')));}var _0x2e34f1=_[_0x6d04('0x55')](_0x174d65[_0x6d04('0x72')],{'uniqueid':_0x4cb247['uniqueid']});if(_0x2e34f1&&_0x2e34f1[_0x6d04('0x5c')]){return ami['Action']({'action':_0x6d04('0x76'),'channel':_0x2e34f1[_0x6d04('0x5c')],'exten':_0x4cb247[_0x6d04('0x77')],'context':_0x4cb247[_0x6d04('0x78')]||_0x2e34f1[_0x6d04('0x78')],'priority':0x1})[_0x6d04('0x1a')](function(_0x5e6637){_0x5ce833({'code':0xc8,'message':[_0x4cb247[_0x6d04('0x5b')],_0x5e6637[_0x6d04('0x1b')]['toLowerCase']()][_0x6d04('0x13')]('\x20')});})[_0x6d04('0x1c')](function(_0x9a88eb){_0x28c6bc(_0x54d9ce[_0x6d04('0xf')](0x1f5,[_0x4cb247[_0x6d04('0x5b')],_0x9a88eb[_0x6d04('0x1b')][_0x6d04('0x65')]()][_0x6d04('0x13')]('\x20')));});}else{return _0x28c6bc(_0x54d9ce[_0x6d04('0xf')](0x1f5,_0x6d04('0x6a')));}});},'Agents':function(_0x5b46dd){return new Promise(function(_0x3fe3d4,_0x5e05e9){var _0x426f6d=_['values'](_0x174d65[_0x6d04('0xa')]);_0x3fe3d4({'count':_0x426f6d[_0x6d04('0x54')],'rows':_0x426f6d});});},'Telephones':function(_0x2242f7){return new Promise(function(_0x33b0f5,_0x40336e){var _0x5622b1=_[_0x6d04('0x58')](_0x174d65[_0x6d04('0x79')]);_0x33b0f5({'count':_0x5622b1['length'],'rows':_0x5622b1});});},'Trunks':function(_0x43af5f){return new Promise(function(_0x34bfcb,_0x5818ed){var _0x2a6c30=_['values'](_0x174d65[_0x6d04('0x7a')]);_0x34bfcb({'count':_0x2a6c30['length'],'rows':_0x2a6c30});});},'OutboundChannels':function(_0x3ff09e){return new Promise(function(_0x23ba11,_0x469443){var _0x29dfba=_[_0x6d04('0x58')](_0x174d65[_0x6d04('0x7b')]);_0x23ba11({'count':_0x29dfba[_0x6d04('0x54')],'rows':_0x29dfba});});},'Outbound':function(_0x2c4219){return new Promise(function(_0x7c68eb,_0x2be999){_0x7c68eb(_0x174d65[_0x6d04('0x29')]);});},'Campaigns':function(_0x3cc46f){return new Promise(function(_0x56c938,_0x3e2eea){var _0x1e68c6=_[_0x6d04('0x58')](_0x174d65[_0x6d04('0x7c')]);_0x56c938({'count':_0x1e68c6['length'],'rows':_0x1e68c6});});},'VoiceQueuesPreview':function(_0x3df7ef){var _0x43ba0b=this;return new Promise(function(_0x46da38,_0x415421){_0x4a1d47[_0x6d04('0x7d')](_0x3df7ef['id'])[_0x6d04('0x1a')](function(_0x281f79){_0x46da38({'code':0xc8,'message':_0x281f79[_0x6d04('0x1b')]});})['catch'](function(_0x250eef){_0x415421(_0x43ba0b['error'](0x1f4,_0x250eef[_0x6d04('0x1b')]));});});},'EventManager':function(_0x57e551){var _0x1b8402=this;return new Promise(function(_0x124708,_0x17ca4d){if(!_0x57e551[_0x6d04('0x7e')]){return _0x17ca4d(_0x1b8402[_0x6d04('0xf')](0x1f4,_0x6d04('0x7f')));}ami['emit'](_0x6d04('0x80')+_0x57e551[_0x6d04('0x7e')],_0x57e551['message']);_0x124708({'code':0xc8,'message':_0x57e551});});},'FaxAccounts':function(_0x36768e){return new Promise(function(_0x1d3b13,_0x7e911b){var _0x4b7a37=_[_0x6d04('0x58')](_0x174d65[_0x6d04('0x81')]);_0x1d3b13({'count':_0x4b7a37[_0x6d04('0x54')],'rows':_0x4b7a37});});},'SendFax':function(_0x220c69){var _0x407f98=this;return new Promise(function(_0x7f5790,_0xe07034){_0x4bacb1[_0x6d04('0x82')](_0x220c69)[_0x6d04('0x1a')](function(_0x345ffe){_0x7f5790({'code':0xc8,'message':_0x345ffe[_0x6d04('0x1b')]});})[_0x6d04('0x1c')](function(_0x93c05c){_0xe07034(_0x407f98[_0x6d04('0xf')](0x1f4,_0x93c05c['message']));});});},'CheckAfterSend':function(_0x2b4e49){var _0x425707=this;return new Promise(function(_0x12a364,_0x202e83){_0x4bacb1['checkAfterSend'](_0x2b4e49)[_0x6d04('0x1a')](function(_0x1e8db9){_0x12a364({'code':0xc8,'message':_0x1e8db9[_0x6d04('0x1b')]});})['catch'](function(_0x24e546){_0x202e83(_0x425707[_0x6d04('0xf')](0x1f4,_0x24e546[_0x6d04('0x1b')]));});});}};var _0x299037=jayson[_0x6d04('0x83')](_0x4f83bc)[_0x6d04('0x84')]();_0x299037['on']('error',function(_0x921efd){return _0x1968c4(_0x921efd);});_0x299037[_0x6d04('0x85')](0x232a,'127.0.0.1',function(){console[_0x6d04('0x86')](_0x6d04('0x87'),0x232a);return _0xf3b4e7(_0x6d04('0x88')+0x232a);});});}; \ No newline at end of file +var _0x7bd0=['log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','module','action','Reload','Action','then','message','catch','join','command','voiceQueues','hasOwnProperty','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','values','channels','uniqueid','channel','%s.%s','filename','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','rec','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','map','StopMixMonitor','destinationchannel','stop','status','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','emit','send','server'];(function(_0x4cfff4,_0x57d274){var _0x1fc1df=function(_0x2ccb62){while(--_0x2ccb62){_0x4cfff4['push'](_0x4cfff4['shift']());}};_0x1fc1df(++_0x57d274);}(_0x7bd0,0x111));var _0x07bd=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x7bd0[_0x4fdcc0];return _0xc0ce94;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var jayson=require(_0x07bd('0x2'));var schema=require(_0x07bd('0x3'));var BPromise=require(_0x07bd('0x4'));var moment=require(_0x07bd('0x5'));var config=require(_0x07bd('0x6'));var properties=require(_0x07bd('0x7'));var ami=require('../ami');exports[_0x07bd('0x8')]=function(_0x3b4f4f,_0x38f3f1,_0x313548){return new BPromise(function(_0x3e8349,_0x422a22){var _0x2e4cd1={'QueuePause':function(_0x5a939d){return new Promise(function(_0x3968d9,_0x5cd446){var _0x8032dc=util[_0x07bd('0x9')](_0x07bd('0xa'),'SIP',_0x5a939d[_0x07bd('0xb')]);if(_0x3b4f4f[_0x07bd('0xc')]&&_0x3b4f4f[_0x07bd('0xc')][_0x8032dc]&&_0x3b4f4f[_0x07bd('0xc')][_0x8032dc]['timer']){_0x3b4f4f[_0x07bd('0xc')][_0x8032dc][_0x07bd('0xd')]();}if(_0x3b4f4f[_0x07bd('0xe')][_0x8032dc]){_0x3b4f4f[_0x07bd('0xe')][_0x8032dc][_0x07bd('0xf')]({'statePause':_0x5a939d[_0x07bd('0x10')]?!![]:![]});}_0x3968d9({'code':0xc8,'message':_0x07bd('0x11')});});},'Reload':function(_0x2b8409){var _0x5c37dd=this;return new Promise(function(_0x51eb2a,_0x2ca1bc){if(ami[_0x07bd('0x12')]()==![]){return _0x2ca1bc(_0x5c37dd[_0x07bd('0x13')](0x1f4,[config[_0x07bd('0x14')]['ip'],config[_0x07bd('0x14')][_0x07bd('0x15')],_0x07bd('0x16')]['join']('\x20')));}_0x2b8409=_[_0x07bd('0x17')](_0x2b8409,_['keys'](properties[_0x07bd('0x18')]));_0x2b8409[_0x07bd('0x19')]=_0x07bd('0x1a');return ami[_0x07bd('0x1b')](_0x2b8409)[_0x07bd('0x1c')](function(_0x4929d6){_0x51eb2a({'code':0xc8,'message':_0x4929d6[_0x07bd('0x1d')]});})[_0x07bd('0x1e')](function(_0x4948f4){_0x2ca1bc(_0x5c37dd[_0x07bd('0x13')](0x1f5,_0x4948f4[_0x07bd('0x1d')]));});});},'Command':function(_0x758fd5){var _0x2fcc59=this;return new Promise(function(_0x36ccec,_0x109dbc){if(ami[_0x07bd('0x12')]()==![]){return _0x109dbc(_0x2fcc59[_0x07bd('0x13')](0x1f4,[config[_0x07bd('0x14')]['ip'],config['asterisk'][_0x07bd('0x15')],_0x07bd('0x16')][_0x07bd('0x1f')]('\x20')));}_0x758fd5=_[_0x07bd('0x17')](_0x758fd5,_0x07bd('0x20'));_0x758fd5['action']='Command';return ami[_0x07bd('0x1b')](_0x758fd5)['then'](function(_0x2b0dee){_0x36ccec({'code':0xc8,'message':_0x2b0dee['content']});})['catch'](function(_0x4165bc){_0x109dbc(_0x2fcc59[_0x07bd('0x13')](0x1f5,_0x4165bc[_0x07bd('0x1d')]));});});},'VoiceQueues':function(_0xdb47ba){return new Promise(function(_0x28bd91,_0x43cbc8){var _0x557042=[];for(var _0x180b43 in _0x3b4f4f[_0x07bd('0x21')]){if(_0x3b4f4f[_0x07bd('0x21')][_0x07bd('0x22')](_0x180b43)){var _0x12ce26=_0x3b4f4f[_0x07bd('0x21')][_0x180b43];var _0x571dab={'id':_0x12ce26['id'],'name':_0x12ce26['name'],'strategy':_0x12ce26['strategy'],'answered':_0x12ce26[_0x07bd('0x23')],'available':_0x12ce26[_0x07bd('0x24')],'loggedIn':_0x12ce26[_0x07bd('0x25')],'pTalking':_0x12ce26['pTalking'],'sumBillable':_0x12ce26[_0x07bd('0x26')],'sumDuration':_0x12ce26[_0x07bd('0x27')],'sumHoldTime':_0x12ce26[_0x07bd('0x28')]||0x0,'talking':_0x12ce26[_0x07bd('0x29')],'total':_0x12ce26[_0x07bd('0x2a')],'type':_0x12ce26[_0x07bd('0x2b')],'unmanaged':_0x12ce26['unmanaged'],'abandoned':_0x12ce26[_0x07bd('0x2c')],'waiting':_0x12ce26[_0x07bd('0x2d')],'loggedInDb':_0x12ce26[_0x07bd('0x2e')]};if(_0x12ce26[_0x07bd('0x2b')]===_0x07bd('0x2f')){_0x571dab[_0x07bd('0x30')]=_0x12ce26[_0x07bd('0x30')];_0x571dab[_0x07bd('0x31')]=_0x12ce26['dialMethod'];_0x571dab['dialOriginateCallerIdName']=_0x12ce26[_0x07bd('0x32')];_0x571dab[_0x07bd('0x33')]=_0x12ce26[_0x07bd('0x33')];_0x571dab['dialOriginateTimeout']=_0x12ce26[_0x07bd('0x34')];_0x571dab[_0x07bd('0x35')]=_0x12ce26[_0x07bd('0x35')];_0x571dab['temp']=_0x12ce26['temp'];_0x571dab[_0x07bd('0x36')]=_0x12ce26[_0x07bd('0x36')];_0x571dab[_0x07bd('0x37')]=_0x12ce26[_0x07bd('0x37')];_0x571dab['outboundBlacklistCallsDay']=_0x12ce26[_0x07bd('0x38')];_0x571dab[_0x07bd('0x39')]=_0x12ce26[_0x07bd('0x39')];_0x571dab['outboundCongestionCallsDay']=_0x12ce26[_0x07bd('0x3a')];_0x571dab[_0x07bd('0x3b')]=_0x12ce26['outboundDropCallsDayACS'];_0x571dab[_0x07bd('0x3c')]=_0x12ce26[_0x07bd('0x3c')];_0x571dab[_0x07bd('0x3d')]=_0x12ce26[_0x07bd('0x3d')];_0x571dab['outboundNoAnswerCallsDay']=_0x12ce26['outboundNoAnswerCallsDay'];_0x571dab[_0x07bd('0x3e')]=_0x12ce26['outboundNoSuchCallsDay'];_0x571dab[_0x07bd('0x3f')]=_0x12ce26[_0x07bd('0x3f')];_0x571dab[_0x07bd('0x40')]=_0x12ce26[_0x07bd('0x40')];_0x571dab[_0x07bd('0x41')]=_0x12ce26[_0x07bd('0x41')];_0x571dab[_0x07bd('0x42')]=_0x12ce26[_0x07bd('0x42')];_0x571dab[_0x07bd('0x43')]=_0x12ce26[_0x07bd('0x43')];_0x571dab[_0x07bd('0x44')]=_0x12ce26[_0x07bd('0x44')];_0x571dab[_0x07bd('0x45')]=_0x12ce26['predictiveIntervalAvgTalktime'];_0x571dab[_0x07bd('0x46')]=_0x12ce26[_0x07bd('0x46')];_0x571dab[_0x07bd('0x47')]=_0x12ce26[_0x07bd('0x47')];_0x571dab['predictiveIntervalErlangCalls']=_0x12ce26[_0x07bd('0x48')];_0x571dab[_0x07bd('0x49')]=_0x12ce26[_0x07bd('0x49')];_0x571dab[_0x07bd('0x4a')]=_0x12ce26[_0x07bd('0x4a')];_0x571dab['predictiveIntervalMultiplicativeFactor']=_0x12ce26['predictiveIntervalMultiplicativeFactor'];_0x571dab[_0x07bd('0x4b')]=_0x12ce26[_0x07bd('0x4b')];_0x571dab[_0x07bd('0x4c')]=_0x12ce26[_0x07bd('0x4c')];_0x571dab['predictiveIntervalTotalCalls']=_0x12ce26[_0x07bd('0x4d')];_0x571dab[_0x07bd('0x1d')]=_0x12ce26[_0x07bd('0x1d')];_0x571dab[_0x07bd('0x4e')]=_0x12ce26[_0x07bd('0x4e')];_0x571dab[_0x07bd('0x4f')]=_0x12ce26[_0x07bd('0x4f')];_0x571dab['erlangCallToSecond']=_0x12ce26[_0x07bd('0x50')];_0x571dab[_0x07bd('0x51')]=_0x12ce26[_0x07bd('0x51')];_0x571dab[_0x07bd('0x52')]=_0x12ce26[_0x07bd('0x52')];_0x571dab['startPredictive']=_0x12ce26[_0x07bd('0x53')];_0x571dab[_0x07bd('0x54')]=_0x12ce26[_0x07bd('0x54')];}if(_0x12ce26[_0x07bd('0x55')]){_0x571dab[_0x07bd('0x55')]={'id':_0x12ce26['Trunk']['id'],'name':_0x12ce26[_0x07bd('0x55')][_0x07bd('0xb')],'active':_0x12ce26[_0x07bd('0x55')][_0x07bd('0x56')],'callerid':_0x12ce26['Trunk']['callerid']};}if(_0x12ce26[_0x07bd('0x57')]){_0x571dab[_0x07bd('0x57')]={'id':_0x12ce26[_0x07bd('0x57')]['id'],'name':_0x12ce26[_0x07bd('0x57')][_0x07bd('0xb')]};}_0x557042[_0x07bd('0x58')](_0x571dab);}}_0x28bd91({'count':_0x557042[_0x07bd('0x59')],'rows':_0x557042});});},'UpdateVoiceQueue':function(_0x3cc593){return new Promise(function(_0x1f2a7a,_0x49604b){var _0x522c34=_[_0x07bd('0x5a')](_0x3b4f4f[_0x07bd('0x21')],{'id':parseInt(_0x3cc593['id'])});var _0x171db8=_[_0x07bd('0x5b')](_0x3cc593,['id']);if(_0x522c34){for(var _0x44274b in _0x171db8){if(typeof _0x171db8[_0x44274b]!==_0x07bd('0x5c')&&typeof _0x522c34[_0x44274b]!=='undefined'){_0x522c34[_0x44274b]=_0x171db8[_0x44274b];}}_0x1f2a7a(_0x522c34);}else{_0x49604b();}});},'VoiceChannels':function(_0x7a0447){return new Promise(function(_0x8cc99e,_0x11f1c2){var _0x39823e=_[_0x07bd('0x5d')](_0x3b4f4f[_0x07bd('0x5e')]);_0x8cc99e({'count':_0x39823e['length'],'rows':_0x39823e});});},'VoiceChannelMixMonitor':function(_0x3264ec){var _0x3760f3=this;return new Promise(function(_0x20c130,_0x3c0371){if(ami[_0x07bd('0x12')]()==![]){return _0x3c0371(_0x3760f3[_0x07bd('0x13')](0x1f4,[config[_0x07bd('0x14')]['ip'],config[_0x07bd('0x14')][_0x07bd('0x15')],_0x07bd('0x16')][_0x07bd('0x1f')]('\x20')));}var _0x2fa62e=schema(properties['voicechannel'])[_0x07bd('0x3')](_0x3264ec);if(_0x2fa62e[_0x07bd('0x59')]>0x0){return _0x3c0371(_0x3760f3[_0x07bd('0x13')](0x1f4,_['map'](_0x2fa62e,'message')[_0x07bd('0x1f')](',\x20')));}var _0x560f06=_[_0x07bd('0x5a')](_0x3b4f4f[_0x07bd('0x5e')],{'uniqueid':_0x3264ec[_0x07bd('0x5f')]});if(_0x560f06&&_0x560f06[_0x07bd('0x60')]){var _0x2a8167=util[_0x07bd('0x9')](_0x07bd('0x61'),_0x3264ec[_0x07bd('0x62')]||_0x3264ec['uniqueid'],_0x3264ec[_0x07bd('0x9')]||_0x07bd('0x63'));return ami[_0x07bd('0x1b')]({'action':'MixMonitor','channel':_0x560f06['channel'],'file':_0x2a8167,'options':'ai(mixmonitorid)'})[_0x07bd('0x1c')](function(_0x381932){var _0x12eae6=_['find'](_0x560f06[_0x07bd('0x64')],{'filename':_0x07bd('0x65')+_0x2a8167[_0x07bd('0x66')]()});if(_[_0x07bd('0x67')](_0x12eae6)){_0x560f06[_0x07bd('0x64')][_0x07bd('0x58')]({'filename':'/var/spool/asterisk/monitor/'+_0x2a8167['toLowerCase'](),'createdAt':moment()[_0x07bd('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x381932['mixmonitorid'],'status':_0x07bd('0x68')});}else{_0x12eae6[_0x07bd('0x69')]=_0x381932[_0x07bd('0x69')];_0x12eae6['status']=_0x07bd('0x68');}_0x20c130({'code':0xc8,'message':[_0x3264ec[_0x07bd('0x5f')],_0x07bd('0x6a'),_0x381932[_0x07bd('0x69')]][_0x07bd('0x1f')]('\x20'),'mixmonitorid':_0x381932[_0x07bd('0x69')]});})[_0x07bd('0x1e')](function(_0x248d6f){_0x3c0371(_0x3760f3[_0x07bd('0x13')](0x1f5,[_0x3264ec['uniqueid'],_0x248d6f[_0x07bd('0x1d')]['toLowerCase']()][_0x07bd('0x1f')]('\x20')));});}else{return _0x3c0371(_0x3760f3[_0x07bd('0x13')](0x1f5,_0x07bd('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x4944e3){var _0xc1d8b2=this;return new Promise(function(_0x5cb398,_0xc4f963){if(ami[_0x07bd('0x12')]()==![]){return _0xc4f963(_0xc1d8b2[_0x07bd('0x13')](0x1f4,[config[_0x07bd('0x14')]['ip'],config['asterisk']['username'],_0x07bd('0x16')]['join']('\x20')));}var _0x1bdfaf=schema(properties[_0x07bd('0x6c')])[_0x07bd('0x3')](_0x4944e3);if(_0x1bdfaf[_0x07bd('0x59')]>0x0){return _0xc4f963(_0xc1d8b2[_0x07bd('0x13')](0x1f4,_[_0x07bd('0x6d')](_0x1bdfaf,'message')[_0x07bd('0x1f')](',\x20')));}var _0x23103c=_[_0x07bd('0x5a')](_0x3b4f4f[_0x07bd('0x5e')],{'uniqueid':_0x4944e3[_0x07bd('0x5f')]});if(_0x23103c){return BPromise['resolve']()[_0x07bd('0x1c')](function(){if(_0x23103c[_0x07bd('0x60')]){return ami[_0x07bd('0x1b')]({'action':'StopMixMonitor','channel':_0x23103c[_0x07bd('0x60')],'mixmonitorid':_0x4944e3['mixmonitorid']})[_0x07bd('0x1e')](function(_0x46a22c){});}})['then'](function(){if(_0x23103c['destinationchannel']){return ami[_0x07bd('0x1b')]({'action':_0x07bd('0x6e'),'channel':_0x23103c[_0x07bd('0x6f')],'mixmonitorid':_0x4944e3[_0x07bd('0x69')]})[_0x07bd('0x1e')](function(_0x562925){});}})[_0x07bd('0x1c')](function(_0x498223){var _0x3ea36d=_['find'](_0x23103c[_0x07bd('0x64')],{'mixmonitorid':_0x4944e3['mixmonitorid']});if(_0x3ea36d){_0x3ea36d['status']=_0x07bd('0x70');}})[_0x07bd('0x1c')](function(){var _0x43f707=util[_0x07bd('0x9')](_0x07bd('0x61'),_0x4944e3[_0x07bd('0x62')]||_0x4944e3[_0x07bd('0x5f')],_0x4944e3[_0x07bd('0x9')]||_0x07bd('0x63'));var _0x20ba85=_['find'](_0x23103c[_0x07bd('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0x43f707[_0x07bd('0x66')]()});if(_0x20ba85){_0x20ba85[_0x07bd('0x71')]=_0x07bd('0x70');}})['then'](function(){_0x5cb398({'code':0xc8,'message':[_0x4944e3[_0x07bd('0x5f')],_0x07bd('0x72')][_0x07bd('0x1f')]('\x20')});})[_0x07bd('0x1e')](function(_0x4d8abc){_0xc4f963(_0xc1d8b2[_0x07bd('0x13')](0x1f5,[_0x4944e3[_0x07bd('0x5f')],_0x4d8abc['message'][_0x07bd('0x66')]()][_0x07bd('0x1f')]('\x20')));});}else{return _0xc4f963(_0xc1d8b2[_0x07bd('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x29a452){return new Promise(function(_0xa83eb9,_0x2e2f4b){var _0x189280=_['values'](_0x3b4f4f[_0x07bd('0x73')]);_0xa83eb9({'count':_0x189280[_0x07bd('0x59')],'rows':_0x189280});});},'VoiceQueuesChannel':function(_0x2d1ee7){var _0x22eaa8=this;return new Promise(function(_0x4b7b4d,_0x2bf632){var _0x5a590d=schema(properties[_0x07bd('0x74')])[_0x07bd('0x3')](_0x2d1ee7);if(_0x5a590d[_0x07bd('0x59')]>0x0){return _0x2bf632(_0x22eaa8[_0x07bd('0x13')](0x1f4,_['map'](_0x5a590d,_0x07bd('0x1d'))[_0x07bd('0x1f')](',\x20')));}var _0x3dd0b5=_[_0x07bd('0x5a')](_0x3b4f4f[_0x07bd('0x73')],{'uniqueid':_0x2d1ee7[_0x07bd('0x5f')]});if(_0x3dd0b5){_0x4b7b4d(_0x3dd0b5);}else{return _0x2bf632(_0x22eaa8[_0x07bd('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x8cd5d0){var _0x3eceb3=this;return new Promise(function(_0x21919c,_0x2b3dd6){if(ami[_0x07bd('0x12')]()==![]){return _0x2b3dd6(_0x3eceb3['error'](0x1f4,[config[_0x07bd('0x14')]['ip'],config[_0x07bd('0x14')][_0x07bd('0x15')],'ami\x20disconnected'][_0x07bd('0x1f')]('\x20')));}var _0x570fc9=schema(properties[_0x07bd('0x75')])[_0x07bd('0x3')](_0x8cd5d0);if(_0x570fc9[_0x07bd('0x59')]>0x0){return _0x2b3dd6(_0x3eceb3['error'](0x1f4,_['map'](_0x570fc9,_0x07bd('0x1d'))[_0x07bd('0x1f')](',\x20')));}var _0x1e722f=_[_0x07bd('0x5a')](_0x3b4f4f[_0x07bd('0x73')],{'uniqueid':_0x8cd5d0[_0x07bd('0x5f')]});if(_0x1e722f&&_0x1e722f[_0x07bd('0x60')]){return ami[_0x07bd('0x1b')]({'action':_0x07bd('0x76'),'channel':_0x1e722f['channel']})[_0x07bd('0x1c')](function(_0x2d4412){_0x21919c({'code':0xc8,'message':[_0x8cd5d0[_0x07bd('0x5f')],_0x2d4412[_0x07bd('0x1d')][_0x07bd('0x66')]()]['join']('\x20')});})[_0x07bd('0x1e')](function(_0x4da591){_0x2b3dd6(_0x3eceb3[_0x07bd('0x13')](0x1f5,[_0x8cd5d0[_0x07bd('0x5f')],_0x4da591['message'][_0x07bd('0x66')]()]['join']('\x20')));});}else{return _0x2b3dd6(_0x3eceb3['error'](0x1f5,_0x07bd('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x354d3e){var _0x243649=this;return new Promise(function(_0x30f02a,_0x1d64b0){if(ami['isConnected']()==![]){return _0x1d64b0(_0x243649[_0x07bd('0x13')](0x1f4,[config[_0x07bd('0x14')]['ip'],config[_0x07bd('0x14')]['username'],_0x07bd('0x16')][_0x07bd('0x1f')]('\x20')));}var _0x5a9ef5=schema(properties[_0x07bd('0x77')])[_0x07bd('0x3')](_0x354d3e);if(_0x5a9ef5['length']>0x0){return _0x1d64b0(_0x243649[_0x07bd('0x13')](0x1f4,_[_0x07bd('0x6d')](_0x5a9ef5,_0x07bd('0x1d'))[_0x07bd('0x1f')](',\x20')));}var _0x37d153=_[_0x07bd('0x5a')](_0x3b4f4f[_0x07bd('0x73')],{'uniqueid':_0x354d3e[_0x07bd('0x5f')]});if(_0x37d153&&_0x37d153['channel']){return ami[_0x07bd('0x1b')]({'action':_0x07bd('0x78'),'channel':_0x37d153['channel'],'exten':_0x354d3e[_0x07bd('0x79')],'context':_0x354d3e[_0x07bd('0x7a')]||_0x37d153[_0x07bd('0x7a')],'priority':0x1})[_0x07bd('0x1c')](function(_0x5c1877){_0x30f02a({'code':0xc8,'message':[_0x354d3e[_0x07bd('0x5f')],_0x5c1877[_0x07bd('0x1d')][_0x07bd('0x66')]()][_0x07bd('0x1f')]('\x20')});})['catch'](function(_0x15a175){_0x1d64b0(_0x243649[_0x07bd('0x13')](0x1f5,[_0x354d3e[_0x07bd('0x5f')],_0x15a175[_0x07bd('0x1d')][_0x07bd('0x66')]()][_0x07bd('0x1f')]('\x20')));});}else{return _0x1d64b0(_0x243649[_0x07bd('0x13')](0x1f5,_0x07bd('0x6b')));}});},'Agents':function(_0x72a4a5){return new Promise(function(_0x179e1d,_0x10e746){var _0x2978b6=_[_0x07bd('0x5d')](_0x3b4f4f[_0x07bd('0xe')]);_0x179e1d({'count':_0x2978b6[_0x07bd('0x59')],'rows':_0x2978b6});});},'Telephones':function(_0x2d20db){return new Promise(function(_0x347501,_0xd02a4e){var _0x5811ef=_[_0x07bd('0x5d')](_0x3b4f4f[_0x07bd('0x7b')]);_0x347501({'count':_0x5811ef[_0x07bd('0x59')],'rows':_0x5811ef});});},'Trunks':function(_0x2704c7){return new Promise(function(_0x3447f0,_0x208646){var _0x13c81f=_[_0x07bd('0x5d')](_0x3b4f4f[_0x07bd('0x7c')]);_0x3447f0({'count':_0x13c81f[_0x07bd('0x59')],'rows':_0x13c81f});});},'OutboundChannels':function(_0x49a808){return new Promise(function(_0x289d10,_0x3395b8){var _0x1dcb20=_[_0x07bd('0x5d')](_0x3b4f4f[_0x07bd('0x7d')]);_0x289d10({'count':_0x1dcb20[_0x07bd('0x59')],'rows':_0x1dcb20});});},'Outbound':function(_0x36e64b){return new Promise(function(_0x3a39df,_0x1b3c8b){_0x3a39df(_0x3b4f4f[_0x07bd('0x2f')]);});},'Campaigns':function(_0xbe2993){return new Promise(function(_0x32a49c,_0x307c9d){var _0x2af323=_[_0x07bd('0x5d')](_0x3b4f4f[_0x07bd('0x7e')]);_0x32a49c({'count':_0x2af323[_0x07bd('0x59')],'rows':_0x2af323});});},'VoiceQueuesPreview':function(_0x17b10e){var _0x4559f9=this;return new Promise(function(_0x429472,_0x4546da){_0x38f3f1[_0x07bd('0x7f')](_0x17b10e['id'])['then'](function(_0x18eecd){_0x429472({'code':0xc8,'message':_0x18eecd[_0x07bd('0x1d')]});})['catch'](function(_0x1b77d1){_0x4546da(_0x4559f9['error'](0x1f4,_0x1b77d1[_0x07bd('0x1d')]));});});},'EventManager':function(_0x5adf01){var _0x1ddb14=this;return new Promise(function(_0x27fd9c,_0x4cf4ad){if(!_0x5adf01[_0x07bd('0x80')]){return _0x4cf4ad(_0x1ddb14[_0x07bd('0x13')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x07bd('0x81')]('custom:'+_0x5adf01[_0x07bd('0x80')],_0x5adf01[_0x07bd('0x1d')]);_0x27fd9c({'code':0xc8,'message':_0x5adf01});});},'FaxAccounts':function(_0x207fde){return new Promise(function(_0x349e55,_0xaac9a4){var _0x3f8539=_[_0x07bd('0x5d')](_0x3b4f4f['faxAccounts']);_0x349e55({'count':_0x3f8539['length'],'rows':_0x3f8539});});},'SendFax':function(_0x46d212){var _0x663616=this;return new Promise(function(_0x3bf215,_0x1c2766){_0x313548[_0x07bd('0x82')](_0x46d212)[_0x07bd('0x1c')](function(_0x5872b8){_0x3bf215({'code':0xc8,'message':_0x5872b8[_0x07bd('0x1d')]});})['catch'](function(_0x3af55a){_0x1c2766(_0x663616['error'](0x1f4,_0x3af55a[_0x07bd('0x1d')]));});});},'CheckAfterSend':function(_0x29d0d1){var _0x170425=this;return new Promise(function(_0x1aed49,_0x2ec74d){_0x313548['checkAfterSend'](_0x29d0d1)[_0x07bd('0x1c')](function(_0x42d45b){_0x1aed49({'code':0xc8,'message':_0x42d45b[_0x07bd('0x1d')]});})[_0x07bd('0x1e')](function(_0x308859){_0x2ec74d(_0x170425[_0x07bd('0x13')](0x1f4,_0x308859[_0x07bd('0x1d')]));});});}};var _0xc4703e=jayson[_0x07bd('0x83')](_0x2e4cd1)['http']();_0xc4703e['on'](_0x07bd('0x13'),function(_0x3ca8ed){return _0x422a22(_0x3ca8ed);});_0xc4703e[_0x07bd('0x8')](0x232a,'127.0.0.1',function(){console[_0x07bd('0x84')](_0x07bd('0x85'),0x232a);return _0x3e8349(_0x07bd('0x86')+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 2a4cb40..b440a25 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 _0xda55=['name','trigger:%s','action','merge','length','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Autocreate\x20disabled','push','format'];(function(_0x4ffd43,_0x435153){var _0x168134=function(_0x5dff25){while(--_0x5dff25){_0x4ffd43['push'](_0x4ffd43['shift']());}};_0x168134(++_0x435153);}(_0xda55,0x6d));var _0x5da5=function(_0x38a36e,_0x29e3bc){_0x38a36e=_0x38a36e-0x0;var _0x363af2=_0xda55[_0x38a36e];return _0x363af2;};'use strict';var _=require(_0x5da5('0x0'));var BPromise=require(_0x5da5('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x5da5('0x2'));var logger=require(_0x5da5('0x3'))(_0x5da5('0x4'));var cmContactRpc=require(_0x5da5('0x5'));config[_0x5da5('0x6')]=_['defaults'](config[_0x5da5('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5da5('0x7'))(new Redis(config['redis']));function emit(_0x2fd877,_0x267469,_0x71b187,_0x46290d,_0x3debdf){logger[_0x5da5('0x8')](_0x5da5('0x9'),_0x2fd877,_0x267469['id'],_0x71b187,_0x46290d,JSON[_0x5da5('0xa')](_0x3debdf));io['to'](_0x71b187)['emit'](_0x46290d,_0x3debdf);}exports[_0x5da5('0xb')]=function(_0x1f98a7,_0x2731a3,_0x26fbe3,_0x1a047e){var _0x2a361c,_0x33313e;var _0x589c14={};var _0x2f4e4b=Number(_0x26fbe3[_0x5da5('0xc')]);var _0x4f813b=_0x26fbe3[_0x5da5('0xd')]?Boolean(Number(_0x26fbe3[_0x5da5('0xd')])):![];var _0x3ced00;var _0x43d526=![];if(!_[_0x5da5('0xe')](_0x26fbe3[_0x5da5('0xf')])){if(_0x26fbe3['data5']=='1')_0x43d526=!![];}if(!_0x43d526){if(_0x1a047e['xmd-contactid']){_0x589c14['id']=_0x1a047e['xmd-contactid'];}}if(!_0x589c14['id']){_0x589c14[_0x5da5('0x10')]=_0x2f4e4b;_0x3ced00=_0x26fbe3[_0x5da5('0x11')]&&_0x26fbe3[_0x5da5('0x11')]!=='0'?_0x26fbe3[_0x5da5('0x11')][_0x5da5('0x12')](','):[_0x5da5('0x13')];_0x589c14[_0x5da5('0x14')]=_['map'](_0x3ced00,function(_0x124dc5){var _0x290136={};_0x290136[_0x124dc5]=_0x1a047e[_0x5da5('0x15')]?_0x1a047e[_0x5da5('0x16')]:_0x1a047e[_0x5da5('0x17')];return _0x290136;});}var _0x428b07=['id','firstName',_0x5da5('0x18'),_0x5da5('0x13'),_0x5da5('0x19'),_0x5da5('0x1a'),_0x5da5('0x10'),'createdAt',_0x5da5('0x1b'),_0x5da5('0x1c')];var _0x42a3cb=_['union'](_0x428b07,_0x3ced00);BPromise[_0x5da5('0x1d')]()[_0x5da5('0x1e')](cmContactRpc[_0x5da5('0x1f')]({'attributes':_0x42a3cb,'where':_0x589c14}))[_0x5da5('0x1e')](function(_0xec69f2){_0x33313e=_0xec69f2;if(!_[_0x5da5('0x20')](_0x33313e)){if(_0x33313e['length']===0x1){_0x2a361c=_0x33313e[0x0];logger[_0x5da5('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1a047e[_0x5da5('0x21')],_0x2731a3['id'],_0x2a361c['id']);}else{logger[_0x5da5('0x8')](_0x5da5('0x22'),_0x1a047e['uniqueid'],_0x2731a3['id'],_[_0x5da5('0x23')](_0x33313e,'id')[_0x5da5('0x24')](','));}return;}else{logger[_0x5da5('0x8')](_0x5da5('0x25'),_0x1a047e['uniqueid'],_0x2731a3['id']);var _0x5b0b43={'ListId':_0x2f4e4b};var _0x50aadc=_0x26fbe3[_0x5da5('0x26')]&&_0x26fbe3['data4']!=='0'?_0x26fbe3['data4']:_0x5da5('0x13');if(_0x4f813b){logger[_0x5da5('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1a047e[_0x5da5('0x21')],_0x2731a3['id']);_0x5b0b43[_0x50aadc]=_[_0x5da5('0xe')](_0x1a047e['routeId'])?_0x1a047e[_0x5da5('0x17')]:_0x1a047e[_0x5da5('0x16')];if(_[_0x5da5('0xe')](_0x1a047e[_0x5da5('0x15')])){_0x5b0b43[_0x5da5('0x27')]=_0x1a047e['calleridname']&&_0x1a047e[_0x5da5('0x28')]!==_0x5da5('0x29')?_0x1a047e[_0x5da5('0x28')]:_0x5da5('0x2a');}else{_0x5b0b43['firstName']=_0x1a047e['destcalleridname']&&_0x1a047e['destcalleridname']!==_0x5da5('0x29')?_0x1a047e[_0x5da5('0x2b')]:_0x5da5('0x2a');}return BPromise[_0x5da5('0x1d')]()['then'](cmContactRpc['createContact'](_0x5b0b43))[_0x5da5('0x1e')](function(_0x4afb58){_0x2a361c=_0x4afb58;_0x33313e['push'](_0x4afb58);if(_0x2a361c){logger[_0x5da5('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1a047e[_0x5da5('0x21')],_0x2731a3['id'],_0x2a361c['id']);}return;});}else{logger[_0x5da5('0x8')](_0x5da5('0x2c'),_0x1a047e[_0x5da5('0x21')],_0x2731a3['id']);_0x5b0b43[_0x50aadc]=_[_0x5da5('0xe')](_0x1a047e[_0x5da5('0x15')])?_0x1a047e[_0x5da5('0x17')]:_0x1a047e[_0x5da5('0x16')];if(_['isNil'](_0x1a047e[_0x5da5('0x15')])){_0x5b0b43['firstName']=_0x1a047e[_0x5da5('0x28')]&&_0x1a047e[_0x5da5('0x28')]!==_0x5da5('0x29')?_0x1a047e[_0x5da5('0x28')]:_0x5da5('0x2a');}else{_0x5b0b43[_0x5da5('0x27')]=_0x1a047e[_0x5da5('0x2b')]&&_0x1a047e[_0x5da5('0x2b')]!==_0x5da5('0x29')?_0x1a047e[_0x5da5('0x2b')]:_0x5da5('0x2a');}_0x2a361c=_0x5b0b43;_0x33313e[_0x5da5('0x2d')](_0x5b0b43);return;}}})[_0x5da5('0x1e')](function(){if(_0x1f98a7){emit(_0x1a047e['uniqueid'],_0x2731a3,util[_0x5da5('0x2e')]('user:%s',_0x1f98a7[_0x5da5('0x2f')]),util[_0x5da5('0x2e')](_0x5da5('0x30'),_0x26fbe3[_0x5da5('0x31')]['toLowerCase']()),{'evt':_[_0x5da5('0x32')](_0x1a047e,{'autoCreate':_0x4f813b}),'contact':_0x2a361c===undefined?{}:_0x2a361c,'contacts':_0x33313e[_0x5da5('0x33')]===0x0?undefined:_0x33313e});}});}; \ No newline at end of file +var _0x4b84=['calleridnum','lastName','phone','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','calleridname','Unknown','firstName','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','../../../../config/environment','../../rpc/cmContact','redis','defaults','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','ListId','data3','map','routeId'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x4b84[_0x3b76f7];return _0x43984e;};'use strict';var _=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x44b8('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x44b8('0x3'));config[_0x44b8('0x4')]=_[_0x44b8('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x44b8('0x4')]));function emit(_0x54274b,_0x327f59,_0x5947f7,_0x3e87c5,_0x5a2353){logger['info'](_0x44b8('0x6'),_0x54274b,_0x327f59['id'],_0x5947f7,_0x3e87c5,JSON[_0x44b8('0x7')](_0x5a2353));io['to'](_0x5947f7)[_0x44b8('0x8')](_0x3e87c5,_0x5a2353);}exports['exec']=function(_0xc650ec,_0x2cc74b,_0x4315f6,_0x9b6048){var _0x24dd10,_0x37e471;var _0xe9a025={};var _0x4ae8a1=Number(_0x4315f6[_0x44b8('0x9')]);var _0x4301a6=_0x4315f6['data2']?Boolean(Number(_0x4315f6[_0x44b8('0xa')])):![];var _0x490bc6;var _0x833ea3=![];if(!_[_0x44b8('0xb')](_0x4315f6['data5'])){if(_0x4315f6[_0x44b8('0xc')]=='1')_0x833ea3=!![];}if(!_0x833ea3){if(_0x9b6048['xmd-contactid']){_0xe9a025['id']=_0x9b6048['xmd-contactid'];}}if(!_0xe9a025['id']){_0xe9a025[_0x44b8('0xd')]=_0x4ae8a1;_0x490bc6=_0x4315f6[_0x44b8('0xe')]&&_0x4315f6[_0x44b8('0xe')]!=='0'?_0x4315f6[_0x44b8('0xe')]['split'](','):['phone'];_0xe9a025['$or']=_[_0x44b8('0xf')](_0x490bc6,function(_0x5b7803){var _0x28ef36={};_0x28ef36[_0x5b7803]=_0x9b6048[_0x44b8('0x10')]?_0x9b6048['destcalleridnum']:_0x9b6048[_0x44b8('0x11')];return _0x28ef36;});}var _0xe3de8f=['id','firstName',_0x44b8('0x12'),_0x44b8('0x13'),'mobile',_0x44b8('0x14'),_0x44b8('0xd'),_0x44b8('0x15'),_0x44b8('0x16'),_0x44b8('0x17')];var _0x369c09=_[_0x44b8('0x18')](_0xe3de8f,_0x490bc6);BPromise[_0x44b8('0x19')]()[_0x44b8('0x1a')](cmContactRpc[_0x44b8('0x1b')]({'attributes':_0x369c09,'where':_0xe9a025}))[_0x44b8('0x1a')](function(_0x14996c){_0x37e471=_0x14996c;if(!_['isEmpty'](_0x37e471)){if(_0x37e471[_0x44b8('0x1c')]===0x1){_0x24dd10=_0x37e471[0x0];logger[_0x44b8('0x1d')](_0x44b8('0x1e'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id'],_0x24dd10['id']);}else{logger[_0x44b8('0x1d')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id'],_['map'](_0x37e471,'id')[_0x44b8('0x20')](','));}return;}else{logger[_0x44b8('0x1d')](_0x44b8('0x21'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);var _0x230a3d={'ListId':_0x4ae8a1};var _0x59acbc=_0x4315f6[_0x44b8('0x22')]&&_0x4315f6['data4']!=='0'?_0x4315f6[_0x44b8('0x22')]:_0x44b8('0x13');if(_0x4301a6){logger['info'](_0x44b8('0x23'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);_0x230a3d[_0x59acbc]=_[_0x44b8('0xb')](_0x9b6048['routeId'])?_0x9b6048[_0x44b8('0x11')]:_0x9b6048[_0x44b8('0x24')];if(_['isNil'](_0x9b6048[_0x44b8('0x10')])){_0x230a3d['firstName']=_0x9b6048[_0x44b8('0x25')]&&_0x9b6048['calleridname']!==''?_0x9b6048['calleridname']:_0x44b8('0x26');}else{_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x28')]&&_0x9b6048[_0x44b8('0x28')]!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x28')]:_0x44b8('0x26');}return BPromise[_0x44b8('0x19')]()[_0x44b8('0x1a')](cmContactRpc[_0x44b8('0x2a')](_0x230a3d))[_0x44b8('0x1a')](function(_0x417d81){_0x24dd10=_0x417d81;_0x37e471[_0x44b8('0x2b')](_0x417d81);if(_0x24dd10){logger['info'](_0x44b8('0x2c'),_0x9b6048['uniqueid'],_0x2cc74b['id'],_0x24dd10['id']);}return;});}else{logger[_0x44b8('0x1d')](_0x44b8('0x2d'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);_0x230a3d[_0x59acbc]=_[_0x44b8('0xb')](_0x9b6048[_0x44b8('0x10')])?_0x9b6048['calleridnum']:_0x9b6048[_0x44b8('0x24')];if(_[_0x44b8('0xb')](_0x9b6048[_0x44b8('0x10')])){_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x25')]&&_0x9b6048['calleridname']!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x25')]:_0x44b8('0x26');}else{_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x28')]&&_0x9b6048[_0x44b8('0x28')]!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x28')]:_0x44b8('0x26');}_0x24dd10=_0x230a3d;_0x37e471[_0x44b8('0x2b')](_0x230a3d);return;}}})[_0x44b8('0x1a')](function(){if(_0xc650ec){emit(_0x9b6048[_0x44b8('0x1f')],_0x2cc74b,util[_0x44b8('0x2e')](_0x44b8('0x2f'),_0xc650ec[_0x44b8('0x30')]),util[_0x44b8('0x2e')](_0x44b8('0x31'),_0x4315f6[_0x44b8('0x32')][_0x44b8('0x33')]()),{'evt':_[_0x44b8('0x34')](_0x9b6048,{'autoCreate':_0x4301a6}),'contact':_0x24dd10===undefined?{}:_0x24dd10,'contacts':_0x37e471[_0x44b8('0x1c')]===0x0?undefined:_0x37e471});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 617cead..63ccacc 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 _0xcf2e=['membername','lastevent','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentnosuchnumber','custom:agentbusy','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','clone','motionChannel','undefined','voice','interface','checkTriggers','hasOwnProperty','status','checkTrigger','variables','Actions','length','action','toLowerCase','contactmanager','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','data3','isNil','location','uriLocation','data4','windowWidth','data5','800','windowHeight','data6','winApplication','winArguments','user:%s','name','format','jscripty','trigger:%s','merge','integration','exec','queue','voiceExtensions','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','message','event','agent'];(function(_0x10ceab,_0x5a4a50){var _0x5d1ce7=function(_0x3ba6a2){while(--_0x3ba6a2){_0x10ceab['push'](_0x10ceab['shift']());}};_0x5d1ce7(++_0x5a4a50);}(_0xcf2e,0x197));var _0xecf2=function(_0x9d2bdc,_0x4f2b6a){_0x9d2bdc=_0x9d2bdc-0x0;var _0x410615=_0xcf2e[_0x9d2bdc];return _0x410615;};'use strict';var util=require(_0xecf2('0x0'));var _=require(_0xecf2('0x1'));var url=require(_0xecf2('0x2'));var Mustache=require(_0xecf2('0x3'));var Redis=require(_0xecf2('0x4'));var urlforward=require(_0xecf2('0x5'));var integration=require(_0xecf2('0x6'));var cmContact=require(_0xecf2('0x7'));var script=require(_0xecf2('0x8'));var config=require('../../../config/environment');var logger=require(_0xecf2('0x9'))(_0xecf2('0xa'));var ami=require(_0xecf2('0xb'));config[_0xecf2('0xc')]=_['defaults'](config[_0xecf2('0xc')],{'host':_0xecf2('0xd'),'port':0x18eb});var io=require(_0xecf2('0xe'))(new Redis(config[_0xecf2('0xc')]));var operators={'equals':function(_0x11250c,_0x351d92){return _0x11250c==_0x351d92;},'not_equals':function(_0x1f5f16,_0x451856){return _0x1f5f16!=_0x451856;}};var barAndWebActions=['popup',_0xecf2('0x2'),_0xecf2('0xf')];function Trigger(_0x31d92f){this[_0xecf2('0x10')]=_0x31d92f[_0xecf2('0x10')];this[_0xecf2('0x11')]=_0x31d92f['agents'];this[_0xecf2('0x12')]=_0x31d92f[_0xecf2('0x12')];this[_0xecf2('0x13')]=_0x31d92f[_0xecf2('0x13')];this['voiceExtensions']=_0x31d92f['voiceExtensions'];this['zendeskAccounts']=_0x31d92f[_0xecf2('0x14')];this[_0xecf2('0x15')]=_0x31d92f[_0xecf2('0x15')];this[_0xecf2('0x16')]=_0x31d92f[_0xecf2('0x16')];this[_0xecf2('0x17')]=_0x31d92f[_0xecf2('0x17')];this['zohoAccounts']=_0x31d92f[_0xecf2('0x18')];this['deskAccounts']=_0x31d92f[_0xecf2('0x19')];this[_0xecf2('0x1a')]=_0x31d92f['vtigerAccounts'];this['servicenowAccounts']=_0x31d92f['servicenowAccounts'];this['dynamics365Accounts']=_0x31d92f[_0xecf2('0x1b')];this[_0xecf2('0x1c')]=_0x31d92f[_0xecf2('0x1c')];this[_0xecf2('0x1d')]={'zendesk':this[_0xecf2('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xecf2('0x15')],'sugarcrm':this[_0xecf2('0x17')],'zoho':this[_0xecf2('0x18')],'desk':this[_0xecf2('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xecf2('0x1c')],'servicenow':this[_0xecf2('0x1e')]};ami['on'](_0xecf2('0x1f'),this[_0xecf2('0x20')]['bind'](this));ami['on'](_0xecf2('0x21'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0xecf2('0x22')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent']['bind'](this));ami['on'](_0xecf2('0x23'),this['syncCustomEvent'][_0xecf2('0x22')](this));ami['on']('custom:agentnoanswer',this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x24'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x25'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x26'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x27'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on']('custom:dialbegin',this[_0xecf2('0x28')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x29'),this[_0xecf2('0x28')]['bind'](this));ami['on']('custom:dialend',this['syncAgentDial'][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x2a'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x2b'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x2c'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x2d'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x2e'),this[_0xecf2('0x20')]['bind'](this));ami['on'](_0xecf2('0x2f'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));ami['on'](_0xecf2('0x30'),this[_0xecf2('0x20')]['bind'](this));ami['on'](_0xecf2('0x31'),this[_0xecf2('0x20')][_0xecf2('0x22')](this));}Trigger['prototype'][_0xecf2('0x32')]=function(_0x3f7454,_0x474dd4,_0x16c07d){logger[_0xecf2('0x33')](_0x3f7454,_0x474dd4,JSON[_0xecf2('0x34')](_0x16c07d));io['to'](_0x3f7454)[_0xecf2('0x32')](_0x474dd4,_0x16c07d);};Trigger[_0xecf2('0x35')][_0xecf2('0x20')]=function(_0x4aea11){var _0x328525=_[_0xecf2('0x36')](_0x4aea11);if(typeof _0x328525[_0xecf2('0x37')]===_0xecf2('0x38')){_0x328525['motionChannel']=_0xecf2('0x39');}this['checkTriggers'](_0x328525);};Trigger['prototype'][_0xecf2('0x28')]=function(_0x4d130f){if(this[_0xecf2('0x11')][_0x4d130f[_0xecf2('0x3a')]]){this[_0xecf2('0x20')](_0x4d130f);}};Trigger['prototype'][_0xecf2('0x3b')]=function(_0x52ceda){var _0x5e9d0d;for(var _0x20221c in this[_0xecf2('0x10')]){if(this[_0xecf2('0x10')][_0xecf2('0x3c')](_0x20221c)){if(this[_0xecf2('0x10')][_0x20221c][_0xecf2('0x3d')]){_0x5e9d0d=this[_0xecf2('0x3e')](this[_0xecf2('0x10')][_0x20221c],_0x52ceda);if(_0x5e9d0d){_['merge'](_0x52ceda,_0x52ceda[_0xecf2('0x3f')]);for(var _0x11cf66=0x0,_0x2cd7d4,_0x2f2d4b,_0x196981;_0x11cf660x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x245cc5,_0x202d27){_0x245cc5=_0x245cc5-0x0;var _0x325ae3=_0xe14b[_0x245cc5];return _0x325ae3;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f165882..50eca09 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 _0xb694=['enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','type','nameField','customField','idField','substring','indexOf','ticketType','incidents','assign','getString','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','%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]','recordingFormat','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','length','internalemailaddress','catch','outbound','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf'];(function(_0x418402,_0x59d1f7){var _0xda4459=function(_0x43dade){while(--_0x43dade){_0x418402['push'](_0x418402['shift']());}};_0xda4459(++_0x59d1f7);}(_0xb694,0x10e));var _0x4b69=function(_0xa32784,_0x2fc279){_0xa32784=_0xa32784-0x0;var _0x236891=_0xb694[_0xa32784];return _0x236891;};'use strict';var _=require(_0x4b69('0x0'));var rp=require(_0x4b69('0x1'));var util=require(_0x4b69('0x2'));var intUtil=require(_0x4b69('0x3'));var md5=require(_0x4b69('0x4'));var Redis=require(_0x4b69('0x5'));var logger=require(_0x4b69('0x6'))(_0x4b69('0x7'));var config=require(_0x4b69('0x8'));config[_0x4b69('0x9')]=_[_0x4b69('0xa')](config[_0x4b69('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x2536cc,_0x4cd029,_0x2db6fe){if(_0x2536cc[_0x4b69('0xb')]){_0x2536cc[_0x4b69('0xc')]=_0x2536cc[_0x4b69('0xd')][_0x4b69('0xe')];_0x2536cc[_0x4b69('0xf')]=_0x2536cc[_0x4b69('0xd')][_0x4b69('0x10')];return Promise[_0x4b69('0x11')](_0x2536cc[_0x4b69('0xd')][_0x4b69('0x12')]);}var _0x230edd={'method':_0x4b69('0x13'),'uri':_0x4cd029,'form':{'client_id':_0x2536cc['clientId'],'resource':_0x2536cc['remoteUri'],'username':_0x2536cc[_0x4b69('0x14')],'password':_0x2536cc['password'],'grant_type':_0x4b69('0x15'),'client_secret':_0x2536cc['clientSecret']},'json':!![]};return rp(_0x230edd)[_0x4b69('0x16')](function(_0x3c1f3f){return _0x3c1f3f[_0x4b69('0x17')];})['catch'](function(_0x50628b){logger[_0x4b69('0x18')]('['+[_0x2db6fe[_0x4b69('0x19')]()]+_0x4b69('0x1a'));return _0x50628b[_0x4b69('0x1b')];});}function getUser(_0x539170,_0x25c173,_0x275a26,_0x2a438d,_0x5f314a,_0x3b186b){return new Promise(function(_0x2096f7,_0x5ed03d){return getAuthToken(_0x25c173,_0x2a438d,_0x3b186b)[_0x4b69('0x16')](function(_0x17a5d1){var _0x283355={'method':_0x4b69('0x1c'),'uri':_0x5f314a+_0x4b69('0x1d'),'headers':{'Authorization':_0x4b69('0x1e')+_0x17a5d1,'OData-Version':_0x4b69('0x1f')},'json':!![]};return rp(_0x283355);})[_0x4b69('0x16')](function(_0x3f6045){var _0x4fce65=_0x3f6045['value'];var _0x316390=![];var _0x246b73=null;if(!_[_0x4b69('0x20')](_0x275a26)){if(intUtil[_0x4b69('0x21')](_0x275a26[_0x4b69('0x22')])){_0x539170[_0x4b69('0x23')]=_0x275a26[_0x4b69('0x22')];for(_0x246b73=0x0;_0x246b73<_0x4fce65['length'];_0x246b73++){if(_0x4fce65[_0x246b73]['internalemailaddress']===_0x275a26[_0x4b69('0x22')]&&!_0x4fce65[_0x246b73][_0x4b69('0x24')]){_0x316390=!![];logger['info']('['+[_0x3b186b[_0x4b69('0x19')]()]+_0x4b69('0x25')+_0x4fce65[_0x246b73][_0x4b69('0x26')]+'!');_0x539170[_0x4b69('0x27')]=_0x4fce65[_0x246b73][_0x4b69('0x26')];}}}}if(!_0x316390){logger[_0x4b69('0x28')]('['+[_0x3b186b['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x539170['userEmail']=_0x25c173['username'];for(_0x246b73=0x0;_0x246b73<_0x4fce65[_0x4b69('0x29')];_0x246b73++){if(_0x4fce65[_0x246b73][_0x4b69('0x2a')]===_0x25c173[_0x4b69('0x14')]){_0x539170[_0x4b69('0x27')]=_0x4fce65[_0x246b73][_0x4b69('0x26')];}}}_0x2096f7(_0x539170);})[_0x4b69('0x2b')](function(_0x5d467c){_0x5ed03d(_0x5d467c['message']);});});}function createEndUser(_0x166781,_0x341870,_0x229885,_0x5cf026,_0x4b7e63,_0x6a63e0){return new Promise(function(_0x57c8b4,_0x4e324e){return getAuthToken(_0x341870,_0x229885,_0x6a63e0)['then'](function(_0x550c2b){var _0x556b14=_0x6a63e0['toLowerCase']()===_0x4b69('0x2c')?_0x4b7e63['destcalleridnum']:_0x4b7e63[_0x4b69('0x2d')];var _0x147828={'method':_0x4b69('0x13'),'uri':_0x5cf026+_0x4b69('0x2e'),'body':{'telephone1':_0x556b14,'fullname':_0x556b14,'firstname':_0x556b14,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4b69('0x2f')+_0x166781[_0x4b69('0x27')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x550c2b,'OData-Version':_0x4b69('0x1f')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x147828);})[_0x4b69('0x16')](function(_0x52e575){var _0xd62de5=_0x52e575[_0x4b69('0x30')][_0x4b69('0x31')];var _0x5d0288=_0xd62de5['substring'](_0xd62de5[_0x4b69('0x32')]('(')+0x1,_0xd62de5['lastIndexOf'](')'));_0x166781[_0x4b69('0x33')]=_0x5d0288;_0x57c8b4(_0x166781);})['catch'](function(_0x182c39){_0x4e324e(_0x182c39['message']);});});}function getEndUser(_0x40abd8,_0x3b487c,_0x3279c6,_0x420cd3,_0x588780,_0x5371e2,_0x3e7c56){var _0x4b989d=_0x5371e2[_0x4b69('0x34')]()===_0x4b69('0x2c')?_0x588780['destcalleridnum']:_0x588780[_0x4b69('0x2d')];return getAuthToken(_0x3b487c,_0x3279c6,_0x5371e2)['then'](function(_0x2b7eef){var _0x1b1f74={'method':_0x4b69('0x1c'),'uri':_0x420cd3+_0x4b69('0x35')+_0x4b989d[_0x4b69('0x36')]('+',_0x4b69('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x2b7eef,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b1f74);})['then'](function(_0x457ec5){var _0x1f4c62=![];if(!_0x457ec5)return _0x1f4c62;var _0x59fcb4=_0x457ec5[_0x4b69('0x38')];for(var _0x1da9d0=0x0;_0x1da9d0<_0x59fcb4[_0x4b69('0x29')];_0x1da9d0++){if(_0x59fcb4[_0x1da9d0][_0x4b69('0x39')]===_0x4b989d){_0x1f4c62=!![];_0x40abd8['enduserId']=_0x59fcb4[_0x1da9d0][_0x4b69('0x3a')];}}return _0x1f4c62;})[_0x4b69('0x16')](function(_0x46cb92){if(_0x46cb92)return _0x40abd8;if(_0x3e7c56===_0x4b69('0x3b')){logger[_0x4b69('0x28')]('['+[_0x5371e2[_0x4b69('0x19')]()]+_0x4b69('0x3c'));return _0x40abd8;}return createEndUser(_0x40abd8,_0x3b487c,_0x3279c6,_0x420cd3,_0x588780,_0x5371e2)['then'](function(_0x58ea55){logger[_0x4b69('0x28')]('['+[_0x5371e2[_0x4b69('0x19')]()]+_0x4b69('0x3d'),_0x58ea55['enduserId']);return _0x58ea55;});});}function getCustomFields(_0x271adb,_0x4f4bb3,_0x201527){var _0x286f39={};if(_0x271adb[_0x4b69('0x29')]>0x0){_['forEach'](_0x271adb,function(_0x48f8a7){if(_[_0x4b69('0x3e')]([_0x4b69('0x3f'),_0x4b69('0x40')],_0x48f8a7[_0x4b69('0x41')])&&_0x48f8a7[_0x4b69('0x42')]&&!_0x48f8a7[_0x4b69('0x43')]){var _0x2a115c=_0x48f8a7[_0x4b69('0x44')][_0x4b69('0x34')]();var _0x2fd8c8=_0x2a115c[_0x4b69('0x45')](0x0,_0x2a115c['indexOf']('_'));var _0x79b322=_0x2a115c[_0x4b69('0x45')](_0x2a115c[_0x4b69('0x46')]('_')+0x1);if(_0x2fd8c8===_0x201527){_0x286f39[_0x79b322]=_0x48f8a7['content'];}}});}return _0x286f39;}function getTicket(_0x489fd4,_0x4a3f60,_0x49051c,_0x487681,_0x330576,_0x35d068,_0x832e2a){return new Promise(function(_0x2c6541,_0x2be865){var _0x186ee8;return getAuthToken(_0x4a3f60,_0x49051c,_0x832e2a)[_0x4b69('0x16')](function(_0x57f3d6){if(_0x35d068[_0x4b69('0x47')]==='incident'){_0x186ee8={'method':_0x4b69('0x13'),'uri':_0x487681+_0x4b69('0x48'),'body':Object[_0x4b69('0x49')]({},{'title':intUtil['getString'](_0x35d068['Subjects'],_0x330576,'\x20'),'description':intUtil[_0x4b69('0x4a')](_0x35d068[_0x4b69('0x4b')],_0x330576,'\x0a'),'customerid_contact@odata.bind':_0x489fd4['enduserId']?'/contacts('+_0x489fd4['enduserId']+')':undefined,'ownerid@odata.bind':_0x4b69('0x2f')+_0x489fd4['userId']+')','caseorigincode':'1'},getCustomFields(_0x35d068[_0x4b69('0x4c')],_0x330576,_0x35d068[_0x4b69('0x47')])),'headers':{'Authorization':_0x4b69('0x1e')+_0x57f3d6,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x35d068[_0x4b69('0x47')]===_0x4b69('0x4d')){var _0x481fa7=_0x489fd4[_0x4b69('0x33')]?[{'partyid_systemuser@odata.bind':_0x4b69('0x2f')+_0x489fd4[_0x4b69('0x27')]+')','participationtypemask':_0x489fd4[_0x4b69('0x4e')]===_0x4b69('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x4b69('0x50')+_0x489fd4['enduserId']+')','participationtypemask':_0x489fd4[_0x4b69('0x4e')]===_0x4b69('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4b69('0x2f')+_0x489fd4[_0x4b69('0x27')]+')','participationtypemask':_0x489fd4[_0x4b69('0x4e')]===_0x4b69('0x4f')?0x2:0x1}];_0x186ee8={'method':_0x4b69('0x13'),'uri':_0x487681+'phonecalls','body':Object[_0x4b69('0x49')]({},{'subject':intUtil[_0x4b69('0x4a')](_0x35d068['Subjects'],_0x330576,'\x20'),'phonenumber':String(_0x330576['calleridnum']),'description':intUtil[_0x4b69('0x4a')](_0x35d068[_0x4b69('0x4b')],_0x330576,'\x0a'),'regardingobjectid_contact@odata.bind':_0x489fd4[_0x4b69('0x33')]?_0x4b69('0x50')+_0x489fd4[_0x4b69('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x489fd4['userId']+')','directioncode':_0x489fd4['callDirection']===_0x4b69('0x4f')?![]:!![],'phonecall_activity_parties':_0x481fa7},getCustomFields(_0x35d068[_0x4b69('0x4c')],_0x330576,_0x35d068[_0x4b69('0x47')])),'headers':{'Authorization':_0x4b69('0x1e')+_0x57f3d6,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x186ee8);})['then'](function(_0x48fc36){var _0x1972e6=_0x48fc36['headers']['odata-entityid'];var _0x2d09f8=_0x1972e6[_0x4b69('0x45')](_0x1972e6[_0x4b69('0x32')]('(')+0x1,_0x1972e6['lastIndexOf'](')'));_0x489fd4['ticketId']=_0x2d09f8;_0x2c6541(_0x489fd4);})[_0x4b69('0x2b')](function(_0x31df52){_0x2be865(_0x31df52[_0x4b69('0x1b')]);});});}function emit(_0x39fbc3,_0x3ff8f3,_0x31ee1a,_0x3ddc44){var _0x47dc80={'uri':util[_0x4b69('0x51')](_0x4b69('0x52'),_0x39fbc3,_0x31ee1a,_0x3ddc44)};io['to'](util['format'](_0x4b69('0x53'),_0x3ff8f3))[_0x4b69('0x54')]('trigger:browser:url',_0x47dc80);}exports['cs']=function(_0x260cce,_0x447bba,_0x2124ec,_0x4d0b0d,_0x5f212f,_0x3b0a3a,_0x4a1883,_0x30bc99){var _0x467bc0={};_0x3b0a3a[_0x4b69('0xc')]=_0x3b0a3a[_0x4b69('0xb')]?intUtil['stripTrailingSlash'](_0x3b0a3a[_0x4b69('0xd')]['data7']):intUtil[_0x4b69('0x55')](_0x3b0a3a['remoteUri']);_0x3b0a3a[_0x4b69('0x56')]=intUtil['stripTrailingSlash'](_0x3b0a3a[_0x4b69('0x56')]);_0x467bc0[_0x4b69('0x4e')]=_0x30bc99===_0x4b69('0x4f')||_0x30bc99==='unmanaged'?_0x4b69('0x4f'):'outbound';var _0x4eb6a4=_0x3b0a3a[_0x4b69('0xb')]?util['format'](_0x4b69('0x57'),_0x3b0a3a[_0x4b69('0xd')]['data7']):util[_0x4b69('0x51')]('%s/api/data/v9.0/',_0x3b0a3a[_0x4b69('0xc')]);var _0xa23cef=util[_0x4b69('0x51')](_0x4b69('0x58'),_0x3b0a3a['tenantId']);var _0x57934c=util[_0x4b69('0x51')](_0x4b69('0x59'),_0x3b0a3a['serverUrl'],_0x447bba[_0x4b69('0x5a')],md5(_0x447bba[_0x4b69('0x5a')]));if(_0x5f212f&&_0x5f212f[_0x4b69('0x5b')]){logger[_0x4b69('0x28')](_0x4b69('0x5c'),'Recording\x20is\x20enabled!');_0x447bba['recordingURL']=_0x57934c;}else if(_0x4a1883&&_0x4a1883[_0x4b69('0x5d')]&&_0x4a1883[_0x4b69('0x5d')]!=='none'){logger[_0x4b69('0x28')]('[OUTBOUND]',_0x4b69('0x5e'));_0x447bba['recordingURL']=_0x57934c;}else{_0x447bba[_0x4b69('0x5f')]='';}return getUser(_0x467bc0,_0x3b0a3a,_0x4d0b0d,_0xa23cef,_0x4eb6a4,_0x30bc99)['then'](function(_0xa902d3){logger['info']('['+_0x30bc99[_0x4b69('0x19')]()+_0x4b69('0x60'),_0xa902d3[_0x4b69('0x27')]);logger[_0x4b69('0x28')]('['+_0x30bc99['toUpperCase']()+_0x4b69('0x61'),_0xa902d3[_0x4b69('0x23')]);return getEndUser(_0xa902d3,_0x3b0a3a,_0xa23cef,_0x4eb6a4,_0x447bba,_0x30bc99,_0x2124ec['moduleCreate']);})[_0x4b69('0x16')](function(_0x347575){logger['info']('['+_0x30bc99[_0x4b69('0x19')]()+_0x4b69('0x62'),_0x347575[_0x4b69('0x33')]);logger['info']('['+_0x30bc99[_0x4b69('0x19')]()+_0x4b69('0x63'),_0x447bba[_0x4b69('0x2d')]);return getTicket(_0x347575,_0x3b0a3a,_0xa23cef,_0x4eb6a4,_0x447bba,_0x2124ec,_0x30bc99);})['then'](function(_0x247331){logger[_0x4b69('0x28')](util[_0x4b69('0x51')]('['+_0x30bc99[_0x4b69('0x19')]()+_0x4b69('0x64'),_0x2124ec['ticketType'],_0x247331['ticketId']));logger[_0x4b69('0x28')](util[_0x4b69('0x51')]('['+_0x30bc99[_0x4b69('0x19')]()+_0x4b69('0x65'),_0x30bc99));if(_0x30bc99!==_0x4b69('0x66')){logger[_0x4b69('0x28')]('['+_0x30bc99[_0x4b69('0x19')]()+']',_0x4b69('0x67'));emit(_0x3b0a3a[_0x4b69('0xc')],_0x4d0b0d[_0x4b69('0x68')],_0x2124ec['ticketType'],_0x247331[_0x4b69('0x69')]);}})[_0x4b69('0x2b')](function(_0xff7168){logger[_0x4b69('0x18')]('['+_0x30bc99[_0x4b69('0x19')]()+_0x4b69('0x6a'),_0xff7168[_0x4b69('0x1b')]);});}; \ No newline at end of file +var _0x42ef=['then','access_token','catch',']\x20Wrong\x20credentials!','message','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','headers','substring','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','enduserId','nothing','info','forEach','includes','type','nameField','customField','idField','indexOf','content','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','ticketType','callDirection','queue','phonecalls','odata-entityid','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5','clientId','username','password','clientSecret'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0x42ef,0x18e));var _0xf42e=function(_0x464fa8,_0x44865c){_0x464fa8=_0x464fa8-0x0;var _0x53fc6a=_0x42ef[_0x464fa8];return _0x53fc6a;};'use strict';var _=require(_0xf42e('0x0'));var rp=require(_0xf42e('0x1'));var util=require(_0xf42e('0x2'));var intUtil=require('./util');var md5=require(_0xf42e('0x3'));var Redis=require(_0xf42e('0x4'));var logger=require('../../../../config/logger')(_0xf42e('0x5'));var config=require(_0xf42e('0x6'));config['redis']=_['defaults'](config[_0xf42e('0x7')],{'host':_0xf42e('0x8'),'port':0x18eb});var io=require(_0xf42e('0x9'))(new Redis(config[_0xf42e('0x7')]));function getAuthToken(_0x5ab6ef,_0x5aece8,_0x1c0e7b){if(_0x5ab6ef[_0xf42e('0xa')]){_0x5ab6ef[_0xf42e('0xb')]=_0x5ab6ef['CloudProvider'][_0xf42e('0xc')];_0x5ab6ef[_0xf42e('0xd')]=_0x5ab6ef[_0xf42e('0xe')][_0xf42e('0xf')];return Promise[_0xf42e('0x10')](_0x5ab6ef[_0xf42e('0xe')][_0xf42e('0x11')]);}var _0x315bca={'method':'POST','uri':_0x5aece8,'form':{'client_id':_0x5ab6ef[_0xf42e('0x12')],'resource':_0x5ab6ef[_0xf42e('0xb')],'username':_0x5ab6ef[_0xf42e('0x13')],'password':_0x5ab6ef[_0xf42e('0x14')],'grant_type':_0xf42e('0x14'),'client_secret':_0x5ab6ef[_0xf42e('0x15')]},'json':!![]};return rp(_0x315bca)[_0xf42e('0x16')](function(_0x41adf0){return _0x41adf0[_0xf42e('0x17')];})[_0xf42e('0x18')](function(_0x1cc32a){logger['error']('['+[_0x1c0e7b['toUpperCase']()]+_0xf42e('0x19'));return _0x1cc32a[_0xf42e('0x1a')];});}function getUser(_0x4dd3f4,_0x15de61,_0x3879fb,_0x49b251,_0x250338,_0x346dad){return new Promise(function(_0x178167,_0x41e227){return getAuthToken(_0x15de61,_0x49b251,_0x346dad)[_0xf42e('0x16')](function(_0x3bc3a1){var _0x32a43e={'method':'GET','uri':_0x250338+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xf42e('0x1b')+_0x3bc3a1,'OData-Version':_0xf42e('0x1c')},'json':!![]};return rp(_0x32a43e);})['then'](function(_0x3ba061){var _0x45b18b=_0x3ba061[_0xf42e('0x1d')];var _0x72c8ed=![];var _0x3602c9=null;if(!_[_0xf42e('0x1e')](_0x3879fb)){if(intUtil[_0xf42e('0x1f')](_0x3879fb[_0xf42e('0x20')])){_0x4dd3f4[_0xf42e('0x21')]=_0x3879fb[_0xf42e('0x20')];for(_0x3602c9=0x0;_0x3602c9<_0x45b18b[_0xf42e('0x22')];_0x3602c9++){if(_0x45b18b[_0x3602c9][_0xf42e('0x23')]===_0x3879fb['email']&&!_0x45b18b[_0x3602c9][_0xf42e('0x24')]){_0x72c8ed=!![];logger['info']('['+[_0x346dad['toUpperCase']()]+_0xf42e('0x25')+_0x45b18b[_0x3602c9]['systemuserid']+'!');_0x4dd3f4['userId']=_0x45b18b[_0x3602c9][_0xf42e('0x26')];}}}}if(!_0x72c8ed){logger['info']('['+[_0x346dad[_0xf42e('0x27')]()]+_0xf42e('0x28'));_0x4dd3f4[_0xf42e('0x21')]=_0x15de61['username'];for(_0x3602c9=0x0;_0x3602c9<_0x45b18b['length'];_0x3602c9++){if(_0x45b18b[_0x3602c9]['internalemailaddress']===_0x15de61[_0xf42e('0x13')]){_0x4dd3f4[_0xf42e('0x29')]=_0x45b18b[_0x3602c9]['systemuserid'];}}}_0x178167(_0x4dd3f4);})[_0xf42e('0x18')](function(_0x3c2d3d){_0x41e227(_0x3c2d3d[_0xf42e('0x1a')]);});});}function createEndUser(_0x1392ce,_0x2e1358,_0x487c2d,_0xf47000,_0x47ebe3,_0x3d84ec){return new Promise(function(_0x356bf6,_0x2850b8){return getAuthToken(_0x2e1358,_0x487c2d,_0x3d84ec)[_0xf42e('0x16')](function(_0x414464){var _0x27696e=_0x3d84ec[_0xf42e('0x2a')]()===_0xf42e('0x2b')?_0x47ebe3[_0xf42e('0x2c')]:_0x47ebe3[_0xf42e('0x2d')];var _0x54e5bd={'method':_0xf42e('0x2e'),'uri':_0xf47000+_0xf42e('0x2f'),'body':{'telephone1':_0x27696e,'fullname':_0x27696e,'firstname':_0x27696e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x1392ce[_0xf42e('0x29')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x414464,'OData-Version':_0xf42e('0x1c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x54e5bd);})[_0xf42e('0x16')](function(_0x51a98c){var _0x1ea48f=_0x51a98c[_0xf42e('0x30')]['odata-entityid'];var _0x262e77=_0x1ea48f[_0xf42e('0x31')](_0x1ea48f['lastIndexOf']('(')+0x1,_0x1ea48f['lastIndexOf'](')'));_0x1392ce['enduserId']=_0x262e77;_0x356bf6(_0x1392ce);})[_0xf42e('0x18')](function(_0x502579){_0x2850b8(_0x502579[_0xf42e('0x1a')]);});});}function getEndUser(_0x302018,_0x34bcff,_0x221abb,_0x46ef7e,_0x4ca1fb,_0x26bea2,_0x4d9345){var _0x222f2e=_0x26bea2[_0xf42e('0x2a')]()===_0xf42e('0x2b')?_0x4ca1fb[_0xf42e('0x2c')]:_0x4ca1fb['calleridnum'];return getAuthToken(_0x34bcff,_0x221abb,_0x26bea2)[_0xf42e('0x16')](function(_0x30e073){var _0x398101={'method':_0xf42e('0x32'),'uri':_0x46ef7e+_0xf42e('0x33')+_0x222f2e[_0xf42e('0x34')]('+',_0xf42e('0x35'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x30e073,'If-None-Match':null,'OData-Version':_0xf42e('0x1c')},'json':!![]};return rp(_0x398101);})[_0xf42e('0x16')](function(_0x4e7c47){var _0x35fe88=![];if(!_0x4e7c47)return _0x35fe88;var _0x2d4e3a=_0x4e7c47['value'];for(var _0x162707=0x0;_0x162707<_0x2d4e3a[_0xf42e('0x22')];_0x162707++){if(_0x2d4e3a[_0x162707][_0xf42e('0x36')]===_0x222f2e){_0x35fe88=!![];_0x302018[_0xf42e('0x37')]=_0x2d4e3a[_0x162707]['contactid'];}}return _0x35fe88;})[_0xf42e('0x16')](function(_0x1e5d62){if(_0x1e5d62)return _0x302018;if(_0x4d9345===_0xf42e('0x38')){logger[_0xf42e('0x39')]('['+[_0x26bea2[_0xf42e('0x27')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x302018;}return createEndUser(_0x302018,_0x34bcff,_0x221abb,_0x46ef7e,_0x4ca1fb,_0x26bea2)[_0xf42e('0x16')](function(_0x2ab0c2){logger['info']('['+[_0x26bea2[_0xf42e('0x27')]()]+']\x20Enduser\x20created!',_0x2ab0c2['enduserId']);return _0x2ab0c2;});});}function getCustomFields(_0x1013f3,_0x48d37c,_0x1b79d2){var _0x4e1656={};if(_0x1013f3[_0xf42e('0x22')]>0x0){_[_0xf42e('0x3a')](_0x1013f3,function(_0x2078b2){if(_[_0xf42e('0x3b')](['string','picklist'],_0x2078b2[_0xf42e('0x3c')])&&_0x2078b2[_0xf42e('0x3d')]&&!_0x2078b2[_0xf42e('0x3e')]){var _0x4e43af=_0x2078b2[_0xf42e('0x3f')][_0xf42e('0x2a')]();var _0x5f0b32=_0x4e43af[_0xf42e('0x31')](0x0,_0x4e43af['indexOf']('_'));var _0x479fc1=_0x4e43af[_0xf42e('0x31')](_0x4e43af[_0xf42e('0x40')]('_')+0x1);if(_0x5f0b32===_0x1b79d2){_0x4e1656[_0x479fc1]=_0x2078b2[_0xf42e('0x41')];}}});}return _0x4e1656;}function getTicket(_0x492d4d,_0x55b905,_0x4e6dec,_0x3bee37,_0x4a3d22,_0x421575,_0x185972){return new Promise(function(_0x3d5109,_0x46c3a3){var _0x37e925;return getAuthToken(_0x55b905,_0x4e6dec,_0x185972)[_0xf42e('0x16')](function(_0x401cce){if(_0x421575['ticketType']==='incident'){_0x37e925={'method':_0xf42e('0x2e'),'uri':_0x3bee37+'incidents','body':Object[_0xf42e('0x42')]({},{'title':intUtil[_0xf42e('0x43')](_0x421575[_0xf42e('0x44')],_0x4a3d22,'\x20'),'description':intUtil[_0xf42e('0x43')](_0x421575[_0xf42e('0x45')],_0x4a3d22,'\x0a'),'customerid_contact@odata.bind':_0x492d4d['enduserId']?_0xf42e('0x46')+_0x492d4d[_0xf42e('0x37')]+')':undefined,'ownerid@odata.bind':_0xf42e('0x47')+_0x492d4d['userId']+')','caseorigincode':'1'},getCustomFields(_0x421575[_0xf42e('0x48')],_0x4a3d22,_0x421575[_0xf42e('0x49')])),'headers':{'Authorization':_0xf42e('0x1b')+_0x401cce,'OData-Version':_0xf42e('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x421575[_0xf42e('0x49')]==='phonecall'){var _0x2dacc1=_0x492d4d[_0xf42e('0x37')]?[{'partyid_systemuser@odata.bind':_0xf42e('0x47')+_0x492d4d[_0xf42e('0x29')]+')','participationtypemask':_0x492d4d[_0xf42e('0x4a')]===_0xf42e('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x492d4d[_0xf42e('0x37')]+')','participationtypemask':_0x492d4d['callDirection']===_0xf42e('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf42e('0x47')+_0x492d4d['userId']+')','participationtypemask':_0x492d4d[_0xf42e('0x4a')]==='queue'?0x2:0x1}];_0x37e925={'method':'POST','uri':_0x3bee37+_0xf42e('0x4c'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x421575['Subjects'],_0x4a3d22,'\x20'),'phonenumber':String(_0x4a3d22[_0xf42e('0x2d')]),'description':intUtil[_0xf42e('0x43')](_0x421575[_0xf42e('0x45')],_0x4a3d22,'\x0a'),'regardingobjectid_contact@odata.bind':_0x492d4d[_0xf42e('0x37')]?_0xf42e('0x46')+_0x492d4d[_0xf42e('0x37')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x492d4d[_0xf42e('0x29')]+')','directioncode':_0x492d4d['callDirection']===_0xf42e('0x4b')?![]:!![],'phonecall_activity_parties':_0x2dacc1},getCustomFields(_0x421575[_0xf42e('0x48')],_0x4a3d22,_0x421575[_0xf42e('0x49')])),'headers':{'Authorization':_0xf42e('0x1b')+_0x401cce,'OData-Version':_0xf42e('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x37e925);})[_0xf42e('0x16')](function(_0x5bbaba){var _0x4b2faf=_0x5bbaba[_0xf42e('0x30')][_0xf42e('0x4d')];var _0x16db8a=_0x4b2faf[_0xf42e('0x31')](_0x4b2faf[_0xf42e('0x4e')]('(')+0x1,_0x4b2faf[_0xf42e('0x4e')](')'));_0x492d4d[_0xf42e('0x4f')]=_0x16db8a;_0x3d5109(_0x492d4d);})['catch'](function(_0xccdf4){_0x46c3a3(_0xccdf4[_0xf42e('0x1a')]);});});}function emit(_0x4fdac4,_0x7c68f2,_0x29c3e0,_0x1be6f7){var _0xc26d88={'uri':util[_0xf42e('0x50')](_0xf42e('0x51'),_0x4fdac4,_0x29c3e0,_0x1be6f7)};io['to'](util[_0xf42e('0x50')](_0xf42e('0x52'),_0x7c68f2))[_0xf42e('0x53')](_0xf42e('0x54'),_0xc26d88);}exports['cs']=function(_0x40d620,_0x33de1b,_0x478d02,_0x2a63dd,_0x27f003,_0x258e06,_0x1de125,_0x51ff17){var _0x43554e={};_0x258e06[_0xf42e('0xb')]=_0x258e06[_0xf42e('0xa')]?intUtil[_0xf42e('0x55')](_0x258e06[_0xf42e('0xe')][_0xf42e('0xc')]):intUtil['stripTrailingSlash'](_0x258e06[_0xf42e('0xb')]);_0x258e06[_0xf42e('0x56')]=intUtil['stripTrailingSlash'](_0x258e06[_0xf42e('0x56')]);_0x43554e['callDirection']=_0x51ff17==='queue'||_0x51ff17===_0xf42e('0x57')?_0xf42e('0x4b'):_0xf42e('0x2b');var _0x416e83=_0x258e06[_0xf42e('0xa')]?util[_0xf42e('0x50')](_0xf42e('0x58'),_0x258e06[_0xf42e('0xe')][_0xf42e('0xc')]):util[_0xf42e('0x50')]('%s/api/data/v9.0/',_0x258e06[_0xf42e('0xb')]);var _0x28c5c7=util[_0xf42e('0x50')](_0xf42e('0x59'),_0x258e06['tenantId']);var _0x207830=util[_0xf42e('0x50')](_0xf42e('0x5a'),_0x258e06['serverUrl'],_0x33de1b['uniqueid'],md5(_0x33de1b[_0xf42e('0x5b')]));if(_0x27f003&&_0x27f003['monitor_format']){logger['info'](_0xf42e('0x5c'),_0xf42e('0x5d'));_0x33de1b[_0xf42e('0x5e')]=_0x207830;}else if(_0x1de125&&_0x1de125['recordingFormat']&&_0x1de125[_0xf42e('0x5f')]!=='none'){logger[_0xf42e('0x39')](_0xf42e('0x60'),'Recording\x20is\x20enabled!');_0x33de1b[_0xf42e('0x5e')]=_0x207830;}else{_0x33de1b[_0xf42e('0x5e')]='';}return getUser(_0x43554e,_0x258e06,_0x2a63dd,_0x28c5c7,_0x416e83,_0x51ff17)[_0xf42e('0x16')](function(_0x5cbf9c){logger['info']('['+_0x51ff17[_0xf42e('0x27')]()+_0xf42e('0x61'),_0x5cbf9c[_0xf42e('0x29')]);logger[_0xf42e('0x39')]('['+_0x51ff17[_0xf42e('0x27')]()+']\x20The\x20User\x20email\x20is:',_0x5cbf9c[_0xf42e('0x21')]);return getEndUser(_0x5cbf9c,_0x258e06,_0x28c5c7,_0x416e83,_0x33de1b,_0x51ff17,_0x478d02[_0xf42e('0x62')]);})[_0xf42e('0x16')](function(_0x3e13a6){logger[_0xf42e('0x39')]('['+_0x51ff17[_0xf42e('0x27')]()+_0xf42e('0x63'),_0x3e13a6[_0xf42e('0x37')]);logger[_0xf42e('0x39')]('['+_0x51ff17[_0xf42e('0x27')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x33de1b['calleridnum']);return getTicket(_0x3e13a6,_0x258e06,_0x28c5c7,_0x416e83,_0x33de1b,_0x478d02,_0x51ff17);})[_0xf42e('0x16')](function(_0x22229e){logger[_0xf42e('0x39')](util[_0xf42e('0x50')]('['+_0x51ff17[_0xf42e('0x27')]()+_0xf42e('0x64'),_0x478d02[_0xf42e('0x49')],_0x22229e[_0xf42e('0x4f')]));logger['info'](util[_0xf42e('0x50')]('['+_0x51ff17['toUpperCase']()+_0xf42e('0x65'),_0x51ff17));if(_0x51ff17!==_0xf42e('0x57')){logger[_0xf42e('0x39')]('['+_0x51ff17['toUpperCase']()+']',_0xf42e('0x66'));emit(_0x258e06[_0xf42e('0xb')],_0x2a63dd['name'],_0x478d02[_0xf42e('0x49')],_0x22229e[_0xf42e('0x4f')]);}})['catch'](function(_0x25572e){logger[_0xf42e('0x67')]('['+_0x51ff17[_0xf42e('0x27')]()+_0xf42e('0x68'),_0x25572e['message']);});}; \ 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 55a6099..5a49aa5 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 _0x073a=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','%s/helpdesk/tickets/%d','catch','error','unmanaged','lastevent','toUpperCase','request-promise','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','type','nameField','customField','content','picklist','idField','push','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:'];(function(_0x4f6dfa,_0x1b5ec2){var _0x5c7759=function(_0x32b58a){while(--_0x32b58a){_0x4f6dfa['push'](_0x4f6dfa['shift']());}};_0x5c7759(++_0x1b5ec2);}(_0x073a,0x1db));var _0xa073=function(_0x4937f7,_0x5062df){_0x4937f7=_0x4937f7-0x0;var _0x20f75f=_0x073a[_0x4937f7];return _0x20f75f;};'use strict';var _=require('lodash');var rp=require(_0xa073('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xa073('0x1'));var intUtil=require('./util');var config=require(_0xa073('0x2'));var logger=require('../../../../config/logger')(_0xa073('0x3'));config[_0xa073('0x4')]=_[_0xa073('0x5')](config[_0xa073('0x4')],{'host':_0xa073('0x6'),'port':0x18eb});var io=require(_0xa073('0x7'))(new Redis(config[_0xa073('0x4')]));var headers={'Content-Type':'application/json','Accept':_0xa073('0x8')};function emit(_0x4cac29,_0x1b9992,_0x5f3f4c){io['to'](_0x4cac29)[_0xa073('0x9')](_0x1b9992,_0x5f3f4c);}function getTicket(_0x2fc6fc,_0x27536c,_0x3fa722,_0x53501b,_0x11c541){logger[_0xa073('0xa')](_0xa073('0xb'));var _0x5ae6ef=_[_0xa073('0xc')]({'responder_id':_0x27536c['id'],'requester_id':_0x3fa722['id'],'name':util[_0xa073('0xd')]('Caller\x20-\x20%s',_0x11c541['calleridname']),'phone':_0x11c541[_0xa073('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xa073('0xf')](_0x53501b[_0xa073('0x10')],_0x11c541,'\x20'),'description':intUtil['getString'](_0x53501b['Descriptions'],_0x11c541,_0xa073('0x11')),'tags':getTags(_0x53501b[_0xa073('0x12')],_0xa073('0x13'))},getCustomFields(_0x53501b[_0xa073('0x14')],_0x11c541));_0x5ae6ef[_0xa073('0x15')]=_['mapValues'](_[_0xa073('0x16')](_0x5ae6ef['custom_fields'],'id'),_0xa073('0x17'));return request({'uri':util[_0xa073('0xd')](_0xa073('0x18'),_0x2fc6fc[_0xa073('0x19')]),'method':_0xa073('0x1a'),'body':_0x5ae6ef})['then'](function(_0x326f8b){logger[_0xa073('0xa')](_0xa073('0x1b'));return _0x326f8b;});}function getUser(_0x32c79b,_0x96913d){if(intUtil[_0xa073('0x1c')](_0x96913d)){return request({'uri':util[_0xa073('0xd')]('%s/api/v2/agents',_0x32c79b['remoteUri']),'qs':{'email':_0x96913d}})['then'](function(_0x366d52){if(_0x366d52['length']){logger[_0xa073('0xa')](_0xa073('0x1d'));return _[_0xa073('0x1e')](_0x366d52,function(_0x5c455c){return _0x5c455c[_0xa073('0x1f')][_0xa073('0x20')]===_0x96913d;});}else{logger['info'](_0xa073('0x21'));return request({'uri':util[_0xa073('0xd')]('%s/api/v2/agents/me',_0x32c79b[_0xa073('0x19')])})[_0xa073('0x22')](function(_0x8c75ba){logger[_0xa073('0xa')](_0xa073('0x23'));return _0x8c75ba;});}});}else{logger[_0xa073('0xa')](_0xa073('0x24'));return request({'uri':util[_0xa073('0xd')](_0xa073('0x25'),_0x32c79b['remoteUri'])})['then'](function(_0x2a1f29){logger['info']('Admin\x20account\x20selected.');return _0x2a1f29;});}}function getEndUser(_0x21adfb,_0x1ad873,_0x2f1a6e){logger[_0xa073('0xa')](_0xa073('0x26'),_0x2f1a6e);return request({'uri':util[_0xa073('0xd')](_0xa073('0x27'),_0x21adfb[_0xa073('0x19')]),'qs':{'phone':_0x2f1a6e}})[_0xa073('0x22')](function(_0xe85a3a){if(_0xe85a3a[_0xa073('0x28')]){logger['info']('Enduser\x20found!');return _[_0xa073('0x1e')](_0xe85a3a,{'phone':_0x2f1a6e});}else{logger[_0xa073('0xa')](_0xa073('0x29'));return request({'uri':util[_0xa073('0xd')](_0xa073('0x27'),_0x21adfb['remoteUri']),'method':_0xa073('0x1a'),'body':{'name':_0x1ad873,'phone':_0x2f1a6e}})[_0xa073('0x22')](function(_0x1241a2){logger[_0xa073('0xa')](_0xa073('0x2a'));return _0x1241a2;});}});}function getAuth(_0x5a9a0f){return util[_0xa073('0xd')](_0xa073('0x2b'),new Buffer(_0x5a9a0f[_0xa073('0x2c')]+':X')[_0xa073('0x2d')](_0xa073('0x2e')));}function request(_0x570d3d){logger[_0xa073('0x2f')](_0xa073('0x30'),JSON[_0xa073('0x31')](_0x570d3d));return rp(_[_0xa073('0x5')](_0x570d3d,{'method':_0xa073('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x5905cd,_0x1ba1a8){var _0x55a064=[];if(_0x5905cd&&_0x5905cd[_0xa073('0x28')]>0x0){_0x55a064=_[_0xa073('0x33')](_0x5905cd,_0x1ba1a8);}return _0x55a064;}function getCustomFields(_0x4e1c1f,_0x59ce48){var _0x32caf5=[];var _0x2e8331={'custom_fields':[]};if(_0x4e1c1f[_0xa073('0x28')]>0x0){_['forEach'](_0x4e1c1f,function(_0x163374){if(_[_0xa073('0x34')]([_0xa073('0x35'),'picklist'],_0x163374[_0xa073('0x36')])&&_0x163374[_0xa073('0x37')]&&!_0x163374[_0xa073('0x38')]){_0x2e8331[_0x163374[_0xa073('0x37')]['toLowerCase']()]=_0x163374[_0xa073('0x39')][_0xa073('0x2d')]();}else if(_[_0xa073('0x34')]([_0xa073('0x35'),_0xa073('0x3a')],_0x163374[_0xa073('0x36')])&&_0x163374[_0xa073('0x3b')]&&_0x163374[_0xa073('0x38')]){_0x2e8331[_0xa073('0x15')][_0xa073('0x3c')]({'id':_0x163374[_0xa073('0x3b')],'value':_0x163374[_0xa073('0x39')][_0xa073('0x2d')]()});}else if(_0x163374[_0xa073('0x36')]===_0xa073('0x3d')&&_0x163374[_0xa073('0x3e')]&&_0x163374[_0xa073('0x3b')]&&_0x163374[_0xa073('0x38')]){_0x59ce48[_0x163374[_0xa073('0x3e')]]&&_0x2e8331[_0xa073('0x15')][_0xa073('0x3c')]({'id':_0x163374[_0xa073('0x3b')],'value':_0x59ce48[_0x163374[_0xa073('0x3e')]][_0xa073('0x2d')]()});}else if(_0x163374[_0xa073('0x36')]===_0xa073('0x3f')&&_0x163374['Variable']&&_0x163374['Variable'][_0xa073('0x13')]&&_0x163374[_0xa073('0x3b')]&&_0x163374['customField']){_0x59ce48[_0x163374[_0xa073('0x40')][_0xa073('0x13')][_0xa073('0x41')]()]&&_0x2e8331[_0xa073('0x15')][_0xa073('0x3c')]({'id':_0x163374[_0xa073('0x3b')],'value':_0x59ce48[_0x163374['Variable'][_0xa073('0x13')]['toLowerCase']()][_0xa073('0x2d')]()});}});}return _0x2e8331;}exports['queue']=function(_0x266d26,_0x44b3be,_0x283f7d,_0x31981e,_0x332df4,_0x321bfe){var _0xd52b13,_0x3f4525;_0x321bfe[_0xa073('0x19')]=intUtil[_0xa073('0x42')](_0x321bfe['remoteUri']);_0x321bfe[_0xa073('0x43')]=intUtil[_0xa073('0x42')](_0x321bfe[_0xa073('0x43')]);if(_0x332df4&&_0x332df4[_0xa073('0x44')]){logger['info'](_0xa073('0x45'),_0xa073('0x46'));_0x44b3be[_0xa073('0x47')]=util[_0xa073('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x321bfe[_0xa073('0x43')],_0x44b3be[_0xa073('0x48')],md5(_0x44b3be['uniqueid']));}else{_0x44b3be[_0xa073('0x47')]='';}headers['Authorization']=getAuth(_0x321bfe);return getUser(_0x321bfe,_0x31981e[_0xa073('0x20')])[_0xa073('0x22')](function(_0xf86584){_0xd52b13=_0xf86584;logger['info'](_0xa073('0x49'),_0xd52b13['id']);return getEndUser(_0x321bfe,_0x44b3be[_0xa073('0x4a')],_0x44b3be['calleridnum']);})[_0xa073('0x22')](function(_0x5d4f2e){_0x3f4525=_0x5d4f2e;logger[_0xa073('0xa')](_0xa073('0x4b'),_0x3f4525['id']);return getTicket(_0x321bfe,_0xd52b13,_0x3f4525,_0x283f7d,_0x44b3be);})[_0xa073('0x22')](function(_0x3b4193){if(_0x3b4193&&_0x3b4193['id']){logger[_0xa073('0xa')](_0xa073('0x1b'));logger['info'](_0xa073('0x4c'),_0x3b4193['id']);logger[_0xa073('0xa')](_0xa073('0x45'),_0xa073('0x4d'));emit(util['format']('user:%s',_0x31981e[_0xa073('0x13')]),_0xa073('0x4e'),{'uri':util[_0xa073('0xd')]('%s/helpdesk/tickets/%d',_0x321bfe[_0xa073('0x19')],_0x3b4193['id'])});}})['catch'](function(_0x2e8c3f){logger['error'](_0xa073('0x45'),JSON[_0xa073('0x31')](_0x2e8c3f));});};exports[_0xa073('0x4f')]=function(_0x2bd36a,_0x5d5911,_0x34d7ad,_0x3a1d3f,_0xc0d32a,_0x30f370,_0x415799){var _0x1e5528,_0x5f2535;_0x30f370[_0xa073('0x19')]=intUtil[_0xa073('0x42')](_0x30f370[_0xa073('0x19')]);_0x30f370[_0xa073('0x43')]=intUtil[_0xa073('0x42')](_0x30f370['serverUrl']);if(_0x415799&&_0x415799[_0xa073('0x50')]&&_0x415799[_0xa073('0x50')]!==_0xa073('0x51')){logger[_0xa073('0xa')](_0xa073('0x52'),_0xa073('0x46'));_0x5d5911[_0xa073('0x47')]=util[_0xa073('0xd')](_0xa073('0x53'),_0x30f370[_0xa073('0x43')],_0x5d5911['uniqueid'],md5(_0x5d5911['uniqueid']));}headers[_0xa073('0x54')]=getAuth(_0x30f370);return getUser(_0x30f370,_0x3a1d3f[_0xa073('0x20')])[_0xa073('0x22')](function(_0x512f08){_0x1e5528=_0x512f08;logger['info']('The\x20User\x20ID\x20is:',_0x1e5528['id']);return getEndUser(_0x30f370,_0x5d5911['destcalleridname'],_0x5d5911[_0xa073('0x55')]);})[_0xa073('0x22')](function(_0x1b66c9){_0x5f2535=_0x1b66c9;logger['info'](_0xa073('0x4b'),_0x5f2535['id']);return getTicket(_0x30f370,_0x1e5528,_0x5f2535,_0x34d7ad,_0x5d5911);})[_0xa073('0x22')](function(_0x1d471b){if(_0x1d471b&&_0x1d471b['id']){logger[_0xa073('0xa')](_0xa073('0x1b'));logger[_0xa073('0xa')](_0xa073('0x4c'),_0x1d471b['id']);logger[_0xa073('0xa')](_0xa073('0x52'),_0xa073('0x4d'));emit(util[_0xa073('0xd')]('user:%s',_0x3a1d3f[_0xa073('0x13')]),_0xa073('0x4e'),{'uri':util['format'](_0xa073('0x56'),_0x30f370[_0xa073('0x19')],_0x1d471b['id'])});}})[_0xa073('0x57')](function(_0x109243){logger[_0xa073('0x58')](_0xa073('0x52'),JSON[_0xa073('0x31')](_0x109243));});};exports[_0xa073('0x59')]=function(_0x4b7fe7,_0x2076ef,_0x4c6cee,_0x4c66ab,_0x26193d,_0x555545){var _0x487f82,_0x5277e1;_0x555545[_0xa073('0x19')]=intUtil[_0xa073('0x42')](_0x555545['remoteUri']);_0x555545[_0xa073('0x43')]=intUtil[_0xa073('0x42')](_0x555545['serverUrl']);if(_0x26193d&&_0x26193d[_0xa073('0x44')]){logger[_0xa073('0xa')]('['+_0x2076ef[_0xa073('0x5a')][_0xa073('0x5b')]()+']',_0xa073('0x46'));_0x2076ef[_0xa073('0x47')]=util[_0xa073('0xd')](_0xa073('0x53'),_0x555545['serverUrl'],_0x2076ef[_0xa073('0x48')],md5(_0x2076ef[_0xa073('0x48')]));}else{_0x2076ef[_0xa073('0x47')]='';}headers[_0xa073('0x54')]=getAuth(_0x555545);return getUser(_0x555545,'')['then'](function(_0x4059cb){_0x487f82=_0x4059cb;logger[_0xa073('0xa')](_0xa073('0x49'),_0x487f82['id']);return getEndUser(_0x555545,_0x2076ef[_0xa073('0x4a')],_0x2076ef[_0xa073('0xe')]);})[_0xa073('0x22')](function(_0x481023){_0x5277e1=_0x481023;logger[_0xa073('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5277e1['id']);return getTicket(_0x555545,_0x487f82,_0x5277e1,_0x4c6cee,_0x2076ef);})[_0xa073('0x22')](function(_0x5e5d8a){if(_0x5e5d8a){logger[_0xa073('0xa')](_0xa073('0x1b'));logger[_0xa073('0xa')](_0xa073('0x4c'),_0x5e5d8a['id']);}})[_0xa073('0x57')](function(_0xfeec6a){logger[_0xa073('0x58')]('['+_0x2076ef[_0xa073('0x5a')][_0xa073('0x5b')]()+']',JSON['stringify'](_0xfeec6a));});}; \ No newline at end of file +var _0x4515=['Basic\x20%s','toString','base64','debug','[HTTP]','GET','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','Variable','queue','stripTrailingSlash','serverUrl','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','trigger:browser:url','unmanaged','monitor_format','lastevent','toUpperCase','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','%s/api/v2/tickets','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.'];(function(_0x449bf8,_0x2bc097){var _0x466ecf=function(_0x4893ab){while(--_0x4893ab){_0x449bf8['push'](_0x449bf8['shift']());}};_0x466ecf(++_0x2bc097);}(_0x4515,0x138));var _0x5451=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4515[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x5451('0x0'));var intUtil=require(_0x5451('0x1'));var config=require(_0x5451('0x2'));var logger=require('../../../../config/logger')('freshdesk');config[_0x5451('0x3')]=_[_0x5451('0x4')](config[_0x5451('0x3')],{'host':_0x5451('0x5'),'port':0x18eb});var io=require(_0x5451('0x6'))(new Redis(config['redis']));var headers={'Content-Type':_0x5451('0x7'),'Accept':_0x5451('0x7')};function emit(_0x2f1786,_0x4e1048,_0x30c5e3){io['to'](_0x2f1786)[_0x5451('0x8')](_0x4e1048,_0x30c5e3);}function getTicket(_0x1e7bed,_0x1322ca,_0x421a6a,_0x7979c8,_0x50350f){logger['info'](_0x5451('0x9'));var _0x57b7ed=_[_0x5451('0xa')]({'responder_id':_0x1322ca['id'],'requester_id':_0x421a6a['id'],'name':util[_0x5451('0xb')](_0x5451('0xc'),_0x50350f['calleridname']),'phone':_0x50350f[_0x5451('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5451('0xe')](_0x7979c8[_0x5451('0xf')],_0x50350f,'\x20'),'description':intUtil['getString'](_0x7979c8[_0x5451('0x10')],_0x50350f,_0x5451('0x11')),'tags':getTags(_0x7979c8[_0x5451('0x12')],_0x5451('0x13'))},getCustomFields(_0x7979c8[_0x5451('0x14')],_0x50350f));_0x57b7ed[_0x5451('0x15')]=_['mapValues'](_['keyBy'](_0x57b7ed[_0x5451('0x15')],'id'),'value');return request({'uri':util[_0x5451('0xb')](_0x5451('0x16'),_0x1e7bed['remoteUri']),'method':_0x5451('0x17'),'body':_0x57b7ed})['then'](function(_0x16c8e1){logger[_0x5451('0x18')](_0x5451('0x19'));return _0x16c8e1;});}function getUser(_0x38ec8d,_0x3be3a8){if(intUtil[_0x5451('0x1a')](_0x3be3a8)){return request({'uri':util[_0x5451('0xb')](_0x5451('0x1b'),_0x38ec8d['remoteUri']),'qs':{'email':_0x3be3a8}})[_0x5451('0x1c')](function(_0x52cc24){if(_0x52cc24[_0x5451('0x1d')]){logger[_0x5451('0x18')](_0x5451('0x1e'));return _['find'](_0x52cc24,function(_0x1c4e81){return _0x1c4e81[_0x5451('0x1f')][_0x5451('0x20')]===_0x3be3a8;});}else{logger['info'](_0x5451('0x21'));return request({'uri':util[_0x5451('0xb')](_0x5451('0x22'),_0x38ec8d[_0x5451('0x23')])})[_0x5451('0x1c')](function(_0x17751e){logger[_0x5451('0x18')](_0x5451('0x24'));return _0x17751e;});}});}else{logger[_0x5451('0x18')](_0x5451('0x25'));return request({'uri':util[_0x5451('0xb')]('%s/api/v2/agents/me',_0x38ec8d[_0x5451('0x23')])})['then'](function(_0x3ac209){logger[_0x5451('0x18')](_0x5451('0x24'));return _0x3ac209;});}}function getEndUser(_0x53e9b5,_0x38f2d9,_0x1c9f53){logger['info'](_0x5451('0x26'),_0x1c9f53);return request({'uri':util[_0x5451('0xb')](_0x5451('0x27'),_0x53e9b5[_0x5451('0x23')]),'qs':{'phone':_0x1c9f53}})[_0x5451('0x1c')](function(_0x212ee9){if(_0x212ee9[_0x5451('0x1d')]){logger[_0x5451('0x18')](_0x5451('0x28'));return _[_0x5451('0x29')](_0x212ee9,{'phone':_0x1c9f53});}else{logger['info'](_0x5451('0x2a'));return request({'uri':util['format'](_0x5451('0x27'),_0x53e9b5[_0x5451('0x23')]),'method':_0x5451('0x17'),'body':{'name':_0x38f2d9,'phone':_0x1c9f53}})[_0x5451('0x1c')](function(_0x4b95c5){logger[_0x5451('0x18')](_0x5451('0x2b'));return _0x4b95c5;});}});}function getAuth(_0x25aa3c){return util['format'](_0x5451('0x2c'),new Buffer(_0x25aa3c['apiKey']+':X')[_0x5451('0x2d')](_0x5451('0x2e')));}function request(_0x1b3aa8){logger[_0x5451('0x2f')](_0x5451('0x30'),JSON['stringify'](_0x1b3aa8));return rp(_[_0x5451('0x4')](_0x1b3aa8,{'method':_0x5451('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x3f0ddc,_0x4d4e65){var _0x144241=[];if(_0x3f0ddc&&_0x3f0ddc[_0x5451('0x1d')]>0x0){_0x144241=_['map'](_0x3f0ddc,_0x4d4e65);}return _0x144241;}function getCustomFields(_0x425b8c,_0x1a8f20){var _0x3704c4=[];var _0x3bf176={'custom_fields':[]};if(_0x425b8c[_0x5451('0x1d')]>0x0){_['forEach'](_0x425b8c,function(_0x1550ec){if(_[_0x5451('0x32')]([_0x5451('0x33'),_0x5451('0x34')],_0x1550ec[_0x5451('0x35')])&&_0x1550ec[_0x5451('0x36')]&&!_0x1550ec[_0x5451('0x37')]){_0x3bf176[_0x1550ec[_0x5451('0x36')][_0x5451('0x38')]()]=_0x1550ec[_0x5451('0x39')][_0x5451('0x2d')]();}else if(_[_0x5451('0x32')]([_0x5451('0x33'),_0x5451('0x34')],_0x1550ec['type'])&&_0x1550ec[_0x5451('0x3a')]&&_0x1550ec[_0x5451('0x37')]){_0x3bf176[_0x5451('0x15')][_0x5451('0x3b')]({'id':_0x1550ec['idField'],'value':_0x1550ec[_0x5451('0x39')][_0x5451('0x2d')]()});}else if(_0x1550ec[_0x5451('0x35')]==='variable'&&_0x1550ec[_0x5451('0x3c')]&&_0x1550ec['idField']&&_0x1550ec[_0x5451('0x37')]){_0x1a8f20[_0x1550ec['variableName']]&&_0x3bf176[_0x5451('0x15')][_0x5451('0x3b')]({'id':_0x1550ec[_0x5451('0x3a')],'value':_0x1a8f20[_0x1550ec[_0x5451('0x3c')]][_0x5451('0x2d')]()});}else if(_0x1550ec[_0x5451('0x35')]==='customVariable'&&_0x1550ec[_0x5451('0x3d')]&&_0x1550ec[_0x5451('0x3d')][_0x5451('0x13')]&&_0x1550ec[_0x5451('0x3a')]&&_0x1550ec['customField']){_0x1a8f20[_0x1550ec[_0x5451('0x3d')][_0x5451('0x13')][_0x5451('0x38')]()]&&_0x3bf176[_0x5451('0x15')][_0x5451('0x3b')]({'id':_0x1550ec[_0x5451('0x3a')],'value':_0x1a8f20[_0x1550ec[_0x5451('0x3d')][_0x5451('0x13')]['toLowerCase']()]['toString']()});}});}return _0x3bf176;}exports[_0x5451('0x3e')]=function(_0x3dbf13,_0x443c72,_0x16d61e,_0x2c6c78,_0x4d89fd,_0xaf756e){var _0xa11b96,_0x1416c1;_0xaf756e[_0x5451('0x23')]=intUtil[_0x5451('0x3f')](_0xaf756e[_0x5451('0x23')]);_0xaf756e[_0x5451('0x40')]=intUtil['stripTrailingSlash'](_0xaf756e['serverUrl']);if(_0x4d89fd&&_0x4d89fd['monitor_format']){logger[_0x5451('0x18')]('[QUEUE]','Recording\x20is\x20enabled!');_0x443c72['recordingURL']=util[_0x5451('0xb')](_0x5451('0x41'),_0xaf756e[_0x5451('0x40')],_0x443c72[_0x5451('0x42')],md5(_0x443c72[_0x5451('0x42')]));}else{_0x443c72[_0x5451('0x43')]='';}headers[_0x5451('0x44')]=getAuth(_0xaf756e);return getUser(_0xaf756e,_0x2c6c78[_0x5451('0x20')])[_0x5451('0x1c')](function(_0x1be830){_0xa11b96=_0x1be830;logger[_0x5451('0x18')](_0x5451('0x45'),_0xa11b96['id']);return getEndUser(_0xaf756e,_0x443c72[_0x5451('0x46')],_0x443c72[_0x5451('0xd')]);})['then'](function(_0x1746cb){_0x1416c1=_0x1746cb;logger[_0x5451('0x18')](_0x5451('0x47'),_0x1416c1['id']);return getTicket(_0xaf756e,_0xa11b96,_0x1416c1,_0x16d61e,_0x443c72);})[_0x5451('0x1c')](function(_0x2df125){if(_0x2df125&&_0x2df125['id']){logger[_0x5451('0x18')]('Ticket\x20created!');logger[_0x5451('0x18')](_0x5451('0x48'),_0x2df125['id']);logger['info'](_0x5451('0x49'),_0x5451('0x4a'));emit(util[_0x5451('0xb')](_0x5451('0x4b'),_0x2c6c78['name']),'trigger:browser:url',{'uri':util[_0x5451('0xb')]('%s/helpdesk/tickets/%d',_0xaf756e[_0x5451('0x23')],_0x2df125['id'])});}})[_0x5451('0x4c')](function(_0x3af0cd){logger[_0x5451('0x4d')](_0x5451('0x49'),JSON[_0x5451('0x4e')](_0x3af0cd));});};exports[_0x5451('0x4f')]=function(_0x2d5281,_0x749caa,_0x108ed2,_0x3af32c,_0x5cc487,_0x236376,_0x2879e8){var _0x7fd717,_0x2d0f58;_0x236376[_0x5451('0x23')]=intUtil[_0x5451('0x3f')](_0x236376['remoteUri']);_0x236376[_0x5451('0x40')]=intUtil['stripTrailingSlash'](_0x236376[_0x5451('0x40')]);if(_0x2879e8&&_0x2879e8[_0x5451('0x50')]&&_0x2879e8['recordingFormat']!==_0x5451('0x51')){logger[_0x5451('0x18')](_0x5451('0x52'),_0x5451('0x53'));_0x749caa['recordingURL']=util[_0x5451('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x236376[_0x5451('0x40')],_0x749caa[_0x5451('0x42')],md5(_0x749caa['uniqueid']));}headers[_0x5451('0x44')]=getAuth(_0x236376);return getUser(_0x236376,_0x3af32c[_0x5451('0x20')])[_0x5451('0x1c')](function(_0x3814f9){_0x7fd717=_0x3814f9;logger[_0x5451('0x18')](_0x5451('0x45'),_0x7fd717['id']);return getEndUser(_0x236376,_0x749caa['destcalleridname'],_0x749caa['destcalleridnum']);})[_0x5451('0x1c')](function(_0x557d88){_0x2d0f58=_0x557d88;logger[_0x5451('0x18')](_0x5451('0x47'),_0x2d0f58['id']);return getTicket(_0x236376,_0x7fd717,_0x2d0f58,_0x108ed2,_0x749caa);})[_0x5451('0x1c')](function(_0x3e70fb){if(_0x3e70fb&&_0x3e70fb['id']){logger[_0x5451('0x18')](_0x5451('0x19'));logger['info'](_0x5451('0x48'),_0x3e70fb['id']);logger['info'](_0x5451('0x52'),_0x5451('0x4a'));emit(util[_0x5451('0xb')](_0x5451('0x4b'),_0x3af32c[_0x5451('0x13')]),_0x5451('0x54'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x236376[_0x5451('0x23')],_0x3e70fb['id'])});}})['catch'](function(_0x273015){logger[_0x5451('0x4d')](_0x5451('0x52'),JSON[_0x5451('0x4e')](_0x273015));});};exports[_0x5451('0x55')]=function(_0x198055,_0xc3ece2,_0x2bde81,_0x597b15,_0x2d37bb,_0x1c4cbb){var _0x4bf136,_0x10d3c4;_0x1c4cbb[_0x5451('0x23')]=intUtil[_0x5451('0x3f')](_0x1c4cbb[_0x5451('0x23')]);_0x1c4cbb[_0x5451('0x40')]=intUtil[_0x5451('0x3f')](_0x1c4cbb[_0x5451('0x40')]);if(_0x2d37bb&&_0x2d37bb[_0x5451('0x56')]){logger[_0x5451('0x18')]('['+_0xc3ece2[_0x5451('0x57')][_0x5451('0x58')]()+']','Recording\x20is\x20enabled!');_0xc3ece2[_0x5451('0x43')]=util[_0x5451('0xb')](_0x5451('0x41'),_0x1c4cbb[_0x5451('0x40')],_0xc3ece2[_0x5451('0x42')],md5(_0xc3ece2[_0x5451('0x42')]));}else{_0xc3ece2[_0x5451('0x43')]='';}headers[_0x5451('0x44')]=getAuth(_0x1c4cbb);return getUser(_0x1c4cbb,'')[_0x5451('0x1c')](function(_0x3105fb){_0x4bf136=_0x3105fb;logger['info']('The\x20User\x20ID\x20is:',_0x4bf136['id']);return getEndUser(_0x1c4cbb,_0xc3ece2[_0x5451('0x46')],_0xc3ece2[_0x5451('0xd')]);})[_0x5451('0x1c')](function(_0x8edcd7){_0x10d3c4=_0x8edcd7;logger[_0x5451('0x18')](_0x5451('0x47'),_0x10d3c4['id']);return getTicket(_0x1c4cbb,_0x4bf136,_0x10d3c4,_0x2bde81,_0xc3ece2);})[_0x5451('0x1c')](function(_0x40d01b){if(_0x40d01b){logger['info']('Ticket\x20created!');logger[_0x5451('0x18')](_0x5451('0x48'),_0x40d01b['id']);}})[_0x5451('0x4c')](function(_0x162536){logger[_0x5451('0x4d')]('['+_0xc3ece2[_0x5451('0x57')][_0x5451('0x58')]()+']',JSON[_0x5451('0x4e')](_0x162536));});}; \ 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 241bd14..5cf42f7 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 _0x08fb=['Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','length','email','adminEmail','adminId','catch','error','toUpperCase','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','userEmail','Requested\x20Resource\x20not\x20Found','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:'];(function(_0x571c83,_0x4c97dc){var _0x2b8bd2=function(_0x1401a1){while(--_0x1401a1){_0x571c83['push'](_0x571c83['shift']());}};_0x2b8bd2(++_0x4c97dc);}(_0x08fb,0x125));var _0xb08f=function(_0x68e149,_0x42e815){_0x68e149=_0x68e149-0x0;var _0x336a36=_0x08fb[_0x68e149];return _0x336a36;};'use strict';var _=require(_0xb08f('0x0'));var rp=require(_0xb08f('0x1'));var md5=require(_0xb08f('0x2'));var util=require(_0xb08f('0x3'));var moment=require('moment');var Promise=require(_0xb08f('0x4'));var Redis=require(_0xb08f('0x5'));var intUtil=require(_0xb08f('0x6'));var config=require(_0xb08f('0x7'));var logger=require(_0xb08f('0x8'))('freshsales');config[_0xb08f('0x9')]=_['defaults'](config['redis'],{'host':_0xb08f('0xa'),'port':0x18eb});var io=require(_0xb08f('0xb'))(new Redis(config[_0xb08f('0x9')]));function getAdminId(_0x376294,_0x536ff7,_0xa4c8a3,_0x374f70){return new Promise(function(_0x473f11,_0x26c17a){var _0x2ade7e=![];var _0x40ed37={'method':_0xb08f('0xc'),'uri':_0x374f70+_0xb08f('0xd'),'json':!![]};_0x40ed37[_0xb08f('0xe')]=_0xa4c8a3;logger[_0xb08f('0xf')]('Getting\x20admin\x20information');return rp(_0x40ed37)[_0xb08f('0x10')](function(_0x455186){if(_0x455186){var _0x559546=_0x455186['users'];var _0x2e1308=null;for(_0x2e1308=0x0;_0x2e1308<_0x559546[_0xb08f('0x11')];_0x2e1308++){if(_0x559546[_0x2e1308][_0xb08f('0x12')]===_0x376294[_0xb08f('0x13')]){_0x376294[_0xb08f('0x14')]=_0x559546[_0x2e1308]['id'];_0x2ade7e=!![];}}if(_0x2ade7e){logger['info']('Admin\x20found:',_0x376294[_0xb08f('0x14')]);_0x473f11(_0x376294);}else{_0x26c17a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x26c17a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb08f('0x15')](function(_0x22fd53){logger[_0xb08f('0x16')]('['+[_0x536ff7[_0xb08f('0x17')]()]+']',_0x22fd53[_0xb08f('0x18')]);_0x26c17a(_0x22fd53);});});}function getUser(_0x5a56ed,_0x4f18ee,_0x1d7d38){return function(_0x567d7e){return new Promise(function(_0x36a42e,_0x26b5ba){var _0x3a4ce8={'method':'GET','uri':_0x1d7d38+_0xb08f('0xd'),'json':!![]};_0x3a4ce8['headers']=_0x4f18ee;logger['info'](_0xb08f('0x19'));return rp(_0x3a4ce8)['then'](function(_0x5f21b9){if(_0x5f21b9){var _0x3aa50d=_0x5f21b9[_0xb08f('0x1a')];var _0x3eae92=![];var _0x207e7f=null;if(_0x567d7e[_0xb08f('0x1b')]!==null){logger['info'](_0xb08f('0x1c'),_0x567d7e[_0xb08f('0x1b')]);_0x567d7e['userEmail']=_0x567d7e[_0xb08f('0x1b')];for(_0x207e7f=0x0;_0x207e7f<_0x3aa50d[_0xb08f('0x11')];_0x207e7f++){if(_0x3aa50d[_0x207e7f]['email']===_0x567d7e[_0xb08f('0x1b')]){_0x3eae92=!![];_0x567d7e[_0xb08f('0x1d')]=_0x3aa50d[_0x207e7f]['id'];logger['info'](_0xb08f('0x1e'),_0x567d7e[_0xb08f('0x1d')]);}}}if(!_0x3eae92){logger[_0xb08f('0xf')]('Admin\x20selected');_0x567d7e[_0xb08f('0x1f')]=_0x567d7e[_0xb08f('0x13')];_0x567d7e['userId']=_0x567d7e[_0xb08f('0x14')];_0x3eae92=!![];}if(_0x3eae92){_0x36a42e(_0x567d7e);}else{_0x26b5ba({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x26b5ba({'statusCode':0x194,'message':_0xb08f('0x20')});}})['catch'](function(_0x1fcf19){logger[_0xb08f('0x16')]('['+[_0x5a56ed[_0xb08f('0x17')]()]+']',_0x1fcf19[_0xb08f('0x18')]);_0x26b5ba(_0x1fcf19);});});};}function searchContact(_0x453dbf,_0x52cd17,_0x54c36c,_0x3938cd){return new Promise(function(_0x3121e2,_0x43c599){var _0x5958c3={'method':_0xb08f('0xc'),'headers':_0x52cd17,'uri':_0x453dbf+_0xb08f('0x21')+_0x3938cd+_0xb08f('0x22')+_0x54c36c+'&entities=contact','json':!![]};rp(_0x5958c3)[_0xb08f('0x10')](function(_0x1adce6){var _0x163ac2=_[_0xb08f('0x23')](_0x1adce6[_0xb08f('0x24')][_0xb08f('0x24')],[_0x54c36c,_0x3938cd]);_0x3121e2(_0x163ac2);})[_0xb08f('0x15')](function(_0x3afb26){_0x43c599(_0x3afb26);});});}function getEndUser(_0x2538e3,_0x471a54,_0x1d5c20){return function(_0x142590){return new Promise(function(_0x5f55f7,_0x457dd6){logger[_0xb08f('0xf')](util[_0xb08f('0x25')](_0xb08f('0x26'),_0x142590[_0xb08f('0x27')]));searchContact(_0x1d5c20,_0x471a54,_0xb08f('0x28'),_0x142590['contactNumber'])[_0xb08f('0x10')](function(_0x3ad365){if(_0x3ad365){_0x142590[_0xb08f('0x29')]=_0x3ad365['id'];logger[_0xb08f('0xf')](_0xb08f('0x2a'),_0x142590['endUserId']);return _0x5f55f7(_0x142590);}searchContact(_0x1d5c20,_0x471a54,'work_number',_0x142590[_0xb08f('0x27')])['then'](function(_0x2f55a9){if(_0x2f55a9){_0x142590[_0xb08f('0x29')]=_0x2f55a9['id'];logger['info'](_0xb08f('0x2b'),_0x142590[_0xb08f('0x29')]);return _0x5f55f7(_0x142590);}createEndUser(_0x142590,_0x2538e3,_0x471a54,_0x1d5c20)[_0xb08f('0x10')](function(_0x44e418){logger['info'](_0xb08f('0x2c'),_0x44e418['endUserId']);return _0x5f55f7(_0x44e418);});});})['catch'](function(_0x57a550){_0x457dd6(_0x57a550);});});};}function createEndUser(_0x36e091,_0x498f49,_0x2037f4,_0x2b4625){return new Promise(function(_0x43b576,_0x162381){var _0x1ad0e0=moment();var _0x392475={'method':_0xb08f('0x2d'),'uri':_0x2b4625+_0xb08f('0x2e'),'body':{'contact':{'last_name':_0x36e091[_0xb08f('0x27')],'work_number':_0x36e091[_0xb08f('0x27')],'mobile_number':_0x36e091['contactNumber'],'owner_id':_0x36e091[_0xb08f('0x1d')],'created_at':_0x1ad0e0['format'](_0xb08f('0x2f'))}},'json':!![]};_0x392475[_0xb08f('0xe')]=_0x2037f4;logger[_0xb08f('0xf')](_0xb08f('0x30'));return rp(_0x392475)[_0xb08f('0x10')](function(_0x5b0abd){_0x36e091[_0xb08f('0x29')]=_0x5b0abd[_0xb08f('0x31')]['id'];_0x43b576(_0x36e091);})['catch'](function(_0x68d989){logger[_0xb08f('0x16')]('['+[_0x498f49['toUpperCase']()]+']',_0x68d989['message']);_0x162381(_0x68d989[_0xb08f('0x18')]);});});}function getTicket(_0x42a260,_0xae34c,_0x1bbb05,_0x150a82,_0x47451d){return function(_0xc44fe7){logger[_0xb08f('0xf')](_0xb08f('0x32'));return new Promise(function(_0x42e0be,_0x1fc430){var _0x48f60c=moment();var _0x31f60b={'method':_0xb08f('0x2d'),'uri':_0x1bbb05+_0xb08f('0x33'),'body':{'title':intUtil[_0xb08f('0x34')](_0x150a82['Subjects'],_0x47451d,'\x20'),'description':intUtil[_0xb08f('0x34')](_0x150a82[_0xb08f('0x35')],_0x47451d,'\x0a'),'owner_id':_0xc44fe7[_0xb08f('0x1d')],'creater_id':_0xc44fe7[_0xb08f('0x14')],'targetable_id':_0xc44fe7['endUserId'],'targetable_type':_0xb08f('0x36'),'created_at':_0x48f60c[_0xb08f('0x25')](_0xb08f('0x2f')),'due_date':_0x48f60c[_0xb08f('0x37')](0x1e,'m')['format'](_0xb08f('0x2f'))},'json':!![]};_0x31f60b['headers']=_0xae34c;return rp(_0x31f60b)[_0xb08f('0x10')](function(_0x40d6e9){_0xc44fe7[_0xb08f('0x38')]=_0x40d6e9[_0xb08f('0x39')]['id'];logger[_0xb08f('0xf')](_0xb08f('0x3a'),_0xc44fe7[_0xb08f('0x38')]);_0x42e0be(_0xc44fe7);})[_0xb08f('0x15')](function(_0x199072){logger['error']('['+[_0x42a260['toUpperCase']()]+']',_0x199072[_0xb08f('0x18')]);_0x1fc430(_0x199072[_0xb08f('0x18')]);});});};}function emit(_0x2ad968,_0x46e9ff,_0x142413){var _0x5201f5={'uri':_0x2ad968+_0xb08f('0x3b')+_0x142413};io['to'](util[_0xb08f('0x25')](_0xb08f('0x3c'),_0x46e9ff))[_0xb08f('0x3d')](_0xb08f('0x3e'),_0x5201f5);}exports['cs']=function(_0x2ec7fd,_0x466e72,_0x2352c3,_0x568d10,_0x2ed566,_0x5d56a7,_0x9e052a,_0x211b55){var _0x22af5e={};var _0x460833={'Authorization':_0xb08f('0x3f')+_0x5d56a7[_0xb08f('0x40')]};_0x5d56a7['remoteUri']=intUtil[_0xb08f('0x41')](_0x5d56a7['remoteUri']);_0x5d56a7[_0xb08f('0x42')]=intUtil['stripTrailingSlash'](_0x5d56a7[_0xb08f('0x42')]);var _0x5def44=_0x5d56a7[_0xb08f('0x43')];_0x22af5e[_0xb08f('0x13')]=_0x5d56a7[_0xb08f('0x44')];_0x22af5e[_0xb08f('0x27')]=_0x211b55['toLowerCase']()===_0xb08f('0x45')?_0x466e72[_0xb08f('0x46')]:_0x466e72[_0xb08f('0x47')];_0x22af5e[_0xb08f('0x48')]=_0x211b55===_0xb08f('0x49')||_0x211b55===_0xb08f('0x4a')?'queue':_0xb08f('0x45');if(_0x568d10){_0x22af5e[_0xb08f('0x1b')]=_0x568d10[_0xb08f('0x12')];}var _0x213fe3=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d56a7[_0xb08f('0x42')],_0x466e72[_0xb08f('0x4b')],md5(_0x466e72['uniqueid']));if(_0x2ed566&&_0x2ed566[_0xb08f('0x4c')]){logger[_0xb08f('0xf')](_0xb08f('0x4d'),_0xb08f('0x4e'));_0x466e72[_0xb08f('0x4f')]=_0x213fe3;}else if(_0x9e052a&&_0x9e052a[_0xb08f('0x50')]&&_0x9e052a[_0xb08f('0x50')]!==_0xb08f('0x51')){logger[_0xb08f('0xf')]('[OUTBOUND]',_0xb08f('0x4e'));_0x466e72[_0xb08f('0x4f')]=_0x213fe3;}else{_0x466e72[_0xb08f('0x4f')]='';}return getAdminId(_0x22af5e,_0x211b55,_0x460833,_0x5def44)[_0xb08f('0x10')](getUser(_0x211b55,_0x460833,_0x5def44))[_0xb08f('0x10')](getEndUser(_0x211b55,_0x460833,_0x5def44))[_0xb08f('0x10')](getTicket(_0x211b55,_0x460833,_0x5def44,_0x2352c3,_0x466e72))[_0xb08f('0x10')](function(_0x8c6dfb){logger['info'](util[_0xb08f('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x8c6dfb['ticketId']));if(_0x211b55!==_0xb08f('0x4a')){logger['info']('['+[_0x211b55[_0xb08f('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5def44,_0x568d10[_0xb08f('0x52')],_0x8c6dfb['endUserId']);}})['catch'](function(_0x515462){logger[_0xb08f('0x16')]('['+[_0x211b55['toUpperCase']()]+_0xb08f('0x53'),util['inspect'](_0x515462,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf701=['catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','then','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','format','add','ticketId','task','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','moment','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','users','email','adminEmail','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','length','userId','Admin\x20selected','adminId'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xf701,0x130));var _0x1f70=function(_0x3a7c2d,_0x94ddd4){_0x3a7c2d=_0x3a7c2d-0x0;var _0x32d717=_0xf701[_0x3a7c2d];return _0x32d717;};'use strict';var _=require(_0x1f70('0x0'));var rp=require(_0x1f70('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0x1f70('0x2'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x1f70('0x3'));var config=require(_0x1f70('0x4'));var logger=require(_0x1f70('0x5'))(_0x1f70('0x6'));config[_0x1f70('0x7')]=_['defaults'](config[_0x1f70('0x7')],{'host':_0x1f70('0x8'),'port':0x18eb});var io=require(_0x1f70('0x9'))(new Redis(config[_0x1f70('0x7')]));function getAdminId(_0x10cdaf,_0x2f3d62,_0x392c32,_0x3cf72d){return new Promise(function(_0xeff665,_0x4a6496){var _0x530e04=![];var _0x3e75b4={'method':_0x1f70('0xa'),'uri':_0x3cf72d+_0x1f70('0xb'),'json':!![]};_0x3e75b4['headers']=_0x392c32;logger['info']('Getting\x20admin\x20information');return rp(_0x3e75b4)['then'](function(_0x34b334){if(_0x34b334){var _0x3c5ed1=_0x34b334[_0x1f70('0xc')];var _0x2425b5=null;for(_0x2425b5=0x0;_0x2425b5<_0x3c5ed1['length'];_0x2425b5++){if(_0x3c5ed1[_0x2425b5][_0x1f70('0xd')]===_0x10cdaf[_0x1f70('0xe')]){_0x10cdaf['adminId']=_0x3c5ed1[_0x2425b5]['id'];_0x530e04=!![];}}if(_0x530e04){logger[_0x1f70('0xf')](_0x1f70('0x10'),_0x10cdaf['adminId']);_0xeff665(_0x10cdaf);}else{_0x4a6496({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4a6496({'statusCode':0x194,'message':_0x1f70('0x11')});}})['catch'](function(_0x3b8791){logger[_0x1f70('0x12')]('['+[_0x2f3d62[_0x1f70('0x13')]()]+']',_0x3b8791[_0x1f70('0x14')]);_0x4a6496(_0x3b8791);});});}function getUser(_0x417916,_0x54fd72,_0x5889a0){return function(_0x3796b1){return new Promise(function(_0x4893e4,_0x5e2257){var _0x5d7ee5={'method':_0x1f70('0xa'),'uri':_0x5889a0+_0x1f70('0xb'),'json':!![]};_0x5d7ee5['headers']=_0x54fd72;logger[_0x1f70('0xf')](_0x1f70('0x15'));return rp(_0x5d7ee5)['then'](function(_0x3ff544){if(_0x3ff544){var _0x43e1fa=_0x3ff544['users'];var _0x3564ec=![];var _0x4da17c=null;if(_0x3796b1[_0x1f70('0x16')]!==null){logger[_0x1f70('0xf')]('Getting\x20user\x20with\x20email',_0x3796b1[_0x1f70('0x16')]);_0x3796b1[_0x1f70('0x17')]=_0x3796b1[_0x1f70('0x16')];for(_0x4da17c=0x0;_0x4da17c<_0x43e1fa[_0x1f70('0x18')];_0x4da17c++){if(_0x43e1fa[_0x4da17c][_0x1f70('0xd')]===_0x3796b1[_0x1f70('0x16')]){_0x3564ec=!![];_0x3796b1['userId']=_0x43e1fa[_0x4da17c]['id'];logger['info']('User\x20found:',_0x3796b1[_0x1f70('0x19')]);}}}if(!_0x3564ec){logger[_0x1f70('0xf')](_0x1f70('0x1a'));_0x3796b1[_0x1f70('0x17')]=_0x3796b1['adminEmail'];_0x3796b1['userId']=_0x3796b1[_0x1f70('0x1b')];_0x3564ec=!![];}if(_0x3564ec){_0x4893e4(_0x3796b1);}else{_0x5e2257({'statusCode':0x194,'message':_0x1f70('0x11')});}}else{_0x5e2257({'statusCode':0x194,'message':_0x1f70('0x11')});}})[_0x1f70('0x1c')](function(_0x3d3af0){logger['error']('['+[_0x417916[_0x1f70('0x13')]()]+']',_0x3d3af0[_0x1f70('0x14')]);_0x5e2257(_0x3d3af0);});});};}function searchContact(_0x457002,_0x300e2a,_0x2de6b0,_0x32be4b){return new Promise(function(_0x20efb7,_0x56423d){var _0xbfaafa={'method':_0x1f70('0xa'),'headers':_0x300e2a,'uri':_0x457002+_0x1f70('0x1d')+_0x32be4b+_0x1f70('0x1e')+_0x2de6b0+_0x1f70('0x1f'),'json':!![]};rp(_0xbfaafa)['then'](function(_0xc4f760){var _0x4061bc=_[_0x1f70('0x20')](_0xc4f760[_0x1f70('0x21')]['contacts'],[_0x2de6b0,_0x32be4b]);_0x20efb7(_0x4061bc);})[_0x1f70('0x1c')](function(_0x6ea62){_0x56423d(_0x6ea62);});});}function getEndUser(_0x391c35,_0x423405,_0xa9b539){return function(_0x2fd657){return new Promise(function(_0x358ef8,_0x5ca87b){logger[_0x1f70('0xf')](util['format'](_0x1f70('0x22'),_0x2fd657['contactNumber']));searchContact(_0xa9b539,_0x423405,_0x1f70('0x23'),_0x2fd657[_0x1f70('0x24')])[_0x1f70('0x25')](function(_0x2a8f57){if(_0x2a8f57){_0x2fd657['endUserId']=_0x2a8f57['id'];logger[_0x1f70('0xf')](_0x1f70('0x26'),_0x2fd657[_0x1f70('0x27')]);return _0x358ef8(_0x2fd657);}searchContact(_0xa9b539,_0x423405,_0x1f70('0x28'),_0x2fd657[_0x1f70('0x24')])[_0x1f70('0x25')](function(_0x2dc8c1){if(_0x2dc8c1){_0x2fd657[_0x1f70('0x27')]=_0x2dc8c1['id'];logger['info']('Contact\x20found\x20work_number:',_0x2fd657[_0x1f70('0x27')]);return _0x358ef8(_0x2fd657);}createEndUser(_0x2fd657,_0x391c35,_0x423405,_0xa9b539)['then'](function(_0x21fbd7){logger[_0x1f70('0xf')](_0x1f70('0x29'),_0x21fbd7[_0x1f70('0x27')]);return _0x358ef8(_0x21fbd7);});});})['catch'](function(_0x19823d){_0x5ca87b(_0x19823d);});});};}function createEndUser(_0x165e70,_0x22cf54,_0x2afbb0,_0x4edc4c){return new Promise(function(_0x3cba6f,_0x45b9f3){var _0x4b823f=moment();var _0x3d5f3d={'method':_0x1f70('0x2a'),'uri':_0x4edc4c+_0x1f70('0x2b'),'body':{'contact':{'last_name':_0x165e70['contactNumber'],'work_number':_0x165e70[_0x1f70('0x24')],'mobile_number':_0x165e70[_0x1f70('0x24')],'owner_id':_0x165e70[_0x1f70('0x19')],'created_at':_0x4b823f['format'](_0x1f70('0x2c'))}},'json':!![]};_0x3d5f3d[_0x1f70('0x2d')]=_0x2afbb0;logger[_0x1f70('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3d5f3d)[_0x1f70('0x25')](function(_0x4c5839){_0x165e70[_0x1f70('0x27')]=_0x4c5839[_0x1f70('0x2e')]['id'];_0x3cba6f(_0x165e70);})[_0x1f70('0x1c')](function(_0x551fc3){logger[_0x1f70('0x12')]('['+[_0x22cf54[_0x1f70('0x13')]()]+']',_0x551fc3[_0x1f70('0x14')]);_0x45b9f3(_0x551fc3[_0x1f70('0x14')]);});});}function getTicket(_0x38e109,_0x185466,_0x5c4712,_0x1a4dab,_0x419fae){return function(_0x100a7a){logger[_0x1f70('0xf')](_0x1f70('0x2f'));return new Promise(function(_0x238490,_0x392aa){var _0x23dbf4=moment();var _0xd1e613={'method':_0x1f70('0x2a'),'uri':_0x5c4712+_0x1f70('0x30'),'body':{'title':intUtil['getString'](_0x1a4dab[_0x1f70('0x31')],_0x419fae,'\x20'),'description':intUtil[_0x1f70('0x32')](_0x1a4dab[_0x1f70('0x33')],_0x419fae,'\x0a'),'owner_id':_0x100a7a[_0x1f70('0x19')],'creater_id':_0x100a7a[_0x1f70('0x1b')],'targetable_id':_0x100a7a['endUserId'],'targetable_type':_0x1f70('0x34'),'created_at':_0x23dbf4[_0x1f70('0x35')](_0x1f70('0x2c')),'due_date':_0x23dbf4[_0x1f70('0x36')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xd1e613[_0x1f70('0x2d')]=_0x185466;return rp(_0xd1e613)[_0x1f70('0x25')](function(_0x1ff33a){_0x100a7a[_0x1f70('0x37')]=_0x1ff33a[_0x1f70('0x38')]['id'];logger[_0x1f70('0xf')]('Task\x20created:',_0x100a7a['ticketId']);_0x238490(_0x100a7a);})[_0x1f70('0x1c')](function(_0xc508e1){logger[_0x1f70('0x12')]('['+[_0x38e109[_0x1f70('0x13')]()]+']',_0xc508e1[_0x1f70('0x14')]);_0x392aa(_0xc508e1[_0x1f70('0x14')]);});});};}function emit(_0x4497c6,_0x44b403,_0x5a6578){var _0x151b79={'uri':_0x4497c6+_0x1f70('0x39')+_0x5a6578};io['to'](util['format'](_0x1f70('0x3a'),_0x44b403))['emit'](_0x1f70('0x3b'),_0x151b79);}exports['cs']=function(_0x3fba02,_0x37197c,_0x582e6f,_0x3b2592,_0x122b6a,_0x5be77a,_0x52e806,_0xc0b1fc){var _0x5b3c12={};var _0x3c10b8={'Authorization':_0x1f70('0x3c')+_0x5be77a[_0x1f70('0x3d')]};_0x5be77a['remoteUri']=intUtil[_0x1f70('0x3e')](_0x5be77a['remoteUri']);_0x5be77a['serverUrl']=intUtil['stripTrailingSlash'](_0x5be77a[_0x1f70('0x3f')]);var _0x59fea3=_0x5be77a[_0x1f70('0x40')];_0x5b3c12[_0x1f70('0xe')]=_0x5be77a[_0x1f70('0x41')];_0x5b3c12['contactNumber']=_0xc0b1fc[_0x1f70('0x42')]()==='outbound'?_0x37197c[_0x1f70('0x43')]:_0x37197c[_0x1f70('0x44')];_0x5b3c12['callDirection']=_0xc0b1fc==='queue'||_0xc0b1fc===_0x1f70('0x45')?_0x1f70('0x46'):'outbound';if(_0x3b2592){_0x5b3c12[_0x1f70('0x16')]=_0x3b2592['email'];}var _0x32a2b5=util['format'](_0x1f70('0x47'),_0x5be77a[_0x1f70('0x3f')],_0x37197c[_0x1f70('0x48')],md5(_0x37197c[_0x1f70('0x48')]));if(_0x122b6a&&_0x122b6a[_0x1f70('0x49')]){logger[_0x1f70('0xf')](_0x1f70('0x4a'),_0x1f70('0x4b'));_0x37197c[_0x1f70('0x4c')]=_0x32a2b5;}else if(_0x52e806&&_0x52e806[_0x1f70('0x4d')]&&_0x52e806[_0x1f70('0x4d')]!==_0x1f70('0x4e')){logger['info']('[OUTBOUND]',_0x1f70('0x4b'));_0x37197c[_0x1f70('0x4c')]=_0x32a2b5;}else{_0x37197c[_0x1f70('0x4c')]='';}return getAdminId(_0x5b3c12,_0xc0b1fc,_0x3c10b8,_0x59fea3)[_0x1f70('0x25')](getUser(_0xc0b1fc,_0x3c10b8,_0x59fea3))[_0x1f70('0x25')](getEndUser(_0xc0b1fc,_0x3c10b8,_0x59fea3))[_0x1f70('0x25')](getTicket(_0xc0b1fc,_0x3c10b8,_0x59fea3,_0x582e6f,_0x37197c))[_0x1f70('0x25')](function(_0x38cce6){logger[_0x1f70('0xf')](util['format'](_0x1f70('0x4f'),_0x38cce6[_0x1f70('0x37')]));if(_0xc0b1fc!==_0x1f70('0x45')){logger[_0x1f70('0xf')]('['+[_0xc0b1fc[_0x1f70('0x13')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x59fea3,_0x3b2592[_0x1f70('0x50')],_0x38cce6[_0x1f70('0x27')]);}})['catch'](function(_0x217da3){logger[_0x1f70('0x12')]('['+[_0xc0b1fc[_0x1f70('0x13')]()]+_0x1f70('0x51'),util[_0x1f70('0x52')](_0x217da3,{'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 a5f78a0..2948583 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 _0x4ca7=['toLowerCase','data1','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ca7,0x103));var _0x74ca=function(_0x2e5ea3,_0x5cee84){_0x2e5ea3=_0x2e5ea3-0x0;var _0x293973=_0x4ca7[_0x2e5ea3];return _0x293973;};'use strict';var _=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var zendesk=require(_0x74ca('0x2'));var salesforce=require(_0x74ca('0x3'));var sugarcrm=require(_0x74ca('0x4'));var freshdesk=require(_0x74ca('0x5'));var zoho=require(_0x74ca('0x6'));var desk=require(_0x74ca('0x7'));var vtiger=require(_0x74ca('0x8'));var servicenow=require(_0x74ca('0x9'));var dynamics365=require(_0x74ca('0xa'));var freshsales=require(_0x74ca('0xb'));var integrations=['zendesk',_0x74ca('0xc'),_0x74ca('0xd'),_0x74ca('0xe'),_0x74ca('0xf'),_0x74ca('0x10'),_0x74ca('0x11'),_0x74ca('0x12'),_0x74ca('0x13'),'servicenow'];exports[_0x74ca('0x14')]=function(_0x548ed2,_0x3f15fa,_0x5e6de5,_0x22f0c2,_0x34301c,_0x4e1102){if(_0x5e6de5){if(_['includes'](integrations,_0x548ed2['data1'][_0x74ca('0x15')]())){try{var _0x458b90=null;var _0x25ba0e='';var _0x4e9644=_0x5e6de5[_0x548ed2[_0x74ca('0x16')][_0x74ca('0x15')]()];if(_0x4e9644){var _0x41e1eb=_0x4e9644[_0x548ed2['data2']];if(_0x41e1eb){var _0x7d1f49=_[_0x74ca('0x17')](_0x41e1eb['Configurations'],{'id':parseInt(_0x548ed2[_0x74ca('0x18')],0xa)});if(_0x7d1f49){if(_0x22f0c2){if(_0x34301c&&_0x3f15fa[_0x74ca('0x19')]){_0x25ba0e=_0x74ca('0x19');}else if(_0x3f15fa[_0x74ca('0x1a')]){_0x25ba0e=_0x74ca('0x1b');}else{console[_0x74ca('0x1c')](_0x74ca('0x1d'),_0x3f15fa);}}else{_0x25ba0e=_0x74ca('0x1e');}switch(_0x548ed2[_0x74ca('0x16')][_0x74ca('0x15')]()){case'zendesk':zendesk[_0x25ba0e](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102);break;case'salesforce':salesforce[_0x25ba0e](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102);break;case _0x74ca('0xd'):sugarcrm[_0x25ba0e](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102);break;case _0x74ca('0xe'):freshdesk[_0x25ba0e](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102);break;case'zoho':zoho[_0x25ba0e](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102);break;case _0x74ca('0x10'):desk[_0x25ba0e](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102);break;case'vtiger':vtiger[_0x25ba0e](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102);break;case _0x74ca('0x13'):freshsales['cs'](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102,_0x25ba0e);break;case _0x74ca('0x1f'):servicenow['cs'](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102,_0x25ba0e);break;case _0x74ca('0x12'):dynamics365['cs'](_0x548ed2,_0x3f15fa,_0x7d1f49,_0x22f0c2,_0x34301c,_0x41e1eb,_0x4e1102,_0x25ba0e);break;default:console[_0x74ca('0x1c')](_0x74ca('0x20'));}}else{_0x458b90=require(_0x74ca('0x21'))(_0x548ed2[_0x74ca('0x16')][_0x74ca('0x15')]());_0x458b90[_0x74ca('0x22')](_0x74ca('0x23'),util[_0x74ca('0x24')](_0x74ca('0x25'),_0x548ed2['data1'][_0x74ca('0x15')](),_0x548ed2[_0x74ca('0x18')]));}}else{_0x458b90=require(_0x74ca('0x21'))(_0x548ed2['data1'][_0x74ca('0x15')]());_0x458b90['error'](_0x74ca('0x23'),util[_0x74ca('0x24')](_0x74ca('0x26'),_0x548ed2[_0x74ca('0x16')][_0x74ca('0x15')](),_0x548ed2[_0x74ca('0x27')]));}}else{}}catch(_0x5edc64){console[_0x74ca('0x22')](_0x5edc64);}}}}; \ No newline at end of file +var _0x43c5=['sugarcrm','freshdesk','zoho','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x43c5,0xd8));var _0x543c=function(_0x6678b6,_0x492b83){_0x6678b6=_0x6678b6-0x0;var _0x484384=_0x43c5[_0x6678b6];return _0x484384;};'use strict';var _=require(_0x543c('0x0'));var util=require(_0x543c('0x1'));var zendesk=require(_0x543c('0x2'));var salesforce=require(_0x543c('0x3'));var sugarcrm=require(_0x543c('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x543c('0x5'));var desk=require('./desk');var vtiger=require(_0x543c('0x6'));var servicenow=require(_0x543c('0x7'));var dynamics365=require(_0x543c('0x8'));var freshsales=require(_0x543c('0x9'));var integrations=[_0x543c('0xa'),_0x543c('0xb'),_0x543c('0xc'),_0x543c('0xd'),_0x543c('0xe'),'desk','vtiger',_0x543c('0xf'),_0x543c('0x10'),_0x543c('0x11')];exports[_0x543c('0x12')]=function(_0x2af447,_0x258a7c,_0x5289a2,_0x36fa3d,_0x12acf6,_0x57bc10){if(_0x5289a2){if(_[_0x543c('0x13')](integrations,_0x2af447[_0x543c('0x14')][_0x543c('0x15')]())){try{var _0x19aed4=null;var _0x5dffc9='';var _0x594b9e=_0x5289a2[_0x2af447[_0x543c('0x14')]['toLowerCase']()];if(_0x594b9e){var _0x4f0462=_0x594b9e[_0x2af447['data2']];if(_0x4f0462){var _0x1be899=_['find'](_0x4f0462[_0x543c('0x16')],{'id':parseInt(_0x2af447[_0x543c('0x17')],0xa)});if(_0x1be899){if(_0x36fa3d){if(_0x12acf6&&_0x258a7c['queue']){_0x5dffc9=_0x543c('0x18');}else if(_0x258a7c[_0x543c('0x19')]){_0x5dffc9=_0x543c('0x1a');}else{console[_0x543c('0x1b')](_0x543c('0x1c'),_0x258a7c);}}else{_0x5dffc9=_0x543c('0x1d');}switch(_0x2af447[_0x543c('0x14')][_0x543c('0x15')]()){case'zendesk':zendesk[_0x5dffc9](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10);break;case _0x543c('0xb'):salesforce[_0x5dffc9](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10);break;case _0x543c('0xc'):sugarcrm[_0x5dffc9](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10);break;case _0x543c('0xd'):freshdesk[_0x5dffc9](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10);break;case _0x543c('0xe'):zoho[_0x5dffc9](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10);break;case _0x543c('0x1e'):desk[_0x5dffc9](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10);break;case _0x543c('0x1f'):vtiger[_0x5dffc9](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10);break;case'freshsales':freshsales['cs'](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10,_0x5dffc9);break;case _0x543c('0x11'):servicenow['cs'](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10,_0x5dffc9);break;case'dynamics365':dynamics365['cs'](_0x2af447,_0x258a7c,_0x1be899,_0x36fa3d,_0x12acf6,_0x4f0462,_0x57bc10,_0x5dffc9);break;default:console[_0x543c('0x1b')](_0x543c('0x20'));}}else{_0x19aed4=require(_0x543c('0x21'))(_0x2af447['data1'][_0x543c('0x15')]());_0x19aed4[_0x543c('0x22')](_0x543c('0x23'),util[_0x543c('0x24')](_0x543c('0x25'),_0x2af447[_0x543c('0x14')][_0x543c('0x15')](),_0x2af447[_0x543c('0x17')]));}}else{_0x19aed4=require(_0x543c('0x21'))(_0x2af447['data1'][_0x543c('0x15')]());_0x19aed4[_0x543c('0x22')](_0x543c('0x23'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x2af447[_0x543c('0x14')][_0x543c('0x15')](),_0x2af447['data2']));}}else{}}catch(_0x124907){console[_0x543c('0x22')](_0x124907);}}}}; \ 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 9e974ba..7ff506a 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 _0x68a7=['LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Name','upperFirst','create','forEach','string','picklist','idField','content','variableName','toString','customVariable','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','WhatId','Case','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','Lead','additionalSearchAccount','$or','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.'];(function(_0x1aac6d,_0x44a251){var _0xfcba03=function(_0x1d9db8){while(--_0x1d9db8){_0x1aac6d['push'](_0x1aac6d['shift']());}};_0xfcba03(++_0x44a251);}(_0x68a7,0xce));var _0x768a=function(_0xec0d71,_0x2c44e8){_0xec0d71=_0xec0d71-0x0;var _0x23e2b0=_0x68a7[_0xec0d71];return _0x23e2b0;};'use strict';var _=require(_0x768a('0x0'));var rp=require(_0x768a('0x1'));var moment=require('moment');var BPromise=require(_0x768a('0x2'));var md5=require(_0x768a('0x3'));var jsforce=require(_0x768a('0x4'));var util=require(_0x768a('0x5'));var Redis=require(_0x768a('0x6'));var intUtil=require('./util');var config=require(_0x768a('0x7'));var logger=require(_0x768a('0x8'))(_0x768a('0x9'));config[_0x768a('0xa')]=_[_0x768a('0xb')](config[_0x768a('0xa')],{'host':_0x768a('0xc'),'port':0x18eb});var io=require(_0x768a('0xd'))(new Redis(config['redis']));function emit(_0x488334,_0x2f68c7,_0x4a648a){io['to'](_0x488334)['emit'](_0x2f68c7,_0x4a648a);}function getTicket(_0x436819,_0x28d358,_0x11c081,_0x1f8205,_0x57148f,_0x1cd898,_0x4802cb,_0x2bf4de){var _0x21392c=Object[_0x768a('0xe')]({},{'OwnerId':_0x28d358['id'],'Subject':intUtil[_0x768a('0xf')](_0x1f8205['Subjects'],_0x57148f,'\x20'),'Description':intUtil[_0x768a('0xf')](_0x1f8205[_0x768a('0x10')],_0x57148f,'\x0a')},getCustomFields(_0x1cd898,_0x57148f));if(_0x11c081){if(_0x1f8205[_0x768a('0x11')]===_0x768a('0x12')){_0x21392c[_0x768a('0x13')]=moment[_0x768a('0x14')]();_0x21392c['IsReminderSet']=![];_0x21392c[_0x768a('0x15')]=![];if(_0x11c081[_0x768a('0x16')]===_0x768a('0x17')||_0x11c081['endUserType']==='lead'){_0x21392c[_0x768a('0x18')]=_0x11c081['id'];}else if(_0x11c081[_0x768a('0x16')]==='account'){_0x21392c[_0x768a('0x19')]=_0x11c081['id'];}}else if(_0x1f8205[_0x768a('0x11')]===_0x768a('0x1a')){if(_0x11c081['endUserType']===_0x768a('0x17')){_0x21392c[_0x768a('0x1b')]=_0x11c081['id'];}else if(_0x11c081[_0x768a('0x16')]===_0x768a('0x1c')){_0x21392c[_0x768a('0x1d')]=_0x11c081['id'];}else if(_0x11c081['endUserType']==='lead'&&_0x1f8205[_0x768a('0x1e')]){_0x21392c[_0x1f8205[_0x768a('0x1e')]]=_0x11c081['id'];}else{logger[_0x768a('0x1f')](_0x768a('0x20'));}}}return _0x4802cb[_0x768a('0x21')](_0x1f8205[_0x768a('0x11')])['create'](_0x21392c);}function getUser(_0x11adb3,_0xba5d03,_0x22f682){if(!_[_0x768a('0x22')](_0xba5d03)&&intUtil[_0x768a('0x23')](_0xba5d03)){var _0x393cba={'Email':_0xba5d03};var _0x4e557c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x22f682[_0x768a('0x21')](_0x768a('0x24'))[_0x768a('0x25')](_0x393cba,_0x4e557c)[_0x768a('0x26')]()['then'](function(_0x35d189){if(_0x35d189[_0x768a('0x27')]){var _0x58e191=_['find'](_0x35d189,function(_0x31bd1c){return _0x31bd1c[_0x768a('0x28')]===_0xba5d03;});if(_0x58e191){logger[_0x768a('0x1f')](_0x768a('0x29'),_0xba5d03);return BPromise[_0x768a('0x2a')]({'id':_0x58e191['Id'],'name':_0x58e191['Name']});}}else{logger['info'](_0x768a('0x2b'),_0xba5d03);return _0x22f682[_0x768a('0x2c')]()[_0x768a('0x2d')](function(_0x48fcaa){return BPromise[_0x768a('0x2a')]({'id':_0x48fcaa[_0x768a('0x2e')],'name':_0x48fcaa[_0x768a('0x2f')]});});}});}else{logger[_0x768a('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xba5d03);return _0x22f682[_0x768a('0x2c')]()[_0x768a('0x2d')](function(_0x5bd49f){return BPromise['resolve']({'id':_0x5bd49f[_0x768a('0x2e')],'name':_0x5bd49f[_0x768a('0x2f')]});});}}function getEndUser(_0x3e2620,_0x4fa865,_0x1dd6ed,_0x235ae9,_0x348668){var _0x197305={'$or':{'Phone':_0x235ae9}};var _0x578c2c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x768a('0x2a')]()['then'](function(){logger[_0x768a('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x235ae9,_0x4fa865['moduleSearch']);switch(_0x4fa865[_0x768a('0x30')]){case _0x768a('0x31'):var _0x33f382=_[_0x768a('0x32')](_0x197305);if(_0x4fa865['additionalSearchContact']){var _0x546802={};_0x546802[_0x4fa865[_0x768a('0x33')]]=_0x235ae9;_['merge'](_0x33f382['$or'],_0x546802);}return _0x348668[_0x768a('0x21')](_0x768a('0x34'))[_0x768a('0x25')](_0x33f382,_0x578c2c)[_0x768a('0x26')]()[_0x768a('0x2d')](function(_0x24cca2){if(_0x24cca2&&_0x24cca2['length']){return _0x24cca2;}else{var _0x36ad80=_[_0x768a('0x32')](_0x197305);if(_0x4fa865['additionalSearchLead']){var _0x510e76={};_0x510e76[_0x4fa865[_0x768a('0x35')]]=_0x235ae9;_[_0x768a('0x36')](_0x36ad80['$or'],_0x510e76);}return _0x348668[_0x768a('0x21')](_0x768a('0x37'))['find'](_0x36ad80,_0x578c2c);}});case'account_contact_lead':var _0x3c48bb=_['cloneDeep'](_0x197305);if(_0x4fa865[_0x768a('0x38')]){var _0x546802={};_0x546802[_0x4fa865[_0x768a('0x38')]]=_0x235ae9;_['merge'](_0x3c48bb['$or'],_0x546802);}return _0x348668[_0x768a('0x21')]('Account')[_0x768a('0x25')](_0x3c48bb,_0x578c2c)[_0x768a('0x26')]()[_0x768a('0x2d')](function(_0xf9cb50){if(_0xf9cb50&&_0xf9cb50[_0x768a('0x27')]){return _0xf9cb50;}else{var _0x2fe530=_[_0x768a('0x32')](_0x197305);if(_0x4fa865['additionalSearchContact']){var _0x570bfe={};_0x570bfe[_0x4fa865[_0x768a('0x33')]]=_0x235ae9;_[_0x768a('0x36')](_0x2fe530[_0x768a('0x39')],_0x570bfe);}return _0x348668[_0x768a('0x21')](_0x768a('0x34'))['find'](_0x2fe530,_0x578c2c)[_0x768a('0x2d')](function(_0x162564){if(_0x162564&&_0x162564['length']){return _0x162564;}else{var _0x681893=_[_0x768a('0x32')](_0x197305);if(_0x4fa865[_0x768a('0x35')]){var _0x807359={};_0x807359[_0x4fa865['additionalSearchLead']]=_0x235ae9;_[_0x768a('0x36')](_0x681893[_0x768a('0x39')],_0x807359);}return _0x348668[_0x768a('0x21')]('Lead')['find'](_0x681893,_0x578c2c);}});}});case _0x768a('0x17'):var _0x33f382=_[_0x768a('0x32')](_0x197305);if(_0x4fa865[_0x768a('0x33')]){var _0x546802={};_0x546802[_0x4fa865['additionalSearchContact']]=_0x235ae9;_[_0x768a('0x36')](_0x33f382[_0x768a('0x39')],_0x546802);}return _0x348668[_0x768a('0x21')]('Contact')['find'](_0x33f382,_0x578c2c)[_0x768a('0x26')]();case'lead':var _0xea3990=_['cloneDeep'](_0x197305);if(_0x4fa865[_0x768a('0x35')]){var _0x546802={};_0x546802[_0x4fa865['additionalSearchLead']]=_0x235ae9;_[_0x768a('0x36')](_0xea3990['$or'],_0x546802);}return _0x348668[_0x768a('0x21')](_0x768a('0x37'))[_0x768a('0x25')](_0xea3990,_0x578c2c);case _0x768a('0x1c'):var _0x3c48bb=_[_0x768a('0x32')](_0x197305);if(_0x4fa865['additionalSearchAccount']){var _0x546802={};_0x546802[_0x4fa865['additionalSearchAccount']]=_0x235ae9;_['merge'](_0x3c48bb[_0x768a('0x39')],_0x546802);}return _0x348668[_0x768a('0x21')](_0x768a('0x3a'))[_0x768a('0x25')](_0x3c48bb,_0x578c2c);default:return null;}})[_0x768a('0x2d')](function(_0xf45d32){if(_0xf45d32&&_0xf45d32[_0x768a('0x27')]){var _0x3185d9=_[_0x768a('0x3b')](_0xf45d32);if(_0x3185d9){return BPromise[_0x768a('0x2a')]({'id':_0x3185d9['Id'],'name':_0x3185d9['Name'],'phone':_0x3185d9[_0x768a('0x3c')],'endUserType':_0x3185d9[_0x768a('0x3d')][_0x768a('0x3e')][_0x768a('0x3f')]()});}}})[_0x768a('0x2d')](function(_0x39b4e6){if(_0x39b4e6){logger[_0x768a('0x1f')](_0x768a('0x40'),_0x39b4e6[_0x768a('0x16')],_0x235ae9);return BPromise[_0x768a('0x2a')](_0x39b4e6);}else{logger[_0x768a('0x1f')](_0x768a('0x41'),_0x235ae9);var _0x5cae99={'Phone':_0x235ae9};if(_0x4fa865['moduleCreate']){if(_0x4fa865[_0x768a('0x42')]===_0x768a('0x17')){logger['info'](_0x768a('0x43'),_0x235ae9,_0x4fa865[_0x768a('0x42')]);_0x5cae99[_0x768a('0x44')]=_0x1dd6ed!==_0x768a('0x45')?_0x1dd6ed:util[_0x768a('0x46')](_0x768a('0x47'),_0x235ae9);}else if(_0x4fa865[_0x768a('0x42')]==='lead'){logger['info'](_0x768a('0x43'),_0x235ae9,_0x4fa865[_0x768a('0x42')]);_0x5cae99[_0x768a('0x44')]=_0x1dd6ed!==_0x768a('0x45')?_0x1dd6ed:util[_0x768a('0x46')]('Caller\x20-\x20%s',_0x235ae9);_0x5cae99[_0x768a('0x48')]=_0x768a('0x49');}else if(_0x4fa865[_0x768a('0x42')]==='account'){logger['info'](_0x768a('0x43'),_0x235ae9,_0x4fa865['moduleCreate']);_0x5cae99[_0x768a('0x4a')]=_0x1dd6ed!==_0x768a('0x45')?_0x1dd6ed:util['format'](_0x768a('0x47'),_0x235ae9);}else{return null;}}return _0x348668[_0x768a('0x21')](_[_0x768a('0x4b')](_0x4fa865[_0x768a('0x42')]))[_0x768a('0x4c')](_0x5cae99)[_0x768a('0x2d')](function(_0x3f6fe6){return BPromise['resolve']({'id':_0x3f6fe6['id'],'endUserType':_0x4fa865[_0x768a('0x42')]});});}});}function getCustomFields(_0x8d8342,_0x15da90){var _0x529215={};if(_0x8d8342[_0x768a('0x27')]>0x0){_[_0x768a('0x4d')](_0x8d8342,function(_0x3fae02){if(_['includes']([_0x768a('0x4e'),_0x768a('0x4f')],_0x3fae02['type'])&&_0x3fae02[_0x768a('0x50')]){_0x529215[_0x3fae02[_0x768a('0x50')]]=_0x3fae02[_0x768a('0x51')]['toString']();}else if(_0x3fae02['type']==='variable'&&_0x3fae02['variableName']&&_0x3fae02[_0x768a('0x50')]){_0x15da90[_0x3fae02[_0x768a('0x52')]]&&(_0x529215[_0x3fae02[_0x768a('0x50')]]=_0x15da90[_0x3fae02[_0x768a('0x52')]][_0x768a('0x53')]());}else if(_0x3fae02[_0x768a('0x3e')]===_0x768a('0x54')&&_0x3fae02[_0x768a('0x55')]&&_0x3fae02[_0x768a('0x55')][_0x768a('0x56')]&&_0x3fae02[_0x768a('0x50')]){_0x15da90[_0x3fae02[_0x768a('0x55')]['name'][_0x768a('0x3f')]()]&&(_0x529215[_0x3fae02[_0x768a('0x50')]]=_0x15da90[_0x3fae02[_0x768a('0x55')][_0x768a('0x56')][_0x768a('0x3f')]()][_0x768a('0x53')]());}});}return _0x529215;}function getConnection(_0x23d66){var _0x335927=_0x23d66[_0x768a('0x57')][_0x768a('0x58')](_0x23d66[_0x768a('0x59')]);var _0x19c7f4=new jsforce[(_0x768a('0x5a'))]({'oauth2':{'loginUrl':_0x23d66['remoteUri']||_0x768a('0x5b'),'clientId':_0x23d66[_0x768a('0x5c')],'clientSecret':_0x23d66[_0x768a('0x5d')]}});return _0x19c7f4[_0x768a('0x5e')](_0x23d66[_0x768a('0x5f')],_0x335927)[_0x768a('0x2d')](function(){logger['info'](_0x768a('0x60'));return _0x19c7f4;});}exports[_0x768a('0x61')]=function(_0x3efed9,_0x11a340,_0x2ff56c,_0x284be2,_0x24adcf,_0x52e449){var _0x45df03,_0x2c9b66,_0x3605bd,_0x254923;_0x52e449[_0x768a('0x62')]=intUtil[_0x768a('0x63')](_0x52e449[_0x768a('0x62')]);_0x52e449[_0x768a('0x64')]=intUtil[_0x768a('0x63')](_0x52e449[_0x768a('0x64')]);if(_0x24adcf&&_0x24adcf[_0x768a('0x65')]){logger[_0x768a('0x1f')](_0x768a('0x66'),_0x768a('0x67'));_0x11a340[_0x768a('0x68')]=util[_0x768a('0x46')](_0x768a('0x69'),_0x52e449[_0x768a('0x62')],_0x11a340[_0x768a('0x6a')],md5(_0x11a340[_0x768a('0x6a')]));}else{_0x11a340[_0x768a('0x68')]='';}return getConnection(_0x52e449)['then'](function(_0x47cbf5){_0x254923=_0x47cbf5;return getUser(_0x52e449,_0x284be2['email'],_0x254923);})['then'](function(_0x6601a8){_0x45df03=_0x6601a8;return getEndUser(_0x52e449,_0x2ff56c,_0x11a340[_0x768a('0x6b')],_0x11a340['calleridnum'],_0x254923);})[_0x768a('0x2d')](function(_0x19e415){_0x2c9b66=_0x19e415;return getTicket(_0x52e449,_0x45df03,_0x2c9b66,_0x2ff56c,_0x11a340,_0x2ff56c[_0x768a('0x6c')],_0x254923,_0x768a('0x61'));})[_0x768a('0x2d')](function(_0x226268){_0x3605bd=_0x226268;logger[_0x768a('0x1f')](_0x768a('0x6d'),_0x3605bd['id']);logger[_0x768a('0x1f')](_0x768a('0x6e'),_0x3605bd['id'],_0x284be2[_0x768a('0x56')],_0x52e449['type']);switch(_0x52e449[_0x768a('0x3e')]){case'integrationTab':emit(util[_0x768a('0x46')](_0x768a('0x6f'),_0x284be2[_0x768a('0x56')]),_0x768a('0x70'),{'recordId':_0x3605bd['id']});break;case _0x768a('0x71'):emit(util[_0x768a('0x46')]('user:%s',_0x284be2['name']),_0x768a('0x72'),{'uri':util['format'](_0x768a('0x73'),_0x254923[_0x768a('0x74')],_0x3605bd['id'])});break;default:logger[_0x768a('0x75')](_0x768a('0x76'));}})[_0x768a('0x77')](function(_0x408739){logger[_0x768a('0x75')](_0x768a('0x66'),_0x408739);});};exports[_0x768a('0x78')]=function(_0x1a3ab7,_0x44c5da,_0x513dbd,_0x4c64b9,_0x112ba9,_0x10f5d2,_0x2b2249){var _0x4b1e53,_0xbc4f2e,_0x5522ca,_0x1b4916;_0x10f5d2['serverUrl']=intUtil['stripTrailingSlash'](_0x10f5d2[_0x768a('0x62')]);_0x10f5d2['remoteUri']=intUtil[_0x768a('0x63')](_0x10f5d2[_0x768a('0x64')]);if(_0x2b2249&&_0x2b2249[_0x768a('0x79')]&&_0x2b2249[_0x768a('0x79')]!==_0x768a('0x7a')){logger[_0x768a('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x44c5da[_0x768a('0x68')]=util[_0x768a('0x46')](_0x768a('0x69'),_0x10f5d2[_0x768a('0x62')],_0x44c5da[_0x768a('0x6a')],md5(_0x44c5da[_0x768a('0x6a')]));}return getConnection(_0x10f5d2)[_0x768a('0x2d')](function(_0x1a6fae){_0x1b4916=_0x1a6fae;return getUser(_0x10f5d2,_0x4c64b9[_0x768a('0x7b')],_0x1b4916);})[_0x768a('0x2d')](function(_0x1d756c){_0x4b1e53=_0x1d756c;return getEndUser(_0x10f5d2,_0x513dbd,_0x44c5da[_0x768a('0x7c')],_0x44c5da[_0x768a('0x7d')],_0x1b4916);})['then'](function(_0x4b7b7a){_0xbc4f2e=_0x4b7b7a;return getTicket(_0x10f5d2,_0x4b1e53,_0xbc4f2e,_0x513dbd,_0x44c5da,_0x513dbd['Fields'],_0x1b4916,'outbound');})[_0x768a('0x2d')](function(_0x4fe785){_0x5522ca=_0x4fe785;logger[_0x768a('0x1f')](_0x768a('0x7e'),_0x5522ca['id']);logger['info'](_0x768a('0x7f'),_0x5522ca['id'],_0x4c64b9['name'],_0x10f5d2[_0x768a('0x3e')]);switch(_0x10f5d2[_0x768a('0x3e')]){case _0x768a('0x80'):emit(util[_0x768a('0x46')](_0x768a('0x6f'),_0x4c64b9[_0x768a('0x56')]),_0x768a('0x70'),{'recordId':_0x5522ca['id']});break;case _0x768a('0x71'):emit(util[_0x768a('0x46')]('user:%s',_0x4c64b9[_0x768a('0x56')]),_0x768a('0x72'),{'uri':util[_0x768a('0x46')](_0x768a('0x73'),_0x1b4916['instanceUrl'],_0x5522ca['id'])});break;default:logger[_0x768a('0x75')](_0x768a('0x81'),_0x768a('0x82'));}})['catch'](function(_0x2c1a9f){logger['error'](_0x768a('0x81'),_0x2c1a9f);});};exports[_0x768a('0x83')]=function(_0x1393b4,_0x20c8b8,_0x165cd3,_0x35bd53,_0x41740c,_0x1b28dd){var _0x5a99ea,_0x3053ab,_0xc017e5,_0x475102;_0x1b28dd[_0x768a('0x62')]=intUtil[_0x768a('0x63')](_0x1b28dd['serverUrl']);_0x1b28dd[_0x768a('0x64')]=intUtil[_0x768a('0x63')](_0x1b28dd[_0x768a('0x64')]);if(_0x41740c&&_0x41740c[_0x768a('0x65')]){logger[_0x768a('0x1f')]('['+_0x20c8b8[_0x768a('0x84')][_0x768a('0x85')]()+']',_0x768a('0x67'));_0x20c8b8[_0x768a('0x68')]=util['format'](_0x768a('0x69'),_0x1b28dd['serverUrl'],_0x20c8b8[_0x768a('0x6a')],md5(_0x20c8b8[_0x768a('0x6a')]));}else{_0x20c8b8[_0x768a('0x68')]='';}return getConnection(_0x1b28dd)['then'](function(_0x2fd6d0){_0x475102=_0x2fd6d0;if(!_[_0x768a('0x22')](_0x35bd53)){return getUser(_0x1b28dd,_0x35bd53[_0x768a('0x56')],_0x475102);}else{return getUser(_0x1b28dd,null,_0x475102);}})[_0x768a('0x2d')](function(_0x57b042){_0x5a99ea=_0x57b042;return getEndUser(_0x1b28dd,_0x165cd3,_0x20c8b8[_0x768a('0x6b')],_0x20c8b8[_0x768a('0x86')],_0x475102);})[_0x768a('0x2d')](function(_0x58d8f3){_0x3053ab=_0x58d8f3;return getTicket(_0x1b28dd,_0x5a99ea,_0x3053ab,_0x165cd3,_0x20c8b8,_0x165cd3[_0x768a('0x6c')],_0x475102);})[_0x768a('0x2d')](function(_0x476298){_0xc017e5=_0x476298;logger['info']('['+_0x20c8b8[_0x768a('0x84')][_0x768a('0x85')]()+_0x768a('0x87'),_0xc017e5['id']);logger[_0x768a('0x1f')]('['+_0x20c8b8['lastevent'][_0x768a('0x85')]()+_0x768a('0x88'),_0x1b28dd[_0x768a('0x3e')]);})[_0x768a('0x77')](function(_0x651c44){logger[_0x768a('0x75')]('['+_0x20c8b8['lastevent'][_0x768a('0x85')]()+']',_0x651c44);});}; \ No newline at end of file +var _0xf4ae=['merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','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','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','create','string','idField','toString','type','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','instanceUrl','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','%s/%s/e','error','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase','isNil','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','util','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','Task','utc','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','ticketType','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact'];(function(_0x20193d,_0x2730ea){var _0x118fdc=function(_0x5dc097){while(--_0x5dc097){_0x20193d['push'](_0x20193d['shift']());}};_0x118fdc(++_0x2730ea);}(_0xf4ae,0xce));var _0xef4a=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xf4ae[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xef4a('0x0'));var BPromise=require(_0xef4a('0x1'));var md5=require(_0xef4a('0x2'));var jsforce=require(_0xef4a('0x3'));var util=require(_0xef4a('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xef4a('0x5'));config[_0xef4a('0x6')]=_[_0xef4a('0x7')](config[_0xef4a('0x6')],{'host':_0xef4a('0x8'),'port':0x18eb});var io=require(_0xef4a('0x9'))(new Redis(config[_0xef4a('0x6')]));function emit(_0x31f31a,_0x5d98f0,_0x449101){io['to'](_0x31f31a)[_0xef4a('0xa')](_0x5d98f0,_0x449101);}function getTicket(_0x385834,_0x41578f,_0x3940d6,_0x53fbeb,_0x6b62e8,_0x518ec4,_0x1980d0,_0x39e026){var _0x3f5c23=Object[_0xef4a('0xb')]({},{'OwnerId':_0x41578f['id'],'Subject':intUtil['getString'](_0x53fbeb['Subjects'],_0x6b62e8,'\x20'),'Description':intUtil[_0xef4a('0xc')](_0x53fbeb[_0xef4a('0xd')],_0x6b62e8,'\x0a')},getCustomFields(_0x518ec4,_0x6b62e8));if(_0x3940d6){if(_0x53fbeb['ticketType']===_0xef4a('0xe')){_0x3f5c23['ActivityDate']=moment[_0xef4a('0xf')]();_0x3f5c23['IsReminderSet']=![];_0x3f5c23[_0xef4a('0x10')]=![];if(_0x3940d6['endUserType']===_0xef4a('0x11')||_0x3940d6[_0xef4a('0x12')]===_0xef4a('0x13')){_0x3f5c23[_0xef4a('0x14')]=_0x3940d6['id'];}else if(_0x3940d6[_0xef4a('0x12')]===_0xef4a('0x15')){_0x3f5c23[_0xef4a('0x16')]=_0x3940d6['id'];}}else if(_0x53fbeb[_0xef4a('0x17')]===_0xef4a('0x18')){if(_0x3940d6[_0xef4a('0x12')]===_0xef4a('0x11')){_0x3f5c23['ContactId']=_0x3940d6['id'];}else if(_0x3940d6[_0xef4a('0x12')]===_0xef4a('0x15')){_0x3f5c23['AccountId']=_0x3940d6['id'];}else if(_0x3940d6[_0xef4a('0x12')]==='lead'&&_0x53fbeb[_0xef4a('0x19')]){_0x3f5c23[_0x53fbeb[_0xef4a('0x19')]]=_0x3940d6['id'];}else{logger[_0xef4a('0x1a')](_0xef4a('0x1b'));}}}return _0x1980d0[_0xef4a('0x1c')](_0x53fbeb[_0xef4a('0x17')])['create'](_0x3f5c23);}function getUser(_0x596736,_0x51e2c6,_0x4e8464){if(!_['isNil'](_0x51e2c6)&&intUtil[_0xef4a('0x1d')](_0x51e2c6)){var _0x1269e2={'Email':_0x51e2c6};var _0x4af0e9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4e8464[_0xef4a('0x1c')]('User')[_0xef4a('0x1e')](_0x1269e2,_0x4af0e9)[_0xef4a('0x1f')]()[_0xef4a('0x20')](function(_0x3f658b){if(_0x3f658b[_0xef4a('0x21')]){var _0x12d19a=_[_0xef4a('0x1e')](_0x3f658b,function(_0x1e7c01){return _0x1e7c01[_0xef4a('0x22')]===_0x51e2c6;});if(_0x12d19a){logger[_0xef4a('0x1a')](_0xef4a('0x23'),_0x51e2c6);return BPromise[_0xef4a('0x24')]({'id':_0x12d19a['Id'],'name':_0x12d19a[_0xef4a('0x25')]});}}else{logger['info'](_0xef4a('0x26'),_0x51e2c6);return _0x4e8464['identity']()[_0xef4a('0x20')](function(_0x41f1f7){return BPromise[_0xef4a('0x24')]({'id':_0x41f1f7['user_id'],'name':_0x41f1f7['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x51e2c6);return _0x4e8464[_0xef4a('0x27')]()['then'](function(_0x2088e9){return BPromise['resolve']({'id':_0x2088e9[_0xef4a('0x28')],'name':_0x2088e9['display_name']});});}}function getEndUser(_0x1e7564,_0x269a5c,_0xc4605e,_0x53b5b9,_0x14dfc8){var _0x5051ca={'$or':{'Phone':_0x53b5b9}};var _0x55f4bb={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xef4a('0x20')](function(){logger[_0xef4a('0x1a')](_0xef4a('0x29'),_0x53b5b9,_0x269a5c['moduleSearch']);switch(_0x269a5c[_0xef4a('0x2a')]){case _0xef4a('0x2b'):var _0x4d99bf=_[_0xef4a('0x2c')](_0x5051ca);if(_0x269a5c[_0xef4a('0x2d')]){var _0x31a085={};_0x31a085[_0x269a5c[_0xef4a('0x2d')]]=_0x53b5b9;_[_0xef4a('0x2e')](_0x4d99bf[_0xef4a('0x2f')],_0x31a085);}return _0x14dfc8['sobject']('Contact')[_0xef4a('0x1e')](_0x4d99bf,_0x55f4bb)[_0xef4a('0x1f')]()[_0xef4a('0x20')](function(_0x296321){if(_0x296321&&_0x296321['length']){return _0x296321;}else{var _0x587e90=_['cloneDeep'](_0x5051ca);if(_0x269a5c[_0xef4a('0x30')]){var _0xaf43c4={};_0xaf43c4[_0x269a5c[_0xef4a('0x30')]]=_0x53b5b9;_[_0xef4a('0x2e')](_0x587e90[_0xef4a('0x2f')],_0xaf43c4);}return _0x14dfc8[_0xef4a('0x1c')](_0xef4a('0x31'))[_0xef4a('0x1e')](_0x587e90,_0x55f4bb);}});case _0xef4a('0x32'):var _0x5b863a=_[_0xef4a('0x2c')](_0x5051ca);if(_0x269a5c['additionalSearchAccount']){var _0x31a085={};_0x31a085[_0x269a5c[_0xef4a('0x33')]]=_0x53b5b9;_[_0xef4a('0x2e')](_0x5b863a[_0xef4a('0x2f')],_0x31a085);}return _0x14dfc8[_0xef4a('0x1c')](_0xef4a('0x34'))[_0xef4a('0x1e')](_0x5b863a,_0x55f4bb)[_0xef4a('0x1f')]()[_0xef4a('0x20')](function(_0x1b8dc7){if(_0x1b8dc7&&_0x1b8dc7[_0xef4a('0x21')]){return _0x1b8dc7;}else{var _0x1c4d93=_['cloneDeep'](_0x5051ca);if(_0x269a5c[_0xef4a('0x2d')]){var _0x5c4079={};_0x5c4079[_0x269a5c['additionalSearchContact']]=_0x53b5b9;_[_0xef4a('0x2e')](_0x1c4d93[_0xef4a('0x2f')],_0x5c4079);}return _0x14dfc8[_0xef4a('0x1c')](_0xef4a('0x35'))[_0xef4a('0x1e')](_0x1c4d93,_0x55f4bb)[_0xef4a('0x20')](function(_0xce70ec){if(_0xce70ec&&_0xce70ec['length']){return _0xce70ec;}else{var _0x490992=_[_0xef4a('0x2c')](_0x5051ca);if(_0x269a5c[_0xef4a('0x30')]){var _0x2e6bd2={};_0x2e6bd2[_0x269a5c[_0xef4a('0x30')]]=_0x53b5b9;_[_0xef4a('0x2e')](_0x490992[_0xef4a('0x2f')],_0x2e6bd2);}return _0x14dfc8['sobject'](_0xef4a('0x31'))['find'](_0x490992,_0x55f4bb);}});}});case'contact':var _0x4d99bf=_[_0xef4a('0x2c')](_0x5051ca);if(_0x269a5c[_0xef4a('0x2d')]){var _0x31a085={};_0x31a085[_0x269a5c[_0xef4a('0x2d')]]=_0x53b5b9;_[_0xef4a('0x2e')](_0x4d99bf[_0xef4a('0x2f')],_0x31a085);}return _0x14dfc8['sobject']('Contact')['find'](_0x4d99bf,_0x55f4bb)[_0xef4a('0x1f')]();case'lead':var _0x2fdf5c=_['cloneDeep'](_0x5051ca);if(_0x269a5c[_0xef4a('0x30')]){var _0x31a085={};_0x31a085[_0x269a5c[_0xef4a('0x30')]]=_0x53b5b9;_['merge'](_0x2fdf5c[_0xef4a('0x2f')],_0x31a085);}return _0x14dfc8[_0xef4a('0x1c')](_0xef4a('0x31'))[_0xef4a('0x1e')](_0x2fdf5c,_0x55f4bb);case'account':var _0x5b863a=_[_0xef4a('0x2c')](_0x5051ca);if(_0x269a5c[_0xef4a('0x33')]){var _0x31a085={};_0x31a085[_0x269a5c['additionalSearchAccount']]=_0x53b5b9;_[_0xef4a('0x2e')](_0x5b863a[_0xef4a('0x2f')],_0x31a085);}return _0x14dfc8['sobject'](_0xef4a('0x34'))['find'](_0x5b863a,_0x55f4bb);default:return null;}})[_0xef4a('0x20')](function(_0x1f4be9){if(_0x1f4be9&&_0x1f4be9['length']){var _0x248ac4=_[_0xef4a('0x36')](_0x1f4be9);if(_0x248ac4){return BPromise['resolve']({'id':_0x248ac4['Id'],'name':_0x248ac4[_0xef4a('0x25')],'phone':_0x248ac4[_0xef4a('0x37')],'endUserType':_0x248ac4[_0xef4a('0x38')]['type'][_0xef4a('0x39')]()});}}})[_0xef4a('0x20')](function(_0x5cc5c1){if(_0x5cc5c1){logger['info'](_0xef4a('0x3a'),_0x5cc5c1['endUserType'],_0x53b5b9);return BPromise[_0xef4a('0x24')](_0x5cc5c1);}else{logger[_0xef4a('0x1a')](_0xef4a('0x3b'),_0x53b5b9);var _0x1ff45e={'Phone':_0x53b5b9};if(_0x269a5c[_0xef4a('0x3c')]){if(_0x269a5c[_0xef4a('0x3c')]===_0xef4a('0x11')){logger['info'](_0xef4a('0x3d'),_0x53b5b9,_0x269a5c['moduleCreate']);_0x1ff45e[_0xef4a('0x3e')]=_0xc4605e!==_0xef4a('0x3f')?_0xc4605e:util[_0xef4a('0x40')](_0xef4a('0x41'),_0x53b5b9);}else if(_0x269a5c[_0xef4a('0x3c')]===_0xef4a('0x13')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x53b5b9,_0x269a5c[_0xef4a('0x3c')]);_0x1ff45e[_0xef4a('0x3e')]=_0xc4605e!==''?_0xc4605e:util['format'](_0xef4a('0x41'),_0x53b5b9);_0x1ff45e['Company']=_0xef4a('0x42');}else if(_0x269a5c['moduleCreate']===_0xef4a('0x15')){logger[_0xef4a('0x1a')](_0xef4a('0x3d'),_0x53b5b9,_0x269a5c[_0xef4a('0x3c')]);_0x1ff45e[_0xef4a('0x25')]=_0xc4605e!==_0xef4a('0x3f')?_0xc4605e:util[_0xef4a('0x40')](_0xef4a('0x41'),_0x53b5b9);}else{return null;}}return _0x14dfc8[_0xef4a('0x1c')](_[_0xef4a('0x43')](_0x269a5c['moduleCreate']))[_0xef4a('0x44')](_0x1ff45e)[_0xef4a('0x20')](function(_0x3b51e1){return BPromise['resolve']({'id':_0x3b51e1['id'],'endUserType':_0x269a5c[_0xef4a('0x3c')]});});}});}function getCustomFields(_0x1732e6,_0x5e7bc8){var _0x32c936={};if(_0x1732e6[_0xef4a('0x21')]>0x0){_['forEach'](_0x1732e6,function(_0x101140){if(_['includes']([_0xef4a('0x45'),'picklist'],_0x101140['type'])&&_0x101140[_0xef4a('0x46')]){_0x32c936[_0x101140[_0xef4a('0x46')]]=_0x101140['content'][_0xef4a('0x47')]();}else if(_0x101140[_0xef4a('0x48')]===_0xef4a('0x49')&&_0x101140[_0xef4a('0x4a')]&&_0x101140[_0xef4a('0x46')]){_0x5e7bc8[_0x101140[_0xef4a('0x4a')]]&&(_0x32c936[_0x101140['idField']]=_0x5e7bc8[_0x101140[_0xef4a('0x4a')]][_0xef4a('0x47')]());}else if(_0x101140[_0xef4a('0x48')]===_0xef4a('0x4b')&&_0x101140['Variable']&&_0x101140['Variable']['name']&&_0x101140[_0xef4a('0x46')]){_0x5e7bc8[_0x101140[_0xef4a('0x4c')][_0xef4a('0x4d')][_0xef4a('0x39')]()]&&(_0x32c936[_0x101140['idField']]=_0x5e7bc8[_0x101140['Variable'][_0xef4a('0x4d')][_0xef4a('0x39')]()][_0xef4a('0x47')]());}});}return _0x32c936;}function getConnection(_0x4fb417){var _0x52818a=_0x4fb417[_0xef4a('0x4e')][_0xef4a('0x4f')](_0x4fb417[_0xef4a('0x50')]);var _0x2f8ef6=new jsforce[(_0xef4a('0x51'))]({'oauth2':{'loginUrl':_0x4fb417[_0xef4a('0x52')]||_0xef4a('0x53'),'clientId':_0x4fb417[_0xef4a('0x54')],'clientSecret':_0x4fb417[_0xef4a('0x55')]}});return _0x2f8ef6[_0xef4a('0x56')](_0x4fb417[_0xef4a('0x57')],_0x52818a)[_0xef4a('0x20')](function(){logger[_0xef4a('0x1a')](_0xef4a('0x58'));return _0x2f8ef6;});}exports[_0xef4a('0x59')]=function(_0x469d47,_0x127d30,_0x34c86b,_0x1349e1,_0x10886d,_0xc07475){var _0x2e0b01,_0x2e33e0,_0x24163c,_0x3e3d5b;_0xc07475[_0xef4a('0x5a')]=intUtil[_0xef4a('0x5b')](_0xc07475[_0xef4a('0x5a')]);_0xc07475['remoteUri']=intUtil[_0xef4a('0x5b')](_0xc07475[_0xef4a('0x52')]);if(_0x10886d&&_0x10886d[_0xef4a('0x5c')]){logger['info'](_0xef4a('0x5d'),_0xef4a('0x5e'));_0x127d30[_0xef4a('0x5f')]=util[_0xef4a('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc07475['serverUrl'],_0x127d30[_0xef4a('0x60')],md5(_0x127d30[_0xef4a('0x60')]));}else{_0x127d30[_0xef4a('0x5f')]='';}return getConnection(_0xc07475)[_0xef4a('0x20')](function(_0x2ab86b){_0x3e3d5b=_0x2ab86b;return getUser(_0xc07475,_0x1349e1[_0xef4a('0x61')],_0x3e3d5b);})['then'](function(_0x5533a8){_0x2e0b01=_0x5533a8;return getEndUser(_0xc07475,_0x34c86b,_0x127d30['calleridname'],_0x127d30['calleridnum'],_0x3e3d5b);})[_0xef4a('0x20')](function(_0x330c22){_0x2e33e0=_0x330c22;return getTicket(_0xc07475,_0x2e0b01,_0x2e33e0,_0x34c86b,_0x127d30,_0x34c86b[_0xef4a('0x62')],_0x3e3d5b,_0xef4a('0x59'));})[_0xef4a('0x20')](function(_0x2c9601){_0x24163c=_0x2c9601;logger['info'](_0xef4a('0x63'),_0x24163c['id']);logger[_0xef4a('0x1a')](_0xef4a('0x64'),_0x24163c['id'],_0x1349e1[_0xef4a('0x4d')],_0xc07475[_0xef4a('0x48')]);switch(_0xc07475[_0xef4a('0x48')]){case _0xef4a('0x65'):emit(util[_0xef4a('0x40')](_0xef4a('0x66'),_0x1349e1[_0xef4a('0x4d')]),'trigger:salesforce:display',{'recordId':_0x24163c['id']});break;case'newTab':emit(util[_0xef4a('0x40')](_0xef4a('0x66'),_0x1349e1[_0xef4a('0x4d')]),_0xef4a('0x67'),{'uri':util[_0xef4a('0x40')]('%s/%s/e',_0x3e3d5b[_0xef4a('0x68')],_0x24163c['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x935272){logger['error'](_0xef4a('0x5d'),_0x935272);});};exports[_0xef4a('0x69')]=function(_0x376430,_0x5f7a1d,_0x3ef1fb,_0x3aba59,_0x1c9118,_0x145c5d,_0x2dfac9){var _0x33425a,_0xfbfc3e,_0x57bea6,_0x4559e7;_0x145c5d[_0xef4a('0x5a')]=intUtil[_0xef4a('0x5b')](_0x145c5d[_0xef4a('0x5a')]);_0x145c5d[_0xef4a('0x52')]=intUtil[_0xef4a('0x5b')](_0x145c5d[_0xef4a('0x52')]);if(_0x2dfac9&&_0x2dfac9[_0xef4a('0x6a')]&&_0x2dfac9['recordingFormat']!==_0xef4a('0x6b')){logger[_0xef4a('0x1a')](_0xef4a('0x6c'),_0xef4a('0x5e'));_0x5f7a1d[_0xef4a('0x5f')]=util[_0xef4a('0x40')](_0xef4a('0x6d'),_0x145c5d[_0xef4a('0x5a')],_0x5f7a1d[_0xef4a('0x60')],md5(_0x5f7a1d[_0xef4a('0x60')]));}return getConnection(_0x145c5d)[_0xef4a('0x20')](function(_0x48a133){_0x4559e7=_0x48a133;return getUser(_0x145c5d,_0x3aba59[_0xef4a('0x61')],_0x4559e7);})['then'](function(_0x3317db){_0x33425a=_0x3317db;return getEndUser(_0x145c5d,_0x3ef1fb,_0x5f7a1d[_0xef4a('0x6e')],_0x5f7a1d[_0xef4a('0x6f')],_0x4559e7);})[_0xef4a('0x20')](function(_0x4dd955){_0xfbfc3e=_0x4dd955;return getTicket(_0x145c5d,_0x33425a,_0xfbfc3e,_0x3ef1fb,_0x5f7a1d,_0x3ef1fb[_0xef4a('0x62')],_0x4559e7,'outbound');})[_0xef4a('0x20')](function(_0x3cfda1){_0x57bea6=_0x3cfda1;logger[_0xef4a('0x1a')](_0xef4a('0x70'),_0x57bea6['id']);logger[_0xef4a('0x1a')](_0xef4a('0x71'),_0x57bea6['id'],_0x3aba59[_0xef4a('0x4d')],_0x145c5d[_0xef4a('0x48')]);switch(_0x145c5d['type']){case _0xef4a('0x65'):emit(util['format'](_0xef4a('0x66'),_0x3aba59[_0xef4a('0x4d')]),_0xef4a('0x72'),{'recordId':_0x57bea6['id']});break;case _0xef4a('0x73'):emit(util[_0xef4a('0x40')]('user:%s',_0x3aba59['name']),_0xef4a('0x67'),{'uri':util[_0xef4a('0x40')](_0xef4a('0x74'),_0x4559e7[_0xef4a('0x68')],_0x57bea6['id'])});break;default:logger[_0xef4a('0x75')](_0xef4a('0x6c'),_0xef4a('0x76'));}})[_0xef4a('0x77')](function(_0x2b9818){logger[_0xef4a('0x75')](_0xef4a('0x6c'),_0x2b9818);});};exports['unmanaged']=function(_0x5bcfd1,_0x146408,_0x1a4427,_0x49071e,_0x1414cf,_0x49f544){var _0x993672,_0x25cd70,_0x2bfa11,_0x1f26bc;_0x49f544[_0xef4a('0x5a')]=intUtil[_0xef4a('0x5b')](_0x49f544[_0xef4a('0x5a')]);_0x49f544[_0xef4a('0x52')]=intUtil[_0xef4a('0x5b')](_0x49f544['remoteUri']);if(_0x1414cf&&_0x1414cf[_0xef4a('0x5c')]){logger[_0xef4a('0x1a')]('['+_0x146408[_0xef4a('0x78')][_0xef4a('0x79')]()+']',_0xef4a('0x5e'));_0x146408[_0xef4a('0x5f')]=util[_0xef4a('0x40')](_0xef4a('0x6d'),_0x49f544[_0xef4a('0x5a')],_0x146408[_0xef4a('0x60')],md5(_0x146408[_0xef4a('0x60')]));}else{_0x146408[_0xef4a('0x5f')]='';}return getConnection(_0x49f544)['then'](function(_0x2a4e1d){_0x1f26bc=_0x2a4e1d;if(!_[_0xef4a('0x7a')](_0x49071e)){return getUser(_0x49f544,_0x49071e[_0xef4a('0x4d')],_0x1f26bc);}else{return getUser(_0x49f544,null,_0x1f26bc);}})[_0xef4a('0x20')](function(_0x19a201){_0x993672=_0x19a201;return getEndUser(_0x49f544,_0x1a4427,_0x146408[_0xef4a('0x7b')],_0x146408['calleridnum'],_0x1f26bc);})['then'](function(_0x4ac2f4){_0x25cd70=_0x4ac2f4;return getTicket(_0x49f544,_0x993672,_0x25cd70,_0x1a4427,_0x146408,_0x1a4427[_0xef4a('0x62')],_0x1f26bc);})['then'](function(_0x24ef67){_0x2bfa11=_0x24ef67;logger[_0xef4a('0x1a')]('['+_0x146408[_0xef4a('0x78')][_0xef4a('0x79')]()+_0xef4a('0x7c'),_0x2bfa11['id']);logger[_0xef4a('0x1a')]('['+_0x146408[_0xef4a('0x78')][_0xef4a('0x79')]()+_0xef4a('0x7d'),_0x49f544[_0xef4a('0x48')]);})['catch'](function(_0x3cd1c6){logger[_0xef4a('0x75')]('['+_0x146408[_0xef4a('0x78')]['toUpperCase']()+']',_0x3cd1c6);});}; \ 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 0910a9b..39a268e 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 _0x7133=['adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','sys_id','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','toString','idField','toLowerCase','variable','customVariable','Variable','name','incident','assign','Subjects','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminId','userEmail'];(function(_0x436609,_0x3ffc92){var _0x53ccef=function(_0x29cb69){while(--_0x29cb69){_0x436609['push'](_0x436609['shift']());}};_0x53ccef(++_0x3ffc92);}(_0x7133,0x19d));var _0x3713=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7133[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x3713('0x0'));var Promise=require(_0x3713('0x1'));var rp=require(_0x3713('0x2'));var util=require(_0x3713('0x3'));var md5=require('md5');var Redis=require(_0x3713('0x4'));var intUtil=require(_0x3713('0x5'));var config=require(_0x3713('0x6'));var logger=require(_0x3713('0x7'))(_0x3713('0x8'));config[_0x3713('0x9')]=_[_0x3713('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3713('0xb'))(new Redis(config[_0x3713('0x9')]));function getAdminUser(_0x1f7881,_0x2f219c,_0x4566c1,_0x5b0deb,_0x3a3b97,_0x37f3e5){return new Promise(function(_0x8a508e,_0x17de2a){var _0x4c9af8={'method':_0x3713('0xc'),'uri':_0x5b0deb+_0x3713('0xd')+'&'+_0x3a3b97+'&'+_0x37f3e5,'auth':_0x2f219c,'json':!![]};return rp(_0x4c9af8)[_0x3713('0xe')](function(_0x5ee737){if(_0x5ee737[_0x3713('0xf')][_0x3713('0x10')]>0x0){_0x4566c1['adminId']=_0x5ee737[_0x3713('0xf')][0x0]['sys_id'];}logger[_0x3713('0x11')]('['+[_0x1f7881[_0x3713('0x12')]()]+_0x3713('0x13'),_0x4566c1);_0x8a508e(_0x4566c1);})['catch'](function(_0x16612f){logger[_0x3713('0x14')]('['+[_0x1f7881['toUpperCase']()]+']',_0x16612f[_0x3713('0x15')]);_0x17de2a(_0x16612f[_0x3713('0x15')]);});});}function getUser(_0x145ec8,_0x5b96bb,_0x154a93,_0x1f5ff7,_0xae4545){return function(_0x842090){logger['info']('['+[_0x145ec8[_0x3713('0x12')]()]+_0x3713('0x16'),_0x842090);return new Promise(function(_0x235ccb,_0x58cb96){if(intUtil[_0x3713('0x17')](_0x842090['userEmail'])){var _0x43aff3={'method':'GET','uri':_0x154a93+_0x3713('0x18')+_0x842090['userEmail']+'&'+_0x1f5ff7+'&'+_0xae4545,'auth':_0x5b96bb,'json':!![]};logger[_0x3713('0x11')]('['+[_0x145ec8[_0x3713('0x12')]()]+_0x3713('0x19'),_0x43aff3);return rp(_0x43aff3)[_0x3713('0xe')](function(_0x5db00d){logger[_0x3713('0x11')]('['+[_0x145ec8[_0x3713('0x12')]()]+'],\x20getUser\x20entity',_0x5db00d);if(_0x5db00d[_0x3713('0xf')][_0x3713('0x10')]>0x0&&String(_0x5db00d[_0x3713('0xf')][0x0][_0x3713('0x1a')])===_0x3713('0x1b')){_0x842090[_0x3713('0x1c')]=_0x5db00d[_0x3713('0xf')][0x0]['sys_id'];}else{_0x842090[_0x3713('0x1c')]=_0x842090[_0x3713('0x1d')];_0x842090[_0x3713('0x1e')]=_0x842090[_0x3713('0x1f')];}logger[_0x3713('0x11')]('['+[_0x145ec8['toUpperCase']()]+_0x3713('0x20'),_0x842090);_0x235ccb(_0x842090);})[_0x3713('0x21')](function(_0x21f981){logger[_0x3713('0x14')]('['+[_0x145ec8[_0x3713('0x12')]()]+']',_0x21f981['message']);_0x58cb96(_0x21f981['message']);});}else{logger[_0x3713('0x11')]('['+[_0x145ec8[_0x3713('0x12')]()]+_0x3713('0x22'));_0x842090[_0x3713('0x1c')]=_0x842090[_0x3713('0x1d')];_0x842090['userEmail']=_0x842090[_0x3713('0x1f')];_0x235ccb(_0x842090);}});};}function createEndUser(_0x7f634d,_0x3b72e6,_0xfb353d,_0x18034f,_0x88e506){logger[_0x3713('0x11')]('['+[_0x7f634d[_0x3713('0x12')]()]+_0x3713('0x23'),_0xfb353d);return new Promise(function(_0x5e7d11,_0x3da424){var _0x1c520e={'method':_0x3713('0x24'),'uri':_0x18034f+'sys_user?'+_0x88e506,'body':{'user_name':_0xfb353d[_0x3713('0x25')],'roles':_0x3713('0x26'),'first_name':_0xfb353d[_0x3713('0x25')],'active':'true','date_format':_0x3713('0x27'),'phone':_0xfb353d[_0x3713('0x25')]},'auth':_0x3b72e6,'json':!![]};return rp(_0x1c520e)[_0x3713('0xe')](function(_0x571e13){logger['info']('['+[_0x7f634d[_0x3713('0x12')]()]+'],\x20EndUser\x20schema',_0x571e13[_0x3713('0xf')]);_0xfb353d[_0x3713('0x28')]=_0x571e13['result']['sys_id'];_0x5e7d11(_0xfb353d);})['catch'](function(_0x400503){logger[_0x3713('0x14')]('['+[_0x7f634d[_0x3713('0x12')]()]+']',_0x400503[_0x3713('0x15')]);_0x3da424(_0x400503[_0x3713('0x15')]);});});}function getEndUser(_0xc261d7,_0x276be0,_0x295428,_0x4b021f,_0x24822e){return function(_0x22005e){logger[_0x3713('0x11')]('['+[_0xc261d7[_0x3713('0x12')]()]+_0x3713('0x29'),_0x22005e);return new Promise(function(_0x1189cc,_0x50d20b){var _0x37ccc4={'method':_0x3713('0xc'),'uri':_0x295428+_0x3713('0x2a')+_0x22005e[_0x3713('0x25')]+'&'+_0x4b021f+'&'+_0x24822e,'auth':_0x276be0,'json':!![]};return rp(_0x37ccc4)[_0x3713('0xe')](function(_0x393995){if(_0x393995['result'][_0x3713('0x10')]>0x0){_0x22005e[_0x3713('0x28')]=_0x393995[_0x3713('0xf')][0x0][_0x3713('0x2b')];logger['info']('['+[_0xc261d7[_0x3713('0x12')]()]+_0x3713('0x2c'),_0x22005e);_0x1189cc(_0x22005e);}else{return createEndUser(_0xc261d7,_0x276be0,_0x22005e,_0x295428,_0x4b021f)[_0x3713('0xe')](function(_0x172fc2){logger[_0x3713('0x11')]('['+[_0xc261d7[_0x3713('0x12')]()]+_0x3713('0x2d'),_0x172fc2);_0x1189cc(_0x172fc2);});}})['catch'](function(_0x9af57f){logger['error']('['+[_0xc261d7[_0x3713('0x12')]()]+']',_0x9af57f[_0x3713('0x15')]);_0x50d20b(_0x9af57f[_0x3713('0x15')]);});});};}function getCustomFields(_0x1e66a8,_0x48c481){var _0x1b4934={};if(_0x1e66a8[_0x3713('0x10')]>0x0){_[_0x3713('0x2e')](_0x1e66a8,function(_0x457933){if(_[_0x3713('0x2f')]([_0x3713('0x30'),_0x3713('0x31')],_0x457933[_0x3713('0x32')])&&_0x457933[_0x3713('0x33')]&&!_0x457933[_0x3713('0x34')]){_0x1b4934[_0x457933['nameField']['toLowerCase']()]=_0x457933[_0x3713('0x35')][_0x3713('0x36')]();}else if(_[_0x3713('0x2f')](['string',_0x3713('0x31')],_0x457933[_0x3713('0x32')])&&_0x457933[_0x3713('0x37')]&&_0x457933[_0x3713('0x34')]){_0x1b4934[_0x457933[_0x3713('0x37')][_0x3713('0x38')]()]=_0x457933[_0x3713('0x35')]['toString']();}else if(_0x457933[_0x3713('0x32')]===_0x3713('0x39')&&_0x457933['variableName']&&_0x457933[_0x3713('0x37')]&&_0x457933[_0x3713('0x34')]){_0x1b4934[_0x457933[_0x3713('0x37')][_0x3713('0x38')]()]=_0x48c481[_0x457933['variableName']][_0x3713('0x36')]();}else if(_0x457933[_0x3713('0x32')]===_0x3713('0x3a')&&_0x457933['Variable']&&_0x457933[_0x3713('0x3b')][_0x3713('0x3c')]&&_0x457933[_0x3713('0x37')]&&_0x457933[_0x3713('0x34')]){_0x1b4934[_0x457933[_0x3713('0x37')][_0x3713('0x38')]()]=_0x48c481[_0x457933[_0x3713('0x3b')][_0x3713('0x3c')][_0x3713('0x38')]()]['toString']();}});}return _0x1b4934;}function getTicket(_0xa3f74c,_0x229fa1,_0x281f23,_0x19a5f5,_0x56d7b1,_0x43094a){return function(_0x3e60ce){logger[_0x3713('0x11')]('['+[_0xa3f74c[_0x3713('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x3e60ce);return new Promise(function(_0x5d5e9e,_0x55991c){var _0x115450=_0xa3f74c[_0x3713('0x38')]()==='outbound'?_0x3e60ce[_0x3713('0x1c')]:_0x3e60ce[_0x3713('0x28')];var _0x172805={'method':_0x3713('0x24'),'uri':_0x281f23+_0x3713('0x3d')+'?'+_0x43094a,'body':Object[_0x3713('0x3e')]({},{'active':'true','caller_id':_0x115450,'assigned_to':_0x3e60ce['userId'],'short_description':intUtil['getString'](_0x19a5f5[_0x3713('0x3f')],_0x56d7b1,'\x20'),'description':intUtil[_0x3713('0x40')](_0x19a5f5[_0x3713('0x41')],_0x56d7b1,'\x0a')},getCustomFields(_0x19a5f5['Fields'],_0x56d7b1)),'auth':_0x229fa1,'json':!![]};return rp(_0x172805)[_0x3713('0xe')](function(_0x3e43f2){logger[_0x3713('0x11')]('['+[_0xa3f74c[_0x3713('0x12')]()]+_0x3713('0x42'),_0x3e43f2[_0x3713('0xf')]);_0x3e60ce[_0x3713('0x43')]=_0x3e43f2[_0x3713('0xf')][_0x3713('0x2b')];_0x3e60ce[_0x3713('0x44')]=_0x3e43f2[_0x3713('0xf')][_0x3713('0x45')];logger['info']('['+[_0xa3f74c[_0x3713('0x12')]()]+_0x3713('0x46'),_0x3e60ce);_0x5d5e9e(_0x3e60ce);})['catch'](function(_0x42d11b){logger[_0x3713('0x14')]('['+[_0xa3f74c[_0x3713('0x12')]()]+']',_0x42d11b['message']);_0x55991c(_0x42d11b[_0x3713('0x15')]);});});};}function createRemoteTag(_0xa3d5da,_0x20276a,_0x9facd7,_0x362057){return new Promise(function(_0x1cf619,_0x419223){var _0x49b667={'method':'POST','uri':_0x9facd7+_0x3713('0x47')+'?'+_0x362057,'body':{'short_description':_0xa3d5da,'global':!![],'active':!![],'name':_0xa3d5da},'auth':_0x20276a,'json':!![]};return rp(_0x49b667)[_0x3713('0xe')](function(_0x5f52ef){var _0x1f5c08=_0x5f52ef[_0x3713('0xf')][_0x3713('0x2b')];_0x1cf619(_0x1f5c08);});});}function getRemoteTag(_0x25681f,_0x77d523,_0x354458,_0x229e60,_0x1c02e0){return new Promise(function(_0xa21db6,_0x575003){var _0x4565d9={'method':_0x3713('0xc'),'uri':_0x354458+_0x3713('0x47')+'?sysparm_query=name%3D'+_0x25681f+'&'+_0x229e60,'auth':_0x77d523,'json':!![]};return rp(_0x4565d9)[_0x3713('0xe')](function(_0x4d0482){if(_0x4d0482[_0x3713('0xf')][_0x3713('0x10')]>0x0){var _0x25fb67=_0x4d0482['result'][0x0]['sys_id'];_0xa21db6(_0x25fb67);}else{return createRemoteTag(_0x25681f,_0x77d523,_0x354458,_0x229e60)[_0x3713('0xe')](function(_0x2a1ed2){_0xa21db6(_0x2a1ed2);});}});});}function assignTagToIncident(_0x4935e3,_0x46ceab,_0x447b57,_0x38f9ac,_0x1baf5f){return new Promise(function(_0x234722,_0xfdcac0){var _0x419879={'method':_0x3713('0x24'),'uri':_0x447b57+_0x3713('0x48')+'?'+_0x1baf5f,'body':{'label':_0x4935e3,'table':_0x3713('0x3d'),'id_type':_0x3713('0x49'),'table_key':_0x38f9ac[_0x3713('0x43')],'title':_0x3713('0x4a')+_0x38f9ac[_0x3713('0x44')],'id_display':_0x38f9ac[_0x3713('0x44')]},'auth':_0x46ceab,'json':!![]};return rp(_0x419879)['then'](function(_0x2b58fd){_0x234722();})['catch'](function(){_0x234722();});});}function manageTags(_0x183775,_0x1b73e8,_0x4a8fda,_0x42790e,_0xad98e4,_0x2a482f,_0xc84394){return new Promise(function(_0x74e0ba,_0x1091e){var _0x28143f=[];_0x1b73e8['forEach'](function(_0x1b6fb8){_0x28143f[_0x3713('0x4b')](getRemoteTag(_0x1b6fb8,_0x4a8fda,_0x42790e,_0x2a482f,_0xc84394));});return Promise['all'](_0x28143f)[_0x3713('0xe')](function(_0x175ef4){if(_0x175ef4[_0x3713('0x10')]){logger[_0x3713('0x11')]('['+[_0x183775['toUpperCase']()]+_0x3713('0x4c'),_0x175ef4);var _0xa25880=[];_0x175ef4[_0x3713('0x2e')](function(_0x3692ae){_0xa25880[_0x3713('0x4b')](assignTagToIncident(_0x3692ae,_0x4a8fda,_0x42790e,_0xad98e4,_0x2a482f));});return Promise[_0x3713('0x4d')](_0xa25880)[_0x3713('0xe')](function(){_0x74e0ba();})[_0x3713('0x21')](function(){_0x74e0ba();});}else{_0x74e0ba();}});});}function getTags(_0x12ecfb,_0x148c79,_0x392d7b,_0x1feb26,_0x705f10,_0x525f43){return function(_0x3cfd74){return new Promise(function(_0x444320,_0x560845){var _0x1db77e=[];var _0x469592=_0x1feb26['Tags'];if(_0x469592&&_0x469592[_0x3713('0x10')]>0x0){_0x1db77e=_[_0x3713('0x4e')](_0x469592,_0x3713('0x3c'));}if(_0x1db77e[_0x3713('0x10')]>0x0){return manageTags(_0x12ecfb,_0x1db77e,_0x148c79,_0x392d7b,_0x3cfd74,_0x705f10,_0x525f43)[_0x3713('0xe')](function(){_0x444320(_0x3cfd74);});}else{_0x444320(_0x3cfd74);}});};}function emit(_0x28bd4c,_0x2e1342,_0x5269ba){var _0x1077e7='%26sysparm_record_target%3Dincident'+_0x3713('0x4f')+_0x3713('0x50')+_0x3713('0x51');var _0xcc08a6={'uri':_0x28bd4c+_0x3713('0x52')+_0x5269ba+_0x1077e7};io['to'](util[_0x3713('0x53')]('user:%s',_0x2e1342))[_0x3713('0x54')]('trigger:browser:url',_0xcc08a6);}exports['cs']=function(_0x3086d4,_0x4a097d,_0x33307a,_0x2b9276,_0x1d3ea6,_0x2f621d,_0x49abcf,_0x1d2b4b){var _0x50f31c={};var _0x214923={'user':_0x2f621d[_0x3713('0x55')],'pass':_0x2f621d[_0x3713('0x56')]};var _0x3f0e20=_0x3713('0x57');var _0x251820=_0x3713('0x58');_0x2f621d[_0x3713('0x59')]=intUtil['stripTrailingSlash'](_0x2f621d[_0x3713('0x59')]);_0x2f621d['serverUrl']=intUtil[_0x3713('0x5a')](_0x2f621d[_0x3713('0x5b')]);var _0x372510=util[_0x3713('0x53')](_0x3713('0x5c'),_0x2f621d['remoteUri']);_0x50f31c['userEmail']=!_[_0x3713('0x5d')](_0x2b9276)?_0x2b9276[_0x3713('0x5e')]:null;_0x50f31c['adminEmail']=_0x2f621d[_0x3713('0x5e')];_0x50f31c[_0x3713('0x25')]=_0x1d2b4b['toLowerCase']()===_0x3713('0x5f')?_0x4a097d[_0x3713('0x60')]:_0x4a097d[_0x3713('0x61')];_0x50f31c[_0x3713('0x62')]=_0x1d2b4b===_0x3713('0x63')||_0x1d2b4b===_0x3713('0x64')?'queue':'outbound';var _0x256fd4=util[_0x3713('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f621d['serverUrl'],_0x4a097d[_0x3713('0x65')],md5(_0x4a097d[_0x3713('0x65')]));if(_0x1d3ea6&&_0x1d3ea6['monitor_format']){logger[_0x3713('0x11')](_0x3713('0x66'),_0x3713('0x67'));_0x4a097d['recordingURL']=_0x256fd4;}else if(_0x49abcf&&_0x49abcf[_0x3713('0x68')]&&_0x49abcf[_0x3713('0x68')]!==_0x3713('0x69')){logger[_0x3713('0x11')]('[OUTBOUND]',_0x3713('0x67'));_0x4a097d['recordingURL']=_0x256fd4;}else{_0x4a097d[_0x3713('0x6a')]='';}return getAdminUser(_0x1d2b4b,_0x214923,_0x50f31c,_0x372510,_0x251820,_0x3f0e20)[_0x3713('0xe')](getUser(_0x1d2b4b,_0x214923,_0x372510,_0x251820,_0x3f0e20))[_0x3713('0xe')](getEndUser(_0x1d2b4b,_0x214923,_0x372510,_0x251820,_0x3f0e20))[_0x3713('0xe')](getTicket(_0x1d2b4b,_0x214923,_0x372510,_0x33307a,_0x4a097d,_0x251820))[_0x3713('0xe')](function(_0x9cdd76){logger[_0x3713('0x11')](util[_0x3713('0x53')](_0x3713('0x6b'),_0x9cdd76['ticketId']));logger['info'](util['format'](_0x3713('0x6c'),_0x1d2b4b));if(_0x1d2b4b!=='unmanaged'){logger[_0x3713('0x11')]('['+[_0x1d2b4b[_0x3713('0x12')]()]+']',_0x3713('0x6d'));emit(_0x2f621d['remoteUri'],_0x2b9276[_0x3713('0x3c')],_0x9cdd76[_0x3713('0x43')]);}})[_0x3713('0x21')](function(_0x3ee44a){logger['error']('['+[_0x1d2b4b[_0x3713('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x3713('0x6e')](_0x3ee44a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe1af=['uniqueid','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','request-promise','util','md5','ioredis','./util','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','toLowerCase','content','toString','includes','idField','customField','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','catch','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','format','%s/api/now/table/','remoteUri','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x2b92ec,_0x18e0e3){var _0x12be46=function(_0x18118b){while(--_0x18118b){_0x2b92ec['push'](_0x2b92ec['shift']());}};_0x12be46(++_0x18e0e3);}(_0xe1af,0xdd));var _0xfe1a=function(_0x1e89ed,_0x1cf7de){_0x1e89ed=_0x1e89ed-0x0;var _0x3e3e2c=_0xe1af[_0x1e89ed];return _0x3e3e2c;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xfe1a('0x0'));var util=require(_0xfe1a('0x1'));var md5=require(_0xfe1a('0x2'));var Redis=require(_0xfe1a('0x3'));var intUtil=require(_0xfe1a('0x4'));var config=require('../../../../config/environment');var logger=require(_0xfe1a('0x5'))(_0xfe1a('0x6'));config[_0xfe1a('0x7')]=_['defaults'](config[_0xfe1a('0x7')],{'host':_0xfe1a('0x8'),'port':0x18eb});var io=require(_0xfe1a('0x9'))(new Redis(config[_0xfe1a('0x7')]));function getAdminUser(_0x32846f,_0xfffedb,_0x4b7779,_0x575d86,_0x4d1fe6,_0x28a8bc){return new Promise(function(_0x31b9b0,_0x3173f1){var _0x2853ae={'method':_0xfe1a('0xa'),'uri':_0x575d86+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x4d1fe6+'&'+_0x28a8bc,'auth':_0xfffedb,'json':!![]};return rp(_0x2853ae)['then'](function(_0x432d3e){if(_0x432d3e[_0xfe1a('0xb')][_0xfe1a('0xc')]>0x0){_0x4b7779[_0xfe1a('0xd')]=_0x432d3e[_0xfe1a('0xb')][0x0]['sys_id'];}logger[_0xfe1a('0xe')]('['+[_0x32846f[_0xfe1a('0xf')]()]+_0xfe1a('0x10'),_0x4b7779);_0x31b9b0(_0x4b7779);})['catch'](function(_0x181fe6){logger[_0xfe1a('0x11')]('['+[_0x32846f[_0xfe1a('0xf')]()]+']',_0x181fe6[_0xfe1a('0x12')]);_0x3173f1(_0x181fe6['message']);});});}function getUser(_0x37be0e,_0x349ed8,_0x4b1325,_0x4dd42b,_0x156ace){return function(_0x326194){logger[_0xfe1a('0xe')]('['+[_0x37be0e['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x326194);return new Promise(function(_0x2009a2,_0x168b0e){if(intUtil[_0xfe1a('0x13')](_0x326194[_0xfe1a('0x14')])){var _0x1244f8={'method':_0xfe1a('0xa'),'uri':_0x4b1325+_0xfe1a('0x15')+_0x326194[_0xfe1a('0x14')]+'&'+_0x4dd42b+'&'+_0x156ace,'auth':_0x349ed8,'json':!![]};logger[_0xfe1a('0xe')]('['+[_0x37be0e[_0xfe1a('0xf')]()]+_0xfe1a('0x16'),_0x1244f8);return rp(_0x1244f8)[_0xfe1a('0x17')](function(_0x5a3ee5){logger[_0xfe1a('0xe')]('['+[_0x37be0e[_0xfe1a('0xf')]()]+_0xfe1a('0x18'),_0x5a3ee5);if(_0x5a3ee5[_0xfe1a('0xb')][_0xfe1a('0xc')]>0x0&&String(_0x5a3ee5['result'][0x0][_0xfe1a('0x19')])===_0xfe1a('0x1a')){_0x326194[_0xfe1a('0x1b')]=_0x5a3ee5[_0xfe1a('0xb')][0x0][_0xfe1a('0x1c')];}else{_0x326194[_0xfe1a('0x1b')]=_0x326194['adminId'];_0x326194[_0xfe1a('0x14')]=_0x326194[_0xfe1a('0x1d')];}logger[_0xfe1a('0xe')]('['+[_0x37be0e[_0xfe1a('0xf')]()]+'],\x20getUser\x20crm',_0x326194);_0x2009a2(_0x326194);})['catch'](function(_0x6d32f1){logger[_0xfe1a('0x11')]('['+[_0x37be0e[_0xfe1a('0xf')]()]+']',_0x6d32f1[_0xfe1a('0x12')]);_0x168b0e(_0x6d32f1[_0xfe1a('0x12')]);});}else{logger['info']('['+[_0x37be0e[_0xfe1a('0xf')]()]+']\x20using\x20admin\x20profile');_0x326194[_0xfe1a('0x1b')]=_0x326194[_0xfe1a('0xd')];_0x326194[_0xfe1a('0x14')]=_0x326194[_0xfe1a('0x1d')];_0x2009a2(_0x326194);}});};}function createEndUser(_0x30b352,_0x19ca9f,_0x49cba1,_0x131255,_0x1cb666){logger[_0xfe1a('0xe')]('['+[_0x30b352[_0xfe1a('0xf')]()]+_0xfe1a('0x1e'),_0x49cba1);return new Promise(function(_0x1f967f,_0x1fc463){var _0x1abf51={'method':_0xfe1a('0x1f'),'uri':_0x131255+_0xfe1a('0x20')+_0x1cb666,'body':{'user_name':_0x49cba1[_0xfe1a('0x21')],'roles':_0xfe1a('0x22'),'first_name':_0x49cba1[_0xfe1a('0x21')],'active':'true','date_format':_0xfe1a('0x23'),'phone':_0x49cba1[_0xfe1a('0x21')]},'auth':_0x19ca9f,'json':!![]};return rp(_0x1abf51)[_0xfe1a('0x17')](function(_0x4d1738){logger[_0xfe1a('0xe')]('['+[_0x30b352[_0xfe1a('0xf')]()]+'],\x20EndUser\x20schema',_0x4d1738['result']);_0x49cba1[_0xfe1a('0x24')]=_0x4d1738['result']['sys_id'];_0x1f967f(_0x49cba1);})['catch'](function(_0x50d779){logger[_0xfe1a('0x11')]('['+[_0x30b352[_0xfe1a('0xf')]()]+']',_0x50d779[_0xfe1a('0x12')]);_0x1fc463(_0x50d779[_0xfe1a('0x12')]);});});}function getEndUser(_0x4367d6,_0x103a4f,_0x1c6bbd,_0x278dd1,_0x1c4cb7){return function(_0x4a1eea){logger[_0xfe1a('0xe')]('['+[_0x4367d6[_0xfe1a('0xf')]()]+_0xfe1a('0x25'),_0x4a1eea);return new Promise(function(_0x42df3c,_0x65480c){var _0x41abd1={'method':_0xfe1a('0xa'),'uri':_0x1c6bbd+_0xfe1a('0x26')+_0x4a1eea[_0xfe1a('0x21')]+'&'+_0x278dd1+'&'+_0x1c4cb7,'auth':_0x103a4f,'json':!![]};return rp(_0x41abd1)['then'](function(_0x85a96b){if(_0x85a96b[_0xfe1a('0xb')][_0xfe1a('0xc')]>0x0){_0x4a1eea[_0xfe1a('0x24')]=_0x85a96b[_0xfe1a('0xb')][0x0]['sys_id'];logger[_0xfe1a('0xe')]('['+[_0x4367d6['toUpperCase']()]+_0xfe1a('0x27'),_0x4a1eea);_0x42df3c(_0x4a1eea);}else{return createEndUser(_0x4367d6,_0x103a4f,_0x4a1eea,_0x1c6bbd,_0x278dd1)['then'](function(_0x3d00df){logger[_0xfe1a('0xe')]('['+[_0x4367d6['toUpperCase']()]+_0xfe1a('0x28'),_0x3d00df);_0x42df3c(_0x3d00df);});}})['catch'](function(_0x44bf1b){logger[_0xfe1a('0x11')]('['+[_0x4367d6['toUpperCase']()]+']',_0x44bf1b['message']);_0x65480c(_0x44bf1b['message']);});});};}function getCustomFields(_0x39b167,_0x3a950f){var _0x4d0657={};if(_0x39b167[_0xfe1a('0xc')]>0x0){_[_0xfe1a('0x29')](_0x39b167,function(_0x5bd7e2){if(_['includes']([_0xfe1a('0x2a'),_0xfe1a('0x2b')],_0x5bd7e2[_0xfe1a('0x2c')])&&_0x5bd7e2[_0xfe1a('0x2d')]&&!_0x5bd7e2['customField']){_0x4d0657[_0x5bd7e2[_0xfe1a('0x2d')][_0xfe1a('0x2e')]()]=_0x5bd7e2[_0xfe1a('0x2f')][_0xfe1a('0x30')]();}else if(_[_0xfe1a('0x31')]([_0xfe1a('0x2a'),'picklist'],_0x5bd7e2[_0xfe1a('0x2c')])&&_0x5bd7e2[_0xfe1a('0x32')]&&_0x5bd7e2[_0xfe1a('0x33')]){_0x4d0657[_0x5bd7e2['idField']['toLowerCase']()]=_0x5bd7e2[_0xfe1a('0x2f')][_0xfe1a('0x30')]();}else if(_0x5bd7e2[_0xfe1a('0x2c')]==='variable'&&_0x5bd7e2['variableName']&&_0x5bd7e2['idField']&&_0x5bd7e2[_0xfe1a('0x33')]){_0x4d0657[_0x5bd7e2[_0xfe1a('0x32')]['toLowerCase']()]=_0x3a950f[_0x5bd7e2[_0xfe1a('0x34')]][_0xfe1a('0x30')]();}else if(_0x5bd7e2['type']===_0xfe1a('0x35')&&_0x5bd7e2[_0xfe1a('0x36')]&&_0x5bd7e2['Variable'][_0xfe1a('0x37')]&&_0x5bd7e2[_0xfe1a('0x32')]&&_0x5bd7e2[_0xfe1a('0x33')]){_0x4d0657[_0x5bd7e2[_0xfe1a('0x32')][_0xfe1a('0x2e')]()]=_0x3a950f[_0x5bd7e2[_0xfe1a('0x36')]['name'][_0xfe1a('0x2e')]()]['toString']();}});}return _0x4d0657;}function getTicket(_0x1e673e,_0x1b7b4a,_0x2dd47a,_0x5a639a,_0x336e36,_0x1384a6){return function(_0x48cb31){logger[_0xfe1a('0xe')]('['+[_0x1e673e[_0xfe1a('0xf')]()]+']\x20getTicket\x20input\x20crm',_0x48cb31);return new Promise(function(_0x683c99,_0x4d7f78){var _0x304346=_0x1e673e[_0xfe1a('0x2e')]()===_0xfe1a('0x38')?_0x48cb31[_0xfe1a('0x1b')]:_0x48cb31['endUserId'];var _0x2ae792={'method':'POST','uri':_0x2dd47a+_0xfe1a('0x39')+'?'+_0x1384a6,'body':Object[_0xfe1a('0x3a')]({},{'active':_0xfe1a('0x1a'),'caller_id':_0x304346,'assigned_to':_0x48cb31[_0xfe1a('0x1b')],'short_description':intUtil[_0xfe1a('0x3b')](_0x5a639a[_0xfe1a('0x3c')],_0x336e36,'\x20'),'description':intUtil[_0xfe1a('0x3b')](_0x5a639a[_0xfe1a('0x3d')],_0x336e36,'\x0a')},getCustomFields(_0x5a639a['Fields'],_0x336e36)),'auth':_0x1b7b4a,'json':!![]};return rp(_0x2ae792)[_0xfe1a('0x17')](function(_0x431c02){logger[_0xfe1a('0xe')]('['+[_0x1e673e[_0xfe1a('0xf')]()]+_0xfe1a('0x3e'),_0x431c02[_0xfe1a('0xb')]);_0x48cb31[_0xfe1a('0x3f')]=_0x431c02[_0xfe1a('0xb')]['sys_id'];_0x48cb31['ticketNumber']=_0x431c02[_0xfe1a('0xb')]['number'];logger['info']('['+[_0x1e673e[_0xfe1a('0xf')]()]+_0xfe1a('0x40'),_0x48cb31);_0x683c99(_0x48cb31);})[_0xfe1a('0x41')](function(_0x1e0c47){logger[_0xfe1a('0x11')]('['+[_0x1e673e[_0xfe1a('0xf')]()]+']',_0x1e0c47['message']);_0x4d7f78(_0x1e0c47[_0xfe1a('0x12')]);});});};}function createRemoteTag(_0x956419,_0x5080a9,_0x3d0008,_0x17c8a4){return new Promise(function(_0x44a6a3,_0x2aa560){var _0x1a7e27={'method':'POST','uri':_0x3d0008+_0xfe1a('0x42')+'?'+_0x17c8a4,'body':{'short_description':_0x956419,'global':!![],'active':!![],'name':_0x956419},'auth':_0x5080a9,'json':!![]};return rp(_0x1a7e27)[_0xfe1a('0x17')](function(_0x3f4732){var _0x5c7dd7=_0x3f4732[_0xfe1a('0xb')][_0xfe1a('0x1c')];_0x44a6a3(_0x5c7dd7);});});}function getRemoteTag(_0x3edda2,_0x35c097,_0x4e017b,_0x205a37,_0x1ee128){return new Promise(function(_0xfb8fa5,_0x9b6362){var _0x436d5e={'method':'GET','uri':_0x4e017b+_0xfe1a('0x42')+_0xfe1a('0x43')+_0x3edda2+'&'+_0x205a37,'auth':_0x35c097,'json':!![]};return rp(_0x436d5e)['then'](function(_0x1d47e8){if(_0x1d47e8[_0xfe1a('0xb')][_0xfe1a('0xc')]>0x0){var _0x306ce6=_0x1d47e8['result'][0x0]['sys_id'];_0xfb8fa5(_0x306ce6);}else{return createRemoteTag(_0x3edda2,_0x35c097,_0x4e017b,_0x205a37)['then'](function(_0x49a024){_0xfb8fa5(_0x49a024);});}});});}function assignTagToIncident(_0x3c3e1b,_0x3e4355,_0x442e8f,_0x3d9e1c,_0x5aa95d){return new Promise(function(_0x3d6b62,_0x55eaaf){var _0x50448c={'method':_0xfe1a('0x1f'),'uri':_0x442e8f+_0xfe1a('0x44')+'?'+_0x5aa95d,'body':{'label':_0x3c3e1b,'table':'incident','id_type':_0xfe1a('0x45'),'table_key':_0x3d9e1c[_0xfe1a('0x3f')],'title':_0xfe1a('0x46')+_0x3d9e1c[_0xfe1a('0x47')],'id_display':_0x3d9e1c[_0xfe1a('0x47')]},'auth':_0x3e4355,'json':!![]};return rp(_0x50448c)[_0xfe1a('0x17')](function(_0x5d8d87){_0x3d6b62();})['catch'](function(){_0x3d6b62();});});}function manageTags(_0x50b833,_0x3970a5,_0x346f00,_0xf9394c,_0x555aac,_0x483e94,_0x3a7304){return new Promise(function(_0x47d081,_0x57e0d8){var _0x59c95b=[];_0x3970a5[_0xfe1a('0x29')](function(_0x24f016){_0x59c95b[_0xfe1a('0x48')](getRemoteTag(_0x24f016,_0x346f00,_0xf9394c,_0x483e94,_0x3a7304));});return Promise['all'](_0x59c95b)[_0xfe1a('0x17')](function(_0x3f2fc1){if(_0x3f2fc1[_0xfe1a('0xc')]){logger['info']('['+[_0x50b833[_0xfe1a('0xf')]()]+_0xfe1a('0x49'),_0x3f2fc1);var _0x3c4204=[];_0x3f2fc1[_0xfe1a('0x29')](function(_0x454dba){_0x3c4204[_0xfe1a('0x48')](assignTagToIncident(_0x454dba,_0x346f00,_0xf9394c,_0x555aac,_0x483e94));});return Promise[_0xfe1a('0x4a')](_0x3c4204)[_0xfe1a('0x17')](function(){_0x47d081();})[_0xfe1a('0x41')](function(){_0x47d081();});}else{_0x47d081();}});});}function getTags(_0x2b67d3,_0x362e59,_0x2fdea6,_0x4e44a9,_0x346148,_0x4b0e6d){return function(_0x53baa4){return new Promise(function(_0xc2d64c,_0x33a0a1){var _0x2551b8=[];var _0x5c39bf=_0x4e44a9[_0xfe1a('0x4b')];if(_0x5c39bf&&_0x5c39bf[_0xfe1a('0xc')]>0x0){_0x2551b8=_[_0xfe1a('0x4c')](_0x5c39bf,_0xfe1a('0x37'));}if(_0x2551b8[_0xfe1a('0xc')]>0x0){return manageTags(_0x2b67d3,_0x2551b8,_0x362e59,_0x2fdea6,_0x53baa4,_0x346148,_0x4b0e6d)[_0xfe1a('0x17')](function(){_0xc2d64c(_0x53baa4);});}else{_0xc2d64c(_0x53baa4);}});};}function emit(_0x330f0a,_0x5b9c89,_0xe1573f){var _0x47984d=_0xfe1a('0x4d')+_0xfe1a('0x4e')+_0xfe1a('0x4f')+_0xfe1a('0x50');var _0x43eb50={'uri':_0x330f0a+'/nav_to.do?uri=incident.do?sys_id%3D'+_0xe1573f+_0x47984d};io['to'](util['format'](_0xfe1a('0x51'),_0x5b9c89))['emit']('trigger:browser:url',_0x43eb50);}exports['cs']=function(_0x2b5f7f,_0x5b4ddc,_0x41dcf0,_0xc11f30,_0x3b999e,_0x3a5e55,_0x1825eb,_0x4b4ba2){var _0x4db4bf={};var _0xa222c2={'user':_0x3a5e55[_0xfe1a('0x52')],'pass':_0x3a5e55[_0xfe1a('0x53')]};var _0x173f9b=_0xfe1a('0x54');var _0x159f6a=_0xfe1a('0x55');_0x3a5e55['remoteUri']=intUtil[_0xfe1a('0x56')](_0x3a5e55['remoteUri']);_0x3a5e55[_0xfe1a('0x57')]=intUtil['stripTrailingSlash'](_0x3a5e55[_0xfe1a('0x57')]);var _0x28eff2=util[_0xfe1a('0x58')](_0xfe1a('0x59'),_0x3a5e55[_0xfe1a('0x5a')]);_0x4db4bf[_0xfe1a('0x14')]=!_[_0xfe1a('0x5b')](_0xc11f30)?_0xc11f30['email']:null;_0x4db4bf[_0xfe1a('0x1d')]=_0x3a5e55[_0xfe1a('0x5c')];_0x4db4bf[_0xfe1a('0x21')]=_0x4b4ba2[_0xfe1a('0x2e')]()===_0xfe1a('0x38')?_0x5b4ddc['destcalleridnum']:_0x5b4ddc[_0xfe1a('0x5d')];_0x4db4bf['callDirection']=_0x4b4ba2===_0xfe1a('0x5e')||_0x4b4ba2===_0xfe1a('0x5f')?'queue':_0xfe1a('0x38');var _0x1f80b1=util['format'](_0xfe1a('0x60'),_0x3a5e55[_0xfe1a('0x57')],_0x5b4ddc[_0xfe1a('0x61')],md5(_0x5b4ddc[_0xfe1a('0x61')]));if(_0x3b999e&&_0x3b999e['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5b4ddc[_0xfe1a('0x62')]=_0x1f80b1;}else if(_0x1825eb&&_0x1825eb[_0xfe1a('0x63')]&&_0x1825eb[_0xfe1a('0x63')]!==_0xfe1a('0x64')){logger[_0xfe1a('0xe')](_0xfe1a('0x65'),_0xfe1a('0x66'));_0x5b4ddc[_0xfe1a('0x62')]=_0x1f80b1;}else{_0x5b4ddc['recordingURL']='';}return getAdminUser(_0x4b4ba2,_0xa222c2,_0x4db4bf,_0x28eff2,_0x159f6a,_0x173f9b)[_0xfe1a('0x17')](getUser(_0x4b4ba2,_0xa222c2,_0x28eff2,_0x159f6a,_0x173f9b))[_0xfe1a('0x17')](getEndUser(_0x4b4ba2,_0xa222c2,_0x28eff2,_0x159f6a,_0x173f9b))[_0xfe1a('0x17')](getTicket(_0x4b4ba2,_0xa222c2,_0x28eff2,_0x41dcf0,_0x5b4ddc,_0x159f6a))[_0xfe1a('0x17')](function(_0x320389){logger[_0xfe1a('0xe')](util['format'](_0xfe1a('0x67'),_0x320389[_0xfe1a('0x3f')]));logger[_0xfe1a('0xe')](util[_0xfe1a('0x58')]('call\x20direction:\x20%s',_0x4b4ba2));if(_0x4b4ba2!==_0xfe1a('0x5f')){logger['info']('['+[_0x4b4ba2[_0xfe1a('0xf')]()]+']',_0xfe1a('0x68'));emit(_0x3a5e55['remoteUri'],_0xc11f30[_0xfe1a('0x37')],_0x320389['ticketId']);}})[_0xfe1a('0x41')](function(_0x55629d){logger[_0xfe1a('0x11')]('['+[_0x4b4ba2[_0xfe1a('0xf')]()]+_0xfe1a('0x69'),util['inspect'](_0x55629d,{'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 13ed175..2ccaa13 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 _0x6484=['socket.io-emitter','POST','emit','info','name','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','variable','customVariable','Variable','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','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','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','error','unmanaged','lastevent','isNil','calleridname','toUpperCase','bluebird','md5','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x6484,0xe8));var _0x4648=function(_0x262baa,_0x6c1eb8){_0x262baa=_0x262baa-0x0;var _0x2c0e2f=_0x6484[_0x262baa];return _0x2c0e2f;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x4648('0x0'));var md5=require(_0x4648('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4648('0x2'));var logger=require(_0x4648('0x3'))(_0x4648('0x4'));config[_0x4648('0x5')]=_[_0x4648('0x6')](config[_0x4648('0x5')],{'host':_0x4648('0x7'),'port':0x18eb});var io=require(_0x4648('0x8'))(new Redis(config[_0x4648('0x5')]));var def={'method':_0x4648('0x9'),'json':!![]};function emit(_0x353f62,_0x1d2bab,_0x6b59b3){io['to'](_0x353f62)[_0x4648('0xa')](_0x1d2bab,_0x6b59b3);}function getTicket(_0x33923d,_0xbc3c13,_0x5c0647,_0x424e45,_0x4b8563,_0x2867cb,_0x43fccf,_0x4a21a7){logger[_0x4648('0xb')]('Creating\x20new\x20ticket...');var _0x37b304=new Date();var _0x290966=[{'name':_0x4648('0xc'),'value':intUtil['getString'](_0x424e45[_0x4648('0xd')],_0x4b8563,'\x20')},{'name':_0x4648('0xe'),'value':_0xbc3c13['id']},{'name':'created_by','value':_0xbc3c13['id']},{'name':_0x4648('0xf'),'value':intUtil['getString'](_0x424e45[_0x4648('0x10')],_0x4b8563,'\x0a')},{'name':_0x4648('0x11'),'value':_0x37b304[_0x4648('0x12')]()[_0x4648('0x13')](0x0,0x13)[_0x4648('0x14')]('T','\x20')},{'name':_0x4648('0x15'),'value':'0'},{'name':_0x4648('0x16'),'value':'15'},{'name':'parent_id','value':_0x5c0647['id']},{'name':_0x4648('0x17'),'value':_0x4648('0x18')},{'name':_0x4648('0x19'),'value':_0x5c0647[_0x4648('0xc')]},{'name':_0x4648('0x1a'),'value':_0x4a21a7}];if(_0x2867cb[_0x4648('0x1b')]){_[_0x4648('0x1c')](_0x2867cb,function(_0xaa058){if(_0x4b8563[_0xaa058[_0x4648('0x1d')]]){_0x290966[_0x4648('0x1e')]({'name':_0xaa058[_0x4648('0x1f')],'value':_0x4b8563[_0xaa058[_0x4648('0x1d')]]});}});}return request({'form':{'method':_0x4648('0x20'),'input_type':_0x4648('0x21'),'response_type':_0x4648('0x21'),'rest_data':JSON[_0x4648('0x22')]({'session':_0x43fccf['id'],'module_name':_0x4648('0x23'),'name_value_list':_0x290966})}});}function getAuth(_0x1d4adf){return util[_0x4648('0x24')](_0x4648('0x25'),new Buffer(_0x1d4adf[_0x4648('0x26')]+':X')['toString']('base64'));}function getServerInfo(_0x575135){return request({'form':{'method':'get_server_info','input_type':_0x4648('0x21'),'response_type':'JSON','rest_data':JSON[_0x4648('0x22')]({'session':_0x575135['id']})}});}function getUser(_0x3f8583,_0x201547,_0x1c7001){if(!_['isNil'](_0x201547)){logger['info'](_0x4648('0x27'),_0x201547);return request({'form':{'method':_0x4648('0x28'),'input_type':_0x4648('0x21'),'response_type':_0x4648('0x21'),'rest_data':JSON[_0x4648('0x22')]({'session':_0x1c7001['id'],'module_name':_0x4648('0x29'),'query':util['format'](_0x4648('0x2a'),_0x201547),'order_by':'','offset':'0','select_fields':['id','name',_0x4648('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4648('0x2c')](function(_0x37691a){if(_0x37691a[_0x4648('0x2d')][_0x4648('0x1b')]){var _0x188a51=_['find'](_0x37691a[_0x4648('0x2d')],function(_0x6f1c79){return _0x6f1c79[_0x4648('0x2e')][_0x4648('0x2b')][_0x4648('0x2f')]===_0x201547;});if(_0x188a51){logger[_0x4648('0xb')]('Agent\x20found!');return BPromise[_0x4648('0x30')]({'id':_0x188a51['name_value_list']['id'][_0x4648('0x2f')],'name':_0x188a51[_0x4648('0x2e')][_0x4648('0xc')][_0x4648('0x2f')]});}}logger['info'](_0x4648('0x31'));return BPromise[_0x4648('0x30')]({'id':_0x1c7001['name_value_list'][_0x4648('0x32')][_0x4648('0x2f')],'name':_0x1c7001[_0x4648('0x2e')][_0x4648('0x2b')][_0x4648('0x2f')]});});}else{logger['info'](_0x4648('0x33'));return BPromise['resolve']({'id':_0x1c7001[_0x4648('0x2e')]['user_id'][_0x4648('0x2f')],'name':_0x1c7001[_0x4648('0x2e')][_0x4648('0x2b')][_0x4648('0x2f')]});}}function getEndUser(_0x3e8939,_0x332224,_0x4b2cf6,_0x1be67b){logger[_0x4648('0xb')](_0x4648('0x34'),_0x4b2cf6);return request({'form':{'method':_0x4648('0x28'),'input_type':_0x4648('0x21'),'response_type':_0x4648('0x21'),'rest_data':JSON['stringify']({'session':_0x1be67b['id'],'module_name':_0x4648('0x18'),'query':util[_0x4648('0x24')](_0x4648('0x35'),_0x4b2cf6),'order_by':'','offset':'0','select_fields':['id',_0x4648('0xc'),_0x4648('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1808bf){if(_0x1808bf['entry_list'][_0x4648('0x1b')]){var _0x583738=_[_0x4648('0x37')](_0x1808bf[_0x4648('0x2d')],function(_0x32cec2){return _0x32cec2[_0x4648('0x2e')][_0x4648('0x36')][_0x4648('0x2f')]===_0x4b2cf6;});if(_0x583738){logger[_0x4648('0xb')](_0x4648('0x38'));return BPromise['resolve']({'id':_0x583738[_0x4648('0x2e')]['id']['value'],'name':_0x583738['name_value_list']['name'][_0x4648('0x2f')],'phone':_0x583738[_0x4648('0x2e')][_0x4648('0x36')][_0x4648('0x2f')]});}}else{logger[_0x4648('0xb')](_0x4648('0x39'));return request({'form':{'method':_0x4648('0x20'),'input_type':_0x4648('0x21'),'response_type':_0x4648('0x21'),'rest_data':JSON[_0x4648('0x22')]({'session':_0x1be67b['id'],'module_name':'Contacts','name_value_list':[{'name':_0x4648('0x3a'),'value':_0x332224!==_0x4648('0x3b')?_0x332224:util[_0x4648('0x24')]('Caller\x20-\x20%s',_0x4b2cf6)},{'name':_0x4648('0x36'),'value':_0x4b2cf6}]})}})[_0x4648('0x2c')](function(_0x10f7bb){logger['info'](_0x4648('0x3c'));return BPromise['resolve']({'id':_0x10f7bb['id'],'name':_0x10f7bb[_0x4648('0x2d')][_0x4648('0x3a')][_0x4648('0x2f')],'phone':_0x10f7bb[_0x4648('0x2d')][_0x4648('0x36')][_0x4648('0x2f')]});});}});}function request(_0x4d620a){logger[_0x4648('0x3d')](_0x4648('0x3e'),JSON[_0x4648('0x22')](_0x4d620a));return rp(_[_0x4648('0x3f')](def,_0x4d620a));}function getTags(_0x2ead82,_0x243be8){var _0x1a5e86=[];if(_0x2ead82&&_0x2ead82[_0x4648('0x1b')]>0x0){_0x1a5e86=_['map'](_0x2ead82,_0x243be8);}return _0x1a5e86;}function getCustomFields(_0x371cdb,_0x4e19b1){var _0x4c6f97=[];var _0x1735d5={'custom_fields':[]};if(_0x371cdb[_0x4648('0x1b')]>0x0){_[_0x4648('0x1c')](_0x371cdb,function(_0x2ffaad){if(_0x2ffaad[_0x4648('0x40')]===_0x4648('0x41')&&_0x2ffaad[_0x4648('0x42')]&&!_0x2ffaad[_0x4648('0x43')]){_0x1735d5[_0x2ffaad[_0x4648('0x42')][_0x4648('0x44')]()]=_0x2ffaad[_0x4648('0x45')][_0x4648('0x46')]();}else if(_0x2ffaad[_0x4648('0x40')]===_0x4648('0x41')&&_0x2ffaad[_0x4648('0x1f')]&&_0x2ffaad['customField']){_0x1735d5[_0x4648('0x47')][_0x4648('0x1e')]({'id':_0x2ffaad[_0x4648('0x1f')],'value':_0x2ffaad[_0x4648('0x45')]['toString']()});}else if(_0x2ffaad[_0x4648('0x40')]===_0x4648('0x48')&&_0x2ffaad[_0x4648('0x1d')]&&_0x2ffaad[_0x4648('0x1f')]&&_0x2ffaad[_0x4648('0x43')]){_0x4e19b1[_0x2ffaad[_0x4648('0x1d')]]&&_0x1735d5[_0x4648('0x47')][_0x4648('0x1e')]({'id':_0x2ffaad[_0x4648('0x1f')],'value':_0x4e19b1[_0x2ffaad[_0x4648('0x1d')]][_0x4648('0x46')]()});}else if(_0x2ffaad[_0x4648('0x40')]===_0x4648('0x49')&&_0x2ffaad[_0x4648('0x4a')]&&_0x2ffaad['Variable'][_0x4648('0xc')]&&_0x2ffaad['idField']&&_0x2ffaad[_0x4648('0x43')]){_0x4e19b1[_0x2ffaad['Variable'][_0x4648('0xc')][_0x4648('0x44')]()]&&_0x1735d5[_0x4648('0x47')][_0x4648('0x1e')]({'id':_0x2ffaad[_0x4648('0x1f')],'value':_0x4e19b1[_0x2ffaad[_0x4648('0x4a')][_0x4648('0xc')][_0x4648('0x44')]()][_0x4648('0x46')]()});}});}return _0x1735d5;}function getConnection(_0x4fcc6e){return request({'method':_0x4648('0x9'),'form':{'method':_0x4648('0x4b'),'input_type':_0x4648('0x21'),'response_type':_0x4648('0x21'),'rest_data':JSON[_0x4648('0x22')]({'user_auth':{'user_name':_0x4fcc6e[_0x4648('0x4c')],'password':_0x4fcc6e['password'],'encryption':_0x4648('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4648('0x2c')](function(_0x4a278b){var _0x8ad345=_0x4a278b;if(_0x8ad345['id']){def[_0x4648('0x4e')]=_0x8ad345['id'];return BPromise['resolve'](_0x8ad345);}else{throw new Error(util[_0x4648('0x24')](_0x4648('0x4f'),_0x4fcc6e['id']));}});}function setRelationship(_0x2128ee,_0x3b7a9a,_0x3d5806,_0x48ade3){return request({'form':{'method':_0x4648('0x50'),'input_type':_0x4648('0x21'),'response_type':_0x4648('0x21'),'rest_data':JSON['stringify']({'session':_0x2128ee['id'],'module_name':_0x4648('0x23'),'module_id':_0x3d5806['id'],'link_field_name':_0x48ade3,'related_ids':[_0x3b7a9a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4648('0x51')]=function(_0x3f8afd,_0xac9ae3,_0x5e92e9,_0x1d1afe,_0x370d42,_0x5c45fa){var _0xe9c72d,_0x27e7a7,_0x536e43,_0x222113;_0x5c45fa[_0x4648('0x52')]=intUtil[_0x4648('0x53')](_0x5c45fa[_0x4648('0x52')]);_0x5c45fa[_0x4648('0x54')]=intUtil[_0x4648('0x53')](_0x5c45fa[_0x4648('0x54')]);def[_0x4648('0x55')]=util['format'](_0x4648('0x56'),_0x5c45fa['remoteUri']);if(_0x370d42&&_0x370d42[_0x4648('0x57')]){logger[_0x4648('0xb')](_0x4648('0x58'),_0x4648('0x59'));_0xac9ae3[_0x4648('0x5a')]=util[_0x4648('0x24')](_0x4648('0x5b'),_0x5c45fa[_0x4648('0x54')],_0xac9ae3[_0x4648('0x5c')],md5(_0xac9ae3['uniqueid']));}else{_0xac9ae3[_0x4648('0x5a')]='';}return getConnection(_0x5c45fa)[_0x4648('0x2c')](function(_0x6783e3){_0x222113=_0x6783e3;return getUser(_0x5c45fa,_0x1d1afe[_0x4648('0xc')],_0x222113);})[_0x4648('0x2c')](function(_0x32d311){_0xe9c72d=_0x32d311;logger[_0x4648('0xb')]('The\x20User\x20ID\x20is:',_0xe9c72d['id']);return getEndUser(_0x5c45fa,_0xac9ae3['calleridname'],_0xac9ae3[_0x4648('0x5d')],_0x222113);})['then'](function(_0x3c6ffe){_0x27e7a7=_0x3c6ffe;logger[_0x4648('0xb')](_0x4648('0x5e'),_0x27e7a7['id']);return getTicket(_0x5c45fa,_0xe9c72d,_0x27e7a7,_0x5e92e9,_0xac9ae3,_0x5e92e9[_0x4648('0x5f')],_0x222113,_0x4648('0x60'));})['then'](function(_0x19e28f){_0x536e43=_0x19e28f;logger[_0x4648('0xb')]('Ticket\x20created!');logger[_0x4648('0xb')](_0x4648('0x61'),_0x536e43['id']);return setRelationship(_0x222113,_0xe9c72d,_0x536e43,_0x4648('0x62'));})[_0x4648('0x2c')](function(){return setRelationship(_0x222113,_0x27e7a7,_0x536e43,_0x4648('0x63'));})[_0x4648('0x2c')](function(){return getServerInfo(_0x222113);})['then'](function(_0x4f8853){var _0x50bfe2=parseInt(_0x4f8853[_0x4648('0x64')]['charAt'](0x0));var _0x27ac66=util[_0x4648('0x24')](_0x4648('0x65'),_0x5c45fa['remoteUri'],_0x536e43['id']);if(_0x50bfe2>0x6){_0x27ac66=util[_0x4648('0x24')](_0x4648('0x66'),_0x5c45fa[_0x4648('0x52')],_0x536e43['id']);}logger[_0x4648('0xb')](_0x4648('0x58'),_0x4648('0x67'));emit(util['format'](_0x4648('0x68'),_0x1d1afe[_0x4648('0xc')]),_0x4648('0x69'),{'uri':_0x27ac66});})[_0x4648('0x6a')](function(_0x1274a3){logger['error'](_0x4648('0x58'),JSON[_0x4648('0x22')](_0x1274a3));});};exports[_0x4648('0x6b')]=function(_0x1df707,_0x392da0,_0x4d0b52,_0xb037b0,_0x2277b7,_0x845d4,_0x1345b4){var _0x4182f2,_0x5035c8,_0x57c76c,_0x375b96;_0x845d4['remoteUri']=intUtil[_0x4648('0x53')](_0x845d4['remoteUri']);_0x845d4[_0x4648('0x54')]=intUtil['stripTrailingSlash'](_0x845d4[_0x4648('0x54')]);def[_0x4648('0x55')]=util[_0x4648('0x24')](_0x4648('0x56'),_0x845d4['remoteUri']);if(_0x1345b4&&_0x1345b4['recordingFormat']&&_0x1345b4[_0x4648('0x6c')]!==_0x4648('0x6d')){logger[_0x4648('0xb')](_0x4648('0x6e'),'Recording\x20is\x20enabled!');_0x392da0[_0x4648('0x5a')]=util[_0x4648('0x24')](_0x4648('0x5b'),_0x845d4[_0x4648('0x54')],_0x392da0[_0x4648('0x5c')],md5(_0x392da0[_0x4648('0x5c')]));}return getConnection(_0x845d4)[_0x4648('0x2c')](function(_0x581071){_0x375b96=_0x581071;return getUser(_0x845d4,_0xb037b0['name'],_0x375b96);})[_0x4648('0x2c')](function(_0x92941b){_0x4182f2=_0x92941b;logger[_0x4648('0xb')]('The\x20User\x20ID\x20is:',_0x4182f2['id']);return getEndUser(_0x845d4,_0x392da0[_0x4648('0x6f')],_0x392da0[_0x4648('0x70')],_0x375b96);})[_0x4648('0x2c')](function(_0x2e4c35){_0x5035c8=_0x2e4c35;logger[_0x4648('0xb')](_0x4648('0x5e'),_0x5035c8['id']);return getTicket(_0x845d4,_0x4182f2,_0x5035c8,_0x4d0b52,_0x392da0,_0x4d0b52['Fields'],_0x375b96,'Outbound');})[_0x4648('0x2c')](function(_0x543474){_0x57c76c=_0x543474;logger[_0x4648('0xb')](_0x4648('0x71'));logger[_0x4648('0xb')](_0x4648('0x61'),_0x57c76c['id']);return setRelationship(_0x375b96,_0x4182f2,_0x57c76c,'users');})['then'](function(){return setRelationship(_0x375b96,_0x5035c8,_0x57c76c,_0x4648('0x63'));})[_0x4648('0x2c')](function(){return getServerInfo(_0x375b96);})['then'](function(_0x5237b9){var _0x14c733=parseInt(_0x5237b9[_0x4648('0x64')]['charAt'](0x0));var _0x250eac=util['format'](_0x4648('0x65'),_0x845d4[_0x4648('0x52')],_0x57c76c['id']);if(_0x14c733>0x6){_0x250eac=util['format'](_0x4648('0x66'),_0x845d4[_0x4648('0x52')],_0x57c76c['id']);}logger[_0x4648('0xb')](_0x4648('0x6e'),_0x4648('0x67'));emit(util[_0x4648('0x24')](_0x4648('0x68'),_0xb037b0[_0x4648('0xc')]),_0x4648('0x69'),{'uri':_0x250eac});})[_0x4648('0x6a')](function(_0x317bc3){logger[_0x4648('0x72')](_0x4648('0x6e'),JSON['stringify'](_0x317bc3));});};exports[_0x4648('0x73')]=function(_0x5e9894,_0x395a60,_0x41c7ad,_0x232ad1,_0x499d38,_0x55e9c5){var _0x2e17c4,_0x28f709,_0x2155bb,_0x3f2ba5;_0x55e9c5[_0x4648('0x52')]=intUtil[_0x4648('0x53')](_0x55e9c5[_0x4648('0x52')]);_0x55e9c5[_0x4648('0x54')]=intUtil['stripTrailingSlash'](_0x55e9c5[_0x4648('0x54')]);def['uri']=util[_0x4648('0x24')](_0x4648('0x56'),_0x55e9c5[_0x4648('0x52')]);if(_0x499d38&&_0x499d38[_0x4648('0x57')]){logger[_0x4648('0xb')]('['+_0x395a60[_0x4648('0x74')]['toUpperCase']()+']',_0x4648('0x59'));_0x395a60[_0x4648('0x5a')]=util[_0x4648('0x24')](_0x4648('0x5b'),_0x55e9c5[_0x4648('0x54')],_0x395a60['uniqueid'],md5(_0x395a60[_0x4648('0x5c')]));}else{_0x395a60[_0x4648('0x5a')]='';}return getConnection(_0x55e9c5)[_0x4648('0x2c')](function(_0x55fb42){_0x3f2ba5=_0x55fb42;if(!_[_0x4648('0x75')](_0x232ad1)){return getUser(_0x55e9c5,_0x232ad1['name'],_0x3f2ba5);}else{return getUser(_0x55e9c5,null,_0x3f2ba5);}})[_0x4648('0x2c')](function(_0x438810){_0x2e17c4=_0x438810;logger[_0x4648('0xb')]('The\x20User\x20ID\x20is:',_0x2e17c4['id']);return getEndUser(_0x55e9c5,_0x395a60[_0x4648('0x76')],_0x395a60[_0x4648('0x5d')],_0x3f2ba5);})[_0x4648('0x2c')](function(_0x53404d){_0x28f709=_0x53404d;logger[_0x4648('0xb')](_0x4648('0x5e'),_0x28f709['id']);return getTicket(_0x55e9c5,_0x2e17c4,_0x28f709,_0x41c7ad,_0x395a60,_0x41c7ad[_0x4648('0x5f')],_0x3f2ba5,_0x4648('0x60'));})[_0x4648('0x2c')](function(_0x365f80){_0x2155bb=_0x365f80;logger[_0x4648('0xb')](_0x4648('0x71'));logger['info'](_0x4648('0x61'),_0x2155bb['id']);return setRelationship(_0x3f2ba5,_0x2e17c4,_0x2155bb,_0x4648('0x62'));})[_0x4648('0x2c')](function(){return setRelationship(_0x3f2ba5,_0x28f709,_0x2155bb,'contacts');})[_0x4648('0x2c')](function(){return getServerInfo(_0x3f2ba5);})[_0x4648('0x6a')](function(_0x459f36){logger['error']('['+_0x395a60['lastevent'][_0x4648('0x77')]()+']',JSON['stringify'](_0x459f36));});}; \ No newline at end of file +var _0xa3ca=['idField','customVariable','Variable','toLowerCase','POST','login','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','Fields','Inbound','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','[QUEUE]','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','catch','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','push','variableName','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','format','contacts.phone_home\x20=\x20\x22%s\x22','Enduser\x20found!','set_entry','first_name','','Caller\x20-\x20%s','phone_home','Enduser\x20created.','debug','merge','map','forEach','type','nameField','customField','content','string','custom_fields'];(function(_0x3edd55,_0x59ffd6){var _0x2164d8=function(_0x584ad3){while(--_0x584ad3){_0x3edd55['push'](_0x3edd55['shift']());}};_0x2164d8(++_0x59ffd6);}(_0xa3ca,0x12d));var _0xaa3c=function(_0xc1bee0,_0x1ba3ab){_0xc1bee0=_0xc1bee0-0x0;var _0x5e15cf=_0xa3ca[_0xc1bee0];return _0x5e15cf;};'use strict';var _=require(_0xaa3c('0x0'));var rp=require(_0xaa3c('0x1'));var BPromise=require(_0xaa3c('0x2'));var md5=require(_0xaa3c('0x3'));var util=require(_0xaa3c('0x4'));var Redis=require(_0xaa3c('0x5'));var intUtil=require(_0xaa3c('0x6'));var config=require(_0xaa3c('0x7'));var logger=require(_0xaa3c('0x8'))(_0xaa3c('0x9'));config[_0xaa3c('0xa')]=_[_0xaa3c('0xb')](config['redis'],{'host':_0xaa3c('0xc'),'port':0x18eb});var io=require(_0xaa3c('0xd'))(new Redis(config[_0xaa3c('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x52c4d9,_0x14b521,_0xe99c37){io['to'](_0x52c4d9)[_0xaa3c('0xe')](_0x14b521,_0xe99c37);}function getTicket(_0x42dec7,_0x81a460,_0x16388e,_0x4d195b,_0x4c29ef,_0x2507be,_0x2b05cc,_0xd86fdd){logger[_0xaa3c('0xf')](_0xaa3c('0x10'));var _0x2cb90d=new Date();var _0x5e4b63=[{'name':_0xaa3c('0x11'),'value':intUtil[_0xaa3c('0x12')](_0x4d195b['Subjects'],_0x4c29ef,'\x20')},{'name':_0xaa3c('0x13'),'value':_0x81a460['id']},{'name':_0xaa3c('0x14'),'value':_0x81a460['id']},{'name':_0xaa3c('0x15'),'value':intUtil[_0xaa3c('0x12')](_0x4d195b[_0xaa3c('0x16')],_0x4c29ef,'\x0a')},{'name':'date_start','value':_0x2cb90d['toISOString']()[_0xaa3c('0x17')](0x0,0x13)[_0xaa3c('0x18')]('T','\x20')},{'name':_0xaa3c('0x19'),'value':'0'},{'name':_0xaa3c('0x1a'),'value':'15'},{'name':'parent_id','value':_0x16388e['id']},{'name':_0xaa3c('0x1b'),'value':_0xaa3c('0x1c')},{'name':_0xaa3c('0x1d'),'value':_0x16388e[_0xaa3c('0x11')]},{'name':_0xaa3c('0x1e'),'value':_0xd86fdd}];if(_0x2507be[_0xaa3c('0x1f')]){_['forEach'](_0x2507be,function(_0x4430c9){if(_0x4c29ef[_0x4430c9['variableName']]){_0x5e4b63[_0xaa3c('0x20')]({'name':_0x4430c9['idField'],'value':_0x4c29ef[_0x4430c9[_0xaa3c('0x21')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xaa3c('0x22'),'response_type':_0xaa3c('0x22'),'rest_data':JSON[_0xaa3c('0x23')]({'session':_0x2b05cc['id'],'module_name':_0xaa3c('0x24'),'name_value_list':_0x5e4b63})}});}function getAuth(_0x3681d7){return util['format'](_0xaa3c('0x25'),new Buffer(_0x3681d7[_0xaa3c('0x26')]+':X')[_0xaa3c('0x27')](_0xaa3c('0x28')));}function getServerInfo(_0x99b181){return request({'form':{'method':_0xaa3c('0x29'),'input_type':_0xaa3c('0x22'),'response_type':_0xaa3c('0x22'),'rest_data':JSON[_0xaa3c('0x23')]({'session':_0x99b181['id']})}});}function getUser(_0x71a02b,_0x5db17c,_0x118f60){if(!_[_0xaa3c('0x2a')](_0x5db17c)){logger[_0xaa3c('0xf')](_0xaa3c('0x2b'),_0x5db17c);return request({'form':{'method':'get_entry_list','input_type':_0xaa3c('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x118f60['id'],'module_name':'Employees','query':util['format'](_0xaa3c('0x2c'),_0x5db17c),'order_by':'','offset':'0','select_fields':['id','name',_0xaa3c('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaa3c('0x2e')](function(_0xe73f8){if(_0xe73f8[_0xaa3c('0x2f')][_0xaa3c('0x1f')]){var _0x1aa2ba=_[_0xaa3c('0x30')](_0xe73f8['entry_list'],function(_0x41a0e6){return _0x41a0e6[_0xaa3c('0x31')]['user_name'][_0xaa3c('0x32')]===_0x5db17c;});if(_0x1aa2ba){logger['info'](_0xaa3c('0x33'));return BPromise[_0xaa3c('0x34')]({'id':_0x1aa2ba[_0xaa3c('0x31')]['id']['value'],'name':_0x1aa2ba[_0xaa3c('0x31')][_0xaa3c('0x11')][_0xaa3c('0x32')]});}}logger[_0xaa3c('0xf')](_0xaa3c('0x35'));return BPromise[_0xaa3c('0x34')]({'id':_0x118f60[_0xaa3c('0x31')][_0xaa3c('0x36')][_0xaa3c('0x32')],'name':_0x118f60[_0xaa3c('0x31')][_0xaa3c('0x2d')][_0xaa3c('0x32')]});});}else{logger['info'](_0xaa3c('0x37'));return BPromise['resolve']({'id':_0x118f60[_0xaa3c('0x31')]['user_id'][_0xaa3c('0x32')],'name':_0x118f60[_0xaa3c('0x31')][_0xaa3c('0x2d')][_0xaa3c('0x32')]});}}function getEndUser(_0xddb7bf,_0x57fc35,_0x205ea8,_0x5936a9){logger[_0xaa3c('0xf')](_0xaa3c('0x38'),_0x205ea8);return request({'form':{'method':_0xaa3c('0x39'),'input_type':_0xaa3c('0x22'),'response_type':'JSON','rest_data':JSON[_0xaa3c('0x23')]({'session':_0x5936a9['id'],'module_name':_0xaa3c('0x1c'),'query':util[_0xaa3c('0x3a')](_0xaa3c('0x3b'),_0x205ea8),'order_by':'','offset':'0','select_fields':['id',_0xaa3c('0x11'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x12a20c){if(_0x12a20c['entry_list'][_0xaa3c('0x1f')]){var _0x54adb1=_[_0xaa3c('0x30')](_0x12a20c[_0xaa3c('0x2f')],function(_0x59a81d){return _0x59a81d[_0xaa3c('0x31')]['phone_home']['value']===_0x205ea8;});if(_0x54adb1){logger[_0xaa3c('0xf')](_0xaa3c('0x3c'));return BPromise['resolve']({'id':_0x54adb1[_0xaa3c('0x31')]['id'][_0xaa3c('0x32')],'name':_0x54adb1[_0xaa3c('0x31')]['name'][_0xaa3c('0x32')],'phone':_0x54adb1[_0xaa3c('0x31')]['phone_home']['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xaa3c('0x3d'),'input_type':_0xaa3c('0x22'),'response_type':'JSON','rest_data':JSON[_0xaa3c('0x23')]({'session':_0x5936a9['id'],'module_name':_0xaa3c('0x1c'),'name_value_list':[{'name':_0xaa3c('0x3e'),'value':_0x57fc35!==_0xaa3c('0x3f')?_0x57fc35:util[_0xaa3c('0x3a')](_0xaa3c('0x40'),_0x205ea8)},{'name':_0xaa3c('0x41'),'value':_0x205ea8}]})}})[_0xaa3c('0x2e')](function(_0x2fef74){logger[_0xaa3c('0xf')](_0xaa3c('0x42'));return BPromise[_0xaa3c('0x34')]({'id':_0x2fef74['id'],'name':_0x2fef74[_0xaa3c('0x2f')][_0xaa3c('0x3e')][_0xaa3c('0x32')],'phone':_0x2fef74['entry_list']['phone_home']['value']});});}});}function request(_0x10425b){logger[_0xaa3c('0x43')]('[HTTP]',JSON[_0xaa3c('0x23')](_0x10425b));return rp(_[_0xaa3c('0x44')](def,_0x10425b));}function getTags(_0x57f361,_0x1a5533){var _0x4b88d8=[];if(_0x57f361&&_0x57f361[_0xaa3c('0x1f')]>0x0){_0x4b88d8=_[_0xaa3c('0x45')](_0x57f361,_0x1a5533);}return _0x4b88d8;}function getCustomFields(_0x1fa9ab,_0x4eba96){var _0xdfc833=[];var _0x110852={'custom_fields':[]};if(_0x1fa9ab[_0xaa3c('0x1f')]>0x0){_[_0xaa3c('0x46')](_0x1fa9ab,function(_0x2ab4e2){if(_0x2ab4e2[_0xaa3c('0x47')]==='string'&&_0x2ab4e2[_0xaa3c('0x48')]&&!_0x2ab4e2[_0xaa3c('0x49')]){_0x110852[_0x2ab4e2[_0xaa3c('0x48')]['toLowerCase']()]=_0x2ab4e2[_0xaa3c('0x4a')][_0xaa3c('0x27')]();}else if(_0x2ab4e2[_0xaa3c('0x47')]===_0xaa3c('0x4b')&&_0x2ab4e2['idField']&&_0x2ab4e2[_0xaa3c('0x49')]){_0x110852[_0xaa3c('0x4c')][_0xaa3c('0x20')]({'id':_0x2ab4e2['idField'],'value':_0x2ab4e2[_0xaa3c('0x4a')]['toString']()});}else if(_0x2ab4e2[_0xaa3c('0x47')]==='variable'&&_0x2ab4e2[_0xaa3c('0x21')]&&_0x2ab4e2[_0xaa3c('0x4d')]&&_0x2ab4e2[_0xaa3c('0x49')]){_0x4eba96[_0x2ab4e2[_0xaa3c('0x21')]]&&_0x110852[_0xaa3c('0x4c')][_0xaa3c('0x20')]({'id':_0x2ab4e2[_0xaa3c('0x4d')],'value':_0x4eba96[_0x2ab4e2[_0xaa3c('0x21')]][_0xaa3c('0x27')]()});}else if(_0x2ab4e2[_0xaa3c('0x47')]===_0xaa3c('0x4e')&&_0x2ab4e2[_0xaa3c('0x4f')]&&_0x2ab4e2['Variable'][_0xaa3c('0x11')]&&_0x2ab4e2['idField']&&_0x2ab4e2[_0xaa3c('0x49')]){_0x4eba96[_0x2ab4e2[_0xaa3c('0x4f')][_0xaa3c('0x11')][_0xaa3c('0x50')]()]&&_0x110852['custom_fields']['push']({'id':_0x2ab4e2[_0xaa3c('0x4d')],'value':_0x4eba96[_0x2ab4e2[_0xaa3c('0x4f')]['name'][_0xaa3c('0x50')]()][_0xaa3c('0x27')]()});}});}return _0x110852;}function getConnection(_0x4d7aa4){return request({'method':_0xaa3c('0x51'),'form':{'method':_0xaa3c('0x52'),'input_type':_0xaa3c('0x22'),'response_type':_0xaa3c('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4d7aa4['username'],'password':_0x4d7aa4['password'],'encryption':_0xaa3c('0x53')},'application':_0xaa3c('0x54')})}})['then'](function(_0x4c4a02){var _0x134687=_0x4c4a02;if(_0x134687['id']){def['sessionID']=_0x134687['id'];return BPromise['resolve'](_0x134687);}else{throw new Error(util[_0xaa3c('0x3a')](_0xaa3c('0x55'),_0x4d7aa4['id']));}});}function setRelationship(_0x219172,_0x141bd9,_0x43d9de,_0x593905){return request({'form':{'method':_0xaa3c('0x56'),'input_type':'JSON','response_type':_0xaa3c('0x22'),'rest_data':JSON['stringify']({'session':_0x219172['id'],'module_name':'Calls','module_id':_0x43d9de['id'],'link_field_name':_0x593905,'related_ids':[_0x141bd9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xaa3c('0x57')]=function(_0x2144ad,_0x3c6eb3,_0x1c9849,_0x14150e,_0x18f044,_0x1d4f77){var _0x45d96d,_0x518a24,_0x31f3e1,_0x41280d;_0x1d4f77[_0xaa3c('0x58')]=intUtil['stripTrailingSlash'](_0x1d4f77[_0xaa3c('0x58')]);_0x1d4f77['serverUrl']=intUtil[_0xaa3c('0x59')](_0x1d4f77[_0xaa3c('0x5a')]);def['uri']=util[_0xaa3c('0x3a')](_0xaa3c('0x5b'),_0x1d4f77[_0xaa3c('0x58')]);if(_0x18f044&&_0x18f044['monitor_format']){logger[_0xaa3c('0xf')]('[QUEUE]',_0xaa3c('0x5c'));_0x3c6eb3['recordingURL']=util[_0xaa3c('0x3a')](_0xaa3c('0x5d'),_0x1d4f77['serverUrl'],_0x3c6eb3[_0xaa3c('0x5e')],md5(_0x3c6eb3[_0xaa3c('0x5e')]));}else{_0x3c6eb3[_0xaa3c('0x5f')]='';}return getConnection(_0x1d4f77)['then'](function(_0x55a943){_0x41280d=_0x55a943;return getUser(_0x1d4f77,_0x14150e[_0xaa3c('0x11')],_0x41280d);})[_0xaa3c('0x2e')](function(_0x200c57){_0x45d96d=_0x200c57;logger[_0xaa3c('0xf')]('The\x20User\x20ID\x20is:',_0x45d96d['id']);return getEndUser(_0x1d4f77,_0x3c6eb3[_0xaa3c('0x60')],_0x3c6eb3['calleridnum'],_0x41280d);})[_0xaa3c('0x2e')](function(_0x420bb7){_0x518a24=_0x420bb7;logger[_0xaa3c('0xf')]('The\x20Enduser\x20ID\x20is:',_0x518a24['id']);return getTicket(_0x1d4f77,_0x45d96d,_0x518a24,_0x1c9849,_0x3c6eb3,_0x1c9849[_0xaa3c('0x61')],_0x41280d,_0xaa3c('0x62'));})[_0xaa3c('0x2e')](function(_0x135123){_0x31f3e1=_0x135123;logger['info']('Ticket\x20created!');logger[_0xaa3c('0xf')]('The\x20Ticket\x20ID\x20is:',_0x31f3e1['id']);return setRelationship(_0x41280d,_0x45d96d,_0x31f3e1,_0xaa3c('0x63'));})[_0xaa3c('0x2e')](function(){return setRelationship(_0x41280d,_0x518a24,_0x31f3e1,_0xaa3c('0x64'));})[_0xaa3c('0x2e')](function(){return getServerInfo(_0x41280d);})[_0xaa3c('0x2e')](function(_0x2e2e5d){var _0x2e0568=parseInt(_0x2e2e5d[_0xaa3c('0x65')][_0xaa3c('0x66')](0x0));var _0x5bdf90=util[_0xaa3c('0x3a')](_0xaa3c('0x67'),_0x1d4f77[_0xaa3c('0x58')],_0x31f3e1['id']);if(_0x2e0568>0x6){_0x5bdf90=util[_0xaa3c('0x3a')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1d4f77['remoteUri'],_0x31f3e1['id']);}logger[_0xaa3c('0xf')]('[QUEUE]',_0xaa3c('0x68'));emit(util['format'](_0xaa3c('0x69'),_0x14150e[_0xaa3c('0x11')]),_0xaa3c('0x6a'),{'uri':_0x5bdf90});})['catch'](function(_0x2bbccf){logger[_0xaa3c('0x6b')](_0xaa3c('0x6c'),JSON[_0xaa3c('0x23')](_0x2bbccf));});};exports[_0xaa3c('0x6d')]=function(_0x5911f7,_0xac4221,_0x2e7981,_0x10dfc1,_0x4553fb,_0x5a0078,_0x41aee8){var _0x5a24dc,_0xba8498,_0x5c30b1,_0x712a4c;_0x5a0078[_0xaa3c('0x58')]=intUtil[_0xaa3c('0x59')](_0x5a0078['remoteUri']);_0x5a0078[_0xaa3c('0x5a')]=intUtil[_0xaa3c('0x59')](_0x5a0078[_0xaa3c('0x5a')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x5a0078[_0xaa3c('0x58')]);if(_0x41aee8&&_0x41aee8[_0xaa3c('0x6e')]&&_0x41aee8[_0xaa3c('0x6e')]!==_0xaa3c('0x6f')){logger[_0xaa3c('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xac4221[_0xaa3c('0x5f')]=util[_0xaa3c('0x3a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a0078[_0xaa3c('0x5a')],_0xac4221[_0xaa3c('0x5e')],md5(_0xac4221[_0xaa3c('0x5e')]));}return getConnection(_0x5a0078)[_0xaa3c('0x2e')](function(_0x4fdd44){_0x712a4c=_0x4fdd44;return getUser(_0x5a0078,_0x10dfc1[_0xaa3c('0x11')],_0x712a4c);})[_0xaa3c('0x2e')](function(_0x14ad28){_0x5a24dc=_0x14ad28;logger['info'](_0xaa3c('0x70'),_0x5a24dc['id']);return getEndUser(_0x5a0078,_0xac4221['destcalleridname'],_0xac4221[_0xaa3c('0x71')],_0x712a4c);})['then'](function(_0x961d25){_0xba8498=_0x961d25;logger[_0xaa3c('0xf')](_0xaa3c('0x72'),_0xba8498['id']);return getTicket(_0x5a0078,_0x5a24dc,_0xba8498,_0x2e7981,_0xac4221,_0x2e7981['Fields'],_0x712a4c,_0xaa3c('0x73'));})[_0xaa3c('0x2e')](function(_0xb513ed){_0x5c30b1=_0xb513ed;logger[_0xaa3c('0xf')](_0xaa3c('0x74'));logger[_0xaa3c('0xf')](_0xaa3c('0x75'),_0x5c30b1['id']);return setRelationship(_0x712a4c,_0x5a24dc,_0x5c30b1,_0xaa3c('0x63'));})[_0xaa3c('0x2e')](function(){return setRelationship(_0x712a4c,_0xba8498,_0x5c30b1,_0xaa3c('0x64'));})[_0xaa3c('0x2e')](function(){return getServerInfo(_0x712a4c);})[_0xaa3c('0x2e')](function(_0x417864){var _0x309d95=parseInt(_0x417864['version'][_0xaa3c('0x66')](0x0));var _0x1cbf97=util[_0xaa3c('0x3a')](_0xaa3c('0x67'),_0x5a0078[_0xaa3c('0x58')],_0x5c30b1['id']);if(_0x309d95>0x6){_0x1cbf97=util[_0xaa3c('0x3a')](_0xaa3c('0x76'),_0x5a0078[_0xaa3c('0x58')],_0x5c30b1['id']);}logger[_0xaa3c('0xf')](_0xaa3c('0x77'),_0xaa3c('0x68'));emit(util[_0xaa3c('0x3a')]('user:%s',_0x10dfc1['name']),_0xaa3c('0x6a'),{'uri':_0x1cbf97});})[_0xaa3c('0x78')](function(_0x139f15){logger['error'](_0xaa3c('0x77'),JSON[_0xaa3c('0x23')](_0x139f15));});};exports[_0xaa3c('0x79')]=function(_0x2869a3,_0x125844,_0x2f1b30,_0x2f64c6,_0x1f7b80,_0x563577){var _0x2d2b5c,_0x2d82a1,_0x83cb8a,_0x269dd7;_0x563577[_0xaa3c('0x58')]=intUtil[_0xaa3c('0x59')](_0x563577[_0xaa3c('0x58')]);_0x563577['serverUrl']=intUtil[_0xaa3c('0x59')](_0x563577[_0xaa3c('0x5a')]);def['uri']=util['format'](_0xaa3c('0x5b'),_0x563577['remoteUri']);if(_0x1f7b80&&_0x1f7b80[_0xaa3c('0x7a')]){logger[_0xaa3c('0xf')]('['+_0x125844[_0xaa3c('0x7b')][_0xaa3c('0x7c')]()+']',_0xaa3c('0x5c'));_0x125844[_0xaa3c('0x5f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x563577[_0xaa3c('0x5a')],_0x125844[_0xaa3c('0x5e')],md5(_0x125844[_0xaa3c('0x5e')]));}else{_0x125844[_0xaa3c('0x5f')]='';}return getConnection(_0x563577)[_0xaa3c('0x2e')](function(_0x370d81){_0x269dd7=_0x370d81;if(!_[_0xaa3c('0x2a')](_0x2f64c6)){return getUser(_0x563577,_0x2f64c6[_0xaa3c('0x11')],_0x269dd7);}else{return getUser(_0x563577,null,_0x269dd7);}})[_0xaa3c('0x2e')](function(_0x13d409){_0x2d2b5c=_0x13d409;logger[_0xaa3c('0xf')](_0xaa3c('0x70'),_0x2d2b5c['id']);return getEndUser(_0x563577,_0x125844[_0xaa3c('0x60')],_0x125844[_0xaa3c('0x7d')],_0x269dd7);})[_0xaa3c('0x2e')](function(_0x58ecd5){_0x2d82a1=_0x58ecd5;logger[_0xaa3c('0xf')](_0xaa3c('0x72'),_0x2d82a1['id']);return getTicket(_0x563577,_0x2d2b5c,_0x2d82a1,_0x2f1b30,_0x125844,_0x2f1b30[_0xaa3c('0x61')],_0x269dd7,_0xaa3c('0x62'));})[_0xaa3c('0x2e')](function(_0x30d681){_0x83cb8a=_0x30d681;logger[_0xaa3c('0xf')]('Ticket\x20created!');logger[_0xaa3c('0xf')](_0xaa3c('0x75'),_0x83cb8a['id']);return setRelationship(_0x269dd7,_0x2d2b5c,_0x83cb8a,_0xaa3c('0x63'));})['then'](function(){return setRelationship(_0x269dd7,_0x2d82a1,_0x83cb8a,_0xaa3c('0x64'));})[_0xaa3c('0x2e')](function(){return getServerInfo(_0x269dd7);})[_0xaa3c('0x78')](function(_0x20dfd6){logger[_0xaa3c('0x6b')]('['+_0x125844[_0xaa3c('0x7b')]['toUpperCase']()+']',JSON[_0xaa3c('0x23')](_0x20dfd6));});}; \ 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 8573049..a19fcd2 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 _0x0da9=['Variable','name','toLowerCase','keyValue','keyType','string','key','keyContent','format','%s:\x20%s','join','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','type','push','content','variable','variableName','customVariable'];(function(_0x49c273,_0x456aa1){var _0x1d4451=function(_0x220827){while(--_0x220827){_0x49c273['push'](_0x49c273['shift']());}};_0x1d4451(++_0x456aa1);}(_0x0da9,0x1e4));var _0x90da=function(_0x5bf578,_0x52abff){_0x5bf578=_0x5bf578-0x0;var _0x2ac394=_0x0da9[_0x5bf578];return _0x2ac394;};'use strict';var _=require(_0x90da('0x0'));var util=require(_0x90da('0x1'));exports[_0x90da('0x2')]=function(_0x4af76a,_0x320e70,_0x57996b){var _0x386d74=[];if(_0x4af76a[_0x90da('0x3')]>0x0){var _0x4746c1=_['sortBy'](_0x4af76a,['id']);for(var _0x380bb9=0x0;_0x380bb9<_0x4746c1['length'];_0x380bb9++){var _0x194024=_0x4746c1[_0x380bb9];if(_0x194024[_0x90da('0x4')]==='string'){_0x386d74[_0x90da('0x5')](_0x194024[_0x90da('0x6')]);}else if(_0x194024[_0x90da('0x4')]===_0x90da('0x7')&&_0x194024[_0x90da('0x8')]){_0x320e70[_0x194024[_0x90da('0x8')]]&&_0x386d74[_0x90da('0x5')](_0x320e70[_0x194024[_0x90da('0x8')]]['toString']());}else if(_0x194024['type']===_0x90da('0x9')&&_0x194024[_0x90da('0xa')]&&_0x194024['Variable'][_0x90da('0xb')]){_0x320e70[_0x194024[_0x90da('0xa')][_0x90da('0xb')][_0x90da('0xc')]()]&&_0x386d74[_0x90da('0x5')](_0x320e70[_0x194024['Variable'][_0x90da('0xb')][_0x90da('0xc')]()]['toString']());}else if(_0x194024['type']===_0x90da('0xd')){if(_0x194024[_0x90da('0xe')]===_0x90da('0xf')&&_0x194024[_0x90da('0x10')]){_0x386d74[_0x90da('0x5')](util['format']('%s:\x20%s',_0x194024['key'],_0x194024[_0x90da('0x11')]));}else if(_0x194024[_0x90da('0xe')]===_0x90da('0x7')&&_0x194024[_0x90da('0x8')]&&_0x194024[_0x90da('0x10')]){_0x320e70[_0x194024[_0x90da('0x8')]]&&_0x386d74[_0x90da('0x5')](util[_0x90da('0x12')]('%s:\x20%s',_0x194024[_0x90da('0x10')],_0x320e70[_0x194024[_0x90da('0x8')]]));}else if(_0x194024[_0x90da('0xe')]===_0x90da('0x9')&&_0x194024[_0x90da('0xa')]&&_0x194024[_0x90da('0xa')][_0x90da('0xb')]&&_0x194024['key']){_0x320e70[_0x194024[_0x90da('0xa')][_0x90da('0xb')][_0x90da('0xc')]()]&&_0x386d74[_0x90da('0x5')](util['format'](_0x90da('0x13'),_0x194024[_0x90da('0x10')],_0x320e70[_0x194024['Variable'][_0x90da('0xb')]['toLowerCase']()]));}}}}return _0x386d74[_0x90da('0x14')](_0x57996b);};exports['stripTrailingSlash']=function(_0x568ca6){var _0x41c662=_0x568ca6['slice'](-0x1);if(_0x41c662==='/'){_0x568ca6=_0x568ca6[_0x90da('0x15')](0x0,_0x568ca6[_0x90da('0x16')](_0x41c662));}return _0x568ca6;};exports[_0x90da('0x17')]=function(_0x174307){if(!_[_0x90da('0x18')](_0x174307)&&_0x174307!==''){var _0x18bad6=/^(([^<>()\[\]\\.,;:\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 _0x18bad6[_0x90da('0x19')](String(_0x174307)[_0x90da('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x9b91=['type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','slice','substring','lastIndexOf','test','lodash','util','getString','sortBy','length'];(function(_0x51b79c,_0x5bdef4){var _0x5becfc=function(_0x511ef8){while(--_0x511ef8){_0x51b79c['push'](_0x51b79c['shift']());}};_0x5becfc(++_0x5bdef4);}(_0x9b91,0x67));var _0x19b9=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0x9b91[_0x38fb0d];return _0x30a5d6;};'use strict';var _=require(_0x19b9('0x0'));var util=require(_0x19b9('0x1'));exports[_0x19b9('0x2')]=function(_0x21895e,_0x71524,_0x59059e){var _0x1aa46c=[];if(_0x21895e['length']>0x0){var _0x326537=_[_0x19b9('0x3')](_0x21895e,['id']);for(var _0x562a25=0x0;_0x562a25<_0x326537[_0x19b9('0x4')];_0x562a25++){var _0x2d588b=_0x326537[_0x562a25];if(_0x2d588b[_0x19b9('0x5')]===_0x19b9('0x6')){_0x1aa46c[_0x19b9('0x7')](_0x2d588b[_0x19b9('0x8')]);}else if(_0x2d588b[_0x19b9('0x5')]===_0x19b9('0x9')&&_0x2d588b[_0x19b9('0xa')]){_0x71524[_0x2d588b['variableName']]&&_0x1aa46c[_0x19b9('0x7')](_0x71524[_0x2d588b['variableName']][_0x19b9('0xb')]());}else if(_0x2d588b['type']===_0x19b9('0xc')&&_0x2d588b['Variable']&&_0x2d588b[_0x19b9('0xd')][_0x19b9('0xe')]){_0x71524[_0x2d588b[_0x19b9('0xd')][_0x19b9('0xe')][_0x19b9('0xf')]()]&&_0x1aa46c[_0x19b9('0x7')](_0x71524[_0x2d588b[_0x19b9('0xd')][_0x19b9('0xe')][_0x19b9('0xf')]()][_0x19b9('0xb')]());}else if(_0x2d588b[_0x19b9('0x5')]===_0x19b9('0x10')){if(_0x2d588b['keyType']===_0x19b9('0x6')&&_0x2d588b[_0x19b9('0x11')]){_0x1aa46c[_0x19b9('0x7')](util[_0x19b9('0x12')](_0x19b9('0x13'),_0x2d588b[_0x19b9('0x11')],_0x2d588b[_0x19b9('0x14')]));}else if(_0x2d588b[_0x19b9('0x15')]===_0x19b9('0x9')&&_0x2d588b[_0x19b9('0xa')]&&_0x2d588b['key']){_0x71524[_0x2d588b[_0x19b9('0xa')]]&&_0x1aa46c[_0x19b9('0x7')](util[_0x19b9('0x12')](_0x19b9('0x13'),_0x2d588b[_0x19b9('0x11')],_0x71524[_0x2d588b[_0x19b9('0xa')]]));}else if(_0x2d588b[_0x19b9('0x15')]===_0x19b9('0xc')&&_0x2d588b['Variable']&&_0x2d588b['Variable']['name']&&_0x2d588b['key']){_0x71524[_0x2d588b[_0x19b9('0xd')][_0x19b9('0xe')][_0x19b9('0xf')]()]&&_0x1aa46c[_0x19b9('0x7')](util[_0x19b9('0x12')]('%s:\x20%s',_0x2d588b[_0x19b9('0x11')],_0x71524[_0x2d588b[_0x19b9('0xd')][_0x19b9('0xe')][_0x19b9('0xf')]()]));}}}}return _0x1aa46c[_0x19b9('0x16')](_0x59059e);};exports['stripTrailingSlash']=function(_0x3750f4){var _0x467060=_0x3750f4[_0x19b9('0x17')](-0x1);if(_0x467060==='/'){_0x3750f4=_0x3750f4[_0x19b9('0x18')](0x0,_0x3750f4[_0x19b9('0x19')](_0x467060));}return _0x3750f4;};exports['validateEmail']=function(_0x2c4ac8){if(!_['isNil'](_0x2c4ac8)&&_0x2c4ac8!==''){var _0x194ef=/^(([^<>()\[\]\\.,;:\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 _0x194ef[_0x19b9('0x1a')](String(_0x2c4ac8)[_0x19b9('0xf')]());}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 4d5f47e..62447ff 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(_0x24a312,_0x816625){var _0x4ac91f=function(_0x55e130){while(--_0x55e130){_0x24a312['push'](_0x24a312['shift']());}};_0x4ac91f(++_0x816625);}(_0xe706,0xa3));var _0x6e70=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xe706[_0x2fc012];return _0x2891f9;};'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 _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(_0x336221,_0x4e04de){var _0x2ad2a5=function(_0x1d46aa){while(--_0x1d46aa){_0x336221['push'](_0x336221['shift']());}};_0x2ad2a5(++_0x4e04de);}(_0xe706,0xa3));var _0x6e70=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0xe706[_0x1265fa];return _0x1fe35e;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index b2ee5eb..534ef9d 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 _0xa735=['The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','name','getString','Subjects','Fields','then','info','Ticket\x20created!','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','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','results','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','includes','string','picklist','nameField','customField','toLowerCase','type','idField','push','content','variableName','customVariable','Variable','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','Recording\x20is\x20enabled!'];(function(_0x99066,_0x40070e){var _0x2c2a62=function(_0x554422){while(--_0x554422){_0x99066['push'](_0x99066['shift']());}};_0x2c2a62(++_0x40070e);}(_0xa735,0x7a));var _0x5a73=function(_0x4fd272,_0x51386e){_0x4fd272=_0x4fd272-0x0;var _0x7ad0c1=_0xa735[_0x4fd272];return _0x7ad0c1;};'use strict';var _=require(_0x5a73('0x0'));var rp=require('request-promise');var md5=require(_0x5a73('0x1'));var util=require(_0x5a73('0x2'));var Redis=require(_0x5a73('0x3'));var intUtil=require(_0x5a73('0x4'));var config=require(_0x5a73('0x5'));var logger=require('../../../../config/logger')(_0x5a73('0x6'));config['redis']=_['defaults'](config[_0x5a73('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5d3870,_0x5732c7,_0x15458b){io['to'](_0x5d3870)[_0x5a73('0x8')](_0x5732c7,_0x15458b);}var headers={'Content-Type':_0x5a73('0x9'),'Accept':'application/json'};function getTicket(_0x350f7d,_0x30b3fa,_0x47c5b4,_0x187e67,_0x14cd07){logger['info'](_0x5a73('0xa'));return request({'uri':util[_0x5a73('0xb')](_0x5a73('0xc'),_0x350f7d[_0x5a73('0xd')]),'method':_0x5a73('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x47c5b4['id'],'submitter_id':_0x30b3fa?_0x30b3fa['id']:undefined,'assignee_id':_0x30b3fa?_0x30b3fa['id']:undefined,'tags':getTags(_0x187e67['Tags'],_0x5a73('0xf')),'subject':intUtil[_0x5a73('0x10')](_0x187e67[_0x5a73('0x11')],_0x14cd07,'\x20'),'description':intUtil['getString'](_0x187e67['Descriptions'],_0x14cd07,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5a73('0x10')](_0x187e67['Descriptions'],_0x14cd07,'\x0a')}},getCustomFields(_0x187e67[_0x5a73('0x12')],_0x14cd07))}})[_0x5a73('0x13')](function(_0x1689e6){logger[_0x5a73('0x14')](_0x5a73('0x15'));return _0x1689e6['ticket'];});}function getUser(_0x29d680,_0x42c0e2){if(intUtil[_0x5a73('0x16')](_0x42c0e2)){logger[_0x5a73('0x14')]('Getting\x20agent\x20with\x20email',_0x42c0e2);return request({'uri':util[_0x5a73('0xb')](_0x5a73('0x17'),_0x29d680[_0x5a73('0xd')]),'qs':{'query':util[_0x5a73('0xb')](_0x5a73('0x18'),_0x42c0e2)}})[_0x5a73('0x13')](function(_0x204831){if(_0x204831[_0x5a73('0x19')]){logger['info'](_0x5a73('0x1a'));return _[_0x5a73('0x1b')](_0x204831['results'],{'email':_0x42c0e2,'role':_0x5a73('0x1c')});}else{logger['info'](_0x5a73('0x1d'));return request({'uri':util[_0x5a73('0xb')]('%s/users/me.json',_0x29d680[_0x5a73('0xd')])})[_0x5a73('0x13')](function(_0x5bfa33){logger[_0x5a73('0x14')](_0x5a73('0x1e'));return _0x5bfa33[_0x5a73('0x1f')];});}});}else{logger[_0x5a73('0x14')](_0x5a73('0x1d'));return request({'uri':util['format'](_0x5a73('0x20'),_0x29d680[_0x5a73('0xd')])})['then'](function(_0x5f2a7e){logger[_0x5a73('0x14')](_0x5a73('0x1e'));return _0x5f2a7e[_0x5a73('0x1f')];});}}function getEndUser(_0x2f0f98,_0x538914,_0x5ae8d7){logger[_0x5a73('0x14')](_0x5a73('0x21'),_0x5ae8d7);return request({'uri':util[_0x5a73('0xb')](_0x5a73('0x17'),_0x2f0f98[_0x5a73('0xd')]),'qs':{'query':util['format'](_0x5a73('0x22'),_0x5ae8d7)}})[_0x5a73('0x13')](function(_0x29c509){var _0x5be942;if(_0x29c509['results'][_0x5a73('0x23')]){_0x29c509[_0x5a73('0x24')]=_[_0x5a73('0x25')](_0x29c509[_0x5a73('0x24')],{'suspended':![],'role':_0x5a73('0x26')});if(_0x29c509[_0x5a73('0x24')][_0x5a73('0x23')]){_0x5be942=_[_0x5a73('0x27')](_0x29c509[_0x5a73('0x24')]);}}if(_0x5be942){logger[_0x5a73('0x14')](_0x5a73('0x28'));return _0x5be942;}else{logger[_0x5a73('0x14')](_0x5a73('0x29'));return request({'uri':util[_0x5a73('0xb')](_0x5a73('0x2a'),_0x2f0f98[_0x5a73('0xd')]),'method':_0x5a73('0xe'),'body':{'user':{'role':_0x5a73('0x26'),'name':util[_0x5a73('0xb')](_0x5a73('0x2b'),_0x538914||_0x5ae8d7),'phone':_0x5ae8d7}}})['then'](function(_0x3405ee){logger[_0x5a73('0x14')](_0x5a73('0x2c'));return _0x3405ee[_0x5a73('0x1f')];});}});}function getAuth(_0xbb2985){var _0x57aaa5;if(_0xbb2985[_0x5a73('0x2d')]===_0x5a73('0x2e')){_0x57aaa5=util['format']('%s:%s',_0xbb2985['username'],_0xbb2985[_0x5a73('0x2e')]);}else if(_0xbb2985[_0x5a73('0x2d')]===_0x5a73('0x2f')){_0x57aaa5=util['format'](_0x5a73('0x30'),_0xbb2985['username'],_0xbb2985[_0x5a73('0x2f')]);}return util[_0x5a73('0xb')](_0x5a73('0x31'),new Buffer(_0x57aaa5)[_0x5a73('0x32')](_0x5a73('0x33')));}function request(_0x6e96af){logger[_0x5a73('0x34')](_0x5a73('0x35'),JSON[_0x5a73('0x36')](_0x6e96af));return rp(_[_0x5a73('0x37')](_0x6e96af,{'method':_0x5a73('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x23ded6,_0x1dc567){var _0x4d5b3b=[];if(_0x23ded6&&_0x23ded6[_0x5a73('0x23')]>0x0){_0x4d5b3b=_[_0x5a73('0x39')](_0x23ded6,_0x1dc567);}return _0x4d5b3b;}function getCustomFields(_0x942b4,_0x2b82dc){var _0x12da34=[];var _0x39ac47={'custom_fields':[]};if(_0x942b4[_0x5a73('0x23')]>0x0){_['forEach'](_0x942b4,function(_0x53425f){if(_[_0x5a73('0x3a')]([_0x5a73('0x3b'),_0x5a73('0x3c')],_0x53425f['type'])&&_0x53425f[_0x5a73('0x3d')]&&!_0x53425f[_0x5a73('0x3e')]){_0x39ac47[_0x53425f['nameField'][_0x5a73('0x3f')]()]=_0x53425f['content']['toString']();}else if(_[_0x5a73('0x3a')](['string',_0x5a73('0x3c')],_0x53425f[_0x5a73('0x40')])&&_0x53425f[_0x5a73('0x41')]&&_0x53425f['customField']){_0x39ac47['custom_fields'][_0x5a73('0x42')]({'id':_0x53425f[_0x5a73('0x41')],'value':_0x53425f[_0x5a73('0x43')]['toString']()});}else if(_0x53425f[_0x5a73('0x40')]==='variable'&&_0x53425f[_0x5a73('0x44')]&&_0x53425f[_0x5a73('0x41')]&&_0x53425f[_0x5a73('0x3e')]){_0x2b82dc[_0x53425f['variableName']]&&_0x39ac47['custom_fields'][_0x5a73('0x42')]({'id':_0x53425f[_0x5a73('0x41')],'value':_0x2b82dc[_0x53425f['variableName']][_0x5a73('0x32')]()});}else if(_0x53425f['type']===_0x5a73('0x45')&&_0x53425f['Variable']&&_0x53425f[_0x5a73('0x46')][_0x5a73('0xf')]&&_0x53425f[_0x5a73('0x41')]&&_0x53425f[_0x5a73('0x3e')]){_0x2b82dc[_0x53425f[_0x5a73('0x46')][_0x5a73('0xf')][_0x5a73('0x3f')]()]&&_0x39ac47[_0x5a73('0x47')][_0x5a73('0x42')]({'id':_0x53425f['idField'],'value':_0x2b82dc[_0x53425f['Variable'][_0x5a73('0xf')][_0x5a73('0x3f')]()]['toString']()});}});}return _0x39ac47;}exports[_0x5a73('0x48')]=function(_0x5b524d,_0x3420ab,_0x27e316,_0x2f47a3,_0x41efe6,_0x3c33ca){var _0x5b455e,_0x21206d;_0x3c33ca[_0x5a73('0xd')]=intUtil[_0x5a73('0x49')](_0x3c33ca[_0x5a73('0xd')]);_0x3c33ca[_0x5a73('0x4a')]=intUtil[_0x5a73('0x49')](_0x3c33ca[_0x5a73('0x4a')]);if(_0x41efe6&&_0x41efe6[_0x5a73('0x4b')]){logger[_0x5a73('0x14')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3420ab['recordingURL']=util[_0x5a73('0xb')](_0x5a73('0x4c'),_0x3c33ca[_0x5a73('0x4a')],_0x3420ab[_0x5a73('0x4d')],md5(_0x3420ab[_0x5a73('0x4d')]));}else{_0x3420ab[_0x5a73('0x4e')]='';}headers[_0x5a73('0x4f')]=getAuth(_0x3c33ca);return getUser(_0x3c33ca,_0x2f47a3[_0x5a73('0x50')])[_0x5a73('0x13')](function(_0x376f0c){_0x5b455e=_0x376f0c;logger[_0x5a73('0x14')]('The\x20User\x20ID\x20is:',_0x5b455e['id']);return getEndUser(_0x3c33ca,_0x3420ab[_0x5a73('0x51')],_0x3420ab[_0x5a73('0x52')]);})[_0x5a73('0x13')](function(_0x4ff491){_0x21206d=_0x4ff491;logger[_0x5a73('0x14')](_0x5a73('0x53'),_0x21206d['id']);return getTicket(_0x3c33ca,_0x5b455e,_0x21206d,_0x27e316,_0x3420ab);})[_0x5a73('0x13')](function(_0x75cd33){if(_0x75cd33){logger['info'](_0x5a73('0x54'),_0x75cd33['id']);switch(_0x3c33ca[_0x5a73('0x40')]){case _0x5a73('0x55'):logger[_0x5a73('0x14')]('[QUEUE]',_0x5a73('0x56'));return request({'uri':util[_0x5a73('0xb')](_0x5a73('0x57'),_0x3c33ca[_0x5a73('0xd')],_0x5b455e['id'],_0x75cd33['id']),'method':_0x5a73('0xe')});case _0x5a73('0x58'):logger[_0x5a73('0x14')](_0x5a73('0x59'),_0x5a73('0x5a'));emit(util['format'](_0x5a73('0x5b'),_0x2f47a3[_0x5a73('0xf')]),_0x5a73('0x5c'),{'uri':util[_0x5a73('0xb')]('%s/agent/tickets/%s',_0x3c33ca[_0x5a73('0xd')][_0x5a73('0x5d')](_0x5a73('0x5e'),''),_0x75cd33['id'])});break;default:logger[_0x5a73('0x5f')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5a73('0x60')](function(_0x3a906b){logger[_0x5a73('0x5f')](_0x5a73('0x61'),util['inspect'](_0x3a906b,{'showHidden':!![],'depth':null}));});};exports[_0x5a73('0x62')]=function(_0x2a4894,_0x5abe24,_0x3bd55b,_0x1a6cab,_0x52fef5,_0x24c985,_0x49aa26){var _0x47d5df,_0x18fcb6;_0x24c985[_0x5a73('0xd')]=intUtil[_0x5a73('0x49')](_0x24c985[_0x5a73('0xd')]);_0x24c985[_0x5a73('0x4a')]=intUtil[_0x5a73('0x49')](_0x24c985[_0x5a73('0x4a')]);if(_0x49aa26&&_0x49aa26[_0x5a73('0x63')]&&_0x49aa26[_0x5a73('0x63')]!==_0x5a73('0x64')){logger[_0x5a73('0x14')]('[OUTBOUND]',_0x5a73('0x65'));_0x5abe24['recordingURL']=util['format'](_0x5a73('0x4c'),_0x24c985[_0x5a73('0x4a')],_0x5abe24[_0x5a73('0x4d')],md5(_0x5abe24['uniqueid']));}headers[_0x5a73('0x4f')]=getAuth(_0x24c985);return getUser(_0x24c985,_0x1a6cab[_0x5a73('0x50')])['then'](function(_0x549154){_0x47d5df=_0x549154;logger[_0x5a73('0x14')](_0x5a73('0x66'),_0x47d5df['id']);return getEndUser(_0x24c985,_0x5abe24[_0x5a73('0x67')],_0x5abe24[_0x5a73('0x68')]);})[_0x5a73('0x13')](function(_0x50dd9a){_0x18fcb6=_0x50dd9a;logger[_0x5a73('0x14')](_0x5a73('0x53'),_0x18fcb6['id']);return getTicket(_0x24c985,_0x47d5df,_0x18fcb6,_0x3bd55b,_0x5abe24);})['then'](function(_0x59b3a8){if(_0x59b3a8){logger['info']('The\x20Ticket\x20ID\x20is:',_0x59b3a8['id']);switch(_0x24c985[_0x5a73('0x40')]){case _0x5a73('0x55'):logger['info'](_0x5a73('0x69'),_0x5a73('0x56'));return request({'uri':util[_0x5a73('0xb')](_0x5a73('0x57'),_0x24c985['remoteUri'],_0x47d5df['id'],_0x59b3a8['id']),'method':_0x5a73('0xe')});case _0x5a73('0x58'):logger[_0x5a73('0x14')]('[OUTBOUND]',_0x5a73('0x5a'));emit(util[_0x5a73('0xb')](_0x5a73('0x5b'),_0x1a6cab['name']),_0x5a73('0x5c'),{'uri':util['format'](_0x5a73('0x6a'),_0x24c985[_0x5a73('0xd')][_0x5a73('0x5d')](_0x5a73('0x5e'),''),_0x59b3a8['id'])});break;default:logger[_0x5a73('0x5f')](_0x5a73('0x69'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5a73('0x60')](function(_0x227364){logger[_0x5a73('0x5f')](_0x5a73('0x6b'),util[_0x5a73('0x6c')](_0x227364,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x48cdd8,_0x5aa8dc,_0x277866,_0x59c60a,_0x383c02,_0x270830){var _0x3cc463,_0x331c70;_0x270830[_0x5a73('0xd')]=intUtil[_0x5a73('0x49')](_0x270830[_0x5a73('0xd')]);_0x270830[_0x5a73('0x4a')]=intUtil[_0x5a73('0x49')](_0x270830['serverUrl']);if(_0x383c02&&_0x383c02[_0x5a73('0x4b')]){logger['info']('['+_0x5aa8dc[_0x5a73('0x6d')][_0x5a73('0x6e')]()+']',_0x5a73('0x65'));_0x5aa8dc['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x270830[_0x5a73('0x4a')],_0x5aa8dc['uniqueid'],md5(_0x5aa8dc[_0x5a73('0x4d')]));}else{_0x5aa8dc['recordingURL']='';}headers[_0x5a73('0x4f')]=getAuth(_0x270830);return getUser(_0x270830)[_0x5a73('0x13')](function(_0x435865){_0x3cc463=_0x435865;logger[_0x5a73('0x14')](_0x5a73('0x66'),_0x3cc463['id']);return getEndUser(_0x270830,_0x5aa8dc[_0x5a73('0x51')],_0x5aa8dc[_0x5a73('0x52')]);})['then'](function(_0x1650e6){_0x331c70=_0x1650e6;logger[_0x5a73('0x14')]('The\x20Enduser\x20ID\x20is:',_0x331c70['id']);return getTicket(_0x270830,_0x3cc463,_0x331c70,_0x277866,_0x5aa8dc);})['then'](function(_0x4fdea4){if(_0x4fdea4){logger[_0x5a73('0x14')](_0x5a73('0x54'),_0x4fdea4['id']);}})[_0x5a73('0x60')](function(_0x33e614){logger['error']('['+_0x5aa8dc[_0x5a73('0x6d')][_0x5a73('0x6e')]()+']'+_0x5a73('0x6f'),util[_0x5a73('0x6c')](_0x33e614,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3662=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','newTab','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','password','username','authType','token','toString','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','content','customField','idField','variable','variableName','custom_fields','Variable','toLowerCase'];(function(_0x17f49a,_0x452eb3){var _0x2626f4=function(_0x387c1e){while(--_0x387c1e){_0x17f49a['push'](_0x17f49a['shift']());}};_0x2626f4(++_0x452eb3);}(_0x3662,0x94));var _0x2366=function(_0x4aba1d,_0x4ac679){_0x4aba1d=_0x4aba1d-0x0;var _0x370932=_0x3662[_0x4aba1d];return _0x370932;};'use strict';var _=require(_0x2366('0x0'));var rp=require('request-promise');var md5=require(_0x2366('0x1'));var util=require(_0x2366('0x2'));var Redis=require(_0x2366('0x3'));var intUtil=require(_0x2366('0x4'));var config=require(_0x2366('0x5'));var logger=require(_0x2366('0x6'))(_0x2366('0x7'));config[_0x2366('0x8')]=_[_0x2366('0x9')](config[_0x2366('0x8')],{'host':_0x2366('0xa'),'port':0x18eb});var io=require(_0x2366('0xb'))(new Redis(config[_0x2366('0x8')]));function emit(_0x57df21,_0x13f64c,_0x1aa030){io['to'](_0x57df21)[_0x2366('0xc')](_0x13f64c,_0x1aa030);}var headers={'Content-Type':_0x2366('0xd'),'Accept':_0x2366('0xd')};function getTicket(_0x3e1b83,_0x5b56aa,_0x1883b5,_0x4ea8af,_0x30d034){logger[_0x2366('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x2366('0xf')](_0x2366('0x10'),_0x3e1b83[_0x2366('0x11')]),'method':_0x2366('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x1883b5['id'],'submitter_id':_0x5b56aa?_0x5b56aa['id']:undefined,'assignee_id':_0x5b56aa?_0x5b56aa['id']:undefined,'tags':getTags(_0x4ea8af[_0x2366('0x13')],_0x2366('0x14')),'subject':intUtil['getString'](_0x4ea8af[_0x2366('0x15')],_0x30d034,'\x20'),'description':intUtil[_0x2366('0x16')](_0x4ea8af[_0x2366('0x17')],_0x30d034,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2366('0x16')](_0x4ea8af[_0x2366('0x17')],_0x30d034,'\x0a')}},getCustomFields(_0x4ea8af[_0x2366('0x18')],_0x30d034))}})[_0x2366('0x19')](function(_0xc319f5){logger[_0x2366('0xe')](_0x2366('0x1a'));return _0xc319f5[_0x2366('0x1b')];});}function getUser(_0x3c4995,_0x40f9e6){if(intUtil[_0x2366('0x1c')](_0x40f9e6)){logger[_0x2366('0xe')](_0x2366('0x1d'),_0x40f9e6);return request({'uri':util[_0x2366('0xf')](_0x2366('0x1e'),_0x3c4995['remoteUri']),'qs':{'query':util[_0x2366('0xf')](_0x2366('0x1f'),_0x40f9e6)}})[_0x2366('0x19')](function(_0x4b0c24){if(_0x4b0c24[_0x2366('0x20')]){logger['info']('Agent\x20found!');return _[_0x2366('0x21')](_0x4b0c24['results'],{'email':_0x40f9e6,'role':_0x2366('0x22')});}else{logger['info'](_0x2366('0x23'));return request({'uri':util[_0x2366('0xf')](_0x2366('0x24'),_0x3c4995[_0x2366('0x11')])})['then'](function(_0x2b078e){logger[_0x2366('0xe')]('Admin\x20account\x20selected.');return _0x2b078e[_0x2366('0x25')];});}});}else{logger[_0x2366('0xe')](_0x2366('0x23'));return request({'uri':util['format']('%s/users/me.json',_0x3c4995[_0x2366('0x11')])})[_0x2366('0x19')](function(_0x3b45aa){logger[_0x2366('0xe')](_0x2366('0x26'));return _0x3b45aa[_0x2366('0x25')];});}}function getEndUser(_0x3abf3d,_0x55bd2a,_0x526e68){logger['info'](_0x2366('0x27'),_0x526e68);return request({'uri':util[_0x2366('0xf')]('%s/search.json',_0x3abf3d[_0x2366('0x11')]),'qs':{'query':util[_0x2366('0xf')](_0x2366('0x28'),_0x526e68)}})[_0x2366('0x19')](function(_0x596837){var _0x267b0e;if(_0x596837[_0x2366('0x29')][_0x2366('0x2a')]){_0x596837[_0x2366('0x29')]=_[_0x2366('0x2b')](_0x596837[_0x2366('0x29')],{'suspended':![],'role':_0x2366('0x2c')});if(_0x596837['results'][_0x2366('0x2a')]){_0x267b0e=_['first'](_0x596837[_0x2366('0x29')]);}}if(_0x267b0e){logger[_0x2366('0xe')](_0x2366('0x2d'));return _0x267b0e;}else{logger[_0x2366('0xe')](_0x2366('0x2e'));return request({'uri':util[_0x2366('0xf')]('%s/users.json',_0x3abf3d[_0x2366('0x11')]),'method':_0x2366('0x12'),'body':{'user':{'role':_0x2366('0x2c'),'name':util[_0x2366('0xf')](_0x2366('0x2f'),_0x55bd2a||_0x526e68),'phone':_0x526e68}}})[_0x2366('0x19')](function(_0x5028c5){logger[_0x2366('0xe')](_0x2366('0x30'));return _0x5028c5['user'];});}});}function getAuth(_0x53c5fb){var _0x43a6dc;if(_0x53c5fb['authType']===_0x2366('0x31')){_0x43a6dc=util[_0x2366('0xf')]('%s:%s',_0x53c5fb[_0x2366('0x32')],_0x53c5fb[_0x2366('0x31')]);}else if(_0x53c5fb[_0x2366('0x33')]===_0x2366('0x34')){_0x43a6dc=util[_0x2366('0xf')]('%s/token:%s',_0x53c5fb['username'],_0x53c5fb[_0x2366('0x34')]);}return util['format']('Basic\x20%s',new Buffer(_0x43a6dc)[_0x2366('0x35')]('base64'));}function request(_0x14de59){logger[_0x2366('0x36')](_0x2366('0x37'),JSON[_0x2366('0x38')](_0x14de59));return rp(_[_0x2366('0x9')](_0x14de59,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xc52f2f,_0x1bd1fa){var _0xa30db2=[];if(_0xc52f2f&&_0xc52f2f[_0x2366('0x2a')]>0x0){_0xa30db2=_['map'](_0xc52f2f,_0x1bd1fa);}return _0xa30db2;}function getCustomFields(_0x405d50,_0x2ee179){var _0x4edec4=[];var _0x332b1f={'custom_fields':[]};if(_0x405d50[_0x2366('0x2a')]>0x0){_[_0x2366('0x39')](_0x405d50,function(_0x4cb171){if(_[_0x2366('0x3a')]([_0x2366('0x3b'),_0x2366('0x3c')],_0x4cb171[_0x2366('0x3d')])&&_0x4cb171['nameField']&&!_0x4cb171['customField']){_0x332b1f[_0x4cb171['nameField']['toLowerCase']()]=_0x4cb171[_0x2366('0x3e')][_0x2366('0x35')]();}else if(_[_0x2366('0x3a')]([_0x2366('0x3b'),_0x2366('0x3c')],_0x4cb171[_0x2366('0x3d')])&&_0x4cb171['idField']&&_0x4cb171[_0x2366('0x3f')]){_0x332b1f['custom_fields']['push']({'id':_0x4cb171[_0x2366('0x40')],'value':_0x4cb171[_0x2366('0x3e')][_0x2366('0x35')]()});}else if(_0x4cb171[_0x2366('0x3d')]===_0x2366('0x41')&&_0x4cb171['variableName']&&_0x4cb171['idField']&&_0x4cb171[_0x2366('0x3f')]){_0x2ee179[_0x4cb171[_0x2366('0x42')]]&&_0x332b1f[_0x2366('0x43')]['push']({'id':_0x4cb171[_0x2366('0x40')],'value':_0x2ee179[_0x4cb171[_0x2366('0x42')]][_0x2366('0x35')]()});}else if(_0x4cb171[_0x2366('0x3d')]==='customVariable'&&_0x4cb171['Variable']&&_0x4cb171[_0x2366('0x44')]['name']&&_0x4cb171['idField']&&_0x4cb171[_0x2366('0x3f')]){_0x2ee179[_0x4cb171['Variable'][_0x2366('0x14')][_0x2366('0x45')]()]&&_0x332b1f['custom_fields']['push']({'id':_0x4cb171[_0x2366('0x40')],'value':_0x2ee179[_0x4cb171[_0x2366('0x44')][_0x2366('0x14')][_0x2366('0x45')]()][_0x2366('0x35')]()});}});}return _0x332b1f;}exports['queue']=function(_0x2bcce2,_0x45eada,_0x3b77b7,_0x2f9a65,_0x26cd44,_0x16dec1){var _0x30fad5,_0x3096b1;_0x16dec1[_0x2366('0x11')]=intUtil[_0x2366('0x46')](_0x16dec1['remoteUri']);_0x16dec1[_0x2366('0x47')]=intUtil[_0x2366('0x46')](_0x16dec1['serverUrl']);if(_0x26cd44&&_0x26cd44[_0x2366('0x48')]){logger[_0x2366('0xe')](_0x2366('0x49'),'Recording\x20is\x20enabled!');_0x45eada['recordingURL']=util[_0x2366('0xf')](_0x2366('0x4a'),_0x16dec1[_0x2366('0x47')],_0x45eada['uniqueid'],md5(_0x45eada['uniqueid']));}else{_0x45eada[_0x2366('0x4b')]='';}headers[_0x2366('0x4c')]=getAuth(_0x16dec1);return getUser(_0x16dec1,_0x2f9a65[_0x2366('0x4d')])['then'](function(_0x3ccb09){_0x30fad5=_0x3ccb09;logger[_0x2366('0xe')](_0x2366('0x4e'),_0x30fad5['id']);return getEndUser(_0x16dec1,_0x45eada['calleridname'],_0x45eada[_0x2366('0x4f')]);})[_0x2366('0x19')](function(_0x8369bc){_0x3096b1=_0x8369bc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3096b1['id']);return getTicket(_0x16dec1,_0x30fad5,_0x3096b1,_0x3b77b7,_0x45eada);})['then'](function(_0x9a0d51){if(_0x9a0d51){logger[_0x2366('0xe')](_0x2366('0x50'),_0x9a0d51['id']);switch(_0x16dec1[_0x2366('0x3d')]){case _0x2366('0x51'):logger[_0x2366('0xe')](_0x2366('0x49'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2366('0xf')](_0x2366('0x52'),_0x16dec1[_0x2366('0x11')],_0x30fad5['id'],_0x9a0d51['id']),'method':_0x2366('0x12')});case'newTab':logger[_0x2366('0xe')]('[QUEUE]',_0x2366('0x53'));emit(util[_0x2366('0xf')](_0x2366('0x54'),_0x2f9a65[_0x2366('0x14')]),_0x2366('0x55'),{'uri':util[_0x2366('0xf')]('%s/agent/tickets/%s',_0x16dec1[_0x2366('0x11')][_0x2366('0x56')](_0x2366('0x57'),''),_0x9a0d51['id'])});break;default:logger[_0x2366('0x58')]('[QUEUE]',_0x2366('0x59'));}}})[_0x2366('0x5a')](function(_0x5b3f3c){logger['error'](_0x2366('0x5b'),util[_0x2366('0x5c')](_0x5b3f3c,{'showHidden':!![],'depth':null}));});};exports[_0x2366('0x5d')]=function(_0x5ad6c0,_0x5dfc9e,_0x2b46f5,_0x283003,_0x418eff,_0x2df736,_0x5f304d){var _0xd0a162,_0x465c9c;_0x2df736['remoteUri']=intUtil[_0x2366('0x46')](_0x2df736[_0x2366('0x11')]);_0x2df736['serverUrl']=intUtil[_0x2366('0x46')](_0x2df736[_0x2366('0x47')]);if(_0x5f304d&&_0x5f304d['recordingFormat']&&_0x5f304d[_0x2366('0x5e')]!==_0x2366('0x5f')){logger[_0x2366('0xe')]('[OUTBOUND]',_0x2366('0x60'));_0x5dfc9e[_0x2366('0x4b')]=util[_0x2366('0xf')](_0x2366('0x4a'),_0x2df736['serverUrl'],_0x5dfc9e['uniqueid'],md5(_0x5dfc9e[_0x2366('0x61')]));}headers[_0x2366('0x4c')]=getAuth(_0x2df736);return getUser(_0x2df736,_0x283003[_0x2366('0x4d')])[_0x2366('0x19')](function(_0x314ae6){_0xd0a162=_0x314ae6;logger['info']('The\x20User\x20ID\x20is:',_0xd0a162['id']);return getEndUser(_0x2df736,_0x5dfc9e[_0x2366('0x62')],_0x5dfc9e[_0x2366('0x63')]);})[_0x2366('0x19')](function(_0x20037d){_0x465c9c=_0x20037d;logger[_0x2366('0xe')](_0x2366('0x64'),_0x465c9c['id']);return getTicket(_0x2df736,_0xd0a162,_0x465c9c,_0x2b46f5,_0x5dfc9e);})[_0x2366('0x19')](function(_0x2612bb){if(_0x2612bb){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2612bb['id']);switch(_0x2df736[_0x2366('0x3d')]){case _0x2366('0x51'):logger[_0x2366('0xe')](_0x2366('0x65'),_0x2366('0x66'));return request({'uri':util[_0x2366('0xf')](_0x2366('0x52'),_0x2df736[_0x2366('0x11')],_0xd0a162['id'],_0x2612bb['id']),'method':_0x2366('0x12')});case _0x2366('0x67'):logger['info']('[OUTBOUND]',_0x2366('0x53'));emit(util['format'](_0x2366('0x54'),_0x283003[_0x2366('0x14')]),'trigger:browser:url',{'uri':util[_0x2366('0xf')](_0x2366('0x68'),_0x2df736[_0x2366('0x11')][_0x2366('0x56')]('/api/v2',''),_0x2612bb['id'])});break;default:logger[_0x2366('0x58')](_0x2366('0x65'),_0x2366('0x59'));}}})['catch'](function(_0x5d4a85){logger[_0x2366('0x58')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2366('0x5c')](_0x5d4a85,{'showHidden':!![],'depth':null}));});};exports[_0x2366('0x69')]=function(_0x31d71c,_0x50a300,_0x15acd4,_0x4f14d1,_0x4cc7ef,_0x1cbc04){var _0x40ab0a,_0x128efe;_0x1cbc04[_0x2366('0x11')]=intUtil['stripTrailingSlash'](_0x1cbc04['remoteUri']);_0x1cbc04[_0x2366('0x47')]=intUtil[_0x2366('0x46')](_0x1cbc04[_0x2366('0x47')]);if(_0x4cc7ef&&_0x4cc7ef[_0x2366('0x48')]){logger['info']('['+_0x50a300[_0x2366('0x6a')][_0x2366('0x6b')]()+']','Recording\x20is\x20enabled!');_0x50a300[_0x2366('0x4b')]=util['format'](_0x2366('0x4a'),_0x1cbc04[_0x2366('0x47')],_0x50a300['uniqueid'],md5(_0x50a300[_0x2366('0x61')]));}else{_0x50a300[_0x2366('0x4b')]='';}headers['Authorization']=getAuth(_0x1cbc04);return getUser(_0x1cbc04)[_0x2366('0x19')](function(_0x1bd903){_0x40ab0a=_0x1bd903;logger[_0x2366('0xe')]('The\x20User\x20ID\x20is:',_0x40ab0a['id']);return getEndUser(_0x1cbc04,_0x50a300[_0x2366('0x6c')],_0x50a300[_0x2366('0x4f')]);})[_0x2366('0x19')](function(_0x1518eb){_0x128efe=_0x1518eb;logger['info']('The\x20Enduser\x20ID\x20is:',_0x128efe['id']);return getTicket(_0x1cbc04,_0x40ab0a,_0x128efe,_0x15acd4,_0x50a300);})['then'](function(_0xfb5098){if(_0xfb5098){logger['info'](_0x2366('0x50'),_0xfb5098['id']);}})[_0x2366('0x5a')](function(_0x1434fb){logger[_0x2366('0x58')]('['+_0x50a300[_0x2366('0x6a')][_0x2366('0x6b')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1434fb,{'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 c59dc1e..f58d728 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 _0x5a68=['then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','code','SUCCESS','details','enduserType','Error:\x20','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','contact','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','talktime','format','mm:ss','answertime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','trigger:browser:url','recordingFormat','none','zoho.eu','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','Inbound','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','emit','debug','[HTTP]','stringify','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','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','clientId','clientSecret','refresh_token'];(function(_0x1eef4e,_0x5217d8){var _0x48414f=function(_0x2ab10a){while(--_0x2ab10a){_0x1eef4e['push'](_0x1eef4e['shift']());}};_0x48414f(++_0x5217d8);}(_0x5a68,0x1ae));var _0x85a6=function(_0x2cd87d,_0x58fd3e){_0x2cd87d=_0x2cd87d-0x0;var _0x49e2c1=_0x5a68[_0x2cd87d];return _0x49e2c1;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x85a6('0x0'));var util=require(_0x85a6('0x1'));var intUtil=require(_0x85a6('0x2'));var moment=require(_0x85a6('0x3'));var Redis=require(_0x85a6('0x4'));var BPromise=require(_0x85a6('0x5'));var config=require(_0x85a6('0x6'));var logger=require(_0x85a6('0x7'))(_0x85a6('0x8'));config['redis']=_[_0x85a6('0x9')](config[_0x85a6('0xa')],{'host':_0x85a6('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x85a6('0xa')]));function emit(_0x3dfeb7,_0x49c5d,_0x37b09d){io['to'](_0x3dfeb7)[_0x85a6('0xc')](_0x49c5d,_0x37b09d);}function request(_0x1a3a2c){logger[_0x85a6('0xd')](_0x85a6('0xe'),JSON[_0x85a6('0xf')](_0x1a3a2c));return rp(_0x1a3a2c);}function getCustomFields(_0x5e4518,_0x77420c){var _0x4bae34={};if(_0x5e4518['length']>0x0){_['forEach'](_0x5e4518,function(_0x1aafe1){if(_['includes'](['string','picklist'],_0x1aafe1['type'])&&_0x1aafe1[_0x85a6('0x10')]){_0x4bae34[_0x1aafe1[_0x85a6('0x10')]]=_0x1aafe1[_0x85a6('0x11')]['toString']();}else if(_0x1aafe1[_0x85a6('0x12')]===_0x85a6('0x13')&&_0x1aafe1[_0x85a6('0x14')]&&_0x1aafe1[_0x85a6('0x10')]&&_0x77420c[_0x1aafe1[_0x85a6('0x14')]]){_0x4bae34[_0x1aafe1[_0x85a6('0x10')]]=_0x77420c[_0x1aafe1[_0x85a6('0x14')]][_0x85a6('0x15')]();}else if(_0x1aafe1[_0x85a6('0x12')]===_0x85a6('0x16')&&_0x1aafe1['Variable']&&_0x1aafe1[_0x85a6('0x17')][_0x85a6('0x18')]&&_0x1aafe1[_0x85a6('0x10')]&&_0x77420c[_0x1aafe1[_0x85a6('0x17')]['name'][_0x85a6('0x19')]()]){_0x4bae34[_0x1aafe1[_0x85a6('0x10')]]=_0x77420c[_0x1aafe1['Variable'][_0x85a6('0x18')][_0x85a6('0x19')]()][_0x85a6('0x15')]();}});}return _0x4bae34;}function getName(_0x52c4c2){if(_0x52c4c2[_0x85a6('0x1a')]('\x20')>0x0){var _0x461380=_0x52c4c2['split'](/ (.+)/);if(_0x461380[0x1]){return _0x461380;}}return[_0x52c4c2,_0x52c4c2];}var accountsTokens={};function getAccessToken(_0x21b7df){return new Promise(function(_0x1c6a6c,_0x4329e6){if(!_[_0x85a6('0x1b')](accountsTokens[_0x21b7df['id']])&&!_[_0x85a6('0x1b')](accountsTokens[_0x21b7df['id']][_0x85a6('0x1c')])){if(moment()[_0x85a6('0x1d')](accountsTokens[_0x21b7df['id']]['expires_in'])){_0x1c6a6c(accountsTokens[_0x21b7df['id']]['access_token']);}}var _0x1c1ebb;switch(_0x21b7df[_0x85a6('0x1e')]){case'US':_0x1c1ebb=_0x85a6('0x1f');break;case'AU':_0x1c1ebb=_0x85a6('0x20');break;case'EU':_0x1c1ebb=_0x85a6('0x21');break;case'IN':_0x1c1ebb=_0x85a6('0x22');break;case'CN':_0x1c1ebb=_0x85a6('0x23');break;default:_0x1c1ebb=_0x85a6('0x21');break;}var _0x296ec7={'method':_0x85a6('0x24'),'uri':_0x1c1ebb+_0x85a6('0x25'),'qs':{'refresh_token':_0x21b7df['refreshToken'],'client_id':_0x21b7df[_0x85a6('0x26')],'client_secret':_0x21b7df[_0x85a6('0x27')],'grant_type':_0x85a6('0x28')},'json':!![]};return rp(_0x296ec7)[_0x85a6('0x29')](function(_0x88b82d){accountsTokens[_0x21b7df['id']]={'access_token':_0x88b82d[_0x85a6('0x1c')],'expires_in':moment()[_0x85a6('0x2a')](_0x88b82d['expires_in'],_0x85a6('0x2b'))};_0x1c6a6c(_0x88b82d[_0x85a6('0x1c')]);})[_0x85a6('0x2c')](function(_0x343801){logger[_0x85a6('0x2d')](_0x85a6('0x2e'),_0x343801[_0x85a6('0x2f')]);_0x4329e6(_0x343801);});});}function getUser(_0x517630,_0x442ce8,_0x154311,_0x40b337){logger[_0x85a6('0x30')](_0x85a6('0x31'));return request({'method':_0x85a6('0x32'),'uri':util['format'](_0x85a6('0x33'),_0x442ce8),'qs':{'type':_0x85a6('0x34')},'headers':{'Authorization':_0x85a6('0x35')+_0x517630},'json':!![]})['then'](function(_0x9123e3){if(_0x9123e3['users']){var _0x5a055e=-0x1;if(_['isArrayLikeObject'](_0x9123e3[_0x85a6('0x36')])){if(!_[_0x85a6('0x1b')](_0x40b337)){_0x5a055e=_[_0x85a6('0x37')](_0x9123e3[_0x85a6('0x36')],function(_0x1d5511){return _0x1d5511[_0x85a6('0x38')]===_0x40b337;});}if(_0x5a055e>=0x0){logger[_0x85a6('0x30')]('Agent\x20found!');}else{logger[_0x85a6('0x30')](_0x85a6('0x39'));_0x5a055e=_[_0x85a6('0x37')](_0x9123e3[_0x85a6('0x36')],function(_0x210f35){return _0x210f35[_0x85a6('0x3a')][_0x85a6('0x18')]===_0x85a6('0x3b');});}return _0x9123e3[_0x85a6('0x36')][_0x5a055e];}else{if(_0x9123e3['user'][_0x85a6('0x3a')][_0x85a6('0x18')]==='Administrator'){logger[_0x85a6('0x30')]('Using\x20the\x20admin\x20account!');user=_0x9123e3[_0x85a6('0x3c')];return user;}else{logger[_0x85a6('0x2d')](_0x85a6('0x3d'),JSON[_0x85a6('0xf')](_0x9123e3));throw new Error(_0x85a6('0x3e')+JSON[_0x85a6('0xf')](_0x9123e3));}}}else{logger['error'](_0x85a6('0x3d'),JSON[_0x85a6('0xf')](_0x9123e3));throw new Error(_0x85a6('0x3e')+JSON[_0x85a6('0xf')](_0x9123e3));}})[_0x85a6('0x2c')](function(_0x47b811){console['error'](_0x47b811);});}function getZohoUser(_0x424eda,_0x1239f1){return new BPromise(function(_0x406ff3,_0x30222b){request(_0x424eda)[_0x85a6('0x29')](function(_0x5a840e){var _0x7aa0da=null;if(_0x5a840e){_0x7aa0da=_0x5a840e[_0x85a6('0x3f')][0x0];_0x7aa0da['enduserType']=_0x1239f1;}_0x406ff3(_0x7aa0da);})[_0x85a6('0x2c')](function(_0x1524af){_0x30222b(_0x1524af);});});}function createEndUser(_0x2b13d2,_0x4048f2,_0x2391ac,_0x44edd1,_0x4ff8cf,_0x15a3cd){var _0x2391ac=getName(_0x2391ac);return request({'method':_0x85a6('0x24'),'uri':_0x85a6('0x40')+_0x4048f2+_0x85a6('0x41')+_[_0x85a6('0x42')](_0x15a3cd[_0x85a6('0x43')])+'s','body':{'data':[{'Last_Name':_0x2391ac[0x1],'First_Name':_0x2391ac[0x0],'Phone':_0x44edd1,'Owner':{'name':!_['isNil'](_0x4ff8cf[_0x85a6('0x44')][_0x85a6('0x18')])?_0x4ff8cf['role'][_0x85a6('0x18')]:!_[_0x85a6('0x1b')](_0x4ff8cf[_0x85a6('0x45')])?_0x4ff8cf[_0x85a6('0x45')]+'\x20'+_0x4ff8cf['last_name']:_0x4ff8cf['last_name'],'id':_0x4ff8cf['id']}}]},'headers':{'Authorization':_0x85a6('0x35')+_0x2b13d2},'json':!![]})[_0x85a6('0x29')](function(_0x5095e3){if(_0x5095e3&&_0x5095e3[_0x85a6('0x3f')][0x0][_0x85a6('0x46')]===_0x85a6('0x47')){var _0x37e7c7=_0x5095e3[_0x85a6('0x3f')][0x0][_0x85a6('0x48')];_0x37e7c7[_0x85a6('0x49')]=_['startCase'](_0x15a3cd[_0x85a6('0x43')])+'s';return _0x37e7c7;}logger[_0x85a6('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x85a6('0xf')](data));throw new Error(_0x85a6('0x4a')+JSON[_0x85a6('0xf')](data));})[_0x85a6('0x2c')](function(_0x50262e){console[_0x85a6('0x4b')]('CREATE\x20ERROR',_0x50262e);});}function getEndUser(_0x12ce6b,_0x24feaf,_0x1139b6,_0x39b33c,_0x162f5e,_0x40f2dd,_0x4836f8){var _0xcba217={'method':_0x85a6('0x32'),'uri':'','headers':{'Authorization':_0x85a6('0x35')+_0x12ce6b},'json':!![]};switch(_0x4836f8['moduleSearch']){case _0x85a6('0x4c'):_0xcba217[_0x85a6('0x4d')]=_0x85a6('0x40')+_0x24feaf+_0x85a6('0x4e')+_0x162f5e+'))';return getZohoUser(_0xcba217,'Contacts')[_0x85a6('0x29')](function(_0x291676){if(_0x291676)return _0x291676;_0xcba217[_0x85a6('0x4d')]='https://www.zohoapis.'+_0x24feaf+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x162f5e+'))';return getZohoUser(_0xcba217,'Leads')[_0x85a6('0x29')](function(_0x5cff93){if(_0x5cff93)return _0x5cff93;if(_0x4836f8['moduleCreate']!='nothing'){return createEndUser(_0x12ce6b,_0x24feaf,_0x39b33c,_0x162f5e,_0x40f2dd,_0x4836f8);}else{return{};}});});break;case _0x85a6('0x4f'):_0xcba217[_0x85a6('0x4d')]=_0x85a6('0x40')+_0x24feaf+_0x85a6('0x4e')+_0x162f5e+'))';return getZohoUser(_0xcba217,_0x85a6('0x50'))[_0x85a6('0x29')](function(_0x888066){if(_0x888066)return _0x888066;if(_0x4836f8[_0x85a6('0x43')]!='nothing'){return createEndUser(_0x12ce6b,_0x24feaf,_0x39b33c,_0x162f5e,_0x40f2dd,_0x4836f8);}else{return{};}});break;case _0x85a6('0x51'):_0xcba217[_0x85a6('0x4d')]='https://www.zohoapis.'+_0x24feaf+_0x85a6('0x52')+_0x162f5e+'))';return getZohoUser(_0xcba217,_0x85a6('0x53'))['then'](function(_0x4255b0){if(_0x4255b0)return _0x4255b0;if(_0x4836f8[_0x85a6('0x43')]!=_0x85a6('0x54')){return createEndUser(_0x12ce6b,_0x24feaf,_0x39b33c,_0x162f5e,_0x40f2dd,_0x4836f8);}else{return{};}});break;}}function getCall(_0x331efa,_0x36571f,_0x14318d,_0x1def93,_0x2280fe,_0x14d0e5,_0x7ea6f3,_0x2912a4){logger['info'](_0x85a6('0x55'));var _0xdcc63e={};_0xdcc63e[_0x85a6('0x56')]={'name':!_[_0x85a6('0x1b')](_0x1def93[_0x85a6('0x44')][_0x85a6('0x18')])&&!_[_0x85a6('0x1b')](_0x1def93[_0x85a6('0x3a')][_0x85a6('0x18')])&&_0x1def93[_0x85a6('0x3a')][_0x85a6('0x18')]===_0x85a6('0x57')?_0x1def93[_0x85a6('0x44')][_0x85a6('0x18')]:!_[_0x85a6('0x1b')](_0x1def93[_0x85a6('0x45')])?_0x1def93['first_name']+'\x20'+_0x1def93[_0x85a6('0x58')]:_0x1def93[_0x85a6('0x58')],'id':_0x1def93['id']};_0xdcc63e[_0x85a6('0x59')]=intUtil['getString'](_0x14d0e5[_0x85a6('0x5a')],_0x7ea6f3,'\x20');_0xdcc63e[_0x85a6('0x5b')]=intUtil[_0x85a6('0x5c')](_0x14d0e5[_0x85a6('0x5d')],_0x7ea6f3,'\x0a');if(_0x2280fe['enduserType']===_0x85a6('0x50')){_0xdcc63e[_0x85a6('0x5e')]={'name':!_[_0x85a6('0x1b')](_0x2280fe[_0x85a6('0x5f')])?_0x2280fe['Full_Name']:!_[_0x85a6('0x1b')](_0x2280fe['First_Name'])?_0x2280fe[_0x85a6('0x60')]+'\x20'+_0x2280fe['Last_Name']:_0x2280fe['Last_Name'],'id':_0x2280fe['id']};}if(_0x2280fe[_0x85a6('0x49')]===_0x85a6('0x53')){_0xdcc63e[_0x85a6('0x61')]={'name':!_[_0x85a6('0x1b')](_0x2280fe[_0x85a6('0x5f')])?_0x2280fe[_0x85a6('0x5f')]:!_[_0x85a6('0x1b')](_0x2280fe[_0x85a6('0x60')])?_0x2280fe[_0x85a6('0x60')]+'\x20'+_0x2280fe['Last_Name']:_0x2280fe[_0x85a6('0x62')],'id':_0x2280fe['id']};_0xdcc63e['$se_module']=_['startCase'](_0x2280fe[_0x85a6('0x49')]);}if(_0x7ea6f3[_0x85a6('0x63')]){_0xdcc63e['Call_Duration']=moment['utc'](parseInt(_0x7ea6f3[_0x85a6('0x63')])*0x3e8)[_0x85a6('0x64')](_0x85a6('0x65'));}else if(_0x7ea6f3[_0x85a6('0x66')]&&_0x7ea6f3['endtime']){_0xdcc63e[_0x85a6('0x67')]=moment[_0x85a6('0x68')](moment(_0x7ea6f3[_0x85a6('0x69')],_0x85a6('0x6a'))[_0x85a6('0x6b')](moment(_0x7ea6f3[_0x85a6('0x6c')],_0x85a6('0x6a'))))[_0x85a6('0x64')](_0x85a6('0x65'));}switch(_0x7ea6f3['lastevent']){case _0x85a6('0x6d'):_0xdcc63e[_0x85a6('0x6e')]=_0x85a6('0x6f');break;case _0x85a6('0x70'):case _0x85a6('0x71'):_0xdcc63e[_0x85a6('0x6e')]=_0x85a6('0x72');break;case _0x85a6('0x73'):_0xdcc63e[_0x85a6('0x6e')]=_0x85a6('0x74');break;case _0x85a6('0x75'):_0xdcc63e[_0x85a6('0x6e')]=_0x85a6('0x76');break;case _0x85a6('0x77'):_0xdcc63e[_0x85a6('0x6e')]=_0x85a6('0x78');default:}_0xdcc63e['Call_Start_Time']=(_0x2912a4===_0x85a6('0x79')?moment(_0x7ea6f3[_0x85a6('0x6c')])[_0x85a6('0x64')](_0x85a6('0x6a')):moment(_0x7ea6f3[_0x85a6('0x7a')])[_0x85a6('0x64')](_0x85a6('0x6a')))||moment()[_0x85a6('0x64')](_0x85a6('0x6a'));_0xdcc63e['Call_Type']=_0x2912a4||'Inbound';_0xdcc63e=_[_0x85a6('0x7b')](_0xdcc63e,getCustomFields(_0x14d0e5[_0x85a6('0x7c')],_0x7ea6f3));return request({'method':'POST','uri':_0x85a6('0x40')+_0x36571f+_0x85a6('0x7d'),'headers':{'Authorization':_0x85a6('0x35')+_0x331efa},'body':{'data':[_0xdcc63e]},'json':!![]})[_0x85a6('0x29')](function(_0xd5a410){if(_0xd5a410&&_0xd5a410[_0x85a6('0x3f')][0x0]['code']===_0x85a6('0x47')){logger[_0x85a6('0x30')](_0x85a6('0x7e'));return{'id':_0xd5a410[_0x85a6('0x3f')][0x0][_0x85a6('0x48')]['id']};}})[_0x85a6('0x2c')](function(_0x55fe15){logger[_0x85a6('0x30')]('err',_0x55fe15[_0x85a6('0x2f')]);console[_0x85a6('0x4b')](_0x85a6('0x7f'),_0x55fe15);});}exports['queue']=function(_0x164dd0,_0x3536cd,_0x3d7a8d,_0xfac0d5,_0x441e03,_0x35d792){var _0x42bc36,_0xf0342e,_0x13129d;_0x35d792[_0x85a6('0x80')]=intUtil[_0x85a6('0x81')](_0x35d792['host']);_0x35d792[_0x85a6('0x82')]=intUtil[_0x85a6('0x81')](_0x35d792[_0x85a6('0x82')]);if(_0x441e03&&_0x441e03[_0x85a6('0x83')]){logger[_0x85a6('0x30')](_0x85a6('0x84'),_0x85a6('0x85'));_0x3536cd[_0x85a6('0x86')]=_0x35d792[_0x85a6('0x82')]+_0x85a6('0x87')+_0x3536cd[_0x85a6('0x88')]+_0x85a6('0x89')+md5(_0x3536cd[_0x85a6('0x88')]);}else{_0x3536cd[_0x85a6('0x86')]='';}var _0x5917a9=_0x35d792['host']==='zoho.eu'?'eu':_0x85a6('0x8a');return getAccessToken(_0x35d792)[_0x85a6('0x29')](function(_0x5c690b){_0x13129d=_0x5c690b;return getUser(_0x13129d,_0x5917a9,_0x35d792,_0xfac0d5[_0x85a6('0x38')]);})[_0x85a6('0x29')](function(_0x332abe){_0x42bc36=_0x332abe;logger[_0x85a6('0x30')](_0x85a6('0x8b'),_0x42bc36['id']);return getEndUser(_0x13129d,_0x5917a9,_0x35d792,_0x3536cd[_0x85a6('0x8c')],_0x3536cd[_0x85a6('0x8d')],_0x42bc36,_0x3d7a8d);})[_0x85a6('0x29')](function(_0x8175a5){_0xf0342e=_0x8175a5;return getCall(_0x13129d,_0x5917a9,_0x35d792,_0x42bc36,_0xf0342e,_0x3d7a8d,_0x3536cd,'Inbound');})['then'](function(_0x400d35){if(_0x400d35){logger[_0x85a6('0x30')](_0x85a6('0x8e'),_0x400d35['id']);logger[_0x85a6('0x30')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x85a6('0x64')]('user:%s',_0xfac0d5['name']),_0x85a6('0x8f'),{'uri':'https://crm.'+_0x35d792[_0x85a6('0x80')]+'/crm/EntityInfo.do?module=Calls&id='+_0x400d35['id']});}})['catch'](function(_0x169cf8){logger[_0x85a6('0x2d')](_0x85a6('0x84'),JSON[_0x85a6('0xf')](_0x169cf8));});};exports[_0x85a6('0x79')]=function(_0x21c02c,_0x8e8c89,_0x46522c,_0xe0b56e,_0x5a0ea1,_0x52ac5e,_0x5a9878){var _0x2363b1,_0x905875,_0x1bc51e;_0x52ac5e['host']=intUtil[_0x85a6('0x81')](_0x52ac5e[_0x85a6('0x80')]);_0x52ac5e['serverUrl']=intUtil[_0x85a6('0x81')](_0x52ac5e[_0x85a6('0x82')]);if(_0x5a9878&&_0x5a9878[_0x85a6('0x90')]&&_0x5a9878[_0x85a6('0x90')]!==_0x85a6('0x91')){logger[_0x85a6('0x30')]('[OUTBOUND]',_0x85a6('0x85'));_0x8e8c89['recordingURL']=_0x52ac5e[_0x85a6('0x82')]+_0x85a6('0x87')+_0x8e8c89[_0x85a6('0x88')]+_0x85a6('0x89')+md5(_0x8e8c89[_0x85a6('0x88')]);}var _0x3bcb71=_0x52ac5e[_0x85a6('0x80')]===_0x85a6('0x92')?'eu':_0x85a6('0x8a');return getAccessToken(_0x52ac5e)[_0x85a6('0x29')](function(_0x1907ad){_0x1bc51e=_0x1907ad;return getUser(_0x1bc51e,_0x3bcb71,_0x52ac5e,_0xe0b56e[_0x85a6('0x38')]);})[_0x85a6('0x29')](function(_0x1fb196){_0x2363b1=_0x1fb196;logger[_0x85a6('0x30')]('The\x20User\x20ID\x20is:',_0x2363b1['id']);return getEndUser(_0x1bc51e,_0x3bcb71,_0x52ac5e,_0x8e8c89[_0x85a6('0x93')],_0x8e8c89[_0x85a6('0x94')],_0x2363b1,_0x46522c);})[_0x85a6('0x29')](function(_0x3781e9){_0x905875=_0x3781e9;return getCall(_0x1bc51e,_0x3bcb71,_0x52ac5e,_0x2363b1,_0x905875,_0x46522c,_0x8e8c89,_0x85a6('0x95'));})['then'](function(_0x47fea7){if(_0x47fea7){logger['info']('The\x20Call\x20ID\x20is:',_0x47fea7['id']);logger['info'](_0x85a6('0x96'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x85a6('0x64')]('user:%s',_0xe0b56e[_0x85a6('0x18')]),_0x85a6('0x8f'),{'uri':_0x85a6('0x97')+_0x52ac5e[_0x85a6('0x80')]+_0x85a6('0x98')+_0x47fea7['id']});}})[_0x85a6('0x2c')](function(_0x1e816d){logger[_0x85a6('0x2d')](_0x85a6('0x96'),JSON[_0x85a6('0xf')](_0x1e816d));});};exports[_0x85a6('0x99')]=function(_0x212a23,_0x1ed3ea,_0x286ea4,_0x102945,_0x27e572,_0x57f202){var _0x1050fc,_0x75d4e2,_0x2f0e19;_0x57f202[_0x85a6('0x80')]=intUtil['stripTrailingSlash'](_0x57f202[_0x85a6('0x80')]);_0x57f202['serverUrl']=intUtil['stripTrailingSlash'](_0x57f202['serverUrl']);if(_0x27e572&&_0x27e572['monitor_format']){logger[_0x85a6('0x30')]('['+_0x1ed3ea[_0x85a6('0x9a')][_0x85a6('0x9b')]()+']','Recording\x20is\x20enabled!');_0x1ed3ea[_0x85a6('0x86')]=_0x57f202[_0x85a6('0x82')]+'/api/voice/recordings/'+_0x1ed3ea['uniqueid']+_0x85a6('0x89')+md5(_0x1ed3ea[_0x85a6('0x88')]);}else{_0x1ed3ea['recordingURL']='';}var _0x5311a8=_0x57f202[_0x85a6('0x80')]==='zoho.eu'?'eu':_0x85a6('0x8a');return getAccessToken(_0x57f202)[_0x85a6('0x29')](function(_0x27a8e8){_0x2f0e19=_0x27a8e8;return getUser(_0x2f0e19,_0x5311a8,_0x57f202);})['then'](function(_0xb9e068){_0x1050fc=_0xb9e068;logger[_0x85a6('0x30')](_0x85a6('0x8b'),_0x1050fc['id']);return getEndUser(_0x2f0e19,_0x5311a8,_0x57f202,_0x1ed3ea['calleridname'],_0x1ed3ea[_0x85a6('0x8d')],_0x1050fc,_0x286ea4);})[_0x85a6('0x29')](function(_0x1205c1){_0x75d4e2=_0x1205c1;return getCall(_0x2f0e19,_0x5311a8,_0x57f202,_0x1050fc,_0x75d4e2,_0x286ea4,_0x1ed3ea,_0x85a6('0x9c'));})['then'](function(_0x57cb4e){if(_0x57cb4e){logger[_0x85a6('0x30')]('The\x20Call\x20ID\x20is:',_0x57cb4e['id']);}})[_0x85a6('0x2c')](function(_0x5b9095){logger[_0x85a6('0x2d')]('['+_0x1ed3ea[_0x85a6('0x9a')][_0x85a6('0x9b')]()+']',JSON[_0x85a6('0xf')](_0x5b9095));});}; \ No newline at end of file +var _0x29e1=['md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','type','idField','content','toString','variable','variableName','customVariable','Variable','name','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','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','findIndex','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','log','CREATE\x20ERROR','GET','contact_lead','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','connect','Answered','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','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','none','[OUTBOUND]','destcalleridnum','Outbound','unmanaged','toUpperCase','calleridnum','lodash','request-promise'];(function(_0x12d719,_0x4286a3){var _0x18130f=function(_0xc3ba23){while(--_0xc3ba23){_0x12d719['push'](_0x12d719['shift']());}};_0x18130f(++_0x4286a3);}(_0x29e1,0x142));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x129e('0x0'));var rp=require(_0x129e('0x1'));var md5=require(_0x129e('0x2'));var util=require(_0x129e('0x3'));var intUtil=require('./util');var moment=require(_0x129e('0x4'));var Redis=require('ioredis');var BPromise=require(_0x129e('0x5'));var config=require(_0x129e('0x6'));var logger=require(_0x129e('0x7'))(_0x129e('0x8'));config[_0x129e('0x9')]=_[_0x129e('0xa')](config['redis'],{'host':_0x129e('0xb'),'port':0x18eb});var io=require(_0x129e('0xc'))(new Redis(config[_0x129e('0x9')]));function emit(_0x49c81b,_0x37f5e2,_0x420675){io['to'](_0x49c81b)[_0x129e('0xd')](_0x37f5e2,_0x420675);}function request(_0x1289ab){logger[_0x129e('0xe')](_0x129e('0xf'),JSON[_0x129e('0x10')](_0x1289ab));return rp(_0x1289ab);}function getCustomFields(_0x5b1936,_0x4c8955){var _0x39bf44={};if(_0x5b1936['length']>0x0){_[_0x129e('0x11')](_0x5b1936,function(_0x54d59c){if(_[_0x129e('0x12')](['string','picklist'],_0x54d59c[_0x129e('0x13')])&&_0x54d59c[_0x129e('0x14')]){_0x39bf44[_0x54d59c[_0x129e('0x14')]]=_0x54d59c[_0x129e('0x15')][_0x129e('0x16')]();}else if(_0x54d59c['type']===_0x129e('0x17')&&_0x54d59c[_0x129e('0x18')]&&_0x54d59c[_0x129e('0x14')]&&_0x4c8955[_0x54d59c[_0x129e('0x18')]]){_0x39bf44[_0x54d59c[_0x129e('0x14')]]=_0x4c8955[_0x54d59c[_0x129e('0x18')]][_0x129e('0x16')]();}else if(_0x54d59c['type']===_0x129e('0x19')&&_0x54d59c[_0x129e('0x1a')]&&_0x54d59c[_0x129e('0x1a')][_0x129e('0x1b')]&&_0x54d59c[_0x129e('0x14')]&&_0x4c8955[_0x54d59c[_0x129e('0x1a')]['name']['toLowerCase']()]){_0x39bf44[_0x54d59c[_0x129e('0x14')]]=_0x4c8955[_0x54d59c['Variable'][_0x129e('0x1b')]['toLowerCase']()][_0x129e('0x16')]();}});}return _0x39bf44;}function getName(_0x17ab1b){if(_0x17ab1b[_0x129e('0x1c')]('\x20')>0x0){var _0x35b248=_0x17ab1b[_0x129e('0x1d')](/ (.+)/);if(_0x35b248[0x1]){return _0x35b248;}}return[_0x17ab1b,_0x17ab1b];}var accountsTokens={};function getAccessToken(_0x224144){return new Promise(function(_0xd620b1,_0x5b03a5){if(!_[_0x129e('0x1e')](accountsTokens[_0x224144['id']])&&!_[_0x129e('0x1e')](accountsTokens[_0x224144['id']][_0x129e('0x1f')])){if(moment()[_0x129e('0x20')](accountsTokens[_0x224144['id']][_0x129e('0x21')])){_0xd620b1(accountsTokens[_0x224144['id']]['access_token']);}}var _0x245b80;switch(_0x224144[_0x129e('0x22')]){case'US':_0x245b80=_0x129e('0x23');break;case'AU':_0x245b80=_0x129e('0x24');break;case'EU':_0x245b80=_0x129e('0x25');break;case'IN':_0x245b80=_0x129e('0x26');break;case'CN':_0x245b80=_0x129e('0x27');break;default:_0x245b80=_0x129e('0x25');break;}var _0x54d6cd={'method':_0x129e('0x28'),'uri':_0x245b80+_0x129e('0x29'),'qs':{'refresh_token':_0x224144[_0x129e('0x2a')],'client_id':_0x224144[_0x129e('0x2b')],'client_secret':_0x224144[_0x129e('0x2c')],'grant_type':_0x129e('0x2d')},'json':!![]};return rp(_0x54d6cd)['then'](function(_0x158374){accountsTokens[_0x224144['id']]={'access_token':_0x158374[_0x129e('0x1f')],'expires_in':moment()[_0x129e('0x2e')](_0x158374[_0x129e('0x21')],_0x129e('0x2f'))};_0xd620b1(_0x158374[_0x129e('0x1f')]);})[_0x129e('0x30')](function(_0x10ebe4){logger[_0x129e('0x31')](_0x129e('0x32'),_0x10ebe4[_0x129e('0x33')]);_0x5b03a5(_0x10ebe4);});});}function getUser(_0x53dc0e,_0x39757b,_0x1b7e0d,_0x4ce56a){logger[_0x129e('0x34')](_0x129e('0x35'));return request({'method':'GET','uri':util['format'](_0x129e('0x36'),_0x39757b),'qs':{'type':_0x129e('0x37')},'headers':{'Authorization':_0x129e('0x38')+_0x53dc0e},'json':!![]})[_0x129e('0x39')](function(_0x51f7af){if(_0x51f7af[_0x129e('0x3a')]){var _0x4af80f=-0x1;if(_[_0x129e('0x3b')](_0x51f7af[_0x129e('0x3a')])){if(!_[_0x129e('0x1e')](_0x4ce56a)){_0x4af80f=_['findIndex'](_0x51f7af['users'],function(_0x966357){return _0x966357[_0x129e('0x3c')]===_0x4ce56a;});}if(_0x4af80f>=0x0){logger[_0x129e('0x34')](_0x129e('0x3d'));}else{logger[_0x129e('0x34')]('Using\x20the\x20admin\x20account!');_0x4af80f=_[_0x129e('0x3e')](_0x51f7af[_0x129e('0x3a')],function(_0x3b3a84){return _0x3b3a84[_0x129e('0x3f')][_0x129e('0x1b')]===_0x129e('0x40');});}return _0x51f7af[_0x129e('0x3a')][_0x4af80f];}else{if(_0x51f7af['user']['profile'][_0x129e('0x1b')]===_0x129e('0x40')){logger['info'](_0x129e('0x41'));user=_0x51f7af[_0x129e('0x42')];return user;}else{logger[_0x129e('0x31')](_0x129e('0x43'),JSON[_0x129e('0x10')](_0x51f7af));throw new Error(_0x129e('0x44')+JSON[_0x129e('0x10')](_0x51f7af));}}}else{logger[_0x129e('0x31')]('The\x20failing\x20result\x20is',JSON[_0x129e('0x10')](_0x51f7af));throw new Error(_0x129e('0x44')+JSON['stringify'](_0x51f7af));}})[_0x129e('0x30')](function(_0x4dcd3c){console[_0x129e('0x31')](_0x4dcd3c);});}function getZohoUser(_0x138464,_0x25a8f8){return new BPromise(function(_0x15a718,_0x7dd88b){request(_0x138464)[_0x129e('0x39')](function(_0x39c8e7){var _0x27098b=null;if(_0x39c8e7){_0x27098b=_0x39c8e7[_0x129e('0x45')][0x0];_0x27098b[_0x129e('0x46')]=_0x25a8f8;}_0x15a718(_0x27098b);})[_0x129e('0x30')](function(_0x44e1b6){_0x7dd88b(_0x44e1b6);});});}function createEndUser(_0x39e0a6,_0x4b846a,_0x4a8289,_0x4203b8,_0x266c24,_0x547444){var _0x4a8289=getName(_0x4a8289);return request({'method':'POST','uri':_0x129e('0x47')+_0x4b846a+_0x129e('0x48')+_[_0x129e('0x49')](_0x547444['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4a8289[0x1],'First_Name':_0x4a8289[0x0],'Phone':_0x4203b8,'Owner':{'name':!_[_0x129e('0x1e')](_0x266c24[_0x129e('0x4a')][_0x129e('0x1b')])?_0x266c24[_0x129e('0x4a')][_0x129e('0x1b')]:!_[_0x129e('0x1e')](_0x266c24[_0x129e('0x4b')])?_0x266c24[_0x129e('0x4b')]+'\x20'+_0x266c24[_0x129e('0x4c')]:_0x266c24[_0x129e('0x4c')],'id':_0x266c24['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x39e0a6},'json':!![]})['then'](function(_0x5e8f3a){if(_0x5e8f3a&&_0x5e8f3a[_0x129e('0x45')][0x0][_0x129e('0x4d')]===_0x129e('0x4e')){var _0x33a62=_0x5e8f3a[_0x129e('0x45')][0x0][_0x129e('0x4f')];_0x33a62[_0x129e('0x46')]=_[_0x129e('0x49')](_0x547444[_0x129e('0x50')])+'s';return _0x33a62;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x129e('0x10')](data));throw new Error('Error:\x20'+JSON[_0x129e('0x10')](data));})[_0x129e('0x30')](function(_0x55a54e){console[_0x129e('0x51')](_0x129e('0x52'),_0x55a54e);});}function getEndUser(_0x18943b,_0x174c85,_0x580440,_0x45c2a1,_0x347500,_0xba2791,_0x3c0186){var _0x3c9404={'method':_0x129e('0x53'),'uri':'','headers':{'Authorization':_0x129e('0x38')+_0x18943b},'json':!![]};switch(_0x3c0186['moduleSearch']){case _0x129e('0x54'):_0x3c9404[_0x129e('0x55')]=_0x129e('0x47')+_0x174c85+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x347500+'))';return getZohoUser(_0x3c9404,'Contacts')[_0x129e('0x39')](function(_0x4a0897){if(_0x4a0897)return _0x4a0897;_0x3c9404[_0x129e('0x55')]=_0x129e('0x47')+_0x174c85+_0x129e('0x56')+_0x347500+'))';return getZohoUser(_0x3c9404,_0x129e('0x57'))[_0x129e('0x39')](function(_0x3b4409){if(_0x3b4409)return _0x3b4409;if(_0x3c0186['moduleCreate']!=_0x129e('0x58')){return createEndUser(_0x18943b,_0x174c85,_0x45c2a1,_0x347500,_0xba2791,_0x3c0186);}else{return{};}});});break;case _0x129e('0x59'):_0x3c9404[_0x129e('0x55')]=_0x129e('0x47')+_0x174c85+_0x129e('0x5a')+_0x347500+'))';return getZohoUser(_0x3c9404,_0x129e('0x5b'))[_0x129e('0x39')](function(_0x2640d3){if(_0x2640d3)return _0x2640d3;if(_0x3c0186[_0x129e('0x50')]!=_0x129e('0x58')){return createEndUser(_0x18943b,_0x174c85,_0x45c2a1,_0x347500,_0xba2791,_0x3c0186);}else{return{};}});break;case _0x129e('0x5c'):_0x3c9404[_0x129e('0x55')]='https://www.zohoapis.'+_0x174c85+_0x129e('0x56')+_0x347500+'))';return getZohoUser(_0x3c9404,_0x129e('0x57'))[_0x129e('0x39')](function(_0x1d500e){if(_0x1d500e)return _0x1d500e;if(_0x3c0186[_0x129e('0x50')]!=_0x129e('0x58')){return createEndUser(_0x18943b,_0x174c85,_0x45c2a1,_0x347500,_0xba2791,_0x3c0186);}else{return{};}});break;}}function getCall(_0x55799e,_0x52487c,_0x9a0205,_0x2c9413,_0xe3a648,_0x5ab451,_0x2bfeed,_0x214a55){logger[_0x129e('0x34')](_0x129e('0x5d'));var _0x511514={};_0x511514[_0x129e('0x5e')]={'name':!_[_0x129e('0x1e')](_0x2c9413[_0x129e('0x4a')]['name'])&&!_[_0x129e('0x1e')](_0x2c9413[_0x129e('0x3f')][_0x129e('0x1b')])&&_0x2c9413[_0x129e('0x3f')][_0x129e('0x1b')]===_0x129e('0x5f')?_0x2c9413['role'][_0x129e('0x1b')]:!_['isNil'](_0x2c9413[_0x129e('0x4b')])?_0x2c9413[_0x129e('0x4b')]+'\x20'+_0x2c9413[_0x129e('0x4c')]:_0x2c9413['last_name'],'id':_0x2c9413['id']};_0x511514[_0x129e('0x60')]=intUtil[_0x129e('0x61')](_0x5ab451['Subjects'],_0x2bfeed,'\x20');_0x511514['Description']=intUtil[_0x129e('0x61')](_0x5ab451[_0x129e('0x62')],_0x2bfeed,'\x0a');if(_0xe3a648[_0x129e('0x46')]===_0x129e('0x5b')){_0x511514[_0x129e('0x63')]={'name':!_[_0x129e('0x1e')](_0xe3a648[_0x129e('0x64')])?_0xe3a648[_0x129e('0x64')]:!_['isNil'](_0xe3a648[_0x129e('0x65')])?_0xe3a648[_0x129e('0x65')]+'\x20'+_0xe3a648[_0x129e('0x66')]:_0xe3a648[_0x129e('0x66')],'id':_0xe3a648['id']};}if(_0xe3a648['enduserType']===_0x129e('0x57')){_0x511514[_0x129e('0x67')]={'name':!_[_0x129e('0x1e')](_0xe3a648[_0x129e('0x64')])?_0xe3a648[_0x129e('0x64')]:!_[_0x129e('0x1e')](_0xe3a648[_0x129e('0x65')])?_0xe3a648[_0x129e('0x65')]+'\x20'+_0xe3a648[_0x129e('0x66')]:_0xe3a648[_0x129e('0x66')],'id':_0xe3a648['id']};_0x511514[_0x129e('0x68')]=_['startCase'](_0xe3a648[_0x129e('0x46')]);}if(_0x2bfeed[_0x129e('0x69')]){_0x511514['Call_Duration']=moment[_0x129e('0x6a')](parseInt(_0x2bfeed['talktime'])*0x3e8)[_0x129e('0x6b')](_0x129e('0x6c'));}else if(_0x2bfeed[_0x129e('0x6d')]&&_0x2bfeed[_0x129e('0x6e')]){_0x511514[_0x129e('0x6f')]=moment['utc'](moment(_0x2bfeed[_0x129e('0x6e')],_0x129e('0x70'))[_0x129e('0x71')](moment(_0x2bfeed[_0x129e('0x72')],_0x129e('0x70'))))['format'](_0x129e('0x6c'));}switch(_0x2bfeed[_0x129e('0x73')]){case _0x129e('0x74'):_0x511514[_0x129e('0x75')]='Called';break;case'complete':case _0x129e('0x76'):_0x511514[_0x129e('0x75')]=_0x129e('0x77');break;case'rejected':_0x511514['Call_Result']=_0x129e('0x78');break;case'abandoned':_0x511514[_0x129e('0x75')]=_0x129e('0x79');break;case _0x129e('0x7a'):_0x511514[_0x129e('0x75')]=_0x129e('0x7b');default:}_0x511514[_0x129e('0x7c')]=(_0x214a55==='outbound'?moment(_0x2bfeed[_0x129e('0x72')])[_0x129e('0x6b')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2bfeed[_0x129e('0x7d')])['format'](_0x129e('0x70')))||moment()[_0x129e('0x6b')](_0x129e('0x70'));_0x511514[_0x129e('0x7e')]=_0x214a55||'Inbound';_0x511514=_[_0x129e('0x7f')](_0x511514,getCustomFields(_0x5ab451[_0x129e('0x80')],_0x2bfeed));return request({'method':_0x129e('0x28'),'uri':_0x129e('0x47')+_0x52487c+_0x129e('0x81'),'headers':{'Authorization':_0x129e('0x38')+_0x55799e},'body':{'data':[_0x511514]},'json':!![]})['then'](function(_0xc26bab){if(_0xc26bab&&_0xc26bab['data'][0x0][_0x129e('0x4d')]===_0x129e('0x4e')){logger[_0x129e('0x34')](_0x129e('0x82'));return{'id':_0xc26bab[_0x129e('0x45')][0x0][_0x129e('0x4f')]['id']};}})['catch'](function(_0x1cbade){logger[_0x129e('0x34')]('err',_0x1cbade[_0x129e('0x33')]);console[_0x129e('0x51')](_0x129e('0x83'),_0x1cbade);});}exports[_0x129e('0x84')]=function(_0x379d3b,_0x628139,_0x4429ae,_0x54e676,_0x3e6b07,_0x3d9632){var _0x5494e1,_0x336ce1,_0x3f3f0a;_0x3d9632[_0x129e('0x85')]=intUtil[_0x129e('0x86')](_0x3d9632[_0x129e('0x85')]);_0x3d9632['serverUrl']=intUtil['stripTrailingSlash'](_0x3d9632['serverUrl']);if(_0x3e6b07&&_0x3e6b07[_0x129e('0x87')]){logger['info']('[QUEUE]',_0x129e('0x88'));_0x628139[_0x129e('0x89')]=_0x3d9632[_0x129e('0x8a')]+_0x129e('0x8b')+_0x628139[_0x129e('0x8c')]+_0x129e('0x8d')+md5(_0x628139[_0x129e('0x8c')]);}else{_0x628139[_0x129e('0x89')]='';}var _0xd77ac6=_0x3d9632['host']===_0x129e('0x8e')?'eu':_0x129e('0x8f');return getAccessToken(_0x3d9632)[_0x129e('0x39')](function(_0xbc27aa){_0x3f3f0a=_0xbc27aa;return getUser(_0x3f3f0a,_0xd77ac6,_0x3d9632,_0x54e676['email']);})['then'](function(_0x41f2b1){_0x5494e1=_0x41f2b1;logger[_0x129e('0x34')](_0x129e('0x90'),_0x5494e1['id']);return getEndUser(_0x3f3f0a,_0xd77ac6,_0x3d9632,_0x628139[_0x129e('0x91')],_0x628139['calleridnum'],_0x5494e1,_0x4429ae);})[_0x129e('0x39')](function(_0x572256){_0x336ce1=_0x572256;return getCall(_0x3f3f0a,_0xd77ac6,_0x3d9632,_0x5494e1,_0x336ce1,_0x4429ae,_0x628139,'Inbound');})[_0x129e('0x39')](function(_0x390b95){if(_0x390b95){logger[_0x129e('0x34')](_0x129e('0x92'),_0x390b95['id']);logger['info'](_0x129e('0x93'),_0x129e('0x94'));emit(util[_0x129e('0x6b')](_0x129e('0x95'),_0x54e676[_0x129e('0x1b')]),_0x129e('0x96'),{'uri':_0x129e('0x97')+_0x3d9632[_0x129e('0x85')]+_0x129e('0x98')+_0x390b95['id']});}})[_0x129e('0x30')](function(_0x456ed3){logger['error']('[QUEUE]',JSON['stringify'](_0x456ed3));});};exports[_0x129e('0x99')]=function(_0x46ad34,_0x14a137,_0x29bf54,_0x41755b,_0x49b5a1,_0x4c95b5,_0x19ed64){var _0x2da387,_0xf60574,_0x140fa1;_0x4c95b5[_0x129e('0x85')]=intUtil[_0x129e('0x86')](_0x4c95b5[_0x129e('0x85')]);_0x4c95b5[_0x129e('0x8a')]=intUtil[_0x129e('0x86')](_0x4c95b5[_0x129e('0x8a')]);if(_0x19ed64&&_0x19ed64[_0x129e('0x9a')]&&_0x19ed64[_0x129e('0x9a')]!==_0x129e('0x9b')){logger['info'](_0x129e('0x9c'),'Recording\x20is\x20enabled!');_0x14a137[_0x129e('0x89')]=_0x4c95b5['serverUrl']+'/api/voice/recordings/'+_0x14a137[_0x129e('0x8c')]+_0x129e('0x8d')+md5(_0x14a137[_0x129e('0x8c')]);}var _0x3a8477=_0x4c95b5[_0x129e('0x85')]===_0x129e('0x8e')?'eu':_0x129e('0x8f');return getAccessToken(_0x4c95b5)[_0x129e('0x39')](function(_0x2a2527){_0x140fa1=_0x2a2527;return getUser(_0x140fa1,_0x3a8477,_0x4c95b5,_0x41755b['email']);})[_0x129e('0x39')](function(_0x122d0d){_0x2da387=_0x122d0d;logger[_0x129e('0x34')](_0x129e('0x90'),_0x2da387['id']);return getEndUser(_0x140fa1,_0x3a8477,_0x4c95b5,_0x14a137['destcalleridname'],_0x14a137[_0x129e('0x9d')],_0x2da387,_0x29bf54);})[_0x129e('0x39')](function(_0x4629b3){_0xf60574=_0x4629b3;return getCall(_0x140fa1,_0x3a8477,_0x4c95b5,_0x2da387,_0xf60574,_0x29bf54,_0x14a137,_0x129e('0x9e'));})['then'](function(_0x52d3a8){if(_0x52d3a8){logger[_0x129e('0x34')](_0x129e('0x92'),_0x52d3a8['id']);logger[_0x129e('0x34')](_0x129e('0x9c'),_0x129e('0x94'));emit(util[_0x129e('0x6b')](_0x129e('0x95'),_0x41755b[_0x129e('0x1b')]),_0x129e('0x96'),{'uri':_0x129e('0x97')+_0x4c95b5[_0x129e('0x85')]+'/crm/EntityInfo.do?module=Calls&id='+_0x52d3a8['id']});}})[_0x129e('0x30')](function(_0x34595d){logger[_0x129e('0x31')](_0x129e('0x9c'),JSON[_0x129e('0x10')](_0x34595d));});};exports[_0x129e('0x9f')]=function(_0xd5ea9a,_0x2e03b5,_0x10d894,_0x1d5121,_0x378df6,_0x59ef97){var _0x49ea6c,_0x260336,_0x39a9e4;_0x59ef97[_0x129e('0x85')]=intUtil['stripTrailingSlash'](_0x59ef97[_0x129e('0x85')]);_0x59ef97[_0x129e('0x8a')]=intUtil[_0x129e('0x86')](_0x59ef97['serverUrl']);if(_0x378df6&&_0x378df6[_0x129e('0x87')]){logger[_0x129e('0x34')]('['+_0x2e03b5['lastevent'][_0x129e('0xa0')]()+']',_0x129e('0x88'));_0x2e03b5[_0x129e('0x89')]=_0x59ef97[_0x129e('0x8a')]+'/api/voice/recordings/'+_0x2e03b5[_0x129e('0x8c')]+_0x129e('0x8d')+md5(_0x2e03b5['uniqueid']);}else{_0x2e03b5[_0x129e('0x89')]='';}var _0x1e921d=_0x59ef97[_0x129e('0x85')]===_0x129e('0x8e')?'eu':'com';return getAccessToken(_0x59ef97)['then'](function(_0xff0315){_0x39a9e4=_0xff0315;return getUser(_0x39a9e4,_0x1e921d,_0x59ef97);})['then'](function(_0x5c70b6){_0x49ea6c=_0x5c70b6;logger[_0x129e('0x34')](_0x129e('0x90'),_0x49ea6c['id']);return getEndUser(_0x39a9e4,_0x1e921d,_0x59ef97,_0x2e03b5[_0x129e('0x91')],_0x2e03b5[_0x129e('0xa1')],_0x49ea6c,_0x10d894);})[_0x129e('0x39')](function(_0x4ac991){_0x260336=_0x4ac991;return getCall(_0x39a9e4,_0x1e921d,_0x59ef97,_0x49ea6c,_0x260336,_0x10d894,_0x2e03b5,'Inbound');})['then'](function(_0x36c4fe){if(_0x36c4fe){logger[_0x129e('0x34')]('The\x20Call\x20ID\x20is:',_0x36c4fe['id']);}})['catch'](function(_0x201208){logger[_0x129e('0x31')]('['+_0x2e03b5[_0x129e('0x73')][_0x129e('0xa0')]()+']',JSON[_0x129e('0x10')](_0x201208));});}; \ 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 207b34f..a586d1d 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 _0x2f07=['render','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','trigger','data2','Script','data3'];(function(_0x3d3590,_0x23bd12){var _0x1348ff=function(_0x26a61a){while(--_0x26a61a){_0x3d3590['push'](_0x3d3590['shift']());}};_0x1348ff(++_0x23bd12);}(_0x2f07,0x1c2));var _0x72f0=function(_0x4957f2,_0x57de39){_0x4957f2=_0x4957f2-0x0;var _0x1448f9=_0x2f07[_0x4957f2];return _0x1448f9;};'use strict';var util=require(_0x72f0('0x0'));var sh=require(_0x72f0('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x72f0('0x2'));exports['exec']=function(_0x49dd6f,_0x3e9bf6){var _0x4f0baf=_0x49dd6f[_0x72f0('0x3')]?_0x49dd6f[_0x72f0('0x3')]:_0x72f0('0x4');var _0x25ba39=_0x49dd6f[_0x72f0('0x5')]?Mustache[_0x72f0('0x6')](_0x49dd6f['data3'],_0x3e9bf6):_0x3e9bf6;sh[_0x72f0('0x7')](_0x25ba39,function(_0x47677d,_0x1cd4f1,_0x48abc4){if(_0x47677d!==0x0){logger['error'](util[_0x72f0('0x8')](_0x72f0('0x9'),_0x4f0baf,_0x25ba39,_0x47677d,_0x48abc4));}else{logger[_0x72f0('0xa')](util['format'](_0x72f0('0xb'),_0x4f0baf,_0x25ba39,_0x1cd4f1));}});}; \ No newline at end of file +var _0x3dca=['render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3dca,0x14e));var _0xa3dc=function(_0x47356d,_0x1ef48f){_0x47356d=_0x47356d-0x0;var _0x3ee50d=_0x3dca[_0x47356d];return _0x3ee50d;};'use strict';var util=require('util');var sh=require(_0xa3dc('0x0'));var Mustache=require(_0xa3dc('0x1'));var logger=require(_0xa3dc('0x2'))(_0xa3dc('0x3'));exports[_0xa3dc('0x4')]=function(_0x5048ca,_0x26b340){var _0x29c3b0=_0x5048ca['data2']?_0x5048ca[_0xa3dc('0x5')]:'Script';var _0x868df=_0x5048ca[_0xa3dc('0x6')]?Mustache[_0xa3dc('0x7')](_0x5048ca[_0xa3dc('0x6')],_0x26b340):_0x26b340;sh[_0xa3dc('0x4')](_0x868df,function(_0x48d7ad,_0x4c40f3,_0x494132){if(_0x48d7ad!==0x0){logger['error'](util[_0xa3dc('0x8')](_0xa3dc('0x9'),_0x29c3b0,_0x868df,_0x48d7ad,_0x494132));}else{logger[_0xa3dc('0xa')](util[_0xa3dc('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x29c3b0,_0x868df,_0x4c40f3));}});}; \ 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 2ec9f2e..56d3d1b 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 _0xb3a1=['data2','data5','data6','stack','GET','POST','PUT','parse','data7','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','stringify','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render'];(function(_0x7f6e9,_0x2cf772){var _0x5a3124=function(_0x4d1156){while(--_0x4d1156){_0x7f6e9['push'](_0x7f6e9['shift']());}};_0x5a3124(++_0x2cf772);}(_0xb3a1,0x16b));var _0x1b3a=function(_0x2f37c7,_0x1e2370){_0x2f37c7=_0x2f37c7-0x0;var _0x5c0bbb=_0xb3a1[_0x2f37c7];return _0x5c0bbb;};'use strict';var rp=require(_0x1b3a('0x0'));var util=require(_0x1b3a('0x1'));var _=require(_0x1b3a('0x2'));var Mustache=require(_0x1b3a('0x3'));var logger=require(_0x1b3a('0x4'))('trigger');exports[_0x1b3a('0x5')]=function(_0x2b1527,_0x3af8a5){var _0x5b586c,_0x1ebf36;var _0x1d683c={'method':_0x2b1527[_0x1b3a('0x6')][_0x1b3a('0x7')](),'uri':Mustache[_0x1b3a('0x8')](_0x2b1527[_0x1b3a('0x9')],_0x3af8a5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2b1527[_0x1b3a('0xa')])==='number'&&parseInt(_0x2b1527[_0x1b3a('0xa')])>=0x1&&parseInt(_0x2b1527[_0x1b3a('0xa')])<=0xa?parseInt(_0x2b1527[_0x1b3a('0xa')])*0x3e8:0x5*0x3e8};try{_0x1d683c['headers']=_0x2b1527[_0x1b3a('0xb')]?JSON['parse'](Mustache[_0x1b3a('0x8')](_0x2b1527[_0x1b3a('0xb')],_0x3af8a5)):{};}catch(_0x3929ad){logger['error'](_0x3929ad[_0x1b3a('0xc')]);}switch(_0x2b1527[_0x1b3a('0x6')]['toUpperCase']()){case _0x1b3a('0xd'):case'DELETE':_0x5b586c=null;_0x1d683c['qs']=_0x3af8a5;break;case _0x1b3a('0xe'):case _0x1b3a('0xf'):if(_0x2b1527['data7']){try{_0x5b586c=JSON[_0x1b3a('0x10')](Mustache['render'](_0x2b1527[_0x1b3a('0x11')],_0x3af8a5));_0x1d683c['body']=_0x5b586c;}catch(_0x7a6b21){logger[_0x1b3a('0x12')](_0x7a6b21['stack']);logger[_0x1b3a('0x12')](_0x1b3a('0x13'));}}else{_0x5b586c=_0x3af8a5;_0x1d683c[_0x1b3a('0x14')]=_0x5b586c;}break;}logger[_0x1b3a('0x15')](util[_0x1b3a('0x16')](_0x1b3a('0x17'),_0x2b1527[_0x1b3a('0x6')],_0x2b1527[_0x1b3a('0x9')],JSON['stringify'](_0x1d683c)));rp(_0x1d683c)[_0x1b3a('0x18')](function(_0x58f252){_0x5b586c=!_['isNil'](_0x5b586c)?_0x1b3a('0x19')+_0x5b586c:'';_0x1ebf36=typeof _0x58f252[_0x1b3a('0x14')]==='object'?JSON[_0x1b3a('0x1a')](_0x58f252[_0x1b3a('0x14')]):_0x58f252[_0x1b3a('0x14')];logger[_0x1b3a('0x15')](util[_0x1b3a('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2b1527[_0x1b3a('0x6')],_0x2b1527[_0x1b3a('0x9')],_0x58f252[_0x1b3a('0x1b')],_0x1ebf36));})['catch'](function(_0x11db57){logger['error'](util[_0x1b3a('0x16')](_0x1b3a('0x1c'),_0x2b1527['data1'],_0x2b1527[_0x1b3a('0x9')],_0x11db57[_0x1b3a('0x1b')],_0x11db57[_0x1b3a('0x1d')],_0x11db57[_0x1b3a('0x1e')]));});}; \ No newline at end of file +var _0xd2cf=['stack','GET','DELETE','POST','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','statusCode','name','message','request-promise','util','lodash','../../../../config/logger','data1','toUpperCase','render','data5','number','headers','data6','error'];(function(_0x3ec824,_0x3717b0){var _0x377bac=function(_0x203dc2){while(--_0x203dc2){_0x3ec824['push'](_0x3ec824['shift']());}};_0x377bac(++_0x3717b0);}(_0xd2cf,0xcd));var _0xfd2c=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xd2cf[_0x39d39d];return _0x577ac3;};'use strict';var rp=require(_0xfd2c('0x0'));var util=require(_0xfd2c('0x1'));var _=require(_0xfd2c('0x2'));var Mustache=require('mustache');var logger=require(_0xfd2c('0x3'))('trigger');exports['exec']=function(_0x2c05b5,_0x2a4270){var _0x3bab34,_0x988aef;var _0x40c3de={'method':_0x2c05b5[_0xfd2c('0x4')][_0xfd2c('0x5')](),'uri':Mustache[_0xfd2c('0x6')](_0x2c05b5['data2'],_0x2a4270),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2c05b5[_0xfd2c('0x7')])===_0xfd2c('0x8')&&parseInt(_0x2c05b5[_0xfd2c('0x7')])>=0x1&&parseInt(_0x2c05b5['data5'])<=0xa?parseInt(_0x2c05b5['data5'])*0x3e8:0x5*0x3e8};try{_0x40c3de[_0xfd2c('0x9')]=_0x2c05b5[_0xfd2c('0xa')]?JSON['parse'](Mustache[_0xfd2c('0x6')](_0x2c05b5[_0xfd2c('0xa')],_0x2a4270)):{};}catch(_0x101133){logger[_0xfd2c('0xb')](_0x101133[_0xfd2c('0xc')]);}switch(_0x2c05b5[_0xfd2c('0x4')][_0xfd2c('0x5')]()){case _0xfd2c('0xd'):case _0xfd2c('0xe'):_0x3bab34=null;_0x40c3de['qs']=_0x2a4270;break;case _0xfd2c('0xf'):case'PUT':if(_0x2c05b5[_0xfd2c('0x10')]){try{_0x3bab34=JSON['parse'](Mustache[_0xfd2c('0x6')](_0x2c05b5[_0xfd2c('0x10')],_0x2a4270));_0x40c3de[_0xfd2c('0x11')]=_0x3bab34;}catch(_0x35e191){logger[_0xfd2c('0xb')](_0x35e191[_0xfd2c('0xc')]);logger[_0xfd2c('0xb')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3bab34=_0x2a4270;_0x40c3de[_0xfd2c('0x11')]=_0x3bab34;}break;}logger[_0xfd2c('0x12')](util['format'](_0xfd2c('0x13'),_0x2c05b5[_0xfd2c('0x4')],_0x2c05b5[_0xfd2c('0x14')],JSON[_0xfd2c('0x15')](_0x40c3de)));rp(_0x40c3de)[_0xfd2c('0x16')](function(_0x46556f){_0x3bab34=!_[_0xfd2c('0x17')](_0x3bab34)?',\x20request\x20body:\x20'+_0x3bab34:'';_0x988aef=typeof _0x46556f[_0xfd2c('0x11')]===_0xfd2c('0x18')?JSON[_0xfd2c('0x15')](_0x46556f[_0xfd2c('0x11')]):_0x46556f[_0xfd2c('0x11')];logger['info'](util[_0xfd2c('0x19')](_0xfd2c('0x1a'),_0x2c05b5[_0xfd2c('0x4')],_0x2c05b5[_0xfd2c('0x14')],_0x46556f['statusCode'],_0x988aef));})[_0xfd2c('0x1b')](function(_0x119560){logger[_0xfd2c('0xb')](util[_0xfd2c('0x19')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x2c05b5[_0xfd2c('0x4')],_0x2c05b5['data2'],_0x119560[_0xfd2c('0x1c')],_0x119560[_0xfd2c('0x1d')],_0x119560[_0xfd2c('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 384c93c..451efa0 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 _0x15f0=['../../config/logger','client','http','Request','then','debug','rpc','routing','error','message','result','bluebird'];(function(_0x54cefb,_0x192225){var _0x5e4fbb=function(_0x5ac5dc){while(--_0x5ac5dc){_0x54cefb['push'](_0x54cefb['shift']());}};_0x5e4fbb(++_0x192225);}(_0x15f0,0xcb));var _0x015f=function(_0x5b1326,_0xfdabe5){_0x5b1326=_0x5b1326-0x0;var _0x4ce21d=_0x15f0[_0x5b1326];return _0x4ce21d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x015f('0x0'));var logger=require(_0x015f('0x1'))('routing');var client=jayson[_0x015f('0x2')][_0x015f('0x3')]({'port':0x2329});client[_0x015f('0x4')]=function(_0x4e7ce5,_0x5af21d){return new BPromise(function(_0x43e890,_0x1fe860){return client['request'](_0x4e7ce5,_0x5af21d)[_0x015f('0x5')](function(_0x2e9412){logger[_0x015f('0x6')](_0x015f('0x7'),_0x015f('0x8'),_0x4e7ce5,_0x5af21d,_0x2e9412);if(_0x2e9412[_0x015f('0x9')]){logger[_0x015f('0x9')]('rpc',_0x015f('0x8'),_0x4e7ce5,_0x2e9412[_0x015f('0x9')][_0x015f('0xa')],_0x5af21d);return _0x1fe860(_0x2e9412[_0x015f('0x9')]['message']);}else{return _0x43e890(_0x2e9412[_0x015f('0xb')]);}})['catch'](function(_0x3e087b){logger[_0x015f('0x9')](_0x015f('0x7'),_0x015f('0x8'),_0x4e7ce5,_0x3e087b,_0x5af21d);return _0x1fe860(_0x3e087b);});});};module['exports']=client; \ No newline at end of file +var _0x1399=['routing','error','rpc','message','result','catch','exports','../../config/logger','http','request','then','debug'];(function(_0x4cf688,_0xb3e952){var _0x2f8086=function(_0x5eb86a){while(--_0x5eb86a){_0x4cf688['push'](_0x4cf688['shift']());}};_0x2f8086(++_0xb3e952);}(_0x1399,0x1b7));var _0x9139=function(_0x599fdc,_0x1f1138){_0x599fdc=_0x599fdc-0x0;var _0x98ea0f=_0x1399[_0x599fdc];return _0x98ea0f;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x9139('0x0'))('routing');var client=jayson['client'][_0x9139('0x1')]({'port':0x2329});client['Request']=function(_0x3013b1,_0x2989c5){return new BPromise(function(_0x1d97ad,_0x3d17e0){return client[_0x9139('0x2')](_0x3013b1,_0x2989c5)[_0x9139('0x3')](function(_0x4a4856){logger[_0x9139('0x4')]('rpc',_0x9139('0x5'),_0x3013b1,_0x2989c5,_0x4a4856);if(_0x4a4856[_0x9139('0x6')]){logger['error'](_0x9139('0x7'),_0x9139('0x5'),_0x3013b1,_0x4a4856[_0x9139('0x6')]['message'],_0x2989c5);return _0x3d17e0(_0x4a4856[_0x9139('0x6')][_0x9139('0x8')]);}else{return _0x1d97ad(_0x4a4856[_0x9139('0x9')]);}})[_0x9139('0xa')](function(_0x1ebea7){logger[_0x9139('0x6')](_0x9139('0x7'),'routing',_0x3013b1,_0x1ebea7,_0x2989c5);return _0x3d17e0(_0x1ebea7);});});};module[_0x9139('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e5859b6..80e7eda 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 _0x40ad=['then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./lib/email','./rpc/setting','../../config/logger','email'];(function(_0x5d3e10,_0x282535){var _0x15b465=function(_0x90f879){while(--_0x90f879){_0x5d3e10['push'](_0x5d3e10['shift']());}};_0x15b465(++_0x282535);}(_0x40ad,0x15a));var _0xd40a=function(_0x322752,_0x1ab149){_0x322752=_0x322752-0x0;var _0x2a6840=_0x40ad[_0x322752];return _0x2a6840;};'use strict';var server=require(_0xd40a('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xd40a('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xd40a('0x2'));var logger=require(_0xd40a('0x3'))(_0xd40a('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xd40a('0x5')](mailAccount[_0xd40a('0x6')]())[_0xd40a('0x5')](realtime[_0xd40a('0x7')]())[_0xd40a('0x5')](function(){email['refresh'](realtime[_0xd40a('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xd40a('0x5')](function(){return initRealtime();})[_0xd40a('0x5')](function(){return setting[_0xd40a('0x9')]();})[_0xd40a('0x5')](function(_0x1938ce){return setInterval(initRealtime,_0x1938ce[_0xd40a('0xa')]*0x3e8);})[_0xd40a('0xb')](function(_0x3fc985){logger['error'](_0xd40a('0xc'),_0x3fc985);});}main(); \ No newline at end of file +var _0x2423=['loginMailFrequency','catch','Email\x20service\x20initialization','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings'];(function(_0xb1ebbd,_0x551602){var _0x435935=function(_0x211dbc){while(--_0x211dbc){_0xb1ebbd['push'](_0xb1ebbd['shift']());}};_0x435935(++_0x551602);}(_0x2423,0x1d3));var _0x3242=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2423[_0x321bb2];return _0x9c12ed;};'use strict';var server=require('./server');var Realtime=require(_0x3242('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x3242('0x1'));var setting=require(_0x3242('0x2'));var logger=require(_0x3242('0x3'))(_0x3242('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3242('0x5')]()[_0x3242('0x6')](mailAccount[_0x3242('0x7')]())[_0x3242('0x6')](realtime[_0x3242('0x8')]())[_0x3242('0x6')](function(){email[_0x3242('0x9')](realtime[_0x3242('0xa')]);return realtime;});}function main(){return server[_0x3242('0xb')](realtime,email)['then'](function(){return initRealtime();})[_0x3242('0x6')](function(){return setting[_0x3242('0xc')]();})['then'](function(_0xe2145){return setInterval(initRealtime,_0xe2145[_0x3242('0xd')]*0x3e8);})[_0x3242('0xe')](function(_0x3f787b){logger['error'](_0x3242('0xf'),_0x3f787b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ab9f697..fc4cf2f 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 _0xab16=['verified','exports','lodash','bluebird','../../../config/environment','email','defaults','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','name','key','active','Imap','status','total','isNil','stringify','md5','emit','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messageStatus','handleImapBox','connected','messages','lastName','from','info','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','verifySmtp','Smtp','verify'];(function(_0x592326,_0x43179e){var _0x337b2d=function(_0xb2333c){while(--_0xb2333c){_0x592326['push'](_0x592326['shift']());}};_0x337b2d(++_0x43179e);}(_0xab16,0xa7));var _0x6ab1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xab16[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x6ab1('0x0'));var moment=require('moment');var BPromise=require(_0x6ab1('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x6ab1('0x2'));var logger=require('../../../config/logger')(_0x6ab1('0x3'));config['redis']=_[_0x6ab1('0x4')](config[_0x6ab1('0x5')],{'host':_0x6ab1('0x6'),'port':0x18eb});var io=require(_0x6ab1('0x7'))(new Redis(config[_0x6ab1('0x5')]));var EmailImap=require(_0x6ab1('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x6ab1('0x9'));var md5Accounts={};function EmailChannel(_0x3b55f3){logger['info'](_0x6ab1('0xa'));this[_0x6ab1('0xb')]=_0x3b55f3[_0x6ab1('0xb')];this[_0x6ab1('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x1d5d89){var _0x39f79b=this['mailAccounts'][_0x1d5d89];var _0xbed966={'id':_0x39f79b['id'],'name':_0x39f79b[_0x6ab1('0xd')],'key':_0x39f79b[_0x6ab1('0xe')],'active':_0x39f79b[_0x6ab1('0xf')],'Imap':{'status':_0x39f79b[_0x6ab1('0x10')][_0x6ab1('0x11')],'messageStatus':_0x39f79b[_0x6ab1('0x10')]['messageStatus'],'total':_0x39f79b[_0x6ab1('0x10')][_0x6ab1('0x12')]}};if(_[_0x6ab1('0x13')](md5Accounts[_0x1d5d89])){md5Accounts[_0x1d5d89]={};}var _0x5a05c2=md5(JSON[_0x6ab1('0x14')](_0xbed966));if(md5Accounts[_0x1d5d89][_0x6ab1('0x15')]!==_0x5a05c2){md5Accounts[_0x1d5d89]['md5']=_0x5a05c2;io[_0x6ab1('0x16')](_0x6ab1('0x17'),_0xbed966);}};EmailChannel[_0x6ab1('0x18')][_0x6ab1('0x19')]=function(_0x16e740){for(var _0x15a9fb in _0x16e740){if(_0x16e740[_0x6ab1('0x1a')](_0x15a9fb)){if(_0x16e740[_0x15a9fb]['Imap']&&_0x16e740[_0x15a9fb][_0x6ab1('0xf')]){var _0x318adc=_0x16e740[_0x15a9fb]['Imap'];if(!_0x318adc[_0x6ab1('0x1b')]&&_0x16e740[_0x15a9fb][_0x6ab1('0x1c')]!==_0x6ab1('0x1d'))_0x318adc[_0x6ab1('0x1b')]=_0x16e740[_0x15a9fb][_0x6ab1('0x1c')];if(!this[_0x6ab1('0xc')][_0x6ab1('0x1a')](_0x318adc['id'])){this[_0x6ab1('0xc')][_0x318adc['id']]=new EmailImap(_0x318adc,_0x16e740[_0x15a9fb][_0x6ab1('0x3')]);this['imapAccounts'][_0x318adc['id']]['on'](_0x6ab1('0x1e'),this['handleImapBox'][_0x6ab1('0x1f')](this,_0x15a9fb));this[_0x6ab1('0xc')][_0x318adc['id']]['on'](_0x6ab1('0x3'),this[_0x6ab1('0x20')][_0x6ab1('0x1f')](this,_0x15a9fb));this[_0x6ab1('0xc')][_0x318adc['id']]['on'](_0x6ab1('0x21'),this[_0x6ab1('0x22')][_0x6ab1('0x1f')](this,_0x15a9fb));this[_0x6ab1('0xc')][_0x318adc['id']]['on'](_0x6ab1('0x23'),this[_0x6ab1('0x24')][_0x6ab1('0x1f')](this,_0x15a9fb));}}else{if(_[_0x6ab1('0x13')](this[_0x6ab1('0xb')][_0x15a9fb][_0x6ab1('0x10')])){this['mailAccounts'][_0x15a9fb][_0x6ab1('0x10')]={};}this[_0x6ab1('0xb')][_0x15a9fb][_0x6ab1('0x10')][_0x6ab1('0x11')]=_0x6ab1('0x25');this[_0x6ab1('0xb')][_0x15a9fb]['Imap'][_0x6ab1('0x26')]='';this[_0x6ab1('0x16')](_0x15a9fb);}}}};EmailChannel[_0x6ab1('0x18')][_0x6ab1('0x27')]=function(_0xcb3b03,_0x448778){if(this[_0x6ab1('0xb')][_0xcb3b03]){this['mailAccounts'][_0xcb3b03]['Imap']['status']=_0x6ab1('0x28');this[_0x6ab1('0xb')][_0xcb3b03]['Imap']['messageStatus']=_0x448778[_0x6ab1('0xd')];if(_0x448778['messages']){this[_0x6ab1('0xb')][_0xcb3b03][_0x6ab1('0x10')][_0x6ab1('0x12')]=_0x448778[_0x6ab1('0x29')]['total'];}return this[_0x6ab1('0x16')](_0xcb3b03);}};EmailChannel[_0x6ab1('0x18')][_0x6ab1('0x20')]=function(_0x5f1620,_0x57da04){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x57da04['firstName'],_0x57da04[_0x6ab1('0x2a')],_0x57da04[_0x6ab1('0x2b')],_0x5f1620);if(this[_0x6ab1('0xb')][_0x5f1620]){return mailAccount['notify'](_0x5f1620,_0x57da04)['then'](function(_0x240ef6){if(_0x240ef6){logger[_0x6ab1('0x2c')](_0x6ab1('0x2d'));}})['catch'](function(_0x572dea){logger['error'](_0x6ab1('0x2e'),JSON[_0x6ab1('0x14')](_0x572dea));});}};EmailChannel[_0x6ab1('0x18')][_0x6ab1('0x22')]=function(_0x5c3bd8){if(this[_0x6ab1('0xb')][_0x5c3bd8]&&this[_0x6ab1('0xb')][_0x5c3bd8][_0x6ab1('0x10')]){if(this[_0x6ab1('0xc')][this['mailAccounts'][_0x5c3bd8][_0x6ab1('0x10')]['id']]){delete this[_0x6ab1('0xc')][this[_0x6ab1('0xb')][_0x5c3bd8][_0x6ab1('0x10')]['id']];}this['mailAccounts'][_0x5c3bd8][_0x6ab1('0x10')][_0x6ab1('0x2f')]=moment();this[_0x6ab1('0x16')](_0x5c3bd8);}};EmailChannel[_0x6ab1('0x18')][_0x6ab1('0x24')]=function(_0x484f55,_0x5f4508){if(this[_0x6ab1('0xb')][_0x484f55]){this[_0x6ab1('0xb')][_0x484f55]['Imap'][_0x6ab1('0x11')]='error';this['mailAccounts'][_0x484f55][_0x6ab1('0x10')]['messageStatus']=_0x5f4508;return this[_0x6ab1('0x16')](_0x484f55);}};EmailChannel[_0x6ab1('0x18')][_0x6ab1('0x30')]=function(_0x486e61,_0x584c58){return this[_0x6ab1('0x31')]['send'](_0x486e61,_0x584c58);};EmailChannel[_0x6ab1('0x18')][_0x6ab1('0x32')]=function(_0x5ea309){var _0x5a8cdc=this;if(this[_0x6ab1('0xb')][_0x5ea309['id']]){if(_[_0x6ab1('0x13')](this[_0x6ab1('0xb')][_0x5ea309['id']][_0x6ab1('0x33')])){this[_0x6ab1('0xb')][_0x5ea309['id']][_0x6ab1('0x33')]={};}this[_0x6ab1('0xb')][_0x5ea309['id']]['Smtp'][_0x6ab1('0x2f')]=moment();return new BPromise(function(_0x331bc8,_0x2ab09b){return _0x5a8cdc[_0x6ab1('0x31')][_0x6ab1('0x34')](_0x5ea309)['then'](function(_0x12bd9f){_0x5a8cdc['mailAccounts'][_0x5ea309['id']][_0x6ab1('0x33')][_0x6ab1('0x11')]=_0x6ab1('0x35');_0x5a8cdc[_0x6ab1('0xb')][_0x5ea309['id']][_0x6ab1('0x33')][_0x6ab1('0x26')]='';_0x5a8cdc[_0x6ab1('0x16')](_0x5ea309['id']);_0x331bc8(_0x12bd9f);})['catch'](function(_0x47f2ed){_0x5a8cdc[_0x6ab1('0xb')][_0x5ea309['id']][_0x6ab1('0x33')]['status']=_0x6ab1('0x23');_0x5a8cdc['mailAccounts'][_0x5ea309['id']]['Smtp'][_0x6ab1('0x26')]=_0x47f2ed;_0x5a8cdc[_0x6ab1('0x16')](_0x5ea309['id']);_0x2ab09b(_0x47f2ed);});});}return this[_0x6ab1('0x31')][_0x6ab1('0x34')](_0x5ea309);};module[_0x6ab1('0x36')]=EmailChannel; \ No newline at end of file +var _0x02fe=['then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','verified','messageStatus','catch','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','total','isNil','stringify','mailAccount:update','service','provider','custom','hasOwnProperty','box','handleImapBox','handleImapEmail','bind','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x02fe,0x1d4));var _0xe02f=function(_0xe2f254,_0x1360c6){_0xe2f254=_0xe2f254-0x0;var _0x1e2809=_0x02fe[_0xe2f254];return _0x1e2809;};'use strict';var _=require(_0xe02f('0x0'));var moment=require('moment');var BPromise=require(_0xe02f('0x1'));var md5=require(_0xe02f('0x2'));var Redis=require(_0xe02f('0x3'));var config=require(_0xe02f('0x4'));var logger=require(_0xe02f('0x5'))(_0xe02f('0x6'));config[_0xe02f('0x7')]=_['defaults'](config[_0xe02f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe02f('0x8'))(new Redis(config[_0xe02f('0x7')]));var EmailImap=require(_0xe02f('0x9'));var EmailSmtp=require(_0xe02f('0xa'));var mailAccount=require(_0xe02f('0xb'));var md5Accounts={};function EmailChannel(_0x309b60){logger[_0xe02f('0xc')](_0xe02f('0xd'));this[_0xe02f('0xe')]=_0x309b60[_0xe02f('0xe')];this[_0xe02f('0xf')]={};this[_0xe02f('0x10')]=new EmailSmtp();}EmailChannel[_0xe02f('0x11')][_0xe02f('0x12')]=function(_0x349076){var _0x3294dc=this[_0xe02f('0xe')][_0x349076];var _0x38d96e={'id':_0x3294dc['id'],'name':_0x3294dc[_0xe02f('0x13')],'key':_0x3294dc['key'],'active':_0x3294dc[_0xe02f('0x14')],'Imap':{'status':_0x3294dc[_0xe02f('0x15')][_0xe02f('0x16')],'messageStatus':_0x3294dc[_0xe02f('0x15')]['messageStatus'],'total':_0x3294dc['Imap'][_0xe02f('0x17')]}};if(_[_0xe02f('0x18')](md5Accounts[_0x349076])){md5Accounts[_0x349076]={};}var _0x820852=md5(JSON[_0xe02f('0x19')](_0x38d96e));if(md5Accounts[_0x349076]['md5']!==_0x820852){md5Accounts[_0x349076]['md5']=_0x820852;io[_0xe02f('0x12')](_0xe02f('0x1a'),_0x38d96e);}};EmailChannel['prototype']['refresh']=function(_0x2db222){for(var _0x395c21 in _0x2db222){if(_0x2db222['hasOwnProperty'](_0x395c21)){if(_0x2db222[_0x395c21]['Imap']&&_0x2db222[_0x395c21][_0xe02f('0x14')]){var _0x51348e=_0x2db222[_0x395c21][_0xe02f('0x15')];if(!_0x51348e[_0xe02f('0x1b')]&&_0x2db222[_0x395c21][_0xe02f('0x1c')]!==_0xe02f('0x1d'))_0x51348e[_0xe02f('0x1b')]=_0x2db222[_0x395c21][_0xe02f('0x1c')];if(!this['imapAccounts'][_0xe02f('0x1e')](_0x51348e['id'])){this[_0xe02f('0xf')][_0x51348e['id']]=new EmailImap(_0x51348e,_0x2db222[_0x395c21]['email']);this[_0xe02f('0xf')][_0x51348e['id']]['on'](_0xe02f('0x1f'),this[_0xe02f('0x20')]['bind'](this,_0x395c21));this[_0xe02f('0xf')][_0x51348e['id']]['on'](_0xe02f('0x6'),this[_0xe02f('0x21')][_0xe02f('0x22')](this,_0x395c21));this[_0xe02f('0xf')][_0x51348e['id']]['on']('end',this[_0xe02f('0x23')][_0xe02f('0x22')](this,_0x395c21));this[_0xe02f('0xf')][_0x51348e['id']]['on'](_0xe02f('0x24'),this[_0xe02f('0x25')][_0xe02f('0x22')](this,_0x395c21));}}else{if(_[_0xe02f('0x18')](this[_0xe02f('0xe')][_0x395c21][_0xe02f('0x15')])){this[_0xe02f('0xe')][_0x395c21]['Imap']={};}this['mailAccounts'][_0x395c21][_0xe02f('0x15')][_0xe02f('0x16')]=_0xe02f('0x26');this['mailAccounts'][_0x395c21][_0xe02f('0x15')]['messageStatus']='';this[_0xe02f('0x12')](_0x395c21);}}}};EmailChannel[_0xe02f('0x11')][_0xe02f('0x20')]=function(_0x4299a7,_0x55b367){if(this['mailAccounts'][_0x4299a7]){this[_0xe02f('0xe')][_0x4299a7][_0xe02f('0x15')][_0xe02f('0x16')]=_0xe02f('0x27');this[_0xe02f('0xe')][_0x4299a7]['Imap']['messageStatus']=_0x55b367['name'];if(_0x55b367[_0xe02f('0x28')]){this[_0xe02f('0xe')][_0x4299a7][_0xe02f('0x15')][_0xe02f('0x17')]=_0x55b367[_0xe02f('0x28')][_0xe02f('0x17')];}return this[_0xe02f('0x12')](_0x4299a7);}};EmailChannel['prototype'][_0xe02f('0x21')]=function(_0x5ace62,_0x2ed0c5){logger[_0xe02f('0xc')](_0xe02f('0x29'),_0x2ed0c5['firstName'],_0x2ed0c5[_0xe02f('0x2a')],_0x2ed0c5[_0xe02f('0x2b')],_0x5ace62);if(this[_0xe02f('0xe')][_0x5ace62]){return mailAccount[_0xe02f('0x2c')](_0x5ace62,_0x2ed0c5)[_0xe02f('0x2d')](function(_0x201e60){if(_0x201e60){logger[_0xe02f('0xc')](_0xe02f('0x2e'));}})['catch'](function(_0x3e7224){logger['error'](_0xe02f('0x2f'),JSON[_0xe02f('0x19')](_0x3e7224));});}};EmailChannel[_0xe02f('0x11')]['handleImapEnd']=function(_0x2d87aa){if(this['mailAccounts'][_0x2d87aa]&&this[_0xe02f('0xe')][_0x2d87aa]['Imap']){if(this[_0xe02f('0xf')][this['mailAccounts'][_0x2d87aa]['Imap']['id']]){delete this[_0xe02f('0xf')][this[_0xe02f('0xe')][_0x2d87aa]['Imap']['id']];}this[_0xe02f('0xe')][_0x2d87aa]['Imap'][_0xe02f('0x30')]=moment();this[_0xe02f('0x12')](_0x2d87aa);}};EmailChannel[_0xe02f('0x11')][_0xe02f('0x25')]=function(_0x9fbf68,_0xe2ede2){if(this[_0xe02f('0xe')][_0x9fbf68]){this[_0xe02f('0xe')][_0x9fbf68][_0xe02f('0x15')][_0xe02f('0x16')]='error';this[_0xe02f('0xe')][_0x9fbf68][_0xe02f('0x15')]['messageStatus']=_0xe2ede2;return this['emit'](_0x9fbf68);}};EmailChannel[_0xe02f('0x11')][_0xe02f('0x31')]=function(_0x445566,_0x46e3ee){return this[_0xe02f('0x10')]['send'](_0x445566,_0x46e3ee);};EmailChannel[_0xe02f('0x11')][_0xe02f('0x32')]=function(_0xbf6a9b){var _0x396130=this;if(this[_0xe02f('0xe')][_0xbf6a9b['id']]){if(_['isNil'](this[_0xe02f('0xe')][_0xbf6a9b['id']][_0xe02f('0x33')])){this[_0xe02f('0xe')][_0xbf6a9b['id']][_0xe02f('0x33')]={};}this[_0xe02f('0xe')][_0xbf6a9b['id']][_0xe02f('0x33')][_0xe02f('0x30')]=moment();return new BPromise(function(_0x437c9b,_0x74bfbd){return _0x396130['smtp'][_0xe02f('0x34')](_0xbf6a9b)[_0xe02f('0x2d')](function(_0x191494){_0x396130[_0xe02f('0xe')][_0xbf6a9b['id']][_0xe02f('0x33')][_0xe02f('0x16')]=_0xe02f('0x35');_0x396130[_0xe02f('0xe')][_0xbf6a9b['id']]['Smtp'][_0xe02f('0x36')]='';_0x396130['emit'](_0xbf6a9b['id']);_0x437c9b(_0x191494);})[_0xe02f('0x37')](function(_0x136807){_0x396130[_0xe02f('0xe')][_0xbf6a9b['id']]['Smtp'][_0xe02f('0x16')]='error';_0x396130[_0xe02f('0xe')][_0xbf6a9b['id']]['Smtp']['messageStatus']=_0x136807;_0x396130[_0xe02f('0x12')](_0xbf6a9b['id']);_0x74bfbd(_0x136807);});});}return this[_0xe02f('0x10')][_0xe02f('0x34')](_0xbf6a9b);};module[_0xe02f('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index d2edd6e..dd8b25e 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 _0xc2c7=['textCode','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','email','getAccount','account','once','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','CloudProvider','service','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleSimpleParser','handleMessageAttributes','handleMessageEnd','parser'];(function(_0x8d4128,_0x1d9666){var _0x1b08b2=function(_0x59ed79){while(--_0x59ed79){_0x8d4128['push'](_0x8d4128['shift']());}};_0x1b08b2(++_0x1d9666);}(_0xc2c7,0x134));var _0x7c2c=function(_0x496f61,_0x47324e){_0x496f61=_0x496f61-0x0;var _0x2d6c47=_0xc2c7[_0x496f61];return _0x2d6c47;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var Imap=require(_0x7c2c('0x1'));var simpleParser=require(_0x7c2c('0x2'))[_0x7c2c('0x3')];var Iconv=require(_0x7c2c('0x4'))[_0x7c2c('0x5')];var EventEmitter=require(_0x7c2c('0x6'))[_0x7c2c('0x7')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x7c2c('0x8'));function EmailImap(_0x42ecc9,_0x23c038){this['mailbox']='INBOX';this['account']=this[_0x7c2c('0x9')](_0x42ecc9,_0x23c038);this[_0x7c2c('0x1')]=new Imap(this[_0x7c2c('0xa')]);this[_0x7c2c('0x1')][_0x7c2c('0xb')]('ready',this[_0x7c2c('0xc')][_0x7c2c('0xd')](this));this[_0x7c2c('0x1')][_0x7c2c('0xb')](_0x7c2c('0xe'),this[_0x7c2c('0xf')][_0x7c2c('0xd')](this));this[_0x7c2c('0x1')]['on'](_0x7c2c('0x10'),this[_0x7c2c('0x11')][_0x7c2c('0xd')](this));this[_0x7c2c('0x1')][_0x7c2c('0x12')]();}util[_0x7c2c('0x13')](EmailImap,EventEmitter);EmailImap[_0x7c2c('0x14')][_0x7c2c('0x9')]=function(_0x4c4aaf,_0x5b5729){var _0x102778={'connTimeout':_0x4c4aaf[_0x7c2c('0x15')]?_0x4c4aaf[_0x7c2c('0x15')]*0x3e8:0x2710,'authTimeout':_0x4c4aaf['authTimeout']?_0x4c4aaf[_0x7c2c('0x16')]*0x3e8:0x1388};if(_[_0x7c2c('0x17')](_0x4c4aaf['service'])){if(_0x4c4aaf[_0x7c2c('0x18')]){_0x102778['user']=_0x4c4aaf[_0x7c2c('0x19')];_0x102778['password']=_0x4c4aaf[_0x7c2c('0x1a')];}_0x102778[_0x7c2c('0x1b')]=_0x4c4aaf[_0x7c2c('0x1b')];_0x102778[_0x7c2c('0x1c')]=_0x4c4aaf[_0x7c2c('0x1c')]||0x3e1;if(_0x4c4aaf[_0x7c2c('0x1d')]){_0x102778[_0x7c2c('0x1d')]=!![];}else{_0x102778[_0x7c2c('0x1d')]=![];_0x102778[_0x7c2c('0x1e')]=_0x7c2c('0x1f');}}else{if(_0x4c4aaf[_0x7c2c('0x20')]){_0x102778[_0x7c2c('0x21')]=utils['generateXOAuth2Token'](_0x4c4aaf[_0x7c2c('0x22')]['data5'],_0x4c4aaf['user']);_0x102778[_0x7c2c('0x19')]=_0x4c4aaf[_0x7c2c('0x19')];}else{_0x102778[_0x7c2c('0x19')]=_0x4c4aaf[_0x7c2c('0x19')];_0x102778[_0x7c2c('0x1a')]=_0x4c4aaf[_0x7c2c('0x1a')];}_0x102778[_0x7c2c('0x1b')]=utils['getHost'](_0x4c4aaf[_0x7c2c('0x23')]);_0x102778['port']=0x3e1;_0x102778[_0x7c2c('0x1d')]=!![];}_0x102778['email']=_0x5b5729||_0x4c4aaf[_0x7c2c('0x19')]||_0x7c2c('0x24');return _0x102778;};EmailImap[_0x7c2c('0x14')]['handleReady']=function(){this['imap'][_0x7c2c('0x25')](this[_0x7c2c('0x26')],![],this[_0x7c2c('0x27')][_0x7c2c('0xd')](this));};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x27')]=function(_0x3f4618,_0x4b1dd0){if(_0x3f4618){this[_0x7c2c('0x11')](_0x3f4618,!![]);}else{this[_0x7c2c('0x28')](_0x7c2c('0x29'),_0x4b1dd0);this[_0x7c2c('0x2a')]();}};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x2b')]=function(_0xf2bfd1){if(_0xf2bfd1){this[_0x7c2c('0x11')](_0xf2bfd1,!![]);}else{this[_0x7c2c('0x1')]['end']();}};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x2a')]=function(){this[_0x7c2c('0x1')][_0x7c2c('0x2c')](['UNSEEN'],this[_0x7c2c('0x2d')][_0x7c2c('0xd')](this));};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x2d')]=function(_0x1859c2,_0x3ad837){if(_0x1859c2){this[_0x7c2c('0x11')](_0x1859c2,!![]);}else{if(_0x3ad837['length']){try{var _0x1969f4=this[_0x7c2c('0x1')][_0x7c2c('0x2e')](_0x3ad837,{'bodies':'','markSeen':!![]});_0x1969f4['on'](_0x7c2c('0x2f'),this[_0x7c2c('0x30')]['bind'](this));_0x1969f4['once'](_0x7c2c('0x10'),this['handleFetchError']['bind'](this));_0x1969f4[_0x7c2c('0xb')](_0x7c2c('0xe'),this[_0x7c2c('0x31')][_0x7c2c('0xd')](this));}catch(_0x536dcf){logger[_0x7c2c('0x10')](_0x536dcf);}}else{this[_0x7c2c('0x1')][_0x7c2c('0x32')](!![],this[_0x7c2c('0x2b')][_0x7c2c('0xd')](this));}}};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x30')]=function(_0xab5072){_0xab5072['on'](_0x7c2c('0x33'),this[_0x7c2c('0x34')][_0x7c2c('0xd')](this));_0xab5072[_0x7c2c('0xb')](_0x7c2c('0x35'),this['handleMessageAttributes']['bind'](this));_0xab5072[_0x7c2c('0xb')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x34')]=function(_0x129bf0){simpleParser(_0x129bf0,{'Iconv':Iconv},this[_0x7c2c('0x36')][_0x7c2c('0xd')](this));};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x37')]=function(){};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x38')]=function(){};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x36')]=function(_0x58696a,_0x4c7402){if(_0x58696a){logger[_0x7c2c('0x10')](_0x58696a);}else{var _0x360928=this;utils[_0x7c2c('0x39')](this[_0x7c2c('0xa')],_0x4c7402,function(_0x5e8c96){_0x360928[_0x7c2c('0x28')](_0x7c2c('0x8'),_0x5e8c96);});}};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x31')]=function(){this[_0x7c2c('0x1')][_0x7c2c('0x32')](!![],this[_0x7c2c('0x2b')][_0x7c2c('0xd')](this));};EmailImap[_0x7c2c('0x14')]['handleFetchError']=function(_0xe2a67b){this['handleError'](_0xe2a67b);this[_0x7c2c('0x1')][_0x7c2c('0x32')](!![],this['handleCloseBox'][_0x7c2c('0xd')](this));};EmailImap['prototype'][_0x7c2c('0xf')]=function(){this[_0x7c2c('0x28')](_0x7c2c('0xe'));};EmailImap[_0x7c2c('0x14')]['handleError']=function(_0x23fdcf,_0x500974){logger['error'](_0x7c2c('0x11'),this[_0x7c2c('0xa')][_0x7c2c('0x8')],JSON['stringify'](_0x23fdcf));var _0x3adfd1='';if(_0x23fdcf){if(_0x23fdcf[_0x7c2c('0x3a')]){_0x3adfd1=_0x23fdcf['textCode'];}else{for(var _0x267361 in _0x23fdcf){if(_0x23fdcf['hasOwnProperty'](_0x267361)){_0x3adfd1+=_[_0x7c2c('0x3b')](_0x267361)+':\x20'+_0x23fdcf[_0x267361]+'\x0a';}}}}if(_0x500974){this[_0x7c2c('0x1')]['end']();}else{this['emit'](_0x7c2c('0x10'),_0x3adfd1);this[_0x7c2c('0x28')]('end');}};module[_0x7c2c('0x3c')]=EmailImap; \ No newline at end of file +var _0x7096=['util','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','autotls','required','modernAuthentication','xoauth2','CloudProvider','data5','password','getHost','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','exports'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x7096,0x10c));var _0x6709=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x7096[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var Imap=require('imap');var simpleParser=require(_0x6709('0x1'))['simpleParser'];var Iconv=require(_0x6709('0x2'))[_0x6709('0x3')];var EventEmitter=require(_0x6709('0x4'))[_0x6709('0x5')];var utils=require(_0x6709('0x6'));var logger=require(_0x6709('0x7'))(_0x6709('0x8'));function EmailImap(_0x9d630f,_0xa35832){this[_0x6709('0x9')]=_0x6709('0xa');this[_0x6709('0xb')]=this[_0x6709('0xc')](_0x9d630f,_0xa35832);this['imap']=new Imap(this['account']);this[_0x6709('0xd')][_0x6709('0xe')](_0x6709('0xf'),this[_0x6709('0x10')][_0x6709('0x11')](this));this[_0x6709('0xd')]['once']('end',this[_0x6709('0x12')][_0x6709('0x11')](this));this[_0x6709('0xd')]['on'](_0x6709('0x13'),this[_0x6709('0x14')][_0x6709('0x11')](this));this[_0x6709('0xd')][_0x6709('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x6709('0x16')][_0x6709('0xc')]=function(_0x4d5255,_0x3706e1){var _0x4e4587={'connTimeout':_0x4d5255[_0x6709('0x17')]?_0x4d5255['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4d5255[_0x6709('0x18')]?_0x4d5255['authTimeout']*0x3e8:0x1388};if(_[_0x6709('0x19')](_0x4d5255[_0x6709('0x1a')])){if(_0x4d5255[_0x6709('0x1b')]){_0x4e4587[_0x6709('0x1c')]=_0x4d5255['user'];_0x4e4587['password']=_0x4d5255['password'];}_0x4e4587[_0x6709('0x1d')]=_0x4d5255[_0x6709('0x1d')];_0x4e4587['port']=_0x4d5255[_0x6709('0x1e')]||0x3e1;if(_0x4d5255[_0x6709('0x1f')]){_0x4e4587[_0x6709('0x1f')]=!![];}else{_0x4e4587['tls']=![];_0x4e4587[_0x6709('0x20')]=_0x6709('0x21');}}else{if(_0x4d5255[_0x6709('0x22')]){_0x4e4587[_0x6709('0x23')]=utils['generateXOAuth2Token'](_0x4d5255[_0x6709('0x24')][_0x6709('0x25')],_0x4d5255[_0x6709('0x1c')]);_0x4e4587[_0x6709('0x1c')]=_0x4d5255[_0x6709('0x1c')];}else{_0x4e4587[_0x6709('0x1c')]=_0x4d5255[_0x6709('0x1c')];_0x4e4587[_0x6709('0x26')]=_0x4d5255[_0x6709('0x26')];}_0x4e4587[_0x6709('0x1d')]=utils[_0x6709('0x27')](_0x4d5255[_0x6709('0x1a')]);_0x4e4587['port']=0x3e1;_0x4e4587[_0x6709('0x1f')]=!![];}_0x4e4587[_0x6709('0x8')]=_0x3706e1||_0x4d5255[_0x6709('0x1c')]||'anonymous@xcally.com';return _0x4e4587;};EmailImap[_0x6709('0x16')][_0x6709('0x10')]=function(){this[_0x6709('0xd')][_0x6709('0x28')](this['mailbox'],![],this[_0x6709('0x29')][_0x6709('0x11')](this));};EmailImap['prototype'][_0x6709('0x29')]=function(_0x39f6a9,_0x5dbb87){if(_0x39f6a9){this[_0x6709('0x14')](_0x39f6a9,!![]);}else{this[_0x6709('0x2a')]('box',_0x5dbb87);this[_0x6709('0x2b')]();}};EmailImap['prototype'][_0x6709('0x2c')]=function(_0x3cd555){if(_0x3cd555){this['handleError'](_0x3cd555,!![]);}else{this[_0x6709('0xd')]['end']();}};EmailImap[_0x6709('0x16')][_0x6709('0x2b')]=function(){this['imap'][_0x6709('0x2d')](['UNSEEN'],this[_0x6709('0x2e')][_0x6709('0x11')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x37b3ce,_0x2a0cb0){if(_0x37b3ce){this[_0x6709('0x14')](_0x37b3ce,!![]);}else{if(_0x2a0cb0[_0x6709('0x2f')]){try{var _0x12db17=this[_0x6709('0xd')][_0x6709('0x30')](_0x2a0cb0,{'bodies':'','markSeen':!![]});_0x12db17['on'](_0x6709('0x31'),this[_0x6709('0x32')]['bind'](this));_0x12db17[_0x6709('0xe')](_0x6709('0x13'),this[_0x6709('0x33')][_0x6709('0x11')](this));_0x12db17['once'](_0x6709('0x34'),this[_0x6709('0x35')][_0x6709('0x11')](this));}catch(_0x1bd075){logger['error'](_0x1bd075);}}else{this[_0x6709('0xd')][_0x6709('0x36')](!![],this['handleCloseBox'][_0x6709('0x11')](this));}}};EmailImap[_0x6709('0x16')]['handleFetchMessage']=function(_0x6863f9){_0x6863f9['on'](_0x6709('0x37'),this[_0x6709('0x38')][_0x6709('0x11')](this));_0x6863f9[_0x6709('0xe')](_0x6709('0x39'),this[_0x6709('0x3a')]['bind'](this));_0x6863f9[_0x6709('0xe')](_0x6709('0x34'),this['handleMessageEnd'][_0x6709('0x11')](this));};EmailImap[_0x6709('0x16')][_0x6709('0x38')]=function(_0x2bb89c){simpleParser(_0x2bb89c,{'Iconv':Iconv},this[_0x6709('0x3b')][_0x6709('0x11')](this));};EmailImap['prototype'][_0x6709('0x3a')]=function(){};EmailImap['prototype'][_0x6709('0x3c')]=function(){};EmailImap[_0x6709('0x16')][_0x6709('0x3b')]=function(_0x48492f,_0x149a7a){if(_0x48492f){logger[_0x6709('0x13')](_0x48492f);}else{var _0x2d9879=this;utils[_0x6709('0x3d')](this[_0x6709('0xb')],_0x149a7a,function(_0x1030ee){_0x2d9879[_0x6709('0x2a')]('email',_0x1030ee);});}};EmailImap[_0x6709('0x16')][_0x6709('0x35')]=function(){this[_0x6709('0xd')][_0x6709('0x36')](!![],this[_0x6709('0x2c')][_0x6709('0x11')](this));};EmailImap[_0x6709('0x16')]['handleFetchError']=function(_0x5abb53){this[_0x6709('0x14')](_0x5abb53);this[_0x6709('0xd')][_0x6709('0x36')](!![],this[_0x6709('0x2c')]['bind'](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x6709('0x2a')](_0x6709('0x34'));};EmailImap['prototype'][_0x6709('0x14')]=function(_0x2ab80f,_0x50d638){logger['error'](_0x6709('0x14'),this[_0x6709('0xb')][_0x6709('0x8')],JSON[_0x6709('0x3e')](_0x2ab80f));var _0x13877a='';if(_0x2ab80f){if(_0x2ab80f['textCode']){_0x13877a=_0x2ab80f[_0x6709('0x3f')];}else{for(var _0x4d93e4 in _0x2ab80f){if(_0x2ab80f[_0x6709('0x40')](_0x4d93e4)){_0x13877a+=_[_0x6709('0x41')](_0x4d93e4)+':\x20'+_0x2ab80f[_0x4d93e4]+'\x0a';}}}}if(_0x50d638){this[_0x6709('0xd')]['end']();}else{this[_0x6709('0x2a')]('error',_0x13877a);this['emit'](_0x6709('0x34'));}};module[_0x6709('0x42')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 77b9cca..c64110b 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 _0x5e82=['send','compile','prototype','verify','createTransport','toString','exports','nodemailer-plugin-inline-base64'];(function(_0x31fb52,_0xded904){var _0x3fc244=function(_0x267c70){while(--_0x267c70){_0x31fb52['push'](_0x31fb52['shift']());}};_0x3fc244(++_0xded904);}(_0x5e82,0x17f));var _0x25e8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5e82[_0x14add3];return _0x4a174f;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x25e8('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x25e8('0x1')]=function(_0x5f0e37,_0x2f3a34){return new Promise(function(_0x486886,_0x20ad21){var _0x3c62ab=nodemailer['createTransport'](_0x5f0e37);_0x3c62ab['use'](_0x25e8('0x2'),inlineBase64());_0x3c62ab['sendMail'](_0x2f3a34,function(_0x288f17,_0x38cf72){if(_0x288f17){_0x20ad21(_0x288f17['toString']());}else{_0x486886(_0x38cf72);}});});};EmailSmtp[_0x25e8('0x3')][_0x25e8('0x4')]=function(_0x728207){return new Promise(function(_0x3879aa,_0x3446d7){var _0x1aa1a9=nodemailer[_0x25e8('0x5')](_0x728207);_0x1aa1a9['verify'](function(_0x467fba,_0x4b01e1){if(_0x467fba){_0x3446d7(_0x467fba[_0x25e8('0x6')]());}else{if(_0x4b01e1){_0x3879aa(_0x4b01e1);}else{_0x3446d7('Not\x20verifired');}}});});};module[_0x25e8('0x7')]=EmailSmtp; \ No newline at end of file +var _0xca1d=['sendMail','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile'];(function(_0x3e3f8b,_0xc3cf21){var _0x146999=function(_0x31518f){while(--_0x31518f){_0x3e3f8b['push'](_0x3e3f8b['shift']());}};_0x146999(++_0xc3cf21);}(_0xca1d,0x9e));var _0xdca1=function(_0x40baaa,_0x4f9fe2){_0x40baaa=_0x40baaa-0x0;var _0x312b13=_0xca1d[_0x40baaa];return _0x312b13;};'use strict';var nodemailer=require(_0xdca1('0x0'));var inlineBase64=require(_0xdca1('0x1'));function EmailSmtp(){}EmailSmtp[_0xdca1('0x2')][_0xdca1('0x3')]=function(_0x38f4fa,_0x547179){return new Promise(function(_0x43b973,_0xbe660b){var _0x581898=nodemailer[_0xdca1('0x4')](_0x38f4fa);_0x581898[_0xdca1('0x5')](_0xdca1('0x6'),inlineBase64());_0x581898[_0xdca1('0x7')](_0x547179,function(_0x4f7f48,_0x46e0f9){if(_0x4f7f48){_0xbe660b(_0x4f7f48['toString']());}else{_0x43b973(_0x46e0f9);}});});};EmailSmtp['prototype'][_0xdca1('0x8')]=function(_0x1f8c79){return new Promise(function(_0xef6724,_0x1f2c21){var _0x2a6e8c=nodemailer['createTransport'](_0x1f8c79);_0x2a6e8c[_0xdca1('0x8')](function(_0x202338,_0x5d77f7){if(_0x202338){_0x1f2c21(_0x202338['toString']());}else{if(_0x5d77f7){_0xef6724(_0x5d77f7);}else{_0x1f2c21(_0xdca1('0x9'));}}});});};module[_0xdca1('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 6bc0195..1cc04cb 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 _0xd9b5=['push','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','headerLines','line','parser','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','user=','auth=Bearer\x20','toString','moment','randomstring','path','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','name','substring','length','join','split','pop','isEmpty','anonymous','@xcally.com','test','html','replace','includes','','body','0x1?_0x17603c['slice'](0x0,-0x1)[_0x5d9b('0xd')]('\x20'):_0x3aff7d['name'];}return'Anonymous';}function getLastName(_0x58957f){var _0x4e0163=_[_0x5d9b('0x6')](_0x58957f[_0x5d9b('0x7')]);if(_0x4e0163&&_0x4e0163[_0x5d9b('0xa')]){var _0x163fc7=_0x4e0163[_0x5d9b('0xa')][_0x5d9b('0xe')](/\s+/);return _0x163fc7['length']>0x1?_0x163fc7[_0x5d9b('0xf')]():'';}return'';}function getMails(_0x5c1d4d,_0x42e389){var _0x3766ff='';for(var _0x15e1cc=0x0;_0x15e1cc<_0x42e389[_0x5d9b('0x7')][_0x5d9b('0xc')];_0x15e1cc+=0x1){if(_0x42e389['value'][_0x15e1cc][_0x5d9b('0x8')]!==_0x5c1d4d){if(!_[_0x5d9b('0x10')](_0x3766ff)){_0x3766ff+=',';}_0x3766ff+=_0x42e389[_0x5d9b('0x7')][_0x15e1cc][_0x5d9b('0xa')]||_0x42e389[_0x5d9b('0x7')][_0x15e1cc]['address']||'';_0x3766ff+='\x20<';_0x3766ff+=_0x42e389[_0x5d9b('0x7')][_0x15e1cc][_0x5d9b('0x8')]?_0x42e389['value'][_0x15e1cc]['address']:_0x5d9b('0x11')+random[_0x5d9b('0x9')](0x6)+_0x5d9b('0x12');_0x3766ff+='>';}}return _0x3766ff;}function parseEmail(_0x568e4e,_0xac1f40,_0x3bb0ca){if(_0xac1f40['html']){var _0x888079=/)<[^<]*)*<\/script>/gi;while(_0x888079[_0x5d9b('0x13')](_0xac1f40[_0x5d9b('0x14')])){_0xac1f40['html']=_0xac1f40['html'][_0x5d9b('0x15')](_0x888079,'');}if(_0xac1f40[_0x5d9b('0x14')][_0x5d9b('0x16')](_0x5d9b('0x17'))){var _0x10028b=[];_0xac1f40['attachments'][_0x5d9b('0x18')](_0x32bd11=>{_0x10028b['push'](_0x32bd11[_0x5d9b('0x19')]);});var _0x45baa5=/]+>/g;var _0x227509=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x489565=_0xac1f40[_0x5d9b('0x14')]['replace'](_0x227509,_0x5d9b('0x1a'));var _0x400bc2=_0x489565['replace'](_0x45baa5,_0x5d9b('0x1b'));for(let _0x265bef=0x0;_0x265bef<_0x10028b['length'];_0x265bef++){var _0x263ee2=_0x400bc2[_0x5d9b('0x15')]('_IMG','\x20[Attachment:\x20'+_0x10028b[_0x265bef]+_0x5d9b('0x1c'));_0x400bc2=_0x263ee2;}_0xac1f40['html']=_0x400bc2;}_0x3bb0ca[_0x5d9b('0x1d')]=_0xac1f40['html'];}else{_0x3bb0ca['body']=_0xac1f40['textAsHtml'];}if(_0x3bb0ca[_0x5d9b('0x1d')]){_0x3bb0ca[_0x5d9b('0x1d')]=_0x3bb0ca[_0x5d9b('0x1d')][_0x5d9b('0x15')](/0x0){var _0x575fd9=['Auto-Submitted:\x20auto-replied',_0x5d9b('0x2f'),_0x5d9b('0x30')];for(var _0x2d4960=0x0;_0x2d4960<_0xac1f40[_0x5d9b('0x31')][_0x5d9b('0xc')];_0x2d4960++){var _0x53224b=_['indexOf'](_0x575fd9,_0xac1f40[_0x5d9b('0x31')][_0x2d4960][_0x5d9b('0x32')]);if(_0x53224b>=0x0){_0x3bb0ca['isAutoreply']=!![];}}}return _0x3bb0ca;}exports[_0x5d9b('0x33')]=function(_0x14182f,_0x4c61b2,_0x5cf22a){var _0x1642f0={'from':getAddress(_0x4c61b2[_0x5d9b('0x34')]),'firstName':getFirstName(_0x4c61b2[_0x5d9b('0x34')]),'lastName':getLastName(_0x4c61b2[_0x5d9b('0x34')]),'mapKey':_0x5d9b('0x21'),'message':{'from':getMails(_0x14182f[_0x5d9b('0x21')],_0x4c61b2[_0x5d9b('0x34')]),'to':_0x14182f['email'],'cc':'','subject':_0x4c61b2['subject']||'','messageId':_0x4c61b2[_0x5d9b('0x35')],'inReplyTo':_0x4c61b2[_0x5d9b('0x36')],'sentAt':moment(_0x4c61b2[_0x5d9b('0x37')])[_0x5d9b('0x28')](_0x5d9b('0x38')),'attach':![],'attachments':[]}};if(!_0x4c61b2[_0x5d9b('0x14')]&&!_0x4c61b2[_0x5d9b('0x39')]){var _0x122085=_[_0x5d9b('0x3a')](_0x4c61b2[_0x5d9b('0x23')],{'contentType':_0x5d9b('0x3b')});if(_0x122085[_0x5d9b('0xc')]){logger['info'](util[_0x5d9b('0x28')](_0x5d9b('0x3c'),_0x4c61b2[_0x5d9b('0x35')]));tnef[_0x5d9b('0x3d')](_[_0x5d9b('0x3e')](_0x122085)[_0x5d9b('0x2d')],function(_0xbdadf9,_0x1db900){if(_0x1db900){_0x4c61b2[_0x5d9b('0x14')]=_0x1db900[_0x5d9b('0x3f')]||_0x5d9b('0x40');if(_0x1db900[_0x5d9b('0x41')]){for(var _0x39c797=0x0;_0x39c797<_0x1db900[_0x5d9b('0x41')]['length'];_0x39c797++){var _0x55e64b=_0x1db900['Attachments'][_0x39c797];_0x1642f0[_0x5d9b('0x1f')][_0x5d9b('0x23')]['push']({'filename':_0x55e64b[_0x5d9b('0x42')],'content':Buffer[_0x5d9b('0x34')](_0x55e64b[_0x5d9b('0x43')])});}}}_0x5cf22a(parseEmail(_0x14182f,_0x4c61b2,_0x1642f0));});}else{_0x4c61b2[_0x5d9b('0x14')]=_0x5d9b('0x40');_0x5cf22a(parseEmail(_0x14182f,_0x4c61b2,_0x1642f0));}}else{_0x5cf22a(parseEmail(_0x14182f,_0x4c61b2,_0x1642f0));}};exports[_0x5d9b('0x44')]=function(_0x1e5e04){switch(_0x1e5e04){case _0x5d9b('0x45'):return _0x5d9b('0x46');case _0x5d9b('0x47'):return _0x5d9b('0x48');case _0x5d9b('0x49'):return _0x5d9b('0x4a');case _0x5d9b('0x4b'):return _0x5d9b('0x4c');}return'127.0.0.1';};exports['generateXOAuth2Token']=function(_0x25376b,_0x2ae7fb){var _0x3f9560=[_0x5d9b('0x4d')+(_0x2ae7fb||''),_0x5d9b('0x4e')+_0x25376b,'',''];return Buffer[_0x5d9b('0x34')](_0x3f9560[_0x5d9b('0xd')](''),'utf-8')[_0x5d9b('0x4f')]('base64');}; \ No newline at end of file +var _0xb691=['base64','lodash','moment','path','util','email','../../../config/environment','address','anonymous','generate','head','name','substring','indexOf','split','length','slice','Anonymous','value','pop','isEmpty','@xcally.com','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','gmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','user=','toString'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0xb691,0x17d));var _0x1b69=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0xb691[_0xb99421];return _0x4b3ec7;};'use strict';var _=require(_0x1b69('0x0'));var moment=require(_0x1b69('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x1b69('0x2'));var util=require(_0x1b69('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x1b69('0x4'));var config=require(_0x1b69('0x5'));function getAddress(_0x4a8b0b){var _0x4dfa33=_['head'](_0x4a8b0b['value']);return _0x4dfa33&&_0x4dfa33[_0x1b69('0x6')]?_0x4dfa33[_0x1b69('0x6')]:_0x1b69('0x7')+random[_0x1b69('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x523273){var _0x2891fc=_[_0x1b69('0x9')](_0x523273['value']);if(_0x2891fc&&_0x2891fc[_0x1b69('0xa')]){if(_0x2891fc[_0x1b69('0xa')]==_0x2891fc['address']){return _0x2891fc[_0x1b69('0xa')][_0x1b69('0xb')](0x0,_0x2891fc['name'][_0x1b69('0xc')]('@'));}var _0x4986a2=_0x2891fc[_0x1b69('0xa')][_0x1b69('0xd')](/\s+/);return _0x4986a2[_0x1b69('0xe')]>0x1?_0x4986a2[_0x1b69('0xf')](0x0,-0x1)['join']('\x20'):_0x2891fc['name'];}return _0x1b69('0x10');}function getLastName(_0x1527e9){var _0x5bcdfb=_['head'](_0x1527e9[_0x1b69('0x11')]);if(_0x5bcdfb&&_0x5bcdfb['name']){var _0x5a89c1=_0x5bcdfb[_0x1b69('0xa')][_0x1b69('0xd')](/\s+/);return _0x5a89c1['length']>0x1?_0x5a89c1[_0x1b69('0x12')]():'';}return'';}function getMails(_0x134cd6,_0x50c1fb){var _0x227670='';for(var _0x25d9f6=0x0;_0x25d9f6<_0x50c1fb['value'][_0x1b69('0xe')];_0x25d9f6+=0x1){if(_0x50c1fb['value'][_0x25d9f6][_0x1b69('0x6')]!==_0x134cd6){if(!_[_0x1b69('0x13')](_0x227670)){_0x227670+=',';}_0x227670+=_0x50c1fb[_0x1b69('0x11')][_0x25d9f6]['name']||_0x50c1fb[_0x1b69('0x11')][_0x25d9f6][_0x1b69('0x6')]||'';_0x227670+='\x20<';_0x227670+=_0x50c1fb['value'][_0x25d9f6][_0x1b69('0x6')]?_0x50c1fb[_0x1b69('0x11')][_0x25d9f6][_0x1b69('0x6')]:_0x1b69('0x7')+random['generate'](0x6)+_0x1b69('0x14');_0x227670+='>';}}return _0x227670;}function parseEmail(_0x28cbcd,_0x3fdcf7,_0x2a7e6f){if(_0x3fdcf7[_0x1b69('0x15')]){var _0x4644bb=/)<[^<]*)*<\/script>/gi;while(_0x4644bb[_0x1b69('0x16')](_0x3fdcf7[_0x1b69('0x15')])){_0x3fdcf7['html']=_0x3fdcf7['html'][_0x1b69('0x17')](_0x4644bb,'');}if(_0x3fdcf7[_0x1b69('0x15')][_0x1b69('0x18')](_0x1b69('0x19'))){var _0x5c7202=[];_0x3fdcf7['attachments'][_0x1b69('0x1a')](_0x51eeb0=>{_0x5c7202[_0x1b69('0x1b')](_0x51eeb0[_0x1b69('0x1c')]);});var _0x4bf790=/]+>/g;var _0x23afb3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2a9bc2=_0x3fdcf7[_0x1b69('0x15')]['replace'](_0x23afb3,_0x1b69('0x1d'));var _0x3acbde=_0x2a9bc2[_0x1b69('0x17')](_0x4bf790,_0x1b69('0x1e'));for(let _0xedc266=0x0;_0xedc266<_0x5c7202[_0x1b69('0xe')];_0xedc266++){var _0x2c918d=_0x3acbde[_0x1b69('0x17')](_0x1b69('0x1e'),_0x1b69('0x1f')+_0x5c7202[_0xedc266]+'\x20]');_0x3acbde=_0x2c918d;}_0x3fdcf7[_0x1b69('0x15')]=_0x3acbde;}_0x2a7e6f[_0x1b69('0x20')]=_0x3fdcf7['html'];}else{_0x2a7e6f['body']=_0x3fdcf7[_0x1b69('0x21')];}if(_0x2a7e6f['body']){_0x2a7e6f[_0x1b69('0x20')]=_0x2a7e6f[_0x1b69('0x20')][_0x1b69('0x17')](/0x0){var _0x4acc1c=[_0x1b69('0x33'),_0x1b69('0x34'),_0x1b69('0x35')];for(var _0x5b21d0=0x0;_0x5b21d0<_0x3fdcf7['headerLines'][_0x1b69('0xe')];_0x5b21d0++){var _0xb7ac83=_[_0x1b69('0xc')](_0x4acc1c,_0x3fdcf7['headerLines'][_0x5b21d0][_0x1b69('0x36')]);if(_0xb7ac83>=0x0){_0x2a7e6f[_0x1b69('0x37')]=!![];}}}return _0x2a7e6f;}exports['parser']=function(_0x15030c,_0x491f26,_0x194845){var _0x2461d0={'from':getAddress(_0x491f26[_0x1b69('0x38')]),'firstName':getFirstName(_0x491f26[_0x1b69('0x38')]),'lastName':getLastName(_0x491f26[_0x1b69('0x38')]),'mapKey':_0x1b69('0x4'),'message':{'from':getMails(_0x15030c[_0x1b69('0x4')],_0x491f26['from']),'to':_0x15030c[_0x1b69('0x4')],'cc':'','subject':_0x491f26[_0x1b69('0x39')]||'','messageId':_0x491f26['messageId'],'inReplyTo':_0x491f26['inReplyTo'],'sentAt':moment(_0x491f26['date'])[_0x1b69('0x2b')](_0x1b69('0x3a')),'attach':![],'attachments':[]}};if(!_0x491f26[_0x1b69('0x15')]&&!_0x491f26['textAsHtml']){var _0x48b483=_['filter'](_0x491f26['attachments'],{'contentType':'application/ms-tnef'});if(_0x48b483[_0x1b69('0xe')]){logger[_0x1b69('0x3b')](util[_0x1b69('0x2b')](_0x1b69('0x3c'),_0x491f26[_0x1b69('0x3d')]));tnef[_0x1b69('0x3e')](_[_0x1b69('0x3f')](_0x48b483)[_0x1b69('0x31')],function(_0x243dc8,_0x5ef56d){if(_0x5ef56d){_0x491f26['html']=_0x5ef56d['BodyHTML']||_0x1b69('0x40');if(_0x5ef56d[_0x1b69('0x41')]){for(var _0x4433d1=0x0;_0x4433d1<_0x5ef56d[_0x1b69('0x41')]['length'];_0x4433d1++){var _0x544c92=_0x5ef56d[_0x1b69('0x41')][_0x4433d1];_0x2461d0['message'][_0x1b69('0x27')][_0x1b69('0x1b')]({'filename':_0x544c92[_0x1b69('0x42')],'content':Buffer[_0x1b69('0x38')](_0x544c92['Data'])});}}}_0x194845(parseEmail(_0x15030c,_0x491f26,_0x2461d0));});}else{_0x491f26['html']=_0x1b69('0x40');_0x194845(parseEmail(_0x15030c,_0x491f26,_0x2461d0));}}else{_0x194845(parseEmail(_0x15030c,_0x491f26,_0x2461d0));}};exports['getHost']=function(_0x2a0b58){switch(_0x2a0b58){case _0x1b69('0x43'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case'hotmail':return _0x1b69('0x44');case _0x1b69('0x45'):return _0x1b69('0x46');}return _0x1b69('0x47');};exports[_0x1b69('0x48')]=function(_0x520775,_0x2859d5){var _0x4338ac=[_0x1b69('0x49')+(_0x2859d5||''),'auth=Bearer\x20'+_0x520775,'',''];return Buffer[_0x1b69('0x38')](_0x4338ac['join'](''),'utf-8')[_0x1b69('0x4a')](_0x1b69('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 04975c2..3f76f90 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 _0x0a3c=['active','Imap','Smtp','exports','name','key'];(function(_0x17788a,_0x150887){var _0x33f47c=function(_0x120fcb){while(--_0x120fcb){_0x17788a['push'](_0x17788a['shift']());}};_0x33f47c(++_0x150887);}(_0x0a3c,0x136));var _0xc0a3=function(_0x3d644d,_0x13e459){_0x3d644d=_0x3d644d-0x0;var _0x369bca=_0x0a3c[_0x3d644d];return _0x369bca;};'use strict';var _=require('lodash');function MailAccount(_0x16fdfc){this['id']=_0x16fdfc['id']||0x0;this[_0xc0a3('0x0')]=_0x16fdfc['name']||'Service';this[_0xc0a3('0x1')]=_0x16fdfc[_0xc0a3('0x1')]||'SERV';this[_0xc0a3('0x2')]=_0x16fdfc[_0xc0a3('0x2')]||![];this['Imap']=_0x16fdfc[_0xc0a3('0x3')]||[];this[_0xc0a3('0x4')]=_0x16fdfc['Smtp']||[];}module[_0xc0a3('0x5')]=MailAccount; \ No newline at end of file +var _0xbdda=['Smtp','exports','lodash','name','Service','active','Imap'];(function(_0x25efc1,_0x562953){var _0x2b55f1=function(_0x1cb20c){while(--_0x1cb20c){_0x25efc1['push'](_0x25efc1['shift']());}};_0x2b55f1(++_0x562953);}(_0xbdda,0x18a));var _0xabdd=function(_0x49e811,_0xa732a0){_0x49e811=_0x49e811-0x0;var _0x46a762=_0xbdda[_0x49e811];return _0x46a762;};'use strict';var _=require(_0xabdd('0x0'));function MailAccount(_0x198233){this['id']=_0x198233['id']||0x0;this[_0xabdd('0x1')]=_0x198233[_0xabdd('0x1')]||_0xabdd('0x2');this['key']=_0x198233['key']||'SERV';this[_0xabdd('0x3')]=_0x198233[_0xabdd('0x3')]||![];this[_0xabdd('0x4')]=_0x198233[_0xabdd('0x4')]||[];this[_0xabdd('0x5')]=_0x198233['Smtp']||[];}module[_0xabdd('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 49c4189..222047d 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 _0x5d7d=['length','isUndefined','merge','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts'];(function(_0x3a8935,_0x170fa){var _0x1cfdfe=function(_0x8a30e7){while(--_0x8a30e7){_0x3a8935['push'](_0x3a8935['shift']());}};_0x1cfdfe(++_0x170fa);}(_0x5d7d,0x1f2));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xd5d7('0x0')]={};};function freeIsNotKey(_0x1e817c,_0x379610,_0xc90283){var _0x81f987=_[_0xd5d7('0x1')](_0x1e817c,function(_0x6490fb,_0x3a90fc){return _0x6490fb[_0xc90283];});for(var _0x47d4cd in _0x379610){if(_0x379610[_0xd5d7('0x2')](_0x47d4cd)){if(!_0x81f987[_0x47d4cd]){delete _0x379610[_0x47d4cd];}}}}Realtime[_0xd5d7('0x3')][_0xd5d7('0x4')]=function(_0x1bddd6,_0x416e7c){for(var _0x54c7ac in _0x416e7c){if(_0x1bddd6[_0xd5d7('0x2')](_0x54c7ac)){_0x1bddd6[_0x54c7ac]=_0x416e7c[_0x54c7ac];}}};Realtime[_0xd5d7('0x3')][_0xd5d7('0x5')]=function(){var _0x4ac09a=this;return function(_0x1a58d4){if(_0x1a58d4){freeIsNotKey(_0x1a58d4,_0x4ac09a[_0xd5d7('0x0')],'id');for(var _0xaabc5a=0x0,_0x471e1a={},_0x16e973={};_0xaabc5a<_0x1a58d4[_0xd5d7('0x6')];_0xaabc5a+=0x1){_0x471e1a=_0x1a58d4[_0xaabc5a];if(_[_0xd5d7('0x7')](_0x4ac09a[_0xd5d7('0x0')][_0x471e1a['id']])){_0x4ac09a[_0xd5d7('0x0')][_0x471e1a['id']]=new MailAccount(_0x471e1a);}else{_[_0xd5d7('0x8')](_0x4ac09a[_0xd5d7('0x0')][_0x471e1a['id']],_0x471e1a);}}}return _0x4ac09a[_0xd5d7('0x0')];};};module['exports']=Realtime; \ No newline at end of file +var _0x47a4=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x47a4,0x1c0));var _0x447a=function(_0x4ca6ab,_0xdd715){_0x4ca6ab=_0x4ca6ab-0x0;var _0x329f8c=_0x47a4[_0x4ca6ab];return _0x329f8c;};'use strict';var _=require(_0x447a('0x0'));var MailAccount=require(_0x447a('0x1'));var Realtime=function(){this[_0x447a('0x2')]={};};function freeIsNotKey(_0x547bd6,_0x4eac40,_0x79a847){var _0x165a6f=_[_0x447a('0x3')](_0x547bd6,function(_0x2c4d6a,_0x458098){return _0x2c4d6a[_0x79a847];});for(var _0x225f32 in _0x4eac40){if(_0x4eac40[_0x447a('0x4')](_0x225f32)){if(!_0x165a6f[_0x225f32]){delete _0x4eac40[_0x225f32];}}}}Realtime[_0x447a('0x5')][_0x447a('0x6')]=function(_0x69c4f4,_0x1a08f7){for(var _0x160322 in _0x1a08f7){if(_0x69c4f4[_0x447a('0x4')](_0x160322)){_0x69c4f4[_0x160322]=_0x1a08f7[_0x160322];}}};Realtime[_0x447a('0x5')]['initMailAccounts']=function(){var _0x29c35b=this;return function(_0x510ccf){if(_0x510ccf){freeIsNotKey(_0x510ccf,_0x29c35b[_0x447a('0x2')],'id');for(var _0x30f828=0x0,_0x382589={},_0x17ebf4={};_0x30f828<_0x510ccf[_0x447a('0x7')];_0x30f828+=0x1){_0x382589=_0x510ccf[_0x30f828];if(_[_0x447a('0x8')](_0x29c35b[_0x447a('0x2')][_0x382589['id']])){_0x29c35b['mailAccounts'][_0x382589['id']]=new MailAccount(_0x382589);}else{_[_0x447a('0x9')](_0x29c35b['mailAccounts'][_0x382589['id']],_0x382589);}}}return _0x29c35b[_0x447a('0x2')];};};module[_0x447a('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 6c1bbcf..3957e56 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 _0x9c57=['data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type'];(function(_0x523222,_0xb528d){var _0x26b6cd=function(_0x4f548f){while(--_0x4f548f){_0x523222['push'](_0x523222['shift']());}};_0x26b6cd(++_0xb528d);}(_0x9c57,0x99));var _0x79c5=function(_0x5c2d7b,_0x4918c5){_0x5c2d7b=_0x5c2d7b-0x0;var _0x27e5f6=_0x9c57[_0x5c2d7b];return _0x27e5f6;};'use strict';var client=require(_0x79c5('0x0'));exports[_0x79c5('0x1')]=function(){return function(){return client[_0x79c5('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x79c5('0x3'),_0x79c5('0x4'),_0x79c5('0x5'),_0x79c5('0x6'),_0x79c5('0x7'),_0x79c5('0x8'),_0x79c5('0x9'),_0x79c5('0xa')],'raw':![],'include':[{'model':_0x79c5('0xb'),'as':_0x79c5('0xc'),'include':[{'model':_0x79c5('0xd'),'attributes':['id',_0x79c5('0x3'),_0x79c5('0x5'),_0x79c5('0xe'),_0x79c5('0xf')],'as':_0x79c5('0xd')}]},{'model':_0x79c5('0x10'),'as':_0x79c5('0x11'),'include':[{'model':_0x79c5('0xd'),'attributes':['id',_0x79c5('0x3'),_0x79c5('0x5'),_0x79c5('0xe'),_0x79c5('0xf')],'as':_0x79c5('0xd')}]}]},'log':_0x79c5('0x12')});};};exports[_0x79c5('0x13')]=function(_0x8f8505,_0x177a82){return client[_0x79c5('0x2')](_0x79c5('0x14'),{'account':{'id':_0x8f8505},'body':_0x177a82,'log':_0x79c5('0x14')});}; \ No newline at end of file +var _0xbf40=['MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','Request','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type'];(function(_0x3d4a6b,_0x20dbcb){var _0x55d64a=function(_0x220a50){while(--_0x220a50){_0x3d4a6b['push'](_0x3d4a6b['shift']());}};_0x55d64a(++_0x20dbcb);}(_0xbf40,0x1f4));var _0x0bf4=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xbf40[_0x2a7b8e];return _0x29b5c8;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x0bf4('0x0')]('GetMailAccount',{'options':{'attributes':['id','name',_0x0bf4('0x1'),_0x0bf4('0x2'),_0x0bf4('0x3'),_0x0bf4('0x4'),_0x0bf4('0x5'),_0x0bf4('0x6'),_0x0bf4('0x7')],'raw':![],'include':[{'model':_0x0bf4('0x8'),'as':_0x0bf4('0x9'),'include':[{'model':_0x0bf4('0xa'),'attributes':['id',_0x0bf4('0xb'),'service',_0x0bf4('0xc'),'data5'],'as':_0x0bf4('0xa')}]},{'model':_0x0bf4('0xd'),'as':_0x0bf4('0xe'),'include':[{'model':_0x0bf4('0xa'),'attributes':['id',_0x0bf4('0xb'),'service',_0x0bf4('0xc'),_0x0bf4('0xf')],'as':_0x0bf4('0xa')}]}]},'log':_0x0bf4('0x10')});};};exports[_0x0bf4('0x11')]=function(_0x5f358f,_0x41a526){return client[_0x0bf4('0x0')](_0x0bf4('0x12'),{'account':{'id':_0x5f358f},'body':_0x41a526,'log':_0x0bf4('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index f6efeca..837b704 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 _0xab4b=['ShowSetting','loginMailFrequency','getSettings','Request'];(function(_0x33424e,_0x119b2b){var _0x4ae9ab=function(_0x41085a){while(--_0x41085a){_0x33424e['push'](_0x33424e['shift']());}};_0x4ae9ab(++_0x119b2b);}(_0xab4b,0x15e));var _0xbab4=function(_0x2d719c,_0x59b346){_0x2d719c=_0x2d719c-0x0;var _0x16c7e8=_0xab4b[_0x2d719c];return _0x16c7e8;};'use strict';var client=require('../client');exports[_0xbab4('0x0')]=function(){return client[_0xbab4('0x1')](_0xbab4('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbab4('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xc4f9=['getSettings','GetSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4f9,0x102));var _0x9c4f=function(_0x2fc542,_0x30fc1e){_0x2fc542=_0x2fc542-0x0;var _0x5bf715=_0xc4f9[_0x2fc542];return _0x5bf715;};'use strict';var client=require('../client');exports[_0x9c4f('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x9c4f('0x1')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 778a731..0f6bb66 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 891a1cb..d16d6a8 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 _0x7983=['sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','exports','lodash','express'];(function(_0x108831,_0x5e4f70){var _0x4da77a=function(_0x139446){while(--_0x139446){_0x108831['push'](_0x108831['shift']());}};_0x4da77a(++_0x5e4f70);}(_0x7983,0x18e));var _0x3798=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7983[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x3798('0x0'));var http=require('http');var express=require(_0x3798('0x1'));var sticky=require(_0x3798('0x2'));var Redis=require(_0x3798('0x3'));var config=require(_0x3798('0x4'));var app=express();var server=http[_0x3798('0x5')](app);server[_0x3798('0x6')]=0xdbba0;if(sticky[_0x3798('0x7')](server,config[_0x3798('0x8')])){var socketio=require(_0x3798('0x9'))(server,{'transports':[_0x3798('0xa'),'polling']});config[_0x3798('0xb')]=_[_0x3798('0xc')](config['redis'],{'host':_0x3798('0xd'),'port':0x18eb});socketio[_0x3798('0xe')](require(_0x3798('0xf'))({'pubClient':new Redis(config[_0x3798('0xb')]),'subClient':new Redis(config[_0x3798('0xb')])}));require(_0x3798('0x10'))[_0x3798('0x11')]();require(_0x3798('0x12'))[_0x3798('0x11')](socketio);require(_0x3798('0x13'))[_0x3798('0x11')](app);require(_0x3798('0x14'))[_0x3798('0x11')](app);}else{server[_0x3798('0x15')](_0x3798('0x16'),function(){console[_0x3798('0x17')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x3798('0x8')]);});}exports=module[_0x3798('0x18')]=app; \ No newline at end of file +var _0x734d=['../../config/environment','createServer','timeout','listen','port','websocket','polling','defaults','localhost','socket.io-redis','default','../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http'];(function(_0x31e8fc,_0x1df65e){var _0x4c58b2=function(_0x1861ea){while(--_0x1861ea){_0x31e8fc['push'](_0x31e8fc['shift']());}};_0x4c58b2(++_0x1df65e);}(_0x734d,0x1af));var _0xd734=function(_0x3f5880,_0x2beec0){_0x3f5880=_0x3f5880-0x0;var _0x1cc879=_0x734d[_0x3f5880];return _0x1cc879;};'use strict';var _=require('lodash');var http=require(_0xd734('0x0'));var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xd734('0x1'));var app=express();var server=http[_0xd734('0x2')](app);server[_0xd734('0x3')]=0xdbba0;if(sticky[_0xd734('0x4')](server,config[_0xd734('0x5')])){var socketio=require('socket.io')(server,{'transports':[_0xd734('0x6'),_0xd734('0x7')]});config['redis']=_[_0xd734('0x8')](config['redis'],{'host':_0xd734('0x9'),'port':0x18eb});socketio['adapter'](require(_0xd734('0xa'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0xd734('0xb')]();require(_0xd734('0xc'))[_0xd734('0xb')](socketio);require('../../config/express')[_0xd734('0xb')](app);require('../../routes')[_0xd734('0xb')](app);}else{server[_0xd734('0xd')](_0xd734('0xe'),function(){console[_0xd734('0xf')](_0xd734('0x10'),config[_0xd734('0x5')]);});}exports=module[_0xd734('0x11')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 150b817..bef3335 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 _0x2a9c=['rpc','message','result','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2a9c,0x11b));var _0xc2a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a9c[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xc2a9('0x0'));var BPromise=require(_0xc2a9('0x1'));var logger=require(_0xc2a9('0x2'))(_0xc2a9('0x3'));var client=jayson[_0xc2a9('0x4')][_0xc2a9('0x5')]({'port':0x2329});client[_0xc2a9('0x6')]=function(_0x221442,_0x27e363){return new BPromise(function(_0x19e620,_0x5407a2){return client[_0xc2a9('0x7')](_0x221442,_0x27e363)[_0xc2a9('0x8')](function(_0x477dac){logger[_0xc2a9('0x9')]('rpc',_0xc2a9('0x3'),_0x221442,_0x27e363,_0x477dac);if(_0x477dac[_0xc2a9('0xa')]){logger[_0xc2a9('0xa')](_0xc2a9('0xb'),_0xc2a9('0x3'),_0x221442,_0x477dac['error'][_0xc2a9('0xc')],_0x27e363);return _0x5407a2(_0x477dac[_0xc2a9('0xa')]['message']);}else{return _0x19e620(_0x477dac[_0xc2a9('0xd')]);}})['catch'](function(_0x76982){logger[_0xc2a9('0xa')](_0xc2a9('0xb'),_0xc2a9('0x3'),_0x221442,_0x76982,_0x27e363);return _0x5407a2(_0x76982);});});};module['exports']=client; \ No newline at end of file +var _0xada0=['exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x52d861,_0x21f9b9){var _0x1a2023=function(_0x43d056){while(--_0x43d056){_0x52d861['push'](_0x52d861['shift']());}};_0x1a2023(++_0x21f9b9);}(_0xada0,0x7f));var _0x0ada=function(_0x14712a,_0x167eb7){_0x14712a=_0x14712a-0x0;var _0x2e4585=_0xada0[_0x14712a];return _0x2e4585;};'use strict';var jayson=require(_0x0ada('0x0'));var BPromise=require(_0x0ada('0x1'));var logger=require('../../config/logger')(_0x0ada('0x2'));var client=jayson[_0x0ada('0x3')][_0x0ada('0x4')]({'port':0x2329});client[_0x0ada('0x5')]=function(_0x262bb7,_0x15f2c5){return new BPromise(function(_0x31bb02,_0x4ac9f3){return client[_0x0ada('0x6')](_0x262bb7,_0x15f2c5)[_0x0ada('0x7')](function(_0x55a731){logger[_0x0ada('0x8')](_0x0ada('0x9'),_0x0ada('0x2'),_0x262bb7,_0x15f2c5,_0x55a731);if(_0x55a731[_0x0ada('0xa')]){logger[_0x0ada('0xa')]('rpc',_0x0ada('0x2'),_0x262bb7,_0x55a731[_0x0ada('0xa')]['message'],_0x15f2c5);return _0x4ac9f3(_0x55a731[_0x0ada('0xa')][_0x0ada('0xb')]);}else{return _0x31bb02(_0x55a731[_0x0ada('0xc')]);}})['catch'](function(_0xbf5718){logger[_0x0ada('0xa')](_0x0ada('0x9'),_0x0ada('0x2'),_0x262bb7,_0xbf5718,_0x15f2c5);return _0x4ac9f3(_0xbf5718);});});};module[_0x0ada('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 40b127c..dc2a737 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 _0x65b7=['./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','bluebird'];(function(_0x29da6a,_0x8328b9){var _0x5d1295=function(_0x24ad9e){while(--_0x24ad9e){_0x29da6a['push'](_0x29da6a['shift']());}};_0x5d1295(++_0x8328b9);}(_0x65b7,0x1b2));var _0x765b=function(_0x1a3084,_0x1f2db9){_0x1a3084=_0x1a3084-0x0;var _0x57e3d1=_0x65b7[_0x1a3084];return _0x57e3d1;};'use strict';var BPromise=require(_0x765b('0x0'));var server=require(_0x765b('0x1'));var Realtime=require(_0x765b('0x2'));var user=require(_0x765b('0x3'));var interval=require(_0x765b('0x4'));var openchannelQueue=require(_0x765b('0x5'));var chatQueue=require(_0x765b('0x6'));var smsQueue=require(_0x765b('0x7'));var mailQueue=require(_0x765b('0x8'));var faxQueue=require(_0x765b('0x9'));var whatsappQueue=require(_0x765b('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x765b('0xb')]()['then'](user[_0x765b('0xc')]())[_0x765b('0xd')](realtime[_0x765b('0xe')]())[_0x765b('0xd')](interval[_0x765b('0xf')]())[_0x765b('0xd')](realtime[_0x765b('0x10')]())[_0x765b('0xd')](openchannelQueue[_0x765b('0x11')]())[_0x765b('0xd')](realtime[_0x765b('0x12')]())[_0x765b('0xd')](chatQueue[_0x765b('0x13')]())[_0x765b('0xd')](realtime[_0x765b('0x14')]())['then'](smsQueue[_0x765b('0x15')]())[_0x765b('0xd')](realtime['initSmsQueues']())[_0x765b('0xd')](mailQueue[_0x765b('0x16')]())['then'](realtime[_0x765b('0x17')]())[_0x765b('0xd')](faxQueue[_0x765b('0x18')]())[_0x765b('0xd')](realtime[_0x765b('0x19')]())[_0x765b('0xd')](whatsappQueue[_0x765b('0x1a')]())[_0x765b('0xd')](realtime['initWhatsappQueues']())[_0x765b('0xd')](function(){return realtime;});}function main(){return server[_0x765b('0x1b')](realtime)[_0x765b('0xd')](function(_0x4a3bea){return initRealtime();})[_0x765b('0xd')](function(_0x416cef){return setInterval(initRealtime,0x1388);})[_0x765b('0x1c')](function(_0x2ab0e8){console['log'](_0x2ab0e8);});}main(); \ No newline at end of file +var _0x9896=['./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9896,0x192));var _0x6989=function(_0x128a05,_0x330b0c){_0x128a05=_0x128a05-0x0;var _0xbb9bd5=_0x9896[_0x128a05];return _0xbb9bd5;};'use strict';var BPromise=require('bluebird');var server=require(_0x6989('0x0'));var Realtime=require(_0x6989('0x1'));var user=require(_0x6989('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x6989('0x3'));var chatQueue=require(_0x6989('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x6989('0x5'));var faxQueue=require(_0x6989('0x6'));var whatsappQueue=require(_0x6989('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x6989('0x8')]()[_0x6989('0x9')](user[_0x6989('0xa')]())[_0x6989('0x9')](realtime[_0x6989('0xb')]())[_0x6989('0x9')](interval['getIntervals']())[_0x6989('0x9')](realtime[_0x6989('0xc')]())[_0x6989('0x9')](openchannelQueue[_0x6989('0xd')]())[_0x6989('0x9')](realtime['initOpenchannelQueues']())[_0x6989('0x9')](chatQueue['getChatQueues']())[_0x6989('0x9')](realtime[_0x6989('0xe')]())['then'](smsQueue[_0x6989('0xf')]())['then'](realtime['initSmsQueues']())[_0x6989('0x9')](mailQueue[_0x6989('0x10')]())['then'](realtime[_0x6989('0x11')]())[_0x6989('0x9')](faxQueue[_0x6989('0x12')]())['then'](realtime[_0x6989('0x13')]())[_0x6989('0x9')](whatsappQueue['getWhatsappQueues']())[_0x6989('0x9')](realtime[_0x6989('0x14')]())[_0x6989('0x9')](function(){return realtime;});}function main(){return server[_0x6989('0x15')](realtime)[_0x6989('0x9')](function(_0x5f248f){return initRealtime();})[_0x6989('0x9')](function(_0x119bef){return setInterval(initRealtime,0x1388);})[_0x6989('0x16')](function(_0x1b173b){console[_0x6989('0x17')](_0x1b173b);});}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 5a7e27d..493da7b 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x215da6,_0x38b200){var _0xfb0853=function(_0x1ab8ba){while(--_0x1ab8ba){_0x215da6['push'](_0x215da6['shift']());}};_0xfb0853(++_0x38b200);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x4e965e,_0x497325){var _0xd82ce2=function(_0x90d75b){while(--_0x90d75b){_0x4e965e['push'](_0x4e965e['shift']());}};_0xd82ce2(++_0x497325);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c0d8be8..8c8c07f 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 _0xa623=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x38ae9c,_0x29a447){var _0x265a50=function(_0x272629){while(--_0x272629){_0x38ae9c['push'](_0x38ae9c['shift']());}};_0x265a50(++_0x29a447);}(_0xa623,0x12c));var _0x3a62=function(_0x315143,_0x8dde2f){_0x315143=_0x315143-0x0;var _0x11966a=_0xa623[_0x315143];return _0x11966a;};'use strict';var BPromise=require(_0x3a62('0x0'));var jayson=require(_0x3a62('0x1'));var client=jayson[_0x3a62('0x2')][_0x3a62('0x3')]({'port':0x232b});function request(_0x4dec59,_0xff6803){return new BPromise(function(_0x76df52,_0x1cdd16){return client['request'](_0x4dec59,_0xff6803)['then'](function(_0x3a0ea6){if(_0x3a0ea6['error']){return _0x1cdd16(_0x3a0ea6['error']['message']);}else{return _0x76df52(_0x3a0ea6[_0x3a62('0x4')]);}})[_0x3a62('0x5')](function(_0x4f9aed){return _0x1cdd16(_0x4f9aed);});});}exports[_0x3a62('0x6')]=function(_0x3b85bc,_0x208221){return request(_0x3a62('0x7'),{'account':_0x3b85bc,'message':_0x208221});}; \ No newline at end of file +var _0x5618=['jayson/promise','client','http','request','error','result','sendMailMessage'];(function(_0x33bed4,_0x2b5797){var _0x1b4b05=function(_0x57af4d){while(--_0x57af4d){_0x33bed4['push'](_0x33bed4['shift']());}};_0x1b4b05(++_0x2b5797);}(_0x5618,0x181));var _0x8561=function(_0x261934,_0x2edfd8){_0x261934=_0x261934-0x0;var _0x456a52=_0x5618[_0x261934];return _0x456a52;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x8561('0x0'));var client=jayson[_0x8561('0x1')][_0x8561('0x2')]({'port':0x232b});function request(_0x57af24,_0xd06588){return new BPromise(function(_0x4e9669,_0xb96930){return client[_0x8561('0x3')](_0x57af24,_0xd06588)['then'](function(_0x20c423){if(_0x20c423[_0x8561('0x4')]){return _0xb96930(_0x20c423['error']['message']);}else{return _0x4e9669(_0x20c423[_0x8561('0x5')]);}})['catch'](function(_0x1a8e8e){return _0xb96930(_0x1a8e8e);});});}exports[_0x8561('0x6')]=function(_0x217dac,_0x4b2632){return request('SendMail',{'account':_0x217dac,'message':_0x4b2632});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 645f713..b02c406 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 _0x0f6c=['openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','mail','chat','openchannel','sms','whatsapp','length','StatusTime','toNumber','format','mailStatusTime','faxStatus','faxStatusTime','openchannelStatus','openchannelStatusTime','stringify','emit','user:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause'];(function(_0x2ce05,_0x306b52){var _0x1c6341=function(_0x512eca){while(--_0x512eca){_0x2ce05['push'](_0x2ce05['shift']());}};_0x1c6341(++_0x306b52);}(_0x0f6c,0xe1));var _0xc0f6=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0f6c[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xc0f6('0x0'));var moment=require('moment');var md5=require(_0xc0f6('0x1'));var Redis=require(_0xc0f6('0x2'));var config=require(_0xc0f6('0x3'));config[_0xc0f6('0x4')]=_[_0xc0f6('0x5')](config[_0xc0f6('0x4')],{'host':_0xc0f6('0x6'),'port':0x18eb});var io=require(_0xc0f6('0x7'))(new Redis(config[_0xc0f6('0x4')]));function Agent(_0x464dba){this['id']=_0x464dba['id']||0x0;this['name']=_0x464dba[_0xc0f6('0x8')]||'';this[_0xc0f6('0x9')]=_0x464dba['online']||!![];this[_0xc0f6('0xa')]=_0x464dba[_0xc0f6('0xa')]||![];this[_0xc0f6('0xb')]=_0x464dba['chatPause']||![];this['mailPause']=_0x464dba[_0xc0f6('0xc')]||![];this[_0xc0f6('0xd')]=_0x464dba[_0xc0f6('0xd')]||![];this[_0xc0f6('0xe')]=_0x464dba['smsPause']||![];this[_0xc0f6('0xf')]=_0x464dba['openchannelPause']||![];this[_0xc0f6('0x10')]='unknown';this[_0xc0f6('0x11')]=0x0;this[_0xc0f6('0x12')]=_0x464dba[_0xc0f6('0x12')]||0x0;this[_0xc0f6('0x13')]=0x0;this[_0xc0f6('0x14')]=_0xc0f6('0x15');this['mailStatusTime']=0x0;this['mailCapacity']=_0x464dba[_0xc0f6('0x16')]||0x0;this[_0xc0f6('0x17')]=0x0;this['faxStatus']=_0xc0f6('0x15');this['faxStatusTime']=0x0;this[_0xc0f6('0x18')]=_0x464dba[_0xc0f6('0x18')]||0x0;this[_0xc0f6('0x19')]=0x0;this[_0xc0f6('0x1a')]='unknown';this['smsStatusTime']=0x0;this[_0xc0f6('0x1b')]=_0x464dba[_0xc0f6('0x1b')]||0x0;this[_0xc0f6('0x1c')]=0x0;this[_0xc0f6('0x1d')]=_0xc0f6('0x15');this[_0xc0f6('0x1e')]=0x0;this[_0xc0f6('0x1f')]=_0x464dba[_0xc0f6('0x1f')]||0x0;this[_0xc0f6('0x20')]=0x0;this['openchannelStatus']=_0xc0f6('0x15');this['openchannelStatusTime']=0x0;this[_0xc0f6('0x21')]=_0x464dba['openchannelCapacity']||0x0;this[_0xc0f6('0x22')]=0x0;this[_0xc0f6('0x23')]=![];this[_0xc0f6('0x24')]=undefined;this[_0xc0f6('0x1')]='';this[_0xc0f6('0x25')]();}Agent[_0xc0f6('0x26')][_0xc0f6('0x27')]=function(_0x55956d){if(this[_0x55956d+_0xc0f6('0x28')]>0x0){if(this[_0x55956d+_0xc0f6('0x29')]>0x0&&this[_0x55956d+_0xc0f6('0x28')]>=this[_0x55956d+_0xc0f6('0x29')]){return'maxcapacity';}else{return _0xc0f6('0x2a');}}else{return'idle';}};Agent[_0xc0f6('0x26')][_0xc0f6('0x25')]=function(){var _0x10850e=[_0xc0f6('0x2b'),_0xc0f6('0x2c'),_0xc0f6('0x2d'),'fax',_0xc0f6('0x2e'),_0xc0f6('0x2f')];for(var _0x1421b0=0x0;_0x1421b0<_0x10850e[_0xc0f6('0x30')];_0x1421b0+=0x1){var _0x51a49d=this[_0xc0f6('0x27')](_0x10850e[_0x1421b0]);if(this[_0x10850e[_0x1421b0]+'Status']!==_0x51a49d){this[_0x10850e[_0x1421b0]+_0xc0f6('0x31')]=_[_0xc0f6('0x32')](moment()[_0xc0f6('0x33')]('x'));}this[_0x10850e[_0x1421b0]+'Status']=_0x51a49d;}var _0x4c4d88={'id':this['id'],'name':this[_0xc0f6('0x8')],'online':this[_0xc0f6('0x9')],'voicePause':this[_0xc0f6('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xc0f6('0xc')],'smsPause':this[_0xc0f6('0xe')],'faxPause':this[_0xc0f6('0xd')],'openchannelPause':this[_0xc0f6('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xc0f6('0x11')],'chatCapacity':this[_0xc0f6('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xc0f6('0x14')],'mailStatusTime':this[_0xc0f6('0x34')],'mailCapacity':this[_0xc0f6('0x16')],'mailCurrentCapacity':this[_0xc0f6('0x17')],'faxStatus':this[_0xc0f6('0x35')],'faxStatusTime':this[_0xc0f6('0x36')],'faxCapacity':this[_0xc0f6('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xc0f6('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xc0f6('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xc0f6('0x1d')],'whatsappStatusTime':this[_0xc0f6('0x1e')],'whatsappCapacity':this[_0xc0f6('0x1f')],'whatsappCurrentCapacity':this[_0xc0f6('0x20')],'openchannelStatus':this[_0xc0f6('0x37')],'openchannelStatusTime':this[_0xc0f6('0x38')],'openchannelCapacity':this[_0xc0f6('0x21')],'openchannelCurrentCapacity':this[_0xc0f6('0x22')],'busy':this['busy'],'busyQueue':this[_0xc0f6('0x24')]};var _0x13a7d7=md5(JSON[_0xc0f6('0x39')](_0x4c4d88));if(this[_0xc0f6('0x1')]!==_0x13a7d7){this[_0xc0f6('0x1')]=_0x13a7d7;io[_0xc0f6('0x3a')](_0xc0f6('0x3b'),_0x4c4d88);}};module['exports']=Agent; \ No newline at end of file +var _0xd76f=['smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailStatusTime','faxStatus','faxStatusTime','whatsappStatus','whatsappStatusTime','stringify','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0xd76f,0xe3));var _0xfd76=function(_0x44b533,_0x221c8d){_0x44b533=_0x44b533-0x0;var _0x42325b=_0xd76f[_0x44b533];return _0x42325b;};'use strict';var _=require(_0xfd76('0x0'));var moment=require('moment');var md5=require(_0xfd76('0x1'));var Redis=require(_0xfd76('0x2'));var config=require(_0xfd76('0x3'));config[_0xfd76('0x4')]=_[_0xfd76('0x5')](config['redis'],{'host':_0xfd76('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfd76('0x4')]));function Agent(_0x46f74e){this['id']=_0x46f74e['id']||0x0;this[_0xfd76('0x7')]=_0x46f74e['name']||'';this[_0xfd76('0x8')]=_0x46f74e[_0xfd76('0x8')]||!![];this[_0xfd76('0x9')]=_0x46f74e[_0xfd76('0x9')]||![];this[_0xfd76('0xa')]=_0x46f74e[_0xfd76('0xa')]||![];this['mailPause']=_0x46f74e[_0xfd76('0xb')]||![];this[_0xfd76('0xc')]=_0x46f74e['faxPause']||![];this[_0xfd76('0xd')]=_0x46f74e[_0xfd76('0xd')]||![];this['openchannelPause']=_0x46f74e[_0xfd76('0xe')]||![];this[_0xfd76('0xf')]=_0xfd76('0x10');this[_0xfd76('0x11')]=0x0;this['chatCapacity']=_0x46f74e[_0xfd76('0x12')]||0x0;this[_0xfd76('0x13')]=0x0;this[_0xfd76('0x14')]=_0xfd76('0x10');this['mailStatusTime']=0x0;this[_0xfd76('0x15')]=_0x46f74e['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xfd76('0x10');this['faxStatusTime']=0x0;this[_0xfd76('0x16')]=_0x46f74e[_0xfd76('0x16')]||0x0;this[_0xfd76('0x17')]=0x0;this[_0xfd76('0x18')]=_0xfd76('0x10');this[_0xfd76('0x19')]=0x0;this[_0xfd76('0x1a')]=_0x46f74e[_0xfd76('0x1a')]||0x0;this[_0xfd76('0x1b')]=0x0;this['whatsappStatus']=_0xfd76('0x10');this['whatsappStatusTime']=0x0;this[_0xfd76('0x1c')]=_0x46f74e[_0xfd76('0x1c')]||0x0;this[_0xfd76('0x1d')]=0x0;this[_0xfd76('0x1e')]=_0xfd76('0x10');this[_0xfd76('0x1f')]=0x0;this['openchannelCapacity']=_0x46f74e[_0xfd76('0x20')]||0x0;this[_0xfd76('0x21')]=0x0;this[_0xfd76('0x22')]=![];this['busyQueue']=undefined;this[_0xfd76('0x1')]='';this[_0xfd76('0x23')]();}Agent[_0xfd76('0x24')][_0xfd76('0x25')]=function(_0x27fe20){if(this[_0x27fe20+_0xfd76('0x26')]>0x0){if(this[_0x27fe20+_0xfd76('0x27')]>0x0&&this[_0x27fe20+_0xfd76('0x26')]>=this[_0x27fe20+'Capacity']){return _0xfd76('0x28');}else{return'working';}}else{return _0xfd76('0x29');}};Agent['prototype'][_0xfd76('0x23')]=function(){var _0x51bf76=[_0xfd76('0x2a'),_0xfd76('0x2b'),'openchannel',_0xfd76('0x2c'),_0xfd76('0x2d'),_0xfd76('0x2e')];for(var _0x11c45b=0x0;_0x11c45b<_0x51bf76[_0xfd76('0x2f')];_0x11c45b+=0x1){var _0x4954bd=this[_0xfd76('0x25')](_0x51bf76[_0x11c45b]);if(this[_0x51bf76[_0x11c45b]+_0xfd76('0x30')]!==_0x4954bd){this[_0x51bf76[_0x11c45b]+_0xfd76('0x31')]=_[_0xfd76('0x32')](moment()[_0xfd76('0x33')]('x'));}this[_0x51bf76[_0x11c45b]+_0xfd76('0x30')]=_0x4954bd;}var _0x50e6d4={'id':this['id'],'name':this[_0xfd76('0x7')],'online':this['online'],'voicePause':this[_0xfd76('0x9')],'chatPause':this[_0xfd76('0xa')],'mailPause':this[_0xfd76('0xb')],'smsPause':this[_0xfd76('0xd')],'faxPause':this[_0xfd76('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xfd76('0xf')],'chatStatusTime':this[_0xfd76('0x11')],'chatCapacity':this[_0xfd76('0x12')],'chatCurrentCapacity':this[_0xfd76('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xfd76('0x34')],'mailCapacity':this[_0xfd76('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xfd76('0x35')],'faxStatusTime':this[_0xfd76('0x36')],'faxCapacity':this[_0xfd76('0x16')],'faxCurrentCapacity':this[_0xfd76('0x17')],'smsStatus':this[_0xfd76('0x18')],'smsStatusTime':this[_0xfd76('0x19')],'smsCapacity':this[_0xfd76('0x1a')],'smsCurrentCapacity':this[_0xfd76('0x1b')],'whatsappStatus':this[_0xfd76('0x37')],'whatsappStatusTime':this[_0xfd76('0x38')],'whatsappCapacity':this[_0xfd76('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xfd76('0x1f')],'openchannelCapacity':this[_0xfd76('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xfd76('0x22')],'busyQueue':this['busyQueue']};var _0x5de184=md5(JSON[_0xfd76('0x39')](_0x50e6d4));if(this[_0xfd76('0x1')]!==_0x5de184){this[_0xfd76('0x1')]=_0x5de184;io[_0xfd76('0x3a')]('user:save',_0x50e6d4);}};module[_0xfd76('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 35c67f8..bdab1ea 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 _0x3797=['online','chatPause','paused','available','stringify','format','chat:queue:%s','emit','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length'];(function(_0x289837,_0x492605){var _0x243004=function(_0x548f3f){while(--_0x548f3f){_0x289837['push'](_0x289837['shift']());}};_0x243004(++_0x492605);}(_0x3797,0xc2));var _0x7379=function(_0x55cec3,_0x2babdc){_0x55cec3=_0x55cec3-0x0;var _0x1e8a4a=_0x3797[_0x55cec3];return _0x1e8a4a;};'use strict';var _=require(_0x7379('0x0'));var md5=require('md5');var util=require(_0x7379('0x1'));var Redis=require(_0x7379('0x2'));var config=require(_0x7379('0x3'));config['redis']=_[_0x7379('0x4')](config[_0x7379('0x5')],{'host':_0x7379('0x6'),'port':0x18eb});var io=require(_0x7379('0x7'))(new Redis(config[_0x7379('0x5')]));function ChatQueue(_0x517735){this['id']=_0x517735['id']||0x0;this['name']=_0x517735[_0x7379('0x8')]||'';this[_0x7379('0x9')]=_0x517735[_0x7379('0x9')]||0xa;this[_0x7379('0xa')]=_0x517735[_0x7379('0xa')]||_0x7379('0xb');this[_0x7379('0xc')]=_0x517735[_0x7379('0xc')];this[_0x7379('0xd')]={};this[_0x7379('0xe')]=0x0;this[_0x7379('0xf')]='';this[_0x7379('0x10')]();this[_0x7379('0x11')]();}ChatQueue[_0x7379('0x12')]['updateRouting']=function(){var _0x3734b8=this[_0x7379('0xd')][_0x7379('0x13')];this[_0x7379('0xd')]=_[_0x7379('0x14')](this['Agents'],'id');this[_0x7379('0xd')][_0x7379('0x13')]=_0x3734b8;};ChatQueue['prototype'][_0x7379('0x11')]=function(){this[_0x7379('0x15')]=0x0;this['paused']=0x0;for(var _0x3253eb=0x0;_0x3253eb=0x0?this['available']:0x0;var _0x5f2d81={'id':this['id'],'available':this[_0x7379('0x1a')],'loggedIn':this['loggedIn'],'name':this[_0x7379('0x8')],'paused':this[_0x7379('0x19')],'waiting':this[_0x7379('0xe')]};var _0x1b717e=md5(JSON[_0x7379('0x1b')](_0x5f2d81));if(this['md5']!==_0x1b717e){this[_0x7379('0xf')]=_0x1b717e;io['to'](util[_0x7379('0x1c')](_0x7379('0x1d'),_0x5f2d81[_0x7379('0x8')]))[_0x7379('0x1e')]('chat_queue:save',_0x5f2d81);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x690b=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x2c1e7b,_0x360b5e){var _0x5e19ac=function(_0x192cb7){while(--_0x192cb7){_0x2c1e7b['push'](_0x2c1e7b['shift']());}};_0x5e19ac(++_0x360b5e);}(_0x690b,0x8b));var _0xb690=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x690b[_0x9d14e3];return _0x19bf32;};'use strict';var _=require(_0xb690('0x0'));var md5=require(_0xb690('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xb690('0x2'));config[_0xb690('0x3')]=_[_0xb690('0x4')](config[_0xb690('0x3')],{'host':_0xb690('0x5'),'port':0x18eb});var io=require(_0xb690('0x6'))(new Redis(config[_0xb690('0x3')]));function ChatQueue(_0x3a2469){this['id']=_0x3a2469['id']||0x0;this[_0xb690('0x7')]=_0x3a2469[_0xb690('0x7')]||'';this[_0xb690('0x8')]=_0x3a2469[_0xb690('0x8')]||0xa;this[_0xb690('0x9')]=_0x3a2469[_0xb690('0x9')]||_0xb690('0xa');this[_0xb690('0xb')]=_0x3a2469[_0xb690('0xb')];this[_0xb690('0xc')]={};this[_0xb690('0xd')]=0x0;this[_0xb690('0x1')]='';this[_0xb690('0xe')]();this[_0xb690('0xf')]();}ChatQueue[_0xb690('0x10')][_0xb690('0xe')]=function(){var _0x2f652f=this[_0xb690('0xc')][_0xb690('0x11')];this[_0xb690('0xc')]=_[_0xb690('0x12')](this[_0xb690('0xb')],'id');this[_0xb690('0xc')]['_rr']=_0x2f652f;};ChatQueue[_0xb690('0x10')][_0xb690('0xf')]=function(){this[_0xb690('0x13')]=0x0;this[_0xb690('0x14')]=0x0;for(var _0x586064=0x0;_0x586064=0x0?this[_0xb690('0x18')]:0x0;var _0x33d625={'id':this['id'],'available':this[_0xb690('0x18')],'loggedIn':this[_0xb690('0x13')],'name':this[_0xb690('0x7')],'paused':this[_0xb690('0x14')],'waiting':this[_0xb690('0xd')]};var _0x43d1f6=md5(JSON[_0xb690('0x19')](_0x33d625));if(this[_0xb690('0x1')]!==_0x43d1f6){this[_0xb690('0x1')]=_0x43d1f6;io['to'](util[_0xb690('0x1a')]('chat:queue:%s',_0x33d625[_0xb690('0x7')]))[_0xb690('0x1b')](_0xb690('0x1c'),_0x33d625);}};module[_0xb690('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6083491..2725843 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 _0xf1fb=['mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','faxPause','available','waiting','format','fax:queue:%s','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x3b584b,_0x39dc34){var _0x38559d=function(_0x2cbf9e){while(--_0x2cbf9e){_0x3b584b['push'](_0x3b584b['shift']());}};_0x38559d(++_0x39dc34);}(_0xf1fb,0xa9));var _0xbf1f=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xf1fb[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xbf1f('0x0'));var md5=require(_0xbf1f('0x1'));var util=require(_0xbf1f('0x2'));var Redis=require(_0xbf1f('0x3'));var config=require(_0xbf1f('0x4'));config['redis']=_[_0xbf1f('0x5')](config[_0xbf1f('0x6')],{'host':_0xbf1f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x45642){this['id']=_0x45642['id']||0x0;this[_0xbf1f('0x8')]=_0x45642[_0xbf1f('0x8')]||'';this[_0xbf1f('0x9')]=_0x45642['timeout']||0xa;this[_0xbf1f('0xa')]=_0x45642[_0xbf1f('0xa')]||_0xbf1f('0xb');this[_0xbf1f('0xc')]=_0x45642[_0xbf1f('0xc')];this[_0xbf1f('0xd')]={};this['waiting']=0x0;this[_0xbf1f('0x1')]='';this[_0xbf1f('0xe')]();this[_0xbf1f('0xf')]();}FaxQueue[_0xbf1f('0x10')][_0xbf1f('0xe')]=function(){var _0x384156=this[_0xbf1f('0xd')][_0xbf1f('0x11')];this[_0xbf1f('0xd')]=_[_0xbf1f('0x12')](this[_0xbf1f('0xc')],'id');this[_0xbf1f('0xd')][_0xbf1f('0x11')]=_0x384156;};FaxQueue[_0xbf1f('0x10')][_0xbf1f('0xf')]=function(){this[_0xbf1f('0x13')]=0x0;this[_0xbf1f('0x14')]=0x0;for(var _0x315fb3=0x0;_0x315fb3=0x0?this['available']:0x0;var _0x2672ba={'id':this['id'],'available':this[_0xbf1f('0x16')],'loggedIn':this[_0xbf1f('0x13')],'name':this[_0xbf1f('0x8')],'paused':this[_0xbf1f('0x14')],'waiting':this[_0xbf1f('0x17')]};var _0x236699=md5(JSON['stringify'](_0x2672ba));if(this[_0xbf1f('0x1')]!==_0x236699){this[_0xbf1f('0x1')]=_0x236699;io['to'](util[_0xbf1f('0x18')](_0xbf1f('0x19'),_0x2672ba[_0xbf1f('0x8')]))['emit']('fax_queue:save',_0x2672ba);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x0c22=['name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x253319,_0x10aedf){var _0x2623ed=function(_0x5e6abb){while(--_0x5e6abb){_0x253319['push'](_0x253319['shift']());}};_0x2623ed(++_0x10aedf);}(_0x0c22,0xa1));var _0x20c2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0c22[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x20c2('0x0'));var Redis=require(_0x20c2('0x1'));var config=require(_0x20c2('0x2'));config[_0x20c2('0x3')]=_[_0x20c2('0x4')](config[_0x20c2('0x3')],{'host':_0x20c2('0x5'),'port':0x18eb});var io=require(_0x20c2('0x6'))(new Redis(config[_0x20c2('0x3')]));function FaxQueue(_0x4ab48e){this['id']=_0x4ab48e['id']||0x0;this[_0x20c2('0x7')]=_0x4ab48e[_0x20c2('0x7')]||'';this[_0x20c2('0x8')]=_0x4ab48e[_0x20c2('0x8')]||0xa;this[_0x20c2('0x9')]=_0x4ab48e[_0x20c2('0x9')]||'beepall';this[_0x20c2('0xa')]=_0x4ab48e[_0x20c2('0xa')];this['mapAgentsId']={};this[_0x20c2('0xb')]=0x0;this[_0x20c2('0xc')]='';this[_0x20c2('0xd')]();this[_0x20c2('0xe')]();}FaxQueue[_0x20c2('0xf')][_0x20c2('0xd')]=function(){var _0x31482d=this[_0x20c2('0x10')][_0x20c2('0x11')];this[_0x20c2('0x10')]=_[_0x20c2('0x12')](this[_0x20c2('0xa')],'id');this['mapAgentsId'][_0x20c2('0x11')]=_0x31482d;};FaxQueue[_0x20c2('0xf')][_0x20c2('0xe')]=function(){this[_0x20c2('0x13')]=0x0;this[_0x20c2('0x14')]=0x0;for(var _0x1fe537=0x0;_0x1fe537=0x0?this[_0x20c2('0x18')]:0x0;var _0x5fd419={'id':this['id'],'available':this[_0x20c2('0x18')],'loggedIn':this[_0x20c2('0x13')],'name':this['name'],'paused':this[_0x20c2('0x14')],'waiting':this[_0x20c2('0xb')]};var _0x1bda2f=md5(JSON[_0x20c2('0x19')](_0x5fd419));if(this[_0x20c2('0xc')]!==_0x1bda2f){this[_0x20c2('0xc')]=_0x1bda2f;io['to'](util[_0x20c2('0x1a')]('fax:queue:%s',_0x5fd419[_0x20c2('0x7')]))['emit']('fax_queue:save',_0x5fd419);}};module[_0x20c2('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 3b5ccde..32bfad3 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 _0xa682=['name','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa682,0xfe));var _0x2a68=function(_0x515502,_0x3549fd){_0x515502=_0x515502-0x0;var _0x2501df=_0xa682[_0x515502];return _0x2501df;};'use strict';function Interval(_0x5b9b31){this['id']=_0x5b9b31['id']||0x0;this[_0x2a68('0x0')]=_0x5b9b31['name']||'';this[_0x2a68('0x1')]=_0x5b9b31['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x40e9=['name','Intervals','exports'];(function(_0x5bca8f,_0x1683d5){var _0x20fd20=function(_0x3aa967){while(--_0x3aa967){_0x5bca8f['push'](_0x5bca8f['shift']());}};_0x20fd20(++_0x1683d5);}(_0x40e9,0xcc));var _0x940e=function(_0x2ad561,_0x5e58b0){_0x2ad561=_0x2ad561-0x0;var _0x2d9700=_0x40e9[_0x2ad561];return _0x2d9700;};'use strict';function Interval(_0x198884){this['id']=_0x198884['id']||0x0;this[_0x940e('0x0')]=_0x198884[_0x940e('0x0')]||'';this[_0x940e('0x1')]=_0x198884[_0x940e('0x1')]||{};}module[_0x940e('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 b576e82..63e88ae 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 _0xa7b5=['mailPause','available','mail:queue:%s','emit','mail_queue:save','lodash','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','prototype','paused','online','loggedIn'];(function(_0x3c53de,_0x3f9ff4){var _0xa7d2ea=function(_0x54372f){while(--_0x54372f){_0x3c53de['push'](_0x3c53de['shift']());}};_0xa7d2ea(++_0x3f9ff4);}(_0xa7b5,0xa1));var _0x5a7b=function(_0x5e3691,_0x2b8a33){_0x5e3691=_0x5e3691-0x0;var _0x53c1d1=_0xa7b5[_0x5e3691];return _0x53c1d1;};'use strict';var _=require(_0x5a7b('0x0'));var md5=require('md5');var util=require(_0x5a7b('0x1'));var Redis=require('ioredis');var config=require(_0x5a7b('0x2'));config['redis']=_[_0x5a7b('0x3')](config[_0x5a7b('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5a7b('0x5'))(new Redis(config[_0x5a7b('0x4')]));function MailQueue(_0x56972b){this['id']=_0x56972b['id']||0x0;this[_0x5a7b('0x6')]=_0x56972b[_0x5a7b('0x6')]||'';this[_0x5a7b('0x7')]=_0x56972b['timeout']||0xa;this[_0x5a7b('0x8')]=_0x56972b[_0x5a7b('0x8')]||_0x5a7b('0x9');this[_0x5a7b('0xa')]=_0x56972b[_0x5a7b('0xa')];this[_0x5a7b('0xb')]={};this[_0x5a7b('0xc')]=0x0;this[_0x5a7b('0xd')]='';this[_0x5a7b('0xe')]();this[_0x5a7b('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0xcce605=this[_0x5a7b('0xb')][_0x5a7b('0x10')];this[_0x5a7b('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x5a7b('0x10')]=_0xcce605;};MailQueue[_0x5a7b('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x5a7b('0x12')]=0x0;for(var _0x49c102=0x0;_0x49c102=0x0?this[_0x5a7b('0x16')]:0x0;var _0x39be80={'id':this['id'],'available':this[_0x5a7b('0x16')],'loggedIn':this[_0x5a7b('0x14')],'name':this[_0x5a7b('0x6')],'paused':this[_0x5a7b('0x12')],'waiting':this['waiting']};var _0x1e2e35=md5(JSON['stringify'](_0x39be80));if(this[_0x5a7b('0xd')]!==_0x1e2e35){this[_0x5a7b('0xd')]=_0x1e2e35;io['to'](util['format'](_0x5a7b('0x17'),_0x39be80[_0x5a7b('0x6')]))[_0x5a7b('0x18')](_0x5a7b('0x19'),_0x39be80);}};module['exports']=MailQueue; \ No newline at end of file +var _0x7aae=['emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','online','mailPause','paused','available','waiting','mail:queue:%s'];(function(_0x29ea28,_0x460a3c){var _0x1be8ba=function(_0x16fe0b){while(--_0x16fe0b){_0x29ea28['push'](_0x29ea28['shift']());}};_0x1be8ba(++_0x460a3c);}(_0x7aae,0x193));var _0xe7aa=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7aae[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe7aa('0x0'));var md5=require(_0xe7aa('0x1'));var util=require('util');var Redis=require(_0xe7aa('0x2'));var config=require(_0xe7aa('0x3'));config[_0xe7aa('0x4')]=_['defaults'](config[_0xe7aa('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe7aa('0x4')]));function MailQueue(_0x2cc3a7){this['id']=_0x2cc3a7['id']||0x0;this[_0xe7aa('0x5')]=_0x2cc3a7[_0xe7aa('0x5')]||'';this[_0xe7aa('0x6')]=_0x2cc3a7[_0xe7aa('0x6')]||0xa;this['strategy']=_0x2cc3a7[_0xe7aa('0x7')]||'beepall';this[_0xe7aa('0x8')]=_0x2cc3a7['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xe7aa('0x1')]='';this[_0xe7aa('0x9')]();this[_0xe7aa('0xa')]();}MailQueue[_0xe7aa('0xb')][_0xe7aa('0x9')]=function(){var _0x2faa93=this[_0xe7aa('0xc')][_0xe7aa('0xd')];this[_0xe7aa('0xc')]=_[_0xe7aa('0xe')](this[_0xe7aa('0x8')],'id');this['mapAgentsId'][_0xe7aa('0xd')]=_0x2faa93;};MailQueue[_0xe7aa('0xb')][_0xe7aa('0xa')]=function(){this[_0xe7aa('0xf')]=0x0;this['paused']=0x0;for(var _0xeeef82=0x0;_0xeeef82=0x0?this[_0xe7aa('0x13')]:0x0;var _0x3fe6cb={'id':this['id'],'available':this[_0xe7aa('0x13')],'loggedIn':this[_0xe7aa('0xf')],'name':this[_0xe7aa('0x5')],'paused':this['paused'],'waiting':this[_0xe7aa('0x14')]};var _0x390601=md5(JSON['stringify'](_0x3fe6cb));if(this[_0xe7aa('0x1')]!==_0x390601){this[_0xe7aa('0x1')]=_0x390601;io['to'](util['format'](_0xe7aa('0x15'),_0x3fe6cb[_0xe7aa('0x5')]))[_0xe7aa('0x16')](_0xe7aa('0x17'),_0x3fe6cb);}};module[_0xe7aa('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 01f8461..9914bd3 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x280d1c,_0x265fe1){var _0x56148f=function(_0x4a8c55){while(--_0x4a8c55){_0x280d1c['push'](_0x280d1c['shift']());}};_0x56148f(++_0x265fe1);}(_0x814b,0x1a2));var _0xb814=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x814b[_0x24697b];return _0x585b99;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x36103d,_0x3453b9){var _0x4edadd=function(_0x1b6e64){while(--_0x1b6e64){_0x36103d['push'](_0x36103d['shift']());}};_0x4edadd(++_0x3453b9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x5fc3[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index da267c9..c03cfa8 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 _0x207d=['waiting','updateRouting','mapAgentsId','_rr','prototype','updateRealtime','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0x207d,0x10d));var _0xd207=function(_0x5d0ddf,_0x1b6fdb){_0x5d0ddf=_0x5d0ddf-0x0;var _0x2c6c33=_0x207d[_0x5d0ddf];return _0x2c6c33;};'use strict';var _=require(_0xd207('0x0'));var md5=require(_0xd207('0x1'));var util=require(_0xd207('0x2'));var Redis=require(_0xd207('0x3'));var config=require('../../../config/environment');config[_0xd207('0x4')]=_['defaults'](config[_0xd207('0x4')],{'host':_0xd207('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd207('0x4')]));function SmsQueue(_0x47386f){this['id']=_0x47386f['id']||0x0;this[_0xd207('0x6')]=_0x47386f[_0xd207('0x6')]||'';this[_0xd207('0x7')]=_0x47386f[_0xd207('0x7')]||0xa;this[_0xd207('0x8')]=_0x47386f[_0xd207('0x8')]||_0xd207('0x9');this[_0xd207('0xa')]=_0x47386f[_0xd207('0xa')];this['mapAgentsId']={};this[_0xd207('0xb')]=0x0;this[_0xd207('0x1')]='';this[_0xd207('0xc')]();this['updateRealtime']();}SmsQueue['prototype'][_0xd207('0xc')]=function(){var _0x260dfd=this[_0xd207('0xd')]['_rr'];this[_0xd207('0xd')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xd207('0xe')]=_0x260dfd;};SmsQueue[_0xd207('0xf')][_0xd207('0x10')]=function(){this[_0xd207('0x11')]=0x0;this[_0xd207('0x12')]=0x0;for(var _0x450adf=0x0;_0x450adf=0x0?this[_0xd207('0x15')]:0x0;var _0x3e7e60={'id':this['id'],'available':this[_0xd207('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xd207('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x6b7fbd=md5(JSON[_0xd207('0x16')](_0x3e7e60));if(this[_0xd207('0x1')]!==_0x6b7fbd){this[_0xd207('0x1')]=_0x6b7fbd;io['to'](util[_0xd207('0x17')](_0xd207('0x18'),_0x3e7e60[_0xd207('0x6')]))[_0xd207('0x19')](_0xd207('0x1a'),_0x3e7e60);}};module[_0xd207('0x1b')]=SmsQueue; \ No newline at end of file +var _0xc368=['emit','sms_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','waiting','stringify','format','sms:queue:%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc368,0x7b));var _0x8c36=function(_0x30d91a,_0x413e3f){_0x30d91a=_0x30d91a-0x0;var _0xd8e872=_0xc368[_0x30d91a];return _0xd8e872;};'use strict';var _=require('lodash');var md5=require(_0x8c36('0x0'));var util=require('util');var Redis=require(_0x8c36('0x1'));var config=require(_0x8c36('0x2'));config[_0x8c36('0x3')]=_[_0x8c36('0x4')](config[_0x8c36('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8c36('0x5'))(new Redis(config[_0x8c36('0x3')]));function SmsQueue(_0x912acb){this['id']=_0x912acb['id']||0x0;this[_0x8c36('0x6')]=_0x912acb['name']||'';this['timeout']=_0x912acb[_0x8c36('0x7')]||0xa;this[_0x8c36('0x8')]=_0x912acb[_0x8c36('0x8')]||_0x8c36('0x9');this[_0x8c36('0xa')]=_0x912acb[_0x8c36('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x8c36('0xb')]();this[_0x8c36('0xc')]();}SmsQueue['prototype'][_0x8c36('0xb')]=function(){var _0x1c49a0=this[_0x8c36('0xd')][_0x8c36('0xe')];this[_0x8c36('0xd')]=_[_0x8c36('0xf')](this[_0x8c36('0xa')],'id');this[_0x8c36('0xd')][_0x8c36('0xe')]=_0x1c49a0;};SmsQueue[_0x8c36('0x10')][_0x8c36('0xc')]=function(){this[_0x8c36('0x11')]=0x0;this[_0x8c36('0x12')]=0x0;for(var _0x220f18=0x0;_0x220f18=0x0?this[_0x8c36('0x16')]:0x0;var _0x46ae6e={'id':this['id'],'available':this[_0x8c36('0x16')],'loggedIn':this[_0x8c36('0x11')],'name':this[_0x8c36('0x6')],'paused':this['paused'],'waiting':this[_0x8c36('0x17')]};var _0x409de0=md5(JSON[_0x8c36('0x18')](_0x46ae6e));if(this[_0x8c36('0x0')]!==_0x409de0){this[_0x8c36('0x0')]=_0x409de0;io['to'](util[_0x8c36('0x19')](_0x8c36('0x1a'),_0x46ae6e[_0x8c36('0x6')]))[_0x8c36('0x1b')](_0x8c36('0x1c'),_0x46ae6e);}};module[_0x8c36('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7b354b7..5c703e6 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 _0x66ae=['md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x66ae,0x121));var _0xe66a=function(_0x1f5741,_0x444ae5){_0x1f5741=_0x1f5741-0x0;var _0x52fc50=_0x66ae[_0x1f5741];return _0x52fc50;};'use strict';var _=require(_0xe66a('0x0'));var md5=require(_0xe66a('0x1'));var util=require(_0xe66a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe66a('0x3')]=_[_0xe66a('0x4')](config['redis'],{'host':_0xe66a('0x5'),'port':0x18eb});var io=require(_0xe66a('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x4afe2f){this['id']=_0x4afe2f['id']||0x0;this[_0xe66a('0x7')]=_0x4afe2f[_0xe66a('0x7')]||'';this[_0xe66a('0x8')]=_0x4afe2f[_0xe66a('0x8')]||0xa;this['strategy']=_0x4afe2f['strategy']||_0xe66a('0x9');this[_0xe66a('0xa')]=_0x4afe2f['Agents'];this[_0xe66a('0xb')]={};this[_0xe66a('0xc')]=0x0;this['md5']='';this[_0xe66a('0xd')]();this[_0xe66a('0xe')]();}WhatsappQueue[_0xe66a('0xf')][_0xe66a('0xd')]=function(){var _0x47aefe=this[_0xe66a('0xb')][_0xe66a('0x10')];this[_0xe66a('0xb')]=_[_0xe66a('0x11')](this[_0xe66a('0xa')],'id');this[_0xe66a('0xb')][_0xe66a('0x10')]=_0x47aefe;};WhatsappQueue['prototype'][_0xe66a('0xe')]=function(){this[_0xe66a('0x12')]=0x0;this[_0xe66a('0x13')]=0x0;for(var _0x50b25a=0x0;_0x50b25a=0x0?this[_0xe66a('0x17')]:0x0;var _0x130b8f={'id':this['id'],'available':this[_0xe66a('0x17')],'loggedIn':this[_0xe66a('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xe66a('0xc')]};var _0x55206c=md5(JSON['stringify'](_0x130b8f));if(this[_0xe66a('0x1')]!==_0x55206c){this[_0xe66a('0x1')]=_0x55206c;io['to'](util[_0xe66a('0x18')](_0xe66a('0x19'),_0x130b8f['name']))[_0xe66a('0x1a')](_0xe66a('0x1b'),_0x130b8f);}};module[_0xe66a('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xb6d2=['length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused'];(function(_0x10bd19,_0x5d0490){var _0xbe5000=function(_0x149891){while(--_0x149891){_0x10bd19['push'](_0x10bd19['shift']());}};_0xbe5000(++_0x5d0490);}(_0xb6d2,0x1db));var _0x2b6d=function(_0x155c12,_0x140de6){_0x155c12=_0x155c12-0x0;var _0x3e6804=_0xb6d2[_0x155c12];return _0x3e6804;};'use strict';var _=require(_0x2b6d('0x0'));var md5=require(_0x2b6d('0x1'));var util=require(_0x2b6d('0x2'));var Redis=require(_0x2b6d('0x3'));var config=require(_0x2b6d('0x4'));config[_0x2b6d('0x5')]=_[_0x2b6d('0x6')](config[_0x2b6d('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2b6d('0x7'))(new Redis(config[_0x2b6d('0x5')]));function WhatsappQueue(_0x157588){this['id']=_0x157588['id']||0x0;this['name']=_0x157588[_0x2b6d('0x8')]||'';this[_0x2b6d('0x9')]=_0x157588['timeout']||0xa;this['strategy']=_0x157588[_0x2b6d('0xa')]||_0x2b6d('0xb');this[_0x2b6d('0xc')]=_0x157588['Agents'];this[_0x2b6d('0xd')]={};this[_0x2b6d('0xe')]=0x0;this['md5']='';this[_0x2b6d('0xf')]();this[_0x2b6d('0x10')]();}WhatsappQueue[_0x2b6d('0x11')][_0x2b6d('0xf')]=function(){var _0x27c19b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x2b6d('0x12')](this[_0x2b6d('0xc')],'id');this[_0x2b6d('0xd')]['_rr']=_0x27c19b;};WhatsappQueue[_0x2b6d('0x11')]['updateRealtime']=function(){this[_0x2b6d('0x13')]=0x0;this[_0x2b6d('0x14')]=0x0;for(var _0x383670=0x0;_0x383670=0x0?this['available']:0x0;var _0x10f1f8={'id':this['id'],'available':this[_0x2b6d('0x18')],'loggedIn':this[_0x2b6d('0x13')],'name':this[_0x2b6d('0x8')],'paused':this['paused'],'waiting':this[_0x2b6d('0xe')]};var _0x1dc4a9=md5(JSON[_0x2b6d('0x19')](_0x10f1f8));if(this[_0x2b6d('0x1')]!==_0x1dc4a9){this['md5']=_0x1dc4a9;io['to'](util[_0x2b6d('0x1a')](_0x2b6d('0x1b'),_0x10f1f8[_0x2b6d('0x8')]))[_0x2b6d('0x1c')](_0x2b6d('0x1d'),_0x10f1f8);}};module[_0x2b6d('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9d79588..ec24cc8 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x390a53,_0x1bd94f){var _0x27dbf3=function(_0x1baa1b){while(--_0x1baa1b){_0x390a53['push'](_0x390a53['shift']());}};_0x27dbf3(++_0x1bd94f);}(_0xb10b,0x12a));var _0xbb10=function(_0x68c4d9,_0x419b3c){_0x68c4d9=_0x68c4d9-0x0;var _0x62da93=_0xb10b[_0x68c4d9];return _0x62da93;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x578221,_0x296a5e){var _0x1bc6e8=function(_0x1c5d93){while(--_0x1c5d93){_0x578221['push'](_0x578221['shift']());}};_0x1bc6e8(++_0x296a5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x23651b,_0x5741ae){_0x23651b=_0x23651b-0x0;var _0xd5c714=_0xb10b[_0x23651b];return _0xd5c714;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 0511abd..c256994 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 _0x9e47=['AddTagsToChatInteraction','../client','update','updateChatInteraction','Request'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x9e47,0x1f0));var _0x79e4=function(_0x7964c6,_0x42e1a4){_0x7964c6=_0x7964c6-0x0;var _0x396ea8=_0x9e47[_0x7964c6];return _0x396ea8;};'use strict';var client=require(_0x79e4('0x0'));exports[_0x79e4('0x1')]=function(_0x3dec34,_0x3c74b9){return client['Request']('UpdateChatInteraction',{'body':_0x3c74b9,'options':{'where':{'id':_0x3dec34}},'log':_0x79e4('0x2')});};exports['addTags']=function(_0x266de0,_0x4f9aa2){return client[_0x79e4('0x3')](_0x79e4('0x4'),{'body':_0x4f9aa2,'options':{'where':{'id':_0x266de0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x61b5=['updateChatInteraction','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x54bb5e,_0xc9513a){var _0x2cfe75=function(_0x52ef1b){while(--_0x52ef1b){_0x54bb5e['push'](_0x54bb5e['shift']());}};_0x2cfe75(++_0xc9513a);}(_0x61b5,0x1b8));var _0x561b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61b5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x561b('0x0'));exports[_0x561b('0x1')]=function(_0x4572bc,_0x5da8de){return client[_0x561b('0x2')](_0x561b('0x3'),{'body':_0x5da8de,'options':{'where':{'id':_0x4572bc}},'log':_0x561b('0x4')});};exports['addTags']=function(_0x173b5f,_0x239d99){return client[_0x561b('0x2')](_0x561b('0x5'),{'body':_0x239d99,'options':{'where':{'id':_0x173b5f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 6453282..c0d37a7 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 _0x67ad=['createChatMessage','../client','create','Request'];(function(_0x21333e,_0x3187d3){var _0x242841=function(_0x14cbd9){while(--_0x14cbd9){_0x21333e['push'](_0x21333e['shift']());}};_0x242841(++_0x3187d3);}(_0x67ad,0x1bd));var _0xd67a=function(_0x3d4506,_0x234767){_0x3d4506=_0x3d4506-0x0;var _0x11b56b=_0x67ad[_0x3d4506];return _0x11b56b;};'use strict';var client=require(_0xd67a('0x0'));exports[_0xd67a('0x1')]=function(_0x372359){return client[_0xd67a('0x2')]('CreateChatMessage',{'body':_0x372359,'log':_0xd67a('0x3')});}; \ No newline at end of file +var _0x49a6=['Request','CreateChatMessage','createChatMessage','create'];(function(_0x4272d1,_0x5426fa){var _0x5222f8=function(_0x21d297){while(--_0x21d297){_0x4272d1['push'](_0x4272d1['shift']());}};_0x5222f8(++_0x5426fa);}(_0x49a6,0x18f));var _0x649a=function(_0x3c84aa,_0x50aeb5){_0x3c84aa=_0x3c84aa-0x0;var _0x200348=_0x49a6[_0x3c84aa];return _0x200348;};'use strict';var client=require('../client');exports[_0x649a('0x0')]=function(_0x42db4d){return client[_0x649a('0x1')](_0x649a('0x2'),{'body':_0x42db4d,'log':_0x649a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ea5ad56..55fa705 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 _0x26d1=['GetChatQueue','name','timeout','Agents','online','chatPause','getChatQueues','../client','Request'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x26d1,0x8e));var _0x126d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x26d1[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x126d('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x126d('0x1')](_0x126d('0x2'),{'options':{'raw':![],'attributes':['id',_0x126d('0x3'),_0x126d('0x4'),'strategy'],'include':[{'model':'User','as':_0x126d('0x5'),'attributes':['id','name',_0x126d('0x6'),_0x126d('0x7')]}]},'log':_0x126d('0x8')});};}; \ No newline at end of file +var _0x6753=['name','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','Agents'];(function(_0x1dddf3,_0x5bacbb){var _0x3d2212=function(_0x1323ff){while(--_0x1323ff){_0x1dddf3['push'](_0x1dddf3['shift']());}};_0x3d2212(++_0x5bacbb);}(_0x6753,0xa1));var _0x3675=function(_0x216ca7,_0x3c0349){_0x216ca7=_0x216ca7-0x0;var _0x129771=_0x6753[_0x216ca7];return _0x129771;};'use strict';var client=require(_0x3675('0x0'));exports[_0x3675('0x1')]=function(){return function(){return client[_0x3675('0x2')](_0x3675('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x3675('0x4'),_0x3675('0x5')],'include':[{'model':'User','as':_0x3675('0x6'),'attributes':['id',_0x3675('0x7'),'online','chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 48345f4..ee24e12 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 _0xd66c=['UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x466625,_0x5983a5){var _0x8bf3e2=function(_0x395e21){while(--_0x395e21){_0x466625['push'](_0x466625['shift']());}};_0x8bf3e2(++_0x5983a5);}(_0xd66c,0x106));var _0xcd66=function(_0x55e54f,_0x554624){_0x55e54f=_0x55e54f-0x0;var _0x2aa1bf=_0xd66c[_0x55e54f];return _0x2aa1bf;};'use strict';var client=require(_0xcd66('0x0'));exports['create']=function(_0x35f78b){return client[_0xcd66('0x1')](_0xcd66('0x2'),{'body':_0x35f78b,'log':_0xcd66('0x2')});};exports['update']=function(_0xeccb2d,_0x13a713){return client[_0xcd66('0x1')](_0xcd66('0x3'),{'body':_0x13a713,'options':{'where':{'uniqueid':_0xeccb2d},'order':[['id',_0xcd66('0x4')]],'limit':0x1},'log':_0xcd66('0x3')});}; \ No newline at end of file +var _0xf430=['create','CreateChatQueueReport','Request','UpdateChatQueueReport','../client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf430,0x1e4));var _0x0f43=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0xf430[_0x52bfa5];return _0x26f80b;};'use strict';var client=require(_0x0f43('0x0'));exports[_0x0f43('0x1')]=function(_0x40bcc5){return client['Request'](_0x0f43('0x2'),{'body':_0x40bcc5,'log':_0x0f43('0x2')});};exports['update']=function(_0x4e2851,_0x462c88){return client[_0x0f43('0x3')](_0x0f43('0x4'),{'body':_0x462c88,'options':{'where':{'uniqueid':_0x4e2851},'order':[['id','DESC']],'limit':0x1},'log':_0x0f43('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index f52e074..5c1de42 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x7a54,0x106));var _0x47a5=function(_0x2230e4,_0x323c00){_0x2230e4=_0x2230e4-0x0;var _0x50699c=_0x7a54[_0x2230e4];return _0x50699c;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x7a54,0x106));var _0x47a5=function(_0x50d765,_0x186fcd){_0x50d765=_0x50d765-0x0;var _0x5e334c=_0x7a54[_0x50d765];return _0x5e334c;};'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 ae4a447..8397540 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 _0x2cff=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x54e333,_0x4ba478){var _0x47279e=function(_0x8e4f0b){while(--_0x8e4f0b){_0x54e333['push'](_0x54e333['shift']());}};_0x47279e(++_0x4ba478);}(_0x2cff,0x76));var _0xf2cf=function(_0x2a5251,_0x9c7bb2){_0x2a5251=_0x2a5251-0x0;var _0x1a4a93=_0x2cff[_0x2a5251];return _0x1a4a93;};'use strict';var client=require(_0xf2cf('0x0'));exports[_0xf2cf('0x1')]=function(_0x11daa5){return client[_0xf2cf('0x2')](_0xf2cf('0x3'),{'body':_0x11daa5,'log':_0xf2cf('0x4')});}; \ No newline at end of file +var _0xeecc=['../client','CreateFaxMessage','createFaxMessage'];(function(_0x325b01,_0x189212){var _0x35b0f6=function(_0x4a0042){while(--_0x4a0042){_0x325b01['push'](_0x325b01['shift']());}};_0x35b0f6(++_0x189212);}(_0xeecc,0x1d1));var _0xceec=function(_0x584b3e,_0x401737){_0x584b3e=_0x584b3e-0x0;var _0x5ac470=_0xeecc[_0x584b3e];return _0x5ac470;};'use strict';var client=require(_0xceec('0x0'));exports['create']=function(_0x2873f8){return client['Request'](_0xceec('0x1'),{'body':_0x2873f8,'log':_0xceec('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 736e18b..4f27930 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 _0x83eb=['name','../client','getFaxQueues','Request','timeout','strategy','User'];(function(_0x55856f,_0xae44b1){var _0x1d22ba=function(_0x384d52){while(--_0x384d52){_0x55856f['push'](_0x55856f['shift']());}};_0x1d22ba(++_0xae44b1);}(_0x83eb,0x14a));var _0xb83e=function(_0x3bfe34,_0x1fc464){_0x3bfe34=_0x3bfe34-0x0;var _0x2889d0=_0x83eb[_0x3bfe34];return _0x2889d0;};'use strict';var client=require(_0xb83e('0x0'));exports[_0xb83e('0x1')]=function(){return function(){return client[_0xb83e('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0xb83e('0x3'),_0xb83e('0x4')],'include':[{'model':_0xb83e('0x5'),'as':'Agents','attributes':['id',_0xb83e('0x6'),'online','faxPause']}]},'log':_0xb83e('0x1')});};}; \ No newline at end of file +var _0xf6fb=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','strategy','User'];(function(_0x291887,_0x4a6303){var _0x42be08=function(_0x30a9f3){while(--_0x30a9f3){_0x291887['push'](_0x291887['shift']());}};_0x42be08(++_0x4a6303);}(_0xf6fb,0x107));var _0xbf6f=function(_0x28aec9,_0x12585){_0x28aec9=_0x28aec9-0x0;var _0xda2c10=_0xf6fb[_0x28aec9];return _0xda2c10;};'use strict';var client=require(_0xbf6f('0x0'));exports[_0xbf6f('0x1')]=function(){return function(){return client[_0xbf6f('0x2')](_0xbf6f('0x3'),{'options':{'raw':![],'attributes':['id',_0xbf6f('0x4'),'timeout',_0xbf6f('0x5')],'include':[{'model':_0xbf6f('0x6'),'as':'Agents','attributes':['id','name',_0xbf6f('0x7'),_0xbf6f('0x8')]}]},'log':_0xbf6f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index bd0b04e..d570224 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 _0x743f=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','DESC'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x743f,0xd3));var _0xf743=function(_0x56dde7,_0x4e17ca){_0x56dde7=_0x56dde7-0x0;var _0xe29b02=_0x743f[_0x56dde7];return _0xe29b02;};'use strict';var client=require(_0xf743('0x0'));exports[_0xf743('0x1')]=function(_0xb7c9f9){return client[_0xf743('0x2')]('CreateFaxQueueReport',{'body':_0xb7c9f9,'log':_0xf743('0x3')});};exports['update']=function(_0x3cd57c,_0x4d12e0){return client[_0xf743('0x2')]('UpdateFaxQueueReport',{'body':_0x4d12e0,'options':{'where':{'uniqueid':_0x3cd57c},'order':[['id',_0xf743('0x4')]],'limit':0x1},'log':_0xf743('0x5')});}; \ No newline at end of file +var _0xf54f=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x42b3c7,_0x332285){var _0x1699f7=function(_0x528de9){while(--_0x528de9){_0x42b3c7['push'](_0x42b3c7['shift']());}};_0x1699f7(++_0x332285);}(_0xf54f,0x1bb));var _0xff54=function(_0x52536c,_0x5989dd){_0x52536c=_0x52536c-0x0;var _0x47ef57=_0xf54f[_0x52536c];return _0x47ef57;};'use strict';var client=require('../client');exports[_0xff54('0x0')]=function(_0x4f99d5){return client[_0xff54('0x1')](_0xff54('0x2'),{'body':_0x4f99d5,'log':_0xff54('0x2')});};exports[_0xff54('0x3')]=function(_0x3e8872,_0x5550da){return client[_0xff54('0x1')](_0xff54('0x4'),{'body':_0x5550da,'options':{'where':{'uniqueid':_0x3e8872},'order':[['id',_0xff54('0x5')]],'limit':0x1},'log':_0xff54('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 76d622c..15fbe9e 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 _0x31b5=['Request','GetInterval','Interval','Intervals','name','interval','../client','getIntervals'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x31b5,0x136));var _0x531b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x31b5[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x531b('0x0'));exports[_0x531b('0x1')]=function(){return function(){return client[_0x531b('0x2')](_0x531b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x531b('0x4'),'as':_0x531b('0x5'),'attributes':['id',_0x531b('0x6'),_0x531b('0x7')]}]},'log':_0x531b('0x1')});};}; \ No newline at end of file +var _0xabd0=['getIntervals','Request','Interval','Intervals','name','interval'];(function(_0xb61433,_0x31d758){var _0x123400=function(_0x14b3db){while(--_0x14b3db){_0xb61433['push'](_0xb61433['shift']());}};_0x123400(++_0x31d758);}(_0xabd0,0xf0));var _0x0abd=function(_0xe268d6,_0x5d8806){_0xe268d6=_0xe268d6-0x0;var _0x2cc104=_0xabd0[_0xe268d6];return _0x2cc104;};'use strict';var client=require('../client');exports[_0x0abd('0x0')]=function(){return function(){return client[_0x0abd('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x0abd('0x2'),'as':_0x0abd('0x3'),'attributes':['id',_0x0abd('0x4'),_0x0abd('0x5')]}]},'log':_0x0abd('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 51b5065..1202200 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 _0x28f2=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x1b33a9,_0x1083ac){var _0x556ed8=function(_0x8dbd4b){while(--_0x8dbd4b){_0x1b33a9['push'](_0x1b33a9['shift']());}};_0x556ed8(++_0x1083ac);}(_0x28f2,0x193));var _0x228f=function(_0x11895a,_0x3db293){_0x11895a=_0x11895a-0x0;var _0x158a2b=_0x28f2[_0x11895a];return _0x158a2b;};'use strict';var client=require(_0x228f('0x0'));exports[_0x228f('0x1')]=function(_0x108337,_0x2e5e0b){return client[_0x228f('0x2')]('UpdateMailInteraction',{'body':_0x2e5e0b,'options':{'where':{'id':_0x108337}},'log':_0x228f('0x3')});};exports[_0x228f('0x4')]=function(_0x79ed5f,_0x4303c3){return client[_0x228f('0x2')](_0x228f('0x5'),{'body':_0x4303c3,'options':{'where':{'id':_0x79ed5f}},'log':_0x228f('0x6')});}; \ No newline at end of file +var _0x5464=['update','Request','updateMailInteraction','AddTagsToMailInteraction','../client'];(function(_0x297c42,_0x38f54a){var _0x3a2cdf=function(_0x556477){while(--_0x556477){_0x297c42['push'](_0x297c42['shift']());}};_0x3a2cdf(++_0x38f54a);}(_0x5464,0x15d));var _0x4546=function(_0x26faa8,_0x4fcc2d){_0x26faa8=_0x26faa8-0x0;var _0x3ec967=_0x5464[_0x26faa8];return _0x3ec967;};'use strict';var client=require(_0x4546('0x0'));exports[_0x4546('0x1')]=function(_0x159e14,_0x4f33fd){return client[_0x4546('0x2')]('UpdateMailInteraction',{'body':_0x4f33fd,'options':{'where':{'id':_0x159e14}},'log':_0x4546('0x3')});};exports['addTags']=function(_0x320c4d,_0x396a1d){return client[_0x4546('0x2')](_0x4546('0x4'),{'body':_0x396a1d,'options':{'where':{'id':_0x320c4d}},'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 f6c0977..ea567d2 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 _0x4eed=['Request','CreateMailMessage','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4eed,0xda));var _0xd4ee=function(_0x3b0ef5,_0x155352){_0x3b0ef5=_0x3b0ef5-0x0;var _0x693882=_0x4eed[_0x3b0ef5];return _0x693882;};'use strict';var client=require(_0xd4ee('0x0'));exports[_0xd4ee('0x1')]=function(_0x3c2218){return client[_0xd4ee('0x2')](_0xd4ee('0x3'),{'body':_0x3c2218,'log':'createMailMessage'});}; \ No newline at end of file +var _0xe8f3=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x3ab40f,_0x49c079){var _0x5c2a4b=function(_0x520008){while(--_0x520008){_0x3ab40f['push'](_0x3ab40f['shift']());}};_0x5c2a4b(++_0x49c079);}(_0xe8f3,0x10d));var _0x3e8f=function(_0xc297b5,_0x2d8a9b){_0xc297b5=_0xc297b5-0x0;var _0x58557e=_0xe8f3[_0xc297b5];return _0x58557e;};'use strict';var client=require(_0x3e8f('0x0'));exports[_0x3e8f('0x1')]=function(_0x2b1b50){return client[_0x3e8f('0x2')](_0x3e8f('0x3'),{'body':_0x2b1b50,'log':_0x3e8f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ed346a3..9e46328 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 _0x4a9f=['Agents','online','mailPause','../client','getMailQueues','Request','name','timeout','strategy','User'];(function(_0x28c870,_0x1bf349){var _0x5e4de6=function(_0x418068){while(--_0x418068){_0x28c870['push'](_0x28c870['shift']());}};_0x5e4de6(++_0x1bf349);}(_0x4a9f,0x67));var _0xf4a9=function(_0x80a0e2,_0x39003f){_0x80a0e2=_0x80a0e2-0x0;var _0x258e83=_0x4a9f[_0x80a0e2];return _0x258e83;};'use strict';var client=require(_0xf4a9('0x0'));exports[_0xf4a9('0x1')]=function(){return function(){return client[_0xf4a9('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xf4a9('0x3'),_0xf4a9('0x4'),_0xf4a9('0x5')],'include':[{'model':_0xf4a9('0x6'),'as':_0xf4a9('0x7'),'attributes':['id',_0xf4a9('0x3'),_0xf4a9('0x8'),_0xf4a9('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x6609=['online','mailPause','../client','Request','GetMailQueue','name','timeout','strategy','Agents'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6609,0xfe));var _0x9660=function(_0x5c53ce,_0xdc9d74){_0x5c53ce=_0x5c53ce-0x0;var _0x480f49=_0x6609[_0x5c53ce];return _0x480f49;};'use strict';var client=require(_0x9660('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x9660('0x1')](_0x9660('0x2'),{'options':{'raw':![],'attributes':['id',_0x9660('0x3'),_0x9660('0x4'),_0x9660('0x5')],'include':[{'model':'User','as':_0x9660('0x6'),'attributes':['id',_0x9660('0x3'),_0x9660('0x7'),_0x9660('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 74f6879..962f80f 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 _0xc7cc=['Request','CreateMailQueueReport','DESC','UpdateMailQueueReport','create'];(function(_0x19edc0,_0x39c116){var _0x5da0a4=function(_0xf2e510){while(--_0xf2e510){_0x19edc0['push'](_0x19edc0['shift']());}};_0x5da0a4(++_0x39c116);}(_0xc7cc,0x14e));var _0xcc7c=function(_0x109877,_0x4fbb17){_0x109877=_0x109877-0x0;var _0x5cd789=_0xc7cc[_0x109877];return _0x5cd789;};'use strict';var client=require('../client');exports[_0xcc7c('0x0')]=function(_0x154dab){return client[_0xcc7c('0x1')](_0xcc7c('0x2'),{'body':_0x154dab,'log':'CreateMailQueueReport'});};exports['update']=function(_0x4f8d02,_0x5abcb8){return client['Request']('UpdateMailQueueReport',{'body':_0x5abcb8,'options':{'where':{'uniqueid':_0x4f8d02},'order':[['id',_0xcc7c('0x3')]],'limit':0x1},'log':_0xcc7c('0x4')});}; \ No newline at end of file +var _0xaccd=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','create'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xaccd,0x7c));var _0xdacc=function(_0x1976fd,_0x504ab3){_0x1976fd=_0x1976fd-0x0;var _0xf3c474=_0xaccd[_0x1976fd];return _0xf3c474;};'use strict';var client=require('../client');exports[_0xdacc('0x0')]=function(_0x2938b8){return client['Request']('CreateMailQueueReport',{'body':_0x2938b8,'log':_0xdacc('0x1')});};exports[_0xdacc('0x2')]=function(_0x25999d,_0x2c5c3a){return client[_0xdacc('0x3')]('UpdateMailQueueReport',{'body':_0x2c5c3a,'options':{'where':{'uniqueid':_0x25999d},'order':[['id','DESC']],'limit':0x1},'log':_0xdacc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index b3ae61b..9a31d2d 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 _0x3def=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x4de9af,_0x41941c){var _0x20bd1c=function(_0x24d71f){while(--_0x24d71f){_0x4de9af['push'](_0x4de9af['shift']());}};_0x20bd1c(++_0x41941c);}(_0x3def,0x183));var _0xf3de=function(_0x3da493,_0x3b5afc){_0x3da493=_0x3da493-0x0;var _0x2227a5=_0x3def[_0x3da493];return _0x2227a5;};'use strict';var client=require(_0xf3de('0x0'));exports[_0xf3de('0x1')]=function(_0x3394cc,_0x325346){return client[_0xf3de('0x2')]('UpdateOpenchannelInteraction',{'body':_0x325346,'options':{'where':{'id':_0x3394cc}},'log':_0xf3de('0x3')});};exports['addTags']=function(_0x53777e,_0x38a9c8){return client[_0xf3de('0x2')](_0xf3de('0x4'),{'body':_0x38a9c8,'options':{'where':{'id':_0x53777e}},'log':_0xf3de('0x5')});}; \ No newline at end of file +var _0x3e96=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','../client'];(function(_0x1df644,_0x513cd7){var _0x236bdb=function(_0x43bc01){while(--_0x43bc01){_0x1df644['push'](_0x1df644['shift']());}};_0x236bdb(++_0x513cd7);}(_0x3e96,0x95));var _0x63e9=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x3e96[_0x120123];return _0x3bec4c;};'use strict';var client=require(_0x63e9('0x0'));exports['update']=function(_0x4e0bf4,_0x2f0138){return client['Request'](_0x63e9('0x1'),{'body':_0x2f0138,'options':{'where':{'id':_0x4e0bf4}},'log':_0x63e9('0x2')});};exports['addTags']=function(_0x4aa564,_0x557c1c){return client[_0x63e9('0x3')](_0x63e9('0x4'),{'body':_0x557c1c,'options':{'where':{'id':_0x4aa564}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 18cef03..240b013 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 _0x7ba8=['createOpenchannelMessage','../client','Request','CreateOpenchannelMessage'];(function(_0x80b8ac,_0x2b6d52){var _0x39e3c8=function(_0x36af0b){while(--_0x36af0b){_0x80b8ac['push'](_0x80b8ac['shift']());}};_0x39e3c8(++_0x2b6d52);}(_0x7ba8,0x10d));var _0x87ba=function(_0x20d657,_0x12c592){_0x20d657=_0x20d657-0x0;var _0x9ba0db=_0x7ba8[_0x20d657];return _0x9ba0db;};'use strict';var client=require(_0x87ba('0x0'));exports['create']=function(_0x5c199d){return client[_0x87ba('0x1')](_0x87ba('0x2'),{'body':_0x5c199d,'log':_0x87ba('0x3')});}; \ No newline at end of file +var _0xda9a=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x4bce6f,_0x1ca6f2){var _0x3baa07=function(_0x25d3b0){while(--_0x25d3b0){_0x4bce6f['push'](_0x4bce6f['shift']());}};_0x3baa07(++_0x1ca6f2);}(_0xda9a,0x142));var _0xada9=function(_0x21c23e,_0x1d33e3){_0x21c23e=_0x21c23e-0x0;var _0xa7b7e2=_0xda9a[_0x21c23e];return _0xa7b7e2;};'use strict';var client=require(_0xada9('0x0'));exports[_0xada9('0x1')]=function(_0x16965b){return client['Request'](_0xada9('0x2'),{'body':_0x16965b,'log':_0xada9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2a9ffcf..93751eb 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 _0x89e8=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','openchannelPause','../client'];(function(_0x229aa2,_0x100c43){var _0xa151d0=function(_0xba1543){while(--_0xba1543){_0x229aa2['push'](_0x229aa2['shift']());}};_0xa151d0(++_0x100c43);}(_0x89e8,0x74));var _0x889e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x89e8[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x889e('0x0'));exports[_0x889e('0x1')]=function(){return function(){return client[_0x889e('0x2')](_0x889e('0x3'),{'options':{'raw':![],'attributes':['id',_0x889e('0x4'),_0x889e('0x5'),_0x889e('0x6')],'include':[{'model':_0x889e('0x7'),'as':'Agents','attributes':['id','name','online',_0x889e('0x8')]}]},'log':_0x889e('0x1')});};}; \ No newline at end of file +var _0x706e=['name','timeout','strategy','User','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x566a21,_0x341a55){var _0x2ff5b8=function(_0x7903a5){while(--_0x7903a5){_0x566a21['push'](_0x566a21['shift']());}};_0x2ff5b8(++_0x341a55);}(_0x706e,0xe6));var _0xe706=function(_0x1769df,_0x584120){_0x1769df=_0x1769df-0x0;var _0x31c9e1=_0x706e[_0x1769df];return _0x31c9e1;};'use strict';var client=require(_0xe706('0x0'));exports[_0xe706('0x1')]=function(){return function(){return client[_0xe706('0x2')](_0xe706('0x3'),{'options':{'raw':![],'attributes':['id',_0xe706('0x4'),_0xe706('0x5'),_0xe706('0x6')],'include':[{'model':_0xe706('0x7'),'as':'Agents','attributes':['id',_0xe706('0x4'),'online',_0xe706('0x8')]}]},'log':_0xe706('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 17eaec7..a938d81 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 _0x78a8=['DESC','../client','create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x78a8,0xda));var _0x878a=function(_0x507b9f,_0x17de0d){_0x507b9f=_0x507b9f-0x0;var _0x4c9837=_0x78a8[_0x507b9f];return _0x4c9837;};'use strict';var client=require(_0x878a('0x0'));exports[_0x878a('0x1')]=function(_0x2ce54b){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x2ce54b,'log':_0x878a('0x2')});};exports[_0x878a('0x3')]=function(_0x116cd6,_0x108efd){return client[_0x878a('0x4')](_0x878a('0x5'),{'body':_0x108efd,'options':{'where':{'uniqueid':_0x116cd6},'order':[['id',_0x878a('0x6')]],'limit':0x1},'log':_0x878a('0x5')});}; \ No newline at end of file +var _0xc611=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','create'];(function(_0x3dc0ab,_0x26a681){var _0x2cc76d=function(_0x581eab){while(--_0x581eab){_0x3dc0ab['push'](_0x3dc0ab['shift']());}};_0x2cc76d(++_0x26a681);}(_0xc611,0xc7));var _0x1c61=function(_0x9c708,_0x39ad9f){_0x9c708=_0x9c708-0x0;var _0xa349ac=_0xc611[_0x9c708];return _0xa349ac;};'use strict';var client=require('../client');exports[_0x1c61('0x0')]=function(_0x92cea4){return client[_0x1c61('0x1')](_0x1c61('0x2'),{'body':_0x92cea4,'log':'CreateOpenchannelQueueReport'});};exports[_0x1c61('0x3')]=function(_0x613453,_0x38e27f){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x38e27f,'options':{'where':{'uniqueid':_0x613453},'order':[['id','DESC']],'limit':0x1},'log':_0x1c61('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e1b7b84..b7946da 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 _0x46fc=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x48b287,_0x1cff3d){var _0x54e675=function(_0x32a30a){while(--_0x32a30a){_0x48b287['push'](_0x48b287['shift']());}};_0x54e675(++_0x1cff3d);}(_0x46fc,0x103));var _0xc46f=function(_0x2f3ecb,_0x167647){_0x2f3ecb=_0x2f3ecb-0x0;var _0x92a07c=_0x46fc[_0x2f3ecb];return _0x92a07c;};'use strict';var client=require(_0xc46f('0x0'));exports[_0xc46f('0x1')]=function(_0xf5212c,_0x23d3ae){return client[_0xc46f('0x2')](_0xc46f('0x3'),{'body':_0x23d3ae,'options':{'where':{'id':_0xf5212c}},'log':_0xc46f('0x4')});};exports[_0xc46f('0x5')]=function(_0x3a56db,_0x5b0483){return client['Request'](_0xc46f('0x6'),{'body':_0x5b0483,'options':{'where':{'id':_0x3a56db}},'log':_0xc46f('0x7')});}; \ No newline at end of file +var _0x09f4=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x21fd45,_0x32e491){var _0x537a12=function(_0x5d446c){while(--_0x5d446c){_0x21fd45['push'](_0x21fd45['shift']());}};_0x537a12(++_0x32e491);}(_0x09f4,0xe4));var _0x409f=function(_0x1936f5,_0x58c5b1){_0x1936f5=_0x1936f5-0x0;var _0x405775=_0x09f4[_0x1936f5];return _0x405775;};'use strict';var client=require('../client');exports['update']=function(_0x203895,_0x1e5329){return client[_0x409f('0x0')](_0x409f('0x1'),{'body':_0x1e5329,'options':{'where':{'id':_0x203895}},'log':_0x409f('0x2')});};exports[_0x409f('0x3')]=function(_0x1d859b,_0x3c329a){return client[_0x409f('0x0')](_0x409f('0x4'),{'body':_0x3c329a,'options':{'where':{'id':_0x1d859b}},'log':_0x409f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3b47549..adfbf95 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 _0xb191=['CreateSmsMessage','createSmsMessage','create'];(function(_0x24b31e,_0x57f7c3){var _0x4724b9=function(_0x15ad20){while(--_0x15ad20){_0x24b31e['push'](_0x24b31e['shift']());}};_0x4724b9(++_0x57f7c3);}(_0xb191,0xe3));var _0x1b19=function(_0x74827a,_0x46bb41){_0x74827a=_0x74827a-0x0;var _0x3218d2=_0xb191[_0x74827a];return _0x3218d2;};'use strict';var client=require('../client');exports[_0x1b19('0x0')]=function(_0x2a890c){return client['Request'](_0x1b19('0x1'),{'body':_0x2a890c,'log':_0x1b19('0x2')});}; \ No newline at end of file +var _0xdb9c=['createSmsMessage','../client','Request'];(function(_0x4d331d,_0x538170){var _0xd3bfb=function(_0x2327f6){while(--_0x2327f6){_0x4d331d['push'](_0x4d331d['shift']());}};_0xd3bfb(++_0x538170);}(_0xdb9c,0x18a));var _0xcdb9=function(_0x1eb086,_0x3eedfa){_0x1eb086=_0x1eb086-0x0;var _0x140137=_0xdb9c[_0x1eb086];return _0x140137;};'use strict';var client=require(_0xcdb9('0x0'));exports['create']=function(_0x3298ff){return client[_0xcdb9('0x1')]('CreateSmsMessage',{'body':_0x3298ff,'log':_0xcdb9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index bbc33ac..38bbe1f 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2878c3,_0x37e5d5){var _0x1a0f64=function(_0x533d93){while(--_0x533d93){_0x2878c3['push'](_0x2878c3['shift']());}};_0x1a0f64(++_0x37e5d5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x26bb41,_0x40ccd7){var _0x34d2fe=function(_0x24cf63){while(--_0x24cf63){_0x26bb41['push'](_0x26bb41['shift']());}};_0x34d2fe(++_0x40ccd7);}(_0x70e0,0x17b));var _0x070e=function(_0x12c8fd,_0xc1cf0d){_0x12c8fd=_0x12c8fd-0x0;var _0x5430bb=_0x70e0[_0x12c8fd];return _0x5430bb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6e566fb..b50c95e 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x1be31f,_0x4dabe7){var _0x54f838=function(_0x37f665){while(--_0x37f665){_0x1be31f['push'](_0x1be31f['shift']());}};_0x54f838(++_0x4dabe7);}(_0x34e8,0x12c));var _0x834e=function(_0x4ee1cd,_0x21ba2a){_0x4ee1cd=_0x4ee1cd-0x0;var _0x255c68=_0x34e8[_0x4ee1cd];return _0x255c68;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x3866ad,_0x7bdee5){var _0x169411=function(_0x22e80a){while(--_0x22e80a){_0x3866ad['push'](_0x3866ad['shift']());}};_0x169411(++_0x7bdee5);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index aff937a..de33c7d 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(_0x5b6789,_0x2741bf){var _0x4b9754=function(_0x5f3561){while(--_0x5f3561){_0x5b6789['push'](_0x5b6789['shift']());}};_0x4b9754(++_0x2741bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x5e1dfb,_0x5b6cae){var _0x5bdd38=function(_0x216cc8){while(--_0x216cc8){_0x5e1dfb['push'](_0x5e1dfb['shift']());}};_0x5bdd38(++_0x5b6cae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 41524c7..50ee2f6 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 _0xc4aa=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(_0x40a0d0,_0x351dd5){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'body':_0x351dd5,'options':{'where':{'id':_0x40a0d0}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x47d4f6,_0x2f48ed){return client[_0xac4a('0x2')](_0xac4a('0x4'),{'body':_0x2f48ed,'options':{'where':{'id':_0x47d4f6}},'log':_0xac4a('0x5')});}; \ No newline at end of file +var _0x8b52=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x3de980,_0x5446fd){var _0x539e17=function(_0x255947){while(--_0x255947){_0x3de980['push'](_0x3de980['shift']());}};_0x539e17(++_0x5446fd);}(_0x8b52,0x151));var _0x28b5=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8b52[_0x2d7f0e];return _0x110b07;};'use strict';var client=require(_0x28b5('0x0'));exports[_0x28b5('0x1')]=function(_0x1559d9,_0x52ddc8){return client[_0x28b5('0x2')](_0x28b5('0x3'),{'body':_0x52ddc8,'options':{'where':{'id':_0x1559d9}},'log':'updateWhatsappInteraction'});};exports[_0x28b5('0x4')]=function(_0x3d0e93,_0x3a762e){return client[_0x28b5('0x2')](_0x28b5('0x5'),{'body':_0x3a762e,'options':{'where':{'id':_0x3d0e93}},'log':_0x28b5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 422e3f6..b9307c2 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 _0xf2be=['create','Request','CreateWhatsappMessage','../client'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0xf2be,0x7b));var _0xef2b=function(_0x27fe12,_0x1fa06f){_0x27fe12=_0x27fe12-0x0;var _0x518e25=_0xf2be[_0x27fe12];return _0x518e25;};'use strict';var client=require(_0xef2b('0x0'));exports[_0xef2b('0x1')]=function(_0xd7f57f){return client[_0xef2b('0x2')](_0xef2b('0x3'),{'body':_0xd7f57f,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x092b=['create','Request','CreateWhatsappMessage','../client'];(function(_0x3c5fa3,_0x379db8){var _0x254c4a=function(_0x2c41ba){while(--_0x2c41ba){_0x3c5fa3['push'](_0x3c5fa3['shift']());}};_0x254c4a(++_0x379db8);}(_0x092b,0xcf));var _0xb092=function(_0x1106a9,_0x5e36d9){_0x1106a9=_0x1106a9-0x0;var _0x5e78d1=_0x092b[_0x1106a9];return _0x5e78d1;};'use strict';var client=require(_0xb092('0x0'));exports[_0xb092('0x1')]=function(_0x4ece5a){return client[_0xb092('0x2')](_0xb092('0x3'),{'body':_0x4ece5a,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 9a085ba..ee93c06 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 _0xdf42=['whatsappPause','../client','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0x3cf670,_0x472306){var _0x53dfdc=function(_0x526c34){while(--_0x526c34){_0x3cf670['push'](_0x3cf670['shift']());}};_0x53dfdc(++_0x472306);}(_0xdf42,0xf1));var _0x2df4=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xdf42[_0x24f31b];return _0x488401;};'use strict';var client=require(_0x2df4('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x2df4('0x1')](_0x2df4('0x2'),{'options':{'raw':![],'attributes':['id',_0x2df4('0x3'),_0x2df4('0x4'),_0x2df4('0x5')],'include':[{'model':_0x2df4('0x6'),'as':_0x2df4('0x7'),'attributes':['id',_0x2df4('0x3'),_0x2df4('0x8'),_0x2df4('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x7251=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','timeout','User','name','online'];(function(_0x3344f7,_0x423634){var _0x1df131=function(_0x508ee5){while(--_0x508ee5){_0x3344f7['push'](_0x3344f7['shift']());}};_0x1df131(++_0x423634);}(_0x7251,0x161));var _0x1725=function(_0x518447,_0x12b32f){_0x518447=_0x518447-0x0;var _0xdeb6d1=_0x7251[_0x518447];return _0xdeb6d1;};'use strict';var client=require('../client');exports[_0x1725('0x0')]=function(){return function(){return client[_0x1725('0x1')](_0x1725('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x1725('0x3'),'strategy'],'include':[{'model':_0x1725('0x4'),'as':'Agents','attributes':['id',_0x1725('0x5'),_0x1725('0x6'),_0x1725('0x7')]}]},'log':_0x1725('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 31a6ebf..d2a200c 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 _0xfbc8=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xfbc8,0x112));var _0x8fbc=function(_0xfbceb4,_0x392f3b){_0xfbceb4=_0xfbceb4-0x0;var _0x563dbe=_0xfbc8[_0xfbceb4];return _0x563dbe;};'use strict';var client=require(_0x8fbc('0x0'));exports['create']=function(_0x41f873){return client['Request'](_0x8fbc('0x1'),{'body':_0x41f873,'log':_0x8fbc('0x1')});};exports[_0x8fbc('0x2')]=function(_0x1cd688,_0x5a588d){return client['Request'](_0x8fbc('0x3'),{'body':_0x5a588d,'options':{'where':{'uniqueid':_0x1cd688},'order':[['id',_0x8fbc('0x4')]],'limit':0x1},'log':_0x8fbc('0x3')});}; \ No newline at end of file +var _0x26d6=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x2f84b3,_0x5e7aa6){var _0x12efd5=function(_0xe42337){while(--_0xe42337){_0x2f84b3['push'](_0x2f84b3['shift']());}};_0x12efd5(++_0x5e7aa6);}(_0x26d6,0x171));var _0x626d=function(_0x5b4daa,_0xc385e4){_0x5b4daa=_0x5b4daa-0x0;var _0x9b569c=_0x26d6[_0x5b4daa];return _0x9b569c;};'use strict';var client=require(_0x626d('0x0'));exports[_0x626d('0x1')]=function(_0x3f08e0){return client[_0x626d('0x2')](_0x626d('0x3'),{'body':_0x3f08e0,'log':_0x626d('0x3')});};exports[_0x626d('0x4')]=function(_0x59b4dc,_0x1e7519){return client[_0x626d('0x2')](_0x626d('0x5'),{'body':_0x1e7519,'options':{'where':{'uniqueid':_0x59b4dc},'order':[['id',_0x626d('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index b6fff5f..221d83a 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 _0xcf22=['join','stop','find','agents','timeout','channel','format','START:%s','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','log','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xcf22,0x99));var _0x2cf2=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xcf22[_0x2e4aa2];return _0x5e6092;};'use strict';var schema=require(_0x2cf2('0x0'));var _=require(_0x2cf2('0x1'));var util=require(_0x2cf2('0x2'));var seqqueue=require(_0x2cf2('0x3'));var logger=require(_0x2cf2('0x4'))(_0x2cf2('0x5'));var strategy=require(_0x2cf2('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x2cf2('0x7')},'timeout':{'type':_0x2cf2('0x8'),'message':_0x2cf2('0x9')}});function writeLog(_0x27c1fa,_0x4cb821,_0xd01371){return logger['info'](util['format'](_0x2cf2('0xa'),_0x27c1fa,_0x4cb821[_0x2cf2('0xb')],_0xd01371));}function handleFindAgent(_0x521215){return function(_0xb0f459){return _0xb0f459[_0x2cf2('0xb')][_0x2cf2('0xc')]()===_0x521215[_0x2cf2('0xc')]();};}exports[_0x2cf2('0xd')]=function(_0x1326ea,_0x23402a,_0x5b8e94,_0x137107){return function(_0x1b4586){try{var _0x5f0794={'name':_0x23402a[0x0],'timeout':_0x23402a[0x1]};var _0xe70def=queue[_0x2cf2('0x0')](_0x5f0794,{'typecast':!![]});if(_0xe70def[_0x2cf2('0xe')]){logger[_0x2cf2('0xf')]('[%s][AGENT]\x20%s',_0x1326ea,_[_0x2cf2('0x10')](_0xe70def,'message')[_0x2cf2('0x11')](',\x20'));_0x1b4586[_0x2cf2('0x12')]();}else{var _0x21ca5e=_[_0x2cf2('0x13')](_0x5b8e94[_0x2cf2('0x14')],handleFindAgent(_0x5f0794[_0x2cf2('0xb')]));if(_0x21ca5e){var _0x3ad45a=(_0x5f0794[_0x2cf2('0x15')]||0xa)*0x3e8;var _0x573658,_0x4fe400;var _0x3988c9=seqqueue['createQueue'](_0x3ad45a);_0x3988c9['id']=_0x1326ea;_0x3988c9['atimeout']=_0x3ad45a;_0x3988c9[_0x2cf2('0x16')]=_0x137107[_0x2cf2('0x16')];writeLog(_0x1326ea,_0x21ca5e,util[_0x2cf2('0x17')](_0x2cf2('0x18'),_0x3ad45a));_0x5b8e94['rules'][_0x1326ea]['on'](_0x2cf2('0x19'),function(){logger[_0x2cf2('0x1a')](_0x2cf2('0x1b'),_0x1326ea);clearTimeout(_0x4fe400);_0x4fe400=undefined;_0x3988c9[_0x2cf2('0x1c')]();if(_0x5b8e94[_0x2cf2('0x1d')][_0x1326ea]){delete _0x5b8e94[_0x2cf2('0x1d')][_0x1326ea];}_0x1b4586[_0x2cf2('0x12')]();});_0x5b8e94[_0x2cf2('0x1d')][_0x1326ea]['on'](_0x2cf2('0x1e'),function(){if(_0x5b8e94[_0x2cf2('0x1d')][_0x1326ea]){delete _0x5b8e94[_0x2cf2('0x1d')][_0x1326ea];}});_0x4fe400=setTimeout(function(){logger[_0x2cf2('0x1a')](_0x2cf2('0x1f'),_0x1326ea);clearTimeout(_0x4fe400);_0x3988c9[_0x2cf2('0x1c')]();_0x1b4586[_0x2cf2('0x20')]();},_0x3ad45a);strategy['agent'](_0x3988c9,_0x21ca5e,_0x5b8e94,_0x137107);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x1326ea,_0x5f0794['name']);_0x1b4586['stop']();}}}catch(_0xd1adea){console[_0x2cf2('0x21')](_0xd1adea);logger[_0x2cf2('0xf')]('[%s][QUEUE]\x20%s',_0x1326ea,_0xd1adea['stack']);_0x1b4586[_0x2cf2('0x12')]();}};}; \ No newline at end of file +var _0xc2d3=['[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','name','toLowerCase','consequence','[%s][AGENT]\x20%s','message','join','stop','find','atimeout','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','error'];(function(_0x354188,_0x4c689c){var _0x354d33=function(_0x4fd051){while(--_0x4fd051){_0x354188['push'](_0x354188['shift']());}};_0x354d33(++_0x4c689c);}(_0xc2d3,0x10a));var _0x3c2d=function(_0x1de1f9,_0x264f74){_0x1de1f9=_0x1de1f9-0x0;var _0x44414b=_0xc2d3[_0x1de1f9];return _0x44414b;};'use strict';var schema=require(_0x3c2d('0x0'));var _=require(_0x3c2d('0x1'));var util=require('util');var seqqueue=require(_0x3c2d('0x2'));var logger=require(_0x3c2d('0x3'))(_0x3c2d('0x4'));var strategy=require(_0x3c2d('0x5'));var queue=schema({'name':{'type':_0x3c2d('0x6'),'required':!![],'message':_0x3c2d('0x7')},'timeout':{'type':_0x3c2d('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4694be,_0x4e0a09,_0x8b13e1){return logger[_0x3c2d('0x9')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4694be,_0x4e0a09[_0x3c2d('0xa')],_0x8b13e1));}function handleFindAgent(_0xf66bf1){return function(_0x111044){return _0x111044[_0x3c2d('0xa')][_0x3c2d('0xb')]()===_0xf66bf1['toLowerCase']();};}exports[_0x3c2d('0xc')]=function(_0x489777,_0x34eb45,_0x4907fc,_0x343a51){return function(_0xf3db91){try{var _0x26fbbc={'name':_0x34eb45[0x0],'timeout':_0x34eb45[0x1]};var _0x1c9341=queue['validate'](_0x26fbbc,{'typecast':!![]});if(_0x1c9341['length']){logger['error'](_0x3c2d('0xd'),_0x489777,_['map'](_0x1c9341,_0x3c2d('0xe'))[_0x3c2d('0xf')](',\x20'));_0xf3db91[_0x3c2d('0x10')]();}else{var _0x448781=_[_0x3c2d('0x11')](_0x4907fc['agents'],handleFindAgent(_0x26fbbc[_0x3c2d('0xa')]));if(_0x448781){var _0x3cd1ef=(_0x26fbbc['timeout']||0xa)*0x3e8;var _0x735300,_0x295b53;var _0xea9c17=seqqueue['createQueue'](_0x3cd1ef);_0xea9c17['id']=_0x489777;_0xea9c17[_0x3c2d('0x12')]=_0x3cd1ef;_0xea9c17['channel']=_0x343a51[_0x3c2d('0x13')];writeLog(_0x489777,_0x448781,util[_0x3c2d('0x14')](_0x3c2d('0x15'),_0x3cd1ef));_0x4907fc[_0x3c2d('0x16')][_0x489777]['on']('end',function(){logger[_0x3c2d('0x9')](_0x3c2d('0x17'),_0x489777);clearTimeout(_0x295b53);_0x295b53=undefined;_0xea9c17[_0x3c2d('0x18')]();if(_0x4907fc['rules'][_0x489777]){delete _0x4907fc[_0x3c2d('0x16')][_0x489777];}_0xf3db91[_0x3c2d('0x10')]();});_0x4907fc['rules'][_0x489777]['on'](_0x3c2d('0x19'),function(){if(_0x4907fc['rules'][_0x489777]){delete _0x4907fc[_0x3c2d('0x16')][_0x489777];}});_0x295b53=setTimeout(function(){logger['info'](_0x3c2d('0x1a'),_0x489777);clearTimeout(_0x295b53);_0xea9c17[_0x3c2d('0x18')]();_0xf3db91[_0x3c2d('0x1b')]();},_0x3cd1ef);strategy[_0x3c2d('0x1c')](_0xea9c17,_0x448781,_0x4907fc,_0x343a51);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x489777,_0x26fbbc[_0x3c2d('0xa')]);_0xf3db91[_0x3c2d('0x10')]();}}}catch(_0x3c0d57){console[_0x3c2d('0x1d')](_0x3c0d57);logger[_0x3c2d('0x1e')](_0x3c2d('0x1f'),_0x489777,_0x3c0d57[_0x3c2d('0x20')]);_0xf3db91[_0x3c2d('0x10')]();}};}; \ 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 d5ebf38..d25fe19 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 _0x2f76=['stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','postText','message','amazonlex','providerName','providerResponse','dialogState','Failed','catch'];(function(_0x25de8a,_0x118831){var _0x1ceae4=function(_0x34eecd){while(--_0x34eecd){_0x25de8a['push'](_0x25de8a['shift']());}};_0x1ceae4(++_0x118831);}(_0x2f76,0x11b));var _0x62f7=function(_0x4466c4,_0x502c3a){_0x4466c4=_0x4466c4-0x0;var _0x380fd0=_0x2f76[_0x4466c4];return _0x380fd0;};'use strict';var _=require(_0x62f7('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x62f7('0x1'));var logger=require(_0x62f7('0x2'))(_0x62f7('0x3'));var rpc={'chatMessage':require(_0x62f7('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x62f7('0x5')),'faxMessage':require(_0x62f7('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x62f7('0x7')]=function(_0x1e8d95,_0xb142b5){return function(_0xa9b8b3){try{if(!_[_0x62f7('0x8')](this[_0x62f7('0x9')]['UserId'])){logger[_0x62f7('0xa')](_0x62f7('0xb'),_0x1e8d95,_0x62f7('0xc'));return _0xa9b8b3[_0x62f7('0xd')]();}var _0x5caff9={'ContactId':this[_0x62f7('0xe')]['id'],'sentAt':moment()[_0x62f7('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x62f7('0x10')};if(this['channel']===_0x62f7('0x11')||this[_0x62f7('0x12')]===_0x62f7('0x13')){_0x5caff9[_0x62f7('0x14')]=this[_0x62f7('0x9')][_0x62f7('0x14')];}var _0x3d4a1b=this['channel'];if(_0x3d4a1b===_0x62f7('0x15')){_0x5caff9[_0x62f7('0x16')]=this[_0x62f7('0x17')]['id'];}else{_0x5caff9[_['upperFirst'](_0x3d4a1b)+'AccountId']=this['account']['id'];}_0x5caff9[_[_0x62f7('0x18')](_0x3d4a1b)+_0x62f7('0x19')]=this[_0x62f7('0x9')]['id'];if(this[_0x62f7('0x9')][_0x62f7('0x1a')]){var _0x1a37a2=_0xb142b5[0x4];if(!_[_0x62f7('0x1b')](_0x1a37a2)){_0x5caff9[_0x62f7('0x1c')]=utils[_0x62f7('0x1d')](_0x1a37a2,this);return rpc[_0x3d4a1b+_0x62f7('0x1e')][_0x62f7('0x1f')](_0x5caff9)[_0x62f7('0x20')](function(_0x233ce3){logger[_0x62f7('0xa')](_0x62f7('0xb'),_0x1e8d95,_0x5caff9[_0x62f7('0x1c')]);})['catch'](function(_0x3b61ee){logger[_0x62f7('0x21')]('[%s][AMAZONLEX]\x20%s',_0x1e8d95,JSON['stringify'](_0x3b61ee));})[_0x62f7('0x22')](function(){logger[_0x62f7('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1e8d95);_0xa9b8b3[_0x62f7('0x23')]();});}else{logger[_0x62f7('0xa')](_0x62f7('0x24'),_0x1e8d95);_0xa9b8b3[_0x62f7('0x23')]();}}else{var _0x524fda=this;var _0x22b204=new AWS[(_0x62f7('0x25'))]({'accessKeyId':_0xb142b5[0x0],'secretAccessKey':_0xb142b5[0x1],'region':_0xb142b5[0x2]});var _0x556afb={'botAlias':'$LATEST','botName':_0xb142b5[0x3],'inputText':this['message'][_0x62f7('0x1c')],'userId':this[_0x62f7('0x12')]+':'+this[_0x62f7('0x9')]['id']['toString']()};_0x22b204[_0x62f7('0x26')](_0x556afb,function(_0x4e3c91,_0x135513){if(_0x4e3c91){logger[_0x62f7('0x21')](_0x62f7('0xb'),_0x1e8d95,_0x4e3c91['message']);_0xa9b8b3[_0x62f7('0xd')]();}else if(_0x135513&&_0x135513[_0x62f7('0x27')]){_0x524fda['body'][_0x62f7('0x28')]=_0x135513;_0x5caff9[_0x62f7('0x1c')]=_0x135513[_0x62f7('0x27')];_0x5caff9[_0x62f7('0x29')]='amazonlex';_0x5caff9[_0x62f7('0x2a')]=JSON['stringify'](_0x135513);return rpc[_0x3d4a1b+_0x62f7('0x1e')][_0x62f7('0x1f')](_0x5caff9)[_0x62f7('0x20')](function(_0x524c44){logger['info'](_0x62f7('0xb'),_0x1e8d95,_0x5caff9[_0x62f7('0x1c')]);if(_0x135513[_0x62f7('0x2b')]==_0x62f7('0x2c')){_0xa9b8b3['next']();}else{_0xa9b8b3['stop']();}})[_0x62f7('0x2d')](function(_0x430d8d){logger[_0x62f7('0x21')](_0x62f7('0xb'),_0x1e8d95,JSON[_0x62f7('0x2e')](_0x430d8d));_0xa9b8b3[_0x62f7('0xd')]();});}else{_0xa9b8b3[_0x62f7('0xd')]();}});}}catch(_0x4316c0){logger[_0x62f7('0x21')](_0x62f7('0xb'),_0x1e8d95,JSON[_0x62f7('0x2e')](_0x4316c0));_0xa9b8b3[_0x62f7('0x23')]();}};}; \ No newline at end of file +var _0x1219=['Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','message','body','postText','[%s][AMAZONLEX]\x20%s','amazonlex','providerName','providerResponse','Failed','lodash','moment','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty'];(function(_0x246431,_0x1f9a48){var _0x52a6b2=function(_0x3cbba6){while(--_0x3cbba6){_0x246431['push'](_0x246431['shift']());}};_0x52a6b2(++_0x1f9a48);}(_0x1219,0xa5));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9121('0x0'));var moment=require(_0x9121('0x1'));var AWS=require(_0x9121('0x2'));var utils=require(_0x9121('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x9121('0x4')),'openchannelMessage':require(_0x9121('0x5')),'mailMessage':require(_0x9121('0x6')),'smsMessage':require(_0x9121('0x7')),'faxMessage':require(_0x9121('0x8')),'whatsappMessage':require(_0x9121('0x9'))};exports[_0x9121('0xa')]=function(_0x2abd46,_0x1bdfa4){return function(_0x384341){try{if(!_[_0x9121('0xb')](this[_0x9121('0xc')][_0x9121('0xd')])){logger[_0x9121('0xe')]('[%s][AMAZONLEX]\x20%s',_0x2abd46,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x384341[_0x9121('0xf')]();}var _0xb60774={'ContactId':this[_0x9121('0x10')]['id'],'sentAt':moment()['format'](_0x9121('0x11')),'direction':_0x9121('0x12')};if(this[_0x9121('0x13')]===_0x9121('0x14')||this['channel']===_0x9121('0x15')){_0xb60774[_0x9121('0x16')]=this[_0x9121('0xc')][_0x9121('0x16')];}var _0x20de6b=this[_0x9121('0x13')];if(_0x20de6b===_0x9121('0x17')){_0xb60774[_0x9121('0x18')]=this['account']['id'];}else{_0xb60774[_['upperFirst'](_0x20de6b)+_0x9121('0x19')]=this[_0x9121('0x1a')]['id'];}_0xb60774[_[_0x9121('0x1b')](_0x20de6b)+_0x9121('0x1c')]=this[_0x9121('0xc')]['id'];if(this[_0x9121('0xc')][_0x9121('0x1d')]){var _0x3b9094=_0x1bdfa4[0x4];if(!_[_0x9121('0x1e')](_0x3b9094)){_0xb60774['body']=utils['getMustacheRender'](_0x3b9094,this);return rpc[_0x20de6b+_0x9121('0x1f')][_0x9121('0x20')](_0xb60774)[_0x9121('0x21')](function(_0x179886){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2abd46,_0xb60774['body']);})[_0x9121('0x22')](function(_0x5956c9){logger[_0x9121('0x23')]('[%s][AMAZONLEX]\x20%s',_0x2abd46,JSON[_0x9121('0x24')](_0x5956c9));})[_0x9121('0x25')](function(){logger[_0x9121('0xe')](_0x9121('0x26'),_0x2abd46);_0x384341[_0x9121('0x27')]();});}else{logger[_0x9121('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2abd46);_0x384341[_0x9121('0x27')]();}}else{var _0x47a588=this;var _0x43dc27=new AWS[(_0x9121('0x28'))]({'accessKeyId':_0x1bdfa4[0x0],'secretAccessKey':_0x1bdfa4[0x1],'region':_0x1bdfa4[0x2]});var _0x322663={'botAlias':'$LATEST','botName':_0x1bdfa4[0x3],'inputText':this[_0x9121('0x29')][_0x9121('0x2a')],'userId':this['channel']+':'+this[_0x9121('0xc')]['id']['toString']()};_0x43dc27[_0x9121('0x2b')](_0x322663,function(_0x1785c8,_0x2c26fc){if(_0x1785c8){logger[_0x9121('0x23')](_0x9121('0x2c'),_0x2abd46,_0x1785c8[_0x9121('0x29')]);_0x384341[_0x9121('0xf')]();}else if(_0x2c26fc&&_0x2c26fc[_0x9121('0x29')]){_0x47a588[_0x9121('0x2a')][_0x9121('0x2d')]=_0x2c26fc;_0xb60774[_0x9121('0x2a')]=_0x2c26fc[_0x9121('0x29')];_0xb60774[_0x9121('0x2e')]=_0x9121('0x2d');_0xb60774[_0x9121('0x2f')]=JSON[_0x9121('0x24')](_0x2c26fc);return rpc[_0x20de6b+_0x9121('0x1f')][_0x9121('0x20')](_0xb60774)[_0x9121('0x21')](function(_0x6df9be){logger[_0x9121('0xe')](_0x9121('0x2c'),_0x2abd46,_0xb60774[_0x9121('0x2a')]);if(_0x2c26fc['dialogState']==_0x9121('0x30')){_0x384341[_0x9121('0xf')]();}else{_0x384341['stop']();}})[_0x9121('0x22')](function(_0xcb2335){logger['error'](_0x9121('0x2c'),_0x2abd46,JSON[_0x9121('0x24')](_0xcb2335));_0x384341[_0x9121('0xf')]();});}else{_0x384341[_0x9121('0xf')]();}});}}catch(_0x484146){logger[_0x9121('0x23')](_0x9121('0x2c'),_0x2abd46,JSON[_0x9121('0x24')](_0x484146));_0x384341[_0x9121('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index ce8ee8b..2ece400 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 _0x54cf=['phone','subject','startsWith','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','html','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','error','resolve','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stringify','finally','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from'];(function(_0x3dfa26,_0x18d78b){var _0x25b22e=function(_0x3ef4d4){while(--_0x3ef4d4){_0x3dfa26['push'](_0x3dfa26['shift']());}};_0x25b22e(++_0x18d78b);}(_0x54cf,0xa4));var _0xf54c=function(_0x43ac13,_0x1e0741){_0x43ac13=_0x43ac13-0x0;var _0x35c5d5=_0x54cf[_0x43ac13];return _0x35c5d5;};'use strict';var _=require(_0xf54c('0x0'));var moment=require('moment');var utils=require(_0xf54c('0x1'));var logger=require(_0xf54c('0x2'))(_0xf54c('0x3'));var rpc={'chatMessage':require(_0xf54c('0x4')),'openchannelMessage':require(_0xf54c('0x5')),'mailMessage':require(_0xf54c('0x6')),'smsMessage':require(_0xf54c('0x7')),'faxMessage':require(_0xf54c('0x8')),'whatsappMessage':require(_0xf54c('0x9')),'chatInteraction':require(_0xf54c('0xa')),'openchannelInteraction':require(_0xf54c('0xb')),'mailInteraction':require(_0xf54c('0xc')),'smsInteraction':require(_0xf54c('0xd')),'faxInteraction':require(_0xf54c('0xe')),'whatsappInteraction':require(_0xf54c('0xf'))};var mailRpc=require(_0xf54c('0x10'));exports[_0xf54c('0x11')]=function(_0x2679fa,_0x3ee8dc,_0x17dabd,_0x354610){return function(_0x224ebf){try{var _0x2f69ac=this[_0xf54c('0x12')];if(_0x2f69ac===_0xf54c('0x13')&&_0x354610[_0xf54c('0x14')][_0xf54c('0x15')]){logger[_0xf54c('0x16')](_0xf54c('0x17'),_0x2679fa,_0xf54c('0x18'));return _0x224ebf[_0xf54c('0x19')]();}if(_0x3ee8dc[0x0]==='1'&&(_['isNil'](this[_0xf54c('0x1a')][_0xf54c('0x1b')])||!this[_0xf54c('0x1a')]['created'])){logger[_0xf54c('0x16')]('[%s][AUTOREPLY]\x20%s',_0x2679fa,'Autoreply\x20already\x20sent');return _0x224ebf[_0xf54c('0x19')]();}if(_0x3ee8dc[0x0]==='2'&&this[_0xf54c('0x1a')][_0xf54c('0x1c')]){logger[_0xf54c('0x16')](_0xf54c('0x1d'),_0x2679fa,_0xf54c('0x1e'));return _0x224ebf['next']();}var _0xa5b409={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf54c('0x1f')](_0xf54c('0x20')),'direction':_0xf54c('0x21')};if(this[_0xf54c('0x12')]==='mail'){_0xa5b409[_0xf54c('0x14')]=utils[_0xf54c('0x22')](_0x3ee8dc[0x2],this);}else{_0xa5b409[_0xf54c('0x14')]=utils[_0xf54c('0x22')](_0x3ee8dc[0x1],this);}if(this[_0xf54c('0x23')]){_0xa5b409['to']=this[_0xf54c('0x23')][_0xf54c('0x24')]||'';if(this['channel']==='mail'&&_0x3ee8dc[0x1]==='1'){_0xa5b409['cc']=this['message']['cc']||'';}_0xa5b409[_0xf54c('0x24')]=this[_0xf54c('0x23')]['to']||'';_0xa5b409[_0xf54c('0x25')]=this[_0xf54c('0x23')][_0xf54c('0x25')]||'';_0xa5b409['read']=!![];if(this[_0xf54c('0x23')][_0xf54c('0x26')]){_0xa5b409[_0xf54c('0x26')]='';_0xa5b409[_0xf54c('0x26')]+=_[_0xf54c('0x27')](this[_0xf54c('0x23')][_0xf54c('0x26')],'Re:')?'':'Re:\x20';_0xa5b409['subject']+=this[_0xf54c('0x23')]['subject'];}}if(this[_0xf54c('0x12')]===_0xf54c('0x28')){_0xa5b409[_0xf54c('0x29')]=this[_0xf54c('0x2a')]['id'];}else{_0xa5b409[_[_0xf54c('0x2b')](this['channel'])+_0xf54c('0x2c')]=this[_0xf54c('0x2a')]['id'];}_0xa5b409[_[_0xf54c('0x2b')](this[_0xf54c('0x12')])+'InteractionId']=this[_0xf54c('0x1a')]['id'];var _0x3e144a=this[_0xf54c('0x1a')];if(rpc[this['channel']+_0xf54c('0x2d')]){if(this['channel']===_0xf54c('0x13')){_0xa5b409[_0xf54c('0x2e')]=this[_0xf54c('0x23')]['messageId'];_0xa5b409[_0xf54c('0x2f')]=''+_['replace'](_0xa5b409[_0xf54c('0x14')],_0xf54c('0x30'),'','replace','';_0xa4ab0b[_0x4ea3('0x30')]={'Auto-Submitted':_0x4ea3('0x31'),'X-Auto-Response-Suppress':_0x4ea3('0x32'),'Precedence':_0x4ea3('0x33')};return mailRpc[_0x4ea3('0x34')](this[_0x4ea3('0x25')]['smtpOptions'],_0xa4ab0b)[_0x4ea3('0x35')](function(_0x2d41f2){logger[_0x4ea3('0x10')](_0x4ea3('0x36'),_0x228953);_0xa4ab0b['messageId']=_0x2d41f2[_0x4ea3('0x1c')][_0x4ea3('0x2b')];return rpc[_0x30b14e+'Message']['create'](_0xa4ab0b);})[_0x4ea3('0x35')](function(_0x5fa60e){logger['info'](_0x4ea3('0x14'),_0x228953,JSON['stringify'](_0x5fa60e));})[_0x4ea3('0x37')](function(_0x2c6853){logger[_0x4ea3('0x38')]('[RPC][%s][AUTOREPLY]\x20%s',_0x228953,JSON[_0x4ea3('0x39')](_0x2c6853));})['finally'](function(){Promise[_0x4ea3('0x3a')]()['then'](function(){if(_0x26a536[0x0]!=='2'||_0x20cfd2['autoreplyExecuted'])return;return rpc[_0x30b14e+_0x4ea3('0x3b')][_0x4ea3('0x3c')](_0x20cfd2['id'],{'autoreplyExecuted':!![]})['then'](function(_0x159077){logger[_0x4ea3('0x10')](_0x4ea3('0x17'),_0x228953,JSON[_0x4ea3('0x39')](_0x159077));})[_0x4ea3('0x37')](function(_0x60baa2){logger[_0x4ea3('0x38')](_0x4ea3('0x3d'),_0x228953,JSON['stringify'](_0x60baa2));});})['then'](function(){_0xe17efd[_0x4ea3('0x11')]();});});}else{return rpc[this[_0x4ea3('0xc')]+'Message'][_0x4ea3('0x3e')](_0xa4ab0b)[_0x4ea3('0x35')](function(){logger[_0x4ea3('0x10')](_0x4ea3('0x14'),_0x228953,_0xa4ab0b['body']);})[_0x4ea3('0x37')](function(_0x510b6e){logger[_0x4ea3('0x38')](_0x4ea3('0x14'),_0x228953,JSON[_0x4ea3('0x39')](_0x510b6e));})[_0x4ea3('0x3f')](function(){Promise[_0x4ea3('0x3a')]()['then'](function(){if(_0x26a536[0x0]!=='2'||_0x20cfd2['autoreplyExecuted'])return;return rpc[_0x30b14e+_0x4ea3('0x3b')][_0x4ea3('0x3c')](_0x20cfd2['id'],{'autoreplyExecuted':!![]})[_0x4ea3('0x35')](function(_0x7b1f18){logger[_0x4ea3('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x228953,JSON[_0x4ea3('0x39')](_0x7b1f18));})[_0x4ea3('0x37')](function(_0x20f68e){logger[_0x4ea3('0x38')](_0x4ea3('0x3d'),_0x228953,JSON['stringify'](_0x20f68e));});})['then'](function(){_0xe17efd[_0x4ea3('0x11')]();});});}}}catch(_0x3ca460){logger[_0x4ea3('0x38')](_0x4ea3('0x14'),_0x228953,JSON[_0x4ea3('0x39')](_0x3ca460));_0xe17efd[_0x4ea3('0x40')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 7522eb6..04f5d4e 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 _0xf003=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','channel'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0xf003,0xb2));var _0x3f00=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0xf003[_0x188703];return _0x1a0c81;};'use strict';var moment=require(_0x3f00('0x0'));var logger=require(_0x3f00('0x1'))(_0x3f00('0x2'));var rpc={'chatInteraction':require(_0x3f00('0x3')),'openchannelInteraction':require(_0x3f00('0x4')),'smsInteraction':require(_0x3f00('0x5')),'mailInteraction':require(_0x3f00('0x6')),'faxInteraction':require(_0x3f00('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x53d9ed,_0x1695c5,_0x4a35bb,_0x3097a3){return function(_0x1434b8){try{logger[_0x3f00('0x8')](_0x3f00('0x9'),_0x53d9ed,_0x1695c5[0x0]);var _0x1cdb27={'closed':0x1,'closedAt':moment()[_0x3f00('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x1695c5[0x0]};if(rpc[_0x3097a3['channel']+'Interaction']){rpc[_0x3097a3[_0x3f00('0xb')]+'Interaction']['update'](_0x3097a3['interaction']['id'],_0x1cdb27)['then'](function(_0xd9fc80){logger[_0x3f00('0x8')](_0x3f00('0xc'),_0x53d9ed,_0x3097a3[_0x3f00('0xd')]['id']);})['catch'](function(_0x2b24ad){logger[_0x3f00('0xe')](_0x3f00('0xf'),_0x53d9ed,JSON[_0x3f00('0x10')](_0x2b24ad));})[_0x3f00('0x11')](function(){_0x1434b8[_0x3f00('0x12')]();});}}catch(_0x2b06c1){logger[_0x3f00('0xe')](_0x3f00('0xf'),_0x53d9ed,JSON[_0x3f00('0x10')](_0x2b06c1));_0x1434b8['stop']();}};}; \ No newline at end of file +var _0xd700=['[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stop','error','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xd700,0x6f));var _0x0d70=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xd700[_0x4e5552];return _0x60a338;};'use strict';var moment=require(_0x0d70('0x0'));var logger=require(_0x0d70('0x1'))(_0x0d70('0x2'));var rpc={'chatInteraction':require(_0x0d70('0x3')),'openchannelInteraction':require(_0x0d70('0x4')),'smsInteraction':require(_0x0d70('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0d70('0x6')),'whatsappInteraction':require(_0x0d70('0x7'))};exports['consequence']=function(_0x388f2c,_0x4e580b,_0x14b954,_0x8e962d){return function(_0x410a9e){try{logger[_0x0d70('0x8')](_0x0d70('0x9'),_0x388f2c,_0x4e580b[0x0]);var _0x2c4499={'closed':0x1,'closedAt':moment()[_0x0d70('0xa')](_0x0d70('0xb')),'closeReason':_0x0d70('0xc'),'disposition':_0x4e580b[0x0]};if(rpc[_0x8e962d[_0x0d70('0xd')]+'Interaction']){rpc[_0x8e962d[_0x0d70('0xd')]+_0x0d70('0xe')][_0x0d70('0xf')](_0x8e962d[_0x0d70('0x10')]['id'],_0x2c4499)[_0x0d70('0x11')](function(_0x5b6314){logger[_0x0d70('0x8')](_0x0d70('0x12'),_0x388f2c,_0x8e962d[_0x0d70('0x10')]['id']);})[_0x0d70('0x13')](function(_0x29472b){logger['error'](_0x0d70('0x14'),_0x388f2c,JSON['stringify'](_0x29472b));})['finally'](function(){_0x410a9e[_0x0d70('0x15')]();});}}catch(_0x29da11){logger[_0x0d70('0x16')](_0x0d70('0x14'),_0x388f2c,JSON[_0x0d70('0x17')](_0x29da11));_0x410a9e[_0x0d70('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index ae0975f..dd39142 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 _0x2d06=['account','AccountId','InteractionId','created','isEmpty','body','Message','create','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','then','metadata','endConversation','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId'];(function(_0x4935dc,_0x1eb53f){var _0x43a146=function(_0x55ff3a){while(--_0x55ff3a){_0x4935dc['push'](_0x4935dc['shift']());}};_0x43a146(++_0x1eb53f);}(_0x2d06,0x157));var _0x62d0=function(_0x2862e3,_0x152f66){_0x2862e3=_0x2862e3-0x0;var _0xdb39d3=_0x2d06[_0x2862e3];return _0xdb39d3;};'use strict';var _=require('lodash');var moment=require(_0x62d0('0x0'));var apiai=require(_0x62d0('0x1'));var md5=require(_0x62d0('0x2'));var utils=require(_0x62d0('0x3'));var logger=require('../../../../config/logger')(_0x62d0('0x4'));var rpc={'chatMessage':require(_0x62d0('0x5')),'openchannelMessage':require(_0x62d0('0x6')),'mailMessage':require(_0x62d0('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x62d0('0x8')),'whatsappMessage':require(_0x62d0('0x9'))};exports['consequence']=function(_0x377f3d,_0x43fd82){return function(_0x508d82){try{if(!_[_0x62d0('0xa')](this[_0x62d0('0xb')][_0x62d0('0xc')])){logger[_0x62d0('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x377f3d,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x508d82[_0x62d0('0xe')]();}var _0x340cff={'ContactId':this[_0x62d0('0xf')]['id'],'sentAt':moment()[_0x62d0('0x10')](_0x62d0('0x11')),'direction':_0x62d0('0x12')};if(this[_0x62d0('0x13')]===_0x62d0('0x14')||this[_0x62d0('0x13')]===_0x62d0('0x15')){_0x340cff[_0x62d0('0x16')]=this[_0x62d0('0xb')][_0x62d0('0x16')];}var _0x2da9cd=this['channel'];if(_0x2da9cd===_0x62d0('0x17')){_0x340cff[_0x62d0('0x18')]=this[_0x62d0('0x19')]['id'];}else{_0x340cff[_['upperFirst'](_0x2da9cd)+_0x62d0('0x1a')]=this[_0x62d0('0x19')]['id'];}_0x340cff[_['upperFirst'](_0x2da9cd)+_0x62d0('0x1b')]=this[_0x62d0('0xb')]['id'];if(this[_0x62d0('0xb')][_0x62d0('0x1c')]){var _0x555600=_0x43fd82[0x2];if(!_[_0x62d0('0x1d')](_0x555600)){_0x340cff[_0x62d0('0x1e')]=utils['getMustacheRender'](_0x555600,this);return rpc[_0x2da9cd+_0x62d0('0x1f')][_0x62d0('0x20')](_0x340cff)['then'](function(_0x1e7076){logger['info'](_0x62d0('0x21'),_0x377f3d,_0x340cff[_0x62d0('0x1e')]);})[_0x62d0('0x22')](function(_0x58c877){logger[_0x62d0('0x23')](_0x62d0('0x21'),_0x377f3d,JSON[_0x62d0('0x24')](_0x58c877));})['finally'](function(){logger[_0x62d0('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x377f3d);_0x508d82[_0x62d0('0x25')]();});}else{logger['info'](_0x62d0('0x26'),_0x377f3d);_0x508d82['stop']();}}else{var _0x200d3f=this;var _0x211fc7=apiai(_0x43fd82[0x0],{'language':_0x43fd82[0x1]||'en'});return _0x211fc7['textRequest'](this[_0x62d0('0x27')]['body'],{'sessionId':md5(this[_0x62d0('0xb')]['id'])})['then'](function(_0x3253be){_0x200d3f[_0x62d0('0x1e')][_0x62d0('0x28')]=_0x3253be;_0x340cff['body']=_0x3253be[_0x62d0('0x29')][_0x62d0('0x2a')]['speech'];_0x340cff['providerName']='dialogflow';_0x340cff['providerResponse']=JSON[_0x62d0('0x24')](_0x3253be);return rpc[_0x2da9cd+_0x62d0('0x1f')][_0x62d0('0x20')](_0x340cff)[_0x62d0('0x2b')](function(_0x37e2aa){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x377f3d,_0x340cff[_0x62d0('0x1e')]);if(_0x3253be[_0x62d0('0x29')][_0x62d0('0x2c')][_0x62d0('0x2d')]){_0x508d82['next']();}else{_0x508d82[_0x62d0('0x25')]();}})['catch'](function(_0xb9f97c){logger[_0x62d0('0x23')](_0x62d0('0x21'),_0x377f3d,JSON[_0x62d0('0x24')](_0xb9f97c));_0x508d82[_0x62d0('0xe')]();});})[_0x62d0('0x22')](function(_0x84dbb2){logger[_0x62d0('0x23')](_0x62d0('0x21'),_0x377f3d,_0x84dbb2[_0x62d0('0x27')]);_0x508d82[_0x62d0('0xe')]();});}}catch(_0x1ce2a6){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x377f3d,JSON['stringify'](_0x1ce2a6));_0x508d82[_0x62d0('0x25')]();}};}; \ No newline at end of file +var _0x2675=['AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','dialogflow','result','fulfillment','speech','providerName','metadata','endConversation','error','catch','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst'];(function(_0x37ca27,_0x56cab2){var _0x14ec93=function(_0x30f134){while(--_0x30f134){_0x37ca27['push'](_0x37ca27['shift']());}};_0x14ec93(++_0x56cab2);}(_0x2675,0x75));var _0x5267=function(_0x489b41,_0x2fda9b){_0x489b41=_0x489b41-0x0;var _0x2f4d09=_0x2675[_0x489b41];return _0x2f4d09;};'use strict';var _=require(_0x5267('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x5267('0x1'));var logger=require(_0x5267('0x2'))('routing');var rpc={'chatMessage':require(_0x5267('0x3')),'openchannelMessage':require(_0x5267('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5267('0x5')),'faxMessage':require(_0x5267('0x6')),'whatsappMessage':require(_0x5267('0x7'))};exports[_0x5267('0x8')]=function(_0x20f065,_0xc56cd5){return function(_0x527c16){try{if(!_[_0x5267('0x9')](this[_0x5267('0xa')]['UserId'])){logger[_0x5267('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x20f065,_0x5267('0xc'));return _0x527c16[_0x5267('0xd')]();}var _0x26e22b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5267('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5267('0xf')};if(this['channel']===_0x5267('0x10')||this[_0x5267('0x11')]===_0x5267('0x12')){_0x26e22b[_0x5267('0x13')]=this[_0x5267('0xa')][_0x5267('0x13')];}var _0x20785c=this[_0x5267('0x11')];if(_0x20785c===_0x5267('0x14')){_0x26e22b[_0x5267('0x15')]=this[_0x5267('0x16')]['id'];}else{_0x26e22b[_[_0x5267('0x17')](_0x20785c)+_0x5267('0x18')]=this['account']['id'];}_0x26e22b[_['upperFirst'](_0x20785c)+_0x5267('0x19')]=this[_0x5267('0xa')]['id'];if(this[_0x5267('0xa')][_0x5267('0x1a')]){var _0x46b2c2=_0xc56cd5[0x2];if(!_[_0x5267('0x1b')](_0x46b2c2)){_0x26e22b[_0x5267('0x1c')]=utils[_0x5267('0x1d')](_0x46b2c2,this);return rpc[_0x20785c+_0x5267('0x1e')][_0x5267('0x1f')](_0x26e22b)[_0x5267('0x20')](function(_0x1ab03){logger['info'](_0x5267('0x21'),_0x20f065,_0x26e22b[_0x5267('0x1c')]);})['catch'](function(_0x20cb50){logger['error'](_0x5267('0x21'),_0x20f065,JSON[_0x5267('0x22')](_0x20cb50));})[_0x5267('0x23')](function(){logger[_0x5267('0xb')](_0x5267('0x24'),_0x20f065);_0x527c16['stop']();});}else{logger[_0x5267('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x20f065);_0x527c16[_0x5267('0x25')]();}}else{var _0x420fb8=this;var _0x3b53ac=apiai(_0xc56cd5[0x0],{'language':_0xc56cd5[0x1]||'en'});return _0x3b53ac['textRequest'](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x26c7f8){_0x420fb8[_0x5267('0x1c')][_0x5267('0x26')]=_0x26c7f8;_0x26e22b[_0x5267('0x1c')]=_0x26c7f8[_0x5267('0x27')][_0x5267('0x28')][_0x5267('0x29')];_0x26e22b[_0x5267('0x2a')]=_0x5267('0x26');_0x26e22b['providerResponse']=JSON['stringify'](_0x26c7f8);return rpc[_0x20785c+_0x5267('0x1e')][_0x5267('0x1f')](_0x26e22b)['then'](function(_0x45373e){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x20f065,_0x26e22b[_0x5267('0x1c')]);if(_0x26c7f8[_0x5267('0x27')][_0x5267('0x2b')][_0x5267('0x2c')]){_0x527c16[_0x5267('0xd')]();}else{_0x527c16['stop']();}})['catch'](function(_0x18020c){logger[_0x5267('0x2d')](_0x5267('0x21'),_0x20f065,JSON['stringify'](_0x18020c));_0x527c16['next']();});})[_0x5267('0x2e')](function(_0x3ef2a8){logger[_0x5267('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x20f065,_0x3ef2a8['message']);_0x527c16[_0x5267('0xd')]();});}}catch(_0xc7691d){logger[_0x5267('0x2d')](_0x5267('0x21'),_0x20f065,JSON['stringify'](_0xc7691d));_0x527c16[_0x5267('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 2fa7d0d..d59241f 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 _0xd67e=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','message','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','fields','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','lodash','dialogflow','moment','bluebird','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','account','created','getMustacheRender','finally'];(function(_0x34c4f2,_0x1eefc4){var _0x287276=function(_0x56cc22){while(--_0x56cc22){_0x34c4f2['push'](_0x34c4f2['shift']());}};_0x287276(++_0x1eefc4);}(_0xd67e,0xb3));var _0xed67=function(_0x5c84ca,_0x439f19){_0x5c84ca=_0x5c84ca-0x0;var _0x3db739=_0xd67e[_0x5c84ca];return _0x3db739;};'use strict';var _=require(_0xed67('0x0'));var dialogflow=require(_0xed67('0x1'));var md5=require('md5');var moment=require(_0xed67('0x2'));var Promise=require(_0xed67('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xed67('0x4')),'openchannelMessage':require(_0xed67('0x5')),'mailMessage':require(_0xed67('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xed67('0x7')),'whatsappMessage':require(_0xed67('0x8'))};function createMessage(_0x331439,_0x1e5a29,_0xa4d1a3,_0x5cd5f1){return new Promise(function(_0x318071,_0x469745){var _0x2b5516=_['clone'](_0xa4d1a3);_0x2b5516['body']=_0x5cd5f1;return rpc[_0x1e5a29+_0xed67('0x9')][_0xed67('0xa')](_0x2b5516)[_0xed67('0xb')](function(){logger[_0xed67('0xc')](_0xed67('0xd'),_0x331439,_0x2b5516[_0xed67('0xe')]);_0x318071();})[_0xed67('0xf')](function(_0x5c2e9f){logger[_0xed67('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x331439,JSON[_0xed67('0x11')](_0x5c2e9f));_0x469745(_0x5c2e9f);});});}exports[_0xed67('0x12')]=function(_0x5b5b52,_0x52cd43){return function(_0x433fde){try{if(!_[_0xed67('0x13')](this['interaction'][_0xed67('0x14')])){logger[_0xed67('0xc')](_0xed67('0xd'),_0x5b5b52,_0xed67('0x15'));return _0x433fde[_0xed67('0x16')]();}var _0x240cf4={'ContactId':this[_0xed67('0x17')]['id'],'sentAt':moment()[_0xed67('0x18')](_0xed67('0x19')),'direction':_0xed67('0x1a')};if(this['channel']===_0xed67('0x1b')||this[_0xed67('0x1c')]===_0xed67('0x1d')){_0x240cf4[_0xed67('0x1e')]=this[_0xed67('0x1f')][_0xed67('0x1e')];}var _0x4fb541=this['channel'];if(_0x4fb541===_0xed67('0x20')){_0x240cf4[_0xed67('0x21')]=this['account']['id'];}else{_0x240cf4[_[_0xed67('0x22')](_0x4fb541)+_0xed67('0x23')]=this[_0xed67('0x24')]['id'];}_0x240cf4[_[_0xed67('0x22')](_0x4fb541)+'InteractionId']=this[_0xed67('0x1f')]['id'];if(this[_0xed67('0x1f')][_0xed67('0x25')]){var _0x451182=_0x52cd43[0x4];if(!_['isEmpty'](_0x451182)){_0x240cf4['body']=utils[_0xed67('0x26')](_0x451182,this);return rpc[_0x4fb541+_0xed67('0x9')][_0xed67('0xa')](_0x240cf4)['then'](function(_0x83653e){logger['info'](_0xed67('0xd'),_0x5b5b52,_0x240cf4[_0xed67('0xe')]);})[_0xed67('0xf')](function(_0x5e1edb){logger[_0xed67('0x10')](_0xed67('0xd'),_0x5b5b52,JSON[_0xed67('0x11')](_0x5e1edb));})[_0xed67('0x27')](function(){logger['info'](_0xed67('0x28'),_0x5b5b52);_0x433fde[_0xed67('0x29')]();});}else{logger[_0xed67('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5b5b52);_0x433fde[_0xed67('0x29')]();}}else{var _0x41d605=this;var _0x49e5e3=_0x52cd43[0x2][_0xed67('0x2a')](/\\n/g,'\x0a');var _0x545f3c={'credentials':{'private_key':_0x49e5e3,'client_email':_0x52cd43[0x1]}};var _0x15dcf8=new dialogflow[(_0xed67('0x2b'))](_0x545f3c);var _0x19869b=_0x15dcf8['sessionPath'](_0x52cd43[0x0],md5(_0x41d605[_0xed67('0x1f')]['id']));var _0x13e1a0={'session':_0x19869b,'queryInput':{'text':{'text':_0x41d605[_0xed67('0x2c')][_0xed67('0xe')],'languageCode':_0x52cd43[0x3]||'en'}}};return _0x15dcf8[_0xed67('0x2d')](_0x13e1a0)['then'](function(_0x2be5c2){if(_0x2be5c2&&_0x2be5c2[_0xed67('0x2e')]){_0x41d605[_0xed67('0xe')][_0xed67('0x2f')]=_0x2be5c2;var _0x3eca60=_0x2be5c2[0x0];var _0x376f94=_0x3eca60['queryResult'][_0xed67('0x30')]&&_0x3eca60[_0xed67('0x31')][_0xed67('0x30')][_0xed67('0x32')]?_0x3eca60[_0xed67('0x31')][_0xed67('0x30')][_0xed67('0x32')]['end_conversation'][_0xed67('0x33')]:![];_0x41d605[_0xed67('0xe')][_0xed67('0x34')]=_0x3eca60['queryResult'][_0xed67('0x35')];_0x41d605[_0xed67('0xe')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x3eca60['queryResult'][_0xed67('0x36')];_0x41d605[_0xed67('0xe')][_0xed67('0x37')]=_0x3eca60['queryResult']['diagnosticInfo']&&_0x3eca60[_0xed67('0x31')][_0xed67('0x30')][_0xed67('0x32')]?_0x3eca60[_0xed67('0x31')][_0xed67('0x30')][_0xed67('0x32')][_0xed67('0x38')][_0xed67('0x33')]:![];_0x41d605[_0xed67('0xe')][_0xed67('0x39')]=_0x3eca60[_0xed67('0x31')][_0xed67('0x3a')][_0xed67('0x3b')];_0x41d605['body'][_0xed67('0x3c')]=_0x3eca60['queryResult']['intent'][_0xed67('0x3d')];_0x41d605['body'][_0xed67('0x3e')]=_0x3eca60['queryResult'][_0xed67('0x3a')][_0xed67('0x3f')];_0x41d605[_0xed67('0xe')][_0xed67('0x40')]=_0x3eca60[_0xed67('0x31')][_0xed67('0x41')];_0x41d605[_0xed67('0xe')][_0xed67('0x42')]=_0x3eca60['queryResult']['queryText'];_0x41d605[_0xed67('0xe')][_0xed67('0x43')]=_0x3eca60['queryResult'][_0xed67('0x44')];_0x240cf4[_0xed67('0x45')]='dialogflowV2';_0x240cf4[_0xed67('0x46')]=JSON[_0xed67('0x11')](_0x2be5c2);var _0xc907cb=[];for(var _0x38035b=0x0;_0x38035b<_0x2be5c2['length'];_0x38035b++){var _0x222900=_0x2be5c2[_0x38035b];if(_0x222900&&_0x222900[_0xed67('0x31')]&&_0x222900['queryResult'][_0xed67('0x47')]){_0xc907cb[_0xed67('0x48')](createMessage(_0x5b5b52,_0x4fb541,_0x240cf4,_0x222900[_0xed67('0x31')][_0xed67('0x47')]));}}return Promise['all'](_0xc907cb)[_0xed67('0xb')](function(){if(_0x376f94){_0x433fde[_0xed67('0x16')]();}else{_0x433fde[_0xed67('0x29')]();}})[_0xed67('0xf')](function(_0x55ef59){logger[_0xed67('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b5b52,JSON['stringify'](_0x55ef59));_0x433fde[_0xed67('0x16')]();});}})['catch'](function(_0x3b0013){logger[_0xed67('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b5b52,_0x3b0013[_0xed67('0x2c')]);_0x433fde[_0xed67('0x16')]();});}}catch(_0x488e84){logger[_0xed67('0x10')](_0xed67('0xd'),_0x5b5b52,JSON['stringify'](_0x488e84));_0x433fde[_0xed67('0x29')]();}};}; \ No newline at end of file +var _0x0995=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','InteractionId','isEmpty','getMustacheRender','body','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','push','lodash','dialogflow','md5','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x1cc8d4,_0x4cb224){var _0x2a2d60=function(_0x1c3ff8){while(--_0x1c3ff8){_0x1cc8d4['push'](_0x1cc8d4['shift']());}};_0x2a2d60(++_0x4cb224);}(_0x0995,0x7f));var _0x5099=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0995[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5099('0x0'));var dialogflow=require(_0x5099('0x1'));var md5=require(_0x5099('0x2'));var moment=require('moment');var Promise=require(_0x5099('0x3'));var logger=require('../../../../config/logger')(_0x5099('0x4'));var utils=require(_0x5099('0x5'));var rpc={'chatMessage':require(_0x5099('0x6')),'openchannelMessage':require(_0x5099('0x7')),'mailMessage':require(_0x5099('0x8')),'smsMessage':require(_0x5099('0x9')),'faxMessage':require(_0x5099('0xa')),'whatsappMessage':require(_0x5099('0xb'))};function createMessage(_0x4d8737,_0x216bfc,_0x357aa4,_0x23672b){return new Promise(function(_0x58f088,_0x1998b4){var _0x42b3ba=_[_0x5099('0xc')](_0x357aa4);_0x42b3ba['body']=_0x23672b;return rpc[_0x216bfc+_0x5099('0xd')][_0x5099('0xe')](_0x42b3ba)[_0x5099('0xf')](function(){logger[_0x5099('0x10')](_0x5099('0x11'),_0x4d8737,_0x42b3ba['body']);_0x58f088();})[_0x5099('0x12')](function(_0x2fc5ad){logger[_0x5099('0x13')](_0x5099('0x11'),_0x4d8737,JSON['stringify'](_0x2fc5ad));_0x1998b4(_0x2fc5ad);});});}exports[_0x5099('0x14')]=function(_0x5dc932,_0x2f2afb){return function(_0xda0741){try{if(!_[_0x5099('0x15')](this[_0x5099('0x16')][_0x5099('0x17')])){logger[_0x5099('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x5dc932,_0x5099('0x18'));return _0xda0741[_0x5099('0x19')]();}var _0x52298b={'ContactId':this[_0x5099('0x1a')]['id'],'sentAt':moment()[_0x5099('0x1b')](_0x5099('0x1c')),'direction':_0x5099('0x1d')};if(this[_0x5099('0x1e')]===_0x5099('0x1f')||this['channel']===_0x5099('0x20')){_0x52298b['phone']=this[_0x5099('0x16')][_0x5099('0x21')];}var _0xec65b7=this[_0x5099('0x1e')];if(_0xec65b7===_0x5099('0x22')){_0x52298b[_0x5099('0x23')]=this['account']['id'];}else{_0x52298b[_[_0x5099('0x24')](_0xec65b7)+'AccountId']=this['account']['id'];}_0x52298b[_[_0x5099('0x24')](_0xec65b7)+_0x5099('0x25')]=this[_0x5099('0x16')]['id'];if(this[_0x5099('0x16')]['created']){var _0x5e8364=_0x2f2afb[0x4];if(!_[_0x5099('0x26')](_0x5e8364)){_0x52298b['body']=utils[_0x5099('0x27')](_0x5e8364,this);return rpc[_0xec65b7+_0x5099('0xd')][_0x5099('0xe')](_0x52298b)['then'](function(_0x4729fe){logger[_0x5099('0x10')](_0x5099('0x11'),_0x5dc932,_0x52298b[_0x5099('0x28')]);})['catch'](function(_0x5bb7b1){logger[_0x5099('0x13')](_0x5099('0x11'),_0x5dc932,JSON[_0x5099('0x29')](_0x5bb7b1));})[_0x5099('0x2a')](function(){logger[_0x5099('0x10')](_0x5099('0x2b'),_0x5dc932);_0xda0741[_0x5099('0x2c')]();});}else{logger[_0x5099('0x10')](_0x5099('0x2d'),_0x5dc932);_0xda0741['stop']();}}else{var _0x420f18=this;var _0x4ade9f=_0x2f2afb[0x2][_0x5099('0x2e')](/\\n/g,'\x0a');var _0x4d35c4={'credentials':{'private_key':_0x4ade9f,'client_email':_0x2f2afb[0x1]}};var _0x4dad68=new dialogflow['SessionsClient'](_0x4d35c4);var _0xe03e9a=_0x4dad68[_0x5099('0x2f')](_0x2f2afb[0x0],md5(_0x420f18[_0x5099('0x16')]['id']));var _0x556ec3={'session':_0xe03e9a,'queryInput':{'text':{'text':_0x420f18[_0x5099('0x30')][_0x5099('0x28')],'languageCode':_0x2f2afb[0x3]||'en'}}};return _0x4dad68[_0x5099('0x31')](_0x556ec3)[_0x5099('0xf')](function(_0x30ed46){if(_0x30ed46&&_0x30ed46[_0x5099('0x32')]){_0x420f18['body']['dialogflowV2']=_0x30ed46;var _0x2a3197=_0x30ed46[0x0];var _0x4d842c=_0x2a3197[_0x5099('0x33')][_0x5099('0x34')]&&_0x2a3197[_0x5099('0x33')]['diagnosticInfo'][_0x5099('0x35')]?_0x2a3197['queryResult'][_0x5099('0x34')][_0x5099('0x35')][_0x5099('0x36')]['boolValue']:![];_0x420f18[_0x5099('0x28')][_0x5099('0x37')]=_0x2a3197[_0x5099('0x33')][_0x5099('0x38')];_0x420f18['body'][_0x5099('0x39')]=_0x2a3197[_0x5099('0x33')][_0x5099('0x3a')];_0x420f18[_0x5099('0x28')][_0x5099('0x3b')]=_0x2a3197['queryResult'][_0x5099('0x34')]&&_0x2a3197[_0x5099('0x33')]['diagnosticInfo'][_0x5099('0x35')]?_0x2a3197[_0x5099('0x33')][_0x5099('0x34')][_0x5099('0x35')][_0x5099('0x36')][_0x5099('0x3c')]:![];_0x420f18[_0x5099('0x28')]['DIALOGFLOWV2_INTENTNAME']=_0x2a3197[_0x5099('0x33')][_0x5099('0x3d')][_0x5099('0x3e')];_0x420f18['body'][_0x5099('0x3f')]=_0x2a3197['queryResult'][_0x5099('0x3d')][_0x5099('0x40')];_0x420f18['body'][_0x5099('0x41')]=_0x2a3197[_0x5099('0x33')][_0x5099('0x3d')][_0x5099('0x42')];_0x420f18[_0x5099('0x28')]['DIALOGFLOWV2_LANGUAGECODE']=_0x2a3197[_0x5099('0x33')]['languageCode'];_0x420f18['body'][_0x5099('0x43')]=_0x2a3197['queryResult'][_0x5099('0x44')];_0x420f18[_0x5099('0x28')][_0x5099('0x45')]=_0x2a3197[_0x5099('0x33')][_0x5099('0x46')];_0x52298b[_0x5099('0x47')]=_0x5099('0x48');_0x52298b[_0x5099('0x49')]=JSON['stringify'](_0x30ed46);var _0x51fc69=[];for(var _0x73b31f=0x0;_0x73b31f<_0x30ed46[_0x5099('0x32')];_0x73b31f++){var _0x4e2c94=_0x30ed46[_0x73b31f];if(_0x4e2c94&&_0x4e2c94[_0x5099('0x33')]&&_0x4e2c94[_0x5099('0x33')][_0x5099('0x4a')]){_0x51fc69[_0x5099('0x4b')](createMessage(_0x5dc932,_0xec65b7,_0x52298b,_0x4e2c94[_0x5099('0x33')][_0x5099('0x4a')]));}}return Promise['all'](_0x51fc69)[_0x5099('0xf')](function(){if(_0x4d842c){_0xda0741['next']();}else{_0xda0741[_0x5099('0x2c')]();}})[_0x5099('0x12')](function(_0x1d3a0e){logger[_0x5099('0x13')](_0x5099('0x11'),_0x5dc932,JSON[_0x5099('0x29')](_0x1d3a0e));_0xda0741[_0x5099('0x19')]();});}})[_0x5099('0x12')](function(_0x298cdc){logger[_0x5099('0x13')](_0x5099('0x11'),_0x5dc932,_0x298cdc['message']);_0xda0741[_0x5099('0x19')]();});}}catch(_0xaa37e8){logger[_0x5099('0x13')](_0x5099('0x11'),_0x5dc932,JSON[_0x5099('0x29')](_0xaa37e8));_0xda0741[_0x5099('0x2c')]();}};}; \ 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 15d6472..9f0f1fe 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 _0xfafd=['priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','message','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x1134e4,_0x4eaa9e){var _0x3e476b=function(_0x57f631){while(--_0x57f631){_0x1134e4['push'](_0x1134e4['shift']());}};_0x3e476b(++_0x4eaa9e);}(_0xfafd,0xbb));var _0xdfaf=function(_0x3ea2f2,_0x18fba0){_0x3ea2f2=_0x3ea2f2-0x0;var _0x1ebd52=_0xfafd[_0x3ea2f2];return _0x1ebd52;};'use strict';var schema=require(_0xdfaf('0x0'));var _=require(_0xdfaf('0x1'));var htmlToText=require(_0xdfaf('0x2'));var utils=require(_0xdfaf('0x3'));var logger=require(_0xdfaf('0x4'))(_0xdfaf('0x5'));var gotoif=schema({'condition':{'type':_0xdfaf('0x6'),'required':!![],'message':_0xdfaf('0x7')},'priorityTrue':{'type':_0xdfaf('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xdfaf('0x8'),'message':_0xdfaf('0x9')}});exports[_0xdfaf('0xa')]=function(_0x4b0eba,_0x38e6c1){return function(_0x46cbfe){try{var _0x189b9c={'condition':htmlToText[_0xdfaf('0xb')](utils[_0xdfaf('0xc')](_0x38e6c1[0x0],this),{'wordwrap':![]})[_0xdfaf('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x38e6c1[0x1],'priorityFalse':_0x38e6c1[0x2]};var _0x499e64=gotoif[_0xdfaf('0x0')](_0x189b9c,{'typecast':!![]});if(_0x499e64[_0xdfaf('0xe')]){logger[_0xdfaf('0xf')]('[%s][GOTOIF]\x20%s',_0x4b0eba,_['map'](_0x499e64,_0xdfaf('0x10'))['join'](',\x20'));_0x46cbfe['stop']();}else{try{var _0x52ada6=eval('('+_0x189b9c['condition']+')');var _0x258f4d=_0x52ada6?_0x189b9c['priorityTrue']:_0x189b9c[_0xdfaf('0x11')];logger[_0xdfaf('0x12')](_0xdfaf('0x13'),_0x4b0eba,_0x189b9c[_0xdfaf('0x14')],_0x52ada6,_0x258f4d||_0xdfaf('0x15'));if(_0x258f4d){var _0x15afc4=_[_0xdfaf('0x16')](_0x46cbfe['rules'](),{'p':_0x258f4d});if(_0x15afc4>=0x0){logger[_0xdfaf('0x12')](_0xdfaf('0x17'),_0x4b0eba,_0x258f4d||_0xdfaf('0x15'),_0x15afc4);_0x46cbfe[_0xdfaf('0x15')](_0x15afc4);}else{logger[_0xdfaf('0x12')](_0xdfaf('0x18'),_0x4b0eba,_0x258f4d||_0xdfaf('0x15'));_0x46cbfe[_0xdfaf('0x19')]();}}else{_0x46cbfe[_0xdfaf('0x15')]();}}catch(_0xe51244){logger[_0xdfaf('0xf')](_0xdfaf('0x1a'),_0x4b0eba,_0xe51244['message']);_0x46cbfe['stop']();}}}catch(_0x33cdb8){logger[_0xdfaf('0xf')](_0xdfaf('0x1b'),_0x4b0eba,JSON['stringify'](_0x33cdb8));_0x46cbfe[_0xdfaf('0x19')]();}};}; \ No newline at end of file +var _0xc1d3=['routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','[%s][GOTOIF]\x20%s','join','stop','priorityTrue','info','condition','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','./utils'];(function(_0xcbee38,_0x344bc9){var _0x58f075=function(_0xa93df1){while(--_0xa93df1){_0xcbee38['push'](_0xcbee38['shift']());}};_0x58f075(++_0x344bc9);}(_0xc1d3,0x1cd));var _0x3c1d=function(_0x6dc950,_0x44dcec){_0x6dc950=_0x6dc950-0x0;var _0xb2d92b=_0xc1d3[_0x6dc950];return _0xb2d92b;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x3c1d('0x0'));var logger=require('../../../../config/logger')(_0x3c1d('0x1'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x3c1d('0x2')},'priorityTrue':{'type':_0x3c1d('0x3'),'message':_0x3c1d('0x4')},'priorityFalse':{'type':_0x3c1d('0x3'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x3c1d('0x5')]=function(_0x78e4b2,_0x2a6ffb){return function(_0x2f2deb){try{var _0x24a922={'condition':htmlToText[_0x3c1d('0x6')](utils[_0x3c1d('0x7')](_0x2a6ffb[0x0],this),{'wordwrap':![]})[_0x3c1d('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2a6ffb[0x1],'priorityFalse':_0x2a6ffb[0x2]};var _0x1b6c18=gotoif[_0x3c1d('0x9')](_0x24a922,{'typecast':!![]});if(_0x1b6c18[_0x3c1d('0xa')]){logger['error'](_0x3c1d('0xb'),_0x78e4b2,_['map'](_0x1b6c18,'message')[_0x3c1d('0xc')](',\x20'));_0x2f2deb[_0x3c1d('0xd')]();}else{try{var _0x228710=eval('('+_0x24a922['condition']+')');var _0x11286c=_0x228710?_0x24a922[_0x3c1d('0xe')]:_0x24a922['priorityFalse'];logger[_0x3c1d('0xf')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x78e4b2,_0x24a922[_0x3c1d('0x10')],_0x228710,_0x11286c||_0x3c1d('0x11'));if(_0x11286c){var _0x258683=_['findIndex'](_0x2f2deb['rules'](),{'p':_0x11286c});if(_0x258683>=0x0){logger[_0x3c1d('0xf')](_0x3c1d('0x12'),_0x78e4b2,_0x11286c||'next',_0x258683);_0x2f2deb[_0x3c1d('0x11')](_0x258683);}else{logger[_0x3c1d('0xf')](_0x3c1d('0x13'),_0x78e4b2,_0x11286c||_0x3c1d('0x11'));_0x2f2deb[_0x3c1d('0xd')]();}}else{_0x2f2deb[_0x3c1d('0x11')]();}}catch(_0x4a1c35){logger[_0x3c1d('0x14')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x78e4b2,_0x4a1c35['message']);_0x2f2deb['stop']();}}}catch(_0x5c3275){logger[_0x3c1d('0x14')](_0x3c1d('0xb'),_0x78e4b2,JSON[_0x3c1d('0x15')](_0x5c3275));_0x2f2deb['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 3b611df..d02e87f 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 _0x8a94=['[%s][GOTOP]\x20priority\x20%s','priority','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','join','stop'];(function(_0x5662f2,_0x550cb0){var _0x2469f5=function(_0x3baa0c){while(--_0x3baa0c){_0x5662f2['push'](_0x5662f2['shift']());}};_0x2469f5(++_0x550cb0);}(_0x8a94,0x1db));var _0x48a9=function(_0x5d6f14,_0x469f51){_0x5d6f14=_0x5d6f14-0x0;var _0x1ec141=_0x8a94[_0x5d6f14];return _0x1ec141;};'use strict';var schema=require(_0x48a9('0x0'));var _=require('lodash');var logger=require(_0x48a9('0x1'))(_0x48a9('0x2'));var gotop=schema({'priority':{'type':_0x48a9('0x3'),'required':!![],'message':_0x48a9('0x4')}});exports[_0x48a9('0x5')]=function(_0x4d4e83,_0x3c6d94){return function(_0x3488ff){try{var _0x215446={'priority':_0x3c6d94[0x0]};var _0x2dddd5=gotop[_0x48a9('0x0')](_0x215446,{'typecast':!![]});if(_0x2dddd5[_0x48a9('0x6')]){logger[_0x48a9('0x7')](_0x48a9('0x8'),_0x4d4e83,_['map'](_0x2dddd5,'message')[_0x48a9('0x9')](',\x20'));_0x3488ff[_0x48a9('0xa')]();}else{logger['info'](_0x48a9('0xb'),_0x4d4e83,_0x215446[_0x48a9('0xc')]);if(_0x215446[_0x48a9('0xc')]){var _0x341aed=_['findIndex'](_0x3488ff[_0x48a9('0xd')](),{'p':_0x215446[_0x48a9('0xc')]});if(_0x341aed>=0x0){logger[_0x48a9('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4d4e83,_0x215446['priority']||_0x48a9('0xf'),_0x341aed);_0x3488ff[_0x48a9('0xf')](_0x341aed);}else{logger[_0x48a9('0xe')](_0x48a9('0x10'),_0x4d4e83,_0x215446[_0x48a9('0xc')]||'next');_0x3488ff[_0x48a9('0xa')]();}}else{_0x3488ff[_0x48a9('0xf')]();}}}catch(_0x3e4fd3){logger[_0x48a9('0x7')]('[%s][GOTOP]\x20%s',_0x4d4e83,JSON[_0x48a9('0x11')](_0x3e4fd3));_0x3488ff['stop']();}};}; \ No newline at end of file +var _0x8bd4=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','length','error','map','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x3c2901,_0x14f016){var _0x3b8ad5=function(_0x457823){while(--_0x457823){_0x3c2901['push'](_0x3c2901['shift']());}};_0x3b8ad5(++_0x14f016);}(_0x8bd4,0xa5));var _0x48bd=function(_0x32b802,_0x5ec65c){_0x32b802=_0x32b802-0x0;var _0x3b1cb6=_0x8bd4[_0x32b802];return _0x3b1cb6;};'use strict';var schema=require(_0x48bd('0x0'));var _=require(_0x48bd('0x1'));var logger=require(_0x48bd('0x2'))(_0x48bd('0x3'));var gotop=schema({'priority':{'type':_0x48bd('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x48cc9e,_0xc6c131){return function(_0x2596c8){try{var _0x384748={'priority':_0xc6c131[0x0]};var _0x412a2f=gotop[_0x48bd('0x0')](_0x384748,{'typecast':!![]});if(_0x412a2f[_0x48bd('0x5')]){logger[_0x48bd('0x6')]('[%s][GOTOP]\x20%s',_0x48cc9e,_[_0x48bd('0x7')](_0x412a2f,_0x48bd('0x8'))['join'](',\x20'));_0x2596c8[_0x48bd('0x9')]();}else{logger[_0x48bd('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x48cc9e,_0x384748[_0x48bd('0xb')]);if(_0x384748[_0x48bd('0xb')]){var _0x4817d2=_[_0x48bd('0xc')](_0x2596c8[_0x48bd('0xd')](),{'p':_0x384748[_0x48bd('0xb')]});if(_0x4817d2>=0x0){logger[_0x48bd('0xa')](_0x48bd('0xe'),_0x48cc9e,_0x384748['priority']||_0x48bd('0xf'),_0x4817d2);_0x2596c8[_0x48bd('0xf')](_0x4817d2);}else{logger[_0x48bd('0xa')](_0x48bd('0x10'),_0x48cc9e,_0x384748[_0x48bd('0xb')]||_0x48bd('0xf'));_0x2596c8['stop']();}}else{_0x2596c8[_0x48bd('0xf')]();}}}catch(_0xf5aa34){logger[_0x48bd('0x6')]('[%s][GOTOP]\x20%s',_0x48cc9e,JSON[_0x48bd('0x11')](_0xf5aa34));_0x2596c8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 1055256..cae0930 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 _0x6222=['stringify','error','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','then','[%s][MESSAGE]\x20%s','next'];(function(_0x239c9c,_0x2ef253){var _0x4a471d=function(_0x3136a4){while(--_0x3136a4){_0x239c9c['push'](_0x239c9c['shift']());}};_0x4a471d(++_0x2ef253);}(_0x6222,0x9a));var _0x2622=function(_0x41cd51,_0x48c5f6){_0x41cd51=_0x41cd51-0x0;var _0x292bc5=_0x6222[_0x41cd51];return _0x292bc5;};'use strict';var _=require('lodash');var utils=require(_0x2622('0x0'));var logger=require(_0x2622('0x1'))('routing');var rpc={'chatMessage':require(_0x2622('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2622('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x2622('0x4')]=function(_0x3a9e1f,_0x5e8379){return function(_0xf70ae5){try{var _0x1787e2={'body':utils['getMustacheRender'](_0x5e8379[0x0],this),'ContactId':this[_0x2622('0x5')]['id']};if(this[_0x2622('0x6')]===_0x2622('0x7')){_0x1787e2[_0x2622('0x8')]=this[_0x2622('0x9')]['id'];}else{_0x1787e2[_[_0x2622('0xa')](this[_0x2622('0x6')])+_0x2622('0xb')]=this['account']['id'];}_0x1787e2[_[_0x2622('0xa')](this[_0x2622('0x6')])+_0x2622('0xc')]=this['interaction']['id'];if(rpc[this[_0x2622('0x6')]+_0x2622('0xd')]){return rpc[this[_0x2622('0x6')]+_0x2622('0xd')]['create'](_0x1787e2)[_0x2622('0xe')](function(_0x12b323){logger['info'](_0x2622('0xf'),_0x3a9e1f,_0x1787e2['body']);_0xf70ae5[_0x2622('0x10')]();})['catch'](function(_0x434882){logger['error'](_0x2622('0xf'),_0x3a9e1f,JSON[_0x2622('0x11')](_0x434882));_0xf70ae5['stop']();});}}catch(_0x1308db){logger[_0x2622('0x12')](_0x2622('0xf'),_0x3a9e1f,JSON['stringify'](_0x1308db));_0xf70ae5['stop']();}};}; \ No newline at end of file +var _0x9a67=['../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9a67,0x117));var _0x79a6=function(_0x1ace11,_0x517404){_0x1ace11=_0x1ace11-0x0;var _0x41d5e9=_0x9a67[_0x1ace11];return _0x41d5e9;};'use strict';var _=require(_0x79a6('0x0'));var utils=require(_0x79a6('0x1'));var logger=require(_0x79a6('0x2'))(_0x79a6('0x3'));var rpc={'chatMessage':require(_0x79a6('0x4')),'openchannelMessage':require(_0x79a6('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x79a6('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x79a6('0x7'))};exports[_0x79a6('0x8')]=function(_0x11d85f,_0x2ad64e){return function(_0x38b7a6){try{var _0x29ca9f={'body':utils[_0x79a6('0x9')](_0x2ad64e[0x0],this),'ContactId':this[_0x79a6('0xa')]['id']};if(this[_0x79a6('0xb')]===_0x79a6('0xc')){_0x29ca9f[_0x79a6('0xd')]=this[_0x79a6('0xe')]['id'];}else{_0x29ca9f[_[_0x79a6('0xf')](this[_0x79a6('0xb')])+_0x79a6('0x10')]=this[_0x79a6('0xe')]['id'];}_0x29ca9f[_['upperFirst'](this[_0x79a6('0xb')])+'InteractionId']=this[_0x79a6('0x11')]['id'];if(rpc[this[_0x79a6('0xb')]+_0x79a6('0x12')]){return rpc[this[_0x79a6('0xb')]+_0x79a6('0x12')]['create'](_0x29ca9f)[_0x79a6('0x13')](function(_0x55f68b){logger[_0x79a6('0x14')](_0x79a6('0x15'),_0x11d85f,_0x29ca9f[_0x79a6('0x16')]);_0x38b7a6['next']();})['catch'](function(_0x320b3c){logger[_0x79a6('0x17')]('[%s][MESSAGE]\x20%s',_0x11d85f,JSON[_0x79a6('0x18')](_0x320b3c));_0x38b7a6[_0x79a6('0x19')]();});}}catch(_0x1d2b4f){logger[_0x79a6('0x17')](_0x79a6('0x15'),_0x11d85f,JSON['stringify'](_0x1d2b4f));_0x38b7a6[_0x79a6('0x19')]();}};}; \ 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 7daa01c..29df12c 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 _0x6d53=['[%s][NOOP]\x20%s','stop','./utils','../../../../config/logger','consequence','info','getMustacheRender','error'];(function(_0x3b2be5,_0x9c01ae){var _0x14cd8=function(_0x5262be){while(--_0x5262be){_0x3b2be5['push'](_0x3b2be5['shift']());}};_0x14cd8(++_0x9c01ae);}(_0x6d53,0x17a));var _0x36d5=function(_0x14562a,_0x4dbda8){_0x14562a=_0x14562a-0x0;var _0x7856af=_0x6d53[_0x14562a];return _0x7856af;};'use strict';var utils=require(_0x36d5('0x0'));var logger=require(_0x36d5('0x1'))('routing');exports[_0x36d5('0x2')]=function(_0x33b3d9,_0x189616){return function(_0x4a25fd){try{logger[_0x36d5('0x3')]('[%s][NOOP]\x20%s',_0x33b3d9,utils[_0x36d5('0x4')](_0x189616[0x0],this));_0x4a25fd['next']();}catch(_0x528248){logger[_0x36d5('0x5')](_0x36d5('0x6'),_0x33b3d9,JSON['stringify'](_0x528248));_0x4a25fd[_0x36d5('0x7')]();}};}; \ No newline at end of file +var _0x89bc=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x3340bd,_0x23edd5){var _0x139b34=function(_0x2b1f9c){while(--_0x2b1f9c){_0x3340bd['push'](_0x3340bd['shift']());}};_0x139b34(++_0x23edd5);}(_0x89bc,0x1ec));var _0xc89b=function(_0x51e5bd,_0x3c2cf1){_0x51e5bd=_0x51e5bd-0x0;var _0x250aed=_0x89bc[_0x51e5bd];return _0x250aed;};'use strict';var utils=require(_0xc89b('0x0'));var logger=require(_0xc89b('0x1'))(_0xc89b('0x2'));exports[_0xc89b('0x3')]=function(_0x421586,_0x48fb1e){return function(_0x301d7c){try{logger[_0xc89b('0x4')](_0xc89b('0x5'),_0x421586,utils[_0xc89b('0x6')](_0x48fb1e[0x0],this));_0x301d7c[_0xc89b('0x7')]();}catch(_0x16ff3a){logger[_0xc89b('0x8')](_0xc89b('0x5'),_0x421586,JSON[_0xc89b('0x9')](_0x16ff3a));_0x301d7c[_0xc89b('0xa')]();}};}; \ 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 0c930ce..c2fd45d 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 _0xeb97=['seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','WebsiteId','info','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util'];(function(_0xdb4b94,_0x40bb81){var _0x4824a0=function(_0x2d1dee){while(--_0x2d1dee){_0xdb4b94['push'](_0xdb4b94['shift']());}};_0x4824a0(++_0x40bb81);}(_0xeb97,0x97));var _0x7eb9=function(_0x42e447,_0x10f1ba){_0x42e447=_0x42e447-0x0;var _0x4753ff=_0xeb97[_0x42e447];return _0x4753ff;};'use strict';var schema=require(_0x7eb9('0x0'));var _=require(_0x7eb9('0x1'));var util=require(_0x7eb9('0x2'));var seqqueue=require(_0x7eb9('0x3'));var moment=require(_0x7eb9('0x4'));var Redis=require(_0x7eb9('0x5'));var config=require(_0x7eb9('0x6'));var logger=require(_0x7eb9('0x7'))(_0x7eb9('0x8'));var strategy=require(_0x7eb9('0x9'));config['redis']=_['defaults'](config[_0x7eb9('0xa')],{'host':_0x7eb9('0xb'),'port':0x18eb});var io=require(_0x7eb9('0xc'))(new Redis(config['redis']));var attributes=['id',_0x7eb9('0xd'),_0x7eb9('0xe'),_0x7eb9('0xf'),_0x7eb9('0x10'),'joinAt'];function emit(_0xba7a79,_0x240f8e,_0x372122){io['to'](_0xba7a79)[_0x7eb9('0x11')](_0x240f8e,_0x372122);}function emitChannelQueueInteraction(_0x49a226,_0x5722c4,_0x247e2e,_0x5ee6ad,_0x931e8c,_0x42849a,_0x3304b0,_0x18c1f4){var _0x35fd7a=_[_0x7eb9('0x12')](_0x247e2e);_0x35fd7a['queue_id']=_0x18c1f4;_0x35fd7a['queue']=_0x5722c4;_0x35fd7a[_0x7eb9('0xe')]=_0x5ee6ad;_0x35fd7a['id']=_0x931e8c;if(_0x42849a){_0x3304b0[util[_0x7eb9('0x13')](_0x7eb9('0x14'),_0x49a226)][_0x931e8c]=_[_0x7eb9('0x15')](_0x35fd7a,attributes);}else{delete _0x3304b0[util[_0x7eb9('0x13')](_0x7eb9('0x14'),_0x49a226)][_0x931e8c];}emit(util[_0x7eb9('0x13')](_0x7eb9('0x16'),_0x49a226,_0x5722c4),util[_0x7eb9('0x13')](_0x7eb9('0x17'),_0x49a226,_0x42849a?_0x7eb9('0x18'):'remove'),_[_0x7eb9('0x15')](_0x35fd7a,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7eb9('0x19')),'chatQueueReport':require(_0x7eb9('0x1a')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7eb9('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7eb9('0x1c'),'required':!![],'message':_0x7eb9('0x1d')},'timeout':{'type':'number','message':_0x7eb9('0x1e')}});function startRouting(_0x1619b4,_0x4443d4,_0x57bbcf,_0x223104){if(_0x1619b4&&_0x4443d4&&_0x57bbcf){_0x4443d4[_0x7eb9('0x1f')]+=0x1;var _0xf03611={'uniqueid':_0x1619b4,'from':_0x57bbcf[_0x7eb9('0x20')]?_0x57bbcf[_0x7eb9('0x20')][_0x7eb9('0x10')]:'','joinAt':moment()['format'](_0x7eb9('0x21')),'ContactId':_0x57bbcf['contact']?_0x57bbcf[_0x7eb9('0x22')]['id']:null,'ListId':_0x57bbcf[_0x7eb9('0x23')]?_0x57bbcf['list']['id']:null};_0xf03611[_['upperFirst'](_0x57bbcf['channel'])+'QueueId']=_0x4443d4['id']||null;_0xf03611[_[_0x7eb9('0x24')](_0x57bbcf[_0x7eb9('0x25')])+_0x7eb9('0x26')]=_0x57bbcf[_0x7eb9('0x27')]?_0x57bbcf[_0x7eb9('0x27')]['id']:null;_0xf03611[_[_0x7eb9('0x24')](_0x57bbcf[_0x7eb9('0x25')])+_0x7eb9('0x28')]=_0x57bbcf[_0x7eb9('0x29')]?_0x57bbcf[_0x7eb9('0x29')]['id']:null;_0xf03611[_[_0x7eb9('0x24')](_0x57bbcf['channel'])+(_0x57bbcf[_0x7eb9('0x25')]!=='chat'?'AccountId':_0x7eb9('0x2a'))]=_0x57bbcf[_0x7eb9('0xe')]?_0x57bbcf[_0x7eb9('0xe')]['id']:null;logger[_0x7eb9('0x2b')](util[_0x7eb9('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x1619b4,_0x4443d4[_0x7eb9('0x2c')]));emitChannelQueueInteraction(_0x57bbcf[_0x7eb9('0x25')],_0x4443d4[_0x7eb9('0x2c')],_0xf03611,_0x57bbcf['account'][_0x7eb9('0x2c')],_0x57bbcf['message']['id'],!![],_0x223104,_0x4443d4['id']);if(rpc[_0x57bbcf[_0x7eb9('0x25')]+_0x7eb9('0x2d')]){return rpc[_0x57bbcf[_0x7eb9('0x25')]+_0x7eb9('0x2d')]['create'](_0xf03611)[_0x7eb9('0x2e')](function(_0x474aeb){logger[_0x7eb9('0x2f')](_0x7eb9('0x30'));});}}}function stopRouting(_0x36b8f4,_0x42e30e,_0x468867,_0xd93d1c){if(_0x36b8f4&&_0x42e30e){_0x42e30e['waiting']-=0x1;var _0x157938={'leaveAt':moment()[_0x7eb9('0x13')](_0x7eb9('0x21')),'acceptAt':moment()[_0x7eb9('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7eb9('0x31')};logger[_0x7eb9('0x2b')](util[_0x7eb9('0x13')](_0x7eb9('0x32'),_0x36b8f4,_0x42e30e['name']));emitChannelQueueInteraction(_0x468867[_0x7eb9('0x25')],_0x42e30e['name'],_0x468867['body'],_0x468867[_0x7eb9('0xe')][_0x7eb9('0x2c')],_0x468867[_0x7eb9('0x29')]['id'],![],_0xd93d1c,_0x42e30e['id']);if(rpc[_0x468867[_0x7eb9('0x25')]+_0x7eb9('0x2d')]){return rpc[_0x468867[_0x7eb9('0x25')]+_0x7eb9('0x2d')][_0x7eb9('0x33')](_0x36b8f4,_0x157938)['catch'](function(_0xe046b8){logger['error'](_0x7eb9('0x34'));});}}}function endRouting(_0xda5952,_0x295dc9,_0x1647e2,_0x2d023a){if(_0xda5952&&_0x295dc9){_0x295dc9[_0x7eb9('0x1f')]-=0x1;var _0x278de0={'leaveAt':moment()[_0x7eb9('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x7eb9('0x21')),'reason':_0x7eb9('0x35')};logger[_0x7eb9('0x2b')](util['format']('[%s][END:QUEUE][NAME:%s]',_0xda5952,_0x295dc9['name']));emitChannelQueueInteraction(_0x1647e2[_0x7eb9('0x25')],_0x295dc9[_0x7eb9('0x2c')],_0x1647e2['body'],_0x1647e2[_0x7eb9('0xe')][_0x7eb9('0x2c')],_0x1647e2[_0x7eb9('0x29')]['id'],![],_0x2d023a);if(rpc[_0x1647e2[_0x7eb9('0x25')]+_0x7eb9('0x2d')]){return rpc[_0x1647e2[_0x7eb9('0x25')]+'QueueReport'][_0x7eb9('0x33')](_0xda5952,_0x278de0)['catch'](function(_0x1dcf5d){logger[_0x7eb9('0x2f')](_0x7eb9('0x34'));});}}}function handleFindQueue(_0x4d20f1){return function(_0x11c3d7){return _0x11c3d7[_0x7eb9('0x2c')][_0x7eb9('0x36')]()===_0x4d20f1[_0x7eb9('0x36')]();};}exports[_0x7eb9('0x37')]=function(_0x3584c7,_0x3eef8e,_0x5d2bac,_0xa83a42){return function(_0x1cb46a){try{var _0x996f21={'name':_0x3eef8e[0x0],'timeout':_0x3eef8e[0x1]};var _0x49af73=queue[_0x7eb9('0x0')](_0x996f21,{'typecast':!![]});if(_0x49af73[_0x7eb9('0x38')]){logger[_0x7eb9('0x2f')](_0x7eb9('0x39'),_0x3584c7,_[_0x7eb9('0x3a')](_0x49af73,_0x7eb9('0x29'))[_0x7eb9('0x3b')](',\x20'));_0x1cb46a[_0x7eb9('0x3c')]();}else{var _0x220ef2=_[_0x7eb9('0x3d')](_0x5d2bac[_0xa83a42[_0x7eb9('0x25')]+'Queues'],handleFindQueue(_0x996f21['name']));if(_0x220ef2){startRouting(_0x3584c7,_0x220ef2,_0xa83a42,_0x5d2bac);var _0x4bfd03=(_0x220ef2['timeout']||0xa)*0x3e8;var _0x4a632a=(_0x996f21[_0x7eb9('0x35')]||0x14)*0x3e8;var _0x4e917f,_0x28be7c;if(_0x4bfd03>_0x4a632a){_0x4a632a=_0x4bfd03;}var _0x528b69=seqqueue[_0x7eb9('0x3e')](_0x4bfd03);_0x528b69['id']=_0x3584c7;_0x528b69[_0x7eb9('0x3f')]=_0x4bfd03;_0x528b69[_0x7eb9('0x40')]=_0x4a632a;_0x528b69[_0x7eb9('0x25')]=_0xa83a42[_0x7eb9('0x25')];_0x5d2bac[_0x7eb9('0x41')][_0x3584c7]['on'](_0x7eb9('0x42'),function(){logger[_0x7eb9('0x2b')](_0x7eb9('0x43'),_0x3584c7);stopRouting(_0x3584c7,_0x220ef2,_0xa83a42,_0x5d2bac);clearTimeout(_0x4e917f);_0x4e917f=undefined;_0x528b69[_0x7eb9('0x44')](!![]);if(_0x5d2bac[_0x7eb9('0x41')][_0x3584c7]){delete _0x5d2bac[_0x7eb9('0x41')][_0x3584c7];}_0x1cb46a[_0x7eb9('0x3c')]();});_0x5d2bac[_0x7eb9('0x41')][_0x3584c7]['on'](_0x7eb9('0x45'),function(){if(_0x5d2bac['rules'][_0x3584c7]){delete _0x5d2bac[_0x7eb9('0x41')][_0x3584c7];}});_0x4e917f=setTimeout(function(){logger[_0x7eb9('0x2b')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x3584c7);endRouting(_0x3584c7,_0x220ef2,_0xa83a42,_0x5d2bac);clearTimeout(_0x4e917f);_0x528b69[_0x7eb9('0x44')](!![]);_0x1cb46a[_0x7eb9('0x46')]();},_0x4a632a);switch(_0x220ef2[_0x7eb9('0x47')]){case _0x7eb9('0x48'):strategy['rrmemory'](_0x528b69,_0x220ef2,_0x5d2bac,_0xa83a42);break;default:strategy[_0x7eb9('0x49')](_0x528b69,_0x220ef2,_0x5d2bac,_0xa83a42);}}else{logger[_0x7eb9('0x2f')](_0x7eb9('0x4a'),_0x3584c7,_0x996f21['name']);_0x1cb46a[_0x7eb9('0x3c')]();}}}catch(_0x4121a6){console[_0x7eb9('0x4b')](_0x4121a6);logger[_0x7eb9('0x2f')]('[%s][QUEUE]\x20%s',_0x3584c7,_0x4121a6[_0x7eb9('0x4c')]);_0x1cb46a[_0x7eb9('0x3c')]();}};}; \ No newline at end of file +var _0x2b44=['pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','accepted','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','from','joinAt','emit','queue','format','%sQueuesWaitingInteractions'];(function(_0x4206bd,_0x3ebd6c){var _0x3507d7=function(_0x33424a){while(--_0x33424a){_0x4206bd['push'](_0x4206bd['shift']());}};_0x3507d7(++_0x3ebd6c);}(_0x2b44,0x84));var _0x42b4=function(_0x354070,_0xf51436){_0x354070=_0x354070-0x0;var _0xc7aee2=_0x2b44[_0x354070];return _0xc7aee2;};'use strict';var schema=require(_0x42b4('0x0'));var _=require(_0x42b4('0x1'));var util=require(_0x42b4('0x2'));var seqqueue=require(_0x42b4('0x3'));var moment=require(_0x42b4('0x4'));var Redis=require('ioredis');var config=require(_0x42b4('0x5'));var logger=require(_0x42b4('0x6'))(_0x42b4('0x7'));var strategy=require(_0x42b4('0x8'));config[_0x42b4('0x9')]=_[_0x42b4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x42b4('0xb'))(new Redis(config[_0x42b4('0x9')]));var attributes=['id',_0x42b4('0xc'),_0x42b4('0xd'),'queue',_0x42b4('0xe'),_0x42b4('0xf')];function emit(_0x4c1f6d,_0xb6b4dd,_0x2b18df){io['to'](_0x4c1f6d)[_0x42b4('0x10')](_0xb6b4dd,_0x2b18df);}function emitChannelQueueInteraction(_0x16ebbd,_0x575b5e,_0x134512,_0x2af9ce,_0xdc0f1e,_0x3f97a3,_0x392519,_0xa2db7f){var _0x29471e=_['clone'](_0x134512);_0x29471e['queue_id']=_0xa2db7f;_0x29471e[_0x42b4('0x11')]=_0x575b5e;_0x29471e[_0x42b4('0xd')]=_0x2af9ce;_0x29471e['id']=_0xdc0f1e;if(_0x3f97a3){_0x392519[util[_0x42b4('0x12')](_0x42b4('0x13'),_0x16ebbd)][_0xdc0f1e]=_[_0x42b4('0x14')](_0x29471e,attributes);}else{delete _0x392519[util[_0x42b4('0x12')](_0x42b4('0x13'),_0x16ebbd)][_0xdc0f1e];}emit(util[_0x42b4('0x12')](_0x42b4('0x15'),_0x16ebbd,_0x575b5e),util[_0x42b4('0x12')](_0x42b4('0x16'),_0x16ebbd,_0x3f97a3?_0x42b4('0x17'):'remove'),_[_0x42b4('0x14')](_0x29471e,attributes));}var rpc={'openchannelQueueReport':require(_0x42b4('0x18')),'mailQueueReport':require(_0x42b4('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x42b4('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x42b4('0x1b'))};var queue=schema({'name':{'type':_0x42b4('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x42b4('0x1d'),'message':_0x42b4('0x1e')}});function startRouting(_0x472d84,_0x53b663,_0x5160bd,_0x8ffb5){if(_0x472d84&&_0x53b663&&_0x5160bd){_0x53b663[_0x42b4('0x1f')]+=0x1;var _0x1e91d4={'uniqueid':_0x472d84,'from':_0x5160bd[_0x42b4('0x20')]?_0x5160bd[_0x42b4('0x20')][_0x42b4('0xe')]:'','joinAt':moment()[_0x42b4('0x12')](_0x42b4('0x21')),'ContactId':_0x5160bd['contact']?_0x5160bd[_0x42b4('0x22')]['id']:null,'ListId':_0x5160bd[_0x42b4('0x23')]?_0x5160bd[_0x42b4('0x23')]['id']:null};_0x1e91d4[_[_0x42b4('0x24')](_0x5160bd[_0x42b4('0x25')])+_0x42b4('0x26')]=_0x53b663['id']||null;_0x1e91d4[_['upperFirst'](_0x5160bd[_0x42b4('0x25')])+_0x42b4('0x27')]=_0x5160bd[_0x42b4('0x28')]?_0x5160bd['interaction']['id']:null;_0x1e91d4[_['upperFirst'](_0x5160bd[_0x42b4('0x25')])+_0x42b4('0x29')]=_0x5160bd[_0x42b4('0x2a')]?_0x5160bd[_0x42b4('0x2a')]['id']:null;_0x1e91d4[_[_0x42b4('0x24')](_0x5160bd['channel'])+(_0x5160bd[_0x42b4('0x25')]!=='chat'?_0x42b4('0x2b'):_0x42b4('0x2c'))]=_0x5160bd['account']?_0x5160bd[_0x42b4('0xd')]['id']:null;logger[_0x42b4('0x2d')](util['format'](_0x42b4('0x2e'),_0x472d84,_0x53b663[_0x42b4('0x2f')]));emitChannelQueueInteraction(_0x5160bd[_0x42b4('0x25')],_0x53b663[_0x42b4('0x2f')],_0x1e91d4,_0x5160bd[_0x42b4('0xd')][_0x42b4('0x2f')],_0x5160bd[_0x42b4('0x2a')]['id'],!![],_0x8ffb5,_0x53b663['id']);if(rpc[_0x5160bd['channel']+_0x42b4('0x30')]){return rpc[_0x5160bd[_0x42b4('0x25')]+'QueueReport']['create'](_0x1e91d4)[_0x42b4('0x31')](function(_0x528b7f){logger[_0x42b4('0x32')]('create\x20queue\x20report');});}}}function stopRouting(_0x20f5da,_0x2783ff,_0x3c8bd6,_0x263162){if(_0x20f5da&&_0x2783ff){_0x2783ff['waiting']-=0x1;var _0x5a291c={'leaveAt':moment()[_0x42b4('0x12')](_0x42b4('0x21')),'acceptAt':moment()['format'](_0x42b4('0x21')),'reason':_0x42b4('0x33')};logger[_0x42b4('0x2d')](util[_0x42b4('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x20f5da,_0x2783ff[_0x42b4('0x2f')]));emitChannelQueueInteraction(_0x3c8bd6[_0x42b4('0x25')],_0x2783ff[_0x42b4('0x2f')],_0x3c8bd6[_0x42b4('0x20')],_0x3c8bd6['account'][_0x42b4('0x2f')],_0x3c8bd6['message']['id'],![],_0x263162,_0x2783ff['id']);if(rpc[_0x3c8bd6[_0x42b4('0x25')]+_0x42b4('0x30')]){return rpc[_0x3c8bd6[_0x42b4('0x25')]+_0x42b4('0x30')][_0x42b4('0x34')](_0x20f5da,_0x5a291c)['catch'](function(_0x7efc73){logger['error'](_0x42b4('0x35'));});}}}function endRouting(_0x7c8f21,_0x12070a,_0xaa427a,_0x3ec522){if(_0x7c8f21&&_0x12070a){_0x12070a['waiting']-=0x1;var _0x515917={'leaveAt':moment()[_0x42b4('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x42b4('0x12')](_0x42b4('0x21')),'reason':_0x42b4('0x36')};logger[_0x42b4('0x2d')](util['format'](_0x42b4('0x37'),_0x7c8f21,_0x12070a[_0x42b4('0x2f')]));emitChannelQueueInteraction(_0xaa427a[_0x42b4('0x25')],_0x12070a[_0x42b4('0x2f')],_0xaa427a[_0x42b4('0x20')],_0xaa427a[_0x42b4('0xd')]['name'],_0xaa427a[_0x42b4('0x2a')]['id'],![],_0x3ec522);if(rpc[_0xaa427a[_0x42b4('0x25')]+'QueueReport']){return rpc[_0xaa427a[_0x42b4('0x25')]+_0x42b4('0x30')][_0x42b4('0x34')](_0x7c8f21,_0x515917)[_0x42b4('0x31')](function(_0x34b90e){logger[_0x42b4('0x32')](_0x42b4('0x35'));});}}}function handleFindQueue(_0x288747){return function(_0x2efbc4){return _0x2efbc4[_0x42b4('0x2f')][_0x42b4('0x38')]()===_0x288747[_0x42b4('0x38')]();};}exports[_0x42b4('0x39')]=function(_0x154f28,_0x516626,_0x1e79df,_0x336a14){return function(_0xd04b1c){try{var _0x5f3ce8={'name':_0x516626[0x0],'timeout':_0x516626[0x1]};var _0x2eb54f=queue['validate'](_0x5f3ce8,{'typecast':!![]});if(_0x2eb54f[_0x42b4('0x3a')]){logger[_0x42b4('0x32')](_0x42b4('0x3b'),_0x154f28,_['map'](_0x2eb54f,_0x42b4('0x2a'))[_0x42b4('0x3c')](',\x20'));_0xd04b1c[_0x42b4('0x3d')]();}else{var _0x22a841=_[_0x42b4('0x3e')](_0x1e79df[_0x336a14[_0x42b4('0x25')]+'Queues'],handleFindQueue(_0x5f3ce8[_0x42b4('0x2f')]));if(_0x22a841){startRouting(_0x154f28,_0x22a841,_0x336a14,_0x1e79df);var _0x332cc3=(_0x22a841['timeout']||0xa)*0x3e8;var _0x5f22f6=(_0x5f3ce8[_0x42b4('0x36')]||0x14)*0x3e8;var _0x15db6e,_0x529cd0;if(_0x332cc3>_0x5f22f6){_0x5f22f6=_0x332cc3;}var _0x4c1873=seqqueue[_0x42b4('0x3f')](_0x332cc3);_0x4c1873['id']=_0x154f28;_0x4c1873[_0x42b4('0x40')]=_0x332cc3;_0x4c1873[_0x42b4('0x41')]=_0x5f22f6;_0x4c1873[_0x42b4('0x25')]=_0x336a14[_0x42b4('0x25')];_0x1e79df[_0x42b4('0x42')][_0x154f28]['on'](_0x42b4('0x43'),function(){logger[_0x42b4('0x2d')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x154f28);stopRouting(_0x154f28,_0x22a841,_0x336a14,_0x1e79df);clearTimeout(_0x15db6e);_0x15db6e=undefined;_0x4c1873[_0x42b4('0x44')](!![]);if(_0x1e79df[_0x42b4('0x42')][_0x154f28]){delete _0x1e79df[_0x42b4('0x42')][_0x154f28];}_0xd04b1c[_0x42b4('0x3d')]();});_0x1e79df[_0x42b4('0x42')][_0x154f28]['on'](_0x42b4('0x45'),function(){if(_0x1e79df['rules'][_0x154f28]){delete _0x1e79df[_0x42b4('0x42')][_0x154f28];}});_0x15db6e=setTimeout(function(){logger[_0x42b4('0x2d')](_0x42b4('0x46'),_0x154f28);endRouting(_0x154f28,_0x22a841,_0x336a14,_0x1e79df);clearTimeout(_0x15db6e);_0x4c1873[_0x42b4('0x44')](!![]);_0xd04b1c[_0x42b4('0x47')]();},_0x5f22f6);switch(_0x22a841[_0x42b4('0x48')]){case _0x42b4('0x49'):strategy[_0x42b4('0x49')](_0x4c1873,_0x22a841,_0x1e79df,_0x336a14);break;default:strategy[_0x42b4('0x4a')](_0x4c1873,_0x22a841,_0x1e79df,_0x336a14);}}else{logger[_0x42b4('0x32')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x154f28,_0x5f3ce8[_0x42b4('0x2f')]);_0xd04b1c['stop']();}}}catch(_0x484a84){console['log'](_0x484a84);logger[_0x42b4('0x32')](_0x42b4('0x3b'),_0x154f28,_0x484a84[_0x42b4('0x4b')]);_0xd04b1c['stop']();}};}; \ 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 2a3c475..9cd3f89 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 _0x2b64=['busy','busyQueue','STOP','lodash','uuid','./util','routing','notificationId','squeue','realtime','push','handleTimeout','bind','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','showNotification','writeLog',':FORCED','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x2b64,0x7b));var _0x42b6=function(_0xb6b575,_0x32a34b){_0xb6b575=_0xb6b575-0x0;var _0x480218=_0x2b64[_0xb6b575];return _0x480218;};'use strict';var _=require(_0x42b6('0x0'));var uuid=require(_0x42b6('0x1'));var util=require(_0x42b6('0x2'));var logger=require('../../../../../config/logger')(_0x42b6('0x3'));var Agent=function(_0x5ec2c0,_0x415dc5,_0x51d65c,_0x277874){this[_0x42b6('0x4')]=uuid['v4']();this[_0x42b6('0x5')]=_0x5ec2c0;this['agent']=_0x415dc5;this[_0x42b6('0x6')]=_0x51d65c;this[_0x42b6('0x3')]=_0x277874;this[_0x42b6('0x5')][_0x42b6('0x7')](this['handleRun']['bind'](this),this[_0x42b6('0x8')][_0x42b6('0x9')](this));this['squeue']['on'](_0x42b6('0xa'),this[_0x42b6('0x8')][_0x42b6('0x9')](this));this[_0x42b6('0x5')]['on'](_0x42b6('0xb'),this[_0x42b6('0xc')][_0x42b6('0x9')](this));};Agent[_0x42b6('0xd')][_0x42b6('0x7')]=function(){this[_0x42b6('0x5')]['push'](this['handleRun'][_0x42b6('0x9')](this),this[_0x42b6('0x8')][_0x42b6('0x9')](this));};Agent[_0x42b6('0xd')][_0x42b6('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0x42b6('0xd')]['handleRun']=function(_0x197fd4){logger['info'](_0x42b6('0xe'),this[_0x42b6('0x5')]['id'],this[_0x42b6('0xf')]['id']);if(_['isNil'](this[_0x42b6('0x6')][_0x42b6('0x10')][this[_0x42b6('0xf')]['id']])){logger['info'](_0x42b6('0x11'),this[_0x42b6('0x5')]['id'],this[_0x42b6('0xf')]['id']);setTimeout(this[_0x42b6('0x7')][_0x42b6('0x9')](this),0x3e8);}else{if(this['routing'][_0x42b6('0x12')]||util[_0x42b6('0x13')](this[_0x42b6('0x5')]['id'],this['realtime'][_0x42b6('0x10')][this[_0x42b6('0xf')]['id']],this[_0x42b6('0x5')]['channel'],![])){this[_0x42b6('0x6')][_0x42b6('0x10')][this[_0x42b6('0xf')]['id']]['busy']=!![];this[_0x42b6('0x6')][_0x42b6('0x10')][this[_0x42b6('0xf')]['id']]['busyQueue']=undefined;util[_0x42b6('0x14')](this[_0x42b6('0x4')],this[_0x42b6('0x5')]['id'],this[_0x42b6('0x6')][_0x42b6('0x10')][this['agent']['id']],null,this['routing']);util[_0x42b6('0x15')](this[_0x42b6('0x5')]['id'],this[_0x42b6('0x6')][_0x42b6('0x10')][this['agent']['id']],'RINGING'+(this[_0x42b6('0x3')][_0x42b6('0x12')]?_0x42b6('0x16'):''));}else{logger[_0x42b6('0x17')](_0x42b6('0x18'),this[_0x42b6('0x5')]['id'],this[_0x42b6('0xf')]['id']);setTimeout(this[_0x42b6('0x7')]['bind'](this),0x3e8);}}};Agent[_0x42b6('0xd')]['handleTimeout']=function(_0x34cdf0){if(_['isNil'](this['realtime'][_0x42b6('0x10')][this[_0x42b6('0xf')]['id']])){return logger[_0x42b6('0x17')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x42b6('0x5')]['id'],this[_0x42b6('0xf')]['id']);}else{logger[_0x42b6('0x17')](_0x42b6('0x19'),this[_0x42b6('0x5')]['id'],this[_0x42b6('0xf')]['id']);util[_0x42b6('0x1a')](this['notificationId'],this[_0x42b6('0x5')]['id'],this['realtime'][_0x42b6('0x10')][this[_0x42b6('0xf')]['id']],null,this[_0x42b6('0x3')]);this['realtime'][_0x42b6('0x10')][this['agent']['id']][_0x42b6('0x1b')]=![];this[_0x42b6('0x6')][_0x42b6('0x10')][this[_0x42b6('0xf')]['id']][_0x42b6('0x1c')]=undefined;util[_0x42b6('0x15')](this['squeue']['id'],this['realtime'][_0x42b6('0x10')][this[_0x42b6('0xf')]['id']],_0x34cdf0?_0x42b6('0x1d'):'TIMEOUT');}if(!_0x34cdf0){setTimeout(this[_0x42b6('0x7')][_0x42b6('0x9')](this),0x3e8);}};function agent(_0x25662d,_0x5707fe,_0x3aa48f,_0x5395b1){return new Agent(_0x25662d,_0x5707fe,_0x3aa48f,_0x5395b1);}module['exports']=agent; \ No newline at end of file +var _0xbaad=['writeLog','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','realtime','handleRun','handleTimeout','bind','timeout','handleDrained','push','prototype','info','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','showNotification'];(function(_0x4840e0,_0x316a03){var _0x1da65d=function(_0x9c907e){while(--_0x9c907e){_0x4840e0['push'](_0x4840e0['shift']());}};_0x1da65d(++_0x316a03);}(_0xbaad,0xa3));var _0xdbaa=function(_0x662e44,_0x43b4af){_0x662e44=_0x662e44-0x0;var _0x1b658e=_0xbaad[_0x662e44];return _0x1b658e;};'use strict';var _=require('lodash');var uuid=require(_0xdbaa('0x0'));var util=require('./util');var logger=require(_0xdbaa('0x1'))(_0xdbaa('0x2'));var Agent=function(_0x2db839,_0x4c811e,_0x4eaace,_0x1fba64){this[_0xdbaa('0x3')]=uuid['v4']();this[_0xdbaa('0x4')]=_0x2db839;this['agent']=_0x4c811e;this[_0xdbaa('0x5')]=_0x4eaace;this[_0xdbaa('0x2')]=_0x1fba64;this[_0xdbaa('0x4')]['push'](this[_0xdbaa('0x6')]['bind'](this),this[_0xdbaa('0x7')][_0xdbaa('0x8')](this));this['squeue']['on'](_0xdbaa('0x9'),this[_0xdbaa('0x7')][_0xdbaa('0x8')](this));this[_0xdbaa('0x4')]['on']('drained',this[_0xdbaa('0xa')][_0xdbaa('0x8')](this));};Agent['prototype'][_0xdbaa('0xb')]=function(){this[_0xdbaa('0x4')][_0xdbaa('0xb')](this[_0xdbaa('0x6')]['bind'](this),this[_0xdbaa('0x7')]['bind'](this));};Agent[_0xdbaa('0xc')][_0xdbaa('0xa')]=function(){this[_0xdbaa('0x7')](!![]);};Agent['prototype'][_0xdbaa('0x6')]=function(_0x481eda){logger[_0xdbaa('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xdbaa('0x4')]['id'],this[_0xdbaa('0xe')]['id']);if(_[_0xdbaa('0xf')](this[_0xdbaa('0x5')][_0xdbaa('0x10')][this[_0xdbaa('0xe')]['id']])){logger[_0xdbaa('0xd')](_0xdbaa('0x11'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0xdbaa('0x12')](this[_0xdbaa('0x4')]['id'],this[_0xdbaa('0x5')][_0xdbaa('0x10')][this[_0xdbaa('0xe')]['id']],this[_0xdbaa('0x4')][_0xdbaa('0x13')],![])){this[_0xdbaa('0x5')][_0xdbaa('0x10')][this[_0xdbaa('0xe')]['id']][_0xdbaa('0x14')]=!![];this[_0xdbaa('0x5')][_0xdbaa('0x10')][this[_0xdbaa('0xe')]['id']][_0xdbaa('0x15')]=undefined;util[_0xdbaa('0x16')](this[_0xdbaa('0x3')],this[_0xdbaa('0x4')]['id'],this['realtime'][_0xdbaa('0x10')][this[_0xdbaa('0xe')]['id']],null,this['routing']);util[_0xdbaa('0x17')](this['squeue']['id'],this[_0xdbaa('0x5')]['agents'][this[_0xdbaa('0xe')]['id']],'RINGING'+(this[_0xdbaa('0x2')][_0xdbaa('0x18')]?_0xdbaa('0x19'):''));}else{logger['info'](_0xdbaa('0x1a'),this[_0xdbaa('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xdbaa('0xb')][_0xdbaa('0x8')](this),0x3e8);}}};Agent[_0xdbaa('0xc')][_0xdbaa('0x7')]=function(_0x459f64){if(_[_0xdbaa('0xf')](this[_0xdbaa('0x5')]['agents'][this[_0xdbaa('0xe')]['id']])){return logger[_0xdbaa('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xdbaa('0xe')]['id']);}else{logger['info'](_0xdbaa('0x1b'),this[_0xdbaa('0x4')]['id'],this[_0xdbaa('0xe')]['id']);util[_0xdbaa('0x1c')](this[_0xdbaa('0x3')],this[_0xdbaa('0x4')]['id'],this[_0xdbaa('0x5')]['agents'][this[_0xdbaa('0xe')]['id']],null,this[_0xdbaa('0x2')]);this['realtime'][_0xdbaa('0x10')][this[_0xdbaa('0xe')]['id']]['busy']=![];this[_0xdbaa('0x5')][_0xdbaa('0x10')][this[_0xdbaa('0xe')]['id']][_0xdbaa('0x15')]=undefined;util[_0xdbaa('0x17')](this['squeue']['id'],this['realtime'][_0xdbaa('0x10')][this[_0xdbaa('0xe')]['id']],_0x459f64?'STOP':_0xdbaa('0x1d'));}if(!_0x459f64){setTimeout(this[_0xdbaa('0xb')]['bind'](this),0x3e8);}};function agent(_0x47e1c4,_0x3da9f0,_0x4a3b35,_0x4420a6){return new Agent(_0x47e1c4,_0x3da9f0,_0x4a3b35,_0x4420a6);}module[_0xdbaa('0x1e')]=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 42ec62e..6aba3d6 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 _0xa1a5=['handleRun','bind','handleTimeout','timeout','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','push','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime'];(function(_0x2644e4,_0x1c3c29){var _0x16bd69=function(_0x1e7e70){while(--_0x1e7e70){_0x2644e4['push'](_0x2644e4['shift']());}};_0x16bd69(++_0x1c3c29);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x4a4df3,_0xda95ef){_0x4a4df3=_0x4a4df3-0x0;var _0x4701ff=_0xa1a5[_0x4a4df3];return _0x4701ff;};'use strict';var _=require(_0x5a1a('0x0'));var uuid=require('uuid');var util=require(_0x5a1a('0x1'));var logger=require(_0x5a1a('0x2'))(_0x5a1a('0x3'));var Beepall=function(_0x13223e,_0x1eac2b,_0x57cba4,_0x3d3652){this[_0x5a1a('0x4')]=uuid['v4']();this[_0x5a1a('0x5')]=_0x13223e;this[_0x5a1a('0x6')]=_0x1eac2b;this[_0x5a1a('0x7')]=_0x57cba4;this[_0x5a1a('0x3')]=_0x3d3652;this[_0x5a1a('0x5')]['push'](this[_0x5a1a('0x8')][_0x5a1a('0x9')](this),this[_0x5a1a('0xa')][_0x5a1a('0x9')](this));this[_0x5a1a('0x5')]['on'](_0x5a1a('0xb'),this[_0x5a1a('0xa')][_0x5a1a('0x9')](this));this[_0x5a1a('0x5')]['on']('drained',this[_0x5a1a('0xc')][_0x5a1a('0x9')](this));};Beepall[_0x5a1a('0xd')]['push']=function(){this[_0x5a1a('0x5')]['push'](this['handleRun']['bind'](this),this[_0x5a1a('0xa')][_0x5a1a('0x9')](this));};Beepall[_0x5a1a('0xd')][_0x5a1a('0xc')]=function(_0x567c65){this[_0x5a1a('0xa')](!![]);};Beepall[_0x5a1a('0xd')]['handleRun']=function(_0x1a64de){var _0x25148e=!![];if(!_[_0x5a1a('0xe')](this['queue'])&&!_[_0x5a1a('0xe')](this[_0x5a1a('0x6')][_0x5a1a('0xf')])&&this[_0x5a1a('0x6')][_0x5a1a('0xf')][_0x5a1a('0x10')]>0x0){for(var _0x478566=0x0,_0x2e8e89;_0x4785660x0){for(var _0x55940b=0x0,_0x1d75d1;_0x55940b0x0&&_0x18807b[_0x886b6+_0x511e('0x20')]>=_0x18807b[_0x886b6+_0x511e('0x21')]){writeLog(_0xaea29d,_0x18807b,_0x886b6[_0x511e('0x22')]()+_0x511e('0x23'));return![];}}return!![];};exports[_0x511e('0x24')]=function(_0x309695,_0x2451c2,_0x5b72fe,_0x2930b2,_0x1d754d){return sendNotification(!![],_0x309695,_0x2451c2,_0x5b72fe,_0x2930b2,_0x1d754d);};exports[_0x511e('0x25')]=function(_0x1aaac1,_0x369be6,_0x50305a,_0x431b75,_0x4e157f){return sendNotification(![],_0x1aaac1,_0x369be6,_0x50305a,_0x431b75,_0x4e157f);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x7bd0=['notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','hideNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','error','message'];(function(_0x2ad107,_0x9c1674){var _0x205936=function(_0x320289){while(--_0x320289){_0x2ad107['push'](_0x2ad107['shift']());}};_0x205936(++_0x9c1674);}(_0x7bd0,0x111));var _0x07bd=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x7bd0[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var utils=require(_0x07bd('0x2'));var Mustache=require(_0x07bd('0x3'));var Redis=require(_0x07bd('0x4'));var config=require(_0x07bd('0x5'));var logger=require(_0x07bd('0x6'))(_0x07bd('0x7'));config['redis']=_[_0x07bd('0x8')](config[_0x07bd('0x9')],{'host':_0x07bd('0xa'),'port':0x18eb});var io=require(_0x07bd('0xb'))(new Redis(config[_0x07bd('0x9')]));function emit(_0x422a22,_0x2e4cd1,_0x5a939d){io['to'](_0x422a22)[_0x07bd('0xc')](_0x2e4cd1,_0x5a939d);}function sendNotification(_0x5cd446,_0x8032dc,_0xb10241,_0x323724,_0x5984fa,_0x2bace8){io['to'](util[_0x07bd('0xd')](_0x07bd('0xe'),_0x323724[_0x07bd('0xf')]))['emit'](_0x07bd('0x10'),_0x323724);var _0x313ca5=_0x2bace8||{};var _0x1b067a=_0xb10241[_0x07bd('0x11')]('.');var _0x456ecd={'uniqueid':_0x8032dc,'channel':_0x1b067a[0x0],'id':_0x1b067a[0x1],'title':_0x1b067a[0x0]+_0x07bd('0x12'),'interactionId':_0x1b067a[0x2],'queue':_0x5984fa?_0x5984fa[_0x07bd('0xf')]:null,'sound':_0x313ca5[_0x07bd('0x13')]['notificationSound'],'shake':_0x313ca5['account'][_0x07bd('0x14')]};try{if(!_0x313ca5[_0x07bd('0x15')]){_0x313ca5[_0x07bd('0x15')]={};}if(_0x5984fa){_0x313ca5[_0x07bd('0x15')][_0x07bd('0x16')]=_0x5984fa;}else if(_0x313ca5[_0x07bd('0x15')][_0x07bd('0x16')]){delete _0x313ca5['body'][_0x07bd('0x16')];}_0x456ecd['msg']=utils[_0x07bd('0x17')](_0x313ca5[_0x07bd('0x13')][_0x07bd('0x18')],_0x313ca5);}catch(_0x1713ca){_0x456ecd[_0x07bd('0x19')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x07bd('0x1a')](util[_0x07bd('0xd')]('[%s][QUEUE]\x20%s',_0x8032dc,_0x1713ca[_0x07bd('0x1b')]));}io['to'](util[_0x07bd('0xd')](_0x07bd('0xe'),_0x323724[_0x07bd('0xf')]))[_0x07bd('0xc')](util[_0x07bd('0xd')](_0x07bd('0x1c'),_0x5cd446?_0x07bd('0x1d'):_0x07bd('0x1e')),_0x456ecd);}function writeLog(_0x50109f,_0x15c0b8,_0x227807){return logger[_0x07bd('0x1f')](util[_0x07bd('0xd')](_0x07bd('0x20'),_0x50109f,_0x15c0b8['name'],_0x227807));}exports['isAgentAvailable']=function(_0xbb7117,_0x51ca22,_0x2b0dee,_0x480c9c){if(_0x51ca22['busy']){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x21'));return![];}if(!_0x51ca22[_0x07bd('0x22')]){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x23'));return![];}if(_0x51ca22[_0x2b0dee+_0x07bd('0x24')]){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x25'));return![];}if(_0x480c9c&&_0x51ca22[_0x07bd('0x26')](_0x2b0dee+'Capacity')&&_0x51ca22[_0x07bd('0x26')](_0x2b0dee+_0x07bd('0x27'))){if(_0x51ca22[_0x2b0dee+_0x07bd('0x28')]>0x0&&_0x51ca22[_0x2b0dee+_0x07bd('0x27')]>=_0x51ca22[_0x2b0dee+_0x07bd('0x28')]){writeLog(_0xbb7117,_0x51ca22,_0x2b0dee[_0x07bd('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x5184dc,_0x335d61,_0xfa7566,_0x5b31f7,_0x51efa8){return sendNotification(!![],_0x5184dc,_0x335d61,_0xfa7566,_0x5b31f7,_0x51efa8);};exports[_0x07bd('0x2a')]=function(_0x400cc0,_0x253dc0,_0x46ed12,_0x3f9424,_0x13bf6b){return sendNotification(![],_0x400cc0,_0x253dc0,_0x46ed12,_0x3f9424,_0x13bf6b);};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 42ba530..a6d3ef0 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 _0x46e0=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','join','info'];(function(_0x48b41d,_0x2fda76){var _0x12846e=function(_0xc4ff10){while(--_0xc4ff10){_0x48b41d['push'](_0x48b41d['shift']());}};_0x12846e(++_0x2fda76);}(_0x46e0,0x1c3));var _0x046e=function(_0x757dd0,_0x489c20){_0x757dd0=_0x757dd0-0x0;var _0x426f98=_0x46e0[_0x757dd0];return _0x426f98;};'use strict';var schema=require(_0x046e('0x0'));var sh=require(_0x046e('0x1'));var _=require(_0x046e('0x2'));var utils=require(_0x046e('0x3'));var logger=require('../../../../config/logger')(_0x046e('0x4'));var system=schema({'command':{'type':_0x046e('0x5'),'required':!![],'message':_0x046e('0x6')}});exports[_0x046e('0x7')]=function(_0x104708,_0x299a05){return function(_0x34b6b7){try{var _0x44fa8d={'command':_0x299a05[0x0]};var _0x27e01d=system[_0x046e('0x0')](_0x44fa8d,{'typecast':!![]});if(_0x27e01d['length']){logger['error'](_0x046e('0x8'),_0x104708,_['map'](_0x27e01d,'message')[_0x046e('0x9')](',\x20'));logger[_0x046e('0xa')](_0x046e('0xb'),_0x104708);_0x34b6b7[_0x046e('0xc')]();}else{var _0x287574=this;var _0x9ce94a=utils[_0x046e('0xd')](_0x299a05[0x0],this);logger[_0x046e('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x104708,_0x9ce94a);sh[_0x046e('0xe')](_['trim'](_0x9ce94a),function(_0x553c6b,_0x417e30){logger['info'](_0x046e('0xf'),_0x104708,_0x553c6b);if(_0x553c6b==0x0){var _0x4749de=_0x417e30[_0x046e('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x046e('0x11')](_0x299a05[0x1])||_['isEmpty'](_0x299a05[0x1])){logger['info'](_0x046e('0x12'),_0x104708);_0x287574['body'][_0x299a05[0x1]]=_0x4749de;}else{logger[_0x046e('0xa')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x104708,_0x299a05[0x1],_0x4749de);_0x287574[_0x046e('0x13')][_0x299a05[0x1]]=_0x4749de;}}_0x34b6b7[_0x046e('0xc')]();});}}catch(_0x4c9c50){logger['error'](_0x046e('0x8'),_0x104708,_[_0x046e('0x14')](_0x4c9c50)?JSON[_0x046e('0x15')](_0x4c9c50):_0x4c9c50);logger['info'](_0x046e('0xb'),_0x104708);_0x34b6b7[_0x046e('0xc')]();}};}; \ No newline at end of file +var _0xf026=['getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','body','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x43576a,_0x45cf91){var _0x370717=function(_0x5afe4e){while(--_0x5afe4e){_0x43576a['push'](_0x43576a['shift']());}};_0x370717(++_0x45cf91);}(_0xf026,0x106));var _0x6f02=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xf026[_0x346737];return _0x1ade2e;};'use strict';var schema=require(_0x6f02('0x0'));var sh=require(_0x6f02('0x1'));var _=require('lodash');var utils=require(_0x6f02('0x2'));var logger=require(_0x6f02('0x3'))(_0x6f02('0x4'));var system=schema({'command':{'type':_0x6f02('0x5'),'required':!![],'message':_0x6f02('0x6')}});exports[_0x6f02('0x7')]=function(_0x3f883b,_0x193f28){return function(_0xaffc73){try{var _0x537124={'command':_0x193f28[0x0]};var _0xe29c38=system[_0x6f02('0x0')](_0x537124,{'typecast':!![]});if(_0xe29c38[_0x6f02('0x8')]){logger['error']('[%s][SYSTEM]\x20%s',_0x3f883b,_['map'](_0xe29c38,_0x6f02('0x9'))[_0x6f02('0xa')](',\x20'));logger['info'](_0x6f02('0xb'),_0x3f883b);_0xaffc73[_0x6f02('0xc')]();}else{var _0x42c8c4=this;var _0x1fc64a=utils[_0x6f02('0xd')](_0x193f28[0x0],this);logger[_0x6f02('0xe')](_0x6f02('0xf'),_0x3f883b,_0x1fc64a);sh[_0x6f02('0x10')](_[_0x6f02('0x11')](_0x1fc64a),function(_0x6bd4b,_0x283e0c){logger[_0x6f02('0xe')](_0x6f02('0x12'),_0x3f883b,_0x6bd4b);if(_0x6bd4b==0x0){var _0x5167ba=_0x283e0c['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x193f28[0x1])||_[_0x6f02('0x13')](_0x193f28[0x1])){logger[_0x6f02('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x3f883b);_0x42c8c4[_0x6f02('0x14')][_0x193f28[0x1]]=_0x5167ba;}else{logger[_0x6f02('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3f883b,_0x193f28[0x1],_0x5167ba);_0x42c8c4[_0x6f02('0x14')][_0x193f28[0x1]]=_0x5167ba;}}_0xaffc73[_0x6f02('0xc')]();});}}catch(_0x4f50ec){logger[_0x6f02('0x15')](_0x6f02('0x16'),_0x3f883b,_[_0x6f02('0x17')](_0x4f50ec)?JSON[_0x6f02('0x18')](_0x4f50ec):_0x4f50ec);logger[_0x6f02('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3f883b);_0xaffc73[_0x6f02('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 5772852..4dbec25 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 _0xf544=['map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','stringify','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','length','error','[%s][TAG]\x20%s'];(function(_0x372548,_0x30080f){var _0x2326a9=function(_0x3564b9){while(--_0x3564b9){_0x372548['push'](_0x372548['shift']());}};_0x2326a9(++_0x30080f);}(_0xf544,0x15f));var _0x4f54=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0xf544[_0xc82d1a];return _0x32fad2;};'use strict';var schema=require(_0x4f54('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x4f54('0x1')),'openchannelInteraction':require(_0x4f54('0x2')),'smsInteraction':require(_0x4f54('0x3')),'mailInteraction':require(_0x4f54('0x4')),'faxInteraction':require(_0x4f54('0x5')),'whatsappInteraction':require(_0x4f54('0x6'))};var logger=require(_0x4f54('0x7'))(_0x4f54('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x4f54('0x9')]=function(_0x53a5f8,_0x1e4d6a,_0x23a87d,_0x551aee){return function(_0x103844){try{var _0x2d379a={'tag':_0x1e4d6a[0x0]};var _0x1771e1=tag['validate'](_0x2d379a,{'typecast':!![]});if(_0x1771e1[_0x4f54('0xa')]){logger[_0x4f54('0xb')](_0x4f54('0xc'),_0x53a5f8,_[_0x4f54('0xd')](_0x1771e1,'message')[_0x4f54('0xe')](',\x20'));logger['info'](_0x4f54('0xf'),_0x53a5f8);_0x103844[_0x4f54('0x10')]();}else{var _0x334f0d={'ids':[_0x1e4d6a[0x0]]};if(rpc[_0x551aee['channel']+'Interaction']){rpc[_0x551aee['channel']+_0x4f54('0x11')]['addTags'](_0x551aee[_0x4f54('0x12')]['id'],_0x334f0d)[_0x4f54('0x13')](function(_0x4a5e59){logger[_0x4f54('0x14')](_0x4f54('0x15'),_0x53a5f8,_0x1e4d6a[0x1],_0x551aee[_0x4f54('0x16')],_0x551aee[_0x4f54('0x12')]['id']);})[_0x4f54('0x17')](function(_0x2ba7bc){logger[_0x4f54('0xb')]('[%s][TAG]\x20%s',_0x53a5f8,JSON[_0x4f54('0x18')](_0x2ba7bc));logger[_0x4f54('0x14')](_0x4f54('0xf'),_0x53a5f8);})['finally'](function(){_0x103844[_0x4f54('0x10')]();});}}}catch(_0x15ebc8){logger[_0x4f54('0xb')](_0x4f54('0xc'),_0x53a5f8,_[_0x4f54('0x19')](_0x15ebc8)?JSON['stringify'](_0x15ebc8):_0x15ebc8);logger[_0x4f54('0x14')](_0x4f54('0xf'),_0x53a5f8);_0x103844[_0x4f54('0x10')]();}};}; \ No newline at end of file +var _0x71ce=['message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s'];(function(_0x185f5a,_0x4dd484){var _0x51aac3=function(_0x4971ee){while(--_0x4971ee){_0x185f5a['push'](_0x185f5a['shift']());}};_0x51aac3(++_0x4dd484);}(_0x71ce,0x156));var _0xe71c=function(_0x2b4b20,_0x3db505){_0x2b4b20=_0x2b4b20-0x0;var _0x56f796=_0x71ce[_0x2b4b20];return _0x56f796;};'use strict';var schema=require(_0xe71c('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xe71c('0x1')),'openchannelInteraction':require(_0xe71c('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe71c('0x3')),'whatsappInteraction':require(_0xe71c('0x4'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xe71c('0x5'),'required':!![],'message':_0xe71c('0x6')}});exports['consequence']=function(_0x28caaa,_0x187843,_0x178808,_0x2beba6){return function(_0x25eaa4){try{var _0x129181={'tag':_0x187843[0x0]};var _0x280211=tag[_0xe71c('0x0')](_0x129181,{'typecast':!![]});if(_0x280211[_0xe71c('0x7')]){logger[_0xe71c('0x8')](_0xe71c('0x9'),_0x28caaa,_['map'](_0x280211,_0xe71c('0xa'))[_0xe71c('0xb')](',\x20'));logger['info'](_0xe71c('0xc'),_0x28caaa);_0x25eaa4['next']();}else{var _0x4b145c={'ids':[_0x187843[0x0]]};if(rpc[_0x2beba6[_0xe71c('0xd')]+_0xe71c('0xe')]){rpc[_0x2beba6['channel']+_0xe71c('0xe')][_0xe71c('0xf')](_0x2beba6[_0xe71c('0x10')]['id'],_0x4b145c)['then'](function(_0x31f190){logger[_0xe71c('0x11')](_0xe71c('0x12'),_0x28caaa,_0x187843[0x1],_0x2beba6['channel'],_0x2beba6[_0xe71c('0x10')]['id']);})['catch'](function(_0x45e106){logger[_0xe71c('0x8')](_0xe71c('0x9'),_0x28caaa,JSON[_0xe71c('0x13')](_0x45e106));logger[_0xe71c('0x11')](_0xe71c('0xc'),_0x28caaa);})[_0xe71c('0x14')](function(){_0x25eaa4[_0xe71c('0x15')]();});}}}catch(_0x523e64){logger[_0xe71c('0x8')](_0xe71c('0x9'),_0x28caaa,_['isObject'](_0x523e64)?JSON['stringify'](_0x523e64):_0x523e64);logger['info'](_0xe71c('0xc'),_0x28caaa);_0x25eaa4[_0xe71c('0x15')]();}};}; \ 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 a8bf20d..da572ee 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 _0x56ff=['replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','next','request-promise','lodash'];(function(_0x51313d,_0x30de1e){var _0x300b13=function(_0x4954a1){while(--_0x4954a1){_0x51313d['push'](_0x51313d['shift']());}};_0x300b13(++_0x30de1e);}(_0x56ff,0x10c));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var rp=require(_0xf56f('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0xf56f('0x1'));var arr=[];exports['consequence']=function(_0x4bd8ca,_0x4c5bfe){return function(_0x5e87a7){var _0x4262ce=_0x4c5bfe[0xa];var _0x1c25ac=_0x4c5bfe[0xb];var _0x299e42=_0x4c5bfe[0xc];var _0x2a6293=_0x4c5bfe[0xd];var _0x46811e=_0x4c5bfe[0xe];var _0xcb1d1d=_0x4c5bfe[0xf]['replace'](/\n/g,'\x20-\x20');var _0x3e7fe3=_0x4c5bfe[0x10][_0xf56f('0x2')](/\n/g,'\x20');if(!arr[_0xf56f('0x3')](_0x1c25ac)){arr[_0xf56f('0x4')](_0x1c25ac);var _0x83c137=_0x4c5bfe[0x3];var _0x22130b=_0x4c5bfe[0x4];var _0x50042d=_0x4c5bfe[0x1];var _0xf04a0e=_0x4c5bfe[0x0];var _0x433db6={};_0x433db6[_0xf56f('0x5')]=_0x4c5bfe[0x8]+_0xf56f('0x6')+_0x299e42+'|'+_0x4262ce+'|'+_0x2a6293+'|'+_0x1c25ac+'|'+_0x46811e;_0x433db6[_0xf56f('0x7')]=_0x4c5bfe[0x7]+_0xf56f('0x6')+_0x299e42+'|'+_0x4262ce+'|'+_0x2a6293+'|'+_0x1c25ac+'|'+_0x46811e+'|'+_0xcb1d1d+'|'+_0x3e7fe3;_0x433db6['title']=_0x4c5bfe[0x9];var _0x5c89fa={};_0x5c89fa[_0xf56f('0x8')]=_0xf56f('0x9');_0x5c89fa['method']=_0xf56f('0xa');var _0x3112b7=[];_0x3112b7['push'](_0x4c5bfe[0x2]);_0x3112b7[_0xf56f('0x4')](_0x4c5bfe[0x5]);_0x3112b7[_0xf56f('0x4')](_0x4c5bfe[0x6]);_0x5c89fa[_0xf56f('0xb')]=_0x3112b7;_0x5c89fa['id']=0x1;var _0x200ed9=JSON[_0xf56f('0xc')](_0x5c89fa);var _0x39f717={'encoding':_0xf56f('0xd'),'method':_0xf56f('0xe'),'timeout':0x2710,'url':_0x83c137,'headers':{'Content-Type':_0xf56f('0xf')},'body':_0x200ed9};return rp(_0x39f717)[_0xf56f('0x10')](function(_0x1030c0){const _0x3e3378=JSON[_0xf56f('0x11')](_0x1030c0);if(!_0x3e3378[_0xf56f('0x12')][_0xf56f('0x13')]){throw new Error(_0xf56f('0x14'));}var _0x387a9d=_0x1c25ac;var _0x16122a=_0xf56f('0x15')+_0x50042d+'&serviceId='+_0xf04a0e+'&sessionId='+_0x387a9d+'&data='+JSON[_0xf56f('0xc')](_0x433db6);var _0x2493c3=_0x22130b+'?'+_0x16122a;return rp(_0x2493c3);})[_0xf56f('0x10')](function(_0x18685f){logger[_0xf56f('0x16')](_0xf56f('0x17'),_0x4bd8ca,_0x18685f);_0x5e87a7['stop']();})[_0xf56f('0x18')](function(_0x253ba1){logger[_0xf56f('0x19')](_0xf56f('0x1a'),_0x4bd8ca,_[_0xf56f('0x1b')](_0x253ba1)?JSON[_0xf56f('0xc')](_0x253ba1):_0x253ba1);_0x5e87a7[_0xf56f('0x1c')]();});}else{logger[_0xf56f('0x16')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x4bd8ca);_0x5e87a7[_0xf56f('0x1d')]();}};}; \ No newline at end of file +var _0xbad5=['info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','login','params','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data='];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0xbad5,0x1ba));var _0x5bad=function(_0x533721,_0x23cbca){_0x533721=_0x533721-0x0;var _0x5c3e9b=_0xbad5[_0x533721];return _0x5c3e9b;};'use strict';var rp=require(_0x5bad('0x0'));var logger=require(_0x5bad('0x1'))(_0x5bad('0x2'));var _=require(_0x5bad('0x3'));var arr=[];exports[_0x5bad('0x4')]=function(_0x2302b9,_0x35d59e){return function(_0x4ca58b){var _0x441f54=_0x35d59e[0xa];var _0x231419=_0x35d59e[0xb];var _0x38c8c6=_0x35d59e[0xc];var _0x392dbc=_0x35d59e[0xd];var _0x48c0c1=_0x35d59e[0xe];var _0x26934c=_0x35d59e[0xf][_0x5bad('0x5')](/\n/g,_0x5bad('0x6'));var _0x39f18a=_0x35d59e[0x10][_0x5bad('0x5')](/\n/g,'\x20');if(!arr[_0x5bad('0x7')](_0x231419)){arr[_0x5bad('0x8')](_0x231419);var _0x4bf7ea=_0x35d59e[0x3];var _0x12583c=_0x35d59e[0x4];var _0xffeb6=_0x35d59e[0x1];var _0x21245f=_0x35d59e[0x0];var _0x35117e={};_0x35117e[_0x5bad('0x9')]=_0x35d59e[0x8]+_0x5bad('0xa')+_0x38c8c6+'|'+_0x441f54+'|'+_0x392dbc+'|'+_0x231419+'|'+_0x48c0c1;_0x35117e[_0x5bad('0xb')]=_0x35d59e[0x7]+_0x5bad('0xa')+_0x38c8c6+'|'+_0x441f54+'|'+_0x392dbc+'|'+_0x231419+'|'+_0x48c0c1+'|'+_0x26934c+'|'+_0x39f18a;_0x35117e[_0x5bad('0xc')]=_0x35d59e[0x9];var _0x33c01f={};_0x33c01f[_0x5bad('0xd')]=_0x5bad('0xe');_0x33c01f['method']=_0x5bad('0xf');var _0x1d1b35=[];_0x1d1b35[_0x5bad('0x8')](_0x35d59e[0x2]);_0x1d1b35['push'](_0x35d59e[0x5]);_0x1d1b35[_0x5bad('0x8')](_0x35d59e[0x6]);_0x33c01f[_0x5bad('0x10')]=_0x1d1b35;_0x33c01f['id']=0x1;var _0x3a802c=JSON['stringify'](_0x33c01f);var _0x4ed58c={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x4bf7ea,'headers':{'Content-Type':_0x5bad('0x11')},'body':_0x3a802c};return rp(_0x4ed58c)[_0x5bad('0x12')](function(_0x13b140){const _0x520141=JSON[_0x5bad('0x13')](_0x13b140);if(!_0x520141[_0x5bad('0x14')]['logged']){throw new Error(_0x5bad('0x15'));}var _0x3610f1=_0x231419;var _0x54c317=_0x5bad('0x16')+_0xffeb6+_0x5bad('0x17')+_0x21245f+_0x5bad('0x18')+_0x3610f1+_0x5bad('0x19')+JSON['stringify'](_0x35117e);var _0x4d7f88=_0x12583c+'?'+_0x54c317;return rp(_0x4d7f88);})[_0x5bad('0x12')](function(_0x3d15b2){logger[_0x5bad('0x1a')](_0x5bad('0x1b'),_0x2302b9,_0x3d15b2);_0x4ca58b[_0x5bad('0x1c')]();})[_0x5bad('0x1d')](function(_0x3de450){logger[_0x5bad('0x1e')](_0x5bad('0x1f'),_0x2302b9,_[_0x5bad('0x20')](_0x3de450)?JSON[_0x5bad('0x21')](_0x3de450):_0x3de450);_0x4ca58b[_0x5bad('0x1c')]();});}else{logger[_0x5bad('0x1a')](_0x5bad('0x22'),_0x2302b9);_0x4ca58b[_0x5bad('0x23')]();}};}; \ 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 62b0cd0..8b9c908 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1dccc6,_0x4692bd){var _0x1f2dad=function(_0x34a722){while(--_0x34a722){_0x1dccc6['push'](_0x1dccc6['shift']());}};_0x1f2dad(++_0x4692bd);}(_0xe706,0xa3));var _0x6e70=function(_0x524cb3,_0x2d702a){_0x524cb3=_0x524cb3-0x0;var _0x288975=_0xe706[_0x524cb3];return _0x288975;};'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 +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x43f448,_0x1bf4f2){var _0x50fe33=function(_0x1c1b72){while(--_0x1c1b72){_0x43f448['push'](_0x43f448['shift']());}};_0x50fe33(++_0x1bf4f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3f0f7d0..343a6c5 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 _0xc3fe=['length','existsSync','join','app','.js','autoreply','appdata','push','slice','dialogflowv2','split','amazonlex','TagId','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','catch','message\x20is\x20empty','busy','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','loggedIn','name','mailQueues','available','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','listen','rules','channel','message','interaction','applications','isArray'];(function(_0x3c07af,_0x2d5b0c){var _0x2d518a=function(_0x1ecb34){while(--_0x1ecb34){_0x3c07af['push'](_0x3c07af['shift']());}};_0x2d518a(++_0x2d5b0c);}(_0xc3fe,0xff));var _0xec3f=function(_0xa88a8e,_0x5d3c58){_0xa88a8e=_0xa88a8e-0x0;var _0x3caadd=_0xc3fe[_0xa88a8e];return _0x3caadd;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var path=require(_0xec3f('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xec3f('0x3'));var uuid=require(_0xec3f('0x4'));var utils=require(_0xec3f('0x5'));var config=require('../../../config/environment');var logger=require(_0xec3f('0x6'))(_0xec3f('0x7'));var rpc={'openchannelQueueReport':require(_0xec3f('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xec3f('0x9')),'faxQueueReport':require(_0xec3f('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0xcb8557,_0x5df7fc,_0x32207e){return util[_0xec3f('0xb')](_0xec3f('0xc'),_0xcb8557,_0x5df7fc||0x0,_0x32207e||0x0);}function getIntervals(_0x163eb8,_0x54a3fc){var _0x3b5cc3=[];if(!_[_0xec3f('0xd')](_0x54a3fc[_0xec3f('0xe')])&&!_[_0xec3f('0xd')](_0x163eb8[_0x54a3fc[_0xec3f('0xe')]])&&!_[_0xec3f('0xd')](_0x163eb8[_0x54a3fc['IntervalId']][_0xec3f('0xf')])){_0x3b5cc3=_[_0xec3f('0x10')](_0x163eb8[_0x54a3fc[_0xec3f('0xe')]]['Intervals'],'interval');}else if(!_[_0xec3f('0xd')](_0x54a3fc['interval'])){_0x3b5cc3=[_0x54a3fc['interval']];}return _0x3b5cc3;}exports[_0xec3f('0x11')]=function(_0x4318bd){_0x4318bd[_0xec3f('0x12')]={};return new BPromise(function(_0x4e6440,_0x4efa81){var _0x5509ec={'Start':function(_0x5ad65a){var _0x37d688=this;return new Promise(function(_0x10ff81,_0x5bd7c0){if(_0x5ad65a){try{var _0x225edd=[];var _0xb8ee6f=getId(_0x5ad65a[_0xec3f('0x13')],_0x5ad65a[_0xec3f('0x14')]?_0x5ad65a['message']['id']:0x0,_0x5ad65a[_0xec3f('0x15')]?_0x5ad65a[_0xec3f('0x15')]['id']:0x0);if(_0x5ad65a[_0xec3f('0x16')]&&_[_0xec3f('0x17')](_0x5ad65a[_0xec3f('0x16')])&&_0x5ad65a['applications'][_0xec3f('0x18')]){for(var _0x4bea4e=0x0;_0x4bea4e<_0x5ad65a[_0xec3f('0x16')][_0xec3f('0x18')];_0x4bea4e+=0x1){var _0x1d6a23=_0x5ad65a['applications'][_0x4bea4e];if(fs[_0xec3f('0x19')](path[_0xec3f('0x1a')](__dirname,'applications',_0x1d6a23[_0xec3f('0x1b')]+_0xec3f('0x1c')))){var _0x1f173f=[];switch(_0x1d6a23[_0xec3f('0x1b')]['toLowerCase']()){case _0xec3f('0x1d'):var _0x170f11=_0x1d6a23[_0xec3f('0x1e')]['split'](',');if(_0x5ad65a[_0xec3f('0x13')]==='mail'){_0x1f173f[_0xec3f('0x1f')](_0x170f11[0x0]);_0x1f173f['push'](_0x170f11[0x1]);_0x1f173f['push'](_0x170f11[_0xec3f('0x20')](0x2,_0x170f11['length'])[_0xec3f('0x1a')](','));}else{_0x1f173f[_0xec3f('0x1f')](_0x170f11[0x0]);_0x1f173f[_0xec3f('0x1f')](_0x170f11['slice'](0x1,_0x170f11[_0xec3f('0x18')])[_0xec3f('0x1a')](','));}break;case'dialogflow':var _0x53cc0d=_0x1d6a23[_0xec3f('0x1e')]['split'](',');_0x1f173f[_0xec3f('0x1f')](_0x53cc0d[0x0]);_0x1f173f[_0xec3f('0x1f')](_0x53cc0d[0x1]);_0x1f173f[_0xec3f('0x1f')](_0x53cc0d[_0xec3f('0x20')](0x2,_0x53cc0d[_0xec3f('0x18')])[_0xec3f('0x1a')](','));break;case _0xec3f('0x21'):var _0x237134=_0x1d6a23['appdata'][_0xec3f('0x22')](',');_0x1f173f[_0xec3f('0x1f')](_0x237134[0x0]);_0x1f173f['push'](_0x237134[0x1]);_0x1f173f[_0xec3f('0x1f')](_0x237134[0x2]);_0x1f173f[_0xec3f('0x1f')](_0x237134[0x3]);_0x1f173f[_0xec3f('0x1f')](_0x237134[_0xec3f('0x20')](0x4,_0x237134[_0xec3f('0x18')])[_0xec3f('0x1a')](','));break;case _0xec3f('0x23'):var _0x29af36=_0x1d6a23[_0xec3f('0x1e')][_0xec3f('0x22')](',');_0x1f173f[_0xec3f('0x1f')](_0x29af36[0x0]);_0x1f173f[_0xec3f('0x1f')](_0x29af36[0x1]);_0x1f173f[_0xec3f('0x1f')](_0x29af36[0x2]);_0x1f173f[_0xec3f('0x1f')](_0x29af36[0x3]);_0x1f173f[_0xec3f('0x1f')](_0x29af36['slice'](0x4,_0x29af36[_0xec3f('0x18')])[_0xec3f('0x1a')](','));break;case _0xec3f('0x14'):_0x1f173f[_0xec3f('0x1f')](_0x1d6a23[_0xec3f('0x1e')]);break;case'tag':_0x1f173f[_0xec3f('0x1f')](_0x1d6a23[_0xec3f('0x24')]);_0x1f173f[_0xec3f('0x1f')](_0x1d6a23['appdata']);break;case'tvox':var _0x1aded9=utils['getMustacheRender'](_0x5ad65a[_0xec3f('0x25')]['notificationTemplate'],_0x5ad65a);var _0x131839=_0x1d6a23['appdata']['split'](',');_0x1f173f[_0xec3f('0x1f')](_0x131839[0x0]);_0x1f173f[_0xec3f('0x1f')](_0x131839[0x1]);_0x1f173f[_0xec3f('0x1f')](_0x131839[0x2]);_0x1f173f[_0xec3f('0x1f')](_0x131839[0x3]);_0x1f173f[_0xec3f('0x1f')](_0x131839[0x4]);_0x1f173f[_0xec3f('0x1f')](_0x131839[0x5]);_0x1f173f['push'](_0x131839[0x6]);_0x1f173f['push'](_0x131839[0x7]);_0x1f173f[_0xec3f('0x1f')](_0x131839[0x8]);_0x1f173f[_0xec3f('0x1f')](_0x131839[0x9]);_0x1f173f[_0xec3f('0x1f')](_0x131839[0xa]);_0x1f173f[_0xec3f('0x1f')](_0x5ad65a[_0xec3f('0x15')]['id']);_0x1f173f[_0xec3f('0x1f')](_0x5ad65a[_0xec3f('0x14')]['id']);_0x1f173f['push'](_0x1d6a23[_0xec3f('0x26')]);_0x1f173f['push'](_0x5ad65a[_0xec3f('0x15')][_0xec3f('0x27')]);_0x1f173f[_0xec3f('0x1f')](_0x5ad65a[_0xec3f('0x28')][_0xec3f('0x28')]);_0x1f173f[_0xec3f('0x1f')](_0x1aded9);break;default:_0x1f173f=_[_0xec3f('0xd')](_0x1d6a23[_0xec3f('0x1e')])?[]:_0x1d6a23[_0xec3f('0x1e')][_0xec3f('0x22')](',');}var _0x38a9e3={'id':util[_0xec3f('0xb')](_0xec3f('0x29'),_0xb8ee6f,_0x1d6a23['id'],_0x1d6a23['app']),'condition':require(_0xec3f('0x2a'))[_0xec3f('0x2b')](_0xb8ee6f,getIntervals(_0x4318bd['intervals'],_0x1d6a23),_0x4318bd),'consequence':require(_0xec3f('0x2c')+_0x1d6a23[_0xec3f('0x1b')])['consequence'](_0xb8ee6f,_0x1f173f,_0x4318bd,_0x5ad65a),'p':_0x1d6a23[_0xec3f('0x2d')]||0x0};logger[_0xec3f('0x2e')](_0xec3f('0x2f'),_0x38a9e3['id'],_0xec3f('0x30'),getIntervals(_0x4318bd[_0xec3f('0x31')],_0x1d6a23)[_0xec3f('0x1a')]('\x20|\x20'));_0x225edd[_0xec3f('0x1f')](_0x38a9e3);}else{logger[_0xec3f('0x32')](_0xec3f('0x33'),path[_0xec3f('0x1a')](__dirname,_0xec3f('0x16'),_0x1d6a23[_0xec3f('0x1b')]+_0xec3f('0x1c')));}}_0x4318bd[_0xec3f('0x12')][_0xb8ee6f]=new RuleEngine(_0x225edd);_0x4318bd[_0xec3f('0x12')][_0xb8ee6f]['execute'](_0x5ad65a,function(_0x8d0f18){logger['info'](_0xec3f('0x34'),JSON[_0xec3f('0x35')](_0x8d0f18[_0xec3f('0x36')]));if(_0x4318bd[_0xec3f('0x12')][_0xb8ee6f]){_0x4318bd[_0xec3f('0x12')][_0xb8ee6f][_0xec3f('0x37')](_0xec3f('0x38'));}});return _0x10ff81({'code':0xc8,'message':_0x5ad65a});}else{logger[_0xec3f('0x2e')](_0xec3f('0x39'));return _0x10ff81({'code':0xc8,'message':_0x5ad65a});}}catch(_0x1b056c){logger[_0xec3f('0x32')](_0x1b056c[_0xec3f('0x3a')]);return _0x5bd7c0(_0x37d688['error'](0x1f4,_0x1b056c));}}return _0x5bd7c0(_0xec3f('0x3b'));});},'AcceptMessage':function(_0x1943ca){var _0x531c21=this;return new Promise(function(_0x2e21c7,_0x3b061a){if(_0x1943ca[_0xec3f('0x3c')]&&_0x1943ca[_0xec3f('0x3c')]['id']){if(_0x4318bd['agents'][_0x1943ca['agent']['id']]){_0x4318bd[_0xec3f('0x3d')][_0x1943ca[_0xec3f('0x3c')]['id']]['busy']=![];_0x4318bd[_0xec3f('0x3d')][_0x1943ca[_0xec3f('0x3c')]['id']][_0xec3f('0x3e')]=undefined;}}if(_0x1943ca['message']&&_0x1943ca[_0xec3f('0x14')]['id']){try{var _0x5a080f=getId(_0x1943ca['channel'],_0x1943ca['message']?_0x1943ca[_0xec3f('0x14')]['id']:0x0,_0x1943ca[_0xec3f('0x15')]?_0x1943ca[_0xec3f('0x15')]['id']:0x0);if(_0x4318bd[_0xec3f('0x12')][_0x5a080f]){_0x4318bd['rules'][_0x5a080f][_0xec3f('0x37')]('end');if(rpc[_0x1943ca[_0xec3f('0x13')]+_0xec3f('0x3f')]){rpc[_0x1943ca[_0xec3f('0x13')]+_0xec3f('0x3f')][_0xec3f('0x40')](_0x5a080f,{'UserId':_0x1943ca[_0xec3f('0x14')]['UserId']})[_0xec3f('0x41')](function(_0x56e5c2){logger[_0xec3f('0x32')]('error\x20update\x20queue\x20report');});}}return _0x2e21c7({'code':0xc8,'message':_0x1943ca});}catch(_0x425d90){logger['error'](_0x425d90[_0xec3f('0x3a')]);return _0x3b061a(_0x531c21[_0xec3f('0x32')](0x1f4,_0x425d90));}}logger[_0xec3f('0x32')](_0xec3f('0x42'));return _0x3b061a(_0x531c21[_0xec3f('0x32')](0x1f4,_0xec3f('0x42')));});},'RejectMessage':function(_0x2ee773){var _0x10eb47=this;return new Promise(function(_0x50287d,_0x230aad){if(_0x2ee773[_0xec3f('0x3c')]&&_0x2ee773['agent']['id']){try{if(_0x4318bd[_0xec3f('0x3d')][_0x2ee773['agent']['id']]){_0x4318bd[_0xec3f('0x3d')][_0x2ee773['agent']['id']][_0xec3f('0x43')]=![];_0x4318bd['agents'][_0x2ee773[_0xec3f('0x3c')]['id']]['busyQueue']=undefined;}return _0x50287d({'code':0xc8,'message':_0x2ee773});}catch(_0x6d53a2){logger[_0xec3f('0x32')](_0x6d53a2[_0xec3f('0x3a')]);return _0x230aad(_0x10eb47[_0xec3f('0x32')](0x1f4,_0x6d53a2));}}logger[_0xec3f('0x32')](_0xec3f('0x42'));return _0x230aad(_0x10eb47['error'](0x1f4,_0xec3f('0x42')));});},'AbandonInteraction':function(_0x584c68){var _0x13825e=this;return new Promise(function(_0xd498e5,_0x2a421f){if(_0x584c68[_0xec3f('0x13')]&&_0x584c68[_0xec3f('0x15')]&&_0x584c68[_0xec3f('0x15')]['id']){try{var _0x1a9073=getId(_0x584c68['channel'],_0x584c68[_0xec3f('0x14')]?_0x584c68[_0xec3f('0x14')]['id']:0x0,_0x584c68[_0xec3f('0x15')]?_0x584c68[_0xec3f('0x15')]['id']:0x0);if(_0x4318bd[_0xec3f('0x12')][_0x1a9073]){_0x4318bd[_0xec3f('0x12')][_0x1a9073]['emit'](_0xec3f('0x44'));}return _0xd498e5({'code':0xc8,'message':_0x584c68});}catch(_0x2a5a1f){logger[_0xec3f('0x32')](_0x2a5a1f[_0xec3f('0x3a')]);return _0x2a421f(_0x13825e[_0xec3f('0x32')](0x1f4,_0x2a5a1f));}}logger['error'](_0xec3f('0x42'));return _0x2a421f(_0x13825e[_0xec3f('0x32')](0x1f4,_0xec3f('0x42')));});},'AgentCapacity':function(_0x50b4a5){var _0x30576f=this;return new Promise(function(_0x12f0d5,_0xced939){if(_0x4318bd['agents']['hasOwnProperty'](_0x50b4a5['id'])){for(var _0x5c1c1d in _0x50b4a5[_0xec3f('0x45')]){if(_0x50b4a5[_0xec3f('0x45')][_0xec3f('0x46')](_0x5c1c1d)){if(_0x4318bd['agents'][_0x50b4a5['id']]['hasOwnProperty'](_0x5c1c1d+_0xec3f('0x47'))){_0x4318bd[_0xec3f('0x3d')][_0x50b4a5['id']][_0x5c1c1d+_0xec3f('0x47')]=parseInt(_0x50b4a5[_0xec3f('0x45')][_0x5c1c1d],0xa);}}}_0x4318bd[_0xec3f('0x3d')][_0x50b4a5['id']][_0xec3f('0x48')]();return _0x12f0d5({'code':0xc8,'message':_0x4318bd['agents'][_0x50b4a5['id']]});}else{return _0xced939(_0x30576f[_0xec3f('0x32')](0x1f4,_0xec3f('0x49')));}});},'Agents':function(_0x29ef84){return new Promise(function(_0x4be96a,_0x10464d){var _0x50f62c=_['values'](_0x4318bd[_0xec3f('0x3d')]);_0x4be96a({'count':_0x50f62c[_0xec3f('0x18')],'rows':_0x50f62c});});},'ChatQueues':function(_0x51b547){return new Promise(function(_0x21e26e,_0x41c59d){var _0xfef5e8=[];for(var _0x5247db in _0x4318bd[_0xec3f('0x4a')]){if(_0x4318bd['chatQueues'][_0xec3f('0x46')](_0x5247db)){var _0x17ef99=_0x4318bd[_0xec3f('0x4a')][_0x5247db];var _0x18c6de={'id':_0x17ef99['id'],'available':_0x17ef99['available'],'loggedIn':_0x17ef99[_0xec3f('0x4b')],'name':_0x17ef99[_0xec3f('0x4c')],'paused':_0x17ef99['paused'],'waiting':_0x17ef99['waiting']};_0xfef5e8[_0xec3f('0x1f')](_0x18c6de);}}_0x21e26e({'count':_0xfef5e8[_0xec3f('0x18')],'rows':_0xfef5e8});});},'MailQueues':function(_0x4d3600){return new Promise(function(_0x50a024,_0x1f8041){var _0x3b6000=[];for(var _0x46f7be in _0x4318bd['mailQueues']){if(_0x4318bd['mailQueues'][_0xec3f('0x46')](_0x46f7be)){var _0xe4c6bb=_0x4318bd[_0xec3f('0x4d')][_0x46f7be];var _0x3140c5={'id':_0xe4c6bb['id'],'available':_0xe4c6bb[_0xec3f('0x4e')],'loggedIn':_0xe4c6bb[_0xec3f('0x4b')],'name':_0xe4c6bb[_0xec3f('0x4c')],'paused':_0xe4c6bb[_0xec3f('0x4f')],'waiting':_0xe4c6bb[_0xec3f('0x50')]};_0x3b6000['push'](_0x3140c5);}}_0x50a024({'count':_0x3b6000[_0xec3f('0x18')],'rows':_0x3b6000});});},'OpenchannelQueues':function(_0x2f9f93){return new Promise(function(_0x14f8a8,_0x360088){var _0x2520c9=[];for(var _0x202752 in _0x4318bd['openchannelQueues']){if(_0x4318bd[_0xec3f('0x51')][_0xec3f('0x46')](_0x202752)){var _0x35851a=_0x4318bd['openchannelQueues'][_0x202752];var _0xf1da2e={'id':_0x35851a['id'],'available':_0x35851a[_0xec3f('0x4e')],'loggedIn':_0x35851a[_0xec3f('0x4b')],'name':_0x35851a[_0xec3f('0x4c')],'paused':_0x35851a[_0xec3f('0x4f')],'waiting':_0x35851a[_0xec3f('0x50')]};_0x2520c9[_0xec3f('0x1f')](_0xf1da2e);}}_0x14f8a8({'count':_0x2520c9['length'],'rows':_0x2520c9});});},'SmsQueues':function(_0x1a79b5){return new Promise(function(_0x3a8fc4,_0xb21ec5){var _0x5f24b4=[];for(var _0x33563b in _0x4318bd['smsQueues']){if(_0x4318bd[_0xec3f('0x52')][_0xec3f('0x46')](_0x33563b)){var _0xd0ead8=_0x4318bd[_0xec3f('0x52')][_0x33563b];var _0x4436c3={'id':_0xd0ead8['id'],'available':_0xd0ead8[_0xec3f('0x4e')],'loggedIn':_0xd0ead8[_0xec3f('0x4b')],'name':_0xd0ead8[_0xec3f('0x4c')],'paused':_0xd0ead8[_0xec3f('0x4f')],'waiting':_0xd0ead8[_0xec3f('0x50')]};_0x5f24b4[_0xec3f('0x1f')](_0x4436c3);}}_0x3a8fc4({'count':_0x5f24b4[_0xec3f('0x18')],'rows':_0x5f24b4});});},'FaxQueues':function(_0x4ecbb8){return new Promise(function(_0x58e65f,_0x1af3ed){var _0x276aa1=[];for(var _0x3f8e44 in _0x4318bd[_0xec3f('0x53')]){if(_0x4318bd[_0xec3f('0x53')][_0xec3f('0x46')](_0x3f8e44)){var _0x50053b=_0x4318bd['faxQueues'][_0x3f8e44];var _0x56993f={'id':_0x50053b['id'],'available':_0x50053b[_0xec3f('0x4e')],'loggedIn':_0x50053b['loggedIn'],'name':_0x50053b[_0xec3f('0x4c')],'paused':_0x50053b[_0xec3f('0x4f')],'waiting':_0x50053b[_0xec3f('0x50')]};_0x276aa1[_0xec3f('0x1f')](_0x56993f);}}_0x58e65f({'count':_0x276aa1[_0xec3f('0x18')],'rows':_0x276aa1});});},'WhatsappQueues':function(_0x55ef2b){return new Promise(function(_0x15c1d2,_0x8c7db8){var _0x280047=[];for(var _0x530bbf in _0x4318bd[_0xec3f('0x54')]){if(_0x4318bd[_0xec3f('0x54')][_0xec3f('0x46')](_0x530bbf)){var _0x57460f=_0x4318bd['whatsappQueues'][_0x530bbf];var _0x49a78c={'id':_0x57460f['id'],'available':_0x57460f['available'],'loggedIn':_0x57460f[_0xec3f('0x4b')],'name':_0x57460f['name'],'paused':_0x57460f[_0xec3f('0x4f')],'waiting':_0x57460f[_0xec3f('0x50')]};_0x280047[_0xec3f('0x1f')](_0x49a78c);}}_0x15c1d2({'count':_0x280047[_0xec3f('0x18')],'rows':_0x280047});});},'ChatQueuesWaitingInteractions':function(_0x49a60b){return new Promise(function(_0x3c10e2,_0x34c99d){var _0x108034=_[_0xec3f('0x55')](_0x4318bd['chatQueuesWaitingInteractions']);_0x3c10e2({'count':_0x108034[_0xec3f('0x18')],'rows':_0x108034});});},'MailQueuesWaitingInteractions':function(_0x496c8){return new Promise(function(_0x3bea0e,_0xd60ac0){var _0x460262=_['values'](_0x4318bd[_0xec3f('0x56')]);_0x3bea0e({'count':_0x460262[_0xec3f('0x18')],'rows':_0x460262});});},'OpenchannelQueuesWaitingInteractions':function(_0x121a8d){return new Promise(function(_0xfd7451,_0x24da5c){var _0x168708=_[_0xec3f('0x55')](_0x4318bd['openchannelQueuesWaitingInteractions']);_0xfd7451({'count':_0x168708[_0xec3f('0x18')],'rows':_0x168708});});},'SmsQueuesWaitingInteractions':function(_0x1bb0fa){return new Promise(function(_0xeed8ae,_0x3c53bc){var _0x5a8013=_[_0xec3f('0x55')](_0x4318bd[_0xec3f('0x57')]);_0xeed8ae({'count':_0x5a8013['length'],'rows':_0x5a8013});});},'FaxQueuesWaitingInteractions':function(_0x1882b6){return new Promise(function(_0x8b5b76,_0x2a5b97){var _0x346fe7=_['values'](_0x4318bd[_0xec3f('0x58')]);_0x8b5b76({'count':_0x346fe7[_0xec3f('0x18')],'rows':_0x346fe7});});},'WhatsappQueuesWaitingInteractions':function(_0x68c1de){return new Promise(function(_0x2b279f,_0x4824be){var _0x1188d5=_[_0xec3f('0x55')](_0x4318bd['whatsappQueuesWaitingInteractions']);_0x2b279f({'count':_0x1188d5['length'],'rows':_0x1188d5});});}};var _0x45a3c7=jayson[_0xec3f('0x59')](_0x5509ec)[_0xec3f('0x5a')]();_0x45a3c7['on'](_0xec3f('0x32'),function(_0x13efda){logger[_0xec3f('0x32')](JSON[_0xec3f('0x35')](_0x13efda));return _0x4efa81(_0x13efda);});_0x45a3c7[_0xec3f('0x11')](0x232c,_0xec3f('0x5b'),function(){console['log'](_0xec3f('0x5c'),0x232c);return _0x4e6440('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x0cfa=['util','path','jayson/promise','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','mail','push','slice','dialogflow','appdata','split','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','on\x20interval','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','info','error','routing\x20is\x20empty','agents','agent','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','stringify','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash'];(function(_0x304efc,_0x2c6a48){var _0x34e2b9=function(_0x327c24){while(--_0x327c24){_0x304efc['push'](_0x304efc['shift']());}};_0x34e2b9(++_0x2c6a48);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x2c9dc7,_0x3fa9fe){_0x2c9dc7=_0x2c9dc7-0x0;var _0x167114=_0x0cfa[_0x2c9dc7];return _0x167114;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var path=require(_0xa0cf('0x2'));var fs=require('fs');var jayson=require(_0xa0cf('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0xa0cf('0x4'));var logger=require('../../../config/logger')(_0xa0cf('0x5'));var rpc={'openchannelQueueReport':require(_0xa0cf('0x6')),'mailQueueReport':require(_0xa0cf('0x7')),'chatQueueReport':require(_0xa0cf('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xa0cf('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xa0cf('0xa'));function getId(_0x5f0054,_0xdee9d7,_0x4855d0){return util[_0xa0cf('0xb')](_0xa0cf('0xc'),_0x5f0054,_0xdee9d7||0x0,_0x4855d0||0x0);}function getIntervals(_0x354eab,_0x544364){var _0x318f36=[];if(!_[_0xa0cf('0xd')](_0x544364['IntervalId'])&&!_['isNil'](_0x354eab[_0x544364[_0xa0cf('0xe')]])&&!_[_0xa0cf('0xd')](_0x354eab[_0x544364[_0xa0cf('0xe')]]['Intervals'])){_0x318f36=_[_0xa0cf('0xf')](_0x354eab[_0x544364[_0xa0cf('0xe')]][_0xa0cf('0x10')],_0xa0cf('0x11'));}else if(!_[_0xa0cf('0xd')](_0x544364[_0xa0cf('0x11')])){_0x318f36=[_0x544364[_0xa0cf('0x11')]];}return _0x318f36;}exports['listen']=function(_0x560c9b){_0x560c9b[_0xa0cf('0x12')]={};return new BPromise(function(_0x219f1e,_0x4848ed){var _0x1e8234={'Start':function(_0x1cc9ba){var _0x3f55f5=this;return new Promise(function(_0x1186e9,_0x31951b){if(_0x1cc9ba){try{var _0x4cbe8a=[];var _0x19e263=getId(_0x1cc9ba[_0xa0cf('0x13')],_0x1cc9ba['message']?_0x1cc9ba[_0xa0cf('0x14')]['id']:0x0,_0x1cc9ba[_0xa0cf('0x15')]?_0x1cc9ba['interaction']['id']:0x0);if(_0x1cc9ba[_0xa0cf('0x16')]&&_[_0xa0cf('0x17')](_0x1cc9ba[_0xa0cf('0x16')])&&_0x1cc9ba[_0xa0cf('0x16')][_0xa0cf('0x18')]){for(var _0x8bb2ab=0x0;_0x8bb2ab<_0x1cc9ba['applications'][_0xa0cf('0x18')];_0x8bb2ab+=0x1){var _0x308fe9=_0x1cc9ba[_0xa0cf('0x16')][_0x8bb2ab];if(fs[_0xa0cf('0x19')](path[_0xa0cf('0x1a')](__dirname,_0xa0cf('0x16'),_0x308fe9[_0xa0cf('0x1b')]+_0xa0cf('0x1c')))){var _0x1112f8=[];switch(_0x308fe9[_0xa0cf('0x1b')][_0xa0cf('0x1d')]()){case'autoreply':var _0x5f275c=_0x308fe9['appdata']['split'](',');if(_0x1cc9ba['channel']===_0xa0cf('0x1e')){_0x1112f8[_0xa0cf('0x1f')](_0x5f275c[0x0]);_0x1112f8['push'](_0x5f275c[0x1]);_0x1112f8[_0xa0cf('0x1f')](_0x5f275c[_0xa0cf('0x20')](0x2,_0x5f275c[_0xa0cf('0x18')])[_0xa0cf('0x1a')](','));}else{_0x1112f8['push'](_0x5f275c[0x0]);_0x1112f8[_0xa0cf('0x1f')](_0x5f275c[_0xa0cf('0x20')](0x1,_0x5f275c['length'])['join'](','));}break;case _0xa0cf('0x21'):var _0x4b7180=_0x308fe9[_0xa0cf('0x22')][_0xa0cf('0x23')](',');_0x1112f8[_0xa0cf('0x1f')](_0x4b7180[0x0]);_0x1112f8[_0xa0cf('0x1f')](_0x4b7180[0x1]);_0x1112f8['push'](_0x4b7180['slice'](0x2,_0x4b7180[_0xa0cf('0x18')])['join'](','));break;case _0xa0cf('0x24'):var _0x2eed90=_0x308fe9[_0xa0cf('0x22')][_0xa0cf('0x23')](',');_0x1112f8['push'](_0x2eed90[0x0]);_0x1112f8[_0xa0cf('0x1f')](_0x2eed90[0x1]);_0x1112f8[_0xa0cf('0x1f')](_0x2eed90[0x2]);_0x1112f8[_0xa0cf('0x1f')](_0x2eed90[0x3]);_0x1112f8[_0xa0cf('0x1f')](_0x2eed90[_0xa0cf('0x20')](0x4,_0x2eed90[_0xa0cf('0x18')])[_0xa0cf('0x1a')](','));break;case'amazonlex':var _0x217649=_0x308fe9[_0xa0cf('0x22')][_0xa0cf('0x23')](',');_0x1112f8[_0xa0cf('0x1f')](_0x217649[0x0]);_0x1112f8[_0xa0cf('0x1f')](_0x217649[0x1]);_0x1112f8['push'](_0x217649[0x2]);_0x1112f8[_0xa0cf('0x1f')](_0x217649[0x3]);_0x1112f8[_0xa0cf('0x1f')](_0x217649['slice'](0x4,_0x217649['length'])[_0xa0cf('0x1a')](','));break;case _0xa0cf('0x14'):_0x1112f8[_0xa0cf('0x1f')](_0x308fe9[_0xa0cf('0x22')]);break;case _0xa0cf('0x25'):_0x1112f8[_0xa0cf('0x1f')](_0x308fe9[_0xa0cf('0x26')]);_0x1112f8[_0xa0cf('0x1f')](_0x308fe9['appdata']);break;case _0xa0cf('0x27'):var _0x2978c4=utils[_0xa0cf('0x28')](_0x1cc9ba[_0xa0cf('0x29')][_0xa0cf('0x2a')],_0x1cc9ba);var _0x5aefef=_0x308fe9[_0xa0cf('0x22')][_0xa0cf('0x23')](',');_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x0]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x1]);_0x1112f8['push'](_0x5aefef[0x2]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x3]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x4]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x5]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x6]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x7]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x8]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0x9]);_0x1112f8[_0xa0cf('0x1f')](_0x5aefef[0xa]);_0x1112f8['push'](_0x1cc9ba['interaction']['id']);_0x1112f8[_0xa0cf('0x1f')](_0x1cc9ba[_0xa0cf('0x14')]['id']);_0x1112f8[_0xa0cf('0x1f')](_0x308fe9[_0xa0cf('0x2b')]);_0x1112f8['push'](_0x1cc9ba[_0xa0cf('0x15')][_0xa0cf('0x2c')]);_0x1112f8[_0xa0cf('0x1f')](_0x1cc9ba['body'][_0xa0cf('0x2d')]);_0x1112f8[_0xa0cf('0x1f')](_0x2978c4);break;default:_0x1112f8=_['isNil'](_0x308fe9[_0xa0cf('0x22')])?[]:_0x308fe9[_0xa0cf('0x22')][_0xa0cf('0x23')](',');}var _0x3f2b8e={'id':util['format'](_0xa0cf('0x2e'),_0x19e263,_0x308fe9['id'],_0x308fe9[_0xa0cf('0x1b')]),'condition':require(_0xa0cf('0x2f'))[_0xa0cf('0x30')](_0x19e263,getIntervals(_0x560c9b[_0xa0cf('0x31')],_0x308fe9),_0x560c9b),'consequence':require(_0xa0cf('0x32')+_0x308fe9[_0xa0cf('0x1b')])[_0xa0cf('0x33')](_0x19e263,_0x1112f8,_0x560c9b,_0x1cc9ba),'p':_0x308fe9[_0xa0cf('0x34')]||0x0};logger['info']('Push\x20new\x20rule',_0x3f2b8e['id'],_0xa0cf('0x35'),getIntervals(_0x560c9b[_0xa0cf('0x31')],_0x308fe9)[_0xa0cf('0x1a')]('\x20|\x20'));_0x4cbe8a[_0xa0cf('0x1f')](_0x3f2b8e);}else{logger['error'](_0xa0cf('0x36'),path[_0xa0cf('0x1a')](__dirname,_0xa0cf('0x16'),_0x308fe9[_0xa0cf('0x1b')]+_0xa0cf('0x1c')));}}_0x560c9b[_0xa0cf('0x12')][_0x19e263]=new RuleEngine(_0x4cbe8a);_0x560c9b[_0xa0cf('0x12')][_0x19e263][_0xa0cf('0x37')](_0x1cc9ba,function(_0x3fc562){logger['info'](_0xa0cf('0x38'),JSON['stringify'](_0x3fc562[_0xa0cf('0x39')]));if(_0x560c9b[_0xa0cf('0x12')][_0x19e263]){_0x560c9b[_0xa0cf('0x12')][_0x19e263][_0xa0cf('0x3a')]('complete');}});return _0x1186e9({'code':0xc8,'message':_0x1cc9ba});}else{logger[_0xa0cf('0x3b')]('No\x20applications\x20to\x20execute');return _0x1186e9({'code':0xc8,'message':_0x1cc9ba});}}catch(_0x5a491e){logger[_0xa0cf('0x3c')](_0x5a491e['stack']);return _0x31951b(_0x3f55f5[_0xa0cf('0x3c')](0x1f4,_0x5a491e));}}return _0x31951b(_0xa0cf('0x3d'));});},'AcceptMessage':function(_0x11cfc1){var _0x110e0d=this;return new Promise(function(_0x38061a,_0xc1ebb6){if(_0x11cfc1['agent']&&_0x11cfc1['agent']['id']){if(_0x560c9b[_0xa0cf('0x3e')][_0x11cfc1[_0xa0cf('0x3f')]['id']]){_0x560c9b[_0xa0cf('0x3e')][_0x11cfc1[_0xa0cf('0x3f')]['id']][_0xa0cf('0x40')]=![];_0x560c9b[_0xa0cf('0x3e')][_0x11cfc1['agent']['id']][_0xa0cf('0x41')]=undefined;}}if(_0x11cfc1['message']&&_0x11cfc1[_0xa0cf('0x14')]['id']){try{var _0x34328f=getId(_0x11cfc1[_0xa0cf('0x13')],_0x11cfc1[_0xa0cf('0x14')]?_0x11cfc1[_0xa0cf('0x14')]['id']:0x0,_0x11cfc1['interaction']?_0x11cfc1[_0xa0cf('0x15')]['id']:0x0);if(_0x560c9b[_0xa0cf('0x12')][_0x34328f]){_0x560c9b['rules'][_0x34328f][_0xa0cf('0x3a')](_0xa0cf('0x42'));if(rpc[_0x11cfc1[_0xa0cf('0x13')]+_0xa0cf('0x43')]){rpc[_0x11cfc1[_0xa0cf('0x13')]+_0xa0cf('0x43')][_0xa0cf('0x44')](_0x34328f,{'UserId':_0x11cfc1['message'][_0xa0cf('0x45')]})['catch'](function(_0x252953){logger['error'](_0xa0cf('0x46'));});}}return _0x38061a({'code':0xc8,'message':_0x11cfc1});}catch(_0x20dafc){logger[_0xa0cf('0x3c')](_0x20dafc[_0xa0cf('0x47')]);return _0xc1ebb6(_0x110e0d[_0xa0cf('0x3c')](0x1f4,_0x20dafc));}}logger[_0xa0cf('0x3c')](_0xa0cf('0x48'));return _0xc1ebb6(_0x110e0d['error'](0x1f4,_0xa0cf('0x48')));});},'RejectMessage':function(_0x5c8b54){var _0x480602=this;return new Promise(function(_0x3d193c,_0x10cfd2){if(_0x5c8b54['agent']&&_0x5c8b54[_0xa0cf('0x3f')]['id']){try{if(_0x560c9b[_0xa0cf('0x3e')][_0x5c8b54[_0xa0cf('0x3f')]['id']]){_0x560c9b['agents'][_0x5c8b54[_0xa0cf('0x3f')]['id']][_0xa0cf('0x40')]=![];_0x560c9b[_0xa0cf('0x3e')][_0x5c8b54[_0xa0cf('0x3f')]['id']][_0xa0cf('0x41')]=undefined;}return _0x3d193c({'code':0xc8,'message':_0x5c8b54});}catch(_0x58b628){logger[_0xa0cf('0x3c')](_0x58b628[_0xa0cf('0x47')]);return _0x10cfd2(_0x480602[_0xa0cf('0x3c')](0x1f4,_0x58b628));}}logger[_0xa0cf('0x3c')](_0xa0cf('0x48'));return _0x10cfd2(_0x480602[_0xa0cf('0x3c')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x589d0b){var _0x5ddf20=this;return new Promise(function(_0x2cd33e,_0x2e1476){if(_0x589d0b[_0xa0cf('0x13')]&&_0x589d0b[_0xa0cf('0x15')]&&_0x589d0b[_0xa0cf('0x15')]['id']){try{var _0x376616=getId(_0x589d0b['channel'],_0x589d0b[_0xa0cf('0x14')]?_0x589d0b[_0xa0cf('0x14')]['id']:0x0,_0x589d0b[_0xa0cf('0x15')]?_0x589d0b[_0xa0cf('0x15')]['id']:0x0);if(_0x560c9b['rules'][_0x376616]){_0x560c9b['rules'][_0x376616][_0xa0cf('0x3a')](_0xa0cf('0x42'));}return _0x2cd33e({'code':0xc8,'message':_0x589d0b});}catch(_0x467108){logger[_0xa0cf('0x3c')](_0x467108[_0xa0cf('0x47')]);return _0x2e1476(_0x5ddf20[_0xa0cf('0x3c')](0x1f4,_0x467108));}}logger[_0xa0cf('0x3c')](_0xa0cf('0x48'));return _0x2e1476(_0x5ddf20[_0xa0cf('0x3c')](0x1f4,_0xa0cf('0x48')));});},'AgentCapacity':function(_0x150ee5){var _0x3ae707=this;return new Promise(function(_0x26836e,_0x41aed4){if(_0x560c9b[_0xa0cf('0x3e')][_0xa0cf('0x49')](_0x150ee5['id'])){for(var _0x14a628 in _0x150ee5[_0xa0cf('0x4a')]){if(_0x150ee5[_0xa0cf('0x4a')][_0xa0cf('0x49')](_0x14a628)){if(_0x560c9b[_0xa0cf('0x3e')][_0x150ee5['id']][_0xa0cf('0x49')](_0x14a628+'CurrentCapacity')){_0x560c9b[_0xa0cf('0x3e')][_0x150ee5['id']][_0x14a628+_0xa0cf('0x4b')]=parseInt(_0x150ee5[_0xa0cf('0x4a')][_0x14a628],0xa);}}}_0x560c9b[_0xa0cf('0x3e')][_0x150ee5['id']][_0xa0cf('0x4c')]();return _0x26836e({'code':0xc8,'message':_0x560c9b[_0xa0cf('0x3e')][_0x150ee5['id']]});}else{return _0x41aed4(_0x3ae707['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x585e3d){return new Promise(function(_0x50d39b,_0x221ba7){var _0x3810d6=_[_0xa0cf('0x4d')](_0x560c9b[_0xa0cf('0x3e')]);_0x50d39b({'count':_0x3810d6['length'],'rows':_0x3810d6});});},'ChatQueues':function(_0x5ef319){return new Promise(function(_0x2435d9,_0x553692){var _0x3e003a=[];for(var _0x334c5e in _0x560c9b[_0xa0cf('0x4e')]){if(_0x560c9b[_0xa0cf('0x4e')][_0xa0cf('0x49')](_0x334c5e)){var _0x52fc37=_0x560c9b['chatQueues'][_0x334c5e];var _0x8b3d55={'id':_0x52fc37['id'],'available':_0x52fc37['available'],'loggedIn':_0x52fc37[_0xa0cf('0x4f')],'name':_0x52fc37[_0xa0cf('0x50')],'paused':_0x52fc37[_0xa0cf('0x51')],'waiting':_0x52fc37[_0xa0cf('0x52')]};_0x3e003a['push'](_0x8b3d55);}}_0x2435d9({'count':_0x3e003a[_0xa0cf('0x18')],'rows':_0x3e003a});});},'MailQueues':function(_0x2f81f5){return new Promise(function(_0xc22c83,_0x29af4b){var _0x459a7e=[];for(var _0x4afa2d in _0x560c9b['mailQueues']){if(_0x560c9b[_0xa0cf('0x53')][_0xa0cf('0x49')](_0x4afa2d)){var _0x270f76=_0x560c9b[_0xa0cf('0x53')][_0x4afa2d];var _0x6688be={'id':_0x270f76['id'],'available':_0x270f76['available'],'loggedIn':_0x270f76[_0xa0cf('0x4f')],'name':_0x270f76[_0xa0cf('0x50')],'paused':_0x270f76[_0xa0cf('0x51')],'waiting':_0x270f76[_0xa0cf('0x52')]};_0x459a7e['push'](_0x6688be);}}_0xc22c83({'count':_0x459a7e[_0xa0cf('0x18')],'rows':_0x459a7e});});},'OpenchannelQueues':function(_0x547700){return new Promise(function(_0x5a3c04,_0x5d63e5){var _0xc87953=[];for(var _0x12c531 in _0x560c9b[_0xa0cf('0x54')]){if(_0x560c9b[_0xa0cf('0x54')]['hasOwnProperty'](_0x12c531)){var _0x31d8e1=_0x560c9b['openchannelQueues'][_0x12c531];var _0x3231bf={'id':_0x31d8e1['id'],'available':_0x31d8e1[_0xa0cf('0x55')],'loggedIn':_0x31d8e1[_0xa0cf('0x4f')],'name':_0x31d8e1['name'],'paused':_0x31d8e1[_0xa0cf('0x51')],'waiting':_0x31d8e1[_0xa0cf('0x52')]};_0xc87953[_0xa0cf('0x1f')](_0x3231bf);}}_0x5a3c04({'count':_0xc87953[_0xa0cf('0x18')],'rows':_0xc87953});});},'SmsQueues':function(_0x21976f){return new Promise(function(_0x4f840e,_0xa63d53){var _0x15785c=[];for(var _0x401b33 in _0x560c9b['smsQueues']){if(_0x560c9b[_0xa0cf('0x56')][_0xa0cf('0x49')](_0x401b33)){var _0x320268=_0x560c9b[_0xa0cf('0x56')][_0x401b33];var _0x23605e={'id':_0x320268['id'],'available':_0x320268['available'],'loggedIn':_0x320268['loggedIn'],'name':_0x320268[_0xa0cf('0x50')],'paused':_0x320268[_0xa0cf('0x51')],'waiting':_0x320268[_0xa0cf('0x52')]};_0x15785c[_0xa0cf('0x1f')](_0x23605e);}}_0x4f840e({'count':_0x15785c[_0xa0cf('0x18')],'rows':_0x15785c});});},'FaxQueues':function(_0x3f5b1a){return new Promise(function(_0x3f9771,_0x4d88c4){var _0x54d64e=[];for(var _0x1da163 in _0x560c9b[_0xa0cf('0x57')]){if(_0x560c9b[_0xa0cf('0x57')][_0xa0cf('0x49')](_0x1da163)){var _0x3fc3b6=_0x560c9b[_0xa0cf('0x57')][_0x1da163];var _0x291210={'id':_0x3fc3b6['id'],'available':_0x3fc3b6[_0xa0cf('0x55')],'loggedIn':_0x3fc3b6['loggedIn'],'name':_0x3fc3b6[_0xa0cf('0x50')],'paused':_0x3fc3b6[_0xa0cf('0x51')],'waiting':_0x3fc3b6[_0xa0cf('0x52')]};_0x54d64e[_0xa0cf('0x1f')](_0x291210);}}_0x3f9771({'count':_0x54d64e[_0xa0cf('0x18')],'rows':_0x54d64e});});},'WhatsappQueues':function(_0x5e95f6){return new Promise(function(_0x210216,_0x2e640c){var _0x48e36f=[];for(var _0x623b72 in _0x560c9b['whatsappQueues']){if(_0x560c9b[_0xa0cf('0x58')][_0xa0cf('0x49')](_0x623b72)){var _0x2e24a8=_0x560c9b[_0xa0cf('0x58')][_0x623b72];var _0x553b7d={'id':_0x2e24a8['id'],'available':_0x2e24a8[_0xa0cf('0x55')],'loggedIn':_0x2e24a8[_0xa0cf('0x4f')],'name':_0x2e24a8[_0xa0cf('0x50')],'paused':_0x2e24a8['paused'],'waiting':_0x2e24a8[_0xa0cf('0x52')]};_0x48e36f[_0xa0cf('0x1f')](_0x553b7d);}}_0x210216({'count':_0x48e36f[_0xa0cf('0x18')],'rows':_0x48e36f});});},'ChatQueuesWaitingInteractions':function(_0x19382d){return new Promise(function(_0x4676a2,_0x212dbd){var _0x430a8b=_[_0xa0cf('0x4d')](_0x560c9b[_0xa0cf('0x59')]);_0x4676a2({'count':_0x430a8b[_0xa0cf('0x18')],'rows':_0x430a8b});});},'MailQueuesWaitingInteractions':function(_0x36939e){return new Promise(function(_0x21c539,_0xe9421a){var _0x35efe6=_[_0xa0cf('0x4d')](_0x560c9b[_0xa0cf('0x5a')]);_0x21c539({'count':_0x35efe6[_0xa0cf('0x18')],'rows':_0x35efe6});});},'OpenchannelQueuesWaitingInteractions':function(_0x253bb3){return new Promise(function(_0x2ce6ae,_0x7a964f){var _0x451f56=_[_0xa0cf('0x4d')](_0x560c9b['openchannelQueuesWaitingInteractions']);_0x2ce6ae({'count':_0x451f56[_0xa0cf('0x18')],'rows':_0x451f56});});},'SmsQueuesWaitingInteractions':function(_0x5ae559){return new Promise(function(_0x3df2f8,_0x3c2e15){var _0x53c46d=_['values'](_0x560c9b[_0xa0cf('0x5b')]);_0x3df2f8({'count':_0x53c46d[_0xa0cf('0x18')],'rows':_0x53c46d});});},'FaxQueuesWaitingInteractions':function(_0x479ca1){return new Promise(function(_0x59bb34,_0x32acd4){var _0x21148d=_['values'](_0x560c9b['faxQueuesWaitingInteractions']);_0x59bb34({'count':_0x21148d[_0xa0cf('0x18')],'rows':_0x21148d});});},'WhatsappQueuesWaitingInteractions':function(_0x40d7f8){return new Promise(function(_0x2d18fb,_0x1ed7f8){var _0x1867af=_[_0xa0cf('0x4d')](_0x560c9b['whatsappQueuesWaitingInteractions']);_0x2d18fb({'count':_0x1867af[_0xa0cf('0x18')],'rows':_0x1867af});});}};var _0x1a9b5a=jayson[_0xa0cf('0x5c')](_0x1e8234)[_0xa0cf('0x5d')]();_0x1a9b5a['on']('error',function(_0x3f778a){logger['error'](JSON[_0xa0cf('0x5e')](_0x3f778a));return _0x4848ed(_0x3f778a);});_0x1a9b5a[_0xa0cf('0x5f')](0x232c,_0xa0cf('0x60'),function(){console[_0xa0cf('0x61')](_0xa0cf('0x62'),0x232c);return _0x219f1e(_0xa0cf('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1b5086b..99267b2 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 _0xfebd=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20','util','bluebird','jayson/promise','lodash','http','request','then','error','message','result','catch','condition','info'];(function(_0x5e345e,_0x1e4cff){var _0x437adb=function(_0x448458){while(--_0x448458){_0x5e345e['push'](_0x5e345e['shift']());}};_0x437adb(++_0x1e4cff);}(_0xfebd,0x111));var _0xdfeb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfebd[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xdfeb('0x0'));var BPromise=require(_0xdfeb('0x1'));var jayson=require(_0xdfeb('0x2'));var _=require(_0xdfeb('0x3'));var logger=require('../../../config/logger')('routing');var client=jayson['client'][_0xdfeb('0x4')]({'port':0x232a});function request(_0x2201ac,_0x141aa5){return new BPromise(function(_0x411c74,_0x2a84a7){return client[_0xdfeb('0x5')](_0x2201ac,_0x141aa5)[_0xdfeb('0x6')](function(_0x251bde){if(_0x251bde[_0xdfeb('0x7')]){return _0x2a84a7(_0x251bde[_0xdfeb('0x7')][_0xdfeb('0x8')]);}else{return _0x411c74(_0x251bde[_0xdfeb('0x9')]);}})[_0xdfeb('0xa')](function(_0x371834){return _0x2a84a7(_0x371834);});});}exports[_0xdfeb('0xb')]=function(_0xa20d66,_0x514f6e,_0x15e9bb){return function(_0x52fb90){if(_0x15e9bb['rules']&&!_0x15e9bb['rules'][_0xa20d66]){logger[_0xdfeb('0xc')](_0xdfeb('0xd'),_0xa20d66);return _0x52fb90[_0xdfeb('0xe')]();}var _0x2256a2=[];for(var _0x1e9957=0x0;_0x1e9957<_0x514f6e[_0xdfeb('0xf')];_0x1e9957+=0x1){_0x2256a2['push'](request(_0xdfeb('0x10'),{'command':util['format']('iftime\x20%s',_0x514f6e[_0x1e9957])})[_0xdfeb('0x6')](function(_0x37eec9){return _0x37eec9&&_0x37eec9['message']&&_0x37eec9[_0xdfeb('0x8')][_0xdfeb('0x11')](_0xdfeb('0x12'))>=0x0?!![]:![];})[_0xdfeb('0xa')](function(_0xd1f144){logger['error'](_0xdfeb('0x13'),_0xa20d66,_0x514f6e[_0x1e9957]);}));}BPromise[_0xdfeb('0x14')](_0x2256a2)[_0xdfeb('0x6')](function(_0x39721c){var _0x57c0cd=_[_0xdfeb('0x15')](_0x39721c);logger[_0xdfeb('0xc')](_0xdfeb('0x16'),_0xa20d66,_0x514f6e[_0xdfeb('0x17')]('\x20|\x20'),_0x57c0cd);_0x52fb90['when'](_0x57c0cd);})[_0xdfeb('0xa')](function(_0x166b3b){console[_0xdfeb('0x18')](_0x166b3b);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0xa20d66,_0x514f6e[_0xdfeb('0x17')](_0xdfeb('0x19')),_0x166b3b['stack']);_0x52fb90[_0xdfeb('0xe')]();});};}; \ No newline at end of file +var _0x9901=['bluebird','jayson/promise','lodash','../../../config/logger','client','request','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','util'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9901,0x6b));var _0x1990=function(_0x83487c,_0x1104d8){_0x83487c=_0x83487c-0x0;var _0x25ce18=_0x9901[_0x83487c];return _0x25ce18;};'use strict';var util=require(_0x1990('0x0'));var BPromise=require(_0x1990('0x1'));var jayson=require(_0x1990('0x2'));var _=require(_0x1990('0x3'));var logger=require(_0x1990('0x4'))('routing');var client=jayson[_0x1990('0x5')]['http']({'port':0x232a});function request(_0x19af7a,_0x10957c){return new BPromise(function(_0x48178a,_0x468fa9){return client[_0x1990('0x6')](_0x19af7a,_0x10957c)[_0x1990('0x7')](function(_0x23beab){if(_0x23beab['error']){return _0x468fa9(_0x23beab[_0x1990('0x8')][_0x1990('0x9')]);}else{return _0x48178a(_0x23beab[_0x1990('0xa')]);}})[_0x1990('0xb')](function(_0x468bf2){return _0x468fa9(_0x468bf2);});});}exports[_0x1990('0xc')]=function(_0x344d37,_0x815db5,_0x421742){return function(_0x29b3cc){if(_0x421742['rules']&&!_0x421742[_0x1990('0xd')][_0x344d37]){logger['info'](_0x1990('0xe'),_0x344d37);return _0x29b3cc[_0x1990('0xf')]();}var _0x5a580c=[];for(var _0x16ad0b=0x0;_0x16ad0b<_0x815db5[_0x1990('0x10')];_0x16ad0b+=0x1){_0x5a580c[_0x1990('0x11')](request(_0x1990('0x12'),{'command':util[_0x1990('0x13')](_0x1990('0x14'),_0x815db5[_0x16ad0b])})[_0x1990('0x7')](function(_0x14a9ce){return _0x14a9ce&&_0x14a9ce[_0x1990('0x9')]&&_0x14a9ce[_0x1990('0x9')][_0x1990('0x15')](_0x1990('0x16'))>=0x0?!![]:![];})['catch'](function(_0x318584){logger['error']('[%s][INTERVAL]\x20%s',_0x344d37,_0x815db5[_0x16ad0b]);}));}BPromise[_0x1990('0x17')](_0x5a580c)[_0x1990('0x7')](function(_0x4a164f){var _0x45ad75=_['some'](_0x4a164f);logger['info'](_0x1990('0x18'),_0x344d37,_0x815db5[_0x1990('0x19')](_0x1990('0x1a')),_0x45ad75);_0x29b3cc['when'](_0x45ad75);})[_0x1990('0xb')](function(_0x2295a7){console['log'](_0x2295a7);logger[_0x1990('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x344d37,_0x815db5['join'](_0x1990('0x1a')),_0x2295a7['stack']);_0x29b3cc[_0x1990('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 80bdad8..9d4edf4 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 _0x4ded=['agentcompleteAt','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','agentcomplete','acw','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','diffTime'];(function(_0xe12e1,_0x5fbaf4){var _0x4c8883=function(_0x372185){while(--_0x372185){_0xe12e1['push'](_0xe12e1['shift']());}};_0x4c8883(++_0x5fbaf4);}(_0x4ded,0x116));var _0xd4de=function(_0x215520,_0x469685){_0x215520=_0x215520-0x0;var _0x3cd0ff=_0x4ded[_0x215520];return _0x3cd0ff;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var utils=require(_0xd4de('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fa334,_0x2349f5){utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x5'),_0x1fa334[_0xd4de('0x6')],_0x1fa334[_0xd4de('0x7')],_0x1fa334[_0xd4de('0x8')],_0x1fa334[_0xd4de('0x9')],_0x1fa334['interface'],_0x1fa334[_0xd4de('0xa')],_0x1fa334[_0xd4de('0xb')],_0x1fa334[_0xd4de('0xc')]));if(_0x1fa334[_0xd4de('0x8')]){utils[_0xd4de('0xd')](_0x1fa334[_0xd4de('0x8')])['then'](function(_0xb7e8cf){if(_0xb7e8cf){_0x1fa334['type']=_0xb7e8cf['type'];_0x1fa334['agentacw']=_0x1fa334[_0xd4de('0xe')]?_0xb7e8cf[_0xd4de('0xf')]:![];_0x1fa334['acwtime']=_0x1fa334['agentacw']?_0xb7e8cf['acwTimeout']:0x0;}utils[_0xd4de('0x10')]('CreateVoiceAgentReport',_0x1fa334);});}else{utils[_0xd4de('0x10')](_0xd4de('0x11'),_0x1fa334);}if(_0x2349f5){delete transfers[_0x1fa334[_0xd4de('0x6')]];}else{delete agents[_0x1fa334[_0xd4de('0x12')]];}}exports[_0xd4de('0x13')]=function(_0x3af6e0){try{utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x15'),_0x3af6e0[_0xd4de('0x6')]),_0x3af6e0);agents[_0x3af6e0[_0xd4de('0x12')]]=_0x3af6e0;agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0x16')]=utils[_0xd4de('0x17')]();agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x18');agents[_0x3af6e0['destuniqueid']]['connectedlinenum']=null;agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0x19')]=null;utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x3af6e0['uniqueid'],agents[_0x3af6e0[_0xd4de('0x12')]]['membername'],_0x3af6e0[_0xd4de('0x12')]));}catch(_0x29c028){utils['error'](util[_0xd4de('0x4')]('[%s][agents][agentcalled]',_0x3af6e0[_0xd4de('0x6')]),_0x29c028);}};exports[_0xd4de('0x1a')]=function(_0x2bad14){try{if(!_[_0xd4de('0x1b')](agents[_0x2bad14['destuniqueid']])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x1c'),_0x2bad14[_0xd4de('0x6')]),_0x2bad14);utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x1d'),_0x2bad14[_0xd4de('0x6')],agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x9')],_0x2bad14['destuniqueid']));agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x1a')]=!![];agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x1e')]=utils[_0xd4de('0x17')]();agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x1f');agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x20')]=_0xd4de('0x1f');agents[_0x2bad14[_0xd4de('0x12')]]['holdtime']=_0x2bad14[_0xd4de('0x21')]?parseInt(_0x2bad14[_0xd4de('0x21')])/0x3e8:0x0;agents[_0x2bad14['destuniqueid']][_0xd4de('0x22')]=0x0;unanswered['push'](_0x2bad14[_0xd4de('0x12')]);}}catch(_0x32e407){utils[_0xd4de('0x23')](util['format'](_0xd4de('0x1c'),_0x2bad14[_0xd4de('0x6')]),_0x32e407);}};exports[_0xd4de('0x24')]=function(_0x50cb73){try{_[_0xd4de('0x25')](agents,function(_0x1804c7,_0x55f9f9){if(_0x1804c7['uniqueid']==_0x50cb73['uniqueid']&&!_[_0xd4de('0x26')](unanswered,_0x1804c7['destuniqueid'])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x27'),_0x50cb73[_0xd4de('0x6')]),_0x50cb73);utils['info'](util[_0xd4de('0x4')](_0xd4de('0x28'),_0x50cb73['uniqueid'],_0x1804c7[_0xd4de('0x9')],_0x1804c7[_0xd4de('0x12')]));_0x1804c7['agentringnoanswer']=!![];_0x1804c7['agentringnoanswerAt']=utils[_0xd4de('0x17')]();_0x1804c7[_0xd4de('0xc')]=_0xd4de('0x29');_0x1804c7[_0xd4de('0x20')]='abandoned';_0x1804c7[_0xd4de('0x2a')]=_0x50cb73[_0xd4de('0x2a')];_0x1804c7['talktime']=0x0;writeDB(_0x1804c7);}});}catch(_0x329d49){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x27'),_0x50cb73[_0xd4de('0x6')]),_0x329d49);}};exports[_0xd4de('0x2b')]=function(_0x53441c){try{if(agents[_0x53441c['destuniqueid']]){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x2c'),_0x53441c['uniqueid']),_0x53441c);utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x53441c[_0xd4de('0x6')],agents[_0x53441c[_0xd4de('0x12')]][_0xd4de('0x9')],_0x53441c[_0xd4de('0x12')]));agents[_0x53441c['destuniqueid']]['agentconnectAt']=utils[_0xd4de('0x17')]();agents[_0x53441c['destuniqueid']][_0xd4de('0xb')]=_0x53441c['connectedlinenum'];agents[_0x53441c[_0xd4de('0x12')]][_0xd4de('0x19')]=_0x53441c[_0xd4de('0x19')];agents[_0x53441c[_0xd4de('0x12')]]['holdtime']=_0x53441c[_0xd4de('0x21')];agents[_0x53441c['destuniqueid']][_0xd4de('0xc')]=_0xd4de('0x2d');_[_0xd4de('0x25')](agents,function(_0x4517a6,_0x349c5f){if(_0x4517a6[_0xd4de('0x12')]!=_0x53441c[_0xd4de('0x12')]&&_0x4517a6['uniqueid']==_0x53441c[_0xd4de('0x6')]){_0x4517a6[_0xd4de('0x22')]=0x0;_0x4517a6[_0xd4de('0x2a')]=_0x53441c[_0xd4de('0x21')];_0x4517a6[_0xd4de('0x1a')]=!![];_0x4517a6['agentringnoanswerAt']=utils[_0xd4de('0x17')]();_0x4517a6[_0xd4de('0xc')]=_0xd4de('0x2e');_0x4517a6['reason']=_0xd4de('0x2e');_0x4517a6[_0xd4de('0x2f')]=_0x53441c[_0xd4de('0x12')];_0x4517a6['answeredelsewheremembername']=_0x53441c[_0xd4de('0x9')];writeDB(_0x4517a6);}});}}catch(_0x10a42c){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x2c'),_0x53441c[_0xd4de('0x6')]),_0x10a42c);}};exports[_0xd4de('0xe')]=function(_0x5ecbbd){try{if(!_[_0xd4de('0x1b')](agents[_0x5ecbbd[_0xd4de('0x12')]])){utils[_0xd4de('0x14')](util['format'](_0xd4de('0x30'),_0x5ecbbd[_0xd4de('0x6')]),_0x5ecbbd);utils[_0xd4de('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5ecbbd[_0xd4de('0x6')],agents[_0x5ecbbd[_0xd4de('0x12')]]['membername'],_0x5ecbbd[_0xd4de('0x12')]));agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0xe')]=!![];agents[_0x5ecbbd[_0xd4de('0x12')]]['agentcompleteAt']=utils[_0xd4de('0x17')]();agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x22')]=utils[_0xd4de('0x31')](agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x32')],agents[_0x5ecbbd['destuniqueid']][_0xd4de('0x33')]);agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x20')]=_0x5ecbbd[_0xd4de('0x20')];agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x34');writeDB(agents[_0x5ecbbd[_0xd4de('0x12')]]);}}catch(_0xaf442c){utils[_0xd4de('0x23')](util['format'](_0xd4de('0x30'),_0x5ecbbd[_0xd4de('0x6')]),_0xaf442c);}};exports[_0xd4de('0x35')]=function(_0x518bfe){try{if(!_[_0xd4de('0x1b')](agents[_0x518bfe[_0xd4de('0x36')]])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x37'),_0x518bfe[_0xd4de('0x6')]),_0x518bfe);utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x38'),_0x518bfe[_0xd4de('0x6')],agents[_0x518bfe['transfereruniqueid']][_0xd4de('0x9')],agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x6')]));agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x39')]=!![];agents[_0x518bfe['transfereruniqueid']]['transfertype']=_0xd4de('0x3a');agents[_0x518bfe[_0xd4de('0x36')]]['transferexten']=_0x518bfe['extension'];agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x3b')]=agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x6')];}}catch(_0x34d772){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x37'),_0x518bfe[_0xd4de('0x6')]),_0x34d772);}};exports[_0xd4de('0x3c')]=function(_0x3be8c2){try{utils[_0xd4de('0x14')](util['format'](_0xd4de('0x3d'),_0x3be8c2[_0xd4de('0x3e')]),_0x3be8c2);if(_0x3be8c2[_0xd4de('0x3e')]==_0x3be8c2[_0xd4de('0x3f')]){if(!_[_0xd4de('0x1b')](agents[_0x3be8c2[_0xd4de('0x40')]])){utils['info'](util[_0xd4de('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3be8c2['origtransfereruniqueid'],agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x9')]));agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x39')]=!![];agents[_0x3be8c2['secondtransfereruniqueid']][_0xd4de('0x41')]=_0xd4de('0x42');agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x43')]=_0x3be8c2[_0xd4de('0x44')];agents[_0x3be8c2['secondtransfereruniqueid']]['transferuniqueid']=_0x3be8c2['origtransfereruniqueid'];}if(_0x3be8c2[_0xd4de('0x45')]&&agents[_0x3be8c2[_0xd4de('0x45')]]){agents[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x46')]=0x1;transfers[_0x3be8c2['transfereeuniqueid']]=_[_0xd4de('0x47')](agents[_0x3be8c2[_0xd4de('0x45')]]);transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0xa')]=agents[_0x3be8c2['secondtransfereruniqueid']][_0xd4de('0xa')];transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x48')]=agents[_0x3be8c2[_0xd4de('0x40')]]['calleridname'];transfers[_0x3be8c2['transfereeuniqueid']]['agentcalledAt']=utils[_0xd4de('0x17')]();transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x33')]=utils['now']();transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x2a')]=0x0;transfers[_0x3be8c2[_0xd4de('0x45')]]['agententerreason']=0x2;}}else if(_0x3be8c2[_0xd4de('0x40')]==_0x3be8c2['secondtransfererlinkedid']){if(!_[_0xd4de('0x1b')](agents[_0x3be8c2[_0xd4de('0x3e')]])){utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x49'),_0x3be8c2[_0xd4de('0x3e')],agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x9')]));agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x39')]=!![];agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x41')]=_0xd4de('0x42');agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x43')]=_0x3be8c2[_0xd4de('0x4a')];agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x3b')]=_0x3be8c2[_0xd4de('0x40')];}if(_0x3be8c2[_0xd4de('0x4b')]&&agents[_0x3be8c2[_0xd4de('0x4b')]]){agents[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x46')]=0x1;transfers[_0x3be8c2[_0xd4de('0x4b')]]=_[_0xd4de('0x47')](agents[_0x3be8c2[_0xd4de('0x4b')]]);transfers[_0x3be8c2[_0xd4de('0x4b')]]['calleridnum']=agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0xa')];transfers[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x48')]=agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x48')];transfers[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x16')]=utils['now']();transfers[_0x3be8c2[_0xd4de('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x3be8c2['transfertargetuniqueid']][_0xd4de('0x2a')]=0x0;transfers[_0x3be8c2[_0xd4de('0x4b')]]['agententerreason']=0x2;}}}catch(_0x4a06b2){utils['error'](util['format'](_0xd4de('0x3d'),_0x3be8c2['origtransfereruniqueid']),_0x4a06b2);}};exports[_0xd4de('0x4c')]=function(_0x5ddba5){try{utils[_0xd4de('0x14')](util[_0xd4de('0x4')]('[%s][agents][hangup]',_0x5ddba5['uniqueid']),_0x5ddba5);if(agents[_0x5ddba5['uniqueid']]&&agents[_0x5ddba5['uniqueid']][_0xd4de('0x20')]===_0xd4de('0x1f')){if(_0x5ddba5[_0xd4de('0x4d')]==='21'){agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]=_0xd4de('0x4e');agents[_0x5ddba5['uniqueid']]['lastevent']='rejected';}utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],agents[_0x5ddba5['uniqueid']][_0xd4de('0x9')],agents[_0x5ddba5['uniqueid']][_0xd4de('0x20')],agents[_0x5ddba5[_0xd4de('0x6')]]['lastevent']));writeDB(agents[_0x5ddba5[_0xd4de('0x6')]]);var _0x5a4882=unanswered[_0xd4de('0x4f')](_0x5ddba5[_0xd4de('0x6')]);if(_0x5a4882>-0x1){unanswered[_0xd4de('0x50')](_0x5a4882,0x1);}}if(transfers[_0x5ddba5[_0xd4de('0x6')]]){transfers[_0x5ddba5['uniqueid']][_0xd4de('0xe')]=!![];transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')]=utils[_0xd4de('0x17')]();transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x22')]=utils[_0xd4de('0x31')](transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x33')]);transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]='agent';transfers[_0x5ddba5[_0xd4de('0x6')]]['lastevent']='complete';utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x9')],transfers[_0x5ddba5[_0xd4de('0x6')]]['reason'],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]));writeDB(transfers[_0x5ddba5[_0xd4de('0x6')]],!![]);}if(agents[_0x5ddba5[_0xd4de('0x6')]]&&agents[_0x5ddba5[_0xd4de('0x6')]]['agentconnectAt']){agents[_0x5ddba5['uniqueid']]['agentcomplete']=!![];agents[_0x5ddba5['uniqueid']][_0xd4de('0x32')]=utils['now']();agents[_0x5ddba5[_0xd4de('0x6')]]['talktime']=utils[_0xd4de('0x31')](agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x33')]);agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]=agents[_0x5ddba5[_0xd4de('0x6')]]['transfer']?_0xd4de('0x39'):_0xd4de('0x51');agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]='complete';utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x9')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]));writeDB(agents[_0x5ddba5[_0xd4de('0x6')]]);}}catch(_0x27fd09){utils[_0xd4de('0x23')](util[_0xd4de('0x4')]('[%s][agents][hangup]',_0x5ddba5[_0xd4de('0x6')]),_0x27fd09);}}; \ No newline at end of file +var _0x1339=['talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','clone','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime'];(function(_0x1c73ee,_0x49a9c9){var _0x154f05=function(_0x3987f1){while(--_0x3987f1){_0x1c73ee['push'](_0x1c73ee['shift']());}};_0x154f05(++_0x49a9c9);}(_0x1339,0x1ed));var _0x9133=function(_0x49d02c,_0x3934dc){_0x49d02c=_0x49d02c-0x0;var _0x1ad223=_0x1339[_0x49d02c];return _0x1ad223;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9133('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2a91b2,_0x4611be){utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x3'),_0x2a91b2[_0x9133('0x4')],_0x2a91b2[_0x9133('0x5')],_0x2a91b2['queue'],_0x2a91b2[_0x9133('0x6')],_0x2a91b2[_0x9133('0x7')],_0x2a91b2[_0x9133('0x8')],_0x2a91b2['connectedlinenum'],_0x2a91b2[_0x9133('0x9')]));if(_0x2a91b2[_0x9133('0xa')]){utils[_0x9133('0xb')](_0x2a91b2[_0x9133('0xa')])[_0x9133('0xc')](function(_0x3a7a80){if(_0x3a7a80){_0x2a91b2[_0x9133('0xd')]=_0x3a7a80[_0x9133('0xd')];_0x2a91b2[_0x9133('0xe')]=_0x2a91b2[_0x9133('0xf')]?_0x3a7a80['acw']:![];_0x2a91b2[_0x9133('0x10')]=_0x2a91b2[_0x9133('0xe')]?_0x3a7a80[_0x9133('0x11')]:0x0;}utils[_0x9133('0x12')](_0x9133('0x13'),_0x2a91b2);});}else{utils[_0x9133('0x12')]('CreateVoiceAgentReport',_0x2a91b2);}if(_0x4611be){delete transfers[_0x2a91b2[_0x9133('0x4')]];}else{delete agents[_0x2a91b2[_0x9133('0x14')]];}}exports['agentcalled']=function(_0x5283a3){try{utils[_0x9133('0x15')](util['format'](_0x9133('0x16'),_0x5283a3[_0x9133('0x4')]),_0x5283a3);agents[_0x5283a3[_0x9133('0x14')]]=_0x5283a3;agents[_0x5283a3[_0x9133('0x14')]][_0x9133('0x17')]=utils[_0x9133('0x18')]();agents[_0x5283a3['destuniqueid']][_0x9133('0x9')]=_0x9133('0x19');agents[_0x5283a3['destuniqueid']][_0x9133('0x1a')]=null;agents[_0x5283a3[_0x9133('0x14')]][_0x9133('0x1b')]=null;utils[_0x9133('0x1')](util['format'](_0x9133('0x1c'),_0x5283a3['uniqueid'],agents[_0x5283a3[_0x9133('0x14')]]['membername'],_0x5283a3[_0x9133('0x14')]));}catch(_0x1d6d0b){utils['error'](util[_0x9133('0x2')]('[%s][agents][agentcalled]',_0x5283a3[_0x9133('0x4')]),_0x1d6d0b);}};exports['agentringnoanswer']=function(_0x5e4f0c){try{if(!_[_0x9133('0x1d')](agents[_0x5e4f0c['destuniqueid']])){utils[_0x9133('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x5e4f0c['uniqueid']),_0x5e4f0c);utils[_0x9133('0x1')](util[_0x9133('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5e4f0c[_0x9133('0x4')],agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x6')],_0x5e4f0c[_0x9133('0x14')]));agents[_0x5e4f0c['destuniqueid']][_0x9133('0x1e')]=!![];agents[_0x5e4f0c['destuniqueid']][_0x9133('0x1f')]=utils[_0x9133('0x18')]();agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x9')]=_0x9133('0x20');agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x21')]=_0x9133('0x20');agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x22')]=_0x5e4f0c['ringtime']?parseInt(_0x5e4f0c['ringtime'])/0x3e8:0x0;agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x23')]=0x0;unanswered[_0x9133('0x24')](_0x5e4f0c[_0x9133('0x14')]);}}catch(_0x4de894){utils['error'](util[_0x9133('0x2')](_0x9133('0x25'),_0x5e4f0c[_0x9133('0x4')]),_0x4de894);}};exports[_0x9133('0x26')]=function(_0x390f50){try{_[_0x9133('0x27')](agents,function(_0x48c713,_0x58afe0){if(_0x48c713['uniqueid']==_0x390f50[_0x9133('0x4')]&&!_['includes'](unanswered,_0x48c713[_0x9133('0x14')])){utils[_0x9133('0x15')](util['format'](_0x9133('0x28'),_0x390f50['uniqueid']),_0x390f50);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x29'),_0x390f50['uniqueid'],_0x48c713[_0x9133('0x6')],_0x48c713[_0x9133('0x14')]));_0x48c713[_0x9133('0x1e')]=!![];_0x48c713['agentringnoanswerAt']=utils[_0x9133('0x18')]();_0x48c713[_0x9133('0x9')]=_0x9133('0x2a');_0x48c713['reason']=_0x9133('0x2a');_0x48c713[_0x9133('0x22')]=_0x390f50[_0x9133('0x22')];_0x48c713[_0x9133('0x23')]=0x0;writeDB(_0x48c713);}});}catch(_0x5e4d5e){utils[_0x9133('0x2b')](util[_0x9133('0x2')]('[%s][agents][queuecallerabandon]',_0x390f50[_0x9133('0x4')]),_0x5e4d5e);}};exports[_0x9133('0x2c')]=function(_0x593fbe){try{if(agents[_0x593fbe[_0x9133('0x14')]]){utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x2d'),_0x593fbe[_0x9133('0x4')]),_0x593fbe);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x2e'),_0x593fbe['uniqueid'],agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x6')],_0x593fbe['destuniqueid']));agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x2f')]=utils[_0x9133('0x18')]();agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x1a')]=_0x593fbe[_0x9133('0x1a')];agents[_0x593fbe['destuniqueid']]['connectedlinename']=_0x593fbe[_0x9133('0x1b')];agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x22')]=_0x593fbe[_0x9133('0x30')];agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x9')]=_0x9133('0x31');_[_0x9133('0x27')](agents,function(_0x720048,_0x5a3f73){if(_0x720048[_0x9133('0x14')]!=_0x593fbe[_0x9133('0x14')]&&_0x720048[_0x9133('0x4')]==_0x593fbe[_0x9133('0x4')]){_0x720048[_0x9133('0x23')]=0x0;_0x720048['holdtime']=_0x593fbe[_0x9133('0x30')];_0x720048[_0x9133('0x1e')]=!![];_0x720048[_0x9133('0x1f')]=utils[_0x9133('0x18')]();_0x720048['lastevent']=_0x9133('0x32');_0x720048[_0x9133('0x21')]=_0x9133('0x32');_0x720048[_0x9133('0x33')]=_0x593fbe[_0x9133('0x14')];_0x720048[_0x9133('0x34')]=_0x593fbe[_0x9133('0x6')];writeDB(_0x720048);}});}}catch(_0x4ca1a3){utils[_0x9133('0x2b')](util['format']('[%s][agents][agentconnect]',_0x593fbe[_0x9133('0x4')]),_0x4ca1a3);}};exports[_0x9133('0xf')]=function(_0x46156d){try{if(!_[_0x9133('0x1d')](agents[_0x46156d[_0x9133('0x14')]])){utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x35'),_0x46156d[_0x9133('0x4')]),_0x46156d);utils['info'](util[_0x9133('0x2')](_0x9133('0x36'),_0x46156d[_0x9133('0x4')],agents[_0x46156d['destuniqueid']]['membername'],_0x46156d[_0x9133('0x14')]));agents[_0x46156d[_0x9133('0x14')]]['agentcomplete']=!![];agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x37')]=utils[_0x9133('0x18')]();agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x23')]=utils['diffTime'](agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x37')],agents[_0x46156d[_0x9133('0x14')]]['agentconnectAt']);agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x21')]=_0x46156d['reason'];agents[_0x46156d['destuniqueid']][_0x9133('0x9')]=_0x9133('0x38');writeDB(agents[_0x46156d[_0x9133('0x14')]]);}}catch(_0x41fea9){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x35'),_0x46156d[_0x9133('0x4')]),_0x41fea9);}};exports[_0x9133('0x39')]=function(_0xf07fbb){try{if(!_[_0x9133('0x1d')](agents[_0xf07fbb[_0x9133('0x3a')]])){utils['debug'](util['format'](_0x9133('0x3b'),_0xf07fbb['uniqueid']),_0xf07fbb);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x3c'),_0xf07fbb[_0x9133('0x4')],agents[_0xf07fbb['transfereruniqueid']][_0x9133('0x6')],agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x4')]));agents[_0xf07fbb['transfereruniqueid']][_0x9133('0x3d')]=!![];agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x3e')]='blind';agents[_0xf07fbb[_0x9133('0x3a')]]['transferexten']=_0xf07fbb[_0x9133('0x3f')];agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x40')]=agents[_0xf07fbb[_0x9133('0x3a')]]['uniqueid'];}}catch(_0x4a346c){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x3b'),_0xf07fbb[_0x9133('0x4')]),_0x4a346c);}};exports[_0x9133('0x41')]=function(_0x565920){try{utils['debug'](util[_0x9133('0x2')](_0x9133('0x42'),_0x565920['origtransfereruniqueid']),_0x565920);if(_0x565920[_0x9133('0x43')]==_0x565920[_0x9133('0x44')]){if(!_['isNil'](agents[_0x565920['secondtransfereruniqueid']])){utils['info'](util[_0x9133('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x565920[_0x9133('0x43')],agents[_0x565920[_0x9133('0x45')]][_0x9133('0x6')]));agents[_0x565920[_0x9133('0x45')]]['transfer']=!![];agents[_0x565920[_0x9133('0x45')]]['transfertype']=_0x9133('0x46');agents[_0x565920[_0x9133('0x45')]][_0x9133('0x47')]=_0x565920[_0x9133('0x48')];agents[_0x565920[_0x9133('0x45')]][_0x9133('0x40')]=_0x565920['origtransfereruniqueid'];}if(_0x565920['transfereeuniqueid']&&agents[_0x565920['transfereeuniqueid']]){agents[_0x565920[_0x9133('0x49')]][_0x9133('0x4a')]=0x1;transfers[_0x565920[_0x9133('0x49')]]=_['clone'](agents[_0x565920[_0x9133('0x49')]]);transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x8')]=agents[_0x565920[_0x9133('0x45')]][_0x9133('0x8')];transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x4b')]=agents[_0x565920[_0x9133('0x45')]]['calleridname'];transfers[_0x565920[_0x9133('0x49')]]['agentcalledAt']=utils[_0x9133('0x18')]();transfers[_0x565920['transfereeuniqueid']][_0x9133('0x2f')]=utils[_0x9133('0x18')]();transfers[_0x565920['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x4a')]=0x2;}}else if(_0x565920[_0x9133('0x45')]==_0x565920[_0x9133('0x4c')]){if(!_[_0x9133('0x1d')](agents[_0x565920[_0x9133('0x43')]])){utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x4d'),_0x565920[_0x9133('0x43')],agents[_0x565920[_0x9133('0x43')]]['membername']));agents[_0x565920[_0x9133('0x43')]]['transfer']=!![];agents[_0x565920[_0x9133('0x43')]][_0x9133('0x3e')]=_0x9133('0x46');agents[_0x565920[_0x9133('0x43')]][_0x9133('0x47')]=_0x565920['secondtransfererexten'];agents[_0x565920[_0x9133('0x43')]][_0x9133('0x40')]=_0x565920[_0x9133('0x45')];}if(_0x565920[_0x9133('0x4e')]&&agents[_0x565920['transfertargetuniqueid']]){agents[_0x565920[_0x9133('0x4e')]][_0x9133('0x4a')]=0x1;transfers[_0x565920[_0x9133('0x4e')]]=_[_0x9133('0x4f')](agents[_0x565920['transfertargetuniqueid']]);transfers[_0x565920['transfertargetuniqueid']][_0x9133('0x8')]=agents[_0x565920[_0x9133('0x43')]][_0x9133('0x8')];transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x4b')]=agents[_0x565920[_0x9133('0x43')]]['calleridname'];transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x17')]=utils[_0x9133('0x18')]();transfers[_0x565920[_0x9133('0x4e')]]['agentconnectAt']=utils[_0x9133('0x18')]();transfers[_0x565920['transfertargetuniqueid']][_0x9133('0x22')]=0x0;transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x4a')]=0x2;}}}catch(_0x39b46d){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x42'),_0x565920[_0x9133('0x43')]),_0x39b46d);}};exports['hangup']=function(_0x23bd83){try{utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x50'),_0x23bd83[_0x9133('0x4')]),_0x23bd83);if(agents[_0x23bd83['uniqueid']]&&agents[_0x23bd83['uniqueid']]['reason']===_0x9133('0x20')){if(_0x23bd83[_0x9133('0x51')]==='21'){agents[_0x23bd83[_0x9133('0x4')]]['reason']=_0x9133('0x52');agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x9')]=_0x9133('0x52');}utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x53'),_0x23bd83[_0x9133('0x4')],agents[_0x23bd83['uniqueid']][_0x9133('0x6')],agents[_0x23bd83[_0x9133('0x4')]]['reason'],agents[_0x23bd83[_0x9133('0x4')]]['lastevent']));writeDB(agents[_0x23bd83[_0x9133('0x4')]]);var _0x439352=unanswered[_0x9133('0x54')](_0x23bd83[_0x9133('0x4')]);if(_0x439352>-0x1){unanswered[_0x9133('0x55')](_0x439352,0x1);}}if(transfers[_0x23bd83['uniqueid']]){transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0xf')]=!![];transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x37')]=utils['now']();transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x23')]=utils[_0x9133('0x56')](transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x37')],transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x2f')]);transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')]=_0x9133('0x57');transfers[_0x23bd83[_0x9133('0x4')]]['lastevent']=_0x9133('0x38');utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x53'),_0x23bd83['uniqueid'],transfers[_0x23bd83[_0x9133('0x4')]]['membername'],transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')],transfers[_0x23bd83[_0x9133('0x4')]]['lastevent']));writeDB(transfers[_0x23bd83[_0x9133('0x4')]],!![]);}if(agents[_0x23bd83[_0x9133('0x4')]]&&agents[_0x23bd83[_0x9133('0x4')]]['agentconnectAt']){agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0xf')]=!![];agents[_0x23bd83['uniqueid']][_0x9133('0x37')]=utils[_0x9133('0x18')]();agents[_0x23bd83[_0x9133('0x4')]]['talktime']=utils[_0x9133('0x56')](agents[_0x23bd83['uniqueid']][_0x9133('0x37')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x2f')]);agents[_0x23bd83['uniqueid']][_0x9133('0x21')]=agents[_0x23bd83['uniqueid']][_0x9133('0x3d')]?_0x9133('0x3d'):_0x9133('0x57');agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x9')]=_0x9133('0x38');utils[_0x9133('0x1')](util[_0x9133('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x23bd83[_0x9133('0x4')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x6')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')],agents[_0x23bd83['uniqueid']][_0x9133('0x9')]));writeDB(agents[_0x23bd83[_0x9133('0x4')]]);}}catch(_0x1b66d0){utils[_0x9133('0x2b')](util['format'](_0x9133('0x50'),_0x23bd83['uniqueid']),_0x1b66d0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 7b89691..b68b510 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 _0xf90c=['queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','DOCUMENTATION','newstate','isNil','channelstate','systemanswertime','now','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','error','origtransfereruniqueid','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','lastapplication','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel'];(function(_0xf80ac2,_0x2e4049){var _0x3868f2=function(_0x3ecd81){while(--_0x3ecd81){_0xf80ac2['push'](_0xf80ac2['shift']());}};_0x3868f2(++_0x2e4049);}(_0xf90c,0x1a9));var _0xcf90=function(_0x41407b,_0x350f69){_0x41407b=_0x41407b-0x0;var _0x103708=_0xf90c[_0x41407b];return _0x103708;};'use strict';var _=require(_0xcf90('0x0'));var util=require(_0xcf90('0x1'));var utils=require(_0xcf90('0x2'));var transfers=require(_0xcf90('0x3'));var dispositions=[_0xcf90('0x4'),_0xcf90('0x5'),_0xcf90('0x5'),_0xcf90('0x4'),_0xcf90('0x4'),_0xcf90('0x4'),_0xcf90('0x6'),_0xcf90('0x7'),_0xcf90('0x5'),'FAILED',_0xcf90('0x5')];var channels={};function writeDB(_0x5e88de){var _0x243972;if(transfers[_0xcf90('0x8')][_0x5e88de[_0xcf90('0x9')]]){_0x243972=_0x5e88de['uniqueid'];_0x5e88de[_0xcf90('0x9')]=transfers[_0xcf90('0x8')][_0x5e88de[_0xcf90('0x9')]][_0xcf90('0xa')];}utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0xd'),_0x5e88de[_0xcf90('0x9')],_0x5e88de[_0xcf90('0xe')],_0x5e88de[_0xcf90('0xf')],_0x5e88de['membername'],_0x5e88de[_0xcf90('0x10')],_0x5e88de[_0xcf90('0x11')],_0x5e88de[_0xcf90('0x12')],_0x5e88de[_0xcf90('0x13')]));if(_0x5e88de[_0xcf90('0x14')]){utils[_0xcf90('0x15')](_0x5e88de[_0xcf90('0x14')])[_0xcf90('0x16')](function(_0x590ab8){if(_0x590ab8){_0x5e88de[_0xcf90('0x17')]=_0x590ab8['id'];}utils[_0xcf90('0x18')]('CreateVoiceCallReport',_0x5e88de);});}else{utils[_0xcf90('0x18')](_0xcf90('0x19'),_0x5e88de);}if(channels[_0x5e88de[_0xcf90('0x9')]]){delete channels[_0x5e88de[_0xcf90('0x9')]];}else if(_0x243972&&channels[_0x243972]){if(!transfers[_0xcf90('0x8')][_0x243972][_0xcf90('0x1a')])delete transfers[_0xcf90('0x8')][_0x243972];delete channels[_0x243972];}}exports['newchannel']=function(_0x1ec8d2){try{utils[_0xcf90('0x1b')](util['format'](_0xcf90('0x1c'),_0x1ec8d2[_0xcf90('0x9')]),_0x1ec8d2);if(_0x1ec8d2[_0xcf90('0x9')]==_0x1ec8d2['linkedid']&&_0x1ec8d2[_0xcf90('0xe')]!=_0xcf90('0x1d')){utils[_0xcf90('0xb')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x1ec8d2[_0xcf90('0x9')],_0x1ec8d2[_0xcf90('0x1e')],_0x1ec8d2['exten']));channels[_0x1ec8d2['uniqueid']]={'uniqueid':_0x1ec8d2[_0xcf90('0x9')],'accountcode':_0x1ec8d2['accountcode'],'source':_0x1ec8d2[_0xcf90('0x11')],'destination':_0x1ec8d2[_0xcf90('0x1f')],'destinationcontext':_0x1ec8d2['context'],'channel':_0x1ec8d2['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xcf90('0x20')};}}catch(_0x60646a){utils['error'](util[_0xcf90('0xc')](_0xcf90('0x1c'),_0x1ec8d2[_0xcf90('0x9')]),_0x60646a);}};exports[_0xcf90('0x21')]=function(_0x4f7624){try{utils[_0xcf90('0x1b')](util[_0xcf90('0xc')]('[%s][calls][newstate]',_0x4f7624[_0xcf90('0x9')]),_0x4f7624);if(!_[_0xcf90('0x22')](channels[_0x4f7624['uniqueid']])&&_0x4f7624[_0xcf90('0x23')]==0x6){utils[_0xcf90('0xb')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x4f7624['uniqueid'],_0x4f7624['context'],_0x4f7624[_0xcf90('0xe')]));if(_[_0xcf90('0x22')](channels[_0x4f7624[_0xcf90('0x9')]][_0xcf90('0x24')])){channels[_0x4f7624[_0xcf90('0x9')]][_0xcf90('0x24')]=utils[_0xcf90('0x25')]();}}else if(!_[_0xcf90('0x22')](channels[_0x4f7624[_0xcf90('0x26')]])&&_0x4f7624[_0xcf90('0x23')]==0x6&&_0x4f7624[_0xcf90('0x1e')]!='transfer'){utils['info'](util['format'](_0xcf90('0x27'),_0x4f7624[_0xcf90('0x9')],_0x4f7624['linkedid'],_0x4f7624[_0xcf90('0x1e')],_0x4f7624[_0xcf90('0xe')]));channels[_0x4f7624[_0xcf90('0x26')]][_0xcf90('0x14')]=_0x4f7624['accountcode'];channels[_0x4f7624[_0xcf90('0x26')]]['destinationchannel']=_0x4f7624[_0xcf90('0xe')];if(_[_0xcf90('0x22')](channels[_0x4f7624[_0xcf90('0x26')]]['answertime'])){channels[_0x4f7624[_0xcf90('0x26')]][_0xcf90('0x28')]=utils['now']();}channels[_0x4f7624['linkedid']][_0xcf90('0x29')]=dispositions[_[_0xcf90('0x2a')](_0x4f7624['channelstate'])]||_0xcf90('0x6');}}catch(_0x5f4c41){utils['error'](util['format'](_0xcf90('0x2b'),_0x4f7624[_0xcf90('0x9')]),_0x5f4c41);}};exports[_0xcf90('0x2c')]=function(_0x24fa08){try{if(!_[_0xcf90('0x22')](channels[_0x24fa08['uniqueid']])){utils[_0xcf90('0x1b')](util[_0xcf90('0xc')](_0xcf90('0x2d'),_0x24fa08['uniqueid']),_0x24fa08);if(_[_0xcf90('0x22')](channels[_0x24fa08[_0xcf90('0x9')]][_0xcf90('0x2e')])){channels[_0x24fa08[_0xcf90('0x9')]][_0xcf90('0x2e')]=_0x24fa08[_0xcf90('0x2f')]+'\x20<'+_0x24fa08[_0xcf90('0x11')]+'>';}utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x30'),_0x24fa08[_0xcf90('0x9')],channels[_0x24fa08[_0xcf90('0x9')]][_0xcf90('0x2e')],_0x24fa08[_0xcf90('0x31')]));channels[_0x24fa08[_0xcf90('0x9')]][_0xcf90('0x32')]=utils[_0xcf90('0x25')]();channels[_0x24fa08[_0xcf90('0x9')]][_0xcf90('0x33')]=utils['diffTime'](channels[_0x24fa08['uniqueid']][_0xcf90('0x32')],channels[_0x24fa08[_0xcf90('0x9')]][_0xcf90('0x34')]);channels[_0x24fa08['uniqueid']][_0xcf90('0x35')]=channels[_0x24fa08[_0xcf90('0x9')]][_0xcf90('0x28')]?utils['diffTime'](channels[_0x24fa08['uniqueid']][_0xcf90('0x32')],channels[_0x24fa08[_0xcf90('0x9')]][_0xcf90('0x28')]):0x0;writeDB(channels[_0x24fa08[_0xcf90('0x9')]]);}}catch(_0x44e3f7){utils['error'](util[_0xcf90('0xc')](_0xcf90('0x2d'),_0x24fa08[_0xcf90('0x9')]),_0x44e3f7);}};exports[_0xcf90('0x36')]=function(_0x48528c){try{if(!_[_0xcf90('0x22')](channels[_0x48528c['localtwolinkedid']])){utils[_0xcf90('0x1b')](util['format'](_0xcf90('0x37'),_0x48528c['origtransfereruniqueid']),_0x48528c);if(channels[_0x48528c[_0xcf90('0x38')]][_0xcf90('0xe')]==_0x48528c[_0xcf90('0x39')]){utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x3a'),_0x48528c['origtransfereruniqueid'],_0x48528c[_0xcf90('0x38')],_0x48528c['secondtransfererchannel']));channels[_0x48528c['localtwolinkedid']]['destinationchannel']=_0x48528c[_0xcf90('0x3b')];channels[_0x48528c[_0xcf90('0x38')]]['userfield']=_0xcf90('0x3c');}else if(channels[_0x48528c['localtwolinkedid']][_0xcf90('0xe')]=_0x48528c[_0xcf90('0x3d')]){utils['info'](util[_0xcf90('0xc')](_0xcf90('0x3a'),_0x48528c['origtransfereruniqueid'],_0x48528c[_0xcf90('0x38')],_0x48528c[_0xcf90('0x3e')]));channels[_0x48528c[_0xcf90('0x38')]][_0xcf90('0x3f')]=_0x48528c[_0xcf90('0x3e')];channels[_0x48528c[_0xcf90('0x38')]]['userfield']='_attended';}}}catch(_0x787ec8){utils[_0xcf90('0x40')](util['format'](_0xcf90('0x37'),_0x48528c[_0xcf90('0x41')]),_0x787ec8);}};exports['musiconholdstart']=function(_0x3f71ec){try{if(!_[_0xcf90('0x22')](channels[_0x3f71ec[_0xcf90('0x9')]])){utils[_0xcf90('0x1b')](util[_0xcf90('0xc')](_0xcf90('0x42'),_0x3f71ec[_0xcf90('0x9')]),_0x3f71ec);channels[_0x3f71ec[_0xcf90('0x9')]][_0xcf90('0x43')]=utils['now']();utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x44'),_0x3f71ec['uniqueid'],channels[_0x3f71ec[_0xcf90('0x9')]][_0xcf90('0x43')]));}}catch(_0x5f2162){utils['error'](util['format']('[%s][calls][musiconholdstart]',_0x3f71ec[_0xcf90('0x9')]),_0x5f2162);}};exports[_0xcf90('0x45')]=function(_0x415e86){try{if(!_['isNil'](channels[_0x415e86[_0xcf90('0x9')]])){utils['debug'](util[_0xcf90('0xc')]('[%s][calls][musiconholdstop]',_0x415e86[_0xcf90('0x9')]),_0x415e86);if(!_[_0xcf90('0x22')](channels[_0x415e86[_0xcf90('0x9')]][_0xcf90('0x43')])){channels[_0x415e86[_0xcf90('0x9')]][_0xcf90('0x46')]+=utils['diffTime'](utils['now'](),channels[_0x415e86[_0xcf90('0x9')]][_0xcf90('0x43')]);utils['info'](util[_0xcf90('0xc')](_0xcf90('0x47'),_0x415e86['uniqueid'],channels[_0x415e86[_0xcf90('0x9')]][_0xcf90('0x46')]));delete channels[_0x415e86['uniqueid']][_0xcf90('0x43')];}}}catch(_0x49e800){utils[_0xcf90('0x40')](util[_0xcf90('0xc')](_0xcf90('0x48'),_0x415e86['uniqueid']),_0x49e800);}};exports[_0xcf90('0x49')]=function(_0x30614b){try{if(!_['isNil'](channels[_0x30614b[_0xcf90('0x9')]])){utils[_0xcf90('0x1b')](util[_0xcf90('0xc')](_0xcf90('0x4a'),_0x30614b['uniqueid']),_0x30614b);if(!_[_0xcf90('0x22')](_0x30614b['variable'][_0xcf90('0x4b')])){utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x4c'),_0x30614b[_0xcf90('0x9')],_0x30614b[_0xcf90('0x4d')]));channels[_0x30614b['uniqueid']]['source']=_0x30614b['value'];}if(!_[_0xcf90('0x22')](_0x30614b[_0xcf90('0x4e')]['xmd-phone'])){utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x4f'),_0x30614b['uniqueid'],_0x30614b[_0xcf90('0x4d')]));channels[_0x30614b['uniqueid']]['destination']=_0x30614b[_0xcf90('0x4d')];channels[_0x30614b[_0xcf90('0x9')]]['callerid']='\x22'+_0x30614b['value']+'\x22\x20<'+_0x30614b['value']+'>';}if(!_['isNil'](_0x30614b['variable'][_0xcf90('0x50')])||!_[_0xcf90('0x22')](_0x30614b['variable'][_0xcf90('0x51')])){utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x52'),_0x30614b['uniqueid'],!_[_0xcf90('0x22')](_0x30614b[_0xcf90('0x4e')][_0xcf90('0x50')])?_0xcf90('0x50'):_0xcf90('0x51'),_0x30614b[_0xcf90('0x4d')]));channels[_0x30614b[_0xcf90('0x9')]][_0xcf90('0x2e')]=_0x30614b['value'];}if(!_['isNil'](_0x30614b[_0xcf90('0x4e')][_0xcf90('0x53')])||!_[_0xcf90('0x22')](_0x30614b[_0xcf90('0x4e')]['xmcs-queue'])){utils['info'](util[_0xcf90('0xc')](_0xcf90('0x52'),_0x30614b['uniqueid'],!_['isNil'](_0x30614b[_0xcf90('0x4e')]['xmd-queue'])?_0xcf90('0x53'):'xmcs-queue',_0x30614b[_0xcf90('0x4d')]));channels[_0x30614b[_0xcf90('0x9')]]['lastapplication']='Queue';channels[_0x30614b[_0xcf90('0x9')]][_0xcf90('0x54')]=_0x30614b['value'];channels[_0x30614b[_0xcf90('0x9')]][_0xcf90('0xf')]=!![];}if(!_[_0xcf90('0x22')](_0x30614b['variable'][_0xcf90('0x55')])){utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x56'),_0x30614b[_0xcf90('0x9')],_0x30614b['value']));channels[_0x30614b[_0xcf90('0x9')]]['ContactId']=_0x30614b[_0xcf90('0x4d')];}if(!_[_0xcf90('0x22')](_0x30614b['variable'][_0xcf90('0x57')])){utils[_0xcf90('0xb')](util[_0xcf90('0xc')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x30614b[_0xcf90('0x9')],_0x30614b[_0xcf90('0x4d')]));channels[_0x30614b['uniqueid']][_0xcf90('0x58')]=_0x30614b[_0xcf90('0x4d')];}if(!_['isNil'](_0x30614b['variable'][_0xcf90('0x59')])){utils['info'](util[_0xcf90('0xc')](_0xcf90('0x5a'),_0x30614b[_0xcf90('0x9')],_0x30614b['value']));channels[_0x30614b[_0xcf90('0x9')]][_0xcf90('0x5b')]=_0x30614b[_0xcf90('0x4d')];}if(!_['isNil'](_0x30614b['variable']['sipcallid'])){utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x5c'),_0x30614b['uniqueid'],_0x30614b[_0xcf90('0x4d')]));channels[_0x30614b[_0xcf90('0x9')]][_0xcf90('0x5d')]=_0x30614b[_0xcf90('0x4d')];}}}catch(_0xd521ba){utils[_0xcf90('0x40')](util[_0xcf90('0xc')](_0xcf90('0x4a'),_0x30614b[_0xcf90('0x9')]),_0xd521ba);}};exports['newexten']=function(_0x48d34e){try{if(!_[_0xcf90('0x22')](channels[_0x48d34e['uniqueid']])){utils['debug'](util[_0xcf90('0xc')](_0xcf90('0x5e'),_0x48d34e[_0xcf90('0x9')]),_0x48d34e);utils[_0xcf90('0xb')](util[_0xcf90('0xc')](_0xcf90('0x5f'),_0x48d34e[_0xcf90('0x9')],_0x48d34e[_0xcf90('0x60')],_0x48d34e[_0xcf90('0x61')]));if(_0x48d34e[_0xcf90('0x60')][_0xcf90('0x62')]()=='set'&&_[_0xcf90('0x63')](_0x48d34e[_0xcf90('0x61')][_0xcf90('0x62')](),_0xcf90('0x64'))){var _0x5a6f8f=_0x48d34e['appdata'][_0xcf90('0x65')]('=');var _0x4ac4a4=_0x5a6f8f[0x0][_0xcf90('0x66')](_0x5a6f8f[0x0][_0xcf90('0x67')]('(')+0x1,_0x5a6f8f[0x0][_0xcf90('0x67')](')'));var _0x28a2e4=_0x5a6f8f[0x1];channels[_0x48d34e[_0xcf90('0x9')]][_0x4ac4a4]=_0x28a2e4;}if(!_[_0xcf90('0x68')]([_0xcf90('0x2c'),_0xcf90('0x69'),_0xcf90('0x6a'),_0xcf90('0x6b'),_0xcf90('0x6c')],_0x48d34e[_0xcf90('0x60')][_0xcf90('0x62')]())){channels[_0x48d34e['uniqueid']][_0xcf90('0x6d')]=_0x48d34e[_0xcf90('0x60')];channels[_0x48d34e[_0xcf90('0x9')]]['lastdata']=_0x48d34e['appdata'];}}}catch(_0x49d99f){utils[_0xcf90('0x40')](util['format']('[%s][calls][newexten]',_0x48d34e[_0xcf90('0x9')]),_0x49d99f);}}; \ No newline at end of file +var _0x4667=['origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','variable','xmd-originatecalleridnum','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','execif','set','gotoif','lodash','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','interface','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','calleridnum','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','channelstate','transfer','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel'];(function(_0x185839,_0x1c24bf){var _0x5a13b4=function(_0x344d00){while(--_0x344d00){_0x185839['push'](_0x185839['shift']());}};_0x5a13b4(++_0x1c24bf);}(_0x4667,0x10f));var _0x7466=function(_0x17da62,_0x4ad6c1){_0x17da62=_0x17da62-0x0;var _0x2e7612=_0x4667[_0x17da62];return _0x2e7612;};'use strict';var _=require(_0x7466('0x0'));var util=require(_0x7466('0x1'));var utils=require('./utils');var transfers=require(_0x7466('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x7466('0x3'),_0x7466('0x4'),_0x7466('0x4'),'NO\x20ANSWER',_0x7466('0x5'),_0x7466('0x6'),_0x7466('0x3'),_0x7466('0x3'),_0x7466('0x3')];var channels={};function writeDB(_0x24da21){var _0x2378e5;if(transfers[_0x7466('0x7')][_0x24da21[_0x7466('0x8')]]){_0x2378e5=_0x24da21[_0x7466('0x8')];_0x24da21['uniqueid']=transfers[_0x7466('0x7')][_0x24da21[_0x7466('0x8')]][_0x7466('0x9')];}utils['info'](util[_0x7466('0xa')](_0x7466('0xb'),_0x24da21[_0x7466('0x8')],_0x24da21['channel'],_0x24da21['queue'],_0x24da21[_0x7466('0xc')],_0x24da21[_0x7466('0xd')],_0x24da21['calleridnum'],_0x24da21['connectedlinenum'],_0x24da21[_0x7466('0xe')]));if(_0x24da21[_0x7466('0xf')]){utils[_0x7466('0x10')](_0x24da21[_0x7466('0xf')])['then'](function(_0x4a0272){if(_0x4a0272){_0x24da21['UserId']=_0x4a0272['id'];}utils[_0x7466('0x11')](_0x7466('0x12'),_0x24da21);});}else{utils['request'](_0x7466('0x12'),_0x24da21);}if(channels[_0x24da21['uniqueid']]){delete channels[_0x24da21[_0x7466('0x8')]];}else if(_0x2378e5&&channels[_0x2378e5]){if(!transfers['blinds'][_0x2378e5]['recording'])delete transfers[_0x7466('0x7')][_0x2378e5];delete channels[_0x2378e5];}}exports[_0x7466('0x13')]=function(_0x4e570e){try{utils[_0x7466('0x14')](util[_0x7466('0xa')](_0x7466('0x15'),_0x4e570e[_0x7466('0x8')]),_0x4e570e);if(_0x4e570e['uniqueid']==_0x4e570e[_0x7466('0x16')]&&_0x4e570e[_0x7466('0x17')]!=_0x7466('0x18')){utils[_0x7466('0x19')](util[_0x7466('0xa')](_0x7466('0x1a'),_0x4e570e[_0x7466('0x8')],_0x4e570e['context'],_0x4e570e['exten']));channels[_0x4e570e[_0x7466('0x8')]]={'uniqueid':_0x4e570e[_0x7466('0x8')],'accountcode':_0x4e570e[_0x7466('0xf')],'source':_0x4e570e[_0x7466('0x1b')],'destination':_0x4e570e[_0x7466('0x1c')],'destinationcontext':_0x4e570e[_0x7466('0x1d')],'channel':_0x4e570e['channel'],'starttime':utils[_0x7466('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7466('0x4'),'amaflags':_0x7466('0x1f')};}}catch(_0x5f4f14){utils[_0x7466('0x20')](util['format']('[%s][calls][newchannel]',_0x4e570e['uniqueid']),_0x5f4f14);}};exports[_0x7466('0x21')]=function(_0x1c9f93){try{utils[_0x7466('0x14')](util[_0x7466('0xa')](_0x7466('0x22'),_0x1c9f93['uniqueid']),_0x1c9f93);if(!_['isNil'](channels[_0x1c9f93[_0x7466('0x8')]])&&_0x1c9f93['channelstate']==0x6){utils['info'](util[_0x7466('0xa')](_0x7466('0x23'),_0x1c9f93[_0x7466('0x8')],_0x1c9f93[_0x7466('0x1d')],_0x1c9f93[_0x7466('0x17')]));if(_[_0x7466('0x24')](channels[_0x1c9f93[_0x7466('0x8')]][_0x7466('0x25')])){channels[_0x1c9f93[_0x7466('0x8')]]['systemanswertime']=utils[_0x7466('0x1e')]();}}else if(!_[_0x7466('0x24')](channels[_0x1c9f93[_0x7466('0x16')]])&&_0x1c9f93[_0x7466('0x26')]==0x6&&_0x1c9f93[_0x7466('0x1d')]!=_0x7466('0x27')){utils[_0x7466('0x19')](util[_0x7466('0xa')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1c9f93[_0x7466('0x8')],_0x1c9f93[_0x7466('0x16')],_0x1c9f93[_0x7466('0x1d')],_0x1c9f93[_0x7466('0x17')]));channels[_0x1c9f93[_0x7466('0x16')]]['accountcode']=_0x1c9f93[_0x7466('0xf')];channels[_0x1c9f93['linkedid']]['destinationchannel']=_0x1c9f93[_0x7466('0x17')];if(_[_0x7466('0x24')](channels[_0x1c9f93[_0x7466('0x16')]][_0x7466('0x28')])){channels[_0x1c9f93[_0x7466('0x16')]][_0x7466('0x28')]=utils[_0x7466('0x1e')]();}channels[_0x1c9f93[_0x7466('0x16')]]['disposition']=dispositions[_[_0x7466('0x29')](_0x1c9f93[_0x7466('0x26')])]||_0x7466('0x5');}}catch(_0x56cbfc){utils[_0x7466('0x20')](util[_0x7466('0xa')]('[%s][calls][newstate]',_0x1c9f93[_0x7466('0x8')]),_0x56cbfc);}};exports[_0x7466('0x2a')]=function(_0x27d301){try{if(!_[_0x7466('0x24')](channels[_0x27d301[_0x7466('0x8')]])){utils[_0x7466('0x14')](util[_0x7466('0xa')](_0x7466('0x2b'),_0x27d301[_0x7466('0x8')]),_0x27d301);if(_[_0x7466('0x24')](channels[_0x27d301['uniqueid']][_0x7466('0x2c')])){channels[_0x27d301[_0x7466('0x8')]][_0x7466('0x2c')]=_0x27d301['calleridname']+'\x20<'+_0x27d301['calleridnum']+'>';}utils[_0x7466('0x19')](util[_0x7466('0xa')](_0x7466('0x2d'),_0x27d301[_0x7466('0x8')],channels[_0x27d301['uniqueid']][_0x7466('0x2c')],_0x27d301[_0x7466('0x2e')]));channels[_0x27d301[_0x7466('0x8')]][_0x7466('0x2f')]=utils[_0x7466('0x1e')]();channels[_0x27d301[_0x7466('0x8')]]['duration']=utils[_0x7466('0x30')](channels[_0x27d301['uniqueid']][_0x7466('0x2f')],channels[_0x27d301[_0x7466('0x8')]][_0x7466('0x31')]);channels[_0x27d301[_0x7466('0x8')]][_0x7466('0x32')]=channels[_0x27d301[_0x7466('0x8')]]['answertime']?utils[_0x7466('0x30')](channels[_0x27d301[_0x7466('0x8')]][_0x7466('0x2f')],channels[_0x27d301[_0x7466('0x8')]][_0x7466('0x28')]):0x0;writeDB(channels[_0x27d301[_0x7466('0x8')]]);}}catch(_0x537cc9){utils[_0x7466('0x20')](util[_0x7466('0xa')]('[%s][calls][hangup]',_0x27d301[_0x7466('0x8')]),_0x537cc9);}};exports[_0x7466('0x33')]=function(_0x2a1862){try{if(!_['isNil'](channels[_0x2a1862[_0x7466('0x34')]])){utils[_0x7466('0x14')](util[_0x7466('0xa')](_0x7466('0x35'),_0x2a1862[_0x7466('0x36')]),_0x2a1862);if(channels[_0x2a1862[_0x7466('0x34')]]['channel']==_0x2a1862[_0x7466('0x37')]){utils[_0x7466('0x19')](util[_0x7466('0xa')](_0x7466('0x38'),_0x2a1862[_0x7466('0x36')],_0x2a1862[_0x7466('0x34')],_0x2a1862[_0x7466('0x39')]));channels[_0x2a1862[_0x7466('0x34')]][_0x7466('0x3a')]=_0x2a1862[_0x7466('0x39')];channels[_0x2a1862['localtwolinkedid']][_0x7466('0x3b')]=_0x7466('0x3c');}else if(channels[_0x2a1862[_0x7466('0x34')]][_0x7466('0x17')]=_0x2a1862[_0x7466('0x3d')]){utils['info'](util[_0x7466('0xa')](_0x7466('0x38'),_0x2a1862[_0x7466('0x36')],_0x2a1862['localtwolinkedid'],_0x2a1862[_0x7466('0x3e')]));channels[_0x2a1862[_0x7466('0x34')]][_0x7466('0x3a')]=_0x2a1862[_0x7466('0x3e')];channels[_0x2a1862[_0x7466('0x34')]]['userfield']='_attended';}}}catch(_0x278e85){utils[_0x7466('0x20')](util[_0x7466('0xa')](_0x7466('0x35'),_0x2a1862['origtransfereruniqueid']),_0x278e85);}};exports[_0x7466('0x3f')]=function(_0x50872e){try{if(!_[_0x7466('0x24')](channels[_0x50872e[_0x7466('0x8')]])){utils['debug'](util[_0x7466('0xa')](_0x7466('0x40'),_0x50872e[_0x7466('0x8')]),_0x50872e);channels[_0x50872e[_0x7466('0x8')]][_0x7466('0x41')]=utils['now']();utils[_0x7466('0x19')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x50872e[_0x7466('0x8')],channels[_0x50872e[_0x7466('0x8')]]['musiconholdstartAt']));}}catch(_0x176eee){utils[_0x7466('0x20')](util[_0x7466('0xa')](_0x7466('0x40'),_0x50872e[_0x7466('0x8')]),_0x176eee);}};exports[_0x7466('0x42')]=function(_0x58a3b3){try{if(!_[_0x7466('0x24')](channels[_0x58a3b3['uniqueid']])){utils[_0x7466('0x14')](util[_0x7466('0xa')]('[%s][calls][musiconholdstop]',_0x58a3b3[_0x7466('0x8')]),_0x58a3b3);if(!_[_0x7466('0x24')](channels[_0x58a3b3[_0x7466('0x8')]][_0x7466('0x41')])){channels[_0x58a3b3[_0x7466('0x8')]]['mohtime']+=utils[_0x7466('0x30')](utils[_0x7466('0x1e')](),channels[_0x58a3b3[_0x7466('0x8')]]['musiconholdstartAt']);utils[_0x7466('0x19')](util[_0x7466('0xa')](_0x7466('0x43'),_0x58a3b3[_0x7466('0x8')],channels[_0x58a3b3[_0x7466('0x8')]][_0x7466('0x44')]));delete channels[_0x58a3b3['uniqueid']][_0x7466('0x41')];}}}catch(_0x20a35d){utils[_0x7466('0x20')](util[_0x7466('0xa')](_0x7466('0x45'),_0x58a3b3[_0x7466('0x8')]),_0x20a35d);}};exports[_0x7466('0x46')]=function(_0x34dac3){try{if(!_[_0x7466('0x24')](channels[_0x34dac3['uniqueid']])){utils[_0x7466('0x14')](util[_0x7466('0xa')]('[%s][calls][varset]',_0x34dac3[_0x7466('0x8')]),_0x34dac3);if(!_[_0x7466('0x24')](_0x34dac3[_0x7466('0x47')][_0x7466('0x48')])){utils['info'](util[_0x7466('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x34dac3['uniqueid'],_0x34dac3[_0x7466('0x49')]));channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x4a')]=_0x34dac3[_0x7466('0x49')];}if(!_[_0x7466('0x24')](_0x34dac3[_0x7466('0x47')][_0x7466('0x4b')])){utils[_0x7466('0x19')](util[_0x7466('0xa')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x34dac3[_0x7466('0x8')],_0x34dac3['value']));channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x4c')]=_0x34dac3[_0x7466('0x49')];channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x2c')]='\x22'+_0x34dac3[_0x7466('0x49')]+_0x7466('0x4d')+_0x34dac3[_0x7466('0x49')]+'>';}if(!_[_0x7466('0x24')](_0x34dac3['variable'][_0x7466('0x4e')])||!_[_0x7466('0x24')](_0x34dac3[_0x7466('0x47')][_0x7466('0x4f')])){utils[_0x7466('0x19')](util[_0x7466('0xa')](_0x7466('0x50'),_0x34dac3[_0x7466('0x8')],!_['isNil'](_0x34dac3[_0x7466('0x47')][_0x7466('0x4e')])?_0x7466('0x4e'):_0x7466('0x4f'),_0x34dac3[_0x7466('0x49')]));channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x2c')]=_0x34dac3['value'];}if(!_[_0x7466('0x24')](_0x34dac3['variable'][_0x7466('0x51')])||!_[_0x7466('0x24')](_0x34dac3[_0x7466('0x47')][_0x7466('0x52')])){utils['info'](util[_0x7466('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x34dac3[_0x7466('0x8')],!_[_0x7466('0x24')](_0x34dac3[_0x7466('0x47')]['xmd-queue'])?'xmd-queue':_0x7466('0x52'),_0x34dac3[_0x7466('0x49')]));channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x53')]=_0x7466('0x54');channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x55')]=_0x34dac3[_0x7466('0x49')];channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x56')]=!![];}if(!_[_0x7466('0x24')](_0x34dac3[_0x7466('0x47')][_0x7466('0x57')])){utils[_0x7466('0x19')](util[_0x7466('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x34dac3['uniqueid'],_0x34dac3[_0x7466('0x49')]));channels[_0x34dac3['uniqueid']][_0x7466('0x58')]=_0x34dac3['value'];}if(!_['isNil'](_0x34dac3[_0x7466('0x47')][_0x7466('0x59')])){utils[_0x7466('0x19')](util[_0x7466('0xa')](_0x7466('0x5a'),_0x34dac3[_0x7466('0x8')],_0x34dac3[_0x7466('0x49')]));channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x5b')]=_0x34dac3[_0x7466('0x49')];}if(!_[_0x7466('0x24')](_0x34dac3['variable'][_0x7466('0x5c')])){utils[_0x7466('0x19')](util[_0x7466('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x34dac3[_0x7466('0x8')],_0x34dac3[_0x7466('0x49')]));channels[_0x34dac3['uniqueid']][_0x7466('0x5d')]=_0x34dac3[_0x7466('0x49')];}if(!_[_0x7466('0x24')](_0x34dac3[_0x7466('0x47')][_0x7466('0x5e')])){utils[_0x7466('0x19')](util['format'](_0x7466('0x5f'),_0x34dac3['uniqueid'],_0x34dac3[_0x7466('0x49')]));channels[_0x34dac3[_0x7466('0x8')]][_0x7466('0x5e')]=_0x34dac3[_0x7466('0x49')];}}}catch(_0x5acf02){utils[_0x7466('0x20')](util[_0x7466('0xa')](_0x7466('0x60'),_0x34dac3[_0x7466('0x8')]),_0x5acf02);}};exports[_0x7466('0x61')]=function(_0x2ec428){try{if(!_[_0x7466('0x24')](channels[_0x2ec428[_0x7466('0x8')]])){utils[_0x7466('0x14')](util[_0x7466('0xa')](_0x7466('0x62'),_0x2ec428[_0x7466('0x8')]),_0x2ec428);utils[_0x7466('0x19')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2ec428[_0x7466('0x8')],_0x2ec428[_0x7466('0x63')],_0x2ec428[_0x7466('0x64')]));if(_0x2ec428[_0x7466('0x63')][_0x7466('0x65')]()=='set'&&_[_0x7466('0x66')](_0x2ec428[_0x7466('0x64')][_0x7466('0x65')](),_0x7466('0x67'))){var _0x2dc4fe=_0x2ec428['appdata'][_0x7466('0x68')]('=');var _0x13bc96=_0x2dc4fe[0x0][_0x7466('0x69')](_0x2dc4fe[0x0][_0x7466('0x6a')]('(')+0x1,_0x2dc4fe[0x0]['lastIndexOf'](')'));var _0x1a3356=_0x2dc4fe[0x1];channels[_0x2ec428[_0x7466('0x8')]][_0x13bc96]=_0x1a3356;}if(!_[_0x7466('0x6b')]([_0x7466('0x2a'),'noop',_0x7466('0x6c'),_0x7466('0x6d'),_0x7466('0x6e')],_0x2ec428[_0x7466('0x63')][_0x7466('0x65')]())){channels[_0x2ec428[_0x7466('0x8')]]['lastapplication']=_0x2ec428['application'];channels[_0x2ec428['uniqueid']]['lastdata']=_0x2ec428[_0x7466('0x64')];}}}catch(_0x33d3ff){utils['error'](util['format'](_0x7466('0x62'),_0x2ec428[_0x7466('0x8')]),_0x33d3ff);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 7c7e405..29626e2 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 _0xbba8=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbba8,0x1c0));var _0x8bba=function(_0x2c39b0,_0x2ab113){_0x2c39b0=_0x2c39b0-0x0;var _0x5e0884=_0xbba8[_0x2c39b0];return _0x5e0884;};'use strict';var utils=require(_0x8bba('0x0'));exports[_0x8bba('0x1')]=function(){utils[_0x8bba('0x2')](_0x8bba('0x3'));};exports[_0x8bba('0x4')]=function(){utils[_0x8bba('0x2')](_0x8bba('0x5'));};exports[_0x8bba('0x6')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x8bba('0x7')]=function(_0x19528d){utils[_0x8bba('0x7')](_0x8bba('0x8'),_0x19528d);};exports['close']=function(){utils[_0x8bba('0x2')](_0x8bba('0x9'));};exports[_0x8bba('0xa')]=function(_0x25ce8b){}; \ No newline at end of file +var _0x9de2=['[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','info','shutdown'];(function(_0x4ce250,_0x59e26e){var _0x197d4a=function(_0x974fc){while(--_0x974fc){_0x4ce250['push'](_0x4ce250['shift']());}};_0x197d4a(++_0x59e26e);}(_0x9de2,0x1ca));var _0x29de=function(_0x15459e,_0x32cf1a){_0x15459e=_0x15459e-0x0;var _0x5ee339=_0x9de2[_0x15459e];return _0x5ee339;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x29de('0x0')]('[core]\x20connected');};exports[_0x29de('0x1')]=function(){utils[_0x29de('0x0')](_0x29de('0x2'));};exports[_0x29de('0x3')]=function(){utils[_0x29de('0x0')](_0x29de('0x4'));};exports[_0x29de('0x5')]=function(_0xd39cb0){utils['error'](_0x29de('0x6'),_0xd39cb0);};exports[_0x29de('0x7')]=function(){utils[_0x29de('0x0')](_0x29de('0x8'));};exports[_0x29de('0x9')]=function(_0x43c139){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 6ee9df2..0dbe805 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 _0x5443=['cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','now','hangup','[%s][dials][hangup]','calleridname'];(function(_0x265795,_0x584ff5){var _0x2f3092=function(_0x13108f){while(--_0x13108f){_0x265795['push'](_0x265795['shift']());}};_0x2f3092(++_0x584ff5);}(_0x5443,0x66));var _0x3544=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5443[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x3544('0x0'));var util=require(_0x3544('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x96fe7e){utils[_0x3544('0x2')](util[_0x3544('0x3')](_0x3544('0x4'),_0x96fe7e[_0x3544('0x5')],_0x96fe7e['channel'],_0x96fe7e[_0x3544('0x6')],_0x96fe7e[_0x3544('0x7')],_0x96fe7e[_0x3544('0x8')],_0x96fe7e[_0x3544('0x9')]));utils[_0x3544('0xa')](_0x3544('0xb'),_0x96fe7e);delete dials[_0x96fe7e[_0x3544('0x5')]];}exports['newexten']=function(_0x89a797){try{utils[_0x3544('0xc')](util[_0x3544('0x3')]('[%s][dials][newexten]',_0x89a797['uniqueid']),_0x89a797);utils[_0x3544('0x2')](util[_0x3544('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x89a797['uniqueid'],_0x89a797['application'],_0x89a797[_0x3544('0xd')]));if(_0x89a797[_0x3544('0xe')][_0x3544('0xf')]()==_0x3544('0x10')&&_[_0x3544('0x11')](_0x89a797[_0x3544('0xd')][_0x3544('0xf')](),_0x3544('0x12'))){var _0x4bd371=_0x89a797[_0x3544('0xd')][_0x3544('0x13')]('=');dials[_0x89a797[_0x3544('0x5')]]={'routeId':_0x4bd371[0x1]};}}catch(_0x1f1078){utils[_0x3544('0x14')](util[_0x3544('0x3')]('[%s][dials][newexten]',_0x89a797[_0x3544('0x5')]),_0x1f1078);}};exports[_0x3544('0x15')]=function(_0x17992d){try{utils[_0x3544('0xc')](util[_0x3544('0x3')](_0x3544('0x16'),_0x17992d[_0x3544('0x5')]),_0x17992d);if(!_[_0x3544('0x17')](_0x17992d['variable'][_0x3544('0x18')])){utils[_0x3544('0x2')](util[_0x3544('0x3')](_0x3544('0x19'),_0x17992d['uniqueid'],_0x17992d[_0x3544('0x1a')]));dials[_0x17992d[_0x3544('0x5')]]={'routeId':_0x17992d['value']};}}catch(_0xa075cc){utils['error'](util['format'](_0x3544('0x16'),_0x17992d[_0x3544('0x5')]),_0xa075cc);}};exports[_0x3544('0x1b')]=function(_0xe15cc8){try{if(!_[_0x3544('0x17')](dials[_0xe15cc8['uniqueid']])){utils[_0x3544('0xc')](util[_0x3544('0x3')](_0x3544('0x1c'),_0xe15cc8[_0x3544('0x5')]),_0xe15cc8);dials[_0xe15cc8[_0x3544('0x5')]]=_[_0x3544('0x1d')](dials[_0xe15cc8[_0x3544('0x5')]],_0xe15cc8);dials[_0xe15cc8[_0x3544('0x5')]]['starttime']=utils['now']();dials[_0xe15cc8[_0x3544('0x5')]][_0x3544('0x1e')]=_0x3544('0x1f');utils[_0x3544('0x2')](util[_0x3544('0x3')](_0x3544('0x20'),_0xe15cc8[_0x3544('0x5')],dials[_0xe15cc8['uniqueid']][_0x3544('0x21')]));}}catch(_0x52e050){utils[_0x3544('0x14')](util[_0x3544('0x3')](_0x3544('0x1c'),_0xe15cc8[_0x3544('0x5')]),_0x52e050);}};exports[_0x3544('0x22')]=function(_0x160d0b){try{if(!_[_0x3544('0x17')](dials[_0x160d0b['uniqueid']])){utils['debug'](util[_0x3544('0x3')](_0x3544('0x23'),_0x160d0b[_0x3544('0x5')]),_0x160d0b);dials[_0x160d0b[_0x3544('0x5')]][_0x3544('0x9')]=_0x160d0b[_0x3544('0x9')];if(_0x160d0b['dialstatus']==_0x3544('0x24')){dials[_0x160d0b[_0x3544('0x5')]]=_[_0x3544('0x1d')](dials[_0x160d0b[_0x3544('0x5')]],_0x160d0b);dials[_0x160d0b[_0x3544('0x5')]][_0x3544('0x25')]=utils[_0x3544('0x26')]();dials[_0x160d0b[_0x3544('0x5')]]['lastevent']='connect';utils[_0x3544('0x2')](util[_0x3544('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x160d0b['uniqueid'],_0x160d0b['dialstatus'],dials[_0x160d0b[_0x3544('0x5')]][_0x3544('0x25')]));}else{utils[_0x3544('0x2')](util[_0x3544('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x160d0b[_0x3544('0x5')],_0x160d0b['dialstatus']));}}}catch(_0x7198f4){utils['error'](util[_0x3544('0x3')](_0x3544('0x23'),_0x160d0b[_0x3544('0x5')]),_0x7198f4);}};exports[_0x3544('0x27')]=function(_0x446ad6){try{if(!_[_0x3544('0x17')](dials[_0x446ad6[_0x3544('0x5')]])){utils['debug'](util['format'](_0x3544('0x28'),_0x446ad6[_0x3544('0x5')]),_0x446ad6);utils[_0x3544('0x2')](util[_0x3544('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x446ad6[_0x3544('0x5')],_0x446ad6[_0x3544('0x7')],_0x446ad6[_0x3544('0x29')],_0x446ad6[_0x3544('0x2a')]));dials[_0x446ad6[_0x3544('0x5')]]=_[_0x3544('0x1d')](dials[_0x446ad6[_0x3544('0x5')]],{'endtime':utils[_0x3544('0x26')](),'lastevent':_0x3544('0x2b')});dials[_0x446ad6[_0x3544('0x5')]][_0x3544('0x2c')]=utils[_0x3544('0x2d')](dials[_0x446ad6[_0x3544('0x5')]][_0x3544('0x2e')],dials[_0x446ad6['uniqueid']]['starttime']);dials[_0x446ad6[_0x3544('0x5')]]['holdtime']=utils[_0x3544('0x2d')](dials[_0x446ad6[_0x3544('0x5')]][_0x3544('0x25')]||dials[_0x446ad6[_0x3544('0x5')]]['endtime'],dials[_0x446ad6[_0x3544('0x5')]][_0x3544('0x21')]);dials[_0x446ad6[_0x3544('0x5')]][_0x3544('0x2f')]=dials[_0x446ad6[_0x3544('0x5')]]['answertime']?utils[_0x3544('0x2d')](dials[_0x446ad6[_0x3544('0x5')]][_0x3544('0x2e')],dials[_0x446ad6[_0x3544('0x5')]]['answertime']):0x0;writeDB(dials[_0x446ad6[_0x3544('0x5')]]);}}catch(_0x351b9a){utils[_0x3544('0x14')](util[_0x3544('0x3')](_0x3544('0x28'),_0x446ad6['uniqueid']),_0x351b9a);}}; \ No newline at end of file +var _0x84ee=['CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','[%s][dials][dialend]','ANSWER','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','format','dialstring','calleridnum','dialstatus'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x84ee,0x11f));var _0xe84e=function(_0x45071a,_0x406695){_0x45071a=_0x45071a-0x0;var _0x4502ca=_0x84ee[_0x45071a];return _0x4502ca;};'use strict';var _=require(_0xe84e('0x0'));var util=require(_0xe84e('0x1'));var utils=require(_0xe84e('0x2'));var dials={};function writeDB(_0x3a12ab){utils['info'](util[_0xe84e('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x3a12ab['uniqueid'],_0x3a12ab['channel'],_0x3a12ab[_0xe84e('0x4')],_0x3a12ab[_0xe84e('0x5')],_0x3a12ab['connectedlinenum'],_0x3a12ab[_0xe84e('0x6')]));utils['request'](_0xe84e('0x7'),_0x3a12ab);delete dials[_0x3a12ab[_0xe84e('0x8')]];}exports[_0xe84e('0x9')]=function(_0x5cf1e0){try{utils[_0xe84e('0xa')](util['format'](_0xe84e('0xb'),_0x5cf1e0[_0xe84e('0x8')]),_0x5cf1e0);utils[_0xe84e('0xc')](util[_0xe84e('0x3')](_0xe84e('0xd'),_0x5cf1e0['uniqueid'],_0x5cf1e0[_0xe84e('0xe')],_0x5cf1e0[_0xe84e('0xf')]));if(_0x5cf1e0[_0xe84e('0xe')][_0xe84e('0x10')]()==_0xe84e('0x11')&&_[_0xe84e('0x12')](_0x5cf1e0[_0xe84e('0xf')]['toLowerCase'](),_0xe84e('0x13'))){var _0xe89298=_0x5cf1e0['appdata']['split']('=');dials[_0x5cf1e0[_0xe84e('0x8')]]={'routeId':_0xe89298[0x1]};}}catch(_0x108259){utils[_0xe84e('0x14')](util[_0xe84e('0x3')](_0xe84e('0xb'),_0x5cf1e0['uniqueid']),_0x108259);}};exports[_0xe84e('0x15')]=function(_0x53d95f){try{utils[_0xe84e('0xa')](util[_0xe84e('0x3')](_0xe84e('0x16'),_0x53d95f[_0xe84e('0x8')]),_0x53d95f);if(!_[_0xe84e('0x17')](_0x53d95f['variable'][_0xe84e('0x18')])){utils[_0xe84e('0xc')](util[_0xe84e('0x3')](_0xe84e('0x19'),_0x53d95f['uniqueid'],_0x53d95f[_0xe84e('0x1a')]));dials[_0x53d95f['uniqueid']]={'routeId':_0x53d95f['value']};}}catch(_0x2d135e){utils['error'](util['format'](_0xe84e('0x16'),_0x53d95f[_0xe84e('0x8')]),_0x2d135e);}};exports[_0xe84e('0x1b')]=function(_0x46c744){try{if(!_['isNil'](dials[_0x46c744[_0xe84e('0x8')]])){utils['debug'](util[_0xe84e('0x3')]('[%s][dials][dialbegin]',_0x46c744[_0xe84e('0x8')]),_0x46c744);dials[_0x46c744[_0xe84e('0x8')]]=_[_0xe84e('0x1c')](dials[_0x46c744[_0xe84e('0x8')]],_0x46c744);dials[_0x46c744[_0xe84e('0x8')]][_0xe84e('0x1d')]=utils[_0xe84e('0x1e')]();dials[_0x46c744['uniqueid']][_0xe84e('0x1f')]=_0xe84e('0x20');utils['info'](util[_0xe84e('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x46c744['uniqueid'],dials[_0x46c744['uniqueid']][_0xe84e('0x1d')]));}}catch(_0x120722){utils[_0xe84e('0x14')](util['format'](_0xe84e('0x21'),_0x46c744[_0xe84e('0x8')]),_0x120722);}};exports['dialend']=function(_0x5557a4){try{if(!_[_0xe84e('0x17')](dials[_0x5557a4['uniqueid']])){utils['debug'](util[_0xe84e('0x3')](_0xe84e('0x22'),_0x5557a4[_0xe84e('0x8')]),_0x5557a4);dials[_0x5557a4['uniqueid']]['dialstatus']=_0x5557a4[_0xe84e('0x6')];if(_0x5557a4[_0xe84e('0x6')]==_0xe84e('0x23')){dials[_0x5557a4[_0xe84e('0x8')]]=_[_0xe84e('0x1c')](dials[_0x5557a4['uniqueid']],_0x5557a4);dials[_0x5557a4[_0xe84e('0x8')]]['answertime']=utils[_0xe84e('0x1e')]();dials[_0x5557a4[_0xe84e('0x8')]]['lastevent']='connect';utils[_0xe84e('0xc')](util[_0xe84e('0x3')](_0xe84e('0x24'),_0x5557a4[_0xe84e('0x8')],_0x5557a4[_0xe84e('0x6')],dials[_0x5557a4[_0xe84e('0x8')]][_0xe84e('0x25')]));}else{utils[_0xe84e('0xc')](util['format'](_0xe84e('0x26'),_0x5557a4['uniqueid'],_0x5557a4[_0xe84e('0x6')]));}}}catch(_0xbc53f9){utils[_0xe84e('0x14')](util[_0xe84e('0x3')](_0xe84e('0x22'),_0x5557a4[_0xe84e('0x8')]),_0xbc53f9);}};exports[_0xe84e('0x27')]=function(_0x112e37){try{if(!_[_0xe84e('0x17')](dials[_0x112e37[_0xe84e('0x8')]])){utils[_0xe84e('0xa')](util[_0xe84e('0x3')](_0xe84e('0x28'),_0x112e37[_0xe84e('0x8')]),_0x112e37);utils[_0xe84e('0xc')](util['format'](_0xe84e('0x29'),_0x112e37[_0xe84e('0x8')],_0x112e37[_0xe84e('0x5')],_0x112e37[_0xe84e('0x2a')],_0x112e37[_0xe84e('0x2b')]));dials[_0x112e37[_0xe84e('0x8')]]=_['assign'](dials[_0x112e37[_0xe84e('0x8')]],{'endtime':utils[_0xe84e('0x1e')](),'lastevent':_0xe84e('0x2c')});dials[_0x112e37[_0xe84e('0x8')]]['duration']=utils[_0xe84e('0x2d')](dials[_0x112e37[_0xe84e('0x8')]][_0xe84e('0x2e')],dials[_0x112e37['uniqueid']]['starttime']);dials[_0x112e37[_0xe84e('0x8')]][_0xe84e('0x2f')]=utils[_0xe84e('0x2d')](dials[_0x112e37[_0xe84e('0x8')]]['answertime']||dials[_0x112e37[_0xe84e('0x8')]][_0xe84e('0x2e')],dials[_0x112e37[_0xe84e('0x8')]]['starttime']);dials[_0x112e37['uniqueid']][_0xe84e('0x30')]=dials[_0x112e37['uniqueid']][_0xe84e('0x25')]?utils['diffTime'](dials[_0x112e37['uniqueid']]['endtime'],dials[_0x112e37[_0xe84e('0x8')]][_0xe84e('0x25')]):0x0;writeDB(dials[_0x112e37[_0xe84e('0x8')]]);}}catch(_0xdb5894){utils['error'](util[_0xe84e('0x3')]('[%s][dials][hangup]',_0x112e37[_0xe84e('0x8')]),_0xdb5894);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 54bb16e..db40f4b 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 _0xbf91=['[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','port','asterisk','username','password','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','devicestatechange','[%s][index][devicestatechange]','agentcalled','debug','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','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]','[%s][index][blindtransfer]','blindtransfer','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xbf91,0x125));var _0x1bf9=function(_0x358f88,_0xe93aba){_0x358f88=_0x358f88-0x0;var _0x217d4c=_0xbf91[_0x358f88];return _0x217d4c;};var AsteriskManager=require(_0x1bf9('0x0'));var config=require(_0x1bf9('0x1'));var utils=require(_0x1bf9('0x2'));var util=require(_0x1bf9('0x3'));var isXDREnabled=config[_0x1bf9('0x4')]&&config[_0x1bf9('0x4')][_0x1bf9('0x5')]?!config['xdr'][_0x1bf9('0x5')]:!![];var isProduction=config[_0x1bf9('0x6')]===_0x1bf9('0x7')||![];var isLocalAsterisk=config[_0x1bf9('0x4')]&&config['xdr'][_0x1bf9('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x1bf9('0x9')],config[_0x1bf9('0xa')]['ip'],config[_0x1bf9('0xa')][_0x1bf9('0xb')],config['asterisk'][_0x1bf9('0xc')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x1bf9('0xd')](_0x1bf9('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x1bf9('0xf'));var calls=require(_0x1bf9('0x10'));var queues=require(_0x1bf9('0x11'));var recordings=require(_0x1bf9('0x12'));var members=require('./members.controller');var dials=require(_0x1bf9('0x13'));var transfers=require(_0x1bf9('0x14'));var core=require(_0x1bf9('0x15'));ami['on'](_0x1bf9('0x16'),core[_0x1bf9('0x16')]);ami['on'](_0x1bf9('0x17'),core[_0x1bf9('0x17')]);ami['on'](_0x1bf9('0x18'),core[_0x1bf9('0x18')]);ami['on'](_0x1bf9('0x19'),core[_0x1bf9('0x19')]);ami['on'](_0x1bf9('0x1a'),core[_0x1bf9('0x1a')]);ami['on'](_0x1bf9('0x1b'),core[_0x1bf9('0x1b')]);ami['on']('devicestatechange',function(_0x3aaac2){try{utils['debug'](util[_0x1bf9('0x1c')]('[%s][index][devicestatechange]',_0x3aaac2['device']),_0x3aaac2);members[_0x1bf9('0x1d')](_0x3aaac2);}catch(_0x3091a5){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x1e'),_0x3aaac2['device']),_0x3091a5);}});ami['on'](_0x1bf9('0x1f'),function(_0x54745e){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')]('[%s][index][agentcalled]',_0x54745e[_0x1bf9('0x21')]),_0x54745e);agents['agentcalled'](_0x54745e);}catch(_0x21cecb){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x22'),_0x54745e['uniqueid']),_0x21cecb);}});ami['on'](_0x1bf9('0x23'),function(_0x51c898){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x24'),_0x51c898[_0x1bf9('0x21')]),_0x51c898);agents[_0x1bf9('0x23')](_0x51c898);}catch(_0x2a48d3){utils['error'](util['format']('[%s][index][agentringnoanswer]',_0x51c898[_0x1bf9('0x21')]),_0x2a48d3);}});ami['on'](_0x1bf9('0x25'),function(_0x5e897c){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x26'),_0x5e897c['uniqueid']),_0x5e897c);agents[_0x1bf9('0x25')](_0x5e897c);queues[_0x1bf9('0x25')](_0x5e897c);}catch(_0x47df4b){utils[_0x1bf9('0x19')](util['format'](_0x1bf9('0x26'),_0x5e897c['uniqueid']),_0x47df4b);}});ami['on'](_0x1bf9('0x27'),function(_0x5d40d3){try{utils['debug'](util['format'](_0x1bf9('0x28'),_0x5d40d3[_0x1bf9('0x21')]),_0x5d40d3);agents[_0x1bf9('0x27')](_0x5d40d3);queues['agentcomplete'](_0x5d40d3);members[_0x1bf9('0x27')](_0x5d40d3);}catch(_0x47552f){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')]('[%s][index][agentcomplete]',_0x5d40d3[_0x1bf9('0x21')]),_0x47552f);}});ami['on'](_0x1bf9('0x29'),function(_0x145f4e){try{utils['debug'](util[_0x1bf9('0x1c')](_0x1bf9('0x2a'),_0x145f4e[_0x1bf9('0x21')]),_0x145f4e);agents[_0x1bf9('0x29')](_0x145f4e);queues[_0x1bf9('0x29')](_0x145f4e);}catch(_0x17c035){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')]('[%s][index][queuecallerabandon]',_0x145f4e[_0x1bf9('0x21')]),_0x17c035);}});ami['on']('queuecallerjoin',function(_0x497d8f){try{utils[_0x1bf9('0x20')](util['format'](_0x1bf9('0x2b'),_0x497d8f[_0x1bf9('0x21')]),_0x497d8f);queues[_0x1bf9('0x2c')](_0x497d8f);recordings[_0x1bf9('0x2c')](_0x497d8f);}catch(_0x23c065){utils[_0x1bf9('0x19')](util['format'](_0x1bf9('0x2b'),_0x497d8f['uniqueid']),_0x23c065);}});ami['on']('queuecallerleave',function(_0x32a156){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x2d'),_0x32a156['uniqueid']),_0x32a156);queues[_0x1bf9('0x2e')](_0x32a156);}catch(_0x15d280){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x2d'),_0x32a156[_0x1bf9('0x21')]),_0x15d280);}});ami['on'](_0x1bf9('0x2f'),function(_0x20625a){try{utils['debug'](util[_0x1bf9('0x1c')](_0x1bf9('0x30'),_0x20625a[_0x1bf9('0x21')]),_0x20625a);queues[_0x1bf9('0x2f')](_0x20625a);calls[_0x1bf9('0x2f')](_0x20625a);}catch(_0x3d747c){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x30'),_0x20625a['uniqueid']),_0x3d747c);}});ami['on']('musiconholdstop',function(_0x4e51f3){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')]('[%s][index][musiconholdstop]',_0x4e51f3[_0x1bf9('0x21')]),_0x4e51f3);queues[_0x1bf9('0x31')](_0x4e51f3);calls[_0x1bf9('0x31')](_0x4e51f3);}catch(_0x3b490b){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x32'),_0x4e51f3[_0x1bf9('0x21')]),_0x3b490b);}});ami['on'](_0x1bf9('0x33'),function(_0x27494f){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x34'),_0x27494f['uniqueid']),_0x27494f);calls['newstate'](_0x27494f);recordings[_0x1bf9('0x33')](_0x27494f);}catch(_0x5636ce){utils[_0x1bf9('0x19')](util['format']('[%s][index][newstate]',_0x27494f[_0x1bf9('0x21')]),_0x5636ce);}});ami['on']('hangup',function(_0x31319b){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x35'),_0x31319b[_0x1bf9('0x21')]),_0x31319b);calls[_0x1bf9('0x36')](_0x31319b);recordings[_0x1bf9('0x36')](_0x31319b);dials[_0x1bf9('0x36')](_0x31319b);agents['hangup'](_0x31319b);queues['hangup'](_0x31319b);}catch(_0x535534){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x35'),_0x31319b[_0x1bf9('0x21')]),_0x535534);}});ami['on'](_0x1bf9('0x37'),function(_0xd5510e){try{utils['debug'](util[_0x1bf9('0x1c')](_0x1bf9('0x38'),_0xd5510e[_0x1bf9('0x21')]),_0xd5510e);members[_0x1bf9('0x37')](_0xd5510e);}catch(_0x4e4980){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x38'),_0xd5510e[_0x1bf9('0x21')]),_0x4e4980);}});ami['on']('blindtransfer',function(_0x8bcca9){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x39'),_0x8bcca9[_0x1bf9('0x21')]),_0x8bcca9);queues['blindtransfer'](_0x8bcca9);agents['blindtransfer'](_0x8bcca9);transfers[_0x1bf9('0x3a')](_0x8bcca9);recordings[_0x1bf9('0x3a')](_0x8bcca9);}catch(_0x539e02){utils[_0x1bf9('0x19')](util['format'](_0x1bf9('0x39'),_0x8bcca9[_0x1bf9('0x21')]),_0x539e02);}});ami['on']('attendedtransfer',function(_0x2b334d){try{utils['debug'](util[_0x1bf9('0x1c')]('[%s][index][attendedtransfer]',_0x2b334d[_0x1bf9('0x3b')]),_0x2b334d);queues[_0x1bf9('0x3c')](_0x2b334d);transfers['attendedtransfer'](_0x2b334d);agents[_0x1bf9('0x3c')](_0x2b334d);calls[_0x1bf9('0x3c')](_0x2b334d);}catch(_0x39db69){utils[_0x1bf9('0x19')](util['format'](_0x1bf9('0x3d'),_0x2b334d[_0x1bf9('0x3b')]),_0x39db69);}});ami['on'](_0x1bf9('0x3e'),function(_0x173ef5){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x3f'),_0x173ef5[_0x1bf9('0x21')]),_0x173ef5);queues[_0x1bf9('0x3e')](_0x173ef5);recordings[_0x1bf9('0x3e')](_0x173ef5);calls[_0x1bf9('0x3e')](_0x173ef5);dials[_0x1bf9('0x3e')](_0x173ef5);}catch(_0x3332a4){utils[_0x1bf9('0x19')](util['format']('[%s][index][varset]',_0x173ef5[_0x1bf9('0x21')]),_0x3332a4);}});ami['on'](_0x1bf9('0x40'),function(_0xaf7d53){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x41'),_0xaf7d53['uniqueid']),_0xaf7d53);calls[_0x1bf9('0x40')](_0xaf7d53);recordings[_0x1bf9('0x40')](_0xaf7d53);dials['newexten'](_0xaf7d53);}catch(_0x1cc2c8){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x41'),_0xaf7d53['uniqueid']),_0x1cc2c8);}});ami['on']('newchannel',function(_0x148593){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x42'),_0x148593[_0x1bf9('0x21')]),_0x148593);calls[_0x1bf9('0x43')](_0x148593);recordings[_0x1bf9('0x43')](_0x148593);}catch(_0x3b4299){utils[_0x1bf9('0x19')](util['format'](_0x1bf9('0x42'),_0x148593['uniqueid']),_0x3b4299);}});ami['on'](_0x1bf9('0x44'),function(_0x53cf7c){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x45'),_0x53cf7c['uniqueid']),_0x53cf7c);dials[_0x1bf9('0x44')](_0x53cf7c);}catch(_0x3daa26){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x46'),_0x53cf7c['uniqueid']),_0x3daa26);}});ami['on'](_0x1bf9('0x47'),function(_0x54603a){try{utils[_0x1bf9('0x20')](util[_0x1bf9('0x1c')](_0x1bf9('0x48'),_0x54603a[_0x1bf9('0x21')]),_0x54603a);dials[_0x1bf9('0x47')](_0x54603a);}catch(_0x2bea20){utils[_0x1bf9('0x19')](util[_0x1bf9('0x1c')](_0x1bf9('0x48'),_0x54603a[_0x1bf9('0x21')]),_0x2bea20);}});} \ No newline at end of file +var _0x8f57=['shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','device','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect'];(function(_0x43a85f,_0x481eb9){var _0x10ca7e=function(_0x4936cb){while(--_0x4936cb){_0x43a85f['push'](_0x43a85f['shift']());}};_0x10ca7e(++_0x481eb9);}(_0x8f57,0x109));var _0x78f5=function(_0x293440,_0x357eff){_0x293440=_0x293440-0x0;var _0x596af9=_0x8f57[_0x293440];return _0x596af9;};var AsteriskManager=require(_0x78f5('0x0'));var config=require(_0x78f5('0x1'));var utils=require(_0x78f5('0x2'));var util=require(_0x78f5('0x3'));var isXDREnabled=config[_0x78f5('0x4')]&&config[_0x78f5('0x4')][_0x78f5('0x5')]?!config[_0x78f5('0x4')]['disabled']:!![];var isProduction=config[_0x78f5('0x6')]===_0x78f5('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0x78f5('0x4')][_0x78f5('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x78f5('0x9')]['port'],config[_0x78f5('0x9')]['ip'],config[_0x78f5('0x9')]['username'],config[_0x78f5('0x9')][_0x78f5('0xa')],!![]);ami[_0x78f5('0xb')]();if(!isXDREnabled){utils[_0x78f5('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x78f5('0xc')](_0x78f5('0xd'));}else{var agents=require(_0x78f5('0xe'));var calls=require(_0x78f5('0xf'));var queues=require(_0x78f5('0x10'));var recordings=require(_0x78f5('0x11'));var members=require(_0x78f5('0x12'));var dials=require(_0x78f5('0x13'));var transfers=require(_0x78f5('0x14'));var core=require(_0x78f5('0x15'));ami['on']('connect',core[_0x78f5('0x16')]);ami['on'](_0x78f5('0x17'),core[_0x78f5('0x17')]);ami['on'](_0x78f5('0x18'),core['fullybooted']);ami['on'](_0x78f5('0x19'),core[_0x78f5('0x19')]);ami['on'](_0x78f5('0x1a'),core[_0x78f5('0x1a')]);ami['on'](_0x78f5('0x1b'),core[_0x78f5('0x1b')]);ami['on'](_0x78f5('0x1c'),function(_0xfead89){try{utils[_0x78f5('0x1d')](util['format']('[%s][index][devicestatechange]',_0xfead89[_0x78f5('0x1e')]),_0xfead89);members['devicestatechange'](_0xfead89);}catch(_0x458d6b){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x20'),_0xfead89[_0x78f5('0x1e')]),_0x458d6b);}});ami['on'](_0x78f5('0x21'),function(_0x287a34){try{utils['debug'](util['format'](_0x78f5('0x22'),_0x287a34[_0x78f5('0x23')]),_0x287a34);agents['agentcalled'](_0x287a34);}catch(_0x58455f){utils['error'](util['format'](_0x78f5('0x22'),_0x287a34[_0x78f5('0x23')]),_0x58455f);}});ami['on'](_0x78f5('0x24'),function(_0x501ed3){try{utils['debug'](util[_0x78f5('0x1f')]('[%s][index][agentringnoanswer]',_0x501ed3[_0x78f5('0x23')]),_0x501ed3);agents['agentringnoanswer'](_0x501ed3);}catch(_0x5675a8){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')]('[%s][index][agentringnoanswer]',_0x501ed3[_0x78f5('0x23')]),_0x5675a8);}});ami['on'](_0x78f5('0x25'),function(_0x28de67){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x26'),_0x28de67[_0x78f5('0x23')]),_0x28de67);agents['agentconnect'](_0x28de67);queues[_0x78f5('0x25')](_0x28de67);}catch(_0x224fe6){utils[_0x78f5('0x19')](util['format'](_0x78f5('0x26'),_0x28de67['uniqueid']),_0x224fe6);}});ami['on'](_0x78f5('0x27'),function(_0x51255f){try{utils['debug'](util['format'](_0x78f5('0x28'),_0x51255f[_0x78f5('0x23')]),_0x51255f);agents['agentcomplete'](_0x51255f);queues[_0x78f5('0x27')](_0x51255f);members[_0x78f5('0x27')](_0x51255f);}catch(_0x54b795){utils['error'](util[_0x78f5('0x1f')](_0x78f5('0x28'),_0x51255f[_0x78f5('0x23')]),_0x54b795);}});ami['on'](_0x78f5('0x29'),function(_0x4b9080){try{utils['debug'](util[_0x78f5('0x1f')](_0x78f5('0x2a'),_0x4b9080['uniqueid']),_0x4b9080);agents['queuecallerabandon'](_0x4b9080);queues['queuecallerabandon'](_0x4b9080);}catch(_0x3c9066){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x2a'),_0x4b9080[_0x78f5('0x23')]),_0x3c9066);}});ami['on'](_0x78f5('0x2b'),function(_0x47c3c0){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x2c'),_0x47c3c0[_0x78f5('0x23')]),_0x47c3c0);queues['queuecallerjoin'](_0x47c3c0);recordings[_0x78f5('0x2b')](_0x47c3c0);}catch(_0x4db9f6){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x2c'),_0x47c3c0[_0x78f5('0x23')]),_0x4db9f6);}});ami['on'](_0x78f5('0x2d'),function(_0x2eefe7){try{utils['debug'](util[_0x78f5('0x1f')](_0x78f5('0x2e'),_0x2eefe7[_0x78f5('0x23')]),_0x2eefe7);queues['queuecallerleave'](_0x2eefe7);}catch(_0x44c936){utils['error'](util[_0x78f5('0x1f')](_0x78f5('0x2e'),_0x2eefe7[_0x78f5('0x23')]),_0x44c936);}});ami['on'](_0x78f5('0x2f'),function(_0x1b81e7){try{utils['debug'](util[_0x78f5('0x1f')]('[%s][index][musiconholdstart]',_0x1b81e7[_0x78f5('0x23')]),_0x1b81e7);queues[_0x78f5('0x2f')](_0x1b81e7);calls['musiconholdstart'](_0x1b81e7);}catch(_0x3709bd){utils['error'](util[_0x78f5('0x1f')](_0x78f5('0x30'),_0x1b81e7[_0x78f5('0x23')]),_0x3709bd);}});ami['on'](_0x78f5('0x31'),function(_0x4f423a){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x32'),_0x4f423a['uniqueid']),_0x4f423a);queues[_0x78f5('0x31')](_0x4f423a);calls['musiconholdstop'](_0x4f423a);}catch(_0x1dd1e9){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x32'),_0x4f423a[_0x78f5('0x23')]),_0x1dd1e9);}});ami['on'](_0x78f5('0x33'),function(_0x1a6821){try{utils['debug'](util[_0x78f5('0x1f')](_0x78f5('0x34'),_0x1a6821['uniqueid']),_0x1a6821);calls[_0x78f5('0x33')](_0x1a6821);recordings[_0x78f5('0x33')](_0x1a6821);}catch(_0x1fca6d){utils['error'](util[_0x78f5('0x1f')]('[%s][index][newstate]',_0x1a6821[_0x78f5('0x23')]),_0x1fca6d);}});ami['on'](_0x78f5('0x35'),function(_0x561f52){try{utils['debug'](util[_0x78f5('0x1f')]('[%s][index][hangup]',_0x561f52[_0x78f5('0x23')]),_0x561f52);calls[_0x78f5('0x35')](_0x561f52);recordings[_0x78f5('0x35')](_0x561f52);dials['hangup'](_0x561f52);agents[_0x78f5('0x35')](_0x561f52);queues['hangup'](_0x561f52);}catch(_0x56f6f3){utils['error'](util[_0x78f5('0x1f')]('[%s][index][hangup]',_0x561f52['uniqueid']),_0x56f6f3);}});ami['on'](_0x78f5('0x36'),function(_0x217f55){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x37'),_0x217f55[_0x78f5('0x23')]),_0x217f55);members[_0x78f5('0x36')](_0x217f55);}catch(_0xc816c3){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x37'),_0x217f55[_0x78f5('0x23')]),_0xc816c3);}});ami['on'](_0x78f5('0x38'),function(_0x5da71e){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x39'),_0x5da71e[_0x78f5('0x23')]),_0x5da71e);queues[_0x78f5('0x38')](_0x5da71e);agents[_0x78f5('0x38')](_0x5da71e);transfers[_0x78f5('0x38')](_0x5da71e);recordings[_0x78f5('0x38')](_0x5da71e);}catch(_0x3b3434){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x39'),_0x5da71e[_0x78f5('0x23')]),_0x3b3434);}});ami['on']('attendedtransfer',function(_0x45e43e){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')]('[%s][index][attendedtransfer]',_0x45e43e[_0x78f5('0x3a')]),_0x45e43e);queues[_0x78f5('0x3b')](_0x45e43e);transfers[_0x78f5('0x3b')](_0x45e43e);agents[_0x78f5('0x3b')](_0x45e43e);calls['attendedtransfer'](_0x45e43e);}catch(_0x37b4bf){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x3c'),_0x45e43e[_0x78f5('0x3a')]),_0x37b4bf);}});ami['on'](_0x78f5('0x3d'),function(_0xb142bf){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x3e'),_0xb142bf['uniqueid']),_0xb142bf);queues[_0x78f5('0x3d')](_0xb142bf);recordings[_0x78f5('0x3d')](_0xb142bf);calls['varset'](_0xb142bf);dials['varset'](_0xb142bf);}catch(_0x505d32){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x3e'),_0xb142bf[_0x78f5('0x23')]),_0x505d32);}});ami['on'](_0x78f5('0x3f'),function(_0x47eb17){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x40'),_0x47eb17[_0x78f5('0x23')]),_0x47eb17);calls[_0x78f5('0x3f')](_0x47eb17);recordings['newexten'](_0x47eb17);dials[_0x78f5('0x3f')](_0x47eb17);}catch(_0xe8cb33){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x40'),_0x47eb17[_0x78f5('0x23')]),_0xe8cb33);}});ami['on'](_0x78f5('0x41'),function(_0x3b1284){try{utils[_0x78f5('0x1d')](util['format'](_0x78f5('0x42'),_0x3b1284[_0x78f5('0x23')]),_0x3b1284);calls['newchannel'](_0x3b1284);recordings[_0x78f5('0x41')](_0x3b1284);}catch(_0x11e665){utils['error'](util[_0x78f5('0x1f')]('[%s][index][newchannel]',_0x3b1284[_0x78f5('0x23')]),_0x11e665);}});ami['on'](_0x78f5('0x43'),function(_0x4d5473){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x44'),_0x4d5473[_0x78f5('0x23')]),_0x4d5473);dials[_0x78f5('0x43')](_0x4d5473);}catch(_0x1939ff){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')](_0x78f5('0x45'),_0x4d5473[_0x78f5('0x23')]),_0x1939ff);}});ami['on'](_0x78f5('0x46'),function(_0x4df983){try{utils[_0x78f5('0x1d')](util[_0x78f5('0x1f')](_0x78f5('0x47'),_0x4df983[_0x78f5('0x23')]),_0x4df983);dials[_0x78f5('0x46')](_0x4df983);}catch(_0x2c4b58){utils[_0x78f5('0x19')](util[_0x78f5('0x1f')]('[%s][index][dialend]',_0x4df983[_0x78f5('0x23')]),_0x2c4b58);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 9d7a8d2..8dfed84 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 _0x87d1=['destinationchannel','source','[%s][members][cdr]','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','error','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','state','INUSE','BUSY','now','NOT_INUSE','isNil','duration','enterAt','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','exitAt'];(function(_0x10d108,_0x5579d4){var _0x2a4486=function(_0x33fa3c){while(--_0x33fa3c){_0x10d108['push'](_0x10d108['shift']());}};_0x2a4486(++_0x5579d4);}(_0x87d1,0x1a1));var _0x187d=function(_0xa05337,_0x2b2a95){_0xa05337=_0xa05337-0x0;var _0x48aaa9=_0x87d1[_0xa05337];return _0x48aaa9;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x187d('0x0'),_0x187d('0x1')];function writeDB(_0x38dee4){utils[_0x187d('0x2')](util[_0x187d('0x3')](_0x187d('0x4'),_0x38dee4[_0x187d('0x5')],_0x38dee4[_0x187d('0x6')],_0x38dee4[_0x187d('0x7')],_0x38dee4['data2'],_0x38dee4[_0x187d('0x8')],_0x38dee4[_0x187d('0x9')]));if(_0x38dee4[_0x187d('0x6')]){utils[_0x187d('0xa')](_0x38dee4['interface'])[_0x187d('0xb')](function(_0x442fab){if(_0x442fab){_0x38dee4['membername']=_0x442fab[_0x187d('0xc')];_0x38dee4[_0x187d('0xd')]=_0x442fab[_0x187d('0xd')];utils[_0x187d('0xe')](_0x187d('0xf'),_0x38dee4);}else{utils['getUserByName'](_0x38dee4[_0x187d('0x6')][_0x187d('0x10')]('/')[0x1])['then'](function(_0x348d94){if(_0x348d94){_0x38dee4[_0x187d('0x8')]=_0x348d94[_0x187d('0xc')];_0x38dee4[_0x187d('0xd')]=_0x348d94[_0x187d('0xd')];utils[_0x187d('0xe')](_0x187d('0xf'),_0x38dee4);}});}})[_0x187d('0x11')](function(_0x1f751f){utils[_0x187d('0x12')](util[_0x187d('0x3')]('[%s][members][writeDB]',_0x38dee4[_0x187d('0x5')]),_0x1f751f);});}delete members[_0x38dee4[_0x187d('0x6')]];}function startsWith(_0x669954,_0x31701e){return _[_0x187d('0x13')](_0x669954,function(_0x191671){return _[_0x187d('0x14')](_0x31701e,_0x191671);});}exports[_0x187d('0x15')]=function(_0x121518){try{utils['debug'](util['format'](_0x187d('0x16'),members[_0x121518['device']]?members[_0x121518[_0x187d('0x17')]][_0x187d('0x5')]:_0x121518[_0x187d('0x17')]),_0x121518);utils[_0x187d('0x2')](util[_0x187d('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x121518[_0x187d('0x17')]]?members[_0x121518['device']]['uniqueid']:_0x121518[_0x187d('0x17')],_0x121518[_0x187d('0x18')],_0x121518[_0x187d('0x17')]));switch(_0x121518[_0x187d('0x18')]){case _0x187d('0x19'):case _0x187d('0x1a'):if(!startsWith(exclude,_0x121518[_0x187d('0x17')])){members[_0x121518['device']]={'channel':'voice','interface':_0x121518[_0x187d('0x17')],'type':'TALKING','enterAt':utils[_0x187d('0x1b')](),'role':'agent'};}break;case _0x187d('0x1c'):if(!_[_0x187d('0x1d')](members[_0x121518[_0x187d('0x17')]])){members[_0x121518['device']]['exitAt']=utils[_0x187d('0x1b')]();members[_0x121518[_0x187d('0x17')]][_0x187d('0x1e')]=utils['diffTime'](members[_0x121518[_0x187d('0x17')]]['exitAt'],members[_0x121518['device']][_0x187d('0x1f')]);if(members[_0x121518[_0x187d('0x17')]][_0x187d('0x5')]){writeDB(members[_0x121518[_0x187d('0x17')]]);}}break;default:break;}}catch(_0x2a3663){utils[_0x187d('0x12')](util[_0x187d('0x3')]('[%s][members][devicestatechange]',members[_0x121518[_0x187d('0x17')]]?members[_0x121518[_0x187d('0x17')]][_0x187d('0x5')]:_0x121518[_0x187d('0x17')]),_0x2a3663);}};exports[_0x187d('0x20')]=function(_0x44f194){try{if(!_[_0x187d('0x1d')](members[_0x44f194['interface']])){utils[_0x187d('0x21')](util[_0x187d('0x3')]('[%s][members][agentcomplete]',_0x44f194[_0x187d('0x5')]),_0x44f194);utils[_0x187d('0x2')](util[_0x187d('0x3')](_0x187d('0x22'),_0x44f194['uniqueid'],_0x44f194[_0x187d('0x6')],_0x44f194['queue']));members[_0x44f194[_0x187d('0x6')]]=_[_0x187d('0x23')](members[_0x44f194['interface']],{'data4':_0x44f194[_0x187d('0x24')],'uniqueid':_0x44f194[_0x187d('0x5')]});}}catch(_0x574b04){utils[_0x187d('0x12')](util[_0x187d('0x3')]('[%s][members][agentcomplete]',_0x44f194[_0x187d('0x5')]),_0x574b04);}};exports['cdr']=function(_0x519ca0){try{utils['debug'](util['format']('[%s][members][cdr]',_0x519ca0[_0x187d('0x5')]),_0x519ca0);if(_0x519ca0[_0x187d('0x7')]){var _0x1f1dff=_0x519ca0[_0x187d('0x7')][_0x187d('0x10')]('-')[0x0];if(!_['isNil'](members[_0x1f1dff])){members[_0x1f1dff]=_[_0x187d('0x23')](members[_0x1f1dff],{'data1':members[_0x1f1dff]['data1']||_0x519ca0['type'],'data2':members[_0x1f1dff][_0x187d('0x25')]||_0x519ca0['source'],'data3':members[_0x1f1dff]['data3']||_0x519ca0[_0x187d('0x26')],'uniqueid':members[_0x1f1dff][_0x187d('0x5')]||_0x519ca0[_0x187d('0x5')]});utils['info'](util[_0x187d('0x3')](_0x187d('0x27'),_0x519ca0[_0x187d('0x5')],members[_0x1f1dff][_0x187d('0x28')],members[_0x1f1dff][_0x187d('0x25')],members[_0x1f1dff][_0x187d('0x29')]));if(members[_0x1f1dff][_0x187d('0x2a')]){writeDB(members[_0x1f1dff]);}}}if(_0x519ca0[_0x187d('0x2b')]){var _0x9bec94=_0x519ca0[_0x187d('0x2b')][_0x187d('0x10')]('-')[0x0];if(!_['isNil'](members[_0x9bec94])){members[_0x9bec94]=_[_0x187d('0x23')](members[_0x9bec94],{'data1':members[_0x9bec94]['data1']||_0x519ca0[_0x187d('0x9')],'data2':members[_0x9bec94][_0x187d('0x25')]||_0x519ca0[_0x187d('0x2c')],'data3':members[_0x9bec94][_0x187d('0x29')]||_0x519ca0['destination'],'uniqueid':members[_0x9bec94][_0x187d('0x5')]||_0x519ca0['uniqueid']});utils[_0x187d('0x2')](util['format'](_0x187d('0x27'),_0x519ca0[_0x187d('0x5')],members[_0x9bec94]['data1'],members[_0x9bec94]['data2'],members[_0x9bec94]['data3']));if(members[_0x9bec94]['exitAt']){writeDB(members[_0x9bec94]);}}}}catch(_0x3084f6){utils['error'](util['format'](_0x187d('0x2d'),_0x519ca0[_0x187d('0x5')]),_0x3084f6);}}; \ No newline at end of file +var _0x0096=['[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','split','data1','type','data3','destinationchannel','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','info','format','interface','channel','data2','membername','then','name','internal','request','CreateMemberReport','getUserByName','catch','[%s][members][writeDB]','uniqueid','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','voice','TALKING','now','duration','diffTime','exitAt','enterAt','error','[%s][members][devicestatechange]','agentcomplete','isNil'];(function(_0x13f257,_0x3c3d67){var _0x455f37=function(_0x3471eb){while(--_0x3471eb){_0x13f257['push'](_0x13f257['shift']());}};_0x455f37(++_0x3c3d67);}(_0x0096,0xd1));var _0x6009=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x0096[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0x6009('0x0'));var util=require(_0x6009('0x1'));var utils=require(_0x6009('0x2'));var members={};var exclude=[_0x6009('0x3'),'Queue:'];function writeDB(_0x242fc1){utils[_0x6009('0x4')](util[_0x6009('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x242fc1['uniqueid'],_0x242fc1[_0x6009('0x6')],_0x242fc1[_0x6009('0x7')],_0x242fc1[_0x6009('0x8')],_0x242fc1[_0x6009('0x9')],_0x242fc1['type']));if(_0x242fc1['interface']){utils['getUserByInterface'](_0x242fc1[_0x6009('0x6')])[_0x6009('0xa')](function(_0x561bf9){if(_0x561bf9){_0x242fc1[_0x6009('0x9')]=_0x561bf9[_0x6009('0xb')];_0x242fc1[_0x6009('0xc')]=_0x561bf9[_0x6009('0xc')];utils[_0x6009('0xd')](_0x6009('0xe'),_0x242fc1);}else{utils[_0x6009('0xf')](_0x242fc1[_0x6009('0x6')]['split']('/')[0x1])[_0x6009('0xa')](function(_0x1e3c72){if(_0x1e3c72){_0x242fc1['membername']=_0x1e3c72[_0x6009('0xb')];_0x242fc1[_0x6009('0xc')]=_0x1e3c72[_0x6009('0xc')];utils[_0x6009('0xd')](_0x6009('0xe'),_0x242fc1);}});}})[_0x6009('0x10')](function(_0x5d3c4e){utils['error'](util['format'](_0x6009('0x11'),_0x242fc1[_0x6009('0x12')]),_0x5d3c4e);});}delete members[_0x242fc1['interface']];}function startsWith(_0x4d4832,_0x3089ad){return _['some'](_0x4d4832,function(_0x125ee3){return _[_0x6009('0x13')](_0x3089ad,_0x125ee3);});}exports[_0x6009('0x14')]=function(_0xc784e4){try{utils[_0x6009('0x15')](util[_0x6009('0x5')]('[%s][members][devicestatechange]',members[_0xc784e4['device']]?members[_0xc784e4[_0x6009('0x16')]][_0x6009('0x12')]:_0xc784e4[_0x6009('0x16')]),_0xc784e4);utils[_0x6009('0x4')](util[_0x6009('0x5')](_0x6009('0x17'),members[_0xc784e4[_0x6009('0x16')]]?members[_0xc784e4[_0x6009('0x16')]][_0x6009('0x12')]:_0xc784e4[_0x6009('0x16')],_0xc784e4[_0x6009('0x18')],_0xc784e4['device']));switch(_0xc784e4[_0x6009('0x18')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0xc784e4['device'])){members[_0xc784e4['device']]={'channel':_0x6009('0x19'),'interface':_0xc784e4[_0x6009('0x16')],'type':_0x6009('0x1a'),'enterAt':utils[_0x6009('0x1b')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0xc784e4[_0x6009('0x16')]])){members[_0xc784e4['device']]['exitAt']=utils[_0x6009('0x1b')]();members[_0xc784e4['device']][_0x6009('0x1c')]=utils[_0x6009('0x1d')](members[_0xc784e4[_0x6009('0x16')]][_0x6009('0x1e')],members[_0xc784e4[_0x6009('0x16')]][_0x6009('0x1f')]);if(members[_0xc784e4[_0x6009('0x16')]][_0x6009('0x12')]){writeDB(members[_0xc784e4[_0x6009('0x16')]]);}}break;default:break;}}catch(_0x231487){utils[_0x6009('0x20')](util[_0x6009('0x5')](_0x6009('0x21'),members[_0xc784e4[_0x6009('0x16')]]?members[_0xc784e4[_0x6009('0x16')]]['uniqueid']:_0xc784e4[_0x6009('0x16')]),_0x231487);}};exports[_0x6009('0x22')]=function(_0x2ce641){try{if(!_[_0x6009('0x23')](members[_0x2ce641['interface']])){utils[_0x6009('0x15')](util['format'](_0x6009('0x24'),_0x2ce641['uniqueid']),_0x2ce641);utils[_0x6009('0x4')](util['format'](_0x6009('0x25'),_0x2ce641[_0x6009('0x12')],_0x2ce641['interface'],_0x2ce641[_0x6009('0x26')]));members[_0x2ce641[_0x6009('0x6')]]=_[_0x6009('0x27')](members[_0x2ce641[_0x6009('0x6')]],{'data4':_0x2ce641[_0x6009('0x26')],'uniqueid':_0x2ce641['uniqueid']});}}catch(_0x560057){utils[_0x6009('0x20')](util[_0x6009('0x5')]('[%s][members][agentcomplete]',_0x2ce641[_0x6009('0x12')]),_0x560057);}};exports['cdr']=function(_0x43f7ef){try{utils[_0x6009('0x15')](util[_0x6009('0x5')](_0x6009('0x28'),_0x43f7ef[_0x6009('0x12')]),_0x43f7ef);if(_0x43f7ef[_0x6009('0x7')]){var _0x33cbf2=_0x43f7ef[_0x6009('0x7')][_0x6009('0x29')]('-')[0x0];if(!_[_0x6009('0x23')](members[_0x33cbf2])){members[_0x33cbf2]=_['assign'](members[_0x33cbf2],{'data1':members[_0x33cbf2][_0x6009('0x2a')]||_0x43f7ef[_0x6009('0x2b')],'data2':members[_0x33cbf2][_0x6009('0x8')]||_0x43f7ef['source'],'data3':members[_0x33cbf2]['data3']||_0x43f7ef['destination'],'uniqueid':members[_0x33cbf2][_0x6009('0x12')]||_0x43f7ef[_0x6009('0x12')]});utils[_0x6009('0x4')](util[_0x6009('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x43f7ef[_0x6009('0x12')],members[_0x33cbf2]['data1'],members[_0x33cbf2][_0x6009('0x8')],members[_0x33cbf2][_0x6009('0x2c')]));if(members[_0x33cbf2][_0x6009('0x1e')]){writeDB(members[_0x33cbf2]);}}}if(_0x43f7ef[_0x6009('0x2d')]){var _0x1d5429=_0x43f7ef[_0x6009('0x2d')]['split']('-')[0x0];if(!_[_0x6009('0x23')](members[_0x1d5429])){members[_0x1d5429]=_['assign'](members[_0x1d5429],{'data1':members[_0x1d5429][_0x6009('0x2a')]||_0x43f7ef[_0x6009('0x2b')],'data2':members[_0x1d5429][_0x6009('0x8')]||_0x43f7ef[_0x6009('0x2e')],'data3':members[_0x1d5429]['data3']||_0x43f7ef[_0x6009('0x2f')],'uniqueid':members[_0x1d5429][_0x6009('0x12')]||_0x43f7ef[_0x6009('0x12')]});utils[_0x6009('0x4')](util[_0x6009('0x5')](_0x6009('0x30'),_0x43f7ef[_0x6009('0x12')],members[_0x1d5429][_0x6009('0x2a')],members[_0x1d5429]['data2'],members[_0x1d5429][_0x6009('0x2c')]));if(members[_0x1d5429]['exitAt']){writeDB(members[_0x1d5429]);}}}}catch(_0x25a357){utils[_0x6009('0x20')](util[_0x6009('0x5')]('[%s][members][cdr]',_0x43f7ef['uniqueid']),_0x25a357);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 62b8592..5e50027 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 _0x782c=['now','error','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','queuecallerabandonAt','toUpperCase','value','queueposition','queuecallerexitAt','EXITWITHKEY','debug','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfer','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign'];(function(_0x124728,_0x463dca){var _0x8eb20f=function(_0x49d9de){while(--_0x49d9de){_0x124728['push'](_0x124728['shift']());}};_0x8eb20f(++_0x463dca);}(_0x782c,0x11b));var _0xc782=function(_0x5c0aab,_0x53e2e4){_0x5c0aab=_0x5c0aab-0x0;var _0x4866ec=_0x782c[_0x5c0aab];return _0x4866ec;};'use strict';var _=require(_0xc782('0x0'));var util=require(_0xc782('0x1'));var utils=require(_0xc782('0x2'));var queues={};function writeDB(_0x4e9d16){utils[_0xc782('0x3')](util['format'](_0xc782('0x4'),_0x4e9d16[_0xc782('0x5')],_0x4e9d16[_0xc782('0x6')],_0x4e9d16[_0xc782('0x7')],_0x4e9d16[_0xc782('0x8')],_0x4e9d16[_0xc782('0x9')],_0x4e9d16[_0xc782('0xa')],_0x4e9d16[_0xc782('0xb')]));if(_0x4e9d16[_0xc782('0x7')]){utils[_0xc782('0xc')](_0x4e9d16['queue'])['then'](function(_0x2bac81){if(_0x2bac81){_0x4e9d16[_0xc782('0xd')]=_0x2bac81[_0xc782('0xd')];}utils[_0xc782('0xe')](_0xc782('0xf'),_0x4e9d16);});}else{utils[_0xc782('0xe')](_0xc782('0xf'),_0x4e9d16);}if(_0x4e9d16[_0xc782('0x10')]){delete queues[_0x4e9d16[_0xc782('0x10')]];}else{delete queues[_0x4e9d16['uniqueid']];}}exports[_0xc782('0x11')]=function(_0x5a05b3){try{utils['debug'](util[_0xc782('0x12')](_0xc782('0x13'),_0x5a05b3['uniqueid']),_0x5a05b3);utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x14'),_0x5a05b3[_0xc782('0x5')],_0x5a05b3[_0xc782('0x7')],_0x5a05b3[_0xc782('0x15')]));queues[_0x5a05b3[_0xc782('0x5')]]=_[_0xc782('0x16')](_0x5a05b3,{'originalposition':_0x5a05b3[_0xc782('0x15')],'queuecallerjoinAt':utils[_0xc782('0x17')](),'mohtime':0x0});}catch(_0x4a89b1){utils[_0xc782('0x18')](util[_0xc782('0x12')](_0xc782('0x13'),_0x5a05b3['uniqueid']),_0x4a89b1);}};exports['hangup']=function(_0xdf50cb){try{if(!_['isNil'](queues[_0xdf50cb[_0xc782('0x5')]])){utils['debug'](util[_0xc782('0x12')]('[%s][queues][hangup]',_0xdf50cb[_0xc782('0x5')]),_0xdf50cb);if(queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0x19')]){if(!queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0x1a')]&&!queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0x1b')]){queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0x1c')]=!![];queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0x1d')]=utils[_0xc782('0x17')]();queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0xb')]=_0xc782('0x1e');}utils['info'](util[_0xc782('0x12')](_0xc782('0x1f'),_0xdf50cb[_0xc782('0x5')],queues[_0xdf50cb['uniqueid']][_0xc782('0x20')],queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0xb')]));writeDB(queues[_0xdf50cb[_0xc782('0x5')]]);}else if(queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0x10')]){utils['info'](util[_0xc782('0x12')](_0xc782('0x21'),_0xdf50cb[_0xc782('0x5')],queues[_0xdf50cb[_0xc782('0x5')]]['name'],queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0x10')]));queues[queues[_0xdf50cb[_0xc782('0x5')]][_0xc782('0x10')]]=queues[_0xdf50cb[_0xc782('0x5')]];queues[queues[_0xdf50cb['uniqueid']][_0xc782('0x10')]][_0xc782('0x22')]=0x2;delete queues[_0xdf50cb[_0xc782('0x5')]];}}}catch(_0x42663a){utils[_0xc782('0x18')](util[_0xc782('0x12')]('[%s][queues][hangup]',_0xdf50cb[_0xc782('0x5')]),_0x42663a);}};exports[_0xc782('0x23')]=function(_0x44eba9){try{utils['debug'](util[_0xc782('0x12')](_0xc782('0x24'),_0x44eba9[_0xc782('0x5')]),_0x44eba9);if(!_[_0xc782('0x25')](_0x44eba9[_0xc782('0x26')][_0xc782('0x27')])&&_0x44eba9['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0xc782('0x25')](queues[_0x44eba9[_0xc782('0x5')]])){queues[_0x44eba9[_0xc782('0x5')]][_0xc782('0x1a')]=![];queues[_0x44eba9[_0xc782('0x5')]][_0xc782('0x28')]=null;queues[_0x44eba9[_0xc782('0x5')]][_0xc782('0x1b')]=!![];queues[_0x44eba9[_0xc782('0x5')]]['queuecallerexitAt']=utils[_0xc782('0x17')]();queues[_0x44eba9['uniqueid']][_0xc782('0xb')]=_0x44eba9['value'][_0xc782('0x29')]();utils[_0xc782('0x3')](util[_0xc782('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x44eba9['uniqueid'],queues[_0x44eba9['uniqueid']][_0xc782('0x20')],_0x44eba9[_0xc782('0x2a')],queues[_0x44eba9[_0xc782('0x5')]][_0xc782('0xb')]));writeDB(queues[_0x44eba9[_0xc782('0x5')]]);}}else if(!_['isNil'](_0x44eba9[_0xc782('0x26')][_0xc782('0x2b')])){if(!_[_0xc782('0x25')](queues[_0x44eba9[_0xc782('0x5')]])&&!queues[_0x44eba9[_0xc782('0x5')]]['queuecallerabandon']){queues[_0x44eba9[_0xc782('0x5')]][_0xc782('0x1a')]=![];queues[_0x44eba9[_0xc782('0x5')]][_0xc782('0x28')]=null;queues[_0x44eba9[_0xc782('0x5')]]['queuecallerexit']=!![];queues[_0x44eba9['uniqueid']][_0xc782('0x2c')]=utils[_0xc782('0x17')]();queues[_0x44eba9['uniqueid']][_0xc782('0xb')]=_0xc782('0x2d');utils[_0xc782('0x3')](util[_0xc782('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x44eba9[_0xc782('0x5')],queues[_0x44eba9[_0xc782('0x5')]][_0xc782('0x20')],_0x44eba9[_0xc782('0x2a')],queues[_0x44eba9[_0xc782('0x5')]][_0xc782('0xb')]));}}}catch(_0x4318d7){utils[_0xc782('0x18')](util[_0xc782('0x12')](_0xc782('0x24'),_0x44eba9[_0xc782('0x5')]),_0x4318d7);}};exports[_0xc782('0x1a')]=function(_0x5bbbdb){try{if(!_[_0xc782('0x25')](queues[_0x5bbbdb[_0xc782('0x5')]])){utils[_0xc782('0x2e')](util['format'](_0xc782('0x2f'),_0x5bbbdb['uniqueid']),_0x5bbbdb);queues[_0x5bbbdb[_0xc782('0x5')]][_0xc782('0x1b')]=![];queues[_0x5bbbdb[_0xc782('0x5')]][_0xc782('0x2c')]=null;queues[_0x5bbbdb[_0xc782('0x5')]][_0xc782('0x1a')]=!![];queues[_0x5bbbdb[_0xc782('0x5')]][_0xc782('0x28')]=utils[_0xc782('0x17')]();queues[_0x5bbbdb[_0xc782('0x5')]][_0xc782('0xb')]=_0xc782('0x30');utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x31'),_0x5bbbdb[_0xc782('0x5')],queues[_0x5bbbdb[_0xc782('0x5')]][_0xc782('0x20')],queues[_0x5bbbdb[_0xc782('0x5')]][_0xc782('0xb')]));}}catch(_0x339f46){utils['error'](util[_0xc782('0x12')](_0xc782('0x2f'),_0x5bbbdb[_0xc782('0x5')]),_0x339f46);}};exports['queuecallerleave']=function(_0x20303d){try{if(!_['isNil'](queues[_0x20303d[_0xc782('0x5')]])){utils[_0xc782('0x2e')](util[_0xc782('0x12')](_0xc782('0x32'),_0x20303d[_0xc782('0x5')]),_0x20303d);utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x33'),_0x20303d[_0xc782('0x5')],queues[_0x20303d[_0xc782('0x5')]][_0xc782('0x20')],_0x20303d[_0xc782('0x34')],_0x20303d[_0xc782('0x35')]));queues[_0x20303d[_0xc782('0x5')]][_0xc782('0x36')]=!![];queues[_0x20303d[_0xc782('0x5')]][_0xc782('0x19')]=utils[_0xc782('0x17')]();queues[_0x20303d[_0xc782('0x5')]]['holdtime']=utils[_0xc782('0x37')](queues[_0x20303d[_0xc782('0x5')]][_0xc782('0x19')],queues[_0x20303d['uniqueid']][_0xc782('0x38')]);queues[_0x20303d['uniqueid']][_0xc782('0x15')]=_0x20303d[_0xc782('0x15')];queues[_0x20303d[_0xc782('0x5')]][_0xc782('0x39')]=_0x20303d[_0xc782('0x39')];queues[_0x20303d[_0xc782('0x5')]][_0xc782('0x34')]=_0x20303d[_0xc782('0x34')];queues[_0x20303d['uniqueid']][_0xc782('0x35')]=_0x20303d[_0xc782('0x35')];}}catch(_0x5e477b){utils[_0xc782('0x18')](util[_0xc782('0x12')](_0xc782('0x32'),_0x20303d[_0xc782('0x5')]),_0x5e477b);}};exports[_0xc782('0x3a')]=function(_0xaec94b){try{if(!_[_0xc782('0x25')](queues[_0xaec94b[_0xc782('0x5')]])){utils[_0xc782('0x2e')](util[_0xc782('0x12')](_0xc782('0x3b'),_0xaec94b[_0xc782('0x5')]),_0xaec94b);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xaec94b[_0xc782('0x5')],queues[_0xaec94b[_0xc782('0x5')]][_0xc782('0x20')],_0xaec94b[_0xc782('0x3c')],_0xaec94b[_0xc782('0x3d')]));queues[_0xaec94b[_0xc782('0x5')]]['queuecallerabandon']=![];queues[_0xaec94b[_0xc782('0x5')]][_0xc782('0x1a')]=![];queues[_0xaec94b[_0xc782('0x5')]][_0xc782('0x28')]=null;queues[_0xaec94b[_0xc782('0x5')]][_0xc782('0x1b')]=![];queues[_0xaec94b[_0xc782('0x5')]][_0xc782('0xb')]=null;queues[_0xaec94b[_0xc782('0x5')]]['queuecallerexitAt']=null;queues[_0xaec94b[_0xc782('0x5')]][_0xc782('0x3e')]=!![];queues[_0xaec94b[_0xc782('0x5')]]['accountcode']=_0xaec94b[_0xc782('0x3d')];queues[_0xaec94b[_0xc782('0x5')]][_0xc782('0x8')]=_0xaec94b['membername'];}}catch(_0xd5450d){utils[_0xc782('0x18')](util[_0xc782('0x12')](_0xc782('0x3b'),_0xaec94b[_0xc782('0x5')]),_0xd5450d);}};exports[_0xc782('0x3f')]=function(_0x57e6c6){try{if(!_[_0xc782('0x25')](queues[_0x57e6c6[_0xc782('0x5')]])){if(queues[_0x57e6c6[_0xc782('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0xc782('0x12')](_0xc782('0x40'),_0x57e6c6[_0xc782('0x5')]),_0x57e6c6);queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0x1a')]=![];queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0x1a')]=![];queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0x28')]=null;queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0x1b')]=![];queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0x2c')]=null;queues[_0x57e6c6[_0xc782('0x5')]]['assigned']=!![];queues[_0x57e6c6['uniqueid']][_0xc782('0x8')]=_0x57e6c6[_0xc782('0x3c')];queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0x1c')]=!![];queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0x1d')]=utils[_0xc782('0x17')]();if(_0x57e6c6[_0xc782('0x41')]=='transfer'){if(!queues[_0x57e6c6[_0xc782('0x5')]]['transfer']){queues[_0x57e6c6[_0xc782('0x5')]]['queuecallerexitreason']=_0xc782('0x42');}}else{queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0xb')]='COMPLETEDBY'+_0x57e6c6[_0xc782('0x41')]['toUpperCase']();}utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x43'),_0x57e6c6[_0xc782('0x5')],queues[_0x57e6c6[_0xc782('0x5')]][_0xc782('0x20')],_0x57e6c6[_0xc782('0x3c')],queues[_0x57e6c6[_0xc782('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x57e6c6[_0xc782('0x5')]]);}}}catch(_0x58ad3a){utils[_0xc782('0x18')](util['format']('[%s][queues][agentcomplete]',_0x57e6c6['uniqueid']),_0x58ad3a);}};exports['blindtransfer']=function(_0x5c6802){try{if(!_[_0xc782('0x25')](queues[_0x5c6802['transfereeuniqueid']])){utils['debug'](util['format'](_0xc782('0x44'),_0x5c6802['uniqueid']),_0x5c6802);queues[_0x5c6802[_0xc782('0x45')]]['transfer']=!![];queues[_0x5c6802['transfereeuniqueid']][_0xc782('0x46')]='BLIND';queues[_0x5c6802['transfereeuniqueid']][_0xc782('0x47')]=_0x5c6802[_0xc782('0x48')];queues[_0x5c6802[_0xc782('0x45')]][_0xc782('0x49')]=_0x5c6802['transfereeuniqueid'];queues[_0x5c6802[_0xc782('0x45')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x4a'),_0x5c6802[_0xc782('0x5')],queues[_0x5c6802['transfereeuniqueid']][_0xc782('0x20')],_0x5c6802[_0xc782('0x45')],_0x5c6802[_0xc782('0x48')]));}}catch(_0x252c58){utils[_0xc782('0x18')](util[_0xc782('0x12')](_0xc782('0x44'),_0x5c6802[_0xc782('0x5')]),_0x252c58);}};exports['attendedtransfer']=function(_0x47e139){try{utils[_0xc782('0x2e')](util[_0xc782('0x12')]('[%s][queues][attendedtransfer]',_0x47e139[_0xc782('0x4b')]),_0x47e139);if(_0x47e139[_0xc782('0x4b')]==_0x47e139[_0xc782('0x4c')]){if(!_['isNil'](queues[_0x47e139[_0xc782('0x4d')]])){utils['info'](util[_0xc782('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x47e139[_0xc782('0x4b')],queues[_0x47e139['secondtransfererlinkedid']]['name'],_0x47e139[_0xc782('0x4e')]));queues[_0x47e139[_0xc782('0x4d')]][_0xc782('0x4f')]=!![];queues[_0x47e139[_0xc782('0x4d')]]['transfertype']=_0xc782('0x50');queues[_0x47e139['secondtransfererlinkedid']][_0xc782('0x47')]=_0x47e139[_0xc782('0x4e')];queues[_0x47e139['secondtransfererlinkedid']][_0xc782('0x49')]=_0x47e139[_0xc782('0x4b')];queues[_0x47e139[_0xc782('0x4d')]][_0xc782('0xb')]=_0xc782('0x51');}if(!_[_0xc782('0x25')](queues[_0x47e139[_0xc782('0x4c')]])){if(_0x47e139[_0xc782('0x52')]&&queues[_0x47e139['transfereelinkedid']]){queues[_0x47e139['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x47e139[_0xc782('0x45')]]=_[_0xc782('0x53')](queues[_0x47e139[_0xc782('0x52')]]);queues[_0x47e139[_0xc782('0x45')]]['transfereduniqueid']=_0x47e139[_0xc782('0x54')];queues[_0x47e139[_0xc782('0x45')]][_0xc782('0x22')]=0x2;queues[_0x47e139['transfereeuniqueid']][_0xc782('0x9')]=queues[_0x47e139[_0xc782('0x4d')]][_0xc782('0x9')];queues[_0x47e139['transfereeuniqueid']][_0xc782('0x55')]=queues[_0x47e139['secondtransfererlinkedid']][_0xc782('0x55')];queues[_0x47e139['transfereeuniqueid']][_0xc782('0x38')]=utils[_0xc782('0x17')]();queues[_0x47e139[_0xc782('0x45')]][_0xc782('0x19')]=utils['now']();queues[_0x47e139[_0xc782('0x45')]][_0xc782('0x56')]=0x0;queues[_0x47e139['transfereeuniqueid']][_0xc782('0x57')]=0x0;utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x58'),_0x47e139[_0xc782('0x4b')],queues[_0x47e139[_0xc782('0x45')]][_0xc782('0x20')],queues[_0x47e139[_0xc782('0x45')]]['calleridnum'],queues[_0x47e139[_0xc782('0x45')]][_0xc782('0x55')]));}else{utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x59'),_0x47e139['origtransfereruniqueid'],queues[_0x47e139[_0xc782('0x4c')]][_0xc782('0x20')],_0x47e139[_0xc782('0x4d')]));queues[_0x47e139[_0xc782('0x4c')]][_0xc782('0x10')]=_0x47e139[_0xc782('0x4d')];}}}else if(_0x47e139[_0xc782('0x5a')]==_0x47e139[_0xc782('0x4d')]){if(!_[_0xc782('0x25')](queues[_0x47e139[_0xc782('0x4c')]])){utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x5b'),_0x47e139['origtransfereruniqueid'],queues[_0x47e139[_0xc782('0x4c')]][_0xc782('0x20')],_0x47e139[_0xc782('0x5a')],_0x47e139[_0xc782('0x5c')]));queues[_0x47e139[_0xc782('0x4c')]][_0xc782('0x4f')]=!![];queues[_0x47e139[_0xc782('0x4c')]][_0xc782('0x46')]='ATTENDED';queues[_0x47e139[_0xc782('0x4c')]][_0xc782('0x47')]=_0x47e139[_0xc782('0x5c')];queues[_0x47e139[_0xc782('0x4c')]]['transferuniqueid']=_0x47e139[_0xc782('0x5a')];queues[_0x47e139[_0xc782('0x4c')]][_0xc782('0xb')]=_0xc782('0x51');}if(!_[_0xc782('0x25')](queues[_0x47e139[_0xc782('0x4d')]])){if(_0x47e139['transfertargetlinkedid']&&queues[_0x47e139[_0xc782('0x5d')]]){queues[_0x47e139[_0xc782('0x5d')]][_0xc782('0x22')]=0x1;queues[_0x47e139[_0xc782('0x54')]]=_[_0xc782('0x53')](queues[_0x47e139[_0xc782('0x5d')]]);queues[_0x47e139[_0xc782('0x54')]]['transfereduniqueid']=_0x47e139[_0xc782('0x54')];queues[_0x47e139['transfertargetuniqueid']][_0xc782('0x22')]=0x2;queues[_0x47e139[_0xc782('0x54')]][_0xc782('0x9')]=queues[_0x47e139['origtransfererlinkedid']][_0xc782('0x9')];queues[_0x47e139[_0xc782('0x54')]][_0xc782('0x55')]=queues[_0x47e139[_0xc782('0x4c')]]['calleridname'];queues[_0x47e139[_0xc782('0x54')]][_0xc782('0x38')]=utils[_0xc782('0x17')]();queues[_0x47e139[_0xc782('0x54')]][_0xc782('0x19')]=utils[_0xc782('0x17')]();queues[_0x47e139[_0xc782('0x54')]]['holdtime']=0x0;queues[_0x47e139[_0xc782('0x54')]][_0xc782('0x57')]=0x0;utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x5e'),_0x47e139[_0xc782('0x4b')],queues[_0x47e139[_0xc782('0x54')]]['name'],queues[_0x47e139[_0xc782('0x54')]][_0xc782('0x10')],queues[_0x47e139[_0xc782('0x54')]][_0xc782('0x9')],queues[_0x47e139[_0xc782('0x54')]]['calleridname']));}else{utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x59'),_0x47e139[_0xc782('0x4b')],queues[_0x47e139[_0xc782('0x4d')]][_0xc782('0x20')],_0x47e139[_0xc782('0x4c')]));queues[_0x47e139[_0xc782('0x4d')]][_0xc782('0x10')]=_0x47e139[_0xc782('0x4c')];}}}}catch(_0x1185ef){utils[_0xc782('0x18')](util[_0xc782('0x12')](_0xc782('0x5f'),_0x47e139['origtransfereruniqueid']),_0x1185ef);}};exports[_0xc782('0x60')]=function(_0x24d1f4){try{if(!_['isNil'](queues[_0x24d1f4[_0xc782('0x5')]])){utils['debug'](util[_0xc782('0x12')]('[%s][queues][musiconholdstart]',_0x24d1f4['uniqueid']),_0x24d1f4);queues[_0x24d1f4[_0xc782('0x5')]]['musiconholdstartAt']=utils[_0xc782('0x17')]();utils['info'](util[_0xc782('0x12')](_0xc782('0x61'),_0x24d1f4['uniqueid'],queues[_0x24d1f4['uniqueid']][_0xc782('0x20')],queues[_0x24d1f4[_0xc782('0x5')]][_0xc782('0x62')]));}}catch(_0x52b77f){utils[_0xc782('0x18')](util[_0xc782('0x12')]('[%s][queues][musiconholdstart]',_0x24d1f4[_0xc782('0x5')]),_0x52b77f);}};exports[_0xc782('0x63')]=function(_0x1c9096){try{if(!_[_0xc782('0x25')](queues[_0x1c9096['uniqueid']])){if(!_['isNil'](queues[_0x1c9096[_0xc782('0x5')]][_0xc782('0x62')])){utils[_0xc782('0x2e')](util[_0xc782('0x12')](_0xc782('0x64'),_0x1c9096['uniqueid']),_0x1c9096);queues[_0x1c9096[_0xc782('0x5')]][_0xc782('0x57')]+=utils[_0xc782('0x37')](utils['now'](),queues[_0x1c9096[_0xc782('0x5')]]['musiconholdstartAt']);utils[_0xc782('0x3')](util[_0xc782('0x12')](_0xc782('0x65'),_0x1c9096['uniqueid'],queues[_0x1c9096[_0xc782('0x5')]][_0xc782('0x20')],queues[_0x1c9096[_0xc782('0x5')]][_0xc782('0x57')]));delete queues[_0x1c9096['uniqueid']][_0xc782('0x62')];}}}catch(_0x388991){utils[_0xc782('0x18')](util[_0xc782('0x12')](_0xc782('0x64'),_0x1c9096[_0xc782('0x5')]),_0x388991);}}; \ No newline at end of file +var _0x8ca7=['attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDEDTRANSFER','transfereelinkedid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','clone','musiconholdstartAt','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x8ca7,0x1ac));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x78ca('0x0'));var util=require('util');var utils=require(_0x78ca('0x1'));var queues={};function writeDB(_0x46b08b){utils[_0x78ca('0x2')](util['format'](_0x78ca('0x3'),_0x46b08b[_0x78ca('0x4')],_0x46b08b['channel'],_0x46b08b[_0x78ca('0x5')],_0x46b08b[_0x78ca('0x6')],_0x46b08b[_0x78ca('0x7')],_0x46b08b[_0x78ca('0x8')],_0x46b08b[_0x78ca('0x9')]));if(_0x46b08b[_0x78ca('0x5')]){utils['getVoiceQueueByName'](_0x46b08b['queue'])['then'](function(_0x311fa0){if(_0x311fa0){_0x46b08b['type']=_0x311fa0['type'];}utils[_0x78ca('0xa')](_0x78ca('0xb'),_0x46b08b);});}else{utils[_0x78ca('0xa')](_0x78ca('0xb'),_0x46b08b);}if(_0x46b08b['transfereduniqueid']){delete queues[_0x46b08b[_0x78ca('0xc')]];}else{delete queues[_0x46b08b[_0x78ca('0x4')]];}}exports[_0x78ca('0xd')]=function(_0x27e540){try{utils[_0x78ca('0xe')](util[_0x78ca('0xf')](_0x78ca('0x10'),_0x27e540['uniqueid']),_0x27e540);utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x11'),_0x27e540['uniqueid'],_0x27e540['queue'],_0x27e540['position']));queues[_0x27e540[_0x78ca('0x4')]]=_[_0x78ca('0x12')](_0x27e540,{'originalposition':_0x27e540[_0x78ca('0x13')],'queuecallerjoinAt':utils[_0x78ca('0x14')](),'mohtime':0x0});}catch(_0x19fe83){utils[_0x78ca('0x15')](util['format'](_0x78ca('0x10'),_0x27e540[_0x78ca('0x4')]),_0x19fe83);}};exports[_0x78ca('0x16')]=function(_0x5e3136){try{if(!_[_0x78ca('0x17')](queues[_0x5e3136[_0x78ca('0x4')]])){utils[_0x78ca('0xe')](util[_0x78ca('0xf')]('[%s][queues][hangup]',_0x5e3136[_0x78ca('0x4')]),_0x5e3136);if(queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0x18')]){if(!queues[_0x5e3136['uniqueid']][_0x78ca('0x19')]&&!queues[_0x5e3136[_0x78ca('0x4')]]['queuecallerexit']){queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0x1a')]=!![];queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0x1b')]=utils[_0x78ca('0x14')]();queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0x9')]=_0x78ca('0x1c');}utils[_0x78ca('0x2')](util['format'](_0x78ca('0x1d'),_0x5e3136['uniqueid'],queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0x1e')],queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0x9')]));writeDB(queues[_0x5e3136[_0x78ca('0x4')]]);}else if(queues[_0x5e3136['uniqueid']]['transfereduniqueid']){utils[_0x78ca('0x2')](util[_0x78ca('0xf')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5e3136[_0x78ca('0x4')],queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0x1e')],queues[_0x5e3136['uniqueid']][_0x78ca('0xc')]));queues[queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0xc')]]=queues[_0x5e3136[_0x78ca('0x4')]];queues[queues[_0x5e3136[_0x78ca('0x4')]][_0x78ca('0xc')]][_0x78ca('0x1f')]=0x2;delete queues[_0x5e3136['uniqueid']];}}}catch(_0x370f7b){utils[_0x78ca('0x15')](util[_0x78ca('0xf')](_0x78ca('0x20'),_0x5e3136[_0x78ca('0x4')]),_0x370f7b);}};exports[_0x78ca('0x21')]=function(_0x518791){try{utils[_0x78ca('0xe')](util[_0x78ca('0xf')](_0x78ca('0x22'),_0x518791['uniqueid']),_0x518791);if(!_[_0x78ca('0x17')](_0x518791[_0x78ca('0x23')]['queuestatus'])&&_0x518791[_0x78ca('0x24')][_0x78ca('0x25')]()!==_0x78ca('0x26')){if(!_[_0x78ca('0x17')](queues[_0x518791[_0x78ca('0x4')]])){queues[_0x518791['uniqueid']][_0x78ca('0x19')]=![];queues[_0x518791[_0x78ca('0x4')]][_0x78ca('0x27')]=null;queues[_0x518791[_0x78ca('0x4')]][_0x78ca('0x28')]=!![];queues[_0x518791[_0x78ca('0x4')]][_0x78ca('0x29')]=utils[_0x78ca('0x14')]();queues[_0x518791[_0x78ca('0x4')]][_0x78ca('0x9')]=_0x518791[_0x78ca('0x24')][_0x78ca('0x25')]();utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x2a'),_0x518791['uniqueid'],queues[_0x518791['uniqueid']][_0x78ca('0x1e')],_0x518791[_0x78ca('0x24')],queues[_0x518791[_0x78ca('0x4')]][_0x78ca('0x9')]));writeDB(queues[_0x518791['uniqueid']]);}}else if(!_[_0x78ca('0x17')](_0x518791[_0x78ca('0x23')][_0x78ca('0x2b')])){if(!_[_0x78ca('0x17')](queues[_0x518791['uniqueid']])&&!queues[_0x518791[_0x78ca('0x4')]][_0x78ca('0x19')]){queues[_0x518791['uniqueid']][_0x78ca('0x19')]=![];queues[_0x518791['uniqueid']][_0x78ca('0x27')]=null;queues[_0x518791['uniqueid']]['queuecallerexit']=!![];queues[_0x518791[_0x78ca('0x4')]][_0x78ca('0x29')]=utils['now']();queues[_0x518791[_0x78ca('0x4')]][_0x78ca('0x9')]='EXITWITHKEY';utils[_0x78ca('0x2')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x518791[_0x78ca('0x4')],queues[_0x518791['uniqueid']][_0x78ca('0x1e')],_0x518791['value'],queues[_0x518791[_0x78ca('0x4')]]['queuecallerexitreason']));}}}catch(_0xa7d3ef){utils['error'](util[_0x78ca('0xf')](_0x78ca('0x22'),_0x518791['uniqueid']),_0xa7d3ef);}};exports[_0x78ca('0x19')]=function(_0x35aac8){try{if(!_[_0x78ca('0x17')](queues[_0x35aac8[_0x78ca('0x4')]])){utils[_0x78ca('0xe')](util[_0x78ca('0xf')]('[%s][queues][queuecallerabandon]',_0x35aac8['uniqueid']),_0x35aac8);queues[_0x35aac8[_0x78ca('0x4')]][_0x78ca('0x28')]=![];queues[_0x35aac8['uniqueid']][_0x78ca('0x29')]=null;queues[_0x35aac8['uniqueid']]['queuecallerabandon']=!![];queues[_0x35aac8[_0x78ca('0x4')]][_0x78ca('0x27')]=utils['now']();queues[_0x35aac8[_0x78ca('0x4')]][_0x78ca('0x9')]=_0x78ca('0x2c');utils[_0x78ca('0x2')](util['format'](_0x78ca('0x2d'),_0x35aac8['uniqueid'],queues[_0x35aac8['uniqueid']][_0x78ca('0x1e')],queues[_0x35aac8[_0x78ca('0x4')]][_0x78ca('0x9')]));}}catch(_0x580274){utils['error'](util[_0x78ca('0xf')](_0x78ca('0x2e'),_0x35aac8[_0x78ca('0x4')]),_0x580274);}};exports[_0x78ca('0x2f')]=function(_0xc28a56){try{if(!_[_0x78ca('0x17')](queues[_0xc28a56[_0x78ca('0x4')]])){utils[_0x78ca('0xe')](util['format'](_0x78ca('0x30'),_0xc28a56[_0x78ca('0x4')]),_0xc28a56);utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x31'),_0xc28a56['uniqueid'],queues[_0xc28a56[_0x78ca('0x4')]]['name'],_0xc28a56[_0x78ca('0x32')],_0xc28a56['connectedlinename']));queues[_0xc28a56[_0x78ca('0x4')]][_0x78ca('0x2f')]=!![];queues[_0xc28a56[_0x78ca('0x4')]][_0x78ca('0x18')]=utils['now']();queues[_0xc28a56[_0x78ca('0x4')]][_0x78ca('0x33')]=utils[_0x78ca('0x34')](queues[_0xc28a56[_0x78ca('0x4')]][_0x78ca('0x18')],queues[_0xc28a56['uniqueid']][_0x78ca('0x35')]);queues[_0xc28a56['uniqueid']]['position']=_0xc28a56[_0x78ca('0x13')];queues[_0xc28a56['uniqueid']][_0x78ca('0x36')]=_0xc28a56[_0x78ca('0x36')];queues[_0xc28a56[_0x78ca('0x4')]][_0x78ca('0x32')]=_0xc28a56[_0x78ca('0x32')];queues[_0xc28a56[_0x78ca('0x4')]][_0x78ca('0x37')]=_0xc28a56[_0x78ca('0x37')];}}catch(_0x34ed58){utils['error'](util[_0x78ca('0xf')](_0x78ca('0x30'),_0xc28a56[_0x78ca('0x4')]),_0x34ed58);}};exports[_0x78ca('0x38')]=function(_0x1384ad){try{if(!_[_0x78ca('0x17')](queues[_0x1384ad[_0x78ca('0x4')]])){utils[_0x78ca('0xe')](util[_0x78ca('0xf')](_0x78ca('0x39'),_0x1384ad['uniqueid']),_0x1384ad);utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x3a'),_0x1384ad[_0x78ca('0x4')],queues[_0x1384ad[_0x78ca('0x4')]][_0x78ca('0x1e')],_0x1384ad[_0x78ca('0x3b')],_0x1384ad['destaccountcode']));queues[_0x1384ad[_0x78ca('0x4')]][_0x78ca('0x19')]=![];queues[_0x1384ad['uniqueid']][_0x78ca('0x19')]=![];queues[_0x1384ad[_0x78ca('0x4')]][_0x78ca('0x27')]=null;queues[_0x1384ad['uniqueid']]['queuecallerexit']=![];queues[_0x1384ad['uniqueid']][_0x78ca('0x9')]=null;queues[_0x1384ad[_0x78ca('0x4')]][_0x78ca('0x29')]=null;queues[_0x1384ad[_0x78ca('0x4')]][_0x78ca('0x3c')]=!![];queues[_0x1384ad[_0x78ca('0x4')]][_0x78ca('0x8')]=_0x1384ad['destaccountcode'];queues[_0x1384ad[_0x78ca('0x4')]][_0x78ca('0x6')]=_0x1384ad[_0x78ca('0x3b')];}}catch(_0x268f7e){utils['error'](util[_0x78ca('0xf')](_0x78ca('0x39'),_0x1384ad[_0x78ca('0x4')]),_0x268f7e);}};exports[_0x78ca('0x3d')]=function(_0x146dac){try{if(!_[_0x78ca('0x17')](queues[_0x146dac[_0x78ca('0x4')]])){if(queues[_0x146dac['uniqueid']]['queuecallerleaveAt']){utils[_0x78ca('0xe')](util[_0x78ca('0xf')](_0x78ca('0x3e'),_0x146dac[_0x78ca('0x4')]),_0x146dac);queues[_0x146dac['uniqueid']][_0x78ca('0x19')]=![];queues[_0x146dac[_0x78ca('0x4')]]['queuecallerabandon']=![];queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x27')]=null;queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x28')]=![];queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x29')]=null;queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x3c')]=!![];queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x6')]=_0x146dac[_0x78ca('0x3b')];queues[_0x146dac[_0x78ca('0x4')]]['queuecallercomplete']=!![];queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x1b')]=utils[_0x78ca('0x14')]();if(_0x146dac[_0x78ca('0x3f')]==_0x78ca('0x40')){if(!queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x40')]){queues[_0x146dac['uniqueid']][_0x78ca('0x9')]=_0x78ca('0x41');}}else{queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x9')]=_0x78ca('0x42')+_0x146dac[_0x78ca('0x3f')][_0x78ca('0x25')]();}utils['info'](util[_0x78ca('0xf')](_0x78ca('0x43'),_0x146dac[_0x78ca('0x4')],queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x1e')],_0x146dac['membername'],queues[_0x146dac[_0x78ca('0x4')]][_0x78ca('0x9')]));writeDB(queues[_0x146dac[_0x78ca('0x4')]]);}}}catch(_0x5d2289){utils[_0x78ca('0x15')](util['format'](_0x78ca('0x3e'),_0x146dac[_0x78ca('0x4')]),_0x5d2289);}};exports[_0x78ca('0x44')]=function(_0x4a3098){try{if(!_[_0x78ca('0x17')](queues[_0x4a3098[_0x78ca('0x45')]])){utils['debug'](util[_0x78ca('0xf')](_0x78ca('0x46'),_0x4a3098[_0x78ca('0x4')]),_0x4a3098);queues[_0x4a3098[_0x78ca('0x45')]][_0x78ca('0x40')]=!![];queues[_0x4a3098[_0x78ca('0x45')]]['transfertype']=_0x78ca('0x47');queues[_0x4a3098[_0x78ca('0x45')]][_0x78ca('0x48')]=_0x4a3098['extension'];queues[_0x4a3098[_0x78ca('0x45')]][_0x78ca('0x49')]=_0x4a3098[_0x78ca('0x45')];queues[_0x4a3098[_0x78ca('0x45')]][_0x78ca('0x9')]=_0x78ca('0x4a');utils[_0x78ca('0x2')](util['format'](_0x78ca('0x4b'),_0x4a3098['uniqueid'],queues[_0x4a3098[_0x78ca('0x45')]][_0x78ca('0x1e')],_0x4a3098[_0x78ca('0x45')],_0x4a3098[_0x78ca('0x4c')]));}}catch(_0x56bc2a){utils[_0x78ca('0x15')](util[_0x78ca('0xf')](_0x78ca('0x46'),_0x4a3098['uniqueid']),_0x56bc2a);}};exports[_0x78ca('0x4d')]=function(_0x27d8a4){try{utils['debug'](util['format'](_0x78ca('0x4e'),_0x27d8a4[_0x78ca('0x4f')]),_0x27d8a4);if(_0x27d8a4['origtransfereruniqueid']==_0x27d8a4[_0x78ca('0x50')]){if(!_[_0x78ca('0x17')](queues[_0x27d8a4[_0x78ca('0x51')]])){utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x52'),_0x27d8a4[_0x78ca('0x4f')],queues[_0x27d8a4[_0x78ca('0x51')]][_0x78ca('0x1e')],_0x27d8a4[_0x78ca('0x53')]));queues[_0x27d8a4[_0x78ca('0x51')]][_0x78ca('0x40')]=!![];queues[_0x27d8a4['secondtransfererlinkedid']][_0x78ca('0x54')]='ATTENDED';queues[_0x27d8a4[_0x78ca('0x51')]][_0x78ca('0x48')]=_0x27d8a4[_0x78ca('0x53')];queues[_0x27d8a4[_0x78ca('0x51')]][_0x78ca('0x49')]=_0x27d8a4['origtransfereruniqueid'];queues[_0x27d8a4[_0x78ca('0x51')]][_0x78ca('0x9')]=_0x78ca('0x55');}if(!_[_0x78ca('0x17')](queues[_0x27d8a4[_0x78ca('0x50')]])){if(_0x27d8a4[_0x78ca('0x56')]&&queues[_0x27d8a4[_0x78ca('0x56')]]){queues[_0x27d8a4[_0x78ca('0x56')]]['queuecallerenterreason']=0x1;queues[_0x27d8a4[_0x78ca('0x45')]]=_['clone'](queues[_0x27d8a4[_0x78ca('0x56')]]);queues[_0x27d8a4[_0x78ca('0x45')]][_0x78ca('0xc')]=_0x27d8a4['transfertargetuniqueid'];queues[_0x27d8a4[_0x78ca('0x45')]]['queuecallerenterreason']=0x2;queues[_0x27d8a4[_0x78ca('0x45')]]['calleridnum']=queues[_0x27d8a4[_0x78ca('0x51')]]['calleridnum'];queues[_0x27d8a4['transfereeuniqueid']]['calleridname']=queues[_0x27d8a4[_0x78ca('0x51')]][_0x78ca('0x57')];queues[_0x27d8a4[_0x78ca('0x45')]][_0x78ca('0x35')]=utils[_0x78ca('0x14')]();queues[_0x27d8a4[_0x78ca('0x45')]][_0x78ca('0x18')]=utils[_0x78ca('0x14')]();queues[_0x27d8a4[_0x78ca('0x45')]][_0x78ca('0x33')]=0x0;queues[_0x27d8a4[_0x78ca('0x45')]][_0x78ca('0x58')]=0x0;utils['info'](util[_0x78ca('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x27d8a4['origtransfereruniqueid'],queues[_0x27d8a4[_0x78ca('0x45')]][_0x78ca('0x1e')],queues[_0x27d8a4[_0x78ca('0x45')]][_0x78ca('0x7')],queues[_0x27d8a4[_0x78ca('0x45')]][_0x78ca('0x57')]));}else{utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x59'),_0x27d8a4[_0x78ca('0x4f')],queues[_0x27d8a4[_0x78ca('0x50')]]['name'],_0x27d8a4[_0x78ca('0x51')]));queues[_0x27d8a4[_0x78ca('0x50')]]['transfereduniqueid']=_0x27d8a4[_0x78ca('0x51')];}}}else if(_0x27d8a4[_0x78ca('0x5a')]==_0x27d8a4[_0x78ca('0x51')]){if(!_[_0x78ca('0x17')](queues[_0x27d8a4[_0x78ca('0x50')]])){utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x5b'),_0x27d8a4[_0x78ca('0x4f')],queues[_0x27d8a4[_0x78ca('0x50')]][_0x78ca('0x1e')],_0x27d8a4['secondtransfereruniqueid'],_0x27d8a4[_0x78ca('0x5c')]));queues[_0x27d8a4[_0x78ca('0x50')]]['transfer']=!![];queues[_0x27d8a4[_0x78ca('0x50')]][_0x78ca('0x54')]=_0x78ca('0x5d');queues[_0x27d8a4['origtransfererlinkedid']][_0x78ca('0x48')]=_0x27d8a4['secondtransfererexten'];queues[_0x27d8a4['origtransfererlinkedid']][_0x78ca('0x49')]=_0x27d8a4['secondtransfereruniqueid'];queues[_0x27d8a4[_0x78ca('0x50')]][_0x78ca('0x9')]=_0x78ca('0x55');}if(!_[_0x78ca('0x17')](queues[_0x27d8a4[_0x78ca('0x51')]])){if(_0x27d8a4[_0x78ca('0x5e')]&&queues[_0x27d8a4[_0x78ca('0x5e')]]){queues[_0x27d8a4['transfertargetlinkedid']][_0x78ca('0x1f')]=0x1;queues[_0x27d8a4[_0x78ca('0x5f')]]=_[_0x78ca('0x60')](queues[_0x27d8a4[_0x78ca('0x5e')]]);queues[_0x27d8a4[_0x78ca('0x5f')]][_0x78ca('0xc')]=_0x27d8a4[_0x78ca('0x5f')];queues[_0x27d8a4[_0x78ca('0x5f')]][_0x78ca('0x1f')]=0x2;queues[_0x27d8a4[_0x78ca('0x5f')]][_0x78ca('0x7')]=queues[_0x27d8a4[_0x78ca('0x50')]]['calleridnum'];queues[_0x27d8a4[_0x78ca('0x5f')]]['calleridname']=queues[_0x27d8a4[_0x78ca('0x50')]][_0x78ca('0x57')];queues[_0x27d8a4[_0x78ca('0x5f')]]['queuecallerjoinAt']=utils[_0x78ca('0x14')]();queues[_0x27d8a4[_0x78ca('0x5f')]]['queuecallerleaveAt']=utils['now']();queues[_0x27d8a4[_0x78ca('0x5f')]][_0x78ca('0x33')]=0x0;queues[_0x27d8a4['transfertargetuniqueid']][_0x78ca('0x58')]=0x0;utils['info'](util[_0x78ca('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x27d8a4[_0x78ca('0x4f')],queues[_0x27d8a4[_0x78ca('0x5f')]][_0x78ca('0x1e')],queues[_0x27d8a4[_0x78ca('0x5f')]][_0x78ca('0xc')],queues[_0x27d8a4[_0x78ca('0x5f')]][_0x78ca('0x7')],queues[_0x27d8a4['transfertargetuniqueid']]['calleridname']));}else{utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x59'),_0x27d8a4['origtransfereruniqueid'],queues[_0x27d8a4[_0x78ca('0x51')]][_0x78ca('0x1e')],_0x27d8a4[_0x78ca('0x50')]));queues[_0x27d8a4[_0x78ca('0x51')]][_0x78ca('0xc')]=_0x27d8a4['origtransfererlinkedid'];}}}}catch(_0x8a42bd){utils['error'](util[_0x78ca('0xf')]('[%s][queues][attendedtransfer]',_0x27d8a4[_0x78ca('0x4f')]),_0x8a42bd);}};exports['musiconholdstart']=function(_0x38aa2a){try{if(!_[_0x78ca('0x17')](queues[_0x38aa2a[_0x78ca('0x4')]])){utils[_0x78ca('0xe')](util[_0x78ca('0xf')]('[%s][queues][musiconholdstart]',_0x38aa2a['uniqueid']),_0x38aa2a);queues[_0x38aa2a['uniqueid']][_0x78ca('0x61')]=utils['now']();utils['info'](util[_0x78ca('0xf')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x38aa2a[_0x78ca('0x4')],queues[_0x38aa2a[_0x78ca('0x4')]][_0x78ca('0x1e')],queues[_0x38aa2a['uniqueid']][_0x78ca('0x61')]));}}catch(_0x4e297c){utils[_0x78ca('0x15')](util['format'](_0x78ca('0x62'),_0x38aa2a[_0x78ca('0x4')]),_0x4e297c);}};exports['musiconholdstop']=function(_0x5422c1){try{if(!_[_0x78ca('0x17')](queues[_0x5422c1['uniqueid']])){if(!_[_0x78ca('0x17')](queues[_0x5422c1['uniqueid']][_0x78ca('0x61')])){utils[_0x78ca('0xe')](util[_0x78ca('0xf')](_0x78ca('0x63'),_0x5422c1[_0x78ca('0x4')]),_0x5422c1);queues[_0x5422c1['uniqueid']][_0x78ca('0x58')]+=utils[_0x78ca('0x34')](utils[_0x78ca('0x14')](),queues[_0x5422c1[_0x78ca('0x4')]][_0x78ca('0x61')]);utils[_0x78ca('0x2')](util[_0x78ca('0xf')](_0x78ca('0x64'),_0x5422c1[_0x78ca('0x4')],queues[_0x5422c1[_0x78ca('0x4')]][_0x78ca('0x1e')],queues[_0x5422c1[_0x78ca('0x4')]]['mohtime']));delete queues[_0x5422c1[_0x78ca('0x4')]][_0x78ca('0x61')];}}}catch(_0x4a9a0e){utils[_0x78ca('0x15')](util[_0x78ca('0xf')]('[%s][queues][musiconholdstop]',_0x5422c1[_0x78ca('0x4')]),_0x4a9a0e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 7d04833..01da3af 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 _0x3684=['request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId'];(function(_0xfc1c9a,_0xec967b){var _0x54191e=function(_0x29762c){while(--_0x29762c){_0xfc1c9a['push'](_0xfc1c9a['shift']());}};_0x54191e(++_0xec967b);}(_0x3684,0x1ea));var _0x4368=function(_0x3b1b27,_0x3d3bb8){_0x3b1b27=_0x3b1b27-0x0;var _0x3339bc=_0x3684[_0x3b1b27];return _0x3339bc;};'use strict';var _=require('lodash');var util=require(_0x4368('0x0'));var utils=require('./utils');var transfers=require(_0x4368('0x1'));var recordings={};function writeDB(_0x5f371b){var _0xc3e145;utils[_0x4368('0x2')](util[_0x4368('0x3')](_0x4368('0x4'),_0x5f371b[_0x4368('0x5')]));if(transfers[_0x4368('0x6')][_0x5f371b[_0x4368('0x5')]]){_0xc3e145=_0x5f371b['uniqueid'];_0x5f371b[_0x4368('0x5')]=transfers[_0x4368('0x6')][_0x5f371b[_0x4368('0x5')]][_0x4368('0x7')];}if(_0x5f371b[_0x4368('0x8')]){utils[_0x4368('0x9')](_0x5f371b['accountcode'])[_0x4368('0xa')](function(_0x30c5e2){if(_0x30c5e2){_0x5f371b[_0x4368('0xb')]=_0x30c5e2[_0x4368('0xc')];_0x5f371b[_0x4368('0xd')]=_0x30c5e2['id'];}utils[_0x4368('0xe')](_0x4368('0xf'),_0x5f371b);});}else{utils[_0x4368('0xe')](_0x4368('0xf'),_0x5f371b);}if(_0xc3e145)delete transfers['blinds'][_0xc3e145];}exports[_0x4368('0x10')]=function(_0x223c8c){try{utils[_0x4368('0x11')](util['format'](_0x4368('0x12'),_0x223c8c[_0x4368('0x5')]),_0x223c8c);if(_0x223c8c[_0x4368('0x5')]==_0x223c8c['linkedid']){utils['info'](util[_0x4368('0x3')](_0x4368('0x13'),_0x223c8c[_0x4368('0x5')],_0x223c8c[_0x4368('0x14')],_0x223c8c[_0x4368('0x15')]));recordings[_0x223c8c[_0x4368('0x5')]]={'uniqueid':_0x223c8c[_0x4368('0x5')],'accountcode':_0x223c8c[_0x4368('0x8')],'exten':_0x223c8c[_0x4368('0x15')],'context':_0x223c8c['context'],'channel':_0x223c8c[_0x4368('0x16')],'monitors':[]};}}catch(_0x14682b){utils['error'](util['format']('[%s][recordings][newchannel]',_0x223c8c[_0x4368('0x5')]),_0x14682b);}};exports[_0x4368('0x17')]=function(_0x12c2e2){try{utils[_0x4368('0x11')](util['format'](_0x4368('0x18'),_0x12c2e2[_0x4368('0x5')]),_0x12c2e2);if(!_[_0x4368('0x19')](recordings[_0x12c2e2[_0x4368('0x5')]])&&_0x12c2e2[_0x4368('0x1a')]==0x6){utils[_0x4368('0x2')](util[_0x4368('0x3')](_0x4368('0x1b'),_0x12c2e2['uniqueid'],_0x12c2e2[_0x4368('0x14')],_0x12c2e2[_0x4368('0x16')]));}else if(!_[_0x4368('0x19')](recordings[_0x12c2e2['linkedid']])&&_0x12c2e2[_0x4368('0x1a')]==0x6&&_0x12c2e2[_0x4368('0x14')]!=_0x4368('0x1c')){utils['info'](util[_0x4368('0x3')](_0x4368('0x1d'),_0x12c2e2[_0x4368('0x5')],_0x12c2e2['linkedid'],_0x12c2e2['context'],_0x12c2e2[_0x4368('0x16')]));recordings[_0x12c2e2[_0x4368('0x1e')]][_0x4368('0x8')]=_0x12c2e2['accountcode'];}}catch(_0x4adb67){utils[_0x4368('0x1f')](util[_0x4368('0x3')](_0x4368('0x18'),_0x12c2e2[_0x4368('0x5')]),_0x4adb67);}};exports[_0x4368('0x20')]=function(_0x1d8f96){try{if(!_[_0x4368('0x19')](_0x1d8f96['variable'])&&!_['isNil'](_0x1d8f96[_0x4368('0x21')][_0x4368('0x22')])){utils[_0x4368('0x11')](util[_0x4368('0x3')]('[%s][recordings][varset]',_0x1d8f96[_0x4368('0x5')]),_0x1d8f96);utils[_0x4368('0x2')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1d8f96[_0x4368('0x5')],_0x1d8f96[_0x4368('0x21')],_0x1d8f96['value']));if(_[_0x4368('0x23')](_0x1d8f96[_0x4368('0x24')],_0x4368('0x25'))){_0x1d8f96[_0x4368('0x24')]=_0x1d8f96[_0x4368('0x24')][_0x4368('0x26')](_0x4368('0x25'),'.WAV');}if(recordings[_0x1d8f96[_0x4368('0x1e')]]){var _0x500736=_[_0x4368('0x27')](recordings[_0x1d8f96[_0x4368('0x1e')]][_0x4368('0x28')],{'value':_0x1d8f96[_0x4368('0x24')]});if(_[_0x4368('0x19')](_0x500736)){recordings[_0x1d8f96[_0x4368('0x1e')]]['monitors'][_0x4368('0x29')]({'value':_0x1d8f96[_0x4368('0x24')]});}}}}catch(_0xd7c190){utils['error'](util['format'](_0x4368('0x2a'),_0x1d8f96[_0x4368('0x5')]),_0xd7c190);}};exports[_0x4368('0x2b')]=function(_0x35a49a){try{if(!_[_0x4368('0x19')](recordings[_0x35a49a['uniqueid']])){utils[_0x4368('0x11')](util['format'](_0x4368('0x2c'),_0x35a49a[_0x4368('0x5')]),_0x35a49a);utils[_0x4368('0x2')](util[_0x4368('0x3')](_0x4368('0x2d'),_0x35a49a['uniqueid'],_0x35a49a[_0x4368('0x2e')],_0x35a49a[_0x4368('0x2f')],_0x35a49a[_0x4368('0x30')]));recordings[_0x35a49a[_0x4368('0x5')]][_0x4368('0x2e')]=_0x35a49a[_0x4368('0x2e')];recordings[_0x35a49a[_0x4368('0x5')]][_0x4368('0x2f')]=_0x35a49a[_0x4368('0x2f')];recordings[_0x35a49a['uniqueid']][_0x4368('0x31')]=_0x35a49a[_0x4368('0x31')];recordings[_0x35a49a[_0x4368('0x5')]][_0x4368('0x32')]=_0x35a49a['connectedlinename'];if(recordings[_0x35a49a[_0x4368('0x5')]][_0x4368('0x33')]=='outbound'&&recordings[_0x35a49a[_0x4368('0x5')]]['accountcode']){recordings[_0x35a49a[_0x4368('0x5')]][_0x4368('0x31')]=recordings[_0x35a49a[_0x4368('0x5')]]['accountcode'];recordings[_0x35a49a[_0x4368('0x5')]][_0x4368('0x32')]='';}recordings[_0x35a49a[_0x4368('0x5')]][_0x4368('0x28')]['forEach'](function(_0x52ad27){var _0x57291d=_[_0x4368('0x34')](recordings[_0x35a49a[_0x4368('0x5')]]);_0x57291d[_0x4368('0x24')]=_0x52ad27['value'];writeDB(_0x57291d);});delete recordings[_0x35a49a['uniqueid']];}}catch(_0x41fb1f){utils[_0x4368('0x1f')](util[_0x4368('0x3')]('[%s][recordings][hangup]',_0x35a49a[_0x4368('0x5')]),_0x41fb1f);}};exports[_0x4368('0x35')]=function(_0x3810d0){try{if(!_[_0x4368('0x19')](recordings[_0x3810d0[_0x4368('0x5')]])){utils[_0x4368('0x11')](util['format'](_0x4368('0x36'),_0x3810d0[_0x4368('0x5')]),_0x3810d0);utils[_0x4368('0x2')](util['format'](_0x4368('0x37'),_0x3810d0[_0x4368('0x5')],_0x3810d0[_0x4368('0x38')],_0x3810d0[_0x4368('0x39')]));if(_0x3810d0[_0x4368('0x38')][_0x4368('0x3a')]()=='set'&&_['startsWith'](_0x3810d0[_0x4368('0x39')][_0x4368('0x3a')](),'cdr')){var _0x3bbe30=_0x3810d0[_0x4368('0x39')][_0x4368('0x3b')]('=');var _0x255c0f=_0x3bbe30[0x0][_0x4368('0x3c')](_0x3bbe30[0x0]['lastIndexOf']('(')+0x1,_0x3bbe30[0x0][_0x4368('0x3d')](')'));var _0x55a5ef=_0x3bbe30[0x1];recordings[_0x3810d0[_0x4368('0x5')]][_0x255c0f]=_0x55a5ef;}}}catch(_0x42cdba){utils['error'](util[_0x4368('0x3')]('[%s][recordings][newexten]',_0x3810d0[_0x4368('0x5')]),_0x42cdba);}};exports[_0x4368('0x3e')]=function(_0x1bba2a){try{if(!_[_0x4368('0x19')](recordings[_0x1bba2a['uniqueid']])){utils['debug'](util[_0x4368('0x3')](_0x4368('0x3f'),_0x1bba2a[_0x4368('0x5')]),_0x1bba2a);utils['info'](util[_0x4368('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x1bba2a[_0x4368('0x5')],_0x1bba2a[_0x4368('0x40')]));recordings[_0x1bba2a[_0x4368('0x5')]]['queue']=_0x1bba2a[_0x4368('0x40')];}}catch(_0x134614){utils['error'](util[_0x4368('0x3')](_0x4368('0x3f'),_0x1bba2a[_0x4368('0x5')]),_0x134614);}};exports[_0x4368('0x41')]=function(_0x4fccdb){try{utils[_0x4368('0x11')](util[_0x4368('0x3')](_0x4368('0x42'),_0x4fccdb[_0x4368('0x5')]),_0x4fccdb);utils['info'](util[_0x4368('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4fccdb[_0x4368('0x5')],_0x4fccdb['transferercalleridnum'],_0x4fccdb[_0x4368('0x43')],_0x4fccdb[_0x4368('0x44')],_0x4fccdb[_0x4368('0x45')]));if(recordings[_0x4fccdb[_0x4368('0x46')]]&&transfers['blinds'][_0x4fccdb[_0x4368('0x46')]]){transfers[_0x4368('0x6')][_0x4fccdb[_0x4368('0x46')]][_0x4368('0x47')]=!![];}}catch(_0x1cba1c){utils[_0x4368('0x1f')](util[_0x4368('0x3')](_0x4368('0x42'),_0x4fccdb[_0x4368('0x5')]),_0x1cba1c);}}; \ No newline at end of file +var _0xff88=['calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereruniqueid','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xff88,0x1bc));var _0x8ff8=function(_0x354667,_0x877d68){_0x354667=_0x354667-0x0;var _0x54807b=_0xff88[_0x354667];return _0x54807b;};'use strict';var _=require('lodash');var util=require(_0x8ff8('0x0'));var utils=require(_0x8ff8('0x1'));var transfers=require(_0x8ff8('0x2'));var recordings={};function writeDB(_0xd71cc6){var _0x1ebedd;utils[_0x8ff8('0x3')](util[_0x8ff8('0x4')](_0x8ff8('0x5'),_0xd71cc6[_0x8ff8('0x6')]));if(transfers[_0x8ff8('0x7')][_0xd71cc6[_0x8ff8('0x6')]]){_0x1ebedd=_0xd71cc6[_0x8ff8('0x6')];_0xd71cc6[_0x8ff8('0x6')]=transfers[_0x8ff8('0x7')][_0xd71cc6[_0x8ff8('0x6')]][_0x8ff8('0x8')];}if(_0xd71cc6[_0x8ff8('0x9')]){utils[_0x8ff8('0xa')](_0xd71cc6[_0x8ff8('0x9')])[_0x8ff8('0xb')](function(_0x16cced){if(_0x16cced){_0xd71cc6[_0x8ff8('0xc')]=_0x16cced[_0x8ff8('0xd')];_0xd71cc6[_0x8ff8('0xe')]=_0x16cced['id'];}utils['request'](_0x8ff8('0xf'),_0xd71cc6);});}else{utils[_0x8ff8('0x10')]('CreateVoiceRecording',_0xd71cc6);}if(_0x1ebedd)delete transfers['blinds'][_0x1ebedd];}exports[_0x8ff8('0x11')]=function(_0x206c99){try{utils[_0x8ff8('0x12')](util[_0x8ff8('0x4')](_0x8ff8('0x13'),_0x206c99[_0x8ff8('0x6')]),_0x206c99);if(_0x206c99['uniqueid']==_0x206c99[_0x8ff8('0x14')]){utils[_0x8ff8('0x3')](util[_0x8ff8('0x4')](_0x8ff8('0x15'),_0x206c99['uniqueid'],_0x206c99[_0x8ff8('0x16')],_0x206c99['exten']));recordings[_0x206c99['uniqueid']]={'uniqueid':_0x206c99[_0x8ff8('0x6')],'accountcode':_0x206c99['accountcode'],'exten':_0x206c99[_0x8ff8('0x17')],'context':_0x206c99[_0x8ff8('0x16')],'channel':_0x206c99[_0x8ff8('0x18')],'monitors':[]};}}catch(_0x5eb196){utils['error'](util['format'](_0x8ff8('0x13'),_0x206c99[_0x8ff8('0x6')]),_0x5eb196);}};exports[_0x8ff8('0x19')]=function(_0x592740){try{utils[_0x8ff8('0x12')](util[_0x8ff8('0x4')](_0x8ff8('0x1a'),_0x592740['uniqueid']),_0x592740);if(!_['isNil'](recordings[_0x592740[_0x8ff8('0x6')]])&&_0x592740['channelstate']==0x6){utils[_0x8ff8('0x3')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x592740[_0x8ff8('0x6')],_0x592740['context'],_0x592740['channel']));}else if(!_[_0x8ff8('0x1b')](recordings[_0x592740['linkedid']])&&_0x592740[_0x8ff8('0x1c')]==0x6&&_0x592740[_0x8ff8('0x16')]!='transfer'){utils[_0x8ff8('0x3')](util[_0x8ff8('0x4')](_0x8ff8('0x1d'),_0x592740[_0x8ff8('0x6')],_0x592740['linkedid'],_0x592740['context'],_0x592740[_0x8ff8('0x18')]));recordings[_0x592740['linkedid']][_0x8ff8('0x9')]=_0x592740[_0x8ff8('0x9')];}}catch(_0x3eceba){utils[_0x8ff8('0x1e')](util[_0x8ff8('0x4')](_0x8ff8('0x1a'),_0x592740['uniqueid']),_0x3eceba);}};exports[_0x8ff8('0x1f')]=function(_0x35cf84){try{if(!_[_0x8ff8('0x1b')](_0x35cf84['variable'])&&!_[_0x8ff8('0x1b')](_0x35cf84[_0x8ff8('0x20')][_0x8ff8('0x21')])){utils[_0x8ff8('0x12')](util[_0x8ff8('0x4')]('[%s][recordings][varset]',_0x35cf84[_0x8ff8('0x6')]),_0x35cf84);utils[_0x8ff8('0x3')](util[_0x8ff8('0x4')](_0x8ff8('0x22'),_0x35cf84[_0x8ff8('0x6')],_0x35cf84[_0x8ff8('0x20')],_0x35cf84[_0x8ff8('0x23')]));if(_['endsWith'](_0x35cf84[_0x8ff8('0x23')],'.wav49')){_0x35cf84['value']=_0x35cf84[_0x8ff8('0x23')][_0x8ff8('0x24')](_0x8ff8('0x25'),_0x8ff8('0x26'));}if(recordings[_0x35cf84[_0x8ff8('0x14')]]){var _0x42510f=_[_0x8ff8('0x27')](recordings[_0x35cf84[_0x8ff8('0x14')]][_0x8ff8('0x28')],{'value':_0x35cf84['value']});if(_['isNil'](_0x42510f)){recordings[_0x35cf84[_0x8ff8('0x14')]][_0x8ff8('0x28')][_0x8ff8('0x29')]({'value':_0x35cf84[_0x8ff8('0x23')]});}}}}catch(_0x377411){utils[_0x8ff8('0x1e')](util['format']('[%s][recordings][varset]',_0x35cf84['uniqueid']),_0x377411);}};exports[_0x8ff8('0x2a')]=function(_0x304b18){try{if(!_['isNil'](recordings[_0x304b18[_0x8ff8('0x6')]])){utils[_0x8ff8('0x12')](util[_0x8ff8('0x4')](_0x8ff8('0x2b'),_0x304b18[_0x8ff8('0x6')]),_0x304b18);utils['info'](util['format'](_0x8ff8('0x2c'),_0x304b18[_0x8ff8('0x6')],_0x304b18[_0x8ff8('0x2d')],_0x304b18[_0x8ff8('0x2e')],_0x304b18[_0x8ff8('0x2f')]));recordings[_0x304b18[_0x8ff8('0x6')]][_0x8ff8('0x2d')]=_0x304b18['calleridnum'];recordings[_0x304b18['uniqueid']]['calleridname']=_0x304b18[_0x8ff8('0x2e')];recordings[_0x304b18[_0x8ff8('0x6')]]['connectedlinenum']=_0x304b18[_0x8ff8('0x30')];recordings[_0x304b18[_0x8ff8('0x6')]][_0x8ff8('0x31')]=_0x304b18[_0x8ff8('0x31')];if(recordings[_0x304b18[_0x8ff8('0x6')]][_0x8ff8('0x32')]==_0x8ff8('0x33')&&recordings[_0x304b18[_0x8ff8('0x6')]][_0x8ff8('0x9')]){recordings[_0x304b18[_0x8ff8('0x6')]]['connectedlinenum']=recordings[_0x304b18[_0x8ff8('0x6')]][_0x8ff8('0x9')];recordings[_0x304b18['uniqueid']][_0x8ff8('0x31')]='';}recordings[_0x304b18[_0x8ff8('0x6')]][_0x8ff8('0x28')][_0x8ff8('0x34')](function(_0x3b9f83){var _0x27099b=_[_0x8ff8('0x35')](recordings[_0x304b18['uniqueid']]);_0x27099b[_0x8ff8('0x23')]=_0x3b9f83[_0x8ff8('0x23')];writeDB(_0x27099b);});delete recordings[_0x304b18[_0x8ff8('0x6')]];}}catch(_0x2fe089){utils[_0x8ff8('0x1e')](util[_0x8ff8('0x4')](_0x8ff8('0x2b'),_0x304b18[_0x8ff8('0x6')]),_0x2fe089);}};exports[_0x8ff8('0x36')]=function(_0x226518){try{if(!_[_0x8ff8('0x1b')](recordings[_0x226518['uniqueid']])){utils[_0x8ff8('0x12')](util['format']('[%s][recordings][newexten]',_0x226518[_0x8ff8('0x6')]),_0x226518);utils[_0x8ff8('0x3')](util[_0x8ff8('0x4')](_0x8ff8('0x37'),_0x226518[_0x8ff8('0x6')],_0x226518[_0x8ff8('0x38')],_0x226518[_0x8ff8('0x39')]));if(_0x226518[_0x8ff8('0x38')]['toLowerCase']()==_0x8ff8('0x3a')&&_['startsWith'](_0x226518[_0x8ff8('0x39')][_0x8ff8('0x3b')](),'cdr')){var _0x13bb44=_0x226518['appdata']['split']('=');var _0xc80852=_0x13bb44[0x0]['substring'](_0x13bb44[0x0][_0x8ff8('0x3c')]('(')+0x1,_0x13bb44[0x0][_0x8ff8('0x3c')](')'));var _0x4baf7d=_0x13bb44[0x1];recordings[_0x226518[_0x8ff8('0x6')]][_0xc80852]=_0x4baf7d;}}}catch(_0x25543d){utils[_0x8ff8('0x1e')](util[_0x8ff8('0x4')]('[%s][recordings][newexten]',_0x226518[_0x8ff8('0x6')]),_0x25543d);}};exports[_0x8ff8('0x3d')]=function(_0x2e3b8b){try{if(!_['isNil'](recordings[_0x2e3b8b[_0x8ff8('0x6')]])){utils[_0x8ff8('0x12')](util[_0x8ff8('0x4')](_0x8ff8('0x3e'),_0x2e3b8b['uniqueid']),_0x2e3b8b);utils[_0x8ff8('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x2e3b8b[_0x8ff8('0x6')],_0x2e3b8b['queue']));recordings[_0x2e3b8b[_0x8ff8('0x6')]][_0x8ff8('0x3f')]=_0x2e3b8b[_0x8ff8('0x3f')];}}catch(_0x1a0676){utils[_0x8ff8('0x1e')](util[_0x8ff8('0x4')](_0x8ff8('0x3e'),_0x2e3b8b['uniqueid']),_0x1a0676);}};exports[_0x8ff8('0x40')]=function(_0x2cc2b7){try{utils['debug'](util['format'](_0x8ff8('0x41'),_0x2cc2b7[_0x8ff8('0x6')]),_0x2cc2b7);utils[_0x8ff8('0x3')](util['format'](_0x8ff8('0x42'),_0x2cc2b7[_0x8ff8('0x6')],_0x2cc2b7['transferercalleridnum'],_0x2cc2b7[_0x8ff8('0x43')],_0x2cc2b7[_0x8ff8('0x44')],_0x2cc2b7['transfereecalleridname']));if(recordings[_0x2cc2b7[_0x8ff8('0x45')]]&&transfers['blinds'][_0x2cc2b7['transfereruniqueid']]){transfers[_0x8ff8('0x7')][_0x2cc2b7[_0x8ff8('0x45')]]['recording']=!![];}}catch(_0x2f1691){utils[_0x8ff8('0x1e')](util[_0x8ff8('0x4')](_0x8ff8('0x41'),_0x2cc2b7[_0x8ff8('0x6')]),_0x2f1691);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a58024b..f2d3b53 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 _0xe2c7=['isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten'];(function(_0x138240,_0x342205){var _0x5b3b70=function(_0x389b44){while(--_0x389b44){_0x138240['push'](_0x138240['shift']());}};_0x5b3b70(++_0x342205);}(_0xe2c7,0x17a));var _0x7e2c=function(_0x4e87ba,_0x2d95f9){_0x4e87ba=_0x4e87ba-0x0;var _0x212b08=_0xe2c7[_0x4e87ba];return _0x212b08;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x7e2c('0x0'));function writeDB(_0x519453){utils[_0x7e2c('0x1')](util[_0x7e2c('0x2')](_0x7e2c('0x3'),_0x519453[_0x7e2c('0x4')]===_0x7e2c('0x5')?_0x519453[_0x7e2c('0x6')]:_0x519453[_0x7e2c('0x7')],_0x519453[_0x7e2c('0x4')]));utils[_0x7e2c('0x8')]('CreateVoiceTransferReport',_0x519453);}exports[_0x7e2c('0x9')]={};exports['blindtransfer']=function(_0x4920c3){try{utils[_0x7e2c('0xa')](util[_0x7e2c('0x2')](_0x7e2c('0xb'),_0x4920c3[_0x7e2c('0x7')]),_0x4920c3);utils['info'](util[_0x7e2c('0x2')](_0x7e2c('0xc'),_0x4920c3[_0x7e2c('0x7')],_0x4920c3[_0x7e2c('0xd')],_0x4920c3[_0x7e2c('0xe')],_0x4920c3[_0x7e2c('0xf')],_0x4920c3[_0x7e2c('0x10')]));_0x4920c3[_0x7e2c('0x4')]='blind';exports[_0x7e2c('0x9')][_0x4920c3[_0x7e2c('0x11')]]=_0x4920c3;writeDB(_0x4920c3);}catch(_0x4b0e7c){utils[_0x7e2c('0x12')](util[_0x7e2c('0x2')]('[%s][transfers][blindtransfer]',_0x4920c3['uniqueid']),_0x4b0e7c);}};exports[_0x7e2c('0x13')]=function(_0x1a9aa4){try{utils['debug'](util['format']('[%s][transfers][attendedtransfer]',_0x1a9aa4['origtransfereruniqueid']),_0x1a9aa4);utils[_0x7e2c('0x1')](util[_0x7e2c('0x2')](_0x7e2c('0x14'),_0x1a9aa4[_0x7e2c('0x6')],_0x1a9aa4[_0x7e2c('0x15')],_0x1a9aa4[_0x7e2c('0x16')],_0x1a9aa4['transfertargetcalleridnum'],_0x1a9aa4[_0x7e2c('0x17')]));_0x1a9aa4=_[_0x7e2c('0x18')](_0x1a9aa4,{'transfererchannel':_0x1a9aa4[_0x7e2c('0x19')],'transferercalleridnum':_0x1a9aa4[_0x7e2c('0x15')],'transferercalleridname':_0x1a9aa4[_0x7e2c('0x16')],'transfererconnectedlinenum':_0x1a9aa4[_0x7e2c('0x1a')],'transfererconnectedlinename':_0x1a9aa4['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1a9aa4['origtransfereraccountcode'],'transferercontext':_0x1a9aa4[_0x7e2c('0x1b')],'transfererexten':_0x1a9aa4[_0x7e2c('0x1c')],'transfererlinkedid':_0x1a9aa4[_0x7e2c('0x1d')],'context':_0x1a9aa4[_0x7e2c('0x1e')],'extension':_0x1a9aa4[_0x7e2c('0x1f')],'type':'attended'});if(_[_0x7e2c('0x20')](_0x1a9aa4[_0x7e2c('0x21')])){_0x1a9aa4=_[_0x7e2c('0x18')](_0x1a9aa4,{'transfereechannel':_0x1a9aa4['transfertargetchannel'],'transfereecalleridnum':_0x1a9aa4[_0x7e2c('0x22')],'transfereecalleridname':_0x1a9aa4[_0x7e2c('0x17')],'transfereeconnectedlinenum':_0x1a9aa4['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1a9aa4[_0x7e2c('0x23')],'transfereeaccountcode':_0x1a9aa4[_0x7e2c('0x24')],'transfereecontext':_0x1a9aa4[_0x7e2c('0x25')],'transfereeexten':_0x1a9aa4[_0x7e2c('0x26')],'transfereelinkedid':_0x1a9aa4[_0x7e2c('0x27')]});}writeDB(_0x1a9aa4);}catch(_0x2a80f6){utils[_0x7e2c('0x12')](util['format'](_0x7e2c('0x28'),_0x1a9aa4[_0x7e2c('0x6')]),_0x2a80f6);}}; \ No newline at end of file +var _0x2e71=['transfertargetlinkedid','./utils','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','info','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x2e71,0xf1));var _0x12e7=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x2e71[_0x1fdb40];return _0x281f93;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x12e7('0x0'));function writeDB(_0x293608){utils['info'](util['format'](_0x12e7('0x1'),_0x293608[_0x12e7('0x2')]===_0x12e7('0x3')?_0x293608[_0x12e7('0x4')]:_0x293608[_0x12e7('0x5')],_0x293608[_0x12e7('0x2')]));utils[_0x12e7('0x6')](_0x12e7('0x7'),_0x293608);}exports[_0x12e7('0x8')]={};exports[_0x12e7('0x9')]=function(_0xd1e8f7){try{utils[_0x12e7('0xa')](util[_0x12e7('0xb')](_0x12e7('0xc'),_0xd1e8f7['uniqueid']),_0xd1e8f7);utils[_0x12e7('0xd')](util[_0x12e7('0xb')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xd1e8f7[_0x12e7('0x5')],_0xd1e8f7[_0x12e7('0xe')],_0xd1e8f7['transferercalleridname'],_0xd1e8f7[_0x12e7('0xf')],_0xd1e8f7[_0x12e7('0x10')]));_0xd1e8f7[_0x12e7('0x2')]=_0x12e7('0x11');exports[_0x12e7('0x8')][_0xd1e8f7[_0x12e7('0x12')]]=_0xd1e8f7;writeDB(_0xd1e8f7);}catch(_0x3f3b90){utils[_0x12e7('0x13')](util['format'](_0x12e7('0xc'),_0xd1e8f7[_0x12e7('0x5')]),_0x3f3b90);}};exports['attendedtransfer']=function(_0x59687d){try{utils[_0x12e7('0xa')](util[_0x12e7('0xb')](_0x12e7('0x14'),_0x59687d[_0x12e7('0x4')]),_0x59687d);utils[_0x12e7('0xd')](util[_0x12e7('0xb')](_0x12e7('0x15'),_0x59687d[_0x12e7('0x4')],_0x59687d['origtransferercalleridnum'],_0x59687d[_0x12e7('0x16')],_0x59687d[_0x12e7('0x17')],_0x59687d[_0x12e7('0x18')]));_0x59687d=_[_0x12e7('0x19')](_0x59687d,{'transfererchannel':_0x59687d[_0x12e7('0x1a')],'transferercalleridnum':_0x59687d[_0x12e7('0x1b')],'transferercalleridname':_0x59687d['origtransferercalleridname'],'transfererconnectedlinenum':_0x59687d[_0x12e7('0x1c')],'transfererconnectedlinename':_0x59687d[_0x12e7('0x1d')],'transfereraccountcode':_0x59687d[_0x12e7('0x1e')],'transferercontext':_0x59687d['secondtransferercontext'],'transfererexten':_0x59687d[_0x12e7('0x1f')],'transfererlinkedid':_0x59687d[_0x12e7('0x20')],'context':_0x59687d[_0x12e7('0x21')],'extension':_0x59687d['origtransfererexten'],'type':_0x12e7('0x3')});if(_['isNil'](_0x59687d[_0x12e7('0x22')])){_0x59687d=_['assign'](_0x59687d,{'transfereechannel':_0x59687d['transfertargetchannel'],'transfereecalleridnum':_0x59687d['transfertargetcalleridnum'],'transfereecalleridname':_0x59687d[_0x12e7('0x18')],'transfereeconnectedlinenum':_0x59687d[_0x12e7('0x23')],'transfereeconnectedlinename':_0x59687d[_0x12e7('0x24')],'transfereeaccountcode':_0x59687d[_0x12e7('0x25')],'transfereecontext':_0x59687d[_0x12e7('0x26')],'transfereeexten':_0x59687d['transfertargetexten'],'transfereelinkedid':_0x59687d[_0x12e7('0x27')]});}writeDB(_0x59687d);}catch(_0x16fb7c){utils[_0x12e7('0x13')](util[_0x12e7('0xb')](_0x12e7('0x14'),_0x59687d[_0x12e7('0x4')]),_0x16fb7c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8d5aebc..cb2a43c 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 _0xb35d=['[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','seconds','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','info'];(function(_0x10c47e,_0x5c395a){var _0x409ba3=function(_0x59fcdf){while(--_0x59fcdf){_0x10c47e['push'](_0x10c47e['shift']());}};_0x409ba3(++_0x5c395a);}(_0xb35d,0x14b));var _0xdb35=function(_0x1d2e5e,_0x145ae6){_0x1d2e5e=_0x1d2e5e-0x0;var _0x4a1d68=_0xb35d[_0x1d2e5e];return _0x4a1d68;};'use strict';var BPromise=require(_0xdb35('0x0'));var jayson=require(_0xdb35('0x1'));var moment=require(_0xdb35('0x2'));var util=require(_0xdb35('0x3'));var client=jayson[_0xdb35('0x4')][_0xdb35('0x5')]({'port':0x2329});var logger=require(_0xdb35('0x6'))(_0xdb35('0x7'));exports['info']=function(_0x3799fa,_0x277350){logger['info'](_0x3799fa,_0x277350?util[_0xdb35('0x8')](_0x277350,{'showHidden':![],'depth':null}):'');};exports[_0xdb35('0x9')]=function(_0x225fcb,_0x3e7589){logger[_0xdb35('0x9')](_0x225fcb,_0x3e7589?util[_0xdb35('0x8')](_0x3e7589,{'showHidden':![],'depth':null}):'');};exports[_0xdb35('0xa')]=function(_0x4e5eac,_0x1375a1){logger[_0xdb35('0xa')](_0x4e5eac,_0x1375a1?util[_0xdb35('0x8')](_0x1375a1,{'showHidden':![],'depth':null}):'');};exports[_0xdb35('0xb')]=function(_0x34f06a,_0x3b541f){return client[_0xdb35('0xb')](_0x34f06a,{'body':_0x3b541f})[_0xdb35('0xc')](function(_0x454df8){logger[_0xdb35('0x9')]('[utils][request]\x20name:%s',_0x34f06a,_0x454df8?util[_0xdb35('0x8')](_0x454df8,{'showHidden':![],'depth':null}):'');})[_0xdb35('0xd')](function(_0x371ea7){logger[_0xdb35('0xa')](_0xdb35('0xe'),_0x34f06a,_0x371ea7?util[_0xdb35('0x8')](_0x371ea7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x6934d2){return client[_0xdb35('0xb')](_0xdb35('0xf'),{'options':{'raw':!![],'attributes':['id',_0xdb35('0x10'),'name','interface'],'where':_0x6934d2,'limit':0x1}})[_0xdb35('0xc')](function(_0x20b5c2){logger[_0xdb35('0x9')](_0xdb35('0x11'),JSON[_0xdb35('0x12')](_0x6934d2),_0x20b5c2?util[_0xdb35('0x8')](_0x20b5c2,{'showHidden':![],'depth':null}):'');return _0x20b5c2[_0xdb35('0x13')]['length']?_0x20b5c2[_0xdb35('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x488626){return new BPromise(function(_0x3a3cdb,_0x3e3771){if(_0x488626){return getUser({'internal':_0x488626})[_0xdb35('0xc')](function(_0x25d936){logger['info'](_0xdb35('0x14'),_0x488626,_0x25d936?_0xdb35('0x15'):_0xdb35('0x16'));return _0x3a3cdb(_0x25d936);})[_0xdb35('0xd')](function(_0x1fca3f){logger[_0xdb35('0xa')](_0xdb35('0x17'),_0x1fca3f?util[_0xdb35('0x8')](_0x1fca3f,{'showHidden':![],'depth':null}):'');return _0x3a3cdb(null);});}return _0x3a3cdb(null);});};exports[_0xdb35('0x18')]=function(_0x16a5ce){return new BPromise(function(_0xdb993d,_0x3f691a){if(_0x16a5ce){return getUser({'interface':_0x16a5ce})[_0xdb35('0xc')](function(_0x574d66){logger[_0xdb35('0x19')](_0xdb35('0x1a'),_0x16a5ce,_0x574d66?_0xdb35('0x15'):'notfound');return _0xdb993d(_0x574d66);})[_0xdb35('0xd')](function(_0x4e51bf){logger['error'](_0xdb35('0x1b'),_0x4e51bf?util['inspect'](_0x4e51bf,{'showHidden':![],'depth':null}):'');return _0xdb993d(null);});}return _0xdb993d(null);});};exports[_0xdb35('0x1c')]=function(_0x547a25){return new BPromise(function(_0x30ea52,_0x4ef02a){if(_0x547a25){return getUser({'name':_0x547a25})[_0xdb35('0xc')](function(_0x55b1d6){logger['info'](_0xdb35('0x1d'),_0x547a25,_0x55b1d6?_0xdb35('0x15'):'notfound');return _0x30ea52(_0x55b1d6);})[_0xdb35('0xd')](function(_0x5ac4bf){logger['error']('[utils][getUserByName]',_0x5ac4bf?util['inspect'](_0x5ac4bf,{'showHidden':![],'depth':null}):'');return _0x30ea52(null);});}return _0x30ea52(null);});};exports[_0xdb35('0x1e')]=function(_0x1ad1ee){return new BPromise(function(_0x270864,_0x42141e){if(_0x1ad1ee){return client[_0xdb35('0xb')](_0xdb35('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xdb35('0x20'),_0xdb35('0x21'),_0xdb35('0x22'),_0xdb35('0x23')],'where':{'name':_0x1ad1ee},'limit':0x1}})['then'](function(_0x391346){logger[_0xdb35('0x9')](_0xdb35('0x24'),_0x1ad1ee,_0x391346?util[_0xdb35('0x8')](_0x391346,{'showHidden':![],'depth':null}):'');logger['info'](_0xdb35('0x25'),_0x1ad1ee,_0x391346?_0xdb35('0x15'):'notfound');return _0x270864(_0x391346[_0xdb35('0x13')][_0xdb35('0x26')]?_0x391346[_0xdb35('0x13')][0x0]:null);})['catch'](function(_0x3aeb7c){logger[_0xdb35('0xa')](_0xdb35('0x27'),_0x3aeb7c?util['inspect'](_0x3aeb7c,{'showHidden':![],'depth':null}):'');return _0x270864(null);});}return _0x270864(null);});};exports['addTime']=function(_0x41a25d,_0x4fcf3f){return moment(_0x41a25d)[_0xdb35('0x28')](_0x4fcf3f,'seconds')[_0xdb35('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xdb35('0x2a')]=function(_0x1b9707,_0x1f3071){return moment(_0x1b9707)[_0xdb35('0x2b')](_0x1f3071,'seconds')['format'](_0xdb35('0x2c'));};exports[_0xdb35('0x2d')]=function(_0x27837b,_0x160255){return moment(_0x27837b)[_0xdb35('0x2e')](moment(_0x160255),_0xdb35('0x2f'));};exports[_0xdb35('0x30')]=function(_0x4e71f2,_0x3ede16){return parseInt(_0x4e71f2,0xa)+parseInt(_0x3ede16,0xa);};exports['now']=function(){return moment()[_0xdb35('0x29')](_0xdb35('0x2c'));};exports[_0xdb35('0x31')]=function(_0x37c7f3,_0xf66b00){if(_0xf66b00){return moment(_0x37c7f3)[_0xdb35('0x31')](_0xf66b00);}return!![];};exports[_0xdb35('0x32')]=function(_0x486c5e,_0x3873d4){if(_0x3873d4){return moment(_0x486c5e)['isBefore'](_0x3873d4);}else if(_0x486c5e){return!![];}return![];}; \ No newline at end of file +var _0x0b3d=['debug','error','request','then','[utils][request]\x20name:%s','inspect','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','getUserByName','[utils][getUserByName]','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment','client','../../config/logger','info'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x0b3d,0x76));var _0xd0b3=function(_0x4a7273,_0x19c9ca){_0x4a7273=_0x4a7273-0x0;var _0x135ca9=_0x0b3d[_0x4a7273];return _0x135ca9;};'use strict';var BPromise=require(_0xd0b3('0x0'));var jayson=require('jayson/promise');var moment=require(_0xd0b3('0x1'));var util=require('util');var client=jayson[_0xd0b3('0x2')]['http']({'port':0x2329});var logger=require(_0xd0b3('0x3'))('xdr');exports[_0xd0b3('0x4')]=function(_0x50faaa,_0x371869){logger[_0xd0b3('0x4')](_0x50faaa,_0x371869?util['inspect'](_0x371869,{'showHidden':![],'depth':null}):'');};exports[_0xd0b3('0x5')]=function(_0x5bc883,_0x872957){logger['debug'](_0x5bc883,_0x872957?util['inspect'](_0x872957,{'showHidden':![],'depth':null}):'');};exports[_0xd0b3('0x6')]=function(_0x526c12,_0x4b9680){logger[_0xd0b3('0x6')](_0x526c12,_0x4b9680?util['inspect'](_0x4b9680,{'showHidden':![],'depth':null}):'');};exports[_0xd0b3('0x7')]=function(_0x336b7f,_0x5950d7){return client['request'](_0x336b7f,{'body':_0x5950d7})[_0xd0b3('0x8')](function(_0xbf2123){logger[_0xd0b3('0x5')](_0xd0b3('0x9'),_0x336b7f,_0xbf2123?util['inspect'](_0xbf2123,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x97ca75){logger[_0xd0b3('0x6')](_0xd0b3('0x9'),_0x336b7f,_0x97ca75?util[_0xd0b3('0xa')](_0x97ca75,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1f2544){return client[_0xd0b3('0x7')](_0xd0b3('0xb'),{'options':{'raw':!![],'attributes':['id','internal',_0xd0b3('0xc'),_0xd0b3('0xd')],'where':_0x1f2544,'limit':0x1}})[_0xd0b3('0x8')](function(_0x28d379){logger['debug'](_0xd0b3('0xe'),JSON[_0xd0b3('0xf')](_0x1f2544),_0x28d379?util[_0xd0b3('0xa')](_0x28d379,{'showHidden':![],'depth':null}):'');return _0x28d379['result'][_0xd0b3('0x10')]?_0x28d379[_0xd0b3('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0xd4c8cb){return new BPromise(function(_0x232e6a,_0x5045b4){if(_0xd4c8cb){return getUser({'internal':_0xd4c8cb})[_0xd0b3('0x8')](function(_0x3fc7be){logger[_0xd0b3('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0xd4c8cb,_0x3fc7be?_0xd0b3('0x12'):_0xd0b3('0x13'));return _0x232e6a(_0x3fc7be);})[_0xd0b3('0x14')](function(_0x574dcc){logger['error'](_0xd0b3('0x15'),_0x574dcc?util['inspect'](_0x574dcc,{'showHidden':![],'depth':null}):'');return _0x232e6a(null);});}return _0x232e6a(null);});};exports[_0xd0b3('0x16')]=function(_0x1d023d){return new BPromise(function(_0x43ad4b,_0x4234a0){if(_0x1d023d){return getUser({'interface':_0x1d023d})[_0xd0b3('0x8')](function(_0x553c27){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1d023d,_0x553c27?_0xd0b3('0x12'):_0xd0b3('0x13'));return _0x43ad4b(_0x553c27);})[_0xd0b3('0x14')](function(_0x1bfe7b){logger[_0xd0b3('0x6')]('[utils][getUserByInterface]',_0x1bfe7b?util[_0xd0b3('0xa')](_0x1bfe7b,{'showHidden':![],'depth':null}):'');return _0x43ad4b(null);});}return _0x43ad4b(null);});};exports[_0xd0b3('0x17')]=function(_0x276d93){return new BPromise(function(_0x2e0dcc,_0x550d35){if(_0x276d93){return getUser({'name':_0x276d93})[_0xd0b3('0x8')](function(_0x17836c){logger[_0xd0b3('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x276d93,_0x17836c?_0xd0b3('0x12'):_0xd0b3('0x13'));return _0x2e0dcc(_0x17836c);})[_0xd0b3('0x14')](function(_0x2cc459){logger['error'](_0xd0b3('0x18'),_0x2cc459?util[_0xd0b3('0xa')](_0x2cc459,{'showHidden':![],'depth':null}):'');return _0x2e0dcc(null);});}return _0x2e0dcc(null);});};exports['getVoiceQueueByName']=function(_0x1e4c8f){return new BPromise(function(_0x43bfe7,_0x52f324){if(_0x1e4c8f){return client[_0xd0b3('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xd0b3('0xc'),'type',_0xd0b3('0x19'),_0xd0b3('0x1a')],'where':{'name':_0x1e4c8f},'limit':0x1}})[_0xd0b3('0x8')](function(_0x366931){logger[_0xd0b3('0x5')](_0xd0b3('0x1b'),_0x1e4c8f,_0x366931?util[_0xd0b3('0xa')](_0x366931,{'showHidden':![],'depth':null}):'');logger['info'](_0xd0b3('0x1c'),_0x1e4c8f,_0x366931?_0xd0b3('0x12'):_0xd0b3('0x13'));return _0x43bfe7(_0x366931[_0xd0b3('0x11')]['length']?_0x366931[_0xd0b3('0x11')][0x0]:null);})[_0xd0b3('0x14')](function(_0x2194e1){logger[_0xd0b3('0x6')]('[utils][getVoiceQueueByName]',_0x2194e1?util[_0xd0b3('0xa')](_0x2194e1,{'showHidden':![],'depth':null}):'');return _0x43bfe7(null);});}return _0x43bfe7(null);});};exports[_0xd0b3('0x1d')]=function(_0x46116b,_0x2f2e00){return moment(_0x46116b)[_0xd0b3('0x1e')](_0x2f2e00,_0xd0b3('0x1f'))[_0xd0b3('0x20')](_0xd0b3('0x21'));};exports[_0xd0b3('0x22')]=function(_0x1db5dc,_0x22de39){return moment(_0x1db5dc)[_0xd0b3('0x23')](_0x22de39,_0xd0b3('0x1f'))[_0xd0b3('0x20')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xd0b3('0x24')]=function(_0x33df78,_0x2c5261){return moment(_0x33df78)[_0xd0b3('0x25')](moment(_0x2c5261),'seconds');};exports['sumTime']=function(_0x5a69e9,_0x11484e){return parseInt(_0x5a69e9,0xa)+parseInt(_0x11484e,0xa);};exports[_0xd0b3('0x26')]=function(){return moment()[_0xd0b3('0x20')](_0xd0b3('0x21'));};exports[_0xd0b3('0x27')]=function(_0xa31b50,_0x4d12de){if(_0x4d12de){return moment(_0xa31b50)[_0xd0b3('0x27')](_0x4d12de);}return!![];};exports[_0xd0b3('0x28')]=function(_0x2afde3,_0x3f83d2){if(_0x3f83d2){return moment(_0x2afde3)[_0xd0b3('0x28')](_0x3f83d2);}else if(_0x2afde3){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 c16ae7a..be10246 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 _0x8f07=['fs-extra','express-winston','path','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','ensureDir','then','catch','user','data','timestamp','error','api','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','url','other','agent_id','agent_name'];(function(_0xd31204,_0x3fe892){var _0x594a44=function(_0x526433){while(--_0x526433){_0xd31204['push'](_0xd31204['shift']());}};_0x594a44(++_0x3fe892);}(_0x8f07,0x134));var _0x78f0=function(_0x48f3f1,_0x19dec7){_0x48f3f1=_0x48f3f1-0x0;var _0x171c53=_0x8f07[_0x48f3f1];return _0x171c53;};var fs=require(_0x78f0('0x0'));var _=require('lodash');var ewinston=require(_0x78f0('0x1'));var path=require(_0x78f0('0x2'));var util=require('util');var fileLogger=require(_0x78f0('0x3'))[_0x78f0('0x4')];var safeTemplate=require('./safe-template')[_0x78f0('0x5')];var maskSensitiveData=require(_0x78f0('0x6'))[_0x78f0('0x7')];function ClientSideLogger(){function _0x15a941(_0x5dedd7){var _0x108ffe=path[_0x78f0('0x8')](_0x78f0('0x9'),_0x78f0('0xa'),'xcally');var _0x58b3ec=path[_0x78f0('0x8')](_0x78f0('0xb'),_0x5dedd7[_0x78f0('0xc')]+'-'+_0x5dedd7[_0x78f0('0xd')]);return fs[_0x78f0('0xe')](path[_0x78f0('0x8')](_0x108ffe,_0x58b3ec))[_0x78f0('0xf')](function(){var _0x68d159=fileLogger(_0x78f0('0xb'),path[_0x78f0('0x8')](_0x108ffe,_0x58b3ec));return _0x68d159;})[_0x78f0('0x10')](function(_0xa0e46e){throw _0xa0e46e;});}this[_0x78f0('0xa')]=function(_0x2d9532,_0x4dc3ec,_0x12e759,_0x593626){return _0x15a941(_0x2d9532[_0x78f0('0x11')])[_0x78f0('0xf')](function(_0x50622e){var _0x377dbb=_0x50622e[_0x4dc3ec];return _0x377dbb;})[_0x78f0('0xf')](function(_0x16671a){var _0x3dcedc=_0x2d9532['user']?_0x2d9532[_0x78f0('0x11')]['id']:'no-user';var _0x29f304=_0x593626[_0x78f0('0x12')];var _0x13e03b=_0x593626[_0x78f0('0x13')];var _0xef5717=new Date(Number(_0x13e03b));return _0x16671a(_0x3dcedc,_0xef5717,_0x12e759,_0x29f304);})['catch'](function(_0x3c8021){fileLogger(_0x78f0('0xb'))[_0x78f0('0x14')](_0x3c8021);});};}function setupLoggers(_0x210b7b){return new Promise(function(_0x56c271){var _0x2d9cda=new ClientSideLogger();var _0x2ae4bb=fileLogger(_0x78f0('0x15'));var _0x58d02c=fileLogger('auth');_0x210b7b[_0x78f0('0x16')]('client-side-logger',_0x2d9cda);_0x210b7b[_0x78f0('0x17')](ewinston[_0x78f0('0x18')]({'winstonInstance':_0x2ae4bb,'meta':![],'statusLevels':!![],'msg':function(_0x55ab01,_0x299cb4){var _0x4f040d=_0x78f0('0x19');if(!_[_0x78f0('0x1a')](_0x55ab01[_0x78f0('0x1b')])){_0x4f040d+=_0x78f0('0x1c');var _0x4833be=_0x55ab01[_0x78f0('0x1b')];maskSensitiveData(_0x4833be);}return safeTemplate(util[_0x78f0('0x1d')](_0x4f040d,_0x55ab01[_0x78f0('0x1e')],_0x55ab01[_0x78f0('0x1f')]['x-forwarded-for']?_0x55ab01[_0x78f0('0x1f')][_0x78f0('0x20')]:_0x55ab01[_0x78f0('0x21')][_0x78f0('0x22')]||_0x55ab01['ip'],_0x55ab01['url'],_0x299cb4[_0x78f0('0x23')],_0x299cb4[_0x78f0('0x24')],_0x55ab01['user']?_0x55ab01[_0x78f0('0x11')]['id']:null,_0x55ab01[_0x78f0('0x11')]?_0x55ab01[_0x78f0('0x11')][_0x78f0('0xd')]:null,_0x55ab01[_0x78f0('0x11')]?_0x55ab01['user'][_0x78f0('0xc')]:null,_0x4833be?util[_0x78f0('0x25')](_0x4833be,![],null):''));}}));_0x210b7b['use'](ewinston[_0x78f0('0x18')]({'winstonInstance':_0x58d02c,'meta':![],'statusLevels':!![],'msg':function(_0x52f078,_0x41b5b5){var _0x598fa0=_0x78f0('0x26');if(_0x52f078['body']&&_0x52f078[_0x78f0('0x1b')][_0x78f0('0x27')]&&_0x52f078[_0x78f0('0x1b')]['agent_id']){_0x598fa0='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x78f0('0x1d')](_0x598fa0,_0x52f078[_0x78f0('0x1e')],_0x52f078['headers']['x-forwarded-for']?_0x52f078[_0x78f0('0x1f')][_0x78f0('0x20')]:_0x52f078['connection'][_0x78f0('0x22')]||_0x52f078['ip'],_0x52f078[_0x78f0('0x28')],_0x41b5b5[_0x78f0('0x23')],_0x41b5b5[_0x78f0('0x24')],_0x52f078['user']?_0x52f078['user']['id']:null,_0x52f078['user']?_0x52f078[_0x78f0('0x11')][_0x78f0('0xd')]:null,_0x52f078['user']?_0x52f078['user'][_0x78f0('0xc')]:null,_0x52f078[_0x78f0('0x1b')]&&_0x52f078[_0x78f0('0x1b')][_0x78f0('0x27')]?_0x52f078[_0x78f0('0x1b')][_0x78f0('0x27')]:_0x78f0('0x29'),_0x52f078[_0x78f0('0x1b')]&&_0x52f078[_0x78f0('0x1b')][_0x78f0('0x2a')]?_0x52f078[_0x78f0('0x1b')]['agent_id']:'',_0x52f078[_0x78f0('0x1b')]&&_0x52f078['body'][_0x78f0('0x2b')]?_0x52f078[_0x78f0('0x1b')][_0x78f0('0x2b')]:'');},'ignoreRoute':function(_0x409afc){var _0xf5f32a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xf5f32a['test'](_0x409afc[_0x78f0('0x28')]);}}));return _0x56c271();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x2ef6=['setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','use','logger','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','%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)','remoteAddress','role','other','agent_name','test'];(function(_0x593f47,_0x60b49f){var _0x246911=function(_0xe8416){while(--_0xe8416){_0x593f47['push'](_0x593f47['shift']());}};_0x246911(++_0x60b49f);}(_0x2ef6,0x115));var _0x62ef=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x2ef6[_0x527824];return _0xc8b8ed;};var fs=require(_0x62ef('0x0'));var _=require(_0x62ef('0x1'));var ewinston=require(_0x62ef('0x2'));var path=require(_0x62ef('0x3'));var util=require('util');var fileLogger=require(_0x62ef('0x4'))[_0x62ef('0x5')];var safeTemplate=require('./safe-template')[_0x62ef('0x6')];var maskSensitiveData=require(_0x62ef('0x7'))[_0x62ef('0x8')];function ClientSideLogger(){function _0x1e8536(_0x26fe0b){var _0x10e264=path[_0x62ef('0x9')](_0x62ef('0xa'),_0x62ef('0xb'),'xcally');var _0x2f7ed2=path[_0x62ef('0x9')](_0x62ef('0xc'),_0x26fe0b['role']+'-'+_0x26fe0b[_0x62ef('0xd')]);return fs[_0x62ef('0xe')](path[_0x62ef('0x9')](_0x10e264,_0x2f7ed2))[_0x62ef('0xf')](function(){var _0x3b65d4=fileLogger(_0x62ef('0xc'),path[_0x62ef('0x9')](_0x10e264,_0x2f7ed2));return _0x3b65d4;})[_0x62ef('0x10')](function(_0x68f969){throw _0x68f969;});}this[_0x62ef('0xb')]=function(_0x4afd80,_0x550253,_0x2cb792,_0xa59a36){return _0x1e8536(_0x4afd80[_0x62ef('0x11')])[_0x62ef('0xf')](function(_0xaa9844){var _0xbc4c2a=_0xaa9844[_0x550253];return _0xbc4c2a;})[_0x62ef('0xf')](function(_0x882277){var _0x4e6842=_0x4afd80['user']?_0x4afd80['user']['id']:_0x62ef('0x12');var _0x54bf4d=_0xa59a36[_0x62ef('0x13')];var _0x4686eb=_0xa59a36[_0x62ef('0x14')];var _0x1cbbfe=new Date(Number(_0x4686eb));return _0x882277(_0x4e6842,_0x1cbbfe,_0x2cb792,_0x54bf4d);})[_0x62ef('0x10')](function(_0x3ea16e){fileLogger('client')[_0x62ef('0x15')](_0x3ea16e);});};}function setupLoggers(_0x22b307){return new Promise(function(_0x2ec21c){var _0x3b5f3f=new ClientSideLogger();var _0x126bc0=fileLogger(_0x62ef('0x16'));var _0x3b2134=fileLogger(_0x62ef('0x17'));_0x22b307['set']('client-side-logger',_0x3b5f3f);_0x22b307[_0x62ef('0x18')](ewinston[_0x62ef('0x19')]({'winstonInstance':_0x126bc0,'meta':![],'statusLevels':!![],'msg':function(_0x431fa5,_0x57168e){var _0x5de424='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x431fa5[_0x62ef('0x1a')])){_0x5de424+=_0x62ef('0x1b');var _0x441967=_0x431fa5[_0x62ef('0x1a')];maskSensitiveData(_0x441967);}return safeTemplate(util[_0x62ef('0x1c')](_0x5de424,_0x431fa5[_0x62ef('0x1d')],_0x431fa5[_0x62ef('0x1e')]['x-forwarded-for']?_0x431fa5[_0x62ef('0x1e')][_0x62ef('0x1f')]:_0x431fa5[_0x62ef('0x20')]['remoteAddress']||_0x431fa5['ip'],_0x431fa5[_0x62ef('0x21')],_0x57168e[_0x62ef('0x22')],_0x57168e[_0x62ef('0x23')],_0x431fa5[_0x62ef('0x11')]?_0x431fa5[_0x62ef('0x11')]['id']:null,_0x431fa5[_0x62ef('0x11')]?_0x431fa5[_0x62ef('0x11')][_0x62ef('0xd')]:null,_0x431fa5['user']?_0x431fa5[_0x62ef('0x11')]['role']:null,_0x441967?util['inspect'](_0x441967,![],null):''));}}));_0x22b307[_0x62ef('0x18')](ewinston[_0x62ef('0x19')]({'winstonInstance':_0x3b2134,'meta':![],'statusLevels':!![],'msg':function(_0x342566,_0x13e9e1){var _0x3ea97d=_0x62ef('0x24');if(_0x342566[_0x62ef('0x1a')]&&_0x342566[_0x62ef('0x1a')][_0x62ef('0x25')]&&_0x342566[_0x62ef('0x1a')][_0x62ef('0x26')]){_0x3ea97d=_0x62ef('0x27');}return util[_0x62ef('0x1c')](_0x3ea97d,_0x342566[_0x62ef('0x1d')],_0x342566[_0x62ef('0x1e')][_0x62ef('0x1f')]?_0x342566[_0x62ef('0x1e')]['x-forwarded-for']:_0x342566['connection'][_0x62ef('0x28')]||_0x342566['ip'],_0x342566['url'],_0x13e9e1[_0x62ef('0x22')],_0x13e9e1[_0x62ef('0x23')],_0x342566[_0x62ef('0x11')]?_0x342566['user']['id']:null,_0x342566['user']?_0x342566[_0x62ef('0x11')][_0x62ef('0xd')]:null,_0x342566[_0x62ef('0x11')]?_0x342566[_0x62ef('0x11')][_0x62ef('0x29')]:null,_0x342566[_0x62ef('0x1a')]&&_0x342566[_0x62ef('0x1a')][_0x62ef('0x25')]?_0x342566[_0x62ef('0x1a')][_0x62ef('0x25')]:_0x62ef('0x2a'),_0x342566['body']&&_0x342566['body'][_0x62ef('0x26')]?_0x342566[_0x62ef('0x1a')][_0x62ef('0x26')]:'',_0x342566['body']&&_0x342566['body']['agent_name']?_0x342566[_0x62ef('0x1a')][_0x62ef('0x2b')]:'');},'ignoreRoute':function(_0x3739f3){var _0x2f2bf5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2f2bf5[_0x62ef('0x2c')](_0x3739f3[_0x62ef('0x21')]);}}));return _0x2ec21c();});}exports[_0x62ef('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index d7ae227..fab9e15 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa1b=['Console','warn','transports','File','error','%s-%s','consoleLogger','fileLogger','path','moment','debugLevel','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','length','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger'];(function(_0x18a0f,_0x18a71e){var _0xaf97f5=function(_0x1ad70e){while(--_0x1ad70e){_0x18a0f['push'](_0x18a0f['shift']());}};_0xaf97f5(++_0x18a71e);}(_0xaa1b,0xf6));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0xbaa1('0x0'));var util=require('util');var moment=require(_0xbaa1('0x1'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0xbaa1('0x2')]['toLowerCase']():_0xbaa1('0x3');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':_0xbaa1('0x4'),'warn':_0xbaa1('0x5'),'info':_0xbaa1('0x6'),'print':_0xbaa1('0x7'),'success':_0xbaa1('0x8'),'http':_0xbaa1('0x9'),'verbose':_0xbaa1('0xa'),'debug':_0xbaa1('0xb'),'silly':'bold\x20cyan'};winston[_0xbaa1('0xc')](XC_LOG_COLORS);function getLogFileName(_0x390586,_0x6be37c,_0x28d709){var _0x5c9828=_0x390586||'/var/log/xcally';return path['join'](_0x5c9828,util['format']('%s-%s.log',_0x6be37c,_0x28d709));}function formatter(_0x4c5324,_0x1b66d3){_0x1b66d3[_0xbaa1('0xd')]=_0x1b66d3['message']['replace'](/@@{/g,_0xbaa1('0xe'))[_0xbaa1('0xf')](/}@@/g,_0xbaa1('0x10'))[_0xbaa1('0xf')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0xbaa1('0x11'),moment()[_0xbaa1('0x12')](_0xbaa1('0x13')),_0x1b66d3[_0xbaa1('0x14')][_0xbaa1('0x15')](),_0x4c5324,_0x1b66d3['message']);}function fileFormat(_0x1f3f8e,_0x27092b){_0x27092b['message']=_0x27092b[_0xbaa1('0xd')][_0xbaa1('0xf')](/@@{/g,'{{{')[_0xbaa1('0xf')](/}@@/g,_0xbaa1('0x10'))[_0xbaa1('0xf')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xdc009f=_0x27092b['meta']&&Object['keys'](_0x27092b['meta'])[_0xbaa1('0x16')]?'\x0a\x09'+JSON['stringify'](_0x27092b[_0xbaa1('0x17')]):'';return util['format'](_0xbaa1('0x18'),moment()['format'](_0xbaa1('0x13')),_0x27092b[_0xbaa1('0x14')][_0xbaa1('0x15')](),_0x1f3f8e,_0x27092b[_0xbaa1('0xd')],_0xdc009f);}function consoleLogger(){var _0x312f26=new winston[(_0xbaa1('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xbaa1('0x1a'))]({'level':_0xbaa1('0x1b'),'json':![],'formatter':function(_0x5bdf8e){return formatter('',_0x5bdf8e);}})]});return _0x312f26;}function fileLogger(_0x6c4a91,_0x4e9ae5){var _0xbb400a=new winston[(_0xbaa1('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbaa1('0x1c'))][(_0xbaa1('0x1d'))]({'name':util[_0xbaa1('0x12')]('%s-%s',_0x6c4a91,_0xbaa1('0x1e')),'filename':getLogFileName(_0x4e9ae5,_0x6c4a91,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x39c90e){return fileFormat(_0x6c4a91,_0x39c90e);}}),new winston[(_0xbaa1('0x1c'))]['File']({'name':util['format'](_0xbaa1('0x1f'),_0x6c4a91,debugLevel),'filename':getLogFileName(_0x4e9ae5,_0x6c4a91,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xdf0e33){return fileFormat(_0x6c4a91,_0xdf0e33);}}),new winston[(_0xbaa1('0x1c'))][(_0xbaa1('0x1a'))]({'level':_0xbaa1('0x1b'),'json':![],'formatter':function(_0x2f1368){return fileFormat(_0x6c4a91,_0x2f1368);}})]});return _0xbb400a;}exports[_0xbaa1('0x20')]=consoleLogger;exports[_0xbaa1('0x21')]=fileLogger; \ No newline at end of file +var _0xd07b=['toLowerCase','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','level','Logger','Console','warn','transports','File','%s-%s','error','consoleLogger','path','util','moment','winston','../config/environment','debugLevel'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xd07b,0x1c2));var _0xbd07=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd07b[_0x5b644e];return _0x49c6bf;};'use strict';var path=require(_0xbd07('0x0'));var util=require(_0xbd07('0x1'));var moment=require(_0xbd07('0x2'));var winston=require(_0xbd07('0x3'));var config=require(_0xbd07('0x4'));var debugLevel=config['debugLevel']?config[_0xbd07('0x5')][_0xbd07('0x6')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xbd07('0x7'),'error':_0xbd07('0x8'),'warn':_0xbd07('0x9'),'info':'white','print':_0xbd07('0xa'),'success':_0xbd07('0xb'),'http':_0xbd07('0xc'),'verbose':'bold\x20magenta','debug':_0xbd07('0xd'),'silly':_0xbd07('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x219326,_0x5bc590,_0x191a40){var _0x19dd03=_0x219326||_0xbd07('0xf');return path[_0xbd07('0x10')](_0x19dd03,util[_0xbd07('0x11')](_0xbd07('0x12'),_0x5bc590,_0x191a40));}function formatter(_0x12ad19,_0x3f7cdd){_0x3f7cdd['message']=_0x3f7cdd[_0xbd07('0x13')][_0xbd07('0x14')](/@@{/g,_0xbd07('0x15'))[_0xbd07('0x14')](/}@@/g,_0xbd07('0x16'))[_0xbd07('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xbd07('0x11')](_0xbd07('0x17')),_0x3f7cdd['level'][_0xbd07('0x18')](),_0x12ad19,_0x3f7cdd[_0xbd07('0x13')]);}function fileFormat(_0x4c4907,_0x4a0d82){_0x4a0d82[_0xbd07('0x13')]=_0x4a0d82['message'][_0xbd07('0x14')](/@@{/g,_0xbd07('0x15'))[_0xbd07('0x14')](/}@@/g,_0xbd07('0x16'))[_0xbd07('0x14')](/@{/g,'{{')[_0xbd07('0x14')](/}@/g,'}}');var _0x5a9f5b=_0x4a0d82[_0xbd07('0x19')]&&Object[_0xbd07('0x1a')](_0x4a0d82[_0xbd07('0x19')])[_0xbd07('0x1b')]?'\x0a\x09'+JSON[_0xbd07('0x1c')](_0x4a0d82[_0xbd07('0x19')]):'';return util[_0xbd07('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xbd07('0x11')](_0xbd07('0x17')),_0x4a0d82[_0xbd07('0x1d')][_0xbd07('0x18')](),_0x4c4907,_0x4a0d82['message'],_0x5a9f5b);}function consoleLogger(){var _0x2517b2=new winston[(_0xbd07('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xbd07('0x1f'))]({'level':_0xbd07('0x20'),'json':![],'formatter':function(_0x3784f7){return formatter('',_0x3784f7);}})]});return _0x2517b2;}function fileLogger(_0xf72962,_0x48aa85){var _0x26314a=new winston[(_0xbd07('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd07('0x21'))][(_0xbd07('0x22'))]({'name':util[_0xbd07('0x11')](_0xbd07('0x23'),_0xf72962,'error'),'filename':getLogFileName(_0x48aa85,_0xf72962,_0xbd07('0x24')),'level':_0xbd07('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x34896c){return fileFormat(_0xf72962,_0x34896c);}}),new winston['transports'][(_0xbd07('0x22'))]({'name':util[_0xbd07('0x11')](_0xbd07('0x23'),_0xf72962,debugLevel),'filename':getLogFileName(_0x48aa85,_0xf72962,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x56b7c0){return fileFormat(_0xf72962,_0x56b7c0);}}),new winston[(_0xbd07('0x21'))][(_0xbd07('0x1f'))]({'level':_0xbd07('0x20'),'json':![],'formatter':function(_0x2799fd){return fileFormat(_0xf72962,_0x2799fd);}})]});return _0x26314a;}exports[_0xbd07('0x25')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 921081d..80f764c 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 _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x15a106,_0xbc5c2a){var _0xe9013a=function(_0x443fb7){while(--_0x443fb7){_0x15a106['push'](_0x15a106['shift']());}};_0xe9013a(++_0xbc5c2a);}(_0xadb5,0xad));var _0x5adb=function(_0x2e7848,_0xf36cd){_0x2e7848=_0x2e7848-0x0;var _0x4b4d3a=_0xadb5[_0x2e7848];return _0x4b4d3a;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x4473a3,_0x1ce4f3){var _0x244c6b=function(_0x3269ab){while(--_0x3269ab){_0x4473a3['push'](_0x4473a3['shift']());}};_0x244c6b(++_0x1ce4f3);}(_0x0b0e,0x187));var _0xe0b0=function(_0xafdec6,_0x3d94df){_0xafdec6=_0xafdec6-0x0;var _0x372bdb=_0x0b0e[_0xafdec6];return _0x372bdb;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index bf9ce27..0608865 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 _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x30569b,_0xebfd7c){var _0x2f0ca5=function(_0x5a428c){while(--_0x5a428c){_0x30569b['push'](_0x30569b['shift']());}};_0x2f0ca5(++_0xebfd7c);}(_0x4024,0x89));var _0x4402=function(_0x2931b7,_0x1f9f98){_0x2931b7=_0x2931b7-0x0;var _0x4dd9c1=_0x4024[_0x2931b7];return _0x4dd9c1;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x5eb8=['{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate'];(function(_0x1a05a5,_0x453fba){var _0x65218e=function(_0x137b25){while(--_0x137b25){_0x1a05a5['push'](_0x1a05a5['shift']());}};_0x65218e(++_0x453fba);}(_0x5eb8,0xb0));var _0x85eb=function(_0x39ad4c,_0x2fa27e){_0x39ad4c=_0x39ad4c-0x0;var _0xf3314d=_0x5eb8[_0x39ad4c];return _0xf3314d;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x57e9bc){return _0x57e9bc==='{{'?_0x85eb('0x0'):_0x85eb('0x1');}function safeTemplate(_0x393a8a){var _0xd2f5dc=_0x393a8a;if(typeof _0x393a8a===_0x85eb('0x2')){_0xd2f5dc=_0x393a8a[_0x85eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x85eb('0x4')](_0x393a8a)){_0xd2f5dc=_0x393a8a[_0x85eb('0x5')](function(_0x3c5798){return safeTemplate(_0x3c5798);});}else if(_[_0x85eb('0x6')](_0x393a8a)){_0xd2f5dc=Object[_0x85eb('0x7')](_0x393a8a)[_0x85eb('0x8')](function(_0x4a8814,_0x16d7b9){_0x4a8814[_0x16d7b9]=safeTemplate(_0x393a8a[_0x16d7b9]);return _0x4a8814;},{});}return _0xd2f5dc;}module[_0x85eb('0x9')][_0x85eb('0xa')]=safeTemplate; \ No newline at end of file